vue-pure-admin/static/js/vue-flow-core-CpTXh2CK.js

27 lines
155 KiB
JavaScript

var br=Object.defineProperty,xr=Object.defineProperties;var Er=Object.getOwnPropertyDescriptors;var Yt=Object.getOwnPropertySymbols;var po=Object.prototype.hasOwnProperty,mo=Object.prototype.propertyIsEnumerable;var ct=Math.pow,vo=(e,t,n)=>t in e?br(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,D=(e,t)=>{for(var n in t||(t={}))po.call(t,n)&&vo(e,n,t[n]);if(Yt)for(var n of Yt(t))mo.call(t,n)&&vo(e,n,t[n]);return e},fe=(e,t)=>xr(e,Er(t));var dt=(e,t)=>{var n={};for(var o in e)po.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&Yt)for(var o of Yt(e))t.indexOf(o)<0&&mo.call(e,o)&&(n[o]=e[o]);return n};var yo=(e,t,n)=>new Promise((o,i)=>{var r=l=>{try{a(n.next(l))}catch(u){i(u)}},s=l=>{try{a(n.throw(l))}catch(u){i(u)}},a=l=>l.done?o(l.value):Promise.resolve(l.value).then(r,s);a((n=n.apply(e,t)).next())});import{d as xe,b8 as li,bb as xt,gw as ui,n as ve,p as ae,k as ye,e as ge,O as Fe,s as Ye,u as te,v as pt,Q as ue,a as pe,du as Sr,g as rt,i as De,b as st,a4 as ci,F as Ae,N as _e,T as Nr,gx as Cr,m as Qe,a_ as Mr,o as Ir,f as Re,w as Vn,Z as Vt,r as kr,b9 as Qt,U as Tr,j as Pr,t as Rn,Y as $r,l as no,x as Le,y as di,gy as Dr,aE as oo,b5 as Ar,gz as Or,bc as mt,h as fi,L as me,a1 as It,gA as zr}from"./index-DMqaFtX4.js";function gn(e){return li()?(Qt(e),!0):!1}function Ve(e){return typeof e=="function"?e():te(e)}const Br=typeof window!="undefined"&&typeof document!="undefined",Vr=e=>typeof e!="undefined",Rr=Object.prototype.toString,Hr=e=>Rr.call(e)==="[object Object]",Lr=()=>{};function Fr(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 hi=e=>e();function Yr(e=hi){const t=pe(!0);function n(){t.value=!1}function o(){t.value=!0}const i=(...r)=>{t.value&&e(...r)};return{isActive:zr(t),pause:n,resume:o,eventFilter:i}}function _o(e,t=!1,n="Timeout"){return new Promise((o,i)=>{setTimeout(t?()=>i(n):o,e)})}function Gr(e,t,n={}){const r=n,{eventFilter:o=hi}=r,i=dt(r,["eventFilter"]);return ve(e,Fr(o,t),i)}function ft(e,t,n={}){const c=n,{eventFilter:o}=c,i=dt(c,["eventFilter"]),{eventFilter:r,pause:s,resume:a,isActive:l}=Yr(o);return{stop:Gr(e,t,fe(D({},i),{eventFilter:r})),pause:s,resume:a,isActive:l}}function Xr(e,t={}){if(!oo(e))return Ar(e);const n=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const o in e.value)n[o]=Or(()=>({get(){return e.value[o]},set(i){var r;if((r=Ve(t.replaceRef))!=null?r:!0)if(Array.isArray(e.value)){const a=[...e.value];a[o]=i,e.value=a}else{const a=fe(D({},e.value),{[o]:i});Object.setPrototypeOf(a,Object.getPrototypeOf(e.value)),e.value=a}else e.value[o]=i}}));return n}function Hn(e,t=!1){function n(d,{flush:v="sync",deep:p=!1,timeout:S,throwOnTimeout:_}={}){let x=null;const I=[new Promise(y=>{x=ve(e,C=>{d(C)!==t&&(x==null||x(),y(C))},{flush:v,deep:p,immediate:!0})})];return S!=null&&I.push(_o(S,_).then(()=>Ve(e)).finally(()=>x==null?void 0:x())),Promise.race(I)}function o(d,v){if(!oo(d))return n(C=>C===d,v);const{flush:p="sync",deep:S=!1,timeout:_,throwOnTimeout:x}=v!=null?v:{};let N=null;const y=[new Promise(C=>{N=ve([e,d],([z,Y])=>{t!==(z===Y)&&(N==null||N(),C(z))},{flush:p,deep:S,immediate:!0})})];return _!=null&&y.push(_o(_,x).then(()=>Ve(e)).finally(()=>(N==null||N(),Ve(e)))),Promise.race(y)}function i(d){return n(v=>!!v,d)}function r(d){return o(null,d)}function s(d){return o(void 0,d)}function a(d){return n(Number.isNaN,d)}function l(d,v){return n(p=>{const S=Array.from(p);return S.includes(d)||S.includes(Ve(d))},v)}function u(d){return c(1,d)}function c(d=1,v){let p=-1;return n(()=>(p+=1,p>=d),v)}return Array.isArray(Ve(e))?{toMatch:n,toContains:l,changed:u,changedTimes:c,get not(){return Hn(e,!t)}}:{toMatch:n,toBe:o,toBeTruthy:i,toBeNull:r,toBeNaN:a,toBeUndefined:s,changed:u,changedTimes:c,get not(){return Hn(e,!t)}}}function Ln(e){return Hn(e)}function Ur(e){var t;const n=Ve(e);return(t=n==null?void 0:n.$el)!=null?t:n}const gi=Br?window:void 0;function vi(...e){let t,n,o,i;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,o,i]=e,t=gi):[t,n,o,i]=e,!t)return Lr;Array.isArray(n)||(n=[n]),Array.isArray(o)||(o=[o]);const r=[],s=()=>{r.forEach(c=>c()),r.length=0},a=(c,d,v,p)=>(c.addEventListener(d,v,p),()=>c.removeEventListener(d,v,p)),l=ve(()=>[Ur(t),Ve(i)],([c,d])=>{if(s(),!c)return;const v=Hr(d)?D({},d):d;r.push(...n.flatMap(p=>o.map(S=>a(c,p,S,v))))},{immediate:!0,flush:"post"}),u=()=>{l(),s()};return gn(u),u}function Zr(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function wo(...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=gi,eventName:r="keydown",passive:s=!1,dedupe:a=!1}=o,l=Zr(t);return vi(i,r,c=>{c.repeat&&Ve(a)||l(c)&&n(c)},s)}function Wr(e){return JSON.parse(JSON.stringify(e))}function Cn(e,t,n,o={}){var i,r,s;const{clone:a=!1,passive:l=!1,eventName:u,deep:c=!1,defaultValue:d,shouldEmit:v}=o,p=Vt(),S=n||(p==null?void 0:p.emit)||((i=p==null?void 0:p.$emit)==null?void 0:i.bind(p))||((s=(r=p==null?void 0:p.proxy)==null?void 0:r.$emit)==null?void 0:s.bind(p==null?void 0:p.proxy));let _=u;t||(t="modelValue"),_=_||`update:${t.toString()}`;const x=y=>a?typeof a=="function"?a(y):Wr(y):y,N=()=>Vr(e[t])?x(e[t]):d,I=y=>{v?v(y)&&S(_,y):S(_,y)};if(l){const y=N(),C=pe(y);let z=!1;return ve(()=>e[t],Y=>{z||(z=!0,C.value=x(Y),Le(()=>z=!1))}),ve(C,Y=>{!z&&(Y!==e[t]||c)&&I(Y)},{deep:c}),C}else return ae({get(){return N()},set(y){I(y)}})}var Kr={value:()=>{}};function vn(){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 jt(n)}function jt(e){this._=e}function qr(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}})}jt.prototype=vn.prototype={constructor:jt,on:function(e,t){var n=this._,o=qr(e+"",n),i,r=-1,s=o.length;if(arguments.length<2){for(;++r<s;)if((i=(e=o[r]).type)&&(i=Jr(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++r<s;)if(i=(e=o[r]).type)n[i]=bo(n[i],e.name,t);else if(t==null)for(i in n)n[i]=bo(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 jt(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 Jr(e,t){for(var n=0,o=e.length,i;n<o;++n)if((i=e[n]).name===t)return i.value}function bo(e,t,n){for(var o=0,i=e.length;o<i;++o)if(e[o].name===t){e[o]=Kr,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var Fn="http://www.w3.org/1999/xhtml";const xo={svg:"http://www.w3.org/2000/svg",xhtml:Fn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function pn(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),xo.hasOwnProperty(t)?{space:xo[t],local:e}:e}function Qr(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Fn&&t.documentElement.namespaceURI===Fn?t.createElement(e):t.createElementNS(n,e)}}function jr(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function pi(e){var t=pn(e);return(t.local?jr:Qr)(t)}function es(){}function io(e){return e==null?es:function(){return this.querySelector(e)}}function ts(e){typeof e!="function"&&(e=io(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r=t[i],s=r.length,a=o[i]=new Array(s),l,u,c=0;c<s;++c)(l=r[c])&&(u=e.call(l,l.__data__,c,r))&&("__data__"in l&&(u.__data__=l.__data__),a[c]=u);return new Me(o,this._parents)}function ns(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function os(){return[]}function mi(e){return e==null?os:function(){return this.querySelectorAll(e)}}function is(e){return function(){return ns(e.apply(this,arguments))}}function rs(e){typeof e=="function"?e=is(e):e=mi(e);for(var t=this._groups,n=t.length,o=[],i=[],r=0;r<n;++r)for(var s=t[r],a=s.length,l,u=0;u<a;++u)(l=s[u])&&(o.push(e.call(l,l.__data__,u,s)),i.push(l));return new Me(o,i)}function yi(e){return function(){return this.matches(e)}}function _i(e){return function(t){return t.matches(e)}}var ss=Array.prototype.find;function as(e){return function(){return ss.call(this.children,e)}}function ls(){return this.firstElementChild}function us(e){return this.select(e==null?ls:as(typeof e=="function"?e:_i(e)))}var cs=Array.prototype.filter;function ds(){return Array.from(this.children)}function fs(e){return function(){return cs.call(this.children,e)}}function hs(e){return this.selectAll(e==null?ds:fs(typeof e=="function"?e:_i(e)))}function gs(e){typeof e!="function"&&(e=yi(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r=t[i],s=r.length,a=o[i]=[],l,u=0;u<s;++u)(l=r[u])&&e.call(l,l.__data__,u,r)&&a.push(l);return new Me(o,this._parents)}function wi(e){return new Array(e.length)}function vs(){return new Me(this._enter||this._groups.map(wi),this._parents)}function on(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}on.prototype={constructor:on,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 ps(e){return function(){return e}}function ms(e,t,n,o,i,r){for(var s=0,a,l=t.length,u=r.length;s<u;++s)(a=t[s])?(a.__data__=r[s],o[s]=a):n[s]=new on(e,r[s]);for(;s<l;++s)(a=t[s])&&(i[s]=a)}function ys(e,t,n,o,i,r,s){var a,l,u=new Map,c=t.length,d=r.length,v=new Array(c),p;for(a=0;a<c;++a)(l=t[a])&&(v[a]=p=s.call(l,l.__data__,a,t)+"",u.has(p)?i[a]=l:u.set(p,l));for(a=0;a<d;++a)p=s.call(e,r[a],a,r)+"",(l=u.get(p))?(o[a]=l,l.__data__=r[a],u.delete(p)):n[a]=new on(e,r[a]);for(a=0;a<c;++a)(l=t[a])&&u.get(v[a])===l&&(i[a]=l)}function _s(e){return e.__data__}function ws(e,t){if(!arguments.length)return Array.from(this,_s);var n=t?ys:ms,o=this._parents,i=this._groups;typeof e!="function"&&(e=ps(e));for(var r=i.length,s=new Array(r),a=new Array(r),l=new Array(r),u=0;u<r;++u){var c=o[u],d=i[u],v=d.length,p=bs(e.call(c,c&&c.__data__,u,o)),S=p.length,_=a[u]=new Array(S),x=s[u]=new Array(S),N=l[u]=new Array(v);n(c,d,_,x,N,p,t);for(var I=0,y=0,C,z;I<S;++I)if(C=_[I]){for(I>=y&&(y=I+1);!(z=x[y])&&++y<S;);C._next=z||null}}return s=new Me(s,o),s._enter=a,s._exit=l,s}function bs(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function xs(){return new Me(this._exit||this._groups.map(wi),this._parents)}function Es(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 Ss(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,i=n.length,r=o.length,s=Math.min(i,r),a=new Array(i),l=0;l<s;++l)for(var u=n[l],c=o[l],d=u.length,v=a[l]=new Array(d),p,S=0;S<d;++S)(p=u[S]||c[S])&&(v[S]=p);for(;l<i;++l)a[l]=n[l];return new Me(a,this._parents)}function Ns(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],i=o.length-1,r=o[i],s;--i>=0;)(s=o[i])&&(r&&s.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(s,r),r=s);return this}function Cs(e){e||(e=Ms);function t(d,v){return d&&v?e(d.__data__,v.__data__):!d-!v}for(var n=this._groups,o=n.length,i=new Array(o),r=0;r<o;++r){for(var s=n[r],a=s.length,l=i[r]=new Array(a),u,c=0;c<a;++c)(u=s[c])&&(l[c]=u);l.sort(t)}return new Me(i,this._parents).order()}function Ms(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Is(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ks(){return Array.from(this)}function Ts(){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 s=o[i];if(s)return s}return null}function Ps(){let e=0;for(const t of this)++e;return e}function $s(){return!this.node()}function Ds(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var i=t[n],r=0,s=i.length,a;r<s;++r)(a=i[r])&&e.call(a,a.__data__,r,i);return this}function As(e){return function(){this.removeAttribute(e)}}function Os(e){return function(){this.removeAttributeNS(e.space,e.local)}}function zs(e,t){return function(){this.setAttribute(e,t)}}function Bs(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Vs(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Rs(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 Hs(e,t){var n=pn(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?Os:As:typeof t=="function"?n.local?Rs:Vs:n.local?Bs:zs)(n,t))}function bi(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Ls(e){return function(){this.style.removeProperty(e)}}function Fs(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Ys(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Gs(e,t,n){return arguments.length>1?this.each((t==null?Ls:typeof t=="function"?Ys:Fs)(e,t,n==null?"":n)):yt(this.node(),e)}function yt(e,t){return e.style.getPropertyValue(t)||bi(e).getComputedStyle(e,null).getPropertyValue(t)}function Xs(e){return function(){delete this[e]}}function Us(e,t){return function(){this[e]=t}}function Zs(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Ws(e,t){return arguments.length>1?this.each((t==null?Xs:typeof t=="function"?Zs:Us)(e,t)):this.node()[e]}function xi(e){return e.trim().split(/^|\s+/)}function ro(e){return e.classList||new Ei(e)}function Ei(e){this._node=e,this._names=xi(e.getAttribute("class")||"")}Ei.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 Si(e,t){for(var n=ro(e),o=-1,i=t.length;++o<i;)n.add(t[o])}function Ni(e,t){for(var n=ro(e),o=-1,i=t.length;++o<i;)n.remove(t[o])}function Ks(e){return function(){Si(this,e)}}function qs(e){return function(){Ni(this,e)}}function Js(e,t){return function(){(t.apply(this,arguments)?Si:Ni)(this,e)}}function Qs(e,t){var n=xi(e+"");if(arguments.length<2){for(var o=ro(this.node()),i=-1,r=n.length;++i<r;)if(!o.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?Js:t?Ks:qs)(n,t))}function js(){this.textContent=""}function ea(e){return function(){this.textContent=e}}function ta(e){return function(){var t=e.apply(this,arguments);this.textContent=t==null?"":t}}function na(e){return arguments.length?this.each(e==null?js:(typeof e=="function"?ta:ea)(e)):this.node().textContent}function oa(){this.innerHTML=""}function ia(e){return function(){this.innerHTML=e}}function ra(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t==null?"":t}}function sa(e){return arguments.length?this.each(e==null?oa:(typeof e=="function"?ra:ia)(e)):this.node().innerHTML}function aa(){this.nextSibling&&this.parentNode.appendChild(this)}function la(){return this.each(aa)}function ua(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ca(){return this.each(ua)}function da(e){var t=typeof e=="function"?e:pi(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function fa(){return null}function ha(e,t){var n=typeof e=="function"?e:pi(e),o=t==null?fa:typeof t=="function"?t:io(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function ga(){var e=this.parentNode;e&&e.removeChild(this)}function va(){return this.each(ga)}function pa(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ma(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ya(e){return this.select(e?ma:pa)}function _a(e){return arguments.length?this.property("__data__",e):this.node().__data__}function wa(e){return function(t){e.call(this,t,this.__data__)}}function ba(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 xa(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 Ea(e,t,n){return function(){var o=this.__on,i,r=wa(t);if(o){for(var s=0,a=o.length;s<a;++s)if((i=o[s]).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 Sa(e,t,n){var o=ba(e+""),i,r=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,u=a.length,c;l<u;++l)for(i=0,c=a[l];i<r;++i)if((s=o[i]).type===c.type&&s.name===c.name)return c.value}return}for(a=t?Ea:xa,i=0;i<r;++i)this.each(a(o[i],t,n));return this}function Ci(e,t,n){var o=bi(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 Na(e,t){return function(){return Ci(this,e,t)}}function Ca(e,t){return function(){return Ci(this,e,t.apply(this,arguments))}}function Ma(e,t){return this.each((typeof t=="function"?Ca:Na)(e,t))}function*Ia(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],i=0,r=o.length,s;i<r;++i)(s=o[i])&&(yield s)}var Mi=[null];function Me(e,t){this._groups=e,this._parents=t}function Rt(){return new Me([[document.documentElement]],Mi)}function ka(){return this}Me.prototype=Rt.prototype={constructor:Me,select:ts,selectAll:rs,selectChild:us,selectChildren:hs,filter:gs,data:ws,enter:vs,exit:xs,join:Es,merge:Ss,selection:ka,order:Ns,sort:Cs,call:Is,nodes:ks,node:Ts,size:Ps,empty:$s,each:Ds,attr:Hs,style:Gs,property:Ws,classed:Qs,text:na,html:sa,raise:la,lower:ca,append:da,insert:ha,remove:va,clone:ya,datum:_a,on:Sa,dispatch:Ma,[Symbol.iterator]:Ia};function Ie(e){return typeof e=="string"?new Me([[document.querySelector(e)]],[document.documentElement]):new Me([[e]],Mi)}function Ta(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Pe(e,t){if(e=Ta(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 Pa={passive:!1},Pt={capture:!0,passive:!1};function Mn(e){e.stopImmediatePropagation()}function ht(e){e.preventDefault(),e.stopImmediatePropagation()}function Ii(e){var t=e.document.documentElement,n=Ie(e).on("dragstart.drag",ht,Pt);"onselectstart"in t?n.on("selectstart.drag",ht,Pt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function ki(e,t){var n=e.document.documentElement,o=Ie(e).on("dragstart.drag",null);t&&(o.on("click.drag",ht,Pt),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 Gt=e=>()=>e;function Yn(e,{sourceEvent:t,subject:n,target:o,identifier:i,active:r,x:s,y:a,dx:l,dy:u,dispatch:c}){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:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:c}})}Yn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function $a(e){return!e.ctrlKey&&!e.button}function Da(){return this.parentNode}function Aa(e,t){return t==null?{x:e.x,y:e.y}:t}function Oa(){return navigator.maxTouchPoints||"ontouchstart"in this}function za(){var e=$a,t=Da,n=Aa,o=Oa,i={},r=vn("start","drag","end"),s=0,a,l,u,c,d=0;function v(C){C.on("mousedown.drag",p).filter(o).on("touchstart.drag",x).on("touchmove.drag",N,Pa).on("touchend.drag touchcancel.drag",I).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(C,z){if(!(c||!e.call(this,C,z))){var Y=y(this,t.call(this,C,z),C,z,"mouse");Y&&(Ie(C.view).on("mousemove.drag",S,Pt).on("mouseup.drag",_,Pt),Ii(C.view),Mn(C),u=!1,a=C.clientX,l=C.clientY,Y("start",C))}}function S(C){if(ht(C),!u){var z=C.clientX-a,Y=C.clientY-l;u=z*z+Y*Y>d}i.mouse("drag",C)}function _(C){Ie(C.view).on("mousemove.drag mouseup.drag",null),ki(C.view,u),ht(C),i.mouse("end",C)}function x(C,z){if(e.call(this,C,z)){var Y=C.changedTouches,U=t.call(this,C,z),H=Y.length,J,W;for(J=0;J<H;++J)(W=y(this,U,C,z,Y[J].identifier,Y[J]))&&(Mn(C),W("start",C,Y[J]))}}function N(C){var z=C.changedTouches,Y=z.length,U,H;for(U=0;U<Y;++U)(H=i[z[U].identifier])&&(ht(C),H("drag",C,z[U]))}function I(C){var z=C.changedTouches,Y=z.length,U,H;for(c&&clearTimeout(c),c=setTimeout(function(){c=null},500),U=0;U<Y;++U)(H=i[z[U].identifier])&&(Mn(C),H("end",C,z[U]))}function y(C,z,Y,U,H,J){var W=r.copy(),$=Pe(J||Y,z),b,Q,m;if((m=n.call(C,new Yn("beforestart",{sourceEvent:Y,target:v,identifier:H,active:s,x:$[0],y:$[1],dx:0,dy:0,dispatch:W}),U))!=null)return b=m.x-$[0]||0,Q=m.y-$[1]||0,function k(w,P,A){var B=$,O;switch(w){case"start":i[H]=k,O=s++;break;case"end":delete i[H],--s;case"drag":$=Pe(A||P,z),O=s;break}W.call(w,C,new Yn(w,{sourceEvent:P,subject:m,target:v,identifier:H,active:O,x:$[0]+b,y:$[1]+Q,dx:$[0]-B[0],dy:$[1]-B[1],dispatch:W}),U)}}return v.filter=function(C){return arguments.length?(e=typeof C=="function"?C:Gt(!!C),v):e},v.container=function(C){return arguments.length?(t=typeof C=="function"?C:Gt(C),v):t},v.subject=function(C){return arguments.length?(n=typeof C=="function"?C:Gt(C),v):n},v.touchable=function(C){return arguments.length?(o=typeof C=="function"?C:Gt(!!C),v):o},v.on=function(){var C=r.on.apply(r,arguments);return C===r?v:C},v.clickDistance=function(C){return arguments.length?(d=(C=+C)*C,v):Math.sqrt(d)},v}function so(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Ti(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function Ht(){}var $t=.7,rn=1/$t,gt="\\s*([+-]?\\d+)\\s*",Dt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",$e="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Ba=/^#([0-9a-f]{3,8})$/,Va=new RegExp(`^rgb\\(${gt},${gt},${gt}\\)$`),Ra=new RegExp(`^rgb\\(${$e},${$e},${$e}\\)$`),Ha=new RegExp(`^rgba\\(${gt},${gt},${gt},${Dt}\\)$`),La=new RegExp(`^rgba\\(${$e},${$e},${$e},${Dt}\\)$`),Fa=new RegExp(`^hsl\\(${Dt},${$e},${$e}\\)$`),Ya=new RegExp(`^hsla\\(${Dt},${$e},${$e},${Dt}\\)$`),Eo={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};so(Ht,At,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:So,formatHex:So,formatHex8:Ga,formatHsl:Xa,formatRgb:No,toString:No});function So(){return this.rgb().formatHex()}function Ga(){return this.rgb().formatHex8()}function Xa(){return Pi(this).formatHsl()}function No(){return this.rgb().formatRgb()}function At(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Ba.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Co(t):n===3?new Ce(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Xt(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Xt(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=Va.exec(e))?new Ce(t[1],t[2],t[3],1):(t=Ra.exec(e))?new Ce(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Ha.exec(e))?Xt(t[1],t[2],t[3],t[4]):(t=La.exec(e))?Xt(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Fa.exec(e))?ko(t[1],t[2]/100,t[3]/100,1):(t=Ya.exec(e))?ko(t[1],t[2]/100,t[3]/100,t[4]):Eo.hasOwnProperty(e)?Co(Eo[e]):e==="transparent"?new Ce(NaN,NaN,NaN,0):null}function Co(e){return new Ce(e>>16&255,e>>8&255,e&255,1)}function Xt(e,t,n,o){return o<=0&&(e=t=n=NaN),new Ce(e,t,n,o)}function Ua(e){return e instanceof Ht||(e=At(e)),e?(e=e.rgb(),new Ce(e.r,e.g,e.b,e.opacity)):new Ce}function Gn(e,t,n,o){return arguments.length===1?Ua(e):new Ce(e,t,n,o==null?1:o)}function Ce(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}so(Ce,Gn,Ti(Ht,{brighter(e){return e=e==null?rn:Math.pow(rn,e),new Ce(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?$t:Math.pow($t,e),new Ce(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ce(ot(this.r),ot(this.g),ot(this.b),sn(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:Mo,formatHex:Mo,formatHex8:Za,formatRgb:Io,toString:Io}));function Mo(){return`#${nt(this.r)}${nt(this.g)}${nt(this.b)}`}function Za(){return`#${nt(this.r)}${nt(this.g)}${nt(this.b)}${nt((isNaN(this.opacity)?1:this.opacity)*255)}`}function Io(){const e=sn(this.opacity);return`${e===1?"rgb(":"rgba("}${ot(this.r)}, ${ot(this.g)}, ${ot(this.b)}${e===1?")":`, ${e})`}`}function sn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ot(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function nt(e){return e=ot(e),(e<16?"0":"")+e.toString(16)}function ko(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ke(e,t,n,o)}function Pi(e){if(e instanceof ke)return new ke(e.h,e.s,e.l,e.opacity);if(e instanceof Ht||(e=At(e)),!e)return new ke;if(e instanceof ke)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),s=NaN,a=r-i,l=(r+i)/2;return a?(t===r?s=(n-o)/a+(n<o)*6:n===r?s=(o-t)/a+2:s=(t-n)/a+4,a/=l<.5?r+i:2-r-i,s*=60):a=l>0&&l<1?0:s,new ke(s,a,l,e.opacity)}function Wa(e,t,n,o){return arguments.length===1?Pi(e):new ke(e,t,n,o==null?1:o)}function ke(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}so(ke,Wa,Ti(Ht,{brighter(e){return e=e==null?rn:Math.pow(rn,e),new ke(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?$t:Math.pow($t,e),new ke(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 Ce(In(e>=240?e-240:e+120,i,o),In(e,i,o),In(e<120?e+240:e-120,i,o),this.opacity)},clamp(){return new ke(To(this.h),Ut(this.s),Ut(this.l),sn(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=sn(this.opacity);return`${e===1?"hsl(":"hsla("}${To(this.h)}, ${Ut(this.s)*100}%, ${Ut(this.l)*100}%${e===1?")":`, ${e})`}`}}));function To(e){return e=(e||0)%360,e<0?e+360:e}function Ut(e){return Math.max(0,Math.min(1,e||0))}function In(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 $i=e=>()=>e;function Ka(e,t){return function(n){return e+n*t}}function qa(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 Ja(e){return(e=+e)==1?Di:function(t,n){return n-t?qa(t,n,e):$i(isNaN(t)?n:t)}}function Di(e,t){var n=t-e;return n?Ka(e,n):$i(isNaN(e)?t:e)}const Po=function e(t){var n=Ja(t);function o(i,r){var s=n((i=Gn(i)).r,(r=Gn(r)).r),a=n(i.g,r.g),l=n(i.b,r.b),u=Di(i.opacity,r.opacity);return function(c){return i.r=s(c),i.g=a(c),i.b=l(c),i.opacity=u(c),i+""}}return o.gamma=e,o}(1);function Ze(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Xn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,kn=new RegExp(Xn.source,"g");function Qa(e){return function(){return e}}function ja(e){return function(t){return e(t)+""}}function el(e,t){var n=Xn.lastIndex=kn.lastIndex=0,o,i,r,s=-1,a=[],l=[];for(e=e+"",t=t+"";(o=Xn.exec(e))&&(i=kn.exec(t));)(r=i.index)>n&&(r=t.slice(n,r),a[s]?a[s]+=r:a[++s]=r),(o=o[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,l.push({i:s,x:Ze(o,i)})),n=kn.lastIndex;return n<t.length&&(r=t.slice(n),a[s]?a[s]+=r:a[++s]=r),a.length<2?l[0]?ja(l[0].x):Qa(t):(t=l.length,function(u){for(var c=0,d;c<t;++c)a[(d=l[c]).i]=d.x(u);return a.join("")})}var $o=180/Math.PI,Un={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ai(e,t,n,o,i,r){var s,a,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,l/=a),e*o<t*n&&(e=-e,t=-t,l=-l,s=-s),{translateX:i,translateY:r,rotate:Math.atan2(t,e)*$o,skewX:Math.atan(l)*$o,scaleX:s,scaleY:a}}var Zt;function tl(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Un:Ai(t.a,t.b,t.c,t.d,t.e,t.f)}function nl(e){return e==null||(Zt||(Zt=document.createElementNS("http://www.w3.org/2000/svg","g")),Zt.setAttribute("transform",e),!(e=Zt.transform.baseVal.consolidate()))?Un:(e=e.matrix,Ai(e.a,e.b,e.c,e.d,e.e,e.f))}function Oi(e,t,n,o){function i(u){return u.length?u.pop()+" ":""}function r(u,c,d,v,p,S){if(u!==d||c!==v){var _=p.push("translate(",null,t,null,n);S.push({i:_-4,x:Ze(u,d)},{i:_-2,x:Ze(c,v)})}else(d||v)&&p.push("translate("+d+t+v+n)}function s(u,c,d,v){u!==c?(u-c>180?c+=360:c-u>180&&(u+=360),v.push({i:d.push(i(d)+"rotate(",null,o)-2,x:Ze(u,c)})):c&&d.push(i(d)+"rotate("+c+o)}function a(u,c,d,v){u!==c?v.push({i:d.push(i(d)+"skewX(",null,o)-2,x:Ze(u,c)}):c&&d.push(i(d)+"skewX("+c+o)}function l(u,c,d,v,p,S){if(u!==d||c!==v){var _=p.push(i(p)+"scale(",null,",",null,")");S.push({i:_-4,x:Ze(u,d)},{i:_-2,x:Ze(c,v)})}else(d!==1||v!==1)&&p.push(i(p)+"scale("+d+","+v+")")}return function(u,c){var d=[],v=[];return u=e(u),c=e(c),r(u.translateX,u.translateY,c.translateX,c.translateY,d,v),s(u.rotate,c.rotate,d,v),a(u.skewX,c.skewX,d,v),l(u.scaleX,u.scaleY,c.scaleX,c.scaleY,d,v),u=c=null,function(p){for(var S=-1,_=v.length,x;++S<_;)d[(x=v[S]).i]=x.x(p);return d.join("")}}}var ol=Oi(tl,"px, ","px)","deg)"),il=Oi(nl,", ",")",")"),rl=1e-12;function Do(e){return((e=Math.exp(e))+1/e)/2}function sl(e){return((e=Math.exp(e))-1/e)/2}function al(e){return((e=Math.exp(2*e))-1)/(e+1)}const ll=function e(t,n,o){function i(r,s){var a=r[0],l=r[1],u=r[2],c=s[0],d=s[1],v=s[2],p=c-a,S=d-l,_=p*p+S*S,x,N;if(_<rl)N=Math.log(v/u)/t,x=function(U){return[a+U*p,l+U*S,u*Math.exp(t*U*N)]};else{var I=Math.sqrt(_),y=(v*v-u*u+o*_)/(2*u*n*I),C=(v*v-u*u-o*_)/(2*v*n*I),z=Math.log(Math.sqrt(y*y+1)-y),Y=Math.log(Math.sqrt(C*C+1)-C);N=(Y-z)/t,x=function(U){var H=U*N,J=Do(z),W=u/(n*I)*(J*al(t*H+z)-sl(z));return[a+W*p,l+W*S,u*J/Do(t*H+z)]}}return x.duration=N*1e3*t/Math.SQRT2,x}return i.rho=function(r){var s=Math.max(.001,+r),a=s*s,l=a*a;return e(s,a,l)},i}(Math.SQRT2,2,4);var _t=0,Nt=0,Et=0,zi=1e3,an,Ct,ln=0,at=0,mn=0,Ot=typeof performance=="object"&&performance.now?performance:Date,Bi=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function ao(){return at||(Bi(ul),at=Ot.now()+mn)}function ul(){at=0}function un(){this._call=this._time=this._next=null}un.prototype=Vi.prototype={constructor:un,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?ao():+n)+(t==null?0:+t),!this._next&&Ct!==this&&(Ct?Ct._next=this:an=this,Ct=this),this._call=e,this._time=n,Zn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Zn())}};function Vi(e,t,n){var o=new un;return o.restart(e,t,n),o}function cl(){ao(),++_t;for(var e=an,t;e;)(t=at-e._time)>=0&&e._call.call(void 0,t),e=e._next;--_t}function Ao(){at=(ln=Ot.now())+mn,_t=Nt=0;try{cl()}finally{_t=0,fl(),at=0}}function dl(){var e=Ot.now(),t=e-ln;t>zi&&(mn-=t,ln=e)}function fl(){for(var e,t=an,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:an=n);Ct=e,Zn(o)}function Zn(e){if(!_t){Nt&&(Nt=clearTimeout(Nt));var t=e-at;t>24?(e<1/0&&(Nt=setTimeout(Ao,e-Ot.now()-mn)),Et&&(Et=clearInterval(Et))):(Et||(ln=Ot.now(),Et=setInterval(dl,zi)),_t=1,Bi(Ao))}}function Oo(e,t,n){var o=new un;return t=t==null?0:+t,o.restart(i=>{o.stop(),e(i+t)},t,n),o}var hl=vn("start","end","cancel","interrupt"),gl=[],Ri=0,zo=1,Wn=2,en=3,Bo=4,Kn=5,tn=6;function yn(e,t,n,o,i,r){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;vl(e,n,{name:t,index:o,group:i,on:hl,tween:gl,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Ri})}function lo(e,t){var n=Te(e,t);if(n.state>Ri)throw new Error("too late; already scheduled");return n}function Oe(e,t){var n=Te(e,t);if(n.state>en)throw new Error("too late; already running");return n}function Te(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function vl(e,t,n){var o=e.__transition,i;o[t]=n,n.timer=Vi(r,0,n.time);function r(u){n.state=zo,n.timer.restart(s,n.delay,n.time),n.delay<=u&&s(u-n.delay)}function s(u){var c,d,v,p;if(n.state!==zo)return l();for(c in o)if(p=o[c],p.name===n.name){if(p.state===en)return Oo(s);p.state===Bo?(p.state=tn,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete o[c]):+c<t&&(p.state=tn,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete o[c])}if(Oo(function(){n.state===en&&(n.state=Bo,n.timer.restart(a,n.delay,n.time),a(u))}),n.state=Wn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Wn){for(n.state=en,i=new Array(v=n.tween.length),c=0,d=-1;c<v;++c)(p=n.tween[c].value.call(e,e.__data__,n.index,n.group))&&(i[++d]=p);i.length=d+1}}function a(u){for(var c=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(l),n.state=Kn,1),d=-1,v=i.length;++d<v;)i[d].call(e,c);n.state===Kn&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=tn,n.timer.stop(),delete o[t];for(var u in o)return;delete e.__transition}}function nn(e,t){var n=e.__transition,o,i,r=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((o=n[s]).name!==t){r=!1;continue}i=o.state>Wn&&o.state<Kn,o.state=tn,o.timer.stop(),o.on.call(i?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}r&&delete e.__transition}}function pl(e){return this.each(function(){nn(this,e)})}function ml(e,t){var n,o;return function(){var i=Oe(this,e),r=i.tween;if(r!==n){o=n=r;for(var s=0,a=o.length;s<a;++s)if(o[s].name===t){o=o.slice(),o.splice(s,1);break}}i.tween=o}}function yl(e,t,n){var o,i;if(typeof n!="function")throw new Error;return function(){var r=Oe(this,e),s=r.tween;if(s!==o){i=(o=s).slice();for(var a={name:t,value:n},l=0,u=i.length;l<u;++l)if(i[l].name===t){i[l]=a;break}l===u&&i.push(a)}r.tween=i}}function _l(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=Te(this.node(),n).tween,i=0,r=o.length,s;i<r;++i)if((s=o[i]).name===e)return s.value;return null}return this.each((t==null?ml:yl)(n,e,t))}function uo(e,t,n){var o=e._id;return e.each(function(){var i=Oe(this,o);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return Te(i,o).value[t]}}function Hi(e,t){var n;return(typeof t=="number"?Ze:t instanceof At?Po:(n=At(t))?(t=n,Po):el)(e,t)}function wl(e){return function(){this.removeAttribute(e)}}function bl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function xl(e,t,n){var o,i=n+"",r;return function(){var s=this.getAttribute(e);return s===i?null:s===o?r:r=t(o=s,n)}}function El(e,t,n){var o,i=n+"",r;return function(){var s=this.getAttributeNS(e.space,e.local);return s===i?null:s===o?r:r=t(o=s,n)}}function Sl(e,t,n){var o,i,r;return function(){var s,a=n(this),l;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),l=a+"",s===l?null:s===o&&l===i?r:(i=l,r=t(o=s,a)))}}function Nl(e,t,n){var o,i,r;return function(){var s,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),l=a+"",s===l?null:s===o&&l===i?r:(i=l,r=t(o=s,a)))}}function Cl(e,t){var n=pn(e),o=n==="transform"?il:Hi;return this.attrTween(e,typeof t=="function"?(n.local?Nl:Sl)(n,o,uo(this,"attr."+e,t)):t==null?(n.local?bl:wl)(n):(n.local?El:xl)(n,o,t))}function Ml(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Il(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function kl(e,t){var n,o;function i(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&Il(e,r)),n}return i._value=t,i}function Tl(e,t){var n,o;function i(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&Ml(e,r)),n}return i._value=t,i}function Pl(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=pn(e);return this.tween(n,(o.local?kl:Tl)(o,t))}function $l(e,t){return function(){lo(this,e).delay=+t.apply(this,arguments)}}function Dl(e,t){return t=+t,function(){lo(this,e).delay=t}}function Al(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?$l:Dl)(t,e)):Te(this.node(),t).delay}function Ol(e,t){return function(){Oe(this,e).duration=+t.apply(this,arguments)}}function zl(e,t){return t=+t,function(){Oe(this,e).duration=t}}function Bl(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Ol:zl)(t,e)):Te(this.node(),t).duration}function Vl(e,t){if(typeof t!="function")throw new Error;return function(){Oe(this,e).ease=t}}function Rl(e){var t=this._id;return arguments.length?this.each(Vl(t,e)):Te(this.node(),t).ease}function Hl(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Oe(this,e).ease=n}}function Ll(e){if(typeof e!="function")throw new Error;return this.each(Hl(this._id,e))}function Fl(e){typeof e!="function"&&(e=yi(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r=t[i],s=r.length,a=o[i]=[],l,u=0;u<s;++u)(l=r[u])&&e.call(l,l.__data__,u,r)&&a.push(l);return new Ge(o,this._parents,this._name,this._id)}function Yl(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),s=new Array(o),a=0;a<r;++a)for(var l=t[a],u=n[a],c=l.length,d=s[a]=new Array(c),v,p=0;p<c;++p)(v=l[p]||u[p])&&(d[p]=v);for(;a<o;++a)s[a]=t[a];return new Ge(s,this._parents,this._name,this._id)}function Gl(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 Xl(e,t,n){var o,i,r=Gl(t)?lo:Oe;return function(){var s=r(this,e),a=s.on;a!==o&&(i=(o=a).copy()).on(t,n),s.on=i}}function Ul(e,t){var n=this._id;return arguments.length<2?Te(this.node(),n).on.on(e):this.each(Xl(n,e,t))}function Zl(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Wl(){return this.on("end.remove",Zl(this._id))}function Kl(e){var t=this._name,n=this._id;typeof e!="function"&&(e=io(e));for(var o=this._groups,i=o.length,r=new Array(i),s=0;s<i;++s)for(var a=o[s],l=a.length,u=r[s]=new Array(l),c,d,v=0;v<l;++v)(c=a[v])&&(d=e.call(c,c.__data__,v,a))&&("__data__"in c&&(d.__data__=c.__data__),u[v]=d,yn(u[v],t,n,v,u,Te(c,n)));return new Ge(r,this._parents,t,n)}function ql(e){var t=this._name,n=this._id;typeof e!="function"&&(e=mi(e));for(var o=this._groups,i=o.length,r=[],s=[],a=0;a<i;++a)for(var l=o[a],u=l.length,c,d=0;d<u;++d)if(c=l[d]){for(var v=e.call(c,c.__data__,d,l),p,S=Te(c,n),_=0,x=v.length;_<x;++_)(p=v[_])&&yn(p,t,n,_,v,S);r.push(v),s.push(c)}return new Ge(r,s,t,n)}var Jl=Rt.prototype.constructor;function Ql(){return new Jl(this._groups,this._parents)}function jl(e,t){var n,o,i;return function(){var r=yt(this,e),s=(this.style.removeProperty(e),yt(this,e));return r===s?null:r===n&&s===o?i:i=t(n=r,o=s)}}function Li(e){return function(){this.style.removeProperty(e)}}function eu(e,t,n){var o,i=n+"",r;return function(){var s=yt(this,e);return s===i?null:s===o?r:r=t(o=s,n)}}function tu(e,t,n){var o,i,r;return function(){var s=yt(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),yt(this,e))),s===l?null:s===o&&l===i?r:(i=l,r=t(o=s,a))}}function nu(e,t){var n,o,i,r="style."+t,s="end."+r,a;return function(){var l=Oe(this,e),u=l.on,c=l.value[r]==null?a||(a=Li(t)):void 0;(u!==n||i!==c)&&(o=(n=u).copy()).on(s,i=c),l.on=o}}function ou(e,t,n){var o=(e+="")=="transform"?ol:Hi;return t==null?this.styleTween(e,jl(e,o)).on("end.style."+e,Li(e)):typeof t=="function"?this.styleTween(e,tu(e,o,uo(this,"style."+e,t))).each(nu(this._id,e)):this.styleTween(e,eu(e,o,t),n).on("end.style."+e,null)}function iu(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function ru(e,t,n){var o,i;function r(){var s=t.apply(this,arguments);return s!==i&&(o=(i=s)&&iu(e,s,n)),o}return r._value=t,r}function su(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,ru(e,t,n==null?"":n))}function au(e){return function(){this.textContent=e}}function lu(e){return function(){var t=e(this);this.textContent=t==null?"":t}}function uu(e){return this.tween("text",typeof e=="function"?lu(uo(this,"text",e)):au(e==null?"":e+""))}function cu(e){return function(t){this.textContent=e.call(this,t)}}function du(e){var t,n;function o(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&cu(i)),t}return o._value=e,o}function fu(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,du(e))}function hu(){for(var e=this._name,t=this._id,n=Fi(),o=this._groups,i=o.length,r=0;r<i;++r)for(var s=o[r],a=s.length,l,u=0;u<a;++u)if(l=s[u]){var c=Te(l,t);yn(l,e,n,u,s,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new Ge(o,this._parents,e,n)}function gu(){var e,t,n=this,o=n._id,i=n.size();return new Promise(function(r,s){var a={value:s},l={value:function(){--i===0&&r()}};n.each(function(){var u=Oe(this,o),c=u.on;c!==e&&(t=(e=c).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),u.on=t}),i===0&&r()})}var vu=0;function Ge(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Fi(){return++vu}var Be=Rt.prototype;Ge.prototype={constructor:Ge,select:Kl,selectAll:ql,selectChild:Be.selectChild,selectChildren:Be.selectChildren,filter:Fl,merge:Yl,selection:Ql,transition:hu,call:Be.call,nodes:Be.nodes,node:Be.node,size:Be.size,empty:Be.empty,each:Be.each,on:Ul,attr:Cl,attrTween:Pl,style:ou,styleTween:su,text:uu,textTween:fu,remove:Wl,tween:_l,delay:Al,duration:Bl,ease:Rl,easeVarying:Ll,end:gu,[Symbol.iterator]:Be[Symbol.iterator]};function pu(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var mu={time:null,delay:0,duration:250,ease:pu};function yu(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 _u(e){var t,n;e instanceof Ge?(t=e._id,e=e._name):(t=Fi(),(n=mu).time=ao(),e=e==null?null:e+"");for(var o=this._groups,i=o.length,r=0;r<i;++r)for(var s=o[r],a=s.length,l,u=0;u<a;++u)(l=s[u])&&yn(l,e,t,u,s,n||yu(l,t));return new Ge(o,this._parents,e,t)}Rt.prototype.interrupt=pl;Rt.prototype.transition=_u;const Wt=e=>()=>e;function wu(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 He(e,t,n){this.k=e,this.x=t,this.y=n}He.prototype={constructor:He,scale:function(e){return e===1?this:new He(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new He(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 wt=new He(1,0,0);He.prototype;function Tn(e){e.stopImmediatePropagation()}function St(e){e.preventDefault(),e.stopImmediatePropagation()}function bu(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function xu(){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 Vo(){return this.__zoom||wt}function Eu(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Su(){return navigator.maxTouchPoints||"ontouchstart"in this}function Nu(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],s=e.invertY(t[1][1])-n[1][1];return e.translate(i>o?(o+i)/2:Math.min(0,o)||Math.max(0,i),s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s))}function Cu(){var e=bu,t=xu,n=Nu,o=Eu,i=Su,r=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=ll,u=vn("start","zoom","end"),c,d,v,p=500,S=150,_=0,x=10;function N(m){m.property("__zoom",Vo).on("wheel.zoom",H,{passive:!1}).on("mousedown.zoom",J).on("dblclick.zoom",W).filter(i).on("touchstart.zoom",$).on("touchmove.zoom",b).on("touchend.zoom touchcancel.zoom",Q).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}N.transform=function(m,k,w,P){var A=m.selection?m.selection():m;A.property("__zoom",Vo),m!==A?z(m,k,w,P):A.interrupt().each(function(){Y(this,arguments).event(P).start().zoom(null,typeof k=="function"?k.apply(this,arguments):k).end()})},N.scaleBy=function(m,k,w,P){N.scaleTo(m,function(){var A=this.__zoom.k,B=typeof k=="function"?k.apply(this,arguments):k;return A*B},w,P)},N.scaleTo=function(m,k,w,P){N.transform(m,function(){var A=t.apply(this,arguments),B=this.__zoom,O=w==null?C(A):typeof w=="function"?w.apply(this,arguments):w,G=B.invert(O),K=typeof k=="function"?k.apply(this,arguments):k;return n(y(I(B,K),O,G),A,s)},w,P)},N.translateBy=function(m,k,w,P){N.transform(m,function(){return n(this.__zoom.translate(typeof k=="function"?k.apply(this,arguments):k,typeof w=="function"?w.apply(this,arguments):w),t.apply(this,arguments),s)},null,P)},N.translateTo=function(m,k,w,P,A){N.transform(m,function(){var B=t.apply(this,arguments),O=this.__zoom,G=P==null?C(B):typeof P=="function"?P.apply(this,arguments):P;return n(wt.translate(G[0],G[1]).scale(O.k).translate(typeof k=="function"?-k.apply(this,arguments):-k,typeof w=="function"?-w.apply(this,arguments):-w),B,s)},P,A)};function I(m,k){return k=Math.max(r[0],Math.min(r[1],k)),k===m.k?m:new He(k,m.x,m.y)}function y(m,k,w){var P=k[0]-w[0]*m.k,A=k[1]-w[1]*m.k;return P===m.x&&A===m.y?m:new He(m.k,P,A)}function C(m){return[(+m[0][0]+ +m[1][0])/2,(+m[0][1]+ +m[1][1])/2]}function z(m,k,w,P){m.on("start.zoom",function(){Y(this,arguments).event(P).start()}).on("interrupt.zoom end.zoom",function(){Y(this,arguments).event(P).end()}).tween("zoom",function(){var A=this,B=arguments,O=Y(A,B).event(P),G=t.apply(A,B),K=w==null?C(G):typeof w=="function"?w.apply(A,B):w,oe=Math.max(G[1][0]-G[0][0],G[1][1]-G[0][1]),V=A.__zoom,L=typeof k=="function"?k.apply(A,B):k,j=l(V.invert(K).concat(oe/V.k),L.invert(K).concat(oe/L.k));return function(ce){if(ce===1)ce=L;else{var de=j(ce),ie=oe/de[2];ce=new He(ie,K[0]-de[0]*ie,K[1]-de[1]*ie)}O.zoom(null,ce)}})}function Y(m,k,w){return!w&&m.__zooming||new U(m,k)}function U(m,k){this.that=m,this.args=k,this.active=0,this.sourceEvent=null,this.extent=t.apply(m,k),this.taps=0}U.prototype={event:function(m){return m&&(this.sourceEvent=m),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(m,k){return this.mouse&&m!=="mouse"&&(this.mouse[1]=k.invert(this.mouse[0])),this.touch0&&m!=="touch"&&(this.touch0[1]=k.invert(this.touch0[0])),this.touch1&&m!=="touch"&&(this.touch1[1]=k.invert(this.touch1[0])),this.that.__zoom=k,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(m){var k=Ie(this.that).datum();u.call(m,this.that,new wu(m,{sourceEvent:this.sourceEvent,target:N,transform:this.that.__zoom,dispatch:u}),k)}};function H(m,...k){if(!e.apply(this,arguments))return;var w=Y(this,k).event(m),P=this.__zoom,A=Math.max(r[0],Math.min(r[1],P.k*Math.pow(2,o.apply(this,arguments)))),B=Pe(m);if(w.wheel)(w.mouse[0][0]!==B[0]||w.mouse[0][1]!==B[1])&&(w.mouse[1]=P.invert(w.mouse[0]=B)),clearTimeout(w.wheel);else{if(P.k===A)return;w.mouse=[B,P.invert(B)],nn(this),w.start()}St(m),w.wheel=setTimeout(O,S),w.zoom("mouse",n(y(I(P,A),w.mouse[0],w.mouse[1]),w.extent,s));function O(){w.wheel=null,w.end()}}function J(m,...k){if(v||!e.apply(this,arguments))return;var w=m.currentTarget,P=Y(this,k,!0).event(m),A=Ie(m.view).on("mousemove.zoom",K,!0).on("mouseup.zoom",oe,!0),B=Pe(m,w),O=m.clientX,G=m.clientY;Ii(m.view),Tn(m),P.mouse=[B,this.__zoom.invert(B)],nn(this),P.start();function K(V){if(St(V),!P.moved){var L=V.clientX-O,j=V.clientY-G;P.moved=L*L+j*j>_}P.event(V).zoom("mouse",n(y(P.that.__zoom,P.mouse[0]=Pe(V,w),P.mouse[1]),P.extent,s))}function oe(V){A.on("mousemove.zoom mouseup.zoom",null),ki(V.view,P.moved),St(V),P.event(V).end()}}function W(m,...k){if(e.apply(this,arguments)){var w=this.__zoom,P=Pe(m.changedTouches?m.changedTouches[0]:m,this),A=w.invert(P),B=w.k*(m.shiftKey?.5:2),O=n(y(I(w,B),P,A),t.apply(this,k),s);St(m),a>0?Ie(this).transition().duration(a).call(z,O,P,m):Ie(this).call(N.transform,O,P,m)}}function $(m,...k){if(e.apply(this,arguments)){var w=m.touches,P=w.length,A=Y(this,k,m.changedTouches.length===P).event(m),B,O,G,K;for(Tn(m),O=0;O<P;++O)G=w[O],K=Pe(G,this),K=[K,this.__zoom.invert(K),G.identifier],A.touch0?!A.touch1&&A.touch0[2]!==K[2]&&(A.touch1=K,A.taps=0):(A.touch0=K,B=!0,A.taps=1+!!c);c&&(c=clearTimeout(c)),B&&(A.taps<2&&(d=K[0],c=setTimeout(function(){c=null},p)),nn(this),A.start())}}function b(m,...k){if(this.__zooming){var w=Y(this,k).event(m),P=m.changedTouches,A=P.length,B,O,G,K;for(St(m),B=0;B<A;++B)O=P[B],G=Pe(O,this),w.touch0&&w.touch0[2]===O.identifier?w.touch0[0]=G:w.touch1&&w.touch1[2]===O.identifier&&(w.touch1[0]=G);if(O=w.that.__zoom,w.touch1){var oe=w.touch0[0],V=w.touch0[1],L=w.touch1[0],j=w.touch1[1],ce=(ce=L[0]-oe[0])*ce+(ce=L[1]-oe[1])*ce,de=(de=j[0]-V[0])*de+(de=j[1]-V[1])*de;O=I(O,Math.sqrt(ce/de)),G=[(oe[0]+L[0])/2,(oe[1]+L[1])/2],K=[(V[0]+j[0])/2,(V[1]+j[1])/2]}else if(w.touch0)G=w.touch0[0],K=w.touch0[1];else return;w.zoom("touch",n(y(O,G,K),w.extent,s))}}function Q(m,...k){if(this.__zooming){var w=Y(this,k).event(m),P=m.changedTouches,A=P.length,B,O;for(Tn(m),v&&clearTimeout(v),v=setTimeout(function(){v=null},p),B=0;B<A;++B)O=P[B],w.touch0&&w.touch0[2]===O.identifier?delete w.touch0:w.touch1&&w.touch1[2]===O.identifier&&delete w.touch1;if(w.touch1&&!w.touch0&&(w.touch0=w.touch1,delete w.touch1),w.touch0)w.touch0[1]=this.__zoom.invert(w.touch0[0]);else if(w.end(),w.taps===2&&(O=Pe(O,this),Math.hypot(d[0]-O[0],d[1]-O[1])<x)){var G=Ie(this).on("dblclick.zoom");G&&G.apply(this,arguments)}}}return N.wheelDelta=function(m){return arguments.length?(o=typeof m=="function"?m:Wt(+m),N):o},N.filter=function(m){return arguments.length?(e=typeof m=="function"?m:Wt(!!m),N):e},N.touchable=function(m){return arguments.length?(i=typeof m=="function"?m:Wt(!!m),N):i},N.extent=function(m){return arguments.length?(t=typeof m=="function"?m:Wt([[+m[0][0],+m[0][1]],[+m[1][0],+m[1][1]]]),N):t},N.scaleExtent=function(m){return arguments.length?(r[0]=+m[0],r[1]=+m[1],N):[r[0],r[1]]},N.translateExtent=function(m){return arguments.length?(s[0][0]=+m[0][0],s[1][0]=+m[1][0],s[0][1]=+m[0][1],s[1][1]=+m[1][1],N):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},N.constrain=function(m){return arguments.length?(n=m,N):n},N.duration=function(m){return arguments.length?(a=+m,N):a},N.interpolate=function(m){return arguments.length?(l=m,N):l},N.on=function(){var m=u.on.apply(u,arguments);return m===u?N:m},N.clickDistance=function(m){return arguments.length?(_=(m=+m)*m,N):Math.sqrt(_)},N.tapDistance=function(m){return arguments.length?(x=+m,N):x},N}var Z=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(Z||{}),co=(e=>(e.Partial="partial",e.Full="full",e))(co||{}),et=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(et||{}),qe=(e=>(e.Strict="strict",e.Loose="loose",e))(qe||{}),qn=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(qn||{}),kt=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(kt||{});const Mu=["INPUT","SELECT","TEXTAREA"];function Jn(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==null?void 0:o.hasAttribute)=="function"?o.hasAttribute("contenteditable"):!1,r=typeof(o==null?void 0:o.closest)=="function"?o.closest(".nokey"):null;return Mu.includes(o==null?void 0:o.nodeName)||i||!!r}function Iu(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Ro(e,t,n,o){const i=t.replace("+",`
`).replace(`
`,`
+`).split(`
`).map(s=>s.trim().toLowerCase());if(i.length===1)return e.toLowerCase()===t.toLowerCase();o||n.add(e.toLowerCase());const r=i.every((s,a)=>n.has(s)&&Array.from(n.values())[a]===i[a]);return o&&n.delete(e.toLowerCase()),r}function ku(e,t){return n=>{if(!n.code&&!n.key)return!1;const o=Tu(n.code,e);return Array.isArray(e)?e.some(i=>Ro(n[o],i,t,n.type==="keyup")):Ro(n[o],e,t,n.type==="keyup")}}function Tu(e,t){return t.includes(e)?"code":"key"}function Tt(e,t){const n=_e(()=>{var d;return(d=ue(t==null?void 0:t.actInsideInputWithModifier))!=null?d:!1}),o=_e(()=>{var d;return(d=ue(t==null?void 0:t.target))!=null?d:window}),i=_e(()=>{var d;return(d=ue(t==null?void 0:t.preventDefault))!=null?d:!0}),r=pe(ue(e)===!0);let s=!1;const a=new Set;let l=c(ue(e));ve(()=>ue(e),(d,v)=>{typeof v=="boolean"&&typeof d!="boolean"&&u(),l=c(d)},{immediate:!0}),vi(["blur","contextmenu"],u),wo((...d)=>l(...d),d=>{var v,p;if(s=Iu(d),(!s||s&&!n.value)&&Jn(d))return;const _=((p=(v=d.composedPath)==null?void 0:v.call(d))==null?void 0:p[0])||d.target,x=(_==null?void 0:_.nodeName)==="BUTTON"||(_==null?void 0:_.nodeName)==="A";!i.value&&(s||!x)&&d.preventDefault(),r.value=!0},{eventName:"keydown",target:o}),wo((...d)=>l(...d),d=>{if(r.value){if((!s||s&&!n.value)&&Jn(d))return;s=!1,r.value=!1}},{eventName:"keyup",target:o});function u(){s=!1,a.clear(),r.value=ue(e)===!0}function c(d){return d===null?(u(),()=>!1):typeof d=="boolean"?(u(),r.value=d,()=>!1):Array.isArray(d)||typeof d=="string"?ku(d,a):d}return r}const Yi="vue-flow__node-desc",Gi="vue-flow__edge-desc",Pu="vue-flow__aria-live",Xi=["Enter"," ","Escape"],vt={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function cn(e){return fe(D({},e.computedPosition||{x:0,y:0}),{width:e.dimensions.width||0,height:e.dimensions.height||0})}function dn(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 _n(e){return{width:e.offsetWidth,height:e.offsetHeight}}function lt(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function Ui(e,t){return{x:lt(e.x,t[0][0],t[1][0]),y:lt(e.y,t[0][1],t[1][1])}}function Ho(e){const t=e.getRootNode();return"elementFromPoint"in t?t:window.document}function Je(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function it(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!Je(e)}function Mt(e){return it(e)&&"computedPosition"in e}function Kt(e){return!Number.isNaN(e)&&Number.isFinite(e)}function $u(e){return Kt(e.width)&&Kt(e.height)&&Kt(e.x)&&Kt(e.y)}function Du(e,t,n){var i;const o={id:e.id.toString(),type:(i=e.type)!=null?i:"default",dimensions:It({width:0,height:0}),computedPosition:It(D({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:Ee(e.data)?e.data:{},events:It(Ee(e.events)?e.events:{})};return Object.assign(t!=null?t:o,e,{id:e.id.toString(),parentNode:n})}function Zi(e,t,n){var s,a,l,u,c,d,v;var o,i;const r=D({id:e.id.toString(),type:(a=(s=e.type)!=null?s:t==null?void 0:t.type)!=null?a:"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:(l=e.updatable)!=null?l:n==null?void 0:n.updatable,selectable:(u=e.selectable)!=null?u:n==null?void 0:n.selectable,focusable:(c=e.focusable)!=null?c:n==null?void 0:n.focusable,data:Ee(e.data)?e.data:{},events:It(Ee(e.events)?e.events:{}),label:(d=e.label)!=null?d:"",interactionWidth:(v=e.interactionWidth)!=null?v:n==null?void 0:n.interactionWidth},n!=null?n:{});return Object.assign(t!=null?t:r,e,{id:e.id.toString()})}function Wi(e,t,n,o){const i=typeof e=="string"?e:e.id,r=new Set,s=o==="source"?"target":"source";for(const a of n)a[s]===i&&r.add(a[o]);return t.filter(a=>r.has(a.id))}function Au(...e){if(e.length===3){const[r,s,a]=e;return Wi(r,s,a,"target")}const[t,n]=e,o=typeof t=="string"?t:t.id;return n.filter(r=>Je(r)&&r.source===o).map(r=>n.find(s=>it(s)&&s.id===r.target))}function Ou(...e){if(e.length===3){const[r,s,a]=e;return Wi(r,s,a,"source")}const[t,n]=e,o=typeof t=="string"?t:t.id;return n.filter(r=>Je(r)&&r.target===o).map(r=>n.find(s=>it(s)&&s.id===r.source))}function Ki({source:e,sourceHandle:t,target:n,targetHandle:o}){return`vueflow__edge-${e}${t!=null?t:""}-${n}${o!=null?o:""}`}function zu(e,t){return t.some(n=>Je(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 Qn({x:e,y:t},{x:n,y:o,zoom:i}){return{x:e*i+n,y:t*i+o}}function zt({x:e,y:t},{x:n,y:o,zoom:i},r=!1,s=[1,1]){const a={x:(e-n)/i,y:(t-o)/i};return r?wn(a,s):a}function Bu(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 qi({x:e,y:t,width:n,height:o}){return{x:e,y:t,x2:e+n,y2:t+o}}function Vu({x:e,y:t,x2:n,y2:o}){return{x:e,y:t,width:n-e,height:o-t}}function Ji(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=Bu(t,qi(D(D({},o.computedPosition),o.dimensions)))}return Vu(t)}function Qi(e,t,n={x:0,y:0,zoom:1},o=!1,i=!1){var a,l,u,c;const r=fe(D({},zt(t,n)),{width:t.width/n.zoom,height:t.height/n.zoom}),s=[];for(const d of e){const{dimensions:v,selectable:p=!0,hidden:S=!1}=d,_=(l=(a=v.width)!=null?a:d.width)!=null?l:null,x=(c=(u=v.height)!=null?u:d.height)!=null?c:null;if(i&&!p||S)continue;const N=dn(r,cn(d)),I=_===null||x===null,y=o&&N>0,C=(_!=null?_:0)*(x!=null?x:0);(I||y||N>=C||d.dragging)&&s.push(d)}return s}function ji(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 Lo(e,t,n,o,i,r=.1,s={x:0,y:0}){var _,x;const a=t/(e.width*(1+r)),l=n/(e.height*(1+r)),u=Math.min(a,l),c=lt(u,o,i),d=e.x+e.width/2,v=e.y+e.height/2,p=t/2-d*c+((_=s.x)!=null?_:0),S=n/2-v*c+((x=s.y)!=null?x:0);return{x:p,y:S,zoom:c}}function Ru(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function er(e,t){if(!e.parentNode)return!1;const n=t(e.parentNode);return n?n.selected?!0:er(n,t):!1}function Bt(e,t){return typeof e=="undefined"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`}function Fo(e,t,n){return e<t?lt(Math.abs(e-t),1,t)/t:e>n?-lt(Math.abs(e-n),1,t)/t:0}function tr(e,t,n=15,o=40){const i=Fo(e.x,o,t.width-o)*n,r=Fo(e.y,o,t.height-o)*n;return[i,r]}function Pn(e,t){var n,o;if(t){const i=e.position.x+e.dimensions.width-t.dimensions.width,r=e.position.y+e.dimensions.height-t.dimensions.height;if(i>0||r>0||e.position.x<0||e.position.y<0){let s={};if(typeof t.style=="function"?s=D({},t.style(t)):t.style&&(s=D({},t.style)),s.width=(n=s.width)!=null?n:`${t.dimensions.width}px`,s.height=(o=s.height)!=null?o:`${t.dimensions.height}px`,i>0)if(typeof s.width=="string"){const a=Number(s.width.replace("px",""));s.width=`${a+i}px`}else s.width+=i;if(r>0)if(typeof s.height=="string"){const a=Number(s.height.replace("px",""));s.height=`${a+r}px`}else s.height+=r;if(e.position.x<0){const a=Math.abs(e.position.x);if(t.position.x=t.position.x-a,typeof s.width=="string"){const l=Number(s.width.replace("px",""));s.width=`${l+a}px`}else s.width+=a;e.position.x=0}if(e.position.y<0){const a=Math.abs(e.position.y);if(t.position.y=t.position.y-a,typeof s.height=="string"){const l=Number(s.height.replace("px",""));s.height=`${l+a}px`}else s.height+=a;e.position.y=0}t.dimensions.width=Number(s.width.toString().replace("px","")),t.dimensions.height=Number(s.height.toString().replace("px","")),typeof t.style=="function"?t.style=a=>{const l=t.style;return D(D({},l(a)),s)}:t.style=D(D({},t.style),s)}}}function Yo(e,t){var n,o;const i=e.filter(s=>s.type==="add"||s.type==="remove");for(const s of i)if(s.type==="add")t.findIndex(l=>l.id===s.item.id)===-1&&t.push(s.item);else if(s.type==="remove"){const a=t.findIndex(l=>l.id===s.id);a!==-1&&t.splice(a,1)}const r=t.map(s=>s.id);for(const s of t)for(const a of e)if(a.id===s.id)switch(a.type){case"select":s.selected=a.selected;break;case"position":if(Mt(s)&&(typeof a.position!="undefined"&&(s.position=a.position),typeof a.dragging!="undefined"&&(s.dragging=a.dragging),s.expandParent&&s.parentNode)){const l=t[r.indexOf(s.parentNode)];l&&Mt(l)&&Pn(s,l)}break;case"dimensions":if(Mt(s)&&(typeof a.dimensions!="undefined"&&(s.dimensions=a.dimensions),typeof a.updateStyle!="undefined"&&a.updateStyle&&(s.style=fe(D({},s.style||{}),{width:`${(n=a.dimensions)==null?void 0:n.width}px`,height:`${(o=a.dimensions)==null?void 0:o.height}px`})),typeof a.resizing!="undefined"&&(s.resizing=a.resizing),s.expandParent&&s.parentNode)){const l=t[r.indexOf(s.parentNode)];l&&Mt(l)&&(!!l.dimensions.width&&!!l.dimensions.height?Pn(s,l):Le(()=>{Pn(s,l)}))}break}return t}function Ue(e,t){return{id:e,type:"select",selected:t}}function Go(e){return{item:e,type:"add"}}function Xo(e){return{id:e,type:"remove"}}function Uo(e,t,n,o,i){return{id:e,source:t,target:n,sourceHandle:o||null,targetHandle:i||null,type:"remove"}}function We(e,t=new Set,n=!1){const o=[];for(const[i,r]of e){const s=t.has(i);!(r.selected===void 0&&!s)&&r.selected!==s&&(n&&(r.selected=s),o.push(Ue(r.id,s)))}return o}function R(e){const t=new Set;let n=!1;const o=()=>t.size>0;e&&(n=!0,t.add(e));const i=a=>{t.delete(a)};return{on:a=>{e&&n&&t.delete(e),t.add(a);const l=()=>{i(a),e&&n&&t.add(e)};return gn(l),{off:l}},off:i,trigger:a=>Promise.all(Array.from(t).map(l=>l(a))),hasListeners:o,fns:t}}function Zo(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 Hu(e,t,n,o,i){var r,s;const a=[];for(const l of e)(l.selected||l.id===i)&&(!l.parentNode||!er(l,o))&&(l.draggable||t&&typeof l.draggable=="undefined")&&a.push(It({id:l.id,position:l.position||{x:0,y:0},distance:{x:n.x-((r=l.computedPosition)==null?void 0:r.x)||0,y:n.y-((s=l.computedPosition)==null?void 0:s.y)||0},from:l.computedPosition,extent:l.extent,parentNode:l.parentNode,dimensions:l.dimensions,expandParent:l.expandParent}));return a}function $n({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 nr(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 Lu(e,t,n){const[o,i,r,s]=typeof e!="string"?nr(e.padding):[0,0,0,0];return n&&typeof n.computedPosition.x!="undefined"&&typeof n.computedPosition.y!="undefined"&&typeof n.dimensions.width!="undefined"&&typeof n.dimensions.height!="undefined"?[[n.computedPosition.x+s,n.computedPosition.y+o],[n.computedPosition.x+n.dimensions.width-i,n.computedPosition.y+n.dimensions.height-r]]:!1}function Fu(e,t,n,o){let i=e.extent||n;if((i==="parent"||!Array.isArray(i)&&(i==null?void 0:i.range)==="parent")&&!e.expandParent)if(e.parentNode&&o&&e.dimensions.width&&e.dimensions.height){const r=Lu(i,e,o);r&&(i=r)}else t(new Ne(Se.NODE_EXTENT_INVALID,e.id)),i=n;else if(Array.isArray(i)){const r=(o==null?void 0:o.computedPosition.x)||0,s=(o==null?void 0:o.computedPosition.y)||0;i=[[i[0][0]+r,i[0][1]+s],[i[1][0]+r,i[1][1]+s]]}else if(i!=="parent"&&(i!=null&&i.range)&&Array.isArray(i.range)){const[r,s,a,l]=nr(i.padding),u=(o==null?void 0:o.computedPosition.x)||0,c=(o==null?void 0:o.computedPosition.y)||0;i=[[i.range[0][0]+u+l,i.range[0][1]+c+r],[i.range[1][0]+u-s,i.range[1][1]+c-a]]}return i==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:i}function Yu({width:e,height:t},n){return[n[0],[n[1][0]-(e||0),n[1][1]-(t||0)]]}function fo(e,t,n,o,i){const r=Yu(e.dimensions,Fu(e,n,o,i)),s=Ui(t,r);return{position:{x:s.x-((i==null?void 0:i.computedPosition.x)||0),y:s.y-((i==null?void 0:i.computedPosition.y)||0)},computedPosition:s}}function bt(e,t,n=Z.Left,o=!1){var u,c,d;const i=((u=t==null?void 0:t.x)!=null?u:0)+e.computedPosition.x,r=((c=t==null?void 0:t.y)!=null?c:0)+e.computedPosition.y,{width:s,height:a}=t!=null?t:Zu(e);if(o)return{x:i+s/2,y:r+a/2};switch((d=t==null?void 0:t.position)!=null?d:n){case Z.Top:return{x:i+s/2,y:r};case Z.Right:return{x:i+s,y:r+a/2};case Z.Bottom:return{x:i+s/2,y:r+a};case Z.Left:return{x:i,y:r+a/2}}}function Wo(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Gu({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:o,targetWidth:i,targetHeight:r,width:s,height:a,viewport:l}){const u={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)};u.x===u.x2&&(u.x2+=1),u.y===u.y2&&(u.y2+=1);const c=qi({x:(0-l.x)/l.zoom,y:(0-l.y)/l.zoom,width:s/l.zoom,height:a/l.zoom}),d=Math.max(0,Math.min(c.x2,u.x2)-Math.max(c.x,u.x)),v=Math.max(0,Math.min(c.y2,u.y2)-Math.max(c.y,u.y));return Math.ceil(d*v)>0}function Xu(e,t,n=!1){const o=typeof e.zIndex=="number";let i=o?e.zIndex:0;const r=t(e.source),s=t(e.target);return!r||!s?0:(n&&(i=o?e.zIndex:Math.max(r.computedPosition.z||0,s.computedPosition.z||0)),i)}var Se=(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))(Se||{});const Ko={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
Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found
Node: ${e}`,NODE_MISSING_PARENT:(e,t)=>`Node is missing a parent
Node: ${e}
Parent: ${t}`,NODE_TYPE_MISSING:e=>`Node type is missing
Type: ${e}`,NODE_EXTENT_INVALID:e=>`Only child nodes can use a parent extent
Node: ${e}`,EDGE_INVALID:e=>`An edge needs a source and a target
Edge: ${e}`,EDGE_SOURCE_MISSING:(e,t)=>`Edge source is missing
Edge: ${e}
Source: ${t}`,EDGE_TARGET_MISSING:(e,t)=>`Edge target is missing
Edge: ${e}
Target: ${t}`,EDGE_TYPE_MISSING:e=>`Edge type is missing
Type: ${e}`,EDGE_SOURCE_TARGET_SAME:(e,t,n)=>`Edge source and target are the same
Edge: ${e}
Source: ${t}
Target: ${n}`,EDGE_SOURCE_TARGET_MISSING:(e,t,n)=>`Edge source or target is missing
Edge: ${e}
Source: ${t}
Target: ${n}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found
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 Ne extends Error{constructor(t,...n){var o;super((o=Ko[t])==null?void 0:o.call(Ko,...n)),this.name="VueFlowError",this.code=t,this.args=n}}function ho(e){return"clientX"in e}function Uu(e){return"sourceEvent"in e}function Ke(e,t){var a,l;var n,o;const i=ho(e),r=i?e.clientX:(n=e.touches)==null?void 0:n[0].clientX,s=i?e.clientY:(o=e.touches)==null?void 0:o[0].clientY;return{x:r-((a=t==null?void 0:t.left)!=null?a:0),y:s-((l=t==null?void 0:t.top)!=null?l:0)}}const fn=()=>{var e;return typeof navigator!="undefined"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Zu(e){var o,i,r,s;var t,n;return{width:(i=(o=(t=e.dimensions)==null?void 0:t.width)!=null?o:e.width)!=null?i:0,height:(s=(r=(n=e.dimensions)==null?void 0:n.height)!=null?r:e.height)!=null?s:0}}function wn(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}const Wu=()=>!0;function Dn(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function Ku(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())dn(i,cn(r))>0&&o.push(r);return o}const qu=250;function Ju(e,t,n,o){var u,c,d;var i,r;let s=[],a=Number.POSITIVE_INFINITY;const l=Ku(e,n,t+qu);for(const v of l){const p=[...(u=(i=v.handleBounds)==null?void 0:i.source)!=null?u:[],...(c=(r=v.handleBounds)==null?void 0:r.target)!=null?c:[]];for(const S of p){if(o.nodeId===S.nodeId&&o.type===S.type&&o.id===S.id)continue;const{x:_,y:x}=bt(v,S,S.position,!0),N=Math.sqrt(ct(_-e.x,2)+ct(x-e.y,2));N>t||(N<a?(s=[fe(D({},S),{x:_,y:x})],a=N):N===a&&s.push(fe(D({},S),{x:_,y:x})))}}if(!s.length)return null;if(s.length>1){const v=o.type==="source"?"target":"source";return(d=s.find(p=>p.type===v))!=null?d:s[0]}return s[0]}function qo(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:i,fromType:r,doc:s,lib:a,flowId:l,isValidConnection:u=Wu},c,d,v){const p=r==="target",S=t?s.querySelector(`.${a}-flow__handle[data-id="${l}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:_,y:x}=Ke(e),N=s.elementFromPoint(_,x),I=N!=null&&N.classList.contains(`${a}-flow__handle`)?N:S,y={handleDomNode:I,isValid:!1,connection:null,toHandle:null};if(I){const C=or(void 0,I),z=I.getAttribute("data-nodeid"),Y=I.getAttribute("data-handleid"),U=I.classList.contains("connectable"),H=I.classList.contains("connectableend");if(!z||!C)return y;const J={source:p?z:o,sourceHandle:p?Y:i,target:p?o:z,targetHandle:p?i:Y};y.connection=J;const $=U&&H&&(n===qe.Strict?p&&C==="source"||!p&&C==="target":z!==o||Y!==i);y.isValid=$&&u(J,{nodes:d,edges:c,sourceNode:v(o),targetNode:v(z)}),y.toHandle=t}return y}function or(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Qu(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function ju(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function ec(e,t,n,o,i,r=!1){var v,p,S;var s,a,l;const u=o.get(e);if(!u)return null;const c=i===qe.Strict?(s=u.handleBounds)==null?void 0:s[t]:[...(v=(a=u.handleBounds)==null?void 0:a.source)!=null?v:[],...(p=(l=u.handleBounds)==null?void 0:l.target)!=null?p:[]],d=(S=n?c==null?void 0:c.find(_=>_.id===n):c==null?void 0:c[0])!=null?S:null;return d&&r?D(D({},d),bt(u,d,d.position,!0)):d}const jn={[Z.Left]:Z.Right,[Z.Right]:Z.Left,[Z.Top]:Z.Bottom,[Z.Bottom]:Z.Top},tc=["production","prod"];function Lt(e,...t){ir()&&console.warn(`[Vue Flow]: ${e}`,...t)}function ir(){return!tc.includes("production")}function Jo(e,t,n,o){const i=t.querySelectorAll(`.vue-flow__handle.${e}`);return Array.from(i).map(s=>{const a=s.getBoundingClientRect();return D({id:s.getAttribute("data-handleid"),position:s.getAttribute("data-handlepos"),nodeId:s.getAttribute("data-nodeid"),type:e,x:(a.left-n.left)/o,y:(a.top-n.top)/o},_n(s))})}function eo(e,t,n,o,i,r=!1,s){i.value=!1,e.selected?(r||e.selected&&t)&&(o([e]),Le(()=>{s.blur()})):n([e])}function Ee(e){return typeof te(e)!="undefined"}function nc(e,t,n,o){var r;if(!e||!e.source||!e.target)return n(new Ne(Se.EDGE_INVALID,(r=e==null?void 0:e.id)!=null?r:"[ID UNKNOWN]")),!1;let i;return Je(e)?i=e:i=fe(D({},e),{id:Ki(e)}),i=Zi(i,void 0,o),zu(i,t)?!1:i}function oc(e,t,n,o,i){if(!t.source||!t.target)return i(new Ne(Se.EDGE_INVALID,e.id)),!1;if(!n)return i(new Ne(Se.EDGE_NOT_FOUND,e.id)),!1;const a=e,{id:r}=a,s=dt(a,["id"]);return fe(D({},s),{id:o?Ki(t):r,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle})}function Qo(e,t,n){const o={},i=[];for(let r=0;r<e.length;++r){const s=e[r];if(!it(s)){n(new Ne(Se.NODE_INVALID,s==null?void 0:s.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const a=Du(s,t(s.id),s.parentNode);s.parentNode&&(o[s.parentNode]=!0),i[r]=a}for(const r of i){const s=t(r.parentNode)||i.find(a=>a.id===r.parentNode);r.parentNode&&!s&&n(new Ne(Se.NODE_MISSING_PARENT,r.id,r.parentNode)),(r.parentNode||o[r.id])&&(o[r.id]&&(r.isParent=!0),s&&(s.isParent=!0))}return i}function jo(e,t,n,o,i,r){let s=i;const a=o.get(s)||new Map;o.set(s,a.set(n,t)),s=`${i}-${e}`;const l=o.get(s)||new Map;if(o.set(s,l.set(n,t)),r){s=`${i}-${e}-${r}`;const u=o.get(s)||new Map;o.set(s,u.set(n,t))}}function An(e,t,n){e.clear();for(const o of n){const{source:i,target:r,sourceHandle:s=null,targetHandle:a=null}=o,l={edgeId:o.id,source:i,target:r,sourceHandle:s,targetHandle:a},u=`${i}-${s}--${r}-${a}`,c=`${r}-${a}--${i}-${s}`;jo("source",l,c,e,i,s),jo("target",l,u,e,r,a)}}function ei(e,t,n){if(!n)return;const o=[];for(const i of e.keys())t.has(i)||o.push(e.get(i));o.length&&n(o)}function ic(e,t){if(!e&&!t)return!0;if(!e||!t||e.size!==t.size)return!1;if(!e.size&&!t.size)return!0;for(const n of e.keys())if(!t.has(n))return!1;return!0}function ti(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function On(e,t,n,o,i,r,s,a){const l=[];for(const u of e){const c=Je(u)?u:nc(u,a,i,r);if(!c)continue;const d=n(c.source),v=n(c.target);if(!d||!v){i(new Ne(Se.EDGE_SOURCE_TARGET_MISSING,c.id,c.source,c.target));continue}if(!d){i(new Ne(Se.EDGE_SOURCE_MISSING,c.id,c.source));continue}if(!v){i(new Ne(Se.EDGE_TARGET_MISSING,c.id,c.target));continue}if(t&&!t(c,{edges:a,nodes:s,sourceNode:d,targetNode:v})){i(new Ne(Se.EDGE_INVALID,c.id));continue}const p=o(c.id);l.push(fe(D({},Zi(c,p,r)),{sourceNode:d,targetNode:v}))}return l}const ni=Symbol("vueFlow"),rr=Symbol("nodeId"),sr=Symbol("nodeRef"),rc=Symbol("edgeId"),sc=Symbol("edgeRef"),bn=Symbol("slots");function ar(e){const{vueFlowRef:t,snapToGrid:n,snapGrid:o,noDragClassName:i,nodes:r,nodeExtent:s,nodeDragThreshold:a,viewport:l,autoPanOnNodeDrag:u,autoPanSpeed:c,nodesDraggable:d,panBy:v,findNode:p,multiSelectionActive:S,nodesSelectionActive:_,selectNodesOnDrag:x,removeSelectedElements:N,addSelectedNodes:I,updateNodePositions:y,emits:C}=we(),{onStart:z,onDrag:Y,onStop:U,onClick:H,el:J,disabled:W,id:$,selectable:b,dragHandle:Q}=e,m=pe(!1);let k=[],w,P=null,A={x:void 0,y:void 0},B={x:0,y:0},O=null,G=!1,K=0,oe=!1;const V=uc(),L=({x:ee,y:se})=>{A={x:ee,y:se};let le=!1;if(k=k.map(g=>{const f={x:ee-g.distance.x,y:se-g.distance.y},{computedPosition:h}=fo(g,n.value?wn(f,o.value):f,C.error,s.value,g.parentNode?p(g.parentNode):void 0);return le=le||g.position.x!==h.x||g.position.y!==h.y,g.position=h,g}),!!le&&(y(k,!0,!0),m.value=!0,O)){const[g,f]=$n({id:$,dragItems:k,findNode:p});Y({event:O,node:g,nodes:f})}},j=()=>{var le,g;if(!P)return;const[ee,se]=tr(B,P,c.value);if(ee!==0||se!==0){const f={x:((le=A.x)!=null?le:0)-ee/l.value.zoom,y:((g=A.y)!=null?g:0)-se/l.value.zoom};v({x:ee,y:se})&&L(f)}K=requestAnimationFrame(j)},ce=(ee,se)=>{G=!0;const le=p($);!x.value&&!S.value&&le&&(le.selected||N()),le&&ue(b)&&x.value&&eo(le,S.value,I,N,_,!1,se);const g=V(ee.sourceEvent);if(A=g,k=Hu(r.value,d.value,g,p,$),k.length){const[f,h]=$n({id:$,dragItems:k,findNode:p});z({event:ee.sourceEvent,node:f,nodes:h})}},de=(ee,se)=>{var le;ee.sourceEvent.type==="touchmove"&&ee.sourceEvent.touches.length>1||(a.value===0&&ce(ee,se),A=V(ee.sourceEvent),P=((le=t.value)==null?void 0:le.getBoundingClientRect())||null,B=Ke(ee.sourceEvent,P))},ie=(ee,se)=>{var g,f;const le=V(ee.sourceEvent);if(!oe&&G&&u.value&&(oe=!0,j()),!G){const h=le.xSnapped-((g=A.x)!=null?g:0),E=le.ySnapped-((f=A.y)!=null?f:0);Math.sqrt(h*h+E*E)>a.value&&ce(ee,se)}(A.x!==le.xSnapped||A.y!==le.ySnapped)&&k.length&&G&&(O=ee.sourceEvent,B=Ke(ee.sourceEvent,P),L(le))},he=ee=>{var le,g;let se=!1;if(!G&&!m.value&&!S.value){const f=ee.sourceEvent,h=V(f),E=h.xSnapped-((le=A.x)!=null?le:0),T=h.ySnapped-((g=A.y)!=null?g:0),F=Math.sqrt(E*E+T*T);F!==0&&F<=a.value&&(H==null||H(f),se=!0)}if(k.length&&!se){y(k,!1,!1);const[f,h]=$n({id:$,dragItems:k,findNode:p});U({event:ee.sourceEvent,node:f,nodes:h})}k=[],m.value=!1,oe=!1,G=!1,A={x:void 0,y:void 0},cancelAnimationFrame(K)};return ve([()=>ue(W),J],([ee,se],le,g)=>{if(se){const f=Ie(se);ee||(w=za().on("start",h=>de(h,se)).on("drag",h=>ie(h,se)).on("end",h=>he(h)).filter(h=>{const E=h.target,T=ue(Q);return!h.button&&(!i.value||!Zo(E,`.${i.value}`,se)&&(!T||Zo(E,T,se)))}),f.call(w)),g(()=>{f.on(".drag",null),w&&(w.on("start",null),w.on("drag",null),w.on("end",null))})}}),m}function ac(){return{doubleClick:R(),click:R(),mouseEnter:R(),mouseMove:R(),mouseLeave:R(),contextMenu:R(),updateStart:R(),update:R(),updateEnd:R()}}function lc(e,t){const n=ac();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 uc(){const{viewport:e,snapGrid:t,snapToGrid:n}=we();return o=>{const i=Uu(o)?o.sourceEvent:o,{x:r,y:s}=Ke(i),a=zt({x:r,y:s},e.value),{x:l,y:u}=n.value?wn(a,t.value):a;return D({xSnapped:l,ySnapped:u},a)}}function qt(){return!0}function lr({handleId:e,nodeId:t,type:n,isValidConnection:o,edgeUpdaterType:i,onEdgeUpdate:r,onEdgeUpdateEnd:s}){const{id:a,vueFlowRef:l,connectionMode:u,connectionRadius:c,connectOnClick:d,connectionClickStartHandle:v,nodesConnectable:p,autoPanOnConnect:S,autoPanSpeed:_,findNode:x,panBy:N,startConnection:I,updateConnection:y,endConnection:C,emits:z,viewport:Y,edges:U,nodes:H,isValidConnection:J,nodeLookup:W}=we();let $=null,b=!1,Q=null;function m(w){var P;const A=ue(n)==="target",B=ho(w),O=Ho(w.target);if(B&&w.button===0||!B){let G=function(q){g=Ke(q,ee),L=Ju(zt(g,Y.value,!1,[1,1]),c.value,W.value,E),f||(h(),f=!0);const re=qo(q,{handle:L,connectionMode:u.value,fromNodeId:ue(t),fromHandleId:ue(e),fromType:A?"target":"source",isValidConnection:V,doc:O,lib:"vue",flowId:a,nodeLookup:W.value},U.value,H.value,x);Q=re.handleDomNode,$=re.connection,b=ju(!!L,re.isValid);const ne=fe(D({},X),{isValid:b,to:L&&b?Qn({x:L.x,y:L.y},Y.value):g,toHandle:re.toHandle,toPosition:b&&re.toHandle?re.toHandle.position:jn[E.position],toNode:re.toHandle?W.value.get(re.toHandle.nodeId):null});if(!(b&&L&&(X!=null&&X.toHandle)&&ne.toHandle&&X.toHandle.type===ne.toHandle.type&&X.toHandle.nodeId===ne.toHandle.nodeId&&X.toHandle.id===ne.toHandle.id&&X.to.x===ne.to.x&&X.to.y===ne.to.y)){if(y(L&&b?Qn({x:L.x,y:L.y},Y.value):g,re.toHandle,Qu(!!L,b)),X=ne,!L&&!b&&!Q)return Dn(le);$&&$.source!==$.target&&Q&&(Dn(le),le=Q,Q.classList.add("connecting","vue-flow__handle-connecting"),Q.classList.toggle("valid",!!b),Q.classList.toggle("vue-flow__handle-valid",!!b))}},K=function(q){(L||Q)&&$&&b&&(r?r(q,$):z.connect($)),z.connectEnd(q),i&&(s==null||s(q)),Dn(le),cancelAnimationFrame(j),C(q),f=!1,b=!1,$=null,Q=null,O.removeEventListener("mousemove",G),O.removeEventListener("mouseup",K),O.removeEventListener("touchmove",G),O.removeEventListener("touchend",K)};const oe=x(ue(t));let V=ue(o)||J.value||qt;!V&&oe&&(V=(A?oe.isValidSourcePos:oe.isValidTargetPos)||qt);let L,j=0;const{x:ce,y:de}=Ke(w),ie=O==null?void 0:O.elementFromPoint(ce,de),he=or(ue(i),ie),ee=(P=l.value)==null?void 0:P.getBoundingClientRect();if(!ee||!he)return;const se=ec(ue(t),he,ue(e),W.value,u.value);if(!se)return;let le,g=Ke(w,ee),f=!1;const h=()=>{if(!S.value)return;const[q,re]=tr(g,ee,_.value);N({x:q,y:re}),j=requestAnimationFrame(h)},E=fe(D({},se),{nodeId:ue(t),type:he,position:se.position}),T=W.value.get(ue(t)),M={inProgress:!0,isValid:null,from:bt(T,E,Z.Left,!0),fromHandle:E,fromPosition:E.position,fromNode:T,to:g,toHandle:null,toPosition:jn[E.position],toNode:null};I({nodeId:ue(t),id:ue(e),type:he,position:(ie==null?void 0:ie.getAttribute("data-handlepos"))||Z.Top},{x:ce-ee.left,y:de-ee.top}),z.connectStart({event:w,nodeId:ue(t),handleId:ue(e),handleType:he});let X=M;O.addEventListener("mousemove",G),O.addEventListener("mouseup",K),O.addEventListener("touchmove",G),O.addEventListener("touchend",K)}}function k(w){var P,A;if(!d.value)return;const B=ue(n)==="target";if(!v.value){z.clickConnectStart({event:w,nodeId:ue(t),handleId:ue(e)}),I({nodeId:ue(t),type:ue(n),id:ue(e),position:Z.Top},void 0,!0);return}let O=ue(o)||J.value||qt;const G=x(ue(t));if(!O&&G&&(O=(B?G.isValidSourcePos:G.isValidTargetPos)||qt),G&&(typeof G.connectable=="undefined"?p.value:G.connectable)===!1)return;const K=Ho(w.target),oe=qo(w,{handle:{nodeId:ue(t),id:ue(e),type:ue(n),position:Z.Top},connectionMode:u.value,fromNodeId:v.value.nodeId,fromHandleId:v.value.id||null,fromType:v.value.type,isValidConnection:O,doc:K,lib:"vue",flowId:a,nodeLookup:W.value},U.value,H.value,x),V=((P=oe.connection)==null?void 0:P.source)===((A=oe.connection)==null?void 0:A.target);oe.isValid&&oe.connection&&!V&&z.connect(oe.connection),z.clickConnectEnd(w),C(w,!0)}return{handlePointerDown:m,handleClick:k}}function ur(){return xt(rr,"")}function cr(e){var a;const t=(a=e!=null?e:ur())!=null?a:"",n=xt(sr,pe(null)),{findNode:o,edges:i,emits:r}=we(),s=o(t);return s||r.error(new Ne(Se.NODE_NOT_FOUND,t)),{id:t,nodeEl:n,node:s,parentNode:ae(()=>o(s.parentNode)),connectedEdges:ae(()=>ji([s],i.value))}}function cc(){return{doubleClick:R(),click:R(),mouseEnter:R(),mouseMove:R(),mouseLeave:R(),contextMenu:R(),dragStart:R(),drag:R(),dragStop:R()}}function dc(e,t){const n=cc();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 dr(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:n,findNode:o,snapGrid:i,snapToGrid:r,nodesDraggable:s,emits:a}=we();return(l,u=!1)=>{const c=r.value?i.value[0]:5,d=r.value?i.value[1]:5,v=u?4:1,p=l.x*c*v,S=l.y*d*v,_=[];for(const x of e.value)if(x.draggable||s&&typeof x.draggable=="undefined"){const N={x:x.computedPosition.x+p,y:x.computedPosition.y+S},{computedPosition:I}=fo(x,N,a.error,t.value,x.parentNode?o(x.parentNode):void 0);_.push({id:x.id,position:I,from:x.position,distance:{x:l.x,y:l.y},dimensions:x.dimensions})}n(_,!0,!1)}}const zn=.1;function Xe(){return Lt("Viewport not initialized yet."),Promise.resolve(!1)}const fc={zoomIn:Xe,zoomOut:Xe,zoomTo:Xe,fitView:Xe,setCenter:Xe,fitBounds:Xe,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Xe,setTransform:Xe,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function hc(e){function t(o,i){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.scaleBy(Bn(e.d3Selection,i,()=>{r(!0)}),o):r(!1)})}function n(o,i,r,s){return new Promise(a=>{const{x:l,y:u}=Ui({x:-o,y:-i},e.translateExtent),c=wt.translate(-l,-u).scale(r);e.d3Selection&&e.d3Zoom?e.d3Zoom.transform(Bn(e.d3Selection,s,()=>{a(!0)}),c):a(!1)})}return ae(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:i=>t(1.2,i==null?void 0:i.duration),zoomOut:i=>t(1/1.2,i==null?void 0:i.duration),zoomTo:(i,r)=>new Promise(s=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.scaleTo(Bn(e.d3Selection,r==null?void 0:r.duration,()=>{s(!0)}),i):s(!1)}),setViewport:(i,r)=>n(i.x,i.y,i.zoom,r==null?void 0:r.duration),setTransform:(i,r)=>n(i.x,i.y,i.zoom,r==null?void 0:r.duration),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:zn,includeHiddenNodes:!1,duration:0})=>{var v,p,S;var r,s;const a=[];for(const _ of e.nodes)_.dimensions.width&&_.dimensions.height&&((i==null?void 0:i.includeHiddenNodes)||!_.hidden)&&(!((r=i.nodes)!=null&&r.length)||(s=i.nodes)!=null&&s.length&&i.nodes.includes(_.id))&&a.push(_);if(!a.length)return Promise.resolve(!1);const l=Ji(a),{x:u,y:c,zoom:d}=Lo(l,e.dimensions.width,e.dimensions.height,(v=i.minZoom)!=null?v:e.minZoom,(p=i.maxZoom)!=null?p:e.maxZoom,(S=i.padding)!=null?S:zn,i.offset);return n(u,c,d,i==null?void 0:i.duration)},setCenter:(i,r,s)=>{const a=typeof(s==null?void 0:s.zoom)!="undefined"?s.zoom:e.maxZoom,l=e.dimensions.width/2-i*a,u=e.dimensions.height/2-r*a;return n(l,u,a,s==null?void 0:s.duration)},fitBounds:(i,r={padding:zn})=>{const{x:s,y:a,zoom:l}=Lo(i,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding);return n(s,a,l,r==null?void 0:r.duration)},project:i=>zt(i,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:i=>{if(e.vueFlowRef){const{x:r,y:s}=e.vueFlowRef.getBoundingClientRect(),a={x:i.x-r,y:i.y-s};return zt(a,e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:i=>{if(e.vueFlowRef){const{x:r,y:s}=e.vueFlowRef.getBoundingClientRect(),a={x:i.x+r,y:i.y+s};return Qn(a,e.viewport)}return{x:0,y:0}}}:fc)}function Bn(e,t=0,n){return e.transition().duration(t).on("end",n)}function gc(e,t,n){const o=ui(!0);return o.run(()=>{const i=()=>{o.run(()=>{let _,x,N=!!(n.nodes.value.length||n.edges.value.length);_=ft([e.modelValue,()=>{var I,y;return(y=(I=e.modelValue)==null?void 0:I.value)==null?void 0:y.length}],([I])=>{I&&Array.isArray(I)&&(x==null||x.pause(),n.setElements(I),!x&&!N&&I.length?N=!0:x==null||x.resume())}),x=ft([n.nodes,n.edges,()=>n.edges.value.length,()=>n.nodes.value.length],([I,y])=>{var C;(C=e.modelValue)!=null&&C.value&&Array.isArray(e.modelValue.value)&&(_==null||_.pause(),e.modelValue.value=[...I,...y],Le(()=>{_==null||_.resume()}))},{immediate:N}),Qt(()=>{_==null||_.stop(),x==null||x.stop()})})},r=()=>{o.run(()=>{let _,x,N=!!n.nodes.value.length;_=ft([e.nodes,()=>{var I,y;return(y=(I=e.nodes)==null?void 0:I.value)==null?void 0:y.length}],([I])=>{I&&Array.isArray(I)&&(x==null||x.pause(),n.setNodes(I),!x&&!N&&I.length?N=!0:x==null||x.resume())}),x=ft([n.nodes,()=>n.nodes.value.length],([I])=>{var y;(y=e.nodes)!=null&&y.value&&Array.isArray(e.nodes.value)&&(_==null||_.pause(),e.nodes.value=[...I],Le(()=>{_==null||_.resume()}))},{immediate:N}),Qt(()=>{_==null||_.stop(),x==null||x.stop()})})},s=()=>{o.run(()=>{let _,x,N=!!n.edges.value.length;_=ft([e.edges,()=>{var I,y;return(y=(I=e.edges)==null?void 0:I.value)==null?void 0:y.length}],([I])=>{I&&Array.isArray(I)&&(x==null||x.pause(),n.setEdges(I),!x&&!N&&I.length?N=!0:x==null||x.resume())}),x=ft([n.edges,()=>n.edges.value.length],([I])=>{var y;(y=e.edges)!=null&&y.value&&Array.isArray(e.edges.value)&&(_==null||_.pause(),e.edges.value=[...I],Le(()=>{_==null||_.resume()}))},{immediate:N}),Qt(()=>{_==null||_.stop(),x==null||x.stop()})})},a=()=>{o.run(()=>{ve(()=>t.maxZoom,()=>{t.maxZoom&&Ee(t.maxZoom)&&n.setMaxZoom(t.maxZoom)},{immediate:!0})})},l=()=>{o.run(()=>{ve(()=>t.minZoom,()=>{t.minZoom&&Ee(t.minZoom)&&n.setMinZoom(t.minZoom)},{immediate:!0})})},u=()=>{o.run(()=>{ve(()=>t.translateExtent,()=>{t.translateExtent&&Ee(t.translateExtent)&&n.setTranslateExtent(t.translateExtent)},{immediate:!0})})},c=()=>{o.run(()=>{ve(()=>t.nodeExtent,()=>{t.nodeExtent&&Ee(t.nodeExtent)&&n.setNodeExtent(t.nodeExtent)},{immediate:!0})})},d=()=>{o.run(()=>{ve(()=>t.applyDefault,()=>{Ee(t.applyDefault)&&(n.applyDefault.value=t.applyDefault)},{immediate:!0})})},v=()=>{o.run(()=>{const _=x=>yo(this,null,function*(){let N=x;typeof t.autoConnect=="function"&&(N=yield t.autoConnect(x)),N!==!1&&n.addEdges([N])});ve(()=>t.autoConnect,()=>{Ee(t.autoConnect)&&(n.autoConnect.value=t.autoConnect)},{immediate:!0}),ve(n.autoConnect,(x,N,I)=>{x?n.onConnect(_):n.hooks.value.connect.off(_),I(()=>{n.hooks.value.connect.off(_)})},{immediate:!0})})},p=()=>{const _=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const x of Object.keys(t)){const N=x;if(!_.includes(N)){const I=_e(()=>t[N]),y=n[N];oo(y)&&o.run(()=>{ve(I,C=>{Ee(C)&&(y.value=C)},{immediate:!0})})}}};(()=>{i(),r(),s(),l(),a(),u(),c(),d(),v(),p()})()}),()=>o.stop()}function vc(){return{edgesChange:R(),nodesChange:R(),nodeDoubleClick:R(),nodeClick:R(),nodeMouseEnter:R(),nodeMouseMove:R(),nodeMouseLeave:R(),nodeContextMenu:R(),nodeDragStart:R(),nodeDrag:R(),nodeDragStop:R(),nodesInitialized:R(),miniMapNodeClick:R(),miniMapNodeDoubleClick:R(),miniMapNodeMouseEnter:R(),miniMapNodeMouseMove:R(),miniMapNodeMouseLeave:R(),connect:R(),connectStart:R(),connectEnd:R(),clickConnectStart:R(),clickConnectEnd:R(),paneReady:R(),init:R(),move:R(),moveStart:R(),moveEnd:R(),selectionDragStart:R(),selectionDrag:R(),selectionDragStop:R(),selectionContextMenu:R(),selectionStart:R(),selectionEnd:R(),viewportChangeStart:R(),viewportChange:R(),viewportChangeEnd:R(),paneScroll:R(),paneClick:R(),paneContextMenu:R(),paneMouseEnter:R(),paneMouseMove:R(),paneMouseLeave:R(),edgeContextMenu:R(),edgeMouseEnter:R(),edgeMouseMove:R(),edgeMouseLeave:R(),edgeDoubleClick:R(),edgeClick:R(),edgeUpdateStart:R(),edgeUpdate:R(),edgeUpdateEnd:R(),updateNodeInternals:R(),error:R(e=>Lt(e.message))}}function pc(e,t){$r(()=>{for(const[n,o]of Object.entries(t.value)){const i=r=>{e(n,r)};o.fns.add(i),gn(()=>{o.off(i)})}})}function fr(){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:co.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:kt.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:et.Bezier,style:{}},connectionMode:qe.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:fn()?"Meta":"Control",zoomActivationKeyCode:fn()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:vc(),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 mc=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function yc(e,t,n){const o=hc(e),i=g=>{const f=g!=null?g:[];e.hooks.updateNodeInternals.trigger(f)},r=g=>Ou(g,e.nodes,e.edges),s=g=>Au(g,e.nodes,e.edges),a=g=>ji(g,e.edges),l=({id:g,type:f,nodeId:h})=>{var T;var E;return Array.from((T=(E=e.connectionLookup.get(`${h}-${f}-${g!=null?g:null}`))==null?void 0:E.values())!=null?T:[])},u=g=>{if(g)return t.value.get(g)},c=g=>{if(g)return n.value.get(g)},d=(g,f,h)=>{var M,X;var E,T;const F=[];for(const q of g){const re={id:q.id,type:"position",dragging:h,from:q.from};if(f&&(re.position=q.position,q.parentNode)){const ne=u(q.parentNode);re.position={x:re.position.x-((M=(E=ne==null?void 0:ne.computedPosition)==null?void 0:E.x)!=null?M:0),y:re.position.y-((X=(T=ne==null?void 0:ne.computedPosition)==null?void 0:T.y)!=null?X:0)}}F.push(re)}F!=null&&F.length&&e.hooks.nodesChange.trigger(F)},v=g=>{if(!e.vueFlowRef)return;const f=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!f)return;const h=window.getComputedStyle(f),{m22:E}=new window.DOMMatrixReadOnly(h.transform),T=[];for(let F=0;F<g.length;++F){const M=g[F],X=u(M.id);if(X){const q=_n(M.nodeElement);if(!!(q.width&&q.height&&(X.dimensions.width!==q.width||X.dimensions.height!==q.height||M.forceUpdate))){const ne=M.nodeElement.getBoundingClientRect();X.dimensions=q,X.handleBounds.source=Jo("source",M.nodeElement,ne,E),X.handleBounds.target=Jo("target",M.nodeElement,ne,E),T.push({id:X.id,type:"dimensions",dimensions:q})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&o.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),T.length&&e.hooks.nodesChange.trigger(T)},p=(g,f)=>{const h=new Set,E=new Set;for(const M of g)it(M)?h.add(M.id):Je(M)&&E.add(M.id);const T=We(t.value,h,!0),F=We(n.value,E);if(e.multiSelectionActive){for(const M of h)T.push(Ue(M,f));for(const M of E)F.push(Ue(M,f))}T.length&&e.hooks.nodesChange.trigger(T),F.length&&e.hooks.edgesChange.trigger(F)},S=g=>{if(e.multiSelectionActive){const f=g.map(h=>Ue(h.id,!0));e.hooks.nodesChange.trigger(f);return}e.hooks.nodesChange.trigger(We(t.value,new Set(g.map(f=>f.id)),!0)),e.hooks.edgesChange.trigger(We(n.value))},_=g=>{if(e.multiSelectionActive){const f=g.map(h=>Ue(h.id,!0));e.hooks.edgesChange.trigger(f);return}e.hooks.edgesChange.trigger(We(n.value,new Set(g.map(f=>f.id)))),e.hooks.nodesChange.trigger(We(t.value,new Set,!0))},x=g=>{p(g,!0)},N=g=>{const h=(g||e.nodes).map(E=>(E.selected=!1,Ue(E.id,!1)));e.hooks.nodesChange.trigger(h)},I=g=>{const h=(g||e.edges).map(E=>(E.selected=!1,Ue(E.id,!1)));e.hooks.edgesChange.trigger(h)},y=g=>{if(!g||!g.length)return p([],!1);const f=g.reduce((h,E)=>{const T=Ue(E.id,!1);return it(E)?h.nodes.push(T):h.edges.push(T),h},{nodes:[],edges:[]});f.nodes.length&&e.hooks.nodesChange.trigger(f.nodes),f.edges.length&&e.hooks.edgesChange.trigger(f.edges)},C=g=>{var f;(f=e.d3Zoom)==null||f.scaleExtent([g,e.maxZoom]),e.minZoom=g},z=g=>{var f;(f=e.d3Zoom)==null||f.scaleExtent([e.minZoom,g]),e.maxZoom=g},Y=g=>{var f;(f=e.d3Zoom)==null||f.translateExtent(g),e.translateExtent=g},U=g=>{e.nodeExtent=g,i()},H=g=>{var f;(f=e.d3Zoom)==null||f.clickDistance(g)},J=g=>{e.nodesDraggable=g,e.nodesConnectable=g,e.elementsSelectable=g},W=g=>{const f=g instanceof Function?g(e.nodes):g;!e.initialized&&!f.length||(e.nodes=Qo(f,u,e.hooks.error.trigger))},$=g=>{const f=g instanceof Function?g(e.edges):g;if(!e.initialized&&!f.length)return;const h=On(f,e.isValidConnection,u,c,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);An(e.connectionLookup,n.value,h),e.edges=h},b=g=>{const f=g instanceof Function?g([...e.nodes,...e.edges]):g;!e.initialized&&!f.length||(W(f.filter(it)),$(f.filter(Je)))},Q=g=>{let f=g instanceof Function?g(e.nodes):g;f=Array.isArray(f)?f:[f];const h=Qo(f,u,e.hooks.error.trigger),E=[];for(const T of h)E.push(Go(T));E.length&&e.hooks.nodesChange.trigger(E)},m=g=>{let f=g instanceof Function?g(e.edges):g;f=Array.isArray(f)?f:[f];const h=On(f,e.isValidConnection,u,c,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),E=[];for(const T of h)E.push(Go(T));E.length&&e.hooks.edgesChange.trigger(E)},k=(g,f=!0,h=!1)=>{const E=g instanceof Function?g(e.nodes):g,T=Array.isArray(E)?E:[E],F=[],M=[];function X(re){const ne=a(re);for(const be of ne)(!Ee(be.deletable)||be.deletable)&&M.push(Uo(be.id,be.source,be.target,be.sourceHandle,be.targetHandle))}function q(re){const ne=[];for(const be of e.nodes)be.parentNode===re&&ne.push(be);if(ne.length){for(const be of ne)F.push(Xo(be.id));f&&X(ne);for(const be of ne)q(be.id)}}for(const re of T){const ne=typeof re=="string"?u(re):re;ne&&(Ee(ne.deletable)&&!ne.deletable||(F.push(Xo(ne.id)),f&&X([ne]),h&&q(ne.id)))}M.length&&e.hooks.edgesChange.trigger(M),F.length&&e.hooks.nodesChange.trigger(F)},w=g=>{const f=g instanceof Function?g(e.edges):g,h=Array.isArray(f)?f:[f],E=[];for(const T of h){const F=typeof T=="string"?c(T):T;F&&(Ee(F.deletable)&&!F.deletable||E.push(Uo(typeof T=="string"?T:T.id,F.source,F.target,F.sourceHandle,F.targetHandle)))}e.hooks.edgesChange.trigger(E)},P=(g,f,h=!0)=>{const E=c(g.id);if(!E)return!1;const T=e.edges.indexOf(E),F=oc(g,f,E,h,e.hooks.error.trigger);if(F){const[M]=On([F],e.isValidConnection,u,c,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((X,q)=>q===T?M:X),An(e.connectionLookup,n.value,[M]),M}return!1},A=(g,f,h={replace:!1})=>{const E=c(g);if(!E)return;const T=typeof f=="function"?f(E):f;E.data=h.replace?T:D(D({},E.data),T)},B=g=>Yo(g,e.nodes),O=g=>{const f=Yo(g,e.edges);return An(e.connectionLookup,n.value,f),f},G=(g,f,h={replace:!1})=>{const E=u(g);if(!E)return;const T=typeof f=="function"?f(E):f;h.replace?e.nodes.splice(e.nodes.indexOf(E),1,T):Object.assign(E,T)},K=(g,f,h={replace:!1})=>{const E=u(g);if(!E)return;const T=typeof f=="function"?f(E):f;E.data=h.replace?T:D(D({},E.data),T)},oe=(g,f,h=!1)=>{h?e.connectionClickStartHandle=g:e.connectionStartHandle=g,e.connectionEndHandle=null,e.connectionStatus=null,f&&(e.connectionPosition=f)},V=(g,f=null,h=null)=>{e.connectionStartHandle&&(e.connectionPosition=g,e.connectionEndHandle=f,e.connectionStatus=h)},L=(g,f)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,f?e.connectionClickStartHandle=null:e.connectionStartHandle=null},j=g=>{const f=$u(g),h=f?null:Mt(g)?g:u(g.id);return!f&&!h?[null,null,f]:[f?g:cn(h),h,f]},ce=(g,f=!0,h=e.nodes)=>{const[E,T,F]=j(g);if(!E)return[];const M=[];for(const X of h||e.nodes){if(!F&&(X.id===T.id||!X.computedPosition))continue;const q=cn(X),re=dn(q,E);(f&&re>0||re>=Number(E.width)*Number(E.height))&&M.push(X)}return M},de=(g,f,h=!0)=>{const[E]=j(g);if(!E)return!1;const T=dn(E,f);return h&&T>0||T>=Number(E.width)*Number(E.height)},ie=g=>{const{viewport:f,dimensions:h,d3Zoom:E,d3Selection:T,translateExtent:F}=e;if(!E||!T||!g.x&&!g.y)return!1;const M=wt.translate(f.x+g.x,f.y+g.y).scale(f.zoom),X=[[0,0],[h.width,h.height]],q=E.constrain()(M,X,F),re=e.viewport.x!==q.x||e.viewport.y!==q.y||e.viewport.zoom!==q.k;return E.transform(T,q),re},he=g=>{const f=g instanceof Function?g(e):g,h=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];Ee(f.defaultEdgeOptions)&&(e.defaultEdgeOptions=f.defaultEdgeOptions);const E=f.modelValue||f.nodes||f.edges?[]:void 0;E&&(f.modelValue&&E.push(...f.modelValue),f.nodes&&E.push(...f.nodes),f.edges&&E.push(...f.edges),b(E));const T=()=>{Ee(f.maxZoom)&&z(f.maxZoom),Ee(f.minZoom)&&C(f.minZoom),Ee(f.translateExtent)&&Y(f.translateExtent)};for(const F of Object.keys(f)){const M=F,X=f[M];![...mc,...h].includes(M)&&Ee(X)&&(e[M]=X)}Ln(()=>e.d3Zoom).not.toBeNull().then(T),e.initialized||(e.initialized=!0)};return{updateNodePositions:d,updateNodeDimensions:v,setElements:b,setNodes:W,setEdges:$,addNodes:Q,addEdges:m,removeNodes:k,removeEdges:w,findNode:u,findEdge:c,updateEdge:P,updateEdgeData:A,updateNode:G,updateNodeData:K,applyEdgeChanges:O,applyNodeChanges:B,addSelectedElements:x,addSelectedNodes:S,addSelectedEdges:_,setMinZoom:C,setMaxZoom:z,setTranslateExtent:Y,setNodeExtent:U,setPaneClickDistance:H,removeSelectedElements:y,removeSelectedNodes:N,removeSelectedEdges:I,startConnection:oe,updateConnection:V,endConnection:L,setInteractive:J,setState:he,getIntersectingNodes:ce,getIncomers:r,getOutgoers:s,getConnectedEdges:a,getHandleConnections:l,isNodeIntersecting:de,panBy:ie,fitView:g=>o.value.fitView(g),zoomIn:g=>o.value.zoomIn(g),zoomOut:g=>o.value.zoomOut(g),zoomTo:(g,f)=>o.value.zoomTo(g,f),setViewport:(g,f)=>o.value.setViewport(g,f),setTransform:(g,f)=>o.value.setTransform(g,f),getViewport:()=>o.value.getViewport(),getTransform:()=>o.value.getTransform(),setCenter:(g,f,h)=>o.value.setCenter(g,f,h),fitBounds:(g,f)=>o.value.fitBounds(g,f),project:g=>o.value.project(g),screenToFlowCoordinate:g=>o.value.screenToFlowCoordinate(g),flowToScreenCoordinate:g=>o.value.flowToScreenCoordinate(g),toObject:()=>{const g=[],f=[];for(const T of e.nodes){const h=T,{computedPosition:F,handleBounds:M,selected:X,dimensions:q,isParent:re,resizing:ne,dragging:be,events:je}=h,ze=dt(h,["computedPosition","handleBounds","selected","dimensions","isParent","resizing","dragging","events"]);g.push(ze)}for(const T of e.edges){const E=T,{selected:F,sourceNode:M,targetNode:X,events:q}=E,re=dt(E,["selected","sourceNode","targetNode","events"]);f.push(re)}return JSON.parse(JSON.stringify({nodes:g,edges:f,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:g=>new Promise(f=>{const{nodes:h,edges:E,position:T,zoom:F,viewport:M}=g;if(h&&W(h),E&&$(E),M!=null&&M.x&&(M!=null&&M.y)||T){const X=(M==null?void 0:M.x)||T[0],q=(M==null?void 0:M.y)||T[1],re=(M==null?void 0:M.zoom)||F||e.viewport.zoom;return Ln(()=>o.value.viewportInitialized).toBe(!0).then(()=>{o.value.setViewport({x:X,y:q,zoom:re}).then(()=>{f(!0)})})}else f(!0)}),updateNodeInternals:i,viewportHelper:o,$reset:()=>{var f,h,E;const g=fr();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const T=wt.translate((f=g.defaultViewport.x)!=null?f:0,(h=g.defaultViewport.y)!=null?h:0).scale(lt((E=g.defaultViewport.zoom)!=null?E:1,g.minZoom,g.maxZoom)),F=e.viewportRef.getBoundingClientRect(),M=[[0,0],[F.width,F.height]],X=e.d3Zoom.constrain()(T,M,g.translateExtent);e.d3Zoom.transform(e.d3Selection,X)}he(g)},$destroy:()=>{}}}const _c=["data-id","data-handleid","data-nodeid","data-handlepos"],wc={name:"Handle",compatConfig:{MODE:3}},hn=xe(fe(D({},wc),{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=Cr(e,["position","connectable","connectableStart","connectableEnd","id"]),o=_e(()=>{var $;return($=n.type)!=null?$:"source"}),i=_e(()=>{var $;return($=n.isValidConnection)!=null?$:null}),{id:r,connectionStartHandle:s,connectionClickStartHandle:a,connectionEndHandle:l,vueFlowRef:u,nodesConnectable:c,noDragClassName:d,noPanClassName:v}=we(),{id:p,node:S,nodeEl:_,connectedEdges:x}=cr(),N=pe(),I=_e(()=>typeof e.connectableStart!="undefined"?e.connectableStart:!0),y=_e(()=>typeof e.connectableEnd!="undefined"?e.connectableEnd:!0),C=_e(()=>{var $,b,Q,m,k,w;return(($=s.value)==null?void 0:$.nodeId)===p&&((b=s.value)==null?void 0:b.id)===e.id&&((Q=s.value)==null?void 0:Q.type)===o.value||((m=l.value)==null?void 0:m.nodeId)===p&&((k=l.value)==null?void 0:k.id)===e.id&&((w=l.value)==null?void 0:w.type)===o.value}),z=_e(()=>{var $,b,Q;return(($=a.value)==null?void 0:$.nodeId)===p&&((b=a.value)==null?void 0:b.id)===e.id&&((Q=a.value)==null?void 0:Q.type)===o.value}),{handlePointerDown:Y,handleClick:U}=lr({nodeId:p,handleId:e.id,isValidConnection:i,type:o}),H=ae(()=>typeof e.connectable=="string"&&e.connectable==="single"?!x.value.some($=>{const b=$[`${o.value}Handle`];return $[o.value]!==p?!1:b?b===e.id:!0}):typeof e.connectable=="number"?x.value.filter($=>{const b=$[`${o.value}Handle`];return $[o.value]!==p?!1:b?b===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(S,x.value):Ee(e.connectable)?e.connectable:c.value);Qe(()=>{var B;var $;if(!S.dimensions.width||!S.dimensions.height)return;const b=($=S.handleBounds[o.value])==null?void 0:$.find(O=>O.id===e.id);if(!u.value||b)return;const Q=u.value.querySelector(".vue-flow__transformationpane");if(!_.value||!N.value||!Q||!e.id)return;const m=_.value.getBoundingClientRect(),k=N.value.getBoundingClientRect(),w=window.getComputedStyle(Q),{m22:P}=new window.DOMMatrixReadOnly(w.transform),A=D({id:e.id,position:e.position,x:(k.left-m.left)/P,y:(k.top-m.top)/P,type:o.value,nodeId:p},_n(N.value));S.handleBounds[o.value]=[...(B=S.handleBounds[o.value])!=null?B:[],A]});function J($){const b=ho($);H.value&&I.value&&(b&&$.button===0||!b)&&Y($)}function W($){!p||!a.value&&!I.value||H.value&&U($)}return t({handleClick:U,handlePointerDown:Y,onClick:W,onPointerDown:J}),($,b)=>(ge(),ye("div",{ref_key:"handle",ref:N,"data-id":`${te(r)}-${te(p)}-${e.id}-${o.value}`,"data-handleid":e.id,"data-nodeid":te(p),"data-handlepos":$.position,class:pt(["vue-flow__handle",[`vue-flow__handle-${$.position}`,`vue-flow__handle-${e.id}`,te(d),te(v),o.value,{connectable:H.value,connecting:z.value,connectablestart:I.value,connectableend:y.value,connectionindicator:H.value&&(I.value&&!C.value||y.value&&C.value)}]]),onMousedown:J,onTouchstartPassive:J,onClick:W},[Fe($.$slots,"default",{id:$.id})],42,_c))}})),xn=function({sourcePosition:e=Z.Bottom,targetPosition:t=Z.Top,label:n,connectable:o=!0,isValidTargetPos:i,isValidSourcePos:r,data:s}){const a=s.label||n;return[me(hn,{type:"target",position:t,connectable:o,isValidConnection:i}),typeof a!="string"&&a?me(a):me(Ae,[a]),me(hn,{type:"source",position:e,connectable:o,isValidConnection:r})]};xn.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"];xn.inheritAttrs=!1;xn.compatConfig={MODE:3};const bc=xn,En=function({targetPosition:e=Z.Top,label:t,connectable:n=!0,isValidTargetPos:o,data:i}){const r=i.label||t;return[me(hn,{type:"target",position:e,connectable:n,isValidConnection:o}),typeof r!="string"&&r?me(r):me(Ae,[r])]};En.props=["targetPosition","label","isValidTargetPos","connectable","data"];En.inheritAttrs=!1;En.compatConfig={MODE:3};const xc=En,Sn=function({sourcePosition:e=Z.Bottom,label:t,connectable:n=!0,isValidSourcePos:o,data:i}){const r=i.label||t;return[typeof r!="string"&&r?me(r):me(Ae,[r]),me(hn,{type:"source",position:e,connectable:n,isValidConnection:o})]};Sn.props=["sourcePosition","label","isValidSourcePos","connectable","data"];Sn.inheritAttrs=!1;Sn.compatConfig={MODE:3};const Ec=Sn,Sc=["transform"],Nc=["width","height","x","y","rx","ry"],Cc=["y"],Mc={name:"EdgeText",compatConfig:{MODE:3}},Ic=xe(fe(D({},Mc),{props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const t=pe({x:0,y:0,width:0,height:0}),n=pe(null),o=ae(()=>`translate(${e.x-t.value.width/2} ${e.y-t.value.height/2})`);Qe(i),ve([()=>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,s)=>(ge(),ye("g",{transform:o.value,class:"vue-flow__edge-textwrapper"},[r.labelShowBg?(ge(),ye("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:Ye(r.labelBgStyle),rx:r.labelBgBorderRadius,ry:r.labelBgBorderRadius},null,12,Nc)):De("",!0),rt("text",ci(r.$attrs,{ref_key:"el",ref:n,class:"vue-flow__edge-text",y:t.value.height/2,dy:"0.3em",style:r.labelStyle}),[Fe(r.$slots,"default",{},()=>[typeof r.label!="string"?(ge(),st(Tr(r.label),{key:0})):(ge(),ye(Ae,{key:1},[Pr(Rn(r.label),1)],64))])],16,Cc)],8,Sc))}})),kc=["id","d","marker-end","marker-start"],Tc=["d","stroke-width"],Pc={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},Nn=xe(fe(D({},Pc),{props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:t}){const n=pe(null),o=pe(null),i=pe(null),r=Sr();return t({pathEl:n,interactionEl:o,labelEl:i}),(s,a)=>(ge(),ye(Ae,null,[rt("path",ci(te(r),{id:s.id,ref_key:"pathEl",ref:n,d:s.path,class:"vue-flow__edge-path","marker-end":s.markerEnd,"marker-start":s.markerStart}),null,16,kc),s.interactionWidth?(ge(),ye("path",{key:0,ref_key:"interactionEl",ref:o,fill:"none",d:s.path,"stroke-width":s.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,Tc)):De("",!0),s.label&&s.labelX&&s.labelY?(ge(),st(Ic,{key:1,ref_key:"labelEl",ref:i,x:s.labelX,y:s.labelY,label:s.label,"label-show-bg":s.labelShowBg,"label-bg-style":s.labelBgStyle,"label-bg-padding":s.labelBgPadding,"label-bg-border-radius":s.labelBgBorderRadius,"label-style":s.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):De("",!0)],64))}}));function hr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const i=Math.abs(n-e)/2,r=n<e?n+i:n-i,s=Math.abs(o-t)/2,a=o<t?o+s:o-s;return[r,a,i,s]}function gr({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:i,sourceControlY:r,targetControlX:s,targetControlY:a}){const l=e*.125+i*.375+s*.375+n*.125,u=t*.125+r*.375+a*.375+o*.125,c=Math.abs(l-e),d=Math.abs(u-t);return[l,u,c,d]}function Jt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function oi({pos:e,x1:t,y1:n,x2:o,y2:i,c:r}){let s,a;switch(e){case Z.Left:s=t-Jt(t-o,r),a=n;break;case Z.Right:s=t+Jt(o-t,r),a=n;break;case Z.Top:s=t,a=n-Jt(n-i,r);break;case Z.Bottom:s=t,a=n+Jt(i-n,r);break}return[s,a]}function vr(e){const{sourceX:t,sourceY:n,sourcePosition:o=Z.Bottom,targetX:i,targetY:r,targetPosition:s=Z.Top,curvature:a=.25}=e,[l,u]=oi({pos:o,x1:t,y1:n,x2:i,y2:r,c:a}),[c,d]=oi({pos:s,x1:i,y1:r,x2:t,y2:n,c:a}),[v,p,S,_]=gr({sourceX:t,sourceY:n,targetX:i,targetY:r,sourceControlX:l,sourceControlY:u,targetControlX:c,targetControlY:d});return[`M${t},${n} C${l},${u} ${c},${d} ${i},${r}`,v,p,S,_]}function ii({pos:e,x1:t,y1:n,x2:o,y2:i}){let r,s;switch(e){case Z.Left:case Z.Right:r=.5*(t+o),s=n;break;case Z.Top:case Z.Bottom:r=t,s=.5*(n+i);break}return[r,s]}function pr(e){const{sourceX:t,sourceY:n,sourcePosition:o=Z.Bottom,targetX:i,targetY:r,targetPosition:s=Z.Top}=e,[a,l]=ii({pos:o,x1:t,y1:n,x2:i,y2:r}),[u,c]=ii({pos:s,x1:i,y1:r,x2:t,y2:n}),[d,v,p,S]=gr({sourceX:t,sourceY:n,targetX:i,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:u,targetControlY:c});return[`M${t},${n} C${a},${l} ${u},${c} ${i},${r}`,d,v,p,S]}const ri={[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 $c({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 si(e,t){return Math.sqrt(ct(t.x-e.x,2)+ct(t.y-e.y,2))}function Dc({source:e,sourcePosition:t=Z.Bottom,target:n,targetPosition:o=Z.Top,center:i,offset:r}){var U,H;const s=ri[t],a=ri[o],l={x:e.x+s.x*r,y:e.y+s.y*r},u={x:n.x+a.x*r,y:n.y+a.y*r},c=$c({source:l,sourcePosition:t,target:u}),d=c.x!==0?"x":"y",v=c[d];let p,S,_;const x={x:0,y:0},N={x:0,y:0},[I,y,C,z]=hr({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[d]*a[d]===-1){S=(U=i.x)!=null?U:I,_=(H=i.y)!=null?H:y;const J=[{x:S,y:l.y},{x:S,y:u.y}],W=[{x:l.x,y:_},{x:u.x,y:_}];s[d]===v?p=d==="x"?J:W:p=d==="x"?W:J}else{const J=[{x:l.x,y:u.y}],W=[{x:u.x,y:l.y}];if(d==="x"?p=s.x===v?W:J:p=s.y===v?J:W,t===o){const k=Math.abs(e[d]-n[d]);if(k<=r){const w=Math.min(r-1,r-k);s[d]===v?x[d]=(l[d]>e[d]?-1:1)*w:N[d]=(u[d]>n[d]?-1:1)*w}}if(t!==o){const k=d==="x"?"y":"x",w=s[d]===a[k],P=l[k]>u[k],A=l[k]<u[k];(s[d]===1&&(!w&&P||w&&A)||s[d]!==1&&(!w&&A||w&&P))&&(p=d==="x"?J:W)}const $={x:l.x+x.x,y:l.y+x.y},b={x:u.x+N.x,y:u.y+N.y},Q=Math.max(Math.abs($.x-p[0].x),Math.abs(b.x-p[0].x)),m=Math.max(Math.abs($.y-p[0].y),Math.abs(b.y-p[0].y));Q>=m?(S=($.x+b.x)/2,_=p[0].y):(S=p[0].x,_=($.y+b.y)/2)}return[[e,{x:l.x+x.x,y:l.y+x.y},...p,{x:u.x+N.x,y:u.y+N.y},n],S,_,C,z]}function Ac(e,t,n,o){const i=Math.min(si(e,t)/2,si(t,n)/2,o),{x:r,y:s}=t;if(e.x===r&&r===n.x||e.y===s&&s===n.y)return`L${r} ${s}`;if(e.y===s){const u=e.x<n.x?-1:1,c=e.y<n.y?1:-1;return`L ${r+i*u},${s}Q ${r},${s} ${r},${s+i*c}`}const a=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${r},${s+i*l}Q ${r},${s} ${r+i*a},${s}`}function to(e){const{sourceX:t,sourceY:n,sourcePosition:o=Z.Bottom,targetX:i,targetY:r,targetPosition:s=Z.Top,borderRadius:a=5,centerX:l,centerY:u,offset:c=20}=e,[d,v,p,S,_]=Dc({source:{x:t,y:n},sourcePosition:o,target:{x:i,y:r},targetPosition:s,center:{x:l,y:u},offset:c});return[d.reduce((N,I,y)=>{let C;return y>0&&y<d.length-1?C=Ac(d[y-1],I,d[y+1],a):C=`${y===0?"M":"L"}${I.x} ${I.y}`,N+=C,N},""),v,p,S,_]}function Oc(e){const{sourceX:t,sourceY:n,targetX:o,targetY:i}=e,[r,s,a,l]=hr({sourceX:t,sourceY:n,targetX:o,targetY:i});return[`M ${t},${n}L ${o},${i}`,r,s,a,l]}const zc=xe({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]=Oc(e);return me(Nn,D(D({path:n,labelX:o,labelY:i},t),e))}}}),Bc=zc,Vc=xe({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()=>{var r,s;const[n,o,i]=to(fe(D({},e),{sourcePosition:(r=e.sourcePosition)!=null?r:Z.Bottom,targetPosition:(s=e.targetPosition)!=null?s:Z.Top}));return me(Nn,D(D({path:n,labelX:o,labelY:i},t),e))}}}),mr=Vc,Rc=xe({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:t}){return()=>me(mr,fe(D(D({},e),t),{borderRadius:0}))}}),Hc=Rc,Lc=xe({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()=>{var r,s;const[n,o,i]=vr(fe(D({},e),{sourcePosition:(r=e.sourcePosition)!=null?r:Z.Bottom,targetPosition:(s=e.targetPosition)!=null?s:Z.Top}));return me(Nn,D(D({path:n,labelX:o,labelY:i},t),e))}}}),Fc=Lc,Yc=xe({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()=>{var r,s;const[n,o,i]=pr(fe(D({},e),{sourcePosition:(r=e.sourcePosition)!=null?r:Z.Bottom,targetPosition:(s=e.targetPosition)!=null?s:Z.Top}));return me(Nn,D(D({path:n,labelX:o,labelY:i},t),e))}}}),Gc=Yc,Xc={input:Ec,default:bc,output:xc},Uc={default:Fc,straight:Bc,step:Hc,smoothstep:mr,simplebezier:Gc};function Zc(e,t,n){const o=ae(()=>_=>t.value.get(_)),i=ae(()=>_=>n.value.get(_)),r=ae(()=>{const _=D(D({},Uc),e.edgeTypes),x=Object.keys(_);for(const N of e.edges)N.type&&!x.includes(N.type)&&(_[N.type]=N.type);return _}),s=ae(()=>{const _=D(D({},Xc),e.nodeTypes),x=Object.keys(_);for(const N of e.nodes)N.type&&!x.includes(N.type)&&(_[N.type]=N.type);return _}),a=ae(()=>e.onlyRenderVisibleElements?Qi(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),l=ae(()=>{if(e.onlyRenderVisibleElements){const _=[];for(const x of e.edges){const N=t.value.get(x.source),I=t.value.get(x.target);Gu({sourcePos:N.computedPosition||{x:0,y:0},targetPos:I.computedPosition||{x:0,y:0},sourceWidth:N.dimensions.width,sourceHeight:N.dimensions.height,targetWidth:I.dimensions.width,targetHeight:I.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&_.push(x)}return _}return e.edges}),u=ae(()=>[...a.value,...l.value]),c=ae(()=>{const _=[];for(const x of e.nodes)x.selected&&_.push(x);return _}),d=ae(()=>{const _=[];for(const x of e.edges)x.selected&&_.push(x);return _}),v=ae(()=>[...c.value,...d.value]),p=ae(()=>{const _=[];for(const x of e.nodes)x.dimensions.width&&x.dimensions.height&&x.handleBounds!==void 0&&_.push(x);return _}),S=ae(()=>a.value.length>0&&p.value.length===a.value.length);return{getNode:o,getEdge:i,getElements:u,getEdgeTypes:r,getNodeTypes:s,getEdges:l,getNodes:a,getSelectedElements:v,getSelectedNodes:c,getSelectedEdges:d,getNodesInitialized:p,areNodesInitialized:S}}class tt{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var i;var t;const n=(t=Vt())==null?void 0:t.appContext.app,o=(i=n==null?void 0:n.config.globalProperties.$vueFlowStorage)!=null?i:tt.instance;return tt.instance=o!=null?o:new tt,n&&(n.config.globalProperties.$vueFlowStorage=tt.instance),tt.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=fr(),i=kr(o),r={};for(const[v,p]of Object.entries(i.hooks)){const S=`on${v.charAt(0).toUpperCase()+v.slice(1)}`;r[S]=p.on}const s={};for(const[v,p]of Object.entries(i.hooks))s[v]=p.trigger;const a=ae(()=>{const v=new Map;for(const p of i.nodes)v.set(p.id,p);return v}),l=ae(()=>{const v=new Map;for(const p of i.edges)v.set(p.id,p);return v}),u=Zc(i,a,l),c=yc(i,a,l);c.setState(D(D({},i),n));const d=fe(D(D(D(D({},r),u),c),Xr(i)),{nodeLookup:a,edgeLookup:l,emits:s,id:t,vueFlowVersion:"1.42.5",$destroy:()=>{this.remove(t)}});return this.set(t,d),d}getId(){return`vue-flow-${this.currentId++}`}}function we(e){const t=tt.getInstance(),n=li(),o=typeof e=="object",i=o?e:{id:e},r=i.id,s=r!=null?r:n==null?void 0:n.vueFlowId;let a;if(n){const l=xt(ni,null);typeof l!="undefined"&&l!==null&&(!s||l.id===s)&&(a=l)}if(a||s&&(a=t.get(s)),!a||s&&a.id!==s){const l=r!=null?r:t.getId(),u=t.create(l,i);a=u,(n!=null?n:ui(!0)).run(()=>{ve(u.applyDefault,(d,v,p)=>{const S=x=>{u.applyNodeChanges(x)},_=x=>{u.applyEdgeChanges(x)};d?(u.onNodesChange(S),u.onEdgesChange(_)):(u.hooks.value.nodesChange.off(S),u.hooks.value.edgesChange.off(_)),p(()=>{u.hooks.value.nodesChange.off(S),u.hooks.value.edgesChange.off(_)})},{immediate:!0}),gn(()=>{if(a){const d=t.get(a.id);d?d.$destroy():Lt(`No store instance found for id ${a.id} in storage.`)}})})}else o&&a.setState(i);if(n&&(mt(ni,a),n.vueFlowId=a.id),o){const l=Vt();(l==null?void 0:l.type.name)!=="VueFlow"&&a.emits.error(new Ne(Se.USEVUEFLOW_OPTIONS))}return a}function Wc(e){const{emits:t,dimensions:n}=we();let o;Qe(()=>{const i=e.value,r=()=>{if(!i)return;const s=_n(i);(s.width===0||s.height===0)&&t.error(new Ne(Se.MISSING_VIEWPORT_DIMENSIONS)),n.value={width:s.width||500,height:s.height||500}};r(),window.addEventListener("resize",r),i&&(o=new ResizeObserver(()=>r()),o.observe(i)),di(()=>{window.removeEventListener("resize",r),o&&i&&o.unobserve(i)})})}const Kc={name:"UserSelection",compatConfig:{MODE:3}},qc=xe(fe(D({},Kc),{props:{userSelectionRect:{}},setup(e){return(t,n)=>(ge(),ye("div",{class:"vue-flow__selection vue-flow__container",style:Ye({width:`${t.userSelectionRect.width}px`,height:`${t.userSelectionRect.height}px`,transform:`translate(${t.userSelectionRect.x}px, ${t.userSelectionRect.y}px)`})},null,4))}})),Jc=["tabIndex"],Qc={name:"NodesSelection",compatConfig:{MODE:3}},jc=xe(fe(D({},Qc),{setup(e){const{emits:t,viewport:n,getSelectedNodes:o,noPanClassName:i,disableKeyboardA11y:r,userSelectionActive:s}=we(),a=dr(),l=pe(null),u=ar({el:l,onStart(S){t.selectionDragStart(S)},onDrag(S){t.selectionDrag(S)},onStop(S){t.selectionDragStop(S)}});Qe(()=>{var S;r.value||(S=l.value)==null||S.focus({preventScroll:!0})});const c=ae(()=>Ji(o.value)),d=ae(()=>({width:`${c.value.width}px`,height:`${c.value.height}px`,top:`${c.value.y}px`,left:`${c.value.x}px`}));function v(S){t.selectionContextMenu({event:S,nodes:o.value})}function p(S){r||vt[S.key]&&(S.preventDefault(),a({x:vt[S.key].x,y:vt[S.key].y},S.shiftKey))}return(S,_)=>!te(s)&&c.value.width&&c.value.height?(ge(),ye("div",{key:0,class:pt(["vue-flow__nodesselection vue-flow__container",te(i)]),style:Ye({transform:`translate(${te(n).x}px,${te(n).y}px) scale(${te(n).zoom})`})},[rt("div",{ref_key:"el",ref:l,class:pt([{dragging:te(u)},"vue-flow__nodesselection-rect"]),style:Ye(d.value),tabIndex:te(r)?void 0:-1,onContextmenu:v,onKeydown:p},null,46,Jc)],6)):De("",!0)}}));function ed(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const td={name:"Pane",compatConfig:{MODE:3}},nd=xe(fe(D({},td),{props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:t,nodes:n,viewport:o,emits:i,userSelectionActive:r,removeSelectedElements:s,userSelectionRect:a,elementsSelectable:l,nodesSelectionActive:u,getSelectedEdges:c,getSelectedNodes:d,removeNodes:v,removeEdges:p,selectionMode:S,deleteKeyCode:_,multiSelectionKeyCode:x,multiSelectionActive:N,edgeLookup:I,nodeLookup:y,connectionLookup:C,defaultEdgeOptions:z,connectionStartHandle:Y}=we(),U=pe(null),H=pe(new Set),J=pe(new Set),W=pe(),$=_e(()=>l.value&&(e.isSelecting||r.value)),b=_e(()=>Y.value!==null);let Q=!1,m=!1;const k=Tt(_,{actInsideInputWithModifier:!1}),w=Tt(x);ve(k,V=>{V&&(v(d.value),p(c.value),u.value=!1)}),ve(w,V=>{N.value=V});function P(V,L){return j=>{j.target===L&&(V==null||V(j))}}function A(V){if(Q||b.value){Q=!1;return}i.paneClick(V),s(),u.value=!1}function B(V){V.preventDefault(),V.stopPropagation(),i.paneContextMenu(V)}function O(V){i.paneScroll(V)}function G(V){var L,j,ce;if(W.value=(L=t.value)==null?void 0:L.getBoundingClientRect(),!l.value||!e.isSelecting||V.button!==0||V.target!==U.value||!W.value)return;(ce=(j=V.target)==null?void 0:j.setPointerCapture)==null||ce.call(j,V.pointerId);const{x:de,y:ie}=ed(V,W.value);m=!0,Q=!1,s(),a.value={width:0,height:0,startX:de,startY:ie,x:de,y:ie},i.selectionStart(V)}function K(V){var g,f;var L;if(!W.value||!a.value)return;Q=!0;const{x:j,y:ce}=Ke(V,W.value),{startX:de=0,startY:ie=0}=a.value,he={startX:de,startY:ie,x:j<de?j:de,y:ce<ie?ce:ie,width:Math.abs(j-de),height:Math.abs(ce-ie)},ee=H.value,se=J.value;H.value=new Set(Qi(n.value,he,o.value,S.value===co.Partial,!0).map(h=>h.id)),J.value=new Set;const le=(g=(L=z.value)==null?void 0:L.selectable)!=null?g:!0;for(const h of H.value){const E=C.value.get(h);if(E)for(const{edgeId:T}of E.values()){const F=I.value.get(T);F&&((f=F.selectable)!=null?f:le)&&J.value.add(T)}}if(!ti(ee,H.value)){const h=We(y.value,H.value,!0);i.nodesChange(h)}if(!ti(se,J.value)){const h=We(I.value,J.value);i.edgesChange(h)}a.value=he,r.value=!0,u.value=!1}function oe(V){var L;V.button!==0||!m||((L=V.target)==null||L.releasePointerCapture(V.pointerId),!r.value&&a.value&&V.target===U.value&&A(V),r.value=!1,a.value=null,u.value=H.value.size>0,i.selectionEnd(V),e.selectionKeyPressed&&(Q=!1),m=!1)}return(V,L)=>(ge(),ye("div",{ref_key:"container",ref:U,class:pt(["vue-flow__pane vue-flow__container",{selection:V.isSelecting}]),onClick:L[0]||(L[0]=j=>$.value?void 0:P(A,U.value)(j)),onContextmenu:L[1]||(L[1]=j=>P(B,U.value)(j)),onWheelPassive:L[2]||(L[2]=j=>P(O,U.value)(j)),onPointerenter:L[3]||(L[3]=j=>$.value?void 0:te(i).paneMouseEnter(j)),onPointerdown:L[4]||(L[4]=j=>$.value?G(j):te(i).paneMouseMove(j)),onPointermove:L[5]||(L[5]=j=>$.value?K(j):te(i).paneMouseMove(j)),onPointerup:L[6]||(L[6]=j=>$.value?oe(j):void 0),onPointerleave:L[7]||(L[7]=j=>te(i).paneMouseLeave(j))},[Fe(V.$slots,"default"),te(r)&&te(a)?(ge(),st(qc,{key:0,"user-selection-rect":te(a)},null,8,["user-selection-rect"])):De("",!0),te(u)&&te(d).length?(ge(),st(jc,{key:1})):De("",!0)],34))}})),od={name:"Transform",compatConfig:{MODE:3}},id=xe(fe(D({},od),{setup(e){const{viewport:t,fitViewOnInit:n,fitViewOnInitDone:o}=we(),i=ae(()=>n.value?!o.value:!1),r=ae(()=>`translate(${t.value.x}px,${t.value.y}px) scale(${t.value.zoom})`);return(s,a)=>(ge(),ye("div",{class:"vue-flow__transformationpane vue-flow__container",style:Ye({transform:r.value,opacity:i.value?0:void 0})},[Fe(s.$slots,"default")],4))}})),rd={name:"Viewport",compatConfig:{MODE:3}},sd=xe(fe(D({},rd),{setup(e){const{minZoom:t,maxZoom:n,defaultViewport:o,translateExtent:i,zoomActivationKeyCode:r,selectionKeyCode:s,panActivationKeyCode:a,panOnScroll:l,panOnScrollMode:u,panOnScrollSpeed:c,panOnDrag:d,zoomOnDoubleClick:v,zoomOnPinch:p,zoomOnScroll:S,preventScrolling:_,noWheelClassName:x,noPanClassName:N,emits:I,connectionStartHandle:y,userSelectionActive:C,paneDragging:z,d3Zoom:Y,d3Selection:U,d3ZoomHandler:H,viewport:J,viewportRef:W,paneClickDistance:$}=we();Wc(W);const b=pe(!1),Q=pe(!1);let m=null,k=!1,w=0,P={x:0,y:0,zoom:0};const A=Tt(a),B=Tt(s),O=Tt(r),G=_e(()=>(!B.value||B.value&&s.value===!0)&&(A.value||d.value)),K=_e(()=>A.value||l.value),oe=_e(()=>B.value||s.value===!0&&G.value!==!0);Qe(()=>{var E,T,F;if(!W.value){Lt("Viewport element is missing");return}const ie=W.value,he=ie.getBoundingClientRect(),ee=Cu().clickDistance($.value).scaleExtent([t.value,n.value]).translateExtent(i.value),se=Ie(ie).call(ee),le=se.on("wheel.zoom"),g=wt.translate((E=o.value.x)!=null?E:0,(T=o.value.y)!=null?T:0).scale(lt((F=o.value.zoom)!=null?F:1,t.value,n.value)),f=[[0,0],[he.width,he.height]],h=ee.constrain()(g,f,i.value);ee.transform(se,h),ee.wheelDelta(L),Y.value=ee,U.value=se,H.value=le,J.value={x:h.x,y:h.y,zoom:h.k},ee.on("start",M=>{var X;if(!M.sourceEvent)return null;w=M.sourceEvent.button,b.value=!0;const q=ce(M.transform);((X=M.sourceEvent)==null?void 0:X.type)==="mousedown"&&(z.value=!0),P=q,I.viewportChangeStart(q),I.moveStart({event:M,flowTransform:q})}),ee.on("end",M=>{if(!M.sourceEvent)return null;if(b.value=!1,z.value=!1,V(G.value,w!=null?w:0)&&!k&&I.paneContextMenu(M.sourceEvent),k=!1,j(P,M.transform)){const X=ce(M.transform);P=X,I.viewportChangeEnd(X),I.moveEnd({event:M,flowTransform:X})}}),ee.filter(M=>{var X;const q=O.value||S.value,re=p.value&&M.ctrlKey,ne=M.button;if(ne===1&&M.type==="mousedown"&&(de(M,"vue-flow__node")||de(M,"vue-flow__edge")))return!0;if(!G.value&&!q&&!K.value&&!v.value&&!p.value||C.value||!v.value&&M.type==="dblclick"||de(M,x.value)&&M.type==="wheel"||de(M,N.value)&&(M.type!=="wheel"||K.value&&M.type==="wheel"&&!O.value)||!p.value&&M.ctrlKey&&M.type==="wheel"||!q&&!K.value&&!re&&M.type==="wheel")return!1;if(!p&&M.type==="touchstart"&&((X=M.touches)==null?void 0:X.length)>1)return M.preventDefault(),!1;if(!G.value&&(M.type==="mousedown"||M.type==="touchstart")||s.value===!0&&Array.isArray(d.value)&&d.value.includes(0)&&ne===0||Array.isArray(d.value)&&!d.value.includes(ne)&&(M.type==="mousedown"||M.type==="touchstart"))return!1;const be=Array.isArray(d.value)&&d.value.includes(ne)||s.value===!0&&Array.isArray(d.value)&&!d.value.includes(0)||!ne||ne<=1;return(!M.ctrlKey||A.value||M.type==="wheel")&&be}),ve([C,G],()=>{C.value&&!b.value?ee.on("zoom",null):C.value||ee.on("zoom",M=>{J.value={x:M.transform.x,y:M.transform.y,zoom:M.transform.k};const X=ce(M.transform);k=V(G.value,w!=null?w:0),I.viewportChange(X),I.move({event:M,flowTransform:X})})},{immediate:!0}),ve([C,K,u,O,p,_,x],()=>{K.value&&!O.value&&!C.value?se.on("wheel.zoom",M=>{if(de(M,x.value))return!1;const X=O.value||S.value,q=p.value&&M.ctrlKey;if(!(!_.value||K.value||X||q))return!1;M.preventDefault(),M.stopImmediatePropagation();const ne=se.property("__zoom").k||1,be=fn();if(!A.value&&M.ctrlKey&&p.value&&be){const yr=Pe(M),_r=L(M),wr=ne*ct(2,_r);ee.scaleTo(se,wr,yr,M);return}const je=M.deltaMode===1?20:1;let ze=u.value===kt.Vertical?0:M.deltaX*je,Ft=u.value===kt.Horizontal?0:M.deltaY*je;!be&&M.shiftKey&&u.value!==kt.Vertical&&!ze&&Ft&&(ze=Ft,Ft=0),ee.translateBy(se,-(ze/ne)*c.value,-(Ft/ne)*c.value);const ut=ce(se.property("__zoom"));m&&clearTimeout(m),Q.value?(I.move({event:M,flowTransform:ut}),I.viewportChange(ut),m=setTimeout(()=>{I.moveEnd({event:M,flowTransform:ut}),I.viewportChangeEnd(ut),Q.value=!1},150)):(Q.value=!0,I.moveStart({event:M,flowTransform:ut}),I.viewportChangeStart(ut))},{passive:!1}):typeof le!="undefined"&&se.on("wheel.zoom",function(M,X){const q=!_.value&&M.type==="wheel"&&!M.ctrlKey,re=O.value||S.value,ne=p.value&&M.ctrlKey;if(!re&&!l.value&&!ne&&M.type==="wheel"||q||de(M,x.value))return null;M.preventDefault(),le.call(this,M,X)},{passive:!1})},{immediate:!0})});function V(ie,he){return he===2&&Array.isArray(ie)&&ie.includes(2)}function L(ie){const he=ie.ctrlKey&&fn()?10:1;return-ie.deltaY*(ie.deltaMode===1?.05:ie.deltaMode?1:.002)*he}function j(ie,he){return ie.x!==he.x&&!Number.isNaN(he.x)||ie.y!==he.y&&!Number.isNaN(he.y)||ie.zoom!==he.k&&!Number.isNaN(he.k)}function ce(ie){return{x:ie.x,y:ie.y,zoom:ie.k}}function de(ie,he){return ie.target.closest(`.${he}`)}return(ie,he)=>(ge(),ye("div",{ref_key:"viewportRef",ref:W,class:"vue-flow__viewport vue-flow__container"},[Re(nd,{"is-selecting":oe.value,"selection-key-pressed":te(B),class:pt({connecting:!!te(y),dragging:te(z),draggable:te(d)===!0||Array.isArray(te(d))&&te(d).includes(0)})},{default:Vn(()=>[Re(id,null,{default:Vn(()=>[Fe(ie.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}})),ad=["id"],ld=["id"],ud=["id"],cd={name:"A11yDescriptions",compatConfig:{MODE:3}},dd=xe(fe(D({},cd),{setup(e){const{id:t,disableKeyboardA11y:n,ariaLiveMessage:o}=we();return(i,r)=>(ge(),ye(Ae,null,[rt("div",{id:`${te(Yi)}-${te(t)}`,style:{display:"none"}}," Press enter or space to select a node. "+Rn(te(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,ad),rt("div",{id:`${te(Gi)}-${te(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,ld),te(n)?De("",!0):(ge(),ye("div",{key:0,id:`${te(Pu)}-${te(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%)"}},Rn(te(o)),9,ud))],64))}}));function fd(){const e=we();ve(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function hd(e,t,n){return n===Z.Left?e-t:n===Z.Right?e+t:e}function gd(e,t,n){return n===Z.Top?e-t:n===Z.Bottom?e+t:e}const go=function({radius:e=10,centerX:t=0,centerY:n=0,position:o=Z.Top,type:i}){return me("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${i}`,cx:hd(t,e,o),cy:gd(n,e,o),r:e,stroke:"transparent",fill:"transparent"})};go.props=["radius","centerX","centerY","position","type"];go.compatConfig={MODE:3};const ai=go,vd=xe({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:t,addSelectedEdges:n,connectionMode:o,edgeUpdaterRadius:i,emits:r,nodesSelectionActive:s,noPanClassName:a,getEdgeTypes:l,removeSelectedEdges:u,findEdge:c,findNode:d,isValidConnection:v,multiSelectionActive:p,disableKeyboardA11y:S,elementsSelectable:_,edgesUpdatable:x,edgesFocusable:N,hooks:I}=we(),y=ae(()=>c(e.id)),{emit:C,on:z}=lc(y.value,r),Y=xt(bn),U=Vt(),H=pe(!1),J=pe(!1),W=pe(""),$=pe(null),b=pe("source"),Q=pe(null),m=_e(()=>typeof y.value.selectable=="undefined"?_.value:y.value.selectable),k=_e(()=>typeof y.value.updatable=="undefined"?x.value:y.value.updatable),w=_e(()=>typeof y.value.focusable=="undefined"?N.value:y.value.focusable);mt(rc,e.id),mt(sc,Q);const P=ae(()=>y.value.class instanceof Function?y.value.class(y.value):y.value.class),A=ae(()=>y.value.style instanceof Function?y.value.style(y.value):y.value.style),B=ae(()=>{var T;const f=y.value.type||"default",h=Y==null?void 0:Y[`edge-${f}`];if(h)return h;let E=(T=y.value.template)!=null?T:l.value[f];if(typeof E=="string"&&U){const F=Object.keys(U.appContext.components);F&&F.includes(f)&&(E=fi(f,!1))}return E&&typeof E!="string"?E:(r.error(new Ne(Se.EDGE_TYPE_MISSING,E)),!1)}),{handlePointerDown:O}=lr({nodeId:W,handleId:$,type:b,isValidConnection:v,edgeUpdaterType:b,onEdgeUpdate:oe,onEdgeUpdateEnd:V});return()=>{const f=d(y.value.source),h=d(y.value.target),E="pathOptions"in y.value?y.value.pathOptions:{};if(!f&&!h)return r.error(new Ne(Se.EDGE_SOURCE_TARGET_MISSING,y.value.id,y.value.source,y.value.target)),null;if(!f)return r.error(new Ne(Se.EDGE_SOURCE_MISSING,y.value.id,y.value.source)),null;if(!h)return r.error(new Ne(Se.EDGE_TARGET_MISSING,y.value.id,y.value.target)),null;if(!y.value||y.value.hidden||f.hidden||h.hidden)return null;let T;o.value===qe.Strict?T=f.handleBounds.source:T=[...f.handleBounds.source||[],...f.handleBounds.target||[]];const F=Wo(T,y.value.sourceHandle);let M;o.value===qe.Strict?M=h.handleBounds.target:M=[...h.handleBounds.target||[],...h.handleBounds.source||[]];const X=Wo(M,y.value.targetHandle),q=(F==null?void 0:F.position)||Z.Bottom,re=(X==null?void 0:X.position)||Z.Top,{x:ne,y:be}=bt(f,F,q),{x:je,y:ze}=bt(h,X,re);return y.value.sourceX=ne,y.value.sourceY=be,y.value.targetX=je,y.value.targetY=ze,me("g",{ref:Q,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${B.value===!1?"default":y.value.type||"default"}`,a.value,P.value,{updating:H.value,selected:y.value.selected,animated:y.value.animated,inactive:!m.value&&!I.value.edgeClick.hasListeners()}],onClick:j,onContextmenu:ce,onDblclick:de,onMouseenter:ie,onMousemove:he,onMouseleave:ee,onKeyDown:w.value?g:void 0,tabIndex:w.value?0:void 0,"aria-label":y.value.ariaLabel===null?void 0:y.value.ariaLabel||`Edge from ${y.value.source} to ${y.value.target}`,"aria-describedby":w.value?`${Gi}-${t}`:void 0,role:w.value?"button":"img"},[J.value?null:me(B.value===!1?l.value.default:B.value,D({id:e.id,sourceNode:f,targetNode:h,source:y.value.source,target:y.value.target,type:y.value.type,updatable:k.value,selected:y.value.selected,animated:y.value.animated,label:y.value.label,labelStyle:y.value.labelStyle,labelShowBg:y.value.labelShowBg,labelBgStyle:y.value.labelBgStyle,labelBgPadding:y.value.labelBgPadding,labelBgBorderRadius:y.value.labelBgBorderRadius,data:y.value.data,events:D(D({},y.value.events),z),style:A.value,markerStart:`url('#${Bt(y.value.markerStart,t)}')`,markerEnd:`url('#${Bt(y.value.markerEnd,t)}')`,sourcePosition:q,targetPosition:re,sourceX:ne,sourceY:be,targetX:je,targetY:ze,sourceHandleId:y.value.sourceHandle,targetHandleId:y.value.targetHandle,interactionWidth:y.value.interactionWidth},E)),[k.value==="source"||k.value===!0?[me("g",{onMousedown:se,onMouseenter:G,onMouseout:K},me(ai,{position:q,centerX:ne,centerY:be,radius:i.value,type:"source","data-type":"source"}))]:null,k.value==="target"||k.value===!0?[me("g",{onMousedown:le,onMouseenter:G,onMouseout:K},me(ai,{position:re,centerX:je,centerY:ze,radius:i.value,type:"target","data-type":"target"}))]:null]])};function G(){H.value=!0}function K(){H.value=!1}function oe(f,h){C.update({event:f,edge:y.value,connection:h})}function V(f){C.updateEnd({event:f,edge:y.value}),J.value=!1}function L(f,h){var E;f.button===0&&(J.value=!0,W.value=h?y.value.target:y.value.source,$.value=(E=h?y.value.targetHandle:y.value.sourceHandle)!=null?E:null,b.value=h?"target":"source",C.updateStart({event:f,edge:y.value}),O(f))}function j(f){var h;const E={event:f,edge:y.value};m.value&&(s.value=!1,y.value.selected&&p.value?(u([y.value]),(h=Q.value)==null||h.blur()):n([y.value])),C.click(E)}function ce(f){C.contextMenu({event:f,edge:y.value})}function de(f){C.doubleClick({event:f,edge:y.value})}function ie(f){C.mouseEnter({event:f,edge:y.value})}function he(f){C.mouseMove({event:f,edge:y.value})}function ee(f){C.mouseLeave({event:f,edge:y.value})}function se(f){L(f,!0)}function le(f){L(f,!1)}function g(f){var h;!S.value&&Xi.includes(f.key)&&m.value&&(f.key==="Escape"?((h=Q.value)==null||h.blur(),u([c(e.id)])):n([c(e.id)]))}}}),pd=vd,md=xe({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:t,connectionMode:n,connectionStartHandle:o,connectionEndHandle:i,connectionPosition:r,connectionLineType:s,connectionLineStyle:a,connectionLineOptions:l,connectionStatus:u,viewport:c,findNode:d}=we(),v=(e=xt(bn))==null?void 0:e["connection-line"],p=ae(()=>{var I;return d((I=o.value)==null?void 0:I.nodeId)}),S=ae(()=>{var y;var I;return(y=d((I=i.value)==null?void 0:I.nodeId))!=null?y:null}),_=ae(()=>({x:(r.value.x-c.value.x)/c.value.zoom,y:(r.value.y-c.value.y)/c.value.zoom})),x=ae(()=>l.value.markerStart?`url(#${Bt(l.value.markerStart,t)})`:""),N=ae(()=>l.value.markerEnd?`url(#${Bt(l.value.markerEnd,t)})`:"");return()=>{var A,B,O,G;var I,y,C;if(!p.value||!o.value)return null;const z=o.value.id,Y=o.value.type,U=p.value.handleBounds;let H=(U==null?void 0:U[Y])||[];if(n.value===qe.Loose){const K=(U==null?void 0:U[Y==="source"?"target":"source"])||[];H=[...H,...K]}if(!H)return null;const J=(A=z?H.find(K=>K.id===z):H[0])!=null?A:null,W=(J==null?void 0:J.position)||Z.Top,{x:$,y:b}=bt(p.value,J,W);let Q=null;S.value&&(n.value===qe.Strict?Q=((I=S.value.handleBounds[Y==="source"?"target":"source"])==null?void 0:I.find(K=>{var oe;return K.id===((oe=i.value)==null?void 0:oe.id)}))||null:Q=((y=[...S.value.handleBounds.source||[],...S.value.handleBounds.target||[]])==null?void 0:y.find(K=>{var oe;return K.id===((oe=i.value)==null?void 0:oe.id)}))||null);const m=(B=(C=i.value)==null?void 0:C.position)!=null?B:W?jn[W]:null;if(!W||!m)return null;const k=(G=(O=s.value)!=null?O:l.value.type)!=null?G:et.Bezier;let w="";const P={sourceX:$,sourceY:b,sourcePosition:W,targetX:_.value.x,targetY:_.value.y,targetPosition:m};return k===et.Bezier?[w]=vr(P):k===et.Step?[w]=to(fe(D({},P),{borderRadius:0})):k===et.SmoothStep?[w]=to(P):k===et.SimpleBezier?[w]=pr(P):w=`M${$},${b} ${_.value.x},${_.value.y}`,me("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},me("g",{class:"vue-flow__connection"},v?me(v,{sourceX:$,sourceY:b,sourcePosition:W,targetX:_.value.x,targetY:_.value.y,targetPosition:m,sourceNode:p.value,sourceHandle:J,targetNode:S.value,targetHandle:Q,markerEnd:N.value,markerStart:x.value,connectionStatus:u.value}):me("path",{d:w,class:[l.value.class,u,"vue-flow__connection-path"],style:D(D({},a.value),l.value.style),"marker-end":N.value,"marker-start":x.value})))}}}),yd=md,_d=["id","markerWidth","markerHeight","markerUnits","orient"],wd={name:"MarkerType",compatConfig:{MODE:3}},bd=xe(fe(D({},wd),{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)=>(ge(),ye("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===te(qn).ArrowClosed?(ge(),ye("polyline",{key:0,style:Ye({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)):De("",!0),t.type===te(qn).Arrow?(ge(),ye("polyline",{key:1,style:Ye({stroke:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):De("",!0)],8,_d))}})),xd={class:"vue-flow__marker vue-flow__container"},Ed={name:"MarkerDefinitions",compatConfig:{MODE:3}},Sd=xe(fe(D({},Ed),{setup(e){const{id:t,edges:n,connectionLineOptions:o,defaultMarkerColor:i}=we(),r=ae(()=>{const s=new Set,a=[],l=u=>{if(u){const c=Bt(u,t);s.has(c)||(typeof u=="object"?a.push(fe(D({},u),{id:c,color:u.color||i.value})):a.push({id:c,color:i.value,type:u}),s.add(c))}};for(const u of[o.value.markerEnd,o.value.markerStart])l(u);for(const u of n.value)for(const c of[u.markerStart,u.markerEnd])l(c);return a.sort((u,c)=>u.id.localeCompare(c.id))});return(s,a)=>(ge(),ye("svg",xd,[rt("defs",null,[(ge(!0),ye(Ae,null,no(r.value,l=>(ge(),st(bd,{id:l.id,key:l.id,type:l.type,color:l.color,width:l.width,height:l.height,markerUnits:l.markerUnits,"stroke-width":l.strokeWidth,orient:l.orient},null,8,["id","type","color","width","height","markerUnits","stroke-width","orient"]))),128))])]))}})),Nd={name:"Edges",compatConfig:{MODE:3}},Cd=xe(fe(D({},Nd),{setup(e){const{findNode:t,getEdges:n,elevateEdgesOnSelect:o}=we();return(i,r)=>(ge(),ye(Ae,null,[Re(Sd),(ge(!0),ye(Ae,null,no(te(n),s=>(ge(),ye("svg",{key:s.id,class:"vue-flow__edges vue-flow__container",style:Ye({zIndex:te(Xu)(s,te(t),te(o))})},[Re(te(pd),{id:s.id},null,8,["id"])],4))),128)),Re(te(yd))],64))}})),Md=xe({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:t,noPanClassName:n,selectNodesOnDrag:o,nodesSelectionActive:i,multiSelectionActive:r,emits:s,removeSelectedNodes:a,addSelectedNodes:l,updateNodeDimensions:u,onUpdateNodeInternals:c,getNodeTypes:d,nodeExtent:v,elevateNodesOnSelect:p,disableKeyboardA11y:S,ariaLiveMessage:_,snapToGrid:x,snapGrid:N,nodeDragThreshold:I,nodesDraggable:y,elementsSelectable:C,nodesConnectable:z,nodesFocusable:Y,hooks:U}=we(),H=pe(null);mt(sr,H),mt(rr,e.id);const J=xt(bn),W=Vt(),$=dr(),{node:b,parentNode:Q}=cr(e.id),{emit:m,on:k}=dc(b,s),w=_e(()=>typeof b.draggable=="undefined"?y.value:b.draggable),P=_e(()=>typeof b.selectable=="undefined"?C.value:b.selectable),A=_e(()=>typeof b.connectable=="undefined"?z.value:b.connectable),B=_e(()=>typeof b.focusable=="undefined"?Y.value:b.focusable),O=_e(()=>P.value||w.value||U.value.nodeClick.hasListeners()||U.value.nodeDoubleClick.hasListeners()||U.value.nodeMouseEnter.hasListeners()||U.value.nodeMouseMove.hasListeners()||U.value.nodeMouseLeave.hasListeners()),G=_e(()=>!!b.dimensions.width&&!!b.dimensions.height),K=ae(()=>{const h=b.type||"default",E=J==null?void 0:J[`node-${h}`];if(E)return E;let T=b.template||d.value[h];if(typeof T=="string"&&W){const F=Object.keys(W.appContext.components);F&&F.includes(h)&&(T=fi(h,!1))}return T&&typeof T!="string"?T:(s.error(new Ne(Se.NODE_TYPE_MISSING,T)),!1)}),oe=ar({id:e.id,el:H,disabled:()=>!w.value,selectable:P,dragHandle:()=>b.dragHandle,onStart(h){m.dragStart(h)},onDrag(h){m.drag(h)},onStop(h){m.dragStop(h)},onClick(h){g(h)}}),V=ae(()=>b.class instanceof Function?b.class(b):b.class),L=ae(()=>{const h=(b.style instanceof Function?b.style(b):b.style)||{},E=b.width instanceof Function?b.width(b):b.width,T=b.height instanceof Function?b.height(b):b.height;return!h.width&&E&&(h.width=typeof E=="string"?E:`${E}px`),!h.height&&T&&(h.height=typeof T=="string"?T:`${T}px`),h}),j=_e(()=>{var h,E;return Number((E=(h=b.zIndex)!=null?h:L.value.zIndex)!=null?E:0)});return c(h=>{(h.includes(e.id)||!h.length)&&de()}),Qe(()=>{ve(()=>b.hidden,(h=!1,E,T)=>{!h&&H.value&&(e.resizeObserver.observe(H.value),T(()=>{H.value&&e.resizeObserver.unobserve(H.value)}))},{immediate:!0,flush:"post"})}),ve([()=>b.type,()=>b.sourcePosition,()=>b.targetPosition],()=>{Le(()=>{u([{id:e.id,nodeElement:H.value,forceUpdate:!0}])})}),ve([()=>b.position.x,()=>b.position.y,()=>{var h;return(h=Q.value)==null?void 0:h.computedPosition.x},()=>{var h;return(h=Q.value)==null?void 0:h.computedPosition.y},()=>{var h;return(h=Q.value)==null?void 0:h.computedPosition.z},j,()=>b.selected,()=>b.dimensions.height,()=>b.dimensions.width,()=>{var h;return(h=Q.value)==null?void 0:h.dimensions.height},()=>{var h;return(h=Q.value)==null?void 0:h.dimensions.width}],([h,E,T,F,M,X])=>{const q={x:h,y:E,z:X+(p.value&&b.selected?1e3:0)};typeof T!="undefined"&&typeof F!="undefined"?b.computedPosition=Ru({x:T,y:F,z:M},q):b.computedPosition=q},{flush:"post",immediate:!0}),ve([()=>b.extent,v],([h,E],[T,F])=>{(h!==T||E!==F)&&ce()}),b.extent==="parent"||typeof b.extent=="object"&&"range"in b.extent&&b.extent.range==="parent"?Ln(()=>G).toBe(!0).then(ce):ce(),()=>{var h,E;return b.hidden?null:me("div",{ref:H,"data-id":b.id,class:["vue-flow__node",`vue-flow__node-${K.value===!1?"default":b.type||"default"}`,{[n.value]:w.value,dragging:oe==null?void 0:oe.value,draggable:w.value,selected:b.selected,selectable:P.value,parent:b.isParent},V.value],style:D({visibility:G.value?"visible":"hidden",zIndex:(h=b.computedPosition.z)!=null?h:j.value,transform:`translate(${b.computedPosition.x}px,${b.computedPosition.y}px)`,pointerEvents:O.value?"all":"none"},L.value),tabIndex:B.value?0:void 0,role:B.value?"button":void 0,"aria-describedby":S.value?void 0:`${Yi}-${t}`,"aria-label":b.ariaLabel,onMouseenter:ie,onMousemove:he,onMouseleave:ee,onContextmenu:se,onClick:g,onDblclick:le,onKeydown:f},[me(K.value===!1?d.value.default:K.value,{id:b.id,type:b.type,data:b.data,events:D(D({},b.events),k),selected:b.selected,resizing:b.resizing,dragging:oe.value,connectable:A.value,position:b.computedPosition,dimensions:b.dimensions,isValidTargetPos:b.isValidTargetPos,isValidSourcePos:b.isValidSourcePos,parent:b.parentNode,parentNodeId:b.parentNode,zIndex:(E=b.computedPosition.z)!=null?E:j.value,targetPosition:b.targetPosition,sourcePosition:b.sourcePosition,label:b.label,dragHandle:b.dragHandle,onUpdateNodeInternals:de})])};function ce(){const h=b.computedPosition,{computedPosition:E,position:T}=fo(b,x.value?wn(h,N.value):h,s.error,v.value,Q.value);(b.computedPosition.x!==E.x||b.computedPosition.y!==E.y)&&(b.computedPosition=D(D({},b.computedPosition),E)),(b.position.x!==T.x||b.position.y!==T.y)&&(b.position=T)}function de(){H.value&&u([{id:e.id,nodeElement:H.value,forceUpdate:!0}])}function ie(h){oe!=null&&oe.value||m.mouseEnter({event:h,node:b})}function he(h){oe!=null&&oe.value||m.mouseMove({event:h,node:b})}function ee(h){oe!=null&&oe.value||m.mouseLeave({event:h,node:b})}function se(h){return m.contextMenu({event:h,node:b})}function le(h){return m.doubleClick({event:h,node:b})}function g(h){P.value&&(!o.value||!w.value||I.value>0)&&eo(b,r.value,l,a,i,!1,H.value),m.click({event:h,node:b})}function f(h){if(!(Jn(h)||S.value))if(Xi.includes(h.key)&&P.value){const E=h.key==="Escape";eo(b,r.value,l,a,i,E,H.value)}else w.value&&b.selected&&vt[h.key]&&(h.preventDefault(),_.value=`Moved selected node ${h.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~b.position.x}, y: ${~~b.position.y}`,$({x:vt[h.key].x,y:vt[h.key].y},h.shiftKey))}}}),Id=Md,kd={height:"0",width:"0"},Td={name:"EdgeLabelRenderer",compatConfig:{MODE:3}},Ld=xe(fe(D({},Td),{setup(e){const{viewportRef:t}=we(),n=_e(()=>{var o;return(o=t.value)==null?void 0:o.getElementsByClassName("vue-flow__edge-labels")[0]});return(o,i)=>(ge(),ye("svg",null,[(ge(),ye("foreignObject",kd,[(ge(),st(Nr,{to:n.value,disabled:!n.value},[Fe(o.$slots,"default")],8,["to","disabled"]))]))]))}}));function Pd(e={includeHiddenNodes:!1}){const{nodes:t}=we();return ae(()=>{if(t.value.length===0)return!1;for(const n of t.value)if((e.includeHiddenNodes||!n.hidden)&&((n==null?void 0:n.handleBounds)===void 0||n.dimensions.width===0||n.dimensions.height===0))return!1;return!0})}const $d={class:"vue-flow__nodes vue-flow__container"},Dd={name:"Nodes",compatConfig:{MODE:3}},Ad=xe(fe(D({},Dd),{setup(e){const{getNodes:t,updateNodeDimensions:n,emits:o}=we(),i=Pd(),r=pe();return ve(i,s=>{s&&Le(()=>{o.nodesInitialized(t.value)})},{immediate:!0}),Qe(()=>{r.value=new ResizeObserver(s=>{const a=s.map(l=>({id:l.target.getAttribute("data-id"),nodeElement:l.target,forceUpdate:!0}));Le(()=>n(a))})}),di(()=>{var s;return(s=r.value)==null?void 0:s.disconnect()}),(s,a)=>(ge(),ye("div",$d,[r.value?(ge(!0),ye(Ae,{key:0},no(te(t),(l,u,c,d)=>{const v=[l.id];if(d&&d.key===l.id&&Dr(d,v))return d;const p=(ge(),st(te(Id),{id:l.id,key:l.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return p.memo=v,p},a,0),128)):De("",!0)]))}}));function Od(){const{emits:e}=we();Qe(()=>{if(ir()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new Ne(Se.MISSING_STYLES))}})}const zd=rt("div",{class:"vue-flow__edge-labels"},null,-1),Bd={name:"VueFlow",compatConfig:{MODE:3}},Fd=xe(fe(D({},Bd),{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=Mr(),r=Cn(o,"modelValue",n),s=Cn(o,"nodes",n),a=Cn(o,"edges",n),l=we(o),u=gc({modelValue:r,nodes:s,edges:a},o,l);return pc(n,l.hooks),fd(),Od(),mt(bn,i),Ir(()=>{u()}),t(l),(c,d)=>(ge(),ye("div",{ref:te(l).vueFlowRef,class:"vue-flow"},[Re(sd,null,{default:Vn(()=>[Re(Cd),zd,Re(Ad),Fe(c.$slots,"zoom-pane")]),_:3}),Fe(c.$slots,"default"),Re(dd)],512))}})),Vd={name:"Panel",compatConfig:{MODE:3}},Yd=xe(fe(D({},Vd),{props:{position:{}},setup(e){const t=e,{userSelectionActive:n}=we(),o=ae(()=>`${t.position}`.split("-"));return(i,r)=>(ge(),ye("div",{class:pt(["vue-flow__panel",o.value]),style:Ye({pointerEvents:te(n)?"none":"all"})},[Fe(i.$slots,"default")],6))}}));function Gd(e={}){const{handleType:t,handleId:n,nodeId:o,onConnect:i,onDisconnect:r}=e,{connectionLookup:s}=we(),a=ur(),l=pe(null),u=pe(),c=ae(()=>{var S;const d=(S=ue(o))!=null?S:a,v=ue(t),p=ue(n);return`${d}${v?p?`-${v}-${p}`:`-${v}`:""}`});return ve(()=>s.value.get(c.value),d=>{ic(u.value,d)||(u.value=d)},{immediate:!0}),ve([u,()=>typeof i!="undefined",()=>typeof r!="undefined"],([d=new Map])=>{l.value&&l.value!==d&&(ei(l.value,d,r),ei(d,l.value,i)),l.value=d},{immediate:!0}),ae(()=>u.value?Array.from(u.value.values()):[])}function Xd(e){const{findNode:t}=we();return ae({get(){const n=ue(e);if(!Array.isArray(n)){const i=t(n);return i?{id:i.id,type:i.type,data:i.data}:null}const o=[];for(const i of n){const r=t(i);r&&o.push({id:r.id,type:r.type,data:r.data})}return o},set(){Lt("You are trying to set node data via useNodesData. This is not supported.")}})}export{Z as P,Yd as _,Fd as a,Gd as b,hn as c,Xd as d,Nn as e,Ld as f,to as g,we as u};