@decocms/mesh 1.10.0 → 1.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/dist/client/assets/{AlertCircle-DxJIdkjA.js → AlertCircle-fQ1a-Kye.js} +1 -1
  2. package/dist/client/assets/{ArrowLeft-CrgZDDUZ.js → ArrowLeft-BiKe-UDJ.js} +1 -1
  3. package/dist/client/assets/{ChevronDown-B2VaHCqC.js → ChevronDown-B3ly4A-X.js} +1 -1
  4. package/dist/client/assets/ChevronRight-CXZWZETT.js +1 -0
  5. package/dist/client/assets/{Copy01-DfnjsOeR.js → Copy01-CYicndkm.js} +1 -1
  6. package/dist/client/assets/DotsHorizontal-By0WO0xT.js +1 -0
  7. package/dist/client/assets/{DotsVertical-DIWcHGKr.js → DotsVertical-D6iehcQW.js} +1 -1
  8. package/dist/client/assets/{File06-DSeIH9xM.js → File06-BJJWTDds.js} +1 -1
  9. package/dist/client/assets/FilterLines-Bl9i76YX.js +1 -0
  10. package/dist/client/assets/{FlipBackward-s0RSv_vj.js → FlipBackward-h1suVrc9.js} +1 -1
  11. package/dist/client/assets/{GitBranch01-CeFBxnqq.js → GitBranch01-McK6f_RW.js} +1 -1
  12. package/dist/client/assets/{Grid01-Ch9rI6P9.js → Grid01-nuISl4Jo.js} +1 -1
  13. package/dist/client/assets/{Inbox01-7z9hTUsw.js → Inbox01-BXcb_6qt.js} +1 -1
  14. package/dist/client/assets/{InfoCircle-DQaxWpv9.js → InfoCircle-D8RiAWfe.js} +1 -1
  15. package/dist/client/assets/{Key01-CH9qCC00.js → Key01-BQ_2OE0w.js} +1 -1
  16. package/dist/client/assets/{LinkExternal01-DZDUBWQO.js → LinkExternal01-42UxL9hq.js} +1 -1
  17. package/dist/client/assets/{Loading01-B0dLQInZ.js → Loading01-BJF4I2Ad.js} +1 -1
  18. package/dist/client/assets/{Lock01-wpG8qO-9.js → Lock01-BrzFrmRw.js} +1 -1
  19. package/dist/client/assets/Play-MQJiRz2-.js +1 -0
  20. package/dist/client/assets/{Plus-D_XbrIfI.js → Plus-DMj-o9Gi.js} +1 -1
  21. package/dist/client/assets/{Terminal-BSL9-A7C.js → Terminal-CW45jfl-.js} +1 -1
  22. package/dist/client/assets/{Trash01-aTCf1hVv.js → Trash01-BmyJcEM6.js} +1 -1
  23. package/dist/client/assets/{X-BgwVwwIy.js → X-3dUB6f8T.js} +1 -1
  24. package/dist/client/assets/XClose-CCiTTWan.js +1 -0
  25. package/dist/client/assets/{alert-dialog-DIexFXOj.js → alert-dialog-B5AngVSr.js} +3 -3
  26. package/dist/client/assets/auth-bKqgeTR4.js +1 -0
  27. package/dist/client/assets/{auth-catchall-Cp5vKmTi.js → auth-catchall-nRP-qv3i.js} +1 -1
  28. package/dist/client/assets/{avatar-Bf0qQU4w.js → avatar-B3qfE1qj.js} +1 -1
  29. package/dist/client/assets/{badge-CgEtLuTw.js → badge-DnxI94Ef.js} +1 -1
  30. package/dist/client/assets/button-P1l4UZMh.js +1 -0
  31. package/dist/client/assets/{card-ciO_SNWh.js → card-DlmzE0V_.js} +1 -1
  32. package/dist/client/assets/checkbox-Da1a0gnC.js +1 -0
  33. package/dist/client/assets/{collection-detail-msiVYwQa.js → collection-detail-C-lRKJ6c.js} +4 -4
  34. package/dist/client/assets/collection-display-button-DEihXWWS.js +1 -0
  35. package/dist/client/assets/{collection-header-BkZGWAxm.js → collection-header-DldCjJ2b.js} +1 -1
  36. package/dist/client/assets/{collection-page-CREYFoHa.js → collection-page-DUqbzyRz.js} +1 -1
  37. package/dist/client/assets/collection-search-078Tk8ke.js +1 -0
  38. package/dist/client/assets/collection-tab-D9t_zdu8.js +1 -0
  39. package/dist/client/assets/{collection-table-wrapper-Dnmr37nE.js → collection-table-wrapper-s0V0lVte.js} +1 -1
  40. package/dist/client/assets/{connection-card-Dcrw1pJ1.js → connection-card-Bq4SPs9k.js} +1 -1
  41. package/dist/client/assets/connection-detail-G_uQHX56.js +1 -0
  42. package/dist/client/assets/connections-CjllWosN.js +1 -0
  43. package/dist/client/assets/constants--AQKkMmO.js +1 -0
  44. package/dist/client/assets/{create-organization-dialog-CYQoklT3.js → create-organization-dialog-BjXNKLri.js} +1 -1
  45. package/dist/client/assets/{dialog-D4dy2US8.js → dialog-DskfmP3S.js} +1 -1
  46. package/dist/client/assets/dropdown-menu-C_0icbcC.js +1 -0
  47. package/dist/client/assets/{empty-state-CA7indKP.js → empty-state-DGPTU48f.js} +1 -1
  48. package/dist/client/assets/env-vars-editor-DHPvpktS.js +1 -0
  49. package/dist/client/assets/{error-boundary-Ba_T3BIS.js → error-boundary-DVR3TWt5.js} +1 -1
  50. package/dist/client/assets/extract-connection-data-sl_xi-NX.js +1 -0
  51. package/dist/client/assets/{form-rbCVC2Lc.js → form-Dt7KStxI.js} +1 -1
  52. package/dist/client/assets/{formatDistanceToNow-Bsssu-td.js → formatDistanceToNow-CxdFFLDu.js} +1 -1
  53. package/dist/client/assets/gateway-detail-CQ2HJebN.js +1 -0
  54. package/dist/client/assets/gateway-selector-C50wFrLo.js +1 -0
  55. package/dist/client/assets/gateways-Brw5ylzi.js +1 -0
  56. package/dist/client/assets/github-icon-BrF3LMLL.js +1 -0
  57. package/dist/client/assets/{home-0xYKq0nN.js → home-DT_gtVKG.js} +1 -1
  58. package/dist/client/assets/index-BjKus4OW.css +1 -0
  59. package/dist/client/assets/{index-BGmLHZvN.js → index-CQ5PpV5-.js} +5 -5
  60. package/dist/client/assets/index-DB3jkZVV.js +1 -0
  61. package/dist/client/assets/{index-B9fZ40p9.js → index-JM_K-0vS.js} +21 -21
  62. package/dist/client/assets/{input-C3lfdgit.js → input-lEjyv7_t.js} +1 -1
  63. package/dist/client/assets/{layout-BgUF9JkX.js → layout-Mi4JIpR6.js} +1 -1
  64. package/dist/client/assets/{lazy-highlighter-Buv6v3mS.js → lazy-highlighter-6XYxZAuO.js} +1 -1
  65. package/dist/client/assets/{localstorage-keys-BGRuWcRT.js → localstorage-keys-DmEm8_Oa.js} +1 -1
  66. package/dist/client/assets/{login-fFNSXfGP.js → login-DaHhOJbN.js} +1 -1
  67. package/dist/client/assets/{mcp-oauth-DacADfyW.js → mcp-oauth-CK__gbJ2.js} +1 -1
  68. package/dist/client/assets/mcp-server-detail-DERmLIXK.js +1 -0
  69. package/dist/client/assets/members-DzWV9w7S.js +3 -0
  70. package/dist/client/assets/{monaco-editor-uZe9l_bJ.js → monaco-editor-B-DMAUS8.js} +4 -4
  71. package/dist/client/assets/monitoring-Bw9ECV_3.js +49 -0
  72. package/dist/client/assets/{oauth-callback-zUOuo71p.js → oauth-callback-ChEIlyyo.js} +1 -1
  73. package/dist/client/assets/page-DNqUgOCd.js +1 -0
  74. package/dist/client/assets/page-DieG1pN7.js +35 -0
  75. package/dist/client/assets/pin-to-sidebar-button-CbQe-lRF.js +1 -0
  76. package/dist/client/assets/popover-D51HT9Xp.js +1 -0
  77. package/dist/client/assets/project-context-provider-DxPsvg7o.js +1 -0
  78. package/dist/client/assets/resizable-uj7Ud0Nv.js +1 -0
  79. package/dist/client/assets/{resource-tabs-ltvgVmlK.js → resource-tabs-mvYm33c6.js} +1 -1
  80. package/dist/client/assets/select-DDRl1Qvs.js +1 -0
  81. package/dist/client/assets/settings-BFSp8ZnH.js +1 -0
  82. package/dist/client/assets/shell-layout-DsOoA3nx.js +19 -0
  83. package/dist/client/assets/{spinner-CDnZnQfr.js → spinner-pX_8yHq8.js} +1 -1
  84. package/dist/client/assets/switch-6o4pER7R.js +1 -0
  85. package/dist/client/assets/{textarea-CvmD-TCl.js → textarea-BIJ4bnK1.js} +1 -1
  86. package/dist/client/assets/{thread-history-popover-BQKKEP-v.js → thread-history-popover-BLJ6aCqn.js} +37 -37
  87. package/dist/client/assets/tools-list-K2fXAvZZ.js +1 -0
  88. package/dist/client/assets/{use-binding-BWHEOuVA.js → use-binding-DODEZIVG.js} +1 -1
  89. package/dist/client/assets/use-connection-BLmwBfcI.js +2 -0
  90. package/dist/client/assets/{use-connection-resources-DbXXhKLF.js → use-connection-resources-CFssgYId.js} +1 -1
  91. package/dist/client/assets/use-gateway-C8PgG30I.js +1 -0
  92. package/dist/client/assets/{use-list-state-vrSW0egR.js → use-list-state-CNyb0sVm.js} +1 -1
  93. package/dist/client/assets/{use-mcp-BXJqKT0W.js → use-mcp-askdlkSn.js} +1 -1
  94. package/dist/client/assets/use-members-MyMMikAQ.js +1 -0
  95. package/dist/client/assets/{use-mobile-CG0P5-tt.js → use-mobile-aroC6xLW.js} +1 -1
  96. package/dist/client/assets/{use-organization-settings-jxyxG3Do.js → use-organization-settings-447_kc1C.js} +1 -1
  97. package/dist/client/assets/{use-tool-call-vWU--CYB.js → use-tool-call-9WIw8dXG.js} +1 -1
  98. package/dist/client/assets/useQuery-CVizz7NG.js +1 -0
  99. package/dist/client/assets/value-DFuI_KD4.js +1 -0
  100. package/dist/client/assets/{view-mode-toggle-CTKggGXJ.js → view-mode-toggle-B2u6HchE.js} +1 -1
  101. package/dist/client/assets/{well-known-mcp-VNRT0JrW.js → well-known-mcp-D13f-8h2.js} +1 -1
  102. package/dist/client/assets/workflow-dtZDbGNi.js +1 -0
  103. package/dist/client/index.html +2 -2
  104. package/dist/server/cli.js +151 -151
  105. package/dist/server/migrate.js +1 -1
  106. package/dist/server/server.js +148 -148
  107. package/package.json +2 -3
  108. package/dist/client/assets/Clock-CafJ8d76.js +0 -1
  109. package/dist/client/assets/Code01-BHMAmoGH.js +0 -1
  110. package/dist/client/assets/CpuChip02-qVpLCR0_.js +0 -1
  111. package/dist/client/assets/Play-DSXQEflq.js +0 -1
  112. package/dist/client/assets/SearchMd-BJbLhbUT.js +0 -1
  113. package/dist/client/assets/XClose-sskkBH5X.js +0 -1
  114. package/dist/client/assets/auth-BnF0Tfz9.js +0 -1
  115. package/dist/client/assets/button-O0CudEuW.js +0 -1
  116. package/dist/client/assets/checkbox-DUc30Qpz.js +0 -1
  117. package/dist/client/assets/collection-display-button-BVgPIpv0.js +0 -1
  118. package/dist/client/assets/collection-search-s9G5Psps.js +0 -1
  119. package/dist/client/assets/collection-tab-T_hhyR7G.js +0 -1
  120. package/dist/client/assets/connection-detail-ByP6chqW.js +0 -1
  121. package/dist/client/assets/connections-DYOzkJYx.js +0 -1
  122. package/dist/client/assets/constants-BG4081pg.js +0 -1
  123. package/dist/client/assets/dropdown-menu-DjELCVXr.js +0 -1
  124. package/dist/client/assets/env-vars-editor-CFmirc3J.js +0 -1
  125. package/dist/client/assets/extract-connection-data-Bm1qZWCV.js +0 -1
  126. package/dist/client/assets/gateway-detail-JYrV5S3_.js +0 -1
  127. package/dist/client/assets/gateways--haP9jLk.js +0 -1
  128. package/dist/client/assets/index-BNguAQBW.js +0 -1
  129. package/dist/client/assets/index-C9WZdaPe.js +0 -1
  130. package/dist/client/assets/index-CmUsR6rx.css +0 -1
  131. package/dist/client/assets/members-CAufZALX.js +0 -3
  132. package/dist/client/assets/monitoring-DTJtueom.js +0 -4
  133. package/dist/client/assets/page-BP6lcPxY.js +0 -21
  134. package/dist/client/assets/pin-to-sidebar-button-DcWM6FTO.js +0 -1
  135. package/dist/client/assets/popover-BRnyFKtN.js +0 -1
  136. package/dist/client/assets/registry-utils-ulDDT0d8.js +0 -1
  137. package/dist/client/assets/resizable-Bcc9SJfZ.js +0 -1
  138. package/dist/client/assets/responsive-select-BbaQnOfE.js +0 -1
  139. package/dist/client/assets/select-Dsuiuagq.js +0 -1
  140. package/dist/client/assets/settings-Br4mx_yy.js +0 -1
  141. package/dist/client/assets/shell-layout-CM_S8ji4.js +0 -19
  142. package/dist/client/assets/store-CJqU95FV.js +0 -1
  143. package/dist/client/assets/store-app-detail-Bb4mx26e.js +0 -1
  144. package/dist/client/assets/switch-DhyQ2_hE.js +0 -1
  145. package/dist/client/assets/tools-list-zpc-T8zT.js +0 -1
  146. package/dist/client/assets/tooltip-DaImUyOX.js +0 -1
  147. package/dist/client/assets/types-BDHiECry.js +0 -46
  148. package/dist/client/assets/use-connection-9XNP6qUi.js +0 -2
  149. package/dist/client/assets/use-gateway-BU92tNo7.js +0 -1
  150. package/dist/client/assets/use-members-eTAFi1HF.js +0 -1
  151. package/dist/client/assets/useQuery-nlt5lRkW.js +0 -1
  152. package/dist/client/assets/useSuspenseInfiniteQuery-o35GYPjZ.js +0 -1
  153. package/dist/client/assets/workflow-DTYA39cO.js +0 -1
