@decocms/mesh 2.15.0 → 2.15.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 (159) hide show
  1. package/dist/client/assets/{AlertCircle-CIFhWg2i.js → AlertCircle-DlBo4Xw9.js} +1 -1
  2. package/dist/client/assets/{ArrowLeft-D0vIuW0V.js → ArrowLeft-CCqPW2JN.js} +1 -1
  3. package/dist/client/assets/{ArrowUp-MjJJcV-O.js → ArrowUp-KvHCnFh3.js} +1 -1
  4. package/dist/client/assets/{Check-LvJ1lSFr.js → Check-D4dBNJmC.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-QF_Tgl2v.js → ChevronDown-CJaS1NVA.js} +1 -1
  6. package/dist/client/assets/{Clock-CiIkKpUg.js → Clock-ljBuaWDA.js} +1 -1
  7. package/dist/client/assets/{Code01-Du8Lx-Uw.js → Code01-CMazpegY.js} +1 -1
  8. package/dist/client/assets/{Copy01-CunLN8rc.js → Copy01-Rf_P7R5F.js} +1 -1
  9. package/dist/client/assets/{DotsHorizontal-WE50knOB.js → DotsHorizontal-Nj82ZW12.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-CuQjcY-h.js → DotsVertical-f9rnazjX.js} +1 -1
  11. package/dist/client/assets/{Download01-syi4c4iH.js → Download01-Cnas0PSW.js} +1 -1
  12. package/dist/client/assets/{Edit01-DVUwOcf8.js → Edit01-MWKLkbpZ.js} +1 -1
  13. package/dist/client/assets/{File06-BM3BX-NC.js → File06-Dir7h2_j.js} +1 -1
  14. package/dist/client/assets/{FilterLines-DS1pmySA.js → FilterLines-BgxUhbig.js} +1 -1
  15. package/dist/client/assets/{FlipBackward-BKppcJN9.js → FlipBackward-B1KVh_65.js} +1 -1
  16. package/dist/client/assets/{GitBranch01-C3ShOPmQ.js → GitBranch01-CA4KhZZx.js} +1 -1
  17. package/dist/client/assets/{Grid01-DwtrqYPx.js → Grid01-BgBQwtBY.js} +1 -1
  18. package/dist/client/assets/{Home02-DlsAgg82.js → Home02-CR-W2ctm.js} +1 -1
  19. package/dist/client/assets/{Image01-Bw2o5F05.js → Image01-B8cj-qoF.js} +1 -1
  20. package/dist/client/assets/{Inbox01-CSDhYGLL.js → Inbox01-Bh5pMKE1.js} +1 -1
  21. package/dist/client/assets/{InfoCircle-xFKFZGrj.js → InfoCircle-CVdyaBb8.js} +1 -1
  22. package/dist/client/assets/{Key01-S9eZFu7R.js → Key01-BcxLAym0.js} +1 -1
  23. package/dist/client/assets/{LinkExternal01-Dbxh7ZV2.js → LinkExternal01-D41WE0Cl.js} +1 -1
  24. package/dist/client/assets/{List-D2PJPXod.js → List-hTdqyLGB.js} +1 -1
  25. package/dist/client/assets/{Loading01-BhuF3K1g.js → Loading01-Bq_7Os6T.js} +1 -1
  26. package/dist/client/assets/{Lock01-jUZQmYfl.js → Lock01-DOJDUqUZ.js} +1 -1
  27. package/dist/client/assets/{Play-BxDRmyN-.js → Play-CoxjBx7-.js} +1 -1
  28. package/dist/client/assets/{Plus-DCVckKM0.js → Plus-C4F6mby2.js} +1 -1
  29. package/dist/client/assets/{SearchMd-tLR3QB8E.js → SearchMd-B_A85eif.js} +1 -1
  30. package/dist/client/assets/{Terminal-DwE3k3eb.js → Terminal-BWurH474.js} +1 -1
  31. package/dist/client/assets/{Trash01-Dg5Q9OUO.js → Trash01-GrzirNvV.js} +1 -1
  32. package/dist/client/assets/{Upload01-BJUxi5ck.js → Upload01-Ba_zCXbQ.js} +1 -1
  33. package/dist/client/assets/{X-DKF1oh5v.js → X-D09jV0HO.js} +1 -1
  34. package/dist/client/assets/{XClose-BACMQGhN.js → XClose-D9UXYoHK.js} +1 -1
  35. package/dist/client/assets/{alert-dialog-BryTAX-J.js → alert-dialog-Df8ZsItX.js} +1 -1
  36. package/dist/client/assets/{auth-catchall-B3H5JOvc.js → auth-catchall-Bu_AmzqF.js} +1 -1
  37. package/dist/client/assets/{avatar-BtMYdv0U.js → avatar-CrVRRbJ7.js} +1 -1
  38. package/dist/client/assets/{badge-Do7WFlPI.js → badge-BPKvq16e.js} +1 -1
  39. package/dist/client/assets/{binder-B3GXUIAu.js → binder-BtPpbY4I.js} +1 -1
  40. package/dist/client/assets/{button-ClkQLR3o.js → button-Co_HOc3E.js} +1 -1
  41. package/dist/client/assets/{card-CwMKn79y.js → card-Rz2C5-Lx.js} +1 -1
  42. package/dist/client/assets/{checkbox-C6hBycBx.js → checkbox-DGIT6WZ3.js} +1 -1
  43. package/dist/client/assets/{collection-detail-C-m2H10s.js → collection-detail-CIorpvYQ.js} +1 -1
  44. package/dist/client/assets/{collection-display-button-CdHXoeVD.js → collection-display-button-C_GfVLwh.js} +1 -1
  45. package/dist/client/assets/{collection-header-CeBQhXWy.js → collection-header-Dl8Ii13M.js} +1 -1
  46. package/dist/client/assets/{collection-page-pMUw63Yr.js → collection-page-C75JriCh.js} +1 -1
  47. package/dist/client/assets/{collection-search-CF1o4yO7.js → collection-search-D67e9ppe.js} +1 -1
  48. package/dist/client/assets/{collection-tab-ChPNT80-.js → collection-tab-DVmiR956.js} +1 -1
  49. package/dist/client/assets/{collection-table-wrapper-jfSAC6dF.js → collection-table-wrapper-DDHrDWif.js} +1 -1
  50. package/dist/client/assets/{connection-BcYehfdK.js → connection-CmMMEDBY.js} +1 -1
  51. package/dist/client/assets/{connection-card-DO3ahSdV.js → connection-card-BuCHeT4K.js} +1 -1
  52. package/dist/client/assets/{connection-detail-i_lj-oMr.js → connection-detail-BsC5t8hY.js} +1 -1
  53. package/dist/client/assets/{connections-CMzrwOZS.js → connections-B3RW87mz.js} +1 -1
  54. package/dist/client/assets/constants-B5NZDm4s.js +1 -0
  55. package/dist/client/assets/{create-organization-dialog-BydMMM5g.js → create-organization-dialog-DQ5uy2r0.js} +1 -1
  56. package/dist/client/assets/{dialog-Y0g8yyzz.js → dialog-bW33A1d_.js} +1 -1
  57. package/dist/client/assets/{dropdown-menu-C4Ypstre.js → dropdown-menu-dsr_wyw0.js} +1 -1
  58. package/dist/client/assets/{dynamic-plugin-layout-Cds2rM_Z.js → dynamic-plugin-layout-IH0Gl52A.js} +1 -1
  59. package/dist/client/assets/{empty-state-C0gi-aAx.js → empty-state-B1DU5702.js} +1 -1
  60. package/dist/client/assets/{empty-state-Dx0NLAxy.js → empty-state-By_kA__m.js} +1 -1
  61. package/dist/client/assets/{env-vars-editor-GTn7Eu5T.js → env-vars-editor-BjH5KdVc.js} +1 -1
  62. package/dist/client/assets/{error-boundary-D2ZJQHnD.js → error-boundary-BOBkDZ1Y.js} +1 -1
  63. package/dist/client/assets/{extract-connection-data-nsOyk4eb.js → extract-connection-data-CNcw3HV2.js} +1 -1
  64. package/dist/client/assets/{file-browser-s8pLbWaW.js → file-browser-BDyBPrc6.js} +2 -2
  65. package/dist/client/assets/{form-DDdl0439.js → form-ChO7tWCF.js} +1 -1
  66. package/dist/client/assets/{gateway-detail-NHGkjgTy.js → gateway-detail-CzuSbsFr.js} +1 -1
  67. package/dist/client/assets/{gateways-Bv1uyRdE.js → gateways-ckyn_Uas.js} +1 -1
  68. package/dist/client/assets/{grid-view-DNPq1Y__.js → grid-view-CTAOtRDs.js} +1 -1
  69. package/dist/client/assets/{home-9eTtEa0h.js → home-CpIhQ8D8.js} +1 -1
  70. package/dist/client/assets/{index-D6aVJNvm.js → index-BUdiVz6f.js} +1 -1
  71. package/dist/client/assets/{index-hEHbC4y4.js → index-Bc30BcYv.js} +3 -3
  72. package/dist/client/assets/{index-DqVdeyIE.js → index-CH2G6_zW.js} +1 -1
  73. package/dist/client/assets/{index-Cbsnfme0.js → index-ChF3uWl9.js} +1 -1
  74. package/dist/client/assets/{index-C5FDJtAp.js → index-ZiFjEqyT.js} +2 -2
  75. package/dist/client/assets/{infiniteQueryObserver-BnxPLCEe.js → infiniteQueryObserver-DEh2zauU.js} +1 -1
  76. package/dist/client/assets/{input-BbWUShhD.js → input-DEsmZ6es.js} +1 -1
  77. package/dist/client/assets/{layout-BnqnCJOk.js → layout-tF7tb_Qc.js} +1 -1
  78. package/dist/client/assets/{lazy-highlighter-BHJogLPz.js → lazy-highlighter-B2TKQCpQ.js} +1 -1
  79. package/dist/client/assets/{localstorage-keys-BZEjwsD0.js → localstorage-keys-DhdYpXZj.js} +1 -1
  80. package/dist/client/assets/{login-DGLLQl3L.js → login-DtC787Hg.js} +1 -1
  81. package/dist/client/assets/{mcp-oauth-CkuEWYY4.js → mcp-oauth-D8a9d38x.js} +1 -1
  82. package/dist/client/assets/{mcp-server-card-D4bCdTAY.js → mcp-server-card-DSQZ-b3I.js} +1 -1
  83. package/dist/client/assets/{mcp-server-detail-Cy2l0hPz.js → mcp-server-detail-rW4PqaOO.js} +1 -1
  84. package/dist/client/assets/members-C4HTAJHG.js +3 -0
  85. package/dist/client/assets/{monaco-editor-BnXEGbzY.js → monaco-editor-BYgR7J38.js} +1 -1
  86. package/dist/client/assets/{monitoring-vPlAvNfN.js → monitoring-BGY0w02b.js} +1 -1
  87. package/dist/client/assets/{oauth-callback-I_aRwsB5.js → oauth-callback-BSZdPTYI.js} +1 -1
  88. package/dist/client/assets/{page-fWJ76jbj.js → page-DcQoSvJk.js} +1 -1
  89. package/dist/client/assets/{page-DPsdZaOi.js → page-DxMYdFSw.js} +1 -1
  90. package/dist/client/assets/{pin-to-sidebar-button-DTR_Oj1s.js → pin-to-sidebar-button-BahvsjHH.js} +1 -1
  91. package/dist/client/assets/{plugin-empty-state-RYQHQ0B6.js → plugin-empty-state-CIiB0IAw.js} +1 -1
  92. package/dist/client/assets/{plugin-header-BPW1tb_d.js → plugin-header-CvDO4WmD.js} +1 -1
  93. package/dist/client/assets/{plugins-DN4-aMVD.js → plugins-CyUBsABC.js} +1 -1
  94. package/dist/client/assets/{popover-DLFe45bO.js → popover-DW05feED.js} +1 -1
  95. package/dist/client/assets/{project-context-provider-DH0iqA5D.js → project-context-provider-BPo-49FO.js} +1 -1
  96. package/dist/client/assets/{registry-utils-BPPApxjf.js → registry-utils-DzI73csj.js} +1 -1
  97. package/dist/client/assets/{resizable-C6uSLZAk.js → resizable-BAPLF4RD.js} +1 -1
  98. package/dist/client/assets/{resource-tabs-CKatVKnl.js → resource-tabs-CC5dHHUl.js} +1 -1
  99. package/dist/client/assets/{select-CSzUpxmC.js → select-CVEPeRAQ.js} +1 -1
  100. package/dist/client/assets/{settings-Dk6-Mm8r.js → settings-BfbdOKrl.js} +1 -1
  101. package/dist/client/assets/{shell-layout-P7XxC3ZF.js → shell-layout-DJjajsTY.js} +1 -1
  102. package/dist/client/assets/{spinner-CUAQv_4V.js → spinner-DqooIng7.js} +1 -1
  103. package/dist/client/assets/{switch-ZAqg3LbP.js → switch-dZML6kqo.js} +1 -1
  104. package/dist/client/assets/{textarea-BDJhX5-9.js → textarea-DFRypKCQ.js} +1 -1
  105. package/dist/client/assets/{tool-set-selector-D26m7PpE.js → tool-set-selector-DRx4AOzy.js} +1 -1
  106. package/dist/client/assets/{tools-list-pl3Bsjpf.js → tools-list-C8nSsOKD.js} +1 -1
  107. package/dist/client/assets/{tooltip-DXYcokUT.js → tooltip-BJO9sFhZ.js} +1 -1
  108. package/dist/client/assets/{use-binding-Cmi2FEqF.js → use-binding-C8KxuIY6.js} +1 -1
  109. package/dist/client/assets/{use-collections-DxMxR_jZ.js → use-collections-g067BPxP.js} +1 -1
  110. package/dist/client/assets/{use-connection-ClVfoZWG.js → use-connection-BskZam-G.js} +1 -1
  111. package/dist/client/assets/{use-connection-resources-nXRlJNhx.js → use-connection-resources-YXIBGXnm.js} +1 -1
  112. package/dist/client/assets/{use-create-gateway-UkmAQbcu.js → use-create-gateway-CCmt4GT8.js} +1 -1
  113. package/dist/client/assets/{use-gateway-system-prompt-CYi0Zo4K.js → use-gateway-system-prompt-DoCpWoeh.js} +1 -1
  114. package/dist/client/assets/{use-gateway-D_zdUoI4.js → use-gateway-v7etejE8.js} +1 -1
  115. package/dist/client/assets/{use-list-state-G6sniPDx.js → use-list-state-C5pgFF_z.js} +1 -1
  116. package/dist/client/assets/{use-mcp-hlkUt7pz.js → use-mcp-ZNQ-iMEF.js} +1 -1
  117. package/dist/client/assets/{use-members-3RqzErHO.js → use-members-dVasH0ez.js} +1 -1
  118. package/dist/client/assets/{use-mobile-DT1cwytU.js → use-mobile-Co7MtEW-.js} +1 -1
  119. package/dist/client/assets/{use-model-state-Bc4MpPVu.js → use-model-state-B8hL-q1r.js} +2 -2
  120. package/dist/client/assets/{use-organization-settings-D46q7SyU.js → use-organization-settings-K7SU43aD.js} +1 -1
  121. package/dist/client/assets/{use-tool-call-BH-yOcTy.js → use-tool-call-BbfSyOCz.js} +1 -1
  122. package/dist/client/assets/useInfiniteQuery-Dbq7IS1q.js +1 -0
  123. package/dist/client/assets/{useMutation-DEocBykZ.js → useMutation-4fnzP4bc.js} +1 -1
  124. package/dist/client/assets/useQuery-Bn2Wcch_.js +1 -0
  125. package/dist/client/assets/{value-C9Bb1t7X.js → value-zEqR5KPg.js} +1 -1
  126. package/dist/client/assets/{view-mode-toggle-C5hz9T3M.js → view-mode-toggle-tlrhMsiy.js} +1 -1
  127. package/dist/client/assets/{workflow-BJoyVBBY.js → workflow-B8_jtBci.js} +1 -1
  128. package/dist/client/index.html +1 -1
  129. package/dist/server/cli.js +216 -216
  130. package/dist/server/migrate.js +154 -144
  131. package/dist/server/server.js +212 -212
  132. package/package.json +1 -1
  133. package/dist/client/assets/constants-BIwbIZhE.js +0 -1
  134. package/dist/client/assets/members-CXuNIHGD.js +0 -3
  135. package/dist/client/assets/useInfiniteQuery-Dl93eV8h.js +0 -1
  136. package/dist/client/assets/useQuery-Dakt0IBq.js +0 -1
  137. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/LICENSE +0 -47
  138. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/README.md +0 -82
  139. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/emscripten-module.browser.d.ts +0 -11
  140. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/emscripten-module.browser.mjs +0 -43
  141. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/emscripten-module.cjs +0 -45
  142. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/emscripten-module.cloudflare.cjs +0 -46
  143. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/emscripten-module.cloudflare.d.ts +0 -11
  144. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/emscripten-module.d.ts +0 -11
  145. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/emscripten-module.mjs +0 -46
  146. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/emscripten-module.wasm +0 -0
  147. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/ffi.d.mts +0 -83
  148. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/ffi.d.ts +0 -83
  149. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/ffi.js +0 -2
  150. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/ffi.js.map +0 -1
  151. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/ffi.mjs +0 -2
  152. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/ffi.mjs.map +0 -1
  153. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/index.d.mts +0 -20
  154. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/index.d.ts +0 -20
  155. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/index.js +0 -2
  156. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/index.js.map +0 -1
  157. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/index.mjs +0 -2
  158. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/index.mjs.map +0 -1
  159. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/package.json +0 -61
@@ -1,4 +1,4 @@
1
- import{a7 as _O,a8 as SO,r as g,c as ae,f as ia,j as v,t as wr,a9 as Da,a4 as Qe,aa as Te,H as Re,ab as PO,ac as OO,ad as CO,ae as jO,af as AO,ag as mn,ah as NO,ai as MO,aj as oa,ak as ho,al as Mr,m as jr,am as EO,b as TO,K as kO}from"./index-C5FDJtAp.js";import{c as vo}from"./connection-BcYehfdK.js";import{C as yf}from"./collection-header-CeBQhXWy.js";import{C as IO}from"./collection-page-pMUw63Yr.js";import{C as DO}from"./collection-search-CF1o4yO7.js";import{I as Fn,n as bf,E as w1}from"./empty-state-C0gi-aAx.js";import{E as Ja}from"./error-boundary-D2ZJQHnD.js";import{B as Bn}from"./badge-Do7WFlPI.js";import{t as fi}from"./ChevronDown-QF_Tgl2v.js";import{i as _1,c as RO}from"./Grid01-DwtrqYPx.js";import{u as pn}from"./project-context-provider-DH0iqA5D.js";import{B as Me,c as ve,b as lv}from"./button-ClkQLR3o.js";import{P as sa,a as la,b as ua}from"./popover-DLFe45bO.js";import{c as ei,b as ti,T as ri}from"./tooltip-DXYcokUT.js";import{i as uv}from"./Check-LvJ1lSFr.js";import{a as vs}from"./Copy01-CunLN8rc.js";import{n as cv}from"./Download01-syi4c4iH.js";import{i as S1}from"./FilterLines-DS1pmySA.js";import{i as LO}from"./Key01-S9eZFu7R.js";import{i as $O,n as qO}from"./Play-BxDRmyN-.js";import{M as fv}from"./monaco-editor-BnXEGbzY.js";import{r as FO,_ as gn}from"./index-D6aVJNvm.js";import{d as mo,i as BO,e as zO,T as ms}from"./value-C9Bb1t7X.js";import{u as md}from"./use-connection-ClVfoZWG.js";import{u as P1,i as WO}from"./use-gateway-D_zdUoI4.js";import{u as UO}from"./use-members-3RqzErHO.js";import{i as KO}from"./Code01-Du8Lx-Uw.js";import{s as HO}from"./Plus-DCVckKM0.js";import{s as YO}from"./Trash01-Dg5Q9OUO.js";import{I as qn}from"./input-BbWUShhD.js";import{C as dv}from"./checkbox-C6hBycBx.js";import{i as GO}from"./SearchMd-tLR3QB8E.js";import{e as VO,S as hv,a as vv,b as mv,c as pv,d as Ra}from"./select-CSzUpxmC.js";import{s as XO}from"./Clock-CiIkKpUg.js";import{I as ZO}from"./infiniteQueryObserver-BnxPLCEe.js";import{T as QO}from"./textarea-BDJhX5-9.js";import{R as JO}from"./resource-tabs-CKatVKnl.js";import{u as pd}from"./use-tool-call-BH-yOcTy.js";import"./collection-display-button-CdHXoeVD.js";import"./dropdown-menu-C4Ypstre.js";import"./ArrowUp-MjJJcV-O.js";import"./List-D2PJPXod.js";import"./view-mode-toggle-C5hz9T3M.js";import"./Loading01-BhuF3K1g.js";import"./spinner-CUAQv_4V.js";import"./use-collections-DxMxR_jZ.js";import"./useMutation-DEocBykZ.js";import"./useQuery-Dakt0IBq.js";function eC(e,t){return _O({...e,enabled:!0,suspense:!0,throwOnError:SO},ZO,t)}const O1=({size:e=24,color:t="currentColor",...r})=>g.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},g.createElement("path",{d:"m15 18-6-6 6-6"}));O1.displayName="ChevronLeft";const C1=({size:e=24,color:t="currentColor",...r})=>g.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},g.createElement("path",{d:"M9.5 15V9m5 6V9m7.5 3c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z"}));C1.displayName="PauseCircle";const j1=({size:e=24,color:t="currentColor",...r})=>g.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},g.createElement("path",{d:"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z"}),g.createElement("path",{d:"M9.5 8.965c0-.477 0-.716.1-.849a.5.5 0 0 1 .364-.199c.166-.012.367.117.769.375l4.72 3.035c.349.224.523.336.583.478a.5.5 0 0 1 0 .39c-.06.142-.234.254-.583.478l-4.72 3.035c-.402.258-.603.387-.769.375a.5.5 0 0 1-.364-.2c-.1-.132-.1-.371-.1-.848v-6.07Z"}));j1.displayName="PlayCircle";const A1=({size:e=24,color:t="currentColor",...r})=>g.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},g.createElement("path",{d:"M4 7c0-.932 0-1.398.152-1.765a2 2 0 0 1 1.083-1.083C5.602 4 6.068 4 7 4h10c.932 0 1.398 0 1.765.152a2 2 0 0 1 1.083 1.083C20 5.602 20 6.068 20 7M9 20h6M12 4v16"}));A1.displayName="Type01";function gd(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}function tC(e,t){t===void 0&&(t=e,e=mo);for(var r=0,n=t.length-1,a=t[0],i=new Array(n<0?0:n);r<n;)i[r]=e(a,a=t[++r]);return function(o){var s=Math.max(0,Math.min(n-1,Math.floor(o*=n)));return i[s](o-s)}}const xf={maxJsonRenderSize:5e4,pageSize:50,streamingRefetchInterval:3e3};function _r(e){return e.filter(t=>t.key.trim()).map(t=>{const r=encodeURIComponent(t.key.trim()),n=encodeURIComponent(t.value||"");return`${r}:${t.operator}:${n}`}).join(",")}function rC(e){return e?e.split(",").map(t=>{const[r,n,...a]=t.split(":");return{key:decodeURIComponent(r||""),operator:n||"eq",value:decodeURIComponent(a.join(":")||"")}}):[]}function La(e){return e.filter(t=>t.key.trim()).map(t=>{switch(t.operator){case"eq":return`${t.key}=${t.value}`;case"contains":return`${t.key}~${t.value}`;case"exists":return`${t.key}?`}}).join(`
1
+ import{a7 as _O,a8 as SO,r as g,c as ae,f as ia,j as v,t as wr,a9 as Da,a4 as Qe,aa as Te,H as Re,ab as PO,ac as OO,ad as CO,ae as jO,af as AO,ag as mn,ah as NO,ai as MO,aj as oa,ak as ho,al as Mr,m as jr,am as EO,b as TO,K as kO}from"./index-ZiFjEqyT.js";import{c as vo}from"./connection-CmMMEDBY.js";import{C as yf}from"./collection-header-Dl8Ii13M.js";import{C as IO}from"./collection-page-C75JriCh.js";import{C as DO}from"./collection-search-D67e9ppe.js";import{I as Fn,n as bf,E as w1}from"./empty-state-B1DU5702.js";import{E as Ja}from"./error-boundary-BOBkDZ1Y.js";import{B as Bn}from"./badge-BPKvq16e.js";import{t as fi}from"./ChevronDown-CJaS1NVA.js";import{i as _1,c as RO}from"./Grid01-BgBQwtBY.js";import{u as pn}from"./project-context-provider-BPo-49FO.js";import{B as Me,c as ve,b as lv}from"./button-Co_HOc3E.js";import{P as sa,a as la,b as ua}from"./popover-DW05feED.js";import{c as ei,b as ti,T as ri}from"./tooltip-BJO9sFhZ.js";import{i as uv}from"./Check-D4dBNJmC.js";import{a as vs}from"./Copy01-Rf_P7R5F.js";import{n as cv}from"./Download01-Cnas0PSW.js";import{i as S1}from"./FilterLines-BgxUhbig.js";import{i as LO}from"./Key01-BcxLAym0.js";import{i as $O,n as qO}from"./Play-CoxjBx7-.js";import{M as fv}from"./monaco-editor-BYgR7J38.js";import{r as FO,_ as gn}from"./index-BUdiVz6f.js";import{d as mo,i as BO,e as zO,T as ms}from"./value-zEqR5KPg.js";import{u as md}from"./use-connection-BskZam-G.js";import{u as P1,i as WO}from"./use-gateway-v7etejE8.js";import{u as UO}from"./use-members-dVasH0ez.js";import{i as KO}from"./Code01-CMazpegY.js";import{s as HO}from"./Plus-C4F6mby2.js";import{s as YO}from"./Trash01-GrzirNvV.js";import{I as qn}from"./input-DEsmZ6es.js";import{C as dv}from"./checkbox-DGIT6WZ3.js";import{i as GO}from"./SearchMd-B_A85eif.js";import{e as VO,S as hv,a as vv,b as mv,c as pv,d as Ra}from"./select-CVEPeRAQ.js";import{s as XO}from"./Clock-ljBuaWDA.js";import{I as ZO}from"./infiniteQueryObserver-DEh2zauU.js";import{T as QO}from"./textarea-DFRypKCQ.js";import{R as JO}from"./resource-tabs-CC5dHHUl.js";import{u as pd}from"./use-tool-call-BbfSyOCz.js";import"./collection-display-button-C_GfVLwh.js";import"./dropdown-menu-dsr_wyw0.js";import"./ArrowUp-KvHCnFh3.js";import"./List-hTdqyLGB.js";import"./view-mode-toggle-tlrhMsiy.js";import"./Loading01-Bq_7Os6T.js";import"./spinner-DqooIng7.js";import"./use-collections-g067BPxP.js";import"./useMutation-4fnzP4bc.js";import"./useQuery-Bn2Wcch_.js";function eC(e,t){return _O({...e,enabled:!0,suspense:!0,throwOnError:SO},ZO,t)}const O1=({size:e=24,color:t="currentColor",...r})=>g.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},g.createElement("path",{d:"m15 18-6-6 6-6"}));O1.displayName="ChevronLeft";const C1=({size:e=24,color:t="currentColor",...r})=>g.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},g.createElement("path",{d:"M9.5 15V9m5 6V9m7.5 3c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z"}));C1.displayName="PauseCircle";const j1=({size:e=24,color:t="currentColor",...r})=>g.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},g.createElement("path",{d:"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z"}),g.createElement("path",{d:"M9.5 8.965c0-.477 0-.716.1-.849a.5.5 0 0 1 .364-.199c.166-.012.367.117.769.375l4.72 3.035c.349.224.523.336.583.478a.5.5 0 0 1 0 .39c-.06.142-.234.254-.583.478l-4.72 3.035c-.402.258-.603.387-.769.375a.5.5 0 0 1-.364-.2c-.1-.132-.1-.371-.1-.848v-6.07Z"}));j1.displayName="PlayCircle";const A1=({size:e=24,color:t="currentColor",...r})=>g.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},g.createElement("path",{d:"M4 7c0-.932 0-1.398.152-1.765a2 2 0 0 1 1.083-1.083C5.602 4 6.068 4 7 4h10c.932 0 1.398 0 1.765.152a2 2 0 0 1 1.083 1.083C20 5.602 20 6.068 20 7M9 20h6M12 4v16"}));A1.displayName="Type01";function gd(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}function tC(e,t){t===void 0&&(t=e,e=mo);for(var r=0,n=t.length-1,a=t[0],i=new Array(n<0?0:n);r<n;)i[r]=e(a,a=t[++r]);return function(o){var s=Math.max(0,Math.min(n-1,Math.floor(o*=n)));return i[s](o-s)}}const xf={maxJsonRenderSize:5e4,pageSize:50,streamingRefetchInterval:3e3};function _r(e){return e.filter(t=>t.key.trim()).map(t=>{const r=encodeURIComponent(t.key.trim()),n=encodeURIComponent(t.value||"");return`${r}:${t.operator}:${n}`}).join(",")}function rC(e){return e?e.split(",").map(t=>{const[r,n,...a]=t.split(":");return{key:decodeURIComponent(r||""),operator:n||"eq",value:decodeURIComponent(a.join(":")||"")}}):[]}function La(e){return e.filter(t=>t.key.trim()).map(t=>{switch(t.operator){case"eq":return`${t.key}=${t.value}`;case"contains":return`${t.key}~${t.value}`;case"exists":return`${t.key}?`}}).join(`
2
2
  `)}function gv(e){return e.trim()?e.split(`
3
3
  `).map(t=>t.trim()).filter(t=>t.length>0).map(t=>{if(t.endsWith("?"))return{key:t.slice(0,-1),operator:"exists",value:""};if(t.includes("=")){const[r,...n]=t.split("=");return{key:r||"",operator:"eq",value:n.join("=")}}if(t.includes("~")){const[r,...n]=t.split("~");return{key:r||"",operator:"contains",value:n.join("~")}}return{key:t,operator:"exists",value:""}}):[]}function nC(e){const t={},r={},n=[];for(const a of e)if(a.key.trim())switch(a.operator){case"eq":a.value&&(t[a.key]=a.value);break;case"contains":a.value&&(r[a.key]=`%${a.value}%`);break;case"exists":n.push(a.key);break}return{properties:Object.keys(t).length>0?t:void 0,propertyPatterns:Object.keys(r).length>0?r:void 0,propertyKeys:n.length>0?n:void 0}}function yv(e){if(!e)return{content:"null",isTruncated:!1,originalSize:4};const t=JSON.stringify(e,null,2),r=t.length;return r<=xf.maxJsonRenderSize?{content:t,isTruncated:!1,originalSize:r}:{content:t.slice(0,xf.maxJsonRenderSize)+`
4
4
 
@@ -1 +1 @@
1
- import{r as i,j as e}from"./index-C5FDJtAp.js";import{i as n}from"./Loading01-BhuF3K1g.js";import{h as l}from"./mcp-oauth-CkuEWYY4.js";function h(){const[s,c]=i.useState(null),[r,a]=i.useState(!1);return i.useEffect(()=>{(async()=>{try{const t=await l();if(!t.success){c(t.error||"MCP authentication failed"),setTimeout(()=>{window.close()},3e3);return}a(!0),setTimeout(()=>{window.close()},1500)}catch(t){c(t instanceof Error?t.message:String(t)),setTimeout(()=>{window.close()},3e3)}})()},[]),e.jsx("div",{className:"min-h-screen flex items-center justify-center p-8 bg-background",children:e.jsxs("div",{className:"w-full max-w-md flex flex-col items-center justify-center gap-8",children:[r&&e.jsx("img",{src:"/empty-state-success.svg",alt:"",width:220,height:200,"aria-hidden":"true"}),!r&&!s&&e.jsx("div",{className:"flex items-center justify-center py-4",children:e.jsx(n,{size:32,className:"animate-spin text-primary"})}),s&&e.jsx("img",{src:"/empty-state-error.svg",alt:"",width:220,height:200,"aria-hidden":"true"}),e.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[e.jsx("h2",{className:"text-lg font-medium text-foreground",children:s?"Authentication Failed":r?"Authentication Successful":"Authentication in progress..."}),e.jsx("div",{className:"text-sm text-muted-foreground",children:s?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mb-2",children:"An error occurred during authentication:"}),e.jsx("p",{className:"text-destructive",children:s}),e.jsxs("p",{className:"mt-2",children:[e.jsx("br",{}),"This window will close automatically."]})]}):r?e.jsxs("p",{children:["Authentication complete.",e.jsx("br",{}),"This window will close automatically."]}):e.jsx("p",{children:"Processing authentication..."})})]})]})})}export{h as default};
1
+ import{r as i,j as e}from"./index-ZiFjEqyT.js";import{i as n}from"./Loading01-Bq_7Os6T.js";import{h as l}from"./mcp-oauth-D8a9d38x.js";function h(){const[s,c]=i.useState(null),[r,a]=i.useState(!1);return i.useEffect(()=>{(async()=>{try{const t=await l();if(!t.success){c(t.error||"MCP authentication failed"),setTimeout(()=>{window.close()},3e3);return}a(!0),setTimeout(()=>{window.close()},1500)}catch(t){c(t instanceof Error?t.message:String(t)),setTimeout(()=>{window.close()},3e3)}})()},[]),e.jsx("div",{className:"min-h-screen flex items-center justify-center p-8 bg-background",children:e.jsxs("div",{className:"w-full max-w-md flex flex-col items-center justify-center gap-8",children:[r&&e.jsx("img",{src:"/empty-state-success.svg",alt:"",width:220,height:200,"aria-hidden":"true"}),!r&&!s&&e.jsx("div",{className:"flex items-center justify-center py-4",children:e.jsx(n,{size:32,className:"animate-spin text-primary"})}),s&&e.jsx("img",{src:"/empty-state-error.svg",alt:"",width:220,height:200,"aria-hidden":"true"}),e.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[e.jsx("h2",{className:"text-lg font-medium text-foreground",children:s?"Authentication Failed":r?"Authentication Successful":"Authentication in progress..."}),e.jsx("div",{className:"text-sm text-muted-foreground",children:s?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mb-2",children:"An error occurred during authentication:"}),e.jsx("p",{className:"text-destructive",children:s}),e.jsxs("p",{className:"mt-2",children:[e.jsx("br",{}),"This window will close automatically."]})]}):r?e.jsxs("p",{children:["Authentication complete.",e.jsx("br",{}),"This window will close automatically."]}):e.jsx("p",{children:"Processing authentication..."})})]})]})})}export{h as default};
@@ -1,4 +1,4 @@
1
- import{r as H,F as Zi,H as Wi,j as y,c as pe,f as jt,k as Gi,a as qi,t as Ui}from"./index-C5FDJtAp.js";import{e as Ki,a as Qn,b as Qi,d as Ji,C as ue,G as Jn,M as eo,U as ea,f as ta}from"./index-hEHbC4y4.js";import{D as na,u as oa,b as ra,a as sa,c as ia,N as aa,d as to,G as en,T as ca}from"./use-model-state-Bc4MpPVu.js";import{E as dn}from"./error-boundary-D2ZJQHnD.js";import{u as tr}from"./use-connection-ClVfoZWG.js";import{u as nr,i as la}from"./use-gateway-D_zdUoI4.js";import{u as no}from"./localstorage-keys-BZEjwsD0.js";import{u as En}from"./project-context-provider-DH0iqA5D.js";import{c as or,B as rr}from"./button-ClkQLR3o.js";import{V as ua}from"./view-mode-toggle-C5hz9T3M.js";import{i as da}from"./GitBranch01-C3ShOPmQ.js";import{s as fa}from"./Plus-DCVckKM0.js";import{c as ha}from"./connection-BcYehfdK.js";import{I as sr,n as ga}from"./empty-state-C0gi-aAx.js";import{u as pa}from"./use-tool-call-BH-yOcTy.js";import{i as $e,a as oo,b as ma,c as ro,d as tn,T as nn,e as ya}from"./value-C9Bb1t7X.js";import"./input-BbWUShhD.js";import"./popover-DLFe45bO.js";import"./tooltip-DXYcokUT.js";import"./Check-LvJ1lSFr.js";import"./SearchMd-tLR3QB8E.js";import"./use-create-gateway-UkmAQbcu.js";import"./AlertCircle-CIFhWg2i.js";import"./X-DKF1oh5v.js";import"./ArrowUp-MjJJcV-O.js";import"./textarea-BDJhX5-9.js";import"./useMutation-DEocBykZ.js";import"./Grid01-DwtrqYPx.js";import"./Copy01-CunLN8rc.js";import"./Terminal-DwE3k3eb.js";import"./monaco-editor-BnXEGbzY.js";import"./spinner-CUAQv_4V.js";import"./alert-dialog-BryTAX-J.js";import"./select-CSzUpxmC.js";import"./ChevronDown-QF_Tgl2v.js";import"./File06-BM3BX-NC.js";import"./Image01-Bw2o5F05.js";import"./use-collections-DxMxR_jZ.js";import"./use-binding-Cmi2FEqF.js";import"./binder-B3GXUIAu.js";import"./use-gateway-system-prompt-CYi0Zo4K.js";import"./Edit01-DVUwOcf8.js";import"./well-known-mcp-D13f-8h2.js";import"./generate-id-Dyweu44Y.js";import"./Clock-CiIkKpUg.js";import"./Trash01-Dg5Q9OUO.js";import"./useQuery-Dakt0IBq.js";const Cn=({size:e=24,color:t="currentColor",...n})=>H.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},H.createElement("path",{d:"m10 15-3.075 3.114c-.43.434-.644.651-.828.666a.5.5 0 0 1-.421-.172c-.12-.14-.12-.446-.12-1.056v-1.56c0-.548-.449-.944-.99-1.024v0a3 3 0 0 1-2.534-2.533C2 12.219 2 11.96 2 11.445V6.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C4.28 2 5.12 2 6.8 2h7.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C19 4.28 19 5.12 19 6.8V11m0 11-2.176-1.513c-.306-.213-.46-.32-.626-.395a2.002 2.002 0 0 0-.462-.145c-.18-.033-.367-.033-.74-.033H13.2c-1.12 0-1.68 0-2.108-.218a2 2 0 0 1-.874-.874C10 18.394 10 17.834 10 16.714V14.2c0-1.12 0-1.68.218-2.108a2 2 0 0 1 .874-.874C11.52 11 12.08 11 13.2 11h5.6c1.12 0 1.68 0 2.108.218a2 2 0 0 1 .874.874C22 12.52 22 13.08 22 14.2v2.714c0 .932 0 1.398-.152 1.766a2 2 0 0 1-1.083 1.082c-.367.152-.833.152-1.765.152V22Z"}));Cn.displayName="MessageChatSquare";function ae(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=ae(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var xa={value:()=>{}};function Vt(){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 Ct(n)}function Ct(e){this._=e}function wa(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}})}Ct.prototype=Vt.prototype={constructor:Ct,on:function(e,t){var n=this._,o=wa(e+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(e=o[i]).type)&&(r=va(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(r=(e=o[i]).type)n[r]=so(n[r],e.name,t);else if(t==null)for(r in n)n[r]=so(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 Ct(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,i;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],o=0,r=i.length;o<r;++o)i[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,i=o.length;r<i;++r)o[r].value.apply(t,n)}};function va(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function so(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=xa,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var fn="http://www.w3.org/1999/xhtml";const io={svg:"http://www.w3.org/2000/svg",xhtml:fn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ot(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),io.hasOwnProperty(t)?{space:io[t],local:e}:e}function _a(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===fn&&t.documentElement.namespaceURI===fn?t.createElement(e):t.createElementNS(n,e)}}function ba(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ir(e){var t=Ot(e);return(t.local?ba:_a)(t)}function Sa(){}function Nn(e){return e==null?Sa:function(){return this.querySelector(e)}}function Ea(e){typeof e!="function"&&(e=Nn(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=new Array(s),l,c,u=0;u<s;++u)(l=i[u])&&(c=e.call(l,l.__data__,u,i))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new ge(o,this._parents)}function Ca(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Na(){return[]}function ar(e){return e==null?Na:function(){return this.querySelectorAll(e)}}function Ma(e){return function(){return Ca(e.apply(this,arguments))}}function Ia(e){typeof e=="function"?e=Ma(e):e=ar(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&(o.push(e.call(l,l.__data__,c,s)),r.push(l));return new ge(o,r)}function cr(e){return function(){return this.matches(e)}}function lr(e){return function(t){return t.matches(e)}}var ka=Array.prototype.find;function Aa(e){return function(){return ka.call(this.children,e)}}function Pa(){return this.firstElementChild}function Ta(e){return this.select(e==null?Pa:Aa(typeof e=="function"?e:lr(e)))}var Da=Array.prototype.filter;function $a(){return Array.from(this.children)}function za(e){return function(){return Da.call(this.children,e)}}function Ha(e){return this.selectAll(e==null?$a:za(typeof e=="function"?e:lr(e)))}function La(e){typeof e!="function"&&(e=cr(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new ge(o,this._parents)}function ur(e){return new Array(e.length)}function Ra(){return new ge(this._enter||this._groups.map(ur),this._parents)}function At(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}At.prototype={constructor:At,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 ja(e){return function(){return e}}function Va(e,t,n,o,r,i){for(var s=0,a,l=t.length,c=i.length;s<c;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new At(e,i[s]);for(;s<l;++s)(a=t[s])&&(r[s]=a)}function Oa(e,t,n,o,r,i,s){var a,l,c=new Map,u=t.length,f=i.length,d=new Array(u),h;for(a=0;a<u;++a)(l=t[a])&&(d[a]=h=s.call(l,l.__data__,a,t)+"",c.has(h)?r[a]=l:c.set(h,l));for(a=0;a<f;++a)h=s.call(e,i[a],a,i)+"",(l=c.get(h))?(o[a]=l,l.__data__=i[a],c.delete(h)):n[a]=new At(e,i[a]);for(a=0;a<u;++a)(l=t[a])&&c.get(d[a])===l&&(r[a]=l)}function Ba(e){return e.__data__}function Fa(e,t){if(!arguments.length)return Array.from(this,Ba);var n=t?Oa:Va,o=this._parents,r=this._groups;typeof e!="function"&&(e=ja(e));for(var i=r.length,s=new Array(i),a=new Array(i),l=new Array(i),c=0;c<i;++c){var u=o[c],f=r[c],d=f.length,h=Xa(e.call(u,u&&u.__data__,c,o)),g=h.length,v=a[c]=new Array(g),_=s[c]=new Array(g),x=l[c]=new Array(d);n(u,f,v,_,x,h,t);for(var b=0,p=0,m,C;b<g;++b)if(m=v[b]){for(b>=p&&(p=b+1);!(C=_[p])&&++p<g;);m._next=C||null}}return s=new ge(s,o),s._enter=a,s._exit=l,s}function Xa(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Ya(){return new ge(this._exit||this._groups.map(ur),this._parents)}function Za(e,t,n){var o=this.enter(),r=this,i=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?i.remove():n(i),o&&r?o.merge(r).order():r}function Wa(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),l=0;l<s;++l)for(var c=n[l],u=o[l],f=c.length,d=a[l]=new Array(f),h,g=0;g<f;++g)(h=c[g]||u[g])&&(d[g]=h);for(;l<r;++l)a[l]=n[l];return new ge(a,this._parents)}function Ga(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,i=o[r],s;--r>=0;)(s=o[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function qa(e){e||(e=Ua);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],a=s.length,l=r[i]=new Array(a),c,u=0;u<a;++u)(c=s[u])&&(l[u]=c);l.sort(t)}return new ge(r,this._parents).order()}function Ua(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Ka(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Qa(){return Array.from(this)}function Ja(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function ec(){let e=0;for(const t of this)++e;return e}function tc(){return!this.node()}function nc(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],i=0,s=r.length,a;i<s;++i)(a=r[i])&&e.call(a,a.__data__,i,r);return this}function oc(e){return function(){this.removeAttribute(e)}}function rc(e){return function(){this.removeAttributeNS(e.space,e.local)}}function sc(e,t){return function(){this.setAttribute(e,t)}}function ic(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function ac(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function cc(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 lc(e,t){var n=Ot(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?rc:oc:typeof t=="function"?n.local?cc:ac:n.local?ic:sc)(n,t))}function dr(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function uc(e){return function(){this.style.removeProperty(e)}}function dc(e,t,n){return function(){this.style.setProperty(e,t,n)}}function fc(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function hc(e,t,n){return arguments.length>1?this.each((t==null?uc:typeof t=="function"?fc:dc)(e,t,n??"")):Ye(this.node(),e)}function Ye(e,t){return e.style.getPropertyValue(t)||dr(e).getComputedStyle(e,null).getPropertyValue(t)}function gc(e){return function(){delete this[e]}}function pc(e,t){return function(){this[e]=t}}function mc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function yc(e,t){return arguments.length>1?this.each((t==null?gc:typeof t=="function"?mc:pc)(e,t)):this.node()[e]}function fr(e){return e.trim().split(/^|\s+/)}function Mn(e){return e.classList||new hr(e)}function hr(e){this._node=e,this._names=fr(e.getAttribute("class")||"")}hr.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 gr(e,t){for(var n=Mn(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function pr(e,t){for(var n=Mn(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function xc(e){return function(){gr(this,e)}}function wc(e){return function(){pr(this,e)}}function vc(e,t){return function(){(t.apply(this,arguments)?gr:pr)(this,e)}}function _c(e,t){var n=fr(e+"");if(arguments.length<2){for(var o=Mn(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?vc:t?xc:wc)(n,t))}function bc(){this.textContent=""}function Sc(e){return function(){this.textContent=e}}function Ec(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Cc(e){return arguments.length?this.each(e==null?bc:(typeof e=="function"?Ec:Sc)(e)):this.node().textContent}function Nc(){this.innerHTML=""}function Mc(e){return function(){this.innerHTML=e}}function Ic(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function kc(e){return arguments.length?this.each(e==null?Nc:(typeof e=="function"?Ic:Mc)(e)):this.node().innerHTML}function Ac(){this.nextSibling&&this.parentNode.appendChild(this)}function Pc(){return this.each(Ac)}function Tc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Dc(){return this.each(Tc)}function $c(e){var t=typeof e=="function"?e:ir(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function zc(){return null}function Hc(e,t){var n=typeof e=="function"?e:ir(e),o=t==null?zc:typeof t=="function"?t:Nn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function Lc(){var e=this.parentNode;e&&e.removeChild(this)}function Rc(){return this.each(Lc)}function jc(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Vc(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Oc(e){return this.select(e?Vc:jc)}function Bc(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Fc(e){return function(t){e.call(this,t,this.__data__)}}function Xc(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 Yc(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,i;n<r;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++o]=i;++o?t.length=o:delete this.__on}}}function Zc(e,t,n){return function(){var o=this.__on,r,i=Fc(t);if(o){for(var s=0,a=o.length;s<a;++s)if((r=o[s]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=t;return}}this.addEventListener(e.type,i,n),r={type:e.type,name:e.name,value:t,listener:i,options:n},o?o.push(r):this.__on=[r]}}function Wc(e,t,n){var o=Xc(e+""),r,i=o.length,s;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<i;++r)if((s=o[r]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?Zc:Yc,r=0;r<i;++r)this.each(a(o[r],t,n));return this}function mr(e,t,n){var o=dr(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 Gc(e,t){return function(){return mr(this,e,t)}}function qc(e,t){return function(){return mr(this,e,t.apply(this,arguments))}}function Uc(e,t){return this.each((typeof t=="function"?qc:Gc)(e,t))}function*Kc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length,s;r<i;++r)(s=o[r])&&(yield s)}var yr=[null];function ge(e,t){this._groups=e,this._parents=t}function ft(){return new ge([[document.documentElement]],yr)}function Qc(){return this}ge.prototype=ft.prototype={constructor:ge,select:Ea,selectAll:Ia,selectChild:Ta,selectChildren:Ha,filter:La,data:Fa,enter:Ra,exit:Ya,join:Za,merge:Wa,selection:Qc,order:Ga,sort:qa,call:Ka,nodes:Qa,node:Ja,size:ec,empty:tc,each:nc,attr:lc,style:hc,property:yc,classed:_c,text:Cc,html:kc,raise:Pc,lower:Dc,append:$c,insert:Hc,remove:Rc,clone:Oc,datum:Bc,on:Wc,dispatch:Uc,[Symbol.iterator]:Kc};function he(e){return typeof e=="string"?new ge([[document.querySelector(e)]],[document.documentElement]):new ge([[e]],yr)}function Jc(e){let t;for(;t=e.sourceEvent;)e=t;return e}function me(e,t){if(e=Jc(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 el={passive:!1},st={capture:!0,passive:!1};function on(e){e.stopImmediatePropagation()}function Xe(e){e.preventDefault(),e.stopImmediatePropagation()}function xr(e){var t=e.document.documentElement,n=he(e).on("dragstart.drag",Xe,st);"onselectstart"in t?n.on("selectstart.drag",Xe,st):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function wr(e,t){var n=e.document.documentElement,o=he(e).on("dragstart.drag",null);t&&(o.on("click.drag",Xe,st),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 yt=e=>()=>e;function hn(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,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:i,enumerable:!0,configurable:!0},x:{value:s,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}})}hn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function tl(e){return!e.ctrlKey&&!e.button}function nl(){return this.parentNode}function ol(e,t){return t??{x:e.x,y:e.y}}function rl(){return navigator.maxTouchPoints||"ontouchstart"in this}function vr(){var e=tl,t=nl,n=ol,o=rl,r={},i=Vt("start","drag","end"),s=0,a,l,c,u,f=0;function d(m){m.on("mousedown.drag",h).filter(o).on("touchstart.drag",_).on("touchmove.drag",x,el).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(m,C){if(!(u||!e.call(this,m,C))){var S=p(this,t.call(this,m,C),m,C,"mouse");S&&(he(m.view).on("mousemove.drag",g,st).on("mouseup.drag",v,st),xr(m.view),on(m),c=!1,a=m.clientX,l=m.clientY,S("start",m))}}function g(m){if(Xe(m),!c){var C=m.clientX-a,S=m.clientY-l;c=C*C+S*S>f}r.mouse("drag",m)}function v(m){he(m.view).on("mousemove.drag mouseup.drag",null),wr(m.view,c),Xe(m),r.mouse("end",m)}function _(m,C){if(e.call(this,m,C)){var S=m.changedTouches,N=t.call(this,m,C),T=S.length,P,j;for(P=0;P<T;++P)(j=p(this,N,m,C,S[P].identifier,S[P]))&&(on(m),j("start",m,S[P]))}}function x(m){var C=m.changedTouches,S=C.length,N,T;for(N=0;N<S;++N)(T=r[C[N].identifier])&&(Xe(m),T("drag",m,C[N]))}function b(m){var C=m.changedTouches,S=C.length,N,T;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),N=0;N<S;++N)(T=r[C[N].identifier])&&(on(m),T("end",m,C[N]))}function p(m,C,S,N,T,P){var j=i.copy(),I=me(P||S,C),z,L,w;if((w=n.call(m,new hn("beforestart",{sourceEvent:S,target:d,identifier:T,active:s,x:I[0],y:I[1],dx:0,dy:0,dispatch:j}),N))!=null)return z=w.x-I[0]||0,L=w.y-I[1]||0,function M(E,A,k){var D=I,$;switch(E){case"start":r[T]=M,$=s++;break;case"end":delete r[T],--s;case"drag":I=me(k||A,C),$=s;break}j.call(E,m,new hn(E,{sourceEvent:A,subject:w,target:d,identifier:T,active:$,x:I[0]+z,y:I[1]+L,dx:I[0]-D[0],dy:I[1]-D[1],dispatch:j}),N)}}return d.filter=function(m){return arguments.length?(e=typeof m=="function"?m:yt(!!m),d):e},d.container=function(m){return arguments.length?(t=typeof m=="function"?m:yt(m),d):t},d.subject=function(m){return arguments.length?(n=typeof m=="function"?m:yt(m),d):n},d.touchable=function(m){return arguments.length?(o=typeof m=="function"?m:yt(!!m),d):o},d.on=function(){var m=i.on.apply(i,arguments);return m===i?d:m},d.clickDistance=function(m){return arguments.length?(f=(m=+m)*m,d):Math.sqrt(f)},d}var ao=180/Math.PI,gn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function _r(e,t,n,o,r,i){var s,a,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(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,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*ao,skewX:Math.atan(l)*ao,scaleX:s,scaleY:a}}var xt;function sl(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?gn:_r(t.a,t.b,t.c,t.d,t.e,t.f)}function il(e){return e==null||(xt||(xt=document.createElementNS("http://www.w3.org/2000/svg","g")),xt.setAttribute("transform",e),!(e=xt.transform.baseVal.consolidate()))?gn:(e=e.matrix,_r(e.a,e.b,e.c,e.d,e.e,e.f))}function br(e,t,n,o){function r(c){return c.length?c.pop()+" ":""}function i(c,u,f,d,h,g){if(c!==f||u!==d){var v=h.push("translate(",null,t,null,n);g.push({i:v-4,x:$e(c,f)},{i:v-2,x:$e(u,d)})}else(f||d)&&h.push("translate("+f+t+d+n)}function s(c,u,f,d){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),d.push({i:f.push(r(f)+"rotate(",null,o)-2,x:$e(c,u)})):u&&f.push(r(f)+"rotate("+u+o)}function a(c,u,f,d){c!==u?d.push({i:f.push(r(f)+"skewX(",null,o)-2,x:$e(c,u)}):u&&f.push(r(f)+"skewX("+u+o)}function l(c,u,f,d,h,g){if(c!==f||u!==d){var v=h.push(r(h)+"scale(",null,",",null,")");g.push({i:v-4,x:$e(c,f)},{i:v-2,x:$e(u,d)})}else(f!==1||d!==1)&&h.push(r(h)+"scale("+f+","+d+")")}return function(c,u){var f=[],d=[];return c=e(c),u=e(u),i(c.translateX,c.translateY,u.translateX,u.translateY,f,d),s(c.rotate,u.rotate,f,d),a(c.skewX,u.skewX,f,d),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,f,d),c=u=null,function(h){for(var g=-1,v=d.length,_;++g<v;)f[(_=d[g]).i]=_.x(h);return f.join("")}}}var al=br(sl,"px, ","px)","deg)"),cl=br(il,", ",")",")"),ll=1e-12;function co(e){return((e=Math.exp(e))+1/e)/2}function ul(e){return((e=Math.exp(e))-1/e)/2}function dl(e){return((e=Math.exp(2*e))-1)/(e+1)}const Nt=(function e(t,n,o){function r(i,s){var a=i[0],l=i[1],c=i[2],u=s[0],f=s[1],d=s[2],h=u-a,g=f-l,v=h*h+g*g,_,x;if(v<ll)x=Math.log(d/c)/t,_=function(N){return[a+N*h,l+N*g,c*Math.exp(t*N*x)]};else{var b=Math.sqrt(v),p=(d*d-c*c+o*v)/(2*c*n*b),m=(d*d-c*c-o*v)/(2*d*n*b),C=Math.log(Math.sqrt(p*p+1)-p),S=Math.log(Math.sqrt(m*m+1)-m);x=(S-C)/t,_=function(N){var T=N*x,P=co(C),j=c/(n*b)*(P*dl(t*T+C)-ul(C));return[a+j*h,l+j*g,c*P/co(t*T+C)]}}return _.duration=x*1e3*t/Math.SQRT2,_}return r.rho=function(i){var s=Math.max(.001,+i),a=s*s,l=a*a;return e(s,a,l)},r})(Math.SQRT2,2,4);var Ze=0,tt=0,Je=0,Sr=1e3,Pt,nt,Tt=0,Le=0,Bt=0,it=typeof performance=="object"&&performance.now?performance:Date,Er=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function In(){return Le||(Er(fl),Le=it.now()+Bt)}function fl(){Le=0}function Dt(){this._call=this._time=this._next=null}Dt.prototype=Cr.prototype={constructor:Dt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?In():+n)+(t==null?0:+t),!this._next&&nt!==this&&(nt?nt._next=this:Pt=this,nt=this),this._call=e,this._time=n,pn()},stop:function(){this._call&&(this._call=null,this._time=1/0,pn())}};function Cr(e,t,n){var o=new Dt;return o.restart(e,t,n),o}function hl(){In(),++Ze;for(var e=Pt,t;e;)(t=Le-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ze}function lo(){Le=(Tt=it.now())+Bt,Ze=tt=0;try{hl()}finally{Ze=0,pl(),Le=0}}function gl(){var e=it.now(),t=e-Tt;t>Sr&&(Bt-=t,Tt=e)}function pl(){for(var e,t=Pt,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:Pt=n);nt=e,pn(o)}function pn(e){if(!Ze){tt&&(tt=clearTimeout(tt));var t=e-Le;t>24?(e<1/0&&(tt=setTimeout(lo,e-it.now()-Bt)),Je&&(Je=clearInterval(Je))):(Je||(Tt=it.now(),Je=setInterval(gl,Sr)),Ze=1,Er(lo))}}function uo(e,t,n){var o=new Dt;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var ml=Vt("start","end","cancel","interrupt"),yl=[],Nr=0,fo=1,mn=2,Mt=3,ho=4,yn=5,It=6;function Ft(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;xl(e,n,{name:t,index:o,group:r,on:ml,tween:yl,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Nr})}function kn(e,t){var n=we(e,t);if(n.state>Nr)throw new Error("too late; already scheduled");return n}function Se(e,t){var n=we(e,t);if(n.state>Mt)throw new Error("too late; already running");return n}function we(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function xl(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=Cr(i,0,n.time);function i(c){n.state=fo,n.timer.restart(s,n.delay,n.time),n.delay<=c&&s(c-n.delay)}function s(c){var u,f,d,h;if(n.state!==fo)return l();for(u in o)if(h=o[u],h.name===n.name){if(h.state===Mt)return uo(s);h.state===ho?(h.state=It,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[u]):+u<t&&(h.state=It,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete o[u])}if(uo(function(){n.state===Mt&&(n.state=ho,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=mn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===mn){for(n.state=Mt,r=new Array(d=n.tween.length),u=0,f=-1;u<d;++u)(h=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++f]=h);r.length=f+1}}function a(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=yn,1),f=-1,d=r.length;++f<d;)r[f].call(e,u);n.state===yn&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=It,n.timer.stop(),delete o[t];for(var c in o)return;delete e.__transition}}function kt(e,t){var n=e.__transition,o,r,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((o=n[s]).name!==t){i=!1;continue}r=o.state>mn&&o.state<yn,o.state=It,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function wl(e){return this.each(function(){kt(this,e)})}function vl(e,t){var n,o;return function(){var r=Se(this,e),i=r.tween;if(i!==n){o=n=i;for(var s=0,a=o.length;s<a;++s)if(o[s].name===t){o=o.slice(),o.splice(s,1);break}}r.tween=o}}function _l(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=Se(this,e),s=i.tween;if(s!==o){r=(o=s).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)}i.tween=r}}function bl(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=we(this.node(),n).tween,r=0,i=o.length,s;r<i;++r)if((s=o[r]).name===e)return s.value;return null}return this.each((t==null?vl:_l)(n,e,t))}function An(e,t,n){var o=e._id;return e.each(function(){var r=Se(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return we(r,o).value[t]}}function Mr(e,t){var n;return(typeof t=="number"?$e:t instanceof ro?oo:(n=ro(t))?(t=n,oo):ma)(e,t)}function Sl(e){return function(){this.removeAttribute(e)}}function El(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Cl(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttribute(e);return s===r?null:s===o?i:i=t(o=s,n)}}function Nl(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===r?null:s===o?i:i=t(o=s,n)}}function Ml(e,t,n){var o,r,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),l=a+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a)))}}function Il(e,t,n){var o,r,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),l=a+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a)))}}function kl(e,t){var n=Ot(e),o=n==="transform"?cl:Mr;return this.attrTween(e,typeof t=="function"?(n.local?Il:Ml)(n,o,An(this,"attr."+e,t)):t==null?(n.local?El:Sl)(n):(n.local?Nl:Cl)(n,o,t))}function Al(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Pl(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Tl(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Pl(e,i)),n}return r._value=t,r}function Dl(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Al(e,i)),n}return r._value=t,r}function $l(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=Ot(e);return this.tween(n,(o.local?Tl:Dl)(o,t))}function zl(e,t){return function(){kn(this,e).delay=+t.apply(this,arguments)}}function Hl(e,t){return t=+t,function(){kn(this,e).delay=t}}function Ll(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?zl:Hl)(t,e)):we(this.node(),t).delay}function Rl(e,t){return function(){Se(this,e).duration=+t.apply(this,arguments)}}function jl(e,t){return t=+t,function(){Se(this,e).duration=t}}function Vl(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Rl:jl)(t,e)):we(this.node(),t).duration}function Ol(e,t){if(typeof t!="function")throw new Error;return function(){Se(this,e).ease=t}}function Bl(e){var t=this._id;return arguments.length?this.each(Ol(t,e)):we(this.node(),t).ease}function Fl(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Se(this,e).ease=n}}function Xl(e){if(typeof e!="function")throw new Error;return this.each(Fl(this._id,e))}function Yl(e){typeof e!="function"&&(e=cr(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new Me(o,this._parents,this._name,this._id)}function Zl(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var l=t[a],c=n[a],u=l.length,f=s[a]=new Array(u),d,h=0;h<u;++h)(d=l[h]||c[h])&&(f[h]=d);for(;a<o;++a)s[a]=t[a];return new Me(s,this._parents,this._name,this._id)}function Wl(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 Gl(e,t,n){var o,r,i=Wl(t)?kn:Se;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}function ql(e,t){var n=this._id;return arguments.length<2?we(this.node(),n).on.on(e):this.each(Gl(n,e,t))}function Ul(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Kl(){return this.on("end.remove",Ul(this._id))}function Ql(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Nn(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],l=a.length,c=i[s]=new Array(l),u,f,d=0;d<l;++d)(u=a[d])&&(f=e.call(u,u.__data__,d,a))&&("__data__"in u&&(f.__data__=u.__data__),c[d]=f,Ft(c[d],t,n,d,c,we(u,n)));return new Me(i,this._parents,t,n)}function Jl(e){var t=this._name,n=this._id;typeof e!="function"&&(e=ar(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var l=o[a],c=l.length,u,f=0;f<c;++f)if(u=l[f]){for(var d=e.call(u,u.__data__,f,l),h,g=we(u,n),v=0,_=d.length;v<_;++v)(h=d[v])&&Ft(h,t,n,v,d,g);i.push(d),s.push(u)}return new Me(i,s,t,n)}var eu=ft.prototype.constructor;function tu(){return new eu(this._groups,this._parents)}function nu(e,t){var n,o,r;return function(){var i=Ye(this,e),s=(this.style.removeProperty(e),Ye(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function Ir(e){return function(){this.style.removeProperty(e)}}function ou(e,t,n){var o,r=n+"",i;return function(){var s=Ye(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function ru(e,t,n){var o,r,i;return function(){var s=Ye(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),Ye(this,e))),s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a))}}function su(e,t){var n,o,r,i="style."+t,s="end."+i,a;return function(){var l=Se(this,e),c=l.on,u=l.value[i]==null?a||(a=Ir(t)):void 0;(c!==n||r!==u)&&(o=(n=c).copy()).on(s,r=u),l.on=o}}function iu(e,t,n){var o=(e+="")=="transform"?al:Mr;return t==null?this.styleTween(e,nu(e,o)).on("end.style."+e,Ir(e)):typeof t=="function"?this.styleTween(e,ru(e,o,An(this,"style."+e,t))).each(su(this._id,e)):this.styleTween(e,ou(e,o,t),n).on("end.style."+e,null)}function au(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function cu(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&au(e,s,n)),o}return i._value=t,i}function lu(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,cu(e,t,n??""))}function uu(e){return function(){this.textContent=e}}function du(e){return function(){var t=e(this);this.textContent=t??""}}function fu(e){return this.tween("text",typeof e=="function"?du(An(this,"text",e)):uu(e==null?"":e+""))}function hu(e){return function(t){this.textContent=e.call(this,t)}}function gu(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&hu(r)),t}return o._value=e,o}function pu(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,gu(e))}function mu(){for(var e=this._name,t=this._id,n=kr(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,l,c=0;c<a;++c)if(l=s[c]){var u=we(l,t);Ft(l,e,n,c,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Me(o,this._parents,e,n)}function yu(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},l={value:function(){--r===0&&i()}};n.each(function(){var c=Se(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&&i()})}var xu=0;function Me(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function kr(){return++xu}var Ce=ft.prototype;Me.prototype={constructor:Me,select:Ql,selectAll:Jl,selectChild:Ce.selectChild,selectChildren:Ce.selectChildren,filter:Yl,merge:Zl,selection:tu,transition:mu,call:Ce.call,nodes:Ce.nodes,node:Ce.node,size:Ce.size,empty:Ce.empty,each:Ce.each,on:ql,attr:kl,attrTween:$l,style:iu,styleTween:lu,text:fu,textTween:pu,remove:Kl,tween:bl,delay:Ll,duration:Vl,ease:Bl,easeVarying:Xl,end:yu,[Symbol.iterator]:Ce[Symbol.iterator]};function wu(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var vu={time:null,delay:0,duration:250,ease:wu};function _u(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 bu(e){var t,n;e instanceof Me?(t=e._id,e=e._name):(t=kr(),(n=vu).time=In(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&Ft(l,e,t,c,s,n||_u(l,t));return new Me(o,this._parents,e,t)}ft.prototype.interrupt=wl;ft.prototype.transition=bu;const wt=e=>()=>e;function Su(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 Ne(e,t,n){this.k=e,this.x=t,this.y=n}Ne.prototype={constructor:Ne,scale:function(e){return e===1?this:new Ne(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ne(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 Xt=new Ne(1,0,0);Ar.prototype=Ne.prototype;function Ar(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Xt;return e.__zoom}function rn(e){e.stopImmediatePropagation()}function et(e){e.preventDefault(),e.stopImmediatePropagation()}function Eu(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Cu(){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 go(){return this.__zoom||Xt}function Nu(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Mu(){return navigator.maxTouchPoints||"ontouchstart"in this}function Iu(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function Pr(){var e=Eu,t=Cu,n=Iu,o=Nu,r=Mu,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Nt,c=Vt("start","zoom","end"),u,f,d,h=500,g=150,v=0,_=10;function x(w){w.property("__zoom",go).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",P).on("dblclick.zoom",j).filter(r).on("touchstart.zoom",I).on("touchmove.zoom",z).on("touchend.zoom touchcancel.zoom",L).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}x.transform=function(w,M,E,A){var k=w.selection?w.selection():w;k.property("__zoom",go),w!==k?C(w,M,E,A):k.interrupt().each(function(){S(this,arguments).event(A).start().zoom(null,typeof M=="function"?M.apply(this,arguments):M).end()})},x.scaleBy=function(w,M,E,A){x.scaleTo(w,function(){var k=this.__zoom.k,D=typeof M=="function"?M.apply(this,arguments):M;return k*D},E,A)},x.scaleTo=function(w,M,E,A){x.transform(w,function(){var k=t.apply(this,arguments),D=this.__zoom,$=E==null?m(k):typeof E=="function"?E.apply(this,arguments):E,V=D.invert($),R=typeof M=="function"?M.apply(this,arguments):M;return n(p(b(D,R),$,V),k,s)},E,A)},x.translateBy=function(w,M,E,A){x.transform(w,function(){return n(this.__zoom.translate(typeof M=="function"?M.apply(this,arguments):M,typeof E=="function"?E.apply(this,arguments):E),t.apply(this,arguments),s)},null,A)},x.translateTo=function(w,M,E,A,k){x.transform(w,function(){var D=t.apply(this,arguments),$=this.__zoom,V=A==null?m(D):typeof A=="function"?A.apply(this,arguments):A;return n(Xt.translate(V[0],V[1]).scale($.k).translate(typeof M=="function"?-M.apply(this,arguments):-M,typeof E=="function"?-E.apply(this,arguments):-E),D,s)},A,k)};function b(w,M){return M=Math.max(i[0],Math.min(i[1],M)),M===w.k?w:new Ne(M,w.x,w.y)}function p(w,M,E){var A=M[0]-E[0]*w.k,k=M[1]-E[1]*w.k;return A===w.x&&k===w.y?w:new Ne(w.k,A,k)}function m(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function C(w,M,E,A){w.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 k=this,D=arguments,$=S(k,D).event(A),V=t.apply(k,D),R=E==null?m(V):typeof E=="function"?E.apply(k,D):E,F=Math.max(V[1][0]-V[0][0],V[1][1]-V[0][1]),B=k.__zoom,G=typeof M=="function"?M.apply(k,D):M,K=l(B.invert(R).concat(F/B.k),G.invert(R).concat(F/G.k));return function(Z){if(Z===1)Z=G;else{var O=K(Z),X=F/O[2];Z=new Ne(X,R[0]-O[0]*X,R[1]-O[1]*X)}$.zoom(null,Z)}})}function S(w,M,E){return!E&&w.__zooming||new N(w,M)}function N(w,M){this.that=w,this.args=M,this.active=0,this.sourceEvent=null,this.extent=t.apply(w,M),this.taps=0}N.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,M){return this.mouse&&w!=="mouse"&&(this.mouse[1]=M.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=M.invert(this.touch0[0])),this.touch1&&w!=="touch"&&(this.touch1[1]=M.invert(this.touch1[0])),this.that.__zoom=M,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(w){var M=he(this.that).datum();c.call(w,this.that,new Su(w,{sourceEvent:this.sourceEvent,target:x,transform:this.that.__zoom,dispatch:c}),M)}};function T(w,...M){if(!e.apply(this,arguments))return;var E=S(this,M).event(w),A=this.__zoom,k=Math.max(i[0],Math.min(i[1],A.k*Math.pow(2,o.apply(this,arguments)))),D=me(w);if(E.wheel)(E.mouse[0][0]!==D[0]||E.mouse[0][1]!==D[1])&&(E.mouse[1]=A.invert(E.mouse[0]=D)),clearTimeout(E.wheel);else{if(A.k===k)return;E.mouse=[D,A.invert(D)],kt(this),E.start()}et(w),E.wheel=setTimeout($,g),E.zoom("mouse",n(p(b(A,k),E.mouse[0],E.mouse[1]),E.extent,s));function $(){E.wheel=null,E.end()}}function P(w,...M){if(d||!e.apply(this,arguments))return;var E=w.currentTarget,A=S(this,M,!0).event(w),k=he(w.view).on("mousemove.zoom",R,!0).on("mouseup.zoom",F,!0),D=me(w,E),$=w.clientX,V=w.clientY;xr(w.view),rn(w),A.mouse=[D,this.__zoom.invert(D)],kt(this),A.start();function R(B){if(et(B),!A.moved){var G=B.clientX-$,K=B.clientY-V;A.moved=G*G+K*K>v}A.event(B).zoom("mouse",n(p(A.that.__zoom,A.mouse[0]=me(B,E),A.mouse[1]),A.extent,s))}function F(B){k.on("mousemove.zoom mouseup.zoom",null),wr(B.view,A.moved),et(B),A.event(B).end()}}function j(w,...M){if(e.apply(this,arguments)){var E=this.__zoom,A=me(w.changedTouches?w.changedTouches[0]:w,this),k=E.invert(A),D=E.k*(w.shiftKey?.5:2),$=n(p(b(E,D),A,k),t.apply(this,M),s);et(w),a>0?he(this).transition().duration(a).call(C,$,A,w):he(this).call(x.transform,$,A,w)}}function I(w,...M){if(e.apply(this,arguments)){var E=w.touches,A=E.length,k=S(this,M,w.changedTouches.length===A).event(w),D,$,V,R;for(rn(w),$=0;$<A;++$)V=E[$],R=me(V,this),R=[R,this.__zoom.invert(R),V.identifier],k.touch0?!k.touch1&&k.touch0[2]!==R[2]&&(k.touch1=R,k.taps=0):(k.touch0=R,D=!0,k.taps=1+!!u);u&&(u=clearTimeout(u)),D&&(k.taps<2&&(f=R[0],u=setTimeout(function(){u=null},h)),kt(this),k.start())}}function z(w,...M){if(this.__zooming){var E=S(this,M).event(w),A=w.changedTouches,k=A.length,D,$,V,R;for(et(w),D=0;D<k;++D)$=A[D],V=me($,this),E.touch0&&E.touch0[2]===$.identifier?E.touch0[0]=V:E.touch1&&E.touch1[2]===$.identifier&&(E.touch1[0]=V);if($=E.that.__zoom,E.touch1){var F=E.touch0[0],B=E.touch0[1],G=E.touch1[0],K=E.touch1[1],Z=(Z=G[0]-F[0])*Z+(Z=G[1]-F[1])*Z,O=(O=K[0]-B[0])*O+(O=K[1]-B[1])*O;$=b($,Math.sqrt(Z/O)),V=[(F[0]+G[0])/2,(F[1]+G[1])/2],R=[(B[0]+K[0])/2,(B[1]+K[1])/2]}else if(E.touch0)V=E.touch0[0],R=E.touch0[1];else return;E.zoom("touch",n(p($,V,R),E.extent,s))}}function L(w,...M){if(this.__zooming){var E=S(this,M).event(w),A=w.changedTouches,k=A.length,D,$;for(rn(w),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),D=0;D<k;++D)$=A[D],E.touch0&&E.touch0[2]===$.identifier?delete E.touch0:E.touch1&&E.touch1[2]===$.identifier&&delete E.touch1;if(E.touch1&&!E.touch0&&(E.touch0=E.touch1,delete E.touch1),E.touch0)E.touch0[1]=this.__zoom.invert(E.touch0[0]);else if(E.end(),E.taps===2&&($=me($,this),Math.hypot(f[0]-$[0],f[1]-$[1])<_)){var V=he(this).on("dblclick.zoom");V&&V.apply(this,arguments)}}}return x.wheelDelta=function(w){return arguments.length?(o=typeof w=="function"?w:wt(+w),x):o},x.filter=function(w){return arguments.length?(e=typeof w=="function"?w:wt(!!w),x):e},x.touchable=function(w){return arguments.length?(r=typeof w=="function"?w:wt(!!w),x):r},x.extent=function(w){return arguments.length?(t=typeof w=="function"?w:wt([[+w[0][0],+w[0][1]],[+w[1][0],+w[1][1]]]),x):t},x.scaleExtent=function(w){return arguments.length?(i[0]=+w[0],i[1]=+w[1],x):[i[0],i[1]]},x.translateExtent=function(w){return arguments.length?(s[0][0]=+w[0][0],s[1][0]=+w[1][0],s[0][1]=+w[0][1],s[1][1]=+w[1][1],x):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},x.constrain=function(w){return arguments.length?(n=w,x):n},x.duration=function(w){return arguments.length?(a=+w,x):a},x.interpolate=function(w){return arguments.length?(l=w,x):l},x.on=function(){var w=c.on.apply(c,arguments);return w===c?x:w},x.clickDistance=function(w){return arguments.length?(v=(w=+w)*w,x):Math.sqrt(v)},x.tapDistance=function(w){return arguments.length?(_=+w,x):_},x}const be={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."},at=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Tr=["Enter"," ","Escape"],Dr={"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 We;(function(e){e.Strict="strict",e.Loose="loose"})(We||(We={}));var He;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(He||(He={}));var ct;(function(e){e.Partial="partial",e.Full="full"})(ct||(ct={}));const $r={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Pe;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Pe||(Pe={}));var $t;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})($t||($t={}));var Y;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Y||(Y={}));const po={[Y.Left]:Y.Right,[Y.Right]:Y.Left,[Y.Top]:Y.Bottom,[Y.Bottom]:Y.Top};function zr(e){return e===null?null:e?"valid":"invalid"}const Hr=e=>"id"in e&&"source"in e&&"target"in e,ku=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Pn=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),ht=(e,t=[0,0])=>{const{width:n,height:o}=Ie(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},Au=(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 i=typeof r=="string";let s=!t.nodeLookup&&!i?r:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(r):Pn(r)?r:t.nodeLookup.get(r.id));const a=s?zt(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Yt(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Zt(n)},gt=(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=Yt(n,zt(r)),o=!0)}),o?Zt(n):{x:0,y:0,width:0,height:0}},Tn=(e,t,[n,o,r]=[0,0,1],i=!1,s=!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:f=!0,hidden:d=!1}=c;if(s&&!f||d)continue;const h=u.width??c.width??c.initialWidth??null,g=u.height??c.height??c.initialHeight??null,v=lt(a,qe(c)),_=(h??0)*(g??0),x=i&&v>0;(!c.internals.handleBounds||x||v>=_||c.dragging)&&l.push(c)}return l},Pu=(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 Tu(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 Du({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return Promise.resolve(!0);const a=Tu(e,s),l=gt(a),c=Dn(l,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(c,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),Promise.resolve(!0)}function Lr({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},u=s.origin??o;let f=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i?.("005",be.error005());else{const h=a.measured.width,g=a.measured.height;h&&g&&(f=[[l,c],[l+h,c+g]])}else a&&Ue(s.extent)&&(f=[[s.extent[0][0]+l,s.extent[0][1]+c],[s.extent[1][0]+l,s.extent[1][1]+c]]);const d=Ue(f)?Re(t,f,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",be.error015()),{position:{x:d.x-l+(s.measured.width??0)*u[0],y:d.y-c+(s.measured.height??0)*u[1]},positionAbsolute:d}}async function $u({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(d=>d.id)),s=[];for(const d of n){if(d.deletable===!1)continue;const h=i.has(d.id),g=!h&&d.parentId&&s.find(v=>v.id===d.parentId);(h||g)&&s.push(d)}const a=new Set(t.map(d=>d.id)),l=o.filter(d=>d.deletable!==!1),u=Pu(s,l);for(const d of l)a.has(d.id)&&!u.find(g=>g.id===d.id)&&u.push(d);if(!r)return{edges:u,nodes:s};const f=await r({nodes:s,edges:u});return typeof f=="boolean"?f?{edges:u,nodes:s}:{edges:[],nodes:[]}:f}const Ge=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Re=(e={x:0,y:0},t,n)=>({x:Ge(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Ge(e.y,t[0][1],t[1][1]-(n?.height??0))});function Rr(e,t,n){const{width:o,height:r}=Ie(n),{x:i,y:s}=n.internals.positionAbsolute;return Re(e,[[i,s],[i+o,s+r]],t)}const mo=(e,t,n)=>e<t?Ge(Math.abs(e-t),1,t)/t:e>n?-Ge(Math.abs(e-n),1,t)/t:0,jr=(e,t,n=15,o=40)=>{const r=mo(e.x,o,t.width-o)*n,i=mo(e.y,o,t.height-o)*n;return[r,i]},Yt=(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)}),xn=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),Zt=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),qe=(e,t=[0,0])=>{const{x:n,y:o}=Pn(e)?e.internals.positionAbsolute:ht(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}},zt=(e,t=[0,0])=>{const{x:n,y:o}=Pn(e)?e.internals.positionAbsolute:ht(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)}},Vr=(e,t)=>Zt(Yt(xn(e),xn(t))),lt=(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)},yo=e=>ye(e.width)&&ye(e.height)&&ye(e.x)&&ye(e.y),ye=e=>!isNaN(e)&&isFinite(e),zu=(e,t)=>{},pt=(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],i=!1,s=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return i?pt(a,s):a},Ht=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Oe(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 Hu(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=Oe(e,n),r=Oe(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=Oe(e.top??e.y??0,n),r=Oe(e.bottom??e.y??0,n),i=Oe(e.left??e.x??0,t),s=Oe(e.right??e.x??0,t);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Lu(e,t,n,o,r,i){const{x:s,y:a}=Ht(e,[t,n,o]),{x:l,y:c}=Ht({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-l,f=i-c;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(f)}}const Dn=(e,t,n,o,r,i)=>{const s=Hu(i,t,n),a=(t-s.x)/e.width,l=(n-s.y)/e.height,c=Math.min(a,l),u=Ge(c,o,r),f=e.x+e.width/2,d=e.y+e.height/2,h=t/2-f*u,g=n/2-d*u,v=Lu(e,h,g,u,t,n),_={left:Math.min(v.left-s.left,0),top:Math.min(v.top-s.top,0),right:Math.min(v.right-s.right,0),bottom:Math.min(v.bottom-s.bottom,0)};return{x:h-_.left+_.right,y:g-_.top+_.bottom,zoom:u}},ut=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Ue(e){return e!=null&&e!=="parent"}function Ie(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Or(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Br(e,t={width:0,height:0},n,o,r){const i={...e},s=o.get(n);if(s){const a=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}function xo(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Ru(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function ju(e){return{...Dr,...e||{}}}function ot(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=xe(e),a=mt({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:l,y:c}=n?pt(a,t):a;return{xSnapped:l,ySnapped:c,...a}}const $n=e=>({width:e.offsetWidth,height:e.offsetHeight}),Fr=e=>e?.getRootNode?.()||window?.document,Vu=["INPUT","SELECT","TEXTAREA"];function Xr(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Vu.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Yr=e=>"clientX"in e,xe=(e,t)=>{const n=Yr(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)}},wo=(e,t,n,o,r)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:r,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...$n(s)}})};function Zr({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const l=e*.125+r*.375+s*.375+n*.125,c=t*.125+i*.375+a*.375+o*.125,u=Math.abs(l-e),f=Math.abs(c-t);return[l,c,u,f]}function vt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function vo({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case Y.Left:return[t-vt(t-o,i),n];case Y.Right:return[t+vt(o-t,i),n];case Y.Top:return[t,n-vt(n-r,i)];case Y.Bottom:return[t,n+vt(r-n,i)]}}function Wr({sourceX:e,sourceY:t,sourcePosition:n=Y.Bottom,targetX:o,targetY:r,targetPosition:i=Y.Top,curvature:s=.25}){const[a,l]=vo({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[c,u]=vo({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[f,d,h,g]=Zr({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}`,f,d,h,g]}function Gr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n<e?n+r:n-r,s=Math.abs(o-t)/2,a=o<t?o+s:o-s;return[i,a,r,s]}function Ou({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){if(i==="manual")return o;const s=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 s+a}function Bu({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=Yt(zt(e),zt(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return lt(s,Zt(i))>0}const Fu=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Xu=(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)),Yu=(e,t,n={})=>{if(!e.source||!e.target)return t;const o=n.getEdgeId||Fu;let r;return Hr(e)?r={...e}:r={...e,id:o(e)},Xu(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function qr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,a]=Gr({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}const _o={[Y.Left]:{x:-1,y:0},[Y.Right]:{x:1,y:0},[Y.Top]:{x:0,y:-1},[Y.Bottom]:{x:0,y:1}},Zu=({source:e,sourcePosition:t=Y.Bottom,target:n})=>t===Y.Left||t===Y.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},bo=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Wu({source:e,sourcePosition:t=Y.Bottom,target:n,targetPosition:o=Y.Top,center:r,offset:i,stepPosition:s}){const a=_o[t],l=_o[o],c={x:e.x+a.x*i,y:e.y+a.y*i},u={x:n.x+l.x*i,y:n.y+l.y*i},f=Zu({source:c,sourcePosition:t,target:u}),d=f.x!==0?"x":"y",h=f[d];let g=[],v,_;const x={x:0,y:0},b={x:0,y:0},[,,p,m]=Gr({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[d]*l[d]===-1){d==="x"?(v=r.x??c.x+(u.x-c.x)*s,_=r.y??(c.y+u.y)/2):(v=r.x??(c.x+u.x)/2,_=r.y??c.y+(u.y-c.y)*s);const S=[{x:v,y:c.y},{x:v,y:u.y}],N=[{x:c.x,y:_},{x:u.x,y:_}];a[d]===h?g=d==="x"?S:N:g=d==="x"?N:S}else{const S=[{x:c.x,y:u.y}],N=[{x:u.x,y:c.y}];if(d==="x"?g=a.x===h?N:S:g=a.y===h?S:N,t===o){const z=Math.abs(e[d]-n[d]);if(z<=i){const L=Math.min(i-1,i-z);a[d]===h?x[d]=(c[d]>e[d]?-1:1)*L:b[d]=(u[d]>n[d]?-1:1)*L}}if(t!==o){const z=d==="x"?"y":"x",L=a[d]===l[z],w=c[z]>u[z],M=c[z]<u[z];(a[d]===1&&(!L&&w||L&&M)||a[d]!==1&&(!L&&M||L&&w))&&(g=d==="x"?S:N)}const T={x:c.x+x.x,y:c.y+x.y},P={x:u.x+b.x,y:u.y+b.y},j=Math.max(Math.abs(T.x-g[0].x),Math.abs(P.x-g[0].x)),I=Math.max(Math.abs(T.y-g[0].y),Math.abs(P.y-g[0].y));j>=I?(v=(T.x+P.x)/2,_=g[0].y):(v=g[0].x,_=(T.y+P.y)/2)}return[[e,{x:c.x+x.x,y:c.y+x.y},...g,{x:u.x+b.x,y:u.y+b.y},n],v,_,p,m]}function Gu(e,t,n,o){const r=Math.min(bo(e,t)/2,bo(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const c=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${i+r*c},${s}Q ${i},${s} ${i},${s+r*u}`}const a=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${i},${s+r*l}Q ${i},${s} ${i+r*a},${s}`}function wn({sourceX:e,sourceY:t,sourcePosition:n=Y.Bottom,targetX:o,targetY:r,targetPosition:i=Y.Top,borderRadius:s=5,centerX:a,centerY:l,offset:c=20,stepPosition:u=.5}){const[f,d,h,g,v]=Wu({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:l},offset:c,stepPosition:u});return[f.reduce((x,b,p)=>{let m="";return p>0&&p<f.length-1?m=Gu(f[p-1],b,f[p+1],s):m=`${p===0?"M":"L"}${b.x} ${b.y}`,x+=m,x},""),d,h,g,v]}function So(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function qu(e){const{sourceNode:t,targetNode:n}=e;if(!So(t)||!So(n))return null;const o=t.internals.handleBounds||Eo(t.handles),r=n.internals.handleBounds||Eo(n.handles),i=Co(o?.source??[],e.sourceHandle),s=Co(e.connectionMode===We.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",be.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=i?.position||Y.Bottom,l=s?.position||Y.Top,c=je(t,i,a),u=je(n,s,l);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:l}}function Eo(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 je(e,t,n=Y.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??Ie(e);if(o)return{x:r+s/2,y:i+a/2};switch(t?.position??n){case Y.Top:return{x:r+s/2,y:i};case Y.Right:return{x:r+s,y:i+a/2};case Y.Bottom:return{x:r+s/2,y:i+a};case Y.Left:return{x:r,y:i+a/2}}}function Co(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function vn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function Uu(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((s,a)=>([a.markerStart||o,a.markerEnd||r].forEach(l=>{if(l&&typeof l=="object"){const c=vn(l,t);i.has(c)||(s.push({id:c,color:l.color||n,...l}),i.add(c))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const Ur=1e3,Ku=10,zn={nodeOrigin:[0,0],nodeExtent:at,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Qu={...zn,checkEquality:!0};function Hn(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function Ju(e,t,n){const o=Hn(zn,n);for(const r of e.values())if(r.parentId)Rn(r,e,t,o);else{const i=ht(r,o.nodeOrigin),s=Ue(r.extent)?r.extent:o.nodeExtent,a=Re(i,s,Ie(r));r.internals.positionAbsolute=a}}function ed(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const i={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(i):r.type==="target"&&o.push(i)}return{source:n,target:o}}function Ln(e){return e==="manual"}function _n(e,t,n,o={}){const r=Hn(Qu,o),i={i:0},s=new Map(t),a=r?.elevateNodesOnSelect&&!Ln(r.zIndexMode)?Ur:0;let l=e.length>0;t.clear(),n.clear();for(const c of e){let u=s.get(c.id);if(r.checkEquality&&c===u?.internals.userNode)t.set(c.id,u);else{const f=ht(c,r.nodeOrigin),d=Ue(c.extent)?c.extent:r.nodeExtent,h=Re(f,d,Ie(c));u={...r.defaults,...c,measured:{width:c.measured?.width,height:c.measured?.height},internals:{positionAbsolute:h,handleBounds:ed(c,u),z:Kr(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&&Rn(u,t,n,o,i)}return l}function td(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 Rn(e,t,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:l}=Hn(zn,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}td(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*Ku),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);const f=i&&!Ln(l)?Ur:0,{x:d,y:h,z:g}=nd(e,u,s,a,f,l),{positionAbsolute:v}=e.internals,_=d!==v.x||h!==v.y;(_||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:_?{x:d,y:h}:v,z:g}})}function Kr(e,t,n){const o=ye(e.zIndex)?e.zIndex:0;return Ln(n)?o:o+(e.selected?t:0)}function nd(e,t,n,o,r,i){const{x:s,y:a}=t.internals.positionAbsolute,l=Ie(e),c=ht(e,n),u=Ue(e.extent)?Re(c,e.extent,l):c;let f=Re({x:s+u.x,y:a+u.y},o,l);e.extent==="parent"&&(f=Rr(f,l,t));const d=Kr(e,r,i),h=t.internals.z??0;return{x:f.x,y:f.y,z:h>=d?h+1:d}}function jn(e,t,n,o=[0,0]){const r=[],i=new Map;for(const s of e){const a=t.get(s.parentId);if(!a)continue;const l=i.get(s.parentId)?.expandedRect??qe(a),c=Vr(l,s.rect);i.set(s.parentId,{expandedRect:c,parent:a})}return i.size>0&&i.forEach(({expandedRect:s,parent:a},l)=>{const c=a.internals.positionAbsolute,u=Ie(a),f=a.origin??o,d=s.x<c.x?Math.round(Math.abs(c.x-s.x)):0,h=s.y<c.y?Math.round(Math.abs(c.y-s.y)):0,g=Math.max(u.width,Math.round(s.width)),v=Math.max(u.height,Math.round(s.height)),_=(g-u.width)*f[0],x=(v-u.height)*f[1];(d>0||h>0||_||x)&&(r.push({id:l,type:"position",position:{x:a.position.x-d+_,y:a.position.y-h+x}}),n.get(l)?.forEach(b=>{e.some(p=>p.id===b.id)||r.push({id:b.id,type:"position",position:{x:b.position.x+d,y:b.position.y+h}})})),(u.width<s.width||u.height<s.height||d||h)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:g+(d?f[0]*d-_:0),height:v+(h?f[1]*h-x:0)}})}),r}function od(e,t,n,o,r,i,s){const a=o?.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const c=[],u=window.getComputedStyle(a),{m22:f}=new window.DOMMatrixReadOnly(u.transform),d=[];for(const h of e.values()){const g=t.get(h.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),l=!0;continue}const v=$n(h.nodeElement),_=g.measured.width!==v.width||g.measured.height!==v.height;if(!!(v.width&&v.height&&(_||!g.internals.handleBounds||h.force))){const b=h.nodeElement.getBoundingClientRect(),p=Ue(g.extent)?g.extent:i;let{positionAbsolute:m}=g.internals;g.parentId&&g.extent==="parent"?m=Rr(m,v,t.get(g.parentId)):p&&(m=Re(m,p,v));const C={...g,measured:v,internals:{...g.internals,positionAbsolute:m,handleBounds:{source:wo("source",h.nodeElement,b,f,g.id),target:wo("target",h.nodeElement,b,f,g.id)}}};t.set(g.id,C),g.parentId&&Rn(C,t,n,{nodeOrigin:r,zIndexMode:s}),l=!0,_&&(c.push({id:g.id,type:"dimensions",dimensions:v}),g.expandParent&&g.parentId&&d.push({id:g.id,parentId:g.parentId,rect:qe(C,r)}))}}if(d.length>0){const h=jn(d,t,n,r);c.push(...h)}return{changes:c,updatedInternals:l}}async function rd({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o),a=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(a)}function No(e,t,n,o,r,i){let s=r;const a=o.get(s)||new Map;o.set(s,a.set(n,t)),s=`${r}-${e}`;const l=o.get(s)||new Map;if(o.set(s,l.set(n,t)),i){s=`${r}-${e}-${i}`;const c=o.get(s)||new Map;o.set(s,c.set(n,t))}}function Qr(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,l={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},c=`${r}-${s}--${i}-${a}`,u=`${i}-${a}--${r}-${s}`;No("source",l,u,e,r,s),No("target",l,c,e,i,a),t.set(o.id,o)}}function Jr(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Jr(n,t):!1}function Mo(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 sd(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!Jr(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const a=e.get(i);a&&r.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function sn({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[s,a]of t){const l=n.get(s)?.internals.userNode;l&&r.push({...l,position:a.position,dragging:o})}if(!e)return[r[0],r];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function id({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},s=pt(i,t);return{x:s.x-i.x,y:s.y-i.y}}function ad({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,l=!1,c={x:0,y:0},u=null,f=!1,d=null,h=!1,g=!1,v=null;function _({noDragClassName:b,handleSelector:p,domNode:m,isSelectable:C,nodeId:S,nodeClickDistance:N=0}){d=he(m);function T({x:z,y:L}){const{nodeLookup:w,nodeExtent:M,snapGrid:E,snapToGrid:A,nodeOrigin:k,onNodeDrag:D,onSelectionDrag:$,onError:V,updateNodePositions:R}=t();i={x:z,y:L};let F=!1;const B=a.size>1,G=B&&M?xn(gt(a)):null,K=B&&A?id({dragItems:a,snapGrid:E,x:z,y:L}):null;for(const[Z,O]of a){if(!w.has(Z))continue;let X={x:z-O.distance.x,y:L-O.distance.y};A&&(X=K?{x:Math.round(X.x+K.x),y:Math.round(X.y+K.y)}:pt(X,E));let Q=null;if(B&&M&&!O.extent&&G){const{positionAbsolute:q}=O.internals,J=q.x-G.x+M[0][0],ne=q.x+O.measured.width-G.x2+M[1][0],te=q.y-G.y+M[0][1],se=q.y+O.measured.height-G.y2+M[1][1];Q=[[J,te],[ne,se]]}const{position:U,positionAbsolute:W}=Lr({nodeId:Z,nextPosition:X,nodeLookup:w,nodeExtent:Q||M,nodeOrigin:k,onError:V});F=F||O.position.x!==U.x||O.position.y!==U.y,O.position=U,O.internals.positionAbsolute=W}if(g=g||F,!!F&&(R(a,!0),v&&(o||D||!S&&$))){const[Z,O]=sn({nodeId:S,dragItems:a,nodeLookup:w});o?.(v,a,Z,O),D?.(v,Z,O),S||$?.(v,O)}}async function P(){if(!u)return;const{transform:z,panBy:L,autoPanSpeed:w,autoPanOnNodeDrag:M}=t();if(!M){l=!1,cancelAnimationFrame(s);return}const[E,A]=jr(c,u,w);(E!==0||A!==0)&&(i.x=(i.x??0)-E/z[2],i.y=(i.y??0)-A/z[2],await L({x:E,y:A})&&T(i)),s=requestAnimationFrame(P)}function j(z){const{nodeLookup:L,multiSelectionActive:w,nodesDraggable:M,transform:E,snapGrid:A,snapToGrid:k,selectNodesOnDrag:D,onNodeDragStart:$,onSelectionDragStart:V,unselectNodesAndEdges:R}=t();f=!0,(!D||!C)&&!w&&S&&(L.get(S)?.selected||R()),C&&D&&S&&e?.(S);const F=ot(z.sourceEvent,{transform:E,snapGrid:A,snapToGrid:k,containerBounds:u});if(i=F,a=sd(L,M,F,S),a.size>0&&(n||$||!S&&V)){const[B,G]=sn({nodeId:S,dragItems:a,nodeLookup:L});n?.(z.sourceEvent,a,B,G),$?.(z.sourceEvent,B,G),S||V?.(z.sourceEvent,G)}}const I=vr().clickDistance(N).on("start",z=>{const{domNode:L,nodeDragThreshold:w,transform:M,snapGrid:E,snapToGrid:A}=t();u=L?.getBoundingClientRect()||null,h=!1,g=!1,v=z.sourceEvent,w===0&&j(z),i=ot(z.sourceEvent,{transform:M,snapGrid:E,snapToGrid:A,containerBounds:u}),c=xe(z.sourceEvent,u)}).on("drag",z=>{const{autoPanOnNodeDrag:L,transform:w,snapGrid:M,snapToGrid:E,nodeDragThreshold:A,nodeLookup:k}=t(),D=ot(z.sourceEvent,{transform:w,snapGrid:M,snapToGrid:E,containerBounds:u});if(v=z.sourceEvent,(z.sourceEvent.type==="touchmove"&&z.sourceEvent.touches.length>1||S&&!k.has(S))&&(h=!0),!h){if(!l&&L&&f&&(l=!0,P()),!f){const $=xe(z.sourceEvent,u),V=$.x-c.x,R=$.y-c.y;Math.sqrt(V*V+R*R)>A&&j(z)}(i.x!==D.xSnapped||i.y!==D.ySnapped)&&a&&f&&(c=xe(z.sourceEvent,u),T(D))}}).on("end",z=>{if(!(!f||h)&&(l=!1,f=!1,cancelAnimationFrame(s),a.size>0)){const{nodeLookup:L,updateNodePositions:w,onNodeDragStop:M,onSelectionDragStop:E}=t();if(g&&(w(a,!1),g=!1),r||M||!S&&E){const[A,k]=sn({nodeId:S,dragItems:a,nodeLookup:L,dragging:!1});r?.(z.sourceEvent,a,A,k),M?.(z.sourceEvent,A,k),S||E?.(z.sourceEvent,k)}}}).filter(z=>{const L=z.target;return!z.button&&(!b||!Mo(L,`.${b}`,m))&&(!p||Mo(L,p,m))});d.call(I)}function x(){d?.on(".drag",null)}return{update:_,destroy:x}}function cd(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())lt(r,qe(i))>0&&o.push(i);return o}const ld=250;function ud(e,t,n,o){let r=[],i=1/0;const s=cd(e,n,t+ld);for(const a of s){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:f}=je(a,c,c.position,!0),d=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(f-e.y,2));d>t||(d<i?(r=[{...c,x:u,y:f}],i=d):d===i&&r.push({...c,x:u,y:f}))}}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 es(e,t,n,o,r,i=!1){const s=o.get(e);if(!s)return null;const a=r==="strict"?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],l=(n?a?.find(c=>c.id===n):a?.[0])??null;return l&&i?{...l,...je(s,l,l.position,!0)}:l}function ts(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function dd(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const ns=()=>!0;function fd(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:u,flowId:f,panBy:d,cancelConnection:h,onConnectStart:g,onConnect:v,onConnectEnd:_,isValidConnection:x=ns,onReconnectEnd:b,updateConnection:p,getTransform:m,getFromHandle:C,autoPanSpeed:S,dragThreshold:N=1,handleDomNode:T}){const P=Fr(e.target);let j=0,I;const{x:z,y:L}=xe(e),w=ts(i,T),M=a?.getBoundingClientRect();let E=!1;if(!M||!w)return;const A=es(r,w,o,l,t);if(!A)return;let k=xe(e,M),D=!1,$=null,V=!1,R=null;function F(){if(!u||!M)return;const[U,W]=jr(k,M,S);d({x:U,y:W}),j=requestAnimationFrame(F)}const B={...A,nodeId:r,type:w,position:A.position},G=l.get(r);let Z={inProgress:!0,isValid:null,from:je(G,B,Y.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:G,to:k,toHandle:null,toPosition:po[B.position],toNode:null,pointer:k};function O(){E=!0,p(Z),g?.(e,{nodeId:r,handleId:o,handleType:w})}N===0&&O();function X(U){if(!E){const{x:se,y:le}=xe(U),ce=se-z,de=le-L;if(!(ce*ce+de*de>N*N))return;O()}if(!C()||!B){Q(U);return}const W=m();k=xe(U,M),I=ud(mt(k,W,!1,[1,1]),n,l,B),D||(F(),D=!0);const q=os(U,{handle:I,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:x,doc:P,lib:c,flowId:f,nodeLookup:l});R=q.handleDomNode,$=q.connection,V=dd(!!I,q.isValid);const J=l.get(r),ne=J?je(J,B,Y.Left,!0):Z.from,te={...Z,from:ne,isValid:V,to:q.toHandle&&V?Ht({x:q.toHandle.x,y:q.toHandle.y},W):k,toHandle:q.toHandle,toPosition:V&&q.toHandle?q.toHandle.position:po[B.position],toNode:q.toHandle?l.get(q.toHandle.nodeId):null,pointer:k};p(te),Z=te}function Q(U){if(!("touches"in U&&U.touches.length>0)){if(E){(I||R)&&$&&V&&v?.($);const{inProgress:W,...q}=Z,J={...q,toPosition:Z.toHandle?Z.toPosition:null};_?.(U,J),i&&b?.(U,J)}h(),cancelAnimationFrame(j),D=!1,V=!1,$=null,R=null,P.removeEventListener("mousemove",X),P.removeEventListener("mouseup",Q),P.removeEventListener("touchmove",X),P.removeEventListener("touchend",Q)}}P.addEventListener("mousemove",X),P.addEventListener("mouseup",Q),P.addEventListener("touchmove",X),P.addEventListener("touchend",Q)}function os(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:l,isValidConnection:c=ns,nodeLookup:u}){const f=i==="target",d=t?s.querySelector(`.${a}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:g}=xe(e),v=s.elementFromPoint(h,g),_=v?.classList.contains(`${a}-flow__handle`)?v:d,x={handleDomNode:_,isValid:!1,connection:null,toHandle:null};if(_){const b=ts(void 0,_),p=_.getAttribute("data-nodeid"),m=_.getAttribute("data-handleid"),C=_.classList.contains("connectable"),S=_.classList.contains("connectableend");if(!p||!b)return x;const N={source:f?p:o,sourceHandle:f?m:r,target:f?o:p,targetHandle:f?r:m};x.connection=N;const P=C&&S&&(n===We.Strict?f&&b==="source"||!f&&b==="target":p!==o||m!==r);x.isValid=P&&c(N),x.toHandle=es(p,b,m,u,n,!0)}return x}const bn={onPointerDown:fd,isValid:os};function hd({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=he(e);function i({translateExtent:a,width:l,height:c,zoomStep:u=1,pannable:f=!0,zoomable:d=!0,inversePan:h=!1}){const g=p=>{if(p.sourceEvent.type!=="wheel"||!t)return;const m=n(),C=p.sourceEvent.ctrlKey&&ut()?10:1,S=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*u,N=m[2]*Math.pow(2,S*C);t.scaleTo(N)};let v=[0,0];const _=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(v=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},x=p=>{const m=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;const C=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],S=[C[0]-v[0],C[1]-v[1]];v=C;const N=o()*Math.max(m[2],Math.log(m[2]))*(h?-1:1),T={x:m[0]-S[0]*N,y:m[1]-S[1]*N},P=[[0,0],[l,c]];t.setViewportConstrained({x:T.x,y:T.y,zoom:m[2]},P,a)},b=Pr().on("start",_).on("zoom",f?x:null).on("zoom.wheel",d?g:null);r.call(b,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:me}}const Wt=e=>({x:e.x,y:e.y,zoom:e.k}),an=({x:e,y:t,zoom:n})=>Xt.translate(e,t).scale(n),Be=(e,t)=>e.target.closest(`.${t}`),rs=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),gd=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,cn=(e,t=0,n=gd,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},ss=e=>{const t=e.ctrlKey&&ut()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function pd({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return u=>{if(Be(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(u.ctrlKey&&s){const _=me(u),x=ss(u),b=f*Math.pow(2,x);o.scaleTo(n,b,_,u);return}const d=u.deltaMode===1?20:1;let h=r===He.Vertical?0:u.deltaX*d,g=r===He.Horizontal?0:u.deltaY*d;!ut()&&u.shiftKey&&r!==He.Vertical&&(h=u.deltaY*d,g=0),o.translateBy(n,-(h/f)*i,-(g/f)*i,{internal:!0});const v=Wt(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(l?.(u,v),e.panScrollTimeout=setTimeout(()=>{c?.(u,v),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a?.(u,v))}}function md({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,a=Be(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function yd({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=Wt(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 xd({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&rs(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,Wt(i.transform))}}function wd({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&rs(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const a=Wt(s.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,a)},n?150:0)}}}function vd({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:l,lib:c,connectionInProgress:u}){return f=>{const d=e||t,h=n&&f.ctrlKey,g=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(Be(f,`${c}-flow__node`)||Be(f,`${c}-flow__edge`)))return!0;if(!o&&!d&&!r&&!i&&!n||s||u&&!g||Be(f,a)&&g||Be(f,l)&&(!g||r&&g&&!e)||!n&&f.ctrlKey&&g)return!1;if(!n&&f.type==="touchstart"&&f.touches?.length>1)return f.preventDefault(),!1;if(!d&&!r&&!h&&g||!o&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(o)&&!o.includes(f.button)&&f.type==="mousedown")return!1;const v=Array.isArray(o)&&o.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||g)&&v}}function _d({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:l}){const c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),f=Pr().scaleExtent([t,n]).translateExtent(o),d=he(e).call(f);b({x:r.x,y:r.y,zoom:Ge(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);const h=d.on("wheel.zoom"),g=d.on("dblclick.zoom");f.wheelDelta(ss);function v(I,z){return d?new Promise(L=>{f?.interpolate(z?.interpolate==="linear"?tn:Nt).transform(cn(d,z?.duration,z?.ease,()=>L(!0)),I)}):Promise.resolve(!1)}function _({noWheelClassName:I,noPanClassName:z,onPaneContextMenu:L,userSelectionActive:w,panOnScroll:M,panOnDrag:E,panOnScrollMode:A,panOnScrollSpeed:k,preventScrolling:D,zoomOnPinch:$,zoomOnScroll:V,zoomOnDoubleClick:R,zoomActivationKeyPressed:F,lib:B,onTransformChange:G,connectionInProgress:K,paneClickDistance:Z,selectionOnDrag:O}){w&&!c.isZoomingOrPanning&&x();const X=M&&!F&&!w;f.clickDistance(O?1/0:!ye(Z)||Z<0?0:Z);const Q=X?pd({zoomPanValues:c,noWheelClassName:I,d3Selection:d,d3Zoom:f,panOnScrollMode:A,panOnScrollSpeed:k,zoomOnPinch:$,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):md({noWheelClassName:I,preventScrolling:D,d3ZoomHandler:h});if(d.on("wheel.zoom",Q,{passive:!1}),!w){const W=yd({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:s});f.on("start",W);const q=xd({zoomPanValues:c,panOnDrag:E,onPaneContextMenu:!!L,onPanZoom:i,onTransformChange:G});f.on("zoom",q);const J=wd({zoomPanValues:c,panOnDrag:E,panOnScroll:M,onPaneContextMenu:L,onPanZoomEnd:a,onDraggingChange:l});f.on("end",J)}const U=vd({zoomActivationKeyPressed:F,panOnDrag:E,zoomOnScroll:V,panOnScroll:M,zoomOnDoubleClick:R,zoomOnPinch:$,userSelectionActive:w,noPanClassName:z,noWheelClassName:I,lib:B,connectionInProgress:K});f.filter(U),R?d.on("dblclick.zoom",g):d.on("dblclick.zoom",null)}function x(){f.on("zoom",null)}async function b(I,z,L){const w=an(I),M=f?.constrain()(w,z,L);return M&&await v(M),new Promise(E=>E(M))}async function p(I,z){const L=an(I);return await v(L,z),new Promise(w=>w(L))}function m(I){if(d){const z=an(I),L=d.property("__zoom");(L.k!==I.zoom||L.x!==I.x||L.y!==I.y)&&f?.transform(d,z,null,{sync:!0})}}function C(){const I=d?Ar(d.node()):{x:0,y:0,k:1};return{x:I.x,y:I.y,zoom:I.k}}function S(I,z){return d?new Promise(L=>{f?.interpolate(z?.interpolate==="linear"?tn:Nt).scaleTo(cn(d,z?.duration,z?.ease,()=>L(!0)),I)}):Promise.resolve(!1)}function N(I,z){return d?new Promise(L=>{f?.interpolate(z?.interpolate==="linear"?tn:Nt).scaleBy(cn(d,z?.duration,z?.ease,()=>L(!0)),I)}):Promise.resolve(!1)}function T(I){f?.scaleExtent(I)}function P(I){f?.translateExtent(I)}function j(I){const z=!ye(I)||I<0?0:I;f?.clickDistance(z)}return{update:_,destroy:x,setViewport:p,setViewportConstrained:b,getViewport:C,scaleTo:S,scaleBy:N,setScaleExtent:T,setTranslateExtent:P,syncViewport:m,setClickDistance:j}}var Ke;(function(e){e.Line="line",e.Handle="handle"})(Ke||(Ke={}));function bd({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,a=n-o,l=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(l[0]=l[0]*-1),a&&i&&(l[1]=l[1]*-1),l}function Io(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 ke(e,t){return Math.max(0,t-e)}function Ae(e,t){return Math.max(0,e-t)}function _t(e,t,n){return Math.max(0,t-e,e-n)}function ko(e,t){return e?!t:t}function Sd(e,t,n,o,r,i,s,a){let{affectsX:l,affectsY:c}=t;const{isHorizontal:u,isVertical:f}=t,d=u&&f,{xSnapped:h,ySnapped:g}=n,{minWidth:v,maxWidth:_,minHeight:x,maxHeight:b}=o,{x:p,y:m,width:C,height:S,aspectRatio:N}=e;let T=Math.floor(u?h-e.pointerX:0),P=Math.floor(f?g-e.pointerY:0);const j=C+(l?-T:T),I=S+(c?-P:P),z=-i[0]*C,L=-i[1]*S;let w=_t(j,v,_),M=_t(I,x,b);if(s){let k=0,D=0;l&&T<0?k=ke(p+T+z,s[0][0]):!l&&T>0&&(k=Ae(p+j+z,s[1][0])),c&&P<0?D=ke(m+P+L,s[0][1]):!c&&P>0&&(D=Ae(m+I+L,s[1][1])),w=Math.max(w,k),M=Math.max(M,D)}if(a){let k=0,D=0;l&&T>0?k=Ae(p+T,a[0][0]):!l&&T<0&&(k=ke(p+j,a[1][0])),c&&P>0?D=Ae(m+P,a[0][1]):!c&&P<0&&(D=ke(m+I,a[1][1])),w=Math.max(w,k),M=Math.max(M,D)}if(r){if(u){const k=_t(j/N,x,b)*N;if(w=Math.max(w,k),s){let D=0;!l&&!c||l&&!c&&d?D=Ae(m+L+j/N,s[1][1])*N:D=ke(m+L+(l?T:-T)/N,s[0][1])*N,w=Math.max(w,D)}if(a){let D=0;!l&&!c||l&&!c&&d?D=ke(m+j/N,a[1][1])*N:D=Ae(m+(l?T:-T)/N,a[0][1])*N,w=Math.max(w,D)}}if(f){const k=_t(I*N,v,_)/N;if(M=Math.max(M,k),s){let D=0;!l&&!c||c&&!l&&d?D=Ae(p+I*N+z,s[1][0])/N:D=ke(p+(c?P:-P)*N+z,s[0][0])/N,M=Math.max(M,D)}if(a){let D=0;!l&&!c||c&&!l&&d?D=ke(p+I*N,a[1][0])/N:D=Ae(p+(c?P:-P)*N,a[0][0])/N,M=Math.max(M,D)}}}P=P+(P<0?M:-M),T=T+(T<0?w:-w),r&&(d?j>I*N?P=(ko(l,c)?-T:T)/N:T=(ko(l,c)?-P:P)*N:u?(P=T/N,c=l):(T=P*N,l=c));const E=l?p+T:p,A=c?m+P:m;return{width:C+(l?-T:T),height:S+(c?-P:P),x:i[0]*T*(l?-1:1)+E,y:i[1]*P*(c?-1:1)+A}}const is={width:0,height:0,x:0,y:0},Ed={...is,pointerX:0,pointerY:0,aspectRatio:1};function Cd(e){return[[0,0],[e.measured.width,e.measured.height]]}function Nd(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,l=n[1]*s;return[[o-a,r-l],[o+i-a,r+s-l]]}function Md({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=he(e);let s={controlDirection:Io("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:f,resizeDirection:d,onResizeStart:h,onResize:g,onResizeEnd:v,shouldResize:_}){let x={...is},b={...Ed};s={boundaries:u,resizeDirection:d,keepAspectRatio:f,controlDirection:Io(c)};let p,m=null,C=[],S,N,T,P=!1;const j=vr().on("start",I=>{const{nodeLookup:z,transform:L,snapGrid:w,snapToGrid:M,nodeOrigin:E,paneDomNode:A}=n();if(p=z.get(t),!p)return;m=A?.getBoundingClientRect()??null;const{xSnapped:k,ySnapped:D}=ot(I.sourceEvent,{transform:L,snapGrid:w,snapToGrid:M,containerBounds:m});x={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},b={...x,pointerX:k,pointerY:D,aspectRatio:x.width/x.height},S=void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(S=z.get(p.parentId),N=S&&p.extent==="parent"?Cd(S):void 0),C=[],T=void 0;for(const[$,V]of z)if(V.parentId===t&&(C.push({id:$,position:{...V.position},extent:V.extent}),V.extent==="parent"||V.expandParent)){const R=Nd(V,p,V.origin??E);T?T=[[Math.min(R[0][0],T[0][0]),Math.min(R[0][1],T[0][1])],[Math.max(R[1][0],T[1][0]),Math.max(R[1][1],T[1][1])]]:T=R}h?.(I,{...x})}).on("drag",I=>{const{transform:z,snapGrid:L,snapToGrid:w,nodeOrigin:M}=n(),E=ot(I.sourceEvent,{transform:z,snapGrid:L,snapToGrid:w,containerBounds:m}),A=[];if(!p)return;const{x:k,y:D,width:$,height:V}=x,R={},F=p.origin??M,{width:B,height:G,x:K,y:Z}=Sd(b,s.controlDirection,E,s.boundaries,s.keepAspectRatio,F,N,T),O=B!==$,X=G!==V,Q=K!==k&&O,U=Z!==D&&X;if(!Q&&!U&&!O&&!X)return;if((Q||U||F[0]===1||F[1]===1)&&(R.x=Q?K:x.x,R.y=U?Z:x.y,x.x=R.x,x.y=R.y,C.length>0)){const ne=K-k,te=Z-D;for(const se of C)se.position={x:se.position.x-ne+F[0]*(B-$),y:se.position.y-te+F[1]*(G-V)},A.push(se)}if((O||X)&&(R.width=O&&(!s.resizeDirection||s.resizeDirection==="horizontal")?B:x.width,R.height=X&&(!s.resizeDirection||s.resizeDirection==="vertical")?G: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,b.x=b.x-(R.x-ne));const te=F[1]*(R.height??0);R.y&&R.y<te&&(x.y=te,b.y=b.y-(R.y-te))}const W=bd({width:x.width,prevWidth:$,height:x.height,prevHeight:V,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),q={...x,direction:W};_?.(I,q)!==!1&&(P=!0,g?.(I,q),o(R,A))}).on("end",I=>{P&&(v?.(I,{...x}),r?.({...x}),P=!1)});i.call(j)}function l(){i.on(".drag",null)}return{update:a,destroy:l}}const Id={},Ao=e=>{let t;const n=new Set,o=(u,f)=>{const d=typeof u=="function"?u(t):u;if(!Object.is(d,t)){const h=t;t=f??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(g=>g(t,h))}},r=()=>t,l={setState:o,getState:r,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(Id?"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},kd=e=>e?Ao(e):Ao,{useDebugValue:Ad}=Wi,{useSyncExternalStoreWithSelector:Pd}=Zi,Td=e=>e;function as(e,t=Td,n){const o=Pd(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Ad(o),o}const Po=(e,t)=>{const n=kd(e),o=(r,i=t)=>as(n,r,i);return Object.assign(o,n),o},Dd=(e,t)=>e?Po(e,t):Po;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 Gt=H.createContext(null),$d=Gt.Provider,cs=be.error001();function ee(e,t){const n=H.useContext(Gt);if(n===null)throw new Error(cs);return as(n,e,t)}function re(){const e=H.useContext(Gt);if(e===null)throw new Error(cs);return H.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const To={display:"none"},zd={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},ls="react-flow__node-desc",us="react-flow__edge-desc",Hd="react-flow__aria-live",Ld=e=>e.ariaLiveMessage,Rd=e=>e.ariaLabelConfig;function jd({rfId:e}){const t=ee(Ld);return y.jsx("div",{id:`${Hd}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:zd,children:t})}function Vd({rfId:e,disableKeyboardA11y:t}){const n=ee(Rd);return y.jsxs(y.Fragment,{children:[y.jsx("div",{id:`${ls}-${e}`,style:To,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),y.jsx("div",{id:`${us}-${e}`,style:To,children:n["edge.a11yDescription.default"]}),!t&&y.jsx(jd,{rfId:e})]})}const qt=H.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return y.jsx("div",{className:ae(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});qt.displayName="Panel";function Od({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:y.jsx(qt,{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:y.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Bd=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}},bt=e=>e.id;function Fd(e,t){return oe(e.selectedNodes.map(bt),t.selectedNodes.map(bt))&&oe(e.selectedEdges.map(bt),t.selectedEdges.map(bt))}function Xd({onSelectionChange:e}){const t=re(),{selectedNodes:n,selectedEdges:o}=ee(Bd,Fd);return H.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}const Yd=e=>!!e.onSelectionChangeHandlers;function Zd({onSelectionChange:e}){const t=ee(Yd);return e||t?y.jsx(Xd,{onSelectionChange:e}):null}const ds=[0,0],Wd={x:0,y:0,zoom:1},Gd=["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"],Do=[...Gd,"rfId"],qd=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}),$o={translateExtent:at,nodeOrigin:ds,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Ud(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:l}=ee(qd,oe),c=re();H.useEffect(()=>(l(e.defaultNodes,e.defaultEdges),()=>{u.current=$o,a()}),[]);const u=H.useRef($o);return H.useEffect(()=>{for(const f of Do){const d=e[f],h=u.current[f];d!==h&&(typeof e[f]>"u"||(f==="nodes"?t(d):f==="edges"?n(d):f==="minZoom"?o(d):f==="maxZoom"?r(d):f==="translateExtent"?i(d):f==="nodeExtent"?s(d):f==="ariaLabelConfig"?c.setState({ariaLabelConfig:ju(d)}):f==="fitView"?c.setState({fitViewQueued:d}):f==="fitViewOptions"?c.setState({fitViewOptions:d}):c.setState({[f]:d})))}u.current=e},Do.map(f=>e[f])),null}function zo(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Kd(e){const[t,n]=H.useState(e==="system"?null:e);return H.useEffect(()=>{if(e!=="system"){n(e);return}const o=zo(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:zo()?.matches?"dark":"light"}const Ho=typeof document<"u"?document:null;function dt(e=null,t={target:Ho,actInsideInputWithModifier:!0}){const[n,o]=H.useState(!1),r=H.useRef(!1),i=H.useRef(new Set([])),[s,a]=H.useMemo(()=>{if(e!==null){const c=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",`
1
+ import{r as H,F as Zi,H as Wi,j as y,c as pe,f as jt,k as Gi,a as qi,t as Ui}from"./index-ZiFjEqyT.js";import{e as Ki,a as Qn,b as Qi,d as Ji,C as ue,G as Jn,M as eo,U as ea,f as ta}from"./index-Bc30BcYv.js";import{D as na,u as oa,b as ra,a as sa,c as ia,N as aa,d as to,G as en,T as ca}from"./use-model-state-B8hL-q1r.js";import{E as dn}from"./error-boundary-BOBkDZ1Y.js";import{u as tr}from"./use-connection-BskZam-G.js";import{u as nr,i as la}from"./use-gateway-v7etejE8.js";import{u as no}from"./localstorage-keys-DhdYpXZj.js";import{u as En}from"./project-context-provider-BPo-49FO.js";import{c as or,B as rr}from"./button-Co_HOc3E.js";import{V as ua}from"./view-mode-toggle-tlrhMsiy.js";import{i as da}from"./GitBranch01-CA4KhZZx.js";import{s as fa}from"./Plus-C4F6mby2.js";import{c as ha}from"./connection-CmMMEDBY.js";import{I as sr,n as ga}from"./empty-state-B1DU5702.js";import{u as pa}from"./use-tool-call-BbfSyOCz.js";import{i as $e,a as oo,b as ma,c as ro,d as tn,T as nn,e as ya}from"./value-zEqR5KPg.js";import"./input-DEsmZ6es.js";import"./popover-DW05feED.js";import"./tooltip-BJO9sFhZ.js";import"./Check-D4dBNJmC.js";import"./SearchMd-B_A85eif.js";import"./use-create-gateway-CCmt4GT8.js";import"./AlertCircle-DlBo4Xw9.js";import"./X-D09jV0HO.js";import"./ArrowUp-KvHCnFh3.js";import"./textarea-DFRypKCQ.js";import"./useMutation-4fnzP4bc.js";import"./Grid01-BgBQwtBY.js";import"./Copy01-Rf_P7R5F.js";import"./Terminal-BWurH474.js";import"./monaco-editor-BYgR7J38.js";import"./spinner-DqooIng7.js";import"./alert-dialog-Df8ZsItX.js";import"./select-CVEPeRAQ.js";import"./ChevronDown-CJaS1NVA.js";import"./File06-Dir7h2_j.js";import"./Image01-B8cj-qoF.js";import"./use-collections-g067BPxP.js";import"./use-binding-C8KxuIY6.js";import"./binder-BtPpbY4I.js";import"./use-gateway-system-prompt-DoCpWoeh.js";import"./Edit01-MWKLkbpZ.js";import"./well-known-mcp-D13f-8h2.js";import"./generate-id-Dyweu44Y.js";import"./Clock-ljBuaWDA.js";import"./Trash01-GrzirNvV.js";import"./useQuery-Bn2Wcch_.js";const Cn=({size:e=24,color:t="currentColor",...n})=>H.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},H.createElement("path",{d:"m10 15-3.075 3.114c-.43.434-.644.651-.828.666a.5.5 0 0 1-.421-.172c-.12-.14-.12-.446-.12-1.056v-1.56c0-.548-.449-.944-.99-1.024v0a3 3 0 0 1-2.534-2.533C2 12.219 2 11.96 2 11.445V6.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C4.28 2 5.12 2 6.8 2h7.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C19 4.28 19 5.12 19 6.8V11m0 11-2.176-1.513c-.306-.213-.46-.32-.626-.395a2.002 2.002 0 0 0-.462-.145c-.18-.033-.367-.033-.74-.033H13.2c-1.12 0-1.68 0-2.108-.218a2 2 0 0 1-.874-.874C10 18.394 10 17.834 10 16.714V14.2c0-1.12 0-1.68.218-2.108a2 2 0 0 1 .874-.874C11.52 11 12.08 11 13.2 11h5.6c1.12 0 1.68 0 2.108.218a2 2 0 0 1 .874.874C22 12.52 22 13.08 22 14.2v2.714c0 .932 0 1.398-.152 1.766a2 2 0 0 1-1.083 1.082c-.367.152-.833.152-1.765.152V22Z"}));Cn.displayName="MessageChatSquare";function ae(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=ae(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var xa={value:()=>{}};function Vt(){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 Ct(n)}function Ct(e){this._=e}function wa(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}})}Ct.prototype=Vt.prototype={constructor:Ct,on:function(e,t){var n=this._,o=wa(e+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(e=o[i]).type)&&(r=va(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(r=(e=o[i]).type)n[r]=so(n[r],e.name,t);else if(t==null)for(r in n)n[r]=so(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 Ct(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,i;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],o=0,r=i.length;o<r;++o)i[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,i=o.length;r<i;++r)o[r].value.apply(t,n)}};function va(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function so(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=xa,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var fn="http://www.w3.org/1999/xhtml";const io={svg:"http://www.w3.org/2000/svg",xhtml:fn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ot(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),io.hasOwnProperty(t)?{space:io[t],local:e}:e}function _a(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===fn&&t.documentElement.namespaceURI===fn?t.createElement(e):t.createElementNS(n,e)}}function ba(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ir(e){var t=Ot(e);return(t.local?ba:_a)(t)}function Sa(){}function Nn(e){return e==null?Sa:function(){return this.querySelector(e)}}function Ea(e){typeof e!="function"&&(e=Nn(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=new Array(s),l,c,u=0;u<s;++u)(l=i[u])&&(c=e.call(l,l.__data__,u,i))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new ge(o,this._parents)}function Ca(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Na(){return[]}function ar(e){return e==null?Na:function(){return this.querySelectorAll(e)}}function Ma(e){return function(){return Ca(e.apply(this,arguments))}}function Ia(e){typeof e=="function"?e=Ma(e):e=ar(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&(o.push(e.call(l,l.__data__,c,s)),r.push(l));return new ge(o,r)}function cr(e){return function(){return this.matches(e)}}function lr(e){return function(t){return t.matches(e)}}var ka=Array.prototype.find;function Aa(e){return function(){return ka.call(this.children,e)}}function Pa(){return this.firstElementChild}function Ta(e){return this.select(e==null?Pa:Aa(typeof e=="function"?e:lr(e)))}var Da=Array.prototype.filter;function $a(){return Array.from(this.children)}function za(e){return function(){return Da.call(this.children,e)}}function Ha(e){return this.selectAll(e==null?$a:za(typeof e=="function"?e:lr(e)))}function La(e){typeof e!="function"&&(e=cr(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new ge(o,this._parents)}function ur(e){return new Array(e.length)}function Ra(){return new ge(this._enter||this._groups.map(ur),this._parents)}function At(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}At.prototype={constructor:At,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 ja(e){return function(){return e}}function Va(e,t,n,o,r,i){for(var s=0,a,l=t.length,c=i.length;s<c;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new At(e,i[s]);for(;s<l;++s)(a=t[s])&&(r[s]=a)}function Oa(e,t,n,o,r,i,s){var a,l,c=new Map,u=t.length,f=i.length,d=new Array(u),h;for(a=0;a<u;++a)(l=t[a])&&(d[a]=h=s.call(l,l.__data__,a,t)+"",c.has(h)?r[a]=l:c.set(h,l));for(a=0;a<f;++a)h=s.call(e,i[a],a,i)+"",(l=c.get(h))?(o[a]=l,l.__data__=i[a],c.delete(h)):n[a]=new At(e,i[a]);for(a=0;a<u;++a)(l=t[a])&&c.get(d[a])===l&&(r[a]=l)}function Ba(e){return e.__data__}function Fa(e,t){if(!arguments.length)return Array.from(this,Ba);var n=t?Oa:Va,o=this._parents,r=this._groups;typeof e!="function"&&(e=ja(e));for(var i=r.length,s=new Array(i),a=new Array(i),l=new Array(i),c=0;c<i;++c){var u=o[c],f=r[c],d=f.length,h=Xa(e.call(u,u&&u.__data__,c,o)),g=h.length,v=a[c]=new Array(g),_=s[c]=new Array(g),x=l[c]=new Array(d);n(u,f,v,_,x,h,t);for(var b=0,p=0,m,C;b<g;++b)if(m=v[b]){for(b>=p&&(p=b+1);!(C=_[p])&&++p<g;);m._next=C||null}}return s=new ge(s,o),s._enter=a,s._exit=l,s}function Xa(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Ya(){return new ge(this._exit||this._groups.map(ur),this._parents)}function Za(e,t,n){var o=this.enter(),r=this,i=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?i.remove():n(i),o&&r?o.merge(r).order():r}function Wa(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),l=0;l<s;++l)for(var c=n[l],u=o[l],f=c.length,d=a[l]=new Array(f),h,g=0;g<f;++g)(h=c[g]||u[g])&&(d[g]=h);for(;l<r;++l)a[l]=n[l];return new ge(a,this._parents)}function Ga(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,i=o[r],s;--r>=0;)(s=o[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function qa(e){e||(e=Ua);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],a=s.length,l=r[i]=new Array(a),c,u=0;u<a;++u)(c=s[u])&&(l[u]=c);l.sort(t)}return new ge(r,this._parents).order()}function Ua(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Ka(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Qa(){return Array.from(this)}function Ja(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function ec(){let e=0;for(const t of this)++e;return e}function tc(){return!this.node()}function nc(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],i=0,s=r.length,a;i<s;++i)(a=r[i])&&e.call(a,a.__data__,i,r);return this}function oc(e){return function(){this.removeAttribute(e)}}function rc(e){return function(){this.removeAttributeNS(e.space,e.local)}}function sc(e,t){return function(){this.setAttribute(e,t)}}function ic(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function ac(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function cc(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 lc(e,t){var n=Ot(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?rc:oc:typeof t=="function"?n.local?cc:ac:n.local?ic:sc)(n,t))}function dr(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function uc(e){return function(){this.style.removeProperty(e)}}function dc(e,t,n){return function(){this.style.setProperty(e,t,n)}}function fc(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function hc(e,t,n){return arguments.length>1?this.each((t==null?uc:typeof t=="function"?fc:dc)(e,t,n??"")):Ye(this.node(),e)}function Ye(e,t){return e.style.getPropertyValue(t)||dr(e).getComputedStyle(e,null).getPropertyValue(t)}function gc(e){return function(){delete this[e]}}function pc(e,t){return function(){this[e]=t}}function mc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function yc(e,t){return arguments.length>1?this.each((t==null?gc:typeof t=="function"?mc:pc)(e,t)):this.node()[e]}function fr(e){return e.trim().split(/^|\s+/)}function Mn(e){return e.classList||new hr(e)}function hr(e){this._node=e,this._names=fr(e.getAttribute("class")||"")}hr.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 gr(e,t){for(var n=Mn(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function pr(e,t){for(var n=Mn(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function xc(e){return function(){gr(this,e)}}function wc(e){return function(){pr(this,e)}}function vc(e,t){return function(){(t.apply(this,arguments)?gr:pr)(this,e)}}function _c(e,t){var n=fr(e+"");if(arguments.length<2){for(var o=Mn(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?vc:t?xc:wc)(n,t))}function bc(){this.textContent=""}function Sc(e){return function(){this.textContent=e}}function Ec(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Cc(e){return arguments.length?this.each(e==null?bc:(typeof e=="function"?Ec:Sc)(e)):this.node().textContent}function Nc(){this.innerHTML=""}function Mc(e){return function(){this.innerHTML=e}}function Ic(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function kc(e){return arguments.length?this.each(e==null?Nc:(typeof e=="function"?Ic:Mc)(e)):this.node().innerHTML}function Ac(){this.nextSibling&&this.parentNode.appendChild(this)}function Pc(){return this.each(Ac)}function Tc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Dc(){return this.each(Tc)}function $c(e){var t=typeof e=="function"?e:ir(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function zc(){return null}function Hc(e,t){var n=typeof e=="function"?e:ir(e),o=t==null?zc:typeof t=="function"?t:Nn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function Lc(){var e=this.parentNode;e&&e.removeChild(this)}function Rc(){return this.each(Lc)}function jc(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Vc(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Oc(e){return this.select(e?Vc:jc)}function Bc(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Fc(e){return function(t){e.call(this,t,this.__data__)}}function Xc(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 Yc(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,i;n<r;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++o]=i;++o?t.length=o:delete this.__on}}}function Zc(e,t,n){return function(){var o=this.__on,r,i=Fc(t);if(o){for(var s=0,a=o.length;s<a;++s)if((r=o[s]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=t;return}}this.addEventListener(e.type,i,n),r={type:e.type,name:e.name,value:t,listener:i,options:n},o?o.push(r):this.__on=[r]}}function Wc(e,t,n){var o=Xc(e+""),r,i=o.length,s;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<i;++r)if((s=o[r]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?Zc:Yc,r=0;r<i;++r)this.each(a(o[r],t,n));return this}function mr(e,t,n){var o=dr(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 Gc(e,t){return function(){return mr(this,e,t)}}function qc(e,t){return function(){return mr(this,e,t.apply(this,arguments))}}function Uc(e,t){return this.each((typeof t=="function"?qc:Gc)(e,t))}function*Kc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length,s;r<i;++r)(s=o[r])&&(yield s)}var yr=[null];function ge(e,t){this._groups=e,this._parents=t}function ft(){return new ge([[document.documentElement]],yr)}function Qc(){return this}ge.prototype=ft.prototype={constructor:ge,select:Ea,selectAll:Ia,selectChild:Ta,selectChildren:Ha,filter:La,data:Fa,enter:Ra,exit:Ya,join:Za,merge:Wa,selection:Qc,order:Ga,sort:qa,call:Ka,nodes:Qa,node:Ja,size:ec,empty:tc,each:nc,attr:lc,style:hc,property:yc,classed:_c,text:Cc,html:kc,raise:Pc,lower:Dc,append:$c,insert:Hc,remove:Rc,clone:Oc,datum:Bc,on:Wc,dispatch:Uc,[Symbol.iterator]:Kc};function he(e){return typeof e=="string"?new ge([[document.querySelector(e)]],[document.documentElement]):new ge([[e]],yr)}function Jc(e){let t;for(;t=e.sourceEvent;)e=t;return e}function me(e,t){if(e=Jc(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 el={passive:!1},st={capture:!0,passive:!1};function on(e){e.stopImmediatePropagation()}function Xe(e){e.preventDefault(),e.stopImmediatePropagation()}function xr(e){var t=e.document.documentElement,n=he(e).on("dragstart.drag",Xe,st);"onselectstart"in t?n.on("selectstart.drag",Xe,st):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function wr(e,t){var n=e.document.documentElement,o=he(e).on("dragstart.drag",null);t&&(o.on("click.drag",Xe,st),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 yt=e=>()=>e;function hn(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,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:i,enumerable:!0,configurable:!0},x:{value:s,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}})}hn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function tl(e){return!e.ctrlKey&&!e.button}function nl(){return this.parentNode}function ol(e,t){return t??{x:e.x,y:e.y}}function rl(){return navigator.maxTouchPoints||"ontouchstart"in this}function vr(){var e=tl,t=nl,n=ol,o=rl,r={},i=Vt("start","drag","end"),s=0,a,l,c,u,f=0;function d(m){m.on("mousedown.drag",h).filter(o).on("touchstart.drag",_).on("touchmove.drag",x,el).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(m,C){if(!(u||!e.call(this,m,C))){var S=p(this,t.call(this,m,C),m,C,"mouse");S&&(he(m.view).on("mousemove.drag",g,st).on("mouseup.drag",v,st),xr(m.view),on(m),c=!1,a=m.clientX,l=m.clientY,S("start",m))}}function g(m){if(Xe(m),!c){var C=m.clientX-a,S=m.clientY-l;c=C*C+S*S>f}r.mouse("drag",m)}function v(m){he(m.view).on("mousemove.drag mouseup.drag",null),wr(m.view,c),Xe(m),r.mouse("end",m)}function _(m,C){if(e.call(this,m,C)){var S=m.changedTouches,N=t.call(this,m,C),T=S.length,P,j;for(P=0;P<T;++P)(j=p(this,N,m,C,S[P].identifier,S[P]))&&(on(m),j("start",m,S[P]))}}function x(m){var C=m.changedTouches,S=C.length,N,T;for(N=0;N<S;++N)(T=r[C[N].identifier])&&(Xe(m),T("drag",m,C[N]))}function b(m){var C=m.changedTouches,S=C.length,N,T;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),N=0;N<S;++N)(T=r[C[N].identifier])&&(on(m),T("end",m,C[N]))}function p(m,C,S,N,T,P){var j=i.copy(),I=me(P||S,C),z,L,w;if((w=n.call(m,new hn("beforestart",{sourceEvent:S,target:d,identifier:T,active:s,x:I[0],y:I[1],dx:0,dy:0,dispatch:j}),N))!=null)return z=w.x-I[0]||0,L=w.y-I[1]||0,function M(E,A,k){var D=I,$;switch(E){case"start":r[T]=M,$=s++;break;case"end":delete r[T],--s;case"drag":I=me(k||A,C),$=s;break}j.call(E,m,new hn(E,{sourceEvent:A,subject:w,target:d,identifier:T,active:$,x:I[0]+z,y:I[1]+L,dx:I[0]-D[0],dy:I[1]-D[1],dispatch:j}),N)}}return d.filter=function(m){return arguments.length?(e=typeof m=="function"?m:yt(!!m),d):e},d.container=function(m){return arguments.length?(t=typeof m=="function"?m:yt(m),d):t},d.subject=function(m){return arguments.length?(n=typeof m=="function"?m:yt(m),d):n},d.touchable=function(m){return arguments.length?(o=typeof m=="function"?m:yt(!!m),d):o},d.on=function(){var m=i.on.apply(i,arguments);return m===i?d:m},d.clickDistance=function(m){return arguments.length?(f=(m=+m)*m,d):Math.sqrt(f)},d}var ao=180/Math.PI,gn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function _r(e,t,n,o,r,i){var s,a,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(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,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*ao,skewX:Math.atan(l)*ao,scaleX:s,scaleY:a}}var xt;function sl(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?gn:_r(t.a,t.b,t.c,t.d,t.e,t.f)}function il(e){return e==null||(xt||(xt=document.createElementNS("http://www.w3.org/2000/svg","g")),xt.setAttribute("transform",e),!(e=xt.transform.baseVal.consolidate()))?gn:(e=e.matrix,_r(e.a,e.b,e.c,e.d,e.e,e.f))}function br(e,t,n,o){function r(c){return c.length?c.pop()+" ":""}function i(c,u,f,d,h,g){if(c!==f||u!==d){var v=h.push("translate(",null,t,null,n);g.push({i:v-4,x:$e(c,f)},{i:v-2,x:$e(u,d)})}else(f||d)&&h.push("translate("+f+t+d+n)}function s(c,u,f,d){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),d.push({i:f.push(r(f)+"rotate(",null,o)-2,x:$e(c,u)})):u&&f.push(r(f)+"rotate("+u+o)}function a(c,u,f,d){c!==u?d.push({i:f.push(r(f)+"skewX(",null,o)-2,x:$e(c,u)}):u&&f.push(r(f)+"skewX("+u+o)}function l(c,u,f,d,h,g){if(c!==f||u!==d){var v=h.push(r(h)+"scale(",null,",",null,")");g.push({i:v-4,x:$e(c,f)},{i:v-2,x:$e(u,d)})}else(f!==1||d!==1)&&h.push(r(h)+"scale("+f+","+d+")")}return function(c,u){var f=[],d=[];return c=e(c),u=e(u),i(c.translateX,c.translateY,u.translateX,u.translateY,f,d),s(c.rotate,u.rotate,f,d),a(c.skewX,u.skewX,f,d),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,f,d),c=u=null,function(h){for(var g=-1,v=d.length,_;++g<v;)f[(_=d[g]).i]=_.x(h);return f.join("")}}}var al=br(sl,"px, ","px)","deg)"),cl=br(il,", ",")",")"),ll=1e-12;function co(e){return((e=Math.exp(e))+1/e)/2}function ul(e){return((e=Math.exp(e))-1/e)/2}function dl(e){return((e=Math.exp(2*e))-1)/(e+1)}const Nt=(function e(t,n,o){function r(i,s){var a=i[0],l=i[1],c=i[2],u=s[0],f=s[1],d=s[2],h=u-a,g=f-l,v=h*h+g*g,_,x;if(v<ll)x=Math.log(d/c)/t,_=function(N){return[a+N*h,l+N*g,c*Math.exp(t*N*x)]};else{var b=Math.sqrt(v),p=(d*d-c*c+o*v)/(2*c*n*b),m=(d*d-c*c-o*v)/(2*d*n*b),C=Math.log(Math.sqrt(p*p+1)-p),S=Math.log(Math.sqrt(m*m+1)-m);x=(S-C)/t,_=function(N){var T=N*x,P=co(C),j=c/(n*b)*(P*dl(t*T+C)-ul(C));return[a+j*h,l+j*g,c*P/co(t*T+C)]}}return _.duration=x*1e3*t/Math.SQRT2,_}return r.rho=function(i){var s=Math.max(.001,+i),a=s*s,l=a*a;return e(s,a,l)},r})(Math.SQRT2,2,4);var Ze=0,tt=0,Je=0,Sr=1e3,Pt,nt,Tt=0,Le=0,Bt=0,it=typeof performance=="object"&&performance.now?performance:Date,Er=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function In(){return Le||(Er(fl),Le=it.now()+Bt)}function fl(){Le=0}function Dt(){this._call=this._time=this._next=null}Dt.prototype=Cr.prototype={constructor:Dt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?In():+n)+(t==null?0:+t),!this._next&&nt!==this&&(nt?nt._next=this:Pt=this,nt=this),this._call=e,this._time=n,pn()},stop:function(){this._call&&(this._call=null,this._time=1/0,pn())}};function Cr(e,t,n){var o=new Dt;return o.restart(e,t,n),o}function hl(){In(),++Ze;for(var e=Pt,t;e;)(t=Le-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ze}function lo(){Le=(Tt=it.now())+Bt,Ze=tt=0;try{hl()}finally{Ze=0,pl(),Le=0}}function gl(){var e=it.now(),t=e-Tt;t>Sr&&(Bt-=t,Tt=e)}function pl(){for(var e,t=Pt,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:Pt=n);nt=e,pn(o)}function pn(e){if(!Ze){tt&&(tt=clearTimeout(tt));var t=e-Le;t>24?(e<1/0&&(tt=setTimeout(lo,e-it.now()-Bt)),Je&&(Je=clearInterval(Je))):(Je||(Tt=it.now(),Je=setInterval(gl,Sr)),Ze=1,Er(lo))}}function uo(e,t,n){var o=new Dt;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var ml=Vt("start","end","cancel","interrupt"),yl=[],Nr=0,fo=1,mn=2,Mt=3,ho=4,yn=5,It=6;function Ft(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;xl(e,n,{name:t,index:o,group:r,on:ml,tween:yl,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Nr})}function kn(e,t){var n=we(e,t);if(n.state>Nr)throw new Error("too late; already scheduled");return n}function Se(e,t){var n=we(e,t);if(n.state>Mt)throw new Error("too late; already running");return n}function we(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function xl(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=Cr(i,0,n.time);function i(c){n.state=fo,n.timer.restart(s,n.delay,n.time),n.delay<=c&&s(c-n.delay)}function s(c){var u,f,d,h;if(n.state!==fo)return l();for(u in o)if(h=o[u],h.name===n.name){if(h.state===Mt)return uo(s);h.state===ho?(h.state=It,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[u]):+u<t&&(h.state=It,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete o[u])}if(uo(function(){n.state===Mt&&(n.state=ho,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=mn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===mn){for(n.state=Mt,r=new Array(d=n.tween.length),u=0,f=-1;u<d;++u)(h=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++f]=h);r.length=f+1}}function a(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=yn,1),f=-1,d=r.length;++f<d;)r[f].call(e,u);n.state===yn&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=It,n.timer.stop(),delete o[t];for(var c in o)return;delete e.__transition}}function kt(e,t){var n=e.__transition,o,r,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((o=n[s]).name!==t){i=!1;continue}r=o.state>mn&&o.state<yn,o.state=It,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function wl(e){return this.each(function(){kt(this,e)})}function vl(e,t){var n,o;return function(){var r=Se(this,e),i=r.tween;if(i!==n){o=n=i;for(var s=0,a=o.length;s<a;++s)if(o[s].name===t){o=o.slice(),o.splice(s,1);break}}r.tween=o}}function _l(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=Se(this,e),s=i.tween;if(s!==o){r=(o=s).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)}i.tween=r}}function bl(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=we(this.node(),n).tween,r=0,i=o.length,s;r<i;++r)if((s=o[r]).name===e)return s.value;return null}return this.each((t==null?vl:_l)(n,e,t))}function An(e,t,n){var o=e._id;return e.each(function(){var r=Se(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return we(r,o).value[t]}}function Mr(e,t){var n;return(typeof t=="number"?$e:t instanceof ro?oo:(n=ro(t))?(t=n,oo):ma)(e,t)}function Sl(e){return function(){this.removeAttribute(e)}}function El(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Cl(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttribute(e);return s===r?null:s===o?i:i=t(o=s,n)}}function Nl(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===r?null:s===o?i:i=t(o=s,n)}}function Ml(e,t,n){var o,r,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),l=a+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a)))}}function Il(e,t,n){var o,r,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),l=a+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a)))}}function kl(e,t){var n=Ot(e),o=n==="transform"?cl:Mr;return this.attrTween(e,typeof t=="function"?(n.local?Il:Ml)(n,o,An(this,"attr."+e,t)):t==null?(n.local?El:Sl)(n):(n.local?Nl:Cl)(n,o,t))}function Al(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Pl(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Tl(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Pl(e,i)),n}return r._value=t,r}function Dl(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Al(e,i)),n}return r._value=t,r}function $l(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=Ot(e);return this.tween(n,(o.local?Tl:Dl)(o,t))}function zl(e,t){return function(){kn(this,e).delay=+t.apply(this,arguments)}}function Hl(e,t){return t=+t,function(){kn(this,e).delay=t}}function Ll(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?zl:Hl)(t,e)):we(this.node(),t).delay}function Rl(e,t){return function(){Se(this,e).duration=+t.apply(this,arguments)}}function jl(e,t){return t=+t,function(){Se(this,e).duration=t}}function Vl(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Rl:jl)(t,e)):we(this.node(),t).duration}function Ol(e,t){if(typeof t!="function")throw new Error;return function(){Se(this,e).ease=t}}function Bl(e){var t=this._id;return arguments.length?this.each(Ol(t,e)):we(this.node(),t).ease}function Fl(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Se(this,e).ease=n}}function Xl(e){if(typeof e!="function")throw new Error;return this.each(Fl(this._id,e))}function Yl(e){typeof e!="function"&&(e=cr(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new Me(o,this._parents,this._name,this._id)}function Zl(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var l=t[a],c=n[a],u=l.length,f=s[a]=new Array(u),d,h=0;h<u;++h)(d=l[h]||c[h])&&(f[h]=d);for(;a<o;++a)s[a]=t[a];return new Me(s,this._parents,this._name,this._id)}function Wl(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 Gl(e,t,n){var o,r,i=Wl(t)?kn:Se;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}function ql(e,t){var n=this._id;return arguments.length<2?we(this.node(),n).on.on(e):this.each(Gl(n,e,t))}function Ul(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Kl(){return this.on("end.remove",Ul(this._id))}function Ql(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Nn(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],l=a.length,c=i[s]=new Array(l),u,f,d=0;d<l;++d)(u=a[d])&&(f=e.call(u,u.__data__,d,a))&&("__data__"in u&&(f.__data__=u.__data__),c[d]=f,Ft(c[d],t,n,d,c,we(u,n)));return new Me(i,this._parents,t,n)}function Jl(e){var t=this._name,n=this._id;typeof e!="function"&&(e=ar(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var l=o[a],c=l.length,u,f=0;f<c;++f)if(u=l[f]){for(var d=e.call(u,u.__data__,f,l),h,g=we(u,n),v=0,_=d.length;v<_;++v)(h=d[v])&&Ft(h,t,n,v,d,g);i.push(d),s.push(u)}return new Me(i,s,t,n)}var eu=ft.prototype.constructor;function tu(){return new eu(this._groups,this._parents)}function nu(e,t){var n,o,r;return function(){var i=Ye(this,e),s=(this.style.removeProperty(e),Ye(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function Ir(e){return function(){this.style.removeProperty(e)}}function ou(e,t,n){var o,r=n+"",i;return function(){var s=Ye(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function ru(e,t,n){var o,r,i;return function(){var s=Ye(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),Ye(this,e))),s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a))}}function su(e,t){var n,o,r,i="style."+t,s="end."+i,a;return function(){var l=Se(this,e),c=l.on,u=l.value[i]==null?a||(a=Ir(t)):void 0;(c!==n||r!==u)&&(o=(n=c).copy()).on(s,r=u),l.on=o}}function iu(e,t,n){var o=(e+="")=="transform"?al:Mr;return t==null?this.styleTween(e,nu(e,o)).on("end.style."+e,Ir(e)):typeof t=="function"?this.styleTween(e,ru(e,o,An(this,"style."+e,t))).each(su(this._id,e)):this.styleTween(e,ou(e,o,t),n).on("end.style."+e,null)}function au(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function cu(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&au(e,s,n)),o}return i._value=t,i}function lu(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,cu(e,t,n??""))}function uu(e){return function(){this.textContent=e}}function du(e){return function(){var t=e(this);this.textContent=t??""}}function fu(e){return this.tween("text",typeof e=="function"?du(An(this,"text",e)):uu(e==null?"":e+""))}function hu(e){return function(t){this.textContent=e.call(this,t)}}function gu(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&hu(r)),t}return o._value=e,o}function pu(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,gu(e))}function mu(){for(var e=this._name,t=this._id,n=kr(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,l,c=0;c<a;++c)if(l=s[c]){var u=we(l,t);Ft(l,e,n,c,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Me(o,this._parents,e,n)}function yu(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},l={value:function(){--r===0&&i()}};n.each(function(){var c=Se(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&&i()})}var xu=0;function Me(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function kr(){return++xu}var Ce=ft.prototype;Me.prototype={constructor:Me,select:Ql,selectAll:Jl,selectChild:Ce.selectChild,selectChildren:Ce.selectChildren,filter:Yl,merge:Zl,selection:tu,transition:mu,call:Ce.call,nodes:Ce.nodes,node:Ce.node,size:Ce.size,empty:Ce.empty,each:Ce.each,on:ql,attr:kl,attrTween:$l,style:iu,styleTween:lu,text:fu,textTween:pu,remove:Kl,tween:bl,delay:Ll,duration:Vl,ease:Bl,easeVarying:Xl,end:yu,[Symbol.iterator]:Ce[Symbol.iterator]};function wu(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var vu={time:null,delay:0,duration:250,ease:wu};function _u(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 bu(e){var t,n;e instanceof Me?(t=e._id,e=e._name):(t=kr(),(n=vu).time=In(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&Ft(l,e,t,c,s,n||_u(l,t));return new Me(o,this._parents,e,t)}ft.prototype.interrupt=wl;ft.prototype.transition=bu;const wt=e=>()=>e;function Su(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 Ne(e,t,n){this.k=e,this.x=t,this.y=n}Ne.prototype={constructor:Ne,scale:function(e){return e===1?this:new Ne(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ne(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 Xt=new Ne(1,0,0);Ar.prototype=Ne.prototype;function Ar(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Xt;return e.__zoom}function rn(e){e.stopImmediatePropagation()}function et(e){e.preventDefault(),e.stopImmediatePropagation()}function Eu(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Cu(){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 go(){return this.__zoom||Xt}function Nu(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Mu(){return navigator.maxTouchPoints||"ontouchstart"in this}function Iu(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function Pr(){var e=Eu,t=Cu,n=Iu,o=Nu,r=Mu,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Nt,c=Vt("start","zoom","end"),u,f,d,h=500,g=150,v=0,_=10;function x(w){w.property("__zoom",go).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",P).on("dblclick.zoom",j).filter(r).on("touchstart.zoom",I).on("touchmove.zoom",z).on("touchend.zoom touchcancel.zoom",L).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}x.transform=function(w,M,E,A){var k=w.selection?w.selection():w;k.property("__zoom",go),w!==k?C(w,M,E,A):k.interrupt().each(function(){S(this,arguments).event(A).start().zoom(null,typeof M=="function"?M.apply(this,arguments):M).end()})},x.scaleBy=function(w,M,E,A){x.scaleTo(w,function(){var k=this.__zoom.k,D=typeof M=="function"?M.apply(this,arguments):M;return k*D},E,A)},x.scaleTo=function(w,M,E,A){x.transform(w,function(){var k=t.apply(this,arguments),D=this.__zoom,$=E==null?m(k):typeof E=="function"?E.apply(this,arguments):E,V=D.invert($),R=typeof M=="function"?M.apply(this,arguments):M;return n(p(b(D,R),$,V),k,s)},E,A)},x.translateBy=function(w,M,E,A){x.transform(w,function(){return n(this.__zoom.translate(typeof M=="function"?M.apply(this,arguments):M,typeof E=="function"?E.apply(this,arguments):E),t.apply(this,arguments),s)},null,A)},x.translateTo=function(w,M,E,A,k){x.transform(w,function(){var D=t.apply(this,arguments),$=this.__zoom,V=A==null?m(D):typeof A=="function"?A.apply(this,arguments):A;return n(Xt.translate(V[0],V[1]).scale($.k).translate(typeof M=="function"?-M.apply(this,arguments):-M,typeof E=="function"?-E.apply(this,arguments):-E),D,s)},A,k)};function b(w,M){return M=Math.max(i[0],Math.min(i[1],M)),M===w.k?w:new Ne(M,w.x,w.y)}function p(w,M,E){var A=M[0]-E[0]*w.k,k=M[1]-E[1]*w.k;return A===w.x&&k===w.y?w:new Ne(w.k,A,k)}function m(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function C(w,M,E,A){w.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 k=this,D=arguments,$=S(k,D).event(A),V=t.apply(k,D),R=E==null?m(V):typeof E=="function"?E.apply(k,D):E,F=Math.max(V[1][0]-V[0][0],V[1][1]-V[0][1]),B=k.__zoom,G=typeof M=="function"?M.apply(k,D):M,K=l(B.invert(R).concat(F/B.k),G.invert(R).concat(F/G.k));return function(Z){if(Z===1)Z=G;else{var O=K(Z),X=F/O[2];Z=new Ne(X,R[0]-O[0]*X,R[1]-O[1]*X)}$.zoom(null,Z)}})}function S(w,M,E){return!E&&w.__zooming||new N(w,M)}function N(w,M){this.that=w,this.args=M,this.active=0,this.sourceEvent=null,this.extent=t.apply(w,M),this.taps=0}N.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,M){return this.mouse&&w!=="mouse"&&(this.mouse[1]=M.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=M.invert(this.touch0[0])),this.touch1&&w!=="touch"&&(this.touch1[1]=M.invert(this.touch1[0])),this.that.__zoom=M,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(w){var M=he(this.that).datum();c.call(w,this.that,new Su(w,{sourceEvent:this.sourceEvent,target:x,transform:this.that.__zoom,dispatch:c}),M)}};function T(w,...M){if(!e.apply(this,arguments))return;var E=S(this,M).event(w),A=this.__zoom,k=Math.max(i[0],Math.min(i[1],A.k*Math.pow(2,o.apply(this,arguments)))),D=me(w);if(E.wheel)(E.mouse[0][0]!==D[0]||E.mouse[0][1]!==D[1])&&(E.mouse[1]=A.invert(E.mouse[0]=D)),clearTimeout(E.wheel);else{if(A.k===k)return;E.mouse=[D,A.invert(D)],kt(this),E.start()}et(w),E.wheel=setTimeout($,g),E.zoom("mouse",n(p(b(A,k),E.mouse[0],E.mouse[1]),E.extent,s));function $(){E.wheel=null,E.end()}}function P(w,...M){if(d||!e.apply(this,arguments))return;var E=w.currentTarget,A=S(this,M,!0).event(w),k=he(w.view).on("mousemove.zoom",R,!0).on("mouseup.zoom",F,!0),D=me(w,E),$=w.clientX,V=w.clientY;xr(w.view),rn(w),A.mouse=[D,this.__zoom.invert(D)],kt(this),A.start();function R(B){if(et(B),!A.moved){var G=B.clientX-$,K=B.clientY-V;A.moved=G*G+K*K>v}A.event(B).zoom("mouse",n(p(A.that.__zoom,A.mouse[0]=me(B,E),A.mouse[1]),A.extent,s))}function F(B){k.on("mousemove.zoom mouseup.zoom",null),wr(B.view,A.moved),et(B),A.event(B).end()}}function j(w,...M){if(e.apply(this,arguments)){var E=this.__zoom,A=me(w.changedTouches?w.changedTouches[0]:w,this),k=E.invert(A),D=E.k*(w.shiftKey?.5:2),$=n(p(b(E,D),A,k),t.apply(this,M),s);et(w),a>0?he(this).transition().duration(a).call(C,$,A,w):he(this).call(x.transform,$,A,w)}}function I(w,...M){if(e.apply(this,arguments)){var E=w.touches,A=E.length,k=S(this,M,w.changedTouches.length===A).event(w),D,$,V,R;for(rn(w),$=0;$<A;++$)V=E[$],R=me(V,this),R=[R,this.__zoom.invert(R),V.identifier],k.touch0?!k.touch1&&k.touch0[2]!==R[2]&&(k.touch1=R,k.taps=0):(k.touch0=R,D=!0,k.taps=1+!!u);u&&(u=clearTimeout(u)),D&&(k.taps<2&&(f=R[0],u=setTimeout(function(){u=null},h)),kt(this),k.start())}}function z(w,...M){if(this.__zooming){var E=S(this,M).event(w),A=w.changedTouches,k=A.length,D,$,V,R;for(et(w),D=0;D<k;++D)$=A[D],V=me($,this),E.touch0&&E.touch0[2]===$.identifier?E.touch0[0]=V:E.touch1&&E.touch1[2]===$.identifier&&(E.touch1[0]=V);if($=E.that.__zoom,E.touch1){var F=E.touch0[0],B=E.touch0[1],G=E.touch1[0],K=E.touch1[1],Z=(Z=G[0]-F[0])*Z+(Z=G[1]-F[1])*Z,O=(O=K[0]-B[0])*O+(O=K[1]-B[1])*O;$=b($,Math.sqrt(Z/O)),V=[(F[0]+G[0])/2,(F[1]+G[1])/2],R=[(B[0]+K[0])/2,(B[1]+K[1])/2]}else if(E.touch0)V=E.touch0[0],R=E.touch0[1];else return;E.zoom("touch",n(p($,V,R),E.extent,s))}}function L(w,...M){if(this.__zooming){var E=S(this,M).event(w),A=w.changedTouches,k=A.length,D,$;for(rn(w),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),D=0;D<k;++D)$=A[D],E.touch0&&E.touch0[2]===$.identifier?delete E.touch0:E.touch1&&E.touch1[2]===$.identifier&&delete E.touch1;if(E.touch1&&!E.touch0&&(E.touch0=E.touch1,delete E.touch1),E.touch0)E.touch0[1]=this.__zoom.invert(E.touch0[0]);else if(E.end(),E.taps===2&&($=me($,this),Math.hypot(f[0]-$[0],f[1]-$[1])<_)){var V=he(this).on("dblclick.zoom");V&&V.apply(this,arguments)}}}return x.wheelDelta=function(w){return arguments.length?(o=typeof w=="function"?w:wt(+w),x):o},x.filter=function(w){return arguments.length?(e=typeof w=="function"?w:wt(!!w),x):e},x.touchable=function(w){return arguments.length?(r=typeof w=="function"?w:wt(!!w),x):r},x.extent=function(w){return arguments.length?(t=typeof w=="function"?w:wt([[+w[0][0],+w[0][1]],[+w[1][0],+w[1][1]]]),x):t},x.scaleExtent=function(w){return arguments.length?(i[0]=+w[0],i[1]=+w[1],x):[i[0],i[1]]},x.translateExtent=function(w){return arguments.length?(s[0][0]=+w[0][0],s[1][0]=+w[1][0],s[0][1]=+w[0][1],s[1][1]=+w[1][1],x):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},x.constrain=function(w){return arguments.length?(n=w,x):n},x.duration=function(w){return arguments.length?(a=+w,x):a},x.interpolate=function(w){return arguments.length?(l=w,x):l},x.on=function(){var w=c.on.apply(c,arguments);return w===c?x:w},x.clickDistance=function(w){return arguments.length?(v=(w=+w)*w,x):Math.sqrt(v)},x.tapDistance=function(w){return arguments.length?(_=+w,x):_},x}const be={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."},at=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Tr=["Enter"," ","Escape"],Dr={"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 We;(function(e){e.Strict="strict",e.Loose="loose"})(We||(We={}));var He;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(He||(He={}));var ct;(function(e){e.Partial="partial",e.Full="full"})(ct||(ct={}));const $r={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Pe;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Pe||(Pe={}));var $t;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})($t||($t={}));var Y;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Y||(Y={}));const po={[Y.Left]:Y.Right,[Y.Right]:Y.Left,[Y.Top]:Y.Bottom,[Y.Bottom]:Y.Top};function zr(e){return e===null?null:e?"valid":"invalid"}const Hr=e=>"id"in e&&"source"in e&&"target"in e,ku=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Pn=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),ht=(e,t=[0,0])=>{const{width:n,height:o}=Ie(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},Au=(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 i=typeof r=="string";let s=!t.nodeLookup&&!i?r:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(r):Pn(r)?r:t.nodeLookup.get(r.id));const a=s?zt(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Yt(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Zt(n)},gt=(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=Yt(n,zt(r)),o=!0)}),o?Zt(n):{x:0,y:0,width:0,height:0}},Tn=(e,t,[n,o,r]=[0,0,1],i=!1,s=!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:f=!0,hidden:d=!1}=c;if(s&&!f||d)continue;const h=u.width??c.width??c.initialWidth??null,g=u.height??c.height??c.initialHeight??null,v=lt(a,qe(c)),_=(h??0)*(g??0),x=i&&v>0;(!c.internals.handleBounds||x||v>=_||c.dragging)&&l.push(c)}return l},Pu=(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 Tu(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 Du({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return Promise.resolve(!0);const a=Tu(e,s),l=gt(a),c=Dn(l,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(c,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),Promise.resolve(!0)}function Lr({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},u=s.origin??o;let f=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i?.("005",be.error005());else{const h=a.measured.width,g=a.measured.height;h&&g&&(f=[[l,c],[l+h,c+g]])}else a&&Ue(s.extent)&&(f=[[s.extent[0][0]+l,s.extent[0][1]+c],[s.extent[1][0]+l,s.extent[1][1]+c]]);const d=Ue(f)?Re(t,f,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",be.error015()),{position:{x:d.x-l+(s.measured.width??0)*u[0],y:d.y-c+(s.measured.height??0)*u[1]},positionAbsolute:d}}async function $u({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(d=>d.id)),s=[];for(const d of n){if(d.deletable===!1)continue;const h=i.has(d.id),g=!h&&d.parentId&&s.find(v=>v.id===d.parentId);(h||g)&&s.push(d)}const a=new Set(t.map(d=>d.id)),l=o.filter(d=>d.deletable!==!1),u=Pu(s,l);for(const d of l)a.has(d.id)&&!u.find(g=>g.id===d.id)&&u.push(d);if(!r)return{edges:u,nodes:s};const f=await r({nodes:s,edges:u});return typeof f=="boolean"?f?{edges:u,nodes:s}:{edges:[],nodes:[]}:f}const Ge=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Re=(e={x:0,y:0},t,n)=>({x:Ge(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Ge(e.y,t[0][1],t[1][1]-(n?.height??0))});function Rr(e,t,n){const{width:o,height:r}=Ie(n),{x:i,y:s}=n.internals.positionAbsolute;return Re(e,[[i,s],[i+o,s+r]],t)}const mo=(e,t,n)=>e<t?Ge(Math.abs(e-t),1,t)/t:e>n?-Ge(Math.abs(e-n),1,t)/t:0,jr=(e,t,n=15,o=40)=>{const r=mo(e.x,o,t.width-o)*n,i=mo(e.y,o,t.height-o)*n;return[r,i]},Yt=(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)}),xn=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),Zt=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),qe=(e,t=[0,0])=>{const{x:n,y:o}=Pn(e)?e.internals.positionAbsolute:ht(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}},zt=(e,t=[0,0])=>{const{x:n,y:o}=Pn(e)?e.internals.positionAbsolute:ht(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)}},Vr=(e,t)=>Zt(Yt(xn(e),xn(t))),lt=(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)},yo=e=>ye(e.width)&&ye(e.height)&&ye(e.x)&&ye(e.y),ye=e=>!isNaN(e)&&isFinite(e),zu=(e,t)=>{},pt=(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],i=!1,s=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return i?pt(a,s):a},Ht=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Oe(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 Hu(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=Oe(e,n),r=Oe(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=Oe(e.top??e.y??0,n),r=Oe(e.bottom??e.y??0,n),i=Oe(e.left??e.x??0,t),s=Oe(e.right??e.x??0,t);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Lu(e,t,n,o,r,i){const{x:s,y:a}=Ht(e,[t,n,o]),{x:l,y:c}=Ht({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-l,f=i-c;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(f)}}const Dn=(e,t,n,o,r,i)=>{const s=Hu(i,t,n),a=(t-s.x)/e.width,l=(n-s.y)/e.height,c=Math.min(a,l),u=Ge(c,o,r),f=e.x+e.width/2,d=e.y+e.height/2,h=t/2-f*u,g=n/2-d*u,v=Lu(e,h,g,u,t,n),_={left:Math.min(v.left-s.left,0),top:Math.min(v.top-s.top,0),right:Math.min(v.right-s.right,0),bottom:Math.min(v.bottom-s.bottom,0)};return{x:h-_.left+_.right,y:g-_.top+_.bottom,zoom:u}},ut=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Ue(e){return e!=null&&e!=="parent"}function Ie(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Or(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Br(e,t={width:0,height:0},n,o,r){const i={...e},s=o.get(n);if(s){const a=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}function xo(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Ru(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function ju(e){return{...Dr,...e||{}}}function ot(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=xe(e),a=mt({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:l,y:c}=n?pt(a,t):a;return{xSnapped:l,ySnapped:c,...a}}const $n=e=>({width:e.offsetWidth,height:e.offsetHeight}),Fr=e=>e?.getRootNode?.()||window?.document,Vu=["INPUT","SELECT","TEXTAREA"];function Xr(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Vu.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Yr=e=>"clientX"in e,xe=(e,t)=>{const n=Yr(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)}},wo=(e,t,n,o,r)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:r,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...$n(s)}})};function Zr({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const l=e*.125+r*.375+s*.375+n*.125,c=t*.125+i*.375+a*.375+o*.125,u=Math.abs(l-e),f=Math.abs(c-t);return[l,c,u,f]}function vt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function vo({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case Y.Left:return[t-vt(t-o,i),n];case Y.Right:return[t+vt(o-t,i),n];case Y.Top:return[t,n-vt(n-r,i)];case Y.Bottom:return[t,n+vt(r-n,i)]}}function Wr({sourceX:e,sourceY:t,sourcePosition:n=Y.Bottom,targetX:o,targetY:r,targetPosition:i=Y.Top,curvature:s=.25}){const[a,l]=vo({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[c,u]=vo({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[f,d,h,g]=Zr({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}`,f,d,h,g]}function Gr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n<e?n+r:n-r,s=Math.abs(o-t)/2,a=o<t?o+s:o-s;return[i,a,r,s]}function Ou({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){if(i==="manual")return o;const s=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 s+a}function Bu({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=Yt(zt(e),zt(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return lt(s,Zt(i))>0}const Fu=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Xu=(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)),Yu=(e,t,n={})=>{if(!e.source||!e.target)return t;const o=n.getEdgeId||Fu;let r;return Hr(e)?r={...e}:r={...e,id:o(e)},Xu(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function qr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,a]=Gr({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}const _o={[Y.Left]:{x:-1,y:0},[Y.Right]:{x:1,y:0},[Y.Top]:{x:0,y:-1},[Y.Bottom]:{x:0,y:1}},Zu=({source:e,sourcePosition:t=Y.Bottom,target:n})=>t===Y.Left||t===Y.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},bo=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Wu({source:e,sourcePosition:t=Y.Bottom,target:n,targetPosition:o=Y.Top,center:r,offset:i,stepPosition:s}){const a=_o[t],l=_o[o],c={x:e.x+a.x*i,y:e.y+a.y*i},u={x:n.x+l.x*i,y:n.y+l.y*i},f=Zu({source:c,sourcePosition:t,target:u}),d=f.x!==0?"x":"y",h=f[d];let g=[],v,_;const x={x:0,y:0},b={x:0,y:0},[,,p,m]=Gr({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[d]*l[d]===-1){d==="x"?(v=r.x??c.x+(u.x-c.x)*s,_=r.y??(c.y+u.y)/2):(v=r.x??(c.x+u.x)/2,_=r.y??c.y+(u.y-c.y)*s);const S=[{x:v,y:c.y},{x:v,y:u.y}],N=[{x:c.x,y:_},{x:u.x,y:_}];a[d]===h?g=d==="x"?S:N:g=d==="x"?N:S}else{const S=[{x:c.x,y:u.y}],N=[{x:u.x,y:c.y}];if(d==="x"?g=a.x===h?N:S:g=a.y===h?S:N,t===o){const z=Math.abs(e[d]-n[d]);if(z<=i){const L=Math.min(i-1,i-z);a[d]===h?x[d]=(c[d]>e[d]?-1:1)*L:b[d]=(u[d]>n[d]?-1:1)*L}}if(t!==o){const z=d==="x"?"y":"x",L=a[d]===l[z],w=c[z]>u[z],M=c[z]<u[z];(a[d]===1&&(!L&&w||L&&M)||a[d]!==1&&(!L&&M||L&&w))&&(g=d==="x"?S:N)}const T={x:c.x+x.x,y:c.y+x.y},P={x:u.x+b.x,y:u.y+b.y},j=Math.max(Math.abs(T.x-g[0].x),Math.abs(P.x-g[0].x)),I=Math.max(Math.abs(T.y-g[0].y),Math.abs(P.y-g[0].y));j>=I?(v=(T.x+P.x)/2,_=g[0].y):(v=g[0].x,_=(T.y+P.y)/2)}return[[e,{x:c.x+x.x,y:c.y+x.y},...g,{x:u.x+b.x,y:u.y+b.y},n],v,_,p,m]}function Gu(e,t,n,o){const r=Math.min(bo(e,t)/2,bo(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const c=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${i+r*c},${s}Q ${i},${s} ${i},${s+r*u}`}const a=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${i},${s+r*l}Q ${i},${s} ${i+r*a},${s}`}function wn({sourceX:e,sourceY:t,sourcePosition:n=Y.Bottom,targetX:o,targetY:r,targetPosition:i=Y.Top,borderRadius:s=5,centerX:a,centerY:l,offset:c=20,stepPosition:u=.5}){const[f,d,h,g,v]=Wu({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:l},offset:c,stepPosition:u});return[f.reduce((x,b,p)=>{let m="";return p>0&&p<f.length-1?m=Gu(f[p-1],b,f[p+1],s):m=`${p===0?"M":"L"}${b.x} ${b.y}`,x+=m,x},""),d,h,g,v]}function So(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function qu(e){const{sourceNode:t,targetNode:n}=e;if(!So(t)||!So(n))return null;const o=t.internals.handleBounds||Eo(t.handles),r=n.internals.handleBounds||Eo(n.handles),i=Co(o?.source??[],e.sourceHandle),s=Co(e.connectionMode===We.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",be.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=i?.position||Y.Bottom,l=s?.position||Y.Top,c=je(t,i,a),u=je(n,s,l);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:l}}function Eo(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 je(e,t,n=Y.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??Ie(e);if(o)return{x:r+s/2,y:i+a/2};switch(t?.position??n){case Y.Top:return{x:r+s/2,y:i};case Y.Right:return{x:r+s,y:i+a/2};case Y.Bottom:return{x:r+s/2,y:i+a};case Y.Left:return{x:r,y:i+a/2}}}function Co(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function vn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function Uu(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((s,a)=>([a.markerStart||o,a.markerEnd||r].forEach(l=>{if(l&&typeof l=="object"){const c=vn(l,t);i.has(c)||(s.push({id:c,color:l.color||n,...l}),i.add(c))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const Ur=1e3,Ku=10,zn={nodeOrigin:[0,0],nodeExtent:at,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Qu={...zn,checkEquality:!0};function Hn(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function Ju(e,t,n){const o=Hn(zn,n);for(const r of e.values())if(r.parentId)Rn(r,e,t,o);else{const i=ht(r,o.nodeOrigin),s=Ue(r.extent)?r.extent:o.nodeExtent,a=Re(i,s,Ie(r));r.internals.positionAbsolute=a}}function ed(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const i={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(i):r.type==="target"&&o.push(i)}return{source:n,target:o}}function Ln(e){return e==="manual"}function _n(e,t,n,o={}){const r=Hn(Qu,o),i={i:0},s=new Map(t),a=r?.elevateNodesOnSelect&&!Ln(r.zIndexMode)?Ur:0;let l=e.length>0;t.clear(),n.clear();for(const c of e){let u=s.get(c.id);if(r.checkEquality&&c===u?.internals.userNode)t.set(c.id,u);else{const f=ht(c,r.nodeOrigin),d=Ue(c.extent)?c.extent:r.nodeExtent,h=Re(f,d,Ie(c));u={...r.defaults,...c,measured:{width:c.measured?.width,height:c.measured?.height},internals:{positionAbsolute:h,handleBounds:ed(c,u),z:Kr(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&&Rn(u,t,n,o,i)}return l}function td(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 Rn(e,t,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:l}=Hn(zn,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}td(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*Ku),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);const f=i&&!Ln(l)?Ur:0,{x:d,y:h,z:g}=nd(e,u,s,a,f,l),{positionAbsolute:v}=e.internals,_=d!==v.x||h!==v.y;(_||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:_?{x:d,y:h}:v,z:g}})}function Kr(e,t,n){const o=ye(e.zIndex)?e.zIndex:0;return Ln(n)?o:o+(e.selected?t:0)}function nd(e,t,n,o,r,i){const{x:s,y:a}=t.internals.positionAbsolute,l=Ie(e),c=ht(e,n),u=Ue(e.extent)?Re(c,e.extent,l):c;let f=Re({x:s+u.x,y:a+u.y},o,l);e.extent==="parent"&&(f=Rr(f,l,t));const d=Kr(e,r,i),h=t.internals.z??0;return{x:f.x,y:f.y,z:h>=d?h+1:d}}function jn(e,t,n,o=[0,0]){const r=[],i=new Map;for(const s of e){const a=t.get(s.parentId);if(!a)continue;const l=i.get(s.parentId)?.expandedRect??qe(a),c=Vr(l,s.rect);i.set(s.parentId,{expandedRect:c,parent:a})}return i.size>0&&i.forEach(({expandedRect:s,parent:a},l)=>{const c=a.internals.positionAbsolute,u=Ie(a),f=a.origin??o,d=s.x<c.x?Math.round(Math.abs(c.x-s.x)):0,h=s.y<c.y?Math.round(Math.abs(c.y-s.y)):0,g=Math.max(u.width,Math.round(s.width)),v=Math.max(u.height,Math.round(s.height)),_=(g-u.width)*f[0],x=(v-u.height)*f[1];(d>0||h>0||_||x)&&(r.push({id:l,type:"position",position:{x:a.position.x-d+_,y:a.position.y-h+x}}),n.get(l)?.forEach(b=>{e.some(p=>p.id===b.id)||r.push({id:b.id,type:"position",position:{x:b.position.x+d,y:b.position.y+h}})})),(u.width<s.width||u.height<s.height||d||h)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:g+(d?f[0]*d-_:0),height:v+(h?f[1]*h-x:0)}})}),r}function od(e,t,n,o,r,i,s){const a=o?.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const c=[],u=window.getComputedStyle(a),{m22:f}=new window.DOMMatrixReadOnly(u.transform),d=[];for(const h of e.values()){const g=t.get(h.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),l=!0;continue}const v=$n(h.nodeElement),_=g.measured.width!==v.width||g.measured.height!==v.height;if(!!(v.width&&v.height&&(_||!g.internals.handleBounds||h.force))){const b=h.nodeElement.getBoundingClientRect(),p=Ue(g.extent)?g.extent:i;let{positionAbsolute:m}=g.internals;g.parentId&&g.extent==="parent"?m=Rr(m,v,t.get(g.parentId)):p&&(m=Re(m,p,v));const C={...g,measured:v,internals:{...g.internals,positionAbsolute:m,handleBounds:{source:wo("source",h.nodeElement,b,f,g.id),target:wo("target",h.nodeElement,b,f,g.id)}}};t.set(g.id,C),g.parentId&&Rn(C,t,n,{nodeOrigin:r,zIndexMode:s}),l=!0,_&&(c.push({id:g.id,type:"dimensions",dimensions:v}),g.expandParent&&g.parentId&&d.push({id:g.id,parentId:g.parentId,rect:qe(C,r)}))}}if(d.length>0){const h=jn(d,t,n,r);c.push(...h)}return{changes:c,updatedInternals:l}}async function rd({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o),a=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(a)}function No(e,t,n,o,r,i){let s=r;const a=o.get(s)||new Map;o.set(s,a.set(n,t)),s=`${r}-${e}`;const l=o.get(s)||new Map;if(o.set(s,l.set(n,t)),i){s=`${r}-${e}-${i}`;const c=o.get(s)||new Map;o.set(s,c.set(n,t))}}function Qr(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,l={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},c=`${r}-${s}--${i}-${a}`,u=`${i}-${a}--${r}-${s}`;No("source",l,u,e,r,s),No("target",l,c,e,i,a),t.set(o.id,o)}}function Jr(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Jr(n,t):!1}function Mo(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 sd(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!Jr(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const a=e.get(i);a&&r.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function sn({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[s,a]of t){const l=n.get(s)?.internals.userNode;l&&r.push({...l,position:a.position,dragging:o})}if(!e)return[r[0],r];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function id({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},s=pt(i,t);return{x:s.x-i.x,y:s.y-i.y}}function ad({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,l=!1,c={x:0,y:0},u=null,f=!1,d=null,h=!1,g=!1,v=null;function _({noDragClassName:b,handleSelector:p,domNode:m,isSelectable:C,nodeId:S,nodeClickDistance:N=0}){d=he(m);function T({x:z,y:L}){const{nodeLookup:w,nodeExtent:M,snapGrid:E,snapToGrid:A,nodeOrigin:k,onNodeDrag:D,onSelectionDrag:$,onError:V,updateNodePositions:R}=t();i={x:z,y:L};let F=!1;const B=a.size>1,G=B&&M?xn(gt(a)):null,K=B&&A?id({dragItems:a,snapGrid:E,x:z,y:L}):null;for(const[Z,O]of a){if(!w.has(Z))continue;let X={x:z-O.distance.x,y:L-O.distance.y};A&&(X=K?{x:Math.round(X.x+K.x),y:Math.round(X.y+K.y)}:pt(X,E));let Q=null;if(B&&M&&!O.extent&&G){const{positionAbsolute:q}=O.internals,J=q.x-G.x+M[0][0],ne=q.x+O.measured.width-G.x2+M[1][0],te=q.y-G.y+M[0][1],se=q.y+O.measured.height-G.y2+M[1][1];Q=[[J,te],[ne,se]]}const{position:U,positionAbsolute:W}=Lr({nodeId:Z,nextPosition:X,nodeLookup:w,nodeExtent:Q||M,nodeOrigin:k,onError:V});F=F||O.position.x!==U.x||O.position.y!==U.y,O.position=U,O.internals.positionAbsolute=W}if(g=g||F,!!F&&(R(a,!0),v&&(o||D||!S&&$))){const[Z,O]=sn({nodeId:S,dragItems:a,nodeLookup:w});o?.(v,a,Z,O),D?.(v,Z,O),S||$?.(v,O)}}async function P(){if(!u)return;const{transform:z,panBy:L,autoPanSpeed:w,autoPanOnNodeDrag:M}=t();if(!M){l=!1,cancelAnimationFrame(s);return}const[E,A]=jr(c,u,w);(E!==0||A!==0)&&(i.x=(i.x??0)-E/z[2],i.y=(i.y??0)-A/z[2],await L({x:E,y:A})&&T(i)),s=requestAnimationFrame(P)}function j(z){const{nodeLookup:L,multiSelectionActive:w,nodesDraggable:M,transform:E,snapGrid:A,snapToGrid:k,selectNodesOnDrag:D,onNodeDragStart:$,onSelectionDragStart:V,unselectNodesAndEdges:R}=t();f=!0,(!D||!C)&&!w&&S&&(L.get(S)?.selected||R()),C&&D&&S&&e?.(S);const F=ot(z.sourceEvent,{transform:E,snapGrid:A,snapToGrid:k,containerBounds:u});if(i=F,a=sd(L,M,F,S),a.size>0&&(n||$||!S&&V)){const[B,G]=sn({nodeId:S,dragItems:a,nodeLookup:L});n?.(z.sourceEvent,a,B,G),$?.(z.sourceEvent,B,G),S||V?.(z.sourceEvent,G)}}const I=vr().clickDistance(N).on("start",z=>{const{domNode:L,nodeDragThreshold:w,transform:M,snapGrid:E,snapToGrid:A}=t();u=L?.getBoundingClientRect()||null,h=!1,g=!1,v=z.sourceEvent,w===0&&j(z),i=ot(z.sourceEvent,{transform:M,snapGrid:E,snapToGrid:A,containerBounds:u}),c=xe(z.sourceEvent,u)}).on("drag",z=>{const{autoPanOnNodeDrag:L,transform:w,snapGrid:M,snapToGrid:E,nodeDragThreshold:A,nodeLookup:k}=t(),D=ot(z.sourceEvent,{transform:w,snapGrid:M,snapToGrid:E,containerBounds:u});if(v=z.sourceEvent,(z.sourceEvent.type==="touchmove"&&z.sourceEvent.touches.length>1||S&&!k.has(S))&&(h=!0),!h){if(!l&&L&&f&&(l=!0,P()),!f){const $=xe(z.sourceEvent,u),V=$.x-c.x,R=$.y-c.y;Math.sqrt(V*V+R*R)>A&&j(z)}(i.x!==D.xSnapped||i.y!==D.ySnapped)&&a&&f&&(c=xe(z.sourceEvent,u),T(D))}}).on("end",z=>{if(!(!f||h)&&(l=!1,f=!1,cancelAnimationFrame(s),a.size>0)){const{nodeLookup:L,updateNodePositions:w,onNodeDragStop:M,onSelectionDragStop:E}=t();if(g&&(w(a,!1),g=!1),r||M||!S&&E){const[A,k]=sn({nodeId:S,dragItems:a,nodeLookup:L,dragging:!1});r?.(z.sourceEvent,a,A,k),M?.(z.sourceEvent,A,k),S||E?.(z.sourceEvent,k)}}}).filter(z=>{const L=z.target;return!z.button&&(!b||!Mo(L,`.${b}`,m))&&(!p||Mo(L,p,m))});d.call(I)}function x(){d?.on(".drag",null)}return{update:_,destroy:x}}function cd(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())lt(r,qe(i))>0&&o.push(i);return o}const ld=250;function ud(e,t,n,o){let r=[],i=1/0;const s=cd(e,n,t+ld);for(const a of s){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:f}=je(a,c,c.position,!0),d=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(f-e.y,2));d>t||(d<i?(r=[{...c,x:u,y:f}],i=d):d===i&&r.push({...c,x:u,y:f}))}}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 es(e,t,n,o,r,i=!1){const s=o.get(e);if(!s)return null;const a=r==="strict"?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],l=(n?a?.find(c=>c.id===n):a?.[0])??null;return l&&i?{...l,...je(s,l,l.position,!0)}:l}function ts(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function dd(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const ns=()=>!0;function fd(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:u,flowId:f,panBy:d,cancelConnection:h,onConnectStart:g,onConnect:v,onConnectEnd:_,isValidConnection:x=ns,onReconnectEnd:b,updateConnection:p,getTransform:m,getFromHandle:C,autoPanSpeed:S,dragThreshold:N=1,handleDomNode:T}){const P=Fr(e.target);let j=0,I;const{x:z,y:L}=xe(e),w=ts(i,T),M=a?.getBoundingClientRect();let E=!1;if(!M||!w)return;const A=es(r,w,o,l,t);if(!A)return;let k=xe(e,M),D=!1,$=null,V=!1,R=null;function F(){if(!u||!M)return;const[U,W]=jr(k,M,S);d({x:U,y:W}),j=requestAnimationFrame(F)}const B={...A,nodeId:r,type:w,position:A.position},G=l.get(r);let Z={inProgress:!0,isValid:null,from:je(G,B,Y.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:G,to:k,toHandle:null,toPosition:po[B.position],toNode:null,pointer:k};function O(){E=!0,p(Z),g?.(e,{nodeId:r,handleId:o,handleType:w})}N===0&&O();function X(U){if(!E){const{x:se,y:le}=xe(U),ce=se-z,de=le-L;if(!(ce*ce+de*de>N*N))return;O()}if(!C()||!B){Q(U);return}const W=m();k=xe(U,M),I=ud(mt(k,W,!1,[1,1]),n,l,B),D||(F(),D=!0);const q=os(U,{handle:I,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:x,doc:P,lib:c,flowId:f,nodeLookup:l});R=q.handleDomNode,$=q.connection,V=dd(!!I,q.isValid);const J=l.get(r),ne=J?je(J,B,Y.Left,!0):Z.from,te={...Z,from:ne,isValid:V,to:q.toHandle&&V?Ht({x:q.toHandle.x,y:q.toHandle.y},W):k,toHandle:q.toHandle,toPosition:V&&q.toHandle?q.toHandle.position:po[B.position],toNode:q.toHandle?l.get(q.toHandle.nodeId):null,pointer:k};p(te),Z=te}function Q(U){if(!("touches"in U&&U.touches.length>0)){if(E){(I||R)&&$&&V&&v?.($);const{inProgress:W,...q}=Z,J={...q,toPosition:Z.toHandle?Z.toPosition:null};_?.(U,J),i&&b?.(U,J)}h(),cancelAnimationFrame(j),D=!1,V=!1,$=null,R=null,P.removeEventListener("mousemove",X),P.removeEventListener("mouseup",Q),P.removeEventListener("touchmove",X),P.removeEventListener("touchend",Q)}}P.addEventListener("mousemove",X),P.addEventListener("mouseup",Q),P.addEventListener("touchmove",X),P.addEventListener("touchend",Q)}function os(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:l,isValidConnection:c=ns,nodeLookup:u}){const f=i==="target",d=t?s.querySelector(`.${a}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:g}=xe(e),v=s.elementFromPoint(h,g),_=v?.classList.contains(`${a}-flow__handle`)?v:d,x={handleDomNode:_,isValid:!1,connection:null,toHandle:null};if(_){const b=ts(void 0,_),p=_.getAttribute("data-nodeid"),m=_.getAttribute("data-handleid"),C=_.classList.contains("connectable"),S=_.classList.contains("connectableend");if(!p||!b)return x;const N={source:f?p:o,sourceHandle:f?m:r,target:f?o:p,targetHandle:f?r:m};x.connection=N;const P=C&&S&&(n===We.Strict?f&&b==="source"||!f&&b==="target":p!==o||m!==r);x.isValid=P&&c(N),x.toHandle=es(p,b,m,u,n,!0)}return x}const bn={onPointerDown:fd,isValid:os};function hd({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=he(e);function i({translateExtent:a,width:l,height:c,zoomStep:u=1,pannable:f=!0,zoomable:d=!0,inversePan:h=!1}){const g=p=>{if(p.sourceEvent.type!=="wheel"||!t)return;const m=n(),C=p.sourceEvent.ctrlKey&&ut()?10:1,S=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*u,N=m[2]*Math.pow(2,S*C);t.scaleTo(N)};let v=[0,0];const _=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(v=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},x=p=>{const m=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;const C=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],S=[C[0]-v[0],C[1]-v[1]];v=C;const N=o()*Math.max(m[2],Math.log(m[2]))*(h?-1:1),T={x:m[0]-S[0]*N,y:m[1]-S[1]*N},P=[[0,0],[l,c]];t.setViewportConstrained({x:T.x,y:T.y,zoom:m[2]},P,a)},b=Pr().on("start",_).on("zoom",f?x:null).on("zoom.wheel",d?g:null);r.call(b,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:me}}const Wt=e=>({x:e.x,y:e.y,zoom:e.k}),an=({x:e,y:t,zoom:n})=>Xt.translate(e,t).scale(n),Be=(e,t)=>e.target.closest(`.${t}`),rs=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),gd=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,cn=(e,t=0,n=gd,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},ss=e=>{const t=e.ctrlKey&&ut()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function pd({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return u=>{if(Be(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(u.ctrlKey&&s){const _=me(u),x=ss(u),b=f*Math.pow(2,x);o.scaleTo(n,b,_,u);return}const d=u.deltaMode===1?20:1;let h=r===He.Vertical?0:u.deltaX*d,g=r===He.Horizontal?0:u.deltaY*d;!ut()&&u.shiftKey&&r!==He.Vertical&&(h=u.deltaY*d,g=0),o.translateBy(n,-(h/f)*i,-(g/f)*i,{internal:!0});const v=Wt(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(l?.(u,v),e.panScrollTimeout=setTimeout(()=>{c?.(u,v),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a?.(u,v))}}function md({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,a=Be(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function yd({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=Wt(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 xd({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&rs(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,Wt(i.transform))}}function wd({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&rs(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const a=Wt(s.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,a)},n?150:0)}}}function vd({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:l,lib:c,connectionInProgress:u}){return f=>{const d=e||t,h=n&&f.ctrlKey,g=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(Be(f,`${c}-flow__node`)||Be(f,`${c}-flow__edge`)))return!0;if(!o&&!d&&!r&&!i&&!n||s||u&&!g||Be(f,a)&&g||Be(f,l)&&(!g||r&&g&&!e)||!n&&f.ctrlKey&&g)return!1;if(!n&&f.type==="touchstart"&&f.touches?.length>1)return f.preventDefault(),!1;if(!d&&!r&&!h&&g||!o&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(o)&&!o.includes(f.button)&&f.type==="mousedown")return!1;const v=Array.isArray(o)&&o.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||g)&&v}}function _d({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:l}){const c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),f=Pr().scaleExtent([t,n]).translateExtent(o),d=he(e).call(f);b({x:r.x,y:r.y,zoom:Ge(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);const h=d.on("wheel.zoom"),g=d.on("dblclick.zoom");f.wheelDelta(ss);function v(I,z){return d?new Promise(L=>{f?.interpolate(z?.interpolate==="linear"?tn:Nt).transform(cn(d,z?.duration,z?.ease,()=>L(!0)),I)}):Promise.resolve(!1)}function _({noWheelClassName:I,noPanClassName:z,onPaneContextMenu:L,userSelectionActive:w,panOnScroll:M,panOnDrag:E,panOnScrollMode:A,panOnScrollSpeed:k,preventScrolling:D,zoomOnPinch:$,zoomOnScroll:V,zoomOnDoubleClick:R,zoomActivationKeyPressed:F,lib:B,onTransformChange:G,connectionInProgress:K,paneClickDistance:Z,selectionOnDrag:O}){w&&!c.isZoomingOrPanning&&x();const X=M&&!F&&!w;f.clickDistance(O?1/0:!ye(Z)||Z<0?0:Z);const Q=X?pd({zoomPanValues:c,noWheelClassName:I,d3Selection:d,d3Zoom:f,panOnScrollMode:A,panOnScrollSpeed:k,zoomOnPinch:$,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):md({noWheelClassName:I,preventScrolling:D,d3ZoomHandler:h});if(d.on("wheel.zoom",Q,{passive:!1}),!w){const W=yd({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:s});f.on("start",W);const q=xd({zoomPanValues:c,panOnDrag:E,onPaneContextMenu:!!L,onPanZoom:i,onTransformChange:G});f.on("zoom",q);const J=wd({zoomPanValues:c,panOnDrag:E,panOnScroll:M,onPaneContextMenu:L,onPanZoomEnd:a,onDraggingChange:l});f.on("end",J)}const U=vd({zoomActivationKeyPressed:F,panOnDrag:E,zoomOnScroll:V,panOnScroll:M,zoomOnDoubleClick:R,zoomOnPinch:$,userSelectionActive:w,noPanClassName:z,noWheelClassName:I,lib:B,connectionInProgress:K});f.filter(U),R?d.on("dblclick.zoom",g):d.on("dblclick.zoom",null)}function x(){f.on("zoom",null)}async function b(I,z,L){const w=an(I),M=f?.constrain()(w,z,L);return M&&await v(M),new Promise(E=>E(M))}async function p(I,z){const L=an(I);return await v(L,z),new Promise(w=>w(L))}function m(I){if(d){const z=an(I),L=d.property("__zoom");(L.k!==I.zoom||L.x!==I.x||L.y!==I.y)&&f?.transform(d,z,null,{sync:!0})}}function C(){const I=d?Ar(d.node()):{x:0,y:0,k:1};return{x:I.x,y:I.y,zoom:I.k}}function S(I,z){return d?new Promise(L=>{f?.interpolate(z?.interpolate==="linear"?tn:Nt).scaleTo(cn(d,z?.duration,z?.ease,()=>L(!0)),I)}):Promise.resolve(!1)}function N(I,z){return d?new Promise(L=>{f?.interpolate(z?.interpolate==="linear"?tn:Nt).scaleBy(cn(d,z?.duration,z?.ease,()=>L(!0)),I)}):Promise.resolve(!1)}function T(I){f?.scaleExtent(I)}function P(I){f?.translateExtent(I)}function j(I){const z=!ye(I)||I<0?0:I;f?.clickDistance(z)}return{update:_,destroy:x,setViewport:p,setViewportConstrained:b,getViewport:C,scaleTo:S,scaleBy:N,setScaleExtent:T,setTranslateExtent:P,syncViewport:m,setClickDistance:j}}var Ke;(function(e){e.Line="line",e.Handle="handle"})(Ke||(Ke={}));function bd({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,a=n-o,l=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(l[0]=l[0]*-1),a&&i&&(l[1]=l[1]*-1),l}function Io(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 ke(e,t){return Math.max(0,t-e)}function Ae(e,t){return Math.max(0,e-t)}function _t(e,t,n){return Math.max(0,t-e,e-n)}function ko(e,t){return e?!t:t}function Sd(e,t,n,o,r,i,s,a){let{affectsX:l,affectsY:c}=t;const{isHorizontal:u,isVertical:f}=t,d=u&&f,{xSnapped:h,ySnapped:g}=n,{minWidth:v,maxWidth:_,minHeight:x,maxHeight:b}=o,{x:p,y:m,width:C,height:S,aspectRatio:N}=e;let T=Math.floor(u?h-e.pointerX:0),P=Math.floor(f?g-e.pointerY:0);const j=C+(l?-T:T),I=S+(c?-P:P),z=-i[0]*C,L=-i[1]*S;let w=_t(j,v,_),M=_t(I,x,b);if(s){let k=0,D=0;l&&T<0?k=ke(p+T+z,s[0][0]):!l&&T>0&&(k=Ae(p+j+z,s[1][0])),c&&P<0?D=ke(m+P+L,s[0][1]):!c&&P>0&&(D=Ae(m+I+L,s[1][1])),w=Math.max(w,k),M=Math.max(M,D)}if(a){let k=0,D=0;l&&T>0?k=Ae(p+T,a[0][0]):!l&&T<0&&(k=ke(p+j,a[1][0])),c&&P>0?D=Ae(m+P,a[0][1]):!c&&P<0&&(D=ke(m+I,a[1][1])),w=Math.max(w,k),M=Math.max(M,D)}if(r){if(u){const k=_t(j/N,x,b)*N;if(w=Math.max(w,k),s){let D=0;!l&&!c||l&&!c&&d?D=Ae(m+L+j/N,s[1][1])*N:D=ke(m+L+(l?T:-T)/N,s[0][1])*N,w=Math.max(w,D)}if(a){let D=0;!l&&!c||l&&!c&&d?D=ke(m+j/N,a[1][1])*N:D=Ae(m+(l?T:-T)/N,a[0][1])*N,w=Math.max(w,D)}}if(f){const k=_t(I*N,v,_)/N;if(M=Math.max(M,k),s){let D=0;!l&&!c||c&&!l&&d?D=Ae(p+I*N+z,s[1][0])/N:D=ke(p+(c?P:-P)*N+z,s[0][0])/N,M=Math.max(M,D)}if(a){let D=0;!l&&!c||c&&!l&&d?D=ke(p+I*N,a[1][0])/N:D=Ae(p+(c?P:-P)*N,a[0][0])/N,M=Math.max(M,D)}}}P=P+(P<0?M:-M),T=T+(T<0?w:-w),r&&(d?j>I*N?P=(ko(l,c)?-T:T)/N:T=(ko(l,c)?-P:P)*N:u?(P=T/N,c=l):(T=P*N,l=c));const E=l?p+T:p,A=c?m+P:m;return{width:C+(l?-T:T),height:S+(c?-P:P),x:i[0]*T*(l?-1:1)+E,y:i[1]*P*(c?-1:1)+A}}const is={width:0,height:0,x:0,y:0},Ed={...is,pointerX:0,pointerY:0,aspectRatio:1};function Cd(e){return[[0,0],[e.measured.width,e.measured.height]]}function Nd(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,l=n[1]*s;return[[o-a,r-l],[o+i-a,r+s-l]]}function Md({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=he(e);let s={controlDirection:Io("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:f,resizeDirection:d,onResizeStart:h,onResize:g,onResizeEnd:v,shouldResize:_}){let x={...is},b={...Ed};s={boundaries:u,resizeDirection:d,keepAspectRatio:f,controlDirection:Io(c)};let p,m=null,C=[],S,N,T,P=!1;const j=vr().on("start",I=>{const{nodeLookup:z,transform:L,snapGrid:w,snapToGrid:M,nodeOrigin:E,paneDomNode:A}=n();if(p=z.get(t),!p)return;m=A?.getBoundingClientRect()??null;const{xSnapped:k,ySnapped:D}=ot(I.sourceEvent,{transform:L,snapGrid:w,snapToGrid:M,containerBounds:m});x={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},b={...x,pointerX:k,pointerY:D,aspectRatio:x.width/x.height},S=void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(S=z.get(p.parentId),N=S&&p.extent==="parent"?Cd(S):void 0),C=[],T=void 0;for(const[$,V]of z)if(V.parentId===t&&(C.push({id:$,position:{...V.position},extent:V.extent}),V.extent==="parent"||V.expandParent)){const R=Nd(V,p,V.origin??E);T?T=[[Math.min(R[0][0],T[0][0]),Math.min(R[0][1],T[0][1])],[Math.max(R[1][0],T[1][0]),Math.max(R[1][1],T[1][1])]]:T=R}h?.(I,{...x})}).on("drag",I=>{const{transform:z,snapGrid:L,snapToGrid:w,nodeOrigin:M}=n(),E=ot(I.sourceEvent,{transform:z,snapGrid:L,snapToGrid:w,containerBounds:m}),A=[];if(!p)return;const{x:k,y:D,width:$,height:V}=x,R={},F=p.origin??M,{width:B,height:G,x:K,y:Z}=Sd(b,s.controlDirection,E,s.boundaries,s.keepAspectRatio,F,N,T),O=B!==$,X=G!==V,Q=K!==k&&O,U=Z!==D&&X;if(!Q&&!U&&!O&&!X)return;if((Q||U||F[0]===1||F[1]===1)&&(R.x=Q?K:x.x,R.y=U?Z:x.y,x.x=R.x,x.y=R.y,C.length>0)){const ne=K-k,te=Z-D;for(const se of C)se.position={x:se.position.x-ne+F[0]*(B-$),y:se.position.y-te+F[1]*(G-V)},A.push(se)}if((O||X)&&(R.width=O&&(!s.resizeDirection||s.resizeDirection==="horizontal")?B:x.width,R.height=X&&(!s.resizeDirection||s.resizeDirection==="vertical")?G: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,b.x=b.x-(R.x-ne));const te=F[1]*(R.height??0);R.y&&R.y<te&&(x.y=te,b.y=b.y-(R.y-te))}const W=bd({width:x.width,prevWidth:$,height:x.height,prevHeight:V,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),q={...x,direction:W};_?.(I,q)!==!1&&(P=!0,g?.(I,q),o(R,A))}).on("end",I=>{P&&(v?.(I,{...x}),r?.({...x}),P=!1)});i.call(j)}function l(){i.on(".drag",null)}return{update:a,destroy:l}}const Id={},Ao=e=>{let t;const n=new Set,o=(u,f)=>{const d=typeof u=="function"?u(t):u;if(!Object.is(d,t)){const h=t;t=f??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(g=>g(t,h))}},r=()=>t,l={setState:o,getState:r,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(Id?"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},kd=e=>e?Ao(e):Ao,{useDebugValue:Ad}=Wi,{useSyncExternalStoreWithSelector:Pd}=Zi,Td=e=>e;function as(e,t=Td,n){const o=Pd(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Ad(o),o}const Po=(e,t)=>{const n=kd(e),o=(r,i=t)=>as(n,r,i);return Object.assign(o,n),o},Dd=(e,t)=>e?Po(e,t):Po;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 Gt=H.createContext(null),$d=Gt.Provider,cs=be.error001();function ee(e,t){const n=H.useContext(Gt);if(n===null)throw new Error(cs);return as(n,e,t)}function re(){const e=H.useContext(Gt);if(e===null)throw new Error(cs);return H.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const To={display:"none"},zd={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},ls="react-flow__node-desc",us="react-flow__edge-desc",Hd="react-flow__aria-live",Ld=e=>e.ariaLiveMessage,Rd=e=>e.ariaLabelConfig;function jd({rfId:e}){const t=ee(Ld);return y.jsx("div",{id:`${Hd}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:zd,children:t})}function Vd({rfId:e,disableKeyboardA11y:t}){const n=ee(Rd);return y.jsxs(y.Fragment,{children:[y.jsx("div",{id:`${ls}-${e}`,style:To,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),y.jsx("div",{id:`${us}-${e}`,style:To,children:n["edge.a11yDescription.default"]}),!t&&y.jsx(jd,{rfId:e})]})}const qt=H.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return y.jsx("div",{className:ae(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});qt.displayName="Panel";function Od({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:y.jsx(qt,{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:y.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Bd=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}},bt=e=>e.id;function Fd(e,t){return oe(e.selectedNodes.map(bt),t.selectedNodes.map(bt))&&oe(e.selectedEdges.map(bt),t.selectedEdges.map(bt))}function Xd({onSelectionChange:e}){const t=re(),{selectedNodes:n,selectedEdges:o}=ee(Bd,Fd);return H.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}const Yd=e=>!!e.onSelectionChangeHandlers;function Zd({onSelectionChange:e}){const t=ee(Yd);return e||t?y.jsx(Xd,{onSelectionChange:e}):null}const ds=[0,0],Wd={x:0,y:0,zoom:1},Gd=["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"],Do=[...Gd,"rfId"],qd=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}),$o={translateExtent:at,nodeOrigin:ds,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Ud(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:l}=ee(qd,oe),c=re();H.useEffect(()=>(l(e.defaultNodes,e.defaultEdges),()=>{u.current=$o,a()}),[]);const u=H.useRef($o);return H.useEffect(()=>{for(const f of Do){const d=e[f],h=u.current[f];d!==h&&(typeof e[f]>"u"||(f==="nodes"?t(d):f==="edges"?n(d):f==="minZoom"?o(d):f==="maxZoom"?r(d):f==="translateExtent"?i(d):f==="nodeExtent"?s(d):f==="ariaLabelConfig"?c.setState({ariaLabelConfig:ju(d)}):f==="fitView"?c.setState({fitViewQueued:d}):f==="fitViewOptions"?c.setState({fitViewOptions:d}):c.setState({[f]:d})))}u.current=e},Do.map(f=>e[f])),null}function zo(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Kd(e){const[t,n]=H.useState(e==="system"?null:e);return H.useEffect(()=>{if(e!=="system"){n(e);return}const o=zo(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:zo()?.matches?"dark":"light"}const Ho=typeof document<"u"?document:null;function dt(e=null,t={target:Ho,actInsideInputWithModifier:!0}){const[n,o]=H.useState(!1),r=H.useRef(!1),i=H.useRef(new Set([])),[s,a]=H.useMemo(()=>{if(e!==null){const c=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",`
2
2
  `).replace(`
3
3
 
4
4
  `,`