@stonecrop/node-editor 0.4.29 → 0.4.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/node-editor.css +1 -1
- package/dist/node-editor.js +1348 -1349
- package/dist/node-editor.js.map +1 -1
- package/dist/node-editor.umd.cjs +3 -3
- package/dist/node-editor.umd.cjs.map +1 -1
- package/dist/src/tsdoc-metadata.json +1 -1
- package/package.json +6 -6
package/dist/node-editor.umd.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
(function(Ce,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],a):(Ce=typeof globalThis<"u"?globalThis:Ce||self,a(Ce["@stonecrop/node-editor"]={},Ce.Vue))})(this,function(Ce,a){"use strict";function mt(e){return a.getCurrentScope()?(a.onScopeDispose(e),!0):!1}function ke(e){return typeof e=="function"?e():a.unref(e)}const $i=typeof window<"u"&&typeof document<"u",Bi=e=>typeof e<"u",Di=Object.prototype.toString,Vi=e=>Di.call(e)==="[object Object]",Ai=()=>{};function Oi(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 Hn=e=>e();function zi(e=Hn){const t=a.ref(!0);function n(){t.value=!1}function o(){t.value=!0}const i=(...r)=>{t.value&&e(...r)};return{isActive:a.readonly(t),pause:n,resume:o,eventFilter:i}}function Ln(e,t=!1,n="Timeout"){return new Promise((o,i)=>{setTimeout(t?()=>i(n):o,e)})}function Ri(e,t,n={}){const{eventFilter:o=Hn,...i}=n;return a.watch(e,Oi(o,t),i)}function Ge(e,t,n={}){const{eventFilter:o,...i}=n,{eventFilter:r,pause:l,resume:s,isActive:u}=zi(o);return{stop:Ri(e,t,{...i,eventFilter:r}),pause:l,resume:s,isActive:u}}function Hi(e,t={}){if(!a.isRef(e))return a.toRefs(e);const n=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const o in e.value)n[o]=a.customRef(()=>({get(){return e.value[o]},set(i){var r;if((r=ke(t.replaceRef))!=null?r:!0)if(Array.isArray(e.value)){const s=[...e.value];s[o]=i,e.value=s}else{const s={...e.value,[o]:i};Object.setPrototypeOf(s,Object.getPrototypeOf(e.value)),e.value=s}else e.value[o]=i}}));return n}function Jt(e,t=!1){function n(f,{flush:g="sync",deep:h=!1,timeout:x,throwOnTimeout:b}={}){let N=null;const M=[new Promise(_=>{N=a.watch(e,C=>{f(C)!==t&&(N==null||N(),_(C))},{flush:g,deep:h,immediate:!0})})];return x!=null&&M.push(Ln(x,b).then(()=>ke(e)).finally(()=>N==null?void 0:N())),Promise.race(M)}function o(f,g){if(!a.isRef(f))return n(C=>C===f,g);const{flush:h="sync",deep:x=!1,timeout:b,throwOnTimeout:N}=g??{};let k=null;const _=[new Promise(C=>{k=a.watch([e,f],([O,G])=>{t!==(O===G)&&(k==null||k(),C(O))},{flush:h,deep:x,immediate:!0})})];return b!=null&&_.push(Ln(b,N).then(()=>ke(e)).finally(()=>(k==null||k(),ke(e)))),Promise.race(_)}function i(f){return n(g=>!!g,f)}function r(f){return o(null,f)}function l(f){return o(void 0,f)}function s(f){return n(Number.isNaN,f)}function u(f,g){return n(h=>{const x=Array.from(h);return x.includes(f)||x.includes(ke(f))},g)}function c(f){return d(1,f)}function d(f=1,g){let h=-1;return n(()=>(h+=1,h>=f),g)}return Array.isArray(ke(e))?{toMatch:n,toContains:u,changed:c,changedTimes:d,get not(){return Jt(e,!t)}}:{toMatch:n,toBe:o,toBeTruthy:i,toBeNull:r,toBeNaN:s,toBeUndefined:l,changed:c,changedTimes:d,get not(){return Jt(e,!t)}}}function Qt(e){return Jt(e)}function Li(e){var t;const n=ke(e);return(t=n==null?void 0:n.$el)!=null?t:n}const Fn=$i?window:void 0;function Yn(...e){let t,n,o,i;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,o,i]=e,t=Fn):[t,n,o,i]=e,!t)return Ai;Array.isArray(n)||(n=[n]),Array.isArray(o)||(o=[o]);const r=[],l=()=>{r.forEach(d=>d()),r.length=0},s=(d,f,g,h)=>(d.addEventListener(f,g,h),()=>d.removeEventListener(f,g,h)),u=a.watch(()=>[Li(t),ke(i)],([d,f])=>{if(l(),!d)return;const g=Vi(f)?{...f}:f;r.push(...n.flatMap(h=>o.map(x=>s(d,h,x,g))))},{immediate:!0,flush:"post"}),c=()=>{u(),l()};return mt(c),c}function Fi(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function Gn(...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=Fn,eventName:r="keydown",passive:l=!1,dedupe:s=!1}=o,u=Fi(t);return Yn(i,r,d=>{d.repeat&&ke(s)||u(d)&&n(d)},l)}function Yi(e){return JSON.parse(JSON.stringify(e))}function en(e,t,n,o={}){var i,r,l;const{clone:s=!1,passive:u=!1,eventName:c,deep:d=!1,defaultValue:f,shouldEmit:g}=o,h=a.getCurrentInstance(),x=n||(h==null?void 0:h.emit)||((i=h==null?void 0:h.$emit)==null?void 0:i.bind(h))||((l=(r=h==null?void 0:h.proxy)==null?void 0:r.$emit)==null?void 0:l.bind(h==null?void 0:h.proxy));let b=c;t||(t="modelValue"),b=b||`update:${t.toString()}`;const N=_=>s?typeof s=="function"?s(_):Yi(_):_,k=()=>Bi(e[t])?N(e[t]):f,M=_=>{g?g(_)&&x(b,_):x(b,_)};if(u){const _=k(),C=a.ref(_);let O=!1;return a.watch(()=>e[t],G=>{O||(O=!0,C.value=N(G),a.nextTick(()=>O=!1))}),a.watch(C,G=>{!O&&(G!==e[t]||d)&&M(G)},{deep:d}),C}else return a.computed({get(){return k()},set(_){M(_)}})}var Gi={value:()=>{}};function yt(){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 vt(n)}function vt(e){this._=e}function Xi(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}})}vt.prototype=yt.prototype={constructor:vt,on:function(e,t){var n=this._,o=Xi(e+"",n),i,r=-1,l=o.length;if(arguments.length<2){for(;++r<l;)if((i=(e=o[r]).type)&&(i=Ui(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++r<l;)if(i=(e=o[r]).type)n[i]=Xn(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Xn(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 vt(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 Ui(e,t){for(var n=0,o=e.length,i;n<o;++n)if((i=e[n]).name===t)return i.value}function Xn(e,t,n){for(var o=0,i=e.length;o<i;++o)if(e[o].name===t){e[o]=Gi,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var tn="http://www.w3.org/1999/xhtml";const Un={svg:"http://www.w3.org/2000/svg",xhtml:tn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function wt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Un.hasOwnProperty(t)?{space:Un[t],local:e}:e}function Zi(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===tn&&t.documentElement.namespaceURI===tn?t.createElement(e):t.createElementNS(n,e)}}function Wi(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Zn(e){var t=wt(e);return(t.local?Wi:Zi)(t)}function Ki(){}function nn(e){return e==null?Ki:function(){return this.querySelector(e)}}function qi(e){typeof e!="function"&&(e=nn(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r=t[i],l=r.length,s=o[i]=new Array(l),u,c,d=0;d<l;++d)(u=r[d])&&(c=e.call(u,u.__data__,d,r))&&("__data__"in u&&(c.__data__=u.__data__),s[d]=c);return new me(o,this._parents)}function ji(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Ji(){return[]}function Wn(e){return e==null?Ji:function(){return this.querySelectorAll(e)}}function Qi(e){return function(){return ji(e.apply(this,arguments))}}function er(e){typeof e=="function"?e=Qi(e):e=Wn(e);for(var t=this._groups,n=t.length,o=[],i=[],r=0;r<n;++r)for(var l=t[r],s=l.length,u,c=0;c<s;++c)(u=l[c])&&(o.push(e.call(u,u.__data__,c,l)),i.push(u));return new me(o,i)}function Kn(e){return function(){return this.matches(e)}}function qn(e){return function(t){return t.matches(e)}}var tr=Array.prototype.find;function nr(e){return function(){return tr.call(this.children,e)}}function or(){return this.firstElementChild}function ir(e){return this.select(e==null?or:nr(typeof e=="function"?e:qn(e)))}var rr=Array.prototype.filter;function lr(){return Array.from(this.children)}function ar(e){return function(){return rr.call(this.children,e)}}function sr(e){return this.selectAll(e==null?lr:ar(typeof e=="function"?e:qn(e)))}function ur(e){typeof e!="function"&&(e=Kn(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r=t[i],l=r.length,s=o[i]=[],u,c=0;c<l;++c)(u=r[c])&&e.call(u,u.__data__,c,r)&&s.push(u);return new me(o,this._parents)}function jn(e){return new Array(e.length)}function cr(){return new me(this._enter||this._groups.map(jn),this._parents)}function _t(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}_t.prototype={constructor:_t,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 dr(e){return function(){return e}}function fr(e,t,n,o,i,r){for(var l=0,s,u=t.length,c=r.length;l<c;++l)(s=t[l])?(s.__data__=r[l],o[l]=s):n[l]=new _t(e,r[l]);for(;l<u;++l)(s=t[l])&&(i[l]=s)}function hr(e,t,n,o,i,r,l){var s,u,c=new Map,d=t.length,f=r.length,g=new Array(d),h;for(s=0;s<d;++s)(u=t[s])&&(g[s]=h=l.call(u,u.__data__,s,t)+"",c.has(h)?i[s]=u:c.set(h,u));for(s=0;s<f;++s)h=l.call(e,r[s],s,r)+"",(u=c.get(h))?(o[s]=u,u.__data__=r[s],c.delete(h)):n[s]=new _t(e,r[s]);for(s=0;s<d;++s)(u=t[s])&&c.get(g[s])===u&&(i[s]=u)}function gr(e){return e.__data__}function pr(e,t){if(!arguments.length)return Array.from(this,gr);var n=t?hr:fr,o=this._parents,i=this._groups;typeof e!="function"&&(e=dr(e));for(var r=i.length,l=new Array(r),s=new Array(r),u=new Array(r),c=0;c<r;++c){var d=o[c],f=i[c],g=f.length,h=mr(e.call(d,d&&d.__data__,c,o)),x=h.length,b=s[c]=new Array(x),N=l[c]=new Array(x),k=u[c]=new Array(g);n(d,f,b,N,k,h,t);for(var M=0,_=0,C,O;M<x;++M)if(C=b[M]){for(M>=_&&(_=M+1);!(O=N[_])&&++_<x;);C._next=O||null}}return l=new me(l,o),l._enter=s,l._exit=u,l}function mr(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function yr(){return new me(this._exit||this._groups.map(jn),this._parents)}function vr(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 wr(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,i=n.length,r=o.length,l=Math.min(i,r),s=new Array(i),u=0;u<l;++u)for(var c=n[u],d=o[u],f=c.length,g=s[u]=new Array(f),h,x=0;x<f;++x)(h=c[x]||d[x])&&(g[x]=h);for(;u<i;++u)s[u]=n[u];return new me(s,this._parents)}function _r(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],i=o.length-1,r=o[i],l;--i>=0;)(l=o[i])&&(r&&l.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(l,r),r=l);return this}function Er(e){e||(e=br);function t(f,g){return f&&g?e(f.__data__,g.__data__):!f-!g}for(var n=this._groups,o=n.length,i=new Array(o),r=0;r<o;++r){for(var l=n[r],s=l.length,u=i[r]=new Array(s),c,d=0;d<s;++d)(c=l[d])&&(u[d]=c);u.sort(t)}return new me(i,this._parents).order()}function br(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function xr(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Sr(){return Array.from(this)}function Nr(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],i=0,r=o.length;i<r;++i){var l=o[i];if(l)return l}return null}function Cr(){let e=0;for(const t of this)++e;return e}function kr(){return!this.node()}function Mr(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var i=t[n],r=0,l=i.length,s;r<l;++r)(s=i[r])&&e.call(s,s.__data__,r,i);return this}function Ir(e){return function(){this.removeAttribute(e)}}function Tr(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Pr(e,t){return function(){this.setAttribute(e,t)}}function $r(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Br(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Dr(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 Vr(e,t){var n=wt(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?Tr:Ir:typeof t=="function"?n.local?Dr:Br:n.local?$r:Pr)(n,t))}function Jn(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Ar(e){return function(){this.style.removeProperty(e)}}function Or(e,t,n){return function(){this.style.setProperty(e,t,n)}}function zr(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Rr(e,t,n){return arguments.length>1?this.each((t==null?Ar:typeof t=="function"?zr:Or)(e,t,n??"")):Xe(this.node(),e)}function Xe(e,t){return e.style.getPropertyValue(t)||Jn(e).getComputedStyle(e,null).getPropertyValue(t)}function Hr(e){return function(){delete this[e]}}function Lr(e,t){return function(){this[e]=t}}function Fr(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Yr(e,t){return arguments.length>1?this.each((t==null?Hr:typeof t=="function"?Fr:Lr)(e,t)):this.node()[e]}function Qn(e){return e.trim().split(/^|\s+/)}function on(e){return e.classList||new eo(e)}function eo(e){this._node=e,this._names=Qn(e.getAttribute("class")||"")}eo.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 to(e,t){for(var n=on(e),o=-1,i=t.length;++o<i;)n.add(t[o])}function no(e,t){for(var n=on(e),o=-1,i=t.length;++o<i;)n.remove(t[o])}function Gr(e){return function(){to(this,e)}}function Xr(e){return function(){no(this,e)}}function Ur(e,t){return function(){(t.apply(this,arguments)?to:no)(this,e)}}function Zr(e,t){var n=Qn(e+"");if(arguments.length<2){for(var o=on(this.node()),i=-1,r=n.length;++i<r;)if(!o.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?Ur:t?Gr:Xr)(n,t))}function Wr(){this.textContent=""}function Kr(e){return function(){this.textContent=e}}function qr(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function jr(e){return arguments.length?this.each(e==null?Wr:(typeof e=="function"?qr:Kr)(e)):this.node().textContent}function Jr(){this.innerHTML=""}function Qr(e){return function(){this.innerHTML=e}}function el(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function tl(e){return arguments.length?this.each(e==null?Jr:(typeof e=="function"?el:Qr)(e)):this.node().innerHTML}function nl(){this.nextSibling&&this.parentNode.appendChild(this)}function ol(){return this.each(nl)}function il(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function rl(){return this.each(il)}function ll(e){var t=typeof e=="function"?e:Zn(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function al(){return null}function sl(e,t){var n=typeof e=="function"?e:Zn(e),o=t==null?al:typeof t=="function"?t:nn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function ul(){var e=this.parentNode;e&&e.removeChild(this)}function cl(){return this.each(ul)}function dl(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function fl(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function hl(e){return this.select(e?fl:dl)}function gl(e){return arguments.length?this.property("__data__",e):this.node().__data__}function pl(e){return function(t){e.call(this,t,this.__data__)}}function ml(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 yl(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 vl(e,t,n){return function(){var o=this.__on,i,r=pl(t);if(o){for(var l=0,s=o.length;l<s;++l)if((i=o[l]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=r,i.options=n),i.value=t;return}}this.addEventListener(e.type,r,n),i={type:e.type,name:e.name,value:t,listener:r,options:n},o?o.push(i):this.__on=[i]}}function wl(e,t,n){var o=ml(e+""),i,r=o.length,l;if(arguments.length<2){var s=this.node().__on;if(s){for(var u=0,c=s.length,d;u<c;++u)for(i=0,d=s[u];i<r;++i)if((l=o[i]).type===d.type&&l.name===d.name)return d.value}return}for(s=t?vl:yl,i=0;i<r;++i)this.each(s(o[i],t,n));return this}function oo(e,t,n){var o=Jn(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 _l(e,t){return function(){return oo(this,e,t)}}function El(e,t){return function(){return oo(this,e,t.apply(this,arguments))}}function bl(e,t){return this.each((typeof t=="function"?El:_l)(e,t))}function*xl(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],i=0,r=o.length,l;i<r;++i)(l=o[i])&&(yield l)}var io=[null];function me(e,t){this._groups=e,this._parents=t}function Qe(){return new me([[document.documentElement]],io)}function Sl(){return this}me.prototype=Qe.prototype={constructor:me,select:qi,selectAll:er,selectChild:ir,selectChildren:sr,filter:ur,data:pr,enter:cr,exit:yr,join:vr,merge:wr,selection:Sl,order:_r,sort:Er,call:xr,nodes:Sr,node:Nr,size:Cr,empty:kr,each:Mr,attr:Vr,style:Rr,property:Yr,classed:Zr,text:jr,html:tl,raise:ol,lower:rl,append:ll,insert:sl,remove:cl,clone:hl,datum:gl,on:wl,dispatch:bl,[Symbol.iterator]:xl};function ye(e){return typeof e=="string"?new me([[document.querySelector(e)]],[document.documentElement]):new me([[e]],io)}function Nl(e){let t;for(;t=e.sourceEvent;)e=t;return e}function _e(e,t){if(e=Nl(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 Cl={passive:!1},et={capture:!0,passive:!1};function rn(e){e.stopImmediatePropagation()}function Ue(e){e.preventDefault(),e.stopImmediatePropagation()}function ro(e){var t=e.document.documentElement,n=ye(e).on("dragstart.drag",Ue,et);"onselectstart"in t?n.on("selectstart.drag",Ue,et):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function lo(e,t){var n=e.document.documentElement,o=ye(e).on("dragstart.drag",null);t&&(o.on("click.drag",Ue,et),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 Et=e=>()=>e;function ln(e,{sourceEvent:t,subject:n,target:o,identifier:i,active:r,x:l,y:s,dx:u,dy:c,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:r,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:d}})}ln.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function kl(e){return!e.ctrlKey&&!e.button}function Ml(){return this.parentNode}function Il(e,t){return t??{x:e.x,y:e.y}}function Tl(){return navigator.maxTouchPoints||"ontouchstart"in this}function Pl(){var e=kl,t=Ml,n=Il,o=Tl,i={},r=yt("start","drag","end"),l=0,s,u,c,d,f=0;function g(C){C.on("mousedown.drag",h).filter(o).on("touchstart.drag",N).on("touchmove.drag",k,Cl).on("touchend.drag touchcancel.drag",M).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(C,O){if(!(d||!e.call(this,C,O))){var G=_(this,t.call(this,C,O),C,O,"mouse");G&&(ye(C.view).on("mousemove.drag",x,et).on("mouseup.drag",b,et),ro(C.view),rn(C),c=!1,s=C.clientX,u=C.clientY,G("start",C))}}function x(C){if(Ue(C),!c){var O=C.clientX-s,G=C.clientY-u;c=O*O+G*G>f}i.mouse("drag",C)}function b(C){ye(C.view).on("mousemove.drag mouseup.drag",null),lo(C.view,c),Ue(C),i.mouse("end",C)}function N(C,O){if(e.call(this,C,O)){var G=C.changedTouches,Y=t.call(this,C,O),I=G.length,B,A;for(B=0;B<I;++B)(A=_(this,Y,C,O,G[B].identifier,G[B]))&&(rn(C),A("start",C,G[B]))}}function k(C){var O=C.changedTouches,G=O.length,Y,I;for(Y=0;Y<G;++Y)(I=i[O[Y].identifier])&&(Ue(C),I("drag",C,O[Y]))}function M(C){var O=C.changedTouches,G=O.length,Y,I;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),Y=0;Y<G;++Y)(I=i[O[Y].identifier])&&(rn(C),I("end",C,O[Y]))}function _(C,O,G,Y,I,B){var A=r.copy(),D=_e(B||G,O),E,W,w;if((w=n.call(C,new ln("beforestart",{sourceEvent:G,target:g,identifier:I,active:l,x:D[0],y:D[1],dx:0,dy:0,dispatch:A}),Y))!=null)return E=w.x-D[0]||0,W=w.y-D[1]||0,function P(S,$,V){var H=D,z;switch(S){case"start":i[I]=P,z=l++;break;case"end":delete i[I],--l;case"drag":D=_e(V||$,O),z=l;break}A.call(S,C,new ln(S,{sourceEvent:$,subject:w,target:g,identifier:I,active:z,x:D[0]+E,y:D[1]+W,dx:D[0]-H[0],dy:D[1]-H[1],dispatch:A}),Y)}}return g.filter=function(C){return arguments.length?(e=typeof C=="function"?C:Et(!!C),g):e},g.container=function(C){return arguments.length?(t=typeof C=="function"?C:Et(C),g):t},g.subject=function(C){return arguments.length?(n=typeof C=="function"?C:Et(C),g):n},g.touchable=function(C){return arguments.length?(o=typeof C=="function"?C:Et(!!C),g):o},g.on=function(){var C=r.on.apply(r,arguments);return C===r?g:C},g.clickDistance=function(C){return arguments.length?(f=(C=+C)*C,g):Math.sqrt(f)},g}function an(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function ao(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function tt(){}var nt=.7,bt=1/nt,Ze="\\s*([+-]?\\d+)\\s*",ot="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ee="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",$l=/^#([0-9a-f]{3,8})$/,Bl=new RegExp(`^rgb\\(${Ze},${Ze},${Ze}\\)$`),Dl=new RegExp(`^rgb\\(${Ee},${Ee},${Ee}\\)$`),Vl=new RegExp(`^rgba\\(${Ze},${Ze},${Ze},${ot}\\)$`),Al=new RegExp(`^rgba\\(${Ee},${Ee},${Ee},${ot}\\)$`),Ol=new RegExp(`^hsl\\(${ot},${Ee},${Ee}\\)$`),zl=new RegExp(`^hsla\\(${ot},${Ee},${Ee},${ot}\\)$`),so={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};an(tt,Ae,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:uo,formatHex:uo,formatHex8:Rl,formatHsl:Hl,formatRgb:co,toString:co});function uo(){return this.rgb().formatHex()}function Rl(){return this.rgb().formatHex8()}function Hl(){return mo(this).formatHsl()}function co(){return this.rgb().formatRgb()}function Ae(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=$l.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?fo(t):n===3?new pe(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?xt(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?xt(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Bl.exec(e))?new pe(t[1],t[2],t[3],1):(t=Dl.exec(e))?new pe(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Vl.exec(e))?xt(t[1],t[2],t[3],t[4]):(t=Al.exec(e))?xt(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Ol.exec(e))?po(t[1],t[2]/100,t[3]/100,1):(t=zl.exec(e))?po(t[1],t[2]/100,t[3]/100,t[4]):so.hasOwnProperty(e)?fo(so[e]):e==="transparent"?new pe(NaN,NaN,NaN,0):null}function fo(e){return new pe(e>>16&255,e>>8&255,e&255,1)}function xt(e,t,n,o){return o<=0&&(e=t=n=NaN),new pe(e,t,n,o)}function Ll(e){return e instanceof tt||(e=Ae(e)),e?(e=e.rgb(),new pe(e.r,e.g,e.b,e.opacity)):new pe}function sn(e,t,n,o){return arguments.length===1?Ll(e):new pe(e,t,n,o??1)}function pe(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}an(pe,sn,ao(tt,{brighter(e){return e=e==null?bt:Math.pow(bt,e),new pe(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?nt:Math.pow(nt,e),new pe(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new pe(Oe(this.r),Oe(this.g),Oe(this.b),St(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:ho,formatHex:ho,formatHex8:Fl,formatRgb:go,toString:go}));function ho(){return`#${ze(this.r)}${ze(this.g)}${ze(this.b)}`}function Fl(){return`#${ze(this.r)}${ze(this.g)}${ze(this.b)}${ze((isNaN(this.opacity)?1:this.opacity)*255)}`}function go(){const e=St(this.opacity);return`${e===1?"rgb(":"rgba("}${Oe(this.r)}, ${Oe(this.g)}, ${Oe(this.b)}${e===1?")":`, ${e})`}`}function St(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Oe(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ze(e){return e=Oe(e),(e<16?"0":"")+e.toString(16)}function po(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ve(e,t,n,o)}function mo(e){if(e instanceof ve)return new ve(e.h,e.s,e.l,e.opacity);if(e instanceof tt||(e=Ae(e)),!e)return new ve;if(e instanceof ve)return e;e=e.rgb();var t=e.r/255,n=e.g/255,o=e.b/255,i=Math.min(t,n,o),r=Math.max(t,n,o),l=NaN,s=r-i,u=(r+i)/2;return s?(t===r?l=(n-o)/s+(n<o)*6:n===r?l=(o-t)/s+2:l=(t-n)/s+4,s/=u<.5?r+i:2-r-i,l*=60):s=u>0&&u<1?0:l,new ve(l,s,u,e.opacity)}function Yl(e,t,n,o){return arguments.length===1?mo(e):new ve(e,t,n,o??1)}function ve(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}an(ve,Yl,ao(tt,{brighter(e){return e=e==null?bt:Math.pow(bt,e),new ve(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?nt:Math.pow(nt,e),new ve(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,i=2*n-o;return new pe(un(e>=240?e-240:e+120,i,o),un(e,i,o),un(e<120?e+240:e-120,i,o),this.opacity)},clamp(){return new ve(yo(this.h),Nt(this.s),Nt(this.l),St(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=St(this.opacity);return`${e===1?"hsl(":"hsla("}${yo(this.h)}, ${Nt(this.s)*100}%, ${Nt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function yo(e){return e=(e||0)%360,e<0?e+360:e}function Nt(e){return Math.max(0,Math.min(1,e||0))}function un(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 cn=e=>()=>e;function Gl(e,t){return function(n){return e+n*t}}function Xl(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 Ul(e){return(e=+e)==1?vo:function(t,n){return n-t?Xl(t,n,e):cn(isNaN(t)?n:t)}}function vo(e,t){var n=t-e;return n?Gl(e,n):cn(isNaN(e)?t:e)}const Ct=function e(t){var n=Ul(t);function o(i,r){var l=n((i=sn(i)).r,(r=sn(r)).r),s=n(i.g,r.g),u=n(i.b,r.b),c=vo(i.opacity,r.opacity);return function(d){return i.r=l(d),i.g=s(d),i.b=u(d),i.opacity=c(d),i+""}}return o.gamma=e,o}(1);function Zl(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,o=t.slice(),i;return function(r){for(i=0;i<n;++i)o[i]=e[i]*(1-r)+t[i]*r;return o}}function Wl(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Kl(e,t){var n=t?t.length:0,o=e?Math.min(n,e.length):0,i=new Array(o),r=new Array(n),l;for(l=0;l<o;++l)i[l]=it(e[l],t[l]);for(;l<n;++l)r[l]=t[l];return function(s){for(l=0;l<o;++l)r[l]=i[l](s);return r}}function ql(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function be(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function jl(e,t){var n={},o={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?n[i]=it(e[i],t[i]):o[i]=t[i];return function(r){for(i in n)o[i]=n[i](r);return o}}var dn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,fn=new RegExp(dn.source,"g");function Jl(e){return function(){return e}}function Ql(e){return function(t){return e(t)+""}}function wo(e,t){var n=dn.lastIndex=fn.lastIndex=0,o,i,r,l=-1,s=[],u=[];for(e=e+"",t=t+"";(o=dn.exec(e))&&(i=fn.exec(t));)(r=i.index)>n&&(r=t.slice(n,r),s[l]?s[l]+=r:s[++l]=r),(o=o[0])===(i=i[0])?s[l]?s[l]+=i:s[++l]=i:(s[++l]=null,u.push({i:l,x:be(o,i)})),n=fn.lastIndex;return n<t.length&&(r=t.slice(n),s[l]?s[l]+=r:s[++l]=r),s.length<2?u[0]?Ql(u[0].x):Jl(t):(t=u.length,function(c){for(var d=0,f;d<t;++d)s[(f=u[d]).i]=f.x(c);return s.join("")})}function it(e,t){var n=typeof t,o;return t==null||n==="boolean"?cn(t):(n==="number"?be:n==="string"?(o=Ae(t))?(t=o,Ct):wo:t instanceof Ae?Ct:t instanceof Date?ql:Wl(t)?Zl:Array.isArray(t)?Kl:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?jl:be)(e,t)}var _o=180/Math.PI,hn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Eo(e,t,n,o,i,r){var l,s,u;return(l=Math.sqrt(e*e+t*t))&&(e/=l,t/=l),(u=e*n+t*o)&&(n-=e*u,o-=t*u),(s=Math.sqrt(n*n+o*o))&&(n/=s,o/=s,u/=s),e*o<t*n&&(e=-e,t=-t,u=-u,l=-l),{translateX:i,translateY:r,rotate:Math.atan2(t,e)*_o,skewX:Math.atan(u)*_o,scaleX:l,scaleY:s}}var kt;function ea(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?hn:Eo(t.a,t.b,t.c,t.d,t.e,t.f)}function ta(e){return e==null||(kt||(kt=document.createElementNS("http://www.w3.org/2000/svg","g")),kt.setAttribute("transform",e),!(e=kt.transform.baseVal.consolidate()))?hn:(e=e.matrix,Eo(e.a,e.b,e.c,e.d,e.e,e.f))}function bo(e,t,n,o){function i(c){return c.length?c.pop()+" ":""}function r(c,d,f,g,h,x){if(c!==f||d!==g){var b=h.push("translate(",null,t,null,n);x.push({i:b-4,x:be(c,f)},{i:b-2,x:be(d,g)})}else(f||g)&&h.push("translate("+f+t+g+n)}function l(c,d,f,g){c!==d?(c-d>180?d+=360:d-c>180&&(c+=360),g.push({i:f.push(i(f)+"rotate(",null,o)-2,x:be(c,d)})):d&&f.push(i(f)+"rotate("+d+o)}function s(c,d,f,g){c!==d?g.push({i:f.push(i(f)+"skewX(",null,o)-2,x:be(c,d)}):d&&f.push(i(f)+"skewX("+d+o)}function u(c,d,f,g,h,x){if(c!==f||d!==g){var b=h.push(i(h)+"scale(",null,",",null,")");x.push({i:b-4,x:be(c,f)},{i:b-2,x:be(d,g)})}else(f!==1||g!==1)&&h.push(i(h)+"scale("+f+","+g+")")}return function(c,d){var f=[],g=[];return c=e(c),d=e(d),r(c.translateX,c.translateY,d.translateX,d.translateY,f,g),l(c.rotate,d.rotate,f,g),s(c.skewX,d.skewX,f,g),u(c.scaleX,c.scaleY,d.scaleX,d.scaleY,f,g),c=d=null,function(h){for(var x=-1,b=g.length,N;++x<b;)f[(N=g[x]).i]=N.x(h);return f.join("")}}}var na=bo(ea,"px, ","px)","deg)"),oa=bo(ta,", ",")",")"),ia=1e-12;function xo(e){return((e=Math.exp(e))+1/e)/2}function ra(e){return((e=Math.exp(e))-1/e)/2}function la(e){return((e=Math.exp(2*e))-1)/(e+1)}const Mt=function e(t,n,o){function i(r,l){var s=r[0],u=r[1],c=r[2],d=l[0],f=l[1],g=l[2],h=d-s,x=f-u,b=h*h+x*x,N,k;if(b<ia)k=Math.log(g/c)/t,N=function(Y){return[s+Y*h,u+Y*x,c*Math.exp(t*Y*k)]};else{var M=Math.sqrt(b),_=(g*g-c*c+o*b)/(2*c*n*M),C=(g*g-c*c-o*b)/(2*g*n*M),O=Math.log(Math.sqrt(_*_+1)-_),G=Math.log(Math.sqrt(C*C+1)-C);k=(G-O)/t,N=function(Y){var I=Y*k,B=xo(O),A=c/(n*M)*(B*la(t*I+O)-ra(O));return[s+A*h,u+A*x,c*B/xo(t*I+O)]}}return N.duration=k*1e3*t/Math.SQRT2,N}return i.rho=function(r){var l=Math.max(.001,+r),s=l*l,u=s*s;return e(l,s,u)},i}(Math.SQRT2,2,4);var We=0,rt=0,lt=0,So=1e3,It,at,Tt=0,Re=0,Pt=0,st=typeof performance=="object"&&performance.now?performance:Date,No=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function gn(){return Re||(No(aa),Re=st.now()+Pt)}function aa(){Re=0}function $t(){this._call=this._time=this._next=null}$t.prototype=Co.prototype={constructor:$t,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?gn():+n)+(t==null?0:+t),!this._next&&at!==this&&(at?at._next=this:It=this,at=this),this._call=e,this._time=n,pn()},stop:function(){this._call&&(this._call=null,this._time=1/0,pn())}};function Co(e,t,n){var o=new $t;return o.restart(e,t,n),o}function sa(){gn(),++We;for(var e=It,t;e;)(t=Re-e._time)>=0&&e._call.call(void 0,t),e=e._next;--We}function ko(){Re=(Tt=st.now())+Pt,We=rt=0;try{sa()}finally{We=0,ca(),Re=0}}function ua(){var e=st.now(),t=e-Tt;t>So&&(Pt-=t,Tt=e)}function ca(){for(var e,t=It,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:It=n);at=e,pn(o)}function pn(e){if(!We){rt&&(rt=clearTimeout(rt));var t=e-Re;t>24?(e<1/0&&(rt=setTimeout(ko,e-st.now()-Pt)),lt&&(lt=clearInterval(lt))):(lt||(Tt=st.now(),lt=setInterval(ua,So)),We=1,No(ko))}}function Mo(e,t,n){var o=new $t;return t=t==null?0:+t,o.restart(i=>{o.stop(),e(i+t)},t,n),o}var da=yt("start","end","cancel","interrupt"),fa=[],Io=0,To=1,mn=2,Bt=3,Po=4,yn=5,Dt=6;function Vt(e,t,n,o,i,r){var l=e.__transition;if(!l)e.__transition={};else if(n in l)return;ha(e,n,{name:t,index:o,group:i,on:da,tween:fa,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Io})}function vn(e,t){var n=we(e,t);if(n.state>Io)throw new Error("too late; already scheduled");return n}function xe(e,t){var n=we(e,t);if(n.state>Bt)throw new Error("too late; already running");return n}function we(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function ha(e,t,n){var o=e.__transition,i;o[t]=n,n.timer=Co(r,0,n.time);function r(c){n.state=To,n.timer.restart(l,n.delay,n.time),n.delay<=c&&l(c-n.delay)}function l(c){var d,f,g,h;if(n.state!==To)return u();for(d in o)if(h=o[d],h.name===n.name){if(h.state===Bt)return Mo(l);h.state===Po?(h.state=Dt,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[d]):+d<t&&(h.state=Dt,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete o[d])}if(Mo(function(){n.state===Bt&&(n.state=Po,n.timer.restart(s,n.delay,n.time),s(c))}),n.state=mn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===mn){for(n.state=Bt,i=new Array(g=n.tween.length),d=0,f=-1;d<g;++d)(h=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(i[++f]=h);i.length=f+1}}function s(c){for(var d=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(u),n.state=yn,1),f=-1,g=i.length;++f<g;)i[f].call(e,d);n.state===yn&&(n.on.call("end",e,e.__data__,n.index,n.group),u())}function u(){n.state=Dt,n.timer.stop(),delete o[t];for(var c in o)return;delete e.__transition}}function At(e,t){var n=e.__transition,o,i,r=!0,l;if(n){t=t==null?null:t+"";for(l in n){if((o=n[l]).name!==t){r=!1;continue}i=o.state>mn&&o.state<yn,o.state=Dt,o.timer.stop(),o.on.call(i?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[l]}r&&delete e.__transition}}function ga(e){return this.each(function(){At(this,e)})}function pa(e,t){var n,o;return function(){var i=xe(this,e),r=i.tween;if(r!==n){o=n=r;for(var l=0,s=o.length;l<s;++l)if(o[l].name===t){o=o.slice(),o.splice(l,1);break}}i.tween=o}}function ma(e,t,n){var o,i;if(typeof n!="function")throw new Error;return function(){var r=xe(this,e),l=r.tween;if(l!==o){i=(o=l).slice();for(var s={name:t,value:n},u=0,c=i.length;u<c;++u)if(i[u].name===t){i[u]=s;break}u===c&&i.push(s)}r.tween=i}}function ya(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=we(this.node(),n).tween,i=0,r=o.length,l;i<r;++i)if((l=o[i]).name===e)return l.value;return null}return this.each((t==null?pa:ma)(n,e,t))}function wn(e,t,n){var o=e._id;return e.each(function(){var i=xe(this,o);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return we(i,o).value[t]}}function $o(e,t){var n;return(typeof t=="number"?be:t instanceof Ae?Ct:(n=Ae(t))?(t=n,Ct):wo)(e,t)}function va(e){return function(){this.removeAttribute(e)}}function wa(e){return function(){this.removeAttributeNS(e.space,e.local)}}function _a(e,t,n){var o,i=n+"",r;return function(){var l=this.getAttribute(e);return l===i?null:l===o?r:r=t(o=l,n)}}function Ea(e,t,n){var o,i=n+"",r;return function(){var l=this.getAttributeNS(e.space,e.local);return l===i?null:l===o?r:r=t(o=l,n)}}function ba(e,t,n){var o,i,r;return function(){var l,s=n(this),u;return s==null?void this.removeAttribute(e):(l=this.getAttribute(e),u=s+"",l===u?null:l===o&&u===i?r:(i=u,r=t(o=l,s)))}}function xa(e,t,n){var o,i,r;return function(){var l,s=n(this),u;return s==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),u=s+"",l===u?null:l===o&&u===i?r:(i=u,r=t(o=l,s)))}}function Sa(e,t){var n=wt(e),o=n==="transform"?oa:$o;return this.attrTween(e,typeof t=="function"?(n.local?xa:ba)(n,o,wn(this,"attr."+e,t)):t==null?(n.local?wa:va)(n):(n.local?Ea:_a)(n,o,t))}function Na(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Ca(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function ka(e,t){var n,o;function i(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&Ca(e,r)),n}return i._value=t,i}function Ma(e,t){var n,o;function i(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&Na(e,r)),n}return i._value=t,i}function Ia(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=wt(e);return this.tween(n,(o.local?ka:Ma)(o,t))}function Ta(e,t){return function(){vn(this,e).delay=+t.apply(this,arguments)}}function Pa(e,t){return t=+t,function(){vn(this,e).delay=t}}function $a(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Ta:Pa)(t,e)):we(this.node(),t).delay}function Ba(e,t){return function(){xe(this,e).duration=+t.apply(this,arguments)}}function Da(e,t){return t=+t,function(){xe(this,e).duration=t}}function Va(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Ba:Da)(t,e)):we(this.node(),t).duration}function Aa(e,t){if(typeof t!="function")throw new Error;return function(){xe(this,e).ease=t}}function Oa(e){var t=this._id;return arguments.length?this.each(Aa(t,e)):we(this.node(),t).ease}function za(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;xe(this,e).ease=n}}function Ra(e){if(typeof e!="function")throw new Error;return this.each(za(this._id,e))}function Ha(e){typeof e!="function"&&(e=Kn(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r=t[i],l=r.length,s=o[i]=[],u,c=0;c<l;++c)(u=r[c])&&e.call(u,u.__data__,c,r)&&s.push(u);return new Me(o,this._parents,this._name,this._id)}function La(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,i=n.length,r=Math.min(o,i),l=new Array(o),s=0;s<r;++s)for(var u=t[s],c=n[s],d=u.length,f=l[s]=new Array(d),g,h=0;h<d;++h)(g=u[h]||c[h])&&(f[h]=g);for(;s<o;++s)l[s]=t[s];return new Me(l,this._parents,this._name,this._id)}function Fa(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 Ya(e,t,n){var o,i,r=Fa(t)?vn:xe;return function(){var l=r(this,e),s=l.on;s!==o&&(i=(o=s).copy()).on(t,n),l.on=i}}function Ga(e,t){var n=this._id;return arguments.length<2?we(this.node(),n).on.on(e):this.each(Ya(n,e,t))}function Xa(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Ua(){return this.on("end.remove",Xa(this._id))}function Za(e){var t=this._name,n=this._id;typeof e!="function"&&(e=nn(e));for(var o=this._groups,i=o.length,r=new Array(i),l=0;l<i;++l)for(var s=o[l],u=s.length,c=r[l]=new Array(u),d,f,g=0;g<u;++g)(d=s[g])&&(f=e.call(d,d.__data__,g,s))&&("__data__"in d&&(f.__data__=d.__data__),c[g]=f,Vt(c[g],t,n,g,c,we(d,n)));return new Me(r,this._parents,t,n)}function Wa(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Wn(e));for(var o=this._groups,i=o.length,r=[],l=[],s=0;s<i;++s)for(var u=o[s],c=u.length,d,f=0;f<c;++f)if(d=u[f]){for(var g=e.call(d,d.__data__,f,u),h,x=we(d,n),b=0,N=g.length;b<N;++b)(h=g[b])&&Vt(h,t,n,b,g,x);r.push(g),l.push(d)}return new Me(r,l,t,n)}var Ka=Qe.prototype.constructor;function qa(){return new Ka(this._groups,this._parents)}function ja(e,t){var n,o,i;return function(){var r=Xe(this,e),l=(this.style.removeProperty(e),Xe(this,e));return r===l?null:r===n&&l===o?i:i=t(n=r,o=l)}}function Bo(e){return function(){this.style.removeProperty(e)}}function Ja(e,t,n){var o,i=n+"",r;return function(){var l=Xe(this,e);return l===i?null:l===o?r:r=t(o=l,n)}}function Qa(e,t,n){var o,i,r;return function(){var l=Xe(this,e),s=n(this),u=s+"";return s==null&&(u=s=(this.style.removeProperty(e),Xe(this,e))),l===u?null:l===o&&u===i?r:(i=u,r=t(o=l,s))}}function es(e,t){var n,o,i,r="style."+t,l="end."+r,s;return function(){var u=xe(this,e),c=u.on,d=u.value[r]==null?s||(s=Bo(t)):void 0;(c!==n||i!==d)&&(o=(n=c).copy()).on(l,i=d),u.on=o}}function ts(e,t,n){var o=(e+="")=="transform"?na:$o;return t==null?this.styleTween(e,ja(e,o)).on("end.style."+e,Bo(e)):typeof t=="function"?this.styleTween(e,Qa(e,o,wn(this,"style."+e,t))).each(es(this._id,e)):this.styleTween(e,Ja(e,o,t),n).on("end.style."+e,null)}function ns(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function os(e,t,n){var o,i;function r(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&ns(e,l,n)),o}return r._value=t,r}function is(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,os(e,t,n??""))}function rs(e){return function(){this.textContent=e}}function ls(e){return function(){var t=e(this);this.textContent=t??""}}function as(e){return this.tween("text",typeof e=="function"?ls(wn(this,"text",e)):rs(e==null?"":e+""))}function ss(e){return function(t){this.textContent=e.call(this,t)}}function us(e){var t,n;function o(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&ss(i)),t}return o._value=e,o}function cs(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,us(e))}function ds(){for(var e=this._name,t=this._id,n=Do(),o=this._groups,i=o.length,r=0;r<i;++r)for(var l=o[r],s=l.length,u,c=0;c<s;++c)if(u=l[c]){var d=we(u,t);Vt(u,e,n,c,l,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new Me(o,this._parents,e,n)}function fs(){var e,t,n=this,o=n._id,i=n.size();return new Promise(function(r,l){var s={value:l},u={value:function(){--i===0&&r()}};n.each(function(){var c=xe(this,o),d=c.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(u)),c.on=t}),i===0&&r()})}var hs=0;function Me(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Do(){return++hs}var Ie=Qe.prototype;Me.prototype={constructor:Me,select:Za,selectAll:Wa,selectChild:Ie.selectChild,selectChildren:Ie.selectChildren,filter:Ha,merge:La,selection:qa,transition:ds,call:Ie.call,nodes:Ie.nodes,node:Ie.node,size:Ie.size,empty:Ie.empty,each:Ie.each,on:Ga,attr:Sa,attrTween:Ia,style:ts,styleTween:is,text:as,textTween:cs,remove:Ua,tween:ya,delay:$a,duration:Va,ease:Oa,easeVarying:Ra,end:fs,[Symbol.iterator]:Ie[Symbol.iterator]};function gs(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var ps={time:null,delay:0,duration:250,ease:gs};function ms(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 ys(e){var t,n;e instanceof Me?(t=e._id,e=e._name):(t=Do(),(n=ps).time=gn(),e=e==null?null:e+"");for(var o=this._groups,i=o.length,r=0;r<i;++r)for(var l=o[r],s=l.length,u,c=0;c<s;++c)(u=l[c])&&Vt(u,e,t,c,l,n||ms(u,t));return new Me(o,this._parents,e,t)}Qe.prototype.interrupt=ga,Qe.prototype.transition=ys;const Ot=e=>()=>e;function vs(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 Te(e,t,n){this.k=e,this.x=t,this.y=n}Te.prototype={constructor:Te,scale:function(e){return e===1?this:new Te(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Te(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ke=new Te(1,0,0);Te.prototype;function _n(e){e.stopImmediatePropagation()}function ut(e){e.preventDefault(),e.stopImmediatePropagation()}function ws(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function _s(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Vo(){return this.__zoom||Ke}function Es(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function bs(){return navigator.maxTouchPoints||"ontouchstart"in this}function xs(e,t,n){var o=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],r=e.invertY(t[0][1])-n[0][1],l=e.invertY(t[1][1])-n[1][1];return e.translate(i>o?(o+i)/2:Math.min(0,o)||Math.max(0,i),l>r?(r+l)/2:Math.min(0,r)||Math.max(0,l))}function Ss(){var e=ws,t=_s,n=xs,o=Es,i=bs,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,u=Mt,c=yt("start","zoom","end"),d,f,g,h=500,x=150,b=0,N=10;function k(w){w.property("__zoom",Vo).on("wheel.zoom",I,{passive:!1}).on("mousedown.zoom",B).on("dblclick.zoom",A).filter(i).on("touchstart.zoom",D).on("touchmove.zoom",E).on("touchend.zoom touchcancel.zoom",W).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}k.transform=function(w,P,S,$){var V=w.selection?w.selection():w;V.property("__zoom",Vo),w!==V?O(w,P,S,$):V.interrupt().each(function(){G(this,arguments).event($).start().zoom(null,typeof P=="function"?P.apply(this,arguments):P).end()})},k.scaleBy=function(w,P,S,$){k.scaleTo(w,function(){var V=this.__zoom.k,H=typeof P=="function"?P.apply(this,arguments):P;return V*H},S,$)},k.scaleTo=function(w,P,S,$){k.transform(w,function(){var V=t.apply(this,arguments),H=this.__zoom,z=S==null?C(V):typeof S=="function"?S.apply(this,arguments):S,K=H.invert(z),Q=typeof P=="function"?P.apply(this,arguments):P;return n(_(M(H,Q),z,K),V,l)},S,$)},k.translateBy=function(w,P,S,$){k.transform(w,function(){return n(this.__zoom.translate(typeof P=="function"?P.apply(this,arguments):P,typeof S=="function"?S.apply(this,arguments):S),t.apply(this,arguments),l)},null,$)},k.translateTo=function(w,P,S,$,V){k.transform(w,function(){var H=t.apply(this,arguments),z=this.__zoom,K=$==null?C(H):typeof $=="function"?$.apply(this,arguments):$;return n(Ke.translate(K[0],K[1]).scale(z.k).translate(typeof P=="function"?-P.apply(this,arguments):-P,typeof S=="function"?-S.apply(this,arguments):-S),H,l)},$,V)};function M(w,P){return P=Math.max(r[0],Math.min(r[1],P)),P===w.k?w:new Te(P,w.x,w.y)}function _(w,P,S){var $=P[0]-S[0]*w.k,V=P[1]-S[1]*w.k;return $===w.x&&V===w.y?w:new Te(w.k,$,V)}function C(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function O(w,P,S,$){w.on("start.zoom",function(){G(this,arguments).event($).start()}).on("interrupt.zoom end.zoom",function(){G(this,arguments).event($).end()}).tween("zoom",function(){var V=this,H=arguments,z=G(V,H).event($),K=t.apply(V,H),Q=S==null?C(K):typeof S=="function"?S.apply(V,H):S,oe=Math.max(K[1][0]-K[0][0],K[1][1]-K[0][1]),F=V.__zoom,X=typeof P=="function"?P.apply(V,H):P,j=u(F.invert(Q).concat(oe/F.k),X.invert(Q).concat(oe/X.k));return function(le){if(le===1)le=X;else{var ae=j(le),te=oe/ae[2];le=new Te(te,Q[0]-ae[0]*te,Q[1]-ae[1]*te)}z.zoom(null,le)}})}function G(w,P,S){return!S&&w.__zooming||new Y(w,P)}function Y(w,P){this.that=w,this.args=P,this.active=0,this.sourceEvent=null,this.extent=t.apply(w,P),this.taps=0}Y.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,P){return this.mouse&&w!=="mouse"&&(this.mouse[1]=P.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=P.invert(this.touch0[0])),this.touch1&&w!=="touch"&&(this.touch1[1]=P.invert(this.touch1[0])),this.that.__zoom=P,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(w){var P=ye(this.that).datum();c.call(w,this.that,new vs(w,{sourceEvent:this.sourceEvent,target:k,transform:this.that.__zoom,dispatch:c}),P)}};function I(w,...P){if(!e.apply(this,arguments))return;var S=G(this,P).event(w),$=this.__zoom,V=Math.max(r[0],Math.min(r[1],$.k*Math.pow(2,o.apply(this,arguments)))),H=_e(w);if(S.wheel)(S.mouse[0][0]!==H[0]||S.mouse[0][1]!==H[1])&&(S.mouse[1]=$.invert(S.mouse[0]=H)),clearTimeout(S.wheel);else{if($.k===V)return;S.mouse=[H,$.invert(H)],At(this),S.start()}ut(w),S.wheel=setTimeout(z,x),S.zoom("mouse",n(_(M($,V),S.mouse[0],S.mouse[1]),S.extent,l));function z(){S.wheel=null,S.end()}}function B(w,...P){if(g||!e.apply(this,arguments))return;var S=w.currentTarget,$=G(this,P,!0).event(w),V=ye(w.view).on("mousemove.zoom",Q,!0).on("mouseup.zoom",oe,!0),H=_e(w,S),z=w.clientX,K=w.clientY;ro(w.view),_n(w),$.mouse=[H,this.__zoom.invert(H)],At(this),$.start();function Q(F){if(ut(F),!$.moved){var X=F.clientX-z,j=F.clientY-K;$.moved=X*X+j*j>b}$.event(F).zoom("mouse",n(_($.that.__zoom,$.mouse[0]=_e(F,S),$.mouse[1]),$.extent,l))}function oe(F){V.on("mousemove.zoom mouseup.zoom",null),lo(F.view,$.moved),ut(F),$.event(F).end()}}function A(w,...P){if(e.apply(this,arguments)){var S=this.__zoom,$=_e(w.changedTouches?w.changedTouches[0]:w,this),V=S.invert($),H=S.k*(w.shiftKey?.5:2),z=n(_(M(S,H),$,V),t.apply(this,P),l);ut(w),s>0?ye(this).transition().duration(s).call(O,z,$,w):ye(this).call(k.transform,z,$,w)}}function D(w,...P){if(e.apply(this,arguments)){var S=w.touches,$=S.length,V=G(this,P,w.changedTouches.length===$).event(w),H,z,K,Q;for(_n(w),z=0;z<$;++z)K=S[z],Q=_e(K,this),Q=[Q,this.__zoom.invert(Q),K.identifier],V.touch0?!V.touch1&&V.touch0[2]!==Q[2]&&(V.touch1=Q,V.taps=0):(V.touch0=Q,H=!0,V.taps=1+!!d);d&&(d=clearTimeout(d)),H&&(V.taps<2&&(f=Q[0],d=setTimeout(function(){d=null},h)),At(this),V.start())}}function E(w,...P){if(this.__zooming){var S=G(this,P).event(w),$=w.changedTouches,V=$.length,H,z,K,Q;for(ut(w),H=0;H<V;++H)z=$[H],K=_e(z,this),S.touch0&&S.touch0[2]===z.identifier?S.touch0[0]=K:S.touch1&&S.touch1[2]===z.identifier&&(S.touch1[0]=K);if(z=S.that.__zoom,S.touch1){var oe=S.touch0[0],F=S.touch0[1],X=S.touch1[0],j=S.touch1[1],le=(le=X[0]-oe[0])*le+(le=X[1]-oe[1])*le,ae=(ae=j[0]-F[0])*ae+(ae=j[1]-F[1])*ae;z=M(z,Math.sqrt(le/ae)),K=[(oe[0]+X[0])/2,(oe[1]+X[1])/2],Q=[(F[0]+j[0])/2,(F[1]+j[1])/2]}else if(S.touch0)K=S.touch0[0],Q=S.touch0[1];else return;S.zoom("touch",n(_(z,K,Q),S.extent,l))}}function W(w,...P){if(this.__zooming){var S=G(this,P).event(w),$=w.changedTouches,V=$.length,H,z;for(_n(w),g&&clearTimeout(g),g=setTimeout(function(){g=null},h),H=0;H<V;++H)z=$[H],S.touch0&&S.touch0[2]===z.identifier?delete S.touch0:S.touch1&&S.touch1[2]===z.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&(z=_e(z,this),Math.hypot(f[0]-z[0],f[1]-z[1])<N)){var K=ye(this).on("dblclick.zoom");K&&K.apply(this,arguments)}}}return k.wheelDelta=function(w){return arguments.length?(o=typeof w=="function"?w:Ot(+w),k):o},k.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Ot(!!w),k):e},k.touchable=function(w){return arguments.length?(i=typeof w=="function"?w:Ot(!!w),k):i},k.extent=function(w){return arguments.length?(t=typeof w=="function"?w:Ot([[+w[0][0],+w[0][1]],[+w[1][0],+w[1][1]]]),k):t},k.scaleExtent=function(w){return arguments.length?(r[0]=+w[0],r[1]=+w[1],k):[r[0],r[1]]},k.translateExtent=function(w){return arguments.length?(l[0][0]=+w[0][0],l[1][0]=+w[1][0],l[0][1]=+w[0][1],l[1][1]=+w[1][1],k):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},k.constrain=function(w){return arguments.length?(n=w,k):n},k.duration=function(w){return arguments.length?(s=+w,k):s},k.interpolate=function(w){return arguments.length?(u=w,k):u},k.on=function(){var w=c.on.apply(c,arguments);return w===c?k:w},k.clickDistance=function(w){return arguments.length?(b=(w=+w)*w,k):Math.sqrt(b)},k.tapDistance=function(w){return arguments.length?(N=+w,k):N},k}var R=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(R||{}),En=(e=>(e.Partial="partial",e.Full="full",e))(En||{}),He=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(He||{}),Pe=(e=>(e.Strict="strict",e.Loose="loose",e))(Pe||{}),bn=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(bn||{}),ct=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(ct||{});const Ns=["INPUT","SELECT","TEXTAREA"],Cs=typeof document<"u"?document:null;function xn(e){var t,n;const o=((n=(t=e.composedPath)==null?void 0:t.call(e))==null?void 0:n[0])||e.target,i=typeof(o==null?void 0:o.hasAttribute)=="function"?o.hasAttribute("contenteditable"):!1,r=typeof(o==null?void 0:o.closest)=="function"?o.closest(".nokey"):null;return Ns.includes(o==null?void 0:o.nodeName)||i||!!r}function ks(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Ao(e,t,n,o){const i=t.replace("+",`
|
|
1
|
+
(function(Ce,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],a):(Ce=typeof globalThis<"u"?globalThis:Ce||self,a(Ce["@stonecrop/node-editor"]={},Ce.Vue))})(this,function(Ce,a){"use strict";function mt(e){return a.getCurrentScope()?(a.onScopeDispose(e),!0):!1}function ke(e){return typeof e=="function"?e():a.unref(e)}const $i=typeof window<"u"&&typeof document<"u",Bi=e=>typeof e<"u",Di=Object.prototype.toString,Vi=e=>Di.call(e)==="[object Object]",Ai=()=>{};function Oi(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 Hn=e=>e();function zi(e=Hn){const t=a.ref(!0);function n(){t.value=!1}function o(){t.value=!0}const i=(...r)=>{t.value&&e(...r)};return{isActive:a.readonly(t),pause:n,resume:o,eventFilter:i}}function Ln(e,t=!1,n="Timeout"){return new Promise((o,i)=>{setTimeout(t?()=>i(n):o,e)})}function Ri(e,t,n={}){const{eventFilter:o=Hn,...i}=n;return a.watch(e,Oi(o,t),i)}function Ge(e,t,n={}){const{eventFilter:o,...i}=n,{eventFilter:r,pause:l,resume:s,isActive:u}=zi(o);return{stop:Ri(e,t,{...i,eventFilter:r}),pause:l,resume:s,isActive:u}}function Hi(e,t={}){if(!a.isRef(e))return a.toRefs(e);const n=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const o in e.value)n[o]=a.customRef(()=>({get(){return e.value[o]},set(i){var r;if((r=ke(t.replaceRef))!=null?r:!0)if(Array.isArray(e.value)){const s=[...e.value];s[o]=i,e.value=s}else{const s={...e.value,[o]:i};Object.setPrototypeOf(s,Object.getPrototypeOf(e.value)),e.value=s}else e.value[o]=i}}));return n}function Jt(e,t=!1){function n(f,{flush:h="sync",deep:p=!1,timeout:S,throwOnTimeout:x}={}){let N=null;const M=[new Promise(_=>{N=a.watch(e,C=>{f(C)!==t&&(N?.(),_(C))},{flush:h,deep:p,immediate:!0})})];return S!=null&&M.push(Ln(S,x).then(()=>ke(e)).finally(()=>N?.())),Promise.race(M)}function o(f,h){if(!a.isRef(f))return n(C=>C===f,h);const{flush:p="sync",deep:S=!1,timeout:x,throwOnTimeout:N}=h??{};let k=null;const _=[new Promise(C=>{k=a.watch([e,f],([O,G])=>{t!==(O===G)&&(k?.(),C(O))},{flush:p,deep:S,immediate:!0})})];return x!=null&&_.push(Ln(x,N).then(()=>ke(e)).finally(()=>(k?.(),ke(e)))),Promise.race(_)}function i(f){return n(h=>!!h,f)}function r(f){return o(null,f)}function l(f){return o(void 0,f)}function s(f){return n(Number.isNaN,f)}function u(f,h){return n(p=>{const S=Array.from(p);return S.includes(f)||S.includes(ke(f))},h)}function c(f){return d(1,f)}function d(f=1,h){let p=-1;return n(()=>(p+=1,p>=f),h)}return Array.isArray(ke(e))?{toMatch:n,toContains:u,changed:c,changedTimes:d,get not(){return Jt(e,!t)}}:{toMatch:n,toBe:o,toBeTruthy:i,toBeNull:r,toBeNaN:s,toBeUndefined:l,changed:c,changedTimes:d,get not(){return Jt(e,!t)}}}function Qt(e){return Jt(e)}function Li(e){var t;const n=ke(e);return(t=n?.$el)!=null?t:n}const Fn=$i?window:void 0;function Yn(...e){let t,n,o,i;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,o,i]=e,t=Fn):[t,n,o,i]=e,!t)return Ai;Array.isArray(n)||(n=[n]),Array.isArray(o)||(o=[o]);const r=[],l=()=>{r.forEach(d=>d()),r.length=0},s=(d,f,h,p)=>(d.addEventListener(f,h,p),()=>d.removeEventListener(f,h,p)),u=a.watch(()=>[Li(t),ke(i)],([d,f])=>{if(l(),!d)return;const h=Vi(f)?{...f}:f;r.push(...n.flatMap(p=>o.map(S=>s(d,p,S,h))))},{immediate:!0,flush:"post"}),c=()=>{u(),l()};return mt(c),c}function Fi(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function Gn(...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=Fn,eventName:r="keydown",passive:l=!1,dedupe:s=!1}=o,u=Fi(t);return Yn(i,r,d=>{d.repeat&&ke(s)||u(d)&&n(d)},l)}function Yi(e){return JSON.parse(JSON.stringify(e))}function en(e,t,n,o={}){var i,r,l;const{clone:s=!1,passive:u=!1,eventName:c,deep:d=!1,defaultValue:f,shouldEmit:h}=o,p=a.getCurrentInstance(),S=n||p?.emit||((i=p?.$emit)==null?void 0:i.bind(p))||((l=(r=p?.proxy)==null?void 0:r.$emit)==null?void 0:l.bind(p?.proxy));let x=c;t||(t="modelValue"),x=x||`update:${t.toString()}`;const N=_=>s?typeof s=="function"?s(_):Yi(_):_,k=()=>Bi(e[t])?N(e[t]):f,M=_=>{h?h(_)&&S(x,_):S(x,_)};if(u){const _=k(),C=a.ref(_);let O=!1;return a.watch(()=>e[t],G=>{O||(O=!0,C.value=N(G),a.nextTick(()=>O=!1))}),a.watch(C,G=>{!O&&(G!==e[t]||d)&&M(G)},{deep:d}),C}else return a.computed({get(){return k()},set(_){M(_)}})}var Gi={value:()=>{}};function yt(){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 vt(n)}function vt(e){this._=e}function Xi(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}})}vt.prototype=yt.prototype={constructor:vt,on:function(e,t){var n=this._,o=Xi(e+"",n),i,r=-1,l=o.length;if(arguments.length<2){for(;++r<l;)if((i=(e=o[r]).type)&&(i=Ui(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++r<l;)if(i=(e=o[r]).type)n[i]=Xn(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Xn(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 vt(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 Ui(e,t){for(var n=0,o=e.length,i;n<o;++n)if((i=e[n]).name===t)return i.value}function Xn(e,t,n){for(var o=0,i=e.length;o<i;++o)if(e[o].name===t){e[o]=Gi,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var tn="http://www.w3.org/1999/xhtml";const Un={svg:"http://www.w3.org/2000/svg",xhtml:tn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function wt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Un.hasOwnProperty(t)?{space:Un[t],local:e}:e}function Zi(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===tn&&t.documentElement.namespaceURI===tn?t.createElement(e):t.createElementNS(n,e)}}function Wi(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Zn(e){var t=wt(e);return(t.local?Wi:Zi)(t)}function Ki(){}function nn(e){return e==null?Ki:function(){return this.querySelector(e)}}function qi(e){typeof e!="function"&&(e=nn(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r=t[i],l=r.length,s=o[i]=new Array(l),u,c,d=0;d<l;++d)(u=r[d])&&(c=e.call(u,u.__data__,d,r))&&("__data__"in u&&(c.__data__=u.__data__),s[d]=c);return new me(o,this._parents)}function ji(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Ji(){return[]}function Wn(e){return e==null?Ji:function(){return this.querySelectorAll(e)}}function Qi(e){return function(){return ji(e.apply(this,arguments))}}function er(e){typeof e=="function"?e=Qi(e):e=Wn(e);for(var t=this._groups,n=t.length,o=[],i=[],r=0;r<n;++r)for(var l=t[r],s=l.length,u,c=0;c<s;++c)(u=l[c])&&(o.push(e.call(u,u.__data__,c,l)),i.push(u));return new me(o,i)}function Kn(e){return function(){return this.matches(e)}}function qn(e){return function(t){return t.matches(e)}}var tr=Array.prototype.find;function nr(e){return function(){return tr.call(this.children,e)}}function or(){return this.firstElementChild}function ir(e){return this.select(e==null?or:nr(typeof e=="function"?e:qn(e)))}var rr=Array.prototype.filter;function lr(){return Array.from(this.children)}function ar(e){return function(){return rr.call(this.children,e)}}function sr(e){return this.selectAll(e==null?lr:ar(typeof e=="function"?e:qn(e)))}function ur(e){typeof e!="function"&&(e=Kn(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r=t[i],l=r.length,s=o[i]=[],u,c=0;c<l;++c)(u=r[c])&&e.call(u,u.__data__,c,r)&&s.push(u);return new me(o,this._parents)}function jn(e){return new Array(e.length)}function cr(){return new me(this._enter||this._groups.map(jn),this._parents)}function _t(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}_t.prototype={constructor:_t,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 dr(e){return function(){return e}}function fr(e,t,n,o,i,r){for(var l=0,s,u=t.length,c=r.length;l<c;++l)(s=t[l])?(s.__data__=r[l],o[l]=s):n[l]=new _t(e,r[l]);for(;l<u;++l)(s=t[l])&&(i[l]=s)}function hr(e,t,n,o,i,r,l){var s,u,c=new Map,d=t.length,f=r.length,h=new Array(d),p;for(s=0;s<d;++s)(u=t[s])&&(h[s]=p=l.call(u,u.__data__,s,t)+"",c.has(p)?i[s]=u:c.set(p,u));for(s=0;s<f;++s)p=l.call(e,r[s],s,r)+"",(u=c.get(p))?(o[s]=u,u.__data__=r[s],c.delete(p)):n[s]=new _t(e,r[s]);for(s=0;s<d;++s)(u=t[s])&&c.get(h[s])===u&&(i[s]=u)}function gr(e){return e.__data__}function pr(e,t){if(!arguments.length)return Array.from(this,gr);var n=t?hr:fr,o=this._parents,i=this._groups;typeof e!="function"&&(e=dr(e));for(var r=i.length,l=new Array(r),s=new Array(r),u=new Array(r),c=0;c<r;++c){var d=o[c],f=i[c],h=f.length,p=mr(e.call(d,d&&d.__data__,c,o)),S=p.length,x=s[c]=new Array(S),N=l[c]=new Array(S),k=u[c]=new Array(h);n(d,f,x,N,k,p,t);for(var M=0,_=0,C,O;M<S;++M)if(C=x[M]){for(M>=_&&(_=M+1);!(O=N[_])&&++_<S;);C._next=O||null}}return l=new me(l,o),l._enter=s,l._exit=u,l}function mr(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function yr(){return new me(this._exit||this._groups.map(jn),this._parents)}function vr(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 wr(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,i=n.length,r=o.length,l=Math.min(i,r),s=new Array(i),u=0;u<l;++u)for(var c=n[u],d=o[u],f=c.length,h=s[u]=new Array(f),p,S=0;S<f;++S)(p=c[S]||d[S])&&(h[S]=p);for(;u<i;++u)s[u]=n[u];return new me(s,this._parents)}function _r(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],i=o.length-1,r=o[i],l;--i>=0;)(l=o[i])&&(r&&l.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(l,r),r=l);return this}function Er(e){e||(e=br);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var n=this._groups,o=n.length,i=new Array(o),r=0;r<o;++r){for(var l=n[r],s=l.length,u=i[r]=new Array(s),c,d=0;d<s;++d)(c=l[d])&&(u[d]=c);u.sort(t)}return new me(i,this._parents).order()}function br(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function xr(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Sr(){return Array.from(this)}function Nr(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],i=0,r=o.length;i<r;++i){var l=o[i];if(l)return l}return null}function Cr(){let e=0;for(const t of this)++e;return e}function kr(){return!this.node()}function Mr(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var i=t[n],r=0,l=i.length,s;r<l;++r)(s=i[r])&&e.call(s,s.__data__,r,i);return this}function Ir(e){return function(){this.removeAttribute(e)}}function Tr(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Pr(e,t){return function(){this.setAttribute(e,t)}}function $r(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Br(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Dr(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 Vr(e,t){var n=wt(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?Tr:Ir:typeof t=="function"?n.local?Dr:Br:n.local?$r:Pr)(n,t))}function Jn(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Ar(e){return function(){this.style.removeProperty(e)}}function Or(e,t,n){return function(){this.style.setProperty(e,t,n)}}function zr(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Rr(e,t,n){return arguments.length>1?this.each((t==null?Ar:typeof t=="function"?zr:Or)(e,t,n??"")):Xe(this.node(),e)}function Xe(e,t){return e.style.getPropertyValue(t)||Jn(e).getComputedStyle(e,null).getPropertyValue(t)}function Hr(e){return function(){delete this[e]}}function Lr(e,t){return function(){this[e]=t}}function Fr(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Yr(e,t){return arguments.length>1?this.each((t==null?Hr:typeof t=="function"?Fr:Lr)(e,t)):this.node()[e]}function Qn(e){return e.trim().split(/^|\s+/)}function on(e){return e.classList||new eo(e)}function eo(e){this._node=e,this._names=Qn(e.getAttribute("class")||"")}eo.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 to(e,t){for(var n=on(e),o=-1,i=t.length;++o<i;)n.add(t[o])}function no(e,t){for(var n=on(e),o=-1,i=t.length;++o<i;)n.remove(t[o])}function Gr(e){return function(){to(this,e)}}function Xr(e){return function(){no(this,e)}}function Ur(e,t){return function(){(t.apply(this,arguments)?to:no)(this,e)}}function Zr(e,t){var n=Qn(e+"");if(arguments.length<2){for(var o=on(this.node()),i=-1,r=n.length;++i<r;)if(!o.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?Ur:t?Gr:Xr)(n,t))}function Wr(){this.textContent=""}function Kr(e){return function(){this.textContent=e}}function qr(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function jr(e){return arguments.length?this.each(e==null?Wr:(typeof e=="function"?qr:Kr)(e)):this.node().textContent}function Jr(){this.innerHTML=""}function Qr(e){return function(){this.innerHTML=e}}function el(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function tl(e){return arguments.length?this.each(e==null?Jr:(typeof e=="function"?el:Qr)(e)):this.node().innerHTML}function nl(){this.nextSibling&&this.parentNode.appendChild(this)}function ol(){return this.each(nl)}function il(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function rl(){return this.each(il)}function ll(e){var t=typeof e=="function"?e:Zn(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function al(){return null}function sl(e,t){var n=typeof e=="function"?e:Zn(e),o=t==null?al:typeof t=="function"?t:nn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function ul(){var e=this.parentNode;e&&e.removeChild(this)}function cl(){return this.each(ul)}function dl(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function fl(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function hl(e){return this.select(e?fl:dl)}function gl(e){return arguments.length?this.property("__data__",e):this.node().__data__}function pl(e){return function(t){e.call(this,t,this.__data__)}}function ml(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 yl(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 vl(e,t,n){return function(){var o=this.__on,i,r=pl(t);if(o){for(var l=0,s=o.length;l<s;++l)if((i=o[l]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=r,i.options=n),i.value=t;return}}this.addEventListener(e.type,r,n),i={type:e.type,name:e.name,value:t,listener:r,options:n},o?o.push(i):this.__on=[i]}}function wl(e,t,n){var o=ml(e+""),i,r=o.length,l;if(arguments.length<2){var s=this.node().__on;if(s){for(var u=0,c=s.length,d;u<c;++u)for(i=0,d=s[u];i<r;++i)if((l=o[i]).type===d.type&&l.name===d.name)return d.value}return}for(s=t?vl:yl,i=0;i<r;++i)this.each(s(o[i],t,n));return this}function oo(e,t,n){var o=Jn(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 _l(e,t){return function(){return oo(this,e,t)}}function El(e,t){return function(){return oo(this,e,t.apply(this,arguments))}}function bl(e,t){return this.each((typeof t=="function"?El:_l)(e,t))}function*xl(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],i=0,r=o.length,l;i<r;++i)(l=o[i])&&(yield l)}var io=[null];function me(e,t){this._groups=e,this._parents=t}function Qe(){return new me([[document.documentElement]],io)}function Sl(){return this}me.prototype=Qe.prototype={constructor:me,select:qi,selectAll:er,selectChild:ir,selectChildren:sr,filter:ur,data:pr,enter:cr,exit:yr,join:vr,merge:wr,selection:Sl,order:_r,sort:Er,call:xr,nodes:Sr,node:Nr,size:Cr,empty:kr,each:Mr,attr:Vr,style:Rr,property:Yr,classed:Zr,text:jr,html:tl,raise:ol,lower:rl,append:ll,insert:sl,remove:cl,clone:hl,datum:gl,on:wl,dispatch:bl,[Symbol.iterator]:xl};function ye(e){return typeof e=="string"?new me([[document.querySelector(e)]],[document.documentElement]):new me([[e]],io)}function Nl(e){let t;for(;t=e.sourceEvent;)e=t;return e}function _e(e,t){if(e=Nl(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 Cl={passive:!1},et={capture:!0,passive:!1};function rn(e){e.stopImmediatePropagation()}function Ue(e){e.preventDefault(),e.stopImmediatePropagation()}function ro(e){var t=e.document.documentElement,n=ye(e).on("dragstart.drag",Ue,et);"onselectstart"in t?n.on("selectstart.drag",Ue,et):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function lo(e,t){var n=e.document.documentElement,o=ye(e).on("dragstart.drag",null);t&&(o.on("click.drag",Ue,et),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 Et=e=>()=>e;function ln(e,{sourceEvent:t,subject:n,target:o,identifier:i,active:r,x:l,y:s,dx:u,dy:c,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:r,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:d}})}ln.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function kl(e){return!e.ctrlKey&&!e.button}function Ml(){return this.parentNode}function Il(e,t){return t??{x:e.x,y:e.y}}function Tl(){return navigator.maxTouchPoints||"ontouchstart"in this}function Pl(){var e=kl,t=Ml,n=Il,o=Tl,i={},r=yt("start","drag","end"),l=0,s,u,c,d,f=0;function h(C){C.on("mousedown.drag",p).filter(o).on("touchstart.drag",N).on("touchmove.drag",k,Cl).on("touchend.drag touchcancel.drag",M).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(C,O){if(!(d||!e.call(this,C,O))){var G=_(this,t.call(this,C,O),C,O,"mouse");G&&(ye(C.view).on("mousemove.drag",S,et).on("mouseup.drag",x,et),ro(C.view),rn(C),c=!1,s=C.clientX,u=C.clientY,G("start",C))}}function S(C){if(Ue(C),!c){var O=C.clientX-s,G=C.clientY-u;c=O*O+G*G>f}i.mouse("drag",C)}function x(C){ye(C.view).on("mousemove.drag mouseup.drag",null),lo(C.view,c),Ue(C),i.mouse("end",C)}function N(C,O){if(e.call(this,C,O)){var G=C.changedTouches,Y=t.call(this,C,O),I=G.length,B,A;for(B=0;B<I;++B)(A=_(this,Y,C,O,G[B].identifier,G[B]))&&(rn(C),A("start",C,G[B]))}}function k(C){var O=C.changedTouches,G=O.length,Y,I;for(Y=0;Y<G;++Y)(I=i[O[Y].identifier])&&(Ue(C),I("drag",C,O[Y]))}function M(C){var O=C.changedTouches,G=O.length,Y,I;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),Y=0;Y<G;++Y)(I=i[O[Y].identifier])&&(rn(C),I("end",C,O[Y]))}function _(C,O,G,Y,I,B){var A=r.copy(),D=_e(B||G,O),E,W,w;if((w=n.call(C,new ln("beforestart",{sourceEvent:G,target:h,identifier:I,active:l,x:D[0],y:D[1],dx:0,dy:0,dispatch:A}),Y))!=null)return E=w.x-D[0]||0,W=w.y-D[1]||0,function P(b,$,V){var H=D,z;switch(b){case"start":i[I]=P,z=l++;break;case"end":delete i[I],--l;case"drag":D=_e(V||$,O),z=l;break}A.call(b,C,new ln(b,{sourceEvent:$,subject:w,target:h,identifier:I,active:z,x:D[0]+E,y:D[1]+W,dx:D[0]-H[0],dy:D[1]-H[1],dispatch:A}),Y)}}return h.filter=function(C){return arguments.length?(e=typeof C=="function"?C:Et(!!C),h):e},h.container=function(C){return arguments.length?(t=typeof C=="function"?C:Et(C),h):t},h.subject=function(C){return arguments.length?(n=typeof C=="function"?C:Et(C),h):n},h.touchable=function(C){return arguments.length?(o=typeof C=="function"?C:Et(!!C),h):o},h.on=function(){var C=r.on.apply(r,arguments);return C===r?h:C},h.clickDistance=function(C){return arguments.length?(f=(C=+C)*C,h):Math.sqrt(f)},h}function an(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function ao(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function tt(){}var nt=.7,bt=1/nt,Ze="\\s*([+-]?\\d+)\\s*",ot="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ee="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",$l=/^#([0-9a-f]{3,8})$/,Bl=new RegExp(`^rgb\\(${Ze},${Ze},${Ze}\\)$`),Dl=new RegExp(`^rgb\\(${Ee},${Ee},${Ee}\\)$`),Vl=new RegExp(`^rgba\\(${Ze},${Ze},${Ze},${ot}\\)$`),Al=new RegExp(`^rgba\\(${Ee},${Ee},${Ee},${ot}\\)$`),Ol=new RegExp(`^hsl\\(${ot},${Ee},${Ee}\\)$`),zl=new RegExp(`^hsla\\(${ot},${Ee},${Ee},${ot}\\)$`),so={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};an(tt,Ae,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:uo,formatHex:uo,formatHex8:Rl,formatHsl:Hl,formatRgb:co,toString:co});function uo(){return this.rgb().formatHex()}function Rl(){return this.rgb().formatHex8()}function Hl(){return mo(this).formatHsl()}function co(){return this.rgb().formatRgb()}function Ae(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=$l.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?fo(t):n===3?new pe(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?xt(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?xt(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Bl.exec(e))?new pe(t[1],t[2],t[3],1):(t=Dl.exec(e))?new pe(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Vl.exec(e))?xt(t[1],t[2],t[3],t[4]):(t=Al.exec(e))?xt(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Ol.exec(e))?po(t[1],t[2]/100,t[3]/100,1):(t=zl.exec(e))?po(t[1],t[2]/100,t[3]/100,t[4]):so.hasOwnProperty(e)?fo(so[e]):e==="transparent"?new pe(NaN,NaN,NaN,0):null}function fo(e){return new pe(e>>16&255,e>>8&255,e&255,1)}function xt(e,t,n,o){return o<=0&&(e=t=n=NaN),new pe(e,t,n,o)}function Ll(e){return e instanceof tt||(e=Ae(e)),e?(e=e.rgb(),new pe(e.r,e.g,e.b,e.opacity)):new pe}function sn(e,t,n,o){return arguments.length===1?Ll(e):new pe(e,t,n,o??1)}function pe(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}an(pe,sn,ao(tt,{brighter(e){return e=e==null?bt:Math.pow(bt,e),new pe(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?nt:Math.pow(nt,e),new pe(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new pe(Oe(this.r),Oe(this.g),Oe(this.b),St(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:ho,formatHex:ho,formatHex8:Fl,formatRgb:go,toString:go}));function ho(){return`#${ze(this.r)}${ze(this.g)}${ze(this.b)}`}function Fl(){return`#${ze(this.r)}${ze(this.g)}${ze(this.b)}${ze((isNaN(this.opacity)?1:this.opacity)*255)}`}function go(){const e=St(this.opacity);return`${e===1?"rgb(":"rgba("}${Oe(this.r)}, ${Oe(this.g)}, ${Oe(this.b)}${e===1?")":`, ${e})`}`}function St(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Oe(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ze(e){return e=Oe(e),(e<16?"0":"")+e.toString(16)}function po(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ve(e,t,n,o)}function mo(e){if(e instanceof ve)return new ve(e.h,e.s,e.l,e.opacity);if(e instanceof tt||(e=Ae(e)),!e)return new ve;if(e instanceof ve)return e;e=e.rgb();var t=e.r/255,n=e.g/255,o=e.b/255,i=Math.min(t,n,o),r=Math.max(t,n,o),l=NaN,s=r-i,u=(r+i)/2;return s?(t===r?l=(n-o)/s+(n<o)*6:n===r?l=(o-t)/s+2:l=(t-n)/s+4,s/=u<.5?r+i:2-r-i,l*=60):s=u>0&&u<1?0:l,new ve(l,s,u,e.opacity)}function Yl(e,t,n,o){return arguments.length===1?mo(e):new ve(e,t,n,o??1)}function ve(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}an(ve,Yl,ao(tt,{brighter(e){return e=e==null?bt:Math.pow(bt,e),new ve(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?nt:Math.pow(nt,e),new ve(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,i=2*n-o;return new pe(un(e>=240?e-240:e+120,i,o),un(e,i,o),un(e<120?e+240:e-120,i,o),this.opacity)},clamp(){return new ve(yo(this.h),Nt(this.s),Nt(this.l),St(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=St(this.opacity);return`${e===1?"hsl(":"hsla("}${yo(this.h)}, ${Nt(this.s)*100}%, ${Nt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function yo(e){return e=(e||0)%360,e<0?e+360:e}function Nt(e){return Math.max(0,Math.min(1,e||0))}function un(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 cn=e=>()=>e;function Gl(e,t){return function(n){return e+n*t}}function Xl(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 Ul(e){return(e=+e)==1?vo:function(t,n){return n-t?Xl(t,n,e):cn(isNaN(t)?n:t)}}function vo(e,t){var n=t-e;return n?Gl(e,n):cn(isNaN(e)?t:e)}const Ct=function e(t){var n=Ul(t);function o(i,r){var l=n((i=sn(i)).r,(r=sn(r)).r),s=n(i.g,r.g),u=n(i.b,r.b),c=vo(i.opacity,r.opacity);return function(d){return i.r=l(d),i.g=s(d),i.b=u(d),i.opacity=c(d),i+""}}return o.gamma=e,o}(1);function Zl(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,o=t.slice(),i;return function(r){for(i=0;i<n;++i)o[i]=e[i]*(1-r)+t[i]*r;return o}}function Wl(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Kl(e,t){var n=t?t.length:0,o=e?Math.min(n,e.length):0,i=new Array(o),r=new Array(n),l;for(l=0;l<o;++l)i[l]=it(e[l],t[l]);for(;l<n;++l)r[l]=t[l];return function(s){for(l=0;l<o;++l)r[l]=i[l](s);return r}}function ql(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function be(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function jl(e,t){var n={},o={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?n[i]=it(e[i],t[i]):o[i]=t[i];return function(r){for(i in n)o[i]=n[i](r);return o}}var dn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,fn=new RegExp(dn.source,"g");function Jl(e){return function(){return e}}function Ql(e){return function(t){return e(t)+""}}function wo(e,t){var n=dn.lastIndex=fn.lastIndex=0,o,i,r,l=-1,s=[],u=[];for(e=e+"",t=t+"";(o=dn.exec(e))&&(i=fn.exec(t));)(r=i.index)>n&&(r=t.slice(n,r),s[l]?s[l]+=r:s[++l]=r),(o=o[0])===(i=i[0])?s[l]?s[l]+=i:s[++l]=i:(s[++l]=null,u.push({i:l,x:be(o,i)})),n=fn.lastIndex;return n<t.length&&(r=t.slice(n),s[l]?s[l]+=r:s[++l]=r),s.length<2?u[0]?Ql(u[0].x):Jl(t):(t=u.length,function(c){for(var d=0,f;d<t;++d)s[(f=u[d]).i]=f.x(c);return s.join("")})}function it(e,t){var n=typeof t,o;return t==null||n==="boolean"?cn(t):(n==="number"?be:n==="string"?(o=Ae(t))?(t=o,Ct):wo:t instanceof Ae?Ct:t instanceof Date?ql:Wl(t)?Zl:Array.isArray(t)?Kl:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?jl:be)(e,t)}var _o=180/Math.PI,hn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Eo(e,t,n,o,i,r){var l,s,u;return(l=Math.sqrt(e*e+t*t))&&(e/=l,t/=l),(u=e*n+t*o)&&(n-=e*u,o-=t*u),(s=Math.sqrt(n*n+o*o))&&(n/=s,o/=s,u/=s),e*o<t*n&&(e=-e,t=-t,u=-u,l=-l),{translateX:i,translateY:r,rotate:Math.atan2(t,e)*_o,skewX:Math.atan(u)*_o,scaleX:l,scaleY:s}}var kt;function ea(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?hn:Eo(t.a,t.b,t.c,t.d,t.e,t.f)}function ta(e){return e==null||(kt||(kt=document.createElementNS("http://www.w3.org/2000/svg","g")),kt.setAttribute("transform",e),!(e=kt.transform.baseVal.consolidate()))?hn:(e=e.matrix,Eo(e.a,e.b,e.c,e.d,e.e,e.f))}function bo(e,t,n,o){function i(c){return c.length?c.pop()+" ":""}function r(c,d,f,h,p,S){if(c!==f||d!==h){var x=p.push("translate(",null,t,null,n);S.push({i:x-4,x:be(c,f)},{i:x-2,x:be(d,h)})}else(f||h)&&p.push("translate("+f+t+h+n)}function l(c,d,f,h){c!==d?(c-d>180?d+=360:d-c>180&&(c+=360),h.push({i:f.push(i(f)+"rotate(",null,o)-2,x:be(c,d)})):d&&f.push(i(f)+"rotate("+d+o)}function s(c,d,f,h){c!==d?h.push({i:f.push(i(f)+"skewX(",null,o)-2,x:be(c,d)}):d&&f.push(i(f)+"skewX("+d+o)}function u(c,d,f,h,p,S){if(c!==f||d!==h){var x=p.push(i(p)+"scale(",null,",",null,")");S.push({i:x-4,x:be(c,f)},{i:x-2,x:be(d,h)})}else(f!==1||h!==1)&&p.push(i(p)+"scale("+f+","+h+")")}return function(c,d){var f=[],h=[];return c=e(c),d=e(d),r(c.translateX,c.translateY,d.translateX,d.translateY,f,h),l(c.rotate,d.rotate,f,h),s(c.skewX,d.skewX,f,h),u(c.scaleX,c.scaleY,d.scaleX,d.scaleY,f,h),c=d=null,function(p){for(var S=-1,x=h.length,N;++S<x;)f[(N=h[S]).i]=N.x(p);return f.join("")}}}var na=bo(ea,"px, ","px)","deg)"),oa=bo(ta,", ",")",")"),ia=1e-12;function xo(e){return((e=Math.exp(e))+1/e)/2}function ra(e){return((e=Math.exp(e))-1/e)/2}function la(e){return((e=Math.exp(2*e))-1)/(e+1)}const Mt=function e(t,n,o){function i(r,l){var s=r[0],u=r[1],c=r[2],d=l[0],f=l[1],h=l[2],p=d-s,S=f-u,x=p*p+S*S,N,k;if(x<ia)k=Math.log(h/c)/t,N=function(Y){return[s+Y*p,u+Y*S,c*Math.exp(t*Y*k)]};else{var M=Math.sqrt(x),_=(h*h-c*c+o*x)/(2*c*n*M),C=(h*h-c*c-o*x)/(2*h*n*M),O=Math.log(Math.sqrt(_*_+1)-_),G=Math.log(Math.sqrt(C*C+1)-C);k=(G-O)/t,N=function(Y){var I=Y*k,B=xo(O),A=c/(n*M)*(B*la(t*I+O)-ra(O));return[s+A*p,u+A*S,c*B/xo(t*I+O)]}}return N.duration=k*1e3*t/Math.SQRT2,N}return i.rho=function(r){var l=Math.max(.001,+r),s=l*l,u=s*s;return e(l,s,u)},i}(Math.SQRT2,2,4);var We=0,rt=0,lt=0,So=1e3,It,at,Tt=0,Re=0,Pt=0,st=typeof performance=="object"&&performance.now?performance:Date,No=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function gn(){return Re||(No(aa),Re=st.now()+Pt)}function aa(){Re=0}function $t(){this._call=this._time=this._next=null}$t.prototype=Co.prototype={constructor:$t,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?gn():+n)+(t==null?0:+t),!this._next&&at!==this&&(at?at._next=this:It=this,at=this),this._call=e,this._time=n,pn()},stop:function(){this._call&&(this._call=null,this._time=1/0,pn())}};function Co(e,t,n){var o=new $t;return o.restart(e,t,n),o}function sa(){gn(),++We;for(var e=It,t;e;)(t=Re-e._time)>=0&&e._call.call(void 0,t),e=e._next;--We}function ko(){Re=(Tt=st.now())+Pt,We=rt=0;try{sa()}finally{We=0,ca(),Re=0}}function ua(){var e=st.now(),t=e-Tt;t>So&&(Pt-=t,Tt=e)}function ca(){for(var e,t=It,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:It=n);at=e,pn(o)}function pn(e){if(!We){rt&&(rt=clearTimeout(rt));var t=e-Re;t>24?(e<1/0&&(rt=setTimeout(ko,e-st.now()-Pt)),lt&&(lt=clearInterval(lt))):(lt||(Tt=st.now(),lt=setInterval(ua,So)),We=1,No(ko))}}function Mo(e,t,n){var o=new $t;return t=t==null?0:+t,o.restart(i=>{o.stop(),e(i+t)},t,n),o}var da=yt("start","end","cancel","interrupt"),fa=[],Io=0,To=1,mn=2,Bt=3,Po=4,yn=5,Dt=6;function Vt(e,t,n,o,i,r){var l=e.__transition;if(!l)e.__transition={};else if(n in l)return;ha(e,n,{name:t,index:o,group:i,on:da,tween:fa,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Io})}function vn(e,t){var n=we(e,t);if(n.state>Io)throw new Error("too late; already scheduled");return n}function xe(e,t){var n=we(e,t);if(n.state>Bt)throw new Error("too late; already running");return n}function we(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function ha(e,t,n){var o=e.__transition,i;o[t]=n,n.timer=Co(r,0,n.time);function r(c){n.state=To,n.timer.restart(l,n.delay,n.time),n.delay<=c&&l(c-n.delay)}function l(c){var d,f,h,p;if(n.state!==To)return u();for(d in o)if(p=o[d],p.name===n.name){if(p.state===Bt)return Mo(l);p.state===Po?(p.state=Dt,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete o[d]):+d<t&&(p.state=Dt,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete o[d])}if(Mo(function(){n.state===Bt&&(n.state=Po,n.timer.restart(s,n.delay,n.time),s(c))}),n.state=mn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===mn){for(n.state=Bt,i=new Array(h=n.tween.length),d=0,f=-1;d<h;++d)(p=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(i[++f]=p);i.length=f+1}}function s(c){for(var d=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(u),n.state=yn,1),f=-1,h=i.length;++f<h;)i[f].call(e,d);n.state===yn&&(n.on.call("end",e,e.__data__,n.index,n.group),u())}function u(){n.state=Dt,n.timer.stop(),delete o[t];for(var c in o)return;delete e.__transition}}function At(e,t){var n=e.__transition,o,i,r=!0,l;if(n){t=t==null?null:t+"";for(l in n){if((o=n[l]).name!==t){r=!1;continue}i=o.state>mn&&o.state<yn,o.state=Dt,o.timer.stop(),o.on.call(i?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[l]}r&&delete e.__transition}}function ga(e){return this.each(function(){At(this,e)})}function pa(e,t){var n,o;return function(){var i=xe(this,e),r=i.tween;if(r!==n){o=n=r;for(var l=0,s=o.length;l<s;++l)if(o[l].name===t){o=o.slice(),o.splice(l,1);break}}i.tween=o}}function ma(e,t,n){var o,i;if(typeof n!="function")throw new Error;return function(){var r=xe(this,e),l=r.tween;if(l!==o){i=(o=l).slice();for(var s={name:t,value:n},u=0,c=i.length;u<c;++u)if(i[u].name===t){i[u]=s;break}u===c&&i.push(s)}r.tween=i}}function ya(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=we(this.node(),n).tween,i=0,r=o.length,l;i<r;++i)if((l=o[i]).name===e)return l.value;return null}return this.each((t==null?pa:ma)(n,e,t))}function wn(e,t,n){var o=e._id;return e.each(function(){var i=xe(this,o);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return we(i,o).value[t]}}function $o(e,t){var n;return(typeof t=="number"?be:t instanceof Ae?Ct:(n=Ae(t))?(t=n,Ct):wo)(e,t)}function va(e){return function(){this.removeAttribute(e)}}function wa(e){return function(){this.removeAttributeNS(e.space,e.local)}}function _a(e,t,n){var o,i=n+"",r;return function(){var l=this.getAttribute(e);return l===i?null:l===o?r:r=t(o=l,n)}}function Ea(e,t,n){var o,i=n+"",r;return function(){var l=this.getAttributeNS(e.space,e.local);return l===i?null:l===o?r:r=t(o=l,n)}}function ba(e,t,n){var o,i,r;return function(){var l,s=n(this),u;return s==null?void this.removeAttribute(e):(l=this.getAttribute(e),u=s+"",l===u?null:l===o&&u===i?r:(i=u,r=t(o=l,s)))}}function xa(e,t,n){var o,i,r;return function(){var l,s=n(this),u;return s==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),u=s+"",l===u?null:l===o&&u===i?r:(i=u,r=t(o=l,s)))}}function Sa(e,t){var n=wt(e),o=n==="transform"?oa:$o;return this.attrTween(e,typeof t=="function"?(n.local?xa:ba)(n,o,wn(this,"attr."+e,t)):t==null?(n.local?wa:va)(n):(n.local?Ea:_a)(n,o,t))}function Na(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Ca(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function ka(e,t){var n,o;function i(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&Ca(e,r)),n}return i._value=t,i}function Ma(e,t){var n,o;function i(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&Na(e,r)),n}return i._value=t,i}function Ia(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=wt(e);return this.tween(n,(o.local?ka:Ma)(o,t))}function Ta(e,t){return function(){vn(this,e).delay=+t.apply(this,arguments)}}function Pa(e,t){return t=+t,function(){vn(this,e).delay=t}}function $a(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Ta:Pa)(t,e)):we(this.node(),t).delay}function Ba(e,t){return function(){xe(this,e).duration=+t.apply(this,arguments)}}function Da(e,t){return t=+t,function(){xe(this,e).duration=t}}function Va(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Ba:Da)(t,e)):we(this.node(),t).duration}function Aa(e,t){if(typeof t!="function")throw new Error;return function(){xe(this,e).ease=t}}function Oa(e){var t=this._id;return arguments.length?this.each(Aa(t,e)):we(this.node(),t).ease}function za(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;xe(this,e).ease=n}}function Ra(e){if(typeof e!="function")throw new Error;return this.each(za(this._id,e))}function Ha(e){typeof e!="function"&&(e=Kn(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r=t[i],l=r.length,s=o[i]=[],u,c=0;c<l;++c)(u=r[c])&&e.call(u,u.__data__,c,r)&&s.push(u);return new Me(o,this._parents,this._name,this._id)}function La(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,i=n.length,r=Math.min(o,i),l=new Array(o),s=0;s<r;++s)for(var u=t[s],c=n[s],d=u.length,f=l[s]=new Array(d),h,p=0;p<d;++p)(h=u[p]||c[p])&&(f[p]=h);for(;s<o;++s)l[s]=t[s];return new Me(l,this._parents,this._name,this._id)}function Fa(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 Ya(e,t,n){var o,i,r=Fa(t)?vn:xe;return function(){var l=r(this,e),s=l.on;s!==o&&(i=(o=s).copy()).on(t,n),l.on=i}}function Ga(e,t){var n=this._id;return arguments.length<2?we(this.node(),n).on.on(e):this.each(Ya(n,e,t))}function Xa(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Ua(){return this.on("end.remove",Xa(this._id))}function Za(e){var t=this._name,n=this._id;typeof e!="function"&&(e=nn(e));for(var o=this._groups,i=o.length,r=new Array(i),l=0;l<i;++l)for(var s=o[l],u=s.length,c=r[l]=new Array(u),d,f,h=0;h<u;++h)(d=s[h])&&(f=e.call(d,d.__data__,h,s))&&("__data__"in d&&(f.__data__=d.__data__),c[h]=f,Vt(c[h],t,n,h,c,we(d,n)));return new Me(r,this._parents,t,n)}function Wa(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Wn(e));for(var o=this._groups,i=o.length,r=[],l=[],s=0;s<i;++s)for(var u=o[s],c=u.length,d,f=0;f<c;++f)if(d=u[f]){for(var h=e.call(d,d.__data__,f,u),p,S=we(d,n),x=0,N=h.length;x<N;++x)(p=h[x])&&Vt(p,t,n,x,h,S);r.push(h),l.push(d)}return new Me(r,l,t,n)}var Ka=Qe.prototype.constructor;function qa(){return new Ka(this._groups,this._parents)}function ja(e,t){var n,o,i;return function(){var r=Xe(this,e),l=(this.style.removeProperty(e),Xe(this,e));return r===l?null:r===n&&l===o?i:i=t(n=r,o=l)}}function Bo(e){return function(){this.style.removeProperty(e)}}function Ja(e,t,n){var o,i=n+"",r;return function(){var l=Xe(this,e);return l===i?null:l===o?r:r=t(o=l,n)}}function Qa(e,t,n){var o,i,r;return function(){var l=Xe(this,e),s=n(this),u=s+"";return s==null&&(u=s=(this.style.removeProperty(e),Xe(this,e))),l===u?null:l===o&&u===i?r:(i=u,r=t(o=l,s))}}function es(e,t){var n,o,i,r="style."+t,l="end."+r,s;return function(){var u=xe(this,e),c=u.on,d=u.value[r]==null?s||(s=Bo(t)):void 0;(c!==n||i!==d)&&(o=(n=c).copy()).on(l,i=d),u.on=o}}function ts(e,t,n){var o=(e+="")=="transform"?na:$o;return t==null?this.styleTween(e,ja(e,o)).on("end.style."+e,Bo(e)):typeof t=="function"?this.styleTween(e,Qa(e,o,wn(this,"style."+e,t))).each(es(this._id,e)):this.styleTween(e,Ja(e,o,t),n).on("end.style."+e,null)}function ns(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function os(e,t,n){var o,i;function r(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&ns(e,l,n)),o}return r._value=t,r}function is(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,os(e,t,n??""))}function rs(e){return function(){this.textContent=e}}function ls(e){return function(){var t=e(this);this.textContent=t??""}}function as(e){return this.tween("text",typeof e=="function"?ls(wn(this,"text",e)):rs(e==null?"":e+""))}function ss(e){return function(t){this.textContent=e.call(this,t)}}function us(e){var t,n;function o(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&ss(i)),t}return o._value=e,o}function cs(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,us(e))}function ds(){for(var e=this._name,t=this._id,n=Do(),o=this._groups,i=o.length,r=0;r<i;++r)for(var l=o[r],s=l.length,u,c=0;c<s;++c)if(u=l[c]){var d=we(u,t);Vt(u,e,n,c,l,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new Me(o,this._parents,e,n)}function fs(){var e,t,n=this,o=n._id,i=n.size();return new Promise(function(r,l){var s={value:l},u={value:function(){--i===0&&r()}};n.each(function(){var c=xe(this,o),d=c.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(u)),c.on=t}),i===0&&r()})}var hs=0;function Me(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Do(){return++hs}var Ie=Qe.prototype;Me.prototype={constructor:Me,select:Za,selectAll:Wa,selectChild:Ie.selectChild,selectChildren:Ie.selectChildren,filter:Ha,merge:La,selection:qa,transition:ds,call:Ie.call,nodes:Ie.nodes,node:Ie.node,size:Ie.size,empty:Ie.empty,each:Ie.each,on:Ga,attr:Sa,attrTween:Ia,style:ts,styleTween:is,text:as,textTween:cs,remove:Ua,tween:ya,delay:$a,duration:Va,ease:Oa,easeVarying:Ra,end:fs,[Symbol.iterator]:Ie[Symbol.iterator]};function gs(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var ps={time:null,delay:0,duration:250,ease:gs};function ms(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 ys(e){var t,n;e instanceof Me?(t=e._id,e=e._name):(t=Do(),(n=ps).time=gn(),e=e==null?null:e+"");for(var o=this._groups,i=o.length,r=0;r<i;++r)for(var l=o[r],s=l.length,u,c=0;c<s;++c)(u=l[c])&&Vt(u,e,t,c,l,n||ms(u,t));return new Me(o,this._parents,e,t)}Qe.prototype.interrupt=ga,Qe.prototype.transition=ys;const Ot=e=>()=>e;function vs(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 Te(e,t,n){this.k=e,this.x=t,this.y=n}Te.prototype={constructor:Te,scale:function(e){return e===1?this:new Te(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Te(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ke=new Te(1,0,0);Te.prototype;function _n(e){e.stopImmediatePropagation()}function ut(e){e.preventDefault(),e.stopImmediatePropagation()}function ws(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function _s(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Vo(){return this.__zoom||Ke}function Es(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function bs(){return navigator.maxTouchPoints||"ontouchstart"in this}function xs(e,t,n){var o=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],r=e.invertY(t[0][1])-n[0][1],l=e.invertY(t[1][1])-n[1][1];return e.translate(i>o?(o+i)/2:Math.min(0,o)||Math.max(0,i),l>r?(r+l)/2:Math.min(0,r)||Math.max(0,l))}function Ss(){var e=ws,t=_s,n=xs,o=Es,i=bs,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,u=Mt,c=yt("start","zoom","end"),d,f,h,p=500,S=150,x=0,N=10;function k(w){w.property("__zoom",Vo).on("wheel.zoom",I,{passive:!1}).on("mousedown.zoom",B).on("dblclick.zoom",A).filter(i).on("touchstart.zoom",D).on("touchmove.zoom",E).on("touchend.zoom touchcancel.zoom",W).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}k.transform=function(w,P,b,$){var V=w.selection?w.selection():w;V.property("__zoom",Vo),w!==V?O(w,P,b,$):V.interrupt().each(function(){G(this,arguments).event($).start().zoom(null,typeof P=="function"?P.apply(this,arguments):P).end()})},k.scaleBy=function(w,P,b,$){k.scaleTo(w,function(){var V=this.__zoom.k,H=typeof P=="function"?P.apply(this,arguments):P;return V*H},b,$)},k.scaleTo=function(w,P,b,$){k.transform(w,function(){var V=t.apply(this,arguments),H=this.__zoom,z=b==null?C(V):typeof b=="function"?b.apply(this,arguments):b,K=H.invert(z),Q=typeof P=="function"?P.apply(this,arguments):P;return n(_(M(H,Q),z,K),V,l)},b,$)},k.translateBy=function(w,P,b,$){k.transform(w,function(){return n(this.__zoom.translate(typeof P=="function"?P.apply(this,arguments):P,typeof b=="function"?b.apply(this,arguments):b),t.apply(this,arguments),l)},null,$)},k.translateTo=function(w,P,b,$,V){k.transform(w,function(){var H=t.apply(this,arguments),z=this.__zoom,K=$==null?C(H):typeof $=="function"?$.apply(this,arguments):$;return n(Ke.translate(K[0],K[1]).scale(z.k).translate(typeof P=="function"?-P.apply(this,arguments):-P,typeof b=="function"?-b.apply(this,arguments):-b),H,l)},$,V)};function M(w,P){return P=Math.max(r[0],Math.min(r[1],P)),P===w.k?w:new Te(P,w.x,w.y)}function _(w,P,b){var $=P[0]-b[0]*w.k,V=P[1]-b[1]*w.k;return $===w.x&&V===w.y?w:new Te(w.k,$,V)}function C(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function O(w,P,b,$){w.on("start.zoom",function(){G(this,arguments).event($).start()}).on("interrupt.zoom end.zoom",function(){G(this,arguments).event($).end()}).tween("zoom",function(){var V=this,H=arguments,z=G(V,H).event($),K=t.apply(V,H),Q=b==null?C(K):typeof b=="function"?b.apply(V,H):b,oe=Math.max(K[1][0]-K[0][0],K[1][1]-K[0][1]),F=V.__zoom,X=typeof P=="function"?P.apply(V,H):P,j=u(F.invert(Q).concat(oe/F.k),X.invert(Q).concat(oe/X.k));return function(le){if(le===1)le=X;else{var ae=j(le),te=oe/ae[2];le=new Te(te,Q[0]-ae[0]*te,Q[1]-ae[1]*te)}z.zoom(null,le)}})}function G(w,P,b){return!b&&w.__zooming||new Y(w,P)}function Y(w,P){this.that=w,this.args=P,this.active=0,this.sourceEvent=null,this.extent=t.apply(w,P),this.taps=0}Y.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,P){return this.mouse&&w!=="mouse"&&(this.mouse[1]=P.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=P.invert(this.touch0[0])),this.touch1&&w!=="touch"&&(this.touch1[1]=P.invert(this.touch1[0])),this.that.__zoom=P,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(w){var P=ye(this.that).datum();c.call(w,this.that,new vs(w,{sourceEvent:this.sourceEvent,target:k,transform:this.that.__zoom,dispatch:c}),P)}};function I(w,...P){if(!e.apply(this,arguments))return;var b=G(this,P).event(w),$=this.__zoom,V=Math.max(r[0],Math.min(r[1],$.k*Math.pow(2,o.apply(this,arguments)))),H=_e(w);if(b.wheel)(b.mouse[0][0]!==H[0]||b.mouse[0][1]!==H[1])&&(b.mouse[1]=$.invert(b.mouse[0]=H)),clearTimeout(b.wheel);else{if($.k===V)return;b.mouse=[H,$.invert(H)],At(this),b.start()}ut(w),b.wheel=setTimeout(z,S),b.zoom("mouse",n(_(M($,V),b.mouse[0],b.mouse[1]),b.extent,l));function z(){b.wheel=null,b.end()}}function B(w,...P){if(h||!e.apply(this,arguments))return;var b=w.currentTarget,$=G(this,P,!0).event(w),V=ye(w.view).on("mousemove.zoom",Q,!0).on("mouseup.zoom",oe,!0),H=_e(w,b),z=w.clientX,K=w.clientY;ro(w.view),_n(w),$.mouse=[H,this.__zoom.invert(H)],At(this),$.start();function Q(F){if(ut(F),!$.moved){var X=F.clientX-z,j=F.clientY-K;$.moved=X*X+j*j>x}$.event(F).zoom("mouse",n(_($.that.__zoom,$.mouse[0]=_e(F,b),$.mouse[1]),$.extent,l))}function oe(F){V.on("mousemove.zoom mouseup.zoom",null),lo(F.view,$.moved),ut(F),$.event(F).end()}}function A(w,...P){if(e.apply(this,arguments)){var b=this.__zoom,$=_e(w.changedTouches?w.changedTouches[0]:w,this),V=b.invert($),H=b.k*(w.shiftKey?.5:2),z=n(_(M(b,H),$,V),t.apply(this,P),l);ut(w),s>0?ye(this).transition().duration(s).call(O,z,$,w):ye(this).call(k.transform,z,$,w)}}function D(w,...P){if(e.apply(this,arguments)){var b=w.touches,$=b.length,V=G(this,P,w.changedTouches.length===$).event(w),H,z,K,Q;for(_n(w),z=0;z<$;++z)K=b[z],Q=_e(K,this),Q=[Q,this.__zoom.invert(Q),K.identifier],V.touch0?!V.touch1&&V.touch0[2]!==Q[2]&&(V.touch1=Q,V.taps=0):(V.touch0=Q,H=!0,V.taps=1+!!d);d&&(d=clearTimeout(d)),H&&(V.taps<2&&(f=Q[0],d=setTimeout(function(){d=null},p)),At(this),V.start())}}function E(w,...P){if(this.__zooming){var b=G(this,P).event(w),$=w.changedTouches,V=$.length,H,z,K,Q;for(ut(w),H=0;H<V;++H)z=$[H],K=_e(z,this),b.touch0&&b.touch0[2]===z.identifier?b.touch0[0]=K:b.touch1&&b.touch1[2]===z.identifier&&(b.touch1[0]=K);if(z=b.that.__zoom,b.touch1){var oe=b.touch0[0],F=b.touch0[1],X=b.touch1[0],j=b.touch1[1],le=(le=X[0]-oe[0])*le+(le=X[1]-oe[1])*le,ae=(ae=j[0]-F[0])*ae+(ae=j[1]-F[1])*ae;z=M(z,Math.sqrt(le/ae)),K=[(oe[0]+X[0])/2,(oe[1]+X[1])/2],Q=[(F[0]+j[0])/2,(F[1]+j[1])/2]}else if(b.touch0)K=b.touch0[0],Q=b.touch0[1];else return;b.zoom("touch",n(_(z,K,Q),b.extent,l))}}function W(w,...P){if(this.__zooming){var b=G(this,P).event(w),$=w.changedTouches,V=$.length,H,z;for(_n(w),h&&clearTimeout(h),h=setTimeout(function(){h=null},p),H=0;H<V;++H)z=$[H],b.touch0&&b.touch0[2]===z.identifier?delete b.touch0:b.touch1&&b.touch1[2]===z.identifier&&delete b.touch1;if(b.touch1&&!b.touch0&&(b.touch0=b.touch1,delete b.touch1),b.touch0)b.touch0[1]=this.__zoom.invert(b.touch0[0]);else if(b.end(),b.taps===2&&(z=_e(z,this),Math.hypot(f[0]-z[0],f[1]-z[1])<N)){var K=ye(this).on("dblclick.zoom");K&&K.apply(this,arguments)}}}return k.wheelDelta=function(w){return arguments.length?(o=typeof w=="function"?w:Ot(+w),k):o},k.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Ot(!!w),k):e},k.touchable=function(w){return arguments.length?(i=typeof w=="function"?w:Ot(!!w),k):i},k.extent=function(w){return arguments.length?(t=typeof w=="function"?w:Ot([[+w[0][0],+w[0][1]],[+w[1][0],+w[1][1]]]),k):t},k.scaleExtent=function(w){return arguments.length?(r[0]=+w[0],r[1]=+w[1],k):[r[0],r[1]]},k.translateExtent=function(w){return arguments.length?(l[0][0]=+w[0][0],l[1][0]=+w[1][0],l[0][1]=+w[0][1],l[1][1]=+w[1][1],k):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},k.constrain=function(w){return arguments.length?(n=w,k):n},k.duration=function(w){return arguments.length?(s=+w,k):s},k.interpolate=function(w){return arguments.length?(u=w,k):u},k.on=function(){var w=c.on.apply(c,arguments);return w===c?k:w},k.clickDistance=function(w){return arguments.length?(x=(w=+w)*w,k):Math.sqrt(x)},k.tapDistance=function(w){return arguments.length?(N=+w,k):N},k}var R=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(R||{}),En=(e=>(e.Partial="partial",e.Full="full",e))(En||{}),He=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(He||{}),Pe=(e=>(e.Strict="strict",e.Loose="loose",e))(Pe||{}),bn=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(bn||{}),ct=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(ct||{});const Ns=["INPUT","SELECT","TEXTAREA"],Cs=typeof document<"u"?document:null;function xn(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 Ns.includes(o?.nodeName)||i||!!r}function ks(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Ao(e,t,n,o){const i=t.replace("+",`
|
|
2
2
|
`).replace(`
|
|
3
3
|
|
|
4
4
|
`,`
|
|
5
5
|
+`).split(`
|
|
6
|
-
`).map(l=>l.trim().toLowerCase());if(i.length===1)return e.toLowerCase()===t.toLowerCase();o||n.add(e.toLowerCase());const r=i.every((l,s)=>n.has(l)&&Array.from(n.values())[s]===i[s]);return o&&n.delete(e.toLowerCase()),r}function Ms(e,t){return n=>{if(!n.code&&!n.key)return!1;const o=Is(n.code,e);return Array.isArray(e)?e.some(i=>Ao(n[o],i,t,n.type==="keyup")):Ao(n[o],e,t,n.type==="keyup")}}function Is(e,t){return t.includes(e)?"code":"key"}function dt(e,t){const n=a.computed(()=>a.toValue(t==null?void 0:t.target)??Cs),o=a.shallowRef(a.toValue(e)===!0);let i=!1;const r=new Set;let l=u(a.toValue(e));a.watch(()=>a.toValue(e),(c,d)=>{typeof d=="boolean"&&typeof c!="boolean"&&s(),l=u(c)},{immediate:!0}),Yn(["blur","contextmenu"],s),Gn((...c)=>l(...c),c=>{var d,f;const g=a.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0,h=a.toValue(t==null?void 0:t.preventDefault)??!1;if(i=ks(c),(!i||i&&!g)&&xn(c))return;const b=((f=(d=c.composedPath)==null?void 0:d.call(c))==null?void 0:f[0])||c.target,N=(b==null?void 0:b.nodeName)==="BUTTON"||(b==null?void 0:b.nodeName)==="A";!h&&(i||!N)&&c.preventDefault(),o.value=!0},{eventName:"keydown",target:n}),Gn((...c)=>l(...c),c=>{const d=a.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0;if(o.value){if((!i||i&&!d)&&xn(c))return;i=!1,o.value=!1}},{eventName:"keyup",target:n});function s(){i=!1,r.clear(),o.value=a.toValue(e)===!0}function u(c){return c===null?(s(),()=>!1):typeof c=="boolean"?(s(),o.value=c,()=>!1):Array.isArray(c)||typeof c=="string"?Ms(c,r):c}return o}const Oo="vue-flow__node-desc",zo="vue-flow__edge-desc",Ts="vue-flow__aria-live",Ro=["Enter"," ","Escape"],qe={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function zt(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function Rt(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 Ht(e){return{width:e.offsetWidth,height:e.offsetHeight}}function Le(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function Ho(e,t){return{x:Le(e.x,t[0][0],t[1][0]),y:Le(e.y,t[0][1],t[1][1])}}function Lo(e){const t=e.getRootNode();return"elementFromPoint"in t?t:window.document}function $e(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function Fe(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!$e(e)}function ft(e){return Fe(e)&&"computedPosition"in e}function Lt(e){return!Number.isNaN(e)&&Number.isFinite(e)}function Ps(e){return Lt(e.width)&&Lt(e.height)&&Lt(e.x)&&Lt(e.y)}function $s(e,t,n){const o={id:e.id.toString(),type:e.type??"default",dimensions:a.markRaw({width:0,height:0}),computedPosition:a.markRaw({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:he(e.data)?e.data:{},events:a.markRaw(he(e.events)?e.events:{})};return Object.assign(t??o,e,{id:e.id.toString(),parentNode:n})}function Fo(e,t,n){var o,i;const r={id:e.id.toString(),type:e.type??(t==null?void 0: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==null?void 0:n.updatable),selectable:e.selectable??(n==null?void 0:n.selectable),focusable:e.focusable??(n==null?void 0:n.focusable),data:he(e.data)?e.data:{},events:a.markRaw(he(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??(n==null?void 0:n.interactionWidth),...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function Yo(e,t,n,o){const i=typeof e=="string"?e:e.id,r=new Set,l=o==="source"?"target":"source";for(const s of n)s[l]===i&&r.add(s[o]);return t.filter(s=>r.has(s.id))}function Bs(...e){if(e.length===3){const[r,l,s]=e;return Yo(r,l,s,"target")}const[t,n]=e,o=typeof t=="string"?t:t.id;return n.filter(r=>$e(r)&&r.source===o).map(r=>n.find(l=>Fe(l)&&l.id===r.target))}function Ds(...e){if(e.length===3){const[r,l,s]=e;return Yo(r,l,s,"source")}const[t,n]=e,o=typeof t=="string"?t:t.id;return n.filter(r=>$e(r)&&r.target===o).map(r=>n.find(l=>Fe(l)&&l.id===r.source))}function Go({source:e,sourceHandle:t,target:n,targetHandle:o}){return`vueflow__edge-${e}${t??""}-${n}${o??""}`}function Vs(e,t){return t.some(n=>$e(n)&&n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle))}function Sn({x:e,y:t},{x:n,y:o,zoom:i}){return{x:e*i+n,y:t*i+o}}function ht({x:e,y:t},{x:n,y:o,zoom:i},r=!1,l=[1,1]){const s={x:(e-n)/i,y:(t-o)/i};return r?Yt(s,l):s}function As(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 Xo({x:e,y:t,width:n,height:o}){return{x:e,y:t,x2:e+n,y2:t+o}}function Os({x:e,y:t,x2:n,y2:o}){return{x:e,y:t,width:n-e,height:o-t}}function Uo(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=As(t,Xo({...o.computedPosition,...o.dimensions}))}return Os(t)}function Zo(e,t,n={x:0,y:0,zoom:1},o=!1,i=!1){const r={...ht(t,n),width:t.width/n.zoom,height:t.height/n.zoom},l=[];for(const s of e){const{dimensions:u,selectable:c=!0,hidden:d=!1}=s,f=u.width??s.width??null,g=u.height??s.height??null;if(i&&!c||d)continue;const h=Rt(r,zt(s)),x=f===null||g===null,b=o&&h>0,N=(f??0)*(g??0);(x||b||h>=N||s.dragging)&&l.push(s)}return l}function Wo(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 Ko(e,t,n,o,i,r=.1,l={x:0,y:0}){const s=t/(e.width*(1+r)),u=n/(e.height*(1+r)),c=Math.min(s,u),d=Le(c,o,i),f=e.x+e.width/2,g=e.y+e.height/2,h=t/2-f*d+(l.x??0),x=n/2-g*d+(l.y??0);return{x:h,y:x,zoom:d}}function zs(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function qo(e,t){if(!e.parentNode)return!1;const n=t(e.parentNode);return n?n.selected?!0:qo(n,t):!1}function gt(e,t){return typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`}function jo(e,t,n){return e<t?Le(Math.abs(e-t),1,t)/t:e>n?-Le(Math.abs(e-n),1,t)/t:0}function Jo(e,t,n=15,o=40){const i=jo(e.x,o,t.width-o)*n,r=jo(e.y,o,t.height-o)*n;return[i,r]}function Nn(e,t){if(t){const n=e.position.x+e.dimensions.width-t.dimensions.width,o=e.position.y+e.dimensions.height-t.dimensions.height;if(n>0||o>0||e.position.x<0||e.position.y<0){let i={};if(typeof t.style=="function"?i={...t.style(t)}:t.style&&(i={...t.style}),i.width=i.width??`${t.dimensions.width}px`,i.height=i.height??`${t.dimensions.height}px`,n>0)if(typeof i.width=="string"){const r=Number(i.width.replace("px",""));i.width=`${r+n}px`}else i.width+=n;if(o>0)if(typeof i.height=="string"){const r=Number(i.height.replace("px",""));i.height=`${r+o}px`}else i.height+=o;if(e.position.x<0){const r=Math.abs(e.position.x);if(t.position.x=t.position.x-r,typeof i.width=="string"){const l=Number(i.width.replace("px",""));i.width=`${l+r}px`}else i.width+=r;e.position.x=0}if(e.position.y<0){const r=Math.abs(e.position.y);if(t.position.y=t.position.y-r,typeof i.height=="string"){const l=Number(i.height.replace("px",""));i.height=`${l+r}px`}else i.height+=r;e.position.y=0}t.dimensions.width=Number(i.width.toString().replace("px","")),t.dimensions.height=Number(i.height.toString().replace("px","")),typeof t.style=="function"?t.style=r=>{const l=t.style;return{...l(r),...i}}:t.style={...t.style,...i}}}}function Qo(e,t){var n,o;const i=e.filter(l=>l.type==="add"||l.type==="remove");for(const l of i)if(l.type==="add")t.findIndex(u=>u.id===l.item.id)===-1&&t.push(l.item);else if(l.type==="remove"){const s=t.findIndex(u=>u.id===l.id);s!==-1&&t.splice(s,1)}const r=t.map(l=>l.id);for(const l of t)for(const s of e)if(s.id===l.id)switch(s.type){case"select":l.selected=s.selected;break;case"position":if(ft(l)&&(typeof s.position<"u"&&(l.position=s.position),typeof s.dragging<"u"&&(l.dragging=s.dragging),l.expandParent&&l.parentNode)){const u=t[r.indexOf(l.parentNode)];u&&ft(u)&&Nn(l,u)}break;case"dimensions":if(ft(l)&&(typeof s.dimensions<"u"&&(l.dimensions=s.dimensions),typeof s.updateStyle<"u"&&s.updateStyle&&(l.style={...l.style||{},width:`${(n=s.dimensions)==null?void 0:n.width}px`,height:`${(o=s.dimensions)==null?void 0:o.height}px`}),typeof s.resizing<"u"&&(l.resizing=s.resizing),l.expandParent&&l.parentNode)){const u=t[r.indexOf(l.parentNode)];u&&ft(u)&&(!!u.dimensions.width&&!!u.dimensions.height?Nn(l,u):a.nextTick(()=>{Nn(l,u)}))}break}return t}function Be(e,t){return{id:e,type:"select",selected:t}}function ei(e){return{item:e,type:"add"}}function ti(e){return{id:e,type:"remove"}}function ni(e,t,n,o,i){return{id:e,source:t,target:n,sourceHandle:o||null,targetHandle:i||null,type:"remove"}}function De(e,t=new Set,n=!1){const o=[];for(const[i,r]of e){const l=t.has(i);!(r.selected===void 0&&!l)&&r.selected!==l&&(n&&(r.selected=l),o.push(Be(r.id,l)))}return o}function L(e){const t=new Set;let n=!1;const o=()=>t.size>0;e&&(n=!0,t.add(e));const i=s=>{t.delete(s)};return{on:s=>{e&&n&&t.delete(e),t.add(s);const u=()=>{i(s),e&&n&&t.add(e)};return mt(u),{off:u}},off:i,trigger:s=>Promise.all(Array.from(t).map(u=>u(s))),hasListeners:o,fns:t}}function oi(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 Rs(e,t,n,o,i){var r,l;const s=[];for(const u of e)(u.selected||u.id===i)&&(!u.parentNode||!qo(u,o))&&(u.draggable||t&&typeof u.draggable>"u")&&s.push(a.markRaw({id:u.id,position:u.position||{x:0,y:0},distance:{x:n.x-((r=u.computedPosition)==null?void 0:r.x)||0,y:n.y-((l=u.computedPosition)==null?void 0:l.y)||0},from:u.computedPosition,extent:u.extent,parentNode:u.parentNode,dimensions:u.dimensions,expandParent:u.expandParent}));return s}function Cn({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 ii(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 Hs(e,t,n){const[o,i,r,l]=typeof e!="string"?ii(e.padding):[0,0,0,0];return n&&typeof n.computedPosition.x<"u"&&typeof n.computedPosition.y<"u"&&typeof n.dimensions.width<"u"&&typeof n.dimensions.height<"u"?[[n.computedPosition.x+l,n.computedPosition.y+o],[n.computedPosition.x+n.dimensions.width-i,n.computedPosition.y+n.dimensions.height-r]]:!1}function Ls(e,t,n,o){let i=e.extent||n;if((i==="parent"||!Array.isArray(i)&&(i==null?void 0:i.range)==="parent")&&!e.expandParent)if(e.parentNode&&o&&e.dimensions.width&&e.dimensions.height){const r=Hs(i,e,o);r&&(i=r)}else t(new ge(fe.NODE_EXTENT_INVALID,e.id)),i=n;else if(Array.isArray(i)){const r=(o==null?void 0:o.computedPosition.x)||0,l=(o==null?void 0:o.computedPosition.y)||0;i=[[i[0][0]+r,i[0][1]+l],[i[1][0]+r,i[1][1]+l]]}else if(i!=="parent"&&(i!=null&&i.range)&&Array.isArray(i.range)){const[r,l,s,u]=ii(i.padding),c=(o==null?void 0:o.computedPosition.x)||0,d=(o==null?void 0:o.computedPosition.y)||0;i=[[i.range[0][0]+c+u,i.range[0][1]+d+r],[i.range[1][0]+c-l,i.range[1][1]+d-s]]}return i==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:i}function Fs({width:e,height:t},n){return[n[0],[n[1][0]-(e||0),n[1][1]-(t||0)]]}function kn(e,t,n,o,i){const r=Fs(e.dimensions,Ls(e,n,o,i)),l=Ho(t,r);return{position:{x:l.x-((i==null?void 0:i.computedPosition.x)||0),y:l.y-((i==null?void 0:i.computedPosition.y)||0)},computedPosition:l}}function je(e,t,n=R.Left,o=!1){const i=((t==null?void 0:t.x)??0)+e.computedPosition.x,r=((t==null?void 0:t.y)??0)+e.computedPosition.y,{width:l,height:s}=t??Us(e);if(o)return{x:i+l/2,y:r+s/2};switch((t==null?void 0:t.position)??n){case R.Top:return{x:i+l/2,y:r};case R.Right:return{x:i+l,y:r+s/2};case R.Bottom:return{x:i+l/2,y:r+s};case R.Left:return{x:i,y:r+s/2}}}function ri(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Ys({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:o,targetWidth:i,targetHeight:r,width:l,height:s,viewport:u}){const c={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+i),y2:Math.max(e.y+o,t.y+r)};c.x===c.x2&&(c.x2+=1),c.y===c.y2&&(c.y2+=1);const d=Xo({x:(0-u.x)/u.zoom,y:(0-u.y)/u.zoom,width:l/u.zoom,height:s/u.zoom}),f=Math.max(0,Math.min(d.x2,c.x2)-Math.max(d.x,c.x)),g=Math.max(0,Math.min(d.y2,c.y2)-Math.max(d.y,c.y));return Math.ceil(f*g)>0}function Gs(e,t,n=!1){const o=typeof e.zIndex=="number";let i=o?e.zIndex:0;const r=t(e.source),l=t(e.target);return!r||!l?0:(n&&(i=o?e.zIndex:Math.max(r.computedPosition.z||0,l.computedPosition.z||0)),i)}var fe=(e=>(e.MISSING_STYLES="MISSING_STYLES",e.MISSING_VIEWPORT_DIMENSIONS="MISSING_VIEWPORT_DIMENSIONS",e.NODE_INVALID="NODE_INVALID",e.NODE_NOT_FOUND="NODE_NOT_FOUND",e.NODE_MISSING_PARENT="NODE_MISSING_PARENT",e.NODE_TYPE_MISSING="NODE_TYPE_MISSING",e.NODE_EXTENT_INVALID="NODE_EXTENT_INVALID",e.EDGE_INVALID="EDGE_INVALID",e.EDGE_NOT_FOUND="EDGE_NOT_FOUND",e.EDGE_SOURCE_MISSING="EDGE_SOURCE_MISSING",e.EDGE_TARGET_MISSING="EDGE_TARGET_MISSING",e.EDGE_TYPE_MISSING="EDGE_TYPE_MISSING",e.EDGE_SOURCE_TARGET_SAME="EDGE_SOURCE_TARGET_SAME",e.EDGE_SOURCE_TARGET_MISSING="EDGE_SOURCE_TARGET_MISSING",e.EDGE_ORPHANED="EDGE_ORPHANED",e.USEVUEFLOW_OPTIONS="USEVUEFLOW_OPTIONS",e))(fe||{});const li={MISSING_STYLES:()=>"It seems that you haven't loaded the necessary styles. Please import '@vue-flow/core/dist/style.css' to ensure that the graph is rendered correctly",MISSING_VIEWPORT_DIMENSIONS:()=>"The Vue Flow parent container needs a width and a height to render the graph",NODE_INVALID:e=>`Node is invalid
|
|
6
|
+
`).map(l=>l.trim().toLowerCase());if(i.length===1)return e.toLowerCase()===t.toLowerCase();o||n.add(e.toLowerCase());const r=i.every((l,s)=>n.has(l)&&Array.from(n.values())[s]===i[s]);return o&&n.delete(e.toLowerCase()),r}function Ms(e,t){return n=>{if(!n.code&&!n.key)return!1;const o=Is(n.code,e);return Array.isArray(e)?e.some(i=>Ao(n[o],i,t,n.type==="keyup")):Ao(n[o],e,t,n.type==="keyup")}}function Is(e,t){return t.includes(e)?"code":"key"}function dt(e,t){const n=a.computed(()=>a.toValue(t?.target)??Cs),o=a.shallowRef(a.toValue(e)===!0);let i=!1;const r=new Set;let l=u(a.toValue(e));a.watch(()=>a.toValue(e),(c,d)=>{typeof d=="boolean"&&typeof c!="boolean"&&s(),l=u(c)},{immediate:!0}),Yn(["blur","contextmenu"],s),Gn((...c)=>l(...c),c=>{var d,f;const h=a.toValue(t?.actInsideInputWithModifier)??!0,p=a.toValue(t?.preventDefault)??!1;if(i=ks(c),(!i||i&&!h)&&xn(c))return;const x=((f=(d=c.composedPath)==null?void 0:d.call(c))==null?void 0:f[0])||c.target,N=x?.nodeName==="BUTTON"||x?.nodeName==="A";!p&&(i||!N)&&c.preventDefault(),o.value=!0},{eventName:"keydown",target:n}),Gn((...c)=>l(...c),c=>{const d=a.toValue(t?.actInsideInputWithModifier)??!0;if(o.value){if((!i||i&&!d)&&xn(c))return;i=!1,o.value=!1}},{eventName:"keyup",target:n});function s(){i=!1,r.clear(),o.value=a.toValue(e)===!0}function u(c){return c===null?(s(),()=>!1):typeof c=="boolean"?(s(),o.value=c,()=>!1):Array.isArray(c)||typeof c=="string"?Ms(c,r):c}return o}const Oo="vue-flow__node-desc",zo="vue-flow__edge-desc",Ts="vue-flow__aria-live",Ro=["Enter"," ","Escape"],qe={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function zt(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function Rt(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 Ht(e){return{width:e.offsetWidth,height:e.offsetHeight}}function Le(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function Ho(e,t){return{x:Le(e.x,t[0][0],t[1][0]),y:Le(e.y,t[0][1],t[1][1])}}function Lo(e){const t=e.getRootNode();return"elementFromPoint"in t?t:window.document}function $e(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function Fe(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!$e(e)}function ft(e){return Fe(e)&&"computedPosition"in e}function Lt(e){return!Number.isNaN(e)&&Number.isFinite(e)}function Ps(e){return Lt(e.width)&&Lt(e.height)&&Lt(e.x)&&Lt(e.y)}function $s(e,t,n){const o={id:e.id.toString(),type:e.type??"default",dimensions:a.markRaw({width:0,height:0}),computedPosition:a.markRaw({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:he(e.data)?e.data:{},events:a.markRaw(he(e.events)?e.events:{})};return Object.assign(t??o,e,{id:e.id.toString(),parentNode:n})}function Fo(e,t,n){var o,i;const r={id:e.id.toString(),type:e.type??t?.type??"default",source:e.source.toString(),target:e.target.toString(),sourceHandle:(o=e.sourceHandle)==null?void 0:o.toString(),targetHandle:(i=e.targetHandle)==null?void 0:i.toString(),updatable:e.updatable??n?.updatable,selectable:e.selectable??n?.selectable,focusable:e.focusable??n?.focusable,data:he(e.data)?e.data:{},events:a.markRaw(he(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function Yo(e,t,n,o){const i=typeof e=="string"?e:e.id,r=new Set,l=o==="source"?"target":"source";for(const s of n)s[l]===i&&r.add(s[o]);return t.filter(s=>r.has(s.id))}function Bs(...e){if(e.length===3){const[r,l,s]=e;return Yo(r,l,s,"target")}const[t,n]=e,o=typeof t=="string"?t:t.id;return n.filter(r=>$e(r)&&r.source===o).map(r=>n.find(l=>Fe(l)&&l.id===r.target))}function Ds(...e){if(e.length===3){const[r,l,s]=e;return Yo(r,l,s,"source")}const[t,n]=e,o=typeof t=="string"?t:t.id;return n.filter(r=>$e(r)&&r.target===o).map(r=>n.find(l=>Fe(l)&&l.id===r.source))}function Go({source:e,sourceHandle:t,target:n,targetHandle:o}){return`vueflow__edge-${e}${t??""}-${n}${o??""}`}function Vs(e,t){return t.some(n=>$e(n)&&n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle))}function Sn({x:e,y:t},{x:n,y:o,zoom:i}){return{x:e*i+n,y:t*i+o}}function ht({x:e,y:t},{x:n,y:o,zoom:i},r=!1,l=[1,1]){const s={x:(e-n)/i,y:(t-o)/i};return r?Yt(s,l):s}function As(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 Xo({x:e,y:t,width:n,height:o}){return{x:e,y:t,x2:e+n,y2:t+o}}function Os({x:e,y:t,x2:n,y2:o}){return{x:e,y:t,width:n-e,height:o-t}}function Uo(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=As(t,Xo({...o.computedPosition,...o.dimensions}))}return Os(t)}function Zo(e,t,n={x:0,y:0,zoom:1},o=!1,i=!1){const r={...ht(t,n),width:t.width/n.zoom,height:t.height/n.zoom},l=[];for(const s of e){const{dimensions:u,selectable:c=!0,hidden:d=!1}=s,f=u.width??s.width??null,h=u.height??s.height??null;if(i&&!c||d)continue;const p=Rt(r,zt(s)),S=f===null||h===null,x=o&&p>0,N=(f??0)*(h??0);(S||x||p>=N||s.dragging)&&l.push(s)}return l}function Wo(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 Ko(e,t,n,o,i,r=.1,l={x:0,y:0}){const s=t/(e.width*(1+r)),u=n/(e.height*(1+r)),c=Math.min(s,u),d=Le(c,o,i),f=e.x+e.width/2,h=e.y+e.height/2,p=t/2-f*d+(l.x??0),S=n/2-h*d+(l.y??0);return{x:p,y:S,zoom:d}}function zs(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function qo(e,t){if(!e.parentNode)return!1;const n=t(e.parentNode);return n?n.selected?!0:qo(n,t):!1}function gt(e,t){return typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`}function jo(e,t,n){return e<t?Le(Math.abs(e-t),1,t)/t:e>n?-Le(Math.abs(e-n),1,t)/t:0}function Jo(e,t,n=15,o=40){const i=jo(e.x,o,t.width-o)*n,r=jo(e.y,o,t.height-o)*n;return[i,r]}function Nn(e,t){if(t){const n=e.position.x+e.dimensions.width-t.dimensions.width,o=e.position.y+e.dimensions.height-t.dimensions.height;if(n>0||o>0||e.position.x<0||e.position.y<0){let i={};if(typeof t.style=="function"?i={...t.style(t)}:t.style&&(i={...t.style}),i.width=i.width??`${t.dimensions.width}px`,i.height=i.height??`${t.dimensions.height}px`,n>0)if(typeof i.width=="string"){const r=Number(i.width.replace("px",""));i.width=`${r+n}px`}else i.width+=n;if(o>0)if(typeof i.height=="string"){const r=Number(i.height.replace("px",""));i.height=`${r+o}px`}else i.height+=o;if(e.position.x<0){const r=Math.abs(e.position.x);if(t.position.x=t.position.x-r,typeof i.width=="string"){const l=Number(i.width.replace("px",""));i.width=`${l+r}px`}else i.width+=r;e.position.x=0}if(e.position.y<0){const r=Math.abs(e.position.y);if(t.position.y=t.position.y-r,typeof i.height=="string"){const l=Number(i.height.replace("px",""));i.height=`${l+r}px`}else i.height+=r;e.position.y=0}t.dimensions.width=Number(i.width.toString().replace("px","")),t.dimensions.height=Number(i.height.toString().replace("px","")),typeof t.style=="function"?t.style=r=>{const l=t.style;return{...l(r),...i}}:t.style={...t.style,...i}}}}function Qo(e,t){var n,o;const i=e.filter(l=>l.type==="add"||l.type==="remove");for(const l of i)if(l.type==="add")t.findIndex(u=>u.id===l.item.id)===-1&&t.push(l.item);else if(l.type==="remove"){const s=t.findIndex(u=>u.id===l.id);s!==-1&&t.splice(s,1)}const r=t.map(l=>l.id);for(const l of t)for(const s of e)if(s.id===l.id)switch(s.type){case"select":l.selected=s.selected;break;case"position":if(ft(l)&&(typeof s.position<"u"&&(l.position=s.position),typeof s.dragging<"u"&&(l.dragging=s.dragging),l.expandParent&&l.parentNode)){const u=t[r.indexOf(l.parentNode)];u&&ft(u)&&Nn(l,u)}break;case"dimensions":if(ft(l)&&(typeof s.dimensions<"u"&&(l.dimensions=s.dimensions),typeof s.updateStyle<"u"&&s.updateStyle&&(l.style={...l.style||{},width:`${(n=s.dimensions)==null?void 0:n.width}px`,height:`${(o=s.dimensions)==null?void 0:o.height}px`}),typeof s.resizing<"u"&&(l.resizing=s.resizing),l.expandParent&&l.parentNode)){const u=t[r.indexOf(l.parentNode)];u&&ft(u)&&(!!u.dimensions.width&&!!u.dimensions.height?Nn(l,u):a.nextTick(()=>{Nn(l,u)}))}break}return t}function Be(e,t){return{id:e,type:"select",selected:t}}function ei(e){return{item:e,type:"add"}}function ti(e){return{id:e,type:"remove"}}function ni(e,t,n,o,i){return{id:e,source:t,target:n,sourceHandle:o||null,targetHandle:i||null,type:"remove"}}function De(e,t=new Set,n=!1){const o=[];for(const[i,r]of e){const l=t.has(i);!(r.selected===void 0&&!l)&&r.selected!==l&&(n&&(r.selected=l),o.push(Be(r.id,l)))}return o}function L(e){const t=new Set;let n=!1;const o=()=>t.size>0;e&&(n=!0,t.add(e));const i=s=>{t.delete(s)};return{on:s=>{e&&n&&t.delete(e),t.add(s);const u=()=>{i(s),e&&n&&t.add(e)};return mt(u),{off:u}},off:i,trigger:s=>Promise.all(Array.from(t).map(u=>u(s))),hasListeners:o,fns:t}}function oi(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 Rs(e,t,n,o,i){var r,l;const s=[];for(const u of e)(u.selected||u.id===i)&&(!u.parentNode||!qo(u,o))&&(u.draggable||t&&typeof u.draggable>"u")&&s.push(a.markRaw({id:u.id,position:u.position||{x:0,y:0},distance:{x:n.x-((r=u.computedPosition)==null?void 0:r.x)||0,y:n.y-((l=u.computedPosition)==null?void 0:l.y)||0},from:u.computedPosition,extent:u.extent,parentNode:u.parentNode,dimensions:u.dimensions,expandParent:u.expandParent}));return s}function Cn({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 ii(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 Hs(e,t,n){const[o,i,r,l]=typeof e!="string"?ii(e.padding):[0,0,0,0];return n&&typeof n.computedPosition.x<"u"&&typeof n.computedPosition.y<"u"&&typeof n.dimensions.width<"u"&&typeof n.dimensions.height<"u"?[[n.computedPosition.x+l,n.computedPosition.y+o],[n.computedPosition.x+n.dimensions.width-i,n.computedPosition.y+n.dimensions.height-r]]:!1}function Ls(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=Hs(i,e,o);r&&(i=r)}else t(new ge(fe.NODE_EXTENT_INVALID,e.id)),i=n;else if(Array.isArray(i)){const r=o?.computedPosition.x||0,l=o?.computedPosition.y||0;i=[[i[0][0]+r,i[0][1]+l],[i[1][0]+r,i[1][1]+l]]}else if(i!=="parent"&&i?.range&&Array.isArray(i.range)){const[r,l,s,u]=ii(i.padding),c=o?.computedPosition.x||0,d=o?.computedPosition.y||0;i=[[i.range[0][0]+c+u,i.range[0][1]+d+r],[i.range[1][0]+c-l,i.range[1][1]+d-s]]}return i==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:i}function Fs({width:e,height:t},n){return[n[0],[n[1][0]-(e||0),n[1][1]-(t||0)]]}function kn(e,t,n,o,i){const r=Fs(e.dimensions,Ls(e,n,o,i)),l=Ho(t,r);return{position:{x:l.x-(i?.computedPosition.x||0),y:l.y-(i?.computedPosition.y||0)},computedPosition:l}}function je(e,t,n=R.Left,o=!1){const i=(t?.x??0)+e.computedPosition.x,r=(t?.y??0)+e.computedPosition.y,{width:l,height:s}=t??Us(e);if(o)return{x:i+l/2,y:r+s/2};switch(t?.position??n){case R.Top:return{x:i+l/2,y:r};case R.Right:return{x:i+l,y:r+s/2};case R.Bottom:return{x:i+l/2,y:r+s};case R.Left:return{x:i,y:r+s/2}}}function ri(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Ys({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:o,targetWidth:i,targetHeight:r,width:l,height:s,viewport:u}){const c={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+i),y2:Math.max(e.y+o,t.y+r)};c.x===c.x2&&(c.x2+=1),c.y===c.y2&&(c.y2+=1);const d=Xo({x:(0-u.x)/u.zoom,y:(0-u.y)/u.zoom,width:l/u.zoom,height:s/u.zoom}),f=Math.max(0,Math.min(d.x2,c.x2)-Math.max(d.x,c.x)),h=Math.max(0,Math.min(d.y2,c.y2)-Math.max(d.y,c.y));return Math.ceil(f*h)>0}function Gs(e,t,n=!1){const o=typeof e.zIndex=="number";let i=o?e.zIndex:0;const r=t(e.source),l=t(e.target);return!r||!l?0:(n&&(i=o?e.zIndex:Math.max(r.computedPosition.z||0,l.computedPosition.z||0)),i)}var fe=(e=>(e.MISSING_STYLES="MISSING_STYLES",e.MISSING_VIEWPORT_DIMENSIONS="MISSING_VIEWPORT_DIMENSIONS",e.NODE_INVALID="NODE_INVALID",e.NODE_NOT_FOUND="NODE_NOT_FOUND",e.NODE_MISSING_PARENT="NODE_MISSING_PARENT",e.NODE_TYPE_MISSING="NODE_TYPE_MISSING",e.NODE_EXTENT_INVALID="NODE_EXTENT_INVALID",e.EDGE_INVALID="EDGE_INVALID",e.EDGE_NOT_FOUND="EDGE_NOT_FOUND",e.EDGE_SOURCE_MISSING="EDGE_SOURCE_MISSING",e.EDGE_TARGET_MISSING="EDGE_TARGET_MISSING",e.EDGE_TYPE_MISSING="EDGE_TYPE_MISSING",e.EDGE_SOURCE_TARGET_SAME="EDGE_SOURCE_TARGET_SAME",e.EDGE_SOURCE_TARGET_MISSING="EDGE_SOURCE_TARGET_MISSING",e.EDGE_ORPHANED="EDGE_ORPHANED",e.USEVUEFLOW_OPTIONS="USEVUEFLOW_OPTIONS",e))(fe||{});const li={MISSING_STYLES:()=>"It seems that you haven't loaded the necessary styles. Please import '@vue-flow/core/dist/style.css' to ensure that the graph is rendered correctly",MISSING_VIEWPORT_DIMENSIONS:()=>"The Vue Flow parent container needs a width and a height to render the graph",NODE_INVALID:e=>`Node is invalid
|
|
7
7
|
Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found
|
|
8
8
|
Node: ${e}`,NODE_MISSING_PARENT:(e,t)=>`Node is missing a parent
|
|
9
9
|
Node: ${e}
|
|
@@ -23,5 +23,5 @@ Edge: ${e}
|
|
|
23
23
|
Source: ${t}
|
|
24
24
|
Target: ${n}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
|
|
25
25
|
Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found
|
|
26
|
-
Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead"};class ge extends Error{constructor(t,...n){var o;super((o=li[t])==null?void 0:o.call(li,...n)),this.name="VueFlowError",this.code=t,this.args=n}}function Mn(e){return"clientX"in e}function Xs(e){return"sourceEvent"in e}function Se(e,t){const n=Mn(e);let o,i;return n?(o=e.clientX,i=e.clientY):"touches"in e&&e.touches.length>0?(o=e.touches[0].clientX,i=e.touches[0].clientY):"changedTouches"in e&&e.changedTouches.length>0?(o=e.changedTouches[0].clientX,i=e.changedTouches[0].clientY):(o=0,i=0),{x:o-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}}const Ft=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Us(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 Yt(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}const Zs=()=>!0;function In(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function Ws(e,t,n){const o=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const r of t.values())Rt(i,zt(r))>0&&o.push(r);return o}const Ks=250;function qs(e,t,n,o){var i,r;let l=[],s=Number.POSITIVE_INFINITY;const u=Ws(e,n,t+Ks);for(const c of u){const d=[...((i=c.handleBounds)==null?void 0:i.source)??[],...((r=c.handleBounds)==null?void 0:r.target)??[]];for(const f of d){if(o.nodeId===f.nodeId&&o.type===f.type&&o.id===f.id)continue;const{x:g,y:h}=je(c,f,f.position,!0),x=Math.sqrt((g-e.x)**2+(h-e.y)**2);x>t||(x<s?(l=[{...f,x:g,y:h}],s=x):x===s&&l.push({...f,x:g,y:h}))}}if(!l.length)return null;if(l.length>1){const c=o.type==="source"?"target":"source";return l.find(d=>d.type===c)??l[0]}return l[0]}function ai(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:i,fromType:r,doc:l,lib:s,flowId:u,isValidConnection:c=Zs},d,f,g){const h=r==="target",x=t?l.querySelector(`.${s}-flow__handle[data-id="${u}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:b,y:N}=Se(e),k=l.elementFromPoint(b,N),M=k!=null&&k.classList.contains(`${s}-flow__handle`)?k:x,_={handleDomNode:M,isValid:!1,connection:null,toHandle:null};if(M){const C=si(void 0,M),O=M.getAttribute("data-nodeid"),G=M.getAttribute("data-handleid"),Y=M.classList.contains("connectable"),I=M.classList.contains("connectableend");if(!O||!C)return _;const B={source:h?O:o,sourceHandle:h?G:i,target:h?o:O,targetHandle:h?i:G};_.connection=B;const D=Y&&I&&(n===Pe.Strict?h&&C==="source"||!h&&C==="target":O!==o||G!==i);_.isValid=D&&c(B,{nodes:f,edges:d,sourceNode:g(o),targetNode:g(O)}),_.toHandle=t}return _}function si(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function js(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function Js(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function Qs(e,t,n,o,i,r=!1){var l,s,u;const c=o.get(e);if(!c)return null;const d=i===Pe.Strict?(l=c.handleBounds)==null?void 0:l[t]:[...((s=c.handleBounds)==null?void 0:s.source)??[],...((u=c.handleBounds)==null?void 0:u.target)??[]],f=(n?d==null?void 0:d.find(g=>g.id===n):d==null?void 0:d[0])??null;return f&&r?{...f,...je(c,f,f.position,!0)}:f}const Tn={[R.Left]:R.Right,[R.Right]:R.Left,[R.Top]:R.Bottom,[R.Bottom]:R.Top},eu=["production","prod"];function Gt(e,...t){ui()&&console.warn(`[Vue Flow]: ${e}`,...t)}function ui(){return!eu.includes(process.env.NODE_ENV||"")}function ci(e,t,n,o,i){const r=t.querySelectorAll(`.vue-flow__handle.${e}`);return r!=null&&r.length?Array.from(r).map(l=>{const s=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),type:e,nodeId:i,position:l.getAttribute("data-handlepos"),x:(s.left-n.left)/o,y:(s.top-n.top)/o,...Ht(l)}}):null}function Pn(e,t,n,o,i,r=!1,l){i.value=!1,e.selected?(r||e.selected&&t)&&(o([e]),a.nextTick(()=>{l.blur()})):n([e])}function he(e){return typeof a.unref(e)<"u"}function tu(e,t,n,o){if(!e||!e.source||!e.target)return n(new ge(fe.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let i;return $e(e)?i=e:i={...e,id:Go(e)},i=Fo(i,void 0,o),Vs(i,t)?!1:i}function nu(e,t,n,o,i){if(!t.source||!t.target)return i(new ge(fe.EDGE_INVALID,e.id)),!1;if(!n)return i(new ge(fe.EDGE_NOT_FOUND,e.id)),!1;const{id:r,...l}=e;return{...l,id:o?Go(t):r,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function di(e,t,n){const o={},i=[];for(let r=0;r<e.length;++r){const l=e[r];if(!Fe(l)){n(new ge(fe.NODE_INVALID,l==null?void 0:l.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const s=$s(l,t(l.id),l.parentNode);l.parentNode&&(o[l.parentNode]=!0),i[r]=s}for(const r of i){const l=t(r.parentNode)||i.find(s=>s.id===r.parentNode);r.parentNode&&!l&&n(new ge(fe.NODE_MISSING_PARENT,r.id,r.parentNode)),(r.parentNode||o[r.id])&&(o[r.id]&&(r.isParent=!0),l&&(l.isParent=!0))}return i}function fi(e,t,n,o,i,r){let l=i;const s=o.get(l)||new Map;o.set(l,s.set(n,t)),l=`${i}-${e}`;const u=o.get(l)||new Map;if(o.set(l,u.set(n,t)),r){l=`${i}-${e}-${r}`;const c=o.get(l)||new Map;o.set(l,c.set(n,t))}}function $n(e,t,n){e.clear();for(const o of n){const{source:i,target:r,sourceHandle:l=null,targetHandle:s=null}=o,u={edgeId:o.id,source:i,target:r,sourceHandle:l,targetHandle:s},c=`${i}-${l}--${r}-${s}`,d=`${r}-${s}--${i}-${l}`;fi("source",u,d,e,i,l),fi("target",u,c,e,r,s)}}function hi(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Bn(e,t,n,o,i,r,l,s){const u=[];for(const c of e){const d=$e(c)?c:tu(c,s,i,r);if(!d)continue;const f=n(d.source),g=n(d.target);if(!f||!g){i(new ge(fe.EDGE_SOURCE_TARGET_MISSING,d.id,d.source,d.target));continue}if(!f){i(new ge(fe.EDGE_SOURCE_MISSING,d.id,d.source));continue}if(!g){i(new ge(fe.EDGE_TARGET_MISSING,d.id,d.target));continue}if(t&&!t(d,{edges:s,nodes:l,sourceNode:f,targetNode:g})){i(new ge(fe.EDGE_INVALID,d.id));continue}const h=o(d.id);u.push({...Fo(d,h,r),sourceNode:f,targetNode:g})}return u}const gi=Symbol("vueFlow"),pi=Symbol("nodeId"),mi=Symbol("nodeRef"),ou=Symbol("edgeId"),iu=Symbol("edgeRef"),Xt=Symbol("slots");function yi(e){const{vueFlowRef:t,snapToGrid:n,snapGrid:o,noDragClassName:i,nodes:r,nodeExtent:l,nodeDragThreshold:s,viewport:u,autoPanOnNodeDrag:c,autoPanSpeed:d,nodesDraggable:f,panBy:g,findNode:h,multiSelectionActive:x,nodesSelectionActive:b,selectNodesOnDrag:N,removeSelectedElements:k,addSelectedNodes:M,updateNodePositions:_,emits:C}=de(),{onStart:O,onDrag:G,onStop:Y,onClick:I,el:B,disabled:A,id:D,selectable:E,dragHandle:W}=e,w=a.shallowRef(!1);let P=[],S,$=null,V={x:void 0,y:void 0},H={x:0,y:0},z=null,K=!1,Q=0,oe=!1;const F=au(),X=({x:J,y:ne})=>{V={x:J,y:ne};let ie=!1;if(P=P.map(m=>{const p={x:J-m.distance.x,y:ne-m.distance.y},{computedPosition:v}=kn(m,n.value?Yt(p,o.value):p,C.error,l.value,m.parentNode?h(m.parentNode):void 0);return ie=ie||m.position.x!==v.x||m.position.y!==v.y,m.position=v,m}),!!ie&&(_(P,!0,!0),w.value=!0,z)){const[m,p]=Cn({id:D,dragItems:P,findNode:h});G({event:z,node:m,nodes:p})}},j=()=>{if(!$)return;const[J,ne]=Jo(H,$,d.value);if(J!==0||ne!==0){const ie={x:(V.x??0)-J/u.value.zoom,y:(V.y??0)-ne/u.value.zoom};g({x:J,y:ne})&&X(ie)}Q=requestAnimationFrame(j)},le=(J,ne)=>{K=!0;const ie=h(D);!N.value&&!x.value&&ie&&(ie.selected||k()),ie&&a.toValue(E)&&N.value&&Pn(ie,x.value,M,k,b,!1,ne);const m=F(J.sourceEvent);if(V=m,P=Rs(r.value,f.value,m,h,D),P.length){const[p,v]=Cn({id:D,dragItems:P,findNode:h});O({event:J.sourceEvent,node:p,nodes:v})}},ae=(J,ne)=>{var ie;J.sourceEvent.type==="touchmove"&&J.sourceEvent.touches.length>1||(s.value===0&&le(J,ne),V=F(J.sourceEvent),$=((ie=t.value)==null?void 0:ie.getBoundingClientRect())||null,H=Se(J.sourceEvent,$))},te=(J,ne)=>{const ie=F(J.sourceEvent);if(!oe&&K&&c.value&&(oe=!0,j()),!K){const m=ie.xSnapped-(V.x??0),p=ie.ySnapped-(V.y??0);Math.sqrt(m*m+p*p)>s.value&&le(J,ne)}(V.x!==ie.xSnapped||V.y!==ie.ySnapped)&&P.length&&K&&(z=J.sourceEvent,H=Se(J.sourceEvent,$),X(ie))},ue=J=>{let ne=!1;if(!K&&!w.value&&!x.value){const ie=J.sourceEvent,m=F(ie),p=m.xSnapped-(V.x??0),v=m.ySnapped-(V.y??0),y=Math.sqrt(p*p+v*v);y!==0&&y<=s.value&&(I==null||I(ie),ne=!0)}if(P.length&&!ne){_(P,!1,!1);const[ie,m]=Cn({id:D,dragItems:P,findNode:h});Y({event:J.sourceEvent,node:ie,nodes:m})}P=[],w.value=!1,oe=!1,K=!1,V={x:void 0,y:void 0},cancelAnimationFrame(Q)};return a.watch([()=>a.toValue(A),B],([J,ne],ie,m)=>{if(ne){const p=ye(ne);J||(S=Pl().on("start",v=>ae(v,ne)).on("drag",v=>te(v,ne)).on("end",v=>ue(v)).filter(v=>{const y=v.target,T=a.toValue(W);return!v.button&&(!i.value||!oi(y,`.${i.value}`,ne)&&(!T||oi(y,T,ne)))}),p.call(S)),m(()=>{p.on(".drag",null),S&&(S.on("start",null),S.on("drag",null),S.on("end",null))})}}),w}function ru(){return{doubleClick:L(),click:L(),mouseEnter:L(),mouseMove:L(),mouseLeave:L(),contextMenu:L(),updateStart:L(),update:L(),updateEnd:L()}}function lu(e,t){const n=ru();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 au(){const{viewport:e,snapGrid:t,snapToGrid:n,vueFlowRef:o}=de();return i=>{var r;const l=((r=o.value)==null?void 0:r.getBoundingClientRect())??{left:0,top:0},s=Xs(i)?i.sourceEvent:i,{x:u,y:c}=Se(s,l),d=ht({x:u,y:c},e.value),{x:f,y:g}=n.value?Yt(d,t.value):d;return{xSnapped:f,ySnapped:g,...d}}}function Ut(){return!0}function vi({handleId:e,nodeId:t,type:n,isValidConnection:o,edgeUpdaterType:i,onEdgeUpdate:r,onEdgeUpdateEnd:l}){const{id:s,vueFlowRef:u,connectionMode:c,connectionRadius:d,connectOnClick:f,connectionClickStartHandle:g,nodesConnectable:h,autoPanOnConnect:x,autoPanSpeed:b,findNode:N,panBy:k,startConnection:M,updateConnection:_,endConnection:C,emits:O,viewport:G,edges:Y,nodes:I,isValidConnection:B,nodeLookup:A}=de();let D=null,E=!1,W=null;function w(S){var $;const V=a.toValue(n)==="target",H=Mn(S),z=Lo(S.target);if(H&&S.button===0||!H){let K=function(ee){m=Se(ee,J),X=qs(ht(m,G.value,!1,[1,1]),d.value,A.value,y),p||(v(),p=!0);const re=ai(ee,{handle:X,connectionMode:c.value,fromNodeId:a.toValue(t),fromHandleId:a.toValue(e),fromType:V?"target":"source",isValidConnection:F,doc:z,lib:"vue",flowId:s,nodeLookup:A.value},Y.value,I.value,N);W=re.handleDomNode,D=re.connection,E=Js(!!X,re.isValid);const se={...Z,isValid:E,to:re.toHandle&&E?Sn({x:re.toHandle.x,y:re.toHandle.y},G.value):m,toHandle:re.toHandle,toPosition:E&&re.toHandle?re.toHandle.position:Tn[y.position],toNode:re.toHandle?A.value.get(re.toHandle.nodeId):null};if(!(E&&X&&(Z!=null&&Z.toHandle)&&se.toHandle&&Z.toHandle.type===se.toHandle.type&&Z.toHandle.nodeId===se.toHandle.nodeId&&Z.toHandle.id===se.toHandle.id&&Z.to.x===se.to.x&&Z.to.y===se.to.y)){if(_(X&&E?Sn({x:X.x,y:X.y},G.value):m,re.toHandle,js(!!X,E)),Z=se,!X&&!E&&!W)return In(ie);D&&D.source!==D.target&&W&&(In(ie),ie=W,W.classList.add("connecting","vue-flow__handle-connecting"),W.classList.toggle("valid",!!E),W.classList.toggle("vue-flow__handle-valid",!!E))}},Q=function(ee){(X||W)&&D&&E&&(r?r(ee,D):O.connect(D)),O.connectEnd(ee),i&&(l==null||l(ee)),In(ie),cancelAnimationFrame(j),C(ee),p=!1,E=!1,D=null,W=null,z.removeEventListener("mousemove",K),z.removeEventListener("mouseup",Q),z.removeEventListener("touchmove",K),z.removeEventListener("touchend",Q)};const oe=N(a.toValue(t));let F=a.toValue(o)||B.value||Ut;!F&&oe&&(F=(V?oe.isValidSourcePos:oe.isValidTargetPos)||Ut);let X,j=0;const{x:le,y:ae}=Se(S),te=z==null?void 0:z.elementFromPoint(le,ae),ue=si(a.toValue(i),te),J=($=u.value)==null?void 0:$.getBoundingClientRect();if(!J||!ue)return;const ne=Qs(a.toValue(t),ue,a.toValue(e),A.value,c.value);if(!ne)return;let ie,m=Se(S,J),p=!1;const v=()=>{if(!x.value)return;const[ee,re]=Jo(m,J,b.value);k({x:ee,y:re}),j=requestAnimationFrame(v)},y={...ne,nodeId:a.toValue(t),type:ue,position:ne.position},T=A.value.get(a.toValue(t)),U={inProgress:!0,isValid:null,from:je(T,y,R.Left,!0),fromHandle:y,fromPosition:y.position,fromNode:T,to:m,toHandle:null,toPosition:Tn[y.position],toNode:null};M({nodeId:a.toValue(t),id:a.toValue(e),type:ue,position:(te==null?void 0:te.getAttribute("data-handlepos"))||R.Top,...m},{x:le-J.left,y:ae-J.top}),O.connectStart({event:S,nodeId:a.toValue(t),handleId:a.toValue(e),handleType:ue});let Z=U;z.addEventListener("mousemove",K),z.addEventListener("mouseup",Q),z.addEventListener("touchmove",K),z.addEventListener("touchend",Q)}}function P(S){var $,V;if(!f.value)return;const H=a.toValue(n)==="target";if(!g.value){O.clickConnectStart({event:S,nodeId:a.toValue(t),handleId:a.toValue(e)}),M({nodeId:a.toValue(t),type:a.toValue(n),id:a.toValue(e),position:R.Top,...Se(S)},void 0,!0);return}let z=a.toValue(o)||B.value||Ut;const K=N(a.toValue(t));if(!z&&K&&(z=(H?K.isValidSourcePos:K.isValidTargetPos)||Ut),K&&(typeof K.connectable>"u"?h.value:K.connectable)===!1)return;const Q=Lo(S.target),oe=ai(S,{handle:{nodeId:a.toValue(t),id:a.toValue(e),type:a.toValue(n),position:R.Top,...Se(S)},connectionMode:c.value,fromNodeId:g.value.nodeId,fromHandleId:g.value.id??null,fromType:g.value.type,isValidConnection:z,doc:Q,lib:"vue",flowId:s,nodeLookup:A.value},Y.value,I.value,N),F=(($=oe.connection)==null?void 0:$.source)===((V=oe.connection)==null?void 0:V.target);oe.isValid&&oe.connection&&!F&&O.connect(oe.connection),O.clickConnectEnd(S),C(S,!0)}return{handlePointerDown:w,handleClick:P}}function su(){return a.inject(pi,"")}function wi(e){const t=e??su()??"",n=a.inject(mi,a.ref(null)),{findNode:o,edges:i,emits:r}=de(),l=o(t);return l||r.error(new ge(fe.NODE_NOT_FOUND,t)),{id:t,nodeEl:n,node:l,parentNode:a.computed(()=>o(l.parentNode)),connectedEdges:a.computed(()=>Wo([l],i.value))}}function uu(){return{doubleClick:L(),click:L(),mouseEnter:L(),mouseMove:L(),mouseLeave:L(),contextMenu:L(),dragStart:L(),drag:L(),dragStop:L()}}function cu(e,t){const n=uu();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 _i(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:n,findNode:o,snapGrid:i,snapToGrid:r,nodesDraggable:l,emits:s}=de();return(u,c=!1)=>{const d=r.value?i.value[0]:5,f=r.value?i.value[1]:5,g=c?4:1,h=u.x*d*g,x=u.y*f*g,b=[];for(const N of e.value)if(N.draggable||l&&typeof N.draggable>"u"){const k={x:N.computedPosition.x+h,y:N.computedPosition.y+x},{computedPosition:M}=kn(N,k,s.error,t.value,N.parentNode?o(N.parentNode):void 0);b.push({id:N.id,position:M,from:N.position,distance:{x:u.x,y:u.y},dimensions:N.dimensions})}n(b,!0,!1)}}const Dn=.1,du=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function Ve(){return Gt("Viewport not initialized yet."),Promise.resolve(!1)}const fu={zoomIn:Ve,zoomOut:Ve,zoomTo:Ve,fitView:Ve,setCenter:Ve,fitBounds:Ve,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Ve,setTransform:Ve,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function hu(e){function t(o,i){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((i==null?void 0:i.interpolate)==="linear"?it:Mt).scaleBy(Vn(e.d3Selection,i==null?void 0:i.duration,i==null?void 0:i.ease,()=>{r(!0)}),o):r(!1)})}function n(o,i,r,l){return new Promise(s=>{var u;const{x:c,y:d}=Ho({x:-o,y:-i},e.translateExtent),f=Ke.translate(-c,-d).scale(r);e.d3Selection&&e.d3Zoom?(u=e.d3Zoom)==null||u.interpolate((l==null?void 0:l.interpolate)==="linear"?it:Mt).transform(Vn(e.d3Selection,l==null?void 0:l.duration,l==null?void 0:l.ease,()=>{s(!0)}),f):s(!1)})}return a.computed(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:i=>t(1.2,i),zoomOut:i=>t(1/1.2,i),zoomTo:(i,r)=>new Promise(l=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((r==null?void 0:r.interpolate)==="linear"?it:Mt).scaleTo(Vn(e.d3Selection,r==null?void 0:r.duration,r==null?void 0:r.ease,()=>{l(!0)}),i):l(!1)}),setViewport:(i,r)=>n(i.x,i.y,i.zoom,r),setTransform:(i,r)=>n(i.x,i.y,i.zoom,r),getViewport:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),getTransform:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),fitView:(i={padding:Dn,includeHiddenNodes:!1,duration:0})=>{var r,l;const s=[];for(const g of e.nodes)g.dimensions.width&&g.dimensions.height&&((i==null?void 0:i.includeHiddenNodes)||!g.hidden)&&(!((r=i.nodes)!=null&&r.length)||(l=i.nodes)!=null&&l.length&&i.nodes.includes(g.id))&&s.push(g);if(!s.length)return Promise.resolve(!1);const u=Uo(s),{x:c,y:d,zoom:f}=Ko(u,e.dimensions.width,e.dimensions.height,i.minZoom??e.minZoom,i.maxZoom??e.maxZoom,i.padding??Dn,i.offset);return n(c,d,f,i)},setCenter:(i,r,l)=>{const s=typeof(l==null?void 0:l.zoom)<"u"?l.zoom:e.maxZoom,u=e.dimensions.width/2-i*s,c=e.dimensions.height/2-r*s;return n(u,c,s,l)},fitBounds:(i,r={padding:Dn})=>{const{x:l,y:s,zoom:u}=Ko(i,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding);return n(l,s,u,r)},project:i=>ht(i,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:i=>{if(e.vueFlowRef){const{x:r,y:l}=e.vueFlowRef.getBoundingClientRect(),s={x:i.x-r,y:i.y-l};return ht(s,e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:i=>{if(e.vueFlowRef){const{x:r,y:l}=e.vueFlowRef.getBoundingClientRect(),s={x:i.x+r,y:i.y+l};return Sn(s,e.viewport)}return{x:0,y:0}}}:fu)}function Vn(e,t=0,n=du,o=()=>{}){const i=typeof t=="number"&&t>0;return i||o(),i?e.transition().duration(t).ease(n).on("end",o):e}function gu(e,t,n){const o=a.effectScope(!0);return o.run(()=>{const i=()=>{o.run(()=>{let b,N,k=!!(n.nodes.value.length||n.edges.value.length);b=Ge([e.modelValue,()=>{var M,_;return(_=(M=e.modelValue)==null?void 0:M.value)==null?void 0:_.length}],([M])=>{M&&Array.isArray(M)&&(N==null||N.pause(),n.setElements(M),!N&&!k&&M.length?k=!0:N==null||N.resume())}),N=Ge([n.nodes,n.edges,()=>n.edges.value.length,()=>n.nodes.value.length],([M,_])=>{var C;(C=e.modelValue)!=null&&C.value&&Array.isArray(e.modelValue.value)&&(b==null||b.pause(),e.modelValue.value=[...M,..._],a.nextTick(()=>{b==null||b.resume()}))},{immediate:k}),a.onScopeDispose(()=>{b==null||b.stop(),N==null||N.stop()})})},r=()=>{o.run(()=>{let b,N,k=!!n.nodes.value.length;b=Ge([e.nodes,()=>{var M,_;return(_=(M=e.nodes)==null?void 0:M.value)==null?void 0:_.length}],([M])=>{M&&Array.isArray(M)&&(N==null||N.pause(),n.setNodes(M),!N&&!k&&M.length?k=!0:N==null||N.resume())}),N=Ge([n.nodes,()=>n.nodes.value.length],([M])=>{var _;(_=e.nodes)!=null&&_.value&&Array.isArray(e.nodes.value)&&(b==null||b.pause(),e.nodes.value=[...M],a.nextTick(()=>{b==null||b.resume()}))},{immediate:k}),a.onScopeDispose(()=>{b==null||b.stop(),N==null||N.stop()})})},l=()=>{o.run(()=>{let b,N,k=!!n.edges.value.length;b=Ge([e.edges,()=>{var M,_;return(_=(M=e.edges)==null?void 0:M.value)==null?void 0:_.length}],([M])=>{M&&Array.isArray(M)&&(N==null||N.pause(),n.setEdges(M),!N&&!k&&M.length?k=!0:N==null||N.resume())}),N=Ge([n.edges,()=>n.edges.value.length],([M])=>{var _;(_=e.edges)!=null&&_.value&&Array.isArray(e.edges.value)&&(b==null||b.pause(),e.edges.value=[...M],a.nextTick(()=>{b==null||b.resume()}))},{immediate:k}),a.onScopeDispose(()=>{b==null||b.stop(),N==null||N.stop()})})},s=()=>{o.run(()=>{a.watch(()=>t.maxZoom,()=>{t.maxZoom&&he(t.maxZoom)&&n.setMaxZoom(t.maxZoom)},{immediate:!0})})},u=()=>{o.run(()=>{a.watch(()=>t.minZoom,()=>{t.minZoom&&he(t.minZoom)&&n.setMinZoom(t.minZoom)},{immediate:!0})})},c=()=>{o.run(()=>{a.watch(()=>t.translateExtent,()=>{t.translateExtent&&he(t.translateExtent)&&n.setTranslateExtent(t.translateExtent)},{immediate:!0})})},d=()=>{o.run(()=>{a.watch(()=>t.nodeExtent,()=>{t.nodeExtent&&he(t.nodeExtent)&&n.setNodeExtent(t.nodeExtent)},{immediate:!0})})},f=()=>{o.run(()=>{a.watch(()=>t.applyDefault,()=>{he(t.applyDefault)&&(n.applyDefault.value=t.applyDefault)},{immediate:!0})})},g=()=>{o.run(()=>{const b=async N=>{let k=N;typeof t.autoConnect=="function"&&(k=await t.autoConnect(N)),k!==!1&&n.addEdges([k])};a.watch(()=>t.autoConnect,()=>{he(t.autoConnect)&&(n.autoConnect.value=t.autoConnect)},{immediate:!0}),a.watch(n.autoConnect,(N,k,M)=>{N?n.onConnect(b):n.hooks.value.connect.off(b),M(()=>{n.hooks.value.connect.off(b)})},{immediate:!0})})},h=()=>{const b=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const N of Object.keys(t)){const k=N;if(!b.includes(k)){const M=a.toRef(()=>t[k]),_=n[k];a.isRef(_)&&o.run(()=>{a.watch(M,C=>{he(C)&&(_.value=C)},{immediate:!0})})}}};(()=>{i(),r(),l(),u(),s(),c(),d(),f(),g(),h()})()}),()=>o.stop()}function pu(){return{edgesChange:L(),nodesChange:L(),nodeDoubleClick:L(),nodeClick:L(),nodeMouseEnter:L(),nodeMouseMove:L(),nodeMouseLeave:L(),nodeContextMenu:L(),nodeDragStart:L(),nodeDrag:L(),nodeDragStop:L(),nodesInitialized:L(),miniMapNodeClick:L(),miniMapNodeDoubleClick:L(),miniMapNodeMouseEnter:L(),miniMapNodeMouseMove:L(),miniMapNodeMouseLeave:L(),connect:L(),connectStart:L(),connectEnd:L(),clickConnectStart:L(),clickConnectEnd:L(),paneReady:L(),init:L(),move:L(),moveStart:L(),moveEnd:L(),selectionDragStart:L(),selectionDrag:L(),selectionDragStop:L(),selectionContextMenu:L(),selectionStart:L(),selectionEnd:L(),viewportChangeStart:L(),viewportChange:L(),viewportChangeEnd:L(),paneScroll:L(),paneClick:L(),paneContextMenu:L(),paneMouseEnter:L(),paneMouseMove:L(),paneMouseLeave:L(),edgeContextMenu:L(),edgeMouseEnter:L(),edgeMouseMove:L(),edgeMouseLeave:L(),edgeDoubleClick:L(),edgeClick:L(),edgeUpdateStart:L(),edgeUpdate:L(),edgeUpdateEnd:L(),updateNodeInternals:L(),error:L(e=>Gt(e.message))}}function mu(e,t){a.onBeforeMount(()=>{for(const[n,o]of Object.entries(t.value)){const i=r=>{e(n,r)};o.fns.add(i),mt(()=>{o.off(i)})}})}function Ei(){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:En.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:ct.Free,paneClickDistance:0,panOnDrag:!0,edgeUpdaterRadius:10,onlyRenderVisibleElements:!1,defaultViewport:{x:0,y:0,zoom:1},nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,defaultMarkerColor:"#b1b1b7",connectionLineStyle:{},connectionLineType:null,connectionLineOptions:{type:He.Bezier,style:{}},connectionMode:Pe.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:Ft()?"Meta":"Control",zoomActivationKeyCode:Ft()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:pu(),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 yu=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function vu(e,t,n){const o=hu(e),i=m=>{const p=m??[];e.hooks.updateNodeInternals.trigger(p)},r=m=>Ds(m,e.nodes,e.edges),l=m=>Bs(m,e.nodes,e.edges),s=m=>Wo(m,e.edges),u=({id:m,type:p,nodeId:v})=>{var y;return Array.from(((y=e.connectionLookup.get(`${v}-${p}-${m??null}`))==null?void 0:y.values())??[])},c=m=>{if(m)return t.value.get(m)},d=m=>{if(m)return n.value.get(m)},f=(m,p,v)=>{var y,T;const q=[];for(const U of m){const Z={id:U.id,type:"position",dragging:v,from:U.from};if(p&&(Z.position=U.position,U.parentNode)){const ee=c(U.parentNode);Z.position={x:Z.position.x-(((y=ee==null?void 0:ee.computedPosition)==null?void 0:y.x)??0),y:Z.position.y-(((T=ee==null?void 0:ee.computedPosition)==null?void 0:T.y)??0)}}q.push(Z)}q!=null&&q.length&&e.hooks.nodesChange.trigger(q)},g=m=>{if(!e.vueFlowRef)return;const p=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!p)return;const v=window.getComputedStyle(p),{m22:y}=new window.DOMMatrixReadOnly(v.transform),T=[];for(const q of m){const U=q,Z=c(U.id);if(Z){const ee=Ht(U.nodeElement);if(!!(ee.width&&ee.height&&(Z.dimensions.width!==ee.width||Z.dimensions.height!==ee.height||U.forceUpdate))){const se=U.nodeElement.getBoundingClientRect();Z.dimensions=ee,Z.handleBounds.source=ci("source",U.nodeElement,se,y,Z.id),Z.handleBounds.target=ci("target",U.nodeElement,se,y,Z.id),T.push({id:Z.id,type:"dimensions",dimensions:ee})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&o.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),T.length&&e.hooks.nodesChange.trigger(T)},h=(m,p)=>{const v=new Set,y=new Set;for(const U of m)Fe(U)?v.add(U.id):$e(U)&&y.add(U.id);const T=De(t.value,v,!0),q=De(n.value,y);if(e.multiSelectionActive){for(const U of v)T.push(Be(U,p));for(const U of y)q.push(Be(U,p))}T.length&&e.hooks.nodesChange.trigger(T),q.length&&e.hooks.edgesChange.trigger(q)},x=m=>{if(e.multiSelectionActive){const p=m.map(v=>Be(v.id,!0));e.hooks.nodesChange.trigger(p);return}e.hooks.nodesChange.trigger(De(t.value,new Set(m.map(p=>p.id)),!0)),e.hooks.edgesChange.trigger(De(n.value))},b=m=>{if(e.multiSelectionActive){const p=m.map(v=>Be(v.id,!0));e.hooks.edgesChange.trigger(p);return}e.hooks.edgesChange.trigger(De(n.value,new Set(m.map(p=>p.id)))),e.hooks.nodesChange.trigger(De(t.value,new Set,!0))},N=m=>{h(m,!0)},k=m=>{const v=(m||e.nodes).map(y=>(y.selected=!1,Be(y.id,!1)));e.hooks.nodesChange.trigger(v)},M=m=>{const v=(m||e.edges).map(y=>(y.selected=!1,Be(y.id,!1)));e.hooks.edgesChange.trigger(v)},_=m=>{if(!m||!m.length)return h([],!1);const p=m.reduce((v,y)=>{const T=Be(y.id,!1);return Fe(y)?v.nodes.push(T):v.edges.push(T),v},{nodes:[],edges:[]});p.nodes.length&&e.hooks.nodesChange.trigger(p.nodes),p.edges.length&&e.hooks.edgesChange.trigger(p.edges)},C=m=>{var p;(p=e.d3Zoom)==null||p.scaleExtent([m,e.maxZoom]),e.minZoom=m},O=m=>{var p;(p=e.d3Zoom)==null||p.scaleExtent([e.minZoom,m]),e.maxZoom=m},G=m=>{var p;(p=e.d3Zoom)==null||p.translateExtent(m),e.translateExtent=m},Y=m=>{e.nodeExtent=m,i()},I=m=>{var p;(p=e.d3Zoom)==null||p.clickDistance(m)},B=m=>{e.nodesDraggable=m,e.nodesConnectable=m,e.elementsSelectable=m},A=m=>{const p=m instanceof Function?m(e.nodes):m;!e.initialized&&!p.length||(e.nodes=di(p,c,e.hooks.error.trigger))},D=m=>{const p=m instanceof Function?m(e.edges):m;if(!e.initialized&&!p.length)return;const v=Bn(p,e.isValidConnection,c,d,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);$n(e.connectionLookup,n.value,v),e.edges=v},E=m=>{const p=m instanceof Function?m([...e.nodes,...e.edges]):m;!e.initialized&&!p.length||(A(p.filter(Fe)),D(p.filter($e)))},W=m=>{let p=m instanceof Function?m(e.nodes):m;p=Array.isArray(p)?p:[p];const v=di(p,c,e.hooks.error.trigger),y=[];for(const T of v)y.push(ei(T));y.length&&e.hooks.nodesChange.trigger(y)},w=m=>{let p=m instanceof Function?m(e.edges):m;p=Array.isArray(p)?p:[p];const v=Bn(p,e.isValidConnection,c,d,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),y=[];for(const T of v)y.push(ei(T));y.length&&e.hooks.edgesChange.trigger(y)},P=(m,p=!0,v=!1)=>{const y=m instanceof Function?m(e.nodes):m,T=Array.isArray(y)?y:[y],q=[],U=[];function Z(re){const se=s(re);for(const ce of se)(!he(ce.deletable)||ce.deletable)&&U.push(ni(ce.id,ce.source,ce.target,ce.sourceHandle,ce.targetHandle))}function ee(re){const se=[];for(const ce of e.nodes)ce.parentNode===re&&se.push(ce);if(se.length){for(const ce of se)q.push(ti(ce.id));p&&Z(se);for(const ce of se)ee(ce.id)}}for(const re of T){const se=typeof re=="string"?c(re):re;se&&(he(se.deletable)&&!se.deletable||(q.push(ti(se.id)),p&&Z([se]),v&&ee(se.id)))}U.length&&e.hooks.edgesChange.trigger(U),q.length&&e.hooks.nodesChange.trigger(q)},S=m=>{const p=m instanceof Function?m(e.edges):m,v=Array.isArray(p)?p:[p],y=[];for(const T of v){const q=typeof T=="string"?d(T):T;q&&(he(q.deletable)&&!q.deletable||y.push(ni(typeof T=="string"?T:T.id,q.source,q.target,q.sourceHandle,q.targetHandle)))}e.hooks.edgesChange.trigger(y)},$=(m,p,v=!0)=>{const y=d(m.id);if(!y)return!1;const T=e.edges.indexOf(y),q=nu(m,p,y,v,e.hooks.error.trigger);if(q){const[U]=Bn([q],e.isValidConnection,c,d,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((Z,ee)=>ee===T?U:Z),$n(e.connectionLookup,n.value,[U]),U}return!1},V=(m,p,v={replace:!1})=>{const y=d(m);if(!y)return;const T=typeof p=="function"?p(y):p;y.data=v.replace?T:{...y.data,...T}},H=m=>Qo(m,e.nodes),z=m=>{const p=Qo(m,e.edges);return $n(e.connectionLookup,n.value,p),p},K=(m,p,v={replace:!1})=>{const y=c(m);if(!y)return;const T=typeof p=="function"?p(y):p;v.replace?e.nodes.splice(e.nodes.indexOf(y),1,T):Object.assign(y,T)},Q=(m,p,v={replace:!1})=>{const y=c(m);if(!y)return;const T=typeof p=="function"?p(y):p;y.data=v.replace?T:{...y.data,...T}},oe=(m,p,v=!1)=>{v?e.connectionClickStartHandle=m:e.connectionStartHandle=m,e.connectionEndHandle=null,e.connectionStatus=null,p&&(e.connectionPosition=p)},F=(m,p=null,v=null)=>{e.connectionStartHandle&&(e.connectionPosition=m,e.connectionEndHandle=p,e.connectionStatus=v)},X=(m,p)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,p?e.connectionClickStartHandle=null:e.connectionStartHandle=null},j=m=>{const p=Ps(m),v=p?null:ft(m)?m:c(m.id);return!p&&!v?[null,null,p]:[p?m:zt(v),v,p]},le=(m,p=!0,v=e.nodes)=>{const[y,T,q]=j(m);if(!y)return[];const U=[];for(const Z of v||e.nodes){if(!q&&(Z.id===T.id||!Z.computedPosition))continue;const ee=zt(Z),re=Rt(ee,y);(p&&re>0||re>=Number(y.width)*Number(y.height))&&U.push(Z)}return U},ae=(m,p,v=!0)=>{const[y]=j(m);if(!y)return!1;const T=Rt(y,p);return v&&T>0||T>=Number(y.width)*Number(y.height)},te=m=>{const{viewport:p,dimensions:v,d3Zoom:y,d3Selection:T,translateExtent:q}=e;if(!y||!T||!m.x&&!m.y)return!1;const U=Ke.translate(p.x+m.x,p.y+m.y).scale(p.zoom),Z=[[0,0],[v.width,v.height]],ee=y.constrain()(U,Z,q),re=e.viewport.x!==ee.x||e.viewport.y!==ee.y||e.viewport.zoom!==ee.k;return y.transform(T,ee),re},ue=m=>{const p=m instanceof Function?m(e):m,v=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];he(p.defaultEdgeOptions)&&(e.defaultEdgeOptions=p.defaultEdgeOptions);const y=p.modelValue||p.nodes||p.edges?[]:void 0;y&&(p.modelValue&&y.push(...p.modelValue),p.nodes&&y.push(...p.nodes),p.edges&&y.push(...p.edges),E(y));const T=()=>{he(p.maxZoom)&&O(p.maxZoom),he(p.minZoom)&&C(p.minZoom),he(p.translateExtent)&&G(p.translateExtent)};for(const q of Object.keys(p)){const U=q,Z=p[U];![...yu,...v].includes(U)&&he(Z)&&(e[U]=Z)}Qt(()=>e.d3Zoom).not.toBeNull().then(T),e.initialized||(e.initialized=!0)};return{updateNodePositions:f,updateNodeDimensions:g,setElements:E,setNodes:A,setEdges:D,addNodes:W,addEdges:w,removeNodes:P,removeEdges:S,findNode:c,findEdge:d,updateEdge:$,updateEdgeData:V,updateNode:K,updateNodeData:Q,applyEdgeChanges:z,applyNodeChanges:H,addSelectedElements:N,addSelectedNodes:x,addSelectedEdges:b,setMinZoom:C,setMaxZoom:O,setTranslateExtent:G,setNodeExtent:Y,setPaneClickDistance:I,removeSelectedElements:_,removeSelectedNodes:k,removeSelectedEdges:M,startConnection:oe,updateConnection:F,endConnection:X,setInteractive:B,setState:ue,getIntersectingNodes:le,getIncomers:r,getOutgoers:l,getConnectedEdges:s,getHandleConnections:u,isNodeIntersecting:ae,panBy:te,fitView:m=>o.value.fitView(m),zoomIn:m=>o.value.zoomIn(m),zoomOut:m=>o.value.zoomOut(m),zoomTo:(m,p)=>o.value.zoomTo(m,p),setViewport:(m,p)=>o.value.setViewport(m,p),setTransform:(m,p)=>o.value.setTransform(m,p),getViewport:()=>o.value.getViewport(),getTransform:()=>o.value.getTransform(),setCenter:(m,p,v)=>o.value.setCenter(m,p,v),fitBounds:(m,p)=>o.value.fitBounds(m,p),project:m=>o.value.project(m),screenToFlowCoordinate:m=>o.value.screenToFlowCoordinate(m),flowToScreenCoordinate:m=>o.value.flowToScreenCoordinate(m),toObject:()=>{const m=[],p=[];for(const v of e.nodes){const{computedPosition:y,handleBounds:T,selected:q,dimensions:U,isParent:Z,resizing:ee,dragging:re,events:se,...ce}=v;m.push(ce)}for(const v of e.edges){const{selected:y,sourceNode:T,targetNode:q,events:U,...Z}=v;p.push(Z)}return JSON.parse(JSON.stringify({nodes:m,edges:p,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:m=>new Promise(p=>{const{nodes:v,edges:y,position:T,zoom:q,viewport:U}=m;if(v&&A(v),y&&D(y),U!=null&&U.x&&(U!=null&&U.y)||T){const Z=(U==null?void 0:U.x)||T[0],ee=(U==null?void 0:U.y)||T[1],re=(U==null?void 0:U.zoom)||q||e.viewport.zoom;return Qt(()=>o.value.viewportInitialized).toBe(!0).then(()=>{o.value.setViewport({x:Z,y:ee,zoom:re}).then(()=>{p(!0)})})}else p(!0)}),updateNodeInternals:i,viewportHelper:o,$reset:()=>{const m=Ei();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const p=Ke.translate(m.defaultViewport.x??0,m.defaultViewport.y??0).scale(Le(m.defaultViewport.zoom??1,m.minZoom,m.maxZoom)),v=e.viewportRef.getBoundingClientRect(),y=[[0,0],[v.width,v.height]],T=e.d3Zoom.constrain()(p,y,m.translateExtent);e.d3Zoom.transform(e.d3Selection,T)}ue(m)},$destroy:()=>{}}}const wu=["data-id","data-handleid","data-nodeid","data-handlepos"],_u={name:"Handle",compatConfig:{MODE:3}},Je=a.defineComponent({..._u,props:{id:{default:null},type:{},position:{default:()=>R.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(e,{expose:t}){const n=a.createPropsRestProxy(e,["position","connectable","connectableStart","connectableEnd","id"]),o=a.toRef(()=>n.type??"source"),i=a.toRef(()=>n.isValidConnection??null),{id:r,connectionStartHandle:l,connectionClickStartHandle:s,connectionEndHandle:u,vueFlowRef:c,nodesConnectable:d,noDragClassName:f,noPanClassName:g}=de(),{id:h,node:x,nodeEl:b,connectedEdges:N}=wi(),k=a.ref(),M=a.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),_=a.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),C=a.toRef(()=>{var D,E,W,w,P,S;return((D=l.value)==null?void 0:D.nodeId)===h&&((E=l.value)==null?void 0:E.id)===e.id&&((W=l.value)==null?void 0:W.type)===o.value||((w=u.value)==null?void 0:w.nodeId)===h&&((P=u.value)==null?void 0:P.id)===e.id&&((S=u.value)==null?void 0:S.type)===o.value}),O=a.toRef(()=>{var D,E,W;return((D=s.value)==null?void 0:D.nodeId)===h&&((E=s.value)==null?void 0:E.id)===e.id&&((W=s.value)==null?void 0:W.type)===o.value}),{handlePointerDown:G,handleClick:Y}=vi({nodeId:h,handleId:e.id,isValidConnection:i,type:o}),I=a.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!N.value.some(D=>{const E=D[`${o.value}Handle`];return D[o.value]!==h?!1:E?E===e.id:!0}):typeof e.connectable=="number"?N.value.filter(D=>{const E=D[`${o.value}Handle`];return D[o.value]!==h?!1:E?E===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(x,N.value):he(e.connectable)?e.connectable:d.value);a.onMounted(()=>{var D;if(!x.dimensions.width||!x.dimensions.height)return;const E=(D=x.handleBounds[o.value])==null?void 0:D.find(H=>H.id===e.id);if(!c.value||E)return;const W=c.value.querySelector(".vue-flow__transformationpane");if(!b.value||!k.value||!W||!e.id)return;const w=b.value.getBoundingClientRect(),P=k.value.getBoundingClientRect(),S=window.getComputedStyle(W),{m22:$}=new window.DOMMatrixReadOnly(S.transform),V={id:e.id,position:e.position,x:(P.left-w.left)/$,y:(P.top-w.top)/$,type:o.value,nodeId:h,...Ht(k.value)};x.handleBounds[o.value]=[...x.handleBounds[o.value]??[],V]});function B(D){const E=Mn(D);I.value&&M.value&&(E&&D.button===0||!E)&&G(D)}function A(D){!h||!s.value&&!M.value||I.value&&Y(D)}return t({handleClick:Y,handlePointerDown:G,onClick:A,onPointerDown:B}),(D,E)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"handle",ref:k,"data-id":`${a.unref(r)}-${a.unref(h)}-${e.id}-${o.value}`,"data-handleid":e.id,"data-nodeid":a.unref(h),"data-handlepos":D.position,class:a.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${D.position}`,`vue-flow__handle-${e.id}`,a.unref(f),a.unref(g),o.value,{connectable:I.value,connecting:O.value,connectablestart:M.value,connectableend:_.value,connectionindicator:I.value&&(M.value&&!C.value||_.value&&C.value)}]]),onMousedown:B,onTouchstartPassive:B,onClick:A},[a.renderSlot(D.$slots,"default",{id:D.id})],42,wu))}}),Zt=function({sourcePosition:e=R.Bottom,targetPosition:t=R.Top,label:n,connectable:o=!0,isValidTargetPos:i,isValidSourcePos:r,data:l}){const s=l.label??n;return[a.h(Je,{type:"target",position:t,connectable:o,isValidConnection:i}),typeof s!="string"&&s?a.h(s):a.h(a.Fragment,[s]),a.h(Je,{type:"source",position:e,connectable:o,isValidConnection:r})]};Zt.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],Zt.inheritAttrs=!1,Zt.compatConfig={MODE:3};const Eu=Zt,Wt=function({targetPosition:e=R.Top,label:t,connectable:n=!0,isValidTargetPos:o,data:i}){const r=i.label??t;return[a.h(Je,{type:"target",position:e,connectable:n,isValidConnection:o}),typeof r!="string"&&r?a.h(r):a.h(a.Fragment,[r])]};Wt.props=["targetPosition","label","isValidTargetPos","connectable","data"],Wt.inheritAttrs=!1,Wt.compatConfig={MODE:3};const bu=Wt,Kt=function({sourcePosition:e=R.Bottom,label:t,connectable:n=!0,isValidSourcePos:o,data:i}){const r=i.label??t;return[typeof r!="string"&&r?a.h(r):a.h(a.Fragment,[r]),a.h(Je,{type:"source",position:e,connectable:n,isValidConnection:o})]};Kt.props=["sourcePosition","label","isValidSourcePos","connectable","data"],Kt.inheritAttrs=!1,Kt.compatConfig={MODE:3};const xu=Kt,Su=["transform"],Nu=["width","height","x","y","rx","ry"],Cu=["y"],ku={name:"EdgeText",compatConfig:{MODE:3}},Mu=a.defineComponent({...ku,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const t=a.ref({x:0,y:0,width:0,height:0}),n=a.ref(null),o=a.computed(()=>`translate(${e.x-t.value.width/2} ${e.y-t.value.height/2})`);a.onMounted(i),a.watch([()=>e.x,()=>e.y,n,()=>e.label],i);function i(){if(!n.value)return;const r=n.value.getBBox();(r.width!==t.value.width||r.height!==t.value.height)&&(t.value=r)}return(r,l)=>(a.openBlock(),a.createElementBlock("g",{transform:o.value,class:"vue-flow__edge-textwrapper"},[r.labelShowBg?(a.openBlock(),a.createElementBlock("rect",{key:0,class:"vue-flow__edge-textbg",width:`${t.value.width+2*r.labelBgPadding[0]}px`,height:`${t.value.height+2*r.labelBgPadding[1]}px`,x:-r.labelBgPadding[0],y:-r.labelBgPadding[1],style:a.normalizeStyle(r.labelBgStyle),rx:r.labelBgBorderRadius,ry:r.labelBgBorderRadius},null,12,Nu)):a.createCommentVNode("",!0),a.createElementVNode("text",a.mergeProps(r.$attrs,{ref_key:"el",ref:n,class:"vue-flow__edge-text",y:t.value.height/2,dy:"0.3em",style:r.labelStyle}),[a.renderSlot(r.$slots,"default",{},()=>[typeof r.label!="string"?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(r.label),{key:0})):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[a.createTextVNode(a.toDisplayString(r.label),1)],64))])],16,Cu)],8,Su))}}),Iu=["id","d","marker-end","marker-start"],Tu=["d","stroke-width"],Pu={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},qt=a.defineComponent({...Pu,props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:t}){const n=a.ref(null),o=a.ref(null),i=a.ref(null),r=a.useAttrs();return t({pathEl:n,interactionEl:o,labelEl:i}),(l,s)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("path",a.mergeProps(a.unref(r),{id:l.id,ref_key:"pathEl",ref:n,d:l.path,class:"vue-flow__edge-path","marker-end":l.markerEnd,"marker-start":l.markerStart}),null,16,Iu),l.interactionWidth?(a.openBlock(),a.createElementBlock("path",{key:0,ref_key:"interactionEl",ref:o,fill:"none",d:l.path,"stroke-width":l.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,Tu)):a.createCommentVNode("",!0),l.label&&l.labelX&&l.labelY?(a.openBlock(),a.createBlock(Mu,{key:1,ref_key:"labelEl",ref:i,x:l.labelX,y:l.labelY,label:l.label,"label-show-bg":l.labelShowBg,"label-bg-style":l.labelBgStyle,"label-bg-padding":l.labelBgPadding,"label-bg-border-radius":l.labelBgBorderRadius,"label-style":l.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):a.createCommentVNode("",!0)],64))}});function bi({sourceX:e,sourceY:t,targetX:n,targetY:o}){const i=Math.abs(n-e)/2,r=n<e?n+i:n-i,l=Math.abs(o-t)/2,s=o<t?o+l:o-l;return[r,s,i,l]}function xi({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:i,sourceControlY:r,targetControlX:l,targetControlY:s}){const u=e*.125+i*.375+l*.375+n*.125,c=t*.125+r*.375+s*.375+o*.125,d=Math.abs(u-e),f=Math.abs(c-t);return[u,c,d,f]}function jt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Si({pos:e,x1:t,y1:n,x2:o,y2:i,c:r}){let l,s;switch(e){case R.Left:l=t-jt(t-o,r),s=n;break;case R.Right:l=t+jt(o-t,r),s=n;break;case R.Top:l=t,s=n-jt(n-i,r);break;case R.Bottom:l=t,s=n+jt(i-n,r);break}return[l,s]}function An(e){const{sourceX:t,sourceY:n,sourcePosition:o=R.Bottom,targetX:i,targetY:r,targetPosition:l=R.Top,curvature:s=.25}=e,[u,c]=Si({pos:o,x1:t,y1:n,x2:i,y2:r,c:s}),[d,f]=Si({pos:l,x1:i,y1:r,x2:t,y2:n,c:s}),[g,h,x,b]=xi({sourceX:t,sourceY:n,targetX:i,targetY:r,sourceControlX:u,sourceControlY:c,targetControlX:d,targetControlY:f});return[`M${t},${n} C${u},${c} ${d},${f} ${i},${r}`,g,h,x,b]}function Ni({pos:e,x1:t,y1:n,x2:o,y2:i}){let r,l;switch(e){case R.Left:case R.Right:r=.5*(t+o),l=n;break;case R.Top:case R.Bottom:r=t,l=.5*(n+i);break}return[r,l]}function Ci(e){const{sourceX:t,sourceY:n,sourcePosition:o=R.Bottom,targetX:i,targetY:r,targetPosition:l=R.Top}=e,[s,u]=Ni({pos:o,x1:t,y1:n,x2:i,y2:r}),[c,d]=Ni({pos:l,x1:i,y1:r,x2:t,y2:n}),[f,g,h,x]=xi({sourceX:t,sourceY:n,targetX:i,targetY:r,sourceControlX:s,sourceControlY:u,targetControlX:c,targetControlY:d});return[`M${t},${n} C${s},${u} ${c},${d} ${i},${r}`,f,g,h,x]}const ki={[R.Left]:{x:-1,y:0},[R.Right]:{x:1,y:0},[R.Top]:{x:0,y:-1},[R.Bottom]:{x:0,y:1}};function $u({source:e,sourcePosition:t=R.Bottom,target:n}){return t===R.Left||t===R.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1}}function Mi(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function Bu({source:e,sourcePosition:t=R.Bottom,target:n,targetPosition:o=R.Top,center:i,offset:r}){const l=ki[t],s=ki[o],u={x:e.x+l.x*r,y:e.y+l.y*r},c={x:n.x+s.x*r,y:n.y+s.y*r},d=$u({source:u,sourcePosition:t,target:c}),f=d.x!==0?"x":"y",g=d[f];let h,x,b;const N={x:0,y:0},k={x:0,y:0},[M,_,C,O]=bi({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[f]*s[f]===-1){x=i.x??M,b=i.y??_;const Y=[{x,y:u.y},{x,y:c.y}],I=[{x:u.x,y:b},{x:c.x,y:b}];l[f]===g?h=f==="x"?Y:I:h=f==="x"?I:Y}else{const Y=[{x:u.x,y:c.y}],I=[{x:c.x,y:u.y}];if(f==="x"?h=l.x===g?I:Y:h=l.y===g?Y:I,t===o){const W=Math.abs(e[f]-n[f]);if(W<=r){const w=Math.min(r-1,r-W);l[f]===g?N[f]=(u[f]>e[f]?-1:1)*w:k[f]=(c[f]>n[f]?-1:1)*w}}if(t!==o){const W=f==="x"?"y":"x",w=l[f]===s[W],P=u[W]>c[W],S=u[W]<c[W];(l[f]===1&&(!w&&P||w&&S)||l[f]!==1&&(!w&&S||w&&P))&&(h=f==="x"?Y:I)}const B={x:u.x+N.x,y:u.y+N.y},A={x:c.x+k.x,y:c.y+k.y},D=Math.max(Math.abs(B.x-h[0].x),Math.abs(A.x-h[0].x)),E=Math.max(Math.abs(B.y-h[0].y),Math.abs(A.y-h[0].y));D>=E?(x=(B.x+A.x)/2,b=h[0].y):(x=h[0].x,b=(B.y+A.y)/2)}return[[e,{x:u.x+N.x,y:u.y+N.y},...h,{x:c.x+k.x,y:c.y+k.y},n],x,b,C,O]}function Du(e,t,n,o){const i=Math.min(Mi(e,t)/2,Mi(t,n)/2,o),{x:r,y:l}=t;if(e.x===r&&r===n.x||e.y===l&&l===n.y)return`L${r} ${l}`;if(e.y===l){const c=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${r+i*c},${l}Q ${r},${l} ${r},${l+i*d}`}const s=e.x<n.x?1:-1,u=e.y<n.y?-1:1;return`L ${r},${l+i*u}Q ${r},${l} ${r+i*s},${l}`}function On(e){const{sourceX:t,sourceY:n,sourcePosition:o=R.Bottom,targetX:i,targetY:r,targetPosition:l=R.Top,borderRadius:s=5,centerX:u,centerY:c,offset:d=20}=e,[f,g,h,x,b]=Bu({source:{x:t,y:n},sourcePosition:o,target:{x:i,y:r},targetPosition:l,center:{x:u,y:c},offset:d});return[f.reduce((k,M,_)=>{let C;return _>0&&_<f.length-1?C=Du(f[_-1],M,f[_+1],s):C=`${_===0?"M":"L"}${M.x} ${M.y}`,k+=C,k},""),g,h,x,b]}function Vu(e){const{sourceX:t,sourceY:n,targetX:o,targetY:i}=e,[r,l,s,u]=bi({sourceX:t,sourceY:n,targetX:o,targetY:i});return[`M ${t},${n}L ${o},${i}`,r,l,s,u]}const Au=a.defineComponent({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=Vu(e);return a.h(qt,{path:n,labelX:o,labelY:i,...t,...e})}}}),Ii=a.defineComponent({name:"SmoothStepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","borderRadius","markerEnd","markerStart","interactionWidth","offset"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=On({...e,sourcePosition:e.sourcePosition??R.Bottom,targetPosition:e.targetPosition??R.Top});return a.h(qt,{path:n,labelX:o,labelY:i,...t,...e})}}}),Ou=a.defineComponent({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:t}){return()=>a.h(Ii,{...e,...t,borderRadius:0})}}),zu=a.defineComponent({name:"BezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=An({...e,sourcePosition:e.sourcePosition??R.Bottom,targetPosition:e.targetPosition??R.Top});return a.h(qt,{path:n,labelX:o,labelY:i,...t,...e})}}}),Ru=a.defineComponent({name:"SimpleBezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=Ci({...e,sourcePosition:e.sourcePosition??R.Bottom,targetPosition:e.targetPosition??R.Top});return a.h(qt,{path:n,labelX:o,labelY:i,...t,...e})}}}),Hu={input:xu,default:Eu,output:bu},Lu={default:zu,straight:Au,step:Ou,smoothstep:Ii,simplebezier:Ru};function Fu(e,t,n){const o=a.computed(()=>b=>t.value.get(b)),i=a.computed(()=>b=>n.value.get(b)),r=a.computed(()=>{const b={...Lu,...e.edgeTypes},N=Object.keys(b);for(const k of e.edges)k.type&&!N.includes(k.type)&&(b[k.type]=k.type);return b}),l=a.computed(()=>{const b={...Hu,...e.nodeTypes},N=Object.keys(b);for(const k of e.nodes)k.type&&!N.includes(k.type)&&(b[k.type]=k.type);return b}),s=a.computed(()=>e.onlyRenderVisibleElements?Zo(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),u=a.computed(()=>{if(e.onlyRenderVisibleElements){const b=[];for(const N of e.edges){const k=t.value.get(N.source),M=t.value.get(N.target);Ys({sourcePos:k.computedPosition||{x:0,y:0},targetPos:M.computedPosition||{x:0,y:0},sourceWidth:k.dimensions.width,sourceHeight:k.dimensions.height,targetWidth:M.dimensions.width,targetHeight:M.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&b.push(N)}return b}return e.edges}),c=a.computed(()=>[...s.value,...u.value]),d=a.computed(()=>{const b=[];for(const N of e.nodes)N.selected&&b.push(N);return b}),f=a.computed(()=>{const b=[];for(const N of e.edges)N.selected&&b.push(N);return b}),g=a.computed(()=>[...d.value,...f.value]),h=a.computed(()=>{const b=[];for(const N of e.nodes)N.dimensions.width&&N.dimensions.height&&N.handleBounds!==void 0&&b.push(N);return b}),x=a.computed(()=>s.value.length>0&&h.value.length===s.value.length);return{getNode:o,getEdge:i,getElements:c,getEdgeTypes:r,getNodeTypes:l,getEdges:u,getNodes:s,getSelectedElements:g,getSelectedNodes:d,getSelectedEdges:f,getNodesInitialized:h,areNodesInitialized:x}}class Ye{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var t;const n=(t=a.getCurrentInstance())==null?void 0:t.appContext.app,o=(n==null?void 0:n.config.globalProperties.$vueFlowStorage)??Ye.instance;return Ye.instance=o??new Ye,n&&(n.config.globalProperties.$vueFlowStorage=Ye.instance),Ye.instance}set(t,n){return this.flows.set(t,n)}get(t){return this.flows.get(t)}remove(t){return this.flows.delete(t)}create(t,n){const o=Ei(),i=a.reactive(o),r={};for(const[g,h]of Object.entries(i.hooks)){const x=`on${g.charAt(0).toUpperCase()+g.slice(1)}`;r[x]=h.on}const l={};for(const[g,h]of Object.entries(i.hooks))l[g]=h.trigger;const s=a.computed(()=>{const g=new Map;for(const h of i.nodes)g.set(h.id,h);return g}),u=a.computed(()=>{const g=new Map;for(const h of i.edges)g.set(h.id,h);return g}),c=Fu(i,s,u),d=vu(i,s,u);d.setState({...i,...n});const f={...r,...c,...d,...Hi(i),nodeLookup:s,edgeLookup:u,emits:l,id:t,vueFlowVersion:"1.45.0",$destroy:()=>{this.remove(t)}};return this.set(t,f),f}getId(){return`vue-flow-${this.currentId++}`}}function de(e){const t=Ye.getInstance(),n=a.getCurrentScope(),o=typeof e=="object",i=o?e:{id:e},r=i.id,l=r??(n==null?void 0:n.vueFlowId);let s;if(n){const u=a.inject(gi,null);typeof u<"u"&&u!==null&&(!l||u.id===l)&&(s=u)}if(s||l&&(s=t.get(l)),!s||l&&s.id!==l){const u=r??t.getId(),c=t.create(u,i);s=c,(n??a.effectScope(!0)).run(()=>{a.watch(c.applyDefault,(f,g,h)=>{const x=N=>{c.applyNodeChanges(N)},b=N=>{c.applyEdgeChanges(N)};f?(c.onNodesChange(x),c.onEdgesChange(b)):(c.hooks.value.nodesChange.off(x),c.hooks.value.edgesChange.off(b)),h(()=>{c.hooks.value.nodesChange.off(x),c.hooks.value.edgesChange.off(b)})},{immediate:!0}),mt(()=>{if(s){const f=t.get(s.id);f?f.$destroy():Gt(`No store instance found for id ${s.id} in storage.`)}})})}else o&&s.setState(i);if(n&&(a.provide(gi,s),n.vueFlowId=s.id),o){const u=a.getCurrentInstance();(u==null?void 0:u.type.name)!=="VueFlow"&&s.emits.error(new ge(fe.USEVUEFLOW_OPTIONS))}return s}function Yu(e){const{emits:t,dimensions:n}=de();let o;a.onMounted(()=>{const i=e.value,r=()=>{if(!i)return;const l=Ht(i);(l.width===0||l.height===0)&&t.error(new ge(fe.MISSING_VIEWPORT_DIMENSIONS)),n.value={width:l.width||500,height:l.height||500}};r(),window.addEventListener("resize",r),i&&(o=new ResizeObserver(()=>r()),o.observe(i)),a.onBeforeUnmount(()=>{window.removeEventListener("resize",r),o&&i&&o.unobserve(i)})})}const Gu={name:"UserSelection",compatConfig:{MODE:3}},Xu=a.defineComponent({...Gu,props:{userSelectionRect:{}},setup(e){return(t,n)=>(a.openBlock(),a.createElementBlock("div",{class:"vue-flow__selection vue-flow__container",style:a.normalizeStyle({width:`${t.userSelectionRect.width}px`,height:`${t.userSelectionRect.height}px`,transform:`translate(${t.userSelectionRect.x}px, ${t.userSelectionRect.y}px)`})},null,4))}}),Uu=["tabIndex"],Zu={name:"NodesSelection",compatConfig:{MODE:3}},Wu=a.defineComponent({...Zu,setup(e){const{emits:t,viewport:n,getSelectedNodes:o,noPanClassName:i,disableKeyboardA11y:r,userSelectionActive:l}=de(),s=_i(),u=a.ref(null),c=yi({el:u,onStart(x){t.selectionDragStart(x)},onDrag(x){t.selectionDrag(x)},onStop(x){t.selectionDragStop(x)}});a.onMounted(()=>{var x;r.value||(x=u.value)==null||x.focus({preventScroll:!0})});const d=a.computed(()=>Uo(o.value)),f=a.computed(()=>({width:`${d.value.width}px`,height:`${d.value.height}px`,top:`${d.value.y}px`,left:`${d.value.x}px`}));function g(x){t.selectionContextMenu({event:x,nodes:o.value})}function h(x){r||qe[x.key]&&(x.preventDefault(),s({x:qe[x.key].x,y:qe[x.key].y},x.shiftKey))}return(x,b)=>!a.unref(l)&&d.value.width&&d.value.height?(a.openBlock(),a.createElementBlock("div",{key:0,class:a.normalizeClass(["vue-flow__nodesselection vue-flow__container",a.unref(i)]),style:a.normalizeStyle({transform:`translate(${a.unref(n).x}px,${a.unref(n).y}px) scale(${a.unref(n).zoom})`})},[a.createElementVNode("div",{ref_key:"el",ref:u,class:a.normalizeClass([{dragging:a.unref(c)},"vue-flow__nodesselection-rect"]),style:a.normalizeStyle(f.value),tabIndex:a.unref(r)?void 0:-1,onContextmenu:g,onKeydown:h},null,46,Uu)],6)):a.createCommentVNode("",!0)}});function Ku(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const qu={name:"Pane",compatConfig:{MODE:3}},ju=a.defineComponent({...qu,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:t,nodes:n,viewport:o,emits:i,userSelectionActive:r,removeSelectedElements:l,userSelectionRect:s,elementsSelectable:u,nodesSelectionActive:c,getSelectedEdges:d,getSelectedNodes:f,removeNodes:g,removeEdges:h,selectionMode:x,deleteKeyCode:b,multiSelectionKeyCode:N,multiSelectionActive:k,edgeLookup:M,nodeLookup:_,connectionLookup:C,defaultEdgeOptions:O,connectionStartHandle:G}=de(),Y=a.ref(null),I=a.ref(new Set),B=a.ref(new Set),A=a.ref(),D=a.toRef(()=>u.value&&(e.isSelecting||r.value)),E=a.toRef(()=>G.value!==null);let W=!1,w=!1;const P=dt(b,{actInsideInputWithModifier:!1}),S=dt(N);a.watch(P,F=>{F&&(g(f.value),h(d.value),c.value=!1)}),a.watch(S,F=>{k.value=F});function $(F,X){return j=>{j.target===X&&(F==null||F(j))}}function V(F){if(W||E.value){W=!1;return}i.paneClick(F),l(),c.value=!1}function H(F){F.preventDefault(),F.stopPropagation(),i.paneContextMenu(F)}function z(F){i.paneScroll(F)}function K(F){var X,j,le;if(A.value=(X=t.value)==null?void 0:X.getBoundingClientRect(),!u.value||!e.isSelecting||F.button!==0||F.target!==Y.value||!A.value)return;(le=(j=F.target)==null?void 0:j.setPointerCapture)==null||le.call(j,F.pointerId);const{x:ae,y:te}=Ku(F,A.value);w=!0,W=!1,l(),s.value={width:0,height:0,startX:ae,startY:te,x:ae,y:te},i.selectionStart(F)}function Q(F){var X;if(!A.value||!s.value)return;W=!0;const{x:j,y:le}=Se(F,A.value),{startX:ae=0,startY:te=0}=s.value,ue={startX:ae,startY:te,x:j<ae?j:ae,y:le<te?le:te,width:Math.abs(j-ae),height:Math.abs(le-te)},J=I.value,ne=B.value;I.value=new Set(Zo(n.value,ue,o.value,x.value===En.Partial,!0).map(m=>m.id)),B.value=new Set;const ie=((X=O.value)==null?void 0:X.selectable)??!0;for(const m of I.value){const p=C.value.get(m);if(p)for(const{edgeId:v}of p.values()){const y=M.value.get(v);y&&(y.selectable??ie)&&B.value.add(v)}}if(!hi(J,I.value)){const m=De(_.value,I.value,!0);i.nodesChange(m)}if(!hi(ne,B.value)){const m=De(M.value,B.value);i.edgesChange(m)}s.value=ue,r.value=!0,c.value=!1}function oe(F){var X;F.button!==0||!w||((X=F.target)==null||X.releasePointerCapture(F.pointerId),!r.value&&s.value&&F.target===Y.value&&V(F),r.value=!1,s.value=null,c.value=I.value.size>0,i.selectionEnd(F),e.selectionKeyPressed&&(W=!1),w=!1)}return(F,X)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"container",ref:Y,class:a.normalizeClass(["vue-flow__pane vue-flow__container",{selection:F.isSelecting}]),onClick:X[0]||(X[0]=j=>D.value?void 0:$(V,Y.value)(j)),onContextmenu:X[1]||(X[1]=j=>$(H,Y.value)(j)),onWheelPassive:X[2]||(X[2]=j=>$(z,Y.value)(j)),onPointerenter:X[3]||(X[3]=j=>D.value?void 0:a.unref(i).paneMouseEnter(j)),onPointerdown:X[4]||(X[4]=j=>D.value?K(j):a.unref(i).paneMouseMove(j)),onPointermove:X[5]||(X[5]=j=>D.value?Q(j):a.unref(i).paneMouseMove(j)),onPointerup:X[6]||(X[6]=j=>D.value?oe(j):void 0),onPointerleave:X[7]||(X[7]=j=>a.unref(i).paneMouseLeave(j))},[a.renderSlot(F.$slots,"default"),a.unref(r)&&a.unref(s)?(a.openBlock(),a.createBlock(Xu,{key:0,"user-selection-rect":a.unref(s)},null,8,["user-selection-rect"])):a.createCommentVNode("",!0),a.unref(c)&&a.unref(f).length?(a.openBlock(),a.createBlock(Wu,{key:1})):a.createCommentVNode("",!0)],34))}}),Ju={name:"Transform",compatConfig:{MODE:3}},Qu=a.defineComponent({...Ju,setup(e){const{viewport:t,fitViewOnInit:n,fitViewOnInitDone:o}=de(),i=a.computed(()=>n.value?!o.value:!1),r=a.computed(()=>`translate(${t.value.x}px,${t.value.y}px) scale(${t.value.zoom})`);return(l,s)=>(a.openBlock(),a.createElementBlock("div",{class:"vue-flow__transformationpane vue-flow__container",style:a.normalizeStyle({transform:r.value,opacity:i.value?0:void 0})},[a.renderSlot(l.$slots,"default")],4))}}),ec={name:"Viewport",compatConfig:{MODE:3}},tc=a.defineComponent({...ec,setup(e){const{minZoom:t,maxZoom:n,defaultViewport:o,translateExtent:i,zoomActivationKeyCode:r,selectionKeyCode:l,panActivationKeyCode:s,panOnScroll:u,panOnScrollMode:c,panOnScrollSpeed:d,panOnDrag:f,zoomOnDoubleClick:g,zoomOnPinch:h,zoomOnScroll:x,preventScrolling:b,noWheelClassName:N,noPanClassName:k,emits:M,connectionStartHandle:_,userSelectionActive:C,paneDragging:O,d3Zoom:G,d3Selection:Y,d3ZoomHandler:I,viewport:B,viewportRef:A,paneClickDistance:D}=de();Yu(A);const E=a.shallowRef(!1),W=a.shallowRef(!1);let w=null,P=!1,S=0,$={x:0,y:0,zoom:0};const V=dt(s),H=dt(l),z=dt(r),K=a.toRef(()=>(!H.value||H.value&&l.value===!0)&&(V.value||f.value)),Q=a.toRef(()=>V.value||u.value),oe=a.toRef(()=>H.value||l.value===!0&&K.value!==!0);a.onMounted(()=>{if(!A.value){Gt("Viewport element is missing");return}const te=A.value,ue=te.getBoundingClientRect(),J=Ss().clickDistance(D.value).scaleExtent([t.value,n.value]).translateExtent(i.value),ne=ye(te).call(J),ie=ne.on("wheel.zoom"),m=Ke.translate(o.value.x??0,o.value.y??0).scale(Le(o.value.zoom??1,t.value,n.value)),p=[[0,0],[ue.width,ue.height]],v=J.constrain()(m,p,i.value);J.transform(ne,v),J.wheelDelta(X),G.value=J,Y.value=ne,I.value=ie,B.value={x:v.x,y:v.y,zoom:v.k},J.on("start",y=>{var T;if(!y.sourceEvent)return null;S=y.sourceEvent.button,E.value=!0;const q=le(y.transform);((T=y.sourceEvent)==null?void 0:T.type)==="mousedown"&&(O.value=!0),$=q,M.viewportChangeStart(q),M.moveStart({event:y,flowTransform:q})}),J.on("end",y=>{if(!y.sourceEvent)return null;if(E.value=!1,O.value=!1,F(K.value,S??0)&&!P&&M.paneContextMenu(y.sourceEvent),P=!1,j($,y.transform)){const T=le(y.transform);$=T,M.viewportChangeEnd(T),M.moveEnd({event:y,flowTransform:T})}}),J.filter(y=>{var T;const q=z.value||x.value,U=h.value&&y.ctrlKey,Z=y.button;if(Z===1&&y.type==="mousedown"&&(ae(y,"vue-flow__node")||ae(y,"vue-flow__edge")))return!0;if(!K.value&&!q&&!Q.value&&!g.value&&!h.value||C.value||!g.value&&y.type==="dblclick"||ae(y,N.value)&&y.type==="wheel"||ae(y,k.value)&&(y.type!=="wheel"||Q.value&&y.type==="wheel"&&!z.value)||!h.value&&y.ctrlKey&&y.type==="wheel"||!q&&!Q.value&&!U&&y.type==="wheel")return!1;if(!h&&y.type==="touchstart"&&((T=y.touches)==null?void 0:T.length)>1)return y.preventDefault(),!1;if(!K.value&&(y.type==="mousedown"||y.type==="touchstart")||l.value===!0&&Array.isArray(f.value)&&f.value.includes(0)&&Z===0||Array.isArray(f.value)&&!f.value.includes(Z)&&(y.type==="mousedown"||y.type==="touchstart"))return!1;const ee=Array.isArray(f.value)&&f.value.includes(Z)||l.value===!0&&Array.isArray(f.value)&&!f.value.includes(0)||!Z||Z<=1;return(!y.ctrlKey||V.value||y.type==="wheel")&&ee}),a.watch([C,K],()=>{C.value&&!E.value?J.on("zoom",null):C.value||J.on("zoom",y=>{B.value={x:y.transform.x,y:y.transform.y,zoom:y.transform.k};const T=le(y.transform);P=F(K.value,S??0),M.viewportChange(T),M.move({event:y,flowTransform:T})})},{immediate:!0}),a.watch([C,Q,c,z,h,b,N],()=>{Q.value&&!z.value&&!C.value?ne.on("wheel.zoom",y=>{if(ae(y,N.value))return!1;const T=z.value||x.value,q=h.value&&y.ctrlKey;if(!(!b.value||Q.value||T||q))return!1;y.preventDefault(),y.stopImmediatePropagation();const Z=ne.property("__zoom").k||1,ee=Ft();if(!V.value&&y.ctrlKey&&h.value&&ee){const pt=_e(y),Xc=X(y),Uc=Z*2**Xc;J.scaleTo(ne,Uc,pt,y);return}const re=y.deltaMode===1?20:1;let se=c.value===ct.Vertical?0:y.deltaX*re,ce=c.value===ct.Horizontal?0:y.deltaY*re;!ee&&y.shiftKey&&c.value!==ct.Vertical&&!se&&ce&&(se=ce,ce=0),J.translateBy(ne,-(se/Z)*d.value,-(ce/Z)*d.value);const Ne=le(ne.property("__zoom"));w&&clearTimeout(w),W.value?(M.move({event:y,flowTransform:Ne}),M.viewportChange(Ne),w=setTimeout(()=>{M.moveEnd({event:y,flowTransform:Ne}),M.viewportChangeEnd(Ne),W.value=!1},150)):(W.value=!0,M.moveStart({event:y,flowTransform:Ne}),M.viewportChangeStart(Ne))},{passive:!1}):typeof ie<"u"&&ne.on("wheel.zoom",function(y,T){const q=!b.value&&y.type==="wheel"&&!y.ctrlKey,U=z.value||x.value,Z=h.value&&y.ctrlKey;if(!U&&!u.value&&!Z&&y.type==="wheel"||q||ae(y,N.value))return null;y.preventDefault(),ie.call(this,y,T)},{passive:!1})},{immediate:!0})});function F(te,ue){return ue===2&&Array.isArray(te)&&te.includes(2)}function X(te){const ue=te.ctrlKey&&Ft()?10:1;return-te.deltaY*(te.deltaMode===1?.05:te.deltaMode?1:.002)*ue}function j(te,ue){return te.x!==ue.x&&!Number.isNaN(ue.x)||te.y!==ue.y&&!Number.isNaN(ue.y)||te.zoom!==ue.k&&!Number.isNaN(ue.k)}function le(te){return{x:te.x,y:te.y,zoom:te.k}}function ae(te,ue){return te.target.closest(`.${ue}`)}return(te,ue)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"viewportRef",ref:A,class:"vue-flow__viewport vue-flow__container"},[a.createVNode(ju,{"is-selecting":oe.value,"selection-key-pressed":a.unref(H),class:a.normalizeClass({connecting:!!a.unref(_),dragging:a.unref(O),draggable:a.unref(f)===!0||Array.isArray(a.unref(f))&&a.unref(f).includes(0)})},{default:a.withCtx(()=>[a.createVNode(Qu,null,{default:a.withCtx(()=>[a.renderSlot(te.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),nc=["id"],oc=["id"],ic=["id"],rc={name:"A11yDescriptions",compatConfig:{MODE:3}},lc=a.defineComponent({...rc,setup(e){const{id:t,disableKeyboardA11y:n,ariaLiveMessage:o}=de();return(i,r)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("div",{id:`${a.unref(Oo)}-${a.unref(t)}`,style:{display:"none"}}," Press enter or space to select a node. "+a.toDisplayString(a.unref(n)?"":"You can then use the arrow keys to move the node around.")+" You can then use the arrow keys to move the node around, press delete to remove it and press escape to cancel. ",9,nc),a.createElementVNode("div",{id:`${a.unref(zo)}-${a.unref(t)}`,style:{display:"none"}}," Press enter or space to select an edge. You can then press delete to remove it or press escape to cancel. ",8,oc),a.unref(n)?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("div",{key:0,id:`${a.unref(Ts)}-${a.unref(t)}`,"aria-live":"assertive","aria-atomic":"true",style:{position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)","clip-path":"inset(100%)"}},a.toDisplayString(a.unref(o)),9,ic))],64))}});function ac(){const e=de();a.watch(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function sc(e,t,n){return n===R.Left?e-t:n===R.Right?e+t:e}function uc(e,t,n){return n===R.Top?e-t:n===R.Bottom?e+t:e}const zn=function({radius:e=10,centerX:t=0,centerY:n=0,position:o=R.Top,type:i}){return a.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${i}`,cx:sc(t,e,o),cy:uc(n,e,o),r:e,stroke:"transparent",fill:"transparent"})};zn.props=["radius","centerX","centerY","position","type"],zn.compatConfig={MODE:3};const Ti=zn,cc=a.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:t,addSelectedEdges:n,connectionMode:o,edgeUpdaterRadius:i,emits:r,nodesSelectionActive:l,noPanClassName:s,getEdgeTypes:u,removeSelectedEdges:c,findEdge:d,findNode:f,isValidConnection:g,multiSelectionActive:h,disableKeyboardA11y:x,elementsSelectable:b,edgesUpdatable:N,edgesFocusable:k,hooks:M}=de(),_=a.computed(()=>d(e.id)),{emit:C,on:O}=lu(_.value,r),G=a.inject(Xt),Y=a.getCurrentInstance(),I=a.ref(!1),B=a.ref(!1),A=a.ref(""),D=a.ref(null),E=a.ref("source"),W=a.ref(null),w=a.toRef(()=>typeof _.value.selectable>"u"?b.value:_.value.selectable),P=a.toRef(()=>typeof _.value.updatable>"u"?N.value:_.value.updatable),S=a.toRef(()=>typeof _.value.focusable>"u"?k.value:_.value.focusable);a.provide(ou,e.id),a.provide(iu,W);const $=a.computed(()=>_.value.class instanceof Function?_.value.class(_.value):_.value.class),V=a.computed(()=>_.value.style instanceof Function?_.value.style(_.value):_.value.style),H=a.computed(()=>{const p=_.value.type||"default",v=G==null?void 0:G[`edge-${p}`];if(v)return v;let y=_.value.template??u.value[p];if(typeof y=="string"&&Y){const T=Object.keys(Y.appContext.components);T&&T.includes(p)&&(y=a.resolveComponent(p,!1))}return y&&typeof y!="string"?y:(r.error(new ge(fe.EDGE_TYPE_MISSING,y)),!1)}),{handlePointerDown:z}=vi({nodeId:A,handleId:D,type:E,isValidConnection:g,edgeUpdaterType:E,onEdgeUpdate:oe,onEdgeUpdateEnd:F});return()=>{const p=f(_.value.source),v=f(_.value.target),y="pathOptions"in _.value?_.value.pathOptions:{};if(!p&&!v)return r.error(new ge(fe.EDGE_SOURCE_TARGET_MISSING,_.value.id,_.value.source,_.value.target)),null;if(!p)return r.error(new ge(fe.EDGE_SOURCE_MISSING,_.value.id,_.value.source)),null;if(!v)return r.error(new ge(fe.EDGE_TARGET_MISSING,_.value.id,_.value.target)),null;if(!_.value||_.value.hidden||p.hidden||v.hidden)return null;let T;o.value===Pe.Strict?T=p.handleBounds.source:T=[...p.handleBounds.source||[],...p.handleBounds.target||[]];const q=ri(T,_.value.sourceHandle);let U;o.value===Pe.Strict?U=v.handleBounds.target:U=[...v.handleBounds.target||[],...v.handleBounds.source||[]];const Z=ri(U,_.value.targetHandle),ee=(q==null?void 0:q.position)||R.Bottom,re=(Z==null?void 0:Z.position)||R.Top,{x:se,y:ce}=je(p,q,ee),{x:Ne,y:pt}=je(v,Z,re);return _.value.sourceX=se,_.value.sourceY=ce,_.value.targetX=Ne,_.value.targetY=pt,a.h("g",{ref:W,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${H.value===!1?"default":_.value.type||"default"}`,s.value,$.value,{updating:I.value,selected:_.value.selected,animated:_.value.animated,inactive:!w.value&&!M.value.edgeClick.hasListeners()}],tabIndex:S.value?0:void 0,"aria-label":_.value.ariaLabel===null?void 0:_.value.ariaLabel??`Edge from ${_.value.source} to ${_.value.target}`,"aria-describedby":S.value?`${zo}-${t}`:void 0,"aria-roledescription":"edge",role:S.value?"group":"img",..._.value.domAttributes,onClick:j,onContextmenu:le,onDblclick:ae,onMouseenter:te,onMousemove:ue,onMouseleave:J,onKeyDown:S.value?m:void 0},[B.value?null:a.h(H.value===!1?u.value.default:H.value,{id:e.id,sourceNode:p,targetNode:v,source:_.value.source,target:_.value.target,type:_.value.type,updatable:P.value,selected:_.value.selected,animated:_.value.animated,label:_.value.label,labelStyle:_.value.labelStyle,labelShowBg:_.value.labelShowBg,labelBgStyle:_.value.labelBgStyle,labelBgPadding:_.value.labelBgPadding,labelBgBorderRadius:_.value.labelBgBorderRadius,data:_.value.data,events:{..._.value.events,...O},style:V.value,markerStart:`url('#${gt(_.value.markerStart,t)}')`,markerEnd:`url('#${gt(_.value.markerEnd,t)}')`,sourcePosition:ee,targetPosition:re,sourceX:se,sourceY:ce,targetX:Ne,targetY:pt,sourceHandleId:_.value.sourceHandle,targetHandleId:_.value.targetHandle,interactionWidth:_.value.interactionWidth,...y}),[P.value==="source"||P.value===!0?[a.h("g",{onMousedown:ne,onMouseenter:K,onMouseout:Q},a.h(Ti,{position:ee,centerX:se,centerY:ce,radius:i.value,type:"source","data-type":"source"}))]:null,P.value==="target"||P.value===!0?[a.h("g",{onMousedown:ie,onMouseenter:K,onMouseout:Q},a.h(Ti,{position:re,centerX:Ne,centerY:pt,radius:i.value,type:"target","data-type":"target"}))]:null]])};function K(){I.value=!0}function Q(){I.value=!1}function oe(p,v){C.update({event:p,edge:_.value,connection:v})}function F(p){C.updateEnd({event:p,edge:_.value}),B.value=!1}function X(p,v){p.button===0&&(B.value=!0,A.value=v?_.value.target:_.value.source,D.value=(v?_.value.targetHandle:_.value.sourceHandle)??null,E.value=v?"target":"source",C.updateStart({event:p,edge:_.value}),z(p))}function j(p){var v;const y={event:p,edge:_.value};w.value&&(l.value=!1,_.value.selected&&h.value?(c([_.value]),(v=W.value)==null||v.blur()):n([_.value])),C.click(y)}function le(p){C.contextMenu({event:p,edge:_.value})}function ae(p){C.doubleClick({event:p,edge:_.value})}function te(p){C.mouseEnter({event:p,edge:_.value})}function ue(p){C.mouseMove({event:p,edge:_.value})}function J(p){C.mouseLeave({event:p,edge:_.value})}function ne(p){X(p,!0)}function ie(p){X(p,!1)}function m(p){var v;!x.value&&Ro.includes(p.key)&&w.value&&(p.key==="Escape"?((v=W.value)==null||v.blur(),c([d(e.id)])):n([d(e.id)]))}}}),dc=a.defineComponent({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:t,connectionMode:n,connectionStartHandle:o,connectionEndHandle:i,connectionPosition:r,connectionLineType:l,connectionLineStyle:s,connectionLineOptions:u,connectionStatus:c,viewport:d,findNode:f}=de(),g=(e=a.inject(Xt))==null?void 0:e["connection-line"],h=a.computed(()=>{var M;return f((M=o.value)==null?void 0:M.nodeId)}),x=a.computed(()=>{var M;return f((M=i.value)==null?void 0:M.nodeId)??null}),b=a.computed(()=>({x:(r.value.x-d.value.x)/d.value.zoom,y:(r.value.y-d.value.y)/d.value.zoom})),N=a.computed(()=>u.value.markerStart?`url(#${gt(u.value.markerStart,t)})`:""),k=a.computed(()=>u.value.markerEnd?`url(#${gt(u.value.markerEnd,t)})`:"");return()=>{var M,_,C;if(!h.value||!o.value)return null;const O=o.value.id,G=o.value.type,Y=h.value.handleBounds;let I=(Y==null?void 0:Y[G])??[];if(n.value===Pe.Loose){const V=(Y==null?void 0:Y[G==="source"?"target":"source"])??[];I=[...I,...V]}if(!I)return null;const B=(O?I.find(V=>V.id===O):I[0])??null,A=(B==null?void 0:B.position)??R.Top,{x:D,y:E}=je(h.value,B,A);let W=null;x.value&&(n.value===Pe.Strict?W=((M=x.value.handleBounds[G==="source"?"target":"source"])==null?void 0:M.find(V=>{var H;return V.id===((H=i.value)==null?void 0:H.id)}))||null:W=((_=[...x.value.handleBounds.source??[],...x.value.handleBounds.target??[]])==null?void 0:_.find(V=>{var H;return V.id===((H=i.value)==null?void 0:H.id)}))||null);const w=((C=i.value)==null?void 0:C.position)??(A?Tn[A]:null);if(!A||!w)return null;const P=l.value??u.value.type??He.Bezier;let S="";const $={sourceX:D,sourceY:E,sourcePosition:A,targetX:b.value.x,targetY:b.value.y,targetPosition:w};return P===He.Bezier?[S]=An($):P===He.Step?[S]=On({...$,borderRadius:0}):P===He.SmoothStep?[S]=On($):P===He.SimpleBezier?[S]=Ci($):S=`M${D},${E} ${b.value.x},${b.value.y}`,a.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},a.h("g",{class:"vue-flow__connection"},g?a.h(g,{sourceX:D,sourceY:E,sourcePosition:A,targetX:b.value.x,targetY:b.value.y,targetPosition:w,sourceNode:h.value,sourceHandle:B,targetNode:x.value,targetHandle:W,markerEnd:k.value,markerStart:N.value,connectionStatus:c.value}):a.h("path",{d:S,class:[u.value.class,c,"vue-flow__connection-path"],style:{...s.value,...u.value.style},"marker-end":k.value,"marker-start":N.value})))}}}),fc=["id","markerWidth","markerHeight","markerUnits","orient"],hc={name:"MarkerType",compatConfig:{MODE:3}},gc=a.defineComponent({...hc,props:{id:{},type:{},color:{default:"none"},width:{default:12.5},height:{default:12.5},markerUnits:{default:"strokeWidth"},orient:{default:"auto-start-reverse"},strokeWidth:{default:1}},setup(e){return(t,n)=>(a.openBlock(),a.createElementBlock("marker",{id:t.id,class:"vue-flow__arrowhead",viewBox:"-10 -10 20 20",refX:"0",refY:"0",markerWidth:`${t.width}`,markerHeight:`${t.height}`,markerUnits:t.markerUnits,orient:t.orient},[t.type===a.unref(bn).ArrowClosed?(a.openBlock(),a.createElementBlock("polyline",{key:0,style:a.normalizeStyle({stroke:t.color,fill:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",points:"-5,-4 0,0 -5,4 -5,-4"},null,4)):a.createCommentVNode("",!0),t.type===a.unref(bn).Arrow?(a.openBlock(),a.createElementBlock("polyline",{key:1,style:a.normalizeStyle({stroke:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):a.createCommentVNode("",!0)],8,fc))}}),pc={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},mc={name:"MarkerDefinitions",compatConfig:{MODE:3}},yc=a.defineComponent({...mc,setup(e){const{id:t,edges:n,connectionLineOptions:o,defaultMarkerColor:i}=de(),r=a.computed(()=>{const l=new Set,s=[],u=c=>{if(c){const d=gt(c,t);l.has(d)||(typeof c=="object"?s.push({...c,id:d,color:c.color||i.value}):s.push({id:d,color:i.value,type:c}),l.add(d))}};for(const c of[o.value.markerEnd,o.value.markerStart])u(c);for(const c of n.value)for(const d of[c.markerStart,c.markerEnd])u(d);return s.sort((c,d)=>c.id.localeCompare(d.id))});return(l,s)=>(a.openBlock(),a.createElementBlock("svg",pc,[a.createElementVNode("defs",null,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(r.value,u=>(a.openBlock(),a.createBlock(gc,{id:u.id,key:u.id,type:u.type,color:u.color,width:u.width,height:u.height,markerUnits:u.markerUnits,"stroke-width":u.strokeWidth,orient:u.orient},null,8,["id","type","color","width","height","markerUnits","stroke-width","orient"]))),128))])]))}}),vc={name:"Edges",compatConfig:{MODE:3}},wc=a.defineComponent({...vc,setup(e){const{findNode:t,getEdges:n,elevateEdgesOnSelect:o}=de();return(i,r)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createVNode(yc),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(n),l=>(a.openBlock(),a.createElementBlock("svg",{key:l.id,class:"vue-flow__edges vue-flow__container",style:a.normalizeStyle({zIndex:a.unref(Gs)(l,a.unref(t),a.unref(o))})},[a.createVNode(a.unref(cc),{id:l.id},null,8,["id"])],4))),128)),a.createVNode(a.unref(dc))],64))}}),_c=a.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:t,noPanClassName:n,selectNodesOnDrag:o,nodesSelectionActive:i,multiSelectionActive:r,emits:l,removeSelectedNodes:s,addSelectedNodes:u,updateNodeDimensions:c,onUpdateNodeInternals:d,getNodeTypes:f,nodeExtent:g,elevateNodesOnSelect:h,disableKeyboardA11y:x,ariaLiveMessage:b,snapToGrid:N,snapGrid:k,nodeDragThreshold:M,nodesDraggable:_,elementsSelectable:C,nodesConnectable:O,nodesFocusable:G,hooks:Y}=de(),I=a.ref(null);a.provide(mi,I),a.provide(pi,e.id);const B=a.inject(Xt),A=a.getCurrentInstance(),D=_i(),{node:E,parentNode:W}=wi(e.id),{emit:w,on:P}=cu(E,l),S=a.toRef(()=>typeof E.draggable>"u"?_.value:E.draggable),$=a.toRef(()=>typeof E.selectable>"u"?C.value:E.selectable),V=a.toRef(()=>typeof E.connectable>"u"?O.value:E.connectable),H=a.toRef(()=>typeof E.focusable>"u"?G.value:E.focusable),z=a.computed(()=>$.value||S.value||Y.value.nodeClick.hasListeners()||Y.value.nodeDoubleClick.hasListeners()||Y.value.nodeMouseEnter.hasListeners()||Y.value.nodeMouseMove.hasListeners()||Y.value.nodeMouseLeave.hasListeners()),K=a.toRef(()=>!!E.dimensions.width&&!!E.dimensions.height),Q=a.computed(()=>{const v=E.type||"default",y=B==null?void 0:B[`node-${v}`];if(y)return y;let T=E.template||f.value[v];if(typeof T=="string"&&A){const q=Object.keys(A.appContext.components);q&&q.includes(v)&&(T=a.resolveComponent(v,!1))}return T&&typeof T!="string"?T:(l.error(new ge(fe.NODE_TYPE_MISSING,T)),!1)}),oe=yi({id:e.id,el:I,disabled:()=>!S.value,selectable:$,dragHandle:()=>E.dragHandle,onStart(v){w.dragStart(v)},onDrag(v){w.drag(v)},onStop(v){w.dragStop(v)},onClick(v){m(v)}}),F=a.computed(()=>E.class instanceof Function?E.class(E):E.class),X=a.computed(()=>{const v=(E.style instanceof Function?E.style(E):E.style)||{},y=E.width instanceof Function?E.width(E):E.width,T=E.height instanceof Function?E.height(E):E.height;return!v.width&&y&&(v.width=typeof y=="string"?y:`${y}px`),!v.height&&T&&(v.height=typeof T=="string"?T:`${T}px`),v}),j=a.toRef(()=>Number(E.zIndex??X.value.zIndex??0));return d(v=>{(v.includes(e.id)||!v.length)&&ae()}),a.onMounted(()=>{a.watch(()=>E.hidden,(v=!1,y,T)=>{!v&&I.value&&(e.resizeObserver.observe(I.value),T(()=>{I.value&&e.resizeObserver.unobserve(I.value)}))},{immediate:!0,flush:"post"})}),a.watch([()=>E.type,()=>E.sourcePosition,()=>E.targetPosition],()=>{a.nextTick(()=>{c([{id:e.id,nodeElement:I.value,forceUpdate:!0}])})}),a.watch([()=>E.position.x,()=>E.position.y,()=>{var v;return(v=W.value)==null?void 0:v.computedPosition.x},()=>{var v;return(v=W.value)==null?void 0:v.computedPosition.y},()=>{var v;return(v=W.value)==null?void 0:v.computedPosition.z},j,()=>E.selected,()=>E.dimensions.height,()=>E.dimensions.width,()=>{var v;return(v=W.value)==null?void 0:v.dimensions.height},()=>{var v;return(v=W.value)==null?void 0:v.dimensions.width}],([v,y,T,q,U,Z])=>{const ee={x:v,y,z:Z+(h.value&&E.selected?1e3:0)};typeof T<"u"&&typeof q<"u"?E.computedPosition=zs({x:T,y:q,z:U},ee):E.computedPosition=ee},{flush:"post",immediate:!0}),a.watch([()=>E.extent,g],([v,y],[T,q])=>{(v!==T||y!==q)&&le()}),E.extent==="parent"||typeof E.extent=="object"&&"range"in E.extent&&E.extent.range==="parent"?Qt(()=>K).toBe(!0).then(le):le(),()=>E.hidden?null:a.h("div",{ref:I,"data-id":E.id,class:["vue-flow__node",`vue-flow__node-${Q.value===!1?"default":E.type||"default"}`,{[n.value]:S.value,dragging:oe==null?void 0:oe.value,draggable:S.value,selected:E.selected,selectable:$.value,parent:E.isParent},F.value],style:{visibility:K.value?"visible":"hidden",zIndex:E.computedPosition.z??j.value,transform:`translate(${E.computedPosition.x}px,${E.computedPosition.y}px)`,pointerEvents:z.value?"all":"none",...X.value},tabIndex:H.value?0:void 0,role:H.value?"group":void 0,"aria-describedby":x.value?void 0:`${Oo}-${t}`,"aria-label":E.ariaLabel,"aria-roledescription":"node",...E.domAttributes,onMouseenter:te,onMousemove:ue,onMouseleave:J,onContextmenu:ne,onClick:m,onDblclick:ie,onKeydown:p},[a.h(Q.value===!1?f.value.default:Q.value,{id:E.id,type:E.type,data:E.data,events:{...E.events,...P},selected:E.selected,resizing:E.resizing,dragging:oe.value,connectable:V.value,position:E.computedPosition,dimensions:E.dimensions,isValidTargetPos:E.isValidTargetPos,isValidSourcePos:E.isValidSourcePos,parent:E.parentNode,parentNodeId:E.parentNode,zIndex:E.computedPosition.z??j.value,targetPosition:E.targetPosition,sourcePosition:E.sourcePosition,label:E.label,dragHandle:E.dragHandle,onUpdateNodeInternals:ae})]);function le(){const v=E.computedPosition,{computedPosition:y,position:T}=kn(E,N.value?Yt(v,k.value):v,l.error,g.value,W.value);(E.computedPosition.x!==y.x||E.computedPosition.y!==y.y)&&(E.computedPosition={...E.computedPosition,...y}),(E.position.x!==T.x||E.position.y!==T.y)&&(E.position=T)}function ae(){I.value&&c([{id:e.id,nodeElement:I.value,forceUpdate:!0}])}function te(v){oe!=null&&oe.value||w.mouseEnter({event:v,node:E})}function ue(v){oe!=null&&oe.value||w.mouseMove({event:v,node:E})}function J(v){oe!=null&&oe.value||w.mouseLeave({event:v,node:E})}function ne(v){return w.contextMenu({event:v,node:E})}function ie(v){return w.doubleClick({event:v,node:E})}function m(v){$.value&&(!o.value||!S.value||M.value>0)&&Pn(E,r.value,u,s,i,!1,I.value),w.click({event:v,node:E})}function p(v){if(!(xn(v)||x.value))if(Ro.includes(v.key)&&$.value){const y=v.key==="Escape";Pn(E,r.value,u,s,i,y,I.value)}else S.value&&E.selected&&qe[v.key]&&(v.preventDefault(),b.value=`Moved selected node ${v.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~E.position.x}, y: ${~~E.position.y}`,D({x:qe[v.key].x,y:qe[v.key].y},v.shiftKey))}}}),Ec={height:"0",width:"0"},bc={name:"EdgeLabelRenderer",compatConfig:{MODE:3}},xc=a.defineComponent({...bc,setup(e){const{viewportRef:t}=de(),n=a.toRef(()=>{var o;return(o=t.value)==null?void 0:o.getElementsByClassName("vue-flow__edge-labels")[0]});return(o,i)=>(a.openBlock(),a.createElementBlock("svg",null,[(a.openBlock(),a.createElementBlock("foreignObject",Ec,[(a.openBlock(),a.createBlock(a.Teleport,{to:n.value,disabled:!n.value},[a.renderSlot(o.$slots,"default")],8,["to","disabled"]))]))]))}});function Sc(e={includeHiddenNodes:!1}){const{nodes:t}=de();return a.computed(()=>{if(t.value.length===0)return!1;for(const n of t.value)if((e.includeHiddenNodes||!n.hidden)&&((n==null?void 0:n.handleBounds)===void 0||n.dimensions.width===0||n.dimensions.height===0))return!1;return!0})}const Nc={class:"vue-flow__nodes vue-flow__container"},Cc={name:"Nodes",compatConfig:{MODE:3}},kc=a.defineComponent({...Cc,setup(e){const{getNodes:t,updateNodeDimensions:n,emits:o}=de(),i=Sc(),r=a.ref();return a.watch(i,l=>{l&&a.nextTick(()=>{o.nodesInitialized(t.value)})},{immediate:!0}),a.onMounted(()=>{r.value=new ResizeObserver(l=>{const s=l.map(u=>({id:u.target.getAttribute("data-id"),nodeElement:u.target,forceUpdate:!0}));a.nextTick(()=>n(s))})}),a.onBeforeUnmount(()=>{var l;return(l=r.value)==null?void 0:l.disconnect()}),(l,s)=>(a.openBlock(),a.createElementBlock("div",Nc,[r.value?(a.openBlock(!0),a.createElementBlock(a.Fragment,{key:0},a.renderList(a.unref(t),(u,c,d,f)=>{const g=[u.id];if(f&&f.key===u.id&&a.isMemoSame(f,g))return f;const h=(a.openBlock(),a.createBlock(a.unref(_c),{id:u.id,key:u.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return h.memo=g,h},s,0),128)):a.createCommentVNode("",!0)]))}});function Mc(){const{emits:e}=de();a.onMounted(()=>{if(ui()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new ge(fe.MISSING_STYLES))}})}const Ic=a.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),Tc={name:"VueFlow",compatConfig:{MODE:3}},Pc=a.defineComponent({...Tc,props:{id:{},modelValue:{},nodes:{},edges:{},edgeTypes:{},nodeTypes:{},connectionMode:{},connectionLineType:{},connectionLineStyle:{default:void 0},connectionLineOptions:{default:void 0},connectionRadius:{},isValidConnection:{type:[Function,null],default:void 0},deleteKeyCode:{default:void 0},selectionKeyCode:{type:[Boolean,null],default:void 0},multiSelectionKeyCode:{default:void 0},zoomActivationKeyCode:{default:void 0},panActivationKeyCode:{default:void 0},snapToGrid:{type:Boolean,default:void 0},snapGrid:{},onlyRenderVisibleElements:{type:Boolean,default:void 0},edgesUpdatable:{type:[Boolean,String],default:void 0},nodesDraggable:{type:Boolean,default:void 0},nodesConnectable:{type:Boolean,default:void 0},nodeDragThreshold:{},elementsSelectable:{type:Boolean,default:void 0},selectNodesOnDrag:{type:Boolean,default:void 0},panOnDrag:{type:[Boolean,Array],default:void 0},minZoom:{},maxZoom:{},defaultViewport:{},translateExtent:{},nodeExtent:{},defaultMarkerColor:{},zoomOnScroll:{type:Boolean,default:void 0},zoomOnPinch:{type:Boolean,default:void 0},panOnScroll:{type:Boolean,default:void 0},panOnScrollSpeed:{},panOnScrollMode:{},paneClickDistance:{},zoomOnDoubleClick:{type:Boolean,default:void 0},preventScrolling:{type:Boolean,default:void 0},selectionMode:{},edgeUpdaterRadius:{},fitViewOnInit:{type:Boolean,default:void 0},connectOnClick:{type:Boolean,default:void 0},applyDefault:{type:Boolean,default:void 0},autoConnect:{type:[Boolean,Function],default:void 0},noDragClassName:{},noWheelClassName:{},noPanClassName:{},defaultEdgeOptions:{},elevateEdgesOnSelect:{type:Boolean,default:void 0},elevateNodesOnSelect:{type:Boolean,default:void 0},disableKeyboardA11y:{type:Boolean,default:void 0},edgesFocusable:{type:Boolean,default:void 0},nodesFocusable:{type:Boolean,default:void 0},autoPanOnConnect:{type:Boolean,default:void 0},autoPanOnNodeDrag:{type:Boolean,default:void 0},autoPanSpeed:{}},emits:["nodesChange","edgesChange","nodesInitialized","paneReady","init","updateNodeInternals","error","connect","connectStart","connectEnd","clickConnectStart","clickConnectEnd","moveStart","move","moveEnd","selectionDragStart","selectionDrag","selectionDragStop","selectionContextMenu","selectionStart","selectionEnd","viewportChangeStart","viewportChange","viewportChangeEnd","paneScroll","paneClick","paneContextMenu","paneMouseEnter","paneMouseMove","paneMouseLeave","edgeUpdate","edgeContextMenu","edgeMouseEnter","edgeMouseMove","edgeMouseLeave","edgeDoubleClick","edgeClick","edgeUpdateStart","edgeUpdateEnd","nodeContextMenu","nodeMouseEnter","nodeMouseMove","nodeMouseLeave","nodeDoubleClick","nodeClick","nodeDragStart","nodeDrag","nodeDragStop","miniMapNodeClick","miniMapNodeDoubleClick","miniMapNodeMouseEnter","miniMapNodeMouseMove","miniMapNodeMouseLeave","update:modelValue","update:nodes","update:edges"],setup(e,{expose:t,emit:n}){const o=e,i=a.useSlots(),r=en(o,"modelValue",n),l=en(o,"nodes",n),s=en(o,"edges",n),u=de(o),c=gu({modelValue:r,nodes:l,edges:s},o,u);return mu(n,u.hooks),ac(),Mc(),a.provide(Xt,i),a.onUnmounted(()=>{c()}),t(u),(d,f)=>(a.openBlock(),a.createElementBlock("div",{ref:a.unref(u).vueFlowRef,class:"vue-flow"},[a.createVNode(tc,null,{default:a.withCtx(()=>[a.createVNode(wc),Ic,a.createVNode(kc),a.renderSlot(d.$slots,"zoom-pane")]),_:3}),a.renderSlot(d.$slots,"default"),a.createVNode(lc)],512))}}),$c=["id","d","marker-end"],Bc={class:"vue-flow__edge-label"},Dc={key:0,class:"label-input-wrapper"},Vc={inheritAttrs:!1},Ac=a.defineComponent({...Vc,__name:"EditableEdge",props:{id:{},sourceNode:{},targetNode:{},source:{},target:{},type:{},label:{},style:{},selected:{type:Boolean},sourcePosition:{},targetPosition:{},sourceHandleId:{},targetHandleId:{},animated:{type:Boolean},updatable:{type:Boolean},markerStart:{},markerEnd:{},curvature:{},interactionWidth:{},data:{},events:{},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{},sourceX:{},sourceY:{},targetX:{},targetY:{}},emits:["change"],setup(e,{emit:t}){const n=e,o=t,i=a.useTemplateRef("labelInput"),r=a.ref(""),l=a.ref(!1);let s=0;const u=async()=>{let g=Date.now();g-s<500&&!l.value&&await c(),s=g},c=async()=>{r.value=n.label,l.value=!0,await a.nextTick(),i.value.focus()},d=()=>{l.value=!1,o("change",r.value)},f=a.computed(()=>An(n));return(g,h)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("path",{id:g.id,style:a.normalizeStyle(g.style),class:"vue-flow__edge-path",d:f.value[0],"marker-end":g.markerEnd},null,12,$c),a.createVNode(a.unref(xc),null,{default:a.withCtx(()=>[a.createElementVNode("div",{style:a.normalizeStyle({pointerEvents:"all",position:"absolute",transform:`translate(-50%, -50%) translate(${f.value[1]}px,${f.value[2]}px)`}),class:"nodrag nopan editable-edge-label",onClick:h[2]||(h[2]=x=>u())},[a.createElementVNode("div",Bc,a.toDisplayString(g.label),1),l.value?(a.openBlock(),a.createElementBlock("div",Dc,[a.withDirectives(a.createElementVNode("input",{ref:"labelInput",class:"label-input","onUpdate:modelValue":h[0]||(h[0]=x=>r.value=x),onBlur:h[1]||(h[1]=x=>l.value=!1),onKeypress:a.withKeys(d,["enter"])},null,544),[[a.vModelText,r.value]])])):a.createCommentVNode("",!0)],4)]),_:1})],64))}}),Oc={key:0,class:"label-input-wrapper"},zc=a.defineComponent({__name:"EditableNode",props:{id:{},type:{},selected:{type:Boolean},connectable:{type:[Boolean,Number,String,Function]},position:{},dimensions:{},label:{},isValidTargetPos:{type:Function},isValidSourcePos:{type:Function},parent:{},parentNodeId:{},dragging:{type:Boolean},resizing:{type:Boolean},zIndex:{},targetPosition:{},sourcePosition:{},dragHandle:{},data:{},events:{}},emits:["change"],setup(e,{emit:t}){const n=e,o=t,i=a.useTemplateRef("labelInput"),r=a.ref(""),l=a.ref(!1);let s=0;const u=async()=>{let f=Date.now();f-s<500&&!l.value&&await c(),s=f},c=async()=>{r.value=n.label,l.value=!0,await a.nextTick(),i.value.focus()},d=()=>{l.value=!1,o("change",r.value)};return(f,g)=>(a.openBlock(),a.createElementBlock("div",{onClick:g[2]||(g[2]=h=>u())},[a.createElementVNode("div",null,a.toDisplayString(f.label),1),l.value?(a.openBlock(),a.createElementBlock("div",Oc,[a.withDirectives(a.createElementVNode("input",{ref:"labelInput",class:"label-input","onUpdate:modelValue":g[0]||(g[0]=h=>r.value=h),onBlur:g[1]||(g[1]=h=>l.value=!1),onKeypress:a.withKeys(d,["enter"])},null,544),[[a.vModelText,r.value]])])):a.createCommentVNode("",!0),f.data.hasInput?(a.openBlock(),a.createBlock(a.unref(Je),{key:1,id:"a",type:"target",position:f.targetPosition},null,8,["position"])):a.createCommentVNode("",!0),f.data.hasOutput?(a.openBlock(),a.createBlock(a.unref(Je),{key:2,id:"b",type:"source",position:f.sourcePosition},null,8,["position"])):a.createCommentVNode("",!0)]))}}),Rc={class:"chart-controls"},Hc={class:"chart-controls-left"},Lc={class:"chart-controls-right"},Fc={key:0},Yc={key:1},Rn=a.defineComponent({__name:"NodeEditor",props:{modelValue:{},nodeContainerClass:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t,o=a.ref(!1),i=a.ref([]),r=a.ref(),l=a.ref(""),s=a.computed(()=>(i.value.forEach((I,B)=>{if(I.id===l.value)return B}),-1)),u=a.computed({get:()=>{const I=e.modelValue;for(const B of I)B.data={},B.type==="input"?(B.data.hasInput=!1,B.data.hasOutput=!0):B.type==="output"?(B.data.hasInput=!0,B.data.hasOutput=!1):(B.data.hasInput=!0,B.data.hasOutput=!0),B.class="vue-flow__node-default",B.type="editable";for(const B of I)B.events={click:()=>{l.value=B.id}};return I},set:I=>{n("update:modelValue",JSON.parse(JSON.stringify(I)))}}),{onConnect:c,addEdges:d,onEdgeContextMenu:f,onPaneReady:g,removeEdges:h}=de();a.onMounted(()=>{document.removeEventListener("keypress",M),document.addEventListener("keypress",M)}),a.onBeforeUnmount(()=>{document.removeEventListener("keypress",M)}),g(I=>{r.value=I}),i.value=u.value;const x=I=>({[R.Top]:R.Right,[R.Right]:R.Bottom,[R.Bottom]:R.Left,[R.Left]:R.Top})[I],b=()=>{if(s.value>-1){const I=i.value[s.value];I.sourcePosition=x(I.sourcePosition)}},N=()=>{if(s.value>-1){const I=i.value[s.value];I.targetPosition=x(I.targetPosition)}},k=I=>{window.scrollBy(0,I.deltaY)},M=I=>{o.value&&I.ctrlKey==!0&&((I.key=="+"||I.key=="=")&&r.value.zoomIn(),I.key=="-"&&r.value.zoomOut())},_=async()=>{await r.value.fitView()},C=()=>{let I=!1,B={x:Math.random()*200,y:Math.random()*200};if(s.value>-1){const E=i.value[s.value];E.data.hasOutput&&(B={x:E.position.x+200,y:E.position.y+50},I=!0)}const A=i.value.length,D=`node-${A}`;if(i.value.push({id:D,label:"Node "+A,sourcePosition:R.Right,targetPosition:R.Left,class:"vue-flow__node-default",type:"editable",data:{hasInput:!0,hasOutput:!0},events:{click:()=>{l.value=D}},position:B}),I){let E=`edge-${A+1}`;i.value.push({id:E,source:l.value,target:D,type:"editable",label:`EDGE ${A+1}`,animated:!0,events:{click:()=>{l.value=E}}})}},O=(I,B)=>{for(let A=0;A<i.value.length;A++)if(i.value[A].id==B){i.value[A].label=I;break}};c(I=>{const A={id:`edge-${i.value.length}`,source:I.source,target:I.target,type:"editable",label:"New Edge",interactionWidth:400,animated:!0,events:{click:()=>{l.value=A.id}}};d([A])});const Y=I=>{h(I)};return f(({event:I,edge:B})=>{Y(B.id)}),(I,B)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["node-editor-wrapper",I.nodeContainerClass]),onMouseover:B[1]||(B[1]=A=>o.value=!0),onMouseleave:B[2]||(B[2]=A=>o.value=!1)},[a.createElementVNode("div",Rc,[a.createElementVNode("div",Hc,[a.createElementVNode("div",null,[B[3]||(B[3]=a.createElementVNode("b",null,"Selected Node:",-1)),a.createTextVNode(" "+a.toDisplayString(l.value?l.value:"none"),1)])]),a.createElementVNode("div",Lc,[a.createElementVNode("div",null,[a.createElementVNode("button",{class:"button-default",onClick:C},"Add Node")]),a.createElementVNode("div",null,[a.createElementVNode("button",{class:"button-default",onClick:_},"Center")]),s.value>-1?(a.openBlock(),a.createElementBlock("div",Fc,[a.createElementVNode("button",{class:"button-default",onClick:N},"Shift Input Position")])):a.createCommentVNode("",!0),s.value>-1?(a.openBlock(),a.createElementBlock("div",Yc,[a.createElementVNode("button",{class:"button-default",onClick:b},"Shift Output Position")])):a.createCommentVNode("",!0)])]),i.value&&i.value.length?(a.openBlock(),a.createBlock(a.unref(Pc),{key:0,class:"nowheel","prevent-scrolling":!0,"zoom-on-scroll":!1,"fit-view-on-init":!0,modelValue:i.value,"onUpdate:modelValue":B[0]||(B[0]=A=>i.value=A),onWheel:a.withModifiers(k,["prevent"])},{"node-editable":a.withCtx(A=>[a.createVNode(zc,a.mergeProps(A,{onChange:D=>O(D,A.id)}),null,16,["onChange"])]),"edge-editable":a.withCtx(A=>[a.createVNode(Ac,a.mergeProps(A,{onChange:D=>O(D,A.id)}),null,16,["onChange"])]),_:1},8,["modelValue"])):a.createCommentVNode("",!0)],34))}}),Pi=a.defineComponent({__name:"StateEditor",props:a.mergeModels({layout:{},nodeContainerClass:{}},{modelValue:{},modelModifiers:{}}),emits:a.mergeModels(["update:modelValue"],["update:modelValue"]),setup(e,{emit:t}){const n=t,o=a.useModel(e,"modelValue"),i=a.computed({get:()=>{var d,f,g;const l={},s=[],u={};if(!o.value)return s;let c=0;for(const[h,x]of Object.entries(o.value)){const b={id:h,label:h,position:((d=e.layout[h])==null?void 0:d.position)||{x:200*c,y:100},targetPosition:((f=e.layout[h])==null?void 0:f.targetPosition)||R.Left,sourcePosition:((g=e.layout[h])==null?void 0:g.sourcePosition)||R.Right};(x==null?void 0:x.type)==="final"&&(b.type="output",b.class="default-output-node"),u[h]=b}for(const[h,x]of Object.entries(o.value)){if(x!=null&&x.on)for(const[b,N]of Object.entries(x.on)){const k=N.target||N;s.push({id:`${h}-${k}`,source:h,target:k,label:b,animated:!0}),l[k]=!0}c++}for(const[h,x]of Object.entries(u))l[h]||(x.type="input",x.class="default-input-node"),s.push(x);return s},set:l=>{r(l)}}),r=l=>{const s={},u={},c={};for(const d of l){const f=d.label;d.type==="input"?c[f]={on:{}}:d.type==="output"?c[f]={type:"final"}:d.source&&d.target?(s[d.source]=s[d.source]||{},s[d.source][f]={target:d.target}):c[f]={on:{}},u[d.id]=f}for(const[d,f]of Object.entries(s)){const g=u[d];for(const[h,x]of Object.entries(f))c[g]||(c[g]={on:{}}),c[g].on[h]=x}n("update:modelValue",c)};return(l,s)=>(a.openBlock(),a.createElementBlock("div",null,[a.createVNode(Rn,{modelValue:i.value,"onUpdate:modelValue":s[0]||(s[0]=u=>i.value=u),"node-container-class":l.nodeContainerClass},null,8,["modelValue","node-container-class"])]))}});function Gc(e){e.component("NodeEditor",Rn),e.component("StateEditor",Pi)}Ce.NodeEditor=Rn,Ce.StateEditor=Pi,Ce.install=Gc,Object.defineProperty(Ce,Symbol.toStringTag,{value:"Module"})});
|
|
26
|
+
Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead"};class ge extends Error{constructor(t,...n){var o;super((o=li[t])==null?void 0:o.call(li,...n)),this.name="VueFlowError",this.code=t,this.args=n}}function Mn(e){return"clientX"in e}function Xs(e){return"sourceEvent"in e}function Se(e,t){const n=Mn(e);let o,i;return n?(o=e.clientX,i=e.clientY):"touches"in e&&e.touches.length>0?(o=e.touches[0].clientX,i=e.touches[0].clientY):"changedTouches"in e&&e.changedTouches.length>0?(o=e.changedTouches[0].clientX,i=e.changedTouches[0].clientY):(o=0,i=0),{x:o-(t?.left??0),y:i-(t?.top??0)}}const Ft=()=>{var e;return typeof navigator<"u"&&((e=navigator?.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Us(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 Yt(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}const Zs=()=>!0;function In(e){e?.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function Ws(e,t,n){const o=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const r of t.values())Rt(i,zt(r))>0&&o.push(r);return o}const Ks=250;function qs(e,t,n,o){var i,r;let l=[],s=Number.POSITIVE_INFINITY;const u=Ws(e,n,t+Ks);for(const c of u){const d=[...((i=c.handleBounds)==null?void 0:i.source)??[],...((r=c.handleBounds)==null?void 0:r.target)??[]];for(const f of d){if(o.nodeId===f.nodeId&&o.type===f.type&&o.id===f.id)continue;const{x:h,y:p}=je(c,f,f.position,!0),S=Math.sqrt((h-e.x)**2+(p-e.y)**2);S>t||(S<s?(l=[{...f,x:h,y:p}],s=S):S===s&&l.push({...f,x:h,y:p}))}}if(!l.length)return null;if(l.length>1){const c=o.type==="source"?"target":"source";return l.find(d=>d.type===c)??l[0]}return l[0]}function ai(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:i,fromType:r,doc:l,lib:s,flowId:u,isValidConnection:c=Zs},d,f,h){const p=r==="target",S=t?l.querySelector(`.${s}-flow__handle[data-id="${u}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x,y:N}=Se(e),k=l.elementFromPoint(x,N),M=k?.classList.contains(`${s}-flow__handle`)?k:S,_={handleDomNode:M,isValid:!1,connection:null,toHandle:null};if(M){const C=si(void 0,M),O=M.getAttribute("data-nodeid"),G=M.getAttribute("data-handleid"),Y=M.classList.contains("connectable"),I=M.classList.contains("connectableend");if(!O||!C)return _;const B={source:p?O:o,sourceHandle:p?G:i,target:p?o:O,targetHandle:p?i:G};_.connection=B;const D=Y&&I&&(n===Pe.Strict?p&&C==="source"||!p&&C==="target":O!==o||G!==i);_.isValid=D&&c(B,{nodes:f,edges:d,sourceNode:h(o),targetNode:h(O)}),_.toHandle=t}return _}function si(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function js(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function Js(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function Qs(e,t,n,o,i,r=!1){var l,s,u;const c=o.get(e);if(!c)return null;const d=i===Pe.Strict?(l=c.handleBounds)==null?void 0:l[t]:[...((s=c.handleBounds)==null?void 0:s.source)??[],...((u=c.handleBounds)==null?void 0:u.target)??[]],f=(n?d?.find(h=>h.id===n):d?.[0])??null;return f&&r?{...f,...je(c,f,f.position,!0)}:f}const Tn={[R.Left]:R.Right,[R.Right]:R.Left,[R.Top]:R.Bottom,[R.Bottom]:R.Top},eu=["production","prod"];function Gt(e,...t){ui()&&console.warn(`[Vue Flow]: ${e}`,...t)}function ui(){return!eu.includes(process.env.NODE_ENV||"")}function ci(e,t,n,o,i){const r=t.querySelectorAll(`.vue-flow__handle.${e}`);return r?.length?Array.from(r).map(l=>{const s=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),type:e,nodeId:i,position:l.getAttribute("data-handlepos"),x:(s.left-n.left)/o,y:(s.top-n.top)/o,...Ht(l)}}):null}function Pn(e,t,n,o,i,r=!1,l){i.value=!1,e.selected?(r||e.selected&&t)&&(o([e]),a.nextTick(()=>{l.blur()})):n([e])}function he(e){return typeof a.unref(e)<"u"}function tu(e,t,n,o){if(!e||!e.source||!e.target)return n(new ge(fe.EDGE_INVALID,e?.id??"[ID UNKNOWN]")),!1;let i;return $e(e)?i=e:i={...e,id:Go(e)},i=Fo(i,void 0,o),Vs(i,t)?!1:i}function nu(e,t,n,o,i){if(!t.source||!t.target)return i(new ge(fe.EDGE_INVALID,e.id)),!1;if(!n)return i(new ge(fe.EDGE_NOT_FOUND,e.id)),!1;const{id:r,...l}=e;return{...l,id:o?Go(t):r,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function di(e,t,n){const o={},i=[];for(let r=0;r<e.length;++r){const l=e[r];if(!Fe(l)){n(new ge(fe.NODE_INVALID,l?.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const s=$s(l,t(l.id),l.parentNode);l.parentNode&&(o[l.parentNode]=!0),i[r]=s}for(const r of i){const l=t(r.parentNode)||i.find(s=>s.id===r.parentNode);r.parentNode&&!l&&n(new ge(fe.NODE_MISSING_PARENT,r.id,r.parentNode)),(r.parentNode||o[r.id])&&(o[r.id]&&(r.isParent=!0),l&&(l.isParent=!0))}return i}function fi(e,t,n,o,i,r){let l=i;const s=o.get(l)||new Map;o.set(l,s.set(n,t)),l=`${i}-${e}`;const u=o.get(l)||new Map;if(o.set(l,u.set(n,t)),r){l=`${i}-${e}-${r}`;const c=o.get(l)||new Map;o.set(l,c.set(n,t))}}function $n(e,t,n){e.clear();for(const o of n){const{source:i,target:r,sourceHandle:l=null,targetHandle:s=null}=o,u={edgeId:o.id,source:i,target:r,sourceHandle:l,targetHandle:s},c=`${i}-${l}--${r}-${s}`,d=`${r}-${s}--${i}-${l}`;fi("source",u,d,e,i,l),fi("target",u,c,e,r,s)}}function hi(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Bn(e,t,n,o,i,r,l,s){const u=[];for(const c of e){const d=$e(c)?c:tu(c,s,i,r);if(!d)continue;const f=n(d.source),h=n(d.target);if(!f||!h){i(new ge(fe.EDGE_SOURCE_TARGET_MISSING,d.id,d.source,d.target));continue}if(!f){i(new ge(fe.EDGE_SOURCE_MISSING,d.id,d.source));continue}if(!h){i(new ge(fe.EDGE_TARGET_MISSING,d.id,d.target));continue}if(t&&!t(d,{edges:s,nodes:l,sourceNode:f,targetNode:h})){i(new ge(fe.EDGE_INVALID,d.id));continue}const p=o(d.id);u.push({...Fo(d,p,r),sourceNode:f,targetNode:h})}return u}const gi=Symbol("vueFlow"),pi=Symbol("nodeId"),mi=Symbol("nodeRef"),ou=Symbol("edgeId"),iu=Symbol("edgeRef"),Xt=Symbol("slots");function yi(e){const{vueFlowRef:t,snapToGrid:n,snapGrid:o,noDragClassName:i,nodes:r,nodeExtent:l,nodeDragThreshold:s,viewport:u,autoPanOnNodeDrag:c,autoPanSpeed:d,nodesDraggable:f,panBy:h,findNode:p,multiSelectionActive:S,nodesSelectionActive:x,selectNodesOnDrag:N,removeSelectedElements:k,addSelectedNodes:M,updateNodePositions:_,emits:C}=de(),{onStart:O,onDrag:G,onStop:Y,onClick:I,el:B,disabled:A,id:D,selectable:E,dragHandle:W}=e,w=a.shallowRef(!1);let P=[],b,$=null,V={x:void 0,y:void 0},H={x:0,y:0},z=null,K=!1,Q=0,oe=!1;const F=au(),X=({x:J,y:ne})=>{V={x:J,y:ne};let ie=!1;if(P=P.map(m=>{const g={x:J-m.distance.x,y:ne-m.distance.y},{computedPosition:v}=kn(m,n.value?Yt(g,o.value):g,C.error,l.value,m.parentNode?p(m.parentNode):void 0);return ie=ie||m.position.x!==v.x||m.position.y!==v.y,m.position=v,m}),!!ie&&(_(P,!0,!0),w.value=!0,z)){const[m,g]=Cn({id:D,dragItems:P,findNode:p});G({event:z,node:m,nodes:g})}},j=()=>{if(!$)return;const[J,ne]=Jo(H,$,d.value);if(J!==0||ne!==0){const ie={x:(V.x??0)-J/u.value.zoom,y:(V.y??0)-ne/u.value.zoom};h({x:J,y:ne})&&X(ie)}Q=requestAnimationFrame(j)},le=(J,ne)=>{K=!0;const ie=p(D);!N.value&&!S.value&&ie&&(ie.selected||k()),ie&&a.toValue(E)&&N.value&&Pn(ie,S.value,M,k,x,!1,ne);const m=F(J.sourceEvent);if(V=m,P=Rs(r.value,f.value,m,p,D),P.length){const[g,v]=Cn({id:D,dragItems:P,findNode:p});O({event:J.sourceEvent,node:g,nodes:v})}},ae=(J,ne)=>{var ie;J.sourceEvent.type==="touchmove"&&J.sourceEvent.touches.length>1||(s.value===0&&le(J,ne),V=F(J.sourceEvent),$=((ie=t.value)==null?void 0:ie.getBoundingClientRect())||null,H=Se(J.sourceEvent,$))},te=(J,ne)=>{const ie=F(J.sourceEvent);if(!oe&&K&&c.value&&(oe=!0,j()),!K){const m=ie.xSnapped-(V.x??0),g=ie.ySnapped-(V.y??0);Math.sqrt(m*m+g*g)>s.value&&le(J,ne)}(V.x!==ie.xSnapped||V.y!==ie.ySnapped)&&P.length&&K&&(z=J.sourceEvent,H=Se(J.sourceEvent,$),X(ie))},ue=J=>{let ne=!1;if(!K&&!w.value&&!S.value){const ie=J.sourceEvent,m=F(ie),g=m.xSnapped-(V.x??0),v=m.ySnapped-(V.y??0),y=Math.sqrt(g*g+v*v);y!==0&&y<=s.value&&(I?.(ie),ne=!0)}if(P.length&&!ne){_(P,!1,!1);const[ie,m]=Cn({id:D,dragItems:P,findNode:p});Y({event:J.sourceEvent,node:ie,nodes:m})}P=[],w.value=!1,oe=!1,K=!1,V={x:void 0,y:void 0},cancelAnimationFrame(Q)};return a.watch([()=>a.toValue(A),B],([J,ne],ie,m)=>{if(ne){const g=ye(ne);J||(b=Pl().on("start",v=>ae(v,ne)).on("drag",v=>te(v,ne)).on("end",v=>ue(v)).filter(v=>{const y=v.target,T=a.toValue(W);return!v.button&&(!i.value||!oi(y,`.${i.value}`,ne)&&(!T||oi(y,T,ne)))}),g.call(b)),m(()=>{g.on(".drag",null),b&&(b.on("start",null),b.on("drag",null),b.on("end",null))})}}),w}function ru(){return{doubleClick:L(),click:L(),mouseEnter:L(),mouseMove:L(),mouseLeave:L(),contextMenu:L(),updateStart:L(),update:L(),updateEnd:L()}}function lu(e,t){const n=ru();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 au(){const{viewport:e,snapGrid:t,snapToGrid:n,vueFlowRef:o}=de();return i=>{var r;const l=((r=o.value)==null?void 0:r.getBoundingClientRect())??{left:0,top:0},s=Xs(i)?i.sourceEvent:i,{x:u,y:c}=Se(s,l),d=ht({x:u,y:c},e.value),{x:f,y:h}=n.value?Yt(d,t.value):d;return{xSnapped:f,ySnapped:h,...d}}}function Ut(){return!0}function vi({handleId:e,nodeId:t,type:n,isValidConnection:o,edgeUpdaterType:i,onEdgeUpdate:r,onEdgeUpdateEnd:l}){const{id:s,vueFlowRef:u,connectionMode:c,connectionRadius:d,connectOnClick:f,connectionClickStartHandle:h,nodesConnectable:p,autoPanOnConnect:S,autoPanSpeed:x,findNode:N,panBy:k,startConnection:M,updateConnection:_,endConnection:C,emits:O,viewport:G,edges:Y,nodes:I,isValidConnection:B,nodeLookup:A}=de();let D=null,E=!1,W=null;function w(b){var $;const V=a.toValue(n)==="target",H=Mn(b),z=Lo(b.target);if(H&&b.button===0||!H){let K=function(ee){m=Se(ee,J),X=qs(ht(m,G.value,!1,[1,1]),d.value,A.value,y),g||(v(),g=!0);const re=ai(ee,{handle:X,connectionMode:c.value,fromNodeId:a.toValue(t),fromHandleId:a.toValue(e),fromType:V?"target":"source",isValidConnection:F,doc:z,lib:"vue",flowId:s,nodeLookup:A.value},Y.value,I.value,N);W=re.handleDomNode,D=re.connection,E=Js(!!X,re.isValid);const se={...Z,isValid:E,to:re.toHandle&&E?Sn({x:re.toHandle.x,y:re.toHandle.y},G.value):m,toHandle:re.toHandle,toPosition:E&&re.toHandle?re.toHandle.position:Tn[y.position],toNode:re.toHandle?A.value.get(re.toHandle.nodeId):null};if(!(E&&X&&Z?.toHandle&&se.toHandle&&Z.toHandle.type===se.toHandle.type&&Z.toHandle.nodeId===se.toHandle.nodeId&&Z.toHandle.id===se.toHandle.id&&Z.to.x===se.to.x&&Z.to.y===se.to.y)){if(_(X&&E?Sn({x:X.x,y:X.y},G.value):m,re.toHandle,js(!!X,E)),Z=se,!X&&!E&&!W)return In(ie);D&&D.source!==D.target&&W&&(In(ie),ie=W,W.classList.add("connecting","vue-flow__handle-connecting"),W.classList.toggle("valid",!!E),W.classList.toggle("vue-flow__handle-valid",!!E))}},Q=function(ee){(X||W)&&D&&E&&(r?r(ee,D):O.connect(D)),O.connectEnd(ee),i&&l?.(ee),In(ie),cancelAnimationFrame(j),C(ee),g=!1,E=!1,D=null,W=null,z.removeEventListener("mousemove",K),z.removeEventListener("mouseup",Q),z.removeEventListener("touchmove",K),z.removeEventListener("touchend",Q)};const oe=N(a.toValue(t));let F=a.toValue(o)||B.value||Ut;!F&&oe&&(F=(V?oe.isValidSourcePos:oe.isValidTargetPos)||Ut);let X,j=0;const{x:le,y:ae}=Se(b),te=z?.elementFromPoint(le,ae),ue=si(a.toValue(i),te),J=($=u.value)==null?void 0:$.getBoundingClientRect();if(!J||!ue)return;const ne=Qs(a.toValue(t),ue,a.toValue(e),A.value,c.value);if(!ne)return;let ie,m=Se(b,J),g=!1;const v=()=>{if(!S.value)return;const[ee,re]=Jo(m,J,x.value);k({x:ee,y:re}),j=requestAnimationFrame(v)},y={...ne,nodeId:a.toValue(t),type:ue,position:ne.position},T=A.value.get(a.toValue(t)),U={inProgress:!0,isValid:null,from:je(T,y,R.Left,!0),fromHandle:y,fromPosition:y.position,fromNode:T,to:m,toHandle:null,toPosition:Tn[y.position],toNode:null};M({nodeId:a.toValue(t),id:a.toValue(e),type:ue,position:te?.getAttribute("data-handlepos")||R.Top,...m},{x:le-J.left,y:ae-J.top}),O.connectStart({event:b,nodeId:a.toValue(t),handleId:a.toValue(e),handleType:ue});let Z=U;z.addEventListener("mousemove",K),z.addEventListener("mouseup",Q),z.addEventListener("touchmove",K),z.addEventListener("touchend",Q)}}function P(b){var $,V;if(!f.value)return;const H=a.toValue(n)==="target";if(!h.value){O.clickConnectStart({event:b,nodeId:a.toValue(t),handleId:a.toValue(e)}),M({nodeId:a.toValue(t),type:a.toValue(n),id:a.toValue(e),position:R.Top,...Se(b)},void 0,!0);return}let z=a.toValue(o)||B.value||Ut;const K=N(a.toValue(t));if(!z&&K&&(z=(H?K.isValidSourcePos:K.isValidTargetPos)||Ut),K&&(typeof K.connectable>"u"?p.value:K.connectable)===!1)return;const Q=Lo(b.target),oe=ai(b,{handle:{nodeId:a.toValue(t),id:a.toValue(e),type:a.toValue(n),position:R.Top,...Se(b)},connectionMode:c.value,fromNodeId:h.value.nodeId,fromHandleId:h.value.id??null,fromType:h.value.type,isValidConnection:z,doc:Q,lib:"vue",flowId:s,nodeLookup:A.value},Y.value,I.value,N),F=(($=oe.connection)==null?void 0:$.source)===((V=oe.connection)==null?void 0:V.target);oe.isValid&&oe.connection&&!F&&O.connect(oe.connection),O.clickConnectEnd(b),C(b,!0)}return{handlePointerDown:w,handleClick:P}}function su(){return a.inject(pi,"")}function wi(e){const t=e??su()??"",n=a.inject(mi,a.ref(null)),{findNode:o,edges:i,emits:r}=de(),l=o(t);return l||r.error(new ge(fe.NODE_NOT_FOUND,t)),{id:t,nodeEl:n,node:l,parentNode:a.computed(()=>o(l.parentNode)),connectedEdges:a.computed(()=>Wo([l],i.value))}}function uu(){return{doubleClick:L(),click:L(),mouseEnter:L(),mouseMove:L(),mouseLeave:L(),contextMenu:L(),dragStart:L(),drag:L(),dragStop:L()}}function cu(e,t){const n=uu();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 _i(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:n,findNode:o,snapGrid:i,snapToGrid:r,nodesDraggable:l,emits:s}=de();return(u,c=!1)=>{const d=r.value?i.value[0]:5,f=r.value?i.value[1]:5,h=c?4:1,p=u.x*d*h,S=u.y*f*h,x=[];for(const N of e.value)if(N.draggable||l&&typeof N.draggable>"u"){const k={x:N.computedPosition.x+p,y:N.computedPosition.y+S},{computedPosition:M}=kn(N,k,s.error,t.value,N.parentNode?o(N.parentNode):void 0);x.push({id:N.id,position:M,from:N.position,distance:{x:u.x,y:u.y},dimensions:N.dimensions})}n(x,!0,!1)}}const Dn=.1,du=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function Ve(){return Gt("Viewport not initialized yet."),Promise.resolve(!1)}const fu={zoomIn:Ve,zoomOut:Ve,zoomTo:Ve,fitView:Ve,setCenter:Ve,fitBounds:Ve,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Ve,setTransform:Ve,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function hu(e){function t(o,i){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate(i?.interpolate==="linear"?it:Mt).scaleBy(Vn(e.d3Selection,i?.duration,i?.ease,()=>{r(!0)}),o):r(!1)})}function n(o,i,r,l){return new Promise(s=>{var u;const{x:c,y:d}=Ho({x:-o,y:-i},e.translateExtent),f=Ke.translate(-c,-d).scale(r);e.d3Selection&&e.d3Zoom?(u=e.d3Zoom)==null||u.interpolate(l?.interpolate==="linear"?it:Mt).transform(Vn(e.d3Selection,l?.duration,l?.ease,()=>{s(!0)}),f):s(!1)})}return a.computed(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:i=>t(1.2,i),zoomOut:i=>t(1/1.2,i),zoomTo:(i,r)=>new Promise(l=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate(r?.interpolate==="linear"?it:Mt).scaleTo(Vn(e.d3Selection,r?.duration,r?.ease,()=>{l(!0)}),i):l(!1)}),setViewport:(i,r)=>n(i.x,i.y,i.zoom,r),setTransform:(i,r)=>n(i.x,i.y,i.zoom,r),getViewport:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),getTransform:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),fitView:(i={padding:Dn,includeHiddenNodes:!1,duration:0})=>{var r,l;const s=[];for(const h of e.nodes)h.dimensions.width&&h.dimensions.height&&(i?.includeHiddenNodes||!h.hidden)&&(!((r=i.nodes)!=null&&r.length)||(l=i.nodes)!=null&&l.length&&i.nodes.includes(h.id))&&s.push(h);if(!s.length)return Promise.resolve(!1);const u=Uo(s),{x:c,y:d,zoom:f}=Ko(u,e.dimensions.width,e.dimensions.height,i.minZoom??e.minZoom,i.maxZoom??e.maxZoom,i.padding??Dn,i.offset);return n(c,d,f,i)},setCenter:(i,r,l)=>{const s=typeof l?.zoom<"u"?l.zoom:e.maxZoom,u=e.dimensions.width/2-i*s,c=e.dimensions.height/2-r*s;return n(u,c,s,l)},fitBounds:(i,r={padding:Dn})=>{const{x:l,y:s,zoom:u}=Ko(i,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding);return n(l,s,u,r)},project:i=>ht(i,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:i=>{if(e.vueFlowRef){const{x:r,y:l}=e.vueFlowRef.getBoundingClientRect(),s={x:i.x-r,y:i.y-l};return ht(s,e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:i=>{if(e.vueFlowRef){const{x:r,y:l}=e.vueFlowRef.getBoundingClientRect(),s={x:i.x+r,y:i.y+l};return Sn(s,e.viewport)}return{x:0,y:0}}}:fu)}function Vn(e,t=0,n=du,o=()=>{}){const i=typeof t=="number"&&t>0;return i||o(),i?e.transition().duration(t).ease(n).on("end",o):e}function gu(e,t,n){const o=a.effectScope(!0);return o.run(()=>{const i=()=>{o.run(()=>{let x,N,k=!!(n.nodes.value.length||n.edges.value.length);x=Ge([e.modelValue,()=>{var M,_;return(_=(M=e.modelValue)==null?void 0:M.value)==null?void 0:_.length}],([M])=>{M&&Array.isArray(M)&&(N?.pause(),n.setElements(M),!N&&!k&&M.length?k=!0:N?.resume())}),N=Ge([n.nodes,n.edges,()=>n.edges.value.length,()=>n.nodes.value.length],([M,_])=>{var C;(C=e.modelValue)!=null&&C.value&&Array.isArray(e.modelValue.value)&&(x?.pause(),e.modelValue.value=[...M,..._],a.nextTick(()=>{x?.resume()}))},{immediate:k}),a.onScopeDispose(()=>{x?.stop(),N?.stop()})})},r=()=>{o.run(()=>{let x,N,k=!!n.nodes.value.length;x=Ge([e.nodes,()=>{var M,_;return(_=(M=e.nodes)==null?void 0:M.value)==null?void 0:_.length}],([M])=>{M&&Array.isArray(M)&&(N?.pause(),n.setNodes(M),!N&&!k&&M.length?k=!0:N?.resume())}),N=Ge([n.nodes,()=>n.nodes.value.length],([M])=>{var _;(_=e.nodes)!=null&&_.value&&Array.isArray(e.nodes.value)&&(x?.pause(),e.nodes.value=[...M],a.nextTick(()=>{x?.resume()}))},{immediate:k}),a.onScopeDispose(()=>{x?.stop(),N?.stop()})})},l=()=>{o.run(()=>{let x,N,k=!!n.edges.value.length;x=Ge([e.edges,()=>{var M,_;return(_=(M=e.edges)==null?void 0:M.value)==null?void 0:_.length}],([M])=>{M&&Array.isArray(M)&&(N?.pause(),n.setEdges(M),!N&&!k&&M.length?k=!0:N?.resume())}),N=Ge([n.edges,()=>n.edges.value.length],([M])=>{var _;(_=e.edges)!=null&&_.value&&Array.isArray(e.edges.value)&&(x?.pause(),e.edges.value=[...M],a.nextTick(()=>{x?.resume()}))},{immediate:k}),a.onScopeDispose(()=>{x?.stop(),N?.stop()})})},s=()=>{o.run(()=>{a.watch(()=>t.maxZoom,()=>{t.maxZoom&&he(t.maxZoom)&&n.setMaxZoom(t.maxZoom)},{immediate:!0})})},u=()=>{o.run(()=>{a.watch(()=>t.minZoom,()=>{t.minZoom&&he(t.minZoom)&&n.setMinZoom(t.minZoom)},{immediate:!0})})},c=()=>{o.run(()=>{a.watch(()=>t.translateExtent,()=>{t.translateExtent&&he(t.translateExtent)&&n.setTranslateExtent(t.translateExtent)},{immediate:!0})})},d=()=>{o.run(()=>{a.watch(()=>t.nodeExtent,()=>{t.nodeExtent&&he(t.nodeExtent)&&n.setNodeExtent(t.nodeExtent)},{immediate:!0})})},f=()=>{o.run(()=>{a.watch(()=>t.applyDefault,()=>{he(t.applyDefault)&&(n.applyDefault.value=t.applyDefault)},{immediate:!0})})},h=()=>{o.run(()=>{const x=async N=>{let k=N;typeof t.autoConnect=="function"&&(k=await t.autoConnect(N)),k!==!1&&n.addEdges([k])};a.watch(()=>t.autoConnect,()=>{he(t.autoConnect)&&(n.autoConnect.value=t.autoConnect)},{immediate:!0}),a.watch(n.autoConnect,(N,k,M)=>{N?n.onConnect(x):n.hooks.value.connect.off(x),M(()=>{n.hooks.value.connect.off(x)})},{immediate:!0})})},p=()=>{const x=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const N of Object.keys(t)){const k=N;if(!x.includes(k)){const M=a.toRef(()=>t[k]),_=n[k];a.isRef(_)&&o.run(()=>{a.watch(M,C=>{he(C)&&(_.value=C)},{immediate:!0})})}}};(()=>{i(),r(),l(),u(),s(),c(),d(),f(),h(),p()})()}),()=>o.stop()}function pu(){return{edgesChange:L(),nodesChange:L(),nodeDoubleClick:L(),nodeClick:L(),nodeMouseEnter:L(),nodeMouseMove:L(),nodeMouseLeave:L(),nodeContextMenu:L(),nodeDragStart:L(),nodeDrag:L(),nodeDragStop:L(),nodesInitialized:L(),miniMapNodeClick:L(),miniMapNodeDoubleClick:L(),miniMapNodeMouseEnter:L(),miniMapNodeMouseMove:L(),miniMapNodeMouseLeave:L(),connect:L(),connectStart:L(),connectEnd:L(),clickConnectStart:L(),clickConnectEnd:L(),paneReady:L(),init:L(),move:L(),moveStart:L(),moveEnd:L(),selectionDragStart:L(),selectionDrag:L(),selectionDragStop:L(),selectionContextMenu:L(),selectionStart:L(),selectionEnd:L(),viewportChangeStart:L(),viewportChange:L(),viewportChangeEnd:L(),paneScroll:L(),paneClick:L(),paneContextMenu:L(),paneMouseEnter:L(),paneMouseMove:L(),paneMouseLeave:L(),edgeContextMenu:L(),edgeMouseEnter:L(),edgeMouseMove:L(),edgeMouseLeave:L(),edgeDoubleClick:L(),edgeClick:L(),edgeUpdateStart:L(),edgeUpdate:L(),edgeUpdateEnd:L(),updateNodeInternals:L(),error:L(e=>Gt(e.message))}}function mu(e,t){a.onBeforeMount(()=>{for(const[n,o]of Object.entries(t.value)){const i=r=>{e(n,r)};o.fns.add(i),mt(()=>{o.off(i)})}})}function Ei(){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:En.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:ct.Free,paneClickDistance:0,panOnDrag:!0,edgeUpdaterRadius:10,onlyRenderVisibleElements:!1,defaultViewport:{x:0,y:0,zoom:1},nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,defaultMarkerColor:"#b1b1b7",connectionLineStyle:{},connectionLineType:null,connectionLineOptions:{type:He.Bezier,style:{}},connectionMode:Pe.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:Ft()?"Meta":"Control",zoomActivationKeyCode:Ft()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:pu(),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 yu=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function vu(e,t,n){const o=hu(e),i=m=>{const g=m??[];e.hooks.updateNodeInternals.trigger(g)},r=m=>Ds(m,e.nodes,e.edges),l=m=>Bs(m,e.nodes,e.edges),s=m=>Wo(m,e.edges),u=({id:m,type:g,nodeId:v})=>{var y;return Array.from(((y=e.connectionLookup.get(`${v}-${g}-${m??null}`))==null?void 0:y.values())??[])},c=m=>{if(m)return t.value.get(m)},d=m=>{if(m)return n.value.get(m)},f=(m,g,v)=>{var y,T;const q=[];for(const U of m){const Z={id:U.id,type:"position",dragging:v,from:U.from};if(g&&(Z.position=U.position,U.parentNode)){const ee=c(U.parentNode);Z.position={x:Z.position.x-(((y=ee?.computedPosition)==null?void 0:y.x)??0),y:Z.position.y-(((T=ee?.computedPosition)==null?void 0:T.y)??0)}}q.push(Z)}q?.length&&e.hooks.nodesChange.trigger(q)},h=m=>{if(!e.vueFlowRef)return;const g=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!g)return;const v=window.getComputedStyle(g),{m22:y}=new window.DOMMatrixReadOnly(v.transform),T=[];for(const q of m){const U=q,Z=c(U.id);if(Z){const ee=Ht(U.nodeElement);if(!!(ee.width&&ee.height&&(Z.dimensions.width!==ee.width||Z.dimensions.height!==ee.height||U.forceUpdate))){const se=U.nodeElement.getBoundingClientRect();Z.dimensions=ee,Z.handleBounds.source=ci("source",U.nodeElement,se,y,Z.id),Z.handleBounds.target=ci("target",U.nodeElement,se,y,Z.id),T.push({id:Z.id,type:"dimensions",dimensions:ee})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&o.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),T.length&&e.hooks.nodesChange.trigger(T)},p=(m,g)=>{const v=new Set,y=new Set;for(const U of m)Fe(U)?v.add(U.id):$e(U)&&y.add(U.id);const T=De(t.value,v,!0),q=De(n.value,y);if(e.multiSelectionActive){for(const U of v)T.push(Be(U,g));for(const U of y)q.push(Be(U,g))}T.length&&e.hooks.nodesChange.trigger(T),q.length&&e.hooks.edgesChange.trigger(q)},S=m=>{if(e.multiSelectionActive){const g=m.map(v=>Be(v.id,!0));e.hooks.nodesChange.trigger(g);return}e.hooks.nodesChange.trigger(De(t.value,new Set(m.map(g=>g.id)),!0)),e.hooks.edgesChange.trigger(De(n.value))},x=m=>{if(e.multiSelectionActive){const g=m.map(v=>Be(v.id,!0));e.hooks.edgesChange.trigger(g);return}e.hooks.edgesChange.trigger(De(n.value,new Set(m.map(g=>g.id)))),e.hooks.nodesChange.trigger(De(t.value,new Set,!0))},N=m=>{p(m,!0)},k=m=>{const v=(m||e.nodes).map(y=>(y.selected=!1,Be(y.id,!1)));e.hooks.nodesChange.trigger(v)},M=m=>{const v=(m||e.edges).map(y=>(y.selected=!1,Be(y.id,!1)));e.hooks.edgesChange.trigger(v)},_=m=>{if(!m||!m.length)return p([],!1);const g=m.reduce((v,y)=>{const T=Be(y.id,!1);return Fe(y)?v.nodes.push(T):v.edges.push(T),v},{nodes:[],edges:[]});g.nodes.length&&e.hooks.nodesChange.trigger(g.nodes),g.edges.length&&e.hooks.edgesChange.trigger(g.edges)},C=m=>{var g;(g=e.d3Zoom)==null||g.scaleExtent([m,e.maxZoom]),e.minZoom=m},O=m=>{var g;(g=e.d3Zoom)==null||g.scaleExtent([e.minZoom,m]),e.maxZoom=m},G=m=>{var g;(g=e.d3Zoom)==null||g.translateExtent(m),e.translateExtent=m},Y=m=>{e.nodeExtent=m,i()},I=m=>{var g;(g=e.d3Zoom)==null||g.clickDistance(m)},B=m=>{e.nodesDraggable=m,e.nodesConnectable=m,e.elementsSelectable=m},A=m=>{const g=m instanceof Function?m(e.nodes):m;!e.initialized&&!g.length||(e.nodes=di(g,c,e.hooks.error.trigger))},D=m=>{const g=m instanceof Function?m(e.edges):m;if(!e.initialized&&!g.length)return;const v=Bn(g,e.isValidConnection,c,d,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);$n(e.connectionLookup,n.value,v),e.edges=v},E=m=>{const g=m instanceof Function?m([...e.nodes,...e.edges]):m;!e.initialized&&!g.length||(A(g.filter(Fe)),D(g.filter($e)))},W=m=>{let g=m instanceof Function?m(e.nodes):m;g=Array.isArray(g)?g:[g];const v=di(g,c,e.hooks.error.trigger),y=[];for(const T of v)y.push(ei(T));y.length&&e.hooks.nodesChange.trigger(y)},w=m=>{let g=m instanceof Function?m(e.edges):m;g=Array.isArray(g)?g:[g];const v=Bn(g,e.isValidConnection,c,d,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),y=[];for(const T of v)y.push(ei(T));y.length&&e.hooks.edgesChange.trigger(y)},P=(m,g=!0,v=!1)=>{const y=m instanceof Function?m(e.nodes):m,T=Array.isArray(y)?y:[y],q=[],U=[];function Z(re){const se=s(re);for(const ce of se)(!he(ce.deletable)||ce.deletable)&&U.push(ni(ce.id,ce.source,ce.target,ce.sourceHandle,ce.targetHandle))}function ee(re){const se=[];for(const ce of e.nodes)ce.parentNode===re&&se.push(ce);if(se.length){for(const ce of se)q.push(ti(ce.id));g&&Z(se);for(const ce of se)ee(ce.id)}}for(const re of T){const se=typeof re=="string"?c(re):re;se&&(he(se.deletable)&&!se.deletable||(q.push(ti(se.id)),g&&Z([se]),v&&ee(se.id)))}U.length&&e.hooks.edgesChange.trigger(U),q.length&&e.hooks.nodesChange.trigger(q)},b=m=>{const g=m instanceof Function?m(e.edges):m,v=Array.isArray(g)?g:[g],y=[];for(const T of v){const q=typeof T=="string"?d(T):T;q&&(he(q.deletable)&&!q.deletable||y.push(ni(typeof T=="string"?T:T.id,q.source,q.target,q.sourceHandle,q.targetHandle)))}e.hooks.edgesChange.trigger(y)},$=(m,g,v=!0)=>{const y=d(m.id);if(!y)return!1;const T=e.edges.indexOf(y),q=nu(m,g,y,v,e.hooks.error.trigger);if(q){const[U]=Bn([q],e.isValidConnection,c,d,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((Z,ee)=>ee===T?U:Z),$n(e.connectionLookup,n.value,[U]),U}return!1},V=(m,g,v={replace:!1})=>{const y=d(m);if(!y)return;const T=typeof g=="function"?g(y):g;y.data=v.replace?T:{...y.data,...T}},H=m=>Qo(m,e.nodes),z=m=>{const g=Qo(m,e.edges);return $n(e.connectionLookup,n.value,g),g},K=(m,g,v={replace:!1})=>{const y=c(m);if(!y)return;const T=typeof g=="function"?g(y):g;v.replace?e.nodes.splice(e.nodes.indexOf(y),1,T):Object.assign(y,T)},Q=(m,g,v={replace:!1})=>{const y=c(m);if(!y)return;const T=typeof g=="function"?g(y):g;y.data=v.replace?T:{...y.data,...T}},oe=(m,g,v=!1)=>{v?e.connectionClickStartHandle=m:e.connectionStartHandle=m,e.connectionEndHandle=null,e.connectionStatus=null,g&&(e.connectionPosition=g)},F=(m,g=null,v=null)=>{e.connectionStartHandle&&(e.connectionPosition=m,e.connectionEndHandle=g,e.connectionStatus=v)},X=(m,g)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,g?e.connectionClickStartHandle=null:e.connectionStartHandle=null},j=m=>{const g=Ps(m),v=g?null:ft(m)?m:c(m.id);return!g&&!v?[null,null,g]:[g?m:zt(v),v,g]},le=(m,g=!0,v=e.nodes)=>{const[y,T,q]=j(m);if(!y)return[];const U=[];for(const Z of v||e.nodes){if(!q&&(Z.id===T.id||!Z.computedPosition))continue;const ee=zt(Z),re=Rt(ee,y);(g&&re>0||re>=Number(y.width)*Number(y.height))&&U.push(Z)}return U},ae=(m,g,v=!0)=>{const[y]=j(m);if(!y)return!1;const T=Rt(y,g);return v&&T>0||T>=Number(y.width)*Number(y.height)},te=m=>{const{viewport:g,dimensions:v,d3Zoom:y,d3Selection:T,translateExtent:q}=e;if(!y||!T||!m.x&&!m.y)return!1;const U=Ke.translate(g.x+m.x,g.y+m.y).scale(g.zoom),Z=[[0,0],[v.width,v.height]],ee=y.constrain()(U,Z,q),re=e.viewport.x!==ee.x||e.viewport.y!==ee.y||e.viewport.zoom!==ee.k;return y.transform(T,ee),re},ue=m=>{const g=m instanceof Function?m(e):m,v=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];he(g.defaultEdgeOptions)&&(e.defaultEdgeOptions=g.defaultEdgeOptions);const y=g.modelValue||g.nodes||g.edges?[]:void 0;y&&(g.modelValue&&y.push(...g.modelValue),g.nodes&&y.push(...g.nodes),g.edges&&y.push(...g.edges),E(y));const T=()=>{he(g.maxZoom)&&O(g.maxZoom),he(g.minZoom)&&C(g.minZoom),he(g.translateExtent)&&G(g.translateExtent)};for(const q of Object.keys(g)){const U=q,Z=g[U];![...yu,...v].includes(U)&&he(Z)&&(e[U]=Z)}Qt(()=>e.d3Zoom).not.toBeNull().then(T),e.initialized||(e.initialized=!0)};return{updateNodePositions:f,updateNodeDimensions:h,setElements:E,setNodes:A,setEdges:D,addNodes:W,addEdges:w,removeNodes:P,removeEdges:b,findNode:c,findEdge:d,updateEdge:$,updateEdgeData:V,updateNode:K,updateNodeData:Q,applyEdgeChanges:z,applyNodeChanges:H,addSelectedElements:N,addSelectedNodes:S,addSelectedEdges:x,setMinZoom:C,setMaxZoom:O,setTranslateExtent:G,setNodeExtent:Y,setPaneClickDistance:I,removeSelectedElements:_,removeSelectedNodes:k,removeSelectedEdges:M,startConnection:oe,updateConnection:F,endConnection:X,setInteractive:B,setState:ue,getIntersectingNodes:le,getIncomers:r,getOutgoers:l,getConnectedEdges:s,getHandleConnections:u,isNodeIntersecting:ae,panBy:te,fitView:m=>o.value.fitView(m),zoomIn:m=>o.value.zoomIn(m),zoomOut:m=>o.value.zoomOut(m),zoomTo:(m,g)=>o.value.zoomTo(m,g),setViewport:(m,g)=>o.value.setViewport(m,g),setTransform:(m,g)=>o.value.setTransform(m,g),getViewport:()=>o.value.getViewport(),getTransform:()=>o.value.getTransform(),setCenter:(m,g,v)=>o.value.setCenter(m,g,v),fitBounds:(m,g)=>o.value.fitBounds(m,g),project:m=>o.value.project(m),screenToFlowCoordinate:m=>o.value.screenToFlowCoordinate(m),flowToScreenCoordinate:m=>o.value.flowToScreenCoordinate(m),toObject:()=>{const m=[],g=[];for(const v of e.nodes){const{computedPosition:y,handleBounds:T,selected:q,dimensions:U,isParent:Z,resizing:ee,dragging:re,events:se,...ce}=v;m.push(ce)}for(const v of e.edges){const{selected:y,sourceNode:T,targetNode:q,events:U,...Z}=v;g.push(Z)}return JSON.parse(JSON.stringify({nodes:m,edges:g,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:m=>new Promise(g=>{const{nodes:v,edges:y,position:T,zoom:q,viewport:U}=m;if(v&&A(v),y&&D(y),U?.x&&U?.y||T){const Z=U?.x||T[0],ee=U?.y||T[1],re=U?.zoom||q||e.viewport.zoom;return Qt(()=>o.value.viewportInitialized).toBe(!0).then(()=>{o.value.setViewport({x:Z,y:ee,zoom:re}).then(()=>{g(!0)})})}else g(!0)}),updateNodeInternals:i,viewportHelper:o,$reset:()=>{const m=Ei();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const g=Ke.translate(m.defaultViewport.x??0,m.defaultViewport.y??0).scale(Le(m.defaultViewport.zoom??1,m.minZoom,m.maxZoom)),v=e.viewportRef.getBoundingClientRect(),y=[[0,0],[v.width,v.height]],T=e.d3Zoom.constrain()(g,y,m.translateExtent);e.d3Zoom.transform(e.d3Selection,T)}ue(m)},$destroy:()=>{}}}const wu=["data-id","data-handleid","data-nodeid","data-handlepos"],_u={name:"Handle",compatConfig:{MODE:3}},Je=a.defineComponent({..._u,props:{id:{default:null},type:{},position:{default:()=>R.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(e,{expose:t}){const n=a.createPropsRestProxy(e,["position","connectable","connectableStart","connectableEnd","id"]),o=a.toRef(()=>n.type??"source"),i=a.toRef(()=>n.isValidConnection??null),{id:r,connectionStartHandle:l,connectionClickStartHandle:s,connectionEndHandle:u,vueFlowRef:c,nodesConnectable:d,noDragClassName:f,noPanClassName:h}=de(),{id:p,node:S,nodeEl:x,connectedEdges:N}=wi(),k=a.ref(),M=a.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),_=a.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),C=a.toRef(()=>{var D,E,W,w,P,b;return((D=l.value)==null?void 0:D.nodeId)===p&&((E=l.value)==null?void 0:E.id)===e.id&&((W=l.value)==null?void 0:W.type)===o.value||((w=u.value)==null?void 0:w.nodeId)===p&&((P=u.value)==null?void 0:P.id)===e.id&&((b=u.value)==null?void 0:b.type)===o.value}),O=a.toRef(()=>{var D,E,W;return((D=s.value)==null?void 0:D.nodeId)===p&&((E=s.value)==null?void 0:E.id)===e.id&&((W=s.value)==null?void 0:W.type)===o.value}),{handlePointerDown:G,handleClick:Y}=vi({nodeId:p,handleId:e.id,isValidConnection:i,type:o}),I=a.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!N.value.some(D=>{const E=D[`${o.value}Handle`];return D[o.value]!==p?!1:E?E===e.id:!0}):typeof e.connectable=="number"?N.value.filter(D=>{const E=D[`${o.value}Handle`];return D[o.value]!==p?!1:E?E===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(S,N.value):he(e.connectable)?e.connectable:d.value);a.onMounted(()=>{var D;if(!S.dimensions.width||!S.dimensions.height)return;const E=(D=S.handleBounds[o.value])==null?void 0:D.find(H=>H.id===e.id);if(!c.value||E)return;const W=c.value.querySelector(".vue-flow__transformationpane");if(!x.value||!k.value||!W||!e.id)return;const w=x.value.getBoundingClientRect(),P=k.value.getBoundingClientRect(),b=window.getComputedStyle(W),{m22:$}=new window.DOMMatrixReadOnly(b.transform),V={id:e.id,position:e.position,x:(P.left-w.left)/$,y:(P.top-w.top)/$,type:o.value,nodeId:p,...Ht(k.value)};S.handleBounds[o.value]=[...S.handleBounds[o.value]??[],V]});function B(D){const E=Mn(D);I.value&&M.value&&(E&&D.button===0||!E)&&G(D)}function A(D){!p||!s.value&&!M.value||I.value&&Y(D)}return t({handleClick:Y,handlePointerDown:G,onClick:A,onPointerDown:B}),(D,E)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"handle",ref:k,"data-id":`${a.unref(r)}-${a.unref(p)}-${e.id}-${o.value}`,"data-handleid":e.id,"data-nodeid":a.unref(p),"data-handlepos":D.position,class:a.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${D.position}`,`vue-flow__handle-${e.id}`,a.unref(f),a.unref(h),o.value,{connectable:I.value,connecting:O.value,connectablestart:M.value,connectableend:_.value,connectionindicator:I.value&&(M.value&&!C.value||_.value&&C.value)}]]),onMousedown:B,onTouchstartPassive:B,onClick:A},[a.renderSlot(D.$slots,"default",{id:D.id})],42,wu))}}),Zt=function({sourcePosition:e=R.Bottom,targetPosition:t=R.Top,label:n,connectable:o=!0,isValidTargetPos:i,isValidSourcePos:r,data:l}){const s=l.label??n;return[a.h(Je,{type:"target",position:t,connectable:o,isValidConnection:i}),typeof s!="string"&&s?a.h(s):a.h(a.Fragment,[s]),a.h(Je,{type:"source",position:e,connectable:o,isValidConnection:r})]};Zt.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],Zt.inheritAttrs=!1,Zt.compatConfig={MODE:3};const Eu=Zt,Wt=function({targetPosition:e=R.Top,label:t,connectable:n=!0,isValidTargetPos:o,data:i}){const r=i.label??t;return[a.h(Je,{type:"target",position:e,connectable:n,isValidConnection:o}),typeof r!="string"&&r?a.h(r):a.h(a.Fragment,[r])]};Wt.props=["targetPosition","label","isValidTargetPos","connectable","data"],Wt.inheritAttrs=!1,Wt.compatConfig={MODE:3};const bu=Wt,Kt=function({sourcePosition:e=R.Bottom,label:t,connectable:n=!0,isValidSourcePos:o,data:i}){const r=i.label??t;return[typeof r!="string"&&r?a.h(r):a.h(a.Fragment,[r]),a.h(Je,{type:"source",position:e,connectable:n,isValidConnection:o})]};Kt.props=["sourcePosition","label","isValidSourcePos","connectable","data"],Kt.inheritAttrs=!1,Kt.compatConfig={MODE:3};const xu=Kt,Su=["transform"],Nu=["width","height","x","y","rx","ry"],Cu=["y"],ku={name:"EdgeText",compatConfig:{MODE:3}},Mu=a.defineComponent({...ku,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const t=a.ref({x:0,y:0,width:0,height:0}),n=a.ref(null),o=a.computed(()=>`translate(${e.x-t.value.width/2} ${e.y-t.value.height/2})`);a.onMounted(i),a.watch([()=>e.x,()=>e.y,n,()=>e.label],i);function i(){if(!n.value)return;const r=n.value.getBBox();(r.width!==t.value.width||r.height!==t.value.height)&&(t.value=r)}return(r,l)=>(a.openBlock(),a.createElementBlock("g",{transform:o.value,class:"vue-flow__edge-textwrapper"},[r.labelShowBg?(a.openBlock(),a.createElementBlock("rect",{key:0,class:"vue-flow__edge-textbg",width:`${t.value.width+2*r.labelBgPadding[0]}px`,height:`${t.value.height+2*r.labelBgPadding[1]}px`,x:-r.labelBgPadding[0],y:-r.labelBgPadding[1],style:a.normalizeStyle(r.labelBgStyle),rx:r.labelBgBorderRadius,ry:r.labelBgBorderRadius},null,12,Nu)):a.createCommentVNode("",!0),a.createElementVNode("text",a.mergeProps(r.$attrs,{ref_key:"el",ref:n,class:"vue-flow__edge-text",y:t.value.height/2,dy:"0.3em",style:r.labelStyle}),[a.renderSlot(r.$slots,"default",{},()=>[typeof r.label!="string"?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(r.label),{key:0})):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[a.createTextVNode(a.toDisplayString(r.label),1)],64))])],16,Cu)],8,Su))}}),Iu=["id","d","marker-end","marker-start"],Tu=["d","stroke-width"],Pu={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},qt=a.defineComponent({...Pu,props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:t}){const n=a.ref(null),o=a.ref(null),i=a.ref(null),r=a.useAttrs();return t({pathEl:n,interactionEl:o,labelEl:i}),(l,s)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("path",a.mergeProps(a.unref(r),{id:l.id,ref_key:"pathEl",ref:n,d:l.path,class:"vue-flow__edge-path","marker-end":l.markerEnd,"marker-start":l.markerStart}),null,16,Iu),l.interactionWidth?(a.openBlock(),a.createElementBlock("path",{key:0,ref_key:"interactionEl",ref:o,fill:"none",d:l.path,"stroke-width":l.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,Tu)):a.createCommentVNode("",!0),l.label&&l.labelX&&l.labelY?(a.openBlock(),a.createBlock(Mu,{key:1,ref_key:"labelEl",ref:i,x:l.labelX,y:l.labelY,label:l.label,"label-show-bg":l.labelShowBg,"label-bg-style":l.labelBgStyle,"label-bg-padding":l.labelBgPadding,"label-bg-border-radius":l.labelBgBorderRadius,"label-style":l.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):a.createCommentVNode("",!0)],64))}});function bi({sourceX:e,sourceY:t,targetX:n,targetY:o}){const i=Math.abs(n-e)/2,r=n<e?n+i:n-i,l=Math.abs(o-t)/2,s=o<t?o+l:o-l;return[r,s,i,l]}function xi({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:i,sourceControlY:r,targetControlX:l,targetControlY:s}){const u=e*.125+i*.375+l*.375+n*.125,c=t*.125+r*.375+s*.375+o*.125,d=Math.abs(u-e),f=Math.abs(c-t);return[u,c,d,f]}function jt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Si({pos:e,x1:t,y1:n,x2:o,y2:i,c:r}){let l,s;switch(e){case R.Left:l=t-jt(t-o,r),s=n;break;case R.Right:l=t+jt(o-t,r),s=n;break;case R.Top:l=t,s=n-jt(n-i,r);break;case R.Bottom:l=t,s=n+jt(i-n,r);break}return[l,s]}function An(e){const{sourceX:t,sourceY:n,sourcePosition:o=R.Bottom,targetX:i,targetY:r,targetPosition:l=R.Top,curvature:s=.25}=e,[u,c]=Si({pos:o,x1:t,y1:n,x2:i,y2:r,c:s}),[d,f]=Si({pos:l,x1:i,y1:r,x2:t,y2:n,c:s}),[h,p,S,x]=xi({sourceX:t,sourceY:n,targetX:i,targetY:r,sourceControlX:u,sourceControlY:c,targetControlX:d,targetControlY:f});return[`M${t},${n} C${u},${c} ${d},${f} ${i},${r}`,h,p,S,x]}function Ni({pos:e,x1:t,y1:n,x2:o,y2:i}){let r,l;switch(e){case R.Left:case R.Right:r=.5*(t+o),l=n;break;case R.Top:case R.Bottom:r=t,l=.5*(n+i);break}return[r,l]}function Ci(e){const{sourceX:t,sourceY:n,sourcePosition:o=R.Bottom,targetX:i,targetY:r,targetPosition:l=R.Top}=e,[s,u]=Ni({pos:o,x1:t,y1:n,x2:i,y2:r}),[c,d]=Ni({pos:l,x1:i,y1:r,x2:t,y2:n}),[f,h,p,S]=xi({sourceX:t,sourceY:n,targetX:i,targetY:r,sourceControlX:s,sourceControlY:u,targetControlX:c,targetControlY:d});return[`M${t},${n} C${s},${u} ${c},${d} ${i},${r}`,f,h,p,S]}const ki={[R.Left]:{x:-1,y:0},[R.Right]:{x:1,y:0},[R.Top]:{x:0,y:-1},[R.Bottom]:{x:0,y:1}};function $u({source:e,sourcePosition:t=R.Bottom,target:n}){return t===R.Left||t===R.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1}}function Mi(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function Bu({source:e,sourcePosition:t=R.Bottom,target:n,targetPosition:o=R.Top,center:i,offset:r}){const l=ki[t],s=ki[o],u={x:e.x+l.x*r,y:e.y+l.y*r},c={x:n.x+s.x*r,y:n.y+s.y*r},d=$u({source:u,sourcePosition:t,target:c}),f=d.x!==0?"x":"y",h=d[f];let p,S,x;const N={x:0,y:0},k={x:0,y:0},[M,_,C,O]=bi({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[f]*s[f]===-1){S=i.x??M,x=i.y??_;const Y=[{x:S,y:u.y},{x:S,y:c.y}],I=[{x:u.x,y:x},{x:c.x,y:x}];l[f]===h?p=f==="x"?Y:I:p=f==="x"?I:Y}else{const Y=[{x:u.x,y:c.y}],I=[{x:c.x,y:u.y}];if(f==="x"?p=l.x===h?I:Y:p=l.y===h?Y:I,t===o){const W=Math.abs(e[f]-n[f]);if(W<=r){const w=Math.min(r-1,r-W);l[f]===h?N[f]=(u[f]>e[f]?-1:1)*w:k[f]=(c[f]>n[f]?-1:1)*w}}if(t!==o){const W=f==="x"?"y":"x",w=l[f]===s[W],P=u[W]>c[W],b=u[W]<c[W];(l[f]===1&&(!w&&P||w&&b)||l[f]!==1&&(!w&&b||w&&P))&&(p=f==="x"?Y:I)}const B={x:u.x+N.x,y:u.y+N.y},A={x:c.x+k.x,y:c.y+k.y},D=Math.max(Math.abs(B.x-p[0].x),Math.abs(A.x-p[0].x)),E=Math.max(Math.abs(B.y-p[0].y),Math.abs(A.y-p[0].y));D>=E?(S=(B.x+A.x)/2,x=p[0].y):(S=p[0].x,x=(B.y+A.y)/2)}return[[e,{x:u.x+N.x,y:u.y+N.y},...p,{x:c.x+k.x,y:c.y+k.y},n],S,x,C,O]}function Du(e,t,n,o){const i=Math.min(Mi(e,t)/2,Mi(t,n)/2,o),{x:r,y:l}=t;if(e.x===r&&r===n.x||e.y===l&&l===n.y)return`L${r} ${l}`;if(e.y===l){const c=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${r+i*c},${l}Q ${r},${l} ${r},${l+i*d}`}const s=e.x<n.x?1:-1,u=e.y<n.y?-1:1;return`L ${r},${l+i*u}Q ${r},${l} ${r+i*s},${l}`}function On(e){const{sourceX:t,sourceY:n,sourcePosition:o=R.Bottom,targetX:i,targetY:r,targetPosition:l=R.Top,borderRadius:s=5,centerX:u,centerY:c,offset:d=20}=e,[f,h,p,S,x]=Bu({source:{x:t,y:n},sourcePosition:o,target:{x:i,y:r},targetPosition:l,center:{x:u,y:c},offset:d});return[f.reduce((k,M,_)=>{let C;return _>0&&_<f.length-1?C=Du(f[_-1],M,f[_+1],s):C=`${_===0?"M":"L"}${M.x} ${M.y}`,k+=C,k},""),h,p,S,x]}function Vu(e){const{sourceX:t,sourceY:n,targetX:o,targetY:i}=e,[r,l,s,u]=bi({sourceX:t,sourceY:n,targetX:o,targetY:i});return[`M ${t},${n}L ${o},${i}`,r,l,s,u]}const Au=a.defineComponent({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=Vu(e);return a.h(qt,{path:n,labelX:o,labelY:i,...t,...e})}}}),Ii=a.defineComponent({name:"SmoothStepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","borderRadius","markerEnd","markerStart","interactionWidth","offset"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=On({...e,sourcePosition:e.sourcePosition??R.Bottom,targetPosition:e.targetPosition??R.Top});return a.h(qt,{path:n,labelX:o,labelY:i,...t,...e})}}}),Ou=a.defineComponent({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:t}){return()=>a.h(Ii,{...e,...t,borderRadius:0})}}),zu=a.defineComponent({name:"BezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=An({...e,sourcePosition:e.sourcePosition??R.Bottom,targetPosition:e.targetPosition??R.Top});return a.h(qt,{path:n,labelX:o,labelY:i,...t,...e})}}}),Ru=a.defineComponent({name:"SimpleBezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=Ci({...e,sourcePosition:e.sourcePosition??R.Bottom,targetPosition:e.targetPosition??R.Top});return a.h(qt,{path:n,labelX:o,labelY:i,...t,...e})}}}),Hu={input:xu,default:Eu,output:bu},Lu={default:zu,straight:Au,step:Ou,smoothstep:Ii,simplebezier:Ru};function Fu(e,t,n){const o=a.computed(()=>x=>t.value.get(x)),i=a.computed(()=>x=>n.value.get(x)),r=a.computed(()=>{const x={...Lu,...e.edgeTypes},N=Object.keys(x);for(const k of e.edges)k.type&&!N.includes(k.type)&&(x[k.type]=k.type);return x}),l=a.computed(()=>{const x={...Hu,...e.nodeTypes},N=Object.keys(x);for(const k of e.nodes)k.type&&!N.includes(k.type)&&(x[k.type]=k.type);return x}),s=a.computed(()=>e.onlyRenderVisibleElements?Zo(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),u=a.computed(()=>{if(e.onlyRenderVisibleElements){const x=[];for(const N of e.edges){const k=t.value.get(N.source),M=t.value.get(N.target);Ys({sourcePos:k.computedPosition||{x:0,y:0},targetPos:M.computedPosition||{x:0,y:0},sourceWidth:k.dimensions.width,sourceHeight:k.dimensions.height,targetWidth:M.dimensions.width,targetHeight:M.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&x.push(N)}return x}return e.edges}),c=a.computed(()=>[...s.value,...u.value]),d=a.computed(()=>{const x=[];for(const N of e.nodes)N.selected&&x.push(N);return x}),f=a.computed(()=>{const x=[];for(const N of e.edges)N.selected&&x.push(N);return x}),h=a.computed(()=>[...d.value,...f.value]),p=a.computed(()=>{const x=[];for(const N of e.nodes)N.dimensions.width&&N.dimensions.height&&N.handleBounds!==void 0&&x.push(N);return x}),S=a.computed(()=>s.value.length>0&&p.value.length===s.value.length);return{getNode:o,getEdge:i,getElements:c,getEdgeTypes:r,getNodeTypes:l,getEdges:u,getNodes:s,getSelectedElements:h,getSelectedNodes:d,getSelectedEdges:f,getNodesInitialized:p,areNodesInitialized:S}}class Ye{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var t;const n=(t=a.getCurrentInstance())==null?void 0:t.appContext.app,o=n?.config.globalProperties.$vueFlowStorage??Ye.instance;return Ye.instance=o??new Ye,n&&(n.config.globalProperties.$vueFlowStorage=Ye.instance),Ye.instance}set(t,n){return this.flows.set(t,n)}get(t){return this.flows.get(t)}remove(t){return this.flows.delete(t)}create(t,n){const o=Ei(),i=a.reactive(o),r={};for(const[h,p]of Object.entries(i.hooks)){const S=`on${h.charAt(0).toUpperCase()+h.slice(1)}`;r[S]=p.on}const l={};for(const[h,p]of Object.entries(i.hooks))l[h]=p.trigger;const s=a.computed(()=>{const h=new Map;for(const p of i.nodes)h.set(p.id,p);return h}),u=a.computed(()=>{const h=new Map;for(const p of i.edges)h.set(p.id,p);return h}),c=Fu(i,s,u),d=vu(i,s,u);d.setState({...i,...n});const f={...r,...c,...d,...Hi(i),nodeLookup:s,edgeLookup:u,emits:l,id:t,vueFlowVersion:"1.45.0",$destroy:()=>{this.remove(t)}};return this.set(t,f),f}getId(){return`vue-flow-${this.currentId++}`}}function de(e){const t=Ye.getInstance(),n=a.getCurrentScope(),o=typeof e=="object",i=o?e:{id:e},r=i.id,l=r??n?.vueFlowId;let s;if(n){const u=a.inject(gi,null);typeof u<"u"&&u!==null&&(!l||u.id===l)&&(s=u)}if(s||l&&(s=t.get(l)),!s||l&&s.id!==l){const u=r??t.getId(),c=t.create(u,i);s=c,(n??a.effectScope(!0)).run(()=>{a.watch(c.applyDefault,(f,h,p)=>{const S=N=>{c.applyNodeChanges(N)},x=N=>{c.applyEdgeChanges(N)};f?(c.onNodesChange(S),c.onEdgesChange(x)):(c.hooks.value.nodesChange.off(S),c.hooks.value.edgesChange.off(x)),p(()=>{c.hooks.value.nodesChange.off(S),c.hooks.value.edgesChange.off(x)})},{immediate:!0}),mt(()=>{if(s){const f=t.get(s.id);f?f.$destroy():Gt(`No store instance found for id ${s.id} in storage.`)}})})}else o&&s.setState(i);if(n&&(a.provide(gi,s),n.vueFlowId=s.id),o){const u=a.getCurrentInstance();u?.type.name!=="VueFlow"&&s.emits.error(new ge(fe.USEVUEFLOW_OPTIONS))}return s}function Yu(e){const{emits:t,dimensions:n}=de();let o;a.onMounted(()=>{const i=e.value,r=()=>{if(!i)return;const l=Ht(i);(l.width===0||l.height===0)&&t.error(new ge(fe.MISSING_VIEWPORT_DIMENSIONS)),n.value={width:l.width||500,height:l.height||500}};r(),window.addEventListener("resize",r),i&&(o=new ResizeObserver(()=>r()),o.observe(i)),a.onBeforeUnmount(()=>{window.removeEventListener("resize",r),o&&i&&o.unobserve(i)})})}const Gu={name:"UserSelection",compatConfig:{MODE:3}},Xu=a.defineComponent({...Gu,props:{userSelectionRect:{}},setup(e){return(t,n)=>(a.openBlock(),a.createElementBlock("div",{class:"vue-flow__selection vue-flow__container",style:a.normalizeStyle({width:`${t.userSelectionRect.width}px`,height:`${t.userSelectionRect.height}px`,transform:`translate(${t.userSelectionRect.x}px, ${t.userSelectionRect.y}px)`})},null,4))}}),Uu=["tabIndex"],Zu={name:"NodesSelection",compatConfig:{MODE:3}},Wu=a.defineComponent({...Zu,setup(e){const{emits:t,viewport:n,getSelectedNodes:o,noPanClassName:i,disableKeyboardA11y:r,userSelectionActive:l}=de(),s=_i(),u=a.ref(null),c=yi({el:u,onStart(S){t.selectionDragStart(S)},onDrag(S){t.selectionDrag(S)},onStop(S){t.selectionDragStop(S)}});a.onMounted(()=>{var S;r.value||(S=u.value)==null||S.focus({preventScroll:!0})});const d=a.computed(()=>Uo(o.value)),f=a.computed(()=>({width:`${d.value.width}px`,height:`${d.value.height}px`,top:`${d.value.y}px`,left:`${d.value.x}px`}));function h(S){t.selectionContextMenu({event:S,nodes:o.value})}function p(S){r||qe[S.key]&&(S.preventDefault(),s({x:qe[S.key].x,y:qe[S.key].y},S.shiftKey))}return(S,x)=>!a.unref(l)&&d.value.width&&d.value.height?(a.openBlock(),a.createElementBlock("div",{key:0,class:a.normalizeClass(["vue-flow__nodesselection vue-flow__container",a.unref(i)]),style:a.normalizeStyle({transform:`translate(${a.unref(n).x}px,${a.unref(n).y}px) scale(${a.unref(n).zoom})`})},[a.createElementVNode("div",{ref_key:"el",ref:u,class:a.normalizeClass([{dragging:a.unref(c)},"vue-flow__nodesselection-rect"]),style:a.normalizeStyle(f.value),tabIndex:a.unref(r)?void 0:-1,onContextmenu:h,onKeydown:p},null,46,Uu)],6)):a.createCommentVNode("",!0)}});function Ku(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const qu={name:"Pane",compatConfig:{MODE:3}},ju=a.defineComponent({...qu,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:t,nodes:n,viewport:o,emits:i,userSelectionActive:r,removeSelectedElements:l,userSelectionRect:s,elementsSelectable:u,nodesSelectionActive:c,getSelectedEdges:d,getSelectedNodes:f,removeNodes:h,removeEdges:p,selectionMode:S,deleteKeyCode:x,multiSelectionKeyCode:N,multiSelectionActive:k,edgeLookup:M,nodeLookup:_,connectionLookup:C,defaultEdgeOptions:O,connectionStartHandle:G}=de(),Y=a.ref(null),I=a.ref(new Set),B=a.ref(new Set),A=a.ref(),D=a.toRef(()=>u.value&&(e.isSelecting||r.value)),E=a.toRef(()=>G.value!==null);let W=!1,w=!1;const P=dt(x,{actInsideInputWithModifier:!1}),b=dt(N);a.watch(P,F=>{F&&(h(f.value),p(d.value),c.value=!1)}),a.watch(b,F=>{k.value=F});function $(F,X){return j=>{j.target===X&&F?.(j)}}function V(F){if(W||E.value){W=!1;return}i.paneClick(F),l(),c.value=!1}function H(F){F.preventDefault(),F.stopPropagation(),i.paneContextMenu(F)}function z(F){i.paneScroll(F)}function K(F){var X,j,le;if(A.value=(X=t.value)==null?void 0:X.getBoundingClientRect(),!u.value||!e.isSelecting||F.button!==0||F.target!==Y.value||!A.value)return;(le=(j=F.target)==null?void 0:j.setPointerCapture)==null||le.call(j,F.pointerId);const{x:ae,y:te}=Ku(F,A.value);w=!0,W=!1,l(),s.value={width:0,height:0,startX:ae,startY:te,x:ae,y:te},i.selectionStart(F)}function Q(F){var X;if(!A.value||!s.value)return;W=!0;const{x:j,y:le}=Se(F,A.value),{startX:ae=0,startY:te=0}=s.value,ue={startX:ae,startY:te,x:j<ae?j:ae,y:le<te?le:te,width:Math.abs(j-ae),height:Math.abs(le-te)},J=I.value,ne=B.value;I.value=new Set(Zo(n.value,ue,o.value,S.value===En.Partial,!0).map(m=>m.id)),B.value=new Set;const ie=((X=O.value)==null?void 0:X.selectable)??!0;for(const m of I.value){const g=C.value.get(m);if(g)for(const{edgeId:v}of g.values()){const y=M.value.get(v);y&&(y.selectable??ie)&&B.value.add(v)}}if(!hi(J,I.value)){const m=De(_.value,I.value,!0);i.nodesChange(m)}if(!hi(ne,B.value)){const m=De(M.value,B.value);i.edgesChange(m)}s.value=ue,r.value=!0,c.value=!1}function oe(F){var X;F.button!==0||!w||((X=F.target)==null||X.releasePointerCapture(F.pointerId),!r.value&&s.value&&F.target===Y.value&&V(F),r.value=!1,s.value=null,c.value=I.value.size>0,i.selectionEnd(F),e.selectionKeyPressed&&(W=!1),w=!1)}return(F,X)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"container",ref:Y,class:a.normalizeClass(["vue-flow__pane vue-flow__container",{selection:F.isSelecting}]),onClick:X[0]||(X[0]=j=>D.value?void 0:$(V,Y.value)(j)),onContextmenu:X[1]||(X[1]=j=>$(H,Y.value)(j)),onWheelPassive:X[2]||(X[2]=j=>$(z,Y.value)(j)),onPointerenter:X[3]||(X[3]=j=>D.value?void 0:a.unref(i).paneMouseEnter(j)),onPointerdown:X[4]||(X[4]=j=>D.value?K(j):a.unref(i).paneMouseMove(j)),onPointermove:X[5]||(X[5]=j=>D.value?Q(j):a.unref(i).paneMouseMove(j)),onPointerup:X[6]||(X[6]=j=>D.value?oe(j):void 0),onPointerleave:X[7]||(X[7]=j=>a.unref(i).paneMouseLeave(j))},[a.renderSlot(F.$slots,"default"),a.unref(r)&&a.unref(s)?(a.openBlock(),a.createBlock(Xu,{key:0,"user-selection-rect":a.unref(s)},null,8,["user-selection-rect"])):a.createCommentVNode("",!0),a.unref(c)&&a.unref(f).length?(a.openBlock(),a.createBlock(Wu,{key:1})):a.createCommentVNode("",!0)],34))}}),Ju={name:"Transform",compatConfig:{MODE:3}},Qu=a.defineComponent({...Ju,setup(e){const{viewport:t,fitViewOnInit:n,fitViewOnInitDone:o}=de(),i=a.computed(()=>n.value?!o.value:!1),r=a.computed(()=>`translate(${t.value.x}px,${t.value.y}px) scale(${t.value.zoom})`);return(l,s)=>(a.openBlock(),a.createElementBlock("div",{class:"vue-flow__transformationpane vue-flow__container",style:a.normalizeStyle({transform:r.value,opacity:i.value?0:void 0})},[a.renderSlot(l.$slots,"default")],4))}}),ec={name:"Viewport",compatConfig:{MODE:3}},tc=a.defineComponent({...ec,setup(e){const{minZoom:t,maxZoom:n,defaultViewport:o,translateExtent:i,zoomActivationKeyCode:r,selectionKeyCode:l,panActivationKeyCode:s,panOnScroll:u,panOnScrollMode:c,panOnScrollSpeed:d,panOnDrag:f,zoomOnDoubleClick:h,zoomOnPinch:p,zoomOnScroll:S,preventScrolling:x,noWheelClassName:N,noPanClassName:k,emits:M,connectionStartHandle:_,userSelectionActive:C,paneDragging:O,d3Zoom:G,d3Selection:Y,d3ZoomHandler:I,viewport:B,viewportRef:A,paneClickDistance:D}=de();Yu(A);const E=a.shallowRef(!1),W=a.shallowRef(!1);let w=null,P=!1,b=0,$={x:0,y:0,zoom:0};const V=dt(s),H=dt(l),z=dt(r),K=a.toRef(()=>(!H.value||H.value&&l.value===!0)&&(V.value||f.value)),Q=a.toRef(()=>V.value||u.value),oe=a.toRef(()=>H.value||l.value===!0&&K.value!==!0);a.onMounted(()=>{if(!A.value){Gt("Viewport element is missing");return}const te=A.value,ue=te.getBoundingClientRect(),J=Ss().clickDistance(D.value).scaleExtent([t.value,n.value]).translateExtent(i.value),ne=ye(te).call(J),ie=ne.on("wheel.zoom"),m=Ke.translate(o.value.x??0,o.value.y??0).scale(Le(o.value.zoom??1,t.value,n.value)),g=[[0,0],[ue.width,ue.height]],v=J.constrain()(m,g,i.value);J.transform(ne,v),J.wheelDelta(X),G.value=J,Y.value=ne,I.value=ie,B.value={x:v.x,y:v.y,zoom:v.k},J.on("start",y=>{var T;if(!y.sourceEvent)return null;b=y.sourceEvent.button,E.value=!0;const q=le(y.transform);((T=y.sourceEvent)==null?void 0:T.type)==="mousedown"&&(O.value=!0),$=q,M.viewportChangeStart(q),M.moveStart({event:y,flowTransform:q})}),J.on("end",y=>{if(!y.sourceEvent)return null;if(E.value=!1,O.value=!1,F(K.value,b??0)&&!P&&M.paneContextMenu(y.sourceEvent),P=!1,j($,y.transform)){const T=le(y.transform);$=T,M.viewportChangeEnd(T),M.moveEnd({event:y,flowTransform:T})}}),J.filter(y=>{var T;const q=z.value||S.value,U=p.value&&y.ctrlKey,Z=y.button;if(Z===1&&y.type==="mousedown"&&(ae(y,"vue-flow__node")||ae(y,"vue-flow__edge")))return!0;if(!K.value&&!q&&!Q.value&&!h.value&&!p.value||C.value||!h.value&&y.type==="dblclick"||ae(y,N.value)&&y.type==="wheel"||ae(y,k.value)&&(y.type!=="wheel"||Q.value&&y.type==="wheel"&&!z.value)||!p.value&&y.ctrlKey&&y.type==="wheel"||!q&&!Q.value&&!U&&y.type==="wheel")return!1;if(!p&&y.type==="touchstart"&&((T=y.touches)==null?void 0:T.length)>1)return y.preventDefault(),!1;if(!K.value&&(y.type==="mousedown"||y.type==="touchstart")||l.value===!0&&Array.isArray(f.value)&&f.value.includes(0)&&Z===0||Array.isArray(f.value)&&!f.value.includes(Z)&&(y.type==="mousedown"||y.type==="touchstart"))return!1;const ee=Array.isArray(f.value)&&f.value.includes(Z)||l.value===!0&&Array.isArray(f.value)&&!f.value.includes(0)||!Z||Z<=1;return(!y.ctrlKey||V.value||y.type==="wheel")&&ee}),a.watch([C,K],()=>{C.value&&!E.value?J.on("zoom",null):C.value||J.on("zoom",y=>{B.value={x:y.transform.x,y:y.transform.y,zoom:y.transform.k};const T=le(y.transform);P=F(K.value,b??0),M.viewportChange(T),M.move({event:y,flowTransform:T})})},{immediate:!0}),a.watch([C,Q,c,z,p,x,N],()=>{Q.value&&!z.value&&!C.value?ne.on("wheel.zoom",y=>{if(ae(y,N.value))return!1;const T=z.value||S.value,q=p.value&&y.ctrlKey;if(!(!x.value||Q.value||T||q))return!1;y.preventDefault(),y.stopImmediatePropagation();const Z=ne.property("__zoom").k||1,ee=Ft();if(!V.value&&y.ctrlKey&&p.value&&ee){const pt=_e(y),Xc=X(y),Uc=Z*2**Xc;J.scaleTo(ne,Uc,pt,y);return}const re=y.deltaMode===1?20:1;let se=c.value===ct.Vertical?0:y.deltaX*re,ce=c.value===ct.Horizontal?0:y.deltaY*re;!ee&&y.shiftKey&&c.value!==ct.Vertical&&!se&&ce&&(se=ce,ce=0),J.translateBy(ne,-(se/Z)*d.value,-(ce/Z)*d.value);const Ne=le(ne.property("__zoom"));w&&clearTimeout(w),W.value?(M.move({event:y,flowTransform:Ne}),M.viewportChange(Ne),w=setTimeout(()=>{M.moveEnd({event:y,flowTransform:Ne}),M.viewportChangeEnd(Ne),W.value=!1},150)):(W.value=!0,M.moveStart({event:y,flowTransform:Ne}),M.viewportChangeStart(Ne))},{passive:!1}):typeof ie<"u"&&ne.on("wheel.zoom",function(y,T){const q=!x.value&&y.type==="wheel"&&!y.ctrlKey,U=z.value||S.value,Z=p.value&&y.ctrlKey;if(!U&&!u.value&&!Z&&y.type==="wheel"||q||ae(y,N.value))return null;y.preventDefault(),ie.call(this,y,T)},{passive:!1})},{immediate:!0})});function F(te,ue){return ue===2&&Array.isArray(te)&&te.includes(2)}function X(te){const ue=te.ctrlKey&&Ft()?10:1;return-te.deltaY*(te.deltaMode===1?.05:te.deltaMode?1:.002)*ue}function j(te,ue){return te.x!==ue.x&&!Number.isNaN(ue.x)||te.y!==ue.y&&!Number.isNaN(ue.y)||te.zoom!==ue.k&&!Number.isNaN(ue.k)}function le(te){return{x:te.x,y:te.y,zoom:te.k}}function ae(te,ue){return te.target.closest(`.${ue}`)}return(te,ue)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"viewportRef",ref:A,class:"vue-flow__viewport vue-flow__container"},[a.createVNode(ju,{"is-selecting":oe.value,"selection-key-pressed":a.unref(H),class:a.normalizeClass({connecting:!!a.unref(_),dragging:a.unref(O),draggable:a.unref(f)===!0||Array.isArray(a.unref(f))&&a.unref(f).includes(0)})},{default:a.withCtx(()=>[a.createVNode(Qu,null,{default:a.withCtx(()=>[a.renderSlot(te.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),nc=["id"],oc=["id"],ic=["id"],rc={name:"A11yDescriptions",compatConfig:{MODE:3}},lc=a.defineComponent({...rc,setup(e){const{id:t,disableKeyboardA11y:n,ariaLiveMessage:o}=de();return(i,r)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("div",{id:`${a.unref(Oo)}-${a.unref(t)}`,style:{display:"none"}}," Press enter or space to select a node. "+a.toDisplayString(a.unref(n)?"":"You can then use the arrow keys to move the node around.")+" You can then use the arrow keys to move the node around, press delete to remove it and press escape to cancel. ",9,nc),a.createElementVNode("div",{id:`${a.unref(zo)}-${a.unref(t)}`,style:{display:"none"}}," Press enter or space to select an edge. You can then press delete to remove it or press escape to cancel. ",8,oc),a.unref(n)?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("div",{key:0,id:`${a.unref(Ts)}-${a.unref(t)}`,"aria-live":"assertive","aria-atomic":"true",style:{position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)","clip-path":"inset(100%)"}},a.toDisplayString(a.unref(o)),9,ic))],64))}});function ac(){const e=de();a.watch(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function sc(e,t,n){return n===R.Left?e-t:n===R.Right?e+t:e}function uc(e,t,n){return n===R.Top?e-t:n===R.Bottom?e+t:e}const zn=function({radius:e=10,centerX:t=0,centerY:n=0,position:o=R.Top,type:i}){return a.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${i}`,cx:sc(t,e,o),cy:uc(n,e,o),r:e,stroke:"transparent",fill:"transparent"})};zn.props=["radius","centerX","centerY","position","type"],zn.compatConfig={MODE:3};const Ti=zn,cc=a.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:t,addSelectedEdges:n,connectionMode:o,edgeUpdaterRadius:i,emits:r,nodesSelectionActive:l,noPanClassName:s,getEdgeTypes:u,removeSelectedEdges:c,findEdge:d,findNode:f,isValidConnection:h,multiSelectionActive:p,disableKeyboardA11y:S,elementsSelectable:x,edgesUpdatable:N,edgesFocusable:k,hooks:M}=de(),_=a.computed(()=>d(e.id)),{emit:C,on:O}=lu(_.value,r),G=a.inject(Xt),Y=a.getCurrentInstance(),I=a.ref(!1),B=a.ref(!1),A=a.ref(""),D=a.ref(null),E=a.ref("source"),W=a.ref(null),w=a.toRef(()=>typeof _.value.selectable>"u"?x.value:_.value.selectable),P=a.toRef(()=>typeof _.value.updatable>"u"?N.value:_.value.updatable),b=a.toRef(()=>typeof _.value.focusable>"u"?k.value:_.value.focusable);a.provide(ou,e.id),a.provide(iu,W);const $=a.computed(()=>_.value.class instanceof Function?_.value.class(_.value):_.value.class),V=a.computed(()=>_.value.style instanceof Function?_.value.style(_.value):_.value.style),H=a.computed(()=>{const g=_.value.type||"default",v=G?.[`edge-${g}`];if(v)return v;let y=_.value.template??u.value[g];if(typeof y=="string"&&Y){const T=Object.keys(Y.appContext.components);T&&T.includes(g)&&(y=a.resolveComponent(g,!1))}return y&&typeof y!="string"?y:(r.error(new ge(fe.EDGE_TYPE_MISSING,y)),!1)}),{handlePointerDown:z}=vi({nodeId:A,handleId:D,type:E,isValidConnection:h,edgeUpdaterType:E,onEdgeUpdate:oe,onEdgeUpdateEnd:F});return()=>{const g=f(_.value.source),v=f(_.value.target),y="pathOptions"in _.value?_.value.pathOptions:{};if(!g&&!v)return r.error(new ge(fe.EDGE_SOURCE_TARGET_MISSING,_.value.id,_.value.source,_.value.target)),null;if(!g)return r.error(new ge(fe.EDGE_SOURCE_MISSING,_.value.id,_.value.source)),null;if(!v)return r.error(new ge(fe.EDGE_TARGET_MISSING,_.value.id,_.value.target)),null;if(!_.value||_.value.hidden||g.hidden||v.hidden)return null;let T;o.value===Pe.Strict?T=g.handleBounds.source:T=[...g.handleBounds.source||[],...g.handleBounds.target||[]];const q=ri(T,_.value.sourceHandle);let U;o.value===Pe.Strict?U=v.handleBounds.target:U=[...v.handleBounds.target||[],...v.handleBounds.source||[]];const Z=ri(U,_.value.targetHandle),ee=q?.position||R.Bottom,re=Z?.position||R.Top,{x:se,y:ce}=je(g,q,ee),{x:Ne,y:pt}=je(v,Z,re);return _.value.sourceX=se,_.value.sourceY=ce,_.value.targetX=Ne,_.value.targetY=pt,a.h("g",{ref:W,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${H.value===!1?"default":_.value.type||"default"}`,s.value,$.value,{updating:I.value,selected:_.value.selected,animated:_.value.animated,inactive:!w.value&&!M.value.edgeClick.hasListeners()}],tabIndex:b.value?0:void 0,"aria-label":_.value.ariaLabel===null?void 0:_.value.ariaLabel??`Edge from ${_.value.source} to ${_.value.target}`,"aria-describedby":b.value?`${zo}-${t}`:void 0,"aria-roledescription":"edge",role:b.value?"group":"img",..._.value.domAttributes,onClick:j,onContextmenu:le,onDblclick:ae,onMouseenter:te,onMousemove:ue,onMouseleave:J,onKeyDown:b.value?m:void 0},[B.value?null:a.h(H.value===!1?u.value.default:H.value,{id:e.id,sourceNode:g,targetNode:v,source:_.value.source,target:_.value.target,type:_.value.type,updatable:P.value,selected:_.value.selected,animated:_.value.animated,label:_.value.label,labelStyle:_.value.labelStyle,labelShowBg:_.value.labelShowBg,labelBgStyle:_.value.labelBgStyle,labelBgPadding:_.value.labelBgPadding,labelBgBorderRadius:_.value.labelBgBorderRadius,data:_.value.data,events:{..._.value.events,...O},style:V.value,markerStart:`url('#${gt(_.value.markerStart,t)}')`,markerEnd:`url('#${gt(_.value.markerEnd,t)}')`,sourcePosition:ee,targetPosition:re,sourceX:se,sourceY:ce,targetX:Ne,targetY:pt,sourceHandleId:_.value.sourceHandle,targetHandleId:_.value.targetHandle,interactionWidth:_.value.interactionWidth,...y}),[P.value==="source"||P.value===!0?[a.h("g",{onMousedown:ne,onMouseenter:K,onMouseout:Q},a.h(Ti,{position:ee,centerX:se,centerY:ce,radius:i.value,type:"source","data-type":"source"}))]:null,P.value==="target"||P.value===!0?[a.h("g",{onMousedown:ie,onMouseenter:K,onMouseout:Q},a.h(Ti,{position:re,centerX:Ne,centerY:pt,radius:i.value,type:"target","data-type":"target"}))]:null]])};function K(){I.value=!0}function Q(){I.value=!1}function oe(g,v){C.update({event:g,edge:_.value,connection:v})}function F(g){C.updateEnd({event:g,edge:_.value}),B.value=!1}function X(g,v){g.button===0&&(B.value=!0,A.value=v?_.value.target:_.value.source,D.value=(v?_.value.targetHandle:_.value.sourceHandle)??null,E.value=v?"target":"source",C.updateStart({event:g,edge:_.value}),z(g))}function j(g){var v;const y={event:g,edge:_.value};w.value&&(l.value=!1,_.value.selected&&p.value?(c([_.value]),(v=W.value)==null||v.blur()):n([_.value])),C.click(y)}function le(g){C.contextMenu({event:g,edge:_.value})}function ae(g){C.doubleClick({event:g,edge:_.value})}function te(g){C.mouseEnter({event:g,edge:_.value})}function ue(g){C.mouseMove({event:g,edge:_.value})}function J(g){C.mouseLeave({event:g,edge:_.value})}function ne(g){X(g,!0)}function ie(g){X(g,!1)}function m(g){var v;!S.value&&Ro.includes(g.key)&&w.value&&(g.key==="Escape"?((v=W.value)==null||v.blur(),c([d(e.id)])):n([d(e.id)]))}}}),dc=a.defineComponent({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:t,connectionMode:n,connectionStartHandle:o,connectionEndHandle:i,connectionPosition:r,connectionLineType:l,connectionLineStyle:s,connectionLineOptions:u,connectionStatus:c,viewport:d,findNode:f}=de(),h=(e=a.inject(Xt))==null?void 0:e["connection-line"],p=a.computed(()=>{var M;return f((M=o.value)==null?void 0:M.nodeId)}),S=a.computed(()=>{var M;return f((M=i.value)==null?void 0:M.nodeId)??null}),x=a.computed(()=>({x:(r.value.x-d.value.x)/d.value.zoom,y:(r.value.y-d.value.y)/d.value.zoom})),N=a.computed(()=>u.value.markerStart?`url(#${gt(u.value.markerStart,t)})`:""),k=a.computed(()=>u.value.markerEnd?`url(#${gt(u.value.markerEnd,t)})`:"");return()=>{var M,_,C;if(!p.value||!o.value)return null;const O=o.value.id,G=o.value.type,Y=p.value.handleBounds;let I=Y?.[G]??[];if(n.value===Pe.Loose){const V=Y?.[G==="source"?"target":"source"]??[];I=[...I,...V]}if(!I)return null;const B=(O?I.find(V=>V.id===O):I[0])??null,A=B?.position??R.Top,{x:D,y:E}=je(p.value,B,A);let W=null;S.value&&(n.value===Pe.Strict?W=((M=S.value.handleBounds[G==="source"?"target":"source"])==null?void 0:M.find(V=>{var H;return V.id===((H=i.value)==null?void 0:H.id)}))||null:W=((_=[...S.value.handleBounds.source??[],...S.value.handleBounds.target??[]])==null?void 0:_.find(V=>{var H;return V.id===((H=i.value)==null?void 0:H.id)}))||null);const w=((C=i.value)==null?void 0:C.position)??(A?Tn[A]:null);if(!A||!w)return null;const P=l.value??u.value.type??He.Bezier;let b="";const $={sourceX:D,sourceY:E,sourcePosition:A,targetX:x.value.x,targetY:x.value.y,targetPosition:w};return P===He.Bezier?[b]=An($):P===He.Step?[b]=On({...$,borderRadius:0}):P===He.SmoothStep?[b]=On($):P===He.SimpleBezier?[b]=Ci($):b=`M${D},${E} ${x.value.x},${x.value.y}`,a.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},a.h("g",{class:"vue-flow__connection"},h?a.h(h,{sourceX:D,sourceY:E,sourcePosition:A,targetX:x.value.x,targetY:x.value.y,targetPosition:w,sourceNode:p.value,sourceHandle:B,targetNode:S.value,targetHandle:W,markerEnd:k.value,markerStart:N.value,connectionStatus:c.value}):a.h("path",{d:b,class:[u.value.class,c,"vue-flow__connection-path"],style:{...s.value,...u.value.style},"marker-end":k.value,"marker-start":N.value})))}}}),fc=["id","markerWidth","markerHeight","markerUnits","orient"],hc={name:"MarkerType",compatConfig:{MODE:3}},gc=a.defineComponent({...hc,props:{id:{},type:{},color:{default:"none"},width:{default:12.5},height:{default:12.5},markerUnits:{default:"strokeWidth"},orient:{default:"auto-start-reverse"},strokeWidth:{default:1}},setup(e){return(t,n)=>(a.openBlock(),a.createElementBlock("marker",{id:t.id,class:"vue-flow__arrowhead",viewBox:"-10 -10 20 20",refX:"0",refY:"0",markerWidth:`${t.width}`,markerHeight:`${t.height}`,markerUnits:t.markerUnits,orient:t.orient},[t.type===a.unref(bn).ArrowClosed?(a.openBlock(),a.createElementBlock("polyline",{key:0,style:a.normalizeStyle({stroke:t.color,fill:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",points:"-5,-4 0,0 -5,4 -5,-4"},null,4)):a.createCommentVNode("",!0),t.type===a.unref(bn).Arrow?(a.openBlock(),a.createElementBlock("polyline",{key:1,style:a.normalizeStyle({stroke:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):a.createCommentVNode("",!0)],8,fc))}}),pc={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},mc={name:"MarkerDefinitions",compatConfig:{MODE:3}},yc=a.defineComponent({...mc,setup(e){const{id:t,edges:n,connectionLineOptions:o,defaultMarkerColor:i}=de(),r=a.computed(()=>{const l=new Set,s=[],u=c=>{if(c){const d=gt(c,t);l.has(d)||(typeof c=="object"?s.push({...c,id:d,color:c.color||i.value}):s.push({id:d,color:i.value,type:c}),l.add(d))}};for(const c of[o.value.markerEnd,o.value.markerStart])u(c);for(const c of n.value)for(const d of[c.markerStart,c.markerEnd])u(d);return s.sort((c,d)=>c.id.localeCompare(d.id))});return(l,s)=>(a.openBlock(),a.createElementBlock("svg",pc,[a.createElementVNode("defs",null,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(r.value,u=>(a.openBlock(),a.createBlock(gc,{id:u.id,key:u.id,type:u.type,color:u.color,width:u.width,height:u.height,markerUnits:u.markerUnits,"stroke-width":u.strokeWidth,orient:u.orient},null,8,["id","type","color","width","height","markerUnits","stroke-width","orient"]))),128))])]))}}),vc={name:"Edges",compatConfig:{MODE:3}},wc=a.defineComponent({...vc,setup(e){const{findNode:t,getEdges:n,elevateEdgesOnSelect:o}=de();return(i,r)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createVNode(yc),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(n),l=>(a.openBlock(),a.createElementBlock("svg",{key:l.id,class:"vue-flow__edges vue-flow__container",style:a.normalizeStyle({zIndex:a.unref(Gs)(l,a.unref(t),a.unref(o))})},[a.createVNode(a.unref(cc),{id:l.id},null,8,["id"])],4))),128)),a.createVNode(a.unref(dc))],64))}}),_c=a.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:t,noPanClassName:n,selectNodesOnDrag:o,nodesSelectionActive:i,multiSelectionActive:r,emits:l,removeSelectedNodes:s,addSelectedNodes:u,updateNodeDimensions:c,onUpdateNodeInternals:d,getNodeTypes:f,nodeExtent:h,elevateNodesOnSelect:p,disableKeyboardA11y:S,ariaLiveMessage:x,snapToGrid:N,snapGrid:k,nodeDragThreshold:M,nodesDraggable:_,elementsSelectable:C,nodesConnectable:O,nodesFocusable:G,hooks:Y}=de(),I=a.ref(null);a.provide(mi,I),a.provide(pi,e.id);const B=a.inject(Xt),A=a.getCurrentInstance(),D=_i(),{node:E,parentNode:W}=wi(e.id),{emit:w,on:P}=cu(E,l),b=a.toRef(()=>typeof E.draggable>"u"?_.value:E.draggable),$=a.toRef(()=>typeof E.selectable>"u"?C.value:E.selectable),V=a.toRef(()=>typeof E.connectable>"u"?O.value:E.connectable),H=a.toRef(()=>typeof E.focusable>"u"?G.value:E.focusable),z=a.computed(()=>$.value||b.value||Y.value.nodeClick.hasListeners()||Y.value.nodeDoubleClick.hasListeners()||Y.value.nodeMouseEnter.hasListeners()||Y.value.nodeMouseMove.hasListeners()||Y.value.nodeMouseLeave.hasListeners()),K=a.toRef(()=>!!E.dimensions.width&&!!E.dimensions.height),Q=a.computed(()=>{const v=E.type||"default",y=B?.[`node-${v}`];if(y)return y;let T=E.template||f.value[v];if(typeof T=="string"&&A){const q=Object.keys(A.appContext.components);q&&q.includes(v)&&(T=a.resolveComponent(v,!1))}return T&&typeof T!="string"?T:(l.error(new ge(fe.NODE_TYPE_MISSING,T)),!1)}),oe=yi({id:e.id,el:I,disabled:()=>!b.value,selectable:$,dragHandle:()=>E.dragHandle,onStart(v){w.dragStart(v)},onDrag(v){w.drag(v)},onStop(v){w.dragStop(v)},onClick(v){m(v)}}),F=a.computed(()=>E.class instanceof Function?E.class(E):E.class),X=a.computed(()=>{const v=(E.style instanceof Function?E.style(E):E.style)||{},y=E.width instanceof Function?E.width(E):E.width,T=E.height instanceof Function?E.height(E):E.height;return!v.width&&y&&(v.width=typeof y=="string"?y:`${y}px`),!v.height&&T&&(v.height=typeof T=="string"?T:`${T}px`),v}),j=a.toRef(()=>Number(E.zIndex??X.value.zIndex??0));return d(v=>{(v.includes(e.id)||!v.length)&&ae()}),a.onMounted(()=>{a.watch(()=>E.hidden,(v=!1,y,T)=>{!v&&I.value&&(e.resizeObserver.observe(I.value),T(()=>{I.value&&e.resizeObserver.unobserve(I.value)}))},{immediate:!0,flush:"post"})}),a.watch([()=>E.type,()=>E.sourcePosition,()=>E.targetPosition],()=>{a.nextTick(()=>{c([{id:e.id,nodeElement:I.value,forceUpdate:!0}])})}),a.watch([()=>E.position.x,()=>E.position.y,()=>{var v;return(v=W.value)==null?void 0:v.computedPosition.x},()=>{var v;return(v=W.value)==null?void 0:v.computedPosition.y},()=>{var v;return(v=W.value)==null?void 0:v.computedPosition.z},j,()=>E.selected,()=>E.dimensions.height,()=>E.dimensions.width,()=>{var v;return(v=W.value)==null?void 0:v.dimensions.height},()=>{var v;return(v=W.value)==null?void 0:v.dimensions.width}],([v,y,T,q,U,Z])=>{const ee={x:v,y,z:Z+(p.value&&E.selected?1e3:0)};typeof T<"u"&&typeof q<"u"?E.computedPosition=zs({x:T,y:q,z:U},ee):E.computedPosition=ee},{flush:"post",immediate:!0}),a.watch([()=>E.extent,h],([v,y],[T,q])=>{(v!==T||y!==q)&&le()}),E.extent==="parent"||typeof E.extent=="object"&&"range"in E.extent&&E.extent.range==="parent"?Qt(()=>K).toBe(!0).then(le):le(),()=>E.hidden?null:a.h("div",{ref:I,"data-id":E.id,class:["vue-flow__node",`vue-flow__node-${Q.value===!1?"default":E.type||"default"}`,{[n.value]:b.value,dragging:oe?.value,draggable:b.value,selected:E.selected,selectable:$.value,parent:E.isParent},F.value],style:{visibility:K.value?"visible":"hidden",zIndex:E.computedPosition.z??j.value,transform:`translate(${E.computedPosition.x}px,${E.computedPosition.y}px)`,pointerEvents:z.value?"all":"none",...X.value},tabIndex:H.value?0:void 0,role:H.value?"group":void 0,"aria-describedby":S.value?void 0:`${Oo}-${t}`,"aria-label":E.ariaLabel,"aria-roledescription":"node",...E.domAttributes,onMouseenter:te,onMousemove:ue,onMouseleave:J,onContextmenu:ne,onClick:m,onDblclick:ie,onKeydown:g},[a.h(Q.value===!1?f.value.default:Q.value,{id:E.id,type:E.type,data:E.data,events:{...E.events,...P},selected:E.selected,resizing:E.resizing,dragging:oe.value,connectable:V.value,position:E.computedPosition,dimensions:E.dimensions,isValidTargetPos:E.isValidTargetPos,isValidSourcePos:E.isValidSourcePos,parent:E.parentNode,parentNodeId:E.parentNode,zIndex:E.computedPosition.z??j.value,targetPosition:E.targetPosition,sourcePosition:E.sourcePosition,label:E.label,dragHandle:E.dragHandle,onUpdateNodeInternals:ae})]);function le(){const v=E.computedPosition,{computedPosition:y,position:T}=kn(E,N.value?Yt(v,k.value):v,l.error,h.value,W.value);(E.computedPosition.x!==y.x||E.computedPosition.y!==y.y)&&(E.computedPosition={...E.computedPosition,...y}),(E.position.x!==T.x||E.position.y!==T.y)&&(E.position=T)}function ae(){I.value&&c([{id:e.id,nodeElement:I.value,forceUpdate:!0}])}function te(v){oe?.value||w.mouseEnter({event:v,node:E})}function ue(v){oe?.value||w.mouseMove({event:v,node:E})}function J(v){oe?.value||w.mouseLeave({event:v,node:E})}function ne(v){return w.contextMenu({event:v,node:E})}function ie(v){return w.doubleClick({event:v,node:E})}function m(v){$.value&&(!o.value||!b.value||M.value>0)&&Pn(E,r.value,u,s,i,!1,I.value),w.click({event:v,node:E})}function g(v){if(!(xn(v)||S.value))if(Ro.includes(v.key)&&$.value){const y=v.key==="Escape";Pn(E,r.value,u,s,i,y,I.value)}else b.value&&E.selected&&qe[v.key]&&(v.preventDefault(),x.value=`Moved selected node ${v.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~E.position.x}, y: ${~~E.position.y}`,D({x:qe[v.key].x,y:qe[v.key].y},v.shiftKey))}}}),Ec={height:"0",width:"0"},bc={name:"EdgeLabelRenderer",compatConfig:{MODE:3}},xc=a.defineComponent({...bc,setup(e){const{viewportRef:t}=de(),n=a.toRef(()=>{var o;return(o=t.value)==null?void 0:o.getElementsByClassName("vue-flow__edge-labels")[0]});return(o,i)=>(a.openBlock(),a.createElementBlock("svg",null,[(a.openBlock(),a.createElementBlock("foreignObject",Ec,[(a.openBlock(),a.createBlock(a.Teleport,{to:n.value,disabled:!n.value},[a.renderSlot(o.$slots,"default")],8,["to","disabled"]))]))]))}});function Sc(e={includeHiddenNodes:!1}){const{nodes:t}=de();return a.computed(()=>{if(t.value.length===0)return!1;for(const n of t.value)if((e.includeHiddenNodes||!n.hidden)&&(n?.handleBounds===void 0||n.dimensions.width===0||n.dimensions.height===0))return!1;return!0})}const Nc={class:"vue-flow__nodes vue-flow__container"},Cc={name:"Nodes",compatConfig:{MODE:3}},kc=a.defineComponent({...Cc,setup(e){const{getNodes:t,updateNodeDimensions:n,emits:o}=de(),i=Sc(),r=a.ref();return a.watch(i,l=>{l&&a.nextTick(()=>{o.nodesInitialized(t.value)})},{immediate:!0}),a.onMounted(()=>{r.value=new ResizeObserver(l=>{const s=l.map(u=>({id:u.target.getAttribute("data-id"),nodeElement:u.target,forceUpdate:!0}));a.nextTick(()=>n(s))})}),a.onBeforeUnmount(()=>{var l;return(l=r.value)==null?void 0:l.disconnect()}),(l,s)=>(a.openBlock(),a.createElementBlock("div",Nc,[r.value?(a.openBlock(!0),a.createElementBlock(a.Fragment,{key:0},a.renderList(a.unref(t),(u,c,d,f)=>{const h=[u.id];if(f&&f.key===u.id&&a.isMemoSame(f,h))return f;const p=(a.openBlock(),a.createBlock(a.unref(_c),{id:u.id,key:u.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return p.memo=h,p},s,0),128)):a.createCommentVNode("",!0)]))}});function Mc(){const{emits:e}=de();a.onMounted(()=>{if(ui()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new ge(fe.MISSING_STYLES))}})}const Ic=a.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),Tc={name:"VueFlow",compatConfig:{MODE:3}},Pc=a.defineComponent({...Tc,props:{id:{},modelValue:{},nodes:{},edges:{},edgeTypes:{},nodeTypes:{},connectionMode:{},connectionLineType:{},connectionLineStyle:{default:void 0},connectionLineOptions:{default:void 0},connectionRadius:{},isValidConnection:{type:[Function,null],default:void 0},deleteKeyCode:{default:void 0},selectionKeyCode:{type:[Boolean,null],default:void 0},multiSelectionKeyCode:{default:void 0},zoomActivationKeyCode:{default:void 0},panActivationKeyCode:{default:void 0},snapToGrid:{type:Boolean,default:void 0},snapGrid:{},onlyRenderVisibleElements:{type:Boolean,default:void 0},edgesUpdatable:{type:[Boolean,String],default:void 0},nodesDraggable:{type:Boolean,default:void 0},nodesConnectable:{type:Boolean,default:void 0},nodeDragThreshold:{},elementsSelectable:{type:Boolean,default:void 0},selectNodesOnDrag:{type:Boolean,default:void 0},panOnDrag:{type:[Boolean,Array],default:void 0},minZoom:{},maxZoom:{},defaultViewport:{},translateExtent:{},nodeExtent:{},defaultMarkerColor:{},zoomOnScroll:{type:Boolean,default:void 0},zoomOnPinch:{type:Boolean,default:void 0},panOnScroll:{type:Boolean,default:void 0},panOnScrollSpeed:{},panOnScrollMode:{},paneClickDistance:{},zoomOnDoubleClick:{type:Boolean,default:void 0},preventScrolling:{type:Boolean,default:void 0},selectionMode:{},edgeUpdaterRadius:{},fitViewOnInit:{type:Boolean,default:void 0},connectOnClick:{type:Boolean,default:void 0},applyDefault:{type:Boolean,default:void 0},autoConnect:{type:[Boolean,Function],default:void 0},noDragClassName:{},noWheelClassName:{},noPanClassName:{},defaultEdgeOptions:{},elevateEdgesOnSelect:{type:Boolean,default:void 0},elevateNodesOnSelect:{type:Boolean,default:void 0},disableKeyboardA11y:{type:Boolean,default:void 0},edgesFocusable:{type:Boolean,default:void 0},nodesFocusable:{type:Boolean,default:void 0},autoPanOnConnect:{type:Boolean,default:void 0},autoPanOnNodeDrag:{type:Boolean,default:void 0},autoPanSpeed:{}},emits:["nodesChange","edgesChange","nodesInitialized","paneReady","init","updateNodeInternals","error","connect","connectStart","connectEnd","clickConnectStart","clickConnectEnd","moveStart","move","moveEnd","selectionDragStart","selectionDrag","selectionDragStop","selectionContextMenu","selectionStart","selectionEnd","viewportChangeStart","viewportChange","viewportChangeEnd","paneScroll","paneClick","paneContextMenu","paneMouseEnter","paneMouseMove","paneMouseLeave","edgeUpdate","edgeContextMenu","edgeMouseEnter","edgeMouseMove","edgeMouseLeave","edgeDoubleClick","edgeClick","edgeUpdateStart","edgeUpdateEnd","nodeContextMenu","nodeMouseEnter","nodeMouseMove","nodeMouseLeave","nodeDoubleClick","nodeClick","nodeDragStart","nodeDrag","nodeDragStop","miniMapNodeClick","miniMapNodeDoubleClick","miniMapNodeMouseEnter","miniMapNodeMouseMove","miniMapNodeMouseLeave","update:modelValue","update:nodes","update:edges"],setup(e,{expose:t,emit:n}){const o=e,i=a.useSlots(),r=en(o,"modelValue",n),l=en(o,"nodes",n),s=en(o,"edges",n),u=de(o),c=gu({modelValue:r,nodes:l,edges:s},o,u);return mu(n,u.hooks),ac(),Mc(),a.provide(Xt,i),a.onUnmounted(()=>{c()}),t(u),(d,f)=>(a.openBlock(),a.createElementBlock("div",{ref:a.unref(u).vueFlowRef,class:"vue-flow"},[a.createVNode(tc,null,{default:a.withCtx(()=>[a.createVNode(wc),Ic,a.createVNode(kc),a.renderSlot(d.$slots,"zoom-pane")]),_:3}),a.renderSlot(d.$slots,"default"),a.createVNode(lc)],512))}}),$c=["id","d","marker-end"],Bc={class:"vue-flow__edge-label"},Dc={key:0,class:"label-input-wrapper"},Vc={inheritAttrs:!1},Ac=a.defineComponent({...Vc,__name:"EditableEdge",props:{id:{},sourceNode:{},targetNode:{},source:{},target:{},type:{},label:{},style:{},selected:{type:Boolean},sourcePosition:{},targetPosition:{},sourceHandleId:{},targetHandleId:{},animated:{type:Boolean},updatable:{type:Boolean},markerStart:{},markerEnd:{},curvature:{},interactionWidth:{},data:{},events:{},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{},sourceX:{},sourceY:{},targetX:{},targetY:{}},emits:["change"],setup(e,{emit:t}){const n=e,o=t,i=a.useTemplateRef("labelInput"),r=a.ref(""),l=a.ref(!1);let s=0;const u=async()=>{let h=Date.now();h-s<500&&!l.value&&await c(),s=h},c=async()=>{r.value=n.label,l.value=!0,await a.nextTick(),i.value.focus()},d=()=>{l.value=!1,o("change",r.value)},f=a.computed(()=>An(n));return(h,p)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("path",{id:h.id,style:a.normalizeStyle(h.style),class:"vue-flow__edge-path",d:f.value[0],"marker-end":h.markerEnd},null,12,$c),a.createVNode(a.unref(xc),null,{default:a.withCtx(()=>[a.createElementVNode("div",{style:a.normalizeStyle({pointerEvents:"all",position:"absolute",transform:`translate(-50%, -50%) translate(${f.value[1]}px,${f.value[2]}px)`}),class:"nodrag nopan editable-edge-label",onClick:p[2]||(p[2]=S=>u())},[a.createElementVNode("div",Bc,a.toDisplayString(h.label),1),l.value?(a.openBlock(),a.createElementBlock("div",Dc,[a.withDirectives(a.createElementVNode("input",{ref:"labelInput",class:"label-input","onUpdate:modelValue":p[0]||(p[0]=S=>r.value=S),onBlur:p[1]||(p[1]=S=>l.value=!1),onKeypress:a.withKeys(d,["enter"])},null,544),[[a.vModelText,r.value]])])):a.createCommentVNode("",!0)],4)]),_:1})],64))}}),Oc={key:0,class:"label-input-wrapper"},zc=a.defineComponent({__name:"EditableNode",props:{id:{},type:{},selected:{type:Boolean},connectable:{type:[Boolean,Number,String,Function]},position:{},dimensions:{},label:{},isValidTargetPos:{type:Function},isValidSourcePos:{type:Function},parent:{},parentNodeId:{},dragging:{type:Boolean},resizing:{type:Boolean},zIndex:{},targetPosition:{},sourcePosition:{},dragHandle:{},data:{},events:{}},emits:["change"],setup(e,{emit:t}){const n=e,o=t,i=a.useTemplateRef("labelInput"),r=a.ref(""),l=a.ref(!1);let s=0;const u=async()=>{let f=Date.now();f-s<500&&!l.value&&await c(),s=f},c=async()=>{r.value=n.label,l.value=!0,await a.nextTick(),i.value.focus()},d=()=>{l.value=!1,o("change",r.value)};return(f,h)=>(a.openBlock(),a.createElementBlock("div",{onClick:h[2]||(h[2]=p=>u())},[a.createElementVNode("div",null,a.toDisplayString(f.label),1),l.value?(a.openBlock(),a.createElementBlock("div",Oc,[a.withDirectives(a.createElementVNode("input",{ref:"labelInput",class:"label-input","onUpdate:modelValue":h[0]||(h[0]=p=>r.value=p),onBlur:h[1]||(h[1]=p=>l.value=!1),onKeypress:a.withKeys(d,["enter"])},null,544),[[a.vModelText,r.value]])])):a.createCommentVNode("",!0),f.data.hasInput?(a.openBlock(),a.createBlock(a.unref(Je),{key:1,id:"a",type:"target",position:f.targetPosition},null,8,["position"])):a.createCommentVNode("",!0),f.data.hasOutput?(a.openBlock(),a.createBlock(a.unref(Je),{key:2,id:"b",type:"source",position:f.sourcePosition},null,8,["position"])):a.createCommentVNode("",!0)]))}}),Rc={class:"chart-controls"},Hc={class:"chart-controls-left"},Lc={class:"chart-controls-right"},Fc={key:0},Yc={key:1},Rn=a.defineComponent({__name:"NodeEditor",props:{modelValue:{},nodeContainerClass:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t,o=a.ref(!1),i=a.ref([]),r=a.ref(),l=a.ref(""),s=a.computed(()=>(i.value.forEach((I,B)=>{if(I.id===l.value)return B}),-1)),u=a.computed({get:()=>{const I=e.modelValue;for(const B of I)B.data={},B.type==="input"?(B.data.hasInput=!1,B.data.hasOutput=!0):B.type==="output"?(B.data.hasInput=!0,B.data.hasOutput=!1):(B.data.hasInput=!0,B.data.hasOutput=!0),B.class="vue-flow__node-default",B.type="editable";for(const B of I)B.events={click:()=>{l.value=B.id}};return I},set:I=>{n("update:modelValue",JSON.parse(JSON.stringify(I)))}}),{onConnect:c,addEdges:d,onEdgeContextMenu:f,onPaneReady:h,removeEdges:p}=de();a.onMounted(()=>{document.removeEventListener("keypress",M),document.addEventListener("keypress",M)}),a.onBeforeUnmount(()=>{document.removeEventListener("keypress",M)}),h(I=>{r.value=I}),i.value=u.value;const S=I=>({[R.Top]:R.Right,[R.Right]:R.Bottom,[R.Bottom]:R.Left,[R.Left]:R.Top})[I],x=()=>{if(s.value>-1){const I=i.value[s.value];I.sourcePosition=S(I.sourcePosition)}},N=()=>{if(s.value>-1){const I=i.value[s.value];I.targetPosition=S(I.targetPosition)}},k=I=>{window.scrollBy(0,I.deltaY)},M=I=>{o.value&&I.ctrlKey==!0&&((I.key=="+"||I.key=="=")&&r.value.zoomIn(),I.key=="-"&&r.value.zoomOut())},_=async()=>{await r.value.fitView()},C=()=>{let I=!1,B={x:Math.random()*200,y:Math.random()*200};if(s.value>-1){const E=i.value[s.value];E.data.hasOutput&&(B={x:E.position.x+200,y:E.position.y+50},I=!0)}const A=i.value.length,D=`node-${A}`;if(i.value.push({id:D,label:"Node "+A,sourcePosition:R.Right,targetPosition:R.Left,class:"vue-flow__node-default",type:"editable",data:{hasInput:!0,hasOutput:!0},events:{click:()=>{l.value=D}},position:B}),I){let E=`edge-${A+1}`;i.value.push({id:E,source:l.value,target:D,type:"editable",label:`EDGE ${A+1}`,animated:!0,events:{click:()=>{l.value=E}}})}},O=(I,B)=>{for(let A=0;A<i.value.length;A++)if(i.value[A].id==B){i.value[A].label=I;break}};c(I=>{const A={id:`edge-${i.value.length}`,source:I.source,target:I.target,type:"editable",label:"New Edge",interactionWidth:400,animated:!0,events:{click:()=>{l.value=A.id}}};d([A])});const Y=I=>{p(I)};return f(({event:I,edge:B})=>{Y(B.id)}),(I,B)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["node-editor-wrapper",I.nodeContainerClass]),onMouseover:B[1]||(B[1]=A=>o.value=!0),onMouseleave:B[2]||(B[2]=A=>o.value=!1)},[a.createElementVNode("div",Rc,[a.createElementVNode("div",Hc,[a.createElementVNode("div",null,[B[3]||(B[3]=a.createElementVNode("b",null,"Selected Node:",-1)),a.createTextVNode(" "+a.toDisplayString(l.value?l.value:"none"),1)])]),a.createElementVNode("div",Lc,[a.createElementVNode("div",null,[a.createElementVNode("button",{class:"button-default",onClick:C},"Add Node")]),a.createElementVNode("div",null,[a.createElementVNode("button",{class:"button-default",onClick:_},"Center")]),s.value>-1?(a.openBlock(),a.createElementBlock("div",Fc,[a.createElementVNode("button",{class:"button-default",onClick:N},"Shift Input Position")])):a.createCommentVNode("",!0),s.value>-1?(a.openBlock(),a.createElementBlock("div",Yc,[a.createElementVNode("button",{class:"button-default",onClick:x},"Shift Output Position")])):a.createCommentVNode("",!0)])]),i.value&&i.value.length?(a.openBlock(),a.createBlock(a.unref(Pc),{key:0,class:"nowheel","prevent-scrolling":!0,"zoom-on-scroll":!1,"fit-view-on-init":!0,modelValue:i.value,"onUpdate:modelValue":B[0]||(B[0]=A=>i.value=A),onWheel:a.withModifiers(k,["prevent"])},{"node-editable":a.withCtx(A=>[a.createVNode(zc,a.mergeProps(A,{onChange:D=>O(D,A.id)}),null,16,["onChange"])]),"edge-editable":a.withCtx(A=>[a.createVNode(Ac,a.mergeProps(A,{onChange:D=>O(D,A.id)}),null,16,["onChange"])]),_:1},8,["modelValue"])):a.createCommentVNode("",!0)],34))}}),Pi=a.defineComponent({__name:"StateEditor",props:a.mergeModels({layout:{},nodeContainerClass:{}},{modelValue:{},modelModifiers:{}}),emits:a.mergeModels(["update:modelValue"],["update:modelValue"]),setup(e,{emit:t}){const n=t,o=a.useModel(e,"modelValue"),i=a.computed({get:()=>{const l={},s=[],u={};if(!o.value)return s;let c=0;for(const[d,f]of Object.entries(o.value)){const h={id:d,label:d,position:e.layout[d]?.position||{x:200*c,y:100},targetPosition:e.layout[d]?.targetPosition||R.Left,sourcePosition:e.layout[d]?.sourcePosition||R.Right};f?.type==="final"&&(h.type="output",h.class="default-output-node"),u[d]=h}for(const[d,f]of Object.entries(o.value)){if(f?.on)for(const[h,p]of Object.entries(f.on)){const S=p.target||p;s.push({id:`${d}-${S}`,source:d,target:S,label:h,animated:!0}),l[S]=!0}c++}for(const[d,f]of Object.entries(u))l[d]||(f.type="input",f.class="default-input-node"),s.push(f);return s},set:l=>{r(l)}}),r=l=>{const s={},u={},c={};for(const d of l){const f=d.label;d.type==="input"?c[f]={on:{}}:d.type==="output"?c[f]={type:"final"}:d.source&&d.target?(s[d.source]=s[d.source]||{},s[d.source][f]={target:d.target}):c[f]={on:{}},u[d.id]=f}for(const[d,f]of Object.entries(s)){const h=u[d];for(const[p,S]of Object.entries(f))c[h]||(c[h]={on:{}}),c[h].on[p]=S}n("update:modelValue",c)};return(l,s)=>(a.openBlock(),a.createElementBlock("div",null,[a.createVNode(Rn,{modelValue:i.value,"onUpdate:modelValue":s[0]||(s[0]=u=>i.value=u),"node-container-class":l.nodeContainerClass},null,8,["modelValue","node-container-class"])]))}});function Gc(e){e.component("NodeEditor",Rn),e.component("StateEditor",Pi)}Ce.NodeEditor=Rn,Ce.StateEditor=Pi,Ce.install=Gc,Object.defineProperty(Ce,Symbol.toStringTag,{value:"Module"})});
|
|
27
27
|
//# sourceMappingURL=node-editor.umd.cjs.map
|