@@ -1,21 +0,0 @@
1
- import{r as C,z as Wn,j as h,B as Tn,E as rc,F as ue,H as sc,I as Or,J as ic,L as ac,M as cc,i as lc,c as se,Q as uc,f as ye,V as Zn}from"./index-B9fZ40p9.js";import{u as nn,c as je,I as He,n as Gt}from"./use-connection-9XNP6qUi.js";import{C as dc}from"./collection-header-BkZGWAxm.js";import{C as fc}from"./collection-page-CREYFoHa.js";import{E as Ye}from"./error-boundary-Ba_T3BIS.js";import{u as Te}from"./use-tool-call-vWU--CYB.js";import{u as Se}from"./tooltip-DaImUyOX.js";import{c as on,B as An}from"./button-O0CudEuW.js";import{V as hc}from"./view-mode-toggle-CTKggGXJ.js";import{i as mc}from"./GitBranch01-CeFBxnqq.js";import{s as Rr}from"./Plus-D_XbrIfI.js";import{i as Hr}from"./CpuChip02-qVpLCR0_.js";import{u as Vr}from"./use-gateway-BU92tNo7.js";import{i as ze,a as ko,b as gc,c as Po,d as bn,e as _n,f as Br,s as Fr,D as Kn,g as Gr,h as pc,Z as Un,L as Qn,u as Xr,j as yc,k as xc,l as Dn,m as Yr,n as Jn,o as qr,p as Wr,q as Zr,r as vc,t as wc,v as bc,w as jo,x as _c,y as Kr,z as Ur,R as Sc,S as Nc,A as Ec,B as Qr,C as Cc,E as Mc,F as Ic,G as kc,H as Pc,I as jc,J as Jr,K as To,M as Tc,N as Ac,O as ct,P as Dc,Q as Lc,T as $c,U as zc,V as Oc,W as Rc,X as Hc,Y as Vc,_ as Bc,$ as Ae,a0 as Fc,a1 as Gc,a2 as rn}from"./types-BDHiECry.js";import{B as Xc}from"./badge-CgEtLuTw.js";import"./collection-display-button-BVgPIpv0.js";import"./dropdown-menu-DjELCVXr.js";import"./Grid01-Ch9rI6P9.js";import"./useQuery-nlt5lRkW.js";import"./index-C9WZdaPe.js";import"./popover-BRnyFKtN.js";import"./Copy01-DfnjsOeR.js";import"./Key01-CH9qCC00.js";import"./Play-DSXQEflq.js";import"./monaco-editor-uZe9l_bJ.js";import"./spinner-CDnZnQfr.js";const es=({size:e=24,color:t="currentColor",...n})=>C.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},C.createElement("path",{d:"M18 20V10m-6 10V4M6 20v-6"}));es.displayName="BarChart01";const ts=({size:e=24,color:t="currentColor",...n})=>C.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},C.createElement("path",{d:"M5.52 2.64 3.96 4.72c-.309.412-.463.618-.46.79a.5.5 0 0 0 .192.384C3.828 6 4.085 6 4.6 6h14.8c.515 0 .773 0 .908-.106a.5.5 0 0 0 .192-.384c.003-.172-.151-.378-.46-.79l-1.56-2.08m-12.96 0c.176-.235.264-.352.376-.437a1 1 0 0 1 .33-.165C6.36 2 6.505 2 6.8 2h10.4c.293 0 .44 0 .575.038a1 1 0 0 1 .33.165c.111.085.199.202.375.437m-12.96 0L3.64 5.147c-.237.316-.356.475-.44.649a2 2 0 0 0-.163.487C3 6.473 3 6.671 3 7.067V18.8c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C4.52 22 5.08 22 6.2 22h11.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C21 20.48 21 19.92 21 18.8V7.067c0-.396 0-.594-.037-.784a1.998 1.998 0 0 0-.163-.487c-.084-.174-.203-.333-.44-.65L18.48 2.64M16 10a4 4 0 1 1-8 0"}));ts.displayName="ShoppingBag01";function De(){const e=new Date,t=new Date;t.setHours(e.getHours()-24),t.setSeconds(0,0);const n=new Date(e);return n.setHours(n.getHours()+1),n.setSeconds(0,0),{startDate:t.toISOString(),endDate:n.toISOString()}}var ns="Toggle",os=C.forwardRef((e,t)=>{const{pressed:n,defaultPressed:o,onPressedChange:r,...s}=e,[i,a]=Wn({prop:n,onChange:r,defaultProp:o??!1,caller:ns});return h.jsx(Tn.button,{type:"button","aria-pressed":i,"data-state":i?"on":"off","data-disabled":e.disabled?"":void 0,...s,ref:t,onClick:rc(e.onClick,()=>{e.disabled||a(!i)})})});os.displayName=ns;var Le="ToggleGroup",[rs]=sc(Le,[Or]),ss=Or(),eo=ue.forwardRef((e,t)=>{const{type:n,...o}=e;if(n==="single"){const r=o;return h.jsx(Yc,{...r,ref:t})}if(n==="multiple"){const r=o;return h.jsx(qc,{...r,ref:t})}throw new Error(`Missing prop \`type\` expected on \`${Le}\``)});eo.displayName=Le;var[is,as]=rs(Le),Yc=ue.forwardRef((e,t)=>{const{value:n,defaultValue:o,onValueChange:r=()=>{},...s}=e,[i,a]=Wn({prop:n,defaultProp:o??"",onChange:r,caller:Le});return h.jsx(is,{scope:e.__scopeToggleGroup,type:"single",value:ue.useMemo(()=>i?[i]:[],[i]),onItemActivate:a,onItemDeactivate:ue.useCallback(()=>a(""),[a]),children:h.jsx(cs,{...s,ref:t})})}),qc=ue.forwardRef((e,t)=>{const{value:n,defaultValue:o,onValueChange:r=()=>{},...s}=e,[i,a]=Wn({prop:n,defaultProp:o??[],onChange:r,caller:Le}),l=ue.useCallback(u=>a((d=[])=>[...d,u]),[a]),c=ue.useCallback(u=>a((d=[])=>d.filter(f=>f!==u)),[a]);return h.jsx(is,{scope:e.__scopeToggleGroup,type:"multiple",value:i,onItemActivate:l,onItemDeactivate:c,children:h.jsx(cs,{...s,ref:t})})});eo.displayName=Le;var[Wc,Zc]=rs(Le),cs=ue.forwardRef((e,t)=>{const{__scopeToggleGroup:n,disabled:o=!1,rovingFocus:r=!0,orientation:s,dir:i,loop:a=!0,...l}=e,c=ss(n),u=ac(i),d={role:"group",dir:u,...l};return h.jsx(Wc,{scope:n,rovingFocus:r,disabled:o,children:r?h.jsx(cc,{asChild:!0,...c,orientation:s,dir:u,loop:a,children:h.jsx(Tn.div,{...d,ref:t})}):h.jsx(Tn.div,{...d,ref:t})})}),Xt="ToggleGroupItem",ls=ue.forwardRef((e,t)=>{const n=as(Xt,e.__scopeToggleGroup),o=Zc(Xt,e.__scopeToggleGroup),r=ss(e.__scopeToggleGroup),s=n.value.includes(e.value),i=o.disabled||e.disabled,a={...e,pressed:s,disabled:i},l=ue.useRef(null);return o.rovingFocus?h.jsx(ic,{asChild:!0,...r,focusable:!i,active:s,ref:l,children:h.jsx(Ao,{...a,ref:t})}):h.jsx(Ao,{...a,ref:t})});ls.displayName=Xt;var Ao=ue.forwardRef((e,t)=>{const{__scopeToggleGroup:n,value:o,...r}=e,s=as(Xt,n),i={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},a=s.type==="single"?i:void 0;return h.jsx(os,{...a,...r,ref:t,onPressedChange:l=>{l?s.onItemActivate(o):s.onItemDeactivate(o)}})}),Kc=eo,Uc=ls;const Qc=lc("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-2 min-w-9",sm:"h-7 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}}),us=C.createContext({size:"default",variant:"default"});function ds(e){const t=se.c(20);let n,o,r,s,i;t[0]!==e?({className:o,variant:i,size:s,children:n,...r}=e,t[0]=e,t[1]=n,t[2]=o,t[3]=r,t[4]=s,t[5]=i):(n=t[1],o=t[2],r=t[3],s=t[4],i=t[5]);let a;t[6]!==o?(a=on("group/toggle-group flex w-fit items-center rounded-md data-[variant=outline]:shadow-xs",o),t[6]=o,t[7]=a):a=t[7];let l;t[8]!==s||t[9]!==i?(l={variant:i,size:s},t[8]=s,t[9]=i,t[10]=l):l=t[10];let c;t[11]!==n||t[12]!==l?(c=h.jsx(us.Provider,{value:l,children:n}),t[11]=n,t[12]=l,t[13]=c):c=t[13];let u;return t[14]!==r||t[15]!==s||t[16]!==a||t[17]!==c||t[18]!==i?(u=h.jsx(Kc,{"data-slot":"toggle-group","data-variant":i,"data-size":s,className:a,...r,children:c}),t[14]=r,t[15]=s,t[16]=a,t[17]=c,t[18]=i,t[19]=u):u=t[19],u}function Ze(e){const t=se.c(18);let n,o,r,s,i;t[0]!==e?({className:o,children:n,variant:i,size:s,...r}=e,t[0]=e,t[1]=n,t[2]=o,t[3]=r,t[4]=s,t[5]=i):(n=t[1],o=t[2],r=t[3],s=t[4],i=t[5]);const a=C.useContext(us),l=a.variant||i,c=a.size||s;let u;t[6]!==o||t[7]!==a.size||t[8]!==a.variant||t[9]!==s||t[10]!==i?(u=on(Qc({variant:a.variant||i,size:a.size||s}),"min-w-0 flex-1 shrink-0 rounded-none shadow-none first:rounded-l-md last:rounded-r-md focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0 data-[variant=outline]:first:border-l",o),t[6]=o,t[7]=a.size,t[8]=a.variant,t[9]=s,t[10]=i,t[11]=u):u=t[11];let d;return t[12]!==n||t[13]!==r||t[14]!==l||t[15]!==c||t[16]!==u?(d=h.jsx(Uc,{"data-slot":"toggle-group-item","data-variant":l,"data-size":c,className:u,...r,children:n}),t[12]=n,t[13]=r,t[14]=l,t[15]=c,t[16]=u,t[17]=d):d=t[17],d}function ie(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n<e.length;n++)(o=ie(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Jc={value:()=>{}};function sn(){for(var e=0,t=arguments.length,n={},o;e<t;++e){if(!(o=arguments[e]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new zt(n)}function zt(e){this._=e}function el(e,t){return e.trim().split(/^|\s+/).map(function(n){var o="",r=n.indexOf(".");if(r>=0&&(o=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}zt.prototype=sn.prototype={constructor:zt,on:function(e,t){var n=this._,o=el(e+"",n),r,s=-1,i=o.length;if(arguments.length<2){for(;++s<i;)if((r=(e=o[s]).type)&&(r=tl(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<i;)if(r=(e=o[s]).type)n[r]=Do(n[r],e.name,t);else if(t==null)for(r in n)n[r]=Do(n[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new zt(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,s;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],o=0,r=s.length;o<r;++o)s[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,s=o.length;r<s;++r)o[r].value.apply(t,n)}};function tl(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function Do(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=Jc,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var Ln="http://www.w3.org/1999/xhtml";const Lo={svg:"http://www.w3.org/2000/svg",xhtml:Ln,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function an(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Lo.hasOwnProperty(t)?{space:Lo[t],local:e}:e}function nl(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Ln&&t.documentElement.namespaceURI===Ln?t.createElement(e):t.createElementNS(n,e)}}function ol(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function fs(e){var t=an(e);return(t.local?ol:nl)(t)}function rl(){}function to(e){return e==null?rl:function(){return this.querySelector(e)}}function sl(e){typeof e!="function"&&(e=to(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=new Array(i),l,c,u=0;u<i;++u)(l=s[u])&&(c=e.call(l,l.__data__,u,s))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new le(o,this._parents)}function il(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function al(){return[]}function hs(e){return e==null?al:function(){return this.querySelectorAll(e)}}function cl(e){return function(){return il(e.apply(this,arguments))}}function ll(e){typeof e=="function"?e=cl(e):e=hs(e);for(var t=this._groups,n=t.length,o=[],r=[],s=0;s<n;++s)for(var i=t[s],a=i.length,l,c=0;c<a;++c)(l=i[c])&&(o.push(e.call(l,l.__data__,c,i)),r.push(l));return new le(o,r)}function ms(e){return function(){return this.matches(e)}}function gs(e){return function(t){return t.matches(e)}}var ul=Array.prototype.find;function dl(e){return function(){return ul.call(this.children,e)}}function fl(){return this.firstElementChild}function hl(e){return this.select(e==null?fl:dl(typeof e=="function"?e:gs(e)))}var ml=Array.prototype.filter;function gl(){return Array.from(this.children)}function pl(e){return function(){return ml.call(this.children,e)}}function yl(e){return this.selectAll(e==null?gl:pl(typeof e=="function"?e:gs(e)))}function xl(e){typeof e!="function"&&(e=ms(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=[],l,c=0;c<i;++c)(l=s[c])&&e.call(l,l.__data__,c,s)&&a.push(l);return new le(o,this._parents)}function ps(e){return new Array(e.length)}function vl(){return new le(this._enter||this._groups.map(ps),this._parents)}function Yt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Yt.prototype={constructor:Yt,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 wl(e){return function(){return e}}function bl(e,t,n,o,r,s){for(var i=0,a,l=t.length,c=s.length;i<c;++i)(a=t[i])?(a.__data__=s[i],o[i]=a):n[i]=new Yt(e,s[i]);for(;i<l;++i)(a=t[i])&&(r[i]=a)}function _l(e,t,n,o,r,s,i){var a,l,c=new Map,u=t.length,d=s.length,f=new Array(u),g;for(a=0;a<u;++a)(l=t[a])&&(f[a]=g=i.call(l,l.__data__,a,t)+"",c.has(g)?r[a]=l:c.set(g,l));for(a=0;a<d;++a)g=i.call(e,s[a],a,s)+"",(l=c.get(g))?(o[a]=l,l.__data__=s[a],c.delete(g)):n[a]=new Yt(e,s[a]);for(a=0;a<u;++a)(l=t[a])&&c.get(f[a])===l&&(r[a]=l)}function Sl(e){return e.__data__}function Nl(e,t){if(!arguments.length)return Array.from(this,Sl);var n=t?_l:bl,o=this._parents,r=this._groups;typeof e!="function"&&(e=wl(e));for(var s=r.length,i=new Array(s),a=new Array(s),l=new Array(s),c=0;c<s;++c){var u=o[c],d=r[c],f=d.length,g=El(e.call(u,u&&u.__data__,c,o)),m=g.length,y=a[c]=new Array(m),v=i[c]=new Array(m),x=l[c]=new Array(f);n(u,d,y,v,x,g,t);for(var _=0,p=0,w,M;_<m;++_)if(w=y[_]){for(_>=p&&(p=_+1);!(M=v[p])&&++p<m;);w._next=M||null}}return i=new le(i,o),i._enter=a,i._exit=l,i}function El(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Cl(){return new le(this._exit||this._groups.map(ps),this._parents)}function Ml(e,t,n){var o=this.enter(),r=this,s=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?s.remove():n(s),o&&r?o.merge(r).order():r}function Il(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,s=o.length,i=Math.min(r,s),a=new Array(r),l=0;l<i;++l)for(var c=n[l],u=o[l],d=c.length,f=a[l]=new Array(d),g,m=0;m<d;++m)(g=c[m]||u[m])&&(f[m]=g);for(;l<r;++l)a[l]=n[l];return new le(a,this._parents)}function kl(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,s=o[r],i;--r>=0;)(i=o[r])&&(s&&i.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(i,s),s=i);return this}function Pl(e){e||(e=jl);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,o=n.length,r=new Array(o),s=0;s<o;++s){for(var i=n[s],a=i.length,l=r[s]=new Array(a),c,u=0;u<a;++u)(c=i[u])&&(l[u]=c);l.sort(t)}return new le(r,this._parents).order()}function jl(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Tl(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Al(){return Array.from(this)}function Dl(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,s=o.length;r<s;++r){var i=o[r];if(i)return i}return null}function Ll(){let e=0;for(const t of this)++e;return e}function $l(){return!this.node()}function zl(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],s=0,i=r.length,a;s<i;++s)(a=r[s])&&e.call(a,a.__data__,s,r);return this}function Ol(e){return function(){this.removeAttribute(e)}}function Rl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Hl(e,t){return function(){this.setAttribute(e,t)}}function Vl(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Bl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Fl(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 Gl(e,t){var n=an(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?Rl:Ol:typeof t=="function"?n.local?Fl:Bl:n.local?Vl:Hl)(n,t))}function ys(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Xl(e){return function(){this.style.removeProperty(e)}}function Yl(e,t,n){return function(){this.style.setProperty(e,t,n)}}function ql(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Wl(e,t,n){return arguments.length>1?this.each((t==null?Xl:typeof t=="function"?ql:Yl)(e,t,n??"")):Ue(this.node(),e)}function Ue(e,t){return e.style.getPropertyValue(t)||ys(e).getComputedStyle(e,null).getPropertyValue(t)}function Zl(e){return function(){delete this[e]}}function Kl(e,t){return function(){this[e]=t}}function Ul(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Ql(e,t){return arguments.length>1?this.each((t==null?Zl:typeof t=="function"?Ul:Kl)(e,t)):this.node()[e]}function xs(e){return e.trim().split(/^|\s+/)}function no(e){return e.classList||new vs(e)}function vs(e){this._node=e,this._names=xs(e.getAttribute("class")||"")}vs.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function ws(e,t){for(var n=no(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function bs(e,t){for(var n=no(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function Jl(e){return function(){ws(this,e)}}function eu(e){return function(){bs(this,e)}}function tu(e,t){return function(){(t.apply(this,arguments)?ws:bs)(this,e)}}function nu(e,t){var n=xs(e+"");if(arguments.length<2){for(var o=no(this.node()),r=-1,s=n.length;++r<s;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?tu:t?Jl:eu)(n,t))}function ou(){this.textContent=""}function ru(e){return function(){this.textContent=e}}function su(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function iu(e){return arguments.length?this.each(e==null?ou:(typeof e=="function"?su:ru)(e)):this.node().textContent}function au(){this.innerHTML=""}function cu(e){return function(){this.innerHTML=e}}function lu(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function uu(e){return arguments.length?this.each(e==null?au:(typeof e=="function"?lu:cu)(e)):this.node().innerHTML}function du(){this.nextSibling&&this.parentNode.appendChild(this)}function fu(){return this.each(du)}function hu(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function mu(){return this.each(hu)}function gu(e){var t=typeof e=="function"?e:fs(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function pu(){return null}function yu(e,t){var n=typeof e=="function"?e:fs(e),o=t==null?pu:typeof t=="function"?t:to(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function xu(){var e=this.parentNode;e&&e.removeChild(this)}function vu(){return this.each(xu)}function wu(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function bu(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function _u(e){return this.select(e?bu:wu)}function Su(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Nu(e){return function(t){e.call(this,t,this.__data__)}}function Eu(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function Cu(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,s;n<r;++n)s=t[n],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++o]=s;++o?t.length=o:delete this.__on}}}function Mu(e,t,n){return function(){var o=this.__on,r,s=Nu(t);if(o){for(var i=0,a=o.length;i<a;++i)if((r=o[i]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=s,r.options=n),r.value=t;return}}this.addEventListener(e.type,s,n),r={type:e.type,name:e.name,value:t,listener:s,options:n},o?o.push(r):this.__on=[r]}}function Iu(e,t,n){var o=Eu(e+""),r,s=o.length,i;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(r=0,u=a[l];r<s;++r)if((i=o[r]).type===u.type&&i.name===u.name)return u.value}return}for(a=t?Mu:Cu,r=0;r<s;++r)this.each(a(o[r],t,n));return this}function _s(e,t,n){var o=ys(e),r=o.CustomEvent;typeof r=="function"?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function ku(e,t){return function(){return _s(this,e,t)}}function Pu(e,t){return function(){return _s(this,e,t.apply(this,arguments))}}function ju(e,t){return this.each((typeof t=="function"?Pu:ku)(e,t))}function*Tu(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,s=o.length,i;r<s;++r)(i=o[r])&&(yield i)}var Ss=[null];function le(e,t){this._groups=e,this._parents=t}function St(){return new le([[document.documentElement]],Ss)}function Au(){return this}le.prototype=St.prototype={constructor:le,select:sl,selectAll:ll,selectChild:hl,selectChildren:yl,filter:xl,data:Nl,enter:vl,exit:Cl,join:Ml,merge:Il,selection:Au,order:kl,sort:Pl,call:Tl,nodes:Al,node:Dl,size:Ll,empty:$l,each:zl,attr:Gl,style:Wl,property:Ql,classed:nu,text:iu,html:uu,raise:fu,lower:mu,append:gu,insert:yu,remove:vu,clone:_u,datum:Su,on:Iu,dispatch:ju,[Symbol.iterator]:Tu};function ce(e){return typeof e=="string"?new le([[document.querySelector(e)]],[document.documentElement]):new le([[e]],Ss)}function Du(e){let t;for(;t=e.sourceEvent;)e=t;return e}function de(e,t){if(e=Du(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}const Lu={passive:!1},gt={capture:!0,passive:!1};function Sn(e){e.stopImmediatePropagation()}function Ke(e){e.preventDefault(),e.stopImmediatePropagation()}function Ns(e){var t=e.document.documentElement,n=ce(e).on("dragstart.drag",Ke,gt);"onselectstart"in t?n.on("selectstart.drag",Ke,gt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Es(e,t){var n=e.document.documentElement,o=ce(e).on("dragstart.drag",null);t&&(o.on("click.drag",Ke,gt),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const kt=e=>()=>e;function $n(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:s,x:i,y:a,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,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:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}$n.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function $u(e){return!e.ctrlKey&&!e.button}function zu(){return this.parentNode}function Ou(e,t){return t??{x:e.x,y:e.y}}function Ru(){return navigator.maxTouchPoints||"ontouchstart"in this}function Cs(){var e=$u,t=zu,n=Ou,o=Ru,r={},s=sn("start","drag","end"),i=0,a,l,c,u,d=0;function f(w){w.on("mousedown.drag",g).filter(o).on("touchstart.drag",v).on("touchmove.drag",x,Lu).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(w,M){if(!(u||!e.call(this,w,M))){var S=p(this,t.call(this,w,M),w,M,"mouse");S&&(ce(w.view).on("mousemove.drag",m,gt).on("mouseup.drag",y,gt),Ns(w.view),Sn(w),c=!1,a=w.clientX,l=w.clientY,S("start",w))}}function m(w){if(Ke(w),!c){var M=w.clientX-a,S=w.clientY-l;c=M*M+S*S>d}r.mouse("drag",w)}function y(w){ce(w.view).on("mousemove.drag mouseup.drag",null),Es(w.view,c),Ke(w),r.mouse("end",w)}function v(w,M){if(e.call(this,w,M)){var S=w.changedTouches,N=t.call(this,w,M),D=S.length,T,z;for(T=0;T<D;++T)(z=p(this,N,w,M,S[T].identifier,S[T]))&&(Sn(w),z("start",w,S[T]))}}function x(w){var M=w.changedTouches,S=M.length,N,D;for(N=0;N<S;++N)(D=r[M[N].identifier])&&(Ke(w),D("drag",w,M[N]))}function _(w){var M=w.changedTouches,S=M.length,N,D;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),N=0;N<S;++N)(D=r[M[N].identifier])&&(Sn(w),D("end",w,M[N]))}function p(w,M,S,N,D,T){var z=s.copy(),E=de(T||S,M),L,$,b;if((b=n.call(w,new $n("beforestart",{sourceEvent:S,target:f,identifier:D,active:i,x:E[0],y:E[1],dx:0,dy:0,dispatch:z}),N))!=null)return L=b.x-E[0]||0,$=b.y-E[1]||0,function k(I,A,P){var j=E,O;switch(I){case"start":r[D]=k,O=i++;break;case"end":delete r[D],--i;case"drag":E=de(P||A,M),O=i;break}z.call(I,w,new $n(I,{sourceEvent:A,subject:b,target:f,identifier:D,active:O,x:E[0]+L,y:E[1]+$,dx:E[0]-j[0],dy:E[1]-j[1],dispatch:z}),N)}}return f.filter=function(w){return arguments.length?(e=typeof w=="function"?w:kt(!!w),f):e},f.container=function(w){return arguments.length?(t=typeof w=="function"?w:kt(w),f):t},f.subject=function(w){return arguments.length?(n=typeof w=="function"?w:kt(w),f):n},f.touchable=function(w){return arguments.length?(o=typeof w=="function"?w:kt(!!w),f):o},f.on=function(){var w=s.on.apply(s,arguments);return w===s?f:w},f.clickDistance=function(w){return arguments.length?(d=(w=+w)*w,f):Math.sqrt(d)},f}var $o=180/Math.PI,zn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ms(e,t,n,o,r,s){var i,a,l;return(i=Math.sqrt(e*e+t*t))&&(e/=i,t/=i),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,l/=a),e*o<t*n&&(e=-e,t=-t,l=-l,i=-i),{translateX:r,translateY:s,rotate:Math.atan2(t,e)*$o,skewX:Math.atan(l)*$o,scaleX:i,scaleY:a}}var Pt;function Hu(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?zn:Ms(t.a,t.b,t.c,t.d,t.e,t.f)}function Vu(e){return e==null||(Pt||(Pt=document.createElementNS("http://www.w3.org/2000/svg","g")),Pt.setAttribute("transform",e),!(e=Pt.transform.baseVal.consolidate()))?zn:(e=e.matrix,Ms(e.a,e.b,e.c,e.d,e.e,e.f))}function Is(e,t,n,o){function r(c){return c.length?c.pop()+" ":""}function s(c,u,d,f,g,m){if(c!==d||u!==f){var y=g.push("translate(",null,t,null,n);m.push({i:y-4,x:ze(c,d)},{i:y-2,x:ze(u,f)})}else(d||f)&&g.push("translate("+d+t+f+n)}function i(c,u,d,f){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),f.push({i:d.push(r(d)+"rotate(",null,o)-2,x:ze(c,u)})):u&&d.push(r(d)+"rotate("+u+o)}function a(c,u,d,f){c!==u?f.push({i:d.push(r(d)+"skewX(",null,o)-2,x:ze(c,u)}):u&&d.push(r(d)+"skewX("+u+o)}function l(c,u,d,f,g,m){if(c!==d||u!==f){var y=g.push(r(g)+"scale(",null,",",null,")");m.push({i:y-4,x:ze(c,d)},{i:y-2,x:ze(u,f)})}else(d!==1||f!==1)&&g.push(r(g)+"scale("+d+","+f+")")}return function(c,u){var d=[],f=[];return c=e(c),u=e(u),s(c.translateX,c.translateY,u.translateX,u.translateY,d,f),i(c.rotate,u.rotate,d,f),a(c.skewX,u.skewX,d,f),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,d,f),c=u=null,function(g){for(var m=-1,y=f.length,v;++m<y;)d[(v=f[m]).i]=v.x(g);return d.join("")}}}var Bu=Is(Hu,"px, ","px)","deg)"),Fu=Is(Vu,", ",")",")"),Gu=1e-12;function zo(e){return((e=Math.exp(e))+1/e)/2}function Xu(e){return((e=Math.exp(e))-1/e)/2}function Yu(e){return((e=Math.exp(2*e))-1)/(e+1)}const Ot=(function e(t,n,o){function r(s,i){var a=s[0],l=s[1],c=s[2],u=i[0],d=i[1],f=i[2],g=u-a,m=d-l,y=g*g+m*m,v,x;if(y<Gu)x=Math.log(f/c)/t,v=function(N){return[a+N*g,l+N*m,c*Math.exp(t*N*x)]};else{var _=Math.sqrt(y),p=(f*f-c*c+o*y)/(2*c*n*_),w=(f*f-c*c-o*y)/(2*f*n*_),M=Math.log(Math.sqrt(p*p+1)-p),S=Math.log(Math.sqrt(w*w+1)-w);x=(S-M)/t,v=function(N){var D=N*x,T=zo(M),z=c/(n*_)*(T*Yu(t*D+M)-Xu(M));return[a+z*g,l+z*m,c*T/zo(t*D+M)]}}return v.duration=x*1e3*t/Math.SQRT2,v}return r.rho=function(s){var i=Math.max(.001,+s),a=i*i,l=a*a;return e(i,a,l)},r})(Math.SQRT2,2,4);var Qe=0,dt=0,lt=0,ks=1e3,qt,ft,Wt=0,Ve=0,cn=0,pt=typeof performance=="object"&&performance.now?performance:Date,Ps=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function oo(){return Ve||(Ps(qu),Ve=pt.now()+cn)}function qu(){Ve=0}function Zt(){this._call=this._time=this._next=null}Zt.prototype=js.prototype={constructor:Zt,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&&ft!==this&&(ft?ft._next=this:qt=this,ft=this),this._call=e,this._time=n,On()},stop:function(){this._call&&(this._call=null,this._time=1/0,On())}};function js(e,t,n){var o=new Zt;return o.restart(e,t,n),o}function Wu(){oo(),++Qe;for(var e=qt,t;e;)(t=Ve-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Qe}function Oo(){Ve=(Wt=pt.now())+cn,Qe=dt=0;try{Wu()}finally{Qe=0,Ku(),Ve=0}}function Zu(){var e=pt.now(),t=e-Wt;t>ks&&(cn-=t,Wt=e)}function Ku(){for(var e,t=qt,n,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:qt=n);ft=e,On(o)}function On(e){if(!Qe){dt&&(dt=clearTimeout(dt));var t=e-Ve;t>24?(e<1/0&&(dt=setTimeout(Oo,e-pt.now()-cn)),lt&&(lt=clearInterval(lt))):(lt||(Wt=pt.now(),lt=setInterval(Zu,ks)),Qe=1,Ps(Oo))}}function Ro(e,t,n){var o=new Zt;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var Uu=sn("start","end","cancel","interrupt"),Qu=[],Ts=0,Ho=1,Rn=2,Rt=3,Vo=4,Hn=5,Ht=6;function ln(e,t,n,o,r,s){var i=e.__transition;if(!i)e.__transition={};else if(n in i)return;Ju(e,n,{name:t,index:o,group:r,on:Uu,tween:Qu,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Ts})}function ro(e,t){var n=me(e,t);if(n.state>Ts)throw new Error("too late; already scheduled");return n}function xe(e,t){var n=me(e,t);if(n.state>Rt)throw new Error("too late; already running");return n}function me(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Ju(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=js(s,0,n.time);function s(c){n.state=Ho,n.timer.restart(i,n.delay,n.time),n.delay<=c&&i(c-n.delay)}function i(c){var u,d,f,g;if(n.state!==Ho)return l();for(u in o)if(g=o[u],g.name===n.name){if(g.state===Rt)return Ro(i);g.state===Vo?(g.state=Ht,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete o[u]):+u<t&&(g.state=Ht,g.timer.stop(),g.on.call("cancel",e,e.__data__,g.index,g.group),delete o[u])}if(Ro(function(){n.state===Rt&&(n.state=Vo,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=Rn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Rn){for(n.state=Rt,r=new Array(f=n.tween.length),u=0,d=-1;u<f;++u)(g=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++d]=g);r.length=d+1}}function a(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=Hn,1),d=-1,f=r.length;++d<f;)r[d].call(e,u);n.state===Hn&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=Ht,n.timer.stop(),delete o[t];for(var c in o)return;delete e.__transition}}function Vt(e,t){var n=e.__transition,o,r,s=!0,i;if(n){t=t==null?null:t+"";for(i in n){if((o=n[i]).name!==t){s=!1;continue}r=o.state>Rn&&o.state<Hn,o.state=Ht,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[i]}s&&delete e.__transition}}function ed(e){return this.each(function(){Vt(this,e)})}function td(e,t){var n,o;return function(){var r=xe(this,e),s=r.tween;if(s!==n){o=n=s;for(var i=0,a=o.length;i<a;++i)if(o[i].name===t){o=o.slice(),o.splice(i,1);break}}r.tween=o}}function nd(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var s=xe(this,e),i=s.tween;if(i!==o){r=(o=i).slice();for(var a={name:t,value:n},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=a;break}l===c&&r.push(a)}s.tween=r}}function od(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=me(this.node(),n).tween,r=0,s=o.length,i;r<s;++r)if((i=o[r]).name===e)return i.value;return null}return this.each((t==null?td:nd)(n,e,t))}function so(e,t,n){var o=e._id;return e.each(function(){var r=xe(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return me(r,o).value[t]}}function As(e,t){var n;return(typeof t=="number"?ze:t instanceof Po?ko:(n=Po(t))?(t=n,ko):gc)(e,t)}function rd(e){return function(){this.removeAttribute(e)}}function sd(e){return function(){this.removeAttributeNS(e.space,e.local)}}function id(e,t,n){var o,r=n+"",s;return function(){var i=this.getAttribute(e);return i===r?null:i===o?s:s=t(o=i,n)}}function ad(e,t,n){var o,r=n+"",s;return function(){var i=this.getAttributeNS(e.space,e.local);return i===r?null:i===o?s:s=t(o=i,n)}}function cd(e,t,n){var o,r,s;return function(){var i,a=n(this),l;return a==null?void this.removeAttribute(e):(i=this.getAttribute(e),l=a+"",i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a)))}}function ld(e,t,n){var o,r,s;return function(){var i,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(i=this.getAttributeNS(e.space,e.local),l=a+"",i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a)))}}function ud(e,t){var n=an(e),o=n==="transform"?Fu:As;return this.attrTween(e,typeof t=="function"?(n.local?ld:cd)(n,o,so(this,"attr."+e,t)):t==null?(n.local?sd:rd)(n):(n.local?ad:id)(n,o,t))}function dd(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function fd(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function hd(e,t){var n,o;function r(){var s=t.apply(this,arguments);return s!==o&&(n=(o=s)&&fd(e,s)),n}return r._value=t,r}function md(e,t){var n,o;function r(){var s=t.apply(this,arguments);return s!==o&&(n=(o=s)&&dd(e,s)),n}return r._value=t,r}function gd(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var o=an(e);return this.tween(n,(o.local?hd:md)(o,t))}function pd(e,t){return function(){ro(this,e).delay=+t.apply(this,arguments)}}function yd(e,t){return t=+t,function(){ro(this,e).delay=t}}function xd(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?pd:yd)(t,e)):me(this.node(),t).delay}function vd(e,t){return function(){xe(this,e).duration=+t.apply(this,arguments)}}function wd(e,t){return t=+t,function(){xe(this,e).duration=t}}function bd(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?vd:wd)(t,e)):me(this.node(),t).duration}function _d(e,t){if(typeof t!="function")throw new Error;return function(){xe(this,e).ease=t}}function Sd(e){var t=this._id;return arguments.length?this.each(_d(t,e)):me(this.node(),t).ease}function Nd(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;xe(this,e).ease=n}}function Ed(e){if(typeof e!="function")throw new Error;return this.each(Nd(this._id,e))}function Cd(e){typeof e!="function"&&(e=ms(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=[],l,c=0;c<i;++c)(l=s[c])&&e.call(l,l.__data__,c,s)&&a.push(l);return new _e(o,this._parents,this._name,this._id)}function Md(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,s=Math.min(o,r),i=new Array(o),a=0;a<s;++a)for(var l=t[a],c=n[a],u=l.length,d=i[a]=new Array(u),f,g=0;g<u;++g)(f=l[g]||c[g])&&(d[g]=f);for(;a<o;++a)i[a]=t[a];return new _e(i,this._parents,this._name,this._id)}function Id(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 kd(e,t,n){var o,r,s=Id(t)?ro:xe;return function(){var i=s(this,e),a=i.on;a!==o&&(r=(o=a).copy()).on(t,n),i.on=r}}function Pd(e,t){var n=this._id;return arguments.length<2?me(this.node(),n).on.on(e):this.each(kd(n,e,t))}function jd(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Td(){return this.on("end.remove",jd(this._id))}function Ad(e){var t=this._name,n=this._id;typeof e!="function"&&(e=to(e));for(var o=this._groups,r=o.length,s=new Array(r),i=0;i<r;++i)for(var a=o[i],l=a.length,c=s[i]=new Array(l),u,d,f=0;f<l;++f)(u=a[f])&&(d=e.call(u,u.__data__,f,a))&&("__data__"in u&&(d.__data__=u.__data__),c[f]=d,ln(c[f],t,n,f,c,me(u,n)));return new _e(s,this._parents,t,n)}function Dd(e){var t=this._name,n=this._id;typeof e!="function"&&(e=hs(e));for(var o=this._groups,r=o.length,s=[],i=[],a=0;a<r;++a)for(var l=o[a],c=l.length,u,d=0;d<c;++d)if(u=l[d]){for(var f=e.call(u,u.__data__,d,l),g,m=me(u,n),y=0,v=f.length;y<v;++y)(g=f[y])&&ln(g,t,n,y,f,m);s.push(f),i.push(u)}return new _e(s,i,t,n)}var Ld=St.prototype.constructor;function $d(){return new Ld(this._groups,this._parents)}function zd(e,t){var n,o,r;return function(){var s=Ue(this,e),i=(this.style.removeProperty(e),Ue(this,e));return s===i?null:s===n&&i===o?r:r=t(n=s,o=i)}}function Ds(e){return function(){this.style.removeProperty(e)}}function Od(e,t,n){var o,r=n+"",s;return function(){var i=Ue(this,e);return i===r?null:i===o?s:s=t(o=i,n)}}function Rd(e,t,n){var o,r,s;return function(){var i=Ue(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),Ue(this,e))),i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a))}}function Hd(e,t){var n,o,r,s="style."+t,i="end."+s,a;return function(){var l=xe(this,e),c=l.on,u=l.value[s]==null?a||(a=Ds(t)):void 0;(c!==n||r!==u)&&(o=(n=c).copy()).on(i,r=u),l.on=o}}function Vd(e,t,n){var o=(e+="")=="transform"?Bu:As;return t==null?this.styleTween(e,zd(e,o)).on("end.style."+e,Ds(e)):typeof t=="function"?this.styleTween(e,Rd(e,o,so(this,"style."+e,t))).each(Hd(this._id,e)):this.styleTween(e,Od(e,o,t),n).on("end.style."+e,null)}function Bd(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function Fd(e,t,n){var o,r;function s(){var i=t.apply(this,arguments);return i!==r&&(o=(r=i)&&Bd(e,i,n)),o}return s._value=t,s}function Gd(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,Fd(e,t,n??""))}function Xd(e){return function(){this.textContent=e}}function Yd(e){return function(){var t=e(this);this.textContent=t??""}}function qd(e){return this.tween("text",typeof e=="function"?Yd(so(this,"text",e)):Xd(e==null?"":e+""))}function Wd(e){return function(t){this.textContent=e.call(this,t)}}function Zd(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Wd(r)),t}return o._value=e,o}function Kd(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,Zd(e))}function Ud(){for(var e=this._name,t=this._id,n=Ls(),o=this._groups,r=o.length,s=0;s<r;++s)for(var i=o[s],a=i.length,l,c=0;c<a;++c)if(l=i[c]){var u=me(l,t);ln(l,e,n,c,i,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new _e(o,this._parents,e,n)}function Qd(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(s,i){var a={value:i},l={value:function(){--r===0&&s()}};n.each(function(){var c=xe(this,o),u=c.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),r===0&&s()})}var Jd=0;function _e(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Ls(){return++Jd}var we=St.prototype;_e.prototype={constructor:_e,select:Ad,selectAll:Dd,selectChild:we.selectChild,selectChildren:we.selectChildren,filter:Cd,merge:Md,selection:$d,transition:Ud,call:we.call,nodes:we.nodes,node:we.node,size:we.size,empty:we.empty,each:we.each,on:Pd,attr:ud,attrTween:gd,style:Vd,styleTween:Gd,text:qd,textTween:Kd,remove:Td,tween:od,delay:xd,duration:bd,ease:Sd,easeVarying:Ed,end:Qd,[Symbol.iterator]:we[Symbol.iterator]};function ef(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var tf={time:null,delay:0,duration:250,ease:ef};function nf(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 of(e){var t,n;e instanceof _e?(t=e._id,e=e._name):(t=Ls(),(n=tf).time=oo(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,s=0;s<r;++s)for(var i=o[s],a=i.length,l,c=0;c<a;++c)(l=i[c])&&ln(l,e,t,c,i,n||nf(l,t));return new _e(o,this._parents,e,t)}St.prototype.interrupt=ed;St.prototype.transition=of;const jt=e=>()=>e;function rf(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function be(e,t,n){this.k=e,this.x=t,this.y=n}be.prototype={constructor:be,scale:function(e){return e===1?this:new be(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new be(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 un=new be(1,0,0);$s.prototype=be.prototype;function $s(e){for(;!e.__zoom;)if(!(e=e.parentNode))return un;return e.__zoom}function Nn(e){e.stopImmediatePropagation()}function ut(e){e.preventDefault(),e.stopImmediatePropagation()}function sf(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function af(){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 Bo(){return this.__zoom||un}function cf(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function lf(){return navigator.maxTouchPoints||"ontouchstart"in this}function uf(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=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(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i))}function zs(){var e=sf,t=af,n=uf,o=cf,r=lf,s=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Ot,c=sn("start","zoom","end"),u,d,f,g=500,m=150,y=0,v=10;function x(b){b.property("__zoom",Bo).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",z).filter(r).on("touchstart.zoom",E).on("touchmove.zoom",L).on("touchend.zoom touchcancel.zoom",$).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}x.transform=function(b,k,I,A){var P=b.selection?b.selection():b;P.property("__zoom",Bo),b!==P?M(b,k,I,A):P.interrupt().each(function(){S(this,arguments).event(A).start().zoom(null,typeof k=="function"?k.apply(this,arguments):k).end()})},x.scaleBy=function(b,k,I,A){x.scaleTo(b,function(){var P=this.__zoom.k,j=typeof k=="function"?k.apply(this,arguments):k;return P*j},I,A)},x.scaleTo=function(b,k,I,A){x.transform(b,function(){var P=t.apply(this,arguments),j=this.__zoom,O=I==null?w(P):typeof I=="function"?I.apply(this,arguments):I,H=j.invert(O),R=typeof k=="function"?k.apply(this,arguments):k;return n(p(_(j,R),O,H),P,i)},I,A)},x.translateBy=function(b,k,I,A){x.transform(b,function(){return n(this.__zoom.translate(typeof k=="function"?k.apply(this,arguments):k,typeof I=="function"?I.apply(this,arguments):I),t.apply(this,arguments),i)},null,A)},x.translateTo=function(b,k,I,A,P){x.transform(b,function(){var j=t.apply(this,arguments),O=this.__zoom,H=A==null?w(j):typeof A=="function"?A.apply(this,arguments):A;return n(un.translate(H[0],H[1]).scale(O.k).translate(typeof k=="function"?-k.apply(this,arguments):-k,typeof I=="function"?-I.apply(this,arguments):-I),j,i)},A,P)};function _(b,k){return k=Math.max(s[0],Math.min(s[1],k)),k===b.k?b:new be(k,b.x,b.y)}function p(b,k,I){var A=k[0]-I[0]*b.k,P=k[1]-I[1]*b.k;return A===b.x&&P===b.y?b:new be(b.k,A,P)}function w(b){return[(+b[0][0]+ +b[1][0])/2,(+b[0][1]+ +b[1][1])/2]}function M(b,k,I,A){b.on("start.zoom",function(){S(this,arguments).event(A).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(A).end()}).tween("zoom",function(){var P=this,j=arguments,O=S(P,j).event(A),H=t.apply(P,j),R=I==null?w(H):typeof I=="function"?I.apply(P,j):I,F=Math.max(H[1][0]-H[0][0],H[1][1]-H[0][1]),B=P.__zoom,q=typeof k=="function"?k.apply(P,j):k,K=l(B.invert(R).concat(F/B.k),q.invert(R).concat(F/q.k));return function(Y){if(Y===1)Y=q;else{var V=K(Y),X=F/V[2];Y=new be(X,R[0]-V[0]*X,R[1]-V[1]*X)}O.zoom(null,Y)}})}function S(b,k,I){return!I&&b.__zooming||new N(b,k)}function N(b,k){this.that=b,this.args=k,this.active=0,this.sourceEvent=null,this.extent=t.apply(b,k),this.taps=0}N.prototype={event:function(b){return b&&(this.sourceEvent=b),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(b,k){return this.mouse&&b!=="mouse"&&(this.mouse[1]=k.invert(this.mouse[0])),this.touch0&&b!=="touch"&&(this.touch0[1]=k.invert(this.touch0[0])),this.touch1&&b!=="touch"&&(this.touch1[1]=k.invert(this.touch1[0])),this.that.__zoom=k,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(b){var k=ce(this.that).datum();c.call(b,this.that,new rf(b,{sourceEvent:this.sourceEvent,target:x,transform:this.that.__zoom,dispatch:c}),k)}};function D(b,...k){if(!e.apply(this,arguments))return;var I=S(this,k).event(b),A=this.__zoom,P=Math.max(s[0],Math.min(s[1],A.k*Math.pow(2,o.apply(this,arguments)))),j=de(b);if(I.wheel)(I.mouse[0][0]!==j[0]||I.mouse[0][1]!==j[1])&&(I.mouse[1]=A.invert(I.mouse[0]=j)),clearTimeout(I.wheel);else{if(A.k===P)return;I.mouse=[j,A.invert(j)],Vt(this),I.start()}ut(b),I.wheel=setTimeout(O,m),I.zoom("mouse",n(p(_(A,P),I.mouse[0],I.mouse[1]),I.extent,i));function O(){I.wheel=null,I.end()}}function T(b,...k){if(f||!e.apply(this,arguments))return;var I=b.currentTarget,A=S(this,k,!0).event(b),P=ce(b.view).on("mousemove.zoom",R,!0).on("mouseup.zoom",F,!0),j=de(b,I),O=b.clientX,H=b.clientY;Ns(b.view),Nn(b),A.mouse=[j,this.__zoom.invert(j)],Vt(this),A.start();function R(B){if(ut(B),!A.moved){var q=B.clientX-O,K=B.clientY-H;A.moved=q*q+K*K>y}A.event(B).zoom("mouse",n(p(A.that.__zoom,A.mouse[0]=de(B,I),A.mouse[1]),A.extent,i))}function F(B){P.on("mousemove.zoom mouseup.zoom",null),Es(B.view,A.moved),ut(B),A.event(B).end()}}function z(b,...k){if(e.apply(this,arguments)){var I=this.__zoom,A=de(b.changedTouches?b.changedTouches[0]:b,this),P=I.invert(A),j=I.k*(b.shiftKey?.5:2),O=n(p(_(I,j),A,P),t.apply(this,k),i);ut(b),a>0?ce(this).transition().duration(a).call(M,O,A,b):ce(this).call(x.transform,O,A,b)}}function E(b,...k){if(e.apply(this,arguments)){var I=b.touches,A=I.length,P=S(this,k,b.changedTouches.length===A).event(b),j,O,H,R;for(Nn(b),O=0;O<A;++O)H=I[O],R=de(H,this),R=[R,this.__zoom.invert(R),H.identifier],P.touch0?!P.touch1&&P.touch0[2]!==R[2]&&(P.touch1=R,P.taps=0):(P.touch0=R,j=!0,P.taps=1+!!u);u&&(u=clearTimeout(u)),j&&(P.taps<2&&(d=R[0],u=setTimeout(function(){u=null},g)),Vt(this),P.start())}}function L(b,...k){if(this.__zooming){var I=S(this,k).event(b),A=b.changedTouches,P=A.length,j,O,H,R;for(ut(b),j=0;j<P;++j)O=A[j],H=de(O,this),I.touch0&&I.touch0[2]===O.identifier?I.touch0[0]=H:I.touch1&&I.touch1[2]===O.identifier&&(I.touch1[0]=H);if(O=I.that.__zoom,I.touch1){var F=I.touch0[0],B=I.touch0[1],q=I.touch1[0],K=I.touch1[1],Y=(Y=q[0]-F[0])*Y+(Y=q[1]-F[1])*Y,V=(V=K[0]-B[0])*V+(V=K[1]-B[1])*V;O=_(O,Math.sqrt(Y/V)),H=[(F[0]+q[0])/2,(F[1]+q[1])/2],R=[(B[0]+K[0])/2,(B[1]+K[1])/2]}else if(I.touch0)H=I.touch0[0],R=I.touch0[1];else return;I.zoom("touch",n(p(O,H,R),I.extent,i))}}function $(b,...k){if(this.__zooming){var I=S(this,k).event(b),A=b.changedTouches,P=A.length,j,O;for(Nn(b),f&&clearTimeout(f),f=setTimeout(function(){f=null},g),j=0;j<P;++j)O=A[j],I.touch0&&I.touch0[2]===O.identifier?delete I.touch0:I.touch1&&I.touch1[2]===O.identifier&&delete I.touch1;if(I.touch1&&!I.touch0&&(I.touch0=I.touch1,delete I.touch1),I.touch0)I.touch0[1]=this.__zoom.invert(I.touch0[0]);else if(I.end(),I.taps===2&&(O=de(O,this),Math.hypot(d[0]-O[0],d[1]-O[1])<v)){var H=ce(this).on("dblclick.zoom");H&&H.apply(this,arguments)}}}return x.wheelDelta=function(b){return arguments.length?(o=typeof b=="function"?b:jt(+b),x):o},x.filter=function(b){return arguments.length?(e=typeof b=="function"?b:jt(!!b),x):e},x.touchable=function(b){return arguments.length?(r=typeof b=="function"?b:jt(!!b),x):r},x.extent=function(b){return arguments.length?(t=typeof b=="function"?b:jt([[+b[0][0],+b[0][1]],[+b[1][0],+b[1][1]]]),x):t},x.scaleExtent=function(b){return arguments.length?(s[0]=+b[0],s[1]=+b[1],x):[s[0],s[1]]},x.translateExtent=function(b){return arguments.length?(i[0][0]=+b[0][0],i[1][0]=+b[1][0],i[0][1]=+b[0][1],i[1][1]=+b[1][1],x):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},x.constrain=function(b){return arguments.length?(n=b,x):n},x.duration=function(b){return arguments.length?(a=+b,x):a},x.interpolate=function(b){return arguments.length?(l=b,x):l},x.on=function(){var b=c.on.apply(c,arguments);return b===c?x:b},x.clickDistance=function(b){return arguments.length?(y=(b=+b)*b,x):Math.sqrt(y)},x.tapDistance=function(b){return arguments.length?(v=+b,x):v},x}const pe={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:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:o}", 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."},yt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Os=["Enter"," ","Escape"],Rs={"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 Je;(function(e){e.Strict="strict",e.Loose="loose"})(Je||(Je={}));var Re;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Re||(Re={}));var xt;(function(e){e.Partial="partial",e.Full="full"})(xt||(xt={}));const Hs={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ie;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ie||(Ie={}));var Kt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Kt||(Kt={}));var G;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(G||(G={}));const Fo={[G.Left]:G.Right,[G.Right]:G.Left,[G.Top]:G.Bottom,[G.Bottom]:G.Top};function Vs(e){return e===null?null:e?"valid":"invalid"}const Bs=e=>"id"in e&&"source"in e&&"target"in e,df=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),io=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Nt=(e,t=[0,0])=>{const{width:n,height:o}=Ne(e),r=e.origin??t,s=n*r[0],i=o*r[1];return{x:e.position.x-s,y:e.position.y-i}},ff=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,r)=>{const s=typeof r=="string";let i=!t.nodeLookup&&!s?r:void 0;t.nodeLookup&&(i=s?t.nodeLookup.get(r):io(r)?r:t.nodeLookup.get(r.id));const a=i?Ut(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return dn(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return fn(n)},Et=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=dn(n,Ut(r)),o=!0)}),o?fn(n):{x:0,y:0,width:0,height:0}},ao=(e,t,[n,o,r]=[0,0,1],s=!1,i=!1)=>{const a={...Mt(t,[n,o,r]),width:t.width/r,height:t.height/r},l=[];for(const c of e.values()){const{measured:u,selectable:d=!0,hidden:f=!1}=c;if(i&&!d||f)continue;const g=u.width??c.width??c.initialWidth??null,m=u.height??c.height??c.initialHeight??null,y=vt(a,tt(c)),v=(g??0)*(m??0),x=s&&y>0;(!c.internals.handleBounds||x||y>=v||c.dragging)&&l.push(c)}return l},hf=(e,t)=>{const n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function mf(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&(t?.includeHiddenNodes||!r.hidden)&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function gf({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:s},i){if(e.size===0)return Promise.resolve(!0);const a=mf(e,i),l=Et(a),c=co(l,t,n,i?.minZoom??r,i?.maxZoom??s,i?.padding??.1);return await o.setViewport(c,{duration:i?.duration,ease:i?.ease,interpolate:i?.interpolate}),Promise.resolve(!0)}function Fs({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:s}){const i=n.get(e),a=i.parentId?n.get(i.parentId):void 0,{x:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},u=i.origin??o;let d=i.extent||r;if(i.extent==="parent"&&!i.expandParent)if(!a)s?.("005",pe.error005());else{const g=a.measured.width,m=a.measured.height;g&&m&&(d=[[l,c],[l+g,c+m]])}else a&&nt(i.extent)&&(d=[[i.extent[0][0]+l,i.extent[0][1]+c],[i.extent[1][0]+l,i.extent[1][1]+c]]);const f=nt(d)?Be(t,d,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&s?.("015",pe.error015()),{position:{x:f.x-l+(i.measured.width??0)*u[0],y:f.y-c+(i.measured.height??0)*u[1]},positionAbsolute:f}}async function pf({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){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),m=!g&&f.parentId&&i.find(y=>y.id===f.parentId);(g||m)&&i.push(f)}const a=new Set(t.map(f=>f.id)),l=o.filter(f=>f.deletable!==!1),u=hf(i,l);for(const f of l)a.has(f.id)&&!u.find(m=>m.id===f.id)&&u.push(f);if(!r)return{edges:u,nodes:i};const d=await r({nodes:i,edges:u});return typeof d=="boolean"?d?{edges:u,nodes:i}:{edges:[],nodes:[]}:d}const et=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Be=(e={x:0,y:0},t,n)=>({x:et(e.x,t[0][0],t[1][0]-(n?.width??0)),y:et(e.y,t[0][1],t[1][1]-(n?.height??0))});function Gs(e,t,n){const{width:o,height:r}=Ne(n),{x:s,y:i}=n.internals.positionAbsolute;return Be(e,[[s,i],[s+o,i+r]],t)}const Go=(e,t,n)=>e<t?et(Math.abs(e-t),1,t)/t:e>n?-et(Math.abs(e-n),1,t)/t:0,Xs=(e,t,n=15,o=40)=>{const r=Go(e.x,o,t.width-o)*n,s=Go(e.y,o,t.height-o)*n;return[r,s]},dn=(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)}),Vn=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),fn=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),tt=(e,t=[0,0])=>{const{x:n,y:o}=io(e)?e.internals.positionAbsolute:Nt(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Ut=(e,t=[0,0])=>{const{x:n,y:o}=io(e)?e.internals.positionAbsolute:Nt(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},Ys=(e,t)=>fn(dn(Vn(e),Vn(t))),vt=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},Xo=e=>fe(e.width)&&fe(e.height)&&fe(e.x)&&fe(e.y),fe=e=>!isNaN(e)&&isFinite(e),yf=(e,t)=>{},Ct=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Mt=({x:e,y:t},[n,o,r],s=!1,i=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return s?Ct(a,i):a},Qt=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Xe(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 xf(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=Xe(e,n),r=Xe(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=Xe(e.top??e.y??0,n),r=Xe(e.bottom??e.y??0,n),s=Xe(e.left??e.x??0,t),i=Xe(e.right??e.x??0,t);return{top:o,right:i,bottom:r,left:s,x:s+i,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function vf(e,t,n,o,r,s){const{x:i,y:a}=Qt(e,[t,n,o]),{x:l,y:c}=Qt({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-l,d=s-c;return{left:Math.floor(i),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(d)}}const co=(e,t,n,o,r,s)=>{const i=xf(s,t,n),a=(t-i.x)/e.width,l=(n-i.y)/e.height,c=Math.min(a,l),u=et(c,o,r),d=e.x+e.width/2,f=e.y+e.height/2,g=t/2-d*u,m=n/2-f*u,y=vf(e,g,m,u,t,n),v={left:Math.min(y.left-i.left,0),top:Math.min(y.top-i.top,0),right:Math.min(y.right-i.right,0),bottom:Math.min(y.bottom-i.bottom,0)};return{x:g-v.left+v.right,y:m-v.top+v.bottom,zoom:u}},wt=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function nt(e){return e!=null&&e!=="parent"}function Ne(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function qs(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Ws(e,t={width:0,height:0},n,o,r){const s={...e},i=o.get(n);if(i){const a=i.origin||r;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 Yo(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function wf(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function bf(e){return{...Rs,...e||{}}}function ht(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:s,y:i}=he(e),a=Mt({x:s-(r?.left??0),y:i-(r?.top??0)},o),{x:l,y:c}=n?Ct(a,t):a;return{xSnapped:l,ySnapped:c,...a}}const lo=e=>({width:e.offsetWidth,height:e.offsetHeight}),Zs=e=>e?.getRootNode?.()||window?.document,_f=["INPUT","SELECT","TEXTAREA"];function Ks(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:_f.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Us=e=>"clientX"in e,he=(e,t)=>{const n=Us(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},qo=(e,t,n,o,r)=>{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:r,position:i.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...lo(i)}})};function Qs({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:s,targetControlX:i,targetControlY:a}){const l=e*.125+r*.375+i*.375+n*.125,c=t*.125+s*.375+a*.375+o*.125,u=Math.abs(l-e),d=Math.abs(c-t);return[l,c,u,d]}function Tt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Wo({pos:e,x1:t,y1:n,x2:o,y2:r,c:s}){switch(e){case G.Left:return[t-Tt(t-o,s),n];case G.Right:return[t+Tt(o-t,s),n];case G.Top:return[t,n-Tt(n-r,s)];case G.Bottom:return[t,n+Tt(r-n,s)]}}function Js({sourceX:e,sourceY:t,sourcePosition:n=G.Bottom,targetX:o,targetY:r,targetPosition:s=G.Top,curvature:i=.25}){const[a,l]=Wo({pos:n,x1:e,y1:t,x2:o,y2:r,c:i}),[c,u]=Wo({pos:s,x1:o,y1:r,x2:e,y2:t,c:i}),[d,f,g,m]=Qs({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${l} ${c},${u} ${o},${r}`,d,f,g,m]}function ei({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,s=n<e?n+r:n-r,i=Math.abs(o-t)/2,a=o<t?o+i:o-i;return[s,a,r,i]}function Sf({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:s="basic"}){if(s==="manual")return o;const i=r&&n?o+1e3:o,a=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return i+a}function Nf({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const s=dn(Ut(e),Ut(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const i={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return vt(i,fn(s))>0}const Ef=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Cf=(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)),Mf=(e,t,n={})=>{if(!e.source||!e.target)return t;const o=n.getEdgeId||Ef;let r;return Bs(e)?r={...e}:r={...e,id:o(e)},Cf(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function ti({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,s,i,a]=ei({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,s,i,a]}const Zo={[G.Left]:{x:-1,y:0},[G.Right]:{x:1,y:0},[G.Top]:{x:0,y:-1},[G.Bottom]:{x:0,y:1}},If=({source:e,sourcePosition:t=G.Bottom,target:n})=>t===G.Left||t===G.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},Ko=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function kf({source:e,sourcePosition:t=G.Bottom,target:n,targetPosition:o=G.Top,center:r,offset:s,stepPosition:i}){const a=Zo[t],l=Zo[o],c={x:e.x+a.x*s,y:e.y+a.y*s},u={x:n.x+l.x*s,y:n.y+l.y*s},d=If({source:c,sourcePosition:t,target:u}),f=d.x!==0?"x":"y",g=d[f];let m=[],y,v;const x={x:0,y:0},_={x:0,y:0},[,,p,w]=ei({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*l[f]===-1){f==="x"?(y=r.x??c.x+(u.x-c.x)*i,v=r.y??(c.y+u.y)/2):(y=r.x??(c.x+u.x)/2,v=r.y??c.y+(u.y-c.y)*i);const S=[{x:y,y:c.y},{x:y,y:u.y}],N=[{x:c.x,y:v},{x:u.x,y:v}];a[f]===g?m=f==="x"?S:N:m=f==="x"?N:S}else{const S=[{x:c.x,y:u.y}],N=[{x:u.x,y:c.y}];if(f==="x"?m=a.x===g?N:S:m=a.y===g?S:N,t===o){const L=Math.abs(e[f]-n[f]);if(L<=s){const $=Math.min(s-1,s-L);a[f]===g?x[f]=(c[f]>e[f]?-1:1)*$:_[f]=(u[f]>n[f]?-1:1)*$}}if(t!==o){const L=f==="x"?"y":"x",$=a[f]===l[L],b=c[L]>u[L],k=c[L]<u[L];(a[f]===1&&(!$&&b||$&&k)||a[f]!==1&&(!$&&k||$&&b))&&(m=f==="x"?S:N)}const D={x:c.x+x.x,y:c.y+x.y},T={x:u.x+_.x,y:u.y+_.y},z=Math.max(Math.abs(D.x-m[0].x),Math.abs(T.x-m[0].x)),E=Math.max(Math.abs(D.y-m[0].y),Math.abs(T.y-m[0].y));z>=E?(y=(D.x+T.x)/2,v=m[0].y):(y=m[0].x,v=(D.y+T.y)/2)}return[[e,{x:c.x+x.x,y:c.y+x.y},...m,{x:u.x+_.x,y:u.y+_.y},n],y,v,p,w]}function Pf(e,t,n,o){const r=Math.min(Ko(e,t)/2,Ko(t,n)/2,o),{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 c=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${s+r*c},${i}Q ${s},${i} ${s},${i+r*u}`}const a=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${s},${i+r*l}Q ${s},${i} ${s+r*a},${i}`}function Bn({sourceX:e,sourceY:t,sourcePosition:n=G.Bottom,targetX:o,targetY:r,targetPosition:s=G.Top,borderRadius:i=5,centerX:a,centerY:l,offset:c=20,stepPosition:u=.5}){const[d,f,g,m,y]=kf({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:s,center:{x:a,y:l},offset:c,stepPosition:u});return[d.reduce((x,_,p)=>{let w="";return p>0&&p<d.length-1?w=Pf(d[p-1],_,d[p+1],i):w=`${p===0?"M":"L"}${_.x} ${_.y}`,x+=w,x},""),f,g,m,y]}function Uo(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function jf(e){const{sourceNode:t,targetNode:n}=e;if(!Uo(t)||!Uo(n))return null;const o=t.internals.handleBounds||Qo(t.handles),r=n.internals.handleBounds||Qo(n.handles),s=Jo(o?.source??[],e.sourceHandle),i=Jo(e.connectionMode===Je.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!s||!i)return e.onError?.("008",pe.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=s?.position||G.Bottom,l=i?.position||G.Top,c=Fe(t,s,a),u=Fe(n,i,l);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:l}}function Qo(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&n.push(o);return{source:t,target:n}}function Fe(e,t,n=G.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,s=(t?.y??0)+e.internals.positionAbsolute.y,{width:i,height:a}=t??Ne(e);if(o)return{x:r+i/2,y:s+a/2};switch(t?.position??n){case G.Top:return{x:r+i/2,y:s};case G.Right:return{x:r+i,y:s+a/2};case G.Bottom:return{x:r+i/2,y:s+a};case G.Left:return{x:r,y:s+a/2}}}function Jo(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Fn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function Tf(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const s=new Set;return e.reduce((i,a)=>([a.markerStart||o,a.markerEnd||r].forEach(l=>{if(l&&typeof l=="object"){const c=Fn(l,t);s.has(c)||(i.push({id:c,color:l.color||n,...l}),s.add(c))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))}const ni=1e3,Af=10,uo={nodeOrigin:[0,0],nodeExtent:yt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Df={...uo,checkEquality:!0};function fo(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function Lf(e,t,n){const o=fo(uo,n);for(const r of e.values())if(r.parentId)mo(r,e,t,o);else{const s=Nt(r,o.nodeOrigin),i=nt(r.extent)?r.extent:o.nodeExtent,a=Be(s,i,Ne(r));r.internals.positionAbsolute=a}}function $f(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const s={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(s):r.type==="target"&&o.push(s)}return{source:n,target:o}}function ho(e){return e==="manual"}function Gn(e,t,n,o={}){const r=fo(Df,o),s={i:0},i=new Map(t),a=r?.elevateNodesOnSelect&&!ho(r.zIndexMode)?ni:0;let l=e.length>0;t.clear(),n.clear();for(const c of e){let u=i.get(c.id);if(r.checkEquality&&c===u?.internals.userNode)t.set(c.id,u);else{const d=Nt(c,r.nodeOrigin),f=nt(c.extent)?c.extent:r.nodeExtent,g=Be(d,f,Ne(c));u={...r.defaults,...c,measured:{width:c.measured?.width,height:c.measured?.height},internals:{positionAbsolute:g,handleBounds:$f(c,u),z:oi(c,a,r.zIndexMode),userNode:c}},t.set(c.id,u)}(u.measured===void 0||u.measured.width===void 0||u.measured.height===void 0)&&!u.hidden&&(l=!1),c.parentId&&mo(u,t,n,o,s)}return l}function zf(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 mo(e,t,n,o,r){const{elevateNodesOnSelect:s,nodeOrigin:i,nodeExtent:a,zIndexMode:l}=fo(uo,o),c=e.parentId,u=t.get(c);if(!u){console.warn(`Parent node ${c} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}zf(e,n),r&&!u.parentId&&u.internals.rootParentIndex===void 0&&l==="auto"&&(u.internals.rootParentIndex=++r.i,u.internals.z=u.internals.z+r.i*Af),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);const d=s&&!ho(l)?ni:0,{x:f,y:g,z:m}=Of(e,u,i,a,d,l),{positionAbsolute:y}=e.internals,v=f!==y.x||g!==y.y;(v||m!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:v?{x:f,y:g}:y,z:m}})}function oi(e,t,n){const o=fe(e.zIndex)?e.zIndex:0;return ho(n)?o:o+(e.selected?t:0)}function Of(e,t,n,o,r,s){const{x:i,y:a}=t.internals.positionAbsolute,l=Ne(e),c=Nt(e,n),u=nt(e.extent)?Be(c,e.extent,l):c;let d=Be({x:i+u.x,y:a+u.y},o,l);e.extent==="parent"&&(d=Gs(d,l,t));const f=oi(e,r,s),g=t.internals.z??0;return{x:d.x,y:d.y,z:g>=f?g+1:f}}function go(e,t,n,o=[0,0]){const r=[],s=new Map;for(const i of e){const a=t.get(i.parentId);if(!a)continue;const l=s.get(i.parentId)?.expandedRect??tt(a),c=Ys(l,i.rect);s.set(i.parentId,{expandedRect:c,parent:a})}return s.size>0&&s.forEach(({expandedRect:i,parent:a},l)=>{const c=a.internals.positionAbsolute,u=Ne(a),d=a.origin??o,f=i.x<c.x?Math.round(Math.abs(c.x-i.x)):0,g=i.y<c.y?Math.round(Math.abs(c.y-i.y)):0,m=Math.max(u.width,Math.round(i.width)),y=Math.max(u.height,Math.round(i.height)),v=(m-u.width)*d[0],x=(y-u.height)*d[1];(f>0||g>0||v||x)&&(r.push({id:l,type:"position",position:{x:a.position.x-f+v,y:a.position.y-g+x}}),n.get(l)?.forEach(_=>{e.some(p=>p.id===_.id)||r.push({id:_.id,type:"position",position:{x:_.position.x+f,y:_.position.y+g}})})),(u.width<i.width||u.height<i.height||f||g)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:m+(f?d[0]*f-v:0),height:y+(g?d[1]*g-x:0)}})}),r}function Rf(e,t,n,o,r,s,i){const a=o?.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const c=[],u=window.getComputedStyle(a),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(const g of e.values()){const m=t.get(g.id);if(!m)continue;if(m.hidden){t.set(m.id,{...m,internals:{...m.internals,handleBounds:void 0}}),l=!0;continue}const y=lo(g.nodeElement),v=m.measured.width!==y.width||m.measured.height!==y.height;if(!!(y.width&&y.height&&(v||!m.internals.handleBounds||g.force))){const _=g.nodeElement.getBoundingClientRect(),p=nt(m.extent)?m.extent:s;let{positionAbsolute:w}=m.internals;m.parentId&&m.extent==="parent"?w=Gs(w,y,t.get(m.parentId)):p&&(w=Be(w,p,y));const M={...m,measured:y,internals:{...m.internals,positionAbsolute:w,handleBounds:{source:qo("source",g.nodeElement,_,d,m.id),target:qo("target",g.nodeElement,_,d,m.id)}}};t.set(m.id,M),m.parentId&&mo(M,t,n,{nodeOrigin:r,zIndexMode:i}),l=!0,v&&(c.push({id:m.id,type:"dimensions",dimensions:y}),m.expandParent&&m.parentId&&f.push({id:m.id,parentId:m.parentId,rect:tt(M,r)}))}}if(f.length>0){const g=go(f,t,n,r);c.push(...g)}return{changes:c,updatedInternals:l}}async function Hf({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,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],[r,s]],o),a=!!i&&(i.x!==n[0]||i.y!==n[1]||i.k!==n[2]);return Promise.resolve(a)}function er(e,t,n,o,r,s){let i=r;const a=o.get(i)||new Map;o.set(i,a.set(n,t)),i=`${r}-${e}`;const l=o.get(i)||new Map;if(o.set(i,l.set(n,t)),s){i=`${r}-${e}-${s}`;const c=o.get(i)||new Map;o.set(i,c.set(n,t))}}function ri(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:s,sourceHandle:i=null,targetHandle:a=null}=o,l={edgeId:o.id,source:r,target:s,sourceHandle:i,targetHandle:a},c=`${r}-${i}--${s}-${a}`,u=`${s}-${a}--${r}-${i}`;er("source",l,u,e,r,i),er("target",l,c,e,s,a),t.set(o.id,o)}}function si(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:si(n,t):!1}function tr(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function Vf(e,t,n,o){const r=new Map;for(const[s,i]of e)if((i.selected||i.id===o)&&(!i.parentId||!si(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){const a=e.get(s);a&&r.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 r}function En({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[i,a]of t){const l=n.get(i)?.internals.userNode;l&&r.push({...l,position:a.position,dragging:o})}if(!e)return[r[0],r];const s=n.get(e)?.internals.userNode;return[s?{...s,position:t.get(e)?.position||s.position,dragging:o}:r[0],r]}function Bf({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const s={x:n-r.distance.x,y:o-r.distance.y},i=Ct(s,t);return{x:i.x-s.x,y:i.y-s.y}}function Ff({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let s={x:null,y:null},i=0,a=new Map,l=!1,c={x:0,y:0},u=null,d=!1,f=null,g=!1,m=!1,y=null;function v({noDragClassName:_,handleSelector:p,domNode:w,isSelectable:M,nodeId:S,nodeClickDistance:N=0}){f=ce(w);function D({x:L,y:$}){const{nodeLookup:b,nodeExtent:k,snapGrid:I,snapToGrid:A,nodeOrigin:P,onNodeDrag:j,onSelectionDrag:O,onError:H,updateNodePositions:R}=t();s={x:L,y:$};let F=!1;const B=a.size>1,q=B&&k?Vn(Et(a)):null,K=B&&A?Bf({dragItems:a,snapGrid:I,x:L,y:$}):null;for(const[Y,V]of a){if(!b.has(Y))continue;let X={x:L-V.distance.x,y:$-V.distance.y};A&&(X=K?{x:Math.round(X.x+K.x),y:Math.round(X.y+K.y)}:Ct(X,I));let Q=null;if(B&&k&&!V.extent&&q){const{positionAbsolute:Z}=V.internals,ee=Z.x-q.x+k[0][0],ne=Z.x+V.measured.width-q.x2+k[1][0],te=Z.y-q.y+k[0][1],ae=Z.y+V.measured.height-q.y2+k[1][1];Q=[[ee,te],[ne,ae]]}const{position:U,positionAbsolute:W}=Fs({nodeId:Y,nextPosition:X,nodeLookup:b,nodeExtent:Q||k,nodeOrigin:P,onError:H});F=F||V.position.x!==U.x||V.position.y!==U.y,V.position=U,V.internals.positionAbsolute=W}if(m=m||F,!!F&&(R(a,!0),y&&(o||j||!S&&O))){const[Y,V]=En({nodeId:S,dragItems:a,nodeLookup:b});o?.(y,a,Y,V),j?.(y,Y,V),S||O?.(y,V)}}async function T(){if(!u)return;const{transform:L,panBy:$,autoPanSpeed:b,autoPanOnNodeDrag:k}=t();if(!k){l=!1,cancelAnimationFrame(i);return}const[I,A]=Xs(c,u,b);(I!==0||A!==0)&&(s.x=(s.x??0)-I/L[2],s.y=(s.y??0)-A/L[2],await $({x:I,y:A})&&D(s)),i=requestAnimationFrame(T)}function z(L){const{nodeLookup:$,multiSelectionActive:b,nodesDraggable:k,transform:I,snapGrid:A,snapToGrid:P,selectNodesOnDrag:j,onNodeDragStart:O,onSelectionDragStart:H,unselectNodesAndEdges:R}=t();d=!0,(!j||!M)&&!b&&S&&($.get(S)?.selected||R()),M&&j&&S&&e?.(S);const F=ht(L.sourceEvent,{transform:I,snapGrid:A,snapToGrid:P,containerBounds:u});if(s=F,a=Vf($,k,F,S),a.size>0&&(n||O||!S&&H)){const[B,q]=En({nodeId:S,dragItems:a,nodeLookup:$});n?.(L.sourceEvent,a,B,q),O?.(L.sourceEvent,B,q),S||H?.(L.sourceEvent,q)}}const E=Cs().clickDistance(N).on("start",L=>{const{domNode:$,nodeDragThreshold:b,transform:k,snapGrid:I,snapToGrid:A}=t();u=$?.getBoundingClientRect()||null,g=!1,m=!1,y=L.sourceEvent,b===0&&z(L),s=ht(L.sourceEvent,{transform:k,snapGrid:I,snapToGrid:A,containerBounds:u}),c=he(L.sourceEvent,u)}).on("drag",L=>{const{autoPanOnNodeDrag:$,transform:b,snapGrid:k,snapToGrid:I,nodeDragThreshold:A,nodeLookup:P}=t(),j=ht(L.sourceEvent,{transform:b,snapGrid:k,snapToGrid:I,containerBounds:u});if(y=L.sourceEvent,(L.sourceEvent.type==="touchmove"&&L.sourceEvent.touches.length>1||S&&!P.has(S))&&(g=!0),!g){if(!l&&$&&d&&(l=!0,T()),!d){const O=he(L.sourceEvent,u),H=O.x-c.x,R=O.y-c.y;Math.sqrt(H*H+R*R)>A&&z(L)}(s.x!==j.xSnapped||s.y!==j.ySnapped)&&a&&d&&(c=he(L.sourceEvent,u),D(j))}}).on("end",L=>{if(!(!d||g)&&(l=!1,d=!1,cancelAnimationFrame(i),a.size>0)){const{nodeLookup:$,updateNodePositions:b,onNodeDragStop:k,onSelectionDragStop:I}=t();if(m&&(b(a,!1),m=!1),r||k||!S&&I){const[A,P]=En({nodeId:S,dragItems:a,nodeLookup:$,dragging:!1});r?.(L.sourceEvent,a,A,P),k?.(L.sourceEvent,A,P),S||I?.(L.sourceEvent,P)}}}).filter(L=>{const $=L.target;return!L.button&&(!_||!tr($,`.${_}`,w))&&(!p||tr($,p,w))});f.call(E)}function x(){f?.on(".drag",null)}return{update:v,destroy:x}}function Gf(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const s of t.values())vt(r,tt(s))>0&&o.push(s);return o}const Xf=250;function Yf(e,t,n,o){let r=[],s=1/0;const i=Gf(e,n,t+Xf);for(const a of i){const l=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(const c of l){if(o.nodeId===c.nodeId&&o.type===c.type&&o.id===c.id)continue;const{x:u,y:d}=Fe(a,c,c.position,!0),f=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(d-e.y,2));f>t||(f<s?(r=[{...c,x:u,y:d}],s=f):f===s&&r.push({...c,x:u,y:d}))}}if(!r.length)return null;if(r.length>1){const a=o.type==="source"?"target":"source";return r.find(l=>l.type===a)??r[0]}return r[0]}function ii(e,t,n,o,r,s=!1){const i=o.get(e);if(!i)return null;const a=r==="strict"?i.internals.handleBounds?.[t]:[...i.internals.handleBounds?.source??[],...i.internals.handleBounds?.target??[]],l=(n?a?.find(c=>c.id===n):a?.[0])??null;return l&&s?{...l,...Fe(i,l,l.position,!0)}:l}function ai(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function qf(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const ci=()=>!0;function Wf(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:s,isTarget:i,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:g,onConnectStart:m,onConnect:y,onConnectEnd:v,isValidConnection:x=ci,onReconnectEnd:_,updateConnection:p,getTransform:w,getFromHandle:M,autoPanSpeed:S,dragThreshold:N=1,handleDomNode:D}){const T=Zs(e.target);let z=0,E;const{x:L,y:$}=he(e),b=ai(s,D),k=a?.getBoundingClientRect();let I=!1;if(!k||!b)return;const A=ii(r,b,o,l,t);if(!A)return;let P=he(e,k),j=!1,O=null,H=!1,R=null;function F(){if(!u||!k)return;const[U,W]=Xs(P,k,S);f({x:U,y:W}),z=requestAnimationFrame(F)}const B={...A,nodeId:r,type:b,position:A.position},q=l.get(r);let Y={inProgress:!0,isValid:null,from:Fe(q,B,G.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:q,to:P,toHandle:null,toPosition:Fo[B.position],toNode:null,pointer:P};function V(){I=!0,p(Y),m?.(e,{nodeId:r,handleId:o,handleType:b})}N===0&&V();function X(U){if(!I){const{x:ae,y:Ee}=he(U),ve=ae-L,$e=Ee-$;if(!(ve*ve+$e*$e>N*N))return;V()}if(!M()||!B){Q(U);return}const W=w();P=he(U,k),E=Yf(Mt(P,W,!1,[1,1]),n,l,B),j||(F(),j=!0);const Z=li(U,{handle:E,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:i?"target":"source",isValidConnection:x,doc:T,lib:c,flowId:d,nodeLookup:l});R=Z.handleDomNode,O=Z.connection,H=qf(!!E,Z.isValid);const ee=l.get(r),ne=ee?Fe(ee,B,G.Left,!0):Y.from,te={...Y,from:ne,isValid:H,to:Z.toHandle&&H?Qt({x:Z.toHandle.x,y:Z.toHandle.y},W):P,toHandle:Z.toHandle,toPosition:H&&Z.toHandle?Z.toHandle.position:Fo[B.position],toNode:Z.toHandle?l.get(Z.toHandle.nodeId):null,pointer:P};p(te),Y=te}function Q(U){if(!("touches"in U&&U.touches.length>0)){if(I){(E||R)&&O&&H&&y?.(O);const{inProgress:W,...Z}=Y,ee={...Z,toPosition:Y.toHandle?Y.toPosition:null};v?.(U,ee),s&&_?.(U,ee)}g(),cancelAnimationFrame(z),j=!1,H=!1,O=null,R=null,T.removeEventListener("mousemove",X),T.removeEventListener("mouseup",Q),T.removeEventListener("touchmove",X),T.removeEventListener("touchend",Q)}}T.addEventListener("mousemove",X),T.addEventListener("mouseup",Q),T.addEventListener("touchmove",X),T.addEventListener("touchend",Q)}function li(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:s,doc:i,lib:a,flowId:l,isValidConnection:c=ci,nodeLookup:u}){const d=s==="target",f=t?i.querySelector(`.${a}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:g,y:m}=he(e),y=i.elementFromPoint(g,m),v=y?.classList.contains(`${a}-flow__handle`)?y:f,x={handleDomNode:v,isValid:!1,connection:null,toHandle:null};if(v){const _=ai(void 0,v),p=v.getAttribute("data-nodeid"),w=v.getAttribute("data-handleid"),M=v.classList.contains("connectable"),S=v.classList.contains("connectableend");if(!p||!_)return x;const N={source:d?p:o,sourceHandle:d?w:r,target:d?o:p,targetHandle:d?r:w};x.connection=N;const T=M&&S&&(n===Je.Strict?d&&_==="source"||!d&&_==="target":p!==o||w!==r);x.isValid=T&&c(N),x.toHandle=ii(p,_,w,u,n,!0)}return x}const Xn={onPointerDown:Wf,isValid:li};function Zf({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=ce(e);function s({translateExtent:a,width:l,height:c,zoomStep:u=1,pannable:d=!0,zoomable:f=!0,inversePan:g=!1}){const m=p=>{if(p.sourceEvent.type!=="wheel"||!t)return;const w=n(),M=p.sourceEvent.ctrlKey&&wt()?10:1,S=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*u,N=w[2]*Math.pow(2,S*M);t.scaleTo(N)};let y=[0,0];const v=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(y=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},x=p=>{const w=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;const M=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],S=[M[0]-y[0],M[1]-y[1]];y=M;const N=o()*Math.max(w[2],Math.log(w[2]))*(g?-1:1),D={x:w[0]-S[0]*N,y:w[1]-S[1]*N},T=[[0,0],[l,c]];t.setViewportConstrained({x:D.x,y:D.y,zoom:w[2]},T,a)},_=zs().on("start",v).on("zoom",d?x:null).on("zoom.wheel",f?m:null);r.call(_,{})}function i(){r.on("zoom",null)}return{update:s,destroy:i,pointer:de}}const hn=e=>({x:e.x,y:e.y,zoom:e.k}),Cn=({x:e,y:t,zoom:n})=>un.translate(e,t).scale(n),qe=(e,t)=>e.target.closest(`.${t}`),ui=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Kf=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Mn=(e,t=0,n=Kf,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},di=e=>{const t=e.ctrlKey&&wt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Uf({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:s,zoomOnPinch:i,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return u=>{if(qe(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(u.ctrlKey&&i){const v=de(u),x=di(u),_=d*Math.pow(2,x);o.scaleTo(n,_,v,u);return}const f=u.deltaMode===1?20:1;let g=r===Re.Vertical?0:u.deltaX*f,m=r===Re.Horizontal?0:u.deltaY*f;!wt()&&u.shiftKey&&r!==Re.Vertical&&(g=u.deltaY*f,m=0),o.translateBy(n,-(g/d)*s,-(m/d)*s,{internal:!0});const y=hn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(l?.(u,y),e.panScrollTimeout=setTimeout(()=>{c?.(u,y),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a?.(u,y))}}function Qf({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const s=o.type==="wheel",i=!t&&s&&!o.ctrlKey,a=qe(o,e);if(o.ctrlKey&&s&&a&&o.preventDefault(),i||a)return null;o.preventDefault(),n.call(this,o,r)}}function Jf({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=hn(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,r)}}function eh({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return s=>{e.usedRightMouseButton=!!(n&&ui(t,e.mouseButton??0)),s.sourceEvent?.sync||o([s.transform.x,s.transform.y,s.transform.k]),r&&!s.sourceEvent?.internal&&r?.(s.sourceEvent,hn(s.transform))}}function th({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:s}){return i=>{if(!i.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,s&&ui(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&s(i.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const a=hn(i.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(i.sourceEvent,a)},n?150:0)}}}function nh({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:s,userSelectionActive:i,noWheelClassName:a,noPanClassName:l,lib:c,connectionInProgress:u}){return d=>{const f=e||t,g=n&&d.ctrlKey,m=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(qe(d,`${c}-flow__node`)||qe(d,`${c}-flow__edge`)))return!0;if(!o&&!f&&!r&&!s&&!n||i||u&&!m||qe(d,a)&&m||qe(d,l)&&(!m||r&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type==="touchstart"&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!r&&!g&&m||!o&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(o)&&!o.includes(d.button)&&d.type==="mousedown")return!1;const y=Array.isArray(o)&&o.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&y}}function oh({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:s,onPanZoomStart:i,onPanZoomEnd:a,onDraggingChange:l}){const c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=zs().scaleExtent([t,n]).translateExtent(o),f=ce(e).call(d);_({x:r.x,y:r.y,zoom:et(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);const g=f.on("wheel.zoom"),m=f.on("dblclick.zoom");d.wheelDelta(di);function y(E,L){return f?new Promise($=>{d?.interpolate(L?.interpolate==="linear"?bn:Ot).transform(Mn(f,L?.duration,L?.ease,()=>$(!0)),E)}):Promise.resolve(!1)}function v({noWheelClassName:E,noPanClassName:L,onPaneContextMenu:$,userSelectionActive:b,panOnScroll:k,panOnDrag:I,panOnScrollMode:A,panOnScrollSpeed:P,preventScrolling:j,zoomOnPinch:O,zoomOnScroll:H,zoomOnDoubleClick:R,zoomActivationKeyPressed:F,lib:B,onTransformChange:q,connectionInProgress:K,paneClickDistance:Y,selectionOnDrag:V}){b&&!c.isZoomingOrPanning&&x();const X=k&&!F&&!b;d.clickDistance(V?1/0:!fe(Y)||Y<0?0:Y);const Q=X?Uf({zoomPanValues:c,noWheelClassName:E,d3Selection:f,d3Zoom:d,panOnScrollMode:A,panOnScrollSpeed:P,zoomOnPinch:O,onPanZoomStart:i,onPanZoom:s,onPanZoomEnd:a}):Qf({noWheelClassName:E,preventScrolling:j,d3ZoomHandler:g});if(f.on("wheel.zoom",Q,{passive:!1}),!b){const W=Jf({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:i});d.on("start",W);const Z=eh({zoomPanValues:c,panOnDrag:I,onPaneContextMenu:!!$,onPanZoom:s,onTransformChange:q});d.on("zoom",Z);const ee=th({zoomPanValues:c,panOnDrag:I,panOnScroll:k,onPaneContextMenu:$,onPanZoomEnd:a,onDraggingChange:l});d.on("end",ee)}const U=nh({zoomActivationKeyPressed:F,panOnDrag:I,zoomOnScroll:H,panOnScroll:k,zoomOnDoubleClick:R,zoomOnPinch:O,userSelectionActive:b,noPanClassName:L,noWheelClassName:E,lib:B,connectionInProgress:K});d.filter(U),R?f.on("dblclick.zoom",m):f.on("dblclick.zoom",null)}function x(){d.on("zoom",null)}async function _(E,L,$){const b=Cn(E),k=d?.constrain()(b,L,$);return k&&await y(k),new Promise(I=>I(k))}async function p(E,L){const $=Cn(E);return await y($,L),new Promise(b=>b($))}function w(E){if(f){const L=Cn(E),$=f.property("__zoom");($.k!==E.zoom||$.x!==E.x||$.y!==E.y)&&d?.transform(f,L,null,{sync:!0})}}function M(){const E=f?$s(f.node()):{x:0,y:0,k:1};return{x:E.x,y:E.y,zoom:E.k}}function S(E,L){return f?new Promise($=>{d?.interpolate(L?.interpolate==="linear"?bn:Ot).scaleTo(Mn(f,L?.duration,L?.ease,()=>$(!0)),E)}):Promise.resolve(!1)}function N(E,L){return f?new Promise($=>{d?.interpolate(L?.interpolate==="linear"?bn:Ot).scaleBy(Mn(f,L?.duration,L?.ease,()=>$(!0)),E)}):Promise.resolve(!1)}function D(E){d?.scaleExtent(E)}function T(E){d?.translateExtent(E)}function z(E){const L=!fe(E)||E<0?0:E;d?.clickDistance(L)}return{update:v,destroy:x,setViewport:p,setViewportConstrained:_,getViewport:M,scaleTo:S,scaleBy:N,setScaleExtent:D,setTranslateExtent:T,syncViewport:w,setClickDistance:z}}var ot;(function(e){e.Line="line",e.Handle="handle"})(ot||(ot={}));function rh({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:s}){const i=e-t,a=n-o,l=[i>0?1:i<0?-1:0,a>0?1:a<0?-1:0];return i&&r&&(l[0]=l[0]*-1),a&&s&&(l[1]=l[1]*-1),l}function nr(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function Ce(e,t){return Math.max(0,t-e)}function Me(e,t){return Math.max(0,e-t)}function At(e,t,n){return Math.max(0,t-e,e-n)}function or(e,t){return e?!t:t}function sh(e,t,n,o,r,s,i,a){let{affectsX:l,affectsY:c}=t;const{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:g,ySnapped:m}=n,{minWidth:y,maxWidth:v,minHeight:x,maxHeight:_}=o,{x:p,y:w,width:M,height:S,aspectRatio:N}=e;let D=Math.floor(u?g-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0);const z=M+(l?-D:D),E=S+(c?-T:T),L=-s[0]*M,$=-s[1]*S;let b=At(z,y,v),k=At(E,x,_);if(i){let P=0,j=0;l&&D<0?P=Ce(p+D+L,i[0][0]):!l&&D>0&&(P=Me(p+z+L,i[1][0])),c&&T<0?j=Ce(w+T+$,i[0][1]):!c&&T>0&&(j=Me(w+E+$,i[1][1])),b=Math.max(b,P),k=Math.max(k,j)}if(a){let P=0,j=0;l&&D>0?P=Me(p+D,a[0][0]):!l&&D<0&&(P=Ce(p+z,a[1][0])),c&&T>0?j=Me(w+T,a[0][1]):!c&&T<0&&(j=Ce(w+E,a[1][1])),b=Math.max(b,P),k=Math.max(k,j)}if(r){if(u){const P=At(z/N,x,_)*N;if(b=Math.max(b,P),i){let j=0;!l&&!c||l&&!c&&f?j=Me(w+$+z/N,i[1][1])*N:j=Ce(w+$+(l?D:-D)/N,i[0][1])*N,b=Math.max(b,j)}if(a){let j=0;!l&&!c||l&&!c&&f?j=Ce(w+z/N,a[1][1])*N:j=Me(w+(l?D:-D)/N,a[0][1])*N,b=Math.max(b,j)}}if(d){const P=At(E*N,y,v)/N;if(k=Math.max(k,P),i){let j=0;!l&&!c||c&&!l&&f?j=Me(p+E*N+L,i[1][0])/N:j=Ce(p+(c?T:-T)*N+L,i[0][0])/N,k=Math.max(k,j)}if(a){let j=0;!l&&!c||c&&!l&&f?j=Ce(p+E*N,a[1][0])/N:j=Me(p+(c?T:-T)*N,a[0][0])/N,k=Math.max(k,j)}}}T=T+(T<0?k:-k),D=D+(D<0?b:-b),r&&(f?z>E*N?T=(or(l,c)?-D:D)/N:D=(or(l,c)?-T:T)*N:u?(T=D/N,c=l):(D=T*N,l=c));const I=l?p+D:p,A=c?w+T:w;return{width:M+(l?-D:D),height:S+(c?-T:T),x:s[0]*D*(l?-1:1)+I,y:s[1]*T*(c?-1:1)+A}}const fi={width:0,height:0,x:0,y:0},ih={...fi,pointerX:0,pointerY:0,aspectRatio:1};function ah(e){return[[0,0],[e.measured.width,e.measured.height]]}function ch(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,s=e.measured.width??0,i=e.measured.height??0,a=n[0]*s,l=n[1]*i;return[[o-a,r-l],[o+s-a,r+i-l]]}function lh({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const s=ce(e);let i={controlDirection:nr("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:c,boundaries:u,keepAspectRatio:d,resizeDirection:f,onResizeStart:g,onResize:m,onResizeEnd:y,shouldResize:v}){let x={...fi},_={...ih};i={boundaries:u,resizeDirection:f,keepAspectRatio:d,controlDirection:nr(c)};let p,w=null,M=[],S,N,D,T=!1;const z=Cs().on("start",E=>{const{nodeLookup:L,transform:$,snapGrid:b,snapToGrid:k,nodeOrigin:I,paneDomNode:A}=n();if(p=L.get(t),!p)return;w=A?.getBoundingClientRect()??null;const{xSnapped:P,ySnapped:j}=ht(E.sourceEvent,{transform:$,snapGrid:b,snapToGrid:k,containerBounds:w});x={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},_={...x,pointerX:P,pointerY:j,aspectRatio:x.width/x.height},S=void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(S=L.get(p.parentId),N=S&&p.extent==="parent"?ah(S):void 0),M=[],D=void 0;for(const[O,H]of L)if(H.parentId===t&&(M.push({id:O,position:{...H.position},extent:H.extent}),H.extent==="parent"||H.expandParent)){const R=ch(H,p,H.origin??I);D?D=[[Math.min(R[0][0],D[0][0]),Math.min(R[0][1],D[0][1])],[Math.max(R[1][0],D[1][0]),Math.max(R[1][1],D[1][1])]]:D=R}g?.(E,{...x})}).on("drag",E=>{const{transform:L,snapGrid:$,snapToGrid:b,nodeOrigin:k}=n(),I=ht(E.sourceEvent,{transform:L,snapGrid:$,snapToGrid:b,containerBounds:w}),A=[];if(!p)return;const{x:P,y:j,width:O,height:H}=x,R={},F=p.origin??k,{width:B,height:q,x:K,y:Y}=sh(_,i.controlDirection,I,i.boundaries,i.keepAspectRatio,F,N,D),V=B!==O,X=q!==H,Q=K!==P&&V,U=Y!==j&&X;if(!Q&&!U&&!V&&!X)return;if((Q||U||F[0]===1||F[1]===1)&&(R.x=Q?K:x.x,R.y=U?Y:x.y,x.x=R.x,x.y=R.y,M.length>0)){const ne=K-P,te=Y-j;for(const ae of M)ae.position={x:ae.position.x-ne+F[0]*(B-O),y:ae.position.y-te+F[1]*(q-H)},A.push(ae)}if((V||X)&&(R.width=V&&(!i.resizeDirection||i.resizeDirection==="horizontal")?B:x.width,R.height=X&&(!i.resizeDirection||i.resizeDirection==="vertical")?q:x.height,x.width=R.width,x.height=R.height),S&&p.expandParent){const ne=F[0]*(R.width??0);R.x&&R.x<ne&&(x.x=ne,_.x=_.x-(R.x-ne));const te=F[1]*(R.height??0);R.y&&R.y<te&&(x.y=te,_.y=_.y-(R.y-te))}const W=rh({width:x.width,prevWidth:O,height:x.height,prevHeight:H,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),Z={...x,direction:W};v?.(E,Z)!==!1&&(T=!0,m?.(E,Z),o(R,A))}).on("end",E=>{T&&(y?.(E,{...x}),r?.({...x}),T=!1)});s.call(z)}function l(){s.on(".drag",null)}return{update:a,destroy:l}}const uh={},rr=e=>{let t;const n=new Set,o=(u,d)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const g=t;t=d??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(m=>m(t,g))}},r=()=>t,l={setState:o,getState:r,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(uh?"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()}},c=t=e(o,r,l);return l},dh=e=>e?rr(e):rr,{useDebugValue:fh}=ue,{useSyncExternalStoreWithSelector:hh}=uc,mh=e=>e;function hi(e,t=mh,n){const o=hh(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return fh(o),o}const sr=(e,t)=>{const n=dh(e),o=(r,s=t)=>hi(n,r,s);return Object.assign(o,n),o},gh=(e,t)=>e?sr(e,t):sr;function oe(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[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const mn=C.createContext(null),ph=mn.Provider,mi=pe.error001();function J(e,t){const n=C.useContext(mn);if(n===null)throw new Error(mi);return hi(n,e,t)}function re(){const e=C.useContext(mn);if(e===null)throw new Error(mi);return C.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const ir={display:"none"},yh={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},gi="react-flow__node-desc",pi="react-flow__edge-desc",xh="react-flow__aria-live",vh=e=>e.ariaLiveMessage,wh=e=>e.ariaLabelConfig;function bh({rfId:e}){const t=J(vh);return h.jsx("div",{id:`${xh}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:yh,children:t})}function _h({rfId:e,disableKeyboardA11y:t}){const n=J(wh);return h.jsxs(h.Fragment,{children:[h.jsx("div",{id:`${gi}-${e}`,style:ir,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),h.jsx("div",{id:`${pi}-${e}`,style:ir,children:n["edge.a11yDescription.default"]}),!t&&h.jsx(bh,{rfId:e})]})}const gn=C.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},s)=>{const i=`${e}`.split("-");return h.jsx("div",{className:ie(["react-flow__panel",n,...i]),style:o,ref:s,...r,children:t})});gn.displayName="Panel";function Sh({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:h.jsx(gn,{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 Nh=e=>{const t=[],n=[];for(const[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(const[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},Dt=e=>e.id;function Eh(e,t){return oe(e.selectedNodes.map(Dt),t.selectedNodes.map(Dt))&&oe(e.selectedEdges.map(Dt),t.selectedEdges.map(Dt))}function Ch({onSelectionChange:e}){const t=re(),{selectedNodes:n,selectedEdges:o}=J(Nh,Eh);return C.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(s=>s(r))},[n,o,e]),null}const Mh=e=>!!e.onSelectionChangeHandlers;function Ih({onSelectionChange:e}){const t=J(Mh);return e||t?h.jsx(Ch,{onSelectionChange:e}):null}const yi=[0,0],kh={x:0,y:0,zoom:1},Ph=["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"],ar=[...Ph,"rfId"],jh=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}),cr={translateExtent:yt,nodeOrigin:yi,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Th(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:s,setNodeExtent:i,reset:a,setDefaultNodesAndEdges:l}=J(jh,oe),c=re();C.useEffect(()=>(l(e.defaultNodes,e.defaultEdges),()=>{u.current=cr,a()}),[]);const u=C.useRef(cr);return C.useEffect(()=>{for(const d of ar){const f=e[d],g=u.current[d];f!==g&&(typeof e[d]>"u"||(d==="nodes"?t(f):d==="edges"?n(f):d==="minZoom"?o(f):d==="maxZoom"?r(f):d==="translateExtent"?s(f):d==="nodeExtent"?i(f):d==="ariaLabelConfig"?c.setState({ariaLabelConfig:bf(f)}):d==="fitView"?c.setState({fitViewQueued:f}):d==="fitViewOptions"?c.setState({fitViewOptions:f}):c.setState({[d]:f})))}u.current=e},ar.map(d=>e[d])),null}function lr(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Ah(e){const[t,n]=C.useState(e==="system"?null:e);return C.useEffect(()=>{if(e!=="system"){n(e);return}const o=lr(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:lr()?.matches?"dark":"light"}const ur=typeof document<"u"?document:null;function bt(e=null,t={target:ur,actInsideInputWithModifier:!0}){const[n,o]=C.useState(!1),r=C.useRef(!1),s=C.useRef(new Set([])),[i,a]=C.useMemo(()=>{if(e!==null){const c=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",`
2
- `).replace(`
3
-
4
- `,`
5
- +`).split(`
6
- `)),u=c.reduce((d,f)=>d.concat(...f),[]);return[c,u]}return[[],[]]},[e]);return C.useEffect(()=>{const l=t?.target??ur,c=t?.actInsideInputWithModifier??!0;if(e!==null){const u=g=>{if(r.current=g.ctrlKey||g.metaKey||g.shiftKey||g.altKey,(!r.current||r.current&&!c)&&Ks(g))return!1;const y=fr(g.code,a);if(s.current.add(g[y]),dr(i,s.current,!1)){const v=g.composedPath?.()?.[0]||g.target,x=v?.nodeName==="BUTTON"||v?.nodeName==="A";t.preventDefault!==!1&&(r.current||!x)&&g.preventDefault(),o(!0)}},d=g=>{const m=fr(g.code,a);dr(i,s.current,!0)?(o(!1),s.current.clear()):s.current.delete(g[m]),g.key==="Meta"&&s.current.clear(),r.current=!1},f=()=>{s.current.clear(),o(!1)};return l?.addEventListener("keydown",u),l?.addEventListener("keyup",d),window.addEventListener("blur",f),window.addEventListener("contextmenu",f),()=>{l?.removeEventListener("keydown",u),l?.removeEventListener("keyup",d),window.removeEventListener("blur",f),window.removeEventListener("contextmenu",f)}}},[e,o]),n}function dr(e,t,n){return e.filter(o=>n||o.length===t.size).some(o=>o.every(r=>t.has(r)))}function fr(e,t){return t.includes(e)?"code":"key"}const Dh=()=>{const e=re();return C.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:o}=e.getState();return o?o.scaleTo(t,{duration:n?.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[o,r,s],panZoom:i}=e.getState();return i?(await i.setViewport({x:t.x??o,y:t.y??r,zoom:t.zoom??s},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,o]=e.getState().transform;return{x:t,y:n,zoom:o}},setCenter:async(t,n,o)=>e.getState().setCenter(t,n,o),fitBounds:async(t,n)=>{const{width:o,height:r,minZoom:s,maxZoom:i,panZoom:a}=e.getState(),l=co(t,o,r,s,i,n?.padding??.1);return a?(await a.setViewport(l,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:o,snapGrid:r,snapToGrid:s,domNode:i}=e.getState();if(!i)return t;const{x:a,y:l}=i.getBoundingClientRect(),c={x:t.x-a,y:t.y-l},u=n.snapGrid??r,d=n.snapToGrid??s;return Mt(c,o,d,u)},flowToScreenPosition:t=>{const{transform:n,domNode:o}=e.getState();if(!o)return t;const{x:r,y:s}=o.getBoundingClientRect(),i=Qt(t,n);return{x:i.x+r,y:i.y+s}}}),[])};function xi(e,t){const n=[],o=new Map,r=[];for(const s of e)if(s.type==="add"){r.push(s);continue}else if(s.type==="remove"||s.type==="replace")o.set(s.id,[s]);else{const i=o.get(s.id);i?i.push(s):o.set(s.id,[s])}for(const s of t){const i=o.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 l of i)Lh(l,a);n.push(a)}return r.length&&r.forEach(s=>{s.index!==void 0?n.splice(s.index,0,{...s.item}):n.push({...s.item})}),n}function Lh(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 $h(e,t){return xi(e,t)}function zh(e,t){return xi(e,t)}function Oe(e,t){return{id:e,type:"select",selected:t}}function We(e,t=new Set,n=!1){const o=[];for(const[r,s]of e){const i=t.has(r);!(s.selected===void 0&&!i)&&s.selected!==i&&(n&&(s.selected=i),o.push(Oe(s.id,i)))}return o}function hr({items:e=[],lookup:t}){const n=[],o=new Map(e.map(r=>[r.id,r]));for(const[r,s]of e.entries()){const i=t.get(s.id),a=i?.internals?.userNode??i;a!==void 0&&a!==s&&n.push({id:s.id,item:s,type:"replace"}),a===void 0&&n.push({item:s,type:"add",index:r})}for(const[r]of t)o.get(r)===void 0&&n.push({id:r,type:"remove"});return n}function mr(e){return{id:e.id,type:"remove"}}const gr=e=>df(e),Oh=e=>Bs(e);function vi(e){return C.forwardRef(e)}const Rh=typeof window<"u"?C.useLayoutEffect:C.useEffect;function pr(e){const[t,n]=C.useState(BigInt(0)),[o]=C.useState(()=>Hh(()=>n(r=>r+BigInt(1))));return Rh(()=>{const r=o.get();r.length&&(e(r),o.reset())},[t]),o}function Hh(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const wi=C.createContext(null);function Vh({children:e}){const t=re(),n=C.useCallback(a=>{const{nodes:l=[],setNodes:c,hasDefaultNodes:u,onNodesChange:d,nodeLookup:f,fitViewQueued:g,onNodesChangeMiddlewareMap:m}=t.getState();let y=l;for(const x of a)y=typeof x=="function"?x(y):x;let v=hr({items:y,lookup:f});for(const x of m.values())v=x(v);u&&c(y),v.length>0?d?.(v):g&&window.requestAnimationFrame(()=>{const{fitViewQueued:x,nodes:_,setNodes:p}=t.getState();x&&p(_)})},[]),o=pr(n),r=C.useCallback(a=>{const{edges:l=[],setEdges:c,hasDefaultEdges:u,onEdgesChange:d,edgeLookup:f}=t.getState();let g=l;for(const m of a)g=typeof m=="function"?m(g):m;u?c(g):d&&d(hr({items:g,lookup:f}))},[]),s=pr(r),i=C.useMemo(()=>({nodeQueue:o,edgeQueue:s}),[]);return h.jsx(wi.Provider,{value:i,children:e})}function Bh(){const e=C.useContext(wi);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Fh=e=>!!e.panZoom;function po(){const e=Dh(),t=re(),n=Bh(),o=J(Fh),r=C.useMemo(()=>{const s=d=>t.getState().nodeLookup.get(d),i=d=>{n.nodeQueue.push(d)},a=d=>{n.edgeQueue.push(d)},l=d=>{const{nodeLookup:f,nodeOrigin:g}=t.getState(),m=gr(d)?d:f.get(d.id),y=m.parentId?Ws(m.position,m.measured,m.parentId,f,g):m.position,v={...m,position:y,width:m.measured?.width??m.width,height:m.measured?.height??m.height};return tt(v)},c=(d,f,g={replace:!1})=>{i(m=>m.map(y=>{if(y.id===d){const v=typeof f=="function"?f(y):f;return g.replace&&gr(v)?v:{...y,...v}}return y}))},u=(d,f,g={replace:!1})=>{a(m=>m.map(y=>{if(y.id===d){const v=typeof f=="function"?f(y):f;return g.replace&&Oh(v)?v:{...y,...v}}return y}))};return{getNodes:()=>t.getState().nodes.map(d=>({...d})),getNode:d=>s(d)?.internals.userNode,getInternalNode:s,getEdges:()=>{const{edges:d=[]}=t.getState();return d.map(f=>({...f}))},getEdge:d=>t.getState().edgeLookup.get(d),setNodes:i,setEdges:a,addNodes:d=>{const f=Array.isArray(d)?d:[d];n.nodeQueue.push(g=>[...g,...f])},addEdges:d=>{const f=Array.isArray(d)?d:[d];n.edgeQueue.push(g=>[...g,...f])},toObject:()=>{const{nodes:d=[],edges:f=[],transform:g}=t.getState(),[m,y,v]=g;return{nodes:d.map(x=>({...x})),edges:f.map(x=>({...x})),viewport:{x:m,y,zoom:v}}},deleteElements:async({nodes:d=[],edges:f=[]})=>{const{nodes:g,edges:m,onNodesDelete:y,onEdgesDelete:v,triggerNodeChanges:x,triggerEdgeChanges:_,onDelete:p,onBeforeDelete:w}=t.getState(),{nodes:M,edges:S}=await pf({nodesToRemove:d,edgesToRemove:f,nodes:g,edges:m,onBeforeDelete:w}),N=S.length>0,D=M.length>0;if(N){const T=S.map(mr);v?.(S),_(T)}if(D){const T=M.map(mr);y?.(M),x(T)}return(D||N)&&p?.({nodes:M,edges:S}),{deletedNodes:M,deletedEdges:S}},getIntersectingNodes:(d,f=!0,g)=>{const m=Xo(d),y=m?d:l(d),v=g!==void 0;return y?(g||t.getState().nodes).filter(x=>{const _=t.getState().nodeLookup.get(x.id);if(_&&!m&&(x.id===d.id||!_.internals.positionAbsolute))return!1;const p=tt(v?x:_),w=vt(p,y);return f&&w>0||w>=p.width*p.height||w>=y.width*y.height}):[]},isNodeIntersecting:(d,f,g=!0)=>{const y=Xo(d)?d:l(d);if(!y)return!1;const v=vt(y,f);return g&&v>0||v>=f.width*f.height||v>=y.width*y.height},updateNode:c,updateNodeData:(d,f,g={replace:!1})=>{c(d,m=>{const y=typeof f=="function"?f(m):f;return g.replace?{...m,data:y}:{...m,data:{...m.data,...y}}},g)},updateEdge:u,updateEdgeData:(d,f,g={replace:!1})=>{u(d,m=>{const y=typeof f=="function"?f(m):f;return g.replace?{...m,data:y}:{...m,data:{...m.data,...y}}},g)},getNodesBounds:d=>{const{nodeLookup:f,nodeOrigin:g}=t.getState();return ff(d,{nodeLookup:f,nodeOrigin:g})},getHandleConnections:({type:d,id:f,nodeId:g})=>Array.from(t.getState().connectionLookup.get(`${g}-${d}${f?`-${f}`:""}`)?.values()??[]),getNodeConnections:({type:d,handleId:f,nodeId:g})=>Array.from(t.getState().connectionLookup.get(`${g}${d?f?`-${d}-${f}`:`-${d}`:""}`)?.values()??[]),fitView:async d=>{const f=t.getState().fitViewResolver??wf();return t.setState({fitViewQueued:!0,fitViewOptions:d,fitViewResolver:f}),n.nodeQueue.push(g=>[...g]),f.promise}}},[]);return C.useMemo(()=>({...r,...e,viewportInitialized:o}),[o])}const yr=e=>e.selected,Gh=typeof window<"u"?window:void 0;function Xh({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=re(),{deleteElements:o}=po(),r=bt(e,{actInsideInputWithModifier:!1}),s=bt(t,{target:Gh});C.useEffect(()=>{if(r){const{edges:i,nodes:a}=n.getState();o({nodes:a.filter(yr),edges:i.filter(yr)}),n.setState({nodesSelectionActive:!1})}},[r]),C.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])}function Yh(e){const t=re();C.useEffect(()=>{const n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;const o=lo(e.current);(o.height===0||o.width===0)&&t.getState().onError?.("004",pe.error004()),t.setState({width:o.width||500,height:o.height||500})};if(e.current){n(),window.addEventListener("resize",n);const o=new ResizeObserver(()=>n());return o.observe(e.current),()=>{window.removeEventListener("resize",n),o&&e.current&&o.unobserve(e.current)}}},[])}const pn={position:"absolute",width:"100%",height:"100%",top:0,left:0},qh=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Wh({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:o=!1,panOnScrollSpeed:r=.5,panOnScrollMode:s=Re.Free,zoomOnDoubleClick:i=!0,panOnDrag:a=!0,defaultViewport:l,translateExtent:c,minZoom:u,maxZoom:d,zoomActivationKeyCode:f,preventScrolling:g=!0,children:m,noWheelClassName:y,noPanClassName:v,onViewportChange:x,isControlledViewport:_,paneClickDistance:p,selectionOnDrag:w}){const M=re(),S=C.useRef(null),{userSelectionActive:N,lib:D,connectionInProgress:T}=J(qh,oe),z=bt(f),E=C.useRef();Yh(S);const L=C.useCallback($=>{x?.({x:$[0],y:$[1],zoom:$[2]}),_||M.setState({transform:$})},[x,_]);return C.useEffect(()=>{if(S.current){E.current=oh({domNode:S.current,minZoom:u,maxZoom:d,translateExtent:c,viewport:l,onDraggingChange:I=>M.setState({paneDragging:I}),onPanZoomStart:(I,A)=>{const{onViewportChangeStart:P,onMoveStart:j}=M.getState();j?.(I,A),P?.(A)},onPanZoom:(I,A)=>{const{onViewportChange:P,onMove:j}=M.getState();j?.(I,A),P?.(A)},onPanZoomEnd:(I,A)=>{const{onViewportChangeEnd:P,onMoveEnd:j}=M.getState();j?.(I,A),P?.(A)}});const{x:$,y:b,zoom:k}=E.current.getViewport();return M.setState({panZoom:E.current,transform:[$,b,k],domNode:S.current.closest(".react-flow")}),()=>{E.current?.destroy()}}},[]),C.useEffect(()=>{E.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:o,panOnScrollSpeed:r,panOnScrollMode:s,zoomOnDoubleClick:i,panOnDrag:a,zoomActivationKeyPressed:z,preventScrolling:g,noPanClassName:v,userSelectionActive:N,noWheelClassName:y,lib:D,onTransformChange:L,connectionInProgress:T,selectionOnDrag:w,paneClickDistance:p})},[e,t,n,o,r,s,i,a,z,g,v,N,y,D,L,T,w,p]),h.jsx("div",{className:"react-flow__renderer",ref:S,style:pn,children:m})}const Zh=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Kh(){const{userSelectionActive:e,userSelectionRect:t}=J(Zh,oe);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 In=(e,t)=>n=>{n.target===t.current&&e?.(n)},Uh=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function Qh({isSelecting:e,selectionKeyPressed:t,selectionMode:n=xt.Full,panOnDrag:o,paneClickDistance:r,selectionOnDrag:s,onSelectionStart:i,onSelectionEnd:a,onPaneClick:l,onPaneContextMenu:c,onPaneScroll:u,onPaneMouseEnter:d,onPaneMouseMove:f,onPaneMouseLeave:g,children:m}){const y=re(),{userSelectionActive:v,elementsSelectable:x,dragging:_,connectionInProgress:p}=J(Uh,oe),w=x&&(e||v),M=C.useRef(null),S=C.useRef(),N=C.useRef(new Set),D=C.useRef(new Set),T=C.useRef(!1),z=P=>{if(T.current||p){T.current=!1;return}l?.(P),y.getState().resetSelectedElements(),y.setState({nodesSelectionActive:!1})},E=P=>{if(Array.isArray(o)&&o?.includes(2)){P.preventDefault();return}c?.(P)},L=u?P=>u(P):void 0,$=P=>{T.current&&(P.stopPropagation(),T.current=!1)},b=P=>{const{domNode:j}=y.getState();if(S.current=j?.getBoundingClientRect(),!S.current)return;const O=P.target===M.current;if(!O&&!!P.target.closest(".nokey")||!e||!(s&&O||t)||P.button!==0||!P.isPrimary)return;P.target?.setPointerCapture?.(P.pointerId),T.current=!1;const{x:F,y:B}=he(P.nativeEvent,S.current);y.setState({userSelectionRect:{width:0,height:0,startX:F,startY:B,x:F,y:B}}),O||(P.stopPropagation(),P.preventDefault())},k=P=>{const{userSelectionRect:j,transform:O,nodeLookup:H,edgeLookup:R,connectionLookup:F,triggerNodeChanges:B,triggerEdgeChanges:q,defaultEdgeOptions:K,resetSelectedElements:Y}=y.getState();if(!S.current||!j)return;const{x:V,y:X}=he(P.nativeEvent,S.current),{startX:Q,startY:U}=j;if(!T.current){const te=t?0:r;if(Math.hypot(V-Q,X-U)<=te)return;Y(),i?.(P)}T.current=!0;const W={startX:Q,startY:U,x:V<Q?V:Q,y:X<U?X:U,width:Math.abs(V-Q),height:Math.abs(X-U)},Z=N.current,ee=D.current;N.current=new Set(ao(H,W,O,n===xt.Partial,!0).map(te=>te.id)),D.current=new Set;const ne=K?.selectable??!0;for(const te of N.current){const ae=F.get(te);if(ae)for(const{edgeId:Ee}of ae.values()){const ve=R.get(Ee);ve&&(ve.selectable??ne)&&D.current.add(Ee)}}if(!Yo(Z,N.current)){const te=We(H,N.current,!0);B(te)}if(!Yo(ee,D.current)){const te=We(R,D.current);q(te)}y.setState({userSelectionRect:W,userSelectionActive:!0,nodesSelectionActive:!1})},I=P=>{P.button===0&&(P.target?.releasePointerCapture?.(P.pointerId),!v&&P.target===M.current&&y.getState().userSelectionRect&&z?.(P),y.setState({userSelectionActive:!1,userSelectionRect:null}),T.current&&(a?.(P),y.setState({nodesSelectionActive:N.current.size>0})))},A=o===!0||Array.isArray(o)&&o.includes(0);return h.jsxs("div",{className:ie(["react-flow__pane",{draggable:A,dragging:_,selection:e}]),onClick:w?void 0:In(z,M),onContextMenu:In(E,M),onWheel:In(L,M),onPointerEnter:w?void 0:d,onPointerMove:w?k:f,onPointerUp:w?I:void 0,onPointerDownCapture:w?b:void 0,onClickCapture:w?$:void 0,onPointerLeave:g,ref:M,style:pn,children:[m,h.jsx(Kh,{})]})}function Yn({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:s,multiSelectionActive:i,nodeLookup:a,onError:l}=t.getState(),c=a.get(e);if(!c){l?.("012",pe.error012(e));return}t.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&i)&&(s({nodes:[c],edges:[]}),requestAnimationFrame(()=>o?.current?.blur())):r([e])}function bi({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:s,nodeClickDistance:i}){const a=re(),[l,c]=C.useState(!1),u=C.useRef();return C.useEffect(()=>{u.current=Ff({getStoreItems:()=>a.getState(),onNodeMouseDown:d=>{Yn({id:d,store:a,nodeRef:e})},onDragStart:()=>{c(!0)},onDragStop:()=>{c(!1)}})},[]),C.useEffect(()=>{if(t)u.current?.destroy();else if(e.current)return u.current?.update({noDragClassName:n,handleSelector:o,domNode:e.current,isSelectable:s,nodeId:r,nodeClickDistance:i}),()=>{u.current?.destroy()}},[n,o,t,s,e,r]),l}const Jh=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function _i(){const e=re();return C.useCallback(n=>{const{nodeExtent:o,snapToGrid:r,snapGrid:s,nodesDraggable:i,onError:a,updateNodePositions:l,nodeLookup:c,nodeOrigin:u}=e.getState(),d=new Map,f=Jh(i),g=r?s[0]:5,m=r?s[1]:5,y=n.direction.x*g*n.factor,v=n.direction.y*m*n.factor;for(const[,x]of c){if(!f(x))continue;let _={x:x.internals.positionAbsolute.x+y,y:x.internals.positionAbsolute.y+v};r&&(_=Ct(_,s));const{position:p,positionAbsolute:w}=Fs({nodeId:x.id,nextPosition:_,nodeLookup:c,nodeExtent:o,nodeOrigin:u,onError:a});x.position=p,x.internals.positionAbsolute=w,d.set(x.id,x)}l(d)},[])}const yo=C.createContext(null),em=yo.Provider;yo.Consumer;const Si=()=>C.useContext(yo),tm=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),nm=(e,t,n)=>o=>{const{connectionClickStartHandle:r,connectionMode:s,connection:i}=o,{fromHandle:a,toHandle:l,isValid:c}=i,u=l?.nodeId===e&&l?.id===t&&l?.type===n;return{connectingFrom:a?.nodeId===e&&a?.id===t&&a?.type===n,connectingTo:u,clickConnecting:r?.nodeId===e&&r?.id===t&&r?.type===n,isPossibleEndHandle:s===Je.Strict?a?.type!==n:e!==a?.nodeId||t!==a?.id,connectionInProcess:!!a,clickConnectionInProcess:!!r,valid:u&&c}};function om({type:e="source",position:t=G.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:s=!0,id:i,onConnect:a,children:l,className:c,onMouseDown:u,onTouchStart:d,...f},g){const m=i||null,y=e==="target",v=re(),x=Si(),{connectOnClick:_,noPanClassName:p,rfId:w}=J(tm,oe),{connectingFrom:M,connectingTo:S,clickConnecting:N,isPossibleEndHandle:D,connectionInProcess:T,clickConnectionInProcess:z,valid:E}=J(nm(x,m,e),oe);x||v.getState().onError?.("010",pe.error010());const L=k=>{const{defaultEdgeOptions:I,onConnect:A,hasDefaultEdges:P}=v.getState(),j={...I,...k};if(P){const{edges:O,setEdges:H}=v.getState();H(Mf(j,O))}A?.(j),a?.(j)},$=k=>{if(!x)return;const I=Us(k.nativeEvent);if(r&&(I&&k.button===0||!I)){const A=v.getState();Xn.onPointerDown(k.nativeEvent,{handleDomNode:k.currentTarget,autoPanOnConnect:A.autoPanOnConnect,connectionMode:A.connectionMode,connectionRadius:A.connectionRadius,domNode:A.domNode,nodeLookup:A.nodeLookup,lib:A.lib,isTarget:y,handleId:m,nodeId:x,flowId:A.rfId,panBy:A.panBy,cancelConnection:A.cancelConnection,onConnectStart:A.onConnectStart,onConnectEnd:A.onConnectEnd,updateConnection:A.updateConnection,onConnect:L,isValidConnection:n||A.isValidConnection,getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,autoPanSpeed:A.autoPanSpeed,dragThreshold:A.connectionDragThreshold})}I?u?.(k):d?.(k)},b=k=>{const{onClickConnectStart:I,onClickConnectEnd:A,connectionClickStartHandle:P,connectionMode:j,isValidConnection:O,lib:H,rfId:R,nodeLookup:F,connection:B}=v.getState();if(!x||!P&&!r)return;if(!P){I?.(k.nativeEvent,{nodeId:x,handleId:m,handleType:e}),v.setState({connectionClickStartHandle:{nodeId:x,type:e,id:m}});return}const q=Zs(k.target),K=n||O,{connection:Y,isValid:V}=Xn.isValid(k.nativeEvent,{handle:{nodeId:x,id:m,type:e},connectionMode:j,fromNodeId:P.nodeId,fromHandleId:P.id||null,fromType:P.type,isValidConnection:K,flowId:R,doc:q,lib:H,nodeLookup:F});V&&Y&&L(Y);const X=structuredClone(B);delete X.inProgress,X.toPosition=X.toHandle?X.toHandle.position:null,A?.(k,X),v.setState({connectionClickStartHandle:null})};return h.jsx("div",{"data-handleid":m,"data-nodeid":x,"data-handlepos":t,"data-id":`${w}-${x}-${m}-${e}`,className:ie(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",p,c,{source:!y,target:y,connectable:o,connectablestart:r,connectableend:s,clickconnecting:N,connectingfrom:M,connectingto:S,valid:E,connectionindicator:o&&(!T||D)&&(T||z?s:r)}]),onMouseDown:$,onTouchStart:$,onClick:_?b:void 0,ref:g,...f,children:l})}const Pe=C.memo(vi(om));function rm({data:e,isConnectable:t,sourcePosition:n=G.Bottom}){return h.jsxs(h.Fragment,{children:[e?.label,h.jsx(Pe,{type:"source",position:n,isConnectable:t})]})}function sm({data:e,isConnectable:t,targetPosition:n=G.Top,sourcePosition:o=G.Bottom}){return h.jsxs(h.Fragment,{children:[h.jsx(Pe,{type:"target",position:n,isConnectable:t}),e?.label,h.jsx(Pe,{type:"source",position:o,isConnectable:t})]})}function im(){return null}function am({data:e,isConnectable:t,targetPosition:n=G.Top}){return h.jsxs(h.Fragment,{children:[h.jsx(Pe,{type:"target",position:n,isConnectable:t}),e?.label]})}const Jt={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},xr={input:rm,default:sm,output:am,group:im};function cm(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}const lm=e=>{const{width:t,height:n,x:o,y:r}=Et(e.nodeLookup,{filter:s=>!!s.selected});return{width:fe(t)?t:null,height:fe(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${o}px,${r}px)`}};function um({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const o=re(),{width:r,height:s,transformString:i,userSelectionActive:a}=J(lm,oe),l=_i(),c=C.useRef(null);if(C.useEffect(()=>{n||c.current?.focus({preventScroll:!0})},[n]),bi({nodeRef:c}),a||!r||!s)return null;const u=e?f=>{const g=o.getState().nodes.filter(m=>m.selected);e(f,g)}:void 0,d=f=>{Object.prototype.hasOwnProperty.call(Jt,f.key)&&(f.preventDefault(),l({direction:Jt[f.key],factor:f.shiftKey?4:1}))};return h.jsx("div",{className:ie(["react-flow__nodesselection","react-flow__container",t]),style:{transform:i},children:h.jsx("div",{ref:c,className:"react-flow__nodesselection-rect",onContextMenu:u,tabIndex:n?void 0:-1,onKeyDown:n?void 0:d,style:{width:r,height:s}})})}const vr=typeof window<"u"?window:void 0,dm=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Ni({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:i,paneClickDistance:a,deleteKeyCode:l,selectionKeyCode:c,selectionOnDrag:u,selectionMode:d,onSelectionStart:f,onSelectionEnd:g,multiSelectionKeyCode:m,panActivationKeyCode:y,zoomActivationKeyCode:v,elementsSelectable:x,zoomOnScroll:_,zoomOnPinch:p,panOnScroll:w,panOnScrollSpeed:M,panOnScrollMode:S,zoomOnDoubleClick:N,panOnDrag:D,defaultViewport:T,translateExtent:z,minZoom:E,maxZoom:L,preventScrolling:$,onSelectionContextMenu:b,noWheelClassName:k,noPanClassName:I,disableKeyboardA11y:A,onViewportChange:P,isControlledViewport:j}){const{nodesSelectionActive:O,userSelectionActive:H}=J(dm,oe),R=bt(c,{target:vr}),F=bt(y,{target:vr}),B=F||D,q=F||w,K=u&&B!==!0,Y=R||H||K;return Xh({deleteKeyCode:l,multiSelectionKeyCode:m}),h.jsx(Wh,{onPaneContextMenu:s,elementsSelectable:x,zoomOnScroll:_,zoomOnPinch:p,panOnScroll:q,panOnScrollSpeed:M,panOnScrollMode:S,zoomOnDoubleClick:N,panOnDrag:!R&&B,defaultViewport:T,translateExtent:z,minZoom:E,maxZoom:L,zoomActivationKeyCode:v,preventScrolling:$,noWheelClassName:k,noPanClassName:I,onViewportChange:P,isControlledViewport:j,paneClickDistance:a,selectionOnDrag:K,children:h.jsxs(Qh,{onSelectionStart:f,onSelectionEnd:g,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:i,panOnDrag:B,isSelecting:!!Y,selectionMode:d,selectionKeyPressed:R,paneClickDistance:a,selectionOnDrag:K,children:[e,O&&h.jsx(um,{onSelectionContextMenu:b,noPanClassName:I,disableKeyboardA11y:A})]})})}Ni.displayName="FlowRenderer";const fm=C.memo(Ni),hm=e=>t=>e?ao(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 mm(e){return J(C.useCallback(hm(e),[e]),oe)}const gm=e=>e.updateNodeInternals;function pm(){const e=J(gm),[t]=C.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const o=new Map;n.forEach(r=>{const s=r.target.getAttribute("data-id");o.set(s,{id:s,nodeElement:r.target,force:!0})}),e(o)}));return C.useEffect(()=>()=>{t?.disconnect()},[t]),t}function ym({node:e,nodeType:t,hasDimensions:n,resizeObserver:o}){const r=re(),s=C.useRef(null),i=C.useRef(null),a=C.useRef(e.sourcePosition),l=C.useRef(e.targetPosition),c=C.useRef(t),u=n&&!!e.internals.handleBounds;return C.useEffect(()=>{s.current&&!e.hidden&&(!u||i.current!==s.current)&&(i.current&&o?.unobserve(i.current),o?.observe(s.current),i.current=s.current)},[u,e.hidden]),C.useEffect(()=>()=>{i.current&&(o?.unobserve(i.current),i.current=null)},[]),C.useEffect(()=>{if(s.current){const d=c.current!==t,f=a.current!==e.sourcePosition,g=l.current!==e.targetPosition;(d||f||g)&&(c.current=t,a.current=e.sourcePosition,l.current=e.targetPosition,r.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:s.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),s}function xm({id:e,onClick:t,onMouseEnter:n,onMouseMove:o,onMouseLeave:r,onContextMenu:s,onDoubleClick:i,nodesDraggable:a,elementsSelectable:l,nodesConnectable:c,nodesFocusable:u,resizeObserver:d,noDragClassName:f,noPanClassName:g,disableKeyboardA11y:m,rfId:y,nodeTypes:v,nodeClickDistance:x,onError:_}){const{node:p,internals:w,isParent:M}=J(V=>{const X=V.nodeLookup.get(e),Q=V.parentLookup.has(e);return{node:X,internals:X.internals,isParent:Q}},oe);let S=p.type||"default",N=v?.[S]||xr[S];N===void 0&&(_?.("003",pe.error003(S)),S="default",N=v?.default||xr.default);const D=!!(p.draggable||a&&typeof p.draggable>"u"),T=!!(p.selectable||l&&typeof p.selectable>"u"),z=!!(p.connectable||c&&typeof p.connectable>"u"),E=!!(p.focusable||u&&typeof p.focusable>"u"),L=re(),$=qs(p),b=ym({node:p,nodeType:S,hasDimensions:$,resizeObserver:d}),k=bi({nodeRef:b,disabled:p.hidden||!D,noDragClassName:f,handleSelector:p.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:x}),I=_i();if(p.hidden)return null;const A=Ne(p),P=cm(p),j=T||D||t||n||o||r,O=n?V=>n(V,{...w.userNode}):void 0,H=o?V=>o(V,{...w.userNode}):void 0,R=r?V=>r(V,{...w.userNode}):void 0,F=s?V=>s(V,{...w.userNode}):void 0,B=i?V=>i(V,{...w.userNode}):void 0,q=V=>{const{selectNodesOnDrag:X,nodeDragThreshold:Q}=L.getState();T&&(!X||!D||Q>0)&&Yn({id:e,store:L,nodeRef:b}),t&&t(V,{...w.userNode})},K=V=>{if(!(Ks(V.nativeEvent)||m)){if(Os.includes(V.key)&&T){const X=V.key==="Escape";Yn({id:e,store:L,unselect:X,nodeRef:b})}else if(D&&p.selected&&Object.prototype.hasOwnProperty.call(Jt,V.key)){V.preventDefault();const{ariaLabelConfig:X}=L.getState();L.setState({ariaLiveMessage:X["node.a11yDescription.ariaLiveMessage"]({direction:V.key.replace("Arrow","").toLowerCase(),x:~~w.positionAbsolute.x,y:~~w.positionAbsolute.y})}),I({direction:Jt[V.key],factor:V.shiftKey?4:1})}}},Y=()=>{if(m||!b.current?.matches(":focus-visible"))return;const{transform:V,width:X,height:Q,autoPanOnNodeFocus:U,setCenter:W}=L.getState();if(!U)return;ao(new Map([[e,p]]),{x:0,y:0,width:X,height:Q},V,!0).length>0||W(p.position.x+A.width/2,p.position.y+A.height/2,{zoom:V[2]})};return h.jsx("div",{className:ie(["react-flow__node",`react-flow__node-${S}`,{[g]:D},p.className,{selected:p.selected,selectable:T,parent:M,draggable:D,dragging:k}]),ref:b,style:{zIndex:w.z,transform:`translate(${w.positionAbsolute.x}px,${w.positionAbsolute.y}px)`,pointerEvents:j?"all":"none",visibility:$?"visible":"hidden",...p.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:O,onMouseMove:H,onMouseLeave:R,onContextMenu:F,onClick:q,onDoubleClick:B,onKeyDown:E?K:void 0,tabIndex:E?0:void 0,onFocus:E?Y:void 0,role:p.ariaRole??(E?"group":void 0),"aria-roledescription":"node","aria-describedby":m?void 0:`${gi}-${y}`,"aria-label":p.ariaLabel,...p.domAttributes,children:h.jsx(em,{value:e,children:h.jsx(N,{id:e,data:p.data,type:S,positionAbsoluteX:w.positionAbsolute.x,positionAbsoluteY:w.positionAbsolute.y,selected:p.selected??!1,selectable:T,draggable:D,deletable:p.deletable??!0,isConnectable:z,sourcePosition:p.sourcePosition,targetPosition:p.targetPosition,dragging:k,dragHandle:p.dragHandle,zIndex:w.z,parentId:p.parentId,...A})})})}var vm=C.memo(xm);const wm=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Ei(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,onError:s}=J(wm,oe),i=mm(e.onlyRenderVisibleElements),a=pm();return h.jsx("div",{className:"react-flow__nodes",style:pn,children:i.map(l=>h.jsx(vm,{id:l,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:o,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:s},l))})}Ei.displayName="NodeRenderer";const bm=C.memo(Ei);function _m(e){return J(C.useCallback(n=>{if(!e)return n.edges.map(r=>r.id);const o=[];if(n.width&&n.height)for(const r of n.edges){const s=n.nodeLookup.get(r.source),i=n.nodeLookup.get(r.target);s&&i&&Nf({sourceNode:s,targetNode:i,width:n.width,height:n.height,transform:n.transform})&&o.push(r.id)}return o},[e]),oe)}const Sm=({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"})},Nm=({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"})},wr={[Kt.Arrow]:Sm,[Kt.ArrowClosed]:Nm};function Em(e){const t=re();return C.useMemo(()=>Object.prototype.hasOwnProperty.call(wr,e)?wr[e]:(t.getState().onError?.("009",pe.error009(e)),null),[e])}const Cm=({id:e,type:t,color:n,width:o=12.5,height:r=12.5,markerUnits:s="strokeWidth",strokeWidth:i,orient:a="auto-start-reverse"})=>{const l=Em(t);return l?h.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${o}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:a,refX:"0",refY:"0",children:h.jsx(l,{color:n,strokeWidth:i})}):null},Ci=({defaultColor:e,rfId:t})=>{const n=J(s=>s.edges),o=J(s=>s.defaultEdgeOptions),r=C.useMemo(()=>Tf(n,{id:t,defaultColor:e,defaultMarkerStart:o?.markerStart,defaultMarkerEnd:o?.markerEnd}),[n,o,t,e]);return r.length?h.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:h.jsx("defs",{children:r.map(s=>h.jsx(Cm,{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};Ci.displayName="MarkerDefinitions";var Mm=C.memo(Ci);function Mi({x:e,y:t,label:n,labelStyle:o,labelShowBg:r=!0,labelBgStyle:s,labelBgPadding:i=[2,4],labelBgBorderRadius:a=2,children:l,className:c,...u}){const[d,f]=C.useState({x:1,y:0,width:0,height:0}),g=ie(["react-flow__edge-textwrapper",c]),m=C.useRef(null);return C.useEffect(()=>{if(m.current){const y=m.current.getBBox();f({x:y.x,y:y.y,width:y.width,height:y.height})}},[n]),n?h.jsxs("g",{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:g,visibility:d.width?"visible":"hidden",...u,children:[r&&h.jsx("rect",{width:d.width+2*i[0],x:-i[0],y:-i[1],height:d.height+2*i[1],className:"react-flow__edge-textbg",style:s,rx:a,ry:a}),h.jsx("text",{className:"react-flow__edge-text",y:d.height/2,dy:"0.3em",ref:m,style:o,children:n}),l]}):null}Mi.displayName="EdgeText";const Im=C.memo(Mi);function yn({path:e,labelX:t,labelY:n,label:o,labelStyle:r,labelShowBg:s,labelBgStyle:i,labelBgPadding:a,labelBgBorderRadius:l,interactionWidth:c=20,...u}){return h.jsxs(h.Fragment,{children:[h.jsx("path",{...u,d:e,fill:"none",className:ie(["react-flow__edge-path",u.className])}),c?h.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:c,className:"react-flow__edge-interaction"}):null,o&&fe(t)&&fe(n)?h.jsx(Im,{x:t,y:n,label:o,labelStyle:r,labelShowBg:s,labelBgStyle:i,labelBgPadding:a,labelBgBorderRadius:l}):null]})}function br({pos:e,x1:t,y1:n,x2:o,y2:r}){return e===G.Left||e===G.Right?[.5*(t+o),n]:[t,.5*(n+r)]}function Ii({sourceX:e,sourceY:t,sourcePosition:n=G.Bottom,targetX:o,targetY:r,targetPosition:s=G.Top}){const[i,a]=br({pos:n,x1:e,y1:t,x2:o,y2:r}),[l,c]=br({pos:s,x1:o,y1:r,x2:e,y2:t}),[u,d,f,g]=Qs({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:l,targetControlY:c});return[`M${e},${t} C${i},${a} ${l},${c} ${o},${r}`,u,d,f,g]}function ki(e){return C.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:s,sourcePosition:i,targetPosition:a,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:g,style:m,markerEnd:y,markerStart:v,interactionWidth:x})=>{const[_,p,w]=Ii({sourceX:n,sourceY:o,sourcePosition:i,targetX:r,targetY:s,targetPosition:a}),M=e.isInternal?void 0:t;return h.jsx(yn,{id:M,path:_,labelX:p,labelY:w,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:g,style:m,markerEnd:y,markerStart:v,interactionWidth:x})})}const km=ki({isInternal:!1}),Pi=ki({isInternal:!0});km.displayName="SimpleBezierEdge";Pi.displayName="SimpleBezierEdgeInternal";function ji(e){return C.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:d,style:f,sourcePosition:g=G.Bottom,targetPosition:m=G.Top,markerEnd:y,markerStart:v,pathOptions:x,interactionWidth:_})=>{const[p,w,M]=Bn({sourceX:n,sourceY:o,sourcePosition:g,targetX:r,targetY:s,targetPosition:m,borderRadius:x?.borderRadius,offset:x?.offset,stepPosition:x?.stepPosition}),S=e.isInternal?void 0:t;return h.jsx(yn,{id:S,path:p,labelX:w,labelY:M,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:y,markerStart:v,interactionWidth:_})})}const Ti=ji({isInternal:!1}),Ai=ji({isInternal:!0});Ti.displayName="SmoothStepEdge";Ai.displayName="SmoothStepEdgeInternal";function Di(e){return C.memo(({id:t,...n})=>{const o=e.isInternal?void 0:t;return h.jsx(Ti,{...n,id:o,pathOptions:C.useMemo(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}const Pm=Di({isInternal:!1}),Li=Di({isInternal:!0});Pm.displayName="StepEdge";Li.displayName="StepEdgeInternal";function $i(e){return C.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:g,markerStart:m,interactionWidth:y})=>{const[v,x,_]=ti({sourceX:n,sourceY:o,targetX:r,targetY:s}),p=e.isInternal?void 0:t;return h.jsx(yn,{id:p,path:v,labelX:x,labelY:_,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:g,markerStart:m,interactionWidth:y})})}const jm=$i({isInternal:!1}),zi=$i({isInternal:!0});jm.displayName="StraightEdge";zi.displayName="StraightEdgeInternal";function Oi(e){return C.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:s,sourcePosition:i=G.Bottom,targetPosition:a=G.Top,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:g,style:m,markerEnd:y,markerStart:v,pathOptions:x,interactionWidth:_})=>{const[p,w,M]=Js({sourceX:n,sourceY:o,sourcePosition:i,targetX:r,targetY:s,targetPosition:a,curvature:x?.curvature}),S=e.isInternal?void 0:t;return h.jsx(yn,{id:S,path:p,labelX:w,labelY:M,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:g,style:m,markerEnd:y,markerStart:v,interactionWidth:_})})}const Tm=Oi({isInternal:!1}),Ri=Oi({isInternal:!0});Tm.displayName="BezierEdge";Ri.displayName="BezierEdgeInternal";const _r={default:Ri,straight:zi,step:Li,smoothstep:Ai,simplebezier:Pi},Sr={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Am=(e,t,n)=>n===G.Left?e-t:n===G.Right?e+t:e,Dm=(e,t,n)=>n===G.Top?e-t:n===G.Bottom?e+t:e,Nr="react-flow__edgeupdater";function Er({position:e,centerX:t,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:s,onMouseOut:i,type:a}){return h.jsx("circle",{onMouseDown:r,onMouseEnter:s,onMouseOut:i,className:ie([Nr,`${Nr}-${a}`]),cx:Am(t,o,e),cy:Dm(n,o,e),r:o,stroke:"transparent",fill:"transparent"})}function Lm({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:o,sourceY:r,targetX:s,targetY:i,sourcePosition:a,targetPosition:l,onReconnect:c,onReconnectStart:u,onReconnectEnd:d,setReconnecting:f,setUpdateHover:g}){const m=re(),y=(w,M)=>{if(w.button!==0)return;const{autoPanOnConnect:S,domNode:N,isValidConnection:D,connectionMode:T,connectionRadius:z,lib:E,onConnectStart:L,onConnectEnd:$,cancelConnection:b,nodeLookup:k,rfId:I,panBy:A,updateConnection:P}=m.getState(),j=M.type==="target",O=(F,B)=>{f(!1),d?.(F,n,M.type,B)},H=F=>c?.(n,F),R=(F,B)=>{f(!0),u?.(w,n,M.type),L?.(F,B)};Xn.onPointerDown(w.nativeEvent,{autoPanOnConnect:S,connectionMode:T,connectionRadius:z,domNode:N,handleId:M.id,nodeId:M.nodeId,nodeLookup:k,isTarget:j,edgeUpdaterType:M.type,lib:E,flowId:I,cancelConnection:b,panBy:A,isValidConnection:D,onConnect:H,onConnectStart:R,onConnectEnd:$,onReconnectEnd:O,updateConnection:P,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:w.currentTarget})},v=w=>y(w,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),x=w=>y(w,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),_=()=>g(!0),p=()=>g(!1);return h.jsxs(h.Fragment,{children:[(e===!0||e==="source")&&h.jsx(Er,{position:a,centerX:o,centerY:r,radius:t,onMouseDown:v,onMouseEnter:_,onMouseOut:p,type:"source"}),(e===!0||e==="target")&&h.jsx(Er,{position:l,centerX:s,centerY:i,radius:t,onMouseDown:x,onMouseEnter:_,onMouseOut:p,type:"target"})]})}function $m({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:o,onClick:r,onDoubleClick:s,onContextMenu:i,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:g,rfId:m,edgeTypes:y,noPanClassName:v,onError:x,disableKeyboardA11y:_}){let p=J(W=>W.edgeLookup.get(e));const w=J(W=>W.defaultEdgeOptions);p=w?{...w,...p}:p;let M=p.type||"default",S=y?.[M]||_r[M];S===void 0&&(x?.("011",pe.error011(M)),M="default",S=y?.default||_r.default);const N=!!(p.focusable||t&&typeof p.focusable>"u"),D=typeof d<"u"&&(p.reconnectable||n&&typeof p.reconnectable>"u"),T=!!(p.selectable||o&&typeof p.selectable>"u"),z=C.useRef(null),[E,L]=C.useState(!1),[$,b]=C.useState(!1),k=re(),{zIndex:I,sourceX:A,sourceY:P,targetX:j,targetY:O,sourcePosition:H,targetPosition:R}=J(C.useCallback(W=>{const Z=W.nodeLookup.get(p.source),ee=W.nodeLookup.get(p.target);if(!Z||!ee)return{zIndex:p.zIndex,...Sr};const ne=jf({id:e,sourceNode:Z,targetNode:ee,sourceHandle:p.sourceHandle||null,targetHandle:p.targetHandle||null,connectionMode:W.connectionMode,onError:x});return{zIndex:Sf({selected:p.selected,zIndex:p.zIndex,sourceNode:Z,targetNode:ee,elevateOnSelect:W.elevateEdgesOnSelect,zIndexMode:W.zIndexMode}),...ne||Sr}},[p.source,p.target,p.sourceHandle,p.targetHandle,p.selected,p.zIndex]),oe),F=C.useMemo(()=>p.markerStart?`url('#${Fn(p.markerStart,m)}')`:void 0,[p.markerStart,m]),B=C.useMemo(()=>p.markerEnd?`url('#${Fn(p.markerEnd,m)}')`:void 0,[p.markerEnd,m]);if(p.hidden||A===null||P===null||j===null||O===null)return null;const q=W=>{const{addSelectedEdges:Z,unselectNodesAndEdges:ee,multiSelectionActive:ne}=k.getState();T&&(k.setState({nodesSelectionActive:!1}),p.selected&&ne?(ee({nodes:[],edges:[p]}),z.current?.blur()):Z([e])),r&&r(W,p)},K=s?W=>{s(W,{...p})}:void 0,Y=i?W=>{i(W,{...p})}:void 0,V=a?W=>{a(W,{...p})}:void 0,X=l?W=>{l(W,{...p})}:void 0,Q=c?W=>{c(W,{...p})}:void 0,U=W=>{if(!_&&Os.includes(W.key)&&T){const{unselectNodesAndEdges:Z,addSelectedEdges:ee}=k.getState();W.key==="Escape"?(z.current?.blur(),Z({edges:[p]})):ee([e])}};return h.jsx("svg",{style:{zIndex:I},children:h.jsxs("g",{className:ie(["react-flow__edge",`react-flow__edge-${M}`,p.className,v,{selected:p.selected,animated:p.animated,inactive:!T&&!r,updating:E,selectable:T}]),onClick:q,onDoubleClick:K,onContextMenu:Y,onMouseEnter:V,onMouseMove:X,onMouseLeave:Q,onKeyDown:N?U:void 0,tabIndex:N?0:void 0,role:p.ariaRole??(N?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":p.ariaLabel===null?void 0:p.ariaLabel||`Edge from ${p.source} to ${p.target}`,"aria-describedby":N?`${pi}-${m}`:void 0,ref:z,...p.domAttributes,children:[!$&&h.jsx(S,{id:e,source:p.source,target:p.target,type:p.type,selected:p.selected,animated:p.animated,selectable:T,deletable:p.deletable??!0,label:p.label,labelStyle:p.labelStyle,labelShowBg:p.labelShowBg,labelBgStyle:p.labelBgStyle,labelBgPadding:p.labelBgPadding,labelBgBorderRadius:p.labelBgBorderRadius,sourceX:A,sourceY:P,targetX:j,targetY:O,sourcePosition:H,targetPosition:R,data:p.data,style:p.style,sourceHandleId:p.sourceHandle,targetHandleId:p.targetHandle,markerStart:F,markerEnd:B,pathOptions:"pathOptions"in p?p.pathOptions:void 0,interactionWidth:p.interactionWidth}),D&&h.jsx(Lm,{edge:p,isReconnectable:D,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:g,sourceX:A,sourceY:P,targetX:j,targetY:O,sourcePosition:H,targetPosition:R,setUpdateHover:L,setReconnecting:b})]})})}var zm=C.memo($m);const Om=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Hi({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:o,noPanClassName:r,onReconnect:s,onEdgeContextMenu:i,onEdgeMouseEnter:a,onEdgeMouseMove:l,onEdgeMouseLeave:c,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:g,onReconnectEnd:m,disableKeyboardA11y:y}){const{edgesFocusable:v,edgesReconnectable:x,elementsSelectable:_,onError:p}=J(Om,oe),w=_m(t);return h.jsxs("div",{className:"react-flow__edges",children:[h.jsx(Mm,{defaultColor:e,rfId:n}),w.map(M=>h.jsx(zm,{id:M,edgesFocusable:v,edgesReconnectable:x,elementsSelectable:_,noPanClassName:r,onReconnect:s,onContextMenu:i,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,onClick:u,reconnectRadius:d,onDoubleClick:f,onReconnectStart:g,onReconnectEnd:m,rfId:n,onError:p,edgeTypes:o,disableKeyboardA11y:y},M))]})}Hi.displayName="EdgeRenderer";const Rm=C.memo(Hi),Hm=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Vm({children:e}){const t=J(Hm);return h.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function Bm(e){const t=po(),n=C.useRef(!1);C.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const Fm=e=>e.panZoom?.syncViewport;function Gm(e){const t=J(Fm),n=re();return C.useEffect(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Xm(e){return e.connection.inProgress?{...e.connection,to:Mt(e.connection.to,e.transform)}:{...e.connection}}function Ym(e){return Xm}function qm(e){const t=Ym();return J(t,oe)}const Wm=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Zm({containerStyle:e,style:t,type:n,component:o}){const{nodesConnectable:r,width:s,height:i,isValid:a,inProgress:l}=J(Wm,oe);return!(s&&r&&l)?null:h.jsx("svg",{style:e,width:s,height:i,className:"react-flow__connectionline react-flow__container",children:h.jsx("g",{className:ie(["react-flow__connection",Vs(a)]),children:h.jsx(Vi,{style:t,type:n,CustomComponent:o,isValid:a})})})}const Vi=({style:e,type:t=Ie.Bezier,CustomComponent:n,isValid:o})=>{const{inProgress:r,from:s,fromNode:i,fromHandle:a,fromPosition:l,to:c,toNode:u,toHandle:d,toPosition:f,pointer:g}=qm();if(!r)return;if(n)return h.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:i,fromHandle:a,fromX:s.x,fromY:s.y,toX:c.x,toY:c.y,fromPosition:l,toPosition:f,connectionStatus:Vs(o),toNode:u,toHandle:d,pointer:g});let m="";const y={sourceX:s.x,sourceY:s.y,sourcePosition:l,targetX:c.x,targetY:c.y,targetPosition:f};switch(t){case Ie.Bezier:[m]=Js(y);break;case Ie.SimpleBezier:[m]=Ii(y);break;case Ie.Step:[m]=Bn({...y,borderRadius:0});break;case Ie.SmoothStep:[m]=Bn(y);break;default:[m]=ti(y)}return h.jsx("path",{d:m,fill:"none",className:"react-flow__connection-path",style:e})};Vi.displayName="ConnectionLine";const Km={};function Cr(e=Km){C.useRef(e),re(),C.useEffect(()=>{},[e])}function Um(){re(),C.useRef(!1),C.useEffect(()=>{},[])}function Bi({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:o,onEdgeClick:r,onNodeDoubleClick:s,onEdgeDoubleClick:i,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:c,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:g,connectionLineType:m,connectionLineStyle:y,connectionLineComponent:v,connectionLineContainerStyle:x,selectionKeyCode:_,selectionOnDrag:p,selectionMode:w,multiSelectionKeyCode:M,panActivationKeyCode:S,zoomActivationKeyCode:N,deleteKeyCode:D,onlyRenderVisibleElements:T,elementsSelectable:z,defaultViewport:E,translateExtent:L,minZoom:$,maxZoom:b,preventScrolling:k,defaultMarkerColor:I,zoomOnScroll:A,zoomOnPinch:P,panOnScroll:j,panOnScrollSpeed:O,panOnScrollMode:H,zoomOnDoubleClick:R,panOnDrag:F,onPaneClick:B,onPaneMouseEnter:q,onPaneMouseMove:K,onPaneMouseLeave:Y,onPaneScroll:V,onPaneContextMenu:X,paneClickDistance:Q,nodeClickDistance:U,onEdgeContextMenu:W,onEdgeMouseEnter:Z,onEdgeMouseMove:ee,onEdgeMouseLeave:ne,reconnectRadius:te,onReconnect:ae,onReconnectStart:Ee,onReconnectEnd:ve,noDragClassName:$e,noWheelClassName:rt,noPanClassName:st,disableKeyboardA11y:it,nodeExtent:xn,rfId:It,viewport:Ge,onViewportChange:at}){return Cr(e),Cr(t),Um(),Bm(n),Gm(Ge),h.jsx(fm,{onPaneClick:B,onPaneMouseEnter:q,onPaneMouseMove:K,onPaneMouseLeave:Y,onPaneContextMenu:X,onPaneScroll:V,paneClickDistance:Q,deleteKeyCode:D,selectionKeyCode:_,selectionOnDrag:p,selectionMode:w,onSelectionStart:f,onSelectionEnd:g,multiSelectionKeyCode:M,panActivationKeyCode:S,zoomActivationKeyCode:N,elementsSelectable:z,zoomOnScroll:A,zoomOnPinch:P,zoomOnDoubleClick:R,panOnScroll:j,panOnScrollSpeed:O,panOnScrollMode:H,panOnDrag:F,defaultViewport:E,translateExtent:L,minZoom:$,maxZoom:b,onSelectionContextMenu:d,preventScrolling:k,noDragClassName:$e,noWheelClassName:rt,noPanClassName:st,disableKeyboardA11y:it,onViewportChange:at,isControlledViewport:!!Ge,children:h.jsxs(Vm,{children:[h.jsx(Rm,{edgeTypes:t,onEdgeClick:r,onEdgeDoubleClick:i,onReconnect:ae,onReconnectStart:Ee,onReconnectEnd:ve,onlyRenderVisibleElements:T,onEdgeContextMenu:W,onEdgeMouseEnter:Z,onEdgeMouseMove:ee,onEdgeMouseLeave:ne,reconnectRadius:te,defaultMarkerColor:I,noPanClassName:st,disableKeyboardA11y:it,rfId:It}),h.jsx(Zm,{style:y,type:m,component:v,containerStyle:x}),h.jsx("div",{className:"react-flow__edgelabel-renderer"}),h.jsx(bm,{nodeTypes:e,onNodeClick:o,onNodeDoubleClick:s,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:c,onNodeContextMenu:u,nodeClickDistance:U,onlyRenderVisibleElements:T,noPanClassName:st,noDragClassName:$e,disableKeyboardA11y:it,nodeExtent:xn,rfId:It}),h.jsx("div",{className:"react-flow__viewport-portal"})]})})}Bi.displayName="GraphView";const Qm=C.memo(Bi),Mr=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:s,fitView:i,fitViewOptions:a,minZoom:l=.5,maxZoom:c=2,nodeOrigin:u,nodeExtent:d,zIndexMode:f="basic"}={})=>{const g=new Map,m=new Map,y=new Map,v=new Map,x=o??t??[],_=n??e??[],p=u??[0,0],w=d??yt;ri(y,v,x);const M=Gn(_,g,m,{nodeOrigin:p,nodeExtent:w,zIndexMode:f});let S=[0,0,1];if(i&&r&&s){const N=Et(g,{filter:E=>!!((E.width||E.initialWidth)&&(E.height||E.initialHeight))}),{x:D,y:T,zoom:z}=co(N,r,s,l,c,a?.padding??.1);S=[D,T,z]}return{rfId:"1",width:r??0,height:s??0,transform:S,nodes:_,nodesInitialized:M,nodeLookup:g,parentLookup:m,edges:x,edgeLookup:v,connectionLookup:y,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:o!==void 0,panZoom:null,minZoom:l,maxZoom:c,translateExtent:yt,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Je.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:p,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:{...Hs},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:yf,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Rs,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Jm=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:s,fitView:i,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f})=>gh((g,m)=>{async function y(){const{nodeLookup:v,panZoom:x,fitViewOptions:_,fitViewResolver:p,width:w,height:M,minZoom:S,maxZoom:N}=m();x&&(await gf({nodes:v,width:w,height:M,panZoom:x,minZoom:S,maxZoom:N},_),p?.resolve(!0),g({fitViewResolver:null}))}return{...Mr({nodes:e,edges:t,width:r,height:s,fitView:i,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:o,zIndexMode:f}),setNodes:v=>{const{nodeLookup:x,parentLookup:_,nodeOrigin:p,elevateNodesOnSelect:w,fitViewQueued:M,zIndexMode:S}=m(),N=Gn(v,x,_,{nodeOrigin:p,nodeExtent:d,elevateNodesOnSelect:w,checkEquality:!0,zIndexMode:S});M&&N?(y(),g({nodes:v,nodesInitialized:N,fitViewQueued:!1,fitViewOptions:void 0})):g({nodes:v,nodesInitialized:N})},setEdges:v=>{const{connectionLookup:x,edgeLookup:_}=m();ri(x,_,v),g({edges:v})},setDefaultNodesAndEdges:(v,x)=>{if(v){const{setNodes:_}=m();_(v),g({hasDefaultNodes:!0})}if(x){const{setEdges:_}=m();_(x),g({hasDefaultEdges:!0})}},updateNodeInternals:v=>{const{triggerNodeChanges:x,nodeLookup:_,parentLookup:p,domNode:w,nodeOrigin:M,nodeExtent:S,debug:N,fitViewQueued:D,zIndexMode:T}=m(),{changes:z,updatedInternals:E}=Rf(v,_,p,w,M,S,T);E&&(Lf(_,p,{nodeOrigin:M,nodeExtent:S,zIndexMode:T}),D?(y(),g({fitViewQueued:!1,fitViewOptions:void 0})):g({}),z?.length>0&&(N&&console.log("React Flow: trigger node changes",z),x?.(z)))},updateNodePositions:(v,x=!1)=>{const _=[];let p=[];const{nodeLookup:w,triggerNodeChanges:M,connection:S,updateConnection:N,onNodesChangeMiddlewareMap:D}=m();for(const[T,z]of v){const E=w.get(T),L=!!(E?.expandParent&&E?.parentId&&z?.position),$={id:T,type:"position",position:L?{x:Math.max(0,z.position.x),y:Math.max(0,z.position.y)}:z.position,dragging:x};if(E&&S.inProgress&&S.fromNode.id===E.id){const b=Fe(E,S.fromHandle,G.Left,!0);N({...S,from:b})}L&&E.parentId&&_.push({id:T,parentId:E.parentId,rect:{...z.internals.positionAbsolute,width:z.measured.width??0,height:z.measured.height??0}}),p.push($)}if(_.length>0){const{parentLookup:T,nodeOrigin:z}=m(),E=go(_,w,T,z);p.push(...E)}for(const T of D.values())p=T(p);M(p)},triggerNodeChanges:v=>{const{onNodesChange:x,setNodes:_,nodes:p,hasDefaultNodes:w,debug:M}=m();if(v?.length){if(w){const S=$h(v,p);_(S)}M&&console.log("React Flow: trigger node changes",v),x?.(v)}},triggerEdgeChanges:v=>{const{onEdgesChange:x,setEdges:_,edges:p,hasDefaultEdges:w,debug:M}=m();if(v?.length){if(w){const S=zh(v,p);_(S)}M&&console.log("React Flow: trigger edge changes",v),x?.(v)}},addSelectedNodes:v=>{const{multiSelectionActive:x,edgeLookup:_,nodeLookup:p,triggerNodeChanges:w,triggerEdgeChanges:M}=m();if(x){const S=v.map(N=>Oe(N,!0));w(S);return}w(We(p,new Set([...v]),!0)),M(We(_))},addSelectedEdges:v=>{const{multiSelectionActive:x,edgeLookup:_,nodeLookup:p,triggerNodeChanges:w,triggerEdgeChanges:M}=m();if(x){const S=v.map(N=>Oe(N,!0));M(S);return}M(We(_,new Set([...v]))),w(We(p,new Set,!0))},unselectNodesAndEdges:({nodes:v,edges:x}={})=>{const{edges:_,nodes:p,nodeLookup:w,triggerNodeChanges:M,triggerEdgeChanges:S}=m(),N=v||p,D=x||_,T=N.map(E=>{const L=w.get(E.id);return L&&(L.selected=!1),Oe(E.id,!1)}),z=D.map(E=>Oe(E.id,!1));M(T),S(z)},setMinZoom:v=>{const{panZoom:x,maxZoom:_}=m();x?.setScaleExtent([v,_]),g({minZoom:v})},setMaxZoom:v=>{const{panZoom:x,minZoom:_}=m();x?.setScaleExtent([_,v]),g({maxZoom:v})},setTranslateExtent:v=>{m().panZoom?.setTranslateExtent(v),g({translateExtent:v})},resetSelectedElements:()=>{const{edges:v,nodes:x,triggerNodeChanges:_,triggerEdgeChanges:p,elementsSelectable:w}=m();if(!w)return;const M=x.reduce((N,D)=>D.selected?[...N,Oe(D.id,!1)]:N,[]),S=v.reduce((N,D)=>D.selected?[...N,Oe(D.id,!1)]:N,[]);_(M),p(S)},setNodeExtent:v=>{const{nodes:x,nodeLookup:_,parentLookup:p,nodeOrigin:w,elevateNodesOnSelect:M,nodeExtent:S,zIndexMode:N}=m();v[0][0]===S[0][0]&&v[0][1]===S[0][1]&&v[1][0]===S[1][0]&&v[1][1]===S[1][1]||(Gn(x,_,p,{nodeOrigin:w,nodeExtent:v,elevateNodesOnSelect:M,checkEquality:!1,zIndexMode:N}),g({nodeExtent:v}))},panBy:v=>{const{transform:x,width:_,height:p,panZoom:w,translateExtent:M}=m();return Hf({delta:v,panZoom:w,transform:x,translateExtent:M,width:_,height:p})},setCenter:async(v,x,_)=>{const{width:p,height:w,maxZoom:M,panZoom:S}=m();if(!S)return Promise.resolve(!1);const N=typeof _?.zoom<"u"?_.zoom:M;return await S.setViewport({x:p/2-v*N,y:w/2-x*N,zoom:N},{duration:_?.duration,ease:_?.ease,interpolate:_?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{g({connection:{...Hs}})},updateConnection:v=>{g({connection:v})},reset:()=>g({...Mr()})}},Object.is);function eg({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:o,initialWidth:r,initialHeight:s,initialMinZoom:i,initialMaxZoom:a,initialFitViewOptions:l,fitView:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f,children:g}){const[m]=C.useState(()=>Jm({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:s,fitView:c,minZoom:i,maxZoom:a,fitViewOptions:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f}));return h.jsx(ph,{value:m,children:h.jsx(Vh,{children:g})})}function tg({children:e,nodes:t,edges:n,defaultNodes:o,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:g}){return C.useContext(mn)?h.jsx(h.Fragment,{children:e}):h.jsx(eg,{initialNodes:t,initialEdges:n,defaultNodes:o,defaultEdges:r,initialWidth:s,initialHeight:i,fitView:a,initialFitViewOptions:l,initialMinZoom:c,initialMaxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:g,children:e})}const ng={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function og({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:s,edgeTypes:i,onNodeClick:a,onEdgeClick:l,onInit:c,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:g,onConnectStart:m,onConnectEnd:y,onClickConnectStart:v,onClickConnectEnd:x,onNodeMouseEnter:_,onNodeMouseMove:p,onNodeMouseLeave:w,onNodeContextMenu:M,onNodeDoubleClick:S,onNodeDragStart:N,onNodeDrag:D,onNodeDragStop:T,onNodesDelete:z,onEdgesDelete:E,onDelete:L,onSelectionChange:$,onSelectionDragStart:b,onSelectionDrag:k,onSelectionDragStop:I,onSelectionContextMenu:A,onSelectionStart:P,onSelectionEnd:j,onBeforeDelete:O,connectionMode:H,connectionLineType:R=Ie.Bezier,connectionLineStyle:F,connectionLineComponent:B,connectionLineContainerStyle:q,deleteKeyCode:K="Backspace",selectionKeyCode:Y="Shift",selectionOnDrag:V=!1,selectionMode:X=xt.Full,panActivationKeyCode:Q="Space",multiSelectionKeyCode:U=wt()?"Meta":"Control",zoomActivationKeyCode:W=wt()?"Meta":"Control",snapToGrid:Z,snapGrid:ee,onlyRenderVisibleElements:ne=!1,selectNodesOnDrag:te,nodesDraggable:ae,autoPanOnNodeFocus:Ee,nodesConnectable:ve,nodesFocusable:$e,nodeOrigin:rt=yi,edgesFocusable:st,edgesReconnectable:it,elementsSelectable:xn=!0,defaultViewport:It=kh,minZoom:Ge=.5,maxZoom:at=2,translateExtent:wo=yt,preventScrolling:ta=!0,nodeExtent:vn,defaultMarkerColor:na="#b1b1b7",zoomOnScroll:oa=!0,zoomOnPinch:ra=!0,panOnScroll:sa=!1,panOnScrollSpeed:ia=.5,panOnScrollMode:aa=Re.Free,zoomOnDoubleClick:ca=!0,panOnDrag:la=!0,onPaneClick:ua,onPaneMouseEnter:da,onPaneMouseMove:fa,onPaneMouseLeave:ha,onPaneScroll:ma,onPaneContextMenu:ga,paneClickDistance:pa=1,nodeClickDistance:ya=0,children:xa,onReconnect:va,onReconnectStart:wa,onReconnectEnd:ba,onEdgeContextMenu:_a,onEdgeDoubleClick:Sa,onEdgeMouseEnter:Na,onEdgeMouseMove:Ea,onEdgeMouseLeave:Ca,reconnectRadius:Ma=10,onNodesChange:Ia,onEdgesChange:ka,noDragClassName:Pa="nodrag",noWheelClassName:ja="nowheel",noPanClassName:bo="nopan",fitView:_o,fitViewOptions:So,connectOnClick:Ta,attributionPosition:Aa,proOptions:Da,defaultEdgeOptions:La,elevateNodesOnSelect:$a=!0,elevateEdgesOnSelect:za=!1,disableKeyboardA11y:No=!1,autoPanOnConnect:Oa,autoPanOnNodeDrag:Ra,autoPanSpeed:Ha,connectionRadius:Va,isValidConnection:Ba,onError:Fa,style:Ga,id:Eo,nodeDragThreshold:Xa,connectionDragThreshold:Ya,viewport:qa,onViewportChange:Wa,width:Za,height:Ka,colorMode:Ua="light",debug:Qa,onScroll:Co,ariaLabelConfig:Ja,zIndexMode:Mo="basic",...ec},tc){const wn=Eo||"1",nc=Ah(Ua),oc=C.useCallback(Io=>{Io.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Co?.(Io)},[Co]);return h.jsx("div",{"data-testid":"rf__wrapper",...ec,onScroll:oc,style:{...Ga,...ng},ref:tc,className:ie(["react-flow",r,nc]),id:Eo,role:"application",children:h.jsxs(tg,{nodes:e,edges:t,width:Za,height:Ka,fitView:_o,fitViewOptions:So,minZoom:Ge,maxZoom:at,nodeOrigin:rt,nodeExtent:vn,zIndexMode:Mo,children:[h.jsx(Qm,{onInit:c,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:_,onNodeMouseMove:p,onNodeMouseLeave:w,onNodeContextMenu:M,onNodeDoubleClick:S,nodeTypes:s,edgeTypes:i,connectionLineType:R,connectionLineStyle:F,connectionLineComponent:B,connectionLineContainerStyle:q,selectionKeyCode:Y,selectionOnDrag:V,selectionMode:X,deleteKeyCode:K,multiSelectionKeyCode:U,panActivationKeyCode:Q,zoomActivationKeyCode:W,onlyRenderVisibleElements:ne,defaultViewport:It,translateExtent:wo,minZoom:Ge,maxZoom:at,preventScrolling:ta,zoomOnScroll:oa,zoomOnPinch:ra,zoomOnDoubleClick:ca,panOnScroll:sa,panOnScrollSpeed:ia,panOnScrollMode:aa,panOnDrag:la,onPaneClick:ua,onPaneMouseEnter:da,onPaneMouseMove:fa,onPaneMouseLeave:ha,onPaneScroll:ma,onPaneContextMenu:ga,paneClickDistance:pa,nodeClickDistance:ya,onSelectionContextMenu:A,onSelectionStart:P,onSelectionEnd:j,onReconnect:va,onReconnectStart:wa,onReconnectEnd:ba,onEdgeContextMenu:_a,onEdgeDoubleClick:Sa,onEdgeMouseEnter:Na,onEdgeMouseMove:Ea,onEdgeMouseLeave:Ca,reconnectRadius:Ma,defaultMarkerColor:na,noDragClassName:Pa,noWheelClassName:ja,noPanClassName:bo,rfId:wn,disableKeyboardA11y:No,nodeExtent:vn,viewport:qa,onViewportChange:Wa}),h.jsx(Th,{nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:g,onConnectStart:m,onConnectEnd:y,onClickConnectStart:v,onClickConnectEnd:x,nodesDraggable:ae,autoPanOnNodeFocus:Ee,nodesConnectable:ve,nodesFocusable:$e,edgesFocusable:st,edgesReconnectable:it,elementsSelectable:xn,elevateNodesOnSelect:$a,elevateEdgesOnSelect:za,minZoom:Ge,maxZoom:at,nodeExtent:vn,onNodesChange:Ia,onEdgesChange:ka,snapToGrid:Z,snapGrid:ee,connectionMode:H,translateExtent:wo,connectOnClick:Ta,defaultEdgeOptions:La,fitView:_o,fitViewOptions:So,onNodesDelete:z,onEdgesDelete:E,onDelete:L,onNodeDragStart:N,onNodeDrag:D,onNodeDragStop:T,onSelectionDrag:k,onSelectionDragStart:b,onSelectionDragStop:I,onMove:u,onMoveStart:d,onMoveEnd:f,noPanClassName:bo,nodeOrigin:rt,rfId:wn,autoPanOnConnect:Oa,autoPanOnNodeDrag:Ra,autoPanSpeed:Ha,onError:Fa,connectionRadius:Va,isValidConnection:Ba,selectNodesOnDrag:te,nodeDragThreshold:Xa,connectionDragThreshold:Ya,onBeforeDelete:O,debug:Qa,ariaLabelConfig:Ja,zIndexMode:Mo}),h.jsx(Ih,{onSelectionChange:$}),xa,h.jsx(Sh,{proOptions:Da,position:Aa}),h.jsx(_h,{rfId:wn,disableKeyboardA11y:No})]})})}var rg=vi(og);function sg({dimensions:e,lineWidth:t,variant:n,className:o}){return h.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:ie(["react-flow__background-pattern",n,o])})}function ig({radius:e,className:t}){return h.jsx("circle",{cx:e,cy:e,r:e,className:ie(["react-flow__background-pattern","dots",t])})}var ke;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ke||(ke={}));const ag={[ke.Dots]:1,[ke.Lines]:1,[ke.Cross]:6},cg=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Fi({id:e,variant:t=ke.Dots,gap:n=20,size:o,lineWidth:r=1,offset:s=0,color:i,bgColor:a,style:l,className:c,patternClassName:u}){const d=C.useRef(null),{transform:f,patternId:g}=J(cg,oe),m=o||ag[t],y=t===ke.Dots,v=t===ke.Cross,x=Array.isArray(n)?n:[n,n],_=[x[0]*f[2]||1,x[1]*f[2]||1],p=m*f[2],w=Array.isArray(s)?s:[s,s],M=v?[p,p]:_,S=[w[0]*f[2]||1+M[0]/2,w[1]*f[2]||1+M[1]/2],N=`${g}${e||""}`;return h.jsxs("svg",{className:ie(["react-flow__background",c]),style:{...l,...pn,"--xy-background-color-props":a,"--xy-background-pattern-color-props":i},ref:d,"data-testid":"rf__background",children:[h.jsx("pattern",{id:N,x:f[0]%_[0],y:f[1]%_[1],width:_[0],height:_[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${S[0]},-${S[1]})`,children:y?h.jsx(ig,{radius:p/2,className:u}):h.jsx(sg,{dimensions:M,lineWidth:r,variant:t,className:u})}),h.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${N})`})]})}Fi.displayName="Background";C.memo(Fi);function lg(){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 ug(){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 dg(){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 fg(){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 hg(){return h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:h.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function Lt({children:e,className:t,...n}){return h.jsx("button",{type:"button",className:ie(["react-flow__controls-button",t]),...n,children:e})}const mg=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Gi({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:s,onZoomOut:i,onFitView:a,onInteractiveChange:l,className:c,children:u,position:d="bottom-left",orientation:f="vertical","aria-label":g}){const m=re(),{isInteractive:y,minZoomReached:v,maxZoomReached:x,ariaLabelConfig:_}=J(mg,oe),{zoomIn:p,zoomOut:w,fitView:M}=po(),S=()=>{p(),s?.()},N=()=>{w(),i?.()},D=()=>{M(r),a?.()},T=()=>{m.setState({nodesDraggable:!y,nodesConnectable:!y,elementsSelectable:!y}),l?.(!y)},z=f==="horizontal"?"horizontal":"vertical";return h.jsxs(gn,{className:ie(["react-flow__controls",z,c]),position:d,style:e,"data-testid":"rf__controls","aria-label":g??_["controls.ariaLabel"],children:[t&&h.jsxs(h.Fragment,{children:[h.jsx(Lt,{onClick:S,className:"react-flow__controls-zoomin",title:_["controls.zoomIn.ariaLabel"],"aria-label":_["controls.zoomIn.ariaLabel"],disabled:x,children:h.jsx(lg,{})}),h.jsx(Lt,{onClick:N,className:"react-flow__controls-zoomout",title:_["controls.zoomOut.ariaLabel"],"aria-label":_["controls.zoomOut.ariaLabel"],disabled:v,children:h.jsx(ug,{})})]}),n&&h.jsx(Lt,{className:"react-flow__controls-fitview",onClick:D,title:_["controls.fitView.ariaLabel"],"aria-label":_["controls.fitView.ariaLabel"],children:h.jsx(dg,{})}),o&&h.jsx(Lt,{className:"react-flow__controls-interactive",onClick:T,title:_["controls.interactive.ariaLabel"],"aria-label":_["controls.interactive.ariaLabel"],children:y?h.jsx(hg,{}):h.jsx(fg,{})}),u]})}Gi.displayName="Controls";C.memo(Gi);function gg({id:e,x:t,y:n,width:o,height:r,style:s,color:i,strokeColor:a,strokeWidth:l,className:c,borderRadius:u,shapeRendering:d,selected:f,onClick:g}){const{background:m,backgroundColor:y}=s||{},v=i||m||y;return h.jsx("rect",{className:ie(["react-flow__minimap-node",{selected:f},c]),x:t,y:n,rx:u,ry:u,width:o,height:r,style:{fill:v,stroke:a,strokeWidth:l},shapeRendering:d,onClick:g?x=>g(x,e):void 0})}const pg=C.memo(gg),yg=e=>e.nodes.map(t=>t.id),kn=e=>e instanceof Function?e:()=>e;function xg({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:o=5,nodeStrokeWidth:r,nodeComponent:s=pg,onClick:i}){const a=J(yg,oe),l=kn(t),c=kn(e),u=kn(n),d=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return h.jsx(h.Fragment,{children:a.map(f=>h.jsx(wg,{id:f,nodeColorFunc:l,nodeStrokeColorFunc:c,nodeClassNameFunc:u,nodeBorderRadius:o,nodeStrokeWidth:r,NodeComponent:s,onClick:i,shapeRendering:d},f))})}function vg({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:o,nodeBorderRadius:r,nodeStrokeWidth:s,shapeRendering:i,NodeComponent:a,onClick:l}){const{node:c,x:u,y:d,width:f,height:g}=J(m=>{const{internals:y}=m.nodeLookup.get(e),v=y.userNode,{x,y:_}=y.positionAbsolute,{width:p,height:w}=Ne(v);return{node:v,x,y:_,width:p,height:w}},oe);return!c||c.hidden||!qs(c)?null:h.jsx(a,{x:u,y:d,width:f,height:g,style:c.style,selected:!!c.selected,className:o(c),color:t(c),borderRadius:r,strokeColor:n(c),strokeWidth:s,shapeRendering:i,onClick:l,id:c.id})}const wg=C.memo(vg);var bg=C.memo(xg);const _g=200,Sg=150,Ng=e=>!e.hidden,Eg=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?Ys(Et(e.nodeLookup,{filter:Ng}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Cg="react-flow__minimap-desc";function Xi({style:e,className:t,nodeStrokeColor:n,nodeColor:o,nodeClassName:r="",nodeBorderRadius:s=5,nodeStrokeWidth:i,nodeComponent:a,bgColor:l,maskColor:c,maskStrokeColor:u,maskStrokeWidth:d,position:f="bottom-right",onClick:g,onNodeClick:m,pannable:y=!1,zoomable:v=!1,ariaLabel:x,inversePan:_,zoomStep:p=1,offsetScale:w=5}){const M=re(),S=C.useRef(null),{boundingRect:N,viewBB:D,rfId:T,panZoom:z,translateExtent:E,flowWidth:L,flowHeight:$,ariaLabelConfig:b}=J(Eg,oe),k=e?.width??_g,I=e?.height??Sg,A=N.width/k,P=N.height/I,j=Math.max(A,P),O=j*k,H=j*I,R=w*j,F=N.x-(O-N.width)/2-R,B=N.y-(H-N.height)/2-R,q=O+R*2,K=H+R*2,Y=`${Cg}-${T}`,V=C.useRef(0),X=C.useRef();V.current=j,C.useEffect(()=>{if(S.current&&z)return X.current=Zf({domNode:S.current,panZoom:z,getTransform:()=>M.getState().transform,getViewScale:()=>V.current}),()=>{X.current?.destroy()}},[z]),C.useEffect(()=>{X.current?.update({translateExtent:E,width:L,height:$,inversePan:_,pannable:y,zoomStep:p,zoomable:v})},[y,v,_,p,E,L,$]);const Q=g?Z=>{const[ee,ne]=X.current?.pointer(Z)||[0,0];g(Z,{x:ee,y:ne})}:void 0,U=m?C.useCallback((Z,ee)=>{const ne=M.getState().nodeLookup.get(ee).internals.userNode;m(Z,ne)},[]):void 0,W=x??b["minimap.ariaLabel"];return h.jsx(gn,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-stroke-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d=="number"?d*j:void 0,"--xy-minimap-node-background-color-props":typeof o=="string"?o: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:ie(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:h.jsxs("svg",{width:k,height:I,viewBox:`${F} ${B} ${q} ${K}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Y,ref:S,onClick:Q,children:[W&&h.jsx("title",{id:Y,children:W}),h.jsx(bg,{onClick:U,nodeColor:o,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:r,nodeStrokeWidth:i,nodeComponent:a}),h.jsx("path",{className:"react-flow__minimap-mask",d:`M${F-R},${B-R}h${q+R*2}v${K+R*2}h${-q-R*2}z
7
- M${D.x},${D.y}h${D.width}v${D.height}h${-D.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Xi.displayName="MiniMap";C.memo(Xi);const Mg=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Ig={[ot.Line]:"right",[ot.Handle]:"bottom-right"};function kg({nodeId:e,position:t,variant:n=ot.Handle,className:o,style:r=void 0,children:s,color:i,minWidth:a=10,minHeight:l=10,maxWidth:c=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:g=!0,shouldResize:m,onResizeStart:y,onResize:v,onResizeEnd:x}){const _=Si(),p=typeof e=="string"?e:_,w=re(),M=C.useRef(null),S=n===ot.Handle,N=J(C.useCallback(Mg(S&&g),[S,g]),oe),D=C.useRef(null),T=t??Ig[n];C.useEffect(()=>{if(!(!M.current||!p))return D.current||(D.current=lh({domNode:M.current,nodeId:p,getStoreItems:()=>{const{nodeLookup:E,transform:L,snapGrid:$,snapToGrid:b,nodeOrigin:k,domNode:I}=w.getState();return{nodeLookup:E,transform:L,snapGrid:$,snapToGrid:b,nodeOrigin:k,paneDomNode:I}},onChange:(E,L)=>{const{triggerNodeChanges:$,nodeLookup:b,parentLookup:k,nodeOrigin:I}=w.getState(),A=[],P={x:E.x,y:E.y},j=b.get(p);if(j&&j.expandParent&&j.parentId){const O=j.origin??I,H=E.width??j.measured.width??0,R=E.height??j.measured.height??0,F={id:j.id,parentId:j.parentId,rect:{width:H,height:R,...Ws({x:E.x??j.position.x,y:E.y??j.position.y},{width:H,height:R},j.parentId,b,O)}},B=go([F],b,k,I);A.push(...B),P.x=E.x?Math.max(O[0]*H,E.x):void 0,P.y=E.y?Math.max(O[1]*R,E.y):void 0}if(P.x!==void 0&&P.y!==void 0){const O={id:p,type:"position",position:{...P}};A.push(O)}if(E.width!==void 0&&E.height!==void 0){const H={id:p,type:"dimensions",resizing:!0,setAttributes:f?f==="horizontal"?"width":"height":!0,dimensions:{width:E.width,height:E.height}};A.push(H)}for(const O of L){const H={...O,type:"position"};A.push(H)}$(A)},onEnd:({width:E,height:L})=>{const $={id:p,type:"dimensions",resizing:!1,dimensions:{width:E,height:L}};w.getState().triggerNodeChanges([$])}})),D.current.update({controlPosition:T,boundaries:{minWidth:a,minHeight:l,maxWidth:c,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:y,onResize:v,onResizeEnd:x,shouldResize:m}),()=>{D.current?.destroy()}},[T,a,l,c,u,d,y,v,x,m]);const z=T.split("-");return h.jsx("div",{className:ie(["react-flow__resize-control","nodrag",...z,n,o]),ref:M,style:{...r,scale:N,...i&&{[S?"backgroundColor":"borderColor"]:i}},children:s})}C.memo(kg);const Ir=10,en=56,xo=220,mt=56,Pg={requests:{edgeColor:"var(--chart-1)",textClass:"text-chart-1"},errors:{edgeColor:"var(--chart-3)",textClass:"text-chart-3"},latency:{edgeColor:"var(--chart-4)",textClass:"text-chart-4"}};function jg(e){const t=new Map,n=new Map;for(const s of e){const i=s.connectionId;if(i){const l=n.get(i)??{requests:0,errors:0,totalLatency:0};n.set(i,{requests:l.requests+1,errors:l.errors+(s.isError?1:0),totalLatency:l.totalLatency+s.durationMs})}const a=s.gatewayId;if(a){const l=t.get(a)??{requests:0,errors:0,totalLatency:0};t.set(a,{requests:l.requests+1,errors:l.errors+(s.isError?1:0),totalLatency:l.totalLatency+s.durationMs})}}const o=new Map;for(const[s,i]of t)o.set(s,{requests:i.requests,errors:i.errors,errorRate:i.requests>0?i.errors/i.requests*100:0,avgLatencyMs:i.requests>0?i.totalLatency/i.requests:0});const r=new Map;for(const[s,i]of n)r.set(s,{requests:i.requests,errors:i.errors,errorRate:i.requests>0?i.errors/i.requests*100:0,avgLatencyMs:i.requests>0?i.totalLatency/i.requests:0});return{gateways:o,connections:r}}function Yi(e,t){if(!e)return"—";switch(t){case"requests":return e.requests===0?"—":e.requests.toLocaleString();case"errors":return e.errorRate===0?"—":`${e.errorRate.toFixed(1)}%`;case"latency":return e.avgLatencyMs===0?"—":`${Math.round(e.avgLatencyMs)}ms`}}function $t(e,t){if(!e)return 0;switch(t){case"requests":return e.requests;case"errors":return e.errorRate;case"latency":return e.avgLatencyMs}}function Tg(){const e=se.c(9),{locator:t}=Se();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=je(),e[0]=n):n=e[0];const o=n;let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r=De(),e[1]=r):r=e[1];const s=r;let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i={...s,limit:1e3,offset:0},e[2]=i):i=e[2];let a;e[3]!==t?(a={toolCaller:o,toolName:"MONITORING_LOGS_LIST",toolInputParams:i,scope:t,staleTime:3e4},e[3]=t,e[4]=a):a=e[4];const{data:l}=Te(a);let c;e[5]!==l?.logs?(c=l?.logs??[],e[5]=l?.logs,e[6]=c):c=e[6];const u=c;let d;return e[7]!==u?(d=jg(u),e[7]=u,e[8]=d):d=e[8],d}function Ag(e){const t=se.c(30),{data:n}=e,o=ye();let r;t[0]!==n.metric||t[1]!==n.metricsMode?(r=Yi(n.metric,n.metricsMode),t[0]=n.metric,t[1]=n.metricsMode,t[2]=r):r=t[2];const s=r;let i;t[3]!==n.gateway.id||t[4]!==n.metricsMode||t[5]!==n.org||t[6]!==o?(i=()=>{o({to:"/$org/monitoring",params:{org:n.org},search:{from:"now-24h",to:"now",gatewayId:[n.gateway.id],...n.metricsMode==="errors"&&{status:"errors"}}})},t[3]=n.gateway.id,t[4]=n.metricsMode,t[5]=n.org,t[6]=o,t[7]=i):i=t[7];const a=i;let l;t[8]===Symbol.for("react.memo_cache_sentinel")?(l={height:en,width:xo},t[8]=l):l=t[8];let c;t[9]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(Hr,{}),t[9]=c):c=t[9];let u;t[10]!==n.gateway.icon||t[11]!==n.gateway.title?(u=h.jsx(He,{icon:n.gateway.icon,name:n.gateway.title,size:"md",fallbackIcon:c,className:"relative z-10"}),t[10]=n.gateway.icon,t[11]=n.gateway.title,t[12]=u):u=t[12];let d;t[13]!==n.gateway.title?(d=h.jsx("span",{className:"text-sm text-muted-foreground truncate",children:n.gateway.title}),t[13]=n.gateway.title,t[14]=d):d=t[14];let f;t[15]!==n.colorScheme.textClass?(f=on("text-base leading-none font-semibold tabular-nums",n.colorScheme.textClass),t[15]=n.colorScheme.textClass,t[16]=f):f=t[16];let g;t[17]!==s||t[18]!==f?(g=h.jsx("span",{className:f,children:s}),t[17]=s,t[18]=f,t[19]=g):g=t[19];let m;t[20]!==d||t[21]!==g?(m=h.jsxs("div",{className:"relative z-10 flex flex-col min-w-0 flex-1",children:[d,g]}),t[20]=d,t[21]=g,t[22]=m):m=t[22];let y;t[23]!==n.colorScheme.edgeColor?(y=h.jsx(Pe,{type:"source",position:G.Right,style:{width:"8px",height:"8px",background:n.colorScheme.edgeColor,border:"none"}}),t[23]=n.colorScheme.edgeColor,t[24]=y):y=t[24];let v;return t[25]!==a||t[26]!==y||t[27]!==u||t[28]!==m?(v=h.jsxs("div",{className:"relative flex shrink-0 items-center gap-2 pl-1.5 pr-3 bg-background rounded-lg border-shadow nodrag nopan cursor-pointer pointer-events-auto before:absolute before:inset-0 before:rounded-lg before:bg-accent/25 before:opacity-0 hover:before:opacity-100 before:transition-opacity before:duration-800 before:pointer-events-none",style:l,onClick:a,children:[u,m,y]}),t[25]=a,t[26]=y,t[27]=u,t[28]=m,t[29]=v):v=t[29],v}function Dg(e){const t=se.c(30),{data:n}=e,o=ye();let r;t[0]!==n.metric||t[1]!==n.metricsMode?(r=Yi(n.metric,n.metricsMode),t[0]=n.metric,t[1]=n.metricsMode,t[2]=r):r=t[2];const s=r;let i;t[3]!==n.connection.id||t[4]!==n.metricsMode||t[5]!==n.org||t[6]!==o?(i=()=>{o({to:"/$org/monitoring",params:{org:n.org},search:{from:"now-24h",to:"now",connectionId:[n.connection.id],...n.metricsMode==="errors"&&{status:"errors"}}})},t[3]=n.connection.id,t[4]=n.metricsMode,t[5]=n.org,t[6]=o,t[7]=i):i=t[7];const a=i;let l;t[8]===Symbol.for("react.memo_cache_sentinel")?(l={height:en,width:xo},t[8]=l):l=t[8];const c=`1px solid ${n.colorScheme.edgeColor}`;let u;t[9]!==c?(u=h.jsx(Pe,{type:"target",position:G.Left,style:{width:"8px",height:"8px",background:"var(--background)",border:c,pointerEvents:"none",cursor:"default"}}),t[9]=c,t[10]=u):u=t[10];let d;t[11]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsx(Gt,{}),t[11]=d):d=t[11];let f;t[12]!==n.connection.icon||t[13]!==n.connection.title?(f=h.jsx(He,{icon:n.connection.icon,name:n.connection.title,size:"md",fallbackIcon:d,className:"relative z-10"}),t[12]=n.connection.icon,t[13]=n.connection.title,t[14]=f):f=t[14];let g;t[15]!==n.connection.title?(g=h.jsx("span",{className:"text-sm text-muted-foreground truncate",children:n.connection.title}),t[15]=n.connection.title,t[16]=g):g=t[16];let m;t[17]!==n.colorScheme.textClass?(m=on("text-base leading-[1.35] font-semibold tabular-nums",n.colorScheme.textClass),t[17]=n.colorScheme.textClass,t[18]=m):m=t[18];let y;t[19]!==s||t[20]!==m?(y=h.jsx("span",{className:m,children:s}),t[19]=s,t[20]=m,t[21]=y):y=t[21];let v;t[22]!==y||t[23]!==g?(v=h.jsxs("div",{className:"relative z-10 flex flex-col min-w-0 flex-1",children:[g,y]}),t[22]=y,t[23]=g,t[24]=v):v=t[24];let x;return t[25]!==a||t[26]!==v||t[27]!==u||t[28]!==f?(x=h.jsxs("div",{className:"relative flex shrink-0 items-center gap-2 pl-1.5 pr-3 bg-background rounded-lg border-shadow nodrag nopan cursor-pointer pointer-events-auto before:absolute before:inset-0 before:rounded-lg before:bg-accent/25 before:opacity-0 hover:before:opacity-100 before:transition-opacity before:duration-800 before:pointer-events-none",style:l,onClick:a,children:[u,f,v]}),t[25]=a,t[26]=v,t[27]=u,t[28]=f,t[29]=x):x=t[29],x}function Lg(e){const t=se.c(9),{data:n}=e,o=ye();let r;t[0]!==n.org||t[1]!==o?(r=()=>{o({to:"/$org/monitoring",params:{org:n.org}})},t[0]=n.org,t[1]=o,t[2]=r):r=t[2];const s=r;let i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i={height:mt,width:mt},t[3]=i):i=t[3];let a,l;t[4]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx(Pe,{type:"target",position:G.Left,style:{opacity:0,pointerEvents:"none"}}),l=h.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-8 w-8"}),t[4]=a,t[5]=l):(a=t[4],l=t[5]);let c;t[6]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(Pe,{type:"source",position:G.Right,style:{opacity:0,pointerEvents:"none"}}),t[6]=c):c=t[6];let u;return t[7]!==s?(u=h.jsxs("div",{className:"flex items-center justify-center p-2 bg-primary border border-primary-foreground/50 rounded-lg shadow-sm cursor-pointer pointer-events-auto",style:i,onClick:s,children:[a,l,c]}),t[7]=s,t[8]=u):u=t[8],u}const $g={gateway:Ag,server:Dg,mesh:Lg};function zg(e){const t=se.c(8),{value:n,onChange:o}=e;let r;t[0]!==o?(r=c=>c&&o(c),t[0]=o,t[1]=r):r=t[1];let s,i,a;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=h.jsx(Ze,{value:"requests",className:"text-xs px-3 cursor-pointer",children:"Tool Calls"}),i=h.jsx(Ze,{value:"errors",className:"text-xs px-3 cursor-pointer",children:"Errors"}),a=h.jsx(Ze,{value:"latency",className:"text-xs px-3 cursor-pointer",children:"Latency"}),t[2]=s,t[3]=i,t[4]=a):(s=t[2],i=t[3],a=t[4]);let l;return t[5]!==r||t[6]!==n?(l=h.jsxs(ds,{type:"single",value:n,onValueChange:r,variant:"outline",size:"sm",className:"bg-background/80 backdrop-blur-sm",children:[s,i,a]}),t[5]=r,t[6]=n,t[7]=l):l=t[7],l}function Og(e){const t=se.c(42),{showControls:n}=e,[o,r]=C.useState("requests"),{org:s}=Se();let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i={pageSize:Ir},t[0]=i):i=t[0];const a=Vr(i);let l;t[1]===Symbol.for("react.memo_cache_sentinel")?(l={pageSize:Ir},t[1]=l):l=t[1];const c=nn(l),u=Tg();let d,f,g,m,y;if(t[2]!==o||t[3]!==u||t[4]!==c||t[5]!==a){let I;t[11]!==o||t[12]!==u?(I=(P,j)=>$t(u.gateways.get(j.id),o)-$t(u.gateways.get(P.id),o),t[11]=o,t[12]=u,t[13]=I):I=t[13],y=[...a].sort(I);let A;t[14]!==o||t[15]!==u?(A=(P,j)=>$t(u.connections.get(j.id),o)-$t(u.connections.get(P.id),o),t[14]=o,t[15]=u,t[16]=A):A=t[16],m=[...c].sort(A),d=Pg[o],g=new Map,y.forEach((P,j)=>g.set(P.id,j)),f=new Map,m.forEach((P,j)=>f.set(P.id,j)),t[2]=o,t[3]=u,t[4]=c,t[5]=a,t[6]=d,t[7]=f,t[8]=g,t[9]=m,t[10]=y}else d=t[6],f=t[7],g=t[8],m=t[9],y=t[10];const v=-mt/2,x=mt/2,_=v-100-xo,p=x+100,w=y.length,M=m.length;let S,N;if(t[17]!==d||t[18]!==f||t[19]!==g||t[20]!==w||t[21]!==o||t[22]!==u||t[23]!==s.slug||t[24]!==c||t[25]!==a||t[26]!==M){const I={stroke:d.edgeColor,strokeWidth:1.25,strokeDasharray:"8 6",strokeLinecap:"square"};N=[],S=[],N.push({id:"mesh",type:"mesh",position:{x:v,y:-mt/2},data:{org:s.slug,colorScheme:d},draggable:!1,selectable:!1}),[...a].sort(Hg).forEach(j=>{const R=((g.get(j.id)??0)-(w-1)/2)*70-en/2;N.push({id:`gateway-${j.id}`,type:"gateway",position:{x:_,y:R},data:{gateway:j,metricsMode:o,metric:u.gateways.get(j.id),colorScheme:d,org:s.slug},draggable:!1,selectable:!1}),S.push({id:`e-gw-${j.id}`,source:`gateway-${j.id}`,target:"mesh",type:"smoothstep",animated:!0,style:I})}),[...c].sort(Rg).forEach(j=>{const R=((f.get(j.id)??0)-(M-1)/2)*70-en/2;N.push({id:`server-${j.id}`,type:"server",position:{x:p,y:R},data:{connection:j,metricsMode:o,metric:u.connections.get(j.id),colorScheme:d,org:s.slug},draggable:!1,selectable:!1}),S.push({id:`e-srv-${j.id}`,source:"mesh",target:`server-${j.id}`,type:"smoothstep",animated:!0,style:I})}),t[17]=d,t[18]=f,t[19]=g,t[20]=w,t[21]=o,t[22]=u,t[23]=s.slug,t[24]=c,t[25]=a,t[26]=M,t[27]=S,t[28]=N}else S=t[27],N=t[28];let D;t[29]===Symbol.for("react.memo_cache_sentinel")?(D={backgroundImage:"radial-gradient(circle, var(--border) 1px, transparent 1.5px)",backgroundSize:"32px 32px"},t[29]=D):D=t[29];const T=D;let z;t[30]===Symbol.for("react.memo_cache_sentinel")?(z=h.jsx("style",{children:`
8
- .mesh-minimap .react-flow__node { transition: transform 300ms ease-out; }
9
- .mesh-minimap .react-flow__edge path { transition: d 300ms ease-out; }
10
- .mesh-minimap .react-flow__edge.animated path {
11
- animation: dashdraw 0.8s linear infinite;
12
- }
13
- @keyframes dashdraw {
14
- from {
15
- stroke-dashoffset: 0;
16
- }
17
- to {
18
- stroke-dashoffset: -14;
19
- }
20
- }
21
- `}),t[30]=z):z=t[30];let E;t[31]!==o||t[32]!==n?(E=n&&h.jsx("div",{className:"absolute top-4 right-4 z-10",children:h.jsx(zg,{value:o,onChange:r})}),t[31]=o,t[32]=n,t[33]=E):E=t[33];let L;t[34]===Symbol.for("react.memo_cache_sentinel")?(L={padding:.3},t[34]=L):L=t[34];let $;t[35]===Symbol.for("react.memo_cache_sentinel")?($={hideAttribution:!0},t[35]=$):$=t[35];let b;t[36]!==S||t[37]!==N?(b=h.jsx(rg,{nodes:N,edges:S,nodeTypes:$g,fitView:!0,fitViewOptions:L,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnDrag:!0,preventScrolling:!0,proOptions:$,className:"bg-transparent"}),t[36]=S,t[37]=N,t[38]=b):b=t[38];let k;return t[39]!==E||t[40]!==b?(k=h.jsxs("div",{className:"w-full h-full min-h-[420px] relative mesh-minimap bg-background",style:T,children:[z,E,b]}),t[39]=E,t[40]=b,t[41]=k):k=t[41],k}function Rg(e,t){return e.id.localeCompare(t.id)}function Hg(e,t){return e.id.localeCompare(t.id)}function Vg(){const e=se.c(3);let t,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=h.jsx("div",{className:"flex flex-col gap-3",children:[1,2,3,4,5].map(Fg)}),n=h.jsx("div",{className:"h-14 w-28 bg-muted animate-pulse rounded-xl"}),e[0]=t,e[1]=n):(t=e[0],n=e[1]);let o;return e[2]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx("div",{className:"bg-background p-5 h-full min-h-[420px] flex items-center justify-center",children:h.jsxs("div",{className:"flex items-center gap-16",children:[t,n,h.jsx("div",{className:"flex flex-col gap-3",children:[1,2,3,4,5].map(Bg)})]})}),e[2]=o):o=e[2],o}function Bg(e){return h.jsx("div",{className:"h-14 w-[220px] bg-muted animate-pulse rounded-lg"},e)}function Fg(e){return h.jsx("div",{className:"h-14 w-[220px] bg-muted animate-pulse rounded-lg"},e)}function qn(){return qn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},qn.apply(null,arguments)}var qi=e=>{var{cx:t,cy:n,r:o,className:r}=e,s=Zn("recharts-dot",r);return _n(t)&&_n(n)&&_n(o)?C.createElement("circle",qn({},Fr(e),Br(e),{className:s,cx:t,cy:n,r:o})):null},Gg=["points"];function kr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,o)}return n}function Pn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?kr(Object(n),!0).forEach(function(o){Xg(e,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kr(Object(n)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o))})}return e}function Xg(e,t,n){return(t=Yg(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Yg(e){var t=qg(e,"string");return typeof t=="symbol"?t:t+""}function qg(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var o=n.call(e,t);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function tn(){return tn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},tn.apply(null,arguments)}function Wg(e,t){if(e==null)return{};var n,o,r=Zg(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o<s.length;o++)n=s[o],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Zg(e,t){if(e==null)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(t.indexOf(o)!==-1)continue;n[o]=e[o]}return n}function Kg(e){var{option:t,dotProps:n,className:o}=e;if(C.isValidElement(t))return C.cloneElement(t,n);if(typeof t=="function")return t(n);var r=Zn(o,typeof t!="boolean"?t.className:""),s=n??{},{points:i}=s,a=Wg(s,Gg);return C.createElement(qi,tn({},a,{className:r}))}function Ug(e,t){return e==null?!1:t?!0:e.length===1}function Qg(e){var{points:t,dot:n,className:o,dotClassName:r,dataKey:s,baseProps:i,needClip:a,clipPathId:l,zIndex:c=Kn.scatter}=e;if(!Ug(t,n))return null;var u=Gr(n),d=pc(n),f=t.map((m,y)=>{var v,x,_=Pn(Pn(Pn({r:3},i),d),{},{index:y,cx:(v=m.x)!==null&&v!==void 0?v:void 0,cy:(x=m.y)!==null&&x!==void 0?x:void 0,dataKey:s,value:m.value,payload:m.payload,points:t});return C.createElement(Kg,{key:"dot-".concat(y),option:n,dotProps:_,className:r})}),g={};return a&&l!=null&&(g.clipPath="url(#clipPath-".concat(u?"":"dots-").concat(l,")")),C.createElement(Un,{zIndex:c},C.createElement(Qn,tn({className:o},g),f))}function Pr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,o)}return n}function jn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Pr(Object(n),!0).forEach(function(o){Jg(e,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pr(Object(n)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o))})}return e}function Jg(e,t,n){return(t=ep(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ep(e){var t=tp(e,"string");return typeof t=="symbol"?t:t+""}function tp(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var o=n.call(e,t);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var np=e=>{var{point:t,childIndex:n,mainColor:o,activeDot:r,dataKey:s,clipPath:i}=e;if(r===!1||t.x==null||t.y==null)return null;var a={index:n,dataKey:s,cx:t.x,cy:t.y,r:4,fill:o??"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value},l=jn(jn(jn({},a),Yr(r)),Br(r)),c;return C.isValidElement(r)?c=C.cloneElement(r,l):typeof r=="function"?c=r(l):c=C.createElement(qi,l),C.createElement(Qn,{className:"recharts-active-dot",clipPath:i},c)};function op(e){var{points:t,mainColor:n,activeDot:o,itemDataKey:r,clipPath:s,zIndex:i=Kn.activeDot}=e,a=Xr(yc),l=xc();if(t==null||l==null)return null;var c=t.find(u=>l.includes(u.payload));return Dn(c)?null:C.createElement(Un,{zIndex:i},C.createElement(np,{point:c,childIndex:Number(a),mainColor:n,dataKey:r,activeDot:o,clipPath:s}))}var Wi=(e,t,n,o)=>Wr(e,"xAxis",t,o),Zi=(e,t,n,o)=>Zr(e,"xAxis",t,o),Ki=(e,t,n,o)=>Wr(e,"yAxis",n,o),Ui=(e,t,n,o)=>Zr(e,"yAxis",n,o),rp=Jn([qr,Wi,Ki,Zi,Ui],(e,t,n,o,r)=>bc(e,"xAxis")?jo(t,o,!1):jo(n,r,!1)),sp=(e,t,n,o,r)=>r;function ip(e){return e.type==="line"}var ap=Jn([wc,sp],(e,t)=>e.filter(ip).find(n=>n.id===t)),cp=Jn([qr,Wi,Ki,Zi,Ui,ap,rp,vc],(e,t,n,o,r,s,i,a)=>{var{chartData:l,dataStartIndex:c,dataEndIndex:u}=a;if(!(s==null||t==null||n==null||o==null||r==null||o.length===0||r.length===0||i==null||e!=="horizontal"&&e!=="vertical")){var{dataKey:d,data:f}=s,g;if(f!=null&&f.length>0?g=f:g=l?.slice(c,u+1),g!=null)return kp({layout:e,xAxis:t,yAxis:n,xAxisTicks:o,yAxisTicks:r,dataKey:d,bandSize:i,displayedData:g})}});function lp(e){var t=Yr(e),n=3,o=2;if(t!=null){var{r,strokeWidth:s}=t,i=Number(r),a=Number(s);return(Number.isNaN(i)||i<0)&&(i=n),(Number.isNaN(a)||a<0)&&(a=o),{r:i,strokeWidth:a}}return{r:n,strokeWidth:o}}var up=["id"],dp=["type","layout","connectNulls","needClip","shape"],fp=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function _t(){return _t=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},_t.apply(null,arguments)}function jr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,o)}return n}function ge(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?jr(Object(n),!0).forEach(function(o){hp(e,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jr(Object(n)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o))})}return e}function hp(e,t,n){return(t=mp(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mp(e){var t=gp(e,"string");return typeof t=="symbol"?t:t+""}function gp(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var o=n.call(e,t);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function vo(e,t){if(e==null)return{};var n,o,r=pp(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o<s.length;o++)n=s[o],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function pp(e,t){if(e==null)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(t.indexOf(o)!==-1)continue;n[o]=e[o]}return n}var yp=e=>{var{dataKey:t,name:n,stroke:o,legendType:r,hide:s}=e;return[{inactive:s,dataKey:t,type:r,color:o,value:Qr(n,t),payload:e}]},xp=C.memo(e=>{var{dataKey:t,data:n,stroke:o,strokeWidth:r,fill:s,name:i,hide:a,unit:l,tooltipType:c,id:u}=e,d={dataDefinedOnItem:n,positions:void 0,settings:{stroke:o,strokeWidth:r,fill:s,dataKey:t,nameKey:void 0,name:Qr(i,t),hide:a,type:c,color:o,unit:l,graphicalItemId:u}};return C.createElement(Cc,{tooltipEntrySettings:d})}),Qi=(e,t)=>"".concat(t,"px ").concat(e-t,"px");function vp(e,t){for(var n=e.length%2!==0?[...e,0]:e,o=[],r=0;r<t;++r)o=[...o,...n];return o}var wp=(e,t,n)=>{var o=n.reduce((d,f)=>d+f);if(!o)return Qi(t,e);for(var r=Math.floor(e/o),s=e%o,i=t-e,a=[],l=0,c=0;l<n.length;c+=n[l],++l)if(c+n[l]>s){a=[...n.slice(0,l),s-c];break}var u=a.length%2===0?[0,i]:[i];return[...vp(n,r),...a,...u].map(d=>"".concat(d,"px")).join(", ")};function bp(e){var{clipPathId:t,points:n,props:o}=e,{dot:r,dataKey:s,needClip:i}=o,{id:a}=o,l=vo(o,up),c=Fr(l);return C.createElement(Qg,{points:n,dot:r,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:s,baseProps:c,needClip:i,clipPathId:t})}function _p(e){var{showLabels:t,children:n,points:o}=e,r=C.useMemo(()=>o?.map(s=>{var i,a,l={x:(i=s.x)!==null&&i!==void 0?i:0,y:(a=s.y)!==null&&a!==void 0?a:0,width:0,lowerWidth:0,upperWidth:0,height:0};return ge(ge({},l),{},{value:s.value,payload:s.payload,viewBox:l,parentViewBox:void 0,fill:void 0})}),[o]);return C.createElement(Lc,{value:t?r:void 0},n)}function Tr(e){var{clipPathId:t,pathRef:n,points:o,strokeDasharray:r,props:s}=e,{type:i,layout:a,connectNulls:l,needClip:c,shape:u}=s,d=vo(s,dp),f=ge(ge({},$c(d)),{},{fill:"none",className:"recharts-line-curve",clipPath:c?"url(#clipPath-".concat(t,")"):void 0,points:o,type:i,layout:a,connectNulls:l,strokeDasharray:r??s.strokeDasharray});return C.createElement(C.Fragment,null,o?.length>1&&C.createElement(zc,_t({shapeType:"curve",option:u},f,{pathRef:n})),C.createElement(bp,{points:o,clipPathId:t,props:s}))}function Sp(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function Np(e){var{clipPathId:t,props:n,pathRef:o,previousPointsRef:r,longestAnimatedLengthRef:s}=e,{points:i,strokeDasharray:a,isAnimationActive:l,animationBegin:c,animationDuration:u,animationEasing:d,animateNewValues:f,width:g,height:m,onAnimationEnd:y,onAnimationStart:v}=n,x=r.current,_=Tc(i,"recharts-line-"),p=C.useRef(_),[w,M]=C.useState(!1),S=!w,N=C.useCallback(()=>{typeof y=="function"&&y(),M(!1)},[y]),D=C.useCallback(()=>{typeof v=="function"&&v(),M(!0)},[v]),T=Sp(o.current),z=C.useRef(0);p.current!==_&&(z.current=s.current,p.current=_);var E=z.current;return C.createElement(_p,{points:i,showLabels:S},n.children,C.createElement(Ac,{animationId:_,begin:c,duration:u,isActive:l,easing:d,onAnimationEnd:N,onAnimationStart:D,key:_},L=>{var $=ct(E,T+E,L),b=Math.min($,T),k;if(l)if(a){var I="".concat(a).split(/[,\s]+/gim).map(j=>parseFloat(j));k=wp(b,T,I)}else k=Qi(T,b);else k=a==null?void 0:String(a);if(L>0&&T>0&&(r.current=i,s.current=Math.max(s.current,b)),x){var A=x.length/i.length,P=L===1?i:i.map((j,O)=>{var H=Math.floor(O*A);if(x[H]){var R=x[H];return ge(ge({},j),{},{x:ct(R.x,j.x,L),y:ct(R.y,j.y,L)})}return f?ge(ge({},j),{},{x:ct(g*2,j.x,L),y:ct(m/2,j.y,L)}):ge(ge({},j),{},{x:j.x,y:j.y})});return r.current=P,C.createElement(Tr,{props:n,points:P,clipPathId:t,pathRef:o,strokeDasharray:k})}return C.createElement(Tr,{props:n,points:i,clipPathId:t,pathRef:o,strokeDasharray:k})}),C.createElement(Dc,{label:n.label}))}function Ep(e){var{clipPathId:t,props:n}=e,o=C.useRef(null),r=C.useRef(0),s=C.useRef(null);return C.createElement(Np,{props:n,clipPathId:t,previousPointsRef:o,longestAnimatedLengthRef:r,pathRef:s})}var Cp=(e,t)=>{var n,o;return{x:(n=e.x)!==null&&n!==void 0?n:void 0,y:(o=e.y)!==null&&o!==void 0?o:void 0,value:e.value,errorVal:Jr(e.payload,t)}};class Mp extends C.Component{render(){var{hide:t,dot:n,points:o,className:r,xAxisId:s,yAxisId:i,top:a,left:l,width:c,height:u,id:d,needClip:f,zIndex:g}=this.props;if(t)return null;var m=Zn("recharts-line",r),y=d,{r:v,strokeWidth:x}=lp(n),_=Gr(n),p=v*2+x,w=f?"url(#clipPath-".concat(_?"":"dots-").concat(y,")"):void 0;return C.createElement(Un,{zIndex:g},C.createElement(Qn,{className:m},f&&C.createElement("defs",null,C.createElement(Pc,{clipPathId:y,xAxisId:s,yAxisId:i}),!_&&C.createElement("clipPath",{id:"clipPath-dots-".concat(y)},C.createElement("rect",{x:l-p/2,y:a-p/2,width:c+p,height:u+p}))),C.createElement(jc,{xAxisId:s,yAxisId:i,data:o,dataPointFormatter:Cp,errorBarOffset:0},C.createElement(Ep,{props:this.props,clipPathId:y}))),C.createElement(op,{activeDot:this.props.activeDot,points:o,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:w}))}}var Ji={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!0,fill:"#fff",hide:!1,isAnimationActive:"auto",label:!1,legendType:"line",stroke:"#3182bd",strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:Kn.line,type:"linear"};function Ip(e){var t=Kr(e,Ji),{activeDot:n,animateNewValues:o,animationBegin:r,animationDuration:s,animationEasing:i,connectNulls:a,dot:l,hide:c,isAnimationActive:u,label:d,legendType:f,xAxisId:g,yAxisId:m,id:y}=t,v=vo(t,fp),{needClip:x}=Mc(g,m),_=Ic(),p=kc(),w=Ur(),M=Xr(z=>cp(z,g,m,w,y));if(p!=="horizontal"&&p!=="vertical"||M==null||_==null)return null;var{height:S,width:N,x:D,y:T}=_;return C.createElement(Mp,_t({},v,{id:y,connectNulls:a,dot:l,activeDot:n,animateNewValues:o,animationBegin:r,animationDuration:s,animationEasing:i,isAnimationActive:u,hide:c,label:d,legendType:f,xAxisId:g,yAxisId:m,points:M,layout:p,height:S,width:N,left:D,top:T,needClip:x}))}function kp(e){var{layout:t,xAxis:n,yAxis:o,xAxisTicks:r,yAxisTicks:s,dataKey:i,bandSize:a,displayedData:l}=e;return l.map((c,u)=>{var d=Jr(c,i);if(t==="horizontal"){var f=To({axis:n,ticks:r,bandSize:a,entry:c,index:u}),g=Dn(d)?null:o.scale(d);return{x:f,y:g,value:d,payload:c}}var m=Dn(d)?null:n.scale(d),y=To({axis:o,ticks:s,bandSize:a,entry:c,index:u});return m==null||y==null?null:{x:m,y,value:d,payload:c}}).filter(Boolean)}function Pp(e){var t=Kr(e,Ji),n=Ur();return C.createElement(Sc,{id:t.id,type:"line"},o=>C.createElement(C.Fragment,null,C.createElement(Nc,{legendPayload:yp(t)}),C.createElement(xp,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:o}),C.createElement(Ec,{type:"line",id:o,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),C.createElement(Ip,_t({},t,{id:o}))))}var ea=C.memo(Pp,_c);ea.displayName="Line";var jp=["axis"],Tp=C.forwardRef((e,t)=>C.createElement(Oc,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:jp,tooltipPayloadSearcher:Rc,categoricalChartProps:e,ref:t}));function Ap(e,t){const o=(t.getTime()-e.getTime())/24,r=Array.from({length:24},(l,c)=>{const u=new Date(e.getTime()+c*o),d=Math.floor(Math.random()*15)+5,f=c<20?d:d+Math.floor(Math.random()*20),g=Math.random()>.85?Math.floor(Math.random()*3):0,m=f>0?g/f*100:0,y=Math.floor(Math.random()*300)+100;return{t:u.toISOString(),ts:u.getTime(),label:u.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),calls:f,errors:g,errorRate:m,p95:y}}),s=r.reduce((l,c)=>l+c.calls,0),i=r.reduce((l,c)=>l+c.errors,0),a=Math.floor(r.reduce((l,c)=>l+c.p95,0)/r.length);return{totalCalls:s,totalErrors:i,avgDurationMs:a,data:r}}function Dp(){const e=se.c(3),{locator:t,org:n}=Se(),o=ye(),r=je(),s=De(),{data:i}=Te({toolCaller:r,toolName:"MONITORING_LOGS_LIST",toolInputParams:{...s,limit:750,offset:0},scope:t,staleTime:3e4}),a=i?.logs??[],l=new Date(s.startDate),c=new Date(s.endDate),u=a.length===0?Ap(l,c):Vc(a,{startDate:l,endDate:c},24,i?.total);let d;e[0]!==o||e[1]!==n.slug?(d=g=>{o(g==="errors"?{to:"/$org/monitoring",params:{org:n.slug},search:{status:"errors"}}:{to:"/$org/monitoring",params:{org:n.slug}})},e[0]=o,e[1]=n.slug,e[2]=d):d=e[2];const f=d;return h.jsx(Bc,{stats:u,chartHeight:"h-[103px]",showDateLabels:!0,dateRange:{startDate:l,endDate:c},onKPIClick:f})}const Ar={Content:Dp,Skeleton:Hc};function Lp(){const e=se.c(24),{org:t,locator:n}=Se(),o=ye();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=je(),e[0]=r):r=e[0];const s=r,i=nn()??[];let a;e[1]===Symbol.for("react.memo_cache_sentinel")?(a={...De(),limit:10,offset:0},e[1]=a):a=e[1];const l=a;let c;e[2]!==n?(c={toolCaller:s,toolName:"MONITORING_LOGS_LIST",toolInputParams:l,scope:n,staleTime:3e4},e[2]=n,e[3]=c):c=e[3];const{data:u}=Te(c);let d;e[4]!==u?.logs?(d=u?.logs??[],e[4]=u?.logs,e[5]=d):d=e[5];const f=d,g=new Map(i.map($p));let m;e[6]!==o||e[7]!==t.slug?(m=E=>{o({to:"/$org/monitoring",params:{org:t.slug},search:{connectionId:[E.connectionId],tool:E.toolName}})},e[6]=o,e[7]=t.slug,e[8]=m):m=e[8];const y=m;let v;e[9]!==o||e[10]!==t.slug?(v=()=>{o({to:"/$org/monitoring",params:{org:t.slug}})},e[9]=o,e[10]=t.slug,e[11]=v):v=e[11];const x=v;let _;if(e[12]===Symbol.for("react.memo_cache_sentinel")){const E=["Google Drive","Google Sheets","Google Slides","Gmail","Google Calendar","Discord","VTEX","Google Docs","Slack","Notion","GitHub","Linear"];_=Array.from({length:10},(L,$)=>{const b=new Date(Date.now()-$*6e4),k=E[$%E.length]??"Unknown";return{id:`mock-${$}`,toolName:k,connectionId:`mock${$}`,connectionTitle:k,timestamp:b.toISOString(),durationMs:Math.floor(Math.random()*500)+100,isError:Math.random()>.9}}),e[12]=_}else _=e[12];const p=_,w=f.length===0?p:f,M=f.length===0,S=E=>{const L=g.get(E.connectionId),b=new Date(E.timestamp).toLocaleString("en-US",{month:"long",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"});return h.jsxs("div",{className:"flex items-center h-16 border-t border-border/60 hover:bg-muted/40 transition-colors cursor-pointer",onClick:()=>!M&&y(E),children:[h.jsx("div",{className:"flex items-center justify-center w-16 px-4",children:h.jsx(He,{icon:L?.icon||null,name:E.connectionTitle,size:"xs",className:"shadow-sm"})}),h.jsx("div",{className:"flex-1 min-w-0",children:h.jsx("span",{className:"text-xs font-medium text-foreground truncate block",children:E.toolName})}),h.jsxs("div",{className:"flex items-center gap-2 px-5 text-xs whitespace-nowrap",children:[h.jsxs("span",{className:"text-muted-foreground",children:[E.durationMs,"ms"]}),h.jsx("span",{className:"text-foreground",children:b})]}),h.jsx("div",{className:"flex items-center pr-5",children:h.jsx(Xc,{variant:E.isError?"destructive":"success",className:"text-xs px-2 py-1",children:E.isError?"Error":"OK"})})]},E.id)};let N;e[13]===Symbol.for("react.memo_cache_sentinel")?(N=h.jsx("p",{className:"text-sm text-muted-foreground",children:"Recent Activity"}),e[13]=N):N=e[13];let D;if(e[14]!==w||e[15]!==S){let E;e[17]!==S?(E=L=>S(L),e[17]=S,e[18]=E):E=e[18],D=w.map(E),e[14]=w,e[15]=S,e[16]=D}else D=e[16];let T;e[19]!==D?(T=h.jsx("div",{className:"overflow-auto",children:D}),e[19]=D,e[20]=T):T=e[20];let z;return e[21]!==x||e[22]!==T?(z=h.jsx(Ae,{title:N,onTitleClick:x,noPadding:!0,className:"min-h-0 overflow-hidden",children:T}),e[21]=x,e[22]=T,e[23]=z):z=e[23],z}function $p(e){return[e.id,e]}function zp(){const e=se.c(2);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=h.jsx("p",{className:"text-sm text-muted-foreground",children:"Recent Activity"}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for("react.memo_cache_sentinel")?(n=h.jsx(Ae,{title:t,noPadding:!0,className:"min-h-0 overflow-hidden",children:h.jsx("div",{className:"overflow-auto",children:[...Array(10)].map(Op)})}),e[1]=n):n=e[1],n}function Op(e,t){return h.jsxs("div",{className:"flex items-center h-16 border-t border-border/60",children:[h.jsx("div",{className:"flex items-center justify-center w-16 px-4",children:h.jsx("div",{className:"h-6 w-6 bg-muted animate-pulse rounded-md"})}),h.jsx("div",{className:"flex-1 min-w-0",children:h.jsx("div",{className:"h-3 w-32 bg-muted animate-pulse rounded"})}),h.jsxs("div",{className:"flex items-center gap-2 px-5",children:[h.jsx("div",{className:"h-3 w-12 bg-muted animate-pulse rounded"}),h.jsx("div",{className:"h-3 w-40 bg-muted animate-pulse rounded"})]}),h.jsx("div",{className:"flex items-center pr-5",children:h.jsx("div",{className:"h-6 w-12 bg-muted animate-pulse rounded-full"})})]},t)}const Dr={Content:Lp,Skeleton:zp};function Rp(e){const t=new Map;for(const o of e){if(!o.gatewayId)continue;const r=t.get(o.gatewayId)??{requests:0,errors:0,totalLatency:0};t.set(o.gatewayId,{requests:r.requests+1,errors:r.errors+(o.isError?1:0),totalLatency:r.totalLatency+o.durationMs})}const n=new Map;for(const[o,r]of t)n.set(o,{gatewayId:o,requests:r.requests,errors:r.errors,errorRate:r.requests>0?r.errors/r.requests*100:0,avgLatencyMs:r.requests>0?r.totalLatency/r.requests:0});return n}function Hp(e,t){switch(t){case"requests":return e.requests.toLocaleString();case"errors":return`${e.errorRate.toFixed(1)}%`;case"latency":return`${Math.round(e.avgLatencyMs)}ms`}}function Bt(e,t){switch(t){case"requests":return e.requests;case"errors":return e.errorRate;case"latency":return e.avgLatencyMs}}function Vp(e,t,n){if(t===0)return 0;const o=Bt(e,n);return Math.min(o/t*100,100)}function Bp(e){const t=se.c(24),{metricsMode:n}=e,{org:o,locator:r}=Se(),s=ye();let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=je(),t[0]=i):i=t[0];const a=i;let l;t[1]===Symbol.for("react.memo_cache_sentinel")?(l=De(),t[1]=l):l=t[1];const c=l,u=Vr({pageSize:100})??[];let d;t[2]===Symbol.for("react.memo_cache_sentinel")?(d={...c,limit:1e3,offset:0},t[2]=d):d=t[2];let f;t[3]!==r?(f={toolCaller:a,toolName:"MONITORING_LOGS_LIST",toolInputParams:d,scope:r,staleTime:3e4},t[3]=r,t[4]=f):f=t[4];const{data:g}=Te(f),m=g?.logs??[],y=m.length===0?Array.from({length:50},Gp):[],v=m.length===0?y:m,x=Rp(v);let _;t[5]!==n?(_=(A,P)=>Bt(P.metric,n)-Bt(A.metric,n),t[5]=n,t[6]=_):_=t[6];const p=u.map(A=>({gateway:A,metric:x.get(A.id)})).filter(Fp).sort(_).slice(0,6),w=p[0]?.metric,M=w?Bt(w,n):1;let S;t[7]!==n||t[8]!==s||t[9]!==o.slug?(S=A=>{s({to:"/$org/monitoring",params:{org:o.slug},search:{from:"now-24h",to:"now",gatewayId:[A],...n==="errors"&&{status:"errors"}}})},t[7]=n,t[8]=s,t[9]=o.slug,t[10]=S):S=t[10];const N=S;let D;t[11]!==s||t[12]!==o.slug?(D=()=>{s({to:"/$org/gateways",params:{org:o.slug}})},t[11]=s,t[12]=o.slug,t[13]=D):D=t[13];const T=D,z=n==="requests"?"bg-chart-1":n==="errors"?"bg-chart-3":"bg-chart-4";let E;t[14]===Symbol.for("react.memo_cache_sentinel")?(E=h.jsx("div",{className:"border-t border-border/60"}),t[14]=E):E=t[14];const L=Ae;let $;t[15]===Symbol.for("react.memo_cache_sentinel")?($=h.jsx("p",{className:"text-sm text-muted-foreground",children:"Hubs"}),t[15]=$):$=t[15];const b=p.length===0?h.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"No gateway activity in the last 24 hours"}):h.jsx("div",{className:"space-y-3 w-full",children:p.map(A=>{const{gateway:P,metric:j}=A,O=Vp(j,M,n);return h.jsxs("div",{className:"group cursor-pointer flex items-center gap-2",onClick:()=>N(P.id),children:[h.jsx(He,{icon:P.icon,name:P.title,size:"xs",fallbackIcon:h.jsx(Hr,{}),className:"shrink-0"}),h.jsx("span",{className:"text-xs font-medium text-foreground truncate min-w-0 w-32",children:P.title}),h.jsx("div",{className:"relative h-2 bg-muted/50 overflow-hidden flex-1",children:h.jsx("div",{className:`h-full transition-all duration-500 ease-out group-hover:opacity-80 ${z}`,style:{width:`${O}%`}})}),h.jsx("span",{className:"text-xs tabular-nums shrink-0 text-foreground font-normal",children:Hp(j,n)})]},P.id)})});let k;t[16]!==L||t[17]!==T||t[18]!==b||t[19]!==$?(k=h.jsx(L,{title:$,onTitleClick:T,children:b}),t[16]=L,t[17]=T,t[18]=b,t[19]=$,t[20]=k):k=t[20];let I;return t[21]!==k||t[22]!==E?(I=h.jsxs(h.Fragment,{children:[E,k]}),t[21]=k,t[22]=E,t[23]=I):I=t[23],I}function Fp(e){return e.metric}function Gp(e,t){return{id:`mock-${t}`,gatewayId:"mock-gateway-1",connectionId:"",connectionTitle:"",toolName:"COLLECTION_LLM_LIST",isError:Math.random()>.95,errorMessage:null,durationMs:Math.floor(Math.random()*400)+100,timestamp:new Date().toISOString()}}function Xp(){const e=se.c(3);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=h.jsx("div",{className:"border-t border-border/60"}),e[0]=t):t=e[0];let n;e[1]===Symbol.for("react.memo_cache_sentinel")?(n=h.jsx("p",{className:"text-sm text-muted-foreground",children:"Hubs"}),e[1]=n):n=e[1];let o;return e[2]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsxs(h.Fragment,{children:[t,h.jsx(Ae,{title:n,children:h.jsx("div",{className:"space-y-3 w-full",children:Array.from({length:5}).map(Yp)})})]}),e[2]=o):o=e[2],o}function Yp(e,t){return h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:"h-6 w-6 bg-muted animate-pulse rounded-md shrink-0"}),h.jsx("div",{className:"h-3 w-32 bg-muted animate-pulse rounded shrink-0"}),h.jsx("div",{className:"h-2 bg-muted animate-pulse flex-1"}),h.jsx("div",{className:"h-3 w-12 bg-muted animate-pulse rounded shrink-0"})]},t)}const Lr={Content:Bp,Skeleton:Xp};function qp(e){const t=new Map;for(const o of e){if(!o.connectionId)continue;const r=t.get(o.connectionId)??{requests:0,errors:0,totalLatency:0};t.set(o.connectionId,{requests:r.requests+1,errors:r.errors+(o.isError?1:0),totalLatency:r.totalLatency+o.durationMs})}const n=new Map;for(const[o,r]of t)n.set(o,{connectionId:o,requests:r.requests,errors:r.errors,errorRate:r.requests>0?r.errors/r.requests*100:0,avgLatencyMs:r.requests>0?r.totalLatency/r.requests:0});return n}function Wp(e,t){switch(t){case"requests":return e.requests.toLocaleString();case"errors":return`${e.errorRate.toFixed(1)}%`;case"latency":return`${Math.round(e.avgLatencyMs)}ms`}}function Ft(e,t){switch(t){case"requests":return e.requests;case"errors":return e.errorRate;case"latency":return e.avgLatencyMs}}function Zp(e,t,n){if(t===0)return 0;const o=Ft(e,n);return Math.min(o/t*100,100)}function Kp(e){const t=se.c(24),{metricsMode:n,onMetricsModeChange:o}=e,{org:r,locator:s}=Se(),i=ye();let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=je(),t[0]=a):a=t[0];const l=a;let c;t[1]===Symbol.for("react.memo_cache_sentinel")?(c=De(),t[1]=c):c=t[1];const u=c,d=nn({pageSize:100})??[];let f;t[2]===Symbol.for("react.memo_cache_sentinel")?(f={...u,limit:1e3,offset:0},t[2]=f):f=t[2];let g;t[3]!==s?(g={toolCaller:l,toolName:"MONITORING_LOGS_LIST",toolInputParams:f,scope:s,staleTime:3e4},t[3]=s,t[4]=g):g=t[4];const{data:m}=Te(g),y=m?.logs??[],v=y.length===0?Array.from({length:100},Qp):[],x=y.length===0?v:y,_=qp(x);let p;t[5]!==n?(p=(A,P)=>Ft(P.metric,n)-Ft(A.metric,n),t[5]=n,t[6]=p):p=t[6];const w=d.map(A=>({connection:A,metric:_.get(A.id)})).filter(Up).sort(p).slice(0,6),M=w[0]?.metric,S=M?Ft(M,n):1;let N;t[7]!==n||t[8]!==i||t[9]!==r.slug?(N=A=>{i({to:"/$org/monitoring",params:{org:r.slug},search:{from:"now-24h",to:"now",connectionId:[A],...n==="errors"&&{status:"errors"}}})},t[7]=n,t[8]=i,t[9]=r.slug,t[10]=N):N=t[10];const D=N;let T;t[11]!==i||t[12]!==r.slug?(T=()=>{i({to:"/$org/mcps",params:{org:r.slug}})},t[11]=i,t[12]=r.slug,t[13]=T):T=t[13];const z=T,E=n==="requests"?"bg-chart-1":n==="errors"?"bg-chart-3":"bg-chart-4",L=Ae;let $;t[14]===Symbol.for("react.memo_cache_sentinel")?($=h.jsx("p",{className:"text-sm text-muted-foreground",children:"Connections"}),t[14]=$):$=t[14];let b;t[15]!==n||t[16]!==o?(b=o?h.jsxs(ds,{type:"single",value:n,onValueChange:A=>A&&o(A),variant:"outline",size:"sm",children:[h.jsx(Ze,{value:"requests",className:"text-xs px-2 cursor-pointer",children:"Calls"}),h.jsx(Ze,{value:"errors",className:"text-xs px-2 cursor-pointer",children:"Errors"}),h.jsx(Ze,{value:"latency",className:"text-xs px-2 cursor-pointer",children:"Latency"})]}):null,t[15]=n,t[16]=o,t[17]=b):b=t[17];const k=w.length===0?h.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"No server activity in the last 24 hours"}):h.jsx("div",{className:"space-y-3 w-full",children:w.map(A=>{const{connection:P,metric:j}=A,O=Zp(j,S,n);return h.jsxs("div",{className:"group cursor-pointer flex items-center gap-2",onClick:()=>D(P.id),children:[h.jsx(He,{icon:P.icon,name:P.title,size:"xs",fallbackIcon:h.jsx(Gt,{}),className:"shrink-0"}),h.jsx("span",{className:"text-xs font-medium text-foreground truncate min-w-0 w-32",children:P.title}),h.jsx("div",{className:"relative h-2 bg-muted/50 overflow-hidden flex-1",children:h.jsx("div",{className:`h-full transition-all duration-500 ease-out group-hover:opacity-80 ${E}`,style:{width:`${O}%`}})}),h.jsx("span",{className:"text-xs tabular-nums shrink-0 text-foreground font-normal",children:Wp(j,n)})]},P.id)})});let I;return t[18]!==L||t[19]!==z||t[20]!==k||t[21]!==$||t[22]!==b?(I=h.jsx(L,{title:$,onTitleClick:z,action:b,children:k}),t[18]=L,t[19]=z,t[20]=k,t[21]=$,t[22]=b,t[23]=I):I=t[23],I}function Up(e){return e.metric}function Qp(e,t){return{id:`mock-${t}`,connectionId:["mock-1","mock-2","mock-3","mock-4"][t%4]||"mock-1",connectionTitle:"",toolName:"COLLECTION_LLM_LIST",isError:Math.random()>.9,errorMessage:null,durationMs:Math.floor(Math.random()*500)+100,timestamp:new Date().toISOString()}}function Jp(){const e=se.c(2);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=h.jsx("p",{className:"text-sm text-muted-foreground",children:"Connections"}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for("react.memo_cache_sentinel")?(n=h.jsx(Ae,{title:t,children:h.jsx("div",{className:"space-y-3 w-full",children:Array.from({length:5}).map(e0)})}),e[1]=n):n=e[1],n}function e0(e,t){return h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:"h-6 w-6 bg-muted animate-pulse rounded-md shrink-0"}),h.jsx("div",{className:"h-3 w-32 bg-muted animate-pulse rounded shrink-0"}),h.jsx("div",{className:"h-2 bg-muted animate-pulse flex-1"}),h.jsx("div",{className:"h-3 w-12 bg-muted animate-pulse rounded shrink-0"})]},t)}const $r={Content:Kp,Skeleton:Jp};function t0(e,t,n,o=10){const s=t.getTime(),a=(n.getTime()-s)/24,l=new Map;for(const m of e){const y=m.toolName||"Unknown",v=l.get(y);l.set(y,{count:(v?.count??0)+1,connectionId:v?.connectionId||m.connectionId})}const c=[...l.entries()].sort((m,y)=>y[1].count-m[1].count).slice(0,o).map(([m,y])=>({name:m,connectionId:y.connectionId})),u=[],d=c.map(m=>m.name);for(let m=0;m<24;m++){const y=new Date(s+m*a),v={t:y.toISOString(),ts:y.getTime(),label:y.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})};for(const x of d)v[x]=0;u.push(v)}for(const m of e){const y=new Date(m.timestamp).getTime(),v=Math.floor((y-s)/a),x=Math.max(0,Math.min(23,v)),_=u[x];if(!_)continue;const p=m.toolName||"Unknown";d.includes(p)&&(_[p]=_[p]+1)}const f={},g=new Map;return c.forEach((m,y)=>{const x=`var(--chart-${y%5+1})`;g.set(m.name,x),f[m.name]={label:m.name,color:x}}),{buckets:u,topTools:c,chartConfig:f,toolColors:g}}function n0(e){const t=se.c(4),{org:n,locator:o}=Se(),r=ye(),s=je(),i=De(),a=nn()??[],{data:l}=Te({toolCaller:s,toolName:"MONITORING_LOGS_LIST",toolInputParams:{...i,limit:2e3,offset:0},scope:o,staleTime:3e4}),c=l?.logs??[],u=new Date(i.startDate),d=new Date(i.endDate),f=c.length===0?Array.from({length:150},(N,D)=>({id:`mock-${D}`,toolName:["COLLECTION_LLM_LIST","COLLECTION_REGISTRY_APP_LIST","microsoft_docs_search","MCP_CONFIGURATION"][D%4]||"COLLECTION_LLM_LIST",connectionId:`mock-conn-${D%4}`,connectionTitle:"Mock Connection",isError:!1,errorMessage:null,durationMs:Math.floor(Math.random()*300)+100,timestamp:new Date(u.getTime()+Math.random()*(d.getTime()-u.getTime())).toISOString()})):[],g=c.length===0?f:c,{buckets:m,topTools:y,chartConfig:v,toolColors:x}=t0(g,u,d,10),_=new Map(a.map(r0));let p;t[0]!==r||t[1]!==n.slug?(p=()=>{r({to:"/$org/monitoring",params:{org:n.slug}})},t[0]=r,t[1]=n.slug,t[2]=p):p=t[2];const w=p,M=o0;let S;return t[3]===Symbol.for("react.memo_cache_sentinel")?(S=h.jsx("p",{className:"text-sm text-muted-foreground",children:"Top Tools"}),t[3]=S):S=t[3],h.jsx(Ae,{title:h.jsxs("div",{className:"flex flex-col gap-1.5",children:[S,h.jsx("div",{className:"flex items-center gap-3",children:y.slice(0,3).map(N=>{const D=_.get(N.connectionId||"");return h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx(He,{icon:D?.icon||null,name:N.name,size:"xs",fallbackIcon:h.jsx(Gt,{}),className:"shrink-0 !size-4 !min-w-4 aspect-square rounded-sm"}),h.jsx("span",{className:"text-[10px] text-foreground truncate max-w-32",children:N.name})]},N.name)})})]}),onTitleClick:w,children:y.length===0?h.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"No tool activity in the last 24 hours"}):h.jsxs("div",{className:"flex flex-col gap-2 w-full h-full cursor-pointer hover:opacity-80 transition-opacity",children:[h.jsx(Fc,{className:"flex-1 min-h-0 max-h-[120px] w-full",config:v,children:h.jsxs(Tp,{data:m,margin:{left:0,right:0,top:5,bottom:5},children:[h.jsx(Gc,{content:N=>{const{active:D,payload:T}=N;if(!D||!T||T.length===0)return null;const z=T[0]&&typeof T[0]=="object"&&"payload"in T[0]?T[0].payload?.label??"":"";return h.jsxs("div",{className:"rounded-lg border bg-background p-2 shadow-sm",children:[h.jsx("div",{className:"mb-1.5 text-xs text-muted-foreground",children:z}),h.jsx("div",{className:"flex flex-col gap-1",children:T.map(E=>{if(!E.value||E.value===0)return null;const L=y.find(b=>b.name===E.dataKey),$=_.get(L?.connectionId||"");return h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("div",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:E.color}}),h.jsx(He,{icon:$?.icon||null,name:E.dataKey,size:"xs",fallbackIcon:h.jsx(Gt,{}),className:"shrink-0"}),h.jsxs("span",{className:"text-xs font-medium",children:[E.dataKey,":"]}),h.jsx("span",{className:"text-xs font-bold",children:E.value})]},E.dataKey)})})]})}}),y.map(N=>h.jsx(ea,{type:"monotone",dataKey:N.name,stroke:x.get(N.name),strokeWidth:2,dot:!1,activeDot:{r:4}},N.name))]})}),h.jsxs("div",{className:"flex items-start justify-between text-xs text-muted-foreground w-full",children:[h.jsx("p",{children:M(u)}),h.jsx("p",{children:M(d)})]})]})})}function o0(e){return e.toLocaleDateString("en-US",{month:"short",day:"numeric"})}function r0(e){return[e.id,e]}function s0(){const e=se.c(4);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=h.jsx("div",{className:"h-5 w-20 rounded bg-muted animate-pulse"}),e[0]=t):t=e[0];let n;e[1]===Symbol.for("react.memo_cache_sentinel")?(n=h.jsxs("div",{className:"flex flex-col gap-1.5",children:[t,h.jsx("div",{className:"flex items-center gap-2",children:Array.from({length:3}).map(i0)})]}),e[1]=n):n=e[1];let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx("div",{className:"flex-1 min-h-0 max-h-[120px] w-full rounded bg-muted animate-pulse"}),e[2]=o):o=e[2];let r;return e[3]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(Ae,{title:n,children:h.jsxs("div",{className:"flex flex-col gap-2 w-full h-full",children:[o,h.jsxs("div",{className:"flex items-start justify-between w-full",children:[h.jsx("div",{className:"h-4 w-16 rounded bg-muted animate-pulse"}),h.jsx("div",{className:"h-4 w-16 rounded bg-muted animate-pulse"})]})]})}),e[3]=r):r=e[3],r}function i0(e,t){return h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("div",{className:"size-4 aspect-square rounded-md bg-muted animate-pulse"}),h.jsx("div",{className:"h-2.5 w-16 rounded bg-muted animate-pulse"})]},t)}const zr={Content:n0,Skeleton:s0};function a0(){const e=se.c(21),{org:t,locator:n}=Se(),o=ye();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=je(),e[0]=r):r=e[0];const s=r;let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=De(),e[1]=i):i=e[1];const a=i;let l;e[2]!==n?(l={toolCaller:s,toolName:"MONITORING_STATS",toolInputParams:a,scope:n,staleTime:6e4,refetchInterval:c0},e[2]=n,e[3]=l):l=e[3];const{data:c}=Te(l);if(rn(c))return null;let u;e[4]!==o||e[5]!==t.slug?(u=()=>{o({to:"/$org/mcps",params:{org:t.slug},search:{action:"create"}})},e[4]=o,e[5]=t.slug,e[6]=u):u=e[6];const d=u;let f;e[7]!==o||e[8]!==t.slug?(f=()=>{o({to:"/$org/store",params:{org:t.slug}})},e[7]=o,e[8]=t.slug,e[9]=f):f=e[9];const g=f;let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=h.jsx("div",{className:"p-2",children:h.jsx("div",{className:"bg-muted border border-border rounded-lg h-[250px] overflow-hidden flex items-center justify-center",children:h.jsx("img",{src:"/empty-state-home.png",alt:"MCP Mesh illustration",className:"w-full h-full object-cover"})})}),e[10]=m):m=e[10];let y;e[11]===Symbol.for("react.memo_cache_sentinel")?(y=h.jsxs("div",{className:"px-6 py-6 space-y-2",children:[h.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Welcome to your MCP Mesh"}),h.jsx("p",{className:"text-sm text-muted-foreground leading-normal",children:"Connect your first Connection to unlock real-time metrics, activity logs, and analytics right here on your home."})]}),e[11]=y):y=e[11];let v;e[12]===Symbol.for("react.memo_cache_sentinel")?(v=h.jsx(ts,{size:16}),e[12]=v):v=e[12];let x;e[13]!==g?(x=h.jsxs(An,{onClick:g,size:"default",children:[v,"Browse Store"]}),e[13]=g,e[14]=x):x=e[14];let _;e[15]===Symbol.for("react.memo_cache_sentinel")?(_=h.jsx(Rr,{size:16}),e[15]=_):_=e[15];let p;e[16]!==d?(p=h.jsxs(An,{variant:"outline",onClick:d,size:"default",children:[_,"Custom Connection"]}),e[16]=d,e[17]=p):p=e[17];let w;return e[18]!==p||e[19]!==x?(w=h.jsx("div",{className:"absolute inset-0 flex items-center justify-center p-4 bg-background/80 backdrop-blur-[3px] z-10",children:h.jsxs("div",{className:"max-w-md w-full bg-background rounded-xl border border-border shadow-lg pointer-events-auto overflow-hidden",children:[m,y,h.jsxs("div",{className:"border-t border-border px-4 py-4 flex items-center justify-center gap-2",children:[x,p]})]})}),e[18]=p,e[19]=x,e[20]=w):w=e[20],w}function c0(e){return rn(e.state.data)?!1:1e3}function l0(e){const t=se.c(21),{metricsMode:n,onMetricsModeChange:o}=e;let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx("div",{className:"bg-background p-5 text-sm text-muted-foreground",children:"Failed to load monitoring stats"}),t[0]=r):r=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=h.jsx("div",{className:"lg:col-span-2",children:h.jsx(Ye,{fallback:r,children:h.jsx(C.Suspense,{fallback:h.jsx(Ar.Skeleton,{}),children:h.jsx(Ar.Content,{})})})}),t[1]=s):s=t[1];let i;t[2]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsx("div",{className:"bg-background p-5 text-sm text-muted-foreground",children:"Failed to load recent activity"}),t[2]=i):i=t[2];let a;t[3]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx("div",{className:"lg:col-span-1 lg:row-span-3 bg-background grid",children:h.jsx(Ye,{fallback:i,children:h.jsx(C.Suspense,{fallback:h.jsx(Dr.Skeleton,{}),children:h.jsx(Dr.Content,{})})})}),t[3]=a):a=t[3];let l;t[4]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx("div",{className:"bg-background p-5 text-sm text-muted-foreground",children:"Failed to load top tools"}),t[4]=l):l=t[4];let c;t[5]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(zr.Skeleton,{}),t[5]=c):c=t[5];let u;t[6]!==n?(u=h.jsx("div",{className:"lg:col-span-1 lg:row-span-1 bg-background",children:h.jsx(Ye,{fallback:l,children:h.jsx(C.Suspense,{fallback:c,children:h.jsx(zr.Content,{metricsMode:n})})})}),t[6]=n,t[7]=u):u=t[7];let d;t[8]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsx("div",{className:"bg-background p-5 text-sm text-muted-foreground",children:"Failed to load top servers"}),t[8]=d):d=t[8];let f;t[9]===Symbol.for("react.memo_cache_sentinel")?(f=h.jsx($r.Skeleton,{}),t[9]=f):f=t[9];let g;t[10]!==n||t[11]!==o?(g=h.jsx("div",{className:"lg:col-span-1 lg:row-span-1 bg-background",children:h.jsx(Ye,{fallback:d,children:h.jsx(C.Suspense,{fallback:f,children:h.jsx($r.Content,{metricsMode:n,onMetricsModeChange:o})})})}),t[10]=n,t[11]=o,t[12]=g):g=t[12];let m;t[13]===Symbol.for("react.memo_cache_sentinel")?(m=h.jsx("div",{className:"bg-background p-5 text-sm text-muted-foreground",children:"Failed to load top gateways"}),t[13]=m):m=t[13];let y;t[14]===Symbol.for("react.memo_cache_sentinel")?(y=h.jsx(Lr.Skeleton,{}),t[14]=y):y=t[14];let v;t[15]!==n?(v=h.jsx("div",{className:"lg:col-span-1 lg:row-span-1 bg-background",children:h.jsx(Ye,{fallback:m,children:h.jsx(C.Suspense,{fallback:y,children:h.jsx(Lr.Content,{metricsMode:n})})})}),t[15]=n,t[16]=v):v=t[16];let x;return t[17]!==g||t[18]!==v||t[19]!==u?(x=h.jsx("div",{className:"w-full",children:h.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-[0.5px] bg-border",children:[s,a,u,g,v]})}),t[17]=g,t[18]=v,t[19]=u,t[20]=x):x=t[20],x}function O0(){const e=se.c(30),{org:t,locator:n}=Se(),o=ye();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=je(),e[0]=r):r=e[0];const s=r;let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=De(),e[1]=i):i=e[1];const a=i,[l,c]=C.useState(d0),[u,d]=C.useState("requests");let f;e[2]!==n?(f={toolCaller:s,toolName:"MONITORING_STATS",toolInputParams:a,scope:n,staleTime:6e4,refetchInterval:u0},e[2]=n,e[3]=f):f=e[3];const{data:g}=Te(f);let m;e[4]!==g?(m=rn(g),e[4]=g,e[5]=m):m=e[5];const y=m;let v;e[6]===Symbol.for("react.memo_cache_sentinel")?(v=L=>{c(L),localStorage.setItem("org-home-view-mode",L)},e[6]=v):v=e[6];const x=v;let _;e[7]!==o||e[8]!==t.slug?(_=()=>{o({to:"/$org/mcps",params:{org:t.slug},search:{action:"create"}})},e[7]=o,e[8]=t.slug,e[9]=_):_=e[9];const p=_;let w;e[10]===Symbol.for("react.memo_cache_sentinel")?(w=h.jsx(a0,{}),e[10]=w):w=e[10];let M;e[11]!==y||e[12]!==l?(M=y&&h.jsx(hc,{value:l,onValueChange:x,size:"sm",options:[{value:"dashboard",icon:h.jsx(es,{})},{value:"graph",icon:h.jsx(mc,{})}]}),e[11]=y,e[12]=l,e[13]=M):M=e[13];let S;e[14]===Symbol.for("react.memo_cache_sentinel")?(S=h.jsx(Rr,{size:16}),e[14]=S):S=e[14];let N;e[15]!==p?(N=h.jsxs(An,{variant:"outline",size:"sm",onClick:p,children:[S,"Connect MCP Server"]}),e[15]=p,e[16]=N):N=e[16];let D;e[17]!==M||e[18]!==N?(D=h.jsxs("div",{className:"flex items-center gap-2",children:[M,N]}),e[17]=M,e[18]=N,e[19]=D):D=e[19];let T;e[20]!==t.name||e[21]!==D?(T=h.jsx(dc,{title:t.name,ctaButton:D}),e[20]=t.name,e[21]=D,e[22]=T):T=e[22];let z;e[23]!==u||e[24]!==y||e[25]!==l?(z=h.jsx("div",{className:"flex-1 overflow-auto relative",children:l==="graph"?h.jsx(Ye,{fallback:h.jsx("div",{className:"bg-background p-5 text-sm text-muted-foreground h-full flex items-center justify-center",children:"Failed to load mesh visualization"}),children:h.jsx(C.Suspense,{fallback:h.jsx(Vg,{}),children:h.jsx(Og,{showControls:y})})}):h.jsx(l0,{metricsMode:u,onMetricsModeChange:d})}),e[23]=u,e[24]=y,e[25]=l,e[26]=z):z=e[26];let E;return e[27]!==T||e[28]!==z?(E=h.jsxs(fc,{children:[w,T,z]}),e[27]=T,e[28]=z,e[29]=E):E=e[29],E}function u0(e){return rn(e.state.data)?!1:1e3}function d0(){const e=localStorage.getItem("org-home-view-mode");return e==="dashboard"||e==="graph"?e:"dashboard"}export{O0 as default};