@stonecrop/node-editor 0.6.3 → 0.7.1

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.
@@ -1,9 +1,9 @@
1
- (function(Ce,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],a):(Ce=typeof globalThis<"u"?globalThis:Ce||self,a(Ce["@stonecrop/node-editor"]={},Ce.Vue))})(this,(function(Ce,a){"use strict";function et(e){return a.getCurrentScope()?(a.onScopeDispose(e),!0):!1}function ke(e){return typeof e=="function"?e():a.unref(e)}const Ai=typeof window<"u"&&typeof document<"u",Oi=e=>typeof e<"u",zi=Object.prototype.toString,Ri=e=>zi.call(e)==="[object Object]",Hi=()=>{};function Li(e,t){function n(...o){return new Promise((i,r)=>{Promise.resolve(e(()=>t.apply(this,o),{fn:t,thisArg:this,args:o})).then(i).catch(r)})}return n}const Ln=e=>e();function Fi(e=Ln){const t=a.ref(!0);function n(){t.value=!1}function o(){t.value=!0}const i=(...r)=>{t.value&&e(...r)};return{isActive:a.readonly(t),pause:n,resume:o,eventFilter:i}}function Fn(e,t=!1,n="Timeout"){return new Promise((o,i)=>{setTimeout(t?()=>i(n):o,e)})}function Yi(e,t,n={}){const{eventFilter:o=Ln,...i}=n;return a.watch(e,Li(o,t),i)}function Ge(e,t,n={}){const{eventFilter:o,...i}=n,{eventFilter:r,pause:l,resume:s,isActive:u}=Fi(o);return{stop:Yi(e,t,{...i,eventFilter:r}),pause:l,resume:s,isActive:u}}function Gi(e,t={}){if(!a.isRef(e))return a.toRefs(e);const n=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const o in e.value)n[o]=a.customRef(()=>({get(){return e.value[o]},set(i){var r;if((r=ke(t.replaceRef))!=null?r:!0)if(Array.isArray(e.value)){const s=[...e.value];s[o]=i,e.value=s}else{const s={...e.value,[o]:i};Object.setPrototypeOf(s,Object.getPrototypeOf(e.value)),e.value=s}else e.value[o]=i}}));return n}function tn(e,t=!1){function n(f,{flush:h="sync",deep:p=!1,timeout:b,throwOnTimeout:x}={}){let N=null;const M=[new Promise(_=>{N=a.watch(e,C=>{f(C)!==t&&(N?.(),_(C))},{flush:h,deep:p,immediate:!0})})];return b!=null&&M.push(Fn(b,x).then(()=>ke(e)).finally(()=>N?.())),Promise.race(M)}function o(f,h){if(!a.isRef(f))return n(C=>C===f,h);const{flush:p="sync",deep:b=!1,timeout:x,throwOnTimeout:N}=h??{};let k=null;const _=[new Promise(C=>{k=a.watch([e,f],([A,P])=>{t!==(A===P)&&(k?.(),C(A))},{flush:p,deep:b,immediate:!0})})];return x!=null&&_.push(Fn(x,N).then(()=>ke(e)).finally(()=>(k?.(),ke(e)))),Promise.race(_)}function i(f){return n(h=>!!h,f)}function r(f){return o(null,f)}function l(f){return o(void 0,f)}function s(f){return n(Number.isNaN,f)}function u(f,h){return n(p=>{const b=Array.from(p);return b.includes(f)||b.includes(ke(f))},h)}function c(f){return d(1,f)}function d(f=1,h){let p=-1;return n(()=>(p+=1,p>=f),h)}return Array.isArray(ke(e))?{toMatch:n,toContains:u,changed:c,changedTimes:d,get not(){return tn(e,!t)}}:{toMatch:n,toBe:o,toBeTruthy:i,toBeNull:r,toBeNaN:s,toBeUndefined:l,changed:c,changedTimes:d,get not(){return tn(e,!t)}}}function nn(e){return tn(e)}function Xi(e){var t;const n=ke(e);return(t=n?.$el)!=null?t:n}const Yn=Ai?window:void 0;function Gn(...e){let t,n,o,i;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,o,i]=e,t=Yn):[t,n,o,i]=e,!t)return Hi;Array.isArray(n)||(n=[n]),Array.isArray(o)||(o=[o]);const r=[],l=()=>{r.forEach(d=>d()),r.length=0},s=(d,f,h,p)=>(d.addEventListener(f,h,p),()=>d.removeEventListener(f,h,p)),u=a.watch(()=>[Xi(t),ke(i)],([d,f])=>{if(l(),!d)return;const h=Ri(f)?{...f}:f;r.push(...n.flatMap(p=>o.map(b=>s(d,p,b,h))))},{immediate:!0,flush:"post"}),c=()=>{u(),l()};return et(c),c}function Ui(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function Xn(...e){let t,n,o={};e.length===3?(t=e[0],n=e[1],o=e[2]):e.length===2?typeof e[1]=="object"?(t=!0,n=e[0],o=e[1]):(t=e[0],n=e[1]):(t=!0,n=e[0]);const{target:i=Yn,eventName:r="keydown",passive:l=!1,dedupe:s=!1}=o,u=Ui(t);return Gn(i,r,d=>{d.repeat&&ke(s)||u(d)&&n(d)},l)}function Zi(e){return JSON.parse(JSON.stringify(e))}function on(e,t,n,o={}){var i,r,l;const{clone:s=!1,passive:u=!1,eventName:c,deep:d=!1,defaultValue:f,shouldEmit:h}=o,p=a.getCurrentInstance(),b=n||p?.emit||((i=p?.$emit)==null?void 0:i.bind(p))||((l=(r=p?.proxy)==null?void 0:r.$emit)==null?void 0:l.bind(p?.proxy));let x=c;t||(t="modelValue"),x=x||`update:${t.toString()}`;const N=_=>s?typeof s=="function"?s(_):Zi(_):_,k=()=>Oi(e[t])?N(e[t]):f,M=_=>{h?h(_)&&b(x,_):b(x,_)};if(u){const _=k(),C=a.ref(_);let A=!1;return a.watch(()=>e[t],P=>{A||(A=!0,C.value=N(P),a.nextTick(()=>A=!1))}),a.watch(C,P=>{!A&&(P!==e[t]||d)&&M(P)},{deep:d}),C}else return a.computed({get(){return k()},set(_){M(_)}})}var Wi={value:()=>{}};function _t(){for(var e=0,t=arguments.length,n={},o;e<t;++e){if(!(o=arguments[e]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new Et(n)}function Et(e){this._=e}function Ki(e,t){return e.trim().split(/^|\s+/).map(function(n){var o="",i=n.indexOf(".");if(i>=0&&(o=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}Et.prototype=_t.prototype={constructor:Et,on:function(e,t){var n=this._,o=Ki(e+"",n),i,r=-1,l=o.length;if(arguments.length<2){for(;++r<l;)if((i=(e=o[r]).type)&&(i=qi(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++r<l;)if(i=(e=o[r]).type)n[i]=Un(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Un(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Et(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),o=0,i,r;o<i;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(r=this._[e],o=0,i=r.length;o<i;++o)r[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],i=0,r=o.length;i<r;++i)o[i].value.apply(t,n)}};function qi(e,t){for(var n=0,o=e.length,i;n<o;++n)if((i=e[n]).name===t)return i.value}function Un(e,t,n){for(var o=0,i=e.length;o<i;++o)if(e[o].name===t){e[o]=Wi,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var rn="http://www.w3.org/1999/xhtml";const Zn={svg:"http://www.w3.org/2000/svg",xhtml:rn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function bt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Zn.hasOwnProperty(t)?{space:Zn[t],local:e}:e}function ji(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===rn&&t.documentElement.namespaceURI===rn?t.createElement(e):t.createElementNS(n,e)}}function Ji(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Wn(e){var t=bt(e);return(t.local?Ji:ji)(t)}function Qi(){}function ln(e){return e==null?Qi:function(){return this.querySelector(e)}}function er(e){typeof e!="function"&&(e=ln(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r=t[i],l=r.length,s=o[i]=new Array(l),u,c,d=0;d<l;++d)(u=r[d])&&(c=e.call(u,u.__data__,d,r))&&("__data__"in u&&(c.__data__=u.__data__),s[d]=c);return new me(o,this._parents)}function tr(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function nr(){return[]}function Kn(e){return e==null?nr:function(){return this.querySelectorAll(e)}}function or(e){return function(){return tr(e.apply(this,arguments))}}function ir(e){typeof e=="function"?e=or(e):e=Kn(e);for(var t=this._groups,n=t.length,o=[],i=[],r=0;r<n;++r)for(var l=t[r],s=l.length,u,c=0;c<s;++c)(u=l[c])&&(o.push(e.call(u,u.__data__,c,l)),i.push(u));return new me(o,i)}function qn(e){return function(){return this.matches(e)}}function jn(e){return function(t){return t.matches(e)}}var rr=Array.prototype.find;function lr(e){return function(){return rr.call(this.children,e)}}function ar(){return this.firstElementChild}function sr(e){return this.select(e==null?ar:lr(typeof e=="function"?e:jn(e)))}var ur=Array.prototype.filter;function cr(){return Array.from(this.children)}function dr(e){return function(){return ur.call(this.children,e)}}function fr(e){return this.selectAll(e==null?cr:dr(typeof e=="function"?e:jn(e)))}function hr(e){typeof e!="function"&&(e=qn(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r=t[i],l=r.length,s=o[i]=[],u,c=0;c<l;++c)(u=r[c])&&e.call(u,u.__data__,c,r)&&s.push(u);return new me(o,this._parents)}function Jn(e){return new Array(e.length)}function gr(){return new me(this._enter||this._groups.map(Jn),this._parents)}function xt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}xt.prototype={constructor:xt,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 mr(e,t,n,o,i,r){for(var l=0,s,u=t.length,c=r.length;l<c;++l)(s=t[l])?(s.__data__=r[l],o[l]=s):n[l]=new xt(e,r[l]);for(;l<u;++l)(s=t[l])&&(i[l]=s)}function yr(e,t,n,o,i,r,l){var s,u,c=new Map,d=t.length,f=r.length,h=new Array(d),p;for(s=0;s<d;++s)(u=t[s])&&(h[s]=p=l.call(u,u.__data__,s,t)+"",c.has(p)?i[s]=u:c.set(p,u));for(s=0;s<f;++s)p=l.call(e,r[s],s,r)+"",(u=c.get(p))?(o[s]=u,u.__data__=r[s],c.delete(p)):n[s]=new xt(e,r[s]);for(s=0;s<d;++s)(u=t[s])&&c.get(h[s])===u&&(i[s]=u)}function vr(e){return e.__data__}function wr(e,t){if(!arguments.length)return Array.from(this,vr);var n=t?yr:mr,o=this._parents,i=this._groups;typeof e!="function"&&(e=pr(e));for(var r=i.length,l=new Array(r),s=new Array(r),u=new Array(r),c=0;c<r;++c){var d=o[c],f=i[c],h=f.length,p=_r(e.call(d,d&&d.__data__,c,o)),b=p.length,x=s[c]=new Array(b),N=l[c]=new Array(b),k=u[c]=new Array(h);n(d,f,x,N,k,p,t);for(var M=0,_=0,C,A;M<b;++M)if(C=x[M]){for(M>=_&&(_=M+1);!(A=N[_])&&++_<b;);C._next=A||null}}return l=new me(l,o),l._enter=s,l._exit=u,l}function _r(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Er(){return new me(this._exit||this._groups.map(Jn),this._parents)}function br(e,t,n){var o=this.enter(),i=this,r=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?r.remove():n(r),o&&i?o.merge(i).order():i}function xr(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,i=n.length,r=o.length,l=Math.min(i,r),s=new Array(i),u=0;u<l;++u)for(var c=n[u],d=o[u],f=c.length,h=s[u]=new Array(f),p,b=0;b<f;++b)(p=c[b]||d[b])&&(h[b]=p);for(;u<i;++u)s[u]=n[u];return new me(s,this._parents)}function Sr(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],i=o.length-1,r=o[i],l;--i>=0;)(l=o[i])&&(r&&l.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(l,r),r=l);return this}function Nr(e){e||(e=Cr);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var n=this._groups,o=n.length,i=new Array(o),r=0;r<o;++r){for(var l=n[r],s=l.length,u=i[r]=new Array(s),c,d=0;d<s;++d)(c=l[d])&&(u[d]=c);u.sort(t)}return new me(i,this._parents).order()}function Cr(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function kr(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Mr(){return Array.from(this)}function Ir(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],i=0,r=o.length;i<r;++i){var l=o[i];if(l)return l}return null}function Pr(){let e=0;for(const t of this)++e;return e}function Tr(){return!this.node()}function $r(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var i=t[n],r=0,l=i.length,s;r<l;++r)(s=i[r])&&e.call(s,s.__data__,r,i);return this}function Dr(e){return function(){this.removeAttribute(e)}}function Br(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Vr(e,t){return function(){this.setAttribute(e,t)}}function Ar(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Or(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function zr(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 Rr(e,t){var n=bt(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?Br:Dr:typeof t=="function"?n.local?zr:Or:n.local?Ar:Vr)(n,t))}function Qn(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Hr(e){return function(){this.style.removeProperty(e)}}function Lr(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Fr(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Yr(e,t,n){return arguments.length>1?this.each((t==null?Hr:typeof t=="function"?Fr:Lr)(e,t,n??"")):Xe(this.node(),e)}function Xe(e,t){return e.style.getPropertyValue(t)||Qn(e).getComputedStyle(e,null).getPropertyValue(t)}function Gr(e){return function(){delete this[e]}}function Xr(e,t){return function(){this[e]=t}}function Ur(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?Gr:typeof t=="function"?Ur:Xr)(e,t)):this.node()[e]}function eo(e){return e.trim().split(/^|\s+/)}function an(e){return e.classList||new to(e)}function to(e){this._node=e,this._names=eo(e.getAttribute("class")||"")}to.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 no(e,t){for(var n=an(e),o=-1,i=t.length;++o<i;)n.add(t[o])}function oo(e,t){for(var n=an(e),o=-1,i=t.length;++o<i;)n.remove(t[o])}function Wr(e){return function(){no(this,e)}}function Kr(e){return function(){oo(this,e)}}function qr(e,t){return function(){(t.apply(this,arguments)?no:oo)(this,e)}}function jr(e,t){var n=eo(e+"");if(arguments.length<2){for(var o=an(this.node()),i=-1,r=n.length;++i<r;)if(!o.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?qr:t?Wr:Kr)(n,t))}function Jr(){this.textContent=""}function Qr(e){return function(){this.textContent=e}}function el(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function tl(e){return arguments.length?this.each(e==null?Jr:(typeof e=="function"?el:Qr)(e)):this.node().textContent}function nl(){this.innerHTML=""}function ol(e){return function(){this.innerHTML=e}}function il(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function rl(e){return arguments.length?this.each(e==null?nl:(typeof e=="function"?il:ol)(e)):this.node().innerHTML}function ll(){this.nextSibling&&this.parentNode.appendChild(this)}function al(){return this.each(ll)}function sl(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ul(){return this.each(sl)}function cl(e){var t=typeof e=="function"?e:Wn(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function dl(){return null}function fl(e,t){var n=typeof e=="function"?e:Wn(e),o=t==null?dl:typeof t=="function"?t:ln(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function hl(){var e=this.parentNode;e&&e.removeChild(this)}function gl(){return this.each(hl)}function pl(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ml(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function yl(e){return this.select(e?ml:pl)}function vl(e){return arguments.length?this.property("__data__",e):this.node().__data__}function wl(e){return function(t){e.call(this,t,this.__data__)}}function _l(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 El(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,i=t.length,r;n<i;++n)r=t[n],(!e.type||r.type===e.type)&&r.name===e.name?this.removeEventListener(r.type,r.listener,r.options):t[++o]=r;++o?t.length=o:delete this.__on}}}function bl(e,t,n){return function(){var o=this.__on,i,r=wl(t);if(o){for(var l=0,s=o.length;l<s;++l)if((i=o[l]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=r,i.options=n),i.value=t;return}}this.addEventListener(e.type,r,n),i={type:e.type,name:e.name,value:t,listener:r,options:n},o?o.push(i):this.__on=[i]}}function xl(e,t,n){var o=_l(e+""),i,r=o.length,l;if(arguments.length<2){var s=this.node().__on;if(s){for(var u=0,c=s.length,d;u<c;++u)for(i=0,d=s[u];i<r;++i)if((l=o[i]).type===d.type&&l.name===d.name)return d.value}return}for(s=t?bl:El,i=0;i<r;++i)this.each(s(o[i],t,n));return this}function io(e,t,n){var o=Qn(e),i=o.CustomEvent;typeof i=="function"?i=new i(t,n):(i=o.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function Sl(e,t){return function(){return io(this,e,t)}}function Nl(e,t){return function(){return io(this,e,t.apply(this,arguments))}}function Cl(e,t){return this.each((typeof t=="function"?Nl:Sl)(e,t))}function*kl(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],i=0,r=o.length,l;i<r;++i)(l=o[i])&&(yield l)}var ro=[null];function me(e,t){this._groups=e,this._parents=t}function tt(){return new me([[document.documentElement]],ro)}function Ml(){return this}me.prototype=tt.prototype={constructor:me,select:er,selectAll:ir,selectChild:sr,selectChildren:fr,filter:hr,data:wr,enter:gr,exit:Er,join:br,merge:xr,selection:Ml,order:Sr,sort:Nr,call:kr,nodes:Mr,node:Ir,size:Pr,empty:Tr,each:$r,attr:Rr,style:Yr,property:Zr,classed:jr,text:tl,html:rl,raise:al,lower:ul,append:cl,insert:fl,remove:gl,clone:yl,datum:vl,on:xl,dispatch:Cl,[Symbol.iterator]:kl};function ye(e){return typeof e=="string"?new me([[document.querySelector(e)]],[document.documentElement]):new me([[e]],ro)}function Il(e){let t;for(;t=e.sourceEvent;)e=t;return e}function _e(e,t){if(e=Il(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 i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}const Pl={passive:!1},nt={capture:!0,passive:!1};function sn(e){e.stopImmediatePropagation()}function Ue(e){e.preventDefault(),e.stopImmediatePropagation()}function lo(e){var t=e.document.documentElement,n=ye(e).on("dragstart.drag",Ue,nt);"onselectstart"in t?n.on("selectstart.drag",Ue,nt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function ao(e,t){var n=e.document.documentElement,o=ye(e).on("dragstart.drag",null);t&&(o.on("click.drag",Ue,nt),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const St=e=>()=>e;function un(e,{sourceEvent:t,subject:n,target:o,identifier:i,active:r,x:l,y:s,dx:u,dy:c,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:i,enumerable:!0,configurable:!0},active:{value:r,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:d}})}un.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Tl(e){return!e.ctrlKey&&!e.button}function $l(){return this.parentNode}function Dl(e,t){return t??{x:e.x,y:e.y}}function Bl(){return navigator.maxTouchPoints||"ontouchstart"in this}function Vl(){var e=Tl,t=$l,n=Dl,o=Bl,i={},r=_t("start","drag","end"),l=0,s,u,c,d,f=0;function h(C){C.on("mousedown.drag",p).filter(o).on("touchstart.drag",N).on("touchmove.drag",k,Pl).on("touchend.drag touchcancel.drag",M).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(C,A){if(!(d||!e.call(this,C,A))){var P=_(this,t.call(this,C,A),C,A,"mouse");P&&(ye(C.view).on("mousemove.drag",b,nt).on("mouseup.drag",x,nt),lo(C.view),sn(C),c=!1,s=C.clientX,u=C.clientY,P("start",C))}}function b(C){if(Ue(C),!c){var A=C.clientX-s,P=C.clientY-u;c=A*A+P*P>f}i.mouse("drag",C)}function x(C){ye(C.view).on("mousemove.drag mouseup.drag",null),ao(C.view,c),Ue(C),i.mouse("end",C)}function N(C,A){if(e.call(this,C,A)){var P=C.changedTouches,$=t.call(this,C,A),B=P.length,K,F;for(K=0;K<B;++K)(F=_(this,$,C,A,P[K].identifier,P[K]))&&(sn(C),F("start",C,P[K]))}}function k(C){var A=C.changedTouches,P=A.length,$,B;for($=0;$<P;++$)(B=i[A[$].identifier])&&(Ue(C),B("drag",C,A[$]))}function M(C){var A=C.changedTouches,P=A.length,$,B;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),$=0;$<P;++$)(B=i[A[$].identifier])&&(sn(C),B("end",C,A[$]))}function _(C,A,P,$,B,K){var F=r.copy(),O=_e(K||P,A),E,Z,w;if((w=n.call(C,new un("beforestart",{sourceEvent:P,target:h,identifier:B,active:l,x:O[0],y:O[1],dx:0,dy:0,dispatch:F}),$))!=null)return E=w.x-O[0]||0,Z=w.y-O[1]||0,function T(S,D,V){var R=O,H;switch(S){case"start":i[B]=T,H=l++;break;case"end":delete i[B],--l;case"drag":O=_e(V||D,A),H=l;break}F.call(S,C,new un(S,{sourceEvent:D,subject:w,target:h,identifier:B,active:H,x:O[0]+E,y:O[1]+Z,dx:O[0]-R[0],dy:O[1]-R[1],dispatch:F}),$)}}return h.filter=function(C){return arguments.length?(e=typeof C=="function"?C:St(!!C),h):e},h.container=function(C){return arguments.length?(t=typeof C=="function"?C:St(C),h):t},h.subject=function(C){return arguments.length?(n=typeof C=="function"?C:St(C),h):n},h.touchable=function(C){return arguments.length?(o=typeof C=="function"?C:St(!!C),h):o},h.on=function(){var C=r.on.apply(r,arguments);return C===r?h:C},h.clickDistance=function(C){return arguments.length?(f=(C=+C)*C,h):Math.sqrt(f)},h}function cn(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function so(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function ot(){}var it=.7,Nt=1/it,Ze="\\s*([+-]?\\d+)\\s*",rt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ee="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Al=/^#([0-9a-f]{3,8})$/,Ol=new RegExp(`^rgb\\(${Ze},${Ze},${Ze}\\)$`),zl=new RegExp(`^rgb\\(${Ee},${Ee},${Ee}\\)$`),Rl=new RegExp(`^rgba\\(${Ze},${Ze},${Ze},${rt}\\)$`),Hl=new RegExp(`^rgba\\(${Ee},${Ee},${Ee},${rt}\\)$`),Ll=new RegExp(`^hsl\\(${rt},${Ee},${Ee}\\)$`),Fl=new RegExp(`^hsla\\(${rt},${Ee},${Ee},${rt}\\)$`),uo={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};cn(ot,Ae,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:co,formatHex:co,formatHex8:Yl,formatHsl:Gl,formatRgb:fo,toString:fo});function co(){return this.rgb().formatHex()}function Yl(){return this.rgb().formatHex8()}function Gl(){return yo(this).formatHsl()}function fo(){return this.rgb().formatRgb()}function Ae(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Al.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?ho(t):n===3?new pe(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Ct(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Ct(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Ol.exec(e))?new pe(t[1],t[2],t[3],1):(t=zl.exec(e))?new pe(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Rl.exec(e))?Ct(t[1],t[2],t[3],t[4]):(t=Hl.exec(e))?Ct(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Ll.exec(e))?mo(t[1],t[2]/100,t[3]/100,1):(t=Fl.exec(e))?mo(t[1],t[2]/100,t[3]/100,t[4]):uo.hasOwnProperty(e)?ho(uo[e]):e==="transparent"?new pe(NaN,NaN,NaN,0):null}function ho(e){return new pe(e>>16&255,e>>8&255,e&255,1)}function Ct(e,t,n,o){return o<=0&&(e=t=n=NaN),new pe(e,t,n,o)}function Xl(e){return e instanceof ot||(e=Ae(e)),e?(e=e.rgb(),new pe(e.r,e.g,e.b,e.opacity)):new pe}function dn(e,t,n,o){return arguments.length===1?Xl(e):new pe(e,t,n,o??1)}function pe(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}cn(pe,dn,so(ot,{brighter(e){return e=e==null?Nt:Math.pow(Nt,e),new pe(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?it:Math.pow(it,e),new pe(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new pe(Oe(this.r),Oe(this.g),Oe(this.b),kt(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:go,formatHex:go,formatHex8:Ul,formatRgb:po,toString:po}));function go(){return`#${ze(this.r)}${ze(this.g)}${ze(this.b)}`}function Ul(){return`#${ze(this.r)}${ze(this.g)}${ze(this.b)}${ze((isNaN(this.opacity)?1:this.opacity)*255)}`}function po(){const e=kt(this.opacity);return`${e===1?"rgb(":"rgba("}${Oe(this.r)}, ${Oe(this.g)}, ${Oe(this.b)}${e===1?")":`, ${e})`}`}function kt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Oe(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ze(e){return e=Oe(e),(e<16?"0":"")+e.toString(16)}function mo(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ve(e,t,n,o)}function yo(e){if(e instanceof ve)return new ve(e.h,e.s,e.l,e.opacity);if(e instanceof ot||(e=Ae(e)),!e)return new ve;if(e instanceof ve)return e;e=e.rgb();var t=e.r/255,n=e.g/255,o=e.b/255,i=Math.min(t,n,o),r=Math.max(t,n,o),l=NaN,s=r-i,u=(r+i)/2;return s?(t===r?l=(n-o)/s+(n<o)*6:n===r?l=(o-t)/s+2:l=(t-n)/s+4,s/=u<.5?r+i:2-r-i,l*=60):s=u>0&&u<1?0:l,new ve(l,s,u,e.opacity)}function Zl(e,t,n,o){return arguments.length===1?yo(e):new ve(e,t,n,o??1)}function ve(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}cn(ve,Zl,so(ot,{brighter(e){return e=e==null?Nt:Math.pow(Nt,e),new ve(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?it:Math.pow(it,e),new ve(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,i=2*n-o;return new pe(fn(e>=240?e-240:e+120,i,o),fn(e,i,o),fn(e<120?e+240:e-120,i,o),this.opacity)},clamp(){return new ve(vo(this.h),Mt(this.s),Mt(this.l),kt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=kt(this.opacity);return`${e===1?"hsl(":"hsla("}${vo(this.h)}, ${Mt(this.s)*100}%, ${Mt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function vo(e){return e=(e||0)%360,e<0?e+360:e}function Mt(e){return Math.max(0,Math.min(1,e||0))}function fn(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const hn=e=>()=>e;function Wl(e,t){return function(n){return e+n*t}}function Kl(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}function ql(e){return(e=+e)==1?wo:function(t,n){return n-t?Kl(t,n,e):hn(isNaN(t)?n:t)}}function wo(e,t){var n=t-e;return n?Wl(e,n):hn(isNaN(e)?t:e)}const It=(function e(t){var n=ql(t);function o(i,r){var l=n((i=dn(i)).r,(r=dn(r)).r),s=n(i.g,r.g),u=n(i.b,r.b),c=wo(i.opacity,r.opacity);return function(d){return i.r=l(d),i.g=s(d),i.b=u(d),i.opacity=c(d),i+""}}return o.gamma=e,o})(1);function jl(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,o=t.slice(),i;return function(r){for(i=0;i<n;++i)o[i]=e[i]*(1-r)+t[i]*r;return o}}function Jl(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Ql(e,t){var n=t?t.length:0,o=e?Math.min(n,e.length):0,i=new Array(o),r=new Array(n),l;for(l=0;l<o;++l)i[l]=lt(e[l],t[l]);for(;l<n;++l)r[l]=t[l];return function(s){for(l=0;l<o;++l)r[l]=i[l](s);return r}}function ea(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function be(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function ta(e,t){var n={},o={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?n[i]=lt(e[i],t[i]):o[i]=t[i];return function(r){for(i in n)o[i]=n[i](r);return o}}var gn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,pn=new RegExp(gn.source,"g");function na(e){return function(){return e}}function oa(e){return function(t){return e(t)+""}}function _o(e,t){var n=gn.lastIndex=pn.lastIndex=0,o,i,r,l=-1,s=[],u=[];for(e=e+"",t=t+"";(o=gn.exec(e))&&(i=pn.exec(t));)(r=i.index)>n&&(r=t.slice(n,r),s[l]?s[l]+=r:s[++l]=r),(o=o[0])===(i=i[0])?s[l]?s[l]+=i:s[++l]=i:(s[++l]=null,u.push({i:l,x:be(o,i)})),n=pn.lastIndex;return n<t.length&&(r=t.slice(n),s[l]?s[l]+=r:s[++l]=r),s.length<2?u[0]?oa(u[0].x):na(t):(t=u.length,function(c){for(var d=0,f;d<t;++d)s[(f=u[d]).i]=f.x(c);return s.join("")})}function lt(e,t){var n=typeof t,o;return t==null||n==="boolean"?hn(t):(n==="number"?be:n==="string"?(o=Ae(t))?(t=o,It):_o:t instanceof Ae?It:t instanceof Date?ea:Jl(t)?jl:Array.isArray(t)?Ql:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?ta:be)(e,t)}var Eo=180/Math.PI,mn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function bo(e,t,n,o,i,r){var l,s,u;return(l=Math.sqrt(e*e+t*t))&&(e/=l,t/=l),(u=e*n+t*o)&&(n-=e*u,o-=t*u),(s=Math.sqrt(n*n+o*o))&&(n/=s,o/=s,u/=s),e*o<t*n&&(e=-e,t=-t,u=-u,l=-l),{translateX:i,translateY:r,rotate:Math.atan2(t,e)*Eo,skewX:Math.atan(u)*Eo,scaleX:l,scaleY:s}}var Pt;function ia(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?mn:bo(t.a,t.b,t.c,t.d,t.e,t.f)}function ra(e){return e==null||(Pt||(Pt=document.createElementNS("http://www.w3.org/2000/svg","g")),Pt.setAttribute("transform",e),!(e=Pt.transform.baseVal.consolidate()))?mn:(e=e.matrix,bo(e.a,e.b,e.c,e.d,e.e,e.f))}function xo(e,t,n,o){function i(c){return c.length?c.pop()+" ":""}function r(c,d,f,h,p,b){if(c!==f||d!==h){var x=p.push("translate(",null,t,null,n);b.push({i:x-4,x:be(c,f)},{i:x-2,x:be(d,h)})}else(f||h)&&p.push("translate("+f+t+h+n)}function l(c,d,f,h){c!==d?(c-d>180?d+=360:d-c>180&&(c+=360),h.push({i:f.push(i(f)+"rotate(",null,o)-2,x:be(c,d)})):d&&f.push(i(f)+"rotate("+d+o)}function s(c,d,f,h){c!==d?h.push({i:f.push(i(f)+"skewX(",null,o)-2,x:be(c,d)}):d&&f.push(i(f)+"skewX("+d+o)}function u(c,d,f,h,p,b){if(c!==f||d!==h){var x=p.push(i(p)+"scale(",null,",",null,")");b.push({i:x-4,x:be(c,f)},{i:x-2,x:be(d,h)})}else(f!==1||h!==1)&&p.push(i(p)+"scale("+f+","+h+")")}return function(c,d){var f=[],h=[];return c=e(c),d=e(d),r(c.translateX,c.translateY,d.translateX,d.translateY,f,h),l(c.rotate,d.rotate,f,h),s(c.skewX,d.skewX,f,h),u(c.scaleX,c.scaleY,d.scaleX,d.scaleY,f,h),c=d=null,function(p){for(var b=-1,x=h.length,N;++b<x;)f[(N=h[b]).i]=N.x(p);return f.join("")}}}var la=xo(ia,"px, ","px)","deg)"),aa=xo(ra,", ",")",")"),sa=1e-12;function So(e){return((e=Math.exp(e))+1/e)/2}function ua(e){return((e=Math.exp(e))-1/e)/2}function ca(e){return((e=Math.exp(2*e))-1)/(e+1)}const Tt=(function e(t,n,o){function i(r,l){var s=r[0],u=r[1],c=r[2],d=l[0],f=l[1],h=l[2],p=d-s,b=f-u,x=p*p+b*b,N,k;if(x<sa)k=Math.log(h/c)/t,N=function($){return[s+$*p,u+$*b,c*Math.exp(t*$*k)]};else{var M=Math.sqrt(x),_=(h*h-c*c+o*x)/(2*c*n*M),C=(h*h-c*c-o*x)/(2*h*n*M),A=Math.log(Math.sqrt(_*_+1)-_),P=Math.log(Math.sqrt(C*C+1)-C);k=(P-A)/t,N=function($){var B=$*k,K=So(A),F=c/(n*M)*(K*ca(t*B+A)-ua(A));return[s+F*p,u+F*b,c*K/So(t*B+A)]}}return N.duration=k*1e3*t/Math.SQRT2,N}return i.rho=function(r){var l=Math.max(.001,+r),s=l*l,u=s*s;return e(l,s,u)},i})(Math.SQRT2,2,4);var We=0,at=0,st=0,No=1e3,$t,ut,Dt=0,Re=0,Bt=0,ct=typeof performance=="object"&&performance.now?performance:Date,Co=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function yn(){return Re||(Co(da),Re=ct.now()+Bt)}function da(){Re=0}function Vt(){this._call=this._time=this._next=null}Vt.prototype=ko.prototype={constructor:Vt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?yn():+n)+(t==null?0:+t),!this._next&&ut!==this&&(ut?ut._next=this:$t=this,ut=this),this._call=e,this._time=n,vn()},stop:function(){this._call&&(this._call=null,this._time=1/0,vn())}};function ko(e,t,n){var o=new Vt;return o.restart(e,t,n),o}function fa(){yn(),++We;for(var e=$t,t;e;)(t=Re-e._time)>=0&&e._call.call(void 0,t),e=e._next;--We}function Mo(){Re=(Dt=ct.now())+Bt,We=at=0;try{fa()}finally{We=0,ga(),Re=0}}function ha(){var e=ct.now(),t=e-Dt;t>No&&(Bt-=t,Dt=e)}function ga(){for(var e,t=$t,n,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:$t=n);ut=e,vn(o)}function vn(e){if(!We){at&&(at=clearTimeout(at));var t=e-Re;t>24?(e<1/0&&(at=setTimeout(Mo,e-ct.now()-Bt)),st&&(st=clearInterval(st))):(st||(Dt=ct.now(),st=setInterval(ha,No)),We=1,Co(Mo))}}function Io(e,t,n){var o=new Vt;return t=t==null?0:+t,o.restart(i=>{o.stop(),e(i+t)},t,n),o}var pa=_t("start","end","cancel","interrupt"),ma=[],Po=0,To=1,wn=2,At=3,$o=4,_n=5,Ot=6;function zt(e,t,n,o,i,r){var l=e.__transition;if(!l)e.__transition={};else if(n in l)return;ya(e,n,{name:t,index:o,group:i,on:pa,tween:ma,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Po})}function En(e,t){var n=we(e,t);if(n.state>Po)throw new Error("too late; already scheduled");return n}function xe(e,t){var n=we(e,t);if(n.state>At)throw new Error("too late; already running");return n}function we(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function ya(e,t,n){var o=e.__transition,i;o[t]=n,n.timer=ko(r,0,n.time);function r(c){n.state=To,n.timer.restart(l,n.delay,n.time),n.delay<=c&&l(c-n.delay)}function l(c){var d,f,h,p;if(n.state!==To)return u();for(d in o)if(p=o[d],p.name===n.name){if(p.state===At)return Io(l);p.state===$o?(p.state=Ot,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete o[d]):+d<t&&(p.state=Ot,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete o[d])}if(Io(function(){n.state===At&&(n.state=$o,n.timer.restart(s,n.delay,n.time),s(c))}),n.state=wn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===wn){for(n.state=At,i=new Array(h=n.tween.length),d=0,f=-1;d<h;++d)(p=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(i[++f]=p);i.length=f+1}}function s(c){for(var d=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(u),n.state=_n,1),f=-1,h=i.length;++f<h;)i[f].call(e,d);n.state===_n&&(n.on.call("end",e,e.__data__,n.index,n.group),u())}function u(){n.state=Ot,n.timer.stop(),delete o[t];for(var c in o)return;delete e.__transition}}function Rt(e,t){var n=e.__transition,o,i,r=!0,l;if(n){t=t==null?null:t+"";for(l in n){if((o=n[l]).name!==t){r=!1;continue}i=o.state>wn&&o.state<_n,o.state=Ot,o.timer.stop(),o.on.call(i?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[l]}r&&delete e.__transition}}function va(e){return this.each(function(){Rt(this,e)})}function wa(e,t){var n,o;return function(){var i=xe(this,e),r=i.tween;if(r!==n){o=n=r;for(var l=0,s=o.length;l<s;++l)if(o[l].name===t){o=o.slice(),o.splice(l,1);break}}i.tween=o}}function _a(e,t,n){var o,i;if(typeof n!="function")throw new Error;return function(){var r=xe(this,e),l=r.tween;if(l!==o){i=(o=l).slice();for(var s={name:t,value:n},u=0,c=i.length;u<c;++u)if(i[u].name===t){i[u]=s;break}u===c&&i.push(s)}r.tween=i}}function Ea(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=we(this.node(),n).tween,i=0,r=o.length,l;i<r;++i)if((l=o[i]).name===e)return l.value;return null}return this.each((t==null?wa:_a)(n,e,t))}function bn(e,t,n){var o=e._id;return e.each(function(){var i=xe(this,o);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return we(i,o).value[t]}}function Do(e,t){var n;return(typeof t=="number"?be:t instanceof Ae?It:(n=Ae(t))?(t=n,It):_o)(e,t)}function ba(e){return function(){this.removeAttribute(e)}}function xa(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Sa(e,t,n){var o,i=n+"",r;return function(){var l=this.getAttribute(e);return l===i?null:l===o?r:r=t(o=l,n)}}function Na(e,t,n){var o,i=n+"",r;return function(){var l=this.getAttributeNS(e.space,e.local);return l===i?null:l===o?r:r=t(o=l,n)}}function Ca(e,t,n){var o,i,r;return function(){var l,s=n(this),u;return s==null?void this.removeAttribute(e):(l=this.getAttribute(e),u=s+"",l===u?null:l===o&&u===i?r:(i=u,r=t(o=l,s)))}}function ka(e,t,n){var o,i,r;return function(){var l,s=n(this),u;return s==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),u=s+"",l===u?null:l===o&&u===i?r:(i=u,r=t(o=l,s)))}}function Ma(e,t){var n=bt(e),o=n==="transform"?aa:Do;return this.attrTween(e,typeof t=="function"?(n.local?ka:Ca)(n,o,bn(this,"attr."+e,t)):t==null?(n.local?xa:ba)(n):(n.local?Na:Sa)(n,o,t))}function Ia(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Pa(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Ta(e,t){var n,o;function i(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&Pa(e,r)),n}return i._value=t,i}function $a(e,t){var n,o;function i(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&Ia(e,r)),n}return i._value=t,i}function Da(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=bt(e);return this.tween(n,(o.local?Ta:$a)(o,t))}function Ba(e,t){return function(){En(this,e).delay=+t.apply(this,arguments)}}function Va(e,t){return t=+t,function(){En(this,e).delay=t}}function Aa(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Ba:Va)(t,e)):we(this.node(),t).delay}function Oa(e,t){return function(){xe(this,e).duration=+t.apply(this,arguments)}}function za(e,t){return t=+t,function(){xe(this,e).duration=t}}function Ra(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Oa:za)(t,e)):we(this.node(),t).duration}function Ha(e,t){if(typeof t!="function")throw new Error;return function(){xe(this,e).ease=t}}function La(e){var t=this._id;return arguments.length?this.each(Ha(t,e)):we(this.node(),t).ease}function Fa(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;xe(this,e).ease=n}}function Ya(e){if(typeof e!="function")throw new Error;return this.each(Fa(this._id,e))}function Ga(e){typeof e!="function"&&(e=qn(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r=t[i],l=r.length,s=o[i]=[],u,c=0;c<l;++c)(u=r[c])&&e.call(u,u.__data__,c,r)&&s.push(u);return new Me(o,this._parents,this._name,this._id)}function Xa(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,i=n.length,r=Math.min(o,i),l=new Array(o),s=0;s<r;++s)for(var u=t[s],c=n[s],d=u.length,f=l[s]=new Array(d),h,p=0;p<d;++p)(h=u[p]||c[p])&&(f[p]=h);for(;s<o;++s)l[s]=t[s];return new Me(l,this._parents,this._name,this._id)}function Ua(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 Za(e,t,n){var o,i,r=Ua(t)?En:xe;return function(){var l=r(this,e),s=l.on;s!==o&&(i=(o=s).copy()).on(t,n),l.on=i}}function Wa(e,t){var n=this._id;return arguments.length<2?we(this.node(),n).on.on(e):this.each(Za(n,e,t))}function Ka(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function qa(){return this.on("end.remove",Ka(this._id))}function ja(e){var t=this._name,n=this._id;typeof e!="function"&&(e=ln(e));for(var o=this._groups,i=o.length,r=new Array(i),l=0;l<i;++l)for(var s=o[l],u=s.length,c=r[l]=new Array(u),d,f,h=0;h<u;++h)(d=s[h])&&(f=e.call(d,d.__data__,h,s))&&("__data__"in d&&(f.__data__=d.__data__),c[h]=f,zt(c[h],t,n,h,c,we(d,n)));return new Me(r,this._parents,t,n)}function Ja(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Kn(e));for(var o=this._groups,i=o.length,r=[],l=[],s=0;s<i;++s)for(var u=o[s],c=u.length,d,f=0;f<c;++f)if(d=u[f]){for(var h=e.call(d,d.__data__,f,u),p,b=we(d,n),x=0,N=h.length;x<N;++x)(p=h[x])&&zt(p,t,n,x,h,b);r.push(h),l.push(d)}return new Me(r,l,t,n)}var Qa=tt.prototype.constructor;function es(){return new Qa(this._groups,this._parents)}function ts(e,t){var n,o,i;return function(){var r=Xe(this,e),l=(this.style.removeProperty(e),Xe(this,e));return r===l?null:r===n&&l===o?i:i=t(n=r,o=l)}}function Bo(e){return function(){this.style.removeProperty(e)}}function ns(e,t,n){var o,i=n+"",r;return function(){var l=Xe(this,e);return l===i?null:l===o?r:r=t(o=l,n)}}function os(e,t,n){var o,i,r;return function(){var l=Xe(this,e),s=n(this),u=s+"";return s==null&&(u=s=(this.style.removeProperty(e),Xe(this,e))),l===u?null:l===o&&u===i?r:(i=u,r=t(o=l,s))}}function is(e,t){var n,o,i,r="style."+t,l="end."+r,s;return function(){var u=xe(this,e),c=u.on,d=u.value[r]==null?s||(s=Bo(t)):void 0;(c!==n||i!==d)&&(o=(n=c).copy()).on(l,i=d),u.on=o}}function rs(e,t,n){var o=(e+="")=="transform"?la:Do;return t==null?this.styleTween(e,ts(e,o)).on("end.style."+e,Bo(e)):typeof t=="function"?this.styleTween(e,os(e,o,bn(this,"style."+e,t))).each(is(this._id,e)):this.styleTween(e,ns(e,o,t),n).on("end.style."+e,null)}function ls(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function as(e,t,n){var o,i;function r(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&ls(e,l,n)),o}return r._value=t,r}function ss(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,as(e,t,n??""))}function us(e){return function(){this.textContent=e}}function cs(e){return function(){var t=e(this);this.textContent=t??""}}function ds(e){return this.tween("text",typeof e=="function"?cs(bn(this,"text",e)):us(e==null?"":e+""))}function fs(e){return function(t){this.textContent=e.call(this,t)}}function hs(e){var t,n;function o(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&fs(i)),t}return o._value=e,o}function gs(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,hs(e))}function ps(){for(var e=this._name,t=this._id,n=Vo(),o=this._groups,i=o.length,r=0;r<i;++r)for(var l=o[r],s=l.length,u,c=0;c<s;++c)if(u=l[c]){var d=we(u,t);zt(u,e,n,c,l,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new Me(o,this._parents,e,n)}function ms(){var e,t,n=this,o=n._id,i=n.size();return new Promise(function(r,l){var s={value:l},u={value:function(){--i===0&&r()}};n.each(function(){var c=xe(this,o),d=c.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(u)),c.on=t}),i===0&&r()})}var ys=0;function Me(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Vo(){return++ys}var Ie=tt.prototype;Me.prototype={constructor:Me,select:ja,selectAll:Ja,selectChild:Ie.selectChild,selectChildren:Ie.selectChildren,filter:Ga,merge:Xa,selection:es,transition:ps,call:Ie.call,nodes:Ie.nodes,node:Ie.node,size:Ie.size,empty:Ie.empty,each:Ie.each,on:Wa,attr:Ma,attrTween:Da,style:rs,styleTween:ss,text:ds,textTween:gs,remove:qa,tween:Ea,delay:Aa,duration:Ra,ease:La,easeVarying:Ya,end:ms,[Symbol.iterator]:Ie[Symbol.iterator]};function vs(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var ws={time:null,delay:0,duration:250,ease:vs};function _s(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 Es(e){var t,n;e instanceof Me?(t=e._id,e=e._name):(t=Vo(),(n=ws).time=yn(),e=e==null?null:e+"");for(var o=this._groups,i=o.length,r=0;r<i;++r)for(var l=o[r],s=l.length,u,c=0;c<s;++c)(u=l[c])&&zt(u,e,t,c,l,n||_s(u,t));return new Me(o,this._parents,e,t)}tt.prototype.interrupt=va,tt.prototype.transition=Es;const Ht=e=>()=>e;function bs(e,{sourceEvent:t,target:n,transform:o,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:i}})}function Pe(e,t,n){this.k=e,this.x=t,this.y=n}Pe.prototype={constructor:Pe,scale:function(e){return e===1?this:new Pe(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Pe(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 Ke=new Pe(1,0,0);Pe.prototype;function xn(e){e.stopImmediatePropagation()}function dt(e){e.preventDefault(),e.stopImmediatePropagation()}function xs(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Ss(){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 Ao(){return this.__zoom||Ke}function Ns(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Cs(){return navigator.maxTouchPoints||"ontouchstart"in this}function ks(e,t,n){var o=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],r=e.invertY(t[0][1])-n[0][1],l=e.invertY(t[1][1])-n[1][1];return e.translate(i>o?(o+i)/2:Math.min(0,o)||Math.max(0,i),l>r?(r+l)/2:Math.min(0,r)||Math.max(0,l))}function Ms(){var e=xs,t=Ss,n=ks,o=Ns,i=Cs,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,u=Tt,c=_t("start","zoom","end"),d,f,h,p=500,b=150,x=0,N=10;function k(w){w.property("__zoom",Ao).on("wheel.zoom",B,{passive:!1}).on("mousedown.zoom",K).on("dblclick.zoom",F).filter(i).on("touchstart.zoom",O).on("touchmove.zoom",E).on("touchend.zoom touchcancel.zoom",Z).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}k.transform=function(w,T,S,D){var V=w.selection?w.selection():w;V.property("__zoom",Ao),w!==V?A(w,T,S,D):V.interrupt().each(function(){P(this,arguments).event(D).start().zoom(null,typeof T=="function"?T.apply(this,arguments):T).end()})},k.scaleBy=function(w,T,S,D){k.scaleTo(w,function(){var V=this.__zoom.k,R=typeof T=="function"?T.apply(this,arguments):T;return V*R},S,D)},k.scaleTo=function(w,T,S,D){k.transform(w,function(){var V=t.apply(this,arguments),R=this.__zoom,H=S==null?C(V):typeof S=="function"?S.apply(this,arguments):S,W=R.invert(H),Q=typeof T=="function"?T.apply(this,arguments):T;return n(_(M(R,Q),H,W),V,l)},S,D)},k.translateBy=function(w,T,S,D){k.transform(w,function(){return n(this.__zoom.translate(typeof T=="function"?T.apply(this,arguments):T,typeof S=="function"?S.apply(this,arguments):S),t.apply(this,arguments),l)},null,D)},k.translateTo=function(w,T,S,D,V){k.transform(w,function(){var R=t.apply(this,arguments),H=this.__zoom,W=D==null?C(R):typeof D=="function"?D.apply(this,arguments):D;return n(Ke.translate(W[0],W[1]).scale(H.k).translate(typeof T=="function"?-T.apply(this,arguments):-T,typeof S=="function"?-S.apply(this,arguments):-S),R,l)},D,V)};function M(w,T){return T=Math.max(r[0],Math.min(r[1],T)),T===w.k?w:new Pe(T,w.x,w.y)}function _(w,T,S){var D=T[0]-S[0]*w.k,V=T[1]-S[1]*w.k;return D===w.x&&V===w.y?w:new Pe(w.k,D,V)}function C(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function A(w,T,S,D){w.on("start.zoom",function(){P(this,arguments).event(D).start()}).on("interrupt.zoom end.zoom",function(){P(this,arguments).event(D).end()}).tween("zoom",function(){var V=this,R=arguments,H=P(V,R).event(D),W=t.apply(V,R),Q=S==null?C(W):typeof S=="function"?S.apply(V,R):S,te=Math.max(W[1][0]-W[0][0],W[1][1]-W[0][1]),Y=V.__zoom,j=typeof T=="function"?T.apply(V,R):T,q=u(Y.invert(Q).concat(te/Y.k),j.invert(Q).concat(te/j.k));return function(re){if(re===1)re=j;else{var le=q(re),oe=te/le[2];re=new Pe(oe,Q[0]-le[0]*oe,Q[1]-le[1]*oe)}H.zoom(null,re)}})}function P(w,T,S){return!S&&w.__zooming||new $(w,T)}function $(w,T){this.that=w,this.args=T,this.active=0,this.sourceEvent=null,this.extent=t.apply(w,T),this.taps=0}$.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,T){return this.mouse&&w!=="mouse"&&(this.mouse[1]=T.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=T.invert(this.touch0[0])),this.touch1&&w!=="touch"&&(this.touch1[1]=T.invert(this.touch1[0])),this.that.__zoom=T,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(w){var T=ye(this.that).datum();c.call(w,this.that,new bs(w,{sourceEvent:this.sourceEvent,target:k,transform:this.that.__zoom,dispatch:c}),T)}};function B(w,...T){if(!e.apply(this,arguments))return;var S=P(this,T).event(w),D=this.__zoom,V=Math.max(r[0],Math.min(r[1],D.k*Math.pow(2,o.apply(this,arguments)))),R=_e(w);if(S.wheel)(S.mouse[0][0]!==R[0]||S.mouse[0][1]!==R[1])&&(S.mouse[1]=D.invert(S.mouse[0]=R)),clearTimeout(S.wheel);else{if(D.k===V)return;S.mouse=[R,D.invert(R)],Rt(this),S.start()}dt(w),S.wheel=setTimeout(H,b),S.zoom("mouse",n(_(M(D,V),S.mouse[0],S.mouse[1]),S.extent,l));function H(){S.wheel=null,S.end()}}function K(w,...T){if(h||!e.apply(this,arguments))return;var S=w.currentTarget,D=P(this,T,!0).event(w),V=ye(w.view).on("mousemove.zoom",Q,!0).on("mouseup.zoom",te,!0),R=_e(w,S),H=w.clientX,W=w.clientY;lo(w.view),xn(w),D.mouse=[R,this.__zoom.invert(R)],Rt(this),D.start();function Q(Y){if(dt(Y),!D.moved){var j=Y.clientX-H,q=Y.clientY-W;D.moved=j*j+q*q>x}D.event(Y).zoom("mouse",n(_(D.that.__zoom,D.mouse[0]=_e(Y,S),D.mouse[1]),D.extent,l))}function te(Y){V.on("mousemove.zoom mouseup.zoom",null),ao(Y.view,D.moved),dt(Y),D.event(Y).end()}}function F(w,...T){if(e.apply(this,arguments)){var S=this.__zoom,D=_e(w.changedTouches?w.changedTouches[0]:w,this),V=S.invert(D),R=S.k*(w.shiftKey?.5:2),H=n(_(M(S,R),D,V),t.apply(this,T),l);dt(w),s>0?ye(this).transition().duration(s).call(A,H,D,w):ye(this).call(k.transform,H,D,w)}}function O(w,...T){if(e.apply(this,arguments)){var S=w.touches,D=S.length,V=P(this,T,w.changedTouches.length===D).event(w),R,H,W,Q;for(xn(w),H=0;H<D;++H)W=S[H],Q=_e(W,this),Q=[Q,this.__zoom.invert(Q),W.identifier],V.touch0?!V.touch1&&V.touch0[2]!==Q[2]&&(V.touch1=Q,V.taps=0):(V.touch0=Q,R=!0,V.taps=1+!!d);d&&(d=clearTimeout(d)),R&&(V.taps<2&&(f=Q[0],d=setTimeout(function(){d=null},p)),Rt(this),V.start())}}function E(w,...T){if(this.__zooming){var S=P(this,T).event(w),D=w.changedTouches,V=D.length,R,H,W,Q;for(dt(w),R=0;R<V;++R)H=D[R],W=_e(H,this),S.touch0&&S.touch0[2]===H.identifier?S.touch0[0]=W:S.touch1&&S.touch1[2]===H.identifier&&(S.touch1[0]=W);if(H=S.that.__zoom,S.touch1){var te=S.touch0[0],Y=S.touch0[1],j=S.touch1[0],q=S.touch1[1],re=(re=j[0]-te[0])*re+(re=j[1]-te[1])*re,le=(le=q[0]-Y[0])*le+(le=q[1]-Y[1])*le;H=M(H,Math.sqrt(re/le)),W=[(te[0]+j[0])/2,(te[1]+j[1])/2],Q=[(Y[0]+q[0])/2,(Y[1]+q[1])/2]}else if(S.touch0)W=S.touch0[0],Q=S.touch0[1];else return;S.zoom("touch",n(_(H,W,Q),S.extent,l))}}function Z(w,...T){if(this.__zooming){var S=P(this,T).event(w),D=w.changedTouches,V=D.length,R,H;for(xn(w),h&&clearTimeout(h),h=setTimeout(function(){h=null},p),R=0;R<V;++R)H=D[R],S.touch0&&S.touch0[2]===H.identifier?delete S.touch0:S.touch1&&S.touch1[2]===H.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&(H=_e(H,this),Math.hypot(f[0]-H[0],f[1]-H[1])<N)){var W=ye(this).on("dblclick.zoom");W&&W.apply(this,arguments)}}}return k.wheelDelta=function(w){return arguments.length?(o=typeof w=="function"?w:Ht(+w),k):o},k.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Ht(!!w),k):e},k.touchable=function(w){return arguments.length?(i=typeof w=="function"?w:Ht(!!w),k):i},k.extent=function(w){return arguments.length?(t=typeof w=="function"?w:Ht([[+w[0][0],+w[0][1]],[+w[1][0],+w[1][1]]]),k):t},k.scaleExtent=function(w){return arguments.length?(r[0]=+w[0],r[1]=+w[1],k):[r[0],r[1]]},k.translateExtent=function(w){return arguments.length?(l[0][0]=+w[0][0],l[1][0]=+w[1][0],l[0][1]=+w[0][1],l[1][1]=+w[1][1],k):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},k.constrain=function(w){return arguments.length?(n=w,k):n},k.duration=function(w){return arguments.length?(s=+w,k):s},k.interpolate=function(w){return arguments.length?(u=w,k):u},k.on=function(){var w=c.on.apply(c,arguments);return w===c?k:w},k.clickDistance=function(w){return arguments.length?(x=(w=+w)*w,k):Math.sqrt(x)},k.tapDistance=function(w){return arguments.length?(N=+w,k):N},k}var z=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(z||{}),Sn=(e=>(e.Partial="partial",e.Full="full",e))(Sn||{}),He=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(He||{}),Te=(e=>(e.Strict="strict",e.Loose="loose",e))(Te||{}),Nn=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(Nn||{}),ft=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(ft||{});const Is=["INPUT","SELECT","TEXTAREA"],Ps=typeof document<"u"?document:null;function Cn(e){var t,n;const o=((n=(t=e.composedPath)==null?void 0:t.call(e))==null?void 0:n[0])||e.target,i=typeof o?.hasAttribute=="function"?o.hasAttribute("contenteditable"):!1,r=typeof o?.closest=="function"?o.closest(".nokey"):null;return Is.includes(o?.nodeName)||i||!!r}function Ts(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Oo(e,t,n,o){const i=t.replace("+",`
1
+ (function(Ce,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],a):(Ce=typeof globalThis<"u"?globalThis:Ce||self,a(Ce["@stonecrop/node-editor"]={},Ce.Vue))})(this,(function(Ce,a){"use strict";function et(e){return a.getCurrentScope()?(a.onScopeDispose(e),!0):!1}function ke(e){return typeof e=="function"?e():a.unref(e)}const Ai=typeof window<"u"&&typeof document<"u",Oi=e=>typeof e<"u",zi=Object.prototype.toString,Ri=e=>zi.call(e)==="[object Object]",Hi=()=>{};function Li(e,t){function n(...o){return new Promise((i,r)=>{Promise.resolve(e(()=>t.apply(this,o),{fn:t,thisArg:this,args:o})).then(i).catch(r)})}return n}const Ln=e=>e();function Fi(e=Ln){const t=a.ref(!0);function n(){t.value=!1}function o(){t.value=!0}const i=(...r)=>{t.value&&e(...r)};return{isActive:a.readonly(t),pause:n,resume:o,eventFilter:i}}function Fn(e,t=!1,n="Timeout"){return new Promise((o,i)=>{setTimeout(t?()=>i(n):o,e)})}function Yi(e,t,n={}){const{eventFilter:o=Ln,...i}=n;return a.watch(e,Li(o,t),i)}function Ge(e,t,n={}){const{eventFilter:o,...i}=n,{eventFilter:r,pause:l,resume:s,isActive:u}=Fi(o);return{stop:Yi(e,t,{...i,eventFilter:r}),pause:l,resume:s,isActive:u}}function Gi(e,t={}){if(!a.isRef(e))return a.toRefs(e);const n=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const o in e.value)n[o]=a.customRef(()=>({get(){return e.value[o]},set(i){var r;if((r=ke(t.replaceRef))!=null?r:!0)if(Array.isArray(e.value)){const s=[...e.value];s[o]=i,e.value=s}else{const s={...e.value,[o]:i};Object.setPrototypeOf(s,Object.getPrototypeOf(e.value)),e.value=s}else e.value[o]=i}}));return n}function tn(e,t=!1){function n(f,{flush:h="sync",deep:p=!1,timeout:b,throwOnTimeout:x}={}){let N=null;const M=[new Promise(_=>{N=a.watch(e,C=>{f(C)!==t&&(N?.(),_(C))},{flush:h,deep:p,immediate:!0})})];return b!=null&&M.push(Fn(b,x).then(()=>ke(e)).finally(()=>N?.())),Promise.race(M)}function o(f,h){if(!a.isRef(f))return n(C=>C===f,h);const{flush:p="sync",deep:b=!1,timeout:x,throwOnTimeout:N}=h??{};let k=null;const _=[new Promise(C=>{k=a.watch([e,f],([A,P])=>{t!==(A===P)&&(k?.(),C(A))},{flush:p,deep:b,immediate:!0})})];return x!=null&&_.push(Fn(x,N).then(()=>ke(e)).finally(()=>(k?.(),ke(e)))),Promise.race(_)}function i(f){return n(h=>!!h,f)}function r(f){return o(null,f)}function l(f){return o(void 0,f)}function s(f){return n(Number.isNaN,f)}function u(f,h){return n(p=>{const b=Array.from(p);return b.includes(f)||b.includes(ke(f))},h)}function c(f){return d(1,f)}function d(f=1,h){let p=-1;return n(()=>(p+=1,p>=f),h)}return Array.isArray(ke(e))?{toMatch:n,toContains:u,changed:c,changedTimes:d,get not(){return tn(e,!t)}}:{toMatch:n,toBe:o,toBeTruthy:i,toBeNull:r,toBeNaN:s,toBeUndefined:l,changed:c,changedTimes:d,get not(){return tn(e,!t)}}}function nn(e){return tn(e)}function Xi(e){var t;const n=ke(e);return(t=n?.$el)!=null?t:n}const Yn=Ai?window:void 0;function Gn(...e){let t,n,o,i;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,o,i]=e,t=Yn):[t,n,o,i]=e,!t)return Hi;Array.isArray(n)||(n=[n]),Array.isArray(o)||(o=[o]);const r=[],l=()=>{r.forEach(d=>d()),r.length=0},s=(d,f,h,p)=>(d.addEventListener(f,h,p),()=>d.removeEventListener(f,h,p)),u=a.watch(()=>[Xi(t),ke(i)],([d,f])=>{if(l(),!d)return;const h=Ri(f)?{...f}:f;r.push(...n.flatMap(p=>o.map(b=>s(d,p,b,h))))},{immediate:!0,flush:"post"}),c=()=>{u(),l()};return et(c),c}function Ui(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function Xn(...e){let t,n,o={};e.length===3?(t=e[0],n=e[1],o=e[2]):e.length===2?typeof e[1]=="object"?(t=!0,n=e[0],o=e[1]):(t=e[0],n=e[1]):(t=!0,n=e[0]);const{target:i=Yn,eventName:r="keydown",passive:l=!1,dedupe:s=!1}=o,u=Ui(t);return Gn(i,r,d=>{d.repeat&&ke(s)||u(d)&&n(d)},l)}function Zi(e){return JSON.parse(JSON.stringify(e))}function on(e,t,n,o={}){var i,r,l;const{clone:s=!1,passive:u=!1,eventName:c,deep:d=!1,defaultValue:f,shouldEmit:h}=o,p=a.getCurrentInstance(),b=n||p?.emit||((i=p?.$emit)==null?void 0:i.bind(p))||((l=(r=p?.proxy)==null?void 0:r.$emit)==null?void 0:l.bind(p?.proxy));let x=c;t||(t="modelValue"),x=x||`update:${t.toString()}`;const N=_=>s?typeof s=="function"?s(_):Zi(_):_,k=()=>Oi(e[t])?N(e[t]):f,M=_=>{h?h(_)&&b(x,_):b(x,_)};if(u){const _=k(),C=a.ref(_);let A=!1;return a.watch(()=>e[t],P=>{A||(A=!0,C.value=N(P),a.nextTick(()=>A=!1))}),a.watch(C,P=>{!A&&(P!==e[t]||d)&&M(P)},{deep:d}),C}else return a.computed({get(){return k()},set(_){M(_)}})}var Wi={value:()=>{}};function _t(){for(var e=0,t=arguments.length,n={},o;e<t;++e){if(!(o=arguments[e]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new Et(n)}function Et(e){this._=e}function Ki(e,t){return e.trim().split(/^|\s+/).map(function(n){var o="",i=n.indexOf(".");if(i>=0&&(o=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}Et.prototype=_t.prototype={constructor:Et,on:function(e,t){var n=this._,o=Ki(e+"",n),i,r=-1,l=o.length;if(arguments.length<2){for(;++r<l;)if((i=(e=o[r]).type)&&(i=qi(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++r<l;)if(i=(e=o[r]).type)n[i]=Un(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Un(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Et(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),o=0,i,r;o<i;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(r=this._[e],o=0,i=r.length;o<i;++o)r[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],i=0,r=o.length;i<r;++i)o[i].value.apply(t,n)}};function qi(e,t){for(var n=0,o=e.length,i;n<o;++n)if((i=e[n]).name===t)return i.value}function Un(e,t,n){for(var o=0,i=e.length;o<i;++o)if(e[o].name===t){e[o]=Wi,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var rn="http://www.w3.org/1999/xhtml";const Zn={svg:"http://www.w3.org/2000/svg",xhtml:rn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function bt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Zn.hasOwnProperty(t)?{space:Zn[t],local:e}:e}function ji(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===rn&&t.documentElement.namespaceURI===rn?t.createElement(e):t.createElementNS(n,e)}}function Ji(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Wn(e){var t=bt(e);return(t.local?Ji:ji)(t)}function Qi(){}function ln(e){return e==null?Qi:function(){return this.querySelector(e)}}function er(e){typeof e!="function"&&(e=ln(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r=t[i],l=r.length,s=o[i]=new Array(l),u,c,d=0;d<l;++d)(u=r[d])&&(c=e.call(u,u.__data__,d,r))&&("__data__"in u&&(c.__data__=u.__data__),s[d]=c);return new me(o,this._parents)}function tr(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function nr(){return[]}function Kn(e){return e==null?nr:function(){return this.querySelectorAll(e)}}function or(e){return function(){return tr(e.apply(this,arguments))}}function ir(e){typeof e=="function"?e=or(e):e=Kn(e);for(var t=this._groups,n=t.length,o=[],i=[],r=0;r<n;++r)for(var l=t[r],s=l.length,u,c=0;c<s;++c)(u=l[c])&&(o.push(e.call(u,u.__data__,c,l)),i.push(u));return new me(o,i)}function qn(e){return function(){return this.matches(e)}}function jn(e){return function(t){return t.matches(e)}}var rr=Array.prototype.find;function lr(e){return function(){return rr.call(this.children,e)}}function ar(){return this.firstElementChild}function sr(e){return this.select(e==null?ar:lr(typeof e=="function"?e:jn(e)))}var ur=Array.prototype.filter;function cr(){return Array.from(this.children)}function dr(e){return function(){return ur.call(this.children,e)}}function fr(e){return this.selectAll(e==null?cr:dr(typeof e=="function"?e:jn(e)))}function hr(e){typeof e!="function"&&(e=qn(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r=t[i],l=r.length,s=o[i]=[],u,c=0;c<l;++c)(u=r[c])&&e.call(u,u.__data__,c,r)&&s.push(u);return new me(o,this._parents)}function Jn(e){return new Array(e.length)}function gr(){return new me(this._enter||this._groups.map(Jn),this._parents)}function xt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}xt.prototype={constructor:xt,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 mr(e,t,n,o,i,r){for(var l=0,s,u=t.length,c=r.length;l<c;++l)(s=t[l])?(s.__data__=r[l],o[l]=s):n[l]=new xt(e,r[l]);for(;l<u;++l)(s=t[l])&&(i[l]=s)}function yr(e,t,n,o,i,r,l){var s,u,c=new Map,d=t.length,f=r.length,h=new Array(d),p;for(s=0;s<d;++s)(u=t[s])&&(h[s]=p=l.call(u,u.__data__,s,t)+"",c.has(p)?i[s]=u:c.set(p,u));for(s=0;s<f;++s)p=l.call(e,r[s],s,r)+"",(u=c.get(p))?(o[s]=u,u.__data__=r[s],c.delete(p)):n[s]=new xt(e,r[s]);for(s=0;s<d;++s)(u=t[s])&&c.get(h[s])===u&&(i[s]=u)}function vr(e){return e.__data__}function wr(e,t){if(!arguments.length)return Array.from(this,vr);var n=t?yr:mr,o=this._parents,i=this._groups;typeof e!="function"&&(e=pr(e));for(var r=i.length,l=new Array(r),s=new Array(r),u=new Array(r),c=0;c<r;++c){var d=o[c],f=i[c],h=f.length,p=_r(e.call(d,d&&d.__data__,c,o)),b=p.length,x=s[c]=new Array(b),N=l[c]=new Array(b),k=u[c]=new Array(h);n(d,f,x,N,k,p,t);for(var M=0,_=0,C,A;M<b;++M)if(C=x[M]){for(M>=_&&(_=M+1);!(A=N[_])&&++_<b;);C._next=A||null}}return l=new me(l,o),l._enter=s,l._exit=u,l}function _r(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Er(){return new me(this._exit||this._groups.map(Jn),this._parents)}function br(e,t,n){var o=this.enter(),i=this,r=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?r.remove():n(r),o&&i?o.merge(i).order():i}function xr(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,i=n.length,r=o.length,l=Math.min(i,r),s=new Array(i),u=0;u<l;++u)for(var c=n[u],d=o[u],f=c.length,h=s[u]=new Array(f),p,b=0;b<f;++b)(p=c[b]||d[b])&&(h[b]=p);for(;u<i;++u)s[u]=n[u];return new me(s,this._parents)}function Sr(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],i=o.length-1,r=o[i],l;--i>=0;)(l=o[i])&&(r&&l.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(l,r),r=l);return this}function Nr(e){e||(e=Cr);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var n=this._groups,o=n.length,i=new Array(o),r=0;r<o;++r){for(var l=n[r],s=l.length,u=i[r]=new Array(s),c,d=0;d<s;++d)(c=l[d])&&(u[d]=c);u.sort(t)}return new me(i,this._parents).order()}function Cr(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function kr(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Mr(){return Array.from(this)}function Ir(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],i=0,r=o.length;i<r;++i){var l=o[i];if(l)return l}return null}function Pr(){let e=0;for(const t of this)++e;return e}function Tr(){return!this.node()}function $r(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var i=t[n],r=0,l=i.length,s;r<l;++r)(s=i[r])&&e.call(s,s.__data__,r,i);return this}function Dr(e){return function(){this.removeAttribute(e)}}function Br(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Vr(e,t){return function(){this.setAttribute(e,t)}}function Ar(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Or(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function zr(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 Rr(e,t){var n=bt(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?Br:Dr:typeof t=="function"?n.local?zr:Or:n.local?Ar:Vr)(n,t))}function Qn(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Hr(e){return function(){this.style.removeProperty(e)}}function Lr(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Fr(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Yr(e,t,n){return arguments.length>1?this.each((t==null?Hr:typeof t=="function"?Fr:Lr)(e,t,n??"")):Xe(this.node(),e)}function Xe(e,t){return e.style.getPropertyValue(t)||Qn(e).getComputedStyle(e,null).getPropertyValue(t)}function Gr(e){return function(){delete this[e]}}function Xr(e,t){return function(){this[e]=t}}function Ur(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?Gr:typeof t=="function"?Ur:Xr)(e,t)):this.node()[e]}function eo(e){return e.trim().split(/^|\s+/)}function an(e){return e.classList||new to(e)}function to(e){this._node=e,this._names=eo(e.getAttribute("class")||"")}to.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 no(e,t){for(var n=an(e),o=-1,i=t.length;++o<i;)n.add(t[o])}function oo(e,t){for(var n=an(e),o=-1,i=t.length;++o<i;)n.remove(t[o])}function Wr(e){return function(){no(this,e)}}function Kr(e){return function(){oo(this,e)}}function qr(e,t){return function(){(t.apply(this,arguments)?no:oo)(this,e)}}function jr(e,t){var n=eo(e+"");if(arguments.length<2){for(var o=an(this.node()),i=-1,r=n.length;++i<r;)if(!o.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?qr:t?Wr:Kr)(n,t))}function Jr(){this.textContent=""}function Qr(e){return function(){this.textContent=e}}function el(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function tl(e){return arguments.length?this.each(e==null?Jr:(typeof e=="function"?el:Qr)(e)):this.node().textContent}function nl(){this.innerHTML=""}function ol(e){return function(){this.innerHTML=e}}function il(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function rl(e){return arguments.length?this.each(e==null?nl:(typeof e=="function"?il:ol)(e)):this.node().innerHTML}function ll(){this.nextSibling&&this.parentNode.appendChild(this)}function al(){return this.each(ll)}function sl(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ul(){return this.each(sl)}function cl(e){var t=typeof e=="function"?e:Wn(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function dl(){return null}function fl(e,t){var n=typeof e=="function"?e:Wn(e),o=t==null?dl:typeof t=="function"?t:ln(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function hl(){var e=this.parentNode;e&&e.removeChild(this)}function gl(){return this.each(hl)}function pl(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ml(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function yl(e){return this.select(e?ml:pl)}function vl(e){return arguments.length?this.property("__data__",e):this.node().__data__}function wl(e){return function(t){e.call(this,t,this.__data__)}}function _l(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 El(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,i=t.length,r;n<i;++n)r=t[n],(!e.type||r.type===e.type)&&r.name===e.name?this.removeEventListener(r.type,r.listener,r.options):t[++o]=r;++o?t.length=o:delete this.__on}}}function bl(e,t,n){return function(){var o=this.__on,i,r=wl(t);if(o){for(var l=0,s=o.length;l<s;++l)if((i=o[l]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=r,i.options=n),i.value=t;return}}this.addEventListener(e.type,r,n),i={type:e.type,name:e.name,value:t,listener:r,options:n},o?o.push(i):this.__on=[i]}}function xl(e,t,n){var o=_l(e+""),i,r=o.length,l;if(arguments.length<2){var s=this.node().__on;if(s){for(var u=0,c=s.length,d;u<c;++u)for(i=0,d=s[u];i<r;++i)if((l=o[i]).type===d.type&&l.name===d.name)return d.value}return}for(s=t?bl:El,i=0;i<r;++i)this.each(s(o[i],t,n));return this}function io(e,t,n){var o=Qn(e),i=o.CustomEvent;typeof i=="function"?i=new i(t,n):(i=o.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function Sl(e,t){return function(){return io(this,e,t)}}function Nl(e,t){return function(){return io(this,e,t.apply(this,arguments))}}function Cl(e,t){return this.each((typeof t=="function"?Nl:Sl)(e,t))}function*kl(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],i=0,r=o.length,l;i<r;++i)(l=o[i])&&(yield l)}var ro=[null];function me(e,t){this._groups=e,this._parents=t}function tt(){return new me([[document.documentElement]],ro)}function Ml(){return this}me.prototype=tt.prototype={constructor:me,select:er,selectAll:ir,selectChild:sr,selectChildren:fr,filter:hr,data:wr,enter:gr,exit:Er,join:br,merge:xr,selection:Ml,order:Sr,sort:Nr,call:kr,nodes:Mr,node:Ir,size:Pr,empty:Tr,each:$r,attr:Rr,style:Yr,property:Zr,classed:jr,text:tl,html:rl,raise:al,lower:ul,append:cl,insert:fl,remove:gl,clone:yl,datum:vl,on:xl,dispatch:Cl,[Symbol.iterator]:kl};function ye(e){return typeof e=="string"?new me([[document.querySelector(e)]],[document.documentElement]):new me([[e]],ro)}function Il(e){let t;for(;t=e.sourceEvent;)e=t;return e}function _e(e,t){if(e=Il(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 i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}const Pl={passive:!1},nt={capture:!0,passive:!1};function sn(e){e.stopImmediatePropagation()}function Ue(e){e.preventDefault(),e.stopImmediatePropagation()}function lo(e){var t=e.document.documentElement,n=ye(e).on("dragstart.drag",Ue,nt);"onselectstart"in t?n.on("selectstart.drag",Ue,nt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function ao(e,t){var n=e.document.documentElement,o=ye(e).on("dragstart.drag",null);t&&(o.on("click.drag",Ue,nt),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const St=e=>()=>e;function un(e,{sourceEvent:t,subject:n,target:o,identifier:i,active:r,x:l,y:s,dx:u,dy:c,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:i,enumerable:!0,configurable:!0},active:{value:r,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:d}})}un.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Tl(e){return!e.ctrlKey&&!e.button}function $l(){return this.parentNode}function Dl(e,t){return t??{x:e.x,y:e.y}}function Bl(){return navigator.maxTouchPoints||"ontouchstart"in this}function Vl(){var e=Tl,t=$l,n=Dl,o=Bl,i={},r=_t("start","drag","end"),l=0,s,u,c,d,f=0;function h(C){C.on("mousedown.drag",p).filter(o).on("touchstart.drag",N).on("touchmove.drag",k,Pl).on("touchend.drag touchcancel.drag",M).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(C,A){if(!(d||!e.call(this,C,A))){var P=_(this,t.call(this,C,A),C,A,"mouse");P&&(ye(C.view).on("mousemove.drag",b,nt).on("mouseup.drag",x,nt),lo(C.view),sn(C),c=!1,s=C.clientX,u=C.clientY,P("start",C))}}function b(C){if(Ue(C),!c){var A=C.clientX-s,P=C.clientY-u;c=A*A+P*P>f}i.mouse("drag",C)}function x(C){ye(C.view).on("mousemove.drag mouseup.drag",null),ao(C.view,c),Ue(C),i.mouse("end",C)}function N(C,A){if(e.call(this,C,A)){var P=C.changedTouches,$=t.call(this,C,A),D=P.length,K,F;for(K=0;K<D;++K)(F=_(this,$,C,A,P[K].identifier,P[K]))&&(sn(C),F("start",C,P[K]))}}function k(C){var A=C.changedTouches,P=A.length,$,D;for($=0;$<P;++$)(D=i[A[$].identifier])&&(Ue(C),D("drag",C,A[$]))}function M(C){var A=C.changedTouches,P=A.length,$,D;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),$=0;$<P;++$)(D=i[A[$].identifier])&&(sn(C),D("end",C,A[$]))}function _(C,A,P,$,D,K){var F=r.copy(),O=_e(K||P,A),E,J,w;if((w=n.call(C,new un("beforestart",{sourceEvent:P,target:h,identifier:D,active:l,x:O[0],y:O[1],dx:0,dy:0,dispatch:F}),$))!=null)return E=w.x-O[0]||0,J=w.y-O[1]||0,function T(S,B,V){var z=O,H;switch(S){case"start":i[D]=T,H=l++;break;case"end":delete i[D],--l;case"drag":O=_e(V||B,A),H=l;break}F.call(S,C,new un(S,{sourceEvent:B,subject:w,target:h,identifier:D,active:H,x:O[0]+E,y:O[1]+J,dx:O[0]-z[0],dy:O[1]-z[1],dispatch:F}),$)}}return h.filter=function(C){return arguments.length?(e=typeof C=="function"?C:St(!!C),h):e},h.container=function(C){return arguments.length?(t=typeof C=="function"?C:St(C),h):t},h.subject=function(C){return arguments.length?(n=typeof C=="function"?C:St(C),h):n},h.touchable=function(C){return arguments.length?(o=typeof C=="function"?C:St(!!C),h):o},h.on=function(){var C=r.on.apply(r,arguments);return C===r?h:C},h.clickDistance=function(C){return arguments.length?(f=(C=+C)*C,h):Math.sqrt(f)},h}function cn(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function so(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function ot(){}var it=.7,Nt=1/it,Ze="\\s*([+-]?\\d+)\\s*",rt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ee="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Al=/^#([0-9a-f]{3,8})$/,Ol=new RegExp(`^rgb\\(${Ze},${Ze},${Ze}\\)$`),zl=new RegExp(`^rgb\\(${Ee},${Ee},${Ee}\\)$`),Rl=new RegExp(`^rgba\\(${Ze},${Ze},${Ze},${rt}\\)$`),Hl=new RegExp(`^rgba\\(${Ee},${Ee},${Ee},${rt}\\)$`),Ll=new RegExp(`^hsl\\(${rt},${Ee},${Ee}\\)$`),Fl=new RegExp(`^hsla\\(${rt},${Ee},${Ee},${rt}\\)$`),uo={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};cn(ot,Ae,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:co,formatHex:co,formatHex8:Yl,formatHsl:Gl,formatRgb:fo,toString:fo});function co(){return this.rgb().formatHex()}function Yl(){return this.rgb().formatHex8()}function Gl(){return yo(this).formatHsl()}function fo(){return this.rgb().formatRgb()}function Ae(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Al.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?ho(t):n===3?new pe(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Ct(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Ct(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Ol.exec(e))?new pe(t[1],t[2],t[3],1):(t=zl.exec(e))?new pe(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Rl.exec(e))?Ct(t[1],t[2],t[3],t[4]):(t=Hl.exec(e))?Ct(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Ll.exec(e))?mo(t[1],t[2]/100,t[3]/100,1):(t=Fl.exec(e))?mo(t[1],t[2]/100,t[3]/100,t[4]):uo.hasOwnProperty(e)?ho(uo[e]):e==="transparent"?new pe(NaN,NaN,NaN,0):null}function ho(e){return new pe(e>>16&255,e>>8&255,e&255,1)}function Ct(e,t,n,o){return o<=0&&(e=t=n=NaN),new pe(e,t,n,o)}function Xl(e){return e instanceof ot||(e=Ae(e)),e?(e=e.rgb(),new pe(e.r,e.g,e.b,e.opacity)):new pe}function dn(e,t,n,o){return arguments.length===1?Xl(e):new pe(e,t,n,o??1)}function pe(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}cn(pe,dn,so(ot,{brighter(e){return e=e==null?Nt:Math.pow(Nt,e),new pe(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?it:Math.pow(it,e),new pe(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new pe(Oe(this.r),Oe(this.g),Oe(this.b),kt(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:go,formatHex:go,formatHex8:Ul,formatRgb:po,toString:po}));function go(){return`#${ze(this.r)}${ze(this.g)}${ze(this.b)}`}function Ul(){return`#${ze(this.r)}${ze(this.g)}${ze(this.b)}${ze((isNaN(this.opacity)?1:this.opacity)*255)}`}function po(){const e=kt(this.opacity);return`${e===1?"rgb(":"rgba("}${Oe(this.r)}, ${Oe(this.g)}, ${Oe(this.b)}${e===1?")":`, ${e})`}`}function kt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Oe(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ze(e){return e=Oe(e),(e<16?"0":"")+e.toString(16)}function mo(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ve(e,t,n,o)}function yo(e){if(e instanceof ve)return new ve(e.h,e.s,e.l,e.opacity);if(e instanceof ot||(e=Ae(e)),!e)return new ve;if(e instanceof ve)return e;e=e.rgb();var t=e.r/255,n=e.g/255,o=e.b/255,i=Math.min(t,n,o),r=Math.max(t,n,o),l=NaN,s=r-i,u=(r+i)/2;return s?(t===r?l=(n-o)/s+(n<o)*6:n===r?l=(o-t)/s+2:l=(t-n)/s+4,s/=u<.5?r+i:2-r-i,l*=60):s=u>0&&u<1?0:l,new ve(l,s,u,e.opacity)}function Zl(e,t,n,o){return arguments.length===1?yo(e):new ve(e,t,n,o??1)}function ve(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}cn(ve,Zl,so(ot,{brighter(e){return e=e==null?Nt:Math.pow(Nt,e),new ve(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?it:Math.pow(it,e),new ve(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,i=2*n-o;return new pe(fn(e>=240?e-240:e+120,i,o),fn(e,i,o),fn(e<120?e+240:e-120,i,o),this.opacity)},clamp(){return new ve(vo(this.h),Mt(this.s),Mt(this.l),kt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=kt(this.opacity);return`${e===1?"hsl(":"hsla("}${vo(this.h)}, ${Mt(this.s)*100}%, ${Mt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function vo(e){return e=(e||0)%360,e<0?e+360:e}function Mt(e){return Math.max(0,Math.min(1,e||0))}function fn(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const hn=e=>()=>e;function Wl(e,t){return function(n){return e+n*t}}function Kl(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}function ql(e){return(e=+e)==1?wo:function(t,n){return n-t?Kl(t,n,e):hn(isNaN(t)?n:t)}}function wo(e,t){var n=t-e;return n?Wl(e,n):hn(isNaN(e)?t:e)}const It=(function e(t){var n=ql(t);function o(i,r){var l=n((i=dn(i)).r,(r=dn(r)).r),s=n(i.g,r.g),u=n(i.b,r.b),c=wo(i.opacity,r.opacity);return function(d){return i.r=l(d),i.g=s(d),i.b=u(d),i.opacity=c(d),i+""}}return o.gamma=e,o})(1);function jl(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,o=t.slice(),i;return function(r){for(i=0;i<n;++i)o[i]=e[i]*(1-r)+t[i]*r;return o}}function Jl(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Ql(e,t){var n=t?t.length:0,o=e?Math.min(n,e.length):0,i=new Array(o),r=new Array(n),l;for(l=0;l<o;++l)i[l]=lt(e[l],t[l]);for(;l<n;++l)r[l]=t[l];return function(s){for(l=0;l<o;++l)r[l]=i[l](s);return r}}function ea(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function be(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function ta(e,t){var n={},o={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?n[i]=lt(e[i],t[i]):o[i]=t[i];return function(r){for(i in n)o[i]=n[i](r);return o}}var gn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,pn=new RegExp(gn.source,"g");function na(e){return function(){return e}}function oa(e){return function(t){return e(t)+""}}function _o(e,t){var n=gn.lastIndex=pn.lastIndex=0,o,i,r,l=-1,s=[],u=[];for(e=e+"",t=t+"";(o=gn.exec(e))&&(i=pn.exec(t));)(r=i.index)>n&&(r=t.slice(n,r),s[l]?s[l]+=r:s[++l]=r),(o=o[0])===(i=i[0])?s[l]?s[l]+=i:s[++l]=i:(s[++l]=null,u.push({i:l,x:be(o,i)})),n=pn.lastIndex;return n<t.length&&(r=t.slice(n),s[l]?s[l]+=r:s[++l]=r),s.length<2?u[0]?oa(u[0].x):na(t):(t=u.length,function(c){for(var d=0,f;d<t;++d)s[(f=u[d]).i]=f.x(c);return s.join("")})}function lt(e,t){var n=typeof t,o;return t==null||n==="boolean"?hn(t):(n==="number"?be:n==="string"?(o=Ae(t))?(t=o,It):_o:t instanceof Ae?It:t instanceof Date?ea:Jl(t)?jl:Array.isArray(t)?Ql:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?ta:be)(e,t)}var Eo=180/Math.PI,mn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function bo(e,t,n,o,i,r){var l,s,u;return(l=Math.sqrt(e*e+t*t))&&(e/=l,t/=l),(u=e*n+t*o)&&(n-=e*u,o-=t*u),(s=Math.sqrt(n*n+o*o))&&(n/=s,o/=s,u/=s),e*o<t*n&&(e=-e,t=-t,u=-u,l=-l),{translateX:i,translateY:r,rotate:Math.atan2(t,e)*Eo,skewX:Math.atan(u)*Eo,scaleX:l,scaleY:s}}var Pt;function ia(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?mn:bo(t.a,t.b,t.c,t.d,t.e,t.f)}function ra(e){return e==null||(Pt||(Pt=document.createElementNS("http://www.w3.org/2000/svg","g")),Pt.setAttribute("transform",e),!(e=Pt.transform.baseVal.consolidate()))?mn:(e=e.matrix,bo(e.a,e.b,e.c,e.d,e.e,e.f))}function xo(e,t,n,o){function i(c){return c.length?c.pop()+" ":""}function r(c,d,f,h,p,b){if(c!==f||d!==h){var x=p.push("translate(",null,t,null,n);b.push({i:x-4,x:be(c,f)},{i:x-2,x:be(d,h)})}else(f||h)&&p.push("translate("+f+t+h+n)}function l(c,d,f,h){c!==d?(c-d>180?d+=360:d-c>180&&(c+=360),h.push({i:f.push(i(f)+"rotate(",null,o)-2,x:be(c,d)})):d&&f.push(i(f)+"rotate("+d+o)}function s(c,d,f,h){c!==d?h.push({i:f.push(i(f)+"skewX(",null,o)-2,x:be(c,d)}):d&&f.push(i(f)+"skewX("+d+o)}function u(c,d,f,h,p,b){if(c!==f||d!==h){var x=p.push(i(p)+"scale(",null,",",null,")");b.push({i:x-4,x:be(c,f)},{i:x-2,x:be(d,h)})}else(f!==1||h!==1)&&p.push(i(p)+"scale("+f+","+h+")")}return function(c,d){var f=[],h=[];return c=e(c),d=e(d),r(c.translateX,c.translateY,d.translateX,d.translateY,f,h),l(c.rotate,d.rotate,f,h),s(c.skewX,d.skewX,f,h),u(c.scaleX,c.scaleY,d.scaleX,d.scaleY,f,h),c=d=null,function(p){for(var b=-1,x=h.length,N;++b<x;)f[(N=h[b]).i]=N.x(p);return f.join("")}}}var la=xo(ia,"px, ","px)","deg)"),aa=xo(ra,", ",")",")"),sa=1e-12;function So(e){return((e=Math.exp(e))+1/e)/2}function ua(e){return((e=Math.exp(e))-1/e)/2}function ca(e){return((e=Math.exp(2*e))-1)/(e+1)}const Tt=(function e(t,n,o){function i(r,l){var s=r[0],u=r[1],c=r[2],d=l[0],f=l[1],h=l[2],p=d-s,b=f-u,x=p*p+b*b,N,k;if(x<sa)k=Math.log(h/c)/t,N=function($){return[s+$*p,u+$*b,c*Math.exp(t*$*k)]};else{var M=Math.sqrt(x),_=(h*h-c*c+o*x)/(2*c*n*M),C=(h*h-c*c-o*x)/(2*h*n*M),A=Math.log(Math.sqrt(_*_+1)-_),P=Math.log(Math.sqrt(C*C+1)-C);k=(P-A)/t,N=function($){var D=$*k,K=So(A),F=c/(n*M)*(K*ca(t*D+A)-ua(A));return[s+F*p,u+F*b,c*K/So(t*D+A)]}}return N.duration=k*1e3*t/Math.SQRT2,N}return i.rho=function(r){var l=Math.max(.001,+r),s=l*l,u=s*s;return e(l,s,u)},i})(Math.SQRT2,2,4);var We=0,at=0,st=0,No=1e3,$t,ut,Dt=0,Re=0,Bt=0,ct=typeof performance=="object"&&performance.now?performance:Date,Co=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function yn(){return Re||(Co(da),Re=ct.now()+Bt)}function da(){Re=0}function Vt(){this._call=this._time=this._next=null}Vt.prototype=ko.prototype={constructor:Vt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?yn():+n)+(t==null?0:+t),!this._next&&ut!==this&&(ut?ut._next=this:$t=this,ut=this),this._call=e,this._time=n,vn()},stop:function(){this._call&&(this._call=null,this._time=1/0,vn())}};function ko(e,t,n){var o=new Vt;return o.restart(e,t,n),o}function fa(){yn(),++We;for(var e=$t,t;e;)(t=Re-e._time)>=0&&e._call.call(void 0,t),e=e._next;--We}function Mo(){Re=(Dt=ct.now())+Bt,We=at=0;try{fa()}finally{We=0,ga(),Re=0}}function ha(){var e=ct.now(),t=e-Dt;t>No&&(Bt-=t,Dt=e)}function ga(){for(var e,t=$t,n,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:$t=n);ut=e,vn(o)}function vn(e){if(!We){at&&(at=clearTimeout(at));var t=e-Re;t>24?(e<1/0&&(at=setTimeout(Mo,e-ct.now()-Bt)),st&&(st=clearInterval(st))):(st||(Dt=ct.now(),st=setInterval(ha,No)),We=1,Co(Mo))}}function Io(e,t,n){var o=new Vt;return t=t==null?0:+t,o.restart(i=>{o.stop(),e(i+t)},t,n),o}var pa=_t("start","end","cancel","interrupt"),ma=[],Po=0,To=1,wn=2,At=3,$o=4,_n=5,Ot=6;function zt(e,t,n,o,i,r){var l=e.__transition;if(!l)e.__transition={};else if(n in l)return;ya(e,n,{name:t,index:o,group:i,on:pa,tween:ma,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Po})}function En(e,t){var n=we(e,t);if(n.state>Po)throw new Error("too late; already scheduled");return n}function xe(e,t){var n=we(e,t);if(n.state>At)throw new Error("too late; already running");return n}function we(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function ya(e,t,n){var o=e.__transition,i;o[t]=n,n.timer=ko(r,0,n.time);function r(c){n.state=To,n.timer.restart(l,n.delay,n.time),n.delay<=c&&l(c-n.delay)}function l(c){var d,f,h,p;if(n.state!==To)return u();for(d in o)if(p=o[d],p.name===n.name){if(p.state===At)return Io(l);p.state===$o?(p.state=Ot,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete o[d]):+d<t&&(p.state=Ot,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete o[d])}if(Io(function(){n.state===At&&(n.state=$o,n.timer.restart(s,n.delay,n.time),s(c))}),n.state=wn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===wn){for(n.state=At,i=new Array(h=n.tween.length),d=0,f=-1;d<h;++d)(p=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(i[++f]=p);i.length=f+1}}function s(c){for(var d=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(u),n.state=_n,1),f=-1,h=i.length;++f<h;)i[f].call(e,d);n.state===_n&&(n.on.call("end",e,e.__data__,n.index,n.group),u())}function u(){n.state=Ot,n.timer.stop(),delete o[t];for(var c in o)return;delete e.__transition}}function Rt(e,t){var n=e.__transition,o,i,r=!0,l;if(n){t=t==null?null:t+"";for(l in n){if((o=n[l]).name!==t){r=!1;continue}i=o.state>wn&&o.state<_n,o.state=Ot,o.timer.stop(),o.on.call(i?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[l]}r&&delete e.__transition}}function va(e){return this.each(function(){Rt(this,e)})}function wa(e,t){var n,o;return function(){var i=xe(this,e),r=i.tween;if(r!==n){o=n=r;for(var l=0,s=o.length;l<s;++l)if(o[l].name===t){o=o.slice(),o.splice(l,1);break}}i.tween=o}}function _a(e,t,n){var o,i;if(typeof n!="function")throw new Error;return function(){var r=xe(this,e),l=r.tween;if(l!==o){i=(o=l).slice();for(var s={name:t,value:n},u=0,c=i.length;u<c;++u)if(i[u].name===t){i[u]=s;break}u===c&&i.push(s)}r.tween=i}}function Ea(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=we(this.node(),n).tween,i=0,r=o.length,l;i<r;++i)if((l=o[i]).name===e)return l.value;return null}return this.each((t==null?wa:_a)(n,e,t))}function bn(e,t,n){var o=e._id;return e.each(function(){var i=xe(this,o);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return we(i,o).value[t]}}function Do(e,t){var n;return(typeof t=="number"?be:t instanceof Ae?It:(n=Ae(t))?(t=n,It):_o)(e,t)}function ba(e){return function(){this.removeAttribute(e)}}function xa(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Sa(e,t,n){var o,i=n+"",r;return function(){var l=this.getAttribute(e);return l===i?null:l===o?r:r=t(o=l,n)}}function Na(e,t,n){var o,i=n+"",r;return function(){var l=this.getAttributeNS(e.space,e.local);return l===i?null:l===o?r:r=t(o=l,n)}}function Ca(e,t,n){var o,i,r;return function(){var l,s=n(this),u;return s==null?void this.removeAttribute(e):(l=this.getAttribute(e),u=s+"",l===u?null:l===o&&u===i?r:(i=u,r=t(o=l,s)))}}function ka(e,t,n){var o,i,r;return function(){var l,s=n(this),u;return s==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),u=s+"",l===u?null:l===o&&u===i?r:(i=u,r=t(o=l,s)))}}function Ma(e,t){var n=bt(e),o=n==="transform"?aa:Do;return this.attrTween(e,typeof t=="function"?(n.local?ka:Ca)(n,o,bn(this,"attr."+e,t)):t==null?(n.local?xa:ba)(n):(n.local?Na:Sa)(n,o,t))}function Ia(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Pa(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Ta(e,t){var n,o;function i(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&Pa(e,r)),n}return i._value=t,i}function $a(e,t){var n,o;function i(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&Ia(e,r)),n}return i._value=t,i}function Da(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=bt(e);return this.tween(n,(o.local?Ta:$a)(o,t))}function Ba(e,t){return function(){En(this,e).delay=+t.apply(this,arguments)}}function Va(e,t){return t=+t,function(){En(this,e).delay=t}}function Aa(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Ba:Va)(t,e)):we(this.node(),t).delay}function Oa(e,t){return function(){xe(this,e).duration=+t.apply(this,arguments)}}function za(e,t){return t=+t,function(){xe(this,e).duration=t}}function Ra(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Oa:za)(t,e)):we(this.node(),t).duration}function Ha(e,t){if(typeof t!="function")throw new Error;return function(){xe(this,e).ease=t}}function La(e){var t=this._id;return arguments.length?this.each(Ha(t,e)):we(this.node(),t).ease}function Fa(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;xe(this,e).ease=n}}function Ya(e){if(typeof e!="function")throw new Error;return this.each(Fa(this._id,e))}function Ga(e){typeof e!="function"&&(e=qn(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r=t[i],l=r.length,s=o[i]=[],u,c=0;c<l;++c)(u=r[c])&&e.call(u,u.__data__,c,r)&&s.push(u);return new Me(o,this._parents,this._name,this._id)}function Xa(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,i=n.length,r=Math.min(o,i),l=new Array(o),s=0;s<r;++s)for(var u=t[s],c=n[s],d=u.length,f=l[s]=new Array(d),h,p=0;p<d;++p)(h=u[p]||c[p])&&(f[p]=h);for(;s<o;++s)l[s]=t[s];return new Me(l,this._parents,this._name,this._id)}function Ua(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 Za(e,t,n){var o,i,r=Ua(t)?En:xe;return function(){var l=r(this,e),s=l.on;s!==o&&(i=(o=s).copy()).on(t,n),l.on=i}}function Wa(e,t){var n=this._id;return arguments.length<2?we(this.node(),n).on.on(e):this.each(Za(n,e,t))}function Ka(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function qa(){return this.on("end.remove",Ka(this._id))}function ja(e){var t=this._name,n=this._id;typeof e!="function"&&(e=ln(e));for(var o=this._groups,i=o.length,r=new Array(i),l=0;l<i;++l)for(var s=o[l],u=s.length,c=r[l]=new Array(u),d,f,h=0;h<u;++h)(d=s[h])&&(f=e.call(d,d.__data__,h,s))&&("__data__"in d&&(f.__data__=d.__data__),c[h]=f,zt(c[h],t,n,h,c,we(d,n)));return new Me(r,this._parents,t,n)}function Ja(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Kn(e));for(var o=this._groups,i=o.length,r=[],l=[],s=0;s<i;++s)for(var u=o[s],c=u.length,d,f=0;f<c;++f)if(d=u[f]){for(var h=e.call(d,d.__data__,f,u),p,b=we(d,n),x=0,N=h.length;x<N;++x)(p=h[x])&&zt(p,t,n,x,h,b);r.push(h),l.push(d)}return new Me(r,l,t,n)}var Qa=tt.prototype.constructor;function es(){return new Qa(this._groups,this._parents)}function ts(e,t){var n,o,i;return function(){var r=Xe(this,e),l=(this.style.removeProperty(e),Xe(this,e));return r===l?null:r===n&&l===o?i:i=t(n=r,o=l)}}function Bo(e){return function(){this.style.removeProperty(e)}}function ns(e,t,n){var o,i=n+"",r;return function(){var l=Xe(this,e);return l===i?null:l===o?r:r=t(o=l,n)}}function os(e,t,n){var o,i,r;return function(){var l=Xe(this,e),s=n(this),u=s+"";return s==null&&(u=s=(this.style.removeProperty(e),Xe(this,e))),l===u?null:l===o&&u===i?r:(i=u,r=t(o=l,s))}}function is(e,t){var n,o,i,r="style."+t,l="end."+r,s;return function(){var u=xe(this,e),c=u.on,d=u.value[r]==null?s||(s=Bo(t)):void 0;(c!==n||i!==d)&&(o=(n=c).copy()).on(l,i=d),u.on=o}}function rs(e,t,n){var o=(e+="")=="transform"?la:Do;return t==null?this.styleTween(e,ts(e,o)).on("end.style."+e,Bo(e)):typeof t=="function"?this.styleTween(e,os(e,o,bn(this,"style."+e,t))).each(is(this._id,e)):this.styleTween(e,ns(e,o,t),n).on("end.style."+e,null)}function ls(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function as(e,t,n){var o,i;function r(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&ls(e,l,n)),o}return r._value=t,r}function ss(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,as(e,t,n??""))}function us(e){return function(){this.textContent=e}}function cs(e){return function(){var t=e(this);this.textContent=t??""}}function ds(e){return this.tween("text",typeof e=="function"?cs(bn(this,"text",e)):us(e==null?"":e+""))}function fs(e){return function(t){this.textContent=e.call(this,t)}}function hs(e){var t,n;function o(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&fs(i)),t}return o._value=e,o}function gs(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,hs(e))}function ps(){for(var e=this._name,t=this._id,n=Vo(),o=this._groups,i=o.length,r=0;r<i;++r)for(var l=o[r],s=l.length,u,c=0;c<s;++c)if(u=l[c]){var d=we(u,t);zt(u,e,n,c,l,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new Me(o,this._parents,e,n)}function ms(){var e,t,n=this,o=n._id,i=n.size();return new Promise(function(r,l){var s={value:l},u={value:function(){--i===0&&r()}};n.each(function(){var c=xe(this,o),d=c.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(u)),c.on=t}),i===0&&r()})}var ys=0;function Me(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Vo(){return++ys}var Ie=tt.prototype;Me.prototype={constructor:Me,select:ja,selectAll:Ja,selectChild:Ie.selectChild,selectChildren:Ie.selectChildren,filter:Ga,merge:Xa,selection:es,transition:ps,call:Ie.call,nodes:Ie.nodes,node:Ie.node,size:Ie.size,empty:Ie.empty,each:Ie.each,on:Wa,attr:Ma,attrTween:Da,style:rs,styleTween:ss,text:ds,textTween:gs,remove:qa,tween:Ea,delay:Aa,duration:Ra,ease:La,easeVarying:Ya,end:ms,[Symbol.iterator]:Ie[Symbol.iterator]};function vs(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var ws={time:null,delay:0,duration:250,ease:vs};function _s(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 Es(e){var t,n;e instanceof Me?(t=e._id,e=e._name):(t=Vo(),(n=ws).time=yn(),e=e==null?null:e+"");for(var o=this._groups,i=o.length,r=0;r<i;++r)for(var l=o[r],s=l.length,u,c=0;c<s;++c)(u=l[c])&&zt(u,e,t,c,l,n||_s(u,t));return new Me(o,this._parents,e,t)}tt.prototype.interrupt=va,tt.prototype.transition=Es;const Ht=e=>()=>e;function bs(e,{sourceEvent:t,target:n,transform:o,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:i}})}function Pe(e,t,n){this.k=e,this.x=t,this.y=n}Pe.prototype={constructor:Pe,scale:function(e){return e===1?this:new Pe(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Pe(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 Ke=new Pe(1,0,0);Pe.prototype;function xn(e){e.stopImmediatePropagation()}function dt(e){e.preventDefault(),e.stopImmediatePropagation()}function xs(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Ss(){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 Ao(){return this.__zoom||Ke}function Ns(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Cs(){return navigator.maxTouchPoints||"ontouchstart"in this}function ks(e,t,n){var o=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],r=e.invertY(t[0][1])-n[0][1],l=e.invertY(t[1][1])-n[1][1];return e.translate(i>o?(o+i)/2:Math.min(0,o)||Math.max(0,i),l>r?(r+l)/2:Math.min(0,r)||Math.max(0,l))}function Ms(){var e=xs,t=Ss,n=ks,o=Ns,i=Cs,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,u=Tt,c=_t("start","zoom","end"),d,f,h,p=500,b=150,x=0,N=10;function k(w){w.property("__zoom",Ao).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",K).on("dblclick.zoom",F).filter(i).on("touchstart.zoom",O).on("touchmove.zoom",E).on("touchend.zoom touchcancel.zoom",J).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}k.transform=function(w,T,S,B){var V=w.selection?w.selection():w;V.property("__zoom",Ao),w!==V?A(w,T,S,B):V.interrupt().each(function(){P(this,arguments).event(B).start().zoom(null,typeof T=="function"?T.apply(this,arguments):T).end()})},k.scaleBy=function(w,T,S,B){k.scaleTo(w,function(){var V=this.__zoom.k,z=typeof T=="function"?T.apply(this,arguments):T;return V*z},S,B)},k.scaleTo=function(w,T,S,B){k.transform(w,function(){var V=t.apply(this,arguments),z=this.__zoom,H=S==null?C(V):typeof S=="function"?S.apply(this,arguments):S,U=z.invert(H),Q=typeof T=="function"?T.apply(this,arguments):T;return n(_(M(z,Q),H,U),V,l)},S,B)},k.translateBy=function(w,T,S,B){k.transform(w,function(){return n(this.__zoom.translate(typeof T=="function"?T.apply(this,arguments):T,typeof S=="function"?S.apply(this,arguments):S),t.apply(this,arguments),l)},null,B)},k.translateTo=function(w,T,S,B,V){k.transform(w,function(){var z=t.apply(this,arguments),H=this.__zoom,U=B==null?C(z):typeof B=="function"?B.apply(this,arguments):B;return n(Ke.translate(U[0],U[1]).scale(H.k).translate(typeof T=="function"?-T.apply(this,arguments):-T,typeof S=="function"?-S.apply(this,arguments):-S),z,l)},B,V)};function M(w,T){return T=Math.max(r[0],Math.min(r[1],T)),T===w.k?w:new Pe(T,w.x,w.y)}function _(w,T,S){var B=T[0]-S[0]*w.k,V=T[1]-S[1]*w.k;return B===w.x&&V===w.y?w:new Pe(w.k,B,V)}function C(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function A(w,T,S,B){w.on("start.zoom",function(){P(this,arguments).event(B).start()}).on("interrupt.zoom end.zoom",function(){P(this,arguments).event(B).end()}).tween("zoom",function(){var V=this,z=arguments,H=P(V,z).event(B),U=t.apply(V,z),Q=S==null?C(U):typeof S=="function"?S.apply(V,z):S,te=Math.max(U[1][0]-U[0][0],U[1][1]-U[0][1]),ie=V.__zoom,G=typeof T=="function"?T.apply(V,z):T,Z=u(ie.invert(Q).concat(te/ie.k),G.invert(Q).concat(te/G.k));return function(j){if(j===1)j=G;else{var ae=Z(j),oe=te/ae[2];j=new Pe(oe,Q[0]-ae[0]*oe,Q[1]-ae[1]*oe)}H.zoom(null,j)}})}function P(w,T,S){return!S&&w.__zooming||new $(w,T)}function $(w,T){this.that=w,this.args=T,this.active=0,this.sourceEvent=null,this.extent=t.apply(w,T),this.taps=0}$.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,T){return this.mouse&&w!=="mouse"&&(this.mouse[1]=T.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=T.invert(this.touch0[0])),this.touch1&&w!=="touch"&&(this.touch1[1]=T.invert(this.touch1[0])),this.that.__zoom=T,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(w){var T=ye(this.that).datum();c.call(w,this.that,new bs(w,{sourceEvent:this.sourceEvent,target:k,transform:this.that.__zoom,dispatch:c}),T)}};function D(w,...T){if(!e.apply(this,arguments))return;var S=P(this,T).event(w),B=this.__zoom,V=Math.max(r[0],Math.min(r[1],B.k*Math.pow(2,o.apply(this,arguments)))),z=_e(w);if(S.wheel)(S.mouse[0][0]!==z[0]||S.mouse[0][1]!==z[1])&&(S.mouse[1]=B.invert(S.mouse[0]=z)),clearTimeout(S.wheel);else{if(B.k===V)return;S.mouse=[z,B.invert(z)],Rt(this),S.start()}dt(w),S.wheel=setTimeout(H,b),S.zoom("mouse",n(_(M(B,V),S.mouse[0],S.mouse[1]),S.extent,l));function H(){S.wheel=null,S.end()}}function K(w,...T){if(h||!e.apply(this,arguments))return;var S=w.currentTarget,B=P(this,T,!0).event(w),V=ye(w.view).on("mousemove.zoom",Q,!0).on("mouseup.zoom",te,!0),z=_e(w,S),H=w.clientX,U=w.clientY;lo(w.view),xn(w),B.mouse=[z,this.__zoom.invert(z)],Rt(this),B.start();function Q(ie){if(dt(ie),!B.moved){var G=ie.clientX-H,Z=ie.clientY-U;B.moved=G*G+Z*Z>x}B.event(ie).zoom("mouse",n(_(B.that.__zoom,B.mouse[0]=_e(ie,S),B.mouse[1]),B.extent,l))}function te(ie){V.on("mousemove.zoom mouseup.zoom",null),ao(ie.view,B.moved),dt(ie),B.event(ie).end()}}function F(w,...T){if(e.apply(this,arguments)){var S=this.__zoom,B=_e(w.changedTouches?w.changedTouches[0]:w,this),V=S.invert(B),z=S.k*(w.shiftKey?.5:2),H=n(_(M(S,z),B,V),t.apply(this,T),l);dt(w),s>0?ye(this).transition().duration(s).call(A,H,B,w):ye(this).call(k.transform,H,B,w)}}function O(w,...T){if(e.apply(this,arguments)){var S=w.touches,B=S.length,V=P(this,T,w.changedTouches.length===B).event(w),z,H,U,Q;for(xn(w),H=0;H<B;++H)U=S[H],Q=_e(U,this),Q=[Q,this.__zoom.invert(Q),U.identifier],V.touch0?!V.touch1&&V.touch0[2]!==Q[2]&&(V.touch1=Q,V.taps=0):(V.touch0=Q,z=!0,V.taps=1+!!d);d&&(d=clearTimeout(d)),z&&(V.taps<2&&(f=Q[0],d=setTimeout(function(){d=null},p)),Rt(this),V.start())}}function E(w,...T){if(this.__zooming){var S=P(this,T).event(w),B=w.changedTouches,V=B.length,z,H,U,Q;for(dt(w),z=0;z<V;++z)H=B[z],U=_e(H,this),S.touch0&&S.touch0[2]===H.identifier?S.touch0[0]=U:S.touch1&&S.touch1[2]===H.identifier&&(S.touch1[0]=U);if(H=S.that.__zoom,S.touch1){var te=S.touch0[0],ie=S.touch0[1],G=S.touch1[0],Z=S.touch1[1],j=(j=G[0]-te[0])*j+(j=G[1]-te[1])*j,ae=(ae=Z[0]-ie[0])*ae+(ae=Z[1]-ie[1])*ae;H=M(H,Math.sqrt(j/ae)),U=[(te[0]+G[0])/2,(te[1]+G[1])/2],Q=[(ie[0]+Z[0])/2,(ie[1]+Z[1])/2]}else if(S.touch0)U=S.touch0[0],Q=S.touch0[1];else return;S.zoom("touch",n(_(H,U,Q),S.extent,l))}}function J(w,...T){if(this.__zooming){var S=P(this,T).event(w),B=w.changedTouches,V=B.length,z,H;for(xn(w),h&&clearTimeout(h),h=setTimeout(function(){h=null},p),z=0;z<V;++z)H=B[z],S.touch0&&S.touch0[2]===H.identifier?delete S.touch0:S.touch1&&S.touch1[2]===H.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&(H=_e(H,this),Math.hypot(f[0]-H[0],f[1]-H[1])<N)){var U=ye(this).on("dblclick.zoom");U&&U.apply(this,arguments)}}}return k.wheelDelta=function(w){return arguments.length?(o=typeof w=="function"?w:Ht(+w),k):o},k.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Ht(!!w),k):e},k.touchable=function(w){return arguments.length?(i=typeof w=="function"?w:Ht(!!w),k):i},k.extent=function(w){return arguments.length?(t=typeof w=="function"?w:Ht([[+w[0][0],+w[0][1]],[+w[1][0],+w[1][1]]]),k):t},k.scaleExtent=function(w){return arguments.length?(r[0]=+w[0],r[1]=+w[1],k):[r[0],r[1]]},k.translateExtent=function(w){return arguments.length?(l[0][0]=+w[0][0],l[1][0]=+w[1][0],l[0][1]=+w[0][1],l[1][1]=+w[1][1],k):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},k.constrain=function(w){return arguments.length?(n=w,k):n},k.duration=function(w){return arguments.length?(s=+w,k):s},k.interpolate=function(w){return arguments.length?(u=w,k):u},k.on=function(){var w=c.on.apply(c,arguments);return w===c?k:w},k.clickDistance=function(w){return arguments.length?(x=(w=+w)*w,k):Math.sqrt(x)},k.tapDistance=function(w){return arguments.length?(N=+w,k):N},k}var R=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(R||{}),Sn=(e=>(e.Partial="partial",e.Full="full",e))(Sn||{}),He=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(He||{}),Te=(e=>(e.Strict="strict",e.Loose="loose",e))(Te||{}),Nn=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(Nn||{}),ft=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(ft||{});const Is=["INPUT","SELECT","TEXTAREA"],Ps=typeof document<"u"?document:null;function Cn(e){var t,n;const o=((n=(t=e.composedPath)==null?void 0:t.call(e))==null?void 0:n[0])||e.target,i=typeof o?.hasAttribute=="function"?o.hasAttribute("contenteditable"):!1,r=typeof o?.closest=="function"?o.closest(".nokey"):null;return Is.includes(o?.nodeName)||i||!!r}function Ts(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Oo(e,t,n,o){const i=t.replace("+",`
2
2
  `).replace(`
3
3
 
4
4
  `,`
5
5
  +`).split(`
6
- `).map(l=>l.trim().toLowerCase());if(i.length===1)return e.toLowerCase()===t.toLowerCase();o||n.add(e.toLowerCase());const r=i.every((l,s)=>n.has(l)&&Array.from(n.values())[s]===i[s]);return o&&n.delete(e.toLowerCase()),r}function $s(e,t){return n=>{if(!n.code&&!n.key)return!1;const o=Ds(n.code,e);return Array.isArray(e)?e.some(i=>Oo(n[o],i,t,n.type==="keyup")):Oo(n[o],e,t,n.type==="keyup")}}function Ds(e,t){return t.includes(e)?"code":"key"}function ht(e,t){const n=a.computed(()=>a.toValue(t?.target)??Ps),o=a.shallowRef(a.toValue(e)===!0);let i=!1;const r=new Set;let l=u(a.toValue(e));a.watch(()=>a.toValue(e),(c,d)=>{typeof d=="boolean"&&typeof c!="boolean"&&s(),l=u(c)},{immediate:!0}),Gn(["blur","contextmenu"],s),Xn((...c)=>l(...c),c=>{var d,f;const h=a.toValue(t?.actInsideInputWithModifier)??!0,p=a.toValue(t?.preventDefault)??!1;if(i=Ts(c),(!i||i&&!h)&&Cn(c))return;const x=((f=(d=c.composedPath)==null?void 0:d.call(c))==null?void 0:f[0])||c.target,N=x?.nodeName==="BUTTON"||x?.nodeName==="A";!p&&(i||!N)&&c.preventDefault(),o.value=!0},{eventName:"keydown",target:n}),Xn((...c)=>l(...c),c=>{const d=a.toValue(t?.actInsideInputWithModifier)??!0;if(o.value){if((!i||i&&!d)&&Cn(c))return;i=!1,o.value=!1}},{eventName:"keyup",target:n});function s(){i=!1,r.clear(),o.value=a.toValue(e)===!0}function u(c){return c===null?(s(),()=>!1):typeof c=="boolean"?(s(),o.value=c,()=>!1):Array.isArray(c)||typeof c=="string"?$s(c,r):c}return o}const zo="vue-flow__node-desc",Ro="vue-flow__edge-desc",Bs="vue-flow__aria-live",Ho=["Enter"," ","Escape"],qe={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Lt(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function Ft(e,t){const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)}function Yt(e){return{width:e.offsetWidth,height:e.offsetHeight}}function Le(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function Lo(e,t){return{x:Le(e.x,t[0][0],t[1][0]),y:Le(e.y,t[0][1],t[1][1])}}function Fo(e){const t=e.getRootNode();return"elementFromPoint"in t?t:window.document}function $e(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function Fe(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!$e(e)}function gt(e){return Fe(e)&&"computedPosition"in e}function Gt(e){return!Number.isNaN(e)&&Number.isFinite(e)}function Vs(e){return Gt(e.width)&&Gt(e.height)&&Gt(e.x)&&Gt(e.y)}function As(e,t,n){const o={id:e.id.toString(),type:e.type??"default",dimensions:a.markRaw({width:0,height:0}),computedPosition:a.markRaw({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:he(e.data)?e.data:{},events:a.markRaw(he(e.events)?e.events:{})};return Object.assign(t??o,e,{id:e.id.toString(),parentNode:n})}function Yo(e,t,n){var o,i;const r={id:e.id.toString(),type:e.type??t?.type??"default",source:e.source.toString(),target:e.target.toString(),sourceHandle:(o=e.sourceHandle)==null?void 0:o.toString(),targetHandle:(i=e.targetHandle)==null?void 0:i.toString(),updatable:e.updatable??n?.updatable,selectable:e.selectable??n?.selectable,focusable:e.focusable??n?.focusable,data:he(e.data)?e.data:{},events:a.markRaw(he(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function Go(e,t,n,o){const i=typeof e=="string"?e:e.id,r=new Set,l=o==="source"?"target":"source";for(const s of n)s[l]===i&&r.add(s[o]);return t.filter(s=>r.has(s.id))}function Os(...e){if(e.length===3){const[r,l,s]=e;return Go(r,l,s,"target")}const[t,n]=e,o=typeof t=="string"?t:t.id;return n.filter(r=>$e(r)&&r.source===o).map(r=>n.find(l=>Fe(l)&&l.id===r.target))}function zs(...e){if(e.length===3){const[r,l,s]=e;return Go(r,l,s,"source")}const[t,n]=e,o=typeof t=="string"?t:t.id;return n.filter(r=>$e(r)&&r.target===o).map(r=>n.find(l=>Fe(l)&&l.id===r.source))}function Xo({source:e,sourceHandle:t,target:n,targetHandle:o}){return`vueflow__edge-${e}${t??""}-${n}${o??""}`}function Rs(e,t){return t.some(n=>$e(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))}function pt({x:e,y:t},{x:n,y:o,zoom:i}){return{x:e*i+n,y:t*i+o}}function mt({x:e,y:t},{x:n,y:o,zoom:i},r=!1,l=[1,1]){const s={x:(e-n)/i,y:(t-o)/i};return r?Ut(s,l):s}function Hs(e,t){return{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)}}function Uo({x:e,y:t,width:n,height:o}){return{x:e,y:t,x2:e+n,y2:t+o}}function Ls({x:e,y:t,x2:n,y2:o}){return{x:e,y:t,width:n-e,height:o-t}}function Zo(e){let t={x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY,x2:Number.NEGATIVE_INFINITY,y2:Number.NEGATIVE_INFINITY};for(let n=0;n<e.length;n++){const o=e[n];t=Hs(t,Uo({...o.computedPosition,...o.dimensions}))}return Ls(t)}function Wo(e,t,n={x:0,y:0,zoom:1},o=!1,i=!1){const r={...mt(t,n),width:t.width/n.zoom,height:t.height/n.zoom},l=[];for(const s of e){const{dimensions:u,selectable:c=!0,hidden:d=!1}=s,f=u.width??s.width??null,h=u.height??s.height??null;if(i&&!c||d)continue;const p=Ft(r,Lt(s)),b=f===null||h===null,x=o&&p>0,N=(f??0)*(h??0);(b||x||p>=N||s.dragging)&&l.push(s)}return l}function Ko(e,t){const n=new Set;if(typeof e=="string")n.add(e);else if(e.length>=1)for(const o of e)n.add(o.id);return t.filter(o=>n.has(o.source)||n.has(o.target))}function je(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=Number.parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=Number.parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return vt(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Fs(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=je(e,n),i=je(e,t);return{top:o,right:i,bottom:o,left:i,x:i*2,y:o*2}}if(typeof e=="object"){const o=je(e.top??e.y??0,n),i=je(e.bottom??e.y??0,n),r=je(e.left??e.x??0,t),l=je(e.right??e.x??0,t);return{top:o,right:l,bottom:i,left:r,x:r+l,y:o+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Ys(e,t,n,o,i,r){const{x:l,y:s}=pt(e,{x:t,y:n,zoom:o}),{x:u,y:c}=pt({x:e.x+e.width,y:e.y+e.height},{x:t,y:n,zoom:o}),d=i-u,f=r-c;return{left:Math.floor(l),top:Math.floor(s),right:Math.floor(d),bottom:Math.floor(f)}}function qo(e,t,n,o,i,r=.1){const l=Fs(r,t,n),s=(t-l.x)/e.width,u=(n-l.y)/e.height,c=Math.min(s,u),d=Le(c,o,i),f=e.x+e.width/2,h=e.y+e.height/2,p=t/2-f*d,b=n/2-h*d,x=Ys(e,p,b,d,t,n),N={left:Math.min(x.left-l.left,0),top:Math.min(x.top-l.top,0),right:Math.min(x.right-l.right,0),bottom:Math.min(x.bottom-l.bottom,0)};return{x:p-N.left+N.right,y:b-N.top+N.bottom,zoom:d}}function Gs(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function jo(e,t){if(!e.parentNode)return!1;const n=t.get(e.parentNode);return n?n.selected?!0:jo(n,t):!1}function yt(e,t){return typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`}function Jo(e){const t=e.ctrlKey&&Xt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t}function Qo(e,t,n){return e<t?Le(Math.abs(e-t),1,t)/t:e>n?-Le(Math.abs(e-n),1,t)/t:0}function ei(e,t,n=15,o=40){const i=Qo(e.x,o,t.width-o)*n,r=Qo(e.y,o,t.height-o)*n;return[i,r]}function kn(e,t){if(t){const n=e.position.x+e.dimensions.width-t.dimensions.width,o=e.position.y+e.dimensions.height-t.dimensions.height;if(n>0||o>0||e.position.x<0||e.position.y<0){let i={};if(typeof t.style=="function"?i={...t.style(t)}:t.style&&(i={...t.style}),i.width=i.width??`${t.dimensions.width}px`,i.height=i.height??`${t.dimensions.height}px`,n>0)if(typeof i.width=="string"){const r=Number(i.width.replace("px",""));i.width=`${r+n}px`}else i.width+=n;if(o>0)if(typeof i.height=="string"){const r=Number(i.height.replace("px",""));i.height=`${r+o}px`}else i.height+=o;if(e.position.x<0){const r=Math.abs(e.position.x);if(t.position.x=t.position.x-r,typeof i.width=="string"){const l=Number(i.width.replace("px",""));i.width=`${l+r}px`}else i.width+=r;e.position.x=0}if(e.position.y<0){const r=Math.abs(e.position.y);if(t.position.y=t.position.y-r,typeof i.height=="string"){const l=Number(i.height.replace("px",""));i.height=`${l+r}px`}else i.height+=r;e.position.y=0}t.dimensions.width=Number(i.width.toString().replace("px","")),t.dimensions.height=Number(i.height.toString().replace("px","")),typeof t.style=="function"?t.style=r=>{const l=t.style;return{...l(r),...i}}:t.style={...t.style,...i}}}}function ti(e,t){var n,o;const i=e.filter(l=>l.type==="add"||l.type==="remove");for(const l of i)if(l.type==="add")t.findIndex(u=>u.id===l.item.id)===-1&&t.push(l.item);else if(l.type==="remove"){const s=t.findIndex(u=>u.id===l.id);s!==-1&&t.splice(s,1)}const r=t.map(l=>l.id);for(const l of t)for(const s of e)if(s.id===l.id)switch(s.type){case"select":l.selected=s.selected;break;case"position":if(gt(l)&&(typeof s.position<"u"&&(l.position=s.position),typeof s.dragging<"u"&&(l.dragging=s.dragging),l.expandParent&&l.parentNode)){const u=t[r.indexOf(l.parentNode)];u&&gt(u)&&kn(l,u)}break;case"dimensions":if(gt(l)&&(typeof s.dimensions<"u"&&(l.dimensions=s.dimensions),typeof s.updateStyle<"u"&&s.updateStyle&&(l.style={...l.style||{},width:`${(n=s.dimensions)==null?void 0:n.width}px`,height:`${(o=s.dimensions)==null?void 0:o.height}px`}),typeof s.resizing<"u"&&(l.resizing=s.resizing),l.expandParent&&l.parentNode)){const u=t[r.indexOf(l.parentNode)];u&&gt(u)&&(!!u.dimensions.width&&!!u.dimensions.height?kn(l,u):a.nextTick(()=>{kn(l,u)}))}break}return t}function De(e,t){return{id:e,type:"select",selected:t}}function ni(e){return{item:e,type:"add"}}function oi(e){return{id:e,type:"remove"}}function ii(e,t,n,o,i){return{id:e,source:t,target:n,sourceHandle:o||null,targetHandle:i||null,type:"remove"}}function Be(e,t=new Set,n=!1){const o=[];for(const[i,r]of e){const l=t.has(i);!(r.selected===void 0&&!l)&&r.selected!==l&&(n&&(r.selected=l),o.push(De(r.id,l)))}return o}const ri=()=>{};function L(e){const t=new Set;let n=ri,o=()=>!1;const i=()=>t.size>0||o(),r=h=>{n=h},l=()=>{n=ri},s=h=>{o=h},u=()=>{o=()=>!1},c=h=>{t.delete(h)};return{on:h=>{t.add(h);const p=()=>c(h);return et(p),{off:p}},off:c,trigger:h=>{const p=[n];return i()?p.push(...t):e&&p.push(e),Promise.allSettled(p.map(b=>b(h)))},hasListeners:i,listeners:t,setEmitter:r,removeEmitter:l,setHasEmitListeners:s,removeHasEmitListeners:u}}function li(e,t,n){let o=e;do{if(o&&o.matches(t))return!0;if(o===n)return!1;o=o.parentElement}while(o);return!1}function Xs(e,t,n,o){var i,r;const l=new Map;for(const[s,u]of e)(u.selected||u.id===o)&&(!u.parentNode||!jo(u,e))&&(u.draggable||t&&typeof u.draggable>"u")&&e.get(s)&&l.set(s,{id:u.id,position:u.position||{x:0,y:0},distance:{x:n.x-((i=u.computedPosition)==null?void 0:i.x)||0,y:n.y-((r=u.computedPosition)==null?void 0:r.y)||0},from:{x:u.computedPosition.x,y:u.computedPosition.y},extent:u.extent,parentNode:u.parentNode,dimensions:{...u.dimensions},expandParent:u.expandParent});return Array.from(l.values())}function Mn({id:e,dragItems:t,findNode:n}){const o=[];for(const i of t){const r=n(i.id);r&&o.push(r)}return[e?o.find(i=>i.id===e):o[0],o]}function ai(e){if(Array.isArray(e))switch(e.length){case 1:return[e[0],e[0],e[0],e[0]];case 2:return[e[0],e[1],e[0],e[1]];case 3:return[e[0],e[1],e[2],e[1]];case 4:return e;default:return[0,0,0,0]}return[e,e,e,e]}function Us(e,t,n){const[o,i,r,l]=typeof e!="string"?ai(e.padding):[0,0,0,0];return n&&typeof n.computedPosition.x<"u"&&typeof n.computedPosition.y<"u"&&typeof n.dimensions.width<"u"&&typeof n.dimensions.height<"u"?[[n.computedPosition.x+l,n.computedPosition.y+o],[n.computedPosition.x+n.dimensions.width-i,n.computedPosition.y+n.dimensions.height-r]]:!1}function Zs(e,t,n,o){let i=e.extent||n;if((i==="parent"||!Array.isArray(i)&&i?.range==="parent")&&!e.expandParent)if(e.parentNode&&o&&e.dimensions.width&&e.dimensions.height){const r=Us(i,e,o);r&&(i=r)}else t(new ge(fe.NODE_EXTENT_INVALID,e.id)),i=n;else if(Array.isArray(i)){const r=o?.computedPosition.x||0,l=o?.computedPosition.y||0;i=[[i[0][0]+r,i[0][1]+l],[i[1][0]+r,i[1][1]+l]]}else if(i!=="parent"&&i?.range&&Array.isArray(i.range)){const[r,l,s,u]=ai(i.padding),c=o?.computedPosition.x||0,d=o?.computedPosition.y||0;i=[[i.range[0][0]+c+u,i.range[0][1]+d+r],[i.range[1][0]+c-l,i.range[1][1]+d-s]]}return i==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:i}function Ws({width:e,height:t},n){return[n[0],[n[1][0]-(e||0),n[1][1]-(t||0)]]}function In(e,t,n,o,i){const r=Ws(e.dimensions,Zs(e,n,o,i)),l=Lo(t,r);return{position:{x:l.x-(i?.computedPosition.x||0),y:l.y-(i?.computedPosition.y||0)},computedPosition:l}}function Je(e,t,n=z.Left,o=!1){const i=(t?.x??0)+e.computedPosition.x,r=(t?.y??0)+e.computedPosition.y,{width:l,height:s}=t??Js(e);if(o)return{x:i+l/2,y:r+s/2};switch(t?.position??n){case z.Top:return{x:i+l/2,y:r};case z.Right:return{x:i+l,y:r+s/2};case z.Bottom:return{x:i+l/2,y:r+s};case z.Left:return{x:i,y:r+s/2}}}function si(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Ks({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:o,targetWidth:i,targetHeight:r,width:l,height:s,viewport:u}){const c={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+i),y2:Math.max(e.y+o,t.y+r)};c.x===c.x2&&(c.x2+=1),c.y===c.y2&&(c.y2+=1);const d=Uo({x:(0-u.x)/u.zoom,y:(0-u.y)/u.zoom,width:l/u.zoom,height:s/u.zoom}),f=Math.max(0,Math.min(d.x2,c.x2)-Math.max(d.x,c.x)),h=Math.max(0,Math.min(d.y2,c.y2)-Math.max(d.y,c.y));return Math.ceil(f*h)>0}function qs(e,t,n=!1){const o=typeof e.zIndex=="number";let i=o?e.zIndex:0;const r=t(e.source),l=t(e.target);return!r||!l?0:(n&&(i=o?e.zIndex:Math.max(r.computedPosition.z||0,l.computedPosition.z||0)),i)}var fe=(e=>(e.MISSING_STYLES="MISSING_STYLES",e.MISSING_VIEWPORT_DIMENSIONS="MISSING_VIEWPORT_DIMENSIONS",e.NODE_INVALID="NODE_INVALID",e.NODE_NOT_FOUND="NODE_NOT_FOUND",e.NODE_MISSING_PARENT="NODE_MISSING_PARENT",e.NODE_TYPE_MISSING="NODE_TYPE_MISSING",e.NODE_EXTENT_INVALID="NODE_EXTENT_INVALID",e.EDGE_INVALID="EDGE_INVALID",e.EDGE_NOT_FOUND="EDGE_NOT_FOUND",e.EDGE_SOURCE_MISSING="EDGE_SOURCE_MISSING",e.EDGE_TARGET_MISSING="EDGE_TARGET_MISSING",e.EDGE_TYPE_MISSING="EDGE_TYPE_MISSING",e.EDGE_SOURCE_TARGET_SAME="EDGE_SOURCE_TARGET_SAME",e.EDGE_SOURCE_TARGET_MISSING="EDGE_SOURCE_TARGET_MISSING",e.EDGE_ORPHANED="EDGE_ORPHANED",e.USEVUEFLOW_OPTIONS="USEVUEFLOW_OPTIONS",e))(fe||{});const ui={MISSING_STYLES:()=>"It seems that you haven't loaded the necessary styles. Please import '@vue-flow/core/dist/style.css' to ensure that the graph is rendered correctly",MISSING_VIEWPORT_DIMENSIONS:()=>"The Vue Flow parent container needs a width and a height to render the graph",NODE_INVALID:e=>`Node is invalid
6
+ `).map(l=>l.trim().toLowerCase());if(i.length===1)return e.toLowerCase()===t.toLowerCase();o||n.add(e.toLowerCase());const r=i.every((l,s)=>n.has(l)&&Array.from(n.values())[s]===i[s]);return o&&n.delete(e.toLowerCase()),r}function $s(e,t){return n=>{if(!n.code&&!n.key)return!1;const o=Ds(n.code,e);return Array.isArray(e)?e.some(i=>Oo(n[o],i,t,n.type==="keyup")):Oo(n[o],e,t,n.type==="keyup")}}function Ds(e,t){return t.includes(e)?"code":"key"}function ht(e,t){const n=a.computed(()=>a.toValue(t?.target)??Ps),o=a.shallowRef(a.toValue(e)===!0);let i=!1;const r=new Set;let l=u(a.toValue(e));a.watch(()=>a.toValue(e),(c,d)=>{typeof d=="boolean"&&typeof c!="boolean"&&s(),l=u(c)},{immediate:!0}),Gn(["blur","contextmenu"],s),Xn((...c)=>l(...c),c=>{var d,f;const h=a.toValue(t?.actInsideInputWithModifier)??!0,p=a.toValue(t?.preventDefault)??!1;if(i=Ts(c),(!i||i&&!h)&&Cn(c))return;const x=((f=(d=c.composedPath)==null?void 0:d.call(c))==null?void 0:f[0])||c.target,N=x?.nodeName==="BUTTON"||x?.nodeName==="A";!p&&(i||!N)&&c.preventDefault(),o.value=!0},{eventName:"keydown",target:n}),Xn((...c)=>l(...c),c=>{const d=a.toValue(t?.actInsideInputWithModifier)??!0;if(o.value){if((!i||i&&!d)&&Cn(c))return;i=!1,o.value=!1}},{eventName:"keyup",target:n});function s(){i=!1,r.clear(),o.value=a.toValue(e)===!0}function u(c){return c===null?(s(),()=>!1):typeof c=="boolean"?(s(),o.value=c,()=>!1):Array.isArray(c)||typeof c=="string"?$s(c,r):c}return o}const zo="vue-flow__node-desc",Ro="vue-flow__edge-desc",Bs="vue-flow__aria-live",Ho=["Enter"," ","Escape"],qe={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Lt(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function Ft(e,t){const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)}function Yt(e){return{width:e.offsetWidth,height:e.offsetHeight}}function Le(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function Lo(e,t){return{x:Le(e.x,t[0][0],t[1][0]),y:Le(e.y,t[0][1],t[1][1])}}function Fo(e){const t=e.getRootNode();return"elementFromPoint"in t?t:window.document}function $e(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function Fe(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!$e(e)}function gt(e){return Fe(e)&&"computedPosition"in e}function Gt(e){return!Number.isNaN(e)&&Number.isFinite(e)}function Vs(e){return Gt(e.width)&&Gt(e.height)&&Gt(e.x)&&Gt(e.y)}function As(e,t,n){const o={id:e.id.toString(),type:e.type??"default",dimensions:a.markRaw({width:0,height:0}),computedPosition:a.markRaw({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:he(e.data)?e.data:{},events:a.markRaw(he(e.events)?e.events:{})};return Object.assign(t??o,e,{id:e.id.toString(),parentNode:n})}function Yo(e,t,n){var o,i;const r={id:e.id.toString(),type:e.type??t?.type??"default",source:e.source.toString(),target:e.target.toString(),sourceHandle:(o=e.sourceHandle)==null?void 0:o.toString(),targetHandle:(i=e.targetHandle)==null?void 0:i.toString(),updatable:e.updatable??n?.updatable,selectable:e.selectable??n?.selectable,focusable:e.focusable??n?.focusable,data:he(e.data)?e.data:{},events:a.markRaw(he(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function Go(e,t,n,o){const i=typeof e=="string"?e:e.id,r=new Set,l=o==="source"?"target":"source";for(const s of n)s[l]===i&&r.add(s[o]);return t.filter(s=>r.has(s.id))}function Os(...e){if(e.length===3){const[r,l,s]=e;return Go(r,l,s,"target")}const[t,n]=e,o=typeof t=="string"?t:t.id;return n.filter(r=>$e(r)&&r.source===o).map(r=>n.find(l=>Fe(l)&&l.id===r.target))}function zs(...e){if(e.length===3){const[r,l,s]=e;return Go(r,l,s,"source")}const[t,n]=e,o=typeof t=="string"?t:t.id;return n.filter(r=>$e(r)&&r.target===o).map(r=>n.find(l=>Fe(l)&&l.id===r.source))}function Xo({source:e,sourceHandle:t,target:n,targetHandle:o}){return`vueflow__edge-${e}${t??""}-${n}${o??""}`}function Rs(e,t){return t.some(n=>$e(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))}function pt({x:e,y:t},{x:n,y:o,zoom:i}){return{x:e*i+n,y:t*i+o}}function mt({x:e,y:t},{x:n,y:o,zoom:i},r=!1,l=[1,1]){const s={x:(e-n)/i,y:(t-o)/i};return r?Ut(s,l):s}function Hs(e,t){return{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)}}function Uo({x:e,y:t,width:n,height:o}){return{x:e,y:t,x2:e+n,y2:t+o}}function Ls({x:e,y:t,x2:n,y2:o}){return{x:e,y:t,width:n-e,height:o-t}}function Zo(e){let t={x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY,x2:Number.NEGATIVE_INFINITY,y2:Number.NEGATIVE_INFINITY};for(let n=0;n<e.length;n++){const o=e[n];t=Hs(t,Uo({...o.computedPosition,...o.dimensions}))}return Ls(t)}function Wo(e,t,n={x:0,y:0,zoom:1},o=!1,i=!1){const r={...mt(t,n),width:t.width/n.zoom,height:t.height/n.zoom},l=[];for(const s of e){const{dimensions:u,selectable:c=!0,hidden:d=!1}=s,f=u.width??s.width??null,h=u.height??s.height??null;if(i&&!c||d)continue;const p=Ft(r,Lt(s)),b=f===null||h===null,x=o&&p>0,N=(f??0)*(h??0);(b||x||p>=N||s.dragging)&&l.push(s)}return l}function Ko(e,t){const n=new Set;if(typeof e=="string")n.add(e);else if(e.length>=1)for(const o of e)n.add(o.id);return t.filter(o=>n.has(o.source)||n.has(o.target))}function je(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=Number.parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=Number.parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return vt(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Fs(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=je(e,n),i=je(e,t);return{top:o,right:i,bottom:o,left:i,x:i*2,y:o*2}}if(typeof e=="object"){const o=je(e.top??e.y??0,n),i=je(e.bottom??e.y??0,n),r=je(e.left??e.x??0,t),l=je(e.right??e.x??0,t);return{top:o,right:l,bottom:i,left:r,x:r+l,y:o+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Ys(e,t,n,o,i,r){const{x:l,y:s}=pt(e,{x:t,y:n,zoom:o}),{x:u,y:c}=pt({x:e.x+e.width,y:e.y+e.height},{x:t,y:n,zoom:o}),d=i-u,f=r-c;return{left:Math.floor(l),top:Math.floor(s),right:Math.floor(d),bottom:Math.floor(f)}}function qo(e,t,n,o,i,r=.1){const l=Fs(r,t,n),s=(t-l.x)/e.width,u=(n-l.y)/e.height,c=Math.min(s,u),d=Le(c,o,i),f=e.x+e.width/2,h=e.y+e.height/2,p=t/2-f*d,b=n/2-h*d,x=Ys(e,p,b,d,t,n),N={left:Math.min(x.left-l.left,0),top:Math.min(x.top-l.top,0),right:Math.min(x.right-l.right,0),bottom:Math.min(x.bottom-l.bottom,0)};return{x:p-N.left+N.right,y:b-N.top+N.bottom,zoom:d}}function Gs(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function jo(e,t){if(!e.parentNode)return!1;const n=t.get(e.parentNode);return n?n.selected?!0:jo(n,t):!1}function yt(e,t){return typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`}function Jo(e){const t=e.ctrlKey&&Xt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t}function Qo(e,t,n){return e<t?Le(Math.abs(e-t),1,t)/t:e>n?-Le(Math.abs(e-n),1,t)/t:0}function ei(e,t,n=15,o=40){const i=Qo(e.x,o,t.width-o)*n,r=Qo(e.y,o,t.height-o)*n;return[i,r]}function kn(e,t){if(t){const n=e.position.x+e.dimensions.width-t.dimensions.width,o=e.position.y+e.dimensions.height-t.dimensions.height;if(n>0||o>0||e.position.x<0||e.position.y<0){let i={};if(typeof t.style=="function"?i={...t.style(t)}:t.style&&(i={...t.style}),i.width=i.width??`${t.dimensions.width}px`,i.height=i.height??`${t.dimensions.height}px`,n>0)if(typeof i.width=="string"){const r=Number(i.width.replace("px",""));i.width=`${r+n}px`}else i.width+=n;if(o>0)if(typeof i.height=="string"){const r=Number(i.height.replace("px",""));i.height=`${r+o}px`}else i.height+=o;if(e.position.x<0){const r=Math.abs(e.position.x);if(t.position.x=t.position.x-r,typeof i.width=="string"){const l=Number(i.width.replace("px",""));i.width=`${l+r}px`}else i.width+=r;e.position.x=0}if(e.position.y<0){const r=Math.abs(e.position.y);if(t.position.y=t.position.y-r,typeof i.height=="string"){const l=Number(i.height.replace("px",""));i.height=`${l+r}px`}else i.height+=r;e.position.y=0}t.dimensions.width=Number(i.width.toString().replace("px","")),t.dimensions.height=Number(i.height.toString().replace("px","")),typeof t.style=="function"?t.style=r=>{const l=t.style;return{...l(r),...i}}:t.style={...t.style,...i}}}}function ti(e,t){var n,o;const i=e.filter(l=>l.type==="add"||l.type==="remove");for(const l of i)if(l.type==="add")t.findIndex(u=>u.id===l.item.id)===-1&&t.push(l.item);else if(l.type==="remove"){const s=t.findIndex(u=>u.id===l.id);s!==-1&&t.splice(s,1)}const r=t.map(l=>l.id);for(const l of t)for(const s of e)if(s.id===l.id)switch(s.type){case"select":l.selected=s.selected;break;case"position":if(gt(l)&&(typeof s.position<"u"&&(l.position=s.position),typeof s.dragging<"u"&&(l.dragging=s.dragging),l.expandParent&&l.parentNode)){const u=t[r.indexOf(l.parentNode)];u&&gt(u)&&kn(l,u)}break;case"dimensions":if(gt(l)&&(typeof s.dimensions<"u"&&(l.dimensions=s.dimensions),typeof s.updateStyle<"u"&&s.updateStyle&&(l.style={...l.style||{},width:`${(n=s.dimensions)==null?void 0:n.width}px`,height:`${(o=s.dimensions)==null?void 0:o.height}px`}),typeof s.resizing<"u"&&(l.resizing=s.resizing),l.expandParent&&l.parentNode)){const u=t[r.indexOf(l.parentNode)];u&&gt(u)&&(!!u.dimensions.width&&!!u.dimensions.height?kn(l,u):a.nextTick(()=>{kn(l,u)}))}break}return t}function De(e,t){return{id:e,type:"select",selected:t}}function ni(e){return{item:e,type:"add"}}function oi(e){return{id:e,type:"remove"}}function ii(e,t,n,o,i){return{id:e,source:t,target:n,sourceHandle:o||null,targetHandle:i||null,type:"remove"}}function Be(e,t=new Set,n=!1){const o=[];for(const[i,r]of e){const l=t.has(i);!(r.selected===void 0&&!l)&&r.selected!==l&&(n&&(r.selected=l),o.push(De(r.id,l)))}return o}const ri=()=>{};function L(e){const t=new Set;let n=ri,o=()=>!1;const i=()=>t.size>0||o(),r=h=>{n=h},l=()=>{n=ri},s=h=>{o=h},u=()=>{o=()=>!1},c=h=>{t.delete(h)};return{on:h=>{t.add(h);const p=()=>c(h);return et(p),{off:p}},off:c,trigger:h=>{const p=[n];return i()?p.push(...t):e&&p.push(e),Promise.allSettled(p.map(b=>b(h)))},hasListeners:i,listeners:t,setEmitter:r,removeEmitter:l,setHasEmitListeners:s,removeHasEmitListeners:u}}function li(e,t,n){let o=e;do{if(o&&o.matches(t))return!0;if(o===n)return!1;o=o.parentElement}while(o);return!1}function Xs(e,t,n,o){var i,r;const l=new Map;for(const[s,u]of e)(u.selected||u.id===o)&&(!u.parentNode||!jo(u,e))&&(u.draggable||t&&typeof u.draggable>"u")&&e.get(s)&&l.set(s,{id:u.id,position:u.position||{x:0,y:0},distance:{x:n.x-((i=u.computedPosition)==null?void 0:i.x)||0,y:n.y-((r=u.computedPosition)==null?void 0:r.y)||0},from:{x:u.computedPosition.x,y:u.computedPosition.y},extent:u.extent,parentNode:u.parentNode,dimensions:{...u.dimensions},expandParent:u.expandParent});return Array.from(l.values())}function Mn({id:e,dragItems:t,findNode:n}){const o=[];for(const i of t){const r=n(i.id);r&&o.push(r)}return[e?o.find(i=>i.id===e):o[0],o]}function ai(e){if(Array.isArray(e))switch(e.length){case 1:return[e[0],e[0],e[0],e[0]];case 2:return[e[0],e[1],e[0],e[1]];case 3:return[e[0],e[1],e[2],e[1]];case 4:return e;default:return[0,0,0,0]}return[e,e,e,e]}function Us(e,t,n){const[o,i,r,l]=typeof e!="string"?ai(e.padding):[0,0,0,0];return n&&typeof n.computedPosition.x<"u"&&typeof n.computedPosition.y<"u"&&typeof n.dimensions.width<"u"&&typeof n.dimensions.height<"u"?[[n.computedPosition.x+l,n.computedPosition.y+o],[n.computedPosition.x+n.dimensions.width-i,n.computedPosition.y+n.dimensions.height-r]]:!1}function Zs(e,t,n,o){let i=e.extent||n;if((i==="parent"||!Array.isArray(i)&&i?.range==="parent")&&!e.expandParent)if(e.parentNode&&o&&e.dimensions.width&&e.dimensions.height){const r=Us(i,e,o);r&&(i=r)}else t(new ge(fe.NODE_EXTENT_INVALID,e.id)),i=n;else if(Array.isArray(i)){const r=o?.computedPosition.x||0,l=o?.computedPosition.y||0;i=[[i[0][0]+r,i[0][1]+l],[i[1][0]+r,i[1][1]+l]]}else if(i!=="parent"&&i?.range&&Array.isArray(i.range)){const[r,l,s,u]=ai(i.padding),c=o?.computedPosition.x||0,d=o?.computedPosition.y||0;i=[[i.range[0][0]+c+u,i.range[0][1]+d+r],[i.range[1][0]+c-l,i.range[1][1]+d-s]]}return i==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:i}function Ws({width:e,height:t},n){return[n[0],[n[1][0]-(e||0),n[1][1]-(t||0)]]}function In(e,t,n,o,i){const r=Ws(e.dimensions,Zs(e,n,o,i)),l=Lo(t,r);return{position:{x:l.x-(i?.computedPosition.x||0),y:l.y-(i?.computedPosition.y||0)},computedPosition:l}}function Je(e,t,n=R.Left,o=!1){const i=(t?.x??0)+e.computedPosition.x,r=(t?.y??0)+e.computedPosition.y,{width:l,height:s}=t??Js(e);if(o)return{x:i+l/2,y:r+s/2};switch(t?.position??n){case R.Top:return{x:i+l/2,y:r};case R.Right:return{x:i+l,y:r+s/2};case R.Bottom:return{x:i+l/2,y:r+s};case R.Left:return{x:i,y:r+s/2}}}function si(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Ks({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:o,targetWidth:i,targetHeight:r,width:l,height:s,viewport:u}){const c={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+i),y2:Math.max(e.y+o,t.y+r)};c.x===c.x2&&(c.x2+=1),c.y===c.y2&&(c.y2+=1);const d=Uo({x:(0-u.x)/u.zoom,y:(0-u.y)/u.zoom,width:l/u.zoom,height:s/u.zoom}),f=Math.max(0,Math.min(d.x2,c.x2)-Math.max(d.x,c.x)),h=Math.max(0,Math.min(d.y2,c.y2)-Math.max(d.y,c.y));return Math.ceil(f*h)>0}function qs(e,t,n=!1){const o=typeof e.zIndex=="number";let i=o?e.zIndex:0;const r=t(e.source),l=t(e.target);return!r||!l?0:(n&&(i=o?e.zIndex:Math.max(r.computedPosition.z||0,l.computedPosition.z||0)),i)}var fe=(e=>(e.MISSING_STYLES="MISSING_STYLES",e.MISSING_VIEWPORT_DIMENSIONS="MISSING_VIEWPORT_DIMENSIONS",e.NODE_INVALID="NODE_INVALID",e.NODE_NOT_FOUND="NODE_NOT_FOUND",e.NODE_MISSING_PARENT="NODE_MISSING_PARENT",e.NODE_TYPE_MISSING="NODE_TYPE_MISSING",e.NODE_EXTENT_INVALID="NODE_EXTENT_INVALID",e.EDGE_INVALID="EDGE_INVALID",e.EDGE_NOT_FOUND="EDGE_NOT_FOUND",e.EDGE_SOURCE_MISSING="EDGE_SOURCE_MISSING",e.EDGE_TARGET_MISSING="EDGE_TARGET_MISSING",e.EDGE_TYPE_MISSING="EDGE_TYPE_MISSING",e.EDGE_SOURCE_TARGET_SAME="EDGE_SOURCE_TARGET_SAME",e.EDGE_SOURCE_TARGET_MISSING="EDGE_SOURCE_TARGET_MISSING",e.EDGE_ORPHANED="EDGE_ORPHANED",e.USEVUEFLOW_OPTIONS="USEVUEFLOW_OPTIONS",e))(fe||{});const ui={MISSING_STYLES:()=>"It seems that you haven't loaded the necessary styles. Please import '@vue-flow/core/dist/style.css' to ensure that the graph is rendered correctly",MISSING_VIEWPORT_DIMENSIONS:()=>"The Vue Flow parent container needs a width and a height to render the graph",NODE_INVALID:e=>`Node is invalid
7
7
  Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found
8
8
  Node: ${e}`,NODE_MISSING_PARENT:(e,t)=>`Node is missing a parent
9
9
  Node: ${e}
@@ -23,5 +23,5 @@ Edge: ${e}
23
23
  Source: ${t}
24
24
  Target: ${n}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
25
25
  Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found
26
- Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead"};class ge extends Error{constructor(t,...n){var o;super((o=ui[t])==null?void 0:o.call(ui,...n)),this.name="VueFlowError",this.code=t,this.args=n}}function Pn(e){return"clientX"in e}function js(e){return"sourceEvent"in e}function Se(e,t){const n=Pn(e);let o,i;return n?(o=e.clientX,i=e.clientY):"touches"in e&&e.touches.length>0?(o=e.touches[0].clientX,i=e.touches[0].clientY):"changedTouches"in e&&e.changedTouches.length>0?(o=e.changedTouches[0].clientX,i=e.changedTouches[0].clientY):(o=0,i=0),{x:o-(t?.left??0),y:i-(t?.top??0)}}const Xt=()=>{var e;return typeof navigator<"u"&&((e=navigator?.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Js(e){var t,n;return{width:((t=e.dimensions)==null?void 0:t.width)??e.width??0,height:((n=e.dimensions)==null?void 0:n.height)??e.height??0}}function Ut(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}const Qs=()=>!0;function Tn(e){e?.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function eu(e,t,n){const o=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const r of t.values())Ft(i,Lt(r))>0&&o.push(r);return o}const tu=250;function nu(e,t,n,o){var i,r;let l=[],s=Number.POSITIVE_INFINITY;const u=eu(e,n,t+tu);for(const c of u){const d=[...((i=c.handleBounds)==null?void 0:i.source)??[],...((r=c.handleBounds)==null?void 0:r.target)??[]];for(const f of d){if(o.nodeId===f.nodeId&&o.type===f.type&&o.id===f.id)continue;const{x:h,y:p}=Je(c,f,f.position,!0),b=Math.sqrt((h-e.x)**2+(p-e.y)**2);b>t||(b<s?(l=[{...f,x:h,y:p}],s=b):b===s&&l.push({...f,x:h,y:p}))}}if(!l.length)return null;if(l.length>1){const c=o.type==="source"?"target":"source";return l.find(d=>d.type===c)??l[0]}return l[0]}function ci(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:i,fromType:r,doc:l,lib:s,flowId:u,isValidConnection:c=Qs},d,f,h,p){const b=r==="target",x=t?l.querySelector(`.${s}-flow__handle[data-id="${u}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:N,y:k}=Se(e),M=l.elementFromPoint(N,k),_=M?.classList.contains(`${s}-flow__handle`)?M:x,C={handleDomNode:_,isValid:!1,connection:null,toHandle:null};if(_){const A=di(void 0,_),P=_.getAttribute("data-nodeid"),$=_.getAttribute("data-handleid"),B=_.classList.contains("connectable"),K=_.classList.contains("connectableend");if(!P||!A)return C;const F={source:b?P:o,sourceHandle:b?$:i,target:b?o:P,targetHandle:b?i:$};C.connection=F;const E=B&&K&&(n===Te.Strict?b&&A==="source"||!b&&A==="target":P!==o||$!==i);C.isValid=E&&c(F,{nodes:f,edges:d,sourceNode:h(F.source),targetNode:h(F.target)}),C.toHandle=fi(P,A,$,p,n,!0)}return C}function di(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function ou(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function iu(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function fi(e,t,n,o,i,r=!1){var l,s,u;const c=o.get(e);if(!c)return null;const d=i===Te.Strict?(l=c.handleBounds)==null?void 0:l[t]:[...((s=c.handleBounds)==null?void 0:s.source)??[],...((u=c.handleBounds)==null?void 0:u.target)??[]],f=(n?d?.find(h=>h.id===n):d?.[0])??null;return f&&r?{...f,...Je(c,f,f.position,!0)}:f}const $n={[z.Left]:z.Right,[z.Right]:z.Left,[z.Top]:z.Bottom,[z.Bottom]:z.Top},ru=["production","prod"];function vt(e,...t){hi()&&console.warn(`[Vue Flow]: ${e}`,...t)}function hi(){return!ru.includes(process.env.NODE_ENV||"")}function gi(e,t,n,o,i){const r=t.querySelectorAll(`.vue-flow__handle.${e}`);return r?.length?Array.from(r).map(l=>{const s=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),type:e,nodeId:i,position:l.getAttribute("data-handlepos"),x:(s.left-n.left)/o,y:(s.top-n.top)/o,...Yt(l)}}):null}function Dn(e,t,n,o,i,r=!1,l){i.value=!1,e.selected?(r||e.selected&&t)&&(o([e]),a.nextTick(()=>{l.blur()})):n([e])}function he(e){return typeof a.unref(e)<"u"}function lu(e,t,n,o){if(!e||!e.source||!e.target)return n(new ge(fe.EDGE_INVALID,e?.id??"[ID UNKNOWN]")),!1;let i;return $e(e)?i=e:i={...e,id:Xo(e)},i=Yo(i,void 0,o),Rs(i,t)?!1:i}function au(e,t,n,o,i){if(!t.source||!t.target)return i(new ge(fe.EDGE_INVALID,e.id)),!1;if(!n)return i(new ge(fe.EDGE_NOT_FOUND,e.id)),!1;const{id:r,...l}=e;return{...l,id:o?Xo(t):r,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function pi(e,t,n){const o={},i=[];for(let r=0;r<e.length;++r){const l=e[r];if(!Fe(l)){n(new ge(fe.NODE_INVALID,l?.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const s=As(l,t(l.id),l.parentNode);l.parentNode&&(o[l.parentNode]=!0),i[r]=s}for(const r of i){const l=t(r.parentNode)||i.find(s=>s.id===r.parentNode);r.parentNode&&!l&&n(new ge(fe.NODE_MISSING_PARENT,r.id,r.parentNode)),(r.parentNode||o[r.id])&&(o[r.id]&&(r.isParent=!0),l&&(l.isParent=!0))}return i}function mi(e,t,n,o,i,r){let l=i;const s=o.get(l)||new Map;o.set(l,s.set(n,t)),l=`${i}-${e}`;const u=o.get(l)||new Map;if(o.set(l,u.set(n,t)),r){l=`${i}-${e}-${r}`;const c=o.get(l)||new Map;o.set(l,c.set(n,t))}}function Bn(e,t,n){e.clear();for(const o of n){const{source:i,target:r,sourceHandle:l=null,targetHandle:s=null}=o,u={edgeId:o.id,source:i,target:r,sourceHandle:l,targetHandle:s},c=`${i}-${l}--${r}-${s}`,d=`${r}-${s}--${i}-${l}`;mi("source",u,d,e,i,l),mi("target",u,c,e,r,s)}}function yi(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Vn(e,t,n,o,i,r,l,s){const u=[];for(const c of e){const d=$e(c)?c:lu(c,s,i,r);if(!d)continue;const f=n(d.source),h=n(d.target);if(!f||!h){i(new ge(fe.EDGE_SOURCE_TARGET_MISSING,d.id,d.source,d.target));continue}if(!f){i(new ge(fe.EDGE_SOURCE_MISSING,d.id,d.source));continue}if(!h){i(new ge(fe.EDGE_TARGET_MISSING,d.id,d.target));continue}if(t&&!t(d,{edges:s,nodes:l,sourceNode:f,targetNode:h})){i(new ge(fe.EDGE_INVALID,d.id));continue}const p=o(d.id);u.push({...Yo(d,p,r),sourceNode:f,targetNode:h})}return u}const vi=Symbol("vueFlow"),wi=Symbol("nodeId"),_i=Symbol("nodeRef"),su=Symbol("edgeId"),uu=Symbol("edgeRef"),Zt=Symbol("slots");function Ei(e){const{vueFlowRef:t,snapToGrid:n,snapGrid:o,noDragClassName:i,nodeLookup:r,nodeExtent:l,nodeDragThreshold:s,viewport:u,autoPanOnNodeDrag:c,autoPanSpeed:d,nodesDraggable:f,panBy:h,findNode:p,multiSelectionActive:b,nodesSelectionActive:x,selectNodesOnDrag:N,removeSelectedElements:k,addSelectedNodes:M,updateNodePositions:_,emits:C}=de(),{onStart:A,onDrag:P,onStop:$,onClick:B,el:K,disabled:F,id:O,selectable:E,dragHandle:Z}=e,w=a.shallowRef(!1);let T=[],S,D=null,V={x:void 0,y:void 0},R={x:0,y:0},H=null,W=!1,Q=!1,te=0,Y=!1;const j=fu(),q=({x:ee,y:ie})=>{V={x:ee,y:ie};let m=!1;if(T=T.map(g=>{const v={x:ee-g.distance.x,y:ie-g.distance.y},{computedPosition:y}=In(g,n.value?Ut(v,o.value):v,C.error,l.value,g.parentNode?p(g.parentNode):void 0);return m=m||g.position.x!==y.x||g.position.y!==y.y,g.position=y,g}),Q=Q||m,!!m&&(_(T,!0,!0),w.value=!0,H)){const[g,v]=Mn({id:O,dragItems:T,findNode:p});P({event:H,node:g,nodes:v})}},re=()=>{if(!D)return;const[ee,ie]=ei(R,D,d.value);if(ee!==0||ie!==0){const m={x:(V.x??0)-ee/u.value.zoom,y:(V.y??0)-ie/u.value.zoom};h({x:ee,y:ie})&&q(m)}te=requestAnimationFrame(re)},le=(ee,ie)=>{W=!0;const m=p(O);!N.value&&!b.value&&m&&(m.selected||k()),m&&a.toValue(E)&&N.value&&Dn(m,b.value,M,k,x,!1,ie);const g=j(ee.sourceEvent);if(V=g,T=Xs(r.value,f.value,g,O),T.length){const[v,y]=Mn({id:O,dragItems:T,findNode:p});A({event:ee.sourceEvent,node:v,nodes:y})}},oe=(ee,ie)=>{var m;ee.sourceEvent.type==="touchmove"&&ee.sourceEvent.touches.length>1||(Q=!1,s.value===0&&le(ee,ie),V=j(ee.sourceEvent),D=((m=t.value)==null?void 0:m.getBoundingClientRect())||null,R=Se(ee.sourceEvent,D))},se=(ee,ie)=>{const m=j(ee.sourceEvent);if(!Y&&W&&c.value&&(Y=!0,re()),!W){const g=m.xSnapped-(V.x??0),v=m.ySnapped-(V.y??0);Math.sqrt(g*g+v*v)>s.value&&le(ee,ie)}(V.x!==m.xSnapped||V.y!==m.ySnapped)&&T.length&&W&&(H=ee.sourceEvent,R=Se(ee.sourceEvent,D),q(m))},ce=ee=>{let ie=!1;if(!W&&!w.value&&!b.value){const m=ee.sourceEvent,g=j(m),v=g.xSnapped-(V.x??0),y=g.ySnapped-(V.y??0),I=Math.sqrt(v*v+y*y);I!==0&&I<=s.value&&(B?.(m),ie=!0)}if(T.length&&!ie){Q&&(_(T,!1,!1),Q=!1);const[m,g]=Mn({id:O,dragItems:T,findNode:p});$({event:ee.sourceEvent,node:m,nodes:g})}T=[],w.value=!1,Y=!1,W=!1,V={x:void 0,y:void 0},cancelAnimationFrame(te)};return a.watch([()=>a.toValue(F),K],([ee,ie],m,g)=>{if(ie){const v=ye(ie);ee||(S=Vl().on("start",y=>oe(y,ie)).on("drag",y=>se(y,ie)).on("end",y=>ce(y)).filter(y=>{const I=y.target,G=a.toValue(Z);return!y.button&&(!i.value||!li(I,`.${i.value}`,ie)&&(!G||li(I,G,ie)))}),v.call(S)),g(()=>{v.on(".drag",null),S&&(S.on("start",null),S.on("drag",null),S.on("end",null))})}}),w}function cu(){return{doubleClick:L(),click:L(),mouseEnter:L(),mouseMove:L(),mouseLeave:L(),contextMenu:L(),updateStart:L(),update:L(),updateEnd:L()}}function du(e,t){const n=cu();return n.doubleClick.on(o=>{var i,r;t.edgeDoubleClick(o),(r=(i=e.events)==null?void 0:i.doubleClick)==null||r.call(i,o)}),n.click.on(o=>{var i,r;t.edgeClick(o),(r=(i=e.events)==null?void 0:i.click)==null||r.call(i,o)}),n.mouseEnter.on(o=>{var i,r;t.edgeMouseEnter(o),(r=(i=e.events)==null?void 0:i.mouseEnter)==null||r.call(i,o)}),n.mouseMove.on(o=>{var i,r;t.edgeMouseMove(o),(r=(i=e.events)==null?void 0:i.mouseMove)==null||r.call(i,o)}),n.mouseLeave.on(o=>{var i,r;t.edgeMouseLeave(o),(r=(i=e.events)==null?void 0:i.mouseLeave)==null||r.call(i,o)}),n.contextMenu.on(o=>{var i,r;t.edgeContextMenu(o),(r=(i=e.events)==null?void 0:i.contextMenu)==null||r.call(i,o)}),n.updateStart.on(o=>{var i,r;t.edgeUpdateStart(o),(r=(i=e.events)==null?void 0:i.updateStart)==null||r.call(i,o)}),n.update.on(o=>{var i,r;t.edgeUpdate(o),(r=(i=e.events)==null?void 0:i.update)==null||r.call(i,o)}),n.updateEnd.on(o=>{var i,r;t.edgeUpdateEnd(o),(r=(i=e.events)==null?void 0:i.updateEnd)==null||r.call(i,o)}),Object.entries(n).reduce((o,[i,r])=>(o.emit[i]=r.trigger,o.on[i]=r.on,o),{emit:{},on:{}})}function fu(){const{viewport:e,snapGrid:t,snapToGrid:n,vueFlowRef:o}=de();return i=>{var r;const l=((r=o.value)==null?void 0:r.getBoundingClientRect())??{left:0,top:0},s=js(i)?i.sourceEvent:i,{x:u,y:c}=Se(s,l),d=mt({x:u,y:c},e.value),{x:f,y:h}=n.value?Ut(d,t.value):d;return{xSnapped:f,ySnapped:h,...d}}}function Wt(){return!0}function bi({handleId:e,nodeId:t,type:n,isValidConnection:o,edgeUpdaterType:i,onEdgeUpdate:r,onEdgeUpdateEnd:l}){const{id:s,vueFlowRef:u,connectionMode:c,connectionRadius:d,connectOnClick:f,connectionClickStartHandle:h,nodesConnectable:p,autoPanOnConnect:b,autoPanSpeed:x,findNode:N,panBy:k,startConnection:M,updateConnection:_,endConnection:C,emits:A,viewport:P,edges:$,nodes:B,isValidConnection:K,nodeLookup:F}=de();let O=null,E=!1,Z=null;function w(S){var D;const V=a.toValue(n)==="target",R=Pn(S),H=Fo(S.target),W=S.currentTarget;if(W&&(R&&S.button===0||!R)){let Q=function(J){m=Se(J,ce),q=nu(mt(m,P.value,!1,[1,1]),d.value,F.value,y),g||(v(),g=!0);const ne=ci(J,{handle:q,connectionMode:c.value,fromNodeId:a.toValue(t),fromHandleId:a.toValue(e),fromType:V?"target":"source",isValidConnection:j,doc:H,lib:"vue",flowId:s,nodeLookup:F.value},$.value,B.value,N,F.value);Z=ne.handleDomNode,O=ne.connection,E=iu(!!q,ne.isValid);const ae={...U,isValid:E,to:ne.toHandle&&E?pt({x:ne.toHandle.x,y:ne.toHandle.y},P.value):m,toHandle:ne.toHandle,toPosition:E&&ne.toHandle?ne.toHandle.position:$n[y.position],toNode:ne.toHandle?F.value.get(ne.toHandle.nodeId):null};if(E&&q&&U?.toHandle&&ae.toHandle&&U.toHandle.type===ae.toHandle.type&&U.toHandle.nodeId===ae.toHandle.nodeId&&U.toHandle.id===ae.toHandle.id&&U.to.x===ae.to.x&&U.to.y===ae.to.y)return;const ue=q??ne.toHandle;if(_(ue&&E?pt({x:ue.x,y:ue.y},P.value):m,ne.toHandle,ou(!!ue,E)),U=ae,!q&&!E&&!Z)return Tn(ie);O&&O.source!==O.target&&Z&&(Tn(ie),ie=Z,Z.classList.add("connecting","vue-flow__handle-connecting"),Z.classList.toggle("valid",!!E),Z.classList.toggle("vue-flow__handle-valid",!!E))},te=function(J){"touches"in J&&J.touches.length>0||((q||Z)&&O&&E&&(r?r(J,O):A.connect(O)),A.connectEnd(J),i&&l?.(J),Tn(ie),cancelAnimationFrame(re),C(J),g=!1,E=!1,O=null,Z=null,H.removeEventListener("mousemove",Q),H.removeEventListener("mouseup",te),H.removeEventListener("touchmove",Q),H.removeEventListener("touchend",te))};const Y=N(a.toValue(t));let j=a.toValue(o)||K.value||Wt;!j&&Y&&(j=(V?Y.isValidSourcePos:Y.isValidTargetPos)||Wt);let q,re=0;const{x:le,y:oe}=Se(S),se=di(a.toValue(i),W),ce=(D=u.value)==null?void 0:D.getBoundingClientRect();if(!ce||!se)return;const ee=fi(a.toValue(t),se,a.toValue(e),F.value,c.value);if(!ee)return;let ie,m=Se(S,ce),g=!1;const v=()=>{if(!b.value)return;const[J,ne]=ei(m,ce,x.value);k({x:J,y:ne}),re=requestAnimationFrame(v)},y={...ee,nodeId:a.toValue(t),type:se,position:ee.position},I=F.value.get(a.toValue(t)),X={inProgress:!0,isValid:null,from:Je(I,y,z.Left,!0),fromHandle:y,fromPosition:y.position,fromNode:I,to:m,toHandle:null,toPosition:$n[y.position],toNode:null};M({nodeId:a.toValue(t),id:a.toValue(e),type:se,position:W?.getAttribute("data-handlepos")||z.Top,...m},{x:le-ce.left,y:oe-ce.top}),A.connectStart({event:S,nodeId:a.toValue(t),handleId:a.toValue(e),handleType:se});let U=X;H.addEventListener("mousemove",Q),H.addEventListener("mouseup",te),H.addEventListener("touchmove",Q),H.addEventListener("touchend",te)}}function T(S){var D,V;if(!f.value)return;const R=a.toValue(n)==="target";if(!h.value){A.clickConnectStart({event:S,nodeId:a.toValue(t),handleId:a.toValue(e)}),M({nodeId:a.toValue(t),type:a.toValue(n),id:a.toValue(e),position:z.Top,...Se(S)},void 0,!0);return}let H=a.toValue(o)||K.value||Wt;const W=N(a.toValue(t));if(!H&&W&&(H=(R?W.isValidSourcePos:W.isValidTargetPos)||Wt),W&&(typeof W.connectable>"u"?p.value:W.connectable)===!1)return;const Q=Fo(S.target),te=ci(S,{handle:{nodeId:a.toValue(t),id:a.toValue(e),type:a.toValue(n),position:z.Top,...Se(S)},connectionMode:c.value,fromNodeId:h.value.nodeId,fromHandleId:h.value.id??null,fromType:h.value.type,isValidConnection:H,doc:Q,lib:"vue",flowId:s,nodeLookup:F.value},$.value,B.value,N,F.value),Y=((D=te.connection)==null?void 0:D.source)===((V=te.connection)==null?void 0:V.target);te.isValid&&te.connection&&!Y&&A.connect(te.connection),A.clickConnectEnd(S),C(S,!0)}return{handlePointerDown:w,handleClick:T}}function hu(){return a.inject(wi,"")}function xi(e){const t=e??hu()??"",n=a.inject(_i,a.ref(null)),{findNode:o,edges:i,emits:r}=de(),l=o(t);return l||r.error(new ge(fe.NODE_NOT_FOUND,t)),{id:t,nodeEl:n,node:l,parentNode:a.computed(()=>o(l.parentNode)),connectedEdges:a.computed(()=>Ko([l],i.value))}}function gu(){return{doubleClick:L(),click:L(),mouseEnter:L(),mouseMove:L(),mouseLeave:L(),contextMenu:L(),dragStart:L(),drag:L(),dragStop:L()}}function pu(e,t){const n=gu();return n.doubleClick.on(o=>{var i,r;t.nodeDoubleClick(o),(r=(i=e.events)==null?void 0:i.doubleClick)==null||r.call(i,o)}),n.click.on(o=>{var i,r;t.nodeClick(o),(r=(i=e.events)==null?void 0:i.click)==null||r.call(i,o)}),n.mouseEnter.on(o=>{var i,r;t.nodeMouseEnter(o),(r=(i=e.events)==null?void 0:i.mouseEnter)==null||r.call(i,o)}),n.mouseMove.on(o=>{var i,r;t.nodeMouseMove(o),(r=(i=e.events)==null?void 0:i.mouseMove)==null||r.call(i,o)}),n.mouseLeave.on(o=>{var i,r;t.nodeMouseLeave(o),(r=(i=e.events)==null?void 0:i.mouseLeave)==null||r.call(i,o)}),n.contextMenu.on(o=>{var i,r;t.nodeContextMenu(o),(r=(i=e.events)==null?void 0:i.contextMenu)==null||r.call(i,o)}),n.dragStart.on(o=>{var i,r;t.nodeDragStart(o),(r=(i=e.events)==null?void 0:i.dragStart)==null||r.call(i,o)}),n.drag.on(o=>{var i,r;t.nodeDrag(o),(r=(i=e.events)==null?void 0:i.drag)==null||r.call(i,o)}),n.dragStop.on(o=>{var i,r;t.nodeDragStop(o),(r=(i=e.events)==null?void 0:i.dragStop)==null||r.call(i,o)}),Object.entries(n).reduce((o,[i,r])=>(o.emit[i]=r.trigger,o.on[i]=r.on,o),{emit:{},on:{}})}function Si(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:n,findNode:o,snapGrid:i,snapToGrid:r,nodesDraggable:l,emits:s}=de();return(u,c=!1)=>{const d=r.value?i.value[0]:5,f=r.value?i.value[1]:5,h=c?4:1,p=u.x*d*h,b=u.y*f*h,x=[];for(const N of e.value)if(N.draggable||l&&typeof N.draggable>"u"){const k={x:N.computedPosition.x+p,y:N.computedPosition.y+b},{computedPosition:M}=In(N,k,s.error,t.value,N.parentNode?o(N.parentNode):void 0);x.push({id:N.id,position:M,from:N.position,distance:{x:u.x,y:u.y},dimensions:N.dimensions})}n(x,!0,!1)}}const Kt=.1,mu=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function Ve(){return vt("Viewport not initialized yet."),Promise.resolve(!1)}const yu={zoomIn:Ve,zoomOut:Ve,zoomTo:Ve,fitView:Ve,setCenter:Ve,fitBounds:Ve,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Ve,setTransform:Ve,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function vu(e){function t(o,i){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate(i?.interpolate==="linear"?lt:Tt).scaleBy(An(e.d3Selection,i?.duration,i?.ease,()=>{r(!0)}),o):r(!1)})}function n(o,i,r,l){return new Promise(s=>{var u;const{x:c,y:d}=Lo({x:-o,y:-i},e.translateExtent),f=Ke.translate(-c,-d).scale(r);e.d3Selection&&e.d3Zoom?(u=e.d3Zoom)==null||u.interpolate(l?.interpolate==="linear"?lt:Tt).transform(An(e.d3Selection,l?.duration,l?.ease,()=>{s(!0)}),f):s(!1)})}return a.computed(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:i=>t(1.2,i),zoomOut:i=>t(1/1.2,i),zoomTo:(i,r)=>new Promise(l=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate(r?.interpolate==="linear"?lt:Tt).scaleTo(An(e.d3Selection,r?.duration,r?.ease,()=>{l(!0)}),i):l(!1)}),setViewport:(i,r)=>n(i.x,i.y,i.zoom,r),setTransform:(i,r)=>n(i.x,i.y,i.zoom,r),getViewport:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),getTransform:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),fitView:(i={padding:Kt,includeHiddenNodes:!1,duration:0})=>{var r,l;const s=[];for(const h of e.nodes)h.dimensions.width&&h.dimensions.height&&(i?.includeHiddenNodes||!h.hidden)&&(!((r=i.nodes)!=null&&r.length)||(l=i.nodes)!=null&&l.length&&i.nodes.includes(h.id))&&s.push(h);if(!s.length)return Promise.resolve(!1);const u=Zo(s),{x:c,y:d,zoom:f}=qo(u,e.dimensions.width,e.dimensions.height,i.minZoom??e.minZoom,i.maxZoom??e.maxZoom,i.padding??Kt);return n(c,d,f,i)},setCenter:(i,r,l)=>{const s=typeof l?.zoom<"u"?l.zoom:e.maxZoom,u=e.dimensions.width/2-i*s,c=e.dimensions.height/2-r*s;return n(u,c,s,l)},fitBounds:(i,r={padding:Kt})=>{const{x:l,y:s,zoom:u}=qo(i,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding??Kt);return n(l,s,u,r)},project:i=>mt(i,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:i=>{if(e.vueFlowRef){const{x:r,y:l}=e.vueFlowRef.getBoundingClientRect(),s={x:i.x-r,y:i.y-l};return mt(s,e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:i=>{if(e.vueFlowRef){const{x:r,y:l}=e.vueFlowRef.getBoundingClientRect(),s={x:i.x+r,y:i.y+l};return pt(s,e.viewport)}return{x:0,y:0}}}:yu)}function An(e,t=0,n=mu,o=()=>{}){const i=typeof t=="number"&&t>0;return i||o(),i?e.transition().duration(t).ease(n).on("end",o):e}function wu(e,t,n){const o=a.effectScope(!0);return o.run(()=>{const i=()=>{o.run(()=>{let x,N,k=!!(n.nodes.value.length||n.edges.value.length);x=Ge([e.modelValue,()=>{var M,_;return(_=(M=e.modelValue)==null?void 0:M.value)==null?void 0:_.length}],([M])=>{M&&Array.isArray(M)&&(N?.pause(),n.setElements(M),!N&&!k&&M.length?k=!0:N?.resume())}),N=Ge([n.nodes,n.edges,()=>n.edges.value.length,()=>n.nodes.value.length],([M,_])=>{var C;(C=e.modelValue)!=null&&C.value&&Array.isArray(e.modelValue.value)&&(x?.pause(),e.modelValue.value=[...M,..._],a.nextTick(()=>{x?.resume()}))},{immediate:k}),a.onScopeDispose(()=>{x?.stop(),N?.stop()})})},r=()=>{o.run(()=>{let x,N,k=!!n.nodes.value.length;x=Ge([e.nodes,()=>{var M,_;return(_=(M=e.nodes)==null?void 0:M.value)==null?void 0:_.length}],([M])=>{M&&Array.isArray(M)&&(N?.pause(),n.setNodes(M),!N&&!k&&M.length?k=!0:N?.resume())}),N=Ge([n.nodes,()=>n.nodes.value.length],([M])=>{var _;(_=e.nodes)!=null&&_.value&&Array.isArray(e.nodes.value)&&(x?.pause(),e.nodes.value=[...M],a.nextTick(()=>{x?.resume()}))},{immediate:k}),a.onScopeDispose(()=>{x?.stop(),N?.stop()})})},l=()=>{o.run(()=>{let x,N,k=!!n.edges.value.length;x=Ge([e.edges,()=>{var M,_;return(_=(M=e.edges)==null?void 0:M.value)==null?void 0:_.length}],([M])=>{M&&Array.isArray(M)&&(N?.pause(),n.setEdges(M),!N&&!k&&M.length?k=!0:N?.resume())}),N=Ge([n.edges,()=>n.edges.value.length],([M])=>{var _;(_=e.edges)!=null&&_.value&&Array.isArray(e.edges.value)&&(x?.pause(),e.edges.value=[...M],a.nextTick(()=>{x?.resume()}))},{immediate:k}),a.onScopeDispose(()=>{x?.stop(),N?.stop()})})},s=()=>{o.run(()=>{a.watch(()=>t.maxZoom,()=>{t.maxZoom&&he(t.maxZoom)&&n.setMaxZoom(t.maxZoom)},{immediate:!0})})},u=()=>{o.run(()=>{a.watch(()=>t.minZoom,()=>{t.minZoom&&he(t.minZoom)&&n.setMinZoom(t.minZoom)},{immediate:!0})})},c=()=>{o.run(()=>{a.watch(()=>t.translateExtent,()=>{t.translateExtent&&he(t.translateExtent)&&n.setTranslateExtent(t.translateExtent)},{immediate:!0})})},d=()=>{o.run(()=>{a.watch(()=>t.nodeExtent,()=>{t.nodeExtent&&he(t.nodeExtent)&&n.setNodeExtent(t.nodeExtent)},{immediate:!0})})},f=()=>{o.run(()=>{a.watch(()=>t.applyDefault,()=>{he(t.applyDefault)&&(n.applyDefault.value=t.applyDefault)},{immediate:!0})})},h=()=>{o.run(()=>{const x=async N=>{let k=N;typeof t.autoConnect=="function"&&(k=await t.autoConnect(N)),k!==!1&&n.addEdges([k])};a.watch(()=>t.autoConnect,()=>{he(t.autoConnect)&&(n.autoConnect.value=t.autoConnect)},{immediate:!0}),a.watch(n.autoConnect,(N,k,M)=>{N?n.onConnect(x):n.hooks.value.connect.off(x),M(()=>{n.hooks.value.connect.off(x)})},{immediate:!0})})},p=()=>{const x=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const N of Object.keys(t)){const k=N;if(!x.includes(k)){const M=a.toRef(()=>t[k]),_=n[k];a.isRef(_)&&o.run(()=>{a.watch(M,C=>{he(C)&&(_.value=C)},{immediate:!0})})}}};i(),r(),l(),u(),s(),c(),d(),f(),h(),p()}),()=>o.stop()}function _u(){return{edgesChange:L(),nodesChange:L(),nodeDoubleClick:L(),nodeClick:L(),nodeMouseEnter:L(),nodeMouseMove:L(),nodeMouseLeave:L(),nodeContextMenu:L(),nodeDragStart:L(),nodeDrag:L(),nodeDragStop:L(),nodesInitialized:L(),miniMapNodeClick:L(),miniMapNodeDoubleClick:L(),miniMapNodeMouseEnter:L(),miniMapNodeMouseMove:L(),miniMapNodeMouseLeave:L(),connect:L(),connectStart:L(),connectEnd:L(),clickConnectStart:L(),clickConnectEnd:L(),paneReady:L(),init:L(),move:L(),moveStart:L(),moveEnd:L(),selectionDragStart:L(),selectionDrag:L(),selectionDragStop:L(),selectionContextMenu:L(),selectionStart:L(),selectionEnd:L(),viewportChangeStart:L(),viewportChange:L(),viewportChangeEnd:L(),paneScroll:L(),paneClick:L(),paneContextMenu:L(),paneMouseEnter:L(),paneMouseMove:L(),paneMouseLeave:L(),edgeContextMenu:L(),edgeMouseEnter:L(),edgeMouseMove:L(),edgeMouseLeave:L(),edgeDoubleClick:L(),edgeClick:L(),edgeUpdateStart:L(),edgeUpdate:L(),edgeUpdateEnd:L(),updateNodeInternals:L(),error:L(e=>vt(e.message))}}function Eu(e,t){const n=a.getCurrentInstance();a.onBeforeMount(()=>{for(const[i,r]of Object.entries(t.value)){const l=s=>{e(i,s)};r.setEmitter(l),et(r.removeEmitter),r.setHasEmitListeners(()=>o(i)),et(r.removeHasEmitListeners)}});function o(i){var r;const l=bu(i);return!!((r=n?.vnode.props)==null?void 0:r[l])}}function bu(e){const[t,...n]=e.split(":");return`on${t.replace(/(?:^|-)(\w)/g,(i,r)=>r.toUpperCase())}${n.length?`:${n.join(":")}`:""}`}function Ni(){return{vueFlowRef:null,viewportRef:null,nodes:[],edges:[],connectionLookup:new Map,nodeTypes:{},edgeTypes:{},initialized:!1,dimensions:{width:0,height:0},viewport:{x:0,y:0,zoom:1},d3Zoom:null,d3Selection:null,d3ZoomHandler:null,minZoom:.5,maxZoom:2,translateExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],nodeExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],selectionMode:Sn.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:ft.Free,paneClickDistance:0,panOnDrag:!0,edgeUpdaterRadius:10,onlyRenderVisibleElements:!1,defaultViewport:{x:0,y:0,zoom:1},nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,defaultMarkerColor:"#b1b1b7",connectionLineStyle:{},connectionLineType:null,connectionLineOptions:{type:He.Bezier,style:{}},connectionMode:Te.Loose,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectionPosition:{x:Number.NaN,y:Number.NaN},connectionRadius:20,connectOnClick:!0,connectionStatus:null,isValidConnection:null,snapGrid:[15,15],snapToGrid:!1,edgesUpdatable:!1,edgesFocusable:!0,nodesFocusable:!0,nodesConnectable:!0,nodesDraggable:!0,nodeDragThreshold:1,elementsSelectable:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,selectionKeyCode:"Shift",multiSelectionKeyCode:Xt()?"Meta":"Control",zoomActivationKeyCode:Xt()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:_u(),applyDefault:!0,autoConnect:!1,fitViewOnInit:!1,fitViewOnInitDone:!1,noDragClassName:"nodrag",noWheelClassName:"nowheel",noPanClassName:"nopan",defaultEdgeOptions:void 0,elevateEdgesOnSelect:!1,elevateNodesOnSelect:!0,autoPanOnNodeDrag:!0,autoPanOnConnect:!0,autoPanSpeed:15,disableKeyboardA11y:!1,ariaLiveMessage:""}}const xu=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function Su(e,t,n){const o=vu(e),i=m=>{const g=m??[];e.hooks.updateNodeInternals.trigger(g)},r=m=>zs(m,e.nodes,e.edges),l=m=>Os(m,e.nodes,e.edges),s=m=>Ko(m,e.edges),u=({id:m,type:g,nodeId:v})=>{var y;const I=m?`-${g}-${m}`:`-${g}`;return Array.from(((y=e.connectionLookup.get(`${v}${I}`))==null?void 0:y.values())??[])},c=m=>{if(m)return t.value.get(m)},d=m=>{if(m)return n.value.get(m)},f=(m,g,v)=>{var y,I;const G=[];for(const X of m){const U={id:X.id,type:"position",dragging:v,from:X.from};if(g&&(U.position=X.position,X.parentNode)){const J=c(X.parentNode);U.position={x:U.position.x-(((y=J?.computedPosition)==null?void 0:y.x)??0),y:U.position.y-(((I=J?.computedPosition)==null?void 0:I.y)??0)}}G.push(U)}G?.length&&e.hooks.nodesChange.trigger(G)},h=m=>{if(!e.vueFlowRef)return;const g=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!g)return;const v=window.getComputedStyle(g),{m22:y}=new window.DOMMatrixReadOnly(v.transform),I=[];for(const G of m){const X=G,U=c(X.id);if(U){const J=Yt(X.nodeElement);if(!!(J.width&&J.height&&(U.dimensions.width!==J.width||U.dimensions.height!==J.height||X.forceUpdate))){const ae=X.nodeElement.getBoundingClientRect();U.dimensions=J,U.handleBounds.source=gi("source",X.nodeElement,ae,y,U.id),U.handleBounds.target=gi("target",X.nodeElement,ae,y,U.id),I.push({id:U.id,type:"dimensions",dimensions:J})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&o.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),I.length&&e.hooks.nodesChange.trigger(I)},p=(m,g)=>{const v=new Set,y=new Set;for(const X of m)Fe(X)?v.add(X.id):$e(X)&&y.add(X.id);const I=Be(t.value,v,!0),G=Be(n.value,y);if(e.multiSelectionActive){for(const X of v)I.push(De(X,g));for(const X of y)G.push(De(X,g))}I.length&&e.hooks.nodesChange.trigger(I),G.length&&e.hooks.edgesChange.trigger(G)},b=m=>{if(e.multiSelectionActive){const g=m.map(v=>De(v.id,!0));e.hooks.nodesChange.trigger(g);return}e.hooks.nodesChange.trigger(Be(t.value,new Set(m.map(g=>g.id)),!0)),e.hooks.edgesChange.trigger(Be(n.value))},x=m=>{if(e.multiSelectionActive){const g=m.map(v=>De(v.id,!0));e.hooks.edgesChange.trigger(g);return}e.hooks.edgesChange.trigger(Be(n.value,new Set(m.map(g=>g.id)))),e.hooks.nodesChange.trigger(Be(t.value,new Set,!0))},N=m=>{p(m,!0)},k=m=>{const v=(m||e.nodes).map(y=>(y.selected=!1,De(y.id,!1)));e.hooks.nodesChange.trigger(v)},M=m=>{const v=(m||e.edges).map(y=>(y.selected=!1,De(y.id,!1)));e.hooks.edgesChange.trigger(v)},_=m=>{if(!m||!m.length)return p([],!1);const g=m.reduce((v,y)=>{const I=De(y.id,!1);return Fe(y)?v.nodes.push(I):v.edges.push(I),v},{nodes:[],edges:[]});g.nodes.length&&e.hooks.nodesChange.trigger(g.nodes),g.edges.length&&e.hooks.edgesChange.trigger(g.edges)},C=m=>{var g;(g=e.d3Zoom)==null||g.scaleExtent([m,e.maxZoom]),e.minZoom=m},A=m=>{var g;(g=e.d3Zoom)==null||g.scaleExtent([e.minZoom,m]),e.maxZoom=m},P=m=>{var g;(g=e.d3Zoom)==null||g.translateExtent(m),e.translateExtent=m},$=m=>{e.nodeExtent=m,i()},B=m=>{var g;(g=e.d3Zoom)==null||g.clickDistance(m)},K=m=>{e.nodesDraggable=m,e.nodesConnectable=m,e.elementsSelectable=m},F=m=>{const g=m instanceof Function?m(e.nodes):m;!e.initialized&&!g.length||(e.nodes=pi(g,c,e.hooks.error.trigger))},O=m=>{const g=m instanceof Function?m(e.edges):m;if(!e.initialized&&!g.length)return;const v=Vn(g,e.isValidConnection,c,d,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);Bn(e.connectionLookup,n.value,v),e.edges=v},E=m=>{const g=m instanceof Function?m([...e.nodes,...e.edges]):m;!e.initialized&&!g.length||(F(g.filter(Fe)),O(g.filter($e)))},Z=m=>{let g=m instanceof Function?m(e.nodes):m;g=Array.isArray(g)?g:[g];const v=pi(g,c,e.hooks.error.trigger),y=[];for(const I of v)y.push(ni(I));y.length&&e.hooks.nodesChange.trigger(y)},w=m=>{let g=m instanceof Function?m(e.edges):m;g=Array.isArray(g)?g:[g];const v=Vn(g,e.isValidConnection,c,d,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),y=[];for(const I of v)y.push(ni(I));y.length&&e.hooks.edgesChange.trigger(y)},T=(m,g=!0,v=!1)=>{const y=m instanceof Function?m(e.nodes):m,I=Array.isArray(y)?y:[y],G=[],X=[];function U(ne){const ae=s(ne);for(const ue of ae)(!he(ue.deletable)||ue.deletable)&&X.push(ii(ue.id,ue.source,ue.target,ue.sourceHandle,ue.targetHandle))}function J(ne){const ae=[];for(const ue of e.nodes)ue.parentNode===ne&&ae.push(ue);if(ae.length){for(const ue of ae)G.push(oi(ue.id));g&&U(ae);for(const ue of ae)J(ue.id)}}for(const ne of I){const ae=typeof ne=="string"?c(ne):ne;ae&&(he(ae.deletable)&&!ae.deletable||(G.push(oi(ae.id)),g&&U([ae]),v&&J(ae.id)))}X.length&&e.hooks.edgesChange.trigger(X),G.length&&e.hooks.nodesChange.trigger(G)},S=m=>{const g=m instanceof Function?m(e.edges):m,v=Array.isArray(g)?g:[g],y=[];for(const I of v){const G=typeof I=="string"?d(I):I;G&&(he(G.deletable)&&!G.deletable||y.push(ii(typeof I=="string"?I:I.id,G.source,G.target,G.sourceHandle,G.targetHandle)))}e.hooks.edgesChange.trigger(y)},D=(m,g,v=!0)=>{const y=d(m.id);if(!y)return!1;const I=e.edges.indexOf(y),G=au(m,g,y,v,e.hooks.error.trigger);if(G){const[X]=Vn([G],e.isValidConnection,c,d,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((U,J)=>J===I?X:U),Bn(e.connectionLookup,n.value,[X]),X}return!1},V=(m,g,v={replace:!1})=>{const y=d(m);if(!y)return;const I=typeof g=="function"?g(y):g;y.data=v.replace?I:{...y.data,...I}},R=m=>ti(m,e.nodes),H=m=>{const g=ti(m,e.edges);return Bn(e.connectionLookup,n.value,g),g},W=(m,g,v={replace:!1})=>{const y=c(m);if(!y)return;const I=typeof g=="function"?g(y):g;v.replace?e.nodes.splice(e.nodes.indexOf(y),1,I):Object.assign(y,I)},Q=(m,g,v={replace:!1})=>{const y=c(m);if(!y)return;const I=typeof g=="function"?g(y):g;y.data=v.replace?I:{...y.data,...I}},te=(m,g,v=!1)=>{v?e.connectionClickStartHandle=m:e.connectionStartHandle=m,e.connectionEndHandle=null,e.connectionStatus=null,g&&(e.connectionPosition=g)},Y=(m,g=null,v=null)=>{e.connectionStartHandle&&(e.connectionPosition=m,e.connectionEndHandle=g,e.connectionStatus=v)},j=(m,g)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,g?e.connectionClickStartHandle=null:e.connectionStartHandle=null},q=m=>{const g=Vs(m),v=g?null:gt(m)?m:c(m.id);return!g&&!v?[null,null,g]:[g?m:Lt(v),v,g]},re=(m,g=!0,v=e.nodes)=>{const[y,I,G]=q(m);if(!y)return[];const X=[];for(const U of v||e.nodes){if(!G&&(U.id===I.id||!U.computedPosition))continue;const J=Lt(U),ne=Ft(J,y);(g&&ne>0||ne>=J.width*J.height||ne>=Number(y.width)*Number(y.height))&&X.push(U)}return X},le=(m,g,v=!0)=>{const[y]=q(m);if(!y)return!1;const I=Ft(y,g);return v&&I>0||I>=Number(y.width)*Number(y.height)},oe=m=>{const{viewport:g,dimensions:v,d3Zoom:y,d3Selection:I,translateExtent:G}=e;if(!y||!I||!m.x&&!m.y)return!1;const X=Ke.translate(g.x+m.x,g.y+m.y).scale(g.zoom),U=[[0,0],[v.width,v.height]],J=y.constrain()(X,U,G),ne=e.viewport.x!==J.x||e.viewport.y!==J.y||e.viewport.zoom!==J.k;return y.transform(I,J),ne},se=m=>{const g=m instanceof Function?m(e):m,v=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];he(g.defaultEdgeOptions)&&(e.defaultEdgeOptions=g.defaultEdgeOptions);const y=g.modelValue||g.nodes||g.edges?[]:void 0;y&&(g.modelValue&&y.push(...g.modelValue),g.nodes&&y.push(...g.nodes),g.edges&&y.push(...g.edges),E(y));const I=()=>{he(g.maxZoom)&&A(g.maxZoom),he(g.minZoom)&&C(g.minZoom),he(g.translateExtent)&&P(g.translateExtent)};for(const G of Object.keys(g)){const X=G,U=g[X];![...xu,...v].includes(X)&&he(U)&&(e[X]=U)}nn(()=>e.d3Zoom).not.toBeNull().then(I),e.initialized||(e.initialized=!0)};return{updateNodePositions:f,updateNodeDimensions:h,setElements:E,setNodes:F,setEdges:O,addNodes:Z,addEdges:w,removeNodes:T,removeEdges:S,findNode:c,findEdge:d,updateEdge:D,updateEdgeData:V,updateNode:W,updateNodeData:Q,applyEdgeChanges:H,applyNodeChanges:R,addSelectedElements:N,addSelectedNodes:b,addSelectedEdges:x,setMinZoom:C,setMaxZoom:A,setTranslateExtent:P,setNodeExtent:$,setPaneClickDistance:B,removeSelectedElements:_,removeSelectedNodes:k,removeSelectedEdges:M,startConnection:te,updateConnection:Y,endConnection:j,setInteractive:K,setState:se,getIntersectingNodes:re,getIncomers:r,getOutgoers:l,getConnectedEdges:s,getHandleConnections:u,isNodeIntersecting:le,panBy:oe,fitView:m=>o.value.fitView(m),zoomIn:m=>o.value.zoomIn(m),zoomOut:m=>o.value.zoomOut(m),zoomTo:(m,g)=>o.value.zoomTo(m,g),setViewport:(m,g)=>o.value.setViewport(m,g),setTransform:(m,g)=>o.value.setTransform(m,g),getViewport:()=>o.value.getViewport(),getTransform:()=>o.value.getTransform(),setCenter:(m,g,v)=>o.value.setCenter(m,g,v),fitBounds:(m,g)=>o.value.fitBounds(m,g),project:m=>o.value.project(m),screenToFlowCoordinate:m=>o.value.screenToFlowCoordinate(m),flowToScreenCoordinate:m=>o.value.flowToScreenCoordinate(m),toObject:()=>{const m=[],g=[];for(const v of e.nodes){const{computedPosition:y,handleBounds:I,selected:G,dimensions:X,isParent:U,resizing:J,dragging:ne,events:ae,...ue}=v;m.push(ue)}for(const v of e.edges){const{selected:y,sourceNode:I,targetNode:G,events:X,...U}=v;g.push(U)}return JSON.parse(JSON.stringify({nodes:m,edges:g,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:m=>new Promise(g=>{const{nodes:v,edges:y,position:I,zoom:G,viewport:X}=m;if(v&&F(v),y&&O(y),X?.x&&X?.y||I){const U=X?.x||I[0],J=X?.y||I[1],ne=X?.zoom||G||e.viewport.zoom;return nn(()=>o.value.viewportInitialized).toBe(!0).then(()=>{o.value.setViewport({x:U,y:J,zoom:ne}).then(()=>{g(!0)})})}else g(!0)}),updateNodeInternals:i,viewportHelper:o,$reset:()=>{const m=Ni();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const g=Ke.translate(m.defaultViewport.x??0,m.defaultViewport.y??0).scale(Le(m.defaultViewport.zoom??1,m.minZoom,m.maxZoom)),v=e.viewportRef.getBoundingClientRect(),y=[[0,0],[v.width,v.height]],I=e.d3Zoom.constrain()(g,y,m.translateExtent);e.d3Zoom.transform(e.d3Selection,I)}se(m)},$destroy:()=>{}}}const Nu=["data-id","data-handleid","data-nodeid","data-handlepos"],Cu={name:"Handle",compatConfig:{MODE:3}},Qe=a.defineComponent({...Cu,props:{id:{default:null},type:{},position:{default:()=>z.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(e,{expose:t}){const n=a.createPropsRestProxy(e,["position","connectable","connectableStart","connectableEnd","id"]),o=a.toRef(()=>n.type??"source"),i=a.toRef(()=>n.isValidConnection??null),{id:r,connectionStartHandle:l,connectionClickStartHandle:s,connectionEndHandle:u,vueFlowRef:c,nodesConnectable:d,noDragClassName:f,noPanClassName:h}=de(),{id:p,node:b,nodeEl:x,connectedEdges:N}=xi(),k=a.ref(),M=a.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),_=a.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),C=a.toRef(()=>{var O,E,Z,w,T,S;return((O=l.value)==null?void 0:O.nodeId)===p&&((E=l.value)==null?void 0:E.id)===e.id&&((Z=l.value)==null?void 0:Z.type)===o.value||((w=u.value)==null?void 0:w.nodeId)===p&&((T=u.value)==null?void 0:T.id)===e.id&&((S=u.value)==null?void 0:S.type)===o.value}),A=a.toRef(()=>{var O,E,Z;return((O=s.value)==null?void 0:O.nodeId)===p&&((E=s.value)==null?void 0:E.id)===e.id&&((Z=s.value)==null?void 0:Z.type)===o.value}),{handlePointerDown:P,handleClick:$}=bi({nodeId:p,handleId:e.id,isValidConnection:i,type:o}),B=a.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!N.value.some(O=>{const E=O[`${o.value}Handle`];return O[o.value]!==p?!1:E?E===e.id:!0}):typeof e.connectable=="number"?N.value.filter(O=>{const E=O[`${o.value}Handle`];return O[o.value]!==p?!1:E?E===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(b,N.value):he(e.connectable)?e.connectable:d.value);a.onMounted(()=>{var O;if(!b.dimensions.width||!b.dimensions.height)return;const E=(O=b.handleBounds[o.value])==null?void 0:O.find(R=>R.id===e.id);if(!c.value||E)return;const Z=c.value.querySelector(".vue-flow__transformationpane");if(!x.value||!k.value||!Z||!e.id)return;const w=x.value.getBoundingClientRect(),T=k.value.getBoundingClientRect(),S=window.getComputedStyle(Z),{m22:D}=new window.DOMMatrixReadOnly(S.transform),V={id:e.id,position:e.position,x:(T.left-w.left)/D,y:(T.top-w.top)/D,type:o.value,nodeId:p,...Yt(k.value)};b.handleBounds[o.value]=[...b.handleBounds[o.value]??[],V]});function K(O){const E=Pn(O);B.value&&M.value&&(E&&O.button===0||!E)&&P(O)}function F(O){!p||!s.value&&!M.value||B.value&&$(O)}return t({handleClick:$,handlePointerDown:P,onClick:F,onPointerDown:K}),(O,E)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"handle",ref:k,"data-id":`${a.unref(r)}-${a.unref(p)}-${e.id}-${o.value}`,"data-handleid":e.id,"data-nodeid":a.unref(p),"data-handlepos":O.position,class:a.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${O.position}`,`vue-flow__handle-${e.id}`,a.unref(f),a.unref(h),o.value,{connectable:B.value,connecting:A.value,connectablestart:M.value,connectableend:_.value,connectionindicator:B.value&&(M.value&&!C.value||_.value&&C.value)}]]),onMousedown:K,onTouchstartPassive:K,onClick:F},[a.renderSlot(O.$slots,"default",{id:O.id})],42,Nu))}}),qt=function({sourcePosition:e=z.Bottom,targetPosition:t=z.Top,label:n,connectable:o=!0,isValidTargetPos:i,isValidSourcePos:r,data:l}){const s=l.label??n;return[a.h(Qe,{type:"target",position:t,connectable:o,isValidConnection:i}),typeof s!="string"&&s?a.h(s):a.h(a.Fragment,[s]),a.h(Qe,{type:"source",position:e,connectable:o,isValidConnection:r})]};qt.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],qt.inheritAttrs=!1,qt.compatConfig={MODE:3};const ku=qt,jt=function({targetPosition:e=z.Top,label:t,connectable:n=!0,isValidTargetPos:o,data:i}){const r=i.label??t;return[a.h(Qe,{type:"target",position:e,connectable:n,isValidConnection:o}),typeof r!="string"&&r?a.h(r):a.h(a.Fragment,[r])]};jt.props=["targetPosition","label","isValidTargetPos","connectable","data"],jt.inheritAttrs=!1,jt.compatConfig={MODE:3};const Mu=jt,Jt=function({sourcePosition:e=z.Bottom,label:t,connectable:n=!0,isValidSourcePos:o,data:i}){const r=i.label??t;return[typeof r!="string"&&r?a.h(r):a.h(a.Fragment,[r]),a.h(Qe,{type:"source",position:e,connectable:n,isValidConnection:o})]};Jt.props=["sourcePosition","label","isValidSourcePos","connectable","data"],Jt.inheritAttrs=!1,Jt.compatConfig={MODE:3};const Iu=Jt,Pu=["transform"],Tu=["width","height","x","y","rx","ry"],$u=["y"],Du={name:"EdgeText",compatConfig:{MODE:3}},Bu=a.defineComponent({...Du,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const t=a.ref({x:0,y:0,width:0,height:0}),n=a.ref(null),o=a.computed(()=>`translate(${e.x-t.value.width/2} ${e.y-t.value.height/2})`);a.onMounted(i),a.watch([()=>e.x,()=>e.y,n,()=>e.label],i);function i(){if(!n.value)return;const r=n.value.getBBox();(r.width!==t.value.width||r.height!==t.value.height)&&(t.value=r)}return(r,l)=>(a.openBlock(),a.createElementBlock("g",{transform:o.value,class:"vue-flow__edge-textwrapper"},[r.labelShowBg?(a.openBlock(),a.createElementBlock("rect",{key:0,class:"vue-flow__edge-textbg",width:`${t.value.width+2*r.labelBgPadding[0]}px`,height:`${t.value.height+2*r.labelBgPadding[1]}px`,x:-r.labelBgPadding[0],y:-r.labelBgPadding[1],style:a.normalizeStyle(r.labelBgStyle),rx:r.labelBgBorderRadius,ry:r.labelBgBorderRadius},null,12,Tu)):a.createCommentVNode("",!0),a.createElementVNode("text",a.mergeProps(r.$attrs,{ref_key:"el",ref:n,class:"vue-flow__edge-text",y:t.value.height/2,dy:"0.3em",style:r.labelStyle}),[a.renderSlot(r.$slots,"default",{},()=>[typeof r.label!="string"?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(r.label),{key:0})):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[a.createTextVNode(a.toDisplayString(r.label),1)],64))])],16,$u)],8,Pu))}}),Vu=["id","d","marker-end","marker-start"],Au=["d","stroke-width"],Ou={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},Qt=a.defineComponent({...Ou,props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:t}){const n=a.ref(null),o=a.ref(null),i=a.ref(null),r=a.useAttrs();return t({pathEl:n,interactionEl:o,labelEl:i}),(l,s)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("path",a.mergeProps(a.unref(r),{id:l.id,ref_key:"pathEl",ref:n,d:l.path,class:"vue-flow__edge-path","marker-end":l.markerEnd,"marker-start":l.markerStart}),null,16,Vu),l.interactionWidth?(a.openBlock(),a.createElementBlock("path",{key:0,ref_key:"interactionEl",ref:o,fill:"none",d:l.path,"stroke-width":l.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,Au)):a.createCommentVNode("",!0),l.label&&l.labelX&&l.labelY?(a.openBlock(),a.createBlock(Bu,{key:1,ref_key:"labelEl",ref:i,x:l.labelX,y:l.labelY,label:l.label,"label-show-bg":l.labelShowBg,"label-bg-style":l.labelBgStyle,"label-bg-padding":l.labelBgPadding,"label-bg-border-radius":l.labelBgBorderRadius,"label-style":l.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):a.createCommentVNode("",!0)],64))}});function Ci({sourceX:e,sourceY:t,targetX:n,targetY:o}){const i=Math.abs(n-e)/2,r=n<e?n+i:n-i,l=Math.abs(o-t)/2,s=o<t?o+l:o-l;return[r,s,i,l]}function ki({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:i,sourceControlY:r,targetControlX:l,targetControlY:s}){const u=e*.125+i*.375+l*.375+n*.125,c=t*.125+r*.375+s*.375+o*.125,d=Math.abs(u-e),f=Math.abs(c-t);return[u,c,d,f]}function en(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Mi({pos:e,x1:t,y1:n,x2:o,y2:i,c:r}){let l,s;switch(e){case z.Left:l=t-en(t-o,r),s=n;break;case z.Right:l=t+en(o-t,r),s=n;break;case z.Top:l=t,s=n-en(n-i,r);break;case z.Bottom:l=t,s=n+en(i-n,r);break}return[l,s]}function On(e){const{sourceX:t,sourceY:n,sourcePosition:o=z.Bottom,targetX:i,targetY:r,targetPosition:l=z.Top,curvature:s=.25}=e,[u,c]=Mi({pos:o,x1:t,y1:n,x2:i,y2:r,c:s}),[d,f]=Mi({pos:l,x1:i,y1:r,x2:t,y2:n,c:s}),[h,p,b,x]=ki({sourceX:t,sourceY:n,targetX:i,targetY:r,sourceControlX:u,sourceControlY:c,targetControlX:d,targetControlY:f});return[`M${t},${n} C${u},${c} ${d},${f} ${i},${r}`,h,p,b,x]}function Ii({pos:e,x1:t,y1:n,x2:o,y2:i}){let r,l;switch(e){case z.Left:case z.Right:r=.5*(t+o),l=n;break;case z.Top:case z.Bottom:r=t,l=.5*(n+i);break}return[r,l]}function Pi(e){const{sourceX:t,sourceY:n,sourcePosition:o=z.Bottom,targetX:i,targetY:r,targetPosition:l=z.Top}=e,[s,u]=Ii({pos:o,x1:t,y1:n,x2:i,y2:r}),[c,d]=Ii({pos:l,x1:i,y1:r,x2:t,y2:n}),[f,h,p,b]=ki({sourceX:t,sourceY:n,targetX:i,targetY:r,sourceControlX:s,sourceControlY:u,targetControlX:c,targetControlY:d});return[`M${t},${n} C${s},${u} ${c},${d} ${i},${r}`,f,h,p,b]}const Ti={[z.Left]:{x:-1,y:0},[z.Right]:{x:1,y:0},[z.Top]:{x:0,y:-1},[z.Bottom]:{x:0,y:1}};function zu({source:e,sourcePosition:t=z.Bottom,target:n}){return t===z.Left||t===z.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1}}function $i(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function Ru({source:e,sourcePosition:t=z.Bottom,target:n,targetPosition:o=z.Top,center:i,offset:r}){const l=Ti[t],s=Ti[o],u={x:e.x+l.x*r,y:e.y+l.y*r},c={x:n.x+s.x*r,y:n.y+s.y*r},d=zu({source:u,sourcePosition:t,target:c}),f=d.x!==0?"x":"y",h=d[f];let p,b,x;const N={x:0,y:0},k={x:0,y:0},[M,_,C,A]=Ci({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[f]*s[f]===-1){b=i.x??M,x=i.y??_;const $=[{x:b,y:u.y},{x:b,y:c.y}],B=[{x:u.x,y:x},{x:c.x,y:x}];l[f]===h?p=f==="x"?$:B:p=f==="x"?B:$}else{const $=[{x:u.x,y:c.y}],B=[{x:c.x,y:u.y}];if(f==="x"?p=l.x===h?B:$:p=l.y===h?$:B,t===o){const Z=Math.abs(e[f]-n[f]);if(Z<=r){const w=Math.min(r-1,r-Z);l[f]===h?N[f]=(u[f]>e[f]?-1:1)*w:k[f]=(c[f]>n[f]?-1:1)*w}}if(t!==o){const Z=f==="x"?"y":"x",w=l[f]===s[Z],T=u[Z]>c[Z],S=u[Z]<c[Z];(l[f]===1&&(!w&&T||w&&S)||l[f]!==1&&(!w&&S||w&&T))&&(p=f==="x"?$:B)}const K={x:u.x+N.x,y:u.y+N.y},F={x:c.x+k.x,y:c.y+k.y},O=Math.max(Math.abs(K.x-p[0].x),Math.abs(F.x-p[0].x)),E=Math.max(Math.abs(K.y-p[0].y),Math.abs(F.y-p[0].y));O>=E?(b=(K.x+F.x)/2,x=p[0].y):(b=p[0].x,x=(K.y+F.y)/2)}return[[e,{x:u.x+N.x,y:u.y+N.y},...p,{x:c.x+k.x,y:c.y+k.y},n],b,x,C,A]}function Hu(e,t,n,o){const i=Math.min($i(e,t)/2,$i(t,n)/2,o),{x:r,y:l}=t;if(e.x===r&&r===n.x||e.y===l&&l===n.y)return`L${r} ${l}`;if(e.y===l){const c=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${r+i*c},${l}Q ${r},${l} ${r},${l+i*d}`}const s=e.x<n.x?1:-1,u=e.y<n.y?-1:1;return`L ${r},${l+i*u}Q ${r},${l} ${r+i*s},${l}`}function zn(e){const{sourceX:t,sourceY:n,sourcePosition:o=z.Bottom,targetX:i,targetY:r,targetPosition:l=z.Top,borderRadius:s=5,centerX:u,centerY:c,offset:d=20}=e,[f,h,p,b,x]=Ru({source:{x:t,y:n},sourcePosition:o,target:{x:i,y:r},targetPosition:l,center:{x:u,y:c},offset:d});return[f.reduce((k,M,_)=>{let C;return _>0&&_<f.length-1?C=Hu(f[_-1],M,f[_+1],s):C=`${_===0?"M":"L"}${M.x} ${M.y}`,k+=C,k},""),h,p,b,x]}function Lu(e){const{sourceX:t,sourceY:n,targetX:o,targetY:i}=e,[r,l,s,u]=Ci({sourceX:t,sourceY:n,targetX:o,targetY:i});return[`M ${t},${n}L ${o},${i}`,r,l,s,u]}const Fu=a.defineComponent({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=Lu(e);return a.h(Qt,{path:n,labelX:o,labelY:i,...t,...e})}}}),Di=a.defineComponent({name:"SmoothStepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","borderRadius","markerEnd","markerStart","interactionWidth","offset"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=zn({...e,sourcePosition:e.sourcePosition??z.Bottom,targetPosition:e.targetPosition??z.Top});return a.h(Qt,{path:n,labelX:o,labelY:i,...t,...e})}}}),Yu=a.defineComponent({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:t}){return()=>a.h(Di,{...e,...t,borderRadius:0})}}),Gu=a.defineComponent({name:"BezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=On({...e,sourcePosition:e.sourcePosition??z.Bottom,targetPosition:e.targetPosition??z.Top});return a.h(Qt,{path:n,labelX:o,labelY:i,...t,...e})}}}),Xu=a.defineComponent({name:"SimpleBezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=Pi({...e,sourcePosition:e.sourcePosition??z.Bottom,targetPosition:e.targetPosition??z.Top});return a.h(Qt,{path:n,labelX:o,labelY:i,...t,...e})}}}),Uu={input:Iu,default:ku,output:Mu},Zu={default:Gu,straight:Fu,step:Yu,smoothstep:Di,simplebezier:Xu};function Wu(e,t,n){const o=a.computed(()=>x=>t.value.get(x)),i=a.computed(()=>x=>n.value.get(x)),r=a.computed(()=>{const x={...Zu,...e.edgeTypes},N=Object.keys(x);for(const k of e.edges)k.type&&!N.includes(k.type)&&(x[k.type]=k.type);return x}),l=a.computed(()=>{const x={...Uu,...e.nodeTypes},N=Object.keys(x);for(const k of e.nodes)k.type&&!N.includes(k.type)&&(x[k.type]=k.type);return x}),s=a.computed(()=>e.onlyRenderVisibleElements?Wo(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),u=a.computed(()=>{if(e.onlyRenderVisibleElements){const x=[];for(const N of e.edges){const k=t.value.get(N.source),M=t.value.get(N.target);Ks({sourcePos:k.computedPosition||{x:0,y:0},targetPos:M.computedPosition||{x:0,y:0},sourceWidth:k.dimensions.width,sourceHeight:k.dimensions.height,targetWidth:M.dimensions.width,targetHeight:M.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&x.push(N)}return x}return e.edges}),c=a.computed(()=>[...s.value,...u.value]),d=a.computed(()=>{const x=[];for(const N of e.nodes)N.selected&&x.push(N);return x}),f=a.computed(()=>{const x=[];for(const N of e.edges)N.selected&&x.push(N);return x}),h=a.computed(()=>[...d.value,...f.value]),p=a.computed(()=>{const x=[];for(const N of e.nodes)N.dimensions.width&&N.dimensions.height&&N.handleBounds!==void 0&&x.push(N);return x}),b=a.computed(()=>s.value.length>0&&p.value.length===s.value.length);return{getNode:o,getEdge:i,getElements:c,getEdgeTypes:r,getNodeTypes:l,getEdges:u,getNodes:s,getSelectedElements:h,getSelectedNodes:d,getSelectedEdges:f,getNodesInitialized:p,areNodesInitialized:b}}class Ye{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var t;const n=(t=a.getCurrentInstance())==null?void 0:t.appContext.app,o=n?.config.globalProperties.$vueFlowStorage??Ye.instance;return Ye.instance=o??new Ye,n&&(n.config.globalProperties.$vueFlowStorage=Ye.instance),Ye.instance}set(t,n){return this.flows.set(t,n)}get(t){return this.flows.get(t)}remove(t){return this.flows.delete(t)}create(t,n){const o=Ni(),i=a.reactive(o),r={};for(const[h,p]of Object.entries(i.hooks)){const b=`on${h.charAt(0).toUpperCase()+h.slice(1)}`;r[b]=p.on}const l={};for(const[h,p]of Object.entries(i.hooks))l[h]=p.trigger;const s=a.computed(()=>{const h=new Map;for(const p of i.nodes)h.set(p.id,p);return h}),u=a.computed(()=>{const h=new Map;for(const p of i.edges)h.set(p.id,p);return h}),c=Wu(i,s,u),d=Su(i,s,u);d.setState({...i,...n});const f={...r,...c,...d,...Gi(i),nodeLookup:s,edgeLookup:u,emits:l,id:t,vueFlowVersion:"1.47.0",$destroy:()=>{this.remove(t)}};return this.set(t,f),f}getId(){return`vue-flow-${this.currentId++}`}}function de(e){const t=Ye.getInstance(),n=a.getCurrentScope(),o=typeof e=="object",i=o?e:{id:e},r=i.id,l=r??n?.vueFlowId;let s;if(n){const u=a.inject(vi,null);typeof u<"u"&&u!==null&&(!l||u.id===l)&&(s=u)}if(s||l&&(s=t.get(l)),!s||l&&s.id!==l){const u=r??t.getId(),c=t.create(u,i);s=c,(n??a.effectScope(!0)).run(()=>{a.watch(c.applyDefault,(f,h,p)=>{const b=N=>{c.applyNodeChanges(N)},x=N=>{c.applyEdgeChanges(N)};f?(c.onNodesChange(b),c.onEdgesChange(x)):(c.hooks.value.nodesChange.off(b),c.hooks.value.edgesChange.off(x)),p(()=>{c.hooks.value.nodesChange.off(b),c.hooks.value.edgesChange.off(x)})},{immediate:!0}),et(()=>{if(s){const f=t.get(s.id);f?f.$destroy():vt(`No store instance found for id ${s.id} in storage.`)}})})}else o&&s.setState(i);if(n&&(a.provide(vi,s),n.vueFlowId=s.id),o){const u=a.getCurrentInstance();u?.type.name!=="VueFlow"&&s.emits.error(new ge(fe.USEVUEFLOW_OPTIONS))}return s}function Ku(e){const{emits:t,dimensions:n}=de();let o;a.onMounted(()=>{const i=()=>{var r,l;if(!e.value||!(((l=(r=e.value).checkVisibility)==null?void 0:l.call(r))??!0))return;const s=Yt(e.value);(s.width===0||s.height===0)&&t.error(new ge(fe.MISSING_VIEWPORT_DIMENSIONS)),n.value={width:s.width||500,height:s.height||500}};i(),window.addEventListener("resize",i),e.value&&(o=new ResizeObserver(()=>i()),o.observe(e.value)),a.onBeforeUnmount(()=>{window.removeEventListener("resize",i),o&&e.value&&o.unobserve(e.value)})})}const qu={name:"UserSelection",compatConfig:{MODE:3}},ju=a.defineComponent({...qu,props:{userSelectionRect:{}},setup(e){return(t,n)=>(a.openBlock(),a.createElementBlock("div",{class:"vue-flow__selection vue-flow__container",style:a.normalizeStyle({width:`${t.userSelectionRect.width}px`,height:`${t.userSelectionRect.height}px`,transform:`translate(${t.userSelectionRect.x}px, ${t.userSelectionRect.y}px)`})},null,4))}}),Ju=["tabIndex"],Qu={name:"NodesSelection",compatConfig:{MODE:3}},ec=a.defineComponent({...Qu,setup(e){const{emits:t,viewport:n,getSelectedNodes:o,noPanClassName:i,disableKeyboardA11y:r,userSelectionActive:l}=de(),s=Si(),u=a.ref(null),c=Ei({el:u,onStart(b){t.selectionDragStart(b),t.nodeDragStart(b)},onDrag(b){t.selectionDrag(b),t.nodeDrag(b)},onStop(b){t.selectionDragStop(b),t.nodeDragStop(b)}});a.onMounted(()=>{var b;r.value||(b=u.value)==null||b.focus({preventScroll:!0})});const d=a.computed(()=>Zo(o.value)),f=a.computed(()=>({width:`${d.value.width}px`,height:`${d.value.height}px`,top:`${d.value.y}px`,left:`${d.value.x}px`}));function h(b){t.selectionContextMenu({event:b,nodes:o.value})}function p(b){r||qe[b.key]&&(b.preventDefault(),s({x:qe[b.key].x,y:qe[b.key].y},b.shiftKey))}return(b,x)=>!a.unref(l)&&d.value.width&&d.value.height?(a.openBlock(),a.createElementBlock("div",{key:0,class:a.normalizeClass(["vue-flow__nodesselection vue-flow__container",a.unref(i)]),style:a.normalizeStyle({transform:`translate(${a.unref(n).x}px,${a.unref(n).y}px) scale(${a.unref(n).zoom})`})},[a.createElementVNode("div",{ref_key:"el",ref:u,class:a.normalizeClass([{dragging:a.unref(c)},"vue-flow__nodesselection-rect"]),style:a.normalizeStyle(f.value),tabIndex:a.unref(r)?void 0:-1,onContextmenu:h,onKeydown:p},null,46,Ju)],6)):a.createCommentVNode("",!0)}});function tc(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const nc={name:"Pane",compatConfig:{MODE:3}},oc=a.defineComponent({...nc,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:t,nodes:n,viewport:o,emits:i,userSelectionActive:r,removeSelectedElements:l,userSelectionRect:s,elementsSelectable:u,nodesSelectionActive:c,getSelectedEdges:d,getSelectedNodes:f,removeNodes:h,removeEdges:p,selectionMode:b,deleteKeyCode:x,multiSelectionKeyCode:N,multiSelectionActive:k,edgeLookup:M,nodeLookup:_,connectionLookup:C,defaultEdgeOptions:A,connectionStartHandle:P}=de(),$=a.ref(null),B=a.ref(new Set),K=a.ref(new Set),F=a.ref(),O=a.toRef(()=>u.value&&(e.isSelecting||r.value)),E=a.toRef(()=>P.value!==null);let Z=!1,w=!1;const T=ht(x,{actInsideInputWithModifier:!1}),S=ht(N);a.watch(T,Y=>{Y&&(h(f.value),p(d.value),c.value=!1)}),a.watch(S,Y=>{k.value=Y});function D(Y,j){return q=>{q.target===j&&Y?.(q)}}function V(Y){if(Z||E.value){Z=!1;return}i.paneClick(Y),l(),c.value=!1}function R(Y){Y.preventDefault(),Y.stopPropagation(),i.paneContextMenu(Y)}function H(Y){i.paneScroll(Y)}function W(Y){var j,q,re;if(F.value=(j=t.value)==null?void 0:j.getBoundingClientRect(),!u.value||!e.isSelecting||Y.button!==0||Y.target!==$.value||!F.value)return;(re=(q=Y.target)==null?void 0:q.setPointerCapture)==null||re.call(q,Y.pointerId);const{x:le,y:oe}=tc(Y,F.value);w=!0,Z=!1,l(),s.value={width:0,height:0,startX:le,startY:oe,x:le,y:oe},i.selectionStart(Y)}function Q(Y){var j;if(!F.value||!s.value)return;Z=!0;const{x:q,y:re}=Se(Y,F.value),{startX:le=0,startY:oe=0}=s.value,se={startX:le,startY:oe,x:q<le?q:le,y:re<oe?re:oe,width:Math.abs(q-le),height:Math.abs(re-oe)},ce=B.value,ee=K.value;B.value=new Set(Wo(n.value,se,o.value,b.value===Sn.Partial,!0).map(m=>m.id)),K.value=new Set;const ie=((j=A.value)==null?void 0:j.selectable)??!0;for(const m of B.value){const g=C.value.get(m);if(g)for(const{edgeId:v}of g.values()){const y=M.value.get(v);y&&(y.selectable??ie)&&K.value.add(v)}}if(!yi(ce,B.value)){const m=Be(_.value,B.value,!0);i.nodesChange(m)}if(!yi(ee,K.value)){const m=Be(M.value,K.value);i.edgesChange(m)}s.value=se,r.value=!0,c.value=!1}function te(Y){var j;Y.button!==0||!w||((j=Y.target)==null||j.releasePointerCapture(Y.pointerId),!r.value&&s.value&&Y.target===$.value&&V(Y),r.value=!1,s.value=null,c.value=B.value.size>0,i.selectionEnd(Y),e.selectionKeyPressed&&(Z=!1),w=!1)}return(Y,j)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"container",ref:$,class:a.normalizeClass(["vue-flow__pane vue-flow__container",{selection:Y.isSelecting}]),onClick:j[0]||(j[0]=q=>O.value?void 0:D(V,$.value)(q)),onContextmenu:j[1]||(j[1]=q=>D(R,$.value)(q)),onWheelPassive:j[2]||(j[2]=q=>D(H,$.value)(q)),onPointerenter:j[3]||(j[3]=q=>O.value?void 0:a.unref(i).paneMouseEnter(q)),onPointerdown:j[4]||(j[4]=q=>O.value?W(q):a.unref(i).paneMouseMove(q)),onPointermove:j[5]||(j[5]=q=>O.value?Q(q):a.unref(i).paneMouseMove(q)),onPointerup:j[6]||(j[6]=q=>O.value?te(q):void 0),onPointerleave:j[7]||(j[7]=q=>a.unref(i).paneMouseLeave(q))},[a.renderSlot(Y.$slots,"default"),a.unref(r)&&a.unref(s)?(a.openBlock(),a.createBlock(ju,{key:0,"user-selection-rect":a.unref(s)},null,8,["user-selection-rect"])):a.createCommentVNode("",!0),a.unref(c)&&a.unref(f).length?(a.openBlock(),a.createBlock(ec,{key:1})):a.createCommentVNode("",!0)],34))}}),ic={name:"Transform",compatConfig:{MODE:3}},rc=a.defineComponent({...ic,setup(e){const{viewport:t,fitViewOnInit:n,fitViewOnInitDone:o}=de(),i=a.computed(()=>n.value?!o.value:!1),r=a.computed(()=>`translate(${t.value.x}px,${t.value.y}px) scale(${t.value.zoom})`);return(l,s)=>(a.openBlock(),a.createElementBlock("div",{class:"vue-flow__transformationpane vue-flow__container",style:a.normalizeStyle({transform:r.value,opacity:i.value?0:void 0})},[a.renderSlot(l.$slots,"default")],4))}}),lc={name:"Viewport",compatConfig:{MODE:3}},ac=a.defineComponent({...lc,setup(e){const{minZoom:t,maxZoom:n,defaultViewport:o,translateExtent:i,zoomActivationKeyCode:r,selectionKeyCode:l,panActivationKeyCode:s,panOnScroll:u,panOnScrollMode:c,panOnScrollSpeed:d,panOnDrag:f,zoomOnDoubleClick:h,zoomOnPinch:p,zoomOnScroll:b,preventScrolling:x,noWheelClassName:N,noPanClassName:k,emits:M,connectionStartHandle:_,userSelectionActive:C,paneDragging:A,d3Zoom:P,d3Selection:$,d3ZoomHandler:B,viewport:K,viewportRef:F,paneClickDistance:O}=de();Ku(F);const E=a.shallowRef(!1),Z=a.shallowRef(!1);let w=null,T=!1,S=0,D={x:0,y:0,zoom:0};const V=ht(s),R=ht(l),H=ht(r),W=a.toRef(()=>(!R.value||R.value&&l.value===!0)&&(V.value||f.value)),Q=a.toRef(()=>V.value||u.value),te=a.toRef(()=>R.value||l.value===!0&&W.value!==!0),Y=a.toRef(()=>_.value!==null);a.onMounted(()=>{if(!F.value){vt("Viewport element is missing");return}const oe=F.value,se=oe.getBoundingClientRect(),ce=Ms().clickDistance(O.value).scaleExtent([t.value,n.value]).translateExtent(i.value),ee=ye(oe).call(ce),ie=ee.on("wheel.zoom"),m=Ke.translate(o.value.x??0,o.value.y??0).scale(Le(o.value.zoom??1,t.value,n.value)),g=[[0,0],[se.width,se.height]],v=ce.constrain()(m,g,i.value);ce.transform(ee,v),ce.wheelDelta(Jo),P.value=ce,$.value=ee,B.value=ie,K.value={x:v.x,y:v.y,zoom:v.k},ce.on("start",y=>{var I;if(!y.sourceEvent)return null;S=y.sourceEvent.button,E.value=!0;const G=re(y.transform);((I=y.sourceEvent)==null?void 0:I.type)==="mousedown"&&(A.value=!0),D=G,M.viewportChangeStart(G),M.moveStart({event:y,flowTransform:G})}),ce.on("end",y=>{if(!y.sourceEvent)return null;if(E.value=!1,A.value=!1,j(W.value,S??0)&&!T&&M.paneContextMenu(y.sourceEvent),T=!1,q(D,y.transform)){const I=re(y.transform);D=I,M.viewportChangeEnd(I),M.moveEnd({event:y,flowTransform:I})}}),ce.filter(y=>{var I;const G=H.value||b.value,X=p.value&&y.ctrlKey,U=y.button,J=y.type==="wheel";if(U===1&&y.type==="mousedown"&&(le(y,"vue-flow__node")||le(y,"vue-flow__edge")))return!0;if(!W.value&&!G&&!Q.value&&!h.value&&!p.value||C.value||Y.value&&!J||!h.value&&y.type==="dblclick"||le(y,N.value)&&J||le(y,k.value)&&(!J||Q.value&&J&&!H.value)||!p.value&&y.ctrlKey&&J||!G&&!Q.value&&!X&&J)return!1;if(!p&&y.type==="touchstart"&&((I=y.touches)==null?void 0:I.length)>1)return y.preventDefault(),!1;if(!W.value&&(y.type==="mousedown"||y.type==="touchstart")||l.value===!0&&Array.isArray(f.value)&&f.value.includes(0)&&U===0||Array.isArray(f.value)&&!f.value.includes(U)&&(y.type==="mousedown"||y.type==="touchstart"))return!1;const ne=Array.isArray(f.value)&&f.value.includes(U)||l.value===!0&&Array.isArray(f.value)&&!f.value.includes(0)||!U||U<=1;return(!y.ctrlKey||V.value||J)&&ne}),a.watch([C,W],()=>{C.value&&!E.value?ce.on("zoom",null):C.value||ce.on("zoom",y=>{K.value={x:y.transform.x,y:y.transform.y,zoom:y.transform.k};const I=re(y.transform);T=j(W.value,S??0),M.viewportChange(I),M.move({event:y,flowTransform:I})})},{immediate:!0}),a.watch([C,Q,c,H,p,x,N],()=>{Q.value&&!H.value&&!C.value?ee.on("wheel.zoom",y=>{if(le(y,N.value))return!1;const I=H.value||b.value,G=p.value&&y.ctrlKey;if(!(!x.value||Q.value||I||G))return!1;y.preventDefault(),y.stopImmediatePropagation();const U=ee.property("__zoom").k||1,J=Xt();if(!V.value&&y.ctrlKey&&p.value&&J){const wt=_e(y),jc=Jo(y),Jc=U*2**jc;ce.scaleTo(ee,Jc,wt,y);return}const ne=y.deltaMode===1?20:1;let ae=c.value===ft.Vertical?0:y.deltaX*ne,ue=c.value===ft.Horizontal?0:y.deltaY*ne;!J&&y.shiftKey&&c.value!==ft.Vertical&&!ae&&ue&&(ae=ue,ue=0),ce.translateBy(ee,-(ae/U)*d.value,-(ue/U)*d.value);const Ne=re(ee.property("__zoom"));w&&clearTimeout(w),Z.value?(M.move({event:y,flowTransform:Ne}),M.viewportChange(Ne),w=setTimeout(()=>{M.moveEnd({event:y,flowTransform:Ne}),M.viewportChangeEnd(Ne),Z.value=!1},150)):(Z.value=!0,M.moveStart({event:y,flowTransform:Ne}),M.viewportChangeStart(Ne))},{passive:!1}):typeof ie<"u"&&ee.on("wheel.zoom",function(y,I){const G=!x.value&&y.type==="wheel"&&!y.ctrlKey,X=H.value||b.value,U=p.value&&y.ctrlKey;if(!X&&!u.value&&!U&&y.type==="wheel"||G||le(y,N.value))return null;y.preventDefault(),ie.call(this,y,I)},{passive:!1})},{immediate:!0})});function j(oe,se){return se===2&&Array.isArray(oe)&&oe.includes(2)}function q(oe,se){return oe.x!==se.x&&!Number.isNaN(se.x)||oe.y!==se.y&&!Number.isNaN(se.y)||oe.zoom!==se.k&&!Number.isNaN(se.k)}function re(oe){return{x:oe.x,y:oe.y,zoom:oe.k}}function le(oe,se){return oe.target.closest(`.${se}`)}return(oe,se)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"viewportRef",ref:F,class:"vue-flow__viewport vue-flow__container"},[a.createVNode(oc,{"is-selecting":te.value,"selection-key-pressed":a.unref(R),class:a.normalizeClass({connecting:Y.value,dragging:a.unref(A),draggable:a.unref(f)===!0||Array.isArray(a.unref(f))&&a.unref(f).includes(0)})},{default:a.withCtx(()=>[a.createVNode(rc,null,{default:a.withCtx(()=>[a.renderSlot(oe.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),sc=["id"],uc=["id"],cc=["id"],dc={name:"A11yDescriptions",compatConfig:{MODE:3}},fc=a.defineComponent({...dc,setup(e){const{id:t,disableKeyboardA11y:n,ariaLiveMessage:o}=de();return(i,r)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("div",{id:`${a.unref(zo)}-${a.unref(t)}`,style:{display:"none"}}," Press enter or space to select a node. "+a.toDisplayString(a.unref(n)?"":"You can then use the arrow keys to move the node around.")+" You can then use the arrow keys to move the node around, press delete to remove it and press escape to cancel. ",9,sc),a.createElementVNode("div",{id:`${a.unref(Ro)}-${a.unref(t)}`,style:{display:"none"}}," Press enter or space to select an edge. You can then press delete to remove it or press escape to cancel. ",8,uc),a.unref(n)?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("div",{key:0,id:`${a.unref(Bs)}-${a.unref(t)}`,"aria-live":"assertive","aria-atomic":"true",style:{position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)","clip-path":"inset(100%)"}},a.toDisplayString(a.unref(o)),9,cc))],64))}});function hc(){const e=de();a.watch(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function gc(e,t,n){return n===z.Left?e-t:n===z.Right?e+t:e}function pc(e,t,n){return n===z.Top?e-t:n===z.Bottom?e+t:e}const Rn=function({radius:e=10,centerX:t=0,centerY:n=0,position:o=z.Top,type:i}){return a.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${i}`,cx:gc(t,e,o),cy:pc(n,e,o),r:e,stroke:"transparent",fill:"transparent"})};Rn.props=["radius","centerX","centerY","position","type"],Rn.compatConfig={MODE:3};const Bi=Rn,mc=a.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:t,addSelectedEdges:n,connectionMode:o,edgeUpdaterRadius:i,emits:r,nodesSelectionActive:l,noPanClassName:s,getEdgeTypes:u,removeSelectedEdges:c,findEdge:d,findNode:f,isValidConnection:h,multiSelectionActive:p,disableKeyboardA11y:b,elementsSelectable:x,edgesUpdatable:N,edgesFocusable:k,hooks:M}=de(),_=a.computed(()=>d(e.id)),{emit:C,on:A}=du(_.value,r),P=a.inject(Zt),$=a.getCurrentInstance(),B=a.ref(!1),K=a.ref(!1),F=a.ref(""),O=a.ref(null),E=a.ref("source"),Z=a.ref(null),w=a.toRef(()=>typeof _.value.selectable>"u"?x.value:_.value.selectable),T=a.toRef(()=>typeof _.value.updatable>"u"?N.value:_.value.updatable),S=a.toRef(()=>typeof _.value.focusable>"u"?k.value:_.value.focusable);a.provide(su,e.id),a.provide(uu,Z);const D=a.computed(()=>_.value.class instanceof Function?_.value.class(_.value):_.value.class),V=a.computed(()=>_.value.style instanceof Function?_.value.style(_.value):_.value.style),R=a.computed(()=>{const g=_.value.type||"default",v=P?.[`edge-${g}`];if(v)return v;let y=_.value.template??u.value[g];if(typeof y=="string"&&$){const I=Object.keys($.appContext.components);I&&I.includes(g)&&(y=a.resolveComponent(g,!1))}return y&&typeof y!="string"?y:(r.error(new ge(fe.EDGE_TYPE_MISSING,y)),!1)}),{handlePointerDown:H}=bi({nodeId:F,handleId:O,type:E,isValidConnection:h,edgeUpdaterType:E,onEdgeUpdate:te,onEdgeUpdateEnd:Y});return()=>{const g=f(_.value.source),v=f(_.value.target),y="pathOptions"in _.value?_.value.pathOptions:{};if(!g&&!v)return r.error(new ge(fe.EDGE_SOURCE_TARGET_MISSING,_.value.id,_.value.source,_.value.target)),null;if(!g)return r.error(new ge(fe.EDGE_SOURCE_MISSING,_.value.id,_.value.source)),null;if(!v)return r.error(new ge(fe.EDGE_TARGET_MISSING,_.value.id,_.value.target)),null;if(!_.value||_.value.hidden||g.hidden||v.hidden)return null;let I;o.value===Te.Strict?I=g.handleBounds.source:I=[...g.handleBounds.source||[],...g.handleBounds.target||[]];const G=si(I,_.value.sourceHandle);let X;o.value===Te.Strict?X=v.handleBounds.target:X=[...v.handleBounds.target||[],...v.handleBounds.source||[]];const U=si(X,_.value.targetHandle),J=G?.position||z.Bottom,ne=U?.position||z.Top,{x:ae,y:ue}=Je(g,G,J),{x:Ne,y:wt}=Je(v,U,ne);return _.value.sourceX=ae,_.value.sourceY=ue,_.value.targetX=Ne,_.value.targetY=wt,a.h("g",{ref:Z,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${R.value===!1?"default":_.value.type||"default"}`,s.value,D.value,{updating:B.value,selected:_.value.selected,animated:_.value.animated,inactive:!w.value&&!M.value.edgeClick.hasListeners()}],tabIndex:S.value?0:void 0,"aria-label":_.value.ariaLabel===null?void 0:_.value.ariaLabel??`Edge from ${_.value.source} to ${_.value.target}`,"aria-describedby":S.value?`${Ro}-${t}`:void 0,"aria-roledescription":"edge",role:S.value?"group":"img",..._.value.domAttributes,onClick:q,onContextmenu:re,onDblclick:le,onMouseenter:oe,onMousemove:se,onMouseleave:ce,onKeyDown:S.value?m:void 0},[K.value?null:a.h(R.value===!1?u.value.default:R.value,{id:e.id,sourceNode:g,targetNode:v,source:_.value.source,target:_.value.target,type:_.value.type,updatable:T.value,selected:_.value.selected,animated:_.value.animated,label:_.value.label,labelStyle:_.value.labelStyle,labelShowBg:_.value.labelShowBg,labelBgStyle:_.value.labelBgStyle,labelBgPadding:_.value.labelBgPadding,labelBgBorderRadius:_.value.labelBgBorderRadius,data:_.value.data,events:{..._.value.events,...A},style:V.value,markerStart:`url('#${yt(_.value.markerStart,t)}')`,markerEnd:`url('#${yt(_.value.markerEnd,t)}')`,sourcePosition:J,targetPosition:ne,sourceX:ae,sourceY:ue,targetX:Ne,targetY:wt,sourceHandleId:_.value.sourceHandle,targetHandleId:_.value.targetHandle,interactionWidth:_.value.interactionWidth,...y}),[T.value==="source"||T.value===!0?[a.h("g",{onMousedown:ee,onMouseenter:W,onMouseout:Q},a.h(Bi,{position:J,centerX:ae,centerY:ue,radius:i.value,type:"source","data-type":"source"}))]:null,T.value==="target"||T.value===!0?[a.h("g",{onMousedown:ie,onMouseenter:W,onMouseout:Q},a.h(Bi,{position:ne,centerX:Ne,centerY:wt,radius:i.value,type:"target","data-type":"target"}))]:null]])};function W(){B.value=!0}function Q(){B.value=!1}function te(g,v){C.update({event:g,edge:_.value,connection:v})}function Y(g){C.updateEnd({event:g,edge:_.value}),K.value=!1}function j(g,v){g.button===0&&(K.value=!0,F.value=v?_.value.target:_.value.source,O.value=(v?_.value.targetHandle:_.value.sourceHandle)??null,E.value=v?"target":"source",C.updateStart({event:g,edge:_.value}),H(g))}function q(g){var v;const y={event:g,edge:_.value};w.value&&(l.value=!1,_.value.selected&&p.value?(c([_.value]),(v=Z.value)==null||v.blur()):n([_.value])),C.click(y)}function re(g){C.contextMenu({event:g,edge:_.value})}function le(g){C.doubleClick({event:g,edge:_.value})}function oe(g){C.mouseEnter({event:g,edge:_.value})}function se(g){C.mouseMove({event:g,edge:_.value})}function ce(g){C.mouseLeave({event:g,edge:_.value})}function ee(g){j(g,!0)}function ie(g){j(g,!1)}function m(g){var v;!b.value&&Ho.includes(g.key)&&w.value&&(g.key==="Escape"?((v=Z.value)==null||v.blur(),c([d(e.id)])):n([d(e.id)]))}}}),yc=a.defineComponent({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:t,connectionMode:n,connectionStartHandle:o,connectionEndHandle:i,connectionPosition:r,connectionLineType:l,connectionLineStyle:s,connectionLineOptions:u,connectionStatus:c,viewport:d,findNode:f}=de(),h=(e=a.inject(Zt))==null?void 0:e["connection-line"],p=a.computed(()=>{var M;return f((M=o.value)==null?void 0:M.nodeId)}),b=a.computed(()=>{var M;return f((M=i.value)==null?void 0:M.nodeId)??null}),x=a.computed(()=>({x:(r.value.x-d.value.x)/d.value.zoom,y:(r.value.y-d.value.y)/d.value.zoom})),N=a.computed(()=>u.value.markerStart?`url(#${yt(u.value.markerStart,t)})`:""),k=a.computed(()=>u.value.markerEnd?`url(#${yt(u.value.markerEnd,t)})`:"");return()=>{var M,_,C;if(!p.value||!o.value)return null;const A=o.value.id,P=o.value.type,$=p.value.handleBounds;let B=$?.[P]??[];if(n.value===Te.Loose){const V=$?.[P==="source"?"target":"source"]??[];B=[...B,...V]}if(!B)return null;const K=(A?B.find(V=>V.id===A):B[0])??null,F=K?.position??z.Top,{x:O,y:E}=Je(p.value,K,F);let Z=null;b.value&&(n.value===Te.Strict?Z=((M=b.value.handleBounds[P==="source"?"target":"source"])==null?void 0:M.find(V=>{var R;return V.id===((R=i.value)==null?void 0:R.id)}))||null:Z=((_=[...b.value.handleBounds.source??[],...b.value.handleBounds.target??[]])==null?void 0:_.find(V=>{var R;return V.id===((R=i.value)==null?void 0:R.id)}))||null);const w=((C=i.value)==null?void 0:C.position)??(F?$n[F]:null);if(!F||!w)return null;const T=l.value??u.value.type??He.Bezier;let S="";const D={sourceX:O,sourceY:E,sourcePosition:F,targetX:x.value.x,targetY:x.value.y,targetPosition:w};return T===He.Bezier?[S]=On(D):T===He.Step?[S]=zn({...D,borderRadius:0}):T===He.SmoothStep?[S]=zn(D):T===He.SimpleBezier?[S]=Pi(D):S=`M${O},${E} ${x.value.x},${x.value.y}`,a.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},a.h("g",{class:"vue-flow__connection"},h?a.h(h,{sourceX:O,sourceY:E,sourcePosition:F,targetX:x.value.x,targetY:x.value.y,targetPosition:w,sourceNode:p.value,sourceHandle:K,targetNode:b.value,targetHandle:Z,markerEnd:k.value,markerStart:N.value,connectionStatus:c.value}):a.h("path",{d:S,class:[u.value.class,c.value,"vue-flow__connection-path"],style:{...s.value,...u.value.style},"marker-end":k.value,"marker-start":N.value})))}}}),vc=["id","markerWidth","markerHeight","markerUnits","orient"],wc={name:"MarkerType",compatConfig:{MODE:3}},_c=a.defineComponent({...wc,props:{id:{},type:{},color:{default:"none"},width:{default:12.5},height:{default:12.5},markerUnits:{default:"strokeWidth"},orient:{default:"auto-start-reverse"},strokeWidth:{default:1}},setup(e){return(t,n)=>(a.openBlock(),a.createElementBlock("marker",{id:t.id,class:"vue-flow__arrowhead",viewBox:"-10 -10 20 20",refX:"0",refY:"0",markerWidth:`${t.width}`,markerHeight:`${t.height}`,markerUnits:t.markerUnits,orient:t.orient},[t.type===a.unref(Nn).ArrowClosed?(a.openBlock(),a.createElementBlock("polyline",{key:0,style:a.normalizeStyle({stroke:t.color,fill:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",points:"-5,-4 0,0 -5,4 -5,-4"},null,4)):a.createCommentVNode("",!0),t.type===a.unref(Nn).Arrow?(a.openBlock(),a.createElementBlock("polyline",{key:1,style:a.normalizeStyle({stroke:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):a.createCommentVNode("",!0)],8,vc))}}),Ec={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},bc={name:"MarkerDefinitions",compatConfig:{MODE:3}},xc=a.defineComponent({...bc,setup(e){const{id:t,edges:n,connectionLineOptions:o,defaultMarkerColor:i}=de(),r=a.computed(()=>{const l=new Set,s=[],u=c=>{if(c){const d=yt(c,t);l.has(d)||(typeof c=="object"?s.push({...c,id:d,color:c.color||i.value}):s.push({id:d,color:i.value,type:c}),l.add(d))}};for(const c of[o.value.markerEnd,o.value.markerStart])u(c);for(const c of n.value)for(const d of[c.markerStart,c.markerEnd])u(d);return s.sort((c,d)=>c.id.localeCompare(d.id))});return(l,s)=>(a.openBlock(),a.createElementBlock("svg",Ec,[a.createElementVNode("defs",null,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(r.value,u=>(a.openBlock(),a.createBlock(_c,{id:u.id,key:u.id,type:u.type,color:u.color,width:u.width,height:u.height,markerUnits:u.markerUnits,"stroke-width":u.strokeWidth,orient:u.orient},null,8,["id","type","color","width","height","markerUnits","stroke-width","orient"]))),128))])]))}}),Sc={name:"Edges",compatConfig:{MODE:3}},Nc=a.defineComponent({...Sc,setup(e){const{findNode:t,getEdges:n,elevateEdgesOnSelect:o}=de();return(i,r)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createVNode(xc),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(n),l=>(a.openBlock(),a.createElementBlock("svg",{key:l.id,class:"vue-flow__edges vue-flow__container",style:a.normalizeStyle({zIndex:a.unref(qs)(l,a.unref(t),a.unref(o))})},[a.createVNode(a.unref(mc),{id:l.id},null,8,["id"])],4))),128)),a.createVNode(a.unref(yc))],64))}}),Cc=a.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:t,noPanClassName:n,selectNodesOnDrag:o,nodesSelectionActive:i,multiSelectionActive:r,emits:l,removeSelectedNodes:s,addSelectedNodes:u,updateNodeDimensions:c,onUpdateNodeInternals:d,getNodeTypes:f,nodeExtent:h,elevateNodesOnSelect:p,disableKeyboardA11y:b,ariaLiveMessage:x,snapToGrid:N,snapGrid:k,nodeDragThreshold:M,nodesDraggable:_,elementsSelectable:C,nodesConnectable:A,nodesFocusable:P,hooks:$}=de(),B=a.ref(null);a.provide(_i,B),a.provide(wi,e.id);const K=a.inject(Zt),F=a.getCurrentInstance(),O=Si(),{node:E,parentNode:Z}=xi(e.id),{emit:w,on:T}=pu(E,l),S=a.toRef(()=>typeof E.draggable>"u"?_.value:E.draggable),D=a.toRef(()=>typeof E.selectable>"u"?C.value:E.selectable),V=a.toRef(()=>typeof E.connectable>"u"?A.value:E.connectable),R=a.toRef(()=>typeof E.focusable>"u"?P.value:E.focusable),H=a.computed(()=>D.value||S.value||$.value.nodeClick.hasListeners()||$.value.nodeDoubleClick.hasListeners()||$.value.nodeMouseEnter.hasListeners()||$.value.nodeMouseMove.hasListeners()||$.value.nodeMouseLeave.hasListeners()),W=a.toRef(()=>!!E.dimensions.width&&!!E.dimensions.height),Q=a.computed(()=>{const v=E.type||"default",y=K?.[`node-${v}`];if(y)return y;let I=E.template||f.value[v];if(typeof I=="string"&&F){const G=Object.keys(F.appContext.components);G&&G.includes(v)&&(I=a.resolveComponent(v,!1))}return I&&typeof I!="string"?I:(l.error(new ge(fe.NODE_TYPE_MISSING,I)),!1)}),te=Ei({id:e.id,el:B,disabled:()=>!S.value,selectable:D,dragHandle:()=>E.dragHandle,onStart(v){w.dragStart(v)},onDrag(v){w.drag(v)},onStop(v){w.dragStop(v)},onClick(v){m(v)}}),Y=a.computed(()=>E.class instanceof Function?E.class(E):E.class),j=a.computed(()=>{const v=(E.style instanceof Function?E.style(E):E.style)||{},y=E.width instanceof Function?E.width(E):E.width,I=E.height instanceof Function?E.height(E):E.height;return!v.width&&y&&(v.width=typeof y=="string"?y:`${y}px`),!v.height&&I&&(v.height=typeof I=="string"?I:`${I}px`),v}),q=a.toRef(()=>Number(E.zIndex??j.value.zIndex??0));return d(v=>{(v.includes(e.id)||!v.length)&&le()}),a.onMounted(()=>{a.watch(()=>E.hidden,(v=!1,y,I)=>{!v&&B.value&&(e.resizeObserver.observe(B.value),I(()=>{B.value&&e.resizeObserver.unobserve(B.value)}))},{immediate:!0,flush:"post"})}),a.watch([()=>E.type,()=>E.sourcePosition,()=>E.targetPosition],()=>{a.nextTick(()=>{c([{id:e.id,nodeElement:B.value,forceUpdate:!0}])})}),a.watch([()=>E.position.x,()=>E.position.y,()=>{var v;return(v=Z.value)==null?void 0:v.computedPosition.x},()=>{var v;return(v=Z.value)==null?void 0:v.computedPosition.y},()=>{var v;return(v=Z.value)==null?void 0:v.computedPosition.z},q,()=>E.selected,()=>E.dimensions.height,()=>E.dimensions.width,()=>{var v;return(v=Z.value)==null?void 0:v.dimensions.height},()=>{var v;return(v=Z.value)==null?void 0:v.dimensions.width}],([v,y,I,G,X,U])=>{const J={x:v,y,z:U+(p.value&&E.selected?1e3:0)};typeof I<"u"&&typeof G<"u"?E.computedPosition=Gs({x:I,y:G,z:X},J):E.computedPosition=J},{flush:"post",immediate:!0}),a.watch([()=>E.extent,h],([v,y],[I,G])=>{(v!==I||y!==G)&&re()}),E.extent==="parent"||typeof E.extent=="object"&&"range"in E.extent&&E.extent.range==="parent"?nn(()=>W).toBe(!0).then(re):re(),()=>E.hidden?null:a.h("div",{ref:B,"data-id":E.id,class:["vue-flow__node",`vue-flow__node-${Q.value===!1?"default":E.type||"default"}`,{[n.value]:S.value,dragging:te?.value,draggable:S.value,selected:E.selected,selectable:D.value,parent:E.isParent},Y.value],style:{visibility:W.value?"visible":"hidden",zIndex:E.computedPosition.z??q.value,transform:`translate(${E.computedPosition.x}px,${E.computedPosition.y}px)`,pointerEvents:H.value?"all":"none",...j.value},tabIndex:R.value?0:void 0,role:R.value?"group":void 0,"aria-describedby":b.value?void 0:`${zo}-${t}`,"aria-label":E.ariaLabel,"aria-roledescription":"node",...E.domAttributes,onMouseenter:oe,onMousemove:se,onMouseleave:ce,onContextmenu:ee,onClick:m,onDblclick:ie,onKeydown:g},[a.h(Q.value===!1?f.value.default:Q.value,{id:E.id,type:E.type,data:E.data,events:{...E.events,...T},selected:E.selected,resizing:E.resizing,dragging:te.value,connectable:V.value,position:E.computedPosition,dimensions:E.dimensions,isValidTargetPos:E.isValidTargetPos,isValidSourcePos:E.isValidSourcePos,parent:E.parentNode,parentNodeId:E.parentNode,zIndex:E.computedPosition.z??q.value,targetPosition:E.targetPosition,sourcePosition:E.sourcePosition,label:E.label,dragHandle:E.dragHandle,onUpdateNodeInternals:le})]);function re(){const v=E.computedPosition,{computedPosition:y,position:I}=In(E,N.value?Ut(v,k.value):v,l.error,h.value,Z.value);(E.computedPosition.x!==y.x||E.computedPosition.y!==y.y)&&(E.computedPosition={...E.computedPosition,...y}),(E.position.x!==I.x||E.position.y!==I.y)&&(E.position=I)}function le(){B.value&&c([{id:e.id,nodeElement:B.value,forceUpdate:!0}])}function oe(v){te?.value||w.mouseEnter({event:v,node:E})}function se(v){te?.value||w.mouseMove({event:v,node:E})}function ce(v){te?.value||w.mouseLeave({event:v,node:E})}function ee(v){return w.contextMenu({event:v,node:E})}function ie(v){return w.doubleClick({event:v,node:E})}function m(v){D.value&&(!o.value||!S.value||M.value>0)&&Dn(E,r.value,u,s,i,!1,B.value),w.click({event:v,node:E})}function g(v){if(!(Cn(v)||b.value))if(Ho.includes(v.key)&&D.value){const y=v.key==="Escape";Dn(E,r.value,u,s,i,y,B.value)}else S.value&&E.selected&&qe[v.key]&&(v.preventDefault(),x.value=`Moved selected node ${v.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~E.position.x}, y: ${~~E.position.y}`,O({x:qe[v.key].x,y:qe[v.key].y},v.shiftKey))}}}),kc={height:"0",width:"0"},Mc={name:"EdgeLabelRenderer",compatConfig:{MODE:3}},Ic=a.defineComponent({...Mc,setup(e){const{viewportRef:t}=de(),n=a.toRef(()=>{var o;return(o=t.value)==null?void 0:o.getElementsByClassName("vue-flow__edge-labels")[0]});return(o,i)=>(a.openBlock(),a.createElementBlock("svg",null,[(a.openBlock(),a.createElementBlock("foreignObject",kc,[(a.openBlock(),a.createBlock(a.Teleport,{to:n.value,disabled:!n.value},[a.renderSlot(o.$slots,"default")],8,["to","disabled"]))]))]))}});function Pc(e={includeHiddenNodes:!1}){const{nodes:t}=de();return a.computed(()=>{if(t.value.length===0)return!1;for(const n of t.value)if((e.includeHiddenNodes||!n.hidden)&&(n?.handleBounds===void 0||n.dimensions.width===0||n.dimensions.height===0))return!1;return!0})}const Tc={class:"vue-flow__nodes vue-flow__container"},$c={name:"Nodes",compatConfig:{MODE:3}},Dc=a.defineComponent({...$c,setup(e){const{getNodes:t,updateNodeDimensions:n,emits:o}=de(),i=Pc(),r=a.ref();return a.watch(i,l=>{l&&a.nextTick(()=>{o.nodesInitialized(t.value)})},{immediate:!0}),a.onMounted(()=>{r.value=new ResizeObserver(l=>{const s=l.map(u=>({id:u.target.getAttribute("data-id"),nodeElement:u.target,forceUpdate:!0}));a.nextTick(()=>n(s))})}),a.onBeforeUnmount(()=>{var l;return(l=r.value)==null?void 0:l.disconnect()}),(l,s)=>(a.openBlock(),a.createElementBlock("div",Tc,[r.value?(a.openBlock(!0),a.createElementBlock(a.Fragment,{key:0},a.renderList(a.unref(t),(u,c,d,f)=>{const h=[u.id];if(f&&f.key===u.id&&a.isMemoSame(f,h))return f;const p=(a.openBlock(),a.createBlock(a.unref(Cc),{id:u.id,key:u.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return p.memo=h,p},s,0),128)):a.createCommentVNode("",!0)]))}});function Bc(){const{emits:e}=de();a.onMounted(()=>{if(hi()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new ge(fe.MISSING_STYLES))}})}const Vc=a.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),Ac={name:"VueFlow",compatConfig:{MODE:3}},Oc=a.defineComponent({...Ac,props:{id:{},modelValue:{},nodes:{},edges:{},edgeTypes:{},nodeTypes:{},connectionMode:{},connectionLineType:{},connectionLineStyle:{default:void 0},connectionLineOptions:{default:void 0},connectionRadius:{},isValidConnection:{type:[Function,null],default:void 0},deleteKeyCode:{default:void 0},selectionKeyCode:{type:[Boolean,null],default:void 0},multiSelectionKeyCode:{default:void 0},zoomActivationKeyCode:{default:void 0},panActivationKeyCode:{default:void 0},snapToGrid:{type:Boolean,default:void 0},snapGrid:{},onlyRenderVisibleElements:{type:Boolean,default:void 0},edgesUpdatable:{type:[Boolean,String],default:void 0},nodesDraggable:{type:Boolean,default:void 0},nodesConnectable:{type:Boolean,default:void 0},nodeDragThreshold:{},elementsSelectable:{type:Boolean,default:void 0},selectNodesOnDrag:{type:Boolean,default:void 0},panOnDrag:{type:[Boolean,Array],default:void 0},minZoom:{},maxZoom:{},defaultViewport:{},translateExtent:{},nodeExtent:{},defaultMarkerColor:{},zoomOnScroll:{type:Boolean,default:void 0},zoomOnPinch:{type:Boolean,default:void 0},panOnScroll:{type:Boolean,default:void 0},panOnScrollSpeed:{},panOnScrollMode:{},paneClickDistance:{},zoomOnDoubleClick:{type:Boolean,default:void 0},preventScrolling:{type:Boolean,default:void 0},selectionMode:{},edgeUpdaterRadius:{},fitViewOnInit:{type:Boolean,default:void 0},connectOnClick:{type:Boolean,default:void 0},applyDefault:{type:Boolean,default:void 0},autoConnect:{type:[Boolean,Function],default:void 0},noDragClassName:{},noWheelClassName:{},noPanClassName:{},defaultEdgeOptions:{},elevateEdgesOnSelect:{type:Boolean,default:void 0},elevateNodesOnSelect:{type:Boolean,default:void 0},disableKeyboardA11y:{type:Boolean,default:void 0},edgesFocusable:{type:Boolean,default:void 0},nodesFocusable:{type:Boolean,default:void 0},autoPanOnConnect:{type:Boolean,default:void 0},autoPanOnNodeDrag:{type:Boolean,default:void 0},autoPanSpeed:{}},emits:["nodesChange","edgesChange","nodesInitialized","paneReady","init","updateNodeInternals","error","connect","connectStart","connectEnd","clickConnectStart","clickConnectEnd","moveStart","move","moveEnd","selectionDragStart","selectionDrag","selectionDragStop","selectionContextMenu","selectionStart","selectionEnd","viewportChangeStart","viewportChange","viewportChangeEnd","paneScroll","paneClick","paneContextMenu","paneMouseEnter","paneMouseMove","paneMouseLeave","edgeUpdate","edgeContextMenu","edgeMouseEnter","edgeMouseMove","edgeMouseLeave","edgeDoubleClick","edgeClick","edgeUpdateStart","edgeUpdateEnd","nodeContextMenu","nodeMouseEnter","nodeMouseMove","nodeMouseLeave","nodeDoubleClick","nodeClick","nodeDragStart","nodeDrag","nodeDragStop","miniMapNodeClick","miniMapNodeDoubleClick","miniMapNodeMouseEnter","miniMapNodeMouseMove","miniMapNodeMouseLeave","update:modelValue","update:nodes","update:edges"],setup(e,{expose:t,emit:n}){const o=e,i=a.useSlots(),r=on(o,"modelValue",n),l=on(o,"nodes",n),s=on(o,"edges",n),u=de(o),c=wu({modelValue:r,nodes:l,edges:s},o,u);return Eu(n,u.hooks),hc(),Bc(),a.provide(Zt,i),a.onUnmounted(c),t(u),(d,f)=>(a.openBlock(),a.createElementBlock("div",{ref:a.unref(u).vueFlowRef,class:"vue-flow"},[a.createVNode(ac,null,{default:a.withCtx(()=>[a.createVNode(Nc),Vc,a.createVNode(Dc),a.renderSlot(d.$slots,"zoom-pane")]),_:3}),a.renderSlot(d.$slots,"default"),a.createVNode(fc)],512))}}),zc=["id","d","marker-end"],Rc={class:"vue-flow__edge-label"},Hc={key:0,class:"label-input-wrapper"},Lc={inheritAttrs:!1},Fc=a.defineComponent({...Lc,__name:"EditableEdge",props:{id:{},sourceNode:{},targetNode:{},source:{},target:{},type:{},label:{type:[String,Object,Function]},style:{},selected:{type:Boolean},sourcePosition:{},targetPosition:{},sourceHandleId:{},targetHandleId:{},animated:{type:Boolean},updatable:{type:Boolean},markerStart:{},markerEnd:{},curvature:{},interactionWidth:{},data:{},events:{},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{},sourceX:{},sourceY:{},targetX:{},targetY:{}},emits:["change"],setup(e,{emit:t}){const n=e,o=t,i=a.useTemplateRef("labelInput"),r=a.ref(""),l=a.ref(!1);let s=0;const u=async()=>{let h=Date.now();h-s<500&&!l.value&&await c(),s=h},c=async()=>{r.value=n.label,l.value=!0,await a.nextTick(),i.value.focus()},d=()=>{l.value=!1,o("change",r.value)},f=a.computed(()=>On(n));return(h,p)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("path",{id:e.id,style:a.normalizeStyle(e.style),class:"vue-flow__edge-path",d:f.value[0],"marker-end":e.markerEnd},null,12,zc),a.createVNode(a.unref(Ic),null,{default:a.withCtx(()=>[a.createElementVNode("div",{style:a.normalizeStyle({pointerEvents:"all",position:"absolute",transform:`translate(-50%, -50%) translate(${f.value[1]}px,${f.value[2]}px)`}),class:"nodrag nopan editable-edge-label",onClick:p[2]||(p[2]=b=>u())},[a.createElementVNode("div",Rc,a.toDisplayString(e.label),1),l.value?(a.openBlock(),a.createElementBlock("div",Hc,[a.withDirectives(a.createElementVNode("input",{ref:"labelInput","onUpdate:modelValue":p[0]||(p[0]=b=>r.value=b),class:"label-input",onBlur:p[1]||(p[1]=b=>l.value=!1),onKeypress:a.withKeys(d,["enter"])},null,544),[[a.vModelText,r.value]])])):a.createCommentVNode("",!0)],4)]),_:1})],64))}}),Yc={key:0,class:"label-input-wrapper"},Gc=a.defineComponent({__name:"EditableNode",props:{id:{},type:{},selected:{type:Boolean},connectable:{type:[Boolean,Number,String,Function]},position:{},dimensions:{},label:{},isValidTargetPos:{type:Function},isValidSourcePos:{type:Function},parent:{},parentNodeId:{},dragging:{type:Boolean},resizing:{type:Boolean},zIndex:{},targetPosition:{},sourcePosition:{},dragHandle:{},data:{},events:{}},emits:["change"],setup(e,{emit:t}){const n=e,o=t,i=a.useTemplateRef("labelInput"),r=a.ref(""),l=a.ref(!1);let s=0;const u=async()=>{let f=Date.now();f-s<500&&!l.value&&await c(),s=f},c=async()=>{r.value=n.label,l.value=!0,await a.nextTick(),i.value.focus()},d=()=>{l.value=!1,o("change",r.value)};return(f,h)=>(a.openBlock(),a.createElementBlock("div",{onClick:h[2]||(h[2]=p=>u())},[a.createElementVNode("div",null,a.toDisplayString(e.label),1),l.value?(a.openBlock(),a.createElementBlock("div",Yc,[a.withDirectives(a.createElementVNode("input",{ref:"labelInput","onUpdate:modelValue":h[0]||(h[0]=p=>r.value=p),class:"label-input",onBlur:h[1]||(h[1]=p=>l.value=!1),onKeypress:a.withKeys(d,["enter"])},null,544),[[a.vModelText,r.value]])])):a.createCommentVNode("",!0),e.data.hasInput?(a.openBlock(),a.createBlock(a.unref(Qe),{key:1,id:"a",type:"target",position:e.targetPosition},null,8,["position"])):a.createCommentVNode("",!0),e.data.hasOutput?(a.openBlock(),a.createBlock(a.unref(Qe),{key:2,id:"b",type:"source",position:e.sourcePosition},null,8,["position"])):a.createCommentVNode("",!0)]))}}),Xc={class:"chart-controls"},Uc={class:"chart-controls-left"},Zc={class:"chart-controls-right"},Wc={key:0},Kc={key:1},Hn=a.defineComponent({__name:"NodeEditor",props:{modelValue:{},nodeContainerClass:{default:""}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t,o=a.ref(!1),i=a.ref([]),r=a.ref(),l=a.ref(""),s=a.computed(()=>(i.value.forEach((P,$)=>{if(P.id===l.value)return $}),-1)),u=a.computed({get:()=>{const P=e.modelValue;for(const $ of P)$.data={},$.type==="input"?($.data.hasInput=!1,$.data.hasOutput=!0):$.type==="output"?($.data.hasInput=!0,$.data.hasOutput=!1):($.data.hasInput=!0,$.data.hasOutput=!0),$.class="vue-flow__node-default",$.type="editable";for(const $ of P)$.events={click:()=>{l.value=$.id}};return P},set:P=>{n("update:modelValue",JSON.parse(JSON.stringify(P)))}}),{addEdges:c,removeEdges:d}=de();a.onMounted(()=>{document.removeEventListener("keypress",N),document.addEventListener("keypress",N)}),a.onBeforeUnmount(()=>{document.removeEventListener("keypress",N)});const f=P=>{r.value=P};i.value=u.value;const h=P=>({[z.Top]:z.Right,[z.Right]:z.Bottom,[z.Bottom]:z.Left,[z.Left]:z.Top})[P],p=()=>{if(s.value>-1){const P=i.value[s.value];if(!P.sourcePosition)return;P.sourcePosition=h(P.sourcePosition)}},b=()=>{if(s.value>-1){const P=i.value[s.value];if(!P.targetPosition)return;P.targetPosition=h(P.targetPosition)}},x=P=>{window.scrollBy(0,P.deltaY)},N=P=>{o.value&&P.ctrlKey==!0&&((P.key=="+"||P.key=="=")&&r.value?.zoomIn(),P.key=="-"&&r.value?.zoomOut())},k=async()=>{await r.value?.fitView()},M=()=>{let P=!1,$={x:Math.random()*200,y:Math.random()*200};if(s.value>-1){const F=i.value[s.value];F.data?.hasOutput&&($={x:F.position.x+200,y:F.position.y+50},P=!0)}const B=i.value.length,K=`node-${B}`;if(i.value.push({id:K,label:"Node "+B,sourcePosition:z.Right,targetPosition:z.Left,class:"vue-flow__node-default",type:"editable",data:{hasInput:!0,hasOutput:!0},events:{click:()=>{l.value=K}},position:$}),P){let F=`edge-${B+1}`;i.value.push({id:F,source:l.value,target:K,type:"editable",label:`EDGE ${B+1}`,animated:!0,events:{click:()=>{l.value=F}}})}},_=(P,$)=>{for(let B=0;B<i.value.length;B++)if(i.value[B].id==$){i.value[B].label=P;break}},C=P=>{const B={id:`edge-${i.value.length}`,source:P.source,target:P.target,type:"editable",label:"New Edge",interactionWidth:400,animated:!0,events:{click:()=>{l.value=B.id}}};c([B])},A=P=>{d(P.edge.id)};return(P,$)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["node-editor-wrapper",e.nodeContainerClass]),onMouseover:$[1]||($[1]=B=>o.value=!0),onMouseleave:$[2]||($[2]=B=>o.value=!1)},[a.createElementVNode("div",Xc,[a.createElementVNode("div",Uc,[a.createElementVNode("div",null,[$[3]||($[3]=a.createElementVNode("b",null,"Selected Node:",-1)),a.createTextVNode(" "+a.toDisplayString(l.value?l.value:"none"),1)])]),a.createElementVNode("div",Zc,[a.createElementVNode("div",null,[a.createElementVNode("button",{class:"button-default",onClick:M},"Add Node")]),a.createElementVNode("div",null,[a.createElementVNode("button",{class:"button-default",onClick:k},"Center")]),s.value>-1?(a.openBlock(),a.createElementBlock("div",Wc,[a.createElementVNode("button",{class:"button-default",onClick:b},"Shift Input Position")])):a.createCommentVNode("",!0),s.value>-1?(a.openBlock(),a.createElementBlock("div",Kc,[a.createElementVNode("button",{class:"button-default",onClick:p},"Shift Output Position")])):a.createCommentVNode("",!0)])]),i.value&&i.value.length?(a.openBlock(),a.createBlock(a.unref(Oc),{key:0,modelValue:i.value,"onUpdate:modelValue":$[0]||($[0]=B=>i.value=B),class:"nowheel","prevent-scrolling":!0,"zoom-on-scroll":!1,"fit-view-on-init":!0,onConnect:C,onPaneReady:f,onEdgeContextMenu:A,onWheel:a.withModifiers(x,["prevent"])},{"node-editable":a.withCtx(B=>[a.createVNode(Gc,a.mergeProps(B,{onChange:K=>_(K,B.id)}),null,16,["onChange"])]),"edge-editable":a.withCtx(B=>[a.createVNode(Fc,a.mergeProps(B,{onChange:K=>_(K,B.id)}),null,16,["onChange"])]),_:1},8,["modelValue"])):a.createCommentVNode("",!0)],34))}}),Vi=a.defineComponent({__name:"StateEditor",props:a.mergeModels({layout:{},nodeContainerClass:{default:""}},{modelValue:{},modelModifiers:{}}),emits:a.mergeModels(["update:modelValue"],["update:modelValue"]),setup(e,{emit:t}){const n=t,o=a.useModel(e,"modelValue"),i=a.computed({get:()=>{const l={},s=[],u={};if(!o.value)return s;let c=0;for(const[d,f]of Object.entries(o.value)){const h={id:d,label:d,position:e.layout[d]?.position||{x:200*c,y:100},targetPosition:e.layout[d]?.targetPosition||z.Left,sourcePosition:e.layout[d]?.sourcePosition||z.Right};f?.type==="final"&&(h.type="output",h.class="default-output-node"),u[d]=h}for(const[d,f]of Object.entries(o.value)){if(f?.on)for(const[h,p]of Object.entries(f.on)){const b=p.target||p;s.push({id:`${d}-${b}`,source:d,target:b,label:h,animated:!0,type:"smoothstep"}),l[b]=!0}c++}for(const[d,f]of Object.entries(u))l[d]||(f.type="input",f.class="default-input-node"),s.push(f);return s},set:l=>{r(l)}}),r=l=>{const s={},u={},c={};for(const d of l){const f=d.label;d.type==="input"?c[f]={on:{}}:d.type==="output"?c[f]={type:"final"}:d.source&&d.target?(s[d.source]=s[d.source]||{},s[d.source][f]={target:d.target}):c[f]={on:{}},u[d.id]=f}for(const[d,f]of Object.entries(s)){const h=u[d];for(const[p,b]of Object.entries(f))c[h]||(c[h]={on:{}}),c[h].on[p]=b}n("update:modelValue",c)};return(l,s)=>(a.openBlock(),a.createElementBlock("div",null,[a.createVNode(Hn,{modelValue:i.value,"onUpdate:modelValue":s[0]||(s[0]=u=>i.value=u),"node-container-class":e.nodeContainerClass},null,8,["modelValue","node-container-class"])]))}});function qc(e){e.component("NodeEditor",Hn),e.component("StateEditor",Vi)}Ce.NodeEditor=Hn,Ce.StateEditor=Vi,Ce.install=qc,Object.defineProperty(Ce,Symbol.toStringTag,{value:"Module"})}));
26
+ Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead"};class ge extends Error{constructor(t,...n){var o;super((o=ui[t])==null?void 0:o.call(ui,...n)),this.name="VueFlowError",this.code=t,this.args=n}}function Pn(e){return"clientX"in e}function js(e){return"sourceEvent"in e}function Se(e,t){const n=Pn(e);let o,i;return n?(o=e.clientX,i=e.clientY):"touches"in e&&e.touches.length>0?(o=e.touches[0].clientX,i=e.touches[0].clientY):"changedTouches"in e&&e.changedTouches.length>0?(o=e.changedTouches[0].clientX,i=e.changedTouches[0].clientY):(o=0,i=0),{x:o-(t?.left??0),y:i-(t?.top??0)}}const Xt=()=>{var e;return typeof navigator<"u"&&((e=navigator?.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Js(e){var t,n;return{width:((t=e.dimensions)==null?void 0:t.width)??e.width??0,height:((n=e.dimensions)==null?void 0:n.height)??e.height??0}}function Ut(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}const Qs=()=>!0;function Tn(e){e?.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function eu(e,t,n){const o=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const r of t.values())Ft(i,Lt(r))>0&&o.push(r);return o}const tu=250;function nu(e,t,n,o){var i,r;let l=[],s=Number.POSITIVE_INFINITY;const u=eu(e,n,t+tu);for(const c of u){const d=[...((i=c.handleBounds)==null?void 0:i.source)??[],...((r=c.handleBounds)==null?void 0:r.target)??[]];for(const f of d){if(o.nodeId===f.nodeId&&o.type===f.type&&o.id===f.id)continue;const{x:h,y:p}=Je(c,f,f.position,!0),b=Math.sqrt((h-e.x)**2+(p-e.y)**2);b>t||(b<s?(l=[{...f,x:h,y:p}],s=b):b===s&&l.push({...f,x:h,y:p}))}}if(!l.length)return null;if(l.length>1){const c=o.type==="source"?"target":"source";return l.find(d=>d.type===c)??l[0]}return l[0]}function ci(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:i,fromType:r,doc:l,lib:s,flowId:u,isValidConnection:c=Qs},d,f,h,p){const b=r==="target",x=t?l.querySelector(`.${s}-flow__handle[data-id="${u}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:N,y:k}=Se(e),M=l.elementFromPoint(N,k),_=M?.classList.contains(`${s}-flow__handle`)?M:x,C={handleDomNode:_,isValid:!1,connection:null,toHandle:null};if(_){const A=di(void 0,_),P=_.getAttribute("data-nodeid"),$=_.getAttribute("data-handleid"),D=_.classList.contains("connectable"),K=_.classList.contains("connectableend");if(!P||!A)return C;const F={source:b?P:o,sourceHandle:b?$:i,target:b?o:P,targetHandle:b?i:$};C.connection=F;const E=D&&K&&(n===Te.Strict?b&&A==="source"||!b&&A==="target":P!==o||$!==i);C.isValid=E&&c(F,{nodes:f,edges:d,sourceNode:h(F.source),targetNode:h(F.target)}),C.toHandle=fi(P,A,$,p,n,!0)}return C}function di(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function ou(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function iu(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function fi(e,t,n,o,i,r=!1){var l,s,u;const c=o.get(e);if(!c)return null;const d=i===Te.Strict?(l=c.handleBounds)==null?void 0:l[t]:[...((s=c.handleBounds)==null?void 0:s.source)??[],...((u=c.handleBounds)==null?void 0:u.target)??[]],f=(n?d?.find(h=>h.id===n):d?.[0])??null;return f&&r?{...f,...Je(c,f,f.position,!0)}:f}const $n={[R.Left]:R.Right,[R.Right]:R.Left,[R.Top]:R.Bottom,[R.Bottom]:R.Top},ru=["production","prod"];function vt(e,...t){hi()&&console.warn(`[Vue Flow]: ${e}`,...t)}function hi(){return!ru.includes(process.env.NODE_ENV||"")}function gi(e,t,n,o,i){const r=t.querySelectorAll(`.vue-flow__handle.${e}`);return r?.length?Array.from(r).map(l=>{const s=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),type:e,nodeId:i,position:l.getAttribute("data-handlepos"),x:(s.left-n.left)/o,y:(s.top-n.top)/o,...Yt(l)}}):null}function Dn(e,t,n,o,i,r=!1,l){i.value=!1,e.selected?(r||e.selected&&t)&&(o([e]),a.nextTick(()=>{l.blur()})):n([e])}function he(e){return typeof a.unref(e)<"u"}function lu(e,t,n,o){if(!e||!e.source||!e.target)return n(new ge(fe.EDGE_INVALID,e?.id??"[ID UNKNOWN]")),!1;let i;return $e(e)?i=e:i={...e,id:Xo(e)},i=Yo(i,void 0,o),Rs(i,t)?!1:i}function au(e,t,n,o,i){if(!t.source||!t.target)return i(new ge(fe.EDGE_INVALID,e.id)),!1;if(!n)return i(new ge(fe.EDGE_NOT_FOUND,e.id)),!1;const{id:r,...l}=e;return{...l,id:o?Xo(t):r,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function pi(e,t,n){const o={},i=[];for(let r=0;r<e.length;++r){const l=e[r];if(!Fe(l)){n(new ge(fe.NODE_INVALID,l?.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const s=As(l,t(l.id),l.parentNode);l.parentNode&&(o[l.parentNode]=!0),i[r]=s}for(const r of i){const l=t(r.parentNode)||i.find(s=>s.id===r.parentNode);r.parentNode&&!l&&n(new ge(fe.NODE_MISSING_PARENT,r.id,r.parentNode)),(r.parentNode||o[r.id])&&(o[r.id]&&(r.isParent=!0),l&&(l.isParent=!0))}return i}function mi(e,t,n,o,i,r){let l=i;const s=o.get(l)||new Map;o.set(l,s.set(n,t)),l=`${i}-${e}`;const u=o.get(l)||new Map;if(o.set(l,u.set(n,t)),r){l=`${i}-${e}-${r}`;const c=o.get(l)||new Map;o.set(l,c.set(n,t))}}function Bn(e,t,n){e.clear();for(const o of n){const{source:i,target:r,sourceHandle:l=null,targetHandle:s=null}=o,u={edgeId:o.id,source:i,target:r,sourceHandle:l,targetHandle:s},c=`${i}-${l}--${r}-${s}`,d=`${r}-${s}--${i}-${l}`;mi("source",u,d,e,i,l),mi("target",u,c,e,r,s)}}function yi(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Vn(e,t,n,o,i,r,l,s){const u=[];for(const c of e){const d=$e(c)?c:lu(c,s,i,r);if(!d)continue;const f=n(d.source),h=n(d.target);if(!f||!h){i(new ge(fe.EDGE_SOURCE_TARGET_MISSING,d.id,d.source,d.target));continue}if(!f){i(new ge(fe.EDGE_SOURCE_MISSING,d.id,d.source));continue}if(!h){i(new ge(fe.EDGE_TARGET_MISSING,d.id,d.target));continue}if(t&&!t(d,{edges:s,nodes:l,sourceNode:f,targetNode:h})){i(new ge(fe.EDGE_INVALID,d.id));continue}const p=o(d.id);u.push({...Yo(d,p,r),sourceNode:f,targetNode:h})}return u}const vi=Symbol("vueFlow"),wi=Symbol("nodeId"),_i=Symbol("nodeRef"),su=Symbol("edgeId"),uu=Symbol("edgeRef"),Zt=Symbol("slots");function Ei(e){const{vueFlowRef:t,snapToGrid:n,snapGrid:o,noDragClassName:i,nodeLookup:r,nodeExtent:l,nodeDragThreshold:s,viewport:u,autoPanOnNodeDrag:c,autoPanSpeed:d,nodesDraggable:f,panBy:h,findNode:p,multiSelectionActive:b,nodesSelectionActive:x,selectNodesOnDrag:N,removeSelectedElements:k,addSelectedNodes:M,updateNodePositions:_,emits:C}=de(),{onStart:A,onDrag:P,onStop:$,onClick:D,el:K,disabled:F,id:O,selectable:E,dragHandle:J}=e,w=a.shallowRef(!1);let T=[],S,B=null,V={x:void 0,y:void 0},z={x:0,y:0},H=null,U=!1,Q=!1,te=0,ie=!1;const G=fu(),Z=({x:ee,y:re})=>{V={x:ee,y:re};let y=!1;if(T=T.map(g=>{const v={x:ee-g.distance.x,y:re-g.distance.y},{computedPosition:m}=In(g,n.value?Ut(v,o.value):v,C.error,l.value,g.parentNode?p(g.parentNode):void 0);return y=y||g.position.x!==m.x||g.position.y!==m.y,g.position=m,g}),Q=Q||y,!!y&&(_(T,!0,!0),w.value=!0,H)){const[g,v]=Mn({id:O,dragItems:T,findNode:p});P({event:H,node:g,nodes:v})}},j=()=>{if(!B)return;const[ee,re]=ei(z,B,d.value);if(ee!==0||re!==0){const y={x:(V.x??0)-ee/u.value.zoom,y:(V.y??0)-re/u.value.zoom};h({x:ee,y:re})&&Z(y)}te=requestAnimationFrame(j)},ae=(ee,re)=>{U=!0;const y=p(O);!N.value&&!b.value&&y&&(y.selected||k()),y&&a.toValue(E)&&N.value&&Dn(y,b.value,M,k,x,!1,re);const g=G(ee.sourceEvent);if(V=g,T=Xs(r.value,f.value,g,O),T.length){const[v,m]=Mn({id:O,dragItems:T,findNode:p});A({event:ee.sourceEvent,node:v,nodes:m})}},oe=(ee,re)=>{var y;ee.sourceEvent.type==="touchmove"&&ee.sourceEvent.touches.length>1||(Q=!1,s.value===0&&ae(ee,re),V=G(ee.sourceEvent),B=((y=t.value)==null?void 0:y.getBoundingClientRect())||null,z=Se(ee.sourceEvent,B))},le=(ee,re)=>{const y=G(ee.sourceEvent);if(!ie&&U&&c.value&&(ie=!0,j()),!U){const g=y.xSnapped-(V.x??0),v=y.ySnapped-(V.y??0);Math.sqrt(g*g+v*v)>s.value&&ae(ee,re)}(V.x!==y.xSnapped||V.y!==y.ySnapped)&&T.length&&U&&(H=ee.sourceEvent,z=Se(ee.sourceEvent,B),Z(y))},ce=ee=>{let re=!1;if(!U&&!w.value&&!b.value){const y=ee.sourceEvent,g=G(y),v=g.xSnapped-(V.x??0),m=g.ySnapped-(V.y??0),I=Math.sqrt(v*v+m*m);I!==0&&I<=s.value&&(D?.(y),re=!0)}if(T.length&&!re){Q&&(_(T,!1,!1),Q=!1);const[y,g]=Mn({id:O,dragItems:T,findNode:p});$({event:ee.sourceEvent,node:y,nodes:g})}T=[],w.value=!1,ie=!1,U=!1,V={x:void 0,y:void 0},cancelAnimationFrame(te)};return a.watch([()=>a.toValue(F),K],([ee,re],y,g)=>{if(re){const v=ye(re);ee||(S=Vl().on("start",m=>oe(m,re)).on("drag",m=>le(m,re)).on("end",m=>ce(m)).filter(m=>{const I=m.target,X=a.toValue(J);return!m.button&&(!i.value||!li(I,`.${i.value}`,re)&&(!X||li(I,X,re)))}),v.call(S)),g(()=>{v.on(".drag",null),S&&(S.on("start",null),S.on("drag",null),S.on("end",null))})}}),w}function cu(){return{doubleClick:L(),click:L(),mouseEnter:L(),mouseMove:L(),mouseLeave:L(),contextMenu:L(),updateStart:L(),update:L(),updateEnd:L()}}function du(e,t){const n=cu();return n.doubleClick.on(o=>{var i,r;t.edgeDoubleClick(o),(r=(i=e.events)==null?void 0:i.doubleClick)==null||r.call(i,o)}),n.click.on(o=>{var i,r;t.edgeClick(o),(r=(i=e.events)==null?void 0:i.click)==null||r.call(i,o)}),n.mouseEnter.on(o=>{var i,r;t.edgeMouseEnter(o),(r=(i=e.events)==null?void 0:i.mouseEnter)==null||r.call(i,o)}),n.mouseMove.on(o=>{var i,r;t.edgeMouseMove(o),(r=(i=e.events)==null?void 0:i.mouseMove)==null||r.call(i,o)}),n.mouseLeave.on(o=>{var i,r;t.edgeMouseLeave(o),(r=(i=e.events)==null?void 0:i.mouseLeave)==null||r.call(i,o)}),n.contextMenu.on(o=>{var i,r;t.edgeContextMenu(o),(r=(i=e.events)==null?void 0:i.contextMenu)==null||r.call(i,o)}),n.updateStart.on(o=>{var i,r;t.edgeUpdateStart(o),(r=(i=e.events)==null?void 0:i.updateStart)==null||r.call(i,o)}),n.update.on(o=>{var i,r;t.edgeUpdate(o),(r=(i=e.events)==null?void 0:i.update)==null||r.call(i,o)}),n.updateEnd.on(o=>{var i,r;t.edgeUpdateEnd(o),(r=(i=e.events)==null?void 0:i.updateEnd)==null||r.call(i,o)}),Object.entries(n).reduce((o,[i,r])=>(o.emit[i]=r.trigger,o.on[i]=r.on,o),{emit:{},on:{}})}function fu(){const{viewport:e,snapGrid:t,snapToGrid:n,vueFlowRef:o}=de();return i=>{var r;const l=((r=o.value)==null?void 0:r.getBoundingClientRect())??{left:0,top:0},s=js(i)?i.sourceEvent:i,{x:u,y:c}=Se(s,l),d=mt({x:u,y:c},e.value),{x:f,y:h}=n.value?Ut(d,t.value):d;return{xSnapped:f,ySnapped:h,...d}}}function Wt(){return!0}function bi({handleId:e,nodeId:t,type:n,isValidConnection:o,edgeUpdaterType:i,onEdgeUpdate:r,onEdgeUpdateEnd:l}){const{id:s,vueFlowRef:u,connectionMode:c,connectionRadius:d,connectOnClick:f,connectionClickStartHandle:h,nodesConnectable:p,autoPanOnConnect:b,autoPanSpeed:x,findNode:N,panBy:k,startConnection:M,updateConnection:_,endConnection:C,emits:A,viewport:P,edges:$,nodes:D,isValidConnection:K,nodeLookup:F}=de();let O=null,E=!1,J=null;function w(S){var B;const V=a.toValue(n)==="target",z=Pn(S),H=Fo(S.target),U=S.currentTarget;if(U&&(z&&S.button===0||!z)){let Q=function(q){y=Se(q,ce),Z=nu(mt(y,P.value,!1,[1,1]),d.value,F.value,m),g||(v(),g=!0);const ne=ci(q,{handle:Z,connectionMode:c.value,fromNodeId:a.toValue(t),fromHandleId:a.toValue(e),fromType:V?"target":"source",isValidConnection:G,doc:H,lib:"vue",flowId:s,nodeLookup:F.value},$.value,D.value,N,F.value);J=ne.handleDomNode,O=ne.connection,E=iu(!!Z,ne.isValid);const se={...Y,isValid:E,to:ne.toHandle&&E?pt({x:ne.toHandle.x,y:ne.toHandle.y},P.value):y,toHandle:ne.toHandle,toPosition:E&&ne.toHandle?ne.toHandle.position:$n[m.position],toNode:ne.toHandle?F.value.get(ne.toHandle.nodeId):null};if(E&&Z&&Y?.toHandle&&se.toHandle&&Y.toHandle.type===se.toHandle.type&&Y.toHandle.nodeId===se.toHandle.nodeId&&Y.toHandle.id===se.toHandle.id&&Y.to.x===se.to.x&&Y.to.y===se.to.y)return;const ue=Z??ne.toHandle;if(_(ue&&E?pt({x:ue.x,y:ue.y},P.value):y,ue,ou(!!ue,E)),Y=se,!Z&&!E&&!J)return Tn(re);O&&O.source!==O.target&&J&&(Tn(re),re=J,J.classList.add("connecting","vue-flow__handle-connecting"),J.classList.toggle("valid",!!E),J.classList.toggle("vue-flow__handle-valid",!!E))},te=function(q){"touches"in q&&q.touches.length>0||((Z||J)&&O&&E&&(r?r(q,O):A.connect(O)),A.connectEnd(q),i&&l?.(q),Tn(re),cancelAnimationFrame(j),C(q),g=!1,E=!1,O=null,J=null,H.removeEventListener("mousemove",Q),H.removeEventListener("mouseup",te),H.removeEventListener("touchmove",Q),H.removeEventListener("touchend",te))};const ie=N(a.toValue(t));let G=a.toValue(o)||K.value||Wt;!G&&ie&&(G=(V?ie.isValidSourcePos:ie.isValidTargetPos)||Wt);let Z,j=0;const{x:ae,y:oe}=Se(S),le=di(a.toValue(i),U),ce=(B=u.value)==null?void 0:B.getBoundingClientRect();if(!ce||!le)return;const ee=fi(a.toValue(t),le,a.toValue(e),F.value,c.value);if(!ee)return;let re,y=Se(S,ce),g=!1;const v=()=>{if(!b.value)return;const[q,ne]=ei(y,ce,x.value);k({x:q,y:ne}),j=requestAnimationFrame(v)},m={...ee,nodeId:a.toValue(t),type:le,position:ee.position},I=F.value.get(a.toValue(t)),W={inProgress:!0,isValid:null,from:Je(I,m,R.Left,!0),fromHandle:m,fromPosition:m.position,fromNode:I,to:y,toHandle:null,toPosition:$n[m.position],toNode:null};M({nodeId:a.toValue(t),id:a.toValue(e),type:le,position:U?.getAttribute("data-handlepos")||R.Top,...y},{x:ae-ce.left,y:oe-ce.top}),A.connectStart({event:S,nodeId:a.toValue(t),handleId:a.toValue(e),handleType:le});let Y=W;H.addEventListener("mousemove",Q),H.addEventListener("mouseup",te),H.addEventListener("touchmove",Q),H.addEventListener("touchend",te)}}function T(S){var B,V;if(!f.value)return;const z=a.toValue(n)==="target";if(!h.value){A.clickConnectStart({event:S,nodeId:a.toValue(t),handleId:a.toValue(e)}),M({nodeId:a.toValue(t),type:a.toValue(n),id:a.toValue(e),position:R.Top,...Se(S)},void 0,!0);return}let H=a.toValue(o)||K.value||Wt;const U=N(a.toValue(t));if(!H&&U&&(H=(z?U.isValidSourcePos:U.isValidTargetPos)||Wt),U&&(typeof U.connectable>"u"?p.value:U.connectable)===!1)return;const Q=Fo(S.target),te=ci(S,{handle:{nodeId:a.toValue(t),id:a.toValue(e),type:a.toValue(n),position:R.Top,...Se(S)},connectionMode:c.value,fromNodeId:h.value.nodeId,fromHandleId:h.value.id??null,fromType:h.value.type,isValidConnection:H,doc:Q,lib:"vue",flowId:s,nodeLookup:F.value},$.value,D.value,N,F.value),ie=((B=te.connection)==null?void 0:B.source)===((V=te.connection)==null?void 0:V.target);te.isValid&&te.connection&&!ie&&A.connect(te.connection),A.clickConnectEnd(S),C(S,!0)}return{handlePointerDown:w,handleClick:T}}function hu(){return a.inject(wi,"")}function xi(e){const t=e??hu()??"",n=a.inject(_i,a.ref(null)),{findNode:o,edges:i,emits:r}=de(),l=o(t);return l||r.error(new ge(fe.NODE_NOT_FOUND,t)),{id:t,nodeEl:n,node:l,parentNode:a.computed(()=>o(l.parentNode)),connectedEdges:a.computed(()=>Ko([l],i.value))}}function gu(){return{doubleClick:L(),click:L(),mouseEnter:L(),mouseMove:L(),mouseLeave:L(),contextMenu:L(),dragStart:L(),drag:L(),dragStop:L()}}function pu(e,t){const n=gu();return n.doubleClick.on(o=>{var i,r;t.nodeDoubleClick(o),(r=(i=e.events)==null?void 0:i.doubleClick)==null||r.call(i,o)}),n.click.on(o=>{var i,r;t.nodeClick(o),(r=(i=e.events)==null?void 0:i.click)==null||r.call(i,o)}),n.mouseEnter.on(o=>{var i,r;t.nodeMouseEnter(o),(r=(i=e.events)==null?void 0:i.mouseEnter)==null||r.call(i,o)}),n.mouseMove.on(o=>{var i,r;t.nodeMouseMove(o),(r=(i=e.events)==null?void 0:i.mouseMove)==null||r.call(i,o)}),n.mouseLeave.on(o=>{var i,r;t.nodeMouseLeave(o),(r=(i=e.events)==null?void 0:i.mouseLeave)==null||r.call(i,o)}),n.contextMenu.on(o=>{var i,r;t.nodeContextMenu(o),(r=(i=e.events)==null?void 0:i.contextMenu)==null||r.call(i,o)}),n.dragStart.on(o=>{var i,r;t.nodeDragStart(o),(r=(i=e.events)==null?void 0:i.dragStart)==null||r.call(i,o)}),n.drag.on(o=>{var i,r;t.nodeDrag(o),(r=(i=e.events)==null?void 0:i.drag)==null||r.call(i,o)}),n.dragStop.on(o=>{var i,r;t.nodeDragStop(o),(r=(i=e.events)==null?void 0:i.dragStop)==null||r.call(i,o)}),Object.entries(n).reduce((o,[i,r])=>(o.emit[i]=r.trigger,o.on[i]=r.on,o),{emit:{},on:{}})}function Si(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:n,findNode:o,snapGrid:i,snapToGrid:r,nodesDraggable:l,emits:s}=de();return(u,c=!1)=>{const d=r.value?i.value[0]:5,f=r.value?i.value[1]:5,h=c?4:1,p=u.x*d*h,b=u.y*f*h,x=[];for(const N of e.value)if(N.draggable||l&&typeof N.draggable>"u"){const k={x:N.computedPosition.x+p,y:N.computedPosition.y+b},{position:M}=In(N,k,s.error,t.value,N.parentNode?o(N.parentNode):void 0);x.push({id:N.id,position:M,from:N.position,distance:{x:u.x,y:u.y},dimensions:N.dimensions})}n(x,!0,!1)}}const Kt=.1,mu=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function Ve(){return vt("Viewport not initialized yet."),Promise.resolve(!1)}const yu={zoomIn:Ve,zoomOut:Ve,zoomTo:Ve,fitView:Ve,setCenter:Ve,fitBounds:Ve,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Ve,setTransform:Ve,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function vu(e){function t(o,i){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate(i?.interpolate==="linear"?lt:Tt).scaleBy(An(e.d3Selection,i?.duration,i?.ease,()=>{r(!0)}),o):r(!1)})}function n(o,i,r,l){return new Promise(s=>{var u;const{x:c,y:d}=Lo({x:-o,y:-i},e.translateExtent),f=Ke.translate(-c,-d).scale(r);e.d3Selection&&e.d3Zoom?(u=e.d3Zoom)==null||u.interpolate(l?.interpolate==="linear"?lt:Tt).transform(An(e.d3Selection,l?.duration,l?.ease,()=>{s(!0)}),f):s(!1)})}return a.computed(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:i=>t(1.2,i),zoomOut:i=>t(1/1.2,i),zoomTo:(i,r)=>new Promise(l=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate(r?.interpolate==="linear"?lt:Tt).scaleTo(An(e.d3Selection,r?.duration,r?.ease,()=>{l(!0)}),i):l(!1)}),setViewport:(i,r)=>n(i.x,i.y,i.zoom,r),setTransform:(i,r)=>n(i.x,i.y,i.zoom,r),getViewport:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),getTransform:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),fitView:(i={padding:Kt,includeHiddenNodes:!1,duration:0})=>{var r,l;const s=[];for(const h of e.nodes)h.dimensions.width&&h.dimensions.height&&(i?.includeHiddenNodes||!h.hidden)&&(!((r=i.nodes)!=null&&r.length)||(l=i.nodes)!=null&&l.length&&i.nodes.includes(h.id))&&s.push(h);if(!s.length)return Promise.resolve(!1);const u=Zo(s),{x:c,y:d,zoom:f}=qo(u,e.dimensions.width,e.dimensions.height,i.minZoom??e.minZoom,i.maxZoom??e.maxZoom,i.padding??Kt);return n(c,d,f,i)},setCenter:(i,r,l)=>{const s=typeof l?.zoom<"u"?l.zoom:e.maxZoom,u=e.dimensions.width/2-i*s,c=e.dimensions.height/2-r*s;return n(u,c,s,l)},fitBounds:(i,r={padding:Kt})=>{const{x:l,y:s,zoom:u}=qo(i,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding??Kt);return n(l,s,u,r)},project:i=>mt(i,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:i=>{if(e.vueFlowRef){const{x:r,y:l}=e.vueFlowRef.getBoundingClientRect(),s={x:i.x-r,y:i.y-l};return mt(s,e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:i=>{if(e.vueFlowRef){const{x:r,y:l}=e.vueFlowRef.getBoundingClientRect(),s={x:i.x+r,y:i.y+l};return pt(s,e.viewport)}return{x:0,y:0}}}:yu)}function An(e,t=0,n=mu,o=()=>{}){const i=typeof t=="number"&&t>0;return i||o(),i?e.transition().duration(t).ease(n).on("end",o):e}function wu(e,t,n){const o=a.effectScope(!0);return o.run(()=>{const i=()=>{o.run(()=>{let x,N,k=!!(n.nodes.value.length||n.edges.value.length);x=Ge([e.modelValue,()=>{var M,_;return(_=(M=e.modelValue)==null?void 0:M.value)==null?void 0:_.length}],([M])=>{M&&Array.isArray(M)&&(N?.pause(),n.setElements(M),!N&&!k&&M.length?k=!0:N?.resume())}),N=Ge([n.nodes,n.edges,()=>n.edges.value.length,()=>n.nodes.value.length],([M,_])=>{var C;(C=e.modelValue)!=null&&C.value&&Array.isArray(e.modelValue.value)&&(x?.pause(),e.modelValue.value=[...M,..._],a.nextTick(()=>{x?.resume()}))},{immediate:k}),a.onScopeDispose(()=>{x?.stop(),N?.stop()})})},r=()=>{o.run(()=>{let x,N,k=!!n.nodes.value.length;x=Ge([e.nodes,()=>{var M,_;return(_=(M=e.nodes)==null?void 0:M.value)==null?void 0:_.length}],([M])=>{M&&Array.isArray(M)&&(N?.pause(),n.setNodes(M),!N&&!k&&M.length?k=!0:N?.resume())}),N=Ge([n.nodes,()=>n.nodes.value.length],([M])=>{var _;(_=e.nodes)!=null&&_.value&&Array.isArray(e.nodes.value)&&(x?.pause(),e.nodes.value=[...M],a.nextTick(()=>{x?.resume()}))},{immediate:k}),a.onScopeDispose(()=>{x?.stop(),N?.stop()})})},l=()=>{o.run(()=>{let x,N,k=!!n.edges.value.length;x=Ge([e.edges,()=>{var M,_;return(_=(M=e.edges)==null?void 0:M.value)==null?void 0:_.length}],([M])=>{M&&Array.isArray(M)&&(N?.pause(),n.setEdges(M),!N&&!k&&M.length?k=!0:N?.resume())}),N=Ge([n.edges,()=>n.edges.value.length],([M])=>{var _;(_=e.edges)!=null&&_.value&&Array.isArray(e.edges.value)&&(x?.pause(),e.edges.value=[...M],a.nextTick(()=>{x?.resume()}))},{immediate:k}),a.onScopeDispose(()=>{x?.stop(),N?.stop()})})},s=()=>{o.run(()=>{a.watch(()=>t.maxZoom,()=>{t.maxZoom&&he(t.maxZoom)&&n.setMaxZoom(t.maxZoom)},{immediate:!0})})},u=()=>{o.run(()=>{a.watch(()=>t.minZoom,()=>{t.minZoom&&he(t.minZoom)&&n.setMinZoom(t.minZoom)},{immediate:!0})})},c=()=>{o.run(()=>{a.watch(()=>t.translateExtent,()=>{t.translateExtent&&he(t.translateExtent)&&n.setTranslateExtent(t.translateExtent)},{immediate:!0})})},d=()=>{o.run(()=>{a.watch(()=>t.nodeExtent,()=>{t.nodeExtent&&he(t.nodeExtent)&&n.setNodeExtent(t.nodeExtent)},{immediate:!0})})},f=()=>{o.run(()=>{a.watch(()=>t.applyDefault,()=>{he(t.applyDefault)&&(n.applyDefault.value=t.applyDefault)},{immediate:!0})})},h=()=>{o.run(()=>{const x=async N=>{let k=N;typeof t.autoConnect=="function"&&(k=await t.autoConnect(N)),k!==!1&&n.addEdges([k])};a.watch(()=>t.autoConnect,()=>{he(t.autoConnect)&&(n.autoConnect.value=t.autoConnect)},{immediate:!0}),a.watch(n.autoConnect,(N,k,M)=>{N?n.onConnect(x):n.hooks.value.connect.off(x),M(()=>{n.hooks.value.connect.off(x)})},{immediate:!0})})},p=()=>{const x=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const N of Object.keys(t)){const k=N;if(!x.includes(k)){const M=a.toRef(()=>t[k]),_=n[k];a.isRef(_)&&o.run(()=>{a.watch(M,C=>{he(C)&&(_.value=C)},{immediate:!0})})}}};i(),r(),l(),u(),s(),c(),d(),f(),h(),p()}),()=>o.stop()}function _u(){return{edgesChange:L(),nodesChange:L(),nodeDoubleClick:L(),nodeClick:L(),nodeMouseEnter:L(),nodeMouseMove:L(),nodeMouseLeave:L(),nodeContextMenu:L(),nodeDragStart:L(),nodeDrag:L(),nodeDragStop:L(),nodesInitialized:L(),miniMapNodeClick:L(),miniMapNodeDoubleClick:L(),miniMapNodeMouseEnter:L(),miniMapNodeMouseMove:L(),miniMapNodeMouseLeave:L(),connect:L(),connectStart:L(),connectEnd:L(),clickConnectStart:L(),clickConnectEnd:L(),paneReady:L(),init:L(),move:L(),moveStart:L(),moveEnd:L(),selectionDragStart:L(),selectionDrag:L(),selectionDragStop:L(),selectionContextMenu:L(),selectionStart:L(),selectionEnd:L(),viewportChangeStart:L(),viewportChange:L(),viewportChangeEnd:L(),paneScroll:L(),paneClick:L(),paneContextMenu:L(),paneMouseEnter:L(),paneMouseMove:L(),paneMouseLeave:L(),edgeContextMenu:L(),edgeMouseEnter:L(),edgeMouseMove:L(),edgeMouseLeave:L(),edgeDoubleClick:L(),edgeClick:L(),edgeUpdateStart:L(),edgeUpdate:L(),edgeUpdateEnd:L(),updateNodeInternals:L(),error:L(e=>vt(e.message))}}function Eu(e,t){const n=a.getCurrentInstance();a.onBeforeMount(()=>{for(const[i,r]of Object.entries(t.value)){const l=s=>{e(i,s)};r.setEmitter(l),et(r.removeEmitter),r.setHasEmitListeners(()=>o(i)),et(r.removeHasEmitListeners)}});function o(i){var r;const l=bu(i);return!!((r=n?.vnode.props)==null?void 0:r[l])}}function bu(e){const[t,...n]=e.split(":");return`on${t.replace(/(?:^|-)(\w)/g,(i,r)=>r.toUpperCase())}${n.length?`:${n.join(":")}`:""}`}function Ni(){return{vueFlowRef:null,viewportRef:null,nodes:[],edges:[],connectionLookup:new Map,nodeTypes:{},edgeTypes:{},initialized:!1,dimensions:{width:0,height:0},viewport:{x:0,y:0,zoom:1},d3Zoom:null,d3Selection:null,d3ZoomHandler:null,minZoom:.5,maxZoom:2,translateExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],nodeExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],selectionMode:Sn.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:ft.Free,paneClickDistance:0,panOnDrag:!0,edgeUpdaterRadius:10,onlyRenderVisibleElements:!1,defaultViewport:{x:0,y:0,zoom:1},nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,defaultMarkerColor:"#b1b1b7",connectionLineStyle:{},connectionLineType:null,connectionLineOptions:{type:He.Bezier,style:{}},connectionMode:Te.Loose,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectionPosition:{x:Number.NaN,y:Number.NaN},connectionRadius:20,connectOnClick:!0,connectionStatus:null,isValidConnection:null,snapGrid:[15,15],snapToGrid:!1,edgesUpdatable:!1,edgesFocusable:!0,nodesFocusable:!0,nodesConnectable:!0,nodesDraggable:!0,nodeDragThreshold:1,elementsSelectable:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,selectionKeyCode:"Shift",multiSelectionKeyCode:Xt()?"Meta":"Control",zoomActivationKeyCode:Xt()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:_u(),applyDefault:!0,autoConnect:!1,fitViewOnInit:!1,fitViewOnInitDone:!1,noDragClassName:"nodrag",noWheelClassName:"nowheel",noPanClassName:"nopan",defaultEdgeOptions:void 0,elevateEdgesOnSelect:!1,elevateNodesOnSelect:!0,autoPanOnNodeDrag:!0,autoPanOnConnect:!0,autoPanSpeed:15,disableKeyboardA11y:!1,ariaLiveMessage:""}}const xu=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function Su(e,t,n){const o=vu(e),i=y=>{const g=y??[];e.hooks.updateNodeInternals.trigger(g)},r=y=>zs(y,e.nodes,e.edges),l=y=>Os(y,e.nodes,e.edges),s=y=>Ko(y,e.edges),u=({id:y,type:g,nodeId:v})=>{var m;const I=y?`-${g}-${y}`:`-${g}`;return Array.from(((m=e.connectionLookup.get(`${v}${I}`))==null?void 0:m.values())??[])},c=y=>{if(y)return t.value.get(y)},d=y=>{if(y)return n.value.get(y)},f=(y,g,v)=>{var m,I;const X=[];for(const W of y){const Y={id:W.id,type:"position",dragging:v,from:W.from};if(g&&(Y.position=W.position,W.parentNode)){const q=c(W.parentNode);Y.position={x:Y.position.x-(((m=q?.computedPosition)==null?void 0:m.x)??0),y:Y.position.y-(((I=q?.computedPosition)==null?void 0:I.y)??0)}}X.push(Y)}X?.length&&e.hooks.nodesChange.trigger(X)},h=y=>{if(!e.vueFlowRef)return;const g=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!g)return;const v=window.getComputedStyle(g),{m22:m}=new window.DOMMatrixReadOnly(v.transform),I=[];for(const X of y){const W=X,Y=c(W.id);if(Y){const q=Yt(W.nodeElement);if(!!(q.width&&q.height&&(Y.dimensions.width!==q.width||Y.dimensions.height!==q.height||W.forceUpdate))){const se=W.nodeElement.getBoundingClientRect();Y.dimensions=q,Y.handleBounds.source=gi("source",W.nodeElement,se,m,Y.id),Y.handleBounds.target=gi("target",W.nodeElement,se,m,Y.id),I.push({id:Y.id,type:"dimensions",dimensions:q})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&o.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),I.length&&e.hooks.nodesChange.trigger(I)},p=(y,g)=>{const v=new Set,m=new Set;for(const W of y)Fe(W)?v.add(W.id):$e(W)&&m.add(W.id);const I=Be(t.value,v,!0),X=Be(n.value,m);if(e.multiSelectionActive){for(const W of v)I.push(De(W,g));for(const W of m)X.push(De(W,g))}I.length&&e.hooks.nodesChange.trigger(I),X.length&&e.hooks.edgesChange.trigger(X)},b=y=>{if(e.multiSelectionActive){const g=y.map(v=>De(v.id,!0));e.hooks.nodesChange.trigger(g);return}e.hooks.nodesChange.trigger(Be(t.value,new Set(y.map(g=>g.id)),!0)),e.hooks.edgesChange.trigger(Be(n.value))},x=y=>{if(e.multiSelectionActive){const g=y.map(v=>De(v.id,!0));e.hooks.edgesChange.trigger(g);return}e.hooks.edgesChange.trigger(Be(n.value,new Set(y.map(g=>g.id)))),e.hooks.nodesChange.trigger(Be(t.value,new Set,!0))},N=y=>{p(y,!0)},k=y=>{const v=(y||e.nodes).map(m=>(m.selected=!1,De(m.id,!1)));e.hooks.nodesChange.trigger(v)},M=y=>{const v=(y||e.edges).map(m=>(m.selected=!1,De(m.id,!1)));e.hooks.edgesChange.trigger(v)},_=y=>{if(!y||!y.length)return p([],!1);const g=y.reduce((v,m)=>{const I=De(m.id,!1);return Fe(m)?v.nodes.push(I):v.edges.push(I),v},{nodes:[],edges:[]});g.nodes.length&&e.hooks.nodesChange.trigger(g.nodes),g.edges.length&&e.hooks.edgesChange.trigger(g.edges)},C=y=>{var g;(g=e.d3Zoom)==null||g.scaleExtent([y,e.maxZoom]),e.minZoom=y},A=y=>{var g;(g=e.d3Zoom)==null||g.scaleExtent([e.minZoom,y]),e.maxZoom=y},P=y=>{var g;(g=e.d3Zoom)==null||g.translateExtent(y),e.translateExtent=y},$=y=>{e.nodeExtent=y,i()},D=y=>{var g;(g=e.d3Zoom)==null||g.clickDistance(y)},K=y=>{e.nodesDraggable=y,e.nodesConnectable=y,e.elementsSelectable=y},F=y=>{const g=y instanceof Function?y(e.nodes):y;!e.initialized&&!g.length||(e.nodes=pi(g,c,e.hooks.error.trigger))},O=y=>{const g=y instanceof Function?y(e.edges):y;if(!e.initialized&&!g.length)return;const v=Vn(g,e.isValidConnection,c,d,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);Bn(e.connectionLookup,n.value,v),e.edges=v},E=y=>{const g=y instanceof Function?y([...e.nodes,...e.edges]):y;!e.initialized&&!g.length||(F(g.filter(Fe)),O(g.filter($e)))},J=y=>{let g=y instanceof Function?y(e.nodes):y;g=Array.isArray(g)?g:[g];const v=pi(g,c,e.hooks.error.trigger),m=[];for(const I of v)m.push(ni(I));m.length&&e.hooks.nodesChange.trigger(m)},w=y=>{let g=y instanceof Function?y(e.edges):y;g=Array.isArray(g)?g:[g];const v=Vn(g,e.isValidConnection,c,d,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),m=[];for(const I of v)m.push(ni(I));m.length&&e.hooks.edgesChange.trigger(m)},T=(y,g=!0,v=!1)=>{const m=y instanceof Function?y(e.nodes):y,I=Array.isArray(m)?m:[m],X=[],W=[];function Y(ne){const se=s(ne);for(const ue of se)(!he(ue.deletable)||ue.deletable)&&W.push(ii(ue.id,ue.source,ue.target,ue.sourceHandle,ue.targetHandle))}function q(ne){const se=[];for(const ue of e.nodes)ue.parentNode===ne&&se.push(ue);if(se.length){for(const ue of se)X.push(oi(ue.id));g&&Y(se);for(const ue of se)q(ue.id)}}for(const ne of I){const se=typeof ne=="string"?c(ne):ne;se&&(he(se.deletable)&&!se.deletable||(X.push(oi(se.id)),g&&Y([se]),v&&q(se.id)))}W.length&&e.hooks.edgesChange.trigger(W),X.length&&e.hooks.nodesChange.trigger(X)},S=y=>{const g=y instanceof Function?y(e.edges):y,v=Array.isArray(g)?g:[g],m=[];for(const I of v){const X=typeof I=="string"?d(I):I;X&&(he(X.deletable)&&!X.deletable||m.push(ii(typeof I=="string"?I:I.id,X.source,X.target,X.sourceHandle,X.targetHandle)))}e.hooks.edgesChange.trigger(m)},B=(y,g,v=!0)=>{const m=d(y.id);if(!m)return!1;const I=e.edges.indexOf(m),X=au(y,g,m,v,e.hooks.error.trigger);if(X){const[W]=Vn([X],e.isValidConnection,c,d,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((Y,q)=>q===I?W:Y),Bn(e.connectionLookup,n.value,[W]),W}return!1},V=(y,g,v={replace:!1})=>{const m=d(y);if(!m)return;const I=typeof g=="function"?g(m):g;m.data=v.replace?I:{...m.data,...I}},z=y=>ti(y,e.nodes),H=y=>{const g=ti(y,e.edges);return Bn(e.connectionLookup,n.value,g),g},U=(y,g,v={replace:!1})=>{const m=c(y);if(!m)return;const I=typeof g=="function"?g(m):g;v.replace?e.nodes.splice(e.nodes.indexOf(m),1,I):Object.assign(m,I)},Q=(y,g,v={replace:!1})=>{const m=c(y);if(!m)return;const I=typeof g=="function"?g(m):g;m.data=v.replace?I:{...m.data,...I}},te=(y,g,v=!1)=>{v?e.connectionClickStartHandle=y:e.connectionStartHandle=y,e.connectionEndHandle=null,e.connectionStatus=null,g&&(e.connectionPosition=g)},ie=(y,g=null,v=null)=>{e.connectionStartHandle&&(e.connectionPosition=y,e.connectionEndHandle=g,e.connectionStatus=v)},G=(y,g)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,g?e.connectionClickStartHandle=null:e.connectionStartHandle=null},Z=y=>{const g=Vs(y),v=g?null:gt(y)?y:c(y.id);return!g&&!v?[null,null,g]:[g?y:Lt(v),v,g]},j=(y,g=!0,v=e.nodes)=>{const[m,I,X]=Z(y);if(!m)return[];const W=[];for(const Y of v||e.nodes){if(!X&&(Y.id===I.id||!Y.computedPosition))continue;const q=Lt(Y),ne=Ft(q,m);(g&&ne>0||ne>=q.width*q.height||ne>=Number(m.width)*Number(m.height))&&W.push(Y)}return W},ae=(y,g,v=!0)=>{const[m]=Z(y);if(!m)return!1;const I=Ft(m,g);return v&&I>0||I>=Number(m.width)*Number(m.height)},oe=y=>{const{viewport:g,dimensions:v,d3Zoom:m,d3Selection:I,translateExtent:X}=e;if(!m||!I||!y.x&&!y.y)return!1;const W=Ke.translate(g.x+y.x,g.y+y.y).scale(g.zoom),Y=[[0,0],[v.width,v.height]],q=m.constrain()(W,Y,X),ne=e.viewport.x!==q.x||e.viewport.y!==q.y||e.viewport.zoom!==q.k;return m.transform(I,q),ne},le=y=>{const g=y instanceof Function?y(e):y,v=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];he(g.defaultEdgeOptions)&&(e.defaultEdgeOptions=g.defaultEdgeOptions);const m=g.modelValue||g.nodes||g.edges?[]:void 0;m&&(g.modelValue&&m.push(...g.modelValue),g.nodes&&m.push(...g.nodes),g.edges&&m.push(...g.edges),E(m));const I=()=>{he(g.maxZoom)&&A(g.maxZoom),he(g.minZoom)&&C(g.minZoom),he(g.translateExtent)&&P(g.translateExtent)};for(const X of Object.keys(g)){const W=X,Y=g[W];![...xu,...v].includes(W)&&he(Y)&&(e[W]=Y)}nn(()=>e.d3Zoom).not.toBeNull().then(I),e.initialized||(e.initialized=!0)};return{updateNodePositions:f,updateNodeDimensions:h,setElements:E,setNodes:F,setEdges:O,addNodes:J,addEdges:w,removeNodes:T,removeEdges:S,findNode:c,findEdge:d,updateEdge:B,updateEdgeData:V,updateNode:U,updateNodeData:Q,applyEdgeChanges:H,applyNodeChanges:z,addSelectedElements:N,addSelectedNodes:b,addSelectedEdges:x,setMinZoom:C,setMaxZoom:A,setTranslateExtent:P,setNodeExtent:$,setPaneClickDistance:D,removeSelectedElements:_,removeSelectedNodes:k,removeSelectedEdges:M,startConnection:te,updateConnection:ie,endConnection:G,setInteractive:K,setState:le,getIntersectingNodes:j,getIncomers:r,getOutgoers:l,getConnectedEdges:s,getHandleConnections:u,isNodeIntersecting:ae,panBy:oe,fitView:y=>o.value.fitView(y),zoomIn:y=>o.value.zoomIn(y),zoomOut:y=>o.value.zoomOut(y),zoomTo:(y,g)=>o.value.zoomTo(y,g),setViewport:(y,g)=>o.value.setViewport(y,g),setTransform:(y,g)=>o.value.setTransform(y,g),getViewport:()=>o.value.getViewport(),getTransform:()=>o.value.getTransform(),setCenter:(y,g,v)=>o.value.setCenter(y,g,v),fitBounds:(y,g)=>o.value.fitBounds(y,g),project:y=>o.value.project(y),screenToFlowCoordinate:y=>o.value.screenToFlowCoordinate(y),flowToScreenCoordinate:y=>o.value.flowToScreenCoordinate(y),toObject:()=>{const y=[],g=[];for(const v of e.nodes){const{computedPosition:m,handleBounds:I,selected:X,dimensions:W,isParent:Y,resizing:q,dragging:ne,events:se,...ue}=v;y.push(ue)}for(const v of e.edges){const{selected:m,sourceNode:I,targetNode:X,events:W,...Y}=v;g.push(Y)}return JSON.parse(JSON.stringify({nodes:y,edges:g,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:y=>new Promise(g=>{const{nodes:v,edges:m,position:I,zoom:X,viewport:W}=y;v&&F(v),m&&O(m);const[Y,q]=W?.x&&W?.y?[W.x,W.y]:I??[null,null];if(Y&&q){const ne=W?.zoom||X||e.viewport.zoom;return nn(()=>o.value.viewportInitialized).toBe(!0).then(()=>{o.value.setViewport({x:Y,y:q,zoom:ne}).then(()=>{g(!0)})})}else g(!0)}),updateNodeInternals:i,viewportHelper:o,$reset:()=>{const y=Ni();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const g=Ke.translate(y.defaultViewport.x??0,y.defaultViewport.y??0).scale(Le(y.defaultViewport.zoom??1,y.minZoom,y.maxZoom)),v=e.viewportRef.getBoundingClientRect(),m=[[0,0],[v.width,v.height]],I=e.d3Zoom.constrain()(g,m,y.translateExtent);e.d3Zoom.transform(e.d3Selection,I)}le(y)},$destroy:()=>{}}}const Nu=["data-id","data-handleid","data-nodeid","data-handlepos"],Cu={name:"Handle",compatConfig:{MODE:3}},Qe=a.defineComponent({...Cu,props:{id:{default:null},type:{},position:{default:()=>R.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(e,{expose:t}){const n=a.createPropsRestProxy(e,["position","connectable","connectableStart","connectableEnd","id"]),o=a.toRef(()=>n.type??"source"),i=a.toRef(()=>n.isValidConnection??null),{id:r,connectionStartHandle:l,connectionClickStartHandle:s,connectionEndHandle:u,vueFlowRef:c,nodesConnectable:d,noDragClassName:f,noPanClassName:h}=de(),{id:p,node:b,nodeEl:x,connectedEdges:N}=xi(),k=a.ref(),M=a.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),_=a.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),C=a.toRef(()=>{var O,E,J,w,T,S;return((O=l.value)==null?void 0:O.nodeId)===p&&((E=l.value)==null?void 0:E.id)===e.id&&((J=l.value)==null?void 0:J.type)===o.value||((w=u.value)==null?void 0:w.nodeId)===p&&((T=u.value)==null?void 0:T.id)===e.id&&((S=u.value)==null?void 0:S.type)===o.value}),A=a.toRef(()=>{var O,E,J;return((O=s.value)==null?void 0:O.nodeId)===p&&((E=s.value)==null?void 0:E.id)===e.id&&((J=s.value)==null?void 0:J.type)===o.value}),{handlePointerDown:P,handleClick:$}=bi({nodeId:p,handleId:e.id,isValidConnection:i,type:o}),D=a.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!N.value.some(O=>{const E=O[`${o.value}Handle`];return O[o.value]!==p?!1:E?E===e.id:!0}):typeof e.connectable=="number"?N.value.filter(O=>{const E=O[`${o.value}Handle`];return O[o.value]!==p?!1:E?E===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(b,N.value):he(e.connectable)?e.connectable:d.value);a.onMounted(()=>{var O;if(!b.dimensions.width||!b.dimensions.height)return;const E=(O=b.handleBounds[o.value])==null?void 0:O.find(z=>z.id===e.id);if(!c.value||E)return;const J=c.value.querySelector(".vue-flow__transformationpane");if(!x.value||!k.value||!J||!e.id)return;const w=x.value.getBoundingClientRect(),T=k.value.getBoundingClientRect(),S=window.getComputedStyle(J),{m22:B}=new window.DOMMatrixReadOnly(S.transform),V={id:e.id,position:e.position,x:(T.left-w.left)/B,y:(T.top-w.top)/B,type:o.value,nodeId:p,...Yt(k.value)};b.handleBounds[o.value]=[...b.handleBounds[o.value]??[],V]});function K(O){const E=Pn(O);D.value&&M.value&&(E&&O.button===0||!E)&&P(O)}function F(O){!p||!s.value&&!M.value||D.value&&$(O)}return t({handleClick:$,handlePointerDown:P,onClick:F,onPointerDown:K}),(O,E)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"handle",ref:k,"data-id":`${a.unref(r)}-${a.unref(p)}-${e.id}-${o.value}`,"data-handleid":e.id,"data-nodeid":a.unref(p),"data-handlepos":O.position,class:a.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${O.position}`,`vue-flow__handle-${e.id}`,a.unref(f),a.unref(h),o.value,{connectable:D.value,connecting:A.value,connectablestart:M.value,connectableend:_.value,connectionindicator:D.value&&(M.value&&!C.value||_.value&&C.value)}]]),onMousedown:K,onTouchstartPassive:K,onClick:F},[a.renderSlot(O.$slots,"default",{id:O.id})],42,Nu))}}),qt=function({sourcePosition:e=R.Bottom,targetPosition:t=R.Top,label:n,connectable:o=!0,isValidTargetPos:i,isValidSourcePos:r,data:l}){const s=l.label??n;return[a.h(Qe,{type:"target",position:t,connectable:o,isValidConnection:i}),typeof s!="string"&&s?a.h(s):a.h(a.Fragment,[s]),a.h(Qe,{type:"source",position:e,connectable:o,isValidConnection:r})]};qt.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],qt.inheritAttrs=!1,qt.compatConfig={MODE:3};const ku=qt,jt=function({targetPosition:e=R.Top,label:t,connectable:n=!0,isValidTargetPos:o,data:i}){const r=i.label??t;return[a.h(Qe,{type:"target",position:e,connectable:n,isValidConnection:o}),typeof r!="string"&&r?a.h(r):a.h(a.Fragment,[r])]};jt.props=["targetPosition","label","isValidTargetPos","connectable","data"],jt.inheritAttrs=!1,jt.compatConfig={MODE:3};const Mu=jt,Jt=function({sourcePosition:e=R.Bottom,label:t,connectable:n=!0,isValidSourcePos:o,data:i}){const r=i.label??t;return[typeof r!="string"&&r?a.h(r):a.h(a.Fragment,[r]),a.h(Qe,{type:"source",position:e,connectable:n,isValidConnection:o})]};Jt.props=["sourcePosition","label","isValidSourcePos","connectable","data"],Jt.inheritAttrs=!1,Jt.compatConfig={MODE:3};const Iu=Jt,Pu=["transform"],Tu=["width","height","x","y","rx","ry"],$u=["y"],Du={name:"EdgeText",compatConfig:{MODE:3}},Bu=a.defineComponent({...Du,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const t=a.ref({x:0,y:0,width:0,height:0}),n=a.ref(null),o=a.computed(()=>`translate(${e.x-t.value.width/2} ${e.y-t.value.height/2})`);a.onMounted(i),a.watch([()=>e.x,()=>e.y,n,()=>e.label],i);function i(){if(!n.value)return;const r=n.value.getBBox();(r.width!==t.value.width||r.height!==t.value.height)&&(t.value=r)}return(r,l)=>(a.openBlock(),a.createElementBlock("g",{transform:o.value,class:"vue-flow__edge-textwrapper"},[r.labelShowBg?(a.openBlock(),a.createElementBlock("rect",{key:0,class:"vue-flow__edge-textbg",width:`${t.value.width+2*r.labelBgPadding[0]}px`,height:`${t.value.height+2*r.labelBgPadding[1]}px`,x:-r.labelBgPadding[0],y:-r.labelBgPadding[1],style:a.normalizeStyle(r.labelBgStyle),rx:r.labelBgBorderRadius,ry:r.labelBgBorderRadius},null,12,Tu)):a.createCommentVNode("",!0),a.createElementVNode("text",a.mergeProps(r.$attrs,{ref_key:"el",ref:n,class:"vue-flow__edge-text",y:t.value.height/2,dy:"0.3em",style:r.labelStyle}),[a.renderSlot(r.$slots,"default",{},()=>[typeof r.label!="string"?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(r.label),{key:0})):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[a.createTextVNode(a.toDisplayString(r.label),1)],64))])],16,$u)],8,Pu))}}),Vu=["id","d","marker-end","marker-start"],Au=["d","stroke-width"],Ou={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},Qt=a.defineComponent({...Ou,props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:t}){const n=a.ref(null),o=a.ref(null),i=a.ref(null),r=a.useAttrs();return t({pathEl:n,interactionEl:o,labelEl:i}),(l,s)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("path",a.mergeProps(a.unref(r),{id:l.id,ref_key:"pathEl",ref:n,d:l.path,class:"vue-flow__edge-path","marker-end":l.markerEnd,"marker-start":l.markerStart}),null,16,Vu),l.interactionWidth?(a.openBlock(),a.createElementBlock("path",{key:0,ref_key:"interactionEl",ref:o,fill:"none",d:l.path,"stroke-width":l.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,Au)):a.createCommentVNode("",!0),l.label&&l.labelX&&l.labelY?(a.openBlock(),a.createBlock(Bu,{key:1,ref_key:"labelEl",ref:i,x:l.labelX,y:l.labelY,label:l.label,"label-show-bg":l.labelShowBg,"label-bg-style":l.labelBgStyle,"label-bg-padding":l.labelBgPadding,"label-bg-border-radius":l.labelBgBorderRadius,"label-style":l.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):a.createCommentVNode("",!0)],64))}});function Ci({sourceX:e,sourceY:t,targetX:n,targetY:o}){const i=Math.abs(n-e)/2,r=n<e?n+i:n-i,l=Math.abs(o-t)/2,s=o<t?o+l:o-l;return[r,s,i,l]}function ki({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:i,sourceControlY:r,targetControlX:l,targetControlY:s}){const u=e*.125+i*.375+l*.375+n*.125,c=t*.125+r*.375+s*.375+o*.125,d=Math.abs(u-e),f=Math.abs(c-t);return[u,c,d,f]}function en(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Mi({pos:e,x1:t,y1:n,x2:o,y2:i,c:r}){let l,s;switch(e){case R.Left:l=t-en(t-o,r),s=n;break;case R.Right:l=t+en(o-t,r),s=n;break;case R.Top:l=t,s=n-en(n-i,r);break;case R.Bottom:l=t,s=n+en(i-n,r);break}return[l,s]}function On(e){const{sourceX:t,sourceY:n,sourcePosition:o=R.Bottom,targetX:i,targetY:r,targetPosition:l=R.Top,curvature:s=.25}=e,[u,c]=Mi({pos:o,x1:t,y1:n,x2:i,y2:r,c:s}),[d,f]=Mi({pos:l,x1:i,y1:r,x2:t,y2:n,c:s}),[h,p,b,x]=ki({sourceX:t,sourceY:n,targetX:i,targetY:r,sourceControlX:u,sourceControlY:c,targetControlX:d,targetControlY:f});return[`M${t},${n} C${u},${c} ${d},${f} ${i},${r}`,h,p,b,x]}function Ii({pos:e,x1:t,y1:n,x2:o,y2:i}){let r,l;switch(e){case R.Left:case R.Right:r=.5*(t+o),l=n;break;case R.Top:case R.Bottom:r=t,l=.5*(n+i);break}return[r,l]}function Pi(e){const{sourceX:t,sourceY:n,sourcePosition:o=R.Bottom,targetX:i,targetY:r,targetPosition:l=R.Top}=e,[s,u]=Ii({pos:o,x1:t,y1:n,x2:i,y2:r}),[c,d]=Ii({pos:l,x1:i,y1:r,x2:t,y2:n}),[f,h,p,b]=ki({sourceX:t,sourceY:n,targetX:i,targetY:r,sourceControlX:s,sourceControlY:u,targetControlX:c,targetControlY:d});return[`M${t},${n} C${s},${u} ${c},${d} ${i},${r}`,f,h,p,b]}const Ti={[R.Left]:{x:-1,y:0},[R.Right]:{x:1,y:0},[R.Top]:{x:0,y:-1},[R.Bottom]:{x:0,y:1}};function zu({source:e,sourcePosition:t=R.Bottom,target:n}){return t===R.Left||t===R.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}}function $i(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function Ru({source:e,sourcePosition:t=R.Bottom,target:n,targetPosition:o=R.Top,center:i,offset:r}){const l=Ti[t],s=Ti[o],u={x:e.x+l.x*r,y:e.y+l.y*r},c={x:n.x+s.x*r,y:n.y+s.y*r},d=zu({source:u,sourcePosition:t,target:c}),f=d.x!==0?"x":"y",h=d[f];let p,b,x;const N={x:0,y:0},k={x:0,y:0},[M,_,C,A]=Ci({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[f]*s[f]===-1){b=i.x??M,x=i.y??_;const $=[{x:b,y:u.y},{x:b,y:c.y}],D=[{x:u.x,y:x},{x:c.x,y:x}];l[f]===h?p=f==="x"?$:D:p=f==="x"?D:$}else{const $=[{x:u.x,y:c.y}],D=[{x:c.x,y:u.y}];if(f==="x"?p=l.x===h?D:$:p=l.y===h?$:D,t===o){const J=Math.abs(e[f]-n[f]);if(J<=r){const w=Math.min(r-1,r-J);l[f]===h?N[f]=(u[f]>e[f]?-1:1)*w:k[f]=(c[f]>n[f]?-1:1)*w}}if(t!==o){const J=f==="x"?"y":"x",w=l[f]===s[J],T=u[J]>c[J],S=u[J]<c[J];(l[f]===1&&(!w&&T||w&&S)||l[f]!==1&&(!w&&S||w&&T))&&(p=f==="x"?$:D)}const K={x:u.x+N.x,y:u.y+N.y},F={x:c.x+k.x,y:c.y+k.y},O=Math.max(Math.abs(K.x-p[0].x),Math.abs(F.x-p[0].x)),E=Math.max(Math.abs(K.y-p[0].y),Math.abs(F.y-p[0].y));O>=E?(b=(K.x+F.x)/2,x=p[0].y):(b=p[0].x,x=(K.y+F.y)/2)}return[[e,{x:u.x+N.x,y:u.y+N.y},...p,{x:c.x+k.x,y:c.y+k.y},n],b,x,C,A]}function Hu(e,t,n,o){const i=Math.min($i(e,t)/2,$i(t,n)/2,o),{x:r,y:l}=t;if(e.x===r&&r===n.x||e.y===l&&l===n.y)return`L${r} ${l}`;if(e.y===l){const c=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${r+i*c},${l}Q ${r},${l} ${r},${l+i*d}`}const s=e.x<n.x?1:-1,u=e.y<n.y?-1:1;return`L ${r},${l+i*u}Q ${r},${l} ${r+i*s},${l}`}function zn(e){const{sourceX:t,sourceY:n,sourcePosition:o=R.Bottom,targetX:i,targetY:r,targetPosition:l=R.Top,borderRadius:s=5,centerX:u,centerY:c,offset:d=20}=e,[f,h,p,b,x]=Ru({source:{x:t,y:n},sourcePosition:o,target:{x:i,y:r},targetPosition:l,center:{x:u,y:c},offset:d});return[f.reduce((k,M,_)=>{let C;return _>0&&_<f.length-1?C=Hu(f[_-1],M,f[_+1],s):C=`${_===0?"M":"L"}${M.x} ${M.y}`,k+=C,k},""),h,p,b,x]}function Lu(e){const{sourceX:t,sourceY:n,targetX:o,targetY:i}=e,[r,l,s,u]=Ci({sourceX:t,sourceY:n,targetX:o,targetY:i});return[`M ${t},${n}L ${o},${i}`,r,l,s,u]}const Fu=a.defineComponent({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=Lu(e);return a.h(Qt,{path:n,labelX:o,labelY:i,...t,...e})}}}),Di=a.defineComponent({name:"SmoothStepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","borderRadius","markerEnd","markerStart","interactionWidth","offset"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=zn({...e,sourcePosition:e.sourcePosition??R.Bottom,targetPosition:e.targetPosition??R.Top});return a.h(Qt,{path:n,labelX:o,labelY:i,...t,...e})}}}),Yu=a.defineComponent({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:t}){return()=>a.h(Di,{...e,...t,borderRadius:0})}}),Gu=a.defineComponent({name:"BezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=On({...e,sourcePosition:e.sourcePosition??R.Bottom,targetPosition:e.targetPosition??R.Top});return a.h(Qt,{path:n,labelX:o,labelY:i,...t,...e})}}}),Xu=a.defineComponent({name:"SimpleBezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=Pi({...e,sourcePosition:e.sourcePosition??R.Bottom,targetPosition:e.targetPosition??R.Top});return a.h(Qt,{path:n,labelX:o,labelY:i,...t,...e})}}}),Uu={input:Iu,default:ku,output:Mu},Zu={default:Gu,straight:Fu,step:Yu,smoothstep:Di,simplebezier:Xu};function Wu(e,t,n){const o=a.computed(()=>x=>t.value.get(x)),i=a.computed(()=>x=>n.value.get(x)),r=a.computed(()=>{const x={...Zu,...e.edgeTypes},N=Object.keys(x);for(const k of e.edges)k.type&&!N.includes(k.type)&&(x[k.type]=k.type);return x}),l=a.computed(()=>{const x={...Uu,...e.nodeTypes},N=Object.keys(x);for(const k of e.nodes)k.type&&!N.includes(k.type)&&(x[k.type]=k.type);return x}),s=a.computed(()=>e.onlyRenderVisibleElements?Wo(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),u=a.computed(()=>{if(e.onlyRenderVisibleElements){const x=[];for(const N of e.edges){const k=t.value.get(N.source),M=t.value.get(N.target);Ks({sourcePos:k.computedPosition||{x:0,y:0},targetPos:M.computedPosition||{x:0,y:0},sourceWidth:k.dimensions.width,sourceHeight:k.dimensions.height,targetWidth:M.dimensions.width,targetHeight:M.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&x.push(N)}return x}return e.edges}),c=a.computed(()=>[...s.value,...u.value]),d=a.computed(()=>{const x=[];for(const N of e.nodes)N.selected&&x.push(N);return x}),f=a.computed(()=>{const x=[];for(const N of e.edges)N.selected&&x.push(N);return x}),h=a.computed(()=>[...d.value,...f.value]),p=a.computed(()=>{const x=[];for(const N of e.nodes)N.dimensions.width&&N.dimensions.height&&N.handleBounds!==void 0&&x.push(N);return x}),b=a.computed(()=>s.value.length>0&&p.value.length===s.value.length);return{getNode:o,getEdge:i,getElements:c,getEdgeTypes:r,getNodeTypes:l,getEdges:u,getNodes:s,getSelectedElements:h,getSelectedNodes:d,getSelectedEdges:f,getNodesInitialized:p,areNodesInitialized:b}}class Ye{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var t;const n=(t=a.getCurrentInstance())==null?void 0:t.appContext.app,o=n?.config.globalProperties.$vueFlowStorage??Ye.instance;return Ye.instance=o??new Ye,n&&(n.config.globalProperties.$vueFlowStorage=Ye.instance),Ye.instance}set(t,n){return this.flows.set(t,n)}get(t){return this.flows.get(t)}remove(t){return this.flows.delete(t)}create(t,n){const o=Ni(),i=a.reactive(o),r={};for(const[h,p]of Object.entries(i.hooks)){const b=`on${h.charAt(0).toUpperCase()+h.slice(1)}`;r[b]=p.on}const l={};for(const[h,p]of Object.entries(i.hooks))l[h]=p.trigger;const s=a.computed(()=>{const h=new Map;for(const p of i.nodes)h.set(p.id,p);return h}),u=a.computed(()=>{const h=new Map;for(const p of i.edges)h.set(p.id,p);return h}),c=Wu(i,s,u),d=Su(i,s,u);d.setState({...i,...n});const f={...r,...c,...d,...Gi(i),nodeLookup:s,edgeLookup:u,emits:l,id:t,vueFlowVersion:"1.48.1",$destroy:()=>{this.remove(t)}};return this.set(t,f),f}getId(){return`vue-flow-${this.currentId++}`}}function de(e){const t=Ye.getInstance(),n=a.getCurrentScope(),o=typeof e=="object",i=o?e:{id:e},r=i.id,l=r??n?.vueFlowId;let s;if(n){const u=a.inject(vi,null);typeof u<"u"&&u!==null&&(!l||u.id===l)&&(s=u)}if(s||l&&(s=t.get(l)),!s||l&&s.id!==l){const u=r??t.getId(),c=t.create(u,i);s=c,(n??a.effectScope(!0)).run(()=>{a.watch(c.applyDefault,(f,h,p)=>{const b=N=>{c.applyNodeChanges(N)},x=N=>{c.applyEdgeChanges(N)};f?(c.onNodesChange(b),c.onEdgesChange(x)):(c.hooks.value.nodesChange.off(b),c.hooks.value.edgesChange.off(x)),p(()=>{c.hooks.value.nodesChange.off(b),c.hooks.value.edgesChange.off(x)})},{immediate:!0}),et(()=>{if(s){const f=t.get(s.id);f?f.$destroy():vt(`No store instance found for id ${s.id} in storage.`)}})})}else o&&s.setState(i);if(n&&(a.provide(vi,s),n.vueFlowId=s.id),o){const u=a.getCurrentInstance();u?.type.name!=="VueFlow"&&s.emits.error(new ge(fe.USEVUEFLOW_OPTIONS))}return s}function Ku(e){const{emits:t,dimensions:n}=de();let o;a.onMounted(()=>{const i=()=>{var r,l;if(!e.value||!(((l=(r=e.value).checkVisibility)==null?void 0:l.call(r))??!0))return;const s=Yt(e.value);(s.width===0||s.height===0)&&t.error(new ge(fe.MISSING_VIEWPORT_DIMENSIONS)),n.value={width:s.width||500,height:s.height||500}};i(),window.addEventListener("resize",i),e.value&&(o=new ResizeObserver(()=>i()),o.observe(e.value)),a.onBeforeUnmount(()=>{window.removeEventListener("resize",i),o&&e.value&&o.unobserve(e.value)})})}const qu={name:"UserSelection",compatConfig:{MODE:3}},ju=a.defineComponent({...qu,props:{userSelectionRect:{}},setup(e){return(t,n)=>(a.openBlock(),a.createElementBlock("div",{class:"vue-flow__selection vue-flow__container",style:a.normalizeStyle({width:`${t.userSelectionRect.width}px`,height:`${t.userSelectionRect.height}px`,transform:`translate(${t.userSelectionRect.x}px, ${t.userSelectionRect.y}px)`})},null,4))}}),Ju=["tabIndex"],Qu={name:"NodesSelection",compatConfig:{MODE:3}},ec=a.defineComponent({...Qu,setup(e){const{emits:t,viewport:n,getSelectedNodes:o,noPanClassName:i,disableKeyboardA11y:r,userSelectionActive:l}=de(),s=Si(),u=a.ref(null),c=Ei({el:u,onStart(b){t.selectionDragStart(b),t.nodeDragStart(b)},onDrag(b){t.selectionDrag(b),t.nodeDrag(b)},onStop(b){t.selectionDragStop(b),t.nodeDragStop(b)}});a.onMounted(()=>{var b;r.value||(b=u.value)==null||b.focus({preventScroll:!0})});const d=a.computed(()=>Zo(o.value)),f=a.computed(()=>({width:`${d.value.width}px`,height:`${d.value.height}px`,top:`${d.value.y}px`,left:`${d.value.x}px`}));function h(b){t.selectionContextMenu({event:b,nodes:o.value})}function p(b){r.value||qe[b.key]&&(b.preventDefault(),s({x:qe[b.key].x,y:qe[b.key].y},b.shiftKey))}return(b,x)=>!a.unref(l)&&d.value.width&&d.value.height?(a.openBlock(),a.createElementBlock("div",{key:0,class:a.normalizeClass(["vue-flow__nodesselection vue-flow__container",a.unref(i)]),style:a.normalizeStyle({transform:`translate(${a.unref(n).x}px,${a.unref(n).y}px) scale(${a.unref(n).zoom})`})},[a.createElementVNode("div",{ref_key:"el",ref:u,class:a.normalizeClass([{dragging:a.unref(c)},"vue-flow__nodesselection-rect"]),style:a.normalizeStyle(f.value),tabIndex:a.unref(r)?void 0:-1,onContextmenu:h,onKeydown:p},null,46,Ju)],6)):a.createCommentVNode("",!0)}});function tc(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const nc={name:"Pane",compatConfig:{MODE:3}},oc=a.defineComponent({...nc,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:t,nodes:n,viewport:o,emits:i,userSelectionActive:r,removeSelectedElements:l,userSelectionRect:s,elementsSelectable:u,nodesSelectionActive:c,getSelectedEdges:d,getSelectedNodes:f,removeNodes:h,removeEdges:p,selectionMode:b,deleteKeyCode:x,multiSelectionKeyCode:N,multiSelectionActive:k,edgeLookup:M,nodeLookup:_,connectionLookup:C,defaultEdgeOptions:A,connectionStartHandle:P,panOnDrag:$}=de(),D=a.shallowRef(null),K=a.shallowRef(new Set),F=a.shallowRef(new Set),O=a.shallowRef(null),E=a.toRef(()=>u.value&&(e.isSelecting||r.value)),J=a.toRef(()=>P.value!==null);let w=!1,T=!1;const S=ht(x,{actInsideInputWithModifier:!1}),B=ht(N);a.watch(S,G=>{G&&(h(f.value),p(d.value),c.value=!1)}),a.watch(B,G=>{k.value=G});function V(G,Z){return j=>{j.target===Z&&G?.(j)}}function z(G){if(w||J.value){w=!1;return}i.paneClick(G),l(),c.value=!1}function H(G){var Z;if(Array.isArray($.value)&&((Z=$.value)!=null&&Z.includes(2))){G.preventDefault();return}i.paneContextMenu(G)}function U(G){i.paneScroll(G)}function Q(G){var Z,j,ae;if(O.value=((Z=t.value)==null?void 0:Z.getBoundingClientRect())??null,!u.value||!e.isSelecting||G.button!==0||G.target!==D.value||!O.value)return;(ae=(j=G.target)==null?void 0:j.setPointerCapture)==null||ae.call(j,G.pointerId);const{x:oe,y:le}=tc(G,O.value);T=!0,w=!1,l(),s.value={width:0,height:0,startX:oe,startY:le,x:oe,y:le},i.selectionStart(G)}function te(G){var Z;if(!O.value||!s.value)return;w=!0;const{x:j,y:ae}=Se(G,O.value),{startX:oe=0,startY:le=0}=s.value,ce={startX:oe,startY:le,x:j<oe?j:oe,y:ae<le?ae:le,width:Math.abs(j-oe),height:Math.abs(ae-le)},ee=K.value,re=F.value;K.value=new Set(Wo(n.value,ce,o.value,b.value===Sn.Partial,!0).map(g=>g.id)),F.value=new Set;const y=((Z=A.value)==null?void 0:Z.selectable)??!0;for(const g of K.value){const v=C.value.get(g);if(v)for(const{edgeId:m}of v.values()){const I=M.value.get(m);I&&(I.selectable??y)&&F.value.add(m)}}if(!yi(ee,K.value)){const g=Be(_.value,K.value,!0);i.nodesChange(g)}if(!yi(re,F.value)){const g=Be(M.value,F.value);i.edgesChange(g)}s.value=ce,r.value=!0,c.value=!1}function ie(G){var Z;G.button!==0||!T||((Z=G.target)==null||Z.releasePointerCapture(G.pointerId),!r.value&&s.value&&G.target===D.value&&z(G),r.value=!1,s.value=null,c.value=K.value.size>0,i.selectionEnd(G),e.selectionKeyPressed&&(w=!1),T=!1)}return(G,Z)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"container",ref:D,class:a.normalizeClass(["vue-flow__pane vue-flow__container",{selection:G.isSelecting}]),onClick:Z[0]||(Z[0]=j=>E.value?void 0:V(z,D.value)(j)),onContextmenu:Z[1]||(Z[1]=j=>V(H,D.value)(j)),onWheelPassive:Z[2]||(Z[2]=j=>V(U,D.value)(j)),onPointerenter:Z[3]||(Z[3]=j=>E.value?void 0:a.unref(i).paneMouseEnter(j)),onPointerdown:Z[4]||(Z[4]=j=>E.value?Q(j):a.unref(i).paneMouseMove(j)),onPointermove:Z[5]||(Z[5]=j=>E.value?te(j):a.unref(i).paneMouseMove(j)),onPointerup:Z[6]||(Z[6]=j=>E.value?ie(j):void 0),onPointerleave:Z[7]||(Z[7]=j=>a.unref(i).paneMouseLeave(j))},[a.renderSlot(G.$slots,"default"),a.unref(r)&&a.unref(s)?(a.openBlock(),a.createBlock(ju,{key:0,"user-selection-rect":a.unref(s)},null,8,["user-selection-rect"])):a.createCommentVNode("",!0),a.unref(c)&&a.unref(f).length?(a.openBlock(),a.createBlock(ec,{key:1})):a.createCommentVNode("",!0)],34))}}),ic={name:"Transform",compatConfig:{MODE:3}},rc=a.defineComponent({...ic,setup(e){const{viewport:t,fitViewOnInit:n,fitViewOnInitDone:o}=de(),i=a.computed(()=>n.value?!o.value:!1),r=a.computed(()=>`translate(${t.value.x}px,${t.value.y}px) scale(${t.value.zoom})`);return(l,s)=>(a.openBlock(),a.createElementBlock("div",{class:"vue-flow__transformationpane vue-flow__container",style:a.normalizeStyle({transform:r.value,opacity:i.value?0:void 0})},[a.renderSlot(l.$slots,"default")],4))}}),lc={name:"Viewport",compatConfig:{MODE:3}},ac=a.defineComponent({...lc,setup(e){const{minZoom:t,maxZoom:n,defaultViewport:o,translateExtent:i,zoomActivationKeyCode:r,selectionKeyCode:l,panActivationKeyCode:s,panOnScroll:u,panOnScrollMode:c,panOnScrollSpeed:d,panOnDrag:f,zoomOnDoubleClick:h,zoomOnPinch:p,zoomOnScroll:b,preventScrolling:x,noWheelClassName:N,noPanClassName:k,emits:M,connectionStartHandle:_,userSelectionActive:C,paneDragging:A,d3Zoom:P,d3Selection:$,d3ZoomHandler:D,viewport:K,viewportRef:F,paneClickDistance:O}=de();Ku(F);const E=a.shallowRef(!1),J=a.shallowRef(!1);let w=null,T=!1,S=0,B={x:0,y:0,zoom:0};const V=ht(s),z=ht(l),H=ht(r),U=a.toRef(()=>(!z.value||z.value&&l.value===!0)&&(V.value||f.value)),Q=a.toRef(()=>V.value||u.value),te=a.toRef(()=>z.value||l.value===!0&&U.value!==!0),ie=a.toRef(()=>_.value!==null);a.onMounted(()=>{if(!F.value){vt("Viewport element is missing");return}const oe=F.value,le=oe.getBoundingClientRect(),ce=Ms().clickDistance(O.value).scaleExtent([t.value,n.value]).translateExtent(i.value),ee=ye(oe).call(ce),re=ee.on("wheel.zoom"),y=Ke.translate(o.value.x??0,o.value.y??0).scale(Le(o.value.zoom??1,t.value,n.value)),g=[[0,0],[le.width,le.height]],v=ce.constrain()(y,g,i.value);ce.transform(ee,v),ce.wheelDelta(Jo),P.value=ce,$.value=ee,D.value=re,K.value={x:v.x,y:v.y,zoom:v.k},ce.on("start",m=>{var I;if(!m.sourceEvent)return null;S=m.sourceEvent.button,E.value=!0;const X=j(m.transform);((I=m.sourceEvent)==null?void 0:I.type)==="mousedown"&&(A.value=!0),B=X,M.viewportChangeStart(X),M.moveStart({event:m,flowTransform:X})}),ce.on("end",m=>{if(!m.sourceEvent)return null;if(E.value=!1,A.value=!1,G(U.value,S??0)&&!T&&M.paneContextMenu(m.sourceEvent),T=!1,Z(B,m.transform)){const I=j(m.transform);B=I,M.viewportChangeEnd(I),M.moveEnd({event:m,flowTransform:I})}}),ce.filter(m=>{var I;const X=H.value||b.value,W=p.value&&m.ctrlKey,Y=m.button,q=m.type==="wheel";if(Y===1&&m.type==="mousedown"&&(ae(m,"vue-flow__node")||ae(m,"vue-flow__edge")))return!0;if(!U.value&&!X&&!Q.value&&!h.value&&!p.value||C.value||ie.value&&!q||!h.value&&m.type==="dblclick"||ae(m,N.value)&&q||ae(m,k.value)&&(!q||Q.value&&q&&!H.value)||!p.value&&m.ctrlKey&&q||!X&&!Q.value&&!W&&q)return!1;if(!p&&m.type==="touchstart"&&((I=m.touches)==null?void 0:I.length)>1)return m.preventDefault(),!1;if(!U.value&&(m.type==="mousedown"||m.type==="touchstart")||l.value===!0&&Array.isArray(f.value)&&f.value.includes(0)&&Y===0||Array.isArray(f.value)&&!f.value.includes(Y)&&(m.type==="mousedown"||m.type==="touchstart"))return!1;const ne=Array.isArray(f.value)&&f.value.includes(Y)||l.value===!0&&Array.isArray(f.value)&&!f.value.includes(0)||!Y||Y<=1;return(!m.ctrlKey||V.value||q)&&ne}),a.watch([C,U],()=>{C.value&&!E.value?ce.on("zoom",null):C.value||ce.on("zoom",m=>{K.value={x:m.transform.x,y:m.transform.y,zoom:m.transform.k};const I=j(m.transform);T=G(U.value,S??0),M.viewportChange(I),M.move({event:m,flowTransform:I})})},{immediate:!0}),a.watch([C,Q,c,H,p,x,N],()=>{Q.value&&!H.value&&!C.value?ee.on("wheel.zoom",m=>{if(ae(m,N.value))return!1;const I=H.value||b.value,X=p.value&&m.ctrlKey;if(!(!x.value||Q.value||I||X))return!1;m.preventDefault(),m.stopImmediatePropagation();const Y=ee.property("__zoom").k||1,q=Xt();if(!V.value&&m.ctrlKey&&p.value&&q){const wt=_e(m),jc=Jo(m),Jc=Y*2**jc;ce.scaleTo(ee,Jc,wt,m);return}const ne=m.deltaMode===1?20:1;let se=c.value===ft.Vertical?0:m.deltaX*ne,ue=c.value===ft.Horizontal?0:m.deltaY*ne;!q&&m.shiftKey&&c.value!==ft.Vertical&&!se&&ue&&(se=ue,ue=0),ce.translateBy(ee,-(se/Y)*d.value,-(ue/Y)*d.value);const Ne=j(ee.property("__zoom"));w&&clearTimeout(w),J.value?(M.move({event:m,flowTransform:Ne}),M.viewportChange(Ne),w=setTimeout(()=>{M.moveEnd({event:m,flowTransform:Ne}),M.viewportChangeEnd(Ne),J.value=!1},150)):(J.value=!0,M.moveStart({event:m,flowTransform:Ne}),M.viewportChangeStart(Ne))},{passive:!1}):typeof re<"u"&&ee.on("wheel.zoom",function(m,I){const X=!x.value&&m.type==="wheel"&&!m.ctrlKey,W=H.value||b.value,Y=p.value&&m.ctrlKey;if(!W&&!u.value&&!Y&&m.type==="wheel"||X||ae(m,N.value))return null;m.preventDefault(),re.call(this,m,I)},{passive:!1})},{immediate:!0})});function G(oe,le){return le===2&&Array.isArray(oe)&&oe.includes(2)}function Z(oe,le){return oe.x!==le.x&&!Number.isNaN(le.x)||oe.y!==le.y&&!Number.isNaN(le.y)||oe.zoom!==le.k&&!Number.isNaN(le.k)}function j(oe){return{x:oe.x,y:oe.y,zoom:oe.k}}function ae(oe,le){return oe.target.closest(`.${le}`)}return(oe,le)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"viewportRef",ref:F,class:"vue-flow__viewport vue-flow__container"},[a.createVNode(oc,{"is-selecting":te.value,"selection-key-pressed":a.unref(z),class:a.normalizeClass({connecting:ie.value,dragging:a.unref(A),draggable:a.unref(f)===!0||Array.isArray(a.unref(f))&&a.unref(f).includes(0)})},{default:a.withCtx(()=>[a.createVNode(rc,null,{default:a.withCtx(()=>[a.renderSlot(oe.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),sc=["id"],uc=["id"],cc=["id"],dc={name:"A11yDescriptions",compatConfig:{MODE:3}},fc=a.defineComponent({...dc,setup(e){const{id:t,disableKeyboardA11y:n,ariaLiveMessage:o}=de();return(i,r)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("div",{id:`${a.unref(zo)}-${a.unref(t)}`,style:{display:"none"}}," Press enter or space to select a node. "+a.toDisplayString(a.unref(n)?"":"You can then use the arrow keys to move the node around.")+" You can then use the arrow keys to move the node around, press delete to remove it and press escape to cancel. ",9,sc),a.createElementVNode("div",{id:`${a.unref(Ro)}-${a.unref(t)}`,style:{display:"none"}}," Press enter or space to select an edge. You can then press delete to remove it or press escape to cancel. ",8,uc),a.unref(n)?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("div",{key:0,id:`${a.unref(Bs)}-${a.unref(t)}`,"aria-live":"assertive","aria-atomic":"true",style:{position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)","clip-path":"inset(100%)"}},a.toDisplayString(a.unref(o)),9,cc))],64))}});function hc(){const e=de();a.watch(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function gc(e,t,n){return n===R.Left?e-t:n===R.Right?e+t:e}function pc(e,t,n){return n===R.Top?e-t:n===R.Bottom?e+t:e}const Rn=function({radius:e=10,centerX:t=0,centerY:n=0,position:o=R.Top,type:i}){return a.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${i}`,cx:gc(t,e,o),cy:pc(n,e,o),r:e,stroke:"transparent",fill:"transparent"})};Rn.props=["radius","centerX","centerY","position","type"],Rn.compatConfig={MODE:3};const Bi=Rn,mc=a.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:t,addSelectedEdges:n,connectionMode:o,edgeUpdaterRadius:i,emits:r,nodesSelectionActive:l,noPanClassName:s,getEdgeTypes:u,removeSelectedEdges:c,findEdge:d,findNode:f,isValidConnection:h,multiSelectionActive:p,disableKeyboardA11y:b,elementsSelectable:x,edgesUpdatable:N,edgesFocusable:k,hooks:M}=de(),_=a.computed(()=>d(e.id)),{emit:C,on:A}=du(_.value,r),P=a.inject(Zt),$=a.getCurrentInstance(),D=a.ref(!1),K=a.ref(!1),F=a.ref(""),O=a.ref(null),E=a.ref("source"),J=a.ref(null),w=a.toRef(()=>typeof _.value.selectable>"u"?x.value:_.value.selectable),T=a.toRef(()=>typeof _.value.updatable>"u"?N.value:_.value.updatable),S=a.toRef(()=>typeof _.value.focusable>"u"?k.value:_.value.focusable);a.provide(su,e.id),a.provide(uu,J);const B=a.computed(()=>_.value.class instanceof Function?_.value.class(_.value):_.value.class),V=a.computed(()=>_.value.style instanceof Function?_.value.style(_.value):_.value.style),z=a.computed(()=>{const g=_.value.type||"default",v=P?.[`edge-${g}`];if(v)return v;let m=_.value.template??u.value[g];if(typeof m=="string"&&$){const I=Object.keys($.appContext.components);I&&I.includes(g)&&(m=a.resolveComponent(g,!1))}return m&&typeof m!="string"?m:(r.error(new ge(fe.EDGE_TYPE_MISSING,m)),!1)}),{handlePointerDown:H}=bi({nodeId:F,handleId:O,type:E,isValidConnection:h,edgeUpdaterType:E,onEdgeUpdate:te,onEdgeUpdateEnd:ie});return()=>{const g=f(_.value.source),v=f(_.value.target),m="pathOptions"in _.value?_.value.pathOptions:{};if(!g&&!v)return r.error(new ge(fe.EDGE_SOURCE_TARGET_MISSING,_.value.id,_.value.source,_.value.target)),null;if(!g)return r.error(new ge(fe.EDGE_SOURCE_MISSING,_.value.id,_.value.source)),null;if(!v)return r.error(new ge(fe.EDGE_TARGET_MISSING,_.value.id,_.value.target)),null;if(!_.value||_.value.hidden||g.hidden||v.hidden)return null;let I;o.value===Te.Strict?I=g.handleBounds.source:I=[...g.handleBounds.source||[],...g.handleBounds.target||[]];const X=si(I,_.value.sourceHandle);let W;o.value===Te.Strict?W=v.handleBounds.target:W=[...v.handleBounds.target||[],...v.handleBounds.source||[]];const Y=si(W,_.value.targetHandle),q=X?.position||R.Bottom,ne=Y?.position||R.Top,{x:se,y:ue}=Je(g,X,q),{x:Ne,y:wt}=Je(v,Y,ne);return _.value.sourceX=se,_.value.sourceY=ue,_.value.targetX=Ne,_.value.targetY=wt,a.h("g",{ref:J,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${z.value===!1?"default":_.value.type||"default"}`,s.value,B.value,{updating:D.value,selected:_.value.selected,animated:_.value.animated,inactive:!w.value&&!M.value.edgeClick.hasListeners()}],tabIndex:S.value?0:void 0,"aria-label":_.value.ariaLabel===null?void 0:_.value.ariaLabel??`Edge from ${_.value.source} to ${_.value.target}`,"aria-describedby":S.value?`${Ro}-${t}`:void 0,"aria-roledescription":"edge",role:S.value?"group":"img",..._.value.domAttributes,onClick:Z,onContextmenu:j,onDblclick:ae,onMouseenter:oe,onMousemove:le,onMouseleave:ce,onKeyDown:S.value?y:void 0},[K.value?null:a.h(z.value===!1?u.value.default:z.value,{id:e.id,sourceNode:g,targetNode:v,source:_.value.source,target:_.value.target,type:_.value.type,updatable:T.value,selected:_.value.selected,animated:_.value.animated,label:_.value.label,labelStyle:_.value.labelStyle,labelShowBg:_.value.labelShowBg,labelBgStyle:_.value.labelBgStyle,labelBgPadding:_.value.labelBgPadding,labelBgBorderRadius:_.value.labelBgBorderRadius,data:_.value.data,events:{..._.value.events,...A},style:V.value,markerStart:`url('#${yt(_.value.markerStart,t)}')`,markerEnd:`url('#${yt(_.value.markerEnd,t)}')`,sourcePosition:q,targetPosition:ne,sourceX:se,sourceY:ue,targetX:Ne,targetY:wt,sourceHandleId:_.value.sourceHandle,targetHandleId:_.value.targetHandle,interactionWidth:_.value.interactionWidth,...m}),[T.value==="source"||T.value===!0?[a.h("g",{onMousedown:ee,onMouseenter:U,onMouseout:Q},a.h(Bi,{position:q,centerX:se,centerY:ue,radius:i.value,type:"source","data-type":"source"}))]:null,T.value==="target"||T.value===!0?[a.h("g",{onMousedown:re,onMouseenter:U,onMouseout:Q},a.h(Bi,{position:ne,centerX:Ne,centerY:wt,radius:i.value,type:"target","data-type":"target"}))]:null]])};function U(){D.value=!0}function Q(){D.value=!1}function te(g,v){C.update({event:g,edge:_.value,connection:v})}function ie(g){C.updateEnd({event:g,edge:_.value}),K.value=!1}function G(g,v){g.button===0&&(K.value=!0,F.value=v?_.value.target:_.value.source,O.value=(v?_.value.targetHandle:_.value.sourceHandle)??null,E.value=v?"target":"source",C.updateStart({event:g,edge:_.value}),H(g))}function Z(g){var v;const m={event:g,edge:_.value};w.value&&(l.value=!1,_.value.selected&&p.value?(c([_.value]),(v=J.value)==null||v.blur()):n([_.value])),C.click(m)}function j(g){C.contextMenu({event:g,edge:_.value})}function ae(g){C.doubleClick({event:g,edge:_.value})}function oe(g){C.mouseEnter({event:g,edge:_.value})}function le(g){C.mouseMove({event:g,edge:_.value})}function ce(g){C.mouseLeave({event:g,edge:_.value})}function ee(g){G(g,!0)}function re(g){G(g,!1)}function y(g){var v;!b.value&&Ho.includes(g.key)&&w.value&&(g.key==="Escape"?((v=J.value)==null||v.blur(),c([d(e.id)])):n([d(e.id)]))}}}),yc=a.defineComponent({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:t,connectionMode:n,connectionStartHandle:o,connectionEndHandle:i,connectionPosition:r,connectionLineType:l,connectionLineStyle:s,connectionLineOptions:u,connectionStatus:c,viewport:d,findNode:f}=de(),h=(e=a.inject(Zt))==null?void 0:e["connection-line"],p=a.computed(()=>{var M;return f((M=o.value)==null?void 0:M.nodeId)}),b=a.computed(()=>{var M;return f((M=i.value)==null?void 0:M.nodeId)??null}),x=a.computed(()=>({x:(r.value.x-d.value.x)/d.value.zoom,y:(r.value.y-d.value.y)/d.value.zoom})),N=a.computed(()=>u.value.markerStart?`url(#${yt(u.value.markerStart,t)})`:""),k=a.computed(()=>u.value.markerEnd?`url(#${yt(u.value.markerEnd,t)})`:"");return()=>{var M,_,C;if(!p.value||!o.value)return null;const A=o.value.id,P=o.value.type,$=p.value.handleBounds;let D=$?.[P]??[];if(n.value===Te.Loose){const V=$?.[P==="source"?"target":"source"]??[];D=[...D,...V]}if(!D)return null;const K=(A?D.find(V=>V.id===A):D[0])??null,F=K?.position??R.Top,{x:O,y:E}=Je(p.value,K,F);let J=null;b.value&&(n.value===Te.Strict?J=((M=b.value.handleBounds[P==="source"?"target":"source"])==null?void 0:M.find(V=>{var z;return V.id===((z=i.value)==null?void 0:z.id)}))||null:J=((_=[...b.value.handleBounds.source??[],...b.value.handleBounds.target??[]])==null?void 0:_.find(V=>{var z;return V.id===((z=i.value)==null?void 0:z.id)}))||null);const w=((C=i.value)==null?void 0:C.position)??(F?$n[F]:null);if(!F||!w)return null;const T=l.value??u.value.type??He.Bezier;let S="";const B={sourceX:O,sourceY:E,sourcePosition:F,targetX:x.value.x,targetY:x.value.y,targetPosition:w};return T===He.Bezier?[S]=On(B):T===He.Step?[S]=zn({...B,borderRadius:0}):T===He.SmoothStep?[S]=zn(B):T===He.SimpleBezier?[S]=Pi(B):S=`M${O},${E} ${x.value.x},${x.value.y}`,a.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},a.h("g",{class:"vue-flow__connection"},h?a.h(h,{sourceX:O,sourceY:E,sourcePosition:F,targetX:x.value.x,targetY:x.value.y,targetPosition:w,sourceNode:p.value,sourceHandle:K,targetNode:b.value,targetHandle:J,markerEnd:k.value,markerStart:N.value,connectionStatus:c.value}):a.h("path",{d:S,class:[u.value.class,c.value,"vue-flow__connection-path"],style:{...s.value,...u.value.style},"marker-end":k.value,"marker-start":N.value})))}}}),vc=["id","markerWidth","markerHeight","markerUnits","orient"],wc={name:"MarkerType",compatConfig:{MODE:3}},_c=a.defineComponent({...wc,props:{id:{},type:{},color:{default:"none"},width:{default:12.5},height:{default:12.5},markerUnits:{default:"strokeWidth"},orient:{default:"auto-start-reverse"},strokeWidth:{default:1}},setup(e){return(t,n)=>(a.openBlock(),a.createElementBlock("marker",{id:t.id,class:"vue-flow__arrowhead",viewBox:"-10 -10 20 20",refX:"0",refY:"0",markerWidth:`${t.width}`,markerHeight:`${t.height}`,markerUnits:t.markerUnits,orient:t.orient},[t.type===a.unref(Nn).ArrowClosed?(a.openBlock(),a.createElementBlock("polyline",{key:0,style:a.normalizeStyle({stroke:t.color,fill:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",points:"-5,-4 0,0 -5,4 -5,-4"},null,4)):a.createCommentVNode("",!0),t.type===a.unref(Nn).Arrow?(a.openBlock(),a.createElementBlock("polyline",{key:1,style:a.normalizeStyle({stroke:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):a.createCommentVNode("",!0)],8,vc))}}),Ec={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},bc={name:"MarkerDefinitions",compatConfig:{MODE:3}},xc=a.defineComponent({...bc,setup(e){const{id:t,edges:n,connectionLineOptions:o,defaultMarkerColor:i}=de(),r=a.computed(()=>{const l=new Set,s=[],u=c=>{if(c){const d=yt(c,t);l.has(d)||(typeof c=="object"?s.push({...c,id:d,color:c.color||i.value}):s.push({id:d,color:i.value,type:c}),l.add(d))}};for(const c of[o.value.markerEnd,o.value.markerStart])u(c);for(const c of n.value)for(const d of[c.markerStart,c.markerEnd])u(d);return s.sort((c,d)=>c.id.localeCompare(d.id))});return(l,s)=>(a.openBlock(),a.createElementBlock("svg",Ec,[a.createElementVNode("defs",null,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(r.value,u=>(a.openBlock(),a.createBlock(_c,{id:u.id,key:u.id,type:u.type,color:u.color,width:u.width,height:u.height,markerUnits:u.markerUnits,"stroke-width":u.strokeWidth,orient:u.orient},null,8,["id","type","color","width","height","markerUnits","stroke-width","orient"]))),128))])]))}}),Sc={name:"Edges",compatConfig:{MODE:3}},Nc=a.defineComponent({...Sc,setup(e){const{findNode:t,getEdges:n,elevateEdgesOnSelect:o}=de();return(i,r)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createVNode(xc),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(n),l=>(a.openBlock(),a.createElementBlock("svg",{key:l.id,class:"vue-flow__edges vue-flow__container",style:a.normalizeStyle({zIndex:a.unref(qs)(l,a.unref(t),a.unref(o))})},[a.createVNode(a.unref(mc),{id:l.id},null,8,["id"])],4))),128)),a.createVNode(a.unref(yc))],64))}}),Cc=a.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:t,noPanClassName:n,selectNodesOnDrag:o,nodesSelectionActive:i,multiSelectionActive:r,emits:l,removeSelectedNodes:s,addSelectedNodes:u,updateNodeDimensions:c,onUpdateNodeInternals:d,getNodeTypes:f,nodeExtent:h,elevateNodesOnSelect:p,disableKeyboardA11y:b,ariaLiveMessage:x,snapToGrid:N,snapGrid:k,nodeDragThreshold:M,nodesDraggable:_,elementsSelectable:C,nodesConnectable:A,nodesFocusable:P,hooks:$}=de(),D=a.ref(null);a.provide(_i,D),a.provide(wi,e.id);const K=a.inject(Zt),F=a.getCurrentInstance(),O=Si(),{node:E,parentNode:J}=xi(e.id),{emit:w,on:T}=pu(E,l),S=a.toRef(()=>typeof E.draggable>"u"?_.value:E.draggable),B=a.toRef(()=>typeof E.selectable>"u"?C.value:E.selectable),V=a.toRef(()=>typeof E.connectable>"u"?A.value:E.connectable),z=a.toRef(()=>typeof E.focusable>"u"?P.value:E.focusable),H=a.computed(()=>B.value||S.value||$.value.nodeClick.hasListeners()||$.value.nodeDoubleClick.hasListeners()||$.value.nodeMouseEnter.hasListeners()||$.value.nodeMouseMove.hasListeners()||$.value.nodeMouseLeave.hasListeners()),U=a.toRef(()=>!!E.dimensions.width&&!!E.dimensions.height),Q=a.computed(()=>{const v=E.type||"default",m=K?.[`node-${v}`];if(m)return m;let I=E.template||f.value[v];if(typeof I=="string"&&F){const X=Object.keys(F.appContext.components);X&&X.includes(v)&&(I=a.resolveComponent(v,!1))}return I&&typeof I!="string"?I:(l.error(new ge(fe.NODE_TYPE_MISSING,I)),!1)}),te=Ei({id:e.id,el:D,disabled:()=>!S.value,selectable:B,dragHandle:()=>E.dragHandle,onStart(v){w.dragStart(v)},onDrag(v){w.drag(v)},onStop(v){w.dragStop(v)},onClick(v){y(v)}}),ie=a.computed(()=>E.class instanceof Function?E.class(E):E.class),G=a.computed(()=>{const v=(E.style instanceof Function?E.style(E):E.style)||{},m=E.width instanceof Function?E.width(E):E.width,I=E.height instanceof Function?E.height(E):E.height;return!v.width&&m&&(v.width=typeof m=="string"?m:`${m}px`),!v.height&&I&&(v.height=typeof I=="string"?I:`${I}px`),v}),Z=a.toRef(()=>Number(E.zIndex??G.value.zIndex??0));return d(v=>{(v.includes(e.id)||!v.length)&&ae()}),a.onMounted(()=>{a.watch(()=>E.hidden,(v=!1,m,I)=>{!v&&D.value&&(e.resizeObserver.observe(D.value),I(()=>{D.value&&e.resizeObserver.unobserve(D.value)}))},{immediate:!0,flush:"post"})}),a.watch([()=>E.type,()=>E.sourcePosition,()=>E.targetPosition],()=>{a.nextTick(()=>{c([{id:e.id,nodeElement:D.value,forceUpdate:!0}])})}),a.watch([()=>E.position.x,()=>E.position.y,()=>{var v;return(v=J.value)==null?void 0:v.computedPosition.x},()=>{var v;return(v=J.value)==null?void 0:v.computedPosition.y},()=>{var v;return(v=J.value)==null?void 0:v.computedPosition.z},Z,()=>E.selected,()=>E.dimensions.height,()=>E.dimensions.width,()=>{var v;return(v=J.value)==null?void 0:v.dimensions.height},()=>{var v;return(v=J.value)==null?void 0:v.dimensions.width}],([v,m,I,X,W,Y])=>{const q={x:v,y:m,z:Y+(p.value&&E.selected?1e3:0)};typeof I<"u"&&typeof X<"u"?E.computedPosition=Gs({x:I,y:X,z:W},q):E.computedPosition=q},{flush:"post",immediate:!0}),a.watch([()=>E.extent,h],([v,m],[I,X])=>{(v!==I||m!==X)&&j()}),E.extent==="parent"||typeof E.extent=="object"&&"range"in E.extent&&E.extent.range==="parent"?nn(()=>U).toBe(!0).then(j):j(),()=>E.hidden?null:a.h("div",{ref:D,"data-id":E.id,class:["vue-flow__node",`vue-flow__node-${Q.value===!1?"default":E.type||"default"}`,{[n.value]:S.value,dragging:te?.value,draggable:S.value,selected:E.selected,selectable:B.value,parent:E.isParent},ie.value],style:{visibility:U.value?"visible":"hidden",zIndex:E.computedPosition.z??Z.value,transform:`translate(${E.computedPosition.x}px,${E.computedPosition.y}px)`,pointerEvents:H.value?"all":"none",...G.value},tabIndex:z.value?0:void 0,role:z.value?"group":void 0,"aria-describedby":b.value?void 0:`${zo}-${t}`,"aria-label":E.ariaLabel,"aria-roledescription":"node",...E.domAttributes,onMouseenter:oe,onMousemove:le,onMouseleave:ce,onContextmenu:ee,onClick:y,onDblclick:re,onKeydown:g},[a.h(Q.value===!1?f.value.default:Q.value,{id:E.id,type:E.type,data:E.data,events:{...E.events,...T},selected:E.selected,resizing:E.resizing,dragging:te.value,connectable:V.value,position:E.computedPosition,dimensions:E.dimensions,isValidTargetPos:E.isValidTargetPos,isValidSourcePos:E.isValidSourcePos,parent:E.parentNode,parentNodeId:E.parentNode,zIndex:E.computedPosition.z??Z.value,targetPosition:E.targetPosition,sourcePosition:E.sourcePosition,label:E.label,dragHandle:E.dragHandle,onUpdateNodeInternals:ae})]);function j(){const v=E.computedPosition,{computedPosition:m,position:I}=In(E,N.value?Ut(v,k.value):v,l.error,h.value,J.value);(E.computedPosition.x!==m.x||E.computedPosition.y!==m.y)&&(E.computedPosition={...E.computedPosition,...m}),(E.position.x!==I.x||E.position.y!==I.y)&&(E.position=I)}function ae(){D.value&&c([{id:e.id,nodeElement:D.value,forceUpdate:!0}])}function oe(v){te?.value||w.mouseEnter({event:v,node:E})}function le(v){te?.value||w.mouseMove({event:v,node:E})}function ce(v){te?.value||w.mouseLeave({event:v,node:E})}function ee(v){return w.contextMenu({event:v,node:E})}function re(v){return w.doubleClick({event:v,node:E})}function y(v){B.value&&(!o.value||!S.value||M.value>0)&&Dn(E,r.value,u,s,i,!1,D.value),w.click({event:v,node:E})}function g(v){if(!(Cn(v)||b.value))if(Ho.includes(v.key)&&B.value){const m=v.key==="Escape";Dn(E,r.value,u,s,i,m,D.value)}else S.value&&E.selected&&qe[v.key]&&(v.preventDefault(),x.value=`Moved selected node ${v.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~E.position.x}, y: ${~~E.position.y}`,O({x:qe[v.key].x,y:qe[v.key].y},v.shiftKey))}}}),kc={height:"0",width:"0"},Mc={name:"EdgeLabelRenderer",compatConfig:{MODE:3}},Ic=a.defineComponent({...Mc,setup(e){const{viewportRef:t}=de(),n=a.toRef(()=>{var o;return(o=t.value)==null?void 0:o.getElementsByClassName("vue-flow__edge-labels")[0]});return(o,i)=>(a.openBlock(),a.createElementBlock("svg",null,[(a.openBlock(),a.createElementBlock("foreignObject",kc,[(a.openBlock(),a.createBlock(a.Teleport,{to:n.value,disabled:!n.value},[a.renderSlot(o.$slots,"default")],8,["to","disabled"]))]))]))}});function Pc(e={includeHiddenNodes:!1}){const{nodes:t}=de();return a.computed(()=>{if(t.value.length===0)return!1;for(const n of t.value)if((e.includeHiddenNodes||!n.hidden)&&(n?.handleBounds===void 0||n.dimensions.width===0||n.dimensions.height===0))return!1;return!0})}const Tc={class:"vue-flow__nodes vue-flow__container"},$c={name:"Nodes",compatConfig:{MODE:3}},Dc=a.defineComponent({...$c,setup(e){const{getNodes:t,updateNodeDimensions:n,emits:o}=de(),i=Pc(),r=a.ref();return a.watch(i,l=>{l&&a.nextTick(()=>{o.nodesInitialized(t.value)})},{immediate:!0}),a.onMounted(()=>{r.value=new ResizeObserver(l=>{const s=l.map(u=>({id:u.target.getAttribute("data-id"),nodeElement:u.target,forceUpdate:!0}));a.nextTick(()=>n(s))})}),a.onBeforeUnmount(()=>{var l;return(l=r.value)==null?void 0:l.disconnect()}),(l,s)=>(a.openBlock(),a.createElementBlock("div",Tc,[r.value?(a.openBlock(!0),a.createElementBlock(a.Fragment,{key:0},a.renderList(a.unref(t),(u,c,d,f)=>{const h=[u.id];if(f&&f.key===u.id&&a.isMemoSame(f,h))return f;const p=(a.openBlock(),a.createBlock(a.unref(Cc),{id:u.id,key:u.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return p.memo=h,p},s,0),128)):a.createCommentVNode("",!0)]))}});function Bc(){const{emits:e}=de();a.onMounted(()=>{if(hi()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new ge(fe.MISSING_STYLES))}})}const Vc=a.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),Ac={name:"VueFlow",compatConfig:{MODE:3}},Oc=a.defineComponent({...Ac,props:{id:{},modelValue:{},nodes:{},edges:{},edgeTypes:{},nodeTypes:{},connectionMode:{},connectionLineType:{},connectionLineStyle:{default:void 0},connectionLineOptions:{default:void 0},connectionRadius:{},isValidConnection:{type:[Function,null],default:void 0},deleteKeyCode:{default:void 0},selectionKeyCode:{type:[Boolean,null],default:void 0},multiSelectionKeyCode:{default:void 0},zoomActivationKeyCode:{default:void 0},panActivationKeyCode:{default:void 0},snapToGrid:{type:Boolean,default:void 0},snapGrid:{},onlyRenderVisibleElements:{type:Boolean,default:void 0},edgesUpdatable:{type:[Boolean,String],default:void 0},nodesDraggable:{type:Boolean,default:void 0},nodesConnectable:{type:Boolean,default:void 0},nodeDragThreshold:{},elementsSelectable:{type:Boolean,default:void 0},selectNodesOnDrag:{type:Boolean,default:void 0},panOnDrag:{type:[Boolean,Array],default:void 0},minZoom:{},maxZoom:{},defaultViewport:{},translateExtent:{},nodeExtent:{},defaultMarkerColor:{},zoomOnScroll:{type:Boolean,default:void 0},zoomOnPinch:{type:Boolean,default:void 0},panOnScroll:{type:Boolean,default:void 0},panOnScrollSpeed:{},panOnScrollMode:{},paneClickDistance:{},zoomOnDoubleClick:{type:Boolean,default:void 0},preventScrolling:{type:Boolean,default:void 0},selectionMode:{},edgeUpdaterRadius:{},fitViewOnInit:{type:Boolean,default:void 0},connectOnClick:{type:Boolean,default:void 0},applyDefault:{type:Boolean,default:void 0},autoConnect:{type:[Boolean,Function],default:void 0},noDragClassName:{},noWheelClassName:{},noPanClassName:{},defaultEdgeOptions:{},elevateEdgesOnSelect:{type:Boolean,default:void 0},elevateNodesOnSelect:{type:Boolean,default:void 0},disableKeyboardA11y:{type:Boolean,default:void 0},edgesFocusable:{type:Boolean,default:void 0},nodesFocusable:{type:Boolean,default:void 0},autoPanOnConnect:{type:Boolean,default:void 0},autoPanOnNodeDrag:{type:Boolean,default:void 0},autoPanSpeed:{}},emits:["nodesChange","edgesChange","nodesInitialized","paneReady","init","updateNodeInternals","error","connect","connectStart","connectEnd","clickConnectStart","clickConnectEnd","moveStart","move","moveEnd","selectionDragStart","selectionDrag","selectionDragStop","selectionContextMenu","selectionStart","selectionEnd","viewportChangeStart","viewportChange","viewportChangeEnd","paneScroll","paneClick","paneContextMenu","paneMouseEnter","paneMouseMove","paneMouseLeave","edgeUpdate","edgeContextMenu","edgeMouseEnter","edgeMouseMove","edgeMouseLeave","edgeDoubleClick","edgeClick","edgeUpdateStart","edgeUpdateEnd","nodeContextMenu","nodeMouseEnter","nodeMouseMove","nodeMouseLeave","nodeDoubleClick","nodeClick","nodeDragStart","nodeDrag","nodeDragStop","miniMapNodeClick","miniMapNodeDoubleClick","miniMapNodeMouseEnter","miniMapNodeMouseMove","miniMapNodeMouseLeave","update:modelValue","update:nodes","update:edges"],setup(e,{expose:t,emit:n}){const o=e,i=a.useSlots(),r=on(o,"modelValue",n),l=on(o,"nodes",n),s=on(o,"edges",n),u=de(o),c=wu({modelValue:r,nodes:l,edges:s},o,u);return Eu(n,u.hooks),hc(),Bc(),a.provide(Zt,i),a.onUnmounted(c),t(u),(d,f)=>(a.openBlock(),a.createElementBlock("div",{ref:a.unref(u).vueFlowRef,class:"vue-flow"},[a.createVNode(ac,null,{default:a.withCtx(()=>[a.createVNode(Nc),Vc,a.createVNode(Dc),a.renderSlot(d.$slots,"zoom-pane")]),_:3}),a.renderSlot(d.$slots,"default"),a.createVNode(fc)],512))}}),zc=["id","d","marker-end"],Rc={class:"vue-flow__edge-label"},Hc={key:0,class:"label-input-wrapper"},Lc={inheritAttrs:!1},Fc=a.defineComponent({...Lc,__name:"EditableEdge",props:{id:{},sourceNode:{},targetNode:{},source:{},target:{},type:{},label:{type:[String,Object,Function]},style:{},selected:{type:Boolean},sourcePosition:{},targetPosition:{},sourceHandleId:{},targetHandleId:{},animated:{type:Boolean},updatable:{type:Boolean},markerStart:{},markerEnd:{},curvature:{},interactionWidth:{},data:{},events:{},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{},sourceX:{},sourceY:{},targetX:{},targetY:{}},emits:["change"],setup(e,{emit:t}){const n=e,o=t,i=a.useTemplateRef("labelInput"),r=a.ref(""),l=a.ref(!1);let s=0;const u=async()=>{let h=Date.now();h-s<500&&!l.value&&await c(),s=h},c=async()=>{r.value=n.label,l.value=!0,await a.nextTick(),i.value.focus()},d=()=>{l.value=!1,o("change",r.value)},f=a.computed(()=>On(n));return(h,p)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("path",{id:e.id,style:a.normalizeStyle(e.style),class:"vue-flow__edge-path",d:f.value[0],"marker-end":e.markerEnd},null,12,zc),a.createVNode(a.unref(Ic),null,{default:a.withCtx(()=>[a.createElementVNode("div",{style:a.normalizeStyle({pointerEvents:"all",position:"absolute",transform:`translate(-50%, -50%) translate(${f.value[1]}px,${f.value[2]}px)`}),class:"nodrag nopan editable-edge-label",onClick:p[2]||(p[2]=b=>u())},[a.createElementVNode("div",Rc,a.toDisplayString(e.label),1),l.value?(a.openBlock(),a.createElementBlock("div",Hc,[a.withDirectives(a.createElementVNode("input",{ref:"labelInput","onUpdate:modelValue":p[0]||(p[0]=b=>r.value=b),class:"label-input",onBlur:p[1]||(p[1]=b=>l.value=!1),onKeypress:a.withKeys(d,["enter"])},null,544),[[a.vModelText,r.value]])])):a.createCommentVNode("",!0)],4)]),_:1})],64))}}),Yc={key:0,class:"label-input-wrapper"},Gc=a.defineComponent({__name:"EditableNode",props:{id:{},type:{},selected:{type:Boolean},connectable:{type:[Boolean,Number,String,Function]},position:{},dimensions:{},label:{},isValidTargetPos:{type:Function},isValidSourcePos:{type:Function},parent:{},parentNodeId:{},dragging:{type:Boolean},resizing:{type:Boolean},zIndex:{},targetPosition:{},sourcePosition:{},dragHandle:{},data:{},events:{}},emits:["change"],setup(e,{emit:t}){const n=e,o=t,i=a.useTemplateRef("labelInput"),r=a.ref(""),l=a.ref(!1);let s=0;const u=async()=>{let f=Date.now();f-s<500&&!l.value&&await c(),s=f},c=async()=>{r.value=n.label,l.value=!0,await a.nextTick(),i.value.focus()},d=()=>{l.value=!1,o("change",r.value)};return(f,h)=>(a.openBlock(),a.createElementBlock("div",{onClick:h[2]||(h[2]=p=>u())},[a.createElementVNode("div",null,a.toDisplayString(e.label),1),l.value?(a.openBlock(),a.createElementBlock("div",Yc,[a.withDirectives(a.createElementVNode("input",{ref:"labelInput","onUpdate:modelValue":h[0]||(h[0]=p=>r.value=p),class:"label-input",onBlur:h[1]||(h[1]=p=>l.value=!1),onKeypress:a.withKeys(d,["enter"])},null,544),[[a.vModelText,r.value]])])):a.createCommentVNode("",!0),e.data.hasInput?(a.openBlock(),a.createBlock(a.unref(Qe),{key:1,id:"a",type:"target",position:e.targetPosition},null,8,["position"])):a.createCommentVNode("",!0),e.data.hasOutput?(a.openBlock(),a.createBlock(a.unref(Qe),{key:2,id:"b",type:"source",position:e.sourcePosition},null,8,["position"])):a.createCommentVNode("",!0)]))}}),Xc={class:"chart-controls"},Uc={class:"chart-controls-left"},Zc={class:"chart-controls-right"},Wc={key:0},Kc={key:1},Hn=a.defineComponent({__name:"NodeEditor",props:{modelValue:{},nodeContainerClass:{default:""}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t,o=a.ref(!1),i=a.ref([]),r=a.ref(),l=a.ref(""),s=a.computed(()=>(i.value.forEach((P,$)=>{if(P.id===l.value)return $}),-1)),u=a.computed({get:()=>{const P=e.modelValue;for(const $ of P)$.data={},$.type==="input"?($.data.hasInput=!1,$.data.hasOutput=!0):$.type==="output"?($.data.hasInput=!0,$.data.hasOutput=!1):($.data.hasInput=!0,$.data.hasOutput=!0),$.class="vue-flow__node-default",$.type="editable";for(const $ of P)$.events={click:()=>{l.value=$.id}};return P},set:P=>{n("update:modelValue",JSON.parse(JSON.stringify(P)))}}),{addEdges:c,removeEdges:d}=de();a.onMounted(()=>{document.removeEventListener("keypress",N),document.addEventListener("keypress",N)}),a.onBeforeUnmount(()=>{document.removeEventListener("keypress",N)});const f=P=>{r.value=P};i.value=u.value;const h=P=>({[R.Top]:R.Right,[R.Right]:R.Bottom,[R.Bottom]:R.Left,[R.Left]:R.Top})[P],p=()=>{if(s.value>-1){const P=i.value[s.value];if(!P.sourcePosition)return;P.sourcePosition=h(P.sourcePosition)}},b=()=>{if(s.value>-1){const P=i.value[s.value];if(!P.targetPosition)return;P.targetPosition=h(P.targetPosition)}},x=P=>{window.scrollBy(0,P.deltaY)},N=P=>{o.value&&P.ctrlKey==!0&&((P.key=="+"||P.key=="=")&&r.value?.zoomIn(),P.key=="-"&&r.value?.zoomOut())},k=async()=>{await r.value?.fitView()},M=()=>{let P=!1,$={x:Math.random()*200,y:Math.random()*200};if(s.value>-1){const F=i.value[s.value];F.data?.hasOutput&&($={x:F.position.x+200,y:F.position.y+50},P=!0)}const D=i.value.length,K=`node-${D}`;if(i.value.push({id:K,label:"Node "+D,sourcePosition:R.Right,targetPosition:R.Left,class:"vue-flow__node-default",type:"editable",data:{hasInput:!0,hasOutput:!0},events:{click:()=>{l.value=K}},position:$}),P){let F=`edge-${D+1}`;i.value.push({id:F,source:l.value,target:K,type:"editable",label:`EDGE ${D+1}`,animated:!0,events:{click:()=>{l.value=F}}})}},_=(P,$)=>{for(let D=0;D<i.value.length;D++)if(i.value[D].id==$){i.value[D].label=P;break}},C=P=>{const D={id:`edge-${i.value.length}`,source:P.source,target:P.target,type:"editable",label:"New Edge",interactionWidth:400,animated:!0,events:{click:()=>{l.value=D.id}}};c([D])},A=P=>{d(P.edge.id)};return(P,$)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["node-editor-wrapper",e.nodeContainerClass]),onMouseover:$[1]||($[1]=D=>o.value=!0),onMouseleave:$[2]||($[2]=D=>o.value=!1)},[a.createElementVNode("div",Xc,[a.createElementVNode("div",Uc,[a.createElementVNode("div",null,[$[3]||($[3]=a.createElementVNode("b",null,"Selected Node:",-1)),a.createTextVNode(" "+a.toDisplayString(l.value?l.value:"none"),1)])]),a.createElementVNode("div",Zc,[a.createElementVNode("div",null,[a.createElementVNode("button",{class:"button-default",onClick:M},"Add Node")]),a.createElementVNode("div",null,[a.createElementVNode("button",{class:"button-default",onClick:k},"Center")]),s.value>-1?(a.openBlock(),a.createElementBlock("div",Wc,[a.createElementVNode("button",{class:"button-default",onClick:b},"Shift Input Position")])):a.createCommentVNode("",!0),s.value>-1?(a.openBlock(),a.createElementBlock("div",Kc,[a.createElementVNode("button",{class:"button-default",onClick:p},"Shift Output Position")])):a.createCommentVNode("",!0)])]),i.value&&i.value.length?(a.openBlock(),a.createBlock(a.unref(Oc),{key:0,modelValue:i.value,"onUpdate:modelValue":$[0]||($[0]=D=>i.value=D),class:"nowheel","prevent-scrolling":!0,"zoom-on-scroll":!1,"fit-view-on-init":!0,onConnect:C,onPaneReady:f,onEdgeContextMenu:A,onWheel:a.withModifiers(x,["prevent"])},{"node-editable":a.withCtx(D=>[a.createVNode(Gc,a.mergeProps(D,{onChange:K=>_(K,D.id)}),null,16,["onChange"])]),"edge-editable":a.withCtx(D=>[a.createVNode(Fc,a.mergeProps(D,{onChange:K=>_(K,D.id)}),null,16,["onChange"])]),_:1},8,["modelValue"])):a.createCommentVNode("",!0)],34))}}),Vi=a.defineComponent({__name:"StateEditor",props:a.mergeModels({layout:{},nodeContainerClass:{default:""}},{modelValue:{},modelModifiers:{}}),emits:a.mergeModels(["update:modelValue"],["update:modelValue"]),setup(e,{emit:t}){const n=t,o=a.useModel(e,"modelValue"),i=a.computed({get:()=>{const l={},s=[],u={};if(!o.value)return s;let c=0;for(const[d,f]of Object.entries(o.value)){const h={id:d,label:d,position:e.layout[d]?.position||{x:200*c,y:100},targetPosition:e.layout[d]?.targetPosition||R.Left,sourcePosition:e.layout[d]?.sourcePosition||R.Right};f?.type==="final"&&(h.type="output",h.class="default-output-node"),u[d]=h}for(const[d,f]of Object.entries(o.value)){if(f?.on)for(const[h,p]of Object.entries(f.on)){const b=p.target||p;s.push({id:`${d}-${b}`,source:d,target:b,label:h,animated:!0,type:"smoothstep"}),l[b]=!0}c++}for(const[d,f]of Object.entries(u))l[d]||(f.type="input",f.class="default-input-node"),s.push(f);return s},set:l=>{r(l)}}),r=l=>{const s={},u={},c={};for(const d of l){const f=d.label;d.type==="input"?c[f]={on:{}}:d.type==="output"?c[f]={type:"final"}:d.source&&d.target?(s[d.source]=s[d.source]||{},s[d.source][f]={target:d.target}):c[f]={on:{}},u[d.id]=f}for(const[d,f]of Object.entries(s)){const h=u[d];for(const[p,b]of Object.entries(f))c[h]||(c[h]={on:{}}),c[h].on[p]=b}n("update:modelValue",c)};return(l,s)=>(a.openBlock(),a.createElementBlock("div",null,[a.createVNode(Hn,{modelValue:i.value,"onUpdate:modelValue":s[0]||(s[0]=u=>i.value=u),"node-container-class":e.nodeContainerClass},null,8,["modelValue","node-container-class"])]))}});function qc(e){e.component("NodeEditor",Hn),e.component("StateEditor",Vi)}Ce.NodeEditor=Hn,Ce.StateEditor=Vi,Ce.install=qc,Object.defineProperty(Ce,Symbol.toStringTag,{value:"Module"})}));
27
27
  //# sourceMappingURL=node-editor.umd.cjs.map