ghost 6.40.0 → 6.41.0

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 (184) hide show
  1. package/core/boot.js +8 -8
  2. package/core/built/admin/assets/{PolarAngleAxis-D7m1zwVk.js → PolarAngleAxis-Bh28wbPV.js} +1 -1
  3. package/core/built/admin/assets/{_baseAssignValue-BDsvYKNK.js → _baseAssignValue-hdDG700N.js} +1 -1
  4. package/core/built/admin/assets/{a-large-small-DxRNdz0F.js → a-large-small-BiK5_5LV.js} +1 -1
  5. package/core/built/admin/assets/{account-migration-SYnE1jBW.js → account-migration-DsSHanIB.js} +1 -1
  6. package/core/built/admin/assets/admin-x-settings/admin-x-settings.js +1 -1
  7. package/core/built/admin/assets/admin-x-settings/{code-editor-view-Bj9rgbLw.mjs → code-editor-view-BEIdFhw3.mjs} +2 -2
  8. package/core/built/admin/assets/admin-x-settings/{index-BrZ9YAzd.mjs → index-BEh3nFEy.mjs} +3 -3
  9. package/core/built/admin/assets/admin-x-settings/{index-DRndIh9T.mjs → index-BLF2n6YB.mjs} +2 -2
  10. package/core/built/admin/assets/admin-x-settings/{index-CIl25Teq.mjs → index-BmPIWs5F.mjs} +3 -3
  11. package/core/built/admin/assets/admin-x-settings/{index-CNyNY3Wh.mjs → index-CP9YnNzc.mjs} +3 -3
  12. package/core/built/admin/assets/admin-x-settings/{index-SGr5sE2h.mjs → index-Cd2Ns-D2.mjs} +2 -2
  13. package/core/built/admin/assets/admin-x-settings/{index-PGoLP2kh.mjs → index-CjqAcKpK.mjs} +5 -5
  14. package/core/built/admin/assets/admin-x-settings/{index-pCIv_7bB.mjs → index-CnMcD9aj.mjs} +6212 -6158
  15. package/core/built/admin/assets/admin-x-settings/{index-CPCcgad-.mjs → index-LzsrZC40.mjs} +3 -3
  16. package/core/built/admin/assets/admin-x-settings/{index-DPqY4h5h.mjs → index-ZYW0UW7I.mjs} +3 -3
  17. package/core/built/admin/assets/admin-x-settings/{modals-lo32WZLi.mjs → modals-C48Tq1rW.mjs} +9 -9
  18. package/core/built/admin/assets/{arrow-right-BixoEua4.js → arrow-right-Bk43nMGd.js} +1 -1
  19. package/core/built/admin/assets/{at-sign-BsHNViA_.js → at-sign-DWOf36uj.js} +1 -1
  20. package/core/built/admin/assets/{audience-0RCWjbIK.js → audience-CvP78Gug.js} +1 -1
  21. package/core/built/admin/assets/{automations-DTUfYvf6.js → automations-BBWZhrha.js} +1 -1
  22. package/core/built/admin/assets/{automations-DiGkcVt-.js → automations-CmulGWwu.js} +1 -1
  23. package/core/built/admin/assets/{avatar-flipboard-BgoH-wIq.js → avatar-flipboard-CVf-N6wp.js} +1 -1
  24. package/core/built/admin/assets/{bluesky-sharing-C2xwSoS-.js → bluesky-sharing-DVC3I9Um.js} +1 -1
  25. package/core/built/admin/assets/{chart-X5cLIH1X.js → chart-CUKSNmKY.js} +1 -1
  26. package/core/built/admin/assets/{checkbox-DMamS4oG.js → checkbox-B_yDSM8z.js} +1 -1
  27. package/core/built/admin/assets/{chevron-up-CVgBkTk5.js → chevron-up-DuaKtE_M.js} +1 -1
  28. package/core/built/admin/assets/{chunk.941.f47098cbbce89a049e03.js → chunk.331.2ec2e2702eda02de96cd.js} +3 -3
  29. package/core/built/admin/assets/{chunk.524.a1d668dcc84709a5d702.js → chunk.524.49cc01002e1a5dba8ef9.js} +4 -4
  30. package/core/built/admin/assets/{chunk.582.180bf2525cf552f5ac5f.js → chunk.582.4bbc54c5f7d3dfb93288.js} +6 -6
  31. package/core/built/admin/assets/{circle-alert-Dg3UkvRP.js → circle-alert-bcK_Yqap.js} +1 -1
  32. package/core/built/admin/assets/{code-editor-view-CAICoZJe.js → code-editor-view-Bl4Jzjhk.js} +1 -1
  33. package/core/built/admin/assets/{comments-BHru9ZQ8.js → comments-DMea0nul.js} +1 -1
  34. package/core/built/admin/assets/{content-helpers-BByMp-Y5.js → content-helpers-B2yRzdvJ.js} +1 -1
  35. package/core/built/admin/assets/{copy-D7jqplrv.js → copy-DVtQi_VJ.js} +1 -1
  36. package/core/built/admin/assets/{data-list-DUaY9nlT.js → data-list-BF4GeUmt.js} +1 -1
  37. package/core/built/admin/assets/{deleted-feed-item-jLcSKuul.js → deleted-feed-item-DO2u3qmi.js} +1 -1
  38. package/core/built/admin/assets/{dropzone-DSPf3N_o.js → dropzone-Cs4DrURS.js} +1 -1
  39. package/core/built/admin/assets/{edit-profile-BvU2-lW5.js → edit-profile-CnuBNQhO.js} +1 -1
  40. package/core/built/admin/assets/{editor-D3fcjt_F.js → editor-CTO9FIUW.js} +1 -1
  41. package/core/built/admin/assets/{empty-indicator-2Pjmce3n.js → empty-indicator-BvyaMcmw.js} +1 -1
  42. package/core/built/admin/assets/{en-Bu-6PYn5.js → en-CjPXRj8j.js} +1 -1
  43. package/core/built/admin/assets/{feed-CygLK1Ad.js → feed-D2wk4cCS.js} +1 -1
  44. package/core/built/admin/assets/{filter-query-core-a0PNU2EO.js → filter-query-core-VEnwTCyO.js} +1 -1
  45. package/core/built/admin/assets/{filters-jiyRsLMH.js → filters-DtIsuqv5.js} +1 -1
  46. package/core/built/admin/assets/{gh-chart-CEhBBu3F.js → gh-chart-JxzKqaoO.js} +1 -1
  47. package/core/built/admin/assets/{ghost-0ab96884815339963364804ab266c99f.js → ghost-30c3dedbe1cca943b92efa7efd2710e4.js} +36 -21
  48. package/core/built/admin/assets/{growth-Fz3Oatml.js → growth-CPNrBpHK.js} +1 -1
  49. package/core/built/admin/assets/{hash-CeFrjo3C.js → hash-CJzbTA5k.js} +1 -1
  50. package/core/built/admin/assets/{inbox-CCirPaG2.js → inbox-CVVAkCmd.js} +1 -1
  51. package/core/built/admin/assets/{index-Dd2BJRZH.js → index-AkQJUr1z.js} +1 -1
  52. package/core/built/admin/assets/{index-CYPN5csJ.js → index-BLWOUf31.js} +1 -1
  53. package/core/built/admin/assets/{index-D7Ui3Fih.js → index-BRBRkRqa.js} +1 -1
  54. package/core/built/admin/assets/{index-CFEzD2_M.js → index-BkbhBpVC.js} +3 -3
  55. package/core/built/admin/assets/{index-BYwL7gFN.js → index-BxFFWYdP.js} +1 -1
  56. package/core/built/admin/assets/{index-D3LfHeBl.js → index-C5_ZKpC1.js} +1 -1
  57. package/core/built/admin/assets/{index-Bjw2qAph.js → index-Cdbufdfy.js} +1 -1
  58. package/core/built/admin/assets/{index-BTf6YUBb.js → index-Cq5vsvxE.js} +1 -1
  59. package/core/built/admin/assets/{index-DPbi4ie_.js → index-CuGoX8Ub.js} +1 -1
  60. package/core/built/admin/assets/{index-CsaU9dfl.js → index-CuH5raTz.js} +1 -1
  61. package/core/built/admin/assets/{index-Bf83suMc.js → index-D3A8RTi0.js} +1 -1
  62. package/core/built/admin/assets/{index-Dskrbhv3.js → index-DIyK69JM.js} +1 -1
  63. package/core/built/admin/assets/{index-GExKMpy_.js → index-DLFVpwt3.js} +1 -1
  64. package/core/built/admin/assets/{index-BOMdiHRG.js → index-DQZp_NsL.js} +1 -1
  65. package/core/built/admin/assets/{index-2qcjFCQs.js → index-DR74ulj2.js} +1 -1
  66. package/core/built/admin/assets/{index-WKMARia9.js → index-DYE2untj.js} +1 -1
  67. package/core/built/admin/assets/{index-DNZUJQ8v.js → index-DssW7xhk.js} +1 -1
  68. package/core/built/admin/assets/{index-Cq4mS7QK.js → index-DvyNqFct.js} +1 -1
  69. package/core/built/admin/assets/{index-C7xLyJVb.js → index-DxB7NHpG.js} +1 -1
  70. package/core/built/admin/assets/{index-Bw4DM4Pr.js → index-IDaHqjnu.js} +1 -1
  71. package/core/built/admin/assets/{index-ClOB5u8L.js → index-TtBMzSeP.js} +1 -1
  72. package/core/built/admin/assets/{index-takfwHSn.js → index-UMWVIyz7.js} +1 -1
  73. package/core/built/admin/assets/{koenig-lexical-BJM9wAwQ.js → koenig-lexical-DVAmevhl.js} +1 -1
  74. package/core/built/admin/assets/{kpi-card-BP-2yicn.js → kpi-card-D3CzvsrI.js} +1 -1
  75. package/core/built/admin/assets/{kpi-card-DOplXdDT.js → kpi-card-DV-nN7xT.js} +1 -1
  76. package/core/built/admin/assets/{kpi-tabs-Rq5jJW2Z.js → kpi-tabs-B3NkaTwb.js} +1 -1
  77. package/core/built/admin/assets/{kpis-yHgME_iy.js → kpis-CVwF08QL.js} +1 -1
  78. package/core/built/admin/assets/{label-fijjy1Mb.js → label-BiPpMny2.js} +1 -1
  79. package/core/built/admin/assets/{links-s3IeAkbo.js → links-BY0Uo6O5.js} +1 -1
  80. package/core/built/admin/assets/{list-page-CUcB5ebB.js → list-page-COHNMpOi.js} +1 -1
  81. package/core/built/admin/assets/{loader-circle-C7mWzo52.js → loader-circle-B1uEfpbZ.js} +1 -1
  82. package/core/built/admin/assets/{mail-9TFkAaAh.js → mail-ccQhEr7k.js} +1 -1
  83. package/core/built/admin/assets/{main-layout-XtviVkg1.js → main-layout-BYKdA6Z1.js} +1 -1
  84. package/core/built/admin/assets/{members-XkHao5Yf.js → members-DkpEnvG5.js} +1 -1
  85. package/core/built/admin/assets/minus-C68D81nx.js +1 -0
  86. package/core/built/admin/assets/{modals-B6R7oqvb.js → modals-X6RSWn5Y.js} +3 -3
  87. package/core/built/admin/assets/{moderation-B2Tixfce.js → moderation-BFrrwfvx.js} +1 -1
  88. package/core/built/admin/assets/{newsletter-CbESXhxf.js → newsletter-n7kc6cxR.js} +1 -1
  89. package/core/built/admin/assets/{newsletters-DOIL_cOY.js → newsletters-CSCa3QdE.js} +1 -1
  90. package/core/built/admin/assets/{note-mUikaB-p.js → note-CMZjeK8e.js} +1 -1
  91. package/core/built/admin/assets/{onboarding-route-Dqv2nP7b.js → onboarding-route-BaX0a-pu.js} +1 -1
  92. package/core/built/admin/assets/{overview-yZ-7KJdx.js → overview-CS9dmE_6.js} +1 -1
  93. package/core/built/admin/assets/{pagemenu-TxGvHwRO.js → pagemenu-O_y8Jm4v.js} +1 -1
  94. package/core/built/admin/assets/{pencil-CKTgzafp.js → pencil-BcymGPnE.js} +1 -1
  95. package/core/built/admin/assets/{pin-BU_u-xRX.js → pin-Bl3nSr7I.js} +1 -1
  96. package/core/built/admin/assets/{post-analytics-CWA8invj.js → post-analytics-DW-TKu-t.js} +1 -1
  97. package/core/built/admin/assets/{post-analytics-context-BWDhMRq_.js → post-analytics-context-D7PgEMo8.js} +1 -1
  98. package/core/built/admin/assets/{post-analytics-header-Bm0mcxjK.js → post-analytics-header-B8C0vA5Y.js} +1 -1
  99. package/core/built/admin/assets/{post-share-modal-D8BtRD2u.js → post-share-modal-D0OlASBQ.js} +1 -1
  100. package/core/built/admin/assets/{posts-u-CAKddc.js → posts-BZaw4-dc.js} +1 -1
  101. package/core/built/admin/assets/{power-DR9gpiQR.js → power-DWm6pts5.js} +1 -1
  102. package/core/built/admin/assets/{referrers-DV_Ihg9y.js → referrers-BsZ85Z0a.js} +1 -1
  103. package/core/built/admin/assets/{repeat-uXmOJ6y8.js → repeat-DQay9e22.js} +1 -1
  104. package/core/built/admin/assets/{reply-9ZyqaxI-.js → reply-CoNqmExw.js} +1 -1
  105. package/core/built/admin/assets/{rocket-DMOr1OCt.js → rocket-Dne6P_8f.js} +1 -1
  106. package/core/built/admin/assets/{select-CPSy44ld.js → select-BfWJkrKc.js} +1 -1
  107. package/core/built/admin/assets/{settings-krk0432u.js → settings-BoXzKMhL.js} +1 -1
  108. package/core/built/admin/assets/{settings-66Zv8QvL.js → settings-rRY210wx.js} +25 -25
  109. package/core/built/admin/assets/{share-modal-BRmGllZq.js → share-modal-CtdLQbnQ.js} +1 -1
  110. package/core/built/admin/assets/{sort-button-5fyeViQL.js → sort-button-7pVgpa0d.js} +1 -1
  111. package/core/built/admin/assets/{source-icon-DeeHyZRn.js → source-icon-Dtua85oN.js} +1 -1
  112. package/core/built/admin/assets/{sprout-956Q4On2.js → sprout-CpwUJAPT.js} +1 -1
  113. package/core/built/admin/assets/{square-BaCvbKJY.js → square-CDrQjv8R.js} +1 -1
  114. package/core/built/admin/assets/{stats-BVKNZJO6.js → stats-Yo9Gco0_.js} +1 -1
  115. package/core/built/admin/assets/{stats-view-gtyaqudG.js → stats-view-DubukX9V.js} +1 -1
  116. package/core/built/admin/assets/{step-1-09wdjzdX.js → step-1-CH8jWKi7.js} +1 -1
  117. package/core/built/admin/assets/{step-2-8iaQ0efq.js → step-2-CWy7Qi0Q.js} +1 -1
  118. package/core/built/admin/assets/{step-3-BuHAZbdD.js → step-3-CNiDFH17.js} +1 -1
  119. package/core/built/admin/assets/{table-DTofVyjA.js → table-qQi9EXB1.js} +1 -1
  120. package/core/built/admin/assets/{tabs-CL5eaCGL.js → tabs-M6kFEqPE.js} +1 -1
  121. package/core/built/admin/assets/{tags-DJrbEw5-.js → tags-74U6lgwY.js} +1 -1
  122. package/core/built/admin/assets/{tags-U3lciBmd.js → tags-DuMshkTz.js} +1 -1
  123. package/core/built/admin/assets/{textarea-DdDuNixZ.js → textarea-CGBp9nOo.js} +1 -1
  124. package/core/built/admin/assets/{tiers-DXKbghdk.js → tiers-D2DYHaeO.js} +1 -1
  125. package/core/built/admin/assets/{toggle-group-DaZKTYDS.js → toggle-group-GYp_w6Po.js} +1 -1
  126. package/core/built/admin/assets/{topic-filter-BzqiVOAU.js → topic-filter-N3CzJ01P.js} +1 -1
  127. package/core/built/admin/assets/{trash-CKK_p9G5.js → trash-CUqAK3SQ.js} +1 -1
  128. package/core/built/admin/assets/{underline-Bq0P-5Zy.js → underline-CwuJG-Ql.js} +1 -1
  129. package/core/built/admin/assets/{undo-2-CcBtw-tW.js → undo-2-D6ZRqONE.js} +1 -1
  130. package/core/built/admin/assets/{upload-BcylHEMw.js → upload-BLiT66bJ.js} +1 -1
  131. package/core/built/admin/assets/{use-growth-stats-Ci0gymWp.js → use-growth-stats-u18So4Gq.js} +1 -1
  132. package/core/built/admin/assets/{use-simple-pagination-ByaFwxfZ.js → use-simple-pagination-Dp2sTt2S.js} +1 -1
  133. package/core/built/admin/assets/{user-round-check-D0I7NO1g.js → user-round-check-BDomHaso.js} +1 -1
  134. package/core/built/admin/assets/{user-round-x-DeGVH29o.js → user-round-x-Cc0RL-V9.js} +1 -1
  135. package/core/built/admin/assets/{virtual-list-window-S0xZxQAf.js → virtual-list-window-BnjCoNIr.js} +1 -1
  136. package/core/built/admin/assets/{wallet-cards-B9TQg4x3.js → wallet-cards-CVZ99Nm3.js} +1 -1
  137. package/core/built/admin/assets/{web-BRN2mUpo.js → web-B_MLxGxZ.js} +1 -1
  138. package/core/built/admin/index.html +5 -5
  139. package/core/server/{services/custom-redirects/file-store.js → adapters/redirects/FileStore.js} +6 -5
  140. package/core/server/{services/custom-redirects/file-store.ts → adapters/redirects/FileStore.ts} +6 -4
  141. package/core/server/adapters/redirects/RedirectsStoreBase.d.ts +9 -0
  142. package/core/server/adapters/redirects/RedirectsStoreBase.js +8 -0
  143. package/core/server/{services/custom-redirects/gcs-store.js → adapters/redirects/S3RedirectsStore.js} +50 -18
  144. package/core/server/adapters/redirects/S3RedirectsStore.ts +163 -0
  145. package/core/server/adapters/scheduling/scheduling-base.js +41 -0
  146. package/core/server/adapters/scheduling/types.js +2 -0
  147. package/core/server/adapters/scheduling/types.ts +36 -0
  148. package/core/server/api/endpoints/authentication.js +26 -5
  149. package/core/server/api/endpoints/schedules.js +0 -30
  150. package/core/server/api/endpoints/utils/serializers/output/authentication.js +10 -0
  151. package/core/server/data/migrations/versions/6.41/2026-05-13-12-00-00-rename-reset-all-passwords-permission.js +21 -0
  152. package/core/server/data/schema/fixtures/fixtures.json +3 -3
  153. package/core/server/models/api-key.js +18 -0
  154. package/core/server/models/user.js +18 -0
  155. package/core/server/services/adapter-manager/config.js +6 -0
  156. package/core/server/services/adapter-manager/index.js +1 -0
  157. package/core/server/services/auth/index.js +4 -0
  158. package/core/server/services/auth/reset-authentication.js +50 -0
  159. package/core/server/services/auth/reset-authentication.ts +75 -0
  160. package/core/server/services/automations/index.js +21 -15
  161. package/core/server/services/custom-redirects/index.js +2 -4
  162. package/core/server/services/gifts/gift-bookshelf-repository.js +7 -0
  163. package/core/server/services/gifts/gift-bookshelf-repository.ts +10 -0
  164. package/core/server/services/gifts/gift-reminder-scheduler.js +94 -0
  165. package/core/server/services/gifts/gift-reminder-scheduler.ts +109 -0
  166. package/core/server/services/gifts/gift-repository.ts +1 -0
  167. package/core/server/services/gifts/gift-service-wrapper.js +10 -7
  168. package/core/server/services/gifts/gift-service.js +1 -32
  169. package/core/server/services/gifts/gift-service.ts +3 -59
  170. package/core/server/services/internal-keys/index.js +1 -3
  171. package/core/server/services/internal-keys/index.ts +11 -3
  172. package/core/server/services/post-scheduling/index.js +16 -28
  173. package/core/server/services/post-scheduling/index.ts +14 -0
  174. package/core/server/services/post-scheduling/post-scheduling.js +115 -0
  175. package/core/server/services/post-scheduling/post-scheduling.ts +138 -0
  176. package/core/server/services/users.js +29 -16
  177. package/core/server/web/api/endpoints/admin/middleware.js +8 -4
  178. package/core/server/web/api/endpoints/admin/routes.js +1 -1
  179. package/core/shared/config/defaults.json +5 -0
  180. package/core/shared/labs.js +2 -1
  181. package/package.json +1 -1
  182. package/core/built/admin/assets/minus-DPrXh11r.js +0 -1
  183. package/core/server/services/custom-redirects/gcs-store.ts +0 -117
  184. package/core/server/services/post-scheduling/post-scheduler-service.js +0 -126
@@ -1,4 +1,4 @@
1
- import{j as p,c_ as aa,dE as ca,c2 as la,t as $e,r as D,aB as ua,bi as gn,G as He,cp as lr,cq as ur,cr as dr,cs as fr,cS as hr,cT as gr,cU as pr,e as pn,dm as da,dF as mr,ao as mn,aJ as yr,aK as xr,B as Je,I as fa,aQ as ha,S as ga,b7 as pa,aW as ma,b8 as ya,b9 as xa,bb as wa,u as va,a2 as ba,a3 as _a,a4 as Ea,a5 as Sa,a6 as Na,a7 as Ca,a8 as Ma}from"./index-CFEzD2_M.js";import{M as An}from"./mail-9TFkAaAh.js";import{C as Pn,P as ka}from"./power-DR9gpiQR.js";import{i as Ee,c as oo,a as ro,b as Ia,d as on}from"./value-BGBiTkF3.js";import{M as yn,i as Aa,a as Pa,A as Da,b as Ta,c as ja}from"./automations-DTUfYvf6.js";import{C as io}from"./checkbox-DMamS4oG.js";import{L as so}from"./label-fijjy1Mb.js";import{S as $a,a as za}from"./select-CPSy44ld.js";import{C as Ha}from"./circle-alert-Dg3UkvRP.js";import{P as La}from"./pencil-CKTgzafp.js";import"./index-BTf6YUBb.js";import"./chevron-up-CVgBkTk5.js";var ao=180/Math.PI,xn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function wr(e,t,n,o,r,i){var s,a,c;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(c=e*n+t*o)&&(n-=e*c,o-=t*c),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,c/=a),e*o<t*n&&(e=-e,t=-t,c=-c,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*ao,skewX:Math.atan(c)*ao,scaleX:s,scaleY:a}}var bt;function Ra(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?xn:wr(t.a,t.b,t.c,t.d,t.e,t.f)}function Oa(e){return e==null||(bt||(bt=document.createElementNS("http://www.w3.org/2000/svg","g")),bt.setAttribute("transform",e),!(e=bt.transform.baseVal.consolidate()))?xn:(e=e.matrix,wr(e.a,e.b,e.c,e.d,e.e,e.f))}function vr(e,t,n,o){function r(l){return l.length?l.pop()+" ":""}function i(l,d,f,u,h,y){if(l!==f||d!==u){var m=h.push("translate(",null,t,null,n);y.push({i:m-4,x:Ee(l,f)},{i:m-2,x:Ee(d,u)})}else(f||u)&&h.push("translate("+f+t+u+n)}function s(l,d,f,u){l!==d?(l-d>180?d+=360:d-l>180&&(l+=360),u.push({i:f.push(r(f)+"rotate(",null,o)-2,x:Ee(l,d)})):d&&f.push(r(f)+"rotate("+d+o)}function a(l,d,f,u){l!==d?u.push({i:f.push(r(f)+"skewX(",null,o)-2,x:Ee(l,d)}):d&&f.push(r(f)+"skewX("+d+o)}function c(l,d,f,u,h,y){if(l!==f||d!==u){var m=h.push(r(h)+"scale(",null,",",null,")");y.push({i:m-4,x:Ee(l,f)},{i:m-2,x:Ee(d,u)})}else(f!==1||u!==1)&&h.push(r(h)+"scale("+f+","+u+")")}return function(l,d){var f=[],u=[];return l=e(l),d=e(d),i(l.translateX,l.translateY,d.translateX,d.translateY,f,u),s(l.rotate,d.rotate,f,u),a(l.skewX,d.skewX,f,u),c(l.scaleX,l.scaleY,d.scaleX,d.scaleY,f,u),l=d=null,function(h){for(var y=-1,m=u.length,b;++y<m;)f[(b=u[y]).i]=b.x(h);return f.join("")}}}var Ba=vr(Ra,"px, ","px)","deg)"),Va=vr(Oa,", ",")",")"),Fa=1e-12;function co(e){return((e=Math.exp(e))+1/e)/2}function Xa(e){return((e=Math.exp(e))-1/e)/2}function Ya(e){return((e=Math.exp(2*e))-1)/(e+1)}const kt=(function e(t,n,o){function r(i,s){var a=i[0],c=i[1],l=i[2],d=s[0],f=s[1],u=s[2],h=d-a,y=f-c,m=h*h+y*y,b,w;if(m<Fa)w=Math.log(u/l)/t,b=function(k){return[a+k*h,c+k*y,l*Math.exp(t*k*w)]};else{var N=Math.sqrt(m),g=(u*u-l*l+o*m)/(2*l*n*N),x=(u*u-l*l-o*m)/(2*u*n*N),E=Math.log(Math.sqrt(g*g+1)-g),_=Math.log(Math.sqrt(x*x+1)-x);w=(_-E)/t,b=function(k){var I=k*w,j=co(E),B=l/(n*N)*(j*Ya(t*I+E)-Xa(E));return[a+B*h,c+B*y,l*j/co(t*I+E)]}}return b.duration=w*1e3*t/Math.SQRT2,b}return r.rho=function(i){var s=Math.max(.001,+i),a=s*s,c=a*a;return e(s,a,c)},r})(Math.SQRT2,2,4),lo=({icon:e,label:t,description:n,onClick:o})=>p.jsxs("button",{className:"flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm hover:bg-accent focus-visible:bg-accent focus-visible:outline-none",type:"button",onClick:o,children:[p.jsx("div",{className:"flex size-8 shrink-0 items-center justify-center rounded-md bg-muted text-text-secondary",children:p.jsx(e,{className:"size-4"})}),p.jsxs("div",{className:"flex min-w-0 flex-col",children:[p.jsx("span",{className:"font-medium",children:t}),p.jsx("span",{className:"text-xs text-text-secondary",children:n})]})]}),br=({onPick:e})=>p.jsxs("div",{className:"flex w-64 flex-col gap-1 p-1","data-testid":"step-picker",children:[p.jsx(lo,{description:"Send an email",icon:An,label:"Email",onClick:()=>e("send_email")}),p.jsx(lo,{description:"Wait a set amount of time",icon:Pn,label:"Wait",onClick:()=>e("wait")})]});function re(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=re(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Wa={value:()=>{}};function Ft(){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 It(n)}function It(e){this._=e}function Za(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}})}It.prototype=Ft.prototype={constructor:It,on:function(e,t){var n=this._,o=Za(e+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(e=o[i]).type)&&(r=Ga(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]=uo(n[r],e.name,t);else if(t==null)for(r in n)n[r]=uo(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 It(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 Ga(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function uo(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=Wa,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var wn="http://www.w3.org/1999/xhtml";const fo={svg:"http://www.w3.org/2000/svg",xhtml:wn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Xt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),fo.hasOwnProperty(t)?{space:fo[t],local:e}:e}function qa(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===wn&&t.documentElement.namespaceURI===wn?t.createElement(e):t.createElementNS(n,e)}}function Ua(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function _r(e){var t=Xt(e);return(t.local?Ua:qa)(t)}function Ka(){}function Dn(e){return e==null?Ka:function(){return this.querySelector(e)}}function Qa(e){typeof e!="function"&&(e=Dn(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),c,l,d=0;d<s;++d)(c=i[d])&&(l=e.call(c,c.__data__,d,i))&&("__data__"in c&&(l.__data__=c.__data__),a[d]=l);return new ce(o,this._parents)}function Ja(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function ec(){return[]}function Er(e){return e==null?ec:function(){return this.querySelectorAll(e)}}function tc(e){return function(){return Ja(e.apply(this,arguments))}}function nc(e){typeof e=="function"?e=tc(e):e=Er(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(o.push(e.call(c,c.__data__,l,s)),r.push(c));return new ce(o,r)}function Sr(e){return function(){return this.matches(e)}}function Nr(e){return function(t){return t.matches(e)}}var oc=Array.prototype.find;function rc(e){return function(){return oc.call(this.children,e)}}function ic(){return this.firstElementChild}function sc(e){return this.select(e==null?ic:rc(typeof e=="function"?e:Nr(e)))}var ac=Array.prototype.filter;function cc(){return Array.from(this.children)}function lc(e){return function(){return ac.call(this.children,e)}}function uc(e){return this.selectAll(e==null?cc:lc(typeof e=="function"?e:Nr(e)))}function dc(e){typeof e!="function"&&(e=Sr(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]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new ce(o,this._parents)}function Cr(e){return new Array(e.length)}function fc(){return new ce(this._enter||this._groups.map(Cr),this._parents)}function jt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}jt.prototype={constructor:jt,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 hc(e){return function(){return e}}function gc(e,t,n,o,r,i){for(var s=0,a,c=t.length,l=i.length;s<l;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new jt(e,i[s]);for(;s<c;++s)(a=t[s])&&(r[s]=a)}function pc(e,t,n,o,r,i,s){var a,c,l=new Map,d=t.length,f=i.length,u=new Array(d),h;for(a=0;a<d;++a)(c=t[a])&&(u[a]=h=s.call(c,c.__data__,a,t)+"",l.has(h)?r[a]=c:l.set(h,c));for(a=0;a<f;++a)h=s.call(e,i[a],a,i)+"",(c=l.get(h))?(o[a]=c,c.__data__=i[a],l.delete(h)):n[a]=new jt(e,i[a]);for(a=0;a<d;++a)(c=t[a])&&l.get(u[a])===c&&(r[a]=c)}function mc(e){return e.__data__}function yc(e,t){if(!arguments.length)return Array.from(this,mc);var n=t?pc:gc,o=this._parents,r=this._groups;typeof e!="function"&&(e=hc(e));for(var i=r.length,s=new Array(i),a=new Array(i),c=new Array(i),l=0;l<i;++l){var d=o[l],f=r[l],u=f.length,h=xc(e.call(d,d&&d.__data__,l,o)),y=h.length,m=a[l]=new Array(y),b=s[l]=new Array(y),w=c[l]=new Array(u);n(d,f,m,b,w,h,t);for(var N=0,g=0,x,E;N<y;++N)if(x=m[N]){for(N>=g&&(g=N+1);!(E=b[g])&&++g<y;);x._next=E||null}}return s=new ce(s,o),s._enter=a,s._exit=c,s}function xc(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function wc(){return new ce(this._exit||this._groups.map(Cr),this._parents)}function vc(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 bc(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),c=0;c<s;++c)for(var l=n[c],d=o[c],f=l.length,u=a[c]=new Array(f),h,y=0;y<f;++y)(h=l[y]||d[y])&&(u[y]=h);for(;c<r;++c)a[c]=n[c];return new ce(a,this._parents)}function _c(){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 Ec(e){e||(e=Sc);function t(f,u){return f&&u?e(f.__data__,u.__data__):!f-!u}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,c=r[i]=new Array(a),l,d=0;d<a;++d)(l=s[d])&&(c[d]=l);c.sort(t)}return new ce(r,this._parents).order()}function Sc(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Nc(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Cc(){return Array.from(this)}function Mc(){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 kc(){let e=0;for(const t of this)++e;return e}function Ic(){return!this.node()}function Ac(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 Pc(e){return function(){this.removeAttribute(e)}}function Dc(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Tc(e,t){return function(){this.setAttribute(e,t)}}function jc(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function $c(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function zc(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 Hc(e,t){var n=Xt(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?Dc:Pc:typeof t=="function"?n.local?zc:$c:n.local?jc:Tc)(n,t))}function Mr(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Lc(e){return function(){this.style.removeProperty(e)}}function Rc(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Oc(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Bc(e,t,n){return arguments.length>1?this.each((t==null?Lc:typeof t=="function"?Oc:Rc)(e,t,n??"")):Le(this.node(),e)}function Le(e,t){return e.style.getPropertyValue(t)||Mr(e).getComputedStyle(e,null).getPropertyValue(t)}function Vc(e){return function(){delete this[e]}}function Fc(e,t){return function(){this[e]=t}}function Xc(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?Vc:typeof t=="function"?Xc:Fc)(e,t)):this.node()[e]}function kr(e){return e.trim().split(/^|\s+/)}function Tn(e){return e.classList||new Ir(e)}function Ir(e){this._node=e,this._names=kr(e.getAttribute("class")||"")}Ir.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 Ar(e,t){for(var n=Tn(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function Pr(e,t){for(var n=Tn(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function Wc(e){return function(){Ar(this,e)}}function Zc(e){return function(){Pr(this,e)}}function Gc(e,t){return function(){(t.apply(this,arguments)?Ar:Pr)(this,e)}}function qc(e,t){var n=kr(e+"");if(arguments.length<2){for(var o=Tn(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?Gc:t?Wc:Zc)(n,t))}function Uc(){this.textContent=""}function Kc(e){return function(){this.textContent=e}}function Qc(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Jc(e){return arguments.length?this.each(e==null?Uc:(typeof e=="function"?Qc:Kc)(e)):this.node().textContent}function el(){this.innerHTML=""}function tl(e){return function(){this.innerHTML=e}}function nl(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function ol(e){return arguments.length?this.each(e==null?el:(typeof e=="function"?nl:tl)(e)):this.node().innerHTML}function rl(){this.nextSibling&&this.parentNode.appendChild(this)}function il(){return this.each(rl)}function sl(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function al(){return this.each(sl)}function cl(e){var t=typeof e=="function"?e:_r(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function ll(){return null}function ul(e,t){var n=typeof e=="function"?e:_r(e),o=t==null?ll:typeof t=="function"?t:Dn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function dl(){var e=this.parentNode;e&&e.removeChild(this)}function fl(){return this.each(dl)}function hl(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function gl(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function pl(e){return this.select(e?gl:hl)}function ml(e){return arguments.length?this.property("__data__",e):this.node().__data__}function yl(e){return function(t){e.call(this,t,this.__data__)}}function xl(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 wl(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 vl(e,t,n){return function(){var o=this.__on,r,i=yl(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 bl(e,t,n){var o=xl(e+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,d;c<l;++c)for(r=0,d=a[c];r<i;++r)if((s=o[r]).type===d.type&&s.name===d.name)return d.value}return}for(a=t?vl:wl,r=0;r<i;++r)this.each(a(o[r],t,n));return this}function Dr(e,t,n){var o=Mr(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 _l(e,t){return function(){return Dr(this,e,t)}}function El(e,t){return function(){return Dr(this,e,t.apply(this,arguments))}}function Sl(e,t){return this.each((typeof t=="function"?El:_l)(e,t))}function*Nl(){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 Tr=[null];function ce(e,t){this._groups=e,this._parents=t}function ft(){return new ce([[document.documentElement]],Tr)}function Cl(){return this}ce.prototype=ft.prototype={constructor:ce,select:Qa,selectAll:nc,selectChild:sc,selectChildren:uc,filter:dc,data:yc,enter:fc,exit:wc,join:vc,merge:bc,selection:Cl,order:_c,sort:Ec,call:Nc,nodes:Cc,node:Mc,size:kc,empty:Ic,each:Ac,attr:Hc,style:Bc,property:Yc,classed:qc,text:Jc,html:ol,raise:il,lower:al,append:cl,insert:ul,remove:fl,clone:pl,datum:ml,on:bl,dispatch:Sl,[Symbol.iterator]:Nl};function ae(e){return typeof e=="string"?new ce([[document.querySelector(e)]],[document.documentElement]):new ce([[e]],Tr)}function Ml(e){let t;for(;t=e.sourceEvent;)e=t;return e}function le(e,t){if(e=Ml(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 kl={passive:!1},nt={capture:!0,passive:!1};function rn(e){e.stopImmediatePropagation()}function ze(e){e.preventDefault(),e.stopImmediatePropagation()}function jr(e){var t=e.document.documentElement,n=ae(e).on("dragstart.drag",ze,nt);"onselectstart"in t?n.on("selectstart.drag",ze,nt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function $r(e,t){var n=e.document.documentElement,o=ae(e).on("dragstart.drag",null);t&&(o.on("click.drag",ze,nt),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 _t=e=>()=>e;function vn(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:c,dy:l,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value: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:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:d}})}vn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Il(e){return!e.ctrlKey&&!e.button}function Al(){return this.parentNode}function Pl(e,t){return t??{x:e.x,y:e.y}}function Dl(){return navigator.maxTouchPoints||"ontouchstart"in this}function zr(){var e=Il,t=Al,n=Pl,o=Dl,r={},i=Ft("start","drag","end"),s=0,a,c,l,d,f=0;function u(x){x.on("mousedown.drag",h).filter(o).on("touchstart.drag",b).on("touchmove.drag",w,kl).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(x,E){if(!(d||!e.call(this,x,E))){var _=g(this,t.call(this,x,E),x,E,"mouse");_&&(ae(x.view).on("mousemove.drag",y,nt).on("mouseup.drag",m,nt),jr(x.view),rn(x),l=!1,a=x.clientX,c=x.clientY,_("start",x))}}function y(x){if(ze(x),!l){var E=x.clientX-a,_=x.clientY-c;l=E*E+_*_>f}r.mouse("drag",x)}function m(x){ae(x.view).on("mousemove.drag mouseup.drag",null),$r(x.view,l),ze(x),r.mouse("end",x)}function b(x,E){if(e.call(this,x,E)){var _=x.changedTouches,k=t.call(this,x,E),I=_.length,j,B;for(j=0;j<I;++j)(B=g(this,k,x,E,_[j].identifier,_[j]))&&(rn(x),B("start",x,_[j]))}}function w(x){var E=x.changedTouches,_=E.length,k,I;for(k=0;k<_;++k)(I=r[E[k].identifier])&&(ze(x),I("drag",x,E[k]))}function N(x){var E=x.changedTouches,_=E.length,k,I;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),k=0;k<_;++k)(I=r[E[k].identifier])&&(rn(x),I("end",x,E[k]))}function g(x,E,_,k,I,j){var B=i.copy(),R=le(j||_,E),A,z,v;if((v=n.call(x,new vn("beforestart",{sourceEvent:_,target:u,identifier:I,active:s,x:R[0],y:R[1],dx:0,dy:0,dispatch:B}),k))!=null)return A=v.x-R[0]||0,z=v.y-R[1]||0,function M(S,C,T){var P=R,$;switch(S){case"start":r[I]=M,$=s++;break;case"end":delete r[I],--s;case"drag":R=le(T||C,E),$=s;break}B.call(S,x,new vn(S,{sourceEvent:C,subject:v,target:u,identifier:I,active:$,x:R[0]+A,y:R[1]+z,dx:R[0]-P[0],dy:R[1]-P[1],dispatch:B}),k)}}return u.filter=function(x){return arguments.length?(e=typeof x=="function"?x:_t(!!x),u):e},u.container=function(x){return arguments.length?(t=typeof x=="function"?x:_t(x),u):t},u.subject=function(x){return arguments.length?(n=typeof x=="function"?x:_t(x),u):n},u.touchable=function(x){return arguments.length?(o=typeof x=="function"?x:_t(!!x),u):o},u.on=function(){var x=i.on.apply(i,arguments);return x===i?u:x},u.clickDistance=function(x){return arguments.length?(f=(x=+x)*x,u):Math.sqrt(f)},u}var Re=0,Ke=0,qe=0,Hr=1e3,$t,Qe,zt=0,Me=0,Yt=0,ot=typeof performance=="object"&&performance.now?performance:Date,Lr=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function jn(){return Me||(Lr(Tl),Me=ot.now()+Yt)}function Tl(){Me=0}function Ht(){this._call=this._time=this._next=null}Ht.prototype=Rr.prototype={constructor:Ht,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?jn():+n)+(t==null?0:+t),!this._next&&Qe!==this&&(Qe?Qe._next=this:$t=this,Qe=this),this._call=e,this._time=n,bn()},stop:function(){this._call&&(this._call=null,this._time=1/0,bn())}};function Rr(e,t,n){var o=new Ht;return o.restart(e,t,n),o}function jl(){jn(),++Re;for(var e=$t,t;e;)(t=Me-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Re}function ho(){Me=(zt=ot.now())+Yt,Re=Ke=0;try{jl()}finally{Re=0,zl(),Me=0}}function $l(){var e=ot.now(),t=e-zt;t>Hr&&(Yt-=t,zt=e)}function zl(){for(var e,t=$t,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:$t=n);Qe=e,bn(o)}function bn(e){if(!Re){Ke&&(Ke=clearTimeout(Ke));var t=e-Me;t>24?(e<1/0&&(Ke=setTimeout(ho,e-ot.now()-Yt)),qe&&(qe=clearInterval(qe))):(qe||(zt=ot.now(),qe=setInterval($l,Hr)),Re=1,Lr(ho))}}function go(e,t,n){var o=new Ht;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var Hl=Ft("start","end","cancel","interrupt"),Ll=[],Or=0,po=1,_n=2,At=3,mo=4,En=5,Pt=6;function Wt(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;Rl(e,n,{name:t,index:o,group:r,on:Hl,tween:Ll,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Or})}function $n(e,t){var n=fe(e,t);if(n.state>Or)throw new Error("too late; already scheduled");return n}function ge(e,t){var n=fe(e,t);if(n.state>At)throw new Error("too late; already running");return n}function fe(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Rl(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=Rr(i,0,n.time);function i(l){n.state=po,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var d,f,u,h;if(n.state!==po)return c();for(d in o)if(h=o[d],h.name===n.name){if(h.state===At)return go(s);h.state===mo?(h.state=Pt,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[d]):+d<t&&(h.state=Pt,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete o[d])}if(go(function(){n.state===At&&(n.state=mo,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=_n,n.on.call("start",e,e.__data__,n.index,n.group),n.state===_n){for(n.state=At,r=new Array(u=n.tween.length),d=0,f=-1;d<u;++d)(h=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(r[++f]=h);r.length=f+1}}function a(l){for(var d=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=En,1),f=-1,u=r.length;++f<u;)r[f].call(e,d);n.state===En&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Pt,n.timer.stop(),delete o[t];for(var l in o)return;delete e.__transition}}function Dt(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>_n&&o.state<En,o.state=Pt,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function Ol(e){return this.each(function(){Dt(this,e)})}function Bl(e,t){var n,o;return function(){var r=ge(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 Vl(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=ge(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},c=0,l=r.length;c<l;++c)if(r[c].name===t){r[c]=a;break}c===l&&r.push(a)}i.tween=r}}function Fl(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=fe(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?Bl:Vl)(n,e,t))}function zn(e,t,n){var o=e._id;return e.each(function(){var r=ge(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return fe(r,o).value[t]}}function Br(e,t){var n;return(typeof t=="number"?Ee:t instanceof oo?ro:(n=oo(t))?(t=n,ro):Ia)(e,t)}function Xl(e){return function(){this.removeAttribute(e)}}function Yl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Wl(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 Zl(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 Gl(e,t,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a)))}}function ql(e,t,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a)))}}function Ul(e,t){var n=Xt(e),o=n==="transform"?Va:Br;return this.attrTween(e,typeof t=="function"?(n.local?ql:Gl)(n,o,zn(this,"attr."+e,t)):t==null?(n.local?Yl:Xl)(n):(n.local?Zl:Wl)(n,o,t))}function Kl(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Ql(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Jl(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Ql(e,i)),n}return r._value=t,r}function eu(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Kl(e,i)),n}return r._value=t,r}function tu(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=Xt(e);return this.tween(n,(o.local?Jl:eu)(o,t))}function nu(e,t){return function(){$n(this,e).delay=+t.apply(this,arguments)}}function ou(e,t){return t=+t,function(){$n(this,e).delay=t}}function ru(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?nu:ou)(t,e)):fe(this.node(),t).delay}function iu(e,t){return function(){ge(this,e).duration=+t.apply(this,arguments)}}function su(e,t){return t=+t,function(){ge(this,e).duration=t}}function au(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?iu:su)(t,e)):fe(this.node(),t).duration}function cu(e,t){if(typeof t!="function")throw new Error;return function(){ge(this,e).ease=t}}function lu(e){var t=this._id;return arguments.length?this.each(cu(t,e)):fe(this.node(),t).ease}function uu(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;ge(this,e).ease=n}}function du(e){if(typeof e!="function")throw new Error;return this.each(uu(this._id,e))}function fu(e){typeof e!="function"&&(e=Sr(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]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new ye(o,this._parents,this._name,this._id)}function hu(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 c=t[a],l=n[a],d=c.length,f=s[a]=new Array(d),u,h=0;h<d;++h)(u=c[h]||l[h])&&(f[h]=u);for(;a<o;++a)s[a]=t[a];return new ye(s,this._parents,this._name,this._id)}function gu(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 pu(e,t,n){var o,r,i=gu(t)?$n:ge;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}function mu(e,t){var n=this._id;return arguments.length<2?fe(this.node(),n).on.on(e):this.each(pu(n,e,t))}function yu(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function xu(){return this.on("end.remove",yu(this._id))}function wu(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Dn(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],c=a.length,l=i[s]=new Array(c),d,f,u=0;u<c;++u)(d=a[u])&&(f=e.call(d,d.__data__,u,a))&&("__data__"in d&&(f.__data__=d.__data__),l[u]=f,Wt(l[u],t,n,u,l,fe(d,n)));return new ye(i,this._parents,t,n)}function vu(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Er(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var c=o[a],l=c.length,d,f=0;f<l;++f)if(d=c[f]){for(var u=e.call(d,d.__data__,f,c),h,y=fe(d,n),m=0,b=u.length;m<b;++m)(h=u[m])&&Wt(h,t,n,m,u,y);i.push(u),s.push(d)}return new ye(i,s,t,n)}var bu=ft.prototype.constructor;function _u(){return new bu(this._groups,this._parents)}function Eu(e,t){var n,o,r;return function(){var i=Le(this,e),s=(this.style.removeProperty(e),Le(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function Vr(e){return function(){this.style.removeProperty(e)}}function Su(e,t,n){var o,r=n+"",i;return function(){var s=Le(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function Nu(e,t,n){var o,r,i;return function(){var s=Le(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Le(this,e))),s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a))}}function Cu(e,t){var n,o,r,i="style."+t,s="end."+i,a;return function(){var c=ge(this,e),l=c.on,d=c.value[i]==null?a||(a=Vr(t)):void 0;(l!==n||r!==d)&&(o=(n=l).copy()).on(s,r=d),c.on=o}}function Mu(e,t,n){var o=(e+="")=="transform"?Ba:Br;return t==null?this.styleTween(e,Eu(e,o)).on("end.style."+e,Vr(e)):typeof t=="function"?this.styleTween(e,Nu(e,o,zn(this,"style."+e,t))).each(Cu(this._id,e)):this.styleTween(e,Su(e,o,t),n).on("end.style."+e,null)}function ku(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function Iu(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&ku(e,s,n)),o}return i._value=t,i}function Au(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,Iu(e,t,n??""))}function Pu(e){return function(){this.textContent=e}}function Du(e){return function(){var t=e(this);this.textContent=t??""}}function Tu(e){return this.tween("text",typeof e=="function"?Du(zn(this,"text",e)):Pu(e==null?"":e+""))}function ju(e){return function(t){this.textContent=e.call(this,t)}}function $u(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&ju(r)),t}return o._value=e,o}function zu(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,$u(e))}function Hu(){for(var e=this._name,t=this._id,n=Fr(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var d=fe(c,t);Wt(c,e,n,l,s,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new ye(o,this._parents,e,n)}function Lu(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},c={value:function(){--r===0&&i()}};n.each(function(){var l=ge(this,o),d=l.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),r===0&&i()})}var Ru=0;function ye(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Fr(){return++Ru}var pe=ft.prototype;ye.prototype={constructor:ye,select:wu,selectAll:vu,selectChild:pe.selectChild,selectChildren:pe.selectChildren,filter:fu,merge:hu,selection:_u,transition:Hu,call:pe.call,nodes:pe.nodes,node:pe.node,size:pe.size,empty:pe.empty,each:pe.each,on:mu,attr:Ul,attrTween:tu,style:Mu,styleTween:Au,text:Tu,textTween:zu,remove:xu,tween:Fl,delay:ru,duration:au,ease:lu,easeVarying:du,end:Lu,[Symbol.iterator]:pe[Symbol.iterator]};function Ou(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Bu={time:null,delay:0,duration:250,ease:Ou};function Vu(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 Fu(e){var t,n;e instanceof ye?(t=e._id,e=e._name):(t=Fr(),(n=Bu).time=jn(),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,c,l=0;l<a;++l)(c=s[l])&&Wt(c,e,t,l,s,n||Vu(c,t));return new ye(o,this._parents,e,t)}ft.prototype.interrupt=Ol;ft.prototype.transition=Fu;const Et=e=>()=>e;function Xu(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 me(e,t,n){this.k=e,this.x=t,this.y=n}me.prototype={constructor:me,scale:function(e){return e===1?this:new me(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new me(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 Zt=new me(1,0,0);Xr.prototype=me.prototype;function Xr(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Zt;return e.__zoom}function sn(e){e.stopImmediatePropagation()}function Ue(e){e.preventDefault(),e.stopImmediatePropagation()}function Yu(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Wu(){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 yo(){return this.__zoom||Zt}function Zu(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Gu(){return navigator.maxTouchPoints||"ontouchstart"in this}function qu(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 Yr(){var e=Yu,t=Wu,n=qu,o=Zu,r=Gu,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=kt,l=Ft("start","zoom","end"),d,f,u,h=500,y=150,m=0,b=10;function w(v){v.property("__zoom",yo).on("wheel.zoom",I,{passive:!1}).on("mousedown.zoom",j).on("dblclick.zoom",B).filter(r).on("touchstart.zoom",R).on("touchmove.zoom",A).on("touchend.zoom touchcancel.zoom",z).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}w.transform=function(v,M,S,C){var T=v.selection?v.selection():v;T.property("__zoom",yo),v!==T?E(v,M,S,C):T.interrupt().each(function(){_(this,arguments).event(C).start().zoom(null,typeof M=="function"?M.apply(this,arguments):M).end()})},w.scaleBy=function(v,M,S,C){w.scaleTo(v,function(){var T=this.__zoom.k,P=typeof M=="function"?M.apply(this,arguments):M;return T*P},S,C)},w.scaleTo=function(v,M,S,C){w.transform(v,function(){var T=t.apply(this,arguments),P=this.__zoom,$=S==null?x(T):typeof S=="function"?S.apply(this,arguments):S,H=P.invert($),L=typeof M=="function"?M.apply(this,arguments):M;return n(g(N(P,L),$,H),T,s)},S,C)},w.translateBy=function(v,M,S,C){w.transform(v,function(){return n(this.__zoom.translate(typeof M=="function"?M.apply(this,arguments):M,typeof S=="function"?S.apply(this,arguments):S),t.apply(this,arguments),s)},null,C)},w.translateTo=function(v,M,S,C,T){w.transform(v,function(){var P=t.apply(this,arguments),$=this.__zoom,H=C==null?x(P):typeof C=="function"?C.apply(this,arguments):C;return n(Zt.translate(H[0],H[1]).scale($.k).translate(typeof M=="function"?-M.apply(this,arguments):-M,typeof S=="function"?-S.apply(this,arguments):-S),P,s)},C,T)};function N(v,M){return M=Math.max(i[0],Math.min(i[1],M)),M===v.k?v:new me(M,v.x,v.y)}function g(v,M,S){var C=M[0]-S[0]*v.k,T=M[1]-S[1]*v.k;return C===v.x&&T===v.y?v:new me(v.k,C,T)}function x(v){return[(+v[0][0]+ +v[1][0])/2,(+v[0][1]+ +v[1][1])/2]}function E(v,M,S,C){v.on("start.zoom",function(){_(this,arguments).event(C).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(C).end()}).tween("zoom",function(){var T=this,P=arguments,$=_(T,P).event(C),H=t.apply(T,P),L=S==null?x(H):typeof S=="function"?S.apply(T,P):S,F=Math.max(H[1][0]-H[0][0],H[1][1]-H[0][1]),V=T.__zoom,Z=typeof M=="function"?M.apply(T,P):M,U=c(V.invert(L).concat(F/V.k),Z.invert(L).concat(F/Z.k));return function(Y){if(Y===1)Y=Z;else{var O=U(Y),W=F/O[2];Y=new me(W,L[0]-O[0]*W,L[1]-O[1]*W)}$.zoom(null,Y)}})}function _(v,M,S){return!S&&v.__zooming||new k(v,M)}function k(v,M){this.that=v,this.args=M,this.active=0,this.sourceEvent=null,this.extent=t.apply(v,M),this.taps=0}k.prototype={event:function(v){return v&&(this.sourceEvent=v),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(v,M){return this.mouse&&v!=="mouse"&&(this.mouse[1]=M.invert(this.mouse[0])),this.touch0&&v!=="touch"&&(this.touch0[1]=M.invert(this.touch0[0])),this.touch1&&v!=="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(v){var M=ae(this.that).datum();l.call(v,this.that,new Xu(v,{sourceEvent:this.sourceEvent,target:w,transform:this.that.__zoom,dispatch:l}),M)}};function I(v,...M){if(!e.apply(this,arguments))return;var S=_(this,M).event(v),C=this.__zoom,T=Math.max(i[0],Math.min(i[1],C.k*Math.pow(2,o.apply(this,arguments)))),P=le(v);if(S.wheel)(S.mouse[0][0]!==P[0]||S.mouse[0][1]!==P[1])&&(S.mouse[1]=C.invert(S.mouse[0]=P)),clearTimeout(S.wheel);else{if(C.k===T)return;S.mouse=[P,C.invert(P)],Dt(this),S.start()}Ue(v),S.wheel=setTimeout($,y),S.zoom("mouse",n(g(N(C,T),S.mouse[0],S.mouse[1]),S.extent,s));function $(){S.wheel=null,S.end()}}function j(v,...M){if(u||!e.apply(this,arguments))return;var S=v.currentTarget,C=_(this,M,!0).event(v),T=ae(v.view).on("mousemove.zoom",L,!0).on("mouseup.zoom",F,!0),P=le(v,S),$=v.clientX,H=v.clientY;jr(v.view),sn(v),C.mouse=[P,this.__zoom.invert(P)],Dt(this),C.start();function L(V){if(Ue(V),!C.moved){var Z=V.clientX-$,U=V.clientY-H;C.moved=Z*Z+U*U>m}C.event(V).zoom("mouse",n(g(C.that.__zoom,C.mouse[0]=le(V,S),C.mouse[1]),C.extent,s))}function F(V){T.on("mousemove.zoom mouseup.zoom",null),$r(V.view,C.moved),Ue(V),C.event(V).end()}}function B(v,...M){if(e.apply(this,arguments)){var S=this.__zoom,C=le(v.changedTouches?v.changedTouches[0]:v,this),T=S.invert(C),P=S.k*(v.shiftKey?.5:2),$=n(g(N(S,P),C,T),t.apply(this,M),s);Ue(v),a>0?ae(this).transition().duration(a).call(E,$,C,v):ae(this).call(w.transform,$,C,v)}}function R(v,...M){if(e.apply(this,arguments)){var S=v.touches,C=S.length,T=_(this,M,v.changedTouches.length===C).event(v),P,$,H,L;for(sn(v),$=0;$<C;++$)H=S[$],L=le(H,this),L=[L,this.__zoom.invert(L),H.identifier],T.touch0?!T.touch1&&T.touch0[2]!==L[2]&&(T.touch1=L,T.taps=0):(T.touch0=L,P=!0,T.taps=1+!!d);d&&(d=clearTimeout(d)),P&&(T.taps<2&&(f=L[0],d=setTimeout(function(){d=null},h)),Dt(this),T.start())}}function A(v,...M){if(this.__zooming){var S=_(this,M).event(v),C=v.changedTouches,T=C.length,P,$,H,L;for(Ue(v),P=0;P<T;++P)$=C[P],H=le($,this),S.touch0&&S.touch0[2]===$.identifier?S.touch0[0]=H:S.touch1&&S.touch1[2]===$.identifier&&(S.touch1[0]=H);if($=S.that.__zoom,S.touch1){var F=S.touch0[0],V=S.touch0[1],Z=S.touch1[0],U=S.touch1[1],Y=(Y=Z[0]-F[0])*Y+(Y=Z[1]-F[1])*Y,O=(O=U[0]-V[0])*O+(O=U[1]-V[1])*O;$=N($,Math.sqrt(Y/O)),H=[(F[0]+Z[0])/2,(F[1]+Z[1])/2],L=[(V[0]+U[0])/2,(V[1]+U[1])/2]}else if(S.touch0)H=S.touch0[0],L=S.touch0[1];else return;S.zoom("touch",n(g($,H,L),S.extent,s))}}function z(v,...M){if(this.__zooming){var S=_(this,M).event(v),C=v.changedTouches,T=C.length,P,$;for(sn(v),u&&clearTimeout(u),u=setTimeout(function(){u=null},h),P=0;P<T;++P)$=C[P],S.touch0&&S.touch0[2]===$.identifier?delete S.touch0:S.touch1&&S.touch1[2]===$.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&($=le($,this),Math.hypot(f[0]-$[0],f[1]-$[1])<b)){var H=ae(this).on("dblclick.zoom");H&&H.apply(this,arguments)}}}return w.wheelDelta=function(v){return arguments.length?(o=typeof v=="function"?v:Et(+v),w):o},w.filter=function(v){return arguments.length?(e=typeof v=="function"?v:Et(!!v),w):e},w.touchable=function(v){return arguments.length?(r=typeof v=="function"?v:Et(!!v),w):r},w.extent=function(v){return arguments.length?(t=typeof v=="function"?v:Et([[+v[0][0],+v[0][1]],[+v[1][0],+v[1][1]]]),w):t},w.scaleExtent=function(v){return arguments.length?(i[0]=+v[0],i[1]=+v[1],w):[i[0],i[1]]},w.translateExtent=function(v){return arguments.length?(s[0][0]=+v[0][0],s[1][0]=+v[1][0],s[0][1]=+v[0][1],s[1][1]=+v[1][1],w):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},w.constrain=function(v){return arguments.length?(n=v,w):n},w.duration=function(v){return arguments.length?(a=+v,w):a},w.interpolate=function(v){return arguments.length?(c=v,w):c},w.on=function(){var v=l.on.apply(l,arguments);return v===l?w:v},w.clickDistance=function(v){return arguments.length?(m=(v=+v)*v,w):Math.sqrt(m)},w.tapDistance=function(v){return arguments.length?(b=+v,w):b},w}const he={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."},rt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Wr=["Enter"," ","Escape"],Zr={"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 Oe;(function(e){e.Strict="strict",e.Loose="loose"})(Oe||(Oe={}));var Ce;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Ce||(Ce={}));var it;(function(e){e.Partial="partial",e.Full="full"})(it||(it={}));const Gr={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null};var be;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(be||(be={}));var Lt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Lt||(Lt={}));var X;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(X||(X={}));const xo={[X.Left]:X.Right,[X.Right]:X.Left,[X.Top]:X.Bottom,[X.Bottom]:X.Top};function qr(e){return e===null?null:e?"valid":"invalid"}const Ur=e=>"id"in e&&"source"in e&&"target"in e,Uu=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Hn=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),ht=(e,t=[0,0])=>{const{width:n,height:o}=xe(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},Ku=(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):Hn(r)?r:t.nodeLookup.get(r.id));const a=s?Rt(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Gt(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return qt(n)},gt=(e,t={})=>{if(e.size===0)return{x:0,y:0,width:0,height:0};let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0};return e.forEach(o=>{if(t.filter===void 0||t.filter(o)){const r=Rt(o);n=Gt(n,r)}}),qt(n)},Ln=(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},c=[];for(const l of e.values()){const{measured:d,selectable:f=!0,hidden:u=!1}=l;if(s&&!f||u)continue;const h=d.width??l.width??l.initialWidth??null,y=d.height??l.height??l.initialHeight??null,m=st(a,Ve(l)),b=(h??0)*(y??0),w=i&&m>0;(!l.internals.handleBounds||w||m>=b||l.dragging)&&c.push(l)}return c},Qu=(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 Ju(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 ed({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return Promise.resolve(!0);const a=Ju(e,s),c=gt(a),l=Rn(c,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(l,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),Promise.resolve(!0)}function Kr({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:c,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},d=s.origin??o;let f=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i?.("005",he.error005());else{const h=a.measured.width,y=a.measured.height;h&&y&&(f=[[c,l],[c+h,l+y]])}else a&&Fe(s.extent)&&(f=[[s.extent[0][0]+c,s.extent[0][1]+l],[s.extent[1][0]+c,s.extent[1][1]+l]]);const u=Fe(f)?ke(t,f,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",he.error015()),{position:{x:u.x-c+(s.measured.width??0)*d[0],y:u.y-l+(s.measured.height??0)*d[1]},positionAbsolute:u}}async function td({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(u=>u.id)),s=[];for(const u of n){if(u.deletable===!1)continue;const h=i.has(u.id),y=!h&&u.parentId&&s.find(m=>m.id===u.parentId);(h||y)&&s.push(u)}const a=new Set(t.map(u=>u.id)),c=o.filter(u=>u.deletable!==!1),d=Qu(s,c);for(const u of c)a.has(u.id)&&!d.find(y=>y.id===u.id)&&d.push(u);if(!r)return{edges:d,nodes:s};const f=await r({nodes:s,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:s}:{edges:[],nodes:[]}:f}const Be=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),ke=(e={x:0,y:0},t,n)=>({x:Be(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Be(e.y,t[0][1],t[1][1]-(n?.height??0))});function Qr(e,t,n){const{width:o,height:r}=xe(n),{x:i,y:s}=n.internals.positionAbsolute;return ke(e,[[i,s],[i+o,s+r]],t)}const wo=(e,t,n)=>e<t?Be(Math.abs(e-t),1,t)/t:e>n?-Be(Math.abs(e-n),1,t)/t:0,Jr=(e,t,n=15,o=40)=>{const r=wo(e.x,o,t.width-o)*n,i=wo(e.y,o,t.height-o)*n;return[r,i]},Gt=(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)}),Sn=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),qt=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),Ve=(e,t=[0,0])=>{const{x:n,y:o}=Hn(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}},Rt=(e,t=[0,0])=>{const{x:n,y:o}=Hn(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)}},ei=(e,t)=>qt(Gt(Sn(e),Sn(t))),st=(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)},vo=e=>ue(e.width)&&ue(e.height)&&ue(e.x)&&ue(e.y),ue=e=>!isNaN(e)&&isFinite(e),nd=(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},Ot=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Pe(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 od(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=Pe(e,n),r=Pe(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=Pe(e.top??e.y??0,n),r=Pe(e.bottom??e.y??0,n),i=Pe(e.left??e.x??0,t),s=Pe(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 rd(e,t,n,o,r,i){const{x:s,y:a}=Ot(e,[t,n,o]),{x:c,y:l}=Ot({x:e.x+e.width,y:e.y+e.height},[t,n,o]),d=r-c,f=i-l;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(d),bottom:Math.floor(f)}}const Rn=(e,t,n,o,r,i)=>{const s=od(i,t,n),a=(t-s.x)/e.width,c=(n-s.y)/e.height,l=Math.min(a,c),d=Be(l,o,r),f=e.x+e.width/2,u=e.y+e.height/2,h=t/2-f*d,y=n/2-u*d,m=rd(e,h,y,d,t,n),b={left:Math.min(m.left-s.left,0),top:Math.min(m.top-s.top,0),right:Math.min(m.right-s.right,0),bottom:Math.min(m.bottom-s.bottom,0)};return{x:h-b.left+b.right,y:y-b.top+b.bottom,zoom:d}},at=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Fe(e){return e!=null&&e!=="parent"}function xe(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function ti(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function ni(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 bo(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function id(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function sd(e){return{...Zr,...e||{}}}function et(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=de(e),a=mt({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:c,y:l}=n?pt(a,t):a;return{xSnapped:c,ySnapped:l,...a}}const On=e=>({width:e.offsetWidth,height:e.offsetHeight}),oi=e=>e?.getRootNode?.()||window?.document,ad=["INPUT","SELECT","TEXTAREA"];function ri(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:ad.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const ii=e=>"clientX"in e,de=(e,t)=>{const n=ii(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)}},_o=(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,...On(s)}})};function si({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const c=e*.125+r*.375+s*.375+n*.125,l=t*.125+i*.375+a*.375+o*.125,d=Math.abs(c-e),f=Math.abs(l-t);return[c,l,d,f]}function St(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Eo({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case X.Left:return[t-St(t-o,i),n];case X.Right:return[t+St(o-t,i),n];case X.Top:return[t,n-St(n-r,i)];case X.Bottom:return[t,n+St(r-n,i)]}}function ai({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top,curvature:s=.25}){const[a,c]=Eo({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[l,d]=Eo({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[f,u,h,y]=si({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:d});return[`M${e},${t} C${a},${c} ${l},${d} ${o},${r}`,f,u,h,y]}function ci({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 cd({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o,elevateOnSelect:r=!1}){if(o!==void 0)return o;const i=r&&n?1e3:0,s=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return i+s}function ld({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=Gt(Rt(e),Rt(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 st(s,qt(i))>0}const ud=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,dd=(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)),fd=(e,t)=>{if(!e.source||!e.target)return t;let n;return Ur(e)?n={...e}:n={...e,id:ud(e)},dd(n,t)?t:(n.sourceHandle===null&&delete n.sourceHandle,n.targetHandle===null&&delete n.targetHandle,t.concat(n))};function li({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,a]=ci({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}const So={[X.Left]:{x:-1,y:0},[X.Right]:{x:1,y:0},[X.Top]:{x:0,y:-1},[X.Bottom]:{x:0,y:1}},hd=({source:e,sourcePosition:t=X.Bottom,target:n})=>t===X.Left||t===X.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},No=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function gd({source:e,sourcePosition:t=X.Bottom,target:n,targetPosition:o=X.Top,center:r,offset:i,stepPosition:s}){const a=So[t],c=So[o],l={x:e.x+a.x*i,y:e.y+a.y*i},d={x:n.x+c.x*i,y:n.y+c.y*i},f=hd({source:l,sourcePosition:t,target:d}),u=f.x!==0?"x":"y",h=f[u];let y=[],m,b;const w={x:0,y:0},N={x:0,y:0},[,,g,x]=ci({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[u]*c[u]===-1){u==="x"?(m=r.x??l.x+(d.x-l.x)*s,b=r.y??(l.y+d.y)/2):(m=r.x??(l.x+d.x)/2,b=r.y??l.y+(d.y-l.y)*s);const _=[{x:m,y:l.y},{x:m,y:d.y}],k=[{x:l.x,y:b},{x:d.x,y:b}];a[u]===h?y=u==="x"?_:k:y=u==="x"?k:_}else{const _=[{x:l.x,y:d.y}],k=[{x:d.x,y:l.y}];if(u==="x"?y=a.x===h?k:_:y=a.y===h?_:k,t===o){const A=Math.abs(e[u]-n[u]);if(A<=i){const z=Math.min(i-1,i-A);a[u]===h?w[u]=(l[u]>e[u]?-1:1)*z:N[u]=(d[u]>n[u]?-1:1)*z}}if(t!==o){const A=u==="x"?"y":"x",z=a[u]===c[A],v=l[A]>d[A],M=l[A]<d[A];(a[u]===1&&(!z&&v||z&&M)||a[u]!==1&&(!z&&M||z&&v))&&(y=u==="x"?_:k)}const I={x:l.x+w.x,y:l.y+w.y},j={x:d.x+N.x,y:d.y+N.y},B=Math.max(Math.abs(I.x-y[0].x),Math.abs(j.x-y[0].x)),R=Math.max(Math.abs(I.y-y[0].y),Math.abs(j.y-y[0].y));B>=R?(m=(I.x+j.x)/2,b=y[0].y):(m=y[0].x,b=(I.y+j.y)/2)}return[[e,{x:l.x+w.x,y:l.y+w.y},...y,{x:d.x+N.x,y:d.y+N.y},n],m,b,g,x]}function pd(e,t,n,o){const r=Math.min(No(e,t)/2,No(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 l=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${i+r*l},${s}Q ${i},${s} ${i},${s+r*d}`}const a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${s+r*c}Q ${i},${s} ${i+r*a},${s}`}function Bt({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top,borderRadius:s=5,centerX:a,centerY:c,offset:l=20,stepPosition:d=.5}){const[f,u,h,y,m]=gd({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:c},offset:l,stepPosition:d});return[f.reduce((w,N,g)=>{let x="";return g>0&&g<f.length-1?x=pd(f[g-1],N,f[g+1],s):x=`${g===0?"M":"L"}${N.x} ${N.y}`,w+=x,w},""),u,h,y,m]}function Co(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function md(e){const{sourceNode:t,targetNode:n}=e;if(!Co(t)||!Co(n))return null;const o=t.internals.handleBounds||Mo(t.handles),r=n.internals.handleBounds||Mo(n.handles),i=ko(o?.source??[],e.sourceHandle),s=ko(e.connectionMode===Oe.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",he.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=i?.position||X.Bottom,c=s?.position||X.Top,l=ct(t,i,a),d=ct(n,s,c);return{sourceX:l.x,sourceY:l.y,targetX:d.x,targetY:d.y,sourcePosition:a,targetPosition:c}}function Mo(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 ct(e,t,n=X.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??xe(e);if(o)return{x:r+s/2,y:i+a/2};switch(t?.position??n){case X.Top:return{x:r+s/2,y:i};case X.Right:return{x:r+s,y:i+a/2};case X.Bottom:return{x:r+s/2,y:i+a};case X.Left:return{x:r,y:i+a/2}}}function ko(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Nn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function yd(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(c=>{if(c&&typeof c=="object"){const l=Nn(c,t);i.has(l)||(s.push({id:l,color:c.color||n,...c}),i.add(l))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const Bn={nodeOrigin:[0,0],nodeExtent:rt,elevateNodesOnSelect:!0,defaults:{}},xd={...Bn,checkEquality:!0};function Vn(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function wd(e,t,n){const o=Vn(Bn,n);for(const r of e.values())if(r.parentId)Fn(r,e,t,o);else{const i=ht(r,o.nodeOrigin),s=Fe(r.extent)?r.extent:o.nodeExtent,a=ke(i,s,xe(r));r.internals.positionAbsolute=a}}function vd(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 Cn(e,t,n,o){const r=Vn(xd,o);let i=e.length>0;const s=new Map(t),a=r?.elevateNodesOnSelect?1e3:0;t.clear(),n.clear();for(const c of e){let l=s.get(c.id);if(r.checkEquality&&c===l?.internals.userNode)t.set(c.id,l);else{const d=ht(c,r.nodeOrigin),f=Fe(c.extent)?c.extent:r.nodeExtent,u=ke(d,f,xe(c));l={...r.defaults,...c,measured:{width:c.measured?.width,height:c.measured?.height},internals:{positionAbsolute:u,handleBounds:vd(c,l),z:ui(c,a),userNode:c}},t.set(c.id,l)}(l.measured===void 0||l.measured.width===void 0||l.measured.height===void 0)&&!l.hidden&&(i=!1),c.parentId&&Fn(l,t,n,o)}return i}function bd(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 Fn(e,t,n,o){const{elevateNodesOnSelect:r,nodeOrigin:i,nodeExtent:s}=Vn(Bn,o),a=e.parentId,c=t.get(a);if(!c){console.warn(`Parent node ${a} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}bd(e,n);const l=r?1e3:0,{x:d,y:f,z:u}=_d(e,c,i,s,l),{positionAbsolute:h}=e.internals,y=d!==h.x||f!==h.y;(y||u!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:y?{x:d,y:f}:h,z:u}})}function ui(e,t){return(ue(e.zIndex)?e.zIndex:0)+(e.selected?t:0)}function _d(e,t,n,o,r){const{x:i,y:s}=t.internals.positionAbsolute,a=xe(e),c=ht(e,n),l=Fe(e.extent)?ke(c,e.extent,a):c;let d=ke({x:i+l.x,y:s+l.y},o,a);e.extent==="parent"&&(d=Qr(d,a,t));const f=ui(e,r),u=t.internals.z??0;return{x:d.x,y:d.y,z:u>=f?u+1:f}}function Xn(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 c=i.get(s.parentId)?.expandedRect??Ve(a),l=ei(c,s.rect);i.set(s.parentId,{expandedRect:l,parent:a})}return i.size>0&&i.forEach(({expandedRect:s,parent:a},c)=>{const l=a.internals.positionAbsolute,d=xe(a),f=a.origin??o,u=s.x<l.x?Math.round(Math.abs(l.x-s.x)):0,h=s.y<l.y?Math.round(Math.abs(l.y-s.y)):0,y=Math.max(d.width,Math.round(s.width)),m=Math.max(d.height,Math.round(s.height)),b=(y-d.width)*f[0],w=(m-d.height)*f[1];(u>0||h>0||b||w)&&(r.push({id:c,type:"position",position:{x:a.position.x-u+b,y:a.position.y-h+w}}),n.get(c)?.forEach(N=>{e.some(g=>g.id===N.id)||r.push({id:N.id,type:"position",position:{x:N.position.x+u,y:N.position.y+h}})})),(d.width<s.width||d.height<s.height||u||h)&&r.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:y+(u?f[0]*u-b:0),height:m+(h?f[1]*h-w:0)}})}),r}function Ed(e,t,n,o,r,i){const s=o?.querySelector(".xyflow__viewport");let a=!1;if(!s)return{changes:[],updatedInternals:a};const c=[],l=window.getComputedStyle(s),{m22:d}=new window.DOMMatrixReadOnly(l.transform),f=[];for(const u of e.values()){const h=t.get(u.id);if(!h)continue;if(h.hidden){t.set(h.id,{...h,internals:{...h.internals,handleBounds:void 0}}),a=!0;continue}const y=On(u.nodeElement),m=h.measured.width!==y.width||h.measured.height!==y.height;if(!!(y.width&&y.height&&(m||!h.internals.handleBounds||u.force))){const w=u.nodeElement.getBoundingClientRect(),N=Fe(h.extent)?h.extent:i;let{positionAbsolute:g}=h.internals;h.parentId&&h.extent==="parent"?g=Qr(g,y,t.get(h.parentId)):N&&(g=ke(g,N,y));const x={...h,measured:y,internals:{...h.internals,positionAbsolute:g,handleBounds:{source:_o("source",u.nodeElement,w,d,h.id),target:_o("target",u.nodeElement,w,d,h.id)}}};t.set(h.id,x),h.parentId&&Fn(x,t,n,{nodeOrigin:r}),a=!0,m&&(c.push({id:h.id,type:"dimensions",dimensions:y}),h.expandParent&&h.parentId&&f.push({id:h.id,parentId:h.parentId,rect:Ve(x,r)}))}}if(f.length>0){const u=Xn(f,t,n,r);c.push(...u)}return{changes:c,updatedInternals:a}}async function Sd({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 Io(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 c=o.get(s)||new Map;if(o.set(s,c.set(n,t)),i){s=`${r}-${e}-${i}`;const l=o.get(s)||new Map;o.set(s,l.set(n,t))}}function di(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,c={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},l=`${r}-${s}--${i}-${a}`,d=`${i}-${a}--${r}-${s}`;Io("source",c,d,e,r,s),Io("target",c,l,e,i,a),t.set(o.id,o)}}function fi(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:fi(n,t):!1}function Ao(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 Nd(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!fi(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 an({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[s,a]of t){const c=n.get(s)?.internals.userNode;c&&r.push({...c,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 Cd({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 Md({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,c=!1,l={x:0,y:0},d=null,f=!1,u=null,h=!1,y=!1,m=null;function b({noDragClassName:N,handleSelector:g,domNode:x,isSelectable:E,nodeId:_,nodeClickDistance:k=0}){u=ae(x);function I({x:A,y:z}){const{nodeLookup:v,nodeExtent:M,snapGrid:S,snapToGrid:C,nodeOrigin:T,onNodeDrag:P,onSelectionDrag:$,onError:H,updateNodePositions:L}=t();i={x:A,y:z};let F=!1;const V=a.size>1,Z=V&&M?Sn(gt(a)):null,U=V&&C?Cd({dragItems:a,snapGrid:S,x:A,y:z}):null;for(const[Y,O]of a){if(!v.has(Y))continue;let W={x:A-O.distance.x,y:z-O.distance.y};C&&(W=U?{x:Math.round(W.x+U.x),y:Math.round(W.y+U.y)}:pt(W,S));let ee=null;if(V&&M&&!O.extent&&Z){const{positionAbsolute:q}=O.internals,K=q.x-Z.x+M[0][0],te=q.x+O.measured.width-Z.x2+M[1][0],ie=q.y-Z.y+M[0][1],se=q.y+O.measured.height-Z.y2+M[1][1];ee=[[K,ie],[te,se]]}const{position:J,positionAbsolute:G}=Kr({nodeId:Y,nextPosition:W,nodeLookup:v,nodeExtent:ee||M,nodeOrigin:T,onError:H});F=F||O.position.x!==J.x||O.position.y!==J.y,O.position=J,O.internals.positionAbsolute=G}if(y=y||F,!!F&&(L(a,!0),m&&(o||P||!_&&$))){const[Y,O]=an({nodeId:_,dragItems:a,nodeLookup:v});o?.(m,a,Y,O),P?.(m,Y,O),_||$?.(m,O)}}async function j(){if(!d)return;const{transform:A,panBy:z,autoPanSpeed:v,autoPanOnNodeDrag:M}=t();if(!M){c=!1,cancelAnimationFrame(s);return}const[S,C]=Jr(l,d,v);(S!==0||C!==0)&&(i.x=(i.x??0)-S/A[2],i.y=(i.y??0)-C/A[2],await z({x:S,y:C})&&I(i)),s=requestAnimationFrame(j)}function B(A){const{nodeLookup:z,multiSelectionActive:v,nodesDraggable:M,transform:S,snapGrid:C,snapToGrid:T,selectNodesOnDrag:P,onNodeDragStart:$,onSelectionDragStart:H,unselectNodesAndEdges:L}=t();f=!0,(!P||!E)&&!v&&_&&(z.get(_)?.selected||L()),E&&P&&_&&e?.(_);const F=et(A.sourceEvent,{transform:S,snapGrid:C,snapToGrid:T,containerBounds:d});if(i=F,a=Nd(z,M,F,_),a.size>0&&(n||$||!_&&H)){const[V,Z]=an({nodeId:_,dragItems:a,nodeLookup:z});n?.(A.sourceEvent,a,V,Z),$?.(A.sourceEvent,V,Z),_||H?.(A.sourceEvent,Z)}}const R=zr().clickDistance(k).on("start",A=>{const{domNode:z,nodeDragThreshold:v,transform:M,snapGrid:S,snapToGrid:C}=t();d=z?.getBoundingClientRect()||null,h=!1,y=!1,m=A.sourceEvent,v===0&&B(A),i=et(A.sourceEvent,{transform:M,snapGrid:S,snapToGrid:C,containerBounds:d}),l=de(A.sourceEvent,d)}).on("drag",A=>{const{autoPanOnNodeDrag:z,transform:v,snapGrid:M,snapToGrid:S,nodeDragThreshold:C,nodeLookup:T}=t(),P=et(A.sourceEvent,{transform:v,snapGrid:M,snapToGrid:S,containerBounds:d});if(m=A.sourceEvent,(A.sourceEvent.type==="touchmove"&&A.sourceEvent.touches.length>1||_&&!T.has(_))&&(h=!0),!h){if(!c&&z&&f&&(c=!0,j()),!f){const $=de(A.sourceEvent,d),H=$.x-l.x,L=$.y-l.y;Math.sqrt(H*H+L*L)>C&&B(A)}(i.x!==P.xSnapped||i.y!==P.ySnapped)&&a&&f&&(l=de(A.sourceEvent,d),I(P))}}).on("end",A=>{if(!(!f||h)&&(c=!1,f=!1,cancelAnimationFrame(s),a.size>0)){const{nodeLookup:z,updateNodePositions:v,onNodeDragStop:M,onSelectionDragStop:S}=t();if(y&&(v(a,!1),y=!1),r||M||!_&&S){const[C,T]=an({nodeId:_,dragItems:a,nodeLookup:z,dragging:!1});r?.(A.sourceEvent,a,C,T),M?.(A.sourceEvent,C,T),_||S?.(A.sourceEvent,T)}}}).filter(A=>{const z=A.target;return!A.button&&(!N||!Ao(z,`.${N}`,x))&&(!g||Ao(z,g,x))});u.call(R)}function w(){u?.on(".drag",null)}return{update:b,destroy:w}}function kd(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())st(r,Ve(i))>0&&o.push(i);return o}const Id=250;function Ad(e,t,n,o){let r=[],i=1/0;const s=kd(e,n,t+Id);for(const a of s){const c=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(const l of c){if(o.nodeId===l.nodeId&&o.type===l.type&&o.id===l.id)continue;const{x:d,y:f}=ct(a,l,l.position,!0),u=Math.sqrt(Math.pow(d-e.x,2)+Math.pow(f-e.y,2));u>t||(u<i?(r=[{...l,x:d,y:f}],i=u):u===i&&r.push({...l,x:d,y:f}))}}if(!r.length)return null;if(r.length>1){const a=o.type==="source"?"target":"source";return r.find(c=>c.type===a)??r[0]}return r[0]}function hi(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??[]],c=(n?a?.find(l=>l.id===n):a?.[0])??null;return c&&i?{...c,...ct(s,c,c.position,!0)}:c}function gi(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function Pd(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const pi=()=>!0;function Dd(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:c,lib:l,autoPanOnConnect:d,flowId:f,panBy:u,cancelConnection:h,onConnectStart:y,onConnect:m,onConnectEnd:b,isValidConnection:w=pi,onReconnectEnd:N,updateConnection:g,getTransform:x,getFromHandle:E,autoPanSpeed:_,dragThreshold:k=1,handleDomNode:I}){const j=oi(e.target);let B=0,R;const{x:A,y:z}=de(e),v=gi(i,I),M=a?.getBoundingClientRect();let S=!1;if(!M||!v)return;const C=hi(r,v,o,c,t);if(!C)return;let T=de(e,M),P=!1,$=null,H=!1,L=null;function F(){if(!d||!M)return;const[J,G]=Jr(T,M,_);u({x:J,y:G}),B=requestAnimationFrame(F)}const V={...C,nodeId:r,type:v,position:C.position},Z=c.get(r);let Y={inProgress:!0,isValid:null,from:ct(Z,V,X.Left,!0),fromHandle:V,fromPosition:V.position,fromNode:Z,to:T,toHandle:null,toPosition:xo[V.position],toNode:null};function O(){S=!0,g(Y),y?.(e,{nodeId:r,handleId:o,handleType:v})}k===0&&O();function W(J){if(!S){const{x:te,y:ie}=de(J),se=te-A,Ie=ie-z;if(!(se*se+Ie*Ie>k*k))return;O()}if(!E()||!V){ee(J);return}const G=x();T=de(J,M),R=Ad(mt(T,G,!1,[1,1]),n,c,V),P||(F(),P=!0);const q=mi(J,{handle:R,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:w,doc:j,lib:l,flowId:f,nodeLookup:c});L=q.handleDomNode,$=q.connection,H=Pd(!!R,q.isValid);const K={...Y,isValid:H,to:q.toHandle&&H?Ot({x:q.toHandle.x,y:q.toHandle.y},G):T,toHandle:q.toHandle,toPosition:H&&q.toHandle?q.toHandle.position:xo[V.position],toNode:q.toHandle?c.get(q.toHandle.nodeId):null};H&&R&&Y.toHandle&&K.toHandle&&Y.toHandle.type===K.toHandle.type&&Y.toHandle.nodeId===K.toHandle.nodeId&&Y.toHandle.id===K.toHandle.id&&Y.to.x===K.to.x&&Y.to.y===K.to.y||(g(K),Y=K)}function ee(J){if(!("touches"in J&&J.touches.length>0)){if(S){(R||L)&&$&&H&&m?.($);const{inProgress:G,...q}=Y,K={...q,toPosition:Y.toHandle?Y.toPosition:null};b?.(J,K),i&&N?.(J,K)}h(),cancelAnimationFrame(B),P=!1,H=!1,$=null,L=null,j.removeEventListener("mousemove",W),j.removeEventListener("mouseup",ee),j.removeEventListener("touchmove",W),j.removeEventListener("touchend",ee)}}j.addEventListener("mousemove",W),j.addEventListener("mouseup",ee),j.addEventListener("touchmove",W),j.addEventListener("touchend",ee)}function mi(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:l=pi,nodeLookup:d}){const f=i==="target",u=t?s.querySelector(`.${a}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y}=de(e),m=s.elementFromPoint(h,y),b=m?.classList.contains(`${a}-flow__handle`)?m:u,w={handleDomNode:b,isValid:!1,connection:null,toHandle:null};if(b){const N=gi(void 0,b),g=b.getAttribute("data-nodeid"),x=b.getAttribute("data-handleid"),E=b.classList.contains("connectable"),_=b.classList.contains("connectableend");if(!g||!N)return w;const k={source:f?g:o,sourceHandle:f?x:r,target:f?o:g,targetHandle:f?r:x};w.connection=k;const j=E&&_&&(n===Oe.Strict?f&&N==="source"||!f&&N==="target":g!==o||x!==r);w.isValid=j&&l(k),w.toHandle=hi(g,N,x,d,n,!0)}return w}const Mn={onPointerDown:Dd,isValid:mi};function Td({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=ae(e);function i({translateExtent:a,width:c,height:l,zoomStep:d=1,pannable:f=!0,zoomable:u=!0,inversePan:h=!1}){const y=g=>{if(g.sourceEvent.type!=="wheel"||!t)return;const x=n(),E=g.sourceEvent.ctrlKey&&at()?10:1,_=-g.sourceEvent.deltaY*(g.sourceEvent.deltaMode===1?.05:g.sourceEvent.deltaMode?1:.002)*d,k=x[2]*Math.pow(2,_*E);t.scaleTo(k)};let m=[0,0];const b=g=>{(g.sourceEvent.type==="mousedown"||g.sourceEvent.type==="touchstart")&&(m=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY])},w=g=>{const x=n();if(g.sourceEvent.type!=="mousemove"&&g.sourceEvent.type!=="touchmove"||!t)return;const E=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY],_=[E[0]-m[0],E[1]-m[1]];m=E;const k=o()*Math.max(x[2],Math.log(x[2]))*(h?-1:1),I={x:x[0]-_[0]*k,y:x[1]-_[1]*k},j=[[0,0],[c,l]];t.setViewportConstrained({x:I.x,y:I.y,zoom:x[2]},j,a)},N=Yr().on("start",b).on("zoom",f?w:null).on("zoom.wheel",u?y:null);r.call(N,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:le}}const jd=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,Ut=e=>({x:e.x,y:e.y,zoom:e.k}),cn=({x:e,y:t,zoom:n})=>Zt.translate(e,t).scale(n),De=(e,t)=>e.target.closest(`.${t}`),yi=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),$d=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,ln=(e,t=0,n=$d,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},xi=e=>{const t=e.ctrlKey&&at()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function zd({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:l}){return d=>{if(De(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(d.ctrlKey&&s){const b=le(d),w=xi(d),N=f*Math.pow(2,w);o.scaleTo(n,N,b,d);return}const u=d.deltaMode===1?20:1;let h=r===Ce.Vertical?0:d.deltaX*u,y=r===Ce.Horizontal?0:d.deltaY*u;!at()&&d.shiftKey&&r!==Ce.Vertical&&(h=d.deltaY*u,y=0),o.translateBy(n,-(h/f)*i,-(y/f)*i,{internal:!0});const m=Ut(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling||(e.isPanScrolling=!0,a?.(d,m)),e.isPanScrolling&&(c?.(d,m),e.panScrollTimeout=setTimeout(()=>{l?.(d,m),e.isPanScrolling=!1},150))}}function Hd({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,a=De(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function Ld({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=Ut(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 Rd({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&yi(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,Ut(i.transform))}}function Od({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&yi(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r&&jd(e.prevViewport,s.transform))){const a=Ut(s.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,a)},n?150:0)}}}function Bd({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:c,lib:l,connectionInProgress:d}){return f=>{const u=e||t,h=n&&f.ctrlKey,y=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(De(f,`${l}-flow__node`)||De(f,`${l}-flow__edge`)))return!0;if(!o&&!u&&!r&&!i&&!n||s||d&&!y||De(f,a)&&y||De(f,c)&&(!y||r&&y&&!e)||!n&&f.ctrlKey&&y)return!1;if(!n&&f.type==="touchstart"&&f.touches?.length>1)return f.preventDefault(),!1;if(!u&&!r&&!h&&y||!o&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(o)&&!o.includes(f.button)&&f.type==="mousedown")return!1;const m=Array.isArray(o)&&o.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||y)&&m}}function Vd({domNode:e,minZoom:t,maxZoom:n,paneClickDistance:o,translateExtent:r,viewport:i,onPanZoom:s,onPanZoomStart:a,onPanZoomEnd:c,onDraggingChange:l}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=e.getBoundingClientRect(),u=Yr().clickDistance(!ue(o)||o<0?0:o).scaleExtent([t,n]).translateExtent(r),h=ae(e).call(u);g({x:i.x,y:i.y,zoom:Be(i.zoom,t,n)},[[0,0],[f.width,f.height]],r);const y=h.on("wheel.zoom"),m=h.on("dblclick.zoom");u.wheelDelta(xi);function b(A,z){return h?new Promise(v=>{u?.interpolate(z?.interpolate==="linear"?on:kt).transform(ln(h,z?.duration,z?.ease,()=>v(!0)),A)}):Promise.resolve(!1)}function w({noWheelClassName:A,noPanClassName:z,onPaneContextMenu:v,userSelectionActive:M,panOnScroll:S,panOnDrag:C,panOnScrollMode:T,panOnScrollSpeed:P,preventScrolling:$,zoomOnPinch:H,zoomOnScroll:L,zoomOnDoubleClick:F,zoomActivationKeyPressed:V,lib:Z,onTransformChange:U,connectionInProgress:Y}){M&&!d.isZoomingOrPanning&&N();const W=S&&!V&&!M?zd({zoomPanValues:d,noWheelClassName:A,d3Selection:h,d3Zoom:u,panOnScrollMode:T,panOnScrollSpeed:P,zoomOnPinch:H,onPanZoomStart:a,onPanZoom:s,onPanZoomEnd:c}):Hd({noWheelClassName:A,preventScrolling:$,d3ZoomHandler:y});if(h.on("wheel.zoom",W,{passive:!1}),!M){const J=Ld({zoomPanValues:d,onDraggingChange:l,onPanZoomStart:a});u.on("start",J);const G=Rd({zoomPanValues:d,panOnDrag:C,onPaneContextMenu:!!v,onPanZoom:s,onTransformChange:U});u.on("zoom",G);const q=Od({zoomPanValues:d,panOnDrag:C,panOnScroll:S,onPaneContextMenu:v,onPanZoomEnd:c,onDraggingChange:l});u.on("end",q)}const ee=Bd({zoomActivationKeyPressed:V,panOnDrag:C,zoomOnScroll:L,panOnScroll:S,zoomOnDoubleClick:F,zoomOnPinch:H,userSelectionActive:M,noPanClassName:z,noWheelClassName:A,lib:Z,connectionInProgress:Y});u.filter(ee),F?h.on("dblclick.zoom",m):h.on("dblclick.zoom",null)}function N(){u.on("zoom",null)}async function g(A,z,v){const M=cn(A),S=u?.constrain()(M,z,v);return S&&await b(S),new Promise(C=>C(S))}async function x(A,z){const v=cn(A);return await b(v,z),new Promise(M=>M(v))}function E(A){if(h){const z=cn(A),v=h.property("__zoom");(v.k!==A.zoom||v.x!==A.x||v.y!==A.y)&&u?.transform(h,z,null,{sync:!0})}}function _(){const A=h?Xr(h.node()):{x:0,y:0,k:1};return{x:A.x,y:A.y,zoom:A.k}}function k(A,z){return h?new Promise(v=>{u?.interpolate(z?.interpolate==="linear"?on:kt).scaleTo(ln(h,z?.duration,z?.ease,()=>v(!0)),A)}):Promise.resolve(!1)}function I(A,z){return h?new Promise(v=>{u?.interpolate(z?.interpolate==="linear"?on:kt).scaleBy(ln(h,z?.duration,z?.ease,()=>v(!0)),A)}):Promise.resolve(!1)}function j(A){u?.scaleExtent(A)}function B(A){u?.translateExtent(A)}function R(A){const z=!ue(A)||A<0?0:A;u?.clickDistance(z)}return{update:w,destroy:N,setViewport:x,setViewportConstrained:g,getViewport:_,scaleTo:k,scaleBy:I,setScaleExtent:j,setTranslateExtent:B,syncViewport:E,setClickDistance:R}}var Xe;(function(e){e.Line="line",e.Handle="handle"})(Xe||(Xe={}));function Fd({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,a=n-o,c=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(c[0]=c[0]*-1),a&&i&&(c[1]=c[1]*-1),c}function Xd(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 we(e,t){return Math.max(0,t-e)}function ve(e,t){return Math.max(0,e-t)}function Nt(e,t,n){return Math.max(0,t-e,e-n)}function Po(e,t){return e?!t:t}function Yd(e,t,n,o,r,i,s,a){let{affectsX:c,affectsY:l}=t;const{isHorizontal:d,isVertical:f}=t,u=d&&f,{xSnapped:h,ySnapped:y}=n,{minWidth:m,maxWidth:b,minHeight:w,maxHeight:N}=o,{x:g,y:x,width:E,height:_,aspectRatio:k}=e;let I=Math.floor(d?h-e.pointerX:0),j=Math.floor(f?y-e.pointerY:0);const B=E+(c?-I:I),R=_+(l?-j:j),A=-i[0]*E,z=-i[1]*_;let v=Nt(B,m,b),M=Nt(R,w,N);if(s){let T=0,P=0;c&&I<0?T=we(g+I+A,s[0][0]):!c&&I>0&&(T=ve(g+B+A,s[1][0])),l&&j<0?P=we(x+j+z,s[0][1]):!l&&j>0&&(P=ve(x+R+z,s[1][1])),v=Math.max(v,T),M=Math.max(M,P)}if(a){let T=0,P=0;c&&I>0?T=ve(g+I,a[0][0]):!c&&I<0&&(T=we(g+B,a[1][0])),l&&j>0?P=ve(x+j,a[0][1]):!l&&j<0&&(P=we(x+R,a[1][1])),v=Math.max(v,T),M=Math.max(M,P)}if(r){if(d){const T=Nt(B/k,w,N)*k;if(v=Math.max(v,T),s){let P=0;!c&&!l||c&&!l&&u?P=ve(x+z+B/k,s[1][1])*k:P=we(x+z+(c?I:-I)/k,s[0][1])*k,v=Math.max(v,P)}if(a){let P=0;!c&&!l||c&&!l&&u?P=we(x+B/k,a[1][1])*k:P=ve(x+(c?I:-I)/k,a[0][1])*k,v=Math.max(v,P)}}if(f){const T=Nt(R*k,m,b)/k;if(M=Math.max(M,T),s){let P=0;!c&&!l||l&&!c&&u?P=ve(g+R*k+A,s[1][0])/k:P=we(g+(l?j:-j)*k+A,s[0][0])/k,M=Math.max(M,P)}if(a){let P=0;!c&&!l||l&&!c&&u?P=we(g+R*k,a[1][0])/k:P=ve(g+(l?j:-j)*k,a[0][0])/k,M=Math.max(M,P)}}}j=j+(j<0?M:-M),I=I+(I<0?v:-v),r&&(u?B>R*k?j=(Po(c,l)?-I:I)/k:I=(Po(c,l)?-j:j)*k:d?(j=I/k,l=c):(I=j*k,c=l));const S=c?g+I:g,C=l?x+j:x;return{width:E+(c?-I:I),height:_+(l?-j:j),x:i[0]*I*(c?-1:1)+S,y:i[1]*j*(l?-1:1)+C}}const wi={width:0,height:0,x:0,y:0},Wd={...wi,pointerX:0,pointerY:0,aspectRatio:1};function Zd(e){return[[0,0],[e.measured.width,e.measured.height]]}function Gd(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,c=n[1]*s;return[[o-a,r-c],[o+i-a,r+s-c]]}function qd({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=ae(e);function s({controlPosition:c,boundaries:l,keepAspectRatio:d,resizeDirection:f,onResizeStart:u,onResize:h,onResizeEnd:y,shouldResize:m}){let b={...wi},w={...Wd};const N=Xd(c);let g,x=null,E=[],_,k,I,j=!1;const B=zr().on("start",R=>{const{nodeLookup:A,transform:z,snapGrid:v,snapToGrid:M,nodeOrigin:S,paneDomNode:C}=n();if(g=A.get(t),!g)return;x=C?.getBoundingClientRect()??null;const{xSnapped:T,ySnapped:P}=et(R.sourceEvent,{transform:z,snapGrid:v,snapToGrid:M,containerBounds:x});b={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},w={...b,pointerX:T,pointerY:P,aspectRatio:b.width/b.height},_=void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(_=A.get(g.parentId),k=_&&g.extent==="parent"?Zd(_):void 0),E=[],I=void 0;for(const[$,H]of A)if(H.parentId===t&&(E.push({id:$,position:{...H.position},extent:H.extent}),H.extent==="parent"||H.expandParent)){const L=Gd(H,g,H.origin??S);I?I=[[Math.min(L[0][0],I[0][0]),Math.min(L[0][1],I[0][1])],[Math.max(L[1][0],I[1][0]),Math.max(L[1][1],I[1][1])]]:I=L}u?.(R,{...b})}).on("drag",R=>{const{transform:A,snapGrid:z,snapToGrid:v,nodeOrigin:M}=n(),S=et(R.sourceEvent,{transform:A,snapGrid:z,snapToGrid:v,containerBounds:x}),C=[];if(!g)return;const{x:T,y:P,width:$,height:H}=b,L={},F=g.origin??M,{width:V,height:Z,x:U,y:Y}=Yd(w,N,S,l,d,F,k,I),O=V!==$,W=Z!==H,ee=U!==T&&O,J=Y!==P&&W;if(!ee&&!J&&!O&&!W)return;if((ee||J||F[0]===1||F[1]===1)&&(L.x=ee?U:b.x,L.y=J?Y:b.y,b.x=L.x,b.y=L.y,E.length>0)){const te=U-T,ie=Y-P;for(const se of E)se.position={x:se.position.x-te+F[0]*(V-$),y:se.position.y-ie+F[1]*(Z-H)},C.push(se)}if((O||W)&&(L.width=O&&(!f||f==="horizontal")?V:b.width,L.height=W&&(!f||f==="vertical")?Z:b.height,b.width=L.width,b.height=L.height),_&&g.expandParent){const te=F[0]*(L.width??0);L.x&&L.x<te&&(b.x=te,w.x=w.x-(L.x-te));const ie=F[1]*(L.height??0);L.y&&L.y<ie&&(b.y=ie,w.y=w.y-(L.y-ie))}const G=Fd({width:b.width,prevWidth:$,height:b.height,prevHeight:H,affectsX:N.affectsX,affectsY:N.affectsY}),q={...b,direction:G};m?.(R,q)!==!1&&(j=!0,h?.(R,q),o(L,C))}).on("end",R=>{j&&(y?.(R,{...b}),r?.({...b}),j=!1)});i.call(B)}function a(){i.on(".drag",null)}return{update:s,destroy:a}}var un={exports:{}},dn={};var Do;function Ud(){if(Do)return dn;Do=1;var e=aa(),t=ca();function n(l,d){return l===d&&(l!==0||1/l===1/d)||l!==l&&d!==d}var o=typeof Object.is=="function"?Object.is:n,r=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,a=e.useMemo,c=e.useDebugValue;return dn.useSyncExternalStoreWithSelector=function(l,d,f,u,h){var y=i(null);if(y.current===null){var m={hasValue:!1,value:null};y.current=m}else m=y.current;y=a(function(){function w(_){if(!N){if(N=!0,g=_,_=u(_),h!==void 0&&m.hasValue){var k=m.value;if(h(k,_))return x=k}return x=_}if(k=x,o(g,_))return k;var I=u(_);return h!==void 0&&h(k,I)?(g=_,k):(g=_,x=I)}var N=!1,g,x,E=f===void 0?null:f;return[function(){return w(d())},E===null?void 0:function(){return w(E())}]},[d,f,u,h]);var b=r(l,y[0],y[1]);return s(function(){m.hasValue=!0,m.value=b},[b]),c(b),b},dn}var To;function Kd(){return To||(To=1,un.exports=Ud()),un.exports}var Qd=Kd();const Jd=la(Qd),ef={},jo=e=>{let t;const n=new Set,o=(d,f)=>{const u=typeof d=="function"?d(t):d;if(!Object.is(u,t)){const h=t;t=f??(typeof u!="object"||u===null)?u:Object.assign({},t,u),n.forEach(y=>y(t,h))}},r=()=>t,c={setState:o,getState:r,getInitialState:()=>l,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(ef?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},l=t=e(o,r,c);return c},tf=e=>e?jo(e):jo,{useDebugValue:nf}=$e,{useSyncExternalStoreWithSelector:of}=Jd,rf=e=>e;function vi(e,t=rf,n){const o=of(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return nf(o),o}const $o=(e,t)=>{const n=tf(e),o=(r,i=t)=>vi(n,r,i);return Object.assign(o,n),o},sf=(e,t)=>e?$o(e,t):$o;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 Kt=D.createContext(null),af=Kt.Provider,bi=he.error001();function Q(e,t){const n=D.useContext(Kt);if(n===null)throw new Error(bi);return vi(n,e,t)}function ne(){const e=D.useContext(Kt);if(e===null)throw new Error(bi);return D.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const zo={display:"none"},cf={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},_i="react-flow__node-desc",Ei="react-flow__edge-desc",lf="react-flow__aria-live",uf=e=>e.ariaLiveMessage,df=e=>e.ariaLabelConfig;function ff({rfId:e}){const t=Q(uf);return p.jsx("div",{id:`${lf}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:cf,children:t})}function hf({rfId:e,disableKeyboardA11y:t}){const n=Q(df);return p.jsxs(p.Fragment,{children:[p.jsx("div",{id:`${_i}-${e}`,style:zo,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),p.jsx("div",{id:`${Ei}-${e}`,style:zo,children:n["edge.a11yDescription.default"]}),!t&&p.jsx(ff,{rfId:e})]})}const Qt=D.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return p.jsx("div",{className:re(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});Qt.displayName="Panel";function gf({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:p.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:p.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const pf=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}},Ct=e=>e.id;function mf(e,t){return oe(e.selectedNodes.map(Ct),t.selectedNodes.map(Ct))&&oe(e.selectedEdges.map(Ct),t.selectedEdges.map(Ct))}function yf({onSelectionChange:e}){const t=ne(),{selectedNodes:n,selectedEdges:o}=Q(pf,mf);return D.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}const xf=e=>!!e.onSelectionChangeHandlers;function wf({onSelectionChange:e}){const t=Q(xf);return e||t?p.jsx(yf,{onSelectionChange:e}):null}const Si=[0,0],vf={x:0,y:0,zoom:1},bf=["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","paneClickDistance","ariaLabelConfig"],Ho=[...bf,"rfId"],_f=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setPaneClickDistance:e.setPaneClickDistance}),Lo={translateExtent:rt,nodeOrigin:Si,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1",paneClickDistance:0};function Ef(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:c,setPaneClickDistance:l}=Q(_f,oe),d=ne();D.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{f.current=Lo,a()}),[]);const f=D.useRef(Lo);return D.useEffect(()=>{for(const u of Ho){const h=e[u],y=f.current[u];h!==y&&(typeof e[u]>"u"||(u==="nodes"?t(h):u==="edges"?n(h):u==="minZoom"?o(h):u==="maxZoom"?r(h):u==="translateExtent"?i(h):u==="nodeExtent"?s(h):u==="paneClickDistance"?l(h):u==="ariaLabelConfig"?d.setState({ariaLabelConfig:sd(h)}):u==="fitView"?d.setState({fitViewQueued:h}):u==="fitViewOptions"?d.setState({fitViewOptions:h}):d.setState({[u]:h})))}f.current=e},Ho.map(u=>e[u])),null}function Ro(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Sf(e){const[t,n]=D.useState(e==="system"?null:e);return D.useEffect(()=>{if(e!=="system"){n(e);return}const o=Ro(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:Ro()?.matches?"dark":"light"}const Oo=typeof document<"u"?document:null;function lt(e=null,t={target:Oo,actInsideInputWithModifier:!0}){const[n,o]=D.useState(!1),r=D.useRef(!1),i=D.useRef(new Set([])),[s,a]=D.useMemo(()=>{if(e!==null){const l=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",`
1
+ import{j as p,c_ as aa,dE as ca,c2 as la,t as $e,r as D,aB as ua,bi as gn,G as He,cp as lr,cq as ur,cr as dr,cs as fr,cS as hr,cT as gr,cU as pr,e as pn,dm as da,dF as mr,ao as mn,aJ as yr,aK as xr,B as Je,I as fa,aQ as ha,S as ga,b7 as pa,aW as ma,b8 as ya,b9 as xa,bb as wa,u as va,a2 as ba,a3 as _a,a4 as Ea,a5 as Sa,a6 as Na,a7 as Ca,a8 as Ma}from"./index-BkbhBpVC.js";import{M as An}from"./mail-ccQhEr7k.js";import{C as Pn,P as ka}from"./power-DWm6pts5.js";import{i as Ee,c as oo,a as ro,b as Ia,d as on}from"./value-BGBiTkF3.js";import{M as yn,i as Aa,a as Pa,A as Da,b as Ta,c as ja}from"./automations-BBWZhrha.js";import{C as io}from"./checkbox-B_yDSM8z.js";import{L as so}from"./label-BiPpMny2.js";import{S as $a,a as za}from"./select-BfWJkrKc.js";import{C as Ha}from"./circle-alert-bcK_Yqap.js";import{P as La}from"./pencil-BcymGPnE.js";import"./index-Cq5vsvxE.js";import"./chevron-up-DuaKtE_M.js";var ao=180/Math.PI,xn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function wr(e,t,n,o,r,i){var s,a,c;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(c=e*n+t*o)&&(n-=e*c,o-=t*c),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,c/=a),e*o<t*n&&(e=-e,t=-t,c=-c,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*ao,skewX:Math.atan(c)*ao,scaleX:s,scaleY:a}}var bt;function Ra(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?xn:wr(t.a,t.b,t.c,t.d,t.e,t.f)}function Oa(e){return e==null||(bt||(bt=document.createElementNS("http://www.w3.org/2000/svg","g")),bt.setAttribute("transform",e),!(e=bt.transform.baseVal.consolidate()))?xn:(e=e.matrix,wr(e.a,e.b,e.c,e.d,e.e,e.f))}function vr(e,t,n,o){function r(l){return l.length?l.pop()+" ":""}function i(l,d,f,u,h,y){if(l!==f||d!==u){var m=h.push("translate(",null,t,null,n);y.push({i:m-4,x:Ee(l,f)},{i:m-2,x:Ee(d,u)})}else(f||u)&&h.push("translate("+f+t+u+n)}function s(l,d,f,u){l!==d?(l-d>180?d+=360:d-l>180&&(l+=360),u.push({i:f.push(r(f)+"rotate(",null,o)-2,x:Ee(l,d)})):d&&f.push(r(f)+"rotate("+d+o)}function a(l,d,f,u){l!==d?u.push({i:f.push(r(f)+"skewX(",null,o)-2,x:Ee(l,d)}):d&&f.push(r(f)+"skewX("+d+o)}function c(l,d,f,u,h,y){if(l!==f||d!==u){var m=h.push(r(h)+"scale(",null,",",null,")");y.push({i:m-4,x:Ee(l,f)},{i:m-2,x:Ee(d,u)})}else(f!==1||u!==1)&&h.push(r(h)+"scale("+f+","+u+")")}return function(l,d){var f=[],u=[];return l=e(l),d=e(d),i(l.translateX,l.translateY,d.translateX,d.translateY,f,u),s(l.rotate,d.rotate,f,u),a(l.skewX,d.skewX,f,u),c(l.scaleX,l.scaleY,d.scaleX,d.scaleY,f,u),l=d=null,function(h){for(var y=-1,m=u.length,b;++y<m;)f[(b=u[y]).i]=b.x(h);return f.join("")}}}var Ba=vr(Ra,"px, ","px)","deg)"),Va=vr(Oa,", ",")",")"),Fa=1e-12;function co(e){return((e=Math.exp(e))+1/e)/2}function Xa(e){return((e=Math.exp(e))-1/e)/2}function Ya(e){return((e=Math.exp(2*e))-1)/(e+1)}const kt=(function e(t,n,o){function r(i,s){var a=i[0],c=i[1],l=i[2],d=s[0],f=s[1],u=s[2],h=d-a,y=f-c,m=h*h+y*y,b,w;if(m<Fa)w=Math.log(u/l)/t,b=function(k){return[a+k*h,c+k*y,l*Math.exp(t*k*w)]};else{var N=Math.sqrt(m),g=(u*u-l*l+o*m)/(2*l*n*N),x=(u*u-l*l-o*m)/(2*u*n*N),E=Math.log(Math.sqrt(g*g+1)-g),_=Math.log(Math.sqrt(x*x+1)-x);w=(_-E)/t,b=function(k){var I=k*w,j=co(E),B=l/(n*N)*(j*Ya(t*I+E)-Xa(E));return[a+B*h,c+B*y,l*j/co(t*I+E)]}}return b.duration=w*1e3*t/Math.SQRT2,b}return r.rho=function(i){var s=Math.max(.001,+i),a=s*s,c=a*a;return e(s,a,c)},r})(Math.SQRT2,2,4),lo=({icon:e,label:t,description:n,onClick:o})=>p.jsxs("button",{className:"flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm hover:bg-accent focus-visible:bg-accent focus-visible:outline-none",type:"button",onClick:o,children:[p.jsx("div",{className:"flex size-8 shrink-0 items-center justify-center rounded-md bg-muted text-text-secondary",children:p.jsx(e,{className:"size-4"})}),p.jsxs("div",{className:"flex min-w-0 flex-col",children:[p.jsx("span",{className:"font-medium",children:t}),p.jsx("span",{className:"text-xs text-text-secondary",children:n})]})]}),br=({onPick:e})=>p.jsxs("div",{className:"flex w-64 flex-col gap-1 p-1","data-testid":"step-picker",children:[p.jsx(lo,{description:"Send an email",icon:An,label:"Email",onClick:()=>e("send_email")}),p.jsx(lo,{description:"Wait a set amount of time",icon:Pn,label:"Wait",onClick:()=>e("wait")})]});function re(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=re(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Wa={value:()=>{}};function Ft(){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 It(n)}function It(e){this._=e}function Za(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}})}It.prototype=Ft.prototype={constructor:It,on:function(e,t){var n=this._,o=Za(e+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(e=o[i]).type)&&(r=Ga(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]=uo(n[r],e.name,t);else if(t==null)for(r in n)n[r]=uo(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 It(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 Ga(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function uo(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=Wa,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var wn="http://www.w3.org/1999/xhtml";const fo={svg:"http://www.w3.org/2000/svg",xhtml:wn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Xt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),fo.hasOwnProperty(t)?{space:fo[t],local:e}:e}function qa(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===wn&&t.documentElement.namespaceURI===wn?t.createElement(e):t.createElementNS(n,e)}}function Ua(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function _r(e){var t=Xt(e);return(t.local?Ua:qa)(t)}function Ka(){}function Dn(e){return e==null?Ka:function(){return this.querySelector(e)}}function Qa(e){typeof e!="function"&&(e=Dn(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),c,l,d=0;d<s;++d)(c=i[d])&&(l=e.call(c,c.__data__,d,i))&&("__data__"in c&&(l.__data__=c.__data__),a[d]=l);return new ce(o,this._parents)}function Ja(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function ec(){return[]}function Er(e){return e==null?ec:function(){return this.querySelectorAll(e)}}function tc(e){return function(){return Ja(e.apply(this,arguments))}}function nc(e){typeof e=="function"?e=tc(e):e=Er(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(o.push(e.call(c,c.__data__,l,s)),r.push(c));return new ce(o,r)}function Sr(e){return function(){return this.matches(e)}}function Nr(e){return function(t){return t.matches(e)}}var oc=Array.prototype.find;function rc(e){return function(){return oc.call(this.children,e)}}function ic(){return this.firstElementChild}function sc(e){return this.select(e==null?ic:rc(typeof e=="function"?e:Nr(e)))}var ac=Array.prototype.filter;function cc(){return Array.from(this.children)}function lc(e){return function(){return ac.call(this.children,e)}}function uc(e){return this.selectAll(e==null?cc:lc(typeof e=="function"?e:Nr(e)))}function dc(e){typeof e!="function"&&(e=Sr(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]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new ce(o,this._parents)}function Cr(e){return new Array(e.length)}function fc(){return new ce(this._enter||this._groups.map(Cr),this._parents)}function jt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}jt.prototype={constructor:jt,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 hc(e){return function(){return e}}function gc(e,t,n,o,r,i){for(var s=0,a,c=t.length,l=i.length;s<l;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new jt(e,i[s]);for(;s<c;++s)(a=t[s])&&(r[s]=a)}function pc(e,t,n,o,r,i,s){var a,c,l=new Map,d=t.length,f=i.length,u=new Array(d),h;for(a=0;a<d;++a)(c=t[a])&&(u[a]=h=s.call(c,c.__data__,a,t)+"",l.has(h)?r[a]=c:l.set(h,c));for(a=0;a<f;++a)h=s.call(e,i[a],a,i)+"",(c=l.get(h))?(o[a]=c,c.__data__=i[a],l.delete(h)):n[a]=new jt(e,i[a]);for(a=0;a<d;++a)(c=t[a])&&l.get(u[a])===c&&(r[a]=c)}function mc(e){return e.__data__}function yc(e,t){if(!arguments.length)return Array.from(this,mc);var n=t?pc:gc,o=this._parents,r=this._groups;typeof e!="function"&&(e=hc(e));for(var i=r.length,s=new Array(i),a=new Array(i),c=new Array(i),l=0;l<i;++l){var d=o[l],f=r[l],u=f.length,h=xc(e.call(d,d&&d.__data__,l,o)),y=h.length,m=a[l]=new Array(y),b=s[l]=new Array(y),w=c[l]=new Array(u);n(d,f,m,b,w,h,t);for(var N=0,g=0,x,E;N<y;++N)if(x=m[N]){for(N>=g&&(g=N+1);!(E=b[g])&&++g<y;);x._next=E||null}}return s=new ce(s,o),s._enter=a,s._exit=c,s}function xc(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function wc(){return new ce(this._exit||this._groups.map(Cr),this._parents)}function vc(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 bc(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),c=0;c<s;++c)for(var l=n[c],d=o[c],f=l.length,u=a[c]=new Array(f),h,y=0;y<f;++y)(h=l[y]||d[y])&&(u[y]=h);for(;c<r;++c)a[c]=n[c];return new ce(a,this._parents)}function _c(){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 Ec(e){e||(e=Sc);function t(f,u){return f&&u?e(f.__data__,u.__data__):!f-!u}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,c=r[i]=new Array(a),l,d=0;d<a;++d)(l=s[d])&&(c[d]=l);c.sort(t)}return new ce(r,this._parents).order()}function Sc(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Nc(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Cc(){return Array.from(this)}function Mc(){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 kc(){let e=0;for(const t of this)++e;return e}function Ic(){return!this.node()}function Ac(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 Pc(e){return function(){this.removeAttribute(e)}}function Dc(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Tc(e,t){return function(){this.setAttribute(e,t)}}function jc(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function $c(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function zc(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 Hc(e,t){var n=Xt(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?Dc:Pc:typeof t=="function"?n.local?zc:$c:n.local?jc:Tc)(n,t))}function Mr(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Lc(e){return function(){this.style.removeProperty(e)}}function Rc(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Oc(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Bc(e,t,n){return arguments.length>1?this.each((t==null?Lc:typeof t=="function"?Oc:Rc)(e,t,n??"")):Le(this.node(),e)}function Le(e,t){return e.style.getPropertyValue(t)||Mr(e).getComputedStyle(e,null).getPropertyValue(t)}function Vc(e){return function(){delete this[e]}}function Fc(e,t){return function(){this[e]=t}}function Xc(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?Vc:typeof t=="function"?Xc:Fc)(e,t)):this.node()[e]}function kr(e){return e.trim().split(/^|\s+/)}function Tn(e){return e.classList||new Ir(e)}function Ir(e){this._node=e,this._names=kr(e.getAttribute("class")||"")}Ir.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 Ar(e,t){for(var n=Tn(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function Pr(e,t){for(var n=Tn(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function Wc(e){return function(){Ar(this,e)}}function Zc(e){return function(){Pr(this,e)}}function Gc(e,t){return function(){(t.apply(this,arguments)?Ar:Pr)(this,e)}}function qc(e,t){var n=kr(e+"");if(arguments.length<2){for(var o=Tn(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?Gc:t?Wc:Zc)(n,t))}function Uc(){this.textContent=""}function Kc(e){return function(){this.textContent=e}}function Qc(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Jc(e){return arguments.length?this.each(e==null?Uc:(typeof e=="function"?Qc:Kc)(e)):this.node().textContent}function el(){this.innerHTML=""}function tl(e){return function(){this.innerHTML=e}}function nl(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function ol(e){return arguments.length?this.each(e==null?el:(typeof e=="function"?nl:tl)(e)):this.node().innerHTML}function rl(){this.nextSibling&&this.parentNode.appendChild(this)}function il(){return this.each(rl)}function sl(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function al(){return this.each(sl)}function cl(e){var t=typeof e=="function"?e:_r(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function ll(){return null}function ul(e,t){var n=typeof e=="function"?e:_r(e),o=t==null?ll:typeof t=="function"?t:Dn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function dl(){var e=this.parentNode;e&&e.removeChild(this)}function fl(){return this.each(dl)}function hl(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function gl(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function pl(e){return this.select(e?gl:hl)}function ml(e){return arguments.length?this.property("__data__",e):this.node().__data__}function yl(e){return function(t){e.call(this,t,this.__data__)}}function xl(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 wl(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 vl(e,t,n){return function(){var o=this.__on,r,i=yl(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 bl(e,t,n){var o=xl(e+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,d;c<l;++c)for(r=0,d=a[c];r<i;++r)if((s=o[r]).type===d.type&&s.name===d.name)return d.value}return}for(a=t?vl:wl,r=0;r<i;++r)this.each(a(o[r],t,n));return this}function Dr(e,t,n){var o=Mr(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 _l(e,t){return function(){return Dr(this,e,t)}}function El(e,t){return function(){return Dr(this,e,t.apply(this,arguments))}}function Sl(e,t){return this.each((typeof t=="function"?El:_l)(e,t))}function*Nl(){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 Tr=[null];function ce(e,t){this._groups=e,this._parents=t}function ft(){return new ce([[document.documentElement]],Tr)}function Cl(){return this}ce.prototype=ft.prototype={constructor:ce,select:Qa,selectAll:nc,selectChild:sc,selectChildren:uc,filter:dc,data:yc,enter:fc,exit:wc,join:vc,merge:bc,selection:Cl,order:_c,sort:Ec,call:Nc,nodes:Cc,node:Mc,size:kc,empty:Ic,each:Ac,attr:Hc,style:Bc,property:Yc,classed:qc,text:Jc,html:ol,raise:il,lower:al,append:cl,insert:ul,remove:fl,clone:pl,datum:ml,on:bl,dispatch:Sl,[Symbol.iterator]:Nl};function ae(e){return typeof e=="string"?new ce([[document.querySelector(e)]],[document.documentElement]):new ce([[e]],Tr)}function Ml(e){let t;for(;t=e.sourceEvent;)e=t;return e}function le(e,t){if(e=Ml(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 kl={passive:!1},nt={capture:!0,passive:!1};function rn(e){e.stopImmediatePropagation()}function ze(e){e.preventDefault(),e.stopImmediatePropagation()}function jr(e){var t=e.document.documentElement,n=ae(e).on("dragstart.drag",ze,nt);"onselectstart"in t?n.on("selectstart.drag",ze,nt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function $r(e,t){var n=e.document.documentElement,o=ae(e).on("dragstart.drag",null);t&&(o.on("click.drag",ze,nt),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 _t=e=>()=>e;function vn(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:c,dy:l,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value: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:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:d}})}vn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Il(e){return!e.ctrlKey&&!e.button}function Al(){return this.parentNode}function Pl(e,t){return t??{x:e.x,y:e.y}}function Dl(){return navigator.maxTouchPoints||"ontouchstart"in this}function zr(){var e=Il,t=Al,n=Pl,o=Dl,r={},i=Ft("start","drag","end"),s=0,a,c,l,d,f=0;function u(x){x.on("mousedown.drag",h).filter(o).on("touchstart.drag",b).on("touchmove.drag",w,kl).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(x,E){if(!(d||!e.call(this,x,E))){var _=g(this,t.call(this,x,E),x,E,"mouse");_&&(ae(x.view).on("mousemove.drag",y,nt).on("mouseup.drag",m,nt),jr(x.view),rn(x),l=!1,a=x.clientX,c=x.clientY,_("start",x))}}function y(x){if(ze(x),!l){var E=x.clientX-a,_=x.clientY-c;l=E*E+_*_>f}r.mouse("drag",x)}function m(x){ae(x.view).on("mousemove.drag mouseup.drag",null),$r(x.view,l),ze(x),r.mouse("end",x)}function b(x,E){if(e.call(this,x,E)){var _=x.changedTouches,k=t.call(this,x,E),I=_.length,j,B;for(j=0;j<I;++j)(B=g(this,k,x,E,_[j].identifier,_[j]))&&(rn(x),B("start",x,_[j]))}}function w(x){var E=x.changedTouches,_=E.length,k,I;for(k=0;k<_;++k)(I=r[E[k].identifier])&&(ze(x),I("drag",x,E[k]))}function N(x){var E=x.changedTouches,_=E.length,k,I;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),k=0;k<_;++k)(I=r[E[k].identifier])&&(rn(x),I("end",x,E[k]))}function g(x,E,_,k,I,j){var B=i.copy(),R=le(j||_,E),A,z,v;if((v=n.call(x,new vn("beforestart",{sourceEvent:_,target:u,identifier:I,active:s,x:R[0],y:R[1],dx:0,dy:0,dispatch:B}),k))!=null)return A=v.x-R[0]||0,z=v.y-R[1]||0,function M(S,C,T){var P=R,$;switch(S){case"start":r[I]=M,$=s++;break;case"end":delete r[I],--s;case"drag":R=le(T||C,E),$=s;break}B.call(S,x,new vn(S,{sourceEvent:C,subject:v,target:u,identifier:I,active:$,x:R[0]+A,y:R[1]+z,dx:R[0]-P[0],dy:R[1]-P[1],dispatch:B}),k)}}return u.filter=function(x){return arguments.length?(e=typeof x=="function"?x:_t(!!x),u):e},u.container=function(x){return arguments.length?(t=typeof x=="function"?x:_t(x),u):t},u.subject=function(x){return arguments.length?(n=typeof x=="function"?x:_t(x),u):n},u.touchable=function(x){return arguments.length?(o=typeof x=="function"?x:_t(!!x),u):o},u.on=function(){var x=i.on.apply(i,arguments);return x===i?u:x},u.clickDistance=function(x){return arguments.length?(f=(x=+x)*x,u):Math.sqrt(f)},u}var Re=0,Ke=0,qe=0,Hr=1e3,$t,Qe,zt=0,Me=0,Yt=0,ot=typeof performance=="object"&&performance.now?performance:Date,Lr=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function jn(){return Me||(Lr(Tl),Me=ot.now()+Yt)}function Tl(){Me=0}function Ht(){this._call=this._time=this._next=null}Ht.prototype=Rr.prototype={constructor:Ht,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?jn():+n)+(t==null?0:+t),!this._next&&Qe!==this&&(Qe?Qe._next=this:$t=this,Qe=this),this._call=e,this._time=n,bn()},stop:function(){this._call&&(this._call=null,this._time=1/0,bn())}};function Rr(e,t,n){var o=new Ht;return o.restart(e,t,n),o}function jl(){jn(),++Re;for(var e=$t,t;e;)(t=Me-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Re}function ho(){Me=(zt=ot.now())+Yt,Re=Ke=0;try{jl()}finally{Re=0,zl(),Me=0}}function $l(){var e=ot.now(),t=e-zt;t>Hr&&(Yt-=t,zt=e)}function zl(){for(var e,t=$t,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:$t=n);Qe=e,bn(o)}function bn(e){if(!Re){Ke&&(Ke=clearTimeout(Ke));var t=e-Me;t>24?(e<1/0&&(Ke=setTimeout(ho,e-ot.now()-Yt)),qe&&(qe=clearInterval(qe))):(qe||(zt=ot.now(),qe=setInterval($l,Hr)),Re=1,Lr(ho))}}function go(e,t,n){var o=new Ht;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var Hl=Ft("start","end","cancel","interrupt"),Ll=[],Or=0,po=1,_n=2,At=3,mo=4,En=5,Pt=6;function Wt(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;Rl(e,n,{name:t,index:o,group:r,on:Hl,tween:Ll,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Or})}function $n(e,t){var n=fe(e,t);if(n.state>Or)throw new Error("too late; already scheduled");return n}function ge(e,t){var n=fe(e,t);if(n.state>At)throw new Error("too late; already running");return n}function fe(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Rl(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=Rr(i,0,n.time);function i(l){n.state=po,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var d,f,u,h;if(n.state!==po)return c();for(d in o)if(h=o[d],h.name===n.name){if(h.state===At)return go(s);h.state===mo?(h.state=Pt,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[d]):+d<t&&(h.state=Pt,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete o[d])}if(go(function(){n.state===At&&(n.state=mo,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=_n,n.on.call("start",e,e.__data__,n.index,n.group),n.state===_n){for(n.state=At,r=new Array(u=n.tween.length),d=0,f=-1;d<u;++d)(h=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(r[++f]=h);r.length=f+1}}function a(l){for(var d=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=En,1),f=-1,u=r.length;++f<u;)r[f].call(e,d);n.state===En&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Pt,n.timer.stop(),delete o[t];for(var l in o)return;delete e.__transition}}function Dt(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>_n&&o.state<En,o.state=Pt,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function Ol(e){return this.each(function(){Dt(this,e)})}function Bl(e,t){var n,o;return function(){var r=ge(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 Vl(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=ge(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},c=0,l=r.length;c<l;++c)if(r[c].name===t){r[c]=a;break}c===l&&r.push(a)}i.tween=r}}function Fl(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=fe(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?Bl:Vl)(n,e,t))}function zn(e,t,n){var o=e._id;return e.each(function(){var r=ge(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return fe(r,o).value[t]}}function Br(e,t){var n;return(typeof t=="number"?Ee:t instanceof oo?ro:(n=oo(t))?(t=n,ro):Ia)(e,t)}function Xl(e){return function(){this.removeAttribute(e)}}function Yl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Wl(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 Zl(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 Gl(e,t,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a)))}}function ql(e,t,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a)))}}function Ul(e,t){var n=Xt(e),o=n==="transform"?Va:Br;return this.attrTween(e,typeof t=="function"?(n.local?ql:Gl)(n,o,zn(this,"attr."+e,t)):t==null?(n.local?Yl:Xl)(n):(n.local?Zl:Wl)(n,o,t))}function Kl(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Ql(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Jl(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Ql(e,i)),n}return r._value=t,r}function eu(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Kl(e,i)),n}return r._value=t,r}function tu(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=Xt(e);return this.tween(n,(o.local?Jl:eu)(o,t))}function nu(e,t){return function(){$n(this,e).delay=+t.apply(this,arguments)}}function ou(e,t){return t=+t,function(){$n(this,e).delay=t}}function ru(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?nu:ou)(t,e)):fe(this.node(),t).delay}function iu(e,t){return function(){ge(this,e).duration=+t.apply(this,arguments)}}function su(e,t){return t=+t,function(){ge(this,e).duration=t}}function au(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?iu:su)(t,e)):fe(this.node(),t).duration}function cu(e,t){if(typeof t!="function")throw new Error;return function(){ge(this,e).ease=t}}function lu(e){var t=this._id;return arguments.length?this.each(cu(t,e)):fe(this.node(),t).ease}function uu(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;ge(this,e).ease=n}}function du(e){if(typeof e!="function")throw new Error;return this.each(uu(this._id,e))}function fu(e){typeof e!="function"&&(e=Sr(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]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new ye(o,this._parents,this._name,this._id)}function hu(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 c=t[a],l=n[a],d=c.length,f=s[a]=new Array(d),u,h=0;h<d;++h)(u=c[h]||l[h])&&(f[h]=u);for(;a<o;++a)s[a]=t[a];return new ye(s,this._parents,this._name,this._id)}function gu(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 pu(e,t,n){var o,r,i=gu(t)?$n:ge;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}function mu(e,t){var n=this._id;return arguments.length<2?fe(this.node(),n).on.on(e):this.each(pu(n,e,t))}function yu(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function xu(){return this.on("end.remove",yu(this._id))}function wu(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Dn(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],c=a.length,l=i[s]=new Array(c),d,f,u=0;u<c;++u)(d=a[u])&&(f=e.call(d,d.__data__,u,a))&&("__data__"in d&&(f.__data__=d.__data__),l[u]=f,Wt(l[u],t,n,u,l,fe(d,n)));return new ye(i,this._parents,t,n)}function vu(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Er(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var c=o[a],l=c.length,d,f=0;f<l;++f)if(d=c[f]){for(var u=e.call(d,d.__data__,f,c),h,y=fe(d,n),m=0,b=u.length;m<b;++m)(h=u[m])&&Wt(h,t,n,m,u,y);i.push(u),s.push(d)}return new ye(i,s,t,n)}var bu=ft.prototype.constructor;function _u(){return new bu(this._groups,this._parents)}function Eu(e,t){var n,o,r;return function(){var i=Le(this,e),s=(this.style.removeProperty(e),Le(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function Vr(e){return function(){this.style.removeProperty(e)}}function Su(e,t,n){var o,r=n+"",i;return function(){var s=Le(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function Nu(e,t,n){var o,r,i;return function(){var s=Le(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Le(this,e))),s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a))}}function Cu(e,t){var n,o,r,i="style."+t,s="end."+i,a;return function(){var c=ge(this,e),l=c.on,d=c.value[i]==null?a||(a=Vr(t)):void 0;(l!==n||r!==d)&&(o=(n=l).copy()).on(s,r=d),c.on=o}}function Mu(e,t,n){var o=(e+="")=="transform"?Ba:Br;return t==null?this.styleTween(e,Eu(e,o)).on("end.style."+e,Vr(e)):typeof t=="function"?this.styleTween(e,Nu(e,o,zn(this,"style."+e,t))).each(Cu(this._id,e)):this.styleTween(e,Su(e,o,t),n).on("end.style."+e,null)}function ku(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function Iu(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&ku(e,s,n)),o}return i._value=t,i}function Au(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,Iu(e,t,n??""))}function Pu(e){return function(){this.textContent=e}}function Du(e){return function(){var t=e(this);this.textContent=t??""}}function Tu(e){return this.tween("text",typeof e=="function"?Du(zn(this,"text",e)):Pu(e==null?"":e+""))}function ju(e){return function(t){this.textContent=e.call(this,t)}}function $u(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&ju(r)),t}return o._value=e,o}function zu(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,$u(e))}function Hu(){for(var e=this._name,t=this._id,n=Fr(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var d=fe(c,t);Wt(c,e,n,l,s,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new ye(o,this._parents,e,n)}function Lu(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},c={value:function(){--r===0&&i()}};n.each(function(){var l=ge(this,o),d=l.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),r===0&&i()})}var Ru=0;function ye(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Fr(){return++Ru}var pe=ft.prototype;ye.prototype={constructor:ye,select:wu,selectAll:vu,selectChild:pe.selectChild,selectChildren:pe.selectChildren,filter:fu,merge:hu,selection:_u,transition:Hu,call:pe.call,nodes:pe.nodes,node:pe.node,size:pe.size,empty:pe.empty,each:pe.each,on:mu,attr:Ul,attrTween:tu,style:Mu,styleTween:Au,text:Tu,textTween:zu,remove:xu,tween:Fl,delay:ru,duration:au,ease:lu,easeVarying:du,end:Lu,[Symbol.iterator]:pe[Symbol.iterator]};function Ou(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Bu={time:null,delay:0,duration:250,ease:Ou};function Vu(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 Fu(e){var t,n;e instanceof ye?(t=e._id,e=e._name):(t=Fr(),(n=Bu).time=jn(),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,c,l=0;l<a;++l)(c=s[l])&&Wt(c,e,t,l,s,n||Vu(c,t));return new ye(o,this._parents,e,t)}ft.prototype.interrupt=Ol;ft.prototype.transition=Fu;const Et=e=>()=>e;function Xu(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 me(e,t,n){this.k=e,this.x=t,this.y=n}me.prototype={constructor:me,scale:function(e){return e===1?this:new me(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new me(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 Zt=new me(1,0,0);Xr.prototype=me.prototype;function Xr(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Zt;return e.__zoom}function sn(e){e.stopImmediatePropagation()}function Ue(e){e.preventDefault(),e.stopImmediatePropagation()}function Yu(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Wu(){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 yo(){return this.__zoom||Zt}function Zu(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Gu(){return navigator.maxTouchPoints||"ontouchstart"in this}function qu(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 Yr(){var e=Yu,t=Wu,n=qu,o=Zu,r=Gu,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=kt,l=Ft("start","zoom","end"),d,f,u,h=500,y=150,m=0,b=10;function w(v){v.property("__zoom",yo).on("wheel.zoom",I,{passive:!1}).on("mousedown.zoom",j).on("dblclick.zoom",B).filter(r).on("touchstart.zoom",R).on("touchmove.zoom",A).on("touchend.zoom touchcancel.zoom",z).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}w.transform=function(v,M,S,C){var T=v.selection?v.selection():v;T.property("__zoom",yo),v!==T?E(v,M,S,C):T.interrupt().each(function(){_(this,arguments).event(C).start().zoom(null,typeof M=="function"?M.apply(this,arguments):M).end()})},w.scaleBy=function(v,M,S,C){w.scaleTo(v,function(){var T=this.__zoom.k,P=typeof M=="function"?M.apply(this,arguments):M;return T*P},S,C)},w.scaleTo=function(v,M,S,C){w.transform(v,function(){var T=t.apply(this,arguments),P=this.__zoom,$=S==null?x(T):typeof S=="function"?S.apply(this,arguments):S,H=P.invert($),L=typeof M=="function"?M.apply(this,arguments):M;return n(g(N(P,L),$,H),T,s)},S,C)},w.translateBy=function(v,M,S,C){w.transform(v,function(){return n(this.__zoom.translate(typeof M=="function"?M.apply(this,arguments):M,typeof S=="function"?S.apply(this,arguments):S),t.apply(this,arguments),s)},null,C)},w.translateTo=function(v,M,S,C,T){w.transform(v,function(){var P=t.apply(this,arguments),$=this.__zoom,H=C==null?x(P):typeof C=="function"?C.apply(this,arguments):C;return n(Zt.translate(H[0],H[1]).scale($.k).translate(typeof M=="function"?-M.apply(this,arguments):-M,typeof S=="function"?-S.apply(this,arguments):-S),P,s)},C,T)};function N(v,M){return M=Math.max(i[0],Math.min(i[1],M)),M===v.k?v:new me(M,v.x,v.y)}function g(v,M,S){var C=M[0]-S[0]*v.k,T=M[1]-S[1]*v.k;return C===v.x&&T===v.y?v:new me(v.k,C,T)}function x(v){return[(+v[0][0]+ +v[1][0])/2,(+v[0][1]+ +v[1][1])/2]}function E(v,M,S,C){v.on("start.zoom",function(){_(this,arguments).event(C).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(C).end()}).tween("zoom",function(){var T=this,P=arguments,$=_(T,P).event(C),H=t.apply(T,P),L=S==null?x(H):typeof S=="function"?S.apply(T,P):S,F=Math.max(H[1][0]-H[0][0],H[1][1]-H[0][1]),V=T.__zoom,Z=typeof M=="function"?M.apply(T,P):M,U=c(V.invert(L).concat(F/V.k),Z.invert(L).concat(F/Z.k));return function(Y){if(Y===1)Y=Z;else{var O=U(Y),W=F/O[2];Y=new me(W,L[0]-O[0]*W,L[1]-O[1]*W)}$.zoom(null,Y)}})}function _(v,M,S){return!S&&v.__zooming||new k(v,M)}function k(v,M){this.that=v,this.args=M,this.active=0,this.sourceEvent=null,this.extent=t.apply(v,M),this.taps=0}k.prototype={event:function(v){return v&&(this.sourceEvent=v),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(v,M){return this.mouse&&v!=="mouse"&&(this.mouse[1]=M.invert(this.mouse[0])),this.touch0&&v!=="touch"&&(this.touch0[1]=M.invert(this.touch0[0])),this.touch1&&v!=="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(v){var M=ae(this.that).datum();l.call(v,this.that,new Xu(v,{sourceEvent:this.sourceEvent,target:w,transform:this.that.__zoom,dispatch:l}),M)}};function I(v,...M){if(!e.apply(this,arguments))return;var S=_(this,M).event(v),C=this.__zoom,T=Math.max(i[0],Math.min(i[1],C.k*Math.pow(2,o.apply(this,arguments)))),P=le(v);if(S.wheel)(S.mouse[0][0]!==P[0]||S.mouse[0][1]!==P[1])&&(S.mouse[1]=C.invert(S.mouse[0]=P)),clearTimeout(S.wheel);else{if(C.k===T)return;S.mouse=[P,C.invert(P)],Dt(this),S.start()}Ue(v),S.wheel=setTimeout($,y),S.zoom("mouse",n(g(N(C,T),S.mouse[0],S.mouse[1]),S.extent,s));function $(){S.wheel=null,S.end()}}function j(v,...M){if(u||!e.apply(this,arguments))return;var S=v.currentTarget,C=_(this,M,!0).event(v),T=ae(v.view).on("mousemove.zoom",L,!0).on("mouseup.zoom",F,!0),P=le(v,S),$=v.clientX,H=v.clientY;jr(v.view),sn(v),C.mouse=[P,this.__zoom.invert(P)],Dt(this),C.start();function L(V){if(Ue(V),!C.moved){var Z=V.clientX-$,U=V.clientY-H;C.moved=Z*Z+U*U>m}C.event(V).zoom("mouse",n(g(C.that.__zoom,C.mouse[0]=le(V,S),C.mouse[1]),C.extent,s))}function F(V){T.on("mousemove.zoom mouseup.zoom",null),$r(V.view,C.moved),Ue(V),C.event(V).end()}}function B(v,...M){if(e.apply(this,arguments)){var S=this.__zoom,C=le(v.changedTouches?v.changedTouches[0]:v,this),T=S.invert(C),P=S.k*(v.shiftKey?.5:2),$=n(g(N(S,P),C,T),t.apply(this,M),s);Ue(v),a>0?ae(this).transition().duration(a).call(E,$,C,v):ae(this).call(w.transform,$,C,v)}}function R(v,...M){if(e.apply(this,arguments)){var S=v.touches,C=S.length,T=_(this,M,v.changedTouches.length===C).event(v),P,$,H,L;for(sn(v),$=0;$<C;++$)H=S[$],L=le(H,this),L=[L,this.__zoom.invert(L),H.identifier],T.touch0?!T.touch1&&T.touch0[2]!==L[2]&&(T.touch1=L,T.taps=0):(T.touch0=L,P=!0,T.taps=1+!!d);d&&(d=clearTimeout(d)),P&&(T.taps<2&&(f=L[0],d=setTimeout(function(){d=null},h)),Dt(this),T.start())}}function A(v,...M){if(this.__zooming){var S=_(this,M).event(v),C=v.changedTouches,T=C.length,P,$,H,L;for(Ue(v),P=0;P<T;++P)$=C[P],H=le($,this),S.touch0&&S.touch0[2]===$.identifier?S.touch0[0]=H:S.touch1&&S.touch1[2]===$.identifier&&(S.touch1[0]=H);if($=S.that.__zoom,S.touch1){var F=S.touch0[0],V=S.touch0[1],Z=S.touch1[0],U=S.touch1[1],Y=(Y=Z[0]-F[0])*Y+(Y=Z[1]-F[1])*Y,O=(O=U[0]-V[0])*O+(O=U[1]-V[1])*O;$=N($,Math.sqrt(Y/O)),H=[(F[0]+Z[0])/2,(F[1]+Z[1])/2],L=[(V[0]+U[0])/2,(V[1]+U[1])/2]}else if(S.touch0)H=S.touch0[0],L=S.touch0[1];else return;S.zoom("touch",n(g($,H,L),S.extent,s))}}function z(v,...M){if(this.__zooming){var S=_(this,M).event(v),C=v.changedTouches,T=C.length,P,$;for(sn(v),u&&clearTimeout(u),u=setTimeout(function(){u=null},h),P=0;P<T;++P)$=C[P],S.touch0&&S.touch0[2]===$.identifier?delete S.touch0:S.touch1&&S.touch1[2]===$.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&($=le($,this),Math.hypot(f[0]-$[0],f[1]-$[1])<b)){var H=ae(this).on("dblclick.zoom");H&&H.apply(this,arguments)}}}return w.wheelDelta=function(v){return arguments.length?(o=typeof v=="function"?v:Et(+v),w):o},w.filter=function(v){return arguments.length?(e=typeof v=="function"?v:Et(!!v),w):e},w.touchable=function(v){return arguments.length?(r=typeof v=="function"?v:Et(!!v),w):r},w.extent=function(v){return arguments.length?(t=typeof v=="function"?v:Et([[+v[0][0],+v[0][1]],[+v[1][0],+v[1][1]]]),w):t},w.scaleExtent=function(v){return arguments.length?(i[0]=+v[0],i[1]=+v[1],w):[i[0],i[1]]},w.translateExtent=function(v){return arguments.length?(s[0][0]=+v[0][0],s[1][0]=+v[1][0],s[0][1]=+v[0][1],s[1][1]=+v[1][1],w):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},w.constrain=function(v){return arguments.length?(n=v,w):n},w.duration=function(v){return arguments.length?(a=+v,w):a},w.interpolate=function(v){return arguments.length?(c=v,w):c},w.on=function(){var v=l.on.apply(l,arguments);return v===l?w:v},w.clickDistance=function(v){return arguments.length?(m=(v=+v)*v,w):Math.sqrt(m)},w.tapDistance=function(v){return arguments.length?(b=+v,w):b},w}const he={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."},rt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Wr=["Enter"," ","Escape"],Zr={"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 Oe;(function(e){e.Strict="strict",e.Loose="loose"})(Oe||(Oe={}));var Ce;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Ce||(Ce={}));var it;(function(e){e.Partial="partial",e.Full="full"})(it||(it={}));const Gr={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null};var be;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(be||(be={}));var Lt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Lt||(Lt={}));var X;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(X||(X={}));const xo={[X.Left]:X.Right,[X.Right]:X.Left,[X.Top]:X.Bottom,[X.Bottom]:X.Top};function qr(e){return e===null?null:e?"valid":"invalid"}const Ur=e=>"id"in e&&"source"in e&&"target"in e,Uu=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Hn=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),ht=(e,t=[0,0])=>{const{width:n,height:o}=xe(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},Ku=(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):Hn(r)?r:t.nodeLookup.get(r.id));const a=s?Rt(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Gt(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return qt(n)},gt=(e,t={})=>{if(e.size===0)return{x:0,y:0,width:0,height:0};let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0};return e.forEach(o=>{if(t.filter===void 0||t.filter(o)){const r=Rt(o);n=Gt(n,r)}}),qt(n)},Ln=(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},c=[];for(const l of e.values()){const{measured:d,selectable:f=!0,hidden:u=!1}=l;if(s&&!f||u)continue;const h=d.width??l.width??l.initialWidth??null,y=d.height??l.height??l.initialHeight??null,m=st(a,Ve(l)),b=(h??0)*(y??0),w=i&&m>0;(!l.internals.handleBounds||w||m>=b||l.dragging)&&c.push(l)}return c},Qu=(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 Ju(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 ed({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return Promise.resolve(!0);const a=Ju(e,s),c=gt(a),l=Rn(c,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(l,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),Promise.resolve(!0)}function Kr({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:c,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},d=s.origin??o;let f=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i?.("005",he.error005());else{const h=a.measured.width,y=a.measured.height;h&&y&&(f=[[c,l],[c+h,l+y]])}else a&&Fe(s.extent)&&(f=[[s.extent[0][0]+c,s.extent[0][1]+l],[s.extent[1][0]+c,s.extent[1][1]+l]]);const u=Fe(f)?ke(t,f,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",he.error015()),{position:{x:u.x-c+(s.measured.width??0)*d[0],y:u.y-l+(s.measured.height??0)*d[1]},positionAbsolute:u}}async function td({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(u=>u.id)),s=[];for(const u of n){if(u.deletable===!1)continue;const h=i.has(u.id),y=!h&&u.parentId&&s.find(m=>m.id===u.parentId);(h||y)&&s.push(u)}const a=new Set(t.map(u=>u.id)),c=o.filter(u=>u.deletable!==!1),d=Qu(s,c);for(const u of c)a.has(u.id)&&!d.find(y=>y.id===u.id)&&d.push(u);if(!r)return{edges:d,nodes:s};const f=await r({nodes:s,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:s}:{edges:[],nodes:[]}:f}const Be=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),ke=(e={x:0,y:0},t,n)=>({x:Be(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Be(e.y,t[0][1],t[1][1]-(n?.height??0))});function Qr(e,t,n){const{width:o,height:r}=xe(n),{x:i,y:s}=n.internals.positionAbsolute;return ke(e,[[i,s],[i+o,s+r]],t)}const wo=(e,t,n)=>e<t?Be(Math.abs(e-t),1,t)/t:e>n?-Be(Math.abs(e-n),1,t)/t:0,Jr=(e,t,n=15,o=40)=>{const r=wo(e.x,o,t.width-o)*n,i=wo(e.y,o,t.height-o)*n;return[r,i]},Gt=(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)}),Sn=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),qt=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),Ve=(e,t=[0,0])=>{const{x:n,y:o}=Hn(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}},Rt=(e,t=[0,0])=>{const{x:n,y:o}=Hn(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)}},ei=(e,t)=>qt(Gt(Sn(e),Sn(t))),st=(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)},vo=e=>ue(e.width)&&ue(e.height)&&ue(e.x)&&ue(e.y),ue=e=>!isNaN(e)&&isFinite(e),nd=(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},Ot=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Pe(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 od(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=Pe(e,n),r=Pe(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=Pe(e.top??e.y??0,n),r=Pe(e.bottom??e.y??0,n),i=Pe(e.left??e.x??0,t),s=Pe(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 rd(e,t,n,o,r,i){const{x:s,y:a}=Ot(e,[t,n,o]),{x:c,y:l}=Ot({x:e.x+e.width,y:e.y+e.height},[t,n,o]),d=r-c,f=i-l;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(d),bottom:Math.floor(f)}}const Rn=(e,t,n,o,r,i)=>{const s=od(i,t,n),a=(t-s.x)/e.width,c=(n-s.y)/e.height,l=Math.min(a,c),d=Be(l,o,r),f=e.x+e.width/2,u=e.y+e.height/2,h=t/2-f*d,y=n/2-u*d,m=rd(e,h,y,d,t,n),b={left:Math.min(m.left-s.left,0),top:Math.min(m.top-s.top,0),right:Math.min(m.right-s.right,0),bottom:Math.min(m.bottom-s.bottom,0)};return{x:h-b.left+b.right,y:y-b.top+b.bottom,zoom:d}},at=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Fe(e){return e!=null&&e!=="parent"}function xe(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function ti(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function ni(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 bo(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function id(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function sd(e){return{...Zr,...e||{}}}function et(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=de(e),a=mt({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:c,y:l}=n?pt(a,t):a;return{xSnapped:c,ySnapped:l,...a}}const On=e=>({width:e.offsetWidth,height:e.offsetHeight}),oi=e=>e?.getRootNode?.()||window?.document,ad=["INPUT","SELECT","TEXTAREA"];function ri(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:ad.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const ii=e=>"clientX"in e,de=(e,t)=>{const n=ii(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)}},_o=(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,...On(s)}})};function si({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const c=e*.125+r*.375+s*.375+n*.125,l=t*.125+i*.375+a*.375+o*.125,d=Math.abs(c-e),f=Math.abs(l-t);return[c,l,d,f]}function St(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Eo({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case X.Left:return[t-St(t-o,i),n];case X.Right:return[t+St(o-t,i),n];case X.Top:return[t,n-St(n-r,i)];case X.Bottom:return[t,n+St(r-n,i)]}}function ai({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top,curvature:s=.25}){const[a,c]=Eo({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[l,d]=Eo({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[f,u,h,y]=si({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:d});return[`M${e},${t} C${a},${c} ${l},${d} ${o},${r}`,f,u,h,y]}function ci({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 cd({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o,elevateOnSelect:r=!1}){if(o!==void 0)return o;const i=r&&n?1e3:0,s=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return i+s}function ld({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=Gt(Rt(e),Rt(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 st(s,qt(i))>0}const ud=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,dd=(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)),fd=(e,t)=>{if(!e.source||!e.target)return t;let n;return Ur(e)?n={...e}:n={...e,id:ud(e)},dd(n,t)?t:(n.sourceHandle===null&&delete n.sourceHandle,n.targetHandle===null&&delete n.targetHandle,t.concat(n))};function li({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,a]=ci({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}const So={[X.Left]:{x:-1,y:0},[X.Right]:{x:1,y:0},[X.Top]:{x:0,y:-1},[X.Bottom]:{x:0,y:1}},hd=({source:e,sourcePosition:t=X.Bottom,target:n})=>t===X.Left||t===X.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},No=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function gd({source:e,sourcePosition:t=X.Bottom,target:n,targetPosition:o=X.Top,center:r,offset:i,stepPosition:s}){const a=So[t],c=So[o],l={x:e.x+a.x*i,y:e.y+a.y*i},d={x:n.x+c.x*i,y:n.y+c.y*i},f=hd({source:l,sourcePosition:t,target:d}),u=f.x!==0?"x":"y",h=f[u];let y=[],m,b;const w={x:0,y:0},N={x:0,y:0},[,,g,x]=ci({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[u]*c[u]===-1){u==="x"?(m=r.x??l.x+(d.x-l.x)*s,b=r.y??(l.y+d.y)/2):(m=r.x??(l.x+d.x)/2,b=r.y??l.y+(d.y-l.y)*s);const _=[{x:m,y:l.y},{x:m,y:d.y}],k=[{x:l.x,y:b},{x:d.x,y:b}];a[u]===h?y=u==="x"?_:k:y=u==="x"?k:_}else{const _=[{x:l.x,y:d.y}],k=[{x:d.x,y:l.y}];if(u==="x"?y=a.x===h?k:_:y=a.y===h?_:k,t===o){const A=Math.abs(e[u]-n[u]);if(A<=i){const z=Math.min(i-1,i-A);a[u]===h?w[u]=(l[u]>e[u]?-1:1)*z:N[u]=(d[u]>n[u]?-1:1)*z}}if(t!==o){const A=u==="x"?"y":"x",z=a[u]===c[A],v=l[A]>d[A],M=l[A]<d[A];(a[u]===1&&(!z&&v||z&&M)||a[u]!==1&&(!z&&M||z&&v))&&(y=u==="x"?_:k)}const I={x:l.x+w.x,y:l.y+w.y},j={x:d.x+N.x,y:d.y+N.y},B=Math.max(Math.abs(I.x-y[0].x),Math.abs(j.x-y[0].x)),R=Math.max(Math.abs(I.y-y[0].y),Math.abs(j.y-y[0].y));B>=R?(m=(I.x+j.x)/2,b=y[0].y):(m=y[0].x,b=(I.y+j.y)/2)}return[[e,{x:l.x+w.x,y:l.y+w.y},...y,{x:d.x+N.x,y:d.y+N.y},n],m,b,g,x]}function pd(e,t,n,o){const r=Math.min(No(e,t)/2,No(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 l=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${i+r*l},${s}Q ${i},${s} ${i},${s+r*d}`}const a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${s+r*c}Q ${i},${s} ${i+r*a},${s}`}function Bt({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top,borderRadius:s=5,centerX:a,centerY:c,offset:l=20,stepPosition:d=.5}){const[f,u,h,y,m]=gd({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:c},offset:l,stepPosition:d});return[f.reduce((w,N,g)=>{let x="";return g>0&&g<f.length-1?x=pd(f[g-1],N,f[g+1],s):x=`${g===0?"M":"L"}${N.x} ${N.y}`,w+=x,w},""),u,h,y,m]}function Co(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function md(e){const{sourceNode:t,targetNode:n}=e;if(!Co(t)||!Co(n))return null;const o=t.internals.handleBounds||Mo(t.handles),r=n.internals.handleBounds||Mo(n.handles),i=ko(o?.source??[],e.sourceHandle),s=ko(e.connectionMode===Oe.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",he.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=i?.position||X.Bottom,c=s?.position||X.Top,l=ct(t,i,a),d=ct(n,s,c);return{sourceX:l.x,sourceY:l.y,targetX:d.x,targetY:d.y,sourcePosition:a,targetPosition:c}}function Mo(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 ct(e,t,n=X.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??xe(e);if(o)return{x:r+s/2,y:i+a/2};switch(t?.position??n){case X.Top:return{x:r+s/2,y:i};case X.Right:return{x:r+s,y:i+a/2};case X.Bottom:return{x:r+s/2,y:i+a};case X.Left:return{x:r,y:i+a/2}}}function ko(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Nn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function yd(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(c=>{if(c&&typeof c=="object"){const l=Nn(c,t);i.has(l)||(s.push({id:l,color:c.color||n,...c}),i.add(l))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const Bn={nodeOrigin:[0,0],nodeExtent:rt,elevateNodesOnSelect:!0,defaults:{}},xd={...Bn,checkEquality:!0};function Vn(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function wd(e,t,n){const o=Vn(Bn,n);for(const r of e.values())if(r.parentId)Fn(r,e,t,o);else{const i=ht(r,o.nodeOrigin),s=Fe(r.extent)?r.extent:o.nodeExtent,a=ke(i,s,xe(r));r.internals.positionAbsolute=a}}function vd(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 Cn(e,t,n,o){const r=Vn(xd,o);let i=e.length>0;const s=new Map(t),a=r?.elevateNodesOnSelect?1e3:0;t.clear(),n.clear();for(const c of e){let l=s.get(c.id);if(r.checkEquality&&c===l?.internals.userNode)t.set(c.id,l);else{const d=ht(c,r.nodeOrigin),f=Fe(c.extent)?c.extent:r.nodeExtent,u=ke(d,f,xe(c));l={...r.defaults,...c,measured:{width:c.measured?.width,height:c.measured?.height},internals:{positionAbsolute:u,handleBounds:vd(c,l),z:ui(c,a),userNode:c}},t.set(c.id,l)}(l.measured===void 0||l.measured.width===void 0||l.measured.height===void 0)&&!l.hidden&&(i=!1),c.parentId&&Fn(l,t,n,o)}return i}function bd(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 Fn(e,t,n,o){const{elevateNodesOnSelect:r,nodeOrigin:i,nodeExtent:s}=Vn(Bn,o),a=e.parentId,c=t.get(a);if(!c){console.warn(`Parent node ${a} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}bd(e,n);const l=r?1e3:0,{x:d,y:f,z:u}=_d(e,c,i,s,l),{positionAbsolute:h}=e.internals,y=d!==h.x||f!==h.y;(y||u!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:y?{x:d,y:f}:h,z:u}})}function ui(e,t){return(ue(e.zIndex)?e.zIndex:0)+(e.selected?t:0)}function _d(e,t,n,o,r){const{x:i,y:s}=t.internals.positionAbsolute,a=xe(e),c=ht(e,n),l=Fe(e.extent)?ke(c,e.extent,a):c;let d=ke({x:i+l.x,y:s+l.y},o,a);e.extent==="parent"&&(d=Qr(d,a,t));const f=ui(e,r),u=t.internals.z??0;return{x:d.x,y:d.y,z:u>=f?u+1:f}}function Xn(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 c=i.get(s.parentId)?.expandedRect??Ve(a),l=ei(c,s.rect);i.set(s.parentId,{expandedRect:l,parent:a})}return i.size>0&&i.forEach(({expandedRect:s,parent:a},c)=>{const l=a.internals.positionAbsolute,d=xe(a),f=a.origin??o,u=s.x<l.x?Math.round(Math.abs(l.x-s.x)):0,h=s.y<l.y?Math.round(Math.abs(l.y-s.y)):0,y=Math.max(d.width,Math.round(s.width)),m=Math.max(d.height,Math.round(s.height)),b=(y-d.width)*f[0],w=(m-d.height)*f[1];(u>0||h>0||b||w)&&(r.push({id:c,type:"position",position:{x:a.position.x-u+b,y:a.position.y-h+w}}),n.get(c)?.forEach(N=>{e.some(g=>g.id===N.id)||r.push({id:N.id,type:"position",position:{x:N.position.x+u,y:N.position.y+h}})})),(d.width<s.width||d.height<s.height||u||h)&&r.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:y+(u?f[0]*u-b:0),height:m+(h?f[1]*h-w:0)}})}),r}function Ed(e,t,n,o,r,i){const s=o?.querySelector(".xyflow__viewport");let a=!1;if(!s)return{changes:[],updatedInternals:a};const c=[],l=window.getComputedStyle(s),{m22:d}=new window.DOMMatrixReadOnly(l.transform),f=[];for(const u of e.values()){const h=t.get(u.id);if(!h)continue;if(h.hidden){t.set(h.id,{...h,internals:{...h.internals,handleBounds:void 0}}),a=!0;continue}const y=On(u.nodeElement),m=h.measured.width!==y.width||h.measured.height!==y.height;if(!!(y.width&&y.height&&(m||!h.internals.handleBounds||u.force))){const w=u.nodeElement.getBoundingClientRect(),N=Fe(h.extent)?h.extent:i;let{positionAbsolute:g}=h.internals;h.parentId&&h.extent==="parent"?g=Qr(g,y,t.get(h.parentId)):N&&(g=ke(g,N,y));const x={...h,measured:y,internals:{...h.internals,positionAbsolute:g,handleBounds:{source:_o("source",u.nodeElement,w,d,h.id),target:_o("target",u.nodeElement,w,d,h.id)}}};t.set(h.id,x),h.parentId&&Fn(x,t,n,{nodeOrigin:r}),a=!0,m&&(c.push({id:h.id,type:"dimensions",dimensions:y}),h.expandParent&&h.parentId&&f.push({id:h.id,parentId:h.parentId,rect:Ve(x,r)}))}}if(f.length>0){const u=Xn(f,t,n,r);c.push(...u)}return{changes:c,updatedInternals:a}}async function Sd({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 Io(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 c=o.get(s)||new Map;if(o.set(s,c.set(n,t)),i){s=`${r}-${e}-${i}`;const l=o.get(s)||new Map;o.set(s,l.set(n,t))}}function di(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,c={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},l=`${r}-${s}--${i}-${a}`,d=`${i}-${a}--${r}-${s}`;Io("source",c,d,e,r,s),Io("target",c,l,e,i,a),t.set(o.id,o)}}function fi(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:fi(n,t):!1}function Ao(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 Nd(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!fi(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 an({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[s,a]of t){const c=n.get(s)?.internals.userNode;c&&r.push({...c,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 Cd({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 Md({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,c=!1,l={x:0,y:0},d=null,f=!1,u=null,h=!1,y=!1,m=null;function b({noDragClassName:N,handleSelector:g,domNode:x,isSelectable:E,nodeId:_,nodeClickDistance:k=0}){u=ae(x);function I({x:A,y:z}){const{nodeLookup:v,nodeExtent:M,snapGrid:S,snapToGrid:C,nodeOrigin:T,onNodeDrag:P,onSelectionDrag:$,onError:H,updateNodePositions:L}=t();i={x:A,y:z};let F=!1;const V=a.size>1,Z=V&&M?Sn(gt(a)):null,U=V&&C?Cd({dragItems:a,snapGrid:S,x:A,y:z}):null;for(const[Y,O]of a){if(!v.has(Y))continue;let W={x:A-O.distance.x,y:z-O.distance.y};C&&(W=U?{x:Math.round(W.x+U.x),y:Math.round(W.y+U.y)}:pt(W,S));let ee=null;if(V&&M&&!O.extent&&Z){const{positionAbsolute:q}=O.internals,K=q.x-Z.x+M[0][0],te=q.x+O.measured.width-Z.x2+M[1][0],ie=q.y-Z.y+M[0][1],se=q.y+O.measured.height-Z.y2+M[1][1];ee=[[K,ie],[te,se]]}const{position:J,positionAbsolute:G}=Kr({nodeId:Y,nextPosition:W,nodeLookup:v,nodeExtent:ee||M,nodeOrigin:T,onError:H});F=F||O.position.x!==J.x||O.position.y!==J.y,O.position=J,O.internals.positionAbsolute=G}if(y=y||F,!!F&&(L(a,!0),m&&(o||P||!_&&$))){const[Y,O]=an({nodeId:_,dragItems:a,nodeLookup:v});o?.(m,a,Y,O),P?.(m,Y,O),_||$?.(m,O)}}async function j(){if(!d)return;const{transform:A,panBy:z,autoPanSpeed:v,autoPanOnNodeDrag:M}=t();if(!M){c=!1,cancelAnimationFrame(s);return}const[S,C]=Jr(l,d,v);(S!==0||C!==0)&&(i.x=(i.x??0)-S/A[2],i.y=(i.y??0)-C/A[2],await z({x:S,y:C})&&I(i)),s=requestAnimationFrame(j)}function B(A){const{nodeLookup:z,multiSelectionActive:v,nodesDraggable:M,transform:S,snapGrid:C,snapToGrid:T,selectNodesOnDrag:P,onNodeDragStart:$,onSelectionDragStart:H,unselectNodesAndEdges:L}=t();f=!0,(!P||!E)&&!v&&_&&(z.get(_)?.selected||L()),E&&P&&_&&e?.(_);const F=et(A.sourceEvent,{transform:S,snapGrid:C,snapToGrid:T,containerBounds:d});if(i=F,a=Nd(z,M,F,_),a.size>0&&(n||$||!_&&H)){const[V,Z]=an({nodeId:_,dragItems:a,nodeLookup:z});n?.(A.sourceEvent,a,V,Z),$?.(A.sourceEvent,V,Z),_||H?.(A.sourceEvent,Z)}}const R=zr().clickDistance(k).on("start",A=>{const{domNode:z,nodeDragThreshold:v,transform:M,snapGrid:S,snapToGrid:C}=t();d=z?.getBoundingClientRect()||null,h=!1,y=!1,m=A.sourceEvent,v===0&&B(A),i=et(A.sourceEvent,{transform:M,snapGrid:S,snapToGrid:C,containerBounds:d}),l=de(A.sourceEvent,d)}).on("drag",A=>{const{autoPanOnNodeDrag:z,transform:v,snapGrid:M,snapToGrid:S,nodeDragThreshold:C,nodeLookup:T}=t(),P=et(A.sourceEvent,{transform:v,snapGrid:M,snapToGrid:S,containerBounds:d});if(m=A.sourceEvent,(A.sourceEvent.type==="touchmove"&&A.sourceEvent.touches.length>1||_&&!T.has(_))&&(h=!0),!h){if(!c&&z&&f&&(c=!0,j()),!f){const $=de(A.sourceEvent,d),H=$.x-l.x,L=$.y-l.y;Math.sqrt(H*H+L*L)>C&&B(A)}(i.x!==P.xSnapped||i.y!==P.ySnapped)&&a&&f&&(l=de(A.sourceEvent,d),I(P))}}).on("end",A=>{if(!(!f||h)&&(c=!1,f=!1,cancelAnimationFrame(s),a.size>0)){const{nodeLookup:z,updateNodePositions:v,onNodeDragStop:M,onSelectionDragStop:S}=t();if(y&&(v(a,!1),y=!1),r||M||!_&&S){const[C,T]=an({nodeId:_,dragItems:a,nodeLookup:z,dragging:!1});r?.(A.sourceEvent,a,C,T),M?.(A.sourceEvent,C,T),_||S?.(A.sourceEvent,T)}}}).filter(A=>{const z=A.target;return!A.button&&(!N||!Ao(z,`.${N}`,x))&&(!g||Ao(z,g,x))});u.call(R)}function w(){u?.on(".drag",null)}return{update:b,destroy:w}}function kd(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())st(r,Ve(i))>0&&o.push(i);return o}const Id=250;function Ad(e,t,n,o){let r=[],i=1/0;const s=kd(e,n,t+Id);for(const a of s){const c=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(const l of c){if(o.nodeId===l.nodeId&&o.type===l.type&&o.id===l.id)continue;const{x:d,y:f}=ct(a,l,l.position,!0),u=Math.sqrt(Math.pow(d-e.x,2)+Math.pow(f-e.y,2));u>t||(u<i?(r=[{...l,x:d,y:f}],i=u):u===i&&r.push({...l,x:d,y:f}))}}if(!r.length)return null;if(r.length>1){const a=o.type==="source"?"target":"source";return r.find(c=>c.type===a)??r[0]}return r[0]}function hi(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??[]],c=(n?a?.find(l=>l.id===n):a?.[0])??null;return c&&i?{...c,...ct(s,c,c.position,!0)}:c}function gi(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function Pd(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const pi=()=>!0;function Dd(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:c,lib:l,autoPanOnConnect:d,flowId:f,panBy:u,cancelConnection:h,onConnectStart:y,onConnect:m,onConnectEnd:b,isValidConnection:w=pi,onReconnectEnd:N,updateConnection:g,getTransform:x,getFromHandle:E,autoPanSpeed:_,dragThreshold:k=1,handleDomNode:I}){const j=oi(e.target);let B=0,R;const{x:A,y:z}=de(e),v=gi(i,I),M=a?.getBoundingClientRect();let S=!1;if(!M||!v)return;const C=hi(r,v,o,c,t);if(!C)return;let T=de(e,M),P=!1,$=null,H=!1,L=null;function F(){if(!d||!M)return;const[J,G]=Jr(T,M,_);u({x:J,y:G}),B=requestAnimationFrame(F)}const V={...C,nodeId:r,type:v,position:C.position},Z=c.get(r);let Y={inProgress:!0,isValid:null,from:ct(Z,V,X.Left,!0),fromHandle:V,fromPosition:V.position,fromNode:Z,to:T,toHandle:null,toPosition:xo[V.position],toNode:null};function O(){S=!0,g(Y),y?.(e,{nodeId:r,handleId:o,handleType:v})}k===0&&O();function W(J){if(!S){const{x:te,y:ie}=de(J),se=te-A,Ie=ie-z;if(!(se*se+Ie*Ie>k*k))return;O()}if(!E()||!V){ee(J);return}const G=x();T=de(J,M),R=Ad(mt(T,G,!1,[1,1]),n,c,V),P||(F(),P=!0);const q=mi(J,{handle:R,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:w,doc:j,lib:l,flowId:f,nodeLookup:c});L=q.handleDomNode,$=q.connection,H=Pd(!!R,q.isValid);const K={...Y,isValid:H,to:q.toHandle&&H?Ot({x:q.toHandle.x,y:q.toHandle.y},G):T,toHandle:q.toHandle,toPosition:H&&q.toHandle?q.toHandle.position:xo[V.position],toNode:q.toHandle?c.get(q.toHandle.nodeId):null};H&&R&&Y.toHandle&&K.toHandle&&Y.toHandle.type===K.toHandle.type&&Y.toHandle.nodeId===K.toHandle.nodeId&&Y.toHandle.id===K.toHandle.id&&Y.to.x===K.to.x&&Y.to.y===K.to.y||(g(K),Y=K)}function ee(J){if(!("touches"in J&&J.touches.length>0)){if(S){(R||L)&&$&&H&&m?.($);const{inProgress:G,...q}=Y,K={...q,toPosition:Y.toHandle?Y.toPosition:null};b?.(J,K),i&&N?.(J,K)}h(),cancelAnimationFrame(B),P=!1,H=!1,$=null,L=null,j.removeEventListener("mousemove",W),j.removeEventListener("mouseup",ee),j.removeEventListener("touchmove",W),j.removeEventListener("touchend",ee)}}j.addEventListener("mousemove",W),j.addEventListener("mouseup",ee),j.addEventListener("touchmove",W),j.addEventListener("touchend",ee)}function mi(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:l=pi,nodeLookup:d}){const f=i==="target",u=t?s.querySelector(`.${a}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y}=de(e),m=s.elementFromPoint(h,y),b=m?.classList.contains(`${a}-flow__handle`)?m:u,w={handleDomNode:b,isValid:!1,connection:null,toHandle:null};if(b){const N=gi(void 0,b),g=b.getAttribute("data-nodeid"),x=b.getAttribute("data-handleid"),E=b.classList.contains("connectable"),_=b.classList.contains("connectableend");if(!g||!N)return w;const k={source:f?g:o,sourceHandle:f?x:r,target:f?o:g,targetHandle:f?r:x};w.connection=k;const j=E&&_&&(n===Oe.Strict?f&&N==="source"||!f&&N==="target":g!==o||x!==r);w.isValid=j&&l(k),w.toHandle=hi(g,N,x,d,n,!0)}return w}const Mn={onPointerDown:Dd,isValid:mi};function Td({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=ae(e);function i({translateExtent:a,width:c,height:l,zoomStep:d=1,pannable:f=!0,zoomable:u=!0,inversePan:h=!1}){const y=g=>{if(g.sourceEvent.type!=="wheel"||!t)return;const x=n(),E=g.sourceEvent.ctrlKey&&at()?10:1,_=-g.sourceEvent.deltaY*(g.sourceEvent.deltaMode===1?.05:g.sourceEvent.deltaMode?1:.002)*d,k=x[2]*Math.pow(2,_*E);t.scaleTo(k)};let m=[0,0];const b=g=>{(g.sourceEvent.type==="mousedown"||g.sourceEvent.type==="touchstart")&&(m=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY])},w=g=>{const x=n();if(g.sourceEvent.type!=="mousemove"&&g.sourceEvent.type!=="touchmove"||!t)return;const E=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY],_=[E[0]-m[0],E[1]-m[1]];m=E;const k=o()*Math.max(x[2],Math.log(x[2]))*(h?-1:1),I={x:x[0]-_[0]*k,y:x[1]-_[1]*k},j=[[0,0],[c,l]];t.setViewportConstrained({x:I.x,y:I.y,zoom:x[2]},j,a)},N=Yr().on("start",b).on("zoom",f?w:null).on("zoom.wheel",u?y:null);r.call(N,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:le}}const jd=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,Ut=e=>({x:e.x,y:e.y,zoom:e.k}),cn=({x:e,y:t,zoom:n})=>Zt.translate(e,t).scale(n),De=(e,t)=>e.target.closest(`.${t}`),yi=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),$d=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,ln=(e,t=0,n=$d,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},xi=e=>{const t=e.ctrlKey&&at()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function zd({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:l}){return d=>{if(De(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(d.ctrlKey&&s){const b=le(d),w=xi(d),N=f*Math.pow(2,w);o.scaleTo(n,N,b,d);return}const u=d.deltaMode===1?20:1;let h=r===Ce.Vertical?0:d.deltaX*u,y=r===Ce.Horizontal?0:d.deltaY*u;!at()&&d.shiftKey&&r!==Ce.Vertical&&(h=d.deltaY*u,y=0),o.translateBy(n,-(h/f)*i,-(y/f)*i,{internal:!0});const m=Ut(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling||(e.isPanScrolling=!0,a?.(d,m)),e.isPanScrolling&&(c?.(d,m),e.panScrollTimeout=setTimeout(()=>{l?.(d,m),e.isPanScrolling=!1},150))}}function Hd({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,a=De(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function Ld({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=Ut(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 Rd({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&yi(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,Ut(i.transform))}}function Od({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&yi(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r&&jd(e.prevViewport,s.transform))){const a=Ut(s.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,a)},n?150:0)}}}function Bd({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:c,lib:l,connectionInProgress:d}){return f=>{const u=e||t,h=n&&f.ctrlKey,y=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(De(f,`${l}-flow__node`)||De(f,`${l}-flow__edge`)))return!0;if(!o&&!u&&!r&&!i&&!n||s||d&&!y||De(f,a)&&y||De(f,c)&&(!y||r&&y&&!e)||!n&&f.ctrlKey&&y)return!1;if(!n&&f.type==="touchstart"&&f.touches?.length>1)return f.preventDefault(),!1;if(!u&&!r&&!h&&y||!o&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(o)&&!o.includes(f.button)&&f.type==="mousedown")return!1;const m=Array.isArray(o)&&o.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||y)&&m}}function Vd({domNode:e,minZoom:t,maxZoom:n,paneClickDistance:o,translateExtent:r,viewport:i,onPanZoom:s,onPanZoomStart:a,onPanZoomEnd:c,onDraggingChange:l}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=e.getBoundingClientRect(),u=Yr().clickDistance(!ue(o)||o<0?0:o).scaleExtent([t,n]).translateExtent(r),h=ae(e).call(u);g({x:i.x,y:i.y,zoom:Be(i.zoom,t,n)},[[0,0],[f.width,f.height]],r);const y=h.on("wheel.zoom"),m=h.on("dblclick.zoom");u.wheelDelta(xi);function b(A,z){return h?new Promise(v=>{u?.interpolate(z?.interpolate==="linear"?on:kt).transform(ln(h,z?.duration,z?.ease,()=>v(!0)),A)}):Promise.resolve(!1)}function w({noWheelClassName:A,noPanClassName:z,onPaneContextMenu:v,userSelectionActive:M,panOnScroll:S,panOnDrag:C,panOnScrollMode:T,panOnScrollSpeed:P,preventScrolling:$,zoomOnPinch:H,zoomOnScroll:L,zoomOnDoubleClick:F,zoomActivationKeyPressed:V,lib:Z,onTransformChange:U,connectionInProgress:Y}){M&&!d.isZoomingOrPanning&&N();const W=S&&!V&&!M?zd({zoomPanValues:d,noWheelClassName:A,d3Selection:h,d3Zoom:u,panOnScrollMode:T,panOnScrollSpeed:P,zoomOnPinch:H,onPanZoomStart:a,onPanZoom:s,onPanZoomEnd:c}):Hd({noWheelClassName:A,preventScrolling:$,d3ZoomHandler:y});if(h.on("wheel.zoom",W,{passive:!1}),!M){const J=Ld({zoomPanValues:d,onDraggingChange:l,onPanZoomStart:a});u.on("start",J);const G=Rd({zoomPanValues:d,panOnDrag:C,onPaneContextMenu:!!v,onPanZoom:s,onTransformChange:U});u.on("zoom",G);const q=Od({zoomPanValues:d,panOnDrag:C,panOnScroll:S,onPaneContextMenu:v,onPanZoomEnd:c,onDraggingChange:l});u.on("end",q)}const ee=Bd({zoomActivationKeyPressed:V,panOnDrag:C,zoomOnScroll:L,panOnScroll:S,zoomOnDoubleClick:F,zoomOnPinch:H,userSelectionActive:M,noPanClassName:z,noWheelClassName:A,lib:Z,connectionInProgress:Y});u.filter(ee),F?h.on("dblclick.zoom",m):h.on("dblclick.zoom",null)}function N(){u.on("zoom",null)}async function g(A,z,v){const M=cn(A),S=u?.constrain()(M,z,v);return S&&await b(S),new Promise(C=>C(S))}async function x(A,z){const v=cn(A);return await b(v,z),new Promise(M=>M(v))}function E(A){if(h){const z=cn(A),v=h.property("__zoom");(v.k!==A.zoom||v.x!==A.x||v.y!==A.y)&&u?.transform(h,z,null,{sync:!0})}}function _(){const A=h?Xr(h.node()):{x:0,y:0,k:1};return{x:A.x,y:A.y,zoom:A.k}}function k(A,z){return h?new Promise(v=>{u?.interpolate(z?.interpolate==="linear"?on:kt).scaleTo(ln(h,z?.duration,z?.ease,()=>v(!0)),A)}):Promise.resolve(!1)}function I(A,z){return h?new Promise(v=>{u?.interpolate(z?.interpolate==="linear"?on:kt).scaleBy(ln(h,z?.duration,z?.ease,()=>v(!0)),A)}):Promise.resolve(!1)}function j(A){u?.scaleExtent(A)}function B(A){u?.translateExtent(A)}function R(A){const z=!ue(A)||A<0?0:A;u?.clickDistance(z)}return{update:w,destroy:N,setViewport:x,setViewportConstrained:g,getViewport:_,scaleTo:k,scaleBy:I,setScaleExtent:j,setTranslateExtent:B,syncViewport:E,setClickDistance:R}}var Xe;(function(e){e.Line="line",e.Handle="handle"})(Xe||(Xe={}));function Fd({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,a=n-o,c=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(c[0]=c[0]*-1),a&&i&&(c[1]=c[1]*-1),c}function Xd(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 we(e,t){return Math.max(0,t-e)}function ve(e,t){return Math.max(0,e-t)}function Nt(e,t,n){return Math.max(0,t-e,e-n)}function Po(e,t){return e?!t:t}function Yd(e,t,n,o,r,i,s,a){let{affectsX:c,affectsY:l}=t;const{isHorizontal:d,isVertical:f}=t,u=d&&f,{xSnapped:h,ySnapped:y}=n,{minWidth:m,maxWidth:b,minHeight:w,maxHeight:N}=o,{x:g,y:x,width:E,height:_,aspectRatio:k}=e;let I=Math.floor(d?h-e.pointerX:0),j=Math.floor(f?y-e.pointerY:0);const B=E+(c?-I:I),R=_+(l?-j:j),A=-i[0]*E,z=-i[1]*_;let v=Nt(B,m,b),M=Nt(R,w,N);if(s){let T=0,P=0;c&&I<0?T=we(g+I+A,s[0][0]):!c&&I>0&&(T=ve(g+B+A,s[1][0])),l&&j<0?P=we(x+j+z,s[0][1]):!l&&j>0&&(P=ve(x+R+z,s[1][1])),v=Math.max(v,T),M=Math.max(M,P)}if(a){let T=0,P=0;c&&I>0?T=ve(g+I,a[0][0]):!c&&I<0&&(T=we(g+B,a[1][0])),l&&j>0?P=ve(x+j,a[0][1]):!l&&j<0&&(P=we(x+R,a[1][1])),v=Math.max(v,T),M=Math.max(M,P)}if(r){if(d){const T=Nt(B/k,w,N)*k;if(v=Math.max(v,T),s){let P=0;!c&&!l||c&&!l&&u?P=ve(x+z+B/k,s[1][1])*k:P=we(x+z+(c?I:-I)/k,s[0][1])*k,v=Math.max(v,P)}if(a){let P=0;!c&&!l||c&&!l&&u?P=we(x+B/k,a[1][1])*k:P=ve(x+(c?I:-I)/k,a[0][1])*k,v=Math.max(v,P)}}if(f){const T=Nt(R*k,m,b)/k;if(M=Math.max(M,T),s){let P=0;!c&&!l||l&&!c&&u?P=ve(g+R*k+A,s[1][0])/k:P=we(g+(l?j:-j)*k+A,s[0][0])/k,M=Math.max(M,P)}if(a){let P=0;!c&&!l||l&&!c&&u?P=we(g+R*k,a[1][0])/k:P=ve(g+(l?j:-j)*k,a[0][0])/k,M=Math.max(M,P)}}}j=j+(j<0?M:-M),I=I+(I<0?v:-v),r&&(u?B>R*k?j=(Po(c,l)?-I:I)/k:I=(Po(c,l)?-j:j)*k:d?(j=I/k,l=c):(I=j*k,c=l));const S=c?g+I:g,C=l?x+j:x;return{width:E+(c?-I:I),height:_+(l?-j:j),x:i[0]*I*(c?-1:1)+S,y:i[1]*j*(l?-1:1)+C}}const wi={width:0,height:0,x:0,y:0},Wd={...wi,pointerX:0,pointerY:0,aspectRatio:1};function Zd(e){return[[0,0],[e.measured.width,e.measured.height]]}function Gd(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,c=n[1]*s;return[[o-a,r-c],[o+i-a,r+s-c]]}function qd({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=ae(e);function s({controlPosition:c,boundaries:l,keepAspectRatio:d,resizeDirection:f,onResizeStart:u,onResize:h,onResizeEnd:y,shouldResize:m}){let b={...wi},w={...Wd};const N=Xd(c);let g,x=null,E=[],_,k,I,j=!1;const B=zr().on("start",R=>{const{nodeLookup:A,transform:z,snapGrid:v,snapToGrid:M,nodeOrigin:S,paneDomNode:C}=n();if(g=A.get(t),!g)return;x=C?.getBoundingClientRect()??null;const{xSnapped:T,ySnapped:P}=et(R.sourceEvent,{transform:z,snapGrid:v,snapToGrid:M,containerBounds:x});b={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},w={...b,pointerX:T,pointerY:P,aspectRatio:b.width/b.height},_=void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(_=A.get(g.parentId),k=_&&g.extent==="parent"?Zd(_):void 0),E=[],I=void 0;for(const[$,H]of A)if(H.parentId===t&&(E.push({id:$,position:{...H.position},extent:H.extent}),H.extent==="parent"||H.expandParent)){const L=Gd(H,g,H.origin??S);I?I=[[Math.min(L[0][0],I[0][0]),Math.min(L[0][1],I[0][1])],[Math.max(L[1][0],I[1][0]),Math.max(L[1][1],I[1][1])]]:I=L}u?.(R,{...b})}).on("drag",R=>{const{transform:A,snapGrid:z,snapToGrid:v,nodeOrigin:M}=n(),S=et(R.sourceEvent,{transform:A,snapGrid:z,snapToGrid:v,containerBounds:x}),C=[];if(!g)return;const{x:T,y:P,width:$,height:H}=b,L={},F=g.origin??M,{width:V,height:Z,x:U,y:Y}=Yd(w,N,S,l,d,F,k,I),O=V!==$,W=Z!==H,ee=U!==T&&O,J=Y!==P&&W;if(!ee&&!J&&!O&&!W)return;if((ee||J||F[0]===1||F[1]===1)&&(L.x=ee?U:b.x,L.y=J?Y:b.y,b.x=L.x,b.y=L.y,E.length>0)){const te=U-T,ie=Y-P;for(const se of E)se.position={x:se.position.x-te+F[0]*(V-$),y:se.position.y-ie+F[1]*(Z-H)},C.push(se)}if((O||W)&&(L.width=O&&(!f||f==="horizontal")?V:b.width,L.height=W&&(!f||f==="vertical")?Z:b.height,b.width=L.width,b.height=L.height),_&&g.expandParent){const te=F[0]*(L.width??0);L.x&&L.x<te&&(b.x=te,w.x=w.x-(L.x-te));const ie=F[1]*(L.height??0);L.y&&L.y<ie&&(b.y=ie,w.y=w.y-(L.y-ie))}const G=Fd({width:b.width,prevWidth:$,height:b.height,prevHeight:H,affectsX:N.affectsX,affectsY:N.affectsY}),q={...b,direction:G};m?.(R,q)!==!1&&(j=!0,h?.(R,q),o(L,C))}).on("end",R=>{j&&(y?.(R,{...b}),r?.({...b}),j=!1)});i.call(B)}function a(){i.on(".drag",null)}return{update:s,destroy:a}}var un={exports:{}},dn={};var Do;function Ud(){if(Do)return dn;Do=1;var e=aa(),t=ca();function n(l,d){return l===d&&(l!==0||1/l===1/d)||l!==l&&d!==d}var o=typeof Object.is=="function"?Object.is:n,r=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,a=e.useMemo,c=e.useDebugValue;return dn.useSyncExternalStoreWithSelector=function(l,d,f,u,h){var y=i(null);if(y.current===null){var m={hasValue:!1,value:null};y.current=m}else m=y.current;y=a(function(){function w(_){if(!N){if(N=!0,g=_,_=u(_),h!==void 0&&m.hasValue){var k=m.value;if(h(k,_))return x=k}return x=_}if(k=x,o(g,_))return k;var I=u(_);return h!==void 0&&h(k,I)?(g=_,k):(g=_,x=I)}var N=!1,g,x,E=f===void 0?null:f;return[function(){return w(d())},E===null?void 0:function(){return w(E())}]},[d,f,u,h]);var b=r(l,y[0],y[1]);return s(function(){m.hasValue=!0,m.value=b},[b]),c(b),b},dn}var To;function Kd(){return To||(To=1,un.exports=Ud()),un.exports}var Qd=Kd();const Jd=la(Qd),ef={},jo=e=>{let t;const n=new Set,o=(d,f)=>{const u=typeof d=="function"?d(t):d;if(!Object.is(u,t)){const h=t;t=f??(typeof u!="object"||u===null)?u:Object.assign({},t,u),n.forEach(y=>y(t,h))}},r=()=>t,c={setState:o,getState:r,getInitialState:()=>l,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(ef?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},l=t=e(o,r,c);return c},tf=e=>e?jo(e):jo,{useDebugValue:nf}=$e,{useSyncExternalStoreWithSelector:of}=Jd,rf=e=>e;function vi(e,t=rf,n){const o=of(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return nf(o),o}const $o=(e,t)=>{const n=tf(e),o=(r,i=t)=>vi(n,r,i);return Object.assign(o,n),o},sf=(e,t)=>e?$o(e,t):$o;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 Kt=D.createContext(null),af=Kt.Provider,bi=he.error001();function Q(e,t){const n=D.useContext(Kt);if(n===null)throw new Error(bi);return vi(n,e,t)}function ne(){const e=D.useContext(Kt);if(e===null)throw new Error(bi);return D.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const zo={display:"none"},cf={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},_i="react-flow__node-desc",Ei="react-flow__edge-desc",lf="react-flow__aria-live",uf=e=>e.ariaLiveMessage,df=e=>e.ariaLabelConfig;function ff({rfId:e}){const t=Q(uf);return p.jsx("div",{id:`${lf}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:cf,children:t})}function hf({rfId:e,disableKeyboardA11y:t}){const n=Q(df);return p.jsxs(p.Fragment,{children:[p.jsx("div",{id:`${_i}-${e}`,style:zo,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),p.jsx("div",{id:`${Ei}-${e}`,style:zo,children:n["edge.a11yDescription.default"]}),!t&&p.jsx(ff,{rfId:e})]})}const Qt=D.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return p.jsx("div",{className:re(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});Qt.displayName="Panel";function gf({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:p.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:p.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const pf=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}},Ct=e=>e.id;function mf(e,t){return oe(e.selectedNodes.map(Ct),t.selectedNodes.map(Ct))&&oe(e.selectedEdges.map(Ct),t.selectedEdges.map(Ct))}function yf({onSelectionChange:e}){const t=ne(),{selectedNodes:n,selectedEdges:o}=Q(pf,mf);return D.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}const xf=e=>!!e.onSelectionChangeHandlers;function wf({onSelectionChange:e}){const t=Q(xf);return e||t?p.jsx(yf,{onSelectionChange:e}):null}const Si=[0,0],vf={x:0,y:0,zoom:1},bf=["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","paneClickDistance","ariaLabelConfig"],Ho=[...bf,"rfId"],_f=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setPaneClickDistance:e.setPaneClickDistance}),Lo={translateExtent:rt,nodeOrigin:Si,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1",paneClickDistance:0};function Ef(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:c,setPaneClickDistance:l}=Q(_f,oe),d=ne();D.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{f.current=Lo,a()}),[]);const f=D.useRef(Lo);return D.useEffect(()=>{for(const u of Ho){const h=e[u],y=f.current[u];h!==y&&(typeof e[u]>"u"||(u==="nodes"?t(h):u==="edges"?n(h):u==="minZoom"?o(h):u==="maxZoom"?r(h):u==="translateExtent"?i(h):u==="nodeExtent"?s(h):u==="paneClickDistance"?l(h):u==="ariaLabelConfig"?d.setState({ariaLabelConfig:sd(h)}):u==="fitView"?d.setState({fitViewQueued:h}):u==="fitViewOptions"?d.setState({fitViewOptions:h}):d.setState({[u]:h})))}f.current=e},Ho.map(u=>e[u])),null}function Ro(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Sf(e){const[t,n]=D.useState(e==="system"?null:e);return D.useEffect(()=>{if(e!=="system"){n(e);return}const o=Ro(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:Ro()?.matches?"dark":"light"}const Oo=typeof document<"u"?document:null;function lt(e=null,t={target:Oo,actInsideInputWithModifier:!0}){const[n,o]=D.useState(!1),r=D.useRef(!1),i=D.useRef(new Set([])),[s,a]=D.useMemo(()=>{if(e!==null){const l=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",`
2
2
  `).replace(`
3
3
 
4
4
  `,`
@@ -1 +1 @@
1
- import{t as d,j as e,G as n}from"./index-CFEzD2_M.js";const x=d.forwardRef(({children:s,className:r,...a},t)=>e.jsx("div",{ref:t,className:n("flex items-center justify-center rounded-full bg-muted w-12 h-12 max-w-12 max-h-12 [&_svg]:size-4 [&_svg]:text-muted-foreground [&_svg]:shrink-0",r),...a,children:s}));x.displayName="EmptyBadge";const l=d.forwardRef(({children:s,className:r,title:a,description:t,actions:m,...c},i)=>e.jsxs("div",{ref:i,className:n("flex flex-col items-center justify-center space-y-3 text-center",r),...c,children:[e.jsx(x,{children:s}),e.jsxs("div",{className:"max-w-[320px] space-y-1.5",children:[e.jsx("h3",{className:"text-md font-medium tracking-normal text-pretty text-foreground",children:a}),t&&e.jsx("p",{className:"text-sm leading-tight text-pretty text-muted-foreground",children:t})]}),m&&e.jsx("div",{className:"flex items-center gap-2",children:m})]}));l.displayName="EmptyIndicator";export{l as E};
1
+ import{t as d,j as e,G as n}from"./index-BkbhBpVC.js";const x=d.forwardRef(({children:s,className:r,...a},t)=>e.jsx("div",{ref:t,className:n("flex items-center justify-center rounded-full bg-muted w-12 h-12 max-w-12 max-h-12 [&_svg]:size-4 [&_svg]:text-muted-foreground [&_svg]:shrink-0",r),...a,children:s}));x.displayName="EmptyBadge";const l=d.forwardRef(({children:s,className:r,title:a,description:t,actions:m,...c},i)=>e.jsxs("div",{ref:i,className:n("flex flex-col items-center justify-center space-y-3 text-center",r),...c,children:[e.jsx(x,{children:s}),e.jsxs("div",{className:"max-w-[320px] space-y-1.5",children:[e.jsx("h3",{className:"text-md font-medium tracking-normal text-pretty text-foreground",children:a}),t&&e.jsx("p",{className:"text-sm leading-tight text-pretty text-muted-foreground",children:t})]}),m&&e.jsx("div",{className:"flex items-center gap-2",children:m})]}));l.displayName="EmptyIndicator";export{l as E};