@workflow/web 5.0.0-beta.1 → 5.0.0-beta.3
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/README.md +1 -1
- package/build/client/assets/encryption-80GMP4r0.js +26 -0
- package/build/client/assets/entry.client-BWsSsWQm.js +11899 -0
- package/build/client/assets/highlighted-body-B3W2YXNL-Be0uLJd8.js +18 -0
- package/build/client/assets/home-Ce97yLJ7.js +4000 -0
- package/build/client/assets/index-DQa-BExo.js +9432 -0
- package/build/client/assets/{manifest-2d7ab41e.js → manifest-923d96a0.js} +1 -1
- package/build/client/assets/mermaid-3ZIDBTTL-BSJR0c5A.js +48117 -0
- package/build/client/assets/root-DXDFWibD.css +1 -0
- package/build/client/assets/root-DdOfCnSG.js +690 -0
- package/build/client/assets/run-detail-JQ32aJru.js +5190 -0
- package/build/client/assets/server-build-pZ5ucXET.css +1 -0
- package/build/client/assets/worker-CqHKTA7D.js +115 -0
- package/build/client/assets/workflow-graph-viewer-DYhMo9jl.js +16166 -0
- package/build/client/assets/{workflow-graph-viewer-yls6qlc0.css → workflow-graph-viewer-DnlNuQQH.css} +1 -1
- package/build/server/assets/{app-DaJqmGT8.js → app-Bh_7yjpl.js} +1 -1
- package/build/server/assets/{highlighted-body-B3W2YXNL-xowfciga.js → highlighted-body-B3W2YXNL-Cdb-ypB4.js} +3 -3
- package/build/server/assets/{index-CFBIzXaR.js → index-CNvEtg5c.js} +31 -30
- package/build/server/assets/{mermaid-3ZIDBTTL-nU8V7hWp.js → mermaid-3ZIDBTTL-CE8Volk5.js} +4 -4
- package/build/server/assets/{server-build-rhQJXUIP.js → server-build-DztRAoMd.js} +2585 -3718
- package/build/server/assets/{token-BZ35B6LQ.js → token-DMEdoEUo.js} +2 -2
- package/build/server/assets/{token-util-vRsmZMJV.js → token-util-DsMisyo3.js} +2 -2
- package/build/server/index.js +1 -1
- package/package.json +7 -7
- package/build/client/assets/encryption-8OvC6eoJ.js +0 -1
- package/build/client/assets/entry.client-BiVEcoV8.js +0 -29
- package/build/client/assets/highlighted-body-B3W2YXNL-epbVCzUZ.js +0 -1
- package/build/client/assets/home-cYqw84jW.js +0 -40
- package/build/client/assets/index-BmZS3y7B.js +0 -59
- package/build/client/assets/mermaid-3ZIDBTTL-CCXSRVd3.js +0 -210
- package/build/client/assets/root-aMfmV5uh.css +0 -1
- package/build/client/assets/root-kDmPgm4u.js +0 -26
- package/build/client/assets/run-detail-B5k2OYOu.js +0 -37
- package/build/client/assets/server-build-CiTtikBY.css +0 -1
- package/build/client/assets/worker-D-HfgUMl.js +0 -1
- package/build/client/assets/workflow-graph-viewer-B5c_xYyF.js +0 -161
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
var Ld=Object.defineProperty;var Fd=(e,t,n)=>t in e?Ld(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var br=(e,t,n)=>Fd(e,typeof t!="symbol"?t+"":t,n);import{c as le,aC as os,d as ae,G as zd,aD as go,E as me,aE as Hd,aF as Bd,aG as Wd,aH as Vd,aI as Yd,aJ as Gd,aK as Xd,aL as Ud,aM as qd,T as Se,a as Ce,b as _e,aN as Kd,aO as Zd,aP as Qd,aQ as Jd,aR as ef,p as mo,n as Yr,v as ss,O as tf,B as Dn,t as Re,s as Li,P as Pt,q as ze,x as Fi,m as nf,H as rf}from"./mermaid-3ZIDBTTL-CCXSRVd3.js";import{r as x,j as h,f as zi,R as de,H as of,C as sf,a as Hi,I as af}from"./index-BmZS3y7B.js";function Bi(e,t){if(typeof t!="string")return null;const[n,r,...o]=t.split("//");if(n!==e||!r||o.length===0)return null;const s=o.join("//");let i=s.split("/").at(-1)??"",a="";if(r.startsWith("./"))a=r.split("/").at(-1)??"";else{const c=r.split("@").slice(0,-1).join("@")||r.split("@")[0];a=(c==null?void 0:c.split("/").at(-1))??""}return["default","__default"].includes(i)&&a&&(i=a),{shortName:i,moduleSpecifier:r,functionName:s}}function tS(e){return Bi("workflow",e)}function nS(e){return Bi("step",e)}/**
|
|
2
|
-
* @license lucide-react v0.575.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const cf=[["path",{d:"M6.87 6.87a8 8 0 1 0 11.26 11.26",key:"3on8tj"}],["path",{d:"M19.9 14.25a8 8 0 0 0-9.15-9.15",key:"15ghsc"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.26 18.67 4 21",key:"yzmioq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M4 4 2 6",key:"1ycko6"}]],Wi=le("alarm-clock-off",cf);/**
|
|
7
|
-
* @license lucide-react v0.575.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const uf=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Bn=le("check",uf);/**
|
|
12
|
-
* @license lucide-react v0.575.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const lf=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],df=le("chevron-down",lf);/**
|
|
17
|
-
* @license lucide-react v0.575.0 - ISC
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the ISC license.
|
|
20
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const ff=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],hf=le("chevron-right",ff);/**
|
|
22
|
-
* @license lucide-react v0.575.0 - ISC
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the ISC license.
|
|
25
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const pf=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],rS=le("chevron-up",pf);/**
|
|
27
|
-
* @license lucide-react v0.575.0 - ISC
|
|
28
|
-
*
|
|
29
|
-
* This source code is licensed under the ISC license.
|
|
30
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const gf=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],mf=le("circle-alert",gf);/**
|
|
32
|
-
* @license lucide-react v0.575.0 - ISC
|
|
33
|
-
*
|
|
34
|
-
* This source code is licensed under the ISC license.
|
|
35
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/const yf=[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],xf=le("circle-play",yf);/**
|
|
37
|
-
* @license lucide-react v0.575.0 - ISC
|
|
38
|
-
*
|
|
39
|
-
* This source code is licensed under the ISC license.
|
|
40
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/const vf=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],wf=le("circle-stop",vf);/**
|
|
42
|
-
* @license lucide-react v0.575.0 - ISC
|
|
43
|
-
*
|
|
44
|
-
* This source code is licensed under the ISC license.
|
|
45
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
-
*/const bf=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Vi=le("circle-x",bf);/**
|
|
47
|
-
* @license lucide-react v0.575.0 - ISC
|
|
48
|
-
*
|
|
49
|
-
* This source code is licensed under the ISC license.
|
|
50
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
-
*/const Ef=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Sf=le("circle",Ef);/**
|
|
52
|
-
* @license lucide-react v0.575.0 - ISC
|
|
53
|
-
*
|
|
54
|
-
* This source code is licensed under the ISC license.
|
|
55
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
-
*/const Cf=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],is=le("clock",Cf);/**
|
|
57
|
-
* @license lucide-react v0.575.0 - ISC
|
|
58
|
-
*
|
|
59
|
-
* This source code is licensed under the ISC license.
|
|
60
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
-
*/const _f=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Gr=le("copy",_f);/**
|
|
62
|
-
* @license lucide-react v0.575.0 - ISC
|
|
63
|
-
*
|
|
64
|
-
* This source code is licensed under the ISC license.
|
|
65
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
66
|
-
*/const Nf=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Mf=le("ellipsis",Nf);/**
|
|
67
|
-
* @license lucide-react v0.575.0 - ISC
|
|
68
|
-
*
|
|
69
|
-
* This source code is licensed under the ISC license.
|
|
70
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
71
|
-
*/const kf=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],Pf=le("link-2",kf);/**
|
|
72
|
-
* @license lucide-react v0.575.0 - ISC
|
|
73
|
-
*
|
|
74
|
-
* This source code is licensed under the ISC license.
|
|
75
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
76
|
-
*/const If=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],Yi=le("rotate-cw",If);/**
|
|
77
|
-
* @license lucide-react v0.575.0 - ISC
|
|
78
|
-
*
|
|
79
|
-
* This source code is licensed under the ISC license.
|
|
80
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
81
|
-
*/const Af=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Rf=le("send",Af);/**
|
|
82
|
-
* @license lucide-react v0.575.0 - ISC
|
|
83
|
-
*
|
|
84
|
-
* This source code is licensed under the ISC license.
|
|
85
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
86
|
-
*/const Tf=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Df=le("x",Tf);/**
|
|
87
|
-
* @license lucide-react v0.575.0 - ISC
|
|
88
|
-
*
|
|
89
|
-
* This source code is licensed under the ISC license.
|
|
90
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
91
|
-
*/const jf=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],yo=le("zap",jf);function Of({title:e,className:t,details:n="Unknown error"}){const[r,o]=x.useState(!1);return h.jsx("div",{className:"flex justify-center w-full",children:h.jsxs("div",{className:os("rounded-lg border border-red-400 w-full max-w-[800px]",t),style:{background:"var(--ds-red-100)"},children:[h.jsxs("button",{type:"button",onClick:()=>o(!r),className:"w-full px-4 py-3 flex items-center justify-between gap-2 text-left transition-colors",style:{color:"var(--ds-red-900)"},children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(mf,{className:"h-4 w-4 shrink-0"}),h.jsx("span",{className:"font-medium text-sm",children:e})]}),h.jsxs("div",{className:"flex items-center gap-1.5 opacity-70",children:[h.jsx("span",{className:"text-xs",children:"Click to show details"}),h.jsx(df,{className:os("h-4 w-4 transition-transform duration-200",r&&"rotate-180")})]})]}),r&&n&&h.jsx("div",{className:"px-4 pb-3",style:{borderTop:"1px solid var(--ds-red-400)"},children:h.jsx("pre",{className:"mt-3 p-3 rounded-md text-xs font-mono whitespace-pre-wrap break-words overflow-auto",style:{background:"var(--ds-red-200)",color:"var(--ds-red-900)"},children:n})})]})})}class oS extends x.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}retry(){this.setState({hasError:!1,error:null})}componentDidCatch(t,n){var r,o;(o=(r=this.props).onCatch)==null||o.call(r,t,()=>this.retry())}render(){if(this.state.hasError){if(this.props.fallback)return this.props.fallback;const t=this.state.error instanceof Error?this.state.error:null,n=t!=null&&t.stack?`${t.message}
|
|
92
|
-
|
|
93
|
-
${t.stack}`:(t==null?void 0:t.message)??"Unknown error";return h.jsx(Of,{title:this.props.title||"An error occurred",details:n})}return this.props.children}}function sS({isOpen:e,onClose:t,onSubmit:n,isSubmitting:r=!1}){var g;const[o,s]=x.useState(""),[i,a]=x.useState(null),c=x.useRef(null);x.useEffect(()=>{e&&c.current&&c.current.focus()},[e]),x.useEffect(()=>{e||(s(""),a(null))},[e]),x.useEffect(()=>{const p=m=>{m.key==="Escape"&&e&&!r&&t()};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e,r,t]);const l=x.useCallback(async()=>{a(null);let p;try{o.trim()===""?p=null:p=JSON.parse(o)}catch{a("Invalid JSON. Please check your input.");return}await n(p)},[o,n]),d=x.useCallback(p=>{p.preventDefault(),l()},[l]),u=typeof navigator<"u"&&(((g=navigator.userAgentData)==null?void 0:g.platform)??navigator.userAgent).toLowerCase().includes("mac"),f=x.useCallback(p=>{(p.metaKey||p.ctrlKey)&&p.key==="Enter"&&!r&&(p.preventDefault(),d(p))},[d,r]);return e?h.jsxs("div",{style:{position:"fixed",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center"},role:"dialog","aria-modal":"true","aria-labelledby":"resolve-hook-modal-title",children:[h.jsx("div",{style:{position:"absolute",inset:0,background:"rgba(0, 0, 0, 0.7)"},onClick:r?void 0:t}),h.jsxs("div",{style:{position:"relative",zIndex:10,width:480,maxWidth:"calc(100% - 32px)",borderRadius:12,border:"none",boxShadow:"var(--ds-shadow-menu)",background:"var(--ds-background-100)",color:"var(--ds-gray-1000)",overflow:"hidden"},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 24px"},children:[h.jsx("h2",{id:"resolve-hook-modal-title",style:{margin:0,fontSize:16,fontWeight:600,color:"var(--ds-gray-1000)"},children:"Resolve Hook"}),h.jsx("button",{type:"button",onClick:t,disabled:r,"aria-label":"Close modal",style:{display:"flex",alignItems:"center",justifyContent:"center",padding:4,borderRadius:6,border:"none",background:"transparent",color:"var(--ds-gray-900)",cursor:r?"not-allowed":"pointer",opacity:r?.5:1,transition:"background 0.15s"},onMouseEnter:p=>{p.currentTarget.style.background="var(--ds-gray-alpha-200)"},onMouseLeave:p=>{p.currentTarget.style.background="transparent"},children:h.jsx(Df,{style:{width:16,height:16}})})]}),h.jsxs("form",{onSubmit:d,children:[h.jsxs("div",{style:{padding:"0 24px 16px"},children:[h.jsx("label",{htmlFor:"json-payload",style:{display:"block",fontSize:14,fontWeight:500,marginBottom:6,color:"var(--ds-gray-1000)"},children:"JSON Payload"}),h.jsxs("p",{style:{fontSize:13,marginBottom:12,marginTop:0,color:"var(--ds-gray-900)",lineHeight:1.5},children:["Enter a JSON value to send to the hook. Leave empty to send"," ",h.jsx("code",{style:{padding:"2px 6px",borderRadius:4,fontSize:12,fontFamily:'var(--font-mono, ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace)',background:"var(--ds-gray-alpha-200)",color:"var(--ds-gray-1000)"},children:"null"}),"."]}),h.jsx("textarea",{ref:c,id:"json-payload",value:o,onChange:p=>{s(p.target.value),a(null)},onKeyDown:f,disabled:r,placeholder:'{"key": "value"}',style:{width:"100%",height:160,padding:"8px 12px",fontFamily:'var(--font-mono, ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace)',fontSize:13,lineHeight:1.5,borderRadius:8,border:`1px solid ${i?"var(--ds-red-700)":"var(--ds-gray-alpha-400)"}`,color:"var(--ds-gray-1000)",background:"var(--ds-background-100)",outline:"none",resize:"none",opacity:r?.5:1,cursor:r?"not-allowed":"text",boxSizing:"border-box"}}),i&&h.jsx("p",{style:{marginTop:8,fontSize:13,color:"var(--ds-red-900)",margin:"8px 0 0"},children:i}),h.jsxs("p",{style:{marginTop:8,fontSize:12,color:"var(--ds-gray-800)",margin:"8px 0 0"},children:["Press"," ",h.jsxs("kbd",{style:{padding:"2px 5px",borderRadius:4,fontSize:11,fontFamily:'var(--font-mono, ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace)',background:"var(--ds-gray-alpha-200)",border:"1px solid var(--ds-gray-alpha-400)"},children:[u?"⌘":"Ctrl","+Enter"]})," ","to submit"]})]}),h.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8,padding:"12px 24px",borderTop:"1px solid var(--ds-gray-alpha-400)"},children:[h.jsx("button",{type:"button",onClick:t,disabled:r,style:{padding:"8px 16px",fontSize:14,fontWeight:500,borderRadius:8,border:"1px solid var(--ds-gray-alpha-400)",background:"var(--ds-background-100)",color:"var(--ds-gray-1000)",cursor:r?"not-allowed":"pointer",opacity:r?.5:1,transition:"background 0.15s"},onMouseEnter:p=>{p.currentTarget.style.background="var(--ds-gray-alpha-100)"},onMouseLeave:p=>{p.currentTarget.style.background="var(--ds-background-100)"},children:"Cancel"}),h.jsxs("button",{type:"button",onClick:()=>void l(),disabled:r,style:{display:"flex",alignItems:"center",gap:6,padding:"8px 16px",fontSize:14,fontWeight:500,borderRadius:8,border:"none",background:"var(--ds-gray-1000)",color:"var(--ds-background-100)",cursor:r?"not-allowed":"pointer",opacity:r?.5:1,transition:"opacity 0.15s"},onMouseEnter:p=>{r||(p.currentTarget.style.opacity="0.9")},onMouseLeave:p=>{r||(p.currentTarget.style.opacity="1")},children:[h.jsx(Rf,{style:{width:14,height:14}}),r?"Sending...":"Send Payload"]})]})]})]})]}):null}function $f(e){if(!e||e.length===0)return{hasPendingSleeps:!1,hasPendingSteps:!1,hasPendingHooks:!1,pendingSleepIds:[],pendingStepIds:[],pendingHookIds:[],lastStepActivityAt:null,lastStepCompletionAt:null};const t=new Map,n=new Set,r=new Map,o=new Set,s=new Map,i=new Set;let a=null,c=null;for(const f of e){const g=f.correlationId;if(g)switch(f.eventType){case"wait_created":t.set(g,f);break;case"wait_completed":n.add(g);break;case"step_started":r.set(g,f),(!a||new Date(f.createdAt)>a)&&(a=new Date(f.createdAt));break;case"step_retrying":(!a||new Date(f.createdAt)>a)&&(a=new Date(f.createdAt));break;case"step_completed":case"step_failed":o.add(g),(!c||new Date(f.createdAt)>c)&&(c=new Date(f.createdAt));break;case"hook_created":s.set(g,f);break;case"hook_disposed":i.add(g);break}}const l=Array.from(t.keys()).filter(f=>!n.has(f)),d=Array.from(r.keys()).filter(f=>!o.has(f)),u=Array.from(s.keys()).filter(f=>!i.has(f));return{hasPendingSleeps:l.length>0,hasPendingSteps:d.length>0,hasPendingHooks:u.length>0,pendingSleepIds:l,pendingStepIds:d,pendingHookIds:u,lastStepActivityAt:a,lastStepCompletionAt:c}}const Lf=zd("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),Ff=x.forwardRef(({className:e,variant:t,...n},r)=>h.jsx("div",{ref:r,role:"alert",className:ae(Lf({variant:t}),e),...n}));Ff.displayName="Alert";const zf=x.forwardRef(({className:e,...t},n)=>h.jsx("h5",{ref:n,className:ae("mb-1 font-medium leading-none tracking-tight",e),...t}));zf.displayName="AlertTitle";const Hf=x.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:ae("text-sm [&_p]:leading-relaxed",e),...t}));Hf.displayName="AlertDescription";function ne(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function iS(e,t){const n=x.createContext(t),r=s=>{const{children:i,...a}=s,c=x.useMemo(()=>a,Object.values(a));return h.jsx(n.Provider,{value:c,children:i})};r.displayName=e+"Provider";function o(s){const i=x.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,o]}function rn(e,t=[]){let n=[];function r(s,i){const a=x.createContext(i),c=n.length;n=[...n,i];const l=u=>{var w;const{scope:f,children:g,...p}=u,m=((w=f==null?void 0:f[e])==null?void 0:w[c])||a,v=x.useMemo(()=>p,Object.values(p));return h.jsx(m.Provider,{value:v,children:g})};l.displayName=s+"Provider";function d(u,f){var m;const g=((m=f==null?void 0:f[e])==null?void 0:m[c])||a,p=x.useContext(g);if(p)return p;if(i!==void 0)return i;throw new Error(`\`${u}\` must be used within \`${s}\``)}return[l,d]}const o=()=>{const s=n.map(i=>x.createContext(i));return function(a){const c=(a==null?void 0:a[e])||s;return x.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return o.scopeName=e,[r,Bf(o,...t)]}function Bf(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((a,{useScope:c,scopeName:l})=>{const u=c(s)[`__scope${l}`];return{...a,...u}},{});return x.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function Pe(e){const t=x.useRef(e);return x.useEffect(()=>{t.current=e}),x.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function Gi({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=Wf({defaultProp:t,onChange:n}),s=e!==void 0,i=s?e:r,a=Pe(n),c=x.useCallback(l=>{if(s){const u=typeof l=="function"?l(e):l;u!==e&&a(u)}else o(l)},[s,e,o,a]);return[i,c]}function Wf({defaultProp:e,onChange:t}){const n=x.useState(e),[r]=n,o=x.useRef(r),s=Pe(t);return x.useEffect(()=>{o.current!==r&&(s(r),o.current=r)},[r,o,s]),n}var Vt=x.forwardRef((e,t)=>{const{children:n,...r}=e,o=x.Children.toArray(n),s=o.find(Yf);if(s){const i=s.props.children,a=o.map(c=>c===s?x.Children.count(i)>1?x.Children.only(null):x.isValidElement(i)?i.props.children:null:c);return h.jsx(Xr,{...r,ref:t,children:x.isValidElement(i)?x.cloneElement(i,void 0,a):null})}return h.jsx(Xr,{...r,ref:t,children:n})});Vt.displayName="Slot";var Xr=x.forwardRef((e,t)=>{const{children:n,...r}=e;if(x.isValidElement(n)){const o=Xf(n),s=Gf(r,n.props);return n.type!==x.Fragment&&(s.ref=t?go(t,o):o),x.cloneElement(n,s)}return x.Children.count(n)>1?x.Children.only(null):null});Xr.displayName="SlotClone";var Vf=({children:e})=>h.jsx(h.Fragment,{children:e});function Yf(e){return x.isValidElement(e)&&e.type===Vf}function Gf(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{s(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function Xf(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Uf=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],fe=Uf.reduce((e,t)=>{const n=x.forwardRef((r,o)=>{const{asChild:s,...i}=r,a=s?Vt:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),h.jsx(a,{...i,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function Xi(e,t){e&&zi.flushSync(()=>e.dispatchEvent(t))}function Ui(e){const t=e+"CollectionProvider",[n,r]=rn(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=g=>{const{scope:p,children:m}=g,v=de.useRef(null),w=de.useRef(new Map).current;return h.jsx(o,{scope:p,itemMap:w,collectionRef:v,children:m})};i.displayName=t;const a=e+"CollectionSlot",c=de.forwardRef((g,p)=>{const{scope:m,children:v}=g,w=s(a,m),E=me(p,w.collectionRef);return h.jsx(Vt,{ref:E,children:v})});c.displayName=a;const l=e+"CollectionItemSlot",d="data-radix-collection-item",u=de.forwardRef((g,p)=>{const{scope:m,children:v,...w}=g,E=de.useRef(null),y=me(p,E),b=s(l,m);return de.useEffect(()=>(b.itemMap.set(E,{ref:E,...w}),()=>void b.itemMap.delete(E))),h.jsx(Vt,{[d]:"",ref:y,children:v})});u.displayName=l;function f(g){const p=s(e+"CollectionConsumer",g);return de.useCallback(()=>{const v=p.collectionRef.current;if(!v)return[];const w=Array.from(v.querySelectorAll(`[${d}]`));return Array.from(p.itemMap.values()).sort((b,S)=>w.indexOf(b.ref.current)-w.indexOf(S.ref.current))},[p.collectionRef,p.itemMap])}return[{Provider:i,Slot:c,ItemSlot:u},f,r]}var qf=x.createContext(void 0);function qi(e){const t=x.useContext(qf);return e||t||"ltr"}function Kf(e,t=globalThis==null?void 0:globalThis.document){const n=Pe(e);x.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var Zf="DismissableLayer",Ur="dismissableLayer.update",Qf="dismissableLayer.pointerDownOutside",Jf="dismissableLayer.focusOutside",as,Ki=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Zi=x.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:a,...c}=e,l=x.useContext(Ki),[d,u]=x.useState(null),f=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=x.useState({}),p=me(t,M=>u(M)),m=Array.from(l.layers),[v]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),w=m.indexOf(v),E=d?m.indexOf(d):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,b=E>=w,S=nh(M=>{const P=M.target,T=[...l.branches].some(z=>z.contains(P));!b||T||(o==null||o(M),i==null||i(M),M.defaultPrevented||a==null||a())},f),_=rh(M=>{const P=M.target;[...l.branches].some(z=>z.contains(P))||(s==null||s(M),i==null||i(M),M.defaultPrevented||a==null||a())},f);return Kf(M=>{E===l.layers.size-1&&(r==null||r(M),!M.defaultPrevented&&a&&(M.preventDefault(),a()))},f),x.useEffect(()=>{if(d)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(as=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(d)),l.layers.add(d),cs(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=as)}},[d,f,n,l]),x.useEffect(()=>()=>{d&&(l.layers.delete(d),l.layersWithOutsidePointerEventsDisabled.delete(d),cs())},[d,l]),x.useEffect(()=>{const M=()=>g({});return document.addEventListener(Ur,M),()=>document.removeEventListener(Ur,M)},[]),h.jsx(fe.div,{...c,ref:p,style:{pointerEvents:y?b?"auto":"none":void 0,...e.style},onFocusCapture:ne(e.onFocusCapture,_.onFocusCapture),onBlurCapture:ne(e.onBlurCapture,_.onBlurCapture),onPointerDownCapture:ne(e.onPointerDownCapture,S.onPointerDownCapture)})});Zi.displayName=Zf;var eh="DismissableLayerBranch",th=x.forwardRef((e,t)=>{const n=x.useContext(Ki),r=x.useRef(null),o=me(t,r);return x.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),h.jsx(fe.div,{...e,ref:o})});th.displayName=eh;function nh(e,t=globalThis==null?void 0:globalThis.document){const n=Pe(e),r=x.useRef(!1),o=x.useRef(()=>{});return x.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let c=function(){Qi(Qf,n,l,{discrete:!0})};const l={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function rh(e,t=globalThis==null?void 0:globalThis.document){const n=Pe(e),r=x.useRef(!1);return x.useEffect(()=>{const o=s=>{s.target&&!r.current&&Qi(Jf,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function cs(){const e=new CustomEvent(Ur);document.dispatchEvent(e)}function Qi(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Xi(o,s):o.dispatchEvent(s)}var Er=0;function oh(){x.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??us()),document.body.insertAdjacentElement("beforeend",e[1]??us()),Er++,()=>{Er===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Er--}},[])}function us(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Sr="focusScope.autoFocusOnMount",Cr="focusScope.autoFocusOnUnmount",ls={bubbles:!1,cancelable:!0},sh="FocusScope",Ji=x.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...i}=e,[a,c]=x.useState(null),l=Pe(o),d=Pe(s),u=x.useRef(null),f=me(t,m=>c(m)),g=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(r){let m=function(y){if(g.paused||!a)return;const b=y.target;a.contains(b)?u.current=b:Xe(u.current,{select:!0})},v=function(y){if(g.paused||!a)return;const b=y.relatedTarget;b!==null&&(a.contains(b)||Xe(u.current,{select:!0}))},w=function(y){if(document.activeElement===document.body)for(const S of y)S.removedNodes.length>0&&Xe(a)};document.addEventListener("focusin",m),document.addEventListener("focusout",v);const E=new MutationObserver(w);return a&&E.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",v),E.disconnect()}}},[r,a,g.paused]),x.useEffect(()=>{if(a){fs.add(g);const m=document.activeElement;if(!a.contains(m)){const w=new CustomEvent(Sr,ls);a.addEventListener(Sr,l),a.dispatchEvent(w),w.defaultPrevented||(ih(dh(ea(a)),{select:!0}),document.activeElement===m&&Xe(a))}return()=>{a.removeEventListener(Sr,l),setTimeout(()=>{const w=new CustomEvent(Cr,ls);a.addEventListener(Cr,d),a.dispatchEvent(w),w.defaultPrevented||Xe(m??document.body,{select:!0}),a.removeEventListener(Cr,d),fs.remove(g)},0)}}},[a,l,d,g]);const p=x.useCallback(m=>{if(!n&&!r||g.paused)return;const v=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,w=document.activeElement;if(v&&w){const E=m.currentTarget,[y,b]=ah(E);y&&b?!m.shiftKey&&w===b?(m.preventDefault(),n&&Xe(y,{select:!0})):m.shiftKey&&w===y&&(m.preventDefault(),n&&Xe(b,{select:!0})):w===E&&m.preventDefault()}},[n,r,g.paused]);return h.jsx(fe.div,{tabIndex:-1,...i,ref:f,onKeyDown:p})});Ji.displayName=sh;function ih(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Xe(r,{select:t}),document.activeElement!==n)return}function ah(e){const t=ea(e),n=ds(t,e),r=ds(t.reverse(),e);return[n,r]}function ea(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ds(e,t){for(const n of e)if(!ch(n,{upTo:t}))return n}function ch(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function uh(e){return e instanceof HTMLInputElement&&"select"in e}function Xe(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&uh(e)&&t&&e.select()}}var fs=lh();function lh(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=hs(e,t),e.unshift(t)},remove(t){var n;e=hs(e,t),(n=e[0])==null||n.resume()}}}function hs(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function dh(e){return e.filter(t=>t.tagName!=="A")}var rt=globalThis!=null&&globalThis.document?x.useLayoutEffect:()=>{},fh=of.useId||(()=>{}),hh=0;function qr(e){const[t,n]=x.useState(fh());return rt(()=>{n(r=>r??String(hh++))},[e]),t?`radix-${t}`:""}var ph="Arrow",ta=x.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return h.jsx(fe.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:h.jsx("polygon",{points:"0,0 30,0 15,10"})})});ta.displayName=ph;var gh=ta;function mh(e){const[t,n]=x.useState(void 0);return rt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let i,a;if("borderBoxSize"in s){const c=s.borderBoxSize,l=Array.isArray(c)?c[0]:c;i=l.inlineSize,a=l.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var xo="Popper",[na,ra]=rn(xo),[yh,oa]=na(xo),sa=e=>{const{__scopePopper:t,children:n}=e,[r,o]=x.useState(null);return h.jsx(yh,{scope:t,anchor:r,onAnchorChange:o,children:n})};sa.displayName=xo;var ia="PopperAnchor",aa=x.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=oa(ia,n),i=x.useRef(null),a=me(t,i);return x.useEffect(()=>{s.onAnchorChange((r==null?void 0:r.current)||i.current)}),r?null:h.jsx(fe.div,{...o,ref:a})});aa.displayName=ia;var vo="PopperContent",[xh,vh]=na(vo),ca=x.forwardRef((e,t)=>{var G,H,V,Q,Z,K;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:d=0,sticky:u="partial",hideWhenDetached:f=!1,updatePositionStrategy:g="optimized",onPlaced:p,...m}=e,v=oa(vo,n),[w,E]=x.useState(null),y=me(t,q=>E(q)),[b,S]=x.useState(null),_=mh(b),M=(_==null?void 0:_.width)??0,P=(_==null?void 0:_.height)??0,T=r+(s!=="center"?"-"+s:""),z=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},A=Array.isArray(l)?l:[l],D=A.length>0,F={padding:z,boundary:A.filter(bh),altBoundary:D},{refs:C,floatingStyles:R,placement:k,isPositioned:j,middlewareData:I}=Hd({strategy:"fixed",placement:T,whileElementsMounted:(...q)=>qd(...q,{animationFrame:g==="always"}),elements:{reference:v.anchor},middleware:[Bd({mainAxis:o+P,alignmentAxis:i}),c&&Wd({mainAxis:!0,crossAxis:!1,limiter:u==="partial"?Ud():void 0,...F}),c&&Vd({...F}),Yd({...F,apply:({elements:q,rects:ee,availableWidth:oe,availableHeight:te})=>{const{width:ue,height:Ae}=ee.reference,pe=q.floating.style;pe.setProperty("--radix-popper-available-width",`${oe}px`),pe.setProperty("--radix-popper-available-height",`${te}px`),pe.setProperty("--radix-popper-anchor-width",`${ue}px`),pe.setProperty("--radix-popper-anchor-height",`${Ae}px`)}}),b&&Gd({element:b,padding:a}),Eh({arrowWidth:M,arrowHeight:P}),f&&Xd({strategy:"referenceHidden",...F})]}),[N,O]=da(k),$=Pe(p);rt(()=>{j&&($==null||$())},[j,$]);const L=(G=I.arrow)==null?void 0:G.x,B=(H=I.arrow)==null?void 0:H.y,W=((V=I.arrow)==null?void 0:V.centerOffset)!==0,[X,U]=x.useState();return rt(()=>{w&&U(window.getComputedStyle(w).zIndex)},[w]),h.jsx("div",{ref:C.setFloating,"data-radix-popper-content-wrapper":"",style:{...R,transform:j?R.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:X,"--radix-popper-transform-origin":[(Q=I.transformOrigin)==null?void 0:Q.x,(Z=I.transformOrigin)==null?void 0:Z.y].join(" "),...((K=I.hide)==null?void 0:K.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:h.jsx(xh,{scope:n,placedSide:N,onArrowChange:S,arrowX:L,arrowY:B,shouldHideArrow:W,children:h.jsx(fe.div,{"data-side":N,"data-align":O,...m,ref:y,style:{...m.style,animation:j?void 0:"none"}})})})});ca.displayName=vo;var ua="PopperArrow",wh={top:"bottom",right:"left",bottom:"top",left:"right"},la=x.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=vh(ua,r),i=wh[s.placedSide];return h.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:h.jsx(gh,{...o,ref:n,style:{...o.style,display:"block"}})})});la.displayName=ua;function bh(e){return e!==null}var Eh=e=>({name:"transformOrigin",options:e,fn(t){var v,w,E;const{placement:n,rects:r,middlewareData:o}=t,i=((v=o.arrow)==null?void 0:v.centerOffset)!==0,a=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[l,d]=da(n),u={start:"0%",center:"50%",end:"100%"}[d],f=(((w=o.arrow)==null?void 0:w.x)??0)+a/2,g=(((E=o.arrow)==null?void 0:E.y)??0)+c/2;let p="",m="";return l==="bottom"?(p=i?u:`${f}px`,m=`${-c}px`):l==="top"?(p=i?u:`${f}px`,m=`${r.floating.height+c}px`):l==="right"?(p=`${-c}px`,m=i?u:`${g}px`):l==="left"&&(p=`${r.floating.width+c}px`,m=i?u:`${g}px`),{data:{x:p,y:m}}}});function da(e){const[t,n="center"]=e.split("-");return[t,n]}var Sh=sa,Ch=aa,_h=ca,Nh=la,Mh="Portal",fa=x.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,s]=x.useState(!1);rt(()=>s(!0),[]);const i=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return i?sf.createPortal(h.jsx(fe.div,{...r,ref:t}),i):null});fa.displayName=Mh;function kh(e,t){return x.useReducer((n,r)=>t[n][r]??n,e)}var on=e=>{const{present:t,children:n}=e,r=Ph(t),o=typeof n=="function"?n({present:r.isPresent}):x.Children.only(n),s=me(r.ref,Ih(o));return typeof n=="function"||r.isPresent?x.cloneElement(o,{ref:s}):null};on.displayName="Presence";function Ph(e){const[t,n]=x.useState(),r=x.useRef({}),o=x.useRef(e),s=x.useRef("none"),i=e?"mounted":"unmounted",[a,c]=kh(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const l=wn(r.current);s.current=a==="mounted"?l:"none"},[a]),rt(()=>{const l=r.current,d=o.current;if(d!==e){const f=s.current,g=wn(l);e?c("MOUNT"):g==="none"||(l==null?void 0:l.display)==="none"?c("UNMOUNT"):c(d&&f!==g?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),rt(()=>{if(t){let l;const d=t.ownerDocument.defaultView??window,u=g=>{const m=wn(r.current).includes(g.animationName);if(g.target===t&&m&&(c("ANIMATION_END"),!o.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",l=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},f=g=>{g.target===t&&(s.current=wn(r.current))};return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{d.clearTimeout(l),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:x.useCallback(l=>{l&&(r.current=getComputedStyle(l)),n(l)},[])}}function wn(e){return(e==null?void 0:e.animationName)||"none"}function Ih(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var _r="rovingFocusGroup.onEntryFocus",Ah={bubbles:!1,cancelable:!0},rr="RovingFocusGroup",[Kr,ha,Rh]=Ui(rr),[Th,pa]=rn(rr,[Rh]),[Dh,jh]=Th(rr),ga=x.forwardRef((e,t)=>h.jsx(Kr.Provider,{scope:e.__scopeRovingFocusGroup,children:h.jsx(Kr.Slot,{scope:e.__scopeRovingFocusGroup,children:h.jsx(Oh,{...e,ref:t})})}));ga.displayName=rr;var Oh=x.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:d=!1,...u}=e,f=x.useRef(null),g=me(t,f),p=qi(s),[m=null,v]=Gi({prop:i,defaultProp:a,onChange:c}),[w,E]=x.useState(!1),y=Pe(l),b=ha(n),S=x.useRef(!1),[_,M]=x.useState(0);return x.useEffect(()=>{const P=f.current;if(P)return P.addEventListener(_r,y),()=>P.removeEventListener(_r,y)},[y]),h.jsx(Dh,{scope:n,orientation:r,dir:p,loop:o,currentTabStopId:m,onItemFocus:x.useCallback(P=>v(P),[v]),onItemShiftTab:x.useCallback(()=>E(!0),[]),onFocusableItemAdd:x.useCallback(()=>M(P=>P+1),[]),onFocusableItemRemove:x.useCallback(()=>M(P=>P-1),[]),children:h.jsx(fe.div,{tabIndex:w||_===0?-1:0,"data-orientation":r,...u,ref:g,style:{outline:"none",...e.style},onMouseDown:ne(e.onMouseDown,()=>{S.current=!0}),onFocus:ne(e.onFocus,P=>{const T=!S.current;if(P.target===P.currentTarget&&T&&!w){const z=new CustomEvent(_r,Ah);if(P.currentTarget.dispatchEvent(z),!z.defaultPrevented){const A=b().filter(k=>k.focusable),D=A.find(k=>k.active),F=A.find(k=>k.id===m),R=[D,F,...A].filter(Boolean).map(k=>k.ref.current);xa(R,d)}}S.current=!1}),onBlur:ne(e.onBlur,()=>E(!1))})})}),ma="RovingFocusGroupItem",ya=x.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,...i}=e,a=qr(),c=s||a,l=jh(ma,n),d=l.currentTabStopId===c,u=ha(n),{onFocusableItemAdd:f,onFocusableItemRemove:g}=l;return x.useEffect(()=>{if(r)return f(),()=>g()},[r,f,g]),h.jsx(Kr.ItemSlot,{scope:n,id:c,focusable:r,active:o,children:h.jsx(fe.span,{tabIndex:d?0:-1,"data-orientation":l.orientation,...i,ref:t,onMouseDown:ne(e.onMouseDown,p=>{r?l.onItemFocus(c):p.preventDefault()}),onFocus:ne(e.onFocus,()=>l.onItemFocus(c)),onKeyDown:ne(e.onKeyDown,p=>{if(p.key==="Tab"&&p.shiftKey){l.onItemShiftTab();return}if(p.target!==p.currentTarget)return;const m=Fh(p,l.orientation,l.dir);if(m!==void 0){if(p.metaKey||p.ctrlKey||p.altKey||p.shiftKey)return;p.preventDefault();let w=u().filter(E=>E.focusable).map(E=>E.ref.current);if(m==="last")w.reverse();else if(m==="prev"||m==="next"){m==="prev"&&w.reverse();const E=w.indexOf(p.currentTarget);w=l.loop?zh(w,E+1):w.slice(E+1)}setTimeout(()=>xa(w))}})})})});ya.displayName=ma;var $h={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Lh(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Fh(e,t,n){const r=Lh(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return $h[r]}function xa(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function zh(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Hh=ga,Bh=ya,Wh=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},dt=new WeakMap,bn=new WeakMap,En={},Nr=0,va=function(e){return e&&(e.host||va(e.parentNode))},Vh=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=va(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Yh=function(e,t,n,r){var o=Vh(t,Array.isArray(e)?e:[e]);En[n]||(En[n]=new WeakMap);var s=En[n],i=[],a=new Set,c=new Set(o),l=function(u){!u||a.has(u)||(a.add(u),l(u.parentNode))};o.forEach(l);var d=function(u){!u||c.has(u)||Array.prototype.forEach.call(u.children,function(f){if(a.has(f))d(f);else try{var g=f.getAttribute(r),p=g!==null&&g!=="false",m=(dt.get(f)||0)+1,v=(s.get(f)||0)+1;dt.set(f,m),s.set(f,v),i.push(f),m===1&&p&&bn.set(f,!0),v===1&&f.setAttribute(n,"true"),p||f.setAttribute(r,"true")}catch(w){console.error("aria-hidden: cannot operate on ",f,w)}})};return d(t),a.clear(),Nr++,function(){i.forEach(function(u){var f=dt.get(u)-1,g=s.get(u)-1;dt.set(u,f),s.set(u,g),f||(bn.has(u)||u.removeAttribute(r),bn.delete(u)),g||u.removeAttribute(n)}),Nr--,Nr||(dt=new WeakMap,dt=new WeakMap,bn=new WeakMap,En={})}},Gh=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=Wh(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),Yh(r,o,n,"aria-hidden")):function(){return null}},De=function(){return De=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},De.apply(this,arguments)};function wa(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function Xh(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r<o;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var jn="right-scroll-bar-position",On="width-before-scroll-bar",Uh="with-scroll-bars-hidden",qh="--removed-body-scroll-bar-size";function Mr(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Kh(e,t){var n=x.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var Zh=typeof window<"u"?x.useLayoutEffect:x.useEffect,ps=new WeakMap;function Qh(e,t){var n=Kh(null,function(r){return e.forEach(function(o){return Mr(o,r)})});return Zh(function(){var r=ps.get(n);if(r){var o=new Set(r),s=new Set(e),i=n.current;o.forEach(function(a){s.has(a)||Mr(a,null)}),s.forEach(function(a){o.has(a)||Mr(a,i)})}ps.set(n,e)},[e]),n}function Jh(e){return e}function ep(e,t){t===void 0&&(t=Jh);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var i=t(s,r);return n.push(i),function(){n=n.filter(function(a){return a!==i})}},assignSyncMedium:function(s){for(r=!0;n.length;){var i=n;n=[],i.forEach(s)}n={push:function(a){return s(a)},filter:function(){return n}}},assignMedium:function(s){r=!0;var i=[];if(n.length){var a=n;n=[],a.forEach(s),i=n}var c=function(){var d=i;i=[],d.forEach(s)},l=function(){return Promise.resolve().then(c)};l(),n={push:function(d){i.push(d),l()},filter:function(d){return i=i.filter(d),n}}}};return o}function tp(e){e===void 0&&(e={});var t=ep(null);return t.options=De({async:!0,ssr:!1},e),t}var ba=function(e){var t=e.sideCar,n=wa(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return x.createElement(r,De({},n))};ba.isSideCarExport=!0;function np(e,t){return e.useMedium(t),ba}var Ea=tp(),kr=function(){},or=x.forwardRef(function(e,t){var n=x.useRef(null),r=x.useState({onScrollCapture:kr,onWheelCapture:kr,onTouchMoveCapture:kr}),o=r[0],s=r[1],i=e.forwardProps,a=e.children,c=e.className,l=e.removeScrollBar,d=e.enabled,u=e.shards,f=e.sideCar,g=e.noRelative,p=e.noIsolation,m=e.inert,v=e.allowPinchZoom,w=e.as,E=w===void 0?"div":w,y=e.gapMode,b=wa(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=f,_=Qh([n,t]),M=De(De({},b),o);return x.createElement(x.Fragment,null,d&&x.createElement(S,{sideCar:Ea,removeScrollBar:l,shards:u,noRelative:g,noIsolation:p,inert:m,setCallbacks:s,allowPinchZoom:!!v,lockRef:n,gapMode:y}),i?x.cloneElement(x.Children.only(a),De(De({},M),{ref:_})):x.createElement(E,De({},M,{className:c,ref:_}),a))});or.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};or.classNames={fullWidth:On,zeroRight:jn};var rp=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function op(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=rp();return t&&e.setAttribute("nonce",t),e}function sp(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function ip(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var ap=function(){var e=0,t=null;return{add:function(n){e==0&&(t=op())&&(sp(t,n),ip(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},cp=function(){var e=ap();return function(t,n){x.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Sa=function(){var e=cp(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},up={left:0,top:0,right:0,gap:0},Pr=function(e){return parseInt(e||"",10)||0},lp=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Pr(n),Pr(r),Pr(o)]},dp=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return up;var t=lp(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},fp=Sa(),xt="data-scroll-locked",hp=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,a=e.gap;return n===void 0&&(n="margin"),`
|
|
94
|
-
.`.concat(Uh,` {
|
|
95
|
-
overflow: hidden `).concat(r,`;
|
|
96
|
-
padding-right: `).concat(a,"px ").concat(r,`;
|
|
97
|
-
}
|
|
98
|
-
body[`).concat(xt,`] {
|
|
99
|
-
overflow: hidden `).concat(r,`;
|
|
100
|
-
overscroll-behavior: contain;
|
|
101
|
-
`).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
|
|
102
|
-
padding-left: `.concat(o,`px;
|
|
103
|
-
padding-top: `).concat(s,`px;
|
|
104
|
-
padding-right: `).concat(i,`px;
|
|
105
|
-
margin-left:0;
|
|
106
|
-
margin-top:0;
|
|
107
|
-
margin-right: `).concat(a,"px ").concat(r,`;
|
|
108
|
-
`),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.`).concat(jn,` {
|
|
112
|
-
right: `).concat(a,"px ").concat(r,`;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
.`).concat(On,` {
|
|
116
|
-
margin-right: `).concat(a,"px ").concat(r,`;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
.`).concat(jn," .").concat(jn,` {
|
|
120
|
-
right: 0 `).concat(r,`;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.`).concat(On," .").concat(On,` {
|
|
124
|
-
margin-right: 0 `).concat(r,`;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
body[`).concat(xt,`] {
|
|
128
|
-
`).concat(qh,": ").concat(a,`px;
|
|
129
|
-
}
|
|
130
|
-
`)},gs=function(){var e=parseInt(document.body.getAttribute(xt)||"0",10);return isFinite(e)?e:0},pp=function(){x.useEffect(function(){return document.body.setAttribute(xt,(gs()+1).toString()),function(){var e=gs()-1;e<=0?document.body.removeAttribute(xt):document.body.setAttribute(xt,e.toString())}},[])},gp=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;pp();var s=x.useMemo(function(){return dp(o)},[o]);return x.createElement(fp,{styles:hp(s,!t,o,n?"":"!important")})},Zr=!1;if(typeof window<"u")try{var Sn=Object.defineProperty({},"passive",{get:function(){return Zr=!0,!0}});window.addEventListener("test",Sn,Sn),window.removeEventListener("test",Sn,Sn)}catch{Zr=!1}var ft=Zr?{passive:!1}:!1,mp=function(e){return e.tagName==="TEXTAREA"},Ca=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!mp(e)&&n[t]==="visible")},yp=function(e){return Ca(e,"overflowY")},xp=function(e){return Ca(e,"overflowX")},ms=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=_a(e,r);if(o){var s=Na(e,r),i=s[1],a=s[2];if(i>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},vp=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},wp=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},_a=function(e,t){return e==="v"?yp(t):xp(t)},Na=function(e,t){return e==="v"?vp(t):wp(t)},bp=function(e,t){return e==="h"&&t==="rtl"?-1:1},Ep=function(e,t,n,r,o){var s=bp(e,window.getComputedStyle(t).direction),i=s*r,a=n.target,c=t.contains(a),l=!1,d=i>0,u=0,f=0;do{if(!a)break;var g=Na(e,a),p=g[0],m=g[1],v=g[2],w=m-v-s*p;(p||w)&&_a(e,a)&&(u+=w,f+=p);var E=a.parentNode;a=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!c&&a!==document.body||c&&(t.contains(a)||t===a));return(d&&Math.abs(u)<1||!d&&Math.abs(f)<1)&&(l=!0),l},Cn=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},ys=function(e){return[e.deltaX,e.deltaY]},xs=function(e){return e&&"current"in e?e.current:e},Sp=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Cp=function(e){return`
|
|
131
|
-
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
132
|
-
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
133
|
-
`)},_p=0,ht=[];function Np(e){var t=x.useRef([]),n=x.useRef([0,0]),r=x.useRef(),o=x.useState(_p++)[0],s=x.useState(Sa)[0],i=x.useRef(e);x.useEffect(function(){i.current=e},[e]),x.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var m=Xh([e.lockRef.current],(e.shards||[]).map(xs),!0).filter(Boolean);return m.forEach(function(v){return v.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var a=x.useCallback(function(m,v){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!i.current.allowPinchZoom;var w=Cn(m),E=n.current,y="deltaX"in m?m.deltaX:E[0]-w[0],b="deltaY"in m?m.deltaY:E[1]-w[1],S,_=m.target,M=Math.abs(y)>Math.abs(b)?"h":"v";if("touches"in m&&M==="h"&&_.type==="range")return!1;var P=ms(M,_);if(!P)return!0;if(P?S=M:(S=M==="v"?"h":"v",P=ms(M,_)),!P)return!1;if(!r.current&&"changedTouches"in m&&(y||b)&&(r.current=S),!S)return!0;var T=r.current||S;return Ep(T,v,m,T==="h"?y:b)},[]),c=x.useCallback(function(m){var v=m;if(!(!ht.length||ht[ht.length-1]!==s)){var w="deltaY"in v?ys(v):Cn(v),E=t.current.filter(function(S){return S.name===v.type&&(S.target===v.target||v.target===S.shadowParent)&&Sp(S.delta,w)})[0];if(E&&E.should){v.cancelable&&v.preventDefault();return}if(!E){var y=(i.current.shards||[]).map(xs).filter(Boolean).filter(function(S){return S.contains(v.target)}),b=y.length>0?a(v,y[0]):!i.current.noIsolation;b&&v.cancelable&&v.preventDefault()}}},[]),l=x.useCallback(function(m,v,w,E){var y={name:m,delta:v,target:w,should:E,shadowParent:Mp(w)};t.current.push(y),setTimeout(function(){t.current=t.current.filter(function(b){return b!==y})},1)},[]),d=x.useCallback(function(m){n.current=Cn(m),r.current=void 0},[]),u=x.useCallback(function(m){l(m.type,ys(m),m.target,a(m,e.lockRef.current))},[]),f=x.useCallback(function(m){l(m.type,Cn(m),m.target,a(m,e.lockRef.current))},[]);x.useEffect(function(){return ht.push(s),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:f}),document.addEventListener("wheel",c,ft),document.addEventListener("touchmove",c,ft),document.addEventListener("touchstart",d,ft),function(){ht=ht.filter(function(m){return m!==s}),document.removeEventListener("wheel",c,ft),document.removeEventListener("touchmove",c,ft),document.removeEventListener("touchstart",d,ft)}},[]);var g=e.removeScrollBar,p=e.inert;return x.createElement(x.Fragment,null,p?x.createElement(s,{styles:Cp(o)}):null,g?x.createElement(gp,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Mp(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const kp=np(Ea,Np);var Ma=x.forwardRef(function(e,t){return x.createElement(or,De({},e,{ref:t,sideCar:kp}))});Ma.classNames=or.classNames;var Qr=["Enter"," "],Pp=["ArrowDown","PageUp","Home"],ka=["ArrowUp","PageDown","End"],Ip=[...Pp,...ka],Ap={ltr:[...Qr,"ArrowRight"],rtl:[...Qr,"ArrowLeft"]},Rp={ltr:["ArrowLeft"],rtl:["ArrowRight"]},sn="Menu",[Yt,Tp,Dp]=Ui(sn),[ct,Pa]=rn(sn,[Dp,ra,pa]),sr=ra(),Ia=pa(),[jp,ut]=ct(sn),[Op,an]=ct(sn),Aa=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:s,modal:i=!0}=e,a=sr(t),[c,l]=x.useState(null),d=x.useRef(!1),u=Pe(s),f=qi(o);return x.useEffect(()=>{const g=()=>{d.current=!0,document.addEventListener("pointerdown",p,{capture:!0,once:!0}),document.addEventListener("pointermove",p,{capture:!0,once:!0})},p=()=>d.current=!1;return document.addEventListener("keydown",g,{capture:!0}),()=>{document.removeEventListener("keydown",g,{capture:!0}),document.removeEventListener("pointerdown",p,{capture:!0}),document.removeEventListener("pointermove",p,{capture:!0})}},[]),h.jsx(Sh,{...a,children:h.jsx(jp,{scope:t,open:n,onOpenChange:u,content:c,onContentChange:l,children:h.jsx(Op,{scope:t,onClose:x.useCallback(()=>u(!1),[u]),isUsingKeyboardRef:d,dir:f,modal:i,children:r})})})};Aa.displayName=sn;var $p="MenuAnchor",wo=x.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=sr(n);return h.jsx(Ch,{...o,...r,ref:t})});wo.displayName=$p;var bo="MenuPortal",[Lp,Ra]=ct(bo,{forceMount:void 0}),Ta=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,s=ut(bo,t);return h.jsx(Lp,{scope:t,forceMount:n,children:h.jsx(on,{present:n||s.open,children:h.jsx(fa,{asChild:!0,container:o,children:r})})})};Ta.displayName=bo;var be="MenuContent",[Fp,Eo]=ct(be),Da=x.forwardRef((e,t)=>{const n=Ra(be,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=ut(be,e.__scopeMenu),i=an(be,e.__scopeMenu);return h.jsx(Yt.Provider,{scope:e.__scopeMenu,children:h.jsx(on,{present:r||s.open,children:h.jsx(Yt.Slot,{scope:e.__scopeMenu,children:i.modal?h.jsx(zp,{...o,ref:t}):h.jsx(Hp,{...o,ref:t})})})})}),zp=x.forwardRef((e,t)=>{const n=ut(be,e.__scopeMenu),r=x.useRef(null),o=me(t,r);return x.useEffect(()=>{const s=r.current;if(s)return Gh(s)},[]),h.jsx(So,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:ne(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Hp=x.forwardRef((e,t)=>{const n=ut(be,e.__scopeMenu);return h.jsx(So,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),So=x.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:d,onFocusOutside:u,onInteractOutside:f,onDismiss:g,disableOutsideScroll:p,...m}=e,v=ut(be,n),w=an(be,n),E=sr(n),y=Ia(n),b=Tp(n),[S,_]=x.useState(null),M=x.useRef(null),P=me(t,M,v.onContentChange),T=x.useRef(0),z=x.useRef(""),A=x.useRef(0),D=x.useRef(null),F=x.useRef("right"),C=x.useRef(0),R=p?Ma:x.Fragment,k=p?{as:Vt,allowPinchZoom:!0}:void 0,j=N=>{var G,H;const O=z.current+N,$=b().filter(V=>!V.disabled),L=document.activeElement,B=(G=$.find(V=>V.ref.current===L))==null?void 0:G.textValue,W=$.map(V=>V.textValue),X=Jp(W,O,B),U=(H=$.find(V=>V.textValue===X))==null?void 0:H.ref.current;(function V(Q){z.current=Q,window.clearTimeout(T.current),Q!==""&&(T.current=window.setTimeout(()=>V(""),1e3))})(O),U&&setTimeout(()=>U.focus())};x.useEffect(()=>()=>window.clearTimeout(T.current),[]),oh();const I=x.useCallback(N=>{var $,L;return F.current===(($=D.current)==null?void 0:$.side)&&tg(N,(L=D.current)==null?void 0:L.area)},[]);return h.jsx(Fp,{scope:n,searchRef:z,onItemEnter:x.useCallback(N=>{I(N)&&N.preventDefault()},[I]),onItemLeave:x.useCallback(N=>{var O;I(N)||((O=M.current)==null||O.focus(),_(null))},[I]),onTriggerLeave:x.useCallback(N=>{I(N)&&N.preventDefault()},[I]),pointerGraceTimerRef:A,onPointerGraceIntentChange:x.useCallback(N=>{D.current=N},[]),children:h.jsx(R,{...k,children:h.jsx(Ji,{asChild:!0,trapped:o,onMountAutoFocus:ne(s,N=>{var O;N.preventDefault(),(O=M.current)==null||O.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:h.jsx(Zi,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:l,onPointerDownOutside:d,onFocusOutside:u,onInteractOutside:f,onDismiss:g,children:h.jsx(Hh,{asChild:!0,...y,dir:w.dir,orientation:"vertical",loop:r,currentTabStopId:S,onCurrentTabStopIdChange:_,onEntryFocus:ne(c,N=>{w.isUsingKeyboardRef.current||N.preventDefault()}),preventScrollOnEntryFocus:!0,children:h.jsx(_h,{role:"menu","aria-orientation":"vertical","data-state":Ka(v.open),"data-radix-menu-content":"",dir:w.dir,...E,...m,ref:P,style:{outline:"none",...m.style},onKeyDown:ne(m.onKeyDown,N=>{const $=N.target.closest("[data-radix-menu-content]")===N.currentTarget,L=N.ctrlKey||N.altKey||N.metaKey,B=N.key.length===1;$&&(N.key==="Tab"&&N.preventDefault(),!L&&B&&j(N.key));const W=M.current;if(N.target!==W||!Ip.includes(N.key))return;N.preventDefault();const U=b().filter(G=>!G.disabled).map(G=>G.ref.current);ka.includes(N.key)&&U.reverse(),Zp(U)}),onBlur:ne(e.onBlur,N=>{N.currentTarget.contains(N.target)||(window.clearTimeout(T.current),z.current="")}),onPointerMove:ne(e.onPointerMove,Gt(N=>{const O=N.target,$=C.current!==N.clientX;if(N.currentTarget.contains(O)&&$){const L=N.clientX>C.current?"right":"left";F.current=L,C.current=N.clientX}}))})})})})})})});Da.displayName=be;var Bp="MenuGroup",Co=x.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return h.jsx(fe.div,{role:"group",...r,ref:t})});Co.displayName=Bp;var Wp="MenuLabel",ja=x.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return h.jsx(fe.div,{...r,ref:t})});ja.displayName=Wp;var Wn="MenuItem",vs="menu.itemSelect",ir=x.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,s=x.useRef(null),i=an(Wn,e.__scopeMenu),a=Eo(Wn,e.__scopeMenu),c=me(t,s),l=x.useRef(!1),d=()=>{const u=s.current;if(!n&&u){const f=new CustomEvent(vs,{bubbles:!0,cancelable:!0});u.addEventListener(vs,g=>r==null?void 0:r(g),{once:!0}),Xi(u,f),f.defaultPrevented?l.current=!1:i.onClose()}};return h.jsx(Oa,{...o,ref:c,disabled:n,onClick:ne(e.onClick,d),onPointerDown:u=>{var f;(f=e.onPointerDown)==null||f.call(e,u),l.current=!0},onPointerUp:ne(e.onPointerUp,u=>{var f;l.current||(f=u.currentTarget)==null||f.click()}),onKeyDown:ne(e.onKeyDown,u=>{const f=a.searchRef.current!=="";n||f&&u.key===" "||Qr.includes(u.key)&&(u.currentTarget.click(),u.preventDefault())})})});ir.displayName=Wn;var Oa=x.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...s}=e,i=Eo(Wn,n),a=Ia(n),c=x.useRef(null),l=me(t,c),[d,u]=x.useState(!1),[f,g]=x.useState("");return x.useEffect(()=>{const p=c.current;p&&g((p.textContent??"").trim())},[s.children]),h.jsx(Yt.ItemSlot,{scope:n,disabled:r,textValue:o??f,children:h.jsx(Bh,{asChild:!0,...a,focusable:!r,children:h.jsx(fe.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:l,onPointerMove:ne(e.onPointerMove,Gt(p=>{r?i.onItemLeave(p):(i.onItemEnter(p),p.defaultPrevented||p.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ne(e.onPointerLeave,Gt(p=>i.onItemLeave(p))),onFocus:ne(e.onFocus,()=>u(!0)),onBlur:ne(e.onBlur,()=>u(!1))})})})}),Vp="MenuCheckboxItem",$a=x.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return h.jsx(Ba,{scope:e.__scopeMenu,checked:n,children:h.jsx(ir,{role:"menuitemcheckbox","aria-checked":Vn(n)?"mixed":n,...o,ref:t,"data-state":No(n),onSelect:ne(o.onSelect,()=>r==null?void 0:r(Vn(n)?!0:!n),{checkForDefaultPrevented:!1})})})});$a.displayName=Vp;var La="MenuRadioGroup",[Yp,Gp]=ct(La,{value:void 0,onValueChange:()=>{}}),Fa=x.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,s=Pe(r);return h.jsx(Yp,{scope:e.__scopeMenu,value:n,onValueChange:s,children:h.jsx(Co,{...o,ref:t})})});Fa.displayName=La;var za="MenuRadioItem",Ha=x.forwardRef((e,t)=>{const{value:n,...r}=e,o=Gp(za,e.__scopeMenu),s=n===o.value;return h.jsx(Ba,{scope:e.__scopeMenu,checked:s,children:h.jsx(ir,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":No(s),onSelect:ne(r.onSelect,()=>{var i;return(i=o.onValueChange)==null?void 0:i.call(o,n)},{checkForDefaultPrevented:!1})})})});Ha.displayName=za;var _o="MenuItemIndicator",[Ba,Xp]=ct(_o,{checked:!1}),Wa=x.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,s=Xp(_o,n);return h.jsx(on,{present:r||Vn(s.checked)||s.checked===!0,children:h.jsx(fe.span,{...o,ref:t,"data-state":No(s.checked)})})});Wa.displayName=_o;var Up="MenuSeparator",Va=x.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return h.jsx(fe.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});Va.displayName=Up;var qp="MenuArrow",Ya=x.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=sr(n);return h.jsx(Nh,{...o,...r,ref:t})});Ya.displayName=qp;var Kp="MenuSub",[aS,Ga]=ct(Kp),Ft="MenuSubTrigger",Xa=x.forwardRef((e,t)=>{const n=ut(Ft,e.__scopeMenu),r=an(Ft,e.__scopeMenu),o=Ga(Ft,e.__scopeMenu),s=Eo(Ft,e.__scopeMenu),i=x.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=s,l={__scopeMenu:e.__scopeMenu},d=x.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return x.useEffect(()=>d,[d]),x.useEffect(()=>{const u=a.current;return()=>{window.clearTimeout(u),c(null)}},[a,c]),h.jsx(wo,{asChild:!0,...l,children:h.jsx(Oa,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":Ka(n.open),...e,ref:go(t,o.onTriggerChange),onClick:u=>{var f;(f=e.onClick)==null||f.call(e,u),!(e.disabled||u.defaultPrevented)&&(u.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:ne(e.onPointerMove,Gt(u=>{s.onItemEnter(u),!u.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(s.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:ne(e.onPointerLeave,Gt(u=>{var g,p;d();const f=(g=n.content)==null?void 0:g.getBoundingClientRect();if(f){const m=(p=n.content)==null?void 0:p.dataset.side,v=m==="right",w=v?-5:5,E=f[v?"left":"right"],y=f[v?"right":"left"];s.onPointerGraceIntentChange({area:[{x:u.clientX+w,y:u.clientY},{x:E,y:f.top},{x:y,y:f.top},{x:y,y:f.bottom},{x:E,y:f.bottom}],side:m}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(u),u.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:ne(e.onKeyDown,u=>{var g;const f=s.searchRef.current!=="";e.disabled||f&&u.key===" "||Ap[r.dir].includes(u.key)&&(n.onOpenChange(!0),(g=n.content)==null||g.focus(),u.preventDefault())})})})});Xa.displayName=Ft;var Ua="MenuSubContent",qa=x.forwardRef((e,t)=>{const n=Ra(be,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=ut(be,e.__scopeMenu),i=an(be,e.__scopeMenu),a=Ga(Ua,e.__scopeMenu),c=x.useRef(null),l=me(t,c);return h.jsx(Yt.Provider,{scope:e.__scopeMenu,children:h.jsx(on,{present:r||s.open,children:h.jsx(Yt.Slot,{scope:e.__scopeMenu,children:h.jsx(So,{id:a.contentId,"aria-labelledby":a.triggerId,...o,ref:l,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var u;i.isUsingKeyboardRef.current&&((u=c.current)==null||u.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:ne(e.onFocusOutside,d=>{d.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:ne(e.onEscapeKeyDown,d=>{i.onClose(),d.preventDefault()}),onKeyDown:ne(e.onKeyDown,d=>{var g;const u=d.currentTarget.contains(d.target),f=Rp[i.dir].includes(d.key);u&&f&&(s.onOpenChange(!1),(g=a.trigger)==null||g.focus(),d.preventDefault())})})})})})});qa.displayName=Ua;function Ka(e){return e?"open":"closed"}function Vn(e){return e==="indeterminate"}function No(e){return Vn(e)?"indeterminate":e?"checked":"unchecked"}function Zp(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Qp(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Jp(e,t,n){const o=t.length>1&&Array.from(t).every(l=>l===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=Qp(e,Math.max(s,0));o.length===1&&(i=i.filter(l=>l!==n));const c=i.find(l=>l.toLowerCase().startsWith(o.toLowerCase()));return c!==n?c:void 0}function eg(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const a=t[s].x,c=t[s].y,l=t[i].x,d=t[i].y;c>r!=d>r&&n<(l-a)*(r-c)/(d-c)+a&&(o=!o)}return o}function tg(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return eg(n,t)}function Gt(e){return t=>t.pointerType==="mouse"?e(t):void 0}var ng=Aa,rg=wo,og=Ta,sg=Da,ig=Co,ag=ja,cg=ir,ug=$a,lg=Fa,dg=Ha,fg=Wa,hg=Va,pg=Ya,gg=Xa,mg=qa,Mo="DropdownMenu",[yg]=rn(Mo,[Pa]),he=Pa(),[xg,Za]=yg(Mo),Qa=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:s,onOpenChange:i,modal:a=!0}=e,c=he(t),l=x.useRef(null),[d=!1,u]=Gi({prop:o,defaultProp:s,onChange:i});return h.jsx(xg,{scope:t,triggerId:qr(),triggerRef:l,contentId:qr(),open:d,onOpenChange:u,onOpenToggle:x.useCallback(()=>u(f=>!f),[u]),modal:a,children:h.jsx(ng,{...c,open:d,onOpenChange:u,dir:r,modal:a,children:n})})};Qa.displayName=Mo;var Ja="DropdownMenuTrigger",ec=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,s=Za(Ja,n),i=he(n);return h.jsx(rg,{asChild:!0,...i,children:h.jsx(fe.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...o,ref:go(t,s.triggerRef),onPointerDown:ne(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:ne(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});ec.displayName=Ja;var vg="DropdownMenuPortal",tc=e=>{const{__scopeDropdownMenu:t,...n}=e,r=he(t);return h.jsx(og,{...r,...n})};tc.displayName=vg;var nc="DropdownMenuContent",rc=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Za(nc,n),s=he(n),i=x.useRef(!1);return h.jsx(sg,{id:o.contentId,"aria-labelledby":o.triggerId,...s,...r,ref:t,onCloseAutoFocus:ne(e.onCloseAutoFocus,a=>{var c;i.current||(c=o.triggerRef.current)==null||c.focus(),i.current=!1,a.preventDefault()}),onInteractOutside:ne(e.onInteractOutside,a=>{const c=a.detail.originalEvent,l=c.button===0&&c.ctrlKey===!0,d=c.button===2||l;(!o.modal||d)&&(i.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});rc.displayName=nc;var wg="DropdownMenuGroup",bg=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=he(n);return h.jsx(ig,{...o,...r,ref:t})});bg.displayName=wg;var Eg="DropdownMenuLabel",oc=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=he(n);return h.jsx(ag,{...o,...r,ref:t})});oc.displayName=Eg;var Sg="DropdownMenuItem",sc=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=he(n);return h.jsx(cg,{...o,...r,ref:t})});sc.displayName=Sg;var Cg="DropdownMenuCheckboxItem",ic=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=he(n);return h.jsx(ug,{...o,...r,ref:t})});ic.displayName=Cg;var _g="DropdownMenuRadioGroup",Ng=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=he(n);return h.jsx(lg,{...o,...r,ref:t})});Ng.displayName=_g;var Mg="DropdownMenuRadioItem",ac=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=he(n);return h.jsx(dg,{...o,...r,ref:t})});ac.displayName=Mg;var kg="DropdownMenuItemIndicator",cc=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=he(n);return h.jsx(fg,{...o,...r,ref:t})});cc.displayName=kg;var Pg="DropdownMenuSeparator",uc=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=he(n);return h.jsx(hg,{...o,...r,ref:t})});uc.displayName=Pg;var Ig="DropdownMenuArrow",Ag=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=he(n);return h.jsx(pg,{...o,...r,ref:t})});Ag.displayName=Ig;var Rg="DropdownMenuSubTrigger",lc=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=he(n);return h.jsx(gg,{...o,...r,ref:t})});lc.displayName=Rg;var Tg="DropdownMenuSubContent",dc=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=he(n);return h.jsx(mg,{...o,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});dc.displayName=Tg;var Dg=Qa,jg=ec,Og=tc,fc=rc,hc=oc,pc=sc,gc=ic,mc=ac,yc=cc,xc=uc,vc=lc,wc=dc;const $g=Dg,Lg=jg,Fg=x.forwardRef(({className:e,inset:t,children:n,...r},o)=>h.jsxs(vc,{ref:o,className:ae("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...r,children:[n,h.jsx(hf,{className:"ml-auto h-4 w-4"})]}));Fg.displayName=vc.displayName;const zg=x.forwardRef(({className:e,...t},n)=>h.jsx(wc,{ref:n,className:ae("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));zg.displayName=wc.displayName;const bc=x.forwardRef(({className:e,sideOffset:t=4,...n},r)=>h.jsx(Og,{children:h.jsx(fc,{ref:r,sideOffset:t,className:ae("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));bc.displayName=fc.displayName;const Je=x.forwardRef(({className:e,inset:t,...n},r)=>h.jsx(pc,{ref:r,className:ae("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));Je.displayName=pc.displayName;const Hg=x.forwardRef(({className:e,children:t,checked:n,...r},o)=>h.jsxs(gc,{ref:o,className:ae("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[h.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:h.jsx(yc,{children:h.jsx(Bn,{className:"h-4 w-4"})})}),t]}));Hg.displayName=gc.displayName;const Bg=x.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(mc,{ref:r,className:ae("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[h.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:h.jsx(yc,{children:h.jsx(Sf,{className:"h-2 w-2 fill-current"})})}),t]}));Bg.displayName=mc.displayName;const Wg=x.forwardRef(({className:e,inset:t,...n},r)=>h.jsx(hc,{ref:r,className:ae("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));Wg.displayName=hc.displayName;const Vg=x.forwardRef(({className:e,...t},n)=>h.jsx(xc,{ref:n,className:ae("-mx-1 my-1 h-px bg-muted",e),...t}));Vg.displayName=xc.displayName;function cS({text:e,children:t,className:n,overlay:r}){const[o,s]=x.useState(!1),i=async a=>{a.stopPropagation();try{await navigator.clipboard.writeText(e),s(!0),setTimeout(()=>s(!1),2e3)}catch(c){console.error("Failed to copy text:",c)}};return r?h.jsxs("span",{className:ae("relative group/copy inline-block",n),children:[t,h.jsxs(Se,{children:[h.jsx(Ce,{asChild:!0,children:h.jsx("button",{type:"button",onClick:i,className:"absolute right-0 top-1/2 -translate-y-1/2 opacity-0 group-hover/copy:opacity-100 transition-opacity bg-background/80 backdrop-blur-sm p-1 rounded","aria-label":"Copy to clipboard",children:o?h.jsx(Bn,{className:"h-3 w-3 text-muted-foreground"}):h.jsx(Gr,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})}),h.jsx(_e,{children:h.jsx("p",{children:o?"Copied!":"Copy to clipboard"})})]})]}):h.jsxs("div",{className:ae("flex items-center gap-2 group",n),children:[t,h.jsxs(Se,{children:[h.jsx(Ce,{asChild:!0,children:h.jsx("button",{type:"button",onClick:i,className:"opacity-0 group-hover:opacity-100 transition-opacity","aria-label":"Copy to clipboard",children:o?h.jsx(Bn,{className:"h-3 w-3 text-green-600"}):h.jsx(Gr,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})}),h.jsx(_e,{children:h.jsx("p",{children:o?"Copied!":"Copy to clipboard"})})]})]})}const Ec=6048e5,Yg=864e5,ws=6e4,bs=525600,Es=43200,Ss=1440,Cs=Symbol.for("constructDateFrom");function He(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&Cs in e?e[Cs](t):e instanceof Date?new e.constructor(t):new Date(t)}function xe(e,t){return He(t||e,e)}let Gg={};function It(){return Gg}function Xt(e,t){var a,c,l,d;const n=It(),r=(t==null?void 0:t.weekStartsOn)??((c=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:c.weekStartsOn)??n.weekStartsOn??((d=(l=n.locale)==null?void 0:l.options)==null?void 0:d.weekStartsOn)??0,o=xe(e,t==null?void 0:t.in),s=o.getDay(),i=(s<r?7:0)+s-r;return o.setDate(o.getDate()-i),o.setHours(0,0,0,0),o}function Yn(e,t){return Xt(e,{...t,weekStartsOn:1})}function Sc(e,t){const n=xe(e,t==null?void 0:t.in),r=n.getFullYear(),o=He(n,0);o.setFullYear(r+1,0,4),o.setHours(0,0,0,0);const s=Yn(o),i=He(n,0);i.setFullYear(r,0,4),i.setHours(0,0,0,0);const a=Yn(i);return n.getTime()>=s.getTime()?r+1:n.getTime()>=a.getTime()?r:r-1}function Gn(e){const t=xe(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function ko(e,...t){const n=He.bind(null,e||t.find(r=>typeof r=="object"));return t.map(n)}function _s(e,t){const n=xe(e,t==null?void 0:t.in);return n.setHours(0,0,0,0),n}function Cc(e,t,n){const[r,o]=ko(n==null?void 0:n.in,e,t),s=_s(r),i=_s(o),a=+s-Gn(s),c=+i-Gn(i);return Math.round((a-c)/Yg)}function Xg(e,t){const n=Sc(e,t),r=He(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Yn(r)}function Ug(e,t){const n=+xe(e)-+xe(t);return n<0?-1:n>0?1:n}function qg(e){return He(e,Date.now())}function Kg(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Zg(e){return!(!Kg(e)&&typeof e!="number"||isNaN(+xe(e)))}function Qg(e){return t=>{const r=(e?Math[e]:Math.trunc)(t);return r===0?0:r}}function Jg(e,t){const n=xe(e,t==null?void 0:t.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}const em={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},tm=(e,t,n)=>{let r;const o=em[e];return typeof o=="string"?r=o:t===1?r=o.one:r=o.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function Ir(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const nm={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},rm={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},om={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},sm={date:Ir({formats:nm,defaultWidth:"full"}),time:Ir({formats:rm,defaultWidth:"full"}),dateTime:Ir({formats:om,defaultWidth:"full"})},im={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},am=(e,t,n,r)=>im[e];function jt(e){return(t,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let o;if(r==="formatting"&&e.formattingValues){const i=e.defaultFormattingWidth||e.defaultWidth,a=n!=null&&n.width?String(n.width):i;o=e.formattingValues[a]||e.formattingValues[i]}else{const i=e.defaultWidth,a=n!=null&&n.width?String(n.width):e.defaultWidth;o=e.values[a]||e.values[i]}const s=e.argumentCallback?e.argumentCallback(t):t;return o[s]}}const cm={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},um={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},lm={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},dm={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},fm={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},hm={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},pm=(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},gm={ordinalNumber:pm,era:jt({values:cm,defaultWidth:"wide"}),quarter:jt({values:um,defaultWidth:"wide",argumentCallback:e=>e-1}),month:jt({values:lm,defaultWidth:"wide"}),day:jt({values:dm,defaultWidth:"wide"}),dayPeriod:jt({values:fm,defaultWidth:"wide",formattingValues:hm,defaultFormattingWidth:"wide"})};function Ot(e){return(t,n={})=>{const r=n.width,o=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],s=t.match(o);if(!s)return null;const i=s[0],a=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(a)?ym(a,u=>u.test(i)):mm(a,u=>u.test(i));let l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;const d=t.slice(i.length);return{value:l,rest:d}}}function mm(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function ym(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function xm(e){return(t,n={})=>{const r=t.match(e.matchPattern);if(!r)return null;const o=r[0],s=t.match(e.parsePattern);if(!s)return null;let i=e.valueCallback?e.valueCallback(s[0]):s[0];i=n.valueCallback?n.valueCallback(i):i;const a=t.slice(o.length);return{value:i,rest:a}}}const vm=/^(\d+)(th|st|nd|rd)?/i,wm=/\d+/i,bm={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Em={any:[/^b/i,/^(a|c)/i]},Sm={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Cm={any:[/1/i,/2/i,/3/i,/4/i]},_m={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Nm={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Mm={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},km={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Pm={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Im={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Am={ordinalNumber:xm({matchPattern:vm,parsePattern:wm,valueCallback:e=>parseInt(e,10)}),era:Ot({matchPatterns:bm,defaultMatchWidth:"wide",parsePatterns:Em,defaultParseWidth:"any"}),quarter:Ot({matchPatterns:Sm,defaultMatchWidth:"wide",parsePatterns:Cm,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Ot({matchPatterns:_m,defaultMatchWidth:"wide",parsePatterns:Nm,defaultParseWidth:"any"}),day:Ot({matchPatterns:Mm,defaultMatchWidth:"wide",parsePatterns:km,defaultParseWidth:"any"}),dayPeriod:Ot({matchPatterns:Pm,defaultMatchWidth:"any",parsePatterns:Im,defaultParseWidth:"any"})},Po={code:"en-US",formatDistance:tm,formatLong:sm,formatRelative:am,localize:gm,match:Am,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Rm(e,t){const n=xe(e,t==null?void 0:t.in);return Cc(n,Jg(n))+1}function Tm(e,t){const n=xe(e,t==null?void 0:t.in),r=+Yn(n)-+Xg(n);return Math.round(r/Ec)+1}function _c(e,t){var d,u,f,g;const n=xe(e,t==null?void 0:t.in),r=n.getFullYear(),o=It(),s=(t==null?void 0:t.firstWeekContainsDate)??((u=(d=t==null?void 0:t.locale)==null?void 0:d.options)==null?void 0:u.firstWeekContainsDate)??o.firstWeekContainsDate??((g=(f=o.locale)==null?void 0:f.options)==null?void 0:g.firstWeekContainsDate)??1,i=He((t==null?void 0:t.in)||e,0);i.setFullYear(r+1,0,s),i.setHours(0,0,0,0);const a=Xt(i,t),c=He((t==null?void 0:t.in)||e,0);c.setFullYear(r,0,s),c.setHours(0,0,0,0);const l=Xt(c,t);return+n>=+a?r+1:+n>=+l?r:r-1}function Dm(e,t){var a,c,l,d;const n=It(),r=(t==null?void 0:t.firstWeekContainsDate)??((c=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:c.firstWeekContainsDate)??n.firstWeekContainsDate??((d=(l=n.locale)==null?void 0:l.options)==null?void 0:d.firstWeekContainsDate)??1,o=_c(e,t),s=He((t==null?void 0:t.in)||e,0);return s.setFullYear(o,0,r),s.setHours(0,0,0,0),Xt(s,t)}function jm(e,t){const n=xe(e,t==null?void 0:t.in),r=+Xt(n,t)-+Dm(n,t);return Math.round(r/Ec)+1}function re(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const Ve={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return re(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):re(n+1,2)},d(e,t){return re(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return re(e.getHours()%12||12,t.length)},H(e,t){return re(e.getHours(),t.length)},m(e,t){return re(e.getMinutes(),t.length)},s(e,t){return re(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),o=Math.trunc(r*Math.pow(10,n-3));return re(o,t.length)}},pt={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Ns={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const r=e.getFullYear(),o=r>0?r:1-r;return n.ordinalNumber(o,{unit:"year"})}return Ve.y(e,t)},Y:function(e,t,n,r){const o=_c(e,r),s=o>0?o:1-o;if(t==="YY"){const i=s%100;return re(i,2)}return t==="Yo"?n.ordinalNumber(s,{unit:"year"}):re(s,t.length)},R:function(e,t){const n=Sc(e);return re(n,t.length)},u:function(e,t){const n=e.getFullYear();return re(n,t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return re(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return re(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return Ve.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return re(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const o=jm(e,r);return t==="wo"?n.ordinalNumber(o,{unit:"week"}):re(o,t.length)},I:function(e,t,n){const r=Tm(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):re(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):Ve.d(e,t)},D:function(e,t,n){const r=Rm(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):re(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const o=e.getDay(),s=(o-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(s);case"ee":return re(s,2);case"eo":return n.ordinalNumber(s,{unit:"day"});case"eee":return n.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(o,{width:"short",context:"formatting"});case"eeee":default:return n.day(o,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const o=e.getDay(),s=(o-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(s);case"cc":return re(s,t.length);case"co":return n.ordinalNumber(s,{unit:"day"});case"ccc":return n.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(o,{width:"narrow",context:"standalone"});case"cccccc":return n.day(o,{width:"short",context:"standalone"});case"cccc":default:return n.day(o,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),o=r===0?7:r;switch(t){case"i":return String(o);case"ii":return re(o,t.length);case"io":return n.ordinalNumber(o,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const o=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let o;switch(r===12?o=pt.noon:r===0?o=pt.midnight:o=r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let o;switch(r>=17?o=pt.evening:r>=12?o=pt.afternoon:r>=4?o=pt.morning:o=pt.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return Ve.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):Ve.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):re(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):re(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):Ve.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):Ve.s(e,t)},S:function(e,t){return Ve.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return ks(r);case"XXXX":case"XX":return Ze(r);case"XXXXX":case"XXX":default:return Ze(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return ks(r);case"xxxx":case"xx":return Ze(r);case"xxxxx":case"xxx":default:return Ze(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Ms(r,":");case"OOOO":default:return"GMT"+Ze(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Ms(r,":");case"zzzz":default:return"GMT"+Ze(r,":")}},t:function(e,t,n){const r=Math.trunc(+e/1e3);return re(r,t.length)},T:function(e,t,n){return re(+e,t.length)}};function Ms(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),o=Math.trunc(r/60),s=r%60;return s===0?n+String(o):n+String(o)+t+re(s,2)}function ks(e,t){return e%60===0?(e>0?"-":"+")+re(Math.abs(e)/60,2):Ze(e,t)}function Ze(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),o=re(Math.trunc(r/60),2),s=re(r%60,2);return n+o+t+s}const Ps=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},Nc=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},Om=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],o=n[2];if(!o)return Ps(e,t);let s;switch(r){case"P":s=t.dateTime({width:"short"});break;case"PP":s=t.dateTime({width:"medium"});break;case"PPP":s=t.dateTime({width:"long"});break;case"PPPP":default:s=t.dateTime({width:"full"});break}return s.replace("{{date}}",Ps(r,t)).replace("{{time}}",Nc(o,t))},$m={p:Nc,P:Om},Lm=/^D+$/,Fm=/^Y+$/,zm=["D","DD","YY","YYYY"];function Hm(e){return Lm.test(e)}function Bm(e){return Fm.test(e)}function Wm(e,t,n){const r=Vm(e,t,n);if(console.warn(r),zm.includes(e))throw new RangeError(r)}function Vm(e,t,n){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Ym=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Gm=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Xm=/^'([^]*?)'?$/,Um=/''/g,qm=/[a-zA-Z]/;function Km(e,t,n){var d,u,f,g,p,m,v,w;const r=It(),o=(n==null?void 0:n.locale)??r.locale??Po,s=(n==null?void 0:n.firstWeekContainsDate)??((u=(d=n==null?void 0:n.locale)==null?void 0:d.options)==null?void 0:u.firstWeekContainsDate)??r.firstWeekContainsDate??((g=(f=r.locale)==null?void 0:f.options)==null?void 0:g.firstWeekContainsDate)??1,i=(n==null?void 0:n.weekStartsOn)??((m=(p=n==null?void 0:n.locale)==null?void 0:p.options)==null?void 0:m.weekStartsOn)??r.weekStartsOn??((w=(v=r.locale)==null?void 0:v.options)==null?void 0:w.weekStartsOn)??0,a=xe(e,n==null?void 0:n.in);if(!Zg(a))throw new RangeError("Invalid time value");let c=t.match(Gm).map(E=>{const y=E[0];if(y==="p"||y==="P"){const b=$m[y];return b(E,o.formatLong)}return E}).join("").match(Ym).map(E=>{if(E==="''")return{isToken:!1,value:"'"};const y=E[0];if(y==="'")return{isToken:!1,value:Zm(E)};if(Ns[y])return{isToken:!0,value:E};if(y.match(qm))throw new RangeError("Format string contains an unescaped latin alphabet character `"+y+"`");return{isToken:!1,value:E}});o.localize.preprocessor&&(c=o.localize.preprocessor(a,c));const l={firstWeekContainsDate:s,weekStartsOn:i,locale:o};return c.map(E=>{if(!E.isToken)return E.value;const y=E.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&Bm(y)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&Hm(y))&&Wm(y,t,String(e));const b=Ns[y[0]];return b(a,y,o.localize,l)}).join("")}function Zm(e){const t=e.match(Xm);return t?t[1].replace(Um,"'"):e}function Qm(e,t,n){const r=It(),o=(n==null?void 0:n.locale)??r.locale??Po,s=Ug(e,t);if(isNaN(s))throw new RangeError("Invalid time value");const i=Object.assign({},n,{addSuffix:n==null?void 0:n.addSuffix,comparison:s}),[a,c]=ko(n==null?void 0:n.in,...s>0?[t,e]:[e,t]),l=Qg((n==null?void 0:n.roundingMethod)??"round"),d=c.getTime()-a.getTime(),u=d/ws,f=Gn(c)-Gn(a),g=(d-f)/ws,p=n==null?void 0:n.unit;let m;if(p?m=p:u<1?m="second":u<60?m="minute":u<Ss?m="hour":g<Es?m="day":g<bs?m="month":m="year",m==="second"){const v=l(d/1e3);return o.formatDistance("xSeconds",v,i)}else if(m==="minute"){const v=l(u);return o.formatDistance("xMinutes",v,i)}else if(m==="hour"){const v=l(u/60);return o.formatDistance("xHours",v,i)}else if(m==="day"){const v=l(g/Ss);return o.formatDistance("xDays",v,i)}else if(m==="month"){const v=l(g/Es);return v===12&&p!=="month"?o.formatDistance("xYears",1,i):o.formatDistance("xMonths",v,i)}else{const v=l(g/bs);return o.formatDistance("xYears",v,i)}}function Jm(e,t){return Qm(e,qg(e),t)}function e0(e,t,n){var u,f;const[r,o]=ko(n==null?void 0:n.in,e,t),s=It(),i=s.locale??Po,a=s.weekStartsOn??((f=(u=s.locale)==null?void 0:u.options)==null?void 0:f.weekStartsOn)??0,c=Cc(r,o);if(isNaN(c))throw new RangeError("Invalid time value");let l;c<-6?l="other":c<-1?l="lastWeek":c<0?l="yesterday":c<1?l="today":c<2?l="tomorrow":c<7?l="nextWeek":l="other";const d=i.formatRelative(l,r,o,{locale:i,weekStartsOn:a});return Km(r,d,{locale:i,weekStartsOn:a})}function uS({date:e,className:t="",type:n="relative"}){const[,r]=x.useState(Date.now());typeof e=="string"&&(e=new Date(e));const o=n==="relative"?e0(new Date(e),new Date):Jm(new Date(e),{addSuffix:!0}),s=new Date(e).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:"short"});return x.useEffect(()=>{const i=setInterval(()=>{r(Date.now())},1e3);return()=>clearInterval(i)},[]),h.jsxs(Se,{children:[h.jsx(Ce,{asChild:!0,children:h.jsx("span",{className:`${t} cursor-help border-b border-dotted`,children:o})}),h.jsx(_e,{children:h.jsx("p",{children:s})})]})}function lS({className:e,...t}){return h.jsx("div",{className:ae("animate-pulse rounded-md bg-muted",e),...t})}const t0="Your current vercel account does not have access to this resource. Use `vercel login` or `vercel switch` to ensure you are linked to the right account.";class Io extends Error{constructor(n,r){super(n,{cause:r==null?void 0:r.cause});br(this,"request");br(this,"layer");this.name="WorkflowWebAPIError",this.request=r==null?void 0:r.request,this.layer=r==null?void 0:r.layer,(r==null?void 0:r.cause)instanceof Error&&(this.stack=`${this.stack}
|
|
134
|
-
Caused by: ${r.cause.stack}`)}}function n0(e){return new Io(e.message,{cause:e.cause,request:e.request,layer:e.layer})}const dS=e=>{var t;return"layer"in e&&e.layer?e instanceof Io&&((t=e.request)==null?void 0:t.status)===403?t0:e.message:e instanceof Error?e.message:"An error occurred"};async function r0(e){let t;try{t=await e}catch(n){t={success:!1,error:n}}return t.success?{error:null,result:t.data}:t.error?{error:n0(t.error),result:null}:{error:new Io("Unknown error occurred",{layer:"client"}),result:null}}async function cn(e){const{error:t,result:n}=await r0(e);if(t)throw t;return n}async function o0(e,t){await cn(Kd(e,t))}async function s0(e,t){return cn(ef(e,t))}async function i0(e,t){await cn(Zd(e,t))}async function a0(e,t,n){return cn(Qd(e,t,n))}async function fS(e,t,n){return cn(Jd(e,t,n))}function c0(e){const t=e+"CollectionProvider",[n,r]=mo(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=m=>{const{scope:v,children:w}=m,E=de.useRef(null),y=de.useRef(new Map).current;return h.jsx(o,{scope:v,itemMap:y,collectionRef:E,children:w})};i.displayName=t;const a=e+"CollectionSlot",c=ss(a),l=de.forwardRef((m,v)=>{const{scope:w,children:E}=m,y=s(a,w),b=Yr(v,y.collectionRef);return h.jsx(c,{ref:b,children:E})});l.displayName=a;const d=e+"CollectionItemSlot",u="data-radix-collection-item",f=ss(d),g=de.forwardRef((m,v)=>{const{scope:w,children:E,...y}=m,b=de.useRef(null),S=Yr(v,b),_=s(d,w);return de.useEffect(()=>(_.itemMap.set(b,{ref:b,...y}),()=>void _.itemMap.delete(b))),h.jsx(f,{[u]:"",ref:S,children:E})});g.displayName=d;function p(m){const v=s(e+"CollectionConsumer",m);return de.useCallback(()=>{const E=v.collectionRef.current;if(!E)return[];const y=Array.from(E.querySelectorAll(`[${u}]`));return Array.from(v.itemMap.values()).sort((_,M)=>y.indexOf(_.ref.current)-y.indexOf(M.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:i,Slot:l,ItemSlot:g},p,r]}var u0=x.createContext(void 0);function Mc(e){const t=x.useContext(u0);return e||t||"ltr"}function l0(e){if(e!==null&&typeof e=="object"&&"code"in e&&typeof e.code=="string")return e.code}function hS({status:e,context:t,className:n,durationMs:r}){const o=()=>{switch(e){case"running":return"bg-blue-500";case"completed":return"bg-emerald-500";case"failed":return"bg-red-500";case"cancelled":return"bg-yellow-500";case"pending":return"bg-gray-400";default:return"bg-gray-400"}},s=h.jsxs("span",{className:ae("flex flex-row gap-2",n),children:[h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx("span",{className:ae("size-2 rounded-full shrink-0",o())}),h.jsx("span",{className:"text-muted-foreground text-xs font-medium capitalize",children:e})]}),r!==void 0&&h.jsxs("span",{className:"text-muted-foreground/70 text-xs",children:["(",tf(r),")"]})]}),i=e==="failed"?l0(t==null?void 0:t.error):void 0;return i?h.jsx(d0,{content:s,errorCode:i}):s}function d0({content:e,errorCode:t}){const[n,r]=x.useState(!1),o=async s=>{s.stopPropagation();try{await navigator.clipboard.writeText(t),r(!0),setTimeout(()=>r(!1),2e3)}catch{}};return h.jsxs(Se,{children:[h.jsx(Ce,{asChild:!0,children:h.jsx("span",{className:"cursor-help",children:e})}),h.jsx(_e,{className:"p-0",children:h.jsxs("div",{className:"flex items-center gap-2 p-1.5",children:[h.jsx("span",{className:"text-xs font-mono",children:t}),h.jsx(Dn,{variant:"ghost",size:"icon",className:"h-5 w-5 shrink-0",onClick:o,children:n?h.jsx(Bn,{className:"h-2.5 w-2.5 text-muted-foreground"}):h.jsx(Gr,{className:"h-2.5 w-2.5 text-muted-foreground"})})]})})]})}function kc({env:e,runId:t,runStatus:n,events:r,callbacks:o}){const[s,i]=x.useState(!1),[a,c]=x.useState(!1),[l,d]=x.useState(!1),[u,f]=x.useState(!1),p=x.useMemo(()=>$f(r),[r]).hasPendingSleeps,m=x.useCallback(async()=>{var y,b;if(s)return null;try{i(!0);const S=await s0(e,t);return Re.success("New run started",{description:`Run ID: ${S}`}),(y=o==null?void 0:o.onSuccess)==null||y.call(o),(b=o==null?void 0:o.onNavigateToRun)==null||b.call(o,S),S}catch(S){return Re.error("Failed to re-run",{description:S instanceof Error?S.message:"Unknown error"}),null}finally{i(!1)}},[e,t,s,o]),v=x.useCallback(async()=>{var y;if(!a)try{c(!0),await i0(e,t),Re.success("Run re-enqueued",{description:"The workflow orchestration layer has been re-enqueued."}),(y=o==null?void 0:o.onSuccess)==null||y.call(o)}catch(b){Re.error("Failed to re-enqueue",{description:b instanceof Error?b.message:"Unknown error"})}finally{c(!1)}},[e,t,a,o]),w=x.useCallback(async()=>{var y;if(!l)try{d(!0);const b=await a0(e,t);b.stoppedCount>0?Re.success("Active sleeps cancelled",{description:`Cancelled ${b.stoppedCount} active sleep${b.stoppedCount>1?"s":""} and resumed the run.`}):Re.info("No active sleeps",{description:"There were no active sleep calls to cancel."}),(y=o==null?void 0:o.onSuccess)==null||y.call(o)}catch(b){Re.error("Failed to cancel sleeps",{description:b instanceof Error?b.message:"Unknown error"})}finally{d(!1)}},[e,t,l,o]),E=x.useCallback(async()=>{var b;if(u)return;if(!(n==="pending"||n==="running")){Re.error("Cannot cancel",{description:"Only active runs can be cancelled"});return}try{f(!0),await o0(e,t),Re.success("Run cancelled"),(b=o==null?void 0:o.onSuccess)==null||b.call(o)}catch(S){Re.error("Failed to cancel",{description:S instanceof Error?S.message:"Unknown error"})}finally{f(!1)}},[e,t,n,u,o]);return{rerunning:s,reenqueuing:a,wakingUp:l,cancelling:u,hasPendingSleeps:p,handleReplay:m,handleReenqueue:v,handleWakeUp:w,handleCancel:E}}function Pc({hasPendingSleeps:e}){return e?h.jsxs(h.Fragment,{children:["Cancel any active ",h.jsx("code",{children:"sleep"})," calls and resume the run immediately."]}):h.jsx(h.Fragment,{children:"No active sleep calls to cancel."})}function Ic(){return h.jsx(h.Fragment,{children:"Re-enqueue the workflow orchestration layer. Use this if the workflow appears stuck with no active steps. This is a no-op for healthy workflows."})}function pS({env:e,runId:t,runStatus:n,events:r,eventsLoading:o,callbacks:s,stopPropagation:i=!1}){const{rerunning:a,reenqueuing:c,wakingUp:l,cancelling:d,hasPendingSleeps:u,handleReplay:f,handleReenqueue:g,handleWakeUp:p,handleCancel:m}=kc({env:e,runId:t,runStatus:n,events:r,callbacks:s}),v=S=>{i&&S.stopPropagation(),f()},w=S=>{i&&S.stopPropagation(),g()},E=S=>{i&&S.stopPropagation(),p()},y=S=>{i&&S.stopPropagation(),m()},b=n==="pending"||n==="running";return h.jsxs(h.Fragment,{children:[h.jsxs(Je,{onClick:v,disabled:a,children:[h.jsx(Yi,{className:"h-4 w-4 mr-2"}),a?"Replaying...":"Replay Run"]}),h.jsxs(Se,{children:[h.jsx(Ce,{asChild:!0,children:h.jsxs(Je,{onClick:w,disabled:o||c,children:[h.jsx(yo,{className:"h-4 w-4 mr-2"}),c?"Re-enqueuing...":"Re-enqueue"]})}),h.jsx(_e,{side:"left",className:"max-w-xs",children:h.jsx(Ic,{})})]}),h.jsxs(Se,{children:[h.jsx(Ce,{asChild:!0,children:h.jsxs(Je,{onClick:E,disabled:o||!u||l,children:[h.jsx(Wi,{className:"h-4 w-4 mr-2"}),l?"Cancelling sleeps...":"Cancel Active Sleeps"]})}),h.jsx(_e,{side:"left",className:"max-w-xs",children:h.jsx(Pc,{hasPendingSleeps:u})})]}),h.jsxs(Je,{onClick:y,disabled:!b||d,children:[h.jsx(Vi,{className:"h-4 w-4 mr-2"}),d?"Cancelling...":"Cancel"]})]})}function gS({env:e,runId:t,runStatus:n,events:r,eventsLoading:o,loading:s,callbacks:i,onCancelClick:a,onRerunClick:c}){const{reenqueuing:l,wakingUp:d,hasPendingSleeps:u,handleReenqueue:f,handleWakeUp:g}=kc({env:e,runId:t,runStatus:n,events:r,callbacks:i}),p=n==="pending"||n==="running",m=p,v=!s&&!p,w=s?"Loading run data...":p?"Cannot re-run while workflow is still running":"",E=n==="completed"?"Run has already completed":n==="failed"?"Run has already failed":n==="cancelled"?"Run has already been cancelled":"";return h.jsxs(h.Fragment,{children:[h.jsxs(Se,{children:[h.jsx(Ce,{asChild:!0,children:h.jsx("span",{children:h.jsxs(Dn,{variant:"outline",size:"sm",onClick:c,disabled:!v,children:[h.jsx(Yi,{className:"h-4 w-4"}),"Replay"]})})}),h.jsx(_e,{children:w?h.jsx("p",{children:w}):h.jsx("p",{children:"This will start a new copy of the current run using the same deployment, environment, and inputs. It will not affect the current run."})})]}),h.jsxs(Se,{children:[h.jsx(Ce,{asChild:!0,children:h.jsx("span",{children:h.jsxs(Dn,{variant:"outline",size:"sm",onClick:a,disabled:!m,children:[h.jsx(Vi,{className:"h-4 w-4"}),"Cancel"]})})}),h.jsx(_e,{children:E?h.jsx("p",{children:E}):h.jsx("p",{children:"Cancel the workflow run"})})]}),h.jsxs($g,{children:[h.jsxs(Se,{children:[h.jsx(Ce,{asChild:!0,children:h.jsx(Lg,{asChild:!0,children:h.jsx(Dn,{variant:"outline",size:"sm",children:h.jsx(Mf,{className:"h-4 w-4"})})})}),h.jsx(_e,{children:"More actions"})]}),h.jsxs(bc,{align:"end",children:[h.jsxs(Se,{children:[h.jsx(Ce,{asChild:!0,children:h.jsxs(Je,{onClick:f,disabled:s||o||l,children:[h.jsx(yo,{className:"h-4 w-4 mr-2"}),l?"Re-enqueuing...":"Re-enqueue"]})}),h.jsx(_e,{side:"left",className:"max-w-xs",children:h.jsx(Ic,{})})]}),h.jsxs(Se,{children:[h.jsx(Ce,{asChild:!0,children:h.jsxs(Je,{onClick:g,disabled:s||o||!u||d,children:[h.jsx(Wi,{className:"h-4 w-4 mr-2"}),d?"Cancelling sleeps...":"Cancel Active Sleeps"]})}),h.jsx(_e,{side:"left",className:"max-w-xs",children:h.jsx(Pc,{hasPendingSleeps:u})})]})]})]})]})}var Ar="rovingFocusGroup.onEntryFocus",f0={bubbles:!1,cancelable:!0},un="RovingFocusGroup",[Jr,Ac,h0]=c0(un),[p0,Rc]=mo(un,[h0]),[g0,m0]=p0(un),Tc=x.forwardRef((e,t)=>h.jsx(Jr.Provider,{scope:e.__scopeRovingFocusGroup,children:h.jsx(Jr.Slot,{scope:e.__scopeRovingFocusGroup,children:h.jsx(y0,{...e,ref:t})})}));Tc.displayName=un;var y0=x.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:d=!1,...u}=e,f=x.useRef(null),g=Yr(t,f),p=Mc(s),[m,v]=Fi({prop:i,defaultProp:a??null,onChange:c,caller:un}),[w,E]=x.useState(!1),y=nf(l),b=Ac(n),S=x.useRef(!1),[_,M]=x.useState(0);return x.useEffect(()=>{const P=f.current;if(P)return P.addEventListener(Ar,y),()=>P.removeEventListener(Ar,y)},[y]),h.jsx(g0,{scope:n,orientation:r,dir:p,loop:o,currentTabStopId:m,onItemFocus:x.useCallback(P=>v(P),[v]),onItemShiftTab:x.useCallback(()=>E(!0),[]),onFocusableItemAdd:x.useCallback(()=>M(P=>P+1),[]),onFocusableItemRemove:x.useCallback(()=>M(P=>P-1),[]),children:h.jsx(Pt.div,{tabIndex:w||_===0?-1:0,"data-orientation":r,...u,ref:g,style:{outline:"none",...e.style},onMouseDown:ze(e.onMouseDown,()=>{S.current=!0}),onFocus:ze(e.onFocus,P=>{const T=!S.current;if(P.target===P.currentTarget&&T&&!w){const z=new CustomEvent(Ar,f0);if(P.currentTarget.dispatchEvent(z),!z.defaultPrevented){const A=b().filter(k=>k.focusable),D=A.find(k=>k.active),F=A.find(k=>k.id===m),R=[D,F,...A].filter(Boolean).map(k=>k.ref.current);Oc(R,d)}}S.current=!1}),onBlur:ze(e.onBlur,()=>E(!1))})})}),Dc="RovingFocusGroupItem",jc=x.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:i,...a}=e,c=Li(),l=s||c,d=m0(Dc,n),u=d.currentTabStopId===l,f=Ac(n),{onFocusableItemAdd:g,onFocusableItemRemove:p,currentTabStopId:m}=d;return x.useEffect(()=>{if(r)return g(),()=>p()},[r,g,p]),h.jsx(Jr.ItemSlot,{scope:n,id:l,focusable:r,active:o,children:h.jsx(Pt.span,{tabIndex:u?0:-1,"data-orientation":d.orientation,...a,ref:t,onMouseDown:ze(e.onMouseDown,v=>{r?d.onItemFocus(l):v.preventDefault()}),onFocus:ze(e.onFocus,()=>d.onItemFocus(l)),onKeyDown:ze(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){d.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const w=w0(v,d.orientation,d.dir);if(w!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let y=f().filter(b=>b.focusable).map(b=>b.ref.current);if(w==="last")y.reverse();else if(w==="prev"||w==="next"){w==="prev"&&y.reverse();const b=y.indexOf(v.currentTarget);y=d.loop?b0(y,b+1):y.slice(b+1)}setTimeout(()=>Oc(y))}}),children:typeof i=="function"?i({isCurrentTabStop:u,hasTabStop:m!=null}):i})})});jc.displayName=Dc;var x0={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function v0(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function w0(e,t,n){const r=v0(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return x0[r]}function Oc(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function b0(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var E0=Tc,S0=jc,ar="Tabs",[C0]=mo(ar,[Rc]),$c=Rc(),[_0,Ao]=C0(ar),Lc=x.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:s,orientation:i="horizontal",dir:a,activationMode:c="automatic",...l}=e,d=Mc(a),[u,f]=Fi({prop:r,onChange:o,defaultProp:s??"",caller:ar});return h.jsx(_0,{scope:n,baseId:Li(),value:u,onValueChange:f,orientation:i,dir:d,activationMode:c,children:h.jsx(Pt.div,{dir:d,"data-orientation":i,...l,ref:t})})});Lc.displayName=ar;var Fc="TabsList",zc=x.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,s=Ao(Fc,n),i=$c(n);return h.jsx(E0,{asChild:!0,...i,orientation:s.orientation,dir:s.dir,loop:r,children:h.jsx(Pt.div,{role:"tablist","aria-orientation":s.orientation,...o,ref:t})})});zc.displayName=Fc;var Hc="TabsTrigger",Bc=x.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=e,i=Ao(Hc,n),a=$c(n),c=Yc(i.baseId,r),l=Gc(i.baseId,r),d=r===i.value;return h.jsx(S0,{asChild:!0,...a,focusable:!o,active:d,children:h.jsx(Pt.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":l,"data-state":d?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...s,ref:t,onMouseDown:ze(e.onMouseDown,u=>{!o&&u.button===0&&u.ctrlKey===!1?i.onValueChange(r):u.preventDefault()}),onKeyDown:ze(e.onKeyDown,u=>{[" ","Enter"].includes(u.key)&&i.onValueChange(r)}),onFocus:ze(e.onFocus,()=>{const u=i.activationMode!=="manual";!d&&!o&&u&&i.onValueChange(r)})})})});Bc.displayName=Hc;var Wc="TabsContent",Vc=x.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...i}=e,a=Ao(Wc,n),c=Yc(a.baseId,r),l=Gc(a.baseId,r),d=r===a.value,u=x.useRef(d);return x.useEffect(()=>{const f=requestAnimationFrame(()=>u.current=!1);return()=>cancelAnimationFrame(f)},[]),h.jsx(rf,{present:o||d,children:({present:f})=>h.jsx(Pt.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!f,id:l,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:u.current?"0s":void 0},children:f&&s})})});Vc.displayName=Wc;function Yc(e,t){return`${e}-trigger-${t}`}function Gc(e,t){return`${e}-content-${t}`}var N0=Lc,M0=zc,k0=Bc,P0=Vc;function mS({className:e,...t}){return h.jsx(N0,{"data-slot":"tabs",className:ae("flex flex-col gap-2",e),...t})}function yS({className:e,...t}){return h.jsx(M0,{"data-slot":"tabs-list",className:ae("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg border border-input p-[3px]",e),...t})}function xS({className:e,...t}){return h.jsx(k0,{"data-slot":"tabs-trigger",className:ae("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...t})}function vS({className:e,...t}){return h.jsx(P0,{"data-slot":"tabs-content",className:ae("flex-1 outline-none",e),...t})}function ce(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=ce(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var I0={value:()=>{}};function cr(){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 $n(n)}function $n(e){this._=e}function A0(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");if(o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}$n.prototype=cr.prototype={constructor:$n,on:function(e,t){var n=this._,r=A0(e+"",n),o,s=-1,i=r.length;if(arguments.length<2){for(;++s<i;)if((o=(e=r[s]).type)&&(o=R0(n[o],e.name)))return o;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<i;)if(o=(e=r[s]).type)n[o]=Is(n[o],e.name,t);else if(t==null)for(o in n)n[o]=Is(n[o],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new $n(e)},call:function(e,t){if((o=arguments.length-2)>0)for(var n=new Array(o),r=0,o,s;r<o;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],r=0,o=s.length;r<o;++r)s[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],o=0,s=r.length;o<s;++o)r[o].value.apply(t,n)}};function R0(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function Is(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=I0,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var eo="http://www.w3.org/1999/xhtml";const As={svg:"http://www.w3.org/2000/svg",xhtml:eo,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ur(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),As.hasOwnProperty(t)?{space:As[t],local:e}:e}function T0(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===eo&&t.documentElement.namespaceURI===eo?t.createElement(e):t.createElementNS(n,e)}}function D0(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Xc(e){var t=ur(e);return(t.local?D0:T0)(t)}function j0(){}function Ro(e){return e==null?j0:function(){return this.querySelector(e)}}function O0(e){typeof e!="function"&&(e=Ro(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var s=t[o],i=s.length,a=r[o]=new Array(i),c,l,d=0;d<i;++d)(c=s[d])&&(l=e.call(c,c.__data__,d,s))&&("__data__"in c&&(l.__data__=c.__data__),a[d]=l);return new ve(r,this._parents)}function $0(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function L0(){return[]}function Uc(e){return e==null?L0:function(){return this.querySelectorAll(e)}}function F0(e){return function(){return $0(e.apply(this,arguments))}}function z0(e){typeof e=="function"?e=F0(e):e=Uc(e);for(var t=this._groups,n=t.length,r=[],o=[],s=0;s<n;++s)for(var i=t[s],a=i.length,c,l=0;l<a;++l)(c=i[l])&&(r.push(e.call(c,c.__data__,l,i)),o.push(c));return new ve(r,o)}function qc(e){return function(){return this.matches(e)}}function Kc(e){return function(t){return t.matches(e)}}var H0=Array.prototype.find;function B0(e){return function(){return H0.call(this.children,e)}}function W0(){return this.firstElementChild}function V0(e){return this.select(e==null?W0:B0(typeof e=="function"?e:Kc(e)))}var Y0=Array.prototype.filter;function G0(){return Array.from(this.children)}function X0(e){return function(){return Y0.call(this.children,e)}}function U0(e){return this.selectAll(e==null?G0:X0(typeof e=="function"?e:Kc(e)))}function q0(e){typeof e!="function"&&(e=qc(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var s=t[o],i=s.length,a=r[o]=[],c,l=0;l<i;++l)(c=s[l])&&e.call(c,c.__data__,l,s)&&a.push(c);return new ve(r,this._parents)}function Zc(e){return new Array(e.length)}function K0(){return new ve(this._enter||this._groups.map(Zc),this._parents)}function Xn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Xn.prototype={constructor:Xn,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Z0(e){return function(){return e}}function Q0(e,t,n,r,o,s){for(var i=0,a,c=t.length,l=s.length;i<l;++i)(a=t[i])?(a.__data__=s[i],r[i]=a):n[i]=new Xn(e,s[i]);for(;i<c;++i)(a=t[i])&&(o[i]=a)}function J0(e,t,n,r,o,s,i){var a,c,l=new Map,d=t.length,u=s.length,f=new Array(d),g;for(a=0;a<d;++a)(c=t[a])&&(f[a]=g=i.call(c,c.__data__,a,t)+"",l.has(g)?o[a]=c:l.set(g,c));for(a=0;a<u;++a)g=i.call(e,s[a],a,s)+"",(c=l.get(g))?(r[a]=c,c.__data__=s[a],l.delete(g)):n[a]=new Xn(e,s[a]);for(a=0;a<d;++a)(c=t[a])&&l.get(f[a])===c&&(o[a]=c)}function ey(e){return e.__data__}function ty(e,t){if(!arguments.length)return Array.from(this,ey);var n=t?J0:Q0,r=this._parents,o=this._groups;typeof e!="function"&&(e=Z0(e));for(var s=o.length,i=new Array(s),a=new Array(s),c=new Array(s),l=0;l<s;++l){var d=r[l],u=o[l],f=u.length,g=ny(e.call(d,d&&d.__data__,l,r)),p=g.length,m=a[l]=new Array(p),v=i[l]=new Array(p),w=c[l]=new Array(f);n(d,u,m,v,w,g,t);for(var E=0,y=0,b,S;E<p;++E)if(b=m[E]){for(E>=y&&(y=E+1);!(S=v[y])&&++y<p;);b._next=S||null}}return i=new ve(i,r),i._enter=a,i._exit=c,i}function ny(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function ry(){return new ve(this._exit||this._groups.map(Zc),this._parents)}function oy(e,t,n){var r=this.enter(),o=this,s=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(o=t(o),o&&(o=o.selection())),n==null?s.remove():n(s),r&&o?r.merge(o).order():o}function sy(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,o=n.length,s=r.length,i=Math.min(o,s),a=new Array(o),c=0;c<i;++c)for(var l=n[c],d=r[c],u=l.length,f=a[c]=new Array(u),g,p=0;p<u;++p)(g=l[p]||d[p])&&(f[p]=g);for(;c<o;++c)a[c]=n[c];return new ve(a,this._parents)}function iy(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],o=r.length-1,s=r[o],i;--o>=0;)(i=r[o])&&(s&&i.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(i,s),s=i);return this}function ay(e){e||(e=cy);function t(u,f){return u&&f?e(u.__data__,f.__data__):!u-!f}for(var n=this._groups,r=n.length,o=new Array(r),s=0;s<r;++s){for(var i=n[s],a=i.length,c=o[s]=new Array(a),l,d=0;d<a;++d)(l=i[d])&&(c[d]=l);c.sort(t)}return new ve(o,this._parents).order()}function cy(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function uy(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ly(){return Array.from(this)}function dy(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,s=r.length;o<s;++o){var i=r[o];if(i)return i}return null}function fy(){let e=0;for(const t of this)++e;return e}function hy(){return!this.node()}function py(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var o=t[n],s=0,i=o.length,a;s<i;++s)(a=o[s])&&e.call(a,a.__data__,s,o);return this}function gy(e){return function(){this.removeAttribute(e)}}function my(e){return function(){this.removeAttributeNS(e.space,e.local)}}function yy(e,t){return function(){this.setAttribute(e,t)}}function xy(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function vy(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function wy(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 by(e,t){var n=ur(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?my:gy:typeof t=="function"?n.local?wy:vy:n.local?xy:yy)(n,t))}function Qc(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Ey(e){return function(){this.style.removeProperty(e)}}function Sy(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Cy(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function _y(e,t,n){return arguments.length>1?this.each((t==null?Ey:typeof t=="function"?Cy:Sy)(e,t,n??"")):bt(this.node(),e)}function bt(e,t){return e.style.getPropertyValue(t)||Qc(e).getComputedStyle(e,null).getPropertyValue(t)}function Ny(e){return function(){delete this[e]}}function My(e,t){return function(){this[e]=t}}function ky(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Py(e,t){return arguments.length>1?this.each((t==null?Ny:typeof t=="function"?ky:My)(e,t)):this.node()[e]}function Jc(e){return e.trim().split(/^|\s+/)}function To(e){return e.classList||new eu(e)}function eu(e){this._node=e,this._names=Jc(e.getAttribute("class")||"")}eu.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 tu(e,t){for(var n=To(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function nu(e,t){for(var n=To(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function Iy(e){return function(){tu(this,e)}}function Ay(e){return function(){nu(this,e)}}function Ry(e,t){return function(){(t.apply(this,arguments)?tu:nu)(this,e)}}function Ty(e,t){var n=Jc(e+"");if(arguments.length<2){for(var r=To(this.node()),o=-1,s=n.length;++o<s;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof t=="function"?Ry:t?Iy:Ay)(n,t))}function Dy(){this.textContent=""}function jy(e){return function(){this.textContent=e}}function Oy(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function $y(e){return arguments.length?this.each(e==null?Dy:(typeof e=="function"?Oy:jy)(e)):this.node().textContent}function Ly(){this.innerHTML=""}function Fy(e){return function(){this.innerHTML=e}}function zy(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Hy(e){return arguments.length?this.each(e==null?Ly:(typeof e=="function"?zy:Fy)(e)):this.node().innerHTML}function By(){this.nextSibling&&this.parentNode.appendChild(this)}function Wy(){return this.each(By)}function Vy(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Yy(){return this.each(Vy)}function Gy(e){var t=typeof e=="function"?e:Xc(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Xy(){return null}function Uy(e,t){var n=typeof e=="function"?e:Xc(e),r=t==null?Xy:typeof t=="function"?t:Ro(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function qy(){var e=this.parentNode;e&&e.removeChild(this)}function Ky(){return this.each(qy)}function Zy(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Qy(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Jy(e){return this.select(e?Qy:Zy)}function ex(e){return arguments.length?this.property("__data__",e):this.node().__data__}function tx(e){return function(t){e.call(this,t,this.__data__)}}function nx(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 rx(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,o=t.length,s;n<o;++n)s=t[n],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++r]=s;++r?t.length=r:delete this.__on}}}function ox(e,t,n){return function(){var r=this.__on,o,s=tx(t);if(r){for(var i=0,a=r.length;i<a;++i)if((o=r[i]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=s,o.options=n),o.value=t;return}}this.addEventListener(e.type,s,n),o={type:e.type,name:e.name,value:t,listener:s,options:n},r?r.push(o):this.__on=[o]}}function sx(e,t,n){var r=nx(e+""),o,s=r.length,i;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,d;c<l;++c)for(o=0,d=a[c];o<s;++o)if((i=r[o]).type===d.type&&i.name===d.name)return d.value}return}for(a=t?ox:rx,o=0;o<s;++o)this.each(a(r[o],t,n));return this}function ru(e,t,n){var r=Qc(e),o=r.CustomEvent;typeof o=="function"?o=new o(t,n):(o=r.document.createEvent("Event"),n?(o.initEvent(t,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function ix(e,t){return function(){return ru(this,e,t)}}function ax(e,t){return function(){return ru(this,e,t.apply(this,arguments))}}function cx(e,t){return this.each((typeof t=="function"?ax:ix)(e,t))}function*ux(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,s=r.length,i;o<s;++o)(i=r[o])&&(yield i)}var ou=[null];function ve(e,t){this._groups=e,this._parents=t}function ln(){return new ve([[document.documentElement]],ou)}function lx(){return this}ve.prototype=ln.prototype={constructor:ve,select:O0,selectAll:z0,selectChild:V0,selectChildren:U0,filter:q0,data:ty,enter:K0,exit:ry,join:oy,merge:sy,selection:lx,order:iy,sort:ay,call:uy,nodes:ly,node:dy,size:fy,empty:hy,each:py,attr:by,style:_y,property:Py,classed:Ty,text:$y,html:Hy,raise:Wy,lower:Yy,append:Gy,insert:Uy,remove:Ky,clone:Jy,datum:ex,on:sx,dispatch:cx,[Symbol.iterator]:ux};function ye(e){return typeof e=="string"?new ve([[document.querySelector(e)]],[document.documentElement]):new ve([[e]],ou)}function dx(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Ee(e,t){if(e=dx(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 o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}const fx={passive:!1},Ut={capture:!0,passive:!1};function Rr(e){e.stopImmediatePropagation()}function vt(e){e.preventDefault(),e.stopImmediatePropagation()}function su(e){var t=e.document.documentElement,n=ye(e).on("dragstart.drag",vt,Ut);"onselectstart"in t?n.on("selectstart.drag",vt,Ut):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function iu(e,t){var n=e.document.documentElement,r=ye(e).on("dragstart.drag",null);t&&(r.on("click.drag",vt,Ut),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 _n=e=>()=>e;function to(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:s,x:i,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:o,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:i,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}})}to.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function hx(e){return!e.ctrlKey&&!e.button}function px(){return this.parentNode}function gx(e,t){return t??{x:e.x,y:e.y}}function mx(){return navigator.maxTouchPoints||"ontouchstart"in this}function au(){var e=hx,t=px,n=gx,r=mx,o={},s=cr("start","drag","end"),i=0,a,c,l,d,u=0;function f(b){b.on("mousedown.drag",g).filter(r).on("touchstart.drag",v).on("touchmove.drag",w,fx).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(b,S){if(!(d||!e.call(this,b,S))){var _=y(this,t.call(this,b,S),b,S,"mouse");_&&(ye(b.view).on("mousemove.drag",p,Ut).on("mouseup.drag",m,Ut),su(b.view),Rr(b),l=!1,a=b.clientX,c=b.clientY,_("start",b))}}function p(b){if(vt(b),!l){var S=b.clientX-a,_=b.clientY-c;l=S*S+_*_>u}o.mouse("drag",b)}function m(b){ye(b.view).on("mousemove.drag mouseup.drag",null),iu(b.view,l),vt(b),o.mouse("end",b)}function v(b,S){if(e.call(this,b,S)){var _=b.changedTouches,M=t.call(this,b,S),P=_.length,T,z;for(T=0;T<P;++T)(z=y(this,M,b,S,_[T].identifier,_[T]))&&(Rr(b),z("start",b,_[T]))}}function w(b){var S=b.changedTouches,_=S.length,M,P;for(M=0;M<_;++M)(P=o[S[M].identifier])&&(vt(b),P("drag",b,S[M]))}function E(b){var S=b.changedTouches,_=S.length,M,P;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),M=0;M<_;++M)(P=o[S[M].identifier])&&(Rr(b),P("end",b,S[M]))}function y(b,S,_,M,P,T){var z=s.copy(),A=Ee(T||_,S),D,F,C;if((C=n.call(b,new to("beforestart",{sourceEvent:_,target:f,identifier:P,active:i,x:A[0],y:A[1],dx:0,dy:0,dispatch:z}),M))!=null)return D=C.x-A[0]||0,F=C.y-A[1]||0,function R(k,j,I){var N=A,O;switch(k){case"start":o[P]=R,O=i++;break;case"end":delete o[P],--i;case"drag":A=Ee(I||j,S),O=i;break}z.call(k,b,new to(k,{sourceEvent:j,subject:C,target:f,identifier:P,active:O,x:A[0]+D,y:A[1]+F,dx:A[0]-N[0],dy:A[1]-N[1],dispatch:z}),M)}}return f.filter=function(b){return arguments.length?(e=typeof b=="function"?b:_n(!!b),f):e},f.container=function(b){return arguments.length?(t=typeof b=="function"?b:_n(b),f):t},f.subject=function(b){return arguments.length?(n=typeof b=="function"?b:_n(b),f):n},f.touchable=function(b){return arguments.length?(r=typeof b=="function"?b:_n(!!b),f):r},f.on=function(){var b=s.on.apply(s,arguments);return b===s?f:b},f.clickDistance=function(b){return arguments.length?(u=(b=+b)*b,f):Math.sqrt(u)},f}function Do(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function cu(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function dn(){}var qt=.7,Un=1/qt,wt="\\s*([+-]?\\d+)\\s*",Kt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",je="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",yx=/^#([0-9a-f]{3,8})$/,xx=new RegExp(`^rgb\\(${wt},${wt},${wt}\\)$`),vx=new RegExp(`^rgb\\(${je},${je},${je}\\)$`),wx=new RegExp(`^rgba\\(${wt},${wt},${wt},${Kt}\\)$`),bx=new RegExp(`^rgba\\(${je},${je},${je},${Kt}\\)$`),Ex=new RegExp(`^hsl\\(${Kt},${je},${je}\\)$`),Sx=new RegExp(`^hsla\\(${Kt},${je},${je},${Kt}\\)$`),Rs={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};Do(dn,ot,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Ts,formatHex:Ts,formatHex8:Cx,formatHsl:_x,formatRgb:Ds,toString:Ds});function Ts(){return this.rgb().formatHex()}function Cx(){return this.rgb().formatHex8()}function _x(){return uu(this).formatHsl()}function Ds(){return this.rgb().formatRgb()}function ot(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=yx.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?js(t):n===3?new ge(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Nn(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Nn(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=xx.exec(e))?new ge(t[1],t[2],t[3],1):(t=vx.exec(e))?new ge(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=wx.exec(e))?Nn(t[1],t[2],t[3],t[4]):(t=bx.exec(e))?Nn(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Ex.exec(e))?Ls(t[1],t[2]/100,t[3]/100,1):(t=Sx.exec(e))?Ls(t[1],t[2]/100,t[3]/100,t[4]):Rs.hasOwnProperty(e)?js(Rs[e]):e==="transparent"?new ge(NaN,NaN,NaN,0):null}function js(e){return new ge(e>>16&255,e>>8&255,e&255,1)}function Nn(e,t,n,r){return r<=0&&(e=t=n=NaN),new ge(e,t,n,r)}function Nx(e){return e instanceof dn||(e=ot(e)),e?(e=e.rgb(),new ge(e.r,e.g,e.b,e.opacity)):new ge}function no(e,t,n,r){return arguments.length===1?Nx(e):new ge(e,t,n,r??1)}function ge(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Do(ge,no,cu(dn,{brighter(e){return e=e==null?Un:Math.pow(Un,e),new ge(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?qt:Math.pow(qt,e),new ge(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ge(tt(this.r),tt(this.g),tt(this.b),qn(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:Os,formatHex:Os,formatHex8:Mx,formatRgb:$s,toString:$s}));function Os(){return`#${et(this.r)}${et(this.g)}${et(this.b)}`}function Mx(){return`#${et(this.r)}${et(this.g)}${et(this.b)}${et((isNaN(this.opacity)?1:this.opacity)*255)}`}function $s(){const e=qn(this.opacity);return`${e===1?"rgb(":"rgba("}${tt(this.r)}, ${tt(this.g)}, ${tt(this.b)}${e===1?")":`, ${e})`}`}function qn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function tt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function et(e){return e=tt(e),(e<16?"0":"")+e.toString(16)}function Ls(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ne(e,t,n,r)}function uu(e){if(e instanceof Ne)return new Ne(e.h,e.s,e.l,e.opacity);if(e instanceof dn||(e=ot(e)),!e)return new Ne;if(e instanceof Ne)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),s=Math.max(t,n,r),i=NaN,a=s-o,c=(s+o)/2;return a?(t===s?i=(n-r)/a+(n<r)*6:n===s?i=(r-t)/a+2:i=(t-n)/a+4,a/=c<.5?s+o:2-s-o,i*=60):a=c>0&&c<1?0:i,new Ne(i,a,c,e.opacity)}function kx(e,t,n,r){return arguments.length===1?uu(e):new Ne(e,t,n,r??1)}function Ne(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Do(Ne,kx,cu(dn,{brighter(e){return e=e==null?Un:Math.pow(Un,e),new Ne(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?qt:Math.pow(qt,e),new Ne(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,o=2*n-r;return new ge(Tr(e>=240?e-240:e+120,o,r),Tr(e,o,r),Tr(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new Ne(Fs(this.h),Mn(this.s),Mn(this.l),qn(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=qn(this.opacity);return`${e===1?"hsl(":"hsla("}${Fs(this.h)}, ${Mn(this.s)*100}%, ${Mn(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Fs(e){return e=(e||0)%360,e<0?e+360:e}function Mn(e){return Math.max(0,Math.min(1,e||0))}function Tr(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 jo=e=>()=>e;function Px(e,t){return function(n){return e+n*t}}function Ix(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 Ax(e){return(e=+e)==1?lu:function(t,n){return n-t?Ix(t,n,e):jo(isNaN(t)?n:t)}}function lu(e,t){var n=t-e;return n?Px(e,n):jo(isNaN(e)?t:e)}const Kn=(function e(t){var n=Ax(t);function r(o,s){var i=n((o=no(o)).r,(s=no(s)).r),a=n(o.g,s.g),c=n(o.b,s.b),l=lu(o.opacity,s.opacity);return function(d){return o.r=i(d),o.g=a(d),o.b=c(d),o.opacity=l(d),o+""}}return r.gamma=e,r})(1);function Rx(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),o;return function(s){for(o=0;o<n;++o)r[o]=e[o]*(1-s)+t[o]*s;return r}}function Tx(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Dx(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,o=new Array(r),s=new Array(n),i;for(i=0;i<r;++i)o[i]=Bt(e[i],t[i]);for(;i<n;++i)s[i]=t[i];return function(a){for(i=0;i<r;++i)s[i]=o[i](a);return s}}function jx(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Te(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Ox(e,t){var n={},r={},o;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(o in t)o in e?n[o]=Bt(e[o],t[o]):r[o]=t[o];return function(s){for(o in n)r[o]=n[o](s);return r}}var ro=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Dr=new RegExp(ro.source,"g");function $x(e){return function(){return e}}function Lx(e){return function(t){return e(t)+""}}function du(e,t){var n=ro.lastIndex=Dr.lastIndex=0,r,o,s,i=-1,a=[],c=[];for(e=e+"",t=t+"";(r=ro.exec(e))&&(o=Dr.exec(t));)(s=o.index)>n&&(s=t.slice(n,s),a[i]?a[i]+=s:a[++i]=s),(r=r[0])===(o=o[0])?a[i]?a[i]+=o:a[++i]=o:(a[++i]=null,c.push({i,x:Te(r,o)})),n=Dr.lastIndex;return n<t.length&&(s=t.slice(n),a[i]?a[i]+=s:a[++i]=s),a.length<2?c[0]?Lx(c[0].x):$x(t):(t=c.length,function(l){for(var d=0,u;d<t;++d)a[(u=c[d]).i]=u.x(l);return a.join("")})}function Bt(e,t){var n=typeof t,r;return t==null||n==="boolean"?jo(t):(n==="number"?Te:n==="string"?(r=ot(t))?(t=r,Kn):du:t instanceof ot?Kn:t instanceof Date?jx:Tx(t)?Rx:Array.isArray(t)?Dx:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Ox:Te)(e,t)}var zs=180/Math.PI,oo={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function fu(e,t,n,r,o,s){var i,a,c;return(i=Math.sqrt(e*e+t*t))&&(e/=i,t/=i),(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,i=-i),{translateX:o,translateY:s,rotate:Math.atan2(t,e)*zs,skewX:Math.atan(c)*zs,scaleX:i,scaleY:a}}var kn;function Fx(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?oo:fu(t.a,t.b,t.c,t.d,t.e,t.f)}function zx(e){return e==null||(kn||(kn=document.createElementNS("http://www.w3.org/2000/svg","g")),kn.setAttribute("transform",e),!(e=kn.transform.baseVal.consolidate()))?oo:(e=e.matrix,fu(e.a,e.b,e.c,e.d,e.e,e.f))}function hu(e,t,n,r){function o(l){return l.length?l.pop()+" ":""}function s(l,d,u,f,g,p){if(l!==u||d!==f){var m=g.push("translate(",null,t,null,n);p.push({i:m-4,x:Te(l,u)},{i:m-2,x:Te(d,f)})}else(u||f)&&g.push("translate("+u+t+f+n)}function i(l,d,u,f){l!==d?(l-d>180?d+=360:d-l>180&&(l+=360),f.push({i:u.push(o(u)+"rotate(",null,r)-2,x:Te(l,d)})):d&&u.push(o(u)+"rotate("+d+r)}function a(l,d,u,f){l!==d?f.push({i:u.push(o(u)+"skewX(",null,r)-2,x:Te(l,d)}):d&&u.push(o(u)+"skewX("+d+r)}function c(l,d,u,f,g,p){if(l!==u||d!==f){var m=g.push(o(g)+"scale(",null,",",null,")");p.push({i:m-4,x:Te(l,u)},{i:m-2,x:Te(d,f)})}else(u!==1||f!==1)&&g.push(o(g)+"scale("+u+","+f+")")}return function(l,d){var u=[],f=[];return l=e(l),d=e(d),s(l.translateX,l.translateY,d.translateX,d.translateY,u,f),i(l.rotate,d.rotate,u,f),a(l.skewX,d.skewX,u,f),c(l.scaleX,l.scaleY,d.scaleX,d.scaleY,u,f),l=d=null,function(g){for(var p=-1,m=f.length,v;++p<m;)u[(v=f[p]).i]=v.x(g);return u.join("")}}}var Hx=hu(Fx,"px, ","px)","deg)"),Bx=hu(zx,", ",")",")"),Wx=1e-12;function Hs(e){return((e=Math.exp(e))+1/e)/2}function Vx(e){return((e=Math.exp(e))-1/e)/2}function Yx(e){return((e=Math.exp(2*e))-1)/(e+1)}const Ln=(function e(t,n,r){function o(s,i){var a=s[0],c=s[1],l=s[2],d=i[0],u=i[1],f=i[2],g=d-a,p=u-c,m=g*g+p*p,v,w;if(m<Wx)w=Math.log(f/l)/t,v=function(M){return[a+M*g,c+M*p,l*Math.exp(t*M*w)]};else{var E=Math.sqrt(m),y=(f*f-l*l+r*m)/(2*l*n*E),b=(f*f-l*l-r*m)/(2*f*n*E),S=Math.log(Math.sqrt(y*y+1)-y),_=Math.log(Math.sqrt(b*b+1)-b);w=(_-S)/t,v=function(M){var P=M*w,T=Hs(S),z=l/(n*E)*(T*Yx(t*P+S)-Vx(S));return[a+z*g,c+z*p,l*T/Hs(t*P+S)]}}return v.duration=w*1e3*t/Math.SQRT2,v}return o.rho=function(s){var i=Math.max(.001,+s),a=i*i,c=a*a;return e(i,a,c)},o})(Math.SQRT2,2,4);var Et=0,zt=0,$t=0,pu=1e3,Zn,Ht,Qn=0,st=0,lr=0,Zt=typeof performance=="object"&&performance.now?performance:Date,gu=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Oo(){return st||(gu(Gx),st=Zt.now()+lr)}function Gx(){st=0}function Jn(){this._call=this._time=this._next=null}Jn.prototype=mu.prototype={constructor:Jn,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Oo():+n)+(t==null?0:+t),!this._next&&Ht!==this&&(Ht?Ht._next=this:Zn=this,Ht=this),this._call=e,this._time=n,so()},stop:function(){this._call&&(this._call=null,this._time=1/0,so())}};function mu(e,t,n){var r=new Jn;return r.restart(e,t,n),r}function Xx(){Oo(),++Et;for(var e=Zn,t;e;)(t=st-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Et}function Bs(){st=(Qn=Zt.now())+lr,Et=zt=0;try{Xx()}finally{Et=0,qx(),st=0}}function Ux(){var e=Zt.now(),t=e-Qn;t>pu&&(lr-=t,Qn=e)}function qx(){for(var e,t=Zn,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:Zn=n);Ht=e,so(r)}function so(e){if(!Et){zt&&(zt=clearTimeout(zt));var t=e-st;t>24?(e<1/0&&(zt=setTimeout(Bs,e-Zt.now()-lr)),$t&&($t=clearInterval($t))):($t||(Qn=Zt.now(),$t=setInterval(Ux,pu)),Et=1,gu(Bs))}}function Ws(e,t,n){var r=new Jn;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,n),r}var Kx=cr("start","end","cancel","interrupt"),Zx=[],yu=0,Vs=1,io=2,Fn=3,Ys=4,ao=5,zn=6;function dr(e,t,n,r,o,s){var i=e.__transition;if(!i)e.__transition={};else if(n in i)return;Qx(e,n,{name:t,index:r,group:o,on:Kx,tween:Zx,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:yu})}function $o(e,t){var n=Ie(e,t);if(n.state>yu)throw new Error("too late; already scheduled");return n}function $e(e,t){var n=Ie(e,t);if(n.state>Fn)throw new Error("too late; already running");return n}function Ie(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Qx(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=mu(s,0,n.time);function s(l){n.state=Vs,n.timer.restart(i,n.delay,n.time),n.delay<=l&&i(l-n.delay)}function i(l){var d,u,f,g;if(n.state!==Vs)return c();for(d in r)if(g=r[d],g.name===n.name){if(g.state===Fn)return Ws(i);g.state===Ys?(g.state=zn,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete r[d]):+d<t&&(g.state=zn,g.timer.stop(),g.on.call("cancel",e,e.__data__,g.index,g.group),delete r[d])}if(Ws(function(){n.state===Fn&&(n.state=Ys,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=io,n.on.call("start",e,e.__data__,n.index,n.group),n.state===io){for(n.state=Fn,o=new Array(f=n.tween.length),d=0,u=-1;d<f;++d)(g=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(o[++u]=g);o.length=u+1}}function a(l){for(var d=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=ao,1),u=-1,f=o.length;++u<f;)o[u].call(e,d);n.state===ao&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=zn,n.timer.stop(),delete r[t];for(var l in r)return;delete e.__transition}}function Hn(e,t){var n=e.__transition,r,o,s=!0,i;if(n){t=t==null?null:t+"";for(i in n){if((r=n[i]).name!==t){s=!1;continue}o=r.state>io&&r.state<ao,r.state=zn,r.timer.stop(),r.on.call(o?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[i]}s&&delete e.__transition}}function Jx(e){return this.each(function(){Hn(this,e)})}function ev(e,t){var n,r;return function(){var o=$e(this,e),s=o.tween;if(s!==n){r=n=s;for(var i=0,a=r.length;i<a;++i)if(r[i].name===t){r=r.slice(),r.splice(i,1);break}}o.tween=r}}function tv(e,t,n){var r,o;if(typeof n!="function")throw new Error;return function(){var s=$e(this,e),i=s.tween;if(i!==r){o=(r=i).slice();for(var a={name:t,value:n},c=0,l=o.length;c<l;++c)if(o[c].name===t){o[c]=a;break}c===l&&o.push(a)}s.tween=o}}function nv(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Ie(this.node(),n).tween,o=0,s=r.length,i;o<s;++o)if((i=r[o]).name===e)return i.value;return null}return this.each((t==null?ev:tv)(n,e,t))}function Lo(e,t,n){var r=e._id;return e.each(function(){var o=$e(this,r);(o.value||(o.value={}))[t]=n.apply(this,arguments)}),function(o){return Ie(o,r).value[t]}}function xu(e,t){var n;return(typeof t=="number"?Te:t instanceof ot?Kn:(n=ot(t))?(t=n,Kn):du)(e,t)}function rv(e){return function(){this.removeAttribute(e)}}function ov(e){return function(){this.removeAttributeNS(e.space,e.local)}}function sv(e,t,n){var r,o=n+"",s;return function(){var i=this.getAttribute(e);return i===o?null:i===r?s:s=t(r=i,n)}}function iv(e,t,n){var r,o=n+"",s;return function(){var i=this.getAttributeNS(e.space,e.local);return i===o?null:i===r?s:s=t(r=i,n)}}function av(e,t,n){var r,o,s;return function(){var i,a=n(this),c;return a==null?void this.removeAttribute(e):(i=this.getAttribute(e),c=a+"",i===c?null:i===r&&c===o?s:(o=c,s=t(r=i,a)))}}function cv(e,t,n){var r,o,s;return function(){var i,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(i=this.getAttributeNS(e.space,e.local),c=a+"",i===c?null:i===r&&c===o?s:(o=c,s=t(r=i,a)))}}function uv(e,t){var n=ur(e),r=n==="transform"?Bx:xu;return this.attrTween(e,typeof t=="function"?(n.local?cv:av)(n,r,Lo(this,"attr."+e,t)):t==null?(n.local?ov:rv)(n):(n.local?iv:sv)(n,r,t))}function lv(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function dv(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function fv(e,t){var n,r;function o(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&dv(e,s)),n}return o._value=t,o}function hv(e,t){var n,r;function o(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&lv(e,s)),n}return o._value=t,o}function pv(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=ur(e);return this.tween(n,(r.local?fv:hv)(r,t))}function gv(e,t){return function(){$o(this,e).delay=+t.apply(this,arguments)}}function mv(e,t){return t=+t,function(){$o(this,e).delay=t}}function yv(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?gv:mv)(t,e)):Ie(this.node(),t).delay}function xv(e,t){return function(){$e(this,e).duration=+t.apply(this,arguments)}}function vv(e,t){return t=+t,function(){$e(this,e).duration=t}}function wv(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?xv:vv)(t,e)):Ie(this.node(),t).duration}function bv(e,t){if(typeof t!="function")throw new Error;return function(){$e(this,e).ease=t}}function Ev(e){var t=this._id;return arguments.length?this.each(bv(t,e)):Ie(this.node(),t).ease}function Sv(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;$e(this,e).ease=n}}function Cv(e){if(typeof e!="function")throw new Error;return this.each(Sv(this._id,e))}function _v(e){typeof e!="function"&&(e=qc(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var s=t[o],i=s.length,a=r[o]=[],c,l=0;l<i;++l)(c=s[l])&&e.call(c,c.__data__,l,s)&&a.push(c);return new Be(r,this._parents,this._name,this._id)}function Nv(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,o=n.length,s=Math.min(r,o),i=new Array(r),a=0;a<s;++a)for(var c=t[a],l=n[a],d=c.length,u=i[a]=new Array(d),f,g=0;g<d;++g)(f=c[g]||l[g])&&(u[g]=f);for(;a<r;++a)i[a]=t[a];return new Be(i,this._parents,this._name,this._id)}function Mv(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 kv(e,t,n){var r,o,s=Mv(t)?$o:$e;return function(){var i=s(this,e),a=i.on;a!==r&&(o=(r=a).copy()).on(t,n),i.on=o}}function Pv(e,t){var n=this._id;return arguments.length<2?Ie(this.node(),n).on.on(e):this.each(kv(n,e,t))}function Iv(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Av(){return this.on("end.remove",Iv(this._id))}function Rv(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Ro(e));for(var r=this._groups,o=r.length,s=new Array(o),i=0;i<o;++i)for(var a=r[i],c=a.length,l=s[i]=new Array(c),d,u,f=0;f<c;++f)(d=a[f])&&(u=e.call(d,d.__data__,f,a))&&("__data__"in d&&(u.__data__=d.__data__),l[f]=u,dr(l[f],t,n,f,l,Ie(d,n)));return new Be(s,this._parents,t,n)}function Tv(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Uc(e));for(var r=this._groups,o=r.length,s=[],i=[],a=0;a<o;++a)for(var c=r[a],l=c.length,d,u=0;u<l;++u)if(d=c[u]){for(var f=e.call(d,d.__data__,u,c),g,p=Ie(d,n),m=0,v=f.length;m<v;++m)(g=f[m])&&dr(g,t,n,m,f,p);s.push(f),i.push(d)}return new Be(s,i,t,n)}var Dv=ln.prototype.constructor;function jv(){return new Dv(this._groups,this._parents)}function Ov(e,t){var n,r,o;return function(){var s=bt(this,e),i=(this.style.removeProperty(e),bt(this,e));return s===i?null:s===n&&i===r?o:o=t(n=s,r=i)}}function vu(e){return function(){this.style.removeProperty(e)}}function $v(e,t,n){var r,o=n+"",s;return function(){var i=bt(this,e);return i===o?null:i===r?s:s=t(r=i,n)}}function Lv(e,t,n){var r,o,s;return function(){var i=bt(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),bt(this,e))),i===c?null:i===r&&c===o?s:(o=c,s=t(r=i,a))}}function Fv(e,t){var n,r,o,s="style."+t,i="end."+s,a;return function(){var c=$e(this,e),l=c.on,d=c.value[s]==null?a||(a=vu(t)):void 0;(l!==n||o!==d)&&(r=(n=l).copy()).on(i,o=d),c.on=r}}function zv(e,t,n){var r=(e+="")=="transform"?Hx:xu;return t==null?this.styleTween(e,Ov(e,r)).on("end.style."+e,vu(e)):typeof t=="function"?this.styleTween(e,Lv(e,r,Lo(this,"style."+e,t))).each(Fv(this._id,e)):this.styleTween(e,$v(e,r,t),n).on("end.style."+e,null)}function Hv(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Bv(e,t,n){var r,o;function s(){var i=t.apply(this,arguments);return i!==o&&(r=(o=i)&&Hv(e,i,n)),r}return s._value=t,s}function Wv(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,Bv(e,t,n??""))}function Vv(e){return function(){this.textContent=e}}function Yv(e){return function(){var t=e(this);this.textContent=t??""}}function Gv(e){return this.tween("text",typeof e=="function"?Yv(Lo(this,"text",e)):Vv(e==null?"":e+""))}function Xv(e){return function(t){this.textContent=e.call(this,t)}}function Uv(e){var t,n;function r(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&Xv(o)),t}return r._value=e,r}function qv(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,Uv(e))}function Kv(){for(var e=this._name,t=this._id,n=wu(),r=this._groups,o=r.length,s=0;s<o;++s)for(var i=r[s],a=i.length,c,l=0;l<a;++l)if(c=i[l]){var d=Ie(c,t);dr(c,e,n,l,i,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new Be(r,this._parents,e,n)}function Zv(){var e,t,n=this,r=n._id,o=n.size();return new Promise(function(s,i){var a={value:i},c={value:function(){--o===0&&s()}};n.each(function(){var l=$e(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}),o===0&&s()})}var Qv=0;function Be(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function wu(){return++Qv}var Le=ln.prototype;Be.prototype={constructor:Be,select:Rv,selectAll:Tv,selectChild:Le.selectChild,selectChildren:Le.selectChildren,filter:_v,merge:Nv,selection:jv,transition:Kv,call:Le.call,nodes:Le.nodes,node:Le.node,size:Le.size,empty:Le.empty,each:Le.each,on:Pv,attr:uv,attrTween:pv,style:zv,styleTween:Wv,text:Gv,textTween:qv,remove:Av,tween:nv,delay:yv,duration:wv,ease:Ev,easeVarying:Cv,end:Zv,[Symbol.iterator]:Le[Symbol.iterator]};function Jv(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var ew={time:null,delay:0,duration:250,ease:Jv};function tw(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 nw(e){var t,n;e instanceof Be?(t=e._id,e=e._name):(t=wu(),(n=ew).time=Oo(),e=e==null?null:e+"");for(var r=this._groups,o=r.length,s=0;s<o;++s)for(var i=r[s],a=i.length,c,l=0;l<a;++l)(c=i[l])&&dr(c,e,t,l,i,n||tw(c,t));return new Be(r,this._parents,e,t)}ln.prototype.interrupt=Jx;ln.prototype.transition=nw;const Pn=e=>()=>e;function rw(e,{sourceEvent:t,target:n,transform:r,dispatch:o}){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:o}})}function Fe(e,t,n){this.k=e,this.x=t,this.y=n}Fe.prototype={constructor:Fe,scale:function(e){return e===1?this:new Fe(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Fe(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 fr=new Fe(1,0,0);bu.prototype=Fe.prototype;function bu(e){for(;!e.__zoom;)if(!(e=e.parentNode))return fr;return e.__zoom}function jr(e){e.stopImmediatePropagation()}function Lt(e){e.preventDefault(),e.stopImmediatePropagation()}function ow(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function sw(){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 Gs(){return this.__zoom||fr}function iw(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function aw(){return navigator.maxTouchPoints||"ontouchstart"in this}function cw(e,t,n){var r=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],i=e.invertY(t[1][1])-n[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i))}function Eu(){var e=ow,t=sw,n=cw,r=iw,o=aw,s=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],a=250,c=Ln,l=cr("start","zoom","end"),d,u,f,g=500,p=150,m=0,v=10;function w(C){C.property("__zoom",Gs).on("wheel.zoom",P,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",z).filter(o).on("touchstart.zoom",A).on("touchmove.zoom",D).on("touchend.zoom touchcancel.zoom",F).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}w.transform=function(C,R,k,j){var I=C.selection?C.selection():C;I.property("__zoom",Gs),C!==I?S(C,R,k,j):I.interrupt().each(function(){_(this,arguments).event(j).start().zoom(null,typeof R=="function"?R.apply(this,arguments):R).end()})},w.scaleBy=function(C,R,k,j){w.scaleTo(C,function(){var I=this.__zoom.k,N=typeof R=="function"?R.apply(this,arguments):R;return I*N},k,j)},w.scaleTo=function(C,R,k,j){w.transform(C,function(){var I=t.apply(this,arguments),N=this.__zoom,O=k==null?b(I):typeof k=="function"?k.apply(this,arguments):k,$=N.invert(O),L=typeof R=="function"?R.apply(this,arguments):R;return n(y(E(N,L),O,$),I,i)},k,j)},w.translateBy=function(C,R,k,j){w.transform(C,function(){return n(this.__zoom.translate(typeof R=="function"?R.apply(this,arguments):R,typeof k=="function"?k.apply(this,arguments):k),t.apply(this,arguments),i)},null,j)},w.translateTo=function(C,R,k,j,I){w.transform(C,function(){var N=t.apply(this,arguments),O=this.__zoom,$=j==null?b(N):typeof j=="function"?j.apply(this,arguments):j;return n(fr.translate($[0],$[1]).scale(O.k).translate(typeof R=="function"?-R.apply(this,arguments):-R,typeof k=="function"?-k.apply(this,arguments):-k),N,i)},j,I)};function E(C,R){return R=Math.max(s[0],Math.min(s[1],R)),R===C.k?C:new Fe(R,C.x,C.y)}function y(C,R,k){var j=R[0]-k[0]*C.k,I=R[1]-k[1]*C.k;return j===C.x&&I===C.y?C:new Fe(C.k,j,I)}function b(C){return[(+C[0][0]+ +C[1][0])/2,(+C[0][1]+ +C[1][1])/2]}function S(C,R,k,j){C.on("start.zoom",function(){_(this,arguments).event(j).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(j).end()}).tween("zoom",function(){var I=this,N=arguments,O=_(I,N).event(j),$=t.apply(I,N),L=k==null?b($):typeof k=="function"?k.apply(I,N):k,B=Math.max($[1][0]-$[0][0],$[1][1]-$[0][1]),W=I.__zoom,X=typeof R=="function"?R.apply(I,N):R,U=c(W.invert(L).concat(B/W.k),X.invert(L).concat(B/X.k));return function(G){if(G===1)G=X;else{var H=U(G),V=B/H[2];G=new Fe(V,L[0]-H[0]*V,L[1]-H[1]*V)}O.zoom(null,G)}})}function _(C,R,k){return!k&&C.__zooming||new M(C,R)}function M(C,R){this.that=C,this.args=R,this.active=0,this.sourceEvent=null,this.extent=t.apply(C,R),this.taps=0}M.prototype={event:function(C){return C&&(this.sourceEvent=C),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(C,R){return this.mouse&&C!=="mouse"&&(this.mouse[1]=R.invert(this.mouse[0])),this.touch0&&C!=="touch"&&(this.touch0[1]=R.invert(this.touch0[0])),this.touch1&&C!=="touch"&&(this.touch1[1]=R.invert(this.touch1[0])),this.that.__zoom=R,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(C){var R=ye(this.that).datum();l.call(C,this.that,new rw(C,{sourceEvent:this.sourceEvent,target:w,transform:this.that.__zoom,dispatch:l}),R)}};function P(C,...R){if(!e.apply(this,arguments))return;var k=_(this,R).event(C),j=this.__zoom,I=Math.max(s[0],Math.min(s[1],j.k*Math.pow(2,r.apply(this,arguments)))),N=Ee(C);if(k.wheel)(k.mouse[0][0]!==N[0]||k.mouse[0][1]!==N[1])&&(k.mouse[1]=j.invert(k.mouse[0]=N)),clearTimeout(k.wheel);else{if(j.k===I)return;k.mouse=[N,j.invert(N)],Hn(this),k.start()}Lt(C),k.wheel=setTimeout(O,p),k.zoom("mouse",n(y(E(j,I),k.mouse[0],k.mouse[1]),k.extent,i));function O(){k.wheel=null,k.end()}}function T(C,...R){if(f||!e.apply(this,arguments))return;var k=C.currentTarget,j=_(this,R,!0).event(C),I=ye(C.view).on("mousemove.zoom",L,!0).on("mouseup.zoom",B,!0),N=Ee(C,k),O=C.clientX,$=C.clientY;su(C.view),jr(C),j.mouse=[N,this.__zoom.invert(N)],Hn(this),j.start();function L(W){if(Lt(W),!j.moved){var X=W.clientX-O,U=W.clientY-$;j.moved=X*X+U*U>m}j.event(W).zoom("mouse",n(y(j.that.__zoom,j.mouse[0]=Ee(W,k),j.mouse[1]),j.extent,i))}function B(W){I.on("mousemove.zoom mouseup.zoom",null),iu(W.view,j.moved),Lt(W),j.event(W).end()}}function z(C,...R){if(e.apply(this,arguments)){var k=this.__zoom,j=Ee(C.changedTouches?C.changedTouches[0]:C,this),I=k.invert(j),N=k.k*(C.shiftKey?.5:2),O=n(y(E(k,N),j,I),t.apply(this,R),i);Lt(C),a>0?ye(this).transition().duration(a).call(S,O,j,C):ye(this).call(w.transform,O,j,C)}}function A(C,...R){if(e.apply(this,arguments)){var k=C.touches,j=k.length,I=_(this,R,C.changedTouches.length===j).event(C),N,O,$,L;for(jr(C),O=0;O<j;++O)$=k[O],L=Ee($,this),L=[L,this.__zoom.invert(L),$.identifier],I.touch0?!I.touch1&&I.touch0[2]!==L[2]&&(I.touch1=L,I.taps=0):(I.touch0=L,N=!0,I.taps=1+!!d);d&&(d=clearTimeout(d)),N&&(I.taps<2&&(u=L[0],d=setTimeout(function(){d=null},g)),Hn(this),I.start())}}function D(C,...R){if(this.__zooming){var k=_(this,R).event(C),j=C.changedTouches,I=j.length,N,O,$,L;for(Lt(C),N=0;N<I;++N)O=j[N],$=Ee(O,this),k.touch0&&k.touch0[2]===O.identifier?k.touch0[0]=$:k.touch1&&k.touch1[2]===O.identifier&&(k.touch1[0]=$);if(O=k.that.__zoom,k.touch1){var B=k.touch0[0],W=k.touch0[1],X=k.touch1[0],U=k.touch1[1],G=(G=X[0]-B[0])*G+(G=X[1]-B[1])*G,H=(H=U[0]-W[0])*H+(H=U[1]-W[1])*H;O=E(O,Math.sqrt(G/H)),$=[(B[0]+X[0])/2,(B[1]+X[1])/2],L=[(W[0]+U[0])/2,(W[1]+U[1])/2]}else if(k.touch0)$=k.touch0[0],L=k.touch0[1];else return;k.zoom("touch",n(y(O,$,L),k.extent,i))}}function F(C,...R){if(this.__zooming){var k=_(this,R).event(C),j=C.changedTouches,I=j.length,N,O;for(jr(C),f&&clearTimeout(f),f=setTimeout(function(){f=null},g),N=0;N<I;++N)O=j[N],k.touch0&&k.touch0[2]===O.identifier?delete k.touch0:k.touch1&&k.touch1[2]===O.identifier&&delete k.touch1;if(k.touch1&&!k.touch0&&(k.touch0=k.touch1,delete k.touch1),k.touch0)k.touch0[1]=this.__zoom.invert(k.touch0[0]);else if(k.end(),k.taps===2&&(O=Ee(O,this),Math.hypot(u[0]-O[0],u[1]-O[1])<v)){var $=ye(this).on("dblclick.zoom");$&&$.apply(this,arguments)}}}return w.wheelDelta=function(C){return arguments.length?(r=typeof C=="function"?C:Pn(+C),w):r},w.filter=function(C){return arguments.length?(e=typeof C=="function"?C:Pn(!!C),w):e},w.touchable=function(C){return arguments.length?(o=typeof C=="function"?C:Pn(!!C),w):o},w.extent=function(C){return arguments.length?(t=typeof C=="function"?C:Pn([[+C[0][0],+C[0][1]],[+C[1][0],+C[1][1]]]),w):t},w.scaleExtent=function(C){return arguments.length?(s[0]=+C[0],s[1]=+C[1],w):[s[0],s[1]]},w.translateExtent=function(C){return arguments.length?(i[0][0]=+C[0][0],i[1][0]=+C[1][0],i[0][1]=+C[0][1],i[1][1]=+C[1][1],w):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},w.constrain=function(C){return arguments.length?(n=C,w):n},w.duration=function(C){return arguments.length?(a=+C,w):a},w.interpolate=function(C){return arguments.length?(c=C,w):c},w.on=function(){var C=l.on.apply(l,arguments);return C===l?w:C},w.clickDistance=function(C){return arguments.length?(m=(C=+C)*C,w):Math.sqrt(m)},w.tapDistance=function(C){return arguments.length?(v=+C,w):v},w}const Oe={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.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},Qt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Su=["Enter"," ","Escape"],Cu={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var St;(function(e){e.Strict="strict",e.Loose="loose"})(St||(St={}));var nt;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(nt||(nt={}));var Jt;(function(e){e.Partial="partial",e.Full="full"})(Jt||(Jt={}));const _u={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ue;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ue||(Ue={}));var Ct;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Ct||(Ct={}));var Y;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Y||(Y={}));const Xs={[Y.Left]:Y.Right,[Y.Right]:Y.Left,[Y.Top]:Y.Bottom,[Y.Bottom]:Y.Top};function Nu(e){return e===null?null:e?"valid":"invalid"}const Mu=e=>"id"in e&&"source"in e&&"target"in e,uw=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Fo=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),fn=(e,t=[0,0])=>{const{width:n,height:r}=We(e),o=e.origin??t,s=n*o[0],i=r*o[1];return{x:e.position.x-s,y:e.position.y-i}},lw=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,o)=>{const s=typeof o=="string";let i=!t.nodeLookup&&!s?o:void 0;t.nodeLookup&&(i=s?t.nodeLookup.get(o):Fo(o)?o:t.nodeLookup.get(o.id));const a=i?er(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return hr(r,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return pr(n)},hn=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(o=>{(t.filter===void 0||t.filter(o))&&(n=hr(n,er(o)),r=!0)}),r?pr(n):{x:0,y:0,width:0,height:0}},zo=(e,t,[n,r,o]=[0,0,1],s=!1,i=!1)=>{const a={...gn(t,[n,r,o]),width:t.width/o,height:t.height/o},c=[];for(const l of e.values()){const{measured:d,selectable:u=!0,hidden:f=!1}=l;if(i&&!u||f)continue;const g=d.width??l.width??l.initialWidth??null,p=d.height??l.height??l.initialHeight??null,m=en(a,Nt(l)),v=(g??0)*(p??0),w=s&&m>0;(!l.internals.handleBounds||w||m>=v||l.dragging)&&c.push(l)}return c},dw=(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 fw(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(o=>o.id)):null;return e.forEach(o=>{o.measured.width&&o.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!o.hidden)&&(!r||r.has(o.id))&&n.set(o.id,o)}),n}async function hw({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:s},i){if(e.size===0)return Promise.resolve(!0);const a=fw(e,i),c=hn(a),l=Ho(c,t,n,(i==null?void 0:i.minZoom)??o,(i==null?void 0:i.maxZoom)??s,(i==null?void 0:i.padding)??.1);return await r.setViewport(l,{duration:i==null?void 0:i.duration,ease:i==null?void 0:i.ease,interpolate:i==null?void 0:i.interpolate}),Promise.resolve(!0)}function ku({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:o,onError:s}){const i=n.get(e),a=i.parentId?n.get(i.parentId):void 0,{x:c,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},d=i.origin??r;let u=i.extent||o;if(i.extent==="parent"&&!i.expandParent)if(!a)s==null||s("005",Oe.error005());else{const g=a.measured.width,p=a.measured.height;g&&p&&(u=[[c,l],[c+g,l+p]])}else a&&Mt(i.extent)&&(u=[[i.extent[0][0]+c,i.extent[0][1]+l],[i.extent[1][0]+c,i.extent[1][1]+l]]);const f=Mt(u)?it(t,u,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&(s==null||s("015",Oe.error015())),{position:{x:f.x-c+(i.measured.width??0)*d[0],y:f.y-l+(i.measured.height??0)*d[1]},positionAbsolute:f}}async function pw({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:o}){const s=new Set(e.map(f=>f.id)),i=[];for(const f of n){if(f.deletable===!1)continue;const g=s.has(f.id),p=!g&&f.parentId&&i.find(m=>m.id===f.parentId);(g||p)&&i.push(f)}const a=new Set(t.map(f=>f.id)),c=r.filter(f=>f.deletable!==!1),d=dw(i,c);for(const f of c)a.has(f.id)&&!d.find(p=>p.id===f.id)&&d.push(f);if(!o)return{edges:d,nodes:i};const u=await o({nodes:i,edges:d});return typeof u=="boolean"?u?{edges:d,nodes:i}:{edges:[],nodes:[]}:u}const _t=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),it=(e={x:0,y:0},t,n)=>({x:_t(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:_t(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function Pu(e,t,n){const{width:r,height:o}=We(n),{x:s,y:i}=n.internals.positionAbsolute;return it(e,[[s,i],[s+r,i+o]],t)}const Us=(e,t,n)=>e<t?_t(Math.abs(e-t),1,t)/t:e>n?-_t(Math.abs(e-n),1,t)/t:0,Iu=(e,t,n=15,r=40)=>{const o=Us(e.x,r,t.width-r)*n,s=Us(e.y,r,t.height-r)*n;return[o,s]},hr=(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)}),co=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),pr=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Nt=(e,t=[0,0])=>{var o,s;const{x:n,y:r}=Fo(e)?e.internals.positionAbsolute:fn(e,t);return{x:n,y:r,width:((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0,height:((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0}},er=(e,t=[0,0])=>{var o,s;const{x:n,y:r}=Fo(e)?e.internals.positionAbsolute:fn(e,t);return{x:n,y:r,x2:n+(((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0),y2:r+(((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0)}},Au=(e,t)=>pr(hr(co(e),co(t))),en=(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)},qs=e=>Me(e.width)&&Me(e.height)&&Me(e.x)&&Me(e.y),Me=e=>!isNaN(e)&&isFinite(e),gw=(e,t)=>{},pn=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),gn=({x:e,y:t},[n,r,o],s=!1,i=[1,1])=>{const a={x:(e-n)/o,y:(t-r)/o};return s?pn(a,i):a},tr=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r});function gt(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function mw(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=gt(e,n),o=gt(e,t);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof e=="object"){const r=gt(e.top??e.y??0,n),o=gt(e.bottom??e.y??0,n),s=gt(e.left??e.x??0,t),i=gt(e.right??e.x??0,t);return{top:r,right:i,bottom:o,left:s,x:s+i,y:r+o}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function yw(e,t,n,r,o,s){const{x:i,y:a}=tr(e,[t,n,r]),{x:c,y:l}=tr({x:e.x+e.width,y:e.y+e.height},[t,n,r]),d=o-c,u=s-l;return{left:Math.floor(i),top:Math.floor(a),right:Math.floor(d),bottom:Math.floor(u)}}const Ho=(e,t,n,r,o,s)=>{const i=mw(s,t,n),a=(t-i.x)/e.width,c=(n-i.y)/e.height,l=Math.min(a,c),d=_t(l,r,o),u=e.x+e.width/2,f=e.y+e.height/2,g=t/2-u*d,p=n/2-f*d,m=yw(e,g,p,d,t,n),v={left:Math.min(m.left-i.left,0),top:Math.min(m.top-i.top,0),right:Math.min(m.right-i.right,0),bottom:Math.min(m.bottom-i.bottom,0)};return{x:g-v.left+v.right,y:p-v.top+v.bottom,zoom:d}},tn=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Mt(e){return e!=null&&e!=="parent"}function We(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 Ru(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 Tu(e,t={width:0,height:0},n,r,o){const s={...e},i=r.get(n);if(i){const a=i.origin||o;s.x+=i.internals.positionAbsolute.x-(t.width??0)*a[0],s.y+=i.internals.positionAbsolute.y-(t.height??0)*a[1]}return s}function Ks(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function xw(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}function vw(e){return{...Cu,...e||{}}}function Wt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:s,y:i}=ke(e),a=gn({x:s-((o==null?void 0:o.left)??0),y:i-((o==null?void 0:o.top)??0)},r),{x:c,y:l}=n?pn(a,t):a;return{xSnapped:c,ySnapped:l,...a}}const Bo=e=>({width:e.offsetWidth,height:e.offsetHeight}),Du=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},ww=["INPUT","SELECT","TEXTAREA"];function ju(e){var r,o;const t=((o=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:o[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:ww.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Ou=e=>"clientX"in e,ke=(e,t)=>{var s,i;const n=Ou(e),r=n?e.clientX:(s=e.touches)==null?void 0:s[0].clientX,o=n?e.clientY:(i=e.touches)==null?void 0:i[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:o-((t==null?void 0:t.top)??0)}},Zs=(e,t,n,r,o)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(i=>{const a=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:o,position:i.getAttribute("data-handlepos"),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...Bo(i)}})};function $u({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:o,sourceControlY:s,targetControlX:i,targetControlY:a}){const c=e*.125+o*.375+i*.375+n*.125,l=t*.125+s*.375+a*.375+r*.125,d=Math.abs(c-e),u=Math.abs(l-t);return[c,l,d,u]}function In(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Qs({pos:e,x1:t,y1:n,x2:r,y2:o,c:s}){switch(e){case Y.Left:return[t-In(t-r,s),n];case Y.Right:return[t+In(r-t,s),n];case Y.Top:return[t,n-In(n-o,s)];case Y.Bottom:return[t,n+In(o-n,s)]}}function Lu({sourceX:e,sourceY:t,sourcePosition:n=Y.Bottom,targetX:r,targetY:o,targetPosition:s=Y.Top,curvature:i=.25}){const[a,c]=Qs({pos:n,x1:e,y1:t,x2:r,y2:o,c:i}),[l,d]=Qs({pos:s,x1:r,y1:o,x2:e,y2:t,c:i}),[u,f,g,p]=$u({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:d});return[`M${e},${t} C${a},${c} ${l},${d} ${r},${o}`,u,f,g,p]}function Fu({sourceX:e,sourceY:t,targetX:n,targetY:r}){const o=Math.abs(n-e)/2,s=n<e?n+o:n-o,i=Math.abs(r-t)/2,a=r<t?r+i:r-i;return[s,a,o,i]}function bw({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:o=!1,zIndexMode:s="basic"}){if(s==="manual")return r;const i=o&&n?r+1e3:r,a=Math.max(e.parentId||o&&e.selected?e.internals.z:0,t.parentId||o&&t.selected?t.internals.z:0);return i+a}function Ew({sourceNode:e,targetNode:t,width:n,height:r,transform:o}){const s=hr(er(e),er(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const i={x:-o[0]/o[2],y:-o[1]/o[2],width:n/o[2],height:r/o[2]};return en(i,pr(s))>0}const Sw=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,Cw=(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)),_w=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||Sw;let o;return Mu(e)?o={...e}:o={...e,id:r(e)},Cw(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function zu({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,s,i,a]=Fu({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,s,i,a]}const Js={[Y.Left]:{x:-1,y:0},[Y.Right]:{x:1,y:0},[Y.Top]:{x:0,y:-1},[Y.Bottom]:{x:0,y:1}},Nw=({source:e,sourcePosition:t=Y.Bottom,target:n})=>t===Y.Left||t===Y.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},ei=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Mw({source:e,sourcePosition:t=Y.Bottom,target:n,targetPosition:r=Y.Top,center:o,offset:s,stepPosition:i}){const a=Js[t],c=Js[r],l={x:e.x+a.x*s,y:e.y+a.y*s},d={x:n.x+c.x*s,y:n.y+c.y*s},u=Nw({source:l,sourcePosition:t,target:d}),f=u.x!==0?"x":"y",g=u[f];let p=[],m,v;const w={x:0,y:0},E={x:0,y:0},[,,y,b]=Fu({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*c[f]===-1){f==="x"?(m=o.x??l.x+(d.x-l.x)*i,v=o.y??(l.y+d.y)/2):(m=o.x??(l.x+d.x)/2,v=o.y??l.y+(d.y-l.y)*i);const _=[{x:m,y:l.y},{x:m,y:d.y}],M=[{x:l.x,y:v},{x:d.x,y:v}];a[f]===g?p=f==="x"?_:M:p=f==="x"?M:_}else{const _=[{x:l.x,y:d.y}],M=[{x:d.x,y:l.y}];if(f==="x"?p=a.x===g?M:_:p=a.y===g?_:M,t===r){const D=Math.abs(e[f]-n[f]);if(D<=s){const F=Math.min(s-1,s-D);a[f]===g?w[f]=(l[f]>e[f]?-1:1)*F:E[f]=(d[f]>n[f]?-1:1)*F}}if(t!==r){const D=f==="x"?"y":"x",F=a[f]===c[D],C=l[D]>d[D],R=l[D]<d[D];(a[f]===1&&(!F&&C||F&&R)||a[f]!==1&&(!F&&R||F&&C))&&(p=f==="x"?_:M)}const P={x:l.x+w.x,y:l.y+w.y},T={x:d.x+E.x,y:d.y+E.y},z=Math.max(Math.abs(P.x-p[0].x),Math.abs(T.x-p[0].x)),A=Math.max(Math.abs(P.y-p[0].y),Math.abs(T.y-p[0].y));z>=A?(m=(P.x+T.x)/2,v=p[0].y):(m=p[0].x,v=(P.y+T.y)/2)}return[[e,{x:l.x+w.x,y:l.y+w.y},...p,{x:d.x+E.x,y:d.y+E.y},n],m,v,y,b]}function kw(e,t,n,r){const o=Math.min(ei(e,t)/2,ei(t,n)/2,r),{x:s,y:i}=t;if(e.x===s&&s===n.x||e.y===i&&i===n.y)return`L${s} ${i}`;if(e.y===i){const l=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${s+o*l},${i}Q ${s},${i} ${s},${i+o*d}`}const a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${s},${i+o*c}Q ${s},${i} ${s+o*a},${i}`}function uo({sourceX:e,sourceY:t,sourcePosition:n=Y.Bottom,targetX:r,targetY:o,targetPosition:s=Y.Top,borderRadius:i=5,centerX:a,centerY:c,offset:l=20,stepPosition:d=.5}){const[u,f,g,p,m]=Mw({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:o},targetPosition:s,center:{x:a,y:c},offset:l,stepPosition:d});return[u.reduce((w,E,y)=>{let b="";return y>0&&y<u.length-1?b=kw(u[y-1],E,u[y+1],i):b=`${y===0?"M":"L"}${E.x} ${E.y}`,w+=b,w},""),f,g,p,m]}function ti(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Pw(e){var u;const{sourceNode:t,targetNode:n}=e;if(!ti(t)||!ti(n))return null;const r=t.internals.handleBounds||ni(t.handles),o=n.internals.handleBounds||ni(n.handles),s=ri((r==null?void 0:r.source)??[],e.sourceHandle),i=ri(e.connectionMode===St.Strict?(o==null?void 0:o.target)??[]:((o==null?void 0:o.target)??[]).concat((o==null?void 0:o.source)??[]),e.targetHandle);if(!s||!i)return(u=e.onError)==null||u.call(e,"008",Oe.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=(s==null?void 0:s.position)||Y.Bottom,c=(i==null?void 0:i.position)||Y.Top,l=at(t,s,a),d=at(n,i,c);return{sourceX:l.x,sourceY:l.y,targetX:d.x,targetY:d.y,sourcePosition:a,targetPosition:c}}function ni(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 at(e,t,n=Y.Left,r=!1){const o=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,s=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:i,height:a}=t??We(e);if(r)return{x:o+i/2,y:s+a/2};switch((t==null?void 0:t.position)??n){case Y.Top:return{x:o+i/2,y:s};case Y.Right:return{x:o+i,y:s+a/2};case Y.Bottom:return{x:o+i/2,y:s+a};case Y.Left:return{x:o,y:s+a/2}}}function ri(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function lo(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function Iw(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:o}){const s=new Set;return e.reduce((i,a)=>([a.markerStart||r,a.markerEnd||o].forEach(c=>{if(c&&typeof c=="object"){const l=lo(c,t);s.has(l)||(i.push({id:l,color:c.color||n,...c}),s.add(l))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))}const Hu=1e3,Aw=10,Wo={nodeOrigin:[0,0],nodeExtent:Qt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Rw={...Wo,checkEquality:!0};function Vo(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function Tw(e,t,n){const r=Vo(Wo,n);for(const o of e.values())if(o.parentId)Go(o,e,t,r);else{const s=fn(o,r.nodeOrigin),i=Mt(o.extent)?o.extent:r.nodeExtent,a=it(s,i,We(o));o.internals.positionAbsolute=a}}function Dw(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const o of e.handles){const s={id:o.id,width:o.width??1,height:o.height??1,nodeId:e.id,x:o.x,y:o.y,position:o.position,type:o.type};o.type==="source"?n.push(s):o.type==="target"&&r.push(s)}return{source:n,target:r}}function Yo(e){return e==="manual"}function fo(e,t,n,r={}){var l,d;const o=Vo(Rw,r),s={i:0},i=new Map(t),a=o!=null&&o.elevateNodesOnSelect&&!Yo(o.zIndexMode)?Hu:0;let c=e.length>0;t.clear(),n.clear();for(const u of e){let f=i.get(u.id);if(o.checkEquality&&u===(f==null?void 0:f.internals.userNode))t.set(u.id,f);else{const g=fn(u,o.nodeOrigin),p=Mt(u.extent)?u.extent:o.nodeExtent,m=it(g,p,We(u));f={...o.defaults,...u,measured:{width:(l=u.measured)==null?void 0:l.width,height:(d=u.measured)==null?void 0:d.height},internals:{positionAbsolute:m,handleBounds:Dw(u,f),z:Bu(u,a,o.zIndexMode),userNode:u}},t.set(u.id,f)}(f.measured===void 0||f.measured.width===void 0||f.measured.height===void 0)&&!f.hidden&&(c=!1),u.parentId&&Go(f,t,n,r,s)}return c}function jw(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 Go(e,t,n,r,o){const{elevateNodesOnSelect:s,nodeOrigin:i,nodeExtent:a,zIndexMode:c}=Vo(Wo,r),l=e.parentId,d=t.get(l);if(!d){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}jw(e,n),o&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++o.i,d.internals.z=d.internals.z+o.i*Aw),o&&d.internals.rootParentIndex!==void 0&&(o.i=d.internals.rootParentIndex);const u=s&&!Yo(c)?Hu:0,{x:f,y:g,z:p}=Ow(e,d,i,a,u,c),{positionAbsolute:m}=e.internals,v=f!==m.x||g!==m.y;(v||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:v?{x:f,y:g}:m,z:p}})}function Bu(e,t,n){const r=Me(e.zIndex)?e.zIndex:0;return Yo(n)?r:r+(e.selected?t:0)}function Ow(e,t,n,r,o,s){const{x:i,y:a}=t.internals.positionAbsolute,c=We(e),l=fn(e,n),d=Mt(e.extent)?it(l,e.extent,c):l;let u=it({x:i+d.x,y:a+d.y},r,c);e.extent==="parent"&&(u=Pu(u,c,t));const f=Bu(e,o,s),g=t.internals.z??0;return{x:u.x,y:u.y,z:g>=f?g+1:f}}function Xo(e,t,n,r=[0,0]){var i;const o=[],s=new Map;for(const a of e){const c=t.get(a.parentId);if(!c)continue;const l=((i=s.get(a.parentId))==null?void 0:i.expandedRect)??Nt(c),d=Au(l,a.rect);s.set(a.parentId,{expandedRect:d,parent:c})}return s.size>0&&s.forEach(({expandedRect:a,parent:c},l)=>{var y;const d=c.internals.positionAbsolute,u=We(c),f=c.origin??r,g=a.x<d.x?Math.round(Math.abs(d.x-a.x)):0,p=a.y<d.y?Math.round(Math.abs(d.y-a.y)):0,m=Math.max(u.width,Math.round(a.width)),v=Math.max(u.height,Math.round(a.height)),w=(m-u.width)*f[0],E=(v-u.height)*f[1];(g>0||p>0||w||E)&&(o.push({id:l,type:"position",position:{x:c.position.x-g+w,y:c.position.y-p+E}}),(y=n.get(l))==null||y.forEach(b=>{e.some(S=>S.id===b.id)||o.push({id:b.id,type:"position",position:{x:b.position.x+g,y:b.position.y+p}})})),(u.width<a.width||u.height<a.height||g||p)&&o.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:m+(g?f[0]*g-w:0),height:v+(p?f[1]*p-E:0)}})}),o}function $w(e,t,n,r,o,s,i){const a=r==null?void 0:r.querySelector(".xyflow__viewport");let c=!1;if(!a)return{changes:[],updatedInternals:c};const l=[],d=window.getComputedStyle(a),{m22:u}=new window.DOMMatrixReadOnly(d.transform),f=[];for(const g of e.values()){const p=t.get(g.id);if(!p)continue;if(p.hidden){t.set(p.id,{...p,internals:{...p.internals,handleBounds:void 0}}),c=!0;continue}const m=Bo(g.nodeElement),v=p.measured.width!==m.width||p.measured.height!==m.height;if(!!(m.width&&m.height&&(v||!p.internals.handleBounds||g.force))){const E=g.nodeElement.getBoundingClientRect(),y=Mt(p.extent)?p.extent:s;let{positionAbsolute:b}=p.internals;p.parentId&&p.extent==="parent"?b=Pu(b,m,t.get(p.parentId)):y&&(b=it(b,y,m));const S={...p,measured:m,internals:{...p.internals,positionAbsolute:b,handleBounds:{source:Zs("source",g.nodeElement,E,u,p.id),target:Zs("target",g.nodeElement,E,u,p.id)}}};t.set(p.id,S),p.parentId&&Go(S,t,n,{nodeOrigin:o,zIndexMode:i}),c=!0,v&&(l.push({id:p.id,type:"dimensions",dimensions:m}),p.expandParent&&p.parentId&&f.push({id:p.id,parentId:p.parentId,rect:Nt(S,o)}))}}if(f.length>0){const g=Xo(f,t,n,o);l.push(...g)}return{changes:l,updatedInternals:c}}async function Lw({delta:e,panZoom:t,transform:n,translateExtent:r,width:o,height:s}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const i=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[o,s]],r),a=!!i&&(i.x!==n[0]||i.y!==n[1]||i.k!==n[2]);return Promise.resolve(a)}function oi(e,t,n,r,o,s){let i=o;const a=r.get(i)||new Map;r.set(i,a.set(n,t)),i=`${o}-${e}`;const c=r.get(i)||new Map;if(r.set(i,c.set(n,t)),s){i=`${o}-${e}-${s}`;const l=r.get(i)||new Map;r.set(i,l.set(n,t))}}function Wu(e,t,n){e.clear(),t.clear();for(const r of n){const{source:o,target:s,sourceHandle:i=null,targetHandle:a=null}=r,c={edgeId:r.id,source:o,target:s,sourceHandle:i,targetHandle:a},l=`${o}-${i}--${s}-${a}`,d=`${s}-${a}--${o}-${i}`;oi("source",c,d,e,o,i),oi("target",c,l,e,s,a),t.set(r.id,r)}}function Vu(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Vu(n,t):!1}function si(e,t,n){var o;let r=e;do{if((o=r==null?void 0:r.matches)!=null&&o.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function Fw(e,t,n,r){const o=new Map;for(const[s,i]of e)if((i.selected||i.id===r)&&(!i.parentId||!Vu(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){const a=e.get(s);a&&o.set(s,{id:s,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 o}function Or({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var i,a,c;const o=[];for(const[l,d]of t){const u=(i=n.get(l))==null?void 0:i.internals.userNode;u&&o.push({...u,position:d.position,dragging:r})}if(!e)return[o[0],o];const s=(a=n.get(e))==null?void 0:a.internals.userNode;return[s?{...s,position:((c=t.get(e))==null?void 0:c.position)||s.position,dragging:r}:o[0],o]}function zw({dragItems:e,snapGrid:t,x:n,y:r}){const o=e.values().next().value;if(!o)return null;const s={x:n-o.distance.x,y:r-o.distance.y},i=pn(s,t);return{x:i.x-s.x,y:i.y-s.y}}function Hw({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:o}){let s={x:null,y:null},i=0,a=new Map,c=!1,l={x:0,y:0},d=null,u=!1,f=null,g=!1,p=!1,m=null;function v({noDragClassName:E,handleSelector:y,domNode:b,isSelectable:S,nodeId:_,nodeClickDistance:M=0}){f=ye(b);function P({x:D,y:F}){const{nodeLookup:C,nodeExtent:R,snapGrid:k,snapToGrid:j,nodeOrigin:I,onNodeDrag:N,onSelectionDrag:O,onError:$,updateNodePositions:L}=t();s={x:D,y:F};let B=!1;const W=a.size>1,X=W&&R?co(hn(a)):null,U=W&&j?zw({dragItems:a,snapGrid:k,x:D,y:F}):null;for(const[G,H]of a){if(!C.has(G))continue;let V={x:D-H.distance.x,y:F-H.distance.y};j&&(V=U?{x:Math.round(V.x+U.x),y:Math.round(V.y+U.y)}:pn(V,k));let Q=null;if(W&&R&&!H.extent&&X){const{positionAbsolute:q}=H.internals,ee=q.x-X.x+R[0][0],oe=q.x+H.measured.width-X.x2+R[1][0],te=q.y-X.y+R[0][1],ue=q.y+H.measured.height-X.y2+R[1][1];Q=[[ee,te],[oe,ue]]}const{position:Z,positionAbsolute:K}=ku({nodeId:G,nextPosition:V,nodeLookup:C,nodeExtent:Q||R,nodeOrigin:I,onError:$});B=B||H.position.x!==Z.x||H.position.y!==Z.y,H.position=Z,H.internals.positionAbsolute=K}if(p=p||B,!!B&&(L(a,!0),m&&(r||N||!_&&O))){const[G,H]=Or({nodeId:_,dragItems:a,nodeLookup:C});r==null||r(m,a,G,H),N==null||N(m,G,H),_||O==null||O(m,H)}}async function T(){if(!d)return;const{transform:D,panBy:F,autoPanSpeed:C,autoPanOnNodeDrag:R}=t();if(!R){c=!1,cancelAnimationFrame(i);return}const[k,j]=Iu(l,d,C);(k!==0||j!==0)&&(s.x=(s.x??0)-k/D[2],s.y=(s.y??0)-j/D[2],await F({x:k,y:j})&&P(s)),i=requestAnimationFrame(T)}function z(D){var W;const{nodeLookup:F,multiSelectionActive:C,nodesDraggable:R,transform:k,snapGrid:j,snapToGrid:I,selectNodesOnDrag:N,onNodeDragStart:O,onSelectionDragStart:$,unselectNodesAndEdges:L}=t();u=!0,(!N||!S)&&!C&&_&&((W=F.get(_))!=null&&W.selected||L()),S&&N&&_&&(e==null||e(_));const B=Wt(D.sourceEvent,{transform:k,snapGrid:j,snapToGrid:I,containerBounds:d});if(s=B,a=Fw(F,R,B,_),a.size>0&&(n||O||!_&&$)){const[X,U]=Or({nodeId:_,dragItems:a,nodeLookup:F});n==null||n(D.sourceEvent,a,X,U),O==null||O(D.sourceEvent,X,U),_||$==null||$(D.sourceEvent,U)}}const A=au().clickDistance(M).on("start",D=>{const{domNode:F,nodeDragThreshold:C,transform:R,snapGrid:k,snapToGrid:j}=t();d=(F==null?void 0:F.getBoundingClientRect())||null,g=!1,p=!1,m=D.sourceEvent,C===0&&z(D),s=Wt(D.sourceEvent,{transform:R,snapGrid:k,snapToGrid:j,containerBounds:d}),l=ke(D.sourceEvent,d)}).on("drag",D=>{const{autoPanOnNodeDrag:F,transform:C,snapGrid:R,snapToGrid:k,nodeDragThreshold:j,nodeLookup:I}=t(),N=Wt(D.sourceEvent,{transform:C,snapGrid:R,snapToGrid:k,containerBounds:d});if(m=D.sourceEvent,(D.sourceEvent.type==="touchmove"&&D.sourceEvent.touches.length>1||_&&!I.has(_))&&(g=!0),!g){if(!c&&F&&u&&(c=!0,T()),!u){const O=ke(D.sourceEvent,d),$=O.x-l.x,L=O.y-l.y;Math.sqrt($*$+L*L)>j&&z(D)}(s.x!==N.xSnapped||s.y!==N.ySnapped)&&a&&u&&(l=ke(D.sourceEvent,d),P(N))}}).on("end",D=>{if(!(!u||g)&&(c=!1,u=!1,cancelAnimationFrame(i),a.size>0)){const{nodeLookup:F,updateNodePositions:C,onNodeDragStop:R,onSelectionDragStop:k}=t();if(p&&(C(a,!1),p=!1),o||R||!_&&k){const[j,I]=Or({nodeId:_,dragItems:a,nodeLookup:F,dragging:!1});o==null||o(D.sourceEvent,a,j,I),R==null||R(D.sourceEvent,j,I),_||k==null||k(D.sourceEvent,I)}}}).filter(D=>{const F=D.target;return!D.button&&(!E||!si(F,`.${E}`,b))&&(!y||si(F,y,b))});f.call(A)}function w(){f==null||f.on(".drag",null)}return{update:v,destroy:w}}function Bw(e,t,n){const r=[],o={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const s of t.values())en(o,Nt(s))>0&&r.push(s);return r}const Ww=250;function Vw(e,t,n,r){var a,c;let o=[],s=1/0;const i=Bw(e,n,t+Ww);for(const l of i){const d=[...((a=l.internals.handleBounds)==null?void 0:a.source)??[],...((c=l.internals.handleBounds)==null?void 0:c.target)??[]];for(const u of d){if(r.nodeId===u.nodeId&&r.type===u.type&&r.id===u.id)continue;const{x:f,y:g}=at(l,u,u.position,!0),p=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(g-e.y,2));p>t||(p<s?(o=[{...u,x:f,y:g}],s=p):p===s&&o.push({...u,x:f,y:g}))}}if(!o.length)return null;if(o.length>1){const l=r.type==="source"?"target":"source";return o.find(d=>d.type===l)??o[0]}return o[0]}function Yu(e,t,n,r,o,s=!1){var l,d,u;const i=r.get(e);if(!i)return null;const a=o==="strict"?(l=i.internals.handleBounds)==null?void 0:l[t]:[...((d=i.internals.handleBounds)==null?void 0:d.source)??[],...((u=i.internals.handleBounds)==null?void 0:u.target)??[]],c=(n?a==null?void 0:a.find(f=>f.id===n):a==null?void 0:a[0])??null;return c&&s?{...c,...at(i,c,c.position,!0)}:c}function Gu(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Yw(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Xu=()=>!0;function Gw(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:s,isTarget:i,domNode:a,nodeLookup:c,lib:l,autoPanOnConnect:d,flowId:u,panBy:f,cancelConnection:g,onConnectStart:p,onConnect:m,onConnectEnd:v,isValidConnection:w=Xu,onReconnectEnd:E,updateConnection:y,getTransform:b,getFromHandle:S,autoPanSpeed:_,dragThreshold:M=1,handleDomNode:P}){const T=Du(e.target);let z=0,A;const{x:D,y:F}=ke(e),C=Gu(s,P),R=a==null?void 0:a.getBoundingClientRect();let k=!1;if(!R||!C)return;const j=Yu(o,C,r,c,t);if(!j)return;let I=ke(e,R),N=!1,O=null,$=!1,L=null;function B(){if(!d||!R)return;const[Z,K]=Iu(I,R,_);f({x:Z,y:K}),z=requestAnimationFrame(B)}const W={...j,nodeId:o,type:C,position:j.position},X=c.get(o);let G={inProgress:!0,isValid:null,from:at(X,W,Y.Left,!0),fromHandle:W,fromPosition:W.position,fromNode:X,to:I,toHandle:null,toPosition:Xs[W.position],toNode:null,pointer:I};function H(){k=!0,y(G),p==null||p(e,{nodeId:o,handleId:r,handleType:C})}M===0&&H();function V(Z){if(!k){const{x:ue,y:Ae}=ke(Z),pe=ue-D,Ke=Ae-F;if(!(pe*pe+Ke*Ke>M*M))return;H()}if(!S()||!W){Q(Z);return}const K=b();I=ke(Z,R),A=Vw(gn(I,K,!1,[1,1]),n,c,W),N||(B(),N=!0);const q=Uu(Z,{handle:A,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:i?"target":"source",isValidConnection:w,doc:T,lib:l,flowId:u,nodeLookup:c});L=q.handleDomNode,O=q.connection,$=Yw(!!A,q.isValid);const ee=c.get(o),oe=ee?at(ee,W,Y.Left,!0):G.from,te={...G,from:oe,isValid:$,to:q.toHandle&&$?tr({x:q.toHandle.x,y:q.toHandle.y},K):I,toHandle:q.toHandle,toPosition:$&&q.toHandle?q.toHandle.position:Xs[W.position],toNode:q.toHandle?c.get(q.toHandle.nodeId):null,pointer:I};y(te),G=te}function Q(Z){if(!("touches"in Z&&Z.touches.length>0)){if(k){(A||L)&&O&&$&&(m==null||m(O));const{inProgress:K,...q}=G,ee={...q,toPosition:G.toHandle?G.toPosition:null};v==null||v(Z,ee),s&&(E==null||E(Z,ee))}g(),cancelAnimationFrame(z),N=!1,$=!1,O=null,L=null,T.removeEventListener("mousemove",V),T.removeEventListener("mouseup",Q),T.removeEventListener("touchmove",V),T.removeEventListener("touchend",Q)}}T.addEventListener("mousemove",V),T.addEventListener("mouseup",Q),T.addEventListener("touchmove",V),T.addEventListener("touchend",Q)}function Uu(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:s,doc:i,lib:a,flowId:c,isValidConnection:l=Xu,nodeLookup:d}){const u=s==="target",f=t?i.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:g,y:p}=ke(e),m=i.elementFromPoint(g,p),v=m!=null&&m.classList.contains(`${a}-flow__handle`)?m:f,w={handleDomNode:v,isValid:!1,connection:null,toHandle:null};if(v){const E=Gu(void 0,v),y=v.getAttribute("data-nodeid"),b=v.getAttribute("data-handleid"),S=v.classList.contains("connectable"),_=v.classList.contains("connectableend");if(!y||!E)return w;const M={source:u?y:r,sourceHandle:u?b:o,target:u?r:y,targetHandle:u?o:b};w.connection=M;const T=S&&_&&(n===St.Strict?u&&E==="source"||!u&&E==="target":y!==r||b!==o);w.isValid=T&&l(M),w.toHandle=Yu(y,E,b,d,n,!0)}return w}const ho={onPointerDown:Gw,isValid:Uu};function Xw({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const o=ye(e);function s({translateExtent:a,width:c,height:l,zoomStep:d=1,pannable:u=!0,zoomable:f=!0,inversePan:g=!1}){const p=y=>{if(y.sourceEvent.type!=="wheel"||!t)return;const b=n(),S=y.sourceEvent.ctrlKey&&tn()?10:1,_=-y.sourceEvent.deltaY*(y.sourceEvent.deltaMode===1?.05:y.sourceEvent.deltaMode?1:.002)*d,M=b[2]*Math.pow(2,_*S);t.scaleTo(M)};let m=[0,0];const v=y=>{(y.sourceEvent.type==="mousedown"||y.sourceEvent.type==="touchstart")&&(m=[y.sourceEvent.clientX??y.sourceEvent.touches[0].clientX,y.sourceEvent.clientY??y.sourceEvent.touches[0].clientY])},w=y=>{const b=n();if(y.sourceEvent.type!=="mousemove"&&y.sourceEvent.type!=="touchmove"||!t)return;const S=[y.sourceEvent.clientX??y.sourceEvent.touches[0].clientX,y.sourceEvent.clientY??y.sourceEvent.touches[0].clientY],_=[S[0]-m[0],S[1]-m[1]];m=S;const M=r()*Math.max(b[2],Math.log(b[2]))*(g?-1:1),P={x:b[0]-_[0]*M,y:b[1]-_[1]*M},T=[[0,0],[c,l]];t.setViewportConstrained({x:P.x,y:P.y,zoom:b[2]},T,a)},E=Eu().on("start",v).on("zoom",u?w:null).on("zoom.wheel",f?p:null);o.call(E,{})}function i(){o.on("zoom",null)}return{update:s,destroy:i,pointer:Ee}}const gr=e=>({x:e.x,y:e.y,zoom:e.k}),$r=({x:e,y:t,zoom:n})=>fr.translate(e,t).scale(n),mt=(e,t)=>e.target.closest(`.${t}`),qu=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Uw=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Lr=(e,t=0,n=Uw,r=()=>{})=>{const o=typeof t=="number"&&t>0;return o||r(),o?e.transition().duration(t).ease(n).on("end",r):e},Ku=e=>{const t=e.ctrlKey&&tn()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function qw({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:s,zoomOnPinch:i,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:l}){return d=>{if(mt(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(d.ctrlKey&&i){const v=Ee(d),w=Ku(d),E=u*Math.pow(2,w);r.scaleTo(n,E,v,d);return}const f=d.deltaMode===1?20:1;let g=o===nt.Vertical?0:d.deltaX*f,p=o===nt.Horizontal?0:d.deltaY*f;!tn()&&d.shiftKey&&o!==nt.Vertical&&(g=d.deltaY*f,p=0),r.translateBy(n,-(g/u)*s,-(p/u)*s,{internal:!0});const m=gr(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,m),e.panScrollTimeout=setTimeout(()=>{l==null||l(d,m),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a==null||a(d,m))}}function Kw({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,o){const s=r.type==="wheel",i=!t&&s&&!r.ctrlKey,a=mt(r,e);if(r.ctrlKey&&s&&a&&r.preventDefault(),i||a)return null;r.preventDefault(),n.call(this,r,o)}}function Zw({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var s,i,a;if((s=r.sourceEvent)!=null&&s.internal)return;const o=gr(r.transform);e.mouseButton=((i=r.sourceEvent)==null?void 0:i.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=o,((a=r.sourceEvent)==null?void 0:a.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,o))}}function Qw({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return s=>{var i,a;e.usedRightMouseButton=!!(n&&qu(t,e.mouseButton??0)),(i=s.sourceEvent)!=null&&i.sync||r([s.transform.x,s.transform.y,s.transform.k]),o&&!((a=s.sourceEvent)!=null&&a.internal)&&(o==null||o(s.sourceEvent,gr(s.transform)))}}function Jw({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:o,onPaneContextMenu:s}){return i=>{var a;if(!((a=i.sourceEvent)!=null&&a.internal)&&(e.isZoomingOrPanning=!1,s&&qu(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&s(i.sourceEvent),e.usedRightMouseButton=!1,r(!1),o)){const c=gr(i.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o==null||o(i.sourceEvent,c)},n?150:0)}}}function eb({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:o,zoomOnDoubleClick:s,userSelectionActive:i,noWheelClassName:a,noPanClassName:c,lib:l,connectionInProgress:d}){return u=>{var v;const f=e||t,g=n&&u.ctrlKey,p=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(mt(u,`${l}-flow__node`)||mt(u,`${l}-flow__edge`)))return!0;if(!r&&!f&&!o&&!s&&!n||i||d&&!p||mt(u,a)&&p||mt(u,c)&&(!p||o&&p&&!e)||!n&&u.ctrlKey&&p)return!1;if(!n&&u.type==="touchstart"&&((v=u.touches)==null?void 0:v.length)>1)return u.preventDefault(),!1;if(!f&&!o&&!g&&p||!r&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(r)&&!r.includes(u.button)&&u.type==="mousedown")return!1;const m=Array.isArray(r)&&r.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||p)&&m}}function tb({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:o,onPanZoom:s,onPanZoomStart:i,onPanZoomEnd:a,onDraggingChange:c}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),u=Eu().scaleExtent([t,n]).translateExtent(r),f=ye(e).call(u);E({x:o.x,y:o.y,zoom:_t(o.zoom,t,n)},[[0,0],[d.width,d.height]],r);const g=f.on("wheel.zoom"),p=f.on("dblclick.zoom");u.wheelDelta(Ku);function m(A,D){return f?new Promise(F=>{u==null||u.interpolate((D==null?void 0:D.interpolate)==="linear"?Bt:Ln).transform(Lr(f,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>F(!0)),A)}):Promise.resolve(!1)}function v({noWheelClassName:A,noPanClassName:D,onPaneContextMenu:F,userSelectionActive:C,panOnScroll:R,panOnDrag:k,panOnScrollMode:j,panOnScrollSpeed:I,preventScrolling:N,zoomOnPinch:O,zoomOnScroll:$,zoomOnDoubleClick:L,zoomActivationKeyPressed:B,lib:W,onTransformChange:X,connectionInProgress:U,paneClickDistance:G,selectionOnDrag:H}){C&&!l.isZoomingOrPanning&&w();const V=R&&!B&&!C;u.clickDistance(H?1/0:!Me(G)||G<0?0:G);const Q=V?qw({zoomPanValues:l,noWheelClassName:A,d3Selection:f,d3Zoom:u,panOnScrollMode:j,panOnScrollSpeed:I,zoomOnPinch:O,onPanZoomStart:i,onPanZoom:s,onPanZoomEnd:a}):Kw({noWheelClassName:A,preventScrolling:N,d3ZoomHandler:g});if(f.on("wheel.zoom",Q,{passive:!1}),!C){const K=Zw({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:i});u.on("start",K);const q=Qw({zoomPanValues:l,panOnDrag:k,onPaneContextMenu:!!F,onPanZoom:s,onTransformChange:X});u.on("zoom",q);const ee=Jw({zoomPanValues:l,panOnDrag:k,panOnScroll:R,onPaneContextMenu:F,onPanZoomEnd:a,onDraggingChange:c});u.on("end",ee)}const Z=eb({zoomActivationKeyPressed:B,panOnDrag:k,zoomOnScroll:$,panOnScroll:R,zoomOnDoubleClick:L,zoomOnPinch:O,userSelectionActive:C,noPanClassName:D,noWheelClassName:A,lib:W,connectionInProgress:U});u.filter(Z),L?f.on("dblclick.zoom",p):f.on("dblclick.zoom",null)}function w(){u.on("zoom",null)}async function E(A,D,F){const C=$r(A),R=u==null?void 0:u.constrain()(C,D,F);return R&&await m(R),new Promise(k=>k(R))}async function y(A,D){const F=$r(A);return await m(F,D),new Promise(C=>C(F))}function b(A){if(f){const D=$r(A),F=f.property("__zoom");(F.k!==A.zoom||F.x!==A.x||F.y!==A.y)&&(u==null||u.transform(f,D,null,{sync:!0}))}}function S(){const A=f?bu(f.node()):{x:0,y:0,k:1};return{x:A.x,y:A.y,zoom:A.k}}function _(A,D){return f?new Promise(F=>{u==null||u.interpolate((D==null?void 0:D.interpolate)==="linear"?Bt:Ln).scaleTo(Lr(f,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>F(!0)),A)}):Promise.resolve(!1)}function M(A,D){return f?new Promise(F=>{u==null||u.interpolate((D==null?void 0:D.interpolate)==="linear"?Bt:Ln).scaleBy(Lr(f,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>F(!0)),A)}):Promise.resolve(!1)}function P(A){u==null||u.scaleExtent(A)}function T(A){u==null||u.translateExtent(A)}function z(A){const D=!Me(A)||A<0?0:A;u==null||u.clickDistance(D)}return{update:v,destroy:w,setViewport:y,setViewportConstrained:E,getViewport:S,scaleTo:_,scaleBy:M,setScaleExtent:P,setTranslateExtent:T,syncViewport:b,setClickDistance:z}}var kt;(function(e){e.Line="line",e.Handle="handle"})(kt||(kt={}));function nb({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:o,affectsY:s}){const i=e-t,a=n-r,c=[i>0?1:i<0?-1:0,a>0?1:a<0?-1:0];return i&&o&&(c[0]=c[0]*-1),a&&s&&(c[1]=c[1]*-1),c}function ii(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),o=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:o}}function Ye(e,t){return Math.max(0,t-e)}function Ge(e,t){return Math.max(0,e-t)}function An(e,t,n){return Math.max(0,t-e,e-n)}function ai(e,t){return e?!t:t}function rb(e,t,n,r,o,s,i,a){let{affectsX:c,affectsY:l}=t;const{isHorizontal:d,isVertical:u}=t,f=d&&u,{xSnapped:g,ySnapped:p}=n,{minWidth:m,maxWidth:v,minHeight:w,maxHeight:E}=r,{x:y,y:b,width:S,height:_,aspectRatio:M}=e;let P=Math.floor(d?g-e.pointerX:0),T=Math.floor(u?p-e.pointerY:0);const z=S+(c?-P:P),A=_+(l?-T:T),D=-s[0]*S,F=-s[1]*_;let C=An(z,m,v),R=An(A,w,E);if(i){let I=0,N=0;c&&P<0?I=Ye(y+P+D,i[0][0]):!c&&P>0&&(I=Ge(y+z+D,i[1][0])),l&&T<0?N=Ye(b+T+F,i[0][1]):!l&&T>0&&(N=Ge(b+A+F,i[1][1])),C=Math.max(C,I),R=Math.max(R,N)}if(a){let I=0,N=0;c&&P>0?I=Ge(y+P,a[0][0]):!c&&P<0&&(I=Ye(y+z,a[1][0])),l&&T>0?N=Ge(b+T,a[0][1]):!l&&T<0&&(N=Ye(b+A,a[1][1])),C=Math.max(C,I),R=Math.max(R,N)}if(o){if(d){const I=An(z/M,w,E)*M;if(C=Math.max(C,I),i){let N=0;!c&&!l||c&&!l&&f?N=Ge(b+F+z/M,i[1][1])*M:N=Ye(b+F+(c?P:-P)/M,i[0][1])*M,C=Math.max(C,N)}if(a){let N=0;!c&&!l||c&&!l&&f?N=Ye(b+z/M,a[1][1])*M:N=Ge(b+(c?P:-P)/M,a[0][1])*M,C=Math.max(C,N)}}if(u){const I=An(A*M,m,v)/M;if(R=Math.max(R,I),i){let N=0;!c&&!l||l&&!c&&f?N=Ge(y+A*M+D,i[1][0])/M:N=Ye(y+(l?T:-T)*M+D,i[0][0])/M,R=Math.max(R,N)}if(a){let N=0;!c&&!l||l&&!c&&f?N=Ye(y+A*M,a[1][0])/M:N=Ge(y+(l?T:-T)*M,a[0][0])/M,R=Math.max(R,N)}}}T=T+(T<0?R:-R),P=P+(P<0?C:-C),o&&(f?z>A*M?T=(ai(c,l)?-P:P)/M:P=(ai(c,l)?-T:T)*M:d?(T=P/M,l=c):(P=T*M,c=l));const k=c?y+P:y,j=l?b+T:b;return{width:S+(c?-P:P),height:_+(l?-T:T),x:s[0]*P*(c?-1:1)+k,y:s[1]*T*(l?-1:1)+j}}const Zu={width:0,height:0,x:0,y:0},ob={...Zu,pointerX:0,pointerY:0,aspectRatio:1};function sb(e){return[[0,0],[e.measured.width,e.measured.height]]}function ib(e,t,n){const r=t.position.x+e.position.x,o=t.position.y+e.position.y,s=e.measured.width??0,i=e.measured.height??0,a=n[0]*s,c=n[1]*i;return[[r-a,o-c],[r+s-a,o+i-c]]}function ab({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){const s=ye(e);let i={controlDirection:ii("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:l,boundaries:d,keepAspectRatio:u,resizeDirection:f,onResizeStart:g,onResize:p,onResizeEnd:m,shouldResize:v}){let w={...Zu},E={...ob};i={boundaries:d,resizeDirection:f,keepAspectRatio:u,controlDirection:ii(l)};let y,b=null,S=[],_,M,P,T=!1;const z=au().on("start",A=>{const{nodeLookup:D,transform:F,snapGrid:C,snapToGrid:R,nodeOrigin:k,paneDomNode:j}=n();if(y=D.get(t),!y)return;b=(j==null?void 0:j.getBoundingClientRect())??null;const{xSnapped:I,ySnapped:N}=Wt(A.sourceEvent,{transform:F,snapGrid:C,snapToGrid:R,containerBounds:b});w={width:y.measured.width??0,height:y.measured.height??0,x:y.position.x??0,y:y.position.y??0},E={...w,pointerX:I,pointerY:N,aspectRatio:w.width/w.height},_=void 0,y.parentId&&(y.extent==="parent"||y.expandParent)&&(_=D.get(y.parentId),M=_&&y.extent==="parent"?sb(_):void 0),S=[],P=void 0;for(const[O,$]of D)if($.parentId===t&&(S.push({id:O,position:{...$.position},extent:$.extent}),$.extent==="parent"||$.expandParent)){const L=ib($,y,$.origin??k);P?P=[[Math.min(L[0][0],P[0][0]),Math.min(L[0][1],P[0][1])],[Math.max(L[1][0],P[1][0]),Math.max(L[1][1],P[1][1])]]:P=L}g==null||g(A,{...w})}).on("drag",A=>{const{transform:D,snapGrid:F,snapToGrid:C,nodeOrigin:R}=n(),k=Wt(A.sourceEvent,{transform:D,snapGrid:F,snapToGrid:C,containerBounds:b}),j=[];if(!y)return;const{x:I,y:N,width:O,height:$}=w,L={},B=y.origin??R,{width:W,height:X,x:U,y:G}=rb(E,i.controlDirection,k,i.boundaries,i.keepAspectRatio,B,M,P),H=W!==O,V=X!==$,Q=U!==I&&H,Z=G!==N&&V;if(!Q&&!Z&&!H&&!V)return;if((Q||Z||B[0]===1||B[1]===1)&&(L.x=Q?U:w.x,L.y=Z?G:w.y,w.x=L.x,w.y=L.y,S.length>0)){const oe=U-I,te=G-N;for(const ue of S)ue.position={x:ue.position.x-oe+B[0]*(W-O),y:ue.position.y-te+B[1]*(X-$)},j.push(ue)}if((H||V)&&(L.width=H&&(!i.resizeDirection||i.resizeDirection==="horizontal")?W:w.width,L.height=V&&(!i.resizeDirection||i.resizeDirection==="vertical")?X:w.height,w.width=L.width,w.height=L.height),_&&y.expandParent){const oe=B[0]*(L.width??0);L.x&&L.x<oe&&(w.x=oe,E.x=E.x-(L.x-oe));const te=B[1]*(L.height??0);L.y&&L.y<te&&(w.y=te,E.y=E.y-(L.y-te))}const K=nb({width:w.width,prevWidth:O,height:w.height,prevHeight:$,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),q={...w,direction:K};(v==null?void 0:v(A,q))!==!1&&(T=!0,p==null||p(A,q),r(L,j))}).on("end",A=>{T&&(m==null||m(A,{...w}),o==null||o({...w}),T=!1)});s.call(z)}function c(){s.on(".drag",null)}return{update:a,destroy:c}}var Fr={exports:{}},zr={},Hr={exports:{}},Br={};/**
|
|
135
|
-
* @license React
|
|
136
|
-
* use-sync-external-store-shim.production.js
|
|
137
|
-
*
|
|
138
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
139
|
-
*
|
|
140
|
-
* This source code is licensed under the MIT license found in the
|
|
141
|
-
* LICENSE file in the root directory of this source tree.
|
|
142
|
-
*/var ci;function cb(){if(ci)return Br;ci=1;var e=Hi();function t(u,f){return u===f&&(u!==0||1/u===1/f)||u!==u&&f!==f}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function a(u,f){var g=f(),p=r({inst:{value:g,getSnapshot:f}}),m=p[0].inst,v=p[1];return s(function(){m.value=g,m.getSnapshot=f,c(m)&&v({inst:m})},[u,g,f]),o(function(){return c(m)&&v({inst:m}),u(function(){c(m)&&v({inst:m})})},[u]),i(g),g}function c(u){var f=u.getSnapshot;u=u.value;try{var g=f();return!n(u,g)}catch{return!0}}function l(u,f){return f()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:a;return Br.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,Br}var ui;function ub(){return ui||(ui=1,Hr.exports=cb()),Hr.exports}/**
|
|
143
|
-
* @license React
|
|
144
|
-
* use-sync-external-store-shim/with-selector.production.js
|
|
145
|
-
*
|
|
146
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
147
|
-
*
|
|
148
|
-
* This source code is licensed under the MIT license found in the
|
|
149
|
-
* LICENSE file in the root directory of this source tree.
|
|
150
|
-
*/var li;function lb(){if(li)return zr;li=1;var e=Hi(),t=ub();function n(l,d){return l===d&&(l!==0||1/l===1/d)||l!==l&&d!==d}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,s=e.useRef,i=e.useEffect,a=e.useMemo,c=e.useDebugValue;return zr.useSyncExternalStoreWithSelector=function(l,d,u,f,g){var p=s(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=a(function(){function w(_){if(!E){if(E=!0,y=_,_=f(_),g!==void 0&&m.hasValue){var M=m.value;if(g(M,_))return b=M}return b=_}if(M=b,r(y,_))return M;var P=f(_);return g!==void 0&&g(M,P)?(y=_,M):(y=_,b=P)}var E=!1,y,b,S=u===void 0?null:u;return[function(){return w(d())},S===null?void 0:function(){return w(S())}]},[d,u,f,g]);var v=o(l,p[0],p[1]);return i(function(){m.hasValue=!0,m.value=v},[v]),c(v),v},zr}var di;function db(){return di||(di=1,Fr.exports=lb()),Fr.exports}var fb=db();const hb=af(fb),pb={},fi=e=>{let t;const n=new Set,r=(d,u)=>{const f=typeof d=="function"?d(t):d;if(!Object.is(f,t)){const g=t;t=u??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(p=>p(t,g))}},o=()=>t,c={setState:r,getState:o,getInitialState:()=>l,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(pb?"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,o,c);return c},gb=e=>e?fi(e):fi,{useDebugValue:mb}=de,{useSyncExternalStoreWithSelector:yb}=hb,xb=e=>e;function Qu(e,t=xb,n){const r=yb(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return mb(r),r}const hi=(e,t)=>{const n=gb(e),r=(o,s=t)=>Qu(n,o,s);return Object.assign(r,n),r},vb=(e,t)=>e?hi(e,t):hi;function se(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,o]of e)if(!Object.is(o,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 mr=x.createContext(null),wb=mr.Provider,Ju=Oe.error001();function J(e,t){const n=x.useContext(mr);if(n===null)throw new Error(Ju);return Qu(n,e,t)}function ie(){const e=x.useContext(mr);if(e===null)throw new Error(Ju);return x.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const pi={display:"none"},bb={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},el="react-flow__node-desc",tl="react-flow__edge-desc",Eb="react-flow__aria-live",Sb=e=>e.ariaLiveMessage,Cb=e=>e.ariaLabelConfig;function _b({rfId:e}){const t=J(Sb);return h.jsx("div",{id:`${Eb}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:bb,children:t})}function Nb({rfId:e,disableKeyboardA11y:t}){const n=J(Cb);return h.jsxs(h.Fragment,{children:[h.jsx("div",{id:`${el}-${e}`,style:pi,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),h.jsx("div",{id:`${tl}-${e}`,style:pi,children:n["edge.a11yDescription.default"]}),!t&&h.jsx(_b,{rfId:e})]})}const mn=x.forwardRef(({position:e="top-left",children:t,className:n,style:r,...o},s)=>{const i=`${e}`.split("-");return h.jsx("div",{className:ce(["react-flow__panel",n,...i]),style:r,ref:s,...o,children:t})});mn.displayName="Panel";function Mb({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:h.jsx(mn,{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 kb=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}},Rn=e=>e.id;function Pb(e,t){return se(e.selectedNodes.map(Rn),t.selectedNodes.map(Rn))&&se(e.selectedEdges.map(Rn),t.selectedEdges.map(Rn))}function Ib({onSelectionChange:e}){const t=ie(),{selectedNodes:n,selectedEdges:r}=J(kb,Pb);return x.useEffect(()=>{const o={nodes:n,edges:r};e==null||e(o),t.getState().onSelectionChangeHandlers.forEach(s=>s(o))},[n,r,e]),null}const Ab=e=>!!e.onSelectionChangeHandlers;function Rb({onSelectionChange:e}){const t=J(Ab);return e||t?h.jsx(Ib,{onSelectionChange:e}):null}const nl=[0,0],Tb={x:0,y:0,zoom:1},Db=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","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","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],gi=[...Db,"rfId"],jb=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}),mi={translateExtent:Qt,nodeOrigin:nl,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Ob(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:o,setTranslateExtent:s,setNodeExtent:i,reset:a,setDefaultNodesAndEdges:c}=J(jb,se),l=ie();x.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=mi,a()}),[]);const d=x.useRef(mi);return x.useEffect(()=>{for(const u of gi){const f=e[u],g=d.current[u];f!==g&&(typeof e[u]>"u"||(u==="nodes"?t(f):u==="edges"?n(f):u==="minZoom"?r(f):u==="maxZoom"?o(f):u==="translateExtent"?s(f):u==="nodeExtent"?i(f):u==="ariaLabelConfig"?l.setState({ariaLabelConfig:vw(f)}):u==="fitView"?l.setState({fitViewQueued:f}):u==="fitViewOptions"?l.setState({fitViewOptions:f}):l.setState({[u]:f})))}d.current=e},gi.map(u=>e[u])),null}function yi(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function $b(e){var r;const[t,n]=x.useState(e==="system"?null:e);return x.useEffect(()=>{if(e!=="system"){n(e);return}const o=yi(),s=()=>n(o!=null&&o.matches?"dark":"light");return s(),o==null||o.addEventListener("change",s),()=>{o==null||o.removeEventListener("change",s)}},[e]),t!==null?t:(r=yi())!=null&&r.matches?"dark":"light"}const xi=typeof document<"u"?document:null;function nn(e=null,t={target:xi,actInsideInputWithModifier:!0}){const[n,r]=x.useState(!1),o=x.useRef(!1),s=x.useRef(new Set([])),[i,a]=x.useMemo(()=>{if(e!==null){const l=(Array.isArray(e)?e:[e]).filter(u=>typeof u=="string").map(u=>u.replace("+",`
|
|
151
|
-
`).replace(`
|
|
152
|
-
|
|
153
|
-
`,`
|
|
154
|
-
+`).split(`
|
|
155
|
-
`)),d=l.reduce((u,f)=>u.concat(...f),[]);return[l,d]}return[[],[]]},[e]);return x.useEffect(()=>{const c=(t==null?void 0:t.target)??xi,l=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=g=>{var v,w;if(o.current=g.ctrlKey||g.metaKey||g.shiftKey||g.altKey,(!o.current||o.current&&!l)&&ju(g))return!1;const m=wi(g.code,a);if(s.current.add(g[m]),vi(i,s.current,!1)){const E=((w=(v=g.composedPath)==null?void 0:v.call(g))==null?void 0:w[0])||g.target,y=(E==null?void 0:E.nodeName)==="BUTTON"||(E==null?void 0:E.nodeName)==="A";t.preventDefault!==!1&&(o.current||!y)&&g.preventDefault(),r(!0)}},u=g=>{const p=wi(g.code,a);vi(i,s.current,!0)?(r(!1),s.current.clear()):s.current.delete(g[p]),g.key==="Meta"&&s.current.clear(),o.current=!1},f=()=>{s.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",d),c==null||c.addEventListener("keyup",u),window.addEventListener("blur",f),window.addEventListener("contextmenu",f),()=>{c==null||c.removeEventListener("keydown",d),c==null||c.removeEventListener("keyup",u),window.removeEventListener("blur",f),window.removeEventListener("contextmenu",f)}}},[e,r]),n}function vi(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(o=>t.has(o)))}function wi(e,t){return t.includes(e)?"code":"key"}const Lb=()=>{const e=ie();return x.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,o,s],panZoom:i}=e.getState();return i?(await i.setViewport({x:t.x??r,y:t.y??o,zoom:t.zoom??s},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:o,minZoom:s,maxZoom:i,panZoom:a}=e.getState(),c=Ho(t,r,o,s,i,(n==null?void 0:n.padding)??.1);return a?(await a.setViewport(c,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:o,snapToGrid:s,domNode:i}=e.getState();if(!i)return t;const{x:a,y:c}=i.getBoundingClientRect(),l={x:t.x-a,y:t.y-c},d=n.snapGrid??o,u=n.snapToGrid??s;return gn(l,r,u,d)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:o,y:s}=r.getBoundingClientRect(),i=tr(t,n);return{x:i.x+o,y:i.y+s}}}),[])};function rl(e,t){const n=[],r=new Map,o=[];for(const s of e)if(s.type==="add"){o.push(s);continue}else if(s.type==="remove"||s.type==="replace")r.set(s.id,[s]);else{const i=r.get(s.id);i?i.push(s):r.set(s.id,[s])}for(const s of t){const i=r.get(s.id);if(!i){n.push(s);continue}if(i[0].type==="remove")continue;if(i[0].type==="replace"){n.push({...i[0].item});continue}const a={...s};for(const c of i)Fb(c,a);n.push(a)}return o.length&&o.forEach(s=>{s.index!==void 0?n.splice(s.index,0,{...s.item}):n.push({...s.item})}),n}function Fb(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={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function ol(e,t){return rl(e,t)}function sl(e,t){return rl(e,t)}function Qe(e,t){return{id:e,type:"select",selected:t}}function yt(e,t=new Set,n=!1){const r=[];for(const[o,s]of e){const i=t.has(o);!(s.selected===void 0&&!i)&&s.selected!==i&&(n&&(s.selected=i),r.push(Qe(s.id,i)))}return r}function bi({items:e=[],lookup:t}){var o;const n=[],r=new Map(e.map(s=>[s.id,s]));for(const[s,i]of e.entries()){const a=t.get(i.id),c=((o=a==null?void 0:a.internals)==null?void 0:o.userNode)??a;c!==void 0&&c!==i&&n.push({id:i.id,item:i,type:"replace"}),c===void 0&&n.push({item:i,type:"add",index:s})}for(const[s]of t)r.get(s)===void 0&&n.push({id:s,type:"remove"});return n}function Ei(e){return{id:e.id,type:"remove"}}const Si=e=>uw(e),zb=e=>Mu(e);function il(e){return x.forwardRef(e)}const Hb=typeof window<"u"?x.useLayoutEffect:x.useEffect;function Ci(e){const[t,n]=x.useState(BigInt(0)),[r]=x.useState(()=>Bb(()=>n(o=>o+BigInt(1))));return Hb(()=>{const o=r.get();o.length&&(e(o),r.reset())},[t]),r}function Bb(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const al=x.createContext(null);function Wb({children:e}){const t=ie(),n=x.useCallback(a=>{const{nodes:c=[],setNodes:l,hasDefaultNodes:d,onNodesChange:u,nodeLookup:f,fitViewQueued:g,onNodesChangeMiddlewareMap:p}=t.getState();let m=c;for(const w of a)m=typeof w=="function"?w(m):w;let v=bi({items:m,lookup:f});for(const w of p.values())v=w(v);d&&l(m),v.length>0?u==null||u(v):g&&window.requestAnimationFrame(()=>{const{fitViewQueued:w,nodes:E,setNodes:y}=t.getState();w&&y(E)})},[]),r=Ci(n),o=x.useCallback(a=>{const{edges:c=[],setEdges:l,hasDefaultEdges:d,onEdgesChange:u,edgeLookup:f}=t.getState();let g=c;for(const p of a)g=typeof p=="function"?p(g):p;d?l(g):u&&u(bi({items:g,lookup:f}))},[]),s=Ci(o),i=x.useMemo(()=>({nodeQueue:r,edgeQueue:s}),[]);return h.jsx(al.Provider,{value:i,children:e})}function Vb(){const e=x.useContext(al);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Yb=e=>!!e.panZoom;function Uo(){const e=Lb(),t=ie(),n=Vb(),r=J(Yb),o=x.useMemo(()=>{const s=u=>t.getState().nodeLookup.get(u),i=u=>{n.nodeQueue.push(u)},a=u=>{n.edgeQueue.push(u)},c=u=>{var w,E;const{nodeLookup:f,nodeOrigin:g}=t.getState(),p=Si(u)?u:f.get(u.id),m=p.parentId?Tu(p.position,p.measured,p.parentId,f,g):p.position,v={...p,position:m,width:((w=p.measured)==null?void 0:w.width)??p.width,height:((E=p.measured)==null?void 0:E.height)??p.height};return Nt(v)},l=(u,f,g={replace:!1})=>{i(p=>p.map(m=>{if(m.id===u){const v=typeof f=="function"?f(m):f;return g.replace&&Si(v)?v:{...m,...v}}return m}))},d=(u,f,g={replace:!1})=>{a(p=>p.map(m=>{if(m.id===u){const v=typeof f=="function"?f(m):f;return g.replace&&zb(v)?v:{...m,...v}}return m}))};return{getNodes:()=>t.getState().nodes.map(u=>({...u})),getNode:u=>{var f;return(f=s(u))==null?void 0:f.internals.userNode},getInternalNode:s,getEdges:()=>{const{edges:u=[]}=t.getState();return u.map(f=>({...f}))},getEdge:u=>t.getState().edgeLookup.get(u),setNodes:i,setEdges:a,addNodes:u=>{const f=Array.isArray(u)?u:[u];n.nodeQueue.push(g=>[...g,...f])},addEdges:u=>{const f=Array.isArray(u)?u:[u];n.edgeQueue.push(g=>[...g,...f])},toObject:()=>{const{nodes:u=[],edges:f=[],transform:g}=t.getState(),[p,m,v]=g;return{nodes:u.map(w=>({...w})),edges:f.map(w=>({...w})),viewport:{x:p,y:m,zoom:v}}},deleteElements:async({nodes:u=[],edges:f=[]})=>{const{nodes:g,edges:p,onNodesDelete:m,onEdgesDelete:v,triggerNodeChanges:w,triggerEdgeChanges:E,onDelete:y,onBeforeDelete:b}=t.getState(),{nodes:S,edges:_}=await pw({nodesToRemove:u,edgesToRemove:f,nodes:g,edges:p,onBeforeDelete:b}),M=_.length>0,P=S.length>0;if(M){const T=_.map(Ei);v==null||v(_),E(T)}if(P){const T=S.map(Ei);m==null||m(S),w(T)}return(P||M)&&(y==null||y({nodes:S,edges:_})),{deletedNodes:S,deletedEdges:_}},getIntersectingNodes:(u,f=!0,g)=>{const p=qs(u),m=p?u:c(u),v=g!==void 0;return m?(g||t.getState().nodes).filter(w=>{const E=t.getState().nodeLookup.get(w.id);if(E&&!p&&(w.id===u.id||!E.internals.positionAbsolute))return!1;const y=Nt(v?w:E),b=en(y,m);return f&&b>0||b>=y.width*y.height||b>=m.width*m.height}):[]},isNodeIntersecting:(u,f,g=!0)=>{const m=qs(u)?u:c(u);if(!m)return!1;const v=en(m,f);return g&&v>0||v>=f.width*f.height||v>=m.width*m.height},updateNode:l,updateNodeData:(u,f,g={replace:!1})=>{l(u,p=>{const m=typeof f=="function"?f(p):f;return g.replace?{...p,data:m}:{...p,data:{...p.data,...m}}},g)},updateEdge:d,updateEdgeData:(u,f,g={replace:!1})=>{d(u,p=>{const m=typeof f=="function"?f(p):f;return g.replace?{...p,data:m}:{...p,data:{...p.data,...m}}},g)},getNodesBounds:u=>{const{nodeLookup:f,nodeOrigin:g}=t.getState();return lw(u,{nodeLookup:f,nodeOrigin:g})},getHandleConnections:({type:u,id:f,nodeId:g})=>{var p;return Array.from(((p=t.getState().connectionLookup.get(`${g}-${u}${f?`-${f}`:""}`))==null?void 0:p.values())??[])},getNodeConnections:({type:u,handleId:f,nodeId:g})=>{var p;return Array.from(((p=t.getState().connectionLookup.get(`${g}${u?f?`-${u}-${f}`:`-${u}`:""}`))==null?void 0:p.values())??[])},fitView:async u=>{const f=t.getState().fitViewResolver??xw();return t.setState({fitViewQueued:!0,fitViewOptions:u,fitViewResolver:f}),n.nodeQueue.push(g=>[...g]),f.promise}}},[]);return x.useMemo(()=>({...o,...e,viewportInitialized:r}),[r])}const _i=e=>e.selected,Gb=typeof window<"u"?window:void 0;function Xb({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=ie(),{deleteElements:r}=Uo(),o=nn(e,{actInsideInputWithModifier:!1}),s=nn(t,{target:Gb});x.useEffect(()=>{if(o){const{edges:i,nodes:a}=n.getState();r({nodes:a.filter(_i),edges:i.filter(_i)}),n.setState({nodesSelectionActive:!1})}},[o]),x.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])}function Ub(e){const t=ie();x.useEffect(()=>{const n=()=>{var o,s,i,a;if(!e.current||!(((s=(o=e.current).checkVisibility)==null?void 0:s.call(o))??!0))return!1;const r=Bo(e.current);(r.height===0||r.width===0)&&((a=(i=t.getState()).onError)==null||a.call(i,"004",Oe.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 yr={position:"absolute",width:"100%",height:"100%",top:0,left:0},qb=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Kb({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:o=.5,panOnScrollMode:s=nt.Free,zoomOnDoubleClick:i=!0,panOnDrag:a=!0,defaultViewport:c,translateExtent:l,minZoom:d,maxZoom:u,zoomActivationKeyCode:f,preventScrolling:g=!0,children:p,noWheelClassName:m,noPanClassName:v,onViewportChange:w,isControlledViewport:E,paneClickDistance:y,selectionOnDrag:b}){const S=ie(),_=x.useRef(null),{userSelectionActive:M,lib:P,connectionInProgress:T}=J(qb,se),z=nn(f),A=x.useRef();Ub(_);const D=x.useCallback(F=>{w==null||w({x:F[0],y:F[1],zoom:F[2]}),E||S.setState({transform:F})},[w,E]);return x.useEffect(()=>{if(_.current){A.current=tb({domNode:_.current,minZoom:d,maxZoom:u,translateExtent:l,viewport:c,onDraggingChange:k=>S.setState(j=>j.paneDragging===k?j:{paneDragging:k}),onPanZoomStart:(k,j)=>{const{onViewportChangeStart:I,onMoveStart:N}=S.getState();N==null||N(k,j),I==null||I(j)},onPanZoom:(k,j)=>{const{onViewportChange:I,onMove:N}=S.getState();N==null||N(k,j),I==null||I(j)},onPanZoomEnd:(k,j)=>{const{onViewportChangeEnd:I,onMoveEnd:N}=S.getState();N==null||N(k,j),I==null||I(j)}});const{x:F,y:C,zoom:R}=A.current.getViewport();return S.setState({panZoom:A.current,transform:[F,C,R],domNode:_.current.closest(".react-flow")}),()=>{var k;(k=A.current)==null||k.destroy()}}},[]),x.useEffect(()=>{var F;(F=A.current)==null||F.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:o,panOnScrollMode:s,zoomOnDoubleClick:i,panOnDrag:a,zoomActivationKeyPressed:z,preventScrolling:g,noPanClassName:v,userSelectionActive:M,noWheelClassName:m,lib:P,onTransformChange:D,connectionInProgress:T,selectionOnDrag:b,paneClickDistance:y})},[e,t,n,r,o,s,i,a,z,g,v,M,m,P,D,T,b,y]),h.jsx("div",{className:"react-flow__renderer",ref:_,style:yr,children:p})}const Zb=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Qb(){const{userSelectionActive:e,userSelectionRect:t}=J(Zb,se);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 Wr=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},Jb=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function e1({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Jt.Full,panOnDrag:r,paneClickDistance:o,selectionOnDrag:s,onSelectionStart:i,onSelectionEnd:a,onPaneClick:c,onPaneContextMenu:l,onPaneScroll:d,onPaneMouseEnter:u,onPaneMouseMove:f,onPaneMouseLeave:g,children:p}){const m=ie(),{userSelectionActive:v,elementsSelectable:w,dragging:E,connectionInProgress:y}=J(Jb,se),b=w&&(e||v),S=x.useRef(null),_=x.useRef(),M=x.useRef(new Set),P=x.useRef(new Set),T=x.useRef(!1),z=I=>{if(T.current||y){T.current=!1;return}c==null||c(I),m.getState().resetSelectedElements(),m.setState({nodesSelectionActive:!1})},A=I=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){I.preventDefault();return}l==null||l(I)},D=d?I=>d(I):void 0,F=I=>{T.current&&(I.stopPropagation(),T.current=!1)},C=I=>{var X,U;const{domNode:N}=m.getState();if(_.current=N==null?void 0:N.getBoundingClientRect(),!_.current)return;const O=I.target===S.current;if(!O&&!!I.target.closest(".nokey")||!e||!(s&&O||t)||I.button!==0||!I.isPrimary)return;(U=(X=I.target)==null?void 0:X.setPointerCapture)==null||U.call(X,I.pointerId),T.current=!1;const{x:B,y:W}=ke(I.nativeEvent,_.current);m.setState({userSelectionRect:{width:0,height:0,startX:B,startY:W,x:B,y:W}}),O||(I.stopPropagation(),I.preventDefault())},R=I=>{const{userSelectionRect:N,transform:O,nodeLookup:$,edgeLookup:L,connectionLookup:B,triggerNodeChanges:W,triggerEdgeChanges:X,defaultEdgeOptions:U,resetSelectedElements:G}=m.getState();if(!_.current||!N)return;const{x:H,y:V}=ke(I.nativeEvent,_.current),{startX:Q,startY:Z}=N;if(!T.current){const te=t?0:o;if(Math.hypot(H-Q,V-Z)<=te)return;G(),i==null||i(I)}T.current=!0;const K={startX:Q,startY:Z,x:H<Q?H:Q,y:V<Z?V:Z,width:Math.abs(H-Q),height:Math.abs(V-Z)},q=M.current,ee=P.current;M.current=new Set(zo($,K,O,n===Jt.Partial,!0).map(te=>te.id)),P.current=new Set;const oe=(U==null?void 0:U.selectable)??!0;for(const te of M.current){const ue=B.get(te);if(ue)for(const{edgeId:Ae}of ue.values()){const pe=L.get(Ae);pe&&(pe.selectable??oe)&&P.current.add(Ae)}}if(!Ks(q,M.current)){const te=yt($,M.current,!0);W(te)}if(!Ks(ee,P.current)){const te=yt(L,P.current);X(te)}m.setState({userSelectionRect:K,userSelectionActive:!0,nodesSelectionActive:!1})},k=I=>{var N,O;I.button===0&&((O=(N=I.target)==null?void 0:N.releasePointerCapture)==null||O.call(N,I.pointerId),!v&&I.target===S.current&&m.getState().userSelectionRect&&(z==null||z(I)),m.setState({userSelectionActive:!1,userSelectionRect:null}),T.current&&(a==null||a(I),m.setState({nodesSelectionActive:M.current.size>0})))},j=r===!0||Array.isArray(r)&&r.includes(0);return h.jsxs("div",{className:ce(["react-flow__pane",{draggable:j,dragging:E,selection:e}]),onClick:b?void 0:Wr(z,S),onContextMenu:Wr(A,S),onWheel:Wr(D,S),onPointerEnter:b?void 0:u,onPointerMove:b?R:f,onPointerUp:b?k:void 0,onPointerDownCapture:b?C:void 0,onClickCapture:b?F:void 0,onPointerLeave:g,ref:S,style:yr,children:[p,h.jsx(Qb,{})]})}function po({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:o,unselectNodesAndEdges:s,multiSelectionActive:i,nodeLookup:a,onError:c}=t.getState(),l=a.get(e);if(!l){c==null||c("012",Oe.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&i)&&(s({nodes:[l],edges:[]}),requestAnimationFrame(()=>{var d;return(d=r==null?void 0:r.current)==null?void 0:d.blur()})):o([e])}function cl({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:o,isSelectable:s,nodeClickDistance:i}){const a=ie(),[c,l]=x.useState(!1),d=x.useRef();return x.useEffect(()=>{d.current=Hw({getStoreItems:()=>a.getState(),onNodeMouseDown:u=>{po({id:u,store:a,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}})},[]),x.useEffect(()=>{if(!(t||!e.current||!d.current))return d.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:s,nodeId:o,nodeClickDistance:i}),()=>{var u;(u=d.current)==null||u.destroy()}},[n,r,t,s,e,o,i]),c}const t1=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function ul(){const e=ie();return x.useCallback(n=>{const{nodeExtent:r,snapToGrid:o,snapGrid:s,nodesDraggable:i,onError:a,updateNodePositions:c,nodeLookup:l,nodeOrigin:d}=e.getState(),u=new Map,f=t1(i),g=o?s[0]:5,p=o?s[1]:5,m=n.direction.x*g*n.factor,v=n.direction.y*p*n.factor;for(const[,w]of l){if(!f(w))continue;let E={x:w.internals.positionAbsolute.x+m,y:w.internals.positionAbsolute.y+v};o&&(E=pn(E,s));const{position:y,positionAbsolute:b}=ku({nodeId:w.id,nextPosition:E,nodeLookup:l,nodeExtent:r,nodeOrigin:d,onError:a});w.position=y,w.internals.positionAbsolute=b,u.set(w.id,w)}c(u)},[])}const qo=x.createContext(null),n1=qo.Provider;qo.Consumer;const ll=()=>x.useContext(qo),r1=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),o1=(e,t,n)=>r=>{const{connectionClickStartHandle:o,connectionMode:s,connection:i}=r,{fromHandle:a,toHandle:c,isValid:l}=i,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:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.id)===t&&(o==null?void 0:o.type)===n,isPossibleEndHandle:s===St.Strict?(a==null?void 0:a.type)!==n:e!==(a==null?void 0:a.nodeId)||t!==(a==null?void 0:a.id),connectionInProcess:!!a,clickConnectionInProcess:!!o,valid:d&&l}};function s1({type:e="source",position:t=Y.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:o=!0,isConnectableEnd:s=!0,id:i,onConnect:a,children:c,className:l,onMouseDown:d,onTouchStart:u,...f},g){var R,k;const p=i||null,m=e==="target",v=ie(),w=ll(),{connectOnClick:E,noPanClassName:y,rfId:b}=J(r1,se),{connectingFrom:S,connectingTo:_,clickConnecting:M,isPossibleEndHandle:P,connectionInProcess:T,clickConnectionInProcess:z,valid:A}=J(o1(w,p,e),se);w||(k=(R=v.getState()).onError)==null||k.call(R,"010",Oe.error010());const D=j=>{const{defaultEdgeOptions:I,onConnect:N,hasDefaultEdges:O}=v.getState(),$={...I,...j};if(O){const{edges:L,setEdges:B}=v.getState();B(_w($,L))}N==null||N($),a==null||a($)},F=j=>{if(!w)return;const I=Ou(j.nativeEvent);if(o&&(I&&j.button===0||!I)){const N=v.getState();ho.onPointerDown(j.nativeEvent,{handleDomNode:j.currentTarget,autoPanOnConnect:N.autoPanOnConnect,connectionMode:N.connectionMode,connectionRadius:N.connectionRadius,domNode:N.domNode,nodeLookup:N.nodeLookup,lib:N.lib,isTarget:m,handleId:p,nodeId:w,flowId:N.rfId,panBy:N.panBy,cancelConnection:N.cancelConnection,onConnectStart:N.onConnectStart,onConnectEnd:(...O)=>{var $,L;return(L=($=v.getState()).onConnectEnd)==null?void 0:L.call($,...O)},updateConnection:N.updateConnection,onConnect:D,isValidConnection:n||((...O)=>{var $,L;return((L=($=v.getState()).isValidConnection)==null?void 0:L.call($,...O))??!0}),getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,autoPanSpeed:N.autoPanSpeed,dragThreshold:N.connectionDragThreshold})}I?d==null||d(j):u==null||u(j)},C=j=>{const{onClickConnectStart:I,onClickConnectEnd:N,connectionClickStartHandle:O,connectionMode:$,isValidConnection:L,lib:B,rfId:W,nodeLookup:X,connection:U}=v.getState();if(!w||!O&&!o)return;if(!O){I==null||I(j.nativeEvent,{nodeId:w,handleId:p,handleType:e}),v.setState({connectionClickStartHandle:{nodeId:w,type:e,id:p}});return}const G=Du(j.target),H=n||L,{connection:V,isValid:Q}=ho.isValid(j.nativeEvent,{handle:{nodeId:w,id:p,type:e},connectionMode:$,fromNodeId:O.nodeId,fromHandleId:O.id||null,fromType:O.type,isValidConnection:H,flowId:W,doc:G,lib:B,nodeLookup:X});Q&&V&&D(V);const Z=structuredClone(U);delete Z.inProgress,Z.toPosition=Z.toHandle?Z.toHandle.position:null,N==null||N(j,Z),v.setState({connectionClickStartHandle:null})};return h.jsx("div",{"data-handleid":p,"data-nodeid":w,"data-handlepos":t,"data-id":`${b}-${w}-${p}-${e}`,className:ce(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",y,l,{source:!m,target:m,connectable:r,connectablestart:o,connectableend:s,clickconnecting:M,connectingfrom:S,connectingto:_,valid:A,connectionindicator:r&&(!T||P)&&(T||z?s:o)}]),onMouseDown:F,onTouchStart:F,onClick:E?C:void 0,ref:g,...f,children:c})}const we=x.memo(il(s1));function i1({data:e,isConnectable:t,sourcePosition:n=Y.Bottom}){return h.jsxs(h.Fragment,{children:[e==null?void 0:e.label,h.jsx(we,{type:"source",position:n,isConnectable:t})]})}function a1({data:e,isConnectable:t,targetPosition:n=Y.Top,sourcePosition:r=Y.Bottom}){return h.jsxs(h.Fragment,{children:[h.jsx(we,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,h.jsx(we,{type:"source",position:r,isConnectable:t})]})}function c1(){return null}function u1({data:e,isConnectable:t,targetPosition:n=Y.Top}){return h.jsxs(h.Fragment,{children:[h.jsx(we,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const nr={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Ni={input:i1,default:a1,output:u1,group:c1};function l1(e){var t,n,r,o;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??((o=e.style)==null?void 0:o.height)}}const d1=e=>{const{width:t,height:n,x:r,y:o}=hn(e.nodeLookup,{filter:s=>!!s.selected});return{width:Me(t)?t:null,height:Me(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${o}px)`}};function f1({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=ie(),{width:o,height:s,transformString:i,userSelectionActive:a}=J(d1,se),c=ul(),l=x.useRef(null);x.useEffect(()=>{var g;n||(g=l.current)==null||g.focus({preventScroll:!0})},[n]);const d=!a&&o!==null&&s!==null;if(cl({nodeRef:l,disabled:!d}),!d)return null;const u=e?g=>{const p=r.getState().nodes.filter(m=>m.selected);e(g,p)}:void 0,f=g=>{Object.prototype.hasOwnProperty.call(nr,g.key)&&(g.preventDefault(),c({direction:nr[g.key],factor:g.shiftKey?4:1}))};return h.jsx("div",{className:ce(["react-flow__nodesselection","react-flow__container",t]),style:{transform:i},children:h.jsx("div",{ref:l,className:"react-flow__nodesselection-rect",onContextMenu:u,tabIndex:n?void 0:-1,onKeyDown:n?void 0:f,style:{width:o,height:s}})})}const Mi=typeof window<"u"?window:void 0,h1=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function dl({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:s,onPaneScroll:i,paneClickDistance:a,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:d,selectionMode:u,onSelectionStart:f,onSelectionEnd:g,multiSelectionKeyCode:p,panActivationKeyCode:m,zoomActivationKeyCode:v,elementsSelectable:w,zoomOnScroll:E,zoomOnPinch:y,panOnScroll:b,panOnScrollSpeed:S,panOnScrollMode:_,zoomOnDoubleClick:M,panOnDrag:P,defaultViewport:T,translateExtent:z,minZoom:A,maxZoom:D,preventScrolling:F,onSelectionContextMenu:C,noWheelClassName:R,noPanClassName:k,disableKeyboardA11y:j,onViewportChange:I,isControlledViewport:N}){const{nodesSelectionActive:O,userSelectionActive:$}=J(h1,se),L=nn(l,{target:Mi}),B=nn(m,{target:Mi}),W=B||P,X=B||b,U=d&&W!==!0,G=L||$||U;return Xb({deleteKeyCode:c,multiSelectionKeyCode:p}),h.jsx(Kb,{onPaneContextMenu:s,elementsSelectable:w,zoomOnScroll:E,zoomOnPinch:y,panOnScroll:X,panOnScrollSpeed:S,panOnScrollMode:_,zoomOnDoubleClick:M,panOnDrag:!L&&W,defaultViewport:T,translateExtent:z,minZoom:A,maxZoom:D,zoomActivationKeyCode:v,preventScrolling:F,noWheelClassName:R,noPanClassName:k,onViewportChange:I,isControlledViewport:N,paneClickDistance:a,selectionOnDrag:U,children:h.jsxs(e1,{onSelectionStart:f,onSelectionEnd:g,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:s,onPaneScroll:i,panOnDrag:W,isSelecting:!!G,selectionMode:u,selectionKeyPressed:L,paneClickDistance:a,selectionOnDrag:U,children:[e,O&&h.jsx(f1,{onSelectionContextMenu:C,noPanClassName:k,disableKeyboardA11y:j})]})})}dl.displayName="FlowRenderer";const p1=x.memo(dl),g1=e=>t=>e?zo(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 m1(e){return J(x.useCallback(g1(e),[e]),se)}const y1=e=>e.updateNodeInternals;function x1(){const e=J(y1),[t]=x.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(o=>{const s=o.target.getAttribute("data-id");r.set(s,{id:s,nodeElement:o.target,force:!0})}),e(r)}));return x.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function v1({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const o=ie(),s=x.useRef(null),i=x.useRef(null),a=x.useRef(e.sourcePosition),c=x.useRef(e.targetPosition),l=x.useRef(t),d=n&&!!e.internals.handleBounds;return x.useEffect(()=>{s.current&&!e.hidden&&(!d||i.current!==s.current)&&(i.current&&(r==null||r.unobserve(i.current)),r==null||r.observe(s.current),i.current=s.current)},[d,e.hidden]),x.useEffect(()=>()=>{i.current&&(r==null||r.unobserve(i.current),i.current=null)},[]),x.useEffect(()=>{if(s.current){const u=l.current!==t,f=a.current!==e.sourcePosition,g=c.current!==e.targetPosition;(u||f||g)&&(l.current=t,a.current=e.sourcePosition,c.current=e.targetPosition,o.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:s.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),s}function w1({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onContextMenu:s,onDoubleClick:i,nodesDraggable:a,elementsSelectable:c,nodesConnectable:l,nodesFocusable:d,resizeObserver:u,noDragClassName:f,noPanClassName:g,disableKeyboardA11y:p,rfId:m,nodeTypes:v,nodeClickDistance:w,onError:E}){const{node:y,internals:b,isParent:S}=J(H=>{const V=H.nodeLookup.get(e),Q=H.parentLookup.has(e);return{node:V,internals:V.internals,isParent:Q}},se);let _=y.type||"default",M=(v==null?void 0:v[_])||Ni[_];M===void 0&&(E==null||E("003",Oe.error003(_)),_="default",M=(v==null?void 0:v.default)||Ni.default);const P=!!(y.draggable||a&&typeof y.draggable>"u"),T=!!(y.selectable||c&&typeof y.selectable>"u"),z=!!(y.connectable||l&&typeof y.connectable>"u"),A=!!(y.focusable||d&&typeof y.focusable>"u"),D=ie(),F=Ru(y),C=v1({node:y,nodeType:_,hasDimensions:F,resizeObserver:u}),R=cl({nodeRef:C,disabled:y.hidden||!P,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:w}),k=ul();if(y.hidden)return null;const j=We(y),I=l1(y),N=T||P||t||n||r||o,O=n?H=>n(H,{...b.userNode}):void 0,$=r?H=>r(H,{...b.userNode}):void 0,L=o?H=>o(H,{...b.userNode}):void 0,B=s?H=>s(H,{...b.userNode}):void 0,W=i?H=>i(H,{...b.userNode}):void 0,X=H=>{const{selectNodesOnDrag:V,nodeDragThreshold:Q}=D.getState();T&&(!V||!P||Q>0)&&po({id:e,store:D,nodeRef:C}),t&&t(H,{...b.userNode})},U=H=>{if(!(ju(H.nativeEvent)||p)){if(Su.includes(H.key)&&T){const V=H.key==="Escape";po({id:e,store:D,unselect:V,nodeRef:C})}else if(P&&y.selected&&Object.prototype.hasOwnProperty.call(nr,H.key)){H.preventDefault();const{ariaLabelConfig:V}=D.getState();D.setState({ariaLiveMessage:V["node.a11yDescription.ariaLiveMessage"]({direction:H.key.replace("Arrow","").toLowerCase(),x:~~b.positionAbsolute.x,y:~~b.positionAbsolute.y})}),k({direction:nr[H.key],factor:H.shiftKey?4:1})}}},G=()=>{var ee;if(p||!((ee=C.current)!=null&&ee.matches(":focus-visible")))return;const{transform:H,width:V,height:Q,autoPanOnNodeFocus:Z,setCenter:K}=D.getState();if(!Z)return;zo(new Map([[e,y]]),{x:0,y:0,width:V,height:Q},H,!0).length>0||K(y.position.x+j.width/2,y.position.y+j.height/2,{zoom:H[2]})};return h.jsx("div",{className:ce(["react-flow__node",`react-flow__node-${_}`,{[g]:P},y.className,{selected:y.selected,selectable:T,parent:S,draggable:P,dragging:R}]),ref:C,style:{zIndex:b.z,transform:`translate(${b.positionAbsolute.x}px,${b.positionAbsolute.y}px)`,pointerEvents:N?"all":"none",visibility:F?"visible":"hidden",...y.style,...I},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:O,onMouseMove:$,onMouseLeave:L,onContextMenu:B,onClick:X,onDoubleClick:W,onKeyDown:A?U:void 0,tabIndex:A?0:void 0,onFocus:A?G:void 0,role:y.ariaRole??(A?"group":void 0),"aria-roledescription":"node","aria-describedby":p?void 0:`${el}-${m}`,"aria-label":y.ariaLabel,...y.domAttributes,children:h.jsx(n1,{value:e,children:h.jsx(M,{id:e,data:y.data,type:_,positionAbsoluteX:b.positionAbsolute.x,positionAbsoluteY:b.positionAbsolute.y,selected:y.selected??!1,selectable:T,draggable:P,deletable:y.deletable??!0,isConnectable:z,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:R,dragHandle:y.dragHandle,zIndex:b.z,parentId:y.parentId,...j})})})}var b1=x.memo(w1);const E1=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function fl(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,onError:s}=J(E1,se),i=m1(e.onlyRenderVisibleElements),a=x1();return h.jsx("div",{className:"react-flow__nodes",style:yr,children:i.map(c=>h.jsx(b1,{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:o,nodeClickDistance:e.nodeClickDistance,onError:s},c))})}fl.displayName="NodeRenderer";const S1=x.memo(fl);function C1(e){return J(x.useCallback(n=>{if(!e)return n.edges.map(o=>o.id);const r=[];if(n.width&&n.height)for(const o of n.edges){const s=n.nodeLookup.get(o.source),i=n.nodeLookup.get(o.target);s&&i&&Ew({sourceNode:s,targetNode:i,width:n.width,height:n.height,transform:n.transform})&&r.push(o.id)}return r},[e]),se)}const _1=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return h.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},N1=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return h.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},ki={[Ct.Arrow]:_1,[Ct.ArrowClosed]:N1};function M1(e){const t=ie();return x.useMemo(()=>{var o,s;return Object.prototype.hasOwnProperty.call(ki,e)?ki[e]:((s=(o=t.getState()).onError)==null||s.call(o,"009",Oe.error009(e)),null)},[e])}const k1=({id:e,type:t,color:n,width:r=12.5,height:o=12.5,markerUnits:s="strokeWidth",strokeWidth:i,orient:a="auto-start-reverse"})=>{const c=M1(t);return c?h.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:a,refX:"0",refY:"0",children:h.jsx(c,{color:n,strokeWidth:i})}):null},hl=({defaultColor:e,rfId:t})=>{const n=J(s=>s.edges),r=J(s=>s.defaultEdgeOptions),o=x.useMemo(()=>Iw(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return o.length?h.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:h.jsx("defs",{children:o.map(s=>h.jsx(k1,{id:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient},s.id))})}):null};hl.displayName="MarkerDefinitions";var P1=x.memo(hl);function pl({x:e,y:t,label:n,labelStyle:r,labelShowBg:o=!0,labelBgStyle:s,labelBgPadding:i=[2,4],labelBgBorderRadius:a=2,children:c,className:l,...d}){const[u,f]=x.useState({x:1,y:0,width:0,height:0}),g=ce(["react-flow__edge-textwrapper",l]),p=x.useRef(null);return x.useEffect(()=>{if(p.current){const m=p.current.getBBox();f({x:m.x,y:m.y,width:m.width,height:m.height})}},[n]),n?h.jsxs("g",{transform:`translate(${e-u.width/2} ${t-u.height/2})`,className:g,visibility:u.width?"visible":"hidden",...d,children:[o&&h.jsx("rect",{width:u.width+2*i[0],x:-i[0],y:-i[1],height:u.height+2*i[1],className:"react-flow__edge-textbg",style:s,rx:a,ry:a}),h.jsx("text",{className:"react-flow__edge-text",y:u.height/2,dy:"0.3em",ref:p,style:r,children:n}),c]}):null}pl.displayName="EdgeText";const I1=x.memo(pl);function yn({path:e,labelX:t,labelY:n,label:r,labelStyle:o,labelShowBg:s,labelBgStyle:i,labelBgPadding:a,labelBgBorderRadius:c,interactionWidth:l=20,...d}){return h.jsxs(h.Fragment,{children:[h.jsx("path",{...d,d:e,fill:"none",className:ce(["react-flow__edge-path",d.className])}),l?h.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:l,className:"react-flow__edge-interaction"}):null,r&&Me(t)&&Me(n)?h.jsx(I1,{x:t,y:n,label:r,labelStyle:o,labelShowBg:s,labelBgStyle:i,labelBgPadding:a,labelBgBorderRadius:c}):null]})}function Pi({pos:e,x1:t,y1:n,x2:r,y2:o}){return e===Y.Left||e===Y.Right?[.5*(t+r),n]:[t,.5*(n+o)]}function gl({sourceX:e,sourceY:t,sourcePosition:n=Y.Bottom,targetX:r,targetY:o,targetPosition:s=Y.Top}){const[i,a]=Pi({pos:n,x1:e,y1:t,x2:r,y2:o}),[c,l]=Pi({pos:s,x1:r,y1:o,x2:e,y2:t}),[d,u,f,g]=$u({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:i,sourceControlY:a,targetControlX:c,targetControlY:l});return[`M${e},${t} C${i},${a} ${c},${l} ${r},${o}`,d,u,f,g]}function ml(e){return x.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:s,sourcePosition:i,targetPosition:a,label:c,labelStyle:l,labelShowBg:d,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:g,style:p,markerEnd:m,markerStart:v,interactionWidth:w})=>{const[E,y,b]=gl({sourceX:n,sourceY:r,sourcePosition:i,targetX:o,targetY:s,targetPosition:a}),S=e.isInternal?void 0:t;return h.jsx(yn,{id:S,path:E,labelX:y,labelY:b,label:c,labelStyle:l,labelShowBg:d,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:g,style:p,markerEnd:m,markerStart:v,interactionWidth:w})})}const A1=ml({isInternal:!1}),yl=ml({isInternal:!0});A1.displayName="SimpleBezierEdge";yl.displayName="SimpleBezierEdgeInternal";function xl(e){return x.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:s,label:i,labelStyle:a,labelShowBg:c,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:u,style:f,sourcePosition:g=Y.Bottom,targetPosition:p=Y.Top,markerEnd:m,markerStart:v,pathOptions:w,interactionWidth:E})=>{const[y,b,S]=uo({sourceX:n,sourceY:r,sourcePosition:g,targetX:o,targetY:s,targetPosition:p,borderRadius:w==null?void 0:w.borderRadius,offset:w==null?void 0:w.offset,stepPosition:w==null?void 0:w.stepPosition}),_=e.isInternal?void 0:t;return h.jsx(yn,{id:_,path:y,labelX:b,labelY:S,label:i,labelStyle:a,labelShowBg:c,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:m,markerStart:v,interactionWidth:E})})}const vl=xl({isInternal:!1}),wl=xl({isInternal:!0});vl.displayName="SmoothStepEdge";wl.displayName="SmoothStepEdgeInternal";function bl(e){return x.memo(({id:t,...n})=>{var o;const r=e.isInternal?void 0:t;return h.jsx(vl,{...n,id:r,pathOptions:x.useMemo(()=>{var s;return{borderRadius:0,offset:(s=n.pathOptions)==null?void 0:s.offset}},[(o=n.pathOptions)==null?void 0:o.offset])})})}const R1=bl({isInternal:!1}),El=bl({isInternal:!0});R1.displayName="StepEdge";El.displayName="StepEdgeInternal";function Sl(e){return x.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:s,label:i,labelStyle:a,labelShowBg:c,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:g,markerStart:p,interactionWidth:m})=>{const[v,w,E]=zu({sourceX:n,sourceY:r,targetX:o,targetY:s}),y=e.isInternal?void 0:t;return h.jsx(yn,{id:y,path:v,labelX:w,labelY:E,label:i,labelStyle:a,labelShowBg:c,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:g,markerStart:p,interactionWidth:m})})}const T1=Sl({isInternal:!1}),Cl=Sl({isInternal:!0});T1.displayName="StraightEdge";Cl.displayName="StraightEdgeInternal";function _l(e){return x.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:s,sourcePosition:i=Y.Bottom,targetPosition:a=Y.Top,label:c,labelStyle:l,labelShowBg:d,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:g,style:p,markerEnd:m,markerStart:v,pathOptions:w,interactionWidth:E})=>{const[y,b,S]=Lu({sourceX:n,sourceY:r,sourcePosition:i,targetX:o,targetY:s,targetPosition:a,curvature:w==null?void 0:w.curvature}),_=e.isInternal?void 0:t;return h.jsx(yn,{id:_,path:y,labelX:b,labelY:S,label:c,labelStyle:l,labelShowBg:d,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:g,style:p,markerEnd:m,markerStart:v,interactionWidth:E})})}const D1=_l({isInternal:!1}),Nl=_l({isInternal:!0});D1.displayName="BezierEdge";Nl.displayName="BezierEdgeInternal";const Ii={default:Nl,straight:Cl,step:El,smoothstep:wl,simplebezier:yl},Ai={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},j1=(e,t,n)=>n===Y.Left?e-t:n===Y.Right?e+t:e,O1=(e,t,n)=>n===Y.Top?e-t:n===Y.Bottom?e+t:e,Ri="react-flow__edgeupdater";function Ti({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:o,onMouseEnter:s,onMouseOut:i,type:a}){return h.jsx("circle",{onMouseDown:o,onMouseEnter:s,onMouseOut:i,className:ce([Ri,`${Ri}-${a}`]),cx:j1(t,r,e),cy:O1(n,r,e),r,stroke:"transparent",fill:"transparent"})}function $1({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:o,targetX:s,targetY:i,sourcePosition:a,targetPosition:c,onReconnect:l,onReconnectStart:d,onReconnectEnd:u,setReconnecting:f,setUpdateHover:g}){const p=ie(),m=(b,S)=>{if(b.button!==0)return;const{autoPanOnConnect:_,domNode:M,connectionMode:P,connectionRadius:T,lib:z,onConnectStart:A,cancelConnection:D,nodeLookup:F,rfId:C,panBy:R,updateConnection:k}=p.getState(),j=S.type==="target",I=($,L)=>{f(!1),u==null||u($,n,S.type,L)},N=$=>l==null?void 0:l(n,$),O=($,L)=>{f(!0),d==null||d(b,n,S.type),A==null||A($,L)};ho.onPointerDown(b.nativeEvent,{autoPanOnConnect:_,connectionMode:P,connectionRadius:T,domNode:M,handleId:S.id,nodeId:S.nodeId,nodeLookup:F,isTarget:j,edgeUpdaterType:S.type,lib:z,flowId:C,cancelConnection:D,panBy:R,isValidConnection:(...$)=>{var L,B;return((B=(L=p.getState()).isValidConnection)==null?void 0:B.call(L,...$))??!0},onConnect:N,onConnectStart:O,onConnectEnd:(...$)=>{var L,B;return(B=(L=p.getState()).onConnectEnd)==null?void 0:B.call(L,...$)},onReconnectEnd:I,updateConnection:k,getTransform:()=>p.getState().transform,getFromHandle:()=>p.getState().connection.fromHandle,dragThreshold:p.getState().connectionDragThreshold,handleDomNode:b.currentTarget})},v=b=>m(b,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),w=b=>m(b,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),E=()=>g(!0),y=()=>g(!1);return h.jsxs(h.Fragment,{children:[(e===!0||e==="source")&&h.jsx(Ti,{position:a,centerX:r,centerY:o,radius:t,onMouseDown:v,onMouseEnter:E,onMouseOut:y,type:"source"}),(e===!0||e==="target")&&h.jsx(Ti,{position:c,centerX:s,centerY:i,radius:t,onMouseDown:w,onMouseEnter:E,onMouseOut:y,type:"target"})]})}function L1({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:o,onDoubleClick:s,onContextMenu:i,onMouseEnter:a,onMouseMove:c,onMouseLeave:l,reconnectRadius:d,onReconnect:u,onReconnectStart:f,onReconnectEnd:g,rfId:p,edgeTypes:m,noPanClassName:v,onError:w,disableKeyboardA11y:E}){let y=J(K=>K.edgeLookup.get(e));const b=J(K=>K.defaultEdgeOptions);y=b?{...b,...y}:y;let S=y.type||"default",_=(m==null?void 0:m[S])||Ii[S];_===void 0&&(w==null||w("011",Oe.error011(S)),S="default",_=(m==null?void 0:m.default)||Ii.default);const M=!!(y.focusable||t&&typeof y.focusable>"u"),P=typeof u<"u"&&(y.reconnectable||n&&typeof y.reconnectable>"u"),T=!!(y.selectable||r&&typeof y.selectable>"u"),z=x.useRef(null),[A,D]=x.useState(!1),[F,C]=x.useState(!1),R=ie(),{zIndex:k,sourceX:j,sourceY:I,targetX:N,targetY:O,sourcePosition:$,targetPosition:L}=J(x.useCallback(K=>{const q=K.nodeLookup.get(y.source),ee=K.nodeLookup.get(y.target);if(!q||!ee)return{zIndex:y.zIndex,...Ai};const oe=Pw({id:e,sourceNode:q,targetNode:ee,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:K.connectionMode,onError:w});return{zIndex:bw({selected:y.selected,zIndex:y.zIndex,sourceNode:q,targetNode:ee,elevateOnSelect:K.elevateEdgesOnSelect,zIndexMode:K.zIndexMode}),...oe||Ai}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),se),B=x.useMemo(()=>y.markerStart?`url('#${lo(y.markerStart,p)}')`:void 0,[y.markerStart,p]),W=x.useMemo(()=>y.markerEnd?`url('#${lo(y.markerEnd,p)}')`:void 0,[y.markerEnd,p]);if(y.hidden||j===null||I===null||N===null||O===null)return null;const X=K=>{var te;const{addSelectedEdges:q,unselectNodesAndEdges:ee,multiSelectionActive:oe}=R.getState();T&&(R.setState({nodesSelectionActive:!1}),y.selected&&oe?(ee({nodes:[],edges:[y]}),(te=z.current)==null||te.blur()):q([e])),o&&o(K,y)},U=s?K=>{s(K,{...y})}:void 0,G=i?K=>{i(K,{...y})}:void 0,H=a?K=>{a(K,{...y})}:void 0,V=c?K=>{c(K,{...y})}:void 0,Q=l?K=>{l(K,{...y})}:void 0,Z=K=>{var q;if(!E&&Su.includes(K.key)&&T){const{unselectNodesAndEdges:ee,addSelectedEdges:oe}=R.getState();K.key==="Escape"?((q=z.current)==null||q.blur(),ee({edges:[y]})):oe([e])}};return h.jsx("svg",{style:{zIndex:k},children:h.jsxs("g",{className:ce(["react-flow__edge",`react-flow__edge-${S}`,y.className,v,{selected:y.selected,animated:y.animated,inactive:!T&&!o,updating:A,selectable:T}]),onClick:X,onDoubleClick:U,onContextMenu:G,onMouseEnter:H,onMouseMove:V,onMouseLeave:Q,onKeyDown:M?Z:void 0,tabIndex:M?0:void 0,role:y.ariaRole??(M?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":M?`${tl}-${p}`:void 0,ref:z,...y.domAttributes,children:[!F&&h.jsx(_,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:T,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:j,sourceY:I,targetX:N,targetY:O,sourcePosition:$,targetPosition:L,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:B,markerEnd:W,pathOptions:"pathOptions"in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),P&&h.jsx($1,{edge:y,isReconnectable:P,reconnectRadius:d,onReconnect:u,onReconnectStart:f,onReconnectEnd:g,sourceX:j,sourceY:I,targetX:N,targetY:O,sourcePosition:$,targetPosition:L,setUpdateHover:D,setReconnecting:C})]})})}var F1=x.memo(L1);const z1=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Ml({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:o,onReconnect:s,onEdgeContextMenu:i,onEdgeMouseEnter:a,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:d,reconnectRadius:u,onEdgeDoubleClick:f,onReconnectStart:g,onReconnectEnd:p,disableKeyboardA11y:m}){const{edgesFocusable:v,edgesReconnectable:w,elementsSelectable:E,onError:y}=J(z1,se),b=C1(t);return h.jsxs("div",{className:"react-flow__edges",children:[h.jsx(P1,{defaultColor:e,rfId:n}),b.map(S=>h.jsx(F1,{id:S,edgesFocusable:v,edgesReconnectable:w,elementsSelectable:E,noPanClassName:o,onReconnect:s,onContextMenu:i,onMouseEnter:a,onMouseMove:c,onMouseLeave:l,onClick:d,reconnectRadius:u,onDoubleClick:f,onReconnectStart:g,onReconnectEnd:p,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:m},S))]})}Ml.displayName="EdgeRenderer";const H1=x.memo(Ml),B1=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function W1({children:e}){const t=J(B1);return h.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function V1(e){const t=Uo(),n=x.useRef(!1);x.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const Y1=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function G1(e){const t=J(Y1),n=ie();return x.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function X1(e){return e.connection.inProgress?{...e.connection,to:gn(e.connection.to,e.transform)}:{...e.connection}}function U1(e){return X1}function q1(e){const t=U1();return J(t,se)}const K1=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Z1({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:o,width:s,height:i,isValid:a,inProgress:c}=J(K1,se);return!(s&&o&&c)?null:h.jsx("svg",{style:e,width:s,height:i,className:"react-flow__connectionline react-flow__container",children:h.jsx("g",{className:ce(["react-flow__connection",Nu(a)]),children:h.jsx(kl,{style:t,type:n,CustomComponent:r,isValid:a})})})}const kl=({style:e,type:t=Ue.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:o,from:s,fromNode:i,fromHandle:a,fromPosition:c,to:l,toNode:d,toHandle:u,toPosition:f,pointer:g}=q1();if(!o)return;if(n)return h.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:i,fromHandle:a,fromX:s.x,fromY:s.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:f,connectionStatus:Nu(r),toNode:d,toHandle:u,pointer:g});let p="";const m={sourceX:s.x,sourceY:s.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:f};switch(t){case Ue.Bezier:[p]=Lu(m);break;case Ue.SimpleBezier:[p]=gl(m);break;case Ue.Step:[p]=uo({...m,borderRadius:0});break;case Ue.SmoothStep:[p]=uo(m);break;default:[p]=zu(m)}return h.jsx("path",{d:p,fill:"none",className:"react-flow__connection-path",style:e})};kl.displayName="ConnectionLine";const Q1={};function Di(e=Q1){x.useRef(e),ie(),x.useEffect(()=>{},[e])}function J1(){ie(),x.useRef(!1),x.useEffect(()=>{},[])}function Pl({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:o,onNodeDoubleClick:s,onEdgeDoubleClick:i,onNodeMouseEnter:a,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:d,onSelectionContextMenu:u,onSelectionStart:f,onSelectionEnd:g,connectionLineType:p,connectionLineStyle:m,connectionLineComponent:v,connectionLineContainerStyle:w,selectionKeyCode:E,selectionOnDrag:y,selectionMode:b,multiSelectionKeyCode:S,panActivationKeyCode:_,zoomActivationKeyCode:M,deleteKeyCode:P,onlyRenderVisibleElements:T,elementsSelectable:z,defaultViewport:A,translateExtent:D,minZoom:F,maxZoom:C,preventScrolling:R,defaultMarkerColor:k,zoomOnScroll:j,zoomOnPinch:I,panOnScroll:N,panOnScrollSpeed:O,panOnScrollMode:$,zoomOnDoubleClick:L,panOnDrag:B,onPaneClick:W,onPaneMouseEnter:X,onPaneMouseMove:U,onPaneMouseLeave:G,onPaneScroll:H,onPaneContextMenu:V,paneClickDistance:Q,nodeClickDistance:Z,onEdgeContextMenu:K,onEdgeMouseEnter:q,onEdgeMouseMove:ee,onEdgeMouseLeave:oe,reconnectRadius:te,onReconnect:ue,onReconnectStart:Ae,onReconnectEnd:pe,noDragClassName:Ke,noWheelClassName:At,noPanClassName:Rt,disableKeyboardA11y:Tt,nodeExtent:xr,rfId:xn,viewport:lt,onViewportChange:Dt}){return Di(e),Di(t),J1(),V1(n),G1(lt),h.jsx(p1,{onPaneClick:W,onPaneMouseEnter:X,onPaneMouseMove:U,onPaneMouseLeave:G,onPaneContextMenu:V,onPaneScroll:H,paneClickDistance:Q,deleteKeyCode:P,selectionKeyCode:E,selectionOnDrag:y,selectionMode:b,onSelectionStart:f,onSelectionEnd:g,multiSelectionKeyCode:S,panActivationKeyCode:_,zoomActivationKeyCode:M,elementsSelectable:z,zoomOnScroll:j,zoomOnPinch:I,zoomOnDoubleClick:L,panOnScroll:N,panOnScrollSpeed:O,panOnScrollMode:$,panOnDrag:B,defaultViewport:A,translateExtent:D,minZoom:F,maxZoom:C,onSelectionContextMenu:u,preventScrolling:R,noDragClassName:Ke,noWheelClassName:At,noPanClassName:Rt,disableKeyboardA11y:Tt,onViewportChange:Dt,isControlledViewport:!!lt,children:h.jsxs(W1,{children:[h.jsx(H1,{edgeTypes:t,onEdgeClick:o,onEdgeDoubleClick:i,onReconnect:ue,onReconnectStart:Ae,onReconnectEnd:pe,onlyRenderVisibleElements:T,onEdgeContextMenu:K,onEdgeMouseEnter:q,onEdgeMouseMove:ee,onEdgeMouseLeave:oe,reconnectRadius:te,defaultMarkerColor:k,noPanClassName:Rt,disableKeyboardA11y:Tt,rfId:xn}),h.jsx(Z1,{style:m,type:p,component:v,containerStyle:w}),h.jsx("div",{className:"react-flow__edgelabel-renderer"}),h.jsx(S1,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:s,onNodeMouseEnter:a,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:d,nodeClickDistance:Z,onlyRenderVisibleElements:T,noPanClassName:Rt,noDragClassName:Ke,disableKeyboardA11y:Tt,nodeExtent:xr,rfId:xn}),h.jsx("div",{className:"react-flow__viewport-portal"})]})})}Pl.displayName="GraphView";const eE=x.memo(Pl),ji=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:s,fitView:i,fitViewOptions:a,minZoom:c=.5,maxZoom:l=2,nodeOrigin:d,nodeExtent:u,zIndexMode:f="basic"}={})=>{const g=new Map,p=new Map,m=new Map,v=new Map,w=r??t??[],E=n??e??[],y=d??[0,0],b=u??Qt;Wu(m,v,w);const S=fo(E,g,p,{nodeOrigin:y,nodeExtent:b,zIndexMode:f});let _=[0,0,1];if(i&&o&&s){const M=hn(g,{filter:A=>!!((A.width||A.initialWidth)&&(A.height||A.initialHeight))}),{x:P,y:T,zoom:z}=Ho(M,o,s,c,l,(a==null?void 0:a.padding)??.1);_=[P,T,z]}return{rfId:"1",width:o??0,height:s??0,transform:_,nodes:E,nodesInitialized:S,nodeLookup:g,parentLookup:p,edges:w,edgeLookup:v,connectionLookup:m,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:Qt,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:St.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:y,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:i??!1,fitViewOptions:a,fitViewResolver:null,connection:{..._u},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:gw,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Cu,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},tE=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:s,fitView:i,fitViewOptions:a,minZoom:c,maxZoom:l,nodeOrigin:d,nodeExtent:u,zIndexMode:f})=>vb((g,p)=>{async function m(){const{nodeLookup:v,panZoom:w,fitViewOptions:E,fitViewResolver:y,width:b,height:S,minZoom:_,maxZoom:M}=p();w&&(await hw({nodes:v,width:b,height:S,panZoom:w,minZoom:_,maxZoom:M},E),y==null||y.resolve(!0),g({fitViewResolver:null}))}return{...ji({nodes:e,edges:t,width:o,height:s,fitView:i,fitViewOptions:a,minZoom:c,maxZoom:l,nodeOrigin:d,nodeExtent:u,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:v=>{const{nodeLookup:w,parentLookup:E,nodeOrigin:y,elevateNodesOnSelect:b,fitViewQueued:S,zIndexMode:_}=p(),M=fo(v,w,E,{nodeOrigin:y,nodeExtent:u,elevateNodesOnSelect:b,checkEquality:!0,zIndexMode:_});S&&M?(m(),g({nodes:v,nodesInitialized:M,fitViewQueued:!1,fitViewOptions:void 0})):g({nodes:v,nodesInitialized:M})},setEdges:v=>{const{connectionLookup:w,edgeLookup:E}=p();Wu(w,E,v),g({edges:v})},setDefaultNodesAndEdges:(v,w)=>{if(v){const{setNodes:E}=p();E(v),g({hasDefaultNodes:!0})}if(w){const{setEdges:E}=p();E(w),g({hasDefaultEdges:!0})}},updateNodeInternals:v=>{const{triggerNodeChanges:w,nodeLookup:E,parentLookup:y,domNode:b,nodeOrigin:S,nodeExtent:_,debug:M,fitViewQueued:P,zIndexMode:T}=p(),{changes:z,updatedInternals:A}=$w(v,E,y,b,S,_,T);A&&(Tw(E,y,{nodeOrigin:S,nodeExtent:_,zIndexMode:T}),P?(m(),g({fitViewQueued:!1,fitViewOptions:void 0})):g({}),(z==null?void 0:z.length)>0&&(M&&console.log("React Flow: trigger node changes",z),w==null||w(z)))},updateNodePositions:(v,w=!1)=>{const E=[];let y=[];const{nodeLookup:b,triggerNodeChanges:S,connection:_,updateConnection:M,onNodesChangeMiddlewareMap:P}=p();for(const[T,z]of v){const A=b.get(T),D=!!(A!=null&&A.expandParent&&(A!=null&&A.parentId)&&(z!=null&&z.position)),F={id:T,type:"position",position:D?{x:Math.max(0,z.position.x),y:Math.max(0,z.position.y)}:z.position,dragging:w};if(A&&_.inProgress&&_.fromNode.id===A.id){const C=at(A,_.fromHandle,Y.Left,!0);M({..._,from:C})}D&&A.parentId&&E.push({id:T,parentId:A.parentId,rect:{...z.internals.positionAbsolute,width:z.measured.width??0,height:z.measured.height??0}}),y.push(F)}if(E.length>0){const{parentLookup:T,nodeOrigin:z}=p(),A=Xo(E,b,T,z);y.push(...A)}for(const T of P.values())y=T(y);S(y)},triggerNodeChanges:v=>{const{onNodesChange:w,setNodes:E,nodes:y,hasDefaultNodes:b,debug:S}=p();if(v!=null&&v.length){if(b){const _=ol(v,y);E(_)}S&&console.log("React Flow: trigger node changes",v),w==null||w(v)}},triggerEdgeChanges:v=>{const{onEdgesChange:w,setEdges:E,edges:y,hasDefaultEdges:b,debug:S}=p();if(v!=null&&v.length){if(b){const _=sl(v,y);E(_)}S&&console.log("React Flow: trigger edge changes",v),w==null||w(v)}},addSelectedNodes:v=>{const{multiSelectionActive:w,edgeLookup:E,nodeLookup:y,triggerNodeChanges:b,triggerEdgeChanges:S}=p();if(w){const _=v.map(M=>Qe(M,!0));b(_);return}b(yt(y,new Set([...v]),!0)),S(yt(E))},addSelectedEdges:v=>{const{multiSelectionActive:w,edgeLookup:E,nodeLookup:y,triggerNodeChanges:b,triggerEdgeChanges:S}=p();if(w){const _=v.map(M=>Qe(M,!0));S(_);return}S(yt(E,new Set([...v]))),b(yt(y,new Set,!0))},unselectNodesAndEdges:({nodes:v,edges:w}={})=>{const{edges:E,nodes:y,nodeLookup:b,triggerNodeChanges:S,triggerEdgeChanges:_}=p(),M=v||y,P=w||E,T=[];for(const A of M){if(!A.selected)continue;const D=b.get(A.id);D&&(D.selected=!1),T.push(Qe(A.id,!1))}const z=[];for(const A of P)A.selected&&z.push(Qe(A.id,!1));S(T),_(z)},setMinZoom:v=>{const{panZoom:w,maxZoom:E}=p();w==null||w.setScaleExtent([v,E]),g({minZoom:v})},setMaxZoom:v=>{const{panZoom:w,minZoom:E}=p();w==null||w.setScaleExtent([E,v]),g({maxZoom:v})},setTranslateExtent:v=>{var w;(w=p().panZoom)==null||w.setTranslateExtent(v),g({translateExtent:v})},resetSelectedElements:()=>{const{edges:v,nodes:w,triggerNodeChanges:E,triggerEdgeChanges:y,elementsSelectable:b}=p();if(!b)return;const S=w.reduce((M,P)=>P.selected?[...M,Qe(P.id,!1)]:M,[]),_=v.reduce((M,P)=>P.selected?[...M,Qe(P.id,!1)]:M,[]);E(S),y(_)},setNodeExtent:v=>{const{nodes:w,nodeLookup:E,parentLookup:y,nodeOrigin:b,elevateNodesOnSelect:S,nodeExtent:_,zIndexMode:M}=p();v[0][0]===_[0][0]&&v[0][1]===_[0][1]&&v[1][0]===_[1][0]&&v[1][1]===_[1][1]||(fo(w,E,y,{nodeOrigin:b,nodeExtent:v,elevateNodesOnSelect:S,checkEquality:!1,zIndexMode:M}),g({nodeExtent:v}))},panBy:v=>{const{transform:w,width:E,height:y,panZoom:b,translateExtent:S}=p();return Lw({delta:v,panZoom:b,transform:w,translateExtent:S,width:E,height:y})},setCenter:async(v,w,E)=>{const{width:y,height:b,maxZoom:S,panZoom:_}=p();if(!_)return Promise.resolve(!1);const M=typeof(E==null?void 0:E.zoom)<"u"?E.zoom:S;return await _.setViewport({x:y/2-v*M,y:b/2-w*M,zoom:M},{duration:E==null?void 0:E.duration,ease:E==null?void 0:E.ease,interpolate:E==null?void 0:E.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{g({connection:{..._u}})},updateConnection:v=>{g({connection:v})},reset:()=>g({...ji()})}},Object.is);function nE({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:o,initialHeight:s,initialMinZoom:i,initialMaxZoom:a,initialFitViewOptions:c,fitView:l,nodeOrigin:d,nodeExtent:u,zIndexMode:f,children:g}){const[p]=x.useState(()=>tE({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:s,fitView:l,minZoom:i,maxZoom:a,fitViewOptions:c,nodeOrigin:d,nodeExtent:u,zIndexMode:f}));return h.jsx(wb,{value:p,children:h.jsx(Wb,{children:g})})}function rE({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:o,width:s,height:i,fitView:a,fitViewOptions:c,minZoom:l,maxZoom:d,nodeOrigin:u,nodeExtent:f,zIndexMode:g}){return x.useContext(mr)?h.jsx(h.Fragment,{children:e}):h.jsx(nE,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:o,initialWidth:s,initialHeight:i,fitView:a,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:d,nodeOrigin:u,nodeExtent:f,zIndexMode:g,children:e})}const oE={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function sE({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:o,nodeTypes:s,edgeTypes:i,onNodeClick:a,onEdgeClick:c,onInit:l,onMove:d,onMoveStart:u,onMoveEnd:f,onConnect:g,onConnectStart:p,onConnectEnd:m,onClickConnectStart:v,onClickConnectEnd:w,onNodeMouseEnter:E,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:S,onNodeDoubleClick:_,onNodeDragStart:M,onNodeDrag:P,onNodeDragStop:T,onNodesDelete:z,onEdgesDelete:A,onDelete:D,onSelectionChange:F,onSelectionDragStart:C,onSelectionDrag:R,onSelectionDragStop:k,onSelectionContextMenu:j,onSelectionStart:I,onSelectionEnd:N,onBeforeDelete:O,connectionMode:$,connectionLineType:L=Ue.Bezier,connectionLineStyle:B,connectionLineComponent:W,connectionLineContainerStyle:X,deleteKeyCode:U="Backspace",selectionKeyCode:G="Shift",selectionOnDrag:H=!1,selectionMode:V=Jt.Full,panActivationKeyCode:Q="Space",multiSelectionKeyCode:Z=tn()?"Meta":"Control",zoomActivationKeyCode:K=tn()?"Meta":"Control",snapToGrid:q,snapGrid:ee,onlyRenderVisibleElements:oe=!1,selectNodesOnDrag:te,nodesDraggable:ue,autoPanOnNodeFocus:Ae,nodesConnectable:pe,nodesFocusable:Ke,nodeOrigin:At=nl,edgesFocusable:Rt,edgesReconnectable:Tt,elementsSelectable:xr=!0,defaultViewport:xn=Tb,minZoom:lt=.5,maxZoom:Dt=2,translateExtent:Ko=Qt,preventScrolling:jl=!0,nodeExtent:vr,defaultMarkerColor:Ol="#b1b1b7",zoomOnScroll:$l=!0,zoomOnPinch:Ll=!0,panOnScroll:Fl=!1,panOnScrollSpeed:zl=.5,panOnScrollMode:Hl=nt.Free,zoomOnDoubleClick:Bl=!0,panOnDrag:Wl=!0,onPaneClick:Vl,onPaneMouseEnter:Yl,onPaneMouseMove:Gl,onPaneMouseLeave:Xl,onPaneScroll:Ul,onPaneContextMenu:ql,paneClickDistance:Kl=1,nodeClickDistance:Zl=0,children:Ql,onReconnect:Jl,onReconnectStart:ed,onReconnectEnd:td,onEdgeContextMenu:nd,onEdgeDoubleClick:rd,onEdgeMouseEnter:od,onEdgeMouseMove:sd,onEdgeMouseLeave:id,reconnectRadius:ad=10,onNodesChange:cd,onEdgesChange:ud,noDragClassName:ld="nodrag",noWheelClassName:dd="nowheel",noPanClassName:Zo="nopan",fitView:Qo,fitViewOptions:Jo,connectOnClick:fd,attributionPosition:hd,proOptions:pd,defaultEdgeOptions:gd,elevateNodesOnSelect:md=!0,elevateEdgesOnSelect:yd=!1,disableKeyboardA11y:es=!1,autoPanOnConnect:xd,autoPanOnNodeDrag:vd,autoPanSpeed:wd,connectionRadius:bd,isValidConnection:Ed,onError:Sd,style:Cd,id:ts,nodeDragThreshold:_d,connectionDragThreshold:Nd,viewport:Md,onViewportChange:kd,width:Pd,height:Id,colorMode:Ad="light",debug:Rd,onScroll:vn,ariaLabelConfig:Td,zIndexMode:ns="basic",...Dd},jd){const wr=ts||"1",Od=$b(Ad),$d=x.useCallback(rs=>{rs.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),vn==null||vn(rs)},[vn]);return h.jsx("div",{"data-testid":"rf__wrapper",...Dd,onScroll:$d,style:{...Cd,...oE},ref:jd,className:ce(["react-flow",o,Od]),id:ts,role:"application",children:h.jsxs(rE,{nodes:e,edges:t,width:Pd,height:Id,fitView:Qo,fitViewOptions:Jo,minZoom:lt,maxZoom:Dt,nodeOrigin:At,nodeExtent:vr,zIndexMode:ns,children:[h.jsx(eE,{onInit:l,onNodeClick:a,onEdgeClick:c,onNodeMouseEnter:E,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:S,onNodeDoubleClick:_,nodeTypes:s,edgeTypes:i,connectionLineType:L,connectionLineStyle:B,connectionLineComponent:W,connectionLineContainerStyle:X,selectionKeyCode:G,selectionOnDrag:H,selectionMode:V,deleteKeyCode:U,multiSelectionKeyCode:Z,panActivationKeyCode:Q,zoomActivationKeyCode:K,onlyRenderVisibleElements:oe,defaultViewport:xn,translateExtent:Ko,minZoom:lt,maxZoom:Dt,preventScrolling:jl,zoomOnScroll:$l,zoomOnPinch:Ll,zoomOnDoubleClick:Bl,panOnScroll:Fl,panOnScrollSpeed:zl,panOnScrollMode:Hl,panOnDrag:Wl,onPaneClick:Vl,onPaneMouseEnter:Yl,onPaneMouseMove:Gl,onPaneMouseLeave:Xl,onPaneScroll:Ul,onPaneContextMenu:ql,paneClickDistance:Kl,nodeClickDistance:Zl,onSelectionContextMenu:j,onSelectionStart:I,onSelectionEnd:N,onReconnect:Jl,onReconnectStart:ed,onReconnectEnd:td,onEdgeContextMenu:nd,onEdgeDoubleClick:rd,onEdgeMouseEnter:od,onEdgeMouseMove:sd,onEdgeMouseLeave:id,reconnectRadius:ad,defaultMarkerColor:Ol,noDragClassName:ld,noWheelClassName:dd,noPanClassName:Zo,rfId:wr,disableKeyboardA11y:es,nodeExtent:vr,viewport:Md,onViewportChange:kd}),h.jsx(Ob,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:g,onConnectStart:p,onConnectEnd:m,onClickConnectStart:v,onClickConnectEnd:w,nodesDraggable:ue,autoPanOnNodeFocus:Ae,nodesConnectable:pe,nodesFocusable:Ke,edgesFocusable:Rt,edgesReconnectable:Tt,elementsSelectable:xr,elevateNodesOnSelect:md,elevateEdgesOnSelect:yd,minZoom:lt,maxZoom:Dt,nodeExtent:vr,onNodesChange:cd,onEdgesChange:ud,snapToGrid:q,snapGrid:ee,connectionMode:$,translateExtent:Ko,connectOnClick:fd,defaultEdgeOptions:gd,fitView:Qo,fitViewOptions:Jo,onNodesDelete:z,onEdgesDelete:A,onDelete:D,onNodeDragStart:M,onNodeDrag:P,onNodeDragStop:T,onSelectionDrag:R,onSelectionDragStart:C,onSelectionDragStop:k,onMove:d,onMoveStart:u,onMoveEnd:f,noPanClassName:Zo,nodeOrigin:At,rfId:wr,autoPanOnConnect:xd,autoPanOnNodeDrag:vd,autoPanSpeed:wd,onError:Sd,connectionRadius:bd,isValidConnection:Ed,selectNodesOnDrag:te,nodeDragThreshold:_d,connectionDragThreshold:Nd,onBeforeDelete:O,debug:Rd,ariaLabelConfig:Td,zIndexMode:ns}),h.jsx(Rb,{onSelectionChange:F}),Ql,h.jsx(Mb,{proOptions:pd,position:hd}),h.jsx(Nb,{rfId:wr,disableKeyboardA11y:es})]})})}var iE=il(sE);const aE=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function cE({children:e}){const t=J(aE);return t?zi.createPortal(e,t):null}function uE(e){const[t,n]=x.useState(e),r=x.useCallback(o=>n(s=>ol(o,s)),[]);return[t,n,r]}function lE(e){const[t,n]=x.useState(e),r=x.useCallback(o=>n(s=>sl(o,s)),[]);return[t,n,r]}function dE({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:ce(["react-flow__background-pattern",n,r])})}function fE({radius:e,className:t}){return h.jsx("circle",{cx:e,cy:e,r:e,className:ce(["react-flow__background-pattern","dots",t])})}var qe;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(qe||(qe={}));const hE={[qe.Dots]:1,[qe.Lines]:1,[qe.Cross]:6},pE=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Il({id:e,variant:t=qe.Dots,gap:n=20,size:r,lineWidth:o=1,offset:s=0,color:i,bgColor:a,style:c,className:l,patternClassName:d}){const u=x.useRef(null),{transform:f,patternId:g}=J(pE,se),p=r||hE[t],m=t===qe.Dots,v=t===qe.Cross,w=Array.isArray(n)?n:[n,n],E=[w[0]*f[2]||1,w[1]*f[2]||1],y=p*f[2],b=Array.isArray(s)?s:[s,s],S=v?[y,y]:E,_=[b[0]*f[2]||1+S[0]/2,b[1]*f[2]||1+S[1]/2],M=`${g}${e||""}`;return h.jsxs("svg",{className:ce(["react-flow__background",l]),style:{...c,...yr,"--xy-background-color-props":a,"--xy-background-pattern-color-props":i},ref:u,"data-testid":"rf__background",children:[h.jsx("pattern",{id:M,x:f[0]%E[0],y:f[1]%E[1],width:E[0],height:E[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${_[0]},-${_[1]})`,children:m?h.jsx(fE,{radius:y/2,className:d}):h.jsx(dE,{dimensions:S,lineWidth:o,variant:t,className:d})}),h.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${M})`})]})}Il.displayName="Background";const gE=x.memo(Il);function mE(){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 yE(){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 xE(){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 vE(){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 wE(){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 Tn({children:e,className:t,...n}){return h.jsx("button",{type:"button",className:ce(["react-flow__controls-button",t]),...n,children:e})}const bE=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Al({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:o,onZoomIn:s,onZoomOut:i,onFitView:a,onInteractiveChange:c,className:l,children:d,position:u="bottom-left",orientation:f="vertical","aria-label":g}){const p=ie(),{isInteractive:m,minZoomReached:v,maxZoomReached:w,ariaLabelConfig:E}=J(bE,se),{zoomIn:y,zoomOut:b,fitView:S}=Uo(),_=()=>{y(),s==null||s()},M=()=>{b(),i==null||i()},P=()=>{S(o),a==null||a()},T=()=>{p.setState({nodesDraggable:!m,nodesConnectable:!m,elementsSelectable:!m}),c==null||c(!m)},z=f==="horizontal"?"horizontal":"vertical";return h.jsxs(mn,{className:ce(["react-flow__controls",z,l]),position:u,style:e,"data-testid":"rf__controls","aria-label":g??E["controls.ariaLabel"],children:[t&&h.jsxs(h.Fragment,{children:[h.jsx(Tn,{onClick:_,className:"react-flow__controls-zoomin",title:E["controls.zoomIn.ariaLabel"],"aria-label":E["controls.zoomIn.ariaLabel"],disabled:w,children:h.jsx(mE,{})}),h.jsx(Tn,{onClick:M,className:"react-flow__controls-zoomout",title:E["controls.zoomOut.ariaLabel"],"aria-label":E["controls.zoomOut.ariaLabel"],disabled:v,children:h.jsx(yE,{})})]}),n&&h.jsx(Tn,{className:"react-flow__controls-fitview",onClick:P,title:E["controls.fitView.ariaLabel"],"aria-label":E["controls.fitView.ariaLabel"],children:h.jsx(xE,{})}),r&&h.jsx(Tn,{className:"react-flow__controls-interactive",onClick:T,title:E["controls.interactive.ariaLabel"],"aria-label":E["controls.interactive.ariaLabel"],children:m?h.jsx(wE,{}):h.jsx(vE,{})}),d]})}Al.displayName="Controls";const EE=x.memo(Al);function SE({id:e,x:t,y:n,width:r,height:o,style:s,color:i,strokeColor:a,strokeWidth:c,className:l,borderRadius:d,shapeRendering:u,selected:f,onClick:g}){const{background:p,backgroundColor:m}=s||{},v=i||p||m;return h.jsx("rect",{className:ce(["react-flow__minimap-node",{selected:f},l]),x:t,y:n,rx:d,ry:d,width:r,height:o,style:{fill:v,stroke:a,strokeWidth:c},shapeRendering:u,onClick:g?w=>g(w,e):void 0})}const CE=x.memo(SE),_E=e=>e.nodes.map(t=>t.id),Vr=e=>e instanceof Function?e:()=>e;function NE({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o,nodeComponent:s=CE,onClick:i}){const a=J(_E,se),c=Vr(t),l=Vr(e),d=Vr(n),u=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return h.jsx(h.Fragment,{children:a.map(f=>h.jsx(kE,{id:f,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:o,NodeComponent:s,onClick:i,shapeRendering:u},f))})}function ME({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:o,nodeStrokeWidth:s,shapeRendering:i,NodeComponent:a,onClick:c}){const{node:l,x:d,y:u,width:f,height:g}=J(p=>{const m=p.nodeLookup.get(e);if(!m)return{node:void 0,x:0,y:0,width:0,height:0};const v=m.internals.userNode,{x:w,y:E}=m.internals.positionAbsolute,{width:y,height:b}=We(v);return{node:v,x:w,y:E,width:y,height:b}},se);return!l||l.hidden||!Ru(l)?null:h.jsx(a,{x:d,y:u,width:f,height:g,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:o,strokeColor:n(l),strokeWidth:s,shapeRendering:i,onClick:c,id:l.id})}const kE=x.memo(ME);var PE=x.memo(NE);const IE=200,AE=150,RE=e=>!e.hidden,TE=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?Au(hn(e.nodeLookup,{filter:RE}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},DE="react-flow__minimap-desc";function Rl({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:o="",nodeBorderRadius:s=5,nodeStrokeWidth:i,nodeComponent:a,bgColor:c,maskColor:l,maskStrokeColor:d,maskStrokeWidth:u,position:f="bottom-right",onClick:g,onNodeClick:p,pannable:m=!1,zoomable:v=!1,ariaLabel:w,inversePan:E,zoomStep:y=1,offsetScale:b=5}){const S=ie(),_=x.useRef(null),{boundingRect:M,viewBB:P,rfId:T,panZoom:z,translateExtent:A,flowWidth:D,flowHeight:F,ariaLabelConfig:C}=J(TE,se),R=(e==null?void 0:e.width)??IE,k=(e==null?void 0:e.height)??AE,j=M.width/R,I=M.height/k,N=Math.max(j,I),O=N*R,$=N*k,L=b*N,B=M.x-(O-M.width)/2-L,W=M.y-($-M.height)/2-L,X=O+L*2,U=$+L*2,G=`${DE}-${T}`,H=x.useRef(0),V=x.useRef();H.current=N,x.useEffect(()=>{if(_.current&&z)return V.current=Xw({domNode:_.current,panZoom:z,getTransform:()=>S.getState().transform,getViewScale:()=>H.current}),()=>{var q;(q=V.current)==null||q.destroy()}},[z]),x.useEffect(()=>{var q;(q=V.current)==null||q.update({translateExtent:A,width:D,height:F,inversePan:E,pannable:m,zoomStep:y,zoomable:v})},[m,v,E,y,A,D,F]);const Q=g?q=>{var te;const[ee,oe]=((te=V.current)==null?void 0:te.pointer(q))||[0,0];g(q,{x:ee,y:oe})}:void 0,Z=p?x.useCallback((q,ee)=>{const oe=S.getState().nodeLookup.get(ee).internals.userNode;p(q,oe)},[]):void 0,K=w??C["minimap.ariaLabel"];return h.jsx(mn,{position:f,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 u=="number"?u*N: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 i=="number"?i:void 0},className:ce(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:h.jsxs("svg",{width:R,height:k,viewBox:`${B} ${W} ${X} ${U}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":G,ref:_,onClick:Q,children:[K&&h.jsx("title",{id:G,children:K}),h.jsx(PE,{onClick:Z,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:o,nodeStrokeWidth:i,nodeComponent:a}),h.jsx("path",{className:"react-flow__minimap-mask",d:`M${B-L},${W-L}h${X+L*2}v${U+L*2}h${-X-L*2}z
|
|
156
|
-
M${P.x},${P.y}h${P.width}v${P.height}h${-P.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Rl.displayName="MiniMap";x.memo(Rl);const jE=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,OE={[kt.Line]:"right",[kt.Handle]:"bottom-right"};function $E({nodeId:e,position:t,variant:n=kt.Handle,className:r,style:o=void 0,children:s,color:i,minWidth:a=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:u=!1,resizeDirection:f,autoScale:g=!0,shouldResize:p,onResizeStart:m,onResize:v,onResizeEnd:w}){const E=ll(),y=typeof e=="string"?e:E,b=ie(),S=x.useRef(null),_=n===kt.Handle,M=J(x.useCallback(jE(_&&g),[_,g]),se),P=x.useRef(null),T=t??OE[n];x.useEffect(()=>{if(!(!S.current||!y))return P.current||(P.current=ab({domNode:S.current,nodeId:y,getStoreItems:()=>{const{nodeLookup:A,transform:D,snapGrid:F,snapToGrid:C,nodeOrigin:R,domNode:k}=b.getState();return{nodeLookup:A,transform:D,snapGrid:F,snapToGrid:C,nodeOrigin:R,paneDomNode:k}},onChange:(A,D)=>{const{triggerNodeChanges:F,nodeLookup:C,parentLookup:R,nodeOrigin:k}=b.getState(),j=[],I={x:A.x,y:A.y},N=C.get(y);if(N&&N.expandParent&&N.parentId){const O=N.origin??k,$=A.width??N.measured.width??0,L=A.height??N.measured.height??0,B={id:N.id,parentId:N.parentId,rect:{width:$,height:L,...Tu({x:A.x??N.position.x,y:A.y??N.position.y},{width:$,height:L},N.parentId,C,O)}},W=Xo([B],C,R,k);j.push(...W),I.x=A.x?Math.max(O[0]*$,A.x):void 0,I.y=A.y?Math.max(O[1]*L,A.y):void 0}if(I.x!==void 0&&I.y!==void 0){const O={id:y,type:"position",position:{...I}};j.push(O)}if(A.width!==void 0&&A.height!==void 0){const $={id:y,type:"dimensions",resizing:!0,setAttributes:f?f==="horizontal"?"width":"height":!0,dimensions:{width:A.width,height:A.height}};j.push($)}for(const O of D){const $={...O,type:"position"};j.push($)}F(j)},onEnd:({width:A,height:D})=>{const F={id:y,type:"dimensions",resizing:!1,dimensions:{width:A,height:D}};b.getState().triggerNodeChanges([F])}})),P.current.update({controlPosition:T,boundaries:{minWidth:a,minHeight:c,maxWidth:l,maxHeight:d},keepAspectRatio:u,resizeDirection:f,onResizeStart:m,onResize:v,onResizeEnd:w,shouldResize:p}),()=>{var A;(A=P.current)==null||A.destroy()}},[T,a,c,l,d,u,m,v,w,p]);const z=T.split("-");return h.jsx("div",{className:ce(["react-flow__resize-control","nodrag",...z,n,r]),ref:S,style:{...o,scale:M,...i&&{[_?"backgroundColor":"borderColor"]:i}},children:s})}x.memo($E);const LE={NODE_WIDTH:220,NODE_HEIGHT:120,HORIZONTAL_SPACING:280,VERTICAL_SPACING:220,START_X:250,PARALLEL_GROUP_PADDING:25};function FE({data:e,selected:t}){var r,o,s,i;const n=e;return h.jsxs("div",{className:`relative ${n.className||""}`,style:{borderWidth:((r=n.nodeStyle)==null?void 0:r.borderWidth)??1,borderRadius:8,padding:12,width:220,borderStyle:"solid",backgroundColor:(o=n.nodeStyle)==null?void 0:o.backgroundColor,borderColor:((s=n.nodeStyle)==null?void 0:s.borderColor)??"#9ca3af",opacity:(i=n.nodeStyle)==null?void 0:i.opacity,boxShadow:t?"0 0 0 2px rgba(168, 85, 247, 0.5)":void 0},children:[n.label,h.jsx(we,{type:"target",position:Y.Top,className:"!bg-purple-500"}),h.jsx(we,{type:"source",position:Y.Bottom,className:"!bg-purple-500"}),h.jsx(we,{type:"source",position:Y.Left,id:"loop-out",className:"!bg-purple-500 !-left-1 !w-[6px] !h-[6px] !min-w-0 !min-h-0",style:{top:"30%"}}),h.jsx(we,{type:"target",position:Y.Left,id:"loop-in",className:"!bg-purple-500 !-left-1 !w-[6px] !h-[6px] !min-w-0 !min-h-0",style:{top:"70%"}})]})}function zE({data:e}){return h.jsx("div",{style:{width:e.groupWidth||200,height:e.groupHeight||100,position:"relative"},children:h.jsx("span",{style:{position:"absolute",top:8,left:12,fontSize:11,fontWeight:600,color:"rgba(59, 130, 246, 0.8)",textTransform:"uppercase",letterSpacing:"0.5px",pointerEvents:"none"},children:e.label})})}function HE({data:e,selected:t}){var o,s,i;const n=e,r=160;return h.jsxs("div",{className:`relative flex items-center justify-center ${n.className||""}`,style:{width:r,height:r},children:[h.jsx("div",{style:{width:r*.7,height:r*.7,transform:"rotate(45deg)",borderWidth:2,borderStyle:"solid",borderRadius:4,backgroundColor:(o=n.nodeStyle)==null?void 0:o.backgroundColor,borderColor:((s=n.nodeStyle)==null?void 0:s.borderColor)??"#ef4444",opacity:(i=n.nodeStyle)==null?void 0:i.opacity,boxShadow:t?"0 0 0 2px rgba(239, 68, 68, 0.5)":void 0}}),h.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-auto",style:{fontSize:11,fontWeight:600,padding:r*.25},title:typeof n.label=="string"?n.label:void 0,children:h.jsx("span",{className:"text-center line-clamp-3 overflow-hidden",children:n.label})}),h.jsx(we,{type:"target",position:Y.Top,className:"!bg-red-500"}),h.jsx(we,{type:"source",position:Y.Bottom,id:"bottom",className:"!bg-red-500"}),h.jsx(we,{type:"source",position:Y.Left,id:"left",className:"!bg-red-500"}),h.jsx(we,{type:"source",position:Y.Right,id:"right",className:"!bg-red-500"})]})}const BE={loopNode:FE,parallelGroup:zE,diamondNode:HE},WE=BE,Tl={strokeColor:"#6b7280",labelBgClass:"bg-gray-200 dark:bg-gray-700 text-black dark:text-gray-200 border-gray-400 dark:border-gray-500"};function VE(e=Tl){return function({id:n,sourceX:r,sourceY:o,targetX:s,targetY:i,label:a,markerEnd:c}){const d=i-o,u=`
|
|
157
|
-
M ${r} ${o}
|
|
158
|
-
C ${r-50} ${o},
|
|
159
|
-
${r-50} ${i},
|
|
160
|
-
${s} ${i}
|
|
161
|
-
`,f=r-50+5,g=o+d/2-12;return h.jsxs(h.Fragment,{children:[h.jsx(yn,{id:n,path:u,markerEnd:c,style:{stroke:e.strokeColor,strokeWidth:2}}),a&&h.jsx(cE,{children:h.jsx("div",{style:{position:"absolute",transform:`translate(-100%, -50%) translate(${f}px, ${g}px)`,pointerEvents:"all"},className:"nodrag nopan",children:h.jsx("span",{className:`px-1.5 py-0.5 text-[9px] font-bold rounded border whitespace-nowrap ${e.labelBgClass}`,children:a})})})]})}}const YE=VE(Tl),GE={selfLoop:YE};function XE(e){return e==="workflow_start"||e==="workflow_end"?"var(--node-bg-start)":e==="primitive"?"var(--node-bg-primitive)":e==="agent"?"var(--node-bg-agent)":e==="tool"?"var(--node-bg-tool)":e==="conditional"?"var(--node-bg-conditional)":"var(--node-bg-step)"}function UE(e){return e==="workflow_start"||e==="workflow_end"?"#60a5fa":e==="primitive"?"#f97316":e==="agent"?"#ec4899":e==="tool"?"#a855f7":e==="conditional"?"#ef4444":"#22c55e"}function qE(e){return{color:"hsl(var(--card-foreground))",backgroundColor:XE(e),borderColor:UE(e)}}function KE(e,t){return e==="workflow_start"?h.jsx(xf,{className:"h-3.5 w-3.5 text-blue-600 dark:text-blue-400"}):e==="workflow_end"?h.jsx(wf,{className:"h-3.5 w-3.5 text-blue-600 dark:text-blue-400"}):e==="primitive"?t==="sleep"?h.jsx(is,{className:"h-3.5 w-3.5 text-orange-600 dark:text-orange-400"}):t==="createHook"||t==="createWebhook"?h.jsx(Pf,{className:"h-3.5 w-3.5 text-orange-600 dark:text-orange-400"}):h.jsx(is,{className:"h-3.5 w-3.5 text-orange-600 dark:text-orange-400"}):e==="agent"?h.jsx("span",{className:"h-3.5 w-3.5 text-pink-600 dark:text-pink-400 text-xs",children:"🤖"}):e==="tool"?h.jsx("span",{className:"h-3.5 w-3.5 text-purple-600 dark:text-purple-400 text-xs",children:"🔧"}):e==="conditional"?h.jsx("span",{className:"h-3.5 w-3.5 text-red-600 dark:text-red-400 text-xs",children:"◇"}):h.jsx(yo,{className:"h-3.5 w-3.5 text-green-600 dark:text-green-400"})}function Dl(e,t=LE){var c,l,d,u,f;const n=e.nodes.map(g=>({...g})),r=[],o=[],s=new Map,i=new Map,a=new Map;for(const g of n){if((c=g.metadata)!=null&&c.parallelGroupId){const p=s.get(g.metadata.parallelGroupId)||{nodes:[],method:g.metadata.parallelMethod};p.nodes.push(g),s.set(g.metadata.parallelGroupId,p)}if((l=g.metadata)!=null&&l.loopId){const p=i.get(g.metadata.loopId)||[];p.push(g),i.set(g.metadata.loopId,p)}if((d=g.metadata)!=null&&d.conditionalId){const p=a.get(g.metadata.conditionalId)||{thenBranch:[],elseBranch:[]};g.metadata.conditionalBranch==="Then"?p.thenBranch.push(g):p.elseBranch.push(g),a.set(g.metadata.conditionalId,p)}}for(const[g,p]of s){const m=p.nodes;if(m.length===0)continue;const v=m[0].position.y;if(m.length>1){const _=t.HORIZONTAL_SPACING,M=(m.length-1)*_,P=t.START_X-M/2;m.forEach((T,z)=>{T.position={x:P+z*_,y:v}})}const w=Math.min(...m.map(_=>_.position.x)),E=Math.max(...m.map(_=>_.position.x)),y=p.method==="all"?"Promise.all":p.method==="race"?"Promise.race":p.method==="allSettled"?"Promise.allSettled":p.method==="any"?"Promise.any":"Parallel",b=E-w+t.NODE_WIDTH+t.PARALLEL_GROUP_PADDING*2,S=t.NODE_HEIGHT+t.PARALLEL_GROUP_PADDING*2;r.push({id:`group_${g}`,type:"group",position:{x:w-t.PARALLEL_GROUP_PADDING,y:v-t.PARALLEL_GROUP_PADDING},style:{width:b,height:S,backgroundColor:"rgba(59, 130, 246, 0.05)",border:"2px dashed rgba(59, 130, 246, 0.3)",borderRadius:12},data:{label:y,groupWidth:b,groupHeight:S}})}for(const[,g]of a){if([...g.thenBranch,...g.elseBranch].length<=1)continue;const m=g.thenBranch,v=g.elseBranch;if(m.length>0&&v.length>0){const w=Math.min(((u=m[0])==null?void 0:u.position.y)||0,((f=v[0])==null?void 0:f.position.y)||0);m.forEach((E,y)=>{E.position={x:100,y:w+y*120}}),v.forEach((E,y)=>{E.position={x:400,y:w+y*120}})}}for(const[,g]of i)if(g.length>0){const p=g.some(m=>{var v;return(v=m.metadata)==null?void 0:v.loopIsAwait});for(const m of g)o.push({id:`self_loop_${m.id}`,source:m.id,target:m.id,sourceHandle:"loop-out",targetHandle:"loop-in",type:"selfLoop",label:p?"await":"loop"})}return{nodes:n,groupNodes:r,additionalEdges:o}}function ZE(e,t){var i;const n=new Map;for(const a of t)(i=a.metadata)!=null&&i.parallelGroupId&&n.set(a.id,a.metadata.parallelGroupId);const r=new Map,o=[];for(const a of e){const c=n.get(a.source),l=n.get(a.target);if(c&&l&&c!==l){const d=`${c}->${l}`,u=r.get(d)||[];u.push(a),r.set(d,u)}else o.push(a)}const s=[...o];for(const[,a]of r)if(a.length>1){const c=[...new Set(a.map(d=>d.target))],l=a[0].source;for(const d of c){const u=a.find(g=>g.target===d),f=a.filter(g=>g.target===d).map(g=>g.id);s.push({...u,id:`consolidated_${l}_${d}`,source:l,target:d,isConsolidated:!0,originalEdgeIds:f})}}else s.push(...a);return s}function Oi(e){var a;const{nodes:t,groupNodes:n}=Dl(e),r=new Map,o=new Map;for(const c of n)c.id.startsWith("group_")&&o.set(c.id,c.position);for(const c of t){const l=(a=c.metadata)!=null&&a.parallelGroupId?`group_${c.metadata.parallelGroupId}`:null;l&&o.has(l)&&r.set(c.id,l)}const s=[],i=n.filter(c=>c.id.startsWith("group_"));for(const c of i)s.push({id:c.id,type:"parallelGroup",position:c.position,style:{...c.style,cursor:"grab",zIndex:-1},data:c.data,draggable:!0,selectable:!0});return t.forEach(c=>{const l=qE(c.data.nodeKind),d=c.metadata,u=!!(d!=null&&d.loopId),f=!!(d!=null&&d.loopIsAwait),g=c.data.nodeKind==="conditional";let p=g?"diamondNode":u?"loopNode":"default";c.type==="workflowStart"?p="input":c.type==="workflowEnd"&&(p="output");const m=[],v=r.get(c.id);let w=c.position;if(v){const y=o.get(v);y&&(w={x:c.position.x-y.x,y:c.position.y-y.y})}const E=h.jsxs("div",{className:"flex flex-col gap-1.5 w-full overflow-hidden",children:[h.jsxs("div",{className:"flex items-start gap-2 w-full overflow-hidden",children:[h.jsx("div",{className:"flex-shrink-0",children:KE(c.data.nodeKind,c.data.label)}),h.jsx("span",{className:"text-sm font-medium break-words whitespace-normal leading-tight flex-1 min-w-0",children:c.data.label})]}),m.length>0&&h.jsx("div",{className:"flex flex-wrap gap-1",children:m})]},`label-${c.id}`);u?s.push({id:c.id,type:p,position:w,parentId:v,extent:v?"parent":void 0,expandParent:!0,data:{...c.data,label:E,isLoopNode:!0,isAwaitLoop:f,nodeStyle:l}}):g?s.push({id:c.id,type:p,position:w,parentId:v,extent:v?"parent":void 0,expandParent:!0,data:{...c.data,label:c.data.label,nodeStyle:l}}):s.push({id:c.id,type:p,position:w,parentId:v,extent:v?"parent":void 0,expandParent:!0,data:{...c.data,label:E},style:{borderWidth:1,borderRadius:8,padding:12,width:220,...l}})}),s}function $i(e){const{additionalEdges:t}=Dl(e),r=[...e.edges.map(s=>s.type==="loop"?{...s,id:`loop_back_${s.source}_${s.target}`,isOriginal:!0}:{...s,isOriginal:!0}),...t.map(s=>({...s,isOriginal:!1}))];return ZE(r,e.nodes).map(s=>{if(s.type==="selfLoop")return{id:s.id,source:s.source,target:s.target,sourceHandle:s.sourceHandle,targetHandle:s.targetHandle,type:"selfLoop",label:s.label,markerEnd:{type:Ct.ArrowClosed,width:12,height:12,color:"#6b7280"}};const i="#6b7280";let a=1,c;const l=!1;let d=s.label,u="bezier",f=!1;switch(s.type){case"parallel":a=1.5,c="4,4",u="smoothstep",d=void 0;break;case"loop":a=2,c="8,4",u="step";break;case"conditional":c="8,4",u="smoothstep",f=!0;break;default:u="bezier";break}const g=f?"#ffffff":"#6b7280",p=f?"#374151":"#f3f4f6",m=f?"#4b5563":"#d1d5db";return{id:s.id,source:s.source,target:s.target,type:u,animated:l,label:d,labelStyle:{fill:g,fontWeight:500,fontSize:"11px"},labelBgPadding:[4,6],labelBgBorderRadius:4,labelBgStyle:{fill:p,fillOpacity:.95,stroke:m,strokeWidth:1},markerEnd:{type:Ct.ArrowClosed,width:12,height:12,color:i},style:{strokeWidth:a,stroke:i,strokeDasharray:c}}})}function wS({workflow:e}){const t=x.useMemo(()=>Oi(e),[e]),n=x.useMemo(()=>$i(e),[e]),[r,o,s]=uE(t),[i,a,c]=lE(n);return x.useEffect(()=>{o(Oi(e)),a($i(e))},[e,o,a]),h.jsx("div",{className:"h-full w-full border rounded-lg bg-background relative overflow-hidden",children:h.jsxs(iE,{nodes:r,edges:i,onNodesChange:s,onEdgesChange:c,nodeTypes:WE,edgeTypes:GE,fitView:!0,minZoom:.1,maxZoom:2,defaultViewport:{x:0,y:0,zoom:1},proOptions:{hideAttribution:!0},children:[h.jsx(gE,{}),h.jsx(EE,{}),h.jsx(mn,{position:"top-left",className:"bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 border rounded-lg p-3 text-xs",children:h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"space-y-1",children:[h.jsx("div",{className:"font-semibold text-[10px] text-muted-foreground mb-1.5",children:"Node Types"}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),h.jsx("span",{children:"Start / End"})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:"w-3 h-3 rounded-full bg-green-500"}),h.jsx("span",{children:"Step"})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),h.jsx("span",{children:"Primitive (sleep, hook)"})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),h.jsx("span",{children:"Conditional"})]})]}),h.jsxs("div",{className:"space-y-1 pt-2 border-t",children:[h.jsx("div",{className:"font-semibold text-[10px] text-muted-foreground mb-1.5",children:"Edge Types"}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:"w-8 h-0.5 bg-gray-500"}),h.jsx("span",{children:"Sequential"})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:"w-8 h-0.5",style:{backgroundImage:"repeating-linear-gradient(90deg, #6b7280, #6b7280 4px, transparent 4px, transparent 8px)"}}),h.jsx("span",{children:"Parallel / Loop / Conditional"})]})]})]})})]})})}export{rt as $,Ff as A,tS as B,mf as C,$g as D,Mf as E,hS as F,Vi as G,pS as H,r0 as I,wS as J,yS as K,xS as L,vS as M,oS as N,Gr as O,fe as P,nS as Q,sS as R,Rf as S,mS as T,Of as U,is as V,Io as W,Df as X,Kf as Y,yo as Z,Pe as _,lS as a,iS as a0,qr as a1,oh as a2,LE as a3,a0 as a4,gS as a5,s0 as a6,uS as b,zf as c,Hf as d,cS as e,Lg as f,dS as g,bc as h,Je as i,hf as j,c0 as k,Gh as l,Ma as m,Mc as n,df as o,rS as p,Bn as q,fS as r,Gi as s,rn as t,cn as u,ne as v,on as w,mh as x,o0 as y,i0 as z};
|