fischer-agentkit/src/agentkit/server/static/assets/WorkflowView-Dv5wD9j5.js

27 lines
198 KiB
JavaScript

import{c as z,I as _t,a1 as na,r as me,f as te,d as we,o as O,a as J,b as ne,F as De,j as qt,k as ve,g as He,l as dt,t as Ne,B as Ue,h as $e,n as Xe,e as D,a2 as oa,a3 as Se,a4 as ia,$ as Oi,w as ue,y as It,a5 as Ti,i as Ee,a6 as ra,C as et,Q as Ai,a7 as aa,m as fe,G as at,a8 as Pt,a9 as zi,aa as dn,ab as pe,z as kt,ac as xe,M as la,ad as go,L as sa,ae as ua,af as ca,ag as lt,ah as Bi,ai as da,aj as Vi,X as Oe,a0 as $n,ak as Cn,al as Mn,am as fa,an as qe,W as Hi,Y as ha}from"./index-gqpFY6Qt.js";import{B as va}from"./base-DPp00EV9.js";import{T as Ri,U as Li}from"./UserOutlined-CvCrh-WB.js";import{_ as ct}from"./_plugin-vue_export-helper-Da7nhmaa.js";import{T as po}from"./index-RLKibtJr.js";import{S as ga}from"./index-DoEPe2JM.js";import{B as mo}from"./index-YXX8X6VB.js";import{D as yo,_ as pa}from"./DeleteOutlined-BZTTXnow.js";import{F as Fi,_ as Yi}from"./index-Dd95JYlE.js";import{I as ma,_ as Gi,P as ya}from"./index-KxFPh2gJ.js";import{_ as wa,U as _a}from"./index-D4egOf7T.js";import{D as ba}from"./Dropdown-XbNR4d_F.js";import{S as xa}from"./index-DwzKHBT7.js";import{M as Ea}from"./index-gcNyH-By.js";import"./zoom-BFNOWbJv.js";import"./styleChecker-B3mut-jB.js";import"./FolderOpenOutlined-DjFpnogK.js";import"./responsiveObserve-CWMCg4ra.js";import"./index-BEjLgAar.js";import"./pickAttrs-Ko_UXWn6.js";import"./LeftOutlined-CBUjbbRo.js";import"./FormItemContext-C7YeCp9s.js";import"./index-ldpn1699.js";import"./Checkbox-BKRvy9FI.js";import"./index-DDQQQHWy.js";var Sa={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M872 474H286.9l350.2-304c5.6-4.9 2.2-14-5.2-14h-88.5c-3.9 0-7.6 1.4-10.5 3.9L155 487.8a31.96 31.96 0 000 48.3L535.1 866c1.5 1.3 3.3 2 5.2 2h91.5c7.4 0 10.8-9.2 5.2-14L286.9 550H872c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"arrow-left",theme:"outlined"};function zo(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?Object(arguments[t]):{},o=Object.keys(n);typeof Object.getOwnPropertySymbols=="function"&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable}))),o.forEach(function(i){Na(e,i,n[i])})}return e}function Na(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var wo=function(t,n){var o=zo({},t,n.attrs);return z(_t,zo({},o,{icon:Sa}),null)};wo.displayName="ArrowLeftOutlined";wo.inheritAttrs=!1;var ka={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M740 161c-61.8 0-112 50.2-112 112 0 50.1 33.1 92.6 78.5 106.9v95.9L320 602.4V318.1c44.2-15 76-56.9 76-106.1 0-61.8-50.2-112-112-112s-112 50.2-112 112c0 49.2 31.8 91 76 106.1V706c-44.2 15-76 56.9-76 106.1 0 61.8 50.2 112 112 112s112-50.2 112-112c0-49.2-31.8-91-76-106.1v-27.8l423.5-138.7a50.52 50.52 0 0034.9-48.2V378.2c42.9-15.8 73.6-57 73.6-105.2 0-61.8-50.2-112-112-112zm-504 51a48.01 48.01 0 0196 0 48.01 48.01 0 01-96 0zm96 600a48.01 48.01 0 01-96 0 48.01 48.01 0 0196 0zm408-491a48.01 48.01 0 010-96 48.01 48.01 0 010 96z"}}]},name:"branches",theme:"outlined"};function Bo(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?Object(arguments[t]):{},o=Object.keys(n);typeof Object.getOwnPropertySymbols=="function"&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable}))),o.forEach(function(i){$a(e,i,n[i])})}return e}function $a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Dn=function(t,n){var o=Bo({},t,n.attrs);return z(_t,Bo({},o,{icon:ka}),null)};Dn.displayName="BranchesOutlined";Dn.inheritAttrs=!1;var Ca={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm176.5 585.7l-28.6 39a7.99 7.99 0 01-11.2 1.7L483.3 569.8a7.92 7.92 0 01-3.3-6.5V288c0-4.4 3.6-8 8-8h48.1c4.4 0 8 3.6 8 8v247.5l142.6 103.1c3.6 2.5 4.4 7.5 1.8 11.1z"}}]},name:"clock-circle",theme:"filled"};function Vo(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?Object(arguments[t]):{},o=Object.keys(n);typeof Object.getOwnPropertySymbols=="function"&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable}))),o.forEach(function(i){Ma(e,i,n[i])})}return e}function Ma(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ot=function(t,n){var o=Vo({},t,n.attrs);return z(_t,Vo({},o,{icon:Ca}),null)};Ot.displayName="ClockCircleFilled";Ot.inheritAttrs=!1;var Da={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M752 100c-61.8 0-112 50.2-112 112 0 47.7 29.9 88.5 72 104.6v27.6L512 601.4 312 344.2v-27.6c42.1-16.1 72-56.9 72-104.6 0-61.8-50.2-112-112-112s-112 50.2-112 112c0 50.6 33.8 93.5 80 107.3v34.4c0 9.7 3.3 19.3 9.3 27L476 672.3v33.6c-44.2 15-76 56.9-76 106.1 0 61.8 50.2 112 112 112s112-50.2 112-112c0-49.2-31.8-91-76-106.1v-33.6l226.7-291.6c6-7.7 9.3-17.3 9.3-27v-34.4c46.2-13.8 80-56.7 80-107.3 0-61.8-50.2-112-112-112zM224 212a48.01 48.01 0 0196 0 48.01 48.01 0 01-96 0zm336 600a48.01 48.01 0 01-96 0 48.01 48.01 0 0196 0zm192-552a48.01 48.01 0 010-96 48.01 48.01 0 010 96z"}}]},name:"fork",theme:"outlined"};function Ho(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?Object(arguments[t]):{},o=Object.keys(n);typeof Object.getOwnPropertySymbols=="function"&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable}))),o.forEach(function(i){Ia(e,i,n[i])})}return e}function Ia(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var _o=function(t,n){var o=Ho({},t,n.attrs);return z(_t,Ho({},o,{icon:Da}),null)};_o.displayName="ForkOutlined";_o.inheritAttrs=!1;var Pa={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"defs",attrs:{},children:[{tag:"style",attrs:{}}]},{tag:"path",attrs:{d:"M640.6 429.8h257.1c7.9 0 14.3-6.4 14.3-14.3V158.3c0-7.9-6.4-14.3-14.3-14.3H640.6c-7.9 0-14.3 6.4-14.3 14.3v92.9H490.6c-3.9 0-7.1 3.2-7.1 7.1v221.5h-85.7v-96.5c0-7.9-6.4-14.3-14.3-14.3H126.3c-7.9 0-14.3 6.4-14.3 14.3v257.2c0 7.9 6.4 14.3 14.3 14.3h257.1c7.9 0 14.3-6.4 14.3-14.3V544h85.7v221.5c0 3.9 3.2 7.1 7.1 7.1h135.7v92.9c0 7.9 6.4 14.3 14.3 14.3h257.1c7.9 0 14.3-6.4 14.3-14.3v-257c0-7.9-6.4-14.3-14.3-14.3h-257c-7.9 0-14.3 6.4-14.3 14.3v100h-78.6v-393h78.6v100c0 7.9 6.4 14.3 14.3 14.3zm53.5-217.9h150V362h-150V211.9zM329.9 587h-150V437h150v150zm364.2 75.1h150v150.1h-150V662.1z"}}]},name:"partition",theme:"outlined"};function Ro(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?Object(arguments[t]):{},o=Object.keys(n);typeof Object.getOwnPropertySymbols=="function"&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable}))),o.forEach(function(i){Oa(e,i,n[i])})}return e}function Oa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var bo=function(t,n){var o=Ro({},t,n.attrs);return z(_t,Ro({},o,{icon:Pa}),null)};bo.displayName="PartitionOutlined";bo.inheritAttrs=!1;var Ta={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M719.4 499.1l-296.1-215A15.9 15.9 0 00398 297v430c0 13.1 14.8 20.5 25.3 12.9l296.1-215a15.9 15.9 0 000-25.8zm-257.6 134V390.9L628.5 512 461.8 633.1z"}}]},name:"play-circle",theme:"outlined"};function Lo(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?Object(arguments[t]):{},o=Object.keys(n);typeof Object.getOwnPropertySymbols=="function"&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable}))),o.forEach(function(i){Aa(e,i,n[i])})}return e}function Aa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var xo=function(t,n){var o=Lo({},t,n.attrs);return z(_t,Lo({},o,{icon:Ta}),null)};xo.displayName="PlayCircleOutlined";xo.inheritAttrs=!1;var za={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M893.3 293.3L730.7 130.7c-7.5-7.5-16.7-13-26.7-16V112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V338.5c0-17-6.7-33.2-18.7-45.2zM384 184h256v104H384V184zm456 656H184V184h136v136c0 17.7 14.3 32 32 32h320c17.7 0 32-14.3 32-32V205.8l136 136V840zM512 442c-79.5 0-144 64.5-144 144s64.5 144 144 144 144-64.5 144-144-64.5-144-144-144zm0 224c-44.2 0-80-35.8-80-80s35.8-80 80-80 80 35.8 80 80-35.8 80-80 80z"}}]},name:"save",theme:"outlined"};function Fo(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?Object(arguments[t]):{},o=Object.keys(n);typeof Object.getOwnPropertySymbols=="function"&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable}))),o.forEach(function(i){Ba(e,i,n[i])})}return e}function Ba(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Eo=function(t,n){var o=Fo({},t,n.attrs);return z(_t,Fo({},o,{icon:za}),null)};Eo.displayName="SaveOutlined";Eo.inheritAttrs=!1;const Va="/api/v1";class Ha extends va{constructor(t=Va){super(t)}async listWorkflows(t=50){return this.request(`/workflows?limit=${t}`)}async createWorkflow(t){return this.request("/workflows",{method:"POST",body:JSON.stringify(t)})}async getWorkflow(t){return this.request(`/workflows/${t}`)}async updateWorkflow(t,n){return this.request(`/workflows/${t}`,{method:"PUT",body:JSON.stringify(n)})}async deleteWorkflow(t){await this.request(`/workflows/${t}`,{method:"DELETE"})}async executeWorkflow(t,n){return this.request(`/workflows/${t}/execute`,{method:"POST",body:JSON.stringify({variables:n||{}})})}async getExecution(t){return this.request(`/workflows/executions/${t}`)}async approveExecution(t,n,o){return this.request(`/workflows/executions/${t}/approve`,{method:"POST",body:JSON.stringify({approved:n,comment:o})})}async cancelExecution(t){return this.request(`/workflows/executions/${t}/cancel`,{method:"POST"})}async listExecutions(t,n=50,o=0){return this.request(`/workflows/${t}/executions?limit=${n}&offset=${o}`)}createWorkflowWebSocket(){return super.createWebSocket("/workflows/ws")}}const ze=new Ha,Yo={skill:{label:"技能节点",type:"skill",action:"",agent:"default",timeout_seconds:300,retry_count:0,condition:null,config:{}},condition:{label:"条件节点",type:"condition",action:"evaluate",agent:"default",timeout_seconds:60,retry_count:0,condition:null,config:{expression:""}},approval:{label:"审批节点",type:"approval",action:"approve",agent:"default",timeout_seconds:3600,retry_count:0,condition:null,config:{approver:"",timeout:3600}},parallel:{label:"并行节点",type:"parallel",action:"parallel",agent:"default",timeout_seconds:600,retry_count:0,condition:null,config:{max_parallel:5}}};function Ra(e){return{...Yo[e]||Yo.skill}}function La(e,t,n,o=""){const i=e.map(a=>{var u;const r=a.data,l=t.filter(c=>c.target===a.id).map(c=>{var h;const f=e.find(g=>g.id===c.source);return((h=f==null?void 0:f.data)==null?void 0:h.label)||c.source}),s={name:(r==null?void 0:r.label)||a.id,agent:(r==null?void 0:r.agent)||"default",action:(r==null?void 0:r.action)||"",depends_on:l,inputs:{},outputs:[],timeout_seconds:(r==null?void 0:r.timeout_seconds)||300,retry_count:(r==null?void 0:r.retry_count)||0,continue_on_failure:!1,condition:(r==null?void 0:r.condition)||null,type:(r==null?void 0:r.type)||"skill",config:{...(r==null?void 0:r.config)||{}}};if((r==null?void 0:r.type)==="condition"){const c={},f=t.filter(h=>h.source===a.id);for(const h of f){const g=e.find(y=>y.id===h.target);if(g){const y=((u=g.data)==null?void 0:u.label)||h.target;h.sourceHandle==="true"?c.true=y:h.sourceHandle==="false"&&(c.false=y)}}s.config={...s.config,branch_targets:c}}return s});return{workflow_id:o,name:n,version:1,stages:i,triggers:[],variables_schema:{},output_schema:{},created_at:new Date().toISOString(),updated_at:new Date().toISOString()}}function Fa(e){var a;const t=new Map,n={skill:"skill",condition:"condition",approval:"approval",parallel:"parallel"},o=e.stages.map((r,l)=>{const s=`node-${l}`;return t.set(r.name,s),{id:s,type:n[r.type]||"skill",position:{x:100+l*250,y:200},data:{label:r.name,type:r.type,config:r.config,action:r.action,agent:r.agent,timeout_seconds:r.timeout_seconds,retry_count:r.retry_count,condition:r.condition}}}),i=[];for(const r of e.stages){const l=t.get(r.name);if(l)for(const s of r.depends_on){const u=t.get(s);if(!u)continue;const c=e.stages.find(g=>g.name===s);let f="output",h="input";if((c==null?void 0:c.type)==="condition"){const g=(a=c.config)==null?void 0:a.branch_targets;g&&(g.true===r.name?f="true":g.false===r.name&&(f="false"))}i.push({id:`edge-${u}-${l}`,source:u,target:l,sourceHandle:f,targetHandle:h,animated:!0})}}return{nodes:o,edges:i}}const So=na("workflow",()=>{const e=me([]),t=me(null),n=me(null),o=me(!1),i=me(!1),a=me(null),r=me([]),l=me([]),s=me(null),u=me([]),c=me([]);let f=null,h=0;const g=3;let y=null,b=null;const N=me([]),S=me(0),$=te(()=>s.value&&r.value.find(d=>d.id===s.value)||null),_=te(()=>{var d;return((d=$.value)==null?void 0:d.data)||null}),C=te(()=>u.value.length>0),B=te(()=>c.value.length>0);function G(d){r.value.push(d)}function X(d){const p=r.value.find(P=>P.id===d);if(!p)return null;const w=l.value.filter(P=>P.source===d||P.target===d);return r.value=r.value.filter(P=>P.id!==d),l.value=l.value.filter(P=>P.source!==d&&P.target!==d),s.value===d&&(s.value=null),{node:p,edges:w}}function Y(d){l.value=[...l.value,d]}function oe(d){const p=l.value.find(w=>w.id===d);return p?(l.value=l.value.filter(w=>w.id!==d),p):null}function K(d,p){const w=r.value.findIndex(P=>P.id===d);if(w!==-1){const P=r.value[w];r.value[w]={...P,data:{...P.data,...p}}}}function A(d){d.execute(),u.value.push(d),c.value=[]}function k(){const d=u.value.pop();d&&(d.undo(),c.value.push(d))}function ee(){const d=c.value.pop();d&&(d.execute(),u.value.push(d))}function x(){u.value=[],c.value=[]}function I(d,p){const w=r.value.find(P=>{var R,F;return((R=P.data)==null?void 0:R.stage_id)===d||P.id===d||((F=P.data)==null?void 0:F.label)===d});w&&w.data&&(w.data={...w.data,status:p})}function E(d){y=d,h=0,M()}function M(){if(y){T(),f&&(f.onclose=null,f.close(),f=null),h++;try{f=ze.createWorkflowWebSocket(),f.onopen=()=>{h=0,y&&(f==null||f.send(JSON.stringify({type:"subscribe",execution_id:y})))},f.onmessage=d=>{try{const p=JSON.parse(d.data);if(p.execution_id&&p.execution_id!==y)return;switch(p.type){case"stage_started":I(p.stage_id,"running");break;case"stage_completed":I(p.stage_id,"completed");break;case"stage_failed":I(p.stage_id,"failed");break;case"approval_required":I(p.stage_id,"waiting_approval");break;case"execution_completed":case"execution_failed":o.value=!1,V(),y&&ze.getExecution(y).then(w=>{n.value=w}).catch(()=>{});break}}catch{}},f.onclose=()=>{f=null,o.value&&h<g&&(b=setTimeout(()=>M(),2e3))},f.onerror=()=>{}}catch{h<g&&(b=setTimeout(()=>M(),2e3))}}}function T(){b&&(clearTimeout(b),b=null)}function V(){T(),f&&(f.onclose=null,f.close(),f=null),y=null}function H(){r.value=r.value.map(d=>{var p;if((p=d.data)!=null&&p.status){const{status:w,...P}=d.data;return{...d,data:P}}return d})}async function U(){i.value=!0,a.value=null;try{const d=await ze.listWorkflows();e.value=d.workflows}catch(d){a.value=d instanceof Error?d.message:"加载工作流列表失败",console.error("Failed to load workflows:",d)}finally{i.value=!1}}async function ie(d){i.value=!0,a.value=null;try{const p=await ze.createWorkflow({name:d,stages:[]});return t.value=p,r.value=[],l.value=[],s.value=null,x(),await U(),p}catch(p){return a.value=p instanceof Error?p.message:"创建工作流失败",console.error("Failed to create workflow:",p),null}finally{i.value=!1}}async function le(d){i.value=!0,a.value=null;try{const p=await ze.getWorkflow(d);t.value=p;const{nodes:w,edges:P}=Fa(p);r.value=w,l.value=P,s.value=null,x()}catch(p){a.value=p instanceof Error?p.message:"加载工作流失败",console.error("Failed to load workflow:",p)}finally{i.value=!1}}async function he(){if(!t.value)return!1;i.value=!0,a.value=null;try{const d=La(r.value,l.value,t.value.name,t.value.workflow_id),p=await ze.updateWorkflow(t.value.workflow_id,{name:d.name,stages:d.stages,triggers:d.triggers,variables_schema:d.variables_schema,output_schema:d.output_schema});return t.value=p,await U(),!0}catch(d){return a.value=d instanceof Error?d.message:"保存工作流失败",console.error("Failed to save workflow:",d),!1}finally{i.value=!1}}async function q(d){var p;i.value=!0,a.value=null;try{return await ze.deleteWorkflow(d),((p=t.value)==null?void 0:p.workflow_id)===d&&(t.value=null,r.value=[],l.value=[],s.value=null,x()),await U(),!0}catch(w){return a.value=w instanceof Error?w.message:"删除工作流失败",console.error("Failed to delete workflow:",w),!1}finally{i.value=!1}}async function j(d){if(t.value){o.value=!0,a.value=null,H();try{const p=await ze.executeWorkflow(t.value.workflow_id,d);E(p.execution_id);const w=await ze.getExecution(p.execution_id);n.value=w}catch(p){a.value=p instanceof Error?p.message:"执行工作流失败",console.error("Failed to execute workflow:",p),o.value=!1}}}async function L(d,p,w){try{const P=await ze.approveExecution(d,p,w);n.value=P}catch(P){a.value=P instanceof Error?P.message:"审批操作失败",console.error("Failed to approve execution:",P)}}async function ce(d){try{const p=await ze.cancelExecution(d);n.value=p,o.value=!1,V()}catch(p){a.value=p instanceof Error?p.message:"取消执行失败",console.error("Failed to cancel execution:",p)}}async function _e(d=50,p=0){if(t.value)try{const w=await ze.listExecutions(t.value.workflow_id,d,p);N.value=w.executions,S.value=w.total}catch(w){console.error("Failed to load execution history:",w)}}function de(d,p){const w=`node-${Date.now()}-${Math.random().toString(36).substring(2,7)}`,P=Ra(d),F={id:w,type:{skill:"skill",condition:"condition",approval:"approval",parallel:"parallel"}[d]||"skill",position:p,data:P},Q={execute:()=>G(F),undo:()=>X(F.id),description:`添加节点 ${P.label}`};A(Q)}function ye(d,p){const w=r.value.findIndex(re=>re.id===d);if(w===-1)return;const R=r.value[w].data,F={};for(const re of Object.keys(p))F[re]=R[re];A({execute:()=>K(d,p),undo:()=>K(d,F),description:"更新节点属性"})}function ae(d){var R;const p=r.value.find(F=>F.id===d);if(!p)return;const w=l.value.filter(F=>F.source===d||F.target===d),P={execute:()=>{r.value=r.value.filter(F=>F.id!==d),l.value=l.value.filter(F=>F.source!==d&&F.target!==d),s.value===d&&(s.value=null)},undo:()=>{r.value=[...r.value,p],l.value=[...l.value,...w]},description:`删除节点 ${((R=p.data)==null?void 0:R.label)||d}`};A(P)}function se(d){A({execute:()=>Y(d),undo:()=>oe(d.id),description:"添加连线"})}function m(){r.value=[],l.value=[],s.value=null,x()}function v(d){s.value=d}return{workflows:e,currentWorkflow:t,currentExecution:n,isExecuting:o,isLoading:i,error:a,flowNodes:r,flowEdges:l,selectedNodeId:s,undoStack:u,redoStack:c,executionHistory:N,executionHistoryTotal:S,selectedNode:$,selectedNodeData:_,canUndo:C,canRedo:B,loadWorkflows:U,createWorkflow:ie,loadWorkflow:le,saveWorkflow:he,deleteWorkflow:q,executeWorkflow:j,approveExecution:L,cancelExecution:ce,loadExecutionHistory:_e,addNode:de,updateNodeData:ye,removeNode:ae,addEdge:se,clearCanvas:m,selectNode:v,undo:k,redo:ee,executeCommand:A,clearUndoRedo:x,updateNodeStatus:I,connectExecutionWebSocket:E,disconnectExecutionWebSocket:V,resetNodeStatuses:H}}),Ya={class:"node-palette"},Ga={class:"palette-list"},Wa=["onDragstart"],Xa={class:"item-info"},Ua={class:"item-name"},Za={class:"item-desc"},Ka=we({__name:"NodePalette",setup(e){const t=[{type:"skill",name:"技能节点",desc:"引用已注册的技能",icon:Ri,color:"#7c3aed"},{type:"condition",name:"条件节点",desc:"If/else 条件分支",icon:Dn,color:"#f59e0b"},{type:"approval",name:"审批节点",desc:"人工审批关卡",icon:Li,color:"#7c3aed"},{type:"parallel",name:"并行节点",desc:"并行执行组",icon:_o,color:"#10b981"}];function n(o,i){o.dataTransfer&&(o.dataTransfer.setData("application/vueflow",i),o.dataTransfer.effectAllowed="move")}return(o,i)=>(O(),J("div",Ya,[i[0]||(i[0]=ne("div",{class:"palette-title"},"节点类型",-1)),ne("div",Ga,[(O(),J(De,null,qt(t,a=>ne("div",{key:a.type,class:"palette-item",draggable:"true",onDragstart:r=>n(r,a.type)},[(O(),ve(dt(a.icon),{class:"item-icon",style:He({color:a.color})},null,8,["style"])),ne("div",Xa,[ne("div",Ua,Ne(a.name),1),ne("div",Za,Ne(a.desc),1)])],40,Wa)),64))])]))}}),qa=ct(Ka,[["__scopeId","data-v-e8fc92a2"]]);function Ft(e){return zi()?(dn(e),!0):!1}function je(e){return typeof e=="function"?e():D(e)}const ja=typeof window<"u"&&typeof document<"u",Ja=e=>typeof e<"u",Qa=Object.prototype.toString,el=e=>Qa.call(e)==="[object Object]",tl=()=>{};function nl(e,t){function n(...o){return new Promise((i,a)=>{Promise.resolve(e(()=>t.apply(this,o),{fn:t,thisArg:this,args:o})).then(i).catch(a)})}return n}const Wi=e=>e();function ol(e=Wi){const t=me(!0);function n(){t.value=!1}function o(){t.value=!0}const i=(...a)=>{t.value&&e(...a)};return{isActive:ca(t),pause:n,resume:o,eventFilter:i}}function Go(e,t=!1,n="Timeout"){return new Promise((o,i)=>{setTimeout(t?()=>i(n):o,e)})}function il(e,t,n={}){const{eventFilter:o=Wi,...i}=n;return Ee(e,nl(o,t),i)}function bt(e,t,n={}){const{eventFilter:o,...i}=n,{eventFilter:a,pause:r,resume:l,isActive:s}=ol(o);return{stop:il(e,t,{...i,eventFilter:a}),pause:r,resume:l,isActive:s}}function rl(e,t={}){if(!go(e))return sa(e);const n=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const o in e.value)n[o]=ua(()=>({get(){return e.value[o]},set(i){var a;if((a=je(t.replaceRef))!=null?a:!0)if(Array.isArray(e.value)){const l=[...e.value];l[o]=i,e.value=l}else{const l={...e.value,[o]:i};Object.setPrototypeOf(l,Object.getPrototypeOf(e.value)),e.value=l}else e.value[o]=i}}));return n}function Qn(e,t=!1){function n(f,{flush:h="sync",deep:g=!1,timeout:y,throwOnTimeout:b}={}){let N=null;const $=[new Promise(_=>{N=Ee(e,C=>{f(C)!==t&&(N==null||N(),_(C))},{flush:h,deep:g,immediate:!0})})];return y!=null&&$.push(Go(y,b).then(()=>je(e)).finally(()=>N==null?void 0:N())),Promise.race($)}function o(f,h){if(!go(f))return n(C=>C===f,h);const{flush:g="sync",deep:y=!1,timeout:b,throwOnTimeout:N}=h??{};let S=null;const _=[new Promise(C=>{S=Ee([e,f],([B,G])=>{t!==(B===G)&&(S==null||S(),C(B))},{flush:g,deep:y,immediate:!0})})];return b!=null&&_.push(Go(b,N).then(()=>je(e)).finally(()=>(S==null||S(),je(e)))),Promise.race(_)}function i(f){return n(h=>!!h,f)}function a(f){return o(null,f)}function r(f){return o(void 0,f)}function l(f){return n(Number.isNaN,f)}function s(f,h){return n(g=>{const y=Array.from(g);return y.includes(f)||y.includes(je(f))},h)}function u(f){return c(1,f)}function c(f=1,h){let g=-1;return n(()=>(g+=1,g>=f),h)}return Array.isArray(je(e))?{toMatch:n,toContains:s,changed:u,changedTimes:c,get not(){return Qn(e,!t)}}:{toMatch:n,toBe:o,toBeTruthy:i,toBeNull:a,toBeNaN:l,toBeUndefined:r,changed:u,changedTimes:c,get not(){return Qn(e,!t)}}}function eo(e){return Qn(e)}function al(e){var t;const n=je(e);return(t=n==null?void 0:n.$el)!=null?t:n}const Xi=ja?window:void 0;function Ui(...e){let t,n,o,i;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,o,i]=e,t=Xi):[t,n,o,i]=e,!t)return tl;Array.isArray(n)||(n=[n]),Array.isArray(o)||(o=[o]);const a=[],r=()=>{a.forEach(c=>c()),a.length=0},l=(c,f,h,g)=>(c.addEventListener(f,h,g),()=>c.removeEventListener(f,h,g)),s=Ee(()=>[al(t),je(i)],([c,f])=>{if(r(),!c)return;const h=el(f)?{...f}:f;a.push(...n.flatMap(g=>o.map(y=>l(c,g,y,h))))},{immediate:!0,flush:"post"}),u=()=>{s(),r()};return Ft(u),u}function ll(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function Wo(...e){let t,n,o={};e.length===3?(t=e[0],n=e[1],o=e[2]):e.length===2?typeof e[1]=="object"?(t=!0,n=e[0],o=e[1]):(t=e[0],n=e[1]):(t=!0,n=e[0]);const{target:i=Xi,eventName:a="keydown",passive:r=!1,dedupe:l=!1}=o,s=ll(t);return Ui(i,a,c=>{c.repeat&&je(l)||s(c)&&n(c)},r)}function sl(e){return JSON.parse(JSON.stringify(e))}function Fn(e,t,n,o={}){var i,a,r;const{clone:l=!1,passive:s=!1,eventName:u,deep:c=!1,defaultValue:f,shouldEmit:h}=o,g=Pt(),y=n||(g==null?void 0:g.emit)||((i=g==null?void 0:g.$emit)==null?void 0:i.bind(g))||((r=(a=g==null?void 0:g.proxy)==null?void 0:a.$emit)==null?void 0:r.bind(g==null?void 0:g.proxy));let b=u;t||(t="modelValue"),b=b||`update:${t.toString()}`;const N=_=>l?typeof l=="function"?l(_):sl(_):_,S=()=>Ja(e[t])?N(e[t]):f,$=_=>{h?h(_)&&y(b,_):y(b,_)};if(s){const _=S(),C=me(_);let B=!1;return Ee(()=>e[t],G=>{B||(B=!0,C.value=N(G),et(()=>B=!1))}),Ee(C,G=>{!B&&(G!==e[t]||c)&&$(G)},{deep:c}),C}else return te({get(){return S()},set(_){$(_)}})}var ul={value:()=>{}};function In(){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 fn(n)}function fn(e){this._=e}function cl(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}})}fn.prototype=In.prototype={constructor:fn,on:function(e,t){var n=this._,o=cl(e+"",n),i,a=-1,r=o.length;if(arguments.length<2){for(;++a<r;)if((i=(e=o[a]).type)&&(i=dl(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++a<r;)if(i=(e=o[a]).type)n[i]=Xo(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Xo(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 fn(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),o=0,i,a;o<i;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(a=this._[e],o=0,i=a.length;o<i;++o)a[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,a=o.length;i<a;++i)o[i].value.apply(t,n)}};function dl(e,t){for(var n=0,o=e.length,i;n<o;++n)if((i=e[n]).name===t)return i.value}function Xo(e,t,n){for(var o=0,i=e.length;o<i;++o)if(e[o].name===t){e[o]=ul,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var to="http://www.w3.org/1999/xhtml";const Uo={svg:"http://www.w3.org/2000/svg",xhtml:to,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Pn(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Uo.hasOwnProperty(t)?{space:Uo[t],local:e}:e}function fl(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===to&&t.documentElement.namespaceURI===to?t.createElement(e):t.createElementNS(n,e)}}function hl(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Zi(e){var t=Pn(e);return(t.local?hl:fl)(t)}function vl(){}function No(e){return e==null?vl:function(){return this.querySelector(e)}}function gl(e){typeof e!="function"&&(e=No(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var a=t[i],r=a.length,l=o[i]=new Array(r),s,u,c=0;c<r;++c)(s=a[c])&&(u=e.call(s,s.__data__,c,a))&&("__data__"in s&&(u.__data__=s.__data__),l[c]=u);return new Ae(o,this._parents)}function pl(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function ml(){return[]}function Ki(e){return e==null?ml:function(){return this.querySelectorAll(e)}}function yl(e){return function(){return pl(e.apply(this,arguments))}}function wl(e){typeof e=="function"?e=yl(e):e=Ki(e);for(var t=this._groups,n=t.length,o=[],i=[],a=0;a<n;++a)for(var r=t[a],l=r.length,s,u=0;u<l;++u)(s=r[u])&&(o.push(e.call(s,s.__data__,u,r)),i.push(s));return new Ae(o,i)}function qi(e){return function(){return this.matches(e)}}function ji(e){return function(t){return t.matches(e)}}var _l=Array.prototype.find;function bl(e){return function(){return _l.call(this.children,e)}}function xl(){return this.firstElementChild}function El(e){return this.select(e==null?xl:bl(typeof e=="function"?e:ji(e)))}var Sl=Array.prototype.filter;function Nl(){return Array.from(this.children)}function kl(e){return function(){return Sl.call(this.children,e)}}function $l(e){return this.selectAll(e==null?Nl:kl(typeof e=="function"?e:ji(e)))}function Cl(e){typeof e!="function"&&(e=qi(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var a=t[i],r=a.length,l=o[i]=[],s,u=0;u<r;++u)(s=a[u])&&e.call(s,s.__data__,u,a)&&l.push(s);return new Ae(o,this._parents)}function Ji(e){return new Array(e.length)}function Ml(){return new Ae(this._enter||this._groups.map(Ji),this._parents)}function mn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}mn.prototype={constructor:mn,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 Dl(e){return function(){return e}}function Il(e,t,n,o,i,a){for(var r=0,l,s=t.length,u=a.length;r<u;++r)(l=t[r])?(l.__data__=a[r],o[r]=l):n[r]=new mn(e,a[r]);for(;r<s;++r)(l=t[r])&&(i[r]=l)}function Pl(e,t,n,o,i,a,r){var l,s,u=new Map,c=t.length,f=a.length,h=new Array(c),g;for(l=0;l<c;++l)(s=t[l])&&(h[l]=g=r.call(s,s.__data__,l,t)+"",u.has(g)?i[l]=s:u.set(g,s));for(l=0;l<f;++l)g=r.call(e,a[l],l,a)+"",(s=u.get(g))?(o[l]=s,s.__data__=a[l],u.delete(g)):n[l]=new mn(e,a[l]);for(l=0;l<c;++l)(s=t[l])&&u.get(h[l])===s&&(i[l]=s)}function Ol(e){return e.__data__}function Tl(e,t){if(!arguments.length)return Array.from(this,Ol);var n=t?Pl:Il,o=this._parents,i=this._groups;typeof e!="function"&&(e=Dl(e));for(var a=i.length,r=new Array(a),l=new Array(a),s=new Array(a),u=0;u<a;++u){var c=o[u],f=i[u],h=f.length,g=Al(e.call(c,c&&c.__data__,u,o)),y=g.length,b=l[u]=new Array(y),N=r[u]=new Array(y),S=s[u]=new Array(h);n(c,f,b,N,S,g,t);for(var $=0,_=0,C,B;$<y;++$)if(C=b[$]){for($>=_&&(_=$+1);!(B=N[_])&&++_<y;);C._next=B||null}}return r=new Ae(r,o),r._enter=l,r._exit=s,r}function Al(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function zl(){return new Ae(this._exit||this._groups.map(Ji),this._parents)}function Bl(e,t,n){var o=this.enter(),i=this,a=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?a.remove():n(a),o&&i?o.merge(i).order():i}function Vl(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,i=n.length,a=o.length,r=Math.min(i,a),l=new Array(i),s=0;s<r;++s)for(var u=n[s],c=o[s],f=u.length,h=l[s]=new Array(f),g,y=0;y<f;++y)(g=u[y]||c[y])&&(h[y]=g);for(;s<i;++s)l[s]=n[s];return new Ae(l,this._parents)}function Hl(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],i=o.length-1,a=o[i],r;--i>=0;)(r=o[i])&&(a&&r.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(r,a),a=r);return this}function Rl(e){e||(e=Ll);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a){for(var r=n[a],l=r.length,s=i[a]=new Array(l),u,c=0;c<l;++c)(u=r[c])&&(s[c]=u);s.sort(t)}return new Ae(i,this._parents).order()}function Ll(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Fl(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Yl(){return Array.from(this)}function Gl(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],i=0,a=o.length;i<a;++i){var r=o[i];if(r)return r}return null}function Wl(){let e=0;for(const t of this)++e;return e}function Xl(){return!this.node()}function Ul(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var i=t[n],a=0,r=i.length,l;a<r;++a)(l=i[a])&&e.call(l,l.__data__,a,i);return this}function Zl(e){return function(){this.removeAttribute(e)}}function Kl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ql(e,t){return function(){this.setAttribute(e,t)}}function jl(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Jl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Ql(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 es(e,t){var n=Pn(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?Kl:Zl:typeof t=="function"?n.local?Ql:Jl:n.local?jl:ql)(n,t))}function Qi(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function ts(e){return function(){this.style.removeProperty(e)}}function ns(e,t,n){return function(){this.style.setProperty(e,t,n)}}function os(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function is(e,t,n){return arguments.length>1?this.each((t==null?ts:typeof t=="function"?os:ns)(e,t,n??"")):$t(this.node(),e)}function $t(e,t){return e.style.getPropertyValue(t)||Qi(e).getComputedStyle(e,null).getPropertyValue(t)}function rs(e){return function(){delete this[e]}}function as(e,t){return function(){this[e]=t}}function ls(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function ss(e,t){return arguments.length>1?this.each((t==null?rs:typeof t=="function"?ls:as)(e,t)):this.node()[e]}function er(e){return e.trim().split(/^|\s+/)}function ko(e){return e.classList||new tr(e)}function tr(e){this._node=e,this._names=er(e.getAttribute("class")||"")}tr.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 nr(e,t){for(var n=ko(e),o=-1,i=t.length;++o<i;)n.add(t[o])}function or(e,t){for(var n=ko(e),o=-1,i=t.length;++o<i;)n.remove(t[o])}function us(e){return function(){nr(this,e)}}function cs(e){return function(){or(this,e)}}function ds(e,t){return function(){(t.apply(this,arguments)?nr:or)(this,e)}}function fs(e,t){var n=er(e+"");if(arguments.length<2){for(var o=ko(this.node()),i=-1,a=n.length;++i<a;)if(!o.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?ds:t?us:cs)(n,t))}function hs(){this.textContent=""}function vs(e){return function(){this.textContent=e}}function gs(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function ps(e){return arguments.length?this.each(e==null?hs:(typeof e=="function"?gs:vs)(e)):this.node().textContent}function ms(){this.innerHTML=""}function ys(e){return function(){this.innerHTML=e}}function ws(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function _s(e){return arguments.length?this.each(e==null?ms:(typeof e=="function"?ws:ys)(e)):this.node().innerHTML}function bs(){this.nextSibling&&this.parentNode.appendChild(this)}function xs(){return this.each(bs)}function Es(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ss(){return this.each(Es)}function Ns(e){var t=typeof e=="function"?e:Zi(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function ks(){return null}function $s(e,t){var n=typeof e=="function"?e:Zi(e),o=t==null?ks:typeof t=="function"?t:No(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function Cs(){var e=this.parentNode;e&&e.removeChild(this)}function Ms(){return this.each(Cs)}function Ds(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Is(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ps(e){return this.select(e?Is:Ds)}function Os(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Ts(e){return function(t){e.call(this,t,this.__data__)}}function As(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 zs(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++o]=a;++o?t.length=o:delete this.__on}}}function Bs(e,t,n){return function(){var o=this.__on,i,a=Ts(t);if(o){for(var r=0,l=o.length;r<l;++r)if((i=o[r]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},o?o.push(i):this.__on=[i]}}function Vs(e,t,n){var o=As(e+""),i,a=o.length,r;if(arguments.length<2){var l=this.node().__on;if(l){for(var s=0,u=l.length,c;s<u;++s)for(i=0,c=l[s];i<a;++i)if((r=o[i]).type===c.type&&r.name===c.name)return c.value}return}for(l=t?Bs:zs,i=0;i<a;++i)this.each(l(o[i],t,n));return this}function ir(e,t,n){var o=Qi(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 Hs(e,t){return function(){return ir(this,e,t)}}function Rs(e,t){return function(){return ir(this,e,t.apply(this,arguments))}}function Ls(e,t){return this.each((typeof t=="function"?Rs:Hs)(e,t))}function*Fs(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],i=0,a=o.length,r;i<a;++i)(r=o[i])&&(yield r)}var rr=[null];function Ae(e,t){this._groups=e,this._parents=t}function jt(){return new Ae([[document.documentElement]],rr)}function Ys(){return this}Ae.prototype=jt.prototype={constructor:Ae,select:gl,selectAll:wl,selectChild:El,selectChildren:$l,filter:Cl,data:Tl,enter:Ml,exit:zl,join:Bl,merge:Vl,selection:Ys,order:Hl,sort:Rl,call:Fl,nodes:Yl,node:Gl,size:Wl,empty:Xl,each:Ul,attr:es,style:is,property:ss,classed:fs,text:ps,html:_s,raise:xs,lower:Ss,append:Ns,insert:$s,remove:Ms,clone:Ps,datum:Os,on:Vs,dispatch:Ls,[Symbol.iterator]:Fs};function Be(e){return typeof e=="string"?new Ae([[document.querySelector(e)]],[document.documentElement]):new Ae([[e]],rr)}function Gs(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Fe(e,t){if(e=Gs(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 Ws={passive:!1},Yt={capture:!0,passive:!1};function Yn(e){e.stopImmediatePropagation()}function Et(e){e.preventDefault(),e.stopImmediatePropagation()}function ar(e){var t=e.document.documentElement,n=Be(e).on("dragstart.drag",Et,Yt);"onselectstart"in t?n.on("selectstart.drag",Et,Yt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function lr(e,t){var n=e.document.documentElement,o=Be(e).on("dragstart.drag",null);t&&(o.on("click.drag",Et,Yt),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 en=e=>()=>e;function no(e,{sourceEvent:t,subject:n,target:o,identifier:i,active:a,x:r,y:l,dx:s,dy:u,dispatch:c}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:r,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:s,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:c}})}no.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Xs(e){return!e.ctrlKey&&!e.button}function Us(){return this.parentNode}function Zs(e,t){return t??{x:e.x,y:e.y}}function Ks(){return navigator.maxTouchPoints||"ontouchstart"in this}function qs(){var e=Xs,t=Us,n=Zs,o=Ks,i={},a=In("start","drag","end"),r=0,l,s,u,c,f=0;function h(C){C.on("mousedown.drag",g).filter(o).on("touchstart.drag",N).on("touchmove.drag",S,Ws).on("touchend.drag touchcancel.drag",$).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(C,B){if(!(c||!e.call(this,C,B))){var G=_(this,t.call(this,C,B),C,B,"mouse");G&&(Be(C.view).on("mousemove.drag",y,Yt).on("mouseup.drag",b,Yt),ar(C.view),Yn(C),u=!1,l=C.clientX,s=C.clientY,G("start",C))}}function y(C){if(Et(C),!u){var B=C.clientX-l,G=C.clientY-s;u=B*B+G*G>f}i.mouse("drag",C)}function b(C){Be(C.view).on("mousemove.drag mouseup.drag",null),lr(C.view,u),Et(C),i.mouse("end",C)}function N(C,B){if(e.call(this,C,B)){var G=C.changedTouches,X=t.call(this,C,B),Y=G.length,oe,K;for(oe=0;oe<Y;++oe)(K=_(this,X,C,B,G[oe].identifier,G[oe]))&&(Yn(C),K("start",C,G[oe]))}}function S(C){var B=C.changedTouches,G=B.length,X,Y;for(X=0;X<G;++X)(Y=i[B[X].identifier])&&(Et(C),Y("drag",C,B[X]))}function $(C){var B=C.changedTouches,G=B.length,X,Y;for(c&&clearTimeout(c),c=setTimeout(function(){c=null},500),X=0;X<G;++X)(Y=i[B[X].identifier])&&(Yn(C),Y("end",C,B[X]))}function _(C,B,G,X,Y,oe){var K=a.copy(),A=Fe(oe||G,B),k,ee,x;if((x=n.call(C,new no("beforestart",{sourceEvent:G,target:h,identifier:Y,active:r,x:A[0],y:A[1],dx:0,dy:0,dispatch:K}),X))!=null)return k=x.x-A[0]||0,ee=x.y-A[1]||0,function I(E,M,T){var V=A,H;switch(E){case"start":i[Y]=I,H=r++;break;case"end":delete i[Y],--r;case"drag":A=Fe(T||M,B),H=r;break}K.call(E,C,new no(E,{sourceEvent:M,subject:x,target:h,identifier:Y,active:H,x:A[0]+k,y:A[1]+ee,dx:A[0]-V[0],dy:A[1]-V[1],dispatch:K}),X)}}return h.filter=function(C){return arguments.length?(e=typeof C=="function"?C:en(!!C),h):e},h.container=function(C){return arguments.length?(t=typeof C=="function"?C:en(C),h):t},h.subject=function(C){return arguments.length?(n=typeof C=="function"?C:en(C),h):n},h.touchable=function(C){return arguments.length?(o=typeof C=="function"?C:en(!!C),h):o},h.on=function(){var C=a.on.apply(a,arguments);return C===a?h:C},h.clickDistance=function(C){return arguments.length?(f=(C=+C)*C,h):Math.sqrt(f)},h}function $o(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function sr(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function Jt(){}var Gt=.7,yn=1/Gt,St="\\s*([+-]?\\d+)\\s*",Wt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",We="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",js=/^#([0-9a-f]{3,8})$/,Js=new RegExp(`^rgb\\(${St},${St},${St}\\)$`),Qs=new RegExp(`^rgb\\(${We},${We},${We}\\)$`),eu=new RegExp(`^rgba\\(${St},${St},${St},${Wt}\\)$`),tu=new RegExp(`^rgba\\(${We},${We},${We},${Wt}\\)$`),nu=new RegExp(`^hsl\\(${Wt},${We},${We}\\)$`),ou=new RegExp(`^hsla\\(${Wt},${We},${We},${Wt}\\)$`),Zo={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};$o(Jt,mt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Ko,formatHex:Ko,formatHex8:iu,formatHsl:ru,formatRgb:qo,toString:qo});function Ko(){return this.rgb().formatHex()}function iu(){return this.rgb().formatHex8()}function ru(){return ur(this).formatHsl()}function qo(){return this.rgb().formatRgb()}function mt(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=js.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?jo(t):n===3?new Pe(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?tn(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?tn(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=Js.exec(e))?new Pe(t[1],t[2],t[3],1):(t=Qs.exec(e))?new Pe(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=eu.exec(e))?tn(t[1],t[2],t[3],t[4]):(t=tu.exec(e))?tn(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=nu.exec(e))?ei(t[1],t[2]/100,t[3]/100,1):(t=ou.exec(e))?ei(t[1],t[2]/100,t[3]/100,t[4]):Zo.hasOwnProperty(e)?jo(Zo[e]):e==="transparent"?new Pe(NaN,NaN,NaN,0):null}function jo(e){return new Pe(e>>16&255,e>>8&255,e&255,1)}function tn(e,t,n,o){return o<=0&&(e=t=n=NaN),new Pe(e,t,n,o)}function au(e){return e instanceof Jt||(e=mt(e)),e?(e=e.rgb(),new Pe(e.r,e.g,e.b,e.opacity)):new Pe}function oo(e,t,n,o){return arguments.length===1?au(e):new Pe(e,t,n,o??1)}function Pe(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}$o(Pe,oo,sr(Jt,{brighter(e){return e=e==null?yn:Math.pow(yn,e),new Pe(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Gt:Math.pow(Gt,e),new Pe(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Pe(gt(this.r),gt(this.g),gt(this.b),wn(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:Jo,formatHex:Jo,formatHex8:lu,formatRgb:Qo,toString:Qo}));function Jo(){return`#${vt(this.r)}${vt(this.g)}${vt(this.b)}`}function lu(){return`#${vt(this.r)}${vt(this.g)}${vt(this.b)}${vt((isNaN(this.opacity)?1:this.opacity)*255)}`}function Qo(){const e=wn(this.opacity);return`${e===1?"rgb(":"rgba("}${gt(this.r)}, ${gt(this.g)}, ${gt(this.b)}${e===1?")":`, ${e})`}`}function wn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function gt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function vt(e){return e=gt(e),(e<16?"0":"")+e.toString(16)}function ei(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ve(e,t,n,o)}function ur(e){if(e instanceof Ve)return new Ve(e.h,e.s,e.l,e.opacity);if(e instanceof Jt||(e=mt(e)),!e)return new Ve;if(e instanceof Ve)return e;e=e.rgb();var t=e.r/255,n=e.g/255,o=e.b/255,i=Math.min(t,n,o),a=Math.max(t,n,o),r=NaN,l=a-i,s=(a+i)/2;return l?(t===a?r=(n-o)/l+(n<o)*6:n===a?r=(o-t)/l+2:r=(t-n)/l+4,l/=s<.5?a+i:2-a-i,r*=60):l=s>0&&s<1?0:r,new Ve(r,l,s,e.opacity)}function su(e,t,n,o){return arguments.length===1?ur(e):new Ve(e,t,n,o??1)}function Ve(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}$o(Ve,su,sr(Jt,{brighter(e){return e=e==null?yn:Math.pow(yn,e),new Ve(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Gt:Math.pow(Gt,e),new Ve(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,i=2*n-o;return new Pe(Gn(e>=240?e-240:e+120,i,o),Gn(e,i,o),Gn(e<120?e+240:e-120,i,o),this.opacity)},clamp(){return new Ve(ti(this.h),nn(this.s),nn(this.l),wn(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=wn(this.opacity);return`${e===1?"hsl(":"hsla("}${ti(this.h)}, ${nn(this.s)*100}%, ${nn(this.l)*100}%${e===1?")":`, ${e})`}`}}));function ti(e){return e=(e||0)%360,e<0?e+360:e}function nn(e){return Math.max(0,Math.min(1,e||0))}function Gn(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 Co=e=>()=>e;function uu(e,t){return function(n){return e+n*t}}function cu(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 du(e){return(e=+e)==1?cr:function(t,n){return n-t?cu(t,n,e):Co(isNaN(t)?n:t)}}function cr(e,t){var n=t-e;return n?uu(e,n):Co(isNaN(e)?t:e)}const _n=function e(t){var n=du(t);function o(i,a){var r=n((i=oo(i)).r,(a=oo(a)).r),l=n(i.g,a.g),s=n(i.b,a.b),u=cr(i.opacity,a.opacity);return function(c){return i.r=r(c),i.g=l(c),i.b=s(c),i.opacity=u(c),i+""}}return o.gamma=e,o}(1);function fu(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,o=t.slice(),i;return function(a){for(i=0;i<n;++i)o[i]=e[i]*(1-a)+t[i]*a;return o}}function hu(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function vu(e,t){var n=t?t.length:0,o=e?Math.min(n,e.length):0,i=new Array(o),a=new Array(n),r;for(r=0;r<o;++r)i[r]=Ht(e[r],t[r]);for(;r<n;++r)a[r]=t[r];return function(l){for(r=0;r<o;++r)a[r]=i[r](l);return a}}function gu(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function Ye(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function pu(e,t){var n={},o={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?n[i]=Ht(e[i],t[i]):o[i]=t[i];return function(a){for(i in n)o[i]=n[i](a);return o}}var io=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Wn=new RegExp(io.source,"g");function mu(e){return function(){return e}}function yu(e){return function(t){return e(t)+""}}function dr(e,t){var n=io.lastIndex=Wn.lastIndex=0,o,i,a,r=-1,l=[],s=[];for(e=e+"",t=t+"";(o=io.exec(e))&&(i=Wn.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),l[r]?l[r]+=a:l[++r]=a),(o=o[0])===(i=i[0])?l[r]?l[r]+=i:l[++r]=i:(l[++r]=null,s.push({i:r,x:Ye(o,i)})),n=Wn.lastIndex;return n<t.length&&(a=t.slice(n),l[r]?l[r]+=a:l[++r]=a),l.length<2?s[0]?yu(s[0].x):mu(t):(t=s.length,function(u){for(var c=0,f;c<t;++c)l[(f=s[c]).i]=f.x(u);return l.join("")})}function Ht(e,t){var n=typeof t,o;return t==null||n==="boolean"?Co(t):(n==="number"?Ye:n==="string"?(o=mt(t))?(t=o,_n):dr:t instanceof mt?_n:t instanceof Date?gu:hu(t)?fu:Array.isArray(t)?vu:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?pu:Ye)(e,t)}var ni=180/Math.PI,ro={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function fr(e,t,n,o,i,a){var r,l,s;return(r=Math.sqrt(e*e+t*t))&&(e/=r,t/=r),(s=e*n+t*o)&&(n-=e*s,o-=t*s),(l=Math.sqrt(n*n+o*o))&&(n/=l,o/=l,s/=l),e*o<t*n&&(e=-e,t=-t,s=-s,r=-r),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*ni,skewX:Math.atan(s)*ni,scaleX:r,scaleY:l}}var on;function wu(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?ro:fr(t.a,t.b,t.c,t.d,t.e,t.f)}function _u(e){return e==null||(on||(on=document.createElementNS("http://www.w3.org/2000/svg","g")),on.setAttribute("transform",e),!(e=on.transform.baseVal.consolidate()))?ro:(e=e.matrix,fr(e.a,e.b,e.c,e.d,e.e,e.f))}function hr(e,t,n,o){function i(u){return u.length?u.pop()+" ":""}function a(u,c,f,h,g,y){if(u!==f||c!==h){var b=g.push("translate(",null,t,null,n);y.push({i:b-4,x:Ye(u,f)},{i:b-2,x:Ye(c,h)})}else(f||h)&&g.push("translate("+f+t+h+n)}function r(u,c,f,h){u!==c?(u-c>180?c+=360:c-u>180&&(u+=360),h.push({i:f.push(i(f)+"rotate(",null,o)-2,x:Ye(u,c)})):c&&f.push(i(f)+"rotate("+c+o)}function l(u,c,f,h){u!==c?h.push({i:f.push(i(f)+"skewX(",null,o)-2,x:Ye(u,c)}):c&&f.push(i(f)+"skewX("+c+o)}function s(u,c,f,h,g,y){if(u!==f||c!==h){var b=g.push(i(g)+"scale(",null,",",null,")");y.push({i:b-4,x:Ye(u,f)},{i:b-2,x:Ye(c,h)})}else(f!==1||h!==1)&&g.push(i(g)+"scale("+f+","+h+")")}return function(u,c){var f=[],h=[];return u=e(u),c=e(c),a(u.translateX,u.translateY,c.translateX,c.translateY,f,h),r(u.rotate,c.rotate,f,h),l(u.skewX,c.skewX,f,h),s(u.scaleX,u.scaleY,c.scaleX,c.scaleY,f,h),u=c=null,function(g){for(var y=-1,b=h.length,N;++y<b;)f[(N=h[y]).i]=N.x(g);return f.join("")}}}var bu=hr(wu,"px, ","px)","deg)"),xu=hr(_u,", ",")",")"),Eu=1e-12;function oi(e){return((e=Math.exp(e))+1/e)/2}function Su(e){return((e=Math.exp(e))-1/e)/2}function Nu(e){return((e=Math.exp(2*e))-1)/(e+1)}const hn=function e(t,n,o){function i(a,r){var l=a[0],s=a[1],u=a[2],c=r[0],f=r[1],h=r[2],g=c-l,y=f-s,b=g*g+y*y,N,S;if(b<Eu)S=Math.log(h/u)/t,N=function(X){return[l+X*g,s+X*y,u*Math.exp(t*X*S)]};else{var $=Math.sqrt(b),_=(h*h-u*u+o*b)/(2*u*n*$),C=(h*h-u*u-o*b)/(2*h*n*$),B=Math.log(Math.sqrt(_*_+1)-_),G=Math.log(Math.sqrt(C*C+1)-C);S=(G-B)/t,N=function(X){var Y=X*S,oe=oi(B),K=u/(n*$)*(oe*Nu(t*Y+B)-Su(B));return[l+K*g,s+K*y,u*oe/oi(t*Y+B)]}}return N.duration=S*1e3*t/Math.SQRT2,N}return i.rho=function(a){var r=Math.max(.001,+a),l=r*r,s=l*l;return e(r,l,s)},i}(Math.SQRT2,2,4);var Ct=0,zt=0,Tt=0,vr=1e3,bn,Bt,xn=0,yt=0,On=0,Xt=typeof performance=="object"&&performance.now?performance:Date,gr=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Mo(){return yt||(gr(ku),yt=Xt.now()+On)}function ku(){yt=0}function En(){this._call=this._time=this._next=null}En.prototype=pr.prototype={constructor:En,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Mo():+n)+(t==null?0:+t),!this._next&&Bt!==this&&(Bt?Bt._next=this:bn=this,Bt=this),this._call=e,this._time=n,ao()},stop:function(){this._call&&(this._call=null,this._time=1/0,ao())}};function pr(e,t,n){var o=new En;return o.restart(e,t,n),o}function $u(){Mo(),++Ct;for(var e=bn,t;e;)(t=yt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ct}function ii(){yt=(xn=Xt.now())+On,Ct=zt=0;try{$u()}finally{Ct=0,Mu(),yt=0}}function Cu(){var e=Xt.now(),t=e-xn;t>vr&&(On-=t,xn=e)}function Mu(){for(var e,t=bn,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:bn=n);Bt=e,ao(o)}function ao(e){if(!Ct){zt&&(zt=clearTimeout(zt));var t=e-yt;t>24?(e<1/0&&(zt=setTimeout(ii,e-Xt.now()-On)),Tt&&(Tt=clearInterval(Tt))):(Tt||(xn=Xt.now(),Tt=setInterval(Cu,vr)),Ct=1,gr(ii))}}function ri(e,t,n){var o=new En;return t=t==null?0:+t,o.restart(i=>{o.stop(),e(i+t)},t,n),o}var Du=In("start","end","cancel","interrupt"),Iu=[],mr=0,ai=1,lo=2,vn=3,li=4,so=5,gn=6;function Tn(e,t,n,o,i,a){var r=e.__transition;if(!r)e.__transition={};else if(n in r)return;Pu(e,n,{name:t,index:o,group:i,on:Du,tween:Iu,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:mr})}function Do(e,t){var n=Re(e,t);if(n.state>mr)throw new Error("too late; already scheduled");return n}function Ze(e,t){var n=Re(e,t);if(n.state>vn)throw new Error("too late; already running");return n}function Re(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Pu(e,t,n){var o=e.__transition,i;o[t]=n,n.timer=pr(a,0,n.time);function a(u){n.state=ai,n.timer.restart(r,n.delay,n.time),n.delay<=u&&r(u-n.delay)}function r(u){var c,f,h,g;if(n.state!==ai)return s();for(c in o)if(g=o[c],g.name===n.name){if(g.state===vn)return ri(r);g.state===li?(g.state=gn,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete o[c]):+c<t&&(g.state=gn,g.timer.stop(),g.on.call("cancel",e,e.__data__,g.index,g.group),delete o[c])}if(ri(function(){n.state===vn&&(n.state=li,n.timer.restart(l,n.delay,n.time),l(u))}),n.state=lo,n.on.call("start",e,e.__data__,n.index,n.group),n.state===lo){for(n.state=vn,i=new Array(h=n.tween.length),c=0,f=-1;c<h;++c)(g=n.tween[c].value.call(e,e.__data__,n.index,n.group))&&(i[++f]=g);i.length=f+1}}function l(u){for(var c=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(s),n.state=so,1),f=-1,h=i.length;++f<h;)i[f].call(e,c);n.state===so&&(n.on.call("end",e,e.__data__,n.index,n.group),s())}function s(){n.state=gn,n.timer.stop(),delete o[t];for(var u in o)return;delete e.__transition}}function pn(e,t){var n=e.__transition,o,i,a=!0,r;if(n){t=t==null?null:t+"";for(r in n){if((o=n[r]).name!==t){a=!1;continue}i=o.state>lo&&o.state<so,o.state=gn,o.timer.stop(),o.on.call(i?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[r]}a&&delete e.__transition}}function Ou(e){return this.each(function(){pn(this,e)})}function Tu(e,t){var n,o;return function(){var i=Ze(this,e),a=i.tween;if(a!==n){o=n=a;for(var r=0,l=o.length;r<l;++r)if(o[r].name===t){o=o.slice(),o.splice(r,1);break}}i.tween=o}}function Au(e,t,n){var o,i;if(typeof n!="function")throw new Error;return function(){var a=Ze(this,e),r=a.tween;if(r!==o){i=(o=r).slice();for(var l={name:t,value:n},s=0,u=i.length;s<u;++s)if(i[s].name===t){i[s]=l;break}s===u&&i.push(l)}a.tween=i}}function zu(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=Re(this.node(),n).tween,i=0,a=o.length,r;i<a;++i)if((r=o[i]).name===e)return r.value;return null}return this.each((t==null?Tu:Au)(n,e,t))}function Io(e,t,n){var o=e._id;return e.each(function(){var i=Ze(this,o);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return Re(i,o).value[t]}}function yr(e,t){var n;return(typeof t=="number"?Ye:t instanceof mt?_n:(n=mt(t))?(t=n,_n):dr)(e,t)}function Bu(e){return function(){this.removeAttribute(e)}}function Vu(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Hu(e,t,n){var o,i=n+"",a;return function(){var r=this.getAttribute(e);return r===i?null:r===o?a:a=t(o=r,n)}}function Ru(e,t,n){var o,i=n+"",a;return function(){var r=this.getAttributeNS(e.space,e.local);return r===i?null:r===o?a:a=t(o=r,n)}}function Lu(e,t,n){var o,i,a;return function(){var r,l=n(this),s;return l==null?void this.removeAttribute(e):(r=this.getAttribute(e),s=l+"",r===s?null:r===o&&s===i?a:(i=s,a=t(o=r,l)))}}function Fu(e,t,n){var o,i,a;return function(){var r,l=n(this),s;return l==null?void this.removeAttributeNS(e.space,e.local):(r=this.getAttributeNS(e.space,e.local),s=l+"",r===s?null:r===o&&s===i?a:(i=s,a=t(o=r,l)))}}function Yu(e,t){var n=Pn(e),o=n==="transform"?xu:yr;return this.attrTween(e,typeof t=="function"?(n.local?Fu:Lu)(n,o,Io(this,"attr."+e,t)):t==null?(n.local?Vu:Bu)(n):(n.local?Ru:Hu)(n,o,t))}function Gu(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Wu(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Xu(e,t){var n,o;function i(){var a=t.apply(this,arguments);return a!==o&&(n=(o=a)&&Wu(e,a)),n}return i._value=t,i}function Uu(e,t){var n,o;function i(){var a=t.apply(this,arguments);return a!==o&&(n=(o=a)&&Gu(e,a)),n}return i._value=t,i}function Zu(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var o=Pn(e);return this.tween(n,(o.local?Xu:Uu)(o,t))}function Ku(e,t){return function(){Do(this,e).delay=+t.apply(this,arguments)}}function qu(e,t){return t=+t,function(){Do(this,e).delay=t}}function ju(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Ku:qu)(t,e)):Re(this.node(),t).delay}function Ju(e,t){return function(){Ze(this,e).duration=+t.apply(this,arguments)}}function Qu(e,t){return t=+t,function(){Ze(this,e).duration=t}}function ec(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Ju:Qu)(t,e)):Re(this.node(),t).duration}function tc(e,t){if(typeof t!="function")throw new Error;return function(){Ze(this,e).ease=t}}function nc(e){var t=this._id;return arguments.length?this.each(tc(t,e)):Re(this.node(),t).ease}function oc(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Ze(this,e).ease=n}}function ic(e){if(typeof e!="function")throw new Error;return this.each(oc(this._id,e))}function rc(e){typeof e!="function"&&(e=qi(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var a=t[i],r=a.length,l=o[i]=[],s,u=0;u<r;++u)(s=a[u])&&e.call(s,s.__data__,u,a)&&l.push(s);return new tt(o,this._parents,this._name,this._id)}function ac(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,i=n.length,a=Math.min(o,i),r=new Array(o),l=0;l<a;++l)for(var s=t[l],u=n[l],c=s.length,f=r[l]=new Array(c),h,g=0;g<c;++g)(h=s[g]||u[g])&&(f[g]=h);for(;l<o;++l)r[l]=t[l];return new tt(r,this._parents,this._name,this._id)}function lc(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 sc(e,t,n){var o,i,a=lc(t)?Do:Ze;return function(){var r=a(this,e),l=r.on;l!==o&&(i=(o=l).copy()).on(t,n),r.on=i}}function uc(e,t){var n=this._id;return arguments.length<2?Re(this.node(),n).on.on(e):this.each(sc(n,e,t))}function cc(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function dc(){return this.on("end.remove",cc(this._id))}function fc(e){var t=this._name,n=this._id;typeof e!="function"&&(e=No(e));for(var o=this._groups,i=o.length,a=new Array(i),r=0;r<i;++r)for(var l=o[r],s=l.length,u=a[r]=new Array(s),c,f,h=0;h<s;++h)(c=l[h])&&(f=e.call(c,c.__data__,h,l))&&("__data__"in c&&(f.__data__=c.__data__),u[h]=f,Tn(u[h],t,n,h,u,Re(c,n)));return new tt(a,this._parents,t,n)}function hc(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Ki(e));for(var o=this._groups,i=o.length,a=[],r=[],l=0;l<i;++l)for(var s=o[l],u=s.length,c,f=0;f<u;++f)if(c=s[f]){for(var h=e.call(c,c.__data__,f,s),g,y=Re(c,n),b=0,N=h.length;b<N;++b)(g=h[b])&&Tn(g,t,n,b,h,y);a.push(h),r.push(c)}return new tt(a,r,t,n)}var vc=jt.prototype.constructor;function gc(){return new vc(this._groups,this._parents)}function pc(e,t){var n,o,i;return function(){var a=$t(this,e),r=(this.style.removeProperty(e),$t(this,e));return a===r?null:a===n&&r===o?i:i=t(n=a,o=r)}}function wr(e){return function(){this.style.removeProperty(e)}}function mc(e,t,n){var o,i=n+"",a;return function(){var r=$t(this,e);return r===i?null:r===o?a:a=t(o=r,n)}}function yc(e,t,n){var o,i,a;return function(){var r=$t(this,e),l=n(this),s=l+"";return l==null&&(s=l=(this.style.removeProperty(e),$t(this,e))),r===s?null:r===o&&s===i?a:(i=s,a=t(o=r,l))}}function wc(e,t){var n,o,i,a="style."+t,r="end."+a,l;return function(){var s=Ze(this,e),u=s.on,c=s.value[a]==null?l||(l=wr(t)):void 0;(u!==n||i!==c)&&(o=(n=u).copy()).on(r,i=c),s.on=o}}function _c(e,t,n){var o=(e+="")=="transform"?bu:yr;return t==null?this.styleTween(e,pc(e,o)).on("end.style."+e,wr(e)):typeof t=="function"?this.styleTween(e,yc(e,o,Io(this,"style."+e,t))).each(wc(this._id,e)):this.styleTween(e,mc(e,o,t),n).on("end.style."+e,null)}function bc(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function xc(e,t,n){var o,i;function a(){var r=t.apply(this,arguments);return r!==i&&(o=(i=r)&&bc(e,r,n)),o}return a._value=t,a}function Ec(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,xc(e,t,n??""))}function Sc(e){return function(){this.textContent=e}}function Nc(e){return function(){var t=e(this);this.textContent=t??""}}function kc(e){return this.tween("text",typeof e=="function"?Nc(Io(this,"text",e)):Sc(e==null?"":e+""))}function $c(e){return function(t){this.textContent=e.call(this,t)}}function Cc(e){var t,n;function o(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&$c(i)),t}return o._value=e,o}function Mc(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,Cc(e))}function Dc(){for(var e=this._name,t=this._id,n=_r(),o=this._groups,i=o.length,a=0;a<i;++a)for(var r=o[a],l=r.length,s,u=0;u<l;++u)if(s=r[u]){var c=Re(s,t);Tn(s,e,n,u,r,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new tt(o,this._parents,e,n)}function Ic(){var e,t,n=this,o=n._id,i=n.size();return new Promise(function(a,r){var l={value:r},s={value:function(){--i===0&&a()}};n.each(function(){var u=Ze(this,o),c=u.on;c!==e&&(t=(e=c).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(s)),u.on=t}),i===0&&a()})}var Pc=0;function tt(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function _r(){return++Pc}var Ke=jt.prototype;tt.prototype={constructor:tt,select:fc,selectAll:hc,selectChild:Ke.selectChild,selectChildren:Ke.selectChildren,filter:rc,merge:ac,selection:gc,transition:Dc,call:Ke.call,nodes:Ke.nodes,node:Ke.node,size:Ke.size,empty:Ke.empty,each:Ke.each,on:uc,attr:Yu,attrTween:Zu,style:_c,styleTween:Ec,text:kc,textTween:Mc,remove:dc,tween:zu,delay:ju,duration:ec,ease:nc,easeVarying:ic,end:Ic,[Symbol.iterator]:Ke[Symbol.iterator]};function Oc(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Tc={time:null,delay:0,duration:250,ease:Oc};function Ac(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 zc(e){var t,n;e instanceof tt?(t=e._id,e=e._name):(t=_r(),(n=Tc).time=Mo(),e=e==null?null:e+"");for(var o=this._groups,i=o.length,a=0;a<i;++a)for(var r=o[a],l=r.length,s,u=0;u<l;++u)(s=r[u])&&Tn(s,e,t,u,r,n||Ac(s,t));return new tt(o,this._parents,e,t)}jt.prototype.interrupt=Ou;jt.prototype.transition=zc;const rn=e=>()=>e;function Bc(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 Je(e,t,n){this.k=e,this.x=t,this.y=n}Je.prototype={constructor:Je,scale:function(e){return e===1?this:new Je(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Je(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 Mt=new Je(1,0,0);Je.prototype;function Xn(e){e.stopImmediatePropagation()}function At(e){e.preventDefault(),e.stopImmediatePropagation()}function Vc(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Hc(){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 si(){return this.__zoom||Mt}function Rc(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Lc(){return navigator.maxTouchPoints||"ontouchstart"in this}function Fc(e,t,n){var o=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],r=e.invertY(t[1][1])-n[1][1];return e.translate(i>o?(o+i)/2:Math.min(0,o)||Math.max(0,i),r>a?(a+r)/2:Math.min(0,a)||Math.max(0,r))}function Yc(){var e=Vc,t=Hc,n=Fc,o=Rc,i=Lc,a=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],l=250,s=hn,u=In("start","zoom","end"),c,f,h,g=500,y=150,b=0,N=10;function S(x){x.property("__zoom",si).on("wheel.zoom",Y,{passive:!1}).on("mousedown.zoom",oe).on("dblclick.zoom",K).filter(i).on("touchstart.zoom",A).on("touchmove.zoom",k).on("touchend.zoom touchcancel.zoom",ee).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}S.transform=function(x,I,E,M){var T=x.selection?x.selection():x;T.property("__zoom",si),x!==T?B(x,I,E,M):T.interrupt().each(function(){G(this,arguments).event(M).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},S.scaleBy=function(x,I,E,M){S.scaleTo(x,function(){var T=this.__zoom.k,V=typeof I=="function"?I.apply(this,arguments):I;return T*V},E,M)},S.scaleTo=function(x,I,E,M){S.transform(x,function(){var T=t.apply(this,arguments),V=this.__zoom,H=E==null?C(T):typeof E=="function"?E.apply(this,arguments):E,U=V.invert(H),ie=typeof I=="function"?I.apply(this,arguments):I;return n(_($(V,ie),H,U),T,r)},E,M)},S.translateBy=function(x,I,E,M){S.transform(x,function(){return n(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof E=="function"?E.apply(this,arguments):E),t.apply(this,arguments),r)},null,M)},S.translateTo=function(x,I,E,M,T){S.transform(x,function(){var V=t.apply(this,arguments),H=this.__zoom,U=M==null?C(V):typeof M=="function"?M.apply(this,arguments):M;return n(Mt.translate(U[0],U[1]).scale(H.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof E=="function"?-E.apply(this,arguments):-E),V,r)},M,T)};function $(x,I){return I=Math.max(a[0],Math.min(a[1],I)),I===x.k?x:new Je(I,x.x,x.y)}function _(x,I,E){var M=I[0]-E[0]*x.k,T=I[1]-E[1]*x.k;return M===x.x&&T===x.y?x:new Je(x.k,M,T)}function C(x){return[(+x[0][0]+ +x[1][0])/2,(+x[0][1]+ +x[1][1])/2]}function B(x,I,E,M){x.on("start.zoom",function(){G(this,arguments).event(M).start()}).on("interrupt.zoom end.zoom",function(){G(this,arguments).event(M).end()}).tween("zoom",function(){var T=this,V=arguments,H=G(T,V).event(M),U=t.apply(T,V),ie=E==null?C(U):typeof E=="function"?E.apply(T,V):E,le=Math.max(U[1][0]-U[0][0],U[1][1]-U[0][1]),he=T.__zoom,q=typeof I=="function"?I.apply(T,V):I,j=s(he.invert(ie).concat(le/he.k),q.invert(ie).concat(le/q.k));return function(L){if(L===1)L=q;else{var ce=j(L),_e=le/ce[2];L=new Je(_e,ie[0]-ce[0]*_e,ie[1]-ce[1]*_e)}H.zoom(null,L)}})}function G(x,I,E){return!E&&x.__zooming||new X(x,I)}function X(x,I){this.that=x,this.args=I,this.active=0,this.sourceEvent=null,this.extent=t.apply(x,I),this.taps=0}X.prototype={event:function(x){return x&&(this.sourceEvent=x),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(x,I){return this.mouse&&x!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&x!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&x!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(x){var I=Be(this.that).datum();u.call(x,this.that,new Bc(x,{sourceEvent:this.sourceEvent,target:S,transform:this.that.__zoom,dispatch:u}),I)}};function Y(x,...I){if(!e.apply(this,arguments))return;var E=G(this,I).event(x),M=this.__zoom,T=Math.max(a[0],Math.min(a[1],M.k*Math.pow(2,o.apply(this,arguments)))),V=Fe(x);if(E.wheel)(E.mouse[0][0]!==V[0]||E.mouse[0][1]!==V[1])&&(E.mouse[1]=M.invert(E.mouse[0]=V)),clearTimeout(E.wheel);else{if(M.k===T)return;E.mouse=[V,M.invert(V)],pn(this),E.start()}At(x),E.wheel=setTimeout(H,y),E.zoom("mouse",n(_($(M,T),E.mouse[0],E.mouse[1]),E.extent,r));function H(){E.wheel=null,E.end()}}function oe(x,...I){if(h||!e.apply(this,arguments))return;var E=x.currentTarget,M=G(this,I,!0).event(x),T=Be(x.view).on("mousemove.zoom",ie,!0).on("mouseup.zoom",le,!0),V=Fe(x,E),H=x.clientX,U=x.clientY;ar(x.view),Xn(x),M.mouse=[V,this.__zoom.invert(V)],pn(this),M.start();function ie(he){if(At(he),!M.moved){var q=he.clientX-H,j=he.clientY-U;M.moved=q*q+j*j>b}M.event(he).zoom("mouse",n(_(M.that.__zoom,M.mouse[0]=Fe(he,E),M.mouse[1]),M.extent,r))}function le(he){T.on("mousemove.zoom mouseup.zoom",null),lr(he.view,M.moved),At(he),M.event(he).end()}}function K(x,...I){if(e.apply(this,arguments)){var E=this.__zoom,M=Fe(x.changedTouches?x.changedTouches[0]:x,this),T=E.invert(M),V=E.k*(x.shiftKey?.5:2),H=n(_($(E,V),M,T),t.apply(this,I),r);At(x),l>0?Be(this).transition().duration(l).call(B,H,M,x):Be(this).call(S.transform,H,M,x)}}function A(x,...I){if(e.apply(this,arguments)){var E=x.touches,M=E.length,T=G(this,I,x.changedTouches.length===M).event(x),V,H,U,ie;for(Xn(x),H=0;H<M;++H)U=E[H],ie=Fe(U,this),ie=[ie,this.__zoom.invert(ie),U.identifier],T.touch0?!T.touch1&&T.touch0[2]!==ie[2]&&(T.touch1=ie,T.taps=0):(T.touch0=ie,V=!0,T.taps=1+!!c);c&&(c=clearTimeout(c)),V&&(T.taps<2&&(f=ie[0],c=setTimeout(function(){c=null},g)),pn(this),T.start())}}function k(x,...I){if(this.__zooming){var E=G(this,I).event(x),M=x.changedTouches,T=M.length,V,H,U,ie;for(At(x),V=0;V<T;++V)H=M[V],U=Fe(H,this),E.touch0&&E.touch0[2]===H.identifier?E.touch0[0]=U:E.touch1&&E.touch1[2]===H.identifier&&(E.touch1[0]=U);if(H=E.that.__zoom,E.touch1){var le=E.touch0[0],he=E.touch0[1],q=E.touch1[0],j=E.touch1[1],L=(L=q[0]-le[0])*L+(L=q[1]-le[1])*L,ce=(ce=j[0]-he[0])*ce+(ce=j[1]-he[1])*ce;H=$(H,Math.sqrt(L/ce)),U=[(le[0]+q[0])/2,(le[1]+q[1])/2],ie=[(he[0]+j[0])/2,(he[1]+j[1])/2]}else if(E.touch0)U=E.touch0[0],ie=E.touch0[1];else return;E.zoom("touch",n(_(H,U,ie),E.extent,r))}}function ee(x,...I){if(this.__zooming){var E=G(this,I).event(x),M=x.changedTouches,T=M.length,V,H;for(Xn(x),h&&clearTimeout(h),h=setTimeout(function(){h=null},g),V=0;V<T;++V)H=M[V],E.touch0&&E.touch0[2]===H.identifier?delete E.touch0:E.touch1&&E.touch1[2]===H.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&&(H=Fe(H,this),Math.hypot(f[0]-H[0],f[1]-H[1])<N)){var U=Be(this).on("dblclick.zoom");U&&U.apply(this,arguments)}}}return S.wheelDelta=function(x){return arguments.length?(o=typeof x=="function"?x:rn(+x),S):o},S.filter=function(x){return arguments.length?(e=typeof x=="function"?x:rn(!!x),S):e},S.touchable=function(x){return arguments.length?(i=typeof x=="function"?x:rn(!!x),S):i},S.extent=function(x){return arguments.length?(t=typeof x=="function"?x:rn([[+x[0][0],+x[0][1]],[+x[1][0],+x[1][1]]]),S):t},S.scaleExtent=function(x){return arguments.length?(a[0]=+x[0],a[1]=+x[1],S):[a[0],a[1]]},S.translateExtent=function(x){return arguments.length?(r[0][0]=+x[0][0],r[1][0]=+x[1][0],r[0][1]=+x[0][1],r[1][1]=+x[1][1],S):[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},S.constrain=function(x){return arguments.length?(n=x,S):n},S.duration=function(x){return arguments.length?(l=+x,S):l},S.interpolate=function(x){return arguments.length?(s=x,S):s},S.on=function(){var x=u.on.apply(u,arguments);return x===u?S:x},S.clickDistance=function(x){return arguments.length?(b=(x=+x)*x,S):Math.sqrt(b)},S.tapDistance=function(x){return arguments.length?(N=+x,S):N},S}var Z=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(Z||{}),Po=(e=>(e.Partial="partial",e.Full="full",e))(Po||{}),ft=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(ft||{}),st=(e=>(e.Strict="strict",e.Loose="loose",e))(st||{}),uo=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(uo||{}),Rt=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(Rt||{}),br=(e=>(e.TopLeft="top-left",e.TopCenter="top-center",e.TopRight="top-right",e.BottomLeft="bottom-left",e.BottomCenter="bottom-center",e.BottomRight="bottom-right",e))(br||{});const Gc=["INPUT","SELECT","TEXTAREA"],Wc=typeof document<"u"?document:null;function co(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,a=typeof(o==null?void 0:o.closest)=="function"?o.closest(".nokey"):null;return Gc.includes(o==null?void 0:o.nodeName)||i||!!a}function Xc(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function ui(e,t,n,o){const i=t.replace("+",`
`).replace(`
`,`
+`).split(`
`).map(r=>r.trim().toLowerCase());if(i.length===1)return e.toLowerCase()===t.toLowerCase();o||n.add(e.toLowerCase());const a=i.every((r,l)=>n.has(r)&&Array.from(n.values())[l]===i[l]);return o&&n.delete(e.toLowerCase()),a}function Uc(e,t){return n=>{if(!n.code&&!n.key)return!1;const o=Zc(n.code,e);return Array.isArray(e)?e.some(i=>ui(n[o],i,t,n.type==="keyup")):ui(n[o],e,t,n.type==="keyup")}}function Zc(e,t){return t.includes(e)?"code":"key"}function Lt(e,t){const n=te(()=>pe(t==null?void 0:t.target)??Wc),o=at(pe(e)===!0);let i=!1;const a=new Set;let r=s(pe(e));Ee(()=>pe(e),(u,c)=>{typeof c=="boolean"&&typeof u!="boolean"&&l(),r=s(u)},{immediate:!0}),Ui(["blur","contextmenu"],l),Wo((...u)=>r(...u),u=>{var c,f;const h=pe(t==null?void 0:t.actInsideInputWithModifier)??!0,g=pe(t==null?void 0:t.preventDefault)??!1;if(i=Xc(u),(!i||i&&!h)&&co(u))return;const b=((f=(c=u.composedPath)==null?void 0:c.call(u))==null?void 0:f[0])||u.target,N=(b==null?void 0:b.nodeName)==="BUTTON"||(b==null?void 0:b.nodeName)==="A";!g&&(i||!N)&&u.preventDefault(),o.value=!0},{eventName:"keydown",target:n}),Wo((...u)=>r(...u),u=>{const c=pe(t==null?void 0:t.actInsideInputWithModifier)??!0;if(o.value){if((!i||i&&!c)&&co(u))return;i=!1,o.value=!1}},{eventName:"keyup",target:n});function l(){i=!1,a.clear(),o.value=pe(e)===!0}function s(u){return u===null?(l(),()=>!1):typeof u=="boolean"?(l(),o.value=u,()=>!1):Array.isArray(u)||typeof u=="string"?Uc(u,a):u}return o}const xr="vue-flow__node-desc",Er="vue-flow__edge-desc",Kc="vue-flow__aria-live",Sr=["Enter"," ","Escape"],Nt={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Sn(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function Nn(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 An(e){return{width:e.offsetWidth,height:e.offsetHeight}}function wt(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function Nr(e,t){return{x:wt(e.x,t[0][0],t[1][0]),y:wt(e.y,t[0][1],t[1][1])}}function ci(e){const t=e.getRootNode();return"elementFromPoint"in t?t:window.document}function ut(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function pt(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!ut(e)}function Vt(e){return pt(e)&&"computedPosition"in e}function an(e){return!Number.isNaN(e)&&Number.isFinite(e)}function qc(e){return an(e.width)&&an(e.height)&&an(e.x)&&an(e.y)}function jc(e,t,n){const o={id:e.id.toString(),type:e.type??"default",dimensions:lt({width:0,height:0}),computedPosition:lt({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:Ce(e.data)?e.data:{},events:lt(Ce(e.events)?e.events:{})};return Object.assign(t??o,e,{id:e.id.toString(),parentNode:n})}function kr(e,t,n){var o,i;const a={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:Ce(e.data)?e.data:{},events:lt(Ce(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??(n==null?void 0:n.interactionWidth),...n??{}};return Object.assign(t??a,e,{id:e.id.toString()})}function $r(e,t,n,o){const i=typeof e=="string"?e:e.id,a=new Set,r=o==="source"?"target":"source";for(const l of n)l[r]===i&&a.add(l[o]);return t.filter(l=>a.has(l.id))}function Jc(...e){if(e.length===3){const[a,r,l]=e;return $r(a,r,l,"target")}const[t,n]=e,o=typeof t=="string"?t:t.id;return n.filter(a=>ut(a)&&a.source===o).map(a=>n.find(r=>pt(r)&&r.id===a.target))}function Qc(...e){if(e.length===3){const[a,r,l]=e;return $r(a,r,l,"source")}const[t,n]=e,o=typeof t=="string"?t:t.id;return n.filter(a=>ut(a)&&a.target===o).map(a=>n.find(r=>pt(r)&&r.id===a.source))}function Cr({source:e,sourceHandle:t,target:n,targetHandle:o}){return`vueflow__edge-${e}${t??""}-${n}${o??""}`}function ed(e,t){return t.some(n=>ut(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 Ut({x:e,y:t},{x:n,y:o,zoom:i}){return{x:e*i+n,y:t*i+o}}function Zt({x:e,y:t},{x:n,y:o,zoom:i},a=!1,r=[1,1]){const l={x:(e-n)/i,y:(t-o)/i};return a?zn(l,r):l}function td(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 Mr({x:e,y:t,width:n,height:o}){return{x:e,y:t,x2:e+n,y2:t+o}}function nd({x:e,y:t,x2:n,y2:o}){return{x:e,y:t,width:n-e,height:o-t}}function Dr(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=td(t,Mr({...o.computedPosition,...o.dimensions}))}return nd(t)}function Ir(e,t,n={x:0,y:0,zoom:1},o=!1,i=!1){const a={...Zt(t,n),width:t.width/n.zoom,height:t.height/n.zoom},r=[];for(const l of e){const{dimensions:s,selectable:u=!0,hidden:c=!1}=l,f=s.width??l.width??null,h=s.height??l.height??null;if(i&&!u||c)continue;const g=Nn(a,Sn(l)),y=f===null||h===null,b=o&&g>0,N=(f??0)*(h??0);(y||b||g>=N||l.dragging)&&r.push(l)}return r}function Pr(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 xt(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=Number.parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=Number.parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return Qt(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function od(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=xt(e,n),i=xt(e,t);return{top:o,right:i,bottom:o,left:i,x:i*2,y:o*2}}if(typeof e=="object"){const o=xt(e.top??e.y??0,n),i=xt(e.bottom??e.y??0,n),a=xt(e.left??e.x??0,t),r=xt(e.right??e.x??0,t);return{top:o,right:r,bottom:i,left:a,x:a+r,y:o+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function id(e,t,n,o,i,a){const{x:r,y:l}=Ut(e,{x:t,y:n,zoom:o}),{x:s,y:u}=Ut({x:e.x+e.width,y:e.y+e.height},{x:t,y:n,zoom:o}),c=i-s,f=a-u;return{left:Math.floor(r),top:Math.floor(l),right:Math.floor(c),bottom:Math.floor(f)}}function di(e,t,n,o,i,a=.1){const r=od(a,t,n),l=(t-r.x)/e.width,s=(n-r.y)/e.height,u=Math.min(l,s),c=wt(u,o,i),f=e.x+e.width/2,h=e.y+e.height/2,g=t/2-f*c,y=n/2-h*c,b=id(e,g,y,c,t,n),N={left:Math.min(b.left-r.left,0),top:Math.min(b.top-r.top,0),right:Math.min(b.right-r.right,0),bottom:Math.min(b.bottom-r.bottom,0)};return{x:g-N.left+N.right,y:y-N.top+N.bottom,zoom:c}}function rd(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function Or(e,t){if(!e.parentNode)return!1;const n=t.get(e.parentNode);return n?n.selected?!0:Or(n,t):!1}function Kt(e,t){return typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`}function fi(e){const t=e.ctrlKey&&kn()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t}function hi(e,t,n){return e<t?wt(Math.abs(e-t),1,t)/t:e>n?-wt(Math.abs(e-n),1,t)/t:0}function Tr(e,t,n=15,o=40){const i=hi(e.x,o,t.width-o)*n,a=hi(e.y,o,t.height-o)*n;return[i,a]}function Un(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 a=Number(i.width.replace("px",""));i.width=`${a+n}px`}else i.width+=n;if(o>0)if(typeof i.height=="string"){const a=Number(i.height.replace("px",""));i.height=`${a+o}px`}else i.height+=o;if(e.position.x<0){const a=Math.abs(e.position.x);if(t.position.x=t.position.x-a,typeof i.width=="string"){const r=Number(i.width.replace("px",""));i.width=`${r+a}px`}else i.width+=a;e.position.x=0}if(e.position.y<0){const a=Math.abs(e.position.y);if(t.position.y=t.position.y-a,typeof i.height=="string"){const r=Number(i.height.replace("px",""));i.height=`${r+a}px`}else i.height+=a;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=a=>{const r=t.style;return{...r(a),...i}}:t.style={...t.style,...i}}}}function vi(e,t){var n,o;const i=e.filter(r=>r.type==="add"||r.type==="remove");for(const r of i)if(r.type==="add")t.findIndex(s=>s.id===r.item.id)===-1&&t.push(r.item);else if(r.type==="remove"){const l=t.findIndex(s=>s.id===r.id);l!==-1&&t.splice(l,1)}const a=t.map(r=>r.id);for(const r of t)for(const l of e)if(l.id===r.id)switch(l.type){case"select":r.selected=l.selected;break;case"position":if(Vt(r)&&(typeof l.position<"u"&&(r.position=l.position),typeof l.dragging<"u"&&(r.dragging=l.dragging),r.expandParent&&r.parentNode)){const s=t[a.indexOf(r.parentNode)];s&&Vt(s)&&Un(r,s)}break;case"dimensions":if(Vt(r)&&(typeof l.dimensions<"u"&&(r.dimensions=l.dimensions),typeof l.updateStyle<"u"&&l.updateStyle&&(r.style={...r.style||{},width:`${(n=l.dimensions)==null?void 0:n.width}px`,height:`${(o=l.dimensions)==null?void 0:o.height}px`}),typeof l.resizing<"u"&&(r.resizing=l.resizing),r.expandParent&&r.parentNode)){const s=t[a.indexOf(r.parentNode)];s&&Vt(s)&&(!!s.dimensions.width&&!!s.dimensions.height?Un(r,s):et(()=>{Un(r,s)}))}break}return t}function it(e,t){return{id:e,type:"select",selected:t}}function gi(e){return{item:e,type:"add"}}function pi(e){return{id:e,type:"remove"}}function mi(e,t,n,o,i){return{id:e,source:t,target:n,sourceHandle:o||null,targetHandle:i||null,type:"remove"}}function rt(e,t=new Set,n=!1){const o=[];for(const[i,a]of e){const r=t.has(i);!(a.selected===void 0&&!r)&&a.selected!==r&&(n&&(a.selected=r),o.push(it(a.id,r)))}return o}const yi=()=>{};function W(e){const t=new Set;let n=yi,o=()=>!1;const i=()=>t.size>0||o(),a=h=>{n=h},r=()=>{n=yi},l=h=>{o=h},s=()=>{o=()=>!1},u=h=>{t.delete(h)};return{on:h=>{t.add(h);const g=()=>u(h);return Ft(g),{off:g}},off:u,trigger:h=>{const g=[n];return i()?g.push(...t):e&&g.push(e),Promise.allSettled(g.map(y=>y(h)))},hasListeners:i,listeners:t,setEmitter:a,removeEmitter:r,setHasEmitListeners:l,removeHasEmitListeners:s}}function wi(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 ad(e,t,n,o){var i,a;const r=new Map;for(const[l,s]of e)(s.selected||s.id===o)&&(!s.parentNode||!Or(s,e))&&(s.draggable||t&&typeof s.draggable>"u")&&e.get(l)&&r.set(l,{id:s.id,position:s.position||{x:0,y:0},distance:{x:n.x-((i=s.computedPosition)==null?void 0:i.x)||0,y:n.y-((a=s.computedPosition)==null?void 0:a.y)||0},from:{x:s.computedPosition.x,y:s.computedPosition.y},extent:s.extent,parentNode:s.parentNode,dimensions:{...s.dimensions},expandParent:s.expandParent});return Array.from(r.values())}function Zn({id:e,dragItems:t,findNode:n}){const o=[];for(const i of t){const a=n(i.id);a&&o.push(a)}return[e?o.find(i=>i.id===e):o[0],o]}function Ar(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 ld(e,t,n){const[o,i,a,r]=typeof e!="string"?Ar(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+r,n.computedPosition.y+o],[n.computedPosition.x+n.dimensions.width-i,n.computedPosition.y+n.dimensions.height-a]]:!1}function sd(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 a=ld(i,e,o);a&&(i=a)}else t(new Ie(Me.NODE_EXTENT_INVALID,e.id)),i=n;else if(Array.isArray(i)){const a=(o==null?void 0:o.computedPosition.x)||0,r=(o==null?void 0:o.computedPosition.y)||0;i=[[i[0][0]+a,i[0][1]+r],[i[1][0]+a,i[1][1]+r]]}else if(i!=="parent"&&(i!=null&&i.range)&&Array.isArray(i.range)){const[a,r,l,s]=Ar(i.padding),u=(o==null?void 0:o.computedPosition.x)||0,c=(o==null?void 0:o.computedPosition.y)||0;i=[[i.range[0][0]+u+s,i.range[0][1]+c+a],[i.range[1][0]+u-r,i.range[1][1]+c-l]]}return i==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:i}function ud({width:e,height:t},n){return[n[0],[n[1][0]-(e||0),n[1][1]-(t||0)]]}function Oo(e,t,n,o,i){const a=ud(e.dimensions,sd(e,n,o,i)),r=Nr(t,a);return{position:{x:r.x-((i==null?void 0:i.computedPosition.x)||0),y:r.y-((i==null?void 0:i.computedPosition.y)||0)},computedPosition:r}}function Dt(e,t,n=Z.Left,o=!1){const i=((t==null?void 0:t.x)??0)+e.computedPosition.x,a=((t==null?void 0:t.y)??0)+e.computedPosition.y,{width:r,height:l}=t??hd(e);if(o)return{x:i+r/2,y:a+l/2};switch((t==null?void 0:t.position)??n){case Z.Top:return{x:i+r/2,y:a};case Z.Right:return{x:i+r,y:a+l/2};case Z.Bottom:return{x:i+r/2,y:a+l};case Z.Left:return{x:i,y:a+l/2}}}function _i(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function cd({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:o,targetWidth:i,targetHeight:a,width:r,height:l,viewport:s}){const u={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+i),y2:Math.max(e.y+o,t.y+a)};u.x===u.x2&&(u.x2+=1),u.y===u.y2&&(u.y2+=1);const c=Mr({x:(0-s.x)/s.zoom,y:(0-s.y)/s.zoom,width:r/s.zoom,height:l/s.zoom}),f=Math.max(0,Math.min(c.x2,u.x2)-Math.max(c.x,u.x)),h=Math.max(0,Math.min(c.y2,u.y2)-Math.max(c.y,u.y));return Math.ceil(f*h)>0}function dd(e,t,n=!1){const o=typeof e.zIndex=="number";let i=o?e.zIndex:0;const a=t(e.source),r=t(e.target);return!a||!r?0:(n&&(i=o?e.zIndex:Math.max(a.computedPosition.z||0,r.computedPosition.z||0)),i)}var Me=(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))(Me||{});const bi={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 Ie extends Error{constructor(t,...n){var o;super((o=bi[t])==null?void 0:o.call(bi,...n)),this.name="VueFlowError",this.code=t,this.args=n}}function To(e){return"clientX"in e}function fd(e){return"sourceEvent"in e}function Ge(e,t){const n=To(e);let o,i;return n?(o=e.clientX,i=e.clientY):"touches"in e&&e.touches.length>0?(o=e.touches[0].clientX,i=e.touches[0].clientY):"changedTouches"in e&&e.changedTouches.length>0?(o=e.changedTouches[0].clientX,i=e.changedTouches[0].clientY):(o=0,i=0),{x:o-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}}const kn=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function hd(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 zn(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}const vd=()=>!0;function Kn(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function gd(e,t,n){const o=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const a of t.values())Nn(i,Sn(a))>0&&o.push(a);return o}const pd=250;function md(e,t,n,o){var i,a;let r=[],l=Number.POSITIVE_INFINITY;const s=gd(e,n,t+pd);for(const u of s){const c=[...((i=u.handleBounds)==null?void 0:i.source)??[],...((a=u.handleBounds)==null?void 0:a.target)??[]];for(const f of c){if(o.nodeId===f.nodeId&&o.type===f.type&&o.id===f.id)continue;const{x:h,y:g}=Dt(u,f,f.position,!0),y=Math.sqrt((h-e.x)**2+(g-e.y)**2);y>t||(y<l?(r=[{...f,x:h,y:g}],l=y):y===l&&r.push({...f,x:h,y:g}))}}if(!r.length)return null;if(r.length>1){const u=o.type==="source"?"target":"source";return r.find(c=>c.type===u)??r[0]}return r[0]}function xi(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:i,fromType:a,doc:r,lib:l,flowId:s,isValidConnection:u=vd},c,f,h,g){const y=a==="target",b=t?r.querySelector(`.${l}-flow__handle[data-id="${s}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:N,y:S}=Ge(e),$=r.elementFromPoint(N,S),_=$!=null&&$.classList.contains(`${l}-flow__handle`)?$:b,C={handleDomNode:_,isValid:!1,connection:null,toHandle:null};if(_){const B=zr(void 0,_),G=_.getAttribute("data-nodeid"),X=_.getAttribute("data-handleid"),Y=_.classList.contains("connectable"),oe=_.classList.contains("connectableend");if(!G||!B)return C;const K={source:y?G:o,sourceHandle:y?X:i,target:y?o:G,targetHandle:y?i:X};C.connection=K;const k=Y&&oe&&(n===st.Strict?y&&B==="source"||!y&&B==="target":G!==o||X!==i);C.isValid=k&&u(K,{nodes:f,edges:c,sourceNode:h(K.source),targetNode:h(K.target)}),C.toHandle=Br(G,B,X,g,n,!0)}return C}function zr(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function yd(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function wd(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function Br(e,t,n,o,i,a=!1){var r,l,s;const u=o.get(e);if(!u)return null;const c=i===st.Strict?(r=u.handleBounds)==null?void 0:r[t]:[...((l=u.handleBounds)==null?void 0:l.source)??[],...((s=u.handleBounds)==null?void 0:s.target)??[]],f=(n?c==null?void 0:c.find(h=>h.id===n):c==null?void 0:c[0])??null;return f&&a?{...f,...Dt(u,f,f.position,!0)}:f}const fo={[Z.Left]:Z.Right,[Z.Right]:Z.Left,[Z.Top]:Z.Bottom,[Z.Bottom]:Z.Top},_d=["production","prod"];function Qt(e,...t){Vr()&&console.warn(`[Vue Flow]: ${e}`,...t)}function Vr(){return!_d.includes("production")}function Ei(e,t,n,o,i){const a=t.querySelectorAll(`.vue-flow__handle.${e}`);return a!=null&&a.length?Array.from(a).map(r=>{const l=r.getBoundingClientRect();return{id:r.getAttribute("data-handleid"),type:e,nodeId:i,position:r.getAttribute("data-handlepos"),x:(l.left-n.left)/o,y:(l.top-n.top)/o,...An(r)}}):null}function ho(e,t,n,o,i,a=!1,r){i.value=!1,e.selected?(a||e.selected&&t)&&(o([e]),et(()=>{r.blur()})):n([e])}function Ce(e){return typeof D(e)<"u"}function bd(e,t,n,o){if(!e||!e.source||!e.target)return n(new Ie(Me.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let i;return ut(e)?i=e:i={...e,id:Cr(e)},i=kr(i,void 0,o),ed(i,t)?!1:i}function xd(e,t,n,o,i){if(!t.source||!t.target)return i(new Ie(Me.EDGE_INVALID,e.id)),!1;if(!n)return i(new Ie(Me.EDGE_NOT_FOUND,e.id)),!1;const{id:a,...r}=e;return{...r,id:o?Cr(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function Si(e,t,n){const o={},i=[];for(let a=0;a<e.length;++a){const r=e[a];if(!pt(r)){n(new Ie(Me.NODE_INVALID,r==null?void 0:r.id)||`[ID UNKNOWN|INDEX ${a}]`);continue}const l=jc(r,t(r.id),r.parentNode);r.parentNode&&(o[r.parentNode]=!0),i[a]=l}for(const a of i){const r=t(a.parentNode)||i.find(l=>l.id===a.parentNode);a.parentNode&&!r&&n(new Ie(Me.NODE_MISSING_PARENT,a.id,a.parentNode)),(a.parentNode||o[a.id])&&(o[a.id]&&(a.isParent=!0),r&&(r.isParent=!0))}return i}function Ni(e,t,n,o,i,a){let r=i;const l=o.get(r)||new Map;o.set(r,l.set(n,t)),r=`${i}-${e}`;const s=o.get(r)||new Map;if(o.set(r,s.set(n,t)),a){r=`${i}-${e}-${a}`;const u=o.get(r)||new Map;o.set(r,u.set(n,t))}}function qn(e,t,n){e.clear();for(const o of n){const{source:i,target:a,sourceHandle:r=null,targetHandle:l=null}=o,s={edgeId:o.id,source:i,target:a,sourceHandle:r,targetHandle:l},u=`${i}-${r}--${a}-${l}`,c=`${a}-${l}--${i}-${r}`;Ni("source",s,c,e,i,r),Ni("target",s,u,e,a,l)}}function ki(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function jn(e,t,n,o,i,a,r,l){const s=[];for(const u of e){const c=ut(u)?u:bd(u,l,i,a);if(!c)continue;const f=n(c.source),h=n(c.target);if(!f||!h){i(new Ie(Me.EDGE_SOURCE_TARGET_MISSING,c.id,c.source,c.target));continue}if(!f){i(new Ie(Me.EDGE_SOURCE_MISSING,c.id,c.source));continue}if(!h){i(new Ie(Me.EDGE_TARGET_MISSING,c.id,c.target));continue}if(t&&!t(c,{edges:l,nodes:r,sourceNode:f,targetNode:h})){i(new Ie(Me.EDGE_INVALID,c.id));continue}const g=o(c.id);s.push({...kr(c,g,a),sourceNode:f,targetNode:h})}return s}const $i=Symbol("vueFlow"),Hr=Symbol("nodeId"),Rr=Symbol("nodeRef"),Ed=Symbol("edgeId"),Sd=Symbol("edgeRef"),Bn=Symbol("slots");function Lr(e){const{vueFlowRef:t,snapToGrid:n,snapGrid:o,noDragClassName:i,nodeLookup:a,nodeExtent:r,nodeDragThreshold:l,viewport:s,autoPanOnNodeDrag:u,autoPanSpeed:c,nodesDraggable:f,panBy:h,findNode:g,multiSelectionActive:y,nodesSelectionActive:b,selectNodesOnDrag:N,removeSelectedElements:S,addSelectedNodes:$,updateNodePositions:_,emits:C}=ke(),{onStart:B,onDrag:G,onStop:X,onClick:Y,el:oe,disabled:K,id:A,selectable:k,dragHandle:ee}=e,x=at(!1);let I=[],E,M=null,T={x:void 0,y:void 0},V={x:0,y:0},H=null,U=!1,ie=!1,le=0,he=!1;const q=$d(),j=({x:ae,y:se})=>{T={x:ae,y:se};let m=!1;if(I=I.map(v=>{const d={x:ae-v.distance.x,y:se-v.distance.y},{computedPosition:p}=Oo(v,n.value?zn(d,o.value):d,C.error,r.value,v.parentNode?g(v.parentNode):void 0);return m=m||v.position.x!==p.x||v.position.y!==p.y,v.position=p,v}),ie=ie||m,!!m&&(_(I,!0,!0),x.value=!0,H)){const[v,d]=Zn({id:A,dragItems:I,findNode:g});G({event:H,node:v,nodes:d})}},L=()=>{if(!M)return;const[ae,se]=Tr(V,M,c.value);if(ae!==0||se!==0){const m={x:(T.x??0)-ae/s.value.zoom,y:(T.y??0)-se/s.value.zoom};h({x:ae,y:se})&&j(m)}le=requestAnimationFrame(L)},ce=(ae,se)=>{U=!0;const m=g(A);!N.value&&!y.value&&m&&(m.selected||S()),m&&pe(k)&&N.value&&ho(m,y.value,$,S,b,!1,se);const v=q(ae.sourceEvent);if(T=v,I=ad(a.value,f.value,v,A),I.length){const[d,p]=Zn({id:A,dragItems:I,findNode:g});B({event:ae.sourceEvent,node:d,nodes:p})}},_e=(ae,se)=>{var m;ae.sourceEvent.type==="touchmove"&&ae.sourceEvent.touches.length>1||(ie=!1,l.value===0&&ce(ae,se),T=q(ae.sourceEvent),M=((m=t.value)==null?void 0:m.getBoundingClientRect())||null,V=Ge(ae.sourceEvent,M))},de=(ae,se)=>{const m=q(ae.sourceEvent);if(!he&&U&&u.value&&(he=!0,L()),!U){const v=m.xSnapped-(T.x??0),d=m.ySnapped-(T.y??0);Math.sqrt(v*v+d*d)>l.value&&ce(ae,se)}(T.x!==m.xSnapped||T.y!==m.ySnapped)&&I.length&&U&&(H=ae.sourceEvent,V=Ge(ae.sourceEvent,M),j(m))},ye=ae=>{let se=!1;if(!U&&!x.value&&!y.value){const m=ae.sourceEvent,v=q(m),d=v.xSnapped-(T.x??0),p=v.ySnapped-(T.y??0),w=Math.sqrt(d*d+p*p);w!==0&&w<=l.value&&(Y==null||Y(m),se=!0)}if(I.length&&!se){ie&&(_(I,!1,!1),ie=!1);const[m,v]=Zn({id:A,dragItems:I,findNode:g});X({event:ae.sourceEvent,node:m,nodes:v})}I=[],x.value=!1,he=!1,U=!1,T={x:void 0,y:void 0},cancelAnimationFrame(le)};return Ee([()=>pe(K),oe],([ae,se],m,v)=>{if(se){const d=Be(se);ae||(E=qs().on("start",p=>_e(p,se)).on("drag",p=>de(p,se)).on("end",p=>ye(p)).filter(p=>{const w=p.target,P=pe(ee);return!p.button&&(!i.value||!wi(w,`.${i.value}`,se)&&(!P||wi(w,P,se)))}),d.call(E)),v(()=>{d.on(".drag",null),E&&(E.on("start",null),E.on("drag",null),E.on("end",null))})}}),x}function Nd(){return{doubleClick:W(),click:W(),mouseEnter:W(),mouseMove:W(),mouseLeave:W(),contextMenu:W(),updateStart:W(),update:W(),updateEnd:W()}}function kd(e,t){const n=Nd();return n.doubleClick.on(o=>{var i,a;t.edgeDoubleClick(o),(a=(i=e.events)==null?void 0:i.doubleClick)==null||a.call(i,o)}),n.click.on(o=>{var i,a;t.edgeClick(o),(a=(i=e.events)==null?void 0:i.click)==null||a.call(i,o)}),n.mouseEnter.on(o=>{var i,a;t.edgeMouseEnter(o),(a=(i=e.events)==null?void 0:i.mouseEnter)==null||a.call(i,o)}),n.mouseMove.on(o=>{var i,a;t.edgeMouseMove(o),(a=(i=e.events)==null?void 0:i.mouseMove)==null||a.call(i,o)}),n.mouseLeave.on(o=>{var i,a;t.edgeMouseLeave(o),(a=(i=e.events)==null?void 0:i.mouseLeave)==null||a.call(i,o)}),n.contextMenu.on(o=>{var i,a;t.edgeContextMenu(o),(a=(i=e.events)==null?void 0:i.contextMenu)==null||a.call(i,o)}),n.updateStart.on(o=>{var i,a;t.edgeUpdateStart(o),(a=(i=e.events)==null?void 0:i.updateStart)==null||a.call(i,o)}),n.update.on(o=>{var i,a;t.edgeUpdate(o),(a=(i=e.events)==null?void 0:i.update)==null||a.call(i,o)}),n.updateEnd.on(o=>{var i,a;t.edgeUpdateEnd(o),(a=(i=e.events)==null?void 0:i.updateEnd)==null||a.call(i,o)}),Object.entries(n).reduce((o,[i,a])=>(o.emit[i]=a.trigger,o.on[i]=a.on,o),{emit:{},on:{}})}function $d(){const{viewport:e,snapGrid:t,snapToGrid:n,vueFlowRef:o}=ke();return i=>{var a;const r=((a=o.value)==null?void 0:a.getBoundingClientRect())??{left:0,top:0},l=fd(i)?i.sourceEvent:i,{x:s,y:u}=Ge(l,r),c=Zt({x:s,y:u},e.value),{x:f,y:h}=n.value?zn(c,t.value):c;return{xSnapped:f,ySnapped:h,...c}}}function ln(){return!0}function Fr({handleId:e,nodeId:t,type:n,isValidConnection:o,edgeUpdaterType:i,onEdgeUpdate:a,onEdgeUpdateEnd:r}){const{id:l,vueFlowRef:s,connectionMode:u,connectionRadius:c,connectOnClick:f,connectionClickStartHandle:h,nodesConnectable:g,autoPanOnConnect:y,autoPanSpeed:b,findNode:N,panBy:S,startConnection:$,updateConnection:_,endConnection:C,emits:B,viewport:G,edges:X,nodes:Y,isValidConnection:oe,nodeLookup:K}=ke();let A=null,k=!1,ee=null;function x(E){var M;const T=pe(n)==="target",V=To(E),H=ci(E.target),U=E.currentTarget;if(U&&(V&&E.button===0||!V)){let ie=function(Q){m=Ge(Q,ye),j=md(Zt(m,G.value,!1,[1,1]),c.value,K.value,p),v||(d(),v=!0);const re=xi(Q,{handle:j,connectionMode:u.value,fromNodeId:pe(t),fromHandleId:pe(e),fromType:T?"target":"source",isValidConnection:q,doc:H,lib:"vue",flowId:l,nodeLookup:K.value},X.value,Y.value,N,K.value);ee=re.handleDomNode,A=re.connection,k=wd(!!j,re.isValid);const ge={...F,isValid:k,to:re.toHandle&&k?Ut({x:re.toHandle.x,y:re.toHandle.y},G.value):m,toHandle:re.toHandle,toPosition:k&&re.toHandle?re.toHandle.position:fo[p.position],toNode:re.toHandle?K.value.get(re.toHandle.nodeId):null};if(k&&j&&(F!=null&&F.toHandle)&&ge.toHandle&&F.toHandle.type===ge.toHandle.type&&F.toHandle.nodeId===ge.toHandle.nodeId&&F.toHandle.id===ge.toHandle.id&&F.to.x===ge.to.x&&F.to.y===ge.to.y)return;const be=j??re.toHandle;if(_(be&&k?Ut({x:be.x,y:be.y},G.value):m,be,yd(!!be,k)),F=ge,!j&&!k&&!ee)return Kn(se);A&&A.source!==A.target&&ee&&(Kn(se),se=ee,ee.classList.add("connecting","vue-flow__handle-connecting"),ee.classList.toggle("valid",!!k),ee.classList.toggle("vue-flow__handle-valid",!!k))},le=function(Q){"touches"in Q&&Q.touches.length>0||((j||ee)&&A&&k&&(a?a(Q,A):B.connect(A)),B.connectEnd(Q),i&&(r==null||r(Q)),Kn(se),cancelAnimationFrame(L),C(Q),v=!1,k=!1,A=null,ee=null,H.removeEventListener("mousemove",ie),H.removeEventListener("mouseup",le),H.removeEventListener("touchmove",ie),H.removeEventListener("touchend",le))};const he=N(pe(t));let q=pe(o)||oe.value||ln;!q&&he&&(q=(T?he.isValidSourcePos:he.isValidTargetPos)||ln);let j,L=0;const{x:ce,y:_e}=Ge(E),de=zr(pe(i),U),ye=(M=s.value)==null?void 0:M.getBoundingClientRect();if(!ye||!de)return;const ae=Br(pe(t),de,pe(e),K.value,u.value);if(!ae)return;let se,m=Ge(E,ye),v=!1;const d=()=>{if(!y.value)return;const[Q,re]=Tr(m,ye,b.value);S({x:Q,y:re}),L=requestAnimationFrame(d)},p={...ae,nodeId:pe(t),type:de,position:ae.position},w=K.value.get(pe(t)),R={inProgress:!0,isValid:null,from:Dt(w,p,Z.Left,!0),fromHandle:p,fromPosition:p.position,fromNode:w,to:m,toHandle:null,toPosition:fo[p.position],toNode:null};$({nodeId:pe(t),id:pe(e),type:de,position:(U==null?void 0:U.getAttribute("data-handlepos"))||Z.Top,...m},{x:ce-ye.left,y:_e-ye.top}),B.connectStart({event:E,nodeId:pe(t),handleId:pe(e),handleType:de});let F=R;H.addEventListener("mousemove",ie),H.addEventListener("mouseup",le),H.addEventListener("touchmove",ie),H.addEventListener("touchend",le)}}function I(E){var M,T;if(!f.value)return;const V=pe(n)==="target";if(!h.value){B.clickConnectStart({event:E,nodeId:pe(t),handleId:pe(e)}),$({nodeId:pe(t),type:pe(n),id:pe(e),position:Z.Top,...Ge(E)},void 0,!0);return}let H=pe(o)||oe.value||ln;const U=N(pe(t));if(!H&&U&&(H=(V?U.isValidSourcePos:U.isValidTargetPos)||ln),U&&(typeof U.connectable>"u"?g.value:U.connectable)===!1)return;const ie=ci(E.target),le=xi(E,{handle:{nodeId:pe(t),id:pe(e),type:pe(n),position:Z.Top,...Ge(E)},connectionMode:u.value,fromNodeId:h.value.nodeId,fromHandleId:h.value.id??null,fromType:h.value.type,isValidConnection:H,doc:ie,lib:"vue",flowId:l,nodeLookup:K.value},X.value,Y.value,N,K.value),he=((M=le.connection)==null?void 0:M.source)===((T=le.connection)==null?void 0:T.target);le.isValid&&le.connection&&!he&&B.connect(le.connection),B.clickConnectEnd(E),C(E,!0)}return{handlePointerDown:x,handleClick:I}}function Cd(){return It(Hr,"")}function Yr(e){const t=e??Cd()??"",n=It(Rr,me(null)),{findNode:o,edges:i,emits:a}=ke(),r=o(t);return r||a.error(new Ie(Me.NODE_NOT_FOUND,t)),{id:t,nodeEl:n,node:r,parentNode:te(()=>o(r.parentNode)),connectedEdges:te(()=>Pr([r],i.value))}}function Md(){return{doubleClick:W(),click:W(),mouseEnter:W(),mouseMove:W(),mouseLeave:W(),contextMenu:W(),dragStart:W(),drag:W(),dragStop:W()}}function Dd(e,t){const n=Md();return n.doubleClick.on(o=>{var i,a;t.nodeDoubleClick(o),(a=(i=e.events)==null?void 0:i.doubleClick)==null||a.call(i,o)}),n.click.on(o=>{var i,a;t.nodeClick(o),(a=(i=e.events)==null?void 0:i.click)==null||a.call(i,o)}),n.mouseEnter.on(o=>{var i,a;t.nodeMouseEnter(o),(a=(i=e.events)==null?void 0:i.mouseEnter)==null||a.call(i,o)}),n.mouseMove.on(o=>{var i,a;t.nodeMouseMove(o),(a=(i=e.events)==null?void 0:i.mouseMove)==null||a.call(i,o)}),n.mouseLeave.on(o=>{var i,a;t.nodeMouseLeave(o),(a=(i=e.events)==null?void 0:i.mouseLeave)==null||a.call(i,o)}),n.contextMenu.on(o=>{var i,a;t.nodeContextMenu(o),(a=(i=e.events)==null?void 0:i.contextMenu)==null||a.call(i,o)}),n.dragStart.on(o=>{var i,a;t.nodeDragStart(o),(a=(i=e.events)==null?void 0:i.dragStart)==null||a.call(i,o)}),n.drag.on(o=>{var i,a;t.nodeDrag(o),(a=(i=e.events)==null?void 0:i.drag)==null||a.call(i,o)}),n.dragStop.on(o=>{var i,a;t.nodeDragStop(o),(a=(i=e.events)==null?void 0:i.dragStop)==null||a.call(i,o)}),Object.entries(n).reduce((o,[i,a])=>(o.emit[i]=a.trigger,o.on[i]=a.on,o),{emit:{},on:{}})}function Gr(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:n,findNode:o,snapGrid:i,snapToGrid:a,nodesDraggable:r,emits:l}=ke();return(s,u=!1)=>{const c=a.value?i.value[0]:5,f=a.value?i.value[1]:5,h=u?4:1,g=s.x*c*h,y=s.y*f*h,b=[];for(const N of e.value)if(N.draggable||r&&typeof N.draggable>"u"){const S={x:N.computedPosition.x+g,y:N.computedPosition.y+y},{position:$}=Oo(N,S,l.error,t.value,N.parentNode?o(N.parentNode):void 0);b.push({id:N.id,position:$,from:N.position,distance:{x:s.x,y:s.y},dimensions:N.dimensions})}n(b,!0,!1)}}const sn=.1,Id=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function ot(){return Qt("Viewport not initialized yet."),Promise.resolve(!1)}const Pd={zoomIn:ot,zoomOut:ot,zoomTo:ot,fitView:ot,setCenter:ot,fitBounds:ot,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:ot,setTransform:ot,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function Od(e){function t(o,i){return new Promise(a=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((i==null?void 0:i.interpolate)==="linear"?Ht:hn).scaleBy(Jn(e.d3Selection,i==null?void 0:i.duration,i==null?void 0:i.ease,()=>{a(!0)}),o):a(!1)})}function n(o,i,a,r){return new Promise(l=>{var s;const{x:u,y:c}=Nr({x:-o,y:-i},e.translateExtent),f=Mt.translate(-u,-c).scale(a);e.d3Selection&&e.d3Zoom?(s=e.d3Zoom)==null||s.interpolate((r==null?void 0:r.interpolate)==="linear"?Ht:hn).transform(Jn(e.d3Selection,r==null?void 0:r.duration,r==null?void 0:r.ease,()=>{l(!0)}),f):l(!1)})}return te(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:i=>t(1.2,i),zoomOut:i=>t(1/1.2,i),zoomTo:(i,a)=>new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?Ht:hn).scaleTo(Jn(e.d3Selection,a==null?void 0:a.duration,a==null?void 0:a.ease,()=>{r(!0)}),i):r(!1)}),setViewport:(i,a)=>n(i.x,i.y,i.zoom,a),setTransform:(i,a)=>n(i.x,i.y,i.zoom,a),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:sn,includeHiddenNodes:!1,duration:0})=>{var a,r;const l=[];for(const h of e.nodes)h.dimensions.width&&h.dimensions.height&&((i==null?void 0:i.includeHiddenNodes)||!h.hidden)&&(!((a=i.nodes)!=null&&a.length)||(r=i.nodes)!=null&&r.length&&i.nodes.includes(h.id))&&l.push(h);if(!l.length)return Promise.resolve(!1);const s=Dr(l),{x:u,y:c,zoom:f}=di(s,e.dimensions.width,e.dimensions.height,i.minZoom??e.minZoom,i.maxZoom??e.maxZoom,i.padding??sn);return n(u,c,f,i)},setCenter:(i,a,r)=>{const l=typeof(r==null?void 0:r.zoom)<"u"?r.zoom:e.maxZoom,s=e.dimensions.width/2-i*l,u=e.dimensions.height/2-a*l;return n(s,u,l,r)},fitBounds:(i,a={padding:sn})=>{const{x:r,y:l,zoom:s}=di(i,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,a.padding??sn);return n(r,l,s,a)},project:i=>Zt(i,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:i=>{if(e.vueFlowRef){const{x:a,y:r}=e.vueFlowRef.getBoundingClientRect(),l={x:i.x-a,y:i.y-r};return Zt(l,e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:i=>{if(e.vueFlowRef){const{x:a,y:r}=e.vueFlowRef.getBoundingClientRect(),l={x:i.x+a,y:i.y+r};return Ut(l,e.viewport)}return{x:0,y:0}}}:Pd)}function Jn(e,t=0,n=Id,o=()=>{}){const i=typeof t=="number"&&t>0;return i||o(),i?e.transition().duration(t).ease(n).on("end",o):e}function Td(e,t,n){const o=Ti(!0);return o.run(()=>{const i=()=>{o.run(()=>{let b,N,S=!!(n.nodes.value.length||n.edges.value.length);b=bt([e.modelValue,()=>{var $,_;return(_=($=e.modelValue)==null?void 0:$.value)==null?void 0:_.length}],([$])=>{$&&Array.isArray($)&&(N==null||N.pause(),n.setElements($),!N&&!S&&$.length?S=!0:N==null||N.resume())}),N=bt([n.nodes,n.edges,()=>n.edges.value.length,()=>n.nodes.value.length],([$,_])=>{var C;(C=e.modelValue)!=null&&C.value&&Array.isArray(e.modelValue.value)&&(b==null||b.pause(),e.modelValue.value=[...$,..._],et(()=>{b==null||b.resume()}))},{immediate:S}),dn(()=>{b==null||b.stop(),N==null||N.stop()})})},a=()=>{o.run(()=>{let b,N,S=!!n.nodes.value.length;b=bt([e.nodes,()=>{var $,_;return(_=($=e.nodes)==null?void 0:$.value)==null?void 0:_.length}],([$])=>{$&&Array.isArray($)&&(N==null||N.pause(),n.setNodes($),!N&&!S&&$.length?S=!0:N==null||N.resume())}),N=bt([n.nodes,()=>n.nodes.value.length],([$])=>{var _;(_=e.nodes)!=null&&_.value&&Array.isArray(e.nodes.value)&&(b==null||b.pause(),e.nodes.value=[...$],et(()=>{b==null||b.resume()}))},{immediate:S}),dn(()=>{b==null||b.stop(),N==null||N.stop()})})},r=()=>{o.run(()=>{let b,N,S=!!n.edges.value.length;b=bt([e.edges,()=>{var $,_;return(_=($=e.edges)==null?void 0:$.value)==null?void 0:_.length}],([$])=>{$&&Array.isArray($)&&(N==null||N.pause(),n.setEdges($),!N&&!S&&$.length?S=!0:N==null||N.resume())}),N=bt([n.edges,()=>n.edges.value.length],([$])=>{var _;(_=e.edges)!=null&&_.value&&Array.isArray(e.edges.value)&&(b==null||b.pause(),e.edges.value=[...$],et(()=>{b==null||b.resume()}))},{immediate:S}),dn(()=>{b==null||b.stop(),N==null||N.stop()})})},l=()=>{o.run(()=>{Ee(()=>t.maxZoom,()=>{t.maxZoom&&Ce(t.maxZoom)&&n.setMaxZoom(t.maxZoom)},{immediate:!0})})},s=()=>{o.run(()=>{Ee(()=>t.minZoom,()=>{t.minZoom&&Ce(t.minZoom)&&n.setMinZoom(t.minZoom)},{immediate:!0})})},u=()=>{o.run(()=>{Ee(()=>t.translateExtent,()=>{t.translateExtent&&Ce(t.translateExtent)&&n.setTranslateExtent(t.translateExtent)},{immediate:!0})})},c=()=>{o.run(()=>{Ee(()=>t.nodeExtent,()=>{t.nodeExtent&&Ce(t.nodeExtent)&&n.setNodeExtent(t.nodeExtent)},{immediate:!0})})},f=()=>{o.run(()=>{Ee(()=>t.applyDefault,()=>{Ce(t.applyDefault)&&(n.applyDefault.value=t.applyDefault)},{immediate:!0})})},h=()=>{o.run(()=>{const b=async N=>{let S=N;typeof t.autoConnect=="function"&&(S=await t.autoConnect(N)),S!==!1&&n.addEdges([S])};Ee(()=>t.autoConnect,()=>{Ce(t.autoConnect)&&(n.autoConnect.value=t.autoConnect)},{immediate:!0}),Ee(n.autoConnect,(N,S,$)=>{N?n.onConnect(b):n.hooks.value.connect.off(b),$(()=>{n.hooks.value.connect.off(b)})},{immediate:!0})})},g=()=>{const b=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const N of Object.keys(t)){const S=N;if(!b.includes(S)){const $=Se(()=>t[S]),_=n[S];go(_)&&o.run(()=>{Ee($,C=>{Ce(C)&&(_.value=C)},{immediate:!0})})}}};(()=>{i(),a(),r(),s(),l(),u(),c(),f(),h(),g()})()}),()=>o.stop()}function Ad(){return{edgesChange:W(),nodesChange:W(),nodeDoubleClick:W(),nodeClick:W(),nodeMouseEnter:W(),nodeMouseMove:W(),nodeMouseLeave:W(),nodeContextMenu:W(),nodeDragStart:W(),nodeDrag:W(),nodeDragStop:W(),nodesInitialized:W(),miniMapNodeClick:W(),miniMapNodeDoubleClick:W(),miniMapNodeMouseEnter:W(),miniMapNodeMouseMove:W(),miniMapNodeMouseLeave:W(),connect:W(),connectStart:W(),connectEnd:W(),clickConnectStart:W(),clickConnectEnd:W(),paneReady:W(),init:W(),move:W(),moveStart:W(),moveEnd:W(),selectionDragStart:W(),selectionDrag:W(),selectionDragStop:W(),selectionContextMenu:W(),selectionStart:W(),selectionEnd:W(),viewportChangeStart:W(),viewportChange:W(),viewportChangeEnd:W(),paneScroll:W(),paneClick:W(),paneContextMenu:W(),paneMouseEnter:W(),paneMouseMove:W(),paneMouseLeave:W(),edgeContextMenu:W(),edgeMouseEnter:W(),edgeMouseMove:W(),edgeMouseLeave:W(),edgeDoubleClick:W(),edgeClick:W(),edgeUpdateStart:W(),edgeUpdate:W(),edgeUpdateEnd:W(),updateNodeInternals:W(),error:W(e=>Qt(e.message))}}function zd(e,t){const n=Pt();ra(()=>{for(const[i,a]of Object.entries(t.value)){const r=l=>{e(i,l)};a.setEmitter(r),Ft(a.removeEmitter),a.setHasEmitListeners(()=>o(i)),Ft(a.removeHasEmitListeners)}});function o(i){var a;const r=Bd(i);return!!((a=n==null?void 0:n.vnode.props)==null?void 0:a[r])}}function Bd(e){const[t,...n]=e.split(":");return`on${t.replace(/(?:^|-)(\w)/g,(i,a)=>a.toUpperCase())}${n.length?`:${n.join(":")}`:""}`}function Wr(){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:Po.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:Rt.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:ft.Bezier,style:{}},connectionMode:st.Loose,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectionPosition:{x:Number.NaN,y:Number.NaN},connectionRadius:20,connectOnClick:!0,connectionStatus:null,isValidConnection:null,snapGrid:[15,15],snapToGrid:!1,edgesUpdatable:!1,edgesFocusable:!0,nodesFocusable:!0,nodesConnectable:!0,nodesDraggable:!0,nodeDragThreshold:1,elementsSelectable:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,selectionKeyCode:"Shift",multiSelectionKeyCode:kn()?"Meta":"Control",zoomActivationKeyCode:kn()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:Ad(),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 Vd=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function Hd(e,t,n){const o=Od(e),i=m=>{const v=m??[];e.hooks.updateNodeInternals.trigger(v)},a=m=>Qc(m,e.nodes,e.edges),r=m=>Jc(m,e.nodes,e.edges),l=m=>Pr(m,e.edges),s=({id:m,type:v,nodeId:d})=>{var p;const w=m?`-${v}-${m}`:`-${v}`;return Array.from(((p=e.connectionLookup.get(`${d}${w}`))==null?void 0:p.values())??[])},u=m=>{if(m)return t.value.get(m)},c=m=>{if(m)return n.value.get(m)},f=(m,v,d)=>{var p,w;const P=[];for(const R of m){const F={id:R.id,type:"position",dragging:d,from:R.from};if(v&&(F.position=R.position,R.parentNode)){const Q=u(R.parentNode);F.position={x:F.position.x-(((p=Q==null?void 0:Q.computedPosition)==null?void 0:p.x)??0),y:F.position.y-(((w=Q==null?void 0:Q.computedPosition)==null?void 0:w.y)??0)}}P.push(F)}P!=null&&P.length&&e.hooks.nodesChange.trigger(P)},h=m=>{if(!e.vueFlowRef)return;const v=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!v)return;const d=window.getComputedStyle(v),{m22:p}=new window.DOMMatrixReadOnly(d.transform),w=[];for(const P of m){const R=P,F=u(R.id);if(F){const Q=An(R.nodeElement);if(!!(Q.width&&Q.height&&(F.dimensions.width!==Q.width||F.dimensions.height!==Q.height||R.forceUpdate))){const ge=R.nodeElement.getBoundingClientRect();F.dimensions=Q,F.handleBounds.source=Ei("source",R.nodeElement,ge,p,F.id),F.handleBounds.target=Ei("target",R.nodeElement,ge,p,F.id),w.push({id:F.id,type:"dimensions",dimensions:Q})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&o.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),w.length&&e.hooks.nodesChange.trigger(w)},g=(m,v)=>{const d=new Set,p=new Set;for(const R of m)pt(R)?d.add(R.id):ut(R)&&p.add(R.id);const w=rt(t.value,d,!0),P=rt(n.value,p);if(e.multiSelectionActive){for(const R of d)w.push(it(R,v));for(const R of p)P.push(it(R,v))}w.length&&e.hooks.nodesChange.trigger(w),P.length&&e.hooks.edgesChange.trigger(P)},y=m=>{if(e.multiSelectionActive){const v=m.map(d=>it(d.id,!0));e.hooks.nodesChange.trigger(v);return}e.hooks.nodesChange.trigger(rt(t.value,new Set(m.map(v=>v.id)),!0)),e.hooks.edgesChange.trigger(rt(n.value))},b=m=>{if(e.multiSelectionActive){const v=m.map(d=>it(d.id,!0));e.hooks.edgesChange.trigger(v);return}e.hooks.edgesChange.trigger(rt(n.value,new Set(m.map(v=>v.id)))),e.hooks.nodesChange.trigger(rt(t.value,new Set,!0))},N=m=>{g(m,!0)},S=m=>{const d=(m||e.nodes).map(p=>(p.selected=!1,it(p.id,!1)));e.hooks.nodesChange.trigger(d)},$=m=>{const d=(m||e.edges).map(p=>(p.selected=!1,it(p.id,!1)));e.hooks.edgesChange.trigger(d)},_=m=>{if(!m||!m.length)return g([],!1);const v=m.reduce((d,p)=>{const w=it(p.id,!1);return pt(p)?d.nodes.push(w):d.edges.push(w),d},{nodes:[],edges:[]});v.nodes.length&&e.hooks.nodesChange.trigger(v.nodes),v.edges.length&&e.hooks.edgesChange.trigger(v.edges)},C=m=>{var v;(v=e.d3Zoom)==null||v.scaleExtent([m,e.maxZoom]),e.minZoom=m},B=m=>{var v;(v=e.d3Zoom)==null||v.scaleExtent([e.minZoom,m]),e.maxZoom=m},G=m=>{var v;(v=e.d3Zoom)==null||v.translateExtent(m),e.translateExtent=m},X=m=>{e.nodeExtent=m,i()},Y=m=>{var v;(v=e.d3Zoom)==null||v.clickDistance(m)},oe=m=>{e.nodesDraggable=m,e.nodesConnectable=m,e.elementsSelectable=m},K=m=>{const v=m instanceof Function?m(e.nodes):m;!e.initialized&&!v.length||(e.nodes=Si(v,u,e.hooks.error.trigger))},A=m=>{const v=m instanceof Function?m(e.edges):m;if(!e.initialized&&!v.length)return;const d=jn(v,e.isValidConnection,u,c,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);qn(e.connectionLookup,n.value,d),e.edges=d},k=m=>{const v=m instanceof Function?m([...e.nodes,...e.edges]):m;!e.initialized&&!v.length||(K(v.filter(pt)),A(v.filter(ut)))},ee=m=>{let v=m instanceof Function?m(e.nodes):m;v=Array.isArray(v)?v:[v];const d=Si(v,u,e.hooks.error.trigger),p=[];for(const w of d)p.push(gi(w));p.length&&e.hooks.nodesChange.trigger(p)},x=m=>{let v=m instanceof Function?m(e.edges):m;v=Array.isArray(v)?v:[v];const d=jn(v,e.isValidConnection,u,c,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),p=[];for(const w of d)p.push(gi(w));p.length&&e.hooks.edgesChange.trigger(p)},I=(m,v=!0,d=!1)=>{const p=m instanceof Function?m(e.nodes):m,w=Array.isArray(p)?p:[p],P=[],R=[];function F(re){const ge=l(re);for(const be of ge)(!Ce(be.deletable)||be.deletable)&&R.push(mi(be.id,be.source,be.target,be.sourceHandle,be.targetHandle))}function Q(re){const ge=[];for(const be of e.nodes)be.parentNode===re&&ge.push(be);if(ge.length){for(const be of ge)P.push(pi(be.id));v&&F(ge);for(const be of ge)Q(be.id)}}for(const re of w){const ge=typeof re=="string"?u(re):re;ge&&(Ce(ge.deletable)&&!ge.deletable||(P.push(pi(ge.id)),v&&F([ge]),d&&Q(ge.id)))}R.length&&e.hooks.edgesChange.trigger(R),P.length&&e.hooks.nodesChange.trigger(P)},E=m=>{const v=m instanceof Function?m(e.edges):m,d=Array.isArray(v)?v:[v],p=[];for(const w of d){const P=typeof w=="string"?c(w):w;P&&(Ce(P.deletable)&&!P.deletable||p.push(mi(typeof w=="string"?w:w.id,P.source,P.target,P.sourceHandle,P.targetHandle)))}e.hooks.edgesChange.trigger(p)},M=(m,v,d=!0)=>{const p=c(m.id);if(!p)return!1;const w=e.edges.indexOf(p),P=xd(m,v,p,d,e.hooks.error.trigger);if(P){const[R]=jn([P],e.isValidConnection,u,c,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((F,Q)=>Q===w?R:F),qn(e.connectionLookup,n.value,[R]),R}return!1},T=(m,v,d={replace:!1})=>{const p=c(m);if(!p)return;const w=typeof v=="function"?v(p):v;p.data=d.replace?w:{...p.data,...w}},V=m=>vi(m,e.nodes),H=m=>{const v=vi(m,e.edges);return qn(e.connectionLookup,n.value,v),v},U=(m,v,d={replace:!1})=>{const p=u(m);if(!p)return;const w=typeof v=="function"?v(p):v;d.replace?e.nodes.splice(e.nodes.indexOf(p),1,w):Object.assign(p,w)},ie=(m,v,d={replace:!1})=>{const p=u(m);if(!p)return;const w=typeof v=="function"?v(p):v;p.data=d.replace?w:{...p.data,...w}},le=(m,v,d=!1)=>{d?e.connectionClickStartHandle=m:e.connectionStartHandle=m,e.connectionEndHandle=null,e.connectionStatus=null,v&&(e.connectionPosition=v)},he=(m,v=null,d=null)=>{e.connectionStartHandle&&(e.connectionPosition=m,e.connectionEndHandle=v,e.connectionStatus=d)},q=(m,v)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,v?e.connectionClickStartHandle=null:e.connectionStartHandle=null},j=m=>{const v=qc(m),d=v?null:Vt(m)?m:u(m.id);return!v&&!d?[null,null,v]:[v?m:Sn(d),d,v]},L=(m,v=!0,d=e.nodes)=>{const[p,w,P]=j(m);if(!p)return[];const R=[];for(const F of d||e.nodes){if(!P&&(F.id===w.id||!F.computedPosition))continue;const Q=Sn(F),re=Nn(Q,p);(v&&re>0||re>=Q.width*Q.height||re>=Number(p.width)*Number(p.height))&&R.push(F)}return R},ce=(m,v,d=!0)=>{const[p]=j(m);if(!p)return!1;const w=Nn(p,v);return d&&w>0||w>=Number(p.width)*Number(p.height)},_e=m=>{const{viewport:v,dimensions:d,d3Zoom:p,d3Selection:w,translateExtent:P}=e;if(!p||!w||!m.x&&!m.y)return!1;const R=Mt.translate(v.x+m.x,v.y+m.y).scale(v.zoom),F=[[0,0],[d.width,d.height]],Q=p.constrain()(R,F,P),re=e.viewport.x!==Q.x||e.viewport.y!==Q.y||e.viewport.zoom!==Q.k;return p.transform(w,Q),re},de=m=>{const v=m instanceof Function?m(e):m,d=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];Ce(v.defaultEdgeOptions)&&(e.defaultEdgeOptions=v.defaultEdgeOptions);const p=v.modelValue||v.nodes||v.edges?[]:void 0;p&&(v.modelValue&&p.push(...v.modelValue),v.nodes&&p.push(...v.nodes),v.edges&&p.push(...v.edges),k(p));const w=()=>{Ce(v.maxZoom)&&B(v.maxZoom),Ce(v.minZoom)&&C(v.minZoom),Ce(v.translateExtent)&&G(v.translateExtent)};for(const P of Object.keys(v)){const R=P,F=v[R];![...Vd,...d].includes(R)&&Ce(F)&&(e[R]=F)}eo(()=>e.d3Zoom).not.toBeNull().then(w),e.initialized||(e.initialized=!0)};return{updateNodePositions:f,updateNodeDimensions:h,setElements:k,setNodes:K,setEdges:A,addNodes:ee,addEdges:x,removeNodes:I,removeEdges:E,findNode:u,findEdge:c,updateEdge:M,updateEdgeData:T,updateNode:U,updateNodeData:ie,applyEdgeChanges:H,applyNodeChanges:V,addSelectedElements:N,addSelectedNodes:y,addSelectedEdges:b,setMinZoom:C,setMaxZoom:B,setTranslateExtent:G,setNodeExtent:X,setPaneClickDistance:Y,removeSelectedElements:_,removeSelectedNodes:S,removeSelectedEdges:$,startConnection:le,updateConnection:he,endConnection:q,setInteractive:oe,setState:de,getIntersectingNodes:L,getIncomers:a,getOutgoers:r,getConnectedEdges:l,getHandleConnections:s,isNodeIntersecting:ce,panBy:_e,fitView:m=>o.value.fitView(m),zoomIn:m=>o.value.zoomIn(m),zoomOut:m=>o.value.zoomOut(m),zoomTo:(m,v)=>o.value.zoomTo(m,v),setViewport:(m,v)=>o.value.setViewport(m,v),setTransform:(m,v)=>o.value.setTransform(m,v),getViewport:()=>o.value.getViewport(),getTransform:()=>o.value.getTransform(),setCenter:(m,v,d)=>o.value.setCenter(m,v,d),fitBounds:(m,v)=>o.value.fitBounds(m,v),project:m=>o.value.project(m),screenToFlowCoordinate:m=>o.value.screenToFlowCoordinate(m),flowToScreenCoordinate:m=>o.value.flowToScreenCoordinate(m),toObject:()=>{const m=[],v=[];for(const d of e.nodes){const{computedPosition:p,handleBounds:w,selected:P,dimensions:R,isParent:F,resizing:Q,dragging:re,events:ge,...be}=d;m.push(be)}for(const d of e.edges){const{selected:p,sourceNode:w,targetNode:P,events:R,...F}=d;v.push(F)}return JSON.parse(JSON.stringify({nodes:m,edges:v,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:m=>new Promise(v=>{const{nodes:d,edges:p,position:w,zoom:P,viewport:R}=m;d&&K(d),p&&A(p);const[F,Q]=R!=null&&R.x&&(R!=null&&R.y)?[R.x,R.y]:w??[null,null];if(F&&Q){const re=(R==null?void 0:R.zoom)||P||e.viewport.zoom;return eo(()=>o.value.viewportInitialized).toBe(!0).then(()=>{o.value.setViewport({x:F,y:Q,zoom:re}).then(()=>{v(!0)})})}else v(!0)}),updateNodeInternals:i,viewportHelper:o,$reset:()=>{const m=Wr();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const v=Mt.translate(m.defaultViewport.x??0,m.defaultViewport.y??0).scale(wt(m.defaultViewport.zoom??1,m.minZoom,m.maxZoom)),d=e.viewportRef.getBoundingClientRect(),p=[[0,0],[d.width,d.height]],w=e.d3Zoom.constrain()(v,p,m.translateExtent);e.d3Zoom.transform(e.d3Selection,w)}de(m)},$destroy:()=>{}}}const Rd=["data-id","data-handleid","data-nodeid","data-handlepos"],Ld={name:"Handle",compatConfig:{MODE:3}},Te=we({...Ld,props:{id:{default:null},type:{},position:{default:()=>Z.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(e,{expose:t}){const n=oa(e,["position","connectable","connectableStart","connectableEnd","id"]),o=Se(()=>n.type??"source"),i=Se(()=>n.isValidConnection??null),{id:a,connectionStartHandle:r,connectionClickStartHandle:l,connectionEndHandle:s,vueFlowRef:u,nodesConnectable:c,noDragClassName:f,noPanClassName:h}=ke(),{id:g,node:y,nodeEl:b,connectedEdges:N}=Yr(),S=me(),$=Se(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),_=Se(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),C=Se(()=>{var A,k,ee,x,I,E;return((A=r.value)==null?void 0:A.nodeId)===g&&((k=r.value)==null?void 0:k.id)===e.id&&((ee=r.value)==null?void 0:ee.type)===o.value||((x=s.value)==null?void 0:x.nodeId)===g&&((I=s.value)==null?void 0:I.id)===e.id&&((E=s.value)==null?void 0:E.type)===o.value}),B=Se(()=>{var A,k,ee;return((A=l.value)==null?void 0:A.nodeId)===g&&((k=l.value)==null?void 0:k.id)===e.id&&((ee=l.value)==null?void 0:ee.type)===o.value}),{handlePointerDown:G,handleClick:X}=Fr({nodeId:g,handleId:e.id,isValidConnection:i,type:o}),Y=te(()=>typeof e.connectable=="string"&&e.connectable==="single"?!N.value.some(A=>{const k=A[`${o.value}Handle`];return A[o.value]!==g?!1:k?k===e.id:!0}):typeof e.connectable=="number"?N.value.filter(A=>{const k=A[`${o.value}Handle`];return A[o.value]!==g?!1:k?k===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(y,N.value):Ce(e.connectable)?e.connectable:c.value);Ue(()=>{var A;if(!y.dimensions.width||!y.dimensions.height)return;const k=(A=y.handleBounds[o.value])==null?void 0:A.find(V=>V.id===e.id);if(!u.value||k)return;const ee=u.value.querySelector(".vue-flow__transformationpane");if(!b.value||!S.value||!ee||!e.id)return;const x=b.value.getBoundingClientRect(),I=S.value.getBoundingClientRect(),E=window.getComputedStyle(ee),{m22:M}=new window.DOMMatrixReadOnly(E.transform),T={id:e.id,position:e.position,x:(I.left-x.left)/M,y:(I.top-x.top)/M,type:o.value,nodeId:g,...An(S.value)};y.handleBounds[o.value]=[...y.handleBounds[o.value]??[],T]});function oe(A){const k=To(A);Y.value&&$.value&&(k&&A.button===0||!k)&&G(A)}function K(A){!g||!l.value&&!$.value||Y.value&&X(A)}return t({handleClick:X,handlePointerDown:G,onClick:K,onPointerDown:oe}),(A,k)=>(O(),J("div",{ref_key:"handle",ref:S,"data-id":`${D(a)}-${D(g)}-${e.id}-${o.value}`,"data-handleid":e.id,"data-nodeid":D(g),"data-handlepos":A.position,class:Xe(["vue-flow__handle",[`vue-flow__handle-${A.position}`,`vue-flow__handle-${e.id}`,D(f),D(h),o.value,{connectable:Y.value,connecting:B.value,connectablestart:$.value,connectableend:_.value,connectionindicator:Y.value&&($.value&&!C.value||_.value&&C.value)}]]),onMousedown:oe,onTouchstartPassive:oe,onClick:K},[$e(A.$slots,"default",{id:A.id})],42,Rd))}}),Vn=function({sourcePosition:e=Z.Bottom,targetPosition:t=Z.Top,label:n,connectable:o=!0,isValidTargetPos:i,isValidSourcePos:a,data:r}){const l=r.label??n;return[xe(Te,{type:"target",position:t,connectable:o,isValidConnection:i}),typeof l!="string"&&l?xe(l):xe(De,[l]),xe(Te,{type:"source",position:e,connectable:o,isValidConnection:a})]};Vn.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"];Vn.inheritAttrs=!1;Vn.compatConfig={MODE:3};const Fd=Vn,Hn=function({targetPosition:e=Z.Top,label:t,connectable:n=!0,isValidTargetPos:o,data:i}){const a=i.label??t;return[xe(Te,{type:"target",position:e,connectable:n,isValidConnection:o}),typeof a!="string"&&a?xe(a):xe(De,[a])]};Hn.props=["targetPosition","label","isValidTargetPos","connectable","data"];Hn.inheritAttrs=!1;Hn.compatConfig={MODE:3};const Yd=Hn,Rn=function({sourcePosition:e=Z.Bottom,label:t,connectable:n=!0,isValidSourcePos:o,data:i}){const a=i.label??t;return[typeof a!="string"&&a?xe(a):xe(De,[a]),xe(Te,{type:"source",position:e,connectable:n,isValidConnection:o})]};Rn.props=["sourcePosition","label","isValidSourcePos","connectable","data"];Rn.inheritAttrs=!1;Rn.compatConfig={MODE:3};const Gd=Rn,Wd=["transform"],Xd=["width","height","x","y","rx","ry"],Ud=["y"],Zd={name:"EdgeText",compatConfig:{MODE:3}},Kd=we({...Zd,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const t=me({x:0,y:0,width:0,height:0}),n=me(null),o=te(()=>`translate(${e.x-t.value.width/2} ${e.y-t.value.height/2})`);Ue(i),Ee([()=>e.x,()=>e.y,n,()=>e.label],i);function i(){if(!n.value)return;const a=n.value.getBBox();(a.width!==t.value.width||a.height!==t.value.height)&&(t.value=a)}return(a,r)=>(O(),J("g",{transform:o.value,class:"vue-flow__edge-textwrapper"},[a.labelShowBg?(O(),J("rect",{key:0,class:"vue-flow__edge-textbg",width:`${t.value.width+2*a.labelBgPadding[0]}px`,height:`${t.value.height+2*a.labelBgPadding[1]}px`,x:-a.labelBgPadding[0],y:-a.labelBgPadding[1],style:He(a.labelBgStyle),rx:a.labelBgBorderRadius,ry:a.labelBgBorderRadius},null,12,Xd)):fe("",!0),ne("text",Vi(a.$attrs,{ref_key:"el",ref:n,class:"vue-flow__edge-text",y:t.value.height/2,dy:"0.3em",style:a.labelStyle}),[$e(a.$slots,"default",{},()=>[typeof a.label!="string"?(O(),ve(dt(a.label),{key:0})):(O(),J(De,{key:1},[Oe(Ne(a.label),1)],64))])],16,Ud)],8,Wd))}}),qd=["id","d","marker-end","marker-start"],jd=["d","stroke-width"],Jd={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},Ln=we({...Jd,props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:t}){const n=me(null),o=me(null),i=me(null),a=da();return t({pathEl:n,interactionEl:o,labelEl:i}),(r,l)=>(O(),J(De,null,[ne("path",Vi(D(a),{id:r.id,ref_key:"pathEl",ref:n,d:r.path,class:"vue-flow__edge-path","marker-end":r.markerEnd,"marker-start":r.markerStart}),null,16,qd),r.interactionWidth?(O(),J("path",{key:0,ref_key:"interactionEl",ref:o,fill:"none",d:r.path,"stroke-width":r.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,jd)):fe("",!0),r.label&&r.labelX&&r.labelY?(O(),ve(Kd,{key:1,ref_key:"labelEl",ref:i,x:r.labelX,y:r.labelY,label:r.label,"label-show-bg":r.labelShowBg,"label-bg-style":r.labelBgStyle,"label-bg-padding":r.labelBgPadding,"label-bg-border-radius":r.labelBgBorderRadius,"label-style":r.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):fe("",!0)],64))}});function Xr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const i=Math.abs(n-e)/2,a=n<e?n+i:n-i,r=Math.abs(o-t)/2,l=o<t?o+r:o-r;return[a,l,i,r]}function Ur({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:i,sourceControlY:a,targetControlX:r,targetControlY:l}){const s=e*.125+i*.375+r*.375+n*.125,u=t*.125+a*.375+l*.375+o*.125,c=Math.abs(s-e),f=Math.abs(u-t);return[s,u,c,f]}function un(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Ci({pos:e,x1:t,y1:n,x2:o,y2:i,c:a}){let r,l;switch(e){case Z.Left:r=t-un(t-o,a),l=n;break;case Z.Right:r=t+un(o-t,a),l=n;break;case Z.Top:r=t,l=n-un(n-i,a);break;case Z.Bottom:r=t,l=n+un(i-n,a);break}return[r,l]}function Zr(e){const{sourceX:t,sourceY:n,sourcePosition:o=Z.Bottom,targetX:i,targetY:a,targetPosition:r=Z.Top,curvature:l=.25}=e,[s,u]=Ci({pos:o,x1:t,y1:n,x2:i,y2:a,c:l}),[c,f]=Ci({pos:r,x1:i,y1:a,x2:t,y2:n,c:l}),[h,g,y,b]=Ur({sourceX:t,sourceY:n,targetX:i,targetY:a,sourceControlX:s,sourceControlY:u,targetControlX:c,targetControlY:f});return[`M${t},${n} C${s},${u} ${c},${f} ${i},${a}`,h,g,y,b]}function Mi({pos:e,x1:t,y1:n,x2:o,y2:i}){let a,r;switch(e){case Z.Left:case Z.Right:a=.5*(t+o),r=n;break;case Z.Top:case Z.Bottom:a=t,r=.5*(n+i);break}return[a,r]}function Kr(e){const{sourceX:t,sourceY:n,sourcePosition:o=Z.Bottom,targetX:i,targetY:a,targetPosition:r=Z.Top}=e,[l,s]=Mi({pos:o,x1:t,y1:n,x2:i,y2:a}),[u,c]=Mi({pos:r,x1:i,y1:a,x2:t,y2:n}),[f,h,g,y]=Ur({sourceX:t,sourceY:n,targetX:i,targetY:a,sourceControlX:l,sourceControlY:s,targetControlX:u,targetControlY:c});return[`M${t},${n} C${l},${s} ${u},${c} ${i},${a}`,f,h,g,y]}const Di={[Z.Left]:{x:-1,y:0},[Z.Right]:{x:1,y:0},[Z.Top]:{x:0,y:-1},[Z.Bottom]:{x:0,y:1}};function Qd({source:e,sourcePosition:t=Z.Bottom,target:n}){return t===Z.Left||t===Z.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1}}function Ii(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function ef({source:e,sourcePosition:t=Z.Bottom,target:n,targetPosition:o=Z.Top,center:i,offset:a}){const r=Di[t],l=Di[o],s={x:e.x+r.x*a,y:e.y+r.y*a},u={x:n.x+l.x*a,y:n.y+l.y*a},c=Qd({source:s,sourcePosition:t,target:u}),f=c.x!==0?"x":"y",h=c[f];let g,y,b;const N={x:0,y:0},S={x:0,y:0},[$,_,C,B]=Xr({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(r[f]*l[f]===-1){y=i.x??$,b=i.y??_;const X=[{x:y,y:s.y},{x:y,y:u.y}],Y=[{x:s.x,y:b},{x:u.x,y:b}];r[f]===h?g=f==="x"?X:Y:g=f==="x"?Y:X}else{const X=[{x:s.x,y:u.y}],Y=[{x:u.x,y:s.y}];if(f==="x"?g=r.x===h?Y:X:g=r.y===h?X:Y,t===o){const ee=Math.abs(e[f]-n[f]);if(ee<=a){const x=Math.min(a-1,a-ee);r[f]===h?N[f]=(s[f]>e[f]?-1:1)*x:S[f]=(u[f]>n[f]?-1:1)*x}}if(t!==o){const ee=f==="x"?"y":"x",x=r[f]===l[ee],I=s[ee]>u[ee],E=s[ee]<u[ee];(r[f]===1&&(!x&&I||x&&E)||r[f]!==1&&(!x&&E||x&&I))&&(g=f==="x"?X:Y)}const oe={x:s.x+N.x,y:s.y+N.y},K={x:u.x+S.x,y:u.y+S.y},A=Math.max(Math.abs(oe.x-g[0].x),Math.abs(K.x-g[0].x)),k=Math.max(Math.abs(oe.y-g[0].y),Math.abs(K.y-g[0].y));A>=k?(y=(oe.x+K.x)/2,b=g[0].y):(y=g[0].x,b=(oe.y+K.y)/2)}return[[e,{x:s.x+N.x,y:s.y+N.y},...g,{x:u.x+S.x,y:u.y+S.y},n],y,b,C,B]}function tf(e,t,n,o){const i=Math.min(Ii(e,t)/2,Ii(t,n)/2,o),{x:a,y:r}=t;if(e.x===a&&a===n.x||e.y===r&&r===n.y)return`L${a} ${r}`;if(e.y===r){const u=e.x<n.x?-1:1,c=e.y<n.y?1:-1;return`L ${a+i*u},${r}Q ${a},${r} ${a},${r+i*c}`}const l=e.x<n.x?1:-1,s=e.y<n.y?-1:1;return`L ${a},${r+i*s}Q ${a},${r} ${a+i*l},${r}`}function vo(e){const{sourceX:t,sourceY:n,sourcePosition:o=Z.Bottom,targetX:i,targetY:a,targetPosition:r=Z.Top,borderRadius:l=5,centerX:s,centerY:u,offset:c=20}=e,[f,h,g,y,b]=ef({source:{x:t,y:n},sourcePosition:o,target:{x:i,y:a},targetPosition:r,center:{x:s,y:u},offset:c});return[f.reduce((S,$,_)=>{let C;return _>0&&_<f.length-1?C=tf(f[_-1],$,f[_+1],l):C=`${_===0?"M":"L"}${$.x} ${$.y}`,S+=C,S},""),h,g,y,b]}function nf(e){const{sourceX:t,sourceY:n,targetX:o,targetY:i}=e,[a,r,l,s]=Xr({sourceX:t,sourceY:n,targetX:o,targetY:i});return[`M ${t},${n}L ${o},${i}`,a,r,l,s]}const of=we({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=nf(e);return xe(Ln,{path:n,labelX:o,labelY:i,...t,...e})}}}),rf=of,af=we({name:"SmoothStepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","borderRadius","markerEnd","markerStart","interactionWidth","offset"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=vo({...e,sourcePosition:e.sourcePosition??Z.Bottom,targetPosition:e.targetPosition??Z.Top});return xe(Ln,{path:n,labelX:o,labelY:i,...t,...e})}}}),qr=af,lf=we({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:t}){return()=>xe(qr,{...e,...t,borderRadius:0})}}),sf=lf,uf=we({name:"BezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=Zr({...e,sourcePosition:e.sourcePosition??Z.Bottom,targetPosition:e.targetPosition??Z.Top});return xe(Ln,{path:n,labelX:o,labelY:i,...t,...e})}}}),cf=uf,df=we({name:"SimpleBezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=Kr({...e,sourcePosition:e.sourcePosition??Z.Bottom,targetPosition:e.targetPosition??Z.Top});return xe(Ln,{path:n,labelX:o,labelY:i,...t,...e})}}}),ff=df,hf={input:Gd,default:Fd,output:Yd},vf={default:cf,straight:rf,step:sf,smoothstep:qr,simplebezier:ff};function gf(e,t,n){const o=te(()=>b=>t.value.get(b)),i=te(()=>b=>n.value.get(b)),a=te(()=>{const b={...vf,...e.edgeTypes},N=Object.keys(b);for(const S of e.edges)S.type&&!N.includes(S.type)&&(b[S.type]=S.type);return b}),r=te(()=>{const b={...hf,...e.nodeTypes},N=Object.keys(b);for(const S of e.nodes)S.type&&!N.includes(S.type)&&(b[S.type]=S.type);return b}),l=te(()=>e.onlyRenderVisibleElements?Ir(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),s=te(()=>{if(e.onlyRenderVisibleElements){const b=[];for(const N of e.edges){const S=t.value.get(N.source),$=t.value.get(N.target);cd({sourcePos:S.computedPosition||{x:0,y:0},targetPos:$.computedPosition||{x:0,y:0},sourceWidth:S.dimensions.width,sourceHeight:S.dimensions.height,targetWidth:$.dimensions.width,targetHeight:$.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&b.push(N)}return b}return e.edges}),u=te(()=>[...l.value,...s.value]),c=te(()=>{const b=[];for(const N of e.nodes)N.selected&&b.push(N);return b}),f=te(()=>{const b=[];for(const N of e.edges)N.selected&&b.push(N);return b}),h=te(()=>[...c.value,...f.value]),g=te(()=>{const b=[];for(const N of e.nodes)N.dimensions.width&&N.dimensions.height&&N.handleBounds!==void 0&&b.push(N);return b}),y=te(()=>l.value.length>0&&g.value.length===l.value.length);return{getNode:o,getEdge:i,getElements:u,getEdgeTypes:a,getNodeTypes:r,getEdges:s,getNodes:l,getSelectedElements:h,getSelectedNodes:c,getSelectedEdges:f,getNodesInitialized:g,areNodesInitialized:y}}class ht{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var t;const n=(t=Pt())==null?void 0:t.appContext.app,o=(n==null?void 0:n.config.globalProperties.$vueFlowStorage)??ht.instance;return ht.instance=o??new ht,n&&(n.config.globalProperties.$vueFlowStorage=ht.instance),ht.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=Wr(),i=la(o),a={};for(const[h,g]of Object.entries(i.hooks)){const y=`on${h.charAt(0).toUpperCase()+h.slice(1)}`;a[y]=g.on}const r={};for(const[h,g]of Object.entries(i.hooks))r[h]=g.trigger;const l=te(()=>{const h=new Map;for(const g of i.nodes)h.set(g.id,g);return h}),s=te(()=>{const h=new Map;for(const g of i.edges)h.set(g.id,g);return h}),u=gf(i,l,s),c=Hd(i,l,s);c.setState({...i,...n});const f={...a,...u,...c,...rl(i),nodeLookup:l,edgeLookup:s,emits:r,id:t,vueFlowVersion:"1.48.2",$destroy:()=>{this.remove(t)}};return this.set(t,f),f}getId(){return`vue-flow-${this.currentId++}`}}function ke(e){const t=ht.getInstance(),n=zi(),o=typeof e=="object",i=o?e:{id:e},a=i.id,r=a??(n==null?void 0:n.vueFlowId);let l;if(n){const s=It($i,null);typeof s<"u"&&s!==null&&(!r||s.id===r)&&(l=s)}if(l||r&&(l=t.get(r)),!l||r&&l.id!==r){const s=a??t.getId(),u=t.create(s,i);l=u,(n??Ti(!0)).run(()=>{Ee(u.applyDefault,(f,h,g)=>{const y=N=>{u.applyNodeChanges(N)},b=N=>{u.applyEdgeChanges(N)};f?(u.onNodesChange(y),u.onEdgesChange(b)):(u.hooks.value.nodesChange.off(y),u.hooks.value.edgesChange.off(b)),g(()=>{u.hooks.value.nodesChange.off(y),u.hooks.value.edgesChange.off(b)})},{immediate:!0}),Ft(()=>{if(l){const f=t.get(l.id);f?f.$destroy():Qt(`No store instance found for id ${l.id} in storage.`)}})})}else o&&l.setState(i);if(n&&(kt($i,l),n.vueFlowId=l.id),o){const s=Pt();(s==null?void 0:s.type.name)!=="VueFlow"&&l.emits.error(new Ie(Me.USEVUEFLOW_OPTIONS))}return l}function pf(e){const{emits:t,dimensions:n}=ke();let o;Ue(()=>{const i=()=>{var a,r;if(!e.value||!(((r=(a=e.value).checkVisibility)==null?void 0:r.call(a))??!0))return;const l=An(e.value);(l.width===0||l.height===0)&&t.error(new Ie(Me.MISSING_VIEWPORT_DIMENSIONS)),n.value={width:l.width||500,height:l.height||500}};i(),window.addEventListener("resize",i),e.value&&(o=new ResizeObserver(()=>i()),o.observe(e.value)),Ai(()=>{window.removeEventListener("resize",i),o&&e.value&&o.unobserve(e.value)})})}const mf={name:"UserSelection",compatConfig:{MODE:3}},yf=we({...mf,props:{userSelectionRect:{}},setup(e){return(t,n)=>(O(),J("div",{class:"vue-flow__selection vue-flow__container",style:He({width:`${t.userSelectionRect.width}px`,height:`${t.userSelectionRect.height}px`,transform:`translate(${t.userSelectionRect.x}px, ${t.userSelectionRect.y}px)`})},null,4))}}),wf=["tabIndex"],_f={name:"NodesSelection",compatConfig:{MODE:3}},bf=we({..._f,setup(e){const{emits:t,viewport:n,getSelectedNodes:o,noPanClassName:i,disableKeyboardA11y:a,userSelectionActive:r}=ke(),l=Gr(),s=me(null),u=Lr({el:s,onStart(y){t.selectionDragStart(y),t.nodeDragStart(y)},onDrag(y){t.selectionDrag(y),t.nodeDrag(y)},onStop(y){t.selectionDragStop(y),t.nodeDragStop(y)}});Ue(()=>{var y;a.value||(y=s.value)==null||y.focus({preventScroll:!0})});const c=te(()=>Dr(o.value)),f=te(()=>({width:`${c.value.width}px`,height:`${c.value.height}px`,top:`${c.value.y}px`,left:`${c.value.x}px`}));function h(y){t.selectionContextMenu({event:y,nodes:o.value})}function g(y){a.value||Nt[y.key]&&(y.preventDefault(),l({x:Nt[y.key].x,y:Nt[y.key].y},y.shiftKey))}return(y,b)=>!D(r)&&c.value.width&&c.value.height?(O(),J("div",{key:0,class:Xe(["vue-flow__nodesselection vue-flow__container",D(i)]),style:He({transform:`translate(${D(n).x}px,${D(n).y}px) scale(${D(n).zoom})`})},[ne("div",{ref_key:"el",ref:s,class:Xe([{dragging:D(u)},"vue-flow__nodesselection-rect"]),style:He(f.value),tabIndex:D(a)?void 0:-1,onContextmenu:h,onKeydown:g},null,46,wf)],6)):fe("",!0)}});function xf(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const Ef={name:"Pane",compatConfig:{MODE:3}},Sf=we({...Ef,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:t,nodes:n,viewport:o,emits:i,userSelectionActive:a,removeSelectedElements:r,userSelectionRect:l,elementsSelectable:s,nodesSelectionActive:u,getSelectedEdges:c,getSelectedNodes:f,removeNodes:h,removeEdges:g,selectionMode:y,deleteKeyCode:b,multiSelectionKeyCode:N,multiSelectionActive:S,edgeLookup:$,nodeLookup:_,connectionLookup:C,defaultEdgeOptions:B,connectionStartHandle:G,panOnDrag:X}=ke(),Y=at(null),oe=at(new Set),K=at(new Set),A=at(null),k=Se(()=>s.value&&(e.isSelecting||a.value)),ee=Se(()=>G.value!==null);let x=!1,I=!1;const E=Lt(b,{actInsideInputWithModifier:!1}),M=Lt(N);Ee(E,q=>{q&&(h(f.value),g(c.value),u.value=!1)}),Ee(M,q=>{S.value=q});function T(q,j){return L=>{L.target===j&&(q==null||q(L))}}function V(q){if(x||ee.value){x=!1;return}i.paneClick(q),r(),u.value=!1}function H(q){var j;if(Array.isArray(X.value)&&((j=X.value)!=null&&j.includes(2))){q.preventDefault();return}i.paneContextMenu(q)}function U(q){i.paneScroll(q)}function ie(q){var j,L,ce;if(A.value=((j=t.value)==null?void 0:j.getBoundingClientRect())??null,!s.value||!e.isSelecting||q.button!==0||q.target!==Y.value||!A.value)return;(ce=(L=q.target)==null?void 0:L.setPointerCapture)==null||ce.call(L,q.pointerId);const{x:_e,y:de}=xf(q,A.value);I=!0,x=!1,r(),l.value={width:0,height:0,startX:_e,startY:de,x:_e,y:de},i.selectionStart(q)}function le(q){var j;if(!A.value||!l.value)return;x=!0;const{x:L,y:ce}=Ge(q,A.value),{startX:_e=0,startY:de=0}=l.value,ye={startX:_e,startY:de,x:L<_e?L:_e,y:ce<de?ce:de,width:Math.abs(L-_e),height:Math.abs(ce-de)},ae=oe.value,se=K.value;oe.value=new Set(Ir(n.value,ye,o.value,y.value===Po.Partial,!0).map(v=>v.id)),K.value=new Set;const m=((j=B.value)==null?void 0:j.selectable)??!0;for(const v of oe.value){const d=C.value.get(v);if(d)for(const{edgeId:p}of d.values()){const w=$.value.get(p);w&&(w.selectable??m)&&K.value.add(p)}}if(!ki(ae,oe.value)){const v=rt(_.value,oe.value,!0);i.nodesChange(v)}if(!ki(se,K.value)){const v=rt($.value,K.value);i.edgesChange(v)}l.value=ye,a.value=!0,u.value=!1}function he(q){var j;q.button!==0||!I||((j=q.target)==null||j.releasePointerCapture(q.pointerId),!a.value&&l.value&&q.target===Y.value&&V(q),a.value=!1,l.value=null,u.value=oe.value.size>0,i.selectionEnd(q),e.selectionKeyPressed&&(x=!1),I=!1)}return(q,j)=>(O(),J("div",{ref_key:"container",ref:Y,class:Xe(["vue-flow__pane vue-flow__container",{selection:q.isSelecting}]),onClick:j[0]||(j[0]=L=>k.value?void 0:T(V,Y.value)(L)),onContextmenu:j[1]||(j[1]=L=>T(H,Y.value)(L)),onWheelPassive:j[2]||(j[2]=L=>T(U,Y.value)(L)),onPointerenter:j[3]||(j[3]=L=>k.value?void 0:D(i).paneMouseEnter(L)),onPointerdown:j[4]||(j[4]=L=>k.value?ie(L):D(i).paneMouseMove(L)),onPointermove:j[5]||(j[5]=L=>k.value?le(L):D(i).paneMouseMove(L)),onPointerup:j[6]||(j[6]=L=>k.value?he(L):void 0),onPointerleave:j[7]||(j[7]=L=>D(i).paneMouseLeave(L))},[$e(q.$slots,"default"),D(a)&&D(l)?(O(),ve(yf,{key:0,"user-selection-rect":D(l)},null,8,["user-selection-rect"])):fe("",!0),D(u)&&D(f).length?(O(),ve(bf,{key:1})):fe("",!0)],34))}}),Nf={name:"Transform",compatConfig:{MODE:3}},kf=we({...Nf,setup(e){const{viewport:t,fitViewOnInit:n,fitViewOnInitDone:o}=ke(),i=te(()=>n.value?!o.value:!1),a=te(()=>`translate(${t.value.x}px,${t.value.y}px) scale(${t.value.zoom})`);return(r,l)=>(O(),J("div",{class:"vue-flow__transformationpane vue-flow__container",style:He({transform:a.value,opacity:i.value?0:void 0})},[$e(r.$slots,"default")],4))}}),$f={name:"Viewport",compatConfig:{MODE:3}},Cf=we({...$f,setup(e){const{minZoom:t,maxZoom:n,defaultViewport:o,translateExtent:i,zoomActivationKeyCode:a,selectionKeyCode:r,panActivationKeyCode:l,panOnScroll:s,panOnScrollMode:u,panOnScrollSpeed:c,panOnDrag:f,zoomOnDoubleClick:h,zoomOnPinch:g,zoomOnScroll:y,preventScrolling:b,noWheelClassName:N,noPanClassName:S,emits:$,connectionStartHandle:_,userSelectionActive:C,paneDragging:B,d3Zoom:G,d3Selection:X,d3ZoomHandler:Y,viewport:oe,viewportRef:K,paneClickDistance:A}=ke();pf(K);const k=at(!1),ee=at(!1);let x=null,I=!1,E=0,M={x:0,y:0,zoom:0};const T=Lt(l),V=Lt(r),H=Lt(a),U=Se(()=>(!V.value||V.value&&r.value===!0)&&(T.value||f.value)),ie=Se(()=>T.value||s.value),le=Se(()=>r.value===!0&&U.value!==!0),he=Se(()=>V.value&&r.value!==!0||C.value||le.value),q=Se(()=>_.value!==null);Ue(()=>{if(!K.value){Qt("Viewport element is missing");return}const de=K.value,ye=de.getBoundingClientRect(),ae=Yc().clickDistance(A.value).scaleExtent([t.value,n.value]).translateExtent(i.value),se=Be(de).call(ae),m=se.on("wheel.zoom"),v=Mt.translate(o.value.x??0,o.value.y??0).scale(wt(o.value.zoom??1,t.value,n.value)),d=[[0,0],[ye.width,ye.height]],p=ae.constrain()(v,d,i.value);ae.transform(se,p),ae.wheelDelta(fi),G.value=ae,X.value=se,Y.value=m,oe.value={x:p.x,y:p.y,zoom:p.k},ae.on("start",w=>{var P;if(!w.sourceEvent)return null;E=w.sourceEvent.button,k.value=!0;const R=ce(w.transform);((P=w.sourceEvent)==null?void 0:P.type)==="mousedown"&&(B.value=!0),M=R,$.viewportChangeStart(R),$.moveStart({event:w,flowTransform:R})}),ae.on("end",w=>{if(!w.sourceEvent)return null;if(k.value=!1,B.value=!1,j(U.value,E??0)&&!I&&$.paneContextMenu(w.sourceEvent),I=!1,L(M,w.transform)){const P=ce(w.transform);M=P,$.viewportChangeEnd(P),$.moveEnd({event:w,flowTransform:P})}}),ae.filter(w=>{var P;const R=H.value||y.value,F=g.value&&w.ctrlKey,Q=w.button,re=w.type==="wheel";if(Q===1&&w.type==="mousedown"&&(_e(w,"vue-flow__node")||_e(w,"vue-flow__edge")))return!0;if(!U.value&&!R&&!ie.value&&!h.value&&!g.value||C.value||q.value&&!re||!h.value&&w.type==="dblclick"||_e(w,N.value)&&re||_e(w,S.value)&&(!re||ie.value&&re&&!H.value)||!g.value&&w.ctrlKey&&re||!R&&!ie.value&&!F&&re)return!1;if(!g&&w.type==="touchstart"&&((P=w.touches)==null?void 0:P.length)>1)return w.preventDefault(),!1;if(!U.value&&(w.type==="mousedown"||w.type==="touchstart")||le.value&&Array.isArray(f.value)&&f.value.includes(0)&&Q===0||Array.isArray(f.value)&&!f.value.includes(Q)&&(w.type==="mousedown"||w.type==="touchstart"))return!1;const ge=Array.isArray(f.value)&&f.value.includes(Q)||r.value===!0&&Array.isArray(f.value)&&!f.value.includes(0)||!Q||Q<=1;return(!w.ctrlKey||T.value||re)&&ge}),Ee([C,U],()=>{C.value&&!k.value?ae.on("zoom",null):C.value||ae.on("zoom",w=>{oe.value={x:w.transform.x,y:w.transform.y,zoom:w.transform.k};const P=ce(w.transform);I=j(U.value,E??0),$.viewportChange(P),$.move({event:w,flowTransform:P})})},{immediate:!0}),Ee([C,ie,u,H,g,b,N],()=>{ie.value&&!H.value&&!C.value?se.on("wheel.zoom",w=>{if(_e(w,N.value))return!1;const P=H.value||y.value,R=g.value&&w.ctrlKey;if(!(!b.value||ie.value||P||R))return!1;w.preventDefault(),w.stopImmediatePropagation();const Q=se.property("__zoom").k||1,re=kn();if(!T.value&&w.ctrlKey&&g.value&&re){const Qr=Fe(w),ea=fi(w),ta=Q*2**ea;ae.scaleTo(se,ta,Qr,w);return}const ge=w.deltaMode===1?20:1;let be=u.value===Rt.Vertical?0:w.deltaX*ge,nt=u.value===Rt.Horizontal?0:w.deltaY*ge;!re&&w.shiftKey&&u.value!==Rt.Vertical&&!be&&nt&&(be=nt,nt=0),ae.translateBy(se,-(be/Q)*c.value,-(nt/Q)*c.value);const Le=ce(se.property("__zoom"));x&&clearTimeout(x),ee.value?($.move({event:w,flowTransform:Le}),$.viewportChange(Le),x=setTimeout(()=>{$.moveEnd({event:w,flowTransform:Le}),$.viewportChangeEnd(Le),ee.value=!1},150)):(ee.value=!0,$.moveStart({event:w,flowTransform:Le}),$.viewportChangeStart(Le))},{passive:!1}):typeof m<"u"&&se.on("wheel.zoom",function(w,P){const R=!b.value&&w.type==="wheel"&&!w.ctrlKey,F=H.value||y.value,Q=g.value&&w.ctrlKey;if(!F&&!s.value&&!Q&&w.type==="wheel"||R||_e(w,N.value))return null;w.preventDefault(),m.call(this,w,P)},{passive:!1})},{immediate:!0})});function j(de,ye){return ye===2&&Array.isArray(de)&&de.includes(2)}function L(de,ye){return de.x!==ye.x&&!Number.isNaN(ye.x)||de.y!==ye.y&&!Number.isNaN(ye.y)||de.zoom!==ye.k&&!Number.isNaN(ye.k)}function ce(de){return{x:de.x,y:de.y,zoom:de.k}}function _e(de,ye){return de.target.closest(`.${ye}`)}return(de,ye)=>(O(),J("div",{ref_key:"viewportRef",ref:K,class:"vue-flow__viewport vue-flow__container"},[z(Sf,{"is-selecting":he.value,"selection-key-pressed":D(V),class:Xe({connecting:q.value,dragging:D(B),draggable:D(f)===!0||Array.isArray(D(f))&&D(f).includes(0)})},{default:ue(()=>[z(kf,null,{default:ue(()=>[$e(de.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),Mf=["id"],Df=["id"],If=["id"],Pf={name:"A11yDescriptions",compatConfig:{MODE:3}},Of=we({...Pf,setup(e){const{id:t,disableKeyboardA11y:n,ariaLiveMessage:o}=ke();return(i,a)=>(O(),J(De,null,[ne("div",{id:`${D(xr)}-${D(t)}`,style:{display:"none"}}," Press enter or space to select a node. "+Ne(D(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,Mf),ne("div",{id:`${D(Er)}-${D(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),D(n)?fe("",!0):(O(),J("div",{key:0,id:`${D(Kc)}-${D(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%)"}},Ne(D(o)),9,If))],64))}});function Tf(){const e=ke();Ee(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function Af(e,t,n){return n===Z.Left?e-t:n===Z.Right?e+t:e}function zf(e,t,n){return n===Z.Top?e-t:n===Z.Bottom?e+t:e}const Ao=function({radius:e=10,centerX:t=0,centerY:n=0,position:o=Z.Top,type:i}){return xe("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${i}`,cx:Af(t,e,o),cy:zf(n,e,o),r:e,stroke:"transparent",fill:"transparent"})};Ao.props=["radius","centerX","centerY","position","type"];Ao.compatConfig={MODE:3};const Pi=Ao,Bf=we({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:t,addSelectedEdges:n,connectionMode:o,edgeUpdaterRadius:i,emits:a,nodesSelectionActive:r,noPanClassName:l,getEdgeTypes:s,removeSelectedEdges:u,findEdge:c,findNode:f,isValidConnection:h,multiSelectionActive:g,disableKeyboardA11y:y,elementsSelectable:b,edgesUpdatable:N,edgesFocusable:S,hooks:$}=ke(),_=te(()=>c(e.id)),{emit:C,on:B}=kd(_.value,a),G=It(Bn),X=Pt(),Y=me(!1),oe=me(!1),K=me(""),A=me(null),k=me("source"),ee=me(null),x=Se(()=>typeof _.value.selectable>"u"?b.value:_.value.selectable),I=Se(()=>typeof _.value.updatable>"u"?N.value:_.value.updatable),E=Se(()=>typeof _.value.focusable>"u"?S.value:_.value.focusable);kt(Ed,e.id),kt(Sd,ee);const M=te(()=>_.value.class instanceof Function?_.value.class(_.value):_.value.class),T=te(()=>_.value.style instanceof Function?_.value.style(_.value):_.value.style),V=te(()=>{const v=_.value.type||"default",d=G==null?void 0:G[`edge-${v}`];if(d)return d;let p=_.value.template??s.value[v];if(typeof p=="string"&&X){const w=Object.keys(X.appContext.components);w&&w.includes(v)&&(p=Bi(v,!1))}return p&&typeof p!="string"?p:(a.error(new Ie(Me.EDGE_TYPE_MISSING,p)),!1)}),{handlePointerDown:H}=Fr({nodeId:K,handleId:A,type:k,isValidConnection:h,edgeUpdaterType:k,onEdgeUpdate:le,onEdgeUpdateEnd:he});return()=>{const v=f(_.value.source),d=f(_.value.target),p="pathOptions"in _.value?_.value.pathOptions:{};if(!v&&!d)return a.error(new Ie(Me.EDGE_SOURCE_TARGET_MISSING,_.value.id,_.value.source,_.value.target)),null;if(!v)return a.error(new Ie(Me.EDGE_SOURCE_MISSING,_.value.id,_.value.source)),null;if(!d)return a.error(new Ie(Me.EDGE_TARGET_MISSING,_.value.id,_.value.target)),null;if(!_.value||_.value.hidden||v.hidden||d.hidden)return null;let w;o.value===st.Strict?w=v.handleBounds.source:w=[...v.handleBounds.source||[],...v.handleBounds.target||[]];const P=_i(w,_.value.sourceHandle);let R;o.value===st.Strict?R=d.handleBounds.target:R=[...d.handleBounds.target||[],...d.handleBounds.source||[]];const F=_i(R,_.value.targetHandle),Q=(P==null?void 0:P.position)||Z.Bottom,re=(F==null?void 0:F.position)||Z.Top,{x:ge,y:be}=Dt(v,P,Q),{x:nt,y:Le}=Dt(d,F,re);return _.value.sourceX=ge,_.value.sourceY=be,_.value.targetX=nt,_.value.targetY=Le,xe("g",{ref:ee,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${V.value===!1?"default":_.value.type||"default"}`,l.value,M.value,{updating:Y.value,selected:_.value.selected,animated:_.value.animated,inactive:!x.value&&!$.value.edgeClick.hasListeners()}],tabIndex:E.value?0:void 0,"aria-label":_.value.ariaLabel===null?void 0:_.value.ariaLabel??`Edge from ${_.value.source} to ${_.value.target}`,"aria-describedby":E.value?`${Er}-${t}`:void 0,"aria-roledescription":"edge",role:E.value?"group":"img",..._.value.domAttributes,onClick:j,onContextmenu:L,onDblclick:ce,onMouseenter:_e,onMousemove:de,onMouseleave:ye,onKeyDown:E.value?m:void 0},[oe.value?null:xe(V.value===!1?s.value.default:V.value,{id:e.id,sourceNode:v,targetNode:d,source:_.value.source,target:_.value.target,type:_.value.type,updatable:I.value,selected:_.value.selected,animated:_.value.animated,label:_.value.label,labelStyle:_.value.labelStyle,labelShowBg:_.value.labelShowBg,labelBgStyle:_.value.labelBgStyle,labelBgPadding:_.value.labelBgPadding,labelBgBorderRadius:_.value.labelBgBorderRadius,data:_.value.data,events:{..._.value.events,...B},style:T.value,markerStart:`url('#${Kt(_.value.markerStart,t)}')`,markerEnd:`url('#${Kt(_.value.markerEnd,t)}')`,sourcePosition:Q,targetPosition:re,sourceX:ge,sourceY:be,targetX:nt,targetY:Le,sourceHandleId:_.value.sourceHandle,targetHandleId:_.value.targetHandle,interactionWidth:_.value.interactionWidth,...p}),[I.value==="source"||I.value===!0?[xe("g",{onMousedown:ae,onMouseenter:U,onMouseout:ie},xe(Pi,{position:Q,centerX:ge,centerY:be,radius:i.value,type:"source","data-type":"source"}))]:null,I.value==="target"||I.value===!0?[xe("g",{onMousedown:se,onMouseenter:U,onMouseout:ie},xe(Pi,{position:re,centerX:nt,centerY:Le,radius:i.value,type:"target","data-type":"target"}))]:null]])};function U(){Y.value=!0}function ie(){Y.value=!1}function le(v,d){C.update({event:v,edge:_.value,connection:d})}function he(v){C.updateEnd({event:v,edge:_.value}),oe.value=!1}function q(v,d){v.button===0&&(oe.value=!0,K.value=d?_.value.target:_.value.source,A.value=(d?_.value.targetHandle:_.value.sourceHandle)??null,k.value=d?"target":"source",C.updateStart({event:v,edge:_.value}),H(v))}function j(v){var d;const p={event:v,edge:_.value};x.value&&(r.value=!1,_.value.selected&&g.value?(u([_.value]),(d=ee.value)==null||d.blur()):n([_.value])),C.click(p)}function L(v){C.contextMenu({event:v,edge:_.value})}function ce(v){C.doubleClick({event:v,edge:_.value})}function _e(v){C.mouseEnter({event:v,edge:_.value})}function de(v){C.mouseMove({event:v,edge:_.value})}function ye(v){C.mouseLeave({event:v,edge:_.value})}function ae(v){q(v,!0)}function se(v){q(v,!1)}function m(v){var d;!y.value&&Sr.includes(v.key)&&x.value&&(v.key==="Escape"?((d=ee.value)==null||d.blur(),u([c(e.id)])):n([c(e.id)]))}}}),Vf=Bf,Hf=we({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:t,connectionMode:n,connectionStartHandle:o,connectionEndHandle:i,connectionPosition:a,connectionLineType:r,connectionLineStyle:l,connectionLineOptions:s,connectionStatus:u,viewport:c,findNode:f}=ke(),h=(e=It(Bn))==null?void 0:e["connection-line"],g=te(()=>{var $;return f(($=o.value)==null?void 0:$.nodeId)}),y=te(()=>{var $;return f(($=i.value)==null?void 0:$.nodeId)??null}),b=te(()=>({x:(a.value.x-c.value.x)/c.value.zoom,y:(a.value.y-c.value.y)/c.value.zoom})),N=te(()=>s.value.markerStart?`url(#${Kt(s.value.markerStart,t)})`:""),S=te(()=>s.value.markerEnd?`url(#${Kt(s.value.markerEnd,t)})`:"");return()=>{var $,_,C;if(!g.value||!o.value)return null;const B=o.value.id,G=o.value.type,X=g.value.handleBounds;let Y=(X==null?void 0:X[G])??[];if(n.value===st.Loose){const T=(X==null?void 0:X[G==="source"?"target":"source"])??[];Y=[...Y,...T]}if(!Y)return null;const oe=(B?Y.find(T=>T.id===B):Y[0])??null,K=(oe==null?void 0:oe.position)??Z.Top,{x:A,y:k}=Dt(g.value,oe,K);let ee=null;y.value&&(n.value===st.Strict?ee=(($=y.value.handleBounds[G==="source"?"target":"source"])==null?void 0:$.find(T=>{var V;return T.id===((V=i.value)==null?void 0:V.id)}))||null:ee=((_=[...y.value.handleBounds.source??[],...y.value.handleBounds.target??[]])==null?void 0:_.find(T=>{var V;return T.id===((V=i.value)==null?void 0:V.id)}))||null);const x=((C=i.value)==null?void 0:C.position)??(K?fo[K]:null);if(!K||!x)return null;const I=r.value??s.value.type??ft.Bezier;let E="";const M={sourceX:A,sourceY:k,sourcePosition:K,targetX:b.value.x,targetY:b.value.y,targetPosition:x};return I===ft.Bezier?[E]=Zr(M):I===ft.Step?[E]=vo({...M,borderRadius:0}):I===ft.SmoothStep?[E]=vo(M):I===ft.SimpleBezier?[E]=Kr(M):E=`M${A},${k} ${b.value.x},${b.value.y}`,xe("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},xe("g",{class:"vue-flow__connection"},h?xe(h,{sourceX:A,sourceY:k,sourcePosition:K,targetX:b.value.x,targetY:b.value.y,targetPosition:x,sourceNode:g.value,sourceHandle:oe,targetNode:y.value,targetHandle:ee,markerEnd:S.value,markerStart:N.value,connectionStatus:u.value}):xe("path",{d:E,class:[s.value.class,u.value,"vue-flow__connection-path"],style:{...l.value,...s.value.style},"marker-end":S.value,"marker-start":N.value})))}}}),Rf=Hf,Lf=["id","markerWidth","markerHeight","markerUnits","orient"],Ff={name:"MarkerType",compatConfig:{MODE:3}},Yf=we({...Ff,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)=>(O(),J("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===D(uo).ArrowClosed?(O(),J("polyline",{key:0,style:He({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)):fe("",!0),t.type===D(uo).Arrow?(O(),J("polyline",{key:1,style:He({stroke:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):fe("",!0)],8,Lf))}}),Gf={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},Wf={name:"MarkerDefinitions",compatConfig:{MODE:3}},Xf=we({...Wf,setup(e){const{id:t,edges:n,connectionLineOptions:o,defaultMarkerColor:i}=ke(),a=te(()=>{const r=new Set,l=[],s=u=>{if(u){const c=Kt(u,t);r.has(c)||(typeof u=="object"?l.push({...u,id:c,color:u.color||i.value}):l.push({id:c,color:i.value,type:u}),r.add(c))}};for(const u of[o.value.markerEnd,o.value.markerStart])s(u);for(const u of n.value)for(const c of[u.markerStart,u.markerEnd])s(c);return l.sort((u,c)=>u.id.localeCompare(c.id))});return(r,l)=>(O(),J("svg",Gf,[ne("defs",null,[(O(!0),J(De,null,qt(a.value,s=>(O(),ve(Yf,{id:s.id,key:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,"stroke-width":s.strokeWidth,orient:s.orient},null,8,["id","type","color","width","height","markerUnits","stroke-width","orient"]))),128))])]))}}),Uf={name:"Edges",compatConfig:{MODE:3}},Zf=we({...Uf,setup(e){const{findNode:t,getEdges:n,elevateEdgesOnSelect:o}=ke();return(i,a)=>(O(),J(De,null,[z(Xf),(O(!0),J(De,null,qt(D(n),r=>(O(),J("svg",{key:r.id,class:"vue-flow__edges vue-flow__container",style:He({zIndex:D(dd)(r,D(t),D(o))})},[z(D(Vf),{id:r.id},null,8,["id"])],4))),128)),z(D(Rf))],64))}}),Kf=we({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:t,noPanClassName:n,selectNodesOnDrag:o,nodesSelectionActive:i,multiSelectionActive:a,emits:r,removeSelectedNodes:l,addSelectedNodes:s,updateNodeDimensions:u,onUpdateNodeInternals:c,getNodeTypes:f,nodeExtent:h,elevateNodesOnSelect:g,disableKeyboardA11y:y,ariaLiveMessage:b,snapToGrid:N,snapGrid:S,nodeDragThreshold:$,nodesDraggable:_,elementsSelectable:C,nodesConnectable:B,nodesFocusable:G,hooks:X}=ke(),Y=me(null);kt(Rr,Y),kt(Hr,e.id);const oe=It(Bn),K=Pt(),A=Gr(),{node:k,parentNode:ee}=Yr(e.id),{emit:x,on:I}=Dd(k,r),E=Se(()=>typeof k.draggable>"u"?_.value:k.draggable),M=Se(()=>typeof k.selectable>"u"?C.value:k.selectable),T=Se(()=>typeof k.connectable>"u"?B.value:k.connectable),V=Se(()=>typeof k.focusable>"u"?G.value:k.focusable),H=te(()=>M.value||E.value||X.value.nodeClick.hasListeners()||X.value.nodeDoubleClick.hasListeners()||X.value.nodeMouseEnter.hasListeners()||X.value.nodeMouseMove.hasListeners()||X.value.nodeMouseLeave.hasListeners()),U=Se(()=>!!k.dimensions.width&&!!k.dimensions.height),ie=te(()=>{const d=k.type||"default",p=oe==null?void 0:oe[`node-${d}`];if(p)return p;let w=k.template||f.value[d];if(typeof w=="string"&&K){const P=Object.keys(K.appContext.components);P&&P.includes(d)&&(w=Bi(d,!1))}return w&&typeof w!="string"?w:(r.error(new Ie(Me.NODE_TYPE_MISSING,w)),!1)}),le=Lr({id:e.id,el:Y,disabled:()=>!E.value,selectable:M,dragHandle:()=>k.dragHandle,onStart(d){x.dragStart(d)},onDrag(d){x.drag(d)},onStop(d){x.dragStop(d)},onClick(d){m(d)}}),he=te(()=>k.class instanceof Function?k.class(k):k.class),q=te(()=>{const d=(k.style instanceof Function?k.style(k):k.style)||{},p=k.width instanceof Function?k.width(k):k.width,w=k.height instanceof Function?k.height(k):k.height;return!d.width&&p&&(d.width=typeof p=="string"?p:`${p}px`),!d.height&&w&&(d.height=typeof w=="string"?w:`${w}px`),d}),j=Se(()=>Number(k.zIndex??q.value.zIndex??0));return c(d=>{(d.includes(e.id)||!d.length)&&ce()}),Ue(()=>{Ee(()=>k.hidden,(d=!1,p,w)=>{!d&&Y.value&&(e.resizeObserver.observe(Y.value),w(()=>{Y.value&&e.resizeObserver.unobserve(Y.value)}))},{immediate:!0,flush:"post"})}),Ee([()=>k.type,()=>k.sourcePosition,()=>k.targetPosition],()=>{et(()=>{u([{id:e.id,nodeElement:Y.value,forceUpdate:!0}])})}),Ee([()=>k.position.x,()=>k.position.y,()=>{var d;return(d=ee.value)==null?void 0:d.computedPosition.x},()=>{var d;return(d=ee.value)==null?void 0:d.computedPosition.y},()=>{var d;return(d=ee.value)==null?void 0:d.computedPosition.z},j,()=>k.selected,()=>k.dimensions.height,()=>k.dimensions.width,()=>{var d;return(d=ee.value)==null?void 0:d.dimensions.height},()=>{var d;return(d=ee.value)==null?void 0:d.dimensions.width}],([d,p,w,P,R,F])=>{const Q={x:d,y:p,z:F+(g.value&&k.selected?1e3:0)};typeof w<"u"&&typeof P<"u"?k.computedPosition=rd({x:w,y:P,z:R},Q):k.computedPosition=Q},{flush:"post",immediate:!0}),Ee([()=>k.extent,h],([d,p],[w,P])=>{(d!==w||p!==P)&&L()}),k.extent==="parent"||typeof k.extent=="object"&&"range"in k.extent&&k.extent.range==="parent"?eo(()=>U).toBe(!0).then(L):L(),()=>k.hidden?null:xe("div",{ref:Y,"data-id":k.id,class:["vue-flow__node",`vue-flow__node-${ie.value===!1?"default":k.type||"default"}`,{[n.value]:E.value,dragging:le==null?void 0:le.value,draggable:E.value,selected:k.selected,selectable:M.value,parent:k.isParent},he.value],style:{visibility:U.value?"visible":"hidden",zIndex:k.computedPosition.z??j.value,transform:`translate(${k.computedPosition.x}px,${k.computedPosition.y}px)`,pointerEvents:H.value?"all":"none",...q.value},tabIndex:V.value?0:void 0,role:V.value?"group":void 0,"aria-describedby":y.value?void 0:`${xr}-${t}`,"aria-label":k.ariaLabel,"aria-roledescription":"node",...k.domAttributes,onMouseenter:_e,onMousemove:de,onMouseleave:ye,onContextmenu:ae,onClick:m,onDblclick:se,onKeydown:v},[xe(ie.value===!1?f.value.default:ie.value,{id:k.id,type:k.type,data:k.data,events:{...k.events,...I},selected:k.selected,resizing:k.resizing,dragging:le.value,connectable:T.value,position:k.computedPosition,dimensions:k.dimensions,isValidTargetPos:k.isValidTargetPos,isValidSourcePos:k.isValidSourcePos,parent:k.parentNode,parentNodeId:k.parentNode,zIndex:k.computedPosition.z??j.value,targetPosition:k.targetPosition,sourcePosition:k.sourcePosition,label:k.label,dragHandle:k.dragHandle,onUpdateNodeInternals:ce})]);function L(){const d=k.computedPosition,{computedPosition:p,position:w}=Oo(k,N.value?zn(d,S.value):d,r.error,h.value,ee.value);(k.computedPosition.x!==p.x||k.computedPosition.y!==p.y)&&(k.computedPosition={...k.computedPosition,...p}),(k.position.x!==w.x||k.position.y!==w.y)&&(k.position=w)}function ce(){Y.value&&u([{id:e.id,nodeElement:Y.value,forceUpdate:!0}])}function _e(d){le!=null&&le.value||x.mouseEnter({event:d,node:k})}function de(d){le!=null&&le.value||x.mouseMove({event:d,node:k})}function ye(d){le!=null&&le.value||x.mouseLeave({event:d,node:k})}function ae(d){return x.contextMenu({event:d,node:k})}function se(d){return x.doubleClick({event:d,node:k})}function m(d){M.value&&(!o.value||!E.value||$.value>0)&&ho(k,a.value,s,l,i,!1,Y.value),x.click({event:d,node:k})}function v(d){if(!(co(d)||y.value))if(Sr.includes(d.key)&&M.value){const p=d.key==="Escape";ho(k,a.value,s,l,i,p,Y.value)}else E.value&&k.selected&&Nt[d.key]&&(d.preventDefault(),b.value=`Moved selected node ${d.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~k.position.x}, y: ${~~k.position.y}`,A({x:Nt[d.key].x,y:Nt[d.key].y},d.shiftKey))}}}),qf=Kf;function jf(e={includeHiddenNodes:!1}){const{nodes:t}=ke();return te(()=>{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 Jf={class:"vue-flow__nodes vue-flow__container"},Qf={name:"Nodes",compatConfig:{MODE:3}},eh=we({...Qf,setup(e){const{getNodes:t,updateNodeDimensions:n,emits:o}=ke(),i=jf(),a=me();return Ee(i,r=>{r&&et(()=>{o.nodesInitialized(t.value)})},{immediate:!0}),Ue(()=>{a.value=new ResizeObserver(r=>{const l=r.map(s=>({id:s.target.getAttribute("data-id"),nodeElement:s.target,forceUpdate:!0}));et(()=>n(l))})}),Ai(()=>{var r;return(r=a.value)==null?void 0:r.disconnect()}),(r,l)=>(O(),J("div",Jf,[a.value?(O(!0),J(De,{key:0},qt(D(t),(s,u,c,f)=>{const h=[s.id];if(f&&f.key===s.id&&aa(f,h))return f;const g=(O(),ve(D(qf),{id:s.id,key:s.id,"resize-observer":a.value},null,8,["id","resize-observer"]));return g.memo=h,g},l,0),128)):fe("",!0)]))}});function th(){const{emits:e}=ke();Ue(()=>{if(Vr()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new Ie(Me.MISSING_STYLES))}})}const nh=ne("div",{class:"vue-flow__edge-labels"},null,-1),oh={name:"VueFlow",compatConfig:{MODE:3}},ih=we({...oh,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=ia(),a=Fn(o,"modelValue",n),r=Fn(o,"nodes",n),l=Fn(o,"edges",n),s=ke(o),u=Td({modelValue:a,nodes:r,edges:l},o,s);return zd(n,s.hooks),Tf(),th(),kt(Bn,i),Oi(u),t(s),(c,f)=>(O(),J("div",{ref:D(s).vueFlowRef,class:"vue-flow"},[z(Cf,null,{default:ue(()=>[z(Zf),nh,z(eh),$e(c.$slots,"zoom-pane")]),_:3}),$e(c.$slots,"default"),z(Of)],512))}}),rh={name:"Panel",compatConfig:{MODE:3}},ah=we({...rh,props:{position:{}},setup(e){const t=e,{userSelectionActive:n}=ke(),o=te(()=>`${t.position}`.split("-"));return(i,a)=>(O(),J("div",{class:Xe(["vue-flow__panel",o.value]),style:He({pointerEvents:D(n)?"none":"all"})},[$e(i.$slots,"default")],6))}});var Qe=(e=>(e.Lines="lines",e.Dots="dots",e))(Qe||{});const jr=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]}`})},Jr=function({radius:e,color:t}){return xe("circle",{cx:e,cy:e,r:e,fill:t})};Qe.Lines+"",Qe.Dots+"";const lh={[Qe.Dots]:"#81818a",[Qe.Lines]:"#eee"},sh=["id","x","y","width","height","patternTransform"],uh={key:2,height:"100",width:"100"},ch=["fill"],dh=["x","y","fill"],fh={name:"Background",compatConfig:{MODE:3}},hh=we({...fh,props:{id:{},variant:{default:()=>Qe.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}=ke(),o=te(()=>{const r=n.value.zoom,[l,s]=Array.isArray(e.gap)?e.gap:[e.gap,e.gap],u=[l*r||1,s*r||1],c=e.size*r,[f,h]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],g=[f*r||1+u[0]/2,h*r||1+u[1]/2];return{scaledGap:u,offset:g,size:c}}),i=Se(()=>`pattern-${t}${e.id?`-${e.id}`:""}`),a=Se(()=>e.color||e.patternColor||lh[e.variant||Qe.Dots]);return(r,l)=>(O(),J("svg",{class:"vue-flow__background vue-flow__container",style:He({height:`${r.height>100?100:r.height}%`,width:`${r.width>100?100:r.width}%`})},[$e(r.$slots,"pattern-container",{id:i.value},()=>[ne("pattern",{id:i.value,x:D(n).x%o.value.scaledGap[0],y:D(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"},[$e(r.$slots,"pattern",{},()=>[r.variant===D(Qe).Lines?(O(),ve(D(jr),{key:0,size:r.lineWidth,color:a.value,dimensions:o.value.scaledGap},null,8,["size","color","dimensions"])):r.variant===D(Qe).Dots?(O(),ve(D(Jr),{key:1,color:a.value,radius:o.value.size/2},null,8,["color","radius"])):fe("",!0),r.bgColor?(O(),J("svg",uh,[ne("rect",{width:"100%",height:"100%",fill:r.bgColor},null,8,ch)])):fe("",!0)])],8,sh)]),ne("rect",{x:r.x,y:r.y,width:"100%",height:"100%",fill:`url(#${i.value})`},null,8,dh),$e(r.$slots,"default",{id:i.value})],4))}}),vh={name:"ControlButton",compatConfig:{MODE:3}},gh=(e,t)=>{const n=e.__vccOpts||e;for(const[o,i]of t)n[o]=i;return n},ph={type:"button",class:"vue-flow__controls-button"};function mh(e,t,n,o,i,a){return O(),J("button",ph,[$e(e.$slots,"default")])}const cn=gh(vh,[["render",mh]]),yh={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},wh=ne("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1),_h=[wh];function bh(e,t){return O(),J("svg",yh,_h)}const xh={render:bh},Eh={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},Sh=ne("path",{d:"M0 0h32v4.2H0z"},null,-1),Nh=[Sh];function kh(e,t){return O(),J("svg",Eh,Nh)}const $h={render:kh},Ch={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},Mh=ne("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0 0 27.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94a.919.919 0 0 1-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"},null,-1),Dh=[Mh];function Ih(e,t){return O(),J("svg",Ch,Dh)}const Ph={render:Ih},Oh={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},Th=ne("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"},null,-1),Ah=[Th];function zh(e,t){return O(),J("svg",Oh,Ah)}const Bh={render:zh},Vh={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},Hh=ne("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047z"},null,-1),Rh=[Hh];function Lh(e,t){return O(),J("svg",Vh,Rh)}const Fh={render:Lh},Yh={name:"Controls",compatConfig:{MODE:3}},Gh=we({...Yh,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>br.BottomLeft}},emits:["zoomIn","zoomOut","fitView","interactionChange"],setup(e,{emit:t}){const{nodesDraggable:n,nodesConnectable:o,elementsSelectable:i,setInteractive:a,zoomIn:r,zoomOut:l,fitView:s,viewport:u,minZoom:c,maxZoom:f}=ke(),h=Se(()=>n.value||o.value||i.value),g=Se(()=>u.value.zoom<=c.value),y=Se(()=>u.value.zoom>=f.value);function b(){r(),t("zoomIn")}function N(){l(),t("zoomOut")}function S(){s(e.fitViewParams),t("fitView")}function $(){a(!h.value),t("interactionChange",!h.value)}return(_,C)=>(O(),ve(D(ah),{class:"vue-flow__controls",position:_.position},{default:ue(()=>[$e(_.$slots,"top"),_.showZoom?(O(),J(De,{key:0},[$e(_.$slots,"control-zoom-in",{},()=>[z(cn,{class:"vue-flow__controls-zoomin",disabled:y.value,onClick:b},{default:ue(()=>[$e(_.$slots,"icon-zoom-in",{},()=>[(O(),ve(dt(D(xh))))])]),_:3},8,["disabled"])]),$e(_.$slots,"control-zoom-out",{},()=>[z(cn,{class:"vue-flow__controls-zoomout",disabled:g.value,onClick:N},{default:ue(()=>[$e(_.$slots,"icon-zoom-out",{},()=>[(O(),ve(dt(D($h))))])]),_:3},8,["disabled"])])],64)):fe("",!0),_.showFitView?$e(_.$slots,"control-fit-view",{key:1},()=>[z(cn,{class:"vue-flow__controls-fitview",onClick:S},{default:ue(()=>[$e(_.$slots,"icon-fit-view",{},()=>[(O(),ve(dt(D(Ph))))])]),_:3})]):fe("",!0),_.showInteractive?$e(_.$slots,"control-interactive",{key:2},()=>[_.showInteractive?(O(),ve(cn,{key:0,class:"vue-flow__controls-interactive",onClick:$},{default:ue(()=>[h.value?$e(_.$slots,"icon-unlock",{key:0},()=>[(O(),ve(dt(D(Fh))))]):fe("",!0),h.value?fe("",!0):$e(_.$slots,"icon-lock",{key:1},()=>[(O(),ve(dt(D(Bh))))])]),_:3})):fe("",!0)]):fe("",!0),$e(_.$slots,"default")]),_:3},8,["position"]))}}),Wh={class:"node-header"},Xh={class:"node-title"},Uh={class:"node-body"},Zh={key:0,class:"node-detail"},Kh={class:"detail-value"},qh={key:1,class:"node-detail"},jh={class:"detail-value"},Jh={key:0,class:"status-indicator"},Qh=we({__name:"SkillNode",props:{data:{}},setup(e){return(t,n)=>(O(),J("div",{class:Xe(["skill-node",[e.data.selected?"selected":"",e.data.status?`status-${e.data.status}`:""]])},[z(D(Te),{type:"target",position:D(Z).Left,id:"input"},null,8,["position"]),ne("div",Wh,[z(D(Ri),{class:"node-icon"}),ne("span",Xh,Ne(e.data.label),1)]),ne("div",Uh,[e.data.action?(O(),J("div",Zh,[n[0]||(n[0]=ne("span",{class:"detail-label"},"动作:",-1)),ne("span",Kh,Ne(e.data.action),1)])):fe("",!0),e.data.timeout_seconds?(O(),J("div",qh,[n[1]||(n[1]=ne("span",{class:"detail-label"},"超时:",-1)),ne("span",jh,Ne(e.data.timeout_seconds)+"s",1)])):fe("",!0)]),e.data.status?(O(),J("div",Jh,[e.data.status==="running"?(O(),ve(D($n),{key:0,class:"status-icon running-icon"})):e.data.status==="completed"?(O(),ve(D(Cn),{key:1,class:"status-icon completed-icon"})):e.data.status==="failed"?(O(),ve(D(Mn),{key:2,class:"status-icon failed-icon"})):e.data.status==="waiting_approval"?(O(),ve(D(Ot),{key:3,class:"status-icon waiting-icon"})):fe("",!0)])):fe("",!0),z(D(Te),{type:"source",position:D(Z).Right,id:"output"},null,8,["position"])],2))}}),ev=ct(Qh,[["__scopeId","data-v-84e1f214"]]),tv={class:"diamond-shape"},nv={class:"diamond-content"},ov={class:"node-title"},iv={key:0,class:"condition-expr"},rv={key:1,class:"status-indicator"},av=we({__name:"ConditionNode",props:{data:{}},setup(e){return(t,n)=>{var o;return O(),J("div",{class:Xe(["condition-node",[e.data.selected?"selected":"",e.data.status?`status-${e.data.status}`:""]])},[z(D(Te),{type:"target",position:D(Z).Left,id:"input"},null,8,["position"]),ne("div",tv,[ne("div",nv,[z(D(Dn),{class:"node-icon"}),ne("span",ov,Ne(e.data.label),1)])]),(o=e.data.config)!=null&&o.expression?(O(),J("div",iv,Ne(e.data.config.expression),1)):fe("",!0),e.data.status?(O(),J("div",rv,[e.data.status==="running"?(O(),ve(D($n),{key:0,class:"status-icon running-icon"})):e.data.status==="completed"?(O(),ve(D(Cn),{key:1,class:"status-icon completed-icon"})):e.data.status==="failed"?(O(),ve(D(Mn),{key:2,class:"status-icon failed-icon"})):e.data.status==="waiting_approval"?(O(),ve(D(Ot),{key:3,class:"status-icon waiting-icon"})):fe("",!0)])):fe("",!0),z(D(Te),{type:"source",position:D(Z).Right,id:"true",class:"handle-true"},null,8,["position"]),n[0]||(n[0]=ne("span",{class:"label-true"},"是",-1)),z(D(Te),{type:"source",position:D(Z).Bottom,id:"false",class:"handle-false"},null,8,["position"]),n[1]||(n[1]=ne("span",{class:"label-false"},"否",-1))],2)}}}),lv=ct(av,[["__scopeId","data-v-1b09e49e"]]),sv={class:"node-header"},uv={class:"node-title"},cv={class:"node-body"},dv={key:0,class:"node-detail"},fv={class:"detail-value"},hv={key:1,class:"node-detail"},vv={class:"detail-value"},gv={key:0,class:"status-indicator"},pv=we({__name:"ApprovalNode",props:{data:{}},setup(e){const t=e,n=te(()=>{var o;return((o=t.data.config)==null?void 0:o.status)==="paused"});return(o,i)=>{var r,l;const a=po;return O(),J("div",{class:Xe(["approval-node",[e.data.selected?"selected":"",e.data.status?`status-${e.data.status}`:"",n.value?"paused":""]])},[z(D(Te),{type:"target",position:D(Z).Left,id:"input"},null,8,["position"]),ne("div",sv,[z(D(Li),{class:"node-icon"}),ne("span",uv,Ne(e.data.label),1),n.value?(O(),ve(a,{key:0,color:"orange",class:"pause-tag"},{default:ue(()=>[...i[0]||(i[0]=[Oe("等待审批",-1)])]),_:1})):fe("",!0)]),ne("div",cv,[(r=e.data.config)!=null&&r.approver?(O(),J("div",dv,[i[1]||(i[1]=ne("span",{class:"detail-label"},"审批人:",-1)),ne("span",fv,Ne(e.data.config.approver),1)])):fe("",!0),(l=e.data.config)!=null&&l.timeout?(O(),J("div",hv,[i[2]||(i[2]=ne("span",{class:"detail-label"},"超时:",-1)),ne("span",vv,Ne(e.data.config.timeout)+"s",1)])):fe("",!0)]),e.data.status?(O(),J("div",gv,[e.data.status==="running"?(O(),ve(D($n),{key:0,class:"status-icon running-icon"})):e.data.status==="completed"?(O(),ve(D(Cn),{key:1,class:"status-icon completed-icon"})):e.data.status==="failed"?(O(),ve(D(Mn),{key:2,class:"status-icon failed-icon"})):e.data.status==="waiting_approval"?(O(),ve(D(Ot),{key:3,class:"status-icon waiting-icon"})):fe("",!0)])):fe("",!0),z(D(Te),{type:"source",position:D(Z).Right,id:"output"},null,8,["position"])],2)}}}),mv=ct(pv,[["__scopeId","data-v-31a2d3e2"]]),yv={class:"node-header"},wv={class:"node-title"},_v={class:"node-body"},bv={key:0,class:"node-detail"},xv={class:"detail-value"},Ev={key:0,class:"status-indicator"},Sv=we({__name:"ParallelNode",props:{data:{}},setup(e){return(t,n)=>{var o;return O(),J("div",{class:Xe(["parallel-node",[e.data.selected?"selected":"",e.data.status?`status-${e.data.status}`:""]])},[z(D(Te),{type:"target",position:D(Z).Top,id:"input"},null,8,["position"]),ne("div",yv,[z(D(bo),{class:"node-icon"}),ne("span",wv,Ne(e.data.label),1)]),ne("div",_v,[(o=e.data.config)!=null&&o.max_parallel?(O(),J("div",bv,[n[0]||(n[0]=ne("span",{class:"detail-label"},"最大并行数:",-1)),ne("span",xv,Ne(e.data.config.max_parallel),1)])):fe("",!0)]),e.data.status?(O(),J("div",Ev,[e.data.status==="running"?(O(),ve(D($n),{key:0,class:"status-icon running-icon"})):e.data.status==="completed"?(O(),ve(D(Cn),{key:1,class:"status-icon completed-icon"})):e.data.status==="failed"?(O(),ve(D(Mn),{key:2,class:"status-icon failed-icon"})):e.data.status==="waiting_approval"?(O(),ve(D(Ot),{key:3,class:"status-icon waiting-icon"})):fe("",!0)])):fe("",!0),z(D(Te),{type:"source",position:D(Z).Bottom,id:"output"},null,8,["position"])],2)}}}),Nv=ct(Sv,[["__scopeId","data-v-c3e12e75"]]),kv={class:"canvas-toolbar"},$v=we({__name:"FlowCanvas",props:{saving:{type:Boolean},executing:{type:Boolean}},emits:["save","execute","clear","node-select","node-drop"],setup(e,{emit:t}){const n=So(),o=t,i=me(),a={skill:lt(ev),condition:lt(lv),approval:lt(mv),parallel:lt(Nv)},r={animated:!0,style:{stroke:"#1890ff",strokeWidth:2}};function l(y){y.preventDefault(),y.dataTransfer&&(y.dataTransfer.dropEffect="move")}function s(y){var C,B;const b=(C=y.dataTransfer)==null?void 0:C.getData("application/vueflow");if(!b)return;const{left:N,top:S}=((B=i.value)==null?void 0:B.getBoundingClientRect())||{left:0,top:0};let $=y.clientX-N-100,_=y.clientY-S-50;$=Math.round($/15)*15,_=Math.round(_/15)*15,o("node-drop",b,{x:$,y:_})}function u({node:y}){o("node-select",y.id)}function c(){o("node-select",null)}function f(y){const b={id:`edge-${y.source}-${y.target}`,source:y.source,target:y.target,sourceHandle:y.sourceHandle,targetHandle:y.targetHandle,animated:!0,style:{stroke:"#7c3aed",strokeWidth:2}};n.addEdge(b)}function h(y){const b=y.target;if(b.tagName==="INPUT"||b.tagName==="TEXTAREA"||b.isContentEditable)return;const N=(y.ctrlKey||y.metaKey)&&y.key.toLowerCase()==="z"&&!y.shiftKey,S=(y.ctrlKey||y.metaKey)&&y.key.toLowerCase()==="z"&&y.shiftKey||(y.ctrlKey||y.metaKey)&&y.key.toLowerCase()==="y";N?(y.preventDefault(),n.undo()):S&&(y.preventDefault(),n.redo())}Ue(()=>{window.addEventListener("keydown",h)}),Oi(()=>{window.removeEventListener("keydown",h),n.disconnectExecutionWebSocket()});function g(){if(n.flowNodes.length===0){qe.warning("工作流为空,请添加节点");return}const y=new Set(n.flowEdges.map($=>$.source)),b=new Set(n.flowEdges.map($=>$.target)),N=new Set([...y,...b]),S=n.flowNodes.filter($=>!N.has($.id));if(S.length>0&&n.flowNodes.length>1){qe.warning(`存在未连接的节点: ${S.map($=>{var _;return(_=$.data)==null?void 0:_.label}).join(", ")}`);return}qe.success("工作流验证通过")}return(y,b)=>{const N=mo,S=ga;return O(),J("div",{class:"flow-canvas",ref_key:"canvasRef",ref:i,onDrop:s,onDragover:l},[ne("div",kv,[z(S,null,{default:ue(()=>[z(N,{size:"small",onClick:b[0]||(b[0]=$=>y.$emit("save")),loading:e.saving},{icon:ue(()=>[z(D(Eo))]),default:ue(()=>[b[5]||(b[5]=Oe(" 保存 ",-1))]),_:1},8,["loading"]),z(N,{size:"small",type:"primary",onClick:b[1]||(b[1]=$=>y.$emit("execute")),loading:e.executing},{icon:ue(()=>[z(D(xo))]),default:ue(()=>[b[6]||(b[6]=Oe(" 执行 ",-1))]),_:1},8,["loading"]),z(N,{size:"small",onClick:g},{icon:ue(()=>[z(D(fa))]),default:ue(()=>[b[7]||(b[7]=Oe(" 验证 ",-1))]),_:1}),z(N,{size:"small",danger:"",onClick:b[2]||(b[2]=$=>y.$emit("clear"))},{icon:ue(()=>[z(D(yo))]),default:ue(()=>[b[8]||(b[8]=Oe(" 清空 ",-1))]),_:1})]),_:1})]),z(D(ih),{nodes:D(n).flowNodes,"onUpdate:nodes":b[3]||(b[3]=$=>D(n).flowNodes=$),edges:D(n).flowEdges,"onUpdate:edges":b[4]||(b[4]=$=>D(n).flowEdges=$),"node-types":a,"default-edge-options":r,"snap-to-grid":!0,"snap-grid":[15,15],"fit-view-on-init":"",onNodeClick:u,onPaneClick:c,onConnect:f},{default:ue(()=>[z(D(hh),{gap:20,size:1}),z(D(Gh))]),_:1},8,["nodes","edges"])],544)}}}),Cv=ct($v,[["__scopeId","data-v-f6c82275"]]),Mv={class:"property-panel"},Dv={class:"panel-header"},Iv={class:"panel-body"},Pv={key:1,class:"panel-empty"},Ov=we({__name:"PropertyPanel",props:{nodeData:{}},emits:["delete-node"],setup(e){const t=So(),n=e,o=te(()=>{var s;return{skill:"技能节点",condition:"条件节点",approval:"审批节点",parallel:"并行节点"}[((s=n.nodeData)==null?void 0:s.type)||"skill"]||"未知"}),i=te(()=>{var s;return{skill:"blue",condition:"orange",approval:"purple",parallel:"green"}[((s=n.nodeData)==null?void 0:s.type)||"skill"]||"default"});function a(l,s){t.selectedNodeId&&t.updateNodeData(t.selectedNodeId,{[l]:s})}function r(l,s){t.selectedNodeId&&n.nodeData&&t.updateNodeData(t.selectedNodeId,{config:{...n.nodeData.config,[l]:s}})}return(l,s)=>{const u=mo,c=ma,f=Yi,h=po,g=wa,y=Gi,b=Fi,N=Hi;return O(),J("div",Mv,[e.nodeData?(O(),J(De,{key:0},[ne("div",Dv,[s[11]||(s[11]=ne("span",{class:"panel-title"},"节点属性",-1)),z(u,{size:"small",type:"text",danger:"",onClick:s[0]||(s[0]=S=>l.$emit("delete-node",e.nodeData))},{icon:ue(()=>[z(D(yo))]),_:1})]),ne("div",Iv,[z(b,{layout:"vertical",size:"small"},{default:ue(()=>[z(f,{label:"节点名称"},{default:ue(()=>[z(c,{value:e.nodeData.label,"onUpdate:value":s[1]||(s[1]=S=>a("label",S))},null,8,["value"])]),_:1}),z(f,{label:"节点类型"},{default:ue(()=>[z(h,{color:i.value},{default:ue(()=>[Oe(Ne(o.value),1)]),_:1},8,["color"])]),_:1}),e.nodeData.type==="skill"?(O(),J(De,{key:0},[z(f,{label:"技能动作"},{default:ue(()=>[z(c,{value:e.nodeData.action,"onUpdate:value":s[2]||(s[2]=S=>a("action",S)),placeholder:"输入技能动作名称"},null,8,["value"])]),_:1}),z(f,{label:"Agent"},{default:ue(()=>[z(c,{value:e.nodeData.agent,"onUpdate:value":s[3]||(s[3]=S=>a("agent",S)),placeholder:"default"},null,8,["value"])]),_:1}),z(f,{label:"超时时间(秒)"},{default:ue(()=>[z(g,{value:e.nodeData.timeout_seconds,"onUpdate:value":s[4]||(s[4]=S=>a("timeout_seconds",S)),min:1,max:86400,style:{width:"100%"}},null,8,["value"])]),_:1}),z(f,{label:"重试次数"},{default:ue(()=>[z(g,{value:e.nodeData.retry_count,"onUpdate:value":s[5]||(s[5]=S=>a("retry_count",S)),min:0,max:10,style:{width:"100%"}},null,8,["value"])]),_:1})],64)):fe("",!0),e.nodeData.type==="condition"?(O(),J(De,{key:1},[z(f,{label:"条件表达式"},{default:ue(()=>{var S;return[z(y,{value:((S=e.nodeData.config)==null?void 0:S.expression)||"","onUpdate:value":s[6]||(s[6]=$=>r("expression",$)),placeholder:"例: status == 'approved'",rows:3},null,8,["value"])]}),_:1}),z(f,{label:"超时时间(秒)"},{default:ue(()=>[z(g,{value:e.nodeData.timeout_seconds,"onUpdate:value":s[7]||(s[7]=S=>a("timeout_seconds",S)),min:1,max:3600,style:{width:"100%"}},null,8,["value"])]),_:1})],64)):fe("",!0),e.nodeData.type==="approval"?(O(),J(De,{key:2},[z(f,{label:"审批人"},{default:ue(()=>{var S;return[z(c,{value:((S=e.nodeData.config)==null?void 0:S.approver)||"","onUpdate:value":s[8]||(s[8]=$=>r("approver",$)),placeholder:"输入审批人"},null,8,["value"])]}),_:1}),z(f,{label:"审批超时(秒)"},{default:ue(()=>{var S;return[z(g,{value:((S=e.nodeData.config)==null?void 0:S.timeout)||3600,"onUpdate:value":s[9]||(s[9]=$=>r("timeout",$)),min:60,max:86400,style:{width:"100%"}},null,8,["value"])]}),_:1})],64)):fe("",!0),e.nodeData.type==="parallel"?(O(),ve(f,{key:3,label:"最大并行数"},{default:ue(()=>{var S;return[z(g,{value:((S=e.nodeData.config)==null?void 0:S.max_parallel)||5,"onUpdate:value":s[10]||(s[10]=$=>r("max_parallel",$)),min:2,max:20,style:{width:"100%"}},null,8,["value"])]}),_:1})):fe("",!0)]),_:1})])],64)):(O(),J("div",Pv,[z(N,{description:"选择节点查看属性"})]))])}}}),Tv=ct(Ov,[["__scopeId","data-v-78d3d684"]]),Av={class:"workflow-editor"},zv={key:0,class:"workflow-list"},Bv={class:"list-header"},Vv={class:"list-body"},Hv=["onClick"],Rv={class:"item-name"},Lv={class:"item-meta"},Fv={key:1,class:"editor-main"},Yv={class:"canvas-area"},Gv={class:"execution-history"},Wv={key:0,class:"history-body"},Xv={key:2,class:"back-bar"},Uv={class:"workflow-name"},Zv=we({__name:"WorkflowView",setup(e){const t=So(),n=me(!1),o=me("{}"),i=me(!1),a=te(()=>t.executionHistory),r=te(()=>t.executionHistoryTotal),l=[{title:"执行ID",dataIndex:"execution_id",key:"execution_id",ellipsis:!0,width:120},{title:"状态",dataIndex:"status",key:"status",width:80},{title:"开始时间",dataIndex:"started_at",key:"started_at",width:160},{title:"完成时间",dataIndex:"completed_at",key:"completed_at",width:160}],s=te(()=>t.workflows),u=te(()=>t.currentWorkflow),c=te(()=>t.currentExecution),f=te(()=>t.isExecuting),h=te(()=>t.isLoading),g=te({get:()=>t.flowNodes,set:E=>{t.flowNodes=E}}),y=te({get:()=>t.flowEdges,set:E=>{t.flowEdges=E}}),b=te(()=>t.selectedNodeData),N=te(()=>{var M;return{pending:"default",running:"processing",paused:"warning",completed:"success",failed:"error",cancelled:"default"}[((M=c.value)==null?void 0:M.status)||"pending"]||"default"}),S=te(()=>{var M;return{pending:"等待中",running:"运行中",paused:"已暂停",completed:"已完成",failed:"已失败",cancelled:"已取消"}[((M=c.value)==null?void 0:M.status)||"pending"]||"未知"});Ue(()=>{t.loadWorkflows()});function $(E){return{pending:"default",running:"processing",paused:"warning",completed:"success",failed:"error",cancelled:"default"}[E]||"default"}function _(E){return{pending:"等待中",running:"运行中",paused:"已暂停",completed:"已完成",failed:"已失败",cancelled:"已取消"}[E]||"未知"}function C(E){if(!E)return"-";try{return new Date(E).toLocaleString()}catch{return E}}async function B(){const E=`工作流 ${s.value.length+1}`;await t.createWorkflow(E)&&qe.success("工作流已创建")}async function G(E){await t.loadWorkflow(E),t.loadExecutionHistory()}async function X(E){await t.deleteWorkflow(E)&&qe.success("工作流已删除")}async function Y(){await t.saveWorkflow()?qe.success("工作流已保存"):qe.error("保存失败")}function oe(){n.value=!0}async function K(){n.value=!1;try{const E=JSON.parse(o.value);await t.executeWorkflow(E),qe.success("工作流开始执行")}catch{qe.error("变量格式错误,请输入有效的 JSON")}}function A(){t.clearCanvas()}function k(E){t.selectNode(E)}function ee(E,M){t.addNode(E,M)}function x(){t.selectedNodeId&&t.removeNode(t.selectedNodeId)}function I(){t.currentWorkflow=null,t.flowNodes=[],t.flowEdges=[],t.selectedNodeId=null,t.currentExecution=null,t.loadWorkflows()}return(E,M)=>{const T=mo,V=Hi,H=xa,U=po,ie=pa,le=Gi,he=Yi,q=Fi,j=Ea;return O(),J("div",Av,[u.value?(O(),J("div",Fv,[z(qa),ne("div",Yv,[z(Cv,{nodes:g.value,edges:y.value,saving:h.value,executing:f.value,onSave:Y,onExecute:oe,onClear:A,onNodeSelect:k,onNodeDrop:ee,"onUpdate:edges":M[0]||(M[0]=L=>y.value=L)},null,8,["nodes","edges","saving","executing"]),ne("div",Gv,[ne("div",{class:"history-header",onClick:M[1]||(M[1]=L=>i.value=!i.value)},[ne("span",null,"执行历史 ("+Ne(r.value)+")",1),i.value?(O(),ve(D(_a),{key:0})):(O(),ve(D(ba),{key:1}))]),i.value?(O(),J("div",Wv,[z(ie,{"data-source":a.value,columns:l,pagination:!1,size:"small","row-key":"execution_id",scroll:{y:200}},{bodyCell:ue(({column:L,record:ce})=>[L.key==="status"?(O(),ve(U,{key:0,color:$(ce.status)},{default:ue(()=>[Oe(Ne(_(ce.status)),1)]),_:2},1032,["color"])):L.key==="started_at"?(O(),J(De,{key:1},[Oe(Ne(C(ce.started_at)),1)],64)):L.key==="completed_at"?(O(),J(De,{key:2},[Oe(Ne(C(ce.completed_at)),1)],64)):fe("",!0)]),_:1},8,["data-source"])])):fe("",!0)])]),z(Tv,{"node-data":b.value,onDeleteNode:x},null,8,["node-data"])])):(O(),J("div",zv,[ne("div",Bv,[M[5]||(M[5]=ne("h3",null,"工作流列表",-1)),z(T,{type:"primary",size:"small",onClick:B},{icon:ue(()=>[z(D(ya))]),default:ue(()=>[M[4]||(M[4]=Oe(" 新建 ",-1))]),_:1})]),z(H,{spinning:h.value},{default:ue(()=>[ne("div",Vv,[(O(!0),J(De,null,qt(s.value,L=>(O(),J("div",{key:L.workflow_id,class:"workflow-item",onClick:ce=>G(L.workflow_id)},[ne("div",Rv,Ne(L.name),1),ne("div",Lv,[ne("span",null,Ne(L.stage_count)+" 个阶段",1),ne("span",null,"v"+Ne(L.version),1)]),z(T,{size:"small",type:"text",danger:"",onClick:ha(ce=>X(L.workflow_id),["stop"])},{icon:ue(()=>[z(D(yo))]),_:1},8,["onClick"])],8,Hv))),128)),s.value.length===0?(O(),ve(V,{key:0,description:"暂无工作流"})):fe("",!0)])]),_:1},8,["spinning"])])),u.value?(O(),J("div",Xv,[z(T,{size:"small",onClick:I},{icon:ue(()=>[z(D(wo))]),default:ue(()=>[M[6]||(M[6]=Oe(" 返回列表 ",-1))]),_:1}),ne("span",Uv,Ne(u.value.name),1),c.value?(O(),ve(U,{key:0,color:N.value},{default:ue(()=>[Oe(Ne(S.value),1)]),_:1},8,["color"])):fe("",!0)])):fe("",!0),z(j,{open:n.value,"onUpdate:open":M[3]||(M[3]=L=>n.value=L),title:"执行工作流",onOk:K,"ok-text":"执行","cancel-text":"取消"},{default:ue(()=>[z(q,{layout:"vertical"},{default:ue(()=>[z(he,{label:"输入变量 (JSON)"},{default:ue(()=>[z(le,{value:o.value,"onUpdate:value":M[2]||(M[2]=L=>o.value=L),placeholder:'{"key": "value"}',rows:4},null,8,["value"])]),_:1})]),_:1})]),_:1},8,["open"])])}}}),_g=ct(Zv,[["__scopeId","data-v-7459974e"]]);export{_g as default};