pda-explorer-react 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs ADDED
@@ -0,0 +1,48 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("react/jsx-runtime"),O=require("react");require("react-dom");function fe(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=fe(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var E_={value:()=>{}};function ir(){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 $n(n)}function $n(e){this._=e}function S_(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}$n.prototype=ir.prototype={constructor:$n,on:function(e,t){var n=this._,r=S_(e+"",n),i,o=-1,a=r.length;if(arguments.length<2){for(;++o<a;)if((i=(e=r[o]).type)&&(i=C_(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<a;)if(i=(e=r[o]).type)n[i]=Jc(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Jc(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new $n(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,o;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,o=r.length;i<o;++i)r[i].value.apply(t,n)}};function C_(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function Jc(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=E_,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Vu="http://www.w3.org/1999/xhtml";const el={svg:"http://www.w3.org/2000/svg",xhtml:Vu,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function or(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),el.hasOwnProperty(t)?{space:el[t],local:e}:e}function N_(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Vu&&t.documentElement.namespaceURI===Vu?t.createElement(e):t.createElementNS(n,e)}}function A_(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function hv(e){var t=or(e);return(t.local?A_:N_)(t)}function I_(){}function uc(e){return e==null?I_:function(){return this.querySelector(e)}}function M_(e){typeof e!="function"&&(e=uc(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],a=o.length,s=r[i]=new Array(a),u,l,c=0;c<a;++c)(u=o[c])&&(l=e.call(u,u.__data__,c,o))&&("__data__"in u&&(l.__data__=u.__data__),s[c]=l);return new be(r,this._parents)}function R_(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function q_(){return[]}function pv(e){return e==null?q_:function(){return this.querySelectorAll(e)}}function T_(e){return function(){return R_(e.apply(this,arguments))}}function P_(e){typeof e=="function"?e=T_(e):e=pv(e);for(var t=this._groups,n=t.length,r=[],i=[],o=0;o<n;++o)for(var a=t[o],s=a.length,u,l=0;l<s;++l)(u=a[l])&&(r.push(e.call(u,u.__data__,l,a)),i.push(u));return new be(r,i)}function gv(e){return function(){return this.matches(e)}}function vv(e){return function(t){return t.matches(e)}}var k_=Array.prototype.find;function O_(e){return function(){return k_.call(this.children,e)}}function L_(){return this.firstElementChild}function D_(e){return this.select(e==null?L_:O_(typeof e=="function"?e:vv(e)))}var $_=Array.prototype.filter;function j_(){return Array.from(this.children)}function F_(e){return function(){return $_.call(this.children,e)}}function B_(e){return this.selectAll(e==null?j_:F_(typeof e=="function"?e:vv(e)))}function z_(e){typeof e!="function"&&(e=gv(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],a=o.length,s=r[i]=[],u,l=0;l<a;++l)(u=o[l])&&e.call(u,u.__data__,l,o)&&s.push(u);return new be(r,this._parents)}function mv(e){return new Array(e.length)}function H_(){return new be(this._enter||this._groups.map(mv),this._parents)}function Hn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Hn.prototype={constructor:Hn,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 V_(e){return function(){return e}}function G_(e,t,n,r,i,o){for(var a=0,s,u=t.length,l=o.length;a<l;++a)(s=t[a])?(s.__data__=o[a],r[a]=s):n[a]=new Hn(e,o[a]);for(;a<u;++a)(s=t[a])&&(i[a]=s)}function U_(e,t,n,r,i,o,a){var s,u,l=new Map,c=t.length,f=o.length,d=new Array(c),h;for(s=0;s<c;++s)(u=t[s])&&(d[s]=h=a.call(u,u.__data__,s,t)+"",l.has(h)?i[s]=u:l.set(h,u));for(s=0;s<f;++s)h=a.call(e,o[s],s,o)+"",(u=l.get(h))?(r[s]=u,u.__data__=o[s],l.delete(h)):n[s]=new Hn(e,o[s]);for(s=0;s<c;++s)(u=t[s])&&l.get(d[s])===u&&(i[s]=u)}function K_(e){return e.__data__}function Y_(e,t){if(!arguments.length)return Array.from(this,K_);var n=t?U_:G_,r=this._parents,i=this._groups;typeof e!="function"&&(e=V_(e));for(var o=i.length,a=new Array(o),s=new Array(o),u=new Array(o),l=0;l<o;++l){var c=r[l],f=i[l],d=f.length,h=W_(e.call(c,c&&c.__data__,l,r)),p=h.length,g=s[l]=new Array(p),v=a[l]=new Array(p),m=u[l]=new Array(d);n(c,f,g,v,m,h,t);for(var b=0,y=0,_,C;b<p;++b)if(_=g[b]){for(b>=y&&(y=b+1);!(C=v[y])&&++y<p;);_._next=C||null}}return a=new be(a,r),a._enter=s,a._exit=u,a}function W_(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function X_(){return new be(this._exit||this._groups.map(mv),this._parents)}function Z_(e,t,n){var r=this.enter(),i=this,o=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?o.remove():n(o),r&&i?r.merge(i).order():i}function Q_(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,o=r.length,a=Math.min(i,o),s=new Array(i),u=0;u<a;++u)for(var l=n[u],c=r[u],f=l.length,d=s[u]=new Array(f),h,p=0;p<f;++p)(h=l[p]||c[p])&&(d[p]=h);for(;u<i;++u)s[u]=n[u];return new be(s,this._parents)}function J_(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,o=r[i],a;--i>=0;)(a=r[i])&&(o&&a.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(a,o),o=a);return this}function eb(e){e||(e=tb);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var a=n[o],s=a.length,u=i[o]=new Array(s),l,c=0;c<s;++c)(l=a[c])&&(u[c]=l);u.sort(t)}return new be(i,this._parents).order()}function tb(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function nb(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function rb(){return Array.from(this)}function ib(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null}function ob(){let e=0;for(const t of this)++e;return e}function ab(){return!this.node()}function sb(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],o=0,a=i.length,s;o<a;++o)(s=i[o])&&e.call(s,s.__data__,o,i);return this}function ub(e){return function(){this.removeAttribute(e)}}function cb(e){return function(){this.removeAttributeNS(e.space,e.local)}}function lb(e,t){return function(){this.setAttribute(e,t)}}function fb(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function db(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function hb(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 pb(e,t){var n=or(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?cb:ub:typeof t=="function"?n.local?hb:db:n.local?fb:lb)(n,t))}function yv(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function gb(e){return function(){this.style.removeProperty(e)}}function vb(e,t,n){return function(){this.style.setProperty(e,t,n)}}function mb(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function yb(e,t,n){return arguments.length>1?this.each((t==null?gb:typeof t=="function"?mb:vb)(e,t,n??"")):Rt(this.node(),e)}function Rt(e,t){return e.style.getPropertyValue(t)||yv(e).getComputedStyle(e,null).getPropertyValue(t)}function _b(e){return function(){delete this[e]}}function bb(e,t){return function(){this[e]=t}}function xb(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function wb(e,t){return arguments.length>1?this.each((t==null?_b:typeof t=="function"?xb:bb)(e,t)):this.node()[e]}function _v(e){return e.trim().split(/^|\s+/)}function cc(e){return e.classList||new bv(e)}function bv(e){this._node=e,this._names=_v(e.getAttribute("class")||"")}bv.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 xv(e,t){for(var n=cc(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function wv(e,t){for(var n=cc(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function Eb(e){return function(){xv(this,e)}}function Sb(e){return function(){wv(this,e)}}function Cb(e,t){return function(){(t.apply(this,arguments)?xv:wv)(this,e)}}function Nb(e,t){var n=_v(e+"");if(arguments.length<2){for(var r=cc(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?Cb:t?Eb:Sb)(n,t))}function Ab(){this.textContent=""}function Ib(e){return function(){this.textContent=e}}function Mb(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Rb(e){return arguments.length?this.each(e==null?Ab:(typeof e=="function"?Mb:Ib)(e)):this.node().textContent}function qb(){this.innerHTML=""}function Tb(e){return function(){this.innerHTML=e}}function Pb(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function kb(e){return arguments.length?this.each(e==null?qb:(typeof e=="function"?Pb:Tb)(e)):this.node().innerHTML}function Ob(){this.nextSibling&&this.parentNode.appendChild(this)}function Lb(){return this.each(Ob)}function Db(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function $b(){return this.each(Db)}function jb(e){var t=typeof e=="function"?e:hv(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Fb(){return null}function Bb(e,t){var n=typeof e=="function"?e:hv(e),r=t==null?Fb:typeof t=="function"?t:uc(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function zb(){var e=this.parentNode;e&&e.removeChild(this)}function Hb(){return this.each(zb)}function Vb(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Gb(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ub(e){return this.select(e?Gb:Vb)}function Kb(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Yb(e){return function(t){e.call(this,t,this.__data__)}}function Wb(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 Xb(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,o;n<i;++n)o=t[n],(!e.type||o.type===e.type)&&o.name===e.name?this.removeEventListener(o.type,o.listener,o.options):t[++r]=o;++r?t.length=r:delete this.__on}}}function Zb(e,t,n){return function(){var r=this.__on,i,o=Yb(t);if(r){for(var a=0,s=r.length;a<s;++a)if((i=r[a]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=o,i.options=n),i.value=t;return}}this.addEventListener(e.type,o,n),i={type:e.type,name:e.name,value:t,listener:o,options:n},r?r.push(i):this.__on=[i]}}function Qb(e,t,n){var r=Wb(e+""),i,o=r.length,a;if(arguments.length<2){var s=this.node().__on;if(s){for(var u=0,l=s.length,c;u<l;++u)for(i=0,c=s[u];i<o;++i)if((a=r[i]).type===c.type&&a.name===c.name)return c.value}return}for(s=t?Zb:Xb,i=0;i<o;++i)this.each(s(r[i],t,n));return this}function Ev(e,t,n){var r=yv(e),i=r.CustomEvent;typeof i=="function"?i=new i(t,n):(i=r.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function Jb(e,t){return function(){return Ev(this,e,t)}}function ex(e,t){return function(){return Ev(this,e,t.apply(this,arguments))}}function tx(e,t){return this.each((typeof t=="function"?ex:Jb)(e,t))}function*nx(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,o=r.length,a;i<o;++i)(a=r[i])&&(yield a)}var Sv=[null];function be(e,t){this._groups=e,this._parents=t}function fn(){return new be([[document.documentElement]],Sv)}function rx(){return this}be.prototype=fn.prototype={constructor:be,select:M_,selectAll:P_,selectChild:D_,selectChildren:B_,filter:z_,data:Y_,enter:H_,exit:X_,join:Z_,merge:Q_,selection:rx,order:J_,sort:eb,call:nb,nodes:rb,node:ib,size:ob,empty:ab,each:sb,attr:pb,style:yb,property:wb,classed:Nb,text:Rb,html:kb,raise:Lb,lower:$b,append:jb,insert:Bb,remove:Hb,clone:Ub,datum:Kb,on:Qb,dispatch:tx,[Symbol.iterator]:nx};function _e(e){return typeof e=="string"?new be([[document.querySelector(e)]],[document.documentElement]):new be([[e]],Sv)}function ix(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Se(e,t){if(e=ix(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}const ox={passive:!1},tn={capture:!0,passive:!1};function Dr(e){e.stopImmediatePropagation()}function It(e){e.preventDefault(),e.stopImmediatePropagation()}function Cv(e){var t=e.document.documentElement,n=_e(e).on("dragstart.drag",It,tn);"onselectstart"in t?n.on("selectstart.drag",It,tn):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Nv(e,t){var n=e.document.documentElement,r=_e(e).on("dragstart.drag",null);t&&(r.on("click.drag",It,tn),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 Cn=e=>()=>e;function Gu(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:o,x:a,y:s,dx:u,dy:l,dispatch:c}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:c}})}Gu.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function ax(e){return!e.ctrlKey&&!e.button}function sx(){return this.parentNode}function ux(e,t){return t??{x:e.x,y:e.y}}function cx(){return navigator.maxTouchPoints||"ontouchstart"in this}function Av(){var e=ax,t=sx,n=ux,r=cx,i={},o=ir("start","drag","end"),a=0,s,u,l,c,f=0;function d(_){_.on("mousedown.drag",h).filter(r).on("touchstart.drag",v).on("touchmove.drag",m,ox).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(_,C){if(!(c||!e.call(this,_,C))){var x=y(this,t.call(this,_,C),_,C,"mouse");x&&(_e(_.view).on("mousemove.drag",p,tn).on("mouseup.drag",g,tn),Cv(_.view),Dr(_),l=!1,s=_.clientX,u=_.clientY,x("start",_))}}function p(_){if(It(_),!l){var C=_.clientX-s,x=_.clientY-u;l=C*C+x*x>f}i.mouse("drag",_)}function g(_){_e(_.view).on("mousemove.drag mouseup.drag",null),Nv(_.view,l),It(_),i.mouse("end",_)}function v(_,C){if(e.call(this,_,C)){var x=_.changedTouches,E=t.call(this,_,C),A=x.length,q,D;for(q=0;q<A;++q)(D=y(this,E,_,C,x[q].identifier,x[q]))&&(Dr(_),D("start",_,x[q]))}}function m(_){var C=_.changedTouches,x=C.length,E,A;for(E=0;E<x;++E)(A=i[C[E].identifier])&&(It(_),A("drag",_,C[E]))}function b(_){var C=_.changedTouches,x=C.length,E,A;for(c&&clearTimeout(c),c=setTimeout(function(){c=null},500),E=0;E<x;++E)(A=i[C[E].identifier])&&(Dr(_),A("end",_,C[E]))}function y(_,C,x,E,A,q){var D=o.copy(),N=Se(q||x,C),R,L,w;if((w=n.call(_,new Gu("beforestart",{sourceEvent:x,target:d,identifier:A,active:a,x:N[0],y:N[1],dx:0,dy:0,dispatch:D}),E))!=null)return R=w.x-N[0]||0,L=w.y-N[1]||0,function P(I,k,T){var M=N,$;switch(I){case"start":i[A]=P,$=a++;break;case"end":delete i[A],--a;case"drag":N=Se(T||k,C),$=a;break}D.call(I,_,new Gu(I,{sourceEvent:k,subject:w,target:d,identifier:A,active:$,x:N[0]+R,y:N[1]+L,dx:N[0]-M[0],dy:N[1]-M[1],dispatch:D}),E)}}return d.filter=function(_){return arguments.length?(e=typeof _=="function"?_:Cn(!!_),d):e},d.container=function(_){return arguments.length?(t=typeof _=="function"?_:Cn(_),d):t},d.subject=function(_){return arguments.length?(n=typeof _=="function"?_:Cn(_),d):n},d.touchable=function(_){return arguments.length?(r=typeof _=="function"?_:Cn(!!_),d):r},d.on=function(){var _=o.on.apply(o,arguments);return _===o?d:_},d.clickDistance=function(_){return arguments.length?(f=(_=+_)*_,d):Math.sqrt(f)},d}function lc(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Iv(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function dn(){}var nn=.7,Vn=1/nn,Mt="\\s*([+-]?\\d+)\\s*",rn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Oe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",lx=/^#([0-9a-f]{3,8})$/,fx=new RegExp(`^rgb\\(${Mt},${Mt},${Mt}\\)$`),dx=new RegExp(`^rgb\\(${Oe},${Oe},${Oe}\\)$`),hx=new RegExp(`^rgba\\(${Mt},${Mt},${Mt},${rn}\\)$`),px=new RegExp(`^rgba\\(${Oe},${Oe},${Oe},${rn}\\)$`),gx=new RegExp(`^hsl\\(${rn},${Oe},${Oe}\\)$`),vx=new RegExp(`^hsla\\(${rn},${Oe},${Oe},${rn}\\)$`),tl={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};lc(dn,gt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:nl,formatHex:nl,formatHex8:mx,formatHsl:yx,formatRgb:rl,toString:rl});function nl(){return this.rgb().formatHex()}function mx(){return this.rgb().formatHex8()}function yx(){return Mv(this).formatHsl()}function rl(){return this.rgb().formatRgb()}function gt(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=lx.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?il(t):n===3?new ve(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Nn(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Nn(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=fx.exec(e))?new ve(t[1],t[2],t[3],1):(t=dx.exec(e))?new ve(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=hx.exec(e))?Nn(t[1],t[2],t[3],t[4]):(t=px.exec(e))?Nn(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=gx.exec(e))?sl(t[1],t[2]/100,t[3]/100,1):(t=vx.exec(e))?sl(t[1],t[2]/100,t[3]/100,t[4]):tl.hasOwnProperty(e)?il(tl[e]):e==="transparent"?new ve(NaN,NaN,NaN,0):null}function il(e){return new ve(e>>16&255,e>>8&255,e&255,1)}function Nn(e,t,n,r){return r<=0&&(e=t=n=NaN),new ve(e,t,n,r)}function _x(e){return e instanceof dn||(e=gt(e)),e?(e=e.rgb(),new ve(e.r,e.g,e.b,e.opacity)):new ve}function Uu(e,t,n,r){return arguments.length===1?_x(e):new ve(e,t,n,r??1)}function ve(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}lc(ve,Uu,Iv(dn,{brighter(e){return e=e==null?Vn:Math.pow(Vn,e),new ve(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?nn:Math.pow(nn,e),new ve(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ve(ht(this.r),ht(this.g),ht(this.b),Gn(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:ol,formatHex:ol,formatHex8:bx,formatRgb:al,toString:al}));function ol(){return`#${ft(this.r)}${ft(this.g)}${ft(this.b)}`}function bx(){return`#${ft(this.r)}${ft(this.g)}${ft(this.b)}${ft((isNaN(this.opacity)?1:this.opacity)*255)}`}function al(){const e=Gn(this.opacity);return`${e===1?"rgb(":"rgba("}${ht(this.r)}, ${ht(this.g)}, ${ht(this.b)}${e===1?")":`, ${e})`}`}function Gn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ht(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ft(e){return e=ht(e),(e<16?"0":"")+e.toString(16)}function sl(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ce(e,t,n,r)}function Mv(e){if(e instanceof Ce)return new Ce(e.h,e.s,e.l,e.opacity);if(e instanceof dn||(e=gt(e)),!e)return new Ce;if(e instanceof Ce)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),a=NaN,s=o-i,u=(o+i)/2;return s?(t===o?a=(n-r)/s+(n<r)*6:n===o?a=(r-t)/s+2:a=(t-n)/s+4,s/=u<.5?o+i:2-o-i,a*=60):s=u>0&&u<1?0:a,new Ce(a,s,u,e.opacity)}function xx(e,t,n,r){return arguments.length===1?Mv(e):new Ce(e,t,n,r??1)}function Ce(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}lc(Ce,xx,Iv(dn,{brighter(e){return e=e==null?Vn:Math.pow(Vn,e),new Ce(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?nn:Math.pow(nn,e),new Ce(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new ve($r(e>=240?e-240:e+120,i,r),$r(e,i,r),$r(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Ce(ul(this.h),An(this.s),An(this.l),Gn(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=Gn(this.opacity);return`${e===1?"hsl(":"hsla("}${ul(this.h)}, ${An(this.s)*100}%, ${An(this.l)*100}%${e===1?")":`, ${e})`}`}}));function ul(e){return e=(e||0)%360,e<0?e+360:e}function An(e){return Math.max(0,Math.min(1,e||0))}function $r(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 fc=e=>()=>e;function wx(e,t){return function(n){return e+n*t}}function Ex(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 Sx(e){return(e=+e)==1?Rv:function(t,n){return n-t?Ex(t,n,e):fc(isNaN(t)?n:t)}}function Rv(e,t){var n=t-e;return n?wx(e,n):fc(isNaN(e)?t:e)}const Un=function e(t){var n=Sx(t);function r(i,o){var a=n((i=Uu(i)).r,(o=Uu(o)).r),s=n(i.g,o.g),u=n(i.b,o.b),l=Rv(i.opacity,o.opacity);return function(c){return i.r=a(c),i.g=s(c),i.b=u(c),i.opacity=l(c),i+""}}return r.gamma=e,r}(1);function Cx(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(o){for(i=0;i<n;++i)r[i]=e[i]*(1-o)+t[i]*o;return r}}function Nx(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Ax(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=new Array(r),o=new Array(n),a;for(a=0;a<r;++a)i[a]=Jt(e[a],t[a]);for(;a<n;++a)o[a]=t[a];return function(s){for(a=0;a<r;++a)o[a]=i[a](s);return o}}function Ix(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Pe(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Mx(e,t){var n={},r={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?n[i]=Jt(e[i],t[i]):r[i]=t[i];return function(o){for(i in n)r[i]=n[i](o);return r}}var Ku=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,jr=new RegExp(Ku.source,"g");function Rx(e){return function(){return e}}function qx(e){return function(t){return e(t)+""}}function qv(e,t){var n=Ku.lastIndex=jr.lastIndex=0,r,i,o,a=-1,s=[],u=[];for(e=e+"",t=t+"";(r=Ku.exec(e))&&(i=jr.exec(t));)(o=i.index)>n&&(o=t.slice(n,o),s[a]?s[a]+=o:s[++a]=o),(r=r[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,u.push({i:a,x:Pe(r,i)})),n=jr.lastIndex;return n<t.length&&(o=t.slice(n),s[a]?s[a]+=o:s[++a]=o),s.length<2?u[0]?qx(u[0].x):Rx(t):(t=u.length,function(l){for(var c=0,f;c<t;++c)s[(f=u[c]).i]=f.x(l);return s.join("")})}function Jt(e,t){var n=typeof t,r;return t==null||n==="boolean"?fc(t):(n==="number"?Pe:n==="string"?(r=gt(t))?(t=r,Un):qv:t instanceof gt?Un:t instanceof Date?Ix:Nx(t)?Cx:Array.isArray(t)?Ax:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Mx:Pe)(e,t)}var cl=180/Math.PI,Yu={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Tv(e,t,n,r,i,o){var a,s,u;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(u=e*n+t*r)&&(n-=e*u,r-=t*u),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,u/=s),e*r<t*n&&(e=-e,t=-t,u=-u,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(t,e)*cl,skewX:Math.atan(u)*cl,scaleX:a,scaleY:s}}var In;function Tx(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Yu:Tv(t.a,t.b,t.c,t.d,t.e,t.f)}function Px(e){return e==null||(In||(In=document.createElementNS("http://www.w3.org/2000/svg","g")),In.setAttribute("transform",e),!(e=In.transform.baseVal.consolidate()))?Yu:(e=e.matrix,Tv(e.a,e.b,e.c,e.d,e.e,e.f))}function Pv(e,t,n,r){function i(l){return l.length?l.pop()+" ":""}function o(l,c,f,d,h,p){if(l!==f||c!==d){var g=h.push("translate(",null,t,null,n);p.push({i:g-4,x:Pe(l,f)},{i:g-2,x:Pe(c,d)})}else(f||d)&&h.push("translate("+f+t+d+n)}function a(l,c,f,d){l!==c?(l-c>180?c+=360:c-l>180&&(l+=360),d.push({i:f.push(i(f)+"rotate(",null,r)-2,x:Pe(l,c)})):c&&f.push(i(f)+"rotate("+c+r)}function s(l,c,f,d){l!==c?d.push({i:f.push(i(f)+"skewX(",null,r)-2,x:Pe(l,c)}):c&&f.push(i(f)+"skewX("+c+r)}function u(l,c,f,d,h,p){if(l!==f||c!==d){var g=h.push(i(h)+"scale(",null,",",null,")");p.push({i:g-4,x:Pe(l,f)},{i:g-2,x:Pe(c,d)})}else(f!==1||d!==1)&&h.push(i(h)+"scale("+f+","+d+")")}return function(l,c){var f=[],d=[];return l=e(l),c=e(c),o(l.translateX,l.translateY,c.translateX,c.translateY,f,d),a(l.rotate,c.rotate,f,d),s(l.skewX,c.skewX,f,d),u(l.scaleX,l.scaleY,c.scaleX,c.scaleY,f,d),l=c=null,function(h){for(var p=-1,g=d.length,v;++p<g;)f[(v=d[p]).i]=v.x(h);return f.join("")}}}var kx=Pv(Tx,"px, ","px)","deg)"),Ox=Pv(Px,", ",")",")"),Lx=1e-12;function ll(e){return((e=Math.exp(e))+1/e)/2}function Dx(e){return((e=Math.exp(e))-1/e)/2}function $x(e){return((e=Math.exp(2*e))-1)/(e+1)}const jn=function e(t,n,r){function i(o,a){var s=o[0],u=o[1],l=o[2],c=a[0],f=a[1],d=a[2],h=c-s,p=f-u,g=h*h+p*p,v,m;if(g<Lx)m=Math.log(d/l)/t,v=function(E){return[s+E*h,u+E*p,l*Math.exp(t*E*m)]};else{var b=Math.sqrt(g),y=(d*d-l*l+r*g)/(2*l*n*b),_=(d*d-l*l-r*g)/(2*d*n*b),C=Math.log(Math.sqrt(y*y+1)-y),x=Math.log(Math.sqrt(_*_+1)-_);m=(x-C)/t,v=function(E){var A=E*m,q=ll(C),D=l/(n*b)*(q*$x(t*A+C)-Dx(C));return[s+D*h,u+D*p,l*q/ll(t*A+C)]}}return v.duration=m*1e3*t/Math.SQRT2,v}return i.rho=function(o){var a=Math.max(.001,+o),s=a*a,u=s*s;return e(a,s,u)},i}(Math.SQRT2,2,4);var qt=0,Gt=0,Ht=0,kv=1e3,Kn,Ut,Yn=0,vt=0,ar=0,on=typeof performance=="object"&&performance.now?performance:Date,Ov=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function dc(){return vt||(Ov(jx),vt=on.now()+ar)}function jx(){vt=0}function Wn(){this._call=this._time=this._next=null}Wn.prototype=Lv.prototype={constructor:Wn,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?dc():+n)+(t==null?0:+t),!this._next&&Ut!==this&&(Ut?Ut._next=this:Kn=this,Ut=this),this._call=e,this._time=n,Wu()},stop:function(){this._call&&(this._call=null,this._time=1/0,Wu())}};function Lv(e,t,n){var r=new Wn;return r.restart(e,t,n),r}function Fx(){dc(),++qt;for(var e=Kn,t;e;)(t=vt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--qt}function fl(){vt=(Yn=on.now())+ar,qt=Gt=0;try{Fx()}finally{qt=0,zx(),vt=0}}function Bx(){var e=on.now(),t=e-Yn;t>kv&&(ar-=t,Yn=e)}function zx(){for(var e,t=Kn,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:Kn=n);Ut=e,Wu(r)}function Wu(e){if(!qt){Gt&&(Gt=clearTimeout(Gt));var t=e-vt;t>24?(e<1/0&&(Gt=setTimeout(fl,e-on.now()-ar)),Ht&&(Ht=clearInterval(Ht))):(Ht||(Yn=on.now(),Ht=setInterval(Bx,kv)),qt=1,Ov(fl))}}function dl(e,t,n){var r=new Wn;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var Hx=ir("start","end","cancel","interrupt"),Vx=[],Dv=0,hl=1,Xu=2,Fn=3,pl=4,Zu=5,Bn=6;function sr(e,t,n,r,i,o){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;Gx(e,n,{name:t,index:r,group:i,on:Hx,tween:Vx,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Dv})}function hc(e,t){var n=Ie(e,t);if(n.state>Dv)throw new Error("too late; already scheduled");return n}function Le(e,t){var n=Ie(e,t);if(n.state>Fn)throw new Error("too late; already running");return n}function Ie(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Gx(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=Lv(o,0,n.time);function o(l){n.state=hl,n.timer.restart(a,n.delay,n.time),n.delay<=l&&a(l-n.delay)}function a(l){var c,f,d,h;if(n.state!==hl)return u();for(c in r)if(h=r[c],h.name===n.name){if(h.state===Fn)return dl(a);h.state===pl?(h.state=Bn,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[c]):+c<t&&(h.state=Bn,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[c])}if(dl(function(){n.state===Fn&&(n.state=pl,n.timer.restart(s,n.delay,n.time),s(l))}),n.state=Xu,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Xu){for(n.state=Fn,i=new Array(d=n.tween.length),c=0,f=-1;c<d;++c)(h=n.tween[c].value.call(e,e.__data__,n.index,n.group))&&(i[++f]=h);i.length=f+1}}function s(l){for(var c=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(u),n.state=Zu,1),f=-1,d=i.length;++f<d;)i[f].call(e,c);n.state===Zu&&(n.on.call("end",e,e.__data__,n.index,n.group),u())}function u(){n.state=Bn,n.timer.stop(),delete r[t];for(var l in r)return;delete e.__transition}}function zn(e,t){var n=e.__transition,r,i,o=!0,a;if(n){t=t==null?null:t+"";for(a in n){if((r=n[a]).name!==t){o=!1;continue}i=r.state>Xu&&r.state<Zu,r.state=Bn,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[a]}o&&delete e.__transition}}function Ux(e){return this.each(function(){zn(this,e)})}function Kx(e,t){var n,r;return function(){var i=Le(this,e),o=i.tween;if(o!==n){r=n=o;for(var a=0,s=r.length;a<s;++a)if(r[a].name===t){r=r.slice(),r.splice(a,1);break}}i.tween=r}}function Yx(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var o=Le(this,e),a=o.tween;if(a!==r){i=(r=a).slice();for(var s={name:t,value:n},u=0,l=i.length;u<l;++u)if(i[u].name===t){i[u]=s;break}u===l&&i.push(s)}o.tween=i}}function Wx(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Ie(this.node(),n).tween,i=0,o=r.length,a;i<o;++i)if((a=r[i]).name===e)return a.value;return null}return this.each((t==null?Kx:Yx)(n,e,t))}function pc(e,t,n){var r=e._id;return e.each(function(){var i=Le(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return Ie(i,r).value[t]}}function $v(e,t){var n;return(typeof t=="number"?Pe:t instanceof gt?Un:(n=gt(t))?(t=n,Un):qv)(e,t)}function Xx(e){return function(){this.removeAttribute(e)}}function Zx(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Qx(e,t,n){var r,i=n+"",o;return function(){var a=this.getAttribute(e);return a===i?null:a===r?o:o=t(r=a,n)}}function Jx(e,t,n){var r,i=n+"",o;return function(){var a=this.getAttributeNS(e.space,e.local);return a===i?null:a===r?o:o=t(r=a,n)}}function ew(e,t,n){var r,i,o;return function(){var a,s=n(this),u;return s==null?void this.removeAttribute(e):(a=this.getAttribute(e),u=s+"",a===u?null:a===r&&u===i?o:(i=u,o=t(r=a,s)))}}function tw(e,t,n){var r,i,o;return function(){var a,s=n(this),u;return s==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),u=s+"",a===u?null:a===r&&u===i?o:(i=u,o=t(r=a,s)))}}function nw(e,t){var n=or(e),r=n==="transform"?Ox:$v;return this.attrTween(e,typeof t=="function"?(n.local?tw:ew)(n,r,pc(this,"attr."+e,t)):t==null?(n.local?Zx:Xx)(n):(n.local?Jx:Qx)(n,r,t))}function rw(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function iw(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function ow(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&iw(e,o)),n}return i._value=t,i}function aw(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&rw(e,o)),n}return i._value=t,i}function sw(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=or(e);return this.tween(n,(r.local?ow:aw)(r,t))}function uw(e,t){return function(){hc(this,e).delay=+t.apply(this,arguments)}}function cw(e,t){return t=+t,function(){hc(this,e).delay=t}}function lw(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?uw:cw)(t,e)):Ie(this.node(),t).delay}function fw(e,t){return function(){Le(this,e).duration=+t.apply(this,arguments)}}function dw(e,t){return t=+t,function(){Le(this,e).duration=t}}function hw(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?fw:dw)(t,e)):Ie(this.node(),t).duration}function pw(e,t){if(typeof t!="function")throw new Error;return function(){Le(this,e).ease=t}}function gw(e){var t=this._id;return arguments.length?this.each(pw(t,e)):Ie(this.node(),t).ease}function vw(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Le(this,e).ease=n}}function mw(e){if(typeof e!="function")throw new Error;return this.each(vw(this._id,e))}function yw(e){typeof e!="function"&&(e=gv(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],a=o.length,s=r[i]=[],u,l=0;l<a;++l)(u=o[l])&&e.call(u,u.__data__,l,o)&&s.push(u);return new Ye(r,this._parents,this._name,this._id)}function _w(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,i=n.length,o=Math.min(r,i),a=new Array(r),s=0;s<o;++s)for(var u=t[s],l=n[s],c=u.length,f=a[s]=new Array(c),d,h=0;h<c;++h)(d=u[h]||l[h])&&(f[h]=d);for(;s<r;++s)a[s]=t[s];return new Ye(a,this._parents,this._name,this._id)}function bw(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 xw(e,t,n){var r,i,o=bw(t)?hc:Le;return function(){var a=o(this,e),s=a.on;s!==r&&(i=(r=s).copy()).on(t,n),a.on=i}}function ww(e,t){var n=this._id;return arguments.length<2?Ie(this.node(),n).on.on(e):this.each(xw(n,e,t))}function Ew(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Sw(){return this.on("end.remove",Ew(this._id))}function Cw(e){var t=this._name,n=this._id;typeof e!="function"&&(e=uc(e));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a<i;++a)for(var s=r[a],u=s.length,l=o[a]=new Array(u),c,f,d=0;d<u;++d)(c=s[d])&&(f=e.call(c,c.__data__,d,s))&&("__data__"in c&&(f.__data__=c.__data__),l[d]=f,sr(l[d],t,n,d,l,Ie(c,n)));return new Ye(o,this._parents,t,n)}function Nw(e){var t=this._name,n=this._id;typeof e!="function"&&(e=pv(e));for(var r=this._groups,i=r.length,o=[],a=[],s=0;s<i;++s)for(var u=r[s],l=u.length,c,f=0;f<l;++f)if(c=u[f]){for(var d=e.call(c,c.__data__,f,u),h,p=Ie(c,n),g=0,v=d.length;g<v;++g)(h=d[g])&&sr(h,t,n,g,d,p);o.push(d),a.push(c)}return new Ye(o,a,t,n)}var Aw=fn.prototype.constructor;function Iw(){return new Aw(this._groups,this._parents)}function Mw(e,t){var n,r,i;return function(){var o=Rt(this,e),a=(this.style.removeProperty(e),Rt(this,e));return o===a?null:o===n&&a===r?i:i=t(n=o,r=a)}}function jv(e){return function(){this.style.removeProperty(e)}}function Rw(e,t,n){var r,i=n+"",o;return function(){var a=Rt(this,e);return a===i?null:a===r?o:o=t(r=a,n)}}function qw(e,t,n){var r,i,o;return function(){var a=Rt(this,e),s=n(this),u=s+"";return s==null&&(u=s=(this.style.removeProperty(e),Rt(this,e))),a===u?null:a===r&&u===i?o:(i=u,o=t(r=a,s))}}function Tw(e,t){var n,r,i,o="style."+t,a="end."+o,s;return function(){var u=Le(this,e),l=u.on,c=u.value[o]==null?s||(s=jv(t)):void 0;(l!==n||i!==c)&&(r=(n=l).copy()).on(a,i=c),u.on=r}}function Pw(e,t,n){var r=(e+="")=="transform"?kx:$v;return t==null?this.styleTween(e,Mw(e,r)).on("end.style."+e,jv(e)):typeof t=="function"?this.styleTween(e,qw(e,r,pc(this,"style."+e,t))).each(Tw(this._id,e)):this.styleTween(e,Rw(e,r,t),n).on("end.style."+e,null)}function kw(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Ow(e,t,n){var r,i;function o(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&kw(e,a,n)),r}return o._value=t,o}function Lw(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,Ow(e,t,n??""))}function Dw(e){return function(){this.textContent=e}}function $w(e){return function(){var t=e(this);this.textContent=t??""}}function jw(e){return this.tween("text",typeof e=="function"?$w(pc(this,"text",e)):Dw(e==null?"":e+""))}function Fw(e){return function(t){this.textContent=e.call(this,t)}}function Bw(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&Fw(i)),t}return r._value=e,r}function zw(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,Bw(e))}function Hw(){for(var e=this._name,t=this._id,n=Fv(),r=this._groups,i=r.length,o=0;o<i;++o)for(var a=r[o],s=a.length,u,l=0;l<s;++l)if(u=a[l]){var c=Ie(u,t);sr(u,e,n,l,a,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new Ye(r,this._parents,e,n)}function Vw(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(o,a){var s={value:a},u={value:function(){--i===0&&o()}};n.each(function(){var l=Le(this,r),c=l.on;c!==e&&(t=(e=c).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(u)),l.on=t}),i===0&&o()})}var Gw=0;function Ye(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Fv(){return++Gw}var ze=fn.prototype;Ye.prototype={constructor:Ye,select:Cw,selectAll:Nw,selectChild:ze.selectChild,selectChildren:ze.selectChildren,filter:yw,merge:_w,selection:Iw,transition:Hw,call:ze.call,nodes:ze.nodes,node:ze.node,size:ze.size,empty:ze.empty,each:ze.each,on:ww,attr:nw,attrTween:sw,style:Pw,styleTween:Lw,text:jw,textTween:zw,remove:Sw,tween:Wx,delay:lw,duration:hw,ease:gw,easeVarying:mw,end:Vw,[Symbol.iterator]:ze[Symbol.iterator]};function Uw(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Kw={time:null,delay:0,duration:250,ease:Uw};function Yw(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 Ww(e){var t,n;e instanceof Ye?(t=e._id,e=e._name):(t=Fv(),(n=Kw).time=dc(),e=e==null?null:e+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var a=r[o],s=a.length,u,l=0;l<s;++l)(u=a[l])&&sr(u,e,t,l,a,n||Yw(u,t));return new Ye(r,this._parents,e,t)}fn.prototype.interrupt=Ux;fn.prototype.transition=Ww;const Mn=e=>()=>e;function Xw(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Ve(e,t,n){this.k=e,this.x=t,this.y=n}Ve.prototype={constructor:Ve,scale:function(e){return e===1?this:new Ve(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ve(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 ur=new Ve(1,0,0);Bv.prototype=Ve.prototype;function Bv(e){for(;!e.__zoom;)if(!(e=e.parentNode))return ur;return e.__zoom}function Fr(e){e.stopImmediatePropagation()}function Vt(e){e.preventDefault(),e.stopImmediatePropagation()}function Zw(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Qw(){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 gl(){return this.__zoom||ur}function Jw(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function e1(){return navigator.maxTouchPoints||"ontouchstart"in this}function t1(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}function zv(){var e=Zw,t=Qw,n=t1,r=Jw,i=e1,o=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],s=250,u=jn,l=ir("start","zoom","end"),c,f,d,h=500,p=150,g=0,v=10;function m(w){w.property("__zoom",gl).on("wheel.zoom",A,{passive:!1}).on("mousedown.zoom",q).on("dblclick.zoom",D).filter(i).on("touchstart.zoom",N).on("touchmove.zoom",R).on("touchend.zoom touchcancel.zoom",L).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(w,P,I,k){var T=w.selection?w.selection():w;T.property("__zoom",gl),w!==T?C(w,P,I,k):T.interrupt().each(function(){x(this,arguments).event(k).start().zoom(null,typeof P=="function"?P.apply(this,arguments):P).end()})},m.scaleBy=function(w,P,I,k){m.scaleTo(w,function(){var T=this.__zoom.k,M=typeof P=="function"?P.apply(this,arguments):P;return T*M},I,k)},m.scaleTo=function(w,P,I,k){m.transform(w,function(){var T=t.apply(this,arguments),M=this.__zoom,$=I==null?_(T):typeof I=="function"?I.apply(this,arguments):I,F=M.invert($),j=typeof P=="function"?P.apply(this,arguments):P;return n(y(b(M,j),$,F),T,a)},I,k)},m.translateBy=function(w,P,I,k){m.transform(w,function(){return n(this.__zoom.translate(typeof P=="function"?P.apply(this,arguments):P,typeof I=="function"?I.apply(this,arguments):I),t.apply(this,arguments),a)},null,k)},m.translateTo=function(w,P,I,k,T){m.transform(w,function(){var M=t.apply(this,arguments),$=this.__zoom,F=k==null?_(M):typeof k=="function"?k.apply(this,arguments):k;return n(ur.translate(F[0],F[1]).scale($.k).translate(typeof P=="function"?-P.apply(this,arguments):-P,typeof I=="function"?-I.apply(this,arguments):-I),M,a)},k,T)};function b(w,P){return P=Math.max(o[0],Math.min(o[1],P)),P===w.k?w:new Ve(P,w.x,w.y)}function y(w,P,I){var k=P[0]-I[0]*w.k,T=P[1]-I[1]*w.k;return k===w.x&&T===w.y?w:new Ve(w.k,k,T)}function _(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function C(w,P,I,k){w.on("start.zoom",function(){x(this,arguments).event(k).start()}).on("interrupt.zoom end.zoom",function(){x(this,arguments).event(k).end()}).tween("zoom",function(){var T=this,M=arguments,$=x(T,M).event(k),F=t.apply(T,M),j=I==null?_(F):typeof I=="function"?I.apply(T,M):I,H=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),z=T.__zoom,G=typeof P=="function"?P.apply(T,M):P,X=u(z.invert(j).concat(H/z.k),G.invert(j).concat(H/G.k));return function(K){if(K===1)K=G;else{var B=X(K),U=H/B[2];K=new Ve(U,j[0]-B[0]*U,j[1]-B[1]*U)}$.zoom(null,K)}})}function x(w,P,I){return!I&&w.__zooming||new E(w,P)}function E(w,P){this.that=w,this.args=P,this.active=0,this.sourceEvent=null,this.extent=t.apply(w,P),this.taps=0}E.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,P){return this.mouse&&w!=="mouse"&&(this.mouse[1]=P.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=P.invert(this.touch0[0])),this.touch1&&w!=="touch"&&(this.touch1[1]=P.invert(this.touch1[0])),this.that.__zoom=P,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(w){var P=_e(this.that).datum();l.call(w,this.that,new Xw(w,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:l}),P)}};function A(w,...P){if(!e.apply(this,arguments))return;var I=x(this,P).event(w),k=this.__zoom,T=Math.max(o[0],Math.min(o[1],k.k*Math.pow(2,r.apply(this,arguments)))),M=Se(w);if(I.wheel)(I.mouse[0][0]!==M[0]||I.mouse[0][1]!==M[1])&&(I.mouse[1]=k.invert(I.mouse[0]=M)),clearTimeout(I.wheel);else{if(k.k===T)return;I.mouse=[M,k.invert(M)],zn(this),I.start()}Vt(w),I.wheel=setTimeout($,p),I.zoom("mouse",n(y(b(k,T),I.mouse[0],I.mouse[1]),I.extent,a));function $(){I.wheel=null,I.end()}}function q(w,...P){if(d||!e.apply(this,arguments))return;var I=w.currentTarget,k=x(this,P,!0).event(w),T=_e(w.view).on("mousemove.zoom",j,!0).on("mouseup.zoom",H,!0),M=Se(w,I),$=w.clientX,F=w.clientY;Cv(w.view),Fr(w),k.mouse=[M,this.__zoom.invert(M)],zn(this),k.start();function j(z){if(Vt(z),!k.moved){var G=z.clientX-$,X=z.clientY-F;k.moved=G*G+X*X>g}k.event(z).zoom("mouse",n(y(k.that.__zoom,k.mouse[0]=Se(z,I),k.mouse[1]),k.extent,a))}function H(z){T.on("mousemove.zoom mouseup.zoom",null),Nv(z.view,k.moved),Vt(z),k.event(z).end()}}function D(w,...P){if(e.apply(this,arguments)){var I=this.__zoom,k=Se(w.changedTouches?w.changedTouches[0]:w,this),T=I.invert(k),M=I.k*(w.shiftKey?.5:2),$=n(y(b(I,M),k,T),t.apply(this,P),a);Vt(w),s>0?_e(this).transition().duration(s).call(C,$,k,w):_e(this).call(m.transform,$,k,w)}}function N(w,...P){if(e.apply(this,arguments)){var I=w.touches,k=I.length,T=x(this,P,w.changedTouches.length===k).event(w),M,$,F,j;for(Fr(w),$=0;$<k;++$)F=I[$],j=Se(F,this),j=[j,this.__zoom.invert(j),F.identifier],T.touch0?!T.touch1&&T.touch0[2]!==j[2]&&(T.touch1=j,T.taps=0):(T.touch0=j,M=!0,T.taps=1+!!c);c&&(c=clearTimeout(c)),M&&(T.taps<2&&(f=j[0],c=setTimeout(function(){c=null},h)),zn(this),T.start())}}function R(w,...P){if(this.__zooming){var I=x(this,P).event(w),k=w.changedTouches,T=k.length,M,$,F,j;for(Vt(w),M=0;M<T;++M)$=k[M],F=Se($,this),I.touch0&&I.touch0[2]===$.identifier?I.touch0[0]=F:I.touch1&&I.touch1[2]===$.identifier&&(I.touch1[0]=F);if($=I.that.__zoom,I.touch1){var H=I.touch0[0],z=I.touch0[1],G=I.touch1[0],X=I.touch1[1],K=(K=G[0]-H[0])*K+(K=G[1]-H[1])*K,B=(B=X[0]-z[0])*B+(B=X[1]-z[1])*B;$=b($,Math.sqrt(K/B)),F=[(H[0]+G[0])/2,(H[1]+G[1])/2],j=[(z[0]+X[0])/2,(z[1]+X[1])/2]}else if(I.touch0)F=I.touch0[0],j=I.touch0[1];else return;I.zoom("touch",n(y($,F,j),I.extent,a))}}function L(w,...P){if(this.__zooming){var I=x(this,P).event(w),k=w.changedTouches,T=k.length,M,$;for(Fr(w),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),M=0;M<T;++M)$=k[M],I.touch0&&I.touch0[2]===$.identifier?delete I.touch0:I.touch1&&I.touch1[2]===$.identifier&&delete I.touch1;if(I.touch1&&!I.touch0&&(I.touch0=I.touch1,delete I.touch1),I.touch0)I.touch0[1]=this.__zoom.invert(I.touch0[0]);else if(I.end(),I.taps===2&&($=Se($,this),Math.hypot(f[0]-$[0],f[1]-$[1])<v)){var F=_e(this).on("dblclick.zoom");F&&F.apply(this,arguments)}}}return m.wheelDelta=function(w){return arguments.length?(r=typeof w=="function"?w:Mn(+w),m):r},m.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Mn(!!w),m):e},m.touchable=function(w){return arguments.length?(i=typeof w=="function"?w:Mn(!!w),m):i},m.extent=function(w){return arguments.length?(t=typeof w=="function"?w:Mn([[+w[0][0],+w[0][1]],[+w[1][0],+w[1][1]]]),m):t},m.scaleExtent=function(w){return arguments.length?(o[0]=+w[0],o[1]=+w[1],m):[o[0],o[1]]},m.translateExtent=function(w){return arguments.length?(a[0][0]=+w[0][0],a[1][0]=+w[1][0],a[0][1]=+w[0][1],a[1][1]=+w[1][1],m):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},m.constrain=function(w){return arguments.length?(n=w,m):n},m.duration=function(w){return arguments.length?(s=+w,m):s},m.interpolate=function(w){return arguments.length?(u=w,m):u},m.on=function(){var w=l.on.apply(l,arguments);return w===l?m:w},m.clickDistance=function(w){return arguments.length?(g=(w=+w)*w,m):Math.sqrt(g)},m.tapDistance=function(w){return arguments.length?(v=+w,m):v},m}const xe={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},an=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Hv=["Enter"," ","Escape"],Vv={"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 Tt;(function(e){e.Strict="strict",e.Loose="loose"})(Tt||(Tt={}));var pt;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(pt||(pt={}));var sn;(function(e){e.Partial="partial",e.Full="full"})(sn||(sn={}));const Gv={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var ot;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(ot||(ot={}));var Xn;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Xn||(Xn={}));var V;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(V||(V={}));const vl={[V.Left]:V.Right,[V.Right]:V.Left,[V.Top]:V.Bottom,[V.Bottom]:V.Top};function Uv(e){return e===null?null:e?"valid":"invalid"}const Kv=e=>"id"in e&&"source"in e&&"target"in e,n1=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),gc=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),hn=(e,t=[0,0])=>{const{width:n,height:r}=Xe(e),i=e.origin??t,o=n*i[0],a=r*i[1];return{x:e.position.x-o,y:e.position.y-a}},r1=(e,t={nodeOrigin:[0,0]})=>{if(process.env.NODE_ENV==="development"&&!t.nodeLookup&&console.warn("Please use `getNodesBounds` from `useReactFlow`/`useSvelteFlow` hook to ensure correct values for sub flows. If not possible, you have to provide a nodeLookup to support sub flows."),e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,i)=>{const o=typeof i=="string";let a=!t.nodeLookup&&!o?i:void 0;t.nodeLookup&&(a=o?t.nodeLookup.get(i):gc(i)?i:t.nodeLookup.get(i.id));const s=a?Zn(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return cr(r,s)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return lr(n)},pn=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(i=>{(t.filter===void 0||t.filter(i))&&(n=cr(n,Zn(i)),r=!0)}),r?lr(n):{x:0,y:0,width:0,height:0}},vc=(e,t,[n,r,i]=[0,0,1],o=!1,a=!1)=>{const s={...vn(t,[n,r,i]),width:t.width/i,height:t.height/i},u=[];for(const l of e.values()){const{measured:c,selectable:f=!0,hidden:d=!1}=l;if(a&&!f||d)continue;const h=c.width??l.width??l.initialWidth??null,p=c.height??l.height??l.initialHeight??null,g=un(s,kt(l)),v=(h??0)*(p??0),m=o&&g>0;(!l.internals.handleBounds||m||g>=v||l.dragging)&&u.push(l)}return u},i1=(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 o1(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(i=>i.id)):null;return e.forEach(i=>{i.measured.width&&i.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!i.hidden)&&(!r||r.has(i.id))&&n.set(i.id,i)}),n}async function a1({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:o},a){if(e.size===0)return Promise.resolve(!0);const s=o1(e,a),u=pn(s),l=mc(u,t,n,(a==null?void 0:a.minZoom)??i,(a==null?void 0:a.maxZoom)??o,(a==null?void 0:a.padding)??.1);return await r.setViewport(l,{duration:a==null?void 0:a.duration,ease:a==null?void 0:a.ease,interpolate:a==null?void 0:a.interpolate}),Promise.resolve(!0)}function Yv({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:o}){const a=n.get(e),s=a.parentId?n.get(a.parentId):void 0,{x:u,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},c=a.origin??r;let f=a.extent||i;if(a.extent==="parent"&&!a.expandParent)if(!s)o==null||o("005",xe.error005());else{const h=s.measured.width,p=s.measured.height;h&&p&&(f=[[u,l],[u+h,l+p]])}else s&&Ot(a.extent)&&(f=[[a.extent[0][0]+u,a.extent[0][1]+l],[a.extent[1][0]+u,a.extent[1][1]+l]]);const d=Ot(f)?mt(t,f,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(o==null||o("015",xe.error015())),{position:{x:d.x-u+(a.measured.width??0)*c[0],y:d.y-l+(a.measured.height??0)*c[1]},positionAbsolute:d}}async function s1({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){const o=new Set(e.map(d=>d.id)),a=[];for(const d of n){if(d.deletable===!1)continue;const h=o.has(d.id),p=!h&&d.parentId&&a.find(g=>g.id===d.parentId);(h||p)&&a.push(d)}const s=new Set(t.map(d=>d.id)),u=r.filter(d=>d.deletable!==!1),c=i1(a,u);for(const d of u)s.has(d.id)&&!c.find(p=>p.id===d.id)&&c.push(d);if(!i)return{edges:c,nodes:a};const f=await i({nodes:a,edges:c});return typeof f=="boolean"?f?{edges:c,nodes:a}:{edges:[],nodes:[]}:f}const Pt=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),mt=(e={x:0,y:0},t,n)=>({x:Pt(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Pt(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function Wv(e,t,n){const{width:r,height:i}=Xe(n),{x:o,y:a}=n.internals.positionAbsolute;return mt(e,[[o,a],[o+r,a+i]],t)}const ml=(e,t,n)=>e<t?Pt(Math.abs(e-t),1,t)/t:e>n?-Pt(Math.abs(e-n),1,t)/t:0,Xv=(e,t,n=15,r=40)=>{const i=ml(e.x,r,t.width-r)*n,o=ml(e.y,r,t.height-r)*n;return[i,o]},cr=(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)}),Qu=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),lr=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),kt=(e,t=[0,0])=>{var i,o;const{x:n,y:r}=gc(e)?e.internals.positionAbsolute:hn(e,t);return{x:n,y:r,width:((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0,height:((o=e.measured)==null?void 0:o.height)??e.height??e.initialHeight??0}},Zn=(e,t=[0,0])=>{var i,o;const{x:n,y:r}=gc(e)?e.internals.positionAbsolute:hn(e,t);return{x:n,y:r,x2:n+(((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0),y2:r+(((o=e.measured)==null?void 0:o.height)??e.height??e.initialHeight??0)}},Zv=(e,t)=>lr(cr(Qu(e),Qu(t))),un=(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)},yl=e=>Ne(e.width)&&Ne(e.height)&&Ne(e.x)&&Ne(e.y),Ne=e=>!isNaN(e)&&isFinite(e),Qv=(e,t)=>{process.env.NODE_ENV==="development"&&console.warn(`[React Flow]: ${t} Help: https://reactflow.dev/error#${e}`)},gn=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),vn=({x:e,y:t},[n,r,i],o=!1,a=[1,1])=>{const s={x:(e-n)/i,y:(t-r)/i};return o?gn(s,a):s},Qn=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function Ct(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function u1(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Ct(e,n),i=Ct(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e=="object"){const r=Ct(e.top??e.y??0,n),i=Ct(e.bottom??e.y??0,n),o=Ct(e.left??e.x??0,t),a=Ct(e.right??e.x??0,t);return{top:r,right:a,bottom:i,left:o,x:o+a,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function c1(e,t,n,r,i,o){const{x:a,y:s}=Qn(e,[t,n,r]),{x:u,y:l}=Qn({x:e.x+e.width,y:e.y+e.height},[t,n,r]),c=i-u,f=o-l;return{left:Math.floor(a),top:Math.floor(s),right:Math.floor(c),bottom:Math.floor(f)}}const mc=(e,t,n,r,i,o)=>{const a=u1(o,t,n),s=(t-a.x)/e.width,u=(n-a.y)/e.height,l=Math.min(s,u),c=Pt(l,r,i),f=e.x+e.width/2,d=e.y+e.height/2,h=t/2-f*c,p=n/2-d*c,g=c1(e,h,p,c,t,n),v={left:Math.min(g.left-a.left,0),top:Math.min(g.top-a.top,0),right:Math.min(g.right-a.right,0),bottom:Math.min(g.bottom-a.bottom,0)};return{x:h-v.left+v.right,y:p-v.top+v.bottom,zoom:c}},cn=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Ot(e){return e!=null&&e!=="parent"}function Xe(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function Jv(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 em(e,t={width:0,height:0},n,r,i){const o={...e},a=r.get(n);if(a){const s=a.origin||i;o.x+=a.internals.positionAbsolute.x-(t.width??0)*s[0],o.y+=a.internals.positionAbsolute.y-(t.height??0)*s[1]}return o}function _l(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function l1(){let e,t;return{promise:new Promise((r,i)=>{e=r,t=i}),resolve:e,reject:t}}function f1(e){return{...Vv,...e||{}}}function en(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){const{x:o,y:a}=Ae(e),s=vn({x:o-((i==null?void 0:i.left)??0),y:a-((i==null?void 0:i.top)??0)},r),{x:u,y:l}=n?gn(s,t):s;return{xSnapped:u,ySnapped:l,...s}}const yc=e=>({width:e.offsetWidth,height:e.offsetHeight}),tm=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},d1=["INPUT","SELECT","TEXTAREA"];function nm(e){var r,i;const t=((i=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:i[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:d1.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const rm=e=>"clientX"in e,Ae=(e,t)=>{var o,a;const n=rm(e),r=n?e.clientX:(o=e.touches)==null?void 0:o[0].clientX,i=n?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},bl=(e,t,n,r,i)=>{const o=t.querySelectorAll(`.${e}`);return!o||!o.length?null:Array.from(o).map(a=>{const s=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:i,position:a.getAttribute("data-handlepos"),x:(s.left-n.left)/r,y:(s.top-n.top)/r,...yc(a)}})};function im({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:o,targetControlX:a,targetControlY:s}){const u=e*.125+i*.375+a*.375+n*.125,l=t*.125+o*.375+s*.375+r*.125,c=Math.abs(u-e),f=Math.abs(l-t);return[u,l,c,f]}function Rn(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function xl({pos:e,x1:t,y1:n,x2:r,y2:i,c:o}){switch(e){case V.Left:return[t-Rn(t-r,o),n];case V.Right:return[t+Rn(r-t,o),n];case V.Top:return[t,n-Rn(n-i,o)];case V.Bottom:return[t,n+Rn(i-n,o)]}}function om({sourceX:e,sourceY:t,sourcePosition:n=V.Bottom,targetX:r,targetY:i,targetPosition:o=V.Top,curvature:a=.25}){const[s,u]=xl({pos:n,x1:e,y1:t,x2:r,y2:i,c:a}),[l,c]=xl({pos:o,x1:r,y1:i,x2:e,y2:t,c:a}),[f,d,h,p]=im({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:u,targetControlX:l,targetControlY:c});return[`M${e},${t} C${s},${u} ${l},${c} ${r},${i}`,f,d,h,p]}function am({sourceX:e,sourceY:t,targetX:n,targetY:r}){const i=Math.abs(n-e)/2,o=n<e?n+i:n-i,a=Math.abs(r-t)/2,s=r<t?r+a:r-a;return[o,s,i,a]}function h1({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:o="basic"}){if(o==="manual")return r;const a=i&&n?r+1e3:r,s=Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0);return a+s}function p1({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){const o=cr(Zn(e),Zn(t));o.x===o.x2&&(o.x2+=1),o.y===o.y2&&(o.y2+=1);const a={x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]};return un(a,lr(o))>0}const g1=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,v1=(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)),m1=(e,t,n={})=>{if(!e.source||!e.target)return Qv("006",xe.error006()),t;const r=n.getEdgeId||g1;let i;return Kv(e)?i={...e}:i={...e,id:r(e)},v1(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function sm({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[i,o,a,s]=am({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,o,a,s]}const wl={[V.Left]:{x:-1,y:0},[V.Right]:{x:1,y:0},[V.Top]:{x:0,y:-1},[V.Bottom]:{x:0,y:1}},y1=({source:e,sourcePosition:t=V.Bottom,target:n})=>t===V.Left||t===V.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},El=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function _1({source:e,sourcePosition:t=V.Bottom,target:n,targetPosition:r=V.Top,center:i,offset:o,stepPosition:a}){const s=wl[t],u=wl[r],l={x:e.x+s.x*o,y:e.y+s.y*o},c={x:n.x+u.x*o,y:n.y+u.y*o},f=y1({source:l,sourcePosition:t,target:c}),d=f.x!==0?"x":"y",h=f[d];let p=[],g,v;const m={x:0,y:0},b={x:0,y:0},[,,y,_]=am({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[d]*u[d]===-1){d==="x"?(g=i.x??l.x+(c.x-l.x)*a,v=i.y??(l.y+c.y)/2):(g=i.x??(l.x+c.x)/2,v=i.y??l.y+(c.y-l.y)*a);const x=[{x:g,y:l.y},{x:g,y:c.y}],E=[{x:l.x,y:v},{x:c.x,y:v}];s[d]===h?p=d==="x"?x:E:p=d==="x"?E:x}else{const x=[{x:l.x,y:c.y}],E=[{x:c.x,y:l.y}];if(d==="x"?p=s.x===h?E:x:p=s.y===h?x:E,t===r){const R=Math.abs(e[d]-n[d]);if(R<=o){const L=Math.min(o-1,o-R);s[d]===h?m[d]=(l[d]>e[d]?-1:1)*L:b[d]=(c[d]>n[d]?-1:1)*L}}if(t!==r){const R=d==="x"?"y":"x",L=s[d]===u[R],w=l[R]>c[R],P=l[R]<c[R];(s[d]===1&&(!L&&w||L&&P)||s[d]!==1&&(!L&&P||L&&w))&&(p=d==="x"?x:E)}const A={x:l.x+m.x,y:l.y+m.y},q={x:c.x+b.x,y:c.y+b.y},D=Math.max(Math.abs(A.x-p[0].x),Math.abs(q.x-p[0].x)),N=Math.max(Math.abs(A.y-p[0].y),Math.abs(q.y-p[0].y));D>=N?(g=(A.x+q.x)/2,v=p[0].y):(g=p[0].x,v=(A.y+q.y)/2)}return[[e,{x:l.x+m.x,y:l.y+m.y},...p,{x:c.x+b.x,y:c.y+b.y},n],g,v,y,_]}function b1(e,t,n,r){const i=Math.min(El(e,t)/2,El(t,n)/2,r),{x:o,y:a}=t;if(e.x===o&&o===n.x||e.y===a&&a===n.y)return`L${o} ${a}`;if(e.y===a){const l=e.x<n.x?-1:1,c=e.y<n.y?1:-1;return`L ${o+i*l},${a}Q ${o},${a} ${o},${a+i*c}`}const s=e.x<n.x?1:-1,u=e.y<n.y?-1:1;return`L ${o},${a+i*u}Q ${o},${a} ${o+i*s},${a}`}function Ju({sourceX:e,sourceY:t,sourcePosition:n=V.Bottom,targetX:r,targetY:i,targetPosition:o=V.Top,borderRadius:a=5,centerX:s,centerY:u,offset:l=20,stepPosition:c=.5}){const[f,d,h,p,g]=_1({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:o,center:{x:s,y:u},offset:l,stepPosition:c});return[f.reduce((m,b,y)=>{let _="";return y>0&&y<f.length-1?_=b1(f[y-1],b,f[y+1],a):_=`${y===0?"M":"L"}${b.x} ${b.y}`,m+=_,m},""),d,h,p,g]}function Sl(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function x1(e){var f;const{sourceNode:t,targetNode:n}=e;if(!Sl(t)||!Sl(n))return null;const r=t.internals.handleBounds||Cl(t.handles),i=n.internals.handleBounds||Cl(n.handles),o=Nl((r==null?void 0:r.source)??[],e.sourceHandle),a=Nl(e.connectionMode===Tt.Strict?(i==null?void 0:i.target)??[]:((i==null?void 0:i.target)??[]).concat((i==null?void 0:i.source)??[]),e.targetHandle);if(!o||!a)return(f=e.onError)==null||f.call(e,"008",xe.error008(o?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const s=(o==null?void 0:o.position)||V.Bottom,u=(a==null?void 0:a.position)||V.Top,l=yt(t,o,s),c=yt(n,a,u);return{sourceX:l.x,sourceY:l.y,targetX:c.x,targetY:c.y,sourcePosition:s,targetPosition:u}}function Cl(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 yt(e,t,n=V.Left,r=!1){const i=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,o=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:a,height:s}=t??Xe(e);if(r)return{x:i+a/2,y:o+s/2};switch((t==null?void 0:t.position)??n){case V.Top:return{x:i+a/2,y:o};case V.Right:return{x:i+a,y:o+s/2};case V.Bottom:return{x:i+a/2,y:o+s};case V.Left:return{x:i,y:o+s/2}}}function Nl(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function ec(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function w1(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){const o=new Set;return e.reduce((a,s)=>([s.markerStart||r,s.markerEnd||i].forEach(u=>{if(u&&typeof u=="object"){const l=ec(u,t);o.has(l)||(a.push({id:l,color:u.color||n,...u}),o.add(l))}}),a),[]).sort((a,s)=>a.id.localeCompare(s.id))}const um=1e3,E1=10,_c={nodeOrigin:[0,0],nodeExtent:an,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},S1={..._c,checkEquality:!0};function bc(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function C1(e,t,n){const r=bc(_c,n);for(const i of e.values())if(i.parentId)wc(i,e,t,r);else{const o=hn(i,r.nodeOrigin),a=Ot(i.extent)?i.extent:r.nodeExtent,s=mt(o,a,Xe(i));i.internals.positionAbsolute=s}}function N1(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const i of e.handles){const o={id:i.id,width:i.width??1,height:i.height??1,nodeId:e.id,x:i.x,y:i.y,position:i.position,type:i.type};i.type==="source"?n.push(o):i.type==="target"&&r.push(o)}return{source:n,target:r}}function xc(e){return e==="manual"}function tc(e,t,n,r={}){var l,c;const i=bc(S1,r),o={i:0},a=new Map(t),s=i!=null&&i.elevateNodesOnSelect&&!xc(i.zIndexMode)?um:0;let u=e.length>0;t.clear(),n.clear();for(const f of e){let d=a.get(f.id);if(i.checkEquality&&f===(d==null?void 0:d.internals.userNode))t.set(f.id,d);else{const h=hn(f,i.nodeOrigin),p=Ot(f.extent)?f.extent:i.nodeExtent,g=mt(h,p,Xe(f));d={...i.defaults,...f,measured:{width:(l=f.measured)==null?void 0:l.width,height:(c=f.measured)==null?void 0:c.height},internals:{positionAbsolute:g,handleBounds:N1(f,d),z:cm(f,s,i.zIndexMode),userNode:f}},t.set(f.id,d)}(d.measured===void 0||d.measured.width===void 0||d.measured.height===void 0)&&!d.hidden&&(u=!1),f.parentId&&wc(d,t,n,r,o)}return u}function A1(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 wc(e,t,n,r,i){const{elevateNodesOnSelect:o,nodeOrigin:a,nodeExtent:s,zIndexMode:u}=bc(_c,r),l=e.parentId,c=t.get(l);if(!c){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}A1(e,n),i&&!c.parentId&&c.internals.rootParentIndex===void 0&&u==="auto"&&(c.internals.rootParentIndex=++i.i,c.internals.z=c.internals.z+i.i*E1),i&&c.internals.rootParentIndex!==void 0&&(i.i=c.internals.rootParentIndex);const f=o&&!xc(u)?um:0,{x:d,y:h,z:p}=I1(e,c,a,s,f,u),{positionAbsolute:g}=e.internals,v=d!==g.x||h!==g.y;(v||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:v?{x:d,y:h}:g,z:p}})}function cm(e,t,n){const r=Ne(e.zIndex)?e.zIndex:0;return xc(n)?r:r+(e.selected?t:0)}function I1(e,t,n,r,i,o){const{x:a,y:s}=t.internals.positionAbsolute,u=Xe(e),l=hn(e,n),c=Ot(e.extent)?mt(l,e.extent,u):l;let f=mt({x:a+c.x,y:s+c.y},r,u);e.extent==="parent"&&(f=Wv(f,u,t));const d=cm(e,i,o),h=t.internals.z??0;return{x:f.x,y:f.y,z:h>=d?h+1:d}}function Ec(e,t,n,r=[0,0]){var a;const i=[],o=new Map;for(const s of e){const u=t.get(s.parentId);if(!u)continue;const l=((a=o.get(s.parentId))==null?void 0:a.expandedRect)??kt(u),c=Zv(l,s.rect);o.set(s.parentId,{expandedRect:c,parent:u})}return o.size>0&&o.forEach(({expandedRect:s,parent:u},l)=>{var y;const c=u.internals.positionAbsolute,f=Xe(u),d=u.origin??r,h=s.x<c.x?Math.round(Math.abs(c.x-s.x)):0,p=s.y<c.y?Math.round(Math.abs(c.y-s.y)):0,g=Math.max(f.width,Math.round(s.width)),v=Math.max(f.height,Math.round(s.height)),m=(g-f.width)*d[0],b=(v-f.height)*d[1];(h>0||p>0||m||b)&&(i.push({id:l,type:"position",position:{x:u.position.x-h+m,y:u.position.y-p+b}}),(y=n.get(l))==null||y.forEach(_=>{e.some(C=>C.id===_.id)||i.push({id:_.id,type:"position",position:{x:_.position.x+h,y:_.position.y+p}})})),(f.width<s.width||f.height<s.height||h||p)&&i.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:g+(h?d[0]*h-m:0),height:v+(p?d[1]*p-b:0)}})}),i}function M1(e,t,n,r,i,o,a){const s=r==null?void 0:r.querySelector(".xyflow__viewport");let u=!1;if(!s)return{changes:[],updatedInternals:u};const l=[],c=window.getComputedStyle(s),{m22:f}=new window.DOMMatrixReadOnly(c.transform),d=[];for(const h of e.values()){const p=t.get(h.id);if(!p)continue;if(p.hidden){t.set(p.id,{...p,internals:{...p.internals,handleBounds:void 0}}),u=!0;continue}const g=yc(h.nodeElement),v=p.measured.width!==g.width||p.measured.height!==g.height;if(!!(g.width&&g.height&&(v||!p.internals.handleBounds||h.force))){const b=h.nodeElement.getBoundingClientRect(),y=Ot(p.extent)?p.extent:o;let{positionAbsolute:_}=p.internals;p.parentId&&p.extent==="parent"?_=Wv(_,g,t.get(p.parentId)):y&&(_=mt(_,y,g));const C={...p,measured:g,internals:{...p.internals,positionAbsolute:_,handleBounds:{source:bl("source",h.nodeElement,b,f,p.id),target:bl("target",h.nodeElement,b,f,p.id)}}};t.set(p.id,C),p.parentId&&wc(C,t,n,{nodeOrigin:i,zIndexMode:a}),u=!0,v&&(l.push({id:p.id,type:"dimensions",dimensions:g}),p.expandParent&&p.parentId&&d.push({id:p.id,parentId:p.parentId,rect:kt(C,i)}))}}if(d.length>0){const h=Ec(d,t,n,i);l.push(...h)}return{changes:l,updatedInternals:u}}async function R1({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:o}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const a=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,o]],r),s=!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2]);return Promise.resolve(s)}function Al(e,t,n,r,i,o){let a=i;const s=r.get(a)||new Map;r.set(a,s.set(n,t)),a=`${i}-${e}`;const u=r.get(a)||new Map;if(r.set(a,u.set(n,t)),o){a=`${i}-${e}-${o}`;const l=r.get(a)||new Map;r.set(a,l.set(n,t))}}function lm(e,t,n){e.clear(),t.clear();for(const r of n){const{source:i,target:o,sourceHandle:a=null,targetHandle:s=null}=r,u={edgeId:r.id,source:i,target:o,sourceHandle:a,targetHandle:s},l=`${i}-${a}--${o}-${s}`,c=`${o}-${s}--${i}-${a}`;Al("source",u,c,e,i,a),Al("target",u,l,e,o,s),t.set(r.id,r)}}function fm(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:fm(n,t):!1}function Il(e,t,n){var i;let r=e;do{if((i=r==null?void 0:r.matches)!=null&&i.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function q1(e,t,n,r){const i=new Map;for(const[o,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!fm(a,e))&&(a.draggable||t&&typeof a.draggable>"u")){const s=e.get(o);s&&i.set(o,{id:o,position:s.position||{x:0,y:0},distance:{x:n.x-s.internals.positionAbsolute.x,y:n.y-s.internals.positionAbsolute.y},extent:s.extent,parentId:s.parentId,origin:s.origin,expandParent:s.expandParent,internals:{positionAbsolute:s.internals.positionAbsolute||{x:0,y:0}},measured:{width:s.measured.width??0,height:s.measured.height??0}})}return i}function Br({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var a,s,u;const i=[];for(const[l,c]of t){const f=(a=n.get(l))==null?void 0:a.internals.userNode;f&&i.push({...f,position:c.position,dragging:r})}if(!e)return[i[0],i];const o=(s=n.get(e))==null?void 0:s.internals.userNode;return[o?{...o,position:((u=t.get(e))==null?void 0:u.position)||o.position,dragging:r}:i[0],i]}function T1({dragItems:e,snapGrid:t,x:n,y:r}){const i=e.values().next().value;if(!i)return null;const o={x:n-i.distance.x,y:r-i.distance.y},a=gn(o,t);return{x:a.x-o.x,y:a.y-o.y}}function P1({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let o={x:null,y:null},a=0,s=new Map,u=!1,l={x:0,y:0},c=null,f=!1,d=null,h=!1,p=!1,g=null;function v({noDragClassName:b,handleSelector:y,domNode:_,isSelectable:C,nodeId:x,nodeClickDistance:E=0}){d=_e(_);function A({x:R,y:L}){const{nodeLookup:w,nodeExtent:P,snapGrid:I,snapToGrid:k,nodeOrigin:T,onNodeDrag:M,onSelectionDrag:$,onError:F,updateNodePositions:j}=t();o={x:R,y:L};let H=!1;const z=s.size>1,G=z&&P?Qu(pn(s)):null,X=z&&k?T1({dragItems:s,snapGrid:I,x:R,y:L}):null;for(const[K,B]of s){if(!w.has(K))continue;let U={x:R-B.distance.x,y:L-B.distance.y};k&&(U=X?{x:Math.round(U.x+X.x),y:Math.round(U.y+X.y)}:gn(U,I));let te=null;if(z&&P&&!B.extent&&G){const{positionAbsolute:Y}=B.internals,oe=Y.x-G.x+P[0][0],W=Y.x+B.measured.width-G.x2+P[1][0],re=Y.y-G.y+P[0][1],Q=Y.y+B.measured.height-G.y2+P[1][1];te=[[oe,re],[W,Q]]}const{position:J,positionAbsolute:Z}=Yv({nodeId:K,nextPosition:U,nodeLookup:w,nodeExtent:te||P,nodeOrigin:T,onError:F});H=H||B.position.x!==J.x||B.position.y!==J.y,B.position=J,B.internals.positionAbsolute=Z}if(p=p||H,!!H&&(j(s,!0),g&&(r||M||!x&&$))){const[K,B]=Br({nodeId:x,dragItems:s,nodeLookup:w});r==null||r(g,s,K,B),M==null||M(g,K,B),x||$==null||$(g,B)}}async function q(){if(!c)return;const{transform:R,panBy:L,autoPanSpeed:w,autoPanOnNodeDrag:P}=t();if(!P){u=!1,cancelAnimationFrame(a);return}const[I,k]=Xv(l,c,w);(I!==0||k!==0)&&(o.x=(o.x??0)-I/R[2],o.y=(o.y??0)-k/R[2],await L({x:I,y:k})&&A(o)),a=requestAnimationFrame(q)}function D(R){var z;const{nodeLookup:L,multiSelectionActive:w,nodesDraggable:P,transform:I,snapGrid:k,snapToGrid:T,selectNodesOnDrag:M,onNodeDragStart:$,onSelectionDragStart:F,unselectNodesAndEdges:j}=t();f=!0,(!M||!C)&&!w&&x&&((z=L.get(x))!=null&&z.selected||j()),C&&M&&x&&(e==null||e(x));const H=en(R.sourceEvent,{transform:I,snapGrid:k,snapToGrid:T,containerBounds:c});if(o=H,s=q1(L,P,H,x),s.size>0&&(n||$||!x&&F)){const[G,X]=Br({nodeId:x,dragItems:s,nodeLookup:L});n==null||n(R.sourceEvent,s,G,X),$==null||$(R.sourceEvent,G,X),x||F==null||F(R.sourceEvent,X)}}const N=Av().clickDistance(E).on("start",R=>{const{domNode:L,nodeDragThreshold:w,transform:P,snapGrid:I,snapToGrid:k}=t();c=(L==null?void 0:L.getBoundingClientRect())||null,h=!1,p=!1,g=R.sourceEvent,w===0&&D(R),o=en(R.sourceEvent,{transform:P,snapGrid:I,snapToGrid:k,containerBounds:c}),l=Ae(R.sourceEvent,c)}).on("drag",R=>{const{autoPanOnNodeDrag:L,transform:w,snapGrid:P,snapToGrid:I,nodeDragThreshold:k,nodeLookup:T}=t(),M=en(R.sourceEvent,{transform:w,snapGrid:P,snapToGrid:I,containerBounds:c});if(g=R.sourceEvent,(R.sourceEvent.type==="touchmove"&&R.sourceEvent.touches.length>1||x&&!T.has(x))&&(h=!0),!h){if(!u&&L&&f&&(u=!0,q()),!f){const $=Ae(R.sourceEvent,c),F=$.x-l.x,j=$.y-l.y;Math.sqrt(F*F+j*j)>k&&D(R)}(o.x!==M.xSnapped||o.y!==M.ySnapped)&&s&&f&&(l=Ae(R.sourceEvent,c),A(M))}}).on("end",R=>{if(!(!f||h)&&(u=!1,f=!1,cancelAnimationFrame(a),s.size>0)){const{nodeLookup:L,updateNodePositions:w,onNodeDragStop:P,onSelectionDragStop:I}=t();if(p&&(w(s,!1),p=!1),i||P||!x&&I){const[k,T]=Br({nodeId:x,dragItems:s,nodeLookup:L,dragging:!1});i==null||i(R.sourceEvent,s,k,T),P==null||P(R.sourceEvent,k,T),x||I==null||I(R.sourceEvent,T)}}}).filter(R=>{const L=R.target;return!R.button&&(!b||!Il(L,`.${b}`,_))&&(!y||Il(L,y,_))});d.call(N)}function m(){d==null||d.on(".drag",null)}return{update:v,destroy:m}}function k1(e,t,n){const r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const o of t.values())un(i,kt(o))>0&&r.push(o);return r}const O1=250;function L1(e,t,n,r){var s,u;let i=[],o=1/0;const a=k1(e,n,t+O1);for(const l of a){const c=[...((s=l.internals.handleBounds)==null?void 0:s.source)??[],...((u=l.internals.handleBounds)==null?void 0:u.target)??[]];for(const f of c){if(r.nodeId===f.nodeId&&r.type===f.type&&r.id===f.id)continue;const{x:d,y:h}=yt(l,f,f.position,!0),p=Math.sqrt(Math.pow(d-e.x,2)+Math.pow(h-e.y,2));p>t||(p<o?(i=[{...f,x:d,y:h}],o=p):p===o&&i.push({...f,x:d,y:h}))}}if(!i.length)return null;if(i.length>1){const l=r.type==="source"?"target":"source";return i.find(c=>c.type===l)??i[0]}return i[0]}function dm(e,t,n,r,i,o=!1){var l,c,f;const a=r.get(e);if(!a)return null;const s=i==="strict"?(l=a.internals.handleBounds)==null?void 0:l[t]:[...((c=a.internals.handleBounds)==null?void 0:c.source)??[],...((f=a.internals.handleBounds)==null?void 0:f.target)??[]],u=(n?s==null?void 0:s.find(d=>d.id===n):s==null?void 0:s[0])??null;return u&&o?{...u,...yt(a,u,u.position,!0)}:u}function hm(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function D1(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const pm=()=>!0;function $1(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:o,isTarget:a,domNode:s,nodeLookup:u,lib:l,autoPanOnConnect:c,flowId:f,panBy:d,cancelConnection:h,onConnectStart:p,onConnect:g,onConnectEnd:v,isValidConnection:m=pm,onReconnectEnd:b,updateConnection:y,getTransform:_,getFromHandle:C,autoPanSpeed:x,dragThreshold:E=1,handleDomNode:A}){const q=tm(e.target);let D=0,N;const{x:R,y:L}=Ae(e),w=hm(o,A),P=s==null?void 0:s.getBoundingClientRect();let I=!1;if(!P||!w)return;const k=dm(i,w,r,u,t);if(!k)return;let T=Ae(e,P),M=!1,$=null,F=!1,j=null;function H(){if(!c||!P)return;const[J,Z]=Xv(T,P,x);d({x:J,y:Z}),D=requestAnimationFrame(H)}const z={...k,nodeId:i,type:w,position:k.position},G=u.get(i);let K={inProgress:!0,isValid:null,from:yt(G,z,V.Left,!0),fromHandle:z,fromPosition:z.position,fromNode:G,to:T,toHandle:null,toPosition:vl[z.position],toNode:null,pointer:T};function B(){I=!0,y(K),p==null||p(e,{nodeId:i,handleId:r,handleType:w})}E===0&&B();function U(J){if(!I){const{x:Q,y:pe}=Ae(J),he=Q-R,$e=pe-L;if(!(he*he+$e*$e>E*E))return;B()}if(!C()||!z){te(J);return}const Z=_();T=Ae(J,P),N=L1(vn(T,Z,!1,[1,1]),n,u,z),M||(H(),M=!0);const Y=gm(J,{handle:N,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:a?"target":"source",isValidConnection:m,doc:q,lib:l,flowId:f,nodeLookup:u});j=Y.handleDomNode,$=Y.connection,F=D1(!!N,Y.isValid);const oe=u.get(i),W=oe?yt(oe,z,V.Left,!0):K.from,re={...K,from:W,isValid:F,to:Y.toHandle&&F?Qn({x:Y.toHandle.x,y:Y.toHandle.y},Z):T,toHandle:Y.toHandle,toPosition:F&&Y.toHandle?Y.toHandle.position:vl[z.position],toNode:Y.toHandle?u.get(Y.toHandle.nodeId):null,pointer:T};y(re),K=re}function te(J){if(!("touches"in J&&J.touches.length>0)){if(I){(N||j)&&$&&F&&(g==null||g($));const{inProgress:Z,...Y}=K,oe={...Y,toPosition:K.toHandle?K.toPosition:null};v==null||v(J,oe),o&&(b==null||b(J,oe))}h(),cancelAnimationFrame(D),M=!1,F=!1,$=null,j=null,q.removeEventListener("mousemove",U),q.removeEventListener("mouseup",te),q.removeEventListener("touchmove",U),q.removeEventListener("touchend",te)}}q.addEventListener("mousemove",U),q.addEventListener("mouseup",te),q.addEventListener("touchmove",U),q.addEventListener("touchend",te)}function gm(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:o,doc:a,lib:s,flowId:u,isValidConnection:l=pm,nodeLookup:c}){const f=o==="target",d=t?a.querySelector(`.${s}-flow__handle[data-id="${u}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:h,y:p}=Ae(e),g=a.elementFromPoint(h,p),v=g!=null&&g.classList.contains(`${s}-flow__handle`)?g:d,m={handleDomNode:v,isValid:!1,connection:null,toHandle:null};if(v){const b=hm(void 0,v),y=v.getAttribute("data-nodeid"),_=v.getAttribute("data-handleid"),C=v.classList.contains("connectable"),x=v.classList.contains("connectableend");if(!y||!b)return m;const E={source:f?y:r,sourceHandle:f?_:i,target:f?r:y,targetHandle:f?i:_};m.connection=E;const q=C&&x&&(n===Tt.Strict?f&&b==="source"||!f&&b==="target":y!==r||_!==i);m.isValid=q&&l(E),m.toHandle=dm(y,b,_,c,n,!0)}return m}const nc={onPointerDown:$1,isValid:gm};function j1({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const i=_e(e);function o({translateExtent:s,width:u,height:l,zoomStep:c=1,pannable:f=!0,zoomable:d=!0,inversePan:h=!1}){const p=y=>{if(y.sourceEvent.type!=="wheel"||!t)return;const _=n(),C=y.sourceEvent.ctrlKey&&cn()?10:1,x=-y.sourceEvent.deltaY*(y.sourceEvent.deltaMode===1?.05:y.sourceEvent.deltaMode?1:.002)*c,E=_[2]*Math.pow(2,x*C);t.scaleTo(E)};let g=[0,0];const v=y=>{(y.sourceEvent.type==="mousedown"||y.sourceEvent.type==="touchstart")&&(g=[y.sourceEvent.clientX??y.sourceEvent.touches[0].clientX,y.sourceEvent.clientY??y.sourceEvent.touches[0].clientY])},m=y=>{const _=n();if(y.sourceEvent.type!=="mousemove"&&y.sourceEvent.type!=="touchmove"||!t)return;const C=[y.sourceEvent.clientX??y.sourceEvent.touches[0].clientX,y.sourceEvent.clientY??y.sourceEvent.touches[0].clientY],x=[C[0]-g[0],C[1]-g[1]];g=C;const E=r()*Math.max(_[2],Math.log(_[2]))*(h?-1:1),A={x:_[0]-x[0]*E,y:_[1]-x[1]*E},q=[[0,0],[u,l]];t.setViewportConstrained({x:A.x,y:A.y,zoom:_[2]},q,s)},b=zv().on("start",v).on("zoom",f?m:null).on("zoom.wheel",d?p:null);i.call(b,{})}function a(){i.on("zoom",null)}return{update:o,destroy:a,pointer:Se}}const fr=e=>({x:e.x,y:e.y,zoom:e.k}),zr=({x:e,y:t,zoom:n})=>ur.translate(e,t).scale(n),Nt=(e,t)=>e.target.closest(`.${t}`),vm=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),F1=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Hr=(e,t=0,n=F1,r=()=>{})=>{const i=typeof t=="number"&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on("end",r):e},mm=e=>{const t=e.ctrlKey&&cn()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function B1({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:o,zoomOnPinch:a,onPanZoomStart:s,onPanZoom:u,onPanZoomEnd:l}){return c=>{if(Nt(c,t))return c.ctrlKey&&c.preventDefault(),!1;c.preventDefault(),c.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(c.ctrlKey&&a){const v=Se(c),m=mm(c),b=f*Math.pow(2,m);r.scaleTo(n,b,v,c);return}const d=c.deltaMode===1?20:1;let h=i===pt.Vertical?0:c.deltaX*d,p=i===pt.Horizontal?0:c.deltaY*d;!cn()&&c.shiftKey&&i!==pt.Vertical&&(h=c.deltaY*d,p=0),r.translateBy(n,-(h/f)*o,-(p/f)*o,{internal:!0});const g=fr(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(u==null||u(c,g),e.panScrollTimeout=setTimeout(()=>{l==null||l(c,g),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,s==null||s(c,g))}}function z1({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){const o=r.type==="wheel",a=!t&&o&&!r.ctrlKey,s=Nt(r,e);if(r.ctrlKey&&o&&s&&r.preventDefault(),a||s)return null;r.preventDefault(),n.call(this,r,i)}}function H1({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var o,a,s;if((o=r.sourceEvent)!=null&&o.internal)return;const i=fr(r.transform);e.mouseButton=((a=r.sourceEvent)==null?void 0:a.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=i,((s=r.sourceEvent)==null?void 0:s.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,i))}}function V1({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return o=>{var a,s;e.usedRightMouseButton=!!(n&&vm(t,e.mouseButton??0)),(a=o.sourceEvent)!=null&&a.sync||r([o.transform.x,o.transform.y,o.transform.k]),i&&!((s=o.sourceEvent)!=null&&s.internal)&&(i==null||i(o.sourceEvent,fr(o.transform)))}}function G1({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:o}){return a=>{var s;if(!((s=a.sourceEvent)!=null&&s.internal)&&(e.isZoomingOrPanning=!1,o&&vm(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&o(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){const u=fr(a.transform);e.prevViewport=u,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i==null||i(a.sourceEvent,u)},n?150:0)}}}function U1({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:o,userSelectionActive:a,noWheelClassName:s,noPanClassName:u,lib:l,connectionInProgress:c}){return f=>{var v;const d=e||t,h=n&&f.ctrlKey,p=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(Nt(f,`${l}-flow__node`)||Nt(f,`${l}-flow__edge`)))return!0;if(!r&&!d&&!i&&!o&&!n||a||c&&!p||Nt(f,s)&&p||Nt(f,u)&&(!p||i&&p&&!e)||!n&&f.ctrlKey&&p)return!1;if(!n&&f.type==="touchstart"&&((v=f.touches)==null?void 0:v.length)>1)return f.preventDefault(),!1;if(!d&&!i&&!h&&p||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const g=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||p)&&g}}function K1({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:o,onPanZoomStart:a,onPanZoomEnd:s,onDraggingChange:u}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},c=e.getBoundingClientRect(),f=zv().scaleExtent([t,n]).translateExtent(r),d=_e(e).call(f);b({x:i.x,y:i.y,zoom:Pt(i.zoom,t,n)},[[0,0],[c.width,c.height]],r);const h=d.on("wheel.zoom"),p=d.on("dblclick.zoom");f.wheelDelta(mm);function g(N,R){return d?new Promise(L=>{f==null||f.interpolate((R==null?void 0:R.interpolate)==="linear"?Jt:jn).transform(Hr(d,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>L(!0)),N)}):Promise.resolve(!1)}function v({noWheelClassName:N,noPanClassName:R,onPaneContextMenu:L,userSelectionActive:w,panOnScroll:P,panOnDrag:I,panOnScrollMode:k,panOnScrollSpeed:T,preventScrolling:M,zoomOnPinch:$,zoomOnScroll:F,zoomOnDoubleClick:j,zoomActivationKeyPressed:H,lib:z,onTransformChange:G,connectionInProgress:X,paneClickDistance:K,selectionOnDrag:B}){w&&!l.isZoomingOrPanning&&m();const U=P&&!H&&!w;f.clickDistance(B?1/0:!Ne(K)||K<0?0:K);const te=U?B1({zoomPanValues:l,noWheelClassName:N,d3Selection:d,d3Zoom:f,panOnScrollMode:k,panOnScrollSpeed:T,zoomOnPinch:$,onPanZoomStart:a,onPanZoom:o,onPanZoomEnd:s}):z1({noWheelClassName:N,preventScrolling:M,d3ZoomHandler:h});if(d.on("wheel.zoom",te,{passive:!1}),!w){const Z=H1({zoomPanValues:l,onDraggingChange:u,onPanZoomStart:a});f.on("start",Z);const Y=V1({zoomPanValues:l,panOnDrag:I,onPaneContextMenu:!!L,onPanZoom:o,onTransformChange:G});f.on("zoom",Y);const oe=G1({zoomPanValues:l,panOnDrag:I,panOnScroll:P,onPaneContextMenu:L,onPanZoomEnd:s,onDraggingChange:u});f.on("end",oe)}const J=U1({zoomActivationKeyPressed:H,panOnDrag:I,zoomOnScroll:F,panOnScroll:P,zoomOnDoubleClick:j,zoomOnPinch:$,userSelectionActive:w,noPanClassName:R,noWheelClassName:N,lib:z,connectionInProgress:X});f.filter(J),j?d.on("dblclick.zoom",p):d.on("dblclick.zoom",null)}function m(){f.on("zoom",null)}async function b(N,R,L){const w=zr(N),P=f==null?void 0:f.constrain()(w,R,L);return P&&await g(P),new Promise(I=>I(P))}async function y(N,R){const L=zr(N);return await g(L,R),new Promise(w=>w(L))}function _(N){if(d){const R=zr(N),L=d.property("__zoom");(L.k!==N.zoom||L.x!==N.x||L.y!==N.y)&&(f==null||f.transform(d,R,null,{sync:!0}))}}function C(){const N=d?Bv(d.node()):{x:0,y:0,k:1};return{x:N.x,y:N.y,zoom:N.k}}function x(N,R){return d?new Promise(L=>{f==null||f.interpolate((R==null?void 0:R.interpolate)==="linear"?Jt:jn).scaleTo(Hr(d,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>L(!0)),N)}):Promise.resolve(!1)}function E(N,R){return d?new Promise(L=>{f==null||f.interpolate((R==null?void 0:R.interpolate)==="linear"?Jt:jn).scaleBy(Hr(d,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>L(!0)),N)}):Promise.resolve(!1)}function A(N){f==null||f.scaleExtent(N)}function q(N){f==null||f.translateExtent(N)}function D(N){const R=!Ne(N)||N<0?0:N;f==null||f.clickDistance(R)}return{update:v,destroy:m,setViewport:y,setViewportConstrained:b,getViewport:C,scaleTo:x,scaleBy:E,setScaleExtent:A,setTranslateExtent:q,syncViewport:_,setClickDistance:D}}var Lt;(function(e){e.Line="line",e.Handle="handle"})(Lt||(Lt={}));function Y1({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:o}){const a=e-t,s=n-r,u=[a>0?1:a<0?-1:0,s>0?1:s<0?-1:0];return a&&i&&(u[0]=u[0]*-1),s&&o&&(u[1]=u[1]*-1),u}function Ml(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),i=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:i}}function nt(e,t){return Math.max(0,t-e)}function rt(e,t){return Math.max(0,e-t)}function qn(e,t,n){return Math.max(0,t-e,e-n)}function Rl(e,t){return e?!t:t}function W1(e,t,n,r,i,o,a,s){let{affectsX:u,affectsY:l}=t;const{isHorizontal:c,isVertical:f}=t,d=c&&f,{xSnapped:h,ySnapped:p}=n,{minWidth:g,maxWidth:v,minHeight:m,maxHeight:b}=r,{x:y,y:_,width:C,height:x,aspectRatio:E}=e;let A=Math.floor(c?h-e.pointerX:0),q=Math.floor(f?p-e.pointerY:0);const D=C+(u?-A:A),N=x+(l?-q:q),R=-o[0]*C,L=-o[1]*x;let w=qn(D,g,v),P=qn(N,m,b);if(a){let T=0,M=0;u&&A<0?T=nt(y+A+R,a[0][0]):!u&&A>0&&(T=rt(y+D+R,a[1][0])),l&&q<0?M=nt(_+q+L,a[0][1]):!l&&q>0&&(M=rt(_+N+L,a[1][1])),w=Math.max(w,T),P=Math.max(P,M)}if(s){let T=0,M=0;u&&A>0?T=rt(y+A,s[0][0]):!u&&A<0&&(T=nt(y+D,s[1][0])),l&&q>0?M=rt(_+q,s[0][1]):!l&&q<0&&(M=nt(_+N,s[1][1])),w=Math.max(w,T),P=Math.max(P,M)}if(i){if(c){const T=qn(D/E,m,b)*E;if(w=Math.max(w,T),a){let M=0;!u&&!l||u&&!l&&d?M=rt(_+L+D/E,a[1][1])*E:M=nt(_+L+(u?A:-A)/E,a[0][1])*E,w=Math.max(w,M)}if(s){let M=0;!u&&!l||u&&!l&&d?M=nt(_+D/E,s[1][1])*E:M=rt(_+(u?A:-A)/E,s[0][1])*E,w=Math.max(w,M)}}if(f){const T=qn(N*E,g,v)/E;if(P=Math.max(P,T),a){let M=0;!u&&!l||l&&!u&&d?M=rt(y+N*E+R,a[1][0])/E:M=nt(y+(l?q:-q)*E+R,a[0][0])/E,P=Math.max(P,M)}if(s){let M=0;!u&&!l||l&&!u&&d?M=nt(y+N*E,s[1][0])/E:M=rt(y+(l?q:-q)*E,s[0][0])/E,P=Math.max(P,M)}}}q=q+(q<0?P:-P),A=A+(A<0?w:-w),i&&(d?D>N*E?q=(Rl(u,l)?-A:A)/E:A=(Rl(u,l)?-q:q)*E:c?(q=A/E,l=u):(A=q*E,u=l));const I=u?y+A:y,k=l?_+q:_;return{width:C+(u?-A:A),height:x+(l?-q:q),x:o[0]*A*(u?-1:1)+I,y:o[1]*q*(l?-1:1)+k}}const ym={width:0,height:0,x:0,y:0},X1={...ym,pointerX:0,pointerY:0,aspectRatio:1};function Z1(e){return[[0,0],[e.measured.width,e.measured.height]]}function Q1(e,t,n){const r=t.position.x+e.position.x,i=t.position.y+e.position.y,o=e.measured.width??0,a=e.measured.height??0,s=n[0]*o,u=n[1]*a;return[[r-s,i-u],[r+o-s,i+a-u]]}function J1({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){const o=_e(e);let a={controlDirection:Ml("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:l,boundaries:c,keepAspectRatio:f,resizeDirection:d,onResizeStart:h,onResize:p,onResizeEnd:g,shouldResize:v}){let m={...ym},b={...X1};a={boundaries:c,resizeDirection:d,keepAspectRatio:f,controlDirection:Ml(l)};let y,_=null,C=[],x,E,A,q=!1;const D=Av().on("start",N=>{const{nodeLookup:R,transform:L,snapGrid:w,snapToGrid:P,nodeOrigin:I,paneDomNode:k}=n();if(y=R.get(t),!y)return;_=(k==null?void 0:k.getBoundingClientRect())??null;const{xSnapped:T,ySnapped:M}=en(N.sourceEvent,{transform:L,snapGrid:w,snapToGrid:P,containerBounds:_});m={width:y.measured.width??0,height:y.measured.height??0,x:y.position.x??0,y:y.position.y??0},b={...m,pointerX:T,pointerY:M,aspectRatio:m.width/m.height},x=void 0,y.parentId&&(y.extent==="parent"||y.expandParent)&&(x=R.get(y.parentId),E=x&&y.extent==="parent"?Z1(x):void 0),C=[],A=void 0;for(const[$,F]of R)if(F.parentId===t&&(C.push({id:$,position:{...F.position},extent:F.extent}),F.extent==="parent"||F.expandParent)){const j=Q1(F,y,F.origin??I);A?A=[[Math.min(j[0][0],A[0][0]),Math.min(j[0][1],A[0][1])],[Math.max(j[1][0],A[1][0]),Math.max(j[1][1],A[1][1])]]:A=j}h==null||h(N,{...m})}).on("drag",N=>{const{transform:R,snapGrid:L,snapToGrid:w,nodeOrigin:P}=n(),I=en(N.sourceEvent,{transform:R,snapGrid:L,snapToGrid:w,containerBounds:_}),k=[];if(!y)return;const{x:T,y:M,width:$,height:F}=m,j={},H=y.origin??P,{width:z,height:G,x:X,y:K}=W1(b,a.controlDirection,I,a.boundaries,a.keepAspectRatio,H,E,A),B=z!==$,U=G!==F,te=X!==T&&B,J=K!==M&&U;if(!te&&!J&&!B&&!U)return;if((te||J||H[0]===1||H[1]===1)&&(j.x=te?X:m.x,j.y=J?K:m.y,m.x=j.x,m.y=j.y,C.length>0)){const W=X-T,re=K-M;for(const Q of C)Q.position={x:Q.position.x-W+H[0]*(z-$),y:Q.position.y-re+H[1]*(G-F)},k.push(Q)}if((B||U)&&(j.width=B&&(!a.resizeDirection||a.resizeDirection==="horizontal")?z:m.width,j.height=U&&(!a.resizeDirection||a.resizeDirection==="vertical")?G:m.height,m.width=j.width,m.height=j.height),x&&y.expandParent){const W=H[0]*(j.width??0);j.x&&j.x<W&&(m.x=W,b.x=b.x-(j.x-W));const re=H[1]*(j.height??0);j.y&&j.y<re&&(m.y=re,b.y=b.y-(j.y-re))}const Z=Y1({width:m.width,prevWidth:$,height:m.height,prevHeight:F,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),Y={...m,direction:Z};(v==null?void 0:v(N,Y))!==!1&&(q=!0,p==null||p(N,Y),r(j,k))}).on("end",N=>{q&&(g==null||g(N,{...m}),i==null||i({...m}),q=!1)});o.call(D)}function u(){o.on(".drag",null)}return{update:s,destroy:u}}var Tn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function _m(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var rc={exports:{}},Vr={},Pn={exports:{}},Gr={};/**
2
+ * @license React
3
+ * use-sync-external-store-shim.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var ql;function eE(){if(ql)return Gr;ql=1;var e=O;function t(f,d){return f===d&&(f!==0||1/f===1/d)||f!==f&&d!==d}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,i=e.useEffect,o=e.useLayoutEffect,a=e.useDebugValue;function s(f,d){var h=d(),p=r({inst:{value:h,getSnapshot:d}}),g=p[0].inst,v=p[1];return o(function(){g.value=h,g.getSnapshot=d,u(g)&&v({inst:g})},[f,h,d]),i(function(){return u(g)&&v({inst:g}),f(function(){u(g)&&v({inst:g})})},[f]),a(h),h}function u(f){var d=f.getSnapshot;f=f.value;try{var h=d();return!n(f,h)}catch{return!0}}function l(f,d){return d()}var c=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:s;return Gr.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:c,Gr}var Ur={};/**
10
+ * @license React
11
+ * use-sync-external-store-shim.development.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var Tl;function tE(){return Tl||(Tl=1,process.env.NODE_ENV!=="production"&&function(){function e(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}function t(h,p){c||i.startTransition===void 0||(c=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var g=p();if(!f){var v=p();o(g,v)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}v=a({inst:{value:g,getSnapshot:p}});var m=v[0].inst,b=v[1];return u(function(){m.value=g,m.getSnapshot=p,n(m)&&b({inst:m})},[h,g,p]),s(function(){return n(m)&&b({inst:m}),h(function(){n(m)&&b({inst:m})})},[h]),l(g),g}function n(h){var p=h.getSnapshot;h=h.value;try{var g=p();return!o(h,g)}catch{return!0}}function r(h,p){return p()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var i=O,o=typeof Object.is=="function"?Object.is:e,a=i.useState,s=i.useEffect,u=i.useLayoutEffect,l=i.useDebugValue,c=!1,f=!1,d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;Ur.useSyncExternalStore=i.useSyncExternalStore!==void 0?i.useSyncExternalStore:d,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Ur}var Pl;function bm(){return Pl||(Pl=1,process.env.NODE_ENV==="production"?Pn.exports=eE():Pn.exports=tE()),Pn.exports}/**
18
+ * @license React
19
+ * use-sync-external-store-shim/with-selector.production.js
20
+ *
21
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var kl;function nE(){if(kl)return Vr;kl=1;var e=O,t=bm();function n(l,c){return l===c&&(l!==0||1/l===1/c)||l!==l&&c!==c}var r=typeof Object.is=="function"?Object.is:n,i=t.useSyncExternalStore,o=e.useRef,a=e.useEffect,s=e.useMemo,u=e.useDebugValue;return Vr.useSyncExternalStoreWithSelector=function(l,c,f,d,h){var p=o(null);if(p.current===null){var g={hasValue:!1,value:null};p.current=g}else g=p.current;p=s(function(){function m(x){if(!b){if(b=!0,y=x,x=d(x),h!==void 0&&g.hasValue){var E=g.value;if(h(E,x))return _=E}return _=x}if(E=_,r(y,x))return E;var A=d(x);return h!==void 0&&h(E,A)?(y=x,E):(y=x,_=A)}var b=!1,y,_,C=f===void 0?null:f;return[function(){return m(c())},C===null?void 0:function(){return m(C())}]},[c,f,d,h]);var v=i(l,p[0],p[1]);return a(function(){g.hasValue=!0,g.value=v},[v]),u(v),v},Vr}var Kr={};/**
26
+ * @license React
27
+ * use-sync-external-store-shim/with-selector.development.js
28
+ *
29
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var Ol;function rE(){return Ol||(Ol=1,process.env.NODE_ENV!=="production"&&function(){function e(l,c){return l===c&&(l!==0||1/l===1/c)||l!==l&&c!==c}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=O,n=bm(),r=typeof Object.is=="function"?Object.is:e,i=n.useSyncExternalStore,o=t.useRef,a=t.useEffect,s=t.useMemo,u=t.useDebugValue;Kr.useSyncExternalStoreWithSelector=function(l,c,f,d,h){var p=o(null);if(p.current===null){var g={hasValue:!1,value:null};p.current=g}else g=p.current;p=s(function(){function m(x){if(!b){if(b=!0,y=x,x=d(x),h!==void 0&&g.hasValue){var E=g.value;if(h(E,x))return _=E}return _=x}if(E=_,r(y,x))return E;var A=d(x);return h!==void 0&&h(E,A)?(y=x,E):(y=x,_=A)}var b=!1,y,_,C=f===void 0?null:f;return[function(){return m(c())},C===null?void 0:function(){return m(C())}]},[c,f,d,h]);var v=i(l,p[0],p[1]);return a(function(){g.hasValue=!0,g.value=v},[v]),u(v),v},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Kr}process.env.NODE_ENV==="production"?rc.exports=nE():rc.exports=rE();var iE=rc.exports;const oE=_m(iE),aE={},Ll=e=>{let t;const n=new Set,r=(c,f)=>{const d=typeof c=="function"?c(t):c;if(!Object.is(d,t)){const h=t;t=f??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(p=>p(t,h))}},i=()=>t,u={setState:r,getState:i,getInitialState:()=>l,subscribe:c=>(n.add(c),()=>n.delete(c)),destroy:()=>{(aE?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},l=t=e(r,i,u);return u},sE=e=>e?Ll(e):Ll,{useDebugValue:uE}=O,{useSyncExternalStoreWithSelector:cE}=oE,lE=e=>e;function xm(e,t=lE,n){const r=cE(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return uE(r),r}const Dl=(e,t)=>{const n=sE(e),r=(i,o=t)=>xm(n,i,o);return Object.assign(r,n),r},fE=(e,t)=>e?Dl(e,t):Dl;function se(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,i]of e)if(!Object.is(i,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const dr=O.createContext(null),dE=dr.Provider,wm=xe.error001();function ie(e,t){const n=O.useContext(dr);if(n===null)throw new Error(wm);return xm(n,e,t)}function ue(){const e=O.useContext(dr);if(e===null)throw new Error(wm);return O.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const $l={display:"none"},hE={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Em="react-flow__node-desc",Sm="react-flow__edge-desc",pE="react-flow__aria-live",gE=e=>e.ariaLiveMessage,vE=e=>e.ariaLabelConfig;function mE({rfId:e}){const t=ie(gE);return S.jsx("div",{id:`${pE}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:hE,children:t})}function yE({rfId:e,disableKeyboardA11y:t}){const n=ie(vE);return S.jsxs(S.Fragment,{children:[S.jsx("div",{id:`${Em}-${e}`,style:$l,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),S.jsx("div",{id:`${Sm}-${e}`,style:$l,children:n["edge.a11yDescription.default"]}),!t&&S.jsx(mE,{rfId:e})]})}const hr=O.forwardRef(({position:e="top-left",children:t,className:n,style:r,...i},o)=>{const a=`${e}`.split("-");return S.jsx("div",{className:fe(["react-flow__panel",n,...a]),style:r,ref:o,...i,children:t})});hr.displayName="Panel";function _E({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:S.jsx(hr,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:S.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const bE=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},kn=e=>e.id;function xE(e,t){return se(e.selectedNodes.map(kn),t.selectedNodes.map(kn))&&se(e.selectedEdges.map(kn),t.selectedEdges.map(kn))}function wE({onSelectionChange:e}){const t=ue(),{selectedNodes:n,selectedEdges:r}=ie(bE,xE);return O.useEffect(()=>{const i={nodes:n,edges:r};e==null||e(i),t.getState().onSelectionChangeHandlers.forEach(o=>o(i))},[n,r,e]),null}const EE=e=>!!e.onSelectionChangeHandlers;function SE({onSelectionChange:e}){const t=ie(EE);return e||t?S.jsx(wE,{onSelectionChange:e}):null}const Cm=[0,0],CE={x:0,y:0,zoom:1},NE=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],jl=[...NE,"rfId"],AE=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),Fl={translateExtent:an,nodeOrigin:Cm,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function IE(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:o,setNodeExtent:a,reset:s,setDefaultNodesAndEdges:u}=ie(AE,se),l=ue();O.useEffect(()=>(u(e.defaultNodes,e.defaultEdges),()=>{c.current=Fl,s()}),[]);const c=O.useRef(Fl);return O.useEffect(()=>{for(const f of jl){const d=e[f],h=c.current[f];d!==h&&(typeof e[f]>"u"||(f==="nodes"?t(d):f==="edges"?n(d):f==="minZoom"?r(d):f==="maxZoom"?i(d):f==="translateExtent"?o(d):f==="nodeExtent"?a(d):f==="ariaLabelConfig"?l.setState({ariaLabelConfig:f1(d)}):f==="fitView"?l.setState({fitViewQueued:d}):f==="fitViewOptions"?l.setState({fitViewOptions:d}):l.setState({[f]:d})))}c.current=e},jl.map(f=>e[f])),null}function Bl(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function ME(e){var r;const[t,n]=O.useState(e==="system"?null:e);return O.useEffect(()=>{if(e!=="system"){n(e);return}const i=Bl(),o=()=>n(i!=null&&i.matches?"dark":"light");return o(),i==null||i.addEventListener("change",o),()=>{i==null||i.removeEventListener("change",o)}},[e]),t!==null?t:(r=Bl())!=null&&r.matches?"dark":"light"}const zl=typeof document<"u"?document:null;function ln(e=null,t={target:zl,actInsideInputWithModifier:!0}){const[n,r]=O.useState(!1),i=O.useRef(!1),o=O.useRef(new Set([])),[a,s]=O.useMemo(()=>{if(e!==null){const l=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",`
34
+ `).replace(`
35
+
36
+ `,`
37
+ +`).split(`
38
+ `)),c=l.reduce((f,d)=>f.concat(...d),[]);return[l,c]}return[[],[]]},[e]);return O.useEffect(()=>{const u=(t==null?void 0:t.target)??zl,l=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const c=h=>{var v,m;if(i.current=h.ctrlKey||h.metaKey||h.shiftKey||h.altKey,(!i.current||i.current&&!l)&&nm(h))return!1;const g=Vl(h.code,s);if(o.current.add(h[g]),Hl(a,o.current,!1)){const b=((m=(v=h.composedPath)==null?void 0:v.call(h))==null?void 0:m[0])||h.target,y=(b==null?void 0:b.nodeName)==="BUTTON"||(b==null?void 0:b.nodeName)==="A";t.preventDefault!==!1&&(i.current||!y)&&h.preventDefault(),r(!0)}},f=h=>{const p=Vl(h.code,s);Hl(a,o.current,!0)?(r(!1),o.current.clear()):o.current.delete(h[p]),h.key==="Meta"&&o.current.clear(),i.current=!1},d=()=>{o.current.clear(),r(!1)};return u==null||u.addEventListener("keydown",c),u==null||u.addEventListener("keyup",f),window.addEventListener("blur",d),window.addEventListener("contextmenu",d),()=>{u==null||u.removeEventListener("keydown",c),u==null||u.removeEventListener("keyup",f),window.removeEventListener("blur",d),window.removeEventListener("contextmenu",d)}}},[e,r]),n}function Hl(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(i=>t.has(i)))}function Vl(e,t){return t.includes(e)?"code":"key"}const RE=()=>{const e=ue();return O.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,{duration:n==null?void 0:n.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,i,o],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??o},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:i,minZoom:o,maxZoom:a,panZoom:s}=e.getState(),u=mc(t,r,i,o,a,(n==null?void 0:n.padding)??.1);return s?(await s.setViewport(u,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:i,snapToGrid:o,domNode:a}=e.getState();if(!a)return t;const{x:s,y:u}=a.getBoundingClientRect(),l={x:t.x-s,y:t.y-u},c=n.snapGrid??i,f=n.snapToGrid??o;return vn(l,r,f,c)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:i,y:o}=r.getBoundingClientRect(),a=Qn(t,n);return{x:a.x+i,y:a.y+o}}}),[])};function Nm(e,t){const n=[],r=new Map,i=[];for(const o of e)if(o.type==="add"){i.push(o);continue}else if(o.type==="remove"||o.type==="replace")r.set(o.id,[o]);else{const a=r.get(o.id);a?a.push(o):r.set(o.id,[o])}for(const o of t){const a=r.get(o.id);if(!a){n.push(o);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){n.push({...a[0].item});continue}const s={...o};for(const u of a)qE(u,s);n.push(s)}return i.length&&i.forEach(o=>{o.index!==void 0?n.splice(o.index,0,{...o.item}):n.push({...o.item})}),n}function qE(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function Am(e,t){return Nm(e,t)}function Im(e,t){return Nm(e,t)}function lt(e,t){return{id:e,type:"select",selected:t}}function At(e,t=new Set,n=!1){const r=[];for(const[i,o]of e){const a=t.has(i);!(o.selected===void 0&&!a)&&o.selected!==a&&(n&&(o.selected=a),r.push(lt(o.id,a)))}return r}function Gl({items:e=[],lookup:t}){var i;const n=[],r=new Map(e.map(o=>[o.id,o]));for(const[o,a]of e.entries()){const s=t.get(a.id),u=((i=s==null?void 0:s.internals)==null?void 0:i.userNode)??s;u!==void 0&&u!==a&&n.push({id:a.id,item:a,type:"replace"}),u===void 0&&n.push({item:a,type:"add",index:o})}for(const[o]of t)r.get(o)===void 0&&n.push({id:o,type:"remove"});return n}function Ul(e){return{id:e.id,type:"remove"}}const Kl=e=>n1(e),TE=e=>Kv(e);function Mm(e){return O.forwardRef(e)}const PE=typeof window<"u"?O.useLayoutEffect:O.useEffect;function Yl(e){const[t,n]=O.useState(BigInt(0)),[r]=O.useState(()=>kE(()=>n(i=>i+BigInt(1))));return PE(()=>{const i=r.get();i.length&&(e(i),r.reset())},[t]),r}function kE(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const Rm=O.createContext(null);function OE({children:e}){const t=ue(),n=O.useCallback(s=>{const{nodes:u=[],setNodes:l,hasDefaultNodes:c,onNodesChange:f,nodeLookup:d,fitViewQueued:h,onNodesChangeMiddlewareMap:p}=t.getState();let g=u;for(const m of s)g=typeof m=="function"?m(g):m;let v=Gl({items:g,lookup:d});for(const m of p.values())v=m(v);c&&l(g),v.length>0?f==null||f(v):h&&window.requestAnimationFrame(()=>{const{fitViewQueued:m,nodes:b,setNodes:y}=t.getState();m&&y(b)})},[]),r=Yl(n),i=O.useCallback(s=>{const{edges:u=[],setEdges:l,hasDefaultEdges:c,onEdgesChange:f,edgeLookup:d}=t.getState();let h=u;for(const p of s)h=typeof p=="function"?p(h):p;c?l(h):f&&f(Gl({items:h,lookup:d}))},[]),o=Yl(i),a=O.useMemo(()=>({nodeQueue:r,edgeQueue:o}),[]);return S.jsx(Rm.Provider,{value:a,children:e})}function LE(){const e=O.useContext(Rm);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const DE=e=>!!e.panZoom;function Sc(){const e=RE(),t=ue(),n=LE(),r=ie(DE),i=O.useMemo(()=>{const o=f=>t.getState().nodeLookup.get(f),a=f=>{n.nodeQueue.push(f)},s=f=>{n.edgeQueue.push(f)},u=f=>{var m,b;const{nodeLookup:d,nodeOrigin:h}=t.getState(),p=Kl(f)?f:d.get(f.id),g=p.parentId?em(p.position,p.measured,p.parentId,d,h):p.position,v={...p,position:g,width:((m=p.measured)==null?void 0:m.width)??p.width,height:((b=p.measured)==null?void 0:b.height)??p.height};return kt(v)},l=(f,d,h={replace:!1})=>{a(p=>p.map(g=>{if(g.id===f){const v=typeof d=="function"?d(g):d;return h.replace&&Kl(v)?v:{...g,...v}}return g}))},c=(f,d,h={replace:!1})=>{s(p=>p.map(g=>{if(g.id===f){const v=typeof d=="function"?d(g):d;return h.replace&&TE(v)?v:{...g,...v}}return g}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>{var d;return(d=o(f))==null?void 0:d.internals.userNode},getInternalNode:o,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(d=>({...d}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:a,setEdges:s,addNodes:f=>{const d=Array.isArray(f)?f:[f];n.nodeQueue.push(h=>[...h,...d])},addEdges:f=>{const d=Array.isArray(f)?f:[f];n.edgeQueue.push(h=>[...h,...d])},toObject:()=>{const{nodes:f=[],edges:d=[],transform:h}=t.getState(),[p,g,v]=h;return{nodes:f.map(m=>({...m})),edges:d.map(m=>({...m})),viewport:{x:p,y:g,zoom:v}}},deleteElements:async({nodes:f=[],edges:d=[]})=>{const{nodes:h,edges:p,onNodesDelete:g,onEdgesDelete:v,triggerNodeChanges:m,triggerEdgeChanges:b,onDelete:y,onBeforeDelete:_}=t.getState(),{nodes:C,edges:x}=await s1({nodesToRemove:f,edgesToRemove:d,nodes:h,edges:p,onBeforeDelete:_}),E=x.length>0,A=C.length>0;if(E){const q=x.map(Ul);v==null||v(x),b(q)}if(A){const q=C.map(Ul);g==null||g(C),m(q)}return(A||E)&&(y==null||y({nodes:C,edges:x})),{deletedNodes:C,deletedEdges:x}},getIntersectingNodes:(f,d=!0,h)=>{const p=yl(f),g=p?f:u(f),v=h!==void 0;return g?(h||t.getState().nodes).filter(m=>{const b=t.getState().nodeLookup.get(m.id);if(b&&!p&&(m.id===f.id||!b.internals.positionAbsolute))return!1;const y=kt(v?m:b),_=un(y,g);return d&&_>0||_>=y.width*y.height||_>=g.width*g.height}):[]},isNodeIntersecting:(f,d,h=!0)=>{const g=yl(f)?f:u(f);if(!g)return!1;const v=un(g,d);return h&&v>0||v>=d.width*d.height||v>=g.width*g.height},updateNode:l,updateNodeData:(f,d,h={replace:!1})=>{l(f,p=>{const g=typeof d=="function"?d(p):d;return h.replace?{...p,data:g}:{...p,data:{...p.data,...g}}},h)},updateEdge:c,updateEdgeData:(f,d,h={replace:!1})=>{c(f,p=>{const g=typeof d=="function"?d(p):d;return h.replace?{...p,data:g}:{...p,data:{...p.data,...g}}},h)},getNodesBounds:f=>{const{nodeLookup:d,nodeOrigin:h}=t.getState();return r1(f,{nodeLookup:d,nodeOrigin:h})},getHandleConnections:({type:f,id:d,nodeId:h})=>{var p;return Array.from(((p=t.getState().connectionLookup.get(`${h}-${f}${d?`-${d}`:""}`))==null?void 0:p.values())??[])},getNodeConnections:({type:f,handleId:d,nodeId:h})=>{var p;return Array.from(((p=t.getState().connectionLookup.get(`${h}${f?d?`-${f}-${d}`:`-${f}`:""}`))==null?void 0:p.values())??[])},fitView:async f=>{const d=t.getState().fitViewResolver??l1();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:d}),n.nodeQueue.push(h=>[...h]),d.promise}}},[]);return O.useMemo(()=>({...i,...e,viewportInitialized:r}),[r])}const Wl=e=>e.selected,$E=typeof window<"u"?window:void 0;function jE({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=ue(),{deleteElements:r}=Sc(),i=ln(e,{actInsideInputWithModifier:!1}),o=ln(t,{target:$E});O.useEffect(()=>{if(i){const{edges:a,nodes:s}=n.getState();r({nodes:s.filter(Wl),edges:a.filter(Wl)}),n.setState({nodesSelectionActive:!1})}},[i]),O.useEffect(()=>{n.setState({multiSelectionActive:o})},[o])}function FE(e){const t=ue();O.useEffect(()=>{const n=()=>{var i,o,a,s;if(!e.current||!(((o=(i=e.current).checkVisibility)==null?void 0:o.call(i))??!0))return!1;const r=yc(e.current);(r.height===0||r.width===0)&&((s=(a=t.getState()).onError)==null||s.call(a,"004",xe.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const pr={position:"absolute",width:"100%",height:"100%",top:0,left:0},BE=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function zE({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:o=pt.Free,zoomOnDoubleClick:a=!0,panOnDrag:s=!0,defaultViewport:u,translateExtent:l,minZoom:c,maxZoom:f,zoomActivationKeyCode:d,preventScrolling:h=!0,children:p,noWheelClassName:g,noPanClassName:v,onViewportChange:m,isControlledViewport:b,paneClickDistance:y,selectionOnDrag:_}){const C=ue(),x=O.useRef(null),{userSelectionActive:E,lib:A,connectionInProgress:q}=ie(BE,se),D=ln(d),N=O.useRef();FE(x);const R=O.useCallback(L=>{m==null||m({x:L[0],y:L[1],zoom:L[2]}),b||C.setState({transform:L})},[m,b]);return O.useEffect(()=>{if(x.current){N.current=K1({domNode:x.current,minZoom:c,maxZoom:f,translateExtent:l,viewport:u,onDraggingChange:I=>C.setState({paneDragging:I}),onPanZoomStart:(I,k)=>{const{onViewportChangeStart:T,onMoveStart:M}=C.getState();M==null||M(I,k),T==null||T(k)},onPanZoom:(I,k)=>{const{onViewportChange:T,onMove:M}=C.getState();M==null||M(I,k),T==null||T(k)},onPanZoomEnd:(I,k)=>{const{onViewportChangeEnd:T,onMoveEnd:M}=C.getState();M==null||M(I,k),T==null||T(k)}});const{x:L,y:w,zoom:P}=N.current.getViewport();return C.setState({panZoom:N.current,transform:[L,w,P],domNode:x.current.closest(".react-flow")}),()=>{var I;(I=N.current)==null||I.destroy()}}},[]),O.useEffect(()=>{var L;(L=N.current)==null||L.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:o,zoomOnDoubleClick:a,panOnDrag:s,zoomActivationKeyPressed:D,preventScrolling:h,noPanClassName:v,userSelectionActive:E,noWheelClassName:g,lib:A,onTransformChange:R,connectionInProgress:q,selectionOnDrag:_,paneClickDistance:y})},[e,t,n,r,i,o,a,s,D,h,v,E,g,A,R,q,_,y]),S.jsx("div",{className:"react-flow__renderer",ref:x,style:pr,children:p})}const HE=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function VE(){const{userSelectionActive:e,userSelectionRect:t}=ie(HE,se);return e&&t?S.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const Yr=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},GE=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function UE({isSelecting:e,selectionKeyPressed:t,selectionMode:n=sn.Full,panOnDrag:r,paneClickDistance:i,selectionOnDrag:o,onSelectionStart:a,onSelectionEnd:s,onPaneClick:u,onPaneContextMenu:l,onPaneScroll:c,onPaneMouseEnter:f,onPaneMouseMove:d,onPaneMouseLeave:h,children:p}){const g=ue(),{userSelectionActive:v,elementsSelectable:m,dragging:b,connectionInProgress:y}=ie(GE,se),_=m&&(e||v),C=O.useRef(null),x=O.useRef(),E=O.useRef(new Set),A=O.useRef(new Set),q=O.useRef(!1),D=T=>{if(q.current||y){q.current=!1;return}u==null||u(T),g.getState().resetSelectedElements(),g.setState({nodesSelectionActive:!1})},N=T=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){T.preventDefault();return}l==null||l(T)},R=c?T=>c(T):void 0,L=T=>{q.current&&(T.stopPropagation(),q.current=!1)},w=T=>{var G,X;const{domNode:M}=g.getState();if(x.current=M==null?void 0:M.getBoundingClientRect(),!x.current)return;const $=T.target===C.current;if(!$&&!!T.target.closest(".nokey")||!e||!(o&&$||t)||T.button!==0||!T.isPrimary)return;(X=(G=T.target)==null?void 0:G.setPointerCapture)==null||X.call(G,T.pointerId),q.current=!1;const{x:H,y:z}=Ae(T.nativeEvent,x.current);g.setState({userSelectionRect:{width:0,height:0,startX:H,startY:z,x:H,y:z}}),$||(T.stopPropagation(),T.preventDefault())},P=T=>{const{userSelectionRect:M,transform:$,nodeLookup:F,edgeLookup:j,connectionLookup:H,triggerNodeChanges:z,triggerEdgeChanges:G,defaultEdgeOptions:X,resetSelectedElements:K}=g.getState();if(!x.current||!M)return;const{x:B,y:U}=Ae(T.nativeEvent,x.current),{startX:te,startY:J}=M;if(!q.current){const re=t?0:i;if(Math.hypot(B-te,U-J)<=re)return;K(),a==null||a(T)}q.current=!0;const Z={startX:te,startY:J,x:B<te?B:te,y:U<J?U:J,width:Math.abs(B-te),height:Math.abs(U-J)},Y=E.current,oe=A.current;E.current=new Set(vc(F,Z,$,n===sn.Partial,!0).map(re=>re.id)),A.current=new Set;const W=(X==null?void 0:X.selectable)??!0;for(const re of E.current){const Q=H.get(re);if(Q)for(const{edgeId:pe}of Q.values()){const he=j.get(pe);he&&(he.selectable??W)&&A.current.add(pe)}}if(!_l(Y,E.current)){const re=At(F,E.current,!0);z(re)}if(!_l(oe,A.current)){const re=At(j,A.current);G(re)}g.setState({userSelectionRect:Z,userSelectionActive:!0,nodesSelectionActive:!1})},I=T=>{var M,$;T.button===0&&(($=(M=T.target)==null?void 0:M.releasePointerCapture)==null||$.call(M,T.pointerId),!v&&T.target===C.current&&g.getState().userSelectionRect&&(D==null||D(T)),g.setState({userSelectionActive:!1,userSelectionRect:null}),q.current&&(s==null||s(T),g.setState({nodesSelectionActive:E.current.size>0})))},k=r===!0||Array.isArray(r)&&r.includes(0);return S.jsxs("div",{className:fe(["react-flow__pane",{draggable:k,dragging:b,selection:e}]),onClick:_?void 0:Yr(D,C),onContextMenu:Yr(N,C),onWheel:Yr(R,C),onPointerEnter:_?void 0:f,onPointerMove:_?P:d,onPointerUp:_?I:void 0,onPointerDownCapture:_?w:void 0,onClickCapture:_?L:void 0,onPointerLeave:h,ref:C,style:pr,children:[p,S.jsx(VE,{})]})}function ic({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:i,unselectNodesAndEdges:o,multiSelectionActive:a,nodeLookup:s,onError:u}=t.getState(),l=s.get(e);if(!l){u==null||u("012",xe.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&a)&&(o({nodes:[l],edges:[]}),requestAnimationFrame(()=>{var c;return(c=r==null?void 0:r.current)==null?void 0:c.blur()})):i([e])}function qm({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:o,nodeClickDistance:a}){const s=ue(),[u,l]=O.useState(!1),c=O.useRef();return O.useEffect(()=>{c.current=P1({getStoreItems:()=>s.getState(),onNodeMouseDown:f=>{ic({id:f,store:s,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}})},[]),O.useEffect(()=>{var f,d;if(t)(f=c.current)==null||f.destroy();else if(e.current)return(d=c.current)==null||d.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:o,nodeId:i,nodeClickDistance:a}),()=>{var h;(h=c.current)==null||h.destroy()}},[n,r,t,o,e,i]),u}const KE=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function Tm(){const e=ue();return O.useCallback(n=>{const{nodeExtent:r,snapToGrid:i,snapGrid:o,nodesDraggable:a,onError:s,updateNodePositions:u,nodeLookup:l,nodeOrigin:c}=e.getState(),f=new Map,d=KE(a),h=i?o[0]:5,p=i?o[1]:5,g=n.direction.x*h*n.factor,v=n.direction.y*p*n.factor;for(const[,m]of l){if(!d(m))continue;let b={x:m.internals.positionAbsolute.x+g,y:m.internals.positionAbsolute.y+v};i&&(b=gn(b,o));const{position:y,positionAbsolute:_}=Yv({nodeId:m.id,nextPosition:b,nodeLookup:l,nodeExtent:r,nodeOrigin:c,onError:s});m.position=y,m.internals.positionAbsolute=_,f.set(m.id,m)}u(f)},[])}const Cc=O.createContext(null),YE=Cc.Provider;Cc.Consumer;const Pm=()=>O.useContext(Cc),WE=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),XE=(e,t,n)=>r=>{const{connectionClickStartHandle:i,connectionMode:o,connection:a}=r,{fromHandle:s,toHandle:u,isValid:l}=a,c=(u==null?void 0:u.nodeId)===e&&(u==null?void 0:u.id)===t&&(u==null?void 0:u.type)===n;return{connectingFrom:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===t&&(s==null?void 0:s.type)===n,connectingTo:c,clickConnecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.id)===t&&(i==null?void 0:i.type)===n,isPossibleEndHandle:o===Tt.Strict?(s==null?void 0:s.type)!==n:e!==(s==null?void 0:s.nodeId)||t!==(s==null?void 0:s.id),connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:c&&l}};function ZE({type:e="source",position:t=V.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:o=!0,id:a,onConnect:s,children:u,className:l,onMouseDown:c,onTouchStart:f,...d},h){var P,I;const p=a||null,g=e==="target",v=ue(),m=Pm(),{connectOnClick:b,noPanClassName:y,rfId:_}=ie(WE,se),{connectingFrom:C,connectingTo:x,clickConnecting:E,isPossibleEndHandle:A,connectionInProcess:q,clickConnectionInProcess:D,valid:N}=ie(XE(m,p,e),se);m||(I=(P=v.getState()).onError)==null||I.call(P,"010",xe.error010());const R=k=>{const{defaultEdgeOptions:T,onConnect:M,hasDefaultEdges:$}=v.getState(),F={...T,...k};if($){const{edges:j,setEdges:H}=v.getState();H(m1(F,j))}M==null||M(F),s==null||s(F)},L=k=>{if(!m)return;const T=rm(k.nativeEvent);if(i&&(T&&k.button===0||!T)){const M=v.getState();nc.onPointerDown(k.nativeEvent,{handleDomNode:k.currentTarget,autoPanOnConnect:M.autoPanOnConnect,connectionMode:M.connectionMode,connectionRadius:M.connectionRadius,domNode:M.domNode,nodeLookup:M.nodeLookup,lib:M.lib,isTarget:g,handleId:p,nodeId:m,flowId:M.rfId,panBy:M.panBy,cancelConnection:M.cancelConnection,onConnectStart:M.onConnectStart,onConnectEnd:M.onConnectEnd,updateConnection:M.updateConnection,onConnect:R,isValidConnection:n||M.isValidConnection,getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,autoPanSpeed:M.autoPanSpeed,dragThreshold:M.connectionDragThreshold})}T?c==null||c(k):f==null||f(k)},w=k=>{const{onClickConnectStart:T,onClickConnectEnd:M,connectionClickStartHandle:$,connectionMode:F,isValidConnection:j,lib:H,rfId:z,nodeLookup:G,connection:X}=v.getState();if(!m||!$&&!i)return;if(!$){T==null||T(k.nativeEvent,{nodeId:m,handleId:p,handleType:e}),v.setState({connectionClickStartHandle:{nodeId:m,type:e,id:p}});return}const K=tm(k.target),B=n||j,{connection:U,isValid:te}=nc.isValid(k.nativeEvent,{handle:{nodeId:m,id:p,type:e},connectionMode:F,fromNodeId:$.nodeId,fromHandleId:$.id||null,fromType:$.type,isValidConnection:B,flowId:z,doc:K,lib:H,nodeLookup:G});te&&U&&R(U);const J=structuredClone(X);delete J.inProgress,J.toPosition=J.toHandle?J.toHandle.position:null,M==null||M(k,J),v.setState({connectionClickStartHandle:null})};return S.jsx("div",{"data-handleid":p,"data-nodeid":m,"data-handlepos":t,"data-id":`${_}-${m}-${p}-${e}`,className:fe(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",y,l,{source:!g,target:g,connectable:r,connectablestart:i,connectableend:o,clickconnecting:E,connectingfrom:C,connectingto:x,valid:N,connectionindicator:r&&(!q||A)&&(q||D?o:i)}]),onMouseDown:L,onTouchStart:L,onClick:b?w:void 0,ref:h,...d,children:u})}const Dt=O.memo(Mm(ZE));function QE({data:e,isConnectable:t,sourcePosition:n=V.Bottom}){return S.jsxs(S.Fragment,{children:[e==null?void 0:e.label,S.jsx(Dt,{type:"source",position:n,isConnectable:t})]})}function JE({data:e,isConnectable:t,targetPosition:n=V.Top,sourcePosition:r=V.Bottom}){return S.jsxs(S.Fragment,{children:[S.jsx(Dt,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,S.jsx(Dt,{type:"source",position:r,isConnectable:t})]})}function eS(){return null}function tS({data:e,isConnectable:t,targetPosition:n=V.Top}){return S.jsxs(S.Fragment,{children:[S.jsx(Dt,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Jn={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Xl={input:QE,default:JE,output:tS,group:eS};function nS(e){var t,n,r,i;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((i=e.style)==null?void 0:i.height)}}const rS=e=>{const{width:t,height:n,x:r,y:i}=pn(e.nodeLookup,{filter:o=>!!o.selected});return{width:Ne(t)?t:null,height:Ne(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function iS({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=ue(),{width:i,height:o,transformString:a,userSelectionActive:s}=ie(rS,se),u=Tm(),l=O.useRef(null);if(O.useEffect(()=>{var d;n||(d=l.current)==null||d.focus({preventScroll:!0})},[n]),qm({nodeRef:l}),s||!i||!o)return null;const c=e?d=>{const h=r.getState().nodes.filter(p=>p.selected);e(d,h)}:void 0,f=d=>{Object.prototype.hasOwnProperty.call(Jn,d.key)&&(d.preventDefault(),u({direction:Jn[d.key],factor:d.shiftKey?4:1}))};return S.jsx("div",{className:fe(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:S.jsx("div",{ref:l,className:"react-flow__nodesselection-rect",onContextMenu:c,tabIndex:n?void 0:-1,onKeyDown:n?void 0:f,style:{width:i,height:o}})})}const Zl=typeof window<"u"?window:void 0,oS=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function km({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:o,onPaneScroll:a,paneClickDistance:s,deleteKeyCode:u,selectionKeyCode:l,selectionOnDrag:c,selectionMode:f,onSelectionStart:d,onSelectionEnd:h,multiSelectionKeyCode:p,panActivationKeyCode:g,zoomActivationKeyCode:v,elementsSelectable:m,zoomOnScroll:b,zoomOnPinch:y,panOnScroll:_,panOnScrollSpeed:C,panOnScrollMode:x,zoomOnDoubleClick:E,panOnDrag:A,defaultViewport:q,translateExtent:D,minZoom:N,maxZoom:R,preventScrolling:L,onSelectionContextMenu:w,noWheelClassName:P,noPanClassName:I,disableKeyboardA11y:k,onViewportChange:T,isControlledViewport:M}){const{nodesSelectionActive:$,userSelectionActive:F}=ie(oS,se),j=ln(l,{target:Zl}),H=ln(g,{target:Zl}),z=H||A,G=H||_,X=c&&z!==!0,K=j||F||X;return jE({deleteKeyCode:u,multiSelectionKeyCode:p}),S.jsx(zE,{onPaneContextMenu:o,elementsSelectable:m,zoomOnScroll:b,zoomOnPinch:y,panOnScroll:G,panOnScrollSpeed:C,panOnScrollMode:x,zoomOnDoubleClick:E,panOnDrag:!j&&z,defaultViewport:q,translateExtent:D,minZoom:N,maxZoom:R,zoomActivationKeyCode:v,preventScrolling:L,noWheelClassName:P,noPanClassName:I,onViewportChange:T,isControlledViewport:M,paneClickDistance:s,selectionOnDrag:X,children:S.jsxs(UE,{onSelectionStart:d,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:o,onPaneScroll:a,panOnDrag:z,isSelecting:!!K,selectionMode:f,selectionKeyPressed:j,paneClickDistance:s,selectionOnDrag:X,children:[e,$&&S.jsx(iS,{onSelectionContextMenu:w,noPanClassName:I,disableKeyboardA11y:k})]})})}km.displayName="FlowRenderer";const aS=O.memo(km),sS=e=>t=>e?vc(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function uS(e){return ie(O.useCallback(sS(e),[e]),se)}const cS=e=>e.updateNodeInternals;function lS(){const e=ie(cS),[t]=O.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(i=>{const o=i.target.getAttribute("data-id");r.set(o,{id:o,nodeElement:i.target,force:!0})}),e(r)}));return O.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function fS({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const i=ue(),o=O.useRef(null),a=O.useRef(null),s=O.useRef(e.sourcePosition),u=O.useRef(e.targetPosition),l=O.useRef(t),c=n&&!!e.internals.handleBounds;return O.useEffect(()=>{o.current&&!e.hidden&&(!c||a.current!==o.current)&&(a.current&&(r==null||r.unobserve(a.current)),r==null||r.observe(o.current),a.current=o.current)},[c,e.hidden]),O.useEffect(()=>()=>{a.current&&(r==null||r.unobserve(a.current),a.current=null)},[]),O.useEffect(()=>{if(o.current){const f=l.current!==t,d=s.current!==e.sourcePosition,h=u.current!==e.targetPosition;(f||d||h)&&(l.current=t,s.current=e.sourcePosition,u.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:o.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),o}function dS({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:o,onDoubleClick:a,nodesDraggable:s,elementsSelectable:u,nodesConnectable:l,nodesFocusable:c,resizeObserver:f,noDragClassName:d,noPanClassName:h,disableKeyboardA11y:p,rfId:g,nodeTypes:v,nodeClickDistance:m,onError:b}){const{node:y,internals:_,isParent:C}=ie(B=>{const U=B.nodeLookup.get(e),te=B.parentLookup.has(e);return{node:U,internals:U.internals,isParent:te}},se);let x=y.type||"default",E=(v==null?void 0:v[x])||Xl[x];E===void 0&&(b==null||b("003",xe.error003(x)),x="default",E=(v==null?void 0:v.default)||Xl.default);const A=!!(y.draggable||s&&typeof y.draggable>"u"),q=!!(y.selectable||u&&typeof y.selectable>"u"),D=!!(y.connectable||l&&typeof y.connectable>"u"),N=!!(y.focusable||c&&typeof y.focusable>"u"),R=ue(),L=Jv(y),w=fS({node:y,nodeType:x,hasDimensions:L,resizeObserver:f}),P=qm({nodeRef:w,disabled:y.hidden||!A,noDragClassName:d,handleSelector:y.dragHandle,nodeId:e,isSelectable:q,nodeClickDistance:m}),I=Tm();if(y.hidden)return null;const k=Xe(y),T=nS(y),M=q||A||t||n||r||i,$=n?B=>n(B,{..._.userNode}):void 0,F=r?B=>r(B,{..._.userNode}):void 0,j=i?B=>i(B,{..._.userNode}):void 0,H=o?B=>o(B,{..._.userNode}):void 0,z=a?B=>a(B,{..._.userNode}):void 0,G=B=>{const{selectNodesOnDrag:U,nodeDragThreshold:te}=R.getState();q&&(!U||!A||te>0)&&ic({id:e,store:R,nodeRef:w}),t&&t(B,{..._.userNode})},X=B=>{if(!(nm(B.nativeEvent)||p)){if(Hv.includes(B.key)&&q){const U=B.key==="Escape";ic({id:e,store:R,unselect:U,nodeRef:w})}else if(A&&y.selected&&Object.prototype.hasOwnProperty.call(Jn,B.key)){B.preventDefault();const{ariaLabelConfig:U}=R.getState();R.setState({ariaLiveMessage:U["node.a11yDescription.ariaLiveMessage"]({direction:B.key.replace("Arrow","").toLowerCase(),x:~~_.positionAbsolute.x,y:~~_.positionAbsolute.y})}),I({direction:Jn[B.key],factor:B.shiftKey?4:1})}}},K=()=>{var oe;if(p||!((oe=w.current)!=null&&oe.matches(":focus-visible")))return;const{transform:B,width:U,height:te,autoPanOnNodeFocus:J,setCenter:Z}=R.getState();if(!J)return;vc(new Map([[e,y]]),{x:0,y:0,width:U,height:te},B,!0).length>0||Z(y.position.x+k.width/2,y.position.y+k.height/2,{zoom:B[2]})};return S.jsx("div",{className:fe(["react-flow__node",`react-flow__node-${x}`,{[h]:A},y.className,{selected:y.selected,selectable:q,parent:C,draggable:A,dragging:P}]),ref:w,style:{zIndex:_.z,transform:`translate(${_.positionAbsolute.x}px,${_.positionAbsolute.y}px)`,pointerEvents:M?"all":"none",visibility:L?"visible":"hidden",...y.style,...T},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:$,onMouseMove:F,onMouseLeave:j,onContextMenu:H,onClick:G,onDoubleClick:z,onKeyDown:N?X:void 0,tabIndex:N?0:void 0,onFocus:N?K:void 0,role:y.ariaRole??(N?"group":void 0),"aria-roledescription":"node","aria-describedby":p?void 0:`${Em}-${g}`,"aria-label":y.ariaLabel,...y.domAttributes,children:S.jsx(YE,{value:e,children:S.jsx(E,{id:e,data:y.data,type:x,positionAbsoluteX:_.positionAbsolute.x,positionAbsoluteY:_.positionAbsolute.y,selected:y.selected??!1,selectable:q,draggable:A,deletable:y.deletable??!0,isConnectable:D,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:P,dragHandle:y.dragHandle,zIndex:_.z,parentId:y.parentId,...k})})})}var hS=O.memo(dS);const pS=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Om(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,onError:o}=ie(pS,se),a=uS(e.onlyRenderVisibleElements),s=lS();return S.jsx("div",{className:"react-flow__nodes",style:pr,children:a.map(u=>S.jsx(hS,{id:u,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:s,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,nodeClickDistance:e.nodeClickDistance,onError:o},u))})}Om.displayName="NodeRenderer";const gS=O.memo(Om);function vS(e){return ie(O.useCallback(n=>{if(!e)return n.edges.map(i=>i.id);const r=[];if(n.width&&n.height)for(const i of n.edges){const o=n.nodeLookup.get(i.source),a=n.nodeLookup.get(i.target);o&&a&&p1({sourceNode:o,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&r.push(i.id)}return r},[e]),se)}const mS=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return S.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},yS=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return S.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Ql={[Xn.Arrow]:mS,[Xn.ArrowClosed]:yS};function _S(e){const t=ue();return O.useMemo(()=>{var i,o;return Object.prototype.hasOwnProperty.call(Ql,e)?Ql[e]:((o=(i=t.getState()).onError)==null||o.call(i,"009",xe.error009(e)),null)},[e])}const bS=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:o="strokeWidth",strokeWidth:a,orient:s="auto-start-reverse"})=>{const u=_S(t);return u?S.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:o,orient:s,refX:"0",refY:"0",children:S.jsx(u,{color:n,strokeWidth:a})}):null},Lm=({defaultColor:e,rfId:t})=>{const n=ie(o=>o.edges),r=ie(o=>o.defaultEdgeOptions),i=O.useMemo(()=>w1(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return i.length?S.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:S.jsx("defs",{children:i.map(o=>S.jsx(bS,{id:o.id,type:o.type,color:o.color,width:o.width,height:o.height,markerUnits:o.markerUnits,strokeWidth:o.strokeWidth,orient:o.orient},o.id))})}):null};Lm.displayName="MarkerDefinitions";var xS=O.memo(Lm);function Dm({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:o,labelBgPadding:a=[2,4],labelBgBorderRadius:s=2,children:u,className:l,...c}){const[f,d]=O.useState({x:1,y:0,width:0,height:0}),h=fe(["react-flow__edge-textwrapper",l]),p=O.useRef(null);return O.useEffect(()=>{if(p.current){const g=p.current.getBBox();d({x:g.x,y:g.y,width:g.width,height:g.height})}},[n]),n?S.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:h,visibility:f.width?"visible":"hidden",...c,children:[i&&S.jsx("rect",{width:f.width+2*a[0],x:-a[0],y:-a[1],height:f.height+2*a[1],className:"react-flow__edge-textbg",style:o,rx:s,ry:s}),S.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:p,style:r,children:n}),u]}):null}Dm.displayName="EdgeText";const wS=O.memo(Dm);function gr({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:o,labelBgStyle:a,labelBgPadding:s,labelBgBorderRadius:u,interactionWidth:l=20,...c}){return S.jsxs(S.Fragment,{children:[S.jsx("path",{...c,d:e,fill:"none",className:fe(["react-flow__edge-path",c.className])}),l?S.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:l,className:"react-flow__edge-interaction"}):null,r&&Ne(t)&&Ne(n)?S.jsx(wS,{x:t,y:n,label:r,labelStyle:i,labelShowBg:o,labelBgStyle:a,labelBgPadding:s,labelBgBorderRadius:u}):null]})}function Jl({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===V.Left||e===V.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function $m({sourceX:e,sourceY:t,sourcePosition:n=V.Bottom,targetX:r,targetY:i,targetPosition:o=V.Top}){const[a,s]=Jl({pos:n,x1:e,y1:t,x2:r,y2:i}),[u,l]=Jl({pos:o,x1:r,y1:i,x2:e,y2:t}),[c,f,d,h]=im({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:a,sourceControlY:s,targetControlX:u,targetControlY:l});return[`M${e},${t} C${a},${s} ${u},${l} ${r},${i}`,c,f,d,h]}function jm(e){return O.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:o,sourcePosition:a,targetPosition:s,label:u,labelStyle:l,labelShowBg:c,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:h,style:p,markerEnd:g,markerStart:v,interactionWidth:m})=>{const[b,y,_]=$m({sourceX:n,sourceY:r,sourcePosition:a,targetX:i,targetY:o,targetPosition:s}),C=e.isInternal?void 0:t;return S.jsx(gr,{id:C,path:b,labelX:y,labelY:_,label:u,labelStyle:l,labelShowBg:c,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:h,style:p,markerEnd:g,markerStart:v,interactionWidth:m})})}const ES=jm({isInternal:!1}),Fm=jm({isInternal:!0});ES.displayName="SimpleBezierEdge";Fm.displayName="SimpleBezierEdgeInternal";function Bm(e){return O.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:o,label:a,labelStyle:s,labelShowBg:u,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:f,style:d,sourcePosition:h=V.Bottom,targetPosition:p=V.Top,markerEnd:g,markerStart:v,pathOptions:m,interactionWidth:b})=>{const[y,_,C]=Ju({sourceX:n,sourceY:r,sourcePosition:h,targetX:i,targetY:o,targetPosition:p,borderRadius:m==null?void 0:m.borderRadius,offset:m==null?void 0:m.offset,stepPosition:m==null?void 0:m.stepPosition}),x=e.isInternal?void 0:t;return S.jsx(gr,{id:x,path:y,labelX:_,labelY:C,label:a,labelStyle:s,labelShowBg:u,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:f,style:d,markerEnd:g,markerStart:v,interactionWidth:b})})}const zm=Bm({isInternal:!1}),Hm=Bm({isInternal:!0});zm.displayName="SmoothStepEdge";Hm.displayName="SmoothStepEdgeInternal";function Vm(e){return O.memo(({id:t,...n})=>{var i;const r=e.isInternal?void 0:t;return S.jsx(zm,{...n,id:r,pathOptions:O.useMemo(()=>{var o;return{borderRadius:0,offset:(o=n.pathOptions)==null?void 0:o.offset}},[(i=n.pathOptions)==null?void 0:i.offset])})})}const SS=Vm({isInternal:!1}),Gm=Vm({isInternal:!0});SS.displayName="StepEdge";Gm.displayName="StepEdgeInternal";function Um(e){return O.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:o,label:a,labelStyle:s,labelShowBg:u,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:f,style:d,markerEnd:h,markerStart:p,interactionWidth:g})=>{const[v,m,b]=sm({sourceX:n,sourceY:r,targetX:i,targetY:o}),y=e.isInternal?void 0:t;return S.jsx(gr,{id:y,path:v,labelX:m,labelY:b,label:a,labelStyle:s,labelShowBg:u,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:f,style:d,markerEnd:h,markerStart:p,interactionWidth:g})})}const CS=Um({isInternal:!1}),Km=Um({isInternal:!0});CS.displayName="StraightEdge";Km.displayName="StraightEdgeInternal";function Ym(e){return O.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:o,sourcePosition:a=V.Bottom,targetPosition:s=V.Top,label:u,labelStyle:l,labelShowBg:c,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:h,style:p,markerEnd:g,markerStart:v,pathOptions:m,interactionWidth:b})=>{const[y,_,C]=om({sourceX:n,sourceY:r,sourcePosition:a,targetX:i,targetY:o,targetPosition:s,curvature:m==null?void 0:m.curvature}),x=e.isInternal?void 0:t;return S.jsx(gr,{id:x,path:y,labelX:_,labelY:C,label:u,labelStyle:l,labelShowBg:c,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:h,style:p,markerEnd:g,markerStart:v,interactionWidth:b})})}const NS=Ym({isInternal:!1}),Wm=Ym({isInternal:!0});NS.displayName="BezierEdge";Wm.displayName="BezierEdgeInternal";const ef={default:Wm,straight:Km,step:Gm,smoothstep:Hm,simplebezier:Fm},tf={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},AS=(e,t,n)=>n===V.Left?e-t:n===V.Right?e+t:e,IS=(e,t,n)=>n===V.Top?e-t:n===V.Bottom?e+t:e,nf="react-flow__edgeupdater";function rf({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:o,onMouseOut:a,type:s}){return S.jsx("circle",{onMouseDown:i,onMouseEnter:o,onMouseOut:a,className:fe([nf,`${nf}-${s}`]),cx:AS(t,r,e),cy:IS(n,r,e),r,stroke:"transparent",fill:"transparent"})}function MS({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:o,targetY:a,sourcePosition:s,targetPosition:u,onReconnect:l,onReconnectStart:c,onReconnectEnd:f,setReconnecting:d,setUpdateHover:h}){const p=ue(),g=(_,C)=>{if(_.button!==0)return;const{autoPanOnConnect:x,domNode:E,isValidConnection:A,connectionMode:q,connectionRadius:D,lib:N,onConnectStart:R,onConnectEnd:L,cancelConnection:w,nodeLookup:P,rfId:I,panBy:k,updateConnection:T}=p.getState(),M=C.type==="target",$=(H,z)=>{d(!1),f==null||f(H,n,C.type,z)},F=H=>l==null?void 0:l(n,H),j=(H,z)=>{d(!0),c==null||c(_,n,C.type),R==null||R(H,z)};nc.onPointerDown(_.nativeEvent,{autoPanOnConnect:x,connectionMode:q,connectionRadius:D,domNode:E,handleId:C.id,nodeId:C.nodeId,nodeLookup:P,isTarget:M,edgeUpdaterType:C.type,lib:N,flowId:I,cancelConnection:w,panBy:k,isValidConnection:A,onConnect:F,onConnectStart:j,onConnectEnd:L,onReconnectEnd:$,updateConnection:T,getTransform:()=>p.getState().transform,getFromHandle:()=>p.getState().connection.fromHandle,dragThreshold:p.getState().connectionDragThreshold,handleDomNode:_.currentTarget})},v=_=>g(_,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),m=_=>g(_,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),b=()=>h(!0),y=()=>h(!1);return S.jsxs(S.Fragment,{children:[(e===!0||e==="source")&&S.jsx(rf,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:v,onMouseEnter:b,onMouseOut:y,type:"source"}),(e===!0||e==="target")&&S.jsx(rf,{position:u,centerX:o,centerY:a,radius:t,onMouseDown:m,onMouseEnter:b,onMouseOut:y,type:"target"})]})}function RS({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:o,onContextMenu:a,onMouseEnter:s,onMouseMove:u,onMouseLeave:l,reconnectRadius:c,onReconnect:f,onReconnectStart:d,onReconnectEnd:h,rfId:p,edgeTypes:g,noPanClassName:v,onError:m,disableKeyboardA11y:b}){let y=ie(Z=>Z.edgeLookup.get(e));const _=ie(Z=>Z.defaultEdgeOptions);y=_?{..._,...y}:y;let C=y.type||"default",x=(g==null?void 0:g[C])||ef[C];x===void 0&&(m==null||m("011",xe.error011(C)),C="default",x=(g==null?void 0:g.default)||ef.default);const E=!!(y.focusable||t&&typeof y.focusable>"u"),A=typeof f<"u"&&(y.reconnectable||n&&typeof y.reconnectable>"u"),q=!!(y.selectable||r&&typeof y.selectable>"u"),D=O.useRef(null),[N,R]=O.useState(!1),[L,w]=O.useState(!1),P=ue(),{zIndex:I,sourceX:k,sourceY:T,targetX:M,targetY:$,sourcePosition:F,targetPosition:j}=ie(O.useCallback(Z=>{const Y=Z.nodeLookup.get(y.source),oe=Z.nodeLookup.get(y.target);if(!Y||!oe)return{zIndex:y.zIndex,...tf};const W=x1({id:e,sourceNode:Y,targetNode:oe,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:Z.connectionMode,onError:m});return{zIndex:h1({selected:y.selected,zIndex:y.zIndex,sourceNode:Y,targetNode:oe,elevateOnSelect:Z.elevateEdgesOnSelect,zIndexMode:Z.zIndexMode}),...W||tf}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),se),H=O.useMemo(()=>y.markerStart?`url('#${ec(y.markerStart,p)}')`:void 0,[y.markerStart,p]),z=O.useMemo(()=>y.markerEnd?`url('#${ec(y.markerEnd,p)}')`:void 0,[y.markerEnd,p]);if(y.hidden||k===null||T===null||M===null||$===null)return null;const G=Z=>{var re;const{addSelectedEdges:Y,unselectNodesAndEdges:oe,multiSelectionActive:W}=P.getState();q&&(P.setState({nodesSelectionActive:!1}),y.selected&&W?(oe({nodes:[],edges:[y]}),(re=D.current)==null||re.blur()):Y([e])),i&&i(Z,y)},X=o?Z=>{o(Z,{...y})}:void 0,K=a?Z=>{a(Z,{...y})}:void 0,B=s?Z=>{s(Z,{...y})}:void 0,U=u?Z=>{u(Z,{...y})}:void 0,te=l?Z=>{l(Z,{...y})}:void 0,J=Z=>{var Y;if(!b&&Hv.includes(Z.key)&&q){const{unselectNodesAndEdges:oe,addSelectedEdges:W}=P.getState();Z.key==="Escape"?((Y=D.current)==null||Y.blur(),oe({edges:[y]})):W([e])}};return S.jsx("svg",{style:{zIndex:I},children:S.jsxs("g",{className:fe(["react-flow__edge",`react-flow__edge-${C}`,y.className,v,{selected:y.selected,animated:y.animated,inactive:!q&&!i,updating:N,selectable:q}]),onClick:G,onDoubleClick:X,onContextMenu:K,onMouseEnter:B,onMouseMove:U,onMouseLeave:te,onKeyDown:E?J:void 0,tabIndex:E?0:void 0,role:y.ariaRole??(E?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":E?`${Sm}-${p}`:void 0,ref:D,...y.domAttributes,children:[!L&&S.jsx(x,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:q,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:k,sourceY:T,targetX:M,targetY:$,sourcePosition:F,targetPosition:j,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:H,markerEnd:z,pathOptions:"pathOptions"in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),A&&S.jsx(MS,{edge:y,isReconnectable:A,reconnectRadius:c,onReconnect:f,onReconnectStart:d,onReconnectEnd:h,sourceX:k,sourceY:T,targetX:M,targetY:$,sourcePosition:F,targetPosition:j,setUpdateHover:R,setReconnecting:w})]})})}var qS=O.memo(RS);const TS=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Xm({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:o,onEdgeContextMenu:a,onEdgeMouseEnter:s,onEdgeMouseMove:u,onEdgeMouseLeave:l,onEdgeClick:c,reconnectRadius:f,onEdgeDoubleClick:d,onReconnectStart:h,onReconnectEnd:p,disableKeyboardA11y:g}){const{edgesFocusable:v,edgesReconnectable:m,elementsSelectable:b,onError:y}=ie(TS,se),_=vS(t);return S.jsxs("div",{className:"react-flow__edges",children:[S.jsx(xS,{defaultColor:e,rfId:n}),_.map(C=>S.jsx(qS,{id:C,edgesFocusable:v,edgesReconnectable:m,elementsSelectable:b,noPanClassName:i,onReconnect:o,onContextMenu:a,onMouseEnter:s,onMouseMove:u,onMouseLeave:l,onClick:c,reconnectRadius:f,onDoubleClick:d,onReconnectStart:h,onReconnectEnd:p,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:g},C))]})}Xm.displayName="EdgeRenderer";const PS=O.memo(Xm),kS=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function OS({children:e}){const t=ie(kS);return S.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function LS(e){const t=Sc(),n=O.useRef(!1);O.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const DS=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function $S(e){const t=ie(DS),n=ue();return O.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function jS(e){return e.connection.inProgress?{...e.connection,to:vn(e.connection.to,e.transform)}:{...e.connection}}function FS(e){return jS}function BS(e){const t=FS();return ie(t,se)}const zS=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function HS({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:i,width:o,height:a,isValid:s,inProgress:u}=ie(zS,se);return!(o&&i&&u)?null:S.jsx("svg",{style:e,width:o,height:a,className:"react-flow__connectionline react-flow__container",children:S.jsx("g",{className:fe(["react-flow__connection",Uv(s)]),children:S.jsx(Zm,{style:t,type:n,CustomComponent:r,isValid:s})})})}const Zm=({style:e,type:t=ot.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:i,from:o,fromNode:a,fromHandle:s,fromPosition:u,to:l,toNode:c,toHandle:f,toPosition:d,pointer:h}=BS();if(!i)return;if(n)return S.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:a,fromHandle:s,fromX:o.x,fromY:o.y,toX:l.x,toY:l.y,fromPosition:u,toPosition:d,connectionStatus:Uv(r),toNode:c,toHandle:f,pointer:h});let p="";const g={sourceX:o.x,sourceY:o.y,sourcePosition:u,targetX:l.x,targetY:l.y,targetPosition:d};switch(t){case ot.Bezier:[p]=om(g);break;case ot.SimpleBezier:[p]=$m(g);break;case ot.Step:[p]=Ju({...g,borderRadius:0});break;case ot.SmoothStep:[p]=Ju(g);break;default:[p]=sm(g)}return S.jsx("path",{d:p,fill:"none",className:"react-flow__connection-path",style:e})};Zm.displayName="ConnectionLine";const VS={};function of(e=VS){const t=O.useRef(e),n=ue();O.useEffect(()=>{var r,i;if(process.env.NODE_ENV==="development"){const o=new Set([...Object.keys(t.current),...Object.keys(e)]);for(const a of o)if(t.current[a]!==e[a]){(i=(r=n.getState()).onError)==null||i.call(r,"002",xe.error002());break}t.current=e}},[e])}function GS(){const e=ue(),t=O.useRef(!1);O.useEffect(()=>{var n,r;if(process.env.NODE_ENV==="development"&&!t.current){const i=document.querySelector(".react-flow__pane");i&&window.getComputedStyle(i).zIndex!=="1"&&((r=(n=e.getState()).onError)==null||r.call(n,"013",xe.error013("react"))),t.current=!0}},[])}function Qm({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:o,onEdgeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:u,onNodeMouseLeave:l,onNodeContextMenu:c,onSelectionContextMenu:f,onSelectionStart:d,onSelectionEnd:h,connectionLineType:p,connectionLineStyle:g,connectionLineComponent:v,connectionLineContainerStyle:m,selectionKeyCode:b,selectionOnDrag:y,selectionMode:_,multiSelectionKeyCode:C,panActivationKeyCode:x,zoomActivationKeyCode:E,deleteKeyCode:A,onlyRenderVisibleElements:q,elementsSelectable:D,defaultViewport:N,translateExtent:R,minZoom:L,maxZoom:w,preventScrolling:P,defaultMarkerColor:I,zoomOnScroll:k,zoomOnPinch:T,panOnScroll:M,panOnScrollSpeed:$,panOnScrollMode:F,zoomOnDoubleClick:j,panOnDrag:H,onPaneClick:z,onPaneMouseEnter:G,onPaneMouseMove:X,onPaneMouseLeave:K,onPaneScroll:B,onPaneContextMenu:U,paneClickDistance:te,nodeClickDistance:J,onEdgeContextMenu:Z,onEdgeMouseEnter:Y,onEdgeMouseMove:oe,onEdgeMouseLeave:W,reconnectRadius:re,onReconnect:Q,onReconnectStart:pe,onReconnectEnd:he,noDragClassName:$e,noWheelClassName:qe,noPanClassName:ge,disableKeyboardA11y:le,nodeExtent:Je,rfId:je,viewport:et,onViewportChange:tt}){return of(e),of(t),GS(),LS(n),$S(et),S.jsx(aS,{onPaneClick:z,onPaneMouseEnter:G,onPaneMouseMove:X,onPaneMouseLeave:K,onPaneContextMenu:U,onPaneScroll:B,paneClickDistance:te,deleteKeyCode:A,selectionKeyCode:b,selectionOnDrag:y,selectionMode:_,onSelectionStart:d,onSelectionEnd:h,multiSelectionKeyCode:C,panActivationKeyCode:x,zoomActivationKeyCode:E,elementsSelectable:D,zoomOnScroll:k,zoomOnPinch:T,zoomOnDoubleClick:j,panOnScroll:M,panOnScrollSpeed:$,panOnScrollMode:F,panOnDrag:H,defaultViewport:N,translateExtent:R,minZoom:L,maxZoom:w,onSelectionContextMenu:f,preventScrolling:P,noDragClassName:$e,noWheelClassName:qe,noPanClassName:ge,disableKeyboardA11y:le,onViewportChange:tt,isControlledViewport:!!et,children:S.jsxs(OS,{children:[S.jsx(PS,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:a,onReconnect:Q,onReconnectStart:pe,onReconnectEnd:he,onlyRenderVisibleElements:q,onEdgeContextMenu:Z,onEdgeMouseEnter:Y,onEdgeMouseMove:oe,onEdgeMouseLeave:W,reconnectRadius:re,defaultMarkerColor:I,noPanClassName:ge,disableKeyboardA11y:le,rfId:je}),S.jsx(HS,{style:g,type:p,component:v,containerStyle:m}),S.jsx("div",{className:"react-flow__edgelabel-renderer"}),S.jsx(gS,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:o,onNodeMouseEnter:s,onNodeMouseMove:u,onNodeMouseLeave:l,onNodeContextMenu:c,nodeClickDistance:J,onlyRenderVisibleElements:q,noPanClassName:ge,noDragClassName:$e,disableKeyboardA11y:le,nodeExtent:Je,rfId:je}),S.jsx("div",{className:"react-flow__viewport-portal"})]})})}Qm.displayName="GraphView";const US=O.memo(Qm),af=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:o,fitView:a,fitViewOptions:s,minZoom:u=.5,maxZoom:l=2,nodeOrigin:c,nodeExtent:f,zIndexMode:d="basic"}={})=>{const h=new Map,p=new Map,g=new Map,v=new Map,m=r??t??[],b=n??e??[],y=c??[0,0],_=f??an;lm(g,v,m);const C=tc(b,h,p,{nodeOrigin:y,nodeExtent:_,zIndexMode:d});let x=[0,0,1];if(a&&i&&o){const E=pn(h,{filter:N=>!!((N.width||N.initialWidth)&&(N.height||N.initialHeight))}),{x:A,y:q,zoom:D}=mc(E,i,o,u,l,(s==null?void 0:s.padding)??.1);x=[A,q,D]}return{rfId:"1",width:i??0,height:o??0,transform:x,nodes:b,nodesInitialized:C,nodeLookup:h,parentLookup:p,edges:m,edgeLookup:v,connectionLookup:g,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:u,maxZoom:l,translateExtent:an,nodeExtent:_,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Tt.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:y,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:a??!1,fitViewOptions:s,fitViewResolver:null,connection:{...Gv},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Qv,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Vv,zIndexMode:d,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},KS=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:o,fitView:a,fitViewOptions:s,minZoom:u,maxZoom:l,nodeOrigin:c,nodeExtent:f,zIndexMode:d})=>fE((h,p)=>{async function g(){const{nodeLookup:v,panZoom:m,fitViewOptions:b,fitViewResolver:y,width:_,height:C,minZoom:x,maxZoom:E}=p();m&&(await a1({nodes:v,width:_,height:C,panZoom:m,minZoom:x,maxZoom:E},b),y==null||y.resolve(!0),h({fitViewResolver:null}))}return{...af({nodes:e,edges:t,width:i,height:o,fitView:a,fitViewOptions:s,minZoom:u,maxZoom:l,nodeOrigin:c,nodeExtent:f,defaultNodes:n,defaultEdges:r,zIndexMode:d}),setNodes:v=>{const{nodeLookup:m,parentLookup:b,nodeOrigin:y,elevateNodesOnSelect:_,fitViewQueued:C,zIndexMode:x}=p(),E=tc(v,m,b,{nodeOrigin:y,nodeExtent:f,elevateNodesOnSelect:_,checkEquality:!0,zIndexMode:x});C&&E?(g(),h({nodes:v,nodesInitialized:E,fitViewQueued:!1,fitViewOptions:void 0})):h({nodes:v,nodesInitialized:E})},setEdges:v=>{const{connectionLookup:m,edgeLookup:b}=p();lm(m,b,v),h({edges:v})},setDefaultNodesAndEdges:(v,m)=>{if(v){const{setNodes:b}=p();b(v),h({hasDefaultNodes:!0})}if(m){const{setEdges:b}=p();b(m),h({hasDefaultEdges:!0})}},updateNodeInternals:v=>{const{triggerNodeChanges:m,nodeLookup:b,parentLookup:y,domNode:_,nodeOrigin:C,nodeExtent:x,debug:E,fitViewQueued:A,zIndexMode:q}=p(),{changes:D,updatedInternals:N}=M1(v,b,y,_,C,x,q);N&&(C1(b,y,{nodeOrigin:C,nodeExtent:x,zIndexMode:q}),A?(g(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),(D==null?void 0:D.length)>0&&(E&&console.log("React Flow: trigger node changes",D),m==null||m(D)))},updateNodePositions:(v,m=!1)=>{const b=[];let y=[];const{nodeLookup:_,triggerNodeChanges:C,connection:x,updateConnection:E,onNodesChangeMiddlewareMap:A}=p();for(const[q,D]of v){const N=_.get(q),R=!!(N!=null&&N.expandParent&&(N!=null&&N.parentId)&&(D!=null&&D.position)),L={id:q,type:"position",position:R?{x:Math.max(0,D.position.x),y:Math.max(0,D.position.y)}:D.position,dragging:m};if(N&&x.inProgress&&x.fromNode.id===N.id){const w=yt(N,x.fromHandle,V.Left,!0);E({...x,from:w})}R&&N.parentId&&b.push({id:q,parentId:N.parentId,rect:{...D.internals.positionAbsolute,width:D.measured.width??0,height:D.measured.height??0}}),y.push(L)}if(b.length>0){const{parentLookup:q,nodeOrigin:D}=p(),N=Ec(b,_,q,D);y.push(...N)}for(const q of A.values())y=q(y);C(y)},triggerNodeChanges:v=>{const{onNodesChange:m,setNodes:b,nodes:y,hasDefaultNodes:_,debug:C}=p();if(v!=null&&v.length){if(_){const x=Am(v,y);b(x)}C&&console.log("React Flow: trigger node changes",v),m==null||m(v)}},triggerEdgeChanges:v=>{const{onEdgesChange:m,setEdges:b,edges:y,hasDefaultEdges:_,debug:C}=p();if(v!=null&&v.length){if(_){const x=Im(v,y);b(x)}C&&console.log("React Flow: trigger edge changes",v),m==null||m(v)}},addSelectedNodes:v=>{const{multiSelectionActive:m,edgeLookup:b,nodeLookup:y,triggerNodeChanges:_,triggerEdgeChanges:C}=p();if(m){const x=v.map(E=>lt(E,!0));_(x);return}_(At(y,new Set([...v]),!0)),C(At(b))},addSelectedEdges:v=>{const{multiSelectionActive:m,edgeLookup:b,nodeLookup:y,triggerNodeChanges:_,triggerEdgeChanges:C}=p();if(m){const x=v.map(E=>lt(E,!0));C(x);return}C(At(b,new Set([...v]))),_(At(y,new Set,!0))},unselectNodesAndEdges:({nodes:v,edges:m}={})=>{const{edges:b,nodes:y,nodeLookup:_,triggerNodeChanges:C,triggerEdgeChanges:x}=p(),E=v||y,A=m||b,q=E.map(N=>{const R=_.get(N.id);return R&&(R.selected=!1),lt(N.id,!1)}),D=A.map(N=>lt(N.id,!1));C(q),x(D)},setMinZoom:v=>{const{panZoom:m,maxZoom:b}=p();m==null||m.setScaleExtent([v,b]),h({minZoom:v})},setMaxZoom:v=>{const{panZoom:m,minZoom:b}=p();m==null||m.setScaleExtent([b,v]),h({maxZoom:v})},setTranslateExtent:v=>{var m;(m=p().panZoom)==null||m.setTranslateExtent(v),h({translateExtent:v})},resetSelectedElements:()=>{const{edges:v,nodes:m,triggerNodeChanges:b,triggerEdgeChanges:y,elementsSelectable:_}=p();if(!_)return;const C=m.reduce((E,A)=>A.selected?[...E,lt(A.id,!1)]:E,[]),x=v.reduce((E,A)=>A.selected?[...E,lt(A.id,!1)]:E,[]);b(C),y(x)},setNodeExtent:v=>{const{nodes:m,nodeLookup:b,parentLookup:y,nodeOrigin:_,elevateNodesOnSelect:C,nodeExtent:x,zIndexMode:E}=p();v[0][0]===x[0][0]&&v[0][1]===x[0][1]&&v[1][0]===x[1][0]&&v[1][1]===x[1][1]||(tc(m,b,y,{nodeOrigin:_,nodeExtent:v,elevateNodesOnSelect:C,checkEquality:!1,zIndexMode:E}),h({nodeExtent:v}))},panBy:v=>{const{transform:m,width:b,height:y,panZoom:_,translateExtent:C}=p();return R1({delta:v,panZoom:_,transform:m,translateExtent:C,width:b,height:y})},setCenter:async(v,m,b)=>{const{width:y,height:_,maxZoom:C,panZoom:x}=p();if(!x)return Promise.resolve(!1);const E=typeof(b==null?void 0:b.zoom)<"u"?b.zoom:C;return await x.setViewport({x:y/2-v*E,y:_/2-m*E,zoom:E},{duration:b==null?void 0:b.duration,ease:b==null?void 0:b.ease,interpolate:b==null?void 0:b.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{h({connection:{...Gv}})},updateConnection:v=>{h({connection:v})},reset:()=>h({...af()})}},Object.is);function YS({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:o,initialMinZoom:a,initialMaxZoom:s,initialFitViewOptions:u,fitView:l,nodeOrigin:c,nodeExtent:f,zIndexMode:d,children:h}){const[p]=O.useState(()=>KS({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:o,fitView:l,minZoom:a,maxZoom:s,fitViewOptions:u,nodeOrigin:c,nodeExtent:f,zIndexMode:d}));return S.jsx(dE,{value:p,children:S.jsx(OE,{children:h})})}function WS({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:o,height:a,fitView:s,fitViewOptions:u,minZoom:l,maxZoom:c,nodeOrigin:f,nodeExtent:d,zIndexMode:h}){return O.useContext(dr)?S.jsx(S.Fragment,{children:e}):S.jsx(YS,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:o,initialHeight:a,fitView:s,initialFitViewOptions:u,initialMinZoom:l,initialMaxZoom:c,nodeOrigin:f,nodeExtent:d,zIndexMode:h,children:e})}const XS={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function ZS({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:o,edgeTypes:a,onNodeClick:s,onEdgeClick:u,onInit:l,onMove:c,onMoveStart:f,onMoveEnd:d,onConnect:h,onConnectStart:p,onConnectEnd:g,onClickConnectStart:v,onClickConnectEnd:m,onNodeMouseEnter:b,onNodeMouseMove:y,onNodeMouseLeave:_,onNodeContextMenu:C,onNodeDoubleClick:x,onNodeDragStart:E,onNodeDrag:A,onNodeDragStop:q,onNodesDelete:D,onEdgesDelete:N,onDelete:R,onSelectionChange:L,onSelectionDragStart:w,onSelectionDrag:P,onSelectionDragStop:I,onSelectionContextMenu:k,onSelectionStart:T,onSelectionEnd:M,onBeforeDelete:$,connectionMode:F,connectionLineType:j=ot.Bezier,connectionLineStyle:H,connectionLineComponent:z,connectionLineContainerStyle:G,deleteKeyCode:X="Backspace",selectionKeyCode:K="Shift",selectionOnDrag:B=!1,selectionMode:U=sn.Full,panActivationKeyCode:te="Space",multiSelectionKeyCode:J=cn()?"Meta":"Control",zoomActivationKeyCode:Z=cn()?"Meta":"Control",snapToGrid:Y,snapGrid:oe,onlyRenderVisibleElements:W=!1,selectNodesOnDrag:re,nodesDraggable:Q,autoPanOnNodeFocus:pe,nodesConnectable:he,nodesFocusable:$e,nodeOrigin:qe=Cm,edgesFocusable:ge,edgesReconnectable:le,elementsSelectable:Je=!0,defaultViewport:je=CE,minZoom:et=.5,maxZoom:tt=2,translateExtent:Fe=an,preventScrolling:wn=!0,nodeExtent:St,defaultMarkerColor:Or="#b1b1b7",zoomOnScroll:En=!0,zoomOnPinch:Te=!0,panOnScroll:Be=!1,panOnScrollSpeed:C0=.5,panOnScrollMode:N0=pt.Free,zoomOnDoubleClick:A0=!0,panOnDrag:I0=!0,onPaneClick:M0,onPaneMouseEnter:R0,onPaneMouseMove:q0,onPaneMouseLeave:T0,onPaneScroll:P0,onPaneContextMenu:k0,paneClickDistance:O0=1,nodeClickDistance:L0=0,children:D0,onReconnect:$0,onReconnectStart:j0,onReconnectEnd:F0,onEdgeContextMenu:B0,onEdgeDoubleClick:z0,onEdgeMouseEnter:H0,onEdgeMouseMove:V0,onEdgeMouseLeave:G0,reconnectRadius:U0=10,onNodesChange:K0,onEdgesChange:Y0,noDragClassName:W0="nodrag",noWheelClassName:X0="nowheel",noPanClassName:Uc="nopan",fitView:Kc,fitViewOptions:Yc,connectOnClick:Z0,attributionPosition:Q0,proOptions:J0,defaultEdgeOptions:e_,elevateNodesOnSelect:t_=!0,elevateEdgesOnSelect:n_=!1,disableKeyboardA11y:Wc=!1,autoPanOnConnect:r_,autoPanOnNodeDrag:i_,autoPanSpeed:o_,connectionRadius:a_,isValidConnection:s_,onError:u_,style:c_,id:Xc,nodeDragThreshold:l_,connectionDragThreshold:f_,viewport:d_,onViewportChange:h_,width:p_,height:g_,colorMode:v_="light",debug:m_,onScroll:Sn,ariaLabelConfig:y_,zIndexMode:Zc="basic",...__},b_){const Lr=Xc||"1",x_=ME(v_),w_=O.useCallback(Qc=>{Qc.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Sn==null||Sn(Qc)},[Sn]);return S.jsx("div",{"data-testid":"rf__wrapper",...__,onScroll:w_,style:{...c_,...XS},ref:b_,className:fe(["react-flow",i,x_]),id:Xc,role:"application",children:S.jsxs(WS,{nodes:e,edges:t,width:p_,height:g_,fitView:Kc,fitViewOptions:Yc,minZoom:et,maxZoom:tt,nodeOrigin:qe,nodeExtent:St,zIndexMode:Zc,children:[S.jsx(US,{onInit:l,onNodeClick:s,onEdgeClick:u,onNodeMouseEnter:b,onNodeMouseMove:y,onNodeMouseLeave:_,onNodeContextMenu:C,onNodeDoubleClick:x,nodeTypes:o,edgeTypes:a,connectionLineType:j,connectionLineStyle:H,connectionLineComponent:z,connectionLineContainerStyle:G,selectionKeyCode:K,selectionOnDrag:B,selectionMode:U,deleteKeyCode:X,multiSelectionKeyCode:J,panActivationKeyCode:te,zoomActivationKeyCode:Z,onlyRenderVisibleElements:W,defaultViewport:je,translateExtent:Fe,minZoom:et,maxZoom:tt,preventScrolling:wn,zoomOnScroll:En,zoomOnPinch:Te,zoomOnDoubleClick:A0,panOnScroll:Be,panOnScrollSpeed:C0,panOnScrollMode:N0,panOnDrag:I0,onPaneClick:M0,onPaneMouseEnter:R0,onPaneMouseMove:q0,onPaneMouseLeave:T0,onPaneScroll:P0,onPaneContextMenu:k0,paneClickDistance:O0,nodeClickDistance:L0,onSelectionContextMenu:k,onSelectionStart:T,onSelectionEnd:M,onReconnect:$0,onReconnectStart:j0,onReconnectEnd:F0,onEdgeContextMenu:B0,onEdgeDoubleClick:z0,onEdgeMouseEnter:H0,onEdgeMouseMove:V0,onEdgeMouseLeave:G0,reconnectRadius:U0,defaultMarkerColor:Or,noDragClassName:W0,noWheelClassName:X0,noPanClassName:Uc,rfId:Lr,disableKeyboardA11y:Wc,nodeExtent:St,viewport:d_,onViewportChange:h_}),S.jsx(IE,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:p,onConnectEnd:g,onClickConnectStart:v,onClickConnectEnd:m,nodesDraggable:Q,autoPanOnNodeFocus:pe,nodesConnectable:he,nodesFocusable:$e,edgesFocusable:ge,edgesReconnectable:le,elementsSelectable:Je,elevateNodesOnSelect:t_,elevateEdgesOnSelect:n_,minZoom:et,maxZoom:tt,nodeExtent:St,onNodesChange:K0,onEdgesChange:Y0,snapToGrid:Y,snapGrid:oe,connectionMode:F,translateExtent:Fe,connectOnClick:Z0,defaultEdgeOptions:e_,fitView:Kc,fitViewOptions:Yc,onNodesDelete:D,onEdgesDelete:N,onDelete:R,onNodeDragStart:E,onNodeDrag:A,onNodeDragStop:q,onSelectionDrag:P,onSelectionDragStart:w,onSelectionDragStop:I,onMove:c,onMoveStart:f,onMoveEnd:d,noPanClassName:Uc,nodeOrigin:qe,rfId:Lr,autoPanOnConnect:r_,autoPanOnNodeDrag:i_,autoPanSpeed:o_,onError:u_,connectionRadius:a_,isValidConnection:s_,selectNodesOnDrag:re,nodeDragThreshold:l_,connectionDragThreshold:f_,onBeforeDelete:$,debug:m_,ariaLabelConfig:y_,zIndexMode:Zc}),S.jsx(SE,{onSelectionChange:L}),D0,S.jsx(_E,{proOptions:J0,position:Q0}),S.jsx(yE,{rfId:Lr,disableKeyboardA11y:Wc})]})})}var QS=Mm(ZS);function JS(e){const[t,n]=O.useState(e),r=O.useCallback(i=>n(o=>Am(i,o)),[]);return[t,n,r]}function eC(e){const[t,n]=O.useState(e),r=O.useCallback(i=>n(o=>Im(i,o)),[]);return[t,n,r]}function tC({dimensions:e,lineWidth:t,variant:n,className:r}){return S.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:fe(["react-flow__background-pattern",n,r])})}function nC({radius:e,className:t}){return S.jsx("circle",{cx:e,cy:e,r:e,className:fe(["react-flow__background-pattern","dots",t])})}var Ke;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Ke||(Ke={}));const rC={[Ke.Dots]:1,[Ke.Lines]:1,[Ke.Cross]:6},iC=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Jm({id:e,variant:t=Ke.Dots,gap:n=20,size:r,lineWidth:i=1,offset:o=0,color:a,bgColor:s,style:u,className:l,patternClassName:c}){const f=O.useRef(null),{transform:d,patternId:h}=ie(iC,se),p=r||rC[t],g=t===Ke.Dots,v=t===Ke.Cross,m=Array.isArray(n)?n:[n,n],b=[m[0]*d[2]||1,m[1]*d[2]||1],y=p*d[2],_=Array.isArray(o)?o:[o,o],C=v?[y,y]:b,x=[_[0]*d[2]||1+C[0]/2,_[1]*d[2]||1+C[1]/2],E=`${h}${e||""}`;return S.jsxs("svg",{className:fe(["react-flow__background",l]),style:{...u,...pr,"--xy-background-color-props":s,"--xy-background-pattern-color-props":a},ref:f,"data-testid":"rf__background",children:[S.jsx("pattern",{id:E,x:d[0]%b[0],y:d[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${x[0]},-${x[1]})`,children:g?S.jsx(nC,{radius:y/2,className:c}):S.jsx(tC,{dimensions:C,lineWidth:i,variant:t,className:c})}),S.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${E})`})]})}Jm.displayName="Background";const oC=O.memo(Jm);function aC(){return S.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:S.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function sC(){return S.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:S.jsx("path",{d:"M0 0h32v4.2H0z"})})}function uC(){return S.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:S.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function cC(){return S.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:S.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function lC(){return S.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:S.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function On({children:e,className:t,...n}){return S.jsx("button",{type:"button",className:fe(["react-flow__controls-button",t]),...n,children:e})}const fC=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function ey({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:o,onZoomOut:a,onFitView:s,onInteractiveChange:u,className:l,children:c,position:f="bottom-left",orientation:d="vertical","aria-label":h}){const p=ue(),{isInteractive:g,minZoomReached:v,maxZoomReached:m,ariaLabelConfig:b}=ie(fC,se),{zoomIn:y,zoomOut:_,fitView:C}=Sc(),x=()=>{y(),o==null||o()},E=()=>{_(),a==null||a()},A=()=>{C(i),s==null||s()},q=()=>{p.setState({nodesDraggable:!g,nodesConnectable:!g,elementsSelectable:!g}),u==null||u(!g)},D=d==="horizontal"?"horizontal":"vertical";return S.jsxs(hr,{className:fe(["react-flow__controls",D,l]),position:f,style:e,"data-testid":"rf__controls","aria-label":h??b["controls.ariaLabel"],children:[t&&S.jsxs(S.Fragment,{children:[S.jsx(On,{onClick:x,className:"react-flow__controls-zoomin",title:b["controls.zoomIn.ariaLabel"],"aria-label":b["controls.zoomIn.ariaLabel"],disabled:m,children:S.jsx(aC,{})}),S.jsx(On,{onClick:E,className:"react-flow__controls-zoomout",title:b["controls.zoomOut.ariaLabel"],"aria-label":b["controls.zoomOut.ariaLabel"],disabled:v,children:S.jsx(sC,{})})]}),n&&S.jsx(On,{className:"react-flow__controls-fitview",onClick:A,title:b["controls.fitView.ariaLabel"],"aria-label":b["controls.fitView.ariaLabel"],children:S.jsx(uC,{})}),r&&S.jsx(On,{className:"react-flow__controls-interactive",onClick:q,title:b["controls.interactive.ariaLabel"],"aria-label":b["controls.interactive.ariaLabel"],children:g?S.jsx(lC,{}):S.jsx(cC,{})}),c]})}ey.displayName="Controls";const dC=O.memo(ey);function hC({id:e,x:t,y:n,width:r,height:i,style:o,color:a,strokeColor:s,strokeWidth:u,className:l,borderRadius:c,shapeRendering:f,selected:d,onClick:h}){const{background:p,backgroundColor:g}=o||{},v=a||p||g;return S.jsx("rect",{className:fe(["react-flow__minimap-node",{selected:d},l]),x:t,y:n,rx:c,ry:c,width:r,height:i,style:{fill:v,stroke:s,strokeWidth:u},shapeRendering:f,onClick:h?m=>h(m,e):void 0})}const pC=O.memo(hC),gC=e=>e.nodes.map(t=>t.id),Wr=e=>e instanceof Function?e:()=>e;function vC({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:o=pC,onClick:a}){const s=ie(gC,se),u=Wr(t),l=Wr(e),c=Wr(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return S.jsx(S.Fragment,{children:s.map(d=>S.jsx(yC,{id:d,nodeColorFunc:u,nodeStrokeColorFunc:l,nodeClassNameFunc:c,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:o,onClick:a,shapeRendering:f},d))})}function mC({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:o,shapeRendering:a,NodeComponent:s,onClick:u}){const{node:l,x:c,y:f,width:d,height:h}=ie(p=>{const{internals:g}=p.nodeLookup.get(e),v=g.userNode,{x:m,y:b}=g.positionAbsolute,{width:y,height:_}=Xe(v);return{node:v,x:m,y:b,width:y,height:_}},se);return!l||l.hidden||!Jv(l)?null:S.jsx(s,{x:c,y:f,width:d,height:h,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:i,strokeColor:n(l),strokeWidth:o,shapeRendering:a,onClick:u,id:l.id})}const yC=O.memo(mC);var _C=O.memo(vC);const bC=200,xC=150,wC=e=>!e.hidden,EC=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?Zv(pn(e.nodeLookup,{filter:wC}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},SC="react-flow__minimap-desc";function ty({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i="",nodeBorderRadius:o=5,nodeStrokeWidth:a,nodeComponent:s,bgColor:u,maskColor:l,maskStrokeColor:c,maskStrokeWidth:f,position:d="bottom-right",onClick:h,onNodeClick:p,pannable:g=!1,zoomable:v=!1,ariaLabel:m,inversePan:b,zoomStep:y=1,offsetScale:_=5}){const C=ue(),x=O.useRef(null),{boundingRect:E,viewBB:A,rfId:q,panZoom:D,translateExtent:N,flowWidth:R,flowHeight:L,ariaLabelConfig:w}=ie(EC,se),P=(e==null?void 0:e.width)??bC,I=(e==null?void 0:e.height)??xC,k=E.width/P,T=E.height/I,M=Math.max(k,T),$=M*P,F=M*I,j=_*M,H=E.x-($-E.width)/2-j,z=E.y-(F-E.height)/2-j,G=$+j*2,X=F+j*2,K=`${SC}-${q}`,B=O.useRef(0),U=O.useRef();B.current=M,O.useEffect(()=>{if(x.current&&D)return U.current=j1({domNode:x.current,panZoom:D,getTransform:()=>C.getState().transform,getViewScale:()=>B.current}),()=>{var Y;(Y=U.current)==null||Y.destroy()}},[D]),O.useEffect(()=>{var Y;(Y=U.current)==null||Y.update({translateExtent:N,width:R,height:L,inversePan:b,pannable:g,zoomStep:y,zoomable:v})},[g,v,b,y,N,R,L]);const te=h?Y=>{var re;const[oe,W]=((re=U.current)==null?void 0:re.pointer(Y))||[0,0];h(Y,{x:oe,y:W})}:void 0,J=p?O.useCallback((Y,oe)=>{const W=C.getState().nodeLookup.get(oe).internals.userNode;p(Y,W)},[]):void 0,Z=m??w["minimap.ariaLabel"];return S.jsx(hr,{position:d,style:{...e,"--xy-minimap-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*M:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof a=="number"?a:void 0},className:fe(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:S.jsxs("svg",{width:P,height:I,viewBox:`${H} ${z} ${G} ${X}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":K,ref:x,onClick:te,children:[Z&&S.jsx("title",{id:K,children:Z}),S.jsx(_C,{onClick:J,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:o,nodeClassName:i,nodeStrokeWidth:a,nodeComponent:s}),S.jsx("path",{className:"react-flow__minimap-mask",d:`M${H-j},${z-j}h${G+j*2}v${X+j*2}h${-G-j*2}z
39
+ M${A.x},${A.y}h${A.width}v${A.height}h${-A.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}ty.displayName="MiniMap";const CC=O.memo(ty),NC=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,AC={[Lt.Line]:"right",[Lt.Handle]:"bottom-right"};function IC({nodeId:e,position:t,variant:n=Lt.Handle,className:r,style:i=void 0,children:o,color:a,minWidth:s=10,minHeight:u=10,maxWidth:l=Number.MAX_VALUE,maxHeight:c=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:d,autoScale:h=!0,shouldResize:p,onResizeStart:g,onResize:v,onResizeEnd:m}){const b=Pm(),y=typeof e=="string"?e:b,_=ue(),C=O.useRef(null),x=n===Lt.Handle,E=ie(O.useCallback(NC(x&&h),[x,h]),se),A=O.useRef(null),q=t??AC[n];O.useEffect(()=>{if(!(!C.current||!y))return A.current||(A.current=J1({domNode:C.current,nodeId:y,getStoreItems:()=>{const{nodeLookup:N,transform:R,snapGrid:L,snapToGrid:w,nodeOrigin:P,domNode:I}=_.getState();return{nodeLookup:N,transform:R,snapGrid:L,snapToGrid:w,nodeOrigin:P,paneDomNode:I}},onChange:(N,R)=>{const{triggerNodeChanges:L,nodeLookup:w,parentLookup:P,nodeOrigin:I}=_.getState(),k=[],T={x:N.x,y:N.y},M=w.get(y);if(M&&M.expandParent&&M.parentId){const $=M.origin??I,F=N.width??M.measured.width??0,j=N.height??M.measured.height??0,H={id:M.id,parentId:M.parentId,rect:{width:F,height:j,...em({x:N.x??M.position.x,y:N.y??M.position.y},{width:F,height:j},M.parentId,w,$)}},z=Ec([H],w,P,I);k.push(...z),T.x=N.x?Math.max($[0]*F,N.x):void 0,T.y=N.y?Math.max($[1]*j,N.y):void 0}if(T.x!==void 0&&T.y!==void 0){const $={id:y,type:"position",position:{...T}};k.push($)}if(N.width!==void 0&&N.height!==void 0){const F={id:y,type:"dimensions",resizing:!0,setAttributes:d?d==="horizontal"?"width":"height":!0,dimensions:{width:N.width,height:N.height}};k.push(F)}for(const $ of R){const F={...$,type:"position"};k.push(F)}L(k)},onEnd:({width:N,height:R})=>{const L={id:y,type:"dimensions",resizing:!1,dimensions:{width:N,height:R}};_.getState().triggerNodeChanges([L])}})),A.current.update({controlPosition:q,boundaries:{minWidth:s,minHeight:u,maxWidth:l,maxHeight:c},keepAspectRatio:f,resizeDirection:d,onResizeStart:g,onResize:v,onResizeEnd:m,shouldResize:p}),()=>{var N;(N=A.current)==null||N.destroy()}},[q,s,u,l,c,f,g,v,m,p]);const D=q.split("-");return S.jsx("div",{className:fe(["react-flow__resize-control","nodrag",...D,n,r]),ref:C,style:{...i,scale:E,...a&&{[x?"backgroundColor":"borderColor"]:a}},children:o})}O.memo(IC);function Nc(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Xr,sf;function MC(){if(sf)return Xr;sf=1;function e(){this.__data__=[],this.size=0}return Xr=e,Xr}var Zr,uf;function $t(){if(uf)return Zr;uf=1;function e(t,n){return t===n||t!==t&&n!==n}return Zr=e,Zr}var Qr,cf;function vr(){if(cf)return Qr;cf=1;var e=$t();function t(n,r){for(var i=n.length;i--;)if(e(n[i][0],r))return i;return-1}return Qr=t,Qr}var Jr,lf;function RC(){if(lf)return Jr;lf=1;var e=vr(),t=Array.prototype,n=t.splice;function r(i){var o=this.__data__,a=e(o,i);if(a<0)return!1;var s=o.length-1;return a==s?o.pop():n.call(o,a,1),--this.size,!0}return Jr=r,Jr}var ei,ff;function qC(){if(ff)return ei;ff=1;var e=vr();function t(n){var r=this.__data__,i=e(r,n);return i<0?void 0:r[i][1]}return ei=t,ei}var ti,df;function TC(){if(df)return ti;df=1;var e=vr();function t(n){return e(this.__data__,n)>-1}return ti=t,ti}var ni,hf;function PC(){if(hf)return ni;hf=1;var e=vr();function t(n,r){var i=this.__data__,o=e(i,n);return o<0?(++this.size,i.push([n,r])):i[o][1]=r,this}return ni=t,ni}var ri,pf;function mr(){if(pf)return ri;pf=1;var e=MC(),t=RC(),n=qC(),r=TC(),i=PC();function o(a){var s=-1,u=a==null?0:a.length;for(this.clear();++s<u;){var l=a[s];this.set(l[0],l[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=n,o.prototype.has=r,o.prototype.set=i,ri=o,ri}var ii,gf;function kC(){if(gf)return ii;gf=1;var e=mr();function t(){this.__data__=new e,this.size=0}return ii=t,ii}var oi,vf;function OC(){if(vf)return oi;vf=1;function e(t){var n=this.__data__,r=n.delete(t);return this.size=n.size,r}return oi=e,oi}var ai,mf;function LC(){if(mf)return ai;mf=1;function e(t){return this.__data__.get(t)}return ai=e,ai}var si,yf;function DC(){if(yf)return si;yf=1;function e(t){return this.__data__.has(t)}return si=e,si}var ui,_f;function ny(){if(_f)return ui;_f=1;var e=typeof Tn=="object"&&Tn&&Tn.Object===Object&&Tn;return ui=e,ui}var ci,bf;function Me(){if(bf)return ci;bf=1;var e=ny(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return ci=n,ci}var li,xf;function jt(){if(xf)return li;xf=1;var e=Me(),t=e.Symbol;return li=t,li}var fi,wf;function $C(){if(wf)return fi;wf=1;var e=jt(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,i=e?e.toStringTag:void 0;function o(a){var s=n.call(a,i),u=a[i];try{a[i]=void 0;var l=!0}catch{}var c=r.call(a);return l&&(s?a[i]=u:delete a[i]),c}return fi=o,fi}var di,Ef;function jC(){if(Ef)return di;Ef=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return di=n,di}var hi,Sf;function _t(){if(Sf)return hi;Sf=1;var e=jt(),t=$C(),n=jC(),r="[object Null]",i="[object Undefined]",o=e?e.toStringTag:void 0;function a(s){return s==null?s===void 0?i:r:o&&o in Object(s)?t(s):n(s)}return hi=a,hi}var pi,Cf;function we(){if(Cf)return pi;Cf=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return pi=e,pi}var gi,Nf;function mn(){if(Nf)return gi;Nf=1;var e=_t(),t=we(),n="[object AsyncFunction]",r="[object Function]",i="[object GeneratorFunction]",o="[object Proxy]";function a(s){if(!t(s))return!1;var u=e(s);return u==r||u==i||u==n||u==o}return gi=a,gi}var vi,Af;function FC(){if(Af)return vi;Af=1;var e=Me(),t=e["__core-js_shared__"];return vi=t,vi}var mi,If;function BC(){if(If)return mi;If=1;var e=FC(),t=function(){var r=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}();function n(r){return!!t&&t in r}return mi=n,mi}var yi,Mf;function ry(){if(Mf)return yi;Mf=1;var e=Function.prototype,t=e.toString;function n(r){if(r!=null){try{return t.call(r)}catch{}try{return r+""}catch{}}return""}return yi=n,yi}var _i,Rf;function zC(){if(Rf)return _i;Rf=1;var e=mn(),t=BC(),n=we(),r=ry(),i=/[\\^$.*+?()[\]{}|]/g,o=/^\[object .+?Constructor\]$/,a=Function.prototype,s=Object.prototype,u=a.toString,l=s.hasOwnProperty,c=RegExp("^"+u.call(l).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function f(d){if(!n(d)||t(d))return!1;var h=e(d)?c:o;return h.test(r(d))}return _i=f,_i}var bi,qf;function HC(){if(qf)return bi;qf=1;function e(t,n){return t==null?void 0:t[n]}return bi=e,bi}var xi,Tf;function bt(){if(Tf)return xi;Tf=1;var e=zC(),t=HC();function n(r,i){var o=t(r,i);return e(o)?o:void 0}return xi=n,xi}var wi,Pf;function Ac(){if(Pf)return wi;Pf=1;var e=bt(),t=Me(),n=e(t,"Map");return wi=n,wi}var Ei,kf;function yr(){if(kf)return Ei;kf=1;var e=bt(),t=e(Object,"create");return Ei=t,Ei}var Si,Of;function VC(){if(Of)return Si;Of=1;var e=yr();function t(){this.__data__=e?e(null):{},this.size=0}return Si=t,Si}var Ci,Lf;function GC(){if(Lf)return Ci;Lf=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return Ci=e,Ci}var Ni,Df;function UC(){if(Df)return Ni;Df=1;var e=yr(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function i(o){var a=this.__data__;if(e){var s=a[o];return s===t?void 0:s}return r.call(a,o)?a[o]:void 0}return Ni=i,Ni}var Ai,$f;function KC(){if($f)return Ai;$f=1;var e=yr(),t=Object.prototype,n=t.hasOwnProperty;function r(i){var o=this.__data__;return e?o[i]!==void 0:n.call(o,i)}return Ai=r,Ai}var Ii,jf;function YC(){if(jf)return Ii;jf=1;var e=yr(),t="__lodash_hash_undefined__";function n(r,i){var o=this.__data__;return this.size+=this.has(r)?0:1,o[r]=e&&i===void 0?t:i,this}return Ii=n,Ii}var Mi,Ff;function WC(){if(Ff)return Mi;Ff=1;var e=VC(),t=GC(),n=UC(),r=KC(),i=YC();function o(a){var s=-1,u=a==null?0:a.length;for(this.clear();++s<u;){var l=a[s];this.set(l[0],l[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=n,o.prototype.has=r,o.prototype.set=i,Mi=o,Mi}var Ri,Bf;function XC(){if(Bf)return Ri;Bf=1;var e=WC(),t=mr(),n=Ac();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return Ri=r,Ri}var qi,zf;function ZC(){if(zf)return qi;zf=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return qi=e,qi}var Ti,Hf;function _r(){if(Hf)return Ti;Hf=1;var e=ZC();function t(n,r){var i=n.__data__;return e(r)?i[typeof r=="string"?"string":"hash"]:i.map}return Ti=t,Ti}var Pi,Vf;function QC(){if(Vf)return Pi;Vf=1;var e=_r();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return Pi=t,Pi}var ki,Gf;function JC(){if(Gf)return ki;Gf=1;var e=_r();function t(n){return e(this,n).get(n)}return ki=t,ki}var Oi,Uf;function eN(){if(Uf)return Oi;Uf=1;var e=_r();function t(n){return e(this,n).has(n)}return Oi=t,Oi}var Li,Kf;function tN(){if(Kf)return Li;Kf=1;var e=_r();function t(n,r){var i=e(this,n),o=i.size;return i.set(n,r),this.size+=i.size==o?0:1,this}return Li=t,Li}var Di,Yf;function Ic(){if(Yf)return Di;Yf=1;var e=XC(),t=QC(),n=JC(),r=eN(),i=tN();function o(a){var s=-1,u=a==null?0:a.length;for(this.clear();++s<u;){var l=a[s];this.set(l[0],l[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=n,o.prototype.has=r,o.prototype.set=i,Di=o,Di}var $i,Wf;function nN(){if(Wf)return $i;Wf=1;var e=mr(),t=Ac(),n=Ic(),r=200;function i(o,a){var s=this.__data__;if(s instanceof e){var u=s.__data__;if(!t||u.length<r-1)return u.push([o,a]),this.size=++s.size,this;s=this.__data__=new n(u)}return s.set(o,a),this.size=s.size,this}return $i=i,$i}var ji,Xf;function br(){if(Xf)return ji;Xf=1;var e=mr(),t=kC(),n=OC(),r=LC(),i=DC(),o=nN();function a(s){var u=this.__data__=new e(s);this.size=u.size}return a.prototype.clear=t,a.prototype.delete=n,a.prototype.get=r,a.prototype.has=i,a.prototype.set=o,ji=a,ji}var Fi,Zf;function Mc(){if(Zf)return Fi;Zf=1;function e(t,n){for(var r=-1,i=t==null?0:t.length;++r<i&&n(t[r],r,t)!==!1;);return t}return Fi=e,Fi}var Bi,Qf;function iy(){if(Qf)return Bi;Qf=1;var e=bt(),t=function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}}();return Bi=t,Bi}var zi,Jf;function xr(){if(Jf)return zi;Jf=1;var e=iy();function t(n,r,i){r=="__proto__"&&e?e(n,r,{configurable:!0,enumerable:!0,value:i,writable:!0}):n[r]=i}return zi=t,zi}var Hi,ed;function wr(){if(ed)return Hi;ed=1;var e=xr(),t=$t(),n=Object.prototype,r=n.hasOwnProperty;function i(o,a,s){var u=o[a];(!(r.call(o,a)&&t(u,s))||s===void 0&&!(a in o))&&e(o,a,s)}return Hi=i,Hi}var Vi,td;function yn(){if(td)return Vi;td=1;var e=wr(),t=xr();function n(r,i,o,a){var s=!o;o||(o={});for(var u=-1,l=i.length;++u<l;){var c=i[u],f=a?a(o[c],r[c],c,o,r):void 0;f===void 0&&(f=r[c]),s?t(o,c,f):e(o,c,f)}return o}return Vi=n,Vi}var Gi,nd;function rN(){if(nd)return Gi;nd=1;function e(t,n){for(var r=-1,i=Array(t);++r<t;)i[r]=n(r);return i}return Gi=e,Gi}var Ui,rd;function De(){if(rd)return Ui;rd=1;function e(t){return t!=null&&typeof t=="object"}return Ui=e,Ui}var Ki,id;function iN(){if(id)return Ki;id=1;var e=_t(),t=De(),n="[object Arguments]";function r(i){return t(i)&&e(i)==n}return Ki=r,Ki}var Yi,od;function _n(){if(od)return Yi;od=1;var e=iN(),t=De(),n=Object.prototype,r=n.hasOwnProperty,i=n.propertyIsEnumerable,o=e(function(){return arguments}())?e:function(a){return t(a)&&r.call(a,"callee")&&!i.call(a,"callee")};return Yi=o,Yi}var Wi,ad;function de(){if(ad)return Wi;ad=1;var e=Array.isArray;return Wi=e,Wi}var Kt={exports:{}},Xi,sd;function oN(){if(sd)return Xi;sd=1;function e(){return!1}return Xi=e,Xi}Kt.exports;var ud;function Ft(){return ud||(ud=1,function(e,t){var n=Me(),r=oN(),i=t&&!t.nodeType&&t,o=i&&!0&&e&&!e.nodeType&&e,a=o&&o.exports===i,s=a?n.Buffer:void 0,u=s?s.isBuffer:void 0,l=u||r;e.exports=l}(Kt,Kt.exports)),Kt.exports}var Zi,cd;function Er(){if(cd)return Zi;cd=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(r,i){var o=typeof r;return i=i??e,!!i&&(o=="number"||o!="symbol"&&t.test(r))&&r>-1&&r%1==0&&r<i}return Zi=n,Zi}var Qi,ld;function Rc(){if(ld)return Qi;ld=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return Qi=t,Qi}var Ji,fd;function aN(){if(fd)return Ji;fd=1;var e=_t(),t=Rc(),n=De(),r="[object Arguments]",i="[object Array]",o="[object Boolean]",a="[object Date]",s="[object Error]",u="[object Function]",l="[object Map]",c="[object Number]",f="[object Object]",d="[object RegExp]",h="[object Set]",p="[object String]",g="[object WeakMap]",v="[object ArrayBuffer]",m="[object DataView]",b="[object Float32Array]",y="[object Float64Array]",_="[object Int8Array]",C="[object Int16Array]",x="[object Int32Array]",E="[object Uint8Array]",A="[object Uint8ClampedArray]",q="[object Uint16Array]",D="[object Uint32Array]",N={};N[b]=N[y]=N[_]=N[C]=N[x]=N[E]=N[A]=N[q]=N[D]=!0,N[r]=N[i]=N[v]=N[o]=N[m]=N[a]=N[s]=N[u]=N[l]=N[c]=N[f]=N[d]=N[h]=N[p]=N[g]=!1;function R(L){return n(L)&&t(L.length)&&!!N[e(L)]}return Ji=R,Ji}var eo,dd;function Sr(){if(dd)return eo;dd=1;function e(t){return function(n){return t(n)}}return eo=e,eo}var Yt={exports:{}};Yt.exports;var hd;function qc(){return hd||(hd=1,function(e,t){var n=ny(),r=t&&!t.nodeType&&t,i=r&&!0&&e&&!e.nodeType&&e,o=i&&i.exports===r,a=o&&n.process,s=function(){try{var u=i&&i.require&&i.require("util").types;return u||a&&a.binding&&a.binding("util")}catch{}}();e.exports=s}(Yt,Yt.exports)),Yt.exports}var to,pd;function bn(){if(pd)return to;pd=1;var e=aN(),t=Sr(),n=qc(),r=n&&n.isTypedArray,i=r?t(r):e;return to=i,to}var no,gd;function oy(){if(gd)return no;gd=1;var e=rN(),t=_n(),n=de(),r=Ft(),i=Er(),o=bn(),a=Object.prototype,s=a.hasOwnProperty;function u(l,c){var f=n(l),d=!f&&t(l),h=!f&&!d&&r(l),p=!f&&!d&&!h&&o(l),g=f||d||h||p,v=g?e(l.length,String):[],m=v.length;for(var b in l)(c||s.call(l,b))&&!(g&&(b=="length"||h&&(b=="offset"||b=="parent")||p&&(b=="buffer"||b=="byteLength"||b=="byteOffset")||i(b,m)))&&v.push(b);return v}return no=u,no}var ro,vd;function Cr(){if(vd)return ro;vd=1;var e=Object.prototype;function t(n){var r=n&&n.constructor,i=typeof r=="function"&&r.prototype||e;return n===i}return ro=t,ro}var io,md;function ay(){if(md)return io;md=1;function e(t,n){return function(r){return t(n(r))}}return io=e,io}var oo,yd;function sN(){if(yd)return oo;yd=1;var e=ay(),t=e(Object.keys,Object);return oo=t,oo}var ao,_d;function Tc(){if(_d)return ao;_d=1;var e=Cr(),t=sN(),n=Object.prototype,r=n.hasOwnProperty;function i(o){if(!e(o))return t(o);var a=[];for(var s in Object(o))r.call(o,s)&&s!="constructor"&&a.push(s);return a}return ao=i,ao}var so,bd;function Ze(){if(bd)return so;bd=1;var e=mn(),t=Rc();function n(r){return r!=null&&t(r.length)&&!e(r)}return so=n,so}var uo,xd;function ct(){if(xd)return uo;xd=1;var e=oy(),t=Tc(),n=Ze();function r(i){return n(i)?e(i):t(i)}return uo=r,uo}var co,wd;function uN(){if(wd)return co;wd=1;var e=yn(),t=ct();function n(r,i){return r&&e(i,t(i),r)}return co=n,co}var lo,Ed;function cN(){if(Ed)return lo;Ed=1;function e(t){var n=[];if(t!=null)for(var r in Object(t))n.push(r);return n}return lo=e,lo}var fo,Sd;function lN(){if(Sd)return fo;Sd=1;var e=we(),t=Cr(),n=cN(),r=Object.prototype,i=r.hasOwnProperty;function o(a){if(!e(a))return n(a);var s=t(a),u=[];for(var l in a)l=="constructor"&&(s||!i.call(a,l))||u.push(l);return u}return fo=o,fo}var ho,Cd;function xt(){if(Cd)return ho;Cd=1;var e=oy(),t=lN(),n=Ze();function r(i){return n(i)?e(i,!0):t(i)}return ho=r,ho}var po,Nd;function fN(){if(Nd)return po;Nd=1;var e=yn(),t=xt();function n(r,i){return r&&e(i,t(i),r)}return po=n,po}var Wt={exports:{}};Wt.exports;var Ad;function sy(){return Ad||(Ad=1,function(e,t){var n=Me(),r=t&&!t.nodeType&&t,i=r&&!0&&e&&!e.nodeType&&e,o=i&&i.exports===r,a=o?n.Buffer:void 0,s=a?a.allocUnsafe:void 0;function u(l,c){if(c)return l.slice();var f=l.length,d=s?s(f):new l.constructor(f);return l.copy(d),d}e.exports=u}(Wt,Wt.exports)),Wt.exports}var go,Id;function uy(){if(Id)return go;Id=1;function e(t,n){var r=-1,i=t.length;for(n||(n=Array(i));++r<i;)n[r]=t[r];return n}return go=e,go}var vo,Md;function cy(){if(Md)return vo;Md=1;function e(t,n){for(var r=-1,i=t==null?0:t.length,o=0,a=[];++r<i;){var s=t[r];n(s,r,t)&&(a[o++]=s)}return a}return vo=e,vo}var mo,Rd;function ly(){if(Rd)return mo;Rd=1;function e(){return[]}return mo=e,mo}var yo,qd;function Pc(){if(qd)return yo;qd=1;var e=cy(),t=ly(),n=Object.prototype,r=n.propertyIsEnumerable,i=Object.getOwnPropertySymbols,o=i?function(a){return a==null?[]:(a=Object(a),e(i(a),function(s){return r.call(a,s)}))}:t;return yo=o,yo}var _o,Td;function dN(){if(Td)return _o;Td=1;var e=yn(),t=Pc();function n(r,i){return e(r,t(r),i)}return _o=n,_o}var bo,Pd;function kc(){if(Pd)return bo;Pd=1;function e(t,n){for(var r=-1,i=n.length,o=t.length;++r<i;)t[o+r]=n[r];return t}return bo=e,bo}var xo,kd;function Nr(){if(kd)return xo;kd=1;var e=ay(),t=e(Object.getPrototypeOf,Object);return xo=t,xo}var wo,Od;function fy(){if(Od)return wo;Od=1;var e=kc(),t=Nr(),n=Pc(),r=ly(),i=Object.getOwnPropertySymbols,o=i?function(a){for(var s=[];a;)e(s,n(a)),a=t(a);return s}:r;return wo=o,wo}var Eo,Ld;function hN(){if(Ld)return Eo;Ld=1;var e=yn(),t=fy();function n(r,i){return e(r,t(r),i)}return Eo=n,Eo}var So,Dd;function dy(){if(Dd)return So;Dd=1;var e=kc(),t=de();function n(r,i,o){var a=i(r);return t(r)?a:e(a,o(r))}return So=n,So}var Co,$d;function hy(){if($d)return Co;$d=1;var e=dy(),t=Pc(),n=ct();function r(i){return e(i,n,t)}return Co=r,Co}var No,jd;function pN(){if(jd)return No;jd=1;var e=dy(),t=fy(),n=xt();function r(i){return e(i,n,t)}return No=r,No}var Ao,Fd;function gN(){if(Fd)return Ao;Fd=1;var e=bt(),t=Me(),n=e(t,"DataView");return Ao=n,Ao}var Io,Bd;function vN(){if(Bd)return Io;Bd=1;var e=bt(),t=Me(),n=e(t,"Promise");return Io=n,Io}var Mo,zd;function py(){if(zd)return Mo;zd=1;var e=bt(),t=Me(),n=e(t,"Set");return Mo=n,Mo}var Ro,Hd;function mN(){if(Hd)return Ro;Hd=1;var e=bt(),t=Me(),n=e(t,"WeakMap");return Ro=n,Ro}var qo,Vd;function Bt(){if(Vd)return qo;Vd=1;var e=gN(),t=Ac(),n=vN(),r=py(),i=mN(),o=_t(),a=ry(),s="[object Map]",u="[object Object]",l="[object Promise]",c="[object Set]",f="[object WeakMap]",d="[object DataView]",h=a(e),p=a(t),g=a(n),v=a(r),m=a(i),b=o;return(e&&b(new e(new ArrayBuffer(1)))!=d||t&&b(new t)!=s||n&&b(n.resolve())!=l||r&&b(new r)!=c||i&&b(new i)!=f)&&(b=function(y){var _=o(y),C=_==u?y.constructor:void 0,x=C?a(C):"";if(x)switch(x){case h:return d;case p:return s;case g:return l;case v:return c;case m:return f}return _}),qo=b,qo}var To,Gd;function yN(){if(Gd)return To;Gd=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r){var i=r.length,o=new r.constructor(i);return i&&typeof r[0]=="string"&&t.call(r,"index")&&(o.index=r.index,o.input=r.input),o}return To=n,To}var Po,Ud;function gy(){if(Ud)return Po;Ud=1;var e=Me(),t=e.Uint8Array;return Po=t,Po}var ko,Kd;function Oc(){if(Kd)return ko;Kd=1;var e=gy();function t(n){var r=new n.constructor(n.byteLength);return new e(r).set(new e(n)),r}return ko=t,ko}var Oo,Yd;function _N(){if(Yd)return Oo;Yd=1;var e=Oc();function t(n,r){var i=r?e(n.buffer):n.buffer;return new n.constructor(i,n.byteOffset,n.byteLength)}return Oo=t,Oo}var Lo,Wd;function bN(){if(Wd)return Lo;Wd=1;var e=/\w*$/;function t(n){var r=new n.constructor(n.source,e.exec(n));return r.lastIndex=n.lastIndex,r}return Lo=t,Lo}var Do,Xd;function xN(){if(Xd)return Do;Xd=1;var e=jt(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function r(i){return n?Object(n.call(i)):{}}return Do=r,Do}var $o,Zd;function vy(){if(Zd)return $o;Zd=1;var e=Oc();function t(n,r){var i=r?e(n.buffer):n.buffer;return new n.constructor(i,n.byteOffset,n.length)}return $o=t,$o}var jo,Qd;function wN(){if(Qd)return jo;Qd=1;var e=Oc(),t=_N(),n=bN(),r=xN(),i=vy(),o="[object Boolean]",a="[object Date]",s="[object Map]",u="[object Number]",l="[object RegExp]",c="[object Set]",f="[object String]",d="[object Symbol]",h="[object ArrayBuffer]",p="[object DataView]",g="[object Float32Array]",v="[object Float64Array]",m="[object Int8Array]",b="[object Int16Array]",y="[object Int32Array]",_="[object Uint8Array]",C="[object Uint8ClampedArray]",x="[object Uint16Array]",E="[object Uint32Array]";function A(q,D,N){var R=q.constructor;switch(D){case h:return e(q);case o:case a:return new R(+q);case p:return t(q,N);case g:case v:case m:case b:case y:case _:case C:case x:case E:return i(q,N);case s:return new R;case u:case f:return new R(q);case l:return n(q);case c:return new R;case d:return r(q)}}return jo=A,jo}var Fo,Jd;function my(){if(Jd)return Fo;Jd=1;var e=we(),t=Object.create,n=function(){function r(){}return function(i){if(!e(i))return{};if(t)return t(i);r.prototype=i;var o=new r;return r.prototype=void 0,o}}();return Fo=n,Fo}var Bo,eh;function yy(){if(eh)return Bo;eh=1;var e=my(),t=Nr(),n=Cr();function r(i){return typeof i.constructor=="function"&&!n(i)?e(t(i)):{}}return Bo=r,Bo}var zo,th;function EN(){if(th)return zo;th=1;var e=Bt(),t=De(),n="[object Map]";function r(i){return t(i)&&e(i)==n}return zo=r,zo}var Ho,nh;function SN(){if(nh)return Ho;nh=1;var e=EN(),t=Sr(),n=qc(),r=n&&n.isMap,i=r?t(r):e;return Ho=i,Ho}var Vo,rh;function CN(){if(rh)return Vo;rh=1;var e=Bt(),t=De(),n="[object Set]";function r(i){return t(i)&&e(i)==n}return Vo=r,Vo}var Go,ih;function NN(){if(ih)return Go;ih=1;var e=CN(),t=Sr(),n=qc(),r=n&&n.isSet,i=r?t(r):e;return Go=i,Go}var Uo,oh;function _y(){if(oh)return Uo;oh=1;var e=br(),t=Mc(),n=wr(),r=uN(),i=fN(),o=sy(),a=uy(),s=dN(),u=hN(),l=hy(),c=pN(),f=Bt(),d=yN(),h=wN(),p=yy(),g=de(),v=Ft(),m=SN(),b=we(),y=NN(),_=ct(),C=xt(),x=1,E=2,A=4,q="[object Arguments]",D="[object Array]",N="[object Boolean]",R="[object Date]",L="[object Error]",w="[object Function]",P="[object GeneratorFunction]",I="[object Map]",k="[object Number]",T="[object Object]",M="[object RegExp]",$="[object Set]",F="[object String]",j="[object Symbol]",H="[object WeakMap]",z="[object ArrayBuffer]",G="[object DataView]",X="[object Float32Array]",K="[object Float64Array]",B="[object Int8Array]",U="[object Int16Array]",te="[object Int32Array]",J="[object Uint8Array]",Z="[object Uint8ClampedArray]",Y="[object Uint16Array]",oe="[object Uint32Array]",W={};W[q]=W[D]=W[z]=W[G]=W[N]=W[R]=W[X]=W[K]=W[B]=W[U]=W[te]=W[I]=W[k]=W[T]=W[M]=W[$]=W[F]=W[j]=W[J]=W[Z]=W[Y]=W[oe]=!0,W[L]=W[w]=W[H]=!1;function re(Q,pe,he,$e,qe,ge){var le,Je=pe&x,je=pe&E,et=pe&A;if(he&&(le=qe?he(Q,$e,qe,ge):he(Q)),le!==void 0)return le;if(!b(Q))return Q;var tt=g(Q);if(tt){if(le=d(Q),!Je)return a(Q,le)}else{var Fe=f(Q),wn=Fe==w||Fe==P;if(v(Q))return o(Q,Je);if(Fe==T||Fe==q||wn&&!qe){if(le=je||wn?{}:p(Q),!Je)return je?u(Q,i(le,Q)):s(Q,r(le,Q))}else{if(!W[Fe])return qe?Q:{};le=h(Q,Fe,Je)}}ge||(ge=new e);var St=ge.get(Q);if(St)return St;ge.set(Q,le),y(Q)?Q.forEach(function(Te){le.add(re(Te,pe,he,Te,Q,ge))}):m(Q)&&Q.forEach(function(Te,Be){le.set(Be,re(Te,pe,he,Be,Q,ge))});var Or=et?je?c:l:je?C:_,En=tt?void 0:Or(Q);return t(En||Q,function(Te,Be){En&&(Be=Te,Te=Q[Be]),n(le,Be,re(Te,pe,he,Be,Q,ge))}),le}return Uo=re,Uo}var Ko,ah;function AN(){if(ah)return Ko;ah=1;var e=_y(),t=4;function n(r){return e(r,t)}return Ko=n,Ko}var Yo,sh;function Lc(){if(sh)return Yo;sh=1;function e(t){return function(){return t}}return Yo=e,Yo}var Wo,uh;function IN(){if(uh)return Wo;uh=1;function e(t){return function(n,r,i){for(var o=-1,a=Object(n),s=i(n),u=s.length;u--;){var l=s[t?u:++o];if(r(a[l],l,a)===!1)break}return n}}return Wo=e,Wo}var Xo,ch;function Dc(){if(ch)return Xo;ch=1;var e=IN(),t=e();return Xo=t,Xo}var Zo,lh;function $c(){if(lh)return Zo;lh=1;var e=Dc(),t=ct();function n(r,i){return r&&e(r,i,t)}return Zo=n,Zo}var Qo,fh;function MN(){if(fh)return Qo;fh=1;var e=Ze();function t(n,r){return function(i,o){if(i==null)return i;if(!e(i))return n(i,o);for(var a=i.length,s=r?a:-1,u=Object(i);(r?s--:++s<a)&&o(u[s],s,u)!==!1;);return i}}return Qo=t,Qo}var Jo,dh;function Ar(){if(dh)return Jo;dh=1;var e=$c(),t=MN(),n=t(e);return Jo=n,Jo}var ea,hh;function wt(){if(hh)return ea;hh=1;function e(t){return t}return ea=e,ea}var ta,ph;function by(){if(ph)return ta;ph=1;var e=wt();function t(n){return typeof n=="function"?n:e}return ta=t,ta}var na,gh;function xy(){if(gh)return na;gh=1;var e=Mc(),t=Ar(),n=by(),r=de();function i(o,a){var s=r(o)?e:t;return s(o,n(a))}return na=i,na}var ra,vh;function wy(){return vh||(vh=1,ra=xy()),ra}var ia,mh;function RN(){if(mh)return ia;mh=1;var e=Ar();function t(n,r){var i=[];return e(n,function(o,a,s){r(o,a,s)&&i.push(o)}),i}return ia=t,ia}var oa,yh;function qN(){if(yh)return oa;yh=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return oa=t,oa}var aa,_h;function TN(){if(_h)return aa;_h=1;function e(t){return this.__data__.has(t)}return aa=e,aa}var sa,bh;function Ey(){if(bh)return sa;bh=1;var e=Ic(),t=qN(),n=TN();function r(i){var o=-1,a=i==null?0:i.length;for(this.__data__=new e;++o<a;)this.add(i[o])}return r.prototype.add=r.prototype.push=t,r.prototype.has=n,sa=r,sa}var ua,xh;function PN(){if(xh)return ua;xh=1;function e(t,n){for(var r=-1,i=t==null?0:t.length;++r<i;)if(n(t[r],r,t))return!0;return!1}return ua=e,ua}var ca,wh;function Sy(){if(wh)return ca;wh=1;function e(t,n){return t.has(n)}return ca=e,ca}var la,Eh;function Cy(){if(Eh)return la;Eh=1;var e=Ey(),t=PN(),n=Sy(),r=1,i=2;function o(a,s,u,l,c,f){var d=u&r,h=a.length,p=s.length;if(h!=p&&!(d&&p>h))return!1;var g=f.get(a),v=f.get(s);if(g&&v)return g==s&&v==a;var m=-1,b=!0,y=u&i?new e:void 0;for(f.set(a,s),f.set(s,a);++m<h;){var _=a[m],C=s[m];if(l)var x=d?l(C,_,m,s,a,f):l(_,C,m,a,s,f);if(x!==void 0){if(x)continue;b=!1;break}if(y){if(!t(s,function(E,A){if(!n(y,A)&&(_===E||c(_,E,u,l,f)))return y.push(A)})){b=!1;break}}else if(!(_===C||c(_,C,u,l,f))){b=!1;break}}return f.delete(a),f.delete(s),b}return la=o,la}var fa,Sh;function kN(){if(Sh)return fa;Sh=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(i,o){r[++n]=[o,i]}),r}return fa=e,fa}var da,Ch;function jc(){if(Ch)return da;Ch=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(i){r[++n]=i}),r}return da=e,da}var ha,Nh;function ON(){if(Nh)return ha;Nh=1;var e=jt(),t=gy(),n=$t(),r=Cy(),i=kN(),o=jc(),a=1,s=2,u="[object Boolean]",l="[object Date]",c="[object Error]",f="[object Map]",d="[object Number]",h="[object RegExp]",p="[object Set]",g="[object String]",v="[object Symbol]",m="[object ArrayBuffer]",b="[object DataView]",y=e?e.prototype:void 0,_=y?y.valueOf:void 0;function C(x,E,A,q,D,N,R){switch(A){case b:if(x.byteLength!=E.byteLength||x.byteOffset!=E.byteOffset)return!1;x=x.buffer,E=E.buffer;case m:return!(x.byteLength!=E.byteLength||!N(new t(x),new t(E)));case u:case l:case d:return n(+x,+E);case c:return x.name==E.name&&x.message==E.message;case h:case g:return x==E+"";case f:var L=i;case p:var w=q&a;if(L||(L=o),x.size!=E.size&&!w)return!1;var P=R.get(x);if(P)return P==E;q|=s,R.set(x,E);var I=r(L(x),L(E),q,D,N,R);return R.delete(x),I;case v:if(_)return _.call(x)==_.call(E)}return!1}return ha=C,ha}var pa,Ah;function LN(){if(Ah)return pa;Ah=1;var e=hy(),t=1,n=Object.prototype,r=n.hasOwnProperty;function i(o,a,s,u,l,c){var f=s&t,d=e(o),h=d.length,p=e(a),g=p.length;if(h!=g&&!f)return!1;for(var v=h;v--;){var m=d[v];if(!(f?m in a:r.call(a,m)))return!1}var b=c.get(o),y=c.get(a);if(b&&y)return b==a&&y==o;var _=!0;c.set(o,a),c.set(a,o);for(var C=f;++v<h;){m=d[v];var x=o[m],E=a[m];if(u)var A=f?u(E,x,m,a,o,c):u(x,E,m,o,a,c);if(!(A===void 0?x===E||l(x,E,s,u,c):A)){_=!1;break}C||(C=m=="constructor")}if(_&&!C){var q=o.constructor,D=a.constructor;q!=D&&"constructor"in o&&"constructor"in a&&!(typeof q=="function"&&q instanceof q&&typeof D=="function"&&D instanceof D)&&(_=!1)}return c.delete(o),c.delete(a),_}return pa=i,pa}var ga,Ih;function DN(){if(Ih)return ga;Ih=1;var e=br(),t=Cy(),n=ON(),r=LN(),i=Bt(),o=de(),a=Ft(),s=bn(),u=1,l="[object Arguments]",c="[object Array]",f="[object Object]",d=Object.prototype,h=d.hasOwnProperty;function p(g,v,m,b,y,_){var C=o(g),x=o(v),E=C?c:i(g),A=x?c:i(v);E=E==l?f:E,A=A==l?f:A;var q=E==f,D=A==f,N=E==A;if(N&&a(g)){if(!a(v))return!1;C=!0,q=!1}if(N&&!q)return _||(_=new e),C||s(g)?t(g,v,m,b,y,_):n(g,v,E,m,b,y,_);if(!(m&u)){var R=q&&h.call(g,"__wrapped__"),L=D&&h.call(v,"__wrapped__");if(R||L){var w=R?g.value():g,P=L?v.value():v;return _||(_=new e),y(w,P,m,b,_)}}return N?(_||(_=new e),r(g,v,m,b,y,_)):!1}return ga=p,ga}var va,Mh;function Ny(){if(Mh)return va;Mh=1;var e=DN(),t=De();function n(r,i,o,a,s){return r===i?!0:r==null||i==null||!t(r)&&!t(i)?r!==r&&i!==i:e(r,i,o,a,n,s)}return va=n,va}var ma,Rh;function $N(){if(Rh)return ma;Rh=1;var e=br(),t=Ny(),n=1,r=2;function i(o,a,s,u){var l=s.length,c=l,f=!u;if(o==null)return!c;for(o=Object(o);l--;){var d=s[l];if(f&&d[2]?d[1]!==o[d[0]]:!(d[0]in o))return!1}for(;++l<c;){d=s[l];var h=d[0],p=o[h],g=d[1];if(f&&d[2]){if(p===void 0&&!(h in o))return!1}else{var v=new e;if(u)var m=u(p,g,h,o,a,v);if(!(m===void 0?t(g,p,n|r,u,v):m))return!1}}return!0}return ma=i,ma}var ya,qh;function Ay(){if(qh)return ya;qh=1;var e=we();function t(n){return n===n&&!e(n)}return ya=t,ya}var _a,Th;function jN(){if(Th)return _a;Th=1;var e=Ay(),t=ct();function n(r){for(var i=t(r),o=i.length;o--;){var a=i[o],s=r[a];i[o]=[a,s,e(s)]}return i}return _a=n,_a}var ba,Ph;function Iy(){if(Ph)return ba;Ph=1;function e(t,n){return function(r){return r==null?!1:r[t]===n&&(n!==void 0||t in Object(r))}}return ba=e,ba}var xa,kh;function FN(){if(kh)return xa;kh=1;var e=$N(),t=jN(),n=Iy();function r(i){var o=t(i);return o.length==1&&o[0][2]?n(o[0][0],o[0][1]):function(a){return a===i||e(a,i,o)}}return xa=r,xa}var wa,Oh;function zt(){if(Oh)return wa;Oh=1;var e=_t(),t=De(),n="[object Symbol]";function r(i){return typeof i=="symbol"||t(i)&&e(i)==n}return wa=r,wa}var Ea,Lh;function Fc(){if(Lh)return Ea;Lh=1;var e=de(),t=zt(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(o,a){if(e(o))return!1;var s=typeof o;return s=="number"||s=="symbol"||s=="boolean"||o==null||t(o)?!0:r.test(o)||!n.test(o)||a!=null&&o in Object(a)}return Ea=i,Ea}var Sa,Dh;function BN(){if(Dh)return Sa;Dh=1;var e=Ic(),t="Expected a function";function n(r,i){if(typeof r!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var o=function(){var a=arguments,s=i?i.apply(this,a):a[0],u=o.cache;if(u.has(s))return u.get(s);var l=r.apply(this,a);return o.cache=u.set(s,l)||u,l};return o.cache=new(n.Cache||e),o}return n.Cache=e,Sa=n,Sa}var Ca,$h;function zN(){if($h)return Ca;$h=1;var e=BN(),t=500;function n(r){var i=e(r,function(a){return o.size===t&&o.clear(),a}),o=i.cache;return i}return Ca=n,Ca}var Na,jh;function HN(){if(jh)return Na;jh=1;var e=zN(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(i){var o=[];return i.charCodeAt(0)===46&&o.push(""),i.replace(t,function(a,s,u,l){o.push(u?l.replace(n,"$1"):s||a)}),o});return Na=r,Na}var Aa,Fh;function Ir(){if(Fh)return Aa;Fh=1;function e(t,n){for(var r=-1,i=t==null?0:t.length,o=Array(i);++r<i;)o[r]=n(t[r],r,t);return o}return Aa=e,Aa}var Ia,Bh;function VN(){if(Bh)return Ia;Bh=1;var e=jt(),t=Ir(),n=de(),r=zt(),i=e?e.prototype:void 0,o=i?i.toString:void 0;function a(s){if(typeof s=="string")return s;if(n(s))return t(s,a)+"";if(r(s))return o?o.call(s):"";var u=s+"";return u=="0"&&1/s==-1/0?"-0":u}return Ia=a,Ia}var Ma,zh;function My(){if(zh)return Ma;zh=1;var e=VN();function t(n){return n==null?"":e(n)}return Ma=t,Ma}var Ra,Hh;function Mr(){if(Hh)return Ra;Hh=1;var e=de(),t=Fc(),n=HN(),r=My();function i(o,a){return e(o)?o:t(o,a)?[o]:n(r(o))}return Ra=i,Ra}var qa,Vh;function xn(){if(Vh)return qa;Vh=1;var e=zt();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return qa=t,qa}var Ta,Gh;function Rr(){if(Gh)return Ta;Gh=1;var e=Mr(),t=xn();function n(r,i){i=e(i,r);for(var o=0,a=i.length;r!=null&&o<a;)r=r[t(i[o++])];return o&&o==a?r:void 0}return Ta=n,Ta}var Pa,Uh;function GN(){if(Uh)return Pa;Uh=1;var e=Rr();function t(n,r,i){var o=n==null?void 0:e(n,r);return o===void 0?i:o}return Pa=t,Pa}var ka,Kh;function UN(){if(Kh)return ka;Kh=1;function e(t,n){return t!=null&&n in Object(t)}return ka=e,ka}var Oa,Yh;function Ry(){if(Yh)return Oa;Yh=1;var e=Mr(),t=_n(),n=de(),r=Er(),i=Rc(),o=xn();function a(s,u,l){u=e(u,s);for(var c=-1,f=u.length,d=!1;++c<f;){var h=o(u[c]);if(!(d=s!=null&&l(s,h)))break;s=s[h]}return d||++c!=f?d:(f=s==null?0:s.length,!!f&&i(f)&&r(h,f)&&(n(s)||t(s)))}return Oa=a,Oa}var La,Wh;function qy(){if(Wh)return La;Wh=1;var e=UN(),t=Ry();function n(r,i){return r!=null&&t(r,i,e)}return La=n,La}var Da,Xh;function KN(){if(Xh)return Da;Xh=1;var e=Ny(),t=GN(),n=qy(),r=Fc(),i=Ay(),o=Iy(),a=xn(),s=1,u=2;function l(c,f){return r(c)&&i(f)?o(a(c),f):function(d){var h=t(d,c);return h===void 0&&h===f?n(d,c):e(f,h,s|u)}}return Da=l,Da}var $a,Zh;function Ty(){if(Zh)return $a;Zh=1;function e(t){return function(n){return n==null?void 0:n[t]}}return $a=e,$a}var ja,Qh;function YN(){if(Qh)return ja;Qh=1;var e=Rr();function t(n){return function(r){return e(r,n)}}return ja=t,ja}var Fa,Jh;function WN(){if(Jh)return Fa;Jh=1;var e=Ty(),t=YN(),n=Fc(),r=xn();function i(o){return n(o)?e(r(o)):t(o)}return Fa=i,Fa}var Ba,ep;function Qe(){if(ep)return Ba;ep=1;var e=FN(),t=KN(),n=wt(),r=de(),i=WN();function o(a){return typeof a=="function"?a:a==null?n:typeof a=="object"?r(a)?t(a[0],a[1]):e(a):i(a)}return Ba=o,Ba}var za,tp;function Py(){if(tp)return za;tp=1;var e=cy(),t=RN(),n=Qe(),r=de();function i(o,a){var s=r(o)?e:t;return s(o,n(a,3))}return za=i,za}var Ha,np;function XN(){if(np)return Ha;np=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r,i){return r!=null&&t.call(r,i)}return Ha=n,Ha}var Va,rp;function ky(){if(rp)return Va;rp=1;var e=XN(),t=Ry();function n(r,i){return r!=null&&t(r,i,e)}return Va=n,Va}var Ga,ip;function ZN(){if(ip)return Ga;ip=1;var e=Tc(),t=Bt(),n=_n(),r=de(),i=Ze(),o=Ft(),a=Cr(),s=bn(),u="[object Map]",l="[object Set]",c=Object.prototype,f=c.hasOwnProperty;function d(h){if(h==null)return!0;if(i(h)&&(r(h)||typeof h=="string"||typeof h.splice=="function"||o(h)||s(h)||n(h)))return!h.length;var p=t(h);if(p==u||p==l)return!h.size;if(a(h))return!e(h).length;for(var g in h)if(f.call(h,g))return!1;return!0}return Ga=d,Ga}var Ua,op;function Oy(){if(op)return Ua;op=1;function e(t){return t===void 0}return Ua=e,Ua}var Ka,ap;function Ly(){if(ap)return Ka;ap=1;var e=Ar(),t=Ze();function n(r,i){var o=-1,a=t(r)?Array(r.length):[];return e(r,function(s,u,l){a[++o]=i(s,u,l)}),a}return Ka=n,Ka}var Ya,sp;function Dy(){if(sp)return Ya;sp=1;var e=Ir(),t=Qe(),n=Ly(),r=de();function i(o,a){var s=r(o)?e:n;return s(o,t(a,3))}return Ya=i,Ya}var Wa,up;function QN(){if(up)return Wa;up=1;function e(t,n,r,i){var o=-1,a=t==null?0:t.length;for(i&&a&&(r=t[++o]);++o<a;)r=n(r,t[o],o,t);return r}return Wa=e,Wa}var Xa,cp;function JN(){if(cp)return Xa;cp=1;function e(t,n,r,i,o){return o(t,function(a,s,u){r=i?(i=!1,a):n(r,a,s,u)}),r}return Xa=e,Xa}var Za,lp;function $y(){if(lp)return Za;lp=1;var e=QN(),t=Ar(),n=Qe(),r=JN(),i=de();function o(a,s,u){var l=i(a)?e:r,c=arguments.length<3;return l(a,n(s,4),u,c,t)}return Za=o,Za}var Qa,fp;function eA(){if(fp)return Qa;fp=1;var e=_t(),t=de(),n=De(),r="[object String]";function i(o){return typeof o=="string"||!t(o)&&n(o)&&e(o)==r}return Qa=i,Qa}var Ja,dp;function tA(){if(dp)return Ja;dp=1;var e=Ty(),t=e("length");return Ja=t,Ja}var es,hp;function nA(){if(hp)return es;hp=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",i=t+n+r,o="\\ufe0e\\ufe0f",a="\\u200d",s=RegExp("["+a+e+i+o+"]");function u(l){return s.test(l)}return es=u,es}var ts,pp;function rA(){if(pp)return ts;pp=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",i=t+n+r,o="\\ufe0e\\ufe0f",a="["+e+"]",s="["+i+"]",u="\\ud83c[\\udffb-\\udfff]",l="(?:"+s+"|"+u+")",c="[^"+e+"]",f="(?:\\ud83c[\\udde6-\\uddff]){2}",d="[\\ud800-\\udbff][\\udc00-\\udfff]",h="\\u200d",p=l+"?",g="["+o+"]?",v="(?:"+h+"(?:"+[c,f,d].join("|")+")"+g+p+")*",m=g+p+v,b="(?:"+[c+s+"?",s,f,d,a].join("|")+")",y=RegExp(u+"(?="+u+")|"+b+m,"g");function _(C){for(var x=y.lastIndex=0;y.test(C);)++x;return x}return ts=_,ts}var ns,gp;function iA(){if(gp)return ns;gp=1;var e=tA(),t=nA(),n=rA();function r(i){return t(i)?n(i):e(i)}return ns=r,ns}var rs,vp;function oA(){if(vp)return rs;vp=1;var e=Tc(),t=Bt(),n=Ze(),r=eA(),i=iA(),o="[object Map]",a="[object Set]";function s(u){if(u==null)return 0;if(n(u))return r(u)?i(u):u.length;var l=t(u);return l==o||l==a?u.size:e(u).length}return rs=s,rs}var is,mp;function aA(){if(mp)return is;mp=1;var e=Mc(),t=my(),n=$c(),r=Qe(),i=Nr(),o=de(),a=Ft(),s=mn(),u=we(),l=bn();function c(f,d,h){var p=o(f),g=p||a(f)||l(f);if(d=r(d,4),h==null){var v=f&&f.constructor;g?h=p?new v:[]:u(f)?h=s(v)?t(i(f)):{}:h={}}return(g?e:n)(f,function(m,b,y){return d(h,m,b,y)}),h}return is=c,is}var os,yp;function sA(){if(yp)return os;yp=1;var e=jt(),t=_n(),n=de(),r=e?e.isConcatSpreadable:void 0;function i(o){return n(o)||t(o)||!!(r&&o&&o[r])}return os=i,os}var as,_p;function Bc(){if(_p)return as;_p=1;var e=kc(),t=sA();function n(r,i,o,a,s){var u=-1,l=r.length;for(o||(o=t),s||(s=[]);++u<l;){var c=r[u];i>0&&o(c)?i>1?n(c,i-1,o,a,s):e(s,c):a||(s[s.length]=c)}return s}return as=n,as}var ss,bp;function uA(){if(bp)return ss;bp=1;function e(t,n,r){switch(r.length){case 0:return t.call(n);case 1:return t.call(n,r[0]);case 2:return t.call(n,r[0],r[1]);case 3:return t.call(n,r[0],r[1],r[2])}return t.apply(n,r)}return ss=e,ss}var us,xp;function jy(){if(xp)return us;xp=1;var e=uA(),t=Math.max;function n(r,i,o){return i=t(i===void 0?r.length-1:i,0),function(){for(var a=arguments,s=-1,u=t(a.length-i,0),l=Array(u);++s<u;)l[s]=a[i+s];s=-1;for(var c=Array(i+1);++s<i;)c[s]=a[s];return c[i]=o(l),e(r,this,c)}}return us=n,us}var cs,wp;function cA(){if(wp)return cs;wp=1;var e=Lc(),t=iy(),n=wt(),r=t?function(i,o){return t(i,"toString",{configurable:!0,enumerable:!1,value:e(o),writable:!0})}:n;return cs=r,cs}var ls,Ep;function lA(){if(Ep)return ls;Ep=1;var e=800,t=16,n=Date.now;function r(i){var o=0,a=0;return function(){var s=n(),u=t-(s-a);if(a=s,u>0){if(++o>=e)return arguments[0]}else o=0;return i.apply(void 0,arguments)}}return ls=r,ls}var fs,Sp;function Fy(){if(Sp)return fs;Sp=1;var e=cA(),t=lA(),n=t(e);return fs=n,fs}var ds,Cp;function qr(){if(Cp)return ds;Cp=1;var e=wt(),t=jy(),n=Fy();function r(i,o){return n(t(i,o,e),i+"")}return ds=r,ds}var hs,Np;function By(){if(Np)return hs;Np=1;function e(t,n,r,i){for(var o=t.length,a=r+(i?1:-1);i?a--:++a<o;)if(n(t[a],a,t))return a;return-1}return hs=e,hs}var ps,Ap;function fA(){if(Ap)return ps;Ap=1;function e(t){return t!==t}return ps=e,ps}var gs,Ip;function dA(){if(Ip)return gs;Ip=1;function e(t,n,r){for(var i=r-1,o=t.length;++i<o;)if(t[i]===n)return i;return-1}return gs=e,gs}var vs,Mp;function hA(){if(Mp)return vs;Mp=1;var e=By(),t=fA(),n=dA();function r(i,o,a){return o===o?n(i,o,a):e(i,t,a)}return vs=r,vs}var ms,Rp;function pA(){if(Rp)return ms;Rp=1;var e=hA();function t(n,r){var i=n==null?0:n.length;return!!i&&e(n,r,0)>-1}return ms=t,ms}var ys,qp;function gA(){if(qp)return ys;qp=1;function e(t,n,r){for(var i=-1,o=t==null?0:t.length;++i<o;)if(r(n,t[i]))return!0;return!1}return ys=e,ys}var _s,Tp;function vA(){if(Tp)return _s;Tp=1;function e(){}return _s=e,_s}var bs,Pp;function mA(){if(Pp)return bs;Pp=1;var e=py(),t=vA(),n=jc(),r=1/0,i=e&&1/n(new e([,-0]))[1]==r?function(o){return new e(o)}:t;return bs=i,bs}var xs,kp;function yA(){if(kp)return xs;kp=1;var e=Ey(),t=pA(),n=gA(),r=Sy(),i=mA(),o=jc(),a=200;function s(u,l,c){var f=-1,d=t,h=u.length,p=!0,g=[],v=g;if(c)p=!1,d=n;else if(h>=a){var m=l?null:i(u);if(m)return o(m);p=!1,d=r,v=new e}else v=l?[]:g;e:for(;++f<h;){var b=u[f],y=l?l(b):b;if(b=c||b!==0?b:0,p&&y===y){for(var _=v.length;_--;)if(v[_]===y)continue e;l&&v.push(y),g.push(b)}else d(v,y,c)||(v!==g&&v.push(y),g.push(b))}return g}return xs=s,xs}var ws,Op;function zy(){if(Op)return ws;Op=1;var e=Ze(),t=De();function n(r){return t(r)&&e(r)}return ws=n,ws}var Es,Lp;function _A(){if(Lp)return Es;Lp=1;var e=Bc(),t=qr(),n=yA(),r=zy(),i=t(function(o){return n(e(o,1,r,!0))});return Es=i,Es}var Ss,Dp;function bA(){if(Dp)return Ss;Dp=1;var e=Ir();function t(n,r){return e(r,function(i){return n[i]})}return Ss=t,Ss}var Cs,$p;function Hy(){if($p)return Cs;$p=1;var e=bA(),t=ct();function n(r){return r==null?[]:e(r,t(r))}return Cs=n,Cs}var Ns,jp;function Ee(){if(jp)return Ns;jp=1;var e;if(typeof Nc=="function")try{e={clone:AN(),constant:Lc(),each:wy(),filter:Py(),has:ky(),isArray:de(),isEmpty:ZN(),isFunction:mn(),isUndefined:Oy(),keys:ct(),map:Dy(),reduce:$y(),size:oA(),transform:aA(),union:_A(),values:Hy()}}catch{}return e||(e=window._),Ns=e,Ns}var As,Fp;function zc(){if(Fp)return As;Fp=1;var e=Ee();As=i;var t="\0",n="\0",r="";function i(c){this._isDirected=e.has(c,"directed")?c.directed:!0,this._isMultigraph=e.has(c,"multigraph")?c.multigraph:!1,this._isCompound=e.has(c,"compound")?c.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[n]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(c){return this._label=c,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(c){return e.isFunction(c)||(c=e.constant(c)),this._defaultNodeLabelFn=c,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return e.keys(this._nodes)},i.prototype.sources=function(){var c=this;return e.filter(this.nodes(),function(f){return e.isEmpty(c._in[f])})},i.prototype.sinks=function(){var c=this;return e.filter(this.nodes(),function(f){return e.isEmpty(c._out[f])})},i.prototype.setNodes=function(c,f){var d=arguments,h=this;return e.each(c,function(p){d.length>1?h.setNode(p,f):h.setNode(p)}),this},i.prototype.setNode=function(c,f){return e.has(this._nodes,c)?(arguments.length>1&&(this._nodes[c]=f),this):(this._nodes[c]=arguments.length>1?f:this._defaultNodeLabelFn(c),this._isCompound&&(this._parent[c]=n,this._children[c]={},this._children[n][c]=!0),this._in[c]={},this._preds[c]={},this._out[c]={},this._sucs[c]={},++this._nodeCount,this)},i.prototype.node=function(c){return this._nodes[c]},i.prototype.hasNode=function(c){return e.has(this._nodes,c)},i.prototype.removeNode=function(c){var f=this;if(e.has(this._nodes,c)){var d=function(h){f.removeEdge(f._edgeObjs[h])};delete this._nodes[c],this._isCompound&&(this._removeFromParentsChildList(c),delete this._parent[c],e.each(this.children(c),function(h){f.setParent(h)}),delete this._children[c]),e.each(e.keys(this._in[c]),d),delete this._in[c],delete this._preds[c],e.each(e.keys(this._out[c]),d),delete this._out[c],delete this._sucs[c],--this._nodeCount}return this},i.prototype.setParent=function(c,f){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(f))f=n;else{f+="";for(var d=f;!e.isUndefined(d);d=this.parent(d))if(d===c)throw new Error("Setting "+f+" as parent of "+c+" would create a cycle");this.setNode(f)}return this.setNode(c),this._removeFromParentsChildList(c),this._parent[c]=f,this._children[f][c]=!0,this},i.prototype._removeFromParentsChildList=function(c){delete this._children[this._parent[c]][c]},i.prototype.parent=function(c){if(this._isCompound){var f=this._parent[c];if(f!==n)return f}},i.prototype.children=function(c){if(e.isUndefined(c)&&(c=n),this._isCompound){var f=this._children[c];if(f)return e.keys(f)}else{if(c===n)return this.nodes();if(this.hasNode(c))return[]}},i.prototype.predecessors=function(c){var f=this._preds[c];if(f)return e.keys(f)},i.prototype.successors=function(c){var f=this._sucs[c];if(f)return e.keys(f)},i.prototype.neighbors=function(c){var f=this.predecessors(c);if(f)return e.union(f,this.successors(c))},i.prototype.isLeaf=function(c){var f;return this.isDirected()?f=this.successors(c):f=this.neighbors(c),f.length===0},i.prototype.filterNodes=function(c){var f=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});f.setGraph(this.graph());var d=this;e.each(this._nodes,function(g,v){c(v)&&f.setNode(v,g)}),e.each(this._edgeObjs,function(g){f.hasNode(g.v)&&f.hasNode(g.w)&&f.setEdge(g,d.edge(g))});var h={};function p(g){var v=d.parent(g);return v===void 0||f.hasNode(v)?(h[g]=v,v):v in h?h[v]:p(v)}return this._isCompound&&e.each(f.nodes(),function(g){f.setParent(g,p(g))}),f},i.prototype.setDefaultEdgeLabel=function(c){return e.isFunction(c)||(c=e.constant(c)),this._defaultEdgeLabelFn=c,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return e.values(this._edgeObjs)},i.prototype.setPath=function(c,f){var d=this,h=arguments;return e.reduce(c,function(p,g){return h.length>1?d.setEdge(p,g,f):d.setEdge(p,g),g}),this},i.prototype.setEdge=function(){var c,f,d,h,p=!1,g=arguments[0];typeof g=="object"&&g!==null&&"v"in g?(c=g.v,f=g.w,d=g.name,arguments.length===2&&(h=arguments[1],p=!0)):(c=g,f=arguments[1],d=arguments[3],arguments.length>2&&(h=arguments[2],p=!0)),c=""+c,f=""+f,e.isUndefined(d)||(d=""+d);var v=s(this._isDirected,c,f,d);if(e.has(this._edgeLabels,v))return p&&(this._edgeLabels[v]=h),this;if(!e.isUndefined(d)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(c),this.setNode(f),this._edgeLabels[v]=p?h:this._defaultEdgeLabelFn(c,f,d);var m=u(this._isDirected,c,f,d);return c=m.v,f=m.w,Object.freeze(m),this._edgeObjs[v]=m,o(this._preds[f],c),o(this._sucs[c],f),this._in[f][v]=m,this._out[c][v]=m,this._edgeCount++,this},i.prototype.edge=function(c,f,d){var h=arguments.length===1?l(this._isDirected,arguments[0]):s(this._isDirected,c,f,d);return this._edgeLabels[h]},i.prototype.hasEdge=function(c,f,d){var h=arguments.length===1?l(this._isDirected,arguments[0]):s(this._isDirected,c,f,d);return e.has(this._edgeLabels,h)},i.prototype.removeEdge=function(c,f,d){var h=arguments.length===1?l(this._isDirected,arguments[0]):s(this._isDirected,c,f,d),p=this._edgeObjs[h];return p&&(c=p.v,f=p.w,delete this._edgeLabels[h],delete this._edgeObjs[h],a(this._preds[f],c),a(this._sucs[c],f),delete this._in[f][h],delete this._out[c][h],this._edgeCount--),this},i.prototype.inEdges=function(c,f){var d=this._in[c];if(d){var h=e.values(d);return f?e.filter(h,function(p){return p.v===f}):h}},i.prototype.outEdges=function(c,f){var d=this._out[c];if(d){var h=e.values(d);return f?e.filter(h,function(p){return p.w===f}):h}},i.prototype.nodeEdges=function(c,f){var d=this.inEdges(c,f);if(d)return d.concat(this.outEdges(c,f))};function o(c,f){c[f]?c[f]++:c[f]=1}function a(c,f){--c[f]||delete c[f]}function s(c,f,d,h){var p=""+f,g=""+d;if(!c&&p>g){var v=p;p=g,g=v}return p+r+g+r+(e.isUndefined(h)?t:h)}function u(c,f,d,h){var p=""+f,g=""+d;if(!c&&p>g){var v=p;p=g,g=v}var m={v:p,w:g};return h&&(m.name=h),m}function l(c,f){return s(c,f.v,f.w,f.name)}return As}var Is,Bp;function xA(){return Bp||(Bp=1,Is="2.1.8"),Is}var Ms,zp;function wA(){return zp||(zp=1,Ms={Graph:zc(),version:xA()}),Ms}var Rs,Hp;function EA(){if(Hp)return Rs;Hp=1;var e=Ee(),t=zc();Rs={write:n,read:o};function n(a){var s={options:{directed:a.isDirected(),multigraph:a.isMultigraph(),compound:a.isCompound()},nodes:r(a),edges:i(a)};return e.isUndefined(a.graph())||(s.value=e.clone(a.graph())),s}function r(a){return e.map(a.nodes(),function(s){var u=a.node(s),l=a.parent(s),c={v:s};return e.isUndefined(u)||(c.value=u),e.isUndefined(l)||(c.parent=l),c})}function i(a){return e.map(a.edges(),function(s){var u=a.edge(s),l={v:s.v,w:s.w};return e.isUndefined(s.name)||(l.name=s.name),e.isUndefined(u)||(l.value=u),l})}function o(a){var s=new t(a.options).setGraph(a.value);return e.each(a.nodes,function(u){s.setNode(u.v,u.value),u.parent&&s.setParent(u.v,u.parent)}),e.each(a.edges,function(u){s.setEdge({v:u.v,w:u.w,name:u.name},u.value)}),s}return Rs}var qs,Vp;function SA(){if(Vp)return qs;Vp=1;var e=Ee();qs=t;function t(n){var r={},i=[],o;function a(s){e.has(r,s)||(r[s]=!0,o.push(s),e.each(n.successors(s),a),e.each(n.predecessors(s),a))}return e.each(n.nodes(),function(s){o=[],a(s),o.length&&i.push(o)}),i}return qs}var Ts,Gp;function Vy(){if(Gp)return Ts;Gp=1;var e=Ee();Ts=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(n){return n.key})},t.prototype.has=function(n){return e.has(this._keyIndices,n)},t.prototype.priority=function(n){var r=this._keyIndices[n];if(r!==void 0)return this._arr[r].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(n,r){var i=this._keyIndices;if(n=String(n),!e.has(i,n)){var o=this._arr,a=o.length;return i[n]=a,o.push({key:n,priority:r}),this._decrease(a),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key},t.prototype.decrease=function(n,r){var i=this._keyIndices[n];if(r>this._arr[i].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[i].priority+" New: "+r);this._arr[i].priority=r,this._decrease(i)},t.prototype._heapify=function(n){var r=this._arr,i=2*n,o=i+1,a=n;i<r.length&&(a=r[i].priority<r[a].priority?i:a,o<r.length&&(a=r[o].priority<r[a].priority?o:a),a!==n&&(this._swap(n,a),this._heapify(a)))},t.prototype._decrease=function(n){for(var r=this._arr,i=r[n].priority,o;n!==0&&(o=n>>1,!(r[o].priority<i));)this._swap(n,o),n=o},t.prototype._swap=function(n,r){var i=this._arr,o=this._keyIndices,a=i[n],s=i[r];i[n]=s,i[r]=a,o[s.key]=n,o[a.key]=r},Ts}var Ps,Up;function Gy(){if(Up)return Ps;Up=1;var e=Ee(),t=Vy();Ps=r;var n=e.constant(1);function r(o,a,s,u){return i(o,String(a),s||n,u||function(l){return o.outEdges(l)})}function i(o,a,s,u){var l={},c=new t,f,d,h=function(p){var g=p.v!==f?p.v:p.w,v=l[g],m=s(p),b=d.distance+m;if(m<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+p+" Weight: "+m);b<v.distance&&(v.distance=b,v.predecessor=f,c.decrease(g,b))};for(o.nodes().forEach(function(p){var g=p===a?0:Number.POSITIVE_INFINITY;l[p]={distance:g},c.add(p,g)});c.size()>0&&(f=c.removeMin(),d=l[f],d.distance!==Number.POSITIVE_INFINITY);)u(f).forEach(h);return l}return Ps}var ks,Kp;function CA(){if(Kp)return ks;Kp=1;var e=Gy(),t=Ee();ks=n;function n(r,i,o){return t.transform(r.nodes(),function(a,s){a[s]=e(r,s,i,o)},{})}return ks}var Os,Yp;function Uy(){if(Yp)return Os;Yp=1;var e=Ee();Os=t;function t(n){var r=0,i=[],o={},a=[];function s(u){var l=o[u]={onStack:!0,lowlink:r,index:r++};if(i.push(u),n.successors(u).forEach(function(d){e.has(o,d)?o[d].onStack&&(l.lowlink=Math.min(l.lowlink,o[d].index)):(s(d),l.lowlink=Math.min(l.lowlink,o[d].lowlink))}),l.lowlink===l.index){var c=[],f;do f=i.pop(),o[f].onStack=!1,c.push(f);while(u!==f);a.push(c)}}return n.nodes().forEach(function(u){e.has(o,u)||s(u)}),a}return Os}var Ls,Wp;function NA(){if(Wp)return Ls;Wp=1;var e=Ee(),t=Uy();Ls=n;function n(r){return e.filter(t(r),function(i){return i.length>1||i.length===1&&r.hasEdge(i[0],i[0])})}return Ls}var Ds,Xp;function AA(){if(Xp)return Ds;Xp=1;var e=Ee();Ds=n;var t=e.constant(1);function n(i,o,a){return r(i,o||t,a||function(s){return i.outEdges(s)})}function r(i,o,a){var s={},u=i.nodes();return u.forEach(function(l){s[l]={},s[l][l]={distance:0},u.forEach(function(c){l!==c&&(s[l][c]={distance:Number.POSITIVE_INFINITY})}),a(l).forEach(function(c){var f=c.v===l?c.w:c.v,d=o(c);s[l][f]={distance:d,predecessor:l}})}),u.forEach(function(l){var c=s[l];u.forEach(function(f){var d=s[f];u.forEach(function(h){var p=d[l],g=c[h],v=d[h],m=p.distance+g.distance;m<v.distance&&(v.distance=m,v.predecessor=g.predecessor)})})}),s}return Ds}var $s,Zp;function Ky(){if(Zp)return $s;Zp=1;var e=Ee();$s=t,t.CycleException=n;function t(r){var i={},o={},a=[];function s(u){if(e.has(o,u))throw new n;e.has(i,u)||(o[u]=!0,i[u]=!0,e.each(r.predecessors(u),s),delete o[u],a.push(u))}if(e.each(r.sinks(),s),e.size(i)!==r.nodeCount())throw new n;return a}function n(){}return n.prototype=new Error,$s}var js,Qp;function IA(){if(Qp)return js;Qp=1;var e=Ky();js=t;function t(n){try{e(n)}catch(r){if(r instanceof e.CycleException)return!1;throw r}return!0}return js}var Fs,Jp;function Yy(){if(Jp)return Fs;Jp=1;var e=Ee();Fs=t;function t(r,i,o){e.isArray(i)||(i=[i]);var a=(r.isDirected()?r.successors:r.neighbors).bind(r),s=[],u={};return e.each(i,function(l){if(!r.hasNode(l))throw new Error("Graph does not have node: "+l);n(r,l,o==="post",u,a,s)}),s}function n(r,i,o,a,s,u){e.has(a,i)||(a[i]=!0,o||u.push(i),e.each(s(i),function(l){n(r,l,o,a,s,u)}),o&&u.push(i))}return Fs}var Bs,eg;function MA(){if(eg)return Bs;eg=1;var e=Yy();Bs=t;function t(n,r){return e(n,r,"post")}return Bs}var zs,tg;function RA(){if(tg)return zs;tg=1;var e=Yy();zs=t;function t(n,r){return e(n,r,"pre")}return zs}var Hs,ng;function qA(){if(ng)return Hs;ng=1;var e=Ee(),t=zc(),n=Vy();Hs=r;function r(i,o){var a=new t,s={},u=new n,l;function c(d){var h=d.v===l?d.w:d.v,p=u.priority(h);if(p!==void 0){var g=o(d);g<p&&(s[h]=l,u.decrease(h,g))}}if(i.nodeCount()===0)return a;e.each(i.nodes(),function(d){u.add(d,Number.POSITIVE_INFINITY),a.setNode(d)}),u.decrease(i.nodes()[0],0);for(var f=!1;u.size()>0;){if(l=u.removeMin(),e.has(s,l))a.setEdge(l,s[l]);else{if(f)throw new Error("Input graph is not connected: "+i);f=!0}i.nodeEdges(l).forEach(c)}return a}return Hs}var Vs,rg;function TA(){return rg||(rg=1,Vs={components:SA(),dijkstra:Gy(),dijkstraAll:CA(),findCycles:NA(),floydWarshall:AA(),isAcyclic:IA(),postorder:MA(),preorder:RA(),prim:qA(),tarjan:Uy(),topsort:Ky()}),Vs}var Gs,ig;function PA(){if(ig)return Gs;ig=1;var e=wA();return Gs={Graph:e.Graph,json:EA(),alg:TA(),version:e.version},Gs}var er;if(typeof Nc=="function")try{er=PA()}catch{}er||(er=window.graphlib);var Re=er,Us,og;function kA(){if(og)return Us;og=1;var e=_y(),t=1,n=4;function r(i){return e(i,t|n)}return Us=r,Us}var Ks,ag;function Tr(){if(ag)return Ks;ag=1;var e=$t(),t=Ze(),n=Er(),r=we();function i(o,a,s){if(!r(s))return!1;var u=typeof a;return(u=="number"?t(s)&&n(a,s.length):u=="string"&&a in s)?e(s[a],o):!1}return Ks=i,Ks}var Ys,sg;function OA(){if(sg)return Ys;sg=1;var e=qr(),t=$t(),n=Tr(),r=xt(),i=Object.prototype,o=i.hasOwnProperty,a=e(function(s,u){s=Object(s);var l=-1,c=u.length,f=c>2?u[2]:void 0;for(f&&n(u[0],u[1],f)&&(c=1);++l<c;)for(var d=u[l],h=r(d),p=-1,g=h.length;++p<g;){var v=h[p],m=s[v];(m===void 0||t(m,i[v])&&!o.call(s,v))&&(s[v]=d[v])}return s});return Ys=a,Ys}var Ws,ug;function LA(){if(ug)return Ws;ug=1;var e=Qe(),t=Ze(),n=ct();function r(i){return function(o,a,s){var u=Object(o);if(!t(o)){var l=e(a,3);o=n(o),a=function(f){return l(u[f],f,u)}}var c=i(o,a,s);return c>-1?u[l?o[c]:c]:void 0}}return Ws=r,Ws}var Xs,cg;function DA(){if(cg)return Xs;cg=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return Xs=t,Xs}var Zs,lg;function $A(){if(lg)return Zs;lg=1;var e=DA(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return Zs=n,Zs}var Qs,fg;function jA(){if(fg)return Qs;fg=1;var e=$A(),t=we(),n=zt(),r=NaN,i=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,a=/^0o[0-7]+$/i,s=parseInt;function u(l){if(typeof l=="number")return l;if(n(l))return r;if(t(l)){var c=typeof l.valueOf=="function"?l.valueOf():l;l=t(c)?c+"":c}if(typeof l!="string")return l===0?l:+l;l=e(l);var f=o.test(l);return f||a.test(l)?s(l.slice(2),f?2:8):i.test(l)?r:+l}return Qs=u,Qs}var Js,dg;function Wy(){if(dg)return Js;dg=1;var e=jA(),t=1/0,n=17976931348623157e292;function r(i){if(!i)return i===0?i:0;if(i=e(i),i===t||i===-t){var o=i<0?-1:1;return o*n}return i===i?i:0}return Js=r,Js}var eu,hg;function FA(){if(hg)return eu;hg=1;var e=Wy();function t(n){var r=e(n),i=r%1;return r===r?i?r-i:r:0}return eu=t,eu}var tu,pg;function BA(){if(pg)return tu;pg=1;var e=By(),t=Qe(),n=FA(),r=Math.max;function i(o,a,s){var u=o==null?0:o.length;if(!u)return-1;var l=s==null?0:n(s);return l<0&&(l=r(u+l,0)),e(o,t(a,3),l)}return tu=i,tu}var nu,gg;function zA(){if(gg)return nu;gg=1;var e=LA(),t=BA(),n=e(t);return nu=n,nu}var ru,vg;function Xy(){if(vg)return ru;vg=1;var e=Bc();function t(n){var r=n==null?0:n.length;return r?e(n,1):[]}return ru=t,ru}var iu,mg;function HA(){if(mg)return iu;mg=1;var e=Dc(),t=by(),n=xt();function r(i,o){return i==null?i:e(i,t(o),n)}return iu=r,iu}var ou,yg;function VA(){if(yg)return ou;yg=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return ou=e,ou}var au,_g;function GA(){if(_g)return au;_g=1;var e=xr(),t=$c(),n=Qe();function r(i,o){var a={};return o=n(o,3),t(i,function(s,u,l){e(a,u,o(s,u,l))}),a}return au=r,au}var su,bg;function Hc(){if(bg)return su;bg=1;var e=zt();function t(n,r,i){for(var o=-1,a=n.length;++o<a;){var s=n[o],u=r(s);if(u!=null&&(l===void 0?u===u&&!e(u):i(u,l)))var l=u,c=s}return c}return su=t,su}var uu,xg;function UA(){if(xg)return uu;xg=1;function e(t,n){return t>n}return uu=e,uu}var cu,wg;function KA(){if(wg)return cu;wg=1;var e=Hc(),t=UA(),n=wt();function r(i){return i&&i.length?e(i,n,t):void 0}return cu=r,cu}var lu,Eg;function Zy(){if(Eg)return lu;Eg=1;var e=xr(),t=$t();function n(r,i,o){(o!==void 0&&!t(r[i],o)||o===void 0&&!(i in r))&&e(r,i,o)}return lu=n,lu}var fu,Sg;function YA(){if(Sg)return fu;Sg=1;var e=_t(),t=Nr(),n=De(),r="[object Object]",i=Function.prototype,o=Object.prototype,a=i.toString,s=o.hasOwnProperty,u=a.call(Object);function l(c){if(!n(c)||e(c)!=r)return!1;var f=t(c);if(f===null)return!0;var d=s.call(f,"constructor")&&f.constructor;return typeof d=="function"&&d instanceof d&&a.call(d)==u}return fu=l,fu}var du,Cg;function Qy(){if(Cg)return du;Cg=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return du=e,du}var hu,Ng;function WA(){if(Ng)return hu;Ng=1;var e=yn(),t=xt();function n(r){return e(r,t(r))}return hu=n,hu}var pu,Ag;function XA(){if(Ag)return pu;Ag=1;var e=Zy(),t=sy(),n=vy(),r=uy(),i=yy(),o=_n(),a=de(),s=zy(),u=Ft(),l=mn(),c=we(),f=YA(),d=bn(),h=Qy(),p=WA();function g(v,m,b,y,_,C,x){var E=h(v,b),A=h(m,b),q=x.get(A);if(q){e(v,b,q);return}var D=C?C(E,A,b+"",v,m,x):void 0,N=D===void 0;if(N){var R=a(A),L=!R&&u(A),w=!R&&!L&&d(A);D=A,R||L||w?a(E)?D=E:s(E)?D=r(E):L?(N=!1,D=t(A,!0)):w?(N=!1,D=n(A,!0)):D=[]:f(A)||o(A)?(D=E,o(E)?D=p(E):(!c(E)||l(E))&&(D=i(A))):N=!1}N&&(x.set(A,D),_(D,A,y,C,x),x.delete(A)),e(v,b,D)}return pu=g,pu}var gu,Ig;function ZA(){if(Ig)return gu;Ig=1;var e=br(),t=Zy(),n=Dc(),r=XA(),i=we(),o=xt(),a=Qy();function s(u,l,c,f,d){u!==l&&n(l,function(h,p){if(d||(d=new e),i(h))r(u,l,p,c,s,f,d);else{var g=f?f(a(u,p),h,p+"",u,l,d):void 0;g===void 0&&(g=h),t(u,p,g)}},o)}return gu=s,gu}var vu,Mg;function QA(){if(Mg)return vu;Mg=1;var e=qr(),t=Tr();function n(r){return e(function(i,o){var a=-1,s=o.length,u=s>1?o[s-1]:void 0,l=s>2?o[2]:void 0;for(u=r.length>3&&typeof u=="function"?(s--,u):void 0,l&&t(o[0],o[1],l)&&(u=s<3?void 0:u,s=1),i=Object(i);++a<s;){var c=o[a];c&&r(i,c,a,u)}return i})}return vu=n,vu}var mu,Rg;function JA(){if(Rg)return mu;Rg=1;var e=ZA(),t=QA(),n=t(function(r,i,o){e(r,i,o)});return mu=n,mu}var yu,qg;function Jy(){if(qg)return yu;qg=1;function e(t,n){return t<n}return yu=e,yu}var _u,Tg;function eI(){if(Tg)return _u;Tg=1;var e=Hc(),t=Jy(),n=wt();function r(i){return i&&i.length?e(i,n,t):void 0}return _u=r,_u}var bu,Pg;function tI(){if(Pg)return bu;Pg=1;var e=Hc(),t=Qe(),n=Jy();function r(i,o){return i&&i.length?e(i,t(o,2),n):void 0}return bu=r,bu}var xu,kg;function nI(){if(kg)return xu;kg=1;var e=Me(),t=function(){return e.Date.now()};return xu=t,xu}var wu,Og;function rI(){if(Og)return wu;Og=1;var e=wr(),t=Mr(),n=Er(),r=we(),i=xn();function o(a,s,u,l){if(!r(a))return a;s=t(s,a);for(var c=-1,f=s.length,d=f-1,h=a;h!=null&&++c<f;){var p=i(s[c]),g=u;if(p==="__proto__"||p==="constructor"||p==="prototype")return a;if(c!=d){var v=h[p];g=l?l(v,p,h):void 0,g===void 0&&(g=r(v)?v:n(s[c+1])?[]:{})}e(h,p,g),h=h[p]}return a}return wu=o,wu}var Eu,Lg;function iI(){if(Lg)return Eu;Lg=1;var e=Rr(),t=rI(),n=Mr();function r(i,o,a){for(var s=-1,u=o.length,l={};++s<u;){var c=o[s],f=e(i,c);a(f,c)&&t(l,n(c,i),f)}return l}return Eu=r,Eu}var Su,Dg;function oI(){if(Dg)return Su;Dg=1;var e=iI(),t=qy();function n(r,i){return e(r,i,function(o,a){return t(r,a)})}return Su=n,Su}var Cu,$g;function aI(){if($g)return Cu;$g=1;var e=Xy(),t=jy(),n=Fy();function r(i){return n(t(i,void 0,e),i+"")}return Cu=r,Cu}var Nu,jg;function sI(){if(jg)return Nu;jg=1;var e=oI(),t=aI(),n=t(function(r,i){return r==null?{}:e(r,i)});return Nu=n,Nu}var Au,Fg;function uI(){if(Fg)return Au;Fg=1;var e=Math.ceil,t=Math.max;function n(r,i,o,a){for(var s=-1,u=t(e((i-r)/(o||1)),0),l=Array(u);u--;)l[a?u:++s]=r,r+=o;return l}return Au=n,Au}var Iu,Bg;function cI(){if(Bg)return Iu;Bg=1;var e=uI(),t=Tr(),n=Wy();function r(i){return function(o,a,s){return s&&typeof s!="number"&&t(o,a,s)&&(a=s=void 0),o=n(o),a===void 0?(a=o,o=0):a=n(a),s=s===void 0?o<a?1:-1:n(s),e(o,a,s,i)}}return Iu=r,Iu}var Mu,zg;function lI(){if(zg)return Mu;zg=1;var e=cI(),t=e();return Mu=t,Mu}var Ru,Hg;function fI(){if(Hg)return Ru;Hg=1;function e(t,n){var r=t.length;for(t.sort(n);r--;)t[r]=t[r].value;return t}return Ru=e,Ru}var qu,Vg;function dI(){if(Vg)return qu;Vg=1;var e=zt();function t(n,r){if(n!==r){var i=n!==void 0,o=n===null,a=n===n,s=e(n),u=r!==void 0,l=r===null,c=r===r,f=e(r);if(!l&&!f&&!s&&n>r||s&&u&&c&&!l&&!f||o&&u&&c||!i&&c||!a)return 1;if(!o&&!s&&!f&&n<r||f&&i&&a&&!o&&!s||l&&i&&a||!u&&a||!c)return-1}return 0}return qu=t,qu}var Tu,Gg;function hI(){if(Gg)return Tu;Gg=1;var e=dI();function t(n,r,i){for(var o=-1,a=n.criteria,s=r.criteria,u=a.length,l=i.length;++o<u;){var c=e(a[o],s[o]);if(c){if(o>=l)return c;var f=i[o];return c*(f=="desc"?-1:1)}}return n.index-r.index}return Tu=t,Tu}var Pu,Ug;function pI(){if(Ug)return Pu;Ug=1;var e=Ir(),t=Rr(),n=Qe(),r=Ly(),i=fI(),o=Sr(),a=hI(),s=wt(),u=de();function l(c,f,d){f.length?f=e(f,function(g){return u(g)?function(v){return t(v,g.length===1?g[0]:g)}:g}):f=[s];var h=-1;f=e(f,o(n));var p=r(c,function(g,v,m){var b=e(f,function(y){return y(g)});return{criteria:b,index:++h,value:g}});return i(p,function(g,v){return a(g,v,d)})}return Pu=l,Pu}var ku,Kg;function gI(){if(Kg)return ku;Kg=1;var e=Bc(),t=pI(),n=qr(),r=Tr(),i=n(function(o,a){if(o==null)return[];var s=a.length;return s>1&&r(o,a[0],a[1])?a=[]:s>2&&r(a[0],a[1],a[2])&&(a=[a[0]]),t(o,e(a,1),[])});return ku=i,ku}var Ou,Yg;function vI(){if(Yg)return Ou;Yg=1;var e=My(),t=0;function n(r){var i=++t;return e(r)+i}return Ou=n,Ou}var Lu,Wg;function mI(){if(Wg)return Lu;Wg=1;function e(t,n,r){for(var i=-1,o=t.length,a=n.length,s={};++i<o;){var u=i<a?n[i]:void 0;r(s,t[i],u)}return s}return Lu=e,Lu}var Du,Xg;function yI(){if(Xg)return Du;Xg=1;var e=wr(),t=mI();function n(r,i){return t(r||[],i||[],e)}return Du=n,Du}var tr;if(typeof Nc=="function")try{tr={cloneDeep:kA(),constant:Lc(),defaults:OA(),each:wy(),filter:Py(),find:zA(),flatten:Xy(),forEach:xy(),forIn:HA(),has:ky(),isUndefined:Oy(),last:VA(),map:Dy(),mapValues:GA(),max:KA(),merge:JA(),min:eI(),minBy:tI(),now:nI(),pick:sI(),range:lI(),reduce:$y(),sortBy:gI(),uniqueId:vI(),values:Hy(),zipObject:yI()}}catch{}tr||(tr=window._);var ce=tr,_I=Pr;function Pr(){var e={};e._next=e._prev=e,this._sentinel=e}Pr.prototype.dequeue=function(){var e=this._sentinel,t=e._prev;if(t!==e)return e0(t),t};Pr.prototype.enqueue=function(e){var t=this._sentinel;e._prev&&e._next&&e0(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t};Pr.prototype.toString=function(){for(var e=[],t=this._sentinel,n=t._prev;n!==t;)e.push(JSON.stringify(n,bI)),n=n._prev;return"["+e.join(", ")+"]"};function e0(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function bI(e,t){if(e!=="_next"&&e!=="_prev")return t}var Ge=ce,xI=Re.Graph,wI=_I,EI=CI,SI=Ge.constant(1);function CI(e,t){if(e.nodeCount()<=1)return[];var n=AI(e,t||SI),r=NI(n.graph,n.buckets,n.zeroIdx);return Ge.flatten(Ge.map(r,function(i){return e.outEdges(i.v,i.w)}),!0)}function NI(e,t,n){for(var r=[],i=t[t.length-1],o=t[0],a;e.nodeCount();){for(;a=o.dequeue();)$u(e,t,n,a);for(;a=i.dequeue();)$u(e,t,n,a);if(e.nodeCount()){for(var s=t.length-2;s>0;--s)if(a=t[s].dequeue(),a){r=r.concat($u(e,t,n,a,!0));break}}}return r}function $u(e,t,n,r,i){var o=i?[]:void 0;return Ge.forEach(e.inEdges(r.v),function(a){var s=e.edge(a),u=e.node(a.v);i&&o.push({v:a.v,w:a.w}),u.out-=s,oc(t,n,u)}),Ge.forEach(e.outEdges(r.v),function(a){var s=e.edge(a),u=a.w,l=e.node(u);l.in-=s,oc(t,n,l)}),e.removeNode(r.v),o}function AI(e,t){var n=new xI,r=0,i=0;Ge.forEach(e.nodes(),function(s){n.setNode(s,{v:s,in:0,out:0})}),Ge.forEach(e.edges(),function(s){var u=n.edge(s.v,s.w)||0,l=t(s),c=u+l;n.setEdge(s.v,s.w,c),i=Math.max(i,n.node(s.v).out+=l),r=Math.max(r,n.node(s.w).in+=l)});var o=Ge.range(i+r+3).map(function(){return new wI}),a=r+1;return Ge.forEach(n.nodes(),function(s){oc(o,a,n.node(s))}),{graph:n,buckets:o,zeroIdx:a}}function oc(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}var dt=ce,II=EI,MI={run:RI,undo:TI};function RI(e){var t=e.graph().acyclicer==="greedy"?II(e,n(e)):qI(e);dt.forEach(t,function(r){var i=e.edge(r);e.removeEdge(r),i.forwardName=r.name,i.reversed=!0,e.setEdge(r.w,r.v,i,dt.uniqueId("rev"))});function n(r){return function(i){return r.edge(i).weight}}}function qI(e){var t=[],n={},r={};function i(o){dt.has(r,o)||(r[o]=!0,n[o]=!0,dt.forEach(e.outEdges(o),function(a){dt.has(n,a.w)?t.push(a):i(a.w)}),delete n[o])}return dt.forEach(e.nodes(),i),t}function TI(e){dt.forEach(e.edges(),function(t){var n=e.edge(t);if(n.reversed){e.removeEdge(t);var r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}var ae=ce,t0=Re.Graph,me={addDummyNode:n0,simplify:PI,asNonCompoundGraph:kI,successorWeights:OI,predecessorWeights:LI,intersectRect:DI,buildLayerMatrix:$I,normalizeRanks:jI,removeEmptyRanks:FI,addBorderNode:BI,maxRank:r0,partition:zI,time:HI,notime:VI};function n0(e,t,n,r){var i;do i=ae.uniqueId(r);while(e.hasNode(i));return n.dummy=t,e.setNode(i,n),i}function PI(e){var t=new t0().setGraph(e.graph());return ae.forEach(e.nodes(),function(n){t.setNode(n,e.node(n))}),ae.forEach(e.edges(),function(n){var r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function kI(e){var t=new t0({multigraph:e.isMultigraph()}).setGraph(e.graph());return ae.forEach(e.nodes(),function(n){e.children(n).length||t.setNode(n,e.node(n))}),ae.forEach(e.edges(),function(n){t.setEdge(n,e.edge(n))}),t}function OI(e){var t=ae.map(e.nodes(),function(n){var r={};return ae.forEach(e.outEdges(n),function(i){r[i.w]=(r[i.w]||0)+e.edge(i).weight}),r});return ae.zipObject(e.nodes(),t)}function LI(e){var t=ae.map(e.nodes(),function(n){var r={};return ae.forEach(e.inEdges(n),function(i){r[i.v]=(r[i.v]||0)+e.edge(i).weight}),r});return ae.zipObject(e.nodes(),t)}function DI(e,t){var n=e.x,r=e.y,i=t.x-n,o=t.y-r,a=e.width/2,s=e.height/2;if(!i&&!o)throw new Error("Not possible to find intersection inside of the rectangle");var u,l;return Math.abs(o)*a>Math.abs(i)*s?(o<0&&(s=-s),u=s*i/o,l=s):(i<0&&(a=-a),u=a,l=a*o/i),{x:n+u,y:r+l}}function $I(e){var t=ae.map(ae.range(r0(e)+1),function(){return[]});return ae.forEach(e.nodes(),function(n){var r=e.node(n),i=r.rank;ae.isUndefined(i)||(t[i][r.order]=n)}),t}function jI(e){var t=ae.min(ae.map(e.nodes(),function(n){return e.node(n).rank}));ae.forEach(e.nodes(),function(n){var r=e.node(n);ae.has(r,"rank")&&(r.rank-=t)})}function FI(e){var t=ae.min(ae.map(e.nodes(),function(o){return e.node(o).rank})),n=[];ae.forEach(e.nodes(),function(o){var a=e.node(o).rank-t;n[a]||(n[a]=[]),n[a].push(o)});var r=0,i=e.graph().nodeRankFactor;ae.forEach(n,function(o,a){ae.isUndefined(o)&&a%i!==0?--r:r&&ae.forEach(o,function(s){e.node(s).rank+=r})})}function BI(e,t,n,r){var i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),n0(e,"border",i,t)}function r0(e){return ae.max(ae.map(e.nodes(),function(t){var n=e.node(t).rank;if(!ae.isUndefined(n))return n}))}function zI(e,t){var n={lhs:[],rhs:[]};return ae.forEach(e,function(r){t(r)?n.lhs.push(r):n.rhs.push(r)}),n}function HI(e,t){var n=ae.now();try{return t()}finally{console.log(e+" time: "+(ae.now()-n)+"ms")}}function VI(e,t){return t()}var i0=ce,GI=me,UI={run:KI,undo:WI};function KI(e){e.graph().dummyChains=[],i0.forEach(e.edges(),function(t){YI(e,t)})}function YI(e,t){var n=t.v,r=e.node(n).rank,i=t.w,o=e.node(i).rank,a=t.name,s=e.edge(t),u=s.labelRank;if(o!==r+1){e.removeEdge(t);var l,c,f;for(f=0,++r;r<o;++f,++r)s.points=[],c={width:0,height:0,edgeLabel:s,edgeObj:t,rank:r},l=GI.addDummyNode(e,"edge",c,"_d"),r===u&&(c.width=s.width,c.height=s.height,c.dummy="edge-label",c.labelpos=s.labelpos),e.setEdge(n,l,{weight:s.weight},a),f===0&&e.graph().dummyChains.push(l),n=l;e.setEdge(n,i,{weight:s.weight},a)}}function WI(e){i0.forEach(e.graph().dummyChains,function(t){var n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}var Ln=ce,kr={longestPath:XI,slack:ZI};function XI(e){var t={};function n(r){var i=e.node(r);if(Ln.has(t,r))return i.rank;t[r]=!0;var o=Ln.min(Ln.map(e.outEdges(r),function(a){return n(a.w)-e.edge(a).minlen}));return(o===Number.POSITIVE_INFINITY||o===void 0||o===null)&&(o=0),i.rank=o}Ln.forEach(e.sources(),n)}function ZI(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var nr=ce,QI=Re.Graph,rr=kr.slack,o0=JI;function JI(e){var t=new QI({directed:!1}),n=e.nodes()[0],r=e.nodeCount();t.setNode(n,{});for(var i,o;eM(t,e)<r;)i=tM(t,e),o=t.hasNode(i.v)?rr(e,i):-rr(e,i),nM(t,e,o);return t}function eM(e,t){function n(r){nr.forEach(t.nodeEdges(r),function(i){var o=i.v,a=r===o?i.w:o;!e.hasNode(a)&&!rr(t,i)&&(e.setNode(a,{}),e.setEdge(r,a,{}),n(a))})}return nr.forEach(e.nodes(),n),e.nodeCount()}function tM(e,t){return nr.minBy(t.edges(),function(n){if(e.hasNode(n.v)!==e.hasNode(n.w))return rr(t,n)})}function nM(e,t,n){nr.forEach(e.nodes(),function(r){t.node(r).rank+=n})}var We=ce,rM=o0,iM=kr.slack,oM=kr.longestPath,aM=Re.alg.preorder,sM=Re.alg.postorder,uM=me.simplify,cM=Et;Et.initLowLimValues=Gc;Et.initCutValues=Vc;Et.calcCutValue=a0;Et.leaveEdge=u0;Et.enterEdge=c0;Et.exchangeEdges=l0;function Et(e){e=uM(e),oM(e);var t=rM(e);Gc(t),Vc(t,e);for(var n,r;n=u0(t);)r=c0(t,e,n),l0(t,e,n,r)}function Vc(e,t){var n=sM(e,e.nodes());n=n.slice(0,n.length-1),We.forEach(n,function(r){lM(e,t,r)})}function lM(e,t,n){var r=e.node(n),i=r.parent;e.edge(n,i).cutvalue=a0(e,t,n)}function a0(e,t,n){var r=e.node(n),i=r.parent,o=!0,a=t.edge(n,i),s=0;return a||(o=!1,a=t.edge(i,n)),s=a.weight,We.forEach(t.nodeEdges(n),function(u){var l=u.v===n,c=l?u.w:u.v;if(c!==i){var f=l===o,d=t.edge(u).weight;if(s+=f?d:-d,dM(e,n,c)){var h=e.edge(n,c).cutvalue;s+=f?-h:h}}}),s}function Gc(e,t){arguments.length<2&&(t=e.nodes()[0]),s0(e,{},1,t)}function s0(e,t,n,r,i){var o=n,a=e.node(r);return t[r]=!0,We.forEach(e.neighbors(r),function(s){We.has(t,s)||(n=s0(e,t,n,s,r))}),a.low=o,a.lim=n++,i?a.parent=i:delete a.parent,n}function u0(e){return We.find(e.edges(),function(t){return e.edge(t).cutvalue<0})}function c0(e,t,n){var r=n.v,i=n.w;t.hasEdge(r,i)||(r=n.w,i=n.v);var o=e.node(r),a=e.node(i),s=o,u=!1;o.lim>a.lim&&(s=a,u=!0);var l=We.filter(t.edges(),function(c){return u===Zg(e,e.node(c.v),s)&&u!==Zg(e,e.node(c.w),s)});return We.minBy(l,function(c){return iM(t,c)})}function l0(e,t,n,r){var i=n.v,o=n.w;e.removeEdge(i,o),e.setEdge(r.v,r.w,{}),Gc(e),Vc(e,t),fM(e,t)}function fM(e,t){var n=We.find(e.nodes(),function(i){return!t.node(i).parent}),r=aM(e,n);r=r.slice(1),We.forEach(r,function(i){var o=e.node(i).parent,a=t.edge(i,o),s=!1;a||(a=t.edge(o,i),s=!0),t.node(i).rank=t.node(o).rank+(s?a.minlen:-a.minlen)})}function dM(e,t,n){return e.hasEdge(t,n)}function Zg(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var hM=kr,f0=hM.longestPath,pM=o0,gM=cM,vM=mM;function mM(e){switch(e.graph().ranker){case"network-simplex":Qg(e);break;case"tight-tree":_M(e);break;case"longest-path":yM(e);break;default:Qg(e)}}var yM=f0;function _M(e){f0(e),pM(e)}function Qg(e){gM(e)}var ac=ce,bM=xM;function xM(e){var t=EM(e);ac.forEach(e.graph().dummyChains,function(n){for(var r=e.node(n),i=r.edgeObj,o=wM(e,t,i.v,i.w),a=o.path,s=o.lca,u=0,l=a[u],c=!0;n!==i.w;){if(r=e.node(n),c){for(;(l=a[u])!==s&&e.node(l).maxRank<r.rank;)u++;l===s&&(c=!1)}if(!c){for(;u<a.length-1&&e.node(l=a[u+1]).minRank<=r.rank;)u++;l=a[u]}e.setParent(n,l),n=e.successors(n)[0]}})}function wM(e,t,n,r){var i=[],o=[],a=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),u,l;u=n;do u=e.parent(u),i.push(u);while(u&&(t[u].low>a||s>t[u].lim));for(l=u,u=r;(u=e.parent(u))!==l;)o.push(u);return{path:i.concat(o.reverse()),lca:l}}function EM(e){var t={},n=0;function r(i){var o=n;ac.forEach(e.children(i),r),t[i]={low:o,lim:n++}}return ac.forEach(e.children(),r),t}var Ue=ce,sc=me,SM={run:CM,cleanup:IM};function CM(e){var t=sc.addDummyNode(e,"root",{},"_root"),n=NM(e),r=Ue.max(Ue.values(n))-1,i=2*r+1;e.graph().nestingRoot=t,Ue.forEach(e.edges(),function(a){e.edge(a).minlen*=i});var o=AM(e)+1;Ue.forEach(e.children(),function(a){d0(e,t,i,o,r,n,a)}),e.graph().nodeRankFactor=i}function d0(e,t,n,r,i,o,a){var s=e.children(a);if(!s.length){a!==t&&e.setEdge(t,a,{weight:0,minlen:n});return}var u=sc.addBorderNode(e,"_bt"),l=sc.addBorderNode(e,"_bb"),c=e.node(a);e.setParent(u,a),c.borderTop=u,e.setParent(l,a),c.borderBottom=l,Ue.forEach(s,function(f){d0(e,t,n,r,i,o,f);var d=e.node(f),h=d.borderTop?d.borderTop:f,p=d.borderBottom?d.borderBottom:f,g=d.borderTop?r:2*r,v=h!==p?1:i-o[a]+1;e.setEdge(u,h,{weight:g,minlen:v,nestingEdge:!0}),e.setEdge(p,l,{weight:g,minlen:v,nestingEdge:!0})}),e.parent(a)||e.setEdge(t,u,{weight:0,minlen:i+o[a]})}function NM(e){var t={};function n(r,i){var o=e.children(r);o&&o.length&&Ue.forEach(o,function(a){n(a,i+1)}),t[r]=i}return Ue.forEach(e.children(),function(r){n(r,1)}),t}function AM(e){return Ue.reduce(e.edges(),function(t,n){return t+e.edge(n).weight},0)}function IM(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,Ue.forEach(e.edges(),function(n){var r=e.edge(n);r.nestingEdge&&e.removeEdge(n)})}var ju=ce,MM=me,RM=qM;function qM(e){function t(n){var r=e.children(n),i=e.node(n);if(r.length&&ju.forEach(r,t),ju.has(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var o=i.minRank,a=i.maxRank+1;o<a;++o)Jg(e,"borderLeft","_bl",n,i,o),Jg(e,"borderRight","_br",n,i,o)}}ju.forEach(e.children(),t)}function Jg(e,t,n,r,i,o){var a={width:0,height:0,rank:o,borderType:t},s=i[t][o-1],u=MM.addDummyNode(e,"border",a,n);i[t][o]=u,e.setParent(u,r),s&&e.setEdge(s,u,{weight:1})}var ke=ce,TM={adjust:PM,undo:kM};function PM(e){var t=e.graph().rankdir.toLowerCase();(t==="lr"||t==="rl")&&h0(e)}function kM(e){var t=e.graph().rankdir.toLowerCase();(t==="bt"||t==="rl")&&OM(e),(t==="lr"||t==="rl")&&(LM(e),h0(e))}function h0(e){ke.forEach(e.nodes(),function(t){ev(e.node(t))}),ke.forEach(e.edges(),function(t){ev(e.edge(t))})}function ev(e){var t=e.width;e.width=e.height,e.height=t}function OM(e){ke.forEach(e.nodes(),function(t){Fu(e.node(t))}),ke.forEach(e.edges(),function(t){var n=e.edge(t);ke.forEach(n.points,Fu),ke.has(n,"y")&&Fu(n)})}function Fu(e){e.y=-e.y}function LM(e){ke.forEach(e.nodes(),function(t){Bu(e.node(t))}),ke.forEach(e.edges(),function(t){var n=e.edge(t);ke.forEach(n.points,Bu),ke.has(n,"x")&&Bu(n)})}function Bu(e){var t=e.x;e.x=e.y,e.y=t}var He=ce,DM=$M;function $M(e){var t={},n=He.filter(e.nodes(),function(s){return!e.children(s).length}),r=He.max(He.map(n,function(s){return e.node(s).rank})),i=He.map(He.range(r+1),function(){return[]});function o(s){if(!He.has(t,s)){t[s]=!0;var u=e.node(s);i[u.rank].push(s),He.forEach(e.successors(s),o)}}var a=He.sortBy(n,function(s){return e.node(s).rank});return He.forEach(a,o),i}var it=ce,jM=FM;function FM(e,t){for(var n=0,r=1;r<t.length;++r)n+=BM(e,t[r-1],t[r]);return n}function BM(e,t,n){for(var r=it.zipObject(n,it.map(n,function(l,c){return c})),i=it.flatten(it.map(t,function(l){return it.sortBy(it.map(e.outEdges(l),function(c){return{pos:r[c.w],weight:e.edge(c).weight}}),"pos")}),!0),o=1;o<n.length;)o<<=1;var a=2*o-1;o-=1;var s=it.map(new Array(a),function(){return 0}),u=0;return it.forEach(i.forEach(function(l){var c=l.pos+o;s[c]+=l.weight;for(var f=0;c>0;)c%2&&(f+=s[c+1]),c=c-1>>1,s[c]+=l.weight;u+=l.weight*f})),u}var tv=ce,zM=HM;function HM(e,t){return tv.map(t,function(n){var r=e.inEdges(n);if(r.length){var i=tv.reduce(r,function(o,a){var s=e.edge(a),u=e.node(a.v);return{sum:o.sum+s.weight*u.order,weight:o.weight+s.weight}},{sum:0,weight:0});return{v:n,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:n}})}var ye=ce,VM=GM;function GM(e,t){var n={};ye.forEach(e,function(i,o){var a=n[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:o};ye.isUndefined(i.barycenter)||(a.barycenter=i.barycenter,a.weight=i.weight)}),ye.forEach(t.edges(),function(i){var o=n[i.v],a=n[i.w];!ye.isUndefined(o)&&!ye.isUndefined(a)&&(a.indegree++,o.out.push(n[i.w]))});var r=ye.filter(n,function(i){return!i.indegree});return UM(r)}function UM(e){var t=[];function n(o){return function(a){a.merged||(ye.isUndefined(a.barycenter)||ye.isUndefined(o.barycenter)||a.barycenter>=o.barycenter)&&KM(o,a)}}function r(o){return function(a){a.in.push(o),--a.indegree===0&&e.push(a)}}for(;e.length;){var i=e.pop();t.push(i),ye.forEach(i.in.reverse(),n(i)),ye.forEach(i.out,r(i))}return ye.map(ye.filter(t,function(o){return!o.merged}),function(o){return ye.pick(o,["vs","i","barycenter","weight"])})}function KM(e,t){var n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}var Xt=ce,YM=me,WM=XM;function XM(e,t){var n=YM.partition(e,function(c){return Xt.has(c,"barycenter")}),r=n.lhs,i=Xt.sortBy(n.rhs,function(c){return-c.i}),o=[],a=0,s=0,u=0;r.sort(ZM(!!t)),u=nv(o,i,u),Xt.forEach(r,function(c){u+=c.vs.length,o.push(c.vs),a+=c.barycenter*c.weight,s+=c.weight,u=nv(o,i,u)});var l={vs:Xt.flatten(o,!0)};return s&&(l.barycenter=a/s,l.weight=s),l}function nv(e,t,n){for(var r;t.length&&(r=Xt.last(t)).i<=n;)t.pop(),e.push(r.vs),n++;return n}function ZM(e){return function(t,n){return t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}}var at=ce,QM=zM,JM=VM,eR=WM,tR=p0;function p0(e,t,n,r){var i=e.children(t),o=e.node(t),a=o?o.borderLeft:void 0,s=o?o.borderRight:void 0,u={};a&&(i=at.filter(i,function(p){return p!==a&&p!==s}));var l=QM(e,i);at.forEach(l,function(p){if(e.children(p.v).length){var g=p0(e,p.v,n,r);u[p.v]=g,at.has(g,"barycenter")&&rR(p,g)}});var c=JM(l,n);nR(c,u);var f=eR(c,r);if(a&&(f.vs=at.flatten([a,f.vs,s],!0),e.predecessors(a).length)){var d=e.node(e.predecessors(a)[0]),h=e.node(e.predecessors(s)[0]);at.has(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+d.order+h.order)/(f.weight+2),f.weight+=2}return f}function nR(e,t){at.forEach(e,function(n){n.vs=at.flatten(n.vs.map(function(r){return t[r]?t[r].vs:r}),!0)})}function rR(e,t){at.isUndefined(e.barycenter)?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}var Zt=ce,iR=Re.Graph,oR=aR;function aR(e,t,n){var r=sR(e),i=new iR({compound:!0}).setGraph({root:r}).setDefaultNodeLabel(function(o){return e.node(o)});return Zt.forEach(e.nodes(),function(o){var a=e.node(o),s=e.parent(o);(a.rank===t||a.minRank<=t&&t<=a.maxRank)&&(i.setNode(o),i.setParent(o,s||r),Zt.forEach(e[n](o),function(u){var l=u.v===o?u.w:u.v,c=i.edge(l,o),f=Zt.isUndefined(c)?0:c.weight;i.setEdge(l,o,{weight:e.edge(u).weight+f})}),Zt.has(a,"minRank")&&i.setNode(o,{borderLeft:a.borderLeft[t],borderRight:a.borderRight[t]}))}),i}function sR(e){for(var t;e.hasNode(t=Zt.uniqueId("_root")););return t}var uR=ce,cR=lR;function lR(e,t,n){var r={},i;uR.forEach(n,function(o){for(var a=e.parent(o),s,u;a;){if(s=e.parent(a),s?(u=r[s],r[s]=a):(u=i,i=a),u&&u!==a){t.setEdge(u,a);return}a=s}})}var st=ce,fR=DM,dR=jM,hR=tR,pR=oR,gR=cR,vR=Re.Graph,rv=me,mR=yR;function yR(e){var t=rv.maxRank(e),n=iv(e,st.range(1,t+1),"inEdges"),r=iv(e,st.range(t-1,-1,-1),"outEdges"),i=fR(e);ov(e,i);for(var o=Number.POSITIVE_INFINITY,a,s=0,u=0;u<4;++s,++u){_R(s%2?n:r,s%4>=2),i=rv.buildLayerMatrix(e);var l=dR(e,i);l<o&&(u=0,a=st.cloneDeep(i),o=l)}ov(e,a)}function iv(e,t,n){return st.map(t,function(r){return pR(e,r,n)})}function _R(e,t){var n=new vR;st.forEach(e,function(r){var i=r.graph().root,o=hR(r,i,n,t);st.forEach(o.vs,function(a,s){r.node(a).order=s}),gR(r,n,o.vs)})}function ov(e,t){st.forEach(t,function(n){st.forEach(n,function(r,i){e.node(r).order=i})})}var ee=ce,bR=Re.Graph,xR=me,wR={positionX:PR};function ER(e,t){var n={};function r(i,o){var a=0,s=0,u=i.length,l=ee.last(o);return ee.forEach(o,function(c,f){var d=CR(e,c),h=d?e.node(d).order:u;(d||c===l)&&(ee.forEach(o.slice(s,f+1),function(p){ee.forEach(e.predecessors(p),function(g){var v=e.node(g),m=v.order;(m<a||h<m)&&!(v.dummy&&e.node(p).dummy)&&g0(n,g,p)})}),s=f+1,a=h)}),o}return ee.reduce(t,r),n}function SR(e,t){var n={};function r(o,a,s,u,l){var c;ee.forEach(ee.range(a,s),function(f){c=o[f],e.node(c).dummy&&ee.forEach(e.predecessors(c),function(d){var h=e.node(d);h.dummy&&(h.order<u||h.order>l)&&g0(n,d,c)})})}function i(o,a){var s=-1,u,l=0;return ee.forEach(a,function(c,f){if(e.node(c).dummy==="border"){var d=e.predecessors(c);d.length&&(u=e.node(d[0]).order,r(a,l,f,s,u),l=f,s=u)}r(a,l,a.length,u,o.length)}),a}return ee.reduce(t,i),n}function CR(e,t){if(e.node(t).dummy)return ee.find(e.predecessors(t),function(n){return e.node(n).dummy})}function g0(e,t,n){if(t>n){var r=t;t=n,n=r}var i=e[t];i||(e[t]=i={}),i[n]=!0}function NR(e,t,n){if(t>n){var r=t;t=n,n=r}return ee.has(e[t],n)}function AR(e,t,n,r){var i={},o={},a={};return ee.forEach(t,function(s){ee.forEach(s,function(u,l){i[u]=u,o[u]=u,a[u]=l})}),ee.forEach(t,function(s){var u=-1;ee.forEach(s,function(l){var c=r(l);if(c.length){c=ee.sortBy(c,function(g){return a[g]});for(var f=(c.length-1)/2,d=Math.floor(f),h=Math.ceil(f);d<=h;++d){var p=c[d];o[l]===l&&u<a[p]&&!NR(n,l,p)&&(o[p]=l,o[l]=i[l]=i[p],u=a[p])}}})}),{root:i,align:o}}function IR(e,t,n,r,i){var o={},a=MR(e,t,n,i),s=i?"borderLeft":"borderRight";function u(f,d){for(var h=a.nodes(),p=h.pop(),g={};p;)g[p]?f(p):(g[p]=!0,h.push(p),h=h.concat(d(p))),p=h.pop()}function l(f){o[f]=a.inEdges(f).reduce(function(d,h){return Math.max(d,o[h.v]+a.edge(h))},0)}function c(f){var d=a.outEdges(f).reduce(function(p,g){return Math.min(p,o[g.w]-a.edge(g))},Number.POSITIVE_INFINITY),h=e.node(f);d!==Number.POSITIVE_INFINITY&&h.borderType!==s&&(o[f]=Math.max(o[f],d))}return u(l,a.predecessors.bind(a)),u(c,a.successors.bind(a)),ee.forEach(r,function(f){o[f]=o[n[f]]}),o}function MR(e,t,n,r){var i=new bR,o=e.graph(),a=kR(o.nodesep,o.edgesep,r);return ee.forEach(t,function(s){var u;ee.forEach(s,function(l){var c=n[l];if(i.setNode(c),u){var f=n[u],d=i.edge(f,c);i.setEdge(f,c,Math.max(a(e,l,u),d||0))}u=l})}),i}function RR(e,t){return ee.minBy(ee.values(t),function(n){var r=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;return ee.forIn(n,function(o,a){var s=OR(e,a)/2;r=Math.max(o+s,r),i=Math.min(o-s,i)}),r-i})}function qR(e,t){var n=ee.values(t),r=ee.min(n),i=ee.max(n);ee.forEach(["u","d"],function(o){ee.forEach(["l","r"],function(a){var s=o+a,u=e[s],l;if(u!==t){var c=ee.values(u);l=a==="l"?r-ee.min(c):i-ee.max(c),l&&(e[s]=ee.mapValues(u,function(f){return f+l}))}})})}function TR(e,t){return ee.mapValues(e.ul,function(n,r){if(t)return e[t.toLowerCase()][r];var i=ee.sortBy(ee.map(e,r));return(i[1]+i[2])/2})}function PR(e){var t=xR.buildLayerMatrix(e),n=ee.merge(ER(e,t),SR(e,t)),r={},i;ee.forEach(["u","d"],function(a){i=a==="u"?t:ee.values(t).reverse(),ee.forEach(["l","r"],function(s){s==="r"&&(i=ee.map(i,function(f){return ee.values(f).reverse()}));var u=(a==="u"?e.predecessors:e.successors).bind(e),l=AR(e,i,n,u),c=IR(e,i,l.root,l.align,s==="r");s==="r"&&(c=ee.mapValues(c,function(f){return-f})),r[a+s]=c})});var o=RR(e,r);return qR(r,o),TR(r,e.graph().align)}function kR(e,t,n){return function(r,i,o){var a=r.node(i),s=r.node(o),u=0,l;if(u+=a.width/2,ee.has(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":l=-a.width/2;break;case"r":l=a.width/2;break}if(l&&(u+=n?l:-l),l=0,u+=(a.dummy?t:e)/2,u+=(s.dummy?t:e)/2,u+=s.width/2,ee.has(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":l=s.width/2;break;case"r":l=-s.width/2;break}return l&&(u+=n?l:-l),l=0,u}}function OR(e,t){return e.node(t).width}var Qt=ce,v0=me,LR=wR.positionX,DR=$R;function $R(e){e=v0.asNonCompoundGraph(e),jR(e),Qt.forEach(LR(e),function(t,n){e.node(n).x=t})}function jR(e){var t=v0.buildLayerMatrix(e),n=e.graph().ranksep,r=0;Qt.forEach(t,function(i){var o=Qt.max(Qt.map(i,function(a){return e.node(a).height}));Qt.forEach(i,function(a){e.node(a).y=r+o/2}),r+=o+n})}var ne=ce,av=MI,sv=UI,FR=vM,BR=me.normalizeRanks,zR=bM,HR=me.removeEmptyRanks,uv=SM,VR=RM,cv=TM,GR=mR,UR=DR,ut=me,KR=Re.Graph,YR=WR;function WR(e,t){var n=t&&t.debugTiming?ut.time:ut.notime;n("layout",function(){var r=n(" buildLayoutGraph",function(){return aq(e)});n(" runLayout",function(){XR(r,n)}),n(" updateInputGraph",function(){ZR(e,r)})})}function XR(e,t){t(" makeSpaceForEdgeLabels",function(){sq(e)}),t(" removeSelfEdges",function(){vq(e)}),t(" acyclic",function(){av.run(e)}),t(" nestingGraph.run",function(){uv.run(e)}),t(" rank",function(){FR(ut.asNonCompoundGraph(e))}),t(" injectEdgeLabelProxies",function(){uq(e)}),t(" removeEmptyRanks",function(){HR(e)}),t(" nestingGraph.cleanup",function(){uv.cleanup(e)}),t(" normalizeRanks",function(){BR(e)}),t(" assignRankMinMax",function(){cq(e)}),t(" removeEdgeLabelProxies",function(){lq(e)}),t(" normalize.run",function(){sv.run(e)}),t(" parentDummyChains",function(){zR(e)}),t(" addBorderSegments",function(){VR(e)}),t(" order",function(){GR(e)}),t(" insertSelfEdges",function(){mq(e)}),t(" adjustCoordinateSystem",function(){cv.adjust(e)}),t(" position",function(){UR(e)}),t(" positionSelfEdges",function(){yq(e)}),t(" removeBorderNodes",function(){gq(e)}),t(" normalize.undo",function(){sv.undo(e)}),t(" fixupEdgeLabelCoords",function(){hq(e)}),t(" undoCoordinateSystem",function(){cv.undo(e)}),t(" translateGraph",function(){fq(e)}),t(" assignNodeIntersects",function(){dq(e)}),t(" reversePoints",function(){pq(e)}),t(" acyclic.undo",function(){av.undo(e)})}function ZR(e,t){ne.forEach(e.nodes(),function(n){var r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,t.children(n).length&&(r.width=i.width,r.height=i.height))}),ne.forEach(e.edges(),function(n){var r=e.edge(n),i=t.edge(n);r.points=i.points,ne.has(i,"x")&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var QR=["nodesep","edgesep","ranksep","marginx","marginy"],JR={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},eq=["acyclicer","ranker","rankdir","align"],tq=["width","height"],nq={width:0,height:0},rq=["minlen","weight","width","height","labeloffset"],iq={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},oq=["labelpos"];function aq(e){var t=new KR({multigraph:!0,compound:!0}),n=Hu(e.graph());return t.setGraph(ne.merge({},JR,zu(n,QR),ne.pick(n,eq))),ne.forEach(e.nodes(),function(r){var i=Hu(e.node(r));t.setNode(r,ne.defaults(zu(i,tq),nq)),t.setParent(r,e.parent(r))}),ne.forEach(e.edges(),function(r){var i=Hu(e.edge(r));t.setEdge(r,ne.merge({},iq,zu(i,rq),ne.pick(i,oq)))}),t}function sq(e){var t=e.graph();t.ranksep/=2,ne.forEach(e.edges(),function(n){var r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function uq(e){ne.forEach(e.edges(),function(t){var n=e.edge(t);if(n.width&&n.height){var r=e.node(t.v),i=e.node(t.w),o={rank:(i.rank-r.rank)/2+r.rank,e:t};ut.addDummyNode(e,"edge-proxy",o,"_ep")}})}function cq(e){var t=0;ne.forEach(e.nodes(),function(n){var r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=ne.max(t,r.maxRank))}),e.graph().maxRank=t}function lq(e){ne.forEach(e.nodes(),function(t){var n=e.node(t);n.dummy==="edge-proxy"&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}function fq(e){var t=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,i=0,o=e.graph(),a=o.marginx||0,s=o.marginy||0;function u(l){var c=l.x,f=l.y,d=l.width,h=l.height;t=Math.min(t,c-d/2),n=Math.max(n,c+d/2),r=Math.min(r,f-h/2),i=Math.max(i,f+h/2)}ne.forEach(e.nodes(),function(l){u(e.node(l))}),ne.forEach(e.edges(),function(l){var c=e.edge(l);ne.has(c,"x")&&u(c)}),t-=a,r-=s,ne.forEach(e.nodes(),function(l){var c=e.node(l);c.x-=t,c.y-=r}),ne.forEach(e.edges(),function(l){var c=e.edge(l);ne.forEach(c.points,function(f){f.x-=t,f.y-=r}),ne.has(c,"x")&&(c.x-=t),ne.has(c,"y")&&(c.y-=r)}),o.width=n-t+a,o.height=i-r+s}function dq(e){ne.forEach(e.edges(),function(t){var n=e.edge(t),r=e.node(t.v),i=e.node(t.w),o,a;n.points?(o=n.points[0],a=n.points[n.points.length-1]):(n.points=[],o=i,a=r),n.points.unshift(ut.intersectRect(r,o)),n.points.push(ut.intersectRect(i,a))})}function hq(e){ne.forEach(e.edges(),function(t){var n=e.edge(t);if(ne.has(n,"x"))switch((n.labelpos==="l"||n.labelpos==="r")&&(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}})}function pq(e){ne.forEach(e.edges(),function(t){var n=e.edge(t);n.reversed&&n.points.reverse()})}function gq(e){ne.forEach(e.nodes(),function(t){if(e.children(t).length){var n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),o=e.node(ne.last(n.borderLeft)),a=e.node(ne.last(n.borderRight));n.width=Math.abs(a.x-o.x),n.height=Math.abs(i.y-r.y),n.x=o.x+n.width/2,n.y=r.y+n.height/2}}),ne.forEach(e.nodes(),function(t){e.node(t).dummy==="border"&&e.removeNode(t)})}function vq(e){ne.forEach(e.edges(),function(t){if(t.v===t.w){var n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function mq(e){var t=ut.buildLayerMatrix(e);ne.forEach(t,function(n){var r=0;ne.forEach(n,function(i,o){var a=e.node(i);a.order=o+r,ne.forEach(a.selfEdges,function(s){ut.addDummyNode(e,"selfedge",{width:s.label.width,height:s.label.height,rank:a.rank,order:o+ ++r,e:s.e,label:s.label},"_se")}),delete a.selfEdges})})}function yq(e){ne.forEach(e.nodes(),function(t){var n=e.node(t);if(n.dummy==="selfedge"){var r=e.node(n.e.v),i=r.x+r.width/2,o=r.y,a=n.x-i,s=r.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:i+2*a/3,y:o-s},{x:i+5*a/6,y:o-s},{x:i+a,y:o},{x:i+5*a/6,y:o+s},{x:i+2*a/3,y:o+s}],n.label.x=n.x,n.label.y=n.y}})}function zu(e,t){return ne.mapValues(ne.pick(e,t),Number)}function Hu(e){var t={};return ne.forEach(e,function(n,r){t[r.toLowerCase()]=n}),t}var Dn=ce,_q=me,bq=Re.Graph,xq={debugOrdering:wq};function wq(e){var t=_q.buildLayerMatrix(e),n=new bq({compound:!0,multigraph:!0}).setGraph({});return Dn.forEach(e.nodes(),function(r){n.setNode(r,{label:r}),n.setParent(r,"layer"+e.node(r).rank)}),Dn.forEach(e.edges(),function(r){n.setEdge(r.v,r.w,{},r.name)}),Dn.forEach(t,function(r,i){var o="layer"+i;n.setNode(o,{rank:"same"}),Dn.reduce(r,function(a,s){return n.setEdge(a,s,{style:"invis"}),s})}),n}var Eq="0.8.5",Sq={graphlib:Re,layout:YR,debug:xq,util:{time:me.time,notime:me.notime},version:Eq};const lv=_m(Sq);function Cq({data:e,selected:t}){const{accountType:n}=e,r=n.seeds.length;return S.jsxs("div",{className:`
40
+ pda-explorer-node
41
+ px-4 py-3 rounded-lg border-2 min-w-[160px]
42
+ transition-all duration-200 cursor-pointer
43
+ ${t?"ring-2 ring-white ring-offset-2 ring-offset-gray-900":""}
44
+ `,style:{backgroundColor:`${n.color}20`,borderColor:n.color},children:[S.jsx(Dt,{type:"target",position:V.Top,className:"!bg-gray-400 !w-3 !h-3 !border-2 !border-gray-700"}),S.jsx("div",{className:"font-semibold text-white text-sm text-center",children:n.name}),S.jsx("div",{className:"flex justify-center mt-2",children:S.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full",style:{backgroundColor:n.color,color:"white"},children:[r," seed",r!==1?"s":""]})}),n.children.length>0&&S.jsx(Dt,{type:"source",position:V.Bottom,className:"!bg-gray-400 !w-3 !h-3 !border-2 !border-gray-700"})]})}const m0=O.memo(Cq),Nq={account:m0},Aq={rankdir:"TB",nodesep:60,ranksep:80,marginx:20,marginy:20},fv=180,dv=80;function Iq(e,t){const n=new lv.graphlib.Graph;return n.setDefaultEdgeLabel(()=>({})),n.setGraph(Aq),e.forEach(i=>{n.setNode(i.id,{width:fv,height:dv})}),t.forEach(i=>{n.setEdge(i.source,i.target)}),lv.layout(n),{nodes:e.map(i=>{const o=n.node(i.id);return{...i,position:{x:o.x-fv/2,y:o.y-dv/2}}}),edges:t}}function Mq(e){const t=[],n=[];return Object.values(e.accounts).forEach(r=>{t.push({id:r.id,type:"account",position:{x:0,y:0},data:{accountType:r,label:r.name}})}),Object.values(e.accounts).forEach(r=>{r.children.forEach(i=>{n.push({id:`${r.id}-${i}`,source:r.id,target:i,type:"smoothstep",animated:!1,style:{stroke:"#6B7280",strokeWidth:2},data:{relationship:"parent-child"}})})}),Iq(t,n)}function y0({schema:e,onNodeSelect:t,selectedNodeId:n,edgeColor:r="#6B7280",showMinimap:i=!0,showControls:o=!0}){const a=O.useMemo(()=>Mq(e),[e]),[s,,u]=JS(a.nodes),[l,,c]=eC(a.edges),f=O.useCallback((g,v)=>{t(v.id)},[t]),d=O.useCallback(()=>{t(null)},[t]),h=O.useMemo(()=>s.map(g=>({...g,selected:g.id===n})),[s,n]),p=O.useMemo(()=>l.map(g=>({...g,style:{...g.style,stroke:r}})),[l,r]);return S.jsx("div",{className:"pda-explorer-graph w-full h-full",children:S.jsxs(QS,{nodes:h,edges:p,onNodesChange:u,onEdgesChange:c,onNodeClick:f,onPaneClick:d,nodeTypes:Nq,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:1.5,defaultViewport:{x:0,y:0,zoom:.8},proOptions:{hideAttribution:!0},children:[S.jsx(oC,{variant:Ke.Dots,gap:20,size:1,color:"#374151"}),o&&S.jsx(dC,{className:"!bg-gray-800 !border-gray-700 !rounded-lg",showInteractive:!1}),i&&S.jsx(CC,{className:"!bg-gray-800 !border-gray-700 !rounded-lg",nodeColor:g=>g.data.accountType.color,maskColor:"rgba(0, 0, 0, 0.7)"})]})})}function Rq(e){return Object.values(e.accounts).filter(t=>t.parent===null)}function _0(e,t){const n=e.accounts[t];return n?n.children.map(r=>e.accounts[r]).filter(r=>r!==void 0):[]}function b0(e,t){const n=e.accounts[t];return!n||!n.parent?null:e.accounts[n.parent]||null}function x0(e){return`[${e.seeds.map(n=>n.type==="literal"?`"${n.value}"`:n.type==="pubkey"?n.name:`${n.name}_le`).join(", ")}]`}function qq(e){const t=[],n=new Set(Object.keys(e.accounts));return Object.values(e.accounts).forEach(r=>{r.parent&&!n.has(r.parent)&&t.push(`Account "${r.id}" references non-existent parent "${r.parent}"`),r.children.forEach(i=>{n.has(i)||t.push(`Account "${r.id}" references non-existent child "${i}"`)}),r.seeds.length===0&&t.push(`Account "${r.id}" has no seeds defined`),r.seeds.forEach((i,o)=>{i.type==="literal"&&!i.value&&t.push(`Account "${r.id}" seed ${o} is literal but has no value`)})}),t}const w0={literal:"text-blue-400 bg-blue-900/50",pubkey:"text-purple-400 bg-purple-900/50",u8:"text-green-400 bg-green-900/50",u16:"text-green-400 bg-green-900/50",u32:"text-green-400 bg-green-900/50",u64:"text-green-400 bg-green-900/50"},E0={literal:"string",pubkey:"Pubkey",u8:"u8 (little-endian)",u16:"u16 (little-endian)",u32:"u32 (little-endian)",u64:"u64 (little-endian)"};function S0({schema:e,account:t}){if(!t)return S.jsx("div",{className:"pda-explorer-panel h-full flex items-center justify-center text-gray-500",children:S.jsxs("div",{className:"text-center",children:[S.jsx("svg",{className:"w-12 h-12 mx-auto mb-3 text-gray-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M15 15l-2 5L9 9l11 4-5 2zm0 0l5 5M7.188 2.239l.777 2.897M5.136 7.965l-2.898-.777M13.95 4.05l-2.122 2.122m-5.657 5.656l-2.12 2.122"})}),S.jsx("p",{className:"text-sm",children:"Click on an account to see its seed pattern"})]})});const n=b0(e,t.id),r=_0(e,t.id);return S.jsxs("div",{className:"pda-explorer-panel h-full overflow-y-auto p-4 space-y-6",children:[S.jsxs("div",{children:[S.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[S.jsx("div",{className:"w-4 h-4 rounded",style:{backgroundColor:t.color}}),S.jsx("h2",{className:"text-xl font-bold text-white",children:t.name})]}),S.jsx("p",{className:"text-gray-400 text-sm",children:t.description})]}),S.jsxs("div",{children:[S.jsx("h3",{className:"text-sm font-semibold text-gray-300 mb-2 uppercase tracking-wide",children:"Seed Pattern"}),S.jsx("div",{className:"bg-gray-800 rounded-lg p-3 font-mono text-sm",children:S.jsx("code",{className:"text-green-400",children:x0(t)})})]}),S.jsxs("div",{children:[S.jsx("h3",{className:"text-sm font-semibold text-gray-300 mb-3 uppercase tracking-wide",children:"Seed Components"}),S.jsx("div",{className:"space-y-3",children:t.seeds.map((i,o)=>S.jsxs("div",{className:"bg-gray-800 rounded-lg p-3",children:[S.jsxs("div",{className:"flex items-center justify-between mb-2",children:[S.jsx("span",{className:"font-mono text-white",children:i.name}),S.jsx("span",{className:`text-xs px-2 py-0.5 rounded ${w0[i.type]}`,children:E0[i.type]})]}),i.type==="literal"&&S.jsxs("div",{className:"text-sm text-gray-400",children:["Value:"," ",S.jsxs("code",{className:"text-blue-400 bg-blue-900/30 px-1 rounded",children:['"',i.value,'"']})]}),i.source&&i.type!=="literal"&&S.jsxs("div",{className:"text-sm text-gray-400",children:["Source: ",S.jsx("span",{className:"text-gray-300",children:i.source})]})]},o))})]}),t.deriveFunctionName&&S.jsxs("div",{children:[S.jsx("h3",{className:"text-sm font-semibold text-gray-300 mb-2 uppercase tracking-wide",children:"Derive Function"}),S.jsx("div",{className:"bg-gray-800 rounded-lg p-3",children:S.jsxs("code",{className:"text-purple-400 font-mono text-sm",children:[t.deriveFunctionName,"()"]})})]}),S.jsxs("div",{children:[S.jsx("h3",{className:"text-sm font-semibold text-gray-300 mb-3 uppercase tracking-wide",children:"Relationships"}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[S.jsx("span",{className:"text-gray-500 w-16",children:"Parent:"}),n?S.jsx("span",{className:"px-2 py-0.5 rounded text-white",style:{backgroundColor:`${n.color}40`},children:n.name}):S.jsx("span",{className:"text-gray-600 italic",children:"None (root account)"})]}),S.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[S.jsx("span",{className:"text-gray-500 w-16 pt-0.5",children:"Children:"}),r.length>0?S.jsx("div",{className:"flex flex-wrap gap-1",children:r.map(i=>S.jsx("span",{className:"px-2 py-0.5 rounded text-white",style:{backgroundColor:`${i.color}40`},children:i.name},i.id))}):S.jsx("span",{className:"text-gray-600 italic",children:"None (leaf account)"})]})]})]}),S.jsxs("div",{className:"bg-gray-800/50 rounded-lg p-4 border border-gray-700",children:[S.jsx("h4",{className:"text-sm font-semibold text-gray-300 mb-2",children:"How PDA Derivation Works"}),S.jsxs("p",{className:"text-xs text-gray-400 leading-relaxed",children:["Program Derived Addresses (PDAs) are deterministic. Given the same seeds and program ID, ",S.jsx("code",{className:"text-gray-300",children:"findProgramAddressSync"})," ",'always produces the same address. This enables "discovery" of accounts without storing references—you compute the address from known data.']})]})]})}function Tq({schema:e,title:t,description:n,showLegend:r=!0,showPanel:i=!0,panelWidth:o=320,className:a="",height:s=600}){const[u,l]=O.useState(null),c=O.useCallback(g=>{l(g)},[]),f=u?e.accounts[u]:null,d=t??`${e.programName} PDA Explorer`,h=n??e.description??"Interactive visualization of Program Derived Address (PDA) account hierarchy.",p=typeof o=="number"?`${o}px`:o;return S.jsxs("div",{className:`pda-explorer flex flex-col ${a}`,style:{height:typeof s=="number"?`${s}px`:s},children:[S.jsxs("div",{className:"pda-explorer-header mb-4",children:[S.jsx("h1",{className:"text-2xl font-bold text-white mb-2",children:d}),S.jsx("p",{className:"text-gray-400 text-sm",children:h}),e.programId&&S.jsxs("p",{className:"text-gray-500 text-xs mt-1 font-mono",children:["Program: ",e.programId]})]}),r&&S.jsx("div",{className:"pda-explorer-legend flex flex-wrap gap-2 mb-4",children:Object.values(e.accounts).map(g=>S.jsxs("button",{onClick:()=>c(g.id),className:`
45
+ flex items-center gap-1.5 px-2 py-1 rounded text-xs
46
+ transition-all duration-150
47
+ ${u===g.id?"ring-2 ring-white ring-offset-1 ring-offset-gray-900":"hover:bg-gray-800"}
48
+ `,style:{backgroundColor:u===g.id?`${g.color}40`:`${g.color}20`},children:[S.jsx("div",{className:"w-2 h-2 rounded-sm",style:{backgroundColor:g.color}}),S.jsx("span",{className:"text-gray-300",children:g.name})]},g.id))}),S.jsxs("div",{className:"pda-explorer-content flex-1 flex gap-4 min-h-0",children:[S.jsx("div",{className:"flex-1 bg-gray-800/50 rounded-lg border border-gray-700 overflow-hidden",children:S.jsx(y0,{schema:e,onNodeSelect:c,selectedNodeId:u})}),i&&S.jsx("div",{className:"bg-gray-800/50 rounded-lg border border-gray-700 overflow-hidden",style:{width:p,flexShrink:0},children:S.jsx(S0,{schema:e,account:f})})]}),S.jsx("div",{className:"pda-explorer-footer mt-4 text-xs text-gray-500",children:S.jsxs("span",{className:"inline-flex items-center gap-1",children:[S.jsx("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:S.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})}),"Pan: click + drag | Zoom: scroll | Select: click node"]})})]})}exports.AccountNode=m0;exports.PdaExplorer=Tq;exports.PdaGraph=y0;exports.SEED_TYPE_COLORS=w0;exports.SEED_TYPE_LABELS=E0;exports.SeedPanel=S0;exports.formatSeedPattern=x0;exports.getChildren=_0;exports.getParent=b0;exports.getRootAccounts=Rq;exports.validateSchema=qq;