autoforge-ai 0.1.16 → 0.1.18

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.
@@ -0,0 +1,7 @@
1
+ import{a as yv,g as n_,b as r_,r as $,j as F,c as on}from"./vendor-query-CcgjkJlA.js";import"./vendor-radix-DIVIznMB.js";function ue(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=ue(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var i_={value:()=>{}};function Pn(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new gn(n)}function gn(e){this._=e}function o_(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}gn.prototype=Pn.prototype={constructor:gn,on:function(e,t){var n=this._,r=o_(e+"",n),i,o=-1,a=r.length;if(arguments.length<2){for(;++o<a;)if((i=(e=r[o]).type)&&(i=a_(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<a;)if(i=(e=r[o]).type)n[i]=Gc(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Gc(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new gn(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,o;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,o=r.length;i<o;++i)r[i].value.apply(t,n)}};function a_(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function Gc(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=i_,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Hu="http://www.w3.org/1999/xhtml";const Uc={svg:"http://www.w3.org/2000/svg",xhtml:Hu,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function kn(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Uc.hasOwnProperty(t)?{space:Uc[t],local:e}:e}function s_(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Hu&&t.documentElement.namespaceURI===Hu?t.createElement(e):t.createElementNS(n,e)}}function u_(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function _v(e){var t=kn(e);return(t.local?u_:s_)(t)}function c_(){}function tc(e){return e==null?c_:function(){return this.querySelector(e)}}function l_(e){typeof e!="function"&&(e=tc(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],a=o.length,s=r[i]=new Array(a),c,u,l=0;l<a;++l)(c=o[l])&&(u=e.call(c,c.__data__,l,o))&&("__data__"in c&&(u.__data__=c.__data__),s[l]=u);return new ve(r,this._parents)}function f_(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function d_(){return[]}function bv(e){return e==null?d_:function(){return this.querySelectorAll(e)}}function h_(e){return function(){return f_(e.apply(this,arguments))}}function p_(e){typeof e=="function"?e=h_(e):e=bv(e);for(var t=this._groups,n=t.length,r=[],i=[],o=0;o<n;++o)for(var a=t[o],s=a.length,c,u=0;u<s;++u)(c=a[u])&&(r.push(e.call(c,c.__data__,u,a)),i.push(c));return new ve(r,i)}function wv(e){return function(){return this.matches(e)}}function xv(e){return function(t){return t.matches(e)}}var g_=Array.prototype.find;function v_(e){return function(){return g_.call(this.children,e)}}function m_(){return this.firstElementChild}function y_(e){return this.select(e==null?m_:v_(typeof e=="function"?e:xv(e)))}var __=Array.prototype.filter;function b_(){return Array.from(this.children)}function w_(e){return function(){return __.call(this.children,e)}}function x_(e){return this.selectAll(e==null?b_:w_(typeof e=="function"?e:xv(e)))}function E_(e){typeof e!="function"&&(e=wv(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],a=o.length,s=r[i]=[],c,u=0;u<a;++u)(c=o[u])&&e.call(c,c.__data__,u,o)&&s.push(c);return new ve(r,this._parents)}function Ev(e){return new Array(e.length)}function S_(){return new ve(this._enter||this._groups.map(Ev),this._parents)}function bn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}bn.prototype={constructor:bn,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function C_(e){return function(){return e}}function q_(e,t,n,r,i,o){for(var a=0,s,c=t.length,u=o.length;a<u;++a)(s=t[a])?(s.__data__=o[a],r[a]=s):n[a]=new bn(e,o[a]);for(;a<c;++a)(s=t[a])&&(i[a]=s)}function R_(e,t,n,r,i,o,a){var s,c,u=new Map,l=t.length,f=o.length,d=new Array(l),h;for(s=0;s<l;++s)(c=t[s])&&(d[s]=h=a.call(c,c.__data__,s,t)+"",u.has(h)?i[s]=c:u.set(h,c));for(s=0;s<f;++s)h=a.call(e,o[s],s,o)+"",(c=u.get(h))?(r[s]=c,c.__data__=o[s],u.delete(h)):n[s]=new bn(e,o[s]);for(s=0;s<l;++s)(c=t[s])&&u.get(d[s])===c&&(i[s]=c)}function I_(e){return e.__data__}function N_(e,t){if(!arguments.length)return Array.from(this,I_);var n=t?R_:q_,r=this._parents,i=this._groups;typeof e!="function"&&(e=C_(e));for(var o=i.length,a=new Array(o),s=new Array(o),c=new Array(o),u=0;u<o;++u){var l=r[u],f=i[u],d=f.length,h=A_(e.call(l,l&&l.__data__,u,r)),g=h.length,m=s[u]=new Array(g),v=a[u]=new Array(g),y=c[u]=new Array(d);n(l,f,m,v,y,h,t);for(var b=0,p=0,_,x;b<g;++b)if(_=m[b]){for(b>=p&&(p=b+1);!(x=v[p])&&++p<g;);_._next=x||null}}return a=new ve(a,r),a._enter=s,a._exit=c,a}function A_(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function M_(){return new ve(this._exit||this._groups.map(Ev),this._parents)}function T_(e,t,n){var r=this.enter(),i=this,o=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?o.remove():n(o),r&&i?r.merge(i).order():i}function P_(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,o=r.length,a=Math.min(i,o),s=new Array(i),c=0;c<a;++c)for(var u=n[c],l=r[c],f=u.length,d=s[c]=new Array(f),h,g=0;g<f;++g)(h=u[g]||l[g])&&(d[g]=h);for(;c<i;++c)s[c]=n[c];return new ve(s,this._parents)}function k_(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,o=r[i],a;--i>=0;)(a=r[i])&&(o&&a.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(a,o),o=a);return this}function O_(e){e||(e=L_);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var a=n[o],s=a.length,c=i[o]=new Array(s),u,l=0;l<s;++l)(u=a[l])&&(c[l]=u);c.sort(t)}return new ve(i,this._parents).order()}function L_(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function D_(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function F_(){return Array.from(this)}function z_(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null}function $_(){let e=0;for(const t of this)++e;return e}function H_(){return!this.node()}function B_(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],o=0,a=i.length,s;o<a;++o)(s=i[o])&&e.call(s,s.__data__,o,i);return this}function j_(e){return function(){this.removeAttribute(e)}}function V_(e){return function(){this.removeAttributeNS(e.space,e.local)}}function G_(e,t){return function(){this.setAttribute(e,t)}}function U_(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Y_(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function W_(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function X_(e,t){var n=kn(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?V_:j_:typeof t=="function"?n.local?W_:Y_:n.local?U_:G_)(n,t))}function Sv(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function K_(e){return function(){this.style.removeProperty(e)}}function Z_(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Q_(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function J_(e,t,n){return arguments.length>1?this.each((t==null?K_:typeof t=="function"?Q_:Z_)(e,t,n??"")):gt(this.node(),e)}function gt(e,t){return e.style.getPropertyValue(t)||Sv(e).getComputedStyle(e,null).getPropertyValue(t)}function eb(e){return function(){delete this[e]}}function tb(e,t){return function(){this[e]=t}}function nb(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function rb(e,t){return arguments.length>1?this.each((t==null?eb:typeof t=="function"?nb:tb)(e,t)):this.node()[e]}function Cv(e){return e.trim().split(/^|\s+/)}function nc(e){return e.classList||new qv(e)}function qv(e){this._node=e,this._names=Cv(e.getAttribute("class")||"")}qv.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Rv(e,t){for(var n=nc(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function Iv(e,t){for(var n=nc(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function ib(e){return function(){Rv(this,e)}}function ob(e){return function(){Iv(this,e)}}function ab(e,t){return function(){(t.apply(this,arguments)?Rv:Iv)(this,e)}}function sb(e,t){var n=Cv(e+"");if(arguments.length<2){for(var r=nc(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?ab:t?ib:ob)(n,t))}function ub(){this.textContent=""}function cb(e){return function(){this.textContent=e}}function lb(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function fb(e){return arguments.length?this.each(e==null?ub:(typeof e=="function"?lb:cb)(e)):this.node().textContent}function db(){this.innerHTML=""}function hb(e){return function(){this.innerHTML=e}}function pb(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function gb(e){return arguments.length?this.each(e==null?db:(typeof e=="function"?pb:hb)(e)):this.node().innerHTML}function vb(){this.nextSibling&&this.parentNode.appendChild(this)}function mb(){return this.each(vb)}function yb(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function _b(){return this.each(yb)}function bb(e){var t=typeof e=="function"?e:_v(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function wb(){return null}function xb(e,t){var n=typeof e=="function"?e:_v(e),r=t==null?wb:typeof t=="function"?t:tc(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Eb(){var e=this.parentNode;e&&e.removeChild(this)}function Sb(){return this.each(Eb)}function Cb(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function qb(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Rb(e){return this.select(e?qb:Cb)}function Ib(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Nb(e){return function(t){e.call(this,t,this.__data__)}}function Ab(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function Mb(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,o;n<i;++n)o=t[n],(!e.type||o.type===e.type)&&o.name===e.name?this.removeEventListener(o.type,o.listener,o.options):t[++r]=o;++r?t.length=r:delete this.__on}}}function Tb(e,t,n){return function(){var r=this.__on,i,o=Nb(t);if(r){for(var a=0,s=r.length;a<s;++a)if((i=r[a]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=o,i.options=n),i.value=t;return}}this.addEventListener(e.type,o,n),i={type:e.type,name:e.name,value:t,listener:o,options:n},r?r.push(i):this.__on=[i]}}function Pb(e,t,n){var r=Ab(e+""),i,o=r.length,a;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,u=s.length,l;c<u;++c)for(i=0,l=s[c];i<o;++i)if((a=r[i]).type===l.type&&a.name===l.name)return l.value}return}for(s=t?Tb:Mb,i=0;i<o;++i)this.each(s(r[i],t,n));return this}function Nv(e,t,n){var r=Sv(e),i=r.CustomEvent;typeof i=="function"?i=new i(t,n):(i=r.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function kb(e,t){return function(){return Nv(this,e,t)}}function Ob(e,t){return function(){return Nv(this,e,t.apply(this,arguments))}}function Lb(e,t){return this.each((typeof t=="function"?Ob:kb)(e,t))}function*Db(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,o=r.length,a;i<o;++i)(a=r[i])&&(yield a)}var Av=[null];function ve(e,t){this._groups=e,this._parents=t}function Gt(){return new ve([[document.documentElement]],Av)}function Fb(){return this}ve.prototype=Gt.prototype={constructor:ve,select:l_,selectAll:p_,selectChild:y_,selectChildren:x_,filter:E_,data:N_,enter:S_,exit:M_,join:T_,merge:P_,selection:Fb,order:k_,sort:O_,call:D_,nodes:F_,node:z_,size:$_,empty:H_,each:B_,attr:X_,style:J_,property:rb,classed:sb,text:fb,html:gb,raise:mb,lower:_b,append:bb,insert:xb,remove:Sb,clone:Rb,datum:Ib,on:Pb,dispatch:Lb,[Symbol.iterator]:Db};function ge(e){return typeof e=="string"?new ve([[document.querySelector(e)]],[document.documentElement]):new ve([[e]],Av)}function zb(e){let t;for(;t=e.sourceEvent;)e=t;return e}function _e(e,t){if(e=zb(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}const $b={passive:!1},Lt={capture:!0,passive:!1};function lr(e){e.stopImmediatePropagation()}function ht(e){e.preventDefault(),e.stopImmediatePropagation()}function Mv(e){var t=e.document.documentElement,n=ge(e).on("dragstart.drag",ht,Lt);"onselectstart"in t?n.on("selectstart.drag",ht,Lt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Tv(e,t){var n=e.document.documentElement,r=ge(e).on("dragstart.drag",null);t&&(r.on("click.drag",ht,Lt),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const an=e=>()=>e;function Bu(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:o,x:a,y:s,dx:c,dy:u,dispatch:l}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:l}})}Bu.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Hb(e){return!e.ctrlKey&&!e.button}function Bb(){return this.parentNode}function jb(e,t){return t??{x:e.x,y:e.y}}function Vb(){return navigator.maxTouchPoints||"ontouchstart"in this}function Pv(){var e=Hb,t=Bb,n=jb,r=Vb,i={},o=Pn("start","drag","end"),a=0,s,c,u,l,f=0;function d(_){_.on("mousedown.drag",h).filter(r).on("touchstart.drag",v).on("touchmove.drag",y,$b).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(_,x){if(!(l||!e.call(this,_,x))){var w=p(this,t.call(this,_,x),_,x,"mouse");w&&(ge(_.view).on("mousemove.drag",g,Lt).on("mouseup.drag",m,Lt),Mv(_.view),lr(_),u=!1,s=_.clientX,c=_.clientY,w("start",_))}}function g(_){if(ht(_),!u){var x=_.clientX-s,w=_.clientY-c;u=x*x+w*w>f}i.mouse("drag",_)}function m(_){ge(_.view).on("mousemove.drag mouseup.drag",null),Tv(_.view,u),ht(_),i.mouse("end",_)}function v(_,x){if(e.call(this,_,x)){var w=_.changedTouches,E=t.call(this,_,x),R=w.length,C,T;for(C=0;C<R;++C)(T=p(this,E,_,x,w[C].identifier,w[C]))&&(lr(_),T("start",_,w[C]))}}function y(_){var x=_.changedTouches,w=x.length,E,R;for(E=0;E<w;++E)(R=i[x[E].identifier])&&(ht(_),R("drag",_,x[E]))}function b(_){var x=_.changedTouches,w=x.length,E,R;for(l&&clearTimeout(l),l=setTimeout(function(){l=null},500),E=0;E<w;++E)(R=i[x[E].identifier])&&(lr(_),R("end",_,x[E]))}function p(_,x,w,E,R,C){var T=o.copy(),q=_e(C||w,x),M,k,S;if((S=n.call(_,new Bu("beforestart",{sourceEvent:w,target:d,identifier:R,active:a,x:q[0],y:q[1],dx:0,dy:0,dispatch:T}),E))!=null)return M=S.x-q[0]||0,k=S.y-q[1]||0,function A(N,L,P){var D=q,j;switch(N){case"start":i[R]=A,j=a++;break;case"end":delete i[R],--a;case"drag":q=_e(P||L,x),j=a;break}T.call(N,_,new Bu(N,{sourceEvent:L,subject:S,target:d,identifier:R,active:j,x:q[0]+M,y:q[1]+k,dx:q[0]-D[0],dy:q[1]-D[1],dispatch:T}),E)}}return d.filter=function(_){return arguments.length?(e=typeof _=="function"?_:an(!!_),d):e},d.container=function(_){return arguments.length?(t=typeof _=="function"?_:an(_),d):t},d.subject=function(_){return arguments.length?(n=typeof _=="function"?_:an(_),d):n},d.touchable=function(_){return arguments.length?(r=typeof _=="function"?_:an(!!_),d):r},d.on=function(){var _=o.on.apply(o,arguments);return _===o?d:_},d.clickDistance=function(_){return arguments.length?(f=(_=+_)*_,d):Math.sqrt(f)},d}function rc(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function kv(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Ut(){}var Dt=.7,wn=1/Dt,pt="\\s*([+-]?\\d+)\\s*",Ft="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ne="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Gb=/^#([0-9a-f]{3,8})$/,Ub=new RegExp(`^rgb\\(${pt},${pt},${pt}\\)$`),Yb=new RegExp(`^rgb\\(${Ne},${Ne},${Ne}\\)$`),Wb=new RegExp(`^rgba\\(${pt},${pt},${pt},${Ft}\\)$`),Xb=new RegExp(`^rgba\\(${Ne},${Ne},${Ne},${Ft}\\)$`),Kb=new RegExp(`^hsl\\(${Ft},${Ne},${Ne}\\)$`),Zb=new RegExp(`^hsla\\(${Ft},${Ne},${Ne},${Ft}\\)$`),Yc={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};rc(Ut,tt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Wc,formatHex:Wc,formatHex8:Qb,formatHsl:Jb,formatRgb:Xc,toString:Xc});function Wc(){return this.rgb().formatHex()}function Qb(){return this.rgb().formatHex8()}function Jb(){return Ov(this).formatHsl()}function Xc(){return this.rgb().formatRgb()}function tt(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Gb.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Kc(t):n===3?new he(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?sn(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?sn(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Ub.exec(e))?new he(t[1],t[2],t[3],1):(t=Yb.exec(e))?new he(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Wb.exec(e))?sn(t[1],t[2],t[3],t[4]):(t=Xb.exec(e))?sn(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Kb.exec(e))?Jc(t[1],t[2]/100,t[3]/100,1):(t=Zb.exec(e))?Jc(t[1],t[2]/100,t[3]/100,t[4]):Yc.hasOwnProperty(e)?Kc(Yc[e]):e==="transparent"?new he(NaN,NaN,NaN,0):null}function Kc(e){return new he(e>>16&255,e>>8&255,e&255,1)}function sn(e,t,n,r){return r<=0&&(e=t=n=NaN),new he(e,t,n,r)}function ew(e){return e instanceof Ut||(e=tt(e)),e?(e=e.rgb(),new he(e.r,e.g,e.b,e.opacity)):new he}function ju(e,t,n,r){return arguments.length===1?ew(e):new he(e,t,n,r??1)}function he(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}rc(he,ju,kv(Ut,{brighter(e){return e=e==null?wn:Math.pow(wn,e),new he(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Dt:Math.pow(Dt,e),new he(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new he(Je(this.r),Je(this.g),Je(this.b),xn(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Zc,formatHex:Zc,formatHex8:tw,formatRgb:Qc,toString:Qc}));function Zc(){return`#${Qe(this.r)}${Qe(this.g)}${Qe(this.b)}`}function tw(){return`#${Qe(this.r)}${Qe(this.g)}${Qe(this.b)}${Qe((isNaN(this.opacity)?1:this.opacity)*255)}`}function Qc(){const e=xn(this.opacity);return`${e===1?"rgb(":"rgba("}${Je(this.r)}, ${Je(this.g)}, ${Je(this.b)}${e===1?")":`, ${e})`}`}function xn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Je(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Qe(e){return e=Je(e),(e<16?"0":"")+e.toString(16)}function Jc(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new be(e,t,n,r)}function Ov(e){if(e instanceof be)return new be(e.h,e.s,e.l,e.opacity);if(e instanceof Ut||(e=tt(e)),!e)return new be;if(e instanceof be)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),a=NaN,s=o-i,c=(o+i)/2;return s?(t===o?a=(n-r)/s+(n<r)*6:n===o?a=(r-t)/s+2:a=(t-n)/s+4,s/=c<.5?o+i:2-o-i,a*=60):s=c>0&&c<1?0:a,new be(a,s,c,e.opacity)}function nw(e,t,n,r){return arguments.length===1?Ov(e):new be(e,t,n,r??1)}function be(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}rc(be,nw,kv(Ut,{brighter(e){return e=e==null?wn:Math.pow(wn,e),new be(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Dt:Math.pow(Dt,e),new be(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new he(fr(e>=240?e-240:e+120,i,r),fr(e,i,r),fr(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new be(el(this.h),un(this.s),un(this.l),xn(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=xn(this.opacity);return`${e===1?"hsl(":"hsla("}${el(this.h)}, ${un(this.s)*100}%, ${un(this.l)*100}%${e===1?")":`, ${e})`}`}}));function el(e){return e=(e||0)%360,e<0?e+360:e}function un(e){return Math.max(0,Math.min(1,e||0))}function fr(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const ic=e=>()=>e;function rw(e,t){return function(n){return e+n*t}}function iw(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function ow(e){return(e=+e)==1?Lv:function(t,n){return n-t?iw(t,n,e):ic(isNaN(t)?n:t)}}function Lv(e,t){var n=t-e;return n?rw(e,n):ic(isNaN(e)?t:e)}const En=(function e(t){var n=ow(t);function r(i,o){var a=n((i=ju(i)).r,(o=ju(o)).r),s=n(i.g,o.g),c=n(i.b,o.b),u=Lv(i.opacity,o.opacity);return function(l){return i.r=a(l),i.g=s(l),i.b=c(l),i.opacity=u(l),i+""}}return r.gamma=e,r})(1);function aw(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(o){for(i=0;i<n;++i)r[i]=e[i]*(1-o)+t[i]*o;return r}}function sw(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function uw(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=new Array(r),o=new Array(n),a;for(a=0;a<r;++a)i[a]=kt(e[a],t[a]);for(;a<n;++a)o[a]=t[a];return function(s){for(a=0;a<r;++a)o[a]=i[a](s);return o}}function cw(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Ie(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function lw(e,t){var n={},r={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?n[i]=kt(e[i],t[i]):r[i]=t[i];return function(o){for(i in n)r[i]=n[i](o);return r}}var Vu=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,dr=new RegExp(Vu.source,"g");function fw(e){return function(){return e}}function dw(e){return function(t){return e(t)+""}}function Dv(e,t){var n=Vu.lastIndex=dr.lastIndex=0,r,i,o,a=-1,s=[],c=[];for(e=e+"",t=t+"";(r=Vu.exec(e))&&(i=dr.exec(t));)(o=i.index)>n&&(o=t.slice(n,o),s[a]?s[a]+=o:s[++a]=o),(r=r[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,c.push({i:a,x:Ie(r,i)})),n=dr.lastIndex;return n<t.length&&(o=t.slice(n),s[a]?s[a]+=o:s[++a]=o),s.length<2?c[0]?dw(c[0].x):fw(t):(t=c.length,function(u){for(var l=0,f;l<t;++l)s[(f=c[l]).i]=f.x(u);return s.join("")})}function kt(e,t){var n=typeof t,r;return t==null||n==="boolean"?ic(t):(n==="number"?Ie:n==="string"?(r=tt(t))?(t=r,En):Dv:t instanceof tt?En:t instanceof Date?cw:sw(t)?aw:Array.isArray(t)?uw:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?lw:Ie)(e,t)}var tl=180/Math.PI,Gu={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Fv(e,t,n,r,i,o){var a,s,c;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(t,e)*tl,skewX:Math.atan(c)*tl,scaleX:a,scaleY:s}}var cn;function hw(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Gu:Fv(t.a,t.b,t.c,t.d,t.e,t.f)}function pw(e){return e==null||(cn||(cn=document.createElementNS("http://www.w3.org/2000/svg","g")),cn.setAttribute("transform",e),!(e=cn.transform.baseVal.consolidate()))?Gu:(e=e.matrix,Fv(e.a,e.b,e.c,e.d,e.e,e.f))}function zv(e,t,n,r){function i(u){return u.length?u.pop()+" ":""}function o(u,l,f,d,h,g){if(u!==f||l!==d){var m=h.push("translate(",null,t,null,n);g.push({i:m-4,x:Ie(u,f)},{i:m-2,x:Ie(l,d)})}else(f||d)&&h.push("translate("+f+t+d+n)}function a(u,l,f,d){u!==l?(u-l>180?l+=360:l-u>180&&(u+=360),d.push({i:f.push(i(f)+"rotate(",null,r)-2,x:Ie(u,l)})):l&&f.push(i(f)+"rotate("+l+r)}function s(u,l,f,d){u!==l?d.push({i:f.push(i(f)+"skewX(",null,r)-2,x:Ie(u,l)}):l&&f.push(i(f)+"skewX("+l+r)}function c(u,l,f,d,h,g){if(u!==f||l!==d){var m=h.push(i(h)+"scale(",null,",",null,")");g.push({i:m-4,x:Ie(u,f)},{i:m-2,x:Ie(l,d)})}else(f!==1||d!==1)&&h.push(i(h)+"scale("+f+","+d+")")}return function(u,l){var f=[],d=[];return u=e(u),l=e(l),o(u.translateX,u.translateY,l.translateX,l.translateY,f,d),a(u.rotate,l.rotate,f,d),s(u.skewX,l.skewX,f,d),c(u.scaleX,u.scaleY,l.scaleX,l.scaleY,f,d),u=l=null,function(h){for(var g=-1,m=d.length,v;++g<m;)f[(v=d[g]).i]=v.x(h);return f.join("")}}}var gw=zv(hw,"px, ","px)","deg)"),vw=zv(pw,", ",")",")"),mw=1e-12;function nl(e){return((e=Math.exp(e))+1/e)/2}function yw(e){return((e=Math.exp(e))-1/e)/2}function _w(e){return((e=Math.exp(2*e))-1)/(e+1)}const vn=(function e(t,n,r){function i(o,a){var s=o[0],c=o[1],u=o[2],l=a[0],f=a[1],d=a[2],h=l-s,g=f-c,m=h*h+g*g,v,y;if(m<mw)y=Math.log(d/u)/t,v=function(E){return[s+E*h,c+E*g,u*Math.exp(t*E*y)]};else{var b=Math.sqrt(m),p=(d*d-u*u+r*m)/(2*u*n*b),_=(d*d-u*u-r*m)/(2*d*n*b),x=Math.log(Math.sqrt(p*p+1)-p),w=Math.log(Math.sqrt(_*_+1)-_);y=(w-x)/t,v=function(E){var R=E*y,C=nl(x),T=u/(n*b)*(C*_w(t*R+x)-yw(x));return[s+T*h,c+T*g,u*C/nl(t*R+x)]}}return v.duration=y*1e3*t/Math.SQRT2,v}return i.rho=function(o){var a=Math.max(.001,+o),s=a*a,c=s*s;return e(a,s,c)},i})(Math.SQRT2,2,4);var vt=0,Nt=0,Rt=0,$v=1e3,Sn,At,Cn=0,nt=0,On=0,zt=typeof performance=="object"&&performance.now?performance:Date,Hv=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function oc(){return nt||(Hv(bw),nt=zt.now()+On)}function bw(){nt=0}function qn(){this._call=this._time=this._next=null}qn.prototype=Bv.prototype={constructor:qn,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?oc():+n)+(t==null?0:+t),!this._next&&At!==this&&(At?At._next=this:Sn=this,At=this),this._call=e,this._time=n,Uu()},stop:function(){this._call&&(this._call=null,this._time=1/0,Uu())}};function Bv(e,t,n){var r=new qn;return r.restart(e,t,n),r}function ww(){oc(),++vt;for(var e=Sn,t;e;)(t=nt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--vt}function rl(){nt=(Cn=zt.now())+On,vt=Nt=0;try{ww()}finally{vt=0,Ew(),nt=0}}function xw(){var e=zt.now(),t=e-Cn;t>$v&&(On-=t,Cn=e)}function Ew(){for(var e,t=Sn,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Sn=n);At=e,Uu(r)}function Uu(e){if(!vt){Nt&&(Nt=clearTimeout(Nt));var t=e-nt;t>24?(e<1/0&&(Nt=setTimeout(rl,e-zt.now()-On)),Rt&&(Rt=clearInterval(Rt))):(Rt||(Cn=zt.now(),Rt=setInterval(xw,$v)),vt=1,Hv(rl))}}function il(e,t,n){var r=new qn;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var Sw=Pn("start","end","cancel","interrupt"),Cw=[],jv=0,ol=1,Yu=2,mn=3,al=4,Wu=5,yn=6;function Ln(e,t,n,r,i,o){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;qw(e,n,{name:t,index:r,group:i,on:Sw,tween:Cw,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:jv})}function ac(e,t){var n=Se(e,t);if(n.state>jv)throw new Error("too late; already scheduled");return n}function Me(e,t){var n=Se(e,t);if(n.state>mn)throw new Error("too late; already running");return n}function Se(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function qw(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=Bv(o,0,n.time);function o(u){n.state=ol,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}function a(u){var l,f,d,h;if(n.state!==ol)return c();for(l in r)if(h=r[l],h.name===n.name){if(h.state===mn)return il(a);h.state===al?(h.state=yn,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[l]):+l<t&&(h.state=yn,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[l])}if(il(function(){n.state===mn&&(n.state=al,n.timer.restart(s,n.delay,n.time),s(u))}),n.state=Yu,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Yu){for(n.state=mn,i=new Array(d=n.tween.length),l=0,f=-1;l<d;++l)(h=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++f]=h);i.length=f+1}}function s(u){for(var l=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(c),n.state=Wu,1),f=-1,d=i.length;++f<d;)i[f].call(e,l);n.state===Wu&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=yn,n.timer.stop(),delete r[t];for(var u in r)return;delete e.__transition}}function _n(e,t){var n=e.__transition,r,i,o=!0,a;if(n){t=t==null?null:t+"";for(a in n){if((r=n[a]).name!==t){o=!1;continue}i=r.state>Yu&&r.state<Wu,r.state=yn,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[a]}o&&delete e.__transition}}function Rw(e){return this.each(function(){_n(this,e)})}function Iw(e,t){var n,r;return function(){var i=Me(this,e),o=i.tween;if(o!==n){r=n=o;for(var a=0,s=r.length;a<s;++a)if(r[a].name===t){r=r.slice(),r.splice(a,1);break}}i.tween=r}}function Nw(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var o=Me(this,e),a=o.tween;if(a!==r){i=(r=a).slice();for(var s={name:t,value:n},c=0,u=i.length;c<u;++c)if(i[c].name===t){i[c]=s;break}c===u&&i.push(s)}o.tween=i}}function Aw(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Se(this.node(),n).tween,i=0,o=r.length,a;i<o;++i)if((a=r[i]).name===e)return a.value;return null}return this.each((t==null?Iw:Nw)(n,e,t))}function sc(e,t,n){var r=e._id;return e.each(function(){var i=Me(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return Se(i,r).value[t]}}function Vv(e,t){var n;return(typeof t=="number"?Ie:t instanceof tt?En:(n=tt(t))?(t=n,En):Dv)(e,t)}function Mw(e){return function(){this.removeAttribute(e)}}function Tw(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Pw(e,t,n){var r,i=n+"",o;return function(){var a=this.getAttribute(e);return a===i?null:a===r?o:o=t(r=a,n)}}function kw(e,t,n){var r,i=n+"",o;return function(){var a=this.getAttributeNS(e.space,e.local);return a===i?null:a===r?o:o=t(r=a,n)}}function Ow(e,t,n){var r,i,o;return function(){var a,s=n(this),c;return s==null?void this.removeAttribute(e):(a=this.getAttribute(e),c=s+"",a===c?null:a===r&&c===i?o:(i=c,o=t(r=a,s)))}}function Lw(e,t,n){var r,i,o;return function(){var a,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),c=s+"",a===c?null:a===r&&c===i?o:(i=c,o=t(r=a,s)))}}function Dw(e,t){var n=kn(e),r=n==="transform"?vw:Vv;return this.attrTween(e,typeof t=="function"?(n.local?Lw:Ow)(n,r,sc(this,"attr."+e,t)):t==null?(n.local?Tw:Mw)(n):(n.local?kw:Pw)(n,r,t))}function Fw(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function zw(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function $w(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&zw(e,o)),n}return i._value=t,i}function Hw(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&Fw(e,o)),n}return i._value=t,i}function Bw(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=kn(e);return this.tween(n,(r.local?$w:Hw)(r,t))}function jw(e,t){return function(){ac(this,e).delay=+t.apply(this,arguments)}}function Vw(e,t){return t=+t,function(){ac(this,e).delay=t}}function Gw(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?jw:Vw)(t,e)):Se(this.node(),t).delay}function Uw(e,t){return function(){Me(this,e).duration=+t.apply(this,arguments)}}function Yw(e,t){return t=+t,function(){Me(this,e).duration=t}}function Ww(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Uw:Yw)(t,e)):Se(this.node(),t).duration}function Xw(e,t){if(typeof t!="function")throw new Error;return function(){Me(this,e).ease=t}}function Kw(e){var t=this._id;return arguments.length?this.each(Xw(t,e)):Se(this.node(),t).ease}function Zw(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Me(this,e).ease=n}}function Qw(e){if(typeof e!="function")throw new Error;return this.each(Zw(this._id,e))}function Jw(e){typeof e!="function"&&(e=wv(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],a=o.length,s=r[i]=[],c,u=0;u<a;++u)(c=o[u])&&e.call(c,c.__data__,u,o)&&s.push(c);return new ze(r,this._parents,this._name,this._id)}function ex(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,i=n.length,o=Math.min(r,i),a=new Array(r),s=0;s<o;++s)for(var c=t[s],u=n[s],l=c.length,f=a[s]=new Array(l),d,h=0;h<l;++h)(d=c[h]||u[h])&&(f[h]=d);for(;s<r;++s)a[s]=t[s];return new ze(a,this._parents,this._name,this._id)}function tx(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function nx(e,t,n){var r,i,o=tx(t)?ac:Me;return function(){var a=o(this,e),s=a.on;s!==r&&(i=(r=s).copy()).on(t,n),a.on=i}}function rx(e,t){var n=this._id;return arguments.length<2?Se(this.node(),n).on.on(e):this.each(nx(n,e,t))}function ix(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function ox(){return this.on("end.remove",ix(this._id))}function ax(e){var t=this._name,n=this._id;typeof e!="function"&&(e=tc(e));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a<i;++a)for(var s=r[a],c=s.length,u=o[a]=new Array(c),l,f,d=0;d<c;++d)(l=s[d])&&(f=e.call(l,l.__data__,d,s))&&("__data__"in l&&(f.__data__=l.__data__),u[d]=f,Ln(u[d],t,n,d,u,Se(l,n)));return new ze(o,this._parents,t,n)}function sx(e){var t=this._name,n=this._id;typeof e!="function"&&(e=bv(e));for(var r=this._groups,i=r.length,o=[],a=[],s=0;s<i;++s)for(var c=r[s],u=c.length,l,f=0;f<u;++f)if(l=c[f]){for(var d=e.call(l,l.__data__,f,c),h,g=Se(l,n),m=0,v=d.length;m<v;++m)(h=d[m])&&Ln(h,t,n,m,d,g);o.push(d),a.push(l)}return new ze(o,a,t,n)}var ux=Gt.prototype.constructor;function cx(){return new ux(this._groups,this._parents)}function lx(e,t){var n,r,i;return function(){var o=gt(this,e),a=(this.style.removeProperty(e),gt(this,e));return o===a?null:o===n&&a===r?i:i=t(n=o,r=a)}}function Gv(e){return function(){this.style.removeProperty(e)}}function fx(e,t,n){var r,i=n+"",o;return function(){var a=gt(this,e);return a===i?null:a===r?o:o=t(r=a,n)}}function dx(e,t,n){var r,i,o;return function(){var a=gt(this,e),s=n(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),gt(this,e))),a===c?null:a===r&&c===i?o:(i=c,o=t(r=a,s))}}function hx(e,t){var n,r,i,o="style."+t,a="end."+o,s;return function(){var c=Me(this,e),u=c.on,l=c.value[o]==null?s||(s=Gv(t)):void 0;(u!==n||i!==l)&&(r=(n=u).copy()).on(a,i=l),c.on=r}}function px(e,t,n){var r=(e+="")=="transform"?gw:Vv;return t==null?this.styleTween(e,lx(e,r)).on("end.style."+e,Gv(e)):typeof t=="function"?this.styleTween(e,dx(e,r,sc(this,"style."+e,t))).each(hx(this._id,e)):this.styleTween(e,fx(e,r,t),n).on("end.style."+e,null)}function gx(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function vx(e,t,n){var r,i;function o(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&gx(e,a,n)),r}return o._value=t,o}function mx(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,vx(e,t,n??""))}function yx(e){return function(){this.textContent=e}}function _x(e){return function(){var t=e(this);this.textContent=t??""}}function bx(e){return this.tween("text",typeof e=="function"?_x(sc(this,"text",e)):yx(e==null?"":e+""))}function wx(e){return function(t){this.textContent=e.call(this,t)}}function xx(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&wx(i)),t}return r._value=e,r}function Ex(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,xx(e))}function Sx(){for(var e=this._name,t=this._id,n=Uv(),r=this._groups,i=r.length,o=0;o<i;++o)for(var a=r[o],s=a.length,c,u=0;u<s;++u)if(c=a[u]){var l=Se(c,t);Ln(c,e,n,u,a,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new ze(r,this._parents,e,n)}function Cx(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(o,a){var s={value:a},c={value:function(){--i===0&&o()}};n.each(function(){var u=Me(this,r),l=u.on;l!==e&&(t=(e=l).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),u.on=t}),i===0&&o()})}var qx=0;function ze(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Uv(){return++qx}var De=Gt.prototype;ze.prototype={constructor:ze,select:ax,selectAll:sx,selectChild:De.selectChild,selectChildren:De.selectChildren,filter:Jw,merge:ex,selection:cx,transition:Sx,call:De.call,nodes:De.nodes,node:De.node,size:De.size,empty:De.empty,each:De.each,on:rx,attr:Dw,attrTween:Bw,style:px,styleTween:mx,text:bx,textTween:Ex,remove:ox,tween:Aw,delay:Gw,duration:Ww,ease:Kw,easeVarying:Qw,end:Cx,[Symbol.iterator]:De[Symbol.iterator]};function Rx(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Ix={time:null,delay:0,duration:250,ease:Rx};function Nx(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function Ax(e){var t,n;e instanceof ze?(t=e._id,e=e._name):(t=Uv(),(n=Ix).time=oc(),e=e==null?null:e+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var a=r[o],s=a.length,c,u=0;u<s;++u)(c=a[u])&&Ln(c,e,t,u,a,n||Nx(c,t));return new ze(r,this._parents,e,t)}Gt.prototype.interrupt=Rw;Gt.prototype.transition=Ax;const ln=e=>()=>e;function Mx(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Fe(e,t,n){this.k=e,this.x=t,this.y=n}Fe.prototype={constructor:Fe,scale:function(e){return e===1?this:new Fe(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Fe(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Dn=new Fe(1,0,0);Yv.prototype=Fe.prototype;function Yv(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Dn;return e.__zoom}function hr(e){e.stopImmediatePropagation()}function It(e){e.preventDefault(),e.stopImmediatePropagation()}function Tx(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Px(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function sl(){return this.__zoom||Dn}function kx(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Ox(){return navigator.maxTouchPoints||"ontouchstart"in this}function Lx(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}function Wv(){var e=Tx,t=Px,n=Lx,r=kx,i=Ox,o=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],s=250,c=vn,u=Pn("start","zoom","end"),l,f,d,h=500,g=150,m=0,v=10;function y(S){S.property("__zoom",sl).on("wheel.zoom",R,{passive:!1}).on("mousedown.zoom",C).on("dblclick.zoom",T).filter(i).on("touchstart.zoom",q).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",k).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(S,A,N,L){var P=S.selection?S.selection():S;P.property("__zoom",sl),S!==P?x(S,A,N,L):P.interrupt().each(function(){w(this,arguments).event(L).start().zoom(null,typeof A=="function"?A.apply(this,arguments):A).end()})},y.scaleBy=function(S,A,N,L){y.scaleTo(S,function(){var P=this.__zoom.k,D=typeof A=="function"?A.apply(this,arguments):A;return P*D},N,L)},y.scaleTo=function(S,A,N,L){y.transform(S,function(){var P=t.apply(this,arguments),D=this.__zoom,j=N==null?_(P):typeof N=="function"?N.apply(this,arguments):N,G=D.invert(j),V=typeof A=="function"?A.apply(this,arguments):A;return n(p(b(D,V),j,G),P,a)},N,L)},y.translateBy=function(S,A,N,L){y.transform(S,function(){return n(this.__zoom.translate(typeof A=="function"?A.apply(this,arguments):A,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),a)},null,L)},y.translateTo=function(S,A,N,L,P){y.transform(S,function(){var D=t.apply(this,arguments),j=this.__zoom,G=L==null?_(D):typeof L=="function"?L.apply(this,arguments):L;return n(Dn.translate(G[0],G[1]).scale(j.k).translate(typeof A=="function"?-A.apply(this,arguments):-A,typeof N=="function"?-N.apply(this,arguments):-N),D,a)},L,P)};function b(S,A){return A=Math.max(o[0],Math.min(o[1],A)),A===S.k?S:new Fe(A,S.x,S.y)}function p(S,A,N){var L=A[0]-N[0]*S.k,P=A[1]-N[1]*S.k;return L===S.x&&P===S.y?S:new Fe(S.k,L,P)}function _(S){return[(+S[0][0]+ +S[1][0])/2,(+S[0][1]+ +S[1][1])/2]}function x(S,A,N,L){S.on("start.zoom",function(){w(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(L).end()}).tween("zoom",function(){var P=this,D=arguments,j=w(P,D).event(L),G=t.apply(P,D),V=N==null?_(G):typeof N=="function"?N.apply(P,D):N,Y=Math.max(G[1][0]-G[0][0],G[1][1]-G[0][1]),I=P.__zoom,O=typeof A=="function"?A.apply(P,D):A,z=c(I.invert(V).concat(Y/I.k),O.invert(V).concat(Y/O.k));return function(H){if(H===1)H=O;else{var B=z(H),U=Y/B[2];H=new Fe(U,V[0]-B[0]*U,V[1]-B[1]*U)}j.zoom(null,H)}})}function w(S,A,N){return!N&&S.__zooming||new E(S,A)}function E(S,A){this.that=S,this.args=A,this.active=0,this.sourceEvent=null,this.extent=t.apply(S,A),this.taps=0}E.prototype={event:function(S){return S&&(this.sourceEvent=S),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(S,A){return this.mouse&&S!=="mouse"&&(this.mouse[1]=A.invert(this.mouse[0])),this.touch0&&S!=="touch"&&(this.touch0[1]=A.invert(this.touch0[0])),this.touch1&&S!=="touch"&&(this.touch1[1]=A.invert(this.touch1[0])),this.that.__zoom=A,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(S){var A=ge(this.that).datum();u.call(S,this.that,new Mx(S,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:u}),A)}};function R(S,...A){if(!e.apply(this,arguments))return;var N=w(this,A).event(S),L=this.__zoom,P=Math.max(o[0],Math.min(o[1],L.k*Math.pow(2,r.apply(this,arguments)))),D=_e(S);if(N.wheel)(N.mouse[0][0]!==D[0]||N.mouse[0][1]!==D[1])&&(N.mouse[1]=L.invert(N.mouse[0]=D)),clearTimeout(N.wheel);else{if(L.k===P)return;N.mouse=[D,L.invert(D)],_n(this),N.start()}It(S),N.wheel=setTimeout(j,g),N.zoom("mouse",n(p(b(L,P),N.mouse[0],N.mouse[1]),N.extent,a));function j(){N.wheel=null,N.end()}}function C(S,...A){if(d||!e.apply(this,arguments))return;var N=S.currentTarget,L=w(this,A,!0).event(S),P=ge(S.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",Y,!0),D=_e(S,N),j=S.clientX,G=S.clientY;Mv(S.view),hr(S),L.mouse=[D,this.__zoom.invert(D)],_n(this),L.start();function V(I){if(It(I),!L.moved){var O=I.clientX-j,z=I.clientY-G;L.moved=O*O+z*z>m}L.event(I).zoom("mouse",n(p(L.that.__zoom,L.mouse[0]=_e(I,N),L.mouse[1]),L.extent,a))}function Y(I){P.on("mousemove.zoom mouseup.zoom",null),Tv(I.view,L.moved),It(I),L.event(I).end()}}function T(S,...A){if(e.apply(this,arguments)){var N=this.__zoom,L=_e(S.changedTouches?S.changedTouches[0]:S,this),P=N.invert(L),D=N.k*(S.shiftKey?.5:2),j=n(p(b(N,D),L,P),t.apply(this,A),a);It(S),s>0?ge(this).transition().duration(s).call(x,j,L,S):ge(this).call(y.transform,j,L,S)}}function q(S,...A){if(e.apply(this,arguments)){var N=S.touches,L=N.length,P=w(this,A,S.changedTouches.length===L).event(S),D,j,G,V;for(hr(S),j=0;j<L;++j)G=N[j],V=_e(G,this),V=[V,this.__zoom.invert(V),G.identifier],P.touch0?!P.touch1&&P.touch0[2]!==V[2]&&(P.touch1=V,P.taps=0):(P.touch0=V,D=!0,P.taps=1+!!l);l&&(l=clearTimeout(l)),D&&(P.taps<2&&(f=V[0],l=setTimeout(function(){l=null},h)),_n(this),P.start())}}function M(S,...A){if(this.__zooming){var N=w(this,A).event(S),L=S.changedTouches,P=L.length,D,j,G,V;for(It(S),D=0;D<P;++D)j=L[D],G=_e(j,this),N.touch0&&N.touch0[2]===j.identifier?N.touch0[0]=G:N.touch1&&N.touch1[2]===j.identifier&&(N.touch1[0]=G);if(j=N.that.__zoom,N.touch1){var Y=N.touch0[0],I=N.touch0[1],O=N.touch1[0],z=N.touch1[1],H=(H=O[0]-Y[0])*H+(H=O[1]-Y[1])*H,B=(B=z[0]-I[0])*B+(B=z[1]-I[1])*B;j=b(j,Math.sqrt(H/B)),G=[(Y[0]+O[0])/2,(Y[1]+O[1])/2],V=[(I[0]+z[0])/2,(I[1]+z[1])/2]}else if(N.touch0)G=N.touch0[0],V=N.touch0[1];else return;N.zoom("touch",n(p(j,G,V),N.extent,a))}}function k(S,...A){if(this.__zooming){var N=w(this,A).event(S),L=S.changedTouches,P=L.length,D,j;for(hr(S),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),D=0;D<P;++D)j=L[D],N.touch0&&N.touch0[2]===j.identifier?delete N.touch0:N.touch1&&N.touch1[2]===j.identifier&&delete N.touch1;if(N.touch1&&!N.touch0&&(N.touch0=N.touch1,delete N.touch1),N.touch0)N.touch0[1]=this.__zoom.invert(N.touch0[0]);else if(N.end(),N.taps===2&&(j=_e(j,this),Math.hypot(f[0]-j[0],f[1]-j[1])<v)){var G=ge(this).on("dblclick.zoom");G&&G.apply(this,arguments)}}}return y.wheelDelta=function(S){return arguments.length?(r=typeof S=="function"?S:ln(+S),y):r},y.filter=function(S){return arguments.length?(e=typeof S=="function"?S:ln(!!S),y):e},y.touchable=function(S){return arguments.length?(i=typeof S=="function"?S:ln(!!S),y):i},y.extent=function(S){return arguments.length?(t=typeof S=="function"?S:ln([[+S[0][0],+S[0][1]],[+S[1][0],+S[1][1]]]),y):t},y.scaleExtent=function(S){return arguments.length?(o[0]=+S[0],o[1]=+S[1],y):[o[0],o[1]]},y.translateExtent=function(S){return arguments.length?(a[0][0]=+S[0][0],a[1][0]=+S[1][0],a[0][1]=+S[0][1],a[1][1]=+S[1][1],y):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},y.constrain=function(S){return arguments.length?(n=S,y):n},y.duration=function(S){return arguments.length?(s=+S,y):s},y.interpolate=function(S){return arguments.length?(c=S,y):c},y.on=function(){var S=u.on.apply(u,arguments);return S===u?y:S},y.clickDistance=function(S){return arguments.length?(m=(S=+S)*S,y):Math.sqrt(m)},y.tapDistance=function(S){return arguments.length?(v=+S,y):v},y}const Ae={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},$t=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Xv=["Enter"," ","Escape"],Kv={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var mt;(function(e){e.Strict="strict",e.Loose="loose"})(mt||(mt={}));var et;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(et||(et={}));var Ht;(function(e){e.Partial="partial",e.Full="full"})(Ht||(Ht={}));const Zv={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var We;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(We||(We={}));var Rn;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Rn||(Rn={}));var Z;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Z||(Z={}));const ul={[Z.Left]:Z.Right,[Z.Right]:Z.Left,[Z.Top]:Z.Bottom,[Z.Bottom]:Z.Top};function Qv(e){return e===null?null:e?"valid":"invalid"}const Jv=e=>"id"in e&&"source"in e&&"target"in e,Dx=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),uc=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Yt=(e,t=[0,0])=>{const{width:n,height:r}=$e(e),i=e.origin??t,o=n*i[0],a=r*i[1];return{x:e.position.x-o,y:e.position.y-a}},Fx=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,i)=>{const o=typeof i=="string";let a=!t.nodeLookup&&!o?i:void 0;t.nodeLookup&&(a=o?t.nodeLookup.get(i):uc(i)?i:t.nodeLookup.get(i.id));const s=a?In(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Fn(r,s)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return zn(n)},Wt=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(i=>{(t.filter===void 0||t.filter(i))&&(n=Fn(n,In(i)),r=!0)}),r?zn(n):{x:0,y:0,width:0,height:0}},cc=(e,t,[n,r,i]=[0,0,1],o=!1,a=!1)=>{const s={...Kt(t,[n,r,i]),width:t.width/i,height:t.height/i},c=[];for(const u of e.values()){const{measured:l,selectable:f=!0,hidden:d=!1}=u;if(a&&!f||d)continue;const h=l.width??u.width??u.initialWidth??null,g=l.height??u.height??u.initialHeight??null,m=Bt(s,_t(u)),v=(h??0)*(g??0),y=o&&m>0;(!u.internals.handleBounds||y||m>=v||u.dragging)&&c.push(u)}return c},zx=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function $x(e,t){const n=new Map,r=t?.nodes?new Set(t.nodes.map(i=>i.id)):null;return e.forEach(i=>{i.measured.width&&i.measured.height&&(t?.includeHiddenNodes||!i.hidden)&&(!r||r.has(i.id))&&n.set(i.id,i)}),n}async function Hx({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:o},a){if(e.size===0)return Promise.resolve(!0);const s=$x(e,a),c=Wt(s),u=lc(c,t,n,a?.minZoom??i,a?.maxZoom??o,a?.padding??.1);return await r.setViewport(u,{duration:a?.duration,ease:a?.ease,interpolate:a?.interpolate}),Promise.resolve(!0)}function em({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:o}){const a=n.get(e),s=a.parentId?n.get(a.parentId):void 0,{x:c,y:u}=s?s.internals.positionAbsolute:{x:0,y:0},l=a.origin??r;let f=a.extent||i;if(a.extent==="parent"&&!a.expandParent)if(!s)o?.("005",Ae.error005());else{const h=s.measured.width,g=s.measured.height;h&&g&&(f=[[c,u],[c+h,u+g]])}else s&&bt(a.extent)&&(f=[[a.extent[0][0]+c,a.extent[0][1]+u],[a.extent[1][0]+c,a.extent[1][1]+u]]);const d=bt(f)?rt(t,f,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&o?.("015",Ae.error015()),{position:{x:d.x-c+(a.measured.width??0)*l[0],y:d.y-u+(a.measured.height??0)*l[1]},positionAbsolute:d}}async function Bx({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){const o=new Set(e.map(d=>d.id)),a=[];for(const d of n){if(d.deletable===!1)continue;const h=o.has(d.id),g=!h&&d.parentId&&a.find(m=>m.id===d.parentId);(h||g)&&a.push(d)}const s=new Set(t.map(d=>d.id)),c=r.filter(d=>d.deletable!==!1),l=zx(a,c);for(const d of c)s.has(d.id)&&!l.find(g=>g.id===d.id)&&l.push(d);if(!i)return{edges:l,nodes:a};const f=await i({nodes:a,edges:l});return typeof f=="boolean"?f?{edges:l,nodes:a}:{edges:[],nodes:[]}:f}const yt=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),rt=(e={x:0,y:0},t,n)=>({x:yt(e.x,t[0][0],t[1][0]-(n?.width??0)),y:yt(e.y,t[0][1],t[1][1]-(n?.height??0))});function tm(e,t,n){const{width:r,height:i}=$e(n),{x:o,y:a}=n.internals.positionAbsolute;return rt(e,[[o,a],[o+r,a+i]],t)}const cl=(e,t,n)=>e<t?yt(Math.abs(e-t),1,t)/t:e>n?-yt(Math.abs(e-n),1,t)/t:0,nm=(e,t,n=15,r=40)=>{const i=cl(e.x,r,t.width-r)*n,o=cl(e.y,r,t.height-r)*n;return[i,o]},Fn=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Xu=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),zn=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),_t=(e,t=[0,0])=>{const{x:n,y:r}=uc(e)?e.internals.positionAbsolute:Yt(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},In=(e,t=[0,0])=>{const{x:n,y:r}=uc(e)?e.internals.positionAbsolute:Yt(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},rm=(e,t)=>zn(Fn(Xu(e),Xu(t))),Bt=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},ll=e=>we(e.width)&&we(e.height)&&we(e.x)&&we(e.y),we=e=>!isNaN(e)&&isFinite(e),jx=(e,t)=>{},Xt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Kt=({x:e,y:t},[n,r,i],o=!1,a=[1,1])=>{const s={x:(e-n)/i,y:(t-r)/i};return o?Xt(s,a):s},Nn=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function lt(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Vx(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=lt(e,n),i=lt(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e=="object"){const r=lt(e.top??e.y??0,n),i=lt(e.bottom??e.y??0,n),o=lt(e.left??e.x??0,t),a=lt(e.right??e.x??0,t);return{top:r,right:a,bottom:i,left:o,x:o+a,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Gx(e,t,n,r,i,o){const{x:a,y:s}=Nn(e,[t,n,r]),{x:c,y:u}=Nn({x:e.x+e.width,y:e.y+e.height},[t,n,r]),l=i-c,f=o-u;return{left:Math.floor(a),top:Math.floor(s),right:Math.floor(l),bottom:Math.floor(f)}}const lc=(e,t,n,r,i,o)=>{const a=Vx(o,t,n),s=(t-a.x)/e.width,c=(n-a.y)/e.height,u=Math.min(s,c),l=yt(u,r,i),f=e.x+e.width/2,d=e.y+e.height/2,h=t/2-f*l,g=n/2-d*l,m=Gx(e,h,g,l,t,n),v={left:Math.min(m.left-a.left,0),top:Math.min(m.top-a.top,0),right:Math.min(m.right-a.right,0),bottom:Math.min(m.bottom-a.bottom,0)};return{x:h-v.left+v.right,y:g-v.top+v.bottom,zoom:l}},jt=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function bt(e){return e!=null&&e!=="parent"}function $e(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function im(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function om(e,t={width:0,height:0},n,r,i){const o={...e},a=r.get(n);if(a){const s=a.origin||i;o.x+=a.internals.positionAbsolute.x-(t.width??0)*s[0],o.y+=a.internals.positionAbsolute.y-(t.height??0)*s[1]}return o}function fl(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Ux(){let e,t;return{promise:new Promise((r,i)=>{e=r,t=i}),resolve:e,reject:t}}function Yx(e){return{...Kv,...e||{}}}function Ot(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){const{x:o,y:a}=xe(e),s=Kt({x:o-(i?.left??0),y:a-(i?.top??0)},r),{x:c,y:u}=n?Xt(s,t):s;return{xSnapped:c,ySnapped:u,...s}}const fc=e=>({width:e.offsetWidth,height:e.offsetHeight}),am=e=>e?.getRootNode?.()||window?.document,Wx=["INPUT","SELECT","TEXTAREA"];function sm(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Wx.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const um=e=>"clientX"in e,xe=(e,t)=>{const n=um(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},dl=(e,t,n,r,i)=>{const o=t.querySelectorAll(`.${e}`);return!o||!o.length?null:Array.from(o).map(a=>{const s=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:i,position:a.getAttribute("data-handlepos"),x:(s.left-n.left)/r,y:(s.top-n.top)/r,...fc(a)}})};function cm({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:o,targetControlX:a,targetControlY:s}){const c=e*.125+i*.375+a*.375+n*.125,u=t*.125+o*.375+s*.375+r*.125,l=Math.abs(c-e),f=Math.abs(u-t);return[c,u,l,f]}function fn(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function hl({pos:e,x1:t,y1:n,x2:r,y2:i,c:o}){switch(e){case Z.Left:return[t-fn(t-r,o),n];case Z.Right:return[t+fn(r-t,o),n];case Z.Top:return[t,n-fn(n-i,o)];case Z.Bottom:return[t,n+fn(i-n,o)]}}function lm({sourceX:e,sourceY:t,sourcePosition:n=Z.Bottom,targetX:r,targetY:i,targetPosition:o=Z.Top,curvature:a=.25}){const[s,c]=hl({pos:n,x1:e,y1:t,x2:r,y2:i,c:a}),[u,l]=hl({pos:o,x1:r,y1:i,x2:e,y2:t,c:a}),[f,d,h,g]=cm({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:u,targetControlY:l});return[`M${e},${t} C${s},${c} ${u},${l} ${r},${i}`,f,d,h,g]}function fm({sourceX:e,sourceY:t,targetX:n,targetY:r}){const i=Math.abs(n-e)/2,o=n<e?n+i:n-i,a=Math.abs(r-t)/2,s=r<t?r+a:r-a;return[o,s,i,a]}function Xx({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:o="basic"}){if(o==="manual")return r;const a=i&&n?r+1e3:r,s=Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0);return a+s}function Kx({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){const o=Fn(In(e),In(t));o.x===o.x2&&(o.x2+=1),o.y===o.y2&&(o.y2+=1);const a={x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]};return Bt(a,zn(o))>0}const Zx=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,Qx=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Jx=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||Zx;let i;return Jv(e)?i={...e}:i={...e,id:r(e)},Qx(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function dm({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[i,o,a,s]=fm({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,o,a,s]}const pl={[Z.Left]:{x:-1,y:0},[Z.Right]:{x:1,y:0},[Z.Top]:{x:0,y:-1},[Z.Bottom]:{x:0,y:1}},e1=({source:e,sourcePosition:t=Z.Bottom,target:n})=>t===Z.Left||t===Z.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},gl=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function t1({source:e,sourcePosition:t=Z.Bottom,target:n,targetPosition:r=Z.Top,center:i,offset:o,stepPosition:a}){const s=pl[t],c=pl[r],u={x:e.x+s.x*o,y:e.y+s.y*o},l={x:n.x+c.x*o,y:n.y+c.y*o},f=e1({source:u,sourcePosition:t,target:l}),d=f.x!==0?"x":"y",h=f[d];let g=[],m,v;const y={x:0,y:0},b={x:0,y:0},[,,p,_]=fm({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[d]*c[d]===-1){d==="x"?(m=i.x??u.x+(l.x-u.x)*a,v=i.y??(u.y+l.y)/2):(m=i.x??(u.x+l.x)/2,v=i.y??u.y+(l.y-u.y)*a);const w=[{x:m,y:u.y},{x:m,y:l.y}],E=[{x:u.x,y:v},{x:l.x,y:v}];s[d]===h?g=d==="x"?w:E:g=d==="x"?E:w}else{const w=[{x:u.x,y:l.y}],E=[{x:l.x,y:u.y}];if(d==="x"?g=s.x===h?E:w:g=s.y===h?w:E,t===r){const M=Math.abs(e[d]-n[d]);if(M<=o){const k=Math.min(o-1,o-M);s[d]===h?y[d]=(u[d]>e[d]?-1:1)*k:b[d]=(l[d]>n[d]?-1:1)*k}}if(t!==r){const M=d==="x"?"y":"x",k=s[d]===c[M],S=u[M]>l[M],A=u[M]<l[M];(s[d]===1&&(!k&&S||k&&A)||s[d]!==1&&(!k&&A||k&&S))&&(g=d==="x"?w:E)}const R={x:u.x+y.x,y:u.y+y.y},C={x:l.x+b.x,y:l.y+b.y},T=Math.max(Math.abs(R.x-g[0].x),Math.abs(C.x-g[0].x)),q=Math.max(Math.abs(R.y-g[0].y),Math.abs(C.y-g[0].y));T>=q?(m=(R.x+C.x)/2,v=g[0].y):(m=g[0].x,v=(R.y+C.y)/2)}return[[e,{x:u.x+y.x,y:u.y+y.y},...g,{x:l.x+b.x,y:l.y+b.y},n],m,v,p,_]}function n1(e,t,n,r){const i=Math.min(gl(e,t)/2,gl(t,n)/2,r),{x:o,y:a}=t;if(e.x===o&&o===n.x||e.y===a&&a===n.y)return`L${o} ${a}`;if(e.y===a){const u=e.x<n.x?-1:1,l=e.y<n.y?1:-1;return`L ${o+i*u},${a}Q ${o},${a} ${o},${a+i*l}`}const s=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${o},${a+i*c}Q ${o},${a} ${o+i*s},${a}`}function Ku({sourceX:e,sourceY:t,sourcePosition:n=Z.Bottom,targetX:r,targetY:i,targetPosition:o=Z.Top,borderRadius:a=5,centerX:s,centerY:c,offset:u=20,stepPosition:l=.5}){const[f,d,h,g,m]=t1({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:o,center:{x:s,y:c},offset:u,stepPosition:l});return[f.reduce((y,b,p)=>{let _="";return p>0&&p<f.length-1?_=n1(f[p-1],b,f[p+1],a):_=`${p===0?"M":"L"}${b.x} ${b.y}`,y+=_,y},""),d,h,g,m]}function vl(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function r1(e){const{sourceNode:t,targetNode:n}=e;if(!vl(t)||!vl(n))return null;const r=t.internals.handleBounds||ml(t.handles),i=n.internals.handleBounds||ml(n.handles),o=yl(r?.source??[],e.sourceHandle),a=yl(e.connectionMode===mt.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!o||!a)return e.onError?.("008",Ae.error008(o?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const s=o?.position||Z.Bottom,c=a?.position||Z.Top,u=it(t,o,s),l=it(n,a,c);return{sourceX:u.x,sourceY:u.y,targetX:l.x,targetY:l.y,sourcePosition:s,targetPosition:c}}function ml(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function it(e,t,n=Z.Left,r=!1){const i=(t?.x??0)+e.internals.positionAbsolute.x,o=(t?.y??0)+e.internals.positionAbsolute.y,{width:a,height:s}=t??$e(e);if(r)return{x:i+a/2,y:o+s/2};switch(t?.position??n){case Z.Top:return{x:i+a/2,y:o};case Z.Right:return{x:i+a,y:o+s/2};case Z.Bottom:return{x:i+a/2,y:o+s};case Z.Left:return{x:i,y:o+s/2}}}function yl(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Zu(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function i1(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){const o=new Set;return e.reduce((a,s)=>([s.markerStart||r,s.markerEnd||i].forEach(c=>{if(c&&typeof c=="object"){const u=Zu(c,t);o.has(u)||(a.push({id:u,color:c.color||n,...c}),o.add(u))}}),a),[]).sort((a,s)=>a.id.localeCompare(s.id))}const hm=1e3,o1=10,dc={nodeOrigin:[0,0],nodeExtent:$t,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},a1={...dc,checkEquality:!0};function hc(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function s1(e,t,n){const r=hc(dc,n);for(const i of e.values())if(i.parentId)gc(i,e,t,r);else{const o=Yt(i,r.nodeOrigin),a=bt(i.extent)?i.extent:r.nodeExtent,s=rt(o,a,$e(i));i.internals.positionAbsolute=s}}function u1(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],r=[];for(const i of e.handles){const o={id:i.id,width:i.width??1,height:i.height??1,nodeId:e.id,x:i.x,y:i.y,position:i.position,type:i.type};i.type==="source"?n.push(o):i.type==="target"&&r.push(o)}return{source:n,target:r}}function pc(e){return e==="manual"}function Qu(e,t,n,r={}){const i=hc(a1,r),o={i:0},a=new Map(t),s=i?.elevateNodesOnSelect&&!pc(i.zIndexMode)?hm:0;let c=e.length>0;t.clear(),n.clear();for(const u of e){let l=a.get(u.id);if(i.checkEquality&&u===l?.internals.userNode)t.set(u.id,l);else{const f=Yt(u,i.nodeOrigin),d=bt(u.extent)?u.extent:i.nodeExtent,h=rt(f,d,$e(u));l={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:h,handleBounds:u1(u,l),z:pm(u,s,i.zIndexMode),userNode:u}},t.set(u.id,l)}(l.measured===void 0||l.measured.width===void 0||l.measured.height===void 0)&&!l.hidden&&(c=!1),u.parentId&&gc(l,t,n,r,o)}return c}function c1(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function gc(e,t,n,r,i){const{elevateNodesOnSelect:o,nodeOrigin:a,nodeExtent:s,zIndexMode:c}=hc(dc,r),u=e.parentId,l=t.get(u);if(!l){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}c1(e,n),i&&!l.parentId&&l.internals.rootParentIndex===void 0&&c==="auto"&&(l.internals.rootParentIndex=++i.i,l.internals.z=l.internals.z+i.i*o1),i&&l.internals.rootParentIndex!==void 0&&(i.i=l.internals.rootParentIndex);const f=o&&!pc(c)?hm:0,{x:d,y:h,z:g}=l1(e,l,a,s,f,c),{positionAbsolute:m}=e.internals,v=d!==m.x||h!==m.y;(v||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:v?{x:d,y:h}:m,z:g}})}function pm(e,t,n){const r=we(e.zIndex)?e.zIndex:0;return pc(n)?r:r+(e.selected?t:0)}function l1(e,t,n,r,i,o){const{x:a,y:s}=t.internals.positionAbsolute,c=$e(e),u=Yt(e,n),l=bt(e.extent)?rt(u,e.extent,c):u;let f=rt({x:a+l.x,y:s+l.y},r,c);e.extent==="parent"&&(f=tm(f,c,t));const d=pm(e,i,o),h=t.internals.z??0;return{x:f.x,y:f.y,z:h>=d?h+1:d}}function vc(e,t,n,r=[0,0]){const i=[],o=new Map;for(const a of e){const s=t.get(a.parentId);if(!s)continue;const c=o.get(a.parentId)?.expandedRect??_t(s),u=rm(c,a.rect);o.set(a.parentId,{expandedRect:u,parent:s})}return o.size>0&&o.forEach(({expandedRect:a,parent:s},c)=>{const u=s.internals.positionAbsolute,l=$e(s),f=s.origin??r,d=a.x<u.x?Math.round(Math.abs(u.x-a.x)):0,h=a.y<u.y?Math.round(Math.abs(u.y-a.y)):0,g=Math.max(l.width,Math.round(a.width)),m=Math.max(l.height,Math.round(a.height)),v=(g-l.width)*f[0],y=(m-l.height)*f[1];(d>0||h>0||v||y)&&(i.push({id:c,type:"position",position:{x:s.position.x-d+v,y:s.position.y-h+y}}),n.get(c)?.forEach(b=>{e.some(p=>p.id===b.id)||i.push({id:b.id,type:"position",position:{x:b.position.x+d,y:b.position.y+h}})})),(l.width<a.width||l.height<a.height||d||h)&&i.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:g+(d?f[0]*d-v:0),height:m+(h?f[1]*h-y:0)}})}),i}function f1(e,t,n,r,i,o,a){const s=r?.querySelector(".xyflow__viewport");let c=!1;if(!s)return{changes:[],updatedInternals:c};const u=[],l=window.getComputedStyle(s),{m22:f}=new window.DOMMatrixReadOnly(l.transform),d=[];for(const h of e.values()){const g=t.get(h.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const m=fc(h.nodeElement),v=g.measured.width!==m.width||g.measured.height!==m.height;if(!!(m.width&&m.height&&(v||!g.internals.handleBounds||h.force))){const b=h.nodeElement.getBoundingClientRect(),p=bt(g.extent)?g.extent:o;let{positionAbsolute:_}=g.internals;g.parentId&&g.extent==="parent"?_=tm(_,m,t.get(g.parentId)):p&&(_=rt(_,p,m));const x={...g,measured:m,internals:{...g.internals,positionAbsolute:_,handleBounds:{source:dl("source",h.nodeElement,b,f,g.id),target:dl("target",h.nodeElement,b,f,g.id)}}};t.set(g.id,x),g.parentId&&gc(x,t,n,{nodeOrigin:i,zIndexMode:a}),c=!0,v&&(u.push({id:g.id,type:"dimensions",dimensions:m}),g.expandParent&&g.parentId&&d.push({id:g.id,parentId:g.parentId,rect:_t(x,i)}))}}if(d.length>0){const h=vc(d,t,n,i);u.push(...h)}return{changes:u,updatedInternals:c}}async function d1({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:o}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const a=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,o]],r),s=!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2]);return Promise.resolve(s)}function _l(e,t,n,r,i,o){let a=i;const s=r.get(a)||new Map;r.set(a,s.set(n,t)),a=`${i}-${e}`;const c=r.get(a)||new Map;if(r.set(a,c.set(n,t)),o){a=`${i}-${e}-${o}`;const u=r.get(a)||new Map;r.set(a,u.set(n,t))}}function gm(e,t,n){e.clear(),t.clear();for(const r of n){const{source:i,target:o,sourceHandle:a=null,targetHandle:s=null}=r,c={edgeId:r.id,source:i,target:o,sourceHandle:a,targetHandle:s},u=`${i}-${a}--${o}-${s}`,l=`${o}-${s}--${i}-${a}`;_l("source",c,l,e,i,a),_l("target",c,u,e,o,s),t.set(r.id,r)}}function vm(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:vm(n,t):!1}function bl(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function h1(e,t,n,r){const i=new Map;for(const[o,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!vm(a,e))&&(a.draggable||t&&typeof a.draggable>"u")){const s=e.get(o);s&&i.set(o,{id:o,position:s.position||{x:0,y:0},distance:{x:n.x-s.internals.positionAbsolute.x,y:n.y-s.internals.positionAbsolute.y},extent:s.extent,parentId:s.parentId,origin:s.origin,expandParent:s.expandParent,internals:{positionAbsolute:s.internals.positionAbsolute||{x:0,y:0}},measured:{width:s.measured.width??0,height:s.measured.height??0}})}return i}function pr({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){const i=[];for(const[a,s]of t){const c=n.get(a)?.internals.userNode;c&&i.push({...c,position:s.position,dragging:r})}if(!e)return[i[0],i];const o=n.get(e)?.internals.userNode;return[o?{...o,position:t.get(e)?.position||o.position,dragging:r}:i[0],i]}function p1({dragItems:e,snapGrid:t,x:n,y:r}){const i=e.values().next().value;if(!i)return null;const o={x:n-i.distance.x,y:r-i.distance.y},a=Xt(o,t);return{x:a.x-o.x,y:a.y-o.y}}function g1({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let o={x:null,y:null},a=0,s=new Map,c=!1,u={x:0,y:0},l=null,f=!1,d=null,h=!1,g=!1,m=null;function v({noDragClassName:b,handleSelector:p,domNode:_,isSelectable:x,nodeId:w,nodeClickDistance:E=0}){d=ge(_);function R({x:M,y:k}){const{nodeLookup:S,nodeExtent:A,snapGrid:N,snapToGrid:L,nodeOrigin:P,onNodeDrag:D,onSelectionDrag:j,onError:G,updateNodePositions:V}=t();o={x:M,y:k};let Y=!1;const I=s.size>1,O=I&&A?Xu(Wt(s)):null,z=I&&L?p1({dragItems:s,snapGrid:N,x:M,y:k}):null;for(const[H,B]of s){if(!S.has(H))continue;let U={x:M-B.distance.x,y:k-B.distance.y};L&&(U=z?{x:Math.round(U.x+z.x),y:Math.round(U.y+z.y)}:Xt(U,N));let X=null;if(I&&A&&!B.extent&&O){const{positionAbsolute:W}=B.internals,te=W.x-O.x+A[0][0],K=W.x+B.measured.width-O.x2+A[1][0],re=W.y-O.y+A[0][1],ee=W.y+B.measured.height-O.y2+A[1][1];X=[[te,re],[K,ee]]}const{position:J,positionAbsolute:Q}=em({nodeId:H,nextPosition:U,nodeLookup:S,nodeExtent:X||A,nodeOrigin:P,onError:G});Y=Y||B.position.x!==J.x||B.position.y!==J.y,B.position=J,B.internals.positionAbsolute=Q}if(g=g||Y,!!Y&&(V(s,!0),m&&(r||D||!w&&j))){const[H,B]=pr({nodeId:w,dragItems:s,nodeLookup:S});r?.(m,s,H,B),D?.(m,H,B),w||j?.(m,B)}}async function C(){if(!l)return;const{transform:M,panBy:k,autoPanSpeed:S,autoPanOnNodeDrag:A}=t();if(!A){c=!1,cancelAnimationFrame(a);return}const[N,L]=nm(u,l,S);(N!==0||L!==0)&&(o.x=(o.x??0)-N/M[2],o.y=(o.y??0)-L/M[2],await k({x:N,y:L})&&R(o)),a=requestAnimationFrame(C)}function T(M){const{nodeLookup:k,multiSelectionActive:S,nodesDraggable:A,transform:N,snapGrid:L,snapToGrid:P,selectNodesOnDrag:D,onNodeDragStart:j,onSelectionDragStart:G,unselectNodesAndEdges:V}=t();f=!0,(!D||!x)&&!S&&w&&(k.get(w)?.selected||V()),x&&D&&w&&e?.(w);const Y=Ot(M.sourceEvent,{transform:N,snapGrid:L,snapToGrid:P,containerBounds:l});if(o=Y,s=h1(k,A,Y,w),s.size>0&&(n||j||!w&&G)){const[I,O]=pr({nodeId:w,dragItems:s,nodeLookup:k});n?.(M.sourceEvent,s,I,O),j?.(M.sourceEvent,I,O),w||G?.(M.sourceEvent,O)}}const q=Pv().clickDistance(E).on("start",M=>{const{domNode:k,nodeDragThreshold:S,transform:A,snapGrid:N,snapToGrid:L}=t();l=k?.getBoundingClientRect()||null,h=!1,g=!1,m=M.sourceEvent,S===0&&T(M),o=Ot(M.sourceEvent,{transform:A,snapGrid:N,snapToGrid:L,containerBounds:l}),u=xe(M.sourceEvent,l)}).on("drag",M=>{const{autoPanOnNodeDrag:k,transform:S,snapGrid:A,snapToGrid:N,nodeDragThreshold:L,nodeLookup:P}=t(),D=Ot(M.sourceEvent,{transform:S,snapGrid:A,snapToGrid:N,containerBounds:l});if(m=M.sourceEvent,(M.sourceEvent.type==="touchmove"&&M.sourceEvent.touches.length>1||w&&!P.has(w))&&(h=!0),!h){if(!c&&k&&f&&(c=!0,C()),!f){const j=xe(M.sourceEvent,l),G=j.x-u.x,V=j.y-u.y;Math.sqrt(G*G+V*V)>L&&T(M)}(o.x!==D.xSnapped||o.y!==D.ySnapped)&&s&&f&&(u=xe(M.sourceEvent,l),R(D))}}).on("end",M=>{if(!(!f||h)&&(c=!1,f=!1,cancelAnimationFrame(a),s.size>0)){const{nodeLookup:k,updateNodePositions:S,onNodeDragStop:A,onSelectionDragStop:N}=t();if(g&&(S(s,!1),g=!1),i||A||!w&&N){const[L,P]=pr({nodeId:w,dragItems:s,nodeLookup:k,dragging:!1});i?.(M.sourceEvent,s,L,P),A?.(M.sourceEvent,L,P),w||N?.(M.sourceEvent,P)}}}).filter(M=>{const k=M.target;return!M.button&&(!b||!bl(k,`.${b}`,_))&&(!p||bl(k,p,_))});d.call(q)}function y(){d?.on(".drag",null)}return{update:v,destroy:y}}function v1(e,t,n){const r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const o of t.values())Bt(i,_t(o))>0&&r.push(o);return r}const m1=250;function y1(e,t,n,r){let i=[],o=1/0;const a=v1(e,n,t+m1);for(const s of a){const c=[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]];for(const u of c){if(r.nodeId===u.nodeId&&r.type===u.type&&r.id===u.id)continue;const{x:l,y:f}=it(s,u,u.position,!0),d=Math.sqrt(Math.pow(l-e.x,2)+Math.pow(f-e.y,2));d>t||(d<o?(i=[{...u,x:l,y:f}],o=d):d===o&&i.push({...u,x:l,y:f}))}}if(!i.length)return null;if(i.length>1){const s=r.type==="source"?"target":"source";return i.find(c=>c.type===s)??i[0]}return i[0]}function mm(e,t,n,r,i,o=!1){const a=r.get(e);if(!a)return null;const s=i==="strict"?a.internals.handleBounds?.[t]:[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]],c=(n?s?.find(u=>u.id===n):s?.[0])??null;return c&&o?{...c,...it(a,c,c.position,!0)}:c}function ym(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function _1(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const _m=()=>!0;function b1(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:o,isTarget:a,domNode:s,nodeLookup:c,lib:u,autoPanOnConnect:l,flowId:f,panBy:d,cancelConnection:h,onConnectStart:g,onConnect:m,onConnectEnd:v,isValidConnection:y=_m,onReconnectEnd:b,updateConnection:p,getTransform:_,getFromHandle:x,autoPanSpeed:w,dragThreshold:E=1,handleDomNode:R}){const C=am(e.target);let T=0,q;const{x:M,y:k}=xe(e),S=ym(o,R),A=s?.getBoundingClientRect();let N=!1;if(!A||!S)return;const L=mm(i,S,r,c,t);if(!L)return;let P=xe(e,A),D=!1,j=null,G=!1,V=null;function Y(){if(!l||!A)return;const[J,Q]=nm(P,A,w);d({x:J,y:Q}),T=requestAnimationFrame(Y)}const I={...L,nodeId:i,type:S,position:L.position},O=c.get(i);let H={inProgress:!0,isValid:null,from:it(O,I,Z.Left,!0),fromHandle:I,fromPosition:I.position,fromNode:O,to:P,toHandle:null,toPosition:ul[I.position],toNode:null,pointer:P};function B(){N=!0,p(H),g?.(e,{nodeId:i,handleId:r,handleType:S})}E===0&&B();function U(J){if(!N){const{x:ee,y:fe}=xe(J),le=ee-M,Pe=fe-k;if(!(le*le+Pe*Pe>E*E))return;B()}if(!x()||!I){X(J);return}const Q=_();P=xe(J,A),q=y1(Kt(P,Q,!1,[1,1]),n,c,I),D||(Y(),D=!0);const W=bm(J,{handle:q,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:a?"target":"source",isValidConnection:y,doc:C,lib:u,flowId:f,nodeLookup:c});V=W.handleDomNode,j=W.connection,G=_1(!!q,W.isValid);const te=c.get(i),K=te?it(te,I,Z.Left,!0):H.from,re={...H,from:K,isValid:G,to:W.toHandle&&G?Nn({x:W.toHandle.x,y:W.toHandle.y},Q):P,toHandle:W.toHandle,toPosition:G&&W.toHandle?W.toHandle.position:ul[I.position],toNode:W.toHandle?c.get(W.toHandle.nodeId):null,pointer:P};p(re),H=re}function X(J){if(!("touches"in J&&J.touches.length>0)){if(N){(q||V)&&j&&G&&m?.(j);const{inProgress:Q,...W}=H,te={...W,toPosition:H.toHandle?H.toPosition:null};v?.(J,te),o&&b?.(J,te)}h(),cancelAnimationFrame(T),D=!1,G=!1,j=null,V=null,C.removeEventListener("mousemove",U),C.removeEventListener("mouseup",X),C.removeEventListener("touchmove",U),C.removeEventListener("touchend",X)}}C.addEventListener("mousemove",U),C.addEventListener("mouseup",X),C.addEventListener("touchmove",U),C.addEventListener("touchend",X)}function bm(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:o,doc:a,lib:s,flowId:c,isValidConnection:u=_m,nodeLookup:l}){const f=o==="target",d=t?a.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:g}=xe(e),m=a.elementFromPoint(h,g),v=m?.classList.contains(`${s}-flow__handle`)?m:d,y={handleDomNode:v,isValid:!1,connection:null,toHandle:null};if(v){const b=ym(void 0,v),p=v.getAttribute("data-nodeid"),_=v.getAttribute("data-handleid"),x=v.classList.contains("connectable"),w=v.classList.contains("connectableend");if(!p||!b)return y;const E={source:f?p:r,sourceHandle:f?_:i,target:f?r:p,targetHandle:f?i:_};y.connection=E;const C=x&&w&&(n===mt.Strict?f&&b==="source"||!f&&b==="target":p!==r||_!==i);y.isValid=C&&u(E),y.toHandle=mm(p,b,_,l,n,!0)}return y}const Ju={onPointerDown:b1,isValid:bm};function w1({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const i=ge(e);function o({translateExtent:s,width:c,height:u,zoomStep:l=1,pannable:f=!0,zoomable:d=!0,inversePan:h=!1}){const g=p=>{if(p.sourceEvent.type!=="wheel"||!t)return;const _=n(),x=p.sourceEvent.ctrlKey&&jt()?10:1,w=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*l,E=_[2]*Math.pow(2,w*x);t.scaleTo(E)};let m=[0,0];const v=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(m=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},y=p=>{const _=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;const x=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],w=[x[0]-m[0],x[1]-m[1]];m=x;const E=r()*Math.max(_[2],Math.log(_[2]))*(h?-1:1),R={x:_[0]-w[0]*E,y:_[1]-w[1]*E},C=[[0,0],[c,u]];t.setViewportConstrained({x:R.x,y:R.y,zoom:_[2]},C,s)},b=Wv().on("start",v).on("zoom",f?y:null).on("zoom.wheel",d?g:null);i.call(b,{})}function a(){i.on("zoom",null)}return{update:o,destroy:a,pointer:_e}}const $n=e=>({x:e.x,y:e.y,zoom:e.k}),gr=({x:e,y:t,zoom:n})=>Dn.translate(e,t).scale(n),ft=(e,t)=>e.target.closest(`.${t}`),wm=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),x1=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,vr=(e,t=0,n=x1,r=()=>{})=>{const i=typeof t=="number"&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on("end",r):e},xm=e=>{const t=e.ctrlKey&&jt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function E1({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:o,zoomOnPinch:a,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:u}){return l=>{if(ft(l,t))return l.ctrlKey&&l.preventDefault(),!1;l.preventDefault(),l.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(l.ctrlKey&&a){const v=_e(l),y=xm(l),b=f*Math.pow(2,y);r.scaleTo(n,b,v,l);return}const d=l.deltaMode===1?20:1;let h=i===et.Vertical?0:l.deltaX*d,g=i===et.Horizontal?0:l.deltaY*d;!jt()&&l.shiftKey&&i!==et.Vertical&&(h=l.deltaY*d,g=0),r.translateBy(n,-(h/f)*o,-(g/f)*o,{internal:!0});const m=$n(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c?.(l,m),e.panScrollTimeout=setTimeout(()=>{u?.(l,m),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,s?.(l,m))}}function S1({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){const o=r.type==="wheel",a=!t&&o&&!r.ctrlKey,s=ft(r,e);if(r.ctrlKey&&o&&s&&r.preventDefault(),a||s)return null;r.preventDefault(),n.call(this,r,i)}}function C1({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;const i=$n(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(r.sourceEvent,i)}}function q1({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return o=>{e.usedRightMouseButton=!!(n&&wm(t,e.mouseButton??0)),o.sourceEvent?.sync||r([o.transform.x,o.transform.y,o.transform.k]),i&&!o.sourceEvent?.internal&&i?.(o.sourceEvent,$n(o.transform))}}function R1({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:o}){return a=>{if(!a.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,o&&wm(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&o(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){const s=$n(a.transform);e.prevViewport=s,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(a.sourceEvent,s)},n?150:0)}}}function I1({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:o,userSelectionActive:a,noWheelClassName:s,noPanClassName:c,lib:u,connectionInProgress:l}){return f=>{const d=e||t,h=n&&f.ctrlKey,g=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(ft(f,`${u}-flow__node`)||ft(f,`${u}-flow__edge`)))return!0;if(!r&&!d&&!i&&!o&&!n||a||l&&!g||ft(f,s)&&g||ft(f,c)&&(!g||i&&g&&!e)||!n&&f.ctrlKey&&g)return!1;if(!n&&f.type==="touchstart"&&f.touches?.length>1)return f.preventDefault(),!1;if(!d&&!i&&!h&&g||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const m=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||g)&&m}}function N1({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:o,onPanZoomStart:a,onPanZoomEnd:s,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},l=e.getBoundingClientRect(),f=Wv().scaleExtent([t,n]).translateExtent(r),d=ge(e).call(f);b({x:i.x,y:i.y,zoom:yt(i.zoom,t,n)},[[0,0],[l.width,l.height]],r);const h=d.on("wheel.zoom"),g=d.on("dblclick.zoom");f.wheelDelta(xm);function m(q,M){return d?new Promise(k=>{f?.interpolate(M?.interpolate==="linear"?kt:vn).transform(vr(d,M?.duration,M?.ease,()=>k(!0)),q)}):Promise.resolve(!1)}function v({noWheelClassName:q,noPanClassName:M,onPaneContextMenu:k,userSelectionActive:S,panOnScroll:A,panOnDrag:N,panOnScrollMode:L,panOnScrollSpeed:P,preventScrolling:D,zoomOnPinch:j,zoomOnScroll:G,zoomOnDoubleClick:V,zoomActivationKeyPressed:Y,lib:I,onTransformChange:O,connectionInProgress:z,paneClickDistance:H,selectionOnDrag:B}){S&&!u.isZoomingOrPanning&&y();const U=A&&!Y&&!S;f.clickDistance(B?1/0:!we(H)||H<0?0:H);const X=U?E1({zoomPanValues:u,noWheelClassName:q,d3Selection:d,d3Zoom:f,panOnScrollMode:L,panOnScrollSpeed:P,zoomOnPinch:j,onPanZoomStart:a,onPanZoom:o,onPanZoomEnd:s}):S1({noWheelClassName:q,preventScrolling:D,d3ZoomHandler:h});if(d.on("wheel.zoom",X,{passive:!1}),!S){const Q=C1({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});f.on("start",Q);const W=q1({zoomPanValues:u,panOnDrag:N,onPaneContextMenu:!!k,onPanZoom:o,onTransformChange:O});f.on("zoom",W);const te=R1({zoomPanValues:u,panOnDrag:N,panOnScroll:A,onPaneContextMenu:k,onPanZoomEnd:s,onDraggingChange:c});f.on("end",te)}const J=I1({zoomActivationKeyPressed:Y,panOnDrag:N,zoomOnScroll:G,panOnScroll:A,zoomOnDoubleClick:V,zoomOnPinch:j,userSelectionActive:S,noPanClassName:M,noWheelClassName:q,lib:I,connectionInProgress:z});f.filter(J),V?d.on("dblclick.zoom",g):d.on("dblclick.zoom",null)}function y(){f.on("zoom",null)}async function b(q,M,k){const S=gr(q),A=f?.constrain()(S,M,k);return A&&await m(A),new Promise(N=>N(A))}async function p(q,M){const k=gr(q);return await m(k,M),new Promise(S=>S(k))}function _(q){if(d){const M=gr(q),k=d.property("__zoom");(k.k!==q.zoom||k.x!==q.x||k.y!==q.y)&&f?.transform(d,M,null,{sync:!0})}}function x(){const q=d?Yv(d.node()):{x:0,y:0,k:1};return{x:q.x,y:q.y,zoom:q.k}}function w(q,M){return d?new Promise(k=>{f?.interpolate(M?.interpolate==="linear"?kt:vn).scaleTo(vr(d,M?.duration,M?.ease,()=>k(!0)),q)}):Promise.resolve(!1)}function E(q,M){return d?new Promise(k=>{f?.interpolate(M?.interpolate==="linear"?kt:vn).scaleBy(vr(d,M?.duration,M?.ease,()=>k(!0)),q)}):Promise.resolve(!1)}function R(q){f?.scaleExtent(q)}function C(q){f?.translateExtent(q)}function T(q){const M=!we(q)||q<0?0:q;f?.clickDistance(M)}return{update:v,destroy:y,setViewport:p,setViewportConstrained:b,getViewport:x,scaleTo:w,scaleBy:E,setScaleExtent:R,setTranslateExtent:C,syncViewport:_,setClickDistance:T}}var wt;(function(e){e.Line="line",e.Handle="handle"})(wt||(wt={}));function A1({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:o}){const a=e-t,s=n-r,c=[a>0?1:a<0?-1:0,s>0?1:s<0?-1:0];return a&&i&&(c[0]=c[0]*-1),s&&o&&(c[1]=c[1]*-1),c}function wl(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),i=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:i}}function Ue(e,t){return Math.max(0,t-e)}function Ye(e,t){return Math.max(0,e-t)}function dn(e,t,n){return Math.max(0,t-e,e-n)}function xl(e,t){return e?!t:t}function M1(e,t,n,r,i,o,a,s){let{affectsX:c,affectsY:u}=t;const{isHorizontal:l,isVertical:f}=t,d=l&&f,{xSnapped:h,ySnapped:g}=n,{minWidth:m,maxWidth:v,minHeight:y,maxHeight:b}=r,{x:p,y:_,width:x,height:w,aspectRatio:E}=e;let R=Math.floor(l?h-e.pointerX:0),C=Math.floor(f?g-e.pointerY:0);const T=x+(c?-R:R),q=w+(u?-C:C),M=-o[0]*x,k=-o[1]*w;let S=dn(T,m,v),A=dn(q,y,b);if(a){let P=0,D=0;c&&R<0?P=Ue(p+R+M,a[0][0]):!c&&R>0&&(P=Ye(p+T+M,a[1][0])),u&&C<0?D=Ue(_+C+k,a[0][1]):!u&&C>0&&(D=Ye(_+q+k,a[1][1])),S=Math.max(S,P),A=Math.max(A,D)}if(s){let P=0,D=0;c&&R>0?P=Ye(p+R,s[0][0]):!c&&R<0&&(P=Ue(p+T,s[1][0])),u&&C>0?D=Ye(_+C,s[0][1]):!u&&C<0&&(D=Ue(_+q,s[1][1])),S=Math.max(S,P),A=Math.max(A,D)}if(i){if(l){const P=dn(T/E,y,b)*E;if(S=Math.max(S,P),a){let D=0;!c&&!u||c&&!u&&d?D=Ye(_+k+T/E,a[1][1])*E:D=Ue(_+k+(c?R:-R)/E,a[0][1])*E,S=Math.max(S,D)}if(s){let D=0;!c&&!u||c&&!u&&d?D=Ue(_+T/E,s[1][1])*E:D=Ye(_+(c?R:-R)/E,s[0][1])*E,S=Math.max(S,D)}}if(f){const P=dn(q*E,m,v)/E;if(A=Math.max(A,P),a){let D=0;!c&&!u||u&&!c&&d?D=Ye(p+q*E+M,a[1][0])/E:D=Ue(p+(u?C:-C)*E+M,a[0][0])/E,A=Math.max(A,D)}if(s){let D=0;!c&&!u||u&&!c&&d?D=Ue(p+q*E,s[1][0])/E:D=Ye(p+(u?C:-C)*E,s[0][0])/E,A=Math.max(A,D)}}}C=C+(C<0?A:-A),R=R+(R<0?S:-S),i&&(d?T>q*E?C=(xl(c,u)?-R:R)/E:R=(xl(c,u)?-C:C)*E:l?(C=R/E,u=c):(R=C*E,c=u));const N=c?p+R:p,L=u?_+C:_;return{width:x+(c?-R:R),height:w+(u?-C:C),x:o[0]*R*(c?-1:1)+N,y:o[1]*C*(u?-1:1)+L}}const Em={width:0,height:0,x:0,y:0},T1={...Em,pointerX:0,pointerY:0,aspectRatio:1};function P1(e){return[[0,0],[e.measured.width,e.measured.height]]}function k1(e,t,n){const r=t.position.x+e.position.x,i=t.position.y+e.position.y,o=e.measured.width??0,a=e.measured.height??0,s=n[0]*o,c=n[1]*a;return[[r-s,i-c],[r+o-s,i+a-c]]}function O1({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){const o=ge(e);let a={controlDirection:wl("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:u,boundaries:l,keepAspectRatio:f,resizeDirection:d,onResizeStart:h,onResize:g,onResizeEnd:m,shouldResize:v}){let y={...Em},b={...T1};a={boundaries:l,resizeDirection:d,keepAspectRatio:f,controlDirection:wl(u)};let p,_=null,x=[],w,E,R,C=!1;const T=Pv().on("start",q=>{const{nodeLookup:M,transform:k,snapGrid:S,snapToGrid:A,nodeOrigin:N,paneDomNode:L}=n();if(p=M.get(t),!p)return;_=L?.getBoundingClientRect()??null;const{xSnapped:P,ySnapped:D}=Ot(q.sourceEvent,{transform:k,snapGrid:S,snapToGrid:A,containerBounds:_});y={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},b={...y,pointerX:P,pointerY:D,aspectRatio:y.width/y.height},w=void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(w=M.get(p.parentId),E=w&&p.extent==="parent"?P1(w):void 0),x=[],R=void 0;for(const[j,G]of M)if(G.parentId===t&&(x.push({id:j,position:{...G.position},extent:G.extent}),G.extent==="parent"||G.expandParent)){const V=k1(G,p,G.origin??N);R?R=[[Math.min(V[0][0],R[0][0]),Math.min(V[0][1],R[0][1])],[Math.max(V[1][0],R[1][0]),Math.max(V[1][1],R[1][1])]]:R=V}h?.(q,{...y})}).on("drag",q=>{const{transform:M,snapGrid:k,snapToGrid:S,nodeOrigin:A}=n(),N=Ot(q.sourceEvent,{transform:M,snapGrid:k,snapToGrid:S,containerBounds:_}),L=[];if(!p)return;const{x:P,y:D,width:j,height:G}=y,V={},Y=p.origin??A,{width:I,height:O,x:z,y:H}=M1(b,a.controlDirection,N,a.boundaries,a.keepAspectRatio,Y,E,R),B=I!==j,U=O!==G,X=z!==P&&B,J=H!==D&&U;if(!X&&!J&&!B&&!U)return;if((X||J||Y[0]===1||Y[1]===1)&&(V.x=X?z:y.x,V.y=J?H:y.y,y.x=V.x,y.y=V.y,x.length>0)){const K=z-P,re=H-D;for(const ee of x)ee.position={x:ee.position.x-K+Y[0]*(I-j),y:ee.position.y-re+Y[1]*(O-G)},L.push(ee)}if((B||U)&&(V.width=B&&(!a.resizeDirection||a.resizeDirection==="horizontal")?I:y.width,V.height=U&&(!a.resizeDirection||a.resizeDirection==="vertical")?O:y.height,y.width=V.width,y.height=V.height),w&&p.expandParent){const K=Y[0]*(V.width??0);V.x&&V.x<K&&(y.x=K,b.x=b.x-(V.x-K));const re=Y[1]*(V.height??0);V.y&&V.y<re&&(y.y=re,b.y=b.y-(V.y-re))}const Q=A1({width:y.width,prevWidth:j,height:y.height,prevHeight:G,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),W={...y,direction:Q};v?.(q,W)!==!1&&(C=!0,g?.(q,W),r(V,L))}).on("end",q=>{C&&(m?.(q,{...y}),i?.({...y}),C=!1)});o.call(T)}function c(){o.on(".drag",null)}return{update:s,destroy:c}}var mr={exports:{}},yr={},_r={exports:{}},br={};var El;function L1(){if(El)return br;El=1;var e=yv();function t(f,d){return f===d&&(f!==0||1/f===1/d)||f!==f&&d!==d}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,i=e.useEffect,o=e.useLayoutEffect,a=e.useDebugValue;function s(f,d){var h=d(),g=r({inst:{value:h,getSnapshot:d}}),m=g[0].inst,v=g[1];return o(function(){m.value=h,m.getSnapshot=d,c(m)&&v({inst:m})},[f,h,d]),i(function(){return c(m)&&v({inst:m}),f(function(){c(m)&&v({inst:m})})},[f]),a(h),h}function c(f){var d=f.getSnapshot;f=f.value;try{var h=d();return!n(f,h)}catch{return!0}}function u(f,d){return d()}var l=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:s;return br.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:l,br}var Sl;function D1(){return Sl||(Sl=1,_r.exports=L1()),_r.exports}var Cl;function F1(){if(Cl)return yr;Cl=1;var e=yv(),t=D1();function n(u,l){return u===l&&(u!==0||1/u===1/l)||u!==u&&l!==l}var r=typeof Object.is=="function"?Object.is:n,i=t.useSyncExternalStore,o=e.useRef,a=e.useEffect,s=e.useMemo,c=e.useDebugValue;return yr.useSyncExternalStoreWithSelector=function(u,l,f,d,h){var g=o(null);if(g.current===null){var m={hasValue:!1,value:null};g.current=m}else m=g.current;g=s(function(){function y(w){if(!b){if(b=!0,p=w,w=d(w),h!==void 0&&m.hasValue){var E=m.value;if(h(E,w))return _=E}return _=w}if(E=_,r(p,w))return E;var R=d(w);return h!==void 0&&h(E,R)?(p=w,E):(p=w,_=R)}var b=!1,p,_,x=f===void 0?null:f;return[function(){return y(l())},x===null?void 0:function(){return y(x())}]},[l,f,d,h]);var v=i(u,g[0],g[1]);return a(function(){m.hasValue=!0,m.value=v},[v]),c(v),v},yr}var ql;function z1(){return ql||(ql=1,mr.exports=F1()),mr.exports}var $1=z1();const H1=n_($1),B1={},Rl=e=>{let t;const n=new Set,r=(l,f)=>{const d=typeof l=="function"?l(t):l;if(!Object.is(d,t)){const h=t;t=f??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(g=>g(t,h))}},i=()=>t,c={setState:r,getState:i,getInitialState:()=>u,subscribe:l=>(n.add(l),()=>n.delete(l)),destroy:()=>{(B1?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=t=e(r,i,c);return c},j1=e=>e?Rl(e):Rl,{useDebugValue:V1}=r_,{useSyncExternalStoreWithSelector:G1}=H1,U1=e=>e;function Sm(e,t=U1,n){const r=G1(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return V1(r),r}const Il=(e,t)=>{const n=j1(e),r=(i,o=t)=>Sm(n,i,o);return Object.assign(r,n),r},Y1=(e,t)=>e?Il(e,t):Il;function ie(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,i]of e)if(!Object.is(i,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const Hn=$.createContext(null),W1=Hn.Provider,Cm=Ae.error001();function ne(e,t){const n=$.useContext(Hn);if(n===null)throw new Error(Cm);return Sm(n,e,t)}function oe(){const e=$.useContext(Hn);if(e===null)throw new Error(Cm);return $.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Nl={display:"none"},X1={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},qm="react-flow__node-desc",Rm="react-flow__edge-desc",K1="react-flow__aria-live",Z1=e=>e.ariaLiveMessage,Q1=e=>e.ariaLabelConfig;function J1({rfId:e}){const t=ne(Z1);return F.jsx("div",{id:`${K1}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:X1,children:t})}function eE({rfId:e,disableKeyboardA11y:t}){const n=ne(Q1);return F.jsxs(F.Fragment,{children:[F.jsx("div",{id:`${qm}-${e}`,style:Nl,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),F.jsx("div",{id:`${Rm}-${e}`,style:Nl,children:n["edge.a11yDescription.default"]}),!t&&F.jsx(J1,{rfId:e})]})}const Bn=$.forwardRef(({position:e="top-left",children:t,className:n,style:r,...i},o)=>{const a=`${e}`.split("-");return F.jsx("div",{className:ue(["react-flow__panel",n,...a]),style:r,ref:o,...i,children:t})});Bn.displayName="Panel";function tE({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:F.jsx(Bn,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:F.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const nE=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},hn=e=>e.id;function rE(e,t){return ie(e.selectedNodes.map(hn),t.selectedNodes.map(hn))&&ie(e.selectedEdges.map(hn),t.selectedEdges.map(hn))}function iE({onSelectionChange:e}){const t=oe(),{selectedNodes:n,selectedEdges:r}=ne(nE,rE);return $.useEffect(()=>{const i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(o=>o(i))},[n,r,e]),null}const oE=e=>!!e.onSelectionChangeHandlers;function aE({onSelectionChange:e}){const t=ne(oE);return e||t?F.jsx(iE,{onSelectionChange:e}):null}const Im=[0,0],sE={x:0,y:0,zoom:1},uE=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],Al=[...uE,"rfId"],cE=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),Ml={translateExtent:$t,nodeOrigin:Im,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function lE(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:o,setNodeExtent:a,reset:s,setDefaultNodesAndEdges:c}=ne(cE,ie),u=oe();$.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{l.current=Ml,s()}),[]);const l=$.useRef(Ml);return $.useEffect(()=>{for(const f of Al){const d=e[f],h=l.current[f];d!==h&&(typeof e[f]>"u"||(f==="nodes"?t(d):f==="edges"?n(d):f==="minZoom"?r(d):f==="maxZoom"?i(d):f==="translateExtent"?o(d):f==="nodeExtent"?a(d):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:Yx(d)}):f==="fitView"?u.setState({fitViewQueued:d}):f==="fitViewOptions"?u.setState({fitViewOptions:d}):u.setState({[f]:d})))}l.current=e},Al.map(f=>e[f])),null}function Tl(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function fE(e){const[t,n]=$.useState(e==="system"?null:e);return $.useEffect(()=>{if(e!=="system"){n(e);return}const r=Tl(),i=()=>n(r?.matches?"dark":"light");return i(),r?.addEventListener("change",i),()=>{r?.removeEventListener("change",i)}},[e]),t!==null?t:Tl()?.matches?"dark":"light"}const Pl=typeof document<"u"?document:null;function Vt(e=null,t={target:Pl,actInsideInputWithModifier:!0}){const[n,r]=$.useState(!1),i=$.useRef(!1),o=$.useRef(new Set([])),[a,s]=$.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",`
2
+ `).replace(`
3
+
4
+ `,`
5
+ +`).split(`
6
+ `)),l=u.reduce((f,d)=>f.concat(...d),[]);return[u,l]}return[[],[]]},[e]);return $.useEffect(()=>{const c=t?.target??Pl,u=t?.actInsideInputWithModifier??!0;if(e!==null){const l=h=>{if(i.current=h.ctrlKey||h.metaKey||h.shiftKey||h.altKey,(!i.current||i.current&&!u)&&sm(h))return!1;const m=Ol(h.code,s);if(o.current.add(h[m]),kl(a,o.current,!1)){const v=h.composedPath?.()?.[0]||h.target,y=v?.nodeName==="BUTTON"||v?.nodeName==="A";t.preventDefault!==!1&&(i.current||!y)&&h.preventDefault(),r(!0)}},f=h=>{const g=Ol(h.code,s);kl(a,o.current,!0)?(r(!1),o.current.clear()):o.current.delete(h[g]),h.key==="Meta"&&o.current.clear(),i.current=!1},d=()=>{o.current.clear(),r(!1)};return c?.addEventListener("keydown",l),c?.addEventListener("keyup",f),window.addEventListener("blur",d),window.addEventListener("contextmenu",d),()=>{c?.removeEventListener("keydown",l),c?.removeEventListener("keyup",f),window.removeEventListener("blur",d),window.removeEventListener("contextmenu",d)}}},[e,r]),n}function kl(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(i=>t.has(i)))}function Ol(e,t){return t.includes(e)?"code":"key"}const dE=()=>{const e=oe();return $.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,{duration: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(),c=lc(t,r,i,o,a,n?.padding??.1);return s?(await s.setViewport(c,{duration:n?.duration,ease:n?.ease,interpolate: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:c}=a.getBoundingClientRect(),u={x:t.x-s,y:t.y-c},l=n.snapGrid??i,f=n.snapToGrid??o;return Kt(u,r,f,l)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:i,y:o}=r.getBoundingClientRect(),a=Nn(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 c of a)hE(c,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 hE(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 Mm(e,t){return Nm(e,t)}function Ze(e,t){return{id:e,type:"select",selected:t}}function dt(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(Ze(o.id,a)))}return r}function Ll({items:e=[],lookup:t}){const n=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,o]of e.entries()){const a=t.get(o.id),s=a?.internals?.userNode??a;s!==void 0&&s!==o&&n.push({id:o.id,item:o,type:"replace"}),s===void 0&&n.push({item:o,type:"add",index:i})}for(const[i]of t)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function Dl(e){return{id:e.id,type:"remove"}}const Fl=e=>Dx(e),pE=e=>Jv(e);function Tm(e){return $.forwardRef(e)}const gE=typeof window<"u"?$.useLayoutEffect:$.useEffect;function zl(e){const[t,n]=$.useState(BigInt(0)),[r]=$.useState(()=>vE(()=>n(i=>i+BigInt(1))));return gE(()=>{const i=r.get();i.length&&(e(i),r.reset())},[t]),r}function vE(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const Pm=$.createContext(null);function mE({children:e}){const t=oe(),n=$.useCallback(s=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:l,onNodesChange:f,nodeLookup:d,fitViewQueued:h,onNodesChangeMiddlewareMap:g}=t.getState();let m=c;for(const y of s)m=typeof y=="function"?y(m):y;let v=Ll({items:m,lookup:d});for(const y of g.values())v=y(v);l&&u(m),v.length>0?f?.(v):h&&window.requestAnimationFrame(()=>{const{fitViewQueued:y,nodes:b,setNodes:p}=t.getState();y&&p(b)})},[]),r=zl(n),i=$.useCallback(s=>{const{edges:c=[],setEdges:u,hasDefaultEdges:l,onEdgesChange:f,edgeLookup:d}=t.getState();let h=c;for(const g of s)h=typeof g=="function"?g(h):g;l?u(h):f&&f(Ll({items:h,lookup:d}))},[]),o=zl(i),a=$.useMemo(()=>({nodeQueue:r,edgeQueue:o}),[]);return F.jsx(Pm.Provider,{value:a,children:e})}function yE(){const e=$.useContext(Pm);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const _E=e=>!!e.panZoom;function mc(){const e=dE(),t=oe(),n=yE(),r=ne(_E),i=$.useMemo(()=>{const o=f=>t.getState().nodeLookup.get(f),a=f=>{n.nodeQueue.push(f)},s=f=>{n.edgeQueue.push(f)},c=f=>{const{nodeLookup:d,nodeOrigin:h}=t.getState(),g=Fl(f)?f:d.get(f.id),m=g.parentId?om(g.position,g.measured,g.parentId,d,h):g.position,v={...g,position:m,width:g.measured?.width??g.width,height:g.measured?.height??g.height};return _t(v)},u=(f,d,h={replace:!1})=>{a(g=>g.map(m=>{if(m.id===f){const v=typeof d=="function"?d(m):d;return h.replace&&Fl(v)?v:{...m,...v}}return m}))},l=(f,d,h={replace:!1})=>{s(g=>g.map(m=>{if(m.id===f){const v=typeof d=="function"?d(m):d;return h.replace&&pE(v)?v:{...m,...v}}return m}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>o(f)?.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(),[g,m,v]=h;return{nodes:f.map(y=>({...y})),edges:d.map(y=>({...y})),viewport:{x:g,y:m,zoom:v}}},deleteElements:async({nodes:f=[],edges:d=[]})=>{const{nodes:h,edges:g,onNodesDelete:m,onEdgesDelete:v,triggerNodeChanges:y,triggerEdgeChanges:b,onDelete:p,onBeforeDelete:_}=t.getState(),{nodes:x,edges:w}=await Bx({nodesToRemove:f,edgesToRemove:d,nodes:h,edges:g,onBeforeDelete:_}),E=w.length>0,R=x.length>0;if(E){const C=w.map(Dl);v?.(w),b(C)}if(R){const C=x.map(Dl);m?.(x),y(C)}return(R||E)&&p?.({nodes:x,edges:w}),{deletedNodes:x,deletedEdges:w}},getIntersectingNodes:(f,d=!0,h)=>{const g=ll(f),m=g?f:c(f),v=h!==void 0;return m?(h||t.getState().nodes).filter(y=>{const b=t.getState().nodeLookup.get(y.id);if(b&&!g&&(y.id===f.id||!b.internals.positionAbsolute))return!1;const p=_t(v?y:b),_=Bt(p,m);return d&&_>0||_>=p.width*p.height||_>=m.width*m.height}):[]},isNodeIntersecting:(f,d,h=!0)=>{const m=ll(f)?f:c(f);if(!m)return!1;const v=Bt(m,d);return h&&v>0||v>=d.width*d.height||v>=m.width*m.height},updateNode:u,updateNodeData:(f,d,h={replace:!1})=>{u(f,g=>{const m=typeof d=="function"?d(g):d;return h.replace?{...g,data:m}:{...g,data:{...g.data,...m}}},h)},updateEdge:l,updateEdgeData:(f,d,h={replace:!1})=>{l(f,g=>{const m=typeof d=="function"?d(g):d;return h.replace?{...g,data:m}:{...g,data:{...g.data,...m}}},h)},getNodesBounds:f=>{const{nodeLookup:d,nodeOrigin:h}=t.getState();return Fx(f,{nodeLookup:d,nodeOrigin:h})},getHandleConnections:({type:f,id:d,nodeId:h})=>Array.from(t.getState().connectionLookup.get(`${h}-${f}${d?`-${d}`:""}`)?.values()??[]),getNodeConnections:({type:f,handleId:d,nodeId:h})=>Array.from(t.getState().connectionLookup.get(`${h}${f?d?`-${f}-${d}`:`-${f}`:""}`)?.values()??[]),fitView:async f=>{const d=t.getState().fitViewResolver??Ux();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:d}),n.nodeQueue.push(h=>[...h]),d.promise}}},[]);return $.useMemo(()=>({...i,...e,viewportInitialized:r}),[r])}const $l=e=>e.selected,bE=typeof window<"u"?window:void 0;function wE({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=oe(),{deleteElements:r}=mc(),i=Vt(e,{actInsideInputWithModifier:!1}),o=Vt(t,{target:bE});$.useEffect(()=>{if(i){const{edges:a,nodes:s}=n.getState();r({nodes:s.filter($l),edges:a.filter($l)}),n.setState({nodesSelectionActive:!1})}},[i]),$.useEffect(()=>{n.setState({multiSelectionActive:o})},[o])}function xE(e){const t=oe();$.useEffect(()=>{const n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;const r=fc(e.current);(r.height===0||r.width===0)&&t.getState().onError?.("004",Ae.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 jn={position:"absolute",width:"100%",height:"100%",top:0,left:0},EE=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function SE({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:o=et.Free,zoomOnDoubleClick:a=!0,panOnDrag:s=!0,defaultViewport:c,translateExtent:u,minZoom:l,maxZoom:f,zoomActivationKeyCode:d,preventScrolling:h=!0,children:g,noWheelClassName:m,noPanClassName:v,onViewportChange:y,isControlledViewport:b,paneClickDistance:p,selectionOnDrag:_}){const x=oe(),w=$.useRef(null),{userSelectionActive:E,lib:R,connectionInProgress:C}=ne(EE,ie),T=Vt(d),q=$.useRef();xE(w);const M=$.useCallback(k=>{y?.({x:k[0],y:k[1],zoom:k[2]}),b||x.setState({transform:k})},[y,b]);return $.useEffect(()=>{if(w.current){q.current=N1({domNode:w.current,minZoom:l,maxZoom:f,translateExtent:u,viewport:c,onDraggingChange:N=>x.setState({paneDragging:N}),onPanZoomStart:(N,L)=>{const{onViewportChangeStart:P,onMoveStart:D}=x.getState();D?.(N,L),P?.(L)},onPanZoom:(N,L)=>{const{onViewportChange:P,onMove:D}=x.getState();D?.(N,L),P?.(L)},onPanZoomEnd:(N,L)=>{const{onViewportChangeEnd:P,onMoveEnd:D}=x.getState();D?.(N,L),P?.(L)}});const{x:k,y:S,zoom:A}=q.current.getViewport();return x.setState({panZoom:q.current,transform:[k,S,A],domNode:w.current.closest(".react-flow")}),()=>{q.current?.destroy()}}},[]),$.useEffect(()=>{q.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:o,zoomOnDoubleClick:a,panOnDrag:s,zoomActivationKeyPressed:T,preventScrolling:h,noPanClassName:v,userSelectionActive:E,noWheelClassName:m,lib:R,onTransformChange:M,connectionInProgress:C,selectionOnDrag:_,paneClickDistance:p})},[e,t,n,r,i,o,a,s,T,h,v,E,m,R,M,C,_,p]),F.jsx("div",{className:"react-flow__renderer",ref:w,style:jn,children:g})}const CE=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function qE(){const{userSelectionActive:e,userSelectionRect:t}=ne(CE,ie);return e&&t?F.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 wr=(e,t)=>n=>{n.target===t.current&&e?.(n)},RE=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function IE({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Ht.Full,panOnDrag:r,paneClickDistance:i,selectionOnDrag:o,onSelectionStart:a,onSelectionEnd:s,onPaneClick:c,onPaneContextMenu:u,onPaneScroll:l,onPaneMouseEnter:f,onPaneMouseMove:d,onPaneMouseLeave:h,children:g}){const m=oe(),{userSelectionActive:v,elementsSelectable:y,dragging:b,connectionInProgress:p}=ne(RE,ie),_=y&&(e||v),x=$.useRef(null),w=$.useRef(),E=$.useRef(new Set),R=$.useRef(new Set),C=$.useRef(!1),T=P=>{if(C.current||p){C.current=!1;return}c?.(P),m.getState().resetSelectedElements(),m.setState({nodesSelectionActive:!1})},q=P=>{if(Array.isArray(r)&&r?.includes(2)){P.preventDefault();return}u?.(P)},M=l?P=>l(P):void 0,k=P=>{C.current&&(P.stopPropagation(),C.current=!1)},S=P=>{const{domNode:D}=m.getState();if(w.current=D?.getBoundingClientRect(),!w.current)return;const j=P.target===x.current;if(!j&&!!P.target.closest(".nokey")||!e||!(o&&j||t)||P.button!==0||!P.isPrimary)return;P.target?.setPointerCapture?.(P.pointerId),C.current=!1;const{x:Y,y:I}=xe(P.nativeEvent,w.current);m.setState({userSelectionRect:{width:0,height:0,startX:Y,startY:I,x:Y,y:I}}),j||(P.stopPropagation(),P.preventDefault())},A=P=>{const{userSelectionRect:D,transform:j,nodeLookup:G,edgeLookup:V,connectionLookup:Y,triggerNodeChanges:I,triggerEdgeChanges:O,defaultEdgeOptions:z,resetSelectedElements:H}=m.getState();if(!w.current||!D)return;const{x:B,y:U}=xe(P.nativeEvent,w.current),{startX:X,startY:J}=D;if(!C.current){const re=t?0:i;if(Math.hypot(B-X,U-J)<=re)return;H(),a?.(P)}C.current=!0;const Q={startX:X,startY:J,x:B<X?B:X,y:U<J?U:J,width:Math.abs(B-X),height:Math.abs(U-J)},W=E.current,te=R.current;E.current=new Set(cc(G,Q,j,n===Ht.Partial,!0).map(re=>re.id)),R.current=new Set;const K=z?.selectable??!0;for(const re of E.current){const ee=Y.get(re);if(ee)for(const{edgeId:fe}of ee.values()){const le=V.get(fe);le&&(le.selectable??K)&&R.current.add(fe)}}if(!fl(W,E.current)){const re=dt(G,E.current,!0);I(re)}if(!fl(te,R.current)){const re=dt(V,R.current);O(re)}m.setState({userSelectionRect:Q,userSelectionActive:!0,nodesSelectionActive:!1})},N=P=>{P.button===0&&(P.target?.releasePointerCapture?.(P.pointerId),!v&&P.target===x.current&&m.getState().userSelectionRect&&T?.(P),m.setState({userSelectionActive:!1,userSelectionRect:null}),C.current&&(s?.(P),m.setState({nodesSelectionActive:E.current.size>0})))},L=r===!0||Array.isArray(r)&&r.includes(0);return F.jsxs("div",{className:ue(["react-flow__pane",{draggable:L,dragging:b,selection:e}]),onClick:_?void 0:wr(T,x),onContextMenu:wr(q,x),onWheel:wr(M,x),onPointerEnter:_?void 0:f,onPointerMove:_?A:d,onPointerUp:_?N:void 0,onPointerDownCapture:_?S:void 0,onClickCapture:_?k:void 0,onPointerLeave:h,ref:x,style:jn,children:[g,F.jsx(qE,{})]})}function ec({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:i,unselectNodesAndEdges:o,multiSelectionActive:a,nodeLookup:s,onError:c}=t.getState(),u=s.get(e);if(!u){c?.("012",Ae.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&a)&&(o({nodes:[u],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function km({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:o,nodeClickDistance:a}){const s=oe(),[c,u]=$.useState(!1),l=$.useRef();return $.useEffect(()=>{l.current=g1({getStoreItems:()=>s.getState(),onNodeMouseDown:f=>{ec({id:f,store:s,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),$.useEffect(()=>{if(t)l.current?.destroy();else if(e.current)return l.current?.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:o,nodeId:i,nodeClickDistance:a}),()=>{l.current?.destroy()}},[n,r,t,o,e,i]),c}const NE=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function Om(){const e=oe();return $.useCallback(n=>{const{nodeExtent:r,snapToGrid:i,snapGrid:o,nodesDraggable:a,onError:s,updateNodePositions:c,nodeLookup:u,nodeOrigin:l}=e.getState(),f=new Map,d=NE(a),h=i?o[0]:5,g=i?o[1]:5,m=n.direction.x*h*n.factor,v=n.direction.y*g*n.factor;for(const[,y]of u){if(!d(y))continue;let b={x:y.internals.positionAbsolute.x+m,y:y.internals.positionAbsolute.y+v};i&&(b=Xt(b,o));const{position:p,positionAbsolute:_}=em({nodeId:y.id,nextPosition:b,nodeLookup:u,nodeExtent:r,nodeOrigin:l,onError:s});y.position=p,y.internals.positionAbsolute=_,f.set(y.id,y)}c(f)},[])}const yc=$.createContext(null),AE=yc.Provider;yc.Consumer;const Lm=()=>$.useContext(yc),ME=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),TE=(e,t,n)=>r=>{const{connectionClickStartHandle:i,connectionMode:o,connection:a}=r,{fromHandle:s,toHandle:c,isValid:u}=a,l=c?.nodeId===e&&c?.id===t&&c?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:l,clickConnecting:i?.nodeId===e&&i?.id===t&&i?.type===n,isPossibleEndHandle:o===mt.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:l&&u}};function PE({type:e="source",position:t=Z.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:o=!0,id:a,onConnect:s,children:c,className:u,onMouseDown:l,onTouchStart:f,...d},h){const g=a||null,m=e==="target",v=oe(),y=Lm(),{connectOnClick:b,noPanClassName:p,rfId:_}=ne(ME,ie),{connectingFrom:x,connectingTo:w,clickConnecting:E,isPossibleEndHandle:R,connectionInProcess:C,clickConnectionInProcess:T,valid:q}=ne(TE(y,g,e),ie);y||v.getState().onError?.("010",Ae.error010());const M=A=>{const{defaultEdgeOptions:N,onConnect:L,hasDefaultEdges:P}=v.getState(),D={...N,...A};if(P){const{edges:j,setEdges:G}=v.getState();G(Jx(D,j))}L?.(D),s?.(D)},k=A=>{if(!y)return;const N=um(A.nativeEvent);if(i&&(N&&A.button===0||!N)){const L=v.getState();Ju.onPointerDown(A.nativeEvent,{handleDomNode:A.currentTarget,autoPanOnConnect:L.autoPanOnConnect,connectionMode:L.connectionMode,connectionRadius:L.connectionRadius,domNode:L.domNode,nodeLookup:L.nodeLookup,lib:L.lib,isTarget:m,handleId:g,nodeId:y,flowId:L.rfId,panBy:L.panBy,cancelConnection:L.cancelConnection,onConnectStart:L.onConnectStart,onConnectEnd:L.onConnectEnd,updateConnection:L.updateConnection,onConnect:M,isValidConnection:n||L.isValidConnection,getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,autoPanSpeed:L.autoPanSpeed,dragThreshold:L.connectionDragThreshold})}N?l?.(A):f?.(A)},S=A=>{const{onClickConnectStart:N,onClickConnectEnd:L,connectionClickStartHandle:P,connectionMode:D,isValidConnection:j,lib:G,rfId:V,nodeLookup:Y,connection:I}=v.getState();if(!y||!P&&!i)return;if(!P){N?.(A.nativeEvent,{nodeId:y,handleId:g,handleType:e}),v.setState({connectionClickStartHandle:{nodeId:y,type:e,id:g}});return}const O=am(A.target),z=n||j,{connection:H,isValid:B}=Ju.isValid(A.nativeEvent,{handle:{nodeId:y,id:g,type:e},connectionMode:D,fromNodeId:P.nodeId,fromHandleId:P.id||null,fromType:P.type,isValidConnection:z,flowId:V,doc:O,lib:G,nodeLookup:Y});B&&H&&M(H);const U=structuredClone(I);delete U.inProgress,U.toPosition=U.toHandle?U.toHandle.position:null,L?.(A,U),v.setState({connectionClickStartHandle:null})};return F.jsx("div",{"data-handleid":g,"data-nodeid":y,"data-handlepos":t,"data-id":`${_}-${y}-${g}-${e}`,className:ue(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",p,u,{source:!m,target:m,connectable:r,connectablestart:i,connectableend:o,clickconnecting:E,connectingfrom:x,connectingto:w,valid:q,connectionindicator:r&&(!C||R)&&(C||T?o:i)}]),onMouseDown:k,onTouchStart:k,onClick:b?S:void 0,ref:h,...d,children:c})}const An=$.memo(Tm(PE));function kE({data:e,isConnectable:t,sourcePosition:n=Z.Bottom}){return F.jsxs(F.Fragment,{children:[e?.label,F.jsx(An,{type:"source",position:n,isConnectable:t})]})}function OE({data:e,isConnectable:t,targetPosition:n=Z.Top,sourcePosition:r=Z.Bottom}){return F.jsxs(F.Fragment,{children:[F.jsx(An,{type:"target",position:n,isConnectable:t}),e?.label,F.jsx(An,{type:"source",position:r,isConnectable:t})]})}function LE(){return null}function DE({data:e,isConnectable:t,targetPosition:n=Z.Top}){return F.jsxs(F.Fragment,{children:[F.jsx(An,{type:"target",position:n,isConnectable:t}),e?.label]})}const Mn={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Hl={input:kE,default:OE,output:DE,group:LE};function FE(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}const zE=e=>{const{width:t,height:n,x:r,y:i}=Wt(e.nodeLookup,{filter:o=>!!o.selected});return{width:we(t)?t:null,height:we(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 $E({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=oe(),{width:i,height:o,transformString:a,userSelectionActive:s}=ne(zE,ie),c=Om(),u=$.useRef(null);if($.useEffect(()=>{n||u.current?.focus({preventScroll:!0})},[n]),km({nodeRef:u}),s||!i||!o)return null;const l=e?d=>{const h=r.getState().nodes.filter(g=>g.selected);e(d,h)}:void 0,f=d=>{Object.prototype.hasOwnProperty.call(Mn,d.key)&&(d.preventDefault(),c({direction:Mn[d.key],factor:d.shiftKey?4:1}))};return F.jsx("div",{className:ue(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:F.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:l,tabIndex:n?void 0:-1,onKeyDown:n?void 0:f,style:{width:i,height:o}})})}const Bl=typeof window<"u"?window:void 0,HE=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Dm({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:o,onPaneScroll:a,paneClickDistance:s,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:l,selectionMode:f,onSelectionStart:d,onSelectionEnd:h,multiSelectionKeyCode:g,panActivationKeyCode:m,zoomActivationKeyCode:v,elementsSelectable:y,zoomOnScroll:b,zoomOnPinch:p,panOnScroll:_,panOnScrollSpeed:x,panOnScrollMode:w,zoomOnDoubleClick:E,panOnDrag:R,defaultViewport:C,translateExtent:T,minZoom:q,maxZoom:M,preventScrolling:k,onSelectionContextMenu:S,noWheelClassName:A,noPanClassName:N,disableKeyboardA11y:L,onViewportChange:P,isControlledViewport:D}){const{nodesSelectionActive:j,userSelectionActive:G}=ne(HE,ie),V=Vt(u,{target:Bl}),Y=Vt(m,{target:Bl}),I=Y||R,O=Y||_,z=l&&I!==!0,H=V||G||z;return wE({deleteKeyCode:c,multiSelectionKeyCode:g}),F.jsx(SE,{onPaneContextMenu:o,elementsSelectable:y,zoomOnScroll:b,zoomOnPinch:p,panOnScroll:O,panOnScrollSpeed:x,panOnScrollMode:w,zoomOnDoubleClick:E,panOnDrag:!V&&I,defaultViewport:C,translateExtent:T,minZoom:q,maxZoom:M,zoomActivationKeyCode:v,preventScrolling:k,noWheelClassName:A,noPanClassName:N,onViewportChange:P,isControlledViewport:D,paneClickDistance:s,selectionOnDrag:z,children:F.jsxs(IE,{onSelectionStart:d,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:o,onPaneScroll:a,panOnDrag:I,isSelecting:!!H,selectionMode:f,selectionKeyPressed:V,paneClickDistance:s,selectionOnDrag:z,children:[e,j&&F.jsx($E,{onSelectionContextMenu:S,noPanClassName:N,disableKeyboardA11y:L})]})})}Dm.displayName="FlowRenderer";const BE=$.memo(Dm),jE=e=>t=>e?cc(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 VE(e){return ne($.useCallback(jE(e),[e]),ie)}const GE=e=>e.updateNodeInternals;function UE(){const e=ne(GE),[t]=$.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 $.useEffect(()=>()=>{t?.disconnect()},[t]),t}function YE({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const i=oe(),o=$.useRef(null),a=$.useRef(null),s=$.useRef(e.sourcePosition),c=$.useRef(e.targetPosition),u=$.useRef(t),l=n&&!!e.internals.handleBounds;return $.useEffect(()=>{o.current&&!e.hidden&&(!l||a.current!==o.current)&&(a.current&&r?.unobserve(a.current),r?.observe(o.current),a.current=o.current)},[l,e.hidden]),$.useEffect(()=>()=>{a.current&&(r?.unobserve(a.current),a.current=null)},[]),$.useEffect(()=>{if(o.current){const f=u.current!==t,d=s.current!==e.sourcePosition,h=c.current!==e.targetPosition;(f||d||h)&&(u.current=t,s.current=e.sourcePosition,c.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 WE({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:o,onDoubleClick:a,nodesDraggable:s,elementsSelectable:c,nodesConnectable:u,nodesFocusable:l,resizeObserver:f,noDragClassName:d,noPanClassName:h,disableKeyboardA11y:g,rfId:m,nodeTypes:v,nodeClickDistance:y,onError:b}){const{node:p,internals:_,isParent:x}=ne(B=>{const U=B.nodeLookup.get(e),X=B.parentLookup.has(e);return{node:U,internals:U.internals,isParent:X}},ie);let w=p.type||"default",E=v?.[w]||Hl[w];E===void 0&&(b?.("003",Ae.error003(w)),w="default",E=v?.default||Hl.default);const R=!!(p.draggable||s&&typeof p.draggable>"u"),C=!!(p.selectable||c&&typeof p.selectable>"u"),T=!!(p.connectable||u&&typeof p.connectable>"u"),q=!!(p.focusable||l&&typeof p.focusable>"u"),M=oe(),k=im(p),S=YE({node:p,nodeType:w,hasDimensions:k,resizeObserver:f}),A=km({nodeRef:S,disabled:p.hidden||!R,noDragClassName:d,handleSelector:p.dragHandle,nodeId:e,isSelectable:C,nodeClickDistance:y}),N=Om();if(p.hidden)return null;const L=$e(p),P=FE(p),D=C||R||t||n||r||i,j=n?B=>n(B,{..._.userNode}):void 0,G=r?B=>r(B,{..._.userNode}):void 0,V=i?B=>i(B,{..._.userNode}):void 0,Y=o?B=>o(B,{..._.userNode}):void 0,I=a?B=>a(B,{..._.userNode}):void 0,O=B=>{const{selectNodesOnDrag:U,nodeDragThreshold:X}=M.getState();C&&(!U||!R||X>0)&&ec({id:e,store:M,nodeRef:S}),t&&t(B,{..._.userNode})},z=B=>{if(!(sm(B.nativeEvent)||g)){if(Xv.includes(B.key)&&C){const U=B.key==="Escape";ec({id:e,store:M,unselect:U,nodeRef:S})}else if(R&&p.selected&&Object.prototype.hasOwnProperty.call(Mn,B.key)){B.preventDefault();const{ariaLabelConfig:U}=M.getState();M.setState({ariaLiveMessage:U["node.a11yDescription.ariaLiveMessage"]({direction:B.key.replace("Arrow","").toLowerCase(),x:~~_.positionAbsolute.x,y:~~_.positionAbsolute.y})}),N({direction:Mn[B.key],factor:B.shiftKey?4:1})}}},H=()=>{if(g||!S.current?.matches(":focus-visible"))return;const{transform:B,width:U,height:X,autoPanOnNodeFocus:J,setCenter:Q}=M.getState();if(!J)return;cc(new Map([[e,p]]),{x:0,y:0,width:U,height:X},B,!0).length>0||Q(p.position.x+L.width/2,p.position.y+L.height/2,{zoom:B[2]})};return F.jsx("div",{className:ue(["react-flow__node",`react-flow__node-${w}`,{[h]:R},p.className,{selected:p.selected,selectable:C,parent:x,draggable:R,dragging:A}]),ref:S,style:{zIndex:_.z,transform:`translate(${_.positionAbsolute.x}px,${_.positionAbsolute.y}px)`,pointerEvents:D?"all":"none",visibility:k?"visible":"hidden",...p.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:j,onMouseMove:G,onMouseLeave:V,onContextMenu:Y,onClick:O,onDoubleClick:I,onKeyDown:q?z:void 0,tabIndex:q?0:void 0,onFocus:q?H:void 0,role:p.ariaRole??(q?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${qm}-${m}`,"aria-label":p.ariaLabel,...p.domAttributes,children:F.jsx(AE,{value:e,children:F.jsx(E,{id:e,data:p.data,type:w,positionAbsoluteX:_.positionAbsolute.x,positionAbsoluteY:_.positionAbsolute.y,selected:p.selected??!1,selectable:C,draggable:R,deletable:p.deletable??!0,isConnectable:T,sourcePosition:p.sourcePosition,targetPosition:p.targetPosition,dragging:A,dragHandle:p.dragHandle,zIndex:_.z,parentId:p.parentId,...L})})})}var XE=$.memo(WE);const KE=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Fm(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,onError:o}=ne(KE,ie),a=VE(e.onlyRenderVisibleElements),s=UE();return F.jsx("div",{className:"react-flow__nodes",style:jn,children:a.map(c=>F.jsx(XE,{id:c,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},c))})}Fm.displayName="NodeRenderer";const ZE=$.memo(Fm);function QE(e){return ne($.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&&Kx({sourceNode:o,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&r.push(i.id)}return r},[e]),ie)}const JE=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return F.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},eS=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return F.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},jl={[Rn.Arrow]:JE,[Rn.ArrowClosed]:eS};function tS(e){const t=oe();return $.useMemo(()=>Object.prototype.hasOwnProperty.call(jl,e)?jl[e]:(t.getState().onError?.("009",Ae.error009(e)),null),[e])}const nS=({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 c=tS(t);return c?F.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:F.jsx(c,{color:n,strokeWidth:a})}):null},zm=({defaultColor:e,rfId:t})=>{const n=ne(o=>o.edges),r=ne(o=>o.defaultEdgeOptions),i=$.useMemo(()=>i1(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?F.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:F.jsx("defs",{children:i.map(o=>F.jsx(nS,{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};zm.displayName="MarkerDefinitions";var rS=$.memo(zm);function $m({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:o,labelBgPadding:a=[2,4],labelBgBorderRadius:s=2,children:c,className:u,...l}){const[f,d]=$.useState({x:1,y:0,width:0,height:0}),h=ue(["react-flow__edge-textwrapper",u]),g=$.useRef(null);return $.useEffect(()=>{if(g.current){const m=g.current.getBBox();d({x:m.x,y:m.y,width:m.width,height:m.height})}},[n]),n?F.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:h,visibility:f.width?"visible":"hidden",...l,children:[i&&F.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}),F.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:g,style:r,children:n}),c]}):null}$m.displayName="EdgeText";const iS=$.memo($m);function Vn({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:o,labelBgStyle:a,labelBgPadding:s,labelBgBorderRadius:c,interactionWidth:u=20,...l}){return F.jsxs(F.Fragment,{children:[F.jsx("path",{...l,d:e,fill:"none",className:ue(["react-flow__edge-path",l.className])}),u?F.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,r&&we(t)&&we(n)?F.jsx(iS,{x:t,y:n,label:r,labelStyle:i,labelShowBg:o,labelBgStyle:a,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function Vl({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===Z.Left||e===Z.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function Hm({sourceX:e,sourceY:t,sourcePosition:n=Z.Bottom,targetX:r,targetY:i,targetPosition:o=Z.Top}){const[a,s]=Vl({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,u]=Vl({pos:o,x1:r,y1:i,x2:e,y2:t}),[l,f,d,h]=cm({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:a,sourceControlY:s,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${s} ${c},${u} ${r},${i}`,l,f,d,h]}function Bm(e){return $.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:o,sourcePosition:a,targetPosition:s,label:c,labelStyle:u,labelShowBg:l,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:h,style:g,markerEnd:m,markerStart:v,interactionWidth:y})=>{const[b,p,_]=Hm({sourceX:n,sourceY:r,sourcePosition:a,targetX:i,targetY:o,targetPosition:s}),x=e.isInternal?void 0:t;return F.jsx(Vn,{id:x,path:b,labelX:p,labelY:_,label:c,labelStyle:u,labelShowBg:l,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:h,style:g,markerEnd:m,markerStart:v,interactionWidth:y})})}const oS=Bm({isInternal:!1}),jm=Bm({isInternal:!0});oS.displayName="SimpleBezierEdge";jm.displayName="SimpleBezierEdgeInternal";function Vm(e){return $.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:o,label:a,labelStyle:s,labelShowBg:c,labelBgStyle:u,labelBgPadding:l,labelBgBorderRadius:f,style:d,sourcePosition:h=Z.Bottom,targetPosition:g=Z.Top,markerEnd:m,markerStart:v,pathOptions:y,interactionWidth:b})=>{const[p,_,x]=Ku({sourceX:n,sourceY:r,sourcePosition:h,targetX:i,targetY:o,targetPosition:g,borderRadius:y?.borderRadius,offset:y?.offset,stepPosition:y?.stepPosition}),w=e.isInternal?void 0:t;return F.jsx(Vn,{id:w,path:p,labelX:_,labelY:x,label:a,labelStyle:s,labelShowBg:c,labelBgStyle:u,labelBgPadding:l,labelBgBorderRadius:f,style:d,markerEnd:m,markerStart:v,interactionWidth:b})})}const Gm=Vm({isInternal:!1}),Um=Vm({isInternal:!0});Gm.displayName="SmoothStepEdge";Um.displayName="SmoothStepEdgeInternal";function Ym(e){return $.memo(({id:t,...n})=>{const r=e.isInternal?void 0:t;return F.jsx(Gm,{...n,id:r,pathOptions:$.useMemo(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}const aS=Ym({isInternal:!1}),Wm=Ym({isInternal:!0});aS.displayName="StepEdge";Wm.displayName="StepEdgeInternal";function Xm(e){return $.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:o,label:a,labelStyle:s,labelShowBg:c,labelBgStyle:u,labelBgPadding:l,labelBgBorderRadius:f,style:d,markerEnd:h,markerStart:g,interactionWidth:m})=>{const[v,y,b]=dm({sourceX:n,sourceY:r,targetX:i,targetY:o}),p=e.isInternal?void 0:t;return F.jsx(Vn,{id:p,path:v,labelX:y,labelY:b,label:a,labelStyle:s,labelShowBg:c,labelBgStyle:u,labelBgPadding:l,labelBgBorderRadius:f,style:d,markerEnd:h,markerStart:g,interactionWidth:m})})}const sS=Xm({isInternal:!1}),Km=Xm({isInternal:!0});sS.displayName="StraightEdge";Km.displayName="StraightEdgeInternal";function Zm(e){return $.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:o,sourcePosition:a=Z.Bottom,targetPosition:s=Z.Top,label:c,labelStyle:u,labelShowBg:l,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:h,style:g,markerEnd:m,markerStart:v,pathOptions:y,interactionWidth:b})=>{const[p,_,x]=lm({sourceX:n,sourceY:r,sourcePosition:a,targetX:i,targetY:o,targetPosition:s,curvature:y?.curvature}),w=e.isInternal?void 0:t;return F.jsx(Vn,{id:w,path:p,labelX:_,labelY:x,label:c,labelStyle:u,labelShowBg:l,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:h,style:g,markerEnd:m,markerStart:v,interactionWidth:b})})}const uS=Zm({isInternal:!1}),Qm=Zm({isInternal:!0});uS.displayName="BezierEdge";Qm.displayName="BezierEdgeInternal";const Gl={default:Qm,straight:Km,step:Wm,smoothstep:Um,simplebezier:jm},Ul={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},cS=(e,t,n)=>n===Z.Left?e-t:n===Z.Right?e+t:e,lS=(e,t,n)=>n===Z.Top?e-t:n===Z.Bottom?e+t:e,Yl="react-flow__edgeupdater";function Wl({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:o,onMouseOut:a,type:s}){return F.jsx("circle",{onMouseDown:i,onMouseEnter:o,onMouseOut:a,className:ue([Yl,`${Yl}-${s}`]),cx:cS(t,r,e),cy:lS(n,r,e),r,stroke:"transparent",fill:"transparent"})}function fS({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:o,targetY:a,sourcePosition:s,targetPosition:c,onReconnect:u,onReconnectStart:l,onReconnectEnd:f,setReconnecting:d,setUpdateHover:h}){const g=oe(),m=(_,x)=>{if(_.button!==0)return;const{autoPanOnConnect:w,domNode:E,isValidConnection:R,connectionMode:C,connectionRadius:T,lib:q,onConnectStart:M,onConnectEnd:k,cancelConnection:S,nodeLookup:A,rfId:N,panBy:L,updateConnection:P}=g.getState(),D=x.type==="target",j=(Y,I)=>{d(!1),f?.(Y,n,x.type,I)},G=Y=>u?.(n,Y),V=(Y,I)=>{d(!0),l?.(_,n,x.type),M?.(Y,I)};Ju.onPointerDown(_.nativeEvent,{autoPanOnConnect:w,connectionMode:C,connectionRadius:T,domNode:E,handleId:x.id,nodeId:x.nodeId,nodeLookup:A,isTarget:D,edgeUpdaterType:x.type,lib:q,flowId:N,cancelConnection:S,panBy:L,isValidConnection:R,onConnect:G,onConnectStart:V,onConnectEnd:k,onReconnectEnd:j,updateConnection:P,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:_.currentTarget})},v=_=>m(_,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),y=_=>m(_,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),b=()=>h(!0),p=()=>h(!1);return F.jsxs(F.Fragment,{children:[(e===!0||e==="source")&&F.jsx(Wl,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:v,onMouseEnter:b,onMouseOut:p,type:"source"}),(e===!0||e==="target")&&F.jsx(Wl,{position:c,centerX:o,centerY:a,radius:t,onMouseDown:y,onMouseEnter:b,onMouseOut:p,type:"target"})]})}function dS({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:o,onContextMenu:a,onMouseEnter:s,onMouseMove:c,onMouseLeave:u,reconnectRadius:l,onReconnect:f,onReconnectStart:d,onReconnectEnd:h,rfId:g,edgeTypes:m,noPanClassName:v,onError:y,disableKeyboardA11y:b}){let p=ne(Q=>Q.edgeLookup.get(e));const _=ne(Q=>Q.defaultEdgeOptions);p=_?{..._,...p}:p;let x=p.type||"default",w=m?.[x]||Gl[x];w===void 0&&(y?.("011",Ae.error011(x)),x="default",w=m?.default||Gl.default);const E=!!(p.focusable||t&&typeof p.focusable>"u"),R=typeof f<"u"&&(p.reconnectable||n&&typeof p.reconnectable>"u"),C=!!(p.selectable||r&&typeof p.selectable>"u"),T=$.useRef(null),[q,M]=$.useState(!1),[k,S]=$.useState(!1),A=oe(),{zIndex:N,sourceX:L,sourceY:P,targetX:D,targetY:j,sourcePosition:G,targetPosition:V}=ne($.useCallback(Q=>{const W=Q.nodeLookup.get(p.source),te=Q.nodeLookup.get(p.target);if(!W||!te)return{zIndex:p.zIndex,...Ul};const K=r1({id:e,sourceNode:W,targetNode:te,sourceHandle:p.sourceHandle||null,targetHandle:p.targetHandle||null,connectionMode:Q.connectionMode,onError:y});return{zIndex:Xx({selected:p.selected,zIndex:p.zIndex,sourceNode:W,targetNode:te,elevateOnSelect:Q.elevateEdgesOnSelect,zIndexMode:Q.zIndexMode}),...K||Ul}},[p.source,p.target,p.sourceHandle,p.targetHandle,p.selected,p.zIndex]),ie),Y=$.useMemo(()=>p.markerStart?`url('#${Zu(p.markerStart,g)}')`:void 0,[p.markerStart,g]),I=$.useMemo(()=>p.markerEnd?`url('#${Zu(p.markerEnd,g)}')`:void 0,[p.markerEnd,g]);if(p.hidden||L===null||P===null||D===null||j===null)return null;const O=Q=>{const{addSelectedEdges:W,unselectNodesAndEdges:te,multiSelectionActive:K}=A.getState();C&&(A.setState({nodesSelectionActive:!1}),p.selected&&K?(te({nodes:[],edges:[p]}),T.current?.blur()):W([e])),i&&i(Q,p)},z=o?Q=>{o(Q,{...p})}:void 0,H=a?Q=>{a(Q,{...p})}:void 0,B=s?Q=>{s(Q,{...p})}:void 0,U=c?Q=>{c(Q,{...p})}:void 0,X=u?Q=>{u(Q,{...p})}:void 0,J=Q=>{if(!b&&Xv.includes(Q.key)&&C){const{unselectNodesAndEdges:W,addSelectedEdges:te}=A.getState();Q.key==="Escape"?(T.current?.blur(),W({edges:[p]})):te([e])}};return F.jsx("svg",{style:{zIndex:N},children:F.jsxs("g",{className:ue(["react-flow__edge",`react-flow__edge-${x}`,p.className,v,{selected:p.selected,animated:p.animated,inactive:!C&&!i,updating:q,selectable:C}]),onClick:O,onDoubleClick:z,onContextMenu:H,onMouseEnter:B,onMouseMove:U,onMouseLeave:X,onKeyDown:E?J:void 0,tabIndex:E?0:void 0,role:p.ariaRole??(E?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":p.ariaLabel===null?void 0:p.ariaLabel||`Edge from ${p.source} to ${p.target}`,"aria-describedby":E?`${Rm}-${g}`:void 0,ref:T,...p.domAttributes,children:[!k&&F.jsx(w,{id:e,source:p.source,target:p.target,type:p.type,selected:p.selected,animated:p.animated,selectable:C,deletable:p.deletable??!0,label:p.label,labelStyle:p.labelStyle,labelShowBg:p.labelShowBg,labelBgStyle:p.labelBgStyle,labelBgPadding:p.labelBgPadding,labelBgBorderRadius:p.labelBgBorderRadius,sourceX:L,sourceY:P,targetX:D,targetY:j,sourcePosition:G,targetPosition:V,data:p.data,style:p.style,sourceHandleId:p.sourceHandle,targetHandleId:p.targetHandle,markerStart:Y,markerEnd:I,pathOptions:"pathOptions"in p?p.pathOptions:void 0,interactionWidth:p.interactionWidth}),R&&F.jsx(fS,{edge:p,isReconnectable:R,reconnectRadius:l,onReconnect:f,onReconnectStart:d,onReconnectEnd:h,sourceX:L,sourceY:P,targetX:D,targetY:j,sourcePosition:G,targetPosition:V,setUpdateHover:M,setReconnecting:S})]})})}var hS=$.memo(dS);const pS=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Jm({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:o,onEdgeContextMenu:a,onEdgeMouseEnter:s,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:l,reconnectRadius:f,onEdgeDoubleClick:d,onReconnectStart:h,onReconnectEnd:g,disableKeyboardA11y:m}){const{edgesFocusable:v,edgesReconnectable:y,elementsSelectable:b,onError:p}=ne(pS,ie),_=QE(t);return F.jsxs("div",{className:"react-flow__edges",children:[F.jsx(rS,{defaultColor:e,rfId:n}),_.map(x=>F.jsx(hS,{id:x,edgesFocusable:v,edgesReconnectable:y,elementsSelectable:b,noPanClassName:i,onReconnect:o,onContextMenu:a,onMouseEnter:s,onMouseMove:c,onMouseLeave:u,onClick:l,reconnectRadius:f,onDoubleClick:d,onReconnectStart:h,onReconnectEnd:g,rfId:n,onError:p,edgeTypes:r,disableKeyboardA11y:m},x))]})}Jm.displayName="EdgeRenderer";const gS=$.memo(Jm),vS=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function mS({children:e}){const t=ne(vS);return F.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function yS(e){const t=mc(),n=$.useRef(!1);$.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const _S=e=>e.panZoom?.syncViewport;function bS(e){const t=ne(_S),n=oe();return $.useEffect(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function wS(e){return e.connection.inProgress?{...e.connection,to:Kt(e.connection.to,e.transform)}:{...e.connection}}function xS(e){return wS}function ES(e){const t=xS();return ne(t,ie)}const SS=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function CS({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:i,width:o,height:a,isValid:s,inProgress:c}=ne(SS,ie);return!(o&&i&&c)?null:F.jsx("svg",{style:e,width:o,height:a,className:"react-flow__connectionline react-flow__container",children:F.jsx("g",{className:ue(["react-flow__connection",Qv(s)]),children:F.jsx(ey,{style:t,type:n,CustomComponent:r,isValid:s})})})}const ey=({style:e,type:t=We.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:i,from:o,fromNode:a,fromHandle:s,fromPosition:c,to:u,toNode:l,toHandle:f,toPosition:d,pointer:h}=ES();if(!i)return;if(n)return F.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:a,fromHandle:s,fromX:o.x,fromY:o.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:d,connectionStatus:Qv(r),toNode:l,toHandle:f,pointer:h});let g="";const m={sourceX:o.x,sourceY:o.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:d};switch(t){case We.Bezier:[g]=lm(m);break;case We.SimpleBezier:[g]=Hm(m);break;case We.Step:[g]=Ku({...m,borderRadius:0});break;case We.SmoothStep:[g]=Ku(m);break;default:[g]=dm(m)}return F.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};ey.displayName="ConnectionLine";const qS={};function Xl(e=qS){$.useRef(e),oe(),$.useEffect(()=>{},[e])}function RS(){oe(),$.useRef(!1),$.useEffect(()=>{},[])}function ty({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:o,onEdgeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:l,onSelectionContextMenu:f,onSelectionStart:d,onSelectionEnd:h,connectionLineType:g,connectionLineStyle:m,connectionLineComponent:v,connectionLineContainerStyle:y,selectionKeyCode:b,selectionOnDrag:p,selectionMode:_,multiSelectionKeyCode:x,panActivationKeyCode:w,zoomActivationKeyCode:E,deleteKeyCode:R,onlyRenderVisibleElements:C,elementsSelectable:T,defaultViewport:q,translateExtent:M,minZoom:k,maxZoom:S,preventScrolling:A,defaultMarkerColor:N,zoomOnScroll:L,zoomOnPinch:P,panOnScroll:D,panOnScrollSpeed:j,panOnScrollMode:G,zoomOnDoubleClick:V,panOnDrag:Y,onPaneClick:I,onPaneMouseEnter:O,onPaneMouseMove:z,onPaneMouseLeave:H,onPaneScroll:B,onPaneContextMenu:U,paneClickDistance:X,nodeClickDistance:J,onEdgeContextMenu:Q,onEdgeMouseEnter:W,onEdgeMouseMove:te,onEdgeMouseLeave:K,reconnectRadius:re,onReconnect:ee,onReconnectStart:fe,onReconnectEnd:le,noDragClassName:Pe,noWheelClassName:qe,noPanClassName:de,disableKeyboardA11y:se,nodeExtent:je,rfId:ke,viewport:Ve,onViewportChange:Ge}){return Xl(e),Xl(t),RS(),yS(n),bS(Ve),F.jsx(BE,{onPaneClick:I,onPaneMouseEnter:O,onPaneMouseMove:z,onPaneMouseLeave:H,onPaneContextMenu:U,onPaneScroll:B,paneClickDistance:X,deleteKeyCode:R,selectionKeyCode:b,selectionOnDrag:p,selectionMode:_,onSelectionStart:d,onSelectionEnd:h,multiSelectionKeyCode:x,panActivationKeyCode:w,zoomActivationKeyCode:E,elementsSelectable:T,zoomOnScroll:L,zoomOnPinch:P,zoomOnDoubleClick:V,panOnScroll:D,panOnScrollSpeed:j,panOnScrollMode:G,panOnDrag:Y,defaultViewport:q,translateExtent:M,minZoom:k,maxZoom:S,onSelectionContextMenu:f,preventScrolling:A,noDragClassName:Pe,noWheelClassName:qe,noPanClassName:de,disableKeyboardA11y:se,onViewportChange:Ge,isControlledViewport:!!Ve,children:F.jsxs(mS,{children:[F.jsx(gS,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:a,onReconnect:ee,onReconnectStart:fe,onReconnectEnd:le,onlyRenderVisibleElements:C,onEdgeContextMenu:Q,onEdgeMouseEnter:W,onEdgeMouseMove:te,onEdgeMouseLeave:K,reconnectRadius:re,defaultMarkerColor:N,noPanClassName:de,disableKeyboardA11y:se,rfId:ke}),F.jsx(CS,{style:m,type:g,component:v,containerStyle:y}),F.jsx("div",{className:"react-flow__edgelabel-renderer"}),F.jsx(ZE,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:o,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:l,nodeClickDistance:J,onlyRenderVisibleElements:C,noPanClassName:de,noDragClassName:Pe,disableKeyboardA11y:se,nodeExtent:je,rfId:ke}),F.jsx("div",{className:"react-flow__viewport-portal"})]})})}ty.displayName="GraphView";const IS=$.memo(ty),Kl=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:o,fitView:a,fitViewOptions:s,minZoom:c=.5,maxZoom:u=2,nodeOrigin:l,nodeExtent:f,zIndexMode:d="basic"}={})=>{const h=new Map,g=new Map,m=new Map,v=new Map,y=r??t??[],b=n??e??[],p=l??[0,0],_=f??$t;gm(m,v,y);const x=Qu(b,h,g,{nodeOrigin:p,nodeExtent:_,zIndexMode:d});let w=[0,0,1];if(a&&i&&o){const E=Wt(h,{filter:q=>!!((q.width||q.initialWidth)&&(q.height||q.initialHeight))}),{x:R,y:C,zoom:T}=lc(E,i,o,c,u,s?.padding??.1);w=[R,C,T]}return{rfId:"1",width:i??0,height:o??0,transform:w,nodes:b,nodesInitialized:x,nodeLookup:h,parentLookup:g,edges:y,edgeLookup:v,connectionLookup:m,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:$t,nodeExtent:_,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:mt.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:p,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:{...Zv},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:jx,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Kv,zIndexMode:d,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},NS=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:o,fitView:a,fitViewOptions:s,minZoom:c,maxZoom:u,nodeOrigin:l,nodeExtent:f,zIndexMode:d})=>Y1((h,g)=>{async function m(){const{nodeLookup:v,panZoom:y,fitViewOptions:b,fitViewResolver:p,width:_,height:x,minZoom:w,maxZoom:E}=g();y&&(await Hx({nodes:v,width:_,height:x,panZoom:y,minZoom:w,maxZoom:E},b),p?.resolve(!0),h({fitViewResolver:null}))}return{...Kl({nodes:e,edges:t,width:i,height:o,fitView:a,fitViewOptions:s,minZoom:c,maxZoom:u,nodeOrigin:l,nodeExtent:f,defaultNodes:n,defaultEdges:r,zIndexMode:d}),setNodes:v=>{const{nodeLookup:y,parentLookup:b,nodeOrigin:p,elevateNodesOnSelect:_,fitViewQueued:x,zIndexMode:w}=g(),E=Qu(v,y,b,{nodeOrigin:p,nodeExtent:f,elevateNodesOnSelect:_,checkEquality:!0,zIndexMode:w});x&&E?(m(),h({nodes:v,nodesInitialized:E,fitViewQueued:!1,fitViewOptions:void 0})):h({nodes:v,nodesInitialized:E})},setEdges:v=>{const{connectionLookup:y,edgeLookup:b}=g();gm(y,b,v),h({edges:v})},setDefaultNodesAndEdges:(v,y)=>{if(v){const{setNodes:b}=g();b(v),h({hasDefaultNodes:!0})}if(y){const{setEdges:b}=g();b(y),h({hasDefaultEdges:!0})}},updateNodeInternals:v=>{const{triggerNodeChanges:y,nodeLookup:b,parentLookup:p,domNode:_,nodeOrigin:x,nodeExtent:w,debug:E,fitViewQueued:R,zIndexMode:C}=g(),{changes:T,updatedInternals:q}=f1(v,b,p,_,x,w,C);q&&(s1(b,p,{nodeOrigin:x,nodeExtent:w,zIndexMode:C}),R?(m(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),T?.length>0&&(E&&console.log("React Flow: trigger node changes",T),y?.(T)))},updateNodePositions:(v,y=!1)=>{const b=[];let p=[];const{nodeLookup:_,triggerNodeChanges:x,connection:w,updateConnection:E,onNodesChangeMiddlewareMap:R}=g();for(const[C,T]of v){const q=_.get(C),M=!!(q?.expandParent&&q?.parentId&&T?.position),k={id:C,type:"position",position:M?{x:Math.max(0,T.position.x),y:Math.max(0,T.position.y)}:T.position,dragging:y};if(q&&w.inProgress&&w.fromNode.id===q.id){const S=it(q,w.fromHandle,Z.Left,!0);E({...w,from:S})}M&&q.parentId&&b.push({id:C,parentId:q.parentId,rect:{...T.internals.positionAbsolute,width:T.measured.width??0,height:T.measured.height??0}}),p.push(k)}if(b.length>0){const{parentLookup:C,nodeOrigin:T}=g(),q=vc(b,_,C,T);p.push(...q)}for(const C of R.values())p=C(p);x(p)},triggerNodeChanges:v=>{const{onNodesChange:y,setNodes:b,nodes:p,hasDefaultNodes:_,debug:x}=g();if(v?.length){if(_){const w=Am(v,p);b(w)}x&&console.log("React Flow: trigger node changes",v),y?.(v)}},triggerEdgeChanges:v=>{const{onEdgesChange:y,setEdges:b,edges:p,hasDefaultEdges:_,debug:x}=g();if(v?.length){if(_){const w=Mm(v,p);b(w)}x&&console.log("React Flow: trigger edge changes",v),y?.(v)}},addSelectedNodes:v=>{const{multiSelectionActive:y,edgeLookup:b,nodeLookup:p,triggerNodeChanges:_,triggerEdgeChanges:x}=g();if(y){const w=v.map(E=>Ze(E,!0));_(w);return}_(dt(p,new Set([...v]),!0)),x(dt(b))},addSelectedEdges:v=>{const{multiSelectionActive:y,edgeLookup:b,nodeLookup:p,triggerNodeChanges:_,triggerEdgeChanges:x}=g();if(y){const w=v.map(E=>Ze(E,!0));x(w);return}x(dt(b,new Set([...v]))),_(dt(p,new Set,!0))},unselectNodesAndEdges:({nodes:v,edges:y}={})=>{const{edges:b,nodes:p,nodeLookup:_,triggerNodeChanges:x,triggerEdgeChanges:w}=g(),E=v||p,R=y||b,C=E.map(q=>{const M=_.get(q.id);return M&&(M.selected=!1),Ze(q.id,!1)}),T=R.map(q=>Ze(q.id,!1));x(C),w(T)},setMinZoom:v=>{const{panZoom:y,maxZoom:b}=g();y?.setScaleExtent([v,b]),h({minZoom:v})},setMaxZoom:v=>{const{panZoom:y,minZoom:b}=g();y?.setScaleExtent([b,v]),h({maxZoom:v})},setTranslateExtent:v=>{g().panZoom?.setTranslateExtent(v),h({translateExtent:v})},resetSelectedElements:()=>{const{edges:v,nodes:y,triggerNodeChanges:b,triggerEdgeChanges:p,elementsSelectable:_}=g();if(!_)return;const x=y.reduce((E,R)=>R.selected?[...E,Ze(R.id,!1)]:E,[]),w=v.reduce((E,R)=>R.selected?[...E,Ze(R.id,!1)]:E,[]);b(x),p(w)},setNodeExtent:v=>{const{nodes:y,nodeLookup:b,parentLookup:p,nodeOrigin:_,elevateNodesOnSelect:x,nodeExtent:w,zIndexMode:E}=g();v[0][0]===w[0][0]&&v[0][1]===w[0][1]&&v[1][0]===w[1][0]&&v[1][1]===w[1][1]||(Qu(y,b,p,{nodeOrigin:_,nodeExtent:v,elevateNodesOnSelect:x,checkEquality:!1,zIndexMode:E}),h({nodeExtent:v}))},panBy:v=>{const{transform:y,width:b,height:p,panZoom:_,translateExtent:x}=g();return d1({delta:v,panZoom:_,transform:y,translateExtent:x,width:b,height:p})},setCenter:async(v,y,b)=>{const{width:p,height:_,maxZoom:x,panZoom:w}=g();if(!w)return Promise.resolve(!1);const E=typeof b?.zoom<"u"?b.zoom:x;return await w.setViewport({x:p/2-v*E,y:_/2-y*E,zoom:E},{duration:b?.duration,ease:b?.ease,interpolate:b?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{h({connection:{...Zv}})},updateConnection:v=>{h({connection:v})},reset:()=>h({...Kl()})}},Object.is);function AS({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:o,initialMinZoom:a,initialMaxZoom:s,initialFitViewOptions:c,fitView:u,nodeOrigin:l,nodeExtent:f,zIndexMode:d,children:h}){const[g]=$.useState(()=>NS({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:o,fitView:u,minZoom:a,maxZoom:s,fitViewOptions:c,nodeOrigin:l,nodeExtent:f,zIndexMode:d}));return F.jsx(W1,{value:g,children:F.jsx(mE,{children:h})})}function MS({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:o,height:a,fitView:s,fitViewOptions:c,minZoom:u,maxZoom:l,nodeOrigin:f,nodeExtent:d,zIndexMode:h}){return $.useContext(Hn)?F.jsx(F.Fragment,{children:e}):F.jsx(AS,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:o,initialHeight:a,fitView:s,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:l,nodeOrigin:f,nodeExtent:d,zIndexMode:h,children:e})}const TS={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function PS({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:o,edgeTypes:a,onNodeClick:s,onEdgeClick:c,onInit:u,onMove:l,onMoveStart:f,onMoveEnd:d,onConnect:h,onConnectStart:g,onConnectEnd:m,onClickConnectStart:v,onClickConnectEnd:y,onNodeMouseEnter:b,onNodeMouseMove:p,onNodeMouseLeave:_,onNodeContextMenu:x,onNodeDoubleClick:w,onNodeDragStart:E,onNodeDrag:R,onNodeDragStop:C,onNodesDelete:T,onEdgesDelete:q,onDelete:M,onSelectionChange:k,onSelectionDragStart:S,onSelectionDrag:A,onSelectionDragStop:N,onSelectionContextMenu:L,onSelectionStart:P,onSelectionEnd:D,onBeforeDelete:j,connectionMode:G,connectionLineType:V=We.Bezier,connectionLineStyle:Y,connectionLineComponent:I,connectionLineContainerStyle:O,deleteKeyCode:z="Backspace",selectionKeyCode:H="Shift",selectionOnDrag:B=!1,selectionMode:U=Ht.Full,panActivationKeyCode:X="Space",multiSelectionKeyCode:J=jt()?"Meta":"Control",zoomActivationKeyCode:Q=jt()?"Meta":"Control",snapToGrid:W,snapGrid:te,onlyRenderVisibleElements:K=!1,selectNodesOnDrag:re,nodesDraggable:ee,autoPanOnNodeFocus:fe,nodesConnectable:le,nodesFocusable:Pe,nodeOrigin:qe=Im,edgesFocusable:de,edgesReconnectable:se,elementsSelectable:je=!0,defaultViewport:ke=sE,minZoom:Ve=.5,maxZoom:Ge=2,translateExtent:Oe=$t,preventScrolling:nn=!0,nodeExtent:ct,defaultMarkerColor:ur="#b1b1b7",zoomOnScroll:rn=!0,zoomOnPinch:Re=!0,panOnScroll:Le=!1,panOnScrollSpeed:i0=.5,panOnScrollMode:o0=et.Free,zoomOnDoubleClick:a0=!0,panOnDrag:s0=!0,onPaneClick:u0,onPaneMouseEnter:c0,onPaneMouseMove:l0,onPaneMouseLeave:f0,onPaneScroll:d0,onPaneContextMenu:h0,paneClickDistance:p0=1,nodeClickDistance:g0=0,children:v0,onReconnect:m0,onReconnectStart:y0,onReconnectEnd:_0,onEdgeContextMenu:b0,onEdgeDoubleClick:w0,onEdgeMouseEnter:x0,onEdgeMouseMove:E0,onEdgeMouseLeave:S0,reconnectRadius:C0=10,onNodesChange:q0,onEdgesChange:R0,noDragClassName:I0="nodrag",noWheelClassName:N0="nowheel",noPanClassName:Dc="nopan",fitView:Fc,fitViewOptions:zc,connectOnClick:A0,attributionPosition:M0,proOptions:T0,defaultEdgeOptions:P0,elevateNodesOnSelect:k0=!0,elevateEdgesOnSelect:O0=!1,disableKeyboardA11y:$c=!1,autoPanOnConnect:L0,autoPanOnNodeDrag:D0,autoPanSpeed:F0,connectionRadius:z0,isValidConnection:$0,onError:H0,style:B0,id:Hc,nodeDragThreshold:j0,connectionDragThreshold:V0,viewport:G0,onViewportChange:U0,width:Y0,height:W0,colorMode:X0="light",debug:K0,onScroll:Bc,ariaLabelConfig:Z0,zIndexMode:jc="basic",...Q0},J0){const cr=Hc||"1",e_=fE(X0),t_=$.useCallback(Vc=>{Vc.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Bc?.(Vc)},[Bc]);return F.jsx("div",{"data-testid":"rf__wrapper",...Q0,onScroll:t_,style:{...B0,...TS},ref:J0,className:ue(["react-flow",i,e_]),id:Hc,role:"application",children:F.jsxs(MS,{nodes:e,edges:t,width:Y0,height:W0,fitView:Fc,fitViewOptions:zc,minZoom:Ve,maxZoom:Ge,nodeOrigin:qe,nodeExtent:ct,zIndexMode:jc,children:[F.jsx(IS,{onInit:u,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:b,onNodeMouseMove:p,onNodeMouseLeave:_,onNodeContextMenu:x,onNodeDoubleClick:w,nodeTypes:o,edgeTypes:a,connectionLineType:V,connectionLineStyle:Y,connectionLineComponent:I,connectionLineContainerStyle:O,selectionKeyCode:H,selectionOnDrag:B,selectionMode:U,deleteKeyCode:z,multiSelectionKeyCode:J,panActivationKeyCode:X,zoomActivationKeyCode:Q,onlyRenderVisibleElements:K,defaultViewport:ke,translateExtent:Oe,minZoom:Ve,maxZoom:Ge,preventScrolling:nn,zoomOnScroll:rn,zoomOnPinch:Re,zoomOnDoubleClick:a0,panOnScroll:Le,panOnScrollSpeed:i0,panOnScrollMode:o0,panOnDrag:s0,onPaneClick:u0,onPaneMouseEnter:c0,onPaneMouseMove:l0,onPaneMouseLeave:f0,onPaneScroll:d0,onPaneContextMenu:h0,paneClickDistance:p0,nodeClickDistance:g0,onSelectionContextMenu:L,onSelectionStart:P,onSelectionEnd:D,onReconnect:m0,onReconnectStart:y0,onReconnectEnd:_0,onEdgeContextMenu:b0,onEdgeDoubleClick:w0,onEdgeMouseEnter:x0,onEdgeMouseMove:E0,onEdgeMouseLeave:S0,reconnectRadius:C0,defaultMarkerColor:ur,noDragClassName:I0,noWheelClassName:N0,noPanClassName:Dc,rfId:cr,disableKeyboardA11y:$c,nodeExtent:ct,viewport:G0,onViewportChange:U0}),F.jsx(lE,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:g,onConnectEnd:m,onClickConnectStart:v,onClickConnectEnd:y,nodesDraggable:ee,autoPanOnNodeFocus:fe,nodesConnectable:le,nodesFocusable:Pe,edgesFocusable:de,edgesReconnectable:se,elementsSelectable:je,elevateNodesOnSelect:k0,elevateEdgesOnSelect:O0,minZoom:Ve,maxZoom:Ge,nodeExtent:ct,onNodesChange:q0,onEdgesChange:R0,snapToGrid:W,snapGrid:te,connectionMode:G,translateExtent:Oe,connectOnClick:A0,defaultEdgeOptions:P0,fitView:Fc,fitViewOptions:zc,onNodesDelete:T,onEdgesDelete:q,onDelete:M,onNodeDragStart:E,onNodeDrag:R,onNodeDragStop:C,onSelectionDrag:A,onSelectionDragStart:S,onSelectionDragStop:N,onMove:l,onMoveStart:f,onMoveEnd:d,noPanClassName:Dc,nodeOrigin:qe,rfId:cr,autoPanOnConnect:L0,autoPanOnNodeDrag:D0,autoPanSpeed:F0,onError:H0,connectionRadius:z0,isValidConnection:$0,selectNodesOnDrag:re,nodeDragThreshold:j0,connectionDragThreshold:V0,onBeforeDelete:j,debug:K0,ariaLabelConfig:Z0,zIndexMode:jc}),F.jsx(aE,{onSelectionChange:k}),v0,F.jsx(tE,{proOptions:T0,position:M0}),F.jsx(eE,{rfId:cr,disableKeyboardA11y:$c})]})})}var wI=Tm(PS);function xI(e){const[t,n]=$.useState(e),r=$.useCallback(i=>n(o=>Am(i,o)),[]);return[t,n,r]}function EI(e){const[t,n]=$.useState(e),r=$.useCallback(i=>n(o=>Mm(i,o)),[]);return[t,n,r]}function kS({dimensions:e,lineWidth:t,variant:n,className:r}){return F.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:ue(["react-flow__background-pattern",n,r])})}function OS({radius:e,className:t}){return F.jsx("circle",{cx:e,cy:e,r:e,className:ue(["react-flow__background-pattern","dots",t])})}var Xe;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Xe||(Xe={}));const LS={[Xe.Dots]:1,[Xe.Lines]:1,[Xe.Cross]:6},DS=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function ny({id:e,variant:t=Xe.Dots,gap:n=20,size:r,lineWidth:i=1,offset:o=0,color:a,bgColor:s,style:c,className:u,patternClassName:l}){const f=$.useRef(null),{transform:d,patternId:h}=ne(DS,ie),g=r||LS[t],m=t===Xe.Dots,v=t===Xe.Cross,y=Array.isArray(n)?n:[n,n],b=[y[0]*d[2]||1,y[1]*d[2]||1],p=g*d[2],_=Array.isArray(o)?o:[o,o],x=v?[p,p]:b,w=[_[0]*d[2]||1+x[0]/2,_[1]*d[2]||1+x[1]/2],E=`${h}${e||""}`;return F.jsxs("svg",{className:ue(["react-flow__background",u]),style:{...c,...jn,"--xy-background-color-props":s,"--xy-background-pattern-color-props":a},ref:f,"data-testid":"rf__background",children:[F.jsx("pattern",{id:E,x:d[0]%b[0],y:d[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${w[0]},-${w[1]})`,children:m?F.jsx(OS,{radius:p/2,className:l}):F.jsx(kS,{dimensions:x,lineWidth:i,variant:t,className:l})}),F.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${E})`})]})}ny.displayName="Background";const SI=$.memo(ny);function FS(){return F.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:F.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function zS(){return F.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:F.jsx("path",{d:"M0 0h32v4.2H0z"})})}function $S(){return F.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:F.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 HS(){return F.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:F.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 BS(){return F.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:F.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 pn({children:e,className:t,...n}){return F.jsx("button",{type:"button",className:ue(["react-flow__controls-button",t]),...n,children:e})}const jS=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function ry({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:o,onZoomOut:a,onFitView:s,onInteractiveChange:c,className:u,children:l,position:f="bottom-left",orientation:d="vertical","aria-label":h}){const g=oe(),{isInteractive:m,minZoomReached:v,maxZoomReached:y,ariaLabelConfig:b}=ne(jS,ie),{zoomIn:p,zoomOut:_,fitView:x}=mc(),w=()=>{p(),o?.()},E=()=>{_(),a?.()},R=()=>{x(i),s?.()},C=()=>{g.setState({nodesDraggable:!m,nodesConnectable:!m,elementsSelectable:!m}),c?.(!m)},T=d==="horizontal"?"horizontal":"vertical";return F.jsxs(Bn,{className:ue(["react-flow__controls",T,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":h??b["controls.ariaLabel"],children:[t&&F.jsxs(F.Fragment,{children:[F.jsx(pn,{onClick:w,className:"react-flow__controls-zoomin",title:b["controls.zoomIn.ariaLabel"],"aria-label":b["controls.zoomIn.ariaLabel"],disabled:y,children:F.jsx(FS,{})}),F.jsx(pn,{onClick:E,className:"react-flow__controls-zoomout",title:b["controls.zoomOut.ariaLabel"],"aria-label":b["controls.zoomOut.ariaLabel"],disabled:v,children:F.jsx(zS,{})})]}),n&&F.jsx(pn,{className:"react-flow__controls-fitview",onClick:R,title:b["controls.fitView.ariaLabel"],"aria-label":b["controls.fitView.ariaLabel"],children:F.jsx($S,{})}),r&&F.jsx(pn,{className:"react-flow__controls-interactive",onClick:C,title:b["controls.interactive.ariaLabel"],"aria-label":b["controls.interactive.ariaLabel"],children:m?F.jsx(BS,{}):F.jsx(HS,{})}),l]})}ry.displayName="Controls";const CI=$.memo(ry);function VS({id:e,x:t,y:n,width:r,height:i,style:o,color:a,strokeColor:s,strokeWidth:c,className:u,borderRadius:l,shapeRendering:f,selected:d,onClick:h}){const{background:g,backgroundColor:m}=o||{},v=a||g||m;return F.jsx("rect",{className:ue(["react-flow__minimap-node",{selected:d},u]),x:t,y:n,rx:l,ry:l,width:r,height:i,style:{fill:v,stroke:s,strokeWidth:c},shapeRendering:f,onClick:h?y=>h(y,e):void 0})}const GS=$.memo(VS),US=e=>e.nodes.map(t=>t.id),xr=e=>e instanceof Function?e:()=>e;function YS({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:o=GS,onClick:a}){const s=ne(US,ie),c=xr(t),u=xr(e),l=xr(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return F.jsx(F.Fragment,{children:s.map(d=>F.jsx(XS,{id:d,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:l,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:o,onClick:a,shapeRendering:f},d))})}function WS({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:o,shapeRendering:a,NodeComponent:s,onClick:c}){const{node:u,x:l,y:f,width:d,height:h}=ne(g=>{const{internals:m}=g.nodeLookup.get(e),v=m.userNode,{x:y,y:b}=m.positionAbsolute,{width:p,height:_}=$e(v);return{node:v,x:y,y:b,width:p,height:_}},ie);return!u||u.hidden||!im(u)?null:F.jsx(s,{x:l,y:f,width:d,height:h,style:u.style,selected:!!u.selected,className:r(u),color:t(u),borderRadius:i,strokeColor:n(u),strokeWidth:o,shapeRendering:a,onClick:c,id:u.id})}const XS=$.memo(WS);var KS=$.memo(YS);const ZS=200,QS=150,JS=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?rm(Wt(e.nodeLookup,{filter:JS}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},tC="react-flow__minimap-desc";function iy({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i="",nodeBorderRadius:o=5,nodeStrokeWidth:a,nodeComponent:s,bgColor:c,maskColor:u,maskStrokeColor:l,maskStrokeWidth:f,position:d="bottom-right",onClick:h,onNodeClick:g,pannable:m=!1,zoomable:v=!1,ariaLabel:y,inversePan:b,zoomStep:p=1,offsetScale:_=5}){const x=oe(),w=$.useRef(null),{boundingRect:E,viewBB:R,rfId:C,panZoom:T,translateExtent:q,flowWidth:M,flowHeight:k,ariaLabelConfig:S}=ne(eC,ie),A=e?.width??ZS,N=e?.height??QS,L=E.width/A,P=E.height/N,D=Math.max(L,P),j=D*A,G=D*N,V=_*D,Y=E.x-(j-E.width)/2-V,I=E.y-(G-E.height)/2-V,O=j+V*2,z=G+V*2,H=`${tC}-${C}`,B=$.useRef(0),U=$.useRef();B.current=D,$.useEffect(()=>{if(w.current&&T)return U.current=w1({domNode:w.current,panZoom:T,getTransform:()=>x.getState().transform,getViewScale:()=>B.current}),()=>{U.current?.destroy()}},[T]),$.useEffect(()=>{U.current?.update({translateExtent:q,width:M,height:k,inversePan:b,pannable:m,zoomStep:p,zoomable:v})},[m,v,b,p,q,M,k]);const X=h?W=>{const[te,K]=U.current?.pointer(W)||[0,0];h(W,{x:te,y:K})}:void 0,J=g?$.useCallback((W,te)=>{const K=x.getState().nodeLookup.get(te).internals.userNode;g(W,K)},[]):void 0,Q=y??S["minimap.ariaLabel"];return F.jsx(Bn,{position:d,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*D: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:ue(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:F.jsxs("svg",{width:A,height:N,viewBox:`${Y} ${I} ${O} ${z}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":H,ref:w,onClick:X,children:[Q&&F.jsx("title",{id:H,children:Q}),F.jsx(KS,{onClick:J,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:o,nodeClassName:i,nodeStrokeWidth:a,nodeComponent:s}),F.jsx("path",{className:"react-flow__minimap-mask",d:`M${Y-V},${I-V}h${O+V*2}v${z+V*2}h${-O-V*2}z
7
+ M${R.x},${R.y}h${R.width}v${R.height}h${-R.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}iy.displayName="MiniMap";const qI=$.memo(iy),nC=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,rC={[wt.Line]:"right",[wt.Handle]:"bottom-right"};function iC({nodeId:e,position:t,variant:n=wt.Handle,className:r,style:i=void 0,children:o,color:a,minWidth:s=10,minHeight:c=10,maxWidth:u=Number.MAX_VALUE,maxHeight:l=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:d,autoScale:h=!0,shouldResize:g,onResizeStart:m,onResize:v,onResizeEnd:y}){const b=Lm(),p=typeof e=="string"?e:b,_=oe(),x=$.useRef(null),w=n===wt.Handle,E=ne($.useCallback(nC(w&&h),[w,h]),ie),R=$.useRef(null),C=t??rC[n];$.useEffect(()=>{if(!(!x.current||!p))return R.current||(R.current=O1({domNode:x.current,nodeId:p,getStoreItems:()=>{const{nodeLookup:q,transform:M,snapGrid:k,snapToGrid:S,nodeOrigin:A,domNode:N}=_.getState();return{nodeLookup:q,transform:M,snapGrid:k,snapToGrid:S,nodeOrigin:A,paneDomNode:N}},onChange:(q,M)=>{const{triggerNodeChanges:k,nodeLookup:S,parentLookup:A,nodeOrigin:N}=_.getState(),L=[],P={x:q.x,y:q.y},D=S.get(p);if(D&&D.expandParent&&D.parentId){const j=D.origin??N,G=q.width??D.measured.width??0,V=q.height??D.measured.height??0,Y={id:D.id,parentId:D.parentId,rect:{width:G,height:V,...om({x:q.x??D.position.x,y:q.y??D.position.y},{width:G,height:V},D.parentId,S,j)}},I=vc([Y],S,A,N);L.push(...I),P.x=q.x?Math.max(j[0]*G,q.x):void 0,P.y=q.y?Math.max(j[1]*V,q.y):void 0}if(P.x!==void 0&&P.y!==void 0){const j={id:p,type:"position",position:{...P}};L.push(j)}if(q.width!==void 0&&q.height!==void 0){const G={id:p,type:"dimensions",resizing:!0,setAttributes:d?d==="horizontal"?"width":"height":!0,dimensions:{width:q.width,height:q.height}};L.push(G)}for(const j of M){const G={...j,type:"position"};L.push(G)}k(L)},onEnd:({width:q,height:M})=>{const k={id:p,type:"dimensions",resizing:!1,dimensions:{width:q,height:M}};_.getState().triggerNodeChanges([k])}})),R.current.update({controlPosition:C,boundaries:{minWidth:s,minHeight:c,maxWidth:u,maxHeight:l},keepAspectRatio:f,resizeDirection:d,onResizeStart:m,onResize:v,onResizeEnd:y,shouldResize:g}),()=>{R.current?.destroy()}},[C,s,c,u,l,f,m,v,y,g]);const T=C.split("-");return F.jsx("div",{className:ue(["react-flow__resize-control","nodrag",...T,n,r]),ref:x,style:{...i,scale:E,...a&&{[w?"backgroundColor":"borderColor"]:a}},children:o})}$.memo(iC);function _c(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 Er,Zl;function oC(){if(Zl)return Er;Zl=1;function e(){this.__data__=[],this.size=0}return Er=e,Er}var Sr,Ql;function xt(){if(Ql)return Sr;Ql=1;function e(t,n){return t===n||t!==t&&n!==n}return Sr=e,Sr}var Cr,Jl;function Gn(){if(Jl)return Cr;Jl=1;var e=xt();function t(n,r){for(var i=n.length;i--;)if(e(n[i][0],r))return i;return-1}return Cr=t,Cr}var qr,ef;function aC(){if(ef)return qr;ef=1;var e=Gn(),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 qr=r,qr}var Rr,tf;function sC(){if(tf)return Rr;tf=1;var e=Gn();function t(n){var r=this.__data__,i=e(r,n);return i<0?void 0:r[i][1]}return Rr=t,Rr}var Ir,nf;function uC(){if(nf)return Ir;nf=1;var e=Gn();function t(n){return e(this.__data__,n)>-1}return Ir=t,Ir}var Nr,rf;function cC(){if(rf)return Nr;rf=1;var e=Gn();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 Nr=t,Nr}var Ar,of;function Un(){if(of)return Ar;of=1;var e=oC(),t=aC(),n=sC(),r=uC(),i=cC();function o(a){var s=-1,c=a==null?0:a.length;for(this.clear();++s<c;){var u=a[s];this.set(u[0],u[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=n,o.prototype.has=r,o.prototype.set=i,Ar=o,Ar}var Mr,af;function lC(){if(af)return Mr;af=1;var e=Un();function t(){this.__data__=new e,this.size=0}return Mr=t,Mr}var Tr,sf;function fC(){if(sf)return Tr;sf=1;function e(t){var n=this.__data__,r=n.delete(t);return this.size=n.size,r}return Tr=e,Tr}var Pr,uf;function dC(){if(uf)return Pr;uf=1;function e(t){return this.__data__.get(t)}return Pr=e,Pr}var kr,cf;function hC(){if(cf)return kr;cf=1;function e(t){return this.__data__.has(t)}return kr=e,kr}var Or,lf;function oy(){if(lf)return Or;lf=1;var e=typeof on=="object"&&on&&on.Object===Object&&on;return Or=e,Or}var Lr,ff;function Ce(){if(ff)return Lr;ff=1;var e=oy(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return Lr=n,Lr}var Dr,df;function Et(){if(df)return Dr;df=1;var e=Ce(),t=e.Symbol;return Dr=t,Dr}var Fr,hf;function pC(){if(hf)return Fr;hf=1;var e=Et(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,i=e?e.toStringTag:void 0;function o(a){var s=n.call(a,i),c=a[i];try{a[i]=void 0;var u=!0}catch{}var l=r.call(a);return u&&(s?a[i]=c:delete a[i]),l}return Fr=o,Fr}var zr,pf;function gC(){if(pf)return zr;pf=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return zr=n,zr}var $r,gf;function ot(){if(gf)return $r;gf=1;var e=Et(),t=pC(),n=gC(),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 $r=a,$r}var Hr,vf;function me(){if(vf)return Hr;vf=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Hr=e,Hr}var Br,mf;function Zt(){if(mf)return Br;mf=1;var e=ot(),t=me(),n="[object AsyncFunction]",r="[object Function]",i="[object GeneratorFunction]",o="[object Proxy]";function a(s){if(!t(s))return!1;var c=e(s);return c==r||c==i||c==n||c==o}return Br=a,Br}var jr,yf;function vC(){if(yf)return jr;yf=1;var e=Ce(),t=e["__core-js_shared__"];return jr=t,jr}var Vr,_f;function mC(){if(_f)return Vr;_f=1;var e=vC(),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 Vr=n,Vr}var Gr,bf;function ay(){if(bf)return Gr;bf=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 Gr=n,Gr}var Ur,wf;function yC(){if(wf)return Ur;wf=1;var e=Zt(),t=mC(),n=me(),r=ay(),i=/[\\^$.*+?()[\]{}|]/g,o=/^\[object .+?Constructor\]$/,a=Function.prototype,s=Object.prototype,c=a.toString,u=s.hasOwnProperty,l=RegExp("^"+c.call(u).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function f(d){if(!n(d)||t(d))return!1;var h=e(d)?l:o;return h.test(r(d))}return Ur=f,Ur}var Yr,xf;function _C(){if(xf)return Yr;xf=1;function e(t,n){return t?.[n]}return Yr=e,Yr}var Wr,Ef;function at(){if(Ef)return Wr;Ef=1;var e=yC(),t=_C();function n(r,i){var o=t(r,i);return e(o)?o:void 0}return Wr=n,Wr}var Xr,Sf;function bc(){if(Sf)return Xr;Sf=1;var e=at(),t=Ce(),n=e(t,"Map");return Xr=n,Xr}var Kr,Cf;function Yn(){if(Cf)return Kr;Cf=1;var e=at(),t=e(Object,"create");return Kr=t,Kr}var Zr,qf;function bC(){if(qf)return Zr;qf=1;var e=Yn();function t(){this.__data__=e?e(null):{},this.size=0}return Zr=t,Zr}var Qr,Rf;function wC(){if(Rf)return Qr;Rf=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return Qr=e,Qr}var Jr,If;function xC(){if(If)return Jr;If=1;var e=Yn(),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 Jr=i,Jr}var ei,Nf;function EC(){if(Nf)return ei;Nf=1;var e=Yn(),t=Object.prototype,n=t.hasOwnProperty;function r(i){var o=this.__data__;return e?o[i]!==void 0:n.call(o,i)}return ei=r,ei}var ti,Af;function SC(){if(Af)return ti;Af=1;var e=Yn(),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 ti=n,ti}var ni,Mf;function CC(){if(Mf)return ni;Mf=1;var e=bC(),t=wC(),n=xC(),r=EC(),i=SC();function o(a){var s=-1,c=a==null?0:a.length;for(this.clear();++s<c;){var u=a[s];this.set(u[0],u[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=n,o.prototype.has=r,o.prototype.set=i,ni=o,ni}var ri,Tf;function qC(){if(Tf)return ri;Tf=1;var e=CC(),t=Un(),n=bc();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return ri=r,ri}var ii,Pf;function RC(){if(Pf)return ii;Pf=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return ii=e,ii}var oi,kf;function Wn(){if(kf)return oi;kf=1;var e=RC();function t(n,r){var i=n.__data__;return e(r)?i[typeof r=="string"?"string":"hash"]:i.map}return oi=t,oi}var ai,Of;function IC(){if(Of)return ai;Of=1;var e=Wn();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return ai=t,ai}var si,Lf;function NC(){if(Lf)return si;Lf=1;var e=Wn();function t(n){return e(this,n).get(n)}return si=t,si}var ui,Df;function AC(){if(Df)return ui;Df=1;var e=Wn();function t(n){return e(this,n).has(n)}return ui=t,ui}var ci,Ff;function MC(){if(Ff)return ci;Ff=1;var e=Wn();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 ci=t,ci}var li,zf;function wc(){if(zf)return li;zf=1;var e=qC(),t=IC(),n=NC(),r=AC(),i=MC();function o(a){var s=-1,c=a==null?0:a.length;for(this.clear();++s<c;){var u=a[s];this.set(u[0],u[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=n,o.prototype.has=r,o.prototype.set=i,li=o,li}var fi,$f;function TC(){if($f)return fi;$f=1;var e=Un(),t=bc(),n=wc(),r=200;function i(o,a){var s=this.__data__;if(s instanceof e){var c=s.__data__;if(!t||c.length<r-1)return c.push([o,a]),this.size=++s.size,this;s=this.__data__=new n(c)}return s.set(o,a),this.size=s.size,this}return fi=i,fi}var di,Hf;function Xn(){if(Hf)return di;Hf=1;var e=Un(),t=lC(),n=fC(),r=dC(),i=hC(),o=TC();function a(s){var c=this.__data__=new e(s);this.size=c.size}return a.prototype.clear=t,a.prototype.delete=n,a.prototype.get=r,a.prototype.has=i,a.prototype.set=o,di=a,di}var hi,Bf;function xc(){if(Bf)return hi;Bf=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 hi=e,hi}var pi,jf;function sy(){if(jf)return pi;jf=1;var e=at(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return pi=t,pi}var gi,Vf;function Kn(){if(Vf)return gi;Vf=1;var e=sy();function t(n,r,i){r=="__proto__"&&e?e(n,r,{configurable:!0,enumerable:!0,value:i,writable:!0}):n[r]=i}return gi=t,gi}var vi,Gf;function Zn(){if(Gf)return vi;Gf=1;var e=Kn(),t=xt(),n=Object.prototype,r=n.hasOwnProperty;function i(o,a,s){var c=o[a];(!(r.call(o,a)&&t(c,s))||s===void 0&&!(a in o))&&e(o,a,s)}return vi=i,vi}var mi,Uf;function Qt(){if(Uf)return mi;Uf=1;var e=Zn(),t=Kn();function n(r,i,o,a){var s=!o;o||(o={});for(var c=-1,u=i.length;++c<u;){var l=i[c],f=a?a(o[l],r[l],l,o,r):void 0;f===void 0&&(f=r[l]),s?t(o,l,f):e(o,l,f)}return o}return mi=n,mi}var yi,Yf;function PC(){if(Yf)return yi;Yf=1;function e(t,n){for(var r=-1,i=Array(t);++r<t;)i[r]=n(r);return i}return yi=e,yi}var _i,Wf;function Te(){if(Wf)return _i;Wf=1;function e(t){return t!=null&&typeof t=="object"}return _i=e,_i}var bi,Xf;function kC(){if(Xf)return bi;Xf=1;var e=ot(),t=Te(),n="[object Arguments]";function r(i){return t(i)&&e(i)==n}return bi=r,bi}var wi,Kf;function Jt(){if(Kf)return wi;Kf=1;var e=kC(),t=Te(),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 wi=o,wi}var xi,Zf;function ce(){if(Zf)return xi;Zf=1;var e=Array.isArray;return xi=e,xi}var Mt={exports:{}},Ei,Qf;function OC(){if(Qf)return Ei;Qf=1;function e(){return!1}return Ei=e,Ei}Mt.exports;var Jf;function St(){return Jf||(Jf=1,(function(e,t){var n=Ce(),r=OC(),i=t&&!t.nodeType&&t,o=i&&!0&&e&&!e.nodeType&&e,a=o&&o.exports===i,s=a?n.Buffer:void 0,c=s?s.isBuffer:void 0,u=c||r;e.exports=u})(Mt,Mt.exports)),Mt.exports}var Si,ed;function Qn(){if(ed)return Si;ed=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 Si=n,Si}var Ci,td;function Ec(){if(td)return Ci;td=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return Ci=t,Ci}var qi,nd;function LC(){if(nd)return qi;nd=1;var e=ot(),t=Ec(),n=Te(),r="[object Arguments]",i="[object Array]",o="[object Boolean]",a="[object Date]",s="[object Error]",c="[object Function]",u="[object Map]",l="[object Number]",f="[object Object]",d="[object RegExp]",h="[object Set]",g="[object String]",m="[object WeakMap]",v="[object ArrayBuffer]",y="[object DataView]",b="[object Float32Array]",p="[object Float64Array]",_="[object Int8Array]",x="[object Int16Array]",w="[object Int32Array]",E="[object Uint8Array]",R="[object Uint8ClampedArray]",C="[object Uint16Array]",T="[object Uint32Array]",q={};q[b]=q[p]=q[_]=q[x]=q[w]=q[E]=q[R]=q[C]=q[T]=!0,q[r]=q[i]=q[v]=q[o]=q[y]=q[a]=q[s]=q[c]=q[u]=q[l]=q[f]=q[d]=q[h]=q[g]=q[m]=!1;function M(k){return n(k)&&t(k.length)&&!!q[e(k)]}return qi=M,qi}var Ri,rd;function Jn(){if(rd)return Ri;rd=1;function e(t){return function(n){return t(n)}}return Ri=e,Ri}var Tt={exports:{}};Tt.exports;var id;function Sc(){return id||(id=1,(function(e,t){var n=oy(),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 c=i&&i.require&&i.require("util").types;return c||a&&a.binding&&a.binding("util")}catch{}})();e.exports=s})(Tt,Tt.exports)),Tt.exports}var Ii,od;function en(){if(od)return Ii;od=1;var e=LC(),t=Jn(),n=Sc(),r=n&&n.isTypedArray,i=r?t(r):e;return Ii=i,Ii}var Ni,ad;function uy(){if(ad)return Ni;ad=1;var e=PC(),t=Jt(),n=ce(),r=St(),i=Qn(),o=en(),a=Object.prototype,s=a.hasOwnProperty;function c(u,l){var f=n(u),d=!f&&t(u),h=!f&&!d&&r(u),g=!f&&!d&&!h&&o(u),m=f||d||h||g,v=m?e(u.length,String):[],y=v.length;for(var b in u)(l||s.call(u,b))&&!(m&&(b=="length"||h&&(b=="offset"||b=="parent")||g&&(b=="buffer"||b=="byteLength"||b=="byteOffset")||i(b,y)))&&v.push(b);return v}return Ni=c,Ni}var Ai,sd;function er(){if(sd)return Ai;sd=1;var e=Object.prototype;function t(n){var r=n&&n.constructor,i=typeof r=="function"&&r.prototype||e;return n===i}return Ai=t,Ai}var Mi,ud;function cy(){if(ud)return Mi;ud=1;function e(t,n){return function(r){return t(n(r))}}return Mi=e,Mi}var Ti,cd;function DC(){if(cd)return Ti;cd=1;var e=cy(),t=e(Object.keys,Object);return Ti=t,Ti}var Pi,ld;function Cc(){if(ld)return Pi;ld=1;var e=er(),t=DC(),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 Pi=i,Pi}var ki,fd;function He(){if(fd)return ki;fd=1;var e=Zt(),t=Ec();function n(r){return r!=null&&t(r.length)&&!e(r)}return ki=n,ki}var Oi,dd;function Ke(){if(dd)return Oi;dd=1;var e=uy(),t=Cc(),n=He();function r(i){return n(i)?e(i):t(i)}return Oi=r,Oi}var Li,hd;function FC(){if(hd)return Li;hd=1;var e=Qt(),t=Ke();function n(r,i){return r&&e(i,t(i),r)}return Li=n,Li}var Di,pd;function zC(){if(pd)return Di;pd=1;function e(t){var n=[];if(t!=null)for(var r in Object(t))n.push(r);return n}return Di=e,Di}var Fi,gd;function $C(){if(gd)return Fi;gd=1;var e=me(),t=er(),n=zC(),r=Object.prototype,i=r.hasOwnProperty;function o(a){if(!e(a))return n(a);var s=t(a),c=[];for(var u in a)u=="constructor"&&(s||!i.call(a,u))||c.push(u);return c}return Fi=o,Fi}var zi,vd;function st(){if(vd)return zi;vd=1;var e=uy(),t=$C(),n=He();function r(i){return n(i)?e(i,!0):t(i)}return zi=r,zi}var $i,md;function HC(){if(md)return $i;md=1;var e=Qt(),t=st();function n(r,i){return r&&e(i,t(i),r)}return $i=n,$i}var Pt={exports:{}};Pt.exports;var yd;function ly(){return yd||(yd=1,(function(e,t){var n=Ce(),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 c(u,l){if(l)return u.slice();var f=u.length,d=s?s(f):new u.constructor(f);return u.copy(d),d}e.exports=c})(Pt,Pt.exports)),Pt.exports}var Hi,_d;function fy(){if(_d)return Hi;_d=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 Hi=e,Hi}var Bi,bd;function dy(){if(bd)return Bi;bd=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 Bi=e,Bi}var ji,wd;function hy(){if(wd)return ji;wd=1;function e(){return[]}return ji=e,ji}var Vi,xd;function qc(){if(xd)return Vi;xd=1;var e=dy(),t=hy(),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 Vi=o,Vi}var Gi,Ed;function BC(){if(Ed)return Gi;Ed=1;var e=Qt(),t=qc();function n(r,i){return e(r,t(r),i)}return Gi=n,Gi}var Ui,Sd;function Rc(){if(Sd)return Ui;Sd=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 Ui=e,Ui}var Yi,Cd;function tr(){if(Cd)return Yi;Cd=1;var e=cy(),t=e(Object.getPrototypeOf,Object);return Yi=t,Yi}var Wi,qd;function py(){if(qd)return Wi;qd=1;var e=Rc(),t=tr(),n=qc(),r=hy(),i=Object.getOwnPropertySymbols,o=i?function(a){for(var s=[];a;)e(s,n(a)),a=t(a);return s}:r;return Wi=o,Wi}var Xi,Rd;function jC(){if(Rd)return Xi;Rd=1;var e=Qt(),t=py();function n(r,i){return e(r,t(r),i)}return Xi=n,Xi}var Ki,Id;function gy(){if(Id)return Ki;Id=1;var e=Rc(),t=ce();function n(r,i,o){var a=i(r);return t(r)?a:e(a,o(r))}return Ki=n,Ki}var Zi,Nd;function vy(){if(Nd)return Zi;Nd=1;var e=gy(),t=qc(),n=Ke();function r(i){return e(i,n,t)}return Zi=r,Zi}var Qi,Ad;function VC(){if(Ad)return Qi;Ad=1;var e=gy(),t=py(),n=st();function r(i){return e(i,n,t)}return Qi=r,Qi}var Ji,Md;function GC(){if(Md)return Ji;Md=1;var e=at(),t=Ce(),n=e(t,"DataView");return Ji=n,Ji}var eo,Td;function UC(){if(Td)return eo;Td=1;var e=at(),t=Ce(),n=e(t,"Promise");return eo=n,eo}var to,Pd;function my(){if(Pd)return to;Pd=1;var e=at(),t=Ce(),n=e(t,"Set");return to=n,to}var no,kd;function YC(){if(kd)return no;kd=1;var e=at(),t=Ce(),n=e(t,"WeakMap");return no=n,no}var ro,Od;function Ct(){if(Od)return ro;Od=1;var e=GC(),t=bc(),n=UC(),r=my(),i=YC(),o=ot(),a=ay(),s="[object Map]",c="[object Object]",u="[object Promise]",l="[object Set]",f="[object WeakMap]",d="[object DataView]",h=a(e),g=a(t),m=a(n),v=a(r),y=a(i),b=o;return(e&&b(new e(new ArrayBuffer(1)))!=d||t&&b(new t)!=s||n&&b(n.resolve())!=u||r&&b(new r)!=l||i&&b(new i)!=f)&&(b=function(p){var _=o(p),x=_==c?p.constructor:void 0,w=x?a(x):"";if(w)switch(w){case h:return d;case g:return s;case m:return u;case v:return l;case y:return f}return _}),ro=b,ro}var io,Ld;function WC(){if(Ld)return io;Ld=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 io=n,io}var oo,Dd;function yy(){if(Dd)return oo;Dd=1;var e=Ce(),t=e.Uint8Array;return oo=t,oo}var ao,Fd;function Ic(){if(Fd)return ao;Fd=1;var e=yy();function t(n){var r=new n.constructor(n.byteLength);return new e(r).set(new e(n)),r}return ao=t,ao}var so,zd;function XC(){if(zd)return so;zd=1;var e=Ic();function t(n,r){var i=r?e(n.buffer):n.buffer;return new n.constructor(i,n.byteOffset,n.byteLength)}return so=t,so}var uo,$d;function KC(){if($d)return uo;$d=1;var e=/\w*$/;function t(n){var r=new n.constructor(n.source,e.exec(n));return r.lastIndex=n.lastIndex,r}return uo=t,uo}var co,Hd;function ZC(){if(Hd)return co;Hd=1;var e=Et(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function r(i){return n?Object(n.call(i)):{}}return co=r,co}var lo,Bd;function _y(){if(Bd)return lo;Bd=1;var e=Ic();function t(n,r){var i=r?e(n.buffer):n.buffer;return new n.constructor(i,n.byteOffset,n.length)}return lo=t,lo}var fo,jd;function QC(){if(jd)return fo;jd=1;var e=Ic(),t=XC(),n=KC(),r=ZC(),i=_y(),o="[object Boolean]",a="[object Date]",s="[object Map]",c="[object Number]",u="[object RegExp]",l="[object Set]",f="[object String]",d="[object Symbol]",h="[object ArrayBuffer]",g="[object DataView]",m="[object Float32Array]",v="[object Float64Array]",y="[object Int8Array]",b="[object Int16Array]",p="[object Int32Array]",_="[object Uint8Array]",x="[object Uint8ClampedArray]",w="[object Uint16Array]",E="[object Uint32Array]";function R(C,T,q){var M=C.constructor;switch(T){case h:return e(C);case o:case a:return new M(+C);case g:return t(C,q);case m:case v:case y:case b:case p:case _:case x:case w:case E:return i(C,q);case s:return new M;case c:case f:return new M(C);case u:return n(C);case l:return new M;case d:return r(C)}}return fo=R,fo}var ho,Vd;function by(){if(Vd)return ho;Vd=1;var e=me(),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 ho=n,ho}var po,Gd;function wy(){if(Gd)return po;Gd=1;var e=by(),t=tr(),n=er();function r(i){return typeof i.constructor=="function"&&!n(i)?e(t(i)):{}}return po=r,po}var go,Ud;function JC(){if(Ud)return go;Ud=1;var e=Ct(),t=Te(),n="[object Map]";function r(i){return t(i)&&e(i)==n}return go=r,go}var vo,Yd;function eq(){if(Yd)return vo;Yd=1;var e=JC(),t=Jn(),n=Sc(),r=n&&n.isMap,i=r?t(r):e;return vo=i,vo}var mo,Wd;function tq(){if(Wd)return mo;Wd=1;var e=Ct(),t=Te(),n="[object Set]";function r(i){return t(i)&&e(i)==n}return mo=r,mo}var yo,Xd;function nq(){if(Xd)return yo;Xd=1;var e=tq(),t=Jn(),n=Sc(),r=n&&n.isSet,i=r?t(r):e;return yo=i,yo}var _o,Kd;function xy(){if(Kd)return _o;Kd=1;var e=Xn(),t=xc(),n=Zn(),r=FC(),i=HC(),o=ly(),a=fy(),s=BC(),c=jC(),u=vy(),l=VC(),f=Ct(),d=WC(),h=QC(),g=wy(),m=ce(),v=St(),y=eq(),b=me(),p=nq(),_=Ke(),x=st(),w=1,E=2,R=4,C="[object Arguments]",T="[object Array]",q="[object Boolean]",M="[object Date]",k="[object Error]",S="[object Function]",A="[object GeneratorFunction]",N="[object Map]",L="[object Number]",P="[object Object]",D="[object RegExp]",j="[object Set]",G="[object String]",V="[object Symbol]",Y="[object WeakMap]",I="[object ArrayBuffer]",O="[object DataView]",z="[object Float32Array]",H="[object Float64Array]",B="[object Int8Array]",U="[object Int16Array]",X="[object Int32Array]",J="[object Uint8Array]",Q="[object Uint8ClampedArray]",W="[object Uint16Array]",te="[object Uint32Array]",K={};K[C]=K[T]=K[I]=K[O]=K[q]=K[M]=K[z]=K[H]=K[B]=K[U]=K[X]=K[N]=K[L]=K[P]=K[D]=K[j]=K[G]=K[V]=K[J]=K[Q]=K[W]=K[te]=!0,K[k]=K[S]=K[Y]=!1;function re(ee,fe,le,Pe,qe,de){var se,je=fe&w,ke=fe&E,Ve=fe&R;if(le&&(se=qe?le(ee,Pe,qe,de):le(ee)),se!==void 0)return se;if(!b(ee))return ee;var Ge=m(ee);if(Ge){if(se=d(ee),!je)return a(ee,se)}else{var Oe=f(ee),nn=Oe==S||Oe==A;if(v(ee))return o(ee,je);if(Oe==P||Oe==C||nn&&!qe){if(se=ke||nn?{}:g(ee),!je)return ke?c(ee,i(se,ee)):s(ee,r(se,ee))}else{if(!K[Oe])return qe?ee:{};se=h(ee,Oe,je)}}de||(de=new e);var ct=de.get(ee);if(ct)return ct;de.set(ee,se),p(ee)?ee.forEach(function(Re){se.add(re(Re,fe,le,Re,ee,de))}):y(ee)&&ee.forEach(function(Re,Le){se.set(Le,re(Re,fe,le,Le,ee,de))});var ur=Ve?ke?l:u:ke?x:_,rn=Ge?void 0:ur(ee);return t(rn||ee,function(Re,Le){rn&&(Le=Re,Re=ee[Le]),n(se,Le,re(Re,fe,le,Le,ee,de))}),se}return _o=re,_o}var bo,Zd;function rq(){if(Zd)return bo;Zd=1;var e=xy(),t=4;function n(r){return e(r,t)}return bo=n,bo}var wo,Qd;function Nc(){if(Qd)return wo;Qd=1;function e(t){return function(){return t}}return wo=e,wo}var xo,Jd;function iq(){if(Jd)return xo;Jd=1;function e(t){return function(n,r,i){for(var o=-1,a=Object(n),s=i(n),c=s.length;c--;){var u=s[t?c:++o];if(r(a[u],u,a)===!1)break}return n}}return xo=e,xo}var Eo,eh;function Ac(){if(eh)return Eo;eh=1;var e=iq(),t=e();return Eo=t,Eo}var So,th;function Mc(){if(th)return So;th=1;var e=Ac(),t=Ke();function n(r,i){return r&&e(r,i,t)}return So=n,So}var Co,nh;function oq(){if(nh)return Co;nh=1;var e=He();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,c=Object(i);(r?s--:++s<a)&&o(c[s],s,c)!==!1;);return i}}return Co=t,Co}var qo,rh;function nr(){if(rh)return qo;rh=1;var e=Mc(),t=oq(),n=t(e);return qo=n,qo}var Ro,ih;function ut(){if(ih)return Ro;ih=1;function e(t){return t}return Ro=e,Ro}var Io,oh;function Ey(){if(oh)return Io;oh=1;var e=ut();function t(n){return typeof n=="function"?n:e}return Io=t,Io}var No,ah;function Sy(){if(ah)return No;ah=1;var e=xc(),t=nr(),n=Ey(),r=ce();function i(o,a){var s=r(o)?e:t;return s(o,n(a))}return No=i,No}var Ao,sh;function Cy(){return sh||(sh=1,Ao=Sy()),Ao}var Mo,uh;function aq(){if(uh)return Mo;uh=1;var e=nr();function t(n,r){var i=[];return e(n,function(o,a,s){r(o,a,s)&&i.push(o)}),i}return Mo=t,Mo}var To,ch;function sq(){if(ch)return To;ch=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return To=t,To}var Po,lh;function uq(){if(lh)return Po;lh=1;function e(t){return this.__data__.has(t)}return Po=e,Po}var ko,fh;function qy(){if(fh)return ko;fh=1;var e=wc(),t=sq(),n=uq();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,ko=r,ko}var Oo,dh;function cq(){if(dh)return Oo;dh=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 Oo=e,Oo}var Lo,hh;function Ry(){if(hh)return Lo;hh=1;function e(t,n){return t.has(n)}return Lo=e,Lo}var Do,ph;function Iy(){if(ph)return Do;ph=1;var e=qy(),t=cq(),n=Ry(),r=1,i=2;function o(a,s,c,u,l,f){var d=c&r,h=a.length,g=s.length;if(h!=g&&!(d&&g>h))return!1;var m=f.get(a),v=f.get(s);if(m&&v)return m==s&&v==a;var y=-1,b=!0,p=c&i?new e:void 0;for(f.set(a,s),f.set(s,a);++y<h;){var _=a[y],x=s[y];if(u)var w=d?u(x,_,y,s,a,f):u(_,x,y,a,s,f);if(w!==void 0){if(w)continue;b=!1;break}if(p){if(!t(s,function(E,R){if(!n(p,R)&&(_===E||l(_,E,c,u,f)))return p.push(R)})){b=!1;break}}else if(!(_===x||l(_,x,c,u,f))){b=!1;break}}return f.delete(a),f.delete(s),b}return Do=o,Do}var Fo,gh;function lq(){if(gh)return Fo;gh=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(i,o){r[++n]=[o,i]}),r}return Fo=e,Fo}var zo,vh;function Tc(){if(vh)return zo;vh=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(i){r[++n]=i}),r}return zo=e,zo}var $o,mh;function fq(){if(mh)return $o;mh=1;var e=Et(),t=yy(),n=xt(),r=Iy(),i=lq(),o=Tc(),a=1,s=2,c="[object Boolean]",u="[object Date]",l="[object Error]",f="[object Map]",d="[object Number]",h="[object RegExp]",g="[object Set]",m="[object String]",v="[object Symbol]",y="[object ArrayBuffer]",b="[object DataView]",p=e?e.prototype:void 0,_=p?p.valueOf:void 0;function x(w,E,R,C,T,q,M){switch(R){case b:if(w.byteLength!=E.byteLength||w.byteOffset!=E.byteOffset)return!1;w=w.buffer,E=E.buffer;case y:return!(w.byteLength!=E.byteLength||!q(new t(w),new t(E)));case c:case u:case d:return n(+w,+E);case l:return w.name==E.name&&w.message==E.message;case h:case m:return w==E+"";case f:var k=i;case g:var S=C&a;if(k||(k=o),w.size!=E.size&&!S)return!1;var A=M.get(w);if(A)return A==E;C|=s,M.set(w,E);var N=r(k(w),k(E),C,T,q,M);return M.delete(w),N;case v:if(_)return _.call(w)==_.call(E)}return!1}return $o=x,$o}var Ho,yh;function dq(){if(yh)return Ho;yh=1;var e=vy(),t=1,n=Object.prototype,r=n.hasOwnProperty;function i(o,a,s,c,u,l){var f=s&t,d=e(o),h=d.length,g=e(a),m=g.length;if(h!=m&&!f)return!1;for(var v=h;v--;){var y=d[v];if(!(f?y in a:r.call(a,y)))return!1}var b=l.get(o),p=l.get(a);if(b&&p)return b==a&&p==o;var _=!0;l.set(o,a),l.set(a,o);for(var x=f;++v<h;){y=d[v];var w=o[y],E=a[y];if(c)var R=f?c(E,w,y,a,o,l):c(w,E,y,o,a,l);if(!(R===void 0?w===E||u(w,E,s,c,l):R)){_=!1;break}x||(x=y=="constructor")}if(_&&!x){var C=o.constructor,T=a.constructor;C!=T&&"constructor"in o&&"constructor"in a&&!(typeof C=="function"&&C instanceof C&&typeof T=="function"&&T instanceof T)&&(_=!1)}return l.delete(o),l.delete(a),_}return Ho=i,Ho}var Bo,_h;function hq(){if(_h)return Bo;_h=1;var e=Xn(),t=Iy(),n=fq(),r=dq(),i=Ct(),o=ce(),a=St(),s=en(),c=1,u="[object Arguments]",l="[object Array]",f="[object Object]",d=Object.prototype,h=d.hasOwnProperty;function g(m,v,y,b,p,_){var x=o(m),w=o(v),E=x?l:i(m),R=w?l:i(v);E=E==u?f:E,R=R==u?f:R;var C=E==f,T=R==f,q=E==R;if(q&&a(m)){if(!a(v))return!1;x=!0,C=!1}if(q&&!C)return _||(_=new e),x||s(m)?t(m,v,y,b,p,_):n(m,v,E,y,b,p,_);if(!(y&c)){var M=C&&h.call(m,"__wrapped__"),k=T&&h.call(v,"__wrapped__");if(M||k){var S=M?m.value():m,A=k?v.value():v;return _||(_=new e),p(S,A,y,b,_)}}return q?(_||(_=new e),r(m,v,y,b,p,_)):!1}return Bo=g,Bo}var jo,bh;function Ny(){if(bh)return jo;bh=1;var e=hq(),t=Te();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 jo=n,jo}var Vo,wh;function pq(){if(wh)return Vo;wh=1;var e=Xn(),t=Ny(),n=1,r=2;function i(o,a,s,c){var u=s.length,l=u,f=!c;if(o==null)return!l;for(o=Object(o);u--;){var d=s[u];if(f&&d[2]?d[1]!==o[d[0]]:!(d[0]in o))return!1}for(;++u<l;){d=s[u];var h=d[0],g=o[h],m=d[1];if(f&&d[2]){if(g===void 0&&!(h in o))return!1}else{var v=new e;if(c)var y=c(g,m,h,o,a,v);if(!(y===void 0?t(m,g,n|r,c,v):y))return!1}}return!0}return Vo=i,Vo}var Go,xh;function Ay(){if(xh)return Go;xh=1;var e=me();function t(n){return n===n&&!e(n)}return Go=t,Go}var Uo,Eh;function gq(){if(Eh)return Uo;Eh=1;var e=Ay(),t=Ke();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 Uo=n,Uo}var Yo,Sh;function My(){if(Sh)return Yo;Sh=1;function e(t,n){return function(r){return r==null?!1:r[t]===n&&(n!==void 0||t in Object(r))}}return Yo=e,Yo}var Wo,Ch;function vq(){if(Ch)return Wo;Ch=1;var e=pq(),t=gq(),n=My();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 Wo=r,Wo}var Xo,qh;function qt(){if(qh)return Xo;qh=1;var e=ot(),t=Te(),n="[object Symbol]";function r(i){return typeof i=="symbol"||t(i)&&e(i)==n}return Xo=r,Xo}var Ko,Rh;function Pc(){if(Rh)return Ko;Rh=1;var e=ce(),t=qt(),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 Ko=i,Ko}var Zo,Ih;function mq(){if(Ih)return Zo;Ih=1;var e=wc(),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],c=o.cache;if(c.has(s))return c.get(s);var u=r.apply(this,a);return o.cache=c.set(s,u)||c,u};return o.cache=new(n.Cache||e),o}return n.Cache=e,Zo=n,Zo}var Qo,Nh;function yq(){if(Nh)return Qo;Nh=1;var e=mq(),t=500;function n(r){var i=e(r,function(a){return o.size===t&&o.clear(),a}),o=i.cache;return i}return Qo=n,Qo}var Jo,Ah;function _q(){if(Ah)return Jo;Ah=1;var e=yq(),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,c,u){o.push(c?u.replace(n,"$1"):s||a)}),o});return Jo=r,Jo}var ea,Mh;function rr(){if(Mh)return ea;Mh=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 ea=e,ea}var ta,Th;function bq(){if(Th)return ta;Th=1;var e=Et(),t=rr(),n=ce(),r=qt(),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 c=s+"";return c=="0"&&1/s==-1/0?"-0":c}return ta=a,ta}var na,Ph;function Ty(){if(Ph)return na;Ph=1;var e=bq();function t(n){return n==null?"":e(n)}return na=t,na}var ra,kh;function ir(){if(kh)return ra;kh=1;var e=ce(),t=Pc(),n=_q(),r=Ty();function i(o,a){return e(o)?o:t(o,a)?[o]:n(r(o))}return ra=i,ra}var ia,Oh;function tn(){if(Oh)return ia;Oh=1;var e=qt();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return ia=t,ia}var oa,Lh;function or(){if(Lh)return oa;Lh=1;var e=ir(),t=tn();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 oa=n,oa}var aa,Dh;function wq(){if(Dh)return aa;Dh=1;var e=or();function t(n,r,i){var o=n==null?void 0:e(n,r);return o===void 0?i:o}return aa=t,aa}var sa,Fh;function xq(){if(Fh)return sa;Fh=1;function e(t,n){return t!=null&&n in Object(t)}return sa=e,sa}var ua,zh;function Py(){if(zh)return ua;zh=1;var e=ir(),t=Jt(),n=ce(),r=Qn(),i=Ec(),o=tn();function a(s,c,u){c=e(c,s);for(var l=-1,f=c.length,d=!1;++l<f;){var h=o(c[l]);if(!(d=s!=null&&u(s,h)))break;s=s[h]}return d||++l!=f?d:(f=s==null?0:s.length,!!f&&i(f)&&r(h,f)&&(n(s)||t(s)))}return ua=a,ua}var ca,$h;function ky(){if($h)return ca;$h=1;var e=xq(),t=Py();function n(r,i){return r!=null&&t(r,i,e)}return ca=n,ca}var la,Hh;function Eq(){if(Hh)return la;Hh=1;var e=Ny(),t=wq(),n=ky(),r=Pc(),i=Ay(),o=My(),a=tn(),s=1,c=2;function u(l,f){return r(l)&&i(f)?o(a(l),f):function(d){var h=t(d,l);return h===void 0&&h===f?n(d,l):e(f,h,s|c)}}return la=u,la}var fa,Bh;function Oy(){if(Bh)return fa;Bh=1;function e(t){return function(n){return n?.[t]}}return fa=e,fa}var da,jh;function Sq(){if(jh)return da;jh=1;var e=or();function t(n){return function(r){return e(r,n)}}return da=t,da}var ha,Vh;function Cq(){if(Vh)return ha;Vh=1;var e=Oy(),t=Sq(),n=Pc(),r=tn();function i(o){return n(o)?e(r(o)):t(o)}return ha=i,ha}var pa,Gh;function Be(){if(Gh)return pa;Gh=1;var e=vq(),t=Eq(),n=ut(),r=ce(),i=Cq();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 pa=o,pa}var ga,Uh;function Ly(){if(Uh)return ga;Uh=1;var e=dy(),t=aq(),n=Be(),r=ce();function i(o,a){var s=r(o)?e:t;return s(o,n(a,3))}return ga=i,ga}var va,Yh;function qq(){if(Yh)return va;Yh=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r,i){return r!=null&&t.call(r,i)}return va=n,va}var ma,Wh;function Dy(){if(Wh)return ma;Wh=1;var e=qq(),t=Py();function n(r,i){return r!=null&&t(r,i,e)}return ma=n,ma}var ya,Xh;function Rq(){if(Xh)return ya;Xh=1;var e=Cc(),t=Ct(),n=Jt(),r=ce(),i=He(),o=St(),a=er(),s=en(),c="[object Map]",u="[object Set]",l=Object.prototype,f=l.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 g=t(h);if(g==c||g==u)return!h.size;if(a(h))return!e(h).length;for(var m in h)if(f.call(h,m))return!1;return!0}return ya=d,ya}var _a,Kh;function Fy(){if(Kh)return _a;Kh=1;function e(t){return t===void 0}return _a=e,_a}var ba,Zh;function zy(){if(Zh)return ba;Zh=1;var e=nr(),t=He();function n(r,i){var o=-1,a=t(r)?Array(r.length):[];return e(r,function(s,c,u){a[++o]=i(s,c,u)}),a}return ba=n,ba}var wa,Qh;function $y(){if(Qh)return wa;Qh=1;var e=rr(),t=Be(),n=zy(),r=ce();function i(o,a){var s=r(o)?e:n;return s(o,t(a,3))}return wa=i,wa}var xa,Jh;function Iq(){if(Jh)return xa;Jh=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 xa=e,xa}var Ea,ep;function Nq(){if(ep)return Ea;ep=1;function e(t,n,r,i,o){return o(t,function(a,s,c){r=i?(i=!1,a):n(r,a,s,c)}),r}return Ea=e,Ea}var Sa,tp;function Hy(){if(tp)return Sa;tp=1;var e=Iq(),t=nr(),n=Be(),r=Nq(),i=ce();function o(a,s,c){var u=i(a)?e:r,l=arguments.length<3;return u(a,n(s,4),c,l,t)}return Sa=o,Sa}var Ca,np;function Aq(){if(np)return Ca;np=1;var e=ot(),t=ce(),n=Te(),r="[object String]";function i(o){return typeof o=="string"||!t(o)&&n(o)&&e(o)==r}return Ca=i,Ca}var qa,rp;function Mq(){if(rp)return qa;rp=1;var e=Oy(),t=e("length");return qa=t,qa}var Ra,ip;function Tq(){if(ip)return Ra;ip=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 c(u){return s.test(u)}return Ra=c,Ra}var Ia,op;function Pq(){if(op)return Ia;op=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+"]",c="\\ud83c[\\udffb-\\udfff]",u="(?:"+s+"|"+c+")",l="[^"+e+"]",f="(?:\\ud83c[\\udde6-\\uddff]){2}",d="[\\ud800-\\udbff][\\udc00-\\udfff]",h="\\u200d",g=u+"?",m="["+o+"]?",v="(?:"+h+"(?:"+[l,f,d].join("|")+")"+m+g+")*",y=m+g+v,b="(?:"+[l+s+"?",s,f,d,a].join("|")+")",p=RegExp(c+"(?="+c+")|"+b+y,"g");function _(x){for(var w=p.lastIndex=0;p.test(x);)++w;return w}return Ia=_,Ia}var Na,ap;function kq(){if(ap)return Na;ap=1;var e=Mq(),t=Tq(),n=Pq();function r(i){return t(i)?n(i):e(i)}return Na=r,Na}var Aa,sp;function Oq(){if(sp)return Aa;sp=1;var e=Cc(),t=Ct(),n=He(),r=Aq(),i=kq(),o="[object Map]",a="[object Set]";function s(c){if(c==null)return 0;if(n(c))return r(c)?i(c):c.length;var u=t(c);return u==o||u==a?c.size:e(c).length}return Aa=s,Aa}var Ma,up;function Lq(){if(up)return Ma;up=1;var e=xc(),t=by(),n=Mc(),r=Be(),i=tr(),o=ce(),a=St(),s=Zt(),c=me(),u=en();function l(f,d,h){var g=o(f),m=g||a(f)||u(f);if(d=r(d,4),h==null){var v=f&&f.constructor;m?h=g?new v:[]:c(f)?h=s(v)?t(i(f)):{}:h={}}return(m?e:n)(f,function(y,b,p){return d(h,y,b,p)}),h}return Ma=l,Ma}var Ta,cp;function Dq(){if(cp)return Ta;cp=1;var e=Et(),t=Jt(),n=ce(),r=e?e.isConcatSpreadable:void 0;function i(o){return n(o)||t(o)||!!(r&&o&&o[r])}return Ta=i,Ta}var Pa,lp;function kc(){if(lp)return Pa;lp=1;var e=Rc(),t=Dq();function n(r,i,o,a,s){var c=-1,u=r.length;for(o||(o=t),s||(s=[]);++c<u;){var l=r[c];i>0&&o(l)?i>1?n(l,i-1,o,a,s):e(s,l):a||(s[s.length]=l)}return s}return Pa=n,Pa}var ka,fp;function Fq(){if(fp)return ka;fp=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 ka=e,ka}var Oa,dp;function By(){if(dp)return Oa;dp=1;var e=Fq(),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,c=t(a.length-i,0),u=Array(c);++s<c;)u[s]=a[i+s];s=-1;for(var l=Array(i+1);++s<i;)l[s]=a[s];return l[i]=o(u),e(r,this,l)}}return Oa=n,Oa}var La,hp;function zq(){if(hp)return La;hp=1;var e=Nc(),t=sy(),n=ut(),r=t?function(i,o){return t(i,"toString",{configurable:!0,enumerable:!1,value:e(o),writable:!0})}:n;return La=r,La}var Da,pp;function $q(){if(pp)return Da;pp=1;var e=800,t=16,n=Date.now;function r(i){var o=0,a=0;return function(){var s=n(),c=t-(s-a);if(a=s,c>0){if(++o>=e)return arguments[0]}else o=0;return i.apply(void 0,arguments)}}return Da=r,Da}var Fa,gp;function jy(){if(gp)return Fa;gp=1;var e=zq(),t=$q(),n=t(e);return Fa=n,Fa}var za,vp;function ar(){if(vp)return za;vp=1;var e=ut(),t=By(),n=jy();function r(i,o){return n(t(i,o,e),i+"")}return za=r,za}var $a,mp;function Vy(){if(mp)return $a;mp=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 $a=e,$a}var Ha,yp;function Hq(){if(yp)return Ha;yp=1;function e(t){return t!==t}return Ha=e,Ha}var Ba,_p;function Bq(){if(_p)return Ba;_p=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 Ba=e,Ba}var ja,bp;function jq(){if(bp)return ja;bp=1;var e=Vy(),t=Hq(),n=Bq();function r(i,o,a){return o===o?n(i,o,a):e(i,t,a)}return ja=r,ja}var Va,wp;function Vq(){if(wp)return Va;wp=1;var e=jq();function t(n,r){var i=n==null?0:n.length;return!!i&&e(n,r,0)>-1}return Va=t,Va}var Ga,xp;function Gq(){if(xp)return Ga;xp=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 Ga=e,Ga}var Ua,Ep;function Uq(){if(Ep)return Ua;Ep=1;function e(){}return Ua=e,Ua}var Ya,Sp;function Yq(){if(Sp)return Ya;Sp=1;var e=my(),t=Uq(),n=Tc(),r=1/0,i=e&&1/n(new e([,-0]))[1]==r?function(o){return new e(o)}:t;return Ya=i,Ya}var Wa,Cp;function Wq(){if(Cp)return Wa;Cp=1;var e=qy(),t=Vq(),n=Gq(),r=Ry(),i=Yq(),o=Tc(),a=200;function s(c,u,l){var f=-1,d=t,h=c.length,g=!0,m=[],v=m;if(l)g=!1,d=n;else if(h>=a){var y=u?null:i(c);if(y)return o(y);g=!1,d=r,v=new e}else v=u?[]:m;e:for(;++f<h;){var b=c[f],p=u?u(b):b;if(b=l||b!==0?b:0,g&&p===p){for(var _=v.length;_--;)if(v[_]===p)continue e;u&&v.push(p),m.push(b)}else d(v,p,l)||(v!==m&&v.push(p),m.push(b))}return m}return Wa=s,Wa}var Xa,qp;function Gy(){if(qp)return Xa;qp=1;var e=He(),t=Te();function n(r){return t(r)&&e(r)}return Xa=n,Xa}var Ka,Rp;function Xq(){if(Rp)return Ka;Rp=1;var e=kc(),t=ar(),n=Wq(),r=Gy(),i=t(function(o){return n(e(o,1,r,!0))});return Ka=i,Ka}var Za,Ip;function Kq(){if(Ip)return Za;Ip=1;var e=rr();function t(n,r){return e(r,function(i){return n[i]})}return Za=t,Za}var Qa,Np;function Uy(){if(Np)return Qa;Np=1;var e=Kq(),t=Ke();function n(r){return r==null?[]:e(r,t(r))}return Qa=n,Qa}var Ja,Ap;function ye(){if(Ap)return Ja;Ap=1;var e;if(typeof _c=="function")try{e={clone:rq(),constant:Nc(),each:Cy(),filter:Ly(),has:Dy(),isArray:ce(),isEmpty:Rq(),isFunction:Zt(),isUndefined:Fy(),keys:Ke(),map:$y(),reduce:Hy(),size:Oq(),transform:Lq(),union:Xq(),values:Uy()}}catch{}return e||(e=window._),Ja=e,Ja}var es,Mp;function Oc(){if(Mp)return es;Mp=1;var e=ye();es=i;var t="\0",n="\0",r="";function i(l){this._isDirected=e.has(l,"directed")?l.directed:!0,this._isMultigraph=e.has(l,"multigraph")?l.multigraph:!1,this._isCompound=e.has(l,"compound")?l.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(l){return this._label=l,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(l){return e.isFunction(l)||(l=e.constant(l)),this._defaultNodeLabelFn=l,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return e.keys(this._nodes)},i.prototype.sources=function(){var l=this;return e.filter(this.nodes(),function(f){return e.isEmpty(l._in[f])})},i.prototype.sinks=function(){var l=this;return e.filter(this.nodes(),function(f){return e.isEmpty(l._out[f])})},i.prototype.setNodes=function(l,f){var d=arguments,h=this;return e.each(l,function(g){d.length>1?h.setNode(g,f):h.setNode(g)}),this},i.prototype.setNode=function(l,f){return e.has(this._nodes,l)?(arguments.length>1&&(this._nodes[l]=f),this):(this._nodes[l]=arguments.length>1?f:this._defaultNodeLabelFn(l),this._isCompound&&(this._parent[l]=n,this._children[l]={},this._children[n][l]=!0),this._in[l]={},this._preds[l]={},this._out[l]={},this._sucs[l]={},++this._nodeCount,this)},i.prototype.node=function(l){return this._nodes[l]},i.prototype.hasNode=function(l){return e.has(this._nodes,l)},i.prototype.removeNode=function(l){var f=this;if(e.has(this._nodes,l)){var d=function(h){f.removeEdge(f._edgeObjs[h])};delete this._nodes[l],this._isCompound&&(this._removeFromParentsChildList(l),delete this._parent[l],e.each(this.children(l),function(h){f.setParent(h)}),delete this._children[l]),e.each(e.keys(this._in[l]),d),delete this._in[l],delete this._preds[l],e.each(e.keys(this._out[l]),d),delete this._out[l],delete this._sucs[l],--this._nodeCount}return this},i.prototype.setParent=function(l,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===l)throw new Error("Setting "+f+" as parent of "+l+" would create a cycle");this.setNode(f)}return this.setNode(l),this._removeFromParentsChildList(l),this._parent[l]=f,this._children[f][l]=!0,this},i.prototype._removeFromParentsChildList=function(l){delete this._children[this._parent[l]][l]},i.prototype.parent=function(l){if(this._isCompound){var f=this._parent[l];if(f!==n)return f}},i.prototype.children=function(l){if(e.isUndefined(l)&&(l=n),this._isCompound){var f=this._children[l];if(f)return e.keys(f)}else{if(l===n)return this.nodes();if(this.hasNode(l))return[]}},i.prototype.predecessors=function(l){var f=this._preds[l];if(f)return e.keys(f)},i.prototype.successors=function(l){var f=this._sucs[l];if(f)return e.keys(f)},i.prototype.neighbors=function(l){var f=this.predecessors(l);if(f)return e.union(f,this.successors(l))},i.prototype.isLeaf=function(l){var f;return this.isDirected()?f=this.successors(l):f=this.neighbors(l),f.length===0},i.prototype.filterNodes=function(l){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(m,v){l(v)&&f.setNode(v,m)}),e.each(this._edgeObjs,function(m){f.hasNode(m.v)&&f.hasNode(m.w)&&f.setEdge(m,d.edge(m))});var h={};function g(m){var v=d.parent(m);return v===void 0||f.hasNode(v)?(h[m]=v,v):v in h?h[v]:g(v)}return this._isCompound&&e.each(f.nodes(),function(m){f.setParent(m,g(m))}),f},i.prototype.setDefaultEdgeLabel=function(l){return e.isFunction(l)||(l=e.constant(l)),this._defaultEdgeLabelFn=l,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return e.values(this._edgeObjs)},i.prototype.setPath=function(l,f){var d=this,h=arguments;return e.reduce(l,function(g,m){return h.length>1?d.setEdge(g,m,f):d.setEdge(g,m),m}),this},i.prototype.setEdge=function(){var l,f,d,h,g=!1,m=arguments[0];typeof m=="object"&&m!==null&&"v"in m?(l=m.v,f=m.w,d=m.name,arguments.length===2&&(h=arguments[1],g=!0)):(l=m,f=arguments[1],d=arguments[3],arguments.length>2&&(h=arguments[2],g=!0)),l=""+l,f=""+f,e.isUndefined(d)||(d=""+d);var v=s(this._isDirected,l,f,d);if(e.has(this._edgeLabels,v))return g&&(this._edgeLabels[v]=h),this;if(!e.isUndefined(d)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(l),this.setNode(f),this._edgeLabels[v]=g?h:this._defaultEdgeLabelFn(l,f,d);var y=c(this._isDirected,l,f,d);return l=y.v,f=y.w,Object.freeze(y),this._edgeObjs[v]=y,o(this._preds[f],l),o(this._sucs[l],f),this._in[f][v]=y,this._out[l][v]=y,this._edgeCount++,this},i.prototype.edge=function(l,f,d){var h=arguments.length===1?u(this._isDirected,arguments[0]):s(this._isDirected,l,f,d);return this._edgeLabels[h]},i.prototype.hasEdge=function(l,f,d){var h=arguments.length===1?u(this._isDirected,arguments[0]):s(this._isDirected,l,f,d);return e.has(this._edgeLabels,h)},i.prototype.removeEdge=function(l,f,d){var h=arguments.length===1?u(this._isDirected,arguments[0]):s(this._isDirected,l,f,d),g=this._edgeObjs[h];return g&&(l=g.v,f=g.w,delete this._edgeLabels[h],delete this._edgeObjs[h],a(this._preds[f],l),a(this._sucs[l],f),delete this._in[f][h],delete this._out[l][h],this._edgeCount--),this},i.prototype.inEdges=function(l,f){var d=this._in[l];if(d){var h=e.values(d);return f?e.filter(h,function(g){return g.v===f}):h}},i.prototype.outEdges=function(l,f){var d=this._out[l];if(d){var h=e.values(d);return f?e.filter(h,function(g){return g.w===f}):h}},i.prototype.nodeEdges=function(l,f){var d=this.inEdges(l,f);if(d)return d.concat(this.outEdges(l,f))};function o(l,f){l[f]?l[f]++:l[f]=1}function a(l,f){--l[f]||delete l[f]}function s(l,f,d,h){var g=""+f,m=""+d;if(!l&&g>m){var v=g;g=m,m=v}return g+r+m+r+(e.isUndefined(h)?t:h)}function c(l,f,d,h){var g=""+f,m=""+d;if(!l&&g>m){var v=g;g=m,m=v}var y={v:g,w:m};return h&&(y.name=h),y}function u(l,f){return s(l,f.v,f.w,f.name)}return es}var ts,Tp;function Zq(){return Tp||(Tp=1,ts="2.1.8"),ts}var ns,Pp;function Qq(){return Pp||(Pp=1,ns={Graph:Oc(),version:Zq()}),ns}var rs,kp;function Jq(){if(kp)return rs;kp=1;var e=ye(),t=Oc();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 c=a.node(s),u=a.parent(s),l={v:s};return e.isUndefined(c)||(l.value=c),e.isUndefined(u)||(l.parent=u),l})}function i(a){return e.map(a.edges(),function(s){var c=a.edge(s),u={v:s.v,w:s.w};return e.isUndefined(s.name)||(u.name=s.name),e.isUndefined(c)||(u.value=c),u})}function o(a){var s=new t(a.options).setGraph(a.value);return e.each(a.nodes,function(c){s.setNode(c.v,c.value),c.parent&&s.setParent(c.v,c.parent)}),e.each(a.edges,function(c){s.setEdge({v:c.v,w:c.w,name:c.name},c.value)}),s}return rs}var is,Op;function eR(){if(Op)return is;Op=1;var e=ye();is=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 is}var os,Lp;function Yy(){if(Lp)return os;Lp=1;var e=ye();os=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},os}var as,Dp;function Wy(){if(Dp)return as;Dp=1;var e=ye(),t=Yy();as=r;var n=e.constant(1);function r(o,a,s,c){return i(o,String(a),s||n,c||function(u){return o.outEdges(u)})}function i(o,a,s,c){var u={},l=new t,f,d,h=function(g){var m=g.v!==f?g.v:g.w,v=u[m],y=s(g),b=d.distance+y;if(y<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+g+" Weight: "+y);b<v.distance&&(v.distance=b,v.predecessor=f,l.decrease(m,b))};for(o.nodes().forEach(function(g){var m=g===a?0:Number.POSITIVE_INFINITY;u[g]={distance:m},l.add(g,m)});l.size()>0&&(f=l.removeMin(),d=u[f],d.distance!==Number.POSITIVE_INFINITY);)c(f).forEach(h);return u}return as}var ss,Fp;function tR(){if(Fp)return ss;Fp=1;var e=Wy(),t=ye();ss=n;function n(r,i,o){return t.transform(r.nodes(),function(a,s){a[s]=e(r,s,i,o)},{})}return ss}var us,zp;function Xy(){if(zp)return us;zp=1;var e=ye();us=t;function t(n){var r=0,i=[],o={},a=[];function s(c){var u=o[c]={onStack:!0,lowlink:r,index:r++};if(i.push(c),n.successors(c).forEach(function(d){e.has(o,d)?o[d].onStack&&(u.lowlink=Math.min(u.lowlink,o[d].index)):(s(d),u.lowlink=Math.min(u.lowlink,o[d].lowlink))}),u.lowlink===u.index){var l=[],f;do f=i.pop(),o[f].onStack=!1,l.push(f);while(c!==f);a.push(l)}}return n.nodes().forEach(function(c){e.has(o,c)||s(c)}),a}return us}var cs,$p;function nR(){if($p)return cs;$p=1;var e=ye(),t=Xy();cs=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 cs}var ls,Hp;function rR(){if(Hp)return ls;Hp=1;var e=ye();ls=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={},c=i.nodes();return c.forEach(function(u){s[u]={},s[u][u]={distance:0},c.forEach(function(l){u!==l&&(s[u][l]={distance:Number.POSITIVE_INFINITY})}),a(u).forEach(function(l){var f=l.v===u?l.w:l.v,d=o(l);s[u][f]={distance:d,predecessor:u}})}),c.forEach(function(u){var l=s[u];c.forEach(function(f){var d=s[f];c.forEach(function(h){var g=d[u],m=l[h],v=d[h],y=g.distance+m.distance;y<v.distance&&(v.distance=y,v.predecessor=m.predecessor)})})}),s}return ls}var fs,Bp;function Ky(){if(Bp)return fs;Bp=1;var e=ye();fs=t,t.CycleException=n;function t(r){var i={},o={},a=[];function s(c){if(e.has(o,c))throw new n;e.has(i,c)||(o[c]=!0,i[c]=!0,e.each(r.predecessors(c),s),delete o[c],a.push(c))}if(e.each(r.sinks(),s),e.size(i)!==r.nodeCount())throw new n;return a}function n(){}return n.prototype=new Error,fs}var ds,jp;function iR(){if(jp)return ds;jp=1;var e=Ky();ds=t;function t(n){try{e(n)}catch(r){if(r instanceof e.CycleException)return!1;throw r}return!0}return ds}var hs,Vp;function Zy(){if(Vp)return hs;Vp=1;var e=ye();hs=t;function t(r,i,o){e.isArray(i)||(i=[i]);var a=(r.isDirected()?r.successors:r.neighbors).bind(r),s=[],c={};return e.each(i,function(u){if(!r.hasNode(u))throw new Error("Graph does not have node: "+u);n(r,u,o==="post",c,a,s)}),s}function n(r,i,o,a,s,c){e.has(a,i)||(a[i]=!0,o||c.push(i),e.each(s(i),function(u){n(r,u,o,a,s,c)}),o&&c.push(i))}return hs}var ps,Gp;function oR(){if(Gp)return ps;Gp=1;var e=Zy();ps=t;function t(n,r){return e(n,r,"post")}return ps}var gs,Up;function aR(){if(Up)return gs;Up=1;var e=Zy();gs=t;function t(n,r){return e(n,r,"pre")}return gs}var vs,Yp;function sR(){if(Yp)return vs;Yp=1;var e=ye(),t=Oc(),n=Yy();vs=r;function r(i,o){var a=new t,s={},c=new n,u;function l(d){var h=d.v===u?d.w:d.v,g=c.priority(h);if(g!==void 0){var m=o(d);m<g&&(s[h]=u,c.decrease(h,m))}}if(i.nodeCount()===0)return a;e.each(i.nodes(),function(d){c.add(d,Number.POSITIVE_INFINITY),a.setNode(d)}),c.decrease(i.nodes()[0],0);for(var f=!1;c.size()>0;){if(u=c.removeMin(),e.has(s,u))a.setEdge(u,s[u]);else{if(f)throw new Error("Input graph is not connected: "+i);f=!0}i.nodeEdges(u).forEach(l)}return a}return vs}var ms,Wp;function uR(){return Wp||(Wp=1,ms={components:eR(),dijkstra:Wy(),dijkstraAll:tR(),findCycles:nR(),floydWarshall:rR(),isAcyclic:iR(),postorder:oR(),preorder:aR(),prim:sR(),tarjan:Xy(),topsort:Ky()}),ms}var ys,Xp;function cR(){if(Xp)return ys;Xp=1;var e=Qq();return ys={Graph:e.Graph,json:Jq(),alg:uR(),version:e.version},ys}var _s,Kp;function Ee(){if(Kp)return _s;Kp=1;var e;if(typeof _c=="function")try{e=cR()}catch{}return e||(e=window.graphlib),_s=e,_s}var bs,Zp;function lR(){if(Zp)return bs;Zp=1;var e=xy(),t=1,n=4;function r(i){return e(i,t|n)}return bs=r,bs}var ws,Qp;function sr(){if(Qp)return ws;Qp=1;var e=xt(),t=He(),n=Qn(),r=me();function i(o,a,s){if(!r(s))return!1;var c=typeof a;return(c=="number"?t(s)&&n(a,s.length):c=="string"&&a in s)?e(s[a],o):!1}return ws=i,ws}var xs,Jp;function fR(){if(Jp)return xs;Jp=1;var e=ar(),t=xt(),n=sr(),r=st(),i=Object.prototype,o=i.hasOwnProperty,a=e(function(s,c){s=Object(s);var u=-1,l=c.length,f=l>2?c[2]:void 0;for(f&&n(c[0],c[1],f)&&(l=1);++u<l;)for(var d=c[u],h=r(d),g=-1,m=h.length;++g<m;){var v=h[g],y=s[v];(y===void 0||t(y,i[v])&&!o.call(s,v))&&(s[v]=d[v])}return s});return xs=a,xs}var Es,eg;function dR(){if(eg)return Es;eg=1;var e=Be(),t=He(),n=Ke();function r(i){return function(o,a,s){var c=Object(o);if(!t(o)){var u=e(a,3);o=n(o),a=function(f){return u(c[f],f,c)}}var l=i(o,a,s);return l>-1?c[u?o[l]:l]:void 0}}return Es=r,Es}var Ss,tg;function hR(){if(tg)return Ss;tg=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return Ss=t,Ss}var Cs,ng;function pR(){if(ng)return Cs;ng=1;var e=hR(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return Cs=n,Cs}var qs,rg;function gR(){if(rg)return qs;rg=1;var e=pR(),t=me(),n=qt(),r=NaN,i=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,a=/^0o[0-7]+$/i,s=parseInt;function c(u){if(typeof u=="number")return u;if(n(u))return r;if(t(u)){var l=typeof u.valueOf=="function"?u.valueOf():u;u=t(l)?l+"":l}if(typeof u!="string")return u===0?u:+u;u=e(u);var f=o.test(u);return f||a.test(u)?s(u.slice(2),f?2:8):i.test(u)?r:+u}return qs=c,qs}var Rs,ig;function Qy(){if(ig)return Rs;ig=1;var e=gR(),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 Rs=r,Rs}var Is,og;function vR(){if(og)return Is;og=1;var e=Qy();function t(n){var r=e(n),i=r%1;return r===r?i?r-i:r:0}return Is=t,Is}var Ns,ag;function mR(){if(ag)return Ns;ag=1;var e=Vy(),t=Be(),n=vR(),r=Math.max;function i(o,a,s){var c=o==null?0:o.length;if(!c)return-1;var u=s==null?0:n(s);return u<0&&(u=r(c+u,0)),e(o,t(a,3),u)}return Ns=i,Ns}var As,sg;function yR(){if(sg)return As;sg=1;var e=dR(),t=mR(),n=e(t);return As=n,As}var Ms,ug;function Jy(){if(ug)return Ms;ug=1;var e=kc();function t(n){var r=n==null?0:n.length;return r?e(n,1):[]}return Ms=t,Ms}var Ts,cg;function _R(){if(cg)return Ts;cg=1;var e=Ac(),t=Ey(),n=st();function r(i,o){return i==null?i:e(i,t(o),n)}return Ts=r,Ts}var Ps,lg;function bR(){if(lg)return Ps;lg=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return Ps=e,Ps}var ks,fg;function wR(){if(fg)return ks;fg=1;var e=Kn(),t=Mc(),n=Be();function r(i,o){var a={};return o=n(o,3),t(i,function(s,c,u){e(a,c,o(s,c,u))}),a}return ks=r,ks}var Os,dg;function Lc(){if(dg)return Os;dg=1;var e=qt();function t(n,r,i){for(var o=-1,a=n.length;++o<a;){var s=n[o],c=r(s);if(c!=null&&(u===void 0?c===c&&!e(c):i(c,u)))var u=c,l=s}return l}return Os=t,Os}var Ls,hg;function xR(){if(hg)return Ls;hg=1;function e(t,n){return t>n}return Ls=e,Ls}var Ds,pg;function ER(){if(pg)return Ds;pg=1;var e=Lc(),t=xR(),n=ut();function r(i){return i&&i.length?e(i,n,t):void 0}return Ds=r,Ds}var Fs,gg;function e0(){if(gg)return Fs;gg=1;var e=Kn(),t=xt();function n(r,i,o){(o!==void 0&&!t(r[i],o)||o===void 0&&!(i in r))&&e(r,i,o)}return Fs=n,Fs}var zs,vg;function SR(){if(vg)return zs;vg=1;var e=ot(),t=tr(),n=Te(),r="[object Object]",i=Function.prototype,o=Object.prototype,a=i.toString,s=o.hasOwnProperty,c=a.call(Object);function u(l){if(!n(l)||e(l)!=r)return!1;var f=t(l);if(f===null)return!0;var d=s.call(f,"constructor")&&f.constructor;return typeof d=="function"&&d instanceof d&&a.call(d)==c}return zs=u,zs}var $s,mg;function t0(){if(mg)return $s;mg=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return $s=e,$s}var Hs,yg;function CR(){if(yg)return Hs;yg=1;var e=Qt(),t=st();function n(r){return e(r,t(r))}return Hs=n,Hs}var Bs,_g;function qR(){if(_g)return Bs;_g=1;var e=e0(),t=ly(),n=_y(),r=fy(),i=wy(),o=Jt(),a=ce(),s=Gy(),c=St(),u=Zt(),l=me(),f=SR(),d=en(),h=t0(),g=CR();function m(v,y,b,p,_,x,w){var E=h(v,b),R=h(y,b),C=w.get(R);if(C){e(v,b,C);return}var T=x?x(E,R,b+"",v,y,w):void 0,q=T===void 0;if(q){var M=a(R),k=!M&&c(R),S=!M&&!k&&d(R);T=R,M||k||S?a(E)?T=E:s(E)?T=r(E):k?(q=!1,T=t(R,!0)):S?(q=!1,T=n(R,!0)):T=[]:f(R)||o(R)?(T=E,o(E)?T=g(E):(!l(E)||u(E))&&(T=i(R))):q=!1}q&&(w.set(R,T),_(T,R,p,x,w),w.delete(R)),e(v,b,T)}return Bs=m,Bs}var js,bg;function RR(){if(bg)return js;bg=1;var e=Xn(),t=e0(),n=Ac(),r=qR(),i=me(),o=st(),a=t0();function s(c,u,l,f,d){c!==u&&n(u,function(h,g){if(d||(d=new e),i(h))r(c,u,g,l,s,f,d);else{var m=f?f(a(c,g),h,g+"",c,u,d):void 0;m===void 0&&(m=h),t(c,g,m)}},o)}return js=s,js}var Vs,wg;function IR(){if(wg)return Vs;wg=1;var e=ar(),t=sr();function n(r){return e(function(i,o){var a=-1,s=o.length,c=s>1?o[s-1]:void 0,u=s>2?o[2]:void 0;for(c=r.length>3&&typeof c=="function"?(s--,c):void 0,u&&t(o[0],o[1],u)&&(c=s<3?void 0:c,s=1),i=Object(i);++a<s;){var l=o[a];l&&r(i,l,a,c)}return i})}return Vs=n,Vs}var Gs,xg;function NR(){if(xg)return Gs;xg=1;var e=RR(),t=IR(),n=t(function(r,i,o){e(r,i,o)});return Gs=n,Gs}var Us,Eg;function n0(){if(Eg)return Us;Eg=1;function e(t,n){return t<n}return Us=e,Us}var Ys,Sg;function AR(){if(Sg)return Ys;Sg=1;var e=Lc(),t=n0(),n=ut();function r(i){return i&&i.length?e(i,n,t):void 0}return Ys=r,Ys}var Ws,Cg;function MR(){if(Cg)return Ws;Cg=1;var e=Lc(),t=Be(),n=n0();function r(i,o){return i&&i.length?e(i,t(o,2),n):void 0}return Ws=r,Ws}var Xs,qg;function TR(){if(qg)return Xs;qg=1;var e=Ce(),t=function(){return e.Date.now()};return Xs=t,Xs}var Ks,Rg;function PR(){if(Rg)return Ks;Rg=1;var e=Zn(),t=ir(),n=Qn(),r=me(),i=tn();function o(a,s,c,u){if(!r(a))return a;s=t(s,a);for(var l=-1,f=s.length,d=f-1,h=a;h!=null&&++l<f;){var g=i(s[l]),m=c;if(g==="__proto__"||g==="constructor"||g==="prototype")return a;if(l!=d){var v=h[g];m=u?u(v,g,h):void 0,m===void 0&&(m=r(v)?v:n(s[l+1])?[]:{})}e(h,g,m),h=h[g]}return a}return Ks=o,Ks}var Zs,Ig;function kR(){if(Ig)return Zs;Ig=1;var e=or(),t=PR(),n=ir();function r(i,o,a){for(var s=-1,c=o.length,u={};++s<c;){var l=o[s],f=e(i,l);a(f,l)&&t(u,n(l,i),f)}return u}return Zs=r,Zs}var Qs,Ng;function OR(){if(Ng)return Qs;Ng=1;var e=kR(),t=ky();function n(r,i){return e(r,i,function(o,a){return t(r,a)})}return Qs=n,Qs}var Js,Ag;function LR(){if(Ag)return Js;Ag=1;var e=Jy(),t=By(),n=jy();function r(i){return n(t(i,void 0,e),i+"")}return Js=r,Js}var eu,Mg;function DR(){if(Mg)return eu;Mg=1;var e=OR(),t=LR(),n=t(function(r,i){return r==null?{}:e(r,i)});return eu=n,eu}var tu,Tg;function FR(){if(Tg)return tu;Tg=1;var e=Math.ceil,t=Math.max;function n(r,i,o,a){for(var s=-1,c=t(e((i-r)/(o||1)),0),u=Array(c);c--;)u[a?c:++s]=r,r+=o;return u}return tu=n,tu}var nu,Pg;function zR(){if(Pg)return nu;Pg=1;var e=FR(),t=sr(),n=Qy();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 nu=r,nu}var ru,kg;function $R(){if(kg)return ru;kg=1;var e=zR(),t=e();return ru=t,ru}var iu,Og;function HR(){if(Og)return iu;Og=1;function e(t,n){var r=t.length;for(t.sort(n);r--;)t[r]=t[r].value;return t}return iu=e,iu}var ou,Lg;function BR(){if(Lg)return ou;Lg=1;var e=qt();function t(n,r){if(n!==r){var i=n!==void 0,o=n===null,a=n===n,s=e(n),c=r!==void 0,u=r===null,l=r===r,f=e(r);if(!u&&!f&&!s&&n>r||s&&c&&l&&!u&&!f||o&&c&&l||!i&&l||!a)return 1;if(!o&&!s&&!f&&n<r||f&&i&&a&&!o&&!s||u&&i&&a||!c&&a||!l)return-1}return 0}return ou=t,ou}var au,Dg;function jR(){if(Dg)return au;Dg=1;var e=BR();function t(n,r,i){for(var o=-1,a=n.criteria,s=r.criteria,c=a.length,u=i.length;++o<c;){var l=e(a[o],s[o]);if(l){if(o>=u)return l;var f=i[o];return l*(f=="desc"?-1:1)}}return n.index-r.index}return au=t,au}var su,Fg;function VR(){if(Fg)return su;Fg=1;var e=rr(),t=or(),n=Be(),r=zy(),i=HR(),o=Jn(),a=jR(),s=ut(),c=ce();function u(l,f,d){f.length?f=e(f,function(m){return c(m)?function(v){return t(v,m.length===1?m[0]:m)}:m}):f=[s];var h=-1;f=e(f,o(n));var g=r(l,function(m,v,y){var b=e(f,function(p){return p(m)});return{criteria:b,index:++h,value:m}});return i(g,function(m,v){return a(m,v,d)})}return su=u,su}var uu,zg;function GR(){if(zg)return uu;zg=1;var e=kc(),t=VR(),n=ar(),r=sr(),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 uu=i,uu}var cu,$g;function UR(){if($g)return cu;$g=1;var e=Ty(),t=0;function n(r){var i=++t;return e(r)+i}return cu=n,cu}var lu,Hg;function YR(){if(Hg)return lu;Hg=1;function e(t,n,r){for(var i=-1,o=t.length,a=n.length,s={};++i<o;){var c=i<a?n[i]:void 0;r(s,t[i],c)}return s}return lu=e,lu}var fu,Bg;function WR(){if(Bg)return fu;Bg=1;var e=Zn(),t=YR();function n(r,i){return t(r||[],i||[],e)}return fu=n,fu}var du,jg;function ae(){if(jg)return du;jg=1;var e;if(typeof _c=="function")try{e={cloneDeep:lR(),constant:Nc(),defaults:fR(),each:Cy(),filter:Ly(),find:yR(),flatten:Jy(),forEach:Sy(),forIn:_R(),has:Dy(),isUndefined:Fy(),last:bR(),map:$y(),mapValues:wR(),max:ER(),merge:NR(),min:AR(),minBy:MR(),now:TR(),pick:DR(),range:$R(),reduce:Hy(),sortBy:GR(),uniqueId:UR(),values:Uy(),zipObject:WR()}}catch{}return e||(e=window._),du=e,du}var hu,Vg;function XR(){if(Vg)return hu;Vg=1,hu=e;function e(){var r={};r._next=r._prev=r,this._sentinel=r}e.prototype.dequeue=function(){var r=this._sentinel,i=r._prev;if(i!==r)return t(i),i},e.prototype.enqueue=function(r){var i=this._sentinel;r._prev&&r._next&&t(r),r._next=i._next,i._next._prev=r,i._next=r,r._prev=i},e.prototype.toString=function(){for(var r=[],i=this._sentinel,o=i._prev;o!==i;)r.push(JSON.stringify(o,n)),o=o._prev;return"["+r.join(", ")+"]"};function t(r){r._prev._next=r._next,r._next._prev=r._prev,delete r._next,delete r._prev}function n(r,i){if(r!=="_next"&&r!=="_prev")return i}return hu}var pu,Gg;function KR(){if(Gg)return pu;Gg=1;var e=ae(),t=Ee().Graph,n=XR();pu=i;var r=e.constant(1);function i(u,l){if(u.nodeCount()<=1)return[];var f=s(u,l||r),d=o(f.graph,f.buckets,f.zeroIdx);return e.flatten(e.map(d,function(h){return u.outEdges(h.v,h.w)}),!0)}function o(u,l,f){for(var d=[],h=l[l.length-1],g=l[0],m;u.nodeCount();){for(;m=g.dequeue();)a(u,l,f,m);for(;m=h.dequeue();)a(u,l,f,m);if(u.nodeCount()){for(var v=l.length-2;v>0;--v)if(m=l[v].dequeue(),m){d=d.concat(a(u,l,f,m,!0));break}}}return d}function a(u,l,f,d,h){var g=h?[]:void 0;return e.forEach(u.inEdges(d.v),function(m){var v=u.edge(m),y=u.node(m.v);h&&g.push({v:m.v,w:m.w}),y.out-=v,c(l,f,y)}),e.forEach(u.outEdges(d.v),function(m){var v=u.edge(m),y=m.w,b=u.node(y);b.in-=v,c(l,f,b)}),u.removeNode(d.v),g}function s(u,l){var f=new t,d=0,h=0;e.forEach(u.nodes(),function(v){f.setNode(v,{v,in:0,out:0})}),e.forEach(u.edges(),function(v){var y=f.edge(v.v,v.w)||0,b=l(v),p=y+b;f.setEdge(v.v,v.w,p),h=Math.max(h,f.node(v.v).out+=b),d=Math.max(d,f.node(v.w).in+=b)});var g=e.range(h+d+3).map(function(){return new n}),m=d+1;return e.forEach(f.nodes(),function(v){c(g,m,f.node(v))}),{graph:f,buckets:g,zeroIdx:m}}function c(u,l,f){f.out?f.in?u[f.out-f.in+l].enqueue(f):u[u.length-1].enqueue(f):u[0].enqueue(f)}return pu}var gu,Ug;function ZR(){if(Ug)return gu;Ug=1;var e=ae(),t=KR();gu={run:n,undo:i};function n(o){var a=o.graph().acyclicer==="greedy"?t(o,s(o)):r(o);e.forEach(a,function(c){var u=o.edge(c);o.removeEdge(c),u.forwardName=c.name,u.reversed=!0,o.setEdge(c.w,c.v,u,e.uniqueId("rev"))});function s(c){return function(u){return c.edge(u).weight}}}function r(o){var a=[],s={},c={};function u(l){e.has(c,l)||(c[l]=!0,s[l]=!0,e.forEach(o.outEdges(l),function(f){e.has(s,f.w)?a.push(f):u(f.w)}),delete s[l])}return e.forEach(o.nodes(),u),a}function i(o){e.forEach(o.edges(),function(a){var s=o.edge(a);if(s.reversed){o.removeEdge(a);var c=s.forwardName;delete s.reversed,delete s.forwardName,o.setEdge(a.w,a.v,s,c)}})}return gu}var vu,Yg;function pe(){if(Yg)return vu;Yg=1;var e=ae(),t=Ee().Graph;vu={addDummyNode:n,simplify:r,asNonCompoundGraph:i,successorWeights:o,predecessorWeights:a,intersectRect:s,buildLayerMatrix:c,normalizeRanks:u,removeEmptyRanks:l,addBorderNode:f,maxRank:d,partition:h,time:g,notime:m};function n(v,y,b,p){var _;do _=e.uniqueId(p);while(v.hasNode(_));return b.dummy=y,v.setNode(_,b),_}function r(v){var y=new t().setGraph(v.graph());return e.forEach(v.nodes(),function(b){y.setNode(b,v.node(b))}),e.forEach(v.edges(),function(b){var p=y.edge(b.v,b.w)||{weight:0,minlen:1},_=v.edge(b);y.setEdge(b.v,b.w,{weight:p.weight+_.weight,minlen:Math.max(p.minlen,_.minlen)})}),y}function i(v){var y=new t({multigraph:v.isMultigraph()}).setGraph(v.graph());return e.forEach(v.nodes(),function(b){v.children(b).length||y.setNode(b,v.node(b))}),e.forEach(v.edges(),function(b){y.setEdge(b,v.edge(b))}),y}function o(v){var y=e.map(v.nodes(),function(b){var p={};return e.forEach(v.outEdges(b),function(_){p[_.w]=(p[_.w]||0)+v.edge(_).weight}),p});return e.zipObject(v.nodes(),y)}function a(v){var y=e.map(v.nodes(),function(b){var p={};return e.forEach(v.inEdges(b),function(_){p[_.v]=(p[_.v]||0)+v.edge(_).weight}),p});return e.zipObject(v.nodes(),y)}function s(v,y){var b=v.x,p=v.y,_=y.x-b,x=y.y-p,w=v.width/2,E=v.height/2;if(!_&&!x)throw new Error("Not possible to find intersection inside of the rectangle");var R,C;return Math.abs(x)*w>Math.abs(_)*E?(x<0&&(E=-E),R=E*_/x,C=E):(_<0&&(w=-w),R=w,C=w*x/_),{x:b+R,y:p+C}}function c(v){var y=e.map(e.range(d(v)+1),function(){return[]});return e.forEach(v.nodes(),function(b){var p=v.node(b),_=p.rank;e.isUndefined(_)||(y[_][p.order]=b)}),y}function u(v){var y=e.min(e.map(v.nodes(),function(b){return v.node(b).rank}));e.forEach(v.nodes(),function(b){var p=v.node(b);e.has(p,"rank")&&(p.rank-=y)})}function l(v){var y=e.min(e.map(v.nodes(),function(x){return v.node(x).rank})),b=[];e.forEach(v.nodes(),function(x){var w=v.node(x).rank-y;b[w]||(b[w]=[]),b[w].push(x)});var p=0,_=v.graph().nodeRankFactor;e.forEach(b,function(x,w){e.isUndefined(x)&&w%_!==0?--p:p&&e.forEach(x,function(E){v.node(E).rank+=p})})}function f(v,y,b,p){var _={width:0,height:0};return arguments.length>=4&&(_.rank=b,_.order=p),n(v,"border",_,y)}function d(v){return e.max(e.map(v.nodes(),function(y){var b=v.node(y).rank;if(!e.isUndefined(b))return b}))}function h(v,y){var b={lhs:[],rhs:[]};return e.forEach(v,function(p){y(p)?b.lhs.push(p):b.rhs.push(p)}),b}function g(v,y){var b=e.now();try{return y()}finally{console.log(v+" time: "+(e.now()-b)+"ms")}}function m(v,y){return y()}return vu}var mu,Wg;function QR(){if(Wg)return mu;Wg=1;var e=ae(),t=pe();mu={run:n,undo:i};function n(o){o.graph().dummyChains=[],e.forEach(o.edges(),function(a){r(o,a)})}function r(o,a){var s=a.v,c=o.node(s).rank,u=a.w,l=o.node(u).rank,f=a.name,d=o.edge(a),h=d.labelRank;if(l!==c+1){o.removeEdge(a);var g,m,v;for(v=0,++c;c<l;++v,++c)d.points=[],m={width:0,height:0,edgeLabel:d,edgeObj:a,rank:c},g=t.addDummyNode(o,"edge",m,"_d"),c===h&&(m.width=d.width,m.height=d.height,m.dummy="edge-label",m.labelpos=d.labelpos),o.setEdge(s,g,{weight:d.weight},f),v===0&&o.graph().dummyChains.push(g),s=g;o.setEdge(s,u,{weight:d.weight},f)}}function i(o){e.forEach(o.graph().dummyChains,function(a){var s=o.node(a),c=s.edgeLabel,u;for(o.setEdge(s.edgeObj,c);s.dummy;)u=o.successors(a)[0],o.removeNode(a),c.points.push({x:s.x,y:s.y}),s.dummy==="edge-label"&&(c.x=s.x,c.y=s.y,c.width=s.width,c.height=s.height),a=u,s=o.node(a)})}return mu}var yu,Xg;function Tn(){if(Xg)return yu;Xg=1;var e=ae();yu={longestPath:t,slack:n};function t(r){var i={};function o(a){var s=r.node(a);if(e.has(i,a))return s.rank;i[a]=!0;var c=e.min(e.map(r.outEdges(a),function(u){return o(u.w)-r.edge(u).minlen}));return(c===Number.POSITIVE_INFINITY||c===void 0||c===null)&&(c=0),s.rank=c}e.forEach(r.sources(),o)}function n(r,i){return r.node(i.w).rank-r.node(i.v).rank-r.edge(i).minlen}return yu}var _u,Kg;function r0(){if(Kg)return _u;Kg=1;var e=ae(),t=Ee().Graph,n=Tn().slack;_u=r;function r(s){var c=new t({directed:!1}),u=s.nodes()[0],l=s.nodeCount();c.setNode(u,{});for(var f,d;i(c,s)<l;)f=o(c,s),d=c.hasNode(f.v)?n(s,f):-n(s,f),a(c,s,d);return c}function i(s,c){function u(l){e.forEach(c.nodeEdges(l),function(f){var d=f.v,h=l===d?f.w:d;!s.hasNode(h)&&!n(c,f)&&(s.setNode(h,{}),s.setEdge(l,h,{}),u(h))})}return e.forEach(s.nodes(),u),s.nodeCount()}function o(s,c){return e.minBy(c.edges(),function(u){if(s.hasNode(u.v)!==s.hasNode(u.w))return n(c,u)})}function a(s,c,u){e.forEach(s.nodes(),function(l){c.node(l).rank+=u})}return _u}var bu,Zg;function JR(){if(Zg)return bu;Zg=1;var e=ae(),t=r0(),n=Tn().slack,r=Tn().longestPath,i=Ee().alg.preorder,o=Ee().alg.postorder,a=pe().simplify;bu=s,s.initLowLimValues=f,s.initCutValues=c,s.calcCutValue=l,s.leaveEdge=h,s.enterEdge=g,s.exchangeEdges=m;function s(p){p=a(p),r(p);var _=t(p);f(_),c(_,p);for(var x,w;x=h(_);)w=g(_,p,x),m(_,p,x,w)}function c(p,_){var x=o(p,p.nodes());x=x.slice(0,x.length-1),e.forEach(x,function(w){u(p,_,w)})}function u(p,_,x){var w=p.node(x),E=w.parent;p.edge(x,E).cutvalue=l(p,_,x)}function l(p,_,x){var w=p.node(x),E=w.parent,R=!0,C=_.edge(x,E),T=0;return C||(R=!1,C=_.edge(E,x)),T=C.weight,e.forEach(_.nodeEdges(x),function(q){var M=q.v===x,k=M?q.w:q.v;if(k!==E){var S=M===R,A=_.edge(q).weight;if(T+=S?A:-A,y(p,x,k)){var N=p.edge(x,k).cutvalue;T+=S?-N:N}}}),T}function f(p,_){arguments.length<2&&(_=p.nodes()[0]),d(p,{},1,_)}function d(p,_,x,w,E){var R=x,C=p.node(w);return _[w]=!0,e.forEach(p.neighbors(w),function(T){e.has(_,T)||(x=d(p,_,x,T,w))}),C.low=R,C.lim=x++,E?C.parent=E:delete C.parent,x}function h(p){return e.find(p.edges(),function(_){return p.edge(_).cutvalue<0})}function g(p,_,x){var w=x.v,E=x.w;_.hasEdge(w,E)||(w=x.w,E=x.v);var R=p.node(w),C=p.node(E),T=R,q=!1;R.lim>C.lim&&(T=C,q=!0);var M=e.filter(_.edges(),function(k){return q===b(p,p.node(k.v),T)&&q!==b(p,p.node(k.w),T)});return e.minBy(M,function(k){return n(_,k)})}function m(p,_,x,w){var E=x.v,R=x.w;p.removeEdge(E,R),p.setEdge(w.v,w.w,{}),f(p),c(p,_),v(p,_)}function v(p,_){var x=e.find(p.nodes(),function(E){return!_.node(E).parent}),w=i(p,x);w=w.slice(1),e.forEach(w,function(E){var R=p.node(E).parent,C=_.edge(E,R),T=!1;C||(C=_.edge(R,E),T=!0),_.node(E).rank=_.node(R).rank+(T?C.minlen:-C.minlen)})}function y(p,_,x){return p.hasEdge(_,x)}function b(p,_,x){return x.low<=_.lim&&_.lim<=x.lim}return bu}var wu,Qg;function eI(){if(Qg)return wu;Qg=1;var e=Tn(),t=e.longestPath,n=r0(),r=JR();wu=i;function i(c){switch(c.graph().ranker){case"network-simplex":s(c);break;case"tight-tree":a(c);break;case"longest-path":o(c);break;default:s(c)}}var o=t;function a(c){t(c),n(c)}function s(c){r(c)}return wu}var xu,Jg;function tI(){if(Jg)return xu;Jg=1;var e=ae();xu=t;function t(i){var o=r(i);e.forEach(i.graph().dummyChains,function(a){for(var s=i.node(a),c=s.edgeObj,u=n(i,o,c.v,c.w),l=u.path,f=u.lca,d=0,h=l[d],g=!0;a!==c.w;){if(s=i.node(a),g){for(;(h=l[d])!==f&&i.node(h).maxRank<s.rank;)d++;h===f&&(g=!1)}if(!g){for(;d<l.length-1&&i.node(h=l[d+1]).minRank<=s.rank;)d++;h=l[d]}i.setParent(a,h),a=i.successors(a)[0]}})}function n(i,o,a,s){var c=[],u=[],l=Math.min(o[a].low,o[s].low),f=Math.max(o[a].lim,o[s].lim),d,h;d=a;do d=i.parent(d),c.push(d);while(d&&(o[d].low>l||f>o[d].lim));for(h=d,d=s;(d=i.parent(d))!==h;)u.push(d);return{path:c.concat(u.reverse()),lca:h}}function r(i){var o={},a=0;function s(c){var u=a;e.forEach(i.children(c),s),o[c]={low:u,lim:a++}}return e.forEach(i.children(),s),o}return xu}var Eu,ev;function nI(){if(ev)return Eu;ev=1;var e=ae(),t=pe();Eu={run:n,cleanup:a};function n(s){var c=t.addDummyNode(s,"root",{},"_root"),u=i(s),l=e.max(e.values(u))-1,f=2*l+1;s.graph().nestingRoot=c,e.forEach(s.edges(),function(h){s.edge(h).minlen*=f});var d=o(s)+1;e.forEach(s.children(),function(h){r(s,c,f,d,l,u,h)}),s.graph().nodeRankFactor=f}function r(s,c,u,l,f,d,h){var g=s.children(h);if(!g.length){h!==c&&s.setEdge(c,h,{weight:0,minlen:u});return}var m=t.addBorderNode(s,"_bt"),v=t.addBorderNode(s,"_bb"),y=s.node(h);s.setParent(m,h),y.borderTop=m,s.setParent(v,h),y.borderBottom=v,e.forEach(g,function(b){r(s,c,u,l,f,d,b);var p=s.node(b),_=p.borderTop?p.borderTop:b,x=p.borderBottom?p.borderBottom:b,w=p.borderTop?l:2*l,E=_!==x?1:f-d[h]+1;s.setEdge(m,_,{weight:w,minlen:E,nestingEdge:!0}),s.setEdge(x,v,{weight:w,minlen:E,nestingEdge:!0})}),s.parent(h)||s.setEdge(c,m,{weight:0,minlen:f+d[h]})}function i(s){var c={};function u(l,f){var d=s.children(l);d&&d.length&&e.forEach(d,function(h){u(h,f+1)}),c[l]=f}return e.forEach(s.children(),function(l){u(l,1)}),c}function o(s){return e.reduce(s.edges(),function(c,u){return c+s.edge(u).weight},0)}function a(s){var c=s.graph();s.removeNode(c.nestingRoot),delete c.nestingRoot,e.forEach(s.edges(),function(u){var l=s.edge(u);l.nestingEdge&&s.removeEdge(u)})}return Eu}var Su,tv;function rI(){if(tv)return Su;tv=1;var e=ae(),t=pe();Su=n;function n(i){function o(a){var s=i.children(a),c=i.node(a);if(s.length&&e.forEach(s,o),e.has(c,"minRank")){c.borderLeft=[],c.borderRight=[];for(var u=c.minRank,l=c.maxRank+1;u<l;++u)r(i,"borderLeft","_bl",a,c,u),r(i,"borderRight","_br",a,c,u)}}e.forEach(i.children(),o)}function r(i,o,a,s,c,u){var l={width:0,height:0,rank:u,borderType:o},f=c[o][u-1],d=t.addDummyNode(i,"border",l,a);c[o][u]=d,i.setParent(d,s),f&&i.setEdge(f,d,{weight:1})}return Su}var Cu,nv;function iI(){if(nv)return Cu;nv=1;var e=ae();Cu={adjust:t,undo:n};function t(u){var l=u.graph().rankdir.toLowerCase();(l==="lr"||l==="rl")&&r(u)}function n(u){var l=u.graph().rankdir.toLowerCase();(l==="bt"||l==="rl")&&o(u),(l==="lr"||l==="rl")&&(s(u),r(u))}function r(u){e.forEach(u.nodes(),function(l){i(u.node(l))}),e.forEach(u.edges(),function(l){i(u.edge(l))})}function i(u){var l=u.width;u.width=u.height,u.height=l}function o(u){e.forEach(u.nodes(),function(l){a(u.node(l))}),e.forEach(u.edges(),function(l){var f=u.edge(l);e.forEach(f.points,a),e.has(f,"y")&&a(f)})}function a(u){u.y=-u.y}function s(u){e.forEach(u.nodes(),function(l){c(u.node(l))}),e.forEach(u.edges(),function(l){var f=u.edge(l);e.forEach(f.points,c),e.has(f,"x")&&c(f)})}function c(u){var l=u.x;u.x=u.y,u.y=l}return Cu}var qu,rv;function oI(){if(rv)return qu;rv=1;var e=ae();qu=t;function t(n){var r={},i=e.filter(n.nodes(),function(u){return!n.children(u).length}),o=e.max(e.map(i,function(u){return n.node(u).rank})),a=e.map(e.range(o+1),function(){return[]});function s(u){if(!e.has(r,u)){r[u]=!0;var l=n.node(u);a[l.rank].push(u),e.forEach(n.successors(u),s)}}var c=e.sortBy(i,function(u){return n.node(u).rank});return e.forEach(c,s),a}return qu}var Ru,iv;function aI(){if(iv)return Ru;iv=1;var e=ae();Ru=t;function t(r,i){for(var o=0,a=1;a<i.length;++a)o+=n(r,i[a-1],i[a]);return o}function n(r,i,o){for(var a=e.zipObject(o,e.map(o,function(d,h){return h})),s=e.flatten(e.map(i,function(d){return e.sortBy(e.map(r.outEdges(d),function(h){return{pos:a[h.w],weight:r.edge(h).weight}}),"pos")}),!0),c=1;c<o.length;)c<<=1;var u=2*c-1;c-=1;var l=e.map(new Array(u),function(){return 0}),f=0;return e.forEach(s.forEach(function(d){var h=d.pos+c;l[h]+=d.weight;for(var g=0;h>0;)h%2&&(g+=l[h+1]),h=h-1>>1,l[h]+=d.weight;f+=d.weight*g})),f}return Ru}var Iu,ov;function sI(){if(ov)return Iu;ov=1;var e=ae();Iu=t;function t(n,r){return e.map(r,function(i){var o=n.inEdges(i);if(o.length){var a=e.reduce(o,function(s,c){var u=n.edge(c),l=n.node(c.v);return{sum:s.sum+u.weight*l.order,weight:s.weight+u.weight}},{sum:0,weight:0});return{v:i,barycenter:a.sum/a.weight,weight:a.weight}}else return{v:i}})}return Iu}var Nu,av;function uI(){if(av)return Nu;av=1;var e=ae();Nu=t;function t(i,o){var a={};e.forEach(i,function(c,u){var l=a[c.v]={indegree:0,in:[],out:[],vs:[c.v],i:u};e.isUndefined(c.barycenter)||(l.barycenter=c.barycenter,l.weight=c.weight)}),e.forEach(o.edges(),function(c){var u=a[c.v],l=a[c.w];!e.isUndefined(u)&&!e.isUndefined(l)&&(l.indegree++,u.out.push(a[c.w]))});var s=e.filter(a,function(c){return!c.indegree});return n(s)}function n(i){var o=[];function a(u){return function(l){l.merged||(e.isUndefined(l.barycenter)||e.isUndefined(u.barycenter)||l.barycenter>=u.barycenter)&&r(u,l)}}function s(u){return function(l){l.in.push(u),--l.indegree===0&&i.push(l)}}for(;i.length;){var c=i.pop();o.push(c),e.forEach(c.in.reverse(),a(c)),e.forEach(c.out,s(c))}return e.map(e.filter(o,function(u){return!u.merged}),function(u){return e.pick(u,["vs","i","barycenter","weight"])})}function r(i,o){var a=0,s=0;i.weight&&(a+=i.barycenter*i.weight,s+=i.weight),o.weight&&(a+=o.barycenter*o.weight,s+=o.weight),i.vs=o.vs.concat(i.vs),i.barycenter=a/s,i.weight=s,i.i=Math.min(o.i,i.i),o.merged=!0}return Nu}var Au,sv;function cI(){if(sv)return Au;sv=1;var e=ae(),t=pe();Au=n;function n(o,a){var s=t.partition(o,function(m){return e.has(m,"barycenter")}),c=s.lhs,u=e.sortBy(s.rhs,function(m){return-m.i}),l=[],f=0,d=0,h=0;c.sort(i(!!a)),h=r(l,u,h),e.forEach(c,function(m){h+=m.vs.length,l.push(m.vs),f+=m.barycenter*m.weight,d+=m.weight,h=r(l,u,h)});var g={vs:e.flatten(l,!0)};return d&&(g.barycenter=f/d,g.weight=d),g}function r(o,a,s){for(var c;a.length&&(c=e.last(a)).i<=s;)a.pop(),o.push(c.vs),s++;return s}function i(o){return function(a,s){return a.barycenter<s.barycenter?-1:a.barycenter>s.barycenter?1:o?s.i-a.i:a.i-s.i}}return Au}var Mu,uv;function lI(){if(uv)return Mu;uv=1;var e=ae(),t=sI(),n=uI(),r=cI();Mu=i;function i(s,c,u,l){var f=s.children(c),d=s.node(c),h=d?d.borderLeft:void 0,g=d?d.borderRight:void 0,m={};h&&(f=e.filter(f,function(x){return x!==h&&x!==g}));var v=t(s,f);e.forEach(v,function(x){if(s.children(x.v).length){var w=i(s,x.v,u,l);m[x.v]=w,e.has(w,"barycenter")&&a(x,w)}});var y=n(v,u);o(y,m);var b=r(y,l);if(h&&(b.vs=e.flatten([h,b.vs,g],!0),s.predecessors(h).length)){var p=s.node(s.predecessors(h)[0]),_=s.node(s.predecessors(g)[0]);e.has(b,"barycenter")||(b.barycenter=0,b.weight=0),b.barycenter=(b.barycenter*b.weight+p.order+_.order)/(b.weight+2),b.weight+=2}return b}function o(s,c){e.forEach(s,function(u){u.vs=e.flatten(u.vs.map(function(l){return c[l]?c[l].vs:l}),!0)})}function a(s,c){e.isUndefined(s.barycenter)?(s.barycenter=c.barycenter,s.weight=c.weight):(s.barycenter=(s.barycenter*s.weight+c.barycenter*c.weight)/(s.weight+c.weight),s.weight+=c.weight)}return Mu}var Tu,cv;function fI(){if(cv)return Tu;cv=1;var e=ae(),t=Ee().Graph;Tu=n;function n(i,o,a){var s=r(i),c=new t({compound:!0}).setGraph({root:s}).setDefaultNodeLabel(function(u){return i.node(u)});return e.forEach(i.nodes(),function(u){var l=i.node(u),f=i.parent(u);(l.rank===o||l.minRank<=o&&o<=l.maxRank)&&(c.setNode(u),c.setParent(u,f||s),e.forEach(i[a](u),function(d){var h=d.v===u?d.w:d.v,g=c.edge(h,u),m=e.isUndefined(g)?0:g.weight;c.setEdge(h,u,{weight:i.edge(d).weight+m})}),e.has(l,"minRank")&&c.setNode(u,{borderLeft:l.borderLeft[o],borderRight:l.borderRight[o]}))}),c}function r(i){for(var o;i.hasNode(o=e.uniqueId("_root")););return o}return Tu}var Pu,lv;function dI(){if(lv)return Pu;lv=1;var e=ae();Pu=t;function t(n,r,i){var o={},a;e.forEach(i,function(s){for(var c=n.parent(s),u,l;c;){if(u=n.parent(c),u?(l=o[u],o[u]=c):(l=a,a=c),l&&l!==c){r.setEdge(l,c);return}c=u}})}return Pu}var ku,fv;function hI(){if(fv)return ku;fv=1;var e=ae(),t=oI(),n=aI(),r=lI(),i=fI(),o=dI(),a=Ee().Graph,s=pe();ku=c;function c(d){var h=s.maxRank(d),g=u(d,e.range(1,h+1),"inEdges"),m=u(d,e.range(h-1,-1,-1),"outEdges"),v=t(d);f(d,v);for(var y=Number.POSITIVE_INFINITY,b,p=0,_=0;_<4;++p,++_){l(p%2?g:m,p%4>=2),v=s.buildLayerMatrix(d);var x=n(d,v);x<y&&(_=0,b=e.cloneDeep(v),y=x)}f(d,b)}function u(d,h,g){return e.map(h,function(m){return i(d,m,g)})}function l(d,h){var g=new a;e.forEach(d,function(m){var v=m.graph().root,y=r(m,v,g,h);e.forEach(y.vs,function(b,p){m.node(b).order=p}),o(m,g,y.vs)})}function f(d,h){e.forEach(h,function(g){e.forEach(g,function(m,v){d.node(m).order=v})})}return ku}var Ou,dv;function pI(){if(dv)return Ou;dv=1;var e=ae(),t=Ee().Graph,n=pe();Ou={positionX:g,findType1Conflicts:r,findType2Conflicts:i,addConflict:a,hasConflict:s,verticalAlignment:c,horizontalCompaction:u,alignCoordinates:d,findSmallestWidthAlignment:f,balance:h};function r(y,b){var p={};function _(x,w){var E=0,R=0,C=x.length,T=e.last(w);return e.forEach(w,function(q,M){var k=o(y,q),S=k?y.node(k).order:C;(k||q===T)&&(e.forEach(w.slice(R,M+1),function(A){e.forEach(y.predecessors(A),function(N){var L=y.node(N),P=L.order;(P<E||S<P)&&!(L.dummy&&y.node(A).dummy)&&a(p,N,A)})}),R=M+1,E=S)}),w}return e.reduce(b,_),p}function i(y,b){var p={};function _(w,E,R,C,T){var q;e.forEach(e.range(E,R),function(M){q=w[M],y.node(q).dummy&&e.forEach(y.predecessors(q),function(k){var S=y.node(k);S.dummy&&(S.order<C||S.order>T)&&a(p,k,q)})})}function x(w,E){var R=-1,C,T=0;return e.forEach(E,function(q,M){if(y.node(q).dummy==="border"){var k=y.predecessors(q);k.length&&(C=y.node(k[0]).order,_(E,T,M,R,C),T=M,R=C)}_(E,T,E.length,C,w.length)}),E}return e.reduce(b,x),p}function o(y,b){if(y.node(b).dummy)return e.find(y.predecessors(b),function(p){return y.node(p).dummy})}function a(y,b,p){if(b>p){var _=b;b=p,p=_}var x=y[b];x||(y[b]=x={}),x[p]=!0}function s(y,b,p){if(b>p){var _=b;b=p,p=_}return e.has(y[b],p)}function c(y,b,p,_){var x={},w={},E={};return e.forEach(b,function(R){e.forEach(R,function(C,T){x[C]=C,w[C]=C,E[C]=T})}),e.forEach(b,function(R){var C=-1;e.forEach(R,function(T){var q=_(T);if(q.length){q=e.sortBy(q,function(N){return E[N]});for(var M=(q.length-1)/2,k=Math.floor(M),S=Math.ceil(M);k<=S;++k){var A=q[k];w[T]===T&&C<E[A]&&!s(p,T,A)&&(w[A]=T,w[T]=x[T]=x[A],C=E[A])}}})}),{root:x,align:w}}function u(y,b,p,_,x){var w={},E=l(y,b,p,x),R=x?"borderLeft":"borderRight";function C(M,k){for(var S=E.nodes(),A=S.pop(),N={};A;)N[A]?M(A):(N[A]=!0,S.push(A),S=S.concat(k(A))),A=S.pop()}function T(M){w[M]=E.inEdges(M).reduce(function(k,S){return Math.max(k,w[S.v]+E.edge(S))},0)}function q(M){var k=E.outEdges(M).reduce(function(A,N){return Math.min(A,w[N.w]-E.edge(N))},Number.POSITIVE_INFINITY),S=y.node(M);k!==Number.POSITIVE_INFINITY&&S.borderType!==R&&(w[M]=Math.max(w[M],k))}return C(T,E.predecessors.bind(E)),C(q,E.successors.bind(E)),e.forEach(_,function(M){w[M]=w[p[M]]}),w}function l(y,b,p,_){var x=new t,w=y.graph(),E=m(w.nodesep,w.edgesep,_);return e.forEach(b,function(R){var C;e.forEach(R,function(T){var q=p[T];if(x.setNode(q),C){var M=p[C],k=x.edge(M,q);x.setEdge(M,q,Math.max(E(y,T,C),k||0))}C=T})}),x}function f(y,b){return e.minBy(e.values(b),function(p){var _=Number.NEGATIVE_INFINITY,x=Number.POSITIVE_INFINITY;return e.forIn(p,function(w,E){var R=v(y,E)/2;_=Math.max(w+R,_),x=Math.min(w-R,x)}),_-x})}function d(y,b){var p=e.values(b),_=e.min(p),x=e.max(p);e.forEach(["u","d"],function(w){e.forEach(["l","r"],function(E){var R=w+E,C=y[R],T;if(C!==b){var q=e.values(C);T=E==="l"?_-e.min(q):x-e.max(q),T&&(y[R]=e.mapValues(C,function(M){return M+T}))}})})}function h(y,b){return e.mapValues(y.ul,function(p,_){if(b)return y[b.toLowerCase()][_];var x=e.sortBy(e.map(y,_));return(x[1]+x[2])/2})}function g(y){var b=n.buildLayerMatrix(y),p=e.merge(r(y,b),i(y,b)),_={},x;e.forEach(["u","d"],function(E){x=E==="u"?b:e.values(b).reverse(),e.forEach(["l","r"],function(R){R==="r"&&(x=e.map(x,function(M){return e.values(M).reverse()}));var C=(E==="u"?y.predecessors:y.successors).bind(y),T=c(y,x,p,C),q=u(y,x,T.root,T.align,R==="r");R==="r"&&(q=e.mapValues(q,function(M){return-M})),_[E+R]=q})});var w=f(y,_);return d(_,w),h(_,y.graph().align)}function m(y,b,p){return function(_,x,w){var E=_.node(x),R=_.node(w),C=0,T;if(C+=E.width/2,e.has(E,"labelpos"))switch(E.labelpos.toLowerCase()){case"l":T=-E.width/2;break;case"r":T=E.width/2;break}if(T&&(C+=p?T:-T),T=0,C+=(E.dummy?b:y)/2,C+=(R.dummy?b:y)/2,C+=R.width/2,e.has(R,"labelpos"))switch(R.labelpos.toLowerCase()){case"l":T=R.width/2;break;case"r":T=-R.width/2;break}return T&&(C+=p?T:-T),T=0,C}}function v(y,b){return y.node(b).width}return Ou}var Lu,hv;function gI(){if(hv)return Lu;hv=1;var e=ae(),t=pe(),n=pI().positionX;Lu=r;function r(o){o=t.asNonCompoundGraph(o),i(o),e.forEach(n(o),function(a,s){o.node(s).x=a})}function i(o){var a=t.buildLayerMatrix(o),s=o.graph().ranksep,c=0;e.forEach(a,function(u){var l=e.max(e.map(u,function(f){return o.node(f).height}));e.forEach(u,function(f){o.node(f).y=c+l/2}),c+=l+s})}return Lu}var Du,pv;function vI(){if(pv)return Du;pv=1;var e=ae(),t=ZR(),n=QR(),r=eI(),i=pe().normalizeRanks,o=tI(),a=pe().removeEmptyRanks,s=nI(),c=rI(),u=iI(),l=hI(),f=gI(),d=pe(),h=Ee().Graph;Du=g;function g(I,O){var z=O&&O.debugTiming?d.time:d.notime;z("layout",function(){var H=z(" buildLayoutGraph",function(){return C(I)});z(" runLayout",function(){m(H,z)}),z(" updateInputGraph",function(){v(I,H)})})}function m(I,O){O(" makeSpaceForEdgeLabels",function(){T(I)}),O(" removeSelfEdges",function(){D(I)}),O(" acyclic",function(){t.run(I)}),O(" nestingGraph.run",function(){s.run(I)}),O(" rank",function(){r(d.asNonCompoundGraph(I))}),O(" injectEdgeLabelProxies",function(){q(I)}),O(" removeEmptyRanks",function(){a(I)}),O(" nestingGraph.cleanup",function(){s.cleanup(I)}),O(" normalizeRanks",function(){i(I)}),O(" assignRankMinMax",function(){M(I)}),O(" removeEdgeLabelProxies",function(){k(I)}),O(" normalize.run",function(){n.run(I)}),O(" parentDummyChains",function(){o(I)}),O(" addBorderSegments",function(){c(I)}),O(" order",function(){l(I)}),O(" insertSelfEdges",function(){j(I)}),O(" adjustCoordinateSystem",function(){u.adjust(I)}),O(" position",function(){f(I)}),O(" positionSelfEdges",function(){G(I)}),O(" removeBorderNodes",function(){P(I)}),O(" normalize.undo",function(){n.undo(I)}),O(" fixupEdgeLabelCoords",function(){N(I)}),O(" undoCoordinateSystem",function(){u.undo(I)}),O(" translateGraph",function(){S(I)}),O(" assignNodeIntersects",function(){A(I)}),O(" reversePoints",function(){L(I)}),O(" acyclic.undo",function(){t.undo(I)})}function v(I,O){e.forEach(I.nodes(),function(z){var H=I.node(z),B=O.node(z);H&&(H.x=B.x,H.y=B.y,O.children(z).length&&(H.width=B.width,H.height=B.height))}),e.forEach(I.edges(),function(z){var H=I.edge(z),B=O.edge(z);H.points=B.points,e.has(B,"x")&&(H.x=B.x,H.y=B.y)}),I.graph().width=O.graph().width,I.graph().height=O.graph().height}var y=["nodesep","edgesep","ranksep","marginx","marginy"],b={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},p=["acyclicer","ranker","rankdir","align"],_=["width","height"],x={width:0,height:0},w=["minlen","weight","width","height","labeloffset"],E={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},R=["labelpos"];function C(I){var O=new h({multigraph:!0,compound:!0}),z=Y(I.graph());return O.setGraph(e.merge({},b,V(z,y),e.pick(z,p))),e.forEach(I.nodes(),function(H){var B=Y(I.node(H));O.setNode(H,e.defaults(V(B,_),x)),O.setParent(H,I.parent(H))}),e.forEach(I.edges(),function(H){var B=Y(I.edge(H));O.setEdge(H,e.merge({},E,V(B,w),e.pick(B,R)))}),O}function T(I){var O=I.graph();O.ranksep/=2,e.forEach(I.edges(),function(z){var H=I.edge(z);H.minlen*=2,H.labelpos.toLowerCase()!=="c"&&(O.rankdir==="TB"||O.rankdir==="BT"?H.width+=H.labeloffset:H.height+=H.labeloffset)})}function q(I){e.forEach(I.edges(),function(O){var z=I.edge(O);if(z.width&&z.height){var H=I.node(O.v),B=I.node(O.w),U={rank:(B.rank-H.rank)/2+H.rank,e:O};d.addDummyNode(I,"edge-proxy",U,"_ep")}})}function M(I){var O=0;e.forEach(I.nodes(),function(z){var H=I.node(z);H.borderTop&&(H.minRank=I.node(H.borderTop).rank,H.maxRank=I.node(H.borderBottom).rank,O=e.max(O,H.maxRank))}),I.graph().maxRank=O}function k(I){e.forEach(I.nodes(),function(O){var z=I.node(O);z.dummy==="edge-proxy"&&(I.edge(z.e).labelRank=z.rank,I.removeNode(O))})}function S(I){var O=Number.POSITIVE_INFINITY,z=0,H=Number.POSITIVE_INFINITY,B=0,U=I.graph(),X=U.marginx||0,J=U.marginy||0;function Q(W){var te=W.x,K=W.y,re=W.width,ee=W.height;O=Math.min(O,te-re/2),z=Math.max(z,te+re/2),H=Math.min(H,K-ee/2),B=Math.max(B,K+ee/2)}e.forEach(I.nodes(),function(W){Q(I.node(W))}),e.forEach(I.edges(),function(W){var te=I.edge(W);e.has(te,"x")&&Q(te)}),O-=X,H-=J,e.forEach(I.nodes(),function(W){var te=I.node(W);te.x-=O,te.y-=H}),e.forEach(I.edges(),function(W){var te=I.edge(W);e.forEach(te.points,function(K){K.x-=O,K.y-=H}),e.has(te,"x")&&(te.x-=O),e.has(te,"y")&&(te.y-=H)}),U.width=z-O+X,U.height=B-H+J}function A(I){e.forEach(I.edges(),function(O){var z=I.edge(O),H=I.node(O.v),B=I.node(O.w),U,X;z.points?(U=z.points[0],X=z.points[z.points.length-1]):(z.points=[],U=B,X=H),z.points.unshift(d.intersectRect(H,U)),z.points.push(d.intersectRect(B,X))})}function N(I){e.forEach(I.edges(),function(O){var z=I.edge(O);if(e.has(z,"x"))switch((z.labelpos==="l"||z.labelpos==="r")&&(z.width-=z.labeloffset),z.labelpos){case"l":z.x-=z.width/2+z.labeloffset;break;case"r":z.x+=z.width/2+z.labeloffset;break}})}function L(I){e.forEach(I.edges(),function(O){var z=I.edge(O);z.reversed&&z.points.reverse()})}function P(I){e.forEach(I.nodes(),function(O){if(I.children(O).length){var z=I.node(O),H=I.node(z.borderTop),B=I.node(z.borderBottom),U=I.node(e.last(z.borderLeft)),X=I.node(e.last(z.borderRight));z.width=Math.abs(X.x-U.x),z.height=Math.abs(B.y-H.y),z.x=U.x+z.width/2,z.y=H.y+z.height/2}}),e.forEach(I.nodes(),function(O){I.node(O).dummy==="border"&&I.removeNode(O)})}function D(I){e.forEach(I.edges(),function(O){if(O.v===O.w){var z=I.node(O.v);z.selfEdges||(z.selfEdges=[]),z.selfEdges.push({e:O,label:I.edge(O)}),I.removeEdge(O)}})}function j(I){var O=d.buildLayerMatrix(I);e.forEach(O,function(z){var H=0;e.forEach(z,function(B,U){var X=I.node(B);X.order=U+H,e.forEach(X.selfEdges,function(J){d.addDummyNode(I,"selfedge",{width:J.label.width,height:J.label.height,rank:X.rank,order:U+ ++H,e:J.e,label:J.label},"_se")}),delete X.selfEdges})})}function G(I){e.forEach(I.nodes(),function(O){var z=I.node(O);if(z.dummy==="selfedge"){var H=I.node(z.e.v),B=H.x+H.width/2,U=H.y,X=z.x-B,J=H.height/2;I.setEdge(z.e,z.label),I.removeNode(O),z.label.points=[{x:B+2*X/3,y:U-J},{x:B+5*X/6,y:U-J},{x:B+X,y:U},{x:B+5*X/6,y:U+J},{x:B+2*X/3,y:U+J}],z.label.x=z.x,z.label.y=z.y}})}function V(I,O){return e.mapValues(e.pick(I,O),Number)}function Y(I){var O={};return e.forEach(I,function(z,H){O[H.toLowerCase()]=z}),O}return Du}var Fu,gv;function mI(){if(gv)return Fu;gv=1;var e=ae(),t=pe(),n=Ee().Graph;Fu={debugOrdering:r};function r(i){var o=t.buildLayerMatrix(i),a=new n({compound:!0,multigraph:!0}).setGraph({});return e.forEach(i.nodes(),function(s){a.setNode(s,{label:s}),a.setParent(s,"layer"+i.node(s).rank)}),e.forEach(i.edges(),function(s){a.setEdge(s.v,s.w,{},s.name)}),e.forEach(o,function(s,c){var u="layer"+c;a.setNode(u,{rank:"same"}),e.reduce(s,function(l,f){return a.setEdge(l,f,{style:"invis"}),f})}),a}return Fu}var zu,vv;function yI(){return vv||(vv=1,zu="0.8.5"),zu}var $u,mv;function RI(){return mv||(mv=1,$u={graphlib:Ee(),layout:vI(),debug:mI(),util:{time:pe().time,notime:pe().notime},version:yI()}),$u}export{SI as B,mt as C,An as H,Rn as M,Z as P,EI as a,CI as b,qI as c,wI as i,RI as r,xI as u};