spexcode 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -15
- package/package.json +1 -1
- package/spec-cli/src/cli.ts +3 -2
- package/spec-cli/src/guide.ts +38 -32
- package/spec-cli/src/harness.ts +26 -31
- package/spec-cli/src/help.ts +1 -1
- package/spec-cli/src/layout.ts +1 -3
- package/spec-cli/src/lint.ts +34 -5
- package/spec-cli/src/sessions.ts +11 -7
- package/spec-cli/templates/spexcode.json +7 -0
- package/spec-dashboard/dist/assets/{Dashboard-BwZ2KzxB.js → Dashboard-Dlg78cbC.js} +3 -3
- package/spec-dashboard/dist/assets/EvalsPage-CDxc1-in.js +3 -0
- package/spec-dashboard/dist/assets/{FoldToggle-GwE0-k1d.js → FoldToggle-B5leylLf.js} +1 -1
- package/spec-dashboard/dist/assets/{IssuesPage-B17pnl9I.js → IssuesPage-C2yFXiO-.js} +1 -1
- package/spec-dashboard/dist/assets/{MobileApp-WEZbR8M1.js → MobileApp-RHNECU6x.js} +1 -1
- package/spec-dashboard/dist/assets/{SessionInterface-Sh8kHpnj.js → SessionInterface-YLD6IOmC.js} +1 -1
- package/spec-dashboard/dist/assets/SessionWindow-CmKtpNUX.js +9 -0
- package/spec-dashboard/dist/assets/{Settings-Dgtg-Xb9.js → Settings-ZnOwskMZ.js} +1 -1
- package/spec-dashboard/dist/assets/{index-Dd0_U5rk.js → index-BdRQfrkR.js} +2 -2
- package/spec-dashboard/dist/assets/{index-CCmnCbKS.css → index-DEc5Ru3l.css} +1 -1
- package/spec-dashboard/dist/index.html +2 -2
- package/spec-yatsu/src/cli.ts +39 -11
- package/spec-yatsu/src/evaltab.ts +7 -6
- package/spec-yatsu/src/filing.ts +6 -3
- package/spec-yatsu/src/proof.ts +10 -0
- package/spec-yatsu/src/sidecar.ts +25 -3
- package/spec-yatsu/src/timeline.ts +53 -23
- package/README.zh-CN.md +0 -170
- package/spec-dashboard/dist/assets/EvalsPage-DV75EdP4.js +0 -3
- package/spec-dashboard/dist/assets/SessionWindow-EzFq-hLG.js +0 -9
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SessionInterface-
|
|
2
|
-
import{r as b,g as Ka,R as qa,j as g,u as Xe,a as Ga,l as Ua,_ as An,X as Za,Y as Qa}from"./index-Dd0_U5rk.js";import{S as ot,G as mo,a as Ja,l as fr,A as ec,b as tc,c as hr,s as Ar,d as Ir,e as nc,I as rs,T as yo,f as xo,g as rc,h as sc,i as oc,j as ic,k as ac,m as cc,n as lc,u as uc,o as Me,p as dc,q as fc,r as hc,L as gc,N as pc}from"./SessionWindow-EzFq-hLG.js";function fe(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=fe(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var mc={value:()=>{}};function In(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new gn(n)}function gn(e){this._=e}function yc(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",s=n.indexOf(".");if(s>=0&&(r=n.slice(s+1),n=n.slice(0,s)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}gn.prototype=In.prototype={constructor:gn,on:function(e,t){var n=this._,r=yc(e+"",n),s,o=-1,i=r.length;if(arguments.length<2){for(;++o<i;)if((s=(e=r[o]).type)&&(s=xc(n[s],e.name)))return s;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<i;)if(s=(e=r[o]).type)n[s]=ss(n[s],e.name,t);else if(t==null)for(s in n)n[s]=ss(n[s],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new gn(e)},call:function(e,t){if((s=arguments.length-2)>0)for(var n=new Array(s),r=0,s,o;r<s;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=this._[e],r=0,s=o.length;r<s;++r)o[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],s=0,o=r.length;s<o;++s)r[s].value.apply(t,n)}};function xc(e,t){for(var n=0,r=e.length,s;n<r;++n)if((s=e[n]).name===t)return s.value}function ss(e,t,n){for(var r=0,s=e.length;r<s;++r)if(e[r].name===t){e[r]=mc,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var gr="http://www.w3.org/1999/xhtml";const os={svg:"http://www.w3.org/2000/svg",xhtml:gr,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function $n(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),os.hasOwnProperty(t)?{space:os[t],local:e}:e}function wc(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===gr&&t.documentElement.namespaceURI===gr?t.createElement(e):t.createElementNS(n,e)}}function vc(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function wo(e){var t=$n(e);return(t.local?vc:wc)(t)}function bc(){}function $r(e){return e==null?bc:function(){return this.querySelector(e)}}function _c(e){typeof e!="function"&&(e=$r(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var o=t[s],i=o.length,a=r[s]=new Array(i),c,l,d=0;d<i;++d)(c=o[d])&&(l=e.call(c,c.__data__,d,o))&&("__data__"in c&&(l.__data__=c.__data__),a[d]=l);return new be(r,this._parents)}function Ec(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Nc(){return[]}function vo(e){return e==null?Nc:function(){return this.querySelectorAll(e)}}function Sc(e){return function(){return Ec(e.apply(this,arguments))}}function kc(e){typeof e=="function"?e=Sc(e):e=vo(e);for(var t=this._groups,n=t.length,r=[],s=[],o=0;o<n;++o)for(var i=t[o],a=i.length,c,l=0;l<a;++l)(c=i[l])&&(r.push(e.call(c,c.__data__,l,i)),s.push(c));return new be(r,s)}function bo(e){return function(){return this.matches(e)}}function _o(e){return function(t){return t.matches(e)}}var Mc=Array.prototype.find;function Cc(e){return function(){return Mc.call(this.children,e)}}function Ac(){return this.firstElementChild}function Ic(e){return this.select(e==null?Ac:Cc(typeof e=="function"?e:_o(e)))}var $c=Array.prototype.filter;function jc(){return Array.from(this.children)}function Pc(e){return function(){return $c.call(this.children,e)}}function Dc(e){return this.selectAll(e==null?jc:Pc(typeof e=="function"?e:_o(e)))}function Tc(e){typeof e!="function"&&(e=bo(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var o=t[s],i=o.length,a=r[s]=[],c,l=0;l<i;++l)(c=o[l])&&e.call(c,c.__data__,l,o)&&a.push(c);return new be(r,this._parents)}function Eo(e){return new Array(e.length)}function Lc(){return new be(this._enter||this._groups.map(Eo),this._parents)}function wn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}wn.prototype={constructor:wn,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Rc(e){return function(){return e}}function zc(e,t,n,r,s,o){for(var i=0,a,c=t.length,l=o.length;i<l;++i)(a=t[i])?(a.__data__=o[i],r[i]=a):n[i]=new wn(e,o[i]);for(;i<c;++i)(a=t[i])&&(s[i]=a)}function Hc(e,t,n,r,s,o,i){var a,c,l=new Map,d=t.length,u=o.length,f=new Array(d),h;for(a=0;a<d;++a)(c=t[a])&&(f[a]=h=i.call(c,c.__data__,a,t)+"",l.has(h)?s[a]=c:l.set(h,c));for(a=0;a<u;++a)h=i.call(e,o[a],a,o)+"",(c=l.get(h))?(r[a]=c,c.__data__=o[a],l.delete(h)):n[a]=new wn(e,o[a]);for(a=0;a<d;++a)(c=t[a])&&l.get(f[a])===c&&(s[a]=c)}function Oc(e){return e.__data__}function Bc(e,t){if(!arguments.length)return Array.from(this,Oc);var n=t?Hc:zc,r=this._parents,s=this._groups;typeof e!="function"&&(e=Rc(e));for(var o=s.length,i=new Array(o),a=new Array(o),c=new Array(o),l=0;l<o;++l){var d=r[l],u=s[l],f=u.length,h=Vc(e.call(d,d&&d.__data__,l,r)),p=h.length,v=a[l]=new Array(p),w=i[l]=new Array(p),m=c[l]=new Array(f);n(d,u,v,w,m,h,t);for(var E=0,y=0,x,N;E<p;++E)if(x=v[E]){for(E>=y&&(y=E+1);!(N=w[y])&&++y<p;);x._next=N||null}}return i=new be(i,r),i._enter=a,i._exit=c,i}function Vc(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Fc(){return new be(this._exit||this._groups.map(Eo),this._parents)}function Wc(e,t,n){var r=this.enter(),s=this,o=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(s=t(s),s&&(s=s.selection())),n==null?o.remove():n(o),r&&s?r.merge(s).order():s}function Yc(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,s=n.length,o=r.length,i=Math.min(s,o),a=new Array(s),c=0;c<i;++c)for(var l=n[c],d=r[c],u=l.length,f=a[c]=new Array(u),h,p=0;p<u;++p)(h=l[p]||d[p])&&(f[p]=h);for(;c<s;++c)a[c]=n[c];return new be(a,this._parents)}function Xc(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],s=r.length-1,o=r[s],i;--s>=0;)(i=r[s])&&(o&&i.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(i,o),o=i);return this}function Kc(e){e||(e=qc);function t(u,f){return u&&f?e(u.__data__,f.__data__):!u-!f}for(var n=this._groups,r=n.length,s=new Array(r),o=0;o<r;++o){for(var i=n[o],a=i.length,c=s[o]=new Array(a),l,d=0;d<a;++d)(l=i[d])&&(c[d]=l);c.sort(t)}return new be(s,this._parents).order()}function qc(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Gc(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Uc(){return Array.from(this)}function Zc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,o=r.length;s<o;++s){var i=r[s];if(i)return i}return null}function Qc(){let e=0;for(const t of this)++e;return e}function Jc(){return!this.node()}function el(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var s=t[n],o=0,i=s.length,a;o<i;++o)(a=s[o])&&e.call(a,a.__data__,o,s);return this}function tl(e){return function(){this.removeAttribute(e)}}function nl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function rl(e,t){return function(){this.setAttribute(e,t)}}function sl(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function ol(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function il(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function al(e,t){var n=$n(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?nl:tl:typeof t=="function"?n.local?il:ol:n.local?sl:rl)(n,t))}function No(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function cl(e){return function(){this.style.removeProperty(e)}}function ll(e,t,n){return function(){this.style.setProperty(e,t,n)}}function ul(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function dl(e,t,n){return arguments.length>1?this.each((t==null?cl:typeof t=="function"?ul:ll)(e,t,n??"")):xt(this.node(),e)}function xt(e,t){return e.style.getPropertyValue(t)||No(e).getComputedStyle(e,null).getPropertyValue(t)}function fl(e){return function(){delete this[e]}}function hl(e,t){return function(){this[e]=t}}function gl(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function pl(e,t){return arguments.length>1?this.each((t==null?fl:typeof t=="function"?gl:hl)(e,t)):this.node()[e]}function So(e){return e.trim().split(/^|\s+/)}function jr(e){return e.classList||new ko(e)}function ko(e){this._node=e,this._names=So(e.getAttribute("class")||"")}ko.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Mo(e,t){for(var n=jr(e),r=-1,s=t.length;++r<s;)n.add(t[r])}function Co(e,t){for(var n=jr(e),r=-1,s=t.length;++r<s;)n.remove(t[r])}function ml(e){return function(){Mo(this,e)}}function yl(e){return function(){Co(this,e)}}function xl(e,t){return function(){(t.apply(this,arguments)?Mo:Co)(this,e)}}function wl(e,t){var n=So(e+"");if(arguments.length<2){for(var r=jr(this.node()),s=-1,o=n.length;++s<o;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof t=="function"?xl:t?ml:yl)(n,t))}function vl(){this.textContent=""}function bl(e){return function(){this.textContent=e}}function _l(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function El(e){return arguments.length?this.each(e==null?vl:(typeof e=="function"?_l:bl)(e)):this.node().textContent}function Nl(){this.innerHTML=""}function Sl(e){return function(){this.innerHTML=e}}function kl(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Ml(e){return arguments.length?this.each(e==null?Nl:(typeof e=="function"?kl:Sl)(e)):this.node().innerHTML}function Cl(){this.nextSibling&&this.parentNode.appendChild(this)}function Al(){return this.each(Cl)}function Il(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function $l(){return this.each(Il)}function jl(e){var t=typeof e=="function"?e:wo(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Pl(){return null}function Dl(e,t){var n=typeof e=="function"?e:wo(e),r=t==null?Pl:typeof t=="function"?t:$r(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Tl(){var e=this.parentNode;e&&e.removeChild(this)}function Ll(){return this.each(Tl)}function Rl(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function zl(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Hl(e){return this.select(e?zl:Rl)}function Ol(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Bl(e){return function(t){e.call(this,t,this.__data__)}}function Vl(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function Fl(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,s=t.length,o;n<s;++n)o=t[n],(!e.type||o.type===e.type)&&o.name===e.name?this.removeEventListener(o.type,o.listener,o.options):t[++r]=o;++r?t.length=r:delete this.__on}}}function Wl(e,t,n){return function(){var r=this.__on,s,o=Bl(t);if(r){for(var i=0,a=r.length;i<a;++i)if((s=r[i]).type===e.type&&s.name===e.name){this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=o,s.options=n),s.value=t;return}}this.addEventListener(e.type,o,n),s={type:e.type,name:e.name,value:t,listener:o,options:n},r?r.push(s):this.__on=[s]}}function Yl(e,t,n){var r=Vl(e+""),s,o=r.length,i;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,d;c<l;++c)for(s=0,d=a[c];s<o;++s)if((i=r[s]).type===d.type&&i.name===d.name)return d.value}return}for(a=t?Wl:Fl,s=0;s<o;++s)this.each(a(r[s],t,n));return this}function Ao(e,t,n){var r=No(e),s=r.CustomEvent;typeof s=="function"?s=new s(t,n):(s=r.document.createEvent("Event"),n?(s.initEvent(t,n.bubbles,n.cancelable),s.detail=n.detail):s.initEvent(t,!1,!1)),e.dispatchEvent(s)}function Xl(e,t){return function(){return Ao(this,e,t)}}function Kl(e,t){return function(){return Ao(this,e,t.apply(this,arguments))}}function ql(e,t){return this.each((typeof t=="function"?Kl:Xl)(e,t))}function*Gl(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,o=r.length,i;s<o;++s)(i=r[s])&&(yield i)}var Io=[null];function be(e,t){this._groups=e,this._parents=t}function Yt(){return new be([[document.documentElement]],Io)}function Ul(){return this}be.prototype=Yt.prototype={constructor:be,select:_c,selectAll:kc,selectChild:Ic,selectChildren:Dc,filter:Tc,data:Bc,enter:Lc,exit:Fc,join:Wc,merge:Yc,selection:Ul,order:Xc,sort:Kc,call:Gc,nodes:Uc,node:Zc,size:Qc,empty:Jc,each:el,attr:al,style:dl,property:pl,classed:wl,text:El,html:Ml,raise:Al,lower:$l,append:jl,insert:Dl,remove:Ll,clone:Hl,datum:Ol,on:Yl,dispatch:ql,[Symbol.iterator]:Gl};function ve(e){return typeof e=="string"?new be([[document.querySelector(e)]],[document.documentElement]):new be([[e]],Io)}function Zl(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Ie(e,t){if(e=Zl(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}}return[e.pageX,e.pageY]}const Ql={passive:!1},Tt={capture:!0,passive:!1};function Zn(e){e.stopImmediatePropagation()}function mt(e){e.preventDefault(),e.stopImmediatePropagation()}function $o(e){var t=e.document.documentElement,n=ve(e).on("dragstart.drag",mt,Tt);"onselectstart"in t?n.on("selectstart.drag",mt,Tt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function jo(e,t){var n=e.document.documentElement,r=ve(e).on("dragstart.drag",null);t&&(r.on("click.drag",mt,Tt),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const rn=e=>()=>e;function pr(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:o,x:i,y:a,dx:c,dy:l,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:d}})}pr.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Jl(e){return!e.ctrlKey&&!e.button}function eu(){return this.parentNode}function tu(e,t){return t??{x:e.x,y:e.y}}function nu(){return navigator.maxTouchPoints||"ontouchstart"in this}function Po(){var e=Jl,t=eu,n=tu,r=nu,s={},o=In("start","drag","end"),i=0,a,c,l,d,u=0;function f(x){x.on("mousedown.drag",h).filter(r).on("touchstart.drag",w).on("touchmove.drag",m,Ql).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(x,N){if(!(d||!e.call(this,x,N))){var k=y(this,t.call(this,x,N),x,N,"mouse");k&&(ve(x.view).on("mousemove.drag",p,Tt).on("mouseup.drag",v,Tt),$o(x.view),Zn(x),l=!1,a=x.clientX,c=x.clientY,k("start",x))}}function p(x){if(mt(x),!l){var N=x.clientX-a,k=x.clientY-c;l=N*N+k*k>u}s.mouse("drag",x)}function v(x){ve(x.view).on("mousemove.drag mouseup.drag",null),jo(x.view,l),mt(x),s.mouse("end",x)}function w(x,N){if(e.call(this,x,N)){var k=x.changedTouches,P=t.call(this,x,N),D=k.length,L,F;for(L=0;L<D;++L)(F=y(this,P,x,N,k[L].identifier,k[L]))&&(Zn(x),F("start",x,k[L]))}}function m(x){var N=x.changedTouches,k=N.length,P,D;for(P=0;P<k;++P)(D=s[N[P].identifier])&&(mt(x),D("drag",x,N[P]))}function E(x){var N=x.changedTouches,k=N.length,P,D;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),P=0;P<k;++P)(D=s[N[P].identifier])&&(Zn(x),D("end",x,N[P]))}function y(x,N,k,P,D,L){var F=o.copy(),M=Ie(L||k,N),j,V,_;if((_=n.call(x,new pr("beforestart",{sourceEvent:k,target:f,identifier:D,active:i,x:M[0],y:M[1],dx:0,dy:0,dispatch:F}),P))!=null)return j=_.x-M[0]||0,V=_.y-M[1]||0,function C(S,I,R){var A=M,O;switch(S){case"start":s[D]=C,O=i++;break;case"end":delete s[D],--i;case"drag":M=Ie(R||I,N),O=i;break}F.call(S,x,new pr(S,{sourceEvent:I,subject:_,target:f,identifier:D,active:O,x:M[0]+j,y:M[1]+V,dx:M[0]-A[0],dy:M[1]-A[1],dispatch:F}),P)}}return f.filter=function(x){return arguments.length?(e=typeof x=="function"?x:rn(!!x),f):e},f.container=function(x){return arguments.length?(t=typeof x=="function"?x:rn(x),f):t},f.subject=function(x){return arguments.length?(n=typeof x=="function"?x:rn(x),f):n},f.touchable=function(x){return arguments.length?(r=typeof x=="function"?x:rn(!!x),f):r},f.on=function(){var x=o.on.apply(o,arguments);return x===o?f:x},f.clickDistance=function(x){return arguments.length?(u=(x=+x)*x,f):Math.sqrt(u)},f}function Pr(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Do(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Xt(){}var Lt=.7,vn=1/Lt,yt="\\s*([+-]?\\d+)\\s*",Rt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ze="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ru=/^#([0-9a-f]{3,8})$/,su=new RegExp(`^rgb\\(${yt},${yt},${yt}\\)$`),ou=new RegExp(`^rgb\\(${ze},${ze},${ze}\\)$`),iu=new RegExp(`^rgba\\(${yt},${yt},${yt},${Rt}\\)$`),au=new RegExp(`^rgba\\(${ze},${ze},${ze},${Rt}\\)$`),cu=new RegExp(`^hsl\\(${Rt},${ze},${ze}\\)$`),lu=new RegExp(`^hsla\\(${Rt},${ze},${ze},${Rt}\\)$`),is={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Pr(Xt,it,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:as,formatHex:as,formatHex8:uu,formatHsl:du,formatRgb:cs,toString:cs});function as(){return this.rgb().formatHex()}function uu(){return this.rgb().formatHex8()}function du(){return To(this).formatHsl()}function cs(){return this.rgb().formatRgb()}function it(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=ru.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?ls(t):n===3?new we(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?sn(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?sn(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=su.exec(e))?new we(t[1],t[2],t[3],1):(t=ou.exec(e))?new we(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=iu.exec(e))?sn(t[1],t[2],t[3],t[4]):(t=au.exec(e))?sn(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=cu.exec(e))?fs(t[1],t[2]/100,t[3]/100,1):(t=lu.exec(e))?fs(t[1],t[2]/100,t[3]/100,t[4]):is.hasOwnProperty(e)?ls(is[e]):e==="transparent"?new we(NaN,NaN,NaN,0):null}function ls(e){return new we(e>>16&255,e>>8&255,e&255,1)}function sn(e,t,n,r){return r<=0&&(e=t=n=NaN),new we(e,t,n,r)}function fu(e){return e instanceof Xt||(e=it(e)),e?(e=e.rgb(),new we(e.r,e.g,e.b,e.opacity)):new we}function mr(e,t,n,r){return arguments.length===1?fu(e):new we(e,t,n,r??1)}function we(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Pr(we,mr,Do(Xt,{brighter(e){return e=e==null?vn:Math.pow(vn,e),new we(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Lt:Math.pow(Lt,e),new we(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new we(rt(this.r),rt(this.g),rt(this.b),bn(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:us,formatHex:us,formatHex8:hu,formatRgb:ds,toString:ds}));function us(){return`#${tt(this.r)}${tt(this.g)}${tt(this.b)}`}function hu(){return`#${tt(this.r)}${tt(this.g)}${tt(this.b)}${tt((isNaN(this.opacity)?1:this.opacity)*255)}`}function ds(){const e=bn(this.opacity);return`${e===1?"rgb(":"rgba("}${rt(this.r)}, ${rt(this.g)}, ${rt(this.b)}${e===1?")":`, ${e})`}`}function bn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function rt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function tt(e){return e=rt(e),(e<16?"0":"")+e.toString(16)}function fs(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new $e(e,t,n,r)}function To(e){if(e instanceof $e)return new $e(e.h,e.s,e.l,e.opacity);if(e instanceof Xt||(e=it(e)),!e)return new $e;if(e instanceof $e)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),o=Math.max(t,n,r),i=NaN,a=o-s,c=(o+s)/2;return a?(t===o?i=(n-r)/a+(n<r)*6:n===o?i=(r-t)/a+2:i=(t-n)/a+4,a/=c<.5?o+s:2-o-s,i*=60):a=c>0&&c<1?0:i,new $e(i,a,c,e.opacity)}function gu(e,t,n,r){return arguments.length===1?To(e):new $e(e,t,n,r??1)}function $e(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Pr($e,gu,Do(Xt,{brighter(e){return e=e==null?vn:Math.pow(vn,e),new $e(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Lt:Math.pow(Lt,e),new $e(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,s=2*n-r;return new we(Qn(e>=240?e-240:e+120,s,r),Qn(e,s,r),Qn(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new $e(hs(this.h),on(this.s),on(this.l),bn(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=bn(this.opacity);return`${e===1?"hsl(":"hsla("}${hs(this.h)}, ${on(this.s)*100}%, ${on(this.l)*100}%${e===1?")":`, ${e})`}`}}));function hs(e){return e=(e||0)%360,e<0?e+360:e}function on(e){return Math.max(0,Math.min(1,e||0))}function Qn(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Dr=e=>()=>e;function pu(e,t){return function(n){return e+n*t}}function mu(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function yu(e){return(e=+e)==1?Lo:function(t,n){return n-t?mu(t,n,e):Dr(isNaN(t)?n:t)}}function Lo(e,t){var n=t-e;return n?pu(e,n):Dr(isNaN(e)?t:e)}const _n=function e(t){var n=yu(t);function r(s,o){var i=n((s=mr(s)).r,(o=mr(o)).r),a=n(s.g,o.g),c=n(s.b,o.b),l=Lo(s.opacity,o.opacity);return function(d){return s.r=i(d),s.g=a(d),s.b=c(d),s.opacity=l(d),s+""}}return r.gamma=e,r}(1);function xu(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),s;return function(o){for(s=0;s<n;++s)r[s]=e[s]*(1-o)+t[s]*o;return r}}function wu(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function vu(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,s=new Array(r),o=new Array(n),i;for(i=0;i<r;++i)s[i]=Pt(e[i],t[i]);for(;i<n;++i)o[i]=t[i];return function(a){for(i=0;i<r;++i)o[i]=s[i](a);return o}}function bu(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Re(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function _u(e,t){var n={},r={},s;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(s in t)s in e?n[s]=Pt(e[s],t[s]):r[s]=t[s];return function(o){for(s in n)r[s]=n[s](o);return r}}var yr=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Jn=new RegExp(yr.source,"g");function Eu(e){return function(){return e}}function Nu(e){return function(t){return e(t)+""}}function Ro(e,t){var n=yr.lastIndex=Jn.lastIndex=0,r,s,o,i=-1,a=[],c=[];for(e=e+"",t=t+"";(r=yr.exec(e))&&(s=Jn.exec(t));)(o=s.index)>n&&(o=t.slice(n,o),a[i]?a[i]+=o:a[++i]=o),(r=r[0])===(s=s[0])?a[i]?a[i]+=s:a[++i]=s:(a[++i]=null,c.push({i,x:Re(r,s)})),n=Jn.lastIndex;return n<t.length&&(o=t.slice(n),a[i]?a[i]+=o:a[++i]=o),a.length<2?c[0]?Nu(c[0].x):Eu(t):(t=c.length,function(l){for(var d=0,u;d<t;++d)a[(u=c[d]).i]=u.x(l);return a.join("")})}function Pt(e,t){var n=typeof t,r;return t==null||n==="boolean"?Dr(t):(n==="number"?Re:n==="string"?(r=it(t))?(t=r,_n):Ro:t instanceof it?_n:t instanceof Date?bu:wu(t)?xu:Array.isArray(t)?vu:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?_u:Re)(e,t)}var gs=180/Math.PI,xr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function zo(e,t,n,r,s,o){var i,a,c;return(i=Math.sqrt(e*e+t*t))&&(e/=i,t/=i),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),e*r<t*n&&(e=-e,t=-t,c=-c,i=-i),{translateX:s,translateY:o,rotate:Math.atan2(t,e)*gs,skewX:Math.atan(c)*gs,scaleX:i,scaleY:a}}var an;function Su(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?xr:zo(t.a,t.b,t.c,t.d,t.e,t.f)}function ku(e){return e==null||(an||(an=document.createElementNS("http://www.w3.org/2000/svg","g")),an.setAttribute("transform",e),!(e=an.transform.baseVal.consolidate()))?xr:(e=e.matrix,zo(e.a,e.b,e.c,e.d,e.e,e.f))}function Ho(e,t,n,r){function s(l){return l.length?l.pop()+" ":""}function o(l,d,u,f,h,p){if(l!==u||d!==f){var v=h.push("translate(",null,t,null,n);p.push({i:v-4,x:Re(l,u)},{i:v-2,x:Re(d,f)})}else(u||f)&&h.push("translate("+u+t+f+n)}function i(l,d,u,f){l!==d?(l-d>180?d+=360:d-l>180&&(l+=360),f.push({i:u.push(s(u)+"rotate(",null,r)-2,x:Re(l,d)})):d&&u.push(s(u)+"rotate("+d+r)}function a(l,d,u,f){l!==d?f.push({i:u.push(s(u)+"skewX(",null,r)-2,x:Re(l,d)}):d&&u.push(s(u)+"skewX("+d+r)}function c(l,d,u,f,h,p){if(l!==u||d!==f){var v=h.push(s(h)+"scale(",null,",",null,")");p.push({i:v-4,x:Re(l,u)},{i:v-2,x:Re(d,f)})}else(u!==1||f!==1)&&h.push(s(h)+"scale("+u+","+f+")")}return function(l,d){var u=[],f=[];return l=e(l),d=e(d),o(l.translateX,l.translateY,d.translateX,d.translateY,u,f),i(l.rotate,d.rotate,u,f),a(l.skewX,d.skewX,u,f),c(l.scaleX,l.scaleY,d.scaleX,d.scaleY,u,f),l=d=null,function(h){for(var p=-1,v=f.length,w;++p<v;)u[(w=f[p]).i]=w.x(h);return u.join("")}}}var Mu=Ho(Su,"px, ","px)","deg)"),Cu=Ho(ku,", ",")",")"),Au=1e-12;function ps(e){return((e=Math.exp(e))+1/e)/2}function Iu(e){return((e=Math.exp(e))-1/e)/2}function $u(e){return((e=Math.exp(2*e))-1)/(e+1)}const pn=function e(t,n,r){function s(o,i){var a=o[0],c=o[1],l=o[2],d=i[0],u=i[1],f=i[2],h=d-a,p=u-c,v=h*h+p*p,w,m;if(v<Au)m=Math.log(f/l)/t,w=function(P){return[a+P*h,c+P*p,l*Math.exp(t*P*m)]};else{var E=Math.sqrt(v),y=(f*f-l*l+r*v)/(2*l*n*E),x=(f*f-l*l-r*v)/(2*f*n*E),N=Math.log(Math.sqrt(y*y+1)-y),k=Math.log(Math.sqrt(x*x+1)-x);m=(k-N)/t,w=function(P){var D=P*m,L=ps(N),F=l/(n*E)*(L*$u(t*D+N)-Iu(N));return[a+F*h,c+F*p,l*L/ps(t*D+N)]}}return w.duration=m*1e3*t/Math.SQRT2,w}return s.rho=function(o){var i=Math.max(.001,+o),a=i*i,c=a*a;return e(i,a,c)},s}(Math.SQRT2,2,4);var wt=0,It=0,Ct=0,Oo=1e3,En,$t,Nn=0,at=0,jn=0,zt=typeof performance=="object"&&performance.now?performance:Date,Bo=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Tr(){return at||(Bo(ju),at=zt.now()+jn)}function ju(){at=0}function Sn(){this._call=this._time=this._next=null}Sn.prototype=Vo.prototype={constructor:Sn,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Tr():+n)+(t==null?0:+t),!this._next&&$t!==this&&($t?$t._next=this:En=this,$t=this),this._call=e,this._time=n,wr()},stop:function(){this._call&&(this._call=null,this._time=1/0,wr())}};function Vo(e,t,n){var r=new Sn;return r.restart(e,t,n),r}function Pu(){Tr(),++wt;for(var e=En,t;e;)(t=at-e._time)>=0&&e._call.call(void 0,t),e=e._next;--wt}function ms(){at=(Nn=zt.now())+jn,wt=It=0;try{Pu()}finally{wt=0,Tu(),at=0}}function Du(){var e=zt.now(),t=e-Nn;t>Oo&&(jn-=t,Nn=e)}function Tu(){for(var e,t=En,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:En=n);$t=e,wr(r)}function wr(e){if(!wt){It&&(It=clearTimeout(It));var t=e-at;t>24?(e<1/0&&(It=setTimeout(ms,e-zt.now()-jn)),Ct&&(Ct=clearInterval(Ct))):(Ct||(Nn=zt.now(),Ct=setInterval(Du,Oo)),wt=1,Bo(ms))}}function ys(e,t,n){var r=new Sn;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var Lu=In("start","end","cancel","interrupt"),Ru=[],Fo=0,xs=1,vr=2,mn=3,ws=4,br=5,yn=6;function Pn(e,t,n,r,s,o){var i=e.__transition;if(!i)e.__transition={};else if(n in i)return;zu(e,n,{name:t,index:r,group:s,on:Lu,tween:Ru,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Fo})}function Lr(e,t){var n=Te(e,t);if(n.state>Fo)throw new Error("too late; already scheduled");return n}function He(e,t){var n=Te(e,t);if(n.state>mn)throw new Error("too late; already running");return n}function Te(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function zu(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=Vo(o,0,n.time);function o(l){n.state=xs,n.timer.restart(i,n.delay,n.time),n.delay<=l&&i(l-n.delay)}function i(l){var d,u,f,h;if(n.state!==xs)return c();for(d in r)if(h=r[d],h.name===n.name){if(h.state===mn)return ys(i);h.state===ws?(h.state=yn,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[d]):+d<t&&(h.state=yn,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[d])}if(ys(function(){n.state===mn&&(n.state=ws,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=vr,n.on.call("start",e,e.__data__,n.index,n.group),n.state===vr){for(n.state=mn,s=new Array(f=n.tween.length),d=0,u=-1;d<f;++d)(h=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(s[++u]=h);s.length=u+1}}function a(l){for(var d=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=br,1),u=-1,f=s.length;++u<f;)s[u].call(e,d);n.state===br&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=yn,n.timer.stop(),delete r[t];for(var l in r)return;delete e.__transition}}function xn(e,t){var n=e.__transition,r,s,o=!0,i;if(n){t=t==null?null:t+"";for(i in n){if((r=n[i]).name!==t){o=!1;continue}s=r.state>vr&&r.state<br,r.state=yn,r.timer.stop(),r.on.call(s?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[i]}o&&delete e.__transition}}function Hu(e){return this.each(function(){xn(this,e)})}function Ou(e,t){var n,r;return function(){var s=He(this,e),o=s.tween;if(o!==n){r=n=o;for(var i=0,a=r.length;i<a;++i)if(r[i].name===t){r=r.slice(),r.splice(i,1);break}}s.tween=r}}function Bu(e,t,n){var r,s;if(typeof n!="function")throw new Error;return function(){var o=He(this,e),i=o.tween;if(i!==r){s=(r=i).slice();for(var a={name:t,value:n},c=0,l=s.length;c<l;++c)if(s[c].name===t){s[c]=a;break}c===l&&s.push(a)}o.tween=s}}function Vu(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Te(this.node(),n).tween,s=0,o=r.length,i;s<o;++s)if((i=r[s]).name===e)return i.value;return null}return this.each((t==null?Ou:Bu)(n,e,t))}function Rr(e,t,n){var r=e._id;return e.each(function(){var s=He(this,r);(s.value||(s.value={}))[t]=n.apply(this,arguments)}),function(s){return Te(s,r).value[t]}}function Wo(e,t){var n;return(typeof t=="number"?Re:t instanceof it?_n:(n=it(t))?(t=n,_n):Ro)(e,t)}function Fu(e){return function(){this.removeAttribute(e)}}function Wu(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Yu(e,t,n){var r,s=n+"",o;return function(){var i=this.getAttribute(e);return i===s?null:i===r?o:o=t(r=i,n)}}function Xu(e,t,n){var r,s=n+"",o;return function(){var i=this.getAttributeNS(e.space,e.local);return i===s?null:i===r?o:o=t(r=i,n)}}function Ku(e,t,n){var r,s,o;return function(){var i,a=n(this),c;return a==null?void this.removeAttribute(e):(i=this.getAttribute(e),c=a+"",i===c?null:i===r&&c===s?o:(s=c,o=t(r=i,a)))}}function qu(e,t,n){var r,s,o;return function(){var i,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(i=this.getAttributeNS(e.space,e.local),c=a+"",i===c?null:i===r&&c===s?o:(s=c,o=t(r=i,a)))}}function Gu(e,t){var n=$n(e),r=n==="transform"?Cu:Wo;return this.attrTween(e,typeof t=="function"?(n.local?qu:Ku)(n,r,Rr(this,"attr."+e,t)):t==null?(n.local?Wu:Fu)(n):(n.local?Xu:Yu)(n,r,t))}function Uu(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Zu(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Qu(e,t){var n,r;function s(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&Zu(e,o)),n}return s._value=t,s}function Ju(e,t){var n,r;function s(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&Uu(e,o)),n}return s._value=t,s}function ed(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=$n(e);return this.tween(n,(r.local?Qu:Ju)(r,t))}function td(e,t){return function(){Lr(this,e).delay=+t.apply(this,arguments)}}function nd(e,t){return t=+t,function(){Lr(this,e).delay=t}}function rd(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?td:nd)(t,e)):Te(this.node(),t).delay}function sd(e,t){return function(){He(this,e).duration=+t.apply(this,arguments)}}function od(e,t){return t=+t,function(){He(this,e).duration=t}}function id(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?sd:od)(t,e)):Te(this.node(),t).duration}function ad(e,t){if(typeof t!="function")throw new Error;return function(){He(this,e).ease=t}}function cd(e){var t=this._id;return arguments.length?this.each(ad(t,e)):Te(this.node(),t).ease}function ld(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;He(this,e).ease=n}}function ud(e){if(typeof e!="function")throw new Error;return this.each(ld(this._id,e))}function dd(e){typeof e!="function"&&(e=bo(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var o=t[s],i=o.length,a=r[s]=[],c,l=0;l<i;++l)(c=o[l])&&e.call(c,c.__data__,l,o)&&a.push(c);return new Ye(r,this._parents,this._name,this._id)}function fd(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,s=n.length,o=Math.min(r,s),i=new Array(r),a=0;a<o;++a)for(var c=t[a],l=n[a],d=c.length,u=i[a]=new Array(d),f,h=0;h<d;++h)(f=c[h]||l[h])&&(u[h]=f);for(;a<r;++a)i[a]=t[a];return new Ye(i,this._parents,this._name,this._id)}function hd(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function gd(e,t,n){var r,s,o=hd(t)?Lr:He;return function(){var i=o(this,e),a=i.on;a!==r&&(s=(r=a).copy()).on(t,n),i.on=s}}function pd(e,t){var n=this._id;return arguments.length<2?Te(this.node(),n).on.on(e):this.each(gd(n,e,t))}function md(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function yd(){return this.on("end.remove",md(this._id))}function xd(e){var t=this._name,n=this._id;typeof e!="function"&&(e=$r(e));for(var r=this._groups,s=r.length,o=new Array(s),i=0;i<s;++i)for(var a=r[i],c=a.length,l=o[i]=new Array(c),d,u,f=0;f<c;++f)(d=a[f])&&(u=e.call(d,d.__data__,f,a))&&("__data__"in d&&(u.__data__=d.__data__),l[f]=u,Pn(l[f],t,n,f,l,Te(d,n)));return new Ye(o,this._parents,t,n)}function wd(e){var t=this._name,n=this._id;typeof e!="function"&&(e=vo(e));for(var r=this._groups,s=r.length,o=[],i=[],a=0;a<s;++a)for(var c=r[a],l=c.length,d,u=0;u<l;++u)if(d=c[u]){for(var f=e.call(d,d.__data__,u,c),h,p=Te(d,n),v=0,w=f.length;v<w;++v)(h=f[v])&&Pn(h,t,n,v,f,p);o.push(f),i.push(d)}return new Ye(o,i,t,n)}var vd=Yt.prototype.constructor;function bd(){return new vd(this._groups,this._parents)}function _d(e,t){var n,r,s;return function(){var o=xt(this,e),i=(this.style.removeProperty(e),xt(this,e));return o===i?null:o===n&&i===r?s:s=t(n=o,r=i)}}function Yo(e){return function(){this.style.removeProperty(e)}}function Ed(e,t,n){var r,s=n+"",o;return function(){var i=xt(this,e);return i===s?null:i===r?o:o=t(r=i,n)}}function Nd(e,t,n){var r,s,o;return function(){var i=xt(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),xt(this,e))),i===c?null:i===r&&c===s?o:(s=c,o=t(r=i,a))}}function Sd(e,t){var n,r,s,o="style."+t,i="end."+o,a;return function(){var c=He(this,e),l=c.on,d=c.value[o]==null?a||(a=Yo(t)):void 0;(l!==n||s!==d)&&(r=(n=l).copy()).on(i,s=d),c.on=r}}function kd(e,t,n){var r=(e+="")=="transform"?Mu:Wo;return t==null?this.styleTween(e,_d(e,r)).on("end.style."+e,Yo(e)):typeof t=="function"?this.styleTween(e,Nd(e,r,Rr(this,"style."+e,t))).each(Sd(this._id,e)):this.styleTween(e,Ed(e,r,t),n).on("end.style."+e,null)}function Md(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Cd(e,t,n){var r,s;function o(){var i=t.apply(this,arguments);return i!==s&&(r=(s=i)&&Md(e,i,n)),r}return o._value=t,o}function Ad(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,Cd(e,t,n??""))}function Id(e){return function(){this.textContent=e}}function $d(e){return function(){var t=e(this);this.textContent=t??""}}function jd(e){return this.tween("text",typeof e=="function"?$d(Rr(this,"text",e)):Id(e==null?"":e+""))}function Pd(e){return function(t){this.textContent=e.call(this,t)}}function Dd(e){var t,n;function r(){var s=e.apply(this,arguments);return s!==n&&(t=(n=s)&&Pd(s)),t}return r._value=e,r}function Td(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,Dd(e))}function Ld(){for(var e=this._name,t=this._id,n=Xo(),r=this._groups,s=r.length,o=0;o<s;++o)for(var i=r[o],a=i.length,c,l=0;l<a;++l)if(c=i[l]){var d=Te(c,t);Pn(c,e,n,l,i,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new Ye(r,this._parents,e,n)}function Rd(){var e,t,n=this,r=n._id,s=n.size();return new Promise(function(o,i){var a={value:i},c={value:function(){--s===0&&o()}};n.each(function(){var l=He(this,r),d=l.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),s===0&&o()})}var zd=0;function Ye(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Xo(){return++zd}var Fe=Yt.prototype;Ye.prototype={constructor:Ye,select:xd,selectAll:wd,selectChild:Fe.selectChild,selectChildren:Fe.selectChildren,filter:dd,merge:fd,selection:bd,transition:Ld,call:Fe.call,nodes:Fe.nodes,node:Fe.node,size:Fe.size,empty:Fe.empty,each:Fe.each,on:pd,attr:Gu,attrTween:ed,style:kd,styleTween:Ad,text:jd,textTween:Td,remove:yd,tween:Vu,delay:rd,duration:id,ease:cd,easeVarying:ud,end:Rd,[Symbol.iterator]:Fe[Symbol.iterator]};function Hd(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Od={time:null,delay:0,duration:250,ease:Hd};function Bd(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function Vd(e){var t,n;e instanceof Ye?(t=e._id,e=e._name):(t=Xo(),(n=Od).time=Tr(),e=e==null?null:e+"");for(var r=this._groups,s=r.length,o=0;o<s;++o)for(var i=r[o],a=i.length,c,l=0;l<a;++l)(c=i[l])&&Pn(c,e,t,l,i,n||Bd(c,t));return new Ye(r,this._parents,e,t)}Yt.prototype.interrupt=Hu;Yt.prototype.transition=Vd;const cn=e=>()=>e;function Fd(e,{sourceEvent:t,target:n,transform:r,dispatch:s}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:s}})}function We(e,t,n){this.k=e,this.x=t,this.y=n}We.prototype={constructor:We,scale:function(e){return e===1?this:new We(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new We(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Dn=new We(1,0,0);Ko.prototype=We.prototype;function Ko(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Dn;return e.__zoom}function er(e){e.stopImmediatePropagation()}function At(e){e.preventDefault(),e.stopImmediatePropagation()}function Wd(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Yd(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function vs(){return this.__zoom||Dn}function Xd(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Kd(){return navigator.maxTouchPoints||"ontouchstart"in this}function qd(e,t,n){var r=e.invertX(t[0][0])-n[0][0],s=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],i=e.invertY(t[1][1])-n[1][1];return e.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),i>o?(o+i)/2:Math.min(0,o)||Math.max(0,i))}function qo(){var e=Wd,t=Yd,n=qd,r=Xd,s=Kd,o=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],a=250,c=pn,l=In("start","zoom","end"),d,u,f,h=500,p=150,v=0,w=10;function m(_){_.property("__zoom",vs).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",L).on("dblclick.zoom",F).filter(s).on("touchstart.zoom",M).on("touchmove.zoom",j).on("touchend.zoom touchcancel.zoom",V).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(_,C,S,I){var R=_.selection?_.selection():_;R.property("__zoom",vs),_!==R?N(_,C,S,I):R.interrupt().each(function(){k(this,arguments).event(I).start().zoom(null,typeof C=="function"?C.apply(this,arguments):C).end()})},m.scaleBy=function(_,C,S,I){m.scaleTo(_,function(){var R=this.__zoom.k,A=typeof C=="function"?C.apply(this,arguments):C;return R*A},S,I)},m.scaleTo=function(_,C,S,I){m.transform(_,function(){var R=t.apply(this,arguments),A=this.__zoom,O=S==null?x(R):typeof S=="function"?S.apply(this,arguments):S,B=A.invert(O),H=typeof C=="function"?C.apply(this,arguments):C;return n(y(E(A,H),O,B),R,i)},S,I)},m.translateBy=function(_,C,S,I){m.transform(_,function(){return n(this.__zoom.translate(typeof C=="function"?C.apply(this,arguments):C,typeof S=="function"?S.apply(this,arguments):S),t.apply(this,arguments),i)},null,I)},m.translateTo=function(_,C,S,I,R){m.transform(_,function(){var A=t.apply(this,arguments),O=this.__zoom,B=I==null?x(A):typeof I=="function"?I.apply(this,arguments):I;return n(Dn.translate(B[0],B[1]).scale(O.k).translate(typeof C=="function"?-C.apply(this,arguments):-C,typeof S=="function"?-S.apply(this,arguments):-S),A,i)},I,R)};function E(_,C){return C=Math.max(o[0],Math.min(o[1],C)),C===_.k?_:new We(C,_.x,_.y)}function y(_,C,S){var I=C[0]-S[0]*_.k,R=C[1]-S[1]*_.k;return I===_.x&&R===_.y?_:new We(_.k,I,R)}function x(_){return[(+_[0][0]+ +_[1][0])/2,(+_[0][1]+ +_[1][1])/2]}function N(_,C,S,I){_.on("start.zoom",function(){k(this,arguments).event(I).start()}).on("interrupt.zoom end.zoom",function(){k(this,arguments).event(I).end()}).tween("zoom",function(){var R=this,A=arguments,O=k(R,A).event(I),B=t.apply(R,A),H=S==null?x(B):typeof S=="function"?S.apply(R,A):S,Y=Math.max(B[1][0]-B[0][0],B[1][1]-B[0][1]),X=R.__zoom,ee=typeof C=="function"?C.apply(R,A):C,J=c(X.invert(H).concat(Y/X.k),ee.invert(H).concat(Y/ee.k));return function(Z){if(Z===1)Z=ee;else{var $=J(Z),W=Y/$[2];Z=new We(W,H[0]-$[0]*W,H[1]-$[1]*W)}O.zoom(null,Z)}})}function k(_,C,S){return!S&&_.__zooming||new P(_,C)}function P(_,C){this.that=_,this.args=C,this.active=0,this.sourceEvent=null,this.extent=t.apply(_,C),this.taps=0}P.prototype={event:function(_){return _&&(this.sourceEvent=_),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(_,C){return this.mouse&&_!=="mouse"&&(this.mouse[1]=C.invert(this.mouse[0])),this.touch0&&_!=="touch"&&(this.touch0[1]=C.invert(this.touch0[0])),this.touch1&&_!=="touch"&&(this.touch1[1]=C.invert(this.touch1[0])),this.that.__zoom=C,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(_){var C=ve(this.that).datum();l.call(_,this.that,new Fd(_,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:l}),C)}};function D(_,...C){if(!e.apply(this,arguments))return;var S=k(this,C).event(_),I=this.__zoom,R=Math.max(o[0],Math.min(o[1],I.k*Math.pow(2,r.apply(this,arguments)))),A=Ie(_);if(S.wheel)(S.mouse[0][0]!==A[0]||S.mouse[0][1]!==A[1])&&(S.mouse[1]=I.invert(S.mouse[0]=A)),clearTimeout(S.wheel);else{if(I.k===R)return;S.mouse=[A,I.invert(A)],xn(this),S.start()}At(_),S.wheel=setTimeout(O,p),S.zoom("mouse",n(y(E(I,R),S.mouse[0],S.mouse[1]),S.extent,i));function O(){S.wheel=null,S.end()}}function L(_,...C){if(f||!e.apply(this,arguments))return;var S=_.currentTarget,I=k(this,C,!0).event(_),R=ve(_.view).on("mousemove.zoom",H,!0).on("mouseup.zoom",Y,!0),A=Ie(_,S),O=_.clientX,B=_.clientY;$o(_.view),er(_),I.mouse=[A,this.__zoom.invert(A)],xn(this),I.start();function H(X){if(At(X),!I.moved){var ee=X.clientX-O,J=X.clientY-B;I.moved=ee*ee+J*J>v}I.event(X).zoom("mouse",n(y(I.that.__zoom,I.mouse[0]=Ie(X,S),I.mouse[1]),I.extent,i))}function Y(X){R.on("mousemove.zoom mouseup.zoom",null),jo(X.view,I.moved),At(X),I.event(X).end()}}function F(_,...C){if(e.apply(this,arguments)){var S=this.__zoom,I=Ie(_.changedTouches?_.changedTouches[0]:_,this),R=S.invert(I),A=S.k*(_.shiftKey?.5:2),O=n(y(E(S,A),I,R),t.apply(this,C),i);At(_),a>0?ve(this).transition().duration(a).call(N,O,I,_):ve(this).call(m.transform,O,I,_)}}function M(_,...C){if(e.apply(this,arguments)){var S=_.touches,I=S.length,R=k(this,C,_.changedTouches.length===I).event(_),A,O,B,H;for(er(_),O=0;O<I;++O)B=S[O],H=Ie(B,this),H=[H,this.__zoom.invert(H),B.identifier],R.touch0?!R.touch1&&R.touch0[2]!==H[2]&&(R.touch1=H,R.taps=0):(R.touch0=H,A=!0,R.taps=1+!!d);d&&(d=clearTimeout(d)),A&&(R.taps<2&&(u=H[0],d=setTimeout(function(){d=null},h)),xn(this),R.start())}}function j(_,...C){if(this.__zooming){var S=k(this,C).event(_),I=_.changedTouches,R=I.length,A,O,B,H;for(At(_),A=0;A<R;++A)O=I[A],B=Ie(O,this),S.touch0&&S.touch0[2]===O.identifier?S.touch0[0]=B:S.touch1&&S.touch1[2]===O.identifier&&(S.touch1[0]=B);if(O=S.that.__zoom,S.touch1){var Y=S.touch0[0],X=S.touch0[1],ee=S.touch1[0],J=S.touch1[1],Z=(Z=ee[0]-Y[0])*Z+(Z=ee[1]-Y[1])*Z,$=($=J[0]-X[0])*$+($=J[1]-X[1])*$;O=E(O,Math.sqrt(Z/$)),B=[(Y[0]+ee[0])/2,(Y[1]+ee[1])/2],H=[(X[0]+J[0])/2,(X[1]+J[1])/2]}else if(S.touch0)B=S.touch0[0],H=S.touch0[1];else return;S.zoom("touch",n(y(O,B,H),S.extent,i))}}function V(_,...C){if(this.__zooming){var S=k(this,C).event(_),I=_.changedTouches,R=I.length,A,O;for(er(_),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),A=0;A<R;++A)O=I[A],S.touch0&&S.touch0[2]===O.identifier?delete S.touch0:S.touch1&&S.touch1[2]===O.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&(O=Ie(O,this),Math.hypot(u[0]-O[0],u[1]-O[1])<w)){var B=ve(this).on("dblclick.zoom");B&&B.apply(this,arguments)}}}return m.wheelDelta=function(_){return arguments.length?(r=typeof _=="function"?_:cn(+_),m):r},m.filter=function(_){return arguments.length?(e=typeof _=="function"?_:cn(!!_),m):e},m.touchable=function(_){return arguments.length?(s=typeof _=="function"?_:cn(!!_),m):s},m.extent=function(_){return arguments.length?(t=typeof _=="function"?_:cn([[+_[0][0],+_[0][1]],[+_[1][0],+_[1][1]]]),m):t},m.scaleExtent=function(_){return arguments.length?(o[0]=+_[0],o[1]=+_[1],m):[o[0],o[1]]},m.translateExtent=function(_){return arguments.length?(i[0][0]=+_[0][0],i[1][0]=+_[1][0],i[0][1]=+_[0][1],i[1][1]=+_[1][1],m):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},m.constrain=function(_){return arguments.length?(n=_,m):n},m.duration=function(_){return arguments.length?(a=+_,m):a},m.interpolate=function(_){return arguments.length?(c=_,m):c},m.on=function(){var _=l.on.apply(l,arguments);return _===l?m:_},m.clickDistance=function(_){return arguments.length?(v=(_=+_)*_,m):Math.sqrt(v)},m.tapDistance=function(_){return arguments.length?(w=+_,m):w},m}const De={error001:(e="react")=>`Seems like you have not used zustand provider as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},Ht=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Go=["Enter"," ","Escape"],Uo={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var vt;(function(e){e.Strict="strict",e.Loose="loose"})(vt||(vt={}));var st;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(st||(st={}));var Ot;(function(e){e.Partial="partial",e.Full="full"})(Ot||(Ot={}));const Zo={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ue;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ue||(Ue={}));var Bt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Bt||(Bt={}));var Q;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Q||(Q={}));const bs={[Q.Left]:Q.Right,[Q.Right]:Q.Left,[Q.Top]:Q.Bottom,[Q.Bottom]:Q.Top};function Qo(e){return e===null?null:e?"valid":"invalid"}const Jo=e=>"id"in e&&"source"in e&&"target"in e,Gd=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),zr=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Kt=(e,t=[0,0])=>{const{width:n,height:r}=Ke(e),s=e.origin??t,o=n*s[0],i=r*s[1];return{x:e.position.x-o,y:e.position.y-i}},Ud=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,s)=>{const o=typeof s=="string";let i=!t.nodeLookup&&!o?s:void 0;t.nodeLookup&&(i=o?t.nodeLookup.get(s):zr(s)?s:t.nodeLookup.get(s.id));const a=i?kn(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Tn(r,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Ln(n)},qt=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(s=>{(t.filter===void 0||t.filter(s))&&(n=Tn(n,kn(s)),r=!0)}),r?Ln(n):{x:0,y:0,width:0,height:0}},Hr=(e,t,[n,r,s]=[0,0,1],o=!1,i=!1)=>{const a={...Mt(t,[n,r,s]),width:t.width/s,height:t.height/s},c=[];for(const l of e.values()){const{measured:d,selectable:u=!0,hidden:f=!1}=l;if(i&&!u||f)continue;const h=d.width??l.width??l.initialWidth??null,p=d.height??l.height??l.initialHeight??null,v=Vt(a,_t(l)),w=(h??0)*(p??0),m=o&&v>0;(!l.internals.handleBounds||m||v>=w||l.dragging)&&c.push(l)}return c},Zd=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function Qd(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(s=>s.id)):null;return e.forEach(s=>{s.measured.width&&s.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!s.hidden)&&(!r||r.has(s.id))&&n.set(s.id,s)}),n}async function Jd({nodes:e,width:t,height:n,panZoom:r,minZoom:s,maxZoom:o},i){if(e.size===0)return!0;const a=Qd(e,i),c=qt(a),l=Br(c,t,n,(i==null?void 0:i.minZoom)??s,(i==null?void 0:i.maxZoom)??o,(i==null?void 0:i.padding)??.1);return await r.setViewport(l,{duration:i==null?void 0:i.duration,ease:i==null?void 0:i.ease,interpolate:i==null?void 0:i.interpolate}),!0}function ei({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:s,onError:o}){const i=n.get(e),a=i.parentId?n.get(i.parentId):void 0,{x:c,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},d=i.origin??r;let u=i.extent||s;if(i.extent==="parent"&&!i.expandParent)if(!a)o==null||o("005",De.error005());else{const h=a.measured.width,p=a.measured.height;h&&p&&(u=[[c,l],[c+h,l+p]])}else a&<(i.extent)&&(u=[[i.extent[0][0]+c,i.extent[0][1]+l],[i.extent[1][0]+c,i.extent[1][1]+l]]);const f=lt(u)?ct(t,u,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&(o==null||o("015",De.error015())),{position:{x:f.x-c+(i.measured.width??0)*d[0],y:f.y-l+(i.measured.height??0)*d[1]},positionAbsolute:f}}async function ef({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:s}){const o=new Set(e.map(f=>f.id)),i=[];for(const f of n){if(f.deletable===!1)continue;const h=o.has(f.id),p=!h&&f.parentId&&i.find(v=>v.id===f.parentId);(h||p)&&i.push(f)}const a=new Set(t.map(f=>f.id)),c=r.filter(f=>f.deletable!==!1),d=Zd(i,c);for(const f of c)a.has(f.id)&&!d.find(p=>p.id===f.id)&&d.push(f);if(!s)return{edges:d,nodes:i};const u=await s({nodes:i,edges:d});return typeof u=="boolean"?u?{edges:d,nodes:i}:{edges:[],nodes:[]}:u}const bt=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),ct=(e={x:0,y:0},t,n)=>({x:bt(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:bt(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function ti(e,t,n){const{width:r,height:s}=Ke(n),{x:o,y:i}=n.internals.positionAbsolute;return ct(e,[[o,i],[o+r,i+s]],t)}const _s=(e,t,n)=>e<t?bt(Math.abs(e-t),1,t)/t:e>n?-bt(Math.abs(e-n),1,t)/t:0,Or=(e,t,n=15,r=40)=>{const s=_s(e.x,r,t.width-r)*n,o=_s(e.y,r,t.height-r)*n;return[s,o]},Tn=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),_r=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Ln=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),_t=(e,t=[0,0])=>{var s,o;const{x:n,y:r}=zr(e)?e.internals.positionAbsolute:Kt(e,t);return{x:n,y:r,width:((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0,height:((o=e.measured)==null?void 0:o.height)??e.height??e.initialHeight??0}},kn=(e,t=[0,0])=>{var s,o;const{x:n,y:r}=zr(e)?e.internals.positionAbsolute:Kt(e,t);return{x:n,y:r,x2:n+(((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0),y2:r+(((o=e.measured)==null?void 0:o.height)??e.height??e.initialHeight??0)}},ni=(e,t)=>Ln(Tn(_r(e),_r(t))),Vt=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},Es=e=>je(e.width)&&je(e.height)&&je(e.x)&&je(e.y),je=e=>!isNaN(e)&&isFinite(e),ri=(e,t)=>(n,r)=>{},Gt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Mt=({x:e,y:t},[n,r,s],o=!1,i=[1,1])=>{const a={x:(e-n)/s,y:(t-r)/s};return o?Gt(a,i):a},Et=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r});function ht(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function tf(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=ht(e,n),s=ht(e,t);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof e=="object"){const r=ht(e.top??e.y??0,n),s=ht(e.bottom??e.y??0,n),o=ht(e.left??e.x??0,t),i=ht(e.right??e.x??0,t);return{top:r,right:i,bottom:s,left:o,x:o+i,y:r+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function nf(e,t,n,r,s,o){const{x:i,y:a}=Et(e,[t,n,r]),{x:c,y:l}=Et({x:e.x+e.width,y:e.y+e.height},[t,n,r]),d=s-c,u=o-l;return{left:Math.floor(i),top:Math.floor(a),right:Math.floor(d),bottom:Math.floor(u)}}const Br=(e,t,n,r,s,o)=>{const i=tf(o,t,n),a=(t-i.x)/e.width,c=(n-i.y)/e.height,l=Math.min(a,c),d=bt(l,r,s),u=e.x+e.width/2,f=e.y+e.height/2,h=t/2-u*d,p=n/2-f*d,v=nf(e,h,p,d,t,n),w={left:Math.min(v.left-i.left,0),top:Math.min(v.top-i.top,0),right:Math.min(v.right-i.right,0),bottom:Math.min(v.bottom-i.bottom,0)};return{x:h-w.left+w.right,y:p-w.top+w.bottom,zoom:d}},Ft=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function lt(e){return e!=null&&e!=="parent"}function Ke(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function si(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function oi(e,t={width:0,height:0},n,r,s){const o={...e},i=r.get(n);if(i){const a=i.origin||s;o.x+=i.internals.positionAbsolute.x-(t.width??0)*a[0],o.y+=i.internals.positionAbsolute.y-(t.height??0)*a[1]}return o}function Ns(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function rf(){let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}function sf(e){return{...Uo,...e||{}}}function Dt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:o,y:i}=Pe(e),a=Mt({x:o-((s==null?void 0:s.left)??0),y:i-((s==null?void 0:s.top)??0)},r),{x:c,y:l}=n?Gt(a,t):a;return{xSnapped:c,ySnapped:l,...a}}const Vr=e=>({width:e.offsetWidth,height:e.offsetHeight}),ii=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},of=["INPUT","SELECT","TEXTAREA"];function ai(e){var r,s;const t=((s=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:s[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:of.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const ci=e=>"clientX"in e,Pe=(e,t)=>{var o,i;const n=ci(e),r=n?e.clientX:(o=e.touches)==null?void 0:o[0].clientX,s=n?e.clientY:(i=e.touches)==null?void 0:i[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:s-((t==null?void 0:t.top)??0)}},Ss=(e,t,n,r,s)=>{const o=t.querySelectorAll(`.${e}`);return!o||!o.length?null:Array.from(o).map(i=>{const a=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:s,position:i.getAttribute("data-handlepos"),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...Vr(i)}})};function li({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:s,sourceControlY:o,targetControlX:i,targetControlY:a}){const c=e*.125+s*.375+i*.375+n*.125,l=t*.125+o*.375+a*.375+r*.125,d=Math.abs(c-e),u=Math.abs(l-t);return[c,l,d,u]}function ln(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function ks({pos:e,x1:t,y1:n,x2:r,y2:s,c:o}){switch(e){case Q.Left:return[t-ln(t-r,o),n];case Q.Right:return[t+ln(r-t,o),n];case Q.Top:return[t,n-ln(n-s,o)];case Q.Bottom:return[t,n+ln(s-n,o)]}}function ui({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:s,targetPosition:o=Q.Top,curvature:i=.25}){const[a,c]=ks({pos:n,x1:e,y1:t,x2:r,y2:s,c:i}),[l,d]=ks({pos:o,x1:r,y1:s,x2:e,y2:t,c:i}),[u,f,h,p]=li({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:d});return[`M${e},${t} C${a},${c} ${l},${d} ${r},${s}`,u,f,h,p]}function di({sourceX:e,sourceY:t,targetX:n,targetY:r}){const s=Math.abs(n-e)/2,o=n<e?n+s:n-s,i=Math.abs(r-t)/2,a=r<t?r+i:r-i;return[o,a,s,i]}function af({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:s=!1,zIndexMode:o="basic"}){if(o==="manual")return r;const i=s&&n?r+1e3:r,a=Math.max(e.parentId||s&&e.selected?e.internals.z:0,t.parentId||s&&t.selected?t.internals.z:0);return i+a}function cf({sourceNode:e,targetNode:t,width:n,height:r,transform:s}){const o=Tn(kn(e),kn(t));o.x===o.x2&&(o.x2+=1),o.y===o.y2&&(o.y2+=1);const i={x:-s[0]/s[2],y:-s[1]/s[2],width:n/s[2],height:r/s[2]};return Vt(i,Ln(o))>0}const lf=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,uf=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),df=(e,t,n={})=>{var o;if(!e.source||!e.target)return(o=n.onError)==null||o.call(n,"006",De.error006()),t;const r=n.getEdgeId||lf;let s;return Jo(e)?s={...e}:s={...e,id:r(e)},uf(s,t)?t:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,t.concat(s))};function fi({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,o,i,a]=di({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,o,i,a]}const Ms={[Q.Left]:{x:-1,y:0},[Q.Right]:{x:1,y:0},[Q.Top]:{x:0,y:-1},[Q.Bottom]:{x:0,y:1}},ff=({source:e,sourcePosition:t=Q.Bottom,target:n})=>t===Q.Left||t===Q.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Cs=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function hf({source:e,sourcePosition:t=Q.Bottom,target:n,targetPosition:r=Q.Top,center:s,offset:o,stepPosition:i}){const a=Ms[t],c=Ms[r],l={x:e.x+a.x*o,y:e.y+a.y*o},d={x:n.x+c.x*o,y:n.y+c.y*o},u=ff({source:l,sourcePosition:t,target:d}),f=u.x!==0?"x":"y",h=u[f];let p=[],v,w;const m={x:0,y:0},E={x:0,y:0},[,,y,x]=di({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*c[f]===-1){f==="x"?(v=s.x??l.x+(d.x-l.x)*i,w=s.y??(l.y+d.y)/2):(v=s.x??(l.x+d.x)/2,w=s.y??l.y+(d.y-l.y)*i);const D=[{x:v,y:l.y},{x:v,y:d.y}],L=[{x:l.x,y:w},{x:d.x,y:w}];a[f]===h?p=f==="x"?D:L:p=f==="x"?L:D}else{const D=[{x:l.x,y:d.y}],L=[{x:d.x,y:l.y}];if(f==="x"?p=a.x===h?L:D:p=a.y===h?D:L,t===r){const _=Math.abs(e[f]-n[f]);if(_<=o){const C=Math.min(o-1,o-_);a[f]===h?m[f]=(l[f]>e[f]?-1:1)*C:E[f]=(d[f]>n[f]?-1:1)*C}}if(t!==r){const _=f==="x"?"y":"x",C=a[f]===c[_],S=l[_]>d[_],I=l[_]<d[_];(a[f]===1&&(!C&&S||C&&I)||a[f]!==1&&(!C&&I||C&&S))&&(p=f==="x"?D:L)}const F={x:l.x+m.x,y:l.y+m.y},M={x:d.x+E.x,y:d.y+E.y},j=Math.max(Math.abs(F.x-p[0].x),Math.abs(M.x-p[0].x)),V=Math.max(Math.abs(F.y-p[0].y),Math.abs(M.y-p[0].y));j>=V?(v=(F.x+M.x)/2,w=p[0].y):(v=p[0].x,w=(F.y+M.y)/2)}const N={x:l.x+m.x,y:l.y+m.y},k={x:d.x+E.x,y:d.y+E.y};return[[e,...N.x!==p[0].x||N.y!==p[0].y?[N]:[],...p,...k.x!==p[p.length-1].x||k.y!==p[p.length-1].y?[k]:[],n],v,w,y,x]}function gf(e,t,n,r){const s=Math.min(Cs(e,t)/2,Cs(t,n)/2,r),{x:o,y:i}=t;if(e.x===o&&o===n.x||e.y===i&&i===n.y)return`L${o} ${i}`;if(e.y===i){const l=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${o+s*l},${i}Q ${o},${i} ${o},${i+s*d}`}const a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${o},${i+s*c}Q ${o},${i} ${o+s*a},${i}`}function Er({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:s,targetPosition:o=Q.Top,borderRadius:i=5,centerX:a,centerY:c,offset:l=20,stepPosition:d=.5}){const[u,f,h,p,v]=hf({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:s},targetPosition:o,center:{x:a,y:c},offset:l,stepPosition:d});let w=`M${u[0].x} ${u[0].y}`;for(let m=1;m<u.length-1;m++)w+=gf(u[m-1],u[m],u[m+1],i);return w+=`L${u[u.length-1].x} ${u[u.length-1].y}`,[w,f,h,p,v]}function As(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function pf(e){var u;const{sourceNode:t,targetNode:n}=e;if(!As(t)||!As(n))return null;const r=t.internals.handleBounds||Is(t.handles),s=n.internals.handleBounds||Is(n.handles),o=$s((r==null?void 0:r.source)??[],e.sourceHandle),i=$s(e.connectionMode===vt.Strict?(s==null?void 0:s.target)??[]:((s==null?void 0:s.target)??[]).concat((s==null?void 0:s.source)??[]),e.targetHandle);if(!o||!i)return(u=e.onError)==null||u.call(e,"008",De.error008(o?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=(o==null?void 0:o.position)||Q.Bottom,c=(i==null?void 0:i.position)||Q.Top,l=ut(t,o,a),d=ut(n,i,c);return{sourceX:l.x,sourceY:l.y,targetX:d.x,targetY:d.y,sourcePosition:a,targetPosition:c}}function Is(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function ut(e,t,n=Q.Left,r=!1){const s=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,o=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:i,height:a}=t??Ke(e);if(r)return{x:s+i/2,y:o+a/2};switch((t==null?void 0:t.position)??n){case Q.Top:return{x:s+i/2,y:o};case Q.Right:return{x:s+i,y:o+a/2};case Q.Bottom:return{x:s+i/2,y:o+a};case Q.Left:return{x:s,y:o+a/2}}}function $s(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Nr(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function mf(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:s}){const o=new Set;return e.reduce((i,a)=>([a.markerStart||r,a.markerEnd||s].forEach(c=>{if(c&&typeof c=="object"){const l=Nr(c,t);o.has(l)||(i.push({id:l,color:c.color||n,...c}),o.add(l))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))}const hi=1e3,yf=10,Fr={nodeOrigin:[0,0],nodeExtent:Ht,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},xf={...Fr,checkEquality:!0};function Wr(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function wf(e,t,n){const r=Wr(Fr,n);for(const s of e.values())if(s.parentId)Xr(s,e,t,r);else{const o=Kt(s,r.nodeOrigin),i=lt(s.extent)?s.extent:r.nodeExtent,a=ct(o,i,Ke(s));s.internals.positionAbsolute=a}}function vf(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const s of e.handles){const o={id:s.id,width:s.width??1,height:s.height??1,nodeId:e.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?n.push(o):s.type==="target"&&r.push(o)}return{source:n,target:r}}function Yr(e){return e==="manual"}function Sr(e,t,n,r={}){var d,u;const s=Wr(xf,r),o={i:0},i=new Map(t),a=s!=null&&s.elevateNodesOnSelect&&!Yr(s.zIndexMode)?hi:0;let c=e.length>0,l=!1;t.clear(),n.clear();for(const f of e){let h=i.get(f.id);if(s.checkEquality&&f===(h==null?void 0:h.internals.userNode))t.set(f.id,h);else{const p=Kt(f,s.nodeOrigin),v=lt(f.extent)?f.extent:s.nodeExtent,w=ct(p,v,Ke(f));h={...s.defaults,...f,measured:{width:(d=f.measured)==null?void 0:d.width,height:(u=f.measured)==null?void 0:u.height},internals:{positionAbsolute:w,handleBounds:vf(f,h),z:gi(f,a,s.zIndexMode),userNode:f}},t.set(f.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(c=!1),f.parentId&&Xr(h,t,n,r,o),l||(l=f.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:l}}function bf(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Xr(e,t,n,r,s){const{elevateNodesOnSelect:o,nodeOrigin:i,nodeExtent:a,zIndexMode:c}=Wr(Fr,r),l=e.parentId,d=t.get(l);if(!d){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}bf(e,n),s&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++s.i,d.internals.z=d.internals.z+s.i*yf),s&&d.internals.rootParentIndex!==void 0&&(s.i=d.internals.rootParentIndex);const u=o&&!Yr(c)?hi:0,{x:f,y:h,z:p}=_f(e,d,i,a,u,c),{positionAbsolute:v}=e.internals,w=f!==v.x||h!==v.y;(w||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:w?{x:f,y:h}:v,z:p}})}function gi(e,t,n){const r=je(e.zIndex)?e.zIndex:0;return Yr(n)?r:r+(e.selected?t:0)}function _f(e,t,n,r,s,o){const{x:i,y:a}=t.internals.positionAbsolute,c=Ke(e),l=Kt(e,n),d=lt(e.extent)?ct(l,e.extent,c):l;let u=ct({x:i+d.x,y:a+d.y},r,c);e.extent==="parent"&&(u=ti(u,c,t));const f=gi(e,s,o),h=t.internals.z??0;return{x:u.x,y:u.y,z:h>=f?h+1:f}}function Kr(e,t,n,r=[0,0]){var i;const s=[],o=new Map;for(const a of e){const c=t.get(a.parentId);if(!c)continue;const l=((i=o.get(a.parentId))==null?void 0:i.expandedRect)??_t(c),d=ni(l,a.rect);o.set(a.parentId,{expandedRect:d,parent:c})}return o.size>0&&o.forEach(({expandedRect:a,parent:c},l)=>{var y;const d=c.internals.positionAbsolute,u=Ke(c),f=c.origin??r,h=a.x<d.x?Math.round(Math.abs(d.x-a.x)):0,p=a.y<d.y?Math.round(Math.abs(d.y-a.y)):0,v=Math.max(u.width,Math.round(a.width)),w=Math.max(u.height,Math.round(a.height)),m=(v-u.width)*f[0],E=(w-u.height)*f[1];(h>0||p>0||m||E)&&(s.push({id:l,type:"position",position:{x:c.position.x-h+m,y:c.position.y-p+E}}),(y=n.get(l))==null||y.forEach(x=>{e.some(N=>N.id===x.id)||s.push({id:x.id,type:"position",position:{x:x.position.x+h,y:x.position.y+p}})})),(u.width<a.width||u.height<a.height||h||p)&&s.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:v+(h?f[0]*h-m:0),height:w+(p?f[1]*p-E:0)}})}),s}function Ef(e,t,n,r,s,o,i){const a=r==null?void 0:r.querySelector(".xyflow__viewport");let c=!1;if(!a)return{changes:[],updatedInternals:c};const l=[],d=window.getComputedStyle(a),{m22:u}=new window.DOMMatrixReadOnly(d.transform),f=[];for(const h of e.values()){const p=t.get(h.id);if(!p)continue;if(p.hidden){t.set(p.id,{...p,internals:{...p.internals,handleBounds:void 0}}),c=!0;continue}const v=Vr(h.nodeElement),w=p.measured.width!==v.width||p.measured.height!==v.height;if(!!(v.width&&v.height&&(w||!p.internals.handleBounds||h.force))){const E=h.nodeElement.getBoundingClientRect(),y=lt(p.extent)?p.extent:o;let{positionAbsolute:x}=p.internals;p.parentId&&p.extent==="parent"?x=ti(x,v,t.get(p.parentId)):y&&(x=ct(x,y,v));const N={...p,measured:v,internals:{...p.internals,positionAbsolute:x,handleBounds:{source:Ss("source",h.nodeElement,E,u,p.id),target:Ss("target",h.nodeElement,E,u,p.id)}}};t.set(p.id,N),p.parentId&&Xr(N,t,n,{nodeOrigin:s,zIndexMode:i}),c=!0,w&&(l.push({id:p.id,type:"dimensions",dimensions:v}),p.expandParent&&p.parentId&&f.push({id:p.id,parentId:p.parentId,rect:_t(N,s)}))}}if(f.length>0){const h=Kr(f,t,n,s);l.push(...h)}return{changes:l,updatedInternals:c}}async function Nf({delta:e,panZoom:t,transform:n,translateExtent:r,width:s,height:o}){if(!t||!e.x&&!e.y)return!1;const i=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[s,o]],r);return!!i&&(i.x!==n[0]||i.y!==n[1]||i.k!==n[2])}function js(e,t,n,r,s,o){let i=s;const a=r.get(i)||new Map;r.set(i,a.set(n,t)),i=`${s}-${e}`;const c=r.get(i)||new Map;if(r.set(i,c.set(n,t)),o){i=`${s}-${e}-${o}`;const l=r.get(i)||new Map;r.set(i,l.set(n,t))}}function pi(e,t,n){e.clear(),t.clear();for(const r of n){const{source:s,target:o,sourceHandle:i=null,targetHandle:a=null}=r,c={edgeId:r.id,source:s,target:o,sourceHandle:i,targetHandle:a},l=`${s}-${i}--${o}-${a}`,d=`${o}-${a}--${s}-${i}`;js("source",c,d,e,s,i),js("target",c,l,e,o,a),t.set(r.id,r)}}function mi(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:mi(n,t):!1}function Ps(e,t,n){var s;let r=e;do{if((s=r==null?void 0:r.matches)!=null&&s.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function Sf(e,t,n,r){const s=new Map;for(const[o,i]of e)if((i.selected||i.id===r)&&(!i.parentId||!mi(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){const a=e.get(o);a&&s.set(o,{id:o,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 s}function tr({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var i,a,c;const s=[];for(const[l,d]of t){const u=(i=n.get(l))==null?void 0:i.internals.userNode;u&&s.push({...u,position:d.position,dragging:r})}if(!e)return[s[0],s];const o=(a=n.get(e))==null?void 0:a.internals.userNode;return[o?{...o,position:((c=t.get(e))==null?void 0:c.position)||o.position,dragging:r}:s[0],s]}function kf({dragItems:e,snapGrid:t,x:n,y:r}){const s=e.values().next().value;if(!s)return null;const o={x:n-s.distance.x,y:r-s.distance.y},i=Gt(o,t);return{x:i.x-o.x,y:i.y-o.y}}function Mf({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:s}){let o={x:null,y:null},i=0,a=new Map,c=!1,l={x:0,y:0},d=null,u=!1,f=null,h=!1,p=!1,v=null;function w({noDragClassName:E,handleSelector:y,domNode:x,isSelectable:N,nodeId:k,nodeClickDistance:P=0}){f=ve(x);function D({x:j,y:V}){const{nodeLookup:_,nodeExtent:C,snapGrid:S,snapToGrid:I,nodeOrigin:R,onNodeDrag:A,onSelectionDrag:O,onError:B,updateNodePositions:H}=t();o={x:j,y:V};let Y=!1;const X=a.size>1,ee=X&&C?_r(qt(a)):null,J=X&&I?kf({dragItems:a,snapGrid:S,x:j,y:V}):null;for(const[Z,$]of a){if(!_.has(Z))continue;let W={x:j-$.distance.x,y:V-$.distance.y};I&&(W=J?{x:Math.round(W.x+J.x),y:Math.round(W.y+J.y)}:Gt(W,S));let ne=null;if(X&&C&&!$.extent&&ee){const{positionAbsolute:G}=$.internals,re=G.x-ee.x+C[0][0],se=G.x+$.measured.width-ee.x2+C[1][0],ie=G.y-ee.y+C[0][1],ce=G.y+$.measured.height-ee.y2+C[1][1];ne=[[re,ie],[se,ce]]}const{position:te,positionAbsolute:q}=ei({nodeId:Z,nextPosition:W,nodeLookup:_,nodeExtent:ne||C,nodeOrigin:R,onError:B});Y=Y||$.position.x!==te.x||$.position.y!==te.y,$.position=te,$.internals.positionAbsolute=q}if(p=p||Y,!!Y&&(H(a,!0),v&&(r||A||!k&&O))){const[Z,$]=tr({nodeId:k,dragItems:a,nodeLookup:_});r==null||r(v,a,Z,$),A==null||A(v,Z,$),k||O==null||O(v,$)}}async function L(){if(!d)return;const{transform:j,panBy:V,autoPanSpeed:_,autoPanOnNodeDrag:C}=t();if(!C){c=!1,cancelAnimationFrame(i);return}const[S,I]=Or(l,d,_);(S!==0||I!==0)&&(o.x=(o.x??0)-S/j[2],o.y=(o.y??0)-I/j[2],await V({x:S,y:I})&&D(o)),i=requestAnimationFrame(L)}function F(j){var X;const{nodeLookup:V,multiSelectionActive:_,nodesDraggable:C,transform:S,snapGrid:I,snapToGrid:R,selectNodesOnDrag:A,onNodeDragStart:O,onSelectionDragStart:B,unselectNodesAndEdges:H}=t();u=!0,(!A||!N)&&!_&&k&&((X=V.get(k))!=null&&X.selected||H()),N&&A&&k&&(e==null||e(k));const Y=Dt(j.sourceEvent,{transform:S,snapGrid:I,snapToGrid:R,containerBounds:d});if(o=Y,a=Sf(V,C,Y,k),a.size>0&&(n||O||!k&&B)){const[ee,J]=tr({nodeId:k,dragItems:a,nodeLookup:V});n==null||n(j.sourceEvent,a,ee,J),O==null||O(j.sourceEvent,ee,J),k||B==null||B(j.sourceEvent,J)}}const M=Po().clickDistance(P).on("start",j=>{const{domNode:V,nodeDragThreshold:_,transform:C,snapGrid:S,snapToGrid:I}=t();d=(V==null?void 0:V.getBoundingClientRect())||null,h=!1,p=!1,v=j.sourceEvent,_===0&&F(j),o=Dt(j.sourceEvent,{transform:C,snapGrid:S,snapToGrid:I,containerBounds:d}),l=Pe(j.sourceEvent,d)}).on("drag",j=>{const{autoPanOnNodeDrag:V,transform:_,snapGrid:C,snapToGrid:S,nodeDragThreshold:I,nodeLookup:R}=t(),A=Dt(j.sourceEvent,{transform:_,snapGrid:C,snapToGrid:S,containerBounds:d});if(v=j.sourceEvent,(j.sourceEvent.type==="touchmove"&&j.sourceEvent.touches.length>1||k&&!R.has(k))&&(h=!0),!h){if(!c&&V&&u&&(c=!0,L()),!u){const O=Pe(j.sourceEvent,d),B=O.x-l.x,H=O.y-l.y;Math.sqrt(B*B+H*H)>I&&F(j)}(o.x!==A.xSnapped||o.y!==A.ySnapped)&&a&&u&&(l=Pe(j.sourceEvent,d),D(A))}}).on("end",j=>{if(!u||h){h&&a.size>0&&t().updateNodePositions(a,!1);return}if(c=!1,u=!1,cancelAnimationFrame(i),a.size>0){const{nodeLookup:V,updateNodePositions:_,onNodeDragStop:C,onSelectionDragStop:S}=t();if(p&&(_(a,!1),p=!1),s||C||!k&&S){const[I,R]=tr({nodeId:k,dragItems:a,nodeLookup:V,dragging:!1});s==null||s(j.sourceEvent,a,I,R),C==null||C(j.sourceEvent,I,R),k||S==null||S(j.sourceEvent,R)}}}).filter(j=>{const V=j.target;return!j.button&&(!E||!Ps(V,`.${E}`,x))&&(!y||Ps(V,y,x))});f.call(M)}function m(){f==null||f.on(".drag",null)}return{update:w,destroy:m}}function Cf(e,t,n){const r=[],s={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const o of t.values())Vt(s,_t(o))>0&&r.push(o);return r}const Af=250;function If(e,t,n,r){var a,c;let s=[],o=1/0;const i=Cf(e,n,t+Af);for(const l of i){const d=[...((a=l.internals.handleBounds)==null?void 0:a.source)??[],...((c=l.internals.handleBounds)==null?void 0:c.target)??[]];for(const u of d){if(r.nodeId===u.nodeId&&r.type===u.type&&r.id===u.id)continue;const{x:f,y:h}=ut(l,u,u.position,!0),p=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(h-e.y,2));p>t||(p<o?(s=[{...u,x:f,y:h}],o=p):p===o&&s.push({...u,x:f,y:h}))}}if(!s.length)return null;if(s.length>1){const l=r.type==="source"?"target":"source";return s.find(d=>d.type===l)??s[0]}return s[0]}function yi(e,t,n,r,s,o=!1){var l,d,u;const i=r.get(e);if(!i)return null;const a=s==="strict"?(l=i.internals.handleBounds)==null?void 0:l[t]:[...((d=i.internals.handleBounds)==null?void 0:d.source)??[],...((u=i.internals.handleBounds)==null?void 0:u.target)??[]],c=(n?a==null?void 0:a.find(f=>f.id===n):a==null?void 0:a[0])??null;return c&&o?{...c,...ut(i,c,c.position,!0)}:c}function xi(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function $f(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const wi=()=>!0;function jf(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:s,edgeUpdaterType:o,isTarget:i,domNode:a,nodeLookup:c,lib:l,autoPanOnConnect:d,flowId:u,panBy:f,cancelConnection:h,onConnectStart:p,onConnect:v,onConnectEnd:w,isValidConnection:m=wi,onReconnectEnd:E,updateConnection:y,getTransform:x,getFromHandle:N,autoPanSpeed:k,dragThreshold:P=1,handleDomNode:D}){const L=ii(e.target);let F=0,M;const{x:j,y:V}=Pe(e),_=xi(o,D),C=a==null?void 0:a.getBoundingClientRect();let S=!1;if(!C||!_)return;const I=yi(s,_,r,c,t);if(!I)return;let R=Pe(e,C),A=!1,O=null,B=!1,H=null;function Y(){if(!d||!C)return;const[te,q]=Or(R,C,k);f({x:te,y:q}),F=requestAnimationFrame(Y)}const X={...I,nodeId:s,type:_,position:I.position},ee=c.get(s);let Z={inProgress:!0,isValid:null,from:ut(ee,X,Q.Left,!0),fromHandle:X,fromPosition:X.position,fromNode:ee,to:R,toHandle:null,toPosition:bs[X.position],toNode:null,pointer:R};function $(){S=!0,y(Z),p==null||p(e,{nodeId:s,handleId:r,handleType:_})}P===0&&$();function W(te){if(!S){const{x:ce,y:me}=Pe(te),_e=ce-j,ye=me-V;if(!(_e*_e+ye*ye>P*P))return;$()}if(!N()||!X){ne(te);return}const q=x();R=Pe(te,C),M=If(Mt(R,q,!1,[1,1]),n,c,X),A||(Y(),A=!0);const G=vi(te,{handle:M,connectionMode:t,fromNodeId:s,fromHandleId:r,fromType:i?"target":"source",isValidConnection:m,doc:L,lib:l,flowId:u,nodeLookup:c});H=G.handleDomNode,O=G.connection,B=$f(!!M,G.isValid);const re=c.get(s),se=re?ut(re,X,Q.Left,!0):Z.from,ie={...Z,from:se,isValid:B,to:G.toHandle&&B?Et({x:G.toHandle.x,y:G.toHandle.y},q):R,toHandle:G.toHandle,toPosition:B&&G.toHandle?G.toHandle.position:bs[X.position],toNode:G.toHandle?c.get(G.toHandle.nodeId):null,pointer:R};y(ie),Z=ie}function ne(te){if(!("touches"in te&&te.touches.length>0)){if(S){(M||H)&&O&&B&&(v==null||v(O));const{inProgress:q,...G}=Z,re={...G,toPosition:Z.toHandle?Z.toPosition:null};w==null||w(te,re),o&&(E==null||E(te,re))}h(),cancelAnimationFrame(F),A=!1,B=!1,O=null,H=null,L.removeEventListener("mousemove",W),L.removeEventListener("mouseup",ne),L.removeEventListener("touchmove",W),L.removeEventListener("touchend",ne)}}L.addEventListener("mousemove",W),L.addEventListener("mouseup",ne),L.addEventListener("touchmove",W),L.addEventListener("touchend",ne)}function vi(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:o,doc:i,lib:a,flowId:c,isValidConnection:l=wi,nodeLookup:d}){const u=o==="target",f=t?i.querySelector(`.${a}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:h,y:p}=Pe(e),v=i.elementFromPoint(h,p),w=v!=null&&v.classList.contains(`${a}-flow__handle`)?v:f,m={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const E=xi(void 0,w),y=w.getAttribute("data-nodeid"),x=w.getAttribute("data-handleid"),N=w.classList.contains("connectable"),k=w.classList.contains("connectableend");if(!y||!E)return m;const P={source:u?y:r,sourceHandle:u?x:s,target:u?r:y,targetHandle:u?s:x};m.connection=P;const L=N&&k&&(n===vt.Strict?u&&E==="source"||!u&&E==="target":y!==r||x!==s);m.isValid=L&&l(P),m.toHandle=yi(y,E,x,d,n,!0)}return m}const kr={onPointerDown:jf,isValid:vi};function Pf({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const s=ve(e);function o({translateExtent:a,width:c,height:l,zoomStep:d=1,pannable:u=!0,zoomable:f=!0,inversePan:h=!1}){const p=y=>{if(y.sourceEvent.type!=="wheel"||!t)return;const x=n(),N=y.sourceEvent.ctrlKey&&Ft()?10:1,k=-y.sourceEvent.deltaY*(y.sourceEvent.deltaMode===1?.05:y.sourceEvent.deltaMode?1:.002)*d,P=x[2]*Math.pow(2,k*N);t.scaleTo(P)};let v=[0,0];const w=y=>{(y.sourceEvent.type==="mousedown"||y.sourceEvent.type==="touchstart")&&(v=[y.sourceEvent.clientX??y.sourceEvent.touches[0].clientX,y.sourceEvent.clientY??y.sourceEvent.touches[0].clientY])},m=y=>{const x=n();if(y.sourceEvent.type!=="mousemove"&&y.sourceEvent.type!=="touchmove"||!t)return;const N=[y.sourceEvent.clientX??y.sourceEvent.touches[0].clientX,y.sourceEvent.clientY??y.sourceEvent.touches[0].clientY],k=[N[0]-v[0],N[1]-v[1]];v=N;const P=r()*Math.max(x[2],Math.log(x[2]))*(h?-1:1),D={x:x[0]-k[0]*P,y:x[1]-k[1]*P},L=[[0,0],[c,l]];t.setViewportConstrained({x:D.x,y:D.y,zoom:x[2]},L,a)},E=qo().on("start",w).on("zoom",u?m:null).on("zoom.wheel",f?p:null);s.call(E,{})}function i(){s.on("zoom",null)}return{update:o,destroy:i,pointer:Ie}}const Rn=e=>({x:e.x,y:e.y,zoom:e.k}),nr=({x:e,y:t,zoom:n})=>Dn.translate(e,t).scale(n),gt=(e,t)=>e.target.closest(`.${t}`),bi=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Df=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,rr=(e,t=0,n=Df,r=()=>{})=>{const s=typeof t=="number"&&t>0;return s||r(),s?e.transition().duration(t).ease(n).on("end",r):e},_i=e=>{const t=e.ctrlKey&&Ft()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Tf({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:o,zoomOnPinch:i,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:l}){return d=>{if(gt(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(d.ctrlKey&&i){const w=Ie(d),m=_i(d),E=u*Math.pow(2,m);r.scaleTo(n,E,w,d);return}const f=d.deltaMode===1?20:1;let h=s===st.Vertical?0:d.deltaX*f,p=s===st.Horizontal?0:d.deltaY*f;!Ft()&&d.shiftKey&&s!==st.Vertical&&(h=d.deltaY*f,p=0),r.translateBy(n,-(h/u)*o,-(p/u)*o,{internal:!0});const v=Rn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,v),e.panScrollTimeout=setTimeout(()=>{l==null||l(d,v),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a==null||a(d,v))}}function Lf({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,s){const o=r.type==="wheel",i=!t&&o&&!r.ctrlKey,a=gt(r,e);if(r.ctrlKey&&o&&a&&r.preventDefault(),i||a)return null;r.preventDefault(),n.call(this,r,s)}}function Rf({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var o,i,a;if((o=r.sourceEvent)!=null&&o.internal)return;const s=Rn(r.transform);e.mouseButton=((i=r.sourceEvent)==null?void 0:i.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=s,((a=r.sourceEvent)==null?void 0:a.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,s))}}function zf({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return o=>{var i,a;e.usedRightMouseButton=!!(n&&bi(t,e.mouseButton??0)),(i=o.sourceEvent)!=null&&i.sync||r([o.transform.x,o.transform.y,o.transform.k]),s&&!((a=o.sourceEvent)!=null&&a.internal)&&(s==null||s(o.sourceEvent,Rn(o.transform)))}}function Hf({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:s,onPaneContextMenu:o}){return i=>{var a;if(!((a=i.sourceEvent)!=null&&a.internal)&&(e.isZoomingOrPanning=!1,o&&bi(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&o(i.sourceEvent),e.usedRightMouseButton=!1,r(!1),s)){const c=Rn(i.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(i.sourceEvent,c)},n?150:0)}}}function Of({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:s,zoomOnDoubleClick:o,userSelectionActive:i,noWheelClassName:a,noPanClassName:c,lib:l,connectionInProgress:d}){return u=>{var w;const f=e||t,h=n&&u.ctrlKey,p=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(gt(u,`${l}-flow__node`)||gt(u,`${l}-flow__edge`)))return!0;if(!r&&!f&&!s&&!o&&!n||i||d&&!p||gt(u,a)&&p||gt(u,c)&&(!p||s&&p&&!e)||!n&&u.ctrlKey&&p)return!1;if(!n&&u.type==="touchstart"&&((w=u.touches)==null?void 0:w.length)>1)return u.preventDefault(),!1;if(!f&&!s&&!h&&p||!r&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(r)&&!r.includes(u.button)&&u.type==="mousedown")return!1;const v=Array.isArray(r)&&r.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||p)&&v}}function Bf({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:s,onPanZoom:o,onPanZoomStart:i,onPanZoomEnd:a,onDraggingChange:c}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),u=qo().scaleExtent([t,n]).translateExtent(r),f=ve(e).call(u);E({x:s.x,y:s.y,zoom:bt(s.zoom,t,n)},[[0,0],[d.width,d.height]],r);const h=f.on("wheel.zoom"),p=f.on("dblclick.zoom");u.wheelDelta(_i);async function v(M,j){return f?new Promise(V=>{u==null||u.interpolate((j==null?void 0:j.interpolate)==="linear"?Pt:pn).transform(rr(f,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>V(!0)),M)}):!1}function w({noWheelClassName:M,noPanClassName:j,onPaneContextMenu:V,userSelectionActive:_,panOnScroll:C,panOnDrag:S,panOnScrollMode:I,panOnScrollSpeed:R,preventScrolling:A,zoomOnPinch:O,zoomOnScroll:B,zoomOnDoubleClick:H,zoomActivationKeyPressed:Y,lib:X,onTransformChange:ee,connectionInProgress:J,paneClickDistance:Z,selectionOnDrag:$}){_&&!l.isZoomingOrPanning&&m();const W=C&&!Y&&!_;u.clickDistance($?1/0:!je(Z)||Z<0?0:Z);const ne=W?Tf({zoomPanValues:l,noWheelClassName:M,d3Selection:f,d3Zoom:u,panOnScrollMode:I,panOnScrollSpeed:R,zoomOnPinch:O,onPanZoomStart:i,onPanZoom:o,onPanZoomEnd:a}):Lf({noWheelClassName:M,preventScrolling:A,d3ZoomHandler:h});f.on("wheel.zoom",ne,{passive:!1});const te=Rf({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:i});u.on("start",te);const q=zf({zoomPanValues:l,panOnDrag:S,onPaneContextMenu:!!V,onPanZoom:o,onTransformChange:ee});u.on("zoom",q);const G=Hf({zoomPanValues:l,panOnDrag:S,panOnScroll:C,onPaneContextMenu:V,onPanZoomEnd:a,onDraggingChange:c});u.on("end",G);const re=Of({zoomActivationKeyPressed:Y,panOnDrag:S,zoomOnScroll:B,panOnScroll:C,zoomOnDoubleClick:H,zoomOnPinch:O,userSelectionActive:_,noPanClassName:j,noWheelClassName:M,lib:X,connectionInProgress:J});u.filter(re),H?f.on("dblclick.zoom",p):f.on("dblclick.zoom",null)}function m(){u.on("zoom",null)}async function E(M,j,V){const _=nr(M),C=u==null?void 0:u.constrain()(_,j,V);return C&&await v(C),C}async function y(M,j){const V=nr(M);return await v(V,j),V}function x(M){if(f){const j=nr(M),V=f.property("__zoom");(V.k!==M.zoom||V.x!==M.x||V.y!==M.y)&&(u==null||u.transform(f,j,null,{sync:!0}))}}function N(){const M=f?Ko(f.node()):{x:0,y:0,k:1};return{x:M.x,y:M.y,zoom:M.k}}async function k(M,j){return f?new Promise(V=>{u==null||u.interpolate((j==null?void 0:j.interpolate)==="linear"?Pt:pn).scaleTo(rr(f,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>V(!0)),M)}):!1}async function P(M,j){return f?new Promise(V=>{u==null||u.interpolate((j==null?void 0:j.interpolate)==="linear"?Pt:pn).scaleBy(rr(f,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>V(!0)),M)}):!1}function D(M){u==null||u.scaleExtent(M)}function L(M){u==null||u.translateExtent(M)}function F(M){const j=!je(M)||M<0?0:M;u==null||u.clickDistance(j)}return{update:w,destroy:m,setViewport:y,setViewportConstrained:E,getViewport:N,scaleTo:k,scaleBy:P,setScaleExtent:D,setTranslateExtent:L,syncViewport:x,setClickDistance:F}}var Nt;(function(e){e.Line="line",e.Handle="handle"})(Nt||(Nt={}));function Vf({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:s,affectsY:o}){const i=e-t,a=n-r,c=[i>0?1:i<0?-1:0,a>0?1:a<0?-1:0];return i&&s&&(c[0]=c[0]*-1),a&&o&&(c[1]=c[1]*-1),c}function Ds(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),s=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:s}}function qe(e,t){return Math.max(0,t-e)}function Ge(e,t){return Math.max(0,e-t)}function un(e,t,n){return Math.max(0,t-e,e-n)}function Ts(e,t){return e?!t:t}function Ff(e,t,n,r,s,o,i,a){let{affectsX:c,affectsY:l}=t;const{isHorizontal:d,isVertical:u}=t,f=d&&u,{xSnapped:h,ySnapped:p}=n,{minWidth:v,maxWidth:w,minHeight:m,maxHeight:E}=r,{x:y,y:x,width:N,height:k,aspectRatio:P}=e;let D=Math.floor(d?h-e.pointerX:0),L=Math.floor(u?p-e.pointerY:0);const F=N+(c?-D:D),M=k+(l?-L:L),j=-o[0]*N,V=-o[1]*k;let _=un(F,v,w),C=un(M,m,E);if(i){let R=0,A=0;c&&D<0?R=qe(y+D+j,i[0][0]):!c&&D>0&&(R=Ge(y+F+j,i[1][0])),l&&L<0?A=qe(x+L+V,i[0][1]):!l&&L>0&&(A=Ge(x+M+V,i[1][1])),_=Math.max(_,R),C=Math.max(C,A)}if(a){let R=0,A=0;c&&D>0?R=Ge(y+D,a[0][0]):!c&&D<0&&(R=qe(y+F,a[1][0])),l&&L>0?A=Ge(x+L,a[0][1]):!l&&L<0&&(A=qe(x+M,a[1][1])),_=Math.max(_,R),C=Math.max(C,A)}if(s){if(d){const R=un(F/P,m,E)*P;if(_=Math.max(_,R),i){let A=0;!c&&!l||c&&!l&&f?A=Ge(x+V+F/P,i[1][1])*P:A=qe(x+V+(c?D:-D)/P,i[0][1])*P,_=Math.max(_,A)}if(a){let A=0;!c&&!l||c&&!l&&f?A=qe(x+F/P,a[1][1])*P:A=Ge(x+(c?D:-D)/P,a[0][1])*P,_=Math.max(_,A)}}if(u){const R=un(M*P,v,w)/P;if(C=Math.max(C,R),i){let A=0;!c&&!l||l&&!c&&f?A=Ge(y+M*P+j,i[1][0])/P:A=qe(y+(l?L:-L)*P+j,i[0][0])/P,C=Math.max(C,A)}if(a){let A=0;!c&&!l||l&&!c&&f?A=qe(y+M*P,a[1][0])/P:A=Ge(y+(l?L:-L)*P,a[0][0])/P,C=Math.max(C,A)}}}L=L+(L<0?C:-C),D=D+(D<0?_:-_),s&&(f?F>M*P?L=(Ts(c,l)?-D:D)/P:D=(Ts(c,l)?-L:L)*P:d?(L=D/P,l=c):(D=L*P,c=l));const S=c?y+D:y,I=l?x+L:x;return{width:N+(c?-D:D),height:k+(l?-L:L),x:o[0]*D*(c?-1:1)+S,y:o[1]*L*(l?-1:1)+I}}const Ei={width:0,height:0,x:0,y:0},Wf={...Ei,pointerX:0,pointerY:0,aspectRatio:1};function Yf(e,t,n){const r=t.position.x+e.position.x,s=t.position.y+e.position.y,o=e.measured.width??0,i=e.measured.height??0,a=n[0]*o,c=n[1]*i;return[[r-a,s-c],[r+o-a,s+i-c]]}function Xf({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:s}){const o=ve(e);let i={controlDirection:Ds("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:l,boundaries:d,keepAspectRatio:u,resizeDirection:f,onResizeStart:h,onResize:p,onResizeEnd:v,shouldResize:w}){let m={...Ei},E={...Wf};i={boundaries:d,resizeDirection:f,keepAspectRatio:u,controlDirection:Ds(l)};let y,x=null,N=[],k,P,D,L=!1;const F=Po().on("start",M=>{const{nodeLookup:j,transform:V,snapGrid:_,snapToGrid:C,nodeOrigin:S,paneDomNode:I}=n();if(y=j.get(t),!y)return;x=(I==null?void 0:I.getBoundingClientRect())??null;const{xSnapped:R,ySnapped:A}=Dt(M.sourceEvent,{transform:V,snapGrid:_,snapToGrid:C,containerBounds:x});m={width:y.measured.width??0,height:y.measured.height??0,x:y.position.x??0,y:y.position.y??0},E={...m,pointerX:R,pointerY:A,aspectRatio:m.width/m.height},k=void 0,P=lt(y.extent)?y.extent:void 0,y.parentId&&(y.extent==="parent"||y.expandParent)&&(k=j.get(y.parentId)),k&&y.extent==="parent"&&(P=[[0,0],[k.measured.width,k.measured.height]]),N=[],D=void 0;for(const[O,B]of j)if(B.parentId===t&&(N.push({id:O,position:{...B.position},extent:B.extent}),B.extent==="parent"||B.expandParent)){const H=Yf(B,y,B.origin??S);D?D=[[Math.min(H[0][0],D[0][0]),Math.min(H[0][1],D[0][1])],[Math.max(H[1][0],D[1][0]),Math.max(H[1][1],D[1][1])]]:D=H}h==null||h(M,{...m})}).on("drag",M=>{const{transform:j,snapGrid:V,snapToGrid:_,nodeOrigin:C}=n(),S=Dt(M.sourceEvent,{transform:j,snapGrid:V,snapToGrid:_,containerBounds:x}),I=[];if(!y)return;const{x:R,y:A,width:O,height:B}=m,H={},Y=y.origin??C,{width:X,height:ee,x:J,y:Z}=Ff(E,i.controlDirection,S,i.boundaries,i.keepAspectRatio,Y,P,D),$=X!==O,W=ee!==B,ne=J!==R&&$,te=Z!==A&&W;if(!ne&&!te&&!$&&!W)return;if((ne||te||Y[0]===1||Y[1]===1)&&(H.x=ne?J:m.x,H.y=te?Z:m.y,m.x=H.x,m.y=H.y,N.length>0)){const se=J-R,ie=Z-A;for(const ce of N)ce.position={x:ce.position.x-se+Y[0]*(X-O),y:ce.position.y-ie+Y[1]*(ee-B)},I.push(ce)}if(($||W)&&(H.width=$&&(!i.resizeDirection||i.resizeDirection==="horizontal")?X:m.width,H.height=W&&(!i.resizeDirection||i.resizeDirection==="vertical")?ee:m.height,m.width=H.width,m.height=H.height),k&&y.expandParent){const se=Y[0]*(H.width??0);H.x&&H.x<se&&(m.x=se,E.x=E.x-(H.x-se));const ie=Y[1]*(H.height??0);H.y&&H.y<ie&&(m.y=ie,E.y=E.y-(H.y-ie))}const q=Vf({width:m.width,prevWidth:O,height:m.height,prevHeight:B,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),G={...m,direction:q};(w==null?void 0:w(M,G))!==!1&&(L=!0,p==null||p(M,G),r(H,I))}).on("end",M=>{L&&(v==null||v(M,{...m}),s==null||s({...m}),L=!1)});o.call(F)}function c(){o.on(".drag",null)}return{update:a,destroy:c}}var Ni={exports:{}},Si={},ki={exports:{}},Mi={};/**
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SessionInterface-YLD6IOmC.js","assets/index-BdRQfrkR.js","assets/index-DEc5Ru3l.css","assets/SessionWindow-CmKtpNUX.js","assets/EvalsPage-CDxc1-in.js","assets/FoldToggle-B5leylLf.js","assets/SessionInterface-DYP7pi_n.css","assets/IssuesPage-C2yFXiO-.js","assets/Settings-ZnOwskMZ.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as b,g as Ka,R as qa,j as g,u as Xe,a as Ga,l as Ua,_ as An,X as Za,Y as Qa}from"./index-BdRQfrkR.js";import{S as ot,G as mo,a as Ja,l as fr,A as ec,b as tc,c as hr,s as Ar,d as Ir,e as nc,I as rs,T as yo,f as xo,g as rc,h as sc,i as oc,j as ic,k as ac,m as cc,n as lc,u as uc,o as Me,p as dc,q as fc,r as hc,L as gc,N as pc}from"./SessionWindow-CmKtpNUX.js";function fe(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=fe(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var mc={value:()=>{}};function In(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new gn(n)}function gn(e){this._=e}function yc(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",s=n.indexOf(".");if(s>=0&&(r=n.slice(s+1),n=n.slice(0,s)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}gn.prototype=In.prototype={constructor:gn,on:function(e,t){var n=this._,r=yc(e+"",n),s,o=-1,i=r.length;if(arguments.length<2){for(;++o<i;)if((s=(e=r[o]).type)&&(s=xc(n[s],e.name)))return s;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<i;)if(s=(e=r[o]).type)n[s]=ss(n[s],e.name,t);else if(t==null)for(s in n)n[s]=ss(n[s],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new gn(e)},call:function(e,t){if((s=arguments.length-2)>0)for(var n=new Array(s),r=0,s,o;r<s;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=this._[e],r=0,s=o.length;r<s;++r)o[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],s=0,o=r.length;s<o;++s)r[s].value.apply(t,n)}};function xc(e,t){for(var n=0,r=e.length,s;n<r;++n)if((s=e[n]).name===t)return s.value}function ss(e,t,n){for(var r=0,s=e.length;r<s;++r)if(e[r].name===t){e[r]=mc,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var gr="http://www.w3.org/1999/xhtml";const os={svg:"http://www.w3.org/2000/svg",xhtml:gr,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function $n(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),os.hasOwnProperty(t)?{space:os[t],local:e}:e}function wc(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===gr&&t.documentElement.namespaceURI===gr?t.createElement(e):t.createElementNS(n,e)}}function vc(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function wo(e){var t=$n(e);return(t.local?vc:wc)(t)}function bc(){}function $r(e){return e==null?bc:function(){return this.querySelector(e)}}function _c(e){typeof e!="function"&&(e=$r(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var o=t[s],i=o.length,a=r[s]=new Array(i),c,l,d=0;d<i;++d)(c=o[d])&&(l=e.call(c,c.__data__,d,o))&&("__data__"in c&&(l.__data__=c.__data__),a[d]=l);return new be(r,this._parents)}function Ec(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Nc(){return[]}function vo(e){return e==null?Nc:function(){return this.querySelectorAll(e)}}function Sc(e){return function(){return Ec(e.apply(this,arguments))}}function kc(e){typeof e=="function"?e=Sc(e):e=vo(e);for(var t=this._groups,n=t.length,r=[],s=[],o=0;o<n;++o)for(var i=t[o],a=i.length,c,l=0;l<a;++l)(c=i[l])&&(r.push(e.call(c,c.__data__,l,i)),s.push(c));return new be(r,s)}function bo(e){return function(){return this.matches(e)}}function _o(e){return function(t){return t.matches(e)}}var Mc=Array.prototype.find;function Cc(e){return function(){return Mc.call(this.children,e)}}function Ac(){return this.firstElementChild}function Ic(e){return this.select(e==null?Ac:Cc(typeof e=="function"?e:_o(e)))}var $c=Array.prototype.filter;function jc(){return Array.from(this.children)}function Pc(e){return function(){return $c.call(this.children,e)}}function Dc(e){return this.selectAll(e==null?jc:Pc(typeof e=="function"?e:_o(e)))}function Tc(e){typeof e!="function"&&(e=bo(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var o=t[s],i=o.length,a=r[s]=[],c,l=0;l<i;++l)(c=o[l])&&e.call(c,c.__data__,l,o)&&a.push(c);return new be(r,this._parents)}function Eo(e){return new Array(e.length)}function Lc(){return new be(this._enter||this._groups.map(Eo),this._parents)}function wn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}wn.prototype={constructor:wn,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Rc(e){return function(){return e}}function zc(e,t,n,r,s,o){for(var i=0,a,c=t.length,l=o.length;i<l;++i)(a=t[i])?(a.__data__=o[i],r[i]=a):n[i]=new wn(e,o[i]);for(;i<c;++i)(a=t[i])&&(s[i]=a)}function Hc(e,t,n,r,s,o,i){var a,c,l=new Map,d=t.length,u=o.length,f=new Array(d),h;for(a=0;a<d;++a)(c=t[a])&&(f[a]=h=i.call(c,c.__data__,a,t)+"",l.has(h)?s[a]=c:l.set(h,c));for(a=0;a<u;++a)h=i.call(e,o[a],a,o)+"",(c=l.get(h))?(r[a]=c,c.__data__=o[a],l.delete(h)):n[a]=new wn(e,o[a]);for(a=0;a<d;++a)(c=t[a])&&l.get(f[a])===c&&(s[a]=c)}function Oc(e){return e.__data__}function Bc(e,t){if(!arguments.length)return Array.from(this,Oc);var n=t?Hc:zc,r=this._parents,s=this._groups;typeof e!="function"&&(e=Rc(e));for(var o=s.length,i=new Array(o),a=new Array(o),c=new Array(o),l=0;l<o;++l){var d=r[l],u=s[l],f=u.length,h=Vc(e.call(d,d&&d.__data__,l,r)),p=h.length,v=a[l]=new Array(p),w=i[l]=new Array(p),m=c[l]=new Array(f);n(d,u,v,w,m,h,t);for(var E=0,y=0,x,N;E<p;++E)if(x=v[E]){for(E>=y&&(y=E+1);!(N=w[y])&&++y<p;);x._next=N||null}}return i=new be(i,r),i._enter=a,i._exit=c,i}function Vc(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Fc(){return new be(this._exit||this._groups.map(Eo),this._parents)}function Wc(e,t,n){var r=this.enter(),s=this,o=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(s=t(s),s&&(s=s.selection())),n==null?o.remove():n(o),r&&s?r.merge(s).order():s}function Yc(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,s=n.length,o=r.length,i=Math.min(s,o),a=new Array(s),c=0;c<i;++c)for(var l=n[c],d=r[c],u=l.length,f=a[c]=new Array(u),h,p=0;p<u;++p)(h=l[p]||d[p])&&(f[p]=h);for(;c<s;++c)a[c]=n[c];return new be(a,this._parents)}function Xc(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],s=r.length-1,o=r[s],i;--s>=0;)(i=r[s])&&(o&&i.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(i,o),o=i);return this}function Kc(e){e||(e=qc);function t(u,f){return u&&f?e(u.__data__,f.__data__):!u-!f}for(var n=this._groups,r=n.length,s=new Array(r),o=0;o<r;++o){for(var i=n[o],a=i.length,c=s[o]=new Array(a),l,d=0;d<a;++d)(l=i[d])&&(c[d]=l);c.sort(t)}return new be(s,this._parents).order()}function qc(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Gc(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Uc(){return Array.from(this)}function Zc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,o=r.length;s<o;++s){var i=r[s];if(i)return i}return null}function Qc(){let e=0;for(const t of this)++e;return e}function Jc(){return!this.node()}function el(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var s=t[n],o=0,i=s.length,a;o<i;++o)(a=s[o])&&e.call(a,a.__data__,o,s);return this}function tl(e){return function(){this.removeAttribute(e)}}function nl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function rl(e,t){return function(){this.setAttribute(e,t)}}function sl(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function ol(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function il(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function al(e,t){var n=$n(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?nl:tl:typeof t=="function"?n.local?il:ol:n.local?sl:rl)(n,t))}function No(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function cl(e){return function(){this.style.removeProperty(e)}}function ll(e,t,n){return function(){this.style.setProperty(e,t,n)}}function ul(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function dl(e,t,n){return arguments.length>1?this.each((t==null?cl:typeof t=="function"?ul:ll)(e,t,n??"")):xt(this.node(),e)}function xt(e,t){return e.style.getPropertyValue(t)||No(e).getComputedStyle(e,null).getPropertyValue(t)}function fl(e){return function(){delete this[e]}}function hl(e,t){return function(){this[e]=t}}function gl(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function pl(e,t){return arguments.length>1?this.each((t==null?fl:typeof t=="function"?gl:hl)(e,t)):this.node()[e]}function So(e){return e.trim().split(/^|\s+/)}function jr(e){return e.classList||new ko(e)}function ko(e){this._node=e,this._names=So(e.getAttribute("class")||"")}ko.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Mo(e,t){for(var n=jr(e),r=-1,s=t.length;++r<s;)n.add(t[r])}function Co(e,t){for(var n=jr(e),r=-1,s=t.length;++r<s;)n.remove(t[r])}function ml(e){return function(){Mo(this,e)}}function yl(e){return function(){Co(this,e)}}function xl(e,t){return function(){(t.apply(this,arguments)?Mo:Co)(this,e)}}function wl(e,t){var n=So(e+"");if(arguments.length<2){for(var r=jr(this.node()),s=-1,o=n.length;++s<o;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof t=="function"?xl:t?ml:yl)(n,t))}function vl(){this.textContent=""}function bl(e){return function(){this.textContent=e}}function _l(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function El(e){return arguments.length?this.each(e==null?vl:(typeof e=="function"?_l:bl)(e)):this.node().textContent}function Nl(){this.innerHTML=""}function Sl(e){return function(){this.innerHTML=e}}function kl(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Ml(e){return arguments.length?this.each(e==null?Nl:(typeof e=="function"?kl:Sl)(e)):this.node().innerHTML}function Cl(){this.nextSibling&&this.parentNode.appendChild(this)}function Al(){return this.each(Cl)}function Il(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function $l(){return this.each(Il)}function jl(e){var t=typeof e=="function"?e:wo(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Pl(){return null}function Dl(e,t){var n=typeof e=="function"?e:wo(e),r=t==null?Pl:typeof t=="function"?t:$r(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Tl(){var e=this.parentNode;e&&e.removeChild(this)}function Ll(){return this.each(Tl)}function Rl(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function zl(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Hl(e){return this.select(e?zl:Rl)}function Ol(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Bl(e){return function(t){e.call(this,t,this.__data__)}}function Vl(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function Fl(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,s=t.length,o;n<s;++n)o=t[n],(!e.type||o.type===e.type)&&o.name===e.name?this.removeEventListener(o.type,o.listener,o.options):t[++r]=o;++r?t.length=r:delete this.__on}}}function Wl(e,t,n){return function(){var r=this.__on,s,o=Bl(t);if(r){for(var i=0,a=r.length;i<a;++i)if((s=r[i]).type===e.type&&s.name===e.name){this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=o,s.options=n),s.value=t;return}}this.addEventListener(e.type,o,n),s={type:e.type,name:e.name,value:t,listener:o,options:n},r?r.push(s):this.__on=[s]}}function Yl(e,t,n){var r=Vl(e+""),s,o=r.length,i;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,d;c<l;++c)for(s=0,d=a[c];s<o;++s)if((i=r[s]).type===d.type&&i.name===d.name)return d.value}return}for(a=t?Wl:Fl,s=0;s<o;++s)this.each(a(r[s],t,n));return this}function Ao(e,t,n){var r=No(e),s=r.CustomEvent;typeof s=="function"?s=new s(t,n):(s=r.document.createEvent("Event"),n?(s.initEvent(t,n.bubbles,n.cancelable),s.detail=n.detail):s.initEvent(t,!1,!1)),e.dispatchEvent(s)}function Xl(e,t){return function(){return Ao(this,e,t)}}function Kl(e,t){return function(){return Ao(this,e,t.apply(this,arguments))}}function ql(e,t){return this.each((typeof t=="function"?Kl:Xl)(e,t))}function*Gl(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,o=r.length,i;s<o;++s)(i=r[s])&&(yield i)}var Io=[null];function be(e,t){this._groups=e,this._parents=t}function Yt(){return new be([[document.documentElement]],Io)}function Ul(){return this}be.prototype=Yt.prototype={constructor:be,select:_c,selectAll:kc,selectChild:Ic,selectChildren:Dc,filter:Tc,data:Bc,enter:Lc,exit:Fc,join:Wc,merge:Yc,selection:Ul,order:Xc,sort:Kc,call:Gc,nodes:Uc,node:Zc,size:Qc,empty:Jc,each:el,attr:al,style:dl,property:pl,classed:wl,text:El,html:Ml,raise:Al,lower:$l,append:jl,insert:Dl,remove:Ll,clone:Hl,datum:Ol,on:Yl,dispatch:ql,[Symbol.iterator]:Gl};function ve(e){return typeof e=="string"?new be([[document.querySelector(e)]],[document.documentElement]):new be([[e]],Io)}function Zl(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Ie(e,t){if(e=Zl(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}}return[e.pageX,e.pageY]}const Ql={passive:!1},Tt={capture:!0,passive:!1};function Zn(e){e.stopImmediatePropagation()}function mt(e){e.preventDefault(),e.stopImmediatePropagation()}function $o(e){var t=e.document.documentElement,n=ve(e).on("dragstart.drag",mt,Tt);"onselectstart"in t?n.on("selectstart.drag",mt,Tt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function jo(e,t){var n=e.document.documentElement,r=ve(e).on("dragstart.drag",null);t&&(r.on("click.drag",mt,Tt),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const rn=e=>()=>e;function pr(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:o,x:i,y:a,dx:c,dy:l,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:d}})}pr.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Jl(e){return!e.ctrlKey&&!e.button}function eu(){return this.parentNode}function tu(e,t){return t??{x:e.x,y:e.y}}function nu(){return navigator.maxTouchPoints||"ontouchstart"in this}function Po(){var e=Jl,t=eu,n=tu,r=nu,s={},o=In("start","drag","end"),i=0,a,c,l,d,u=0;function f(x){x.on("mousedown.drag",h).filter(r).on("touchstart.drag",w).on("touchmove.drag",m,Ql).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(x,N){if(!(d||!e.call(this,x,N))){var k=y(this,t.call(this,x,N),x,N,"mouse");k&&(ve(x.view).on("mousemove.drag",p,Tt).on("mouseup.drag",v,Tt),$o(x.view),Zn(x),l=!1,a=x.clientX,c=x.clientY,k("start",x))}}function p(x){if(mt(x),!l){var N=x.clientX-a,k=x.clientY-c;l=N*N+k*k>u}s.mouse("drag",x)}function v(x){ve(x.view).on("mousemove.drag mouseup.drag",null),jo(x.view,l),mt(x),s.mouse("end",x)}function w(x,N){if(e.call(this,x,N)){var k=x.changedTouches,P=t.call(this,x,N),D=k.length,L,F;for(L=0;L<D;++L)(F=y(this,P,x,N,k[L].identifier,k[L]))&&(Zn(x),F("start",x,k[L]))}}function m(x){var N=x.changedTouches,k=N.length,P,D;for(P=0;P<k;++P)(D=s[N[P].identifier])&&(mt(x),D("drag",x,N[P]))}function E(x){var N=x.changedTouches,k=N.length,P,D;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),P=0;P<k;++P)(D=s[N[P].identifier])&&(Zn(x),D("end",x,N[P]))}function y(x,N,k,P,D,L){var F=o.copy(),M=Ie(L||k,N),j,V,_;if((_=n.call(x,new pr("beforestart",{sourceEvent:k,target:f,identifier:D,active:i,x:M[0],y:M[1],dx:0,dy:0,dispatch:F}),P))!=null)return j=_.x-M[0]||0,V=_.y-M[1]||0,function C(S,I,R){var A=M,O;switch(S){case"start":s[D]=C,O=i++;break;case"end":delete s[D],--i;case"drag":M=Ie(R||I,N),O=i;break}F.call(S,x,new pr(S,{sourceEvent:I,subject:_,target:f,identifier:D,active:O,x:M[0]+j,y:M[1]+V,dx:M[0]-A[0],dy:M[1]-A[1],dispatch:F}),P)}}return f.filter=function(x){return arguments.length?(e=typeof x=="function"?x:rn(!!x),f):e},f.container=function(x){return arguments.length?(t=typeof x=="function"?x:rn(x),f):t},f.subject=function(x){return arguments.length?(n=typeof x=="function"?x:rn(x),f):n},f.touchable=function(x){return arguments.length?(r=typeof x=="function"?x:rn(!!x),f):r},f.on=function(){var x=o.on.apply(o,arguments);return x===o?f:x},f.clickDistance=function(x){return arguments.length?(u=(x=+x)*x,f):Math.sqrt(u)},f}function Pr(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Do(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Xt(){}var Lt=.7,vn=1/Lt,yt="\\s*([+-]?\\d+)\\s*",Rt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ze="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ru=/^#([0-9a-f]{3,8})$/,su=new RegExp(`^rgb\\(${yt},${yt},${yt}\\)$`),ou=new RegExp(`^rgb\\(${ze},${ze},${ze}\\)$`),iu=new RegExp(`^rgba\\(${yt},${yt},${yt},${Rt}\\)$`),au=new RegExp(`^rgba\\(${ze},${ze},${ze},${Rt}\\)$`),cu=new RegExp(`^hsl\\(${Rt},${ze},${ze}\\)$`),lu=new RegExp(`^hsla\\(${Rt},${ze},${ze},${Rt}\\)$`),is={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Pr(Xt,it,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:as,formatHex:as,formatHex8:uu,formatHsl:du,formatRgb:cs,toString:cs});function as(){return this.rgb().formatHex()}function uu(){return this.rgb().formatHex8()}function du(){return To(this).formatHsl()}function cs(){return this.rgb().formatRgb()}function it(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=ru.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?ls(t):n===3?new we(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?sn(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?sn(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=su.exec(e))?new we(t[1],t[2],t[3],1):(t=ou.exec(e))?new we(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=iu.exec(e))?sn(t[1],t[2],t[3],t[4]):(t=au.exec(e))?sn(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=cu.exec(e))?fs(t[1],t[2]/100,t[3]/100,1):(t=lu.exec(e))?fs(t[1],t[2]/100,t[3]/100,t[4]):is.hasOwnProperty(e)?ls(is[e]):e==="transparent"?new we(NaN,NaN,NaN,0):null}function ls(e){return new we(e>>16&255,e>>8&255,e&255,1)}function sn(e,t,n,r){return r<=0&&(e=t=n=NaN),new we(e,t,n,r)}function fu(e){return e instanceof Xt||(e=it(e)),e?(e=e.rgb(),new we(e.r,e.g,e.b,e.opacity)):new we}function mr(e,t,n,r){return arguments.length===1?fu(e):new we(e,t,n,r??1)}function we(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Pr(we,mr,Do(Xt,{brighter(e){return e=e==null?vn:Math.pow(vn,e),new we(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Lt:Math.pow(Lt,e),new we(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new we(rt(this.r),rt(this.g),rt(this.b),bn(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:us,formatHex:us,formatHex8:hu,formatRgb:ds,toString:ds}));function us(){return`#${tt(this.r)}${tt(this.g)}${tt(this.b)}`}function hu(){return`#${tt(this.r)}${tt(this.g)}${tt(this.b)}${tt((isNaN(this.opacity)?1:this.opacity)*255)}`}function ds(){const e=bn(this.opacity);return`${e===1?"rgb(":"rgba("}${rt(this.r)}, ${rt(this.g)}, ${rt(this.b)}${e===1?")":`, ${e})`}`}function bn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function rt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function tt(e){return e=rt(e),(e<16?"0":"")+e.toString(16)}function fs(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new $e(e,t,n,r)}function To(e){if(e instanceof $e)return new $e(e.h,e.s,e.l,e.opacity);if(e instanceof Xt||(e=it(e)),!e)return new $e;if(e instanceof $e)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),o=Math.max(t,n,r),i=NaN,a=o-s,c=(o+s)/2;return a?(t===o?i=(n-r)/a+(n<r)*6:n===o?i=(r-t)/a+2:i=(t-n)/a+4,a/=c<.5?o+s:2-o-s,i*=60):a=c>0&&c<1?0:i,new $e(i,a,c,e.opacity)}function gu(e,t,n,r){return arguments.length===1?To(e):new $e(e,t,n,r??1)}function $e(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Pr($e,gu,Do(Xt,{brighter(e){return e=e==null?vn:Math.pow(vn,e),new $e(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Lt:Math.pow(Lt,e),new $e(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,s=2*n-r;return new we(Qn(e>=240?e-240:e+120,s,r),Qn(e,s,r),Qn(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new $e(hs(this.h),on(this.s),on(this.l),bn(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=bn(this.opacity);return`${e===1?"hsl(":"hsla("}${hs(this.h)}, ${on(this.s)*100}%, ${on(this.l)*100}%${e===1?")":`, ${e})`}`}}));function hs(e){return e=(e||0)%360,e<0?e+360:e}function on(e){return Math.max(0,Math.min(1,e||0))}function Qn(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Dr=e=>()=>e;function pu(e,t){return function(n){return e+n*t}}function mu(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function yu(e){return(e=+e)==1?Lo:function(t,n){return n-t?mu(t,n,e):Dr(isNaN(t)?n:t)}}function Lo(e,t){var n=t-e;return n?pu(e,n):Dr(isNaN(e)?t:e)}const _n=function e(t){var n=yu(t);function r(s,o){var i=n((s=mr(s)).r,(o=mr(o)).r),a=n(s.g,o.g),c=n(s.b,o.b),l=Lo(s.opacity,o.opacity);return function(d){return s.r=i(d),s.g=a(d),s.b=c(d),s.opacity=l(d),s+""}}return r.gamma=e,r}(1);function xu(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),s;return function(o){for(s=0;s<n;++s)r[s]=e[s]*(1-o)+t[s]*o;return r}}function wu(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function vu(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,s=new Array(r),o=new Array(n),i;for(i=0;i<r;++i)s[i]=Pt(e[i],t[i]);for(;i<n;++i)o[i]=t[i];return function(a){for(i=0;i<r;++i)o[i]=s[i](a);return o}}function bu(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Re(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function _u(e,t){var n={},r={},s;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(s in t)s in e?n[s]=Pt(e[s],t[s]):r[s]=t[s];return function(o){for(s in n)r[s]=n[s](o);return r}}var yr=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Jn=new RegExp(yr.source,"g");function Eu(e){return function(){return e}}function Nu(e){return function(t){return e(t)+""}}function Ro(e,t){var n=yr.lastIndex=Jn.lastIndex=0,r,s,o,i=-1,a=[],c=[];for(e=e+"",t=t+"";(r=yr.exec(e))&&(s=Jn.exec(t));)(o=s.index)>n&&(o=t.slice(n,o),a[i]?a[i]+=o:a[++i]=o),(r=r[0])===(s=s[0])?a[i]?a[i]+=s:a[++i]=s:(a[++i]=null,c.push({i,x:Re(r,s)})),n=Jn.lastIndex;return n<t.length&&(o=t.slice(n),a[i]?a[i]+=o:a[++i]=o),a.length<2?c[0]?Nu(c[0].x):Eu(t):(t=c.length,function(l){for(var d=0,u;d<t;++d)a[(u=c[d]).i]=u.x(l);return a.join("")})}function Pt(e,t){var n=typeof t,r;return t==null||n==="boolean"?Dr(t):(n==="number"?Re:n==="string"?(r=it(t))?(t=r,_n):Ro:t instanceof it?_n:t instanceof Date?bu:wu(t)?xu:Array.isArray(t)?vu:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?_u:Re)(e,t)}var gs=180/Math.PI,xr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function zo(e,t,n,r,s,o){var i,a,c;return(i=Math.sqrt(e*e+t*t))&&(e/=i,t/=i),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),e*r<t*n&&(e=-e,t=-t,c=-c,i=-i),{translateX:s,translateY:o,rotate:Math.atan2(t,e)*gs,skewX:Math.atan(c)*gs,scaleX:i,scaleY:a}}var an;function Su(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?xr:zo(t.a,t.b,t.c,t.d,t.e,t.f)}function ku(e){return e==null||(an||(an=document.createElementNS("http://www.w3.org/2000/svg","g")),an.setAttribute("transform",e),!(e=an.transform.baseVal.consolidate()))?xr:(e=e.matrix,zo(e.a,e.b,e.c,e.d,e.e,e.f))}function Ho(e,t,n,r){function s(l){return l.length?l.pop()+" ":""}function o(l,d,u,f,h,p){if(l!==u||d!==f){var v=h.push("translate(",null,t,null,n);p.push({i:v-4,x:Re(l,u)},{i:v-2,x:Re(d,f)})}else(u||f)&&h.push("translate("+u+t+f+n)}function i(l,d,u,f){l!==d?(l-d>180?d+=360:d-l>180&&(l+=360),f.push({i:u.push(s(u)+"rotate(",null,r)-2,x:Re(l,d)})):d&&u.push(s(u)+"rotate("+d+r)}function a(l,d,u,f){l!==d?f.push({i:u.push(s(u)+"skewX(",null,r)-2,x:Re(l,d)}):d&&u.push(s(u)+"skewX("+d+r)}function c(l,d,u,f,h,p){if(l!==u||d!==f){var v=h.push(s(h)+"scale(",null,",",null,")");p.push({i:v-4,x:Re(l,u)},{i:v-2,x:Re(d,f)})}else(u!==1||f!==1)&&h.push(s(h)+"scale("+u+","+f+")")}return function(l,d){var u=[],f=[];return l=e(l),d=e(d),o(l.translateX,l.translateY,d.translateX,d.translateY,u,f),i(l.rotate,d.rotate,u,f),a(l.skewX,d.skewX,u,f),c(l.scaleX,l.scaleY,d.scaleX,d.scaleY,u,f),l=d=null,function(h){for(var p=-1,v=f.length,w;++p<v;)u[(w=f[p]).i]=w.x(h);return u.join("")}}}var Mu=Ho(Su,"px, ","px)","deg)"),Cu=Ho(ku,", ",")",")"),Au=1e-12;function ps(e){return((e=Math.exp(e))+1/e)/2}function Iu(e){return((e=Math.exp(e))-1/e)/2}function $u(e){return((e=Math.exp(2*e))-1)/(e+1)}const pn=function e(t,n,r){function s(o,i){var a=o[0],c=o[1],l=o[2],d=i[0],u=i[1],f=i[2],h=d-a,p=u-c,v=h*h+p*p,w,m;if(v<Au)m=Math.log(f/l)/t,w=function(P){return[a+P*h,c+P*p,l*Math.exp(t*P*m)]};else{var E=Math.sqrt(v),y=(f*f-l*l+r*v)/(2*l*n*E),x=(f*f-l*l-r*v)/(2*f*n*E),N=Math.log(Math.sqrt(y*y+1)-y),k=Math.log(Math.sqrt(x*x+1)-x);m=(k-N)/t,w=function(P){var D=P*m,L=ps(N),F=l/(n*E)*(L*$u(t*D+N)-Iu(N));return[a+F*h,c+F*p,l*L/ps(t*D+N)]}}return w.duration=m*1e3*t/Math.SQRT2,w}return s.rho=function(o){var i=Math.max(.001,+o),a=i*i,c=a*a;return e(i,a,c)},s}(Math.SQRT2,2,4);var wt=0,It=0,Ct=0,Oo=1e3,En,$t,Nn=0,at=0,jn=0,zt=typeof performance=="object"&&performance.now?performance:Date,Bo=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Tr(){return at||(Bo(ju),at=zt.now()+jn)}function ju(){at=0}function Sn(){this._call=this._time=this._next=null}Sn.prototype=Vo.prototype={constructor:Sn,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Tr():+n)+(t==null?0:+t),!this._next&&$t!==this&&($t?$t._next=this:En=this,$t=this),this._call=e,this._time=n,wr()},stop:function(){this._call&&(this._call=null,this._time=1/0,wr())}};function Vo(e,t,n){var r=new Sn;return r.restart(e,t,n),r}function Pu(){Tr(),++wt;for(var e=En,t;e;)(t=at-e._time)>=0&&e._call.call(void 0,t),e=e._next;--wt}function ms(){at=(Nn=zt.now())+jn,wt=It=0;try{Pu()}finally{wt=0,Tu(),at=0}}function Du(){var e=zt.now(),t=e-Nn;t>Oo&&(jn-=t,Nn=e)}function Tu(){for(var e,t=En,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:En=n);$t=e,wr(r)}function wr(e){if(!wt){It&&(It=clearTimeout(It));var t=e-at;t>24?(e<1/0&&(It=setTimeout(ms,e-zt.now()-jn)),Ct&&(Ct=clearInterval(Ct))):(Ct||(Nn=zt.now(),Ct=setInterval(Du,Oo)),wt=1,Bo(ms))}}function ys(e,t,n){var r=new Sn;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var Lu=In("start","end","cancel","interrupt"),Ru=[],Fo=0,xs=1,vr=2,mn=3,ws=4,br=5,yn=6;function Pn(e,t,n,r,s,o){var i=e.__transition;if(!i)e.__transition={};else if(n in i)return;zu(e,n,{name:t,index:r,group:s,on:Lu,tween:Ru,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Fo})}function Lr(e,t){var n=Te(e,t);if(n.state>Fo)throw new Error("too late; already scheduled");return n}function He(e,t){var n=Te(e,t);if(n.state>mn)throw new Error("too late; already running");return n}function Te(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function zu(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=Vo(o,0,n.time);function o(l){n.state=xs,n.timer.restart(i,n.delay,n.time),n.delay<=l&&i(l-n.delay)}function i(l){var d,u,f,h;if(n.state!==xs)return c();for(d in r)if(h=r[d],h.name===n.name){if(h.state===mn)return ys(i);h.state===ws?(h.state=yn,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[d]):+d<t&&(h.state=yn,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[d])}if(ys(function(){n.state===mn&&(n.state=ws,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=vr,n.on.call("start",e,e.__data__,n.index,n.group),n.state===vr){for(n.state=mn,s=new Array(f=n.tween.length),d=0,u=-1;d<f;++d)(h=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(s[++u]=h);s.length=u+1}}function a(l){for(var d=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=br,1),u=-1,f=s.length;++u<f;)s[u].call(e,d);n.state===br&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=yn,n.timer.stop(),delete r[t];for(var l in r)return;delete e.__transition}}function xn(e,t){var n=e.__transition,r,s,o=!0,i;if(n){t=t==null?null:t+"";for(i in n){if((r=n[i]).name!==t){o=!1;continue}s=r.state>vr&&r.state<br,r.state=yn,r.timer.stop(),r.on.call(s?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[i]}o&&delete e.__transition}}function Hu(e){return this.each(function(){xn(this,e)})}function Ou(e,t){var n,r;return function(){var s=He(this,e),o=s.tween;if(o!==n){r=n=o;for(var i=0,a=r.length;i<a;++i)if(r[i].name===t){r=r.slice(),r.splice(i,1);break}}s.tween=r}}function Bu(e,t,n){var r,s;if(typeof n!="function")throw new Error;return function(){var o=He(this,e),i=o.tween;if(i!==r){s=(r=i).slice();for(var a={name:t,value:n},c=0,l=s.length;c<l;++c)if(s[c].name===t){s[c]=a;break}c===l&&s.push(a)}o.tween=s}}function Vu(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Te(this.node(),n).tween,s=0,o=r.length,i;s<o;++s)if((i=r[s]).name===e)return i.value;return null}return this.each((t==null?Ou:Bu)(n,e,t))}function Rr(e,t,n){var r=e._id;return e.each(function(){var s=He(this,r);(s.value||(s.value={}))[t]=n.apply(this,arguments)}),function(s){return Te(s,r).value[t]}}function Wo(e,t){var n;return(typeof t=="number"?Re:t instanceof it?_n:(n=it(t))?(t=n,_n):Ro)(e,t)}function Fu(e){return function(){this.removeAttribute(e)}}function Wu(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Yu(e,t,n){var r,s=n+"",o;return function(){var i=this.getAttribute(e);return i===s?null:i===r?o:o=t(r=i,n)}}function Xu(e,t,n){var r,s=n+"",o;return function(){var i=this.getAttributeNS(e.space,e.local);return i===s?null:i===r?o:o=t(r=i,n)}}function Ku(e,t,n){var r,s,o;return function(){var i,a=n(this),c;return a==null?void this.removeAttribute(e):(i=this.getAttribute(e),c=a+"",i===c?null:i===r&&c===s?o:(s=c,o=t(r=i,a)))}}function qu(e,t,n){var r,s,o;return function(){var i,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(i=this.getAttributeNS(e.space,e.local),c=a+"",i===c?null:i===r&&c===s?o:(s=c,o=t(r=i,a)))}}function Gu(e,t){var n=$n(e),r=n==="transform"?Cu:Wo;return this.attrTween(e,typeof t=="function"?(n.local?qu:Ku)(n,r,Rr(this,"attr."+e,t)):t==null?(n.local?Wu:Fu)(n):(n.local?Xu:Yu)(n,r,t))}function Uu(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Zu(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Qu(e,t){var n,r;function s(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&Zu(e,o)),n}return s._value=t,s}function Ju(e,t){var n,r;function s(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&Uu(e,o)),n}return s._value=t,s}function ed(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=$n(e);return this.tween(n,(r.local?Qu:Ju)(r,t))}function td(e,t){return function(){Lr(this,e).delay=+t.apply(this,arguments)}}function nd(e,t){return t=+t,function(){Lr(this,e).delay=t}}function rd(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?td:nd)(t,e)):Te(this.node(),t).delay}function sd(e,t){return function(){He(this,e).duration=+t.apply(this,arguments)}}function od(e,t){return t=+t,function(){He(this,e).duration=t}}function id(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?sd:od)(t,e)):Te(this.node(),t).duration}function ad(e,t){if(typeof t!="function")throw new Error;return function(){He(this,e).ease=t}}function cd(e){var t=this._id;return arguments.length?this.each(ad(t,e)):Te(this.node(),t).ease}function ld(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;He(this,e).ease=n}}function ud(e){if(typeof e!="function")throw new Error;return this.each(ld(this._id,e))}function dd(e){typeof e!="function"&&(e=bo(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var o=t[s],i=o.length,a=r[s]=[],c,l=0;l<i;++l)(c=o[l])&&e.call(c,c.__data__,l,o)&&a.push(c);return new Ye(r,this._parents,this._name,this._id)}function fd(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,s=n.length,o=Math.min(r,s),i=new Array(r),a=0;a<o;++a)for(var c=t[a],l=n[a],d=c.length,u=i[a]=new Array(d),f,h=0;h<d;++h)(f=c[h]||l[h])&&(u[h]=f);for(;a<r;++a)i[a]=t[a];return new Ye(i,this._parents,this._name,this._id)}function hd(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function gd(e,t,n){var r,s,o=hd(t)?Lr:He;return function(){var i=o(this,e),a=i.on;a!==r&&(s=(r=a).copy()).on(t,n),i.on=s}}function pd(e,t){var n=this._id;return arguments.length<2?Te(this.node(),n).on.on(e):this.each(gd(n,e,t))}function md(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function yd(){return this.on("end.remove",md(this._id))}function xd(e){var t=this._name,n=this._id;typeof e!="function"&&(e=$r(e));for(var r=this._groups,s=r.length,o=new Array(s),i=0;i<s;++i)for(var a=r[i],c=a.length,l=o[i]=new Array(c),d,u,f=0;f<c;++f)(d=a[f])&&(u=e.call(d,d.__data__,f,a))&&("__data__"in d&&(u.__data__=d.__data__),l[f]=u,Pn(l[f],t,n,f,l,Te(d,n)));return new Ye(o,this._parents,t,n)}function wd(e){var t=this._name,n=this._id;typeof e!="function"&&(e=vo(e));for(var r=this._groups,s=r.length,o=[],i=[],a=0;a<s;++a)for(var c=r[a],l=c.length,d,u=0;u<l;++u)if(d=c[u]){for(var f=e.call(d,d.__data__,u,c),h,p=Te(d,n),v=0,w=f.length;v<w;++v)(h=f[v])&&Pn(h,t,n,v,f,p);o.push(f),i.push(d)}return new Ye(o,i,t,n)}var vd=Yt.prototype.constructor;function bd(){return new vd(this._groups,this._parents)}function _d(e,t){var n,r,s;return function(){var o=xt(this,e),i=(this.style.removeProperty(e),xt(this,e));return o===i?null:o===n&&i===r?s:s=t(n=o,r=i)}}function Yo(e){return function(){this.style.removeProperty(e)}}function Ed(e,t,n){var r,s=n+"",o;return function(){var i=xt(this,e);return i===s?null:i===r?o:o=t(r=i,n)}}function Nd(e,t,n){var r,s,o;return function(){var i=xt(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),xt(this,e))),i===c?null:i===r&&c===s?o:(s=c,o=t(r=i,a))}}function Sd(e,t){var n,r,s,o="style."+t,i="end."+o,a;return function(){var c=He(this,e),l=c.on,d=c.value[o]==null?a||(a=Yo(t)):void 0;(l!==n||s!==d)&&(r=(n=l).copy()).on(i,s=d),c.on=r}}function kd(e,t,n){var r=(e+="")=="transform"?Mu:Wo;return t==null?this.styleTween(e,_d(e,r)).on("end.style."+e,Yo(e)):typeof t=="function"?this.styleTween(e,Nd(e,r,Rr(this,"style."+e,t))).each(Sd(this._id,e)):this.styleTween(e,Ed(e,r,t),n).on("end.style."+e,null)}function Md(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Cd(e,t,n){var r,s;function o(){var i=t.apply(this,arguments);return i!==s&&(r=(s=i)&&Md(e,i,n)),r}return o._value=t,o}function Ad(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,Cd(e,t,n??""))}function Id(e){return function(){this.textContent=e}}function $d(e){return function(){var t=e(this);this.textContent=t??""}}function jd(e){return this.tween("text",typeof e=="function"?$d(Rr(this,"text",e)):Id(e==null?"":e+""))}function Pd(e){return function(t){this.textContent=e.call(this,t)}}function Dd(e){var t,n;function r(){var s=e.apply(this,arguments);return s!==n&&(t=(n=s)&&Pd(s)),t}return r._value=e,r}function Td(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,Dd(e))}function Ld(){for(var e=this._name,t=this._id,n=Xo(),r=this._groups,s=r.length,o=0;o<s;++o)for(var i=r[o],a=i.length,c,l=0;l<a;++l)if(c=i[l]){var d=Te(c,t);Pn(c,e,n,l,i,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new Ye(r,this._parents,e,n)}function Rd(){var e,t,n=this,r=n._id,s=n.size();return new Promise(function(o,i){var a={value:i},c={value:function(){--s===0&&o()}};n.each(function(){var l=He(this,r),d=l.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),s===0&&o()})}var zd=0;function Ye(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Xo(){return++zd}var Fe=Yt.prototype;Ye.prototype={constructor:Ye,select:xd,selectAll:wd,selectChild:Fe.selectChild,selectChildren:Fe.selectChildren,filter:dd,merge:fd,selection:bd,transition:Ld,call:Fe.call,nodes:Fe.nodes,node:Fe.node,size:Fe.size,empty:Fe.empty,each:Fe.each,on:pd,attr:Gu,attrTween:ed,style:kd,styleTween:Ad,text:jd,textTween:Td,remove:yd,tween:Vu,delay:rd,duration:id,ease:cd,easeVarying:ud,end:Rd,[Symbol.iterator]:Fe[Symbol.iterator]};function Hd(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Od={time:null,delay:0,duration:250,ease:Hd};function Bd(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function Vd(e){var t,n;e instanceof Ye?(t=e._id,e=e._name):(t=Xo(),(n=Od).time=Tr(),e=e==null?null:e+"");for(var r=this._groups,s=r.length,o=0;o<s;++o)for(var i=r[o],a=i.length,c,l=0;l<a;++l)(c=i[l])&&Pn(c,e,t,l,i,n||Bd(c,t));return new Ye(r,this._parents,e,t)}Yt.prototype.interrupt=Hu;Yt.prototype.transition=Vd;const cn=e=>()=>e;function Fd(e,{sourceEvent:t,target:n,transform:r,dispatch:s}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:s}})}function We(e,t,n){this.k=e,this.x=t,this.y=n}We.prototype={constructor:We,scale:function(e){return e===1?this:new We(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new We(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Dn=new We(1,0,0);Ko.prototype=We.prototype;function Ko(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Dn;return e.__zoom}function er(e){e.stopImmediatePropagation()}function At(e){e.preventDefault(),e.stopImmediatePropagation()}function Wd(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Yd(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function vs(){return this.__zoom||Dn}function Xd(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Kd(){return navigator.maxTouchPoints||"ontouchstart"in this}function qd(e,t,n){var r=e.invertX(t[0][0])-n[0][0],s=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],i=e.invertY(t[1][1])-n[1][1];return e.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),i>o?(o+i)/2:Math.min(0,o)||Math.max(0,i))}function qo(){var e=Wd,t=Yd,n=qd,r=Xd,s=Kd,o=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],a=250,c=pn,l=In("start","zoom","end"),d,u,f,h=500,p=150,v=0,w=10;function m(_){_.property("__zoom",vs).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",L).on("dblclick.zoom",F).filter(s).on("touchstart.zoom",M).on("touchmove.zoom",j).on("touchend.zoom touchcancel.zoom",V).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(_,C,S,I){var R=_.selection?_.selection():_;R.property("__zoom",vs),_!==R?N(_,C,S,I):R.interrupt().each(function(){k(this,arguments).event(I).start().zoom(null,typeof C=="function"?C.apply(this,arguments):C).end()})},m.scaleBy=function(_,C,S,I){m.scaleTo(_,function(){var R=this.__zoom.k,A=typeof C=="function"?C.apply(this,arguments):C;return R*A},S,I)},m.scaleTo=function(_,C,S,I){m.transform(_,function(){var R=t.apply(this,arguments),A=this.__zoom,O=S==null?x(R):typeof S=="function"?S.apply(this,arguments):S,B=A.invert(O),H=typeof C=="function"?C.apply(this,arguments):C;return n(y(E(A,H),O,B),R,i)},S,I)},m.translateBy=function(_,C,S,I){m.transform(_,function(){return n(this.__zoom.translate(typeof C=="function"?C.apply(this,arguments):C,typeof S=="function"?S.apply(this,arguments):S),t.apply(this,arguments),i)},null,I)},m.translateTo=function(_,C,S,I,R){m.transform(_,function(){var A=t.apply(this,arguments),O=this.__zoom,B=I==null?x(A):typeof I=="function"?I.apply(this,arguments):I;return n(Dn.translate(B[0],B[1]).scale(O.k).translate(typeof C=="function"?-C.apply(this,arguments):-C,typeof S=="function"?-S.apply(this,arguments):-S),A,i)},I,R)};function E(_,C){return C=Math.max(o[0],Math.min(o[1],C)),C===_.k?_:new We(C,_.x,_.y)}function y(_,C,S){var I=C[0]-S[0]*_.k,R=C[1]-S[1]*_.k;return I===_.x&&R===_.y?_:new We(_.k,I,R)}function x(_){return[(+_[0][0]+ +_[1][0])/2,(+_[0][1]+ +_[1][1])/2]}function N(_,C,S,I){_.on("start.zoom",function(){k(this,arguments).event(I).start()}).on("interrupt.zoom end.zoom",function(){k(this,arguments).event(I).end()}).tween("zoom",function(){var R=this,A=arguments,O=k(R,A).event(I),B=t.apply(R,A),H=S==null?x(B):typeof S=="function"?S.apply(R,A):S,Y=Math.max(B[1][0]-B[0][0],B[1][1]-B[0][1]),X=R.__zoom,ee=typeof C=="function"?C.apply(R,A):C,J=c(X.invert(H).concat(Y/X.k),ee.invert(H).concat(Y/ee.k));return function(Z){if(Z===1)Z=ee;else{var $=J(Z),W=Y/$[2];Z=new We(W,H[0]-$[0]*W,H[1]-$[1]*W)}O.zoom(null,Z)}})}function k(_,C,S){return!S&&_.__zooming||new P(_,C)}function P(_,C){this.that=_,this.args=C,this.active=0,this.sourceEvent=null,this.extent=t.apply(_,C),this.taps=0}P.prototype={event:function(_){return _&&(this.sourceEvent=_),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(_,C){return this.mouse&&_!=="mouse"&&(this.mouse[1]=C.invert(this.mouse[0])),this.touch0&&_!=="touch"&&(this.touch0[1]=C.invert(this.touch0[0])),this.touch1&&_!=="touch"&&(this.touch1[1]=C.invert(this.touch1[0])),this.that.__zoom=C,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(_){var C=ve(this.that).datum();l.call(_,this.that,new Fd(_,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:l}),C)}};function D(_,...C){if(!e.apply(this,arguments))return;var S=k(this,C).event(_),I=this.__zoom,R=Math.max(o[0],Math.min(o[1],I.k*Math.pow(2,r.apply(this,arguments)))),A=Ie(_);if(S.wheel)(S.mouse[0][0]!==A[0]||S.mouse[0][1]!==A[1])&&(S.mouse[1]=I.invert(S.mouse[0]=A)),clearTimeout(S.wheel);else{if(I.k===R)return;S.mouse=[A,I.invert(A)],xn(this),S.start()}At(_),S.wheel=setTimeout(O,p),S.zoom("mouse",n(y(E(I,R),S.mouse[0],S.mouse[1]),S.extent,i));function O(){S.wheel=null,S.end()}}function L(_,...C){if(f||!e.apply(this,arguments))return;var S=_.currentTarget,I=k(this,C,!0).event(_),R=ve(_.view).on("mousemove.zoom",H,!0).on("mouseup.zoom",Y,!0),A=Ie(_,S),O=_.clientX,B=_.clientY;$o(_.view),er(_),I.mouse=[A,this.__zoom.invert(A)],xn(this),I.start();function H(X){if(At(X),!I.moved){var ee=X.clientX-O,J=X.clientY-B;I.moved=ee*ee+J*J>v}I.event(X).zoom("mouse",n(y(I.that.__zoom,I.mouse[0]=Ie(X,S),I.mouse[1]),I.extent,i))}function Y(X){R.on("mousemove.zoom mouseup.zoom",null),jo(X.view,I.moved),At(X),I.event(X).end()}}function F(_,...C){if(e.apply(this,arguments)){var S=this.__zoom,I=Ie(_.changedTouches?_.changedTouches[0]:_,this),R=S.invert(I),A=S.k*(_.shiftKey?.5:2),O=n(y(E(S,A),I,R),t.apply(this,C),i);At(_),a>0?ve(this).transition().duration(a).call(N,O,I,_):ve(this).call(m.transform,O,I,_)}}function M(_,...C){if(e.apply(this,arguments)){var S=_.touches,I=S.length,R=k(this,C,_.changedTouches.length===I).event(_),A,O,B,H;for(er(_),O=0;O<I;++O)B=S[O],H=Ie(B,this),H=[H,this.__zoom.invert(H),B.identifier],R.touch0?!R.touch1&&R.touch0[2]!==H[2]&&(R.touch1=H,R.taps=0):(R.touch0=H,A=!0,R.taps=1+!!d);d&&(d=clearTimeout(d)),A&&(R.taps<2&&(u=H[0],d=setTimeout(function(){d=null},h)),xn(this),R.start())}}function j(_,...C){if(this.__zooming){var S=k(this,C).event(_),I=_.changedTouches,R=I.length,A,O,B,H;for(At(_),A=0;A<R;++A)O=I[A],B=Ie(O,this),S.touch0&&S.touch0[2]===O.identifier?S.touch0[0]=B:S.touch1&&S.touch1[2]===O.identifier&&(S.touch1[0]=B);if(O=S.that.__zoom,S.touch1){var Y=S.touch0[0],X=S.touch0[1],ee=S.touch1[0],J=S.touch1[1],Z=(Z=ee[0]-Y[0])*Z+(Z=ee[1]-Y[1])*Z,$=($=J[0]-X[0])*$+($=J[1]-X[1])*$;O=E(O,Math.sqrt(Z/$)),B=[(Y[0]+ee[0])/2,(Y[1]+ee[1])/2],H=[(X[0]+J[0])/2,(X[1]+J[1])/2]}else if(S.touch0)B=S.touch0[0],H=S.touch0[1];else return;S.zoom("touch",n(y(O,B,H),S.extent,i))}}function V(_,...C){if(this.__zooming){var S=k(this,C).event(_),I=_.changedTouches,R=I.length,A,O;for(er(_),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),A=0;A<R;++A)O=I[A],S.touch0&&S.touch0[2]===O.identifier?delete S.touch0:S.touch1&&S.touch1[2]===O.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&(O=Ie(O,this),Math.hypot(u[0]-O[0],u[1]-O[1])<w)){var B=ve(this).on("dblclick.zoom");B&&B.apply(this,arguments)}}}return m.wheelDelta=function(_){return arguments.length?(r=typeof _=="function"?_:cn(+_),m):r},m.filter=function(_){return arguments.length?(e=typeof _=="function"?_:cn(!!_),m):e},m.touchable=function(_){return arguments.length?(s=typeof _=="function"?_:cn(!!_),m):s},m.extent=function(_){return arguments.length?(t=typeof _=="function"?_:cn([[+_[0][0],+_[0][1]],[+_[1][0],+_[1][1]]]),m):t},m.scaleExtent=function(_){return arguments.length?(o[0]=+_[0],o[1]=+_[1],m):[o[0],o[1]]},m.translateExtent=function(_){return arguments.length?(i[0][0]=+_[0][0],i[1][0]=+_[1][0],i[0][1]=+_[0][1],i[1][1]=+_[1][1],m):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},m.constrain=function(_){return arguments.length?(n=_,m):n},m.duration=function(_){return arguments.length?(a=+_,m):a},m.interpolate=function(_){return arguments.length?(c=_,m):c},m.on=function(){var _=l.on.apply(l,arguments);return _===l?m:_},m.clickDistance=function(_){return arguments.length?(v=(_=+_)*_,m):Math.sqrt(v)},m.tapDistance=function(_){return arguments.length?(w=+_,m):w},m}const De={error001:(e="react")=>`Seems like you have not used zustand provider as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},Ht=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Go=["Enter"," ","Escape"],Uo={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var vt;(function(e){e.Strict="strict",e.Loose="loose"})(vt||(vt={}));var st;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(st||(st={}));var Ot;(function(e){e.Partial="partial",e.Full="full"})(Ot||(Ot={}));const Zo={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ue;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ue||(Ue={}));var Bt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Bt||(Bt={}));var Q;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Q||(Q={}));const bs={[Q.Left]:Q.Right,[Q.Right]:Q.Left,[Q.Top]:Q.Bottom,[Q.Bottom]:Q.Top};function Qo(e){return e===null?null:e?"valid":"invalid"}const Jo=e=>"id"in e&&"source"in e&&"target"in e,Gd=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),zr=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Kt=(e,t=[0,0])=>{const{width:n,height:r}=Ke(e),s=e.origin??t,o=n*s[0],i=r*s[1];return{x:e.position.x-o,y:e.position.y-i}},Ud=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,s)=>{const o=typeof s=="string";let i=!t.nodeLookup&&!o?s:void 0;t.nodeLookup&&(i=o?t.nodeLookup.get(s):zr(s)?s:t.nodeLookup.get(s.id));const a=i?kn(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Tn(r,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Ln(n)},qt=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(s=>{(t.filter===void 0||t.filter(s))&&(n=Tn(n,kn(s)),r=!0)}),r?Ln(n):{x:0,y:0,width:0,height:0}},Hr=(e,t,[n,r,s]=[0,0,1],o=!1,i=!1)=>{const a={...Mt(t,[n,r,s]),width:t.width/s,height:t.height/s},c=[];for(const l of e.values()){const{measured:d,selectable:u=!0,hidden:f=!1}=l;if(i&&!u||f)continue;const h=d.width??l.width??l.initialWidth??null,p=d.height??l.height??l.initialHeight??null,v=Vt(a,_t(l)),w=(h??0)*(p??0),m=o&&v>0;(!l.internals.handleBounds||m||v>=w||l.dragging)&&c.push(l)}return c},Zd=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function Qd(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(s=>s.id)):null;return e.forEach(s=>{s.measured.width&&s.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!s.hidden)&&(!r||r.has(s.id))&&n.set(s.id,s)}),n}async function Jd({nodes:e,width:t,height:n,panZoom:r,minZoom:s,maxZoom:o},i){if(e.size===0)return!0;const a=Qd(e,i),c=qt(a),l=Br(c,t,n,(i==null?void 0:i.minZoom)??s,(i==null?void 0:i.maxZoom)??o,(i==null?void 0:i.padding)??.1);return await r.setViewport(l,{duration:i==null?void 0:i.duration,ease:i==null?void 0:i.ease,interpolate:i==null?void 0:i.interpolate}),!0}function ei({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:s,onError:o}){const i=n.get(e),a=i.parentId?n.get(i.parentId):void 0,{x:c,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},d=i.origin??r;let u=i.extent||s;if(i.extent==="parent"&&!i.expandParent)if(!a)o==null||o("005",De.error005());else{const h=a.measured.width,p=a.measured.height;h&&p&&(u=[[c,l],[c+h,l+p]])}else a&<(i.extent)&&(u=[[i.extent[0][0]+c,i.extent[0][1]+l],[i.extent[1][0]+c,i.extent[1][1]+l]]);const f=lt(u)?ct(t,u,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&(o==null||o("015",De.error015())),{position:{x:f.x-c+(i.measured.width??0)*d[0],y:f.y-l+(i.measured.height??0)*d[1]},positionAbsolute:f}}async function ef({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:s}){const o=new Set(e.map(f=>f.id)),i=[];for(const f of n){if(f.deletable===!1)continue;const h=o.has(f.id),p=!h&&f.parentId&&i.find(v=>v.id===f.parentId);(h||p)&&i.push(f)}const a=new Set(t.map(f=>f.id)),c=r.filter(f=>f.deletable!==!1),d=Zd(i,c);for(const f of c)a.has(f.id)&&!d.find(p=>p.id===f.id)&&d.push(f);if(!s)return{edges:d,nodes:i};const u=await s({nodes:i,edges:d});return typeof u=="boolean"?u?{edges:d,nodes:i}:{edges:[],nodes:[]}:u}const bt=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),ct=(e={x:0,y:0},t,n)=>({x:bt(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:bt(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function ti(e,t,n){const{width:r,height:s}=Ke(n),{x:o,y:i}=n.internals.positionAbsolute;return ct(e,[[o,i],[o+r,i+s]],t)}const _s=(e,t,n)=>e<t?bt(Math.abs(e-t),1,t)/t:e>n?-bt(Math.abs(e-n),1,t)/t:0,Or=(e,t,n=15,r=40)=>{const s=_s(e.x,r,t.width-r)*n,o=_s(e.y,r,t.height-r)*n;return[s,o]},Tn=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),_r=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Ln=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),_t=(e,t=[0,0])=>{var s,o;const{x:n,y:r}=zr(e)?e.internals.positionAbsolute:Kt(e,t);return{x:n,y:r,width:((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0,height:((o=e.measured)==null?void 0:o.height)??e.height??e.initialHeight??0}},kn=(e,t=[0,0])=>{var s,o;const{x:n,y:r}=zr(e)?e.internals.positionAbsolute:Kt(e,t);return{x:n,y:r,x2:n+(((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0),y2:r+(((o=e.measured)==null?void 0:o.height)??e.height??e.initialHeight??0)}},ni=(e,t)=>Ln(Tn(_r(e),_r(t))),Vt=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},Es=e=>je(e.width)&&je(e.height)&&je(e.x)&&je(e.y),je=e=>!isNaN(e)&&isFinite(e),ri=(e,t)=>(n,r)=>{},Gt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Mt=({x:e,y:t},[n,r,s],o=!1,i=[1,1])=>{const a={x:(e-n)/s,y:(t-r)/s};return o?Gt(a,i):a},Et=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r});function ht(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function tf(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=ht(e,n),s=ht(e,t);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof e=="object"){const r=ht(e.top??e.y??0,n),s=ht(e.bottom??e.y??0,n),o=ht(e.left??e.x??0,t),i=ht(e.right??e.x??0,t);return{top:r,right:i,bottom:s,left:o,x:o+i,y:r+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function nf(e,t,n,r,s,o){const{x:i,y:a}=Et(e,[t,n,r]),{x:c,y:l}=Et({x:e.x+e.width,y:e.y+e.height},[t,n,r]),d=s-c,u=o-l;return{left:Math.floor(i),top:Math.floor(a),right:Math.floor(d),bottom:Math.floor(u)}}const Br=(e,t,n,r,s,o)=>{const i=tf(o,t,n),a=(t-i.x)/e.width,c=(n-i.y)/e.height,l=Math.min(a,c),d=bt(l,r,s),u=e.x+e.width/2,f=e.y+e.height/2,h=t/2-u*d,p=n/2-f*d,v=nf(e,h,p,d,t,n),w={left:Math.min(v.left-i.left,0),top:Math.min(v.top-i.top,0),right:Math.min(v.right-i.right,0),bottom:Math.min(v.bottom-i.bottom,0)};return{x:h-w.left+w.right,y:p-w.top+w.bottom,zoom:d}},Ft=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function lt(e){return e!=null&&e!=="parent"}function Ke(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function si(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function oi(e,t={width:0,height:0},n,r,s){const o={...e},i=r.get(n);if(i){const a=i.origin||s;o.x+=i.internals.positionAbsolute.x-(t.width??0)*a[0],o.y+=i.internals.positionAbsolute.y-(t.height??0)*a[1]}return o}function Ns(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function rf(){let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}function sf(e){return{...Uo,...e||{}}}function Dt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:o,y:i}=Pe(e),a=Mt({x:o-((s==null?void 0:s.left)??0),y:i-((s==null?void 0:s.top)??0)},r),{x:c,y:l}=n?Gt(a,t):a;return{xSnapped:c,ySnapped:l,...a}}const Vr=e=>({width:e.offsetWidth,height:e.offsetHeight}),ii=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},of=["INPUT","SELECT","TEXTAREA"];function ai(e){var r,s;const t=((s=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:s[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:of.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const ci=e=>"clientX"in e,Pe=(e,t)=>{var o,i;const n=ci(e),r=n?e.clientX:(o=e.touches)==null?void 0:o[0].clientX,s=n?e.clientY:(i=e.touches)==null?void 0:i[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:s-((t==null?void 0:t.top)??0)}},Ss=(e,t,n,r,s)=>{const o=t.querySelectorAll(`.${e}`);return!o||!o.length?null:Array.from(o).map(i=>{const a=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:s,position:i.getAttribute("data-handlepos"),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...Vr(i)}})};function li({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:s,sourceControlY:o,targetControlX:i,targetControlY:a}){const c=e*.125+s*.375+i*.375+n*.125,l=t*.125+o*.375+a*.375+r*.125,d=Math.abs(c-e),u=Math.abs(l-t);return[c,l,d,u]}function ln(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function ks({pos:e,x1:t,y1:n,x2:r,y2:s,c:o}){switch(e){case Q.Left:return[t-ln(t-r,o),n];case Q.Right:return[t+ln(r-t,o),n];case Q.Top:return[t,n-ln(n-s,o)];case Q.Bottom:return[t,n+ln(s-n,o)]}}function ui({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:s,targetPosition:o=Q.Top,curvature:i=.25}){const[a,c]=ks({pos:n,x1:e,y1:t,x2:r,y2:s,c:i}),[l,d]=ks({pos:o,x1:r,y1:s,x2:e,y2:t,c:i}),[u,f,h,p]=li({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:d});return[`M${e},${t} C${a},${c} ${l},${d} ${r},${s}`,u,f,h,p]}function di({sourceX:e,sourceY:t,targetX:n,targetY:r}){const s=Math.abs(n-e)/2,o=n<e?n+s:n-s,i=Math.abs(r-t)/2,a=r<t?r+i:r-i;return[o,a,s,i]}function af({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:s=!1,zIndexMode:o="basic"}){if(o==="manual")return r;const i=s&&n?r+1e3:r,a=Math.max(e.parentId||s&&e.selected?e.internals.z:0,t.parentId||s&&t.selected?t.internals.z:0);return i+a}function cf({sourceNode:e,targetNode:t,width:n,height:r,transform:s}){const o=Tn(kn(e),kn(t));o.x===o.x2&&(o.x2+=1),o.y===o.y2&&(o.y2+=1);const i={x:-s[0]/s[2],y:-s[1]/s[2],width:n/s[2],height:r/s[2]};return Vt(i,Ln(o))>0}const lf=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,uf=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),df=(e,t,n={})=>{var o;if(!e.source||!e.target)return(o=n.onError)==null||o.call(n,"006",De.error006()),t;const r=n.getEdgeId||lf;let s;return Jo(e)?s={...e}:s={...e,id:r(e)},uf(s,t)?t:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,t.concat(s))};function fi({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,o,i,a]=di({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,o,i,a]}const Ms={[Q.Left]:{x:-1,y:0},[Q.Right]:{x:1,y:0},[Q.Top]:{x:0,y:-1},[Q.Bottom]:{x:0,y:1}},ff=({source:e,sourcePosition:t=Q.Bottom,target:n})=>t===Q.Left||t===Q.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Cs=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function hf({source:e,sourcePosition:t=Q.Bottom,target:n,targetPosition:r=Q.Top,center:s,offset:o,stepPosition:i}){const a=Ms[t],c=Ms[r],l={x:e.x+a.x*o,y:e.y+a.y*o},d={x:n.x+c.x*o,y:n.y+c.y*o},u=ff({source:l,sourcePosition:t,target:d}),f=u.x!==0?"x":"y",h=u[f];let p=[],v,w;const m={x:0,y:0},E={x:0,y:0},[,,y,x]=di({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*c[f]===-1){f==="x"?(v=s.x??l.x+(d.x-l.x)*i,w=s.y??(l.y+d.y)/2):(v=s.x??(l.x+d.x)/2,w=s.y??l.y+(d.y-l.y)*i);const D=[{x:v,y:l.y},{x:v,y:d.y}],L=[{x:l.x,y:w},{x:d.x,y:w}];a[f]===h?p=f==="x"?D:L:p=f==="x"?L:D}else{const D=[{x:l.x,y:d.y}],L=[{x:d.x,y:l.y}];if(f==="x"?p=a.x===h?L:D:p=a.y===h?D:L,t===r){const _=Math.abs(e[f]-n[f]);if(_<=o){const C=Math.min(o-1,o-_);a[f]===h?m[f]=(l[f]>e[f]?-1:1)*C:E[f]=(d[f]>n[f]?-1:1)*C}}if(t!==r){const _=f==="x"?"y":"x",C=a[f]===c[_],S=l[_]>d[_],I=l[_]<d[_];(a[f]===1&&(!C&&S||C&&I)||a[f]!==1&&(!C&&I||C&&S))&&(p=f==="x"?D:L)}const F={x:l.x+m.x,y:l.y+m.y},M={x:d.x+E.x,y:d.y+E.y},j=Math.max(Math.abs(F.x-p[0].x),Math.abs(M.x-p[0].x)),V=Math.max(Math.abs(F.y-p[0].y),Math.abs(M.y-p[0].y));j>=V?(v=(F.x+M.x)/2,w=p[0].y):(v=p[0].x,w=(F.y+M.y)/2)}const N={x:l.x+m.x,y:l.y+m.y},k={x:d.x+E.x,y:d.y+E.y};return[[e,...N.x!==p[0].x||N.y!==p[0].y?[N]:[],...p,...k.x!==p[p.length-1].x||k.y!==p[p.length-1].y?[k]:[],n],v,w,y,x]}function gf(e,t,n,r){const s=Math.min(Cs(e,t)/2,Cs(t,n)/2,r),{x:o,y:i}=t;if(e.x===o&&o===n.x||e.y===i&&i===n.y)return`L${o} ${i}`;if(e.y===i){const l=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${o+s*l},${i}Q ${o},${i} ${o},${i+s*d}`}const a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${o},${i+s*c}Q ${o},${i} ${o+s*a},${i}`}function Er({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:s,targetPosition:o=Q.Top,borderRadius:i=5,centerX:a,centerY:c,offset:l=20,stepPosition:d=.5}){const[u,f,h,p,v]=hf({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:s},targetPosition:o,center:{x:a,y:c},offset:l,stepPosition:d});let w=`M${u[0].x} ${u[0].y}`;for(let m=1;m<u.length-1;m++)w+=gf(u[m-1],u[m],u[m+1],i);return w+=`L${u[u.length-1].x} ${u[u.length-1].y}`,[w,f,h,p,v]}function As(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function pf(e){var u;const{sourceNode:t,targetNode:n}=e;if(!As(t)||!As(n))return null;const r=t.internals.handleBounds||Is(t.handles),s=n.internals.handleBounds||Is(n.handles),o=$s((r==null?void 0:r.source)??[],e.sourceHandle),i=$s(e.connectionMode===vt.Strict?(s==null?void 0:s.target)??[]:((s==null?void 0:s.target)??[]).concat((s==null?void 0:s.source)??[]),e.targetHandle);if(!o||!i)return(u=e.onError)==null||u.call(e,"008",De.error008(o?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=(o==null?void 0:o.position)||Q.Bottom,c=(i==null?void 0:i.position)||Q.Top,l=ut(t,o,a),d=ut(n,i,c);return{sourceX:l.x,sourceY:l.y,targetX:d.x,targetY:d.y,sourcePosition:a,targetPosition:c}}function Is(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function ut(e,t,n=Q.Left,r=!1){const s=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,o=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:i,height:a}=t??Ke(e);if(r)return{x:s+i/2,y:o+a/2};switch((t==null?void 0:t.position)??n){case Q.Top:return{x:s+i/2,y:o};case Q.Right:return{x:s+i,y:o+a/2};case Q.Bottom:return{x:s+i/2,y:o+a};case Q.Left:return{x:s,y:o+a/2}}}function $s(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Nr(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function mf(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:s}){const o=new Set;return e.reduce((i,a)=>([a.markerStart||r,a.markerEnd||s].forEach(c=>{if(c&&typeof c=="object"){const l=Nr(c,t);o.has(l)||(i.push({id:l,color:c.color||n,...c}),o.add(l))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))}const hi=1e3,yf=10,Fr={nodeOrigin:[0,0],nodeExtent:Ht,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},xf={...Fr,checkEquality:!0};function Wr(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function wf(e,t,n){const r=Wr(Fr,n);for(const s of e.values())if(s.parentId)Xr(s,e,t,r);else{const o=Kt(s,r.nodeOrigin),i=lt(s.extent)?s.extent:r.nodeExtent,a=ct(o,i,Ke(s));s.internals.positionAbsolute=a}}function vf(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const s of e.handles){const o={id:s.id,width:s.width??1,height:s.height??1,nodeId:e.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?n.push(o):s.type==="target"&&r.push(o)}return{source:n,target:r}}function Yr(e){return e==="manual"}function Sr(e,t,n,r={}){var d,u;const s=Wr(xf,r),o={i:0},i=new Map(t),a=s!=null&&s.elevateNodesOnSelect&&!Yr(s.zIndexMode)?hi:0;let c=e.length>0,l=!1;t.clear(),n.clear();for(const f of e){let h=i.get(f.id);if(s.checkEquality&&f===(h==null?void 0:h.internals.userNode))t.set(f.id,h);else{const p=Kt(f,s.nodeOrigin),v=lt(f.extent)?f.extent:s.nodeExtent,w=ct(p,v,Ke(f));h={...s.defaults,...f,measured:{width:(d=f.measured)==null?void 0:d.width,height:(u=f.measured)==null?void 0:u.height},internals:{positionAbsolute:w,handleBounds:vf(f,h),z:gi(f,a,s.zIndexMode),userNode:f}},t.set(f.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(c=!1),f.parentId&&Xr(h,t,n,r,o),l||(l=f.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:l}}function bf(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Xr(e,t,n,r,s){const{elevateNodesOnSelect:o,nodeOrigin:i,nodeExtent:a,zIndexMode:c}=Wr(Fr,r),l=e.parentId,d=t.get(l);if(!d){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}bf(e,n),s&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++s.i,d.internals.z=d.internals.z+s.i*yf),s&&d.internals.rootParentIndex!==void 0&&(s.i=d.internals.rootParentIndex);const u=o&&!Yr(c)?hi:0,{x:f,y:h,z:p}=_f(e,d,i,a,u,c),{positionAbsolute:v}=e.internals,w=f!==v.x||h!==v.y;(w||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:w?{x:f,y:h}:v,z:p}})}function gi(e,t,n){const r=je(e.zIndex)?e.zIndex:0;return Yr(n)?r:r+(e.selected?t:0)}function _f(e,t,n,r,s,o){const{x:i,y:a}=t.internals.positionAbsolute,c=Ke(e),l=Kt(e,n),d=lt(e.extent)?ct(l,e.extent,c):l;let u=ct({x:i+d.x,y:a+d.y},r,c);e.extent==="parent"&&(u=ti(u,c,t));const f=gi(e,s,o),h=t.internals.z??0;return{x:u.x,y:u.y,z:h>=f?h+1:f}}function Kr(e,t,n,r=[0,0]){var i;const s=[],o=new Map;for(const a of e){const c=t.get(a.parentId);if(!c)continue;const l=((i=o.get(a.parentId))==null?void 0:i.expandedRect)??_t(c),d=ni(l,a.rect);o.set(a.parentId,{expandedRect:d,parent:c})}return o.size>0&&o.forEach(({expandedRect:a,parent:c},l)=>{var y;const d=c.internals.positionAbsolute,u=Ke(c),f=c.origin??r,h=a.x<d.x?Math.round(Math.abs(d.x-a.x)):0,p=a.y<d.y?Math.round(Math.abs(d.y-a.y)):0,v=Math.max(u.width,Math.round(a.width)),w=Math.max(u.height,Math.round(a.height)),m=(v-u.width)*f[0],E=(w-u.height)*f[1];(h>0||p>0||m||E)&&(s.push({id:l,type:"position",position:{x:c.position.x-h+m,y:c.position.y-p+E}}),(y=n.get(l))==null||y.forEach(x=>{e.some(N=>N.id===x.id)||s.push({id:x.id,type:"position",position:{x:x.position.x+h,y:x.position.y+p}})})),(u.width<a.width||u.height<a.height||h||p)&&s.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:v+(h?f[0]*h-m:0),height:w+(p?f[1]*p-E:0)}})}),s}function Ef(e,t,n,r,s,o,i){const a=r==null?void 0:r.querySelector(".xyflow__viewport");let c=!1;if(!a)return{changes:[],updatedInternals:c};const l=[],d=window.getComputedStyle(a),{m22:u}=new window.DOMMatrixReadOnly(d.transform),f=[];for(const h of e.values()){const p=t.get(h.id);if(!p)continue;if(p.hidden){t.set(p.id,{...p,internals:{...p.internals,handleBounds:void 0}}),c=!0;continue}const v=Vr(h.nodeElement),w=p.measured.width!==v.width||p.measured.height!==v.height;if(!!(v.width&&v.height&&(w||!p.internals.handleBounds||h.force))){const E=h.nodeElement.getBoundingClientRect(),y=lt(p.extent)?p.extent:o;let{positionAbsolute:x}=p.internals;p.parentId&&p.extent==="parent"?x=ti(x,v,t.get(p.parentId)):y&&(x=ct(x,y,v));const N={...p,measured:v,internals:{...p.internals,positionAbsolute:x,handleBounds:{source:Ss("source",h.nodeElement,E,u,p.id),target:Ss("target",h.nodeElement,E,u,p.id)}}};t.set(p.id,N),p.parentId&&Xr(N,t,n,{nodeOrigin:s,zIndexMode:i}),c=!0,w&&(l.push({id:p.id,type:"dimensions",dimensions:v}),p.expandParent&&p.parentId&&f.push({id:p.id,parentId:p.parentId,rect:_t(N,s)}))}}if(f.length>0){const h=Kr(f,t,n,s);l.push(...h)}return{changes:l,updatedInternals:c}}async function Nf({delta:e,panZoom:t,transform:n,translateExtent:r,width:s,height:o}){if(!t||!e.x&&!e.y)return!1;const i=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[s,o]],r);return!!i&&(i.x!==n[0]||i.y!==n[1]||i.k!==n[2])}function js(e,t,n,r,s,o){let i=s;const a=r.get(i)||new Map;r.set(i,a.set(n,t)),i=`${s}-${e}`;const c=r.get(i)||new Map;if(r.set(i,c.set(n,t)),o){i=`${s}-${e}-${o}`;const l=r.get(i)||new Map;r.set(i,l.set(n,t))}}function pi(e,t,n){e.clear(),t.clear();for(const r of n){const{source:s,target:o,sourceHandle:i=null,targetHandle:a=null}=r,c={edgeId:r.id,source:s,target:o,sourceHandle:i,targetHandle:a},l=`${s}-${i}--${o}-${a}`,d=`${o}-${a}--${s}-${i}`;js("source",c,d,e,s,i),js("target",c,l,e,o,a),t.set(r.id,r)}}function mi(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:mi(n,t):!1}function Ps(e,t,n){var s;let r=e;do{if((s=r==null?void 0:r.matches)!=null&&s.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function Sf(e,t,n,r){const s=new Map;for(const[o,i]of e)if((i.selected||i.id===r)&&(!i.parentId||!mi(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){const a=e.get(o);a&&s.set(o,{id:o,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 s}function tr({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var i,a,c;const s=[];for(const[l,d]of t){const u=(i=n.get(l))==null?void 0:i.internals.userNode;u&&s.push({...u,position:d.position,dragging:r})}if(!e)return[s[0],s];const o=(a=n.get(e))==null?void 0:a.internals.userNode;return[o?{...o,position:((c=t.get(e))==null?void 0:c.position)||o.position,dragging:r}:s[0],s]}function kf({dragItems:e,snapGrid:t,x:n,y:r}){const s=e.values().next().value;if(!s)return null;const o={x:n-s.distance.x,y:r-s.distance.y},i=Gt(o,t);return{x:i.x-o.x,y:i.y-o.y}}function Mf({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:s}){let o={x:null,y:null},i=0,a=new Map,c=!1,l={x:0,y:0},d=null,u=!1,f=null,h=!1,p=!1,v=null;function w({noDragClassName:E,handleSelector:y,domNode:x,isSelectable:N,nodeId:k,nodeClickDistance:P=0}){f=ve(x);function D({x:j,y:V}){const{nodeLookup:_,nodeExtent:C,snapGrid:S,snapToGrid:I,nodeOrigin:R,onNodeDrag:A,onSelectionDrag:O,onError:B,updateNodePositions:H}=t();o={x:j,y:V};let Y=!1;const X=a.size>1,ee=X&&C?_r(qt(a)):null,J=X&&I?kf({dragItems:a,snapGrid:S,x:j,y:V}):null;for(const[Z,$]of a){if(!_.has(Z))continue;let W={x:j-$.distance.x,y:V-$.distance.y};I&&(W=J?{x:Math.round(W.x+J.x),y:Math.round(W.y+J.y)}:Gt(W,S));let ne=null;if(X&&C&&!$.extent&&ee){const{positionAbsolute:G}=$.internals,re=G.x-ee.x+C[0][0],se=G.x+$.measured.width-ee.x2+C[1][0],ie=G.y-ee.y+C[0][1],ce=G.y+$.measured.height-ee.y2+C[1][1];ne=[[re,ie],[se,ce]]}const{position:te,positionAbsolute:q}=ei({nodeId:Z,nextPosition:W,nodeLookup:_,nodeExtent:ne||C,nodeOrigin:R,onError:B});Y=Y||$.position.x!==te.x||$.position.y!==te.y,$.position=te,$.internals.positionAbsolute=q}if(p=p||Y,!!Y&&(H(a,!0),v&&(r||A||!k&&O))){const[Z,$]=tr({nodeId:k,dragItems:a,nodeLookup:_});r==null||r(v,a,Z,$),A==null||A(v,Z,$),k||O==null||O(v,$)}}async function L(){if(!d)return;const{transform:j,panBy:V,autoPanSpeed:_,autoPanOnNodeDrag:C}=t();if(!C){c=!1,cancelAnimationFrame(i);return}const[S,I]=Or(l,d,_);(S!==0||I!==0)&&(o.x=(o.x??0)-S/j[2],o.y=(o.y??0)-I/j[2],await V({x:S,y:I})&&D(o)),i=requestAnimationFrame(L)}function F(j){var X;const{nodeLookup:V,multiSelectionActive:_,nodesDraggable:C,transform:S,snapGrid:I,snapToGrid:R,selectNodesOnDrag:A,onNodeDragStart:O,onSelectionDragStart:B,unselectNodesAndEdges:H}=t();u=!0,(!A||!N)&&!_&&k&&((X=V.get(k))!=null&&X.selected||H()),N&&A&&k&&(e==null||e(k));const Y=Dt(j.sourceEvent,{transform:S,snapGrid:I,snapToGrid:R,containerBounds:d});if(o=Y,a=Sf(V,C,Y,k),a.size>0&&(n||O||!k&&B)){const[ee,J]=tr({nodeId:k,dragItems:a,nodeLookup:V});n==null||n(j.sourceEvent,a,ee,J),O==null||O(j.sourceEvent,ee,J),k||B==null||B(j.sourceEvent,J)}}const M=Po().clickDistance(P).on("start",j=>{const{domNode:V,nodeDragThreshold:_,transform:C,snapGrid:S,snapToGrid:I}=t();d=(V==null?void 0:V.getBoundingClientRect())||null,h=!1,p=!1,v=j.sourceEvent,_===0&&F(j),o=Dt(j.sourceEvent,{transform:C,snapGrid:S,snapToGrid:I,containerBounds:d}),l=Pe(j.sourceEvent,d)}).on("drag",j=>{const{autoPanOnNodeDrag:V,transform:_,snapGrid:C,snapToGrid:S,nodeDragThreshold:I,nodeLookup:R}=t(),A=Dt(j.sourceEvent,{transform:_,snapGrid:C,snapToGrid:S,containerBounds:d});if(v=j.sourceEvent,(j.sourceEvent.type==="touchmove"&&j.sourceEvent.touches.length>1||k&&!R.has(k))&&(h=!0),!h){if(!c&&V&&u&&(c=!0,L()),!u){const O=Pe(j.sourceEvent,d),B=O.x-l.x,H=O.y-l.y;Math.sqrt(B*B+H*H)>I&&F(j)}(o.x!==A.xSnapped||o.y!==A.ySnapped)&&a&&u&&(l=Pe(j.sourceEvent,d),D(A))}}).on("end",j=>{if(!u||h){h&&a.size>0&&t().updateNodePositions(a,!1);return}if(c=!1,u=!1,cancelAnimationFrame(i),a.size>0){const{nodeLookup:V,updateNodePositions:_,onNodeDragStop:C,onSelectionDragStop:S}=t();if(p&&(_(a,!1),p=!1),s||C||!k&&S){const[I,R]=tr({nodeId:k,dragItems:a,nodeLookup:V,dragging:!1});s==null||s(j.sourceEvent,a,I,R),C==null||C(j.sourceEvent,I,R),k||S==null||S(j.sourceEvent,R)}}}).filter(j=>{const V=j.target;return!j.button&&(!E||!Ps(V,`.${E}`,x))&&(!y||Ps(V,y,x))});f.call(M)}function m(){f==null||f.on(".drag",null)}return{update:w,destroy:m}}function Cf(e,t,n){const r=[],s={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const o of t.values())Vt(s,_t(o))>0&&r.push(o);return r}const Af=250;function If(e,t,n,r){var a,c;let s=[],o=1/0;const i=Cf(e,n,t+Af);for(const l of i){const d=[...((a=l.internals.handleBounds)==null?void 0:a.source)??[],...((c=l.internals.handleBounds)==null?void 0:c.target)??[]];for(const u of d){if(r.nodeId===u.nodeId&&r.type===u.type&&r.id===u.id)continue;const{x:f,y:h}=ut(l,u,u.position,!0),p=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(h-e.y,2));p>t||(p<o?(s=[{...u,x:f,y:h}],o=p):p===o&&s.push({...u,x:f,y:h}))}}if(!s.length)return null;if(s.length>1){const l=r.type==="source"?"target":"source";return s.find(d=>d.type===l)??s[0]}return s[0]}function yi(e,t,n,r,s,o=!1){var l,d,u;const i=r.get(e);if(!i)return null;const a=s==="strict"?(l=i.internals.handleBounds)==null?void 0:l[t]:[...((d=i.internals.handleBounds)==null?void 0:d.source)??[],...((u=i.internals.handleBounds)==null?void 0:u.target)??[]],c=(n?a==null?void 0:a.find(f=>f.id===n):a==null?void 0:a[0])??null;return c&&o?{...c,...ut(i,c,c.position,!0)}:c}function xi(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function $f(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const wi=()=>!0;function jf(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:s,edgeUpdaterType:o,isTarget:i,domNode:a,nodeLookup:c,lib:l,autoPanOnConnect:d,flowId:u,panBy:f,cancelConnection:h,onConnectStart:p,onConnect:v,onConnectEnd:w,isValidConnection:m=wi,onReconnectEnd:E,updateConnection:y,getTransform:x,getFromHandle:N,autoPanSpeed:k,dragThreshold:P=1,handleDomNode:D}){const L=ii(e.target);let F=0,M;const{x:j,y:V}=Pe(e),_=xi(o,D),C=a==null?void 0:a.getBoundingClientRect();let S=!1;if(!C||!_)return;const I=yi(s,_,r,c,t);if(!I)return;let R=Pe(e,C),A=!1,O=null,B=!1,H=null;function Y(){if(!d||!C)return;const[te,q]=Or(R,C,k);f({x:te,y:q}),F=requestAnimationFrame(Y)}const X={...I,nodeId:s,type:_,position:I.position},ee=c.get(s);let Z={inProgress:!0,isValid:null,from:ut(ee,X,Q.Left,!0),fromHandle:X,fromPosition:X.position,fromNode:ee,to:R,toHandle:null,toPosition:bs[X.position],toNode:null,pointer:R};function $(){S=!0,y(Z),p==null||p(e,{nodeId:s,handleId:r,handleType:_})}P===0&&$();function W(te){if(!S){const{x:ce,y:me}=Pe(te),_e=ce-j,ye=me-V;if(!(_e*_e+ye*ye>P*P))return;$()}if(!N()||!X){ne(te);return}const q=x();R=Pe(te,C),M=If(Mt(R,q,!1,[1,1]),n,c,X),A||(Y(),A=!0);const G=vi(te,{handle:M,connectionMode:t,fromNodeId:s,fromHandleId:r,fromType:i?"target":"source",isValidConnection:m,doc:L,lib:l,flowId:u,nodeLookup:c});H=G.handleDomNode,O=G.connection,B=$f(!!M,G.isValid);const re=c.get(s),se=re?ut(re,X,Q.Left,!0):Z.from,ie={...Z,from:se,isValid:B,to:G.toHandle&&B?Et({x:G.toHandle.x,y:G.toHandle.y},q):R,toHandle:G.toHandle,toPosition:B&&G.toHandle?G.toHandle.position:bs[X.position],toNode:G.toHandle?c.get(G.toHandle.nodeId):null,pointer:R};y(ie),Z=ie}function ne(te){if(!("touches"in te&&te.touches.length>0)){if(S){(M||H)&&O&&B&&(v==null||v(O));const{inProgress:q,...G}=Z,re={...G,toPosition:Z.toHandle?Z.toPosition:null};w==null||w(te,re),o&&(E==null||E(te,re))}h(),cancelAnimationFrame(F),A=!1,B=!1,O=null,H=null,L.removeEventListener("mousemove",W),L.removeEventListener("mouseup",ne),L.removeEventListener("touchmove",W),L.removeEventListener("touchend",ne)}}L.addEventListener("mousemove",W),L.addEventListener("mouseup",ne),L.addEventListener("touchmove",W),L.addEventListener("touchend",ne)}function vi(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:o,doc:i,lib:a,flowId:c,isValidConnection:l=wi,nodeLookup:d}){const u=o==="target",f=t?i.querySelector(`.${a}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:h,y:p}=Pe(e),v=i.elementFromPoint(h,p),w=v!=null&&v.classList.contains(`${a}-flow__handle`)?v:f,m={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const E=xi(void 0,w),y=w.getAttribute("data-nodeid"),x=w.getAttribute("data-handleid"),N=w.classList.contains("connectable"),k=w.classList.contains("connectableend");if(!y||!E)return m;const P={source:u?y:r,sourceHandle:u?x:s,target:u?r:y,targetHandle:u?s:x};m.connection=P;const L=N&&k&&(n===vt.Strict?u&&E==="source"||!u&&E==="target":y!==r||x!==s);m.isValid=L&&l(P),m.toHandle=yi(y,E,x,d,n,!0)}return m}const kr={onPointerDown:jf,isValid:vi};function Pf({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const s=ve(e);function o({translateExtent:a,width:c,height:l,zoomStep:d=1,pannable:u=!0,zoomable:f=!0,inversePan:h=!1}){const p=y=>{if(y.sourceEvent.type!=="wheel"||!t)return;const x=n(),N=y.sourceEvent.ctrlKey&&Ft()?10:1,k=-y.sourceEvent.deltaY*(y.sourceEvent.deltaMode===1?.05:y.sourceEvent.deltaMode?1:.002)*d,P=x[2]*Math.pow(2,k*N);t.scaleTo(P)};let v=[0,0];const w=y=>{(y.sourceEvent.type==="mousedown"||y.sourceEvent.type==="touchstart")&&(v=[y.sourceEvent.clientX??y.sourceEvent.touches[0].clientX,y.sourceEvent.clientY??y.sourceEvent.touches[0].clientY])},m=y=>{const x=n();if(y.sourceEvent.type!=="mousemove"&&y.sourceEvent.type!=="touchmove"||!t)return;const N=[y.sourceEvent.clientX??y.sourceEvent.touches[0].clientX,y.sourceEvent.clientY??y.sourceEvent.touches[0].clientY],k=[N[0]-v[0],N[1]-v[1]];v=N;const P=r()*Math.max(x[2],Math.log(x[2]))*(h?-1:1),D={x:x[0]-k[0]*P,y:x[1]-k[1]*P},L=[[0,0],[c,l]];t.setViewportConstrained({x:D.x,y:D.y,zoom:x[2]},L,a)},E=qo().on("start",w).on("zoom",u?m:null).on("zoom.wheel",f?p:null);s.call(E,{})}function i(){s.on("zoom",null)}return{update:o,destroy:i,pointer:Ie}}const Rn=e=>({x:e.x,y:e.y,zoom:e.k}),nr=({x:e,y:t,zoom:n})=>Dn.translate(e,t).scale(n),gt=(e,t)=>e.target.closest(`.${t}`),bi=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Df=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,rr=(e,t=0,n=Df,r=()=>{})=>{const s=typeof t=="number"&&t>0;return s||r(),s?e.transition().duration(t).ease(n).on("end",r):e},_i=e=>{const t=e.ctrlKey&&Ft()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Tf({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:o,zoomOnPinch:i,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:l}){return d=>{if(gt(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(d.ctrlKey&&i){const w=Ie(d),m=_i(d),E=u*Math.pow(2,m);r.scaleTo(n,E,w,d);return}const f=d.deltaMode===1?20:1;let h=s===st.Vertical?0:d.deltaX*f,p=s===st.Horizontal?0:d.deltaY*f;!Ft()&&d.shiftKey&&s!==st.Vertical&&(h=d.deltaY*f,p=0),r.translateBy(n,-(h/u)*o,-(p/u)*o,{internal:!0});const v=Rn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,v),e.panScrollTimeout=setTimeout(()=>{l==null||l(d,v),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a==null||a(d,v))}}function Lf({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,s){const o=r.type==="wheel",i=!t&&o&&!r.ctrlKey,a=gt(r,e);if(r.ctrlKey&&o&&a&&r.preventDefault(),i||a)return null;r.preventDefault(),n.call(this,r,s)}}function Rf({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var o,i,a;if((o=r.sourceEvent)!=null&&o.internal)return;const s=Rn(r.transform);e.mouseButton=((i=r.sourceEvent)==null?void 0:i.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=s,((a=r.sourceEvent)==null?void 0:a.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,s))}}function zf({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return o=>{var i,a;e.usedRightMouseButton=!!(n&&bi(t,e.mouseButton??0)),(i=o.sourceEvent)!=null&&i.sync||r([o.transform.x,o.transform.y,o.transform.k]),s&&!((a=o.sourceEvent)!=null&&a.internal)&&(s==null||s(o.sourceEvent,Rn(o.transform)))}}function Hf({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:s,onPaneContextMenu:o}){return i=>{var a;if(!((a=i.sourceEvent)!=null&&a.internal)&&(e.isZoomingOrPanning=!1,o&&bi(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&o(i.sourceEvent),e.usedRightMouseButton=!1,r(!1),s)){const c=Rn(i.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(i.sourceEvent,c)},n?150:0)}}}function Of({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:s,zoomOnDoubleClick:o,userSelectionActive:i,noWheelClassName:a,noPanClassName:c,lib:l,connectionInProgress:d}){return u=>{var w;const f=e||t,h=n&&u.ctrlKey,p=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(gt(u,`${l}-flow__node`)||gt(u,`${l}-flow__edge`)))return!0;if(!r&&!f&&!s&&!o&&!n||i||d&&!p||gt(u,a)&&p||gt(u,c)&&(!p||s&&p&&!e)||!n&&u.ctrlKey&&p)return!1;if(!n&&u.type==="touchstart"&&((w=u.touches)==null?void 0:w.length)>1)return u.preventDefault(),!1;if(!f&&!s&&!h&&p||!r&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(r)&&!r.includes(u.button)&&u.type==="mousedown")return!1;const v=Array.isArray(r)&&r.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||p)&&v}}function Bf({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:s,onPanZoom:o,onPanZoomStart:i,onPanZoomEnd:a,onDraggingChange:c}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),u=qo().scaleExtent([t,n]).translateExtent(r),f=ve(e).call(u);E({x:s.x,y:s.y,zoom:bt(s.zoom,t,n)},[[0,0],[d.width,d.height]],r);const h=f.on("wheel.zoom"),p=f.on("dblclick.zoom");u.wheelDelta(_i);async function v(M,j){return f?new Promise(V=>{u==null||u.interpolate((j==null?void 0:j.interpolate)==="linear"?Pt:pn).transform(rr(f,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>V(!0)),M)}):!1}function w({noWheelClassName:M,noPanClassName:j,onPaneContextMenu:V,userSelectionActive:_,panOnScroll:C,panOnDrag:S,panOnScrollMode:I,panOnScrollSpeed:R,preventScrolling:A,zoomOnPinch:O,zoomOnScroll:B,zoomOnDoubleClick:H,zoomActivationKeyPressed:Y,lib:X,onTransformChange:ee,connectionInProgress:J,paneClickDistance:Z,selectionOnDrag:$}){_&&!l.isZoomingOrPanning&&m();const W=C&&!Y&&!_;u.clickDistance($?1/0:!je(Z)||Z<0?0:Z);const ne=W?Tf({zoomPanValues:l,noWheelClassName:M,d3Selection:f,d3Zoom:u,panOnScrollMode:I,panOnScrollSpeed:R,zoomOnPinch:O,onPanZoomStart:i,onPanZoom:o,onPanZoomEnd:a}):Lf({noWheelClassName:M,preventScrolling:A,d3ZoomHandler:h});f.on("wheel.zoom",ne,{passive:!1});const te=Rf({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:i});u.on("start",te);const q=zf({zoomPanValues:l,panOnDrag:S,onPaneContextMenu:!!V,onPanZoom:o,onTransformChange:ee});u.on("zoom",q);const G=Hf({zoomPanValues:l,panOnDrag:S,panOnScroll:C,onPaneContextMenu:V,onPanZoomEnd:a,onDraggingChange:c});u.on("end",G);const re=Of({zoomActivationKeyPressed:Y,panOnDrag:S,zoomOnScroll:B,panOnScroll:C,zoomOnDoubleClick:H,zoomOnPinch:O,userSelectionActive:_,noPanClassName:j,noWheelClassName:M,lib:X,connectionInProgress:J});u.filter(re),H?f.on("dblclick.zoom",p):f.on("dblclick.zoom",null)}function m(){u.on("zoom",null)}async function E(M,j,V){const _=nr(M),C=u==null?void 0:u.constrain()(_,j,V);return C&&await v(C),C}async function y(M,j){const V=nr(M);return await v(V,j),V}function x(M){if(f){const j=nr(M),V=f.property("__zoom");(V.k!==M.zoom||V.x!==M.x||V.y!==M.y)&&(u==null||u.transform(f,j,null,{sync:!0}))}}function N(){const M=f?Ko(f.node()):{x:0,y:0,k:1};return{x:M.x,y:M.y,zoom:M.k}}async function k(M,j){return f?new Promise(V=>{u==null||u.interpolate((j==null?void 0:j.interpolate)==="linear"?Pt:pn).scaleTo(rr(f,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>V(!0)),M)}):!1}async function P(M,j){return f?new Promise(V=>{u==null||u.interpolate((j==null?void 0:j.interpolate)==="linear"?Pt:pn).scaleBy(rr(f,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>V(!0)),M)}):!1}function D(M){u==null||u.scaleExtent(M)}function L(M){u==null||u.translateExtent(M)}function F(M){const j=!je(M)||M<0?0:M;u==null||u.clickDistance(j)}return{update:w,destroy:m,setViewport:y,setViewportConstrained:E,getViewport:N,scaleTo:k,scaleBy:P,setScaleExtent:D,setTranslateExtent:L,syncViewport:x,setClickDistance:F}}var Nt;(function(e){e.Line="line",e.Handle="handle"})(Nt||(Nt={}));function Vf({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:s,affectsY:o}){const i=e-t,a=n-r,c=[i>0?1:i<0?-1:0,a>0?1:a<0?-1:0];return i&&s&&(c[0]=c[0]*-1),a&&o&&(c[1]=c[1]*-1),c}function Ds(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),s=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:s}}function qe(e,t){return Math.max(0,t-e)}function Ge(e,t){return Math.max(0,e-t)}function un(e,t,n){return Math.max(0,t-e,e-n)}function Ts(e,t){return e?!t:t}function Ff(e,t,n,r,s,o,i,a){let{affectsX:c,affectsY:l}=t;const{isHorizontal:d,isVertical:u}=t,f=d&&u,{xSnapped:h,ySnapped:p}=n,{minWidth:v,maxWidth:w,minHeight:m,maxHeight:E}=r,{x:y,y:x,width:N,height:k,aspectRatio:P}=e;let D=Math.floor(d?h-e.pointerX:0),L=Math.floor(u?p-e.pointerY:0);const F=N+(c?-D:D),M=k+(l?-L:L),j=-o[0]*N,V=-o[1]*k;let _=un(F,v,w),C=un(M,m,E);if(i){let R=0,A=0;c&&D<0?R=qe(y+D+j,i[0][0]):!c&&D>0&&(R=Ge(y+F+j,i[1][0])),l&&L<0?A=qe(x+L+V,i[0][1]):!l&&L>0&&(A=Ge(x+M+V,i[1][1])),_=Math.max(_,R),C=Math.max(C,A)}if(a){let R=0,A=0;c&&D>0?R=Ge(y+D,a[0][0]):!c&&D<0&&(R=qe(y+F,a[1][0])),l&&L>0?A=Ge(x+L,a[0][1]):!l&&L<0&&(A=qe(x+M,a[1][1])),_=Math.max(_,R),C=Math.max(C,A)}if(s){if(d){const R=un(F/P,m,E)*P;if(_=Math.max(_,R),i){let A=0;!c&&!l||c&&!l&&f?A=Ge(x+V+F/P,i[1][1])*P:A=qe(x+V+(c?D:-D)/P,i[0][1])*P,_=Math.max(_,A)}if(a){let A=0;!c&&!l||c&&!l&&f?A=qe(x+F/P,a[1][1])*P:A=Ge(x+(c?D:-D)/P,a[0][1])*P,_=Math.max(_,A)}}if(u){const R=un(M*P,v,w)/P;if(C=Math.max(C,R),i){let A=0;!c&&!l||l&&!c&&f?A=Ge(y+M*P+j,i[1][0])/P:A=qe(y+(l?L:-L)*P+j,i[0][0])/P,C=Math.max(C,A)}if(a){let A=0;!c&&!l||l&&!c&&f?A=qe(y+M*P,a[1][0])/P:A=Ge(y+(l?L:-L)*P,a[0][0])/P,C=Math.max(C,A)}}}L=L+(L<0?C:-C),D=D+(D<0?_:-_),s&&(f?F>M*P?L=(Ts(c,l)?-D:D)/P:D=(Ts(c,l)?-L:L)*P:d?(L=D/P,l=c):(D=L*P,c=l));const S=c?y+D:y,I=l?x+L:x;return{width:N+(c?-D:D),height:k+(l?-L:L),x:o[0]*D*(c?-1:1)+S,y:o[1]*L*(l?-1:1)+I}}const Ei={width:0,height:0,x:0,y:0},Wf={...Ei,pointerX:0,pointerY:0,aspectRatio:1};function Yf(e,t,n){const r=t.position.x+e.position.x,s=t.position.y+e.position.y,o=e.measured.width??0,i=e.measured.height??0,a=n[0]*o,c=n[1]*i;return[[r-a,s-c],[r+o-a,s+i-c]]}function Xf({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:s}){const o=ve(e);let i={controlDirection:Ds("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:l,boundaries:d,keepAspectRatio:u,resizeDirection:f,onResizeStart:h,onResize:p,onResizeEnd:v,shouldResize:w}){let m={...Ei},E={...Wf};i={boundaries:d,resizeDirection:f,keepAspectRatio:u,controlDirection:Ds(l)};let y,x=null,N=[],k,P,D,L=!1;const F=Po().on("start",M=>{const{nodeLookup:j,transform:V,snapGrid:_,snapToGrid:C,nodeOrigin:S,paneDomNode:I}=n();if(y=j.get(t),!y)return;x=(I==null?void 0:I.getBoundingClientRect())??null;const{xSnapped:R,ySnapped:A}=Dt(M.sourceEvent,{transform:V,snapGrid:_,snapToGrid:C,containerBounds:x});m={width:y.measured.width??0,height:y.measured.height??0,x:y.position.x??0,y:y.position.y??0},E={...m,pointerX:R,pointerY:A,aspectRatio:m.width/m.height},k=void 0,P=lt(y.extent)?y.extent:void 0,y.parentId&&(y.extent==="parent"||y.expandParent)&&(k=j.get(y.parentId)),k&&y.extent==="parent"&&(P=[[0,0],[k.measured.width,k.measured.height]]),N=[],D=void 0;for(const[O,B]of j)if(B.parentId===t&&(N.push({id:O,position:{...B.position},extent:B.extent}),B.extent==="parent"||B.expandParent)){const H=Yf(B,y,B.origin??S);D?D=[[Math.min(H[0][0],D[0][0]),Math.min(H[0][1],D[0][1])],[Math.max(H[1][0],D[1][0]),Math.max(H[1][1],D[1][1])]]:D=H}h==null||h(M,{...m})}).on("drag",M=>{const{transform:j,snapGrid:V,snapToGrid:_,nodeOrigin:C}=n(),S=Dt(M.sourceEvent,{transform:j,snapGrid:V,snapToGrid:_,containerBounds:x}),I=[];if(!y)return;const{x:R,y:A,width:O,height:B}=m,H={},Y=y.origin??C,{width:X,height:ee,x:J,y:Z}=Ff(E,i.controlDirection,S,i.boundaries,i.keepAspectRatio,Y,P,D),$=X!==O,W=ee!==B,ne=J!==R&&$,te=Z!==A&&W;if(!ne&&!te&&!$&&!W)return;if((ne||te||Y[0]===1||Y[1]===1)&&(H.x=ne?J:m.x,H.y=te?Z:m.y,m.x=H.x,m.y=H.y,N.length>0)){const se=J-R,ie=Z-A;for(const ce of N)ce.position={x:ce.position.x-se+Y[0]*(X-O),y:ce.position.y-ie+Y[1]*(ee-B)},I.push(ce)}if(($||W)&&(H.width=$&&(!i.resizeDirection||i.resizeDirection==="horizontal")?X:m.width,H.height=W&&(!i.resizeDirection||i.resizeDirection==="vertical")?ee:m.height,m.width=H.width,m.height=H.height),k&&y.expandParent){const se=Y[0]*(H.width??0);H.x&&H.x<se&&(m.x=se,E.x=E.x-(H.x-se));const ie=Y[1]*(H.height??0);H.y&&H.y<ie&&(m.y=ie,E.y=E.y-(H.y-ie))}const q=Vf({width:m.width,prevWidth:O,height:m.height,prevHeight:B,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),G={...m,direction:q};(w==null?void 0:w(M,G))!==!1&&(L=!0,p==null||p(M,G),r(H,I))}).on("end",M=>{L&&(v==null||v(M,{...m}),s==null||s({...m}),L=!1)});o.call(F)}function c(){o.on(".drag",null)}return{update:a,destroy:c}}var Ni={exports:{}},Si={},ki={exports:{}},Mi={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* use-sync-external-store-shim.production.js
|
|
5
5
|
*
|
|
@@ -24,4 +24,4 @@ import{r as b,g as Ka,R as qa,j as g,u as Xe,a as Ga,l as Ua,_ as An,X as Za,Y a
|
|
|
24
24
|
M${D.x},${D.y}h${D.width}v${D.height}h${-D.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}aa.displayName="MiniMap";b.memo(aa);const jp=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Pp={[Nt.Line]:"right",[Nt.Handle]:"bottom-right"};function Dp({nodeId:e,position:t,variant:n=Nt.Handle,className:r,style:s=void 0,children:o,color:i,minWidth:a=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:u=!1,resizeDirection:f,autoScale:h=!0,shouldResize:p,onResizeStart:v,onResize:w,onResizeEnd:m}){const E=zi(),y=typeof e=="string"?e:E,x=ue(),N=b.useRef(null),k=n===Nt.Handle,P=ae(b.useCallback(jp(k&&h),[k,h]),le),D=b.useRef(null),L=t??Pp[n];b.useEffect(()=>{if(!(!N.current||!y))return D.current||(D.current=Xf({domNode:N.current,nodeId:y,getStoreItems:()=>{const{nodeLookup:M,transform:j,snapGrid:V,snapToGrid:_,nodeOrigin:C,domNode:S}=x.getState();return{nodeLookup:M,transform:j,snapGrid:V,snapToGrid:_,nodeOrigin:C,paneDomNode:S}},onChange:(M,j)=>{const{triggerNodeChanges:V,nodeLookup:_,parentLookup:C,nodeOrigin:S}=x.getState(),I=[],R={x:M.x,y:M.y},A=_.get(y);if(A&&A.expandParent&&A.parentId){const O=A.origin??S,B=M.width??A.measured.width??0,H=M.height??A.measured.height??0,Y={id:A.id,parentId:A.parentId,rect:{width:B,height:H,...oi({x:M.x??A.position.x,y:M.y??A.position.y},{width:B,height:H},A.parentId,_,O)}},X=Kr([Y],_,C,S);I.push(...X),R.x=M.x?Math.max(O[0]*B,M.x):void 0,R.y=M.y?Math.max(O[1]*H,M.y):void 0}if(R.x!==void 0&&R.y!==void 0){const O={id:y,type:"position",position:{...R}};I.push(O)}if(M.width!==void 0&&M.height!==void 0){const B={id:y,type:"dimensions",resizing:!0,setAttributes:f?f==="horizontal"?"width":"height":!0,dimensions:{width:M.width,height:M.height}};I.push(B)}for(const O of j){const B={...O,type:"position"};I.push(B)}V(I)},onEnd:({width:M,height:j})=>{const V={id:y,type:"dimensions",resizing:!1,dimensions:{width:M,height:j}};x.getState().triggerNodeChanges([V])}})),D.current.update({controlPosition:L,boundaries:{minWidth:a,minHeight:c,maxWidth:l,maxHeight:d},keepAspectRatio:u,resizeDirection:f,onResizeStart:v,onResize:w,onResizeEnd:m,shouldResize:p}),()=>{var M;(M=D.current)==null||M.destroy()}},[L,a,c,l,d,u,v,w,m,p]);const F=L.split("-");return g.jsx("div",{className:fe(["react-flow__resize-control","nodrag",...F,n,r]),ref:N,style:{...s,scale:P,...i&&{[k?"backgroundColor":"borderColor"]:i}},children:o})}b.memo(Dp);function Tp(e,t){if(!e)return null;const n=Date.parse(e);if(Number.isNaN(n))return null;const r=Math.max(0,(Date.now()-n)/1e3);if(r<45)return t("time.justNow");const s=r/60,o=s/60,i=o/24;return s<45?t("time.minutes",{n:Math.round(s)}):o<22?t("time.hours",{n:Math.round(o)}):i<7?t("time.days",{n:Math.round(i)}):t("time.weeks",{n:Math.round(i/7)})}const Lp=4,io={isConnectable:!1,isConnectableStart:!1,isConnectableEnd:!1,style:{pointerEvents:"none"},"aria-hidden":!0};function Rp({data:e}){const t=Xe(),n=[...new Map((e.editors||[]).map(o=>[o.id,o])).values()];if(n.length===0)return null;const r=n.slice(0,Lp),s=n.length-r.length;return g.jsxs("span",{className:"node-editors","data-tip":t("specNode.liveEditors",{n:n.length}),children:[r.map(o=>g.jsx(ec,{seed:o.id,status:o.status,title:t("specNode.editorTitle",{node:o.node||t("common.session"),status:t(`status.${o.status}`),id:o.id.slice(0,8)})},o.id)),s>0&&g.jsxs("span",{className:"av-more","data-tip":t("specNode.more",{n:s}),children:["+",s]})]})}function zp({issues:e,t}){return!e||e.length===0?null:g.jsxs("span",{className:"issue-badge","data-tip":t("specNode.openIssues",{n:e.length}),children:["◆",e.length]})}function Hp({data:e,selected:t}){const n=Xe(),r=ot[e.status]||ot.pending,s=Tp(e.lastEdited,n),o=e.overlays||[],i=o[0],a=o.some(u=>u.op==="deleted"),c=i&&!i.committed,l=[...new Set(o.map(u=>u.op))],d=["spec-node",e.status,t?"focused":"",e.ghost?"ghost":"",a?"deleted":"",o.length?"has-overlay":"",c?"ov-dirty":""].filter(Boolean).join(" ");return g.jsxs("div",{className:d,style:i?{"--ov":fr(i.seed)}:void 0,children:[g.jsx(kt,{type:"target",position:Q.Left,...io}),g.jsxs("div",{className:"node-row1",children:[g.jsx("span",{className:"node-dot",style:{background:r.color},children:e.status==="active"&&g.jsx("span",{className:"pulse",style:{background:r.color}})}),g.jsx("span",{className:"node-title",children:e.title}),l.length>0?g.jsx("span",{className:"ov-marks","data-tip":o.map(u=>n("specNode.opTitle",{op:n(`legend.opRows.${u.op}`),label:u.label,uncommitted:!u.committed})).join(`
|
|
25
25
|
`),children:l.map(u=>g.jsx("span",{className:`ov-mark ov-${u}`,children:mo[u]},u))}):s?g.jsx("span",{className:"node-ago",children:s}):null]}),g.jsxs("div",{className:"node-row2",children:[g.jsx("span",{className:"node-ver",children:e.version?`v${e.version}`:""}),e.drift>0&&g.jsxs("span",{className:"drift-badge","data-tip":(e.driftFiles||[]).map(u=>`${u.file}: ${n("specNode.driftAhead",{n:u.behind})}`).join(`
|
|
26
26
|
`),children:["⚠",e.drift]}),g.jsx(zp,{issues:e.openIssues,t:n}),g.jsx(Ja,{scenarios:e.scenarios,evals:e.evals}),g.jsx(Rp,{data:e})]}),e.collapsed&&g.jsxs("span",{className:"node-expand","data-tip":n("specNode.expandable",{n:e.childCount}),children:["▸",e.childCount]}),g.jsx(kt,{type:"source",position:Q.Right,...io})]})}const ar=typeof window<"u"?window.__escStack||(window.__escStack=[]):[];typeof window<"u"&&!window.__escStackBound&&(window.__escStackBound=!0,window.addEventListener("keydown",e=>{const t=window.__escStack;e.key!=="Escape"||!t||t.length===0||(e.preventDefault(),e.stopImmediatePropagation(),t[t.length-1].close())},!0));function Op(e,t){const n=b.useRef(t);n.current=t,b.useEffect(()=>{if(!e)return;const r={close:()=>{var s;return(s=n.current)==null?void 0:s.call(n)}};return ar.push(r),()=>{const s=ar.indexOf(r);s>=0&&ar.splice(s,1)}},[e])}function Bp({menu:e,onClose:t,onInfo:n,onFresh:r,onNewChild:s,onDelete:o,sessions:i=[],onOpenSession:a}){const c=Xe();if(b.useEffect(()=>{if(e)return window.addEventListener("click",t),window.addEventListener("contextmenu",t,!0),()=>{window.removeEventListener("click",t),window.removeEventListener("contextmenu",t,!0)}},[e,t]),Op(!!e,t),!e)return null;const l=u=>f=>{f.stopPropagation(),t(),u(e.id)},d=u=>f=>{f.stopPropagation(),t(),a==null||a(u)};return g.jsxs("div",{className:"sess-menu",style:{left:e.x,top:e.y},onClick:u=>u.stopPropagation(),children:[g.jsx("button",{className:"sess-menu-item",onClick:l(n),children:c("nodeMenu.info")}),g.jsx("button",{className:"sess-menu-item",onClick:l(r),children:c("nodeMenu.newSession")}),g.jsx("button",{className:"sess-menu-item",onClick:l(s),children:c("nodeMenu.newChild")}),g.jsx("button",{className:"sess-menu-item danger",onClick:l(o),children:c("nodeMenu.del")}),i.length>0&&g.jsx("div",{className:"sess-menu-sep"}),i.map(u=>g.jsxs("button",{className:"sess-menu-item sess-menu-sess",onClick:d(u.id),children:[g.jsx("span",{className:"sess-glyph",style:{color:hr[u.status]},"aria-hidden":"true",children:tc[u.status]}),Ar(u)]},u.id))]})}let cr=null;function ca(e=!0){const[t,n]=b.useState(cr),r=b.useRef(!1);return b.useEffect(()=>{!e||r.current||(r.current=!0,fetch("/api/specs/lite").then(s=>s.ok?s.json():[]).then(s=>{cr={bodies:Object.fromEntries((s||[]).map(o=>[o.id,o.body||""])),scenarios:Object.fromEntries((s||[]).filter(o=>{var i;return(i=o.scenarios)==null?void 0:i.length}).map(o=>[o.id,Object.fromEntries(o.scenarios.map(i=>[i.name,i]))]))},n(cr)}).catch(()=>{}))},[e]),t}const Vp={pass:"✓",fail:"✗",stalePass:"✓",staleFail:"✗",empty:"○",missing:"·"};function Fp({nodeId:e,s:t,prose:n,t:r,onNavigateAddress:s}){const o=(n==null?void 0:n.expected)??t.expected,i=(n==null?void 0:n.code)??t.code;return g.jsxs("button",{type:"button",className:`fp-scenario ${t.state}`,onClick:()=>s==null?void 0:s(xo(e,t.name)),"data-tip":r("focusPanel.openEval"),children:[g.jsx("span",{className:"fp-sc-mark","data-tip":r(`score.${t.state}`),children:Vp[t.state]}),g.jsxs("span",{className:"fp-sc-body",children:[g.jsx("span",{className:"fp-sc-name",children:t.name}),g.jsx(yo,{tags:t.tags}),o&&g.jsx("span",{className:"fp-sc-expected",children:o}),(i==null?void 0:i.length)>0&&g.jsx("span",{className:"fp-sc-code",children:r("focusPanel.tracks",{files:i.join(", ")})})]})]})}function Wp({node:e,onNavigateAddress:t}){var d;const n=Xe(),r=Ir(e==null?void 0:e.scenarios,e==null?void 0:e.evals),s=ca(r.length>0),o=e?(d=s==null?void 0:s.scenarios)==null?void 0:d[e.id]:null,i=r.filter(u=>u.state==="pass").length,a=(e==null?void 0:e.issues)||[],c=a.filter(u=>u.status==="open"),l=a.filter(u=>u.status!=="open");return g.jsxs("aside",{className:"focus-panel",children:[g.jsxs("div",{className:"fp-head",children:[g.jsx("span",{className:"fp-title",children:e?e.title:n("focusPanel.noFocus")}),(e==null?void 0:e.desc)&&g.jsx("span",{className:"fp-desc","data-tip":e.desc,children:e.desc})]}),g.jsxs("section",{className:"fp-sec",children:[g.jsxs("div",{className:"fp-sec-head",children:[g.jsx("span",{children:n("focusPanel.scenarios")}),r.length>0&&g.jsxs("span",{className:`fp-count ${nc(r)}`,children:["✓",i,"/",r.length]})]}),r.length?r.map(u=>g.jsx(Fp,{nodeId:e.id,s:u,prose:o==null?void 0:o[u.name],t:n,onNavigateAddress:t},u.name)):g.jsx("div",{className:"fp-empty",children:n("focusPanel.noScenarios")})]}),g.jsxs("section",{className:"fp-sec",children:[g.jsxs("div",{className:"fp-sec-head",children:[g.jsx("span",{children:n("focusPanel.issues")}),a.length>0&&g.jsxs("span",{className:"fp-issue-counts",children:[c.length>0&&g.jsx("span",{className:"issue-state st-open",children:n("focusPanel.open",{n:c.length})}),l.length>0&&g.jsx("span",{className:"issue-state st-closed",children:n("focusPanel.closed",{n:l.length})})]})]}),a.length?g.jsxs(g.Fragment,{children:[c.map(u=>g.jsx(rs,{issue:u,onNavigateAddress:t},u.id)),l.length>0&&g.jsx("div",{className:"issue-group-head closed",children:n("focusPanel.closed",{n:l.length})}),l.map(u=>g.jsx(rs,{issue:u,onNavigateAddress:t},u.id))]}):g.jsx("div",{className:"fp-empty",children:n("focusPanel.noIssues")})]})]})}function Yp({title:e,closeLabel:t,onClose:n,className:r,children:s}){return g.jsx("div",{className:"legend-backdrop","data-focus-overlay":!0,onClick:n,children:g.jsxs("div",{className:r?`legend ${r}`:"legend",role:"dialog","aria-modal":"true","aria-label":e,onClick:o=>o.stopPropagation(),children:[g.jsxs("div",{className:"legend-head",children:[g.jsx("span",{className:"legend-title",children:e}),g.jsx(rc,{icon:"x",size:13,className:"legend-close",label:t,onClick:n})]}),g.jsx("div",{className:"legend-body",children:s})]})})}const la=[{id:"nav.up",keys:["ArrowUp","k"],rebind:!1,desc:"legend.board.move"},{id:"nav.down",keys:["ArrowDown","j"],rebind:!1,desc:"legend.board.move"},{id:"nav.parent",keys:["ArrowLeft","h"],rebind:!1,desc:"legend.board.parent"},{id:"nav.child",keys:["ArrowRight","l"],rebind:!1,desc:"legend.board.child"},{id:"board.zoomIn",keys:["+","="],rebind:!0,desc:"legend.board.zoom"},{id:"board.zoomOut",keys:["-","_"],rebind:!0,desc:"legend.board.zoom"},{id:"board.zoomReset",keys:["0"],rebind:!0,desc:"legend.board.zoom"},{id:"board.info",keys:["i","I","Enter"],rebind:!0,desc:"legend.board.info"},{id:"board.search",keys:["/"],rebind:!0,desc:"legend.board.search"},{id:"board.cycle",keys:["o"],rebind:!0,desc:"legend.board.overlayCycle"},{id:"board.cycleRev",keys:["O"],rebind:!0,desc:"legend.board.overlayCycle"},{id:"board.fresh",keys:["["],rebind:!0,desc:"legend.board.fresh"},{id:"board.evals",keys:["f"],rebind:!0,desc:"legend.board.evals"},{id:"board.newChild",keys:["n"],rebind:!1,desc:"legend.board.newChild"},{id:"board.del",keys:["d"],rebind:!1,desc:"legend.board.del"},{id:"board.settings",keys:[","],rebind:!0,desc:"legend.board.settings"},{id:"board.help",keys:["?"],rebind:!0,desc:"legend.board.help"}],Xp={ArrowUp:"↑",ArrowDown:"↓",ArrowLeft:"←",ArrowRight:"→",Enter:"⏎",Escape:"esc"," ":"␣","-":"−"},Kp=e=>Xp[e]||e,Gr="spex.keybindings.v1",qp=Object.fromEntries(la.map(e=>[e.id,e]));function Gp(){try{return JSON.parse(localStorage.getItem(Gr))||{}}catch{return{}}}let nt=Gp();function ua(e){var n;const t=nt[e];return t&&t.keys||((n=qp[e])==null?void 0:n.keys)||[]}function Fm(e){return!!nt[e]}function ge(e,t){return ua(e).includes(t)}function Wm(e,t){nt={...nt,[e]:{...nt[e],...t}},localStorage.setItem(Gr,JSON.stringify(nt))}function Ym(){nt={},localStorage.removeItem(Gr)}const Up=new Set(["=","_","I"]),Zp=(()=>{const e=[];for(const t of la){const n=ua(t.id).filter(s=>!Up.has(s)).map(Kp),r=e[e.length-1];r&&r.desc===t.desc?r.keys.push(...n):e.push({desc:t.desc,keys:n})}return e})(),Qp=[[["←","→","h","l","⇥","1","2"],"legend.popup.switch"],[["j","k","↑","↓"],"legend.popup.scroll"],[["⏎"],"legend.popup.enter"],[["esc"],"legend.popup.esc"]],Jp=["merged","active","drift","pending"],em=["added","edited","deleted","moved"];function tm({t:e}){return g.jsxs("section",{className:"legend-sec",children:[g.jsx("div",{className:"legend-h",children:e("legend.secBoard")}),Zp.map(t=>g.jsxs("div",{className:"legend-row",children:[g.jsx("span",{className:"keymap-keys",children:t.keys.map((n,r)=>g.jsx("kbd",{children:n},r))}),g.jsx("span",{className:"legend-desc",children:e(t.desc)})]},t.desc))]})}function nm({title:e,rows:t,t:n}){return g.jsxs("section",{className:"legend-sec",children:[g.jsx("div",{className:"legend-h",children:e}),t.map(([r,s])=>g.jsxs("div",{className:"legend-row",children:[g.jsx("span",{className:"keymap-keys",children:r.map((o,i)=>g.jsx("kbd",{children:o},i))}),g.jsx("span",{className:"legend-desc",children:n(s)})]},s))]})}function rm({onClose:e}){const t=Xe();return g.jsxs(Yp,{title:t("legend.title"),closeLabel:t("legend.close"),onClose:e,children:[g.jsx(tm,{t}),g.jsx(nm,{title:t("legend.secPopup"),rows:Qp,t}),g.jsxs("section",{className:"legend-sec",children:[g.jsx("div",{className:"legend-h",children:t("legend.secStatus")}),Jp.map(n=>g.jsxs("div",{className:"legend-row",children:[g.jsx("span",{className:"node-dot",style:{background:ot[n].color},children:n==="active"&&g.jsx("span",{className:"pulse",style:{background:ot[n].color}})}),g.jsx("span",{className:"legend-name",children:t(`status.${n}`)}),g.jsx("span",{className:"legend-desc",children:t(`legend.statusRows.${n}`)})]},n))]}),g.jsxs("section",{className:"legend-sec",children:[g.jsxs("div",{className:"legend-h",children:[t("legend.secOp")," ",g.jsx("span",{className:"legend-sub",children:t("legend.secOpSub")})]}),em.map(n=>g.jsxs("div",{className:"legend-row",children:[g.jsx("span",{className:`ov-mark ov-${n}`,children:mo[n]}),g.jsx("span",{className:"legend-desc",children:t(`legend.opRows.${n}`)})]},n))]}),g.jsxs("section",{className:"legend-sec",children:[g.jsx("div",{className:"legend-h",children:t("legend.secBadges")}),g.jsxs("div",{className:"legend-row",children:[g.jsx("span",{className:"drift-badge",children:"⚠N"}),g.jsx("span",{className:"legend-desc",children:t("legend.badgeDrift")})]}),g.jsxs("div",{className:"legend-row",children:[g.jsx("span",{className:"legend-glyph legend-ver",children:"vN"}),g.jsx("span",{className:"legend-desc",children:t("legend.badgeVer")})]})]}),g.jsxs("section",{className:"legend-sec",children:[g.jsx("div",{className:"legend-h",children:t("legend.secRing")}),g.jsxs("div",{className:"legend-row",children:[g.jsx("span",{className:"legend-ring ring-dashed"}),g.jsx("span",{className:"legend-desc",children:t("legend.ringDashed")})]}),g.jsxs("div",{className:"legend-row",children:[g.jsx("span",{className:"legend-ring ring-solid"}),g.jsx("span",{className:"legend-desc",children:t("legend.ringSolid")})]}),g.jsxs("div",{className:"legend-row",children:[g.jsx("span",{className:"legend-ring ring-ghost"}),g.jsx("span",{className:"legend-desc",children:t("legend.ringGhost")})]})]})]})}const sm=8,om=5,im=3,am=1,cm=new Set(["the","a","an","and","or","of","to","in","on","is","it","its","as","at","by","for","how","does","do","what","which","that","this","these","those","with","from","into","are","be","can","just","them","they","their","so","if","not","no","but","vs","us","we","you"]);function lm(e){const t=new Set;for(const n of e.toLowerCase().split(/[^a-z0-9]+/))n.length>1&&!cm.has(n)&&t.add(n);return[...t]}function lr(e){return e.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean)}function da(e){let t=e;return t.length>=4&&t.endsWith("s")&&!t.endsWith("ss")&&(t=t.slice(0,-1)),t.length>=5&&t.endsWith("e")&&(t=t.slice(0,-1)),t}function fa(e,t){return t.startsWith(da(e))}function Cn(e,t){return t.startsWith(da(e))||t.length>=3&&e.startsWith(t)}const ao=1.2,co=.4;function lo(e,t,n){return e<=0?0:e*(ao+1)/(e+ao*(1-co+co*t/(n||1)))}function um(e,t,n,r){if(t.nameWords.some(o=>fa(e,o)))return sm;if(t.name.includes(e))return om;if(t.descWords.some(o=>Cn(e,o)))return im*lo(1,t.descWords.length,r);const s=t.bodyWords.reduce((o,i)=>o+(Cn(e,i)?1:0),0);return am*lo(s,t.bodyWords.length,n)}function dm(e,t,n,r=140){const s=e.replace(/\s+/g," ").trim(),o=s.toLowerCase();let i=-1;for(const l of n){const d=o.match(new RegExp("\\b"+l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")));d&&d.index!==void 0&&(i<0||d.index<i)&&(i=d.index)}if(i<0){const l=(t||s).replace(/\s+/g," ").trim();return l.length>r?l.slice(0,r).trimEnd()+"…":l}const a=Math.max(0,i-Math.floor(r/3));let c=s.slice(a,a+r).trim();return a>0&&(c="…"+c),a+r<s.length&&(c=c+"…"),c}function fm(e,t,n={}){const r=n.limit??10,s=lm(e);if(!s.length)return[];const o=t.map(u=>{const f=u.name.toLowerCase();return{ref:u.ref,name:f,nameWords:lr(f),desc:u.desc.toLowerCase(),descWords:lr(u.desc),bodyWords:lr(u.body),snippetText:`${u.desc}
|
|
27
|
-
${u.body}`}}),i=o.length,a=o.reduce((u,f)=>u+f.bodyWords.length,0)/(i||1),c=o.reduce((u,f)=>u+f.descWords.length,0)/(i||1),l={};for(const u of s){let f=0;for(const h of o)(h.nameWords.some(p=>fa(u,p))||h.descWords.some(p=>Cn(u,p))||h.bodyWords.some(p=>Cn(u,p)))&&f++;l[u]=f>0?Math.log(i/f):0}const d=[];for(const u of o){let f=0;for(const h of s)f+=um(h,u,a,c)*l[h];f<=0||d.push({ref:u.ref,score:Math.round(f*100)/100,snippet:dm(u.snippetText,u.desc,s)})}return d.sort((u,f)=>f.score-u.score),d.slice(0,r)}const hm={pass:"var(--green)",fail:"var(--red)",stalePass:"var(--muted)",staleFail:"var(--muted)",empty:"var(--muted)",missing:"var(--muted)"},gm=e=>(e||"").replace(/^\.spec\//,"").replace(/\/spec\.md$/,""),uo=["spec","session","issue","scenario"],pm=e=>e?[e,...uo.filter(t=>t!==e)]:uo;function mm(e,t,n){var o,i;const r=n==null?void 0:n.bodies,s=[];for(const a of e){const c=gm(a.path);s.push({kind:"spec",key:`spec:${a.id}`,target:a.id,address:sc(a.id),color:(ot[a.status]||ot.pending).color,title:a.title||a.id,sub:c,name:`${a.title||a.id} ${a.id}`,desc:a.desc||"",body:(r==null?void 0:r[a.id])??a.body??""});for(const l of a.issues||[]){const d=l.status==="open";s.push({kind:"issue",key:`issue:${a.id}:${l.id}`,target:l.id,nodeId:a.id,address:oc(l.id),color:d?"var(--green)":"var(--muted)",title:l.concern,sub:`${l.id} · ${c}`,name:l.concern||"",desc:l.id,body:""})}for(const l of Ir(a.scenarios,a.evals)){const d=(i=(o=n==null?void 0:n.scenarios)==null?void 0:o[a.id])==null?void 0:i[l.name];s.push({kind:"scenario",key:`scenario:${a.id}:${l.name}`,target:l.name,nodeId:a.id,address:xo(a.id,l.name),color:hm[l.state]||"var(--cyan)",title:l.name,sub:c,tags:l.tags,name:l.name||"",desc:"",body:d?`${d.description||""} ${d.expected||""}`.trim():l.expected||""})}}for(const a of t){const c=Ar(a),l=ic(a),d=a.status||a.promptPreview||a.note||"";s.push({kind:"session",key:`session:${a.id}`,target:a.id,address:ac(a.id),color:hr[a.status]||hr.offline,title:c,sub:d,name:c||"",desc:a.status||"",body:`${a.promptPreview||a.note||""} ${l}`.trim()})}return s}function ym(e,t,n){const r=Object.fromEntries(n.map((a,c)=>[a,c])),s=(a,c)=>r[a.kind]-r[c.kind]||a.name.length-c.name.length||a.key.localeCompare(c.key);if(!t.trim())return e.slice().sort(s).slice(0,15);const o={};for(const a of n){const c=e.filter(l=>l.kind===a).sort((l,d)=>l.name.length-d.name.length||l.key.localeCompare(d.key));o[a]=fm(t,c.map(l=>({ref:l,name:l.name,desc:l.desc,body:l.body})),{limit:15}).map(l=>l.ref)}const i=[];for(let a=0;i.length<15;a++){let c=!1;for(const l of n)o[l][a]&&i.length<15&&(i.push(o[l][a]),c=!0);if(!c)break}return i}function xm({specs:e,sessions:t,onPick:n,onClose:r,boost:s=null}){const o=Xe(),i=ca(),[a,c]=b.useState(""),[l,d]=b.useState("");b.useEffect(()=>{if(!a.trim()){d(a);return}const x=setTimeout(()=>d(a),120);return()=>clearTimeout(x)},[a]);const[u,f]=b.useState(0),h=b.useRef(null),p=b.useRef(null),v=b.useMemo(()=>pm(s),[s]),w=b.useMemo(()=>mm(e,t,i),[e,t,i]),m=b.useMemo(()=>ym(w,l,v),[w,l,v]);b.useEffect(()=>{var x;(x=h.current)==null||x.focus()},[]),b.useEffect(()=>{f(0)},[a]),b.useEffect(()=>{var x,N;(N=(x=p.current)==null?void 0:x.querySelector(".search-item.on"))==null||N.scrollIntoView({block:"nearest"})},[u,m]);const E=x=>{x&&(n(x),r())},y=x=>{x.key==="ArrowDown"?(x.preventDefault(),f(N=>Math.min(m.length-1,N+1))):x.key==="ArrowUp"?(x.preventDefault(),f(N=>Math.max(0,N-1))):x.key==="Enter"?(x.preventDefault(),E(m[u])):x.key==="Escape"&&(x.preventDefault(),r())};return g.jsx("div",{className:"search-backdrop","data-focus-overlay":!0,onClick:r,children:g.jsxs("div",{className:"search-panel",role:"dialog","aria-modal":"true","aria-label":o("search.title"),onClick:x=>x.stopPropagation(),children:[g.jsxs("div",{className:"search-bar",children:[g.jsx("span",{className:"search-icon",children:"⌕"}),g.jsx("input",{ref:h,className:"search-input",value:a,placeholder:o("search.placeholder"),onChange:x=>c(x.target.value),onKeyDown:y})]}),g.jsxs("ul",{className:"search-results",ref:p,children:[m.length===0&&g.jsx("li",{className:"search-empty",children:o("search.empty")}),m.map((x,N)=>g.jsxs("li",{className:`search-item${N===u?" on":""}`,onMouseEnter:()=>f(N),onClick:()=>E(x),children:[g.jsx("span",{className:"node-dot",style:{background:x.color}}),g.jsx("span",{className:`search-kind k-${x.kind}`,children:o(`search.kind.${x.kind}`)}),g.jsx("span",{className:"search-title",children:x.title||x.target}),g.jsx(yo,{tags:x.tags}),g.jsx("span",{className:"search-path",children:x.sub})]},x.key))]}),g.jsx("div",{className:"search-foot",children:o("search.hint")})]})})}function ha(e,t,n=1,r=s=>s){if(!e.length)return null;const s=e.findIndex(o=>r(o)===t);return s===-1?n>0?e[0]:e[e.length-1]:e[(s+n+e.length)%e.length]}const wm=["merged","active","drift","pending"],vm=[{state:"pass",always:!0,titleKey:"scorePass"},{state:"fail",always:!0,titleKey:"scoreFail"},{state:"stalePass",always:!1,titleKey:"scoreStalePass"},{state:"staleFail",always:!1,titleKey:"scoreStaleFail"},{state:"empty",always:!1,titleKey:"scoreEmpty"}];function bm(e){const t={merged:[],active:[],drift:[],pending:[]},n=[],r=[],s=new Set,o={pass:0,fail:0,stalePass:0,staleFail:0,empty:0},i={pass:[],fail:[],stalePass:[],staleFail:[],empty:[]};for(const a of e){t[a.status]&&t[a.status].push(a.id),a.drift>0&&n.push(a.id);const c=a.openIssues||[];if(c.length){r.push(a.id);for(const d of c)s.add(d.id)}const l=new Set;for(const d of Ir(a.scenarios,a.evals)){const u=d.state==="missing"?"empty":d.state;o[u]!==void 0&&(o[u]++,l.has(u)||(l.add(u),i[u].push(a.id)))}}return{total:e.length,status:t,driftIds:n,issueIds:r,issueCount:s.size,scoreCount:o,scoreNodes:i}}function hn({count:e,ids:t,focusId:n,onJump:r,title:s,cls:o="",children:i}){const a=t.length>0;return g.jsxs("button",{type:"button",className:`bstat ${o}`.trim(),disabled:!a,"data-tip":s,"aria-label":s,onClick:a?()=>r(ha(t,n)):void 0,children:[i,e]})}function _m({specs:e,focusId:t,onJump:n}){const r=Xe(),s=b.useMemo(()=>bm(e),[e]),o=i=>i&&(n==null?void 0:n(i));return g.jsxs("div",{className:"board-stats",role:"group","aria-label":r("stats.aria"),children:[g.jsx("span",{className:"bstat-total","data-tip":r("stats.totalTitle",{n:s.total}),children:s.total}),wm.map(i=>g.jsx(hn,{count:s.status[i].length,ids:s.status[i],focusId:t,onJump:o,title:r("stats.statusTitle",{n:s.status[i].length,status:r(`status.${i}`)}),children:g.jsx("span",{className:"bstat-dot",style:{background:ot[i].color}})},i)),g.jsx("span",{className:"bstat-sep"}),g.jsx(hn,{count:s.driftIds.length,ids:s.driftIds,focusId:t,onJump:o,cls:"bstat-drift",title:r("stats.driftTitle",{n:s.driftIds.length}),children:"⚠"}),g.jsx(hn,{count:s.issueCount,ids:s.issueIds,focusId:t,onJump:o,cls:"bstat-issue",title:r("stats.issueTitle",{n:s.issueCount}),children:"◆"}),g.jsx("span",{className:"bstat-sep"}),vm.map(({state:i,always:a,titleKey:c})=>{const l=s.scoreCount[i],d=s.scoreNodes[i];return!l&&!a?null:g.jsx(hn,{count:l,ids:d,focusId:t,onJump:o,title:r(`stats.${c}`,{n:l}),children:g.jsx(cc,{state:i})},i)})]})}const Em=["graph","sessions","evals","issues"];function fo({page:e,active:t,onNav:n,label:r}){return g.jsx("button",{type:"button",className:t?"rail-btn on":"rail-btn","data-tip":r,"aria-label":r,"aria-current":t?"page":void 0,onClick:()=>n(e),children:g.jsx(lc,{name:e,size:18})})}function Nm({page:e,onNav:t}){const n=Xe();return g.jsxs("nav",{className:"side-rail","aria-label":n("nav.railLabel"),children:[Em.map(r=>g.jsx(fo,{page:r,active:e===r,onNav:t,label:n(`nav.${r}`)},r)),g.jsx("div",{className:"rail-spacer"}),g.jsx(fo,{page:"settings",active:e==="settings",onNav:t,label:n("nav.settings")})]})}const Sm=400,km=80,ur=7,dr=6;function Mm(){const[e,t]=b.useState(null),n=b.useRef(null),r=b.useRef(0),s=b.useRef(null),o=b.useRef(null),i=b.useRef(!1);return b.useEffect(()=>{const a=()=>{r.current&&(clearTimeout(r.current),r.current=0)},c=()=>{a(),s.current=null,o.current&&(o.current.getAttribute("aria-describedby")==="ui-tip"&&o.current.removeAttribute("aria-describedby"),o.current=null),t(w=>(w&&(i.current=!0,setTimeout(()=>{s.current||(i.current=!1)},300)),null))},l=w=>{const m=w.getAttribute("data-tip");!m||!w.isConnected||(s.current=w,w.getAttribute("aria-describedby")||(w.setAttribute("aria-describedby","ui-tip"),o.current=w),t({text:m,anchor:w}))},d=(w,m)=>{s.current!==w&&(a(),s.current=w,r.current=setTimeout(()=>{r.current=0,l(w)},m))},u=w=>{var E,y;const m=(y=(E=w.target).closest)==null?void 0:y.call(E,"[data-tip]");m&&d(m,i.current?km:Sm)},f=w=>{var E,y;const m=(y=(E=w.target).closest)==null?void 0:y.call(E,"[data-tip]");!m||m!==s.current||m.contains(w.relatedTarget)||c()},h=w=>{var y,x;const m=(x=(y=w.target).closest)==null?void 0:x.call(y,"[data-tip]");if(!m)return;let E=!0;try{E=m.matches(":focus-visible")}catch{}E&&(a(),l(m))},p=w=>{var E,y;const m=(y=(E=w.target).closest)==null?void 0:y.call(E,"[data-tip]");m&&m===s.current&&c()},v=w=>{w.key==="Escape"&&c()};return document.addEventListener("pointerover",u,!0),document.addEventListener("pointerout",f,!0),document.addEventListener("focusin",h,!0),document.addEventListener("focusout",p,!0),document.addEventListener("keydown",v,!0),document.addEventListener("pointerdown",c,!0),window.addEventListener("scroll",c,!0),window.addEventListener("resize",c),()=>{a(),document.removeEventListener("pointerover",u,!0),document.removeEventListener("pointerout",f,!0),document.removeEventListener("focusin",h,!0),document.removeEventListener("focusout",p,!0),document.removeEventListener("keydown",v,!0),document.removeEventListener("pointerdown",c,!0),window.removeEventListener("scroll",c,!0),window.removeEventListener("resize",c)}},[]),b.useEffect(()=>{const a=n.current;if(!e||!a)return;if(!e.anchor.isConnected){t(null);return}const c=e.anchor.getBoundingClientRect(),l=a.getBoundingClientRect(),d=c.top-l.height-ur>=dr?"top":"bottom",u=d==="top"?c.top-l.height-ur:c.bottom+ur,f=Math.min(Math.max(c.left+c.width/2-l.width/2,dr),window.innerWidth-l.width-dr);a.dataset.place=d,a.style.top=`${Math.round(u)}px`,a.style.left=`${Math.round(f)}px`;const h=a.querySelector(".ui-tip-arrow");h&&(h.style.left=`${Math.round(Math.min(Math.max(c.left+c.width/2-f,10),l.width-10))-4}px`);const p=requestAnimationFrame(()=>a.classList.add("show"));return()=>cancelAnimationFrame(p)},[e]),e?Ga.createPortal(g.jsxs("div",{id:"ui-tip",role:"tooltip",ref:n,className:"ui-tip",children:[e.text,g.jsx("span",{className:"ui-tip-arrow","aria-hidden":"true"})]}),document.body):null}function Cm(e,t,{min:n,max:r,dir:s=1}={}){const[o,i]=b.useState(()=>{try{const l=parseInt(localStorage.getItem(e),10);if(Number.isFinite(l))return Math.max(n,Math.min(r,l))}catch{}return t}),a=b.useRef(null),c=b.useCallback(l=>{l.preventDefault(),a.current={x:l.clientX,w:o};const d=f=>{const h=a.current;if(!h)return;const p=Math.max(n,Math.min(r,h.w+(f.clientX-h.x)*s));i(p)},u=()=>{a.current=null,window.removeEventListener("mousemove",d),window.removeEventListener("mouseup",u),document.body.classList.remove("is-resizing"),i(f=>{try{localStorage.setItem(e,String(Math.round(f)))}catch{}return f})};window.addEventListener("mousemove",d),window.addEventListener("mouseup",u),document.body.classList.add("is-resizing")},[e,o,n,r,s]);return[o,c]}function ho(){let e=0,t=null,n=null,r=null;return function(o,i){if(!o)return;const a=r!=null&&Math.abs(o.scrollTop-r)>1;(o!==n||a)&&(n=o,t=null,r=null);const c=o.scrollHeight-o.clientHeight,l=t??o.scrollTop;t=Math.max(0,Math.min(c,l+i)),cancelAnimationFrame(e);const d=()=>{if(r!=null&&Math.abs(o.scrollTop-r)>1){cancelAnimationFrame(e),t=null,r=null;return}const u=t-o.scrollTop;if(Math.abs(u)<.5){o.scrollTop=t,r=o.scrollTop;return}o.scrollTop+=u*.2,r=o.scrollTop,e=requestAnimationFrame(d)};e=requestAnimationFrame(d)}}let Cr=null;const Am=e=>!!(e&&e.closest&&e.closest("[data-focus-overlay]")),go=e=>!!(e&&e.isConnected&&!e.disabled&&e.getClientRects().length);typeof window<"u"&&window.addEventListener("focusin",e=>{const t=e.target;t&&t!==document.body&&!Am(t)&&(Cr=t)},!0);function Im(){requestAnimationFrame(()=>{if(go(Cr)){Cr.focus();return}const e=document.querySelector("[data-focus-sink]");go(e)&&e.focus()})}const $m=b.lazy(()=>An(()=>import("./SessionInterface-Sh8kHpnj.js"),__vite__mapDeps([0,1,2,3,4,5,6]))),jm=b.lazy(()=>An(()=>import("./EvalsPage-DV75EdP4.js").then(e=>e.b),__vite__mapDeps([4,1,2,3,5]))),Pm=b.lazy(()=>An(()=>import("./IssuesPage-B17pnl9I.js"),__vite__mapDeps([7,1,2,3,5]))),Dm=b.lazy(()=>An(()=>import("./Settings-Dgtg-Xb9.js"),__vite__mapDeps([8,1,2,3]))),Tm={spec:Hp},Lm=220,Rm=46,po=e=>Math.max(.4,Math.min(1.6,e)),jt={nn:e=>`Create a new spec node under [[${e}]] — choose a kebab-case id, write its spec.md at contract altitude with a code: list, implement it, then propose merge. What it should be: `,dd:e=>`Delete the [[${e}]] spec node — remove its dir, repoint or fold its governed code, fix any [[…]] refs, recover its intent from git history, then propose merge. Why: `},ga=Object.keys(jt),zm=new Set(ga.map(e=>e[0]));function Hm({specs:e,sessions:t,reload:n,project:r,issuesData:s,reloadIssues:o}){const{page:i,param:a}=uc(),[c,l]=b.useState(()=>{var K;let z=null;try{z=sessionStorage.getItem("spex.focus")}catch{}return(z&&e.some(U=>U.id===z)?z:null)||((K=e.find(U=>!U.parent))==null?void 0:K.id)});b.useEffect(()=>{try{c&&sessionStorage.setItem("spex.focus",c)}catch{}},[c]);const[d,u]=b.useState(!1),[f,h]=b.useState("spec"),[p,v]=b.useState(!1),[w,m]=b.useState(null),[E,y]=b.useState("new"),[x,N]=b.useState(null),[k,P]=b.useState(null),[D,L]=b.useState(null),{getViewport:F,setViewport:M}=Bn(),j=Xe(),V=b.useRef(null),_=b.useRef(0),C=b.useRef({buf:"",timer:0}),[S,I]=b.useState(!1),R=b.useRef(!1);R.current=S;const A=b.useRef({x:-1,y:-1}),O=b.useMemo(()=>ho(),[]),B=b.useMemo(()=>ho(),[]),H=b.useMemo(()=>Object.fromEntries(e.map(z=>[z.id,z])),[e]),Y=H[c]||e.find(z=>!z.parent)||e[0],X=b.useMemo(()=>{const z=new Set;for(let K=Y;K;K=K.parent?H[K.parent]:null)z.add(K.id);return z},[Y,H]),ee=b.useMemo(()=>Ua(e,X),[e,X]),J=b.useMemo(()=>e.filter(z=>ee[z.id]).map(z=>({...z,...ee[z.id]})),[e,ee]),Z=b.useMemo(()=>Object.fromEntries(J.map(z=>[z.id,z])),[J]),$=Z[Y.id],W=b.useMemo(()=>{const z={};return e.forEach(K=>{K.parent&&(z[K.parent]=(z[K.parent]||0)+1)}),z},[e]),ne=b.useMemo(()=>e.filter(z=>{var K;return(K=z.overlays)==null?void 0:K.length}),[e]),te=b.useMemo(()=>x?t.find(z=>z.source===x):null,[t,x]),q=b.useMemo(()=>x?e.filter(z=>(z.overlays||[]).some(K=>K.source===x)):[],[e,x]),G=b.useMemo(()=>x?q:ne,[x,q,ne]),re=b.useCallback(z=>z?t.filter(K=>{var U;return(U=K.ops)==null?void 0:U.some(oe=>oe.nodeId===z.id)}):[],[t]),se=b.useCallback(z=>{y(z),Me("sessions",z)},[]),ie=b.useCallback(z=>{y("new"),P(z),Me("sessions","new")},[]),ce=b.useCallback(z=>{dc(z,{onFocusNode:l,onOpenSession:se})},[se]),me=b.useMemo(()=>{var U;if(!D)return[];const z=e.find(oe=>oe.id===D.id);return(U=z==null?void 0:z.overlays)!=null&&U.length?[...new Set(z.overlays.map(oe=>oe.source))].map(oe=>t.find(de=>de.source===oe)).filter(Boolean):[]},[D,e,t]),_e=b.useCallback(z=>{ce(z.address)},[ce]);b.useLayoutEffect(()=>{i==="sessions"&&a&&a!==E&&y(a)},[i,a]),b.useEffect(()=>{i==="sessions"&&Me("sessions",E,{replace:!0})},[i,E]),b.useEffect(()=>{i!=="graph"&&(u(!1),v(!1),m(null),L(null))},[i]);const ye=b.useMemo(()=>J.filter(z=>z.parent===$.id),[J,$]),Ee=$.parent?Z[$.parent]:null,Oe=b.useMemo(()=>ye.length?ye.reduce((z,K)=>Math.abs(K.y-$.y)<Math.abs(z.y-$.y)?K:z):null,[ye,$]),Le=b.useMemo(()=>{if(Oe)return Oe;let z=null,K=1/0;for(const U of J){const oe=U.x-$.x;if(oe<=0)continue;const de=U.y-$.y,T=(oe/Za)**2+(de/Qa)**2;T<K&&(K=T,z=U)}return z},[Oe,J,$]),Ne=b.useCallback(z=>{let K=null;for(const U of J){if(U.id===$.id||U.x!==$.x)continue;const oe=U.y-$.y;(z==="down"?oe<=0:oe>=0)||(!K||Math.abs(oe)<Math.abs(K.y-$.y))&&(K=U)}return K},[J,$]),xe=b.useMemo(()=>Ne("down"),[Ne]),Se=b.useMemo(()=>Ne("up"),[Ne]),Ce=b.useMemo(()=>J.map(z=>{const K=z.id===c||z.id===$.parent||z.parent===c||z.parent===$.parent;let U;x&&q.length?U=(z.overlays||[]).some(he=>he.source===x)?"ov-hot":"ov-dim":U=K?void 0:"is-far";const de=re(z).map(he=>({id:he.id,status:he.status,node:he.node})),T=W[z.id]||0,pe={editors:de,collapsed:T>0&&!X.has(z.id),childCount:T};return{id:z.id,type:"spec",position:{x:z.x,y:z.y},data:{...z,...pe},draggable:!1,selected:z.id===c,className:U}}),[c,$.parent,x,q,J,re,W,X]),Be=b.useMemo(()=>{const z=J.filter(U=>U.parent).map(U=>{const oe=U.id===c||U.parent===c;return{id:`${U.parent}-${U.id}`,source:U.parent,target:U.id,type:"smoothstep",style:{stroke:oe?"var(--blue)":"var(--line)",strokeWidth:oe?2:1},zIndex:oe?1:0}}),K=[];for(const U of J){const oe=(U.overlays||[]).find(T=>T.op==="moved"&&T.toParent&&Z[T.toParent]);if(!oe)continue;const de=fr(oe.seed);K.push({id:`move-${U.id}-${oe.toParent}`,source:U.id,target:oe.toParent,type:"smoothstep",animated:!0,zIndex:2,className:"move-edge",style:{stroke:de,strokeWidth:1.5,strokeDasharray:"4 4",opacity:.6},markerEnd:{type:Bt.ArrowClosed,color:de,width:14,height:14}})}return[...z,...K]},[c,J,Z]),Ut=b.useCallback((z,K)=>{const U=F(),oe=performance.now();cancelAnimationFrame(_.current);const de=T=>{const pe=K?Math.min(1,(T-oe)/K):1,he=1-Math.pow(1-pe,3);M({x:U.x+(z.x-U.x)*he,y:U.y+(z.y-U.y)*he,zoom:U.zoom+(z.zoom-U.zoom)*he}),pe<1&&(_.current=requestAnimationFrame(de))};_.current=requestAnimationFrame(de)},[F,M]),ke=b.useCallback((z,K,U=300)=>{const oe=V.current;if(!oe)return;const de=K??F().zoom;Ut({x:oe.clientWidth/2-(z.x+Lm/2)*de,y:oe.clientHeight/2-(z.y+Rm/2)*de,zoom:de},U)},[Ut,F]),Zt=b.useRef(!1);b.useEffect(()=>{if(Zt.current||i!=="graph")return;Zt.current=!0;const z=requestAnimationFrame(()=>ke($,void 0,0));return()=>cancelAnimationFrame(z)},[ke,$,i]);const Qe=b.useRef($);Qe.current=$;const Qt=b.useRef(ke);Qt.current=ke;const Jt=b.useRef(!1),Je=b.useRef(!1),dt=b.useRef(null);b.useEffect(()=>{if(i==="graph"){if(!Jt.current){Jt.current=!0,dt.current=c;return}if(Je.current){Je.current=!1,dt.current=c;return}dt.current!==c&&(dt.current=c,Qt.current(Qe.current))}},[c,i]);const ft=d||p||!!w,en=b.useRef(ft);b.useEffect(()=>{en.current&&!ft&&Im(),en.current=ft},[ft]),b.useEffect(()=>{const z=fc($).map(T=>T.key),K=T=>h(pe=>{const he=z.indexOf(pe);return z[((he<0?0:he)+T+z.length)%z.length]}),U=(T,pe)=>{T&&(pe.preventDefault(),pe.stopPropagation(),I(!0),l(T.id))},oe=T=>O(document.querySelector(".ov-body .pane-doc, .ov-body .pane-hist, .ov-body .pane-issues, .ov-body .pane-eval, .ov-body .pane-edit"),T),de=T=>{var pe,he;if(T.altKey&&!T.metaKey&&!T.ctrlKey){const Ae={Digit1:"graph",Digit2:"sessions",Digit3:"evals",Digit4:"issues",Digit5:"settings"}[T.code];if(Ae){T.preventDefault(),T.stopPropagation(),m(null),Me(Ae);return}if(T.code==="KeyN"){T.preventDefault(),T.stopPropagation(),m(null),y("new"),Me("sessions","new");return}if(T.code==="KeyF"){T.preventDefault(),T.stopPropagation(),m(null),Me("evals");return}}if(w){T.key==="Escape"&&(T.preventDefault(),T.stopPropagation(),m(null));return}if((T.metaKey||T.ctrlKey)&&T.key==="/"){T.preventDefault(),T.stopPropagation(),m("sessions");return}if(!(T.metaKey||T.ctrlKey||T.altKey)&&!((T.key==="Enter"||T.key===" ")&&((he=(pe=T.target)==null?void 0:pe.closest)!=null&&he.call(pe,"button, a[href], input, select, textarea, summary")))&&i!=="sessions"&&!(i==="evals"||i==="issues")){if(i==="settings"){ge("board.settings",T.key)&&(T.preventDefault(),T.stopPropagation(),Me("graph"));return}if(d){if(T.key==="Escape"){T.preventDefault(),u(!1);return}if(T.key==="Tab"){T.preventDefault(),T.stopPropagation(),K(T.shiftKey?-1:1);return}if(T.key==="ArrowLeft"||T.key==="h"){T.preventDefault(),T.stopPropagation(),K(-1);return}if(T.key==="ArrowRight"||T.key==="l"){T.preventDefault(),T.stopPropagation(),K(1);return}if(/^[1-9]$/.test(T.key)&&+T.key<=z.length){T.preventDefault(),T.stopPropagation(),h(z[+T.key-1]);return}if(T.key==="j"||T.key==="k"||T.key==="ArrowDown"||T.key==="ArrowUp"){T.preventDefault(),T.stopPropagation(),oe(T.key==="j"||T.key==="ArrowDown"?120:-120);return}return}if(p){if(T.key==="Escape"||T.key==="?"){T.preventDefault(),v(!1);return}if(T.key==="j"||T.key==="k"||T.key==="ArrowDown"||T.key==="ArrowUp"){T.preventDefault(),T.stopPropagation(),B(document.querySelector(".legend"),T.key==="j"||T.key==="ArrowDown"?120:-120);return}return}if(ge("board.help",T.key)){T.preventDefault(),v(!0);return}if(T.key==="Escape"&&x){T.preventDefault(),T.stopPropagation(),N(null);return}if(ge("board.settings",T.key)){T.preventDefault(),Me("settings");return}if(ge("board.search",T.key)){T.preventDefault(),T.stopPropagation(),m("board");return}if(!T.metaKey&&!T.ctrlKey&&!T.altKey&&/^[a-zA-Z]$/.test(T.key)){const Ve=C.current;if(Ve.buf||zm.has(T.key)){clearTimeout(Ve.timer);const Ae=Ve.buf+T.key;if(jt[Ae]){T.preventDefault(),T.stopPropagation(),C.current={buf:"",timer:0},ie(jt[Ae]($.id));return}if(ga.some(Gn=>Gn.startsWith(Ae))){T.preventDefault(),T.stopPropagation(),C.current={buf:Ae,timer:setTimeout(()=>{C.current={buf:"",timer:0}},700)};return}C.current={buf:"",timer:0}}}if(ge("nav.up",T.key))return U(Se,T);if(ge("nav.down",T.key))return U(xe,T);if(ge("nav.parent",T.key))return U(Ee,T);if(ge("nav.child",T.key))return U(Le,T);if(ge("board.zoomIn",T.key))T.preventDefault(),I(!0),ke($,po(F().zoom*1.2),160);else if(ge("board.zoomOut",T.key))T.preventDefault(),I(!0),ke($,po(F().zoom/1.2),160);else if(ge("board.zoomReset",T.key))T.preventDefault(),I(!0),ke($,.85,200);else if(ge("board.info",T.key))T.preventDefault(),u(!0);else if(ge("board.cycle",T.key)||ge("board.cycleRev",T.key)){if(T.preventDefault(),!G.length)return;I(!0);const Ve=ha(G,$.id,ge("board.cycleRev",T.key)?-1:1,Ae=>Ae.id);Ve&&l(Ve.id)}else ge("board.fresh",T.key)?(T.preventDefault(),ie(`[[${$.id}]] `)):ge("board.evals",T.key)&&(T.preventDefault(),Me("evals"))}};return window.addEventListener("keydown",de,!0),()=>window.removeEventListener("keydown",de,!0)},[d,i,p,w,x,$,G,Se,xe,Le,Ee,ke,F,se,ie,O,B]),b.useEffect(()=>{const z=K=>{const U=A.current,oe=K.clientX!==U.x||K.clientY!==U.y;U.x=K.clientX,U.y=K.clientY,oe&&R.current&&I(!1)};return window.addEventListener("mousemove",z,!0),()=>window.removeEventListener("mousemove",z,!0)},[]);const Wn=b.useCallback((z,K)=>{K.id!==Qe.current.id&&(Je.current=!0),l(K.id)},[]),Yn=b.useCallback((z,K)=>{K.id!==Qe.current.id&&(Je.current=!0),l(K.id),u(!0)},[]),Xn=b.useCallback((z,K)=>{z.preventDefault(),K.id!==Qe.current.id&&(Je.current=!0),l(K.id),L({x:z.clientX,y:z.clientY,id:K.id})},[]),tn=b.useCallback((z,K=!0)=>{const U=K&&x===z.source;if(N(U?null:z.source),U)return;const oe=new Set((z.ops||[]).map(T=>T.nodeId)),de=e.find(T=>oe.has(T.id));de&&l(de.id)},[x,e]),[Kn,qn]=Cm("spex.fpWidth",250,{min:190,max:520,dir:-1});return g.jsxs("div",{className:S?"app kbd-mode":"app",children:[g.jsx(Mm,{}),g.jsx(Nm,{page:i,onNav:Me}),g.jsxs("div",{className:"app-main",children:[g.jsxs("div",{className:"page-graph",style:{"--fp-w":`${Kn}px`,display:i==="graph"?void 0:"none"},children:[g.jsxs("div",{className:"graph",ref:V,children:[g.jsx(lp,{nodes:Ce,edges:Be,nodeTypes:Tm,onNodeClick:Wn,onNodeDoubleClick:Yn,onNodeContextMenu:Xn,zoomOnDoubleClick:!1,nodesDraggable:!1,nodesFocusable:!1,disableKeyboardA11y:!0,defaultViewport:{x:0,y:0,zoom:.85},minZoom:.4,maxZoom:1.6,proOptions:{hideAttribution:!0}}),g.jsxs("div",{className:"hud",children:[g.jsxs("span",{className:"brand",children:["$ ",r||"spec-dashboard"]}),g.jsx("button",{className:"hud-help",onClick:()=>v(z=>!z),"data-tip":j("hud.helpTitle"),children:"?"})]}),g.jsx(hc,{sessions:t,activeId:x,onPick:tn,onOpenSession:se}),g.jsx(_m,{specs:e,focusId:c,onJump:l}),g.jsx(Bp,{menu:D,onClose:()=>L(null),onInfo:()=>u(!0),onFresh:z=>ie(`[[${z}]] `),onNewChild:z=>ie(jt.nn(z)),onDelete:z=>ie(jt.dd(z)),sessions:me,onOpenSession:se}),te&&g.jsxs("div",{className:"lock-hint",style:{"--ov":fr(te.id)},children:[g.jsxs("span",{className:"lock-hint-lead",children:[g.jsx(gc,{})," ",Ar(te)]}),q.length?g.jsxs("span",{className:"lock-hint-body",children:[j("lockHint.cycleBefore"),g.jsx("kbd",{children:"o"}),g.jsx("kbd",{children:"O"}),j("lockHint.cycleAfter",{n:q.length})]}):g.jsx("span",{className:"lock-hint-body",children:j("lockHint.empty")}),g.jsx("button",{className:"lock-hint-release",onClick:()=>N(null),"data-tip":j("lockHint.releaseTitle"),children:j("lockHint.release")})]}),p&&g.jsx(rm,{onClose:()=>v(!1)})]}),g.jsx("div",{className:"pane-resizer",onMouseDown:qn,role:"separator","aria-orientation":"vertical"}),g.jsx(Wp,{node:$,onNavigateAddress:ce})]}),d&&g.jsx(pc,{node:$,pane:f,setPane:h,onClose:()=>u(!1)},$.id),g.jsx(b.Suspense,{fallback:null,children:g.jsx($m,{sessions:t,specs:e,focusNode:$,open:i==="sessions",searchOpen:!!w,sel:E,setSel:y,seed:k,onSeedConsumed:()=>P(null),onClose:()=>Me("graph"),onPickSession:tn,onOpenSession:se,onOpenSearch:()=>m("sessions"),reload:n})}),i==="evals"&&g.jsx("div",{className:"page-pane page-evals",children:g.jsx(b.Suspense,{fallback:g.jsx("div",{className:"loading",children:j("hud.loading")}),children:g.jsx(jm,{specs:e,sessions:t,reloadBoard:n,onOpenSession:se})})}),i==="issues"&&g.jsx("div",{className:"page-pane page-issues",children:g.jsx(b.Suspense,{fallback:g.jsx("div",{className:"loading",children:j("hud.loading")}),children:g.jsx(Pm,{specs:e,sessions:t,issuesData:s,reloadIssues:o,issueId:a,onOpenSession:se,onFocusNode:z=>{l(z),Me("graph")}})})}),i==="settings"&&g.jsx(b.Suspense,{fallback:g.jsx("div",{className:"loading",children:j("hud.loading")}),children:g.jsx(Dm,{})}),w&&g.jsx(xm,{specs:e,sessions:t,onPick:_e,onClose:()=>m(null),boost:w==="sessions"?"session":null})]})]})}function Om(e){return g.jsx(sa,{children:g.jsx(Hm,{...e})})}const Xm=Object.freeze(Object.defineProperty({__proto__:null,default:Om},Symbol.toStringTag,{value:"Module"}));export{la as A,Xm as D,Yp as M,Cm as a,Kp as b,Fm as i,ua as k,Ym as r,Wm as s,Op as u};
|
|
27
|
+
${u.body}`}}),i=o.length,a=o.reduce((u,f)=>u+f.bodyWords.length,0)/(i||1),c=o.reduce((u,f)=>u+f.descWords.length,0)/(i||1),l={};for(const u of s){let f=0;for(const h of o)(h.nameWords.some(p=>fa(u,p))||h.descWords.some(p=>Cn(u,p))||h.bodyWords.some(p=>Cn(u,p)))&&f++;l[u]=f>0?Math.log(i/f):0}const d=[];for(const u of o){let f=0;for(const h of s)f+=um(h,u,a,c)*l[h];f<=0||d.push({ref:u.ref,score:Math.round(f*100)/100,snippet:dm(u.snippetText,u.desc,s)})}return d.sort((u,f)=>f.score-u.score),d.slice(0,r)}const hm={pass:"var(--green)",fail:"var(--red)",stalePass:"var(--muted)",staleFail:"var(--muted)",empty:"var(--muted)",missing:"var(--muted)"},gm=e=>(e||"").replace(/^\.spec\//,"").replace(/\/spec\.md$/,""),uo=["spec","session","issue","scenario"],pm=e=>e?[e,...uo.filter(t=>t!==e)]:uo;function mm(e,t,n){var o,i;const r=n==null?void 0:n.bodies,s=[];for(const a of e){const c=gm(a.path);s.push({kind:"spec",key:`spec:${a.id}`,target:a.id,address:sc(a.id),color:(ot[a.status]||ot.pending).color,title:a.title||a.id,sub:c,name:`${a.title||a.id} ${a.id}`,desc:a.desc||"",body:(r==null?void 0:r[a.id])??a.body??""});for(const l of a.issues||[]){const d=l.status==="open";s.push({kind:"issue",key:`issue:${a.id}:${l.id}`,target:l.id,nodeId:a.id,address:oc(l.id),color:d?"var(--green)":"var(--muted)",title:l.concern,sub:`${l.id} · ${c}`,name:l.concern||"",desc:l.id,body:""})}for(const l of Ir(a.scenarios,a.evals)){const d=(i=(o=n==null?void 0:n.scenarios)==null?void 0:o[a.id])==null?void 0:i[l.name];s.push({kind:"scenario",key:`scenario:${a.id}:${l.name}`,target:l.name,nodeId:a.id,address:xo(a.id,l.name),color:hm[l.state]||"var(--cyan)",title:l.name,sub:c,tags:l.tags,name:l.name||"",desc:"",body:d?`${d.description||""} ${d.expected||""}`.trim():l.expected||""})}}for(const a of t){const c=Ar(a),l=ic(a),d=a.status||a.promptPreview||a.note||"";s.push({kind:"session",key:`session:${a.id}`,target:a.id,address:ac(a.id),color:hr[a.status]||hr.offline,title:c,sub:d,name:c||"",desc:a.status||"",body:`${a.promptPreview||a.note||""} ${l}`.trim()})}return s}function ym(e,t,n){const r=Object.fromEntries(n.map((a,c)=>[a,c])),s=(a,c)=>r[a.kind]-r[c.kind]||a.name.length-c.name.length||a.key.localeCompare(c.key);if(!t.trim())return e.slice().sort(s).slice(0,15);const o={};for(const a of n){const c=e.filter(l=>l.kind===a).sort((l,d)=>l.name.length-d.name.length||l.key.localeCompare(d.key));o[a]=fm(t,c.map(l=>({ref:l,name:l.name,desc:l.desc,body:l.body})),{limit:15}).map(l=>l.ref)}const i=[];for(let a=0;i.length<15;a++){let c=!1;for(const l of n)o[l][a]&&i.length<15&&(i.push(o[l][a]),c=!0);if(!c)break}return i}function xm({specs:e,sessions:t,onPick:n,onClose:r,boost:s=null}){const o=Xe(),i=ca(),[a,c]=b.useState(""),[l,d]=b.useState("");b.useEffect(()=>{if(!a.trim()){d(a);return}const x=setTimeout(()=>d(a),120);return()=>clearTimeout(x)},[a]);const[u,f]=b.useState(0),h=b.useRef(null),p=b.useRef(null),v=b.useMemo(()=>pm(s),[s]),w=b.useMemo(()=>mm(e,t,i),[e,t,i]),m=b.useMemo(()=>ym(w,l,v),[w,l,v]);b.useEffect(()=>{var x;(x=h.current)==null||x.focus()},[]),b.useEffect(()=>{f(0)},[a]),b.useEffect(()=>{var x,N;(N=(x=p.current)==null?void 0:x.querySelector(".search-item.on"))==null||N.scrollIntoView({block:"nearest"})},[u,m]);const E=x=>{x&&(n(x),r())},y=x=>{x.key==="ArrowDown"?(x.preventDefault(),f(N=>Math.min(m.length-1,N+1))):x.key==="ArrowUp"?(x.preventDefault(),f(N=>Math.max(0,N-1))):x.key==="Enter"?(x.preventDefault(),E(m[u])):x.key==="Escape"&&(x.preventDefault(),r())};return g.jsx("div",{className:"search-backdrop","data-focus-overlay":!0,onClick:r,children:g.jsxs("div",{className:"search-panel",role:"dialog","aria-modal":"true","aria-label":o("search.title"),onClick:x=>x.stopPropagation(),children:[g.jsxs("div",{className:"search-bar",children:[g.jsx("span",{className:"search-icon",children:"⌕"}),g.jsx("input",{ref:h,className:"search-input",value:a,placeholder:o("search.placeholder"),onChange:x=>c(x.target.value),onKeyDown:y})]}),g.jsxs("ul",{className:"search-results",ref:p,children:[m.length===0&&g.jsx("li",{className:"search-empty",children:o("search.empty")}),m.map((x,N)=>g.jsxs("li",{className:`search-item${N===u?" on":""}`,onMouseEnter:()=>f(N),onClick:()=>E(x),children:[g.jsx("span",{className:"node-dot",style:{background:x.color}}),g.jsx("span",{className:`search-kind k-${x.kind}`,children:o(`search.kind.${x.kind}`)}),g.jsx("span",{className:"search-title",children:x.title||x.target}),g.jsx(yo,{tags:x.tags}),g.jsx("span",{className:"search-path",children:x.sub})]},x.key))]}),g.jsx("div",{className:"search-foot",children:o("search.hint")})]})})}function ha(e,t,n=1,r=s=>s){if(!e.length)return null;const s=e.findIndex(o=>r(o)===t);return s===-1?n>0?e[0]:e[e.length-1]:e[(s+n+e.length)%e.length]}const wm=["merged","active","drift","pending"],vm=[{state:"pass",always:!0,titleKey:"scorePass"},{state:"fail",always:!0,titleKey:"scoreFail"},{state:"stalePass",always:!1,titleKey:"scoreStalePass"},{state:"staleFail",always:!1,titleKey:"scoreStaleFail"},{state:"empty",always:!1,titleKey:"scoreEmpty"}];function bm(e){const t={merged:[],active:[],drift:[],pending:[]},n=[],r=[],s=new Set,o={pass:0,fail:0,stalePass:0,staleFail:0,empty:0},i={pass:[],fail:[],stalePass:[],staleFail:[],empty:[]};for(const a of e){t[a.status]&&t[a.status].push(a.id),a.drift>0&&n.push(a.id);const c=a.openIssues||[];if(c.length){r.push(a.id);for(const d of c)s.add(d.id)}const l=new Set;for(const d of Ir(a.scenarios,a.evals)){const u=d.state==="missing"?"empty":d.state;o[u]!==void 0&&(o[u]++,l.has(u)||(l.add(u),i[u].push(a.id)))}}return{total:e.length,status:t,driftIds:n,issueIds:r,issueCount:s.size,scoreCount:o,scoreNodes:i}}function hn({count:e,ids:t,focusId:n,onJump:r,title:s,cls:o="",children:i}){const a=t.length>0;return g.jsxs("button",{type:"button",className:`bstat ${o}`.trim(),disabled:!a,"data-tip":s,"aria-label":s,onClick:a?()=>r(ha(t,n)):void 0,children:[i,e]})}function _m({specs:e,focusId:t,onJump:n}){const r=Xe(),s=b.useMemo(()=>bm(e),[e]),o=i=>i&&(n==null?void 0:n(i));return g.jsxs("div",{className:"board-stats",role:"group","aria-label":r("stats.aria"),children:[g.jsx("span",{className:"bstat-total","data-tip":r("stats.totalTitle",{n:s.total}),children:s.total}),wm.map(i=>g.jsx(hn,{count:s.status[i].length,ids:s.status[i],focusId:t,onJump:o,title:r("stats.statusTitle",{n:s.status[i].length,status:r(`status.${i}`)}),children:g.jsx("span",{className:"bstat-dot",style:{background:ot[i].color}})},i)),g.jsx("span",{className:"bstat-sep"}),g.jsx(hn,{count:s.driftIds.length,ids:s.driftIds,focusId:t,onJump:o,cls:"bstat-drift",title:r("stats.driftTitle",{n:s.driftIds.length}),children:"⚠"}),g.jsx(hn,{count:s.issueCount,ids:s.issueIds,focusId:t,onJump:o,cls:"bstat-issue",title:r("stats.issueTitle",{n:s.issueCount}),children:"◆"}),g.jsx("span",{className:"bstat-sep"}),vm.map(({state:i,always:a,titleKey:c})=>{const l=s.scoreCount[i],d=s.scoreNodes[i];return!l&&!a?null:g.jsx(hn,{count:l,ids:d,focusId:t,onJump:o,title:r(`stats.${c}`,{n:l}),children:g.jsx(cc,{state:i})},i)})]})}const Em=["graph","sessions","evals","issues"];function fo({page:e,active:t,onNav:n,label:r}){return g.jsx("button",{type:"button",className:t?"rail-btn on":"rail-btn","data-tip":r,"aria-label":r,"aria-current":t?"page":void 0,onClick:()=>n(e),children:g.jsx(lc,{name:e,size:18})})}function Nm({page:e,onNav:t}){const n=Xe();return g.jsxs("nav",{className:"side-rail","aria-label":n("nav.railLabel"),children:[Em.map(r=>g.jsx(fo,{page:r,active:e===r,onNav:t,label:n(`nav.${r}`)},r)),g.jsx("div",{className:"rail-spacer"}),g.jsx(fo,{page:"settings",active:e==="settings",onNav:t,label:n("nav.settings")})]})}const Sm=400,km=80,ur=7,dr=6;function Mm(){const[e,t]=b.useState(null),n=b.useRef(null),r=b.useRef(0),s=b.useRef(null),o=b.useRef(null),i=b.useRef(!1);return b.useEffect(()=>{const a=()=>{r.current&&(clearTimeout(r.current),r.current=0)},c=()=>{a(),s.current=null,o.current&&(o.current.getAttribute("aria-describedby")==="ui-tip"&&o.current.removeAttribute("aria-describedby"),o.current=null),t(w=>(w&&(i.current=!0,setTimeout(()=>{s.current||(i.current=!1)},300)),null))},l=w=>{const m=w.getAttribute("data-tip");!m||!w.isConnected||(s.current=w,w.getAttribute("aria-describedby")||(w.setAttribute("aria-describedby","ui-tip"),o.current=w),t({text:m,anchor:w}))},d=(w,m)=>{s.current!==w&&(a(),s.current=w,r.current=setTimeout(()=>{r.current=0,l(w)},m))},u=w=>{var E,y;const m=(y=(E=w.target).closest)==null?void 0:y.call(E,"[data-tip]");m&&d(m,i.current?km:Sm)},f=w=>{var E,y;const m=(y=(E=w.target).closest)==null?void 0:y.call(E,"[data-tip]");!m||m!==s.current||m.contains(w.relatedTarget)||c()},h=w=>{var y,x;const m=(x=(y=w.target).closest)==null?void 0:x.call(y,"[data-tip]");if(!m)return;let E=!0;try{E=m.matches(":focus-visible")}catch{}E&&(a(),l(m))},p=w=>{var E,y;const m=(y=(E=w.target).closest)==null?void 0:y.call(E,"[data-tip]");m&&m===s.current&&c()},v=w=>{w.key==="Escape"&&c()};return document.addEventListener("pointerover",u,!0),document.addEventListener("pointerout",f,!0),document.addEventListener("focusin",h,!0),document.addEventListener("focusout",p,!0),document.addEventListener("keydown",v,!0),document.addEventListener("pointerdown",c,!0),window.addEventListener("scroll",c,!0),window.addEventListener("resize",c),()=>{a(),document.removeEventListener("pointerover",u,!0),document.removeEventListener("pointerout",f,!0),document.removeEventListener("focusin",h,!0),document.removeEventListener("focusout",p,!0),document.removeEventListener("keydown",v,!0),document.removeEventListener("pointerdown",c,!0),window.removeEventListener("scroll",c,!0),window.removeEventListener("resize",c)}},[]),b.useEffect(()=>{const a=n.current;if(!e||!a)return;if(!e.anchor.isConnected){t(null);return}const c=e.anchor.getBoundingClientRect(),l=a.getBoundingClientRect(),d=c.top-l.height-ur>=dr?"top":"bottom",u=d==="top"?c.top-l.height-ur:c.bottom+ur,f=Math.min(Math.max(c.left+c.width/2-l.width/2,dr),window.innerWidth-l.width-dr);a.dataset.place=d,a.style.top=`${Math.round(u)}px`,a.style.left=`${Math.round(f)}px`;const h=a.querySelector(".ui-tip-arrow");h&&(h.style.left=`${Math.round(Math.min(Math.max(c.left+c.width/2-f,10),l.width-10))-4}px`);const p=requestAnimationFrame(()=>a.classList.add("show"));return()=>cancelAnimationFrame(p)},[e]),e?Ga.createPortal(g.jsxs("div",{id:"ui-tip",role:"tooltip",ref:n,className:"ui-tip",children:[e.text,g.jsx("span",{className:"ui-tip-arrow","aria-hidden":"true"})]}),document.body):null}function Cm(e,t,{min:n,max:r,dir:s=1}={}){const[o,i]=b.useState(()=>{try{const l=parseInt(localStorage.getItem(e),10);if(Number.isFinite(l))return Math.max(n,Math.min(r,l))}catch{}return t}),a=b.useRef(null),c=b.useCallback(l=>{l.preventDefault(),a.current={x:l.clientX,w:o};const d=f=>{const h=a.current;if(!h)return;const p=Math.max(n,Math.min(r,h.w+(f.clientX-h.x)*s));i(p)},u=()=>{a.current=null,window.removeEventListener("mousemove",d),window.removeEventListener("mouseup",u),document.body.classList.remove("is-resizing"),i(f=>{try{localStorage.setItem(e,String(Math.round(f)))}catch{}return f})};window.addEventListener("mousemove",d),window.addEventListener("mouseup",u),document.body.classList.add("is-resizing")},[e,o,n,r,s]);return[o,c]}function ho(){let e=0,t=null,n=null,r=null;return function(o,i){if(!o)return;const a=r!=null&&Math.abs(o.scrollTop-r)>1;(o!==n||a)&&(n=o,t=null,r=null);const c=o.scrollHeight-o.clientHeight,l=t??o.scrollTop;t=Math.max(0,Math.min(c,l+i)),cancelAnimationFrame(e);const d=()=>{if(r!=null&&Math.abs(o.scrollTop-r)>1){cancelAnimationFrame(e),t=null,r=null;return}const u=t-o.scrollTop;if(Math.abs(u)<.5){o.scrollTop=t,r=o.scrollTop;return}o.scrollTop+=u*.2,r=o.scrollTop,e=requestAnimationFrame(d)};e=requestAnimationFrame(d)}}let Cr=null;const Am=e=>!!(e&&e.closest&&e.closest("[data-focus-overlay]")),go=e=>!!(e&&e.isConnected&&!e.disabled&&e.getClientRects().length);typeof window<"u"&&window.addEventListener("focusin",e=>{const t=e.target;t&&t!==document.body&&!Am(t)&&(Cr=t)},!0);function Im(){requestAnimationFrame(()=>{if(go(Cr)){Cr.focus();return}const e=document.querySelector("[data-focus-sink]");go(e)&&e.focus()})}const $m=b.lazy(()=>An(()=>import("./SessionInterface-YLD6IOmC.js"),__vite__mapDeps([0,1,2,3,4,5,6]))),jm=b.lazy(()=>An(()=>import("./EvalsPage-CDxc1-in.js").then(e=>e.b),__vite__mapDeps([4,1,2,3,5]))),Pm=b.lazy(()=>An(()=>import("./IssuesPage-C2yFXiO-.js"),__vite__mapDeps([7,1,2,3,5]))),Dm=b.lazy(()=>An(()=>import("./Settings-ZnOwskMZ.js"),__vite__mapDeps([8,1,2,3]))),Tm={spec:Hp},Lm=220,Rm=46,po=e=>Math.max(.4,Math.min(1.6,e)),jt={nn:e=>`Create a new spec node under [[${e}]] — choose a kebab-case id, write its spec.md at contract altitude with a code: list, implement it, then propose merge. What it should be: `,dd:e=>`Delete the [[${e}]] spec node — remove its dir, repoint or fold its governed code, fix any [[…]] refs, recover its intent from git history, then propose merge. Why: `},ga=Object.keys(jt),zm=new Set(ga.map(e=>e[0]));function Hm({specs:e,sessions:t,reload:n,project:r,issuesData:s,reloadIssues:o}){const{page:i,param:a}=uc(),[c,l]=b.useState(()=>{var K;let z=null;try{z=sessionStorage.getItem("spex.focus")}catch{}return(z&&e.some(U=>U.id===z)?z:null)||((K=e.find(U=>!U.parent))==null?void 0:K.id)});b.useEffect(()=>{try{c&&sessionStorage.setItem("spex.focus",c)}catch{}},[c]);const[d,u]=b.useState(!1),[f,h]=b.useState("spec"),[p,v]=b.useState(!1),[w,m]=b.useState(null),[E,y]=b.useState("new"),[x,N]=b.useState(null),[k,P]=b.useState(null),[D,L]=b.useState(null),{getViewport:F,setViewport:M}=Bn(),j=Xe(),V=b.useRef(null),_=b.useRef(0),C=b.useRef({buf:"",timer:0}),[S,I]=b.useState(!1),R=b.useRef(!1);R.current=S;const A=b.useRef({x:-1,y:-1}),O=b.useMemo(()=>ho(),[]),B=b.useMemo(()=>ho(),[]),H=b.useMemo(()=>Object.fromEntries(e.map(z=>[z.id,z])),[e]),Y=H[c]||e.find(z=>!z.parent)||e[0],X=b.useMemo(()=>{const z=new Set;for(let K=Y;K;K=K.parent?H[K.parent]:null)z.add(K.id);return z},[Y,H]),ee=b.useMemo(()=>Ua(e,X),[e,X]),J=b.useMemo(()=>e.filter(z=>ee[z.id]).map(z=>({...z,...ee[z.id]})),[e,ee]),Z=b.useMemo(()=>Object.fromEntries(J.map(z=>[z.id,z])),[J]),$=Z[Y.id],W=b.useMemo(()=>{const z={};return e.forEach(K=>{K.parent&&(z[K.parent]=(z[K.parent]||0)+1)}),z},[e]),ne=b.useMemo(()=>e.filter(z=>{var K;return(K=z.overlays)==null?void 0:K.length}),[e]),te=b.useMemo(()=>x?t.find(z=>z.source===x):null,[t,x]),q=b.useMemo(()=>x?e.filter(z=>(z.overlays||[]).some(K=>K.source===x)):[],[e,x]),G=b.useMemo(()=>x?q:ne,[x,q,ne]),re=b.useCallback(z=>z?t.filter(K=>{var U;return(U=K.ops)==null?void 0:U.some(oe=>oe.nodeId===z.id)}):[],[t]),se=b.useCallback(z=>{y(z),Me("sessions",z)},[]),ie=b.useCallback(z=>{y("new"),P(z),Me("sessions","new")},[]),ce=b.useCallback(z=>{dc(z,{onFocusNode:l,onOpenSession:se})},[se]),me=b.useMemo(()=>{var U;if(!D)return[];const z=e.find(oe=>oe.id===D.id);return(U=z==null?void 0:z.overlays)!=null&&U.length?[...new Set(z.overlays.map(oe=>oe.source))].map(oe=>t.find(de=>de.source===oe)).filter(Boolean):[]},[D,e,t]),_e=b.useCallback(z=>{ce(z.address)},[ce]);b.useLayoutEffect(()=>{i==="sessions"&&a&&a!==E&&y(a)},[i,a]),b.useEffect(()=>{i==="sessions"&&Me("sessions",E,{replace:!0})},[i,E]),b.useEffect(()=>{i!=="graph"&&(u(!1),v(!1),m(null),L(null))},[i]);const ye=b.useMemo(()=>J.filter(z=>z.parent===$.id),[J,$]),Ee=$.parent?Z[$.parent]:null,Oe=b.useMemo(()=>ye.length?ye.reduce((z,K)=>Math.abs(K.y-$.y)<Math.abs(z.y-$.y)?K:z):null,[ye,$]),Le=b.useMemo(()=>{if(Oe)return Oe;let z=null,K=1/0;for(const U of J){const oe=U.x-$.x;if(oe<=0)continue;const de=U.y-$.y,T=(oe/Za)**2+(de/Qa)**2;T<K&&(K=T,z=U)}return z},[Oe,J,$]),Ne=b.useCallback(z=>{let K=null;for(const U of J){if(U.id===$.id||U.x!==$.x)continue;const oe=U.y-$.y;(z==="down"?oe<=0:oe>=0)||(!K||Math.abs(oe)<Math.abs(K.y-$.y))&&(K=U)}return K},[J,$]),xe=b.useMemo(()=>Ne("down"),[Ne]),Se=b.useMemo(()=>Ne("up"),[Ne]),Ce=b.useMemo(()=>J.map(z=>{const K=z.id===c||z.id===$.parent||z.parent===c||z.parent===$.parent;let U;x&&q.length?U=(z.overlays||[]).some(he=>he.source===x)?"ov-hot":"ov-dim":U=K?void 0:"is-far";const de=re(z).map(he=>({id:he.id,status:he.status,node:he.node})),T=W[z.id]||0,pe={editors:de,collapsed:T>0&&!X.has(z.id),childCount:T};return{id:z.id,type:"spec",position:{x:z.x,y:z.y},data:{...z,...pe},draggable:!1,selected:z.id===c,className:U}}),[c,$.parent,x,q,J,re,W,X]),Be=b.useMemo(()=>{const z=J.filter(U=>U.parent).map(U=>{const oe=U.id===c||U.parent===c;return{id:`${U.parent}-${U.id}`,source:U.parent,target:U.id,type:"smoothstep",style:{stroke:oe?"var(--blue)":"var(--line)",strokeWidth:oe?2:1},zIndex:oe?1:0}}),K=[];for(const U of J){const oe=(U.overlays||[]).find(T=>T.op==="moved"&&T.toParent&&Z[T.toParent]);if(!oe)continue;const de=fr(oe.seed);K.push({id:`move-${U.id}-${oe.toParent}`,source:U.id,target:oe.toParent,type:"smoothstep",animated:!0,zIndex:2,className:"move-edge",style:{stroke:de,strokeWidth:1.5,strokeDasharray:"4 4",opacity:.6},markerEnd:{type:Bt.ArrowClosed,color:de,width:14,height:14}})}return[...z,...K]},[c,J,Z]),Ut=b.useCallback((z,K)=>{const U=F(),oe=performance.now();cancelAnimationFrame(_.current);const de=T=>{const pe=K?Math.min(1,(T-oe)/K):1,he=1-Math.pow(1-pe,3);M({x:U.x+(z.x-U.x)*he,y:U.y+(z.y-U.y)*he,zoom:U.zoom+(z.zoom-U.zoom)*he}),pe<1&&(_.current=requestAnimationFrame(de))};_.current=requestAnimationFrame(de)},[F,M]),ke=b.useCallback((z,K,U=300)=>{const oe=V.current;if(!oe)return;const de=K??F().zoom;Ut({x:oe.clientWidth/2-(z.x+Lm/2)*de,y:oe.clientHeight/2-(z.y+Rm/2)*de,zoom:de},U)},[Ut,F]),Zt=b.useRef(!1);b.useEffect(()=>{if(Zt.current||i!=="graph")return;Zt.current=!0;const z=requestAnimationFrame(()=>ke($,void 0,0));return()=>cancelAnimationFrame(z)},[ke,$,i]);const Qe=b.useRef($);Qe.current=$;const Qt=b.useRef(ke);Qt.current=ke;const Jt=b.useRef(!1),Je=b.useRef(!1),dt=b.useRef(null);b.useEffect(()=>{if(i==="graph"){if(!Jt.current){Jt.current=!0,dt.current=c;return}if(Je.current){Je.current=!1,dt.current=c;return}dt.current!==c&&(dt.current=c,Qt.current(Qe.current))}},[c,i]);const ft=d||p||!!w,en=b.useRef(ft);b.useEffect(()=>{en.current&&!ft&&Im(),en.current=ft},[ft]),b.useEffect(()=>{const z=fc($).map(T=>T.key),K=T=>h(pe=>{const he=z.indexOf(pe);return z[((he<0?0:he)+T+z.length)%z.length]}),U=(T,pe)=>{T&&(pe.preventDefault(),pe.stopPropagation(),I(!0),l(T.id))},oe=T=>O(document.querySelector(".ov-body .pane-doc, .ov-body .pane-hist, .ov-body .pane-issues, .ov-body .pane-eval, .ov-body .pane-edit"),T),de=T=>{var pe,he;if(T.altKey&&!T.metaKey&&!T.ctrlKey){const Ae={Digit1:"graph",Digit2:"sessions",Digit3:"evals",Digit4:"issues",Digit5:"settings"}[T.code];if(Ae){T.preventDefault(),T.stopPropagation(),m(null),Me(Ae);return}if(T.code==="KeyN"){T.preventDefault(),T.stopPropagation(),m(null),y("new"),Me("sessions","new");return}if(T.code==="KeyF"){T.preventDefault(),T.stopPropagation(),m(null),Me("evals");return}}if(w){T.key==="Escape"&&(T.preventDefault(),T.stopPropagation(),m(null));return}if((T.metaKey||T.ctrlKey)&&T.key==="/"){T.preventDefault(),T.stopPropagation(),m("sessions");return}if(!(T.metaKey||T.ctrlKey||T.altKey)&&!((T.key==="Enter"||T.key===" ")&&((he=(pe=T.target)==null?void 0:pe.closest)!=null&&he.call(pe,"button, a[href], input, select, textarea, summary")))&&i!=="sessions"&&!(i==="evals"||i==="issues")){if(i==="settings"){ge("board.settings",T.key)&&(T.preventDefault(),T.stopPropagation(),Me("graph"));return}if(d){if(T.key==="Escape"){T.preventDefault(),u(!1);return}if(T.key==="Tab"){T.preventDefault(),T.stopPropagation(),K(T.shiftKey?-1:1);return}if(T.key==="ArrowLeft"||T.key==="h"){T.preventDefault(),T.stopPropagation(),K(-1);return}if(T.key==="ArrowRight"||T.key==="l"){T.preventDefault(),T.stopPropagation(),K(1);return}if(/^[1-9]$/.test(T.key)&&+T.key<=z.length){T.preventDefault(),T.stopPropagation(),h(z[+T.key-1]);return}if(T.key==="j"||T.key==="k"||T.key==="ArrowDown"||T.key==="ArrowUp"){T.preventDefault(),T.stopPropagation(),oe(T.key==="j"||T.key==="ArrowDown"?120:-120);return}return}if(p){if(T.key==="Escape"||T.key==="?"){T.preventDefault(),v(!1);return}if(T.key==="j"||T.key==="k"||T.key==="ArrowDown"||T.key==="ArrowUp"){T.preventDefault(),T.stopPropagation(),B(document.querySelector(".legend"),T.key==="j"||T.key==="ArrowDown"?120:-120);return}return}if(ge("board.help",T.key)){T.preventDefault(),v(!0);return}if(T.key==="Escape"&&x){T.preventDefault(),T.stopPropagation(),N(null);return}if(ge("board.settings",T.key)){T.preventDefault(),Me("settings");return}if(ge("board.search",T.key)){T.preventDefault(),T.stopPropagation(),m("board");return}if(!T.metaKey&&!T.ctrlKey&&!T.altKey&&/^[a-zA-Z]$/.test(T.key)){const Ve=C.current;if(Ve.buf||zm.has(T.key)){clearTimeout(Ve.timer);const Ae=Ve.buf+T.key;if(jt[Ae]){T.preventDefault(),T.stopPropagation(),C.current={buf:"",timer:0},ie(jt[Ae]($.id));return}if(ga.some(Gn=>Gn.startsWith(Ae))){T.preventDefault(),T.stopPropagation(),C.current={buf:Ae,timer:setTimeout(()=>{C.current={buf:"",timer:0}},700)};return}C.current={buf:"",timer:0}}}if(ge("nav.up",T.key))return U(Se,T);if(ge("nav.down",T.key))return U(xe,T);if(ge("nav.parent",T.key))return U(Ee,T);if(ge("nav.child",T.key))return U(Le,T);if(ge("board.zoomIn",T.key))T.preventDefault(),I(!0),ke($,po(F().zoom*1.2),160);else if(ge("board.zoomOut",T.key))T.preventDefault(),I(!0),ke($,po(F().zoom/1.2),160);else if(ge("board.zoomReset",T.key))T.preventDefault(),I(!0),ke($,.85,200);else if(ge("board.info",T.key))T.preventDefault(),u(!0);else if(ge("board.cycle",T.key)||ge("board.cycleRev",T.key)){if(T.preventDefault(),!G.length)return;I(!0);const Ve=ha(G,$.id,ge("board.cycleRev",T.key)?-1:1,Ae=>Ae.id);Ve&&l(Ve.id)}else ge("board.fresh",T.key)?(T.preventDefault(),ie(`[[${$.id}]] `)):ge("board.evals",T.key)&&(T.preventDefault(),Me("evals"))}};return window.addEventListener("keydown",de,!0),()=>window.removeEventListener("keydown",de,!0)},[d,i,p,w,x,$,G,Se,xe,Le,Ee,ke,F,se,ie,O,B]),b.useEffect(()=>{const z=K=>{const U=A.current,oe=K.clientX!==U.x||K.clientY!==U.y;U.x=K.clientX,U.y=K.clientY,oe&&R.current&&I(!1)};return window.addEventListener("mousemove",z,!0),()=>window.removeEventListener("mousemove",z,!0)},[]);const Wn=b.useCallback((z,K)=>{K.id!==Qe.current.id&&(Je.current=!0),l(K.id)},[]),Yn=b.useCallback((z,K)=>{K.id!==Qe.current.id&&(Je.current=!0),l(K.id),u(!0)},[]),Xn=b.useCallback((z,K)=>{z.preventDefault(),K.id!==Qe.current.id&&(Je.current=!0),l(K.id),L({x:z.clientX,y:z.clientY,id:K.id})},[]),tn=b.useCallback((z,K=!0)=>{const U=K&&x===z.source;if(N(U?null:z.source),U)return;const oe=new Set((z.ops||[]).map(T=>T.nodeId)),de=e.find(T=>oe.has(T.id));de&&l(de.id)},[x,e]),[Kn,qn]=Cm("spex.fpWidth",250,{min:190,max:520,dir:-1});return g.jsxs("div",{className:S?"app kbd-mode":"app",children:[g.jsx(Mm,{}),g.jsx(Nm,{page:i,onNav:Me}),g.jsxs("div",{className:"app-main",children:[g.jsxs("div",{className:"page-graph",style:{"--fp-w":`${Kn}px`,display:i==="graph"?void 0:"none"},children:[g.jsxs("div",{className:"graph",ref:V,children:[g.jsx(lp,{nodes:Ce,edges:Be,nodeTypes:Tm,onNodeClick:Wn,onNodeDoubleClick:Yn,onNodeContextMenu:Xn,zoomOnDoubleClick:!1,nodesDraggable:!1,nodesFocusable:!1,disableKeyboardA11y:!0,defaultViewport:{x:0,y:0,zoom:.85},minZoom:.4,maxZoom:1.6,proOptions:{hideAttribution:!0}}),g.jsxs("div",{className:"hud",children:[g.jsxs("span",{className:"brand",children:["$ ",r||"spec-dashboard"]}),g.jsx("button",{className:"hud-help",onClick:()=>v(z=>!z),"data-tip":j("hud.helpTitle"),children:"?"})]}),g.jsx(hc,{sessions:t,activeId:x,onPick:tn,onOpenSession:se}),g.jsx(_m,{specs:e,focusId:c,onJump:l}),g.jsx(Bp,{menu:D,onClose:()=>L(null),onInfo:()=>u(!0),onFresh:z=>ie(`[[${z}]] `),onNewChild:z=>ie(jt.nn(z)),onDelete:z=>ie(jt.dd(z)),sessions:me,onOpenSession:se}),te&&g.jsxs("div",{className:"lock-hint",style:{"--ov":fr(te.id)},children:[g.jsxs("span",{className:"lock-hint-lead",children:[g.jsx(gc,{})," ",Ar(te)]}),q.length?g.jsxs("span",{className:"lock-hint-body",children:[j("lockHint.cycleBefore"),g.jsx("kbd",{children:"o"}),g.jsx("kbd",{children:"O"}),j("lockHint.cycleAfter",{n:q.length})]}):g.jsx("span",{className:"lock-hint-body",children:j("lockHint.empty")}),g.jsx("button",{className:"lock-hint-release",onClick:()=>N(null),"data-tip":j("lockHint.releaseTitle"),children:j("lockHint.release")})]}),p&&g.jsx(rm,{onClose:()=>v(!1)})]}),g.jsx("div",{className:"pane-resizer",onMouseDown:qn,role:"separator","aria-orientation":"vertical"}),g.jsx(Wp,{node:$,onNavigateAddress:ce})]}),d&&g.jsx(pc,{node:$,pane:f,setPane:h,onClose:()=>u(!1)},$.id),g.jsx(b.Suspense,{fallback:null,children:g.jsx($m,{sessions:t,specs:e,focusNode:$,open:i==="sessions",searchOpen:!!w,sel:E,setSel:y,seed:k,onSeedConsumed:()=>P(null),onClose:()=>Me("graph"),onPickSession:tn,onOpenSession:se,onOpenSearch:()=>m("sessions"),reload:n})}),i==="evals"&&g.jsx("div",{className:"page-pane page-evals",children:g.jsx(b.Suspense,{fallback:g.jsx("div",{className:"loading",children:j("hud.loading")}),children:g.jsx(jm,{specs:e,sessions:t,reloadBoard:n,onOpenSession:se})})}),i==="issues"&&g.jsx("div",{className:"page-pane page-issues",children:g.jsx(b.Suspense,{fallback:g.jsx("div",{className:"loading",children:j("hud.loading")}),children:g.jsx(Pm,{specs:e,sessions:t,issuesData:s,reloadIssues:o,issueId:a,onOpenSession:se,onFocusNode:z=>{l(z),Me("graph")}})})}),i==="settings"&&g.jsx(b.Suspense,{fallback:g.jsx("div",{className:"loading",children:j("hud.loading")}),children:g.jsx(Dm,{})}),w&&g.jsx(xm,{specs:e,sessions:t,onPick:_e,onClose:()=>m(null),boost:w==="sessions"?"session":null})]})]})}function Om(e){return g.jsx(sa,{children:g.jsx(Hm,{...e})})}const Xm=Object.freeze(Object.defineProperty({__proto__:null,default:Om},Symbol.toStringTag,{value:"Module"}));export{la as A,Xm as D,Yp as M,Cm as a,Kp as b,Fm as i,ua as k,Ym as r,Wm as s,Op as u};
|