1234567891011121314151617181920212223242526 |
- import{d as se,aj as Ii,z as Ce,k as K,e as ue,o as Xe,b as Pi,X as Z,a6 as re,P as qe,u as x,a7 as It,c as Ot,S as Mi,w as _e,p as Pt,g as nn,ah as Qr,f as I,Z as G,M as Ti,N as pn,q as je,D as ea,r as ta,a9 as L,_ as ke,aa as Te,F as Ve,a2 as Pn,a8 as Qe,x as Mn,ak as na,Y as ge,G as Co,H as oa,al as ia,am as ye,ab as Xt,n as xe,U as De,R as ra,K as aa,a1 as sa,E as pe,$ as la,s as Tn,an as ua}from"./vue-fae2b924.js";import{b5 as Re,b6 as Rt,b7 as Di,M as Be,U as Se,b8 as Ai,s as Mt,L as zi,aI as ca,aH as pt,a0 as He,aV as Fe,G as Ye,V as da,b9 as Et,ba as st,c as Vt,a8 as Tt,b0 as _n,a6 as No,bb as Ht,e as Ae,bc as Kn,a_ as ro,bd as ze,a3 as Oi,be as Ri,bf as Bi,aZ as Bo,bg as fa,bh as ha,bi as pa,aY as Fi,bj as va,aG as ga,aa as ma,ab as ya,u as _a}from"./radical-3ee02118.js";import{u as nt,c as ao,g as wa,d as xa,e as ba,r as Sa,b as Ea,a as Ca}from"./global-f242879f.js";import{g as Na,a as ka}from"./logrotate-2ba3d251.js";import{S as $a}from"./state-2a3c36e1.js";import{s as Ia}from"./schema-e321c291.js";import{s as Pa}from"./tree-title-e88e18a0.js";import{g as Ma}from"./utils-f4f08b68.js";import{M as Ta,Y as Da}from"./index-cc40ab6a.js";import{u as Dn}from"./system-13158c13.js";import{g as Aa,a as za}from"./schema-2d8687f0.js";import{d as Oa,u as Ra}from"./pullOnStart-ed67ca2a.js";import{m as Ba,o as wt,p as Fa,j as La}from"./index-137e94ff.js";import{V as Va}from"./jb4-f3d7ce01.js";import{u as Ha}from"./useAddPushForm-f1f7a640.js";import{d as Ya,g as Li,a as wn}from"./mp4-f0802f05.js";import{V as Ga}from"./VideoPlayer-6cce6818.js";import"./monaco-43b45976.js";import"./canvas-14fb4930.js";function An(e){return Ti()?(pn(e),!0):!1}function ot(e){return typeof e=="function"?e():x(e)}const Ua=typeof window<"u"&&typeof document<"u",Xa=e=>typeof e<"u",Wa=Object.prototype.toString,Ka=e=>Wa.call(e)==="[object Object]",Za=()=>{};function qa(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 Vi=e=>e();function ja(e=Vi){const t=K(!0);function n(){t.value=!1}function o(){t.value=!0}const i=(...r)=>{t.value&&e(...r)};return{isActive:ra(t),pause:n,resume:o,eventFilter:i}}function Fo(e,t=!1,n="Timeout"){return new Promise((o,i)=>{setTimeout(t?()=>i(n):o,e)})}function Ja(e,t,n={}){const{eventFilter:o=Vi,...i}=n;return _e(e,qa(o,t),i)}function Ct(e,t,n={}){const{eventFilter:o,...i}=n,{eventFilter:r,pause:a,resume:s,isActive:u}=ja(o);return{stop:Ja(e,t,{...i,eventFilter:r}),pause:a,resume:s,isActive:u}}function Qa(e,t={}){if(!Co(e))return oa(e);const n=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const o in e.value)n[o]=ia(()=>({get(){return e.value[o]},set(i){var r;if((r=ot(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 so(e,t=!1){function n(d,{flush:f="sync",deep:_=!1,timeout:m,throwOnTimeout:v}={}){let p=null;const g=[new Promise(h=>{p=_e(e,w=>{d(w)!==t&&(p==null||p(),h(w))},{flush:f,deep:_,immediate:!0})})];return m!=null&&g.push(Fo(m,v).then(()=>ot(e)).finally(()=>p==null?void 0:p())),Promise.race(g)}function o(d,f){if(!Co(d))return n(w=>w===d,f);const{flush:_="sync",deep:m=!1,timeout:v,throwOnTimeout:p}=f??{};let y=null;const h=[new Promise(w=>{y=_e([e,d],([A,R])=>{t!==(A===R)&&(y==null||y(),w(A))},{flush:_,deep:m,immediate:!0})})];return v!=null&&h.push(Fo(v,p).then(()=>ot(e)).finally(()=>(y==null||y(),ot(e)))),Promise.race(h)}function i(d){return n(f=>!!f,d)}function r(d){return o(null,d)}function a(d){return o(void 0,d)}function s(d){return n(Number.isNaN,d)}function u(d,f){return n(_=>{const m=Array.from(_);return m.includes(d)||m.includes(ot(d))},f)}function l(d){return c(1,d)}function c(d=1,f){let _=-1;return n(()=>(_+=1,_>=d),f)}return Array.isArray(ot(e))?{toMatch:n,toContains:u,changed:l,changedTimes:c,get not(){return so(e,!t)}}:{toMatch:n,toBe:o,toBeTruthy:i,toBeNull:r,toBeNaN:s,toBeUndefined:a,changed:l,changedTimes:c,get not(){return so(e,!t)}}}function lo(e){return so(e)}function es(e){var t;const n=ot(e);return(t=n==null?void 0:n.$el)!=null?t:n}const Hi=Ua?window:void 0;function Yi(...e){let t,n,o,i;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,o,i]=e,t=Hi):[t,n,o,i]=e,!t)return Za;Array.isArray(n)||(n=[n]),Array.isArray(o)||(o=[o]);const r=[],a=()=>{r.forEach(c=>c()),r.length=0},s=(c,d,f,_)=>(c.addEventListener(d,f,_),()=>c.removeEventListener(d,f,_)),u=_e(()=>[es(t),ot(i)],([c,d])=>{if(a(),!c)return;const f=Ka(d)?{...d}:d;r.push(...n.flatMap(_=>o.map(m=>s(c,_,m,f))))},{immediate:!0,flush:"post"}),l=()=>{u(),a()};return An(l),l}function ts(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function Lo(...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=Hi,eventName:r="keydown",passive:a=!1,dedupe:s=!1}=o,u=ts(t);return Yi(i,r,c=>{c.repeat&&ot(s)||u(c)&&n(c)},a)}function ns(e){return JSON.parse(JSON.stringify(e))}function Zn(e,t,n,o={}){var i,r,a;const{clone:s=!1,passive:u=!1,eventName:l,deep:c=!1,defaultValue:d,shouldEmit:f}=o,_=nn(),m=n||(_==null?void 0:_.emit)||((i=_==null?void 0:_.$emit)==null?void 0:i.bind(_))||((a=(r=_==null?void 0:_.proxy)==null?void 0:r.$emit)==null?void 0:a.bind(_==null?void 0:_.proxy));let v=l;t||(t="modelValue"),v=v||`update:${t.toString()}`;const p=h=>s?typeof s=="function"?s(h):ns(h):h,y=()=>Xa(e[t])?p(e[t]):d,g=h=>{f?f(h)&&m(v,h):m(v,h)};if(u){const h=y(),w=K(h);let A=!1;return _e(()=>e[t],R=>{A||(A=!0,w.value=p(R),je(()=>A=!1))}),_e(w,R=>{!A&&(R!==e[t]||c)&&g(R)},{deep:c}),w}else return ue({get(){return y()},set(h){g(h)}})}var os={value:()=>{}};function zn(){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 vn(n)}function vn(e){this._=e}function is(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}})}vn.prototype=zn.prototype={constructor:vn,on:function(e,t){var n=this._,o=is(e+"",n),i,r=-1,a=o.length;if(arguments.length<2){for(;++r<a;)if((i=(e=o[r]).type)&&(i=rs(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++r<a;)if(i=(e=o[r]).type)n[i]=Vo(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Vo(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 vn(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 rs(e,t){for(var n=0,o=e.length,i;n<o;++n)if((i=e[n]).name===t)return i.value}function Vo(e,t,n){for(var o=0,i=e.length;o<i;++o)if(e[o].name===t){e[o]=os,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var uo="http://www.w3.org/1999/xhtml";const Ho={svg:"http://www.w3.org/2000/svg",xhtml:uo,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function On(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Ho.hasOwnProperty(t)?{space:Ho[t],local:e}:e}function as(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===uo&&t.documentElement.namespaceURI===uo?t.createElement(e):t.createElementNS(n,e)}}function ss(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Gi(e){var t=On(e);return(t.local?ss:as)(t)}function ls(){}function ko(e){return e==null?ls:function(){return this.querySelector(e)}}function us(e){typeof e!="function"&&(e=ko(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r=t[i],a=r.length,s=o[i]=new Array(a),u,l,c=0;c<a;++c)(u=r[c])&&(l=e.call(u,u.__data__,c,r))&&("__data__"in u&&(l.__data__=u.__data__),s[c]=l);return new Le(o,this._parents)}function cs(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function ds(){return[]}function Ui(e){return e==null?ds:function(){return this.querySelectorAll(e)}}function fs(e){return function(){return cs(e.apply(this,arguments))}}function hs(e){typeof e=="function"?e=fs(e):e=Ui(e);for(var t=this._groups,n=t.length,o=[],i=[],r=0;r<n;++r)for(var a=t[r],s=a.length,u,l=0;l<s;++l)(u=a[l])&&(o.push(e.call(u,u.__data__,l,a)),i.push(u));return new Le(o,i)}function Xi(e){return function(){return this.matches(e)}}function Wi(e){return function(t){return t.matches(e)}}var ps=Array.prototype.find;function vs(e){return function(){return ps.call(this.children,e)}}function gs(){return this.firstElementChild}function ms(e){return this.select(e==null?gs:vs(typeof e=="function"?e:Wi(e)))}var ys=Array.prototype.filter;function _s(){return Array.from(this.children)}function ws(e){return function(){return ys.call(this.children,e)}}function xs(e){return this.selectAll(e==null?_s:ws(typeof e=="function"?e:Wi(e)))}function bs(e){typeof e!="function"&&(e=Xi(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r=t[i],a=r.length,s=o[i]=[],u,l=0;l<a;++l)(u=r[l])&&e.call(u,u.__data__,l,r)&&s.push(u);return new Le(o,this._parents)}function Ki(e){return new Array(e.length)}function Ss(){return new Le(this._enter||this._groups.map(Ki),this._parents)}function xn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}xn.prototype={constructor:xn,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 Es(e){return function(){return e}}function Cs(e,t,n,o,i,r){for(var a=0,s,u=t.length,l=r.length;a<l;++a)(s=t[a])?(s.__data__=r[a],o[a]=s):n[a]=new xn(e,r[a]);for(;a<u;++a)(s=t[a])&&(i[a]=s)}function Ns(e,t,n,o,i,r,a){var s,u,l=new Map,c=t.length,d=r.length,f=new Array(c),_;for(s=0;s<c;++s)(u=t[s])&&(f[s]=_=a.call(u,u.__data__,s,t)+"",l.has(_)?i[s]=u:l.set(_,u));for(s=0;s<d;++s)_=a.call(e,r[s],s,r)+"",(u=l.get(_))?(o[s]=u,u.__data__=r[s],l.delete(_)):n[s]=new xn(e,r[s]);for(s=0;s<c;++s)(u=t[s])&&l.get(f[s])===u&&(i[s]=u)}function ks(e){return e.__data__}function $s(e,t){if(!arguments.length)return Array.from(this,ks);var n=t?Ns:Cs,o=this._parents,i=this._groups;typeof e!="function"&&(e=Es(e));for(var r=i.length,a=new Array(r),s=new Array(r),u=new Array(r),l=0;l<r;++l){var c=o[l],d=i[l],f=d.length,_=Is(e.call(c,c&&c.__data__,l,o)),m=_.length,v=s[l]=new Array(m),p=a[l]=new Array(m),y=u[l]=new Array(f);n(c,d,v,p,y,_,t);for(var g=0,h=0,w,A;g<m;++g)if(w=v[g]){for(g>=h&&(h=g+1);!(A=p[h])&&++h<m;);w._next=A||null}}return a=new Le(a,o),a._enter=s,a._exit=u,a}function Is(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Ps(){return new Le(this._exit||this._groups.map(Ki),this._parents)}function Ms(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 Ts(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,i=n.length,r=o.length,a=Math.min(i,r),s=new Array(i),u=0;u<a;++u)for(var l=n[u],c=o[u],d=l.length,f=s[u]=new Array(d),_,m=0;m<d;++m)(_=l[m]||c[m])&&(f[m]=_);for(;u<i;++u)s[u]=n[u];return new Le(s,this._parents)}function Ds(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],i=o.length-1,r=o[i],a;--i>=0;)(a=o[i])&&(r&&a.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(a,r),r=a);return this}function As(e){e||(e=zs);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,o=n.length,i=new Array(o),r=0;r<o;++r){for(var a=n[r],s=a.length,u=i[r]=new Array(s),l,c=0;c<s;++c)(l=a[c])&&(u[c]=l);u.sort(t)}return new Le(i,this._parents).order()}function zs(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Os(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Rs(){return Array.from(this)}function Bs(){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 a=o[i];if(a)return a}return null}function Fs(){let e=0;for(const t of this)++e;return e}function Ls(){return!this.node()}function Vs(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var i=t[n],r=0,a=i.length,s;r<a;++r)(s=i[r])&&e.call(s,s.__data__,r,i);return this}function Hs(e){return function(){this.removeAttribute(e)}}function Ys(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Gs(e,t){return function(){this.setAttribute(e,t)}}function Us(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Xs(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Ws(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 Ks(e,t){var n=On(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?Ys:Hs:typeof t=="function"?n.local?Ws:Xs:n.local?Us:Gs)(n,t))}function Zi(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Zs(e){return function(){this.style.removeProperty(e)}}function qs(e,t,n){return function(){this.style.setProperty(e,t,n)}}function js(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Js(e,t,n){return arguments.length>1?this.each((t==null?Zs:typeof t=="function"?js:qs)(e,t,n??"")):Dt(this.node(),e)}function Dt(e,t){return e.style.getPropertyValue(t)||Zi(e).getComputedStyle(e,null).getPropertyValue(t)}function Qs(e){return function(){delete this[e]}}function el(e,t){return function(){this[e]=t}}function tl(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function nl(e,t){return arguments.length>1?this.each((t==null?Qs:typeof t=="function"?tl:el)(e,t)):this.node()[e]}function qi(e){return e.trim().split(/^|\s+/)}function $o(e){return e.classList||new ji(e)}function ji(e){this._node=e,this._names=qi(e.getAttribute("class")||"")}ji.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 Ji(e,t){for(var n=$o(e),o=-1,i=t.length;++o<i;)n.add(t[o])}function Qi(e,t){for(var n=$o(e),o=-1,i=t.length;++o<i;)n.remove(t[o])}function ol(e){return function(){Ji(this,e)}}function il(e){return function(){Qi(this,e)}}function rl(e,t){return function(){(t.apply(this,arguments)?Ji:Qi)(this,e)}}function al(e,t){var n=qi(e+"");if(arguments.length<2){for(var o=$o(this.node()),i=-1,r=n.length;++i<r;)if(!o.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?rl:t?ol:il)(n,t))}function sl(){this.textContent=""}function ll(e){return function(){this.textContent=e}}function ul(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function cl(e){return arguments.length?this.each(e==null?sl:(typeof e=="function"?ul:ll)(e)):this.node().textContent}function dl(){this.innerHTML=""}function fl(e){return function(){this.innerHTML=e}}function hl(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function pl(e){return arguments.length?this.each(e==null?dl:(typeof e=="function"?hl:fl)(e)):this.node().innerHTML}function vl(){this.nextSibling&&this.parentNode.appendChild(this)}function gl(){return this.each(vl)}function ml(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function yl(){return this.each(ml)}function _l(e){var t=typeof e=="function"?e:Gi(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function wl(){return null}function xl(e,t){var n=typeof e=="function"?e:Gi(e),o=t==null?wl:typeof t=="function"?t:ko(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function bl(){var e=this.parentNode;e&&e.removeChild(this)}function Sl(){return this.each(bl)}function El(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Cl(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Nl(e){return this.select(e?Cl:El)}function kl(e){return arguments.length?this.property("__data__",e):this.node().__data__}function $l(e){return function(t){e.call(this,t,this.__data__)}}function Il(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 Pl(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 Ml(e,t,n){return function(){var o=this.__on,i,r=$l(t);if(o){for(var a=0,s=o.length;a<s;++a)if((i=o[a]).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 Tl(e,t,n){var o=Il(e+""),i,r=o.length,a;if(arguments.length<2){var s=this.node().__on;if(s){for(var u=0,l=s.length,c;u<l;++u)for(i=0,c=s[u];i<r;++i)if((a=o[i]).type===c.type&&a.name===c.name)return c.value}return}for(s=t?Ml:Pl,i=0;i<r;++i)this.each(s(o[i],t,n));return this}function er(e,t,n){var o=Zi(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 Dl(e,t){return function(){return er(this,e,t)}}function Al(e,t){return function(){return er(this,e,t.apply(this,arguments))}}function zl(e,t){return this.each((typeof t=="function"?Al:Dl)(e,t))}function*Ol(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],i=0,r=o.length,a;i<r;++i)(a=o[i])&&(yield a)}var tr=[null];function Le(e,t){this._groups=e,this._parents=t}function on(){return new Le([[document.documentElement]],tr)}function Rl(){return this}Le.prototype=on.prototype={constructor:Le,select:us,selectAll:hs,selectChild:ms,selectChildren:xs,filter:bs,data:$s,enter:Ss,exit:Ps,join:Ms,merge:Ts,selection:Rl,order:Ds,sort:As,call:Os,nodes:Rs,node:Bs,size:Fs,empty:Ls,each:Vs,attr:Ks,style:Js,property:nl,classed:al,text:cl,html:pl,raise:gl,lower:yl,append:_l,insert:xl,remove:Sl,clone:Nl,datum:kl,on:Tl,dispatch:zl,[Symbol.iterator]:Ol};function Ge(e){return typeof e=="string"?new Le([[document.querySelector(e)]],[document.documentElement]):new Le([[e]],tr)}function Bl(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Ze(e,t){if(e=Bl(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 Fl={passive:!1},Zt={capture:!0,passive:!1};function qn(e){e.stopImmediatePropagation()}function Nt(e){e.preventDefault(),e.stopImmediatePropagation()}function nr(e){var t=e.document.documentElement,n=Ge(e).on("dragstart.drag",Nt,Zt);"onselectstart"in t?n.on("selectstart.drag",Nt,Zt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function or(e,t){var n=e.document.documentElement,o=Ge(e).on("dragstart.drag",null);t&&(o.on("click.drag",Nt,Zt),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 an=e=>()=>e;function co(e,{sourceEvent:t,subject:n,target:o,identifier:i,active:r,x:a,y:s,dx:u,dy:l,dispatch:c}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:r,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:c}})}co.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Ll(e){return!e.ctrlKey&&!e.button}function Vl(){return this.parentNode}function Hl(e,t){return t??{x:e.x,y:e.y}}function Yl(){return navigator.maxTouchPoints||"ontouchstart"in this}function Gl(){var e=Ll,t=Vl,n=Hl,o=Yl,i={},r=zn("start","drag","end"),a=0,s,u,l,c,d=0;function f(w){w.on("mousedown.drag",_).filter(o).on("touchstart.drag",p).on("touchmove.drag",y,Fl).on("touchend.drag touchcancel.drag",g).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function _(w,A){if(!(c||!e.call(this,w,A))){var R=h(this,t.call(this,w,A),w,A,"mouse");R&&(Ge(w.view).on("mousemove.drag",m,Zt).on("mouseup.drag",v,Zt),nr(w.view),qn(w),l=!1,s=w.clientX,u=w.clientY,R("start",w))}}function m(w){if(Nt(w),!l){var A=w.clientX-s,R=w.clientY-u;l=A*A+R*R>d}i.mouse("drag",w)}function v(w){Ge(w.view).on("mousemove.drag mouseup.drag",null),or(w.view,l),Nt(w),i.mouse("end",w)}function p(w,A){if(e.call(this,w,A)){var R=w.changedTouches,V=t.call(this,w,A),W=R.length,j,Y;for(j=0;j<W;++j)(Y=h(this,V,w,A,R[j].identifier,R[j]))&&(qn(w),Y("start",w,R[j]))}}function y(w){var A=w.changedTouches,R=A.length,V,W;for(V=0;V<R;++V)(W=i[A[V].identifier])&&(Nt(w),W("drag",w,A[V]))}function g(w){var A=w.changedTouches,R=A.length,V,W;for(c&&clearTimeout(c),c=setTimeout(function(){c=null},500),V=0;V<R;++V)(W=i[A[V].identifier])&&(qn(w),W("end",w,A[V]))}function h(w,A,R,V,W,j){var Y=r.copy(),U=Ze(j||R,A),D,ie,N;if((N=n.call(w,new co("beforestart",{sourceEvent:R,target:f,identifier:W,active:a,x:U[0],y:U[1],dx:0,dy:0,dispatch:Y}),V))!=null)return D=N.x-U[0]||0,ie=N.y-U[1]||0,function O(E,$,F){var H=U,X;switch(E){case"start":i[W]=O,X=a++;break;case"end":delete i[W],--a;case"drag":U=Ze(F||$,A),X=a;break}Y.call(E,w,new co(E,{sourceEvent:$,subject:N,target:f,identifier:W,active:X,x:U[0]+D,y:U[1]+ie,dx:U[0]-H[0],dy:U[1]-H[1],dispatch:Y}),V)}}return f.filter=function(w){return arguments.length?(e=typeof w=="function"?w:an(!!w),f):e},f.container=function(w){return arguments.length?(t=typeof w=="function"?w:an(w),f):t},f.subject=function(w){return arguments.length?(n=typeof w=="function"?w:an(w),f):n},f.touchable=function(w){return arguments.length?(o=typeof w=="function"?w:an(!!w),f):o},f.on=function(){var w=r.on.apply(r,arguments);return w===r?f:w},f.clickDistance=function(w){return arguments.length?(d=(w=+w)*w,f):Math.sqrt(d)},f}function Io(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function ir(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function rn(){}var qt=.7,bn=1/qt,kt="\\s*([+-]?\\d+)\\s*",jt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Je="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Ul=/^#([0-9a-f]{3,8})$/,Xl=new RegExp(`^rgb\\(${kt},${kt},${kt}\\)$`),Wl=new RegExp(`^rgb\\(${Je},${Je},${Je}\\)$`),Kl=new RegExp(`^rgba\\(${kt},${kt},${kt},${jt}\\)$`),Zl=new RegExp(`^rgba\\(${Je},${Je},${Je},${jt}\\)$`),ql=new RegExp(`^hsl\\(${jt},${Je},${Je}\\)$`),jl=new RegExp(`^hsla\\(${jt},${Je},${Je},${jt}\\)$`),Yo={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};Io(rn,Jt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Go,formatHex:Go,formatHex8:Jl,formatHsl:Ql,formatRgb:Uo,toString:Uo});function Go(){return this.rgb().formatHex()}function Jl(){return this.rgb().formatHex8()}function Ql(){return rr(this).formatHsl()}function Uo(){return this.rgb().formatRgb()}function Jt(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Ul.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Xo(t):n===3?new Oe(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?sn(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?sn(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=Xl.exec(e))?new Oe(t[1],t[2],t[3],1):(t=Wl.exec(e))?new Oe(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Kl.exec(e))?sn(t[1],t[2],t[3],t[4]):(t=Zl.exec(e))?sn(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=ql.exec(e))?Zo(t[1],t[2]/100,t[3]/100,1):(t=jl.exec(e))?Zo(t[1],t[2]/100,t[3]/100,t[4]):Yo.hasOwnProperty(e)?Xo(Yo[e]):e==="transparent"?new Oe(NaN,NaN,NaN,0):null}function Xo(e){return new Oe(e>>16&255,e>>8&255,e&255,1)}function sn(e,t,n,o){return o<=0&&(e=t=n=NaN),new Oe(e,t,n,o)}function eu(e){return e instanceof rn||(e=Jt(e)),e?(e=e.rgb(),new Oe(e.r,e.g,e.b,e.opacity)):new Oe}function fo(e,t,n,o){return arguments.length===1?eu(e):new Oe(e,t,n,o??1)}function Oe(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}Io(Oe,fo,ir(rn,{brighter(e){return e=e==null?bn:Math.pow(bn,e),new Oe(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?qt:Math.pow(qt,e),new Oe(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Oe(yt(this.r),yt(this.g),yt(this.b),Sn(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Wo,formatHex:Wo,formatHex8:tu,formatRgb:Ko,toString:Ko}));function Wo(){return`#${mt(this.r)}${mt(this.g)}${mt(this.b)}`}function tu(){return`#${mt(this.r)}${mt(this.g)}${mt(this.b)}${mt((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ko(){const e=Sn(this.opacity);return`${e===1?"rgb(":"rgba("}${yt(this.r)}, ${yt(this.g)}, ${yt(this.b)}${e===1?")":`, ${e})`}`}function Sn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function yt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function mt(e){return e=yt(e),(e<16?"0":"")+e.toString(16)}function Zo(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ue(e,t,n,o)}function rr(e){if(e instanceof Ue)return new Ue(e.h,e.s,e.l,e.opacity);if(e instanceof rn||(e=Jt(e)),!e)return new Ue;if(e instanceof Ue)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),a=NaN,s=r-i,u=(r+i)/2;return s?(t===r?a=(n-o)/s+(n<o)*6:n===r?a=(o-t)/s+2:a=(t-n)/s+4,s/=u<.5?r+i:2-r-i,a*=60):s=u>0&&u<1?0:a,new Ue(a,s,u,e.opacity)}function nu(e,t,n,o){return arguments.length===1?rr(e):new Ue(e,t,n,o??1)}function Ue(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}Io(Ue,nu,ir(rn,{brighter(e){return e=e==null?bn:Math.pow(bn,e),new Ue(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?qt:Math.pow(qt,e),new Ue(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 Oe(jn(e>=240?e-240:e+120,i,o),jn(e,i,o),jn(e<120?e+240:e-120,i,o),this.opacity)},clamp(){return new Ue(qo(this.h),ln(this.s),ln(this.l),Sn(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Sn(this.opacity);return`${e===1?"hsl(":"hsla("}${qo(this.h)}, ${ln(this.s)*100}%, ${ln(this.l)*100}%${e===1?")":`, ${e})`}`}}));function qo(e){return e=(e||0)%360,e<0?e+360:e}function ln(e){return Math.max(0,Math.min(1,e||0))}function jn(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 ar=e=>()=>e;function ou(e,t){return function(n){return e+n*t}}function iu(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 ru(e){return(e=+e)==1?sr:function(t,n){return n-t?iu(t,n,e):ar(isNaN(t)?n:t)}}function sr(e,t){var n=t-e;return n?ou(e,n):ar(isNaN(e)?t:e)}const jo=function e(t){var n=ru(t);function o(i,r){var a=n((i=fo(i)).r,(r=fo(r)).r),s=n(i.g,r.g),u=n(i.b,r.b),l=sr(i.opacity,r.opacity);return function(c){return i.r=a(c),i.g=s(c),i.b=u(c),i.opacity=l(c),i+""}}return o.gamma=e,o}(1);function dt(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var ho=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Jn=new RegExp(ho.source,"g");function au(e){return function(){return e}}function su(e){return function(t){return e(t)+""}}function lu(e,t){var n=ho.lastIndex=Jn.lastIndex=0,o,i,r,a=-1,s=[],u=[];for(e=e+"",t=t+"";(o=ho.exec(e))&&(i=Jn.exec(t));)(r=i.index)>n&&(r=t.slice(n,r),s[a]?s[a]+=r:s[++a]=r),(o=o[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,u.push({i:a,x:dt(o,i)})),n=Jn.lastIndex;return n<t.length&&(r=t.slice(n),s[a]?s[a]+=r:s[++a]=r),s.length<2?u[0]?su(u[0].x):au(t):(t=u.length,function(l){for(var c=0,d;c<t;++c)s[(d=u[c]).i]=d.x(l);return s.join("")})}var Jo=180/Math.PI,po={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function lr(e,t,n,o,i,r){var a,s,u;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(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,a=-a),{translateX:i,translateY:r,rotate:Math.atan2(t,e)*Jo,skewX:Math.atan(u)*Jo,scaleX:a,scaleY:s}}var un;function uu(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?po:lr(t.a,t.b,t.c,t.d,t.e,t.f)}function cu(e){return e==null||(un||(un=document.createElementNS("http://www.w3.org/2000/svg","g")),un.setAttribute("transform",e),!(e=un.transform.baseVal.consolidate()))?po:(e=e.matrix,lr(e.a,e.b,e.c,e.d,e.e,e.f))}function ur(e,t,n,o){function i(l){return l.length?l.pop()+" ":""}function r(l,c,d,f,_,m){if(l!==d||c!==f){var v=_.push("translate(",null,t,null,n);m.push({i:v-4,x:dt(l,d)},{i:v-2,x:dt(c,f)})}else(d||f)&&_.push("translate("+d+t+f+n)}function a(l,c,d,f){l!==c?(l-c>180?c+=360:c-l>180&&(l+=360),f.push({i:d.push(i(d)+"rotate(",null,o)-2,x:dt(l,c)})):c&&d.push(i(d)+"rotate("+c+o)}function s(l,c,d,f){l!==c?f.push({i:d.push(i(d)+"skewX(",null,o)-2,x:dt(l,c)}):c&&d.push(i(d)+"skewX("+c+o)}function u(l,c,d,f,_,m){if(l!==d||c!==f){var v=_.push(i(_)+"scale(",null,",",null,")");m.push({i:v-4,x:dt(l,d)},{i:v-2,x:dt(c,f)})}else(d!==1||f!==1)&&_.push(i(_)+"scale("+d+","+f+")")}return function(l,c){var d=[],f=[];return l=e(l),c=e(c),r(l.translateX,l.translateY,c.translateX,c.translateY,d,f),a(l.rotate,c.rotate,d,f),s(l.skewX,c.skewX,d,f),u(l.scaleX,l.scaleY,c.scaleX,c.scaleY,d,f),l=c=null,function(_){for(var m=-1,v=f.length,p;++m<v;)d[(p=f[m]).i]=p.x(_);return d.join("")}}}var du=ur(uu,"px, ","px)","deg)"),fu=ur(cu,", ",")",")"),hu=1e-12;function Qo(e){return((e=Math.exp(e))+1/e)/2}function pu(e){return((e=Math.exp(e))-1/e)/2}function vu(e){return((e=Math.exp(2*e))-1)/(e+1)}const gu=function e(t,n,o){function i(r,a){var s=r[0],u=r[1],l=r[2],c=a[0],d=a[1],f=a[2],_=c-s,m=d-u,v=_*_+m*m,p,y;if(v<hu)y=Math.log(f/l)/t,p=function(V){return[s+V*_,u+V*m,l*Math.exp(t*V*y)]};else{var g=Math.sqrt(v),h=(f*f-l*l+o*v)/(2*l*n*g),w=(f*f-l*l-o*v)/(2*f*n*g),A=Math.log(Math.sqrt(h*h+1)-h),R=Math.log(Math.sqrt(w*w+1)-w);y=(R-A)/t,p=function(V){var W=V*y,j=Qo(A),Y=l/(n*g)*(j*vu(t*W+A)-pu(A));return[s+Y*_,u+Y*m,l*j/Qo(t*W+A)]}}return p.duration=y*1e3*t/Math.SQRT2,p}return i.rho=function(r){var a=Math.max(.001,+r),s=a*a,u=s*s;return e(a,s,u)},i}(Math.SQRT2,2,4);var At=0,Yt=0,Ft=0,cr=1e3,En,Gt,Cn=0,xt=0,Rn=0,Qt=typeof performance=="object"&&performance.now?performance:Date,dr=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Po(){return xt||(dr(mu),xt=Qt.now()+Rn)}function mu(){xt=0}function Nn(){this._call=this._time=this._next=null}Nn.prototype=fr.prototype={constructor:Nn,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Po():+n)+(t==null?0:+t),!this._next&&Gt!==this&&(Gt?Gt._next=this:En=this,Gt=this),this._call=e,this._time=n,vo()},stop:function(){this._call&&(this._call=null,this._time=1/0,vo())}};function fr(e,t,n){var o=new Nn;return o.restart(e,t,n),o}function yu(){Po(),++At;for(var e=En,t;e;)(t=xt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--At}function ei(){xt=(Cn=Qt.now())+Rn,At=Yt=0;try{yu()}finally{At=0,wu(),xt=0}}function _u(){var e=Qt.now(),t=e-Cn;t>cr&&(Rn-=t,Cn=e)}function wu(){for(var e,t=En,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:En=n);Gt=e,vo(o)}function vo(e){if(!At){Yt&&(Yt=clearTimeout(Yt));var t=e-xt;t>24?(e<1/0&&(Yt=setTimeout(ei,e-Qt.now()-Rn)),Ft&&(Ft=clearInterval(Ft))):(Ft||(Cn=Qt.now(),Ft=setInterval(_u,cr)),At=1,dr(ei))}}function ti(e,t,n){var o=new Nn;return t=t==null?0:+t,o.restart(i=>{o.stop(),e(i+t)},t,n),o}var xu=zn("start","end","cancel","interrupt"),bu=[],hr=0,ni=1,go=2,gn=3,oi=4,mo=5,mn=6;function Bn(e,t,n,o,i,r){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;Su(e,n,{name:t,index:o,group:i,on:xu,tween:bu,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:hr})}function Mo(e,t){var n=We(e,t);if(n.state>hr)throw new Error("too late; already scheduled");return n}function et(e,t){var n=We(e,t);if(n.state>gn)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 Su(e,t,n){var o=e.__transition,i;o[t]=n,n.timer=fr(r,0,n.time);function r(l){n.state=ni,n.timer.restart(a,n.delay,n.time),n.delay<=l&&a(l-n.delay)}function a(l){var c,d,f,_;if(n.state!==ni)return u();for(c in o)if(_=o[c],_.name===n.name){if(_.state===gn)return ti(a);_.state===oi?(_.state=mn,_.timer.stop(),_.on.call("interrupt",e,e.__data__,_.index,_.group),delete o[c]):+c<t&&(_.state=mn,_.timer.stop(),_.on.call("cancel",e,e.__data__,_.index,_.group),delete o[c])}if(ti(function(){n.state===gn&&(n.state=oi,n.timer.restart(s,n.delay,n.time),s(l))}),n.state=go,n.on.call("start",e,e.__data__,n.index,n.group),n.state===go){for(n.state=gn,i=new Array(f=n.tween.length),c=0,d=-1;c<f;++c)(_=n.tween[c].value.call(e,e.__data__,n.index,n.group))&&(i[++d]=_);i.length=d+1}}function s(l){for(var c=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(u),n.state=mo,1),d=-1,f=i.length;++d<f;)i[d].call(e,c);n.state===mo&&(n.on.call("end",e,e.__data__,n.index,n.group),u())}function u(){n.state=mn,n.timer.stop(),delete o[t];for(var l in o)return;delete e.__transition}}function yn(e,t){var n=e.__transition,o,i,r=!0,a;if(n){t=t==null?null:t+"";for(a in n){if((o=n[a]).name!==t){r=!1;continue}i=o.state>go&&o.state<mo,o.state=mn,o.timer.stop(),o.on.call(i?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[a]}r&&delete e.__transition}}function Eu(e){return this.each(function(){yn(this,e)})}function Cu(e,t){var n,o;return function(){var i=et(this,e),r=i.tween;if(r!==n){o=n=r;for(var a=0,s=o.length;a<s;++a)if(o[a].name===t){o=o.slice(),o.splice(a,1);break}}i.tween=o}}function Nu(e,t,n){var o,i;if(typeof n!="function")throw new Error;return function(){var r=et(this,e),a=r.tween;if(a!==o){i=(o=a).slice();for(var s={name:t,value:n},u=0,l=i.length;u<l;++u)if(i[u].name===t){i[u]=s;break}u===l&&i.push(s)}r.tween=i}}function ku(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=We(this.node(),n).tween,i=0,r=o.length,a;i<r;++i)if((a=o[i]).name===e)return a.value;return null}return this.each((t==null?Cu:Nu)(n,e,t))}function To(e,t,n){var o=e._id;return e.each(function(){var i=et(this,o);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return We(i,o).value[t]}}function pr(e,t){var n;return(typeof t=="number"?dt:t instanceof Jt?jo:(n=Jt(t))?(t=n,jo):lu)(e,t)}function $u(e){return function(){this.removeAttribute(e)}}function Iu(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Pu(e,t,n){var o,i=n+"",r;return function(){var a=this.getAttribute(e);return a===i?null:a===o?r:r=t(o=a,n)}}function Mu(e,t,n){var o,i=n+"",r;return function(){var a=this.getAttributeNS(e.space,e.local);return a===i?null:a===o?r:r=t(o=a,n)}}function Tu(e,t,n){var o,i,r;return function(){var a,s=n(this),u;return s==null?void this.removeAttribute(e):(a=this.getAttribute(e),u=s+"",a===u?null:a===o&&u===i?r:(i=u,r=t(o=a,s)))}}function Du(e,t,n){var o,i,r;return function(){var a,s=n(this),u;return s==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),u=s+"",a===u?null:a===o&&u===i?r:(i=u,r=t(o=a,s)))}}function Au(e,t){var n=On(e),o=n==="transform"?fu:pr;return this.attrTween(e,typeof t=="function"?(n.local?Du:Tu)(n,o,To(this,"attr."+e,t)):t==null?(n.local?Iu:$u)(n):(n.local?Mu:Pu)(n,o,t))}function zu(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Ou(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Ru(e,t){var n,o;function i(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&Ou(e,r)),n}return i._value=t,i}function Bu(e,t){var n,o;function i(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&zu(e,r)),n}return i._value=t,i}function Fu(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=On(e);return this.tween(n,(o.local?Ru:Bu)(o,t))}function Lu(e,t){return function(){Mo(this,e).delay=+t.apply(this,arguments)}}function Vu(e,t){return t=+t,function(){Mo(this,e).delay=t}}function Hu(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Lu:Vu)(t,e)):We(this.node(),t).delay}function Yu(e,t){return function(){et(this,e).duration=+t.apply(this,arguments)}}function Gu(e,t){return t=+t,function(){et(this,e).duration=t}}function Uu(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Yu:Gu)(t,e)):We(this.node(),t).duration}function Xu(e,t){if(typeof t!="function")throw new Error;return function(){et(this,e).ease=t}}function Wu(e){var t=this._id;return arguments.length?this.each(Xu(t,e)):We(this.node(),t).ease}function Ku(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;et(this,e).ease=n}}function Zu(e){if(typeof e!="function")throw new Error;return this.each(Ku(this._id,e))}function qu(e){typeof e!="function"&&(e=Xi(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r=t[i],a=r.length,s=o[i]=[],u,l=0;l<a;++l)(u=r[l])&&e.call(u,u.__data__,l,r)&&s.push(u);return new lt(o,this._parents,this._name,this._id)}function ju(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),a=new Array(o),s=0;s<r;++s)for(var u=t[s],l=n[s],c=u.length,d=a[s]=new Array(c),f,_=0;_<c;++_)(f=u[_]||l[_])&&(d[_]=f);for(;s<o;++s)a[s]=t[s];return new lt(a,this._parents,this._name,this._id)}function Ju(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 Qu(e,t,n){var o,i,r=Ju(t)?Mo:et;return function(){var a=r(this,e),s=a.on;s!==o&&(i=(o=s).copy()).on(t,n),a.on=i}}function ec(e,t){var n=this._id;return arguments.length<2?We(this.node(),n).on.on(e):this.each(Qu(n,e,t))}function tc(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function nc(){return this.on("end.remove",tc(this._id))}function oc(e){var t=this._name,n=this._id;typeof e!="function"&&(e=ko(e));for(var o=this._groups,i=o.length,r=new Array(i),a=0;a<i;++a)for(var s=o[a],u=s.length,l=r[a]=new Array(u),c,d,f=0;f<u;++f)(c=s[f])&&(d=e.call(c,c.__data__,f,s))&&("__data__"in c&&(d.__data__=c.__data__),l[f]=d,Bn(l[f],t,n,f,l,We(c,n)));return new lt(r,this._parents,t,n)}function ic(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Ui(e));for(var o=this._groups,i=o.length,r=[],a=[],s=0;s<i;++s)for(var u=o[s],l=u.length,c,d=0;d<l;++d)if(c=u[d]){for(var f=e.call(c,c.__data__,d,u),_,m=We(c,n),v=0,p=f.length;v<p;++v)(_=f[v])&&Bn(_,t,n,v,f,m);r.push(f),a.push(c)}return new lt(r,a,t,n)}var rc=on.prototype.constructor;function ac(){return new rc(this._groups,this._parents)}function sc(e,t){var n,o,i;return function(){var r=Dt(this,e),a=(this.style.removeProperty(e),Dt(this,e));return r===a?null:r===n&&a===o?i:i=t(n=r,o=a)}}function vr(e){return function(){this.style.removeProperty(e)}}function lc(e,t,n){var o,i=n+"",r;return function(){var a=Dt(this,e);return a===i?null:a===o?r:r=t(o=a,n)}}function uc(e,t,n){var o,i,r;return function(){var a=Dt(this,e),s=n(this),u=s+"";return s==null&&(u=s=(this.style.removeProperty(e),Dt(this,e))),a===u?null:a===o&&u===i?r:(i=u,r=t(o=a,s))}}function cc(e,t){var n,o,i,r="style."+t,a="end."+r,s;return function(){var u=et(this,e),l=u.on,c=u.value[r]==null?s||(s=vr(t)):void 0;(l!==n||i!==c)&&(o=(n=l).copy()).on(a,i=c),u.on=o}}function dc(e,t,n){var o=(e+="")=="transform"?du:pr;return t==null?this.styleTween(e,sc(e,o)).on("end.style."+e,vr(e)):typeof t=="function"?this.styleTween(e,uc(e,o,To(this,"style."+e,t))).each(cc(this._id,e)):this.styleTween(e,lc(e,o,t),n).on("end.style."+e,null)}function fc(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function hc(e,t,n){var o,i;function r(){var a=t.apply(this,arguments);return a!==i&&(o=(i=a)&&fc(e,a,n)),o}return r._value=t,r}function pc(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,hc(e,t,n??""))}function vc(e){return function(){this.textContent=e}}function gc(e){return function(){var t=e(this);this.textContent=t??""}}function mc(e){return this.tween("text",typeof e=="function"?gc(To(this,"text",e)):vc(e==null?"":e+""))}function yc(e){return function(t){this.textContent=e.call(this,t)}}function _c(e){var t,n;function o(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&yc(i)),t}return o._value=e,o}function wc(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,_c(e))}function xc(){for(var e=this._name,t=this._id,n=gr(),o=this._groups,i=o.length,r=0;r<i;++r)for(var a=o[r],s=a.length,u,l=0;l<s;++l)if(u=a[l]){var c=We(u,t);Bn(u,e,n,l,a,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new lt(o,this._parents,e,n)}function bc(){var e,t,n=this,o=n._id,i=n.size();return new Promise(function(r,a){var s={value:a},u={value:function(){--i===0&&r()}};n.each(function(){var l=et(this,o),c=l.on;c!==e&&(t=(e=c).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(u)),l.on=t}),i===0&&r()})}var Sc=0;function lt(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function gr(){return++Sc}var tt=on.prototype;lt.prototype={constructor:lt,select:oc,selectAll:ic,selectChild:tt.selectChild,selectChildren:tt.selectChildren,filter:qu,merge:ju,selection:ac,transition:xc,call:tt.call,nodes:tt.nodes,node:tt.node,size:tt.size,empty:tt.empty,each:tt.each,on:ec,attr:Au,attrTween:Fu,style:dc,styleTween:pc,text:mc,textTween:wc,remove:nc,tween:ku,delay:Hu,duration:Uu,ease:Wu,easeVarying:Zu,end:bc,[Symbol.iterator]:tt[Symbol.iterator]};function Ec(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Cc={time:null,delay:0,duration:250,ease:Ec};function Nc(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 kc(e){var t,n;e instanceof lt?(t=e._id,e=e._name):(t=gr(),(n=Cc).time=Po(),e=e==null?null:e+"");for(var o=this._groups,i=o.length,r=0;r<i;++r)for(var a=o[r],s=a.length,u,l=0;l<s;++l)(u=a[l])&&Bn(u,e,t,l,a,n||Nc(u,t));return new lt(o,this._parents,e,t)}on.prototype.interrupt=Eu;on.prototype.transition=kc;const cn=e=>()=>e;function $c(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 it(e,t,n){this.k=e,this.x=t,this.y=n}it.prototype={constructor:it,scale:function(e){return e===1?this:new it(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new it(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 zt=new it(1,0,0);it.prototype;function Qn(e){e.stopImmediatePropagation()}function Lt(e){e.preventDefault(),e.stopImmediatePropagation()}function Ic(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Pc(){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 ii(){return this.__zoom||zt}function Mc(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Tc(){return navigator.maxTouchPoints||"ontouchstart"in this}function Dc(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],a=e.invertY(t[1][1])-n[1][1];return e.translate(i>o?(o+i)/2:Math.min(0,o)||Math.max(0,i),a>r?(r+a)/2:Math.min(0,r)||Math.max(0,a))}function Ac(){var e=Ic,t=Pc,n=Dc,o=Mc,i=Tc,r=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],s=250,u=gu,l=zn("start","zoom","end"),c,d,f,_=500,m=150,v=0,p=10;function y(N){N.property("__zoom",ii).on("wheel.zoom",W,{passive:!1}).on("mousedown.zoom",j).on("dblclick.zoom",Y).filter(i).on("touchstart.zoom",U).on("touchmove.zoom",D).on("touchend.zoom touchcancel.zoom",ie).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(N,O,E,$){var F=N.selection?N.selection():N;F.property("__zoom",ii),N!==F?A(N,O,E,$):F.interrupt().each(function(){R(this,arguments).event($).start().zoom(null,typeof O=="function"?O.apply(this,arguments):O).end()})},y.scaleBy=function(N,O,E,$){y.scaleTo(N,function(){var F=this.__zoom.k,H=typeof O=="function"?O.apply(this,arguments):O;return F*H},E,$)},y.scaleTo=function(N,O,E,$){y.transform(N,function(){var F=t.apply(this,arguments),H=this.__zoom,X=E==null?w(F):typeof E=="function"?E.apply(this,arguments):E,T=H.invert(X),z=typeof O=="function"?O.apply(this,arguments):O;return n(h(g(H,z),X,T),F,a)},E,$)},y.translateBy=function(N,O,E,$){y.transform(N,function(){return n(this.__zoom.translate(typeof O=="function"?O.apply(this,arguments):O,typeof E=="function"?E.apply(this,arguments):E),t.apply(this,arguments),a)},null,$)},y.translateTo=function(N,O,E,$,F){y.transform(N,function(){var H=t.apply(this,arguments),X=this.__zoom,T=$==null?w(H):typeof $=="function"?$.apply(this,arguments):$;return n(zt.translate(T[0],T[1]).scale(X.k).translate(typeof O=="function"?-O.apply(this,arguments):-O,typeof E=="function"?-E.apply(this,arguments):-E),H,a)},$,F)};function g(N,O){return O=Math.max(r[0],Math.min(r[1],O)),O===N.k?N:new it(O,N.x,N.y)}function h(N,O,E){var $=O[0]-E[0]*N.k,F=O[1]-E[1]*N.k;return $===N.x&&F===N.y?N:new it(N.k,$,F)}function w(N){return[(+N[0][0]+ +N[1][0])/2,(+N[0][1]+ +N[1][1])/2]}function A(N,O,E,$){N.on("start.zoom",function(){R(this,arguments).event($).start()}).on("interrupt.zoom end.zoom",function(){R(this,arguments).event($).end()}).tween("zoom",function(){var F=this,H=arguments,X=R(F,H).event($),T=t.apply(F,H),z=E==null?w(T):typeof E=="function"?E.apply(F,H):E,M=Math.max(T[1][0]-T[0][0],T[1][1]-T[0][1]),P=F.__zoom,ne=typeof O=="function"?O.apply(F,H):O,ve=u(P.invert(z).concat(M/P.k),ne.invert(z).concat(M/ne.k));return function(fe){if(fe===1)fe=ne;else{var me=ve(fe),le=M/me[2];fe=new it(le,z[0]-me[0]*le,z[1]-me[1]*le)}X.zoom(null,fe)}})}function R(N,O,E){return!E&&N.__zooming||new V(N,O)}function V(N,O){this.that=N,this.args=O,this.active=0,this.sourceEvent=null,this.extent=t.apply(N,O),this.taps=0}V.prototype={event:function(N){return N&&(this.sourceEvent=N),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(N,O){return this.mouse&&N!=="mouse"&&(this.mouse[1]=O.invert(this.mouse[0])),this.touch0&&N!=="touch"&&(this.touch0[1]=O.invert(this.touch0[0])),this.touch1&&N!=="touch"&&(this.touch1[1]=O.invert(this.touch1[0])),this.that.__zoom=O,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(N){var O=Ge(this.that).datum();l.call(N,this.that,new $c(N,{sourceEvent:this.sourceEvent,target:y,type:N,transform:this.that.__zoom,dispatch:l}),O)}};function W(N,...O){if(!e.apply(this,arguments))return;var E=R(this,O).event(N),$=this.__zoom,F=Math.max(r[0],Math.min(r[1],$.k*Math.pow(2,o.apply(this,arguments)))),H=Ze(N);if(E.wheel)(E.mouse[0][0]!==H[0]||E.mouse[0][1]!==H[1])&&(E.mouse[1]=$.invert(E.mouse[0]=H)),clearTimeout(E.wheel);else{if($.k===F)return;E.mouse=[H,$.invert(H)],yn(this),E.start()}Lt(N),E.wheel=setTimeout(X,m),E.zoom("mouse",n(h(g($,F),E.mouse[0],E.mouse[1]),E.extent,a));function X(){E.wheel=null,E.end()}}function j(N,...O){if(f||!e.apply(this,arguments))return;var E=N.currentTarget,$=R(this,O,!0).event(N),F=Ge(N.view).on("mousemove.zoom",z,!0).on("mouseup.zoom",M,!0),H=Ze(N,E),X=N.clientX,T=N.clientY;nr(N.view),Qn(N),$.mouse=[H,this.__zoom.invert(H)],yn(this),$.start();function z(P){if(Lt(P),!$.moved){var ne=P.clientX-X,ve=P.clientY-T;$.moved=ne*ne+ve*ve>v}$.event(P).zoom("mouse",n(h($.that.__zoom,$.mouse[0]=Ze(P,E),$.mouse[1]),$.extent,a))}function M(P){F.on("mousemove.zoom mouseup.zoom",null),or(P.view,$.moved),Lt(P),$.event(P).end()}}function Y(N,...O){if(e.apply(this,arguments)){var E=this.__zoom,$=Ze(N.changedTouches?N.changedTouches[0]:N,this),F=E.invert($),H=E.k*(N.shiftKey?.5:2),X=n(h(g(E,H),$,F),t.apply(this,O),a);Lt(N),s>0?Ge(this).transition().duration(s).call(A,X,$,N):Ge(this).call(y.transform,X,$,N)}}function U(N,...O){if(e.apply(this,arguments)){var E=N.touches,$=E.length,F=R(this,O,N.changedTouches.length===$).event(N),H,X,T,z;for(Qn(N),X=0;X<$;++X)T=E[X],z=Ze(T,this),z=[z,this.__zoom.invert(z),T.identifier],F.touch0?!F.touch1&&F.touch0[2]!==z[2]&&(F.touch1=z,F.taps=0):(F.touch0=z,H=!0,F.taps=1+!!c);c&&(c=clearTimeout(c)),H&&(F.taps<2&&(d=z[0],c=setTimeout(function(){c=null},_)),yn(this),F.start())}}function D(N,...O){if(this.__zooming){var E=R(this,O).event(N),$=N.changedTouches,F=$.length,H,X,T,z;for(Lt(N),H=0;H<F;++H)X=$[H],T=Ze(X,this),E.touch0&&E.touch0[2]===X.identifier?E.touch0[0]=T:E.touch1&&E.touch1[2]===X.identifier&&(E.touch1[0]=T);if(X=E.that.__zoom,E.touch1){var M=E.touch0[0],P=E.touch0[1],ne=E.touch1[0],ve=E.touch1[1],fe=(fe=ne[0]-M[0])*fe+(fe=ne[1]-M[1])*fe,me=(me=ve[0]-P[0])*me+(me=ve[1]-P[1])*me;X=g(X,Math.sqrt(fe/me)),T=[(M[0]+ne[0])/2,(M[1]+ne[1])/2],z=[(P[0]+ve[0])/2,(P[1]+ve[1])/2]}else if(E.touch0)T=E.touch0[0],z=E.touch0[1];else return;E.zoom("touch",n(h(X,T,z),E.extent,a))}}function ie(N,...O){if(this.__zooming){var E=R(this,O).event(N),$=N.changedTouches,F=$.length,H,X;for(Qn(N),f&&clearTimeout(f),f=setTimeout(function(){f=null},_),H=0;H<F;++H)X=$[H],E.touch0&&E.touch0[2]===X.identifier?delete E.touch0:E.touch1&&E.touch1[2]===X.identifier&&delete E.touch1;if(E.touch1&&!E.touch0&&(E.touch0=E.touch1,delete E.touch1),E.touch0)E.touch0[1]=this.__zoom.invert(E.touch0[0]);else if(E.end(),E.taps===2&&(X=Ze(X,this),Math.hypot(d[0]-X[0],d[1]-X[1])<p)){var T=Ge(this).on("dblclick.zoom");T&&T.apply(this,arguments)}}}return y.wheelDelta=function(N){return arguments.length?(o=typeof N=="function"?N:cn(+N),y):o},y.filter=function(N){return arguments.length?(e=typeof N=="function"?N:cn(!!N),y):e},y.touchable=function(N){return arguments.length?(i=typeof N=="function"?N:cn(!!N),y):i},y.extent=function(N){return arguments.length?(t=typeof N=="function"?N:cn([[+N[0][0],+N[0][1]],[+N[1][0],+N[1][1]]]),y):t},y.scaleExtent=function(N){return arguments.length?(r[0]=+N[0],r[1]=+N[1],y):[r[0],r[1]]},y.translateExtent=function(N){return arguments.length?(a[0][0]=+N[0][0],a[1][0]=+N[1][0],a[0][1]=+N[0][1],a[1][1]=+N[1][1],y):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},y.constrain=function(N){return arguments.length?(n=N,y):n},y.duration=function(N){return arguments.length?(s=+N,y):s},y.interpolate=function(N){return arguments.length?(u=N,y):u},y.on=function(){var N=l.on.apply(l,arguments);return N===l?y:N},y.clickDistance=function(N){return arguments.length?(v=(N=+N)*N,y):Math.sqrt(v)},y.tapDistance=function(N){return arguments.length?(p=+N,y):p},y}var q=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(q||{}),Do=(e=>(e.Partial="partial",e.Full="full",e))(Do||{}),vt=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(vt||{}),bt=(e=>(e.Strict="strict",e.Loose="loose",e))(bt||{}),yo=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(yo||{}),Wt=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(Wt||{});function _o(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["INPUT","SELECT","TEXTAREA"].includes(o==null?void 0:o.nodeName)||i||!!r}function zc(e){return e.ctrlKey||e.metaKey||e.shiftKey}function ri(e,t,n,o){const i=t.replace("+",`
- `).replace(`
- `,`
- +`).split(`
- `).map(a=>a.trim().toLowerCase());if(i.length===1)return e.toLowerCase()===t.toLowerCase();o||n.add(e.toLowerCase());const r=i.every((a,s)=>n.has(a)&&Array.from(n.values())[s]===i[s]);return o&&n.delete(e.toLowerCase()),r}function Oc(e,t){return n=>{if(!n.code&&!n.key)return!1;const o=Rc(n.code,e);return Array.isArray(e)?e.some(i=>ri(n[o],i,t,n.type==="keyup")):ri(n[o],e,t,n.type==="keyup")}}function Rc(e,t){return t.includes(e)?"code":"key"}function Kt(e,t){const n=Ce(()=>ye(t==null?void 0:t.actInsideInputWithModifier)??!1),o=Ce(()=>ye(t==null?void 0:t.target)??window),i=K(ye(e)===!0);let r=!1;const a=new Set;let s=l(ye(e));_e(()=>ye(e),(c,d)=>{typeof d=="boolean"&&typeof c!="boolean"&&u(),s=l(c)},{immediate:!0}),Xe(()=>{Yi(window,["blur","contextmenu"],u)}),Lo((...c)=>s(...c),c=>{r=zc(c),!((!r||r&&!n.value)&&_o(c))&&(c.preventDefault(),i.value=!0)},{eventName:"keydown",target:o}),Lo((...c)=>s(...c),c=>{if(i.value){if((!r||r&&!n.value)&&_o(c))return;r=!1,i.value=!1}},{eventName:"keyup",target:o});function u(){r=!1,a.clear(),i.value=ye(e)===!0}function l(c){return c===null?(u(),()=>!1):typeof c=="boolean"?(u(),i.value=c,()=>!1):Array.isArray(c)||typeof c=="string"?Oc(c,a):c}return i}const mr="vue-flow__node-desc",yr="vue-flow__edge-desc",Bc="vue-flow__aria-live",_r=["Enter"," ","Escape"],$t={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function wo(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function xo(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 Fn(e){return{width:e.offsetWidth,height:e.offsetHeight}}function St(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function wr(e,t){return{x:St(e.x,t[0][0],t[1][0]),y:St(e.y,t[0][1],t[1][1])}}function ai(e){const t=e.getRootNode();return"elementFromPoint"in t?t:window.document}function ht(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function _t(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!ht(e)}function Ut(e){return _t(e)&&"computedPosition"in e}function dn(e){return!Number.isNaN(e)&&Number.isFinite(e)}function Fc(e){return dn(e.width)&&dn(e.height)&&dn(e.x)&&dn(e.y)}function Lc(e,t,n){const o={id:e.id.toString(),type:e.type??"default",dimensions:De({width:0,height:0}),computedPosition:De({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:$e(e.data)?e.data:{},events:De($e(e.events)?e.events:{})};return Object.assign(t??o,e,{id:e.id.toString(),parentNode:n})}function xr(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:$e(e.data)?e.data:{},events:De($e(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 br(e,t,n,o){const i=typeof e=="string"?e:e.id,r=new Set,a=o==="source"?"target":"source";for(const s of n)s[a]===i&&r.add(s[o]);return t.filter(s=>r.has(s.id))}function Vc(...e){if(e.length===3){const[r,a,s]=e;return br(r,a,s,"target")}const[t,n]=e,o=typeof t=="string"?t:t.id;return n.filter(r=>ht(r)&&r.source===o).map(r=>n.find(a=>_t(a)&&a.id===r.target))}function Hc(...e){if(e.length===3){const[r,a,s]=e;return br(r,a,s,"source")}const[t,n]=e,o=typeof t=="string"?t:t.id;return n.filter(r=>ht(r)&&r.target===o).map(r=>n.find(a=>_t(a)&&a.id===r.source))}function Sr({source:e,sourceHandle:t,target:n,targetHandle:o}){return`vueflow__edge-${e}${t??""}-${n}${o??""}`}function Yc(e,t){return t.some(n=>ht(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 Er({x:e,y:t},{x:n,y:o,zoom:i}){return{x:e*i+n,y:t*i+o}}function en({x:e,y:t},{x:n,y:o,zoom:i},r=!1,a=[1,1]){const s={x:(e-n)/i,y:(t-o)/i};return r?Ln(s,a):s}function Gc(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 Cr({x:e,y:t,width:n,height:o}){return{x:e,y:t,x2:e+n,y2:t+o}}function Uc({x:e,y:t,x2:n,y2:o}){return{x:e,y:t,width:n-e,height:o-t}}function Nr(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=Gc(t,Cr({...o.computedPosition,...o.dimensions}))}return Uc(t)}function kr(e,t,n={x:0,y:0,zoom:1},o=!1,i=!1){const r={...en(t,n),width:t.width/n.zoom,height:t.height/n.zoom},a=[];for(const s of e){const{dimensions:u,selectable:l=!0,hidden:c=!1}=s,d=u.width??s.width??null,f=u.height??s.height??null;if(i&&!l||c)continue;const _=xo(r,wo(s)),m=d===null||f===null,v=o&&_>0,p=(d??0)*(f??0);(m||v||_>=p||s.dragging)&&a.push(s)}return a}function $r(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 si(e,t,n,o,i,r=.1,a={x:0,y:0}){const s=t/(e.width*(1+r)),u=n/(e.height*(1+r)),l=Math.min(s,u),c=St(l,o,i),d=e.x+e.width/2,f=e.y+e.height/2,_=t/2-d*c+(a.x??0),m=n/2-f*c+(a.y??0);return{x:_,y:m,zoom:c}}function Xc(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function Ir(e,t){if(!e.parentNode)return!1;const n=t(e.parentNode);return n?n.selected?!0:Ir(n,t):!1}function tn(e,t){return typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`}function li(e,t,n){return e<t?St(Math.abs(e-t),1,t)/t:e>n?-St(Math.abs(e-n),1,t)/t:0}function Pr(e,t,n=15,o=40){const i=li(e.x,o,t.width-o)*n,r=li(e.y,o,t.height-o)*n;return[i,r]}function eo(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 a=Number(i.width.replace("px",""));i.width=`${a+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 a=Number(i.height.replace("px",""));i.height=`${a+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 a=t.style;return{...a(r),...i}}:t.style={...t.style,...i}}}}function ui(e,t){var n,o;const i=e.filter(a=>a.type==="add"||a.type==="remove");for(const a of i)if(a.type==="add")t.findIndex(u=>u.id===a.item.id)===-1&&t.push(a.item);else if(a.type==="remove"){const s=t.findIndex(u=>u.id===a.id);s!==-1&&t.splice(s,1)}const r=t.map(a=>a.id);for(const a of t)for(const s of e)if(s.id===a.id)switch(s.type){case"select":a.selected=s.selected;break;case"position":if(Ut(a)&&(typeof s.position<"u"&&(a.position=s.position),typeof s.dragging<"u"&&(a.dragging=s.dragging),a.expandParent&&a.parentNode)){const u=t[r.indexOf(a.parentNode)];u&&Ut(u)&&eo(a,u)}break;case"dimensions":if(Ut(a)&&(typeof s.dimensions<"u"&&(a.dimensions=s.dimensions),typeof s.updateStyle<"u"&&s.updateStyle&&(a.style={...a.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"&&(a.resizing=s.resizing),a.expandParent&&a.parentNode)){const u=t[r.indexOf(a.parentNode)];u&&Ut(u)&&(!!u.dimensions.width&&!!u.dimensions.height?eo(a,u):je(()=>{eo(a,u)}))}break}return t}function ct(e,t){return{id:e,type:"select",selected:t}}function ci(e){return{item:e,type:"add"}}function di(e){return{id:e,type:"remove"}}function fi(e,t,n,o,i){return{id:e,source:t,target:n,sourceHandle:o||null,targetHandle:i||null,type:"remove"}}function ft(e,t=new Set,n=!1){const o=[];for(const[i,r]of e){const a=t.has(i);!(r.selected===void 0&&!a)&&r.selected!==a&&(n&&(r.selected=a),o.push(ct(r.id,a)))}return o}function J(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 An(u),{off:u}},off:i,trigger:s=>Promise.all(Array.from(t).map(u=>u(s))),hasListeners:o,fns:t}}function hi(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 Wc(e,t,n,o,i){var r,a;const s=[];for(const u of e)(u.selected||u.id===i)&&(!u.parentNode||!Ir(u,o))&&(u.draggable||t&&typeof u.draggable>"u")&&s.push(De({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-((a=u.computedPosition)==null?void 0:a.y)||0},from:u.computedPosition,extent:u.extent,parentNode:u.parentNode,dimensions:u.dimensions,expandParent:u.expandParent}));return s}function to({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 Mr(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 Kc(e,t,n){const[o,i,r,a]=typeof e!="string"?Mr(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+a,n.computedPosition.y+o],[n.computedPosition.x+n.dimensions.width-i,n.computedPosition.y+n.dimensions.height-r]]:!1}function Zc(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=Kc(i,e,o);r&&(i=r)}else t(new Me(Pe.NODE_EXTENT_INVALID,e.id)),i=n;else if(Array.isArray(i)){const r=(o==null?void 0:o.computedPosition.x)||0,a=(o==null?void 0:o.computedPosition.y)||0;i=[[i[0][0]+r,i[0][1]+a],[i[1][0]+r,i[1][1]+a]]}else if(i!=="parent"&&(i!=null&&i.range)&&Array.isArray(i.range)){const[r,a,s,u]=Mr(i.padding),l=(o==null?void 0:o.computedPosition.x)||0,c=(o==null?void 0:o.computedPosition.y)||0;i=[[i.range[0][0]+l+u,i.range[0][1]+c+r],[i.range[1][0]+l-a,i.range[1][1]+c-s]]}return i==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:i}function qc({width:e,height:t},n){return[n[0],[n[1][0]-(e||0),n[1][1]-(t||0)]]}function Ao(e,t,n,o,i){const r=qc(e.dimensions,Zc(e,n,o,i)),a=wr(t,r);return{position:{x:a.x-((i==null?void 0:i.computedPosition.x)||0),y:a.y-((i==null?void 0:i.computedPosition.y)||0)},computedPosition:a}}function kn(e,t,n=q.Left){const o=((t==null?void 0:t.x)??0)+e.computedPosition.x,i=((t==null?void 0:t.y)??0)+e.computedPosition.y,{width:r,height:a}=t??Qc(e);switch((t==null?void 0:t.position)??n){case q.Top:return{x:o+r/2,y:i};case q.Right:return{x:o+r,y:i+a/2};case q.Bottom:return{x:o+r/2,y:i+a};case q.Left:return{x:o,y:i+a/2}}}function pi(e=[],t){return e.length&&(t?e.find(n=>n.id===t):e[0])||null}function jc({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:o,targetWidth:i,targetHeight:r,width:a,height:s,viewport:u}){const l={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)};l.x===l.x2&&(l.x2+=1),l.y===l.y2&&(l.y2+=1);const c=Cr({x:(0-u.x)/u.zoom,y:(0-u.y)/u.zoom,width:a/u.zoom,height:s/u.zoom}),d=Math.max(0,Math.min(c.x2,l.x2)-Math.max(c.x,l.x)),f=Math.max(0,Math.min(c.y2,l.y2)-Math.max(c.y,l.y));return Math.ceil(d*f)>0}function Jc(e,t,n=!1){const o=typeof e.zIndex=="number";let i=o?e.zIndex:0;const r=t(e.source),a=t(e.target);return!r||!a?0:(n&&(i=o?e.zIndex:Math.max(r.computedPosition.z||0,a.computedPosition.z||0)),i)}var Pe=(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))(Pe||{});const vi={MISSING_STYLES:()=>"It seems that you haven't loaded the necessary styles. Please import '@vue-flow/core/dist/style.css' to ensure that the graph is rendered correctly",MISSING_VIEWPORT_DIMENSIONS:()=>"The Vue Flow parent container needs a width and a height to render the graph",NODE_INVALID:e=>`Node is invalid
- Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found
- Node: ${e}`,NODE_MISSING_PARENT:(e,t)=>`Node is missing a parent
- Node: ${e}
- Parent: ${t}`,NODE_TYPE_MISSING:e=>`Node type is missing
- Type: ${e}`,NODE_EXTENT_INVALID:e=>`Only child nodes can use a parent extent
- Node: ${e}`,EDGE_INVALID:e=>`An edge needs a source and a target
- Edge: ${e}`,EDGE_SOURCE_MISSING:(e,t)=>`Edge source is missing
- Edge: ${e}
- Source: ${t}`,EDGE_TARGET_MISSING:(e,t)=>`Edge target is missing
- Edge: ${e}
- Target: ${t}`,EDGE_TYPE_MISSING:e=>`Edge type is missing
- Type: ${e}`,EDGE_SOURCE_TARGET_SAME:(e,t,n)=>`Edge source and target are the same
- Edge: ${e}
- Source: ${t}
- Target: ${n}`,EDGE_SOURCE_TARGET_MISSING:(e,t,n)=>`Edge source or target is missing
- Edge: ${e}
- Source: ${t}
- Target: ${n}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
- Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found
- Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead"};class Me extends Error{constructor(t,...n){var o;super((o=vi[t])==null?void 0:o.call(vi,...n)),this.name="VueFlowError",this.code=t,this.args=n}}function zo(e){return"clientX"in e}function Tr(e){return"sourceEvent"in e}function at(e,t){var n,o;const i=zo(e),r=i?e.clientX:(n=e.touches)==null?void 0:n[0].clientX,a=i?e.clientY:(o=e.touches)==null?void 0:o[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:a-((t==null?void 0:t.top)??0)}}const $n=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Qc(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 Ln(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}function Dr(){return{handleDomNode:null,isValid:!1,connection:{source:"",target:"",sourceHandle:null,targetHandle:null},endHandle:null}}function no(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function gi(e,t,n,o){const i=[];for(const r of t[n]||[])if(`${e.id}-${r.id}-${n}`!==o){const{x:a,y:s}=kn(e,r);i.push({id:r.id||null,type:n,nodeId:e.id,x:a,y:s})}return i}function ed(e,t,n,o,i,r){const{x:a,y:s}=at(e),l=t.elementsFromPoint(a,s).find(m=>m.classList.contains("vue-flow__handle"));if(l){const m=l.getAttribute("data-nodeid");if(m){const v=Oo(void 0,l),p=l.getAttribute("data-handleid"),y=r({nodeId:m,id:p,type:v});if(y){const g=i.find(h=>h.nodeId===m&&h.type===v&&h.id===p);return{handle:{id:p,type:v,nodeId:m,x:(g==null?void 0:g.x)||n.x,y:(g==null?void 0:g.y)||n.y},validHandleResult:y}}}}let c=[],d=Number.POSITIVE_INFINITY;for(const m of i){const v=Math.sqrt((m.x-n.x)**2+(m.y-n.y)**2);if(v<=o){const p=r(m);v<=d&&(v<d?c=[{handle:m,validHandleResult:p}]:v===d&&c.push({handle:m,validHandleResult:p}),d=v)}}if(!c.length)return{handle:null,validHandleResult:Dr()};if(c.length===1)return c[0];const f=c.some(({validHandleResult:m})=>m.isValid),_=c.some(({handle:m})=>m.type==="target");return c.find(({handle:m,validHandleResult:v})=>_?m.type==="target":f?v.isValid:!0)||c[0]}function mi(e,t,n,o,i,r,a,s,u,l,c){const d=r==="target",f=s.querySelector(`.vue-flow__handle[data-id="${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`),{x:_,y:m}=at(e),v=s.elementFromPoint(_,m),p=v!=null&&v.classList.contains("vue-flow__handle")?v:f,y=Dr();if(p){y.handleDomNode=p;const g=Oo(void 0,p),h=p.getAttribute("data-nodeid"),w=p.getAttribute("data-handleid"),A=p.classList.contains("connectable"),R=p.classList.contains("connectableend"),V={source:d?h:o,sourceHandle:d?w:i,target:d?o:h,targetHandle:d?i:w};y.connection=V,A&&R&&(n===bt.Strict?d&&g==="source"||!d&&g==="target":h!==o||w!==i)&&(y.isValid=a(V,{edges:u,nodes:l,sourceNode:c(V.source),targetNode:c(V.target)}),y.endHandle={nodeId:h,handleId:w,type:g,position:y.isValid?p.getAttribute("data-handlepos"):null})}return y}function td({nodes:e,nodeId:t,handleId:n,handleType:o}){const i=[];for(let r=0;r<e.length;r++){const a=e[r],{handleBounds:s}=a;let u=[],l=[];s&&(u=gi(a,s,"source",`${t}-${n}-${o}`),l=gi(a,s,"target",`${t}-${n}-${o}`)),i.push(...u,...l)}return i}function Oo(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function nd(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}const od=["production","prod"];function Vn(e,...t){Ar()&&console.warn(`[Vue Flow]: ${e}`,...t)}function Ar(){return!od.includes("production")}function yi(e,t,n,o){const i=t.querySelectorAll(`.vue-flow__handle${e}`);return Array.from(i).map(a=>{const s=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),position:a.getAttribute("data-handlepos"),x:(s.left-n.left)/o,y:(s.top-n.top)/o,...Fn(a)}})}function bo(e,t,n,o,i,r=!1,a){i.value=!1,e.selected?(r||e.selected&&t)&&(o([e]),je(()=>{a.blur()})):n([e])}function $e(e){return typeof x(e)<"u"}function id(e,t,n,o){if(!e||!e.source||!e.target)return n(new Me(Pe.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let i;return ht(e)?i=e:i={...e,id:Sr(e)},i=xr(i,void 0,o),Yc(i,t)?!1:i}function rd(e,t,n,o,i,r){if(!t.source||!t.target)return r(new Me(Pe.EDGE_INVALID,e.id)),!1;const a=o(e.id);if(!a)return r(new Me(Pe.EDGE_NOT_FOUND,e.id)),!1;const{id:s,...u}=e,l={...u,id:i?Sr(t):s,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle};return n.splice(n.indexOf(a),1,l),l}function _i(e,t,n){const o={},i=[];for(let r=0;r<e.length;++r){const a=e[r];if(!_t(a)){n(new Me(Pe.NODE_INVALID,a==null?void 0:a.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const s=Lc(a,t(a.id),a.parentNode);a.parentNode&&(o[a.parentNode]=!0),i[r]=s}for(const r of i){const a=t(r.parentNode)||i.find(s=>s.id===r.parentNode);r.parentNode&&!a&&n(new Me(Pe.NODE_MISSING_PARENT,r.id,r.parentNode)),(r.parentNode||o[r.id])&&(o[r.id]&&(r.isParent=!0),a&&(a.isParent=!0))}return i}function wi(e,t){e.clear();for(const n of t){const{id:o,source:i,target:r,sourceHandle:a=null,targetHandle:s=null}=n,u=`${i}-source-${a}`,l=`${r}-target-${s}`,c=e.get(u)||new Map,d=e.get(l)||new Map,f=De({edgeId:o,source:i,target:r,sourceHandle:a,targetHandle:s});e.set(u,c.set(`${r}-${s}`,f)),e.set(l,d.set(`${i}-${a}`,f))}}function xi(e,t,n,o,i,r,a,s){const u=[];for(const l of e){const c=ht(l)?l:id(l,s,i,r);if(!c)continue;const d=n(c.source),f=n(c.target);if(!d||!f){i(new Me(Pe.EDGE_SOURCE_TARGET_MISSING,c.id,c.source,c.target));continue}if(!d){i(new Me(Pe.EDGE_SOURCE_MISSING,c.id,c.source));continue}if(!f){i(new Me(Pe.EDGE_TARGET_MISSING,c.id,c.target));continue}if(t&&!t(c,{edges:s,nodes:a,sourceNode:d,targetNode:f})){i(new Me(Pe.EDGE_INVALID,c.id));continue}const _=o(c.id);u.push({...xr(c,_,r),sourceNode:d,targetNode:f})}return u}const bi=Symbol("vueFlow"),zr=Symbol("nodeId"),Or=Symbol("nodeRef"),ad=Symbol("edgeId"),sd=Symbol("edgeRef"),Hn=Symbol("slots");function Rr(e){const{vueFlowRef:t,snapToGrid:n,snapGrid:o,noDragClassName:i,nodes:r,nodeExtent:a,nodeDragThreshold:s,viewport:u,autoPanOnNodeDrag:l,autoPanSpeed:c,nodesDraggable:d,panBy:f,findNode:_,multiSelectionActive:m,nodesSelectionActive:v,selectNodesOnDrag:p,removeSelectedElements:y,addSelectedNodes:g,updateNodePositions:h,emits:w}=Ne(),{onStart:A,onDrag:R,onStop:V,onClick:W,el:j,disabled:Y,id:U,selectable:D,dragHandle:ie}=e,N=K(!1);let O=[],E,$=null,F={x:void 0,y:void 0},H={x:0,y:0},X=null,T=!1,z=0,M=!1;const P=cd(),ne=({x:ee,y:oe})=>{F={x:ee,y:oe};let ce=!1;if(O=O.map(C=>{const b={x:ee-C.distance.x,y:oe-C.distance.y},{computedPosition:S}=Ao(C,n.value?Ln(b,o.value):b,w.error,a.value,C.parentNode?_(C.parentNode):void 0);return ce=ce||C.position.x!==S.x||C.position.y!==S.y,C.position=S,C}),!!ce&&(h(O,!0,!0),N.value=!0,X)){const[C,b]=to({id:U,dragItems:O,findNode:_});R({event:X,node:C,nodes:b})}},ve=()=>{if(!$)return;const[ee,oe]=Pr(H,$,c.value);if(ee!==0||oe!==0){const ce={x:(F.x??0)-ee/u.value.zoom,y:(F.y??0)-oe/u.value.zoom};f({x:ee,y:oe})&&ne(ce)}z=requestAnimationFrame(ve)},fe=(ee,oe)=>{T=!0;const ce=_(U);!p.value&&!m.value&&ce&&(ce.selected||y()),ce&&ye(D)&&p.value&&bo(ce,m.value,g,y,v,!1,oe);const C=P(ee.sourceEvent);if(F=C,O=Wc(r.value,d.value,C,_,U),O.length){const[b,S]=to({id:U,dragItems:O,findNode:_});A({event:ee.sourceEvent,node:b,nodes:S})}},me=(ee,oe)=>{var ce;ee.sourceEvent.type==="touchmove"&&ee.sourceEvent.touches.length>1||(s.value===0&&fe(ee,oe),F=P(ee.sourceEvent),$=((ce=t.value)==null?void 0:ce.getBoundingClientRect())||null,H=at(ee.sourceEvent,$))},le=(ee,oe)=>{const ce=P(ee.sourceEvent);if(!M&&T&&l.value&&(M=!0,ve()),!T){const C=ce.xSnapped-(F.x??0),b=ce.ySnapped-(F.y??0);Math.sqrt(C*C+b*b)>s.value&&fe(ee,oe)}(F.x!==ce.xSnapped||F.y!==ce.ySnapped)&&O.length&&T&&(X=ee.sourceEvent,H=at(ee.sourceEvent,$),ne(ce))},de=ee=>{if(!Tr(ee)&&!T&&!N.value&&!m.value){const oe=ee,ce=P(oe),C=ce.xSnapped-(F.x??0),b=ce.ySnapped-(F.y??0),S=Math.sqrt(C*C+b*b);S!==0&&S<=s.value&&(W==null||W(oe));return}if(N.value=!1,M=!1,T=!1,F={x:void 0,y:void 0},cancelAnimationFrame(z),O.length){h(O,!1,!1);const[oe,ce]=to({id:U,dragItems:O,findNode:_});V({event:ee.sourceEvent,node:oe,nodes:ce})}};return _e([()=>ye(Y),j],([ee,oe],ce,C)=>{if(oe){const b=Ge(oe);ee||(E=Gl().on("start",S=>me(S,oe)).on("drag",S=>le(S,oe)).on("end",S=>de(S)).filter(S=>{const k=S.target,B=ye(ie);return!S.button&&(!i.value||!hi(k,`.${i.value}`,oe)&&(!B||hi(k,B,oe)))}),b.call(E)),C(()=>{b.on(".drag",null),E&&(E.on("start",null),E.on("drag",null),E.on("end",null))})}}),N}function ld(){return{doubleClick:J(),click:J(),mouseEnter:J(),mouseMove:J(),mouseLeave:J(),contextMenu:J(),updateStart:J(),update:J(),updateEnd:J()}}function ud(e,t){const n=ld();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 cd(){const{viewport:e,snapGrid:t,snapToGrid:n}=Ne();return o=>{const i=Tr(o)?o.sourceEvent:o,{x:r,y:a}=at(i),s=en({x:r,y:a},e.value),{x:u,y:l}=n.value?Ln(s,t.value):s;return{xSnapped:u,ySnapped:l,...s}}}function fn(){return!0}function Br({handleId:e,nodeId:t,type:n,isValidConnection:o,edgeUpdaterType:i,onEdgeUpdate:r,onEdgeUpdateEnd:a}){const{vueFlowRef:s,connectionMode:u,connectionRadius:l,connectOnClick:c,connectionClickStartHandle:d,nodesConnectable:f,autoPanOnConnect:_,autoPanSpeed:m,findNode:v,panBy:p,startConnection:y,updateConnection:g,endConnection:h,emits:w,viewport:A,edges:R,nodes:V,isValidConnection:W}=Ne();let j=null,Y=!1,U=null,D=null;function ie(O){var E;const $=ye(n)==="target",F=zo(O),H=ai(O.target);if(F&&O.button===0||!F){let X=function(S){oe=at(S,de);const{handle:k,validHandleResult:B}=ed(S,H,en(oe,A.value,!1,[1,1]),l.value,C,Q=>mi(S,Q,u.value,ye(t),ye(e),$?"target":"source",M,H,R.value,V.value,v));if(P=k,ce||(b(),ce=!0),j=B.connection,Y=B.isValid,U=B.handleDomNode,!(Y&&P&&(D!=null&&D.endHandle)&&B.endHandle&&D.endHandle.type===B.endHandle.type&&D.endHandle.nodeId===B.endHandle.nodeId&&D.endHandle.handleId===B.endHandle.handleId)){if(g(P&&Y?Er({x:P.x,y:P.y},A.value):oe,B.endHandle,nd(!!P,Y)),D=B,!P&&!Y&&!U)return no(ee);j&&j.source!==j.target&&U&&(no(ee),ee=U,U.classList.add("connecting","vue-flow__handle-connecting"),U.classList.toggle("valid",Y),U.classList.toggle("vue-flow__handle-valid",Y))}},T=function(S){(P||U)&&j&&Y&&(r?r(S,j):w.connect(j)),w.connectEnd(S),i&&(a==null||a(S)),no(ee),cancelAnimationFrame(ne),h(S),ce=!1,Y=!1,j=null,U=null,H.removeEventListener("mousemove",X),H.removeEventListener("mouseup",T),H.removeEventListener("touchmove",X),H.removeEventListener("touchend",T)};const z=v(ye(t));let M=ye(o)||W.value||fn;!M&&z&&(M=($?z.isValidSourcePos:z.isValidTargetPos)||fn);let P,ne=0;const{x:ve,y:fe}=at(O),me=H==null?void 0:H.elementFromPoint(ve,fe),le=Oo(ye(i),me),de=(E=s.value)==null?void 0:E.getBoundingClientRect();if(!de||!le)return;let ee,oe=at(O,de),ce=!1;const C=td({nodes:V.value,nodeId:ye(t),handleId:ye(e),handleType:le}),b=()=>{if(!_.value)return;const[S,k]=Pr(oe,de,m.value);p({x:S,y:k}),ne=requestAnimationFrame(b)};y({nodeId:ye(t),handleId:ye(e),type:le,position:(me==null?void 0:me.getAttribute("data-handlepos"))||q.Top},{x:ve-de.left,y:fe-de.top}),w.connectStart({event:O,nodeId:ye(t),handleId:ye(e),handleType:le}),H.addEventListener("mousemove",X),H.addEventListener("mouseup",T),H.addEventListener("touchmove",X),H.addEventListener("touchend",T)}}function N(O){if(!c.value)return;const E=ye(n)==="target";if(!d.value)w.clickConnectStart({event:O,nodeId:ye(t),handleId:ye(e)}),y({nodeId:ye(t),type:ye(n),handleId:ye(e)},void 0,!0);else{let $=ye(o)||W.value||fn;const F=v(ye(t));if(!$&&F&&($=(E?F.isValidSourcePos:F.isValidTargetPos)||fn),F&&(typeof F.connectable>"u"?f.value:F.connectable)===!1)return;const H=ai(O.target),{connection:X,isValid:T}=mi(O,{nodeId:ye(t),id:ye(e),type:ye(n)},u.value,d.value.nodeId,d.value.handleId||null,d.value.type,$,H,R.value,V.value,v),z=X.source===X.target;T&&!z&&w.connect(X),w.clickConnectEnd(O),h(O,!0)}}return{handlePointerDown:ie,handleClick:N}}function dd(){return Ot(zr,"")}function Fr(e){const t=e??dd()??"",n=Ot(Or,K(null)),{findNode:o,edges:i,emits:r}=Ne(),a=o(t);return a||r.error(new Me(Pe.NODE_NOT_FOUND,t)),{id:t,nodeEl:n,node:a,parentNode:ue(()=>o(a.parentNode)),connectedEdges:ue(()=>$r([a],i.value))}}function fd(){return{doubleClick:J(),click:J(),mouseEnter:J(),mouseMove:J(),mouseLeave:J(),contextMenu:J(),dragStart:J(),drag:J(),dragStop:J()}}function hd(e,t){const n=fd();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 Lr(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:n,findNode:o,snapGrid:i,snapToGrid:r,nodesDraggable:a,emits:s}=Ne();return(u,l=!1)=>{const c=r.value?i.value[0]:5,d=r.value?i.value[1]:5,f=l?4:1,_=u.x*c*f,m=u.y*d*f,v=[];for(const p of e.value)if(p.draggable||a&&typeof p.draggable>"u"){const y={x:p.computedPosition.x+_,y:p.computedPosition.y+m},{computedPosition:g}=Ao(p,y,s.error,t.value,p.parentNode?o(p.parentNode):void 0);v.push({id:p.id,position:g,from:p.position,distance:{x:u.x,y:u.y},dimensions:p.dimensions})}n(v,!0,!1)}}const oo=.1;function ut(){return Vn("Viewport not initialized yet."),Promise.resolve(!1)}const pd={zoomIn:ut,zoomOut:ut,zoomTo:ut,fitView:ut,setCenter:ut,fitBounds:ut,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:ut,setTransform:ut,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function vd(e){function t(o,i){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.scaleBy(io(e.d3Selection,i,()=>{r(!0)}),o):r(!1)})}function n(o,i,r,a){return new Promise(s=>{const{x:u,y:l}=wr({x:-o,y:-i},e.translateExtent),c=zt.translate(-u,-l).scale(r);e.d3Selection&&e.d3Zoom?e.d3Zoom.transform(io(e.d3Selection,a,()=>{s(!0)}),c):s(!1)})}return ue(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:i=>t(1.2,i==null?void 0:i.duration),zoomOut:i=>t(1/1.2,i==null?void 0:i.duration),zoomTo:(i,r)=>new Promise(a=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.scaleTo(io(e.d3Selection,r==null?void 0:r.duration,()=>{a(!0)}),i):a(!1)}),setViewport:(i,r)=>n(i.x,i.y,i.zoom,r==null?void 0:r.duration),setTransform:(i,r)=>n(i.x,i.y,i.zoom,r==null?void 0:r.duration),getViewport:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),getTransform:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),fitView:(i={padding:oo,includeHiddenNodes:!1,duration:0})=>{var r,a;const s=[];for(const f of e.nodes)f.dimensions.width&&f.dimensions.height&&((i==null?void 0:i.includeHiddenNodes)||!f.hidden)&&(!((r=i.nodes)!=null&&r.length)||(a=i.nodes)!=null&&a.length&&i.nodes.includes(f.id))&&s.push(f);if(!s.length)return Promise.resolve(!1);const u=Nr(s),{x:l,y:c,zoom:d}=si(u,e.dimensions.width,e.dimensions.height,i.minZoom??e.minZoom,i.maxZoom??e.maxZoom,i.padding??oo,i.offset);return n(l,c,d,i==null?void 0:i.duration)},setCenter:(i,r,a)=>{const s=typeof(a==null?void 0:a.zoom)<"u"?a.zoom:e.maxZoom,u=e.dimensions.width/2-i*s,l=e.dimensions.height/2-r*s;return n(u,l,s,a==null?void 0:a.duration)},fitBounds:(i,r={padding:oo})=>{const{x:a,y:s,zoom:u}=si(i,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding);return n(a,s,u,r==null?void 0:r.duration)},project:i=>en(i,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:i=>{if(e.vueFlowRef){const{x:r,y:a}=e.vueFlowRef.getBoundingClientRect(),s={x:i.x-r,y:i.y-a};return en(s,e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:i=>{if(e.vueFlowRef){const{x:r,y:a}=e.vueFlowRef.getBoundingClientRect(),s={x:i.x+r,y:i.y+a};return Er(s,e.viewport)}return{x:0,y:0}}}:pd)}function io(e,t=0,n){return e.transition().duration(t).on("end",n)}function gd(e,t,n){const o=Mi(!0);return o.run(()=>{const i=()=>{o.run(()=>{let v,p,y=!!(n.nodes.value.length||n.edges.value.length);v=Ct([e.modelValue,()=>{var g,h;return(h=(g=e.modelValue)==null?void 0:g.value)==null?void 0:h.length}],([g])=>{g&&Array.isArray(g)&&(p==null||p.pause(),n.setElements(g),!p&&!y&&g.length?y=!0:p==null||p.resume())}),p=Ct([n.nodes,n.edges,()=>n.edges.value.length,()=>n.nodes.value.length],([g,h])=>{var w;(w=e.modelValue)!=null&&w.value&&Array.isArray(e.modelValue.value)&&(v==null||v.pause(),e.modelValue.value=[...g,...h],je(()=>{v==null||v.resume()}))},{immediate:y}),pn(()=>{v==null||v.stop(),p==null||p.stop()})})},r=()=>{o.run(()=>{let v,p,y=!!n.nodes.value.length;v=Ct([e.nodes,()=>{var g,h;return(h=(g=e.nodes)==null?void 0:g.value)==null?void 0:h.length}],([g])=>{g&&Array.isArray(g)&&(p==null||p.pause(),n.setNodes(g),!p&&!y&&g.length?y=!0:p==null||p.resume())}),p=Ct([n.nodes,()=>n.nodes.value.length],([g])=>{var h;(h=e.nodes)!=null&&h.value&&Array.isArray(e.nodes.value)&&(v==null||v.pause(),e.nodes.value=[...g],je(()=>{v==null||v.resume()}))},{immediate:y}),pn(()=>{v==null||v.stop(),p==null||p.stop()})})},a=()=>{o.run(()=>{let v,p,y=!!n.edges.value.length;v=Ct([e.edges,()=>{var g,h;return(h=(g=e.edges)==null?void 0:g.value)==null?void 0:h.length}],([g])=>{g&&Array.isArray(g)&&(p==null||p.pause(),n.setEdges(g),!p&&!y&&g.length?y=!0:p==null||p.resume())}),p=Ct([n.edges,()=>n.edges.value.length],([g])=>{var h;(h=e.edges)!=null&&h.value&&Array.isArray(e.edges.value)&&(v==null||v.pause(),e.edges.value=[...g],je(()=>{v==null||v.resume()}))},{immediate:y}),pn(()=>{v==null||v.stop(),p==null||p.stop()})})},s=()=>{o.run(()=>{_e(()=>t.maxZoom,()=>{t.maxZoom&&$e(t.maxZoom)&&n.setMaxZoom(t.maxZoom)},{immediate:!0})})},u=()=>{o.run(()=>{_e(()=>t.minZoom,()=>{t.minZoom&&$e(t.minZoom)&&n.setMinZoom(t.minZoom)},{immediate:!0})})},l=()=>{o.run(()=>{_e(()=>t.translateExtent,()=>{t.translateExtent&&$e(t.translateExtent)&&n.setTranslateExtent(t.translateExtent)},{immediate:!0})})},c=()=>{o.run(()=>{_e(()=>t.nodeExtent,()=>{t.nodeExtent&&$e(t.nodeExtent)&&n.setNodeExtent(t.nodeExtent)},{immediate:!0})})},d=()=>{o.run(()=>{_e(()=>t.applyDefault,()=>{$e(t.applyDefault)&&(n.applyDefault.value=t.applyDefault)},{immediate:!0})})},f=()=>{o.run(()=>{const v=async p=>{let y=p;typeof t.autoConnect=="function"&&(y=await t.autoConnect(p)),y!==!1&&n.addEdges([y])};_e(()=>t.autoConnect,()=>{$e(t.autoConnect)&&(n.autoConnect.value=t.autoConnect)},{immediate:!0}),_e(n.autoConnect,(p,y,g)=>{p?n.onConnect(v):n.hooks.value.connect.off(v),g(()=>{n.hooks.value.connect.off(v)})},{immediate:!0})})},_=()=>{const v=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const p of Object.keys(t)){const y=p;if(!v.includes(y)){const g=Ce(()=>t[y]),h=n[y];Co(h)&&o.run(()=>{_e(g,w=>{$e(w)&&(h.value=w)},{immediate:!0})})}}};(()=>{i(),r(),a(),u(),s(),l(),c(),d(),f(),_()})()}),()=>o.stop()}function md(){return{edgesChange:J(),nodesChange:J(),nodeDoubleClick:J(),nodeClick:J(),nodeMouseEnter:J(),nodeMouseMove:J(),nodeMouseLeave:J(),nodeContextMenu:J(),nodeDragStart:J(),nodeDrag:J(),nodeDragStop:J(),nodesInitialized:J(),miniMapNodeClick:J(),miniMapNodeDoubleClick:J(),miniMapNodeMouseEnter:J(),miniMapNodeMouseMove:J(),miniMapNodeMouseLeave:J(),connect:J(),connectStart:J(),connectEnd:J(),clickConnectStart:J(),clickConnectEnd:J(),paneReady:J(),init:J(),move:J(),moveStart:J(),moveEnd:J(),selectionDragStart:J(),selectionDrag:J(),selectionDragStop:J(),selectionContextMenu:J(),selectionStart:J(),selectionEnd:J(),viewportChangeStart:J(),viewportChange:J(),viewportChangeEnd:J(),paneScroll:J(),paneClick:J(),paneContextMenu:J(),paneMouseEnter:J(),paneMouseMove:J(),paneMouseLeave:J(),edgeContextMenu:J(),edgeMouseEnter:J(),edgeMouseMove:J(),edgeMouseLeave:J(),edgeDoubleClick:J(),edgeClick:J(),edgeUpdateStart:J(),edgeUpdate:J(),edgeUpdateEnd:J(),updateNodeInternals:J(),error:J(e=>Vn(e.message))}}function yd(e,t){ea(()=>{for(const[n,o]of Object.entries(t.value)){const i=r=>{e(n,r)};o.fns.add(i),An(()=>{o.off(i)})}})}function Vr(){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:Do.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:Wt.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:vt.Bezier,style:{}},connectionMode:bt.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:$n()?"Meta":"Control",zoomActivationKeyCode:$n()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:md(),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 _d=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function wd(e,t,n){const o=vd(e),i=C=>{const b=C??[];e.hooks.updateNodeInternals.trigger(b)},r=C=>Hc(C,e.nodes,e.edges),a=C=>Vc(C,e.nodes,e.edges),s=C=>$r(C,e.edges),u=({id:C,type:b,nodeId:S})=>{var k;return Array.from(((k=e.connectionLookup.get(`${S}-${b}-${C??null}`))==null?void 0:k.values())??[])},l=C=>{if(C)return t.value.get(C)},c=C=>{if(C)return n.value.get(C)},d=(C,b,S)=>{var k,B;const Q=[];for(const te of C){const ae={id:te.id,type:"position",dragging:S,from:te.from};if(b&&(ae.position=te.position,te.parentNode)){const he=l(te.parentNode);ae.position={x:ae.position.x-(((k=he==null?void 0:he.computedPosition)==null?void 0:k.x)??0),y:ae.position.y-(((B=he==null?void 0:he.computedPosition)==null?void 0:B.y)??0)}}Q.push(ae)}Q!=null&&Q.length&&e.hooks.nodesChange.trigger(Q)},f=C=>{if(!e.vueFlowRef)return;const b=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!b)return;const S=window.getComputedStyle(b),{m22:k}=new window.DOMMatrixReadOnly(S.transform),B=[];for(let Q=0;Q<C.length;++Q){const te=C[Q],ae=l(te.id);if(ae){const he=Fn(te.nodeElement);if(!!(he.width&&he.height&&(ae.dimensions.width!==he.width||ae.dimensions.height!==he.height||te.forceUpdate))){const be=te.nodeElement.getBoundingClientRect();ae.dimensions=he,ae.handleBounds.source=yi(".source",te.nodeElement,be,k),ae.handleBounds.target=yi(".target",te.nodeElement,be,k),B.push({id:ae.id,type:"dimensions",dimensions:he})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&o.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),B.length&&e.hooks.nodesChange.trigger(B)},_=(C,b)=>{const S=new Set,k=new Set;for(const te of C)_t(te)?S.add(te.id):ht(te)&&k.add(te.id);const B=ft(t.value,S,!0),Q=ft(n.value,k);if(e.multiSelectionActive){for(const te of S)B.push(ct(te,b));for(const te of k)Q.push(ct(te,b))}B.length&&e.hooks.nodesChange.trigger(B),Q.length&&e.hooks.edgesChange.trigger(Q)},m=C=>{if(e.multiSelectionActive){const b=C.map(S=>ct(S.id,!0));e.hooks.nodesChange.trigger(b);return}e.hooks.nodesChange.trigger(ft(t.value,new Set(C.map(b=>b.id)),!0)),e.hooks.edgesChange.trigger(ft(n.value))},v=C=>{if(e.multiSelectionActive){const b=C.map(S=>ct(S.id,!0));e.hooks.edgesChange.trigger(b);return}e.hooks.edgesChange.trigger(ft(n.value,new Set(C.map(b=>b.id)))),e.hooks.nodesChange.trigger(ft(t.value,new Set,!0))},p=C=>{_(C,!0)},y=C=>{const S=(C||e.nodes).map(k=>(k.selected=!1,ct(k.id,!1)));e.hooks.nodesChange.trigger(S)},g=C=>{const S=(C||e.edges).map(k=>(k.selected=!1,ct(k.id,!1)));e.hooks.edgesChange.trigger(S)},h=C=>{if(!C||!C.length)return _([],!1);const b=C.reduce((S,k)=>{const B=ct(k.id,!1);return _t(k)?S.nodes.push(B):S.edges.push(B),S},{nodes:[],edges:[]});b.nodes.length&&e.hooks.nodesChange.trigger(b.nodes),b.edges.length&&e.hooks.edgesChange.trigger(b.edges)},w=C=>{var b;(b=e.d3Zoom)==null||b.scaleExtent([C,e.maxZoom]),e.minZoom=C},A=C=>{var b;(b=e.d3Zoom)==null||b.scaleExtent([e.minZoom,C]),e.maxZoom=C},R=C=>{var b;(b=e.d3Zoom)==null||b.translateExtent(C),e.translateExtent=C},V=C=>{e.nodeExtent=C,i()},W=C=>{var b;(b=e.d3Zoom)==null||b.clickDistance(C)},j=C=>{e.nodesDraggable=C,e.nodesConnectable=C,e.elementsSelectable=C},Y=C=>{const b=C instanceof Function?C(e.nodes):C;!e.initialized&&!b.length||(e.nodes=_i(b,l,e.hooks.error.trigger))},U=C=>{const b=C instanceof Function?C(e.edges):C;if(!e.initialized&&!b.length)return;const S=xi(b,e.isValidConnection,l,c,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);wi(e.connectionLookup,S),e.edges=S},D=C=>{const b=C instanceof Function?C([...e.nodes,...e.edges]):C;!e.initialized&&!b.length||(Y(b.filter(_t)),U(b.filter(ht)))},ie=C=>{let b=C instanceof Function?C(e.nodes):C;b=Array.isArray(b)?b:[b];const S=_i(b,l,e.hooks.error.trigger),k=[];for(const B of S)k.push(ci(B));k.length&&e.hooks.nodesChange.trigger(k)},N=C=>{let b=C instanceof Function?C(e.edges):C;b=Array.isArray(b)?b:[b];const S=xi(b,e.isValidConnection,l,c,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),k=[];for(const B of S)k.push(ci(B));k.length&&e.hooks.edgesChange.trigger(k)},O=(C,b=!0,S=!1)=>{const k=C instanceof Function?C(e.nodes):C,B=Array.isArray(k)?k:[k],Q=[],te=[];function ae(we){const be=s(we);for(const Ee of be)(!$e(Ee.deletable)||Ee.deletable)&&te.push(fi(Ee.id,Ee.source,Ee.target,Ee.sourceHandle,Ee.targetHandle))}function he(we){const be=[];for(const Ee of e.nodes)Ee.parentNode===we&&be.push(Ee);if(be.length){for(const Ee of be)Q.push(di(Ee.id));b&&ae(be);for(const Ee of be)he(Ee.id)}}for(const we of B){const be=typeof we=="string"?l(we):we;be&&($e(be.deletable)&&!be.deletable||(Q.push(di(be.id)),b&&ae([be]),S&&he(be.id)))}te.length&&e.hooks.edgesChange.trigger(te),Q.length&&e.hooks.nodesChange.trigger(Q)},E=C=>{const b=C instanceof Function?C(e.edges):C,S=Array.isArray(b)?b:[b],k=[];for(const B of S){const Q=typeof B=="string"?c(B):B;Q&&($e(Q.deletable)&&!Q.deletable||k.push(fi(typeof B=="string"?B:B.id,Q.source,Q.target,Q.sourceHandle,Q.targetHandle)))}e.hooks.edgesChange.trigger(k)},$=(C,b,S=!0)=>rd(C,b,e.edges,c,S,e.hooks.error.trigger),F=(C,b,S={replace:!1})=>{const k=c(C);if(!k)return;const B=typeof b=="function"?b(k):b;k.data=S.replace?B:{...k.data,...B}},H=C=>ui(C,e.nodes),X=C=>{const b=ui(C,e.edges);return wi(e.connectionLookup,b),b},T=(C,b,S={replace:!1})=>{const k=l(C);if(!k)return;const B=typeof b=="function"?b(k):b;S.replace?e.nodes.splice(e.nodes.indexOf(k),1,B):Object.assign(k,B)},z=(C,b,S={replace:!1})=>{const k=l(C);if(!k)return;const B=typeof b=="function"?b(k):b;k.data=S.replace?B:{...k.data,...B}},M=(C,b,S=!1)=>{S?e.connectionClickStartHandle=C:e.connectionStartHandle=C,e.connectionEndHandle=null,e.connectionStatus=null,b&&(e.connectionPosition=b)},P=(C,b=null,S=null)=>{e.connectionStartHandle&&(e.connectionPosition=C,e.connectionEndHandle=b,e.connectionStatus=S)},ne=(C,b)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,b?e.connectionClickStartHandle=null:e.connectionStartHandle=null},ve=C=>{const b=Fc(C),S=b?null:Ut(C)?C:l(C.id);return!b&&!S?[null,null,b]:[b?C:wo(S),S,b]},fe=(C,b=!0,S=e.nodes)=>{const[k,B,Q]=ve(C);if(!k)return[];const te=[];for(const ae of S||e.nodes){if(!Q&&(ae.id===B.id||!ae.computedPosition))continue;const he=wo(ae),we=xo(he,k);(b&&we>0||we>=Number(k.width)*Number(k.height))&&te.push(ae)}return te},me=(C,b,S=!0)=>{const[k]=ve(C);if(!k)return!1;const B=xo(k,b);return S&&B>0||B>=Number(k.width)*Number(k.height)},le=C=>{const{viewport:b,dimensions:S,d3Zoom:k,d3Selection:B,translateExtent:Q}=e;if(!k||!B||!C.x&&!C.y)return!1;const te=zt.translate(b.x+C.x,b.y+C.y).scale(b.zoom),ae=[[0,0],[S.width,S.height]],he=k.constrain()(te,ae,Q),we=e.viewport.x!==he.x||e.viewport.y!==he.y||e.viewport.zoom!==he.k;return k.transform(B,he),we},de=C=>{const b=C instanceof Function?C(e):C,S=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];$e(b.defaultEdgeOptions)&&(e.defaultEdgeOptions=b.defaultEdgeOptions);const k=b.modelValue||b.nodes||b.edges?[]:void 0;k&&(b.modelValue&&k.push(...b.modelValue),b.nodes&&k.push(...b.nodes),b.edges&&k.push(...b.edges),D(k));const B=()=>{$e(b.maxZoom)&&A(b.maxZoom),$e(b.minZoom)&&w(b.minZoom),$e(b.translateExtent)&&R(b.translateExtent)};for(const Q of Object.keys(b)){const te=Q,ae=b[te];![..._d,...S].includes(te)&&$e(ae)&&(e[te]=ae)}lo(()=>e.d3Zoom).not.toBeNull().then(B),e.initialized||(e.initialized=!0)};return{updateNodePositions:d,updateNodeDimensions:f,setElements:D,setNodes:Y,setEdges:U,addNodes:ie,addEdges:N,removeNodes:O,removeEdges:E,findNode:l,findEdge:c,updateEdge:$,updateEdgeData:F,updateNode:T,updateNodeData:z,applyEdgeChanges:X,applyNodeChanges:H,addSelectedElements:p,addSelectedNodes:m,addSelectedEdges:v,setMinZoom:w,setMaxZoom:A,setTranslateExtent:R,setNodeExtent:V,setPaneClickDistance:W,removeSelectedElements:h,removeSelectedNodes:y,removeSelectedEdges:g,startConnection:M,updateConnection:P,endConnection:ne,setInteractive:j,setState:de,getIntersectingNodes:fe,getIncomers:r,getOutgoers:a,getConnectedEdges:s,getHandleConnections:u,isNodeIntersecting:me,panBy:le,fitView:C=>o.value.fitView(C),zoomIn:C=>o.value.zoomIn(C),zoomOut:C=>o.value.zoomOut(C),zoomTo:(C,b)=>o.value.zoomTo(C,b),setViewport:(C,b)=>o.value.setViewport(C,b),setTransform:(C,b)=>o.value.setTransform(C,b),getViewport:()=>o.value.getViewport(),getTransform:()=>o.value.getTransform(),setCenter:(C,b,S)=>o.value.setCenter(C,b,S),fitBounds:(C,b)=>o.value.fitBounds(C,b),project:C=>o.value.project(C),screenToFlowCoordinate:C=>o.value.screenToFlowCoordinate(C),flowToScreenCoordinate:C=>o.value.flowToScreenCoordinate(C),toObject:()=>{const C=[],b=[];for(const S of e.nodes){const{computedPosition:k,handleBounds:B,selected:Q,dimensions:te,isParent:ae,resizing:he,dragging:we,events:be,...Ee}=S;C.push(Ee)}for(const S of e.edges){const{selected:k,sourceNode:B,targetNode:Q,events:te,...ae}=S;b.push(ae)}return JSON.parse(JSON.stringify({nodes:C,edges:b,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:C=>new Promise(b=>{const{nodes:S,edges:k,position:B,zoom:Q,viewport:te}=C;if(S&&Y(S),k&&U(k),te!=null&&te.x&&(te!=null&&te.y)||B){const ae=(te==null?void 0:te.x)||B[0],he=(te==null?void 0:te.y)||B[1],we=(te==null?void 0:te.zoom)||Q||e.viewport.zoom;return lo(()=>o.value.viewportInitialized).toBe(!0).then(()=>{o.value.setViewport({x:ae,y:he,zoom:we}).then(()=>{b(!0)})})}else b(!0)}),updateNodeInternals:i,viewportHelper:o,$reset:()=>{const C=Vr();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const b=zt.translate(C.defaultViewport.x??0,C.defaultViewport.y??0).scale(St(C.defaultViewport.zoom??1,C.minZoom,C.maxZoom)),S=e.viewportRef.getBoundingClientRect(),k=[[0,0],[S.width,S.height]],B=e.d3Zoom.constrain()(b,k,C.translateExtent);e.d3Zoom.transform(e.d3Selection,B)}de(C)},$destroy:()=>{}}}const xd=["data-id","data-handleid","data-nodeid","data-handlepos"],bd={name:"Handle",compatConfig:{MODE:3}},Ie=se({...bd,props:{id:{default:null},type:{},position:{default:()=>q.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=Ii(e,["position","connectable","connectableStart","connectableEnd","id"]),o=Ce(()=>n.type??"source"),i=Ce(()=>n.isValidConnection??null),{connectionStartHandle:r,connectionClickStartHandle:a,connectionEndHandle:s,vueFlowRef:u,nodesConnectable:l,noDragClassName:c,noPanClassName:d}=Ne(),{id:f,node:_,nodeEl:m,connectedEdges:v}=Fr(),p=K(),y=Ce(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),g=Ce(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),h=Ce(()=>{var Y,U,D,ie,N,O;return((Y=r.value)==null?void 0:Y.nodeId)===f&&((U=r.value)==null?void 0:U.handleId)===e.id&&((D=r.value)==null?void 0:D.type)===o.value||((ie=s.value)==null?void 0:ie.nodeId)===f&&((N=s.value)==null?void 0:N.handleId)===e.id&&((O=s.value)==null?void 0:O.type)===o.value}),w=Ce(()=>{var Y,U,D;return((Y=a.value)==null?void 0:Y.nodeId)===f&&((U=a.value)==null?void 0:U.handleId)===e.id&&((D=a.value)==null?void 0:D.type)===o.value}),{handlePointerDown:A,handleClick:R}=Br({nodeId:f,handleId:e.id,isValidConnection:i,type:o}),V=ue(()=>typeof e.connectable=="string"&&e.connectable==="single"?!v.value.some(Y=>{const U=Y[`${o.value}Handle`];return Y[o.value]!==f?!1:U?U===e.id:!0}):typeof e.connectable=="number"?v.value.filter(Y=>{const U=Y[`${o.value}Handle`];return Y[o.value]!==f?!1:U?U===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(_,v.value):$e(e.connectable)?e.connectable:l.value);Xe(()=>{var Y;if(!_.dimensions.width||!_.dimensions.height)return;const U=(Y=_.handleBounds[o.value])==null?void 0:Y.find(F=>F.id===e.id);if(!u.value||U)return;const D=u.value.querySelector(".vue-flow__transformationpane");if(!m.value||!p.value||!D||!e.id)return;const ie=m.value.getBoundingClientRect(),N=p.value.getBoundingClientRect(),O=window.getComputedStyle(D),{m22:E}=new window.DOMMatrixReadOnly(O.transform),$={id:e.id,position:e.position,x:(N.left-ie.left)/E,y:(N.top-ie.top)/E,...Fn(p.value)};_.handleBounds[o.value]=[..._.handleBounds[o.value]??[],$]}),Pi(()=>{const Y=_.handleBounds[o.value];Y&&(_.handleBounds[o.value]=Y.filter(U=>U.id!==e.id))});function W(Y){const U=zo(Y);V.value&&y.value&&(U&&Y.button===0||!U)&&A(Y)}function j(Y){!f||!a.value&&!y.value||V.value&&R(Y)}return t({handleClick:R,handlePointerDown:A,onClick:j,onPointerDown:W}),(Y,U)=>(Z(),re("div",{ref_key:"handle",ref:p,"data-id":`${x(f)}-${e.id}-${o.value}`,"data-handleid":e.id,"data-nodeid":x(f),"data-handlepos":Y.position,class:It(["vue-flow__handle",[`vue-flow__handle-${Y.position}`,`vue-flow__handle-${e.id}`,x(c),x(d),o.value,{connectable:V.value,connecting:w.value,connectablestart:y.value,connectableend:g.value,connectionindicator:V.value&&(y.value&&!h.value||g.value&&h.value)}]]),onMousedown:W,onTouchstartPassive:W,onClick:j},[qe(Y.$slots,"default",{id:Y.id})],42,xd))}}),Yn=function({sourcePosition:e=q.Bottom,targetPosition:t=q.Top,label:n,connectable:o=!0,isValidTargetPos:i,isValidSourcePos:r,data:a}){const s=a.label||n;return[xe(Ie,{type:"target",position:t,connectable:o,isValidConnection:i}),typeof s!="string"&&s?xe(s):xe(Ve,[s]),xe(Ie,{type:"source",position:e,connectable:o,isValidConnection:r})]};Yn.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"];Yn.inheritAttrs=!1;Yn.compatConfig={MODE:3};const Sd=Yn,Gn=function({targetPosition:e=q.Top,label:t,connectable:n=!0,isValidTargetPos:o,data:i}){const r=i.label||t;return[xe(Ie,{type:"target",position:e,connectable:n,isValidConnection:o}),typeof r!="string"&&r?xe(r):xe(Ve,[r])]};Gn.props=["targetPosition","label","isValidTargetPos","connectable","data"];Gn.inheritAttrs=!1;Gn.compatConfig={MODE:3};const Ed=Gn,Un=function({sourcePosition:e=q.Bottom,label:t,connectable:n=!0,isValidSourcePos:o,data:i}){const r=i.label||t;return[typeof r!="string"&&r?xe(r):xe(Ve,[r]),xe(Ie,{type:"source",position:e,connectable:n,isValidConnection:o})]};Un.props=["sourcePosition","label","isValidSourcePos","connectable","data"];Un.inheritAttrs=!1;Un.compatConfig={MODE:3};const Cd=Un,Nd=["transform"],kd=["width","height","x","y","rx","ry"],$d=["y"],Id={name:"EdgeText",compatConfig:{MODE:3}},Pd=se({...Id,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const t=K({x:0,y:0,width:0,height:0}),n=K(null),o=ue(()=>`translate(${e.x-t.value.width/2} ${e.y-t.value.height/2})`);Xe(i),_e([()=>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,a)=>(Z(),re("g",{transform:o.value,class:"vue-flow__edge-textwrapper"},[r.labelShowBg?(Z(),re("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:Qe(r.labelBgStyle),rx:r.labelBgBorderRadius,ry:r.labelBgBorderRadius},null,12,kd)):Te("",!0),L("text",la(r.$attrs,{ref_key:"el",ref:n,class:"vue-flow__edge-text",y:t.value.height/2,dy:"0.3em",style:r.labelStyle}),[qe(r.$slots,"default",{},()=>[typeof r.label!="string"?(Z(),ge(sa(r.label),{key:0})):(Z(),re(Ve,{key:1},[pe(ke(r.label),1)],64))])],16,$d)],8,Nd))}}),Md=["id","d","marker-end","marker-start"],Td=["d","stroke-width"],Dd={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},Xn=se({...Dd,props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},style:{},labelStyle:{},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:t}){const n=Ii(e,["interactionWidth","labelShowBg"]),o=K(null),i=K(null),r=K(null),a=aa();return t({pathEl:o,interactionEl:i,labelEl:r}),(s,u)=>(Z(),re(Ve,null,[L("path",{id:s.id,ref_key:"pathEl",ref:o,d:s.path,style:Qe(n.style),class:It(["vue-flow__edge-path",x(a).class]),"marker-end":s.markerEnd,"marker-start":s.markerStart},null,14,Md),s.interactionWidth?(Z(),re("path",{key:0,ref_key:"interactionEl",ref:i,fill:"none",d:s.path,"stroke-width":s.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,Td)):Te("",!0),s.label&&s.labelX&&s.labelY?(Z(),ge(Pd,{key:1,ref_key:"labelEl",ref:r,x:s.labelX,y:s.labelY,label:s.label,"label-show-bg":s.labelShowBg,"label-bg-style":s.labelBgStyle,"label-bg-padding":s.labelBgPadding,"label-bg-border-radius":s.labelBgBorderRadius,"label-style":s.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):Te("",!0)],64))}});function Hr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const i=Math.abs(n-e)/2,r=n<e?n+i:n-i,a=Math.abs(o-t)/2,s=o<t?o+a:o-a;return[r,s,i,a]}function Yr({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:i,sourceControlY:r,targetControlX:a,targetControlY:s}){const u=e*.125+i*.375+a*.375+n*.125,l=t*.125+r*.375+s*.375+o*.125,c=Math.abs(u-e),d=Math.abs(l-t);return[u,l,c,d]}function hn(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 a,s;switch(e){case q.Left:a=t-hn(t-o,r),s=n;break;case q.Right:a=t+hn(o-t,r),s=n;break;case q.Top:a=t,s=n-hn(n-i,r);break;case q.Bottom:a=t,s=n+hn(i-n,r);break}return[a,s]}function Gr(e){const{sourceX:t,sourceY:n,sourcePosition:o=q.Bottom,targetX:i,targetY:r,targetPosition:a=q.Top,curvature:s=.25}=e,[u,l]=Si({pos:o,x1:t,y1:n,x2:i,y2:r,c:s}),[c,d]=Si({pos:a,x1:i,y1:r,x2:t,y2:n,c:s}),[f,_,m,v]=Yr({sourceX:t,sourceY:n,targetX:i,targetY:r,sourceControlX:u,sourceControlY:l,targetControlX:c,targetControlY:d});return[`M${t},${n} C${u},${l} ${c},${d} ${i},${r}`,f,_,m,v]}function Ei({pos:e,x1:t,y1:n,x2:o,y2:i}){let r,a;switch(e){case q.Left:case q.Right:r=.5*(t+o),a=n;break;case q.Top:case q.Bottom:r=t,a=.5*(n+i);break}return[r,a]}function Ur(e){const{sourceX:t,sourceY:n,sourcePosition:o=q.Bottom,targetX:i,targetY:r,targetPosition:a=q.Top}=e,[s,u]=Ei({pos:o,x1:t,y1:n,x2:i,y2:r}),[l,c]=Ei({pos:a,x1:i,y1:r,x2:t,y2:n}),[d,f,_,m]=Yr({sourceX:t,sourceY:n,targetX:i,targetY:r,sourceControlX:s,sourceControlY:u,targetControlX:l,targetControlY:c});return[`M${t},${n} C${s},${u} ${l},${c} ${i},${r}`,d,f,_,m]}const Ci={[q.Left]:{x:-1,y:0},[q.Right]:{x:1,y:0},[q.Top]:{x:0,y:-1},[q.Bottom]:{x:0,y:1}};function Ad({source:e,sourcePosition:t=q.Bottom,target:n}){return t===q.Left||t===q.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 Ni(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function zd({source:e,sourcePosition:t=q.Bottom,target:n,targetPosition:o=q.Top,center:i,offset:r}){const a=Ci[t],s=Ci[o],u={x:e.x+a.x*r,y:e.y+a.y*r},l={x:n.x+s.x*r,y:n.y+s.y*r},c=Ad({source:u,sourcePosition:t,target:l}),d=c.x!==0?"x":"y",f=c[d];let _,m,v;const p={x:0,y:0},y={x:0,y:0},[g,h,w,A]=Hr({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[d]*s[d]===-1){m=i.x??g,v=i.y??h;const V=[{x:m,y:u.y},{x:m,y:l.y}],W=[{x:u.x,y:v},{x:l.x,y:v}];a[d]===f?_=d==="x"?V:W:_=d==="x"?W:V}else{const V=[{x:u.x,y:l.y}],W=[{x:l.x,y:u.y}];if(d==="x"?_=a.x===f?W:V:_=a.y===f?V:W,t===o){const ie=Math.abs(e[d]-n[d]);if(ie<=r){const N=Math.min(r-1,r-ie);a[d]===f?p[d]=(u[d]>e[d]?-1:1)*N:y[d]=(l[d]>n[d]?-1:1)*N}}if(t!==o){const ie=d==="x"?"y":"x",N=a[d]===s[ie],O=u[ie]>l[ie],E=u[ie]<l[ie];(a[d]===1&&(!N&&O||N&&E)||a[d]!==1&&(!N&&E||N&&O))&&(_=d==="x"?V:W)}const j={x:u.x+p.x,y:u.y+p.y},Y={x:l.x+y.x,y:l.y+y.y},U=Math.max(Math.abs(j.x-_[0].x),Math.abs(Y.x-_[0].x)),D=Math.max(Math.abs(j.y-_[0].y),Math.abs(Y.y-_[0].y));U>=D?(m=(j.x+Y.x)/2,v=_[0].y):(m=_[0].x,v=(j.y+Y.y)/2)}return[[e,{x:u.x+p.x,y:u.y+p.y},..._,{x:l.x+y.x,y:l.y+y.y},n],m,v,w,A]}function Od(e,t,n,o){const i=Math.min(Ni(e,t)/2,Ni(t,n)/2,o),{x:r,y:a}=t;if(e.x===r&&r===n.x||e.y===a&&a===n.y)return`L${r} ${a}`;if(e.y===a){const l=e.x<n.x?-1:1,c=e.y<n.y?1:-1;return`L ${r+i*l},${a}Q ${r},${a} ${r},${a+i*c}`}const s=e.x<n.x?1:-1,u=e.y<n.y?-1:1;return`L ${r},${a+i*u}Q ${r},${a} ${r+i*s},${a}`}function So(e){const{sourceX:t,sourceY:n,sourcePosition:o=q.Bottom,targetX:i,targetY:r,targetPosition:a=q.Top,borderRadius:s=5,centerX:u,centerY:l,offset:c=20}=e,[d,f,_,m,v]=zd({source:{x:t,y:n},sourcePosition:o,target:{x:i,y:r},targetPosition:a,center:{x:u,y:l},offset:c});return[d.reduce((y,g,h)=>{let w;return h>0&&h<d.length-1?w=Od(d[h-1],g,d[h+1],s):w=`${h===0?"M":"L"}${g.x} ${g.y}`,y+=w,y},""),f,_,m,v]}function Rd(e){const{sourceX:t,sourceY:n,targetX:o,targetY:i}=e,[r,a,s,u]=Hr({sourceX:t,sourceY:n,targetX:o,targetY:i});return[`M ${t},${n}L ${o},${i}`,r,a,s,u]}const Bd=se({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]=Rd(e);return xe(Xn,{path:n,labelX:o,labelY:i,...t,...e})}}}),Fd=Bd,Ld=se({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]=So({...e,sourcePosition:e.sourcePosition??q.Bottom,targetPosition:e.targetPosition??q.Top});return xe(Xn,{path:n,labelX:o,labelY:i,...t,...e})}}}),Xr=Ld,Vd=se({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:t}){return()=>xe(Xr,{...e,...t,borderRadius:0})}}),Hd=Vd,Yd=se({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]=Gr({...e,sourcePosition:e.sourcePosition??q.Bottom,targetPosition:e.targetPosition??q.Top});return xe(Xn,{path:n,labelX:o,labelY:i,...t,...e})}}}),Gd=Yd,Ud=se({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]=Ur({...e,sourcePosition:e.sourcePosition??q.Bottom,targetPosition:e.targetPosition??q.Top});return xe(Xn,{path:n,labelX:o,labelY:i,...t,...e})}}}),Xd=Ud,Wd={input:Cd,default:Sd,output:Ed},Kd={default:Gd,straight:Fd,step:Hd,smoothstep:Xr,simplebezier:Xd};function Zd(e,t,n){const o=ue(()=>v=>t.value.get(v)),i=ue(()=>v=>n.value.get(v)),r=ue(()=>{const v={...Kd,...e.edgeTypes},p=Object.keys(v);for(const y of e.edges)y.type&&!p.includes(y.type)&&(v[y.type]=y.type);return v}),a=ue(()=>{const v={...Wd,...e.nodeTypes},p=Object.keys(v);for(const y of e.nodes)y.type&&!p.includes(y.type)&&(v[y.type]=y.type);return v}),s=ue(()=>e.onlyRenderVisibleElements?kr(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),u=ue(()=>{if(e.onlyRenderVisibleElements){const v=[];for(const p of e.edges){const y=t.value.get(p.source),g=t.value.get(p.target);jc({sourcePos:y.computedPosition||{x:0,y:0},targetPos:g.computedPosition||{x:0,y:0},sourceWidth:y.dimensions.width,sourceHeight:y.dimensions.height,targetWidth:g.dimensions.width,targetHeight:g.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&v.push(p)}return v}return e.edges}),l=ue(()=>[...s.value,...u.value]),c=ue(()=>{const v=[];for(const p of e.nodes)p.selected&&v.push(p);return v}),d=ue(()=>{const v=[];for(const p of e.edges)p.selected&&v.push(p);return v}),f=ue(()=>[...c.value,...d.value]),_=ue(()=>{const v=[];for(const p of e.nodes)p.dimensions.width&&p.dimensions.height&&p.handleBounds!==void 0&&v.push(p);return v}),m=ue(()=>s.value.length>0&&_.value.length===s.value.length);return{getNode:o,getEdge:i,getElements:l,getEdgeTypes:r,getNodeTypes:a,getEdges:u,getNodes:s,getSelectedElements:f,getSelectedNodes:c,getSelectedEdges:d,getNodesInitialized:_,areNodesInitialized:m}}class gt{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var t;const n=(t=nn())==null?void 0:t.appContext.app,o=(n==null?void 0:n.config.globalProperties.$vueFlowStorage)??gt.instance;return gt.instance=o??new gt,n&&(n.config.globalProperties.$vueFlowStorage=gt.instance),gt.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=Vr(),i=ta(o),r={};for(const[f,_]of Object.entries(i.hooks)){const m=`on${f.charAt(0).toUpperCase()+f.slice(1)}`;r[m]=_.on}const a={};for(const[f,_]of Object.entries(i.hooks))a[f]=_.trigger;const s=ue(()=>{const f=new Map;for(const _ of i.nodes)f.set(_.id,_);return f}),u=ue(()=>{const f=new Map;for(const _ of i.edges)f.set(_.id,_);return f}),l=Zd(i,s,u),c=wd(i,s,u);c.setState({...i,...n});const d={...r,...l,...c,...Qa(i),nodeLookup:s,edgeLookup:u,emits:a,id:t,vueFlowVersion:"1.41.5",$destroy:()=>{this.remove(t)}};return this.set(t,d),d}getId(){return`vue-flow-${this.currentId++}`}}function Ne(e){const t=gt.getInstance(),n=Ti(),o=typeof e=="object",i=o?e:{id:e},r=i.id,a=r??(n==null?void 0:n.vueFlowId);let s;if(n){const u=Ot(bi,null);typeof u<"u"&&u!==null&&(!a||u.id===a)&&(s=u)}if(s||a&&(s=t.get(a)),!s||a&&s.id!==a){const u=r??t.getId(),l=t.create(u,i);s=l,(n??Mi(!0)).run(()=>{_e(l.applyDefault,(d,f,_)=>{const m=p=>{l.applyNodeChanges(p)},v=p=>{l.applyEdgeChanges(p)};d?(l.onNodesChange(m),l.onEdgesChange(v)):(l.hooks.value.nodesChange.off(m),l.hooks.value.edgesChange.off(v)),_(()=>{l.hooks.value.nodesChange.off(m),l.hooks.value.edgesChange.off(v)})},{immediate:!0}),An(()=>{if(s){const d=t.get(s.id);d?d.$destroy():Vn(`No store instance found for id ${s.id} in storage.`)}})})}else o&&s.setState(i);if(n&&(Pt(bi,s),n.vueFlowId=s.id),o){const u=nn();(u==null?void 0:u.type.name)!=="VueFlow"&&s.emits.error(new Me(Pe.USEVUEFLOW_OPTIONS))}return s}function qd(e){const{emits:t,dimensions:n}=Ne();let o;Xe(()=>{const i=e.value,r=()=>{if(!i)return;const a=Fn(i);(a.width===0||a.height===0)&&t.error(new Me(Pe.MISSING_VIEWPORT_DIMENSIONS)),n.value={width:a.width||500,height:a.height||500}};r(),window.addEventListener("resize",r),i&&(o=new ResizeObserver(()=>r()),o.observe(i)),Mn(()=>{window.removeEventListener("resize",r),o&&i&&o.unobserve(i)})})}const jd={name:"UserSelection",compatConfig:{MODE:3}},Jd=se({...jd,props:{userSelectionRect:{}},setup(e){return(t,n)=>(Z(),re("div",{class:"vue-flow__selection vue-flow__container",style:Qe({width:`${t.userSelectionRect.width}px`,height:`${t.userSelectionRect.height}px`,transform:`translate(${t.userSelectionRect.x}px, ${t.userSelectionRect.y}px)`})},null,4))}}),Qd=["tabIndex"],ef={name:"NodesSelection",compatConfig:{MODE:3}},tf=se({...ef,setup(e){const{emits:t,viewport:n,getSelectedNodes:o,noPanClassName:i,disableKeyboardA11y:r,userSelectionActive:a}=Ne(),s=Lr(),u=K(null),l=Rr({el:u,onStart(m){t.selectionDragStart(m)},onDrag(m){t.selectionDrag(m)},onStop(m){t.selectionDragStop(m)}});Xe(()=>{var m;r.value||(m=u.value)==null||m.focus({preventScroll:!0})});const c=ue(()=>Nr(o.value)),d=ue(()=>({width:`${c.value.width}px`,height:`${c.value.height}px`,top:`${c.value.y}px`,left:`${c.value.x}px`}));function f(m){t.selectionContextMenu({event:m,nodes:o.value})}function _(m){r||$t[m.key]&&s({x:$t[m.key].x,y:$t[m.key].y},m.shiftKey)}return(m,v)=>!x(a)&&c.value.width&&c.value.height?(Z(),re("div",{key:0,class:It(["vue-flow__nodesselection vue-flow__container",x(i)]),style:Qe({transform:`translate(${x(n).x}px,${x(n).y}px) scale(${x(n).zoom})`})},[L("div",{ref_key:"el",ref:u,class:It([{dragging:x(l)},"vue-flow__nodesselection-rect"]),style:Qe(d.value),tabIndex:x(r)?void 0:-1,onContextmenu:f,onKeydown:_},null,46,Qd)],6)):Te("",!0)}});function nf(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const of={name:"Pane",compatConfig:{MODE:3}},rf=se({...of,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:t,nodes:n,viewport:o,emits:i,userSelectionActive:r,removeSelectedElements:a,panOnDrag:s,userSelectionRect:u,elementsSelectable:l,nodesSelectionActive:c,getSelectedEdges:d,getSelectedNodes:f,removeNodes:_,removeEdges:m,selectionMode:v,deleteKeyCode:p,multiSelectionKeyCode:y,multiSelectionActive:g,edgeLookup:h,nodeLookup:w}=Ne(),A=K(null),R=K(0),V=K(0),W=K(),j=K(new Map),Y=Ce(()=>l.value&&(e.isSelecting||r.value));let U=!1,D=!1;const ie=Kt(p,{actInsideInputWithModifier:!1}),N=Kt(y);_e(ie,M=>{M&&(_(f.value),m(d.value),c.value=!1)}),_e(N,M=>{g.value=M});function O(M,P){return ne=>{ne.target===P&&(M==null||M(ne))}}function E(){r.value=!1,u.value=null,R.value=0,V.value=0}function $(M){if(U){U=!1;return}i.paneClick(M),a(),c.value=!1}function F(M){var P;if(Array.isArray(s.value)&&((P=s.value)!=null&&P.includes(2))){M.preventDefault();return}i.paneContextMenu(M)}function H(M){i.paneScroll(M)}function X(M){var P,ne,ve,fe,me;if(W.value=(P=t.value)==null?void 0:P.getBoundingClientRect(),!l.value||!e.isSelecting||M.button!==0||M.target!==A.value||!W.value)return;(ve=(ne=M.target)==null?void 0:ne.setPointerCapture)==null||ve.call(ne,M.pointerId);const{x:le,y:de}=nf(M,W.value);D=!0,U=!1,j.value=new Map;for(const[ee,oe]of h.value)j.value.set(oe.source,((fe=j.value.get(oe.source))==null?void 0:fe.add(ee))||new Set([ee])),j.value.set(oe.target,((me=j.value.get(oe.target))==null?void 0:me.add(ee))||new Set([ee]));a(),u.value={width:0,height:0,startX:le,startY:de,x:le,y:de},i.selectionStart(M)}function T(M){if(!W.value||!u.value)return;U=!0;const{x:P,y:ne}=at(M,W.value),{startX:ve=0,startY:fe=0}=u.value,me={startX:ve,startY:fe,x:P<ve?P:ve,y:ne<fe?ne:fe,width:Math.abs(P-ve),height:Math.abs(ne-fe)},le=kr(n.value,me,o.value,v.value===Do.Partial,!0),de=new Set,ee=new Set;for(const oe of le){ee.add(oe.id);const ce=j.value.get(oe.id);if(ce)for(const C of ce)de.add(C)}if(R.value!==ee.size){R.value=ee.size;const oe=ft(w.value,ee,!0);i.nodesChange(oe)}if(V.value!==de.size){V.value=de.size;const oe=ft(h.value,de);i.edgesChange(oe)}u.value=me,r.value=!0,c.value=!1}function z(M){var P;M.button!==0||!D||((P=M.target)==null||P.releasePointerCapture(M.pointerId),!r.value&&u.value&&M.target===A.value&&$(M),R.value>0&&(c.value=!0),E(),i.selectionEnd(M),e.selectionKeyPressed&&(U=!1),D=!1)}return(M,P)=>(Z(),re("div",{ref_key:"container",ref:A,class:It(["vue-flow__pane vue-flow__container",{selection:M.isSelecting}]),onClick:P[0]||(P[0]=ne=>Y.value?void 0:O($,A.value)(ne)),onContextmenu:P[1]||(P[1]=ne=>O(F,A.value)(ne)),onWheelPassive:P[2]||(P[2]=ne=>O(H,A.value)(ne)),onPointerenter:P[3]||(P[3]=ne=>Y.value?void 0:x(i).paneMouseEnter(ne)),onPointerdown:P[4]||(P[4]=ne=>Y.value?X(ne):x(i).paneMouseMove(ne)),onPointermove:P[5]||(P[5]=ne=>Y.value?T(ne):x(i).paneMouseMove(ne)),onPointerup:P[6]||(P[6]=ne=>Y.value?z(ne):void 0),onPointerleave:P[7]||(P[7]=ne=>x(i).paneMouseLeave(ne))},[qe(M.$slots,"default"),x(r)&&x(u)?(Z(),ge(Jd,{key:0,"user-selection-rect":x(u)},null,8,["user-selection-rect"])):Te("",!0),x(c)&&x(f).length?(Z(),ge(tf,{key:1})):Te("",!0)],34))}}),af={name:"Transform",compatConfig:{MODE:3}},sf=se({...af,setup(e){const{viewport:t,fitViewOnInit:n,fitViewOnInitDone:o}=Ne(),i=ue(()=>n.value?!o.value:!1),r=ue(()=>`translate(${t.value.x}px,${t.value.y}px) scale(${t.value.zoom})`);return(a,s)=>(Z(),re("div",{class:"vue-flow__transformationpane vue-flow__container",style:Qe({transform:r.value,opacity:i.value?0:void 0})},[qe(a.$slots,"default")],4))}}),lf={name:"Viewport",compatConfig:{MODE:3}},uf=se({...lf,setup(e){const{minZoom:t,maxZoom:n,defaultViewport:o,translateExtent:i,zoomActivationKeyCode:r,selectionKeyCode:a,panActivationKeyCode:s,panOnScroll:u,panOnScrollMode:l,panOnScrollSpeed:c,panOnDrag:d,zoomOnDoubleClick:f,zoomOnPinch:_,zoomOnScroll:m,preventScrolling:v,noWheelClassName:p,noPanClassName:y,emits:g,connectionStartHandle:h,userSelectionActive:w,paneDragging:A,d3Zoom:R,d3Selection:V,d3ZoomHandler:W,viewport:j,viewportRef:Y,paneClickDistance:U}=Ne();qd(Y);const D=K(!1),ie=K(!1);let N=null,O=!1,E=0,$={x:0,y:0,zoom:0};const F=Kt(s),H=Kt(a),X=Kt(r),T=Ce(()=>(!H.value||H.value&&a.value===!0)&&(F.value||d.value)),z=Ce(()=>F.value||u.value),M=Ce(()=>H.value||a.value===!0&&T.value!==!0);Xe(()=>{if(!Y.value){Vn("Viewport element is missing");return}const le=Y.value,de=le.getBoundingClientRect(),ee=Ac().clickDistance(U.value).scaleExtent([t.value,n.value]).translateExtent(i.value),oe=Ge(le).call(ee),ce=oe.on("wheel.zoom"),C=zt.translate(o.value.x??0,o.value.y??0).scale(St(o.value.zoom??1,t.value,n.value)),b=[[0,0],[de.width,de.height]],S=ee.constrain()(C,b,i.value);ee.transform(oe,S),ee.wheelDelta(ne),R.value=ee,V.value=oe,W.value=ce,j.value={x:S.x,y:S.y,zoom:S.k},ee.on("start",k=>{var B;if(!k.sourceEvent)return null;E=k.sourceEvent.button,D.value=!0;const Q=fe(k.transform);((B=k.sourceEvent)==null?void 0:B.type)==="mousedown"&&(A.value=!0),$=Q,g.viewportChangeStart(Q),g.moveStart({event:k,flowTransform:Q})}),ee.on("end",k=>{if(!k.sourceEvent)return null;if(D.value=!1,A.value=!1,P(T.value,E??0)&&!O&&g.paneContextMenu(k.sourceEvent),O=!1,ve($,k.transform)){const B=fe(k.transform);$=B,g.viewportChangeEnd(B),g.moveEnd({event:k,flowTransform:B})}}),ee.filter(k=>{var B,Q,te;const ae=X.value||m.value,he=_.value&&k.ctrlKey,we=k.button;if((T.value===!0||Array.isArray(T.value)&&T.value.includes(1))&&we===1&&k.type==="mousedown"&&((B=k.target)!=null&&B.closest(".vue-flow__node")||(Q=k.target)!=null&&Q.closest(".vue-flow__edge")))return!0;if(!T.value&&!ae&&!z.value&&!f.value&&!_.value||w.value||!f.value&&k.type==="dblclick"||me(k,p.value)&&k.type==="wheel"||me(k,y.value)&&(k.type!=="wheel"||z.value&&k.type==="wheel"&&!X.value)||!_.value&&k.ctrlKey&&k.type==="wheel"||!ae&&!z.value&&!he&&k.type==="wheel")return!1;if(!_&&k.type==="touchstart"&&((te=k.touches)==null?void 0:te.length)>1)return k.preventDefault(),!1;if(!T.value&&(k.type==="mousedown"||k.type==="touchstart")||a.value===!0&&Array.isArray(d.value)&&d.value.includes(0)&&we===0||Array.isArray(T.value)&&!T.value.includes(we)&&(k.type==="mousedown"||k.type==="touchstart"))return!1;const be=Array.isArray(T.value)&&T.value.includes(we)||a.value===!0&&Array.isArray(T.value)&&!T.value.includes(0)||!we||we<=1;return(!k.ctrlKey||k.type==="wheel")&&be}),_e([w,T],()=>{w.value&&!D.value?ee.on("zoom",null):w.value||ee.on("zoom",k=>{j.value={x:k.transform.x,y:k.transform.y,zoom:k.transform.k};const B=fe(k.transform);O=P(T.value,E??0),g.viewportChange(B),g.move({event:k,flowTransform:B})})},{immediate:!0}),_e([w,z,l,X,_,v,p],()=>{z.value&&!X.value&&!w.value?oe.on("wheel.zoom",k=>{if(me(k,p.value))return!1;const B=X.value||m.value,Q=_.value&&k.ctrlKey;if(!(!v.value||z.value||B||Q))return!1;k.preventDefault(),k.stopImmediatePropagation();const ae=oe.property("__zoom").k||1,he=$n();if(k.ctrlKey&&_.value&&he){const Bt=Ze(k),jr=ne(k),Jr=ae*2**jr;ee.scaleTo(oe,Jr,Bt,k);return}const we=k.deltaMode===1?20:1;let be=l.value===Wt.Vertical?0:k.deltaX*we,Ee=l.value===Wt.Horizontal?0:k.deltaY*we;!he&&k.shiftKey&&l.value!==Wt.Vertical&&!be&&Ee&&(be=Ee,Ee=0),ee.translateBy(oe,-(be/ae)*c.value,-(Ee/ae)*c.value);const Ke=fe(oe.property("__zoom"));N&&clearTimeout(N),ie.value?(g.move({event:k,flowTransform:Ke}),g.viewportChange(Ke),N=setTimeout(()=>{g.moveEnd({event:k,flowTransform:Ke}),g.viewportChangeEnd(Ke),ie.value=!1},150)):(ie.value=!0,g.moveStart({event:k,flowTransform:Ke}),g.viewportChangeStart(Ke))},{passive:!1}):typeof ce<"u"&&oe.on("wheel.zoom",function(k,B){const Q=!v.value&&k.type==="wheel"&&!k.ctrlKey,te=X.value||m.value,ae=_.value&&k.ctrlKey;if(!te&&!u.value&&!ae&&k.type==="wheel"||Q||me(k,p.value))return null;k.preventDefault(),ce.call(this,k,B)},{passive:!1})},{immediate:!0})});function P(le,de){return de===2&&Array.isArray(le)&&le.includes(2)}function ne(le){const de=le.ctrlKey&&$n()?10:1;return-le.deltaY*(le.deltaMode===1?.05:le.deltaMode?1:.002)*de}function ve(le,de){return le.x!==de.x&&!Number.isNaN(de.x)||le.y!==de.y&&!Number.isNaN(de.y)||le.zoom!==de.k&&!Number.isNaN(de.k)}function fe(le){return{x:le.x,y:le.y,zoom:le.k}}function me(le,de){return le.target.closest(`.${de}`)}return(le,de)=>(Z(),re("div",{ref_key:"viewportRef",ref:Y,class:"vue-flow__viewport vue-flow__container"},[I(rf,{"is-selecting":M.value,"selection-key-pressed":x(H),class:It({connecting:!!x(h),dragging:x(A),draggable:x(d)===!0||Array.isArray(x(d))&&x(d).includes(0)})},{default:G(()=>[I(sf,null,{default:G(()=>[qe(le.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),cf=["id"],df=["id"],ff=["id"],hf={name:"A11yDescriptions",compatConfig:{MODE:3}},pf=se({...hf,setup(e){const{id:t,disableKeyboardA11y:n,ariaLiveMessage:o}=Ne();return(i,r)=>(Z(),re(Ve,null,[L("div",{id:`${x(mr)}-${x(t)}`,style:{display:"none"}}," Press enter or space to select a node. "+ke(x(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,cf),L("div",{id:`${x(yr)}-${x(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,df),x(n)?Te("",!0):(Z(),re("div",{key:0,id:`${x(Bc)}-${x(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%)"}},ke(x(o)),9,ff))],64))}});function vf(){const e=Ne();_e(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function gf(e,t,n){return n===q.Left?e-t:n===q.Right?e+t:e}function mf(e,t,n){return n===q.Top?e-t:n===q.Bottom?e+t:e}const Ro=function({radius:e=10,centerX:t=0,centerY:n=0,position:o=q.Top,type:i}){return xe("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${i}`,cx:gf(t,e,o),cy:mf(n,e,o),r:e,stroke:"transparent",fill:"transparent"})};Ro.props=["radius","centerX","centerY","position","type"];Ro.compatConfig={MODE:3};const ki=Ro,yf=se({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:t,addSelectedEdges:n,connectionMode:o,edgeUpdaterRadius:i,emits:r,nodesSelectionActive:a,noPanClassName:s,getEdgeTypes:u,removeSelectedEdges:l,findEdge:c,findNode:d,isValidConnection:f,multiSelectionActive:_,disableKeyboardA11y:m,elementsSelectable:v,edgesUpdatable:p,edgesFocusable:y,hooks:g}=Ne(),h=ue(()=>c(e.id)),{emit:w,on:A}=ud(h.value,r),R=Ot(Hn),V=nn(),W=K(!1),j=K(!1),Y=K(""),U=K(null),D=K("source"),ie=K(null),N=Ce(()=>typeof h.value.selectable>"u"?v.value:h.value.selectable),O=Ce(()=>typeof h.value.updatable>"u"?p.value:h.value.updatable),E=Ce(()=>typeof h.value.focusable>"u"?y.value:h.value.focusable);Pt(ad,e.id),Pt(sd,ie);const $=ue(()=>h.value.class instanceof Function?h.value.class(h.value):h.value.class),F=ue(()=>h.value.style instanceof Function?h.value.style(h.value):h.value.style),H=ue(()=>{const b=h.value.type||"default",S=R==null?void 0:R[`edge-${b}`];if(S)return S;let k=h.value.template??u.value[b];if(typeof k=="string"&&V){const B=Object.keys(V.appContext.components);B&&B.includes(b)&&(k=Xt(b,!1))}return k&&typeof k!="string"?k:(r.error(new Me(Pe.EDGE_TYPE_MISSING,k)),!1)}),{handlePointerDown:X}=Br({nodeId:Y,handleId:U,type:D,isValidConnection:f,edgeUpdaterType:D,onEdgeUpdate:M,onEdgeUpdateEnd:P});return()=>{const b=d(h.value.source),S=d(h.value.target),k="pathOptions"in h.value?h.value.pathOptions:{};if(!b&&!S)return r.error(new Me(Pe.EDGE_SOURCE_TARGET_MISSING,h.value.id,h.value.source,h.value.target)),null;if(!b)return r.error(new Me(Pe.EDGE_SOURCE_MISSING,h.value.id,h.value.source)),null;if(!S)return r.error(new Me(Pe.EDGE_TARGET_MISSING,h.value.id,h.value.target)),null;if(!h.value||h.value.hidden||b.hidden||S.hidden)return null;let B;o.value===bt.Strict?B=b.handleBounds.source:B=[...b.handleBounds.source||[],...b.handleBounds.target||[]];const Q=pi(B,h.value.sourceHandle);let te;o.value===bt.Strict?te=S.handleBounds.target:te=[...S.handleBounds.target||[],...S.handleBounds.source||[]];const ae=pi(te,h.value.targetHandle),he=(Q==null?void 0:Q.position)||q.Bottom,we=(ae==null?void 0:ae.position)||q.Top,{x:be,y:Ee}=kn(b,Q,he),{x:Ke,y:Bt}=kn(S,ae,we);return h.value.sourceX=be,h.value.sourceY=Ee,h.value.targetX=Ke,h.value.targetY=Bt,xe("g",{ref:ie,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${H.value===!1?"default":h.value.type||"default"}`,s.value,$.value,{updating:W.value,selected:h.value.selected,animated:h.value.animated,inactive:!N.value&&!g.value.edgeClick.hasListeners()}],onClick:ve,onContextmenu:fe,onDblclick:me,onMouseenter:le,onMousemove:de,onMouseleave:ee,onKeyDown:E.value?C:void 0,tabIndex:E.value?0:void 0,"aria-label":h.value.ariaLabel===null?void 0:h.value.ariaLabel||`Edge from ${h.value.source} to ${h.value.target}`,"aria-describedby":E.value?`${yr}-${t}`:void 0,role:E.value?"button":"img"},[j.value?null:xe(H.value===!1?u.value.default:H.value,{id:e.id,sourceNode:b,targetNode:S,source:h.value.source,target:h.value.target,type:h.value.type,updatable:O.value,selected:h.value.selected,animated:h.value.animated,label:h.value.label,labelStyle:h.value.labelStyle,labelShowBg:h.value.labelShowBg,labelBgStyle:h.value.labelBgStyle,labelBgPadding:h.value.labelBgPadding,labelBgBorderRadius:h.value.labelBgBorderRadius,data:h.value.data,events:{...h.value.events,...A},style:F.value,markerStart:`url('#${tn(h.value.markerStart,t)}')`,markerEnd:`url('#${tn(h.value.markerEnd,t)}')`,sourcePosition:he,targetPosition:we,sourceX:be,sourceY:Ee,targetX:Ke,targetY:Bt,sourceHandleId:h.value.sourceHandle,targetHandleId:h.value.targetHandle,interactionWidth:h.value.interactionWidth,...k}),[O.value==="source"||O.value===!0?[xe("g",{onMousedown:oe,onMouseenter:T,onMouseout:z},xe(ki,{position:he,centerX:be,centerY:Ee,radius:i.value,type:"source","data-type":"source"}))]:null,O.value==="target"||O.value===!0?[xe("g",{onMousedown:ce,onMouseenter:T,onMouseout:z},xe(ki,{position:we,centerX:Ke,centerY:Bt,radius:i.value,type:"target","data-type":"target"}))]:null]])};function T(){W.value=!0}function z(){W.value=!1}function M(b,S){w.update({event:b,edge:h.value,connection:S})}function P(b){w.updateEnd({event:b,edge:h.value}),j.value=!1}function ne(b,S){b.button===0&&(j.value=!0,Y.value=S?h.value.target:h.value.source,U.value=(S?h.value.targetHandle:h.value.sourceHandle)??"",D.value=S?"target":"source",w.updateStart({event:b,edge:h.value}),X(b))}function ve(b){var S;const k={event:b,edge:h.value};N.value&&(a.value=!1,h.value.selected&&_.value?(l([h.value]),(S=ie.value)==null||S.blur()):n([h.value])),w.click(k)}function fe(b){w.contextMenu({event:b,edge:h.value})}function me(b){w.doubleClick({event:b,edge:h.value})}function le(b){w.mouseEnter({event:b,edge:h.value})}function de(b){w.mouseMove({event:b,edge:h.value})}function ee(b){w.mouseLeave({event:b,edge:h.value})}function oe(b){ne(b,!0)}function ce(b){ne(b,!1)}function C(b){var S;!m.value&&_r.includes(b.key)&&N.value&&(b.key==="Escape"?((S=ie.value)==null||S.blur(),l([c(e.id)])):n([c(e.id)]))}}}),_f=yf,wf={[q.Left]:q.Right,[q.Right]:q.Left,[q.Top]:q.Bottom,[q.Bottom]:q.Top},xf=se({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:t,connectionMode:n,connectionStartHandle:o,connectionEndHandle:i,connectionPosition:r,connectionLineType:a,connectionLineStyle:s,connectionLineOptions:u,connectionStatus:l,viewport:c,findNode:d}=Ne(),f=(e=Ot(Hn))==null?void 0:e["connection-line"],_=ue(()=>{var g;return d((g=o.value)==null?void 0:g.nodeId)}),m=ue(()=>{var g;return d((g=i.value)==null?void 0:g.nodeId)??null}),v=ue(()=>({x:(r.value.x-c.value.x)/c.value.zoom,y:(r.value.y-c.value.y)/c.value.zoom})),p=ue(()=>u.value.markerStart?`url(#${tn(u.value.markerStart,t)})`:""),y=ue(()=>u.value.markerEnd?`url(#${tn(u.value.markerEnd,t)})`:"");return()=>{var g,h,w,A;if(!_.value||!o.value)return null;const R=o.value.handleId,V=o.value.type,W=_.value.handleBounds;let j=(W==null?void 0:W[V])||[];if(n.value===bt.Loose){const H=(W==null?void 0:W[V==="source"?"target":"source"])||[];j=[...j,...H]}if(!j)return null;const Y=(R?j.find(H=>H.id===R):j[0])??null,U=(Y==null?void 0:Y.position)||q.Top,{x:D,y:ie}=kn(_.value,Y,U);let N=null;m.value&&((g=i.value)!=null&&g.handleId)&&(n.value===bt.Strict?N=((h=m.value.handleBounds[V==="source"?"target":"source"])==null?void 0:h.find(H=>{var X;return H.id===((X=i.value)==null?void 0:X.handleId)}))||null:N=((w=[...m.value.handleBounds.source||[],...m.value.handleBounds.target||[]])==null?void 0:w.find(H=>{var X;return H.id===((X=i.value)==null?void 0:X.handleId)}))||null);const O=((A=i.value)==null?void 0:A.position)??(U?wf[U]:null);if(!U||!O)return null;const E=a.value??u.value.type??vt.Bezier;let $="";const F={sourceX:D,sourceY:ie,sourcePosition:U,targetX:v.value.x,targetY:v.value.y,targetPosition:O};return E===vt.Bezier?[$]=Gr(F):E===vt.Step?[$]=So({...F,borderRadius:0}):E===vt.SmoothStep?[$]=So(F):E===vt.SimpleBezier?[$]=Ur(F):$=`M${D},${ie} ${v.value.x},${v.value.y}`,xe("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},xe("g",{class:"vue-flow__connection"},f?xe(f,{sourceX:D,sourceY:ie,sourcePosition:U,targetX:v.value.x,targetY:v.value.y,targetPosition:O,sourceNode:_.value,sourceHandle:Y,targetNode:m.value,targetHandle:N,markerEnd:y.value,markerStart:p.value,connectionStatus:l.value}):xe("path",{d:$,class:[u.value.class,l,"vue-flow__connection-path"],style:{...s.value,...u.value.style},"marker-end":y.value,"marker-start":p.value})))}}}),bf=xf,Sf=["id","markerWidth","markerHeight","markerUnits","orient"],Ef={name:"MarkerType",compatConfig:{MODE:3}},Cf=se({...Ef,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)=>(Z(),re("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===x(yo).ArrowClosed?(Z(),re("polyline",{key:0,style:Qe({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)):Te("",!0),t.type===x(yo).Arrow?(Z(),re("polyline",{key:1,style:Qe({stroke:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):Te("",!0)],8,Sf))}}),Nf={class:"vue-flow__marker vue-flow__container"},kf={name:"MarkerDefinitions",compatConfig:{MODE:3}},$f=se({...kf,setup(e){const{id:t,edges:n,connectionLineOptions:o,defaultMarkerColor:i}=Ne(),r=ue(()=>{const a=new Set,s=[],u=l=>{if(l){const c=tn(l,t);a.has(c)||(typeof l=="object"?s.push({...l,id:c,color:l.color||i.value}):s.push({id:c,color:i.value,type:l}),a.add(c))}};for(const l of[o.value.markerEnd,o.value.markerStart])u(l);for(const l of n.value)for(const c of[l.markerStart,l.markerEnd])u(c);return s.sort((l,c)=>l.id.localeCompare(c.id))});return(a,s)=>(Z(),re("svg",Nf,[L("defs",null,[(Z(!0),re(Ve,null,Pn(r.value,u=>(Z(),ge(Cf,{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))])]))}}),If={name:"Edges",compatConfig:{MODE:3}},Pf=se({...If,setup(e){const{findNode:t,getEdges:n,elevateEdgesOnSelect:o}=Ne();return(i,r)=>(Z(),re(Ve,null,[I($f),(Z(!0),re(Ve,null,Pn(x(n),a=>(Z(),re("svg",{key:a.id,class:"vue-flow__edges vue-flow__container",style:Qe({zIndex:x(Jc)(a,x(t),x(o))})},[I(x(_f),{id:a.id},null,8,["id"])],4))),128)),I(x(bf))],64))}}),Mf=se({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:t,noPanClassName:n,selectNodesOnDrag:o,nodesSelectionActive:i,multiSelectionActive:r,emits:a,removeSelectedNodes:s,addSelectedNodes:u,updateNodeDimensions:l,onUpdateNodeInternals:c,getNodeTypes:d,nodeExtent:f,elevateNodesOnSelect:_,disableKeyboardA11y:m,ariaLiveMessage:v,snapToGrid:p,snapGrid:y,nodeDragThreshold:g,nodesDraggable:h,elementsSelectable:w,nodesConnectable:A,nodesFocusable:R,hooks:V}=Ne(),W=K(null);Pt(Or,W),Pt(zr,e.id);const j=Ot(Hn),Y=nn(),U=Lr(),{node:D,parentNode:ie}=Fr(e.id),{emit:N,on:O}=hd(D,a),E=Ce(()=>typeof D.draggable>"u"?h.value:D.draggable),$=Ce(()=>typeof D.selectable>"u"?w.value:D.selectable),F=Ce(()=>typeof D.connectable>"u"?A.value:D.connectable),H=Ce(()=>typeof D.focusable>"u"?R.value:D.focusable),X=Ce(()=>$.value||E.value||V.value.nodeClick.hasListeners()||V.value.nodeDoubleClick.hasListeners()||V.value.nodeMouseEnter.hasListeners()||V.value.nodeMouseMove.hasListeners()||V.value.nodeMouseLeave.hasListeners()),T=Ce(()=>!!D.dimensions.width&&!!D.dimensions.height),z=ue(()=>{const S=D.type||"default",k=j==null?void 0:j[`node-${S}`];if(k)return k;let B=D.template||d.value[S];if(typeof B=="string"&&Y){const Q=Object.keys(Y.appContext.components);Q&&Q.includes(S)&&(B=Xt(S,!1))}return B&&typeof B!="string"?B:(a.error(new Me(Pe.NODE_TYPE_MISSING,B)),!1)}),M=Rr({id:e.id,el:W,disabled:()=>!E.value,selectable:$,dragHandle:()=>D.dragHandle,onStart(S){N.dragStart(S)},onDrag(S){N.drag(S)},onStop(S){N.dragStop(S)},onClick(S){C(S)}}),P=ue(()=>D.class instanceof Function?D.class(D):D.class),ne=ue(()=>{const S=(D.style instanceof Function?D.style(D):D.style)||{},k=D.width instanceof Function?D.width(D):D.width,B=D.height instanceof Function?D.height(D):D.height;return!S.width&&k&&(S.width=typeof k=="string"?k:`${k}px`),!S.height&&B&&(S.height=typeof B=="string"?B:`${B}px`),S}),ve=Ce(()=>Number(D.zIndex??ne.value.zIndex??0));return c(S=>{(S.includes(e.id)||!S.length)&&me()}),Xe(()=>{_e(()=>D.hidden,(S=!1,k,B)=>{!S&&W.value&&(e.resizeObserver.observe(W.value),B(()=>{W.value&&e.resizeObserver.unobserve(W.value)}))},{immediate:!0,flush:"post"})}),_e([()=>D.type,()=>D.sourcePosition,()=>D.targetPosition],()=>{je(()=>{l([{id:e.id,nodeElement:W.value,forceUpdate:!0}])})}),_e([()=>D.position.x,()=>D.position.y,()=>{var S;return(S=ie.value)==null?void 0:S.computedPosition.x},()=>{var S;return(S=ie.value)==null?void 0:S.computedPosition.y},()=>{var S;return(S=ie.value)==null?void 0:S.computedPosition.z},ve,()=>D.selected,()=>D.dimensions.height,()=>D.dimensions.width,()=>{var S;return(S=ie.value)==null?void 0:S.dimensions.height},()=>{var S;return(S=ie.value)==null?void 0:S.dimensions.width}],([S,k,B,Q,te,ae])=>{const he={x:S,y:k,z:ae+(_.value&&D.selected?1e3:0)};typeof B<"u"&&typeof Q<"u"?D.computedPosition=Xc({x:B,y:Q,z:te},he):D.computedPosition=he},{flush:"post",immediate:!0}),_e([()=>D.extent,f],([S,k],[B,Q])=>{(S!==B||k!==Q)&&fe()}),D.extent==="parent"||typeof D.extent=="object"&&"range"in D.extent&&D.extent.range==="parent"?lo(()=>T).toBe(!0).then(fe):fe(),()=>D.hidden?null:xe("div",{ref:W,"data-id":D.id,class:["vue-flow__node",`vue-flow__node-${z.value===!1?"default":D.type||"default"}`,{[n.value]:E.value,dragging:M==null?void 0:M.value,draggable:E.value,selected:D.selected,selectable:$.value,parent:D.isParent},P.value],style:{visibility:T.value?"visible":"hidden",zIndex:D.computedPosition.z??ve.value,transform:`translate(${D.computedPosition.x}px,${D.computedPosition.y}px)`,pointerEvents:X.value?"all":"none",...ne.value},tabIndex:H.value?0:void 0,role:H.value?"button":void 0,"aria-describedby":m.value?void 0:`${mr}-${t}`,"aria-label":D.ariaLabel,onMouseenter:le,onMousemove:de,onMouseleave:ee,onContextmenu:oe,onClick:C,onDblclick:ce,onKeydown:b},[xe(z.value===!1?d.value.default:z.value,{id:D.id,type:D.type,data:D.data,events:{...D.events,...O},selected:D.selected,resizing:D.resizing,dragging:M.value,connectable:F.value,position:D.computedPosition,dimensions:D.dimensions,isValidTargetPos:D.isValidTargetPos,isValidSourcePos:D.isValidSourcePos,parent:D.parentNode,parentNodeId:D.parentNode,zIndex:D.computedPosition.z??ve.value,targetPosition:D.targetPosition,sourcePosition:D.sourcePosition,label:D.label,dragHandle:D.dragHandle,onUpdateNodeInternals:me})]);function fe(){const S=D.computedPosition,{computedPosition:k,position:B}=Ao(D,p.value?Ln(S,y.value):S,a.error,f.value,ie.value);(D.computedPosition.x!==k.x||D.computedPosition.y!==k.y)&&(D.computedPosition={...D.computedPosition,...k}),(D.position.x!==B.x||D.position.y!==B.y)&&(D.position=B)}function me(){W.value&&l([{id:e.id,nodeElement:W.value,forceUpdate:!0}])}function le(S){M!=null&&M.value||N.mouseEnter({event:S,node:D})}function de(S){M!=null&&M.value||N.mouseMove({event:S,node:D})}function ee(S){M!=null&&M.value||N.mouseLeave({event:S,node:D})}function oe(S){return N.contextMenu({event:S,node:D})}function ce(S){return N.doubleClick({event:S,node:D})}function C(S){$.value&&(!o.value||!E.value||g.value>0)&&bo(D,r.value,u,s,i,!1,W.value),N.click({event:S,node:D})}function b(S){if(!(_o(S)||m.value))if(_r.includes(S.key)&&$.value){const k=S.key==="Escape";bo(D,r.value,u,s,i,k,W.value)}else E.value&&D.selected&&$t[S.key]&&(v.value=`Moved selected node ${S.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~D.position.x}, y: ${~~D.position.y}`,U({x:$t[S.key].x,y:$t[S.key].y},S.shiftKey))}}}),Tf=Mf;function Df(e={includeHiddenNodes:!1}){const{nodes:t}=Ne();return ue(()=>{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 Af={class:"vue-flow__nodes vue-flow__container"},zf={name:"Nodes",compatConfig:{MODE:3}},Of=se({...zf,setup(e){const{getNodes:t,updateNodeDimensions:n,emits:o}=Ne(),i=Df(),r=K();return _e(i,a=>{a&&je(()=>{o.nodesInitialized(t.value)})},{immediate:!0}),Xe(()=>{r.value=new ResizeObserver(a=>{const s=a.map(u=>({id:u.target.getAttribute("data-id"),nodeElement:u.target,forceUpdate:!0}));je(()=>n(s))})}),Mn(()=>{var a;return(a=r.value)==null?void 0:a.disconnect()}),(a,s)=>(Z(),re("div",Af,[r.value?(Z(!0),re(Ve,{key:0},Pn(x(t),(u,l,c,d)=>{const f=[u.id];if(d&&d.key===u.id&&na(d,f))return d;const _=(Z(),ge(x(Tf),{id:u.id,key:u.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return _.memo=f,_},s,0),128)):Te("",!0)]))}});function Rf(){const{emits:e}=Ne();Xe(()=>{if(Ar()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new Me(Pe.MISSING_STYLES))}})}const Bf=L("div",{class:"vue-flow__edge-labels"},null,-1),Ff={name:"VueFlow",compatConfig:{MODE:3}},Lf=se({...Ff,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=Qr(),r=Zn(o,"modelValue",n),a=Zn(o,"nodes",n),s=Zn(o,"edges",n),u=Ne(o),l=gd({modelValue:r,nodes:a,edges:s},o,u);return yd(n,u.hooks),vf(),Rf(),Pt(Hn,i),Pi(()=>{l()}),t(u),(c,d)=>(Z(),re("div",{ref:x(u).vueFlowRef,class:"vue-flow"},[I(uf,null,{default:G(()=>[I(Pf),Bf,I(Of),qe(c.$slots,"zoom-pane")]),_:3}),qe(c.$slots,"default"),I(pf)],512))}});var rt=(e=>(e.Lines="lines",e.Dots="dots",e))(rt||{});const Wr=function({dimensions:e,size:t,color:n}){return xe("path",{stroke:n,"stroke-width":t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})},Kr=function({radius:e,color:t}){return xe("circle",{cx:e,cy:e,r:e,fill:t})};rt.Lines+"",rt.Dots+"";const Vf={[rt.Dots]:"#81818a",[rt.Lines]:"#eee"},Hf=["id","x","y","width","height","patternTransform"],Yf={key:2,height:"100",width:"100"},Gf=["fill"],Uf=["x","y","fill"],Xf={name:"Background",compatConfig:{MODE:3}},Wf=se({...Xf,props:{id:{},variant:{default:()=>rt.Dots},gap:{default:20},size:{default:1},lineWidth:{default:1},patternColor:{},color:{},bgColor:{},height:{default:100},width:{default:100},x:{default:0},y:{default:0},offset:{default:0}},setup(e){const{id:t,viewport:n}=Ne(),o=ue(()=>{const a=n.value.zoom,[s,u]=Array.isArray(e.gap)?e.gap:[e.gap,e.gap],l=[s*a||1,u*a||1],c=e.size*a,[d,f]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],_=[d*a||1+l[0]/2,f*a||1+l[1]/2];return{scaledGap:l,offset:_,size:c}}),i=Ce(()=>`pattern-${t}${e.id?`-${e.id}`:""}`),r=Ce(()=>e.color||e.patternColor||Vf[e.variant||rt.Dots]);return(a,s)=>(Z(),re("svg",{class:"vue-flow__background vue-flow__container",style:Qe({height:`${a.height>100?100:a.height}%`,width:`${a.width>100?100:a.width}%`})},[qe(a.$slots,"pattern-container",{id:i.value},()=>[L("pattern",{id:i.value,x:x(n).x%o.value.scaledGap[0],y:x(n).y%o.value.scaledGap[1],width:o.value.scaledGap[0],height:o.value.scaledGap[1],patternTransform:`translate(-${o.value.offset[0]},-${o.value.offset[1]})`,patternUnits:"userSpaceOnUse"},[qe(a.$slots,"pattern",{},()=>[a.variant===x(rt).Lines?(Z(),ge(x(Wr),{key:0,size:a.lineWidth,color:r.value,dimensions:o.value.scaledGap},null,8,["size","color","dimensions"])):a.variant===x(rt).Dots?(Z(),ge(x(Kr),{key:1,color:r.value,radius:o.value.size/2},null,8,["color","radius"])):Te("",!0),a.bgColor?(Z(),re("svg",Yf,[L("rect",{width:"100%",height:"100%",fill:a.bgColor},null,8,Gf)])):Te("",!0)])],8,Hf)]),L("rect",{x:a.x,y:a.y,width:"100%",height:"100%",fill:`url(#${i.value})`},null,8,Uf),qe(a.$slots,"default",{id:i.value})],4))}}),Kf=[{title:"所属插件",dataIndex:"pluginName"},{title:"流路径",dataIndex:"path"},{title:"状态",dataIndex:"state",customRender:({record:e})=>$a({state:e.state})},{title:"订阅数",dataIndex:"subscribers",width:"70px"}];function Zf({streamList:e}){return e.length?I(Re,{dataSource:e,columns:Kf,size:"small",pagination:!1,bordered:!0,scroll:{y:200}},null):I(Rt,null,null)}const qf=/^(tcp|udp|quic|http)/,jf=[{title:"名称",dataIndex:"name",width:"120px"},{title:"端口",dataIndex:"port",width:"120px",customRender:({record:e})=>{const t=[];if(e.description)for(const n in e.description)qf.test(n)&&t.push(I(Di,{color:"blue"},{default:()=>[n,pe(": "),e.description[n]]}));return t}},{title:"操作",dataIndex:"action",width:"60px",align:"center",customRender:({record:e})=>I(Se,{type:"link",onClick:()=>{Be.confirm({title:`确定重启${e.name}吗?`,content:"开发中"})}},{default:()=>[pe("重启")]})}];function Jf({pluginList:e}){return e.length?I(Re,{dataSource:e,columns:jf,size:"small",pagination:!1,bordered:!0,scroll:{y:200}},null):I(Rt,null,null)}const Qf=[{title:"流",dataIndex:"streamPath"},{title:"别名",dataIndex:"alias"},{title:"自动删除",dataIndex:"autoRemove"},{title:"状态",dataIndex:"status",customRender:({record:e})=>Ia[e.status]}];function eh({aliasList:e}){return e.length?I(Re,{dataSource:e,columns:Qf,size:"small",pagination:!1,bordered:!0,scroll:{y:200}},null):I(Rt,null,null)}const th=[{title:"所有者",dataIndex:"owner"},{title:"状态",dataIndex:"state",width:100,customRender:({record:e})=>Pa[e.state]},{title:"启动时间",dataIndex:"startTime",width:100,customRender:({record:e})=>I(Ai,{value:e.startTime},null)}];function Zr(e){return e.children&&e.children.length>0?e.children=e.children.map(Zr):delete e.children,e}function nh(e){const t=[];function n(o){o.forEach(i=>{i.children&&i.children.length>0&&(t.push(String(i.id)),n(i.children))})}return n(e),t}function oh({taskList:e}){const t=K([]);Tn(()=>{const o=nh(e);t.value=o});const n=(o,i)=>{const r=String(i.id);if(o)t.value.includes(r)||t.value.push(r);else{const a=t.value.indexOf(r);a>-1&&t.value.splice(a,1)}};return e.length?I(Re,{dataSource:e,columns:th,size:"small",pagination:!1,bordered:!0,expandedRowKeys:t.value,onExpand:n,childrenColumnName:"children",indentSize:20,rowKey:o=>String(o.id),scroll:{y:200}},null):I(Rt,null,null)}const ih=[{title:"文件名",dataIndex:"name"},{title:"大小",dataIndex:"size",width:100,customRender:({record:e})=>Ma(e.size)},{title:"操作",dataIndex:"action",width:70,customRender:({record:e})=>I(Se,{type:"link",onClick:()=>rh(e.name)},{default:()=>[pe("查看")]})}];function rh(e){Na(e).then(t=>{Be.info({title:"查看日志",width:"1024px",okText:"关闭",content:I("pre",{class:"w-100% h-600px overflow-auto"},[t])})})}function ah({logList:e}){return e.length?I(Re,{columns:ih,dataSource:e,size:"small",pagination:!1,bordered:!0,scroll:{y:200}},null):I(Rt,null,null)}const sh=[{title:"插件",dataIndex:"pluginName"},{title:"流",dataIndex:"streamPath"},{title:"目标",dataIndex:"target"},{title:"配置",dataIndex:"config"}];function lh({transformList:e}){return e.length?I(Re,{dataSource:e,columns:sh,size:"small",pagination:!1,bordered:!0,scroll:{y:200}},null):I(Rt,null,null)}const uh={style:{position:"relative"}},ch={class:"version-tag"},dh={class:"flex-center"},fh={class:"overview-content"},hh={class:"info-grid"},ph={class:"info-card"},vh={class:"info-header"},gh={class:"info-body"},mh={class:"info-item"},yh={class:"info-item"},_h={class:"value-tag processing"},wh={class:"info-item"},xh={class:"value-tag processing"},bh={class:"detail-row"},Sh={class:"detail-item"},Eh={class:"value-tag default"},Ch={class:"detail-item"},Nh={class:"value-tag default"},kh={class:"info-card"},$h={class:"info-header"},Ih={class:"info-body"},Ph={class:"resource-section"},Mh={class:"resource-title"},Th={class:"resource-details"},Dh={class:"resource-item"},Ah={class:"value-tag default"},zh={class:"resource-item"},Oh={class:"value-tag success"},Rh={class:"resource-section"},Bh={class:"resource-title"},Fh={class:"resource-details"},Lh={class:"resource-item"},Vh={class:"value-tag default"},Hh={class:"resource-item"},Yh={class:"value-tag success"},Gh={class:"info-card"},Uh={class:"info-header"},Xh={class:"info-body"},Wh={class:"resource-section"},Kh={class:"resource-title"},Zh={class:"network-stats-compact"},qh={class:"network-item-compact"},jh={class:"value-tag error"},Jh={class:"network-item-compact"},Qh={class:"value-tag success"},ep={class:"flex-center gap-2px"},tp={class:"flex-center gap-2px"},np={class:"flex-center gap-2px"},op={class:"flex-center gap-2px"},ip={class:"flex-center gap-2px"},rp={class:"flex-center gap-2px"},ap={key:1},sp=se({name:"Instance"}),lp=se({...sp,props:{data:{}},setup(e){const t=Dn(),{summary:n,online:o,sysInfo:i}=Mt(t),r=K([]),a=K([]),s=K([]),u=K([]),l=K([]),c=t.pluginActive("LogRotate");function d(){ao().then(E=>{r.value=E})}function f(){wa().then(E=>{a.value=E})}function _(){xa().then(E=>{l.value=E})}function m(){ba().then(E=>{s.value=[E].map(Zr)})}function v(){ka().then(E=>{u.value=E})}const p={3:{...nt(d),active(){o.value?(d(),this.resume()):this.pause()}},4:{...nt(_),active(){o.value?(_(),this.resume()):this.pause()}},5:{...nt(f),active(){o.value?(f(),this.resume()):this.pause()}},6:{...nt(m),active(){o.value?(m(),this.resume()):this.pause()}},7:{...nt(v),active(){c.value&&o.value?(v(),this.resume()):this.pause()}}},y=zi(),g=e,h=K(),w=K(),A=K(0),R=K(0),V=K("1");_e(V,(E,$)=>{var F,H;(F=p[$])==null||F.pause(),(H=p[E])==null||H.active()}),_e(o,E=>{var $,F;if(E)(F=p[V.value])==null||F.active();else for(const H in p)($=p[H])==null||$.pause()}),Tn(()=>{var E;(!c.value||!o.value)&&((E=p[7])==null||E.pause())});function W(){Be.confirm({title:"热重启",content:"确定要热重启吗?",okText:"确定",cancelText:"取消",onOk:()=>Sa()})}const j=t.registerSummaryCallback(E=>{var $,F,H,X,T;(F=h.value)==null||F.handleUpdate((($=E==null?void 0:E.memory)==null?void 0:$.usage)||0),(H=w.value)==null||H.handleUpdate((E==null?void 0:E.cpuUsage)||0),A.value=((X=E==null?void 0:E.netWork)==null?void 0:X.reduce((z,M)=>z+Number(M.sentSpeed||0),0))||0,R.value=((T=E==null?void 0:E.netWork)==null?void 0:T.reduce((z,M)=>z+Number(M.receiveSpeed||0),0))||0});Mn(()=>{var E;j();for(const $ in p)(E=p[$])==null||E.pause()});function Y(){c.value?g.data.onShowLogTrail():Ye.error("需要启用 Logrotate 插件")}async function U(){try{let $=await Ea();Be.confirm({title:"编辑配置文件",width:800,style:{top:"20px"},content:()=>I("div",{style:"height: 600px"},[I(Ta,{value:$,onChange:F=>$=F,language:"yaml",options:{minimap:{enabled:!1},lineNumbers:"on",automaticLayout:!0}},null)]),onOk:async()=>{try{Da.parse($),await Ca($),Ye.success("保存成功")}catch(F){return Promise.reject("配置文件格式错误:"+F.message)}}})}catch(E){Ye.error("获取配置文件失败:"+E.message)}}function D(){g.data.onShowDebugChart()}function ie(E){return E>=1024?`${(E/1024).toFixed(1)}GB`:`${E}MB`}function N(E){return E>=1024?`${(E/1024).toFixed(1)}TB`:`${E}GB`}function O(E){return E>=1024*1024*1024?`${(E/(1024*1024*1024)).toFixed(1)}GB/s`:E>=1024*1024?`${(E/(1024*1024)).toFixed(1)}MB/s`:E>=1024?`${(E/1024).toFixed(1)}KB/s`:`${E}B/s`}return(E,$)=>(Z(),re("div",uh,[I(x(Ie),{type:"target",position:x(q).Top,id:"upstream"},null,8,["position"]),I(x(Ie),{type:"source",position:x(q).Bottom,id:"downstream"},null,8,["position"]),I(x(Ie),{type:"target",position:x(q).Left,id:"target-pull",style:{top:"20%",bottom:"auto"}},null,8,["position"]),I(x(Ie),{type:"target",position:x(q).Left,id:"target-push",style:{top:"50%",bottom:"auto"}},null,8,["position"]),I(x(Ie),{type:"target",position:x(q).Left,id:"target-read",style:{top:"80%",bottom:"auto"}},null,8,["position"]),I(x(Ie),{type:"source",position:x(q).Right,id:"source-push",style:{top:"20%",bottom:"auto"}},null,8,["position"]),I(x(Ie),{type:"source",position:x(q).Right,id:"source-play",style:{top:"50%",bottom:"auto"}},null,8,["position"]),I(x(Ie),{type:"source",position:x(q).Right,id:"source-read",style:{top:"80%",bottom:"auto"}},null,8,["position"]),x(t).online?(Z(),ge(x(Fe),{key:0,size:"small",class:"w-500px drop-shadow-xl","body-style":{paddingBottom:0,paddingTop:0}},{title:G(()=>[$[2]||($[2]=L("span",null,"Monibuca ",-1)),L("span",ch,ke(x(i).version),1),L("span",null,ke(x(i).localIP),1)]),extra:G(()=>[I(x(Se),{type:"link",onClick:$[0]||($[0]=F=>x(y)("Overview"))},{default:G(()=>$[3]||($[3]=[pe("查看详情")])),_:1})]),actions:G(()=>[I(x(Se),{type:"link",onClick:D,size:"small"},{default:G(()=>$[25]||($[25]=[pe(" 性能观测 ")])),_:1}),I(x(Se),{type:"link",onClick:U,size:"small"},{default:G(()=>$[26]||($[26]=[pe(" 配置 ")])),_:1}),I(x(Se),{type:"link",onClick:Y,size:"small"},{default:G(()=>$[27]||($[27]=[pe(" 日志跟踪 ")])),_:1}),I(x(Se),{type:"link",onClick:W,size:"small"},{default:G(()=>$[28]||($[28]=[pe(" 热重启 ")])),_:1})]),default:G(()=>[I(x(ca),{activeKey:V.value,"onUpdate:activeKey":$[1]||($[1]=F=>V.value=F),size:"small",animated:"","tab-bar-gutter":10,"tab-bar-style":{marginBottom:"2px"}},{default:G(()=>[I(x(pt),{key:"1"},{tab:G(()=>[L("div",dh,[I(x(He),{icon:"dashicons:dashboard",width:"20",height:"20"}),$[4]||($[4]=L("span",null,"概览",-1))])]),default:G(()=>{var F,H,X,T,z,M,P;return[L("div",fh,[L("div",hh,[L("div",ph,[L("div",vh,[I(x(He),{icon:"material-symbols:schedule",class:"info-icon"}),$[5]||($[5]=L("span",{class:"info-title"},"系统信息",-1))]),L("div",gh,[L("div",mh,[$[6]||($[6]=L("span",{class:"label"},"启动时间:",-1)),I(x(Ai),{value:x(i).startTime,class:"text-primary font-medium"},null,8,["value"])]),L("div",yh,[$[7]||($[7]=L("span",{class:"label"},"Go版本:",-1)),L("span",_h,ke(x(i).goVersion),1)]),L("div",wh,[$[8]||($[8]=L("span",{class:"label"},"系统:",-1)),L("span",xh,ke(x(i).os),1)]),L("div",bh,[L("span",Sh,[$[9]||($[9]=L("span",{class:"detail-label"},"CPU:",-1)),L("span",Eh,ke(x(i).cpus)+"核",1)]),L("span",Ch,[$[10]||($[10]=L("span",{class:"detail-label"},"架构:",-1)),L("span",Nh,ke(x(i).arch),1)])])])]),L("div",kh,[L("div",$h,[I(x(He),{icon:"material-symbols:storage",class:"info-icon"}),$[11]||($[11]=L("span",{class:"info-title"},"存储&内存",-1))]),L("div",Ih,[L("div",Ph,[L("div",Mh," 磁盘 "+ke(((F=x(n).hardDisk)==null?void 0:F.usage.toFixed(1))||0)+"% ",1),L("div",Th,[L("span",Dh,[$[12]||($[12]=L("span",{class:"resource-label"},"总计:",-1)),L("span",Ah,ke(N(((H=x(n).hardDisk)==null?void 0:H.total)||0)),1)]),L("span",zh,[$[13]||($[13]=L("span",{class:"resource-label"},"可用:",-1)),L("span",Oh,ke(N(((X=x(n).hardDisk)==null?void 0:X.free)||0)),1)])])]),L("div",Rh,[L("div",Bh," 内存 "+ke(((T=x(n).memory)==null?void 0:T.usage.toFixed(1))||0)+"% ",1),L("div",Fh,[L("span",Lh,[$[14]||($[14]=L("span",{class:"resource-label"},"总计:",-1)),L("span",Vh,ke(ie(((z=x(n).memory)==null?void 0:z.total)||0)),1)]),L("span",Hh,[$[15]||($[15]=L("span",{class:"resource-label"},"可用:",-1)),L("span",Yh,ke(ie(((M=x(n).memory)==null?void 0:M.free)||0)),1)])])])])]),L("div",Gh,[L("div",Uh,[I(x(He),{icon:"material-symbols:network-wifi",class:"info-icon"}),$[16]||($[16]=L("span",{class:"info-title"},"网络&性能",-1))]),L("div",Xh,[L("div",Wh,[L("div",Kh," CPU "+ke(((P=x(n).cpuUsage)==null?void 0:P.toFixed(1))||0)+"% ",1),L("div",Zh,[L("div",qh,[$[17]||($[17]=L("span",{class:"network-label-compact"},"上传:",-1)),L("span",jh,ke(O(A.value)),1)]),L("div",Jh,[$[18]||($[18]=L("span",{class:"network-label-compact"},"下载:",-1)),L("span",Qh,ke(O(R.value)),1)])])])])])])])]}),_:1}),I(x(pt),{key:"2"},{tab:G(()=>[L("div",ep,[I(x(He),{icon:"mingcute:plugin-line",width:"24",height:"24"}),$[19]||($[19]=L("span",null,"插件",-1))])]),default:G(()=>[I(x(Jf),{pluginList:x(i).plugins},null,8,["pluginList"])]),_:1}),I(x(pt),{key:"3"},{tab:G(()=>[L("div",tp,[I(x(He),{icon:"ri:live-line",width:"24",height:"24"}),$[20]||($[20]=L("span",null,"流",-1))])]),default:G(()=>[I(x(Zf),{streamList:r.value},null,8,["streamList"])]),_:1}),I(x(pt),{key:"4"},{tab:G(()=>[L("div",np,[I(x(He),{icon:"carbon:transform-binary",width:"24",height:"24"}),$[21]||($[21]=L("span",null,"转换",-1))])]),default:G(()=>[I(x(lh),{transformList:l.value},null,8,["transformList"])]),_:1}),I(x(pt),{key:"5"},{tab:G(()=>[L("div",op,[I(x(He),{icon:"oui:token-alias",width:"24",height:"24"}),$[22]||($[22]=L("span",null,"别名",-1))])]),default:G(()=>[I(x(eh),{aliasList:a.value},null,8,["aliasList"])]),_:1}),I(x(pt),{key:"6"},{tab:G(()=>[L("div",ip,[I(x(He),{icon:"iconoir:task-list",width:"24",height:"24"}),$[23]||($[23]=L("span",null,"任务",-1))])]),default:G(()=>[I(x(oh),{taskList:s.value},null,8,["taskList"])]),_:1}),I(x(pt),{key:"7"},{tab:G(()=>[L("div",rp,[I(x(He),{icon:"ix:log",width:"24",height:"24"}),$[24]||($[24]=L("span",null,"日志",-1))])]),default:G(()=>[x(c)?(Z(),ge(x(ah),{key:0,logList:u.value},null,8,["logList"])):(Z(),re("div",ap,"需要启用 Logrotate 插件"))]),_:1})]),_:1},8,["activeKey"])]),_:1})):(Z(),ge(x(Fe),{key:1},{default:G(()=>[I(x(He),{icon:"mingcute:plugin-line",width:"24",height:"24"}),$[29]||($[29]=L("span",null,"Monibuca 离线",-1))]),_:1}))]))}});const up=da(lp,[["__scopeId","data-v-a869aeca"]]),cp={key:1,class:"text-12px"},dp=se({name:"Device"}),fp=se({...dp,setup(e){const{pause:t,resume:n}=nt(r),o=K([]),i=K([{title:"名称",dataIndex:"name"},{title:"状态",dataIndex:"status",customRender:({record:a})=>Oa(a.status)}]);function r(){return Aa().then(a=>{o.value=a}).catch(a=>{console.error(`stream-proxy-getList-error: ${a}`)})}return r(),(a,s)=>(Z(),ge(x(Fe),{size:"small",class:"w-250px drop-shadow-xl"},{title:G(()=>[s[1]||(s[1]=L("span",null,"远端服务器或设备",-1)),o.value.length?(Z(),ge(x(Et),{key:0,title:"帮助",content:"设备节点用于配置拉流代理,可以从远程服务器或设备拉取流"},{default:G(()=>[I(x(Se),{type:"link",size:"small"},{default:G(()=>[I(x(st),{class:"ml-1 text-gray-400"})]),_:1})]),_:1})):Te("",!0)]),extra:G(()=>[I(x(Se),{type:"link",onClick:s[0]||(s[0]=u=>x(Ra)({updateList:r,pause:x(t),resume:x(n)}))},{default:G(()=>s[2]||(s[2]=[pe("添加")])),_:1})]),default:G(()=>[I(x(Ie),{type:"source",position:x(q).Right},null,8,["position"]),o.value.length?(Z(),ge(x(Re),{key:0,"data-source":o.value,columns:i.value,size:"small",pagination:!1,bordered:""},null,8,["data-source","columns"])):(Z(),re("span",cp," 拉力代理功能:由 Monibuca 作为客户端主动从远端服务器或者设备拉流。 点击右上角按钮,可以添加拉流代理 "))]),_:1}))}});var Eo={},hp={get exports(){return Eo},set exports(e){Eo=e}};function pp(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var In={},vp={get exports(){return In},set exports(e){In=e}},$i;function gp(){return $i||($i=1,function(e,t){(function(n,o){e.exports=o()})(Vt,function(){var n=n||function(o,i){var r;if(typeof window<"u"&&window.crypto&&(r=window.crypto),typeof self<"u"&&self.crypto&&(r=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(r=globalThis.crypto),!r&&typeof window<"u"&&window.msCrypto&&(r=window.msCrypto),!r&&typeof Vt<"u"&&Vt.crypto&&(r=Vt.crypto),!r&&typeof pp=="function")try{r=Ba}catch{}var a=function(){if(r){if(typeof r.getRandomValues=="function")try{return r.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof r.randomBytes=="function")try{return r.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function g(){}return function(h){var w;return g.prototype=h,w=new g,g.prototype=null,w}}(),u={},l=u.lib={},c=l.Base=function(){return{extend:function(g){var h=s(this);return g&&h.mixIn(g),(!h.hasOwnProperty("init")||this.init===h.init)&&(h.init=function(){h.$super.init.apply(this,arguments)}),h.init.prototype=h,h.$super=this,h},create:function(){var g=this.extend();return g.init.apply(g,arguments),g},init:function(){},mixIn:function(g){for(var h in g)g.hasOwnProperty(h)&&(this[h]=g[h]);g.hasOwnProperty("toString")&&(this.toString=g.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),d=l.WordArray=c.extend({init:function(g,h){g=this.words=g||[],h!=i?this.sigBytes=h:this.sigBytes=g.length*4},toString:function(g){return(g||_).stringify(this)},concat:function(g){var h=this.words,w=g.words,A=this.sigBytes,R=g.sigBytes;if(this.clamp(),A%4)for(var V=0;V<R;V++){var W=w[V>>>2]>>>24-V%4*8&255;h[A+V>>>2]|=W<<24-(A+V)%4*8}else for(var j=0;j<R;j+=4)h[A+j>>>2]=w[j>>>2];return this.sigBytes+=R,this},clamp:function(){var g=this.words,h=this.sigBytes;g[h>>>2]&=4294967295<<32-h%4*8,g.length=o.ceil(h/4)},clone:function(){var g=c.clone.call(this);return g.words=this.words.slice(0),g},random:function(g){for(var h=[],w=0;w<g;w+=4)h.push(a());return new d.init(h,g)}}),f=u.enc={},_=f.Hex={stringify:function(g){for(var h=g.words,w=g.sigBytes,A=[],R=0;R<w;R++){var V=h[R>>>2]>>>24-R%4*8&255;A.push((V>>>4).toString(16)),A.push((V&15).toString(16))}return A.join("")},parse:function(g){for(var h=g.length,w=[],A=0;A<h;A+=2)w[A>>>3]|=parseInt(g.substr(A,2),16)<<24-A%8*4;return new d.init(w,h/2)}},m=f.Latin1={stringify:function(g){for(var h=g.words,w=g.sigBytes,A=[],R=0;R<w;R++){var V=h[R>>>2]>>>24-R%4*8&255;A.push(String.fromCharCode(V))}return A.join("")},parse:function(g){for(var h=g.length,w=[],A=0;A<h;A++)w[A>>>2]|=(g.charCodeAt(A)&255)<<24-A%4*8;return new d.init(w,h)}},v=f.Utf8={stringify:function(g){try{return decodeURIComponent(escape(m.stringify(g)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(g){return m.parse(unescape(encodeURIComponent(g)))}},p=l.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new d.init,this._nDataBytes=0},_append:function(g){typeof g=="string"&&(g=v.parse(g)),this._data.concat(g),this._nDataBytes+=g.sigBytes},_process:function(g){var h,w=this._data,A=w.words,R=w.sigBytes,V=this.blockSize,W=V*4,j=R/W;g?j=o.ceil(j):j=o.max((j|0)-this._minBufferSize,0);var Y=j*V,U=o.min(Y*4,R);if(Y){for(var D=0;D<Y;D+=V)this._doProcessBlock(A,D);h=A.splice(0,Y),w.sigBytes-=U}return new d.init(h,U)},clone:function(){var g=c.clone.call(this);return g._data=this._data.clone(),g},_minBufferSize:0});l.Hasher=p.extend({cfg:c.extend(),init:function(g){this.cfg=this.cfg.extend(g),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(g){return this._append(g),this._process(),this},finalize:function(g){g&&this._append(g);var h=this._doFinalize();return h},blockSize:16,_createHelper:function(g){return function(h,w){return new g.init(w).finalize(h)}},_createHmacHelper:function(g){return function(h,w){return new y.HMAC.init(g,w).finalize(h)}}});var y=u.algo={};return u}(Math);return n})}(vp)),In}(function(e,t){(function(n,o){e.exports=o(gp())})(Vt,function(n){return function(o){var i=n,r=i.lib,a=r.WordArray,s=r.Hasher,u=i.algo,l=[];(function(){for(var v=0;v<64;v++)l[v]=o.abs(o.sin(v+1))*4294967296|0})();var c=u.MD5=s.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(v,p){for(var y=0;y<16;y++){var g=p+y,h=v[g];v[g]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360}var w=this._hash.words,A=v[p+0],R=v[p+1],V=v[p+2],W=v[p+3],j=v[p+4],Y=v[p+5],U=v[p+6],D=v[p+7],ie=v[p+8],N=v[p+9],O=v[p+10],E=v[p+11],$=v[p+12],F=v[p+13],H=v[p+14],X=v[p+15],T=w[0],z=w[1],M=w[2],P=w[3];T=d(T,z,M,P,A,7,l[0]),P=d(P,T,z,M,R,12,l[1]),M=d(M,P,T,z,V,17,l[2]),z=d(z,M,P,T,W,22,l[3]),T=d(T,z,M,P,j,7,l[4]),P=d(P,T,z,M,Y,12,l[5]),M=d(M,P,T,z,U,17,l[6]),z=d(z,M,P,T,D,22,l[7]),T=d(T,z,M,P,ie,7,l[8]),P=d(P,T,z,M,N,12,l[9]),M=d(M,P,T,z,O,17,l[10]),z=d(z,M,P,T,E,22,l[11]),T=d(T,z,M,P,$,7,l[12]),P=d(P,T,z,M,F,12,l[13]),M=d(M,P,T,z,H,17,l[14]),z=d(z,M,P,T,X,22,l[15]),T=f(T,z,M,P,R,5,l[16]),P=f(P,T,z,M,U,9,l[17]),M=f(M,P,T,z,E,14,l[18]),z=f(z,M,P,T,A,20,l[19]),T=f(T,z,M,P,Y,5,l[20]),P=f(P,T,z,M,O,9,l[21]),M=f(M,P,T,z,X,14,l[22]),z=f(z,M,P,T,j,20,l[23]),T=f(T,z,M,P,N,5,l[24]),P=f(P,T,z,M,H,9,l[25]),M=f(M,P,T,z,W,14,l[26]),z=f(z,M,P,T,ie,20,l[27]),T=f(T,z,M,P,F,5,l[28]),P=f(P,T,z,M,V,9,l[29]),M=f(M,P,T,z,D,14,l[30]),z=f(z,M,P,T,$,20,l[31]),T=_(T,z,M,P,Y,4,l[32]),P=_(P,T,z,M,ie,11,l[33]),M=_(M,P,T,z,E,16,l[34]),z=_(z,M,P,T,H,23,l[35]),T=_(T,z,M,P,R,4,l[36]),P=_(P,T,z,M,j,11,l[37]),M=_(M,P,T,z,D,16,l[38]),z=_(z,M,P,T,O,23,l[39]),T=_(T,z,M,P,F,4,l[40]),P=_(P,T,z,M,A,11,l[41]),M=_(M,P,T,z,W,16,l[42]),z=_(z,M,P,T,U,23,l[43]),T=_(T,z,M,P,N,4,l[44]),P=_(P,T,z,M,$,11,l[45]),M=_(M,P,T,z,X,16,l[46]),z=_(z,M,P,T,V,23,l[47]),T=m(T,z,M,P,A,6,l[48]),P=m(P,T,z,M,D,10,l[49]),M=m(M,P,T,z,H,15,l[50]),z=m(z,M,P,T,Y,21,l[51]),T=m(T,z,M,P,$,6,l[52]),P=m(P,T,z,M,W,10,l[53]),M=m(M,P,T,z,O,15,l[54]),z=m(z,M,P,T,R,21,l[55]),T=m(T,z,M,P,ie,6,l[56]),P=m(P,T,z,M,X,10,l[57]),M=m(M,P,T,z,U,15,l[58]),z=m(z,M,P,T,F,21,l[59]),T=m(T,z,M,P,j,6,l[60]),P=m(P,T,z,M,E,10,l[61]),M=m(M,P,T,z,V,15,l[62]),z=m(z,M,P,T,N,21,l[63]),w[0]=w[0]+T|0,w[1]=w[1]+z|0,w[2]=w[2]+M|0,w[3]=w[3]+P|0},_doFinalize:function(){var v=this._data,p=v.words,y=this._nDataBytes*8,g=v.sigBytes*8;p[g>>>5]|=128<<24-g%32;var h=o.floor(y/4294967296),w=y;p[(g+64>>>9<<4)+15]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360,p[(g+64>>>9<<4)+14]=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360,v.sigBytes=(p.length+1)*4,this._process();for(var A=this._hash,R=A.words,V=0;V<4;V++){var W=R[V];R[V]=(W<<8|W>>>24)&16711935|(W<<24|W>>>8)&4278255360}return A},clone:function(){var v=s.clone.call(this);return v._hash=this._hash.clone(),v}});function d(v,p,y,g,h,w,A){var R=v+(p&y|~p&g)+h+A;return(R<<w|R>>>32-w)+p}function f(v,p,y,g,h,w,A){var R=v+(p&g|y&~g)+h+A;return(R<<w|R>>>32-w)+p}function _(v,p,y,g,h,w,A){var R=v+(p^y^g)+h+A;return(R<<w|R>>>32-w)+p}function m(v,p,y,g,h,w,A){var R=v+(y^(p|~g))+h+A;return(R<<w|R>>>32-w)+p}i.MD5=s._createHelper(c),i.HmacMD5=s._createHmacHelper(c)}(Math),n.MD5})})(hp);const qr=Eo,mp=["srcObject"],yp={key:1,class:"text-12px"},_p={class:"flex items-center justify-between pl-10px pr-10px"},wp=se({name:"Pusher"}),xp=se({...wp,props:{data:{}},setup(e){const t=K(!1),n=K(!1),o=Dn(),i=K(""),r=K("live/test"),a=e,{plugins:s,sysInfo:u}=Mt(o),l=o.pluginActive("WebRTC");async function c(){try{return(await navigator.mediaDevices.enumerateDevices()).filter(y=>y.kind==="videoinput").map(y=>({label:y.label||`Camera ${y.deviceId.slice(0,10)}...`,value:y.deviceId,key:y.deviceId}))}catch(p){return console.error("获取摄像头列表失败:",p),Ye.error("获取摄像头列表失败"),[]}}let d;const f=K(null);async function _(p){n.value=!0;const y=f.value=p,g=new RTCPeerConnection;d=()=>{g.close(),y==null||y.getTracks().forEach(R=>{R.stop()}),f.value=null},g.oniceconnectionstatechange=()=>{Ht.info({message:"oniceconnectionstatechange",description:JSON.stringify(g.iceConnectionState)})},g.onicecandidate=R=>{Ht.info({message:"onicecandidate",description:JSON.stringify(R.candidate)})},y.getTracks().forEach(R=>{g.addTrack(R,y)});const h=await g.createOffer();await g.setLocalDescription(h),Ht.info({message:"createOffer",description:()=>I("div",{class:"h-200px overflow-auto"},[h.sdp])});const w=await fetch(`${wt("webrtc","/push")}/${r.value}`,{method:"POST",mode:"cors",cache:"no-cache",credentials:"include",redirect:"follow",referrerPolicy:"no-referrer",headers:{"Content-Type":"application/sdp"},body:h.sdp}),A=await w.text();if(w.status>=300)throw`${w.status} ${w.statusText}: ${A}`;Ht.success({message:"推流成功",description:A||""}),await g.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:A}))}Tn(()=>{t.value?l.value?v():(Ye.error("请先启用 WebRTC 插件"),t.value=!1):d==null||d(),a.data.onPush(t.value)});async function m(){const p=K({useLocalIP:"localhost",secretKey:"",expireTime:Ae().add(1,"hour")});Be.info({title:"推流地址",width:800,content:()=>{const y=h=>{if(!p.value.secretKey||!p.value.expireTime)return"";const w=Math.floor(p.value.expireTime.unix()).toString(16),A=qr(p.value.secretKey+r.value+w).toString();return(h.includes("?")?"&":"?")+`secret=${A}&expire=${w}`},g=[];for(const h of s.value){const w=h.pushAddr;if(w)for(const A of w){const R=A.replace("{hostName}",p.value.useLocalIP).replace("{streamPath}",r.value);g.push({protocol:A.startsWith("http")?h.name.toLocaleLowerCase():A.split(":")[0],path:R+y(R)})}}return g.length?[I(ro,{value:p.value.useLocalIP,onChange:h=>p.value.useLocalIP=h.target.value},{default:()=>[I(Kn,{value:"localhost"},{default:()=>[pe("使用localhost")]}),I(Kn,{value:u.value.publicIP},{default:()=>[pe("使用公网IP")]}),I(Kn,{value:u.value.localIP},{default:()=>[pe("使用内网IP")]})]}),I(ze,{layout:"inline"},{default:()=>[I(ze.Item,null,{default:()=>[I("span",null,[pe("秘钥"),I(Oi,{title:"需要匹配配置文件中 publish 下的 key 配置"},{default:()=>[I(st,{style:"margin-left: 4px"},null)]})]),I(_n,{type:"text",placeholder:"请输入秘钥",class:"w-250px",style:"margin-bottom: 10px",value:p.value.secretKey,onChange:h=>p.value.secretKey=h.target.value},null)]}),I(ze.Item,{label:"过期时间"},{default:()=>[I(Ri,{placeholder:"选择过期时间",showTime:!0,class:"w-250px",style:"margin-bottom: 10px",value:p.value.expireTime,onChange:h=>p.value.expireTime=h},null)]})]}),I(Re,{dataSource:g,columns:[{title:"协议",dataIndex:"protocol"},{title:"推流地址",dataIndex:"path"}],pagination:!1,size:"small"},null)]:I("span",null,[pe("请先启用一些插件,如:rtmp、rtsp 插件")])}})}function v(){navigator.mediaDevices.getUserMedia({video:!0}).then(async p=>{var g;p.getTracks().forEach(h=>{h.stop()});const y=await c();i.value||(i.value=((g=y[0])==null?void 0:g.value)||""),i.value&&(p=await navigator.mediaDevices.getUserMedia({video:{deviceId:i.value}})),Be.confirm({title:"选择摄像头",content:()=>I("div",null,[I(Tt,{value:i.value,onChange:async h=>{p.getTracks().forEach(w=>{w.stop()}),p=await navigator.mediaDevices.getUserMedia({video:{deviceId:h}}),i.value=h},options:y,class:"w-250px"},null),I("video",{autoplay:!0,muted:!0,srcObject:p,width:"240",height:"180"},null)]),onCancel:()=>{p.getTracks().forEach(h=>{h.stop()})},onOk:()=>_(p).then(()=>{a.data.onPush(t.value),n.value=!1}).catch(h=>{Be.error({title:"推流失败",content:h}),t.value=!1,n.value=!1})})})}return(p,y)=>(Z(),ge(x(Fe),{size:"small",class:"w-250px drop-shadow-xl"},{title:G(()=>[y[2]||(y[2]=L("span",null,"推流器",-1)),f.value?(Z(),ge(x(Et),{key:0,title:"帮助",content:"可以通过 OBS、ffmpeg等推流器工具将本地流推送到服务器, 然后通过播放器播放"},{default:G(()=>[I(x(Se),{type:"link",size:"small"},{default:G(()=>[I(x(st),{class:"ml-1 text-gray-400"})]),_:1})]),_:1})):Te("",!0)]),extra:G(()=>[I(x(Se),{type:"link",onClick:m},{default:G(()=>y[4]||(y[4]=[pe("推流地址")])),_:1})]),actions:G(()=>[L("div",_p,[y[5]||(y[5]=L("div",null,"流标识",-1)),I(x(_n),{type:"text",class:"w-120px",value:r.value,"onUpdate:value":y[0]||(y[0]=g=>r.value=g),size:"small"},null,8,["value"]),I(x(No),{checked:t.value,"onUpdate:checked":y[1]||(y[1]=g=>t.value=g),loading:n.value,size:"small"},null,8,["checked","loading"])])]),default:G(()=>[I(x(Ie),{type:"source",position:x(q).Right},null,8,["position"]),f.value?(Z(),re("video",{key:0,id:"video",width:"224",height:"168",style:{"border-radius":"6px","object-fit":"cover"},autoplay:"",muted:"",srcObject:f.value},null,8,mp)):(Z(),re("span",yp,y[3]||(y[3]=[pe(" 可以通过 OBS、ffmpeg等推流器工具将本地流推送到服务器, 然后通过播放器播放 "),L("br",null,null,-1),pe(" 点击右下角开关,将采集您的摄像头使用 WebRTC 推流到服务器。 ")])))]),_:1}))}}),bp=["src"],Sp=se({__name:"debug-chart",props:{data:{}},setup(e){const t=wt("debug","/charts"),n=e,o=()=>{n.data.onClose()};return(i,r)=>(Z(),ge(x(Fe),{size:"small",title:"性能观测",class:"w-800px h-600px drop-shadow-xl relative","body-style":{top:"40px",bottom:0,position:"absolute",left:0,right:0,padding:0}},{extra:G(()=>[I(x(Se),{type:"link",onClick:o},{default:G(()=>[I(x(Bi),{class:"ml-1 text-gray-400"})]),_:1})]),default:G(()=>[L("iframe",{src:x(t),class:"w-full h-full",style:{border:"none"}},null,8,bp)]),_:1}))}}),Ep={class:"flex items-center"},Cp={class:"flex items-center justify-end pr-5"},Np=se({__name:"log-trail",props:{data:{}},setup(e){const t=K(null),n=K(!0),o=K(""),i=K(null);Xe(()=>{t.value=new EventSource(wt("logrotate")+"/trail"),t.value.onmessage=u=>{a.value.push(u.data),n.value&&je(()=>{var l,c;(c=i.value)==null||c.scrollTo({top:(l=i.value)==null?void 0:l.scrollHeight,behavior:"smooth"})})}}),Mn(()=>{var u;(u=t.value)==null||u.close()});const r=e,a=K([]),s=()=>{r.data.onClose()};return(u,l)=>(Z(),ge(x(Fe),{size:"small",title:"日志",class:"w-700px drop-shadow-2xl"},{extra:G(()=>[I(x(Se),{type:"link",onClick:s},{default:G(()=>[I(x(Bi),{class:"ml-1 text-gray-400"})]),_:1})]),actions:G(()=>[L("div",Ep,[l[2]||(l[2]=L("div",{class:"mr-2 ml-2 w-50px"},"过滤",-1)),I(x(_n),{value:o.value,"onUpdate:value":l[0]||(l[0]=c=>o.value=c),size:"small"},null,8,["value"])]),L("div",Cp,[l[3]||(l[3]=L("div",{class:"mr-2 ml-2 w-100px"},"自动滚动",-1)),I(x(No),{checked:n.value,"onUpdate:checked":l[1]||(l[1]=c=>n.value=c),size:"small"},null,8,["checked"])])]),default:G(()=>[L("div",{class:"h-400px w-full overflow-auto",ref_key:"logContainer",ref:i},[(Z(!0),re(Ve,null,Pn(o.value?a.value.filter(c=>c.includes(o.value)):a.value,(c,d)=>(Z(),re("div",{key:d},ke(c),1))),128))],512)]),_:1}))}}),kp={class:"flex flex-col gap-2"},$p={key:0,class:"flex items-center gap-2 mb-2"},Ip={key:2,class:"text-12px"},Pp={class:"flex items-center justify-between pl-10px pr-10px"},Mp=se({name:"Pusher"}),Tp=se({...Mp,props:{data:{}},setup(e){const t=K("ws-flv"),n=K("live/test"),o=K(""),i=K(!1),r=K(!1),a=K([]),s=e;ao().then(d=>{a.value=[{title:"live/test",value:"live/test"}].concat(d.filter(f=>f.path!=="live/test").map(f=>({title:f.path,value:f.path})))});function u(d){r.value=!1,typeof d=="string"&&(Ht.error({message:"播放结束",description:d}),i.value=!1)}function l(d){ao().then(f=>{a.value=[{title:d,value:d}].concat(f.map(_=>({title:_.path,value:_.path})))})}Tn(()=>{s.data.onPlay(i.value),i.value?(r.value=!0,o.value=n.value):o.value=""});async function c(){const d=K({useLocalIP:"localhost",secretKey:"",expireTime:Ae().add(1,"hour")});Be.info({title:"播放地址",width:800,content:()=>{const f=m=>{if(!d.value.secretKey||!d.value.expireTime)return"";const v=Math.floor(d.value.expireTime.unix()).toString(16),p=qr(d.value.secretKey+n.value+v).toString();return(m.includes("?")?"&":"?")+`secret=${p}&expire=${v}`},_=[];for(const m of s.data.plugins){const v=m.playAddr;if(v)for(const p of v){const y=p.replace("{hostName}",d.value.useLocalIP).replace("{streamPath}",n.value);_.push({protocol:p.startsWith("http")?m.name.toLocaleLowerCase():p.split(":")[0],path:y+f(y)})}}return _.length?[I(ro,{value:d.value.useLocalIP,onChange:m=>d.value.useLocalIP=m.target.value},{default:()=>[I(Xt("Radio"),{value:"localhost"},{default:()=>[pe("使用localhost")]}),I(Xt("Radio"),{value:s.data.sysInfo.publicIP},{default:()=>[pe("使用公网IP")]}),I(Xt("Radio"),{value:s.data.sysInfo.localIP},{default:()=>[pe("使用内网IP")]})]}),I(ze,{layout:"inline"},{default:()=>[I(ze.Item,null,{default:()=>[I("span",null,[pe("秘钥"),I(Oi,{title:"需要匹配配置文件中 subscribe 下的 key 配置"},{default:()=>[I(st,{style:"margin-left: 4px"},null)]})]),I(_n,{type:"text",placeholder:"请输入秘钥",class:"w-250px",style:"margin-bottom: 10px",value:d.value.secretKey,onChange:m=>d.value.secretKey=m.target.value},null)]}),I(ze.Item,{label:"过期时间"},{default:()=>[I(Ri,{placeholder:"选择过期时间",showTime:!0,class:"w-250px",style:"margin-bottom: 10px",value:d.value.expireTime,onChange:m=>d.value.expireTime=m},null)]})]}),I(Re,{dataSource:_,columns:[{title:"协议",dataIndex:"protocol"},{title:"播放地址",dataIndex:"path"}],pagination:!1,size:"small"},null)]:I("span",null,[pe("请先启用一些插件,如:rtmp、rtsp 插件")])}})}return(d,f)=>(Z(),ge(x(Fe),{size:"small",class:"w-250px drop-shadow-xl"},{title:G(()=>[f[3]||(f[3]=L("span",null,"播放器",-1)),i.value?(Z(),ge(x(Et),{key:0,title:"帮助",content:"播放器可以播放服务器上的流,例如使用 vlc、ffplay等播放器播放,Web 端可以使用 Jessibuca 播放器。"},{default:G(()=>[I(x(Se),{type:"link",size:"small"},{default:G(()=>[I(x(st),{class:"ml-1 text-gray-400"})]),_:1})]),_:1})):Te("",!0)]),extra:G(()=>[I(x(Se),{type:"link",onClick:c},{default:G(()=>f[7]||(f[7]=[pe("播放地址")])),_:1})]),actions:G(()=>[L("div",Pp,[f[8]||(f[8]=L("div",null,"流标识",-1)),I(x(Tt),{class:"w-120px",showSearch:"",value:n.value,"onUpdate:value":f[1]||(f[1]=_=>n.value=_),options:a.value,onSearch:l,size:"small"},null,8,["value","options"]),I(x(No),{checked:i.value,"onUpdate:checked":f[2]||(f[2]=_=>i.value=_),loading:r.value,size:"small"},null,8,["checked","loading"])])]),default:G(()=>[I(x(Ie),{type:"source",position:x(q).Left},null,8,["position"]),L("div",kp,[i.value?(Z(),re("div",$p,[I(x(ro),{value:t.value,"onUpdate:value":f[0]||(f[0]=_=>t.value=_),size:"small"},{default:G(()=>[I(x(Bo),{value:"ws-flv"},{default:G(()=>f[4]||(f[4]=[pe("WS-FLV")])),_:1}),I(x(Bo),{value:"webrtc"},{default:G(()=>f[5]||(f[5]=[pe("WebRTC")])),_:1})]),_:1},8,["value"])])):Te("",!0),i.value?(Z(),ge(Va,{key:1,streamPath:o.value,format:t.value,onPlay:u,class:"flex-1 m-r-10px w-224px h-168px"},null,8,["streamPath","format"])):(Z(),re("span",Ip,f[6]||(f[6]=[pe(" 播放器可以播放服务器上的流,例如使用 vlc、ffplay等播放器播放,Web 端可以使用 Jessibuca 播放器。 "),L("br",null,null,-1),pe(" 点击右下角开关,将使用 Web 播放技术播放服务器上的流。 ")])))])]),_:1}))}}),Dp={key:1,class:"text-12px"},Ap=se({name:"Remote"}),zp=se({...Ap,setup(e){const{pause:t,resume:n}=nt(r),o=K([]),i=K([{title:"名称",dataIndex:"name"},{title:"状态",dataIndex:"status",customRender:({record:a})=>a.status?"在线":"离线"}]);function r(){return za().then(a=>{o.value=a}).catch(a=>{console.error(`stream-proxy-getList-error: ${a}`)})}return r(),(a,s)=>(Z(),ge(x(Fe),{size:"small",class:"w-250px drop-shadow-xl"},{title:G(()=>[s[1]||(s[1]=L("span",null,"远端服务器或CDN",-1)),o.value.length?(Z(),ge(x(Et),{key:0,title:"帮助",content:"可以将流转推到远端服务器如云端服务器、CDN 等"},{default:G(()=>[I(x(Se),{type:"link",size:"small"},{default:G(()=>[I(x(st),{class:"ml-1 text-gray-400"})]),_:1})]),_:1})):Te("",!0)]),extra:G(()=>[I(x(Se),{type:"link",onClick:s[0]||(s[0]=u=>x(Ha)({updateList:r,pause:x(t),resume:x(n)}))},{default:G(()=>s[2]||(s[2]=[pe("添加")])),_:1})]),default:G(()=>[I(x(Ie),{type:"target",position:x(q).Left},null,8,["position"]),o.value.length?(Z(),ge(x(Re),{key:0,"data-source":o.value,columns:i.value,size:"small",pagination:!1,bordered:""},null,8,["data-source","columns"])):(Z(),re("span",Dp," 转推功能:将流推送到远端服务器或 CDN 等。 点击右上角按钮,可以添加转推代理 "))]),_:1}))}}),Op={key:1},Rp={key:1,class:"text-12px"},Bp=se({name:"ReadRecord"}),Fp=se({...Bp,props:{data:{}},setup(e){const t=e,n=K([]),o=ue(()=>t.data.plugins.some(m=>m.name==="MP4"||m.name==="FLV"));function i(m){const v=new Date(m.startTime),y=new Date(m.endTime).getTime()-v.getTime(),g=y/(36e5*24)>>0,h=(y/36e5>>0)%24,w=(y/6e4>>0)%60,A=(y/1e3>>0)%60;return`${g?`${g}d`:""}${h?`${h}h`:""}${w}'${A}"`}const r=K([{title:"路径",dataIndex:"filePath",customRender:({text:m,record:v})=>I("div",{class:"flex items-center justify-between"},[I("span",{class:"flex-1"},[m]),I("div",{class:"flex gap-2"},[I(fa,{class:"cursor-pointer text-blue-500 hover:text-blue-600",onClick:()=>{_(`${wt(v.type.toLowerCase(),"/download")}/${v.streamPath}?id=${v.id}`,`${v.streamPath}-${v.id}.${v.type.toLowerCase()}`)}},null),I(ha,{class:"cursor-pointer text-red-500 hover:text-red-600",onClick:()=>{Be.confirm({title:"确认删除",content:"确定要删除这条录像记录吗?",onOk:()=>Ya({type:v.type.toLowerCase(),id:v.id}).then(()=>{const p=n.value.find(y=>y.streamPath===v.streamPath);p&&loadDetailRecords(p,pagination.value)})})}},null)])])},{title:"开始时间",dataIndex:"startTime",customRender:({text:m})=>Ae(m).format("YYYY-MM-DD HH:mm:ss")},{title:"结束时间",dataIndex:"endTime",customRender:({text:m})=>Ae(m).format("YYYY-MM-DD HH:mm:ss")},{title:"时长",customRender:({record:m})=>i(m)}]),a=K([{title:"流路径",dataIndex:"streamPath",customRender:({text:m,record:v})=>{const p=K([]),y=K({current:1,pageSize:10,total:0,onChange:(h,w)=>{y.value.current=h,y.value.pageSize=w,g(v,y.value)},showTotal:h=>`共 ${h} 条`});function g(h,w){return Li({streamPath:h.streamPath,type:h.type.toLowerCase(),pageNum:w.current,pageSize:w.pageSize}).then(A=>{p.value=Array.isArray(A)?A:A.list||[],y.value.total=Array.isArray(A)?A.length:A.total||0})}return I("div",{class:"cursor-pointer",onClick:()=>{g(v,y.value),Be.info({title:`${v.streamPath}录像文件列表`,content:()=>I(Re,{dataSource:p.value,columns:r.value,pagination:y.value,size:"small",bordered:!0},null),width:1e3})}},[m,I(pa,{style:{marginLeft:"8px",cursor:"pointer"}},null)])}},{title:"时长",customRender:({record:m})=>i(m)},{title:"类型",dataIndex:"type"}]),{pause:s,resume:u}=nt(d),l=K([]),c=[0,0];function d(){return Promise.all([wn("mp4").catch(m=>(console.error(`mp4-record-catalog-error: ${m}`),[])),wn("flv").catch(m=>(console.error(`flv-record-catalog-error: ${m}`),[]))]).then(([m,v])=>{const p=[...m.map(y=>({...y,type:"MP4"})),...v.map(y=>({...y,type:"FLV"}))];n.value=p,l.value=[...new Set(p.map(y=>y.streamPath))],p.length>0&&(c[0]=Math.min(...p.map(y=>new Date(y.startTime).getTime())),c[1]=Math.max(...p.map(y=>new Date(y.endTime).getTime())))})}const f=()=>{const m=K(l.value[0]),v=K("MP4"),p=K([Ae(c[0]),Ae(c[1])]);Be.confirm({title:"录像下载",width:500,content:()=>I("div",null,[I(ze,{layout:"vertical"},{default:()=>[I(ze.Item,{label:"流路径",required:!0},{default:()=>[I(Tt,{value:m.value,onChange:y=>m.value=y,options:l.value.map(y=>({label:y,value:y}))},null)]}),I(ze.Item,{label:"类型",required:!0},{default:()=>[I(Tt,{value:v.value,onChange:y=>v.value=y,options:[{label:"MP4",value:"MP4"},{label:"FLV",value:"FLV"}]},null)]}),I(ze.Item,{label:"时间范围",required:!0},{default:()=>[I(Fi,{disabledDate:y=>{const g=n.value.find(h=>h.streamPath===m.value&&h.type===v.value);return y&&(y<Ae(g==null?void 0:g.startTime)||y>Ae(g==null?void 0:g.endTime))},value:p.value,onChange:y=>p.value=y,showTime:!0,format:"YYYY-MM-DD HH:mm:ss"},null)]})]})]),onOk:()=>{if(!m.value||!p.value[0]||!p.value[1])return Promise.reject("请填写完整信息");const y=`${Ae(p.value[0]).valueOf()}-${Ae(p.value[1]).valueOf()}`;return _(`${wt(v.value.toLowerCase(),"/download")}/${m.value}?range=${y}`,`${m.value}-${p.value[0].format("YYYYMMDDHHmmss")}-${p.value[1].format("YYYYMMDDHHmmss")}.${v.value.toLowerCase()}`),Promise.resolve()}})};function _(m,v){const p=document.createElement("a");p.href=m,p.target="_blank",p.download=v,document.body.appendChild(p),p.click(),document.body.removeChild(p)}return _e(o,m=>{m?(d(),u()):(s(),n.value=[],l.value=[],c[0]=0,c[1]=0)},{immediate:!0}),(m,v)=>(Z(),ge(x(Fe),{size:"small",class:"w-250px drop-shadow-xl"},{title:G(()=>[v[0]||(v[0]=L("span",null,"录像读取",-1)),n.value.length?(Z(),ge(x(Et),{key:0,title:"帮助",content:"录像读取节点用于查询和管理录像文件,可以将录像转换为实时流"},{default:G(()=>[I(x(Se),{type:"link",size:"small"},{default:G(()=>[I(x(st),{class:"ml-1 text-gray-400"})]),_:1})]),_:1})):Te("",!0)]),extra:G(()=>[o.value?(Z(),ge(x(Se),{key:0,type:"link",onClick:f},{default:G(()=>v[1]||(v[1]=[pe(" 下载 ")])),_:1})):(Z(),re("span",Op," 请先启用MP4或FLV插件 "))]),default:G(()=>[I(x(Ie),{type:"source",position:x(q).Right},null,8,["position"]),n.value.length?(Z(),ge(x(Re),{key:0,"data-source":n.value,columns:a.value,size:"small",pagination:!1,bordered:""},null,8,["data-source","columns"])):(Z(),re("span",Rp," 录像读取功能:查询和管理录像文件,可以将录像转换为实时流。 点击右上角按钮,可以下载录像段 "))]),_:1}))}}),Lp={key:1},Vp={key:1,class:"text-12px"},Hp=se({name:"PlayRecord"}),Yp=se({...Hp,props:{data:{}},setup(e){const t=K(null),n=K([]),o=K(),i=K([]),r=K("mp4"),a=e,s=ue(()=>a.data.plugins.some(l=>l.name==="MP4"||l.name==="FLV")),u=async()=>{var _;if(i.value.length){i.value=[];return}const[l,c]=await Promise.all([wn("mp4").catch(()=>[]),wn("flv").catch(()=>[])]),d=[...l.map(m=>({...m,type:"mp4"})),...c.map(m=>({...m,type:"flv"}))];if(d.length===0){Be.warning({title:"提示",content:"没有可用的录像记录"});return}n.value=[...new Set(d.map(m=>m.streamPath))].map(m=>({label:m,value:m})),o.value=n.value[0].value,r.value=((_=d.find(m=>m.streamPath===o.value))==null?void 0:_.type)||"mp4";let f=K([Ae(d[0].startTime),Ae(d[0].endTime)]);Be.confirm({title:"播放录像",width:500,content:()=>I("div",null,[I(ze,{layout:"vertical"},{default:()=>[I(ze.Item,{label:"流路径",required:!0},{default:()=>[I(Tt,{value:o.value,onChange:m=>{var v;o.value=m,r.value=((v=d.find(p=>p.streamPath===m))==null?void 0:v.type)||"mp4"},placeholder:"请选择流路径",options:n.value},null)]}),I(ze.Item,{label:"类型",required:!0},{default:()=>[I(Tt,{value:r.value,onChange:m=>r.value=m,options:[{label:"MP4",value:"mp4"},{label:"FLV",value:"flv"}]},null)]}),I(ze.Item,{label:"播放时间范围",required:!0},{default:()=>[I(Fi,{value:f.value,disabledDate:m=>{const v=d.find(p=>p.streamPath===o.value&&p.type===r.value);return m&&(m<Ae(v==null?void 0:v.startTime)||m>Ae(v==null?void 0:v.endTime))},onChange:m=>f.value=m,showTime:!0,format:"YYYY-MM-DD HH:mm:ss"},null)]})]})]),onOk:async()=>{var m,v;if(!((m=f.value)!=null&&m[0])||!((v=f.value)!=null&&v[1]))return Promise.reject("请选择时间范围");i.value=await Li({streamPath:o.value,type:r.value,range:`${f.value[0].unix()}-${f.value[1].unix()}`})}})};return(l,c)=>(Z(),ge(x(Fe),{size:"small",class:"w-250px drop-shadow-xl"},{title:G(()=>[c[0]||(c[0]=L("span",null,"录像播放",-1)),t.value?(Z(),ge(x(Et),{key:0,title:"帮助",content:"录像播放节点用于播放录像文件,可以选择时间范围进行回放"},{default:G(()=>[I(x(Se),{type:"link",size:"small"},{default:G(()=>[I(x(st),{class:"ml-1 text-gray-400"})]),_:1})]),_:1})):Te("",!0)]),extra:G(()=>[s.value?(Z(),ge(x(Se),{key:0,type:"link",onClick:u},{default:G(()=>[pe(ke(i.value.length?"停止":"播放"),1)]),_:1})):(Z(),re("span",Lp," 请先启用MP4或FLV插件 "))]),default:G(()=>[I(x(Ie),{type:"target",position:x(q).Left},null,8,["position"]),i.value.length?(Z(),ge(Ga,{key:0,src:`${x(wt)("hls","/vod")}/fmp4.m3u8?start=${new Date(i.value[0].startTime).getTime()}&streamPath=${o.value}`},null,8,["src"])):(Z(),re("span",Vp," 录像播放功能:选择录像文件和时间范围进行回放。 点击右上角按钮,可以选择录像进行播放 "))]),_:1}))}}),Gp={key:0,class:"p-8px"},Up={key:1,class:"text-12px"},Xp=se({name:"Upstream"}),Wp=se({...Xp,setup(e){const t=Dn(),{nodeHistory:n}=Mt(t),o=[{title:"M7S ID",dataIndex:"m7sId",key:"m7sId"},{title:"IP",dataIndex:"ip",key:"ip"}];return(i,r)=>(Z(),ge(x(Fe),{size:"small",class:"w-500px drop-shadow-xl"},{title:G(()=>r[0]||(r[0]=[L("span",null,"上级节点",-1)])),extra:G(()=>[I(x(Se),{disabled:!x(n).length,type:"link",size:"small",onClick:x(t).removeLastNode},{default:G(()=>r[1]||(r[1]=[pe(" 返回上一级 ")])),_:1},8,["disabled","onClick"])]),default:G(()=>[I(x(Ie),{type:"source",position:x(q).Bottom},null,8,["position"]),x(n).length?(Z(),re("div",Gp,[I(x(Re),{columns:o,"data-source":x(n),size:"small",pagination:!1},null,8,["data-source"])])):(Z(),re("span",Up," 点击右上角按钮,可以返回上级节点 "))]),_:1}))}}),Wn=Fa({requestOptions:{apiUrl:()=>wt("cascadeserver")}});function Kp(){return Wn.get({url:"/list"})}function Zp(e){return Wn.post({url:"/create",data:e})}function qp(e){return Wn.post({url:`/delete/${e.id}`})}function jp(e){return Wn.post({url:"/update",data:e})}const Jp={key:0},Qp={key:0,class:"p-8px"},ev={key:1,class:"text-12px"},tv={key:1,class:"p-16px text-center text-gray-500"},nv=se({name:"Downstream"}),ov=se({...nv,props:{data:{default:()=>({active:!1})}},setup(e){const t=e,n=K([]);K(!1),K();const o=()=>({type:"object",properties:{name:{type:"string",title:"节点名称",required:!0,"x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:"请输入节点名称"},"x-validator":[{required:!0,message:"请输入节点名称"},{max:50,message:"节点名称不能超过50个字符"}]},secret:{type:"string",title:"密钥","x-decorator":"FormItem","x-component":"Password","x-component-props":{placeholder:"请输入密钥"},"x-validator":[{message:"请输入密钥"}]}}}),i=async d=>{try{await qp(d),Ye.success("删除成功"),u()}catch(f){Ye.error("删除失败:"+f.message)}},r=zi(),a=[{title:"名称",dataIndex:"name",key:"name",customRender:({record:d})=>d.online?I(Se,{type:"link",size:"small",onClick:()=>{r({name:"Home",params:{m7sId:d.id}})}},{default:()=>[d.name]}):d.name},{title:"IP",dataIndex:"ip",key:"ip"},{title:"状态",key:"status",width:100,customRender:({record:d})=>d.online?"已连接":"未连接"},{title:"操作",key:"action",width:100,customRender:({record:d})=>I(ga,null,{default:()=>[I(Se,{type:"link",size:"small",onClick:()=>s(d)},{default:()=>[pe("修改")]}),I(va,{title:"确定要删除该节点吗?",onConfirm:()=>i(d)},{default:()=>[I(Se,{type:"link",size:"small",danger:!0},{default:()=>[pe("删除")]})]})]})}],s=d=>{const f=!!d,_=d||{id:Date.now(),name:"",ip:"",secret:"",online:!1},{FormilyForm:m,form:v,submit:p}=ma({schema:o(),formProps:{initialValues:_}});ya({content:()=>I(m,null,null),modalConfig:{title:f?"修改下级节点":"添加下级节点",maskClosable:!1,width:500,onOk:async()=>{try{const y=await p(),g={..._,...y};if(g.online)return Promise.reject("请先断开当前连接");f?(await jp(g),Ye.success("修改成功")):(await Zp(g),Ye.success("添加成功")),u()}catch(y){return y===!1?Promise.reject(!1):(Ye.error((f?"修改":"添加")+"失败:"+y.message),Promise.reject(y))}},onClose:()=>{v.reset()}}})};async function u(){if(t.data.active)try{n.value=await Kp()}catch(d){Ye.error("获取下级节点列表失败:"+d.message)}}const{pause:l,resume:c}=nt(u);return l(),_e(()=>t.data.active,d=>{d?(u(),c()):(n.value=[],l())}),Xe(()=>{t.data.active&&(u(),c())}),(d,f)=>(Z(),ge(x(Fe),{size:"small",class:"w-500px drop-shadow-xl"},{title:G(()=>[f[1]||(f[1]=L("span",null,"下级节点",-1)),I(x(Et),{title:"帮助",content:"下级节点用于配置下级服务器地址,下级节点可以从其上级节点拉流"},{default:G(()=>[I(x(Se),{type:"link",size:"small"},{default:G(()=>[I(x(st),{class:"ml-1 text-gray-400"})]),_:1})]),_:1})]),extra:G(()=>[I(x(Se),{type:"link",size:"small",onClick:f[0]||(f[0]=_=>s()),disabled:!t.data.active},{default:G(()=>f[2]||(f[2]=[pe("添加节点")])),_:1},8,["disabled"])]),default:G(()=>[I(x(Ie),{type:"target",position:x(q).Top},null,8,["position"]),t.data.active?(Z(),re("div",Jp,[n.value.length?(Z(),re("div",Qp,[I(x(Re),{columns:a,"data-source":n.value,size:"small",pagination:!1},null,8,["data-source"])])):(Z(),re("span",ev," 下级节点功能:配置下级服务器地址,下级节点可以从其上级节点拉流。 点击右上角按钮,可以添加下级节点 "))])):(Z(),re("div",tv," 服务器需要启用 CascadeServer 插件 "))]),_:1}))}}),iv={class:"text-text"},rv=se({__name:"flow",setup(e){const t={instance:De(up),pullProxy:De(fp),pusher:De(xp),debugChart:De(Sp),logTrail:De(Np),preview:De(Tp),pushProxy:De(zp),readRecord:De(Fp),playRecord:De(Yp),upstream:De(Wp),downstream:De(ov)},n=K(!1),o=K(!1),i=K(!1),r=K(!1),a=Dn(),{online:s}=Mt(a);ua((d,f,_)=>{d.params.m7sId!==f.params.m7sId&&(i.value=!1,r.value=!1,n.value=!1,o.value=!1,_())});const u=ue(()=>({id:"center",type:"instance",data:{onShowDebugChart:()=>{i.value=!0},onShowLogTrail:()=>{r.value=!0}},position:{x:400,y:300}})),l=ue(()=>s.value?[...i.value?[{id:"debugChart",position:{x:100,y:100},data:{onClose:()=>{i.value=!1}},type:"debugChart",zIndex:1e3}]:[],...r.value?[{id:"logTrail",position:{x:100,y:300},type:"logTrail",data:{onClose:()=>{r.value=!1}},zIndex:1001}]:[],{id:"pullProxy",position:{x:50,y:100},targetPosition:q.Right,data:{plugins:a.plugins},type:"pullProxy"},{id:"pushProxy",position:{x:1e3,y:100},data:{plugins:a.plugins},sourcePosition:q.Left,type:"pushProxy"},{id:"pusher",position:{x:50,y:350},data:{plugins:a.plugins,onPush:d=>{n.value=d}},targetPosition:q.Right,type:"pusher"},{id:"player",position:{x:1e3,y:350},data:{plugins:a.plugins,sysInfo:a.sysInfo,onPlay:d=>{o.value=d}},sourcePosition:q.Left,type:"preview"},{id:"upstream",type:"upstream",position:{x:400,y:100},data:{plugins:a.plugins}},{id:"downstream",type:"downstream",position:{x:400,y:700},data:{plugins:a.plugins,active:a.plugins.some(d=>d.name==="CascadeServer")||!1}},u.value,{id:"readRecord",type:"readRecord",data:{plugins:a.plugins},position:{x:50,y:700},targetPosition:q.Right},{id:"playRecord",type:"playRecord",data:{plugins:a.plugins},position:{x:1e3,y:700},sourcePosition:q.Left}]:[u.value]),c=ue(()=>s.value?[{id:"e1->center",source:"pullProxy",target:"center",targetHandle:"target-pull",animated:!0},{id:"epusher->center",source:"pusher",target:"center",targetHandle:"target-push",animated:!0,style:n.value?{stroke:"#000",border:"2px",filter:"drop-shadow(0 0 2px cyan)"}:void 0},{id:"center->pushProxy",source:"center",target:"pushProxy",sourceHandle:"source-push",animated:!0},{id:"center->player",source:"center",target:"player",sourceHandle:"source-play",animated:!0,style:o.value?{stroke:"#000",border:"2px",filter:"drop-shadow(0 0 2px cyan)"}:void 0},{id:"e2->center",source:"upstream",target:"center",targetHandle:"upstream"},{id:"e3->center",source:"center",target:"downstream",sourceHandle:"downstream"},{id:"readRecord->center",source:"readRecord",target:"center",targetHandle:"target-read",animated:!0},{id:"center->playRecord",source:"center",target:"playRecord",sourceHandle:"source-read",animated:!0}]:[]);return(d,f)=>(Z(),re(Ve,null,[L("h2",iv,[f[1]||(f[1]=pe(" SagooMedia Admin 超级面板 ")),I(x(Di),{color:"green",class:"text-10px v-text-bottom"},{default:G(()=>f[0]||(f[0]=[pe("For SagooIoT m7s Pro V5")])),_:1})]),I(x(Lf),{style:{position:"unset"},nodes:l.value,"node-types":t,edges:c.value,"zoom-on-scroll":!1,"pan-on-drag":!0,"zoom-on-double-click":!1,"nodes-connectable":!1,"select-nodes-on-drag":!1,"connect-on-click":!1,"elements-selectable":!1},{default:G(()=>[I(x(Wf))]),_:1},8,["nodes","edges"])],64))}});const av={class:"h-100vh w-100vw p-10px",style:{background:"var(--layout-background)"}},sv={class:"h-full w-full flex min-w-1200px"},lv=se({name:"Instance"}),$v=se({...lv,setup(e){Mt(_a());const t=La();return Mt(t),(n,o)=>(Z(),re("div",av,[L("div",sv,[I(x(Fe),{class:"flex-1 rounded-r-lg",bodyStyle:{height:"100%"}},{default:G(()=>[I(rv)]),_:1})])]))}});export{$v as default};
|