vue-flow-background-c4c69975.js 150 KB

123456789101112131415161718192021222324252627
  1. import{d as we,c9 as Ko,bj as ye,c as ve,f as ie,o as Ue,j as qo,Z as ae,a1 as pe,aW as ke,T as J,ay as it,bJ as Jo,h as ge,e as Pt,ca as dr,L as ht,n as He,a0 as In,C as Ye,I as mt,cb as fr,r as hr,a7 as Ae,a6 as kn,a9 as Ce,a2 as ze,a3 as Un,av as $e,bf as Qo,cc as gr,$ as Je,cd as jo,ce as Gt,cf as Zn,ao as vr,cg as pr,ch as ce,au as ei,bk as fe,c6 as ut,ci as mr,cj as yr,aZ as wr,a5 as _r,ck as br}from"./index-a8341fa1.js";function rn(e){return jo()?(Gt(e),!0):!1}function Ve(e){return typeof e=="function"?e():J(e)}const xr=typeof window<"u"&&typeof document<"u",Er=e=>typeof e<"u",Sr=Object.prototype.toString,Nr=e=>Sr.call(e)==="[object Object]",Cr=()=>{};function Mr(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 ti=e=>e();function Ir(e=ti){const t=ve(!0);function n(){t.value=!1}function o(){t.value=!0}const i=(...r)=>{t.value&&e(...r)};return{isActive:mr(t),pause:n,resume:o,eventFilter:i}}function ro(e,t=!1,n="Timeout"){return new Promise((o,i)=>{setTimeout(t?()=>i(n):o,e)})}function kr(e,t,n={}){const{eventFilter:o=ti,...i}=n;return ge(e,Mr(o,t),i)}function lt(e,t,n={}){const{eventFilter:o,...i}=n,{eventFilter:r,pause:s,resume:a,isActive:l}=Ir(o);return{stop:kr(e,t,{...i,eventFilter:r}),pause:s,resume:a,isActive:l}}function $r(e,t={}){if(!Zn(e))return vr(e);const n=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const o in e.value)n[o]=pr(()=>({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={...e.value,[o]:i};Object.setPrototypeOf(a,Object.getPrototypeOf(e.value)),e.value=a}else e.value[o]=i}}));return n}function $n(e,t=!1){function n(d,{flush:g="sync",deep:m=!1,timeout:N,throwOnTimeout:_}={}){let b=null;const M=[new Promise(w=>{b=ge(e,x=>{d(x)!==t&&(b?.(),w(x))},{flush:g,deep:m,immediate:!0})})];return N!=null&&M.push(ro(N,_).then(()=>Ve(e)).finally(()=>b?.())),Promise.race(M)}function o(d,g){if(!Zn(d))return n(x=>x===d,g);const{flush:m="sync",deep:N=!1,timeout:_,throwOnTimeout:b}=g??{};let S=null;const w=[new Promise(x=>{S=ge([e,d],([A,Y])=>{t!==(A===Y)&&(S?.(),x(A))},{flush:m,deep:N,immediate:!0})})];return _!=null&&w.push(ro(_,b).then(()=>Ve(e)).finally(()=>(S?.(),Ve(e)))),Promise.race(w)}function i(d){return n(g=>!!g,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,g){return n(m=>{const N=Array.from(m);return N.includes(d)||N.includes(Ve(d))},g)}function u(d){return c(1,d)}function c(d=1,g){let m=-1;return n(()=>(m+=1,m>=d),g)}return Array.isArray(Ve(e))?{toMatch:n,toContains:l,changed:u,changedTimes:c,get not(){return $n(e,!t)}}:{toMatch:n,toBe:o,toBeTruthy:i,toBeNull:r,toBeNaN:a,toBeUndefined:s,changed:u,changedTimes:c,get not(){return $n(e,!t)}}}function Tn(e){return $n(e)}function Tr(e){var t;const n=Ve(e);return(t=n?.$el)!=null?t:n}const ni=xr?window:void 0;function oi(...e){let t,n,o,i;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,o,i]=e,t=ni):[t,n,o,i]=e,!t)return Cr;Array.isArray(n)||(n=[n]),Array.isArray(o)||(o=[o]);const r=[],s=()=>{r.forEach(c=>c()),r.length=0},a=(c,d,g,m)=>(c.addEventListener(d,g,m),()=>c.removeEventListener(d,g,m)),l=ge(()=>[Tr(t),Ve(i)],([c,d])=>{if(s(),!c)return;const g=Nr(d)?{...d}:d;r.push(...n.flatMap(m=>o.map(N=>a(c,m,N,g))))},{immediate:!0,flush:"post"}),u=()=>{l(),s()};return rn(u),u}function Dr(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function so(...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=ni,eventName:r="keydown",passive:s=!1,dedupe:a=!1}=o,l=Dr(t);return oi(i,r,c=>{c.repeat&&Ve(a)||l(c)&&n(c)},s)}function Pr(e){return JSON.parse(JSON.stringify(e))}function yn(e,t,n,o={}){var i,r,s;const{clone:a=!1,passive:l=!1,eventName:u,deep:c=!1,defaultValue:d,shouldEmit:g}=o,m=Pt(),N=n||m?.emit||((i=m?.$emit)==null?void 0:i.bind(m))||((s=(r=m?.proxy)==null?void 0:r.$emit)==null?void 0:s.bind(m?.proxy));let _=u;t||(t="modelValue"),_=_||`update:${t.toString()}`;const b=w=>a?typeof a=="function"?a(w):Pr(w):w,S=()=>Er(e[t])?b(e[t]):d,M=w=>{g?g(w)&&N(_,w):N(_,w)};if(l){const w=S(),x=ve(w);let A=!1;return ge(()=>e[t],Y=>{A||(A=!0,x.value=b(Y),Ye(()=>A=!1))}),ge(x,Y=>{!A&&(Y!==e[t]||c)&&M(Y)},{deep:c}),x}else return ie({get(){return S()},set(w){M(w)}})}var Ar={value:()=>{}};function sn(){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 Xt(n)}function Xt(e){this._=e}function Or(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}})}Xt.prototype=sn.prototype={constructor:Xt,on:function(e,t){var n=this._,o=Or(e+"",n),i,r=-1,s=o.length;if(arguments.length<2){for(;++r<s;)if((i=(e=o[r]).type)&&(i=zr(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]=ao(n[i],e.name,t);else if(t==null)for(i in n)n[i]=ao(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 Xt(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 zr(e,t){for(var n=0,o=e.length,i;n<o;++n)if((i=e[n]).name===t)return i.value}function ao(e,t,n){for(var o=0,i=e.length;o<i;++o)if(e[o].name===t){e[o]=Ar,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var Dn="http://www.w3.org/1999/xhtml";const lo={svg:"http://www.w3.org/2000/svg",xhtml:Dn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function an(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),lo.hasOwnProperty(t)?{space:lo[t],local:e}:e}function Br(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Dn&&t.documentElement.namespaceURI===Dn?t.createElement(e):t.createElementNS(n,e)}}function Rr(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ii(e){var t=an(e);return(t.local?Rr:Br)(t)}function Vr(){}function Wn(e){return e==null?Vr:function(){return this.querySelector(e)}}function Hr(e){typeof e!="function"&&(e=Wn(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 Ne(o,this._parents)}function Lr(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Fr(){return[]}function ri(e){return e==null?Fr:function(){return this.querySelectorAll(e)}}function Yr(e){return function(){return Lr(e.apply(this,arguments))}}function Gr(e){typeof e=="function"?e=Yr(e):e=ri(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 Ne(o,i)}function si(e){return function(){return this.matches(e)}}function ai(e){return function(t){return t.matches(e)}}var Xr=Array.prototype.find;function Ur(e){return function(){return Xr.call(this.children,e)}}function Zr(){return this.firstElementChild}function Wr(e){return this.select(e==null?Zr:Ur(typeof e=="function"?e:ai(e)))}var Kr=Array.prototype.filter;function qr(){return Array.from(this.children)}function Jr(e){return function(){return Kr.call(this.children,e)}}function Qr(e){return this.selectAll(e==null?qr:Jr(typeof e=="function"?e:ai(e)))}function jr(e){typeof e!="function"&&(e=si(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 Ne(o,this._parents)}function li(e){return new Array(e.length)}function es(){return new Ne(this._enter||this._groups.map(li),this._parents)}function Kt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Kt.prototype={constructor:Kt,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 ts(e){return function(){return e}}function ns(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 Kt(e,r[s]);for(;s<l;++s)(a=t[s])&&(i[s]=a)}function os(e,t,n,o,i,r,s){var a,l,u=new Map,c=t.length,d=r.length,g=new Array(c),m;for(a=0;a<c;++a)(l=t[a])&&(g[a]=m=s.call(l,l.__data__,a,t)+"",u.has(m)?i[a]=l:u.set(m,l));for(a=0;a<d;++a)m=s.call(e,r[a],a,r)+"",(l=u.get(m))?(o[a]=l,l.__data__=r[a],u.delete(m)):n[a]=new Kt(e,r[a]);for(a=0;a<c;++a)(l=t[a])&&u.get(g[a])===l&&(i[a]=l)}function is(e){return e.__data__}function rs(e,t){if(!arguments.length)return Array.from(this,is);var n=t?os:ns,o=this._parents,i=this._groups;typeof e!="function"&&(e=ts(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],g=d.length,m=ss(e.call(c,c&&c.__data__,u,o)),N=m.length,_=a[u]=new Array(N),b=s[u]=new Array(N),S=l[u]=new Array(g);n(c,d,_,b,S,m,t);for(var M=0,w=0,x,A;M<N;++M)if(x=_[M]){for(M>=w&&(w=M+1);!(A=b[w])&&++w<N;);x._next=A||null}}return s=new Ne(s,o),s._enter=a,s._exit=l,s}function ss(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function as(){return new Ne(this._exit||this._groups.map(li),this._parents)}function ls(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 us(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,g=a[l]=new Array(d),m,N=0;N<d;++N)(m=u[N]||c[N])&&(g[N]=m);for(;l<i;++l)a[l]=n[l];return new Ne(a,this._parents)}function cs(){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 ds(e){e||(e=fs);function t(d,g){return d&&g?e(d.__data__,g.__data__):!d-!g}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 Ne(i,this._parents).order()}function fs(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function hs(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function gs(){return Array.from(this)}function vs(){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 ms(){return!this.node()}function ys(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 ws(e){return function(){this.removeAttribute(e)}}function _s(e){return function(){this.removeAttributeNS(e.space,e.local)}}function bs(e,t){return function(){this.setAttribute(e,t)}}function xs(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Es(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Ss(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 Ns(e,t){var n=an(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?_s:ws:typeof t=="function"?n.local?Ss:Es:n.local?xs:bs)(n,t))}function ui(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Cs(e){return function(){this.style.removeProperty(e)}}function Ms(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Is(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function ks(e,t,n){return arguments.length>1?this.each((t==null?Cs:typeof t=="function"?Is:Ms)(e,t,n??"")):gt(this.node(),e)}function gt(e,t){return e.style.getPropertyValue(t)||ui(e).getComputedStyle(e,null).getPropertyValue(t)}function $s(e){return function(){delete this[e]}}function Ts(e,t){return function(){this[e]=t}}function Ds(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Ps(e,t){return arguments.length>1?this.each((t==null?$s:typeof t=="function"?Ds:Ts)(e,t)):this.node()[e]}function ci(e){return e.trim().split(/^|\s+/)}function Kn(e){return e.classList||new di(e)}function di(e){this._node=e,this._names=ci(e.getAttribute("class")||"")}di.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 fi(e,t){for(var n=Kn(e),o=-1,i=t.length;++o<i;)n.add(t[o])}function hi(e,t){for(var n=Kn(e),o=-1,i=t.length;++o<i;)n.remove(t[o])}function As(e){return function(){fi(this,e)}}function Os(e){return function(){hi(this,e)}}function zs(e,t){return function(){(t.apply(this,arguments)?fi:hi)(this,e)}}function Bs(e,t){var n=ci(e+"");if(arguments.length<2){for(var o=Kn(this.node()),i=-1,r=n.length;++i<r;)if(!o.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?zs:t?As:Os)(n,t))}function Rs(){this.textContent=""}function Vs(e){return function(){this.textContent=e}}function Hs(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Ls(e){return arguments.length?this.each(e==null?Rs:(typeof e=="function"?Hs:Vs)(e)):this.node().textContent}function Fs(){this.innerHTML=""}function Ys(e){return function(){this.innerHTML=e}}function Gs(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Xs(e){return arguments.length?this.each(e==null?Fs:(typeof e=="function"?Gs:Ys)(e)):this.node().innerHTML}function Us(){this.nextSibling&&this.parentNode.appendChild(this)}function Zs(){return this.each(Us)}function Ws(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ks(){return this.each(Ws)}function qs(e){var t=typeof e=="function"?e:ii(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Js(){return null}function Qs(e,t){var n=typeof e=="function"?e:ii(e),o=t==null?Js:typeof t=="function"?t:Wn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function js(){var e=this.parentNode;e&&e.removeChild(this)}function ea(){return this.each(js)}function ta(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function na(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function oa(e){return this.select(e?na:ta)}function ia(e){return arguments.length?this.property("__data__",e):this.node().__data__}function ra(e){return function(t){e.call(this,t,this.__data__)}}function sa(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 aa(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 la(e,t,n){return function(){var o=this.__on,i,r=ra(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 ua(e,t,n){var o=sa(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?la:aa,i=0;i<r;++i)this.each(a(o[i],t,n));return this}function gi(e,t,n){var o=ui(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 ca(e,t){return function(){return gi(this,e,t)}}function da(e,t){return function(){return gi(this,e,t.apply(this,arguments))}}function fa(e,t){return this.each((typeof t=="function"?da:ca)(e,t))}function*ha(){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 vi=[null];function Ne(e,t){this._groups=e,this._parents=t}function At(){return new Ne([[document.documentElement]],vi)}function ga(){return this}Ne.prototype=At.prototype={constructor:Ne,select:Hr,selectAll:Gr,selectChild:Wr,selectChildren:Qr,filter:jr,data:rs,enter:es,exit:as,join:ls,merge:us,selection:ga,order:cs,sort:ds,call:hs,nodes:gs,node:vs,size:ps,empty:ms,each:ys,attr:Ns,style:ks,property:Ps,classed:Bs,text:Ls,html:Xs,raise:Zs,lower:Ks,append:qs,insert:Qs,remove:ea,clone:oa,datum:ia,on:ua,dispatch:fa,[Symbol.iterator]:ha};function Me(e){return typeof e=="string"?new Ne([[document.querySelector(e)]],[document.documentElement]):new Ne([[e]],vi)}function va(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Pe(e,t){if(e=va(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},Ct={capture:!0,passive:!1};function wn(e){e.stopImmediatePropagation()}function ct(e){e.preventDefault(),e.stopImmediatePropagation()}function pi(e){var t=e.document.documentElement,n=Me(e).on("dragstart.drag",ct,Ct);"onselectstart"in t?n.on("selectstart.drag",ct,Ct):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function mi(e,t){var n=e.document.documentElement,o=Me(e).on("dragstart.drag",null);t&&(o.on("click.drag",ct,Ct),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 zt=e=>()=>e;function Pn(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}})}Pn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function ma(e){return!e.ctrlKey&&!e.button}function ya(){return this.parentNode}function wa(e,t){return t??{x:e.x,y:e.y}}function _a(){return navigator.maxTouchPoints||"ontouchstart"in this}function ba(){var e=ma,t=ya,n=wa,o=_a,i={},r=sn("start","drag","end"),s=0,a,l,u,c,d=0;function g(x){x.on("mousedown.drag",m).filter(o).on("touchstart.drag",b).on("touchmove.drag",S,pa).on("touchend.drag touchcancel.drag",M).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(x,A){if(!(c||!e.call(this,x,A))){var Y=w(this,t.call(this,x,A),x,A,"mouse");Y&&(Me(x.view).on("mousemove.drag",N,Ct).on("mouseup.drag",_,Ct),pi(x.view),wn(x),u=!1,a=x.clientX,l=x.clientY,Y("start",x))}}function N(x){if(ct(x),!u){var A=x.clientX-a,Y=x.clientY-l;u=A*A+Y*Y>d}i.mouse("drag",x)}function _(x){Me(x.view).on("mousemove.drag mouseup.drag",null),mi(x.view,u),ct(x),i.mouse("end",x)}function b(x,A){if(e.call(this,x,A)){var Y=x.changedTouches,V=t.call(this,x,A),H=Y.length,Z,T;for(Z=0;Z<H;++Z)(T=w(this,V,x,A,Y[Z].identifier,Y[Z]))&&(wn(x),T("start",x,Y[Z]))}}function S(x){var A=x.changedTouches,Y=A.length,V,H;for(V=0;V<Y;++V)(H=i[A[V].identifier])&&(ct(x),H("drag",x,A[V]))}function M(x){var A=x.changedTouches,Y=A.length,V,H;for(c&&clearTimeout(c),c=setTimeout(function(){c=null},500),V=0;V<Y;++V)(H=i[A[V].identifier])&&(wn(x),H("end",x,A[V]))}function w(x,A,Y,V,H,Z){var T=r.copy(),O=Pe(Z||Y,A),E,j,y;if((y=n.call(x,new Pn("beforestart",{sourceEvent:Y,target:g,identifier:H,active:s,x:O[0],y:O[1],dx:0,dy:0,dispatch:T}),V))!=null)return E=y.x-O[0]||0,j=y.y-O[1]||0,function I(C,$,D){var P=O,z;switch(C){case"start":i[H]=I,z=s++;break;case"end":delete i[H],--s;case"drag":O=Pe(D||$,A),z=s;break}T.call(C,x,new Pn(C,{sourceEvent:$,subject:y,target:g,identifier:H,active:z,x:O[0]+E,y:O[1]+j,dx:O[0]-P[0],dy:O[1]-P[1],dispatch:T}),V)}}return g.filter=function(x){return arguments.length?(e=typeof x=="function"?x:zt(!!x),g):e},g.container=function(x){return arguments.length?(t=typeof x=="function"?x:zt(x),g):t},g.subject=function(x){return arguments.length?(n=typeof x=="function"?x:zt(x),g):n},g.touchable=function(x){return arguments.length?(o=typeof x=="function"?x:zt(!!x),g):o},g.on=function(){var x=r.on.apply(r,arguments);return x===r?g:x},g.clickDistance=function(x){return arguments.length?(d=(x=+x)*x,g):Math.sqrt(d)},g}function qn(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function yi(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function Ot(){}var Mt=.7,qt=1/Mt,dt="\\s*([+-]?\\d+)\\s*",It="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Oe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",xa=/^#([0-9a-f]{3,8})$/,Ea=new RegExp(`^rgb\\(${dt},${dt},${dt}\\)$`),Sa=new RegExp(`^rgb\\(${Oe},${Oe},${Oe}\\)$`),Na=new RegExp(`^rgba\\(${dt},${dt},${dt},${It}\\)$`),Ca=new RegExp(`^rgba\\(${Oe},${Oe},${Oe},${It}\\)$`),Ma=new RegExp(`^hsl\\(${It},${Oe},${Oe}\\)$`),Ia=new RegExp(`^hsla\\(${It},${Oe},${Oe},${It}\\)$`),uo={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};qn(Ot,kt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:co,formatHex:co,formatHex8:ka,formatHsl:$a,formatRgb:fo,toString:fo});function co(){return this.rgb().formatHex()}function ka(){return this.rgb().formatHex8()}function $a(){return wi(this).formatHsl()}function fo(){return this.rgb().formatRgb()}function kt(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=xa.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?ho(t):n===3?new Se(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Bt(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Bt(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=Ea.exec(e))?new Se(t[1],t[2],t[3],1):(t=Sa.exec(e))?new Se(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Na.exec(e))?Bt(t[1],t[2],t[3],t[4]):(t=Ca.exec(e))?Bt(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Ma.exec(e))?po(t[1],t[2]/100,t[3]/100,1):(t=Ia.exec(e))?po(t[1],t[2]/100,t[3]/100,t[4]):uo.hasOwnProperty(e)?ho(uo[e]):e==="transparent"?new Se(NaN,NaN,NaN,0):null}function ho(e){return new Se(e>>16&255,e>>8&255,e&255,1)}function Bt(e,t,n,o){return o<=0&&(e=t=n=NaN),new Se(e,t,n,o)}function Ta(e){return e instanceof Ot||(e=kt(e)),e?(e=e.rgb(),new Se(e.r,e.g,e.b,e.opacity)):new Se}function An(e,t,n,o){return arguments.length===1?Ta(e):new Se(e,t,n,o??1)}function Se(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}qn(Se,An,yi(Ot,{brighter(e){return e=e==null?qt:Math.pow(qt,e),new Se(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Mt:Math.pow(Mt,e),new Se(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Se(nt(this.r),nt(this.g),nt(this.b),Jt(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:go,formatHex:go,formatHex8:Da,formatRgb:vo,toString:vo}));function go(){return`#${tt(this.r)}${tt(this.g)}${tt(this.b)}`}function Da(){return`#${tt(this.r)}${tt(this.g)}${tt(this.b)}${tt((isNaN(this.opacity)?1:this.opacity)*255)}`}function vo(){const e=Jt(this.opacity);return`${e===1?"rgb(":"rgba("}${nt(this.r)}, ${nt(this.g)}, ${nt(this.b)}${e===1?")":`, ${e})`}`}function Jt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function nt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function tt(e){return e=nt(e),(e<16?"0":"")+e.toString(16)}function po(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ie(e,t,n,o)}function wi(e){if(e instanceof Ie)return new Ie(e.h,e.s,e.l,e.opacity);if(e instanceof Ot||(e=kt(e)),!e)return new Ie;if(e instanceof Ie)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 Ie(s,a,l,e.opacity)}function Pa(e,t,n,o){return arguments.length===1?wi(e):new Ie(e,t,n,o??1)}function Ie(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}qn(Ie,Pa,yi(Ot,{brighter(e){return e=e==null?qt:Math.pow(qt,e),new Ie(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Mt:Math.pow(Mt,e),new Ie(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 Se(_n(e>=240?e-240:e+120,i,o),_n(e,i,o),_n(e<120?e+240:e-120,i,o),this.opacity)},clamp(){return new Ie(mo(this.h),Rt(this.s),Rt(this.l),Jt(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=Jt(this.opacity);return`${e===1?"hsl(":"hsla("}${mo(this.h)}, ${Rt(this.s)*100}%, ${Rt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function mo(e){return e=(e||0)%360,e<0?e+360:e}function Rt(e){return Math.max(0,Math.min(1,e||0))}function _n(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 Aa(e,t){return function(n){return e+n*t}}function Oa(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 za(e){return(e=+e)==1?bi:function(t,n){return n-t?Oa(t,n,e):_i(isNaN(t)?n:t)}}function bi(e,t){var n=t-e;return n?Aa(e,n):_i(isNaN(e)?t:e)}const yo=function e(t){var n=za(t);function o(i,r){var s=n((i=An(i)).r,(r=An(r)).r),a=n(i.g,r.g),l=n(i.b,r.b),u=bi(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 Ke(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var On=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,bn=new RegExp(On.source,"g");function Ba(e){return function(){return e}}function Ra(e){return function(t){return e(t)+""}}function Va(e,t){var n=On.lastIndex=bn.lastIndex=0,o,i,r,s=-1,a=[],l=[];for(e=e+"",t=t+"";(o=On.exec(e))&&(i=bn.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:Ke(o,i)})),n=bn.lastIndex;return n<t.length&&(r=t.slice(n),a[s]?a[s]+=r:a[++s]=r),a.length<2?l[0]?Ra(l[0].x):Ba(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 wo=180/Math.PI,zn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function xi(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)*wo,skewX:Math.atan(l)*wo,scaleX:s,scaleY:a}}var Vt;function Ha(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?zn:xi(t.a,t.b,t.c,t.d,t.e,t.f)}function La(e){return e==null||(Vt||(Vt=document.createElementNS("http://www.w3.org/2000/svg","g")),Vt.setAttribute("transform",e),!(e=Vt.transform.baseVal.consolidate()))?zn:(e=e.matrix,xi(e.a,e.b,e.c,e.d,e.e,e.f))}function Ei(e,t,n,o){function i(u){return u.length?u.pop()+" ":""}function r(u,c,d,g,m,N){if(u!==d||c!==g){var _=m.push("translate(",null,t,null,n);N.push({i:_-4,x:Ke(u,d)},{i:_-2,x:Ke(c,g)})}else(d||g)&&m.push("translate("+d+t+g+n)}function s(u,c,d,g){u!==c?(u-c>180?c+=360:c-u>180&&(u+=360),g.push({i:d.push(i(d)+"rotate(",null,o)-2,x:Ke(u,c)})):c&&d.push(i(d)+"rotate("+c+o)}function a(u,c,d,g){u!==c?g.push({i:d.push(i(d)+"skewX(",null,o)-2,x:Ke(u,c)}):c&&d.push(i(d)+"skewX("+c+o)}function l(u,c,d,g,m,N){if(u!==d||c!==g){var _=m.push(i(m)+"scale(",null,",",null,")");N.push({i:_-4,x:Ke(u,d)},{i:_-2,x:Ke(c,g)})}else(d!==1||g!==1)&&m.push(i(m)+"scale("+d+","+g+")")}return function(u,c){var d=[],g=[];return u=e(u),c=e(c),r(u.translateX,u.translateY,c.translateX,c.translateY,d,g),s(u.rotate,c.rotate,d,g),a(u.skewX,c.skewX,d,g),l(u.scaleX,u.scaleY,c.scaleX,c.scaleY,d,g),u=c=null,function(m){for(var N=-1,_=g.length,b;++N<_;)d[(b=g[N]).i]=b.x(m);return d.join("")}}}var Fa=Ei(Ha,"px, ","px)","deg)"),Ya=Ei(La,", ",")",")"),Ga=1e-12;function _o(e){return((e=Math.exp(e))+1/e)/2}function Xa(e){return((e=Math.exp(e))-1/e)/2}function Ua(e){return((e=Math.exp(2*e))-1)/(e+1)}const Za=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],g=s[2],m=c-a,N=d-l,_=m*m+N*N,b,S;if(_<Ga)S=Math.log(g/u)/t,b=function(V){return[a+V*m,l+V*N,u*Math.exp(t*V*S)]};else{var M=Math.sqrt(_),w=(g*g-u*u+o*_)/(2*u*n*M),x=(g*g-u*u-o*_)/(2*g*n*M),A=Math.log(Math.sqrt(w*w+1)-w),Y=Math.log(Math.sqrt(x*x+1)-x);S=(Y-A)/t,b=function(V){var H=V*S,Z=_o(A),T=u/(n*M)*(Z*Ua(t*H+A)-Xa(A));return[a+T*m,l+T*N,u*Z/_o(t*H+A)]}}return b.duration=S*1e3*t/Math.SQRT2,b}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 vt=0,bt=0,wt=0,Si=1e3,Qt,xt,jt=0,rt=0,ln=0,$t=typeof performance=="object"&&performance.now?performance:Date,Ni=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Jn(){return rt||(Ni(Wa),rt=$t.now()+ln)}function Wa(){rt=0}function en(){this._call=this._time=this._next=null}en.prototype=Ci.prototype={constructor:en,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Jn():+n)+(t==null?0:+t),!this._next&&xt!==this&&(xt?xt._next=this:Qt=this,xt=this),this._call=e,this._time=n,Bn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Bn())}};function Ci(e,t,n){var o=new en;return o.restart(e,t,n),o}function Ka(){Jn(),++vt;for(var e=Qt,t;e;)(t=rt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--vt}function bo(){rt=(jt=$t.now())+ln,vt=bt=0;try{Ka()}finally{vt=0,Ja(),rt=0}}function qa(){var e=$t.now(),t=e-jt;t>Si&&(ln-=t,jt=e)}function Ja(){for(var e,t=Qt,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:Qt=n);xt=e,Bn(o)}function Bn(e){if(!vt){bt&&(bt=clearTimeout(bt));var t=e-rt;t>24?(e<1/0&&(bt=setTimeout(bo,e-$t.now()-ln)),wt&&(wt=clearInterval(wt))):(wt||(jt=$t.now(),wt=setInterval(qa,Si)),vt=1,Ni(bo))}}function xo(e,t,n){var o=new en;return t=t==null?0:+t,o.restart(i=>{o.stop(),e(i+t)},t,n),o}var Qa=sn("start","end","cancel","interrupt"),ja=[],Mi=0,Eo=1,Rn=2,Ut=3,So=4,Vn=5,Zt=6;function un(e,t,n,o,i,r){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;el(e,n,{name:t,index:o,group:i,on:Qa,tween:ja,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Mi})}function Qn(e,t){var n=Te(e,t);if(n.state>Mi)throw new Error("too late; already scheduled");return n}function Be(e,t){var n=Te(e,t);if(n.state>Ut)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 el(e,t,n){var o=e.__transition,i;o[t]=n,n.timer=Ci(r,0,n.time);function r(u){n.state=Eo,n.timer.restart(s,n.delay,n.time),n.delay<=u&&s(u-n.delay)}function s(u){var c,d,g,m;if(n.state!==Eo)return l();for(c in o)if(m=o[c],m.name===n.name){if(m.state===Ut)return xo(s);m.state===So?(m.state=Zt,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete o[c]):+c<t&&(m.state=Zt,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete o[c])}if(xo(function(){n.state===Ut&&(n.state=So,n.timer.restart(a,n.delay,n.time),a(u))}),n.state=Rn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Rn){for(n.state=Ut,i=new Array(g=n.tween.length),c=0,d=-1;c<g;++c)(m=n.tween[c].value.call(e,e.__data__,n.index,n.group))&&(i[++d]=m);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=Vn,1),d=-1,g=i.length;++d<g;)i[d].call(e,c);n.state===Vn&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=Zt,n.timer.stop(),delete o[t];for(var u in o)return;delete e.__transition}}function Wt(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>Rn&&o.state<Vn,o.state=Zt,o.timer.stop(),o.on.call(i?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}r&&delete e.__transition}}function tl(e){return this.each(function(){Wt(this,e)})}function nl(e,t){var n,o;return function(){var i=Be(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 ol(e,t,n){var o,i;if(typeof n!="function")throw new Error;return function(){var r=Be(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 il(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?nl:ol)(n,e,t))}function jn(e,t,n){var o=e._id;return e.each(function(){var i=Be(this,o);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return Te(i,o).value[t]}}function Ii(e,t){var n;return(typeof t=="number"?Ke:t instanceof kt?yo:(n=kt(t))?(t=n,yo):Va)(e,t)}function rl(e){return function(){this.removeAttribute(e)}}function sl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function al(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 ll(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 ul(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 cl(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 dl(e,t){var n=an(e),o=n==="transform"?Ya:Ii;return this.attrTween(e,typeof t=="function"?(n.local?cl:ul)(n,o,jn(this,"attr."+e,t)):t==null?(n.local?sl:rl)(n):(n.local?ll:al)(n,o,t))}function fl(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function hl(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function gl(e,t){var n,o;function i(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&hl(e,r)),n}return i._value=t,i}function vl(e,t){var n,o;function i(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&fl(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=an(e);return this.tween(n,(o.local?gl:vl)(o,t))}function ml(e,t){return function(){Qn(this,e).delay=+t.apply(this,arguments)}}function yl(e,t){return t=+t,function(){Qn(this,e).delay=t}}function wl(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?ml:yl)(t,e)):Te(this.node(),t).delay}function _l(e,t){return function(){Be(this,e).duration=+t.apply(this,arguments)}}function bl(e,t){return t=+t,function(){Be(this,e).duration=t}}function xl(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?_l:bl)(t,e)):Te(this.node(),t).duration}function El(e,t){if(typeof t!="function")throw new Error;return function(){Be(this,e).ease=t}}function Sl(e){var t=this._id;return arguments.length?this.each(El(t,e)):Te(this.node(),t).ease}function Nl(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Be(this,e).ease=n}}function Cl(e){if(typeof e!="function")throw new Error;return this.each(Nl(this._id,e))}function Ml(e){typeof e!="function"&&(e=si(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 Xe(o,this._parents,this._name,this._id)}function Il(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),g,m=0;m<c;++m)(g=l[m]||u[m])&&(d[m]=g);for(;a<o;++a)s[a]=t[a];return new Xe(s,this._parents,this._name,this._id)}function kl(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 $l(e,t,n){var o,i,r=kl(t)?Qn:Be;return function(){var s=r(this,e),a=s.on;a!==o&&(i=(o=a).copy()).on(t,n),s.on=i}}function Tl(e,t){var n=this._id;return arguments.length<2?Te(this.node(),n).on.on(e):this.each($l(n,e,t))}function Dl(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Pl(){return this.on("end.remove",Dl(this._id))}function Al(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Wn(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,g=0;g<l;++g)(c=a[g])&&(d=e.call(c,c.__data__,g,a))&&("__data__"in c&&(d.__data__=c.__data__),u[g]=d,un(u[g],t,n,g,u,Te(c,n)));return new Xe(r,this._parents,t,n)}function Ol(e){var t=this._name,n=this._id;typeof e!="function"&&(e=ri(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 g=e.call(c,c.__data__,d,l),m,N=Te(c,n),_=0,b=g.length;_<b;++_)(m=g[_])&&un(m,t,n,_,g,N);r.push(g),s.push(c)}return new Xe(r,s,t,n)}var zl=At.prototype.constructor;function Bl(){return new zl(this._groups,this._parents)}function Rl(e,t){var n,o,i;return function(){var r=gt(this,e),s=(this.style.removeProperty(e),gt(this,e));return r===s?null:r===n&&s===o?i:i=t(n=r,o=s)}}function ki(e){return function(){this.style.removeProperty(e)}}function Vl(e,t,n){var o,i=n+"",r;return function(){var s=gt(this,e);return s===i?null:s===o?r:r=t(o=s,n)}}function Hl(e,t,n){var o,i,r;return function(){var s=gt(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),gt(this,e))),s===l?null:s===o&&l===i?r:(i=l,r=t(o=s,a))}}function Ll(e,t){var n,o,i,r="style."+t,s="end."+r,a;return function(){var l=Be(this,e),u=l.on,c=l.value[r]==null?a||(a=ki(t)):void 0;(u!==n||i!==c)&&(o=(n=u).copy()).on(s,i=c),l.on=o}}function Fl(e,t,n){var o=(e+="")=="transform"?Fa:Ii;return t==null?this.styleTween(e,Rl(e,o)).on("end.style."+e,ki(e)):typeof t=="function"?this.styleTween(e,Hl(e,o,jn(this,"style."+e,t))).each(Ll(this._id,e)):this.styleTween(e,Vl(e,o,t),n).on("end.style."+e,null)}function Yl(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function Gl(e,t,n){var o,i;function r(){var s=t.apply(this,arguments);return s!==i&&(o=(i=s)&&Yl(e,s,n)),o}return r._value=t,r}function Xl(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,Gl(e,t,n??""))}function Ul(e){return function(){this.textContent=e}}function Zl(e){return function(){var t=e(this);this.textContent=t??""}}function Wl(e){return this.tween("text",typeof e=="function"?Zl(jn(this,"text",e)):Ul(e==null?"":e+""))}function Kl(e){return function(t){this.textContent=e.call(this,t)}}function ql(e){var t,n;function o(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&Kl(i)),t}return o._value=e,o}function Jl(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,ql(e))}function Ql(){for(var e=this._name,t=this._id,n=$i(),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);un(l,e,n,u,s,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new Xe(o,this._parents,e,n)}function jl(){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=Be(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 eu=0;function Xe(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function $i(){return++eu}var Re=At.prototype;Xe.prototype={constructor:Xe,select:Al,selectAll:Ol,selectChild:Re.selectChild,selectChildren:Re.selectChildren,filter:Ml,merge:Il,selection:Bl,transition:Ql,call:Re.call,nodes:Re.nodes,node:Re.node,size:Re.size,empty:Re.empty,each:Re.each,on:Tl,attr:dl,attrTween:pl,style:Fl,styleTween:Xl,text:Wl,textTween:Jl,remove:Pl,tween:il,delay:wl,duration:xl,ease:Sl,easeVarying:Cl,end:jl,[Symbol.iterator]:Re[Symbol.iterator]};function tu(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var nu={time:null,delay:0,duration:250,ease:tu};function ou(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 iu(e){var t,n;e instanceof Xe?(t=e._id,e=e._name):(t=$i(),(n=nu).time=Jn(),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])&&un(l,e,t,u,s,n||ou(l,t));return new Xe(o,this._parents,e,t)}At.prototype.interrupt=tl;At.prototype.transition=iu;const Ht=e=>()=>e;function ru(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 Le(e,t,n){this.k=e,this.x=t,this.y=n}Le.prototype={constructor:Le,scale:function(e){return e===1?this:new Le(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Le(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 pt=new Le(1,0,0);Le.prototype;function xn(e){e.stopImmediatePropagation()}function _t(e){e.preventDefault(),e.stopImmediatePropagation()}function su(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function au(){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 No(){return this.__zoom||pt}function lu(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function uu(){return navigator.maxTouchPoints||"ontouchstart"in this}function cu(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 du(){var e=su,t=au,n=cu,o=lu,i=uu,r=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Za,u=sn("start","zoom","end"),c,d,g,m=500,N=150,_=0,b=10;function S(y){y.property("__zoom",No).on("wheel.zoom",H,{passive:!1}).on("mousedown.zoom",Z).on("dblclick.zoom",T).filter(i).on("touchstart.zoom",O).on("touchmove.zoom",E).on("touchend.zoom touchcancel.zoom",j).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}S.transform=function(y,I,C,$){var D=y.selection?y.selection():y;D.property("__zoom",No),y!==D?A(y,I,C,$):D.interrupt().each(function(){Y(this,arguments).event($).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},S.scaleBy=function(y,I,C,$){S.scaleTo(y,function(){var D=this.__zoom.k,P=typeof I=="function"?I.apply(this,arguments):I;return D*P},C,$)},S.scaleTo=function(y,I,C,$){S.transform(y,function(){var D=t.apply(this,arguments),P=this.__zoom,z=C==null?x(D):typeof C=="function"?C.apply(this,arguments):C,F=P.invert(z),Q=typeof I=="function"?I.apply(this,arguments):I;return n(w(M(P,Q),z,F),D,s)},C,$)},S.translateBy=function(y,I,C,$){S.transform(y,function(){return n(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof C=="function"?C.apply(this,arguments):C),t.apply(this,arguments),s)},null,$)},S.translateTo=function(y,I,C,$,D){S.transform(y,function(){var P=t.apply(this,arguments),z=this.__zoom,F=$==null?x(P):typeof $=="function"?$.apply(this,arguments):$;return n(pt.translate(F[0],F[1]).scale(z.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof C=="function"?-C.apply(this,arguments):-C),P,s)},$,D)};function M(y,I){return I=Math.max(r[0],Math.min(r[1],I)),I===y.k?y:new Le(I,y.x,y.y)}function w(y,I,C){var $=I[0]-C[0]*y.k,D=I[1]-C[1]*y.k;return $===y.x&&D===y.y?y:new Le(y.k,$,D)}function x(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function A(y,I,C,$){y.on("start.zoom",function(){Y(this,arguments).event($).start()}).on("interrupt.zoom end.zoom",function(){Y(this,arguments).event($).end()}).tween("zoom",function(){var D=this,P=arguments,z=Y(D,P).event($),F=t.apply(D,P),Q=C==null?x(F):typeof C=="function"?C.apply(D,P):C,L=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),B=D.__zoom,W=typeof I=="function"?I.apply(D,P):I,le=l(B.invert(Q).concat(L/B.k),W.invert(Q).concat(L/W.k));return function(re){if(re===1)re=W;else{var ue=le(re),te=L/ue[2];re=new Le(te,Q[0]-ue[0]*te,Q[1]-ue[1]*te)}z.zoom(null,re)}})}function Y(y,I,C){return!C&&y.__zooming||new V(y,I)}function V(y,I){this.that=y,this.args=I,this.active=0,this.sourceEvent=null,this.extent=t.apply(y,I),this.taps=0}V.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,I){return this.mouse&&y!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(y){var I=Me(this.that).datum();u.call(y,this.that,new ru(y,{sourceEvent:this.sourceEvent,target:S,type:y,transform:this.that.__zoom,dispatch:u}),I)}};function H(y,...I){if(!e.apply(this,arguments))return;var C=Y(this,I).event(y),$=this.__zoom,D=Math.max(r[0],Math.min(r[1],$.k*Math.pow(2,o.apply(this,arguments)))),P=Pe(y);if(C.wheel)(C.mouse[0][0]!==P[0]||C.mouse[0][1]!==P[1])&&(C.mouse[1]=$.invert(C.mouse[0]=P)),clearTimeout(C.wheel);else{if($.k===D)return;C.mouse=[P,$.invert(P)],Wt(this),C.start()}_t(y),C.wheel=setTimeout(z,N),C.zoom("mouse",n(w(M($,D),C.mouse[0],C.mouse[1]),C.extent,s));function z(){C.wheel=null,C.end()}}function Z(y,...I){if(g||!e.apply(this,arguments))return;var C=y.currentTarget,$=Y(this,I,!0).event(y),D=Me(y.view).on("mousemove.zoom",Q,!0).on("mouseup.zoom",L,!0),P=Pe(y,C),z=y.clientX,F=y.clientY;pi(y.view),xn(y),$.mouse=[P,this.__zoom.invert(P)],Wt(this),$.start();function Q(B){if(_t(B),!$.moved){var W=B.clientX-z,le=B.clientY-F;$.moved=W*W+le*le>_}$.event(B).zoom("mouse",n(w($.that.__zoom,$.mouse[0]=Pe(B,C),$.mouse[1]),$.extent,s))}function L(B){D.on("mousemove.zoom mouseup.zoom",null),mi(B.view,$.moved),_t(B),$.event(B).end()}}function T(y,...I){if(e.apply(this,arguments)){var C=this.__zoom,$=Pe(y.changedTouches?y.changedTouches[0]:y,this),D=C.invert($),P=C.k*(y.shiftKey?.5:2),z=n(w(M(C,P),$,D),t.apply(this,I),s);_t(y),a>0?Me(this).transition().duration(a).call(A,z,$,y):Me(this).call(S.transform,z,$,y)}}function O(y,...I){if(e.apply(this,arguments)){var C=y.touches,$=C.length,D=Y(this,I,y.changedTouches.length===$).event(y),P,z,F,Q;for(xn(y),z=0;z<$;++z)F=C[z],Q=Pe(F,this),Q=[Q,this.__zoom.invert(Q),F.identifier],D.touch0?!D.touch1&&D.touch0[2]!==Q[2]&&(D.touch1=Q,D.taps=0):(D.touch0=Q,P=!0,D.taps=1+!!c);c&&(c=clearTimeout(c)),P&&(D.taps<2&&(d=Q[0],c=setTimeout(function(){c=null},m)),Wt(this),D.start())}}function E(y,...I){if(this.__zooming){var C=Y(this,I).event(y),$=y.changedTouches,D=$.length,P,z,F,Q;for(_t(y),P=0;P<D;++P)z=$[P],F=Pe(z,this),C.touch0&&C.touch0[2]===z.identifier?C.touch0[0]=F:C.touch1&&C.touch1[2]===z.identifier&&(C.touch1[0]=F);if(z=C.that.__zoom,C.touch1){var L=C.touch0[0],B=C.touch0[1],W=C.touch1[0],le=C.touch1[1],re=(re=W[0]-L[0])*re+(re=W[1]-L[1])*re,ue=(ue=le[0]-B[0])*ue+(ue=le[1]-B[1])*ue;z=M(z,Math.sqrt(re/ue)),F=[(L[0]+W[0])/2,(L[1]+W[1])/2],Q=[(B[0]+le[0])/2,(B[1]+le[1])/2]}else if(C.touch0)F=C.touch0[0],Q=C.touch0[1];else return;C.zoom("touch",n(w(z,F,Q),C.extent,s))}}function j(y,...I){if(this.__zooming){var C=Y(this,I).event(y),$=y.changedTouches,D=$.length,P,z;for(xn(y),g&&clearTimeout(g),g=setTimeout(function(){g=null},m),P=0;P<D;++P)z=$[P],C.touch0&&C.touch0[2]===z.identifier?delete C.touch0:C.touch1&&C.touch1[2]===z.identifier&&delete C.touch1;if(C.touch1&&!C.touch0&&(C.touch0=C.touch1,delete C.touch1),C.touch0)C.touch0[1]=this.__zoom.invert(C.touch0[0]);else if(C.end(),C.taps===2&&(z=Pe(z,this),Math.hypot(d[0]-z[0],d[1]-z[1])<b)){var F=Me(this).on("dblclick.zoom");F&&F.apply(this,arguments)}}}return S.wheelDelta=function(y){return arguments.length?(o=typeof y=="function"?y:Ht(+y),S):o},S.filter=function(y){return arguments.length?(e=typeof y=="function"?y:Ht(!!y),S):e},S.touchable=function(y){return arguments.length?(i=typeof y=="function"?y:Ht(!!y),S):i},S.extent=function(y){return arguments.length?(t=typeof y=="function"?y:Ht([[+y[0][0],+y[0][1]],[+y[1][0],+y[1][1]]]),S):t},S.scaleExtent=function(y){return arguments.length?(r[0]=+y[0],r[1]=+y[1],S):[r[0],r[1]]},S.translateExtent=function(y){return arguments.length?(s[0][0]=+y[0][0],s[1][0]=+y[1][0],s[0][1]=+y[0][1],s[1][1]=+y[1][1],S):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},S.constrain=function(y){return arguments.length?(n=y,S):n},S.duration=function(y){return arguments.length?(a=+y,S):a},S.interpolate=function(y){return arguments.length?(l=y,S):l},S.on=function(){var y=u.on.apply(u,arguments);return y===u?S:y},S.clickDistance=function(y){return arguments.length?(_=(y=+y)*y,S):Math.sqrt(_)},S.tapDistance=function(y){return arguments.length?(b=+y,S):b},S}var K=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(K||{}),eo=(e=>(e.Partial="partial",e.Full="full",e))(eo||{}),je=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(je||{}),st=(e=>(e.Strict="strict",e.Loose="loose",e))(st||{}),Hn=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(Hn||{}),St=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(St||{}),fu=(e=>(e.TopLeft="top-left",e.TopCenter="top-center",e.TopRight="top-right",e.BottomLeft="bottom-left",e.BottomCenter="bottom-center",e.BottomRight="bottom-right",e))(fu||{});function Ln(e){var t,n;const o=((n=(t=e.composedPath)==null?void 0:t.call(e))==null?void 0:n[0])||e.target,i=typeof o?.hasAttribute=="function"?o.hasAttribute("contenteditable"):!1,r=typeof o?.closest=="function"?o.closest(".nokey"):null;return["INPUT","SELECT","TEXTAREA"].includes(o?.nodeName)||i||!!r}function hu(e){return e.ctrlKey||e.metaKey||e.shiftKey}function Co(e,t,n,o){const i=t.replace("+",`
  2. `).replace(`
  3. `,`
  4. +`).split(`
  5. `).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 gu(e,t){return n=>{if(!n.code&&!n.key)return!1;const o=vu(n.code,e);return Array.isArray(e)?e.some(i=>Co(n[o],i,t,n.type==="keyup")):Co(n[o],e,t,n.type==="keyup")}}function vu(e,t){return t.includes(e)?"code":"key"}function Nt(e,t){const n=ye(()=>ce(t?.actInsideInputWithModifier)??!1),o=ye(()=>ce(t?.target)??window),i=ve(ce(e)===!0);let r=!1;const s=new Set;let a=u(ce(e));ge(()=>ce(e),(c,d)=>{typeof d=="boolean"&&typeof c!="boolean"&&l(),a=u(c)},{immediate:!0}),Ue(()=>{oi(window,["blur","contextmenu"],l)}),so((...c)=>a(...c),c=>{r=hu(c),!((!r||r&&!n.value)&&Ln(c))&&(c.preventDefault(),i.value=!0)},{eventName:"keydown",target:o}),so((...c)=>a(...c),c=>{if(i.value){if((!r||r&&!n.value)&&Ln(c))return;r=!1,i.value=!1}},{eventName:"keyup",target:o});function l(){r=!1,s.clear(),i.value=ce(e)===!0}function u(c){return c===null?(l(),()=>!1):typeof c=="boolean"?(l(),i.value=c,()=>!1):Array.isArray(c)||typeof c=="string"?gu(c,s):c}return i}const Ti="vue-flow__node-desc",Di="vue-flow__edge-desc",pu="vue-flow__aria-live",Pi=["Enter"," ","Escape"],ft={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Fn(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function Yn(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 cn(e){return{width:e.offsetWidth,height:e.offsetHeight}}function at(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function Ai(e,t){return{x:at(e.x,t[0][0],t[1][0]),y:at(e.y,t[0][1],t[1][1])}}function Mo(e){const t=e.getRootNode();return"elementFromPoint"in t?t:window.document}function Qe(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function ot(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!Qe(e)}function Et(e){return ot(e)&&"computedPosition"in e}function Lt(e){return!Number.isNaN(e)&&Number.isFinite(e)}function mu(e){return Lt(e.width)&&Lt(e.height)&&Lt(e.x)&&Lt(e.y)}function yu(e,t,n){const o={id:e.id.toString(),type:e.type??"default",dimensions:ut({width:0,height:0}),computedPosition:ut({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:be(e.data)?e.data:{},events:ut(be(e.events)?e.events:{})};return Object.assign(t??o,e,{id:e.id.toString(),parentNode:n})}function Oi(e,t,n){var o,i;const r={id:e.id.toString(),type:e.type??t?.type??"default",source:e.source.toString(),target:e.target.toString(),sourceHandle:(o=e.sourceHandle)==null?void 0:o.toString(),targetHandle:(i=e.targetHandle)==null?void 0:i.toString(),updatable:e.updatable??n?.updatable,selectable:e.selectable??n?.selectable,focusable:e.focusable??n?.focusable,data:be(e.data)?e.data:{},events:ut(be(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function zi(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 wu(...e){if(e.length===3){const[r,s,a]=e;return zi(r,s,a,"target")}const[t,n]=e,o=typeof t=="string"?t:t.id;return n.filter(r=>Qe(r)&&r.source===o).map(r=>n.find(s=>ot(s)&&s.id===r.target))}function _u(...e){if(e.length===3){const[r,s,a]=e;return zi(r,s,a,"source")}const[t,n]=e,o=typeof t=="string"?t:t.id;return n.filter(r=>Qe(r)&&r.target===o).map(r=>n.find(s=>ot(s)&&s.id===r.source))}function Bi({source:e,sourceHandle:t,target:n,targetHandle:o}){return`vueflow__edge-${e}${t??""}-${n}${o??""}`}function bu(e,t){return t.some(n=>Qe(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 Ri({x:e,y:t},{x:n,y:o,zoom:i}){return{x:e*i+n,y:t*i+o}}function Tt({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?dn(a,s):a}function xu(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 Vi({x:e,y:t,width:n,height:o}){return{x:e,y:t,x2:e+n,y2:t+o}}function Eu({x:e,y:t,x2:n,y2:o}){return{x:e,y:t,width:n-e,height:o-t}}function Hi(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=xu(t,Vi({...o.computedPosition,...o.dimensions}))}return Eu(t)}function Li(e,t,n={x:0,y:0,zoom:1},o=!1,i=!1){const r={...Tt(t,n),width:t.width/n.zoom,height:t.height/n.zoom},s=[];for(const a of e){const{dimensions:l,selectable:u=!0,hidden:c=!1}=a,d=l.width??a.width??null,g=l.height??a.height??null;if(i&&!u||c)continue;const m=Yn(r,Fn(a)),N=d===null||g===null,_=o&&m>0,b=(d??0)*(g??0);(N||_||m>=b||a.dragging)&&s.push(a)}return s}function Fi(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 Io(e,t,n,o,i,r=.1,s={x:0,y:0}){const a=t/(e.width*(1+r)),l=n/(e.height*(1+r)),u=Math.min(a,l),c=at(u,o,i),d=e.x+e.width/2,g=e.y+e.height/2,m=t/2-d*c+(s.x??0),N=n/2-g*c+(s.y??0);return{x:m,y:N,zoom:c}}function Su(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function Yi(e,t){if(!e.parentNode)return!1;const n=t(e.parentNode);return n?n.selected?!0:Yi(n,t):!1}function Dt(e,t){return typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`}function ko(e,t,n){return e<t?at(Math.abs(e-t),1,t)/t:e>n?-at(Math.abs(e-n),1,t)/t:0}function Gi(e,t,n=15,o=40){const i=ko(e.x,o,t.width-o)*n,r=ko(e.y,o,t.height-o)*n;return[i,r]}function En(e,t){if(t){const n=e.position.x+e.dimensions.width-t.dimensions.width,o=e.position.y+e.dimensions.height-t.dimensions.height;if(n>0||o>0||e.position.x<0||e.position.y<0){let i={};if(typeof t.style=="function"?i={...t.style(t)}:t.style&&(i={...t.style}),i.width=i.width??`${t.dimensions.width}px`,i.height=i.height??`${t.dimensions.height}px`,n>0)if(typeof i.width=="string"){const r=Number(i.width.replace("px",""));i.width=`${r+n}px`}else i.width+=n;if(o>0)if(typeof i.height=="string"){const r=Number(i.height.replace("px",""));i.height=`${r+o}px`}else i.height+=o;if(e.position.x<0){const r=Math.abs(e.position.x);if(t.position.x=t.position.x-r,typeof i.width=="string"){const s=Number(i.width.replace("px",""));i.width=`${s+r}px`}else i.width+=r;e.position.x=0}if(e.position.y<0){const r=Math.abs(e.position.y);if(t.position.y=t.position.y-r,typeof i.height=="string"){const s=Number(i.height.replace("px",""));i.height=`${s+r}px`}else i.height+=r;e.position.y=0}t.dimensions.width=Number(i.width.toString().replace("px","")),t.dimensions.height=Number(i.height.toString().replace("px","")),typeof t.style=="function"?t.style=r=>{const s=t.style;return{...s(r),...i}}:t.style={...t.style,...i}}}}function $o(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(Et(s)&&(typeof a.position<"u"&&(s.position=a.position),typeof a.dragging<"u"&&(s.dragging=a.dragging),s.expandParent&&s.parentNode)){const l=t[r.indexOf(s.parentNode)];l&&Et(l)&&En(s,l)}break;case"dimensions":if(Et(s)&&(typeof a.dimensions<"u"&&(s.dimensions=a.dimensions),typeof a.updateStyle<"u"&&a.updateStyle&&(s.style={...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<"u"&&(s.resizing=a.resizing),s.expandParent&&s.parentNode)){const l=t[r.indexOf(s.parentNode)];l&&Et(l)&&(!!l.dimensions.width&&!!l.dimensions.height?En(s,l):Ye(()=>{En(s,l)}))}break}return t}function We(e,t){return{id:e,type:"select",selected:t}}function To(e){return{item:e,type:"add"}}function Do(e){return{id:e,type:"remove"}}function Po(e,t,n,o,i){return{id:e,source:t,target:n,sourceHandle:o||null,targetHandle:i||null,type:"remove"}}function qe(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(We(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 rn(l),{off:l}},off:i,trigger:a=>Promise.all(Array.from(t).map(l=>l(a))),hasListeners:o,fns:t}}function Ao(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 Nu(e,t,n,o,i){var r,s;const a=[];for(const l of e)(l.selected||l.id===i)&&(!l.parentNode||!Yi(l,o))&&(l.draggable||t&&typeof l.draggable>"u")&&a.push(ut({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 Sn({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 Xi(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 Cu(e,t,n){const[o,i,r,s]=typeof e!="string"?Xi(e.padding):[0,0,0,0];return n&&typeof n.computedPosition.x<"u"&&typeof n.computedPosition.y<"u"&&typeof n.dimensions.width<"u"&&typeof n.dimensions.height<"u"?[[n.computedPosition.x+s,n.computedPosition.y+o],[n.computedPosition.x+n.dimensions.width-i,n.computedPosition.y+n.dimensions.height-r]]:!1}function Mu(e,t,n,o){let i=e.extent||n;if((i==="parent"||!Array.isArray(i)&&i?.range==="parent")&&!e.expandParent)if(e.parentNode&&o&&e.dimensions.width&&e.dimensions.height){const r=Cu(i,e,o);r&&(i=r)}else t(new Ee(xe.NODE_EXTENT_INVALID,e.id)),i=n;else if(Array.isArray(i)){const r=o?.computedPosition.x||0,s=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?.range&&Array.isArray(i.range)){const[r,s,a,l]=Xi(i.padding),u=o?.computedPosition.x||0,c=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 Iu({width:e,height:t},n){return[n[0],[n[1][0]-(e||0),n[1][1]-(t||0)]]}function to(e,t,n,o,i){const r=Iu(e.dimensions,Mu(e,n,o,i)),s=Ai(t,r);return{position:{x:s.x-(i?.computedPosition.x||0),y:s.y-(i?.computedPosition.y||0)},computedPosition:s}}function tn(e,t,n=K.Left){const o=(t?.x??0)+e.computedPosition.x,i=(t?.y??0)+e.computedPosition.y,{width:r,height:s}=t??Tu(e);switch(t?.position??n){case K.Top:return{x:o+r/2,y:i};case K.Right:return{x:o+r,y:i+s/2};case K.Bottom:return{x:o+r/2,y:i+s};case K.Left:return{x:o,y:i+s/2}}}function Oo(e=[],t){return e.length&&(t?e.find(n=>n.id===t):e[0])||null}function ku({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=Vi({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)),g=Math.max(0,Math.min(c.y2,u.y2)-Math.max(c.y,u.y));return Math.ceil(d*g)>0}function $u(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 xe=(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))(xe||{});const zo={MISSING_STYLES:()=>"It seems that you haven't loaded the necessary styles. Please import '@vue-flow/core/dist/style.css' to ensure that the graph is rendered correctly",MISSING_VIEWPORT_DIMENSIONS:()=>"The Vue Flow parent container needs a width and a height to render the graph",NODE_INVALID:e=>`Node is invalid
  6. Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found
  7. Node: ${e}`,NODE_MISSING_PARENT:(e,t)=>`Node is missing a parent
  8. Node: ${e}
  9. Parent: ${t}`,NODE_TYPE_MISSING:e=>`Node type is missing
  10. Type: ${e}`,NODE_EXTENT_INVALID:e=>`Only child nodes can use a parent extent
  11. Node: ${e}`,EDGE_INVALID:e=>`An edge needs a source and a target
  12. Edge: ${e}`,EDGE_SOURCE_MISSING:(e,t)=>`Edge source is missing
  13. Edge: ${e}
  14. Source: ${t}`,EDGE_TARGET_MISSING:(e,t)=>`Edge target is missing
  15. Edge: ${e}
  16. Target: ${t}`,EDGE_TYPE_MISSING:e=>`Edge type is missing
  17. Type: ${e}`,EDGE_SOURCE_TARGET_SAME:(e,t,n)=>`Edge source and target are the same
  18. Edge: ${e}
  19. Source: ${t}
  20. Target: ${n}`,EDGE_SOURCE_TARGET_MISSING:(e,t,n)=>`Edge source or target is missing
  21. Edge: ${e}
  22. Source: ${t}
  23. Target: ${n}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
  24. Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found
  25. 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 Ee extends Error{constructor(t,...n){var o;super((o=zo[t])==null?void 0:o.call(zo,...n)),this.name="VueFlowError",this.code=t,this.args=n}}function no(e){return"clientX"in e}function Ui(e){return"sourceEvent"in e}function Ge(e,t){var n,o;const i=no(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-(t?.left??0),y:s-(t?.top??0)}}const nn=()=>{var e;return typeof navigator<"u"&&((e=navigator?.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Tu(e){var t,n;return{width:((t=e.dimensions)==null?void 0:t.width)??e.width??0,height:((n=e.dimensions)==null?void 0:n.height)??e.height??0}}function dn(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}function Zi(){return{handleDomNode:null,isValid:!1,connection:{source:"",target:"",sourceHandle:null,targetHandle:null},endHandle:null}}function Nn(e){e?.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function Bo(e,t,n,o){const i=[];for(const r of t[n]||[])if(`${e.id}-${r.id}-${n}`!==o){const{x:s,y:a}=tn(e,r);i.push({id:r.id||null,type:n,nodeId:e.id,x:s,y:a})}return i}function Du(e,t,n,o,i,r){const{x:s,y:a}=Ge(e),u=t.elementsFromPoint(s,a).find(N=>N.classList.contains("vue-flow__handle"));if(u){const N=u.getAttribute("data-nodeid");if(N){const _=oo(void 0,u),b=u.getAttribute("data-handleid"),S=r({nodeId:N,id:b,type:_});if(S){const M=i.find(w=>w.nodeId===N&&w.type===_&&w.id===b);return{handle:{id:b,type:_,nodeId:N,x:M?.x||n.x,y:M?.y||n.y},validHandleResult:S}}}}let c=[],d=Number.POSITIVE_INFINITY;for(const N of i){const _=Math.sqrt((N.x-n.x)**2+(N.y-n.y)**2);if(_<=o){const b=r(N);_<=d&&(_<d?c=[{handle:N,validHandleResult:b}]:_===d&&c.push({handle:N,validHandleResult:b}),d=_)}}if(!c.length)return{handle:null,validHandleResult:Zi()};if(c.length===1)return c[0];const g=c.some(({validHandleResult:N})=>N.isValid),m=c.some(({handle:N})=>N.type==="target");return c.find(({handle:N,validHandleResult:_})=>m?N.type==="target":g?_.isValid:!0)||c[0]}function Ro(e,t,n,o,i,r,s,a,l,u,c){const d=r==="target",g=a.querySelector(`.vue-flow__handle[data-id="${t?.nodeId}-${t?.id}-${t?.type}"]`),{x:m,y:N}=Ge(e),_=a.elementFromPoint(m,N),b=_?.classList.contains("vue-flow__handle")?_:g,S=Zi();if(b){S.handleDomNode=b;const M=oo(void 0,b),w=b.getAttribute("data-nodeid"),x=b.getAttribute("data-handleid"),A=b.classList.contains("connectable"),Y=b.classList.contains("connectableend"),V={source:d?w:o,sourceHandle:d?x:i,target:d?o:w,targetHandle:d?i:x};S.connection=V,A&&Y&&(n===st.Strict?d&&M==="source"||!d&&M==="target":w!==o||x!==i)&&(S.isValid=s(V,{edges:l,nodes:u,sourceNode:c(V.source),targetNode:c(V.target)}),S.endHandle={nodeId:w,handleId:x,type:M,position:S.isValid?b.getAttribute("data-handlepos"):null})}return S}function Pu({nodes:e,nodeId:t,handleId:n,handleType:o}){const i=[];for(let r=0;r<e.length;r++){const s=e[r],{handleBounds:a}=s;let l=[],u=[];a&&(l=Bo(s,a,"source",`${t}-${n}-${o}`),u=Bo(s,a,"target",`${t}-${n}-${o}`)),i.push(...l,...u)}return i}function oo(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function Au(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}const Ou=["production","prod"];function fn(e,...t){Wi()&&console.warn(`[Vue Flow]: ${e}`,...t)}function Wi(){return!Ou.includes("production")}function Vo(e,t,n,o){const i=t.querySelectorAll(`.vue-flow__handle${e}`);return Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...cn(s)}})}function Gn(e,t,n,o,i,r=!1,s){i.value=!1,e.selected?(r||e.selected&&t)&&(o([e]),Ye(()=>{s.blur()})):n([e])}function be(e){return typeof J(e)<"u"}function zu(e,t,n,o){if(!e||!e.source||!e.target)return n(new Ee(xe.EDGE_INVALID,e?.id??"[ID UNKNOWN]")),!1;let i;return Qe(e)?i=e:i={...e,id:Bi(e)},i=Oi(i,void 0,o),bu(i,t)?!1:i}function Bu(e,t,n,o,i,r){if(!t.source||!t.target)return r(new Ee(xe.EDGE_INVALID,e.id)),!1;const s=o(e.id);if(!s)return r(new Ee(xe.EDGE_NOT_FOUND,e.id)),!1;const{id:a,...l}=e,u={...l,id:i?Bi(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle};return n.splice(n.indexOf(s),1,u),u}function Ho(e,t,n){const o={},i=[];for(let r=0;r<e.length;++r){const s=e[r];if(!ot(s)){n(new Ee(xe.NODE_INVALID,s?.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const a=yu(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 Ee(xe.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 Lo(e,t){e.clear();for(const n of t){const{id:o,source:i,target:r,sourceHandle:s=null,targetHandle:a=null}=n,l=`${i}-source-${s}`,u=`${r}-target-${a}`,c=e.get(l)||new Map,d=e.get(u)||new Map,g=ut({edgeId:o,source:i,target:r,sourceHandle:s,targetHandle:a});e.set(l,c.set(`${r}-${a}`,g)),e.set(u,d.set(`${i}-${s}`,g))}}function Fo(e,t,n,o,i,r,s,a){const l=[];for(const u of e){const c=Qe(u)?u:zu(u,a,i,r);if(!c)continue;const d=n(c.source),g=n(c.target);if(!d||!g){i(new Ee(xe.EDGE_SOURCE_TARGET_MISSING,c.id,c.source,c.target));continue}if(!d){i(new Ee(xe.EDGE_SOURCE_MISSING,c.id,c.source));continue}if(!g){i(new Ee(xe.EDGE_TARGET_MISSING,c.id,c.target));continue}if(t&&!t(c,{edges:a,nodes:s,sourceNode:d,targetNode:g})){i(new Ee(xe.EDGE_INVALID,c.id));continue}const m=o(c.id);l.push({...Oi(c,m,r),sourceNode:d,targetNode:g})}return l}const Yo=Symbol("vueFlow"),Ki=Symbol("nodeId"),qi=Symbol("nodeRef"),Ru=Symbol("edgeId"),Vu=Symbol("edgeRef"),hn=Symbol("slots");function Ji(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:g,findNode:m,multiSelectionActive:N,nodesSelectionActive:_,selectNodesOnDrag:b,removeSelectedElements:S,addSelectedNodes:M,updateNodePositions:w,emits:x}=_e(),{onStart:A,onDrag:Y,onStop:V,onClick:H,el:Z,disabled:T,id:O,selectable:E,dragHandle:j}=e,y=ve(!1);let I=[],C,$=null,D={x:void 0,y:void 0},P={x:0,y:0},z=null,F=!1,Q=0,L=!1;const B=Fu(),W=({x:X,y:q})=>{D={x:X,y:q};let ne=!1;if(I=I.map(v=>{const f={x:X-v.distance.x,y:q-v.distance.y},{computedPosition:h}=to(v,n.value?dn(f,o.value):f,x.error,s.value,v.parentNode?m(v.parentNode):void 0);return ne=ne||v.position.x!==h.x||v.position.y!==h.y,v.position=h,v}),!!ne&&(w(I,!0,!0),y.value=!0,z)){const[v,f]=Sn({id:O,dragItems:I,findNode:m});Y({event:z,node:v,nodes:f})}},le=()=>{if(!$)return;const[X,q]=Gi(P,$,c.value);if(X!==0||q!==0){const ne={x:(D.x??0)-X/l.value.zoom,y:(D.y??0)-q/l.value.zoom};g({x:X,y:q})&&W(ne)}Q=requestAnimationFrame(le)},re=(X,q)=>{F=!0;const ne=m(O);!b.value&&!N.value&&ne&&(ne.selected||S()),ne&&ce(E)&&b.value&&Gn(ne,N.value,M,S,_,!1,q);const v=B(X.sourceEvent);if(D=v,I=Nu(r.value,d.value,v,m,O),I.length){const[f,h]=Sn({id:O,dragItems:I,findNode:m});A({event:X.sourceEvent,node:f,nodes:h})}},ue=(X,q)=>{var ne;X.sourceEvent.type==="touchmove"&&X.sourceEvent.touches.length>1||(a.value===0&&re(X,q),D=B(X.sourceEvent),$=((ne=t.value)==null?void 0:ne.getBoundingClientRect())||null,P=Ge(X.sourceEvent,$))},te=(X,q)=>{const ne=B(X.sourceEvent);if(!L&&F&&u.value&&(L=!0,le()),!F){const v=ne.xSnapped-(D.x??0),f=ne.ySnapped-(D.y??0);Math.sqrt(v*v+f*f)>a.value&&re(X,q)}(D.x!==ne.xSnapped||D.y!==ne.ySnapped)&&I.length&&F&&(z=X.sourceEvent,P=Ge(X.sourceEvent,$),W(ne))},oe=X=>{if(!Ui(X)&&!F&&!y.value&&!N.value){const q=X,ne=B(q),v=ne.xSnapped-(D.x??0),f=ne.ySnapped-(D.y??0),h=Math.sqrt(v*v+f*f);h!==0&&h<=a.value&&H?.(q);return}if(y.value=!1,L=!1,F=!1,D={x:void 0,y:void 0},cancelAnimationFrame(Q),I.length){w(I,!1,!1);const[q,ne]=Sn({id:O,dragItems:I,findNode:m});V({event:X.sourceEvent,node:q,nodes:ne})}};return ge([()=>ce(T),Z],([X,q],ne,v)=>{if(q){const f=Me(q);X||(C=ba().on("start",h=>ue(h,q)).on("drag",h=>te(h,q)).on("end",h=>oe(h)).filter(h=>{const p=h.target,k=ce(j);return!h.button&&(!i.value||!Ao(p,`.${i.value}`,q)&&(!k||Ao(p,k,q)))}),f.call(C)),v(()=>{f.on(".drag",null),C&&(C.on("start",null),C.on("drag",null),C.on("end",null))})}}),y}function Hu(){return{doubleClick:R(),click:R(),mouseEnter:R(),mouseMove:R(),mouseLeave:R(),contextMenu:R(),updateStart:R(),update:R(),updateEnd:R()}}function Lu(e,t){const n=Hu();return n.doubleClick.on(o=>{var i,r;t.edgeDoubleClick(o),(r=(i=e.events)==null?void 0:i.doubleClick)==null||r.call(i,o)}),n.click.on(o=>{var i,r;t.edgeClick(o),(r=(i=e.events)==null?void 0:i.click)==null||r.call(i,o)}),n.mouseEnter.on(o=>{var i,r;t.edgeMouseEnter(o),(r=(i=e.events)==null?void 0:i.mouseEnter)==null||r.call(i,o)}),n.mouseMove.on(o=>{var i,r;t.edgeMouseMove(o),(r=(i=e.events)==null?void 0:i.mouseMove)==null||r.call(i,o)}),n.mouseLeave.on(o=>{var i,r;t.edgeMouseLeave(o),(r=(i=e.events)==null?void 0:i.mouseLeave)==null||r.call(i,o)}),n.contextMenu.on(o=>{var i,r;t.edgeContextMenu(o),(r=(i=e.events)==null?void 0:i.contextMenu)==null||r.call(i,o)}),n.updateStart.on(o=>{var i,r;t.edgeUpdateStart(o),(r=(i=e.events)==null?void 0:i.updateStart)==null||r.call(i,o)}),n.update.on(o=>{var i,r;t.edgeUpdate(o),(r=(i=e.events)==null?void 0:i.update)==null||r.call(i,o)}),n.updateEnd.on(o=>{var i,r;t.edgeUpdateEnd(o),(r=(i=e.events)==null?void 0:i.updateEnd)==null||r.call(i,o)}),Object.entries(n).reduce((o,[i,r])=>(o.emit[i]=r.trigger,o.on[i]=r.on,o),{emit:{},on:{}})}function Fu(){const{viewport:e,snapGrid:t,snapToGrid:n}=_e();return o=>{const i=Ui(o)?o.sourceEvent:o,{x:r,y:s}=Ge(i),a=Tt({x:r,y:s},e.value),{x:l,y:u}=n.value?dn(a,t.value):a;return{xSnapped:l,ySnapped:u,...a}}}function Ft(){return!0}function Qi({handleId:e,nodeId:t,type:n,isValidConnection:o,edgeUpdaterType:i,onEdgeUpdate:r,onEdgeUpdateEnd:s}){const{vueFlowRef:a,connectionMode:l,connectionRadius:u,connectOnClick:c,connectionClickStartHandle:d,nodesConnectable:g,autoPanOnConnect:m,autoPanSpeed:N,findNode:_,panBy:b,startConnection:S,updateConnection:M,endConnection:w,emits:x,viewport:A,edges:Y,nodes:V,isValidConnection:H}=_e();let Z=null,T=!1,O=null,E=null;function j(I){var C;const $=ce(n)==="target",D=no(I),P=Mo(I.target);if(D&&I.button===0||!D){let z=function(h){q=Ge(h,oe);const{handle:p,validHandleResult:k}=Du(h,P,Tt(q,A.value,!1,[1,1]),u.value,v,G=>Ro(h,G,l.value,ce(t),ce(e),$?"target":"source",L,P,Y.value,V.value,_));if(B=p,ne||(f(),ne=!0),Z=k.connection,T=k.isValid,O=k.handleDomNode,!(T&&B&&E?.endHandle&&k.endHandle&&E.endHandle.type===k.endHandle.type&&E.endHandle.nodeId===k.endHandle.nodeId&&E.endHandle.handleId===k.endHandle.handleId)){if(M(B&&T?Ri({x:B.x,y:B.y},A.value):q,k.endHandle,Au(!!B,T)),E=k,!B&&!T&&!O)return Nn(X);Z&&Z.source!==Z.target&&O&&(Nn(X),X=O,O.classList.add("connecting","vue-flow__handle-connecting"),O.classList.toggle("valid",T),O.classList.toggle("vue-flow__handle-valid",T))}},F=function(h){(B||O)&&Z&&T&&(r?r(h,Z):x.connect(Z)),x.connectEnd(h),i&&s?.(h),Nn(X),cancelAnimationFrame(W),w(h),ne=!1,T=!1,Z=null,O=null,P.removeEventListener("mousemove",z),P.removeEventListener("mouseup",F),P.removeEventListener("touchmove",z),P.removeEventListener("touchend",F)};const Q=_(ce(t));let L=ce(o)||H.value||Ft;!L&&Q&&(L=($?Q.isValidSourcePos:Q.isValidTargetPos)||Ft);let B,W=0;const{x:le,y:re}=Ge(I),ue=P?.elementFromPoint(le,re),te=oo(ce(i),ue),oe=(C=a.value)==null?void 0:C.getBoundingClientRect();if(!oe||!te)return;let X,q=Ge(I,oe),ne=!1;const v=Pu({nodes:V.value,nodeId:ce(t),handleId:ce(e),handleType:te}),f=()=>{if(!m.value)return;const[h,p]=Gi(q,oe,N.value);b({x:h,y:p}),W=requestAnimationFrame(f)};S({nodeId:ce(t),handleId:ce(e),type:te,position:ue?.getAttribute("data-handlepos")||K.Top},{x:le-oe.left,y:re-oe.top}),x.connectStart({event:I,nodeId:ce(t),handleId:ce(e),handleType:te}),P.addEventListener("mousemove",z),P.addEventListener("mouseup",F),P.addEventListener("touchmove",z),P.addEventListener("touchend",F)}}function y(I){if(!c.value)return;const C=ce(n)==="target";if(!d.value)x.clickConnectStart({event:I,nodeId:ce(t),handleId:ce(e)}),S({nodeId:ce(t),type:ce(n),handleId:ce(e)},void 0,!0);else{let $=ce(o)||H.value||Ft;const D=_(ce(t));if(!$&&D&&($=(C?D.isValidSourcePos:D.isValidTargetPos)||Ft),D&&(typeof D.connectable>"u"?g.value:D.connectable)===!1)return;const P=Mo(I.target),{connection:z,isValid:F}=Ro(I,{nodeId:ce(t),id:ce(e),type:ce(n)},l.value,d.value.nodeId,d.value.handleId||null,d.value.type,$,P,Y.value,V.value,_),Q=z.source===z.target;F&&!Q&&x.connect(z),x.clickConnectEnd(I),w(I,!0)}}return{handlePointerDown:j,handleClick:y}}function Yu(){return mt(Ki,"")}function ji(e){const t=e??Yu()??"",n=mt(qi,ve(null)),{findNode:o,edges:i,emits:r}=_e(),s=o(t);return s||r.error(new Ee(xe.NODE_NOT_FOUND,t)),{id:t,nodeEl:n,node:s,parentNode:ie(()=>o(s.parentNode)),connectedEdges:ie(()=>Fi([s],i.value))}}function Gu(){return{doubleClick:R(),click:R(),mouseEnter:R(),mouseMove:R(),mouseLeave:R(),contextMenu:R(),dragStart:R(),drag:R(),dragStop:R()}}function Xu(e,t){const n=Gu();return n.doubleClick.on(o=>{var i,r;t.nodeDoubleClick(o),(r=(i=e.events)==null?void 0:i.doubleClick)==null||r.call(i,o)}),n.click.on(o=>{var i,r;t.nodeClick(o),(r=(i=e.events)==null?void 0:i.click)==null||r.call(i,o)}),n.mouseEnter.on(o=>{var i,r;t.nodeMouseEnter(o),(r=(i=e.events)==null?void 0:i.mouseEnter)==null||r.call(i,o)}),n.mouseMove.on(o=>{var i,r;t.nodeMouseMove(o),(r=(i=e.events)==null?void 0:i.mouseMove)==null||r.call(i,o)}),n.mouseLeave.on(o=>{var i,r;t.nodeMouseLeave(o),(r=(i=e.events)==null?void 0:i.mouseLeave)==null||r.call(i,o)}),n.contextMenu.on(o=>{var i,r;t.nodeContextMenu(o),(r=(i=e.events)==null?void 0:i.contextMenu)==null||r.call(i,o)}),n.dragStart.on(o=>{var i,r;t.nodeDragStart(o),(r=(i=e.events)==null?void 0:i.dragStart)==null||r.call(i,o)}),n.drag.on(o=>{var i,r;t.nodeDrag(o),(r=(i=e.events)==null?void 0:i.drag)==null||r.call(i,o)}),n.dragStop.on(o=>{var i,r;t.nodeDragStop(o),(r=(i=e.events)==null?void 0:i.dragStop)==null||r.call(i,o)}),Object.entries(n).reduce((o,[i,r])=>(o.emit[i]=r.trigger,o.on[i]=r.on,o),{emit:{},on:{}})}function er(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:n,findNode:o,snapGrid:i,snapToGrid:r,nodesDraggable:s,emits:a}=_e();return(l,u=!1)=>{const c=r.value?i.value[0]:5,d=r.value?i.value[1]:5,g=u?4:1,m=l.x*c*g,N=l.y*d*g,_=[];for(const b of e.value)if(b.draggable||s&&typeof b.draggable>"u"){const S={x:b.computedPosition.x+m,y:b.computedPosition.y+N},{computedPosition:M}=to(b,S,a.error,t.value,b.parentNode?o(b.parentNode):void 0);_.push({id:b.id,position:M,from:b.position,distance:{x:l.x,y:l.y},dimensions:b.dimensions})}n(_,!0,!1)}}const Cn=.1;function Ze(){return fn("Viewport not initialized yet."),Promise.resolve(!1)}const Uu={zoomIn:Ze,zoomOut:Ze,zoomTo:Ze,fitView:Ze,setCenter:Ze,fitBounds:Ze,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Ze,setTransform:Ze,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function Zu(e){function t(o,i){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.scaleBy(Mn(e.d3Selection,i,()=>{r(!0)}),o):r(!1)})}function n(o,i,r,s){return new Promise(a=>{const{x:l,y:u}=Ai({x:-o,y:-i},e.translateExtent),c=pt.translate(-l,-u).scale(r);e.d3Selection&&e.d3Zoom?e.d3Zoom.transform(Mn(e.d3Selection,s,()=>{a(!0)}),c):a(!1)})}return ie(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:i=>t(1.2,i?.duration),zoomOut:i=>t(1/1.2,i?.duration),zoomTo:(i,r)=>new Promise(s=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.scaleTo(Mn(e.d3Selection,r?.duration,()=>{s(!0)}),i):s(!1)}),setViewport:(i,r)=>n(i.x,i.y,i.zoom,r?.duration),setTransform:(i,r)=>n(i.x,i.y,i.zoom,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:Cn,includeHiddenNodes:!1,duration:0})=>{var r,s;const a=[];for(const g of e.nodes)g.dimensions.width&&g.dimensions.height&&(i?.includeHiddenNodes||!g.hidden)&&(!((r=i.nodes)!=null&&r.length)||(s=i.nodes)!=null&&s.length&&i.nodes.includes(g.id))&&a.push(g);if(!a.length)return Promise.resolve(!1);const l=Hi(a),{x:u,y:c,zoom:d}=Io(l,e.dimensions.width,e.dimensions.height,i.minZoom??e.minZoom,i.maxZoom??e.maxZoom,i.padding??Cn,i.offset);return n(u,c,d,i?.duration)},setCenter:(i,r,s)=>{const a=typeof s?.zoom<"u"?s.zoom:e.maxZoom,l=e.dimensions.width/2-i*a,u=e.dimensions.height/2-r*a;return n(l,u,a,s?.duration)},fitBounds:(i,r={padding:Cn})=>{const{x:s,y:a,zoom:l}=Io(i,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding);return n(s,a,l,r?.duration)},project:i=>Tt(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 Tt(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 Ri(a,e.viewport)}return{x:0,y:0}}}:Uu)}function Mn(e,t=0,n){return e.transition().duration(t).on("end",n)}function Wu(e,t,n){const o=Jo(!0);return o.run(()=>{const i=()=>{o.run(()=>{let _,b,S=!!(n.nodes.value.length||n.edges.value.length);_=lt([e.modelValue,()=>{var M,w;return(w=(M=e.modelValue)==null?void 0:M.value)==null?void 0:w.length}],([M])=>{M&&Array.isArray(M)&&(b?.pause(),n.setElements(M),!b&&!S&&M.length?S=!0:b?.resume())}),b=lt([n.nodes,n.edges,()=>n.edges.value.length,()=>n.nodes.value.length],([M,w])=>{var x;(x=e.modelValue)!=null&&x.value&&Array.isArray(e.modelValue.value)&&(_?.pause(),e.modelValue.value=[...M,...w],Ye(()=>{_?.resume()}))},{immediate:S}),Gt(()=>{_?.stop(),b?.stop()})})},r=()=>{o.run(()=>{let _,b,S=!!n.nodes.value.length;_=lt([e.nodes,()=>{var M,w;return(w=(M=e.nodes)==null?void 0:M.value)==null?void 0:w.length}],([M])=>{M&&Array.isArray(M)&&(b?.pause(),n.setNodes(M),!b&&!S&&M.length?S=!0:b?.resume())}),b=lt([n.nodes,()=>n.nodes.value.length],([M])=>{var w;(w=e.nodes)!=null&&w.value&&Array.isArray(e.nodes.value)&&(_?.pause(),e.nodes.value=[...M],Ye(()=>{_?.resume()}))},{immediate:S}),Gt(()=>{_?.stop(),b?.stop()})})},s=()=>{o.run(()=>{let _,b,S=!!n.edges.value.length;_=lt([e.edges,()=>{var M,w;return(w=(M=e.edges)==null?void 0:M.value)==null?void 0:w.length}],([M])=>{M&&Array.isArray(M)&&(b?.pause(),n.setEdges(M),!b&&!S&&M.length?S=!0:b?.resume())}),b=lt([n.edges,()=>n.edges.value.length],([M])=>{var w;(w=e.edges)!=null&&w.value&&Array.isArray(e.edges.value)&&(_?.pause(),e.edges.value=[...M],Ye(()=>{_?.resume()}))},{immediate:S}),Gt(()=>{_?.stop(),b?.stop()})})},a=()=>{o.run(()=>{ge(()=>t.maxZoom,()=>{t.maxZoom&&be(t.maxZoom)&&n.setMaxZoom(t.maxZoom)},{immediate:!0})})},l=()=>{o.run(()=>{ge(()=>t.minZoom,()=>{t.minZoom&&be(t.minZoom)&&n.setMinZoom(t.minZoom)},{immediate:!0})})},u=()=>{o.run(()=>{ge(()=>t.translateExtent,()=>{t.translateExtent&&be(t.translateExtent)&&n.setTranslateExtent(t.translateExtent)},{immediate:!0})})},c=()=>{o.run(()=>{ge(()=>t.nodeExtent,()=>{t.nodeExtent&&be(t.nodeExtent)&&n.setNodeExtent(t.nodeExtent)},{immediate:!0})})},d=()=>{o.run(()=>{ge(()=>t.applyDefault,()=>{be(t.applyDefault)&&(n.applyDefault.value=t.applyDefault)},{immediate:!0})})},g=()=>{o.run(()=>{const _=async b=>{let S=b;typeof t.autoConnect=="function"&&(S=await t.autoConnect(b)),S!==!1&&n.addEdges([S])};ge(()=>t.autoConnect,()=>{be(t.autoConnect)&&(n.autoConnect.value=t.autoConnect)},{immediate:!0}),ge(n.autoConnect,(b,S,M)=>{b?n.onConnect(_):n.hooks.value.connect.off(_),M(()=>{n.hooks.value.connect.off(_)})},{immediate:!0})})},m=()=>{const _=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const b of Object.keys(t)){const S=b;if(!_.includes(S)){const M=ye(()=>t[S]),w=n[S];Zn(w)&&o.run(()=>{ge(M,x=>{be(x)&&(w.value=x)},{immediate:!0})})}}};(()=>{i(),r(),s(),l(),a(),u(),c(),d(),g(),m()})()}),()=>o.stop()}function Ku(){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=>fn(e.message))}}function qu(e,t){fr(()=>{for(const[n,o]of Object.entries(t.value)){const i=r=>{e(n,r)};o.fns.add(i),rn(()=>{o.off(i)})}})}function tr(){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:eo.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:St.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:je.Bezier,style:{}},connectionMode:st.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:nn()?"Meta":"Control",zoomActivationKeyCode:nn()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:Ku(),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 Ju=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function Qu(e,t,n){const o=Zu(e),i=v=>{const f=v??[];e.hooks.updateNodeInternals.trigger(f)},r=v=>_u(v,e.nodes,e.edges),s=v=>wu(v,e.nodes,e.edges),a=v=>Fi(v,e.edges),l=({id:v,type:f,nodeId:h})=>{var p;return Array.from(((p=e.connectionLookup.get(`${h}-${f}-${v??null}`))==null?void 0:p.values())??[])},u=v=>{if(v)return t.value.get(v)},c=v=>{if(v)return n.value.get(v)},d=(v,f,h)=>{var p,k;const G=[];for(const U of v){const ee={id:U.id,type:"position",dragging:h,from:U.from};if(f&&(ee.position=U.position,U.parentNode)){const se=u(U.parentNode);ee.position={x:ee.position.x-(((p=se?.computedPosition)==null?void 0:p.x)??0),y:ee.position.y-(((k=se?.computedPosition)==null?void 0:k.y)??0)}}G.push(ee)}G?.length&&e.hooks.nodesChange.trigger(G)},g=v=>{if(!e.vueFlowRef)return;const f=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!f)return;const h=window.getComputedStyle(f),{m22:p}=new window.DOMMatrixReadOnly(h.transform),k=[];for(let G=0;G<v.length;++G){const U=v[G],ee=u(U.id);if(ee){const se=cn(U.nodeElement);if(!!(se.width&&se.height&&(ee.dimensions.width!==se.width||ee.dimensions.height!==se.height||U.forceUpdate))){const he=U.nodeElement.getBoundingClientRect();ee.dimensions=se,ee.handleBounds.source=Vo(".source",U.nodeElement,he,p),ee.handleBounds.target=Vo(".target",U.nodeElement,he,p),k.push({id:ee.id,type:"dimensions",dimensions:se})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&o.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),k.length&&e.hooks.nodesChange.trigger(k)},m=(v,f)=>{const h=new Set,p=new Set;for(const U of v)ot(U)?h.add(U.id):Qe(U)&&p.add(U.id);const k=qe(t.value,h,!0),G=qe(n.value,p);if(e.multiSelectionActive){for(const U of h)k.push(We(U,f));for(const U of p)G.push(We(U,f))}k.length&&e.hooks.nodesChange.trigger(k),G.length&&e.hooks.edgesChange.trigger(G)},N=v=>{if(e.multiSelectionActive){const f=v.map(h=>We(h.id,!0));e.hooks.nodesChange.trigger(f);return}e.hooks.nodesChange.trigger(qe(t.value,new Set(v.map(f=>f.id)),!0)),e.hooks.edgesChange.trigger(qe(n.value))},_=v=>{if(e.multiSelectionActive){const f=v.map(h=>We(h.id,!0));e.hooks.edgesChange.trigger(f);return}e.hooks.edgesChange.trigger(qe(n.value,new Set(v.map(f=>f.id)))),e.hooks.nodesChange.trigger(qe(t.value,new Set,!0))},b=v=>{m(v,!0)},S=v=>{const h=(v||e.nodes).map(p=>(p.selected=!1,We(p.id,!1)));e.hooks.nodesChange.trigger(h)},M=v=>{const h=(v||e.edges).map(p=>(p.selected=!1,We(p.id,!1)));e.hooks.edgesChange.trigger(h)},w=v=>{if(!v||!v.length)return m([],!1);const f=v.reduce((h,p)=>{const k=We(p.id,!1);return ot(p)?h.nodes.push(k):h.edges.push(k),h},{nodes:[],edges:[]});f.nodes.length&&e.hooks.nodesChange.trigger(f.nodes),f.edges.length&&e.hooks.edgesChange.trigger(f.edges)},x=v=>{var f;(f=e.d3Zoom)==null||f.scaleExtent([v,e.maxZoom]),e.minZoom=v},A=v=>{var f;(f=e.d3Zoom)==null||f.scaleExtent([e.minZoom,v]),e.maxZoom=v},Y=v=>{var f;(f=e.d3Zoom)==null||f.translateExtent(v),e.translateExtent=v},V=v=>{e.nodeExtent=v,i()},H=v=>{var f;(f=e.d3Zoom)==null||f.clickDistance(v)},Z=v=>{e.nodesDraggable=v,e.nodesConnectable=v,e.elementsSelectable=v},T=v=>{const f=v instanceof Function?v(e.nodes):v;!e.initialized&&!f.length||(e.nodes=Ho(f,u,e.hooks.error.trigger))},O=v=>{const f=v instanceof Function?v(e.edges):v;if(!e.initialized&&!f.length)return;const h=Fo(f,e.isValidConnection,u,c,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);Lo(e.connectionLookup,h),e.edges=h},E=v=>{const f=v instanceof Function?v([...e.nodes,...e.edges]):v;!e.initialized&&!f.length||(T(f.filter(ot)),O(f.filter(Qe)))},j=v=>{let f=v instanceof Function?v(e.nodes):v;f=Array.isArray(f)?f:[f];const h=Ho(f,u,e.hooks.error.trigger),p=[];for(const k of h)p.push(To(k));p.length&&e.hooks.nodesChange.trigger(p)},y=v=>{let f=v instanceof Function?v(e.edges):v;f=Array.isArray(f)?f:[f];const h=Fo(f,e.isValidConnection,u,c,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),p=[];for(const k of h)p.push(To(k));p.length&&e.hooks.edgesChange.trigger(p)},I=(v,f=!0,h=!1)=>{const p=v instanceof Function?v(e.nodes):v,k=Array.isArray(p)?p:[p],G=[],U=[];function ee(de){const he=a(de);for(const me of he)(!be(me.deletable)||me.deletable)&&U.push(Po(me.id,me.source,me.target,me.sourceHandle,me.targetHandle))}function se(de){const he=[];for(const me of e.nodes)me.parentNode===de&&he.push(me);if(he.length){for(const me of he)G.push(Do(me.id));f&&ee(he);for(const me of he)se(me.id)}}for(const de of k){const he=typeof de=="string"?u(de):de;he&&(be(he.deletable)&&!he.deletable||(G.push(Do(he.id)),f&&ee([he]),h&&se(he.id)))}U.length&&e.hooks.edgesChange.trigger(U),G.length&&e.hooks.nodesChange.trigger(G)},C=v=>{const f=v instanceof Function?v(e.edges):v,h=Array.isArray(f)?f:[f],p=[];for(const k of h){const G=typeof k=="string"?c(k):k;G&&(be(G.deletable)&&!G.deletable||p.push(Po(typeof k=="string"?k:k.id,G.source,G.target,G.sourceHandle,G.targetHandle)))}e.hooks.edgesChange.trigger(p)},$=(v,f,h=!0)=>Bu(v,f,e.edges,c,h,e.hooks.error.trigger),D=(v,f,h={replace:!1})=>{const p=c(v);if(!p)return;const k=typeof f=="function"?f(p):f;p.data=h.replace?k:{...p.data,...k}},P=v=>$o(v,e.nodes),z=v=>{const f=$o(v,e.edges);return Lo(e.connectionLookup,f),f},F=(v,f,h={replace:!1})=>{const p=u(v);if(!p)return;const k=typeof f=="function"?f(p):f;h.replace?e.nodes.splice(e.nodes.indexOf(p),1,k):Object.assign(p,k)},Q=(v,f,h={replace:!1})=>{const p=u(v);if(!p)return;const k=typeof f=="function"?f(p):f;p.data=h.replace?k:{...p.data,...k}},L=(v,f,h=!1)=>{h?e.connectionClickStartHandle=v:e.connectionStartHandle=v,e.connectionEndHandle=null,e.connectionStatus=null,f&&(e.connectionPosition=f)},B=(v,f=null,h=null)=>{e.connectionStartHandle&&(e.connectionPosition=v,e.connectionEndHandle=f,e.connectionStatus=h)},W=(v,f)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,f?e.connectionClickStartHandle=null:e.connectionStartHandle=null},le=v=>{const f=mu(v),h=f?null:Et(v)?v:u(v.id);return!f&&!h?[null,null,f]:[f?v:Fn(h),h,f]},re=(v,f=!0,h=e.nodes)=>{const[p,k,G]=le(v);if(!p)return[];const U=[];for(const ee of h||e.nodes){if(!G&&(ee.id===k.id||!ee.computedPosition))continue;const se=Fn(ee),de=Yn(se,p);(f&&de>0||de>=Number(p.width)*Number(p.height))&&U.push(ee)}return U},ue=(v,f,h=!0)=>{const[p]=le(v);if(!p)return!1;const k=Yn(p,f);return h&&k>0||k>=Number(p.width)*Number(p.height)},te=v=>{const{viewport:f,dimensions:h,d3Zoom:p,d3Selection:k,translateExtent:G}=e;if(!p||!k||!v.x&&!v.y)return!1;const U=pt.translate(f.x+v.x,f.y+v.y).scale(f.zoom),ee=[[0,0],[h.width,h.height]],se=p.constrain()(U,ee,G),de=e.viewport.x!==se.x||e.viewport.y!==se.y||e.viewport.zoom!==se.k;return p.transform(k,se),de},oe=v=>{const f=v instanceof Function?v(e):v,h=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];be(f.defaultEdgeOptions)&&(e.defaultEdgeOptions=f.defaultEdgeOptions);const p=f.modelValue||f.nodes||f.edges?[]:void 0;p&&(f.modelValue&&p.push(...f.modelValue),f.nodes&&p.push(...f.nodes),f.edges&&p.push(...f.edges),E(p));const k=()=>{be(f.maxZoom)&&A(f.maxZoom),be(f.minZoom)&&x(f.minZoom),be(f.translateExtent)&&Y(f.translateExtent)};for(const G of Object.keys(f)){const U=G,ee=f[U];![...Ju,...h].includes(U)&&be(ee)&&(e[U]=ee)}Tn(()=>e.d3Zoom).not.toBeNull().then(k),e.initialized||(e.initialized=!0)};return{updateNodePositions:d,updateNodeDimensions:g,setElements:E,setNodes:T,setEdges:O,addNodes:j,addEdges:y,removeNodes:I,removeEdges:C,findNode:u,findEdge:c,updateEdge:$,updateEdgeData:D,updateNode:F,updateNodeData:Q,applyEdgeChanges:z,applyNodeChanges:P,addSelectedElements:b,addSelectedNodes:N,addSelectedEdges:_,setMinZoom:x,setMaxZoom:A,setTranslateExtent:Y,setNodeExtent:V,setPaneClickDistance:H,removeSelectedElements:w,removeSelectedNodes:S,removeSelectedEdges:M,startConnection:L,updateConnection:B,endConnection:W,setInteractive:Z,setState:oe,getIntersectingNodes:re,getIncomers:r,getOutgoers:s,getConnectedEdges:a,getHandleConnections:l,isNodeIntersecting:ue,panBy:te,fitView:v=>o.value.fitView(v),zoomIn:v=>o.value.zoomIn(v),zoomOut:v=>o.value.zoomOut(v),zoomTo:(v,f)=>o.value.zoomTo(v,f),setViewport:(v,f)=>o.value.setViewport(v,f),setTransform:(v,f)=>o.value.setTransform(v,f),getViewport:()=>o.value.getViewport(),getTransform:()=>o.value.getTransform(),setCenter:(v,f,h)=>o.value.setCenter(v,f,h),fitBounds:(v,f)=>o.value.fitBounds(v,f),project:v=>o.value.project(v),screenToFlowCoordinate:v=>o.value.screenToFlowCoordinate(v),flowToScreenCoordinate:v=>o.value.flowToScreenCoordinate(v),toObject:()=>{const v=[],f=[];for(const h of e.nodes){const{computedPosition:p,handleBounds:k,selected:G,dimensions:U,isParent:ee,resizing:se,dragging:de,events:he,...me}=h;v.push(me)}for(const h of e.edges){const{selected:p,sourceNode:k,targetNode:G,events:U,...ee}=h;f.push(ee)}return JSON.parse(JSON.stringify({nodes:v,edges:f,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:v=>new Promise(f=>{const{nodes:h,edges:p,position:k,zoom:G,viewport:U}=v;if(h&&T(h),p&&O(p),U?.x&&U?.y||k){const ee=U?.x||k[0],se=U?.y||k[1],de=U?.zoom||G||e.viewport.zoom;return Tn(()=>o.value.viewportInitialized).toBe(!0).then(()=>{o.value.setViewport({x:ee,y:se,zoom:de}).then(()=>{f(!0)})})}else f(!0)}),updateNodeInternals:i,viewportHelper:o,$reset:()=>{const v=tr();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const f=pt.translate(v.defaultViewport.x??0,v.defaultViewport.y??0).scale(at(v.defaultViewport.zoom??1,v.minZoom,v.maxZoom)),h=e.viewportRef.getBoundingClientRect(),p=[[0,0],[h.width,h.height]],k=e.d3Zoom.constrain()(f,p,v.translateExtent);e.d3Zoom.transform(e.d3Selection,k)}oe(v)},$destroy:()=>{}}}const ju=["data-id","data-handleid","data-nodeid","data-handlepos"],ec={name:"Handle",compatConfig:{MODE:3}},on=we({...ec,props:{id:{default:null},type:{},position:{default:()=>K.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=Ko(e,["position","connectable","connectableStart","connectableEnd","id"]),o=ye(()=>n.type??"source"),i=ye(()=>n.isValidConnection??null),{connectionStartHandle:r,connectionClickStartHandle:s,connectionEndHandle:a,vueFlowRef:l,nodesConnectable:u,noDragClassName:c,noPanClassName:d}=_e(),{id:g,node:m,nodeEl:N,connectedEdges:_}=ji(),b=ve(),S=ye(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),M=ye(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),w=ye(()=>{var T,O,E,j,y,I;return((T=r.value)==null?void 0:T.nodeId)===g&&((O=r.value)==null?void 0:O.handleId)===e.id&&((E=r.value)==null?void 0:E.type)===o.value||((j=a.value)==null?void 0:j.nodeId)===g&&((y=a.value)==null?void 0:y.handleId)===e.id&&((I=a.value)==null?void 0:I.type)===o.value}),x=ye(()=>{var T,O,E;return((T=s.value)==null?void 0:T.nodeId)===g&&((O=s.value)==null?void 0:O.handleId)===e.id&&((E=s.value)==null?void 0:E.type)===o.value}),{handlePointerDown:A,handleClick:Y}=Qi({nodeId:g,handleId:e.id,isValidConnection:i,type:o}),V=ie(()=>typeof e.connectable=="string"&&e.connectable==="single"?!_.value.some(T=>{const O=T[`${o.value}Handle`];return T[o.value]!==g?!1:O?O===e.id:!0}):typeof e.connectable=="number"?_.value.filter(T=>{const O=T[`${o.value}Handle`];return T[o.value]!==g?!1:O?O===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(m,_.value):be(e.connectable)?e.connectable:u.value);Ue(()=>{var T;if(!m.dimensions.width||!m.dimensions.height)return;const O=(T=m.handleBounds[o.value])==null?void 0:T.find(D=>D.id===e.id);if(!l.value||O)return;const E=l.value.querySelector(".vue-flow__transformationpane");if(!N.value||!b.value||!E||!e.id)return;const j=N.value.getBoundingClientRect(),y=b.value.getBoundingClientRect(),I=window.getComputedStyle(E),{m22:C}=new window.DOMMatrixReadOnly(I.transform),$={id:e.id,position:e.position,x:(y.left-j.left)/C,y:(y.top-j.top)/C,...cn(b.value)};m.handleBounds[o.value]=[...m.handleBounds[o.value]??[],$]}),qo(()=>{const T=m.handleBounds[o.value];T&&(m.handleBounds[o.value]=T.filter(O=>O.id!==e.id))});function H(T){const O=no(T);V.value&&S.value&&(O&&T.button===0||!O)&&A(T)}function Z(T){!g||!s.value&&!S.value||V.value&&Y(T)}return t({handleClick:Y,handlePointerDown:A,onClick:Z,onPointerDown:H}),(T,O)=>(ae(),pe("div",{ref_key:"handle",ref:b,"data-id":`${J(g)}-${e.id}-${o.value}`,"data-handleid":e.id,"data-nodeid":J(g),"data-handlepos":T.position,class:it(["vue-flow__handle",[`vue-flow__handle-${T.position}`,`vue-flow__handle-${e.id}`,J(c),J(d),o.value,{connectable:V.value,connecting:x.value,connectablestart:S.value,connectableend:M.value,connectionindicator:V.value&&(S.value&&!w.value||M.value&&w.value)}]]),onMousedown:H,onTouchstartPassive:H,onClick:Z},[ke(T.$slots,"default",{id:T.id})],42,ju))}}),gn=function({sourcePosition:e=K.Bottom,targetPosition:t=K.Top,label:n,connectable:o=!0,isValidTargetPos:i,isValidSourcePos:r,data:s}){const a=s.label||n;return[fe(on,{type:"target",position:t,connectable:o,isValidConnection:i}),typeof a!="string"&&a?fe(a):fe(ze,[a]),fe(on,{type:"source",position:e,connectable:o,isValidConnection:r})]};gn.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"];gn.inheritAttrs=!1;gn.compatConfig={MODE:3};const tc=gn,vn=function({targetPosition:e=K.Top,label:t,connectable:n=!0,isValidTargetPos:o,data:i}){const r=i.label||t;return[fe(on,{type:"target",position:e,connectable:n,isValidConnection:o}),typeof r!="string"&&r?fe(r):fe(ze,[r])]};vn.props=["targetPosition","label","isValidTargetPos","connectable","data"];vn.inheritAttrs=!1;vn.compatConfig={MODE:3};const nc=vn,pn=function({sourcePosition:e=K.Bottom,label:t,connectable:n=!0,isValidSourcePos:o,data:i}){const r=i.label||t;return[typeof r!="string"&&r?fe(r):fe(ze,[r]),fe(on,{type:"source",position:e,connectable:n,isValidConnection:o})]};pn.props=["sourcePosition","label","isValidSourcePos","connectable","data"];pn.inheritAttrs=!1;pn.compatConfig={MODE:3};const oc=pn,ic=["transform"],rc=["width","height","x","y","rx","ry"],sc=["y"],ac={name:"EdgeText",compatConfig:{MODE:3}},lc=we({...ac,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const t=ve({x:0,y:0,width:0,height:0}),n=ve(null),o=ie(()=>`translate(${e.x-t.value.width/2} ${e.y-t.value.height/2})`);Ue(i),ge([()=>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)=>(ae(),pe("g",{transform:o.value,class:"vue-flow__edge-textwrapper"},[r.labelShowBg?(ae(),pe("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:$e(r.labelBgStyle),rx:r.labelBgBorderRadius,ry:r.labelBgBorderRadius},null,12,rc)):Ce("",!0),Ae("text",br(r.$attrs,{ref_key:"el",ref:n,class:"vue-flow__edge-text",y:t.value.height/2,dy:"0.3em",style:r.labelStyle}),[ke(r.$slots,"default",{},()=>[typeof r.label!="string"?(ae(),Je(wr(r.label),{key:0})):(ae(),pe(ze,{key:1},[_r(kn(r.label),1)],64))])],16,sc)],8,ic))}}),uc=["id","d","marker-end","marker-start"],cc=["d","stroke-width"],dc={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},mn=we({...dc,props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},style:{},labelStyle:{},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:t}){const n=Ko(e,["interactionWidth","labelShowBg"]),o=ve(null),i=ve(null),r=ve(null),s=yr();return t({pathEl:o,interactionEl:i,labelEl:r}),(a,l)=>(ae(),pe(ze,null,[Ae("path",{id:a.id,ref_key:"pathEl",ref:o,d:a.path,style:$e(n.style),class:it(["vue-flow__edge-path",J(s).class]),"marker-end":a.markerEnd,"marker-start":a.markerStart},null,14,uc),a.interactionWidth?(ae(),pe("path",{key:0,ref_key:"interactionEl",ref:i,fill:"none",d:a.path,"stroke-width":a.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,cc)):Ce("",!0),a.label&&a.labelX&&a.labelY?(ae(),Je(lc,{key:1,ref_key:"labelEl",ref:r,x:a.labelX,y:a.labelY,label:a.label,"label-show-bg":a.labelShowBg,"label-bg-style":a.labelBgStyle,"label-bg-padding":a.labelBgPadding,"label-bg-border-radius":a.labelBgBorderRadius,"label-style":a.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):Ce("",!0)],64))}});function nr({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 or({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 Yt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Go({pos:e,x1:t,y1:n,x2:o,y2:i,c:r}){let s,a;switch(e){case K.Left:s=t-Yt(t-o,r),a=n;break;case K.Right:s=t+Yt(o-t,r),a=n;break;case K.Top:s=t,a=n-Yt(n-i,r);break;case K.Bottom:s=t,a=n+Yt(i-n,r);break}return[s,a]}function ir(e){const{sourceX:t,sourceY:n,sourcePosition:o=K.Bottom,targetX:i,targetY:r,targetPosition:s=K.Top,curvature:a=.25}=e,[l,u]=Go({pos:o,x1:t,y1:n,x2:i,y2:r,c:a}),[c,d]=Go({pos:s,x1:i,y1:r,x2:t,y2:n,c:a}),[g,m,N,_]=or({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}`,g,m,N,_]}function Xo({pos:e,x1:t,y1:n,x2:o,y2:i}){let r,s;switch(e){case K.Left:case K.Right:r=.5*(t+o),s=n;break;case K.Top:case K.Bottom:r=t,s=.5*(n+i);break}return[r,s]}function rr(e){const{sourceX:t,sourceY:n,sourcePosition:o=K.Bottom,targetX:i,targetY:r,targetPosition:s=K.Top}=e,[a,l]=Xo({pos:o,x1:t,y1:n,x2:i,y2:r}),[u,c]=Xo({pos:s,x1:i,y1:r,x2:t,y2:n}),[d,g,m,N]=or({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,g,m,N]}const Uo={[K.Left]:{x:-1,y:0},[K.Right]:{x:1,y:0},[K.Top]:{x:0,y:-1},[K.Bottom]:{x:0,y:1}};function fc({source:e,sourcePosition:t=K.Bottom,target:n}){return t===K.Left||t===K.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 Zo(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function hc({source:e,sourcePosition:t=K.Bottom,target:n,targetPosition:o=K.Top,center:i,offset:r}){const s=Uo[t],a=Uo[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=fc({source:l,sourcePosition:t,target:u}),d=c.x!==0?"x":"y",g=c[d];let m,N,_;const b={x:0,y:0},S={x:0,y:0},[M,w,x,A]=nr({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[d]*a[d]===-1){N=i.x??M,_=i.y??w;const V=[{x:N,y:l.y},{x:N,y:u.y}],H=[{x:l.x,y:_},{x:u.x,y:_}];s[d]===g?m=d==="x"?V:H:m=d==="x"?H:V}else{const V=[{x:l.x,y:u.y}],H=[{x:u.x,y:l.y}];if(d==="x"?m=s.x===g?H:V:m=s.y===g?V:H,t===o){const j=Math.abs(e[d]-n[d]);if(j<=r){const y=Math.min(r-1,r-j);s[d]===g?b[d]=(l[d]>e[d]?-1:1)*y:S[d]=(u[d]>n[d]?-1:1)*y}}if(t!==o){const j=d==="x"?"y":"x",y=s[d]===a[j],I=l[j]>u[j],C=l[j]<u[j];(s[d]===1&&(!y&&I||y&&C)||s[d]!==1&&(!y&&C||y&&I))&&(m=d==="x"?V:H)}const Z={x:l.x+b.x,y:l.y+b.y},T={x:u.x+S.x,y:u.y+S.y},O=Math.max(Math.abs(Z.x-m[0].x),Math.abs(T.x-m[0].x)),E=Math.max(Math.abs(Z.y-m[0].y),Math.abs(T.y-m[0].y));O>=E?(N=(Z.x+T.x)/2,_=m[0].y):(N=m[0].x,_=(Z.y+T.y)/2)}return[[e,{x:l.x+b.x,y:l.y+b.y},...m,{x:u.x+S.x,y:u.y+S.y},n],N,_,x,A]}function gc(e,t,n,o){const i=Math.min(Zo(e,t)/2,Zo(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 Xn(e){const{sourceX:t,sourceY:n,sourcePosition:o=K.Bottom,targetX:i,targetY:r,targetPosition:s=K.Top,borderRadius:a=5,centerX:l,centerY:u,offset:c=20}=e,[d,g,m,N,_]=hc({source:{x:t,y:n},sourcePosition:o,target:{x:i,y:r},targetPosition:s,center:{x:l,y:u},offset:c});return[d.reduce((S,M,w)=>{let x;return w>0&&w<d.length-1?x=gc(d[w-1],M,d[w+1],a):x=`${w===0?"M":"L"}${M.x} ${M.y}`,S+=x,S},""),g,m,N,_]}function vc(e){const{sourceX:t,sourceY:n,targetX:o,targetY:i}=e,[r,s,a,l]=nr({sourceX:t,sourceY:n,targetX:o,targetY:i});return[`M ${t},${n}L ${o},${i}`,r,s,a,l]}const pc=we({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]=vc(e);return fe(mn,{path:n,labelX:o,labelY:i,...t,...e})}}}),mc=pc,yc=we({name:"SmoothStepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","borderRadius","markerEnd","markerStart","interactionWidth","offset"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=Xn({...e,sourcePosition:e.sourcePosition??K.Bottom,targetPosition:e.targetPosition??K.Top});return fe(mn,{path:n,labelX:o,labelY:i,...t,...e})}}}),sr=yc,wc=we({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:t}){return()=>fe(sr,{...e,...t,borderRadius:0})}}),_c=wc,bc=we({name:"BezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=ir({...e,sourcePosition:e.sourcePosition??K.Bottom,targetPosition:e.targetPosition??K.Top});return fe(mn,{path:n,labelX:o,labelY:i,...t,...e})}}}),xc=bc,Ec=we({name:"SimpleBezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=rr({...e,sourcePosition:e.sourcePosition??K.Bottom,targetPosition:e.targetPosition??K.Top});return fe(mn,{path:n,labelX:o,labelY:i,...t,...e})}}}),Sc=Ec,Nc={input:oc,default:tc,output:nc},Cc={default:xc,straight:mc,step:_c,smoothstep:sr,simplebezier:Sc};function Mc(e,t,n){const o=ie(()=>_=>t.value.get(_)),i=ie(()=>_=>n.value.get(_)),r=ie(()=>{const _={...Cc,...e.edgeTypes},b=Object.keys(_);for(const S of e.edges)S.type&&!b.includes(S.type)&&(_[S.type]=S.type);return _}),s=ie(()=>{const _={...Nc,...e.nodeTypes},b=Object.keys(_);for(const S of e.nodes)S.type&&!b.includes(S.type)&&(_[S.type]=S.type);return _}),a=ie(()=>e.onlyRenderVisibleElements?Li(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),l=ie(()=>{if(e.onlyRenderVisibleElements){const _=[];for(const b of e.edges){const S=t.value.get(b.source),M=t.value.get(b.target);ku({sourcePos:S.computedPosition||{x:0,y:0},targetPos:M.computedPosition||{x:0,y:0},sourceWidth:S.dimensions.width,sourceHeight:S.dimensions.height,targetWidth:M.dimensions.width,targetHeight:M.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&_.push(b)}return _}return e.edges}),u=ie(()=>[...a.value,...l.value]),c=ie(()=>{const _=[];for(const b of e.nodes)b.selected&&_.push(b);return _}),d=ie(()=>{const _=[];for(const b of e.edges)b.selected&&_.push(b);return _}),g=ie(()=>[...c.value,...d.value]),m=ie(()=>{const _=[];for(const b of e.nodes)b.dimensions.width&&b.dimensions.height&&b.handleBounds!==void 0&&_.push(b);return _}),N=ie(()=>a.value.length>0&&m.value.length===a.value.length);return{getNode:o,getEdge:i,getElements:u,getEdgeTypes:r,getNodeTypes:s,getEdges:l,getNodes:a,getSelectedElements:g,getSelectedNodes:c,getSelectedEdges:d,getNodesInitialized:m,areNodesInitialized:N}}class et{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var t;const n=(t=Pt())==null?void 0:t.appContext.app,o=n?.config.globalProperties.$vueFlowStorage??et.instance;return et.instance=o??new et,n&&(n.config.globalProperties.$vueFlowStorage=et.instance),et.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=tr(),i=hr(o),r={};for(const[g,m]of Object.entries(i.hooks)){const N=`on${g.charAt(0).toUpperCase()+g.slice(1)}`;r[N]=m.on}const s={};for(const[g,m]of Object.entries(i.hooks))s[g]=m.trigger;const a=ie(()=>{const g=new Map;for(const m of i.nodes)g.set(m.id,m);return g}),l=ie(()=>{const g=new Map;for(const m of i.edges)g.set(m.id,m);return g}),u=Mc(i,a,l),c=Qu(i,a,l);c.setState({...i,...n});const d={...r,...u,...c,...$r(i),nodeLookup:a,edgeLookup:l,emits:s,id:t,vueFlowVersion:"1.41.5",$destroy:()=>{this.remove(t)}};return this.set(t,d),d}getId(){return`vue-flow-${this.currentId++}`}}function _e(e){const t=et.getInstance(),n=jo(),o=typeof e=="object",i=o?e:{id:e},r=i.id,s=r??n?.vueFlowId;let a;if(n){const l=mt(Yo,null);typeof l<"u"&&l!==null&&(!s||l.id===s)&&(a=l)}if(a||s&&(a=t.get(s)),!a||s&&a.id!==s){const l=r??t.getId(),u=t.create(l,i);a=u,(n??Jo(!0)).run(()=>{ge(u.applyDefault,(d,g,m)=>{const N=b=>{u.applyNodeChanges(b)},_=b=>{u.applyEdgeChanges(b)};d?(u.onNodesChange(N),u.onEdgesChange(_)):(u.hooks.value.nodesChange.off(N),u.hooks.value.edgesChange.off(_)),m(()=>{u.hooks.value.nodesChange.off(N),u.hooks.value.edgesChange.off(_)})},{immediate:!0}),rn(()=>{if(a){const d=t.get(a.id);d?d.$destroy():fn(`No store instance found for id ${a.id} in storage.`)}})})}else o&&a.setState(i);if(n&&(ht(Yo,a),n.vueFlowId=a.id),o){const l=Pt();l?.type.name!=="VueFlow"&&a.emits.error(new Ee(xe.USEVUEFLOW_OPTIONS))}return a}function Ic(e){const{emits:t,dimensions:n}=_e();let o;Ue(()=>{const i=e.value,r=()=>{if(!i)return;const s=cn(i);(s.width===0||s.height===0)&&t.error(new Ee(xe.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)),Qo(()=>{window.removeEventListener("resize",r),o&&i&&o.unobserve(i)})})}const kc={name:"UserSelection",compatConfig:{MODE:3}},$c=we({...kc,props:{userSelectionRect:{}},setup(e){return(t,n)=>(ae(),pe("div",{class:"vue-flow__selection vue-flow__container",style:$e({width:`${t.userSelectionRect.width}px`,height:`${t.userSelectionRect.height}px`,transform:`translate(${t.userSelectionRect.x}px, ${t.userSelectionRect.y}px)`})},null,4))}}),Tc=["tabIndex"],Dc={name:"NodesSelection",compatConfig:{MODE:3}},Pc=we({...Dc,setup(e){const{emits:t,viewport:n,getSelectedNodes:o,noPanClassName:i,disableKeyboardA11y:r,userSelectionActive:s}=_e(),a=er(),l=ve(null),u=Ji({el:l,onStart(N){t.selectionDragStart(N)},onDrag(N){t.selectionDrag(N)},onStop(N){t.selectionDragStop(N)}});Ue(()=>{var N;r.value||(N=l.value)==null||N.focus({preventScroll:!0})});const c=ie(()=>Hi(o.value)),d=ie(()=>({width:`${c.value.width}px`,height:`${c.value.height}px`,top:`${c.value.y}px`,left:`${c.value.x}px`}));function g(N){t.selectionContextMenu({event:N,nodes:o.value})}function m(N){r||ft[N.key]&&a({x:ft[N.key].x,y:ft[N.key].y},N.shiftKey)}return(N,_)=>!J(s)&&c.value.width&&c.value.height?(ae(),pe("div",{key:0,class:it(["vue-flow__nodesselection vue-flow__container",J(i)]),style:$e({transform:`translate(${J(n).x}px,${J(n).y}px) scale(${J(n).zoom})`})},[Ae("div",{ref_key:"el",ref:l,class:it([{dragging:J(u)},"vue-flow__nodesselection-rect"]),style:$e(d.value),tabIndex:J(r)?void 0:-1,onContextmenu:g,onKeydown:m},null,46,Tc)],6)):Ce("",!0)}});function Ac(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const Oc={name:"Pane",compatConfig:{MODE:3}},zc=we({...Oc,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:t,nodes:n,viewport:o,emits:i,userSelectionActive:r,removeSelectedElements:s,panOnDrag:a,userSelectionRect:l,elementsSelectable:u,nodesSelectionActive:c,getSelectedEdges:d,getSelectedNodes:g,removeNodes:m,removeEdges:N,selectionMode:_,deleteKeyCode:b,multiSelectionKeyCode:S,multiSelectionActive:M,edgeLookup:w,nodeLookup:x}=_e(),A=ve(null),Y=ve(0),V=ve(0),H=ve(),Z=ve(new Map),T=ye(()=>u.value&&(e.isSelecting||r.value));let O=!1,E=!1;const j=Nt(b,{actInsideInputWithModifier:!1}),y=Nt(S);ge(j,L=>{L&&(m(g.value),N(d.value),c.value=!1)}),ge(y,L=>{M.value=L});function I(L,B){return W=>{W.target===B&&L?.(W)}}function C(){r.value=!1,l.value=null,Y.value=0,V.value=0}function $(L){if(O){O=!1;return}i.paneClick(L),s(),c.value=!1}function D(L){var B;if(Array.isArray(a.value)&&((B=a.value)!=null&&B.includes(2))){L.preventDefault();return}i.paneContextMenu(L)}function P(L){i.paneScroll(L)}function z(L){var B,W,le,re,ue;if(H.value=(B=t.value)==null?void 0:B.getBoundingClientRect(),!u.value||!e.isSelecting||L.button!==0||L.target!==A.value||!H.value)return;(le=(W=L.target)==null?void 0:W.setPointerCapture)==null||le.call(W,L.pointerId);const{x:te,y:oe}=Ac(L,H.value);E=!0,O=!1,Z.value=new Map;for(const[X,q]of w.value)Z.value.set(q.source,((re=Z.value.get(q.source))==null?void 0:re.add(X))||new Set([X])),Z.value.set(q.target,((ue=Z.value.get(q.target))==null?void 0:ue.add(X))||new Set([X]));s(),l.value={width:0,height:0,startX:te,startY:oe,x:te,y:oe},i.selectionStart(L)}function F(L){if(!H.value||!l.value)return;O=!0;const{x:B,y:W}=Ge(L,H.value),{startX:le=0,startY:re=0}=l.value,ue={startX:le,startY:re,x:B<le?B:le,y:W<re?W:re,width:Math.abs(B-le),height:Math.abs(W-re)},te=Li(n.value,ue,o.value,_.value===eo.Partial,!0),oe=new Set,X=new Set;for(const q of te){X.add(q.id);const ne=Z.value.get(q.id);if(ne)for(const v of ne)oe.add(v)}if(Y.value!==X.size){Y.value=X.size;const q=qe(x.value,X,!0);i.nodesChange(q)}if(V.value!==oe.size){V.value=oe.size;const q=qe(w.value,oe);i.edgesChange(q)}l.value=ue,r.value=!0,c.value=!1}function Q(L){var B;L.button!==0||!E||((B=L.target)==null||B.releasePointerCapture(L.pointerId),!r.value&&l.value&&L.target===A.value&&$(L),Y.value>0&&(c.value=!0),C(),i.selectionEnd(L),e.selectionKeyPressed&&(O=!1),E=!1)}return(L,B)=>(ae(),pe("div",{ref_key:"container",ref:A,class:it(["vue-flow__pane vue-flow__container",{selection:L.isSelecting}]),onClick:B[0]||(B[0]=W=>T.value?void 0:I($,A.value)(W)),onContextmenu:B[1]||(B[1]=W=>I(D,A.value)(W)),onWheelPassive:B[2]||(B[2]=W=>I(P,A.value)(W)),onPointerenter:B[3]||(B[3]=W=>T.value?void 0:J(i).paneMouseEnter(W)),onPointerdown:B[4]||(B[4]=W=>T.value?z(W):J(i).paneMouseMove(W)),onPointermove:B[5]||(B[5]=W=>T.value?F(W):J(i).paneMouseMove(W)),onPointerup:B[6]||(B[6]=W=>T.value?Q(W):void 0),onPointerleave:B[7]||(B[7]=W=>J(i).paneMouseLeave(W))},[ke(L.$slots,"default"),J(r)&&J(l)?(ae(),Je($c,{key:0,"user-selection-rect":J(l)},null,8,["user-selection-rect"])):Ce("",!0),J(c)&&J(g).length?(ae(),Je(Pc,{key:1})):Ce("",!0)],34))}}),Bc={name:"Transform",compatConfig:{MODE:3}},Rc=we({...Bc,setup(e){const{viewport:t,fitViewOnInit:n,fitViewOnInitDone:o}=_e(),i=ie(()=>n.value?!o.value:!1),r=ie(()=>`translate(${t.value.x}px,${t.value.y}px) scale(${t.value.zoom})`);return(s,a)=>(ae(),pe("div",{class:"vue-flow__transformationpane vue-flow__container",style:$e({transform:r.value,opacity:i.value?0:void 0})},[ke(s.$slots,"default")],4))}}),Vc={name:"Viewport",compatConfig:{MODE:3}},Hc=we({...Vc,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:g,zoomOnPinch:m,zoomOnScroll:N,preventScrolling:_,noWheelClassName:b,noPanClassName:S,emits:M,connectionStartHandle:w,userSelectionActive:x,paneDragging:A,d3Zoom:Y,d3Selection:V,d3ZoomHandler:H,viewport:Z,viewportRef:T,paneClickDistance:O}=_e();Ic(T);const E=ve(!1),j=ve(!1);let y=null,I=!1,C=0,$={x:0,y:0,zoom:0};const D=Nt(a),P=Nt(s),z=Nt(r),F=ye(()=>(!P.value||P.value&&s.value===!0)&&(D.value||d.value)),Q=ye(()=>D.value||l.value),L=ye(()=>P.value||s.value===!0&&F.value!==!0);Ue(()=>{if(!T.value){fn("Viewport element is missing");return}const te=T.value,oe=te.getBoundingClientRect(),X=du().clickDistance(O.value).scaleExtent([t.value,n.value]).translateExtent(i.value),q=Me(te).call(X),ne=q.on("wheel.zoom"),v=pt.translate(o.value.x??0,o.value.y??0).scale(at(o.value.zoom??1,t.value,n.value)),f=[[0,0],[oe.width,oe.height]],h=X.constrain()(v,f,i.value);X.transform(q,h),X.wheelDelta(W),Y.value=X,V.value=q,H.value=ne,Z.value={x:h.x,y:h.y,zoom:h.k},X.on("start",p=>{var k;if(!p.sourceEvent)return null;C=p.sourceEvent.button,E.value=!0;const G=re(p.transform);((k=p.sourceEvent)==null?void 0:k.type)==="mousedown"&&(A.value=!0),$=G,M.viewportChangeStart(G),M.moveStart({event:p,flowTransform:G})}),X.on("end",p=>{if(!p.sourceEvent)return null;if(E.value=!1,A.value=!1,B(F.value,C??0)&&!I&&M.paneContextMenu(p.sourceEvent),I=!1,le($,p.transform)){const k=re(p.transform);$=k,M.viewportChangeEnd(k),M.moveEnd({event:p,flowTransform:k})}}),X.filter(p=>{var k,G,U;const ee=z.value||N.value,se=m.value&&p.ctrlKey,de=p.button;if((F.value===!0||Array.isArray(F.value)&&F.value.includes(1))&&de===1&&p.type==="mousedown"&&((k=p.target)!=null&&k.closest(".vue-flow__node")||(G=p.target)!=null&&G.closest(".vue-flow__edge")))return!0;if(!F.value&&!ee&&!Q.value&&!g.value&&!m.value||x.value||!g.value&&p.type==="dblclick"||ue(p,b.value)&&p.type==="wheel"||ue(p,S.value)&&(p.type!=="wheel"||Q.value&&p.type==="wheel"&&!z.value)||!m.value&&p.ctrlKey&&p.type==="wheel"||!ee&&!Q.value&&!se&&p.type==="wheel")return!1;if(!m&&p.type==="touchstart"&&((U=p.touches)==null?void 0:U.length)>1)return p.preventDefault(),!1;if(!F.value&&(p.type==="mousedown"||p.type==="touchstart")||s.value===!0&&Array.isArray(d.value)&&d.value.includes(0)&&de===0||Array.isArray(F.value)&&!F.value.includes(de)&&(p.type==="mousedown"||p.type==="touchstart"))return!1;const he=Array.isArray(F.value)&&F.value.includes(de)||s.value===!0&&Array.isArray(F.value)&&!F.value.includes(0)||!de||de<=1;return(!p.ctrlKey||p.type==="wheel")&&he}),ge([x,F],()=>{x.value&&!E.value?X.on("zoom",null):x.value||X.on("zoom",p=>{Z.value={x:p.transform.x,y:p.transform.y,zoom:p.transform.k};const k=re(p.transform);I=B(F.value,C??0),M.viewportChange(k),M.move({event:p,flowTransform:k})})},{immediate:!0}),ge([x,Q,u,z,m,_,b],()=>{Q.value&&!z.value&&!x.value?q.on("wheel.zoom",p=>{if(ue(p,b.value))return!1;const k=z.value||N.value,G=m.value&&p.ctrlKey;if(!(!_.value||Q.value||k||G))return!1;p.preventDefault(),p.stopImmediatePropagation();const ee=q.property("__zoom").k||1,se=nn();if(p.ctrlKey&&m.value&&se){const yt=Pe(p),ur=W(p),cr=ee*2**ur;X.scaleTo(q,cr,yt,p);return}const de=p.deltaMode===1?20:1;let he=u.value===St.Vertical?0:p.deltaX*de,me=u.value===St.Horizontal?0:p.deltaY*de;!se&&p.shiftKey&&u.value!==St.Vertical&&!he&&me&&(he=me,me=0),X.translateBy(q,-(he/ee)*c.value,-(me/ee)*c.value);const De=re(q.property("__zoom"));y&&clearTimeout(y),j.value?(M.move({event:p,flowTransform:De}),M.viewportChange(De),y=setTimeout(()=>{M.moveEnd({event:p,flowTransform:De}),M.viewportChangeEnd(De),j.value=!1},150)):(j.value=!0,M.moveStart({event:p,flowTransform:De}),M.viewportChangeStart(De))},{passive:!1}):typeof ne<"u"&&q.on("wheel.zoom",function(p,k){const G=!_.value&&p.type==="wheel"&&!p.ctrlKey,U=z.value||N.value,ee=m.value&&p.ctrlKey;if(!U&&!l.value&&!ee&&p.type==="wheel"||G||ue(p,b.value))return null;p.preventDefault(),ne.call(this,p,k)},{passive:!1})},{immediate:!0})});function B(te,oe){return oe===2&&Array.isArray(te)&&te.includes(2)}function W(te){const oe=te.ctrlKey&&nn()?10:1;return-te.deltaY*(te.deltaMode===1?.05:te.deltaMode?1:.002)*oe}function le(te,oe){return te.x!==oe.x&&!Number.isNaN(oe.x)||te.y!==oe.y&&!Number.isNaN(oe.y)||te.zoom!==oe.k&&!Number.isNaN(oe.k)}function re(te){return{x:te.x,y:te.y,zoom:te.k}}function ue(te,oe){return te.target.closest(`.${oe}`)}return(te,oe)=>(ae(),pe("div",{ref_key:"viewportRef",ref:T,class:"vue-flow__viewport vue-flow__container"},[He(zc,{"is-selecting":L.value,"selection-key-pressed":J(P),class:it({connecting:!!J(w),dragging:J(A),draggable:J(d)===!0||Array.isArray(J(d))&&J(d).includes(0)})},{default:In(()=>[He(Rc,null,{default:In(()=>[ke(te.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),Lc=["id"],Fc=["id"],Yc=["id"],Gc={name:"A11yDescriptions",compatConfig:{MODE:3}},Xc=we({...Gc,setup(e){const{id:t,disableKeyboardA11y:n,ariaLiveMessage:o}=_e();return(i,r)=>(ae(),pe(ze,null,[Ae("div",{id:`${J(Ti)}-${J(t)}`,style:{display:"none"}}," Press enter or space to select a node. "+kn(J(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,Lc),Ae("div",{id:`${J(Di)}-${J(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,Fc),J(n)?Ce("",!0):(ae(),pe("div",{key:0,id:`${J(pu)}-${J(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%)"}},kn(J(o)),9,Yc))],64))}});function Uc(){const e=_e();ge(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function Zc(e,t,n){return n===K.Left?e-t:n===K.Right?e+t:e}function Wc(e,t,n){return n===K.Top?e-t:n===K.Bottom?e+t:e}const io=function({radius:e=10,centerX:t=0,centerY:n=0,position:o=K.Top,type:i}){return fe("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${i}`,cx:Zc(t,e,o),cy:Wc(n,e,o),r:e,stroke:"transparent",fill:"transparent"})};io.props=["radius","centerX","centerY","position","type"];io.compatConfig={MODE:3};const Wo=io,Kc=we({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:g,multiSelectionActive:m,disableKeyboardA11y:N,elementsSelectable:_,edgesUpdatable:b,edgesFocusable:S,hooks:M}=_e(),w=ie(()=>c(e.id)),{emit:x,on:A}=Lu(w.value,r),Y=mt(hn),V=Pt(),H=ve(!1),Z=ve(!1),T=ve(""),O=ve(null),E=ve("source"),j=ve(null),y=ye(()=>typeof w.value.selectable>"u"?_.value:w.value.selectable),I=ye(()=>typeof w.value.updatable>"u"?b.value:w.value.updatable),C=ye(()=>typeof w.value.focusable>"u"?S.value:w.value.focusable);ht(Ru,e.id),ht(Vu,j);const $=ie(()=>w.value.class instanceof Function?w.value.class(w.value):w.value.class),D=ie(()=>w.value.style instanceof Function?w.value.style(w.value):w.value.style),P=ie(()=>{const f=w.value.type||"default",h=Y?.[`edge-${f}`];if(h)return h;let p=w.value.template??l.value[f];if(typeof p=="string"&&V){const k=Object.keys(V.appContext.components);k&&k.includes(f)&&(p=ei(f,!1))}return p&&typeof p!="string"?p:(r.error(new Ee(xe.EDGE_TYPE_MISSING,p)),!1)}),{handlePointerDown:z}=Qi({nodeId:T,handleId:O,type:E,isValidConnection:g,edgeUpdaterType:E,onEdgeUpdate:L,onEdgeUpdateEnd:B});return()=>{const f=d(w.value.source),h=d(w.value.target),p="pathOptions"in w.value?w.value.pathOptions:{};if(!f&&!h)return r.error(new Ee(xe.EDGE_SOURCE_TARGET_MISSING,w.value.id,w.value.source,w.value.target)),null;if(!f)return r.error(new Ee(xe.EDGE_SOURCE_MISSING,w.value.id,w.value.source)),null;if(!h)return r.error(new Ee(xe.EDGE_TARGET_MISSING,w.value.id,w.value.target)),null;if(!w.value||w.value.hidden||f.hidden||h.hidden)return null;let k;o.value===st.Strict?k=f.handleBounds.source:k=[...f.handleBounds.source||[],...f.handleBounds.target||[]];const G=Oo(k,w.value.sourceHandle);let U;o.value===st.Strict?U=h.handleBounds.target:U=[...h.handleBounds.target||[],...h.handleBounds.source||[]];const ee=Oo(U,w.value.targetHandle),se=G?.position||K.Bottom,de=ee?.position||K.Top,{x:he,y:me}=tn(f,G,se),{x:De,y:yt}=tn(h,ee,de);return w.value.sourceX=he,w.value.sourceY=me,w.value.targetX=De,w.value.targetY=yt,fe("g",{ref:j,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${P.value===!1?"default":w.value.type||"default"}`,a.value,$.value,{updating:H.value,selected:w.value.selected,animated:w.value.animated,inactive:!y.value&&!M.value.edgeClick.hasListeners()}],onClick:le,onContextmenu:re,onDblclick:ue,onMouseenter:te,onMousemove:oe,onMouseleave:X,onKeyDown:C.value?v:void 0,tabIndex:C.value?0:void 0,"aria-label":w.value.ariaLabel===null?void 0:w.value.ariaLabel||`Edge from ${w.value.source} to ${w.value.target}`,"aria-describedby":C.value?`${Di}-${t}`:void 0,role:C.value?"button":"img"},[Z.value?null:fe(P.value===!1?l.value.default:P.value,{id:e.id,sourceNode:f,targetNode:h,source:w.value.source,target:w.value.target,type:w.value.type,updatable:I.value,selected:w.value.selected,animated:w.value.animated,label:w.value.label,labelStyle:w.value.labelStyle,labelShowBg:w.value.labelShowBg,labelBgStyle:w.value.labelBgStyle,labelBgPadding:w.value.labelBgPadding,labelBgBorderRadius:w.value.labelBgBorderRadius,data:w.value.data,events:{...w.value.events,...A},style:D.value,markerStart:`url('#${Dt(w.value.markerStart,t)}')`,markerEnd:`url('#${Dt(w.value.markerEnd,t)}')`,sourcePosition:se,targetPosition:de,sourceX:he,sourceY:me,targetX:De,targetY:yt,sourceHandleId:w.value.sourceHandle,targetHandleId:w.value.targetHandle,interactionWidth:w.value.interactionWidth,...p}),[I.value==="source"||I.value===!0?[fe("g",{onMousedown:q,onMouseenter:F,onMouseout:Q},fe(Wo,{position:se,centerX:he,centerY:me,radius:i.value,type:"source","data-type":"source"}))]:null,I.value==="target"||I.value===!0?[fe("g",{onMousedown:ne,onMouseenter:F,onMouseout:Q},fe(Wo,{position:de,centerX:De,centerY:yt,radius:i.value,type:"target","data-type":"target"}))]:null]])};function F(){H.value=!0}function Q(){H.value=!1}function L(f,h){x.update({event:f,edge:w.value,connection:h})}function B(f){x.updateEnd({event:f,edge:w.value}),Z.value=!1}function W(f,h){f.button===0&&(Z.value=!0,T.value=h?w.value.target:w.value.source,O.value=(h?w.value.targetHandle:w.value.sourceHandle)??"",E.value=h?"target":"source",x.updateStart({event:f,edge:w.value}),z(f))}function le(f){var h;const p={event:f,edge:w.value};y.value&&(s.value=!1,w.value.selected&&m.value?(u([w.value]),(h=j.value)==null||h.blur()):n([w.value])),x.click(p)}function re(f){x.contextMenu({event:f,edge:w.value})}function ue(f){x.doubleClick({event:f,edge:w.value})}function te(f){x.mouseEnter({event:f,edge:w.value})}function oe(f){x.mouseMove({event:f,edge:w.value})}function X(f){x.mouseLeave({event:f,edge:w.value})}function q(f){W(f,!0)}function ne(f){W(f,!1)}function v(f){var h;!N.value&&Pi.includes(f.key)&&y.value&&(f.key==="Escape"?((h=j.value)==null||h.blur(),u([c(e.id)])):n([c(e.id)]))}}}),qc=Kc,Jc={[K.Left]:K.Right,[K.Right]:K.Left,[K.Top]:K.Bottom,[K.Bottom]:K.Top},Qc=we({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}=_e(),g=(e=mt(hn))==null?void 0:e["connection-line"],m=ie(()=>{var M;return d((M=o.value)==null?void 0:M.nodeId)}),N=ie(()=>{var M;return d((M=i.value)==null?void 0:M.nodeId)??null}),_=ie(()=>({x:(r.value.x-c.value.x)/c.value.zoom,y:(r.value.y-c.value.y)/c.value.zoom})),b=ie(()=>l.value.markerStart?`url(#${Dt(l.value.markerStart,t)})`:""),S=ie(()=>l.value.markerEnd?`url(#${Dt(l.value.markerEnd,t)})`:"");return()=>{var M,w,x,A;if(!m.value||!o.value)return null;const Y=o.value.handleId,V=o.value.type,H=m.value.handleBounds;let Z=H?.[V]||[];if(n.value===st.Loose){const P=H?.[V==="source"?"target":"source"]||[];Z=[...Z,...P]}if(!Z)return null;const T=(Y?Z.find(P=>P.id===Y):Z[0])??null,O=T?.position||K.Top,{x:E,y:j}=tn(m.value,T,O);let y=null;N.value&&((M=i.value)!=null&&M.handleId)&&(n.value===st.Strict?y=((w=N.value.handleBounds[V==="source"?"target":"source"])==null?void 0:w.find(P=>{var z;return P.id===((z=i.value)==null?void 0:z.handleId)}))||null:y=((x=[...N.value.handleBounds.source||[],...N.value.handleBounds.target||[]])==null?void 0:x.find(P=>{var z;return P.id===((z=i.value)==null?void 0:z.handleId)}))||null);const I=((A=i.value)==null?void 0:A.position)??(O?Jc[O]:null);if(!O||!I)return null;const C=s.value??l.value.type??je.Bezier;let $="";const D={sourceX:E,sourceY:j,sourcePosition:O,targetX:_.value.x,targetY:_.value.y,targetPosition:I};return C===je.Bezier?[$]=ir(D):C===je.Step?[$]=Xn({...D,borderRadius:0}):C===je.SmoothStep?[$]=Xn(D):C===je.SimpleBezier?[$]=rr(D):$=`M${E},${j} ${_.value.x},${_.value.y}`,fe("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},fe("g",{class:"vue-flow__connection"},g?fe(g,{sourceX:E,sourceY:j,sourcePosition:O,targetX:_.value.x,targetY:_.value.y,targetPosition:I,sourceNode:m.value,sourceHandle:T,targetNode:N.value,targetHandle:y,markerEnd:S.value,markerStart:b.value,connectionStatus:u.value}):fe("path",{d:$,class:[l.value.class,u,"vue-flow__connection-path"],style:{...a.value,...l.value.style},"marker-end":S.value,"marker-start":b.value})))}}}),jc=Qc,ed=["id","markerWidth","markerHeight","markerUnits","orient"],td={name:"MarkerType",compatConfig:{MODE:3}},nd=we({...td,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)=>(ae(),pe("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===J(Hn).ArrowClosed?(ae(),pe("polyline",{key:0,style:$e({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)):Ce("",!0),t.type===J(Hn).Arrow?(ae(),pe("polyline",{key:1,style:$e({stroke:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):Ce("",!0)],8,ed))}}),od={class:"vue-flow__marker vue-flow__container"},id={name:"MarkerDefinitions",compatConfig:{MODE:3}},rd=we({...id,setup(e){const{id:t,edges:n,connectionLineOptions:o,defaultMarkerColor:i}=_e(),r=ie(()=>{const s=new Set,a=[],l=u=>{if(u){const c=Dt(u,t);s.has(c)||(typeof u=="object"?a.push({...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)=>(ae(),pe("svg",od,[Ae("defs",null,[(ae(!0),pe(ze,null,Un(r.value,l=>(ae(),Je(nd,{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))])]))}}),sd={name:"Edges",compatConfig:{MODE:3}},ad=we({...sd,setup(e){const{findNode:t,getEdges:n,elevateEdgesOnSelect:o}=_e();return(i,r)=>(ae(),pe(ze,null,[He(rd),(ae(!0),pe(ze,null,Un(J(n),s=>(ae(),pe("svg",{key:s.id,class:"vue-flow__edges vue-flow__container",style:$e({zIndex:J($u)(s,J(t),J(o))})},[He(J(qc),{id:s.id},null,8,["id"])],4))),128)),He(J(jc))],64))}}),ld=we({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:g,elevateNodesOnSelect:m,disableKeyboardA11y:N,ariaLiveMessage:_,snapToGrid:b,snapGrid:S,nodeDragThreshold:M,nodesDraggable:w,elementsSelectable:x,nodesConnectable:A,nodesFocusable:Y,hooks:V}=_e(),H=ve(null);ht(qi,H),ht(Ki,e.id);const Z=mt(hn),T=Pt(),O=er(),{node:E,parentNode:j}=ji(e.id),{emit:y,on:I}=Xu(E,s),C=ye(()=>typeof E.draggable>"u"?w.value:E.draggable),$=ye(()=>typeof E.selectable>"u"?x.value:E.selectable),D=ye(()=>typeof E.connectable>"u"?A.value:E.connectable),P=ye(()=>typeof E.focusable>"u"?Y.value:E.focusable),z=ye(()=>$.value||C.value||V.value.nodeClick.hasListeners()||V.value.nodeDoubleClick.hasListeners()||V.value.nodeMouseEnter.hasListeners()||V.value.nodeMouseMove.hasListeners()||V.value.nodeMouseLeave.hasListeners()),F=ye(()=>!!E.dimensions.width&&!!E.dimensions.height),Q=ie(()=>{const h=E.type||"default",p=Z?.[`node-${h}`];if(p)return p;let k=E.template||d.value[h];if(typeof k=="string"&&T){const G=Object.keys(T.appContext.components);G&&G.includes(h)&&(k=ei(h,!1))}return k&&typeof k!="string"?k:(s.error(new Ee(xe.NODE_TYPE_MISSING,k)),!1)}),L=Ji({id:e.id,el:H,disabled:()=>!C.value,selectable:$,dragHandle:()=>E.dragHandle,onStart(h){y.dragStart(h)},onDrag(h){y.drag(h)},onStop(h){y.dragStop(h)},onClick(h){v(h)}}),B=ie(()=>E.class instanceof Function?E.class(E):E.class),W=ie(()=>{const h=(E.style instanceof Function?E.style(E):E.style)||{},p=E.width instanceof Function?E.width(E):E.width,k=E.height instanceof Function?E.height(E):E.height;return!h.width&&p&&(h.width=typeof p=="string"?p:`${p}px`),!h.height&&k&&(h.height=typeof k=="string"?k:`${k}px`),h}),le=ye(()=>Number(E.zIndex??W.value.zIndex??0));return c(h=>{(h.includes(e.id)||!h.length)&&ue()}),Ue(()=>{ge(()=>E.hidden,(h=!1,p,k)=>{!h&&H.value&&(e.resizeObserver.observe(H.value),k(()=>{H.value&&e.resizeObserver.unobserve(H.value)}))},{immediate:!0,flush:"post"})}),ge([()=>E.type,()=>E.sourcePosition,()=>E.targetPosition],()=>{Ye(()=>{u([{id:e.id,nodeElement:H.value,forceUpdate:!0}])})}),ge([()=>E.position.x,()=>E.position.y,()=>{var h;return(h=j.value)==null?void 0:h.computedPosition.x},()=>{var h;return(h=j.value)==null?void 0:h.computedPosition.y},()=>{var h;return(h=j.value)==null?void 0:h.computedPosition.z},le,()=>E.selected,()=>E.dimensions.height,()=>E.dimensions.width,()=>{var h;return(h=j.value)==null?void 0:h.dimensions.height},()=>{var h;return(h=j.value)==null?void 0:h.dimensions.width}],([h,p,k,G,U,ee])=>{const se={x:h,y:p,z:ee+(m.value&&E.selected?1e3:0)};typeof k<"u"&&typeof G<"u"?E.computedPosition=Su({x:k,y:G,z:U},se):E.computedPosition=se},{flush:"post",immediate:!0}),ge([()=>E.extent,g],([h,p],[k,G])=>{(h!==k||p!==G)&&re()}),E.extent==="parent"||typeof E.extent=="object"&&"range"in E.extent&&E.extent.range==="parent"?Tn(()=>F).toBe(!0).then(re):re(),()=>E.hidden?null:fe("div",{ref:H,"data-id":E.id,class:["vue-flow__node",`vue-flow__node-${Q.value===!1?"default":E.type||"default"}`,{[n.value]:C.value,dragging:L?.value,draggable:C.value,selected:E.selected,selectable:$.value,parent:E.isParent},B.value],style:{visibility:F.value?"visible":"hidden",zIndex:E.computedPosition.z??le.value,transform:`translate(${E.computedPosition.x}px,${E.computedPosition.y}px)`,pointerEvents:z.value?"all":"none",...W.value},tabIndex:P.value?0:void 0,role:P.value?"button":void 0,"aria-describedby":N.value?void 0:`${Ti}-${t}`,"aria-label":E.ariaLabel,onMouseenter:te,onMousemove:oe,onMouseleave:X,onContextmenu:q,onClick:v,onDblclick:ne,onKeydown:f},[fe(Q.value===!1?d.value.default:Q.value,{id:E.id,type:E.type,data:E.data,events:{...E.events,...I},selected:E.selected,resizing:E.resizing,dragging:L.value,connectable:D.value,position:E.computedPosition,dimensions:E.dimensions,isValidTargetPos:E.isValidTargetPos,isValidSourcePos:E.isValidSourcePos,parent:E.parentNode,parentNodeId:E.parentNode,zIndex:E.computedPosition.z??le.value,targetPosition:E.targetPosition,sourcePosition:E.sourcePosition,label:E.label,dragHandle:E.dragHandle,onUpdateNodeInternals:ue})]);function re(){const h=E.computedPosition,{computedPosition:p,position:k}=to(E,b.value?dn(h,S.value):h,s.error,g.value,j.value);(E.computedPosition.x!==p.x||E.computedPosition.y!==p.y)&&(E.computedPosition={...E.computedPosition,...p}),(E.position.x!==k.x||E.position.y!==k.y)&&(E.position=k)}function ue(){H.value&&u([{id:e.id,nodeElement:H.value,forceUpdate:!0}])}function te(h){L?.value||y.mouseEnter({event:h,node:E})}function oe(h){L?.value||y.mouseMove({event:h,node:E})}function X(h){L?.value||y.mouseLeave({event:h,node:E})}function q(h){return y.contextMenu({event:h,node:E})}function ne(h){return y.doubleClick({event:h,node:E})}function v(h){$.value&&(!o.value||!C.value||M.value>0)&&Gn(E,r.value,l,a,i,!1,H.value),y.click({event:h,node:E})}function f(h){if(!(Ln(h)||N.value))if(Pi.includes(h.key)&&$.value){const p=h.key==="Escape";Gn(E,r.value,l,a,i,p,H.value)}else C.value&&E.selected&&ft[h.key]&&(_.value=`Moved selected node ${h.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~E.position.x}, y: ${~~E.position.y}`,O({x:ft[h.key].x,y:ft[h.key].y},h.shiftKey))}}}),ud=ld;function cd(e={includeHiddenNodes:!1}){const{nodes:t}=_e();return ie(()=>{if(t.value.length===0)return!1;for(const n of t.value)if((e.includeHiddenNodes||!n.hidden)&&(n?.handleBounds===void 0||n.dimensions.width===0||n.dimensions.height===0))return!1;return!0})}const dd={class:"vue-flow__nodes vue-flow__container"},fd={name:"Nodes",compatConfig:{MODE:3}},hd=we({...fd,setup(e){const{getNodes:t,updateNodeDimensions:n,emits:o}=_e(),i=cd(),r=ve();return ge(i,s=>{s&&Ye(()=>{o.nodesInitialized(t.value)})},{immediate:!0}),Ue(()=>{r.value=new ResizeObserver(s=>{const a=s.map(l=>({id:l.target.getAttribute("data-id"),nodeElement:l.target,forceUpdate:!0}));Ye(()=>n(a))})}),Qo(()=>{var s;return(s=r.value)==null?void 0:s.disconnect()}),(s,a)=>(ae(),pe("div",dd,[r.value?(ae(!0),pe(ze,{key:0},Un(J(t),(l,u,c,d)=>{const g=[l.id];if(d&&d.key===l.id&&gr(d,g))return d;const m=(ae(),Je(J(ud),{id:l.id,key:l.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return m.memo=g,m},a,0),128)):Ce("",!0)]))}});function gd(){const{emits:e}=_e();Ue(()=>{if(Wi()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new Ee(xe.MISSING_STYLES))}})}const vd=Ae("div",{class:"vue-flow__edge-labels"},null,-1),pd={name:"VueFlow",compatConfig:{MODE:3}},Nd=we({...pd,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=dr(),r=yn(o,"modelValue",n),s=yn(o,"nodes",n),a=yn(o,"edges",n),l=_e(o),u=Wu({modelValue:r,nodes:s,edges:a},o,l);return qu(n,l.hooks),Uc(),gd(),ht(hn,i),qo(()=>{u()}),t(l),(c,d)=>(ae(),pe("div",{ref:J(l).vueFlowRef,class:"vue-flow"},[He(Hc,null,{default:In(()=>[He(ad),vd,He(hd),ke(c.$slots,"zoom-pane")]),_:3}),ke(c.$slots,"default"),He(Xc)],512))}}),md={name:"Panel",compatConfig:{MODE:3}},Cd=we({...md,props:{position:{}},setup(e){const t=e,{userSelectionActive:n}=_e(),o=ie(()=>`${t.position}`.split("-"));return(i,r)=>(ae(),pe("div",{class:it(["vue-flow__panel",o.value]),style:$e({pointerEvents:J(n)?"none":"all"})},[ke(i.$slots,"default")],6))}});var Fe=(e=>(e.Lines="lines",e.Dots="dots",e))(Fe||{});const ar=function({dimensions:e,size:t,color:n}){return fe("path",{stroke:n,"stroke-width":t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})},lr=function({radius:e,color:t}){return fe("circle",{cx:e,cy:e,r:e,fill:t})};Fe.Lines+"",Fe.Dots+"";const yd={[Fe.Dots]:"#81818a",[Fe.Lines]:"#eee"},wd=["id","x","y","width","height","patternTransform"],_d={key:2,height:"100",width:"100"},bd=["fill"],xd=["x","y","fill"],Ed={name:"Background",compatConfig:{MODE:3}},Md=we({...Ed,props:{id:{},variant:{default:()=>Fe.Dots},gap:{default:20},size:{default:1},lineWidth:{default:1},patternColor:{},color:{},bgColor:{},height:{default:100},width:{default:100},x:{default:0},y:{default:0},offset:{default:0}},setup(e){const{id:t,viewport:n}=_e(),o=ie(()=>{const s=n.value.zoom,[a,l]=Array.isArray(e.gap)?e.gap:[e.gap,e.gap],u=[a*s||1,l*s||1],c=e.size*s,[d,g]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],m=[d*s||1+u[0]/2,g*s||1+u[1]/2];return{scaledGap:u,offset:m,size:c}}),i=ye(()=>`pattern-${t}${e.id?`-${e.id}`:""}`),r=ye(()=>e.color||e.patternColor||yd[e.variant||Fe.Dots]);return(s,a)=>(ae(),pe("svg",{class:"vue-flow__background vue-flow__container",style:$e({height:`${s.height>100?100:s.height}%`,width:`${s.width>100?100:s.width}%`})},[ke(s.$slots,"pattern-container",{id:i.value},()=>[Ae("pattern",{id:i.value,x:J(n).x%o.value.scaledGap[0],y:J(n).y%o.value.scaledGap[1],width:o.value.scaledGap[0],height:o.value.scaledGap[1],patternTransform:`translate(-${o.value.offset[0]},-${o.value.offset[1]})`,patternUnits:"userSpaceOnUse"},[ke(s.$slots,"pattern",{},()=>[s.variant===J(Fe).Lines?(ae(),Je(J(ar),{key:0,size:s.lineWidth,color:r.value,dimensions:o.value.scaledGap},null,8,["size","color","dimensions"])):s.variant===J(Fe).Dots?(ae(),Je(J(lr),{key:1,color:r.value,radius:o.value.size/2},null,8,["color","radius"])):Ce("",!0),s.bgColor?(ae(),pe("svg",_d,[Ae("rect",{width:"100%",height:"100%",fill:s.bgColor},null,8,bd)])):Ce("",!0)])],8,wd)]),Ae("rect",{x:s.x,y:s.y,width:"100%",height:"100%",fill:`url(#${i.value})`},null,8,xd),ke(s.$slots,"default",{id:i.value})],4))}});export{fu as P,Cd as _,Md as a,Nd as b,K as c,on as d,_e as u};
  26. //# sourceMappingURL=vue-flow-background-c4c69975.js.map