@mcp-graph-workflow/mcp-graph 5.30.0 → 5.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/api/router.d.ts.map +1 -1
  2. package/dist/api/router.js +2 -0
  3. package/dist/api/router.js.map +1 -1
  4. package/dist/api/routes/dream.d.ts +5 -0
  5. package/dist/api/routes/dream.d.ts.map +1 -0
  6. package/dist/api/routes/dream.js +142 -0
  7. package/dist/api/routes/dream.js.map +1 -0
  8. package/dist/core/dream/dream-engine.d.ts +40 -0
  9. package/dist/core/dream/dream-engine.d.ts.map +1 -0
  10. package/dist/core/dream/dream-engine.js +192 -0
  11. package/dist/core/dream/dream-engine.js.map +1 -0
  12. package/dist/core/dream/dream-store.d.ts +19 -0
  13. package/dist/core/dream/dream-store.d.ts.map +1 -0
  14. package/dist/core/dream/dream-store.js +86 -0
  15. package/dist/core/dream/dream-store.js.map +1 -0
  16. package/dist/core/dream/dream-types.d.ts +128 -0
  17. package/dist/core/dream/dream-types.d.ts.map +1 -0
  18. package/dist/core/dream/dream-types.js +99 -0
  19. package/dist/core/dream/dream-types.js.map +1 -0
  20. package/dist/core/dream/phases/nrem-phase.d.ts +21 -0
  21. package/dist/core/dream/phases/nrem-phase.d.ts.map +1 -0
  22. package/dist/core/dream/phases/nrem-phase.js +98 -0
  23. package/dist/core/dream/phases/nrem-phase.js.map +1 -0
  24. package/dist/core/dream/phases/rem-phase.d.ts +22 -0
  25. package/dist/core/dream/phases/rem-phase.d.ts.map +1 -0
  26. package/dist/core/dream/phases/rem-phase.js +87 -0
  27. package/dist/core/dream/phases/rem-phase.js.map +1 -0
  28. package/dist/core/dream/phases/wake-ready-phase.d.ts +24 -0
  29. package/dist/core/dream/phases/wake-ready-phase.d.ts.map +1 -0
  30. package/dist/core/dream/phases/wake-ready-phase.js +63 -0
  31. package/dist/core/dream/phases/wake-ready-phase.js.map +1 -0
  32. package/dist/core/events/event-types.d.ts +39 -1
  33. package/dist/core/events/event-types.d.ts.map +1 -1
  34. package/dist/core/store/migrations.d.ts.map +1 -1
  35. package/dist/core/store/migrations.js +30 -0
  36. package/dist/core/store/migrations.js.map +1 -1
  37. package/dist/docs-manifest.json +36 -1
  38. package/dist/schemas/entity.schema.d.ts +2 -2
  39. package/dist/web/dashboard/dist/assets/{benchmark-tab-Dx9G7cqf.js → benchmark-tab-BD02uofm.js} +1 -1
  40. package/dist/web/dashboard/dist/assets/{circle-alert-B17sfIdw.js → circle-alert-RxlCxXj1.js} +1 -1
  41. package/dist/web/dashboard/dist/assets/context-tab-DTPFGxle.js +1 -0
  42. package/dist/web/dashboard/dist/assets/{docs-tab-sxC7Gxc7.js → docs-tab-2uo7-Ybt.js} +1 -1
  43. package/dist/web/dashboard/dist/assets/{gitnexus-tab-DEcNhLvY.js → gitnexus-tab-CiiNOf3e.js} +1 -1
  44. package/dist/web/dashboard/dist/assets/{graph-section-CsHifp70.js → graph-section-DKMay1zv.js} +1 -1
  45. package/dist/web/dashboard/dist/assets/{graph-tab-D8ZSUyGR.js → graph-tab-BYRVanTv.js} +1 -1
  46. package/dist/web/dashboard/dist/assets/{graph-utils-D10A5HwE.js → graph-utils-1O2cEKuy.js} +1 -1
  47. package/dist/web/dashboard/dist/assets/{index-07Y4UWP1.js → index-B5DzSMGg.js} +1 -1
  48. package/dist/web/dashboard/dist/assets/index-BxDGbcbB.css +1 -0
  49. package/dist/web/dashboard/dist/assets/{index-Dbaws8C6.js → index-CIhDR5rf.js} +26 -26
  50. package/dist/web/dashboard/dist/assets/{index-CVRN6scU.js → index-CSeiGgX8.js} +1 -1
  51. package/dist/web/dashboard/dist/assets/{insights-tab-DJAtypOr.js → insights-tab-DdI7TLP7.js} +1 -1
  52. package/dist/web/dashboard/dist/assets/{journey-tab-CXtDFeGm.js → journey-tab-CDuvIW6V.js} +1 -1
  53. package/dist/web/dashboard/dist/assets/{languages-tab-03j3C58E.js → languages-tab-CrbP4u3b.js} +1 -1
  54. package/dist/web/dashboard/dist/assets/{loader-circle-BNEIXs1s.js → loader-circle-Bl0DpM5P.js} +1 -1
  55. package/dist/web/dashboard/dist/assets/{logs-tab-D3BE923P.js → logs-tab-QYKxeHna.js} +1 -1
  56. package/dist/web/dashboard/dist/assets/{lsp-tab-cac4ysh4.js → lsp-tab-CLO4RFMh.js} +1 -1
  57. package/dist/web/dashboard/dist/assets/{memories-tab-BPJTM45d.js → memories-tab-BT7A7YOy.js} +1 -1
  58. package/dist/web/dashboard/dist/assets/{prd-backlog-tab-5PCpKm0j.js → prd-backlog-tab-M1j0tAm2.js} +1 -1
  59. package/dist/web/dashboard/dist/assets/{refresh-cw-CI2U4FGa.js → refresh-cw-0ApsgAym.js} +1 -1
  60. package/dist/web/dashboard/dist/assets/{siebel-tab-BuhOpZO3.js → siebel-tab-CsZz2y2b.js} +3 -3
  61. package/dist/web/dashboard/dist/assets/{skills-tab-BHWwOBtm.js → skills-tab-BrkrK7AC.js} +1 -1
  62. package/dist/web/dashboard/dist/assets/{style-BPgBTbDw.js → style-UgkJJqFQ.js} +1 -1
  63. package/dist/web/dashboard/dist/assets/{triangle-alert-aqoYdsgW.js → triangle-alert-BcgxNLLr.js} +1 -1
  64. package/dist/web/dashboard/dist/index.html +2 -2
  65. package/package.json +2 -2
  66. package/dist/web/dashboard/dist/assets/context-tab-BX2hlI9H.js +0 -1
  67. package/dist/web/dashboard/dist/assets/index-DVIgWBT4.css +0 -1
@@ -1,4 +1,4 @@
1
- import{t as bs,r as L,j as $}from"./index-Dbaws8C6.js";import{a as Ct,c as Bn,b as Fn,d as Es,i as Ke,u as Ss,r as Ns}from"./index-07Y4UWP1.js";function it(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n=0,o;n<t.length;n++)(o=it(t[n]))!==""&&(e+=(e&&" ")+o);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}var Cs={value:()=>{}};function ze(){for(var t=0,e=arguments.length,n={},o;t<e;++t){if(!(o=arguments[t]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new ve(n)}function ve(t){this._=t}function Ms(t,e){return t.trim().split(/^|\s+/).map(function(n){var o="",r=n.indexOf(".");if(r>=0&&(o=n.slice(r+1),n=n.slice(0,r)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}ve.prototype=ze.prototype={constructor:ve,on:function(t,e){var n=this._,o=Ms(t+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(t=o[i]).type)&&(r=Is(n[r],t.name)))return r;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++i<s;)if(r=(t=o[i]).type)n[r]=On(n[r],t.name,e);else if(e==null)for(r in n)n[r]=On(n[r],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new ve(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,i;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=this._[t],o=0,r=i.length;o<r;++o)i[o].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var o=this._[t],r=0,i=o.length;r<i;++r)o[r].value.apply(e,n)}};function Is(t,e){for(var n=0,o=t.length,r;n<o;++n)if((r=t[n]).name===e)return r.value}function On(t,e,n){for(var o=0,r=t.length;o<r;++o)if(t[o].name===e){t[o]=Cs,t=t.slice(0,o).concat(t.slice(o+1));break}return n!=null&&t.push({name:e,value:n}),t}var on="http://www.w3.org/1999/xhtml";const Xn={svg:"http://www.w3.org/2000/svg",xhtml:on,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Le(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),Xn.hasOwnProperty(e)?{space:Xn[e],local:t}:t}function As(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===on&&e.documentElement.namespaceURI===on?e.createElement(t):e.createElementNS(n,t)}}function ks(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Ho(t){var e=Le(t);return(e.local?ks:As)(e)}function Ps(){}function mn(t){return t==null?Ps:function(){return this.querySelector(t)}}function $s(t){typeof t!="function"&&(t=mn(t));for(var e=this._groups,n=e.length,o=new Array(n),r=0;r<n;++r)for(var i=e[r],s=i.length,a=o[r]=new Array(s),c,l,f=0;f<s;++f)(c=i[f])&&(l=t.call(c,c.__data__,f,i))&&("__data__"in c&&(l.__data__=c.__data__),a[f]=l);return new ct(o,this._parents)}function Ts(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function zs(){return[]}function Ro(t){return t==null?zs:function(){return this.querySelectorAll(t)}}function Ls(t){return function(){return Ts(t.apply(this,arguments))}}function Ds(t){typeof t=="function"?t=Ls(t):t=Ro(t);for(var e=this._groups,n=e.length,o=[],r=[],i=0;i<n;++i)for(var s=e[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(o.push(t.call(c,c.__data__,l,s)),r.push(c));return new ct(o,r)}function Vo(t){return function(){return this.matches(t)}}function Bo(t){return function(e){return e.matches(t)}}var Hs=Array.prototype.find;function Rs(t){return function(){return Hs.call(this.children,t)}}function Vs(){return this.firstElementChild}function Bs(t){return this.select(t==null?Vs:Rs(typeof t=="function"?t:Bo(t)))}var Fs=Array.prototype.filter;function Os(){return Array.from(this.children)}function Xs(t){return function(){return Fs.call(this.children,t)}}function Ys(t){return this.selectAll(t==null?Os:Xs(typeof t=="function"?t:Bo(t)))}function js(t){typeof t!="function"&&(t=Vo(t));for(var e=this._groups,n=e.length,o=new Array(n),r=0;r<n;++r)for(var i=e[r],s=i.length,a=o[r]=[],c,l=0;l<s;++l)(c=i[l])&&t.call(c,c.__data__,l,i)&&a.push(c);return new ct(o,this._parents)}function Fo(t){return new Array(t.length)}function Ws(){return new ct(this._enter||this._groups.map(Fo),this._parents)}function Ne(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Ne.prototype={constructor:Ne,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function Gs(t){return function(){return t}}function qs(t,e,n,o,r,i){for(var s=0,a,c=e.length,l=i.length;s<l;++s)(a=e[s])?(a.__data__=i[s],o[s]=a):n[s]=new Ne(t,i[s]);for(;s<c;++s)(a=e[s])&&(r[s]=a)}function Ks(t,e,n,o,r,i,s){var a,c,l=new Map,f=e.length,u=i.length,d=new Array(f),p;for(a=0;a<f;++a)(c=e[a])&&(d[a]=p=s.call(c,c.__data__,a,e)+"",l.has(p)?r[a]=c:l.set(p,c));for(a=0;a<u;++a)p=s.call(t,i[a],a,i)+"",(c=l.get(p))?(o[a]=c,c.__data__=i[a],l.delete(p)):n[a]=new Ne(t,i[a]);for(a=0;a<f;++a)(c=e[a])&&l.get(d[a])===c&&(r[a]=c)}function Zs(t){return t.__data__}function Us(t,e){if(!arguments.length)return Array.from(this,Zs);var n=e?Ks:qs,o=this._parents,r=this._groups;typeof t!="function"&&(t=Gs(t));for(var i=r.length,s=new Array(i),a=new Array(i),c=new Array(i),l=0;l<i;++l){var f=o[l],u=r[l],d=u.length,p=Qs(t.call(f,f&&f.__data__,l,o)),g=p.length,w=a[l]=new Array(g),y=s[l]=new Array(g),m=c[l]=new Array(d);n(f,u,w,y,m,p,e);for(var _=0,h=0,x,N;_<g;++_)if(x=w[_]){for(_>=h&&(h=_+1);!(N=y[h])&&++h<g;);x._next=N||null}}return s=new ct(s,o),s._enter=a,s._exit=c,s}function Qs(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function Js(){return new ct(this._exit||this._groups.map(Fo),this._parents)}function ta(t,e,n){var o=this.enter(),r=this,i=this.exit();return typeof t=="function"?(o=t(o),o&&(o=o.selection())):o=o.append(t+""),e!=null&&(r=e(r),r&&(r=r.selection())),n==null?i.remove():n(i),o&&r?o.merge(r).order():r}function ea(t){for(var e=t.selection?t.selection():t,n=this._groups,o=e._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),c=0;c<s;++c)for(var l=n[c],f=o[c],u=l.length,d=a[c]=new Array(u),p,g=0;g<u;++g)(p=l[g]||f[g])&&(d[g]=p);for(;c<r;++c)a[c]=n[c];return new ct(a,this._parents)}function na(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var o=t[e],r=o.length-1,i=o[r],s;--r>=0;)(s=o[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function oa(t){t||(t=ra);function e(u,d){return u&&d?t(u.__data__,d.__data__):!u-!d}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],a=s.length,c=r[i]=new Array(a),l,f=0;f<a;++f)(l=s[f])&&(c[f]=l);c.sort(e)}return new ct(r,this._parents).order()}function ra(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function ia(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function sa(){return Array.from(this)}function aa(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var o=t[e],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function ca(){let t=0;for(const e of this)++t;return t}function ua(){return!this.node()}function la(t){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var r=e[n],i=0,s=r.length,a;i<s;++i)(a=r[i])&&t.call(a,a.__data__,i,r);return this}function da(t){return function(){this.removeAttribute(t)}}function fa(t){return function(){this.removeAttributeNS(t.space,t.local)}}function ha(t,e){return function(){this.setAttribute(t,e)}}function ga(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function pa(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function ma(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function ya(t,e){var n=Le(t);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((e==null?n.local?fa:da:typeof e=="function"?n.local?ma:pa:n.local?ga:ha)(n,e))}function Oo(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function xa(t){return function(){this.style.removeProperty(t)}}function wa(t,e,n){return function(){this.style.setProperty(t,e,n)}}function va(t,e,n){return function(){var o=e.apply(this,arguments);o==null?this.style.removeProperty(t):this.style.setProperty(t,o,n)}}function _a(t,e,n){return arguments.length>1?this.each((e==null?xa:typeof e=="function"?va:wa)(t,e,n??"")):Ht(this.node(),t)}function Ht(t,e){return t.style.getPropertyValue(e)||Oo(t).getComputedStyle(t,null).getPropertyValue(e)}function ba(t){return function(){delete this[t]}}function Ea(t,e){return function(){this[t]=e}}function Sa(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function Na(t,e){return arguments.length>1?this.each((e==null?ba:typeof e=="function"?Sa:Ea)(t,e)):this.node()[t]}function Xo(t){return t.trim().split(/^|\s+/)}function yn(t){return t.classList||new Yo(t)}function Yo(t){this._node=t,this._names=Xo(t.getAttribute("class")||"")}Yo.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function jo(t,e){for(var n=yn(t),o=-1,r=e.length;++o<r;)n.add(e[o])}function Wo(t,e){for(var n=yn(t),o=-1,r=e.length;++o<r;)n.remove(e[o])}function Ca(t){return function(){jo(this,t)}}function Ma(t){return function(){Wo(this,t)}}function Ia(t,e){return function(){(e.apply(this,arguments)?jo:Wo)(this,t)}}function Aa(t,e){var n=Xo(t+"");if(arguments.length<2){for(var o=yn(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof e=="function"?Ia:e?Ca:Ma)(n,e))}function ka(){this.textContent=""}function Pa(t){return function(){this.textContent=t}}function $a(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Ta(t){return arguments.length?this.each(t==null?ka:(typeof t=="function"?$a:Pa)(t)):this.node().textContent}function za(){this.innerHTML=""}function La(t){return function(){this.innerHTML=t}}function Da(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function Ha(t){return arguments.length?this.each(t==null?za:(typeof t=="function"?Da:La)(t)):this.node().innerHTML}function Ra(){this.nextSibling&&this.parentNode.appendChild(this)}function Va(){return this.each(Ra)}function Ba(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Fa(){return this.each(Ba)}function Oa(t){var e=typeof t=="function"?t:Ho(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function Xa(){return null}function Ya(t,e){var n=typeof t=="function"?t:Ho(t),o=e==null?Xa:typeof e=="function"?e:mn(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function ja(){var t=this.parentNode;t&&t.removeChild(this)}function Wa(){return this.each(ja)}function Ga(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function qa(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Ka(t){return this.select(t?qa:Ga)}function Za(t){return arguments.length?this.property("__data__",t):this.node().__data__}function Ua(t){return function(e){t.call(this,e,this.__data__)}}function Qa(t){return t.trim().split(/^|\s+/).map(function(e){var n="",o=e.indexOf(".");return o>=0&&(n=e.slice(o+1),e=e.slice(0,o)),{type:e,name:n}})}function Ja(t){return function(){var e=this.__on;if(e){for(var n=0,o=-1,r=e.length,i;n<r;++n)i=e[n],(!t.type||i.type===t.type)&&i.name===t.name?this.removeEventListener(i.type,i.listener,i.options):e[++o]=i;++o?e.length=o:delete this.__on}}}function tc(t,e,n){return function(){var o=this.__on,r,i=Ua(e);if(o){for(var s=0,a=o.length;s<a;++s)if((r=o[s]).type===t.type&&r.name===t.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=e;return}}this.addEventListener(t.type,i,n),r={type:t.type,name:t.name,value:e,listener:i,options:n},o?o.push(r):this.__on=[r]}}function ec(t,e,n){var o=Qa(t+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,f;c<l;++c)for(r=0,f=a[c];r<i;++r)if((s=o[r]).type===f.type&&s.name===f.name)return f.value}return}for(a=e?tc:Ja,r=0;r<i;++r)this.each(a(o[r],e,n));return this}function Go(t,e,n){var o=Oo(t),r=o.CustomEvent;typeof r=="function"?r=new r(e,n):(r=o.document.createEvent("Event"),n?(r.initEvent(e,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(e,!1,!1)),t.dispatchEvent(r)}function nc(t,e){return function(){return Go(this,t,e)}}function oc(t,e){return function(){return Go(this,t,e.apply(this,arguments))}}function rc(t,e){return this.each((typeof e=="function"?oc:nc)(t,e))}function*ic(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var o=t[e],r=0,i=o.length,s;r<i;++r)(s=o[r])&&(yield s)}var qo=[null];function ct(t,e){this._groups=t,this._parents=e}function se(){return new ct([[document.documentElement]],qo)}function sc(){return this}ct.prototype=se.prototype={constructor:ct,select:$s,selectAll:Ds,selectChild:Bs,selectChildren:Ys,filter:js,data:Us,enter:Ws,exit:Js,join:ta,merge:ea,selection:sc,order:na,sort:oa,call:ia,nodes:sa,node:aa,size:ca,empty:ua,each:la,attr:ya,style:_a,property:Na,classed:Aa,text:Ta,html:Ha,raise:Va,lower:Fa,append:Oa,insert:Ya,remove:Wa,clone:Ka,datum:Za,on:ec,dispatch:rc,[Symbol.iterator]:ic};function at(t){return typeof t=="string"?new ct([[document.querySelector(t)]],[document.documentElement]):new ct([[t]],qo)}function ac(t){let e;for(;e=t.sourceEvent;)t=e;return t}function ut(t,e){if(t=ac(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=t.clientX,o.y=t.clientY,o=o.matrixTransform(e.getScreenCTM().inverse()),[o.x,o.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}}return[t.pageX,t.pageY]}const cc={passive:!1},Jt={capture:!0,passive:!1};function Ze(t){t.stopImmediatePropagation()}function Dt(t){t.preventDefault(),t.stopImmediatePropagation()}function Ko(t){var e=t.document.documentElement,n=at(t).on("dragstart.drag",Dt,Jt);"onselectstart"in e?n.on("selectstart.drag",Dt,Jt):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Zo(t,e){var n=t.document.documentElement,o=at(t).on("dragstart.drag",null);e&&(o.on("click.drag",Dt,Jt),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const he=t=>()=>t;function rn(t,{sourceEvent:e,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:c,dy:l,dispatch:f}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:f}})}rn.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function uc(t){return!t.ctrlKey&&!t.button}function lc(){return this.parentNode}function dc(t,e){return e??{x:t.x,y:t.y}}function fc(){return navigator.maxTouchPoints||"ontouchstart"in this}function Uo(){var t=uc,e=lc,n=dc,o=fc,r={},i=ze("start","drag","end"),s=0,a,c,l,f,u=0;function d(x){x.on("mousedown.drag",p).filter(o).on("touchstart.drag",y).on("touchmove.drag",m,cc).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(x,N){if(!(f||!t.call(this,x,N))){var b=h(this,e.call(this,x,N),x,N,"mouse");b&&(at(x.view).on("mousemove.drag",g,Jt).on("mouseup.drag",w,Jt),Ko(x.view),Ze(x),l=!1,a=x.clientX,c=x.clientY,b("start",x))}}function g(x){if(Dt(x),!l){var N=x.clientX-a,b=x.clientY-c;l=N*N+b*b>u}r.mouse("drag",x)}function w(x){at(x.view).on("mousemove.drag mouseup.drag",null),Zo(x.view,l),Dt(x),r.mouse("end",x)}function y(x,N){if(t.call(this,x,N)){var b=x.changedTouches,C=e.call(this,x,N),z=b.length,T,B;for(T=0;T<z;++T)(B=h(this,C,x,N,b[T].identifier,b[T]))&&(Ze(x),B("start",x,b[T]))}}function m(x){var N=x.changedTouches,b=N.length,C,z;for(C=0;C<b;++C)(z=r[N[C].identifier])&&(Dt(x),z("drag",x,N[C]))}function _(x){var N=x.changedTouches,b=N.length,C,z;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),C=0;C<b;++C)(z=r[N[C].identifier])&&(Ze(x),z("end",x,N[C]))}function h(x,N,b,C,z,T){var B=i.copy(),I=ut(T||b,N),P,V,v;if((v=n.call(x,new rn("beforestart",{sourceEvent:b,target:d,identifier:z,active:s,x:I[0],y:I[1],dx:0,dy:0,dispatch:B}),C))!=null)return P=v.x-I[0]||0,V=v.y-I[1]||0,function A(E,k,M){var S=I,D;switch(E){case"start":r[z]=A,D=s++;break;case"end":delete r[z],--s;case"drag":I=ut(M||k,N),D=s;break}B.call(E,x,new rn(E,{sourceEvent:k,subject:v,target:d,identifier:z,active:D,x:I[0]+P,y:I[1]+V,dx:I[0]-S[0],dy:I[1]-S[1],dispatch:B}),C)}}return d.filter=function(x){return arguments.length?(t=typeof x=="function"?x:he(!!x),d):t},d.container=function(x){return arguments.length?(e=typeof x=="function"?x:he(x),d):e},d.subject=function(x){return arguments.length?(n=typeof x=="function"?x:he(x),d):n},d.touchable=function(x){return arguments.length?(o=typeof x=="function"?x:he(!!x),d):o},d.on=function(){var x=i.on.apply(i,arguments);return x===i?d:x},d.clickDistance=function(x){return arguments.length?(u=(x=+x)*x,d):Math.sqrt(u)},d}var Yn=180/Math.PI,sn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Qo(t,e,n,o,r,i){var s,a,c;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(c=t*n+e*o)&&(n-=t*c,o-=e*c),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,c/=a),t*o<e*n&&(t=-t,e=-e,c=-c,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(e,t)*Yn,skewX:Math.atan(c)*Yn,scaleX:s,scaleY:a}}var ge;function hc(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?sn:Qo(e.a,e.b,e.c,e.d,e.e,e.f)}function gc(t){return t==null||(ge||(ge=document.createElementNS("http://www.w3.org/2000/svg","g")),ge.setAttribute("transform",t),!(t=ge.transform.baseVal.consolidate()))?sn:(t=t.matrix,Qo(t.a,t.b,t.c,t.d,t.e,t.f))}function Jo(t,e,n,o){function r(l){return l.length?l.pop()+" ":""}function i(l,f,u,d,p,g){if(l!==u||f!==d){var w=p.push("translate(",null,e,null,n);g.push({i:w-4,x:Ct(l,u)},{i:w-2,x:Ct(f,d)})}else(u||d)&&p.push("translate("+u+e+d+n)}function s(l,f,u,d){l!==f?(l-f>180?f+=360:f-l>180&&(l+=360),d.push({i:u.push(r(u)+"rotate(",null,o)-2,x:Ct(l,f)})):f&&u.push(r(u)+"rotate("+f+o)}function a(l,f,u,d){l!==f?d.push({i:u.push(r(u)+"skewX(",null,o)-2,x:Ct(l,f)}):f&&u.push(r(u)+"skewX("+f+o)}function c(l,f,u,d,p,g){if(l!==u||f!==d){var w=p.push(r(p)+"scale(",null,",",null,")");g.push({i:w-4,x:Ct(l,u)},{i:w-2,x:Ct(f,d)})}else(u!==1||d!==1)&&p.push(r(p)+"scale("+u+","+d+")")}return function(l,f){var u=[],d=[];return l=t(l),f=t(f),i(l.translateX,l.translateY,f.translateX,f.translateY,u,d),s(l.rotate,f.rotate,u,d),a(l.skewX,f.skewX,u,d),c(l.scaleX,l.scaleY,f.scaleX,f.scaleY,u,d),l=f=null,function(p){for(var g=-1,w=d.length,y;++g<w;)u[(y=d[g]).i]=y.x(p);return u.join("")}}}var pc=Jo(hc,"px, ","px)","deg)"),mc=Jo(gc,", ",")",")"),yc=1e-12;function jn(t){return((t=Math.exp(t))+1/t)/2}function xc(t){return((t=Math.exp(t))-1/t)/2}function wc(t){return((t=Math.exp(2*t))-1)/(t+1)}const _e=(function t(e,n,o){function r(i,s){var a=i[0],c=i[1],l=i[2],f=s[0],u=s[1],d=s[2],p=f-a,g=u-c,w=p*p+g*g,y,m;if(w<yc)m=Math.log(d/l)/e,y=function(C){return[a+C*p,c+C*g,l*Math.exp(e*C*m)]};else{var _=Math.sqrt(w),h=(d*d-l*l+o*w)/(2*l*n*_),x=(d*d-l*l-o*w)/(2*d*n*_),N=Math.log(Math.sqrt(h*h+1)-h),b=Math.log(Math.sqrt(x*x+1)-x);m=(b-N)/e,y=function(C){var z=C*m,T=jn(N),B=l/(n*_)*(T*wc(e*z+N)-xc(N));return[a+B*p,c+B*g,l*T/jn(e*z+N)]}}return y.duration=m*1e3*e/Math.SQRT2,y}return r.rho=function(i){var s=Math.max(.001,+i),a=s*s,c=a*a;return t(s,a,c)},r})(Math.SQRT2,2,4);var Rt=0,Zt=0,qt=0,tr=1e3,Ce,Ut,Me=0,At=0,De=0,te=typeof performance=="object"&&performance.now?performance:Date,er=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function xn(){return At||(er(vc),At=te.now()+De)}function vc(){At=0}function Ie(){this._call=this._time=this._next=null}Ie.prototype=nr.prototype={constructor:Ie,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?xn():+n)+(e==null?0:+e),!this._next&&Ut!==this&&(Ut?Ut._next=this:Ce=this,Ut=this),this._call=t,this._time=n,an()},stop:function(){this._call&&(this._call=null,this._time=1/0,an())}};function nr(t,e,n){var o=new Ie;return o.restart(t,e,n),o}function _c(){xn(),++Rt;for(var t=Ce,e;t;)(e=At-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Rt}function Wn(){At=(Me=te.now())+De,Rt=Zt=0;try{_c()}finally{Rt=0,Ec(),At=0}}function bc(){var t=te.now(),e=t-Me;e>tr&&(De-=e,Me=t)}function Ec(){for(var t,e=Ce,n,o=1/0;e;)e._call?(o>e._time&&(o=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Ce=n);Ut=t,an(o)}function an(t){if(!Rt){Zt&&(Zt=clearTimeout(Zt));var e=t-At;e>24?(t<1/0&&(Zt=setTimeout(Wn,t-te.now()-De)),qt&&(qt=clearInterval(qt))):(qt||(Me=te.now(),qt=setInterval(bc,tr)),Rt=1,er(Wn))}}function Gn(t,e,n){var o=new Ie;return e=e==null?0:+e,o.restart(r=>{o.stop(),t(r+e)},e,n),o}var Sc=ze("start","end","cancel","interrupt"),Nc=[],or=0,qn=1,cn=2,be=3,Kn=4,un=5,Ee=6;function He(t,e,n,o,r,i){var s=t.__transition;if(!s)t.__transition={};else if(n in s)return;Cc(t,n,{name:e,index:o,group:r,on:Sc,tween:Nc,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:or})}function wn(t,e){var n=ft(t,e);if(n.state>or)throw new Error("too late; already scheduled");return n}function gt(t,e){var n=ft(t,e);if(n.state>be)throw new Error("too late; already running");return n}function ft(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Cc(t,e,n){var o=t.__transition,r;o[e]=n,n.timer=nr(i,0,n.time);function i(l){n.state=qn,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var f,u,d,p;if(n.state!==qn)return c();for(f in o)if(p=o[f],p.name===n.name){if(p.state===be)return Gn(s);p.state===Kn?(p.state=Ee,p.timer.stop(),p.on.call("interrupt",t,t.__data__,p.index,p.group),delete o[f]):+f<e&&(p.state=Ee,p.timer.stop(),p.on.call("cancel",t,t.__data__,p.index,p.group),delete o[f])}if(Gn(function(){n.state===be&&(n.state=Kn,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=cn,n.on.call("start",t,t.__data__,n.index,n.group),n.state===cn){for(n.state=be,r=new Array(d=n.tween.length),f=0,u=-1;f<d;++f)(p=n.tween[f].value.call(t,t.__data__,n.index,n.group))&&(r[++u]=p);r.length=u+1}}function a(l){for(var f=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=un,1),u=-1,d=r.length;++u<d;)r[u].call(t,f);n.state===un&&(n.on.call("end",t,t.__data__,n.index,n.group),c())}function c(){n.state=Ee,n.timer.stop(),delete o[e];for(var l in o)return;delete t.__transition}}function Se(t,e){var n=t.__transition,o,r,i=!0,s;if(n){e=e==null?null:e+"";for(s in n){if((o=n[s]).name!==e){i=!1;continue}r=o.state>cn&&o.state<un,o.state=Ee,o.timer.stop(),o.on.call(r?"interrupt":"cancel",t,t.__data__,o.index,o.group),delete n[s]}i&&delete t.__transition}}function Mc(t){return this.each(function(){Se(this,t)})}function Ic(t,e){var n,o;return function(){var r=gt(this,t),i=r.tween;if(i!==n){o=n=i;for(var s=0,a=o.length;s<a;++s)if(o[s].name===e){o=o.slice(),o.splice(s,1);break}}r.tween=o}}function Ac(t,e,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=gt(this,t),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:e,value:n},c=0,l=r.length;c<l;++c)if(r[c].name===e){r[c]=a;break}c===l&&r.push(a)}i.tween=r}}function kc(t,e){var n=this._id;if(t+="",arguments.length<2){for(var o=ft(this.node(),n).tween,r=0,i=o.length,s;r<i;++r)if((s=o[r]).name===t)return s.value;return null}return this.each((e==null?Ic:Ac)(n,t,e))}function vn(t,e,n){var o=t._id;return t.each(function(){var r=gt(this,o);(r.value||(r.value={}))[e]=n.apply(this,arguments)}),function(r){return ft(r,o).value[e]}}function rr(t,e){var n;return(typeof e=="number"?Ct:e instanceof Bn?Fn:(n=Bn(e))?(e=n,Fn):Es)(t,e)}function Pc(t){return function(){this.removeAttribute(t)}}function $c(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Tc(t,e,n){var o,r=n+"",i;return function(){var s=this.getAttribute(t);return s===r?null:s===o?i:i=e(o=s,n)}}function zc(t,e,n){var o,r=n+"",i;return function(){var s=this.getAttributeNS(t.space,t.local);return s===r?null:s===o?i:i=e(o=s,n)}}function Lc(t,e,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(t):(s=this.getAttribute(t),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=e(o=s,a)))}}function Dc(t,e,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(t.space,t.local):(s=this.getAttributeNS(t.space,t.local),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=e(o=s,a)))}}function Hc(t,e){var n=Le(t),o=n==="transform"?mc:rr;return this.attrTween(t,typeof e=="function"?(n.local?Dc:Lc)(n,o,vn(this,"attr."+t,e)):e==null?(n.local?$c:Pc)(n):(n.local?zc:Tc)(n,o,e))}function Rc(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function Vc(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function Bc(t,e){var n,o;function r(){var i=e.apply(this,arguments);return i!==o&&(n=(o=i)&&Vc(t,i)),n}return r._value=e,r}function Fc(t,e){var n,o;function r(){var i=e.apply(this,arguments);return i!==o&&(n=(o=i)&&Rc(t,i)),n}return r._value=e,r}function Oc(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var o=Le(t);return this.tween(n,(o.local?Bc:Fc)(o,e))}function Xc(t,e){return function(){wn(this,t).delay=+e.apply(this,arguments)}}function Yc(t,e){return e=+e,function(){wn(this,t).delay=e}}function jc(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Xc:Yc)(e,t)):ft(this.node(),e).delay}function Wc(t,e){return function(){gt(this,t).duration=+e.apply(this,arguments)}}function Gc(t,e){return e=+e,function(){gt(this,t).duration=e}}function qc(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Wc:Gc)(e,t)):ft(this.node(),e).duration}function Kc(t,e){if(typeof e!="function")throw new Error;return function(){gt(this,t).ease=e}}function Zc(t){var e=this._id;return arguments.length?this.each(Kc(e,t)):ft(this.node(),e).ease}function Uc(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;gt(this,t).ease=n}}function Qc(t){if(typeof t!="function")throw new Error;return this.each(Uc(this._id,t))}function Jc(t){typeof t!="function"&&(t=Vo(t));for(var e=this._groups,n=e.length,o=new Array(n),r=0;r<n;++r)for(var i=e[r],s=i.length,a=o[r]=[],c,l=0;l<s;++l)(c=i[l])&&t.call(c,c.__data__,l,i)&&a.push(c);return new xt(o,this._parents,this._name,this._id)}function tu(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,o=e.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var c=e[a],l=n[a],f=c.length,u=s[a]=new Array(f),d,p=0;p<f;++p)(d=c[p]||l[p])&&(u[p]=d);for(;a<o;++a)s[a]=e[a];return new xt(s,this._parents,this._name,this._id)}function eu(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function nu(t,e,n){var o,r,i=eu(e)?wn:gt;return function(){var s=i(this,t),a=s.on;a!==o&&(r=(o=a).copy()).on(e,n),s.on=r}}function ou(t,e){var n=this._id;return arguments.length<2?ft(this.node(),n).on.on(t):this.each(nu(n,t,e))}function ru(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function iu(){return this.on("end.remove",ru(this._id))}function su(t){var e=this._name,n=this._id;typeof t!="function"&&(t=mn(t));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],c=a.length,l=i[s]=new Array(c),f,u,d=0;d<c;++d)(f=a[d])&&(u=t.call(f,f.__data__,d,a))&&("__data__"in f&&(u.__data__=f.__data__),l[d]=u,He(l[d],e,n,d,l,ft(f,n)));return new xt(i,this._parents,e,n)}function au(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Ro(t));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var c=o[a],l=c.length,f,u=0;u<l;++u)if(f=c[u]){for(var d=t.call(f,f.__data__,u,c),p,g=ft(f,n),w=0,y=d.length;w<y;++w)(p=d[w])&&He(p,e,n,w,d,g);i.push(d),s.push(f)}return new xt(i,s,e,n)}var cu=se.prototype.constructor;function uu(){return new cu(this._groups,this._parents)}function lu(t,e){var n,o,r;return function(){var i=Ht(this,t),s=(this.style.removeProperty(t),Ht(this,t));return i===s?null:i===n&&s===o?r:r=e(n=i,o=s)}}function ir(t){return function(){this.style.removeProperty(t)}}function du(t,e,n){var o,r=n+"",i;return function(){var s=Ht(this,t);return s===r?null:s===o?i:i=e(o=s,n)}}function fu(t,e,n){var o,r,i;return function(){var s=Ht(this,t),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(t),Ht(this,t))),s===c?null:s===o&&c===r?i:(r=c,i=e(o=s,a))}}function hu(t,e){var n,o,r,i="style."+e,s="end."+i,a;return function(){var c=gt(this,t),l=c.on,f=c.value[i]==null?a||(a=ir(e)):void 0;(l!==n||r!==f)&&(o=(n=l).copy()).on(s,r=f),c.on=o}}function gu(t,e,n){var o=(t+="")=="transform"?pc:rr;return e==null?this.styleTween(t,lu(t,o)).on("end.style."+t,ir(t)):typeof e=="function"?this.styleTween(t,fu(t,o,vn(this,"style."+t,e))).each(hu(this._id,t)):this.styleTween(t,du(t,o,e),n).on("end.style."+t,null)}function pu(t,e,n){return function(o){this.style.setProperty(t,e.call(this,o),n)}}function mu(t,e,n){var o,r;function i(){var s=e.apply(this,arguments);return s!==r&&(o=(r=s)&&pu(t,s,n)),o}return i._value=e,i}function yu(t,e,n){var o="style."+(t+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(e==null)return this.tween(o,null);if(typeof e!="function")throw new Error;return this.tween(o,mu(t,e,n??""))}function xu(t){return function(){this.textContent=t}}function wu(t){return function(){var e=t(this);this.textContent=e??""}}function vu(t){return this.tween("text",typeof t=="function"?wu(vn(this,"text",t)):xu(t==null?"":t+""))}function _u(t){return function(e){this.textContent=t.call(this,e)}}function bu(t){var e,n;function o(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&_u(r)),e}return o._value=t,o}function Eu(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,bu(t))}function Su(){for(var t=this._name,e=this._id,n=sr(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var f=ft(c,e);He(c,t,n,l,s,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new xt(o,this._parents,t,n)}function Nu(){var t,e,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},c={value:function(){--r===0&&i()}};n.each(function(){var l=gt(this,o),f=l.on;f!==t&&(e=(t=f).copy(),e._.cancel.push(a),e._.interrupt.push(a),e._.end.push(c)),l.on=e}),r===0&&i()})}var Cu=0;function xt(t,e,n,o){this._groups=t,this._parents=e,this._name=n,this._id=o}function sr(){return++Cu}var mt=se.prototype;xt.prototype={constructor:xt,select:su,selectAll:au,selectChild:mt.selectChild,selectChildren:mt.selectChildren,filter:Jc,merge:tu,selection:uu,transition:Su,call:mt.call,nodes:mt.nodes,node:mt.node,size:mt.size,empty:mt.empty,each:mt.each,on:ou,attr:Hc,attrTween:Oc,style:gu,styleTween:yu,text:vu,textTween:Eu,remove:iu,tween:kc,delay:jc,duration:qc,ease:Zc,easeVarying:Qc,end:Nu,[Symbol.iterator]:mt[Symbol.iterator]};function Mu(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var Iu={time:null,delay:0,duration:250,ease:Mu};function Au(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function ku(t){var e,n;t instanceof xt?(e=t._id,t=t._name):(e=sr(),(n=Iu).time=xn(),t=t==null?null:t+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&He(c,t,e,l,s,n||Au(c,e));return new xt(o,this._parents,t,e)}se.prototype.interrupt=Mc;se.prototype.transition=ku;const pe=t=>()=>t;function Pu(t,{sourceEvent:e,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function yt(t,e,n){this.k=t,this.x=e,this.y=n}yt.prototype={constructor:yt,scale:function(t){return t===1?this:new yt(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new yt(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Re=new yt(1,0,0);ar.prototype=yt.prototype;function ar(t){for(;!t.__zoom;)if(!(t=t.parentNode))return Re;return t.__zoom}function Ue(t){t.stopImmediatePropagation()}function Kt(t){t.preventDefault(),t.stopImmediatePropagation()}function $u(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function Tu(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function Zn(){return this.__zoom||Re}function zu(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Lu(){return navigator.maxTouchPoints||"ontouchstart"in this}function Du(t,e,n){var o=t.invertX(e[0][0])-n[0][0],r=t.invertX(e[1][0])-n[1][0],i=t.invertY(e[0][1])-n[0][1],s=t.invertY(e[1][1])-n[1][1];return t.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function cr(){var t=$u,e=Tu,n=Du,o=zu,r=Lu,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=_e,l=ze("start","zoom","end"),f,u,d,p=500,g=150,w=0,y=10;function m(v){v.property("__zoom",Zn).on("wheel.zoom",z,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",B).filter(r).on("touchstart.zoom",I).on("touchmove.zoom",P).on("touchend.zoom touchcancel.zoom",V).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(v,A,E,k){var M=v.selection?v.selection():v;M.property("__zoom",Zn),v!==M?N(v,A,E,k):M.interrupt().each(function(){b(this,arguments).event(k).start().zoom(null,typeof A=="function"?A.apply(this,arguments):A).end()})},m.scaleBy=function(v,A,E,k){m.scaleTo(v,function(){var M=this.__zoom.k,S=typeof A=="function"?A.apply(this,arguments):A;return M*S},E,k)},m.scaleTo=function(v,A,E,k){m.transform(v,function(){var M=e.apply(this,arguments),S=this.__zoom,D=E==null?x(M):typeof E=="function"?E.apply(this,arguments):E,R=S.invert(D),H=typeof A=="function"?A.apply(this,arguments):A;return n(h(_(S,H),D,R),M,s)},E,k)},m.translateBy=function(v,A,E,k){m.transform(v,function(){return n(this.__zoom.translate(typeof A=="function"?A.apply(this,arguments):A,typeof E=="function"?E.apply(this,arguments):E),e.apply(this,arguments),s)},null,k)},m.translateTo=function(v,A,E,k,M){m.transform(v,function(){var S=e.apply(this,arguments),D=this.__zoom,R=k==null?x(S):typeof k=="function"?k.apply(this,arguments):k;return n(Re.translate(R[0],R[1]).scale(D.k).translate(typeof A=="function"?-A.apply(this,arguments):-A,typeof E=="function"?-E.apply(this,arguments):-E),S,s)},k,M)};function _(v,A){return A=Math.max(i[0],Math.min(i[1],A)),A===v.k?v:new yt(A,v.x,v.y)}function h(v,A,E){var k=A[0]-E[0]*v.k,M=A[1]-E[1]*v.k;return k===v.x&&M===v.y?v:new yt(v.k,k,M)}function x(v){return[(+v[0][0]+ +v[1][0])/2,(+v[0][1]+ +v[1][1])/2]}function N(v,A,E,k){v.on("start.zoom",function(){b(this,arguments).event(k).start()}).on("interrupt.zoom end.zoom",function(){b(this,arguments).event(k).end()}).tween("zoom",function(){var M=this,S=arguments,D=b(M,S).event(k),R=e.apply(M,S),H=E==null?x(R):typeof E=="function"?E.apply(M,S):E,O=Math.max(R[1][0]-R[0][0],R[1][1]-R[0][1]),X=M.__zoom,j=typeof A=="function"?A.apply(M,S):A,K=c(X.invert(H).concat(O/X.k),j.invert(H).concat(O/j.k));return function(G){if(G===1)G=j;else{var F=K(G),W=O/F[2];G=new yt(W,H[0]-F[0]*W,H[1]-F[1]*W)}D.zoom(null,G)}})}function b(v,A,E){return!E&&v.__zooming||new C(v,A)}function C(v,A){this.that=v,this.args=A,this.active=0,this.sourceEvent=null,this.extent=e.apply(v,A),this.taps=0}C.prototype={event:function(v){return v&&(this.sourceEvent=v),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(v,A){return this.mouse&&v!=="mouse"&&(this.mouse[1]=A.invert(this.mouse[0])),this.touch0&&v!=="touch"&&(this.touch0[1]=A.invert(this.touch0[0])),this.touch1&&v!=="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(v){var A=at(this.that).datum();l.call(v,this.that,new Pu(v,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:l}),A)}};function z(v,...A){if(!t.apply(this,arguments))return;var E=b(this,A).event(v),k=this.__zoom,M=Math.max(i[0],Math.min(i[1],k.k*Math.pow(2,o.apply(this,arguments)))),S=ut(v);if(E.wheel)(E.mouse[0][0]!==S[0]||E.mouse[0][1]!==S[1])&&(E.mouse[1]=k.invert(E.mouse[0]=S)),clearTimeout(E.wheel);else{if(k.k===M)return;E.mouse=[S,k.invert(S)],Se(this),E.start()}Kt(v),E.wheel=setTimeout(D,g),E.zoom("mouse",n(h(_(k,M),E.mouse[0],E.mouse[1]),E.extent,s));function D(){E.wheel=null,E.end()}}function T(v,...A){if(d||!t.apply(this,arguments))return;var E=v.currentTarget,k=b(this,A,!0).event(v),M=at(v.view).on("mousemove.zoom",H,!0).on("mouseup.zoom",O,!0),S=ut(v,E),D=v.clientX,R=v.clientY;Ko(v.view),Ue(v),k.mouse=[S,this.__zoom.invert(S)],Se(this),k.start();function H(X){if(Kt(X),!k.moved){var j=X.clientX-D,K=X.clientY-R;k.moved=j*j+K*K>w}k.event(X).zoom("mouse",n(h(k.that.__zoom,k.mouse[0]=ut(X,E),k.mouse[1]),k.extent,s))}function O(X){M.on("mousemove.zoom mouseup.zoom",null),Zo(X.view,k.moved),Kt(X),k.event(X).end()}}function B(v,...A){if(t.apply(this,arguments)){var E=this.__zoom,k=ut(v.changedTouches?v.changedTouches[0]:v,this),M=E.invert(k),S=E.k*(v.shiftKey?.5:2),D=n(h(_(E,S),k,M),e.apply(this,A),s);Kt(v),a>0?at(this).transition().duration(a).call(N,D,k,v):at(this).call(m.transform,D,k,v)}}function I(v,...A){if(t.apply(this,arguments)){var E=v.touches,k=E.length,M=b(this,A,v.changedTouches.length===k).event(v),S,D,R,H;for(Ue(v),D=0;D<k;++D)R=E[D],H=ut(R,this),H=[H,this.__zoom.invert(H),R.identifier],M.touch0?!M.touch1&&M.touch0[2]!==H[2]&&(M.touch1=H,M.taps=0):(M.touch0=H,S=!0,M.taps=1+!!f);f&&(f=clearTimeout(f)),S&&(M.taps<2&&(u=H[0],f=setTimeout(function(){f=null},p)),Se(this),M.start())}}function P(v,...A){if(this.__zooming){var E=b(this,A).event(v),k=v.changedTouches,M=k.length,S,D,R,H;for(Kt(v),S=0;S<M;++S)D=k[S],R=ut(D,this),E.touch0&&E.touch0[2]===D.identifier?E.touch0[0]=R:E.touch1&&E.touch1[2]===D.identifier&&(E.touch1[0]=R);if(D=E.that.__zoom,E.touch1){var O=E.touch0[0],X=E.touch0[1],j=E.touch1[0],K=E.touch1[1],G=(G=j[0]-O[0])*G+(G=j[1]-O[1])*G,F=(F=K[0]-X[0])*F+(F=K[1]-X[1])*F;D=_(D,Math.sqrt(G/F)),R=[(O[0]+j[0])/2,(O[1]+j[1])/2],H=[(X[0]+K[0])/2,(X[1]+K[1])/2]}else if(E.touch0)R=E.touch0[0],H=E.touch0[1];else return;E.zoom("touch",n(h(D,R,H),E.extent,s))}}function V(v,...A){if(this.__zooming){var E=b(this,A).event(v),k=v.changedTouches,M=k.length,S,D;for(Ue(v),d&&clearTimeout(d),d=setTimeout(function(){d=null},p),S=0;S<M;++S)D=k[S],E.touch0&&E.touch0[2]===D.identifier?delete E.touch0:E.touch1&&E.touch1[2]===D.identifier&&delete E.touch1;if(E.touch1&&!E.touch0&&(E.touch0=E.touch1,delete E.touch1),E.touch0)E.touch0[1]=this.__zoom.invert(E.touch0[0]);else if(E.end(),E.taps===2&&(D=ut(D,this),Math.hypot(u[0]-D[0],u[1]-D[1])<y)){var R=at(this).on("dblclick.zoom");R&&R.apply(this,arguments)}}}return m.wheelDelta=function(v){return arguments.length?(o=typeof v=="function"?v:pe(+v),m):o},m.filter=function(v){return arguments.length?(t=typeof v=="function"?v:pe(!!v),m):t},m.touchable=function(v){return arguments.length?(r=typeof v=="function"?v:pe(!!v),m):r},m.extent=function(v){return arguments.length?(e=typeof v=="function"?v:pe([[+v[0][0],+v[0][1]],[+v[1][0],+v[1][1]]]),m):e},m.scaleExtent=function(v){return arguments.length?(i[0]=+v[0],i[1]=+v[1],m):[i[0],i[1]]},m.translateExtent=function(v){return arguments.length?(s[0][0]=+v[0][0],s[1][0]=+v[1][0],s[0][1]=+v[0][1],s[1][1]=+v[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(v){return arguments.length?(n=v,m):n},m.duration=function(v){return arguments.length?(a=+v,m):a},m.interpolate=function(v){return arguments.length?(c=v,m):c},m.on=function(){var v=l.on.apply(l,arguments);return v===l?m:v},m.clickDistance=function(v){return arguments.length?(w=(v=+v)*v,m):Math.sqrt(w)},m.tapDistance=function(v){return arguments.length?(y=+v,m):y},m}const ht={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:t=>`Node type "${t}" 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:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,{id:e,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${t} handle id: "${t==="source"?n:o}", edge id: ${e}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(t="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${t}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},ee=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],ur=["Enter"," ","Escape"],lr={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:t,x:e,y:n})=>`Moved selected node ${t}. New position, x: ${e}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Vt;(function(t){t.Strict="strict",t.Loose="loose"})(Vt||(Vt={}));var It;(function(t){t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal"})(It||(It={}));var ne;(function(t){t.Partial="partial",t.Full="full"})(ne||(ne={}));const dr={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Et;(function(t){t.Bezier="default",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t.SimpleBezier="simplebezier"})(Et||(Et={}));var Ae;(function(t){t.Arrow="arrow",t.ArrowClosed="arrowclosed"})(Ae||(Ae={}));var Y;(function(t){t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom"})(Y||(Y={}));const Un={[Y.Left]:Y.Right,[Y.Right]:Y.Left,[Y.Top]:Y.Bottom,[Y.Bottom]:Y.Top};function fr(t){return t===null?null:t?"valid":"invalid"}const hr=t=>"id"in t&&"source"in t&&"target"in t,Hu=t=>"id"in t&&"position"in t&&!("source"in t)&&!("target"in t),_n=t=>"id"in t&&"internals"in t&&!("source"in t)&&!("target"in t),ae=(t,e=[0,0])=>{const{width:n,height:o}=wt(t),r=t.origin??e,i=n*r[0],s=o*r[1];return{x:t.position.x-i,y:t.position.y-s}},Ru=(t,e={nodeOrigin:[0,0]})=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((o,r)=>{const i=typeof r=="string";let s=!e.nodeLookup&&!i?r:void 0;e.nodeLookup&&(s=i?e.nodeLookup.get(r):_n(r)?r:e.nodeLookup.get(r.id));const a=s?ke(s,e.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Ve(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Be(n)},ce=(t,e={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return t.forEach(r=>{(e.filter===void 0||e.filter(r))&&(n=Ve(n,ke(r)),o=!0)}),o?Be(n):{x:0,y:0,width:0,height:0}},bn=(t,e,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const a={...le(e,[n,o,r]),width:e.width/r,height:e.height/r},c=[];for(const l of t.values()){const{measured:f,selectable:u=!0,hidden:d=!1}=l;if(s&&!u||d)continue;const p=f.width??l.width??l.initialWidth??null,g=f.height??l.height??l.initialHeight??null,w=oe(a,Ft(l)),y=(p??0)*(g??0),m=i&&w>0;(!l.internals.handleBounds||m||w>=y||l.dragging)&&c.push(l)}return c},Vu=(t,e)=>{const n=new Set;return t.forEach(o=>{n.add(o.id)}),e.filter(o=>n.has(o.source)||n.has(o.target))};function Bu(t,e){const n=new Map,o=e!=null&&e.nodes?new Set(e.nodes.map(r=>r.id)):null;return t.forEach(r=>{r.measured.width&&r.measured.height&&((e==null?void 0:e.includeHiddenNodes)||!r.hidden)&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function Fu({nodes:t,width:e,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(t.size===0)return Promise.resolve(!0);const a=Bu(t,s),c=ce(a),l=En(c,e,n,(s==null?void 0:s.minZoom)??r,(s==null?void 0:s.maxZoom)??i,(s==null?void 0:s.padding)??.1);return await o.setViewport(l,{duration:s==null?void 0:s.duration,ease:s==null?void 0:s.ease,interpolate:s==null?void 0:s.interpolate}),Promise.resolve(!0)}function gr({nodeId:t,nextPosition:e,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(t),a=s.parentId?n.get(s.parentId):void 0,{x:c,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},f=s.origin??o;let u=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i==null||i("005",ht.error005());else{const p=a.measured.width,g=a.measured.height;p&&g&&(u=[[c,l],[c+p,l+g]])}else a&&Ot(s.extent)&&(u=[[s.extent[0][0]+c,s.extent[0][1]+l],[s.extent[1][0]+c,s.extent[1][1]+l]]);const d=Ot(u)?kt(e,u,s.measured):e;return(s.measured.width===void 0||s.measured.height===void 0)&&(i==null||i("015",ht.error015())),{position:{x:d.x-c+(s.measured.width??0)*f[0],y:d.y-l+(s.measured.height??0)*f[1]},positionAbsolute:d}}async function Ou({nodesToRemove:t=[],edgesToRemove:e=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(t.map(d=>d.id)),s=[];for(const d of n){if(d.deletable===!1)continue;const p=i.has(d.id),g=!p&&d.parentId&&s.find(w=>w.id===d.parentId);(p||g)&&s.push(d)}const a=new Set(e.map(d=>d.id)),c=o.filter(d=>d.deletable!==!1),f=Vu(s,c);for(const d of c)a.has(d.id)&&!f.find(g=>g.id===d.id)&&f.push(d);if(!r)return{edges:f,nodes:s};const u=await r({nodes:s,edges:f});return typeof u=="boolean"?u?{edges:f,nodes:s}:{edges:[],nodes:[]}:u}const Bt=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),kt=(t={x:0,y:0},e,n)=>({x:Bt(t.x,e[0][0],e[1][0]-((n==null?void 0:n.width)??0)),y:Bt(t.y,e[0][1],e[1][1]-((n==null?void 0:n.height)??0))});function pr(t,e,n){const{width:o,height:r}=wt(n),{x:i,y:s}=n.internals.positionAbsolute;return kt(t,[[i,s],[i+o,s+r]],e)}const Qn=(t,e,n)=>t<e?Bt(Math.abs(t-e),1,e)/e:t>n?-Bt(Math.abs(t-n),1,e)/e:0,mr=(t,e,n=15,o=40)=>{const r=Qn(t.x,o,e.width-o)*n,i=Qn(t.y,o,e.height-o)*n;return[r,i]},Ve=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}),ln=({x:t,y:e,width:n,height:o})=>({x:t,y:e,x2:t+n,y2:e+o}),Be=({x:t,y:e,x2:n,y2:o})=>({x:t,y:e,width:n-t,height:o-e}),Ft=(t,e=[0,0])=>{var r,i;const{x:n,y:o}=_n(t)?t.internals.positionAbsolute:ae(t,e);return{x:n,y:o,width:((r=t.measured)==null?void 0:r.width)??t.width??t.initialWidth??0,height:((i=t.measured)==null?void 0:i.height)??t.height??t.initialHeight??0}},ke=(t,e=[0,0])=>{var r,i;const{x:n,y:o}=_n(t)?t.internals.positionAbsolute:ae(t,e);return{x:n,y:o,x2:n+(((r=t.measured)==null?void 0:r.width)??t.width??t.initialWidth??0),y2:o+(((i=t.measured)==null?void 0:i.height)??t.height??t.initialHeight??0)}},yr=(t,e)=>Be(Ve(ln(t),ln(e))),oe=(t,e)=>{const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),o=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*o)},Jn=t=>lt(t.width)&&lt(t.height)&&lt(t.x)&&lt(t.y),lt=t=>!isNaN(t)&&isFinite(t),Xu=(t,e)=>{},ue=(t,e=[1,1])=>({x:e[0]*Math.round(t.x/e[0]),y:e[1]*Math.round(t.y/e[1])}),le=({x:t,y:e},[n,o,r],i=!1,s=[1,1])=>{const a={x:(t-n)/r,y:(e-o)/r};return i?ue(a,s):a},Pe=({x:t,y:e},[n,o,r])=>({x:t*r+n,y:e*r+o});function Tt(t,e){if(typeof t=="number")return Math.floor((e-e/(1+t))*.5);if(typeof t=="string"&&t.endsWith("px")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(n)}if(typeof t=="string"&&t.endsWith("%")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(e*n*.01)}return console.error(`[React Flow] The padding value "${t}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Yu(t,e,n){if(typeof t=="string"||typeof t=="number"){const o=Tt(t,n),r=Tt(t,e);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof t=="object"){const o=Tt(t.top??t.y??0,n),r=Tt(t.bottom??t.y??0,n),i=Tt(t.left??t.x??0,e),s=Tt(t.right??t.x??0,e);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function ju(t,e,n,o,r,i){const{x:s,y:a}=Pe(t,[e,n,o]),{x:c,y:l}=Pe({x:t.x+t.width,y:t.y+t.height},[e,n,o]),f=r-c,u=i-l;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(f),bottom:Math.floor(u)}}const En=(t,e,n,o,r,i)=>{const s=Yu(i,e,n),a=(e-s.x)/t.width,c=(n-s.y)/t.height,l=Math.min(a,c),f=Bt(l,o,r),u=t.x+t.width/2,d=t.y+t.height/2,p=e/2-u*f,g=n/2-d*f,w=ju(t,p,g,f,e,n),y={left:Math.min(w.left-s.left,0),top:Math.min(w.top-s.top,0),right:Math.min(w.right-s.right,0),bottom:Math.min(w.bottom-s.bottom,0)};return{x:p-y.left+y.right,y:g-y.top+y.bottom,zoom:f}},re=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0};function Ot(t){return t!=null&&t!=="parent"}function wt(t){var e,n;return{width:((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth??0,height:((n=t.measured)==null?void 0:n.height)??t.height??t.initialHeight??0}}function xr(t){var e,n;return(((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth)!==void 0&&(((n=t.measured)==null?void 0:n.height)??t.height??t.initialHeight)!==void 0}function wr(t,e={width:0,height:0},n,o,r){const i={...t},s=o.get(n);if(s){const a=s.origin||r;i.x+=s.internals.positionAbsolute.x-(e.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(e.height??0)*a[1]}return i}function to(t,e){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}function Wu(){let t,e;return{promise:new Promise((o,r)=>{t=o,e=r}),resolve:t,reject:e}}function Gu(t){return{...lr,...t||{}}}function Qt(t,{snapGrid:e=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=dt(t),a=le({x:i-((r==null?void 0:r.left)??0),y:s-((r==null?void 0:r.top)??0)},o),{x:c,y:l}=n?ue(a,e):a;return{xSnapped:c,ySnapped:l,...a}}const Sn=t=>({width:t.offsetWidth,height:t.offsetHeight}),vr=t=>{var e;return((e=t==null?void 0:t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},qu=["INPUT","SELECT","TEXTAREA"];function _r(t){var o,r;const e=((r=(o=t.composedPath)==null?void 0:o.call(t))==null?void 0:r[0])||t.target;return(e==null?void 0:e.nodeType)!==1?!1:qu.includes(e.nodeName)||e.hasAttribute("contenteditable")||!!e.closest(".nokey")}const br=t=>"clientX"in t,dt=(t,e)=>{var i,s;const n=br(t),o=n?t.clientX:(i=t.touches)==null?void 0:i[0].clientX,r=n?t.clientY:(s=t.touches)==null?void 0:s[0].clientY;return{x:o-((e==null?void 0:e.left)??0),y:r-((e==null?void 0:e.top)??0)}},eo=(t,e,n,o,r)=>{const i=e.querySelectorAll(`.${t}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:t,nodeId:r,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...Sn(s)}})};function Er({sourceX:t,sourceY:e,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const c=t*.125+r*.375+s*.375+n*.125,l=e*.125+i*.375+a*.375+o*.125,f=Math.abs(c-t),u=Math.abs(l-e);return[c,l,f,u]}function me(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function no({pos:t,x1:e,y1:n,x2:o,y2:r,c:i}){switch(t){case Y.Left:return[e-me(e-o,i),n];case Y.Right:return[e+me(o-e,i),n];case Y.Top:return[e,n-me(n-r,i)];case Y.Bottom:return[e,n+me(r-n,i)]}}function Sr({sourceX:t,sourceY:e,sourcePosition:n=Y.Bottom,targetX:o,targetY:r,targetPosition:i=Y.Top,curvature:s=.25}){const[a,c]=no({pos:n,x1:t,y1:e,x2:o,y2:r,c:s}),[l,f]=no({pos:i,x1:o,y1:r,x2:t,y2:e,c:s}),[u,d,p,g]=Er({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:f});return[`M${t},${e} C${a},${c} ${l},${f} ${o},${r}`,u,d,p,g]}function Nr({sourceX:t,sourceY:e,targetX:n,targetY:o}){const r=Math.abs(n-t)/2,i=n<t?n+r:n-r,s=Math.abs(o-e)/2,a=o<e?o+s:o-s;return[i,a,r,s]}function Ku({sourceNode:t,targetNode:e,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){if(i==="manual")return o;const s=r&&n?o+1e3:o,a=Math.max(t.parentId||r&&t.selected?t.internals.z:0,e.parentId||r&&e.selected?e.internals.z:0);return s+a}function Zu({sourceNode:t,targetNode:e,width:n,height:o,transform:r}){const i=Ve(ke(t),ke(e));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return oe(s,Be(i))>0}const Uu=({source:t,sourceHandle:e,target:n,targetHandle:o})=>`xy-edge__${t}${e||""}-${n}${o||""}`,Qu=(t,e)=>e.some(n=>n.source===t.source&&n.target===t.target&&(n.sourceHandle===t.sourceHandle||!n.sourceHandle&&!t.sourceHandle)&&(n.targetHandle===t.targetHandle||!n.targetHandle&&!t.targetHandle)),Ju=(t,e,n={})=>{if(!t.source||!t.target)return e;const o=n.getEdgeId||Uu;let r;return hr(t)?r={...t}:r={...t,id:o(t)},Qu(r,e)?e:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,e.concat(r))};function Cr({sourceX:t,sourceY:e,targetX:n,targetY:o}){const[r,i,s,a]=Nr({sourceX:t,sourceY:e,targetX:n,targetY:o});return[`M ${t},${e}L ${n},${o}`,r,i,s,a]}const oo={[Y.Left]:{x:-1,y:0},[Y.Right]:{x:1,y:0},[Y.Top]:{x:0,y:-1},[Y.Bottom]:{x:0,y:1}},tl=({source:t,sourcePosition:e=Y.Bottom,target:n})=>e===Y.Left||e===Y.Right?t.x<n.x?{x:1,y:0}:{x:-1,y:0}:t.y<n.y?{x:0,y:1}:{x:0,y:-1},ro=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function el({source:t,sourcePosition:e=Y.Bottom,target:n,targetPosition:o=Y.Top,center:r,offset:i,stepPosition:s}){const a=oo[e],c=oo[o],l={x:t.x+a.x*i,y:t.y+a.y*i},f={x:n.x+c.x*i,y:n.y+c.y*i},u=tl({source:l,sourcePosition:e,target:f}),d=u.x!==0?"x":"y",p=u[d];let g=[],w,y;const m={x:0,y:0},_={x:0,y:0},[,,h,x]=Nr({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(a[d]*c[d]===-1){d==="x"?(w=r.x??l.x+(f.x-l.x)*s,y=r.y??(l.y+f.y)/2):(w=r.x??(l.x+f.x)/2,y=r.y??l.y+(f.y-l.y)*s);const b=[{x:w,y:l.y},{x:w,y:f.y}],C=[{x:l.x,y},{x:f.x,y}];a[d]===p?g=d==="x"?b:C:g=d==="x"?C:b}else{const b=[{x:l.x,y:f.y}],C=[{x:f.x,y:l.y}];if(d==="x"?g=a.x===p?C:b:g=a.y===p?b:C,e===o){const P=Math.abs(t[d]-n[d]);if(P<=i){const V=Math.min(i-1,i-P);a[d]===p?m[d]=(l[d]>t[d]?-1:1)*V:_[d]=(f[d]>n[d]?-1:1)*V}}if(e!==o){const P=d==="x"?"y":"x",V=a[d]===c[P],v=l[P]>f[P],A=l[P]<f[P];(a[d]===1&&(!V&&v||V&&A)||a[d]!==1&&(!V&&A||V&&v))&&(g=d==="x"?b:C)}const z={x:l.x+m.x,y:l.y+m.y},T={x:f.x+_.x,y:f.y+_.y},B=Math.max(Math.abs(z.x-g[0].x),Math.abs(T.x-g[0].x)),I=Math.max(Math.abs(z.y-g[0].y),Math.abs(T.y-g[0].y));B>=I?(w=(z.x+T.x)/2,y=g[0].y):(w=g[0].x,y=(z.y+T.y)/2)}return[[t,{x:l.x+m.x,y:l.y+m.y},...g,{x:f.x+_.x,y:f.y+_.y},n],w,y,h,x]}function nl(t,e,n,o){const r=Math.min(ro(t,e)/2,ro(e,n)/2,o),{x:i,y:s}=e;if(t.x===i&&i===n.x||t.y===s&&s===n.y)return`L${i} ${s}`;if(t.y===s){const l=t.x<n.x?-1:1,f=t.y<n.y?1:-1;return`L ${i+r*l},${s}Q ${i},${s} ${i},${s+r*f}`}const a=t.x<n.x?1:-1,c=t.y<n.y?-1:1;return`L ${i},${s+r*c}Q ${i},${s} ${i+r*a},${s}`}function dn({sourceX:t,sourceY:e,sourcePosition:n=Y.Bottom,targetX:o,targetY:r,targetPosition:i=Y.Top,borderRadius:s=5,centerX:a,centerY:c,offset:l=20,stepPosition:f=.5}){const[u,d,p,g,w]=el({source:{x:t,y:e},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:c},offset:l,stepPosition:f});return[u.reduce((m,_,h)=>{let x="";return h>0&&h<u.length-1?x=nl(u[h-1],_,u[h+1],s):x=`${h===0?"M":"L"}${_.x} ${_.y}`,m+=x,m},""),d,p,g,w]}function io(t){var e;return t&&!!(t.internals.handleBounds||(e=t.handles)!=null&&e.length)&&!!(t.measured.width||t.width||t.initialWidth)}function ol(t){var u;const{sourceNode:e,targetNode:n}=t;if(!io(e)||!io(n))return null;const o=e.internals.handleBounds||so(e.handles),r=n.internals.handleBounds||so(n.handles),i=ao((o==null?void 0:o.source)??[],t.sourceHandle),s=ao(t.connectionMode===Vt.Strict?(r==null?void 0:r.target)??[]:((r==null?void 0:r.target)??[]).concat((r==null?void 0:r.source)??[]),t.targetHandle);if(!i||!s)return(u=t.onError)==null||u.call(t,"008",ht.error008(i?"target":"source",{id:t.id,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle})),null;const a=(i==null?void 0:i.position)||Y.Bottom,c=(s==null?void 0:s.position)||Y.Top,l=Pt(e,i,a),f=Pt(n,s,c);return{sourceX:l.x,sourceY:l.y,targetX:f.x,targetY:f.y,sourcePosition:a,targetPosition:c}}function so(t){if(!t)return null;const e=[],n=[];for(const o of t)o.width=o.width??1,o.height=o.height??1,o.type==="source"?e.push(o):o.type==="target"&&n.push(o);return{source:e,target:n}}function Pt(t,e,n=Y.Left,o=!1){const r=((e==null?void 0:e.x)??0)+t.internals.positionAbsolute.x,i=((e==null?void 0:e.y)??0)+t.internals.positionAbsolute.y,{width:s,height:a}=e??wt(t);if(o)return{x:r+s/2,y:i+a/2};switch((e==null?void 0:e.position)??n){case Y.Top:return{x:r+s/2,y:i};case Y.Right:return{x:r+s,y:i+a/2};case Y.Bottom:return{x:r+s/2,y:i+a};case Y.Left:return{x:r,y:i+a/2}}}function ao(t,e){return t&&(e?t.find(n=>n.id===e):t[0])||null}function fn(t,e){return t?typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(o=>`${o}=${t[o]}`).join("&")}`:""}function rl(t,{id:e,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return t.reduce((s,a)=>([a.markerStart||o,a.markerEnd||r].forEach(c=>{if(c&&typeof c=="object"){const l=fn(c,e);i.has(l)||(s.push({id:l,color:c.color||n,...c}),i.add(l))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const Mr=1e3,il=10,Nn={nodeOrigin:[0,0],nodeExtent:ee,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},sl={...Nn,checkEquality:!0};function Cn(t,e){const n={...t};for(const o in e)e[o]!==void 0&&(n[o]=e[o]);return n}function al(t,e,n){const o=Cn(Nn,n);for(const r of t.values())if(r.parentId)In(r,t,e,o);else{const i=ae(r,o.nodeOrigin),s=Ot(r.extent)?r.extent:o.nodeExtent,a=kt(i,s,wt(r));r.internals.positionAbsolute=a}}function cl(t,e){if(!t.handles)return t.measured?e==null?void 0:e.internals.handleBounds:void 0;const n=[],o=[];for(const r of t.handles){const i={id:r.id,width:r.width??1,height:r.height??1,nodeId:t.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(i):r.type==="target"&&o.push(i)}return{source:n,target:o}}function Mn(t){return t==="manual"}function hn(t,e,n,o={}){var l,f;const r=Cn(sl,o),i={i:0},s=new Map(e),a=r!=null&&r.elevateNodesOnSelect&&!Mn(r.zIndexMode)?Mr:0;let c=t.length>0;e.clear(),n.clear();for(const u of t){let d=s.get(u.id);if(r.checkEquality&&u===(d==null?void 0:d.internals.userNode))e.set(u.id,d);else{const p=ae(u,r.nodeOrigin),g=Ot(u.extent)?u.extent:r.nodeExtent,w=kt(p,g,wt(u));d={...r.defaults,...u,measured:{width:(l=u.measured)==null?void 0:l.width,height:(f=u.measured)==null?void 0:f.height},internals:{positionAbsolute:w,handleBounds:cl(u,d),z:Ir(u,a,r.zIndexMode),userNode:u}},e.set(u.id,d)}(d.measured===void 0||d.measured.width===void 0||d.measured.height===void 0)&&!d.hidden&&(c=!1),u.parentId&&In(d,e,n,o,i)}return c}function ul(t,e){if(!t.parentId)return;const n=e.get(t.parentId);n?n.set(t.id,t):e.set(t.parentId,new Map([[t.id,t]]))}function In(t,e,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:c}=Cn(Nn,o),l=t.parentId,f=e.get(l);if(!f){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}ul(t,n),r&&!f.parentId&&f.internals.rootParentIndex===void 0&&c==="auto"&&(f.internals.rootParentIndex=++r.i,f.internals.z=f.internals.z+r.i*il),r&&f.internals.rootParentIndex!==void 0&&(r.i=f.internals.rootParentIndex);const u=i&&!Mn(c)?Mr:0,{x:d,y:p,z:g}=ll(t,f,s,a,u,c),{positionAbsolute:w}=t.internals,y=d!==w.x||p!==w.y;(y||g!==t.internals.z)&&e.set(t.id,{...t,internals:{...t.internals,positionAbsolute:y?{x:d,y:p}:w,z:g}})}function Ir(t,e,n){const o=lt(t.zIndex)?t.zIndex:0;return Mn(n)?o:o+(t.selected?e:0)}function ll(t,e,n,o,r,i){const{x:s,y:a}=e.internals.positionAbsolute,c=wt(t),l=ae(t,n),f=Ot(t.extent)?kt(l,t.extent,c):l;let u=kt({x:s+f.x,y:a+f.y},o,c);t.extent==="parent"&&(u=pr(u,c,e));const d=Ir(t,r,i),p=e.internals.z??0;return{x:u.x,y:u.y,z:p>=d?p+1:d}}function An(t,e,n,o=[0,0]){var s;const r=[],i=new Map;for(const a of t){const c=e.get(a.parentId);if(!c)continue;const l=((s=i.get(a.parentId))==null?void 0:s.expandedRect)??Ft(c),f=yr(l,a.rect);i.set(a.parentId,{expandedRect:f,parent:c})}return i.size>0&&i.forEach(({expandedRect:a,parent:c},l)=>{var h;const f=c.internals.positionAbsolute,u=wt(c),d=c.origin??o,p=a.x<f.x?Math.round(Math.abs(f.x-a.x)):0,g=a.y<f.y?Math.round(Math.abs(f.y-a.y)):0,w=Math.max(u.width,Math.round(a.width)),y=Math.max(u.height,Math.round(a.height)),m=(w-u.width)*d[0],_=(y-u.height)*d[1];(p>0||g>0||m||_)&&(r.push({id:l,type:"position",position:{x:c.position.x-p+m,y:c.position.y-g+_}}),(h=n.get(l))==null||h.forEach(x=>{t.some(N=>N.id===x.id)||r.push({id:x.id,type:"position",position:{x:x.position.x+p,y:x.position.y+g}})})),(u.width<a.width||u.height<a.height||p||g)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:w+(p?d[0]*p-m:0),height:y+(g?d[1]*g-_:0)}})}),r}function dl(t,e,n,o,r,i,s){const a=o==null?void 0:o.querySelector(".xyflow__viewport");let c=!1;if(!a)return{changes:[],updatedInternals:c};const l=[],f=window.getComputedStyle(a),{m22:u}=new window.DOMMatrixReadOnly(f.transform),d=[];for(const p of t.values()){const g=e.get(p.id);if(!g)continue;if(g.hidden){e.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const w=Sn(p.nodeElement),y=g.measured.width!==w.width||g.measured.height!==w.height;if(!!(w.width&&w.height&&(y||!g.internals.handleBounds||p.force))){const _=p.nodeElement.getBoundingClientRect(),h=Ot(g.extent)?g.extent:i;let{positionAbsolute:x}=g.internals;g.parentId&&g.extent==="parent"?x=pr(x,w,e.get(g.parentId)):h&&(x=kt(x,h,w));const N={...g,measured:w,internals:{...g.internals,positionAbsolute:x,handleBounds:{source:eo("source",p.nodeElement,_,u,g.id),target:eo("target",p.nodeElement,_,u,g.id)}}};e.set(g.id,N),g.parentId&&In(N,e,n,{nodeOrigin:r,zIndexMode:s}),c=!0,y&&(l.push({id:g.id,type:"dimensions",dimensions:w}),g.expandParent&&g.parentId&&d.push({id:g.id,parentId:g.parentId,rect:Ft(N,r)}))}}if(d.length>0){const p=An(d,e,n,r);l.push(...p)}return{changes:l,updatedInternals:c}}async function fl({delta:t,panZoom:e,transform:n,translateExtent:o,width:r,height:i}){if(!e||!t.x&&!t.y)return Promise.resolve(!1);const s=await e.setViewportConstrained({x:n[0]+t.x,y:n[1]+t.y,zoom:n[2]},[[0,0],[r,i]],o),a=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(a)}function co(t,e,n,o,r,i){let s=r;const a=o.get(s)||new Map;o.set(s,a.set(n,e)),s=`${r}-${t}`;const c=o.get(s)||new Map;if(o.set(s,c.set(n,e)),i){s=`${r}-${t}-${i}`;const l=o.get(s)||new Map;o.set(s,l.set(n,e))}}function Ar(t,e,n){t.clear(),e.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,c={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},l=`${r}-${s}--${i}-${a}`,f=`${i}-${a}--${r}-${s}`;co("source",c,f,t,r,s),co("target",c,l,t,i,a),e.set(o.id,o)}}function kr(t,e){if(!t.parentId)return!1;const n=e.get(t.parentId);return n?n.selected?!0:kr(n,e):!1}function uo(t,e,n){var r;let o=t;do{if((r=o==null?void 0:o.matches)!=null&&r.call(o,e))return!0;if(o===n)return!1;o=o==null?void 0:o.parentElement}while(o);return!1}function hl(t,e,n,o){const r=new Map;for(const[i,s]of t)if((s.selected||s.id===o)&&(!s.parentId||!kr(s,t))&&(s.draggable||e&&typeof s.draggable>"u")){const a=t.get(i);a&&r.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function Qe({nodeId:t,dragItems:e,nodeLookup:n,dragging:o=!0}){var s,a,c;const r=[];for(const[l,f]of e){const u=(s=n.get(l))==null?void 0:s.internals.userNode;u&&r.push({...u,position:f.position,dragging:o})}if(!t)return[r[0],r];const i=(a=n.get(t))==null?void 0:a.internals.userNode;return[i?{...i,position:((c=e.get(t))==null?void 0:c.position)||i.position,dragging:o}:r[0],r]}function gl({dragItems:t,snapGrid:e,x:n,y:o}){const r=t.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},s=ue(i,e);return{x:s.x-i.x,y:s.y-i.y}}function pl({onNodeMouseDown:t,getStoreItems:e,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,c=!1,l={x:0,y:0},f=null,u=!1,d=null,p=!1,g=!1,w=null;function y({noDragClassName:_,handleSelector:h,domNode:x,isSelectable:N,nodeId:b,nodeClickDistance:C=0}){d=at(x);function z({x:P,y:V}){const{nodeLookup:v,nodeExtent:A,snapGrid:E,snapToGrid:k,nodeOrigin:M,onNodeDrag:S,onSelectionDrag:D,onError:R,updateNodePositions:H}=e();i={x:P,y:V};let O=!1;const X=a.size>1,j=X&&A?ln(ce(a)):null,K=X&&k?gl({dragItems:a,snapGrid:E,x:P,y:V}):null;for(const[G,F]of a){if(!v.has(G))continue;let W={x:P-F.distance.x,y:V-F.distance.y};k&&(W=K?{x:Math.round(W.x+K.x),y:Math.round(W.y+K.y)}:ue(W,E));let Q=null;if(X&&A&&!F.extent&&j){const{positionAbsolute:q}=F.internals,et=q.x-j.x+A[0][0],nt=q.x+F.measured.width-j.x2+A[1][0],tt=q.y-j.y+A[0][1],st=q.y+F.measured.height-j.y2+A[1][1];Q=[[et,tt],[nt,st]]}const{position:U,positionAbsolute:Z}=gr({nodeId:G,nextPosition:W,nodeLookup:v,nodeExtent:Q||A,nodeOrigin:M,onError:R});O=O||F.position.x!==U.x||F.position.y!==U.y,F.position=U,F.internals.positionAbsolute=Z}if(g=g||O,!!O&&(H(a,!0),w&&(o||S||!b&&D))){const[G,F]=Qe({nodeId:b,dragItems:a,nodeLookup:v});o==null||o(w,a,G,F),S==null||S(w,G,F),b||D==null||D(w,F)}}async function T(){if(!f)return;const{transform:P,panBy:V,autoPanSpeed:v,autoPanOnNodeDrag:A}=e();if(!A){c=!1,cancelAnimationFrame(s);return}const[E,k]=mr(l,f,v);(E!==0||k!==0)&&(i.x=(i.x??0)-E/P[2],i.y=(i.y??0)-k/P[2],await V({x:E,y:k})&&z(i)),s=requestAnimationFrame(T)}function B(P){var X;const{nodeLookup:V,multiSelectionActive:v,nodesDraggable:A,transform:E,snapGrid:k,snapToGrid:M,selectNodesOnDrag:S,onNodeDragStart:D,onSelectionDragStart:R,unselectNodesAndEdges:H}=e();u=!0,(!S||!N)&&!v&&b&&((X=V.get(b))!=null&&X.selected||H()),N&&S&&b&&(t==null||t(b));const O=Qt(P.sourceEvent,{transform:E,snapGrid:k,snapToGrid:M,containerBounds:f});if(i=O,a=hl(V,A,O,b),a.size>0&&(n||D||!b&&R)){const[j,K]=Qe({nodeId:b,dragItems:a,nodeLookup:V});n==null||n(P.sourceEvent,a,j,K),D==null||D(P.sourceEvent,j,K),b||R==null||R(P.sourceEvent,K)}}const I=Uo().clickDistance(C).on("start",P=>{const{domNode:V,nodeDragThreshold:v,transform:A,snapGrid:E,snapToGrid:k}=e();f=(V==null?void 0:V.getBoundingClientRect())||null,p=!1,g=!1,w=P.sourceEvent,v===0&&B(P),i=Qt(P.sourceEvent,{transform:A,snapGrid:E,snapToGrid:k,containerBounds:f}),l=dt(P.sourceEvent,f)}).on("drag",P=>{const{autoPanOnNodeDrag:V,transform:v,snapGrid:A,snapToGrid:E,nodeDragThreshold:k,nodeLookup:M}=e(),S=Qt(P.sourceEvent,{transform:v,snapGrid:A,snapToGrid:E,containerBounds:f});if(w=P.sourceEvent,(P.sourceEvent.type==="touchmove"&&P.sourceEvent.touches.length>1||b&&!M.has(b))&&(p=!0),!p){if(!c&&V&&u&&(c=!0,T()),!u){const D=dt(P.sourceEvent,f),R=D.x-l.x,H=D.y-l.y;Math.sqrt(R*R+H*H)>k&&B(P)}(i.x!==S.xSnapped||i.y!==S.ySnapped)&&a&&u&&(l=dt(P.sourceEvent,f),z(S))}}).on("end",P=>{if(!(!u||p)&&(c=!1,u=!1,cancelAnimationFrame(s),a.size>0)){const{nodeLookup:V,updateNodePositions:v,onNodeDragStop:A,onSelectionDragStop:E}=e();if(g&&(v(a,!1),g=!1),r||A||!b&&E){const[k,M]=Qe({nodeId:b,dragItems:a,nodeLookup:V,dragging:!1});r==null||r(P.sourceEvent,a,k,M),A==null||A(P.sourceEvent,k,M),b||E==null||E(P.sourceEvent,M)}}}).filter(P=>{const V=P.target;return!P.button&&(!_||!uo(V,`.${_}`,x))&&(!h||uo(V,h,x))});d.call(I)}function m(){d==null||d.on(".drag",null)}return{update:y,destroy:m}}function ml(t,e,n){const o=[],r={x:t.x-n,y:t.y-n,width:n*2,height:n*2};for(const i of e.values())oe(r,Ft(i))>0&&o.push(i);return o}const yl=250;function xl(t,e,n,o){var a,c;let r=[],i=1/0;const s=ml(t,n,e+yl);for(const l of s){const f=[...((a=l.internals.handleBounds)==null?void 0:a.source)??[],...((c=l.internals.handleBounds)==null?void 0:c.target)??[]];for(const u of f){if(o.nodeId===u.nodeId&&o.type===u.type&&o.id===u.id)continue;const{x:d,y:p}=Pt(l,u,u.position,!0),g=Math.sqrt(Math.pow(d-t.x,2)+Math.pow(p-t.y,2));g>e||(g<i?(r=[{...u,x:d,y:p}],i=g):g===i&&r.push({...u,x:d,y:p}))}}if(!r.length)return null;if(r.length>1){const l=o.type==="source"?"target":"source";return r.find(f=>f.type===l)??r[0]}return r[0]}function Pr(t,e,n,o,r,i=!1){var l,f,u;const s=o.get(t);if(!s)return null;const a=r==="strict"?(l=s.internals.handleBounds)==null?void 0:l[e]:[...((f=s.internals.handleBounds)==null?void 0:f.source)??[],...((u=s.internals.handleBounds)==null?void 0:u.target)??[]],c=(n?a==null?void 0:a.find(d=>d.id===n):a==null?void 0:a[0])??null;return c&&i?{...c,...Pt(s,c,c.position,!0)}:c}function $r(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function wl(t,e){let n=null;return e?n=!0:t&&!e&&(n=!1),n}const Tr=()=>!0;function vl(t,{connectionMode:e,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:c,lib:l,autoPanOnConnect:f,flowId:u,panBy:d,cancelConnection:p,onConnectStart:g,onConnect:w,onConnectEnd:y,isValidConnection:m=Tr,onReconnectEnd:_,updateConnection:h,getTransform:x,getFromHandle:N,autoPanSpeed:b,dragThreshold:C=1,handleDomNode:z}){const T=vr(t.target);let B=0,I;const{x:P,y:V}=dt(t),v=$r(i,z),A=a==null?void 0:a.getBoundingClientRect();let E=!1;if(!A||!v)return;const k=Pr(r,v,o,c,e);if(!k)return;let M=dt(t,A),S=!1,D=null,R=!1,H=null;function O(){if(!f||!A)return;const[U,Z]=mr(M,A,b);d({x:U,y:Z}),B=requestAnimationFrame(O)}const X={...k,nodeId:r,type:v,position:k.position},j=c.get(r);let G={inProgress:!0,isValid:null,from:Pt(j,X,Y.Left,!0),fromHandle:X,fromPosition:X.position,fromNode:j,to:M,toHandle:null,toPosition:Un[X.position],toNode:null,pointer:M};function F(){E=!0,h(G),g==null||g(t,{nodeId:r,handleId:o,handleType:v})}C===0&&F();function W(U){if(!E){const{x:st,y:vt}=dt(U),pt=st-P,Nt=vt-V;if(!(pt*pt+Nt*Nt>C*C))return;F()}if(!N()||!X){Q(U);return}const Z=x();M=dt(U,A),I=xl(le(M,Z,!1,[1,1]),n,c,X),S||(O(),S=!0);const q=zr(U,{handle:I,connectionMode:e,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:m,doc:T,lib:l,flowId:u,nodeLookup:c});H=q.handleDomNode,D=q.connection,R=wl(!!I,q.isValid);const et=c.get(r),nt=et?Pt(et,X,Y.Left,!0):G.from,tt={...G,from:nt,isValid:R,to:q.toHandle&&R?Pe({x:q.toHandle.x,y:q.toHandle.y},Z):M,toHandle:q.toHandle,toPosition:R&&q.toHandle?q.toHandle.position:Un[X.position],toNode:q.toHandle?c.get(q.toHandle.nodeId):null,pointer:M};h(tt),G=tt}function Q(U){if(!("touches"in U&&U.touches.length>0)){if(E){(I||H)&&D&&R&&(w==null||w(D));const{inProgress:Z,...q}=G,et={...q,toPosition:G.toHandle?G.toPosition:null};y==null||y(U,et),i&&(_==null||_(U,et))}p(),cancelAnimationFrame(B),S=!1,R=!1,D=null,H=null,T.removeEventListener("mousemove",W),T.removeEventListener("mouseup",Q),T.removeEventListener("touchmove",W),T.removeEventListener("touchend",Q)}}T.addEventListener("mousemove",W),T.addEventListener("mouseup",Q),T.addEventListener("touchmove",W),T.addEventListener("touchend",Q)}function zr(t,{handle:e,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:l=Tr,nodeLookup:f}){const u=i==="target",d=e?s.querySelector(`.${a}-flow__handle[data-id="${c}-${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`):null,{x:p,y:g}=dt(t),w=s.elementFromPoint(p,g),y=w!=null&&w.classList.contains(`${a}-flow__handle`)?w:d,m={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const _=$r(void 0,y),h=y.getAttribute("data-nodeid"),x=y.getAttribute("data-handleid"),N=y.classList.contains("connectable"),b=y.classList.contains("connectableend");if(!h||!_)return m;const C={source:u?h:o,sourceHandle:u?x:r,target:u?o:h,targetHandle:u?r:x};m.connection=C;const T=N&&b&&(n===Vt.Strict?u&&_==="source"||!u&&_==="target":h!==o||x!==r);m.isValid=T&&l(C),m.toHandle=Pr(h,_,x,f,n,!0)}return m}const gn={onPointerDown:vl,isValid:zr};function _l({domNode:t,panZoom:e,getTransform:n,getViewScale:o}){const r=at(t);function i({translateExtent:a,width:c,height:l,zoomStep:f=1,pannable:u=!0,zoomable:d=!0,inversePan:p=!1}){const g=h=>{if(h.sourceEvent.type!=="wheel"||!e)return;const x=n(),N=h.sourceEvent.ctrlKey&&re()?10:1,b=-h.sourceEvent.deltaY*(h.sourceEvent.deltaMode===1?.05:h.sourceEvent.deltaMode?1:.002)*f,C=x[2]*Math.pow(2,b*N);e.scaleTo(C)};let w=[0,0];const y=h=>{(h.sourceEvent.type==="mousedown"||h.sourceEvent.type==="touchstart")&&(w=[h.sourceEvent.clientX??h.sourceEvent.touches[0].clientX,h.sourceEvent.clientY??h.sourceEvent.touches[0].clientY])},m=h=>{const x=n();if(h.sourceEvent.type!=="mousemove"&&h.sourceEvent.type!=="touchmove"||!e)return;const N=[h.sourceEvent.clientX??h.sourceEvent.touches[0].clientX,h.sourceEvent.clientY??h.sourceEvent.touches[0].clientY],b=[N[0]-w[0],N[1]-w[1]];w=N;const C=o()*Math.max(x[2],Math.log(x[2]))*(p?-1:1),z={x:x[0]-b[0]*C,y:x[1]-b[1]*C},T=[[0,0],[c,l]];e.setViewportConstrained({x:z.x,y:z.y,zoom:x[2]},T,a)},_=cr().on("start",y).on("zoom",u?m:null).on("zoom.wheel",d?g:null);r.call(_,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:ut}}const Fe=t=>({x:t.x,y:t.y,zoom:t.k}),Je=({x:t,y:e,zoom:n})=>Re.translate(t,e).scale(n),zt=(t,e)=>t.target.closest(`.${e}`),Lr=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),bl=t=>((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2,tn=(t,e=0,n=bl,o=()=>{})=>{const r=typeof e=="number"&&e>0;return r||o(),r?t.transition().duration(e).ease(n).on("end",o):t},Dr=t=>{const e=t.ctrlKey&&re()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e};function El({zoomPanValues:t,noWheelClassName:e,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:l}){return f=>{if(zt(f,e))return f.ctrlKey&&f.preventDefault(),!1;f.preventDefault(),f.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(f.ctrlKey&&s){const y=ut(f),m=Dr(f),_=u*Math.pow(2,m);o.scaleTo(n,_,y,f);return}const d=f.deltaMode===1?20:1;let p=r===It.Vertical?0:f.deltaX*d,g=r===It.Horizontal?0:f.deltaY*d;!re()&&f.shiftKey&&r!==It.Vertical&&(p=f.deltaY*d,g=0),o.translateBy(n,-(p/u)*i,-(g/u)*i,{internal:!0});const w=Fe(n.property("__zoom"));clearTimeout(t.panScrollTimeout),t.isPanScrolling?(c==null||c(f,w),t.panScrollTimeout=setTimeout(()=>{l==null||l(f,w),t.isPanScrolling=!1},150)):(t.isPanScrolling=!0,a==null||a(f,w))}}function Sl({noWheelClassName:t,preventScrolling:e,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!e&&i&&!o.ctrlKey,a=zt(o,t);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function Nl({zoomPanValues:t,onDraggingChange:e,onPanZoomStart:n}){return o=>{var i,s,a;if((i=o.sourceEvent)!=null&&i.internal)return;const r=Fe(o.transform);t.mouseButton=((s=o.sourceEvent)==null?void 0:s.button)||0,t.isZoomingOrPanning=!0,t.prevViewport=r,((a=o.sourceEvent)==null?void 0:a.type)==="mousedown"&&e(!0),n&&(n==null||n(o.sourceEvent,r))}}function Cl({zoomPanValues:t,panOnDrag:e,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{var s,a;t.usedRightMouseButton=!!(n&&Lr(e,t.mouseButton??0)),(s=i.sourceEvent)!=null&&s.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!((a=i.sourceEvent)!=null&&a.internal)&&(r==null||r(i.sourceEvent,Fe(i.transform)))}}function Ml({zoomPanValues:t,panOnDrag:e,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{var a;if(!((a=s.sourceEvent)!=null&&a.internal)&&(t.isZoomingOrPanning=!1,i&&Lr(e,t.mouseButton??0)&&!t.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),t.usedRightMouseButton=!1,o(!1),r)){const c=Fe(s.transform);t.prevViewport=c,clearTimeout(t.timerId),t.timerId=setTimeout(()=>{r==null||r(s.sourceEvent,c)},n?150:0)}}}function Il({zoomActivationKeyPressed:t,zoomOnScroll:e,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:c,lib:l,connectionInProgress:f}){return u=>{var y;const d=t||e,p=n&&u.ctrlKey,g=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(zt(u,`${l}-flow__node`)||zt(u,`${l}-flow__edge`)))return!0;if(!o&&!d&&!r&&!i&&!n||s||f&&!g||zt(u,a)&&g||zt(u,c)&&(!g||r&&g&&!t)||!n&&u.ctrlKey&&g)return!1;if(!n&&u.type==="touchstart"&&((y=u.touches)==null?void 0:y.length)>1)return u.preventDefault(),!1;if(!d&&!r&&!p&&g||!o&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(o)&&!o.includes(u.button)&&u.type==="mousedown")return!1;const w=Array.isArray(o)&&o.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||g)&&w}}function Al({domNode:t,minZoom:e,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:c}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=t.getBoundingClientRect(),u=cr().scaleExtent([e,n]).translateExtent(o),d=at(t).call(u);_({x:r.x,y:r.y,zoom:Bt(r.zoom,e,n)},[[0,0],[f.width,f.height]],o);const p=d.on("wheel.zoom"),g=d.on("dblclick.zoom");u.wheelDelta(Dr);function w(I,P){return d?new Promise(V=>{u==null||u.interpolate((P==null?void 0:P.interpolate)==="linear"?Ke:_e).transform(tn(d,P==null?void 0:P.duration,P==null?void 0:P.ease,()=>V(!0)),I)}):Promise.resolve(!1)}function y({noWheelClassName:I,noPanClassName:P,onPaneContextMenu:V,userSelectionActive:v,panOnScroll:A,panOnDrag:E,panOnScrollMode:k,panOnScrollSpeed:M,preventScrolling:S,zoomOnPinch:D,zoomOnScroll:R,zoomOnDoubleClick:H,zoomActivationKeyPressed:O,lib:X,onTransformChange:j,connectionInProgress:K,paneClickDistance:G,selectionOnDrag:F}){v&&!l.isZoomingOrPanning&&m();const W=A&&!O&&!v;u.clickDistance(F?1/0:!lt(G)||G<0?0:G);const Q=W?El({zoomPanValues:l,noWheelClassName:I,d3Selection:d,d3Zoom:u,panOnScrollMode:k,panOnScrollSpeed:M,zoomOnPinch:D,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):Sl({noWheelClassName:I,preventScrolling:S,d3ZoomHandler:p});if(d.on("wheel.zoom",Q,{passive:!1}),!v){const Z=Nl({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:s});u.on("start",Z);const q=Cl({zoomPanValues:l,panOnDrag:E,onPaneContextMenu:!!V,onPanZoom:i,onTransformChange:j});u.on("zoom",q);const et=Ml({zoomPanValues:l,panOnDrag:E,panOnScroll:A,onPaneContextMenu:V,onPanZoomEnd:a,onDraggingChange:c});u.on("end",et)}const U=Il({zoomActivationKeyPressed:O,panOnDrag:E,zoomOnScroll:R,panOnScroll:A,zoomOnDoubleClick:H,zoomOnPinch:D,userSelectionActive:v,noPanClassName:P,noWheelClassName:I,lib:X,connectionInProgress:K});u.filter(U),H?d.on("dblclick.zoom",g):d.on("dblclick.zoom",null)}function m(){u.on("zoom",null)}async function _(I,P,V){const v=Je(I),A=u==null?void 0:u.constrain()(v,P,V);return A&&await w(A),new Promise(E=>E(A))}async function h(I,P){const V=Je(I);return await w(V,P),new Promise(v=>v(V))}function x(I){if(d){const P=Je(I),V=d.property("__zoom");(V.k!==I.zoom||V.x!==I.x||V.y!==I.y)&&(u==null||u.transform(d,P,null,{sync:!0}))}}function N(){const I=d?ar(d.node()):{x:0,y:0,k:1};return{x:I.x,y:I.y,zoom:I.k}}function b(I,P){return d?new Promise(V=>{u==null||u.interpolate((P==null?void 0:P.interpolate)==="linear"?Ke:_e).scaleTo(tn(d,P==null?void 0:P.duration,P==null?void 0:P.ease,()=>V(!0)),I)}):Promise.resolve(!1)}function C(I,P){return d?new Promise(V=>{u==null||u.interpolate((P==null?void 0:P.interpolate)==="linear"?Ke:_e).scaleBy(tn(d,P==null?void 0:P.duration,P==null?void 0:P.ease,()=>V(!0)),I)}):Promise.resolve(!1)}function z(I){u==null||u.scaleExtent(I)}function T(I){u==null||u.translateExtent(I)}function B(I){const P=!lt(I)||I<0?0:I;u==null||u.clickDistance(P)}return{update:y,destroy:m,setViewport:h,setViewportConstrained:_,getViewport:N,scaleTo:b,scaleBy:C,setScaleExtent:z,setTranslateExtent:T,syncViewport:x,setClickDistance:B}}var Xt;(function(t){t.Line="line",t.Handle="handle"})(Xt||(Xt={}));function kl({width:t,prevWidth:e,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=t-e,a=n-o,c=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(c[0]=c[0]*-1),a&&i&&(c[1]=c[1]*-1),c}function lo(t){const e=t.includes("right")||t.includes("left"),n=t.includes("bottom")||t.includes("top"),o=t.includes("left"),r=t.includes("top");return{isHorizontal:e,isVertical:n,affectsX:o,affectsY:r}}function _t(t,e){return Math.max(0,e-t)}function bt(t,e){return Math.max(0,t-e)}function ye(t,e,n){return Math.max(0,e-t,t-n)}function fo(t,e){return t?!e:e}function Pl(t,e,n,o,r,i,s,a){let{affectsX:c,affectsY:l}=e;const{isHorizontal:f,isVertical:u}=e,d=f&&u,{xSnapped:p,ySnapped:g}=n,{minWidth:w,maxWidth:y,minHeight:m,maxHeight:_}=o,{x:h,y:x,width:N,height:b,aspectRatio:C}=t;let z=Math.floor(f?p-t.pointerX:0),T=Math.floor(u?g-t.pointerY:0);const B=N+(c?-z:z),I=b+(l?-T:T),P=-i[0]*N,V=-i[1]*b;let v=ye(B,w,y),A=ye(I,m,_);if(s){let M=0,S=0;c&&z<0?M=_t(h+z+P,s[0][0]):!c&&z>0&&(M=bt(h+B+P,s[1][0])),l&&T<0?S=_t(x+T+V,s[0][1]):!l&&T>0&&(S=bt(x+I+V,s[1][1])),v=Math.max(v,M),A=Math.max(A,S)}if(a){let M=0,S=0;c&&z>0?M=bt(h+z,a[0][0]):!c&&z<0&&(M=_t(h+B,a[1][0])),l&&T>0?S=bt(x+T,a[0][1]):!l&&T<0&&(S=_t(x+I,a[1][1])),v=Math.max(v,M),A=Math.max(A,S)}if(r){if(f){const M=ye(B/C,m,_)*C;if(v=Math.max(v,M),s){let S=0;!c&&!l||c&&!l&&d?S=bt(x+V+B/C,s[1][1])*C:S=_t(x+V+(c?z:-z)/C,s[0][1])*C,v=Math.max(v,S)}if(a){let S=0;!c&&!l||c&&!l&&d?S=_t(x+B/C,a[1][1])*C:S=bt(x+(c?z:-z)/C,a[0][1])*C,v=Math.max(v,S)}}if(u){const M=ye(I*C,w,y)/C;if(A=Math.max(A,M),s){let S=0;!c&&!l||l&&!c&&d?S=bt(h+I*C+P,s[1][0])/C:S=_t(h+(l?T:-T)*C+P,s[0][0])/C,A=Math.max(A,S)}if(a){let S=0;!c&&!l||l&&!c&&d?S=_t(h+I*C,a[1][0])/C:S=bt(h+(l?T:-T)*C,a[0][0])/C,A=Math.max(A,S)}}}T=T+(T<0?A:-A),z=z+(z<0?v:-v),r&&(d?B>I*C?T=(fo(c,l)?-z:z)/C:z=(fo(c,l)?-T:T)*C:f?(T=z/C,l=c):(z=T*C,c=l));const E=c?h+z:h,k=l?x+T:x;return{width:N+(c?-z:z),height:b+(l?-T:T),x:i[0]*z*(c?-1:1)+E,y:i[1]*T*(l?-1:1)+k}}const Hr={width:0,height:0,x:0,y:0},$l={...Hr,pointerX:0,pointerY:0,aspectRatio:1};function Tl(t){return[[0,0],[t.measured.width,t.measured.height]]}function zl(t,e,n){const o=e.position.x+t.position.x,r=e.position.y+t.position.y,i=t.measured.width??0,s=t.measured.height??0,a=n[0]*i,c=n[1]*s;return[[o-a,r-c],[o+i-a,r+s-c]]}function Ll({domNode:t,nodeId:e,getStoreItems:n,onChange:o,onEnd:r}){const i=at(t);let s={controlDirection:lo("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:l,boundaries:f,keepAspectRatio:u,resizeDirection:d,onResizeStart:p,onResize:g,onResizeEnd:w,shouldResize:y}){let m={...Hr},_={...$l};s={boundaries:f,resizeDirection:d,keepAspectRatio:u,controlDirection:lo(l)};let h,x=null,N=[],b,C,z,T=!1;const B=Uo().on("start",I=>{const{nodeLookup:P,transform:V,snapGrid:v,snapToGrid:A,nodeOrigin:E,paneDomNode:k}=n();if(h=P.get(e),!h)return;x=(k==null?void 0:k.getBoundingClientRect())??null;const{xSnapped:M,ySnapped:S}=Qt(I.sourceEvent,{transform:V,snapGrid:v,snapToGrid:A,containerBounds:x});m={width:h.measured.width??0,height:h.measured.height??0,x:h.position.x??0,y:h.position.y??0},_={...m,pointerX:M,pointerY:S,aspectRatio:m.width/m.height},b=void 0,h.parentId&&(h.extent==="parent"||h.expandParent)&&(b=P.get(h.parentId),C=b&&h.extent==="parent"?Tl(b):void 0),N=[],z=void 0;for(const[D,R]of P)if(R.parentId===e&&(N.push({id:D,position:{...R.position},extent:R.extent}),R.extent==="parent"||R.expandParent)){const H=zl(R,h,R.origin??E);z?z=[[Math.min(H[0][0],z[0][0]),Math.min(H[0][1],z[0][1])],[Math.max(H[1][0],z[1][0]),Math.max(H[1][1],z[1][1])]]:z=H}p==null||p(I,{...m})}).on("drag",I=>{const{transform:P,snapGrid:V,snapToGrid:v,nodeOrigin:A}=n(),E=Qt(I.sourceEvent,{transform:P,snapGrid:V,snapToGrid:v,containerBounds:x}),k=[];if(!h)return;const{x:M,y:S,width:D,height:R}=m,H={},O=h.origin??A,{width:X,height:j,x:K,y:G}=Pl(_,s.controlDirection,E,s.boundaries,s.keepAspectRatio,O,C,z),F=X!==D,W=j!==R,Q=K!==M&&F,U=G!==S&&W;if(!Q&&!U&&!F&&!W)return;if((Q||U||O[0]===1||O[1]===1)&&(H.x=Q?K:m.x,H.y=U?G:m.y,m.x=H.x,m.y=H.y,N.length>0)){const nt=K-M,tt=G-S;for(const st of N)st.position={x:st.position.x-nt+O[0]*(X-D),y:st.position.y-tt+O[1]*(j-R)},k.push(st)}if((F||W)&&(H.width=F&&(!s.resizeDirection||s.resizeDirection==="horizontal")?X:m.width,H.height=W&&(!s.resizeDirection||s.resizeDirection==="vertical")?j:m.height,m.width=H.width,m.height=H.height),b&&h.expandParent){const nt=O[0]*(H.width??0);H.x&&H.x<nt&&(m.x=nt,_.x=_.x-(H.x-nt));const tt=O[1]*(H.height??0);H.y&&H.y<tt&&(m.y=tt,_.y=_.y-(H.y-tt))}const Z=kl({width:m.width,prevWidth:D,height:m.height,prevHeight:R,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),q={...m,direction:Z};(y==null?void 0:y(I,q))!==!1&&(T=!0,g==null||g(I,q),o(H,k))}).on("end",I=>{T&&(w==null||w(I,{...m}),r==null||r({...m}),T=!1)});i.call(B)}function c(){i.on(".drag",null)}return{update:a,destroy:c}}const Dl={},ho=t=>{let e;const n=new Set,o=(f,u)=>{const d=typeof f=="function"?f(e):f;if(!Object.is(d,e)){const p=e;e=u??(typeof d!="object"||d===null)?d:Object.assign({},e,d),n.forEach(g=>g(e,p))}},r=()=>e,c={setState:o,getState:r,getInitialState:()=>l,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(Dl?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},l=e=t(o,r,c);return c},Hl=t=>t?ho(t):ho,{useDebugValue:Rl}=bs,{useSyncExternalStoreWithSelector:Vl}=Ss,Bl=t=>t;function Rr(t,e=Bl,n){const o=Vl(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return Rl(o),o}const go=(t,e)=>{const n=Hl(t),o=(r,i=e)=>Rr(n,r,i);return Object.assign(o,n),o},Fl=(t,e)=>t?go(t,e):go;function ot(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[o,r]of t)if(!Object.is(r,e.get(o)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const o of t)if(!e.has(o))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(e,o)||!Object.is(t[o],e[o]))return!1;return!0}const Oe=L.createContext(null),Ol=Oe.Provider,Vr=ht.error001();function J(t,e){const n=L.useContext(Oe);if(n===null)throw new Error(Vr);return Rr(n,t,e)}function rt(){const t=L.useContext(Oe);if(t===null)throw new Error(Vr);return L.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe}),[t])}const po={display:"none"},Xl={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Br="react-flow__node-desc",Fr="react-flow__edge-desc",Yl="react-flow__aria-live",jl=t=>t.ariaLiveMessage,Wl=t=>t.ariaLabelConfig;function Gl({rfId:t}){const e=J(jl);return $.jsx("div",{id:`${Yl}-${t}`,"aria-live":"assertive","aria-atomic":"true",style:Xl,children:e})}function ql({rfId:t,disableKeyboardA11y:e}){const n=J(Wl);return $.jsxs($.Fragment,{children:[$.jsx("div",{id:`${Br}-${t}`,style:po,children:e?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),$.jsx("div",{id:`${Fr}-${t}`,style:po,children:n["edge.a11yDescription.default"]}),!e&&$.jsx(Gl,{rfId:t})]})}const Xe=L.forwardRef(({position:t="top-left",children:e,className:n,style:o,...r},i)=>{const s=`${t}`.split("-");return $.jsx("div",{className:it(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:e})});Xe.displayName="Panel";function Kl({proOptions:t,position:e="bottom-right"}){return t!=null&&t.hideAttribution?null:$.jsx(Xe,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:$.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Zl=t=>{const e=[],n=[];for(const[,o]of t.nodeLookup)o.selected&&e.push(o.internals.userNode);for(const[,o]of t.edgeLookup)o.selected&&n.push(o);return{selectedNodes:e,selectedEdges:n}},xe=t=>t.id;function Ul(t,e){return ot(t.selectedNodes.map(xe),e.selectedNodes.map(xe))&&ot(t.selectedEdges.map(xe),e.selectedEdges.map(xe))}function Ql({onSelectionChange:t}){const e=rt(),{selectedNodes:n,selectedEdges:o}=J(Zl,Ul);return L.useEffect(()=>{const r={nodes:n,edges:o};t==null||t(r),e.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,t]),null}const Jl=t=>!!t.onSelectionChangeHandlers;function td({onSelectionChange:t}){const e=J(Jl);return t||e?$.jsx(Ql,{onSelectionChange:t}):null}const Or=[0,0],ed={x:0,y:0,zoom:1},nd=["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"],mo=[...nd,"rfId"],od=t=>({setNodes:t.setNodes,setEdges:t.setEdges,setMinZoom:t.setMinZoom,setMaxZoom:t.setMaxZoom,setTranslateExtent:t.setTranslateExtent,setNodeExtent:t.setNodeExtent,reset:t.reset,setDefaultNodesAndEdges:t.setDefaultNodesAndEdges}),yo={translateExtent:ee,nodeOrigin:Or,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function rd(t){const{setNodes:e,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:c}=J(od,ot),l=rt();L.useEffect(()=>(c(t.defaultNodes,t.defaultEdges),()=>{f.current=yo,a()}),[]);const f=L.useRef(yo);return L.useEffect(()=>{for(const u of mo){const d=t[u],p=f.current[u];d!==p&&(typeof t[u]>"u"||(u==="nodes"?e(d):u==="edges"?n(d):u==="minZoom"?o(d):u==="maxZoom"?r(d):u==="translateExtent"?i(d):u==="nodeExtent"?s(d):u==="ariaLabelConfig"?l.setState({ariaLabelConfig:Gu(d)}):u==="fitView"?l.setState({fitViewQueued:d}):u==="fitViewOptions"?l.setState({fitViewOptions:d}):l.setState({[u]:d})))}f.current=t},mo.map(u=>t[u])),null}function xo(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function id(t){var o;const[e,n]=L.useState(t==="system"?null:t);return L.useEffect(()=>{if(t!=="system"){n(t);return}const r=xo(),i=()=>n(r!=null&&r.matches?"dark":"light");return i(),r==null||r.addEventListener("change",i),()=>{r==null||r.removeEventListener("change",i)}},[t]),e!==null?e:(o=xo())!=null&&o.matches?"dark":"light"}const wo=typeof document<"u"?document:null;function ie(t=null,e={target:wo,actInsideInputWithModifier:!0}){const[n,o]=L.useState(!1),r=L.useRef(!1),i=L.useRef(new Set([])),[s,a]=L.useMemo(()=>{if(t!==null){const l=(Array.isArray(t)?t:[t]).filter(u=>typeof u=="string").map(u=>u.replace("+",`
1
+ import{R as bs,r as L,j as $}from"./index-CIhDR5rf.js";import{a as Ct,c as Bn,b as Fn,d as Es,i as Ke,u as Ss,r as Ns}from"./index-B5DzSMGg.js";function it(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n=0,o;n<t.length;n++)(o=it(t[n]))!==""&&(e+=(e&&" ")+o);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}var Cs={value:()=>{}};function ze(){for(var t=0,e=arguments.length,n={},o;t<e;++t){if(!(o=arguments[t]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new ve(n)}function ve(t){this._=t}function Ms(t,e){return t.trim().split(/^|\s+/).map(function(n){var o="",r=n.indexOf(".");if(r>=0&&(o=n.slice(r+1),n=n.slice(0,r)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}ve.prototype=ze.prototype={constructor:ve,on:function(t,e){var n=this._,o=Ms(t+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(t=o[i]).type)&&(r=Is(n[r],t.name)))return r;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++i<s;)if(r=(t=o[i]).type)n[r]=On(n[r],t.name,e);else if(e==null)for(r in n)n[r]=On(n[r],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new ve(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,i;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=this._[t],o=0,r=i.length;o<r;++o)i[o].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var o=this._[t],r=0,i=o.length;r<i;++r)o[r].value.apply(e,n)}};function Is(t,e){for(var n=0,o=t.length,r;n<o;++n)if((r=t[n]).name===e)return r.value}function On(t,e,n){for(var o=0,r=t.length;o<r;++o)if(t[o].name===e){t[o]=Cs,t=t.slice(0,o).concat(t.slice(o+1));break}return n!=null&&t.push({name:e,value:n}),t}var on="http://www.w3.org/1999/xhtml";const Xn={svg:"http://www.w3.org/2000/svg",xhtml:on,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Le(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),Xn.hasOwnProperty(e)?{space:Xn[e],local:t}:t}function As(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===on&&e.documentElement.namespaceURI===on?e.createElement(t):e.createElementNS(n,t)}}function ks(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Ho(t){var e=Le(t);return(e.local?ks:As)(e)}function Ps(){}function mn(t){return t==null?Ps:function(){return this.querySelector(t)}}function $s(t){typeof t!="function"&&(t=mn(t));for(var e=this._groups,n=e.length,o=new Array(n),r=0;r<n;++r)for(var i=e[r],s=i.length,a=o[r]=new Array(s),c,l,f=0;f<s;++f)(c=i[f])&&(l=t.call(c,c.__data__,f,i))&&("__data__"in c&&(l.__data__=c.__data__),a[f]=l);return new ct(o,this._parents)}function Ts(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function zs(){return[]}function Ro(t){return t==null?zs:function(){return this.querySelectorAll(t)}}function Ls(t){return function(){return Ts(t.apply(this,arguments))}}function Ds(t){typeof t=="function"?t=Ls(t):t=Ro(t);for(var e=this._groups,n=e.length,o=[],r=[],i=0;i<n;++i)for(var s=e[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(o.push(t.call(c,c.__data__,l,s)),r.push(c));return new ct(o,r)}function Vo(t){return function(){return this.matches(t)}}function Bo(t){return function(e){return e.matches(t)}}var Hs=Array.prototype.find;function Rs(t){return function(){return Hs.call(this.children,t)}}function Vs(){return this.firstElementChild}function Bs(t){return this.select(t==null?Vs:Rs(typeof t=="function"?t:Bo(t)))}var Fs=Array.prototype.filter;function Os(){return Array.from(this.children)}function Xs(t){return function(){return Fs.call(this.children,t)}}function Ys(t){return this.selectAll(t==null?Os:Xs(typeof t=="function"?t:Bo(t)))}function js(t){typeof t!="function"&&(t=Vo(t));for(var e=this._groups,n=e.length,o=new Array(n),r=0;r<n;++r)for(var i=e[r],s=i.length,a=o[r]=[],c,l=0;l<s;++l)(c=i[l])&&t.call(c,c.__data__,l,i)&&a.push(c);return new ct(o,this._parents)}function Fo(t){return new Array(t.length)}function Ws(){return new ct(this._enter||this._groups.map(Fo),this._parents)}function Ne(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Ne.prototype={constructor:Ne,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function Gs(t){return function(){return t}}function qs(t,e,n,o,r,i){for(var s=0,a,c=e.length,l=i.length;s<l;++s)(a=e[s])?(a.__data__=i[s],o[s]=a):n[s]=new Ne(t,i[s]);for(;s<c;++s)(a=e[s])&&(r[s]=a)}function Ks(t,e,n,o,r,i,s){var a,c,l=new Map,f=e.length,u=i.length,d=new Array(f),p;for(a=0;a<f;++a)(c=e[a])&&(d[a]=p=s.call(c,c.__data__,a,e)+"",l.has(p)?r[a]=c:l.set(p,c));for(a=0;a<u;++a)p=s.call(t,i[a],a,i)+"",(c=l.get(p))?(o[a]=c,c.__data__=i[a],l.delete(p)):n[a]=new Ne(t,i[a]);for(a=0;a<f;++a)(c=e[a])&&l.get(d[a])===c&&(r[a]=c)}function Zs(t){return t.__data__}function Us(t,e){if(!arguments.length)return Array.from(this,Zs);var n=e?Ks:qs,o=this._parents,r=this._groups;typeof t!="function"&&(t=Gs(t));for(var i=r.length,s=new Array(i),a=new Array(i),c=new Array(i),l=0;l<i;++l){var f=o[l],u=r[l],d=u.length,p=Qs(t.call(f,f&&f.__data__,l,o)),g=p.length,w=a[l]=new Array(g),y=s[l]=new Array(g),m=c[l]=new Array(d);n(f,u,w,y,m,p,e);for(var _=0,h=0,x,N;_<g;++_)if(x=w[_]){for(_>=h&&(h=_+1);!(N=y[h])&&++h<g;);x._next=N||null}}return s=new ct(s,o),s._enter=a,s._exit=c,s}function Qs(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function Js(){return new ct(this._exit||this._groups.map(Fo),this._parents)}function ta(t,e,n){var o=this.enter(),r=this,i=this.exit();return typeof t=="function"?(o=t(o),o&&(o=o.selection())):o=o.append(t+""),e!=null&&(r=e(r),r&&(r=r.selection())),n==null?i.remove():n(i),o&&r?o.merge(r).order():r}function ea(t){for(var e=t.selection?t.selection():t,n=this._groups,o=e._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),c=0;c<s;++c)for(var l=n[c],f=o[c],u=l.length,d=a[c]=new Array(u),p,g=0;g<u;++g)(p=l[g]||f[g])&&(d[g]=p);for(;c<r;++c)a[c]=n[c];return new ct(a,this._parents)}function na(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var o=t[e],r=o.length-1,i=o[r],s;--r>=0;)(s=o[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function oa(t){t||(t=ra);function e(u,d){return u&&d?t(u.__data__,d.__data__):!u-!d}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],a=s.length,c=r[i]=new Array(a),l,f=0;f<a;++f)(l=s[f])&&(c[f]=l);c.sort(e)}return new ct(r,this._parents).order()}function ra(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function ia(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function sa(){return Array.from(this)}function aa(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var o=t[e],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function ca(){let t=0;for(const e of this)++t;return t}function ua(){return!this.node()}function la(t){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var r=e[n],i=0,s=r.length,a;i<s;++i)(a=r[i])&&t.call(a,a.__data__,i,r);return this}function da(t){return function(){this.removeAttribute(t)}}function fa(t){return function(){this.removeAttributeNS(t.space,t.local)}}function ha(t,e){return function(){this.setAttribute(t,e)}}function ga(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function pa(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function ma(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function ya(t,e){var n=Le(t);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((e==null?n.local?fa:da:typeof e=="function"?n.local?ma:pa:n.local?ga:ha)(n,e))}function Oo(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function xa(t){return function(){this.style.removeProperty(t)}}function wa(t,e,n){return function(){this.style.setProperty(t,e,n)}}function va(t,e,n){return function(){var o=e.apply(this,arguments);o==null?this.style.removeProperty(t):this.style.setProperty(t,o,n)}}function _a(t,e,n){return arguments.length>1?this.each((e==null?xa:typeof e=="function"?va:wa)(t,e,n??"")):Ht(this.node(),t)}function Ht(t,e){return t.style.getPropertyValue(e)||Oo(t).getComputedStyle(t,null).getPropertyValue(e)}function ba(t){return function(){delete this[t]}}function Ea(t,e){return function(){this[t]=e}}function Sa(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function Na(t,e){return arguments.length>1?this.each((e==null?ba:typeof e=="function"?Sa:Ea)(t,e)):this.node()[t]}function Xo(t){return t.trim().split(/^|\s+/)}function yn(t){return t.classList||new Yo(t)}function Yo(t){this._node=t,this._names=Xo(t.getAttribute("class")||"")}Yo.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function jo(t,e){for(var n=yn(t),o=-1,r=e.length;++o<r;)n.add(e[o])}function Wo(t,e){for(var n=yn(t),o=-1,r=e.length;++o<r;)n.remove(e[o])}function Ca(t){return function(){jo(this,t)}}function Ma(t){return function(){Wo(this,t)}}function Ia(t,e){return function(){(e.apply(this,arguments)?jo:Wo)(this,t)}}function Aa(t,e){var n=Xo(t+"");if(arguments.length<2){for(var o=yn(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof e=="function"?Ia:e?Ca:Ma)(n,e))}function ka(){this.textContent=""}function Pa(t){return function(){this.textContent=t}}function $a(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Ta(t){return arguments.length?this.each(t==null?ka:(typeof t=="function"?$a:Pa)(t)):this.node().textContent}function za(){this.innerHTML=""}function La(t){return function(){this.innerHTML=t}}function Da(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function Ha(t){return arguments.length?this.each(t==null?za:(typeof t=="function"?Da:La)(t)):this.node().innerHTML}function Ra(){this.nextSibling&&this.parentNode.appendChild(this)}function Va(){return this.each(Ra)}function Ba(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Fa(){return this.each(Ba)}function Oa(t){var e=typeof t=="function"?t:Ho(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function Xa(){return null}function Ya(t,e){var n=typeof t=="function"?t:Ho(t),o=e==null?Xa:typeof e=="function"?e:mn(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function ja(){var t=this.parentNode;t&&t.removeChild(this)}function Wa(){return this.each(ja)}function Ga(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function qa(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Ka(t){return this.select(t?qa:Ga)}function Za(t){return arguments.length?this.property("__data__",t):this.node().__data__}function Ua(t){return function(e){t.call(this,e,this.__data__)}}function Qa(t){return t.trim().split(/^|\s+/).map(function(e){var n="",o=e.indexOf(".");return o>=0&&(n=e.slice(o+1),e=e.slice(0,o)),{type:e,name:n}})}function Ja(t){return function(){var e=this.__on;if(e){for(var n=0,o=-1,r=e.length,i;n<r;++n)i=e[n],(!t.type||i.type===t.type)&&i.name===t.name?this.removeEventListener(i.type,i.listener,i.options):e[++o]=i;++o?e.length=o:delete this.__on}}}function tc(t,e,n){return function(){var o=this.__on,r,i=Ua(e);if(o){for(var s=0,a=o.length;s<a;++s)if((r=o[s]).type===t.type&&r.name===t.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=e;return}}this.addEventListener(t.type,i,n),r={type:t.type,name:t.name,value:e,listener:i,options:n},o?o.push(r):this.__on=[r]}}function ec(t,e,n){var o=Qa(t+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,f;c<l;++c)for(r=0,f=a[c];r<i;++r)if((s=o[r]).type===f.type&&s.name===f.name)return f.value}return}for(a=e?tc:Ja,r=0;r<i;++r)this.each(a(o[r],e,n));return this}function Go(t,e,n){var o=Oo(t),r=o.CustomEvent;typeof r=="function"?r=new r(e,n):(r=o.document.createEvent("Event"),n?(r.initEvent(e,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(e,!1,!1)),t.dispatchEvent(r)}function nc(t,e){return function(){return Go(this,t,e)}}function oc(t,e){return function(){return Go(this,t,e.apply(this,arguments))}}function rc(t,e){return this.each((typeof e=="function"?oc:nc)(t,e))}function*ic(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var o=t[e],r=0,i=o.length,s;r<i;++r)(s=o[r])&&(yield s)}var qo=[null];function ct(t,e){this._groups=t,this._parents=e}function se(){return new ct([[document.documentElement]],qo)}function sc(){return this}ct.prototype=se.prototype={constructor:ct,select:$s,selectAll:Ds,selectChild:Bs,selectChildren:Ys,filter:js,data:Us,enter:Ws,exit:Js,join:ta,merge:ea,selection:sc,order:na,sort:oa,call:ia,nodes:sa,node:aa,size:ca,empty:ua,each:la,attr:ya,style:_a,property:Na,classed:Aa,text:Ta,html:Ha,raise:Va,lower:Fa,append:Oa,insert:Ya,remove:Wa,clone:Ka,datum:Za,on:ec,dispatch:rc,[Symbol.iterator]:ic};function at(t){return typeof t=="string"?new ct([[document.querySelector(t)]],[document.documentElement]):new ct([[t]],qo)}function ac(t){let e;for(;e=t.sourceEvent;)t=e;return t}function ut(t,e){if(t=ac(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=t.clientX,o.y=t.clientY,o=o.matrixTransform(e.getScreenCTM().inverse()),[o.x,o.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}}return[t.pageX,t.pageY]}const cc={passive:!1},Jt={capture:!0,passive:!1};function Ze(t){t.stopImmediatePropagation()}function Dt(t){t.preventDefault(),t.stopImmediatePropagation()}function Ko(t){var e=t.document.documentElement,n=at(t).on("dragstart.drag",Dt,Jt);"onselectstart"in e?n.on("selectstart.drag",Dt,Jt):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Zo(t,e){var n=t.document.documentElement,o=at(t).on("dragstart.drag",null);e&&(o.on("click.drag",Dt,Jt),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const he=t=>()=>t;function rn(t,{sourceEvent:e,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:c,dy:l,dispatch:f}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:f}})}rn.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function uc(t){return!t.ctrlKey&&!t.button}function lc(){return this.parentNode}function dc(t,e){return e??{x:t.x,y:t.y}}function fc(){return navigator.maxTouchPoints||"ontouchstart"in this}function Uo(){var t=uc,e=lc,n=dc,o=fc,r={},i=ze("start","drag","end"),s=0,a,c,l,f,u=0;function d(x){x.on("mousedown.drag",p).filter(o).on("touchstart.drag",y).on("touchmove.drag",m,cc).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(x,N){if(!(f||!t.call(this,x,N))){var b=h(this,e.call(this,x,N),x,N,"mouse");b&&(at(x.view).on("mousemove.drag",g,Jt).on("mouseup.drag",w,Jt),Ko(x.view),Ze(x),l=!1,a=x.clientX,c=x.clientY,b("start",x))}}function g(x){if(Dt(x),!l){var N=x.clientX-a,b=x.clientY-c;l=N*N+b*b>u}r.mouse("drag",x)}function w(x){at(x.view).on("mousemove.drag mouseup.drag",null),Zo(x.view,l),Dt(x),r.mouse("end",x)}function y(x,N){if(t.call(this,x,N)){var b=x.changedTouches,C=e.call(this,x,N),z=b.length,T,B;for(T=0;T<z;++T)(B=h(this,C,x,N,b[T].identifier,b[T]))&&(Ze(x),B("start",x,b[T]))}}function m(x){var N=x.changedTouches,b=N.length,C,z;for(C=0;C<b;++C)(z=r[N[C].identifier])&&(Dt(x),z("drag",x,N[C]))}function _(x){var N=x.changedTouches,b=N.length,C,z;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),C=0;C<b;++C)(z=r[N[C].identifier])&&(Ze(x),z("end",x,N[C]))}function h(x,N,b,C,z,T){var B=i.copy(),I=ut(T||b,N),P,V,v;if((v=n.call(x,new rn("beforestart",{sourceEvent:b,target:d,identifier:z,active:s,x:I[0],y:I[1],dx:0,dy:0,dispatch:B}),C))!=null)return P=v.x-I[0]||0,V=v.y-I[1]||0,function A(E,k,M){var S=I,D;switch(E){case"start":r[z]=A,D=s++;break;case"end":delete r[z],--s;case"drag":I=ut(M||k,N),D=s;break}B.call(E,x,new rn(E,{sourceEvent:k,subject:v,target:d,identifier:z,active:D,x:I[0]+P,y:I[1]+V,dx:I[0]-S[0],dy:I[1]-S[1],dispatch:B}),C)}}return d.filter=function(x){return arguments.length?(t=typeof x=="function"?x:he(!!x),d):t},d.container=function(x){return arguments.length?(e=typeof x=="function"?x:he(x),d):e},d.subject=function(x){return arguments.length?(n=typeof x=="function"?x:he(x),d):n},d.touchable=function(x){return arguments.length?(o=typeof x=="function"?x:he(!!x),d):o},d.on=function(){var x=i.on.apply(i,arguments);return x===i?d:x},d.clickDistance=function(x){return arguments.length?(u=(x=+x)*x,d):Math.sqrt(u)},d}var Yn=180/Math.PI,sn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Qo(t,e,n,o,r,i){var s,a,c;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(c=t*n+e*o)&&(n-=t*c,o-=e*c),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,c/=a),t*o<e*n&&(t=-t,e=-e,c=-c,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(e,t)*Yn,skewX:Math.atan(c)*Yn,scaleX:s,scaleY:a}}var ge;function hc(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?sn:Qo(e.a,e.b,e.c,e.d,e.e,e.f)}function gc(t){return t==null||(ge||(ge=document.createElementNS("http://www.w3.org/2000/svg","g")),ge.setAttribute("transform",t),!(t=ge.transform.baseVal.consolidate()))?sn:(t=t.matrix,Qo(t.a,t.b,t.c,t.d,t.e,t.f))}function Jo(t,e,n,o){function r(l){return l.length?l.pop()+" ":""}function i(l,f,u,d,p,g){if(l!==u||f!==d){var w=p.push("translate(",null,e,null,n);g.push({i:w-4,x:Ct(l,u)},{i:w-2,x:Ct(f,d)})}else(u||d)&&p.push("translate("+u+e+d+n)}function s(l,f,u,d){l!==f?(l-f>180?f+=360:f-l>180&&(l+=360),d.push({i:u.push(r(u)+"rotate(",null,o)-2,x:Ct(l,f)})):f&&u.push(r(u)+"rotate("+f+o)}function a(l,f,u,d){l!==f?d.push({i:u.push(r(u)+"skewX(",null,o)-2,x:Ct(l,f)}):f&&u.push(r(u)+"skewX("+f+o)}function c(l,f,u,d,p,g){if(l!==u||f!==d){var w=p.push(r(p)+"scale(",null,",",null,")");g.push({i:w-4,x:Ct(l,u)},{i:w-2,x:Ct(f,d)})}else(u!==1||d!==1)&&p.push(r(p)+"scale("+u+","+d+")")}return function(l,f){var u=[],d=[];return l=t(l),f=t(f),i(l.translateX,l.translateY,f.translateX,f.translateY,u,d),s(l.rotate,f.rotate,u,d),a(l.skewX,f.skewX,u,d),c(l.scaleX,l.scaleY,f.scaleX,f.scaleY,u,d),l=f=null,function(p){for(var g=-1,w=d.length,y;++g<w;)u[(y=d[g]).i]=y.x(p);return u.join("")}}}var pc=Jo(hc,"px, ","px)","deg)"),mc=Jo(gc,", ",")",")"),yc=1e-12;function jn(t){return((t=Math.exp(t))+1/t)/2}function xc(t){return((t=Math.exp(t))-1/t)/2}function wc(t){return((t=Math.exp(2*t))-1)/(t+1)}const _e=(function t(e,n,o){function r(i,s){var a=i[0],c=i[1],l=i[2],f=s[0],u=s[1],d=s[2],p=f-a,g=u-c,w=p*p+g*g,y,m;if(w<yc)m=Math.log(d/l)/e,y=function(C){return[a+C*p,c+C*g,l*Math.exp(e*C*m)]};else{var _=Math.sqrt(w),h=(d*d-l*l+o*w)/(2*l*n*_),x=(d*d-l*l-o*w)/(2*d*n*_),N=Math.log(Math.sqrt(h*h+1)-h),b=Math.log(Math.sqrt(x*x+1)-x);m=(b-N)/e,y=function(C){var z=C*m,T=jn(N),B=l/(n*_)*(T*wc(e*z+N)-xc(N));return[a+B*p,c+B*g,l*T/jn(e*z+N)]}}return y.duration=m*1e3*e/Math.SQRT2,y}return r.rho=function(i){var s=Math.max(.001,+i),a=s*s,c=a*a;return t(s,a,c)},r})(Math.SQRT2,2,4);var Rt=0,Zt=0,qt=0,tr=1e3,Ce,Ut,Me=0,At=0,De=0,te=typeof performance=="object"&&performance.now?performance:Date,er=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function xn(){return At||(er(vc),At=te.now()+De)}function vc(){At=0}function Ie(){this._call=this._time=this._next=null}Ie.prototype=nr.prototype={constructor:Ie,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?xn():+n)+(e==null?0:+e),!this._next&&Ut!==this&&(Ut?Ut._next=this:Ce=this,Ut=this),this._call=t,this._time=n,an()},stop:function(){this._call&&(this._call=null,this._time=1/0,an())}};function nr(t,e,n){var o=new Ie;return o.restart(t,e,n),o}function _c(){xn(),++Rt;for(var t=Ce,e;t;)(e=At-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Rt}function Wn(){At=(Me=te.now())+De,Rt=Zt=0;try{_c()}finally{Rt=0,Ec(),At=0}}function bc(){var t=te.now(),e=t-Me;e>tr&&(De-=e,Me=t)}function Ec(){for(var t,e=Ce,n,o=1/0;e;)e._call?(o>e._time&&(o=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Ce=n);Ut=t,an(o)}function an(t){if(!Rt){Zt&&(Zt=clearTimeout(Zt));var e=t-At;e>24?(t<1/0&&(Zt=setTimeout(Wn,t-te.now()-De)),qt&&(qt=clearInterval(qt))):(qt||(Me=te.now(),qt=setInterval(bc,tr)),Rt=1,er(Wn))}}function Gn(t,e,n){var o=new Ie;return e=e==null?0:+e,o.restart(r=>{o.stop(),t(r+e)},e,n),o}var Sc=ze("start","end","cancel","interrupt"),Nc=[],or=0,qn=1,cn=2,be=3,Kn=4,un=5,Ee=6;function He(t,e,n,o,r,i){var s=t.__transition;if(!s)t.__transition={};else if(n in s)return;Cc(t,n,{name:e,index:o,group:r,on:Sc,tween:Nc,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:or})}function wn(t,e){var n=ft(t,e);if(n.state>or)throw new Error("too late; already scheduled");return n}function gt(t,e){var n=ft(t,e);if(n.state>be)throw new Error("too late; already running");return n}function ft(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Cc(t,e,n){var o=t.__transition,r;o[e]=n,n.timer=nr(i,0,n.time);function i(l){n.state=qn,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var f,u,d,p;if(n.state!==qn)return c();for(f in o)if(p=o[f],p.name===n.name){if(p.state===be)return Gn(s);p.state===Kn?(p.state=Ee,p.timer.stop(),p.on.call("interrupt",t,t.__data__,p.index,p.group),delete o[f]):+f<e&&(p.state=Ee,p.timer.stop(),p.on.call("cancel",t,t.__data__,p.index,p.group),delete o[f])}if(Gn(function(){n.state===be&&(n.state=Kn,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=cn,n.on.call("start",t,t.__data__,n.index,n.group),n.state===cn){for(n.state=be,r=new Array(d=n.tween.length),f=0,u=-1;f<d;++f)(p=n.tween[f].value.call(t,t.__data__,n.index,n.group))&&(r[++u]=p);r.length=u+1}}function a(l){for(var f=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=un,1),u=-1,d=r.length;++u<d;)r[u].call(t,f);n.state===un&&(n.on.call("end",t,t.__data__,n.index,n.group),c())}function c(){n.state=Ee,n.timer.stop(),delete o[e];for(var l in o)return;delete t.__transition}}function Se(t,e){var n=t.__transition,o,r,i=!0,s;if(n){e=e==null?null:e+"";for(s in n){if((o=n[s]).name!==e){i=!1;continue}r=o.state>cn&&o.state<un,o.state=Ee,o.timer.stop(),o.on.call(r?"interrupt":"cancel",t,t.__data__,o.index,o.group),delete n[s]}i&&delete t.__transition}}function Mc(t){return this.each(function(){Se(this,t)})}function Ic(t,e){var n,o;return function(){var r=gt(this,t),i=r.tween;if(i!==n){o=n=i;for(var s=0,a=o.length;s<a;++s)if(o[s].name===e){o=o.slice(),o.splice(s,1);break}}r.tween=o}}function Ac(t,e,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=gt(this,t),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:e,value:n},c=0,l=r.length;c<l;++c)if(r[c].name===e){r[c]=a;break}c===l&&r.push(a)}i.tween=r}}function kc(t,e){var n=this._id;if(t+="",arguments.length<2){for(var o=ft(this.node(),n).tween,r=0,i=o.length,s;r<i;++r)if((s=o[r]).name===t)return s.value;return null}return this.each((e==null?Ic:Ac)(n,t,e))}function vn(t,e,n){var o=t._id;return t.each(function(){var r=gt(this,o);(r.value||(r.value={}))[e]=n.apply(this,arguments)}),function(r){return ft(r,o).value[e]}}function rr(t,e){var n;return(typeof e=="number"?Ct:e instanceof Bn?Fn:(n=Bn(e))?(e=n,Fn):Es)(t,e)}function Pc(t){return function(){this.removeAttribute(t)}}function $c(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Tc(t,e,n){var o,r=n+"",i;return function(){var s=this.getAttribute(t);return s===r?null:s===o?i:i=e(o=s,n)}}function zc(t,e,n){var o,r=n+"",i;return function(){var s=this.getAttributeNS(t.space,t.local);return s===r?null:s===o?i:i=e(o=s,n)}}function Lc(t,e,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(t):(s=this.getAttribute(t),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=e(o=s,a)))}}function Dc(t,e,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(t.space,t.local):(s=this.getAttributeNS(t.space,t.local),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=e(o=s,a)))}}function Hc(t,e){var n=Le(t),o=n==="transform"?mc:rr;return this.attrTween(t,typeof e=="function"?(n.local?Dc:Lc)(n,o,vn(this,"attr."+t,e)):e==null?(n.local?$c:Pc)(n):(n.local?zc:Tc)(n,o,e))}function Rc(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function Vc(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function Bc(t,e){var n,o;function r(){var i=e.apply(this,arguments);return i!==o&&(n=(o=i)&&Vc(t,i)),n}return r._value=e,r}function Fc(t,e){var n,o;function r(){var i=e.apply(this,arguments);return i!==o&&(n=(o=i)&&Rc(t,i)),n}return r._value=e,r}function Oc(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var o=Le(t);return this.tween(n,(o.local?Bc:Fc)(o,e))}function Xc(t,e){return function(){wn(this,t).delay=+e.apply(this,arguments)}}function Yc(t,e){return e=+e,function(){wn(this,t).delay=e}}function jc(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Xc:Yc)(e,t)):ft(this.node(),e).delay}function Wc(t,e){return function(){gt(this,t).duration=+e.apply(this,arguments)}}function Gc(t,e){return e=+e,function(){gt(this,t).duration=e}}function qc(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Wc:Gc)(e,t)):ft(this.node(),e).duration}function Kc(t,e){if(typeof e!="function")throw new Error;return function(){gt(this,t).ease=e}}function Zc(t){var e=this._id;return arguments.length?this.each(Kc(e,t)):ft(this.node(),e).ease}function Uc(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;gt(this,t).ease=n}}function Qc(t){if(typeof t!="function")throw new Error;return this.each(Uc(this._id,t))}function Jc(t){typeof t!="function"&&(t=Vo(t));for(var e=this._groups,n=e.length,o=new Array(n),r=0;r<n;++r)for(var i=e[r],s=i.length,a=o[r]=[],c,l=0;l<s;++l)(c=i[l])&&t.call(c,c.__data__,l,i)&&a.push(c);return new xt(o,this._parents,this._name,this._id)}function tu(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,o=e.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var c=e[a],l=n[a],f=c.length,u=s[a]=new Array(f),d,p=0;p<f;++p)(d=c[p]||l[p])&&(u[p]=d);for(;a<o;++a)s[a]=e[a];return new xt(s,this._parents,this._name,this._id)}function eu(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function nu(t,e,n){var o,r,i=eu(e)?wn:gt;return function(){var s=i(this,t),a=s.on;a!==o&&(r=(o=a).copy()).on(e,n),s.on=r}}function ou(t,e){var n=this._id;return arguments.length<2?ft(this.node(),n).on.on(t):this.each(nu(n,t,e))}function ru(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function iu(){return this.on("end.remove",ru(this._id))}function su(t){var e=this._name,n=this._id;typeof t!="function"&&(t=mn(t));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],c=a.length,l=i[s]=new Array(c),f,u,d=0;d<c;++d)(f=a[d])&&(u=t.call(f,f.__data__,d,a))&&("__data__"in f&&(u.__data__=f.__data__),l[d]=u,He(l[d],e,n,d,l,ft(f,n)));return new xt(i,this._parents,e,n)}function au(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Ro(t));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var c=o[a],l=c.length,f,u=0;u<l;++u)if(f=c[u]){for(var d=t.call(f,f.__data__,u,c),p,g=ft(f,n),w=0,y=d.length;w<y;++w)(p=d[w])&&He(p,e,n,w,d,g);i.push(d),s.push(f)}return new xt(i,s,e,n)}var cu=se.prototype.constructor;function uu(){return new cu(this._groups,this._parents)}function lu(t,e){var n,o,r;return function(){var i=Ht(this,t),s=(this.style.removeProperty(t),Ht(this,t));return i===s?null:i===n&&s===o?r:r=e(n=i,o=s)}}function ir(t){return function(){this.style.removeProperty(t)}}function du(t,e,n){var o,r=n+"",i;return function(){var s=Ht(this,t);return s===r?null:s===o?i:i=e(o=s,n)}}function fu(t,e,n){var o,r,i;return function(){var s=Ht(this,t),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(t),Ht(this,t))),s===c?null:s===o&&c===r?i:(r=c,i=e(o=s,a))}}function hu(t,e){var n,o,r,i="style."+e,s="end."+i,a;return function(){var c=gt(this,t),l=c.on,f=c.value[i]==null?a||(a=ir(e)):void 0;(l!==n||r!==f)&&(o=(n=l).copy()).on(s,r=f),c.on=o}}function gu(t,e,n){var o=(t+="")=="transform"?pc:rr;return e==null?this.styleTween(t,lu(t,o)).on("end.style."+t,ir(t)):typeof e=="function"?this.styleTween(t,fu(t,o,vn(this,"style."+t,e))).each(hu(this._id,t)):this.styleTween(t,du(t,o,e),n).on("end.style."+t,null)}function pu(t,e,n){return function(o){this.style.setProperty(t,e.call(this,o),n)}}function mu(t,e,n){var o,r;function i(){var s=e.apply(this,arguments);return s!==r&&(o=(r=s)&&pu(t,s,n)),o}return i._value=e,i}function yu(t,e,n){var o="style."+(t+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(e==null)return this.tween(o,null);if(typeof e!="function")throw new Error;return this.tween(o,mu(t,e,n??""))}function xu(t){return function(){this.textContent=t}}function wu(t){return function(){var e=t(this);this.textContent=e??""}}function vu(t){return this.tween("text",typeof t=="function"?wu(vn(this,"text",t)):xu(t==null?"":t+""))}function _u(t){return function(e){this.textContent=t.call(this,e)}}function bu(t){var e,n;function o(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&_u(r)),e}return o._value=t,o}function Eu(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,bu(t))}function Su(){for(var t=this._name,e=this._id,n=sr(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var f=ft(c,e);He(c,t,n,l,s,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new xt(o,this._parents,t,n)}function Nu(){var t,e,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},c={value:function(){--r===0&&i()}};n.each(function(){var l=gt(this,o),f=l.on;f!==t&&(e=(t=f).copy(),e._.cancel.push(a),e._.interrupt.push(a),e._.end.push(c)),l.on=e}),r===0&&i()})}var Cu=0;function xt(t,e,n,o){this._groups=t,this._parents=e,this._name=n,this._id=o}function sr(){return++Cu}var mt=se.prototype;xt.prototype={constructor:xt,select:su,selectAll:au,selectChild:mt.selectChild,selectChildren:mt.selectChildren,filter:Jc,merge:tu,selection:uu,transition:Su,call:mt.call,nodes:mt.nodes,node:mt.node,size:mt.size,empty:mt.empty,each:mt.each,on:ou,attr:Hc,attrTween:Oc,style:gu,styleTween:yu,text:vu,textTween:Eu,remove:iu,tween:kc,delay:jc,duration:qc,ease:Zc,easeVarying:Qc,end:Nu,[Symbol.iterator]:mt[Symbol.iterator]};function Mu(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var Iu={time:null,delay:0,duration:250,ease:Mu};function Au(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function ku(t){var e,n;t instanceof xt?(e=t._id,t=t._name):(e=sr(),(n=Iu).time=xn(),t=t==null?null:t+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&He(c,t,e,l,s,n||Au(c,e));return new xt(o,this._parents,t,e)}se.prototype.interrupt=Mc;se.prototype.transition=ku;const pe=t=>()=>t;function Pu(t,{sourceEvent:e,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function yt(t,e,n){this.k=t,this.x=e,this.y=n}yt.prototype={constructor:yt,scale:function(t){return t===1?this:new yt(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new yt(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Re=new yt(1,0,0);ar.prototype=yt.prototype;function ar(t){for(;!t.__zoom;)if(!(t=t.parentNode))return Re;return t.__zoom}function Ue(t){t.stopImmediatePropagation()}function Kt(t){t.preventDefault(),t.stopImmediatePropagation()}function $u(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function Tu(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function Zn(){return this.__zoom||Re}function zu(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Lu(){return navigator.maxTouchPoints||"ontouchstart"in this}function Du(t,e,n){var o=t.invertX(e[0][0])-n[0][0],r=t.invertX(e[1][0])-n[1][0],i=t.invertY(e[0][1])-n[0][1],s=t.invertY(e[1][1])-n[1][1];return t.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function cr(){var t=$u,e=Tu,n=Du,o=zu,r=Lu,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=_e,l=ze("start","zoom","end"),f,u,d,p=500,g=150,w=0,y=10;function m(v){v.property("__zoom",Zn).on("wheel.zoom",z,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",B).filter(r).on("touchstart.zoom",I).on("touchmove.zoom",P).on("touchend.zoom touchcancel.zoom",V).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(v,A,E,k){var M=v.selection?v.selection():v;M.property("__zoom",Zn),v!==M?N(v,A,E,k):M.interrupt().each(function(){b(this,arguments).event(k).start().zoom(null,typeof A=="function"?A.apply(this,arguments):A).end()})},m.scaleBy=function(v,A,E,k){m.scaleTo(v,function(){var M=this.__zoom.k,S=typeof A=="function"?A.apply(this,arguments):A;return M*S},E,k)},m.scaleTo=function(v,A,E,k){m.transform(v,function(){var M=e.apply(this,arguments),S=this.__zoom,D=E==null?x(M):typeof E=="function"?E.apply(this,arguments):E,R=S.invert(D),H=typeof A=="function"?A.apply(this,arguments):A;return n(h(_(S,H),D,R),M,s)},E,k)},m.translateBy=function(v,A,E,k){m.transform(v,function(){return n(this.__zoom.translate(typeof A=="function"?A.apply(this,arguments):A,typeof E=="function"?E.apply(this,arguments):E),e.apply(this,arguments),s)},null,k)},m.translateTo=function(v,A,E,k,M){m.transform(v,function(){var S=e.apply(this,arguments),D=this.__zoom,R=k==null?x(S):typeof k=="function"?k.apply(this,arguments):k;return n(Re.translate(R[0],R[1]).scale(D.k).translate(typeof A=="function"?-A.apply(this,arguments):-A,typeof E=="function"?-E.apply(this,arguments):-E),S,s)},k,M)};function _(v,A){return A=Math.max(i[0],Math.min(i[1],A)),A===v.k?v:new yt(A,v.x,v.y)}function h(v,A,E){var k=A[0]-E[0]*v.k,M=A[1]-E[1]*v.k;return k===v.x&&M===v.y?v:new yt(v.k,k,M)}function x(v){return[(+v[0][0]+ +v[1][0])/2,(+v[0][1]+ +v[1][1])/2]}function N(v,A,E,k){v.on("start.zoom",function(){b(this,arguments).event(k).start()}).on("interrupt.zoom end.zoom",function(){b(this,arguments).event(k).end()}).tween("zoom",function(){var M=this,S=arguments,D=b(M,S).event(k),R=e.apply(M,S),H=E==null?x(R):typeof E=="function"?E.apply(M,S):E,O=Math.max(R[1][0]-R[0][0],R[1][1]-R[0][1]),X=M.__zoom,j=typeof A=="function"?A.apply(M,S):A,K=c(X.invert(H).concat(O/X.k),j.invert(H).concat(O/j.k));return function(G){if(G===1)G=j;else{var F=K(G),W=O/F[2];G=new yt(W,H[0]-F[0]*W,H[1]-F[1]*W)}D.zoom(null,G)}})}function b(v,A,E){return!E&&v.__zooming||new C(v,A)}function C(v,A){this.that=v,this.args=A,this.active=0,this.sourceEvent=null,this.extent=e.apply(v,A),this.taps=0}C.prototype={event:function(v){return v&&(this.sourceEvent=v),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(v,A){return this.mouse&&v!=="mouse"&&(this.mouse[1]=A.invert(this.mouse[0])),this.touch0&&v!=="touch"&&(this.touch0[1]=A.invert(this.touch0[0])),this.touch1&&v!=="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(v){var A=at(this.that).datum();l.call(v,this.that,new Pu(v,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:l}),A)}};function z(v,...A){if(!t.apply(this,arguments))return;var E=b(this,A).event(v),k=this.__zoom,M=Math.max(i[0],Math.min(i[1],k.k*Math.pow(2,o.apply(this,arguments)))),S=ut(v);if(E.wheel)(E.mouse[0][0]!==S[0]||E.mouse[0][1]!==S[1])&&(E.mouse[1]=k.invert(E.mouse[0]=S)),clearTimeout(E.wheel);else{if(k.k===M)return;E.mouse=[S,k.invert(S)],Se(this),E.start()}Kt(v),E.wheel=setTimeout(D,g),E.zoom("mouse",n(h(_(k,M),E.mouse[0],E.mouse[1]),E.extent,s));function D(){E.wheel=null,E.end()}}function T(v,...A){if(d||!t.apply(this,arguments))return;var E=v.currentTarget,k=b(this,A,!0).event(v),M=at(v.view).on("mousemove.zoom",H,!0).on("mouseup.zoom",O,!0),S=ut(v,E),D=v.clientX,R=v.clientY;Ko(v.view),Ue(v),k.mouse=[S,this.__zoom.invert(S)],Se(this),k.start();function H(X){if(Kt(X),!k.moved){var j=X.clientX-D,K=X.clientY-R;k.moved=j*j+K*K>w}k.event(X).zoom("mouse",n(h(k.that.__zoom,k.mouse[0]=ut(X,E),k.mouse[1]),k.extent,s))}function O(X){M.on("mousemove.zoom mouseup.zoom",null),Zo(X.view,k.moved),Kt(X),k.event(X).end()}}function B(v,...A){if(t.apply(this,arguments)){var E=this.__zoom,k=ut(v.changedTouches?v.changedTouches[0]:v,this),M=E.invert(k),S=E.k*(v.shiftKey?.5:2),D=n(h(_(E,S),k,M),e.apply(this,A),s);Kt(v),a>0?at(this).transition().duration(a).call(N,D,k,v):at(this).call(m.transform,D,k,v)}}function I(v,...A){if(t.apply(this,arguments)){var E=v.touches,k=E.length,M=b(this,A,v.changedTouches.length===k).event(v),S,D,R,H;for(Ue(v),D=0;D<k;++D)R=E[D],H=ut(R,this),H=[H,this.__zoom.invert(H),R.identifier],M.touch0?!M.touch1&&M.touch0[2]!==H[2]&&(M.touch1=H,M.taps=0):(M.touch0=H,S=!0,M.taps=1+!!f);f&&(f=clearTimeout(f)),S&&(M.taps<2&&(u=H[0],f=setTimeout(function(){f=null},p)),Se(this),M.start())}}function P(v,...A){if(this.__zooming){var E=b(this,A).event(v),k=v.changedTouches,M=k.length,S,D,R,H;for(Kt(v),S=0;S<M;++S)D=k[S],R=ut(D,this),E.touch0&&E.touch0[2]===D.identifier?E.touch0[0]=R:E.touch1&&E.touch1[2]===D.identifier&&(E.touch1[0]=R);if(D=E.that.__zoom,E.touch1){var O=E.touch0[0],X=E.touch0[1],j=E.touch1[0],K=E.touch1[1],G=(G=j[0]-O[0])*G+(G=j[1]-O[1])*G,F=(F=K[0]-X[0])*F+(F=K[1]-X[1])*F;D=_(D,Math.sqrt(G/F)),R=[(O[0]+j[0])/2,(O[1]+j[1])/2],H=[(X[0]+K[0])/2,(X[1]+K[1])/2]}else if(E.touch0)R=E.touch0[0],H=E.touch0[1];else return;E.zoom("touch",n(h(D,R,H),E.extent,s))}}function V(v,...A){if(this.__zooming){var E=b(this,A).event(v),k=v.changedTouches,M=k.length,S,D;for(Ue(v),d&&clearTimeout(d),d=setTimeout(function(){d=null},p),S=0;S<M;++S)D=k[S],E.touch0&&E.touch0[2]===D.identifier?delete E.touch0:E.touch1&&E.touch1[2]===D.identifier&&delete E.touch1;if(E.touch1&&!E.touch0&&(E.touch0=E.touch1,delete E.touch1),E.touch0)E.touch0[1]=this.__zoom.invert(E.touch0[0]);else if(E.end(),E.taps===2&&(D=ut(D,this),Math.hypot(u[0]-D[0],u[1]-D[1])<y)){var R=at(this).on("dblclick.zoom");R&&R.apply(this,arguments)}}}return m.wheelDelta=function(v){return arguments.length?(o=typeof v=="function"?v:pe(+v),m):o},m.filter=function(v){return arguments.length?(t=typeof v=="function"?v:pe(!!v),m):t},m.touchable=function(v){return arguments.length?(r=typeof v=="function"?v:pe(!!v),m):r},m.extent=function(v){return arguments.length?(e=typeof v=="function"?v:pe([[+v[0][0],+v[0][1]],[+v[1][0],+v[1][1]]]),m):e},m.scaleExtent=function(v){return arguments.length?(i[0]=+v[0],i[1]=+v[1],m):[i[0],i[1]]},m.translateExtent=function(v){return arguments.length?(s[0][0]=+v[0][0],s[1][0]=+v[1][0],s[0][1]=+v[0][1],s[1][1]=+v[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(v){return arguments.length?(n=v,m):n},m.duration=function(v){return arguments.length?(a=+v,m):a},m.interpolate=function(v){return arguments.length?(c=v,m):c},m.on=function(){var v=l.on.apply(l,arguments);return v===l?m:v},m.clickDistance=function(v){return arguments.length?(w=(v=+v)*v,m):Math.sqrt(w)},m.tapDistance=function(v){return arguments.length?(y=+v,m):y},m}const ht={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:t=>`Node type "${t}" 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:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,{id:e,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${t} handle id: "${t==="source"?n:o}", edge id: ${e}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(t="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${t}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},ee=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],ur=["Enter"," ","Escape"],lr={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:t,x:e,y:n})=>`Moved selected node ${t}. New position, x: ${e}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Vt;(function(t){t.Strict="strict",t.Loose="loose"})(Vt||(Vt={}));var It;(function(t){t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal"})(It||(It={}));var ne;(function(t){t.Partial="partial",t.Full="full"})(ne||(ne={}));const dr={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Et;(function(t){t.Bezier="default",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t.SimpleBezier="simplebezier"})(Et||(Et={}));var Ae;(function(t){t.Arrow="arrow",t.ArrowClosed="arrowclosed"})(Ae||(Ae={}));var Y;(function(t){t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom"})(Y||(Y={}));const Un={[Y.Left]:Y.Right,[Y.Right]:Y.Left,[Y.Top]:Y.Bottom,[Y.Bottom]:Y.Top};function fr(t){return t===null?null:t?"valid":"invalid"}const hr=t=>"id"in t&&"source"in t&&"target"in t,Hu=t=>"id"in t&&"position"in t&&!("source"in t)&&!("target"in t),_n=t=>"id"in t&&"internals"in t&&!("source"in t)&&!("target"in t),ae=(t,e=[0,0])=>{const{width:n,height:o}=wt(t),r=t.origin??e,i=n*r[0],s=o*r[1];return{x:t.position.x-i,y:t.position.y-s}},Ru=(t,e={nodeOrigin:[0,0]})=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((o,r)=>{const i=typeof r=="string";let s=!e.nodeLookup&&!i?r:void 0;e.nodeLookup&&(s=i?e.nodeLookup.get(r):_n(r)?r:e.nodeLookup.get(r.id));const a=s?ke(s,e.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Ve(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Be(n)},ce=(t,e={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return t.forEach(r=>{(e.filter===void 0||e.filter(r))&&(n=Ve(n,ke(r)),o=!0)}),o?Be(n):{x:0,y:0,width:0,height:0}},bn=(t,e,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const a={...le(e,[n,o,r]),width:e.width/r,height:e.height/r},c=[];for(const l of t.values()){const{measured:f,selectable:u=!0,hidden:d=!1}=l;if(s&&!u||d)continue;const p=f.width??l.width??l.initialWidth??null,g=f.height??l.height??l.initialHeight??null,w=oe(a,Ft(l)),y=(p??0)*(g??0),m=i&&w>0;(!l.internals.handleBounds||m||w>=y||l.dragging)&&c.push(l)}return c},Vu=(t,e)=>{const n=new Set;return t.forEach(o=>{n.add(o.id)}),e.filter(o=>n.has(o.source)||n.has(o.target))};function Bu(t,e){const n=new Map,o=e!=null&&e.nodes?new Set(e.nodes.map(r=>r.id)):null;return t.forEach(r=>{r.measured.width&&r.measured.height&&((e==null?void 0:e.includeHiddenNodes)||!r.hidden)&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function Fu({nodes:t,width:e,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(t.size===0)return Promise.resolve(!0);const a=Bu(t,s),c=ce(a),l=En(c,e,n,(s==null?void 0:s.minZoom)??r,(s==null?void 0:s.maxZoom)??i,(s==null?void 0:s.padding)??.1);return await o.setViewport(l,{duration:s==null?void 0:s.duration,ease:s==null?void 0:s.ease,interpolate:s==null?void 0:s.interpolate}),Promise.resolve(!0)}function gr({nodeId:t,nextPosition:e,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(t),a=s.parentId?n.get(s.parentId):void 0,{x:c,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},f=s.origin??o;let u=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i==null||i("005",ht.error005());else{const p=a.measured.width,g=a.measured.height;p&&g&&(u=[[c,l],[c+p,l+g]])}else a&&Ot(s.extent)&&(u=[[s.extent[0][0]+c,s.extent[0][1]+l],[s.extent[1][0]+c,s.extent[1][1]+l]]);const d=Ot(u)?kt(e,u,s.measured):e;return(s.measured.width===void 0||s.measured.height===void 0)&&(i==null||i("015",ht.error015())),{position:{x:d.x-c+(s.measured.width??0)*f[0],y:d.y-l+(s.measured.height??0)*f[1]},positionAbsolute:d}}async function Ou({nodesToRemove:t=[],edgesToRemove:e=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(t.map(d=>d.id)),s=[];for(const d of n){if(d.deletable===!1)continue;const p=i.has(d.id),g=!p&&d.parentId&&s.find(w=>w.id===d.parentId);(p||g)&&s.push(d)}const a=new Set(e.map(d=>d.id)),c=o.filter(d=>d.deletable!==!1),f=Vu(s,c);for(const d of c)a.has(d.id)&&!f.find(g=>g.id===d.id)&&f.push(d);if(!r)return{edges:f,nodes:s};const u=await r({nodes:s,edges:f});return typeof u=="boolean"?u?{edges:f,nodes:s}:{edges:[],nodes:[]}:u}const Bt=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),kt=(t={x:0,y:0},e,n)=>({x:Bt(t.x,e[0][0],e[1][0]-((n==null?void 0:n.width)??0)),y:Bt(t.y,e[0][1],e[1][1]-((n==null?void 0:n.height)??0))});function pr(t,e,n){const{width:o,height:r}=wt(n),{x:i,y:s}=n.internals.positionAbsolute;return kt(t,[[i,s],[i+o,s+r]],e)}const Qn=(t,e,n)=>t<e?Bt(Math.abs(t-e),1,e)/e:t>n?-Bt(Math.abs(t-n),1,e)/e:0,mr=(t,e,n=15,o=40)=>{const r=Qn(t.x,o,e.width-o)*n,i=Qn(t.y,o,e.height-o)*n;return[r,i]},Ve=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}),ln=({x:t,y:e,width:n,height:o})=>({x:t,y:e,x2:t+n,y2:e+o}),Be=({x:t,y:e,x2:n,y2:o})=>({x:t,y:e,width:n-t,height:o-e}),Ft=(t,e=[0,0])=>{var r,i;const{x:n,y:o}=_n(t)?t.internals.positionAbsolute:ae(t,e);return{x:n,y:o,width:((r=t.measured)==null?void 0:r.width)??t.width??t.initialWidth??0,height:((i=t.measured)==null?void 0:i.height)??t.height??t.initialHeight??0}},ke=(t,e=[0,0])=>{var r,i;const{x:n,y:o}=_n(t)?t.internals.positionAbsolute:ae(t,e);return{x:n,y:o,x2:n+(((r=t.measured)==null?void 0:r.width)??t.width??t.initialWidth??0),y2:o+(((i=t.measured)==null?void 0:i.height)??t.height??t.initialHeight??0)}},yr=(t,e)=>Be(Ve(ln(t),ln(e))),oe=(t,e)=>{const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),o=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*o)},Jn=t=>lt(t.width)&&lt(t.height)&&lt(t.x)&&lt(t.y),lt=t=>!isNaN(t)&&isFinite(t),Xu=(t,e)=>{},ue=(t,e=[1,1])=>({x:e[0]*Math.round(t.x/e[0]),y:e[1]*Math.round(t.y/e[1])}),le=({x:t,y:e},[n,o,r],i=!1,s=[1,1])=>{const a={x:(t-n)/r,y:(e-o)/r};return i?ue(a,s):a},Pe=({x:t,y:e},[n,o,r])=>({x:t*r+n,y:e*r+o});function Tt(t,e){if(typeof t=="number")return Math.floor((e-e/(1+t))*.5);if(typeof t=="string"&&t.endsWith("px")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(n)}if(typeof t=="string"&&t.endsWith("%")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(e*n*.01)}return console.error(`[React Flow] The padding value "${t}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Yu(t,e,n){if(typeof t=="string"||typeof t=="number"){const o=Tt(t,n),r=Tt(t,e);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof t=="object"){const o=Tt(t.top??t.y??0,n),r=Tt(t.bottom??t.y??0,n),i=Tt(t.left??t.x??0,e),s=Tt(t.right??t.x??0,e);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function ju(t,e,n,o,r,i){const{x:s,y:a}=Pe(t,[e,n,o]),{x:c,y:l}=Pe({x:t.x+t.width,y:t.y+t.height},[e,n,o]),f=r-c,u=i-l;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(f),bottom:Math.floor(u)}}const En=(t,e,n,o,r,i)=>{const s=Yu(i,e,n),a=(e-s.x)/t.width,c=(n-s.y)/t.height,l=Math.min(a,c),f=Bt(l,o,r),u=t.x+t.width/2,d=t.y+t.height/2,p=e/2-u*f,g=n/2-d*f,w=ju(t,p,g,f,e,n),y={left:Math.min(w.left-s.left,0),top:Math.min(w.top-s.top,0),right:Math.min(w.right-s.right,0),bottom:Math.min(w.bottom-s.bottom,0)};return{x:p-y.left+y.right,y:g-y.top+y.bottom,zoom:f}},re=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0};function Ot(t){return t!=null&&t!=="parent"}function wt(t){var e,n;return{width:((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth??0,height:((n=t.measured)==null?void 0:n.height)??t.height??t.initialHeight??0}}function xr(t){var e,n;return(((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth)!==void 0&&(((n=t.measured)==null?void 0:n.height)??t.height??t.initialHeight)!==void 0}function wr(t,e={width:0,height:0},n,o,r){const i={...t},s=o.get(n);if(s){const a=s.origin||r;i.x+=s.internals.positionAbsolute.x-(e.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(e.height??0)*a[1]}return i}function to(t,e){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}function Wu(){let t,e;return{promise:new Promise((o,r)=>{t=o,e=r}),resolve:t,reject:e}}function Gu(t){return{...lr,...t||{}}}function Qt(t,{snapGrid:e=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=dt(t),a=le({x:i-((r==null?void 0:r.left)??0),y:s-((r==null?void 0:r.top)??0)},o),{x:c,y:l}=n?ue(a,e):a;return{xSnapped:c,ySnapped:l,...a}}const Sn=t=>({width:t.offsetWidth,height:t.offsetHeight}),vr=t=>{var e;return((e=t==null?void 0:t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},qu=["INPUT","SELECT","TEXTAREA"];function _r(t){var o,r;const e=((r=(o=t.composedPath)==null?void 0:o.call(t))==null?void 0:r[0])||t.target;return(e==null?void 0:e.nodeType)!==1?!1:qu.includes(e.nodeName)||e.hasAttribute("contenteditable")||!!e.closest(".nokey")}const br=t=>"clientX"in t,dt=(t,e)=>{var i,s;const n=br(t),o=n?t.clientX:(i=t.touches)==null?void 0:i[0].clientX,r=n?t.clientY:(s=t.touches)==null?void 0:s[0].clientY;return{x:o-((e==null?void 0:e.left)??0),y:r-((e==null?void 0:e.top)??0)}},eo=(t,e,n,o,r)=>{const i=e.querySelectorAll(`.${t}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:t,nodeId:r,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...Sn(s)}})};function Er({sourceX:t,sourceY:e,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const c=t*.125+r*.375+s*.375+n*.125,l=e*.125+i*.375+a*.375+o*.125,f=Math.abs(c-t),u=Math.abs(l-e);return[c,l,f,u]}function me(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function no({pos:t,x1:e,y1:n,x2:o,y2:r,c:i}){switch(t){case Y.Left:return[e-me(e-o,i),n];case Y.Right:return[e+me(o-e,i),n];case Y.Top:return[e,n-me(n-r,i)];case Y.Bottom:return[e,n+me(r-n,i)]}}function Sr({sourceX:t,sourceY:e,sourcePosition:n=Y.Bottom,targetX:o,targetY:r,targetPosition:i=Y.Top,curvature:s=.25}){const[a,c]=no({pos:n,x1:t,y1:e,x2:o,y2:r,c:s}),[l,f]=no({pos:i,x1:o,y1:r,x2:t,y2:e,c:s}),[u,d,p,g]=Er({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:f});return[`M${t},${e} C${a},${c} ${l},${f} ${o},${r}`,u,d,p,g]}function Nr({sourceX:t,sourceY:e,targetX:n,targetY:o}){const r=Math.abs(n-t)/2,i=n<t?n+r:n-r,s=Math.abs(o-e)/2,a=o<e?o+s:o-s;return[i,a,r,s]}function Ku({sourceNode:t,targetNode:e,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){if(i==="manual")return o;const s=r&&n?o+1e3:o,a=Math.max(t.parentId||r&&t.selected?t.internals.z:0,e.parentId||r&&e.selected?e.internals.z:0);return s+a}function Zu({sourceNode:t,targetNode:e,width:n,height:o,transform:r}){const i=Ve(ke(t),ke(e));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return oe(s,Be(i))>0}const Uu=({source:t,sourceHandle:e,target:n,targetHandle:o})=>`xy-edge__${t}${e||""}-${n}${o||""}`,Qu=(t,e)=>e.some(n=>n.source===t.source&&n.target===t.target&&(n.sourceHandle===t.sourceHandle||!n.sourceHandle&&!t.sourceHandle)&&(n.targetHandle===t.targetHandle||!n.targetHandle&&!t.targetHandle)),Ju=(t,e,n={})=>{if(!t.source||!t.target)return e;const o=n.getEdgeId||Uu;let r;return hr(t)?r={...t}:r={...t,id:o(t)},Qu(r,e)?e:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,e.concat(r))};function Cr({sourceX:t,sourceY:e,targetX:n,targetY:o}){const[r,i,s,a]=Nr({sourceX:t,sourceY:e,targetX:n,targetY:o});return[`M ${t},${e}L ${n},${o}`,r,i,s,a]}const oo={[Y.Left]:{x:-1,y:0},[Y.Right]:{x:1,y:0},[Y.Top]:{x:0,y:-1},[Y.Bottom]:{x:0,y:1}},tl=({source:t,sourcePosition:e=Y.Bottom,target:n})=>e===Y.Left||e===Y.Right?t.x<n.x?{x:1,y:0}:{x:-1,y:0}:t.y<n.y?{x:0,y:1}:{x:0,y:-1},ro=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function el({source:t,sourcePosition:e=Y.Bottom,target:n,targetPosition:o=Y.Top,center:r,offset:i,stepPosition:s}){const a=oo[e],c=oo[o],l={x:t.x+a.x*i,y:t.y+a.y*i},f={x:n.x+c.x*i,y:n.y+c.y*i},u=tl({source:l,sourcePosition:e,target:f}),d=u.x!==0?"x":"y",p=u[d];let g=[],w,y;const m={x:0,y:0},_={x:0,y:0},[,,h,x]=Nr({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(a[d]*c[d]===-1){d==="x"?(w=r.x??l.x+(f.x-l.x)*s,y=r.y??(l.y+f.y)/2):(w=r.x??(l.x+f.x)/2,y=r.y??l.y+(f.y-l.y)*s);const b=[{x:w,y:l.y},{x:w,y:f.y}],C=[{x:l.x,y},{x:f.x,y}];a[d]===p?g=d==="x"?b:C:g=d==="x"?C:b}else{const b=[{x:l.x,y:f.y}],C=[{x:f.x,y:l.y}];if(d==="x"?g=a.x===p?C:b:g=a.y===p?b:C,e===o){const P=Math.abs(t[d]-n[d]);if(P<=i){const V=Math.min(i-1,i-P);a[d]===p?m[d]=(l[d]>t[d]?-1:1)*V:_[d]=(f[d]>n[d]?-1:1)*V}}if(e!==o){const P=d==="x"?"y":"x",V=a[d]===c[P],v=l[P]>f[P],A=l[P]<f[P];(a[d]===1&&(!V&&v||V&&A)||a[d]!==1&&(!V&&A||V&&v))&&(g=d==="x"?b:C)}const z={x:l.x+m.x,y:l.y+m.y},T={x:f.x+_.x,y:f.y+_.y},B=Math.max(Math.abs(z.x-g[0].x),Math.abs(T.x-g[0].x)),I=Math.max(Math.abs(z.y-g[0].y),Math.abs(T.y-g[0].y));B>=I?(w=(z.x+T.x)/2,y=g[0].y):(w=g[0].x,y=(z.y+T.y)/2)}return[[t,{x:l.x+m.x,y:l.y+m.y},...g,{x:f.x+_.x,y:f.y+_.y},n],w,y,h,x]}function nl(t,e,n,o){const r=Math.min(ro(t,e)/2,ro(e,n)/2,o),{x:i,y:s}=e;if(t.x===i&&i===n.x||t.y===s&&s===n.y)return`L${i} ${s}`;if(t.y===s){const l=t.x<n.x?-1:1,f=t.y<n.y?1:-1;return`L ${i+r*l},${s}Q ${i},${s} ${i},${s+r*f}`}const a=t.x<n.x?1:-1,c=t.y<n.y?-1:1;return`L ${i},${s+r*c}Q ${i},${s} ${i+r*a},${s}`}function dn({sourceX:t,sourceY:e,sourcePosition:n=Y.Bottom,targetX:o,targetY:r,targetPosition:i=Y.Top,borderRadius:s=5,centerX:a,centerY:c,offset:l=20,stepPosition:f=.5}){const[u,d,p,g,w]=el({source:{x:t,y:e},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:c},offset:l,stepPosition:f});return[u.reduce((m,_,h)=>{let x="";return h>0&&h<u.length-1?x=nl(u[h-1],_,u[h+1],s):x=`${h===0?"M":"L"}${_.x} ${_.y}`,m+=x,m},""),d,p,g,w]}function io(t){var e;return t&&!!(t.internals.handleBounds||(e=t.handles)!=null&&e.length)&&!!(t.measured.width||t.width||t.initialWidth)}function ol(t){var u;const{sourceNode:e,targetNode:n}=t;if(!io(e)||!io(n))return null;const o=e.internals.handleBounds||so(e.handles),r=n.internals.handleBounds||so(n.handles),i=ao((o==null?void 0:o.source)??[],t.sourceHandle),s=ao(t.connectionMode===Vt.Strict?(r==null?void 0:r.target)??[]:((r==null?void 0:r.target)??[]).concat((r==null?void 0:r.source)??[]),t.targetHandle);if(!i||!s)return(u=t.onError)==null||u.call(t,"008",ht.error008(i?"target":"source",{id:t.id,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle})),null;const a=(i==null?void 0:i.position)||Y.Bottom,c=(s==null?void 0:s.position)||Y.Top,l=Pt(e,i,a),f=Pt(n,s,c);return{sourceX:l.x,sourceY:l.y,targetX:f.x,targetY:f.y,sourcePosition:a,targetPosition:c}}function so(t){if(!t)return null;const e=[],n=[];for(const o of t)o.width=o.width??1,o.height=o.height??1,o.type==="source"?e.push(o):o.type==="target"&&n.push(o);return{source:e,target:n}}function Pt(t,e,n=Y.Left,o=!1){const r=((e==null?void 0:e.x)??0)+t.internals.positionAbsolute.x,i=((e==null?void 0:e.y)??0)+t.internals.positionAbsolute.y,{width:s,height:a}=e??wt(t);if(o)return{x:r+s/2,y:i+a/2};switch((e==null?void 0:e.position)??n){case Y.Top:return{x:r+s/2,y:i};case Y.Right:return{x:r+s,y:i+a/2};case Y.Bottom:return{x:r+s/2,y:i+a};case Y.Left:return{x:r,y:i+a/2}}}function ao(t,e){return t&&(e?t.find(n=>n.id===e):t[0])||null}function fn(t,e){return t?typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(o=>`${o}=${t[o]}`).join("&")}`:""}function rl(t,{id:e,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return t.reduce((s,a)=>([a.markerStart||o,a.markerEnd||r].forEach(c=>{if(c&&typeof c=="object"){const l=fn(c,e);i.has(l)||(s.push({id:l,color:c.color||n,...c}),i.add(l))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const Mr=1e3,il=10,Nn={nodeOrigin:[0,0],nodeExtent:ee,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},sl={...Nn,checkEquality:!0};function Cn(t,e){const n={...t};for(const o in e)e[o]!==void 0&&(n[o]=e[o]);return n}function al(t,e,n){const o=Cn(Nn,n);for(const r of t.values())if(r.parentId)In(r,t,e,o);else{const i=ae(r,o.nodeOrigin),s=Ot(r.extent)?r.extent:o.nodeExtent,a=kt(i,s,wt(r));r.internals.positionAbsolute=a}}function cl(t,e){if(!t.handles)return t.measured?e==null?void 0:e.internals.handleBounds:void 0;const n=[],o=[];for(const r of t.handles){const i={id:r.id,width:r.width??1,height:r.height??1,nodeId:t.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(i):r.type==="target"&&o.push(i)}return{source:n,target:o}}function Mn(t){return t==="manual"}function hn(t,e,n,o={}){var l,f;const r=Cn(sl,o),i={i:0},s=new Map(e),a=r!=null&&r.elevateNodesOnSelect&&!Mn(r.zIndexMode)?Mr:0;let c=t.length>0;e.clear(),n.clear();for(const u of t){let d=s.get(u.id);if(r.checkEquality&&u===(d==null?void 0:d.internals.userNode))e.set(u.id,d);else{const p=ae(u,r.nodeOrigin),g=Ot(u.extent)?u.extent:r.nodeExtent,w=kt(p,g,wt(u));d={...r.defaults,...u,measured:{width:(l=u.measured)==null?void 0:l.width,height:(f=u.measured)==null?void 0:f.height},internals:{positionAbsolute:w,handleBounds:cl(u,d),z:Ir(u,a,r.zIndexMode),userNode:u}},e.set(u.id,d)}(d.measured===void 0||d.measured.width===void 0||d.measured.height===void 0)&&!d.hidden&&(c=!1),u.parentId&&In(d,e,n,o,i)}return c}function ul(t,e){if(!t.parentId)return;const n=e.get(t.parentId);n?n.set(t.id,t):e.set(t.parentId,new Map([[t.id,t]]))}function In(t,e,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:c}=Cn(Nn,o),l=t.parentId,f=e.get(l);if(!f){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}ul(t,n),r&&!f.parentId&&f.internals.rootParentIndex===void 0&&c==="auto"&&(f.internals.rootParentIndex=++r.i,f.internals.z=f.internals.z+r.i*il),r&&f.internals.rootParentIndex!==void 0&&(r.i=f.internals.rootParentIndex);const u=i&&!Mn(c)?Mr:0,{x:d,y:p,z:g}=ll(t,f,s,a,u,c),{positionAbsolute:w}=t.internals,y=d!==w.x||p!==w.y;(y||g!==t.internals.z)&&e.set(t.id,{...t,internals:{...t.internals,positionAbsolute:y?{x:d,y:p}:w,z:g}})}function Ir(t,e,n){const o=lt(t.zIndex)?t.zIndex:0;return Mn(n)?o:o+(t.selected?e:0)}function ll(t,e,n,o,r,i){const{x:s,y:a}=e.internals.positionAbsolute,c=wt(t),l=ae(t,n),f=Ot(t.extent)?kt(l,t.extent,c):l;let u=kt({x:s+f.x,y:a+f.y},o,c);t.extent==="parent"&&(u=pr(u,c,e));const d=Ir(t,r,i),p=e.internals.z??0;return{x:u.x,y:u.y,z:p>=d?p+1:d}}function An(t,e,n,o=[0,0]){var s;const r=[],i=new Map;for(const a of t){const c=e.get(a.parentId);if(!c)continue;const l=((s=i.get(a.parentId))==null?void 0:s.expandedRect)??Ft(c),f=yr(l,a.rect);i.set(a.parentId,{expandedRect:f,parent:c})}return i.size>0&&i.forEach(({expandedRect:a,parent:c},l)=>{var h;const f=c.internals.positionAbsolute,u=wt(c),d=c.origin??o,p=a.x<f.x?Math.round(Math.abs(f.x-a.x)):0,g=a.y<f.y?Math.round(Math.abs(f.y-a.y)):0,w=Math.max(u.width,Math.round(a.width)),y=Math.max(u.height,Math.round(a.height)),m=(w-u.width)*d[0],_=(y-u.height)*d[1];(p>0||g>0||m||_)&&(r.push({id:l,type:"position",position:{x:c.position.x-p+m,y:c.position.y-g+_}}),(h=n.get(l))==null||h.forEach(x=>{t.some(N=>N.id===x.id)||r.push({id:x.id,type:"position",position:{x:x.position.x+p,y:x.position.y+g}})})),(u.width<a.width||u.height<a.height||p||g)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:w+(p?d[0]*p-m:0),height:y+(g?d[1]*g-_:0)}})}),r}function dl(t,e,n,o,r,i,s){const a=o==null?void 0:o.querySelector(".xyflow__viewport");let c=!1;if(!a)return{changes:[],updatedInternals:c};const l=[],f=window.getComputedStyle(a),{m22:u}=new window.DOMMatrixReadOnly(f.transform),d=[];for(const p of t.values()){const g=e.get(p.id);if(!g)continue;if(g.hidden){e.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const w=Sn(p.nodeElement),y=g.measured.width!==w.width||g.measured.height!==w.height;if(!!(w.width&&w.height&&(y||!g.internals.handleBounds||p.force))){const _=p.nodeElement.getBoundingClientRect(),h=Ot(g.extent)?g.extent:i;let{positionAbsolute:x}=g.internals;g.parentId&&g.extent==="parent"?x=pr(x,w,e.get(g.parentId)):h&&(x=kt(x,h,w));const N={...g,measured:w,internals:{...g.internals,positionAbsolute:x,handleBounds:{source:eo("source",p.nodeElement,_,u,g.id),target:eo("target",p.nodeElement,_,u,g.id)}}};e.set(g.id,N),g.parentId&&In(N,e,n,{nodeOrigin:r,zIndexMode:s}),c=!0,y&&(l.push({id:g.id,type:"dimensions",dimensions:w}),g.expandParent&&g.parentId&&d.push({id:g.id,parentId:g.parentId,rect:Ft(N,r)}))}}if(d.length>0){const p=An(d,e,n,r);l.push(...p)}return{changes:l,updatedInternals:c}}async function fl({delta:t,panZoom:e,transform:n,translateExtent:o,width:r,height:i}){if(!e||!t.x&&!t.y)return Promise.resolve(!1);const s=await e.setViewportConstrained({x:n[0]+t.x,y:n[1]+t.y,zoom:n[2]},[[0,0],[r,i]],o),a=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(a)}function co(t,e,n,o,r,i){let s=r;const a=o.get(s)||new Map;o.set(s,a.set(n,e)),s=`${r}-${t}`;const c=o.get(s)||new Map;if(o.set(s,c.set(n,e)),i){s=`${r}-${t}-${i}`;const l=o.get(s)||new Map;o.set(s,l.set(n,e))}}function Ar(t,e,n){t.clear(),e.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,c={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},l=`${r}-${s}--${i}-${a}`,f=`${i}-${a}--${r}-${s}`;co("source",c,f,t,r,s),co("target",c,l,t,i,a),e.set(o.id,o)}}function kr(t,e){if(!t.parentId)return!1;const n=e.get(t.parentId);return n?n.selected?!0:kr(n,e):!1}function uo(t,e,n){var r;let o=t;do{if((r=o==null?void 0:o.matches)!=null&&r.call(o,e))return!0;if(o===n)return!1;o=o==null?void 0:o.parentElement}while(o);return!1}function hl(t,e,n,o){const r=new Map;for(const[i,s]of t)if((s.selected||s.id===o)&&(!s.parentId||!kr(s,t))&&(s.draggable||e&&typeof s.draggable>"u")){const a=t.get(i);a&&r.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function Qe({nodeId:t,dragItems:e,nodeLookup:n,dragging:o=!0}){var s,a,c;const r=[];for(const[l,f]of e){const u=(s=n.get(l))==null?void 0:s.internals.userNode;u&&r.push({...u,position:f.position,dragging:o})}if(!t)return[r[0],r];const i=(a=n.get(t))==null?void 0:a.internals.userNode;return[i?{...i,position:((c=e.get(t))==null?void 0:c.position)||i.position,dragging:o}:r[0],r]}function gl({dragItems:t,snapGrid:e,x:n,y:o}){const r=t.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},s=ue(i,e);return{x:s.x-i.x,y:s.y-i.y}}function pl({onNodeMouseDown:t,getStoreItems:e,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,c=!1,l={x:0,y:0},f=null,u=!1,d=null,p=!1,g=!1,w=null;function y({noDragClassName:_,handleSelector:h,domNode:x,isSelectable:N,nodeId:b,nodeClickDistance:C=0}){d=at(x);function z({x:P,y:V}){const{nodeLookup:v,nodeExtent:A,snapGrid:E,snapToGrid:k,nodeOrigin:M,onNodeDrag:S,onSelectionDrag:D,onError:R,updateNodePositions:H}=e();i={x:P,y:V};let O=!1;const X=a.size>1,j=X&&A?ln(ce(a)):null,K=X&&k?gl({dragItems:a,snapGrid:E,x:P,y:V}):null;for(const[G,F]of a){if(!v.has(G))continue;let W={x:P-F.distance.x,y:V-F.distance.y};k&&(W=K?{x:Math.round(W.x+K.x),y:Math.round(W.y+K.y)}:ue(W,E));let Q=null;if(X&&A&&!F.extent&&j){const{positionAbsolute:q}=F.internals,et=q.x-j.x+A[0][0],nt=q.x+F.measured.width-j.x2+A[1][0],tt=q.y-j.y+A[0][1],st=q.y+F.measured.height-j.y2+A[1][1];Q=[[et,tt],[nt,st]]}const{position:U,positionAbsolute:Z}=gr({nodeId:G,nextPosition:W,nodeLookup:v,nodeExtent:Q||A,nodeOrigin:M,onError:R});O=O||F.position.x!==U.x||F.position.y!==U.y,F.position=U,F.internals.positionAbsolute=Z}if(g=g||O,!!O&&(H(a,!0),w&&(o||S||!b&&D))){const[G,F]=Qe({nodeId:b,dragItems:a,nodeLookup:v});o==null||o(w,a,G,F),S==null||S(w,G,F),b||D==null||D(w,F)}}async function T(){if(!f)return;const{transform:P,panBy:V,autoPanSpeed:v,autoPanOnNodeDrag:A}=e();if(!A){c=!1,cancelAnimationFrame(s);return}const[E,k]=mr(l,f,v);(E!==0||k!==0)&&(i.x=(i.x??0)-E/P[2],i.y=(i.y??0)-k/P[2],await V({x:E,y:k})&&z(i)),s=requestAnimationFrame(T)}function B(P){var X;const{nodeLookup:V,multiSelectionActive:v,nodesDraggable:A,transform:E,snapGrid:k,snapToGrid:M,selectNodesOnDrag:S,onNodeDragStart:D,onSelectionDragStart:R,unselectNodesAndEdges:H}=e();u=!0,(!S||!N)&&!v&&b&&((X=V.get(b))!=null&&X.selected||H()),N&&S&&b&&(t==null||t(b));const O=Qt(P.sourceEvent,{transform:E,snapGrid:k,snapToGrid:M,containerBounds:f});if(i=O,a=hl(V,A,O,b),a.size>0&&(n||D||!b&&R)){const[j,K]=Qe({nodeId:b,dragItems:a,nodeLookup:V});n==null||n(P.sourceEvent,a,j,K),D==null||D(P.sourceEvent,j,K),b||R==null||R(P.sourceEvent,K)}}const I=Uo().clickDistance(C).on("start",P=>{const{domNode:V,nodeDragThreshold:v,transform:A,snapGrid:E,snapToGrid:k}=e();f=(V==null?void 0:V.getBoundingClientRect())||null,p=!1,g=!1,w=P.sourceEvent,v===0&&B(P),i=Qt(P.sourceEvent,{transform:A,snapGrid:E,snapToGrid:k,containerBounds:f}),l=dt(P.sourceEvent,f)}).on("drag",P=>{const{autoPanOnNodeDrag:V,transform:v,snapGrid:A,snapToGrid:E,nodeDragThreshold:k,nodeLookup:M}=e(),S=Qt(P.sourceEvent,{transform:v,snapGrid:A,snapToGrid:E,containerBounds:f});if(w=P.sourceEvent,(P.sourceEvent.type==="touchmove"&&P.sourceEvent.touches.length>1||b&&!M.has(b))&&(p=!0),!p){if(!c&&V&&u&&(c=!0,T()),!u){const D=dt(P.sourceEvent,f),R=D.x-l.x,H=D.y-l.y;Math.sqrt(R*R+H*H)>k&&B(P)}(i.x!==S.xSnapped||i.y!==S.ySnapped)&&a&&u&&(l=dt(P.sourceEvent,f),z(S))}}).on("end",P=>{if(!(!u||p)&&(c=!1,u=!1,cancelAnimationFrame(s),a.size>0)){const{nodeLookup:V,updateNodePositions:v,onNodeDragStop:A,onSelectionDragStop:E}=e();if(g&&(v(a,!1),g=!1),r||A||!b&&E){const[k,M]=Qe({nodeId:b,dragItems:a,nodeLookup:V,dragging:!1});r==null||r(P.sourceEvent,a,k,M),A==null||A(P.sourceEvent,k,M),b||E==null||E(P.sourceEvent,M)}}}).filter(P=>{const V=P.target;return!P.button&&(!_||!uo(V,`.${_}`,x))&&(!h||uo(V,h,x))});d.call(I)}function m(){d==null||d.on(".drag",null)}return{update:y,destroy:m}}function ml(t,e,n){const o=[],r={x:t.x-n,y:t.y-n,width:n*2,height:n*2};for(const i of e.values())oe(r,Ft(i))>0&&o.push(i);return o}const yl=250;function xl(t,e,n,o){var a,c;let r=[],i=1/0;const s=ml(t,n,e+yl);for(const l of s){const f=[...((a=l.internals.handleBounds)==null?void 0:a.source)??[],...((c=l.internals.handleBounds)==null?void 0:c.target)??[]];for(const u of f){if(o.nodeId===u.nodeId&&o.type===u.type&&o.id===u.id)continue;const{x:d,y:p}=Pt(l,u,u.position,!0),g=Math.sqrt(Math.pow(d-t.x,2)+Math.pow(p-t.y,2));g>e||(g<i?(r=[{...u,x:d,y:p}],i=g):g===i&&r.push({...u,x:d,y:p}))}}if(!r.length)return null;if(r.length>1){const l=o.type==="source"?"target":"source";return r.find(f=>f.type===l)??r[0]}return r[0]}function Pr(t,e,n,o,r,i=!1){var l,f,u;const s=o.get(t);if(!s)return null;const a=r==="strict"?(l=s.internals.handleBounds)==null?void 0:l[e]:[...((f=s.internals.handleBounds)==null?void 0:f.source)??[],...((u=s.internals.handleBounds)==null?void 0:u.target)??[]],c=(n?a==null?void 0:a.find(d=>d.id===n):a==null?void 0:a[0])??null;return c&&i?{...c,...Pt(s,c,c.position,!0)}:c}function $r(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function wl(t,e){let n=null;return e?n=!0:t&&!e&&(n=!1),n}const Tr=()=>!0;function vl(t,{connectionMode:e,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:c,lib:l,autoPanOnConnect:f,flowId:u,panBy:d,cancelConnection:p,onConnectStart:g,onConnect:w,onConnectEnd:y,isValidConnection:m=Tr,onReconnectEnd:_,updateConnection:h,getTransform:x,getFromHandle:N,autoPanSpeed:b,dragThreshold:C=1,handleDomNode:z}){const T=vr(t.target);let B=0,I;const{x:P,y:V}=dt(t),v=$r(i,z),A=a==null?void 0:a.getBoundingClientRect();let E=!1;if(!A||!v)return;const k=Pr(r,v,o,c,e);if(!k)return;let M=dt(t,A),S=!1,D=null,R=!1,H=null;function O(){if(!f||!A)return;const[U,Z]=mr(M,A,b);d({x:U,y:Z}),B=requestAnimationFrame(O)}const X={...k,nodeId:r,type:v,position:k.position},j=c.get(r);let G={inProgress:!0,isValid:null,from:Pt(j,X,Y.Left,!0),fromHandle:X,fromPosition:X.position,fromNode:j,to:M,toHandle:null,toPosition:Un[X.position],toNode:null,pointer:M};function F(){E=!0,h(G),g==null||g(t,{nodeId:r,handleId:o,handleType:v})}C===0&&F();function W(U){if(!E){const{x:st,y:vt}=dt(U),pt=st-P,Nt=vt-V;if(!(pt*pt+Nt*Nt>C*C))return;F()}if(!N()||!X){Q(U);return}const Z=x();M=dt(U,A),I=xl(le(M,Z,!1,[1,1]),n,c,X),S||(O(),S=!0);const q=zr(U,{handle:I,connectionMode:e,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:m,doc:T,lib:l,flowId:u,nodeLookup:c});H=q.handleDomNode,D=q.connection,R=wl(!!I,q.isValid);const et=c.get(r),nt=et?Pt(et,X,Y.Left,!0):G.from,tt={...G,from:nt,isValid:R,to:q.toHandle&&R?Pe({x:q.toHandle.x,y:q.toHandle.y},Z):M,toHandle:q.toHandle,toPosition:R&&q.toHandle?q.toHandle.position:Un[X.position],toNode:q.toHandle?c.get(q.toHandle.nodeId):null,pointer:M};h(tt),G=tt}function Q(U){if(!("touches"in U&&U.touches.length>0)){if(E){(I||H)&&D&&R&&(w==null||w(D));const{inProgress:Z,...q}=G,et={...q,toPosition:G.toHandle?G.toPosition:null};y==null||y(U,et),i&&(_==null||_(U,et))}p(),cancelAnimationFrame(B),S=!1,R=!1,D=null,H=null,T.removeEventListener("mousemove",W),T.removeEventListener("mouseup",Q),T.removeEventListener("touchmove",W),T.removeEventListener("touchend",Q)}}T.addEventListener("mousemove",W),T.addEventListener("mouseup",Q),T.addEventListener("touchmove",W),T.addEventListener("touchend",Q)}function zr(t,{handle:e,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:l=Tr,nodeLookup:f}){const u=i==="target",d=e?s.querySelector(`.${a}-flow__handle[data-id="${c}-${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`):null,{x:p,y:g}=dt(t),w=s.elementFromPoint(p,g),y=w!=null&&w.classList.contains(`${a}-flow__handle`)?w:d,m={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const _=$r(void 0,y),h=y.getAttribute("data-nodeid"),x=y.getAttribute("data-handleid"),N=y.classList.contains("connectable"),b=y.classList.contains("connectableend");if(!h||!_)return m;const C={source:u?h:o,sourceHandle:u?x:r,target:u?o:h,targetHandle:u?r:x};m.connection=C;const T=N&&b&&(n===Vt.Strict?u&&_==="source"||!u&&_==="target":h!==o||x!==r);m.isValid=T&&l(C),m.toHandle=Pr(h,_,x,f,n,!0)}return m}const gn={onPointerDown:vl,isValid:zr};function _l({domNode:t,panZoom:e,getTransform:n,getViewScale:o}){const r=at(t);function i({translateExtent:a,width:c,height:l,zoomStep:f=1,pannable:u=!0,zoomable:d=!0,inversePan:p=!1}){const g=h=>{if(h.sourceEvent.type!=="wheel"||!e)return;const x=n(),N=h.sourceEvent.ctrlKey&&re()?10:1,b=-h.sourceEvent.deltaY*(h.sourceEvent.deltaMode===1?.05:h.sourceEvent.deltaMode?1:.002)*f,C=x[2]*Math.pow(2,b*N);e.scaleTo(C)};let w=[0,0];const y=h=>{(h.sourceEvent.type==="mousedown"||h.sourceEvent.type==="touchstart")&&(w=[h.sourceEvent.clientX??h.sourceEvent.touches[0].clientX,h.sourceEvent.clientY??h.sourceEvent.touches[0].clientY])},m=h=>{const x=n();if(h.sourceEvent.type!=="mousemove"&&h.sourceEvent.type!=="touchmove"||!e)return;const N=[h.sourceEvent.clientX??h.sourceEvent.touches[0].clientX,h.sourceEvent.clientY??h.sourceEvent.touches[0].clientY],b=[N[0]-w[0],N[1]-w[1]];w=N;const C=o()*Math.max(x[2],Math.log(x[2]))*(p?-1:1),z={x:x[0]-b[0]*C,y:x[1]-b[1]*C},T=[[0,0],[c,l]];e.setViewportConstrained({x:z.x,y:z.y,zoom:x[2]},T,a)},_=cr().on("start",y).on("zoom",u?m:null).on("zoom.wheel",d?g:null);r.call(_,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:ut}}const Fe=t=>({x:t.x,y:t.y,zoom:t.k}),Je=({x:t,y:e,zoom:n})=>Re.translate(t,e).scale(n),zt=(t,e)=>t.target.closest(`.${e}`),Lr=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),bl=t=>((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2,tn=(t,e=0,n=bl,o=()=>{})=>{const r=typeof e=="number"&&e>0;return r||o(),r?t.transition().duration(e).ease(n).on("end",o):t},Dr=t=>{const e=t.ctrlKey&&re()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e};function El({zoomPanValues:t,noWheelClassName:e,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:l}){return f=>{if(zt(f,e))return f.ctrlKey&&f.preventDefault(),!1;f.preventDefault(),f.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(f.ctrlKey&&s){const y=ut(f),m=Dr(f),_=u*Math.pow(2,m);o.scaleTo(n,_,y,f);return}const d=f.deltaMode===1?20:1;let p=r===It.Vertical?0:f.deltaX*d,g=r===It.Horizontal?0:f.deltaY*d;!re()&&f.shiftKey&&r!==It.Vertical&&(p=f.deltaY*d,g=0),o.translateBy(n,-(p/u)*i,-(g/u)*i,{internal:!0});const w=Fe(n.property("__zoom"));clearTimeout(t.panScrollTimeout),t.isPanScrolling?(c==null||c(f,w),t.panScrollTimeout=setTimeout(()=>{l==null||l(f,w),t.isPanScrolling=!1},150)):(t.isPanScrolling=!0,a==null||a(f,w))}}function Sl({noWheelClassName:t,preventScrolling:e,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!e&&i&&!o.ctrlKey,a=zt(o,t);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function Nl({zoomPanValues:t,onDraggingChange:e,onPanZoomStart:n}){return o=>{var i,s,a;if((i=o.sourceEvent)!=null&&i.internal)return;const r=Fe(o.transform);t.mouseButton=((s=o.sourceEvent)==null?void 0:s.button)||0,t.isZoomingOrPanning=!0,t.prevViewport=r,((a=o.sourceEvent)==null?void 0:a.type)==="mousedown"&&e(!0),n&&(n==null||n(o.sourceEvent,r))}}function Cl({zoomPanValues:t,panOnDrag:e,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{var s,a;t.usedRightMouseButton=!!(n&&Lr(e,t.mouseButton??0)),(s=i.sourceEvent)!=null&&s.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!((a=i.sourceEvent)!=null&&a.internal)&&(r==null||r(i.sourceEvent,Fe(i.transform)))}}function Ml({zoomPanValues:t,panOnDrag:e,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{var a;if(!((a=s.sourceEvent)!=null&&a.internal)&&(t.isZoomingOrPanning=!1,i&&Lr(e,t.mouseButton??0)&&!t.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),t.usedRightMouseButton=!1,o(!1),r)){const c=Fe(s.transform);t.prevViewport=c,clearTimeout(t.timerId),t.timerId=setTimeout(()=>{r==null||r(s.sourceEvent,c)},n?150:0)}}}function Il({zoomActivationKeyPressed:t,zoomOnScroll:e,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:c,lib:l,connectionInProgress:f}){return u=>{var y;const d=t||e,p=n&&u.ctrlKey,g=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(zt(u,`${l}-flow__node`)||zt(u,`${l}-flow__edge`)))return!0;if(!o&&!d&&!r&&!i&&!n||s||f&&!g||zt(u,a)&&g||zt(u,c)&&(!g||r&&g&&!t)||!n&&u.ctrlKey&&g)return!1;if(!n&&u.type==="touchstart"&&((y=u.touches)==null?void 0:y.length)>1)return u.preventDefault(),!1;if(!d&&!r&&!p&&g||!o&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(o)&&!o.includes(u.button)&&u.type==="mousedown")return!1;const w=Array.isArray(o)&&o.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||g)&&w}}function Al({domNode:t,minZoom:e,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:c}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=t.getBoundingClientRect(),u=cr().scaleExtent([e,n]).translateExtent(o),d=at(t).call(u);_({x:r.x,y:r.y,zoom:Bt(r.zoom,e,n)},[[0,0],[f.width,f.height]],o);const p=d.on("wheel.zoom"),g=d.on("dblclick.zoom");u.wheelDelta(Dr);function w(I,P){return d?new Promise(V=>{u==null||u.interpolate((P==null?void 0:P.interpolate)==="linear"?Ke:_e).transform(tn(d,P==null?void 0:P.duration,P==null?void 0:P.ease,()=>V(!0)),I)}):Promise.resolve(!1)}function y({noWheelClassName:I,noPanClassName:P,onPaneContextMenu:V,userSelectionActive:v,panOnScroll:A,panOnDrag:E,panOnScrollMode:k,panOnScrollSpeed:M,preventScrolling:S,zoomOnPinch:D,zoomOnScroll:R,zoomOnDoubleClick:H,zoomActivationKeyPressed:O,lib:X,onTransformChange:j,connectionInProgress:K,paneClickDistance:G,selectionOnDrag:F}){v&&!l.isZoomingOrPanning&&m();const W=A&&!O&&!v;u.clickDistance(F?1/0:!lt(G)||G<0?0:G);const Q=W?El({zoomPanValues:l,noWheelClassName:I,d3Selection:d,d3Zoom:u,panOnScrollMode:k,panOnScrollSpeed:M,zoomOnPinch:D,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):Sl({noWheelClassName:I,preventScrolling:S,d3ZoomHandler:p});if(d.on("wheel.zoom",Q,{passive:!1}),!v){const Z=Nl({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:s});u.on("start",Z);const q=Cl({zoomPanValues:l,panOnDrag:E,onPaneContextMenu:!!V,onPanZoom:i,onTransformChange:j});u.on("zoom",q);const et=Ml({zoomPanValues:l,panOnDrag:E,panOnScroll:A,onPaneContextMenu:V,onPanZoomEnd:a,onDraggingChange:c});u.on("end",et)}const U=Il({zoomActivationKeyPressed:O,panOnDrag:E,zoomOnScroll:R,panOnScroll:A,zoomOnDoubleClick:H,zoomOnPinch:D,userSelectionActive:v,noPanClassName:P,noWheelClassName:I,lib:X,connectionInProgress:K});u.filter(U),H?d.on("dblclick.zoom",g):d.on("dblclick.zoom",null)}function m(){u.on("zoom",null)}async function _(I,P,V){const v=Je(I),A=u==null?void 0:u.constrain()(v,P,V);return A&&await w(A),new Promise(E=>E(A))}async function h(I,P){const V=Je(I);return await w(V,P),new Promise(v=>v(V))}function x(I){if(d){const P=Je(I),V=d.property("__zoom");(V.k!==I.zoom||V.x!==I.x||V.y!==I.y)&&(u==null||u.transform(d,P,null,{sync:!0}))}}function N(){const I=d?ar(d.node()):{x:0,y:0,k:1};return{x:I.x,y:I.y,zoom:I.k}}function b(I,P){return d?new Promise(V=>{u==null||u.interpolate((P==null?void 0:P.interpolate)==="linear"?Ke:_e).scaleTo(tn(d,P==null?void 0:P.duration,P==null?void 0:P.ease,()=>V(!0)),I)}):Promise.resolve(!1)}function C(I,P){return d?new Promise(V=>{u==null||u.interpolate((P==null?void 0:P.interpolate)==="linear"?Ke:_e).scaleBy(tn(d,P==null?void 0:P.duration,P==null?void 0:P.ease,()=>V(!0)),I)}):Promise.resolve(!1)}function z(I){u==null||u.scaleExtent(I)}function T(I){u==null||u.translateExtent(I)}function B(I){const P=!lt(I)||I<0?0:I;u==null||u.clickDistance(P)}return{update:y,destroy:m,setViewport:h,setViewportConstrained:_,getViewport:N,scaleTo:b,scaleBy:C,setScaleExtent:z,setTranslateExtent:T,syncViewport:x,setClickDistance:B}}var Xt;(function(t){t.Line="line",t.Handle="handle"})(Xt||(Xt={}));function kl({width:t,prevWidth:e,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=t-e,a=n-o,c=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(c[0]=c[0]*-1),a&&i&&(c[1]=c[1]*-1),c}function lo(t){const e=t.includes("right")||t.includes("left"),n=t.includes("bottom")||t.includes("top"),o=t.includes("left"),r=t.includes("top");return{isHorizontal:e,isVertical:n,affectsX:o,affectsY:r}}function _t(t,e){return Math.max(0,e-t)}function bt(t,e){return Math.max(0,t-e)}function ye(t,e,n){return Math.max(0,e-t,t-n)}function fo(t,e){return t?!e:e}function Pl(t,e,n,o,r,i,s,a){let{affectsX:c,affectsY:l}=e;const{isHorizontal:f,isVertical:u}=e,d=f&&u,{xSnapped:p,ySnapped:g}=n,{minWidth:w,maxWidth:y,minHeight:m,maxHeight:_}=o,{x:h,y:x,width:N,height:b,aspectRatio:C}=t;let z=Math.floor(f?p-t.pointerX:0),T=Math.floor(u?g-t.pointerY:0);const B=N+(c?-z:z),I=b+(l?-T:T),P=-i[0]*N,V=-i[1]*b;let v=ye(B,w,y),A=ye(I,m,_);if(s){let M=0,S=0;c&&z<0?M=_t(h+z+P,s[0][0]):!c&&z>0&&(M=bt(h+B+P,s[1][0])),l&&T<0?S=_t(x+T+V,s[0][1]):!l&&T>0&&(S=bt(x+I+V,s[1][1])),v=Math.max(v,M),A=Math.max(A,S)}if(a){let M=0,S=0;c&&z>0?M=bt(h+z,a[0][0]):!c&&z<0&&(M=_t(h+B,a[1][0])),l&&T>0?S=bt(x+T,a[0][1]):!l&&T<0&&(S=_t(x+I,a[1][1])),v=Math.max(v,M),A=Math.max(A,S)}if(r){if(f){const M=ye(B/C,m,_)*C;if(v=Math.max(v,M),s){let S=0;!c&&!l||c&&!l&&d?S=bt(x+V+B/C,s[1][1])*C:S=_t(x+V+(c?z:-z)/C,s[0][1])*C,v=Math.max(v,S)}if(a){let S=0;!c&&!l||c&&!l&&d?S=_t(x+B/C,a[1][1])*C:S=bt(x+(c?z:-z)/C,a[0][1])*C,v=Math.max(v,S)}}if(u){const M=ye(I*C,w,y)/C;if(A=Math.max(A,M),s){let S=0;!c&&!l||l&&!c&&d?S=bt(h+I*C+P,s[1][0])/C:S=_t(h+(l?T:-T)*C+P,s[0][0])/C,A=Math.max(A,S)}if(a){let S=0;!c&&!l||l&&!c&&d?S=_t(h+I*C,a[1][0])/C:S=bt(h+(l?T:-T)*C,a[0][0])/C,A=Math.max(A,S)}}}T=T+(T<0?A:-A),z=z+(z<0?v:-v),r&&(d?B>I*C?T=(fo(c,l)?-z:z)/C:z=(fo(c,l)?-T:T)*C:f?(T=z/C,l=c):(z=T*C,c=l));const E=c?h+z:h,k=l?x+T:x;return{width:N+(c?-z:z),height:b+(l?-T:T),x:i[0]*z*(c?-1:1)+E,y:i[1]*T*(l?-1:1)+k}}const Hr={width:0,height:0,x:0,y:0},$l={...Hr,pointerX:0,pointerY:0,aspectRatio:1};function Tl(t){return[[0,0],[t.measured.width,t.measured.height]]}function zl(t,e,n){const o=e.position.x+t.position.x,r=e.position.y+t.position.y,i=t.measured.width??0,s=t.measured.height??0,a=n[0]*i,c=n[1]*s;return[[o-a,r-c],[o+i-a,r+s-c]]}function Ll({domNode:t,nodeId:e,getStoreItems:n,onChange:o,onEnd:r}){const i=at(t);let s={controlDirection:lo("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:l,boundaries:f,keepAspectRatio:u,resizeDirection:d,onResizeStart:p,onResize:g,onResizeEnd:w,shouldResize:y}){let m={...Hr},_={...$l};s={boundaries:f,resizeDirection:d,keepAspectRatio:u,controlDirection:lo(l)};let h,x=null,N=[],b,C,z,T=!1;const B=Uo().on("start",I=>{const{nodeLookup:P,transform:V,snapGrid:v,snapToGrid:A,nodeOrigin:E,paneDomNode:k}=n();if(h=P.get(e),!h)return;x=(k==null?void 0:k.getBoundingClientRect())??null;const{xSnapped:M,ySnapped:S}=Qt(I.sourceEvent,{transform:V,snapGrid:v,snapToGrid:A,containerBounds:x});m={width:h.measured.width??0,height:h.measured.height??0,x:h.position.x??0,y:h.position.y??0},_={...m,pointerX:M,pointerY:S,aspectRatio:m.width/m.height},b=void 0,h.parentId&&(h.extent==="parent"||h.expandParent)&&(b=P.get(h.parentId),C=b&&h.extent==="parent"?Tl(b):void 0),N=[],z=void 0;for(const[D,R]of P)if(R.parentId===e&&(N.push({id:D,position:{...R.position},extent:R.extent}),R.extent==="parent"||R.expandParent)){const H=zl(R,h,R.origin??E);z?z=[[Math.min(H[0][0],z[0][0]),Math.min(H[0][1],z[0][1])],[Math.max(H[1][0],z[1][0]),Math.max(H[1][1],z[1][1])]]:z=H}p==null||p(I,{...m})}).on("drag",I=>{const{transform:P,snapGrid:V,snapToGrid:v,nodeOrigin:A}=n(),E=Qt(I.sourceEvent,{transform:P,snapGrid:V,snapToGrid:v,containerBounds:x}),k=[];if(!h)return;const{x:M,y:S,width:D,height:R}=m,H={},O=h.origin??A,{width:X,height:j,x:K,y:G}=Pl(_,s.controlDirection,E,s.boundaries,s.keepAspectRatio,O,C,z),F=X!==D,W=j!==R,Q=K!==M&&F,U=G!==S&&W;if(!Q&&!U&&!F&&!W)return;if((Q||U||O[0]===1||O[1]===1)&&(H.x=Q?K:m.x,H.y=U?G:m.y,m.x=H.x,m.y=H.y,N.length>0)){const nt=K-M,tt=G-S;for(const st of N)st.position={x:st.position.x-nt+O[0]*(X-D),y:st.position.y-tt+O[1]*(j-R)},k.push(st)}if((F||W)&&(H.width=F&&(!s.resizeDirection||s.resizeDirection==="horizontal")?X:m.width,H.height=W&&(!s.resizeDirection||s.resizeDirection==="vertical")?j:m.height,m.width=H.width,m.height=H.height),b&&h.expandParent){const nt=O[0]*(H.width??0);H.x&&H.x<nt&&(m.x=nt,_.x=_.x-(H.x-nt));const tt=O[1]*(H.height??0);H.y&&H.y<tt&&(m.y=tt,_.y=_.y-(H.y-tt))}const Z=kl({width:m.width,prevWidth:D,height:m.height,prevHeight:R,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),q={...m,direction:Z};(y==null?void 0:y(I,q))!==!1&&(T=!0,g==null||g(I,q),o(H,k))}).on("end",I=>{T&&(w==null||w(I,{...m}),r==null||r({...m}),T=!1)});i.call(B)}function c(){i.on(".drag",null)}return{update:a,destroy:c}}const Dl={},ho=t=>{let e;const n=new Set,o=(f,u)=>{const d=typeof f=="function"?f(e):f;if(!Object.is(d,e)){const p=e;e=u??(typeof d!="object"||d===null)?d:Object.assign({},e,d),n.forEach(g=>g(e,p))}},r=()=>e,c={setState:o,getState:r,getInitialState:()=>l,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(Dl?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},l=e=t(o,r,c);return c},Hl=t=>t?ho(t):ho,{useDebugValue:Rl}=bs,{useSyncExternalStoreWithSelector:Vl}=Ss,Bl=t=>t;function Rr(t,e=Bl,n){const o=Vl(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return Rl(o),o}const go=(t,e)=>{const n=Hl(t),o=(r,i=e)=>Rr(n,r,i);return Object.assign(o,n),o},Fl=(t,e)=>t?go(t,e):go;function ot(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[o,r]of t)if(!Object.is(r,e.get(o)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const o of t)if(!e.has(o))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(e,o)||!Object.is(t[o],e[o]))return!1;return!0}const Oe=L.createContext(null),Ol=Oe.Provider,Vr=ht.error001();function J(t,e){const n=L.useContext(Oe);if(n===null)throw new Error(Vr);return Rr(n,t,e)}function rt(){const t=L.useContext(Oe);if(t===null)throw new Error(Vr);return L.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe}),[t])}const po={display:"none"},Xl={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Br="react-flow__node-desc",Fr="react-flow__edge-desc",Yl="react-flow__aria-live",jl=t=>t.ariaLiveMessage,Wl=t=>t.ariaLabelConfig;function Gl({rfId:t}){const e=J(jl);return $.jsx("div",{id:`${Yl}-${t}`,"aria-live":"assertive","aria-atomic":"true",style:Xl,children:e})}function ql({rfId:t,disableKeyboardA11y:e}){const n=J(Wl);return $.jsxs($.Fragment,{children:[$.jsx("div",{id:`${Br}-${t}`,style:po,children:e?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),$.jsx("div",{id:`${Fr}-${t}`,style:po,children:n["edge.a11yDescription.default"]}),!e&&$.jsx(Gl,{rfId:t})]})}const Xe=L.forwardRef(({position:t="top-left",children:e,className:n,style:o,...r},i)=>{const s=`${t}`.split("-");return $.jsx("div",{className:it(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:e})});Xe.displayName="Panel";function Kl({proOptions:t,position:e="bottom-right"}){return t!=null&&t.hideAttribution?null:$.jsx(Xe,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:$.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Zl=t=>{const e=[],n=[];for(const[,o]of t.nodeLookup)o.selected&&e.push(o.internals.userNode);for(const[,o]of t.edgeLookup)o.selected&&n.push(o);return{selectedNodes:e,selectedEdges:n}},xe=t=>t.id;function Ul(t,e){return ot(t.selectedNodes.map(xe),e.selectedNodes.map(xe))&&ot(t.selectedEdges.map(xe),e.selectedEdges.map(xe))}function Ql({onSelectionChange:t}){const e=rt(),{selectedNodes:n,selectedEdges:o}=J(Zl,Ul);return L.useEffect(()=>{const r={nodes:n,edges:o};t==null||t(r),e.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,t]),null}const Jl=t=>!!t.onSelectionChangeHandlers;function td({onSelectionChange:t}){const e=J(Jl);return t||e?$.jsx(Ql,{onSelectionChange:t}):null}const Or=[0,0],ed={x:0,y:0,zoom:1},nd=["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"],mo=[...nd,"rfId"],od=t=>({setNodes:t.setNodes,setEdges:t.setEdges,setMinZoom:t.setMinZoom,setMaxZoom:t.setMaxZoom,setTranslateExtent:t.setTranslateExtent,setNodeExtent:t.setNodeExtent,reset:t.reset,setDefaultNodesAndEdges:t.setDefaultNodesAndEdges}),yo={translateExtent:ee,nodeOrigin:Or,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function rd(t){const{setNodes:e,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:c}=J(od,ot),l=rt();L.useEffect(()=>(c(t.defaultNodes,t.defaultEdges),()=>{f.current=yo,a()}),[]);const f=L.useRef(yo);return L.useEffect(()=>{for(const u of mo){const d=t[u],p=f.current[u];d!==p&&(typeof t[u]>"u"||(u==="nodes"?e(d):u==="edges"?n(d):u==="minZoom"?o(d):u==="maxZoom"?r(d):u==="translateExtent"?i(d):u==="nodeExtent"?s(d):u==="ariaLabelConfig"?l.setState({ariaLabelConfig:Gu(d)}):u==="fitView"?l.setState({fitViewQueued:d}):u==="fitViewOptions"?l.setState({fitViewOptions:d}):l.setState({[u]:d})))}f.current=t},mo.map(u=>t[u])),null}function xo(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function id(t){var o;const[e,n]=L.useState(t==="system"?null:t);return L.useEffect(()=>{if(t!=="system"){n(t);return}const r=xo(),i=()=>n(r!=null&&r.matches?"dark":"light");return i(),r==null||r.addEventListener("change",i),()=>{r==null||r.removeEventListener("change",i)}},[t]),e!==null?e:(o=xo())!=null&&o.matches?"dark":"light"}const wo=typeof document<"u"?document:null;function ie(t=null,e={target:wo,actInsideInputWithModifier:!0}){const[n,o]=L.useState(!1),r=L.useRef(!1),i=L.useRef(new Set([])),[s,a]=L.useMemo(()=>{if(t!==null){const l=(Array.isArray(t)?t:[t]).filter(u=>typeof u=="string").map(u=>u.replace("+",`
2
2
  `).replace(`
3
3
 
4
4
  `,`
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-Dbaws8C6.js";/**
1
+ import{c as e}from"./index-CIhDR5rf.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -8,8 +8,8 @@
8
8
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
9
9
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet" />
10
10
  <title>mcp-graph Workstation</title>
11
- <script type="module" crossorigin src="/assets/index-Dbaws8C6.js"></script>
12
- <link rel="stylesheet" crossorigin href="/assets/index-DVIgWBT4.css">
11
+ <script type="module" crossorigin src="/assets/index-CIhDR5rf.js"></script>
12
+ <link rel="stylesheet" crossorigin href="/assets/index-BxDGbcbB.css">
13
13
  </head>
14
14
  <body>
15
15
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcp-graph-workflow/mcp-graph",
3
- "version": "5.30.0",
3
+ "version": "5.31.0",
4
4
  "description": "MCP local-first PRD to task graph — transforms text into executable structure",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -85,7 +85,7 @@
85
85
  "vitest": "^4.0.18"
86
86
  },
87
87
  "dependencies": {
88
- "@mcp-graph-workflow/mcp-graph": "^5.25.0",
88
+ "@mcp-graph-workflow/mcp-graph": "^5.30.0",
89
89
  "@modelcontextprotocol/sdk": "^1.27.1",
90
90
  "adm-zip": "^0.5.16",
91
91
  "better-sqlite3": "^12.6.2",
@@ -1 +0,0 @@
1
- import{r as o,a as h,j as e}from"./index-Dbaws8C6.js";function m(){const[s,x]=o.useState(null),[i,n]=o.useState(!0),[c,r]=o.useState(null),d=o.useCallback(async()=>{n(!0),r(null);try{const l=await h.getContextBudget();x(l)}catch(l){r(l instanceof Error?l.message:"Failed to load context budget")}finally{n(!1)}},[]);return o.useEffect(()=>{d()},[d]),{budget:s,loading:i,error:c,refresh:d}}const u={green:{bg:"bg-green-500/10",text:"text-green-500",border:"border-green-500/30"},yellow:{bg:"bg-yellow-500/10",text:"text-yellow-500",border:"border-yellow-500/30"},red:{bg:"bg-red-500/10",text:"text-red-500",border:"border-red-500/30"}};function g(){const{budget:s,loading:x,error:i,refresh:n}=m();if(i)return e.jsxs("div",{className:"flex items-center justify-center h-full text-danger",children:["Failed to load context budget: ",i]});if(x||!s)return e.jsxs("div",{className:"p-6 max-w-6xl mx-auto space-y-6",children:[e.jsx("div",{className:"h-5 w-48 rounded bg-surface animate-pulse"}),e.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:Array.from({length:4}).map((t,a)=>e.jsx("div",{className:"h-20 rounded-xl border border-edge bg-surface-alt animate-pulse"},a))}),e.jsx("div",{className:"h-24 rounded-lg border border-edge bg-surface-alt animate-pulse"}),e.jsx("div",{className:"h-12 rounded-xl border border-edge bg-surface-alt animate-pulse"})]});const c=u[s.health]??u.green,[r,d]=o.useState(null),l=t=>{r===t?(d(null),h.toggleSkill(t,!1).then(()=>n())):(d(t),setTimeout(()=>d(a=>a===t?null:a),3e3))};return e.jsxs("div",{className:"p-6 max-w-6xl mx-auto space-y-6 overflow-y-auto h-full",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Context Management"}),e.jsx("button",{onClick:()=>n(),className:"text-xs px-3 py-1.5 rounded-lg bg-accent text-white hover:opacity-90 transition-opacity",children:"Refresh"})]}),e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[e.jsxs("div",{className:"p-3 rounded-xl border border-edge shadow-sm hover:shadow-md transition-shadow bg-surface-alt text-center",children:[e.jsx("div",{className:"text-xl font-bold",children:s.activeTokens.toLocaleString()}),e.jsx("div",{className:"text-[10px] text-muted uppercase",children:"Active Tokens"})]}),e.jsxs("div",{className:"p-3 rounded-xl border border-edge shadow-sm hover:shadow-md transition-shadow bg-surface-alt text-center",children:[e.jsx("div",{className:"text-xl font-bold",children:s.totalTokens.toLocaleString()}),e.jsx("div",{className:"text-[10px] text-muted uppercase",children:"Total Tokens"})]}),e.jsxs("div",{className:"p-3 rounded-xl border border-edge shadow-sm hover:shadow-md transition-shadow bg-surface-alt text-center",children:[e.jsx("div",{className:"text-xl font-bold",children:s.activeCount}),e.jsx("div",{className:"text-[10px] text-muted uppercase",children:"Active Skills"})]}),e.jsxs("div",{className:"p-3 rounded-xl border border-edge shadow-sm hover:shadow-md transition-shadow bg-surface-alt text-center",children:[e.jsx("div",{className:"text-xl font-bold",children:s.totalCount}),e.jsx("div",{className:"text-[10px] text-muted uppercase",children:"Total Skills"})]})]}),e.jsxs("div",{className:`p-4 rounded-lg border ${c.bg} ${c.border}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-3 h-3 rounded-full ${s.health==="green"?"bg-green-500":s.health==="yellow"?"bg-yellow-500":"bg-red-500"}`}),e.jsxs("div",{children:[e.jsxs("div",{className:`text-sm font-medium ${c.text}`,children:["Session Health: ",s.health.charAt(0).toUpperCase()+s.health.slice(1)]}),e.jsx("div",{className:"text-xs text-muted mt-0.5",children:s.healthMessage})]})]}),s.recommendations.length>0&&e.jsx("div",{className:"mt-3 space-y-1",children:s.recommendations.map((t,a)=>e.jsx("div",{className:"text-xs text-muted",children:t},a))})]}),e.jsxs("div",{className:"p-4 rounded-xl border border-edge shadow-sm hover:shadow-md transition-shadow bg-surface-alt",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h3",{className:"text-xs font-semibold text-muted uppercase",children:"Token Budget"}),e.jsxs("span",{className:"text-xs text-muted",children:[s.activeTokens.toLocaleString()," / 4,000 (",Math.round(s.activeTokens/40),"%)"]})]}),e.jsxs("div",{className:"w-full h-3 rounded-full bg-edge relative",children:[e.jsx("div",{className:"h-full rounded-full absolute top-0 left-0 opacity-20",style:{width:`${Math.min(Math.round(s.totalTokens/40),100)}%`,background:"#6b7280"}}),e.jsx("div",{className:"h-full rounded-full absolute top-0 left-0 transition-all",style:{width:`${Math.min(Math.round(s.activeTokens/40),100)}%`,background:s.health==="red"?"#ef4444":s.health==="yellow"?"#f59e0b":"#10b981"}})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs font-semibold text-muted uppercase",children:"Token Breakdown by Skill"}),e.jsx("div",{className:"space-y-1",children:s.breakdown.map(t=>{const a=s.totalTokens>0?Math.round(t.tokens/s.totalTokens*100):0;return e.jsxs("div",{className:`flex items-center gap-3 p-2 rounded-xl border border-edge shadow-sm hover:shadow-md transition-shadow bg-surface-alt ${t.enabled?"":"opacity-40"}`,children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-medium truncate",children:t.name}),e.jsx("span",{className:`px-1 py-0.5 rounded text-[9px] ${t.source==="custom"?"bg-purple-500/10 text-purple-500":"bg-blue-500/10 text-blue-500"}`,children:t.source})]}),e.jsx("div",{className:"w-full h-1 rounded-full bg-edge mt-1",children:e.jsx("div",{className:"h-full rounded-full",style:{width:`${a}%`,background:t.enabled?"#3b82f6":"#6b7280"}})})]}),e.jsxs("span",{className:"text-[10px] text-muted shrink-0 w-16 text-right",children:[t.tokens.toLocaleString()," tok"]}),t.enabled&&e.jsx("button",{onClick:()=>l(t.name),className:`text-[10px] px-1.5 py-0.5 rounded border shrink-0 cursor-pointer transition-all ${r===t.name?"bg-red-500/10 text-red-400 border-red-500/30 font-medium":"border-edge text-muted hover:text-red-500 hover:border-red-500/50"}`,children:r===t.name?"Sure?":"Disable"})]},t.name)})})]})]})}export{g as ContextTab};