@dudousxd/nestjs-durable-dashboard 0.22.4 → 0.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/durable-client.d.ts +7 -1
- package/dist/client/durable-client.d.ts.map +1 -1
- package/dist/client/durable-client.js.map +1 -1
- package/dist/client/group-parallel-spans.d.ts +24 -0
- package/dist/client/group-parallel-spans.d.ts.map +1 -0
- package/dist/client/group-parallel-spans.js +64 -0
- package/dist/client/group-parallel-spans.js.map +1 -0
- package/dist/spa/assets/index-B2Kz5wtG.css +1 -0
- package/dist/spa/assets/index-DncInMtX.css +1 -0
- package/dist/spa/assets/index-ZjDhAZOY.js +40 -0
- package/dist/spa/assets/index-uejPUBF0.js +23 -0
- package/dist/spa/assets/preview-2XsIwIad.js +1 -0
- package/dist/spa/index.html +4 -2
- package/dist/spa/preview.html +20 -0
- package/package.json +2 -2
- package/dist/spa/assets/index-BaCR0uUG.css +0 -1
- package/dist/spa/assets/index-D8irnyfw.js +0 -62
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
var kr=e=>{throw TypeError(e)};var Sn=(e,t,n)=>t.has(e)||kr("Cannot "+n);var ne=(e,t,n)=>(Sn(e,t,"read from private field"),n?n.call(e):t.get(e)),Be=(e,t,n)=>t.has(e)?kr("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Ve=(e,t,n,r)=>(Sn(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Oe=(e,t,n)=>(Sn(e,t,"access private method"),n);import{S as $a,s as Ia,h as Cr,g as za,n as As,u as rr,r as M,a as Aa,b as Ta,c as Rn,i as Ts,j as h,K as Hn,X as Ge,B as Ps,d as Pa,e as pt,R as Da,C as Ds,f as Ra,k as ue,l as Ha,m as La,o as sr,p as Fa,q as Ba,t as Va,P as Oa,v as kn,w as Xa,Q as Ya,x as qa,y as Wa}from"./index-ZjDhAZOY.js";var ze,Ae,oe,ye,Ne,Ft,Ln,zs,Ga=(zs=class extends $a{constructor(t,n){super();Be(this,Ne);Be(this,ze);Be(this,Ae);Be(this,oe);Be(this,ye);Ve(this,ze,t),this.setOptions(n),this.bindMethods(),Oe(this,Ne,Ft).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var r;const n=this.options;this.options=ne(this,ze).defaultMutationOptions(t),Ia(this.options,n)||ne(this,ze).getMutationCache().notify({type:"observerOptionsUpdated",mutation:ne(this,oe),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&Cr(n.mutationKey)!==Cr(this.options.mutationKey)?this.reset():((r=ne(this,oe))==null?void 0:r.state.status)==="pending"&&ne(this,oe).setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=ne(this,oe))==null||t.removeObserver(this)}onMutationUpdate(t){Oe(this,Ne,Ft).call(this),Oe(this,Ne,Ln).call(this,t)}getCurrentResult(){return ne(this,Ae)}reset(){var t;(t=ne(this,oe))==null||t.removeObserver(this),Ve(this,oe,void 0),Oe(this,Ne,Ft).call(this),Oe(this,Ne,Ln).call(this)}mutate(t,n){var r;return Ve(this,ye,n),(r=ne(this,oe))==null||r.removeObserver(this),Ve(this,oe,ne(this,ze).getMutationCache().build(ne(this,ze),this.options)),ne(this,oe).addObserver(this),ne(this,oe).execute(t)}},ze=new WeakMap,Ae=new WeakMap,oe=new WeakMap,ye=new WeakMap,Ne=new WeakSet,Ft=function(){var n;const t=((n=ne(this,oe))==null?void 0:n.state)??za();Ve(this,Ae,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},Ln=function(t){As.batch(()=>{var n,r,s,i,o,a,c,l;if(ne(this,ye)&&this.hasListeners()){const d=ne(this,Ae).variables,f=ne(this,Ae).context;(t==null?void 0:t.type)==="success"?((r=(n=ne(this,ye)).onSuccess)==null||r.call(n,t.data,d,f),(i=(s=ne(this,ye)).onSettled)==null||i.call(s,t.data,null,d,f)):(t==null?void 0:t.type)==="error"&&((a=(o=ne(this,ye)).onError)==null||a.call(o,t.error,d,f),(l=(c=ne(this,ye)).onSettled)==null||l.call(c,void 0,t.error,d,f))}this.listeners.forEach(d=>{d(ne(this,Ae))})})},zs);function lt(e,t){const n=rr(),[r]=M.useState(()=>new Ga(n,e));M.useEffect(()=>{r.setOptions(e)},[r,e]);const s=M.useSyncExternalStore(M.useCallback(o=>r.subscribe(As.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=M.useCallback((o,a)=>{r.mutate(o,a).catch(Aa)},[r]);if(s.error&&Ta(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:i,mutateAsync:s.mutate}}function Ka(e,t){if(!e)return t;const n=new Map(e.timeline.map(r=>[r.seq,r]));return{...t,timeline:t.timeline.map(r=>{var i,o;if((r.status==="pending"||r.status==="running")&&(((i=r.events)==null?void 0:i.length)??0)===0){const a=(o=n.get(r.seq))==null?void 0:o.events;if(a!=null&&a.length)return{...r,events:a}}return r})}}function Yt(e){return e<1e3?`${Math.round(e)}ms`:e<6e4?`${(e/1e3).toFixed(2)}s`:`${(e/6e4).toFixed(2)}m`}function jr(e,t){return Yt(new Date(t).getTime()-new Date(e).getTime())}function Mr(e){return ir(new Date(e).getTime())}function ir(e){return new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3})}const Rs={ok:"border-emerald-500/25 bg-emerald-500/10 text-emerald-300",failed:"border-red-500/25 bg-red-500/10 text-red-300",skipped:"border-amber-500/25 bg-amber-500/10 text-amber-300"},Ua={debug:"text-zinc-500",info:"text-zinc-300",warn:"text-amber-300",error:"text-red-300"},Za=["ok","failed","skipped"];function Hs({e}){return h.jsxs("div",{className:"flex gap-2 py-0.5",children:[h.jsx("span",{className:"shrink-0 text-zinc-600 tnum",children:ir(e.at)}),h.jsx("span",{className:`shrink-0 uppercase ${Ua[e.level]}`,children:e.level}),h.jsx("span",{className:"min-w-0 break-words text-zinc-300",children:e.message})]})}function $r({sub:e,showGroup:t=!0}){var a,c;const n=((a=e.terminal)==null?void 0:a.message)!==void 0&&e.terminal.message!==e.name,r=e.phases.length>0||e.logs.length>0||n,[s,i]=M.useState(e.status==="failed"),o=e.status?Rs[e.status]:"border-amber-500/25 bg-amber-500/10 text-amber-300";return h.jsxs("li",{className:`rounded-md border ${o}`,children:[h.jsxs("button",{type:"button",disabled:!r,onClick:()=>i(l=>!l),className:"flex w-full items-center justify-between gap-2 px-2.5 py-1.5 text-left text-[11.5px] disabled:cursor-default","aria-expanded":r?s:void 0,children:[h.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r&&h.jsx("span",{className:`text-[9px] text-zinc-500 transition-transform duration-150 ${s?"":"-rotate-90"}`,children:"▼"}),h.jsx("span",{className:"mono truncate text-zinc-200",children:e.name}),t&&e.group&&h.jsx("span",{className:"mono shrink-0 text-[10px] uppercase tracking-wider text-zinc-500",children:e.group})]}),h.jsxs("span",{className:"mono flex shrink-0 items-center gap-2 text-[10px] uppercase tracking-wider",children:[e.durationMs!==void 0&&h.jsx("span",{className:"tnum text-zinc-400",children:Yt(e.durationMs)}),h.jsx("span",{children:e.status??"running"})]})]}),s&&h.jsxs("div",{className:"border-t border-[var(--line)]/60 px-2.5 py-2",children:[e.phases.length>0&&h.jsx("ul",{className:"mono mb-2 flex flex-col gap-0.5 text-[10.5px]",children:e.phases.map((l,d)=>h.jsxs("li",{className:"flex gap-2",children:[h.jsx("span",{className:"shrink-0 text-zinc-600 tnum",children:ir(l.at)}),h.jsx("span",{className:"text-zinc-400",children:l.phase}),e.startedAt!==void 0&&h.jsxs("span",{className:"text-zinc-600 tnum",children:["+",Yt(l.at-e.startedAt)]})]},`${l.at}-${l.phase}-${d}`))}),((c=e.terminal)==null?void 0:c.message)&&e.terminal.message!==e.name&&h.jsx("div",{className:`mono mb-2 rounded border p-2 text-[11px] ${e.status==="failed"?"border-red-500/25 bg-red-500/10 text-red-200":"border-[var(--line)] bg-black/20 text-zinc-300"}`,children:e.terminal.message}),e.logs.length>0&&h.jsx("div",{className:"mono flex flex-col gap-0.5 text-[11px]",children:e.logs.map((l,d)=>h.jsx(Hs,{e:l},`${l.at}-${d}`))})]})]})}function Qa({events:e}){const{subs:t,stepLogs:n}=Pa(e),r=Za.map(i=>[i,t.filter(o=>o.status===i).length]).filter(([,i])=>i>0),s=t.some(i=>i.group);return h.jsxs(h.Fragment,{children:[t.length>0&&h.jsxs("section",{className:"rise",children:[h.jsxs("div",{className:"mb-1.5 flex items-center justify-between",children:[h.jsxs("span",{className:"mono text-[10px] uppercase tracking-[0.18em] text-zinc-500",children:["sub-processes · ",t.length]}),h.jsx("span",{className:"mono flex gap-2 text-[10px] uppercase tracking-wider",children:r.map(([i,o])=>h.jsxs("span",{className:Rs[i].split(" ").pop(),children:[o," ",i]},i))})]}),s?Object.entries(t.reduce((i,o)=>{const a=o.group??"—";return i[a]===void 0&&(i[a]=[]),i[a].push(o),i},{})).sort(([i],[o])=>i==="—"?1:o==="—"?-1:i.localeCompare(o)).map(([i,o])=>h.jsxs("div",{className:"mb-2",children:[h.jsx("div",{className:"mono mb-1 text-[10px] uppercase tracking-wider text-zinc-500",children:i}),h.jsx("ul",{className:"flex flex-col gap-1",children:o.map(a=>h.jsx($r,{sub:a,showGroup:!1},a.id))})]},i)):h.jsx("ul",{className:"flex flex-col gap-1",children:t.map(i=>h.jsx($r,{sub:i},i.id))})]}),n.length>0&&h.jsxs("section",{className:"rise",children:[h.jsxs("div",{className:"mono mb-1.5 text-[10px] uppercase tracking-[0.18em] text-zinc-500",children:["logs · ",n.length]}),h.jsx("div",{className:"mono max-h-64 overflow-auto rounded-lg border border-[var(--line)] bg-black/40 p-2.5 text-[11px] leading-relaxed",children:n.map((i,o)=>h.jsx(Hs,{e:i},`${i.at}-${o}`))})]})]})}function Ja({value:e}){const[t,n]=M.useState(!1);return h.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded border border-[var(--line)] px-1.5 py-0.5 text-[10px] uppercase tracking-wider text-zinc-500 transition-colors hover:text-zinc-200",onClick:async()=>{try{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1200)}catch{}},children:[t?h.jsx(Ds,{width:11,height:11}):h.jsx(Ra,{width:11,height:11}),t?"copied":"copy"]})}function qt({label:e,value:t}){const n=typeof t=="string"?t:JSON.stringify(t,null,2);return h.jsxs("section",{className:"rise",children:[h.jsxs("div",{className:"mb-1.5 flex items-center justify-between",children:[h.jsx("span",{className:"mono text-[10px] uppercase tracking-[0.18em] text-zinc-500",children:e}),h.jsx(Ja,{value:n})]}),h.jsx("pre",{className:"mono max-h-64 overflow-auto rounded-lg border border-[var(--line)] bg-black/40 p-3 text-[11.5px] leading-relaxed text-zinc-300",children:n})]})}function Ce({k:e,v:t,mono:n=!0}){return h.jsxs("div",{className:"flex items-baseline justify-between gap-3 py-1.5",children:[h.jsx("span",{className:"mono shrink-0 text-[10px] uppercase tracking-[0.16em] text-zinc-600",children:e}),h.jsx("span",{className:`truncate text-right text-[12px] text-zinc-200 ${n?"mono tnum":""}`,children:t})]})}function ec({id:e,onOpenRun:t}){const{data:n}=pt({queryKey:["run",e],queryFn:()=>ue.run(e)}),[r,s]=M.useState(new Set),i=o=>s(a=>{const c=new Set(a);return c.has(o)?c.delete(o):c.add(o),c});return n?n.timeline.length===0?h.jsxs("div",{className:"mono px-2 py-2 text-[10px] text-zinc-600",children:["no steps recorded yet — child ",n.run.status]}):h.jsx("div",{className:"mt-2 max-h-80 space-y-1 overflow-auto rounded-md border border-[var(--line)] bg-black/20 p-1.5",children:h.jsx(Da,{run:n.run,timeline:n.timeline,depth:0,onSelect:()=>{},onOpenRun:t??(()=>{}),expanded:r,onToggleChild:i})}):h.jsx("div",{className:"mono px-2 py-2 text-[10px] text-zinc-600",children:"loading child run…"})}function tc({step:e,run:t,onClose:n,onOpenRun:r}){const s=Rn(e),[i,o]=M.useState(!1),a=e.status==="failed",c=e.status==="pending"||e.status==="running",l=Ts(e.kind),d=jr(t.createdAt,e.startedAt),f=e.enqueuedAt?new Date(e.startedAt).getTime()-new Date(e.enqueuedAt).getTime():0;return h.jsxs("aside",{className:"absolute inset-y-0 right-0 z-20 flex w-[380px] max-w-[90%] flex-col border-l border-[var(--line)] bg-[var(--panel)]/95 shadow-2xl backdrop-blur-md rise",children:[h.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-[var(--line)] px-5 py-4",children:[h.jsxs("div",{className:"min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:`grid h-6 w-6 shrink-0 place-items-center rounded-md ${a?"bg-red-500/15 text-red-300":c?"bg-amber-500/15 text-amber-300":"bg-emerald-500/15 text-emerald-300"}`,children:h.jsx(l,{width:13,height:13})}),h.jsx("h3",{className:"truncate text-[15px] font-semibold tracking-tight text-zinc-50",children:e.name})]}),h.jsxs("div",{className:`mono mt-1 text-[11px] uppercase tracking-wider s-${e.status}`,children:[e.status," · ",Hn[e.kind]??e.kind]})]}),h.jsx("button",{type:"button",onClick:n,className:"grid h-7 w-7 shrink-0 place-items-center rounded-md border border-[var(--line)] text-zinc-500 transition-colors hover:text-zinc-200","aria-label":"Close",children:h.jsx(Ge,{})})]}),h.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-4 overflow-auto px-5 py-4",children:[h.jsxs("div",{className:"rounded-lg border border-[var(--line)] bg-black/20 px-3.5 py-1",children:[h.jsx(Ce,{k:"seq",v:`#${e.seq}`}),f>=1&&h.jsx(Ce,{k:"queued",v:h.jsx("span",{className:"text-sky-300",children:Yt(f)})}),h.jsx(Ce,{k:"duration",v:c?h.jsx("span",{className:"text-amber-300",children:"running…"}):jr(e.startedAt,e.finishedAt)}),h.jsx(Ce,{k:"attempts",v:h.jsxs("span",{className:e.attempts>1?"text-amber-300":"",children:[e.attempts>1&&h.jsx(Ps,{width:11,height:11,className:"mr-1 inline"}),e.attempts]})}),e.workerGroup&&h.jsx(Ce,{k:"worker",v:`@${e.workerGroup}`}),h.jsx(Ce,{k:"started",v:Mr(e.startedAt)}),h.jsx(Ce,{k:"finished",v:Mr(e.finishedAt)}),h.jsx(Ce,{k:"offset",v:`+${d}`})]}),a&&e.error&&h.jsxs("section",{className:"rise",children:[h.jsx("div",{className:"mono mb-1.5 text-[10px] uppercase tracking-[0.18em] text-red-400/80",children:"error"}),h.jsx("div",{className:"mono rounded-lg border border-red-500/25 bg-red-500/10 p-3 text-[11.5px] leading-relaxed text-red-200",children:e.error.message})]}),e.events&&e.events.length>0&&h.jsx(Qa,{events:e.events}),s&&h.jsxs("section",{className:"rise",children:[h.jsxs("div",{className:"mb-1.5 flex items-center justify-between",children:[h.jsx("span",{className:"mono text-[10px] uppercase tracking-[0.18em] text-zinc-500",children:"child run"}),r&&h.jsx("button",{type:"button",onClick:()=>r(s),className:"mono rounded border border-[var(--line)] px-1.5 py-0.5 text-[10px] uppercase tracking-wider text-zinc-500 transition-colors hover:text-zinc-200",children:"open ↗"})]}),h.jsxs("button",{type:"button",onClick:()=>o(u=>!u),className:"flex w-full items-center gap-2 rounded-md border border-indigo-500/30 bg-indigo-500/10 px-2.5 py-1.5 text-left transition-colors hover:bg-indigo-500/20",title:i?"Collapse child run":"Expand child run inline",children:[h.jsx("span",{className:"inline-block text-[9px] text-indigo-300 transition-transform",style:{transform:i?"rotate(90deg)":"rotate(0deg)"},children:"▸"}),h.jsx("span",{className:"mono truncate text-[11px] text-indigo-300",children:s})]}),i&&h.jsx(ec,{id:s,onOpenRun:r})]}),e.input!==void 0&&h.jsx(qt,{label:"input",value:e.input}),e.output!==void 0&&h.jsx(qt,{label:"output",value:e.output})]})]})}function nc({run:e,onClose:t}){const n=e.input===void 0&&e.output===void 0&&!e.error;return h.jsxs("aside",{className:"absolute inset-y-0 right-0 z-30 flex w-[380px] max-w-[90%] flex-col border-l border-[var(--line)] bg-[var(--panel)]/95 shadow-2xl backdrop-blur-md rise",children:[h.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-[var(--line)] px-5 py-4",children:[h.jsxs("div",{className:"min-w-0",children:[h.jsx("h3",{className:"truncate text-[15px] font-semibold tracking-tight text-zinc-50",children:e.workflow}),h.jsxs("div",{className:`mono mt-1 text-[11px] uppercase tracking-wider s-${e.status}`,children:["run · ",e.status]})]}),h.jsx("button",{type:"button",onClick:t,className:"grid h-7 w-7 shrink-0 place-items-center rounded-md border border-[var(--line)] text-zinc-500 transition-colors hover:text-zinc-200","aria-label":"Close",children:h.jsx(Ge,{})})]}),h.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-4 overflow-auto px-5 py-4",children:[e.error&&h.jsxs("section",{className:"rise",children:[h.jsx("div",{className:"mono mb-1.5 text-[10px] uppercase tracking-[0.18em] text-red-400/80",children:"error"}),h.jsx("div",{className:"mono rounded-lg border border-red-500/25 bg-red-500/10 p-3 text-[11.5px] leading-relaxed text-red-200",children:e.error.message})]}),e.input!==void 0&&h.jsx(qt,{label:"input",value:e.input}),e.output!==void 0&&h.jsx(qt,{label:"output",value:e.output}),n&&h.jsx("div",{className:"text-sm text-zinc-600",children:"No input/output recorded."})]})]})}function se(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=se(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var rc={value:()=>{}};function rn(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Bt(n)}function Bt(e){this._=e}function sc(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",s=n.indexOf(".");if(s>=0&&(r=n.slice(s+1),n=n.slice(0,s)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Bt.prototype=rn.prototype={constructor:Bt,on:function(e,t){var n=this._,r=sc(e+"",n),s,i=-1,o=r.length;if(arguments.length<2){for(;++i<o;)if((s=(e=r[i]).type)&&(s=ic(n[s],e.name)))return s;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<o;)if(s=(e=r[i]).type)n[s]=Ir(n[s],e.name,t);else if(t==null)for(s in n)n[s]=Ir(n[s],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Bt(e)},call:function(e,t){if((s=arguments.length-2)>0)for(var n=new Array(s),r=0,s,i;r<s;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,s=i.length;r<s;++r)i[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],s=0,i=r.length;s<i;++s)r[s].value.apply(t,n)}};function ic(e,t){for(var n=0,r=e.length,s;n<r;++n)if((s=e[n]).name===t)return s.value}function Ir(e,t,n){for(var r=0,s=e.length;r<s;++r)if(e[r].name===t){e[r]=rc,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Fn="http://www.w3.org/1999/xhtml";const zr={svg:"http://www.w3.org/2000/svg",xhtml:Fn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function sn(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),zr.hasOwnProperty(t)?{space:zr[t],local:e}:e}function oc(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Fn&&t.documentElement.namespaceURI===Fn?t.createElement(e):t.createElementNS(n,e)}}function ac(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ls(e){var t=sn(e);return(t.local?ac:oc)(t)}function cc(){}function or(e){return e==null?cc:function(){return this.querySelector(e)}}function lc(e){typeof e!="function"&&(e=or(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],o=i.length,a=r[s]=new Array(o),c,l,d=0;d<o;++d)(c=i[d])&&(l=e.call(c,c.__data__,d,i))&&("__data__"in c&&(l.__data__=c.__data__),a[d]=l);return new le(r,this._parents)}function uc(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function dc(){return[]}function Fs(e){return e==null?dc:function(){return this.querySelectorAll(e)}}function fc(e){return function(){return uc(e.apply(this,arguments))}}function hc(e){typeof e=="function"?e=fc(e):e=Fs(e);for(var t=this._groups,n=t.length,r=[],s=[],i=0;i<n;++i)for(var o=t[i],a=o.length,c,l=0;l<a;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),s.push(c));return new le(r,s)}function Bs(e){return function(){return this.matches(e)}}function Vs(e){return function(t){return t.matches(e)}}var pc=Array.prototype.find;function gc(e){return function(){return pc.call(this.children,e)}}function mc(){return this.firstElementChild}function xc(e){return this.select(e==null?mc:gc(typeof e=="function"?e:Vs(e)))}var yc=Array.prototype.filter;function wc(){return Array.from(this.children)}function vc(e){return function(){return yc.call(this.children,e)}}function bc(e){return this.selectAll(e==null?wc:vc(typeof e=="function"?e:Vs(e)))}function Nc(e){typeof e!="function"&&(e=Bs(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],o=i.length,a=r[s]=[],c,l=0;l<o;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new le(r,this._parents)}function Os(e){return new Array(e.length)}function _c(){return new le(this._enter||this._groups.map(Os),this._parents)}function Wt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Wt.prototype={constructor:Wt,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 Ec(e){return function(){return e}}function Sc(e,t,n,r,s,i){for(var o=0,a,c=t.length,l=i.length;o<l;++o)(a=t[o])?(a.__data__=i[o],r[o]=a):n[o]=new Wt(e,i[o]);for(;o<c;++o)(a=t[o])&&(s[o]=a)}function kc(e,t,n,r,s,i,o){var a,c,l=new Map,d=t.length,f=i.length,u=new Array(d),p;for(a=0;a<d;++a)(c=t[a])&&(u[a]=p=o.call(c,c.__data__,a,t)+"",l.has(p)?s[a]=c:l.set(p,c));for(a=0;a<f;++a)p=o.call(e,i[a],a,i)+"",(c=l.get(p))?(r[a]=c,c.__data__=i[a],l.delete(p)):n[a]=new Wt(e,i[a]);for(a=0;a<d;++a)(c=t[a])&&l.get(u[a])===c&&(s[a]=c)}function Cc(e){return e.__data__}function jc(e,t){if(!arguments.length)return Array.from(this,Cc);var n=t?kc:Sc,r=this._parents,s=this._groups;typeof e!="function"&&(e=Ec(e));for(var i=s.length,o=new Array(i),a=new Array(i),c=new Array(i),l=0;l<i;++l){var d=r[l],f=s[l],u=f.length,p=Mc(e.call(d,d&&d.__data__,l,r)),g=p.length,m=a[l]=new Array(g),N=o[l]=new Array(g),y=c[l]=new Array(u);n(d,f,m,N,y,p,t);for(var E=0,v=0,w,j;E<g;++E)if(w=m[E]){for(E>=v&&(v=E+1);!(j=N[v])&&++v<g;);w._next=j||null}}return o=new le(o,r),o._enter=a,o._exit=c,o}function Mc(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function $c(){return new le(this._exit||this._groups.map(Os),this._parents)}function Ic(e,t,n){var r=this.enter(),s=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(s=t(s),s&&(s=s.selection())),n==null?i.remove():n(i),r&&s?r.merge(s).order():s}function zc(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,s=n.length,i=r.length,o=Math.min(s,i),a=new Array(s),c=0;c<o;++c)for(var l=n[c],d=r[c],f=l.length,u=a[c]=new Array(f),p,g=0;g<f;++g)(p=l[g]||d[g])&&(u[g]=p);for(;c<s;++c)a[c]=n[c];return new le(a,this._parents)}function Ac(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],s=r.length-1,i=r[s],o;--s>=0;)(o=r[s])&&(i&&o.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(o,i),i=o);return this}function Tc(e){e||(e=Pc);function t(f,u){return f&&u?e(f.__data__,u.__data__):!f-!u}for(var n=this._groups,r=n.length,s=new Array(r),i=0;i<r;++i){for(var o=n[i],a=o.length,c=s[i]=new Array(a),l,d=0;d<a;++d)(l=o[d])&&(c[d]=l);c.sort(t)}return new le(s,this._parents).order()}function Pc(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Dc(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Rc(){return Array.from(this)}function Hc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,i=r.length;s<i;++s){var o=r[s];if(o)return o}return null}function Lc(){let e=0;for(const t of this)++e;return e}function Fc(){return!this.node()}function Bc(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var s=t[n],i=0,o=s.length,a;i<o;++i)(a=s[i])&&e.call(a,a.__data__,i,s);return this}function Vc(e){return function(){this.removeAttribute(e)}}function Oc(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Xc(e,t){return function(){this.setAttribute(e,t)}}function Yc(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function qc(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Wc(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 Gc(e,t){var n=sn(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?Oc:Vc:typeof t=="function"?n.local?Wc:qc:n.local?Yc:Xc)(n,t))}function Xs(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Kc(e){return function(){this.style.removeProperty(e)}}function Uc(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Zc(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function Qc(e,t,n){return arguments.length>1?this.each((t==null?Kc:typeof t=="function"?Zc:Uc)(e,t,n??"")):Ke(this.node(),e)}function Ke(e,t){return e.style.getPropertyValue(t)||Xs(e).getComputedStyle(e,null).getPropertyValue(t)}function Jc(e){return function(){delete this[e]}}function el(e,t){return function(){this[e]=t}}function tl(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function nl(e,t){return arguments.length>1?this.each((t==null?Jc:typeof t=="function"?tl:el)(e,t)):this.node()[e]}function Ys(e){return e.trim().split(/^|\s+/)}function ar(e){return e.classList||new qs(e)}function qs(e){this._node=e,this._names=Ys(e.getAttribute("class")||"")}qs.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 Ws(e,t){for(var n=ar(e),r=-1,s=t.length;++r<s;)n.add(t[r])}function Gs(e,t){for(var n=ar(e),r=-1,s=t.length;++r<s;)n.remove(t[r])}function rl(e){return function(){Ws(this,e)}}function sl(e){return function(){Gs(this,e)}}function il(e,t){return function(){(t.apply(this,arguments)?Ws:Gs)(this,e)}}function ol(e,t){var n=Ys(e+"");if(arguments.length<2){for(var r=ar(this.node()),s=-1,i=n.length;++s<i;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof t=="function"?il:t?rl:sl)(n,t))}function al(){this.textContent=""}function cl(e){return function(){this.textContent=e}}function ll(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function ul(e){return arguments.length?this.each(e==null?al:(typeof e=="function"?ll:cl)(e)):this.node().textContent}function dl(){this.innerHTML=""}function fl(e){return function(){this.innerHTML=e}}function hl(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function pl(e){return arguments.length?this.each(e==null?dl:(typeof e=="function"?hl:fl)(e)):this.node().innerHTML}function gl(){this.nextSibling&&this.parentNode.appendChild(this)}function ml(){return this.each(gl)}function xl(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function yl(){return this.each(xl)}function wl(e){var t=typeof e=="function"?e:Ls(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function vl(){return null}function bl(e,t){var n=typeof e=="function"?e:Ls(e),r=t==null?vl:typeof t=="function"?t:or(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Nl(){var e=this.parentNode;e&&e.removeChild(this)}function _l(){return this.each(Nl)}function El(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Sl(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function kl(e){return this.select(e?Sl:El)}function Cl(e){return arguments.length?this.property("__data__",e):this.node().__data__}function jl(e){return function(t){e.call(this,t,this.__data__)}}function Ml(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function $l(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,s=t.length,i;n<s;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function Il(e,t,n){return function(){var r=this.__on,s,i=jl(t);if(r){for(var o=0,a=r.length;o<a;++o)if((s=r[o]).type===e.type&&s.name===e.name){this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=i,s.options=n),s.value=t;return}}this.addEventListener(e.type,i,n),s={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(s):this.__on=[s]}}function zl(e,t,n){var r=Ml(e+""),s,i=r.length,o;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,d;c<l;++c)for(s=0,d=a[c];s<i;++s)if((o=r[s]).type===d.type&&o.name===d.name)return d.value}return}for(a=t?Il:$l,s=0;s<i;++s)this.each(a(r[s],t,n));return this}function Ks(e,t,n){var r=Xs(e),s=r.CustomEvent;typeof s=="function"?s=new s(t,n):(s=r.document.createEvent("Event"),n?(s.initEvent(t,n.bubbles,n.cancelable),s.detail=n.detail):s.initEvent(t,!1,!1)),e.dispatchEvent(s)}function Al(e,t){return function(){return Ks(this,e,t)}}function Tl(e,t){return function(){return Ks(this,e,t.apply(this,arguments))}}function Pl(e,t){return this.each((typeof t=="function"?Tl:Al)(e,t))}function*Dl(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,i=r.length,o;s<i;++s)(o=r[s])&&(yield o)}var Us=[null];function le(e,t){this._groups=e,this._parents=t}function St(){return new le([[document.documentElement]],Us)}function Rl(){return this}le.prototype=St.prototype={constructor:le,select:lc,selectAll:hc,selectChild:xc,selectChildren:bc,filter:Nc,data:jc,enter:_c,exit:$c,join:Ic,merge:zc,selection:Rl,order:Ac,sort:Tc,call:Dc,nodes:Rc,node:Hc,size:Lc,empty:Fc,each:Bc,attr:Gc,style:Qc,property:nl,classed:ol,text:ul,html:pl,raise:ml,lower:yl,append:wl,insert:bl,remove:_l,clone:kl,datum:Cl,on:zl,dispatch:Pl,[Symbol.iterator]:Dl};function ce(e){return typeof e=="string"?new le([[document.querySelector(e)]],[document.documentElement]):new le([[e]],Us)}function Hl(e){let t;for(;t=e.sourceEvent;)e=t;return e}function de(e,t){if(e=Hl(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}}return[e.pageX,e.pageY]}const Ll={passive:!1},gt={capture:!0,passive:!1};function Cn(e){e.stopImmediatePropagation()}function qe(e){e.preventDefault(),e.stopImmediatePropagation()}function Zs(e){var t=e.document.documentElement,n=ce(e).on("dragstart.drag",qe,gt);"onselectstart"in t?n.on("selectstart.drag",qe,gt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Qs(e,t){var n=e.document.documentElement,r=ce(e).on("dragstart.drag",null);t&&(r.on("click.drag",qe,gt),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const It=e=>()=>e;function Bn(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:i,x:o,y:a,dx:c,dy:l,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:d}})}Bn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Fl(e){return!e.ctrlKey&&!e.button}function Bl(){return this.parentNode}function Vl(e,t){return t??{x:e.x,y:e.y}}function Ol(){return navigator.maxTouchPoints||"ontouchstart"in this}function Js(){var e=Fl,t=Bl,n=Vl,r=Ol,s={},i=rn("start","drag","end"),o=0,a,c,l,d,f=0;function u(w){w.on("mousedown.drag",p).filter(r).on("touchstart.drag",N).on("touchmove.drag",y,Ll).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(w,j){if(!(d||!e.call(this,w,j))){var R=v(this,t.call(this,w,j),w,j,"mouse");R&&(ce(w.view).on("mousemove.drag",g,gt).on("mouseup.drag",m,gt),Zs(w.view),Cn(w),l=!1,a=w.clientX,c=w.clientY,R("start",w))}}function g(w){if(qe(w),!l){var j=w.clientX-a,R=w.clientY-c;l=j*j+R*R>f}s.mouse("drag",w)}function m(w){ce(w.view).on("mousemove.drag mouseup.drag",null),Qs(w.view,l),qe(w),s.mouse("end",w)}function N(w,j){if(e.call(this,w,j)){var R=w.changedTouches,C=t.call(this,w,j),$=R.length,A,P;for(A=0;A<$;++A)(P=v(this,C,w,j,R[A].identifier,R[A]))&&(Cn(w),P("start",w,R[A]))}}function y(w){var j=w.changedTouches,R=j.length,C,$;for(C=0;C<R;++C)($=s[j[C].identifier])&&(qe(w),$("drag",w,j[C]))}function E(w){var j=w.changedTouches,R=j.length,C,$;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),C=0;C<R;++C)($=s[j[C].identifier])&&(Cn(w),$("end",w,j[C]))}function v(w,j,R,C,$,A){var P=i.copy(),L=de(A||R,j),T,D,x;if((x=n.call(w,new Bn("beforestart",{sourceEvent:R,target:u,identifier:$,active:o,x:L[0],y:L[1],dx:0,dy:0,dispatch:P}),C))!=null)return T=x.x-L[0]||0,D=x.y-L[1]||0,function k(_,I,b){var S=L,z;switch(_){case"start":s[$]=k,z=o++;break;case"end":delete s[$],--o;case"drag":L=de(b||I,j),z=o;break}P.call(_,w,new Bn(_,{sourceEvent:I,subject:x,target:u,identifier:$,active:z,x:L[0]+T,y:L[1]+D,dx:L[0]-S[0],dy:L[1]-S[1],dispatch:P}),C)}}return u.filter=function(w){return arguments.length?(e=typeof w=="function"?w:It(!!w),u):e},u.container=function(w){return arguments.length?(t=typeof w=="function"?w:It(w),u):t},u.subject=function(w){return arguments.length?(n=typeof w=="function"?w:It(w),u):n},u.touchable=function(w){return arguments.length?(r=typeof w=="function"?w:It(!!w),u):r},u.on=function(){var w=i.on.apply(i,arguments);return w===i?u:w},u.clickDistance=function(w){return arguments.length?(f=(w=+w)*w,u):Math.sqrt(f)},u}function cr(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function ei(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function kt(){}var mt=.7,Gt=1/mt,We="\\s*([+-]?\\d+)\\s*",xt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ge="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Xl=/^#([0-9a-f]{3,8})$/,Yl=new RegExp(`^rgb\\(${We},${We},${We}\\)$`),ql=new RegExp(`^rgb\\(${ge},${ge},${ge}\\)$`),Wl=new RegExp(`^rgba\\(${We},${We},${We},${xt}\\)$`),Gl=new RegExp(`^rgba\\(${ge},${ge},${ge},${xt}\\)$`),Kl=new RegExp(`^hsl\\(${xt},${ge},${ge}\\)$`),Ul=new RegExp(`^hsla\\(${xt},${ge},${ge},${xt}\\)$`),Ar={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};cr(kt,yt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Tr,formatHex:Tr,formatHex8:Zl,formatHsl:Ql,formatRgb:Pr,toString:Pr});function Tr(){return this.rgb().formatHex()}function Zl(){return this.rgb().formatHex8()}function Ql(){return ti(this).formatHsl()}function Pr(){return this.rgb().formatRgb()}function yt(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Xl.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Dr(t):n===3?new ae(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?zt(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?zt(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=Yl.exec(e))?new ae(t[1],t[2],t[3],1):(t=ql.exec(e))?new ae(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Wl.exec(e))?zt(t[1],t[2],t[3],t[4]):(t=Gl.exec(e))?zt(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Kl.exec(e))?Lr(t[1],t[2]/100,t[3]/100,1):(t=Ul.exec(e))?Lr(t[1],t[2]/100,t[3]/100,t[4]):Ar.hasOwnProperty(e)?Dr(Ar[e]):e==="transparent"?new ae(NaN,NaN,NaN,0):null}function Dr(e){return new ae(e>>16&255,e>>8&255,e&255,1)}function zt(e,t,n,r){return r<=0&&(e=t=n=NaN),new ae(e,t,n,r)}function Jl(e){return e instanceof kt||(e=yt(e)),e?(e=e.rgb(),new ae(e.r,e.g,e.b,e.opacity)):new ae}function Vn(e,t,n,r){return arguments.length===1?Jl(e):new ae(e,t,n,r??1)}function ae(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}cr(ae,Vn,ei(kt,{brighter(e){return e=e==null?Gt:Math.pow(Gt,e),new ae(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?mt:Math.pow(mt,e),new ae(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ae(Re(this.r),Re(this.g),Re(this.b),Kt(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:Rr,formatHex:Rr,formatHex8:eu,formatRgb:Hr,toString:Hr}));function Rr(){return`#${De(this.r)}${De(this.g)}${De(this.b)}`}function eu(){return`#${De(this.r)}${De(this.g)}${De(this.b)}${De((isNaN(this.opacity)?1:this.opacity)*255)}`}function Hr(){const e=Kt(this.opacity);return`${e===1?"rgb(":"rgba("}${Re(this.r)}, ${Re(this.g)}, ${Re(this.b)}${e===1?")":`, ${e})`}`}function Kt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Re(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function De(e){return e=Re(e),(e<16?"0":"")+e.toString(16)}function Lr(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new fe(e,t,n,r)}function ti(e){if(e instanceof fe)return new fe(e.h,e.s,e.l,e.opacity);if(e instanceof kt||(e=yt(e)),!e)return new fe;if(e instanceof fe)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),i=Math.max(t,n,r),o=NaN,a=i-s,c=(i+s)/2;return a?(t===i?o=(n-r)/a+(n<r)*6:n===i?o=(r-t)/a+2:o=(t-n)/a+4,a/=c<.5?i+s:2-i-s,o*=60):a=c>0&&c<1?0:o,new fe(o,a,c,e.opacity)}function tu(e,t,n,r){return arguments.length===1?ti(e):new fe(e,t,n,r??1)}function fe(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}cr(fe,tu,ei(kt,{brighter(e){return e=e==null?Gt:Math.pow(Gt,e),new fe(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?mt:Math.pow(mt,e),new fe(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,r=n+(n<.5?n:1-n)*t,s=2*n-r;return new ae(jn(e>=240?e-240:e+120,s,r),jn(e,s,r),jn(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new fe(Fr(this.h),At(this.s),At(this.l),Kt(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=Kt(this.opacity);return`${e===1?"hsl(":"hsla("}${Fr(this.h)}, ${At(this.s)*100}%, ${At(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Fr(e){return e=(e||0)%360,e<0?e+360:e}function At(e){return Math.max(0,Math.min(1,e||0))}function jn(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const ni=e=>()=>e;function nu(e,t){return function(n){return e+n*t}}function ru(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function su(e){return(e=+e)==1?ri:function(t,n){return n-t?ru(t,n,e):ni(isNaN(t)?n:t)}}function ri(e,t){var n=t-e;return n?nu(e,n):ni(isNaN(e)?t:e)}const Br=function e(t){var n=su(t);function r(s,i){var o=n((s=Vn(s)).r,(i=Vn(i)).r),a=n(s.g,i.g),c=n(s.b,i.b),l=ri(s.opacity,i.opacity);return function(d){return s.r=o(d),s.g=a(d),s.b=c(d),s.opacity=l(d),s+""}}return r.gamma=e,r}(1);function $e(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var On=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Mn=new RegExp(On.source,"g");function iu(e){return function(){return e}}function ou(e){return function(t){return e(t)+""}}function au(e,t){var n=On.lastIndex=Mn.lastIndex=0,r,s,i,o=-1,a=[],c=[];for(e=e+"",t=t+"";(r=On.exec(e))&&(s=Mn.exec(t));)(i=s.index)>n&&(i=t.slice(n,i),a[o]?a[o]+=i:a[++o]=i),(r=r[0])===(s=s[0])?a[o]?a[o]+=s:a[++o]=s:(a[++o]=null,c.push({i:o,x:$e(r,s)})),n=Mn.lastIndex;return n<t.length&&(i=t.slice(n),a[o]?a[o]+=i:a[++o]=i),a.length<2?c[0]?ou(c[0].x):iu(t):(t=c.length,function(l){for(var d=0,f;d<t;++d)a[(f=c[d]).i]=f.x(l);return a.join("")})}var Vr=180/Math.PI,Xn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function si(e,t,n,r,s,i){var o,a,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:s,translateY:i,rotate:Math.atan2(t,e)*Vr,skewX:Math.atan(c)*Vr,scaleX:o,scaleY:a}}var Tt;function cu(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Xn:si(t.a,t.b,t.c,t.d,t.e,t.f)}function lu(e){return e==null||(Tt||(Tt=document.createElementNS("http://www.w3.org/2000/svg","g")),Tt.setAttribute("transform",e),!(e=Tt.transform.baseVal.consolidate()))?Xn:(e=e.matrix,si(e.a,e.b,e.c,e.d,e.e,e.f))}function ii(e,t,n,r){function s(l){return l.length?l.pop()+" ":""}function i(l,d,f,u,p,g){if(l!==f||d!==u){var m=p.push("translate(",null,t,null,n);g.push({i:m-4,x:$e(l,f)},{i:m-2,x:$e(d,u)})}else(f||u)&&p.push("translate("+f+t+u+n)}function o(l,d,f,u){l!==d?(l-d>180?d+=360:d-l>180&&(l+=360),u.push({i:f.push(s(f)+"rotate(",null,r)-2,x:$e(l,d)})):d&&f.push(s(f)+"rotate("+d+r)}function a(l,d,f,u){l!==d?u.push({i:f.push(s(f)+"skewX(",null,r)-2,x:$e(l,d)}):d&&f.push(s(f)+"skewX("+d+r)}function c(l,d,f,u,p,g){if(l!==f||d!==u){var m=p.push(s(p)+"scale(",null,",",null,")");g.push({i:m-4,x:$e(l,f)},{i:m-2,x:$e(d,u)})}else(f!==1||u!==1)&&p.push(s(p)+"scale("+f+","+u+")")}return function(l,d){var f=[],u=[];return l=e(l),d=e(d),i(l.translateX,l.translateY,d.translateX,d.translateY,f,u),o(l.rotate,d.rotate,f,u),a(l.skewX,d.skewX,f,u),c(l.scaleX,l.scaleY,d.scaleX,d.scaleY,f,u),l=d=null,function(p){for(var g=-1,m=u.length,N;++g<m;)f[(N=u[g]).i]=N.x(p);return f.join("")}}}var uu=ii(cu,"px, ","px)","deg)"),du=ii(lu,", ",")",")"),fu=1e-12;function Or(e){return((e=Math.exp(e))+1/e)/2}function hu(e){return((e=Math.exp(e))-1/e)/2}function pu(e){return((e=Math.exp(2*e))-1)/(e+1)}const gu=function e(t,n,r){function s(i,o){var a=i[0],c=i[1],l=i[2],d=o[0],f=o[1],u=o[2],p=d-a,g=f-c,m=p*p+g*g,N,y;if(m<fu)y=Math.log(u/l)/t,N=function(C){return[a+C*p,c+C*g,l*Math.exp(t*C*y)]};else{var E=Math.sqrt(m),v=(u*u-l*l+r*m)/(2*l*n*E),w=(u*u-l*l-r*m)/(2*u*n*E),j=Math.log(Math.sqrt(v*v+1)-v),R=Math.log(Math.sqrt(w*w+1)-w);y=(R-j)/t,N=function(C){var $=C*y,A=Or(j),P=l/(n*E)*(A*pu(t*$+j)-hu(j));return[a+P*p,c+P*g,l*A/Or(t*$+j)]}}return N.duration=y*1e3*t/Math.SQRT2,N}return s.rho=function(i){var o=Math.max(.001,+i),a=o*o,c=a*a;return e(o,a,c)},s}(Math.SQRT2,2,4);var Ue=0,ut=0,at=0,oi=1e3,Ut,dt,Zt=0,Le=0,on=0,wt=typeof performance=="object"&&performance.now?performance:Date,ai=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function lr(){return Le||(ai(mu),Le=wt.now()+on)}function mu(){Le=0}function Qt(){this._call=this._time=this._next=null}Qt.prototype=ci.prototype={constructor:Qt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?lr():+n)+(t==null?0:+t),!this._next&&dt!==this&&(dt?dt._next=this:Ut=this,dt=this),this._call=e,this._time=n,Yn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Yn())}};function ci(e,t,n){var r=new Qt;return r.restart(e,t,n),r}function xu(){lr(),++Ue;for(var e=Ut,t;e;)(t=Le-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ue}function Xr(){Le=(Zt=wt.now())+on,Ue=ut=0;try{xu()}finally{Ue=0,wu(),Le=0}}function yu(){var e=wt.now(),t=e-Zt;t>oi&&(on-=t,Zt=e)}function wu(){for(var e,t=Ut,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Ut=n);dt=e,Yn(r)}function Yn(e){if(!Ue){ut&&(ut=clearTimeout(ut));var t=e-Le;t>24?(e<1/0&&(ut=setTimeout(Xr,e-wt.now()-on)),at&&(at=clearInterval(at))):(at||(Zt=wt.now(),at=setInterval(yu,oi)),Ue=1,ai(Xr))}}function Yr(e,t,n){var r=new Qt;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var vu=rn("start","end","cancel","interrupt"),bu=[],li=0,qr=1,qn=2,Vt=3,Wr=4,Wn=5,Ot=6;function an(e,t,n,r,s,i){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;Nu(e,n,{name:t,index:r,group:s,on:vu,tween:bu,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:li})}function ur(e,t){var n=pe(e,t);if(n.state>li)throw new Error("too late; already scheduled");return n}function me(e,t){var n=pe(e,t);if(n.state>Vt)throw new Error("too late; already running");return n}function pe(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Nu(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=ci(i,0,n.time);function i(l){n.state=qr,n.timer.restart(o,n.delay,n.time),n.delay<=l&&o(l-n.delay)}function o(l){var d,f,u,p;if(n.state!==qr)return c();for(d in r)if(p=r[d],p.name===n.name){if(p.state===Vt)return Yr(o);p.state===Wr?(p.state=Ot,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete r[d]):+d<t&&(p.state=Ot,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete r[d])}if(Yr(function(){n.state===Vt&&(n.state=Wr,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=qn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===qn){for(n.state=Vt,s=new Array(u=n.tween.length),d=0,f=-1;d<u;++d)(p=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(s[++f]=p);s.length=f+1}}function a(l){for(var d=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=Wn,1),f=-1,u=s.length;++f<u;)s[f].call(e,d);n.state===Wn&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Ot,n.timer.stop(),delete r[t];for(var l in r)return;delete e.__transition}}function Xt(e,t){var n=e.__transition,r,s,i=!0,o;if(n){t=t==null?null:t+"";for(o in n){if((r=n[o]).name!==t){i=!1;continue}s=r.state>qn&&r.state<Wn,r.state=Ot,r.timer.stop(),r.on.call(s?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[o]}i&&delete e.__transition}}function _u(e){return this.each(function(){Xt(this,e)})}function Eu(e,t){var n,r;return function(){var s=me(this,e),i=s.tween;if(i!==n){r=n=i;for(var o=0,a=r.length;o<a;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}s.tween=r}}function Su(e,t,n){var r,s;if(typeof n!="function")throw new Error;return function(){var i=me(this,e),o=i.tween;if(o!==r){s=(r=o).slice();for(var a={name:t,value:n},c=0,l=s.length;c<l;++c)if(s[c].name===t){s[c]=a;break}c===l&&s.push(a)}i.tween=s}}function ku(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=pe(this.node(),n).tween,s=0,i=r.length,o;s<i;++s)if((o=r[s]).name===e)return o.value;return null}return this.each((t==null?Eu:Su)(n,e,t))}function dr(e,t,n){var r=e._id;return e.each(function(){var s=me(this,r);(s.value||(s.value={}))[t]=n.apply(this,arguments)}),function(s){return pe(s,r).value[t]}}function ui(e,t){var n;return(typeof t=="number"?$e:t instanceof yt?Br:(n=yt(t))?(t=n,Br):au)(e,t)}function Cu(e){return function(){this.removeAttribute(e)}}function ju(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Mu(e,t,n){var r,s=n+"",i;return function(){var o=this.getAttribute(e);return o===s?null:o===r?i:i=t(r=o,n)}}function $u(e,t,n){var r,s=n+"",i;return function(){var o=this.getAttributeNS(e.space,e.local);return o===s?null:o===r?i:i=t(r=o,n)}}function Iu(e,t,n){var r,s,i;return function(){var o,a=n(this),c;return a==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=a+"",o===c?null:o===r&&c===s?i:(s=c,i=t(r=o,a)))}}function zu(e,t,n){var r,s,i;return function(){var o,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=a+"",o===c?null:o===r&&c===s?i:(s=c,i=t(r=o,a)))}}function Au(e,t){var n=sn(e),r=n==="transform"?du:ui;return this.attrTween(e,typeof t=="function"?(n.local?zu:Iu)(n,r,dr(this,"attr."+e,t)):t==null?(n.local?ju:Cu)(n):(n.local?$u:Mu)(n,r,t))}function Tu(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Pu(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Du(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Pu(e,i)),n}return s._value=t,s}function Ru(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Tu(e,i)),n}return s._value=t,s}function Hu(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 r=sn(e);return this.tween(n,(r.local?Du:Ru)(r,t))}function Lu(e,t){return function(){ur(this,e).delay=+t.apply(this,arguments)}}function Fu(e,t){return t=+t,function(){ur(this,e).delay=t}}function Bu(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Lu:Fu)(t,e)):pe(this.node(),t).delay}function Vu(e,t){return function(){me(this,e).duration=+t.apply(this,arguments)}}function Ou(e,t){return t=+t,function(){me(this,e).duration=t}}function Xu(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Vu:Ou)(t,e)):pe(this.node(),t).duration}function Yu(e,t){if(typeof t!="function")throw new Error;return function(){me(this,e).ease=t}}function qu(e){var t=this._id;return arguments.length?this.each(Yu(t,e)):pe(this.node(),t).ease}function Wu(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;me(this,e).ease=n}}function Gu(e){if(typeof e!="function")throw new Error;return this.each(Wu(this._id,e))}function Ku(e){typeof e!="function"&&(e=Bs(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],o=i.length,a=r[s]=[],c,l=0;l<o;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new _e(r,this._parents,this._name,this._id)}function Uu(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,s=n.length,i=Math.min(r,s),o=new Array(r),a=0;a<i;++a)for(var c=t[a],l=n[a],d=c.length,f=o[a]=new Array(d),u,p=0;p<d;++p)(u=c[p]||l[p])&&(f[p]=u);for(;a<r;++a)o[a]=t[a];return new _e(o,this._parents,this._name,this._id)}function Zu(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function Qu(e,t,n){var r,s,i=Zu(t)?ur:me;return function(){var o=i(this,e),a=o.on;a!==r&&(s=(r=a).copy()).on(t,n),o.on=s}}function Ju(e,t){var n=this._id;return arguments.length<2?pe(this.node(),n).on.on(e):this.each(Qu(n,e,t))}function ed(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function td(){return this.on("end.remove",ed(this._id))}function nd(e){var t=this._name,n=this._id;typeof e!="function"&&(e=or(e));for(var r=this._groups,s=r.length,i=new Array(s),o=0;o<s;++o)for(var a=r[o],c=a.length,l=i[o]=new Array(c),d,f,u=0;u<c;++u)(d=a[u])&&(f=e.call(d,d.__data__,u,a))&&("__data__"in d&&(f.__data__=d.__data__),l[u]=f,an(l[u],t,n,u,l,pe(d,n)));return new _e(i,this._parents,t,n)}function rd(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Fs(e));for(var r=this._groups,s=r.length,i=[],o=[],a=0;a<s;++a)for(var c=r[a],l=c.length,d,f=0;f<l;++f)if(d=c[f]){for(var u=e.call(d,d.__data__,f,c),p,g=pe(d,n),m=0,N=u.length;m<N;++m)(p=u[m])&&an(p,t,n,m,u,g);i.push(u),o.push(d)}return new _e(i,o,t,n)}var sd=St.prototype.constructor;function id(){return new sd(this._groups,this._parents)}function od(e,t){var n,r,s;return function(){var i=Ke(this,e),o=(this.style.removeProperty(e),Ke(this,e));return i===o?null:i===n&&o===r?s:s=t(n=i,r=o)}}function di(e){return function(){this.style.removeProperty(e)}}function ad(e,t,n){var r,s=n+"",i;return function(){var o=Ke(this,e);return o===s?null:o===r?i:i=t(r=o,n)}}function cd(e,t,n){var r,s,i;return function(){var o=Ke(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Ke(this,e))),o===c?null:o===r&&c===s?i:(s=c,i=t(r=o,a))}}function ld(e,t){var n,r,s,i="style."+t,o="end."+i,a;return function(){var c=me(this,e),l=c.on,d=c.value[i]==null?a||(a=di(t)):void 0;(l!==n||s!==d)&&(r=(n=l).copy()).on(o,s=d),c.on=r}}function ud(e,t,n){var r=(e+="")=="transform"?uu:ui;return t==null?this.styleTween(e,od(e,r)).on("end.style."+e,di(e)):typeof t=="function"?this.styleTween(e,cd(e,r,dr(this,"style."+e,t))).each(ld(this._id,e)):this.styleTween(e,ad(e,r,t),n).on("end.style."+e,null)}function dd(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function fd(e,t,n){var r,s;function i(){var o=t.apply(this,arguments);return o!==s&&(r=(s=o)&&dd(e,o,n)),r}return i._value=t,i}function hd(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,fd(e,t,n??""))}function pd(e){return function(){this.textContent=e}}function gd(e){return function(){var t=e(this);this.textContent=t??""}}function md(e){return this.tween("text",typeof e=="function"?gd(dr(this,"text",e)):pd(e==null?"":e+""))}function xd(e){return function(t){this.textContent=e.call(this,t)}}function yd(e){var t,n;function r(){var s=e.apply(this,arguments);return s!==n&&(t=(n=s)&&xd(s)),t}return r._value=e,r}function wd(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,yd(e))}function vd(){for(var e=this._name,t=this._id,n=fi(),r=this._groups,s=r.length,i=0;i<s;++i)for(var o=r[i],a=o.length,c,l=0;l<a;++l)if(c=o[l]){var d=pe(c,t);an(c,e,n,l,o,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new _e(r,this._parents,e,n)}function bd(){var e,t,n=this,r=n._id,s=n.size();return new Promise(function(i,o){var a={value:o},c={value:function(){--s===0&&i()}};n.each(function(){var l=me(this,r),d=l.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),s===0&&i()})}var Nd=0;function _e(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function fi(){return++Nd}var xe=St.prototype;_e.prototype={constructor:_e,select:nd,selectAll:rd,selectChild:xe.selectChild,selectChildren:xe.selectChildren,filter:Ku,merge:Uu,selection:id,transition:vd,call:xe.call,nodes:xe.nodes,node:xe.node,size:xe.size,empty:xe.empty,each:xe.each,on:Ju,attr:Au,attrTween:Hu,style:ud,styleTween:hd,text:md,textTween:wd,remove:td,tween:ku,delay:Bu,duration:Xu,ease:qu,easeVarying:Gu,end:bd,[Symbol.iterator]:xe[Symbol.iterator]};function _d(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Ed={time:null,delay:0,duration:250,ease:_d};function Sd(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 kd(e){var t,n;e instanceof _e?(t=e._id,e=e._name):(t=fi(),(n=Ed).time=lr(),e=e==null?null:e+"");for(var r=this._groups,s=r.length,i=0;i<s;++i)for(var o=r[i],a=o.length,c,l=0;l<a;++l)(c=o[l])&&an(c,e,t,l,o,n||Sd(c,t));return new _e(r,this._parents,e,t)}St.prototype.interrupt=_u;St.prototype.transition=kd;const Pt=e=>()=>e;function Cd(e,{sourceEvent:t,target:n,transform:r,dispatch:s}){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:r,enumerable:!0,configurable:!0},_:{value:s}})}function we(e,t,n){this.k=e,this.x=t,this.y=n}we.prototype={constructor:we,scale:function(e){return e===1?this:new we(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new we(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 cn=new we(1,0,0);hi.prototype=we.prototype;function hi(e){for(;!e.__zoom;)if(!(e=e.parentNode))return cn;return e.__zoom}function $n(e){e.stopImmediatePropagation()}function ct(e){e.preventDefault(),e.stopImmediatePropagation()}function jd(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Md(){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 Gr(){return this.__zoom||cn}function $d(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Id(){return navigator.maxTouchPoints||"ontouchstart"in this}function zd(e,t,n){var r=e.invertX(t[0][0])-n[0][0],s=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),o>i?(i+o)/2:Math.min(0,i)||Math.max(0,o))}function pi(){var e=jd,t=Md,n=zd,r=$d,s=Id,i=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],a=250,c=gu,l=rn("start","zoom","end"),d,f,u,p=500,g=150,m=0,N=10;function y(x){x.property("__zoom",Gr).on("wheel.zoom",$,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",P).filter(s).on("touchstart.zoom",L).on("touchmove.zoom",T).on("touchend.zoom touchcancel.zoom",D).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(x,k,_,I){var b=x.selection?x.selection():x;b.property("__zoom",Gr),x!==b?j(x,k,_,I):b.interrupt().each(function(){R(this,arguments).event(I).start().zoom(null,typeof k=="function"?k.apply(this,arguments):k).end()})},y.scaleBy=function(x,k,_,I){y.scaleTo(x,function(){var b=this.__zoom.k,S=typeof k=="function"?k.apply(this,arguments):k;return b*S},_,I)},y.scaleTo=function(x,k,_,I){y.transform(x,function(){var b=t.apply(this,arguments),S=this.__zoom,z=_==null?w(b):typeof _=="function"?_.apply(this,arguments):_,H=S.invert(z),F=typeof k=="function"?k.apply(this,arguments):k;return n(v(E(S,F),z,H),b,o)},_,I)},y.translateBy=function(x,k,_,I){y.transform(x,function(){return n(this.__zoom.translate(typeof k=="function"?k.apply(this,arguments):k,typeof _=="function"?_.apply(this,arguments):_),t.apply(this,arguments),o)},null,I)},y.translateTo=function(x,k,_,I,b){y.transform(x,function(){var S=t.apply(this,arguments),z=this.__zoom,H=I==null?w(S):typeof I=="function"?I.apply(this,arguments):I;return n(cn.translate(H[0],H[1]).scale(z.k).translate(typeof k=="function"?-k.apply(this,arguments):-k,typeof _=="function"?-_.apply(this,arguments):-_),S,o)},I,b)};function E(x,k){return k=Math.max(i[0],Math.min(i[1],k)),k===x.k?x:new we(k,x.x,x.y)}function v(x,k,_){var I=k[0]-_[0]*x.k,b=k[1]-_[1]*x.k;return I===x.x&&b===x.y?x:new we(x.k,I,b)}function w(x){return[(+x[0][0]+ +x[1][0])/2,(+x[0][1]+ +x[1][1])/2]}function j(x,k,_,I){x.on("start.zoom",function(){R(this,arguments).event(I).start()}).on("interrupt.zoom end.zoom",function(){R(this,arguments).event(I).end()}).tween("zoom",function(){var b=this,S=arguments,z=R(b,S).event(I),H=t.apply(b,S),F=_==null?w(H):typeof _=="function"?_.apply(b,S):_,Y=Math.max(H[1][0]-H[0][0],H[1][1]-H[0][1]),V=b.__zoom,O=typeof k=="function"?k.apply(b,S):k,X=c(V.invert(F).concat(Y/V.k),O.invert(F).concat(Y/O.k));return function(W){if(W===1)W=O;else{var B=X(W),K=Y/B[2];W=new we(K,F[0]-B[0]*K,F[1]-B[1]*K)}z.zoom(null,W)}})}function R(x,k,_){return!_&&x.__zooming||new C(x,k)}function C(x,k){this.that=x,this.args=k,this.active=0,this.sourceEvent=null,this.extent=t.apply(x,k),this.taps=0}C.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,k){return this.mouse&&x!=="mouse"&&(this.mouse[1]=k.invert(this.mouse[0])),this.touch0&&x!=="touch"&&(this.touch0[1]=k.invert(this.touch0[0])),this.touch1&&x!=="touch"&&(this.touch1[1]=k.invert(this.touch1[0])),this.that.__zoom=k,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(x){var k=ce(this.that).datum();l.call(x,this.that,new Cd(x,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:l}),k)}};function $(x,...k){if(!e.apply(this,arguments))return;var _=R(this,k).event(x),I=this.__zoom,b=Math.max(i[0],Math.min(i[1],I.k*Math.pow(2,r.apply(this,arguments)))),S=de(x);if(_.wheel)(_.mouse[0][0]!==S[0]||_.mouse[0][1]!==S[1])&&(_.mouse[1]=I.invert(_.mouse[0]=S)),clearTimeout(_.wheel);else{if(I.k===b)return;_.mouse=[S,I.invert(S)],Xt(this),_.start()}ct(x),_.wheel=setTimeout(z,g),_.zoom("mouse",n(v(E(I,b),_.mouse[0],_.mouse[1]),_.extent,o));function z(){_.wheel=null,_.end()}}function A(x,...k){if(u||!e.apply(this,arguments))return;var _=x.currentTarget,I=R(this,k,!0).event(x),b=ce(x.view).on("mousemove.zoom",F,!0).on("mouseup.zoom",Y,!0),S=de(x,_),z=x.clientX,H=x.clientY;Zs(x.view),$n(x),I.mouse=[S,this.__zoom.invert(S)],Xt(this),I.start();function F(V){if(ct(V),!I.moved){var O=V.clientX-z,X=V.clientY-H;I.moved=O*O+X*X>m}I.event(V).zoom("mouse",n(v(I.that.__zoom,I.mouse[0]=de(V,_),I.mouse[1]),I.extent,o))}function Y(V){b.on("mousemove.zoom mouseup.zoom",null),Qs(V.view,I.moved),ct(V),I.event(V).end()}}function P(x,...k){if(e.apply(this,arguments)){var _=this.__zoom,I=de(x.changedTouches?x.changedTouches[0]:x,this),b=_.invert(I),S=_.k*(x.shiftKey?.5:2),z=n(v(E(_,S),I,b),t.apply(this,k),o);ct(x),a>0?ce(this).transition().duration(a).call(j,z,I,x):ce(this).call(y.transform,z,I,x)}}function L(x,...k){if(e.apply(this,arguments)){var _=x.touches,I=_.length,b=R(this,k,x.changedTouches.length===I).event(x),S,z,H,F;for($n(x),z=0;z<I;++z)H=_[z],F=de(H,this),F=[F,this.__zoom.invert(F),H.identifier],b.touch0?!b.touch1&&b.touch0[2]!==F[2]&&(b.touch1=F,b.taps=0):(b.touch0=F,S=!0,b.taps=1+!!d);d&&(d=clearTimeout(d)),S&&(b.taps<2&&(f=F[0],d=setTimeout(function(){d=null},p)),Xt(this),b.start())}}function T(x,...k){if(this.__zooming){var _=R(this,k).event(x),I=x.changedTouches,b=I.length,S,z,H,F;for(ct(x),S=0;S<b;++S)z=I[S],H=de(z,this),_.touch0&&_.touch0[2]===z.identifier?_.touch0[0]=H:_.touch1&&_.touch1[2]===z.identifier&&(_.touch1[0]=H);if(z=_.that.__zoom,_.touch1){var Y=_.touch0[0],V=_.touch0[1],O=_.touch1[0],X=_.touch1[1],W=(W=O[0]-Y[0])*W+(W=O[1]-Y[1])*W,B=(B=X[0]-V[0])*B+(B=X[1]-V[1])*B;z=E(z,Math.sqrt(W/B)),H=[(Y[0]+O[0])/2,(Y[1]+O[1])/2],F=[(V[0]+X[0])/2,(V[1]+X[1])/2]}else if(_.touch0)H=_.touch0[0],F=_.touch0[1];else return;_.zoom("touch",n(v(z,H,F),_.extent,o))}}function D(x,...k){if(this.__zooming){var _=R(this,k).event(x),I=x.changedTouches,b=I.length,S,z;for($n(x),u&&clearTimeout(u),u=setTimeout(function(){u=null},p),S=0;S<b;++S)z=I[S],_.touch0&&_.touch0[2]===z.identifier?delete _.touch0:_.touch1&&_.touch1[2]===z.identifier&&delete _.touch1;if(_.touch1&&!_.touch0&&(_.touch0=_.touch1,delete _.touch1),_.touch0)_.touch0[1]=this.__zoom.invert(_.touch0[0]);else if(_.end(),_.taps===2&&(z=de(z,this),Math.hypot(f[0]-z[0],f[1]-z[1])<N)){var H=ce(this).on("dblclick.zoom");H&&H.apply(this,arguments)}}}return y.wheelDelta=function(x){return arguments.length?(r=typeof x=="function"?x:Pt(+x),y):r},y.filter=function(x){return arguments.length?(e=typeof x=="function"?x:Pt(!!x),y):e},y.touchable=function(x){return arguments.length?(s=typeof x=="function"?x:Pt(!!x),y):s},y.extent=function(x){return arguments.length?(t=typeof x=="function"?x:Pt([[+x[0][0],+x[0][1]],[+x[1][0],+x[1][1]]]),y):t},y.scaleExtent=function(x){return arguments.length?(i[0]=+x[0],i[1]=+x[1],y):[i[0],i[1]]},y.translateExtent=function(x){return arguments.length?(o[0][0]=+x[0][0],o[1][0]=+x[1][0],o[0][1]=+x[0][1],o[1][1]=+x[1][1],y):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},y.constrain=function(x){return arguments.length?(n=x,y):n},y.duration=function(x){return arguments.length?(a=+x,y):a},y.interpolate=function(x){return arguments.length?(c=x,y):c},y.on=function(){var x=l.on.apply(l,arguments);return x===l?y:x},y.clickDistance=function(x){return arguments.length?(m=(x=+x)*x,y):Math.sqrt(m)},y.tapDistance=function(x){return arguments.length?(N=+x,y):N},y}const Ee={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`},vt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],gi=["Enter"," ","Escape"];var Ze;(function(e){e.Strict="strict",e.Loose="loose"})(Ze||(Ze={}));var He;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(He||(He={}));var bt;(function(e){e.Partial="partial",e.Full="full"})(bt||(bt={}));const mi={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null};var Ie;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ie||(Ie={}));var Jt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Jt||(Jt={}));var q;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(q||(q={}));const Kr={[q.Left]:q.Right,[q.Right]:q.Left,[q.Top]:q.Bottom,[q.Bottom]:q.Top};function xi(e){return e===null?null:e?"valid":"invalid"}const yi=e=>"id"in e&&"source"in e&&"target"in e,Ad=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),fr=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Ct=(e,t=[0,0])=>{const{width:n,height:r}=Se(e),s=e.origin??t,i=n*s[0],o=r*s[1];return{x:e.position.x-i,y:e.position.y-o}},Td=(e,t={nodeOrigin:[0,0],nodeLookup:void 0})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,s)=>{const i=typeof s=="string";let o=!t.nodeLookup&&!i?s:void 0;t.nodeLookup&&(o=i?t.nodeLookup.get(s):fr(s)?s:t.nodeLookup.get(s.id));const a=o?en(o,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return ln(r,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return un(n)},jt=(e,t={})=>{if(e.size===0)return{x:0,y:0,width:0,height:0};let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0};return e.forEach(r=>{if(t.filter===void 0||t.filter(r)){const s=en(r);n=ln(n,s)}}),un(n)},wi=(e,t,[n,r,s]=[0,0,1],i=!1,o=!1)=>{const a={...Mt(t,[n,r,s]),width:t.width/s,height:t.height/s},c=[];for(const l of e.values()){const{measured:d,selectable:f=!0,hidden:u=!1}=l;if(o&&!f||u)continue;const p=d.width??l.width??l.initialWidth??null,g=d.height??l.height??l.initialHeight??null,m=Nt(a,Je(l)),N=(p??0)*(g??0),y=i&&m>0;(!l.internals.handleBounds||y||m>=N||l.dragging)&&c.push(l)}return c},Pd=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function Gn(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(s=>s.id)):null;return e.forEach(s=>{s.measured.width&&s.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!s.hidden)&&(!r||r.has(s.id))&&n.set(s.id,s)}),n}async function Kn({nodes:e,width:t,height:n,panZoom:r,minZoom:s,maxZoom:i},o){if(e.size===0)return Promise.resolve(!1);const a=jt(e),c=hr(a,t,n,(o==null?void 0:o.minZoom)??s,(o==null?void 0:o.maxZoom)??i,(o==null?void 0:o.padding)??.1);return await r.setViewport(c,{duration:o==null?void 0:o.duration}),Promise.resolve(!0)}function vi({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:s,onError:i}){const o=n.get(e),a=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},d=o.origin??r;let f=s;if(o.extent==="parent"&&!o.expandParent)if(!a)i==null||i("005",Ee.error005());else{const p=a.measured.width,g=a.measured.height;p&&g&&(f=[[c,l],[c+p,l+g]])}else a&&et(o.extent)&&(f=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);const u=et(f)?Fe(t,f,o.measured):t;return{position:{x:u.x-c+o.measured.width*d[0],y:u.y-l+o.measured.height*d[1]},positionAbsolute:u}}async function Dd({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:s}){const i=new Set(e.map(u=>u.id)),o=[];for(const u of n){if(u.deletable===!1)continue;const p=i.has(u.id),g=!p&&u.parentId&&o.find(m=>m.id===u.parentId);(p||g)&&o.push(u)}const a=new Set(t.map(u=>u.id)),c=r.filter(u=>u.deletable!==!1),d=Pd(o,c);for(const u of c)a.has(u.id)&&!d.find(g=>g.id===u.id)&&d.push(u);if(!s)return{edges:d,nodes:o};const f=await s({nodes:o,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:o}:{edges:[],nodes:[]}:f}const Qe=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Fe=(e={x:0,y:0},t,n)=>({x:Qe(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Qe(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function bi(e,t,n){const{width:r,height:s}=Se(n),{x:i,y:o}=n.internals.positionAbsolute;return Fe(e,[[i,o],[i+r,o+s]],t)}const Ur=(e,t,n)=>e<t?Qe(Math.abs(e-t),1,t)/t:e>n?-Qe(Math.abs(e-n),1,t)/t:0,Ni=(e,t,n=15,r=40)=>{const s=Ur(e.x,r,t.width-r)*n,i=Ur(e.y,r,t.height-r)*n;return[s,i]},ln=(e,t)=>({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)}),Un=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),un=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Je=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=fr(e)?e.internals.positionAbsolute:Ct(e,t);return{x:n,y:r,width:((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},en=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=fr(e)?e.internals.positionAbsolute:Ct(e,t);return{x:n,y:r,x2:n+(((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0),y2:r+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},_i=(e,t)=>un(ln(Un(e),Un(t))),Nt=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},Zr=e=>he(e.width)&&he(e.height)&&he(e.x)&&he(e.y),he=e=>!isNaN(e)&&isFinite(e),Rd=(e,t)=>{},dn=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Mt=({x:e,y:t},[n,r,s],i=!1,o=[1,1])=>{const a={x:(e-n)/s,y:(t-r)/s};return i?dn(a,o):a},Ei=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r}),hr=(e,t,n,r,s,i)=>{const o=t/(e.width*(1+i)),a=n/(e.height*(1+i)),c=Math.min(o,a),l=Qe(c,r,s),d=e.x+e.width/2,f=e.y+e.height/2,u=t/2-d*l,p=n/2-f*l;return{x:u,y:p,zoom:l}},tn=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function et(e){return e!==void 0&&e!=="parent"}function Se(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function Si(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function ki(e,t={width:0,height:0},n,r,s){const i={...e},o=r.get(n);if(o){const a=o.origin||s;i.x+=o.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=o.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}function ft(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:i,y:o}=ve(e),a=Mt({x:i-((s==null?void 0:s.left)??0),y:o-((s==null?void 0:s.top)??0)},r),{x:c,y:l}=n?dn(a,t):a;return{xSnapped:c,ySnapped:l,...a}}const fn=e=>({width:e.offsetWidth,height:e.offsetHeight}),Ci=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},Hd=["INPUT","SELECT","TEXTAREA"];function Zn(e){var r,s,i;const t=((s=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:s[0])||e.target;return Hd.includes(t==null?void 0:t.nodeName)||((i=t==null?void 0:t.hasAttribute)==null?void 0:i.call(t,"contenteditable"))||!!(t!=null&&t.closest(".nokey"))}const ji=e=>"clientX"in e,ve=(e,t)=>{var i,o;const n=ji(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,s=n?e.clientY:(o=e.touches)==null?void 0:o[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:s-((t==null?void 0:t.top)??0)}},Qr=(e,t,n,r,s)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(o=>{const a=o.getBoundingClientRect();return{id:o.getAttribute("data-handleid"),type:e,nodeId:s,position:o.getAttribute("data-handlepos"),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...fn(o)}})};function Mi({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:s,sourceControlY:i,targetControlX:o,targetControlY:a}){const c=e*.125+s*.375+o*.375+n*.125,l=t*.125+i*.375+a*.375+r*.125,d=Math.abs(c-e),f=Math.abs(l-t);return[c,l,d,f]}function Dt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Jr({pos:e,x1:t,y1:n,x2:r,y2:s,c:i}){switch(e){case q.Left:return[t-Dt(t-r,i),n];case q.Right:return[t+Dt(r-t,i),n];case q.Top:return[t,n-Dt(n-s,i)];case q.Bottom:return[t,n+Dt(s-n,i)]}}function $i({sourceX:e,sourceY:t,sourcePosition:n=q.Bottom,targetX:r,targetY:s,targetPosition:i=q.Top,curvature:o=.25}){const[a,c]=Jr({pos:n,x1:e,y1:t,x2:r,y2:s,c:o}),[l,d]=Jr({pos:i,x1:r,y1:s,x2:e,y2:t,c:o}),[f,u,p,g]=Mi({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:d});return[`M${e},${t} C${a},${c} ${l},${d} ${r},${s}`,f,u,p,g]}function Ii({sourceX:e,sourceY:t,targetX:n,targetY:r}){const s=Math.abs(n-e)/2,i=n<e?n+s:n-s,o=Math.abs(r-t)/2,a=r<t?r+o:r-o;return[i,a,s,o]}function Ld({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:s=!1}){if(!s)return r;const i=n||t.selected||e.selected,o=Math.max(e.internals.z||0,t.internals.z||0,1e3);return r+(i?o:0)}function Fd({sourceNode:e,targetNode:t,width:n,height:r,transform:s}){const i=ln(en(e),en(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const o={x:-s[0]/s[2],y:-s[1]/s[2],width:n/s[2],height:r/s[2]};return Nt(o,un(i))>0}const Bd=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,Vd=(e,t)=>t.some(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)),Od=(e,t)=>{if(!e.source||!e.target)return t;let n;return yi(e)?n={...e}:n={...e,id:Bd(e)},Vd(n,t)?t:(n.sourceHandle===null&&delete n.sourceHandle,n.targetHandle===null&&delete n.targetHandle,t.concat(n))};function zi({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,i,o,a]=Ii({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,i,o,a]}const es={[q.Left]:{x:-1,y:0},[q.Right]:{x:1,y:0},[q.Top]:{x:0,y:-1},[q.Bottom]:{x:0,y:1}},Xd=({source:e,sourcePosition:t=q.Bottom,target:n})=>t===q.Left||t===q.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},ts=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Yd({source:e,sourcePosition:t=q.Bottom,target:n,targetPosition:r=q.Top,center:s,offset:i}){const o=es[t],a=es[r],c={x:e.x+o.x*i,y:e.y+o.y*i},l={x:n.x+a.x*i,y:n.y+a.y*i},d=Xd({source:c,sourcePosition:t,target:l}),f=d.x!==0?"x":"y",u=d[f];let p=[],g,m;const N={x:0,y:0},y={x:0,y:0},[E,v,w,j]=Ii({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(o[f]*a[f]===-1){g=s.x??E,m=s.y??v;const C=[{x:g,y:c.y},{x:g,y:l.y}],$=[{x:c.x,y:m},{x:l.x,y:m}];o[f]===u?p=f==="x"?C:$:p=f==="x"?$:C}else{const C=[{x:c.x,y:l.y}],$=[{x:l.x,y:c.y}];if(f==="x"?p=o.x===u?$:C:p=o.y===u?C:$,t===r){const D=Math.abs(e[f]-n[f]);if(D<=i){const x=Math.min(i-1,i-D);o[f]===u?N[f]=(c[f]>e[f]?-1:1)*x:y[f]=(l[f]>n[f]?-1:1)*x}}if(t!==r){const D=f==="x"?"y":"x",x=o[f]===a[D],k=c[D]>l[D],_=c[D]<l[D];(o[f]===1&&(!x&&k||x&&_)||o[f]!==1&&(!x&&_||x&&k))&&(p=f==="x"?C:$)}const A={x:c.x+N.x,y:c.y+N.y},P={x:l.x+y.x,y:l.y+y.y},L=Math.max(Math.abs(A.x-p[0].x),Math.abs(P.x-p[0].x)),T=Math.max(Math.abs(A.y-p[0].y),Math.abs(P.y-p[0].y));L>=T?(g=(A.x+P.x)/2,m=p[0].y):(g=p[0].x,m=(A.y+P.y)/2)}return[[e,{x:c.x+N.x,y:c.y+N.y},...p,{x:l.x+y.x,y:l.y+y.y},n],g,m,w,j]}function qd(e,t,n,r){const s=Math.min(ts(e,t)/2,ts(t,n)/2,r),{x:i,y:o}=t;if(e.x===i&&i===n.x||e.y===o&&o===n.y)return`L${i} ${o}`;if(e.y===o){const l=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${i+s*l},${o}Q ${i},${o} ${i},${o+s*d}`}const a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${o+s*c}Q ${i},${o} ${i+s*a},${o}`}function Qn({sourceX:e,sourceY:t,sourcePosition:n=q.Bottom,targetX:r,targetY:s,targetPosition:i=q.Top,borderRadius:o=5,centerX:a,centerY:c,offset:l=20}){const[d,f,u,p,g]=Yd({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:s},targetPosition:i,center:{x:a,y:c},offset:l});return[d.reduce((N,y,E)=>{let v="";return E>0&&E<d.length-1?v=qd(d[E-1],y,d[E+1],o):v=`${E===0?"M":"L"}${y.x} ${y.y}`,N+=v,N},""),f,u,p,g]}function ns(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Wd(e){var f;const{sourceNode:t,targetNode:n}=e;if(!ns(t)||!ns(n))return null;const r=t.internals.handleBounds||rs(t.handles),s=n.internals.handleBounds||rs(n.handles),i=ss((r==null?void 0:r.source)??[],e.sourceHandle),o=ss(e.connectionMode===Ze.Strict?(s==null?void 0:s.target)??[]:((s==null?void 0:s.target)??[]).concat((s==null?void 0:s.source)??[]),e.targetHandle);if(!i||!o)return(f=e.onError)==null||f.call(e,"008",Ee.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=(i==null?void 0:i.position)||q.Bottom,c=(o==null?void 0:o.position)||q.Top,l=_t(t,i,a),d=_t(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:d.x,targetY:d.y,sourcePosition:a,targetPosition:c}}function rs(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function _t(e,t,n=q.Left,r=!1){const s=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,i=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:o,height:a}=t??Se(e);if(r)return{x:s+o/2,y:i+a/2};switch((t==null?void 0:t.position)??n){case q.Top:return{x:s+o/2,y:i};case q.Right:return{x:s+o,y:i+a/2};case q.Bottom:return{x:s+o/2,y:i+a};case q.Left:return{x:s,y:i+a/2}}}function ss(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Jn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function Gd(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:s}){const i=new Set;return e.reduce((o,a)=>([a.markerStart||r,a.markerEnd||s].forEach(c=>{if(c&&typeof c=="object"){const l=Jn(c,t);i.has(l)||(o.push({id:l,color:c.color||n,...c}),i.add(l))}}),o),[]).sort((o,a)=>o.id.localeCompare(a.id))}const pr={nodeOrigin:[0,0],nodeExtent:vt,elevateNodesOnSelect:!0,defaults:{}},Kd={...pr,checkEquality:!0};function gr(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function Ud(e,t,n){const r=gr(pr,n);for(const s of e.values())if(s.parentId)mr(s,e,t,r);else{const i=Ct(s,r.nodeOrigin),o=et(s.extent)?s.extent:r.nodeExtent,a=Fe(i,o,Se(s));s.internals.positionAbsolute=a}}function er(e,t,n,r){var a,c;const s=gr(Kd,r),i=new Map(t),o=s!=null&&s.elevateNodesOnSelect?1e3:0;t.clear(),n.clear();for(const l of e){let d=i.get(l.id);if(s.checkEquality&&l===(d==null?void 0:d.internals.userNode))t.set(l.id,d);else{const f=Ct(l,s.nodeOrigin),u=et(l.extent)?l.extent:s.nodeExtent,p=Fe(f,u,Se(l));d={...s.defaults,...l,measured:{width:(a=l.measured)==null?void 0:a.width,height:(c=l.measured)==null?void 0:c.height},internals:{positionAbsolute:p,handleBounds:l.measured?d==null?void 0:d.internals.handleBounds:void 0,z:Ai(l,o),userNode:l}},t.set(l.id,d)}l.parentId&&mr(d,t,n,r)}}function Zd(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function mr(e,t,n,r){const{elevateNodesOnSelect:s,nodeOrigin:i,nodeExtent:o}=gr(pr,r),a=e.parentId,c=t.get(a);if(!c){console.warn(`Parent node ${a} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Zd(e,n);const l=s?1e3:0,{x:d,y:f,z:u}=Qd(e,c,i,o,l),{positionAbsolute:p}=e.internals,g=d!==p.x||f!==p.y;(g||u!==e.internals.z)&&(e.internals={...e.internals,positionAbsolute:g?{x:d,y:f}:p,z:u})}function Ai(e,t){return(he(e.zIndex)?e.zIndex:0)+(e.selected?t:0)}function Qd(e,t,n,r,s){const{x:i,y:o}=t.internals.positionAbsolute,a=Se(e),c=Ct(e,n),l=et(e.extent)?Fe(c,e.extent,a):c;let d=Fe({x:i+l.x,y:o+l.y},r,a);e.extent==="parent"&&(d=bi(d,a,t));const f=Ai(e,s),u=t.internals.z??0;return{x:d.x,y:d.y,z:u>f?u:f}}function xr(e,t,n,r=[0,0]){var o;const s=[],i=new Map;for(const a of e){const c=t.get(a.parentId);if(!c)continue;const l=((o=i.get(a.parentId))==null?void 0:o.expandedRect)??Je(c),d=_i(l,a.rect);i.set(a.parentId,{expandedRect:d,parent:c})}return i.size>0&&i.forEach(({expandedRect:a,parent:c},l)=>{var v;const d=c.internals.positionAbsolute,f=Se(c),u=c.origin??r,p=a.x<d.x?Math.round(Math.abs(d.x-a.x)):0,g=a.y<d.y?Math.round(Math.abs(d.y-a.y)):0,m=Math.max(f.width,Math.round(a.width)),N=Math.max(f.height,Math.round(a.height)),y=(m-f.width)*u[0],E=(N-f.height)*u[1];(p>0||g>0||y||E)&&(s.push({id:l,type:"position",position:{x:c.position.x-p+y,y:c.position.y-g+E}}),(v=n.get(l))==null||v.forEach(w=>{e.some(j=>j.id===w.id)||s.push({id:w.id,type:"position",position:{x:w.position.x+p,y:w.position.y+g}})})),(f.width<a.width||f.height<a.height||p||g)&&s.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:m+(p?u[0]*p-y:0),height:N+(g?u[1]*g-E:0)}})}),s}function Jd(e,t,n,r,s,i){const o=r==null?void 0:r.querySelector(".xyflow__viewport");let a=!1;if(!o)return{changes:[],updatedInternals:a};const c=[],l=window.getComputedStyle(o),{m22:d}=new window.DOMMatrixReadOnly(l.transform),f=[];for(const u of e.values()){const p=t.get(u.id);if(p)if(p.hidden)p.internals={...p.internals,handleBounds:void 0},a=!0;else{const g=fn(u.nodeElement),m=p.measured.width!==g.width||p.measured.height!==g.height;if(!!(g.width&&g.height&&(m||!p.internals.handleBounds||u.force))){const y=u.nodeElement.getBoundingClientRect(),E=et(p.extent)?p.extent:i;let{positionAbsolute:v}=p.internals;p.parentId&&p.extent==="parent"?v=bi(v,g,t.get(p.parentId)):E&&(v=Fe(v,E,g)),p.measured=g,p.internals={...p.internals,positionAbsolute:v,handleBounds:{source:Qr("source",u.nodeElement,y,d,p.id),target:Qr("target",u.nodeElement,y,d,p.id)}},p.parentId&&mr(p,t,n,{nodeOrigin:s}),a=!0,m&&(c.push({id:p.id,type:"dimensions",dimensions:g}),p.expandParent&&p.parentId&&f.push({id:p.id,parentId:p.parentId,rect:Je(p,s)}))}}}if(f.length>0){const u=xr(f,t,n,s);c.push(...u)}return{changes:c,updatedInternals:a}}async function ef({delta:e,panZoom:t,transform:n,translateExtent:r,width:s,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[s,i]],r),a=!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2]);return Promise.resolve(a)}function Ti(e,t,n){e.clear(),t.clear();for(const r of n){const{source:s,target:i,sourceHandle:o=null,targetHandle:a=null}=r,c=`${s}-source-${o}`,l=`${i}-target-${a}`,d=e.get(c)||new Map,f=e.get(l)||new Map,u={edgeId:r.id,source:s,target:i,sourceHandle:o,targetHandle:a};t.set(r.id,r),e.set(c,d.set(`${i}-${a}`,u)),e.set(l,f.set(`${s}-${o}`,u))}}function Pi(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Pi(n,t):!1}function is(e,t,n){let r=e;do{if(r!=null&&r.matches(t))return!0;if(r===n)return!1;r=r.parentElement}while(r);return!1}function tf(e,t,n,r){const s=new Map;for(const[i,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!Pi(o,e))&&(o.draggable||t&&typeof o.draggable>"u")){const a=e.get(i);a&&s.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return s}function In({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var o,a,c;const s=[];for(const[l,d]of t){const f=(o=n.get(l))==null?void 0:o.internals.userNode;f&&s.push({...f,position:d.position,dragging:r})}if(!e)return[s[0],s];const i=(a=n.get(e))==null?void 0:a.internals.userNode;return[i?{...i,position:((c=t.get(e))==null?void 0:c.position)||i.position,dragging:r}:s[0],s]}function nf({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:s}){let i={x:null,y:null},o=0,a=new Map,c=!1,l={x:0,y:0},d=null,f=!1,u=null,p=!1;function g({noDragClassName:N,handleSelector:y,domNode:E,isSelectable:v,nodeId:w,nodeClickDistance:j=0}){u=ce(E);function R({x:P,y:L},T){const{nodeLookup:D,nodeExtent:x,snapGrid:k,snapToGrid:_,nodeOrigin:I,onNodeDrag:b,onSelectionDrag:S,onError:z,updateNodePositions:H}=t();i={x:P,y:L};let F=!1,Y={x:0,y:0,x2:0,y2:0};if(a.size>1&&x){const V=jt(a);Y=Un(V)}for(const[V,O]of a){if(!D.has(V))continue;let X={x:P-O.distance.x,y:L-O.distance.y};_&&(X=dn(X,k));let W=[[x[0][0],x[0][1]],[x[1][0],x[1][1]]];if(a.size>1&&x&&!O.extent){const{positionAbsolute:Z}=O.internals,U=Z.x-Y.x+x[0][0],G=Z.x+O.measured.width-Y.x2+x[1][0],J=Z.y-Y.y+x[0][1],ee=Z.y+O.measured.height-Y.y2+x[1][1];W=[[U,J],[G,ee]]}const{position:B,positionAbsolute:K}=vi({nodeId:V,nextPosition:X,nodeLookup:D,nodeExtent:W,nodeOrigin:I,onError:z});F=F||O.position.x!==B.x||O.position.y!==B.y,O.position=B,O.internals.positionAbsolute=K}if(F&&(H(a,!0),T&&(r||b||!w&&S))){const[V,O]=In({nodeId:w,dragItems:a,nodeLookup:D});r==null||r(T,a,V,O),b==null||b(T,V,O),w||S==null||S(T,O)}}async function C(){if(!d)return;const{transform:P,panBy:L,autoPanSpeed:T}=t(),[D,x]=Ni(l,d,T);(D!==0||x!==0)&&(i.x=(i.x??0)-D/P[2],i.y=(i.y??0)-x/P[2],await L({x:D,y:x})&&R(i,null)),o=requestAnimationFrame(C)}function $(P){var F;const{nodeLookup:L,multiSelectionActive:T,nodesDraggable:D,transform:x,snapGrid:k,snapToGrid:_,selectNodesOnDrag:I,onNodeDragStart:b,onSelectionDragStart:S,unselectNodesAndEdges:z}=t();f=!0,(!I||!v)&&!T&&w&&((F=L.get(w))!=null&&F.selected||z()),v&&I&&w&&(e==null||e(w));const H=ft(P.sourceEvent,{transform:x,snapGrid:k,snapToGrid:_,containerBounds:d});if(i=H,a=tf(L,D,H,w),a.size>0&&(n||b||!w&&S)){const[Y,V]=In({nodeId:w,dragItems:a,nodeLookup:L});n==null||n(P.sourceEvent,a,Y,V),b==null||b(P.sourceEvent,Y,V),w||S==null||S(P.sourceEvent,V)}}const A=Js().clickDistance(j).on("start",P=>{const{domNode:L,nodeDragThreshold:T,transform:D,snapGrid:x,snapToGrid:k}=t();d=(L==null?void 0:L.getBoundingClientRect())||null,p=!1,T===0&&$(P),i=ft(P.sourceEvent,{transform:D,snapGrid:x,snapToGrid:k,containerBounds:d}),l=ve(P.sourceEvent,d)}).on("drag",P=>{const{autoPanOnNodeDrag:L,transform:T,snapGrid:D,snapToGrid:x,nodeDragThreshold:k,nodeLookup:_}=t(),I=ft(P.sourceEvent,{transform:T,snapGrid:D,snapToGrid:x,containerBounds:d});if((P.sourceEvent.type==="touchmove"&&P.sourceEvent.touches.length>1||w&&!_.has(w))&&(p=!0),!p){if(!c&&L&&f&&(c=!0,C()),!f){const b=I.xSnapped-(i.x??0),S=I.ySnapped-(i.y??0);Math.sqrt(b*b+S*S)>k&&$(P)}(i.x!==I.xSnapped||i.y!==I.ySnapped)&&a&&f&&(l=ve(P.sourceEvent,d),R(I,P.sourceEvent))}}).on("end",P=>{if(!(!f||p)&&(c=!1,f=!1,cancelAnimationFrame(o),a.size>0)){const{nodeLookup:L,updateNodePositions:T,onNodeDragStop:D,onSelectionDragStop:x}=t();if(T(a,!1),s||D||!w&&x){const[k,_]=In({nodeId:w,dragItems:a,nodeLookup:L,dragging:!1});s==null||s(P.sourceEvent,a,k,_),D==null||D(P.sourceEvent,k,_),w||x==null||x(P.sourceEvent,_)}}}).filter(P=>{const L=P.target;return!P.button&&(!N||!is(L,`.${N}`,E))&&(!y||is(L,y,E))});u.call(A)}function m(){u==null||u.on(".drag",null)}return{update:g,destroy:m}}function rf(e,t,n){const r=[],s={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())Nt(s,Je(i))>0&&r.push(i);return r}const sf=250;function of(e,t,n,r){var a,c;let s=[],i=1/0;const o=rf(e,n,t+sf);for(const l of o){const d=[...((a=l.internals.handleBounds)==null?void 0:a.source)??[],...((c=l.internals.handleBounds)==null?void 0:c.target)??[]];for(const f of d){if(r.nodeId===f.nodeId&&r.type===f.type&&r.id===f.id)continue;const{x:u,y:p}=_t(l,f,f.position,!0),g=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(p-e.y,2));g>t||(g<i?(s=[{...f,x:u,y:p}],i=g):g===i&&s.push({...f,x:u,y:p}))}}if(!s.length)return null;if(s.length>1){const l=r.type==="source"?"target":"source";return s.find(d=>d.type===l)??s[0]}return s[0]}function Di(e,t,n,r,s,i=!1){var l,d,f;const o=r.get(e);if(!o)return null;const a=s==="strict"?(l=o.internals.handleBounds)==null?void 0:l[t]:[...((d=o.internals.handleBounds)==null?void 0:d.source)??[],...((f=o.internals.handleBounds)==null?void 0:f.target)??[]],c=(n?a==null?void 0:a.find(u=>u.id===n):a==null?void 0:a[0])??null;return c&&i?{...c,..._t(o,c,c.position,!0)}:c}function Ri(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function af(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Hi=()=>!0;function cf(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:s,edgeUpdaterType:i,isTarget:o,domNode:a,nodeLookup:c,lib:l,autoPanOnConnect:d,flowId:f,panBy:u,cancelConnection:p,onConnectStart:g,onConnect:m,onConnectEnd:N,isValidConnection:y=Hi,onReconnectEnd:E,updateConnection:v,getTransform:w,getFromHandle:j,autoPanSpeed:R}){const C=Ci(e.target);let $=0,A;const{x:P,y:L}=ve(e),T=C==null?void 0:C.elementFromPoint(P,L),D=Ri(i,T),x=a==null?void 0:a.getBoundingClientRect();if(!x||!D)return;const k=Di(s,D,r,c,t);if(!k)return;let _=ve(e,x),I=!1,b=null,S=!1,z=null;function H(){if(!d||!x)return;const[K,Z]=Ni(_,x,R);u({x:K,y:Z}),$=requestAnimationFrame(H)}const F={...k,nodeId:s,type:D,position:k.position},Y=c.get(s),O={inProgress:!0,isValid:null,from:_t(Y,F,q.Left,!0),fromHandle:F,fromPosition:F.position,fromNode:Y,to:_,toHandle:null,toPosition:Kr[F.position],toNode:null};v(O);let X=O;g==null||g(e,{nodeId:s,handleId:r,handleType:D});function W(K){if(!j()||!F){B(K);return}const Z=w();_=ve(K,x),A=of(Mt(_,Z,!1,[1,1]),n,c,F),I||(H(),I=!0);const U=Li(K,{handle:A,connectionMode:t,fromNodeId:s,fromHandleId:r,fromType:o?"target":"source",isValidConnection:y,doc:C,lib:l,flowId:f,nodeLookup:c});z=U.handleDomNode,b=U.connection,S=af(!!A,U.isValid);const G={...X,isValid:S,to:A&&S?Ei({x:A.x,y:A.y},Z):_,toHandle:U.toHandle,toPosition:S&&U.toHandle?U.toHandle.position:Kr[F.position],toNode:U.toHandle?c.get(U.toHandle.nodeId):null};S&&A&&X.toHandle&&G.toHandle&&X.toHandle.type===G.toHandle.type&&X.toHandle.nodeId===G.toHandle.nodeId&&X.toHandle.id===G.toHandle.id&&X.to.x===G.to.x&&X.to.y===G.to.y||(v(G),X=G)}function B(K){(A||z)&&b&&S&&(m==null||m(b));const{inProgress:Z,...U}=X,G={...U,toPosition:X.toHandle?X.toPosition:null};N==null||N(K,G),i&&(E==null||E(K,G)),p(),cancelAnimationFrame($),I=!1,S=!1,b=null,z=null,C.removeEventListener("mousemove",W),C.removeEventListener("mouseup",B),C.removeEventListener("touchmove",W),C.removeEventListener("touchend",B)}C.addEventListener("mousemove",W),C.addEventListener("mouseup",B),C.addEventListener("touchmove",W),C.addEventListener("touchend",B)}function Li(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:i,doc:o,lib:a,flowId:c,isValidConnection:l=Hi,nodeLookup:d}){const f=i==="target",u=t?o.querySelector(`.${a}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:p,y:g}=ve(e),m=o.elementFromPoint(p,g),N=m!=null&&m.classList.contains(`${a}-flow__handle`)?m:u,y={handleDomNode:N,isValid:!1,connection:null,toHandle:null};if(N){const E=Ri(void 0,N),v=N.getAttribute("data-nodeid"),w=N.getAttribute("data-handleid"),j=N.classList.contains("connectable"),R=N.classList.contains("connectableend");if(!v||!E)return y;const C={source:f?v:r,sourceHandle:f?w:s,target:f?r:v,targetHandle:f?s:w};y.connection=C;const A=j&&R&&(n===Ze.Strict?f&&E==="source"||!f&&E==="target":v!==r||w!==s);y.isValid=A&&l(C),y.toHandle=Di(v,E,w,d,n,!1)}return y}const tr={onPointerDown:cf,isValid:Li};function lf({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const s=ce(e);function i({translateExtent:a,width:c,height:l,zoomStep:d=10,pannable:f=!0,zoomable:u=!0,inversePan:p=!1}){const g=v=>{const w=n();if(v.sourceEvent.type!=="wheel"||!t)return;const j=-v.sourceEvent.deltaY*(v.sourceEvent.deltaMode===1?.05:v.sourceEvent.deltaMode?1:.002)*d,R=w[2]*Math.pow(2,j);t.scaleTo(R)};let m=[0,0];const N=v=>{(v.sourceEvent.type==="mousedown"||v.sourceEvent.type==="touchstart")&&(m=[v.sourceEvent.clientX??v.sourceEvent.touches[0].clientX,v.sourceEvent.clientY??v.sourceEvent.touches[0].clientY])},y=v=>{const w=n();if(v.sourceEvent.type!=="mousemove"&&v.sourceEvent.type!=="touchmove"||!t)return;const j=[v.sourceEvent.clientX??v.sourceEvent.touches[0].clientX,v.sourceEvent.clientY??v.sourceEvent.touches[0].clientY],R=[j[0]-m[0],j[1]-m[1]];m=j;const C=r()*Math.max(w[2],Math.log(w[2]))*(p?-1:1),$={x:w[0]-R[0]*C,y:w[1]-R[1]*C},A=[[0,0],[c,l]];t.setViewportConstrained({x:$.x,y:$.y,zoom:w[2]},A,a)},E=pi().on("start",N).on("zoom",f?y:null).on("zoom.wheel",u?g:null);s.call(E,{})}function o(){s.on("zoom",null)}return{update:i,destroy:o,pointer:de}}const uf=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,hn=e=>({x:e.x,y:e.y,zoom:e.k}),zn=({x:e,y:t,zoom:n})=>cn.translate(e,t).scale(n),Xe=(e,t)=>e.target.closest(`.${t}`),Fi=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),An=(e,t=0,n=()=>{})=>{const r=typeof t=="number"&&t>0;return r||n(),r?e.transition().duration(t).on("end",n):e},Bi=e=>{const t=e.ctrlKey&&tn()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function df({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:i,zoomOnPinch:o,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:l}){return d=>{if(Xe(d,t))return!1;d.preventDefault(),d.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(d.ctrlKey&&o){const N=de(d),y=Bi(d),E=f*Math.pow(2,y);r.scaleTo(n,E,N,d);return}const u=d.deltaMode===1?20:1;let p=s===He.Vertical?0:d.deltaX*u,g=s===He.Horizontal?0:d.deltaY*u;!tn()&&d.shiftKey&&s!==He.Vertical&&(p=d.deltaY*u,g=0),r.translateBy(n,-(p/f)*i,-(g/f)*i,{internal:!0});const m=hn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling||(e.isPanScrolling=!0,a==null||a(d,m)),e.isPanScrolling&&(c==null||c(d,m),e.panScrollTimeout=setTimeout(()=>{l==null||l(d,m),e.isPanScrolling=!1},150))}}function ff({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,s){if(!t&&r.type==="wheel"&&!r.ctrlKey||Xe(r,e))return null;r.preventDefault(),n.call(this,r,s)}}function hf({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,o,a;if((i=r.sourceEvent)!=null&&i.internal)return;const s=hn(r.transform);e.mouseButton=((o=r.sourceEvent)==null?void 0:o.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=s,((a=r.sourceEvent)==null?void 0:a.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,s))}}function pf({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return i=>{var o,a;e.usedRightMouseButton=!!(n&&Fi(t,e.mouseButton??0)),(o=i.sourceEvent)!=null&&o.sync||r([i.transform.x,i.transform.y,i.transform.k]),s&&!((a=i.sourceEvent)!=null&&a.internal)&&(s==null||s(i.sourceEvent,hn(i.transform)))}}function gf({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:s,onPaneContextMenu:i}){return o=>{var a;if(!((a=o.sourceEvent)!=null&&a.internal)&&(e.isZoomingOrPanning=!1,i&&Fi(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&i(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),s&&uf(e.prevViewport,o.transform))){const c=hn(o.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(o.sourceEvent,c)},n?150:0)}}}function mf({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:s,zoomOnDoubleClick:i,userSelectionActive:o,noWheelClassName:a,noPanClassName:c,lib:l}){return d=>{var g;const f=e||t,u=n&&d.ctrlKey;if(d.button===1&&d.type==="mousedown"&&(Xe(d,`${l}-flow__node`)||Xe(d,`${l}-flow__edge`)))return!0;if(!r&&!f&&!s&&!i&&!n||o||Xe(d,a)&&d.type==="wheel"||Xe(d,c)&&(d.type!=="wheel"||s&&d.type==="wheel"&&!e)||!n&&d.ctrlKey&&d.type==="wheel")return!1;if(!n&&d.type==="touchstart"&&((g=d.touches)==null?void 0:g.length)>1)return d.preventDefault(),!1;if(!f&&!s&&!u&&d.type==="wheel"||!r&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(r)&&!r.includes(d.button)&&d.type==="mousedown")return!1;const p=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||d.type==="wheel")&&p}}function xf({domNode:e,minZoom:t,maxZoom:n,paneClickDistance:r,translateExtent:s,viewport:i,onPanZoom:o,onPanZoomStart:a,onPanZoomEnd:c,onDraggingChange:l}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=e.getBoundingClientRect(),u=pi().clickDistance(!he(r)||r<0?0:r).scaleExtent([t,n]).translateExtent(s),p=ce(e).call(u);v({x:i.x,y:i.y,zoom:Qe(i.zoom,t,n)},[[0,0],[f.width,f.height]],s);const g=p.on("wheel.zoom"),m=p.on("dblclick.zoom");u.wheelDelta(Bi);function N(T,D){return p?new Promise(x=>{u==null||u.transform(An(p,D==null?void 0:D.duration,()=>x(!0)),T)}):Promise.resolve(!1)}function y({noWheelClassName:T,noPanClassName:D,onPaneContextMenu:x,userSelectionActive:k,panOnScroll:_,panOnDrag:I,panOnScrollMode:b,panOnScrollSpeed:S,preventScrolling:z,zoomOnPinch:H,zoomOnScroll:F,zoomOnDoubleClick:Y,zoomActivationKeyPressed:V,lib:O,onTransformChange:X}){k&&!d.isZoomingOrPanning&&E();const B=_&&!V&&!k?df({zoomPanValues:d,noWheelClassName:T,d3Selection:p,d3Zoom:u,panOnScrollMode:b,panOnScrollSpeed:S,zoomOnPinch:H,onPanZoomStart:a,onPanZoom:o,onPanZoomEnd:c}):ff({noWheelClassName:T,preventScrolling:z,d3ZoomHandler:g});if(p.on("wheel.zoom",B,{passive:!1}),!k){const Z=hf({zoomPanValues:d,onDraggingChange:l,onPanZoomStart:a});u.on("start",Z);const U=pf({zoomPanValues:d,panOnDrag:I,onPaneContextMenu:!!x,onPanZoom:o,onTransformChange:X});u.on("zoom",U);const G=gf({zoomPanValues:d,panOnDrag:I,panOnScroll:_,onPaneContextMenu:x,onPanZoomEnd:c,onDraggingChange:l});u.on("end",G)}const K=mf({zoomActivationKeyPressed:V,panOnDrag:I,zoomOnScroll:F,panOnScroll:_,zoomOnDoubleClick:Y,zoomOnPinch:H,userSelectionActive:k,noPanClassName:D,noWheelClassName:T,lib:O});u.filter(K),Y?p.on("dblclick.zoom",m):p.on("dblclick.zoom",null)}function E(){u.on("zoom",null)}async function v(T,D,x){const k=zn(T),_=u==null?void 0:u.constrain()(k,D,x);return _&&await N(_),new Promise(I=>I(_))}async function w(T,D){const x=zn(T);return await N(x,D),new Promise(k=>k(x))}function j(T){if(p){const D=zn(T),x=p.property("__zoom");(x.k!==T.zoom||x.x!==T.x||x.y!==T.y)&&(u==null||u.transform(p,D,null,{sync:!0}))}}function R(){const T=p?hi(p.node()):{x:0,y:0,k:1};return{x:T.x,y:T.y,zoom:T.k}}function C(T,D){return p?new Promise(x=>{u==null||u.scaleTo(An(p,D==null?void 0:D.duration,()=>x(!0)),T)}):Promise.resolve(!1)}function $(T,D){return p?new Promise(x=>{u==null||u.scaleBy(An(p,D==null?void 0:D.duration,()=>x(!0)),T)}):Promise.resolve(!1)}function A(T){u==null||u.scaleExtent(T)}function P(T){u==null||u.translateExtent(T)}function L(T){const D=!he(T)||T<0?0:T;u==null||u.clickDistance(D)}return{update:y,destroy:E,setViewport:w,setViewportConstrained:v,getViewport:R,scaleTo:C,scaleBy:$,setScaleExtent:A,setTranslateExtent:P,syncViewport:j,setClickDistance:L}}var ht;(function(e){e.Line="line",e.Handle="handle"})(ht||(ht={}));function yf({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:s,affectsY:i}){const o=e-t,a=n-r,c=[o>0?1:o<0?-1:0,a>0?1:a<0?-1:0];return o&&s&&(c[0]=c[0]*-1),a&&i&&(c[1]=c[1]*-1),c}function wf(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),s=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:s}}function je(e,t){return Math.max(0,t-e)}function Me(e,t){return Math.max(0,e-t)}function Rt(e,t,n){return Math.max(0,t-e,e-n)}function os(e,t){return e?!t:t}function vf(e,t,n,r,s,i,o,a){let{affectsX:c,affectsY:l}=t;const{isHorizontal:d,isVertical:f}=t,u=d&&f,{xSnapped:p,ySnapped:g}=n,{minWidth:m,maxWidth:N,minHeight:y,maxHeight:E}=r,{x:v,y:w,width:j,height:R,aspectRatio:C}=e;let $=Math.floor(d?p-e.pointerX:0),A=Math.floor(f?g-e.pointerY:0);const P=j+(c?-$:$),L=R+(l?-A:A),T=-i[0]*j,D=-i[1]*R;let x=Rt(P,m,N),k=Rt(L,y,E);if(o){let b=0,S=0;c&&$<0?b=je(v+$+T,o[0][0]):!c&&$>0&&(b=Me(v+P+T,o[1][0])),l&&A<0?S=je(w+A+D,o[0][1]):!l&&A>0&&(S=Me(w+L+D,o[1][1])),x=Math.max(x,b),k=Math.max(k,S)}if(a){let b=0,S=0;c&&$>0?b=Me(v+$,a[0][0]):!c&&$<0&&(b=je(v+P,a[1][0])),l&&A>0?S=Me(w+A,a[0][1]):!l&&A<0&&(S=je(w+L,a[1][1])),x=Math.max(x,b),k=Math.max(k,S)}if(s){if(d){const b=Rt(P/C,y,E)*C;if(x=Math.max(x,b),o){let S=0;!c&&!l||c&&!l&&u?S=Me(w+D+P/C,o[1][1])*C:S=je(w+D+(c?$:-$)/C,o[0][1])*C,x=Math.max(x,S)}if(a){let S=0;!c&&!l||c&&!l&&u?S=je(w+P/C,a[1][1])*C:S=Me(w+(c?$:-$)/C,a[0][1])*C,x=Math.max(x,S)}}if(f){const b=Rt(L*C,m,N)/C;if(k=Math.max(k,b),o){let S=0;!c&&!l||l&&!c&&u?S=Me(v+L*C+T,o[1][0])/C:S=je(v+(l?A:-A)*C+T,o[0][0])/C,k=Math.max(k,S)}if(a){let S=0;!c&&!l||l&&!c&&u?S=je(v+L*C,a[1][0])/C:S=Me(v+(l?A:-A)*C,a[0][0])/C,k=Math.max(k,S)}}}A=A+(A<0?k:-k),$=$+($<0?x:-x),s&&(u?P>L*C?A=(os(c,l)?-$:$)/C:$=(os(c,l)?-A:A)*C:d?(A=$/C,l=c):($=A*C,c=l));const _=c?v+$:v,I=l?w+A:w;return{width:j+(c?-$:$),height:R+(l?-A:A),x:i[0]*$*(c?-1:1)+_,y:i[1]*A*(l?-1:1)+I}}const Vi={width:0,height:0,x:0,y:0},bf={...Vi,pointerX:0,pointerY:0,aspectRatio:1};function Nf(e){return[[0,0],[e.measured.width,e.measured.height]]}function _f(e,t,n){const r=t.position.x+e.position.x,s=t.position.y+e.position.y,i=e.measured.width??0,o=e.measured.height??0,a=n[0]*i,c=n[1]*o;return[[r-a,s-c],[r+i-a,s+o-c]]}function Ef({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:s}){const i=ce(e);function o({controlPosition:c,boundaries:l,keepAspectRatio:d,onResizeStart:f,onResize:u,onResizeEnd:p,shouldResize:g}){let m={...Vi},N={...bf};const y=wf(c);let E,v=null,w=[],j,R,C;const $=Js().on("start",A=>{const{nodeLookup:P,transform:L,snapGrid:T,snapToGrid:D,nodeOrigin:x,paneDomNode:k}=n();if(E=P.get(t),!E)return;v=(k==null?void 0:k.getBoundingClientRect())??null;const{xSnapped:_,ySnapped:I}=ft(A.sourceEvent,{transform:L,snapGrid:T,snapToGrid:D,containerBounds:v});m={width:E.measured.width??0,height:E.measured.height??0,x:E.position.x??0,y:E.position.y??0},N={...m,pointerX:_,pointerY:I,aspectRatio:m.width/m.height},j=void 0,E.parentId&&(E.extent==="parent"||E.expandParent)&&(j=P.get(E.parentId),R=j&&E.extent==="parent"?Nf(j):void 0),w=[],C=void 0;for(const[b,S]of P)if(S.parentId===t&&(w.push({id:b,position:{...S.position},extent:S.extent}),S.extent==="parent"||S.expandParent)){const z=_f(S,E,S.origin??x);C?C=[[Math.min(z[0][0],C[0][0]),Math.min(z[0][1],C[0][1])],[Math.max(z[1][0],C[1][0]),Math.max(z[1][1],C[1][1])]]:C=z}f==null||f(A,{...m})}).on("drag",A=>{const{transform:P,snapGrid:L,snapToGrid:T,nodeOrigin:D}=n(),x=ft(A.sourceEvent,{transform:P,snapGrid:L,snapToGrid:T,containerBounds:v}),k=[];if(!E)return;const{x:_,y:I,width:b,height:S}=m,z={},H=E.origin??D,{width:F,height:Y,x:V,y:O}=vf(N,y,x,l,d,H,R,C),X=F!==b,W=Y!==S,B=V!==_&&X,K=O!==I&&W;if(!B&&!K&&!X&&!W)return;if((B||K||H[0]===1||H[1]===1)&&(z.x=B?V:m.x,z.y=K?O:m.y,m.x=z.x,m.y=z.y,w.length>0)){const J=V-_,ee=O-I;for(const ie of w)ie.position={x:ie.position.x-J+H[0]*(F-b),y:ie.position.y-ee+H[1]*(Y-S)},k.push(ie)}if((X||W)&&(z.width=X?F:m.width,z.height=W?Y:m.height,m.width=z.width,m.height=z.height),j&&E.expandParent){const J=H[0]*(z.width??0);z.x&&z.x<J&&(m.x=J,N.x=N.x-(z.x-J));const ee=H[1]*(z.height??0);z.y&&z.y<ee&&(m.y=ee,N.y=N.y-(z.y-ee))}const Z=yf({width:m.width,prevWidth:b,height:m.height,prevHeight:S,affectsX:y.affectsX,affectsY:y.affectsY}),U={...m,direction:Z};(g==null?void 0:g(A,U))!==!1&&(u==null||u(A,U),r(z,k))}).on("end",A=>{p==null||p(A,{...m}),s==null||s()});i.call($)}function a(){i.on(".drag",null)}return{update:o,destroy:a}}var Oi={exports:{}},Xi={},Yi={exports:{}},qi={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* use-sync-external-store-shim.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var tt=M;function Sf(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var kf=typeof Object.is=="function"?Object.is:Sf,Cf=tt.useState,jf=tt.useEffect,Mf=tt.useLayoutEffect,$f=tt.useDebugValue;function If(e,t){var n=t(),r=Cf({inst:{value:n,getSnapshot:t}}),s=r[0].inst,i=r[1];return Mf(function(){s.value=n,s.getSnapshot=t,Tn(s)&&i({inst:s})},[e,n,t]),jf(function(){return Tn(s)&&i({inst:s}),e(function(){Tn(s)&&i({inst:s})})},[e]),$f(n),n}function Tn(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!kf(e,n)}catch{return!0}}function zf(e,t){return t()}var Af=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?zf:If;qi.useSyncExternalStore=tt.useSyncExternalStore!==void 0?tt.useSyncExternalStore:Af;Yi.exports=qi;var Tf=Yi.exports;/**
|
|
10
|
+
* @license React
|
|
11
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var pn=M,Pf=Tf;function Df(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Rf=typeof Object.is=="function"?Object.is:Df,Hf=Pf.useSyncExternalStore,Lf=pn.useRef,Ff=pn.useEffect,Bf=pn.useMemo,Vf=pn.useDebugValue;Xi.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var i=Lf(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=Bf(function(){function c(p){if(!l){if(l=!0,d=p,p=r(p),s!==void 0&&o.hasValue){var g=o.value;if(s(g,p))return f=g}return f=p}if(g=f,Rf(d,p))return g;var m=r(p);return s!==void 0&&s(g,m)?(d=p,g):(d=p,f=m)}var l=!1,d,f,u=n===void 0?null:n;return[function(){return c(t())},u===null?void 0:function(){return c(u())}]},[t,n,r,s]);var a=Hf(e,i[0],i[1]);return Ff(function(){o.hasValue=!0,o.value=a},[a]),Vf(a),a};Oi.exports=Xi;var Of=Oi.exports;const Xf=Ha(Of),Yf={},as=e=>{let t;const n=new Set,r=(d,f)=>{const u=typeof d=="function"?d(t):d;if(!Object.is(u,t)){const p=t;t=f??(typeof u!="object"||u===null)?u:Object.assign({},t,u),n.forEach(g=>g(t,p))}},s=()=>t,c={setState:r,getState:s,getInitialState:()=>l,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(Yf?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},l=t=e(r,s,c);return c},qf=e=>e?as(e):as,{useDebugValue:Wf}=La,{useSyncExternalStoreWithSelector:Gf}=Xf,Kf=e=>e;function Wi(e,t=Kf,n){const r=Gf(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Wf(r),r}const cs=(e,t)=>{const n=qf(e),r=(s,i=t)=>Wi(n,s,i);return Object.assign(r,n),r},Uf=(e,t)=>e?cs(e,t):cs;function re(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,s]of e)if(!Object.is(s,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const gn=M.createContext(null),Zf=gn.Provider,Gi=Ee.error001();function Q(e,t){const n=M.useContext(gn);if(n===null)throw new Error(Gi);return Wi(n,e,t)}function te(){const e=M.useContext(gn);if(e===null)throw new Error(Gi);return M.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const ls={display:"none"},Qf={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Ki="react-flow__node-desc",Ui="react-flow__edge-desc",Jf="react-flow__aria-live",eh=e=>e.ariaLiveMessage;function th({rfId:e}){const t=Q(eh);return h.jsx("div",{id:`${Jf}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Qf,children:t})}function nh({rfId:e,disableKeyboardA11y:t}){return h.jsxs(h.Fragment,{children:[h.jsxs("div",{id:`${Ki}-${e}`,style:ls,children:["Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "]}),h.jsx("div",{id:`${Ui}-${e}`,style:ls,children:"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."}),!t&&h.jsx(th,{rfId:e})]})}const rh=e=>e.userSelectionActive?"none":"all",yr=M.forwardRef(({position:e="top-left",children:t,className:n,style:r,...s},i)=>{const o=Q(rh),a=`${e}`.split("-");return h.jsx("div",{className:se(["react-flow__panel",n,...a]),style:{...r,pointerEvents:o},ref:i,...s,children:t})});function sh({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:h.jsx(yr,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:h.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const ih=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},Ht=e=>e.id;function oh(e,t){return re(e.selectedNodes.map(Ht),t.selectedNodes.map(Ht))&&re(e.selectedEdges.map(Ht),t.selectedEdges.map(Ht))}function ah({onSelectionChange:e}){const t=te(),{selectedNodes:n,selectedEdges:r}=Q(ih,oh);return M.useEffect(()=>{const s={nodes:n,edges:r};e==null||e(s),t.getState().onSelectionChangeHandlers.forEach(i=>i(s))},[n,r,e]),null}const ch=e=>!!e.onSelectionChangeHandlers;function lh({onSelectionChange:e}){const t=Q(ch);return e||t?h.jsx(ah,{onSelectionChange:e}):null}const Zi=[0,0],uh={x:0,y:0,zoom:1},dh=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","onBeforeDelete","debug","autoPanSpeed","paneClickDistance"],us=[...dh,"rfId"],fh=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setPaneClickDistance:e.setPaneClickDistance}),ds={translateExtent:vt,nodeOrigin:Zi,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1",paneClickDistance:0};function hh(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:s,setTranslateExtent:i,setNodeExtent:o,reset:a,setDefaultNodesAndEdges:c,setPaneClickDistance:l}=Q(fh,re),d=te();M.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{f.current=ds,a()}),[]);const f=M.useRef(ds);return M.useEffect(()=>{for(const u of us){const p=e[u],g=f.current[u];p!==g&&(typeof e[u]>"u"||(u==="nodes"?t(p):u==="edges"?n(p):u==="minZoom"?r(p):u==="maxZoom"?s(p):u==="translateExtent"?i(p):u==="nodeExtent"?o(p):u==="paneClickDistance"?l(p):u==="fitView"?d.setState({fitViewOnInit:p}):u==="fitViewOptions"?d.setState({fitViewOnInitOptions:p}):d.setState({[u]:p})))}f.current=e},us.map(u=>e[u])),null}function fs(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function ph(e){var r;const[t,n]=M.useState(e==="system"?null:e);return M.useEffect(()=>{if(e!=="system"){n(e);return}const s=fs(),i=()=>n(s!=null&&s.matches?"dark":"light");return i(),s==null||s.addEventListener("change",i),()=>{s==null||s.removeEventListener("change",i)}},[e]),t!==null?t:(r=fs())!=null&&r.matches?"dark":"light"}const hs=typeof document<"u"?document:null;function Et(e=null,t={target:hs,actInsideInputWithModifier:!0}){const[n,r]=M.useState(!1),s=M.useRef(!1),i=M.useRef(new Set([])),[o,a]=M.useMemo(()=>{if(e!==null){const l=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",`
|
|
18
|
+
`).replace(`
|
|
19
|
+
|
|
20
|
+
`,`
|
|
21
|
+
+`).split(`
|
|
22
|
+
`)),d=l.reduce((f,u)=>f.concat(...u),[]);return[l,d]}return[[],[]]},[e]);return M.useEffect(()=>{const c=(t==null?void 0:t.target)||hs;if(e!==null){const l=u=>{if(s.current=u.ctrlKey||u.metaKey||u.shiftKey,(!s.current||s.current&&!t.actInsideInputWithModifier)&&Zn(u))return!1;const g=gs(u.code,a);i.current.add(u[g]),ps(o,i.current,!1)&&(u.preventDefault(),r(!0))},d=u=>{if((!s.current||s.current&&!t.actInsideInputWithModifier)&&Zn(u))return!1;const g=gs(u.code,a);ps(o,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(u[g]),u.key==="Meta"&&i.current.clear(),s.current=!1},f=()=>{i.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",l),c==null||c.addEventListener("keyup",d),window.addEventListener("blur",f),window.addEventListener("contextmenu",f),()=>{c==null||c.removeEventListener("keydown",l),c==null||c.removeEventListener("keyup",d),window.removeEventListener("blur",f),window.removeEventListener("contextmenu",f)}}},[e,r]),n}function ps(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function gs(e,t){return t.includes(e)?"code":"key"}const gh=()=>{const e=te();return M.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,{duration:n==null?void 0:n.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,s,i],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??s,zoom:t.zoom??i},{duration:n==null?void 0:n.duration}),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},fitView:t=>{const{nodeLookup:n,minZoom:r,maxZoom:s,panZoom:i,domNode:o}=e.getState();if(!i||!o)return Promise.resolve(!1);const a=Gn(n,t),{width:c,height:l}=fn(o);return Kn({nodes:a,width:c,height:l,minZoom:r,maxZoom:s,panZoom:i},t)},setCenter:async(t,n,r)=>{const{width:s,height:i,maxZoom:o,panZoom:a}=e.getState(),c=typeof(r==null?void 0:r.zoom)<"u"?r.zoom:o,l=s/2-t*c,d=i/2-n*c;return a?(await a.setViewport({x:l,y:d,zoom:c},{duration:r==null?void 0:r.duration}),Promise.resolve(!0)):Promise.resolve(!1)},fitBounds:async(t,n)=>{const{width:r,height:s,minZoom:i,maxZoom:o,panZoom:a}=e.getState(),c=hr(t,r,s,i,o,(n==null?void 0:n.padding)??.1);return a?(await a.setViewport(c,{duration:n==null?void 0:n.duration}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={snapToGrid:!0})=>{const{transform:r,snapGrid:s,domNode:i}=e.getState();if(!i)return t;const{x:o,y:a}=i.getBoundingClientRect(),c={x:t.x-o,y:t.y-a};return Mt(c,r,n.snapToGrid,s)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:s,y:i}=r.getBoundingClientRect(),o=Ei(t,n);return{x:o.x+s,y:o.y+i}}}),[])};function Qi(e,t){const n=[],r=new Map,s=[];for(const i of e)if(i.type==="add"){s.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const o=r.get(i.id);o?o.push(i):r.set(i.id,[i])}for(const i of t){const o=r.get(i.id);if(!o){n.push(i);continue}if(o[0].type==="remove")continue;if(o[0].type==="replace"){n.push({...o[0].item});continue}const a={...i};for(const c of o)mh(c,a);n.push(a)}return s.length&&s.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function mh(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured??(t.measured={}),t.measured.width=e.dimensions.width,t.measured.height=e.dimensions.height,e.setAttributes&&(t.width=e.dimensions.width,t.height=e.dimensions.height)),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function xh(e,t){return Qi(e,t)}function yh(e,t){return Qi(e,t)}function Pe(e,t){return{id:e,type:"select",selected:t}}function Ye(e,t=new Set,n=!1){const r=[];for(const[s,i]of e){const o=t.has(s);!(i.selected===void 0&&!o)&&i.selected!==o&&(n&&(i.selected=o),r.push(Pe(i.id,o)))}return r}function ms({items:e=[],lookup:t}){var s;const n=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,o]of e.entries()){const a=t.get(o.id),c=((s=a==null?void 0:a.internals)==null?void 0:s.userNode)??a;c!==void 0&&c!==o&&n.push({id:o.id,item:o,type:"replace"}),c===void 0&&n.push({item:o,type:"add",index:i})}for(const[i]of t)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function xs(e){return{id:e.id,type:"remove"}}const ys=e=>Ad(e),wh=e=>yi(e);function Ji(e){return M.forwardRef(e)}const vh=typeof window<"u"?M.useLayoutEffect:M.useEffect;function ws(e){const[t,n]=M.useState(BigInt(0)),[r]=M.useState(()=>bh(()=>n(s=>s+BigInt(1))));return vh(()=>{const s=r.get();s.length&&(e(s),r.reset())},[t]),r}function bh(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const eo=M.createContext(null);function Nh({children:e}){const t=te(),n=M.useCallback(a=>{const{nodes:c=[],setNodes:l,hasDefaultNodes:d,onNodesChange:f,nodeLookup:u}=t.getState();let p=c;for(const g of a)p=typeof g=="function"?g(p):g;d?l(p):f&&f(ms({items:p,lookup:u}))},[]),r=ws(n),s=M.useCallback(a=>{const{edges:c=[],setEdges:l,hasDefaultEdges:d,onEdgesChange:f,edgeLookup:u}=t.getState();let p=c;for(const g of a)p=typeof g=="function"?g(p):g;d?l(p):f&&f(ms({items:p,lookup:u}))},[]),i=ws(s),o=M.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return h.jsx(eo.Provider,{value:o,children:e})}function _h(){const e=M.useContext(eo);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Eh=e=>!!e.panZoom;function wr(){const e=gh(),t=te(),n=_h(),r=Q(Eh),s=M.useMemo(()=>{const i=f=>t.getState().nodeLookup.get(f),o=f=>{n.nodeQueue.push(f)},a=f=>{n.edgeQueue.push(f)},c=f=>{var y,E;const{nodeLookup:u,nodeOrigin:p}=t.getState(),g=ys(f)?f:u.get(f.id),m=g.parentId?ki(g.position,g.measured,g.parentId,u,p):g.position,N={...g,position:m,width:((y=g.measured)==null?void 0:y.width)??g.width,height:((E=g.measured)==null?void 0:E.height)??g.height};return Je(N)},l=(f,u,p={replace:!1})=>{o(g=>g.map(m=>{if(m.id===f){const N=typeof u=="function"?u(m):u;return p.replace&&ys(N)?N:{...m,...N}}return m}))},d=(f,u,p={replace:!1})=>{a(g=>g.map(m=>{if(m.id===f){const N=typeof u=="function"?u(m):u;return p.replace&&wh(N)?N:{...m,...N}}return m}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>{var u;return(u=i(f))==null?void 0:u.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(u=>({...u}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:o,setEdges:a,addNodes:f=>{const u=Array.isArray(f)?f:[f];n.nodeQueue.push(p=>[...p,...u])},addEdges:f=>{const u=Array.isArray(f)?f:[f];n.edgeQueue.push(p=>[...p,...u])},toObject:()=>{const{nodes:f=[],edges:u=[],transform:p}=t.getState(),[g,m,N]=p;return{nodes:f.map(y=>({...y})),edges:u.map(y=>({...y})),viewport:{x:g,y:m,zoom:N}}},deleteElements:async({nodes:f=[],edges:u=[]})=>{const{nodes:p,edges:g,onNodesDelete:m,onEdgesDelete:N,triggerNodeChanges:y,triggerEdgeChanges:E,onDelete:v,onBeforeDelete:w}=t.getState(),{nodes:j,edges:R}=await Dd({nodesToRemove:f,edgesToRemove:u,nodes:p,edges:g,onBeforeDelete:w}),C=R.length>0,$=j.length>0;if(C){const A=R.map(xs);N==null||N(R),E(A)}if($){const A=j.map(xs);m==null||m(j),y(A)}return($||C)&&(v==null||v({nodes:j,edges:R})),{deletedNodes:j,deletedEdges:R}},getIntersectingNodes:(f,u=!0,p)=>{const g=Zr(f),m=g?f:c(f),N=p!==void 0;return m?(p||t.getState().nodes).filter(y=>{const E=t.getState().nodeLookup.get(y.id);if(E&&!g&&(y.id===f.id||!E.internals.positionAbsolute))return!1;const v=Je(N?y:E),w=Nt(v,m);return u&&w>0||w>=m.width*m.height}):[]},isNodeIntersecting:(f,u,p=!0)=>{const m=Zr(f)?f:c(f);if(!m)return!1;const N=Nt(m,u);return p&&N>0||N>=m.width*m.height},updateNode:l,updateNodeData:(f,u,p={replace:!1})=>{l(f,g=>{const m=typeof u=="function"?u(g):u;return p.replace?{...g,data:m}:{...g,data:{...g.data,...m}}},p)},updateEdge:d,updateEdgeData:(f,u,p={replace:!1})=>{d(f,g=>{const m=typeof u=="function"?u(g):u;return p.replace?{...g,data:m}:{...g,data:{...g.data,...m}}},p)},getNodesBounds:f=>{const{nodeLookup:u,nodeOrigin:p}=t.getState();return Td(f,{nodeLookup:u,nodeOrigin:p})},getHandleConnections:({type:f,id:u,nodeId:p})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${p}-${f}-${u??null}`))==null?void 0:g.values())??[])}}},[]);return M.useMemo(()=>({...s,...e,viewportInitialized:r}),[r])}const vs=e=>e.selected,Sh={actInsideInputWithModifier:!1},kh=typeof window<"u"?window:void 0;function Ch({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=te(),{deleteElements:r}=wr(),s=Et(e,Sh),i=Et(t,{target:kh});M.useEffect(()=>{if(s){const{edges:o,nodes:a}=n.getState();r({nodes:a.filter(vs),edges:o.filter(vs)}),n.setState({nodesSelectionActive:!1})}},[s]),M.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function jh(e){const t=te();M.useEffect(()=>{const n=()=>{var s,i;if(!e.current)return!1;const r=fn(e.current);(r.height===0||r.width===0)&&((i=(s=t.getState()).onError)==null||i.call(s,"004",Ee.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const mn={position:"absolute",width:"100%",height:"100%",top:0,left:0},Mh=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib});function $h({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:i=He.Free,zoomOnDoubleClick:o=!0,panOnDrag:a=!0,defaultViewport:c,translateExtent:l,minZoom:d,maxZoom:f,zoomActivationKeyCode:u,preventScrolling:p=!0,children:g,noWheelClassName:m,noPanClassName:N,onViewportChange:y,isControlledViewport:E,paneClickDistance:v}){const w=te(),j=M.useRef(null),{userSelectionActive:R,lib:C}=Q(Mh,re),$=Et(u),A=M.useRef();jh(j);const P=M.useCallback(L=>{y==null||y({x:L[0],y:L[1],zoom:L[2]}),E||w.setState({transform:L})},[y,E]);return M.useEffect(()=>{if(j.current){A.current=xf({domNode:j.current,minZoom:d,maxZoom:f,translateExtent:l,viewport:c,paneClickDistance:v,onDraggingChange:x=>w.setState({paneDragging:x}),onPanZoomStart:(x,k)=>{const{onViewportChangeStart:_,onMoveStart:I}=w.getState();I==null||I(x,k),_==null||_(k)},onPanZoom:(x,k)=>{const{onViewportChange:_,onMove:I}=w.getState();I==null||I(x,k),_==null||_(k)},onPanZoomEnd:(x,k)=>{const{onViewportChangeEnd:_,onMoveEnd:I}=w.getState();I==null||I(x,k),_==null||_(k)}});const{x:L,y:T,zoom:D}=A.current.getViewport();return w.setState({panZoom:A.current,transform:[L,T,D],domNode:j.current.closest(".react-flow")}),()=>{var x;(x=A.current)==null||x.destroy()}}},[]),M.useEffect(()=>{var L;(L=A.current)==null||L.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:i,zoomOnDoubleClick:o,panOnDrag:a,zoomActivationKeyPressed:$,preventScrolling:p,noPanClassName:N,userSelectionActive:R,noWheelClassName:m,lib:C,onTransformChange:P})},[e,t,n,r,s,i,o,a,$,p,N,R,m,C,P]),h.jsx("div",{className:"react-flow__renderer",ref:j,style:mn,children:g})}const Ih=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function zh(){const{userSelectionActive:e,userSelectionRect:t}=Q(Ih,re);return e&&t?h.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const Pn=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},Ah=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging});function Th({isSelecting:e,selectionKeyPressed:t,selectionMode:n=bt.Full,panOnDrag:r,selectionOnDrag:s,onSelectionStart:i,onSelectionEnd:o,onPaneClick:a,onPaneContextMenu:c,onPaneScroll:l,onPaneMouseEnter:d,onPaneMouseMove:f,onPaneMouseLeave:u,children:p}){const g=M.useRef(null),m=te(),N=M.useRef(0),y=M.useRef(0),E=M.useRef(),v=M.useRef(new Map),{userSelectionActive:w,elementsSelectable:j,dragging:R}=Q(Ah,re),C=j&&(e||w),$=M.useRef(!1),A=M.useRef(!1),P=()=>{m.setState({userSelectionActive:!1,userSelectionRect:null}),N.current=0,y.current=0},L=b=>{if($.current){$.current=!1;return}a==null||a(b),m.getState().resetSelectedElements(),m.setState({nodesSelectionActive:!1})},T=b=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){b.preventDefault();return}c==null||c(b)},D=l?b=>l(b):void 0,x=b=>{var V,O,X,W;const{resetSelectedElements:S,domNode:z,edgeLookup:H}=m.getState();if(E.current=z==null?void 0:z.getBoundingClientRect(),!j||!e||b.button!==0||b.target!==g.current||!E.current)return;(O=(V=b.target)==null?void 0:V.setPointerCapture)==null||O.call(V,b.pointerId),A.current=!0,$.current=!1,v.current=new Map;for(const[B,K]of H)v.current.set(K.source,((X=v.current.get(K.source))==null?void 0:X.add(B))||new Set([B])),v.current.set(K.target,((W=v.current.get(K.target))==null?void 0:W.add(B))||new Set([B]));const{x:F,y:Y}=ve(b.nativeEvent,E.current);S(),m.setState({userSelectionRect:{width:0,height:0,startX:F,startY:Y,x:F,y:Y}}),i==null||i(b)},k=b=>{const{userSelectionRect:S,edgeLookup:z,transform:H,nodeLookup:F,triggerNodeChanges:Y,triggerEdgeChanges:V}=m.getState();if(!E.current||!S)return;$.current=!0;const{x:O,y:X}=ve(b.nativeEvent,E.current),{startX:W,startY:B}=S,K={startX:W,startY:B,x:O<W?O:W,y:X<B?X:B,width:Math.abs(O-W),height:Math.abs(X-B)},Z=wi(F,K,H,n===bt.Partial,!0),U=new Set,G=new Set;for(const J of Z){G.add(J.id);const ee=v.current.get(J.id);if(ee)for(const ie of ee)U.add(ie)}if(N.current!==G.size){N.current=G.size;const J=Ye(F,G,!0);Y(J)}if(y.current!==U.size){y.current=U.size;const J=Ye(z,U);V(J)}m.setState({userSelectionRect:K,userSelectionActive:!0,nodesSelectionActive:!1})},_=b=>{var z,H;if(b.button!==0||!A.current)return;(H=(z=b.target)==null?void 0:z.releasePointerCapture)==null||H.call(z,b.pointerId);const{userSelectionRect:S}=m.getState();!w&&S&&b.target===g.current&&(L==null||L(b)),N.current>0&&m.setState({nodesSelectionActive:!0}),P(),o==null||o(b),(t||s)&&($.current=!1),A.current=!1},I=r===!0||Array.isArray(r)&&r.includes(0);return h.jsxs("div",{className:se(["react-flow__pane",{draggable:I,dragging:R,selection:e}]),onClick:C?void 0:Pn(L,g),onContextMenu:Pn(T,g),onWheel:Pn(D,g),onPointerEnter:C?void 0:d,onPointerDown:C?x:f,onPointerMove:C?k:f,onPointerUp:C?_:void 0,onPointerLeave:u,ref:g,style:mn,children:[p,h.jsx(zh,{})]})}function nr({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:o,nodeLookup:a,onError:c}=t.getState(),l=a.get(e);if(!l){c==null||c("012",Ee.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(i({nodes:[l],edges:[]}),requestAnimationFrame(()=>{var d;return(d=r==null?void 0:r.current)==null?void 0:d.blur()})):s([e])}function to({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,nodeClickDistance:o}){const a=te(),[c,l]=M.useState(!1),d=M.useRef();return M.useEffect(()=>{d.current=nf({getStoreItems:()=>a.getState(),onNodeMouseDown:f=>{nr({id:f,store:a,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}})},[]),M.useEffect(()=>{var f,u;if(t)(f=d.current)==null||f.destroy();else if(e.current)return(u=d.current)==null||u.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:s,nodeClickDistance:o}),()=>{var p;(p=d.current)==null||p.destroy()}},[n,r,t,i,e,s]),c}const Ph=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function no(){const e=te();return M.useCallback(n=>{const{nodeExtent:r,snapToGrid:s,snapGrid:i,nodesDraggable:o,onError:a,updateNodePositions:c,nodeLookup:l,nodeOrigin:d}=e.getState(),f=new Map,u=Ph(o),p=s?i[0]:5,g=s?i[1]:5,m=n.direction.x*p*n.factor,N=n.direction.y*g*n.factor;for(const[,y]of l){if(!u(y))continue;let E={x:y.internals.positionAbsolute.x+m,y:y.internals.positionAbsolute.y+N};s&&(E=dn(E,i));const{position:v,positionAbsolute:w}=vi({nodeId:y.id,nextPosition:E,nodeLookup:l,nodeExtent:r,nodeOrigin:d,onError:a});y.position=v,y.internals.positionAbsolute=w,f.set(y.id,y)}c(f)},[])}const vr=M.createContext(null),Dh=vr.Provider;vr.Consumer;const ro=()=>M.useContext(vr),Rh=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Hh=(e,t,n)=>r=>{const{connectionClickStartHandle:s,connectionMode:i,connection:o}=r,{fromHandle:a,toHandle:c,isValid:l}=o,d=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.id)===t&&(a==null?void 0:a.type)===n,connectingTo:d,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===t&&(s==null?void 0:s.type)===n,isPossibleEndHandle:i===Ze.Strict?(a==null?void 0:a.type)!==n:e!==(a==null?void 0:a.nodeId)||t!==(a==null?void 0:a.id),connectionInProcess:!!a,valid:d&&l}};function Lh({type:e="source",position:t=q.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:o,onConnect:a,children:c,className:l,onMouseDown:d,onTouchStart:f,...u},p){var x,k;const g=o||null,m=e==="target",N=te(),y=ro(),{connectOnClick:E,noPanClassName:v,rfId:w}=Q(Rh,re),{connectingFrom:j,connectingTo:R,clickConnecting:C,isPossibleEndHandle:$,connectionInProcess:A,valid:P}=Q(Hh(y,g,e),re);y||(k=(x=N.getState()).onError)==null||k.call(x,"010",Ee.error010());const L=_=>{const{defaultEdgeOptions:I,onConnect:b,hasDefaultEdges:S}=N.getState(),z={...I,..._};if(S){const{edges:H,setEdges:F}=N.getState();F(Od(z,H))}b==null||b(z),a==null||a(z)},T=_=>{if(!y)return;const I=ji(_.nativeEvent);if(s&&(I&&_.button===0||!I)){const b=N.getState();tr.onPointerDown(_.nativeEvent,{autoPanOnConnect:b.autoPanOnConnect,connectionMode:b.connectionMode,connectionRadius:b.connectionRadius,domNode:b.domNode,nodeLookup:b.nodeLookup,lib:b.lib,isTarget:m,handleId:g,nodeId:y,flowId:b.rfId,panBy:b.panBy,cancelConnection:b.cancelConnection,onConnectStart:b.onConnectStart,onConnectEnd:b.onConnectEnd,updateConnection:b.updateConnection,onConnect:L,isValidConnection:n||b.isValidConnection,getTransform:()=>N.getState().transform,getFromHandle:()=>N.getState().connection.fromHandle,autoPanSpeed:b.autoPanSpeed})}I?d==null||d(_):f==null||f(_)},D=_=>{const{onClickConnectStart:I,onClickConnectEnd:b,connectionClickStartHandle:S,connectionMode:z,isValidConnection:H,lib:F,rfId:Y,nodeLookup:V,connection:O}=N.getState();if(!y||!S&&!s)return;if(!S){I==null||I(_.nativeEvent,{nodeId:y,handleId:g,handleType:e}),N.setState({connectionClickStartHandle:{nodeId:y,type:e,id:g}});return}const X=Ci(_.target),W=n||H,{connection:B,isValid:K}=tr.isValid(_.nativeEvent,{handle:{nodeId:y,id:g,type:e},connectionMode:z,fromNodeId:S.nodeId,fromHandleId:S.id||null,fromType:S.type,isValidConnection:W,flowId:Y,doc:X,lib:F,nodeLookup:V});K&&B&&L(B);const Z=structuredClone(O);delete Z.inProgress,Z.toPosition=Z.toHandle?Z.toHandle.position:null,b==null||b(_,Z),N.setState({connectionClickStartHandle:null})};return h.jsx("div",{"data-handleid":g,"data-nodeid":y,"data-handlepos":t,"data-id":`${w}-${y}-${g}-${e}`,className:se(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",v,l,{source:!m,target:m,connectable:r,connectablestart:s,connectableend:i,clickconnecting:C,connectingfrom:j,connectingto:R,valid:P,connectionindicator:r&&(!A||$)&&(A?i:s)}]),onMouseDown:T,onTouchStart:T,onClick:E?D:void 0,ref:p,...u,children:c})}const Te=M.memo(Ji(Lh));function Fh({data:e,isConnectable:t,sourcePosition:n=q.Bottom}){return h.jsxs(h.Fragment,{children:[e==null?void 0:e.label,h.jsx(Te,{type:"source",position:n,isConnectable:t})]})}function Bh({data:e,isConnectable:t,targetPosition:n=q.Top,sourcePosition:r=q.Bottom}){return h.jsxs(h.Fragment,{children:[h.jsx(Te,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,h.jsx(Te,{type:"source",position:r,isConnectable:t})]})}function Vh(){return null}function Oh({data:e,isConnectable:t,targetPosition:n=q.Top}){return h.jsxs(h.Fragment,{children:[h.jsx(Te,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const nn={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},bs={input:Fh,default:Bh,output:Oh,group:Vh};function Xh(e){var t,n,r,s;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((s=e.style)==null?void 0:s.height)}}const Yh=e=>{const{width:t,height:n,x:r,y:s}=jt(e.nodeLookup,{filter:i=>!!i.selected});return{width:he(t)?t:null,height:he(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${s}px)`}};function qh({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=te(),{width:s,height:i,transformString:o,userSelectionActive:a}=Q(Yh,re),c=no(),l=M.useRef(null);if(M.useEffect(()=>{var u;n||(u=l.current)==null||u.focus({preventScroll:!0})},[n]),to({nodeRef:l}),a||!s||!i)return null;const d=e?u=>{const p=r.getState().nodes.filter(g=>g.selected);e(u,p)}:void 0,f=u=>{Object.prototype.hasOwnProperty.call(nn,u.key)&&(u.preventDefault(),c({direction:nn[u.key],factor:u.shiftKey?4:1}))};return h.jsx("div",{className:se(["react-flow__nodesselection","react-flow__container",t]),style:{transform:o},children:h.jsx("div",{ref:l,className:"react-flow__nodesselection-rect",onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:f,style:{width:s,height:i}})})}const Ns=typeof window<"u"?window:void 0,Wh=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function so({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:o,paneClickDistance:a,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:d,selectionMode:f,onSelectionStart:u,onSelectionEnd:p,multiSelectionKeyCode:g,panActivationKeyCode:m,zoomActivationKeyCode:N,elementsSelectable:y,zoomOnScroll:E,zoomOnPinch:v,panOnScroll:w,panOnScrollSpeed:j,panOnScrollMode:R,zoomOnDoubleClick:C,panOnDrag:$,defaultViewport:A,translateExtent:P,minZoom:L,maxZoom:T,preventScrolling:D,onSelectionContextMenu:x,noWheelClassName:k,noPanClassName:_,disableKeyboardA11y:I,onViewportChange:b,isControlledViewport:S}){const{nodesSelectionActive:z,userSelectionActive:H}=Q(Wh),F=Et(l,{target:Ns}),Y=Et(m,{target:Ns}),V=Y||$,O=Y||w,X=d&&V!==!0,W=F||H||X;return Ch({deleteKeyCode:c,multiSelectionKeyCode:g}),h.jsx($h,{onPaneContextMenu:i,elementsSelectable:y,zoomOnScroll:E,zoomOnPinch:v,panOnScroll:O,panOnScrollSpeed:j,panOnScrollMode:R,zoomOnDoubleClick:C,panOnDrag:!F&&V,defaultViewport:A,translateExtent:P,minZoom:L,maxZoom:T,zoomActivationKeyCode:N,preventScrolling:D,noWheelClassName:k,noPanClassName:_,onViewportChange:b,isControlledViewport:S,paneClickDistance:a,children:h.jsxs(Th,{onSelectionStart:u,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:o,panOnDrag:V,isSelecting:!!W,selectionMode:f,selectionKeyPressed:F,selectionOnDrag:X,children:[e,z&&h.jsx(qh,{onSelectionContextMenu:x,noPanClassName:_,disableKeyboardA11y:I})]})})}so.displayName="FlowRenderer";const Gh=M.memo(so),Kh=e=>t=>e?wi(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function Uh(e){return Q(M.useCallback(Kh(e),[e]),re)}const Zh=e=>e.updateNodeInternals;function Qh(){const e=Q(Zh),[t]=M.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(s=>{const i=s.target.getAttribute("data-id");r.set(i,{id:i,nodeElement:s.target,force:!0})}),e(r)}));return M.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function Jh({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const s=te(),i=M.useRef(null),o=M.useRef(null),a=M.useRef(e.sourcePosition),c=M.useRef(e.targetPosition),l=M.useRef(t),d=n&&!!e.internals.handleBounds;return M.useEffect(()=>{i.current&&!e.hidden&&(!d||o.current!==i.current)&&(o.current&&(r==null||r.unobserve(o.current)),r==null||r.observe(i.current),o.current=i.current)},[d,e.hidden]),M.useEffect(()=>()=>{o.current&&(r==null||r.unobserve(o.current),o.current=null)},[]),M.useEffect(()=>{if(i.current){const f=l.current!==t,u=a.current!==e.sourcePosition,p=c.current!==e.targetPosition;(f||u||p)&&(l.current=t,a.current=e.sourcePosition,c.current=e.targetPosition,s.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function e0({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:s,onContextMenu:i,onDoubleClick:o,nodesDraggable:a,elementsSelectable:c,nodesConnectable:l,nodesFocusable:d,resizeObserver:f,noDragClassName:u,noPanClassName:p,disableKeyboardA11y:g,rfId:m,nodeTypes:N,nodeExtent:y,nodeClickDistance:E,onError:v}){const{node:w,internals:j,isParent:R}=Q(B=>{const K=B.nodeLookup.get(e),Z=B.parentLookup.has(e);return{node:K,internals:K.internals,isParent:Z}},re);let C=w.type||"default",$=(N==null?void 0:N[C])||bs[C];$===void 0&&(v==null||v("003",Ee.error003(C)),C="default",$=bs.default);const A=!!(w.draggable||a&&typeof w.draggable>"u"),P=!!(w.selectable||c&&typeof w.selectable>"u"),L=!!(w.connectable||l&&typeof w.connectable>"u"),T=!!(w.focusable||d&&typeof w.focusable>"u"),D=te(),x=Si(w),k=Jh({node:w,nodeType:C,hasDimensions:x,resizeObserver:f}),_=to({nodeRef:k,disabled:w.hidden||!A,noDragClassName:u,handleSelector:w.dragHandle,nodeId:e,isSelectable:P,nodeClickDistance:E}),I=no();if(w.hidden)return null;const b=Se(w),S=Xh(w),z=P||A||t||n||r||s,H=n?B=>n(B,{...j.userNode}):void 0,F=r?B=>r(B,{...j.userNode}):void 0,Y=s?B=>s(B,{...j.userNode}):void 0,V=i?B=>i(B,{...j.userNode}):void 0,O=o?B=>o(B,{...j.userNode}):void 0,X=B=>{const{selectNodesOnDrag:K,nodeDragThreshold:Z}=D.getState();P&&(!K||!A||Z>0)&&nr({id:e,store:D,nodeRef:k}),t&&t(B,{...j.userNode})},W=B=>{if(!(Zn(B.nativeEvent)||g))if(gi.includes(B.key)&&P){const K=B.key==="Escape";nr({id:e,store:D,unselect:K,nodeRef:k})}else A&&w.selected&&Object.prototype.hasOwnProperty.call(nn,B.key)&&(B.preventDefault(),D.setState({ariaLiveMessage:`Moved selected node ${B.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~j.positionAbsolute.x}, y: ${~~j.positionAbsolute.y}`}),I({direction:nn[B.key],factor:B.shiftKey?4:1}))};return h.jsx("div",{className:se(["react-flow__node",`react-flow__node-${C}`,{[p]:A},w.className,{selected:w.selected,selectable:P,parent:R,draggable:A,dragging:_}]),ref:k,style:{zIndex:j.z,transform:`translate(${j.positionAbsolute.x}px,${j.positionAbsolute.y}px)`,pointerEvents:z?"all":"none",visibility:x?"visible":"hidden",...w.style,...S},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:H,onMouseMove:F,onMouseLeave:Y,onContextMenu:V,onClick:X,onDoubleClick:O,onKeyDown:T?W:void 0,tabIndex:T?0:void 0,role:T?"button":void 0,"aria-describedby":g?void 0:`${Ki}-${m}`,"aria-label":w.ariaLabel,children:h.jsx(Dh,{value:e,children:h.jsx($,{id:e,data:w.data,type:C,positionAbsoluteX:j.positionAbsolute.x,positionAbsoluteY:j.positionAbsolute.y,selected:w.selected,selectable:P,draggable:A,deletable:w.deletable??!0,isConnectable:L,sourcePosition:w.sourcePosition,targetPosition:w.targetPosition,dragging:_,dragHandle:w.dragHandle,zIndex:j.z,parentId:w.parentId,...b})})})}const t0=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function io(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,onError:i}=Q(t0,re),o=Uh(e.onlyRenderVisibleElements),a=Qh();return h.jsx("div",{className:"react-flow__nodes",style:mn,children:o.map(c=>h.jsx(e0,{id:c,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:a,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,nodeClickDistance:e.nodeClickDistance,onError:i},c))})}io.displayName="NodeRenderer";const n0=M.memo(io);function r0(e){return Q(M.useCallback(n=>{if(!e)return n.edges.map(s=>s.id);const r=[];if(n.width&&n.height)for(const s of n.edges){const i=n.nodeLookup.get(s.source),o=n.nodeLookup.get(s.target);i&&o&&Fd({sourceNode:i,targetNode:o,width:n.width,height:n.height,transform:n.transform})&&r.push(s.id)}return r},[e]),re)}const s0=({color:e="none",strokeWidth:t=1})=>h.jsx("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),i0=({color:e="none",strokeWidth:t=1})=>h.jsx("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),_s={[Jt.Arrow]:s0,[Jt.ArrowClosed]:i0};function o0(e){const t=te();return M.useMemo(()=>{var s,i;return Object.prototype.hasOwnProperty.call(_s,e)?_s[e]:((i=(s=t.getState()).onError)==null||i.call(s,"009",Ee.error009(e)),null)},[e])}const a0=({id:e,type:t,color:n,width:r=12.5,height:s=12.5,markerUnits:i="strokeWidth",strokeWidth:o,orient:a="auto-start-reverse"})=>{const c=o0(t);return c?h.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:a,refX:"0",refY:"0",children:h.jsx(c,{color:n,strokeWidth:o})}):null},oo=({defaultColor:e,rfId:t})=>{const n=Q(i=>i.edges),r=Q(i=>i.defaultEdgeOptions),s=M.useMemo(()=>Gd(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return s.length?h.jsx("svg",{className:"react-flow__marker",children:h.jsx("defs",{children:s.map(i=>h.jsx(a0,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};oo.displayName="MarkerDefinitions";var c0=M.memo(oo);function ao({x:e,y:t,label:n,labelStyle:r={},labelShowBg:s=!0,labelBgStyle:i={},labelBgPadding:o=[2,4],labelBgBorderRadius:a=2,children:c,className:l,...d}){const[f,u]=M.useState({x:1,y:0,width:0,height:0}),p=se(["react-flow__edge-textwrapper",l]),g=M.useRef(null);return M.useEffect(()=>{if(g.current){const m=g.current.getBBox();u({x:m.x,y:m.y,width:m.width,height:m.height})}},[n]),typeof n>"u"||!n?null:h.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:p,visibility:f.width?"visible":"hidden",...d,children:[s&&h.jsx("rect",{width:f.width+2*o[0],x:-o[0],y:-o[1],height:f.height+2*o[1],className:"react-flow__edge-textbg",style:i,rx:a,ry:a}),h.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:g,style:r,children:n}),c]})}ao.displayName="EdgeText";const l0=M.memo(ao);function xn({path:e,labelX:t,labelY:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:o,labelBgPadding:a,labelBgBorderRadius:c,interactionWidth:l=20,...d}){return h.jsxs(h.Fragment,{children:[h.jsx("path",{...d,d:e,fill:"none",className:se(["react-flow__edge-path",d.className])}),l&&h.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:l,className:"react-flow__edge-interaction"}),r&&he(t)&&he(n)?h.jsx(l0,{x:t,y:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:o,labelBgPadding:a,labelBgBorderRadius:c}):null]})}function Es({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===q.Left||e===q.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function co({sourceX:e,sourceY:t,sourcePosition:n=q.Bottom,targetX:r,targetY:s,targetPosition:i=q.Top}){const[o,a]=Es({pos:n,x1:e,y1:t,x2:r,y2:s}),[c,l]=Es({pos:i,x1:r,y1:s,x2:e,y2:t}),[d,f,u,p]=Mi({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:o,sourceControlY:a,targetControlX:c,targetControlY:l});return[`M${e},${t} C${o},${a} ${c},${l} ${r},${s}`,d,f,u,p]}function lo(e){return M.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:o=q.Bottom,targetPosition:a=q.Top,label:c,labelStyle:l,labelShowBg:d,labelBgStyle:f,labelBgPadding:u,labelBgBorderRadius:p,style:g,markerEnd:m,markerStart:N,interactionWidth:y})=>{const[E,v,w]=co({sourceX:n,sourceY:r,sourcePosition:o,targetX:s,targetY:i,targetPosition:a}),j=e.isInternal?void 0:t;return h.jsx(xn,{id:j,path:E,labelX:v,labelY:w,label:c,labelStyle:l,labelShowBg:d,labelBgStyle:f,labelBgPadding:u,labelBgBorderRadius:p,style:g,markerEnd:m,markerStart:N,interactionWidth:y})})}const u0=lo({isInternal:!1}),uo=lo({isInternal:!0});u0.displayName="SimpleBezierEdge";uo.displayName="SimpleBezierEdgeInternal";function fo(e){return M.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:o,labelStyle:a,labelShowBg:c,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:f,style:u,sourcePosition:p=q.Bottom,targetPosition:g=q.Top,markerEnd:m,markerStart:N,pathOptions:y,interactionWidth:E})=>{const[v,w,j]=Qn({sourceX:n,sourceY:r,sourcePosition:p,targetX:s,targetY:i,targetPosition:g,borderRadius:y==null?void 0:y.borderRadius,offset:y==null?void 0:y.offset}),R=e.isInternal?void 0:t;return h.jsx(xn,{id:R,path:v,labelX:w,labelY:j,label:o,labelStyle:a,labelShowBg:c,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:f,style:u,markerEnd:m,markerStart:N,interactionWidth:E})})}const ho=fo({isInternal:!1}),po=fo({isInternal:!0});ho.displayName="SmoothStepEdge";po.displayName="SmoothStepEdgeInternal";function go(e){return M.memo(({id:t,...n})=>{var s;const r=e.isInternal?void 0:t;return h.jsx(ho,{...n,id:r,pathOptions:M.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(s=n.pathOptions)==null?void 0:s.offset])})})}const d0=go({isInternal:!1}),mo=go({isInternal:!0});d0.displayName="StepEdge";mo.displayName="StepEdgeInternal";function xo(e){return M.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:o,labelStyle:a,labelShowBg:c,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:f,style:u,markerEnd:p,markerStart:g,interactionWidth:m})=>{const[N,y,E]=zi({sourceX:n,sourceY:r,targetX:s,targetY:i}),v=e.isInternal?void 0:t;return h.jsx(xn,{id:v,path:N,labelX:y,labelY:E,label:o,labelStyle:a,labelShowBg:c,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:f,style:u,markerEnd:p,markerStart:g,interactionWidth:m})})}const f0=xo({isInternal:!1}),yo=xo({isInternal:!0});f0.displayName="StraightEdge";yo.displayName="StraightEdgeInternal";function wo(e){return M.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:o=q.Bottom,targetPosition:a=q.Top,label:c,labelStyle:l,labelShowBg:d,labelBgStyle:f,labelBgPadding:u,labelBgBorderRadius:p,style:g,markerEnd:m,markerStart:N,pathOptions:y,interactionWidth:E})=>{const[v,w,j]=$i({sourceX:n,sourceY:r,sourcePosition:o,targetX:s,targetY:i,targetPosition:a,curvature:y==null?void 0:y.curvature}),R=e.isInternal?void 0:t;return h.jsx(xn,{id:R,path:v,labelX:w,labelY:j,label:c,labelStyle:l,labelShowBg:d,labelBgStyle:f,labelBgPadding:u,labelBgBorderRadius:p,style:g,markerEnd:m,markerStart:N,interactionWidth:E})})}const h0=wo({isInternal:!1}),vo=wo({isInternal:!0});h0.displayName="BezierEdge";vo.displayName="BezierEdgeInternal";const Ss={default:vo,straight:yo,step:mo,smoothstep:po,simplebezier:uo},ks={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},p0=(e,t,n)=>n===q.Left?e-t:n===q.Right?e+t:e,g0=(e,t,n)=>n===q.Top?e-t:n===q.Bottom?e+t:e,Cs="react-flow__edgeupdater";function js({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:i,onMouseOut:o,type:a}){return h.jsx("circle",{onMouseDown:s,onMouseEnter:i,onMouseOut:o,className:se([Cs,`${Cs}-${a}`]),cx:p0(t,r,e),cy:g0(n,r,e),r,stroke:"transparent",fill:"transparent"})}function m0({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:s,targetX:i,targetY:o,sourcePosition:a,targetPosition:c,onReconnect:l,onReconnectStart:d,onReconnectEnd:f,setReconnecting:u,setUpdateHover:p}){const g=te(),m=(w,j)=>{if(w.button!==0)return;const{autoPanOnConnect:R,domNode:C,isValidConnection:$,connectionMode:A,connectionRadius:P,lib:L,onConnectStart:T,onConnectEnd:D,cancelConnection:x,nodeLookup:k,rfId:_,panBy:I,updateConnection:b}=g.getState(),S=j.type==="target";u(!0),d==null||d(w,n,j.type);const z=(F,Y)=>{u(!1),f==null||f(F,n,j.type,Y)},H=F=>l==null?void 0:l(n,F);tr.onPointerDown(w.nativeEvent,{autoPanOnConnect:R,connectionMode:A,connectionRadius:P,domNode:C,handleId:j.id,nodeId:j.nodeId,nodeLookup:k,isTarget:S,edgeUpdaterType:j.type,lib:L,flowId:_,cancelConnection:x,panBy:I,isValidConnection:$,onConnect:H,onConnectStart:T,onConnectEnd:D,onReconnectEnd:z,updateConnection:b,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle})},N=w=>m(w,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),y=w=>m(w,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),E=()=>p(!0),v=()=>p(!1);return h.jsxs(h.Fragment,{children:[(e===!0||e==="source")&&h.jsx(js,{position:a,centerX:r,centerY:s,radius:t,onMouseDown:N,onMouseEnter:E,onMouseOut:v,type:"source"}),(e===!0||e==="target")&&h.jsx(js,{position:c,centerX:i,centerY:o,radius:t,onMouseDown:y,onMouseEnter:E,onMouseOut:v,type:"target"})]})}function x0({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:s,onDoubleClick:i,onContextMenu:o,onMouseEnter:a,onMouseMove:c,onMouseLeave:l,reconnectRadius:d,onReconnect:f,onReconnectStart:u,onReconnectEnd:p,rfId:g,edgeTypes:m,noPanClassName:N,onError:y,disableKeyboardA11y:E}){let v=Q(G=>G.edgeLookup.get(e));const w=Q(G=>G.defaultEdgeOptions);v=w?{...w,...v}:v;let j=v.type||"default",R=(m==null?void 0:m[j])||Ss[j];R===void 0&&(y==null||y("011",Ee.error011(j)),j="default",R=Ss.default);const C=!!(v.focusable||t&&typeof v.focusable>"u"),$=typeof f<"u"&&(v.reconnectable||n&&typeof v.reconnectable>"u"),A=!!(v.selectable||r&&typeof v.selectable>"u"),P=M.useRef(null),[L,T]=M.useState(!1),[D,x]=M.useState(!1),k=te(),{zIndex:_,sourceX:I,sourceY:b,targetX:S,targetY:z,sourcePosition:H,targetPosition:F}=Q(M.useCallback(G=>{const J=G.nodeLookup.get(v.source),ee=G.nodeLookup.get(v.target);if(!J||!ee)return{zIndex:v.zIndex,...ks};const ie=Wd({id:e,sourceNode:J,targetNode:ee,sourceHandle:v.sourceHandle||null,targetHandle:v.targetHandle||null,connectionMode:G.connectionMode,onError:y});return{zIndex:Ld({selected:v.selected,zIndex:v.zIndex,sourceNode:J,targetNode:ee,elevateOnSelect:G.elevateEdgesOnSelect}),...ie||ks}},[v.source,v.target,v.sourceHandle,v.targetHandle,v.selected,v.zIndex]),re),Y=M.useMemo(()=>v.markerStart?`url('#${Jn(v.markerStart,g)}')`:void 0,[v.markerStart,g]),V=M.useMemo(()=>v.markerEnd?`url('#${Jn(v.markerEnd,g)}')`:void 0,[v.markerEnd,g]);if(v.hidden||I===null||b===null||S===null||z===null)return null;const O=G=>{var ke;const{addSelectedEdges:J,unselectNodesAndEdges:ee,multiSelectionActive:ie}=k.getState();A&&(k.setState({nodesSelectionActive:!1}),v.selected&&ie?(ee({nodes:[],edges:[v]}),(ke=P.current)==null||ke.blur()):J([e])),s&&s(G,v)},X=i?G=>{i(G,{...v})}:void 0,W=o?G=>{o(G,{...v})}:void 0,B=a?G=>{a(G,{...v})}:void 0,K=c?G=>{c(G,{...v})}:void 0,Z=l?G=>{l(G,{...v})}:void 0,U=G=>{var J;if(!E&&gi.includes(G.key)&&A){const{unselectNodesAndEdges:ee,addSelectedEdges:ie}=k.getState();G.key==="Escape"?((J=P.current)==null||J.blur(),ee({edges:[v]})):ie([e])}};return h.jsx("svg",{style:{zIndex:_},children:h.jsxs("g",{className:se(["react-flow__edge",`react-flow__edge-${j}`,v.className,N,{selected:v.selected,animated:v.animated,inactive:!A&&!s,updating:L,selectable:A}]),onClick:O,onDoubleClick:X,onContextMenu:W,onMouseEnter:B,onMouseMove:K,onMouseLeave:Z,onKeyDown:C?U:void 0,tabIndex:C?0:void 0,role:C?"button":"img","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":v.ariaLabel===null?void 0:v.ariaLabel||`Edge from ${v.source} to ${v.target}`,"aria-describedby":C?`${Ui}-${g}`:void 0,ref:P,children:[!D&&h.jsx(R,{id:e,source:v.source,target:v.target,type:v.type,selected:v.selected,animated:v.animated,selectable:A,deletable:v.deletable??!0,label:v.label,labelStyle:v.labelStyle,labelShowBg:v.labelShowBg,labelBgStyle:v.labelBgStyle,labelBgPadding:v.labelBgPadding,labelBgBorderRadius:v.labelBgBorderRadius,sourceX:I,sourceY:b,targetX:S,targetY:z,sourcePosition:H,targetPosition:F,data:v.data,style:v.style,sourceHandleId:v.sourceHandle,targetHandleId:v.targetHandle,markerStart:Y,markerEnd:V,pathOptions:"pathOptions"in v?v.pathOptions:void 0,interactionWidth:v.interactionWidth}),$&&h.jsx(m0,{edge:v,isReconnectable:$,reconnectRadius:d,onReconnect:f,onReconnectStart:u,onReconnectEnd:p,sourceX:I,sourceY:b,targetX:S,targetY:z,sourcePosition:H,targetPosition:F,setUpdateHover:T,setReconnecting:x})]})})}const y0=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function bo({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:s,onReconnect:i,onEdgeContextMenu:o,onEdgeMouseEnter:a,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:d,reconnectRadius:f,onEdgeDoubleClick:u,onReconnectStart:p,onReconnectEnd:g,disableKeyboardA11y:m}){const{edgesFocusable:N,edgesReconnectable:y,elementsSelectable:E,onError:v}=Q(y0,re),w=r0(t);return h.jsxs("div",{className:"react-flow__edges",children:[h.jsx(c0,{defaultColor:e,rfId:n}),w.map(j=>h.jsx(x0,{id:j,edgesFocusable:N,edgesReconnectable:y,elementsSelectable:E,noPanClassName:s,onReconnect:i,onContextMenu:o,onMouseEnter:a,onMouseMove:c,onMouseLeave:l,onClick:d,reconnectRadius:f,onDoubleClick:u,onReconnectStart:p,onReconnectEnd:g,rfId:n,onError:v,edgeTypes:r,disableKeyboardA11y:m},j))]})}bo.displayName="EdgeRenderer";const w0=M.memo(bo),v0=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function b0({children:e}){const t=Q(v0);return h.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function N0(e){const t=wr(),n=M.useRef(!1);M.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const _0=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function E0(e){const t=Q(_0),n=te();return M.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function S0(e){return e.connection.inProgress?{...e.connection,to:Mt(e.connection.to,e.transform)}:{...e.connection}}function k0(e){return S0}function C0(e){const t=k0();return Q(t,re)}const j0=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function M0({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:s,width:i,height:o,isValid:a,inProgress:c}=Q(j0,re);return!(i&&s&&c)?null:h.jsx("svg",{style:e,width:i,height:o,className:"react-flow__connectionline react-flow__container",children:h.jsx("g",{className:se(["react-flow__connection",xi(a)]),children:h.jsx(No,{style:t,type:n,CustomComponent:r,isValid:a})})})}const No=({style:e,type:t=Ie.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:s,from:i,fromNode:o,fromHandle:a,fromPosition:c,to:l,toNode:d,toHandle:f,toPosition:u}=C0();if(!s)return;if(n)return h.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:a,fromX:i.x,fromY:i.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:u,connectionStatus:xi(r),toNode:d,toHandle:f});let p="";const g={sourceX:i.x,sourceY:i.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:u};switch(t){case Ie.Bezier:[p]=$i(g);break;case Ie.SimpleBezier:[p]=co(g);break;case Ie.Step:[p]=Qn({...g,borderRadius:0});break;case Ie.SmoothStep:[p]=Qn(g);break;default:[p]=zi(g)}return h.jsx("path",{d:p,fill:"none",className:"react-flow__connection-path",style:e})};No.displayName="ConnectionLine";const $0={};function Ms(e=$0){M.useRef(e),te(),M.useEffect(()=>{},[e])}function I0(){te(),M.useRef(!1),M.useEffect(()=>{},[])}function _o({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:i,onEdgeDoubleClick:o,onNodeMouseEnter:a,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:d,onSelectionContextMenu:f,onSelectionStart:u,onSelectionEnd:p,connectionLineType:g,connectionLineStyle:m,connectionLineComponent:N,connectionLineContainerStyle:y,selectionKeyCode:E,selectionOnDrag:v,selectionMode:w,multiSelectionKeyCode:j,panActivationKeyCode:R,zoomActivationKeyCode:C,deleteKeyCode:$,onlyRenderVisibleElements:A,elementsSelectable:P,defaultViewport:L,translateExtent:T,minZoom:D,maxZoom:x,preventScrolling:k,defaultMarkerColor:_,zoomOnScroll:I,zoomOnPinch:b,panOnScroll:S,panOnScrollSpeed:z,panOnScrollMode:H,zoomOnDoubleClick:F,panOnDrag:Y,onPaneClick:V,onPaneMouseEnter:O,onPaneMouseMove:X,onPaneMouseLeave:W,onPaneScroll:B,onPaneContextMenu:K,paneClickDistance:Z,nodeClickDistance:U,onEdgeContextMenu:G,onEdgeMouseEnter:J,onEdgeMouseMove:ee,onEdgeMouseLeave:ie,reconnectRadius:ke,onReconnect:yn,onReconnectStart:wn,onReconnectEnd:vn,noDragClassName:nt,noWheelClassName:bn,noPanClassName:rt,disableKeyboardA11y:st,nodeExtent:Nn,rfId:it,viewport:ot,onViewportChange:$t}){return Ms(e),Ms(t),I0(),N0(n),E0(ot),h.jsx(Gh,{onPaneClick:V,onPaneMouseEnter:O,onPaneMouseMove:X,onPaneMouseLeave:W,onPaneContextMenu:K,onPaneScroll:B,paneClickDistance:Z,deleteKeyCode:$,selectionKeyCode:E,selectionOnDrag:v,selectionMode:w,onSelectionStart:u,onSelectionEnd:p,multiSelectionKeyCode:j,panActivationKeyCode:R,zoomActivationKeyCode:C,elementsSelectable:P,zoomOnScroll:I,zoomOnPinch:b,zoomOnDoubleClick:F,panOnScroll:S,panOnScrollSpeed:z,panOnScrollMode:H,panOnDrag:Y,defaultViewport:L,translateExtent:T,minZoom:D,maxZoom:x,onSelectionContextMenu:f,preventScrolling:k,noDragClassName:nt,noWheelClassName:bn,noPanClassName:rt,disableKeyboardA11y:st,onViewportChange:$t,isControlledViewport:!!ot,children:h.jsxs(b0,{children:[h.jsx(w0,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:o,onReconnect:yn,onReconnectStart:wn,onReconnectEnd:vn,onlyRenderVisibleElements:A,onEdgeContextMenu:G,onEdgeMouseEnter:J,onEdgeMouseMove:ee,onEdgeMouseLeave:ie,reconnectRadius:ke,defaultMarkerColor:_,noPanClassName:rt,disableKeyboardA11y:st,rfId:it}),h.jsx(M0,{style:m,type:g,component:N,containerStyle:y}),h.jsx("div",{className:"react-flow__edgelabel-renderer"}),h.jsx(n0,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:a,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:d,nodeClickDistance:U,onlyRenderVisibleElements:A,noPanClassName:rt,noDragClassName:nt,disableKeyboardA11y:st,nodeExtent:Nn,rfId:it}),h.jsx("div",{className:"react-flow__viewport-portal"})]})})}_o.displayName="GraphView";const z0=M.memo(_o),$s=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:o,nodeOrigin:a,nodeExtent:c}={})=>{const l=new Map,d=new Map,f=new Map,u=new Map,p=r??t??[],g=n??e??[],m=a??[0,0],N=c??vt;Ti(f,u,p),er(g,l,d,{nodeOrigin:m,nodeExtent:N,elevateNodesOnSelect:!1});let y=[0,0,1];if(o&&s&&i){const E=jt(l,{filter:R=>!!((R.width||R.initialWidth)&&(R.height||R.initialHeight))}),{x:v,y:w,zoom:j}=hr(E,s,i,.5,2,.1);y=[v,w,j]}return{rfId:"1",width:0,height:0,transform:y,nodes:g,nodeLookup:l,parentLookup:d,edges:p,edgeLookup:u,connectionLookup:f,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:.5,maxZoom:2,translateExtent:vt,nodeExtent:N,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Ze.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:m,nodeDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!1,fitViewOnInit:!1,fitViewDone:!1,fitViewOnInitOptions:void 0,selectNodesOnDrag:!0,multiSelectionActive:!1,connection:{...mi},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanSpeed:15,connectionRadius:20,onError:Rd,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1}},A0=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:o,nodeOrigin:a,nodeExtent:c})=>Uf((l,d)=>({...$s({nodes:e,edges:t,width:s,height:i,fitView:o,nodeOrigin:a,nodeExtent:c,defaultNodes:n,defaultEdges:r}),setNodes:f=>{const{nodeLookup:u,parentLookup:p,nodeOrigin:g,elevateNodesOnSelect:m}=d();er(f,u,p,{nodeOrigin:g,nodeExtent:c,elevateNodesOnSelect:m,checkEquality:!0}),l({nodes:f})},setEdges:f=>{const{connectionLookup:u,edgeLookup:p}=d();Ti(u,p,f),l({edges:f})},setDefaultNodesAndEdges:(f,u)=>{if(f){const{setNodes:p}=d();p(f),l({hasDefaultNodes:!0})}if(u){const{setEdges:p}=d();p(u),l({hasDefaultEdges:!0})}},updateNodeInternals:(f,u={triggerFitView:!0})=>{const{triggerNodeChanges:p,nodeLookup:g,parentLookup:m,fitViewOnInit:N,fitViewDone:y,fitViewOnInitOptions:E,domNode:v,nodeOrigin:w,nodeExtent:j,debug:R,fitViewSync:C}=d(),{changes:$,updatedInternals:A}=Jd(f,g,m,v,w,j);if(A){if(Ud(g,m,{nodeOrigin:w,nodeExtent:j}),u.triggerFitView){let P=y;!y&&N&&(P=C({...E,nodes:E==null?void 0:E.nodes})),l({fitViewDone:P})}else l({});($==null?void 0:$.length)>0&&(R&&console.log("React Flow: trigger node changes",$),p==null||p($))}},updateNodePositions:(f,u=!1)=>{const p=[],g=[];for(const[m,N]of f){const y=!!(N!=null&&N.expandParent&&(N!=null&&N.parentId)&&(N!=null&&N.position)),E={id:m,type:"position",position:y?{x:Math.max(0,N.position.x),y:Math.max(0,N.position.y)}:N.position,dragging:u};y&&p.push({id:m,parentId:N.parentId,rect:{...N.internals.positionAbsolute,width:N.measured.width,height:N.measured.height}}),g.push(E)}if(p.length>0){const{nodeLookup:m,parentLookup:N,nodeOrigin:y}=d(),E=xr(p,m,N,y);g.push(...E)}d().triggerNodeChanges(g)},triggerNodeChanges:f=>{const{onNodesChange:u,setNodes:p,nodes:g,hasDefaultNodes:m,debug:N}=d();if(f!=null&&f.length){if(m){const y=xh(f,g);p(y)}N&&console.log("React Flow: trigger node changes",f),u==null||u(f)}},triggerEdgeChanges:f=>{const{onEdgesChange:u,setEdges:p,edges:g,hasDefaultEdges:m,debug:N}=d();if(f!=null&&f.length){if(m){const y=yh(f,g);p(y)}N&&console.log("React Flow: trigger edge changes",f),u==null||u(f)}},addSelectedNodes:f=>{const{multiSelectionActive:u,edgeLookup:p,nodeLookup:g,triggerNodeChanges:m,triggerEdgeChanges:N}=d();if(u){const y=f.map(E=>Pe(E,!0));m(y);return}m(Ye(g,new Set([...f]),!0)),N(Ye(p))},addSelectedEdges:f=>{const{multiSelectionActive:u,edgeLookup:p,nodeLookup:g,triggerNodeChanges:m,triggerEdgeChanges:N}=d();if(u){const y=f.map(E=>Pe(E,!0));N(y);return}N(Ye(p,new Set([...f]))),m(Ye(g,new Set,!0))},unselectNodesAndEdges:({nodes:f,edges:u}={})=>{const{edges:p,nodes:g,nodeLookup:m,triggerNodeChanges:N,triggerEdgeChanges:y}=d(),E=f||g,v=u||p,w=E.map(R=>{const C=m.get(R.id);return C&&(C.selected=!1),Pe(R.id,!1)}),j=v.map(R=>Pe(R.id,!1));N(w),y(j)},setMinZoom:f=>{const{panZoom:u,maxZoom:p}=d();u==null||u.setScaleExtent([f,p]),l({minZoom:f})},setMaxZoom:f=>{const{panZoom:u,minZoom:p}=d();u==null||u.setScaleExtent([p,f]),l({maxZoom:f})},setTranslateExtent:f=>{var u;(u=d().panZoom)==null||u.setTranslateExtent(f),l({translateExtent:f})},setPaneClickDistance:f=>{var u;(u=d().panZoom)==null||u.setClickDistance(f)},resetSelectedElements:()=>{const{edges:f,nodes:u,triggerNodeChanges:p,triggerEdgeChanges:g}=d(),m=u.reduce((y,E)=>E.selected?[...y,Pe(E.id,!1)]:y,[]),N=f.reduce((y,E)=>E.selected?[...y,Pe(E.id,!1)]:y,[]);p(m),g(N)},setNodeExtent:f=>{const{nodes:u,nodeLookup:p,parentLookup:g,nodeOrigin:m,elevateNodesOnSelect:N,nodeExtent:y}=d();f[0][0]===y[0][0]&&f[0][1]===y[0][1]&&f[1][0]===y[1][0]&&f[1][1]===y[1][1]||(er(u,p,g,{nodeOrigin:m,nodeExtent:f,elevateNodesOnSelect:N,checkEquality:!1}),l({nodeExtent:f}))},panBy:f=>{const{transform:u,width:p,height:g,panZoom:m,translateExtent:N}=d();return ef({delta:f,panZoom:m,transform:u,translateExtent:N,width:p,height:g})},fitView:f=>{const{panZoom:u,width:p,height:g,minZoom:m,maxZoom:N,nodeLookup:y}=d();if(!u)return Promise.resolve(!1);const E=Gn(y,f);return Kn({nodes:E,width:p,height:g,panZoom:u,minZoom:m,maxZoom:N},f)},fitViewSync:f=>{const{panZoom:u,width:p,height:g,minZoom:m,maxZoom:N,nodeLookup:y}=d();if(!u)return!1;const E=Gn(y,f);return Kn({nodes:E,width:p,height:g,panZoom:u,minZoom:m,maxZoom:N},f),E.size>0},cancelConnection:()=>{l({connection:{...mi}})},updateConnection:f=>{l({connection:f})},reset:()=>l({...$s()})}),Object.is);function T0({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:s,initialHeight:i,fitView:o,nodeOrigin:a,nodeExtent:c,children:l}){const[d]=M.useState(()=>A0({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:o,nodeOrigin:a,nodeExtent:c}));return h.jsx(Zf,{value:d,children:h.jsx(Nh,{children:l})})}function P0({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:s,width:i,height:o,fitView:a,nodeOrigin:c,nodeExtent:l}){return M.useContext(gn)?h.jsx(h.Fragment,{children:e}):h.jsx(T0,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:s,initialWidth:i,initialHeight:o,fitView:a,nodeOrigin:c,nodeExtent:l,children:e})}const D0={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function R0({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i,edgeTypes:o,onNodeClick:a,onEdgeClick:c,onInit:l,onMove:d,onMoveStart:f,onMoveEnd:u,onConnect:p,onConnectStart:g,onConnectEnd:m,onClickConnectStart:N,onClickConnectEnd:y,onNodeMouseEnter:E,onNodeMouseMove:v,onNodeMouseLeave:w,onNodeContextMenu:j,onNodeDoubleClick:R,onNodeDragStart:C,onNodeDrag:$,onNodeDragStop:A,onNodesDelete:P,onEdgesDelete:L,onDelete:T,onSelectionChange:D,onSelectionDragStart:x,onSelectionDrag:k,onSelectionDragStop:_,onSelectionContextMenu:I,onSelectionStart:b,onSelectionEnd:S,onBeforeDelete:z,connectionMode:H,connectionLineType:F=Ie.Bezier,connectionLineStyle:Y,connectionLineComponent:V,connectionLineContainerStyle:O,deleteKeyCode:X="Backspace",selectionKeyCode:W="Shift",selectionOnDrag:B=!1,selectionMode:K=bt.Full,panActivationKeyCode:Z="Space",multiSelectionKeyCode:U=tn()?"Meta":"Control",zoomActivationKeyCode:G=tn()?"Meta":"Control",snapToGrid:J,snapGrid:ee,onlyRenderVisibleElements:ie=!1,selectNodesOnDrag:ke,nodesDraggable:yn,nodesConnectable:wn,nodesFocusable:vn,nodeOrigin:nt=Zi,edgesFocusable:bn,edgesReconnectable:rt,elementsSelectable:st=!0,defaultViewport:Nn=uh,minZoom:it=.5,maxZoom:ot=2,translateExtent:$t=vt,preventScrolling:$o=!0,nodeExtent:_n,defaultMarkerColor:Io="#b1b1b7",zoomOnScroll:zo=!0,zoomOnPinch:Ao=!0,panOnScroll:To=!1,panOnScrollSpeed:Po=.5,panOnScrollMode:Do=He.Free,zoomOnDoubleClick:Ro=!0,panOnDrag:Ho=!0,onPaneClick:Lo,onPaneMouseEnter:Fo,onPaneMouseMove:Bo,onPaneMouseLeave:Vo,onPaneScroll:Oo,onPaneContextMenu:Xo,paneClickDistance:br=0,nodeClickDistance:Yo=0,children:qo,onReconnect:Wo,onReconnectStart:Go,onReconnectEnd:Ko,onEdgeContextMenu:Uo,onEdgeDoubleClick:Zo,onEdgeMouseEnter:Qo,onEdgeMouseMove:Jo,onEdgeMouseLeave:ea,reconnectRadius:ta=10,onNodesChange:na,onEdgesChange:ra,noDragClassName:sa="nodrag",noWheelClassName:ia="nowheel",noPanClassName:Nr="nopan",fitView:_r,fitViewOptions:oa,connectOnClick:aa,attributionPosition:ca,proOptions:la,defaultEdgeOptions:ua,elevateNodesOnSelect:da,elevateEdgesOnSelect:fa,disableKeyboardA11y:Er=!1,autoPanOnConnect:ha,autoPanOnNodeDrag:pa,autoPanSpeed:ga,connectionRadius:ma,isValidConnection:xa,onError:ya,style:wa,id:Sr,nodeDragThreshold:va,viewport:ba,onViewportChange:Na,width:_a,height:Ea,colorMode:Sa="light",debug:ka,...Ca},ja){const En=Sr||"1",Ma=ph(Sa);return h.jsx("div",{"data-testid":"rf__wrapper",...Ca,style:{...wa,...D0},ref:ja,className:se(["react-flow",s,Ma]),id:Sr,children:h.jsxs(P0,{nodes:e,edges:t,width:_a,height:Ea,fitView:_r,nodeOrigin:nt,nodeExtent:_n,children:[h.jsx(z0,{onInit:l,onNodeClick:a,onEdgeClick:c,onNodeMouseEnter:E,onNodeMouseMove:v,onNodeMouseLeave:w,onNodeContextMenu:j,onNodeDoubleClick:R,nodeTypes:i,edgeTypes:o,connectionLineType:F,connectionLineStyle:Y,connectionLineComponent:V,connectionLineContainerStyle:O,selectionKeyCode:W,selectionOnDrag:B,selectionMode:K,deleteKeyCode:X,multiSelectionKeyCode:U,panActivationKeyCode:Z,zoomActivationKeyCode:G,onlyRenderVisibleElements:ie,defaultViewport:Nn,translateExtent:$t,minZoom:it,maxZoom:ot,preventScrolling:$o,zoomOnScroll:zo,zoomOnPinch:Ao,zoomOnDoubleClick:Ro,panOnScroll:To,panOnScrollSpeed:Po,panOnScrollMode:Do,panOnDrag:Ho,onPaneClick:Lo,onPaneMouseEnter:Fo,onPaneMouseMove:Bo,onPaneMouseLeave:Vo,onPaneScroll:Oo,onPaneContextMenu:Xo,paneClickDistance:br,nodeClickDistance:Yo,onSelectionContextMenu:I,onSelectionStart:b,onSelectionEnd:S,onReconnect:Wo,onReconnectStart:Go,onReconnectEnd:Ko,onEdgeContextMenu:Uo,onEdgeDoubleClick:Zo,onEdgeMouseEnter:Qo,onEdgeMouseMove:Jo,onEdgeMouseLeave:ea,reconnectRadius:ta,defaultMarkerColor:Io,noDragClassName:sa,noWheelClassName:ia,noPanClassName:Nr,rfId:En,disableKeyboardA11y:Er,nodeExtent:_n,viewport:ba,onViewportChange:Na}),h.jsx(hh,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:g,onConnectEnd:m,onClickConnectStart:N,onClickConnectEnd:y,nodesDraggable:yn,nodesConnectable:wn,nodesFocusable:vn,edgesFocusable:bn,edgesReconnectable:rt,elementsSelectable:st,elevateNodesOnSelect:da,elevateEdgesOnSelect:fa,minZoom:it,maxZoom:ot,nodeExtent:_n,onNodesChange:na,onEdgesChange:ra,snapToGrid:J,snapGrid:ee,connectionMode:H,translateExtent:$t,connectOnClick:aa,defaultEdgeOptions:ua,fitView:_r,fitViewOptions:oa,onNodesDelete:P,onEdgesDelete:L,onDelete:T,onNodeDragStart:C,onNodeDrag:$,onNodeDragStop:A,onSelectionDrag:k,onSelectionDragStart:x,onSelectionDragStop:_,onMove:d,onMoveStart:f,onMoveEnd:u,noPanClassName:Nr,nodeOrigin:nt,rfId:En,autoPanOnConnect:ha,autoPanOnNodeDrag:pa,autoPanSpeed:ga,onError:ya,connectionRadius:ma,isValidConnection:xa,selectNodesOnDrag:ke,nodeDragThreshold:va,onBeforeDelete:z,paneClickDistance:br,debug:ka}),h.jsx(lh,{onSelectionChange:D}),qo,h.jsx(sh,{proOptions:la,position:ca}),h.jsx(nh,{rfId:En,disableKeyboardA11y:Er})]})})}var H0=Ji(R0);function L0({dimensions:e,lineWidth:t,variant:n,className:r}){return h.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:se(["react-flow__background-pattern",n,r])})}function F0({radius:e,className:t}){return h.jsx("circle",{cx:e,cy:e,r:e,className:se(["react-flow__background-pattern","dots",t])})}var be;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(be||(be={}));const B0={[be.Dots]:1,[be.Lines]:1,[be.Cross]:6},V0=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Eo({id:e,variant:t=be.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=0,color:o,bgColor:a,style:c,className:l,patternClassName:d}){const f=M.useRef(null),{transform:u,patternId:p}=Q(V0,re),g=r||B0[t],m=t===be.Dots,N=t===be.Cross,y=Array.isArray(n)?n:[n,n],E=[y[0]*u[2]||1,y[1]*u[2]||1],v=g*u[2],w=Array.isArray(i)?i:[i,i],j=N?[v,v]:E,R=[w[0]*u[2]||1+j[0]/2,w[1]*u[2]||1+j[1]/2],C=`${p}${e||""}`;return h.jsxs("svg",{className:se(["react-flow__background",l]),style:{...c,...mn,"--xy-background-color-props":a,"--xy-background-pattern-color-props":o},ref:f,"data-testid":"rf__background",children:[h.jsx("pattern",{id:C,x:u[0]%E[0],y:u[1]%E[1],width:E[0],height:E[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${R[0]},-${R[1]})`,children:m?h.jsx(F0,{radius:v/2,className:d}):h.jsx(L0,{dimensions:j,lineWidth:s,variant:t,className:d})}),h.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${C})`})]})}Eo.displayName="Background";const O0=M.memo(Eo);function X0(){return h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:h.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function Y0(){return h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:h.jsx("path",{d:"M0 0h32v4.2H0z"})})}function q0(){return h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:h.jsx("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 0027.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.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function W0(){return h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:h.jsx("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 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-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"})})}function G0(){return h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:h.jsx("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 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function Lt({children:e,className:t,...n}){return h.jsx("button",{type:"button",className:se(["react-flow__controls-button",t]),...n,children:e})}const K0=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom});function So({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:o,onFitView:a,onInteractiveChange:c,className:l,children:d,position:f="bottom-left",orientation:u="vertical","aria-label":p="React Flow controls"}){const g=te(),{isInteractive:m,minZoomReached:N,maxZoomReached:y}=Q(K0,re),{zoomIn:E,zoomOut:v,fitView:w}=wr(),j=()=>{E(),i==null||i()},R=()=>{v(),o==null||o()},C=()=>{w(s),a==null||a()},$=()=>{g.setState({nodesDraggable:!m,nodesConnectable:!m,elementsSelectable:!m}),c==null||c(!m)},A=u==="horizontal"?"horizontal":"vertical";return h.jsxs(yr,{className:se(["react-flow__controls",A,l]),position:f,style:e,"data-testid":"rf__controls","aria-label":p,children:[t&&h.jsxs(h.Fragment,{children:[h.jsx(Lt,{onClick:j,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:y,children:h.jsx(X0,{})}),h.jsx(Lt,{onClick:R,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:N,children:h.jsx(Y0,{})})]}),n&&h.jsx(Lt,{className:"react-flow__controls-fitview",onClick:C,title:"fit view","aria-label":"fit view",children:h.jsx(q0,{})}),r&&h.jsx(Lt,{className:"react-flow__controls-interactive",onClick:$,title:"toggle interactivity","aria-label":"toggle interactivity",children:m?h.jsx(G0,{}):h.jsx(W0,{})}),d]})}So.displayName="Controls";const U0=M.memo(So);function Z0({id:e,x:t,y:n,width:r,height:s,style:i,color:o,strokeColor:a,strokeWidth:c,className:l,borderRadius:d,shapeRendering:f,selected:u,onClick:p}){const{background:g,backgroundColor:m}=i||{},N=o||g||m;return h.jsx("rect",{className:se(["react-flow__minimap-node",{selected:u},l]),x:t,y:n,rx:d,ry:d,width:r,height:s,style:{fill:N,stroke:a,strokeWidth:c},shapeRendering:f,onClick:p?y=>p(y,e):void 0})}const Q0=M.memo(Z0),J0=e=>e.nodes.map(t=>t.id),Dn=e=>e instanceof Function?e:()=>e;function ep({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:i=Q0,onClick:o}){const a=Q(J0,re),c=Dn(t),l=Dn(e),d=Dn(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return h.jsx(h.Fragment,{children:a.map(u=>h.jsx(np,{id:u,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:i,onClick:o,shapeRendering:f},u))})}function tp({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:i,shapeRendering:o,NodeComponent:a,onClick:c}){const{node:l,x:d,y:f,width:u,height:p}=Q(g=>{const m=g.nodeLookup.get(e),{x:N,y}=m.internals.positionAbsolute,{width:E,height:v}=Se(m);return{node:m,x:N,y,width:E,height:v}},re);return!l||l.hidden||!Si(l)?null:h.jsx(a,{x:d,y:f,width:u,height:p,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:s,strokeColor:n(l),strokeWidth:i,shapeRendering:o,onClick:c,id:l.id})}const np=M.memo(tp);var rp=M.memo(ep);const sp=200,ip=150,op=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?_i(jt(e.nodeLookup),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height}},ap="react-flow__minimap-desc";function ko({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:o,nodeComponent:a,bgColor:c,maskColor:l,maskStrokeColor:d,maskStrokeWidth:f,position:u="bottom-right",onClick:p,onNodeClick:g,pannable:m=!1,zoomable:N=!1,ariaLabel:y="React Flow mini map",inversePan:E,zoomStep:v=10,offsetScale:w=5}){const j=te(),R=M.useRef(null),{boundingRect:C,viewBB:$,rfId:A,panZoom:P,translateExtent:L,flowWidth:T,flowHeight:D}=Q(op,re),x=(e==null?void 0:e.width)??sp,k=(e==null?void 0:e.height)??ip,_=C.width/x,I=C.height/k,b=Math.max(_,I),S=b*x,z=b*k,H=w*b,F=C.x-(S-C.width)/2-H,Y=C.y-(z-C.height)/2-H,V=S+H*2,O=z+H*2,X=`${ap}-${A}`,W=M.useRef(0),B=M.useRef();W.current=b,M.useEffect(()=>{if(R.current&&P)return B.current=lf({domNode:R.current,panZoom:P,getTransform:()=>j.getState().transform,getViewScale:()=>W.current}),()=>{var U;(U=B.current)==null||U.destroy()}},[P]),M.useEffect(()=>{var U;(U=B.current)==null||U.update({translateExtent:L,width:T,height:D,inversePan:E,pannable:m,zoomStep:v,zoomable:N})},[m,N,E,v,L,T,D]);const K=p?U=>{var ee;const[G,J]=((ee=B.current)==null?void 0:ee.pointer(U))||[0,0];p(U,{x:G,y:J})}:void 0,Z=g?M.useCallback((U,G)=>{const J=j.getState().nodeLookup.get(G);g(U,J)},[]):void 0;return h.jsx(yr,{position:u,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*b:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o=="string"?o:void 0},className:se(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:h.jsxs("svg",{width:x,height:k,viewBox:`${F} ${Y} ${V} ${O}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":X,ref:R,onClick:K,children:[y&&h.jsx("title",{id:X,children:y}),h.jsx(rp,{onClick:Z,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:o,nodeComponent:a}),h.jsx("path",{className:"react-flow__minimap-mask",d:`M${F-H},${Y-H}h${V+H*2}v${O+H*2}h${-V-H*2}z
|
|
23
|
+
M${$.x},${$.y}h${$.width}v${$.height}h${-$.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}ko.displayName="MiniMap";M.memo(ko);function cp({nodeId:e,position:t,variant:n=ht.Handle,className:r,style:s={},children:i,color:o,minWidth:a=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:f=!1,shouldResize:u,onResizeStart:p,onResize:g,onResizeEnd:m}){const N=ro(),y=typeof e=="string"?e:N,E=te(),v=M.useRef(null),w=n===ht.Line?"right":"bottom-right",j=t??w,R=M.useRef(null);M.useEffect(()=>{if(!(!v.current||!y))return R.current||(R.current=Ef({domNode:v.current,nodeId:y,getStoreItems:()=>{const{nodeLookup:P,transform:L,snapGrid:T,snapToGrid:D,nodeOrigin:x,domNode:k}=E.getState();return{nodeLookup:P,transform:L,snapGrid:T,snapToGrid:D,nodeOrigin:x,paneDomNode:k}},onChange:(P,L)=>{const{triggerNodeChanges:T,nodeLookup:D,parentLookup:x,nodeOrigin:k}=E.getState(),_=[],I={x:P.x,y:P.y},b=D.get(y);if(b&&b.expandParent&&b.parentId){const S=b.origin??k,z=P.width??b.measured.width,H=P.height??b.measured.height,F={id:b.id,parentId:b.parentId,rect:{width:z,height:H,...ki({x:P.x??b.position.x,y:P.y??b.position.y},{width:z,height:H},b.parentId,D,S)}},Y=xr([F],D,x,k);_.push(...Y),I.x=P.x?Math.max(S[0]*z,P.x):void 0,I.y=P.y?Math.max(S[1]*H,P.y):void 0}if(I.x!==void 0&&I.y!==void 0){const S={id:y,type:"position",position:{...I}};_.push(S)}if(P.width!==void 0&&P.height!==void 0){const S={id:y,type:"dimensions",resizing:!0,setAttributes:!0,dimensions:{width:P.width,height:P.height}};_.push(S)}for(const S of L){const z={...S,type:"position"};_.push(z)}T(_)},onEnd:()=>{const P={id:y,type:"dimensions",resizing:!1};E.getState().triggerNodeChanges([P])}})),R.current.update({controlPosition:j,boundaries:{minWidth:a,minHeight:c,maxWidth:l,maxHeight:d},keepAspectRatio:f,onResizeStart:p,onResize:g,onResizeEnd:m,shouldResize:u}),()=>{var P;(P=R.current)==null||P.destroy()}},[j,a,c,l,d,f,p,g,m,u]);const C=j.split("-"),$=n===ht.Line?"borderColor":"backgroundColor",A=o?{...s,[$]:o}:s;return h.jsx("div",{className:se(["react-flow__resize-control","nodrag",...C,n,r]),ref:v,style:A,children:i})}M.memo(cp);const lp=new Set;function up(e){return e.startsWith("signal:child:")}function dp(e){const t=M.useMemo(()=>[...e].sort(),[e]),n=Fa({queries:t.map(s=>({queryKey:["run",s],queryFn:()=>ue.run(s)}))}),r={};return t.forEach((s,i)=>{var a;const o=(a=n[i])==null?void 0:a.data;o&&(r[s]=o)}),r}function fp({data:e}){const t=e.status==="failed",n=e.status==="pending"||e.status==="running",r=!!e.childRunId,s=r?Va:Ts(e.kind),i=t?{rail:"bg-red-400",badge:"bg-red-500/15 text-red-300",pill:"bg-red-500/20 text-red-300"}:n?{rail:"bg-amber-400",badge:"bg-amber-500/15 text-amber-300",pill:"bg-amber-500/20 text-amber-300"}:{rail:"bg-emerald-400",badge:"bg-emerald-500/15 text-emerald-300",pill:"bg-emerald-500/20 text-emerald-300"};return h.jsxs("div",{title:r?Hn.child:Hn[e.kind]??e.kind,className:`group relative w-[208px] cursor-pointer overflow-hidden rounded-xl border bg-[var(--panel)]/95 shadow-lg backdrop-blur transition-all duration-150 hover:-translate-y-0.5 ${e.selected?"border-emerald-400/60 ring-2 ring-emerald-400/30":t?"border-red-500/40 hover:border-red-400/60":r?"border-indigo-500/40 hover:border-indigo-400/60":"border-[var(--line)] hover:border-zinc-600"}`,children:[h.jsx("span",{className:`absolute inset-y-0 left-0 w-[3px] ${i.rail} ${n?"animate-pulse":""}`}),h.jsx(Te,{type:"target",position:q.Left,className:"!border-0 !bg-zinc-600"}),h.jsxs("div",{className:"py-2.5 pl-3.5 pr-3",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:`grid h-5 w-5 shrink-0 place-items-center rounded ${i.badge}`,children:h.jsx(s,{width:12,height:12})}),h.jsx("span",{className:"truncate text-[13px] font-medium text-zinc-100",children:e.name}),h.jsx("span",{className:`ml-auto grid h-4 w-4 shrink-0 place-items-center rounded-full ${i.pill} ${n?"animate-pulse":""}`,children:t?h.jsx(Ge,{width:9,height:9}):n?h.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-current"}):h.jsx(Ds,{width:9,height:9})})]}),h.jsxs("div",{className:"mono mt-1.5 flex items-center gap-1.5 text-[10px] text-zinc-500",children:[r?h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx("button",{type:"button",onClick:o=>{var a;o.stopPropagation(),e.childRunId&&((a=e.onToggleChild)==null||a.call(e,e.childRunId))},title:e.childExpanded?"Collapse child flow":"Expand child flow inline",className:"grid h-4 w-4 place-items-center rounded border border-indigo-500/30 bg-indigo-500/10 text-indigo-300 transition-colors hover:border-indigo-400/60 hover:bg-indigo-500/20 hover:text-indigo-200",children:h.jsx("span",{className:"inline-block text-[9px] transition-transform",style:{transform:e.childExpanded?"rotate(90deg)":"rotate(0deg)"},children:"▸"})}),h.jsx("button",{type:"button",onClick:o=>{var a;o.stopPropagation(),e.childRunId&&((a=e.onOpenRun)==null||a.call(e,e.childRunId))},title:"Open the child run",className:"rounded border border-indigo-500/30 bg-indigo-500/10 px-1 text-indigo-300 transition-colors hover:border-indigo-400/60 hover:bg-indigo-500/20 hover:text-indigo-200",children:"child ↗"})]}):h.jsx("span",{className:"rounded border border-[var(--line)] px-1 text-zinc-400",children:e.kind}),e.attempts>1&&h.jsxs("span",{className:"flex items-center gap-0.5 text-amber-300",children:[h.jsx(Ps,{width:9,height:9}),e.attempts]}),e.workerGroup&&h.jsxs("span",{className:"truncate",children:["@",e.workerGroup]}),h.jsxs("span",{className:"tnum ml-auto text-zinc-400",children:["#",e.seq,e.duration&&h.jsxs("span",{className:"text-zinc-600",children:[" · ",e.duration]})]})]}),e.subs&&h.jsxs("div",{className:"mono mt-1.5 flex items-center gap-2 border-t border-[var(--line)] pt-1.5 text-[10px]",children:[e.subs.ok>0&&h.jsxs("span",{className:"text-emerald-300",children:[e.subs.ok," ok"]}),e.subs.failed>0&&h.jsxs("span",{className:"text-red-300",children:[e.subs.failed," failed"]}),e.subs.skipped>0&&h.jsxs("span",{className:"text-amber-300",children:[e.subs.skipped," skipped"]})]})]}),h.jsx(Te,{type:"source",position:q.Right,className:"!border-0 !bg-zinc-600"})]})}function hp({data:e}){const t=e.status==="running"||e.status==="awaiting";return h.jsxs("div",{className:`s-${e.status} flex items-center gap-2 rounded-full border border-current/30 bg-[var(--panel)] px-3.5 py-1.5`,children:[h.jsx(Te,{type:"target",position:q.Left,className:"!border-0 !bg-zinc-600"}),h.jsx("span",{className:`dot ${t?"pulse":""}`}),h.jsx("span",{className:"mono text-[11px] uppercase tracking-wider",children:e.label}),h.jsx(Te,{type:"source",position:q.Right,className:"!border-0 !bg-zinc-600"})]})}const pp={step:fp,terminal:hp};function gp(e){var n;const t=(n=e.events)==null?void 0:n.filter(r=>r.status);if(!(!t||t.length===0))return{ok:t.filter(r=>r.status==="ok").length,failed:t.filter(r=>r.status==="failed").length,skipped:t.filter(r=>r.status==="skipped").length}}function mp({run:e,timeline:t,selectedKey:n,onSelect:r,onOpenRun:s,fmtDuration:i,expanded:o,onToggleChild:a}){const c=o??lp,l=M.useMemo(()=>{const g=new Set(c);for(const m of t){const N=Rn(m);N!==void 0&&g.add(N)}return g},[c,t]),d=dp(l),{nodes:f,edges:u}=(()=>{const y=[],E=[],v=e.status==="running"||e.status==="suspended",w=(T,D,x)=>({id:`${T}->${D}`,source:T,target:D,style:{stroke:x?"#f87171":"var(--line)",strokeWidth:1.5}}),j=(T,D)=>({id:`${T}=>${D}`,source:T,target:D,style:{stroke:"#818cf8",strokeWidth:1.5,strokeDasharray:"4 3"}});function R(T,D,x,k,_,I){var V;const b=`${_}s${T.seq}`,S=Rn(T),z=S!==void 0&&c.has(S),H=S!==void 0?((V=d[S])==null?void 0:V.run.workflow)??"child workflow":T.name,F=T.status==="failed";y.push({id:b,type:"step",draggable:!1,position:{x:D,y:x},data:{seq:T.seq,name:H,kind:T.kind,status:T.status,workerGroup:T.workerGroup,attempts:T.attempts,duration:i(T.startedAt,T.finishedAt),subs:gp(T),selected:n===`${T.runId}#${T.seq}`,childRunId:S,onOpenRun:s,childExpanded:z,onToggleChild:a,depth:k,step:T,laneRun:I}});const Y=S!==void 0&&z?d[S]:void 0;if(Y){const O=C(Y.timeline,k+1,D+248,x+150,`${S}:`,Y.run);for(const W of O.firstIds)E.push(j(b,W));const X=up(T.name)&&O.connectors.length>0?O.connectors:[{id:b,failed:F}];return{id:b,exits:X,nextX:Math.max(D+248,O.nextX),bottomY:Math.max(x,O.bottomY)}}return{id:b,exits:[{id:b,failed:F}],nextX:D+248,bottomY:x}}function C(T,D,x,k,_,I){let b=x;const S=[];let z=[],H=k;for(const F of Ba(T)){const Y=F.kind==="single"?[F.step]:F.steps,V=S.length===0,O=[];let X=k,W=b;for(const B of Y){const K=R(B,b,X,D,_,I);V&&S.push(K.id);for(const Z of z)E.push(w(Z.id,K.id,Z.failed));O.push(...K.exits),W=Math.max(W,K.nextX),X=K.bottomY+96}z=O,b=W,H=Math.max(H,X-96)}return{firstIds:S,connectors:z,nextX:b,bottomY:H}}const $=248;y.push({id:"start",type:"terminal",position:{x:0,y:0},draggable:!1,data:{status:"running",label:e.workflow}});const A=C(t,0,$,0,"",e);for(const T of A.firstIds)E.push({id:`start->${T}`,source:"start",target:T});const P=sr(e,t);y.push({id:"end",type:"terminal",position:{x:Math.max(A.nextX,$),y:0},draggable:!1,data:{status:P,label:P}});const L=A.connectors.length>0?A.connectors:[{id:"start",failed:!1}];for(const T of L)E.push({id:`${T.id}->end`,source:T.id,target:"end",animated:v,style:{stroke:v?"var(--accent)":"var(--line)",strokeWidth:v?2:1.5}});return{nodes:y,edges:E}})(),p=M.useCallback((g,m)=>{if(m.type!=="step")return;const N=m.data;N.step&&N.laneRun&&r(N.step,N.laneRun)},[r]);return h.jsxs(H0,{nodes:f,edges:u,nodeTypes:pp,onNodeClick:p,fitView:!0,fitViewOptions:{padding:.3,maxZoom:1.1},proOptions:{hideAttribution:!0},nodesConnectable:!1,nodesDraggable:!1,panOnScroll:!0,minZoom:.3,children:[h.jsx(O0,{variant:be.Dots,gap:22,size:1,color:"#1c1c22"}),h.jsx(U0,{showInteractive:!1,position:"bottom-right"})]})}function Co({className:e}){return h.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",className:e,role:"img","aria-label":"durable",children:[h.jsx("title",{children:"durable"}),h.jsx("path",{d:"M12 2.5 21.5 12 12 21.5 2.5 12z",opacity:.35}),h.jsx("circle",{cx:"6.4",cy:"12",r:"1.7",fill:"currentColor",stroke:"none"}),h.jsx("circle",{cx:"12",cy:"12",r:"1.7",fill:"currentColor",stroke:"none"}),h.jsx("circle",{cx:"17.6",cy:"12",r:"1.7",fill:"currentColor",stroke:"none"}),h.jsx("path",{d:"M8.1 12h2.2M13.7 12h2.2"})]})}const xp=["pending","running","suspended","completed","failed","cancelling","cancelled","dead"];function yp(e){const t=Date.now()-new Date(e).getTime(),n=Math.round(t/1e3);if(n<60)return`${n}s ago`;const r=Math.round(n/60);if(r<60)return`${r}m ago`;const s=Math.round(r/60);return s<24?`${s}h ago`:`${Math.round(s/24)}d ago`}function wp(e,t){const n=new Date(t).getTime()-new Date(e).getTime();return n<1e3?`${n}ms`:n<6e4?`${(n/1e3).toFixed(1)}s`:`${(n/6e4).toFixed(1)}m`}function jo({status:e}){const t=e==="running"||e==="awaiting"||e==="cancelling";return h.jsx("span",{className:`dot s-${e} ${t?"pulse":""}`,"aria-hidden":!0})}function Mo({status:e}){return h.jsxs("span",{className:`s-${e} inline-flex items-center gap-1.5 text-[11px] uppercase tracking-wider`,children:[h.jsx(jo,{status:e}),e]})}function vp({counts:e,filter:t,onFilter:n}){const r=Object.values(e).reduce((i,o)=>i+o,0),s=(i,o,a)=>h.jsxs("button",{type:"button",onClick:()=>n(i),className:`group flex items-center gap-2 rounded-md border px-2.5 py-1 text-xs transition-colors ${t===i?"border-zinc-600 bg-zinc-900 text-zinc-100":"border-transparent text-zinc-500 hover:text-zinc-300"}`,children:[i!=="all"&&h.jsx(jo,{status:i}),h.jsx("span",{className:"uppercase tracking-wide",children:o}),h.jsx("span",{className:"mono tnum text-zinc-600",children:a})]},i);return h.jsxs("header",{className:"z-10 flex items-center gap-4 border-b border-[var(--line)] px-5 py-3",children:[h.jsxs("div",{className:"flex items-center gap-2.5",children:[h.jsx("div",{className:"grid h-7 w-7 place-items-center rounded-md border border-emerald-500/30 bg-emerald-500/10",children:h.jsx(Co,{className:"h-4 w-4 text-emerald-400"})}),h.jsxs("div",{className:"leading-none",children:[h.jsx("div",{className:"text-sm font-semibold tracking-tight",children:"durable"}),h.jsx("div",{className:"mono text-[10px] uppercase tracking-[0.2em] text-zinc-600",children:"control plane"})]})]}),h.jsxs("div",{className:"ml-2 flex flex-wrap items-center gap-1",children:[s("all","all",r),xp.map(i=>s(i,i,e[i]??0))]}),h.jsx(bp,{}),h.jsxs("div",{className:"flex items-center gap-2 text-xs text-zinc-500",children:[h.jsx("span",{className:"dot s-completed pulse","aria-hidden":!0}),"live"]})]})}function bp(){const{data:e}=pt({queryKey:["workers"],queryFn:()=>ue.workers(),refetchInterval:1e4});return!e||e.length===0?null:h.jsx("div",{className:"ml-auto flex flex-wrap items-center gap-1.5",children:e.map(t=>{const n=t.liveWorkers.length,r=t.depth>0&&n===0;return h.jsxs("span",{title:`${t.group}: ${n} live worker(s), ${t.depth} queued${r?" — NO worker consuming":""}`,className:`mono flex items-center gap-1 rounded border px-1.5 py-0.5 text-[10px] ${r?"border-rose-500/50 bg-rose-500/15 text-rose-300":"border-[var(--line)] bg-zinc-800/40 text-zinc-400"}`,children:[h.jsx("span",{className:`dot ${r?"s-failed":n>0?"s-completed":""}`,"aria-hidden":!0}),t.group,h.jsxs("span",{className:"tnum text-zinc-500",children:[n,"w",t.depth>0?` ${t.depth}q`:""]})]},t.group)})})}function Np({runs:e,selected:t,onSelect:n,onSelectTag:r}){return e.length===0?h.jsx("div",{className:"p-6 text-sm text-zinc-600",children:"No runs yet."}):h.jsx("ul",{className:"divide-y divide-[var(--line-soft)]",children:e.map(s=>h.jsx("li",{children:h.jsxs("button",{type:"button",onClick:()=>n(s.id),className:`flex w-full flex-col gap-1 px-4 py-3 text-left transition-colors ${t===s.id?"bg-zinc-900":"hover:bg-zinc-900/50"}`,children:[h.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[h.jsx("span",{className:"truncate text-sm font-medium text-zinc-200",children:s.workflow}),s.id.startsWith("dlq:")&&h.jsx("span",{className:"mono shrink-0 rounded border border-rose-500/40 bg-rose-500/10 px-1 text-[9px] uppercase tracking-wider text-rose-300",children:"dlq"})]}),h.jsx(Mo,{status:sr(s)})]}),h.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.jsx("span",{className:"mono truncate text-[11px] text-zinc-600",children:s.id}),h.jsx("span",{className:"shrink-0 text-[11px] text-zinc-600",children:yp(s.updatedAt)})]}),s.tags&&s.tags.length>0&&h.jsx("div",{className:"flex flex-wrap gap-1",children:s.tags.map(i=>h.jsxs("span",{onClick:o=>{o.stopPropagation(),r(i)},className:"mono cursor-pointer rounded border border-[var(--line)] bg-zinc-800/40 px-1.5 text-[10px] text-zinc-400 hover:border-zinc-500 hover:text-zinc-200",children:["#",i]},i))})]})},s.id))})}function _p({id:e,onOpenRun:t}){var _,I;const n=rr(),{data:r}=pt({queryKey:["run",e],queryFn:async()=>Ka(n.getQueryData(["run",e]),await ue.run(e)),refetchInterval:b=>{var z;const S=(z=b.state.data)==null?void 0:z.run.status;return S==="running"||S==="suspended"?1500:!1}}),s=(r==null?void 0:r.run.status)==="dead"?`dlq:${e}`:void 0,{data:i}=pt({queryKey:["run",s],queryFn:()=>ue.run(s),enabled:!!s,retry:!1}),o=()=>{n.invalidateQueries({queryKey:["run",e]}),n.invalidateQueries({queryKey:["runs"]})},a=r==null?void 0:r.run.status,c=a==="running"||a==="suspended";M.useEffect(()=>{if(c)return ue.streamRun(e,b=>{if(b.type==="step.progress"&&b.event&&b.seq!=null){const S=b.seq,z=b.event;n.setQueryData(["run",e],H=>H&&{...H,timeline:H.timeline.map(F=>F.seq===S?{...F,events:[...F.events??[],z]}:F)});return}n.invalidateQueries({queryKey:["run",e]})})},[e,c,n]);const l=lt({mutationFn:()=>ue.retry(e),onSuccess:o}),d=lt({mutationFn:b=>ue.cancel(e,b!==void 0?{compensate:b}:{}),onSuccess:o}),f=lt({mutationFn:()=>ue.continue(e),onSuccess:o}),u=lt({mutationFn:b=>ue.retryWithInput(e,b),onSuccess:b=>{n.invalidateQueries({queryKey:["runs"]}),t(b.runId)}}),p=()=>{const b=JSON.stringify((r==null?void 0:r.run.input)??{},null,2),S=window.prompt("Fix the input, then replay as a fresh run:",b);if(S!=null)try{u.mutate(JSON.parse(S))}catch{window.alert("Invalid JSON")}},[g,m]=M.useState(),[N,y]=M.useState(!1),[E,v]=M.useState(new Set),[w,j]=M.useState(240);function R(b){b.preventDefault(),b.currentTarget.setPointerCapture(b.pointerId);const S=H=>j(F=>Math.max(120,Math.min(720,F-H.movementY))),z=()=>{window.removeEventListener("pointermove",S),window.removeEventListener("pointerup",z)};window.addEventListener("pointermove",S),window.addEventListener("pointerup",z)}function C(b){v(S=>{const z=new Set(S);return z.has(b)?z.delete(b):z.add(b),z})}if(!r)return h.jsx("div",{className:"p-8 text-sm text-zinc-600",children:"Loading run…"});const{run:$,timeline:A}=r,P=$.id.startsWith("dlq:"),L=P?{id:$.id.slice(4),title:"Dead-letter handler",subtitle:`started because run ${$.id.slice(4)} was dead-lettered`,cta:"open dead run →"}:i?{id:`dlq:${$.id}`,title:"Dead-lettered",subtitle:"this run exceeded recovery and was routed to a DLQ handler",cta:"open DLQ handler →"}:void 0,T=$.status==="failed"||$.status==="suspended",D=$.status==="running"||$.status==="suspended",x=A.some(b=>b.status==="pending"&&b.kind==="signal"&&b.name.startsWith("breakpoint")),k=g?`${g.step.runId}#${g.step.seq}`:void 0;return h.jsxs("div",{className:"flex h-full flex-col",children:[h.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-[var(--line)] px-7 py-5",children:[h.jsxs("div",{className:"min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:$.workflow}),P&&h.jsx("span",{className:"mono rounded border border-rose-500/40 bg-rose-500/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wider text-rose-300",children:"dlq"}),h.jsx(Mo,{status:sr($,A)}),h.jsxs("span",{className:"mono rounded border border-[var(--line)] px-1.5 py-0.5 text-[10px] text-zinc-500",children:["v",$.workflowVersion]}),h.jsxs("span",{className:"mono tnum text-[11px] text-zinc-600",children:[A.length," ",A.length===1?"step":"steps"]})]}),h.jsx("div",{className:"mono mt-1 truncate text-[11px] text-zinc-600",children:$.id}),$.tags&&$.tags.length>0&&h.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1",children:$.tags.map(b=>h.jsxs("span",{className:"mono rounded border border-[var(--line)] bg-zinc-800/40 px-1.5 text-[10px] text-zinc-400",children:["#",b]},b))}),$.searchAttributes&&Object.keys($.searchAttributes).length>0&&h.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1",children:Object.entries($.searchAttributes).map(([b,S])=>h.jsxs("span",{className:"mono rounded border border-indigo-500/30 bg-indigo-500/10 px-1.5 text-[10px] text-indigo-300",title:"search attribute",children:[b,"=",String(S)]},b))}),(_=r==null?void 0:r.children)!=null&&_.length?h.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-1",children:[h.jsx("span",{className:"text-[10px] text-zinc-600",children:"children:"}),(I=r.children)==null?void 0:I.map(b=>h.jsx("span",{onClick:()=>t(b),className:"mono cursor-pointer rounded border border-[var(--line)] bg-zinc-800/40 px-1.5 text-[10px] text-zinc-400 hover:border-zinc-500 hover:text-zinc-200",children:b},b))]}):null]}),h.jsxs("div",{className:"flex shrink-0 gap-2",children:[h.jsx("button",{type:"button",onClick:()=>y(!0),className:"mono rounded-md border border-[var(--line)] px-2.5 py-1.5 text-xs text-zinc-400 transition-colors hover:bg-zinc-800 hover:text-zinc-100",title:"Run input / output",children:"{ }"}),x&&h.jsxs("button",{type:"button",disabled:f.isPending,onClick:()=>f.mutate(),className:"flex items-center gap-1.5 rounded-md border border-amber-500/40 bg-amber-500/15 px-3 py-1.5 text-xs font-medium uppercase tracking-wide text-amber-200 transition-colors enabled:hover:bg-amber-500/25 disabled:opacity-30",children:[h.jsx(Oa,{width:12,height:12}),"Continue"]}),h.jsxs("button",{type:"button",disabled:!T||l.isPending,onClick:()=>l.mutate(),className:"flex items-center gap-1.5 rounded-md border border-emerald-500/30 bg-emerald-500/10 px-3 py-1.5 text-xs font-medium uppercase tracking-wide text-emerald-300 transition-colors enabled:hover:bg-emerald-500/20 disabled:opacity-30",children:[h.jsx(kn,{width:12,height:12}),"Retry"]}),($.status==="dead"||$.status==="failed")&&h.jsxs("button",{type:"button",disabled:u.isPending,onClick:p,title:"Edit the input and re-run as a fresh linked run",className:"flex items-center gap-1.5 rounded-md border border-indigo-500/30 bg-indigo-500/10 px-3 py-1.5 text-xs font-medium uppercase tracking-wide text-indigo-300 transition-colors enabled:hover:bg-indigo-500/20 disabled:opacity-30",children:[h.jsx(kn,{width:12,height:12}),"Fix & replay"]}),D&&h.jsxs("button",{type:"button",disabled:d.isPending,onClick:()=>d.mutate(!0),title:"Cancel and run saga compensations (undo completed steps in reverse)",className:"flex items-center gap-1.5 rounded-md border border-amber-600/30 px-3 py-1.5 text-xs font-medium uppercase tracking-wide text-amber-300/90 transition-colors enabled:hover:bg-amber-900/20 disabled:opacity-30",children:[h.jsx(kn,{width:12,height:12}),"Cancel + Undo"]}),h.jsxs("button",{type:"button",disabled:!D||d.isPending,onClick:()=>d.mutate(!1),className:"flex items-center gap-1.5 rounded-md border border-zinc-700 px-3 py-1.5 text-xs font-medium uppercase tracking-wide text-zinc-300 transition-colors enabled:hover:bg-zinc-800 disabled:opacity-30",children:[h.jsx(Ge,{width:12,height:12}),"Cancel"]})]})]}),L&&h.jsxs("div",{className:"flex items-center gap-3 border-b border-rose-500/30 bg-rose-500/10 px-7 py-3",children:[h.jsx("span",{className:"grid h-7 w-7 shrink-0 place-items-center rounded-md border border-rose-500/40 bg-rose-500/15 text-sm text-rose-300","aria-hidden":!0,children:"⚠"}),h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsx("div",{className:"text-[13px] font-medium text-rose-200",children:L.title}),h.jsx("div",{className:"mono truncate text-[11px] text-rose-300/70",children:L.subtitle})]}),h.jsx("button",{type:"button",onClick:()=>t(L.id),className:"mono shrink-0 rounded-md border border-rose-500/40 bg-rose-500/15 px-2.5 py-1.5 text-[11px] text-rose-200 transition-colors hover:bg-rose-500/25",children:L.cta})]}),h.jsxs("div",{className:"relative grid min-h-0 flex-1",style:{gridTemplateRows:A.length>0?`1fr ${w}px`:"1fr"},children:[h.jsxs("div",{className:"relative min-h-0",children:[A.length===0?h.jsx("div",{className:"grid h-full place-items-center text-sm text-zinc-600",children:"No steps recorded yet."}):h.jsx(mp,{run:$,timeline:A,selectedKey:k,onSelect:(b,S)=>m({step:b,run:S}),onOpenRun:t,fmtDuration:wp,expanded:E,onToggleChild:C}),($.status==="failed"||$.status==="cancelled")&&$.error&&h.jsx("div",{className:"mono absolute inset-x-6 bottom-6 rounded-lg border border-red-500/20 bg-red-500/10 px-3 py-2 text-xs text-red-300 backdrop-blur",children:$.error.message})]}),A.length>0&&h.jsxs("div",{className:"relative min-h-0 overflow-hidden border-t border-[var(--line)] bg-black/20",children:[h.jsx("div",{onPointerDown:R,className:"absolute inset-x-0 top-0 z-10 h-1.5 -translate-y-1/2 cursor-row-resize hover:bg-emerald-500/40",title:"Drag to resize"}),h.jsx(Xa,{run:$,timeline:A,selectedKey:k,onSelect:(b,S)=>m({step:b,run:S}),onOpenRun:t,expanded:E,onToggleChild:C})]}),g&&h.jsx(tc,{step:g.step,run:g.run,onClose:()=>m(void 0),onOpenRun:t}),N&&h.jsx(nc,{run:$,onClose:()=>y(!1)})]})]})}function Is(){if(typeof window>"u")return;const e=window.location.hash.match(/^#\/run\/(.+)$/),t=e==null?void 0:e[1];return t?decodeURIComponent(t):void 0}function Ep(){const[e,t]=M.useState("all"),[n,r]=M.useState(""),[s,i]=M.useState(""),[o,a]=M.useState(()=>Is()),c=M.useCallback(m=>{if(a(m),typeof window>"u")return;const N=m?`#/run/${encodeURIComponent(m)}`:"",y=N||window.location.pathname+window.location.search;window.location.hash!==N&&window.history.pushState(null,"",y)},[]);M.useEffect(()=>{const m=()=>a(Is());return window.addEventListener("hashchange",m),window.addEventListener("popstate",m),()=>{window.removeEventListener("hashchange",m),window.removeEventListener("popstate",m)}},[]);const l=rr(),d=s.split(",").map(m=>m.trim()).filter(Boolean),{data:f=[]}=pt({queryKey:["runs",n,d.join("|")],queryFn:()=>ue.runs(void 0,n||void 0,d.length?d:void 0),refetchInterval:3e3}),u=lt({mutationFn:m=>ue.bulk(m,{status:e!=="all"?e:void 0,tag:n||void 0,attr:d.length?d:void 0}),onSuccess:()=>l.invalidateQueries({queryKey:["runs"]})}),p=f.reduce((m,N)=>(m[N.status]=(m[N.status]??0)+1,m),{}),g=e==="all"?f:f.filter(m=>m.status===e);return h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"app-bg"}),h.jsxs("div",{className:"relative z-10 flex h-full flex-col",children:[h.jsx(vp,{counts:p,filter:e,onFilter:t}),h.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-[minmax(300px,360px)_1fr]",children:[h.jsxs("aside",{className:"flex min-h-0 flex-col border-r border-[var(--line)]",children:[h.jsxs("div",{className:"border-b border-[var(--line)] p-2",children:[h.jsxs("div",{className:"flex items-center gap-1.5 rounded-md border border-[var(--line)] px-2",children:[h.jsx("span",{className:"text-zinc-600",children:"#"}),h.jsx("input",{value:n,onChange:m=>r(m.target.value),placeholder:"filter by tag…",className:"mono w-full bg-transparent py-1.5 text-xs text-zinc-200 placeholder:text-zinc-600 focus:outline-none"}),n&&h.jsx("button",{type:"button",onClick:()=>r(""),className:"text-zinc-600 hover:text-zinc-300",title:"clear tag filter",children:h.jsx(Ge,{width:12,height:12})})]}),h.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 rounded-md border border-[var(--line)] px-2",children:[h.jsx("span",{className:"text-zinc-600",children:"⛃"}),h.jsx("input",{value:s,onChange:m=>i(m.target.value),placeholder:"attrs e.g. amount:gte:200, tier:eq:pro",title:"Typed search attributes: comma-separated key:op:value (ops eq ne gt gte lt lte)",className:"mono w-full bg-transparent py-1.5 text-xs text-zinc-200 placeholder:text-zinc-600 focus:outline-none"}),s&&h.jsx("button",{type:"button",onClick:()=>i(""),className:"text-zinc-600 hover:text-zinc-300",title:"clear attribute filter",children:h.jsx(Ge,{width:12,height:12})})]})]}),(e!=="all"||n||d.length>0)&&g.length>0&&h.jsxs("div",{className:"flex items-center gap-2 border-b border-[var(--line)] px-3 py-1.5",children:[h.jsxs("span",{className:"mono text-[10px] text-zinc-500",children:[g.length," ",e!=="all"?e:""," ",n&&`#${n}`,d.length>0&&` ⛃${d.length}`]}),h.jsx("button",{type:"button",disabled:u.isPending,onClick:()=>u.mutate("retry"),className:"mono ml-auto rounded border border-emerald-500/30 bg-emerald-500/10 px-1.5 py-0.5 text-[10px] text-emerald-300 transition-colors hover:bg-emerald-500/20 disabled:opacity-40",children:"retry all"}),h.jsx("button",{type:"button",disabled:u.isPending,onClick:()=>u.mutate("cancel"),className:"mono rounded border border-rose-500/30 bg-rose-500/10 px-1.5 py-0.5 text-[10px] text-rose-300 transition-colors hover:bg-rose-500/20 disabled:opacity-40",children:"cancel all"})]}),h.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:h.jsx(Np,{runs:g,selected:o,onSelect:c,onSelectTag:r})})]}),h.jsx("main",{className:"min-h-0",children:o?h.jsx(_p,{id:o,onOpenRun:c},o):h.jsx("div",{className:"grid h-full place-items-center text-center",children:h.jsxs("div",{className:"flex flex-col items-center",children:[h.jsx(Co,{className:"h-10 w-10 text-zinc-800"}),h.jsx("p",{className:"mt-3 text-sm text-zinc-600",children:"Select a run to see its timeline."})]})})})]})]})]})}const Sp=new Ya({defaultOptions:{queries:{refetchInterval:2e3,refetchOnWindowFocus:!1}}});qa(document.getElementById("root")).render(h.jsx(M.StrictMode,{children:h.jsx(Wa,{client:Sp,children:h.jsx(Ep,{})})}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Q as o,x as l,j as a,r as i,y as c,R as m}from"./index-ZjDhAZOY.js";const e=n=>new Date(n).toISOString(),t=Date.parse("2026-06-22T14:00:00.000Z"),p="gather:1",u=[{name:"handle_AF_FLEET",start:2e3,end:8200},{name:"handle_MEL",start:2120,end:6900},{name:"handle_METADATA",start:2050,end:5400},{name:"handle_MVR",start:2300,end:9600,failed:!0},{name:"handle_SCHED_MX",start:2080,end:7300},{name:"handle_SUBWO",start:2260,end:8900},{name:"handle_UTIL",start:2010,end:4700}],h=u.map((n,d)=>({runId:"mock-run",seq:2+d,name:n.name,kind:"remote",status:n.failed?"failed":"completed",parallelGroup:p,attempts:1,workerGroup:"gather",startedAt:e(t+n.start),finishedAt:e(t+n.end),...n.failed?{error:{message:"MVR lookup timed out after 7s"}}:{}})),f=[{runId:"mock-run",seq:1,name:"setup",kind:"local",status:"completed",attempts:1,startedAt:e(t+0),finishedAt:e(t+1800)},...h,{runId:"mock-run",seq:9,name:"finalize",kind:"local",status:"completed",attempts:1,startedAt:e(t+9700),finishedAt:e(t+11200)}],s={run:{id:"mock-run",workflow:"gatherAircraftData",workflowVersion:"1",status:"completed",createdAt:e(t),updatedAt:e(t+11200)},timeline:f},x=new o({defaultOptions:{queries:{refetchInterval:!1,refetchOnWindowFocus:!1}}}),r=()=>{};l(document.getElementById("root")).render(a.jsx(i.StrictMode,{children:a.jsxs(c,{client:x,children:[a.jsx("div",{className:"app-bg"}),a.jsxs("div",{className:"relative z-10 mx-auto max-w-3xl p-8",children:[a.jsx("div",{className:"mb-3 mono text-[10px] uppercase tracking-[0.2em] text-zinc-500",children:"preview · parallel-fan timeline"}),a.jsx("div",{className:"rounded-lg border border-[var(--line)] bg-[var(--panel)] p-2",children:a.jsx(m,{run:s.run,timeline:s.timeline,depth:0,selectedKey:void 0,onSelect:r,onOpenRun:r,expanded:new Set,onToggleChild:r})})]})]})}));
|
package/dist/spa/index.html
CHANGED
|
@@ -10,8 +10,10 @@
|
|
|
10
10
|
rel="stylesheet"
|
|
11
11
|
/>
|
|
12
12
|
<title>durable · control plane</title>
|
|
13
|
-
<script type="module" crossorigin src="/durable/assets/index-
|
|
14
|
-
<link rel="
|
|
13
|
+
<script type="module" crossorigin src="/durable/assets/index-uejPUBF0.js"></script>
|
|
14
|
+
<link rel="modulepreload" crossorigin href="/durable/assets/index-ZjDhAZOY.js">
|
|
15
|
+
<link rel="stylesheet" crossorigin href="/durable/assets/index-DncInMtX.css">
|
|
16
|
+
<link rel="stylesheet" crossorigin href="/durable/assets/index-B2Kz5wtG.css">
|
|
15
17
|
</head>
|
|
16
18
|
<body>
|
|
17
19
|
<div id="root"></div>
|