showai-reader 0.9.0-reader.fhlbleuo → 0.9.0-reader.fibwhkbi
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 +1 -1
- package/chunks/CardGrid-2L7SI3GT.js +2 -0
- package/chunks/CommandReference-MABH4WNR.js +3 -0
- package/chunks/{ComparisonMatrix-27M44OZJ.js → ComparisonMatrix-4VID3SKW.js} +1 -1
- package/chunks/{EventTimeline-35QURTAO.js → EventTimeline-RPUO3ANI.js} +1 -1
- package/chunks/{ExperimentTracker-P4QX3TFY.js → ExperimentTracker-I7FMOSAT.js} +1 -1
- package/chunks/{ExternalDiagram-AKYOCLQZ.js → ExternalDiagram-PQMI7IOF.js} +19 -19
- package/chunks/{Flowchart-ZNPOCEPD.js → Flowchart-DJDRE6J4.js} +2 -2
- package/chunks/{G2Chart-IA56I52P.js → G2Chart-GKX2KBAE.js} +2 -2
- package/chunks/LayerDiagram-XRFOBN5D.js +2 -0
- package/chunks/{Mindmap-SQCZEOJ2.js → Mindmap-EIHQYYIM.js} +1 -1
- package/chunks/RichTextEditor-ORD5B66H.js +159 -0
- package/chunks/{Roadmap-GTVA7DQG.js → Roadmap-2PZUUITP.js} +1 -1
- package/chunks/{Scene3D-H2F5Y2G3.js → Scene3D-VUYXLU66.js} +2 -2
- package/chunks/{SequenceDiagram-VLOO736H.js → SequenceDiagram-SKWUSADO.js} +1 -1
- package/chunks/{StatusTree-L6XZCK7R.js → StatusTree-M32T5DZK.js} +1 -1
- package/chunks/StepGuide-H3CX2NOQ.js +1 -0
- package/chunks/StructureBrowser-TRZVSHJZ.js +3 -0
- package/chunks/{Waterfall-QA3U6LNC.js → Waterfall-FRJWHEW4.js} +1 -1
- package/chunks/{chunk-NWCMWKOF.js → chunk-2CPNXVIL.js} +2 -2
- package/chunks/{chunk-VQIPL7NG.js → chunk-2XAH6DED.js} +1 -1
- package/chunks/chunk-3YAYFUS4.js +21 -0
- package/chunks/{chunk-PVMEUQFU.js.LEGAL.txt → chunk-3YAYFUS4.js.LEGAL.txt} +0 -2
- package/chunks/chunk-AD4URO5L.js +3 -0
- package/chunks/{chunk-YLTLOYBH.js → chunk-AO3QGOYX.js} +1 -1
- package/chunks/chunk-BJ2PXDYC.js +1 -0
- package/chunks/{chunk-JYWKSXK3.js → chunk-HIORXCFE.js} +1 -1
- package/chunks/{chunk-HSNLLTYJ.js → chunk-IB47MJKL.js} +1 -1
- package/chunks/{chunk-2HAL7KBM.js → chunk-NLDO4KEP.js} +1 -1
- package/chunks/chunk-OK4632EO.js +5 -0
- package/chunks/{chunk-NJBFXE6W.js → chunk-QHZRUC47.js} +1 -1
- package/chunks/chunk-R2O3ZCKW.js +4 -0
- package/chunks/chunk-VFRLMJEN.js +333 -0
- package/index.js +1 -1
- package/manifest.json +4 -4
- package/package.json +1 -1
- package/{reader-FHLBLEUO.js → reader-FIBWHKBI.js} +30 -27
- package/chunks/CardGrid-F5LYBSDH.js +0 -2
- package/chunks/CommandReference-5TSKPHE3.js +0 -3
- package/chunks/LayerDiagram-ES4DSFBP.js +0 -2
- package/chunks/RichTextEditor-NCNUZP23.js +0 -157
- package/chunks/StepGuide-DLY5ZBMO.js +0 -1
- package/chunks/StructureBrowser-H72Y64DB.js +0 -3
- package/chunks/chunk-3I4CQ55U.js +0 -1
- package/chunks/chunk-D74K2NKW.js +0 -1
- package/chunks/chunk-EM2ABYID.js +0 -1
- package/chunks/chunk-EXOUDPUB.js +0 -4
- package/chunks/chunk-MFDCPNW6.js +0 -328
- package/chunks/chunk-PVMEUQFU.js +0 -21
- /package/chunks/{Flowchart-ZNPOCEPD.js.LEGAL.txt → Flowchart-DJDRE6J4.js.LEGAL.txt} +0 -0
- /package/chunks/{G2Chart-IA56I52P.js.LEGAL.txt → G2Chart-GKX2KBAE.js.LEGAL.txt} +0 -0
- /package/chunks/{Scene3D-H2F5Y2G3.js.LEGAL.txt → Scene3D-VUYXLU66.js.LEGAL.txt} +0 -0
- /package/chunks/{chunk-NWCMWKOF.js.LEGAL.txt → chunk-2CPNXVIL.js.LEGAL.txt} +0 -0
- /package/{reader-FHLBLEUO.js.LEGAL.txt → reader-FIBWHKBI.js.LEGAL.txt} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as ct,b as Wn,e as qn,g as wr,h as xr,i as qt,j as vr,k as kr,l as dt,o as _r,p as Er,q as Kn}from"./chunk-P5ET5XMK.js";import{a as ur,b as fr}from"./chunk-GLP5VV7P.js";import{d as pr,e as gr}from"./chunk-JYWKSXK3.js";import{b as jc}from"./chunk-NWCMWKOF.js";import"./chunk-WDYURK6F.js";import{d as mr,e as br,f as yr}from"./chunk-VQIPL7NG.js";import{A as or,Aa as ar,B as rr,Ba as lr,Ga as cr,a as Wt,c as Xn,ib as dr,jb as Zn,kb as Yc,mb as Oe,qa as ir,sa as sr}from"./chunk-PVMEUQFU.js";import{c as Le,d as hr}from"./chunk-DUIGVKKG.js";var oe=Le(Xn(),1);var z=Le(Zn()),D=Le(Xn());function ae(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n<e.length;n++)(o=ae(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Kt="http://www.w3.org/1999/xhtml",Gn={svg:"http://www.w3.org/2000/svg",xhtml:Kt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Pe(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Gn.hasOwnProperty(t)?{space:Gn[t],local:e}:e}function Xc(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Kt&&t.documentElement.namespaceURI===Kt?t.createElement(e):t.createElementNS(n,e)}}function Zc(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Gt(e){var t=Pe(e);return(t.local?Zc:Xc)(t)}function Wc(){}function Ge(e){return e==null?Wc:function(){return this.querySelector(e)}}function Nr(e){typeof e!="function"&&(e=Ge(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=new Array(s),c,l,d=0;d<s;++d)(c=i[d])&&(l=e.call(c,c.__data__,d,i))&&("__data__"in c&&(l.__data__=c.__data__),a[d]=l);return new le(o,this._parents)}function Un(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function qc(){return[]}function Ct(e){return e==null?qc:function(){return this.querySelectorAll(e)}}function Kc(e){return function(){return Un(e.apply(this,arguments))}}function Sr(e){typeof e=="function"?e=Kc(e):e=Ct(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(o.push(e.call(c,c.__data__,l,s)),r.push(c));return new le(o,r)}function Mt(e){return function(){return this.matches(e)}}function Ut(e){return function(t){return t.matches(e)}}var Gc=Array.prototype.find;function Uc(e){return function(){return Gc.call(this.children,e)}}function Qc(){return this.firstElementChild}function Cr(e){return this.select(e==null?Qc:Uc(typeof e=="function"?e:Ut(e)))}var Jc=Array.prototype.filter;function ed(){return Array.from(this.children)}function td(e){return function(){return Jc.call(this.children,e)}}function Mr(e){return this.selectAll(e==null?ed:td(typeof e=="function"?e:Ut(e)))}function Ir(e){typeof e!="function"&&(e=Mt(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new le(o,this._parents)}function Qt(e){return new Array(e.length)}function Or(){return new le(this._enter||this._groups.map(Qt),this._parents)}function It(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}It.prototype={constructor:It,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 Pr(e){return function(){return e}}function nd(e,t,n,o,r,i){for(var s=0,a,c=t.length,l=i.length;s<l;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new It(e,i[s]);for(;s<c;++s)(a=t[s])&&(r[s]=a)}function od(e,t,n,o,r,i,s){var a,c,l=new Map,d=t.length,f=i.length,u=new Array(d),h;for(a=0;a<d;++a)(c=t[a])&&(u[a]=h=s.call(c,c.__data__,a,t)+"",l.has(h)?r[a]=c:l.set(h,c));for(a=0;a<f;++a)h=s.call(e,i[a],a,i)+"",(c=l.get(h))?(o[a]=c,c.__data__=i[a],l.delete(h)):n[a]=new It(e,i[a]);for(a=0;a<d;++a)(c=t[a])&&l.get(u[a])===c&&(r[a]=c)}function rd(e){return e.__data__}function zr(e,t){if(!arguments.length)return Array.from(this,rd);var n=t?od:nd,o=this._parents,r=this._groups;typeof e!="function"&&(e=Pr(e));for(var i=r.length,s=new Array(i),a=new Array(i),c=new Array(i),l=0;l<i;++l){var d=o[l],f=r[l],u=f.length,h=id(e.call(d,d&&d.__data__,l,o)),p=h.length,x=a[l]=new Array(p),b=s[l]=new Array(p),m=c[l]=new Array(u);n(d,f,x,b,m,h,t);for(var v=0,g=0,w,_;v<p;++v)if(w=x[v]){for(v>=g&&(g=v+1);!(_=b[g])&&++g<p;);w._next=_||null}}return s=new le(s,o),s._enter=a,s._exit=c,s}function id(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Dr(){return new le(this._exit||this._groups.map(Qt),this._parents)}function Ar(e,t,n){var o=this.enter(),r=this,i=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?i.remove():n(i),o&&r?o.merge(r).order():r}function Tr(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),c=0;c<s;++c)for(var l=n[c],d=o[c],f=l.length,u=a[c]=new Array(f),h,p=0;p<f;++p)(h=l[p]||d[p])&&(u[p]=h);for(;c<r;++c)a[c]=n[c];return new le(a,this._parents)}function Lr(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,i=o[r],s;--r>=0;)(s=o[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function Rr(e){e||(e=sd);function t(f,u){return f&&u?e(f.__data__,u.__data__):!f-!u}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],a=s.length,c=r[i]=new Array(a),l,d=0;d<a;++d)(l=s[d])&&(c[d]=l);c.sort(t)}return new le(r,this._parents).order()}function sd(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function $r(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Vr(){return Array.from(this)}function Hr(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function Br(){let e=0;for(let t of this)++e;return e}function Fr(){return!this.node()}function Yr(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],i=0,s=r.length,a;i<s;++i)(a=r[i])&&e.call(a,a.__data__,i,r);return this}function ad(e){return function(){this.removeAttribute(e)}}function ld(e){return function(){this.removeAttributeNS(e.space,e.local)}}function cd(e,t){return function(){this.setAttribute(e,t)}}function dd(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function ud(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function fd(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 jr(e,t){var n=Pe(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?ld:ad:typeof t=="function"?n.local?fd:ud:n.local?dd:cd)(n,t))}function Jt(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function hd(e){return function(){this.style.removeProperty(e)}}function pd(e,t,n){return function(){this.style.setProperty(e,t,n)}}function gd(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Xr(e,t,n){return arguments.length>1?this.each((t==null?hd:typeof t=="function"?gd:pd)(e,t,n??"")):Re(this.node(),e)}function Re(e,t){return e.style.getPropertyValue(t)||Jt(e).getComputedStyle(e,null).getPropertyValue(t)}function md(e){return function(){delete this[e]}}function bd(e,t){return function(){this[e]=t}}function yd(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Zr(e,t){return arguments.length>1?this.each((t==null?md:typeof t=="function"?yd:bd)(e,t)):this.node()[e]}function Wr(e){return e.trim().split(/^|\s+/)}function Qn(e){return e.classList||new qr(e)}function qr(e){this._node=e,this._names=Wr(e.getAttribute("class")||"")}qr.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 Kr(e,t){for(var n=Qn(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function Gr(e,t){for(var n=Qn(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function wd(e){return function(){Kr(this,e)}}function xd(e){return function(){Gr(this,e)}}function vd(e,t){return function(){(t.apply(this,arguments)?Kr:Gr)(this,e)}}function Ur(e,t){var n=Wr(e+"");if(arguments.length<2){for(var o=Qn(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?vd:t?wd:xd)(n,t))}function kd(){this.textContent=""}function _d(e){return function(){this.textContent=e}}function Ed(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Qr(e){return arguments.length?this.each(e==null?kd:(typeof e=="function"?Ed:_d)(e)):this.node().textContent}function Nd(){this.innerHTML=""}function Sd(e){return function(){this.innerHTML=e}}function Cd(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Jr(e){return arguments.length?this.each(e==null?Nd:(typeof e=="function"?Cd:Sd)(e)):this.node().innerHTML}function Md(){this.nextSibling&&this.parentNode.appendChild(this)}function ei(){return this.each(Md)}function Id(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ti(){return this.each(Id)}function ni(e){var t=typeof e=="function"?e:Gt(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Od(){return null}function oi(e,t){var n=typeof e=="function"?e:Gt(e),o=t==null?Od:typeof t=="function"?t:Ge(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function Pd(){var e=this.parentNode;e&&e.removeChild(this)}function ri(){return this.each(Pd)}function zd(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Dd(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ii(e){return this.select(e?Dd:zd)}function si(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Ad(e){return function(t){e.call(this,t,this.__data__)}}function Td(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function Ld(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,i;n<r;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++o]=i;++o?t.length=o:delete this.__on}}}function Rd(e,t,n){return function(){var o=this.__on,r,i=Ad(t);if(o){for(var s=0,a=o.length;s<a;++s)if((r=o[s]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=t;return}}this.addEventListener(e.type,i,n),r={type:e.type,name:e.name,value:t,listener:i,options:n},o?o.push(r):this.__on=[r]}}function ai(e,t,n){var o=Td(e+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,d;c<l;++c)for(r=0,d=a[c];r<i;++r)if((s=o[r]).type===d.type&&s.name===d.name)return d.value}return}for(a=t?Rd:Ld,r=0;r<i;++r)this.each(a(o[r],t,n));return this}function li(e,t,n){var o=Jt(e),r=o.CustomEvent;typeof r=="function"?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function $d(e,t){return function(){return li(this,e,t)}}function Vd(e,t){return function(){return li(this,e,t.apply(this,arguments))}}function ci(e,t){return this.each((typeof t=="function"?Vd:$d)(e,t))}function*di(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length,s;r<i;++r)(s=o[r])&&(yield s)}var Jn=[null];function le(e,t){this._groups=e,this._parents=t}function ui(){return new le([[document.documentElement]],Jn)}function Hd(){return this}le.prototype=ui.prototype={constructor:le,select:Nr,selectAll:Sr,selectChild:Cr,selectChildren:Mr,filter:Ir,data:zr,enter:Or,exit:Dr,join:Ar,merge:Tr,selection:Hd,order:Lr,sort:Rr,call:$r,nodes:Vr,node:Hr,size:Br,empty:Fr,each:Yr,attr:jr,style:Xr,property:Zr,classed:Ur,text:Qr,html:Jr,raise:ei,lower:ti,append:ni,insert:oi,remove:ri,clone:ii,datum:si,on:ai,dispatch:ci,[Symbol.iterator]:di};var ze=ui;function de(e){return typeof e=="string"?new le([[document.querySelector(e)]],[document.documentElement]):new le([[e]],Jn)}function fi(e){let t;for(;t=e.sourceEvent;)e=t;return e}function he(e,t){if(e=fi(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}var hi={passive:!1},Ue={capture:!0,passive:!1};function en(e){e.stopImmediatePropagation()}function $e(e){e.preventDefault(),e.stopImmediatePropagation()}function Ot(e){var t=e.document.documentElement,n=de(e).on("dragstart.drag",$e,Ue);"onselectstart"in t?n.on("selectstart.drag",$e,Ue):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Pt(e,t){var n=e.document.documentElement,o=de(e).on("dragstart.drag",null);t&&(o.on("click.drag",$e,Ue),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var zt=e=>()=>e;function Dt(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:c,dy:l,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:d}})}Dt.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Bd(e){return!e.ctrlKey&&!e.button}function Fd(){return this.parentNode}function Yd(e,t){return t??{x:e.x,y:e.y}}function jd(){return navigator.maxTouchPoints||"ontouchstart"in this}function tn(){var e=Bd,t=Fd,n=Yd,o=jd,r={},i=ct("start","drag","end"),s=0,a,c,l,d,f=0;function u(w){w.on("mousedown.drag",h).filter(o).on("touchstart.drag",b).on("touchmove.drag",m,hi).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(w,_){if(!(d||!e.call(this,w,_))){var E=g(this,t.call(this,w,_),w,_,"mouse");E&&(de(w.view).on("mousemove.drag",p,Ue).on("mouseup.drag",x,Ue),Ot(w.view),en(w),l=!1,a=w.clientX,c=w.clientY,E("start",w))}}function p(w){if($e(w),!l){var _=w.clientX-a,E=w.clientY-c;l=_*_+E*E>f}r.mouse("drag",w)}function x(w){de(w.view).on("mousemove.drag mouseup.drag",null),Pt(w.view,l),$e(w),r.mouse("end",w)}function b(w,_){if(e.call(this,w,_)){var E=w.changedTouches,C=t.call(this,w,_),M=E.length,I,V;for(I=0;I<M;++I)(V=g(this,C,w,_,E[I].identifier,E[I]))&&(en(w),V("start",w,E[I]))}}function m(w){var _=w.changedTouches,E=_.length,C,M;for(C=0;C<E;++C)(M=r[_[C].identifier])&&($e(w),M("drag",w,_[C]))}function v(w){var _=w.changedTouches,E=_.length,C,M;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),C=0;C<E;++C)(M=r[_[C].identifier])&&(en(w),M("end",w,_[C]))}function g(w,_,E,C,M,I){var V=i.copy(),P=he(I||E,_),L,S,y;if((y=n.call(w,new Dt("beforestart",{sourceEvent:E,target:u,identifier:M,active:s,x:P[0],y:P[1],dx:0,dy:0,dispatch:V}),C))!=null)return L=y.x-P[0]||0,S=y.y-P[1]||0,function k(N,O,A){var T=P,B;switch(N){case"start":r[M]=k,B=s++;break;case"end":delete r[M],--s;case"drag":P=he(A||O,_),B=s;break}V.call(N,w,new Dt(N,{sourceEvent:O,subject:y,target:u,identifier:M,active:B,x:P[0]+L,y:P[1]+S,dx:P[0]-T[0],dy:P[1]-T[1],dispatch:V}),C)}}return u.filter=function(w){return arguments.length?(e=typeof w=="function"?w:zt(!!w),u):e},u.container=function(w){return arguments.length?(t=typeof w=="function"?w:zt(w),u):t},u.subject=function(w){return arguments.length?(n=typeof w=="function"?w:zt(w),u):n},u.touchable=function(w){return arguments.length?(o=typeof w=="function"?w:zt(!!w),u):o},u.on=function(){var w=i.on.apply(i,arguments);return w===i?u:w},u.clickDistance=function(w){return arguments.length?(f=(w=+w)*w,u):Math.sqrt(f)},u}var Xd=ct("start","end","cancel","interrupt"),Zd=[],mi=0,pi=1,on=2,nn=3,gi=4,rn=5,At=6;function Ve(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;Wd(e,n,{name:t,index:o,group:r,on:Xd,tween:Zd,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:mi})}function Tt(e,t){var n=ce(e,t);if(n.state>mi)throw new Error("too late; already scheduled");return n}function fe(e,t){var n=ce(e,t);if(n.state>nn)throw new Error("too late; already running");return n}function ce(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Wd(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=Er(i,0,n.time);function i(l){n.state=pi,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var d,f,u,h;if(n.state!==pi)return c();for(d in o)if(h=o[d],h.name===n.name){if(h.state===nn)return Kn(s);h.state===gi?(h.state=At,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[d]):+d<t&&(h.state=At,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete o[d])}if(Kn(function(){n.state===nn&&(n.state=gi,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=on,n.on.call("start",e,e.__data__,n.index,n.group),n.state===on){for(n.state=nn,r=new Array(u=n.tween.length),d=0,f=-1;d<u;++d)(h=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(r[++f]=h);r.length=f+1}}function a(l){for(var d=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=rn,1),f=-1,u=r.length;++f<u;)r[f].call(e,d);n.state===rn&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=At,n.timer.stop(),delete o[t];for(var l in o)return;delete e.__transition}}function Qe(e,t){var n=e.__transition,o,r,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((o=n[s]).name!==t){i=!1;continue}r=o.state>on&&o.state<rn,o.state=At,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function bi(e){return this.each(function(){Qe(this,e)})}function qd(e,t){var n,o;return function(){var r=fe(this,e),i=r.tween;if(i!==n){o=n=i;for(var s=0,a=o.length;s<a;++s)if(o[s].name===t){o=o.slice(),o.splice(s,1);break}}r.tween=o}}function Kd(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=fe(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},c=0,l=r.length;c<l;++c)if(r[c].name===t){r[c]=a;break}c===l&&r.push(a)}i.tween=r}}function yi(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=ce(this.node(),n).tween,r=0,i=o.length,s;r<i;++r)if((s=o[r]).name===e)return s.value;return null}return this.each((t==null?qd:Kd)(n,e,t))}function ut(e,t,n){var o=e._id;return e.each(function(){var r=fe(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return ce(r,o).value[t]}}function sn(e,t){var n;return(typeof t=="number"?wr:t instanceof Wn?qn:(n=Wn(t))?(t=n,qn):xr)(e,t)}function Gd(e){return function(){this.removeAttribute(e)}}function Ud(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Qd(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttribute(e);return s===r?null:s===o?i:i=t(o=s,n)}}function Jd(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===r?null:s===o?i:i=t(o=s,n)}}function eu(e,t,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a)))}}function tu(e,t,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a)))}}function wi(e,t){var n=Pe(e),o=n==="transform"?kr:sn;return this.attrTween(e,typeof t=="function"?(n.local?tu:eu)(n,o,ut(this,"attr."+e,t)):t==null?(n.local?Ud:Gd)(n):(n.local?Jd:Qd)(n,o,t))}function nu(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function ou(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function ru(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&ou(e,i)),n}return r._value=t,r}function iu(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&nu(e,i)),n}return r._value=t,r}function xi(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 o=Pe(e);return this.tween(n,(o.local?ru:iu)(o,t))}function su(e,t){return function(){Tt(this,e).delay=+t.apply(this,arguments)}}function au(e,t){return t=+t,function(){Tt(this,e).delay=t}}function vi(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?su:au)(t,e)):ce(this.node(),t).delay}function lu(e,t){return function(){fe(this,e).duration=+t.apply(this,arguments)}}function cu(e,t){return t=+t,function(){fe(this,e).duration=t}}function ki(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?lu:cu)(t,e)):ce(this.node(),t).duration}function du(e,t){if(typeof t!="function")throw new Error;return function(){fe(this,e).ease=t}}function _i(e){var t=this._id;return arguments.length?this.each(du(t,e)):ce(this.node(),t).ease}function uu(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;fe(this,e).ease=n}}function Ei(e){if(typeof e!="function")throw new Error;return this.each(uu(this._id,e))}function Ni(e){typeof e!="function"&&(e=Mt(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new pe(o,this._parents,this._name,this._id)}function Si(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var c=t[a],l=n[a],d=c.length,f=s[a]=new Array(d),u,h=0;h<d;++h)(u=c[h]||l[h])&&(f[h]=u);for(;a<o;++a)s[a]=t[a];return new pe(s,this._parents,this._name,this._id)}function fu(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 hu(e,t,n){var o,r,i=fu(t)?Tt:fe;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}function Ci(e,t){var n=this._id;return arguments.length<2?ce(this.node(),n).on.on(e):this.each(hu(n,e,t))}function pu(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Mi(){return this.on("end.remove",pu(this._id))}function Ii(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Ge(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],c=a.length,l=i[s]=new Array(c),d,f,u=0;u<c;++u)(d=a[u])&&(f=e.call(d,d.__data__,u,a))&&("__data__"in d&&(f.__data__=d.__data__),l[u]=f,Ve(l[u],t,n,u,l,ce(d,n)));return new pe(i,this._parents,t,n)}function Oi(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Ct(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var c=o[a],l=c.length,d,f=0;f<l;++f)if(d=c[f]){for(var u=e.call(d,d.__data__,f,c),h,p=ce(d,n),x=0,b=u.length;x<b;++x)(h=u[x])&&Ve(h,t,n,x,u,p);i.push(u),s.push(d)}return new pe(i,s,t,n)}var gu=ze.prototype.constructor;function Pi(){return new gu(this._groups,this._parents)}function mu(e,t){var n,o,r;return function(){var i=Re(this,e),s=(this.style.removeProperty(e),Re(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function zi(e){return function(){this.style.removeProperty(e)}}function bu(e,t,n){var o,r=n+"",i;return function(){var s=Re(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function yu(e,t,n){var o,r,i;return function(){var s=Re(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Re(this,e))),s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a))}}function wu(e,t){var n,o,r,i="style."+t,s="end."+i,a;return function(){var c=fe(this,e),l=c.on,d=c.value[i]==null?a||(a=zi(t)):void 0;(l!==n||r!==d)&&(o=(n=l).copy()).on(s,r=d),c.on=o}}function Di(e,t,n){var o=(e+="")=="transform"?vr:sn;return t==null?this.styleTween(e,mu(e,o)).on("end.style."+e,zi(e)):typeof t=="function"?this.styleTween(e,yu(e,o,ut(this,"style."+e,t))).each(wu(this._id,e)):this.styleTween(e,bu(e,o,t),n).on("end.style."+e,null)}function xu(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function vu(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&xu(e,s,n)),o}return i._value=t,i}function Ai(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,vu(e,t,n??""))}function ku(e){return function(){this.textContent=e}}function _u(e){return function(){var t=e(this);this.textContent=t??""}}function Ti(e){return this.tween("text",typeof e=="function"?_u(ut(this,"text",e)):ku(e==null?"":e+""))}function Eu(e){return function(t){this.textContent=e.call(this,t)}}function Nu(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Eu(r)),t}return o._value=e,o}function Li(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,Nu(e))}function Ri(){for(var e=this._name,t=this._id,n=an(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var d=ce(c,t);Ve(c,e,n,l,s,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new pe(o,this._parents,e,n)}function $i(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},c={value:function(){--r===0&&i()}};n.each(function(){var l=fe(this,o),d=l.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),r===0&&i()})}var Su=0;function pe(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Vi(e){return ze().transition(e)}function an(){return++Su}var De=ze.prototype;pe.prototype=Vi.prototype={constructor:pe,select:Ii,selectAll:Oi,selectChild:De.selectChild,selectChildren:De.selectChildren,filter:Ni,merge:Si,selection:Pi,transition:Ri,call:De.call,nodes:De.nodes,node:De.node,size:De.size,empty:De.empty,each:De.each,on:Ci,attr:wi,attrTween:xi,style:Di,styleTween:Ai,text:Ti,textTween:Li,remove:Mi,tween:yi,delay:vi,duration:ki,ease:_i,easeVarying:Ei,end:$i,[Symbol.iterator]:De[Symbol.iterator]};function ln(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Cu={time:null,delay:0,duration:250,ease:ln};function Mu(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 Hi(e){var t,n;e instanceof pe?(t=e._id,e=e._name):(t=an(),(n=Cu).time=_r(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&Ve(c,e,t,l,s,n||Mu(c,t));return new pe(o,this._parents,e,t)}ze.prototype.interrupt=bi;ze.prototype.transition=Hi;var Lt=e=>()=>e;function eo(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){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:o,enumerable:!0,configurable:!0},_:{value:r}})}function xe(e,t,n){this.k=e,this.x=t,this.y=n}xe.prototype={constructor:xe,scale:function(e){return e===1?this:new xe(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new xe(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 Je=new xe(1,0,0);Rt.prototype=xe.prototype;function Rt(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Je;return e.__zoom}function cn(e){e.stopImmediatePropagation()}function ft(e){e.preventDefault(),e.stopImmediatePropagation()}function Iu(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Ou(){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 Bi(){return this.__zoom||Je}function Pu(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function zu(){return navigator.maxTouchPoints||"ontouchstart"in this}function Du(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function dn(){var e=Iu,t=Ou,n=Du,o=Pu,r=zu,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=dt,l=ct("start","zoom","end"),d,f,u,h=500,p=150,x=0,b=10;function m(y){y.property("__zoom",Bi).on("wheel.zoom",M,{passive:!1}).on("mousedown.zoom",I).on("dblclick.zoom",V).filter(r).on("touchstart.zoom",P).on("touchmove.zoom",L).on("touchend.zoom touchcancel.zoom",S).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(y,k,N,O){var A=y.selection?y.selection():y;A.property("__zoom",Bi),y!==A?_(y,k,N,O):A.interrupt().each(function(){E(this,arguments).event(O).start().zoom(null,typeof k=="function"?k.apply(this,arguments):k).end()})},m.scaleBy=function(y,k,N,O){m.scaleTo(y,function(){var A=this.__zoom.k,T=typeof k=="function"?k.apply(this,arguments):k;return A*T},N,O)},m.scaleTo=function(y,k,N,O){m.transform(y,function(){var A=t.apply(this,arguments),T=this.__zoom,B=N==null?w(A):typeof N=="function"?N.apply(this,arguments):N,H=T.invert(B),F=typeof k=="function"?k.apply(this,arguments):k;return n(g(v(T,F),B,H),A,s)},N,O)},m.translateBy=function(y,k,N,O){m.transform(y,function(){return n(this.__zoom.translate(typeof k=="function"?k.apply(this,arguments):k,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),s)},null,O)},m.translateTo=function(y,k,N,O,A){m.transform(y,function(){var T=t.apply(this,arguments),B=this.__zoom,H=O==null?w(T):typeof O=="function"?O.apply(this,arguments):O;return n(Je.translate(H[0],H[1]).scale(B.k).translate(typeof k=="function"?-k.apply(this,arguments):-k,typeof N=="function"?-N.apply(this,arguments):-N),T,s)},O,A)};function v(y,k){return k=Math.max(i[0],Math.min(i[1],k)),k===y.k?y:new xe(k,y.x,y.y)}function g(y,k,N){var O=k[0]-N[0]*y.k,A=k[1]-N[1]*y.k;return O===y.x&&A===y.y?y:new xe(y.k,O,A)}function w(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function _(y,k,N,O){y.on("start.zoom",function(){E(this,arguments).event(O).start()}).on("interrupt.zoom end.zoom",function(){E(this,arguments).event(O).end()}).tween("zoom",function(){var A=this,T=arguments,B=E(A,T).event(O),H=t.apply(A,T),F=N==null?w(H):typeof N=="function"?N.apply(A,T):N,q=Math.max(H[1][0]-H[0][0],H[1][1]-H[0][1]),Y=A.__zoom,K=typeof k=="function"?k.apply(A,T):k,ee=c(Y.invert(F).concat(q/Y.k),K.invert(F).concat(q/K.k));return function(W){if(W===1)W=K;else{var $=ee(W),X=q/$[2];W=new xe(X,F[0]-$[0]*X,F[1]-$[1]*X)}B.zoom(null,W)}})}function E(y,k,N){return!N&&y.__zooming||new C(y,k)}function C(y,k){this.that=y,this.args=k,this.active=0,this.sourceEvent=null,this.extent=t.apply(y,k),this.taps=0}C.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,k){return this.mouse&&y!=="mouse"&&(this.mouse[1]=k.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=k.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=k.invert(this.touch1[0])),this.that.__zoom=k,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(y){var k=de(this.that).datum();l.call(y,this.that,new eo(y,{sourceEvent:this.sourceEvent,target:m,type:y,transform:this.that.__zoom,dispatch:l}),k)}};function M(y,...k){if(!e.apply(this,arguments))return;var N=E(this,k).event(y),O=this.__zoom,A=Math.max(i[0],Math.min(i[1],O.k*Math.pow(2,o.apply(this,arguments)))),T=he(y);if(N.wheel)(N.mouse[0][0]!==T[0]||N.mouse[0][1]!==T[1])&&(N.mouse[1]=O.invert(N.mouse[0]=T)),clearTimeout(N.wheel);else{if(O.k===A)return;N.mouse=[T,O.invert(T)],Qe(this),N.start()}ft(y),N.wheel=setTimeout(B,p),N.zoom("mouse",n(g(v(O,A),N.mouse[0],N.mouse[1]),N.extent,s));function B(){N.wheel=null,N.end()}}function I(y,...k){if(u||!e.apply(this,arguments))return;var N=y.currentTarget,O=E(this,k,!0).event(y),A=de(y.view).on("mousemove.zoom",F,!0).on("mouseup.zoom",q,!0),T=he(y,N),B=y.clientX,H=y.clientY;Ot(y.view),cn(y),O.mouse=[T,this.__zoom.invert(T)],Qe(this),O.start();function F(Y){if(ft(Y),!O.moved){var K=Y.clientX-B,ee=Y.clientY-H;O.moved=K*K+ee*ee>x}O.event(Y).zoom("mouse",n(g(O.that.__zoom,O.mouse[0]=he(Y,N),O.mouse[1]),O.extent,s))}function q(Y){A.on("mousemove.zoom mouseup.zoom",null),Pt(Y.view,O.moved),ft(Y),O.event(Y).end()}}function V(y,...k){if(e.apply(this,arguments)){var N=this.__zoom,O=he(y.changedTouches?y.changedTouches[0]:y,this),A=N.invert(O),T=N.k*(y.shiftKey?.5:2),B=n(g(v(N,T),O,A),t.apply(this,k),s);ft(y),a>0?de(this).transition().duration(a).call(_,B,O,y):de(this).call(m.transform,B,O,y)}}function P(y,...k){if(e.apply(this,arguments)){var N=y.touches,O=N.length,A=E(this,k,y.changedTouches.length===O).event(y),T,B,H,F;for(cn(y),B=0;B<O;++B)H=N[B],F=he(H,this),F=[F,this.__zoom.invert(F),H.identifier],A.touch0?!A.touch1&&A.touch0[2]!==F[2]&&(A.touch1=F,A.taps=0):(A.touch0=F,T=!0,A.taps=1+!!d);d&&(d=clearTimeout(d)),T&&(A.taps<2&&(f=F[0],d=setTimeout(function(){d=null},h)),Qe(this),A.start())}}function L(y,...k){if(this.__zooming){var N=E(this,k).event(y),O=y.changedTouches,A=O.length,T,B,H,F;for(ft(y),T=0;T<A;++T)B=O[T],H=he(B,this),N.touch0&&N.touch0[2]===B.identifier?N.touch0[0]=H:N.touch1&&N.touch1[2]===B.identifier&&(N.touch1[0]=H);if(B=N.that.__zoom,N.touch1){var q=N.touch0[0],Y=N.touch0[1],K=N.touch1[0],ee=N.touch1[1],W=(W=K[0]-q[0])*W+(W=K[1]-q[1])*W,$=($=ee[0]-Y[0])*$+($=ee[1]-Y[1])*$;B=v(B,Math.sqrt(W/$)),H=[(q[0]+K[0])/2,(q[1]+K[1])/2],F=[(Y[0]+ee[0])/2,(Y[1]+ee[1])/2]}else if(N.touch0)H=N.touch0[0],F=N.touch0[1];else return;N.zoom("touch",n(g(B,H,F),N.extent,s))}}function S(y,...k){if(this.__zooming){var N=E(this,k).event(y),O=y.changedTouches,A=O.length,T,B;for(cn(y),u&&clearTimeout(u),u=setTimeout(function(){u=null},h),T=0;T<A;++T)B=O[T],N.touch0&&N.touch0[2]===B.identifier?delete N.touch0:N.touch1&&N.touch1[2]===B.identifier&&delete N.touch1;if(N.touch1&&!N.touch0&&(N.touch0=N.touch1,delete N.touch1),N.touch0)N.touch0[1]=this.__zoom.invert(N.touch0[0]);else if(N.end(),N.taps===2&&(B=he(B,this),Math.hypot(f[0]-B[0],f[1]-B[1])<b)){var H=de(this).on("dblclick.zoom");H&&H.apply(this,arguments)}}}return m.wheelDelta=function(y){return arguments.length?(o=typeof y=="function"?y:Lt(+y),m):o},m.filter=function(y){return arguments.length?(e=typeof y=="function"?y:Lt(!!y),m):e},m.touchable=function(y){return arguments.length?(r=typeof y=="function"?y:Lt(!!y),m):r},m.extent=function(y){return arguments.length?(t=typeof y=="function"?y:Lt([[+y[0][0],+y[0][1]],[+y[1][0],+y[1][1]]]),m):t},m.scaleExtent=function(y){return arguments.length?(i[0]=+y[0],i[1]=+y[1],m):[i[0],i[1]]},m.translateExtent=function(y){return arguments.length?(s[0][0]=+y[0][0],s[1][0]=+y[1][0],s[0][1]=+y[0][1],s[1][1]=+y[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(y){return arguments.length?(n=y,m):n},m.duration=function(y){return arguments.length?(a=+y,m):a},m.interpolate=function(y){return arguments.length?(c=y,m):c},m.on=function(){var y=l.on.apply(l,arguments);return y===l?m:y},m.clickDistance=function(y){return arguments.length?(x=(y=+y)*y,m):Math.sqrt(x)},m.tapDistance=function(y){return arguments.length?(b=+y,m):b},m}var ge={error001:(e="react")=>`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} 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:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:o}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},mt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],io=["Enter"," ","Escape"],so={"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"},Ye;(function(e){e.Strict="strict",e.Loose="loose"})(Ye||(Ye={}));var Ae;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Ae||(Ae={}));var et;(function(e){e.Partial="partial",e.Full="full"})(et||(et={}));var ao={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},_e;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(_e||(_e={}));var pt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(pt||(pt={}));var j;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(j||(j={}));var Fi={[j.Left]:j.Right,[j.Right]:j.Left,[j.Top]:j.Bottom,[j.Bottom]:j.Top},lo=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,ts=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),co=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e);var Vt=(e,t=[0,0])=>{let{width:n,height:o}=ye(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},uo=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let n=!1,o=e.reduce((r,i)=>{let s=typeof i=="string",a=!t.nodeLookup&&!s?i:void 0;return t.nodeLookup&&(a=s?t.nodeLookup.get(i):co(i)?i:t.nodeLookup.get(i.id)),a?(n=!0,mn(r,hn(a,t.nodeOrigin))):r},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?bn(o):{x:0,y:0,width:0,height:0}},bt=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=mn(n,hn(r)),o=!0)}),o?bn(n):{x:0,y:0,width:0,height:0}},pn=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{let a=(t.x-n)/r,c=(t.y-o)/r,l=t.width/r,d=t.height/r,f=[];for(let u of e.values()){let{measured:h,selectable:p=!0,hidden:x=!1}=u;if(s&&!p||x)continue;let b=h.width??u.width??u.initialWidth??0,m=h.height??u.height??u.initialHeight??0,{x:v,y:g}=u.internals.positionAbsolute,w=ss(a,c,l,d,v,g,b,m),_=b*m,E=i&&w>0;(!u.internals.handleBounds||E||w>=_||u.dragging)&&f.push(u)}return f},ns=(e,t)=>{let n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function Au(e,t){let n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{let i;if(t?.includeHiddenNodes){let{width:s,height:a}=ye(r);i=s>0&&a>0}else i=!!(r.measured.width&&r.measured.height&&!r.hidden);i&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function os({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return!0;let a=Au(e,s),c=bt(a),l=Bt(c,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(l,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),!0}function fo({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){let s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:c,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},d=s.origin??o,f=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i?.("005",ge.error005());else{let{width:h,height:p}=ye(a);h&&p&&(f=[[c,l],[c+h,l+p]])}else a&&ot(s.extent)&&(f=[[s.extent[0][0]+c,s.extent[0][1]+l],[s.extent[1][0]+c,s.extent[1][1]+l]]);let u=ot(f)?tt(t,f,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",ge.error015()),{position:{x:u.x-c+(s.measured.width??0)*d[0],y:u.y-l+(s.measured.height??0)*d[1]},positionAbsolute:u}}async function rs({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){let i=new Set(e.map(u=>u.id)),s=[];for(let u of n){if(u.deletable===!1)continue;let h=i.has(u.id),p=!h&&u.parentId&&s.find(x=>x.id===u.parentId);(h||p)&&s.push(u)}let a=new Set(t.map(u=>u.id)),c=o.filter(u=>u.deletable!==!1),d=ns(s,c);for(let u of c)a.has(u.id)&&!d.find(p=>p.id===u.id)&&d.push(u);if(!r)return{edges:d,nodes:s};let f=await r({nodes:s,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:s}:{edges:[],nodes:[]}:f}var gt=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),tt=(e={x:0,y:0},t,n)=>({x:gt(e.x,t[0][0],t[1][0]-(n?.width??0)),y:gt(e.y,t[0][1],t[1][1]-(n?.height??0))});function is(e,t,n){let{width:o,height:r}=ye(n),{x:i,y:s}=n.internals.positionAbsolute;return tt(e,[[i,s],[i+o,s+r]],t)}var Yi=(e,t,n)=>e<t?gt(Math.abs(e-t),1,t)/t:e>n?-gt(Math.abs(e-n),1,t)/t:0,gn=(e,t,n=15,o=40)=>{let r=Yi(e.x,o,t.width-o)*n,i=Yi(e.y,o,t.height-o)*n;return[r,i]},mn=(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)}),ro=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),bn=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),yt=(e,t=[0,0])=>{let{x:n,y:o}=co(e)?e.internals.positionAbsolute:Vt(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},hn=(e,t=[0,0])=>{let{x:n,y:o}=co(e)?e.internals.positionAbsolute:Vt(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},ho=(e,t)=>bn(mn(ro(e),ro(t))),ss=(e,t,n,o,r,i,s,a)=>{let c=Math.max(0,Math.min(e+n,r+s)-Math.max(e,r)),l=Math.max(0,Math.min(t+o,i+a)-Math.max(t,i));return Math.ceil(c*l)},Ht=(e,t)=>ss(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),po=e=>me(e.width)&&me(e.height)&&me(e.x)&&me(e.y),me=e=>!isNaN(e)&&isFinite(e),go=(e,t)=>(n,o)=>{},wt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),xt=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{let a={x:(e-n)/r,y:(t-o)/r};return i?wt(a,s):a},nt=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function ht(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){let 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 Tu(e,t,n){if(typeof e=="string"||typeof e=="number"){let o=ht(e,n),r=ht(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){let o=ht(e.top??e.y??0,n),r=ht(e.bottom??e.y??0,n),i=ht(e.left??e.x??0,t),s=ht(e.right??e.x??0,t);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Lu(e,t,n,o,r,i){let{x:s,y:a}=nt(e,[t,n,o]),{x:c,y:l}=nt({x:e.x+e.width,y:e.y+e.height},[t,n,o]),d=r-c,f=i-l;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(d),bottom:Math.floor(f)}}var Bt=(e,t,n,o,r,i)=>{let s=Tu(i,t,n),a=(t-s.x)/e.width,c=(n-s.y)/e.height,l=Math.min(a,c),d=gt(l,o,r),f=e.x+e.width/2,u=e.y+e.height/2,h=t/2-f*d,p=n/2-u*d,x=Lu(e,h,p,d,t,n),b={left:Math.min(x.left-s.left,0),top:Math.min(x.top-s.top,0),right:Math.min(x.right-s.right,0),bottom:Math.min(x.bottom-s.bottom,0)};return{x:h-b.left+b.right,y:p-b.top+b.bottom,zoom:d}},vt=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function ot(e){return e!=null&&e!=="parent"}function ye(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function yn(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function mo(e,t={width:0,height:0},n,o,r){let i={...e},s=o.get(n);if(s){let a=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}function bo(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function as(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function ls(e){return{...so,...e||{}}}function yo(e){return e===null?null:e?"valid":"invalid"}function $t(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){let{x:i,y:s}=be(e),a=xt({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:c,y:l}=n?wt(a,t):a;return{xSnapped:c,ySnapped:l,...a}}var wn=e=>({width:e.offsetWidth,height:e.offsetHeight}),wo=e=>e?.getRootNode?.()||window?.document,Ru=["INPUT","SELECT","TEXTAREA"];function xo(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Ru.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}var vo=e=>"clientX"in e,be=(e,t)=>{let n=vo(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},ji=(e,t,n,o,r)=>{let i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{let a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:r,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...wn(s)}})};function xn({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){let c=e*.125+r*.375+s*.375+n*.125,l=t*.125+i*.375+a*.375+o*.125,d=Math.abs(c-e),f=Math.abs(l-t);return[c,l,d,f]}function un(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Xi({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case j.Left:return[t-un(t-o,i),n];case j.Right:return[t+un(o-t,i),n];case j.Top:return[t,n-un(n-r,i)];case j.Bottom:return[t,n+un(r-n,i)]}}function vn({sourceX:e,sourceY:t,sourcePosition:n=j.Bottom,targetX:o,targetY:r,targetPosition:i=j.Top,curvature:s=.25}){let[a,c]=Xi({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[l,d]=Xi({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[f,u,h,p]=xn({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:d});return[`M${e},${t} C${a},${c} ${l},${d} ${o},${r}`,f,u,h,p]}function ko({sourceX:e,sourceY:t,targetX:n,targetY:o}){let r=Math.abs(n-e)/2,i=n<e?n+r:n-r,s=Math.abs(o-t)/2,a=o<t?o+s:o-s;return[i,a,r,s]}function cs({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){if(i==="manual")return o;let s=r&&n?o+1e3:o,a=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return s+a}function ds({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){let i=mn(hn(e),hn(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);let s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return Ht(s,bn(i))>0}var $u=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Vu=(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)),us=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.("006",ge.error006()),t;let o=n.getEdgeId||$u,r;return lo(e)?r={...e}:r={...e,id:o(e)},Vu(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function kn({sourceX:e,sourceY:t,targetX:n,targetY:o}){let[r,i,s,a]=ko({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}var Zi={[j.Left]:{x:-1,y:0},[j.Right]:{x:1,y:0},[j.Top]:{x:0,y:-1},[j.Bottom]:{x:0,y:1}},Hu=({source:e,sourcePosition:t=j.Bottom,target:n})=>t===j.Left||t===j.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},Wi=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Bu({source:e,sourcePosition:t=j.Bottom,target:n,targetPosition:o=j.Top,center:r,offset:i,stepPosition:s}){let a=Zi[t],c=Zi[o],l={x:e.x+a.x*i,y:e.y+a.y*i},d={x:n.x+c.x*i,y:n.y+c.y*i},f=Hu({source:l,sourcePosition:t,target:d}),u=f.x!==0?"x":"y",h=f[u],p=[],x,b,m={x:0,y:0},v={x:0,y:0},[,,g,w]=ko({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[u]*c[u]===-1){u==="x"?(x=r.x??l.x+(d.x-l.x)*s,b=r.y??(l.y+d.y)/2):(x=r.x??(l.x+d.x)/2,b=r.y??l.y+(d.y-l.y)*s);let M=[{x,y:l.y},{x,y:d.y}],I=[{x:l.x,y:b},{x:d.x,y:b}];a[u]===h?p=u==="x"?M:I:p=u==="x"?I:M}else{let M=[{x:l.x,y:d.y}],I=[{x:d.x,y:l.y}];if(u==="x"?p=a.x===h?I:M:p=a.y===h?M:I,t===o){let y=Math.abs(e[u]-n[u]);if(y<=i){let k=Math.min(i-1,i-y);a[u]===h?m[u]=(l[u]>e[u]?-1:1)*k:v[u]=(d[u]>n[u]?-1:1)*k}}if(t!==o){let y=u==="x"?"y":"x",k=a[u]===c[y],N=l[y]>d[y],O=l[y]<d[y];(a[u]===1&&(!k&&N||k&&O)||a[u]!==1&&(!k&&O||k&&N))&&(p=u==="x"?M:I)}let V={x:l.x+m.x,y:l.y+m.y},P={x:d.x+v.x,y:d.y+v.y},L=Math.max(Math.abs(V.x-p[0].x),Math.abs(P.x-p[0].x)),S=Math.max(Math.abs(V.y-p[0].y),Math.abs(P.y-p[0].y));L>=S?(x=(V.x+P.x)/2,b=p[0].y):(x=p[0].x,b=(V.y+P.y)/2)}let _={x:l.x+m.x,y:l.y+m.y},E={x:d.x+v.x,y:d.y+v.y};return[[e,..._.x!==p[0].x||_.y!==p[0].y?[_]:[],...p,...E.x!==p[p.length-1].x||E.y!==p[p.length-1].y?[E]:[],n],x,b,g,w]}function Fu(e,t,n,o){let r=Math.min(Wi(e,t)/2,Wi(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){let l=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${i+r*l},${s}Q ${i},${s} ${i},${s+r*d}`}let a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${s+r*c}Q ${i},${s} ${i+r*a},${s}`}function rt({sourceX:e,sourceY:t,sourcePosition:n=j.Bottom,targetX:o,targetY:r,targetPosition:i=j.Top,borderRadius:s=5,centerX:a,centerY:c,offset:l=20,stepPosition:d=.5}){let[f,u,h,p,x]=Bu({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:c},offset:l,stepPosition:d}),b=`M${f[0].x} ${f[0].y}`;for(let m=1;m<f.length-1;m++)b+=Fu(f[m-1],f[m],f[m+1],s);return b+=`L${f[f.length-1].x} ${f[f.length-1].y}`,[b,u,h,p,x]}function qi(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function fs(e){let{sourceNode:t,targetNode:n}=e;if(!qi(t)||!qi(n))return null;let o=t.internals.handleBounds||Ki(t.handles),r=n.internals.handleBounds||Ki(n.handles),i=Gi(o?.source??[],e.sourceHandle),s=Gi(e.connectionMode===Ye.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",ge.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let a=i?.position||j.Bottom,c=s?.position||j.Top,l=je(t,i,a),d=je(n,s,c);return{sourceX:l.x,sourceY:l.y,targetX:d.x,targetY:d.y,sourcePosition:a,targetPosition:c}}function Ki(e){if(!e)return null;let t=[],n=[];for(let o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&n.push(o);return{source:t,target:n}}function je(e,t,n=j.Left,o=!1){let r=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??ye(e);if(o)return{x:r+s/2,y:i+a/2};switch(t?.position??n){case j.Top:return{x:r+s/2,y:i};case j.Right:return{x:r+s,y:i+a/2};case j.Bottom:return{x:r+s/2,y:i+a};case j.Left:return{x:r,y:i+a/2}}}function Gi(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function _n(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function hs(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){let i=new Set;return e.reduce((s,a)=>([a.markerStart||o,a.markerEnd||r].forEach(c=>{if(c&&typeof c=="object"){let l=_n(c,t);i.has(l)||(s.push({id:l,color:c.color||n,...c}),i.add(l))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}var ps=1e3,Yu=10,_o={nodeOrigin:[0,0],nodeExtent:mt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},ju={..._o,checkEquality:!0};function Eo(e,t){let n={...e};for(let o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function gs(e,t,n){let o=Eo(_o,n);for(let r of e.values())if(r.parentId)So(r,e,t,o);else{let i=Vt(r,o.nodeOrigin),s=ot(r.extent)?r.extent:o.nodeExtent,a=tt(i,s,ye(r));r.internals.positionAbsolute=a}}function Xu(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],o=[];for(let r of e.handles){let i={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(i):r.type==="target"&&o.push(i)}return{source:n,target:o}}function No(e){return e==="manual"}function En(e,t,n,o={}){let r=Eo(ju,o),i={i:0},s=new Map(t),a=r?.elevateNodesOnSelect&&!No(r.zIndexMode)?ps:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let d of e){let f=s.get(d.id);if(r.checkEquality&&d===f?.internals.userNode)t.set(d.id,f);else{let u=Vt(d,r.nodeOrigin),h=ot(d.extent)?d.extent:r.nodeExtent,p=tt(u,h,ye(d));f={...r.defaults,...d,measured:{width:d.measured?.width,height:d.measured?.height},internals:{positionAbsolute:p,handleBounds:Xu(d,f),z:ms(d,a,r.zIndexMode),userNode:d}},t.set(d.id,f)}(f.measured===void 0||f.measured.width===void 0||f.measured.height===void 0)&&!f.hidden&&(c=!1),d.parentId&&So(f,t,n,o,i),l||=d.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function Zu(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function So(e,t,n,o,r){let{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:c}=Eo(_o,o),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}Zu(e,n),r&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++r.i,d.internals.z=d.internals.z+r.i*Yu),r&&d.internals.rootParentIndex!==void 0&&(r.i=d.internals.rootParentIndex);let f=i&&!No(c)?ps:0,{x:u,y:h,z:p}=Wu(e,d,s,a,f,c),{positionAbsolute:x}=e.internals,b=u!==x.x||h!==x.y;(b||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:b?{x:u,y:h}:x,z:p}})}function ms(e,t,n){let o=me(e.zIndex)?e.zIndex:0;return No(n)?o:o+(e.selected?t:0)}function Wu(e,t,n,o,r,i){let{x:s,y:a}=t.internals.positionAbsolute,c=ye(e),l=Vt(e,n),d=ot(e.extent)?tt(l,e.extent,c):l,f=tt({x:s+d.x,y:a+d.y},o,c);e.extent==="parent"&&(f=is(f,c,t));let u=ms(e,r,i),h=t.internals.z??0;return{x:f.x,y:f.y,z:h>=u?h+1:u}}function Nn(e,t,n,o=[0,0]){let r=[],i=new Map;for(let s of e){let a=t.get(s.parentId);if(!a)continue;let c=i.get(s.parentId)?.expandedRect??yt(a),l=ho(c,s.rect);i.set(s.parentId,{expandedRect:l,parent:a})}return i.size>0&&i.forEach(({expandedRect:s,parent:a},c)=>{let l=a.internals.positionAbsolute,d=ye(a),f=a.origin??o,u=s.x<l.x?Math.round(Math.abs(l.x-s.x)):0,h=s.y<l.y?Math.round(Math.abs(l.y-s.y)):0,p=Math.max(d.width,Math.round(s.width)),x=Math.max(d.height,Math.round(s.height)),b=(p-d.width)*f[0],m=(x-d.height)*f[1];(u>0||h>0||b||m)&&(r.push({id:c,type:"position",position:{x:a.position.x-u+b,y:a.position.y-h+m}}),n.get(c)?.forEach(v=>{e.some(g=>g.id===v.id)||r.push({id:v.id,type:"position",position:{x:v.position.x+u,y:v.position.y+h}})})),(d.width<s.width||d.height<s.height||u||h)&&r.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:p+(u?f[0]*u-b:0),height:x+(h?f[1]*h-m:0)}})}),r}function bs(e,t,n,o,r,i,s){let a=o?.querySelector(".xyflow__viewport"),c=!1;if(!a)return{changes:[],updatedInternals:c};let l=[],d=window.getComputedStyle(a),{m22:f}=new window.DOMMatrixReadOnly(d.transform),u=[];for(let h of e.values()){let 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}let x=wn(h.nodeElement),b=p.measured.width!==x.width||p.measured.height!==x.height;if(!!(x.width&&x.height&&(b||!p.internals.handleBounds||h.force))){let v=h.nodeElement.getBoundingClientRect(),g=ot(p.extent)?p.extent:i,{positionAbsolute:w}=p.internals;if(p.parentId&&p.extent==="parent"){let E=t.get(p.parentId);E&&(w=is(w,x,E))}else g&&(w=tt(w,g,x));let _={...p,measured:x,internals:{...p.internals,positionAbsolute:w,handleBounds:{source:ji("source",h.nodeElement,v,f,p.id),target:ji("target",h.nodeElement,v,f,p.id)}}};t.set(p.id,_),p.parentId&&So(_,t,n,{nodeOrigin:r,zIndexMode:s}),c=!0,b&&(l.push({id:p.id,type:"dimensions",dimensions:x}),p.expandParent&&p.parentId&&u.push({id:p.id,parentId:p.parentId,rect:yt(_,r)}))}}if(u.length>0){let h=Nn(u,t,n,r);l.push(...h)}return{changes:l,updatedInternals:c}}async function ys({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return!1;let s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o);return!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2])}function Ui(e,t,n,o,r,i){let s=r,a=o.get(s)||new Map;o.set(s,a.set(n,t)),s=`${r}-${e}`;let c=o.get(s)||new Map;if(o.set(s,c.set(n,t)),i){s=`${r}-${e}-${i}`;let l=o.get(s)||new Map;o.set(s,l.set(n,t))}}function Co(e,t,n){e.clear(),t.clear();for(let o of n){let{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,c={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},l=`${r}-${s}--${i}-${a}`,d=`${i}-${a}--${r}-${s}`;Ui("source",c,d,e,r,s),Ui("target",c,l,e,i,a),t.set(o.id,o)}}function ws(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:ws(n,t):!1}function Qi(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function qu(e,t,n,o){let r=new Map;for(let[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!ws(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){let a=e.get(i);a&&r.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function to({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){let r=[];for(let[s,a]of t){let c=n.get(s)?.internals.userNode;c&&r.push({...c,position:a.position,dragging:o})}if(!e)return[r[0],r];let i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function Ku({dragItems:e,snapGrid:t,x:n,y:o}){let r=e.values().next().value;if(!r)return null;let i={x:n-r.distance.x,y:o-r.distance.y},s=wt(i,t);return{x:s.x-i.x,y:s.y-i.y}}function xs({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,c=!1,l={x:0,y:0},d=null,f=!1,u=null,h=!1,p=!1,x=null;function b({noDragClassName:v,handleSelector:g,domNode:w,isSelectable:_,nodeId:E,nodeClickDistance:C=0}){u=de(w);function M({x:L,y:S}){let{nodeLookup:y,nodeExtent:k,snapGrid:N,snapToGrid:O,nodeOrigin:A,onNodeDrag:T,onSelectionDrag:B,onError:H,updateNodePositions:F}=t();i={x:L,y:S};let q=!1,Y=a.size>1,K=Y&&k?ro(bt(a)):null,ee=Y&&O?Ku({dragItems:a,snapGrid:N,x:L,y:S}):null;for(let[W,$]of a){if(!y.has(W))continue;let X={x:L-$.distance.x,y:S-$.distance.y};O&&(X=ee?{x:Math.round(X.x+ee.x),y:Math.round(X.y+ee.y)}:wt(X,N));let Q=null;if(Y&&k&&!$.extent&&K){let{positionAbsolute:G}=$.internals,te=G.x-K.x+k[0][0],ne=G.x+$.measured.width-K.x2+k[1][0],re=G.y-K.y+k[0][1],ue=G.y+$.measured.height-K.y2+k[1][1];Q=[[te,re],[ne,ue]]}let{position:U,positionAbsolute:Z}=fo({nodeId:W,nextPosition:X,nodeLookup:y,nodeExtent:Q||k,nodeOrigin:A,onError:H});q=q||$.position.x!==U.x||$.position.y!==U.y,$.position=U,$.internals.positionAbsolute=Z}if(p=p||q,!!q&&(F(a,!0),x&&(o||T||!E&&B))){let[W,$]=to({nodeId:E,dragItems:a,nodeLookup:y});o?.(x,a,W,$),T?.(x,W,$),E||B?.(x,$)}}async function I(){if(!d)return;let{transform:L,panBy:S,autoPanSpeed:y,autoPanOnNodeDrag:k}=t();if(!k){c=!1,cancelAnimationFrame(s);return}let[N,O]=gn(l,d,y);(N!==0||O!==0)&&(i.x=(i.x??0)-N/L[2],i.y=(i.y??0)-O/L[2],await S({x:N,y:O})&&M(i)),s=requestAnimationFrame(I)}function V(L){let{nodeLookup:S,multiSelectionActive:y,nodesDraggable:k,transform:N,snapGrid:O,snapToGrid:A,selectNodesOnDrag:T,onNodeDragStart:B,onSelectionDragStart:H,unselectNodesAndEdges:F}=t();f=!0,(!T||!_)&&!y&&E&&(S.get(E)?.selected||F()),_&&T&&E&&e?.(E);let q=$t(L.sourceEvent,{transform:N,snapGrid:O,snapToGrid:A,containerBounds:d});if(i=q,a=qu(S,k,q,E),a.size>0&&(n||B||!E&&H)){let[Y,K]=to({nodeId:E,dragItems:a,nodeLookup:S});n?.(L.sourceEvent,a,Y,K),B?.(L.sourceEvent,Y,K),E||H?.(L.sourceEvent,K)}}let P=tn().clickDistance(C).on("start",L=>{let{domNode:S,nodeDragThreshold:y,transform:k,snapGrid:N,snapToGrid:O}=t();d=S?.getBoundingClientRect()||null,h=!1,p=!1,x=L.sourceEvent,y===0&&V(L),i=$t(L.sourceEvent,{transform:k,snapGrid:N,snapToGrid:O,containerBounds:d}),l=be(L.sourceEvent,d)}).on("drag",L=>{let{autoPanOnNodeDrag:S,transform:y,snapGrid:k,snapToGrid:N,nodeDragThreshold:O,nodeLookup:A}=t(),T=$t(L.sourceEvent,{transform:y,snapGrid:k,snapToGrid:N,containerBounds:d});if(x=L.sourceEvent,(L.sourceEvent.type==="touchmove"&&L.sourceEvent.touches.length>1||E&&!A.has(E))&&(h=!0),!h){if(!c&&S&&f&&(c=!0,I()),!f){let B=be(L.sourceEvent,d),H=B.x-l.x,F=B.y-l.y;Math.sqrt(H*H+F*F)>O&&V(L)}(i.x!==T.xSnapped||i.y!==T.ySnapped)&&a&&f&&(l=be(L.sourceEvent,d),M(T))}}).on("end",L=>{if(!f||h){h&&a.size>0&&t().updateNodePositions(a,!1);return}if(c=!1,f=!1,cancelAnimationFrame(s),a.size>0){let{nodeLookup:S,updateNodePositions:y,onNodeDragStop:k,onSelectionDragStop:N}=t();if(p&&(y(a,!1),p=!1),r||k||!E&&N){let[O,A]=to({nodeId:E,dragItems:a,nodeLookup:S,dragging:!1});r?.(L.sourceEvent,a,O,A),k?.(L.sourceEvent,O,A),E||N?.(L.sourceEvent,A)}}}).filter(L=>{let S=L.target;return!L.button&&(!v||!Qi(S,`.${v}`,w))&&(!g||Qi(S,g,w))});u.call(P)}function m(){u?.on(".drag",null)}return{update:b,destroy:m}}function Gu(e,t,n){let o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let i of t.values())Ht(r,yt(i))>0&&o.push(i);return o}var Uu=250;function Qu(e,t,n,o){let r=[],i=1/0,s=Gu(e,n,t+Uu);for(let a of s){let c=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(let l of c){if(o.nodeId===l.nodeId&&o.type===l.type&&o.id===l.id)continue;let{x:d,y:f}=je(a,l,l.position,!0),u=Math.sqrt(Math.pow(d-e.x,2)+Math.pow(f-e.y,2));u>t||(u<i?(r=[{...l,x:d,y:f}],i=u):u===i&&r.push({...l,x:d,y:f}))}}if(!r.length)return null;if(r.length>1){let a=o.type==="source"?"target":"source";return r.find(c=>c.type===a)??r[0]}return r[0]}function vs(e,t,n,o,r,i=!1){let s=o.get(e);if(!s)return null;let a=r==="strict"?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],c=(n?a?.find(l=>l.id===n):a?.[0])??null;return c&&i?{...c,...je(s,c,c.position,!0)}:c}function ks(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function Ju(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var _s=()=>!0;function ef(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:c,lib:l,autoPanOnConnect:d,flowId:f,panBy:u,cancelConnection:h,onConnectStart:p,onConnect:x,onConnectEnd:b,isValidConnection:m=_s,onReconnectEnd:v,updateConnection:g,getTransform:w,getFromHandle:_,autoPanSpeed:E,dragThreshold:C=1,handleDomNode:M}){let I=wo(e.target),V=0,P,{x:L,y:S}=be(e),y=ks(i,M),k=a?.getBoundingClientRect(),N=!1;if(!k||!y)return;let O=vs(r,y,o,c,t);if(!O)return;let A=be(e,k),T=!1,B=null,H=!1,F=null;function q(){if(!d||!k)return;let[U,Z]=gn(A,k,E);u({x:U,y:Z}),V=requestAnimationFrame(q)}let Y={...O,nodeId:r,type:y,position:O.position},K=c.get(r),W={inProgress:!0,isValid:null,from:je(K,Y,j.Left,!0),fromHandle:Y,fromPosition:Y.position,fromNode:K,to:A,toHandle:null,toPosition:Fi[Y.position],toNode:null,pointer:A};function $(){N=!0,g(W),p?.(e,{nodeId:r,handleId:o,handleType:y})}C===0&&$();function X(U){if(!N){let{x:ue,y:Se}=be(U),ve=ue-L,ke=Se-S;if(!(ve*ve+ke*ke>C*C))return;$()}if(!_()||!Y){Q(U);return}let Z=w();A=be(U,k),P=Qu(xt(A,Z,!1,[1,1]),n,c,Y),T||(q(),T=!0);let G=Es(U,{handle:P,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:m,doc:I,lib:l,flowId:f,nodeLookup:c});F=G.handleDomNode,B=G.connection,H=Ju(!!P,G.isValid);let te=c.get(r),ne=te?je(te,Y,j.Left,!0):W.from,re={...W,from:ne,isValid:H,to:G.toHandle&&H?nt({x:G.toHandle.x,y:G.toHandle.y},Z):A,toHandle:G.toHandle,toPosition:H&&G.toHandle?G.toHandle.position:Fi[Y.position],toNode:G.toHandle?c.get(G.toHandle.nodeId):null,pointer:A};g(re),W=re}function Q(U){if(!("touches"in U&&U.touches.length>0)){if(N){(P||F)&&B&&H&&x?.(B);let{inProgress:Z,...G}=W,te={...G,toPosition:W.toHandle?W.toPosition:null};b?.(U,te),i&&v?.(U,te)}h(),cancelAnimationFrame(V),T=!1,H=!1,B=null,F=null,I.removeEventListener("mousemove",X),I.removeEventListener("mouseup",Q),I.removeEventListener("touchmove",X),I.removeEventListener("touchend",Q)}}I.addEventListener("mousemove",X),I.addEventListener("mouseup",Q),I.addEventListener("touchmove",X),I.addEventListener("touchend",Q)}function Es(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:l=_s,nodeLookup:d}){let f=i==="target",u=t?s.querySelector(`.${a}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:p}=be(e),x=s.elementFromPoint(h,p),b=x?.classList.contains(`${a}-flow__handle`)?x:u,m={handleDomNode:b,isValid:!1,connection:null,toHandle:null};if(b){let v=ks(void 0,b),g=b.getAttribute("data-nodeid"),w=b.getAttribute("data-handleid"),_=b.classList.contains("connectable"),E=b.classList.contains("connectableend");if(!g||!v)return m;let C={source:f?g:o,sourceHandle:f?w:r,target:f?o:g,targetHandle:f?r:w};m.connection=C;let I=_&&E&&(n===Ye.Strict?f&&v==="source"||!f&&v==="target":g!==o||w!==r);m.isValid=I&&l(C),m.toHandle=vs(g,v,w,d,n,!0)}return m}var Sn={onPointerDown:ef,isValid:Es};function Ns({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){let r=de(e);function i({translateExtent:a,width:c,height:l,zoomStep:d=1,pannable:f=!0,zoomable:u=!0,inversePan:h=!1}){let p=g=>{if(g.sourceEvent.type!=="wheel"||!t)return;let w=n(),_=g.sourceEvent.ctrlKey&&vt()?10:1,E=-g.sourceEvent.deltaY*(g.sourceEvent.deltaMode===1?.05:g.sourceEvent.deltaMode?1:.002)*d,C=w[2]*Math.pow(2,E*_);t.scaleTo(C)},x=[0,0],b=g=>{(g.sourceEvent.type==="mousedown"||g.sourceEvent.type==="touchstart")&&(x=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY])},m=g=>{let w=n();if(g.sourceEvent.type!=="mousemove"&&g.sourceEvent.type!=="touchmove"||!t)return;let _=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY],E=[_[0]-x[0],_[1]-x[1]];x=_;let C=o()*Math.max(w[2],Math.log(w[2]))*(h?-1:1),M={x:w[0]-E[0]*C,y:w[1]-E[1]*C},I=[[0,0],[c,l]];t.setViewportConstrained({x:M.x,y:M.y,zoom:w[2]},I,a)},v=dn().on("start",b).on("zoom",f?m:null).on("zoom.wheel",u?p:null);r.call(v,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:he}}var Cn=e=>({x:e.x,y:e.y,zoom:e.k}),no=({x:e,y:t,zoom:n})=>Je.translate(e,t).scale(n),Fe=(e,t)=>e.target.closest(`.${t}`),Ss=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),tf=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,oo=(e,t=0,n=tf,o=()=>{})=>{let r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Cs=e=>{let t=e.ctrlKey&&vt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function nf({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:l}){return d=>{if(Fe(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();let f=n.property("__zoom").k||1;if(d.ctrlKey&&s){let b=he(d),m=Cs(d),v=f*Math.pow(2,m);o.scaleTo(n,v,b,d);return}let u=d.deltaMode===1?20:1,h=r===Ae.Vertical?0:d.deltaX*u,p=r===Ae.Horizontal?0:d.deltaY*u;!vt()&&d.shiftKey&&r!==Ae.Vertical&&(h=d.deltaY*u,p=0),o.translateBy(n,-(h/f)*i,-(p/f)*i,{internal:!0});let x=Cn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c?.(d,x):(e.isPanScrolling=!0,a?.(d,x)),e.panScrollTimeout=setTimeout(()=>{l?.(d,x),e.isPanScrolling=!1},150)}}function of({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){let i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,a=Fe(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function rf({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;let r=Cn(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,r)}}function sf({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&Ss(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,Cn(i.transform))}}function af({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&Ss(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){let a=Cn(s.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,a)},n?150:0)}}}function lf({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:o,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:s,userSelectionActive:a,noWheelClassName:c,noPanClassName:l,lib:d,connectionInProgress:f}){return u=>{let h=t||n,p=o&&u.ctrlKey,x=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(Fe(u,`${d}-flow__node`)||Fe(u,`${d}-flow__edge`)||Fe(u,`${d}-flow__selection`)||Fe(u,`${d}-flow__nodesselection`)))return!0;if(!r&&!h&&!i&&!s&&!o||a||f&&!x||Fe(u,c)&&x||Fe(u,l)&&(!x||i&&x&&!t)||!o&&u.ctrlKey&&x)return!1;if(!o&&u.type==="touchstart"&&u.touches?.length>1)return u.preventDefault(),!1;if(!h&&!i&&!p&&x||!r&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(r)&&!r.includes(u.button)&&u.type==="mousedown")return!1;let b=Array.isArray(r)&&r.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||x||e)&&b}}function Ms({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),f=[[0,0],[d.width,d.height]];(typeof ResizeObserver<"u"?new ResizeObserver(S=>{let y=S[0];y&&(f=[[0,0],[y.contentRect.width,y.contentRect.height]])}):null)?.observe(e);let h=dn().extent(()=>f).scaleExtent([t,n]).translateExtent(o),p=de(e).call(h);w({x:r.x,y:r.y,zoom:gt(r.zoom,t,n)},[[0,0],[d.width,d.height]],o);let x=p.on("wheel.zoom"),b=p.on("dblclick.zoom");h.wheelDelta(Cs);async function m(S,y){return p?new Promise(k=>{h?.interpolate(y?.interpolate==="linear"?qt:dt).transform(oo(p,y?.duration,y?.ease,()=>k(!0)),S)}):!1}function v({noWheelClassName:S,noPanClassName:y,onPaneContextMenu:k,userSelectionActive:N,panOnScroll:O,panOnDrag:A,panOnScrollMode:T,panOnScrollSpeed:B,preventScrolling:H,zoomOnPinch:F,zoomOnScroll:q,zoomOnDoubleClick:Y,panActivationKeyPressed:K=!1,zoomActivationKeyPressed:ee,lib:W,onTransformChange:$,connectionInProgress:X,paneClickDistance:Q,selectionOnDrag:U}){N&&!l.isZoomingOrPanning&&g();let Z=O&&!ee&&!N;h.clickDistance(U?1/0:!me(Q)||Q<0?0:Q);let G=Z?nf({zoomPanValues:l,noWheelClassName:S,d3Selection:p,d3Zoom:h,panOnScrollMode:T,panOnScrollSpeed:B,zoomOnPinch:F,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):of({noWheelClassName:S,preventScrolling:H,d3ZoomHandler:x});p.on("wheel.zoom",G,{passive:!1});let te=rf({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:s});h.on("start",te);let ne=sf({zoomPanValues:l,panOnDrag:A,onPaneContextMenu:!!k,onPanZoom:i,onTransformChange:$});h.on("zoom",ne);let re=af({zoomPanValues:l,panOnDrag:A,panOnScroll:O,onPaneContextMenu:k,onPanZoomEnd:a,onDraggingChange:c});h.on("end",re);let ue=lf({panActivationKeyPressed:K,zoomActivationKeyPressed:ee,panOnDrag:A,zoomOnScroll:q,panOnScroll:O,zoomOnDoubleClick:Y,zoomOnPinch:F,userSelectionActive:N,noPanClassName:y,noWheelClassName:S,lib:W,connectionInProgress:X});h.filter(ue),Y?p.on("dblclick.zoom",b):p.on("dblclick.zoom",null)}function g(){h.on("zoom",null)}async function w(S,y,k){let N=no(S),O=h?.constrain()(N,y,k);return O&&await m(O),O}async function _(S,y){let k=no(S);return await m(k,y),k}function E(S){if(p){let y=no(S),k=p.property("__zoom");(k.k!==S.zoom||k.x!==S.x||k.y!==S.y)&&h?.transform(p,y,null,{sync:!0})}}function C(){let S=p?Rt(p.node()):{x:0,y:0,k:1};return{x:S.x,y:S.y,zoom:S.k}}async function M(S,y){return p?new Promise(k=>{h?.interpolate(y?.interpolate==="linear"?qt:dt).scaleTo(oo(p,y?.duration,y?.ease,()=>k(!0)),S)}):!1}async function I(S,y){return p?new Promise(k=>{h?.interpolate(y?.interpolate==="linear"?qt:dt).scaleBy(oo(p,y?.duration,y?.ease,()=>k(!0)),S)}):!1}function V(S){h?.scaleExtent(S)}function P(S){h?.translateExtent(S)}function L(S){let y=!me(S)||S<0?0:S;h?.clickDistance(y)}return{update:v,destroy:g,setViewport:_,setViewportConstrained:w,getViewport:C,scaleTo:M,scaleBy:I,setScaleExtent:V,setTranslateExtent:P,syncViewport:E,setClickDistance:L}}var Xe;(function(e){e.Line="line",e.Handle="handle"})(Xe||(Xe={}));function cf({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){let s=e-t,a=n-o,c=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(c[0]=c[0]*-1),a&&i&&(c[1]=c[1]*-1),c}function Ji(e){let t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function He(e,t){return Math.max(0,t-e)}function Be(e,t){return Math.max(0,e-t)}function fn(e,t,n){return Math.max(0,t-e,e-n)}function es(e,t){return e?!t:t}function df(e,t,n,o,r,i,s,a){let{affectsX:c,affectsY:l}=t,{isHorizontal:d,isVertical:f}=t,u=d&&f,{xSnapped:h,ySnapped:p}=n,{minWidth:x,maxWidth:b,minHeight:m,maxHeight:v}=o,{x:g,y:w,width:_,height:E,aspectRatio:C}=e,M=Math.floor(d?h-e.pointerX:0),I=Math.floor(f?p-e.pointerY:0),V=_+(c?-M:M),P=E+(l?-I:I),L=-i[0]*_,S=-i[1]*E,y=fn(V,x,b),k=fn(P,m,v);if(s){let A=0,T=0;c&&M<0?A=He(g+M+L,s[0][0]):!c&&M>0&&(A=Be(g+V+L,s[1][0])),l&&I<0?T=He(w+I+S,s[0][1]):!l&&I>0&&(T=Be(w+P+S,s[1][1])),y=Math.max(y,A),k=Math.max(k,T)}if(a){let A=0,T=0;c&&M>0?A=Be(g+M,a[0][0]):!c&&M<0&&(A=He(g+V,a[1][0])),l&&I>0?T=Be(w+I,a[0][1]):!l&&I<0&&(T=He(w+P,a[1][1])),y=Math.max(y,A),k=Math.max(k,T)}if(r){if(d){let A=fn(V/C,m,v)*C;if(y=Math.max(y,A),s){let T=0;!c&&!l||c&&!l&&u?T=Be(w+S+V/C,s[1][1])*C:T=He(w+S+(c?M:-M)/C,s[0][1])*C,y=Math.max(y,T)}if(a){let T=0;!c&&!l||c&&!l&&u?T=He(w+V/C,a[1][1])*C:T=Be(w+(c?M:-M)/C,a[0][1])*C,y=Math.max(y,T)}}if(f){let A=fn(P*C,x,b)/C;if(k=Math.max(k,A),s){let T=0;!c&&!l||l&&!c&&u?T=Be(g+P*C+L,s[1][0])/C:T=He(g+(l?I:-I)*C+L,s[0][0])/C,k=Math.max(k,T)}if(a){let T=0;!c&&!l||l&&!c&&u?T=He(g+P*C,a[1][0])/C:T=Be(g+(l?I:-I)*C,a[0][0])/C,k=Math.max(k,T)}}}I=I+(I<0?k:-k),M=M+(M<0?y:-y),r&&(u?V>P*C?I=(es(c,l)?-M:M)/C:M=(es(c,l)?-I:I)*C:d?(I=M/C,l=c):(M=I*C,c=l));let N=c?g+M:g,O=l?w+I:w;return{width:_+(c?-M:M),height:E+(l?-I:I),x:i[0]*M*(c?-1:1)+N,y:i[1]*I*(l?-1:1)+O}}var Is={width:0,height:0,x:0,y:0},uf={...Is,pointerX:0,pointerY:0,aspectRatio:1};function ff(e,t,n){let o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,c=n[1]*s;return[[o-a,r-c],[o+i-a,r+s-c]]}function Os({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){let i=de(e),s={controlDirection:Ji("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:f,resizeDirection:u,onResizeStart:h,onResize:p,onResizeEnd:x,shouldResize:b}){let m={...Is},v={...uf};s={boundaries:d,resizeDirection:u,keepAspectRatio:f,controlDirection:Ji(l)};let g,w=null,_=[],E,C,M,I=tn().on("start",V=>{let{nodeLookup:P,transform:L,snapGrid:S,snapToGrid:y,nodeOrigin:k,paneDomNode:N}=n();if(g=P.get(t),!g)return;w=N?.getBoundingClientRect()??null;let{xSnapped:O,ySnapped:A}=$t(V.sourceEvent,{transform:L,snapGrid:S,snapToGrid:y,containerBounds:w});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},v={...m,pointerX:O,pointerY:A,aspectRatio:m.width/m.height},E=void 0,C=ot(g.extent)?g.extent:void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(E=P.get(g.parentId)),E&&g.extent==="parent"&&(C=[[0,0],[E.measured.width,E.measured.height]]),_=[],M=void 0;for(let[T,B]of P)if(B.parentId===t&&(_.push({id:T,position:{...B.position},extent:B.extent}),B.extent==="parent"||B.expandParent)){let H=ff(B,g,B.origin??k);M?M=[[Math.min(H[0][0],M[0][0]),Math.min(H[0][1],M[0][1])],[Math.max(H[1][0],M[1][0]),Math.max(H[1][1],M[1][1])]]:M=H}h?.(V,{...m})}).on("drag",V=>{let{transform:P,snapGrid:L,snapToGrid:S,nodeOrigin:y}=n(),k=$t(V.sourceEvent,{transform:P,snapGrid:L,snapToGrid:S,containerBounds:w}),N=[];if(!g)return;let{x:O,y:A,width:T,height:B}=m,H={},F=g.origin??y,{width:q,height:Y,x:K,y:ee}=df(v,s.controlDirection,k,s.boundaries,s.keepAspectRatio,F,C,M),W=q!==T,$=Y!==B,X=K!==O&&W,Q=ee!==A&&$;if(!X&&!Q&&!W&&!$)return;let U={prevValues:{...m},startX:v.x,startY:v.y,childNodes:_.map(ne=>({...ne,position:{...ne.position}}))};if((X||Q||F[0]===1||F[1]===1)&&(H.x=X?K:m.x,H.y=Q?ee:m.y,m.x=H.x,m.y=H.y,_.length>0)){let ne=K-O,re=ee-A;for(let ue of _)ue.position={x:ue.position.x-ne+F[0]*(q-T),y:ue.position.y-re+F[1]*(Y-B)},N.push(ue)}if((W||$)&&(H.width=W&&(!s.resizeDirection||s.resizeDirection==="horizontal")?q:m.width,H.height=$&&(!s.resizeDirection||s.resizeDirection==="vertical")?Y:m.height,m.width=H.width,m.height=H.height),E&&g.expandParent){let ne=F[0]*(H.width??0);H.x&&H.x<ne&&(m.x=ne,v.x=v.x-(H.x-ne));let re=F[1]*(H.height??0);H.y&&H.y<re&&(m.y=re,v.y=v.y-(H.y-re))}let Z=cf({width:m.width,prevWidth:T,height:m.height,prevHeight:B,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),G={...m,direction:Z};if(b?.(V,G)===!1){m=U.prevValues,v.x=U.startX,v.y=U.startY,_.forEach((ne,re)=>{ne.position=U.childNodes[re].position});return}p?.(V,G),o(H,N)}).on("end",V=>{x?.(V,{...m}),r?.({...m})});i.call(I)}function c(){i.on(".drag",null)}return{update:a,destroy:c}}var As=Le(Xn(),1),Ts=Le(jc(),1);var Ps=e=>{let t,n=new Set,o=(d,f)=>{let u=typeof d=="function"?d(t):d;if(!Object.is(u,t)){let h=t;t=f??(typeof u!="object"||u===null)?u:Object.assign({},t,u),n.forEach(p=>p(t,h))}},r=()=>t,c={setState:o,getState:r,getInitialState:()=>l,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(import.meta.env?import.meta.env.MODE:void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},l=t=e(o,r,c);return c},zs=e=>e?Ps(e):Ps;var{useDebugValue:hf}=As.default,{useSyncExternalStoreWithSelector:pf}=Ts.default,gf=e=>e;function Mo(e,t=gf,n){let o=pf(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return hf(o),o}var Ds=(e,t)=>{let n=zs(e),o=(r,i=t)=>Mo(n,r,i);return Object.assign(o,n),o},Ls=(e,t)=>e?Ds(e,t):Ds;function ie(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let o of e)if(!t.has(o))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}var mf=Le(Yc()),Pn=(0,D.createContext)(null),bf=Pn.Provider,ca=ge.error001("react");function J(e,t){let n=(0,D.useContext)(Pn);if(n===null)throw new Error(ca);return Mo(n,e,t)}function se(){let e=(0,D.useContext)(Pn);if(e===null)throw new Error(ca);return(0,D.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var Rs={display:"none"},yf={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},da="react-flow__node-desc",ua="react-flow__edge-desc",wf="react-flow__aria-live",xf=e=>e.ariaLiveMessage,vf=e=>e.ariaLabelConfig;function kf({rfId:e}){let t=J(xf);return(0,z.jsx)("div",{id:`${wf}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:yf,children:t})}function _f({rfId:e,disableKeyboardA11y:t}){let n=J(vf);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("div",{id:`${da}-${e}`,style:Rs,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),(0,z.jsx)("div",{id:`${ua}-${e}`,style:Rs,children:n["edge.a11yDescription.default"]}),!t&&(0,z.jsx)(kf,{rfId:e})]})}var zn=(0,D.forwardRef)(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{let s=`${e}`.split("-");return(0,z.jsx)("div",{className:ae(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});zn.displayName="Panel";var $s="https://reactflow.dev?utm_source=attribution";function Ef({proOptions:e,position:t="bottom-right"}){return(0,D.useEffect)(()=>{},[]),e?.hideAttribution?null:(0,z.jsx)(zn,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${$s}`,children:(0,z.jsx)("a",{href:$s,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}var Nf=e=>{let t=[],n=[];for(let[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(let[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},Mn=e=>e.id;function Sf(e,t){return ie(e.selectedNodes.map(Mn),t.selectedNodes.map(Mn))&&ie(e.selectedEdges.map(Mn),t.selectedEdges.map(Mn))}function Cf({onSelectionChange:e}){let t=se(),{selectedNodes:n,selectedEdges:o}=J(Nf,Sf);return(0,D.useEffect)(()=>{let r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}var Mf=e=>!!e.onSelectionChangeHandlers;function If({onSelectionChange:e}){let t=J(Mf);return e||t?(0,z.jsx)(Cf,{onSelectionChange:e}):null}var fa=[0,0],Of={x:0,y:0,zoom:1},Pf=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],Vs=[...Pf,"rfId"],zf=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),Hs={translateExtent:mt,nodeOrigin:fa,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Df(e){let{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:c}=J(zf,ie),l=se();(0,D.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=Hs,a()}),[]);let d=(0,D.useRef)(Hs);return(0,D.useEffect)(()=>{for(let f of Vs){let u=e[f],h=d.current[f];u!==h&&(typeof e[f]>"u"||(f==="nodes"?t(u):f==="edges"?n(u):f==="minZoom"?o(u):f==="maxZoom"?r(u):f==="translateExtent"?i(u):f==="nodeExtent"?s(u):f==="ariaLabelConfig"?l.setState({ariaLabelConfig:ls(u)}):f==="fitView"?l.setState({fitViewQueued:u}):f==="fitViewOptions"?l.setState({fitViewOptions:u}):l.setState({[f]:u})))}d.current=e},Vs.map(f=>e[f])),null}function Bs(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Af(e){let[t,n]=(0,D.useState)(e==="system"?null:e);return(0,D.useEffect)(()=>{if(e!=="system"){n(e);return}let o=Bs(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:Bs()?.matches?"dark":"light"}var Fs=typeof document<"u"?document:null;function Ft(e=null,t={target:Fs,actInsideInputWithModifier:!0}){let[n,o]=(0,D.useState)(!1),r=(0,D.useRef)(!1),i=(0,D.useRef)(new Set([])),[s,a]=(0,D.useMemo)(()=>{if(e!==null){let l=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace(/\+/g,`
|
|
1
|
+
import{a as ct,b as Wn,e as qn,g as wr,h as xr,i as qt,j as vr,k as kr,l as dt,o as _r,p as Er,q as Kn}from"./chunk-P5ET5XMK.js";import{a as ur,b as fr}from"./chunk-GLP5VV7P.js";import{d as pr,e as gr}from"./chunk-HIORXCFE.js";import{b as jc}from"./chunk-2CPNXVIL.js";import"./chunk-WDYURK6F.js";import{d as mr,e as br,f as yr}from"./chunk-2XAH6DED.js";import{A as rr,Ea as cr,a as Wt,c as Xn,gb as dr,hb as Zn,ib as Yc,kb as Oe,oa as ir,qa as sr,ya as ar,z as or,za as lr}from"./chunk-3YAYFUS4.js";import{c as Le,d as hr}from"./chunk-DUIGVKKG.js";var oe=Le(Xn(),1);var z=Le(Zn()),D=Le(Xn());function ae(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n<e.length;n++)(o=ae(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Kt="http://www.w3.org/1999/xhtml",Gn={svg:"http://www.w3.org/2000/svg",xhtml:Kt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Pe(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Gn.hasOwnProperty(t)?{space:Gn[t],local:e}:e}function Xc(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Kt&&t.documentElement.namespaceURI===Kt?t.createElement(e):t.createElementNS(n,e)}}function Zc(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Gt(e){var t=Pe(e);return(t.local?Zc:Xc)(t)}function Wc(){}function Ge(e){return e==null?Wc:function(){return this.querySelector(e)}}function Nr(e){typeof e!="function"&&(e=Ge(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=new Array(s),c,l,d=0;d<s;++d)(c=i[d])&&(l=e.call(c,c.__data__,d,i))&&("__data__"in c&&(l.__data__=c.__data__),a[d]=l);return new le(o,this._parents)}function Un(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function qc(){return[]}function Ct(e){return e==null?qc:function(){return this.querySelectorAll(e)}}function Kc(e){return function(){return Un(e.apply(this,arguments))}}function Sr(e){typeof e=="function"?e=Kc(e):e=Ct(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(o.push(e.call(c,c.__data__,l,s)),r.push(c));return new le(o,r)}function Mt(e){return function(){return this.matches(e)}}function Ut(e){return function(t){return t.matches(e)}}var Gc=Array.prototype.find;function Uc(e){return function(){return Gc.call(this.children,e)}}function Qc(){return this.firstElementChild}function Cr(e){return this.select(e==null?Qc:Uc(typeof e=="function"?e:Ut(e)))}var Jc=Array.prototype.filter;function ed(){return Array.from(this.children)}function td(e){return function(){return Jc.call(this.children,e)}}function Mr(e){return this.selectAll(e==null?ed:td(typeof e=="function"?e:Ut(e)))}function Ir(e){typeof e!="function"&&(e=Mt(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new le(o,this._parents)}function Qt(e){return new Array(e.length)}function Or(){return new le(this._enter||this._groups.map(Qt),this._parents)}function It(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}It.prototype={constructor:It,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 Pr(e){return function(){return e}}function nd(e,t,n,o,r,i){for(var s=0,a,c=t.length,l=i.length;s<l;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new It(e,i[s]);for(;s<c;++s)(a=t[s])&&(r[s]=a)}function od(e,t,n,o,r,i,s){var a,c,l=new Map,d=t.length,f=i.length,u=new Array(d),h;for(a=0;a<d;++a)(c=t[a])&&(u[a]=h=s.call(c,c.__data__,a,t)+"",l.has(h)?r[a]=c:l.set(h,c));for(a=0;a<f;++a)h=s.call(e,i[a],a,i)+"",(c=l.get(h))?(o[a]=c,c.__data__=i[a],l.delete(h)):n[a]=new It(e,i[a]);for(a=0;a<d;++a)(c=t[a])&&l.get(u[a])===c&&(r[a]=c)}function rd(e){return e.__data__}function zr(e,t){if(!arguments.length)return Array.from(this,rd);var n=t?od:nd,o=this._parents,r=this._groups;typeof e!="function"&&(e=Pr(e));for(var i=r.length,s=new Array(i),a=new Array(i),c=new Array(i),l=0;l<i;++l){var d=o[l],f=r[l],u=f.length,h=id(e.call(d,d&&d.__data__,l,o)),p=h.length,x=a[l]=new Array(p),b=s[l]=new Array(p),m=c[l]=new Array(u);n(d,f,x,b,m,h,t);for(var v=0,g=0,w,_;v<p;++v)if(w=x[v]){for(v>=g&&(g=v+1);!(_=b[g])&&++g<p;);w._next=_||null}}return s=new le(s,o),s._enter=a,s._exit=c,s}function id(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Dr(){return new le(this._exit||this._groups.map(Qt),this._parents)}function Ar(e,t,n){var o=this.enter(),r=this,i=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?i.remove():n(i),o&&r?o.merge(r).order():r}function Tr(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),c=0;c<s;++c)for(var l=n[c],d=o[c],f=l.length,u=a[c]=new Array(f),h,p=0;p<f;++p)(h=l[p]||d[p])&&(u[p]=h);for(;c<r;++c)a[c]=n[c];return new le(a,this._parents)}function Lr(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,i=o[r],s;--r>=0;)(s=o[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function Rr(e){e||(e=sd);function t(f,u){return f&&u?e(f.__data__,u.__data__):!f-!u}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],a=s.length,c=r[i]=new Array(a),l,d=0;d<a;++d)(l=s[d])&&(c[d]=l);c.sort(t)}return new le(r,this._parents).order()}function sd(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function $r(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Vr(){return Array.from(this)}function Hr(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function Br(){let e=0;for(let t of this)++e;return e}function Fr(){return!this.node()}function Yr(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],i=0,s=r.length,a;i<s;++i)(a=r[i])&&e.call(a,a.__data__,i,r);return this}function ad(e){return function(){this.removeAttribute(e)}}function ld(e){return function(){this.removeAttributeNS(e.space,e.local)}}function cd(e,t){return function(){this.setAttribute(e,t)}}function dd(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function ud(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function fd(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 jr(e,t){var n=Pe(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?ld:ad:typeof t=="function"?n.local?fd:ud:n.local?dd:cd)(n,t))}function Jt(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function hd(e){return function(){this.style.removeProperty(e)}}function pd(e,t,n){return function(){this.style.setProperty(e,t,n)}}function gd(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Xr(e,t,n){return arguments.length>1?this.each((t==null?hd:typeof t=="function"?gd:pd)(e,t,n??"")):Re(this.node(),e)}function Re(e,t){return e.style.getPropertyValue(t)||Jt(e).getComputedStyle(e,null).getPropertyValue(t)}function md(e){return function(){delete this[e]}}function bd(e,t){return function(){this[e]=t}}function yd(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Zr(e,t){return arguments.length>1?this.each((t==null?md:typeof t=="function"?yd:bd)(e,t)):this.node()[e]}function Wr(e){return e.trim().split(/^|\s+/)}function Qn(e){return e.classList||new qr(e)}function qr(e){this._node=e,this._names=Wr(e.getAttribute("class")||"")}qr.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 Kr(e,t){for(var n=Qn(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function Gr(e,t){for(var n=Qn(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function wd(e){return function(){Kr(this,e)}}function xd(e){return function(){Gr(this,e)}}function vd(e,t){return function(){(t.apply(this,arguments)?Kr:Gr)(this,e)}}function Ur(e,t){var n=Wr(e+"");if(arguments.length<2){for(var o=Qn(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?vd:t?wd:xd)(n,t))}function kd(){this.textContent=""}function _d(e){return function(){this.textContent=e}}function Ed(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Qr(e){return arguments.length?this.each(e==null?kd:(typeof e=="function"?Ed:_d)(e)):this.node().textContent}function Nd(){this.innerHTML=""}function Sd(e){return function(){this.innerHTML=e}}function Cd(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Jr(e){return arguments.length?this.each(e==null?Nd:(typeof e=="function"?Cd:Sd)(e)):this.node().innerHTML}function Md(){this.nextSibling&&this.parentNode.appendChild(this)}function ei(){return this.each(Md)}function Id(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ti(){return this.each(Id)}function ni(e){var t=typeof e=="function"?e:Gt(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Od(){return null}function oi(e,t){var n=typeof e=="function"?e:Gt(e),o=t==null?Od:typeof t=="function"?t:Ge(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function Pd(){var e=this.parentNode;e&&e.removeChild(this)}function ri(){return this.each(Pd)}function zd(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Dd(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ii(e){return this.select(e?Dd:zd)}function si(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Ad(e){return function(t){e.call(this,t,this.__data__)}}function Td(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function Ld(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,i;n<r;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++o]=i;++o?t.length=o:delete this.__on}}}function Rd(e,t,n){return function(){var o=this.__on,r,i=Ad(t);if(o){for(var s=0,a=o.length;s<a;++s)if((r=o[s]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=t;return}}this.addEventListener(e.type,i,n),r={type:e.type,name:e.name,value:t,listener:i,options:n},o?o.push(r):this.__on=[r]}}function ai(e,t,n){var o=Td(e+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,d;c<l;++c)for(r=0,d=a[c];r<i;++r)if((s=o[r]).type===d.type&&s.name===d.name)return d.value}return}for(a=t?Rd:Ld,r=0;r<i;++r)this.each(a(o[r],t,n));return this}function li(e,t,n){var o=Jt(e),r=o.CustomEvent;typeof r=="function"?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function $d(e,t){return function(){return li(this,e,t)}}function Vd(e,t){return function(){return li(this,e,t.apply(this,arguments))}}function ci(e,t){return this.each((typeof t=="function"?Vd:$d)(e,t))}function*di(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length,s;r<i;++r)(s=o[r])&&(yield s)}var Jn=[null];function le(e,t){this._groups=e,this._parents=t}function ui(){return new le([[document.documentElement]],Jn)}function Hd(){return this}le.prototype=ui.prototype={constructor:le,select:Nr,selectAll:Sr,selectChild:Cr,selectChildren:Mr,filter:Ir,data:zr,enter:Or,exit:Dr,join:Ar,merge:Tr,selection:Hd,order:Lr,sort:Rr,call:$r,nodes:Vr,node:Hr,size:Br,empty:Fr,each:Yr,attr:jr,style:Xr,property:Zr,classed:Ur,text:Qr,html:Jr,raise:ei,lower:ti,append:ni,insert:oi,remove:ri,clone:ii,datum:si,on:ai,dispatch:ci,[Symbol.iterator]:di};var ze=ui;function de(e){return typeof e=="string"?new le([[document.querySelector(e)]],[document.documentElement]):new le([[e]],Jn)}function fi(e){let t;for(;t=e.sourceEvent;)e=t;return e}function he(e,t){if(e=fi(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}var hi={passive:!1},Ue={capture:!0,passive:!1};function en(e){e.stopImmediatePropagation()}function $e(e){e.preventDefault(),e.stopImmediatePropagation()}function Ot(e){var t=e.document.documentElement,n=de(e).on("dragstart.drag",$e,Ue);"onselectstart"in t?n.on("selectstart.drag",$e,Ue):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Pt(e,t){var n=e.document.documentElement,o=de(e).on("dragstart.drag",null);t&&(o.on("click.drag",$e,Ue),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var zt=e=>()=>e;function Dt(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:c,dy:l,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:d}})}Dt.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Bd(e){return!e.ctrlKey&&!e.button}function Fd(){return this.parentNode}function Yd(e,t){return t??{x:e.x,y:e.y}}function jd(){return navigator.maxTouchPoints||"ontouchstart"in this}function tn(){var e=Bd,t=Fd,n=Yd,o=jd,r={},i=ct("start","drag","end"),s=0,a,c,l,d,f=0;function u(w){w.on("mousedown.drag",h).filter(o).on("touchstart.drag",b).on("touchmove.drag",m,hi).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(w,_){if(!(d||!e.call(this,w,_))){var E=g(this,t.call(this,w,_),w,_,"mouse");E&&(de(w.view).on("mousemove.drag",p,Ue).on("mouseup.drag",x,Ue),Ot(w.view),en(w),l=!1,a=w.clientX,c=w.clientY,E("start",w))}}function p(w){if($e(w),!l){var _=w.clientX-a,E=w.clientY-c;l=_*_+E*E>f}r.mouse("drag",w)}function x(w){de(w.view).on("mousemove.drag mouseup.drag",null),Pt(w.view,l),$e(w),r.mouse("end",w)}function b(w,_){if(e.call(this,w,_)){var E=w.changedTouches,C=t.call(this,w,_),M=E.length,I,V;for(I=0;I<M;++I)(V=g(this,C,w,_,E[I].identifier,E[I]))&&(en(w),V("start",w,E[I]))}}function m(w){var _=w.changedTouches,E=_.length,C,M;for(C=0;C<E;++C)(M=r[_[C].identifier])&&($e(w),M("drag",w,_[C]))}function v(w){var _=w.changedTouches,E=_.length,C,M;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),C=0;C<E;++C)(M=r[_[C].identifier])&&(en(w),M("end",w,_[C]))}function g(w,_,E,C,M,I){var V=i.copy(),P=he(I||E,_),L,S,y;if((y=n.call(w,new Dt("beforestart",{sourceEvent:E,target:u,identifier:M,active:s,x:P[0],y:P[1],dx:0,dy:0,dispatch:V}),C))!=null)return L=y.x-P[0]||0,S=y.y-P[1]||0,function k(N,O,A){var T=P,B;switch(N){case"start":r[M]=k,B=s++;break;case"end":delete r[M],--s;case"drag":P=he(A||O,_),B=s;break}V.call(N,w,new Dt(N,{sourceEvent:O,subject:y,target:u,identifier:M,active:B,x:P[0]+L,y:P[1]+S,dx:P[0]-T[0],dy:P[1]-T[1],dispatch:V}),C)}}return u.filter=function(w){return arguments.length?(e=typeof w=="function"?w:zt(!!w),u):e},u.container=function(w){return arguments.length?(t=typeof w=="function"?w:zt(w),u):t},u.subject=function(w){return arguments.length?(n=typeof w=="function"?w:zt(w),u):n},u.touchable=function(w){return arguments.length?(o=typeof w=="function"?w:zt(!!w),u):o},u.on=function(){var w=i.on.apply(i,arguments);return w===i?u:w},u.clickDistance=function(w){return arguments.length?(f=(w=+w)*w,u):Math.sqrt(f)},u}var Xd=ct("start","end","cancel","interrupt"),Zd=[],mi=0,pi=1,on=2,nn=3,gi=4,rn=5,At=6;function Ve(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;Wd(e,n,{name:t,index:o,group:r,on:Xd,tween:Zd,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:mi})}function Tt(e,t){var n=ce(e,t);if(n.state>mi)throw new Error("too late; already scheduled");return n}function fe(e,t){var n=ce(e,t);if(n.state>nn)throw new Error("too late; already running");return n}function ce(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Wd(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=Er(i,0,n.time);function i(l){n.state=pi,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var d,f,u,h;if(n.state!==pi)return c();for(d in o)if(h=o[d],h.name===n.name){if(h.state===nn)return Kn(s);h.state===gi?(h.state=At,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[d]):+d<t&&(h.state=At,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete o[d])}if(Kn(function(){n.state===nn&&(n.state=gi,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=on,n.on.call("start",e,e.__data__,n.index,n.group),n.state===on){for(n.state=nn,r=new Array(u=n.tween.length),d=0,f=-1;d<u;++d)(h=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(r[++f]=h);r.length=f+1}}function a(l){for(var d=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=rn,1),f=-1,u=r.length;++f<u;)r[f].call(e,d);n.state===rn&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=At,n.timer.stop(),delete o[t];for(var l in o)return;delete e.__transition}}function Qe(e,t){var n=e.__transition,o,r,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((o=n[s]).name!==t){i=!1;continue}r=o.state>on&&o.state<rn,o.state=At,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function bi(e){return this.each(function(){Qe(this,e)})}function qd(e,t){var n,o;return function(){var r=fe(this,e),i=r.tween;if(i!==n){o=n=i;for(var s=0,a=o.length;s<a;++s)if(o[s].name===t){o=o.slice(),o.splice(s,1);break}}r.tween=o}}function Kd(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=fe(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},c=0,l=r.length;c<l;++c)if(r[c].name===t){r[c]=a;break}c===l&&r.push(a)}i.tween=r}}function yi(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=ce(this.node(),n).tween,r=0,i=o.length,s;r<i;++r)if((s=o[r]).name===e)return s.value;return null}return this.each((t==null?qd:Kd)(n,e,t))}function ut(e,t,n){var o=e._id;return e.each(function(){var r=fe(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return ce(r,o).value[t]}}function sn(e,t){var n;return(typeof t=="number"?wr:t instanceof Wn?qn:(n=Wn(t))?(t=n,qn):xr)(e,t)}function Gd(e){return function(){this.removeAttribute(e)}}function Ud(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Qd(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttribute(e);return s===r?null:s===o?i:i=t(o=s,n)}}function Jd(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===r?null:s===o?i:i=t(o=s,n)}}function eu(e,t,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a)))}}function tu(e,t,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a)))}}function wi(e,t){var n=Pe(e),o=n==="transform"?kr:sn;return this.attrTween(e,typeof t=="function"?(n.local?tu:eu)(n,o,ut(this,"attr."+e,t)):t==null?(n.local?Ud:Gd)(n):(n.local?Jd:Qd)(n,o,t))}function nu(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function ou(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function ru(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&ou(e,i)),n}return r._value=t,r}function iu(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&nu(e,i)),n}return r._value=t,r}function xi(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 o=Pe(e);return this.tween(n,(o.local?ru:iu)(o,t))}function su(e,t){return function(){Tt(this,e).delay=+t.apply(this,arguments)}}function au(e,t){return t=+t,function(){Tt(this,e).delay=t}}function vi(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?su:au)(t,e)):ce(this.node(),t).delay}function lu(e,t){return function(){fe(this,e).duration=+t.apply(this,arguments)}}function cu(e,t){return t=+t,function(){fe(this,e).duration=t}}function ki(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?lu:cu)(t,e)):ce(this.node(),t).duration}function du(e,t){if(typeof t!="function")throw new Error;return function(){fe(this,e).ease=t}}function _i(e){var t=this._id;return arguments.length?this.each(du(t,e)):ce(this.node(),t).ease}function uu(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;fe(this,e).ease=n}}function Ei(e){if(typeof e!="function")throw new Error;return this.each(uu(this._id,e))}function Ni(e){typeof e!="function"&&(e=Mt(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new pe(o,this._parents,this._name,this._id)}function Si(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var c=t[a],l=n[a],d=c.length,f=s[a]=new Array(d),u,h=0;h<d;++h)(u=c[h]||l[h])&&(f[h]=u);for(;a<o;++a)s[a]=t[a];return new pe(s,this._parents,this._name,this._id)}function fu(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 hu(e,t,n){var o,r,i=fu(t)?Tt:fe;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}function Ci(e,t){var n=this._id;return arguments.length<2?ce(this.node(),n).on.on(e):this.each(hu(n,e,t))}function pu(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Mi(){return this.on("end.remove",pu(this._id))}function Ii(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Ge(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],c=a.length,l=i[s]=new Array(c),d,f,u=0;u<c;++u)(d=a[u])&&(f=e.call(d,d.__data__,u,a))&&("__data__"in d&&(f.__data__=d.__data__),l[u]=f,Ve(l[u],t,n,u,l,ce(d,n)));return new pe(i,this._parents,t,n)}function Oi(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Ct(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var c=o[a],l=c.length,d,f=0;f<l;++f)if(d=c[f]){for(var u=e.call(d,d.__data__,f,c),h,p=ce(d,n),x=0,b=u.length;x<b;++x)(h=u[x])&&Ve(h,t,n,x,u,p);i.push(u),s.push(d)}return new pe(i,s,t,n)}var gu=ze.prototype.constructor;function Pi(){return new gu(this._groups,this._parents)}function mu(e,t){var n,o,r;return function(){var i=Re(this,e),s=(this.style.removeProperty(e),Re(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function zi(e){return function(){this.style.removeProperty(e)}}function bu(e,t,n){var o,r=n+"",i;return function(){var s=Re(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function yu(e,t,n){var o,r,i;return function(){var s=Re(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Re(this,e))),s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a))}}function wu(e,t){var n,o,r,i="style."+t,s="end."+i,a;return function(){var c=fe(this,e),l=c.on,d=c.value[i]==null?a||(a=zi(t)):void 0;(l!==n||r!==d)&&(o=(n=l).copy()).on(s,r=d),c.on=o}}function Di(e,t,n){var o=(e+="")=="transform"?vr:sn;return t==null?this.styleTween(e,mu(e,o)).on("end.style."+e,zi(e)):typeof t=="function"?this.styleTween(e,yu(e,o,ut(this,"style."+e,t))).each(wu(this._id,e)):this.styleTween(e,bu(e,o,t),n).on("end.style."+e,null)}function xu(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function vu(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&xu(e,s,n)),o}return i._value=t,i}function Ai(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,vu(e,t,n??""))}function ku(e){return function(){this.textContent=e}}function _u(e){return function(){var t=e(this);this.textContent=t??""}}function Ti(e){return this.tween("text",typeof e=="function"?_u(ut(this,"text",e)):ku(e==null?"":e+""))}function Eu(e){return function(t){this.textContent=e.call(this,t)}}function Nu(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Eu(r)),t}return o._value=e,o}function Li(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,Nu(e))}function Ri(){for(var e=this._name,t=this._id,n=an(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var d=ce(c,t);Ve(c,e,n,l,s,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new pe(o,this._parents,e,n)}function $i(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},c={value:function(){--r===0&&i()}};n.each(function(){var l=fe(this,o),d=l.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),r===0&&i()})}var Su=0;function pe(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Vi(e){return ze().transition(e)}function an(){return++Su}var De=ze.prototype;pe.prototype=Vi.prototype={constructor:pe,select:Ii,selectAll:Oi,selectChild:De.selectChild,selectChildren:De.selectChildren,filter:Ni,merge:Si,selection:Pi,transition:Ri,call:De.call,nodes:De.nodes,node:De.node,size:De.size,empty:De.empty,each:De.each,on:Ci,attr:wi,attrTween:xi,style:Di,styleTween:Ai,text:Ti,textTween:Li,remove:Mi,tween:yi,delay:vi,duration:ki,ease:_i,easeVarying:Ei,end:$i,[Symbol.iterator]:De[Symbol.iterator]};function ln(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Cu={time:null,delay:0,duration:250,ease:ln};function Mu(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 Hi(e){var t,n;e instanceof pe?(t=e._id,e=e._name):(t=an(),(n=Cu).time=_r(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&Ve(c,e,t,l,s,n||Mu(c,t));return new pe(o,this._parents,e,t)}ze.prototype.interrupt=bi;ze.prototype.transition=Hi;var Lt=e=>()=>e;function eo(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){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:o,enumerable:!0,configurable:!0},_:{value:r}})}function xe(e,t,n){this.k=e,this.x=t,this.y=n}xe.prototype={constructor:xe,scale:function(e){return e===1?this:new xe(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new xe(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 Je=new xe(1,0,0);Rt.prototype=xe.prototype;function Rt(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Je;return e.__zoom}function cn(e){e.stopImmediatePropagation()}function ft(e){e.preventDefault(),e.stopImmediatePropagation()}function Iu(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Ou(){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 Bi(){return this.__zoom||Je}function Pu(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function zu(){return navigator.maxTouchPoints||"ontouchstart"in this}function Du(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function dn(){var e=Iu,t=Ou,n=Du,o=Pu,r=zu,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=dt,l=ct("start","zoom","end"),d,f,u,h=500,p=150,x=0,b=10;function m(y){y.property("__zoom",Bi).on("wheel.zoom",M,{passive:!1}).on("mousedown.zoom",I).on("dblclick.zoom",V).filter(r).on("touchstart.zoom",P).on("touchmove.zoom",L).on("touchend.zoom touchcancel.zoom",S).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(y,k,N,O){var A=y.selection?y.selection():y;A.property("__zoom",Bi),y!==A?_(y,k,N,O):A.interrupt().each(function(){E(this,arguments).event(O).start().zoom(null,typeof k=="function"?k.apply(this,arguments):k).end()})},m.scaleBy=function(y,k,N,O){m.scaleTo(y,function(){var A=this.__zoom.k,T=typeof k=="function"?k.apply(this,arguments):k;return A*T},N,O)},m.scaleTo=function(y,k,N,O){m.transform(y,function(){var A=t.apply(this,arguments),T=this.__zoom,B=N==null?w(A):typeof N=="function"?N.apply(this,arguments):N,H=T.invert(B),F=typeof k=="function"?k.apply(this,arguments):k;return n(g(v(T,F),B,H),A,s)},N,O)},m.translateBy=function(y,k,N,O){m.transform(y,function(){return n(this.__zoom.translate(typeof k=="function"?k.apply(this,arguments):k,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),s)},null,O)},m.translateTo=function(y,k,N,O,A){m.transform(y,function(){var T=t.apply(this,arguments),B=this.__zoom,H=O==null?w(T):typeof O=="function"?O.apply(this,arguments):O;return n(Je.translate(H[0],H[1]).scale(B.k).translate(typeof k=="function"?-k.apply(this,arguments):-k,typeof N=="function"?-N.apply(this,arguments):-N),T,s)},O,A)};function v(y,k){return k=Math.max(i[0],Math.min(i[1],k)),k===y.k?y:new xe(k,y.x,y.y)}function g(y,k,N){var O=k[0]-N[0]*y.k,A=k[1]-N[1]*y.k;return O===y.x&&A===y.y?y:new xe(y.k,O,A)}function w(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function _(y,k,N,O){y.on("start.zoom",function(){E(this,arguments).event(O).start()}).on("interrupt.zoom end.zoom",function(){E(this,arguments).event(O).end()}).tween("zoom",function(){var A=this,T=arguments,B=E(A,T).event(O),H=t.apply(A,T),F=N==null?w(H):typeof N=="function"?N.apply(A,T):N,q=Math.max(H[1][0]-H[0][0],H[1][1]-H[0][1]),Y=A.__zoom,K=typeof k=="function"?k.apply(A,T):k,ee=c(Y.invert(F).concat(q/Y.k),K.invert(F).concat(q/K.k));return function(W){if(W===1)W=K;else{var $=ee(W),X=q/$[2];W=new xe(X,F[0]-$[0]*X,F[1]-$[1]*X)}B.zoom(null,W)}})}function E(y,k,N){return!N&&y.__zooming||new C(y,k)}function C(y,k){this.that=y,this.args=k,this.active=0,this.sourceEvent=null,this.extent=t.apply(y,k),this.taps=0}C.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,k){return this.mouse&&y!=="mouse"&&(this.mouse[1]=k.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=k.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=k.invert(this.touch1[0])),this.that.__zoom=k,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(y){var k=de(this.that).datum();l.call(y,this.that,new eo(y,{sourceEvent:this.sourceEvent,target:m,type:y,transform:this.that.__zoom,dispatch:l}),k)}};function M(y,...k){if(!e.apply(this,arguments))return;var N=E(this,k).event(y),O=this.__zoom,A=Math.max(i[0],Math.min(i[1],O.k*Math.pow(2,o.apply(this,arguments)))),T=he(y);if(N.wheel)(N.mouse[0][0]!==T[0]||N.mouse[0][1]!==T[1])&&(N.mouse[1]=O.invert(N.mouse[0]=T)),clearTimeout(N.wheel);else{if(O.k===A)return;N.mouse=[T,O.invert(T)],Qe(this),N.start()}ft(y),N.wheel=setTimeout(B,p),N.zoom("mouse",n(g(v(O,A),N.mouse[0],N.mouse[1]),N.extent,s));function B(){N.wheel=null,N.end()}}function I(y,...k){if(u||!e.apply(this,arguments))return;var N=y.currentTarget,O=E(this,k,!0).event(y),A=de(y.view).on("mousemove.zoom",F,!0).on("mouseup.zoom",q,!0),T=he(y,N),B=y.clientX,H=y.clientY;Ot(y.view),cn(y),O.mouse=[T,this.__zoom.invert(T)],Qe(this),O.start();function F(Y){if(ft(Y),!O.moved){var K=Y.clientX-B,ee=Y.clientY-H;O.moved=K*K+ee*ee>x}O.event(Y).zoom("mouse",n(g(O.that.__zoom,O.mouse[0]=he(Y,N),O.mouse[1]),O.extent,s))}function q(Y){A.on("mousemove.zoom mouseup.zoom",null),Pt(Y.view,O.moved),ft(Y),O.event(Y).end()}}function V(y,...k){if(e.apply(this,arguments)){var N=this.__zoom,O=he(y.changedTouches?y.changedTouches[0]:y,this),A=N.invert(O),T=N.k*(y.shiftKey?.5:2),B=n(g(v(N,T),O,A),t.apply(this,k),s);ft(y),a>0?de(this).transition().duration(a).call(_,B,O,y):de(this).call(m.transform,B,O,y)}}function P(y,...k){if(e.apply(this,arguments)){var N=y.touches,O=N.length,A=E(this,k,y.changedTouches.length===O).event(y),T,B,H,F;for(cn(y),B=0;B<O;++B)H=N[B],F=he(H,this),F=[F,this.__zoom.invert(F),H.identifier],A.touch0?!A.touch1&&A.touch0[2]!==F[2]&&(A.touch1=F,A.taps=0):(A.touch0=F,T=!0,A.taps=1+!!d);d&&(d=clearTimeout(d)),T&&(A.taps<2&&(f=F[0],d=setTimeout(function(){d=null},h)),Qe(this),A.start())}}function L(y,...k){if(this.__zooming){var N=E(this,k).event(y),O=y.changedTouches,A=O.length,T,B,H,F;for(ft(y),T=0;T<A;++T)B=O[T],H=he(B,this),N.touch0&&N.touch0[2]===B.identifier?N.touch0[0]=H:N.touch1&&N.touch1[2]===B.identifier&&(N.touch1[0]=H);if(B=N.that.__zoom,N.touch1){var q=N.touch0[0],Y=N.touch0[1],K=N.touch1[0],ee=N.touch1[1],W=(W=K[0]-q[0])*W+(W=K[1]-q[1])*W,$=($=ee[0]-Y[0])*$+($=ee[1]-Y[1])*$;B=v(B,Math.sqrt(W/$)),H=[(q[0]+K[0])/2,(q[1]+K[1])/2],F=[(Y[0]+ee[0])/2,(Y[1]+ee[1])/2]}else if(N.touch0)H=N.touch0[0],F=N.touch0[1];else return;N.zoom("touch",n(g(B,H,F),N.extent,s))}}function S(y,...k){if(this.__zooming){var N=E(this,k).event(y),O=y.changedTouches,A=O.length,T,B;for(cn(y),u&&clearTimeout(u),u=setTimeout(function(){u=null},h),T=0;T<A;++T)B=O[T],N.touch0&&N.touch0[2]===B.identifier?delete N.touch0:N.touch1&&N.touch1[2]===B.identifier&&delete N.touch1;if(N.touch1&&!N.touch0&&(N.touch0=N.touch1,delete N.touch1),N.touch0)N.touch0[1]=this.__zoom.invert(N.touch0[0]);else if(N.end(),N.taps===2&&(B=he(B,this),Math.hypot(f[0]-B[0],f[1]-B[1])<b)){var H=de(this).on("dblclick.zoom");H&&H.apply(this,arguments)}}}return m.wheelDelta=function(y){return arguments.length?(o=typeof y=="function"?y:Lt(+y),m):o},m.filter=function(y){return arguments.length?(e=typeof y=="function"?y:Lt(!!y),m):e},m.touchable=function(y){return arguments.length?(r=typeof y=="function"?y:Lt(!!y),m):r},m.extent=function(y){return arguments.length?(t=typeof y=="function"?y:Lt([[+y[0][0],+y[0][1]],[+y[1][0],+y[1][1]]]),m):t},m.scaleExtent=function(y){return arguments.length?(i[0]=+y[0],i[1]=+y[1],m):[i[0],i[1]]},m.translateExtent=function(y){return arguments.length?(s[0][0]=+y[0][0],s[1][0]=+y[1][0],s[0][1]=+y[0][1],s[1][1]=+y[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(y){return arguments.length?(n=y,m):n},m.duration=function(y){return arguments.length?(a=+y,m):a},m.interpolate=function(y){return arguments.length?(c=y,m):c},m.on=function(){var y=l.on.apply(l,arguments);return y===l?m:y},m.clickDistance=function(y){return arguments.length?(x=(y=+y)*y,m):Math.sqrt(x)},m.tapDistance=function(y){return arguments.length?(b=+y,m):b},m}var ge={error001:(e="react")=>`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} 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:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:o}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},mt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],io=["Enter"," ","Escape"],so={"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"},Ye;(function(e){e.Strict="strict",e.Loose="loose"})(Ye||(Ye={}));var Ae;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Ae||(Ae={}));var et;(function(e){e.Partial="partial",e.Full="full"})(et||(et={}));var ao={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},_e;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(_e||(_e={}));var pt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(pt||(pt={}));var j;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(j||(j={}));var Fi={[j.Left]:j.Right,[j.Right]:j.Left,[j.Top]:j.Bottom,[j.Bottom]:j.Top},lo=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,ts=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),co=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e);var Vt=(e,t=[0,0])=>{let{width:n,height:o}=ye(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},uo=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let n=!1,o=e.reduce((r,i)=>{let s=typeof i=="string",a=!t.nodeLookup&&!s?i:void 0;return t.nodeLookup&&(a=s?t.nodeLookup.get(i):co(i)?i:t.nodeLookup.get(i.id)),a?(n=!0,mn(r,hn(a,t.nodeOrigin))):r},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?bn(o):{x:0,y:0,width:0,height:0}},bt=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=mn(n,hn(r)),o=!0)}),o?bn(n):{x:0,y:0,width:0,height:0}},pn=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{let a=(t.x-n)/r,c=(t.y-o)/r,l=t.width/r,d=t.height/r,f=[];for(let u of e.values()){let{measured:h,selectable:p=!0,hidden:x=!1}=u;if(s&&!p||x)continue;let b=h.width??u.width??u.initialWidth??0,m=h.height??u.height??u.initialHeight??0,{x:v,y:g}=u.internals.positionAbsolute,w=ss(a,c,l,d,v,g,b,m),_=b*m,E=i&&w>0;(!u.internals.handleBounds||E||w>=_||u.dragging)&&f.push(u)}return f},ns=(e,t)=>{let n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function Au(e,t){let n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{let i;if(t?.includeHiddenNodes){let{width:s,height:a}=ye(r);i=s>0&&a>0}else i=!!(r.measured.width&&r.measured.height&&!r.hidden);i&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function os({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return!0;let a=Au(e,s),c=bt(a),l=Bt(c,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(l,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),!0}function fo({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){let s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:c,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},d=s.origin??o,f=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i?.("005",ge.error005());else{let{width:h,height:p}=ye(a);h&&p&&(f=[[c,l],[c+h,l+p]])}else a&&ot(s.extent)&&(f=[[s.extent[0][0]+c,s.extent[0][1]+l],[s.extent[1][0]+c,s.extent[1][1]+l]]);let u=ot(f)?tt(t,f,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",ge.error015()),{position:{x:u.x-c+(s.measured.width??0)*d[0],y:u.y-l+(s.measured.height??0)*d[1]},positionAbsolute:u}}async function rs({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){let i=new Set(e.map(u=>u.id)),s=[];for(let u of n){if(u.deletable===!1)continue;let h=i.has(u.id),p=!h&&u.parentId&&s.find(x=>x.id===u.parentId);(h||p)&&s.push(u)}let a=new Set(t.map(u=>u.id)),c=o.filter(u=>u.deletable!==!1),d=ns(s,c);for(let u of c)a.has(u.id)&&!d.find(p=>p.id===u.id)&&d.push(u);if(!r)return{edges:d,nodes:s};let f=await r({nodes:s,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:s}:{edges:[],nodes:[]}:f}var gt=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),tt=(e={x:0,y:0},t,n)=>({x:gt(e.x,t[0][0],t[1][0]-(n?.width??0)),y:gt(e.y,t[0][1],t[1][1]-(n?.height??0))});function is(e,t,n){let{width:o,height:r}=ye(n),{x:i,y:s}=n.internals.positionAbsolute;return tt(e,[[i,s],[i+o,s+r]],t)}var Yi=(e,t,n)=>e<t?gt(Math.abs(e-t),1,t)/t:e>n?-gt(Math.abs(e-n),1,t)/t:0,gn=(e,t,n=15,o=40)=>{let r=Yi(e.x,o,t.width-o)*n,i=Yi(e.y,o,t.height-o)*n;return[r,i]},mn=(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)}),ro=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),bn=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),yt=(e,t=[0,0])=>{let{x:n,y:o}=co(e)?e.internals.positionAbsolute:Vt(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},hn=(e,t=[0,0])=>{let{x:n,y:o}=co(e)?e.internals.positionAbsolute:Vt(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},ho=(e,t)=>bn(mn(ro(e),ro(t))),ss=(e,t,n,o,r,i,s,a)=>{let c=Math.max(0,Math.min(e+n,r+s)-Math.max(e,r)),l=Math.max(0,Math.min(t+o,i+a)-Math.max(t,i));return Math.ceil(c*l)},Ht=(e,t)=>ss(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),po=e=>me(e.width)&&me(e.height)&&me(e.x)&&me(e.y),me=e=>!isNaN(e)&&isFinite(e),go=(e,t)=>(n,o)=>{},wt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),xt=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{let a={x:(e-n)/r,y:(t-o)/r};return i?wt(a,s):a},nt=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function ht(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){let 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 Tu(e,t,n){if(typeof e=="string"||typeof e=="number"){let o=ht(e,n),r=ht(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){let o=ht(e.top??e.y??0,n),r=ht(e.bottom??e.y??0,n),i=ht(e.left??e.x??0,t),s=ht(e.right??e.x??0,t);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Lu(e,t,n,o,r,i){let{x:s,y:a}=nt(e,[t,n,o]),{x:c,y:l}=nt({x:e.x+e.width,y:e.y+e.height},[t,n,o]),d=r-c,f=i-l;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(d),bottom:Math.floor(f)}}var Bt=(e,t,n,o,r,i)=>{let s=Tu(i,t,n),a=(t-s.x)/e.width,c=(n-s.y)/e.height,l=Math.min(a,c),d=gt(l,o,r),f=e.x+e.width/2,u=e.y+e.height/2,h=t/2-f*d,p=n/2-u*d,x=Lu(e,h,p,d,t,n),b={left:Math.min(x.left-s.left,0),top:Math.min(x.top-s.top,0),right:Math.min(x.right-s.right,0),bottom:Math.min(x.bottom-s.bottom,0)};return{x:h-b.left+b.right,y:p-b.top+b.bottom,zoom:d}},vt=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function ot(e){return e!=null&&e!=="parent"}function ye(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function yn(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function mo(e,t={width:0,height:0},n,o,r){let i={...e},s=o.get(n);if(s){let a=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}function bo(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function as(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function ls(e){return{...so,...e||{}}}function yo(e){return e===null?null:e?"valid":"invalid"}function $t(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){let{x:i,y:s}=be(e),a=xt({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:c,y:l}=n?wt(a,t):a;return{xSnapped:c,ySnapped:l,...a}}var wn=e=>({width:e.offsetWidth,height:e.offsetHeight}),wo=e=>e?.getRootNode?.()||window?.document,Ru=["INPUT","SELECT","TEXTAREA"];function xo(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Ru.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}var vo=e=>"clientX"in e,be=(e,t)=>{let n=vo(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},ji=(e,t,n,o,r)=>{let i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{let a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:r,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...wn(s)}})};function xn({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){let c=e*.125+r*.375+s*.375+n*.125,l=t*.125+i*.375+a*.375+o*.125,d=Math.abs(c-e),f=Math.abs(l-t);return[c,l,d,f]}function un(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Xi({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case j.Left:return[t-un(t-o,i),n];case j.Right:return[t+un(o-t,i),n];case j.Top:return[t,n-un(n-r,i)];case j.Bottom:return[t,n+un(r-n,i)]}}function vn({sourceX:e,sourceY:t,sourcePosition:n=j.Bottom,targetX:o,targetY:r,targetPosition:i=j.Top,curvature:s=.25}){let[a,c]=Xi({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[l,d]=Xi({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[f,u,h,p]=xn({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:d});return[`M${e},${t} C${a},${c} ${l},${d} ${o},${r}`,f,u,h,p]}function ko({sourceX:e,sourceY:t,targetX:n,targetY:o}){let r=Math.abs(n-e)/2,i=n<e?n+r:n-r,s=Math.abs(o-t)/2,a=o<t?o+s:o-s;return[i,a,r,s]}function cs({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){if(i==="manual")return o;let s=r&&n?o+1e3:o,a=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return s+a}function ds({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){let i=mn(hn(e),hn(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);let s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return Ht(s,bn(i))>0}var $u=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Vu=(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)),us=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.("006",ge.error006()),t;let o=n.getEdgeId||$u,r;return lo(e)?r={...e}:r={...e,id:o(e)},Vu(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function kn({sourceX:e,sourceY:t,targetX:n,targetY:o}){let[r,i,s,a]=ko({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}var Zi={[j.Left]:{x:-1,y:0},[j.Right]:{x:1,y:0},[j.Top]:{x:0,y:-1},[j.Bottom]:{x:0,y:1}},Hu=({source:e,sourcePosition:t=j.Bottom,target:n})=>t===j.Left||t===j.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},Wi=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Bu({source:e,sourcePosition:t=j.Bottom,target:n,targetPosition:o=j.Top,center:r,offset:i,stepPosition:s}){let a=Zi[t],c=Zi[o],l={x:e.x+a.x*i,y:e.y+a.y*i},d={x:n.x+c.x*i,y:n.y+c.y*i},f=Hu({source:l,sourcePosition:t,target:d}),u=f.x!==0?"x":"y",h=f[u],p=[],x,b,m={x:0,y:0},v={x:0,y:0},[,,g,w]=ko({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[u]*c[u]===-1){u==="x"?(x=r.x??l.x+(d.x-l.x)*s,b=r.y??(l.y+d.y)/2):(x=r.x??(l.x+d.x)/2,b=r.y??l.y+(d.y-l.y)*s);let M=[{x,y:l.y},{x,y:d.y}],I=[{x:l.x,y:b},{x:d.x,y:b}];a[u]===h?p=u==="x"?M:I:p=u==="x"?I:M}else{let M=[{x:l.x,y:d.y}],I=[{x:d.x,y:l.y}];if(u==="x"?p=a.x===h?I:M:p=a.y===h?M:I,t===o){let y=Math.abs(e[u]-n[u]);if(y<=i){let k=Math.min(i-1,i-y);a[u]===h?m[u]=(l[u]>e[u]?-1:1)*k:v[u]=(d[u]>n[u]?-1:1)*k}}if(t!==o){let y=u==="x"?"y":"x",k=a[u]===c[y],N=l[y]>d[y],O=l[y]<d[y];(a[u]===1&&(!k&&N||k&&O)||a[u]!==1&&(!k&&O||k&&N))&&(p=u==="x"?M:I)}let V={x:l.x+m.x,y:l.y+m.y},P={x:d.x+v.x,y:d.y+v.y},L=Math.max(Math.abs(V.x-p[0].x),Math.abs(P.x-p[0].x)),S=Math.max(Math.abs(V.y-p[0].y),Math.abs(P.y-p[0].y));L>=S?(x=(V.x+P.x)/2,b=p[0].y):(x=p[0].x,b=(V.y+P.y)/2)}let _={x:l.x+m.x,y:l.y+m.y},E={x:d.x+v.x,y:d.y+v.y};return[[e,..._.x!==p[0].x||_.y!==p[0].y?[_]:[],...p,...E.x!==p[p.length-1].x||E.y!==p[p.length-1].y?[E]:[],n],x,b,g,w]}function Fu(e,t,n,o){let r=Math.min(Wi(e,t)/2,Wi(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){let l=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${i+r*l},${s}Q ${i},${s} ${i},${s+r*d}`}let a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${s+r*c}Q ${i},${s} ${i+r*a},${s}`}function rt({sourceX:e,sourceY:t,sourcePosition:n=j.Bottom,targetX:o,targetY:r,targetPosition:i=j.Top,borderRadius:s=5,centerX:a,centerY:c,offset:l=20,stepPosition:d=.5}){let[f,u,h,p,x]=Bu({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:c},offset:l,stepPosition:d}),b=`M${f[0].x} ${f[0].y}`;for(let m=1;m<f.length-1;m++)b+=Fu(f[m-1],f[m],f[m+1],s);return b+=`L${f[f.length-1].x} ${f[f.length-1].y}`,[b,u,h,p,x]}function qi(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function fs(e){let{sourceNode:t,targetNode:n}=e;if(!qi(t)||!qi(n))return null;let o=t.internals.handleBounds||Ki(t.handles),r=n.internals.handleBounds||Ki(n.handles),i=Gi(o?.source??[],e.sourceHandle),s=Gi(e.connectionMode===Ye.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",ge.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let a=i?.position||j.Bottom,c=s?.position||j.Top,l=je(t,i,a),d=je(n,s,c);return{sourceX:l.x,sourceY:l.y,targetX:d.x,targetY:d.y,sourcePosition:a,targetPosition:c}}function Ki(e){if(!e)return null;let t=[],n=[];for(let o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&n.push(o);return{source:t,target:n}}function je(e,t,n=j.Left,o=!1){let r=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??ye(e);if(o)return{x:r+s/2,y:i+a/2};switch(t?.position??n){case j.Top:return{x:r+s/2,y:i};case j.Right:return{x:r+s,y:i+a/2};case j.Bottom:return{x:r+s/2,y:i+a};case j.Left:return{x:r,y:i+a/2}}}function Gi(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function _n(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function hs(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){let i=new Set;return e.reduce((s,a)=>([a.markerStart||o,a.markerEnd||r].forEach(c=>{if(c&&typeof c=="object"){let l=_n(c,t);i.has(l)||(s.push({id:l,color:c.color||n,...c}),i.add(l))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}var ps=1e3,Yu=10,_o={nodeOrigin:[0,0],nodeExtent:mt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},ju={..._o,checkEquality:!0};function Eo(e,t){let n={...e};for(let o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function gs(e,t,n){let o=Eo(_o,n);for(let r of e.values())if(r.parentId)So(r,e,t,o);else{let i=Vt(r,o.nodeOrigin),s=ot(r.extent)?r.extent:o.nodeExtent,a=tt(i,s,ye(r));r.internals.positionAbsolute=a}}function Xu(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],o=[];for(let r of e.handles){let i={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(i):r.type==="target"&&o.push(i)}return{source:n,target:o}}function No(e){return e==="manual"}function En(e,t,n,o={}){let r=Eo(ju,o),i={i:0},s=new Map(t),a=r?.elevateNodesOnSelect&&!No(r.zIndexMode)?ps:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let d of e){let f=s.get(d.id);if(r.checkEquality&&d===f?.internals.userNode)t.set(d.id,f);else{let u=Vt(d,r.nodeOrigin),h=ot(d.extent)?d.extent:r.nodeExtent,p=tt(u,h,ye(d));f={...r.defaults,...d,measured:{width:d.measured?.width,height:d.measured?.height},internals:{positionAbsolute:p,handleBounds:Xu(d,f),z:ms(d,a,r.zIndexMode),userNode:d}},t.set(d.id,f)}(f.measured===void 0||f.measured.width===void 0||f.measured.height===void 0)&&!f.hidden&&(c=!1),d.parentId&&So(f,t,n,o,i),l||=d.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function Zu(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function So(e,t,n,o,r){let{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:c}=Eo(_o,o),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}Zu(e,n),r&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++r.i,d.internals.z=d.internals.z+r.i*Yu),r&&d.internals.rootParentIndex!==void 0&&(r.i=d.internals.rootParentIndex);let f=i&&!No(c)?ps:0,{x:u,y:h,z:p}=Wu(e,d,s,a,f,c),{positionAbsolute:x}=e.internals,b=u!==x.x||h!==x.y;(b||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:b?{x:u,y:h}:x,z:p}})}function ms(e,t,n){let o=me(e.zIndex)?e.zIndex:0;return No(n)?o:o+(e.selected?t:0)}function Wu(e,t,n,o,r,i){let{x:s,y:a}=t.internals.positionAbsolute,c=ye(e),l=Vt(e,n),d=ot(e.extent)?tt(l,e.extent,c):l,f=tt({x:s+d.x,y:a+d.y},o,c);e.extent==="parent"&&(f=is(f,c,t));let u=ms(e,r,i),h=t.internals.z??0;return{x:f.x,y:f.y,z:h>=u?h+1:u}}function Nn(e,t,n,o=[0,0]){let r=[],i=new Map;for(let s of e){let a=t.get(s.parentId);if(!a)continue;let c=i.get(s.parentId)?.expandedRect??yt(a),l=ho(c,s.rect);i.set(s.parentId,{expandedRect:l,parent:a})}return i.size>0&&i.forEach(({expandedRect:s,parent:a},c)=>{let l=a.internals.positionAbsolute,d=ye(a),f=a.origin??o,u=s.x<l.x?Math.round(Math.abs(l.x-s.x)):0,h=s.y<l.y?Math.round(Math.abs(l.y-s.y)):0,p=Math.max(d.width,Math.round(s.width)),x=Math.max(d.height,Math.round(s.height)),b=(p-d.width)*f[0],m=(x-d.height)*f[1];(u>0||h>0||b||m)&&(r.push({id:c,type:"position",position:{x:a.position.x-u+b,y:a.position.y-h+m}}),n.get(c)?.forEach(v=>{e.some(g=>g.id===v.id)||r.push({id:v.id,type:"position",position:{x:v.position.x+u,y:v.position.y+h}})})),(d.width<s.width||d.height<s.height||u||h)&&r.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:p+(u?f[0]*u-b:0),height:x+(h?f[1]*h-m:0)}})}),r}function bs(e,t,n,o,r,i,s){let a=o?.querySelector(".xyflow__viewport"),c=!1;if(!a)return{changes:[],updatedInternals:c};let l=[],d=window.getComputedStyle(a),{m22:f}=new window.DOMMatrixReadOnly(d.transform),u=[];for(let h of e.values()){let 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}let x=wn(h.nodeElement),b=p.measured.width!==x.width||p.measured.height!==x.height;if(!!(x.width&&x.height&&(b||!p.internals.handleBounds||h.force))){let v=h.nodeElement.getBoundingClientRect(),g=ot(p.extent)?p.extent:i,{positionAbsolute:w}=p.internals;if(p.parentId&&p.extent==="parent"){let E=t.get(p.parentId);E&&(w=is(w,x,E))}else g&&(w=tt(w,g,x));let _={...p,measured:x,internals:{...p.internals,positionAbsolute:w,handleBounds:{source:ji("source",h.nodeElement,v,f,p.id),target:ji("target",h.nodeElement,v,f,p.id)}}};t.set(p.id,_),p.parentId&&So(_,t,n,{nodeOrigin:r,zIndexMode:s}),c=!0,b&&(l.push({id:p.id,type:"dimensions",dimensions:x}),p.expandParent&&p.parentId&&u.push({id:p.id,parentId:p.parentId,rect:yt(_,r)}))}}if(u.length>0){let h=Nn(u,t,n,r);l.push(...h)}return{changes:l,updatedInternals:c}}async function ys({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return!1;let s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o);return!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2])}function Ui(e,t,n,o,r,i){let s=r,a=o.get(s)||new Map;o.set(s,a.set(n,t)),s=`${r}-${e}`;let c=o.get(s)||new Map;if(o.set(s,c.set(n,t)),i){s=`${r}-${e}-${i}`;let l=o.get(s)||new Map;o.set(s,l.set(n,t))}}function Co(e,t,n){e.clear(),t.clear();for(let o of n){let{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,c={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},l=`${r}-${s}--${i}-${a}`,d=`${i}-${a}--${r}-${s}`;Ui("source",c,d,e,r,s),Ui("target",c,l,e,i,a),t.set(o.id,o)}}function ws(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:ws(n,t):!1}function Qi(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function qu(e,t,n,o){let r=new Map;for(let[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!ws(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){let a=e.get(i);a&&r.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function to({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){let r=[];for(let[s,a]of t){let c=n.get(s)?.internals.userNode;c&&r.push({...c,position:a.position,dragging:o})}if(!e)return[r[0],r];let i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function Ku({dragItems:e,snapGrid:t,x:n,y:o}){let r=e.values().next().value;if(!r)return null;let i={x:n-r.distance.x,y:o-r.distance.y},s=wt(i,t);return{x:s.x-i.x,y:s.y-i.y}}function xs({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,c=!1,l={x:0,y:0},d=null,f=!1,u=null,h=!1,p=!1,x=null;function b({noDragClassName:v,handleSelector:g,domNode:w,isSelectable:_,nodeId:E,nodeClickDistance:C=0}){u=de(w);function M({x:L,y:S}){let{nodeLookup:y,nodeExtent:k,snapGrid:N,snapToGrid:O,nodeOrigin:A,onNodeDrag:T,onSelectionDrag:B,onError:H,updateNodePositions:F}=t();i={x:L,y:S};let q=!1,Y=a.size>1,K=Y&&k?ro(bt(a)):null,ee=Y&&O?Ku({dragItems:a,snapGrid:N,x:L,y:S}):null;for(let[W,$]of a){if(!y.has(W))continue;let X={x:L-$.distance.x,y:S-$.distance.y};O&&(X=ee?{x:Math.round(X.x+ee.x),y:Math.round(X.y+ee.y)}:wt(X,N));let Q=null;if(Y&&k&&!$.extent&&K){let{positionAbsolute:G}=$.internals,te=G.x-K.x+k[0][0],ne=G.x+$.measured.width-K.x2+k[1][0],re=G.y-K.y+k[0][1],ue=G.y+$.measured.height-K.y2+k[1][1];Q=[[te,re],[ne,ue]]}let{position:U,positionAbsolute:Z}=fo({nodeId:W,nextPosition:X,nodeLookup:y,nodeExtent:Q||k,nodeOrigin:A,onError:H});q=q||$.position.x!==U.x||$.position.y!==U.y,$.position=U,$.internals.positionAbsolute=Z}if(p=p||q,!!q&&(F(a,!0),x&&(o||T||!E&&B))){let[W,$]=to({nodeId:E,dragItems:a,nodeLookup:y});o?.(x,a,W,$),T?.(x,W,$),E||B?.(x,$)}}async function I(){if(!d)return;let{transform:L,panBy:S,autoPanSpeed:y,autoPanOnNodeDrag:k}=t();if(!k){c=!1,cancelAnimationFrame(s);return}let[N,O]=gn(l,d,y);(N!==0||O!==0)&&(i.x=(i.x??0)-N/L[2],i.y=(i.y??0)-O/L[2],await S({x:N,y:O})&&M(i)),s=requestAnimationFrame(I)}function V(L){let{nodeLookup:S,multiSelectionActive:y,nodesDraggable:k,transform:N,snapGrid:O,snapToGrid:A,selectNodesOnDrag:T,onNodeDragStart:B,onSelectionDragStart:H,unselectNodesAndEdges:F}=t();f=!0,(!T||!_)&&!y&&E&&(S.get(E)?.selected||F()),_&&T&&E&&e?.(E);let q=$t(L.sourceEvent,{transform:N,snapGrid:O,snapToGrid:A,containerBounds:d});if(i=q,a=qu(S,k,q,E),a.size>0&&(n||B||!E&&H)){let[Y,K]=to({nodeId:E,dragItems:a,nodeLookup:S});n?.(L.sourceEvent,a,Y,K),B?.(L.sourceEvent,Y,K),E||H?.(L.sourceEvent,K)}}let P=tn().clickDistance(C).on("start",L=>{let{domNode:S,nodeDragThreshold:y,transform:k,snapGrid:N,snapToGrid:O}=t();d=S?.getBoundingClientRect()||null,h=!1,p=!1,x=L.sourceEvent,y===0&&V(L),i=$t(L.sourceEvent,{transform:k,snapGrid:N,snapToGrid:O,containerBounds:d}),l=be(L.sourceEvent,d)}).on("drag",L=>{let{autoPanOnNodeDrag:S,transform:y,snapGrid:k,snapToGrid:N,nodeDragThreshold:O,nodeLookup:A}=t(),T=$t(L.sourceEvent,{transform:y,snapGrid:k,snapToGrid:N,containerBounds:d});if(x=L.sourceEvent,(L.sourceEvent.type==="touchmove"&&L.sourceEvent.touches.length>1||E&&!A.has(E))&&(h=!0),!h){if(!c&&S&&f&&(c=!0,I()),!f){let B=be(L.sourceEvent,d),H=B.x-l.x,F=B.y-l.y;Math.sqrt(H*H+F*F)>O&&V(L)}(i.x!==T.xSnapped||i.y!==T.ySnapped)&&a&&f&&(l=be(L.sourceEvent,d),M(T))}}).on("end",L=>{if(!f||h){h&&a.size>0&&t().updateNodePositions(a,!1);return}if(c=!1,f=!1,cancelAnimationFrame(s),a.size>0){let{nodeLookup:S,updateNodePositions:y,onNodeDragStop:k,onSelectionDragStop:N}=t();if(p&&(y(a,!1),p=!1),r||k||!E&&N){let[O,A]=to({nodeId:E,dragItems:a,nodeLookup:S,dragging:!1});r?.(L.sourceEvent,a,O,A),k?.(L.sourceEvent,O,A),E||N?.(L.sourceEvent,A)}}}).filter(L=>{let S=L.target;return!L.button&&(!v||!Qi(S,`.${v}`,w))&&(!g||Qi(S,g,w))});u.call(P)}function m(){u?.on(".drag",null)}return{update:b,destroy:m}}function Gu(e,t,n){let o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let i of t.values())Ht(r,yt(i))>0&&o.push(i);return o}var Uu=250;function Qu(e,t,n,o){let r=[],i=1/0,s=Gu(e,n,t+Uu);for(let a of s){let c=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(let l of c){if(o.nodeId===l.nodeId&&o.type===l.type&&o.id===l.id)continue;let{x:d,y:f}=je(a,l,l.position,!0),u=Math.sqrt(Math.pow(d-e.x,2)+Math.pow(f-e.y,2));u>t||(u<i?(r=[{...l,x:d,y:f}],i=u):u===i&&r.push({...l,x:d,y:f}))}}if(!r.length)return null;if(r.length>1){let a=o.type==="source"?"target":"source";return r.find(c=>c.type===a)??r[0]}return r[0]}function vs(e,t,n,o,r,i=!1){let s=o.get(e);if(!s)return null;let a=r==="strict"?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],c=(n?a?.find(l=>l.id===n):a?.[0])??null;return c&&i?{...c,...je(s,c,c.position,!0)}:c}function ks(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function Ju(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var _s=()=>!0;function ef(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:c,lib:l,autoPanOnConnect:d,flowId:f,panBy:u,cancelConnection:h,onConnectStart:p,onConnect:x,onConnectEnd:b,isValidConnection:m=_s,onReconnectEnd:v,updateConnection:g,getTransform:w,getFromHandle:_,autoPanSpeed:E,dragThreshold:C=1,handleDomNode:M}){let I=wo(e.target),V=0,P,{x:L,y:S}=be(e),y=ks(i,M),k=a?.getBoundingClientRect(),N=!1;if(!k||!y)return;let O=vs(r,y,o,c,t);if(!O)return;let A=be(e,k),T=!1,B=null,H=!1,F=null;function q(){if(!d||!k)return;let[U,Z]=gn(A,k,E);u({x:U,y:Z}),V=requestAnimationFrame(q)}let Y={...O,nodeId:r,type:y,position:O.position},K=c.get(r),W={inProgress:!0,isValid:null,from:je(K,Y,j.Left,!0),fromHandle:Y,fromPosition:Y.position,fromNode:K,to:A,toHandle:null,toPosition:Fi[Y.position],toNode:null,pointer:A};function $(){N=!0,g(W),p?.(e,{nodeId:r,handleId:o,handleType:y})}C===0&&$();function X(U){if(!N){let{x:ue,y:Se}=be(U),ve=ue-L,ke=Se-S;if(!(ve*ve+ke*ke>C*C))return;$()}if(!_()||!Y){Q(U);return}let Z=w();A=be(U,k),P=Qu(xt(A,Z,!1,[1,1]),n,c,Y),T||(q(),T=!0);let G=Es(U,{handle:P,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:m,doc:I,lib:l,flowId:f,nodeLookup:c});F=G.handleDomNode,B=G.connection,H=Ju(!!P,G.isValid);let te=c.get(r),ne=te?je(te,Y,j.Left,!0):W.from,re={...W,from:ne,isValid:H,to:G.toHandle&&H?nt({x:G.toHandle.x,y:G.toHandle.y},Z):A,toHandle:G.toHandle,toPosition:H&&G.toHandle?G.toHandle.position:Fi[Y.position],toNode:G.toHandle?c.get(G.toHandle.nodeId):null,pointer:A};g(re),W=re}function Q(U){if(!("touches"in U&&U.touches.length>0)){if(N){(P||F)&&B&&H&&x?.(B);let{inProgress:Z,...G}=W,te={...G,toPosition:W.toHandle?W.toPosition:null};b?.(U,te),i&&v?.(U,te)}h(),cancelAnimationFrame(V),T=!1,H=!1,B=null,F=null,I.removeEventListener("mousemove",X),I.removeEventListener("mouseup",Q),I.removeEventListener("touchmove",X),I.removeEventListener("touchend",Q)}}I.addEventListener("mousemove",X),I.addEventListener("mouseup",Q),I.addEventListener("touchmove",X),I.addEventListener("touchend",Q)}function Es(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:l=_s,nodeLookup:d}){let f=i==="target",u=t?s.querySelector(`.${a}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:p}=be(e),x=s.elementFromPoint(h,p),b=x?.classList.contains(`${a}-flow__handle`)?x:u,m={handleDomNode:b,isValid:!1,connection:null,toHandle:null};if(b){let v=ks(void 0,b),g=b.getAttribute("data-nodeid"),w=b.getAttribute("data-handleid"),_=b.classList.contains("connectable"),E=b.classList.contains("connectableend");if(!g||!v)return m;let C={source:f?g:o,sourceHandle:f?w:r,target:f?o:g,targetHandle:f?r:w};m.connection=C;let I=_&&E&&(n===Ye.Strict?f&&v==="source"||!f&&v==="target":g!==o||w!==r);m.isValid=I&&l(C),m.toHandle=vs(g,v,w,d,n,!0)}return m}var Sn={onPointerDown:ef,isValid:Es};function Ns({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){let r=de(e);function i({translateExtent:a,width:c,height:l,zoomStep:d=1,pannable:f=!0,zoomable:u=!0,inversePan:h=!1}){let p=g=>{if(g.sourceEvent.type!=="wheel"||!t)return;let w=n(),_=g.sourceEvent.ctrlKey&&vt()?10:1,E=-g.sourceEvent.deltaY*(g.sourceEvent.deltaMode===1?.05:g.sourceEvent.deltaMode?1:.002)*d,C=w[2]*Math.pow(2,E*_);t.scaleTo(C)},x=[0,0],b=g=>{(g.sourceEvent.type==="mousedown"||g.sourceEvent.type==="touchstart")&&(x=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY])},m=g=>{let w=n();if(g.sourceEvent.type!=="mousemove"&&g.sourceEvent.type!=="touchmove"||!t)return;let _=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY],E=[_[0]-x[0],_[1]-x[1]];x=_;let C=o()*Math.max(w[2],Math.log(w[2]))*(h?-1:1),M={x:w[0]-E[0]*C,y:w[1]-E[1]*C},I=[[0,0],[c,l]];t.setViewportConstrained({x:M.x,y:M.y,zoom:w[2]},I,a)},v=dn().on("start",b).on("zoom",f?m:null).on("zoom.wheel",u?p:null);r.call(v,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:he}}var Cn=e=>({x:e.x,y:e.y,zoom:e.k}),no=({x:e,y:t,zoom:n})=>Je.translate(e,t).scale(n),Fe=(e,t)=>e.target.closest(`.${t}`),Ss=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),tf=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,oo=(e,t=0,n=tf,o=()=>{})=>{let r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Cs=e=>{let t=e.ctrlKey&&vt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function nf({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:l}){return d=>{if(Fe(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();let f=n.property("__zoom").k||1;if(d.ctrlKey&&s){let b=he(d),m=Cs(d),v=f*Math.pow(2,m);o.scaleTo(n,v,b,d);return}let u=d.deltaMode===1?20:1,h=r===Ae.Vertical?0:d.deltaX*u,p=r===Ae.Horizontal?0:d.deltaY*u;!vt()&&d.shiftKey&&r!==Ae.Vertical&&(h=d.deltaY*u,p=0),o.translateBy(n,-(h/f)*i,-(p/f)*i,{internal:!0});let x=Cn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c?.(d,x):(e.isPanScrolling=!0,a?.(d,x)),e.panScrollTimeout=setTimeout(()=>{l?.(d,x),e.isPanScrolling=!1},150)}}function of({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){let i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,a=Fe(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function rf({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;let r=Cn(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,r)}}function sf({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&Ss(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,Cn(i.transform))}}function af({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&Ss(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){let a=Cn(s.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,a)},n?150:0)}}}function lf({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:o,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:s,userSelectionActive:a,noWheelClassName:c,noPanClassName:l,lib:d,connectionInProgress:f}){return u=>{let h=t||n,p=o&&u.ctrlKey,x=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(Fe(u,`${d}-flow__node`)||Fe(u,`${d}-flow__edge`)||Fe(u,`${d}-flow__selection`)||Fe(u,`${d}-flow__nodesselection`)))return!0;if(!r&&!h&&!i&&!s&&!o||a||f&&!x||Fe(u,c)&&x||Fe(u,l)&&(!x||i&&x&&!t)||!o&&u.ctrlKey&&x)return!1;if(!o&&u.type==="touchstart"&&u.touches?.length>1)return u.preventDefault(),!1;if(!h&&!i&&!p&&x||!r&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(r)&&!r.includes(u.button)&&u.type==="mousedown")return!1;let b=Array.isArray(r)&&r.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||x||e)&&b}}function Ms({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),f=[[0,0],[d.width,d.height]];(typeof ResizeObserver<"u"?new ResizeObserver(S=>{let y=S[0];y&&(f=[[0,0],[y.contentRect.width,y.contentRect.height]])}):null)?.observe(e);let h=dn().extent(()=>f).scaleExtent([t,n]).translateExtent(o),p=de(e).call(h);w({x:r.x,y:r.y,zoom:gt(r.zoom,t,n)},[[0,0],[d.width,d.height]],o);let x=p.on("wheel.zoom"),b=p.on("dblclick.zoom");h.wheelDelta(Cs);async function m(S,y){return p?new Promise(k=>{h?.interpolate(y?.interpolate==="linear"?qt:dt).transform(oo(p,y?.duration,y?.ease,()=>k(!0)),S)}):!1}function v({noWheelClassName:S,noPanClassName:y,onPaneContextMenu:k,userSelectionActive:N,panOnScroll:O,panOnDrag:A,panOnScrollMode:T,panOnScrollSpeed:B,preventScrolling:H,zoomOnPinch:F,zoomOnScroll:q,zoomOnDoubleClick:Y,panActivationKeyPressed:K=!1,zoomActivationKeyPressed:ee,lib:W,onTransformChange:$,connectionInProgress:X,paneClickDistance:Q,selectionOnDrag:U}){N&&!l.isZoomingOrPanning&&g();let Z=O&&!ee&&!N;h.clickDistance(U?1/0:!me(Q)||Q<0?0:Q);let G=Z?nf({zoomPanValues:l,noWheelClassName:S,d3Selection:p,d3Zoom:h,panOnScrollMode:T,panOnScrollSpeed:B,zoomOnPinch:F,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):of({noWheelClassName:S,preventScrolling:H,d3ZoomHandler:x});p.on("wheel.zoom",G,{passive:!1});let te=rf({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:s});h.on("start",te);let ne=sf({zoomPanValues:l,panOnDrag:A,onPaneContextMenu:!!k,onPanZoom:i,onTransformChange:$});h.on("zoom",ne);let re=af({zoomPanValues:l,panOnDrag:A,panOnScroll:O,onPaneContextMenu:k,onPanZoomEnd:a,onDraggingChange:c});h.on("end",re);let ue=lf({panActivationKeyPressed:K,zoomActivationKeyPressed:ee,panOnDrag:A,zoomOnScroll:q,panOnScroll:O,zoomOnDoubleClick:Y,zoomOnPinch:F,userSelectionActive:N,noPanClassName:y,noWheelClassName:S,lib:W,connectionInProgress:X});h.filter(ue),Y?p.on("dblclick.zoom",b):p.on("dblclick.zoom",null)}function g(){h.on("zoom",null)}async function w(S,y,k){let N=no(S),O=h?.constrain()(N,y,k);return O&&await m(O),O}async function _(S,y){let k=no(S);return await m(k,y),k}function E(S){if(p){let y=no(S),k=p.property("__zoom");(k.k!==S.zoom||k.x!==S.x||k.y!==S.y)&&h?.transform(p,y,null,{sync:!0})}}function C(){let S=p?Rt(p.node()):{x:0,y:0,k:1};return{x:S.x,y:S.y,zoom:S.k}}async function M(S,y){return p?new Promise(k=>{h?.interpolate(y?.interpolate==="linear"?qt:dt).scaleTo(oo(p,y?.duration,y?.ease,()=>k(!0)),S)}):!1}async function I(S,y){return p?new Promise(k=>{h?.interpolate(y?.interpolate==="linear"?qt:dt).scaleBy(oo(p,y?.duration,y?.ease,()=>k(!0)),S)}):!1}function V(S){h?.scaleExtent(S)}function P(S){h?.translateExtent(S)}function L(S){let y=!me(S)||S<0?0:S;h?.clickDistance(y)}return{update:v,destroy:g,setViewport:_,setViewportConstrained:w,getViewport:C,scaleTo:M,scaleBy:I,setScaleExtent:V,setTranslateExtent:P,syncViewport:E,setClickDistance:L}}var Xe;(function(e){e.Line="line",e.Handle="handle"})(Xe||(Xe={}));function cf({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){let s=e-t,a=n-o,c=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(c[0]=c[0]*-1),a&&i&&(c[1]=c[1]*-1),c}function Ji(e){let t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function He(e,t){return Math.max(0,t-e)}function Be(e,t){return Math.max(0,e-t)}function fn(e,t,n){return Math.max(0,t-e,e-n)}function es(e,t){return e?!t:t}function df(e,t,n,o,r,i,s,a){let{affectsX:c,affectsY:l}=t,{isHorizontal:d,isVertical:f}=t,u=d&&f,{xSnapped:h,ySnapped:p}=n,{minWidth:x,maxWidth:b,minHeight:m,maxHeight:v}=o,{x:g,y:w,width:_,height:E,aspectRatio:C}=e,M=Math.floor(d?h-e.pointerX:0),I=Math.floor(f?p-e.pointerY:0),V=_+(c?-M:M),P=E+(l?-I:I),L=-i[0]*_,S=-i[1]*E,y=fn(V,x,b),k=fn(P,m,v);if(s){let A=0,T=0;c&&M<0?A=He(g+M+L,s[0][0]):!c&&M>0&&(A=Be(g+V+L,s[1][0])),l&&I<0?T=He(w+I+S,s[0][1]):!l&&I>0&&(T=Be(w+P+S,s[1][1])),y=Math.max(y,A),k=Math.max(k,T)}if(a){let A=0,T=0;c&&M>0?A=Be(g+M,a[0][0]):!c&&M<0&&(A=He(g+V,a[1][0])),l&&I>0?T=Be(w+I,a[0][1]):!l&&I<0&&(T=He(w+P,a[1][1])),y=Math.max(y,A),k=Math.max(k,T)}if(r){if(d){let A=fn(V/C,m,v)*C;if(y=Math.max(y,A),s){let T=0;!c&&!l||c&&!l&&u?T=Be(w+S+V/C,s[1][1])*C:T=He(w+S+(c?M:-M)/C,s[0][1])*C,y=Math.max(y,T)}if(a){let T=0;!c&&!l||c&&!l&&u?T=He(w+V/C,a[1][1])*C:T=Be(w+(c?M:-M)/C,a[0][1])*C,y=Math.max(y,T)}}if(f){let A=fn(P*C,x,b)/C;if(k=Math.max(k,A),s){let T=0;!c&&!l||l&&!c&&u?T=Be(g+P*C+L,s[1][0])/C:T=He(g+(l?I:-I)*C+L,s[0][0])/C,k=Math.max(k,T)}if(a){let T=0;!c&&!l||l&&!c&&u?T=He(g+P*C,a[1][0])/C:T=Be(g+(l?I:-I)*C,a[0][0])/C,k=Math.max(k,T)}}}I=I+(I<0?k:-k),M=M+(M<0?y:-y),r&&(u?V>P*C?I=(es(c,l)?-M:M)/C:M=(es(c,l)?-I:I)*C:d?(I=M/C,l=c):(M=I*C,c=l));let N=c?g+M:g,O=l?w+I:w;return{width:_+(c?-M:M),height:E+(l?-I:I),x:i[0]*M*(c?-1:1)+N,y:i[1]*I*(l?-1:1)+O}}var Is={width:0,height:0,x:0,y:0},uf={...Is,pointerX:0,pointerY:0,aspectRatio:1};function ff(e,t,n){let o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,c=n[1]*s;return[[o-a,r-c],[o+i-a,r+s-c]]}function Os({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){let i=de(e),s={controlDirection:Ji("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:f,resizeDirection:u,onResizeStart:h,onResize:p,onResizeEnd:x,shouldResize:b}){let m={...Is},v={...uf};s={boundaries:d,resizeDirection:u,keepAspectRatio:f,controlDirection:Ji(l)};let g,w=null,_=[],E,C,M,I=tn().on("start",V=>{let{nodeLookup:P,transform:L,snapGrid:S,snapToGrid:y,nodeOrigin:k,paneDomNode:N}=n();if(g=P.get(t),!g)return;w=N?.getBoundingClientRect()??null;let{xSnapped:O,ySnapped:A}=$t(V.sourceEvent,{transform:L,snapGrid:S,snapToGrid:y,containerBounds:w});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},v={...m,pointerX:O,pointerY:A,aspectRatio:m.width/m.height},E=void 0,C=ot(g.extent)?g.extent:void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(E=P.get(g.parentId)),E&&g.extent==="parent"&&(C=[[0,0],[E.measured.width,E.measured.height]]),_=[],M=void 0;for(let[T,B]of P)if(B.parentId===t&&(_.push({id:T,position:{...B.position},extent:B.extent}),B.extent==="parent"||B.expandParent)){let H=ff(B,g,B.origin??k);M?M=[[Math.min(H[0][0],M[0][0]),Math.min(H[0][1],M[0][1])],[Math.max(H[1][0],M[1][0]),Math.max(H[1][1],M[1][1])]]:M=H}h?.(V,{...m})}).on("drag",V=>{let{transform:P,snapGrid:L,snapToGrid:S,nodeOrigin:y}=n(),k=$t(V.sourceEvent,{transform:P,snapGrid:L,snapToGrid:S,containerBounds:w}),N=[];if(!g)return;let{x:O,y:A,width:T,height:B}=m,H={},F=g.origin??y,{width:q,height:Y,x:K,y:ee}=df(v,s.controlDirection,k,s.boundaries,s.keepAspectRatio,F,C,M),W=q!==T,$=Y!==B,X=K!==O&&W,Q=ee!==A&&$;if(!X&&!Q&&!W&&!$)return;let U={prevValues:{...m},startX:v.x,startY:v.y,childNodes:_.map(ne=>({...ne,position:{...ne.position}}))};if((X||Q||F[0]===1||F[1]===1)&&(H.x=X?K:m.x,H.y=Q?ee:m.y,m.x=H.x,m.y=H.y,_.length>0)){let ne=K-O,re=ee-A;for(let ue of _)ue.position={x:ue.position.x-ne+F[0]*(q-T),y:ue.position.y-re+F[1]*(Y-B)},N.push(ue)}if((W||$)&&(H.width=W&&(!s.resizeDirection||s.resizeDirection==="horizontal")?q:m.width,H.height=$&&(!s.resizeDirection||s.resizeDirection==="vertical")?Y:m.height,m.width=H.width,m.height=H.height),E&&g.expandParent){let ne=F[0]*(H.width??0);H.x&&H.x<ne&&(m.x=ne,v.x=v.x-(H.x-ne));let re=F[1]*(H.height??0);H.y&&H.y<re&&(m.y=re,v.y=v.y-(H.y-re))}let Z=cf({width:m.width,prevWidth:T,height:m.height,prevHeight:B,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),G={...m,direction:Z};if(b?.(V,G)===!1){m=U.prevValues,v.x=U.startX,v.y=U.startY,_.forEach((ne,re)=>{ne.position=U.childNodes[re].position});return}p?.(V,G),o(H,N)}).on("end",V=>{x?.(V,{...m}),r?.({...m})});i.call(I)}function c(){i.on(".drag",null)}return{update:a,destroy:c}}var As=Le(Xn(),1),Ts=Le(jc(),1);var Ps=e=>{let t,n=new Set,o=(d,f)=>{let u=typeof d=="function"?d(t):d;if(!Object.is(u,t)){let h=t;t=f??(typeof u!="object"||u===null)?u:Object.assign({},t,u),n.forEach(p=>p(t,h))}},r=()=>t,c={setState:o,getState:r,getInitialState:()=>l,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(import.meta.env?import.meta.env.MODE:void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},l=t=e(o,r,c);return c},zs=e=>e?Ps(e):Ps;var{useDebugValue:hf}=As.default,{useSyncExternalStoreWithSelector:pf}=Ts.default,gf=e=>e;function Mo(e,t=gf,n){let o=pf(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return hf(o),o}var Ds=(e,t)=>{let n=zs(e),o=(r,i=t)=>Mo(n,r,i);return Object.assign(o,n),o},Ls=(e,t)=>e?Ds(e,t):Ds;function ie(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let o of e)if(!t.has(o))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}var mf=Le(Yc()),Pn=(0,D.createContext)(null),bf=Pn.Provider,ca=ge.error001("react");function J(e,t){let n=(0,D.useContext)(Pn);if(n===null)throw new Error(ca);return Mo(n,e,t)}function se(){let e=(0,D.useContext)(Pn);if(e===null)throw new Error(ca);return(0,D.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var Rs={display:"none"},yf={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},da="react-flow__node-desc",ua="react-flow__edge-desc",wf="react-flow__aria-live",xf=e=>e.ariaLiveMessage,vf=e=>e.ariaLabelConfig;function kf({rfId:e}){let t=J(xf);return(0,z.jsx)("div",{id:`${wf}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:yf,children:t})}function _f({rfId:e,disableKeyboardA11y:t}){let n=J(vf);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("div",{id:`${da}-${e}`,style:Rs,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),(0,z.jsx)("div",{id:`${ua}-${e}`,style:Rs,children:n["edge.a11yDescription.default"]}),!t&&(0,z.jsx)(kf,{rfId:e})]})}var zn=(0,D.forwardRef)(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{let s=`${e}`.split("-");return(0,z.jsx)("div",{className:ae(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});zn.displayName="Panel";var $s="https://reactflow.dev?utm_source=attribution";function Ef({proOptions:e,position:t="bottom-right"}){return(0,D.useEffect)(()=>{},[]),e?.hideAttribution?null:(0,z.jsx)(zn,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${$s}`,children:(0,z.jsx)("a",{href:$s,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}var Nf=e=>{let t=[],n=[];for(let[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(let[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},Mn=e=>e.id;function Sf(e,t){return ie(e.selectedNodes.map(Mn),t.selectedNodes.map(Mn))&&ie(e.selectedEdges.map(Mn),t.selectedEdges.map(Mn))}function Cf({onSelectionChange:e}){let t=se(),{selectedNodes:n,selectedEdges:o}=J(Nf,Sf);return(0,D.useEffect)(()=>{let r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}var Mf=e=>!!e.onSelectionChangeHandlers;function If({onSelectionChange:e}){let t=J(Mf);return e||t?(0,z.jsx)(Cf,{onSelectionChange:e}):null}var fa=[0,0],Of={x:0,y:0,zoom:1},Pf=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],Vs=[...Pf,"rfId"],zf=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),Hs={translateExtent:mt,nodeOrigin:fa,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Df(e){let{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:c}=J(zf,ie),l=se();(0,D.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=Hs,a()}),[]);let d=(0,D.useRef)(Hs);return(0,D.useEffect)(()=>{for(let f of Vs){let u=e[f],h=d.current[f];u!==h&&(typeof e[f]>"u"||(f==="nodes"?t(u):f==="edges"?n(u):f==="minZoom"?o(u):f==="maxZoom"?r(u):f==="translateExtent"?i(u):f==="nodeExtent"?s(u):f==="ariaLabelConfig"?l.setState({ariaLabelConfig:ls(u)}):f==="fitView"?l.setState({fitViewQueued:u}):f==="fitViewOptions"?l.setState({fitViewOptions:u}):l.setState({[f]:u})))}d.current=e},Vs.map(f=>e[f])),null}function Bs(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Af(e){let[t,n]=(0,D.useState)(e==="system"?null:e);return(0,D.useEffect)(()=>{if(e!=="system"){n(e);return}let o=Bs(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:Bs()?.matches?"dark":"light"}var Fs=typeof document<"u"?document:null;function Ft(e=null,t={target:Fs,actInsideInputWithModifier:!0}){let[n,o]=(0,D.useState)(!1),r=(0,D.useRef)(!1),i=(0,D.useRef)(new Set([])),[s,a]=(0,D.useMemo)(()=>{if(e!==null){let l=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace(/\+/g,`
|
|
2
2
|
`).replace(`
|
|
3
3
|
|
|
4
4
|
`,`
|
|
@@ -9,4 +9,4 @@ import{a as ct,b as Wn,e as qn,g as wr,h as xr,i as qt,j as vr,k as kr,l as dt,o
|
|
|
9
9
|
`);var R=Le(Zn(),1),Qm={request:"kind.request",skill:"kind.skill",decision:"kind.decision",reference:"kind.reference",query:"kind.query",result:"kind.result"},Zt={ok:"state.ok",warn:"state.warn",bad:"state.bad",idle:"state.idle",active:"state.active"},Hn=176,Bn=72;function Xt(e){return e.initialJourney&&e.journeys?.length?{kind:"journey",id:e.initialJourney,step:0}:e.stages?.length?{kind:"stage",index:Math.max(0,e.stages.findIndex(t=>t.id===e.initialStage))}:{kind:"none"}}function $l(e,t){if(t.kind==="journey"){let n=e.journeys?.find(o=>o.id===t.id);return n?{...t,step:Math.min(Math.max(t.step,0),n.steps.length-1)}:Xt({...e,initialJourney:void 0})}return t.kind==="stage"?e.stages?.length?{kind:"stage",index:Math.min(Math.max(t.index,0),e.stages.length-1)}:{kind:"none"}:t}function Jm(e,t){let n=$l(e,t),o=new Map,r=new Map;if(n.kind==="journey"){let i=e.journeys.find(l=>l.id===n.id),s=fr(e,i),a=i.steps.slice(0,n.step+1);for(let l of e.nodes)o.set(l.id,{dim:!0});a.forEach((l,d)=>{let f=o.get(l.node);f.dim=!1,f.badges=[...f.badges??[],d+1]});let c=i.steps[n.step].node;o.get(c).current=!0;for(let l of e.edges)r.set(l.id,{dim:!0});return s.slice(0,n.step+1).forEach((l,d)=>{l&&r.set(l,{traversed:!0,flowing:!0,current:d===n.step})}),{nodes:o,edges:r,current:c}}if(n.kind==="stage"){let i=e.stages[n.index];for(let[s,a]of Object.entries(i.nodes??{}))o.set(s,{state:a.state,note:a.note});for(let[s,a]of Object.entries(i.edges??{}))r.set(s,{state:a.state,label:a.label,flowing:a.state==="bad"||a.state==="active"})}return{nodes:o,edges:r}}var eb=["bad","warn","active","ok","idle"];function tb(e){let t=new Set(Object.values(e.nodes??{}).map(n=>n.state));return eb.find(n=>t.has(n))}var Vl=(0,oe.createContext)(new Map);function nb({id:e,data:t,selected:n}){let o=Oe(Te),r=(0,oe.useContext)(Vl).get(e),i=t.direction==="LR",s=["sf-node",`sf-${t.kind??"query"}`,n&&"is-selected",r?.state&&`sf-state-${r.state}`,r?.current&&"is-current",r?.dim&&"is-dim"].filter(Boolean).join(" ");return(0,R.jsxs)("div",{className:s,style:{width:Hn,minHeight:Bn},children:[(0,R.jsx)(st,{type:"target",position:t.targetSide?t.targetSide:i?j.Left:j.Top}),!!r?.badges?.length&&(0,R.jsx)("span",{className:"sf-badges",children:r.badges.map(a=>(0,R.jsx)("i",{"aria-label":o("stepNumber",{index:a}),children:a},a))}),(0,R.jsx)("strong",{children:t.label}),t.subtitle&&(0,R.jsx)("span",{className:"sf-node-subtitle",children:t.subtitle}),r?.state&&(0,R.jsxs)("span",{className:"sf-node-state",children:[(0,R.jsx)("i",{"aria-hidden":"true"}),r.note?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)("span",{className:"sf-sr",children:[o(Zt[r.state]),": "]}),r.note]}):o(Zt[r.state])]}),(0,R.jsx)(st,{type:"source",position:t.sourceSide?t.sourceSide:i?j.Right:j.Bottom})]})}var ob={showai:nb},rb=["base","path","warn","bad","idle","active"];function ib({prefix:e}){return(0,R.jsx)("svg",{className:"sf-markers","aria-hidden":"true",width:"0",height:"0",children:(0,R.jsx)("defs",{children:rb.map(t=>(0,R.jsx)("marker",{id:`${e}-${t}`,className:`sf-marker-${t}`,viewBox:"-10 -10 20 20",refX:"0",refY:"0",markerWidth:"12.5",markerHeight:"12.5",markerUnits:"strokeWidth",orient:"auto-start-reverse",children:(0,R.jsx)("polyline",{points:"-5,-4 0,0 -5,4 -5,-4",strokeLinecap:"round",strokeLinejoin:"round"})},t))})})}function sb({id:e,sourceX:t,sourceY:n,targetX:o,targetY:r,sourcePosition:i,targetPosition:s,label:a,data:c}){let[l,d,f]=rt({sourceX:t,sourceY:n,targetX:o,targetY:r,sourcePosition:i,targetPosition:s}),u=c?.view,h=u?.traversed?"path":u?.state&&u.state!=="ok"?u.state:"base";return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(_t,{id:e,path:l,markerEnd:`url(#${c?.marker}-${h})`}),u?.flowing&&(0,R.jsx)("path",{d:l,className:"sf-edge-flow"}),a&&(0,R.jsx)(Do,{x:d,y:f,label:a,labelStyle:{fontSize:13},labelBgPadding:[6,3],labelBgBorderRadius:4})]})}var ab={showai:sb};function lb({locked:e}){let{fitView:t,viewportInitialized:n}=at(),o=ja(),r=Fa(),i=J(u=>u.domNode),s=J(u=>u.width),a=J(u=>u.height),[c,l]=(0,oe.useState)({width:0,height:0}),d=(0,oe.useRef)(null),f=JSON.stringify(r.map(u=>[u.id,u.position.x,u.position.y,u.measured?.width,u.measured?.height]));return(0,oe.useEffect)(()=>{if(!i)return;let u=()=>{let p={width:i.offsetWidth,height:i.offsetHeight};l(x=>x.width===p.width&&x.height===p.height?x:p)},h=new ResizeObserver(u);return h.observe(i),u(),()=>h.disconnect()},[i]),(0,oe.useEffect)(()=>{if(!i||!n||!o||!c.width||!c.height||s!==c.width||a!==c.height)return;let u={...c,geometry:f},h=d.current;if(h&&(!e||h.width===u.width&&h.height===u.height&&h.geometry===f)){d.current=u;return}let p=requestAnimationFrame(()=>{i.offsetWidth!==c.width||i.offsetHeight!==c.height||(d.current=u,t({padding:.08}))});return()=>cancelAnimationFrame(p)},[i,t,n,o,c,s,a,f,e]),null}function cb({node:e,onSave:t}){let n=Oe(Te),[o,r]=(0,oe.useState)(e.label),[i,s]=(0,oe.useState)(e.detail??"");return(0,oe.useEffect)(()=>{r(e.label),s(e.detail??"")},[e.id,e.label,e.detail]),(0,R.jsxs)("details",{className:"sf-editor",children:[(0,R.jsx)("summary",{children:n("editNode")}),(0,R.jsxs)("label",{children:[n("nodeName"),(0,R.jsx)("input",{value:o,"aria-invalid":!o.trim(),onChange:a=>r(a.target.value)})]}),(0,R.jsxs)("label",{children:[n("nodeDetail"),(0,R.jsx)("textarea",{value:i,onChange:a=>s(a.target.value)})]}),!o.trim()&&(0,R.jsx)("p",{role:"alert",children:n("nodeNameRequired")}),(0,R.jsx)("button",{type:"button",disabled:!o.trim(),onClick:()=>t({label:o.trim(),detail:i}),children:n("saveNode")})]})}function db(e){let t=new Fo.Graph,n=e.direction??"TB";return t.setGraph({rankdir:n,nodesep:38,ranksep:62,marginx:24,marginy:24}),t.setDefaultEdgeLabel(()=>({})),e.nodes.forEach(o=>t.setNode(o.id,{width:Hn,height:Bn})),e.edges.forEach(o=>t.setEdge(o.source,o.target)),Ll(t),e.nodes.map(o=>{let r=t.node(o.id);return{id:o.id,type:"showai",data:{...o,direction:n},position:o.position??{x:r.x-Hn/2,y:r.y-Bn/2}}})}function ub({locked:e}){let t=at(),n=Oe(Te);return(0,R.jsxs)("div",{className:"sf-controls","aria-label":n("viewControls"),children:[(0,R.jsx)("button",{type:"button",onClick:()=>t.zoomIn(),disabled:e,"aria-label":n("zoomIn"),children:(0,R.jsx)(lr,{size:16})}),(0,R.jsx)("button",{type:"button",onClick:()=>t.zoomOut(),disabled:e,"aria-label":n("zoomOut"),children:(0,R.jsx)(sr,{size:16})}),(0,R.jsx)("button",{type:"button",onClick:()=>t.fitView({padding:.08,duration:200}),disabled:e,"aria-label":n("fitView"),children:(0,R.jsx)(ir,{size:16})})]})}function fb({id:e,locked:t}){let{getNode:n,getViewport:o,setCenter:r}=at(),i=J(l=>l.width),s=J(l=>l.height),a=(0,oe.useRef)({width:i,height:s});a.current={width:i,height:s};let c=(0,oe.useRef)(!1);return(0,oe.useEffect)(()=>{if(!c.current){c.current=!0;return}if(!e||t)return;let l=n(e);if(!l)return;let{x:d,y:f,zoom:u}=o(),h=l.measured?.width??Hn,p=l.measured?.height??Bn,x=l.position.x*u+d,b=l.position.y*u+f,{width:m,height:v}=a.current;if(!m||x>=0&&b>=0&&x+h*u<=m&&b+p*u<=v)return;let g=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;r(l.position.x+h/2,l.position.y+p/2,{zoom:u,duration:g?0:320})},[e,t,n,o,r]),null}function hb({flow:e,height:t,readOnly:n,locked:o,onPosition:r,selected:i,onSelect:s,view:a}){let c=Oe(Te),l=`sf${(0,oe.useId)().replace(/[^a-zA-Z0-9_-]/g,"")}`,d=(0,oe.useMemo)(()=>db(e),[e]),f=(0,oe.useMemo)(()=>d.map(b=>({...b,selected:b.id===i})),[d,i]),[u,h,p]=Ya(f);(0,oe.useEffect)(()=>h(f),[f,h]);let x=(0,oe.useMemo)(()=>e.edges.map(b=>{let m=a.edges.get(b.id);return{...b,label:m?.label??b.label,type:"showai",className:["sf-edge",m?.state&&`sf-edge-${m.state}`,m?.traversed&&"is-traversed",m?.current&&"is-current",m?.dim&&"is-dim"].filter(Boolean).join(" "),data:{view:m,marker:l}}}),[e,a,l]);return(0,R.jsxs)("div",{className:"sf-canvas",style:{height:t},role:"group","aria-label":e.label,children:[(0,R.jsx)(ib,{prefix:l}),(0,R.jsx)(Vl.Provider,{value:a.nodes,children:(0,R.jsxs)(Ba,{proOptions:{hideAttribution:!0},nodes:u,edges:x,nodeTypes:ob,edgeTypes:ab,onNodesChange:p,minZoom:.25,maxZoom:2,nodesDraggable:!n&&!o,panOnDrag:!o,zoomOnScroll:!o,zoomOnPinch:!o,zoomOnDoubleClick:!o,preventScrolling:!o,autoPanOnNodeFocus:!o,autoPanOnNodeDrag:!o,nodesConnectable:!1,edgesFocusable:!1,deleteKeyCode:null,onNodeClick:(b,m)=>s(m.id),onNodeDragStop:(b,m)=>r(m.id,m.position),children:[(0,R.jsx)(lb,{locked:o}),(0,R.jsx)(fb,{id:a.current,locked:o}),(0,R.jsx)(ub,{locked:o})]})}),(0,R.jsxs)("details",{className:"sf-node-picker",children:[(0,R.jsx)("summary",{"aria-label":c("nodeList"),children:c("nodes")}),(0,R.jsx)("div",{children:e.nodes.map(b=>(0,R.jsx)("button",{type:"button","aria-pressed":i===b.id,onClick:()=>s(b.id),children:b.label},b.id))})]})]})}function pb({flow:e,mode:t,onMode:n}){let o=Oe(Te),r=t.kind==="journey"?e.journeys?.find(i=>i.id===t.id):void 0;return(0,R.jsxs)("div",{className:"sf-chips",children:[!!e.journeys?.length&&(0,R.jsxs)("div",{className:"sf-journeys",role:"group","aria-label":o("journeys"),children:[(0,R.jsx)("button",{type:"button","aria-pressed":t.kind!=="journey",onClick:()=>n(e.stages?.length?Xt({...e,initialJourney:void 0}):{kind:"none"}),children:o("overview")}),e.journeys.map(i=>(0,R.jsx)("button",{type:"button","aria-pressed":r?.id===i.id,onClick:()=>n({kind:"journey",id:i.id,step:0}),children:i.label},i.id))]}),r?.summary&&(0,R.jsx)("p",{className:"sf-summary",children:r.summary}),!!e.stages?.length&&(0,R.jsx)("ol",{className:"sf-stages","aria-label":o("stages"),children:e.stages.map((i,s)=>{let a=tb(i),c=t.kind==="stage"&&t.index===s;return(0,R.jsx)("li",{children:(0,R.jsxs)("button",{type:"button",className:a?`sf-tone-${a}`:void 0,"aria-pressed":c,"aria-current":c?"step":void 0,onClick:()=>n({kind:"stage",index:s}),children:[(0,R.jsx)("b",{children:s+1}),(0,R.jsx)("span",{children:i.label})]})},i.id)})})]})}function gb({flow:e,mode:t,playing:n,onMode:o,onPlaying:r}){let i=Oe(Te);if(t.kind==="none")return null;let s=t.kind==="journey"?e.journeys.find(x=>x.id===t.id):void 0,a=t.kind==="journey"?t.step:t.index,c=s?s.steps.length:e.stages.length,l=x=>{r(!1);let b=Math.min(Math.max(x,0),c-1);o(s?{kind:"journey",id:s.id,step:b}:{kind:"stage",index:b})},d=()=>{if(n)return r(!1);a>=c-1&&l(0),r(!0)},f=x=>{if(x.key==="ArrowLeft")l(a-1);else if(x.key==="ArrowRight")l(a+1);else return;x.preventDefault()},u=s?.steps[a],h=s?void 0:e.stages[a],p=u?e.nodes.find(x=>x.id===u.node)?.label:void 0;return(0,R.jsxs)("div",{className:"sf-player",children:[(0,R.jsxs)("div",{className:"sf-player-bar",role:"group","aria-label":i("playback"),onKeyDown:f,children:[(0,R.jsx)("button",{type:"button",className:"sf-player-nav",disabled:a===0,"aria-label":i(s?"previousStep":"previousStage"),onClick:()=>l(a-1),children:(0,R.jsx)(rr,{size:16})}),s&&(0,R.jsx)("div",{className:"sf-dots",children:s.steps.map((x,b)=>(0,R.jsx)("button",{type:"button",className:b<a?"is-done":void 0,"aria-current":b===a?"step":void 0,"aria-label":i("goToStep",{index:b+1,title:x.title}),onClick:()=>l(b),children:b+1},b))}),(0,R.jsx)("button",{type:"button",className:"sf-player-nav",disabled:a>=c-1,"aria-label":i(s?"nextStep":"nextStage"),onClick:()=>l(a+1),children:(0,R.jsx)(or,{size:16})}),(0,R.jsxs)("span",{className:"sf-player-actions",children:[(0,R.jsxs)("button",{type:"button",className:"sf-player-play","aria-pressed":n,onClick:d,children:[n?(0,R.jsx)("span",{className:"sf-pause","aria-hidden":"true"}):(0,R.jsx)(ar,{size:14}),i(n?"pause":"play")]}),(0,R.jsxs)("button",{type:"button",className:"sf-player-restart",disabled:a===0&&!n,onClick:()=>l(0),children:[(0,R.jsx)(cr,{size:14}),i("restart")]})]})]}),(0,R.jsxs)("div",{className:"sf-player-text","aria-live":"polite",children:[(0,R.jsxs)("span",{className:"sf-kicker",children:[s?i("stepOf",{current:a+1,total:c}):i("stageOf",{current:a+1,total:c}),p&&` \xB7 ${p}`]}),(0,R.jsx)("strong",{children:u?.title??h?.label}),(u?.text??h?.summary)&&(0,R.jsx)("p",{children:u?.text??h?.summary})]})]})}function mb({flow:e}){let t=Oe(Te),n=(0,oe.useId)(),[o,r]=(0,oe.useState)(!1),i=new Map(e.nodes.map(a=>[a.id,a.label])),s=new Map(e.edges.map(a=>[a.id,`${i.get(a.source)} \u2192 ${i.get(a.target)}`]));return(0,R.jsxs)("div",{className:"sf-outline","data-open":o,children:[(0,R.jsx)("button",{type:"button",className:"sf-outline-toggle","aria-expanded":o,"aria-controls":n,onClick:()=>r(!o),children:t(o?"outlineHide":"outlineShow")}),(0,R.jsxs)("div",{id:n,className:"sf-outline-body","aria-label":t("outline"),children:[e.journeys?.map(a=>(0,R.jsxs)("section",{children:[(0,R.jsx)("h4",{children:a.label}),a.summary&&(0,R.jsx)("p",{children:a.summary}),(0,R.jsx)("ol",{children:a.steps.map((c,l)=>(0,R.jsxs)("li",{children:[(0,R.jsx)("b",{children:c.title}),(0,R.jsxs)("span",{children:[" \xB7 ",i.get(c.node)]}),(0,R.jsx)("p",{children:c.text})]},l))})]},a.id)),e.stages?.map((a,c)=>(0,R.jsxs)("section",{children:[(0,R.jsxs)("h4",{children:[t("stageOf",{current:c+1,total:e.stages.length})," ","\xB7 ",a.label]}),a.summary&&(0,R.jsx)("p",{children:a.summary}),(0,R.jsxs)("ul",{children:[Object.entries(a.nodes??{}).map(([l,d])=>(0,R.jsxs)("li",{className:`sf-tone-${d.state}`,children:[(0,R.jsx)("i",{"aria-hidden":"true"}),i.get(l),": ",t(Zt[d.state]),d.note&&` \xB7 ${d.note}`]},l)),Object.entries(a.edges??{}).filter(([,l])=>l.label||l.state!=="ok").map(([l,d])=>(0,R.jsxs)("li",{className:`sf-tone-${d.state}`,children:[(0,R.jsx)("i",{"aria-hidden":"true"}),s.get(l),": ",t(Zt[d.state]),d.label&&` \xB7 ${d.label}`]},l))]})]},a.id))]})]})}function Kv({data:e,onChange:t,readOnly:n=!1}){let o=(0,oe.useId)(),r=Oe(Te),i=pr("flowchart"),s=ur(e),[a,c]=(0,oe.useState)(s.flows[0]?.id??""),l=s.flows.find(S=>S.id===a)??s.flows[0],[d,f]=(0,oe.useState)("");(0,oe.useEffect)(()=>{l&&!l.nodes.some(S=>S.id===d)&&f("")},[l,d]);let u=l?.nodes.find(S=>S.id===d),[h,p]=(0,oe.useState)(()=>l?Xt(l):{kind:"none"}),[x,b]=(0,oe.useState)(!1),m=l?$l(l,h):h,v=m.kind==="journey"?`journey:${m.id}:${m.step}`:m.kind==="stage"?`stage:${m.index}`:"none",g=(0,oe.useMemo)(()=>l?Jm(l,m):{nodes:new Map,edges:new Map},[l,v]),w=`${l?.id}
|
|
10
10
|
${l?.initialJourney}
|
|
11
11
|
${l?.initialStage}`,_=(0,oe.useRef)(w);(0,oe.useEffect)(()=>{_.current!==w&&(_.current=w,l&&p(Xt(l)),b(!1))},[w,l]);let E=l?m.kind==="journey"?l.journeys?.find(S=>S.id===m.id)?.steps.length??0:m.kind==="stage"?l.stages?.length??0:0:0,C=m.kind==="journey"?m.step:m.kind==="stage"?m.index:0;(0,oe.useEffect)(()=>{if(!x)return;let S=window.setTimeout(()=>{if(C>=E-1)return b(!1);p(y=>y.kind==="journey"?{...y,step:C+1}:y.kind==="stage"?{...y,index:C+1}:y)},2200);return()=>window.clearTimeout(S)},[x,C,E]);let M=S=>{if(f(S),m.kind!=="journey")return;let y=l.journeys.find(N=>N.id===m.id).steps;if(y[m.step].node===S)return;let k=y.findIndex(N=>N.node===S);k<0||(b(!1),p({...m,step:k}))},I=m.kind==="stage"?l.stages[m.index].nodes:void 0,V=u&&I&&Object.hasOwn(I,u.id)?I[u.id]:void 0,P=!!(l?.journeys?.length||l?.stages?.length),L=(S,y)=>t?.({...s,flows:s.flows.map(k=>k.id===l.id?{...k,nodes:k.nodes.map(N=>N.id===S?{...N,...y}:N)}:k)});return(0,R.jsxs)("section",{ref:i.ref,className:"sb-block sf-block","aria-label":mr(s.title,r("flowchart")),"data-viewport-lock-scope":"flowchart","data-viewport-locked":i.locked,children:[(0,R.jsx)(br,{title:s.title,defaultTitle:r("defaultTitle"),description:s.description}),(0,R.jsx)(gr,{...i,label:r("lockTarget")}),l?(0,R.jsxs)(R.Fragment,{children:[s.flows.length>1&&(0,R.jsx)("div",{className:"sf-tabs",role:"tablist","aria-label":r("chooseFlow"),children:s.flows.map(S=>(0,R.jsx)("button",{id:`${o}-tab-${S.id}`,type:"button",role:"tab","aria-selected":S.id===l.id,"aria-controls":`${o}-panel-${S.id}`,onClick:()=>{c(S.id),f(""),p(Xt(S)),b(!1)},children:S.label},S.id))}),(0,R.jsxs)("div",{role:"tabpanel",id:`${o}-panel-${l.id}`,"aria-labelledby":s.flows.length>1?`${o}-tab-${l.id}`:void 0,children:[l.description&&(0,R.jsx)("p",{className:"sf-description",children:l.description}),P&&(0,R.jsx)(pb,{flow:l,mode:m,onMode:S=>{b(!1),p(S)}}),(0,R.jsx)(Ao,{children:(0,R.jsx)(hb,{flow:l,height:s.height??580,readOnly:n,locked:i.locked,selected:d,onSelect:M,view:g,onPosition:(S,y)=>{n||L(S,{position:y})}})},l.id),P&&(0,R.jsx)(gb,{flow:l,mode:m,playing:x,onMode:p,onPlaying:b}),u&&(V||u.detail||u.commands?.length||u.references?.length||!n&&t)&&(0,R.jsxs)("div",{className:"sf-detail","aria-live":"polite",children:[(0,R.jsxs)("div",{className:"sf-detail-heading",children:[u.kind&&(0,R.jsx)("span",{children:r(Qm[u.kind])}),(0,R.jsx)("strong",{children:u.label}),(0,R.jsx)("button",{type:"button",className:"sb-icon-button","aria-label":r("closeNodeDetail"),onClick:()=>f(""),children:(0,R.jsx)(dr,{size:16})})]}),V&&(0,R.jsxs)("p",{className:`sf-stage-note sf-tone-${V.state}`,children:[(0,R.jsx)("i",{"aria-hidden":"true"}),r("stageState",{state:r(Zt[V.state])}),V.note&&` \xB7 ${V.note}`]}),u.detail&&(0,R.jsx)("p",{children:u.detail}),!!u.commands?.length&&(0,R.jsxs)("div",{className:"sf-detail-group",children:[(0,R.jsx)("span",{children:r("commands")}),u.commands.map(S=>(0,R.jsx)("code",{children:S},S))]}),!!u.references?.length&&(0,R.jsxs)("div",{className:"sf-detail-group",children:[(0,R.jsx)("span",{children:r("references")}),u.references.map(S=>(0,R.jsx)("code",{children:S},S))]}),!n&&t&&(0,R.jsx)(cb,{node:u,onSave:S=>L(u.id,S)})]}),P&&(0,R.jsx)(mb,{flow:l})]})]}):(0,R.jsx)(yr,{title:r("addFlow")})]})}export{Kv as FlowchartBlock,Xt as initialPlayback,db as layoutFlow,Jm as playbackView};
|
|
12
|
-
/*! For license information please see Flowchart-
|
|
12
|
+
/*! For license information please see Flowchart-DJDRE6J4.js.LEGAL.txt */
|