@decocms/mesh 1.6.0 → 1.7.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 (111) hide show
  1. package/dist/client/assets/{AlertCircle-BIlMffS8.js → AlertCircle-BPiWR69f.js} +1 -1
  2. package/dist/client/assets/{ArrowLeft-CJ-eKoid.js → ArrowLeft-CnWcM-Nt.js} +1 -1
  3. package/dist/client/assets/{ChevronDown-atiP0m-F.js → ChevronDown-CzJqGT44.js} +1 -1
  4. package/dist/client/assets/{Clock-BD2gknBV.js → Clock-DfIJLD0U.js} +1 -1
  5. package/dist/client/assets/{Code01-BEefaaXC.js → Code01-BqdRSdUi.js} +1 -1
  6. package/dist/client/assets/{Copy01-DhXqtugg.js → Copy01-Bsnbushh.js} +1 -1
  7. package/dist/client/assets/{CpuChip02-BtgBI59l.js → CpuChip02-C8zbTCUz.js} +1 -1
  8. package/dist/client/assets/{DotsVertical-roys0n6e.js → DotsVertical-Dld0ppCR.js} +1 -1
  9. package/dist/client/assets/{File06-MlW8n69V.js → File06-BqXxPQ9_.js} +1 -1
  10. package/dist/client/assets/{FlipBackward-BSnTMMYy.js → FlipBackward-DfSp-QEd.js} +1 -1
  11. package/dist/client/assets/{GitBranch01-CEvRlFly.js → GitBranch01-D-IJ3Rmm.js} +1 -1
  12. package/dist/client/assets/{Grid01-CkwdbRed.js → Grid01-BGAyn8Yw.js} +1 -1
  13. package/dist/client/assets/{Inbox01-D66dNA_K.js → Inbox01-WG7d7KAj.js} +1 -1
  14. package/dist/client/assets/{Key01-BXlD7hmS.js → Key01-BVEDd5ss.js} +1 -1
  15. package/dist/client/assets/{LinkExternal01-O4xnNCff.js → LinkExternal01-754qZCAw.js} +1 -1
  16. package/dist/client/assets/{Loading01-EiDV-2FW.js → Loading01-C25_IOHO.js} +1 -1
  17. package/dist/client/assets/{Lock01-DpRDCI3P.js → Lock01-BrE0URxO.js} +1 -1
  18. package/dist/client/assets/{Play-FKw7EqPO.js → Play-DMQjilHa.js} +1 -1
  19. package/dist/client/assets/{Plus-CwB-Rc8B.js → Plus-BICwTwx2.js} +1 -1
  20. package/dist/client/assets/{SearchMd-C6P9P1wF.js → SearchMd-BfdAKKpi.js} +1 -1
  21. package/dist/client/assets/{Terminal-Dv6w41J8.js → Terminal-BnLcMoVf.js} +1 -1
  22. package/dist/client/assets/{Trash01-Ctk7srex.js → Trash01-COqd_w6V.js} +1 -1
  23. package/dist/client/assets/{X-Da4xsL05.js → X-BS9TixYK.js} +1 -1
  24. package/dist/client/assets/{XClose-OUZ04LEo.js → XClose-BbtISBJv.js} +1 -1
  25. package/dist/client/assets/{alert-dialog-D6UjYOUP.js → alert-dialog-BDXuXliX.js} +1 -1
  26. package/dist/client/assets/{auth-catchall-BZWl_BRK.js → auth-catchall-C96Z5CEi.js} +1 -1
  27. package/dist/client/assets/{auth-CZR9mNdb.js → auth-q6-9Qro0.js} +1 -1
  28. package/dist/client/assets/{avatar-BHE7lL4M.js → avatar-B8vG4Uqa.js} +1 -1
  29. package/dist/client/assets/{badge-B-u7R38I.js → badge-C1bAg12O.js} +1 -1
  30. package/dist/client/assets/{button-B13xcF6W.js → button-DGQafcd8.js} +1 -1
  31. package/dist/client/assets/{card-7VW-xSd-.js → card-CYr6OLlA.js} +1 -1
  32. package/dist/client/assets/{checkbox-BMd2Z-WT.js → checkbox-CaJyqy-O.js} +1 -1
  33. package/dist/client/assets/{collection-detail-7eGCexqR.js → collection-detail-Cu_HUqcL.js} +1 -1
  34. package/dist/client/assets/{collection-display-button-D4VM0KQx.js → collection-display-button-KGOe_g_c.js} +1 -1
  35. package/dist/client/assets/{collection-header-od14k6u3.js → collection-header-BTdNES9r.js} +1 -1
  36. package/dist/client/assets/{collection-page-BNuNM--s.js → collection-page-zdZke2gS.js} +1 -1
  37. package/dist/client/assets/{collection-search-LnYLnFH8.js → collection-search-B3tGk-LW.js} +1 -1
  38. package/dist/client/assets/{collection-tab-bg_gmLyh.js → collection-tab-DSAVfRke.js} +1 -1
  39. package/dist/client/assets/{collection-table-wrapper-B0AFEn1d.js → collection-table-wrapper-BX_y9ddJ.js} +1 -1
  40. package/dist/client/assets/{connection-card-r2tH19aR.js → connection-card-CjFdHSFM.js} +1 -1
  41. package/dist/client/assets/{connection-detail-Dm1s8Dj2.js → connection-detail-BA5ZpgfC.js} +1 -1
  42. package/dist/client/assets/{connections-CWHukeOK.js → connections-D-_nUNdM.js} +1 -1
  43. package/dist/client/assets/constants-DOHmO1ep.js +1 -0
  44. package/dist/client/assets/{core-BqWxized.js → core-CqC2GVou.js} +1 -1
  45. package/dist/client/assets/{create-organization-dialog-CjneLhKn.js → create-organization-dialog-CGAUGBhL.js} +1 -1
  46. package/dist/client/assets/{dialog-DoN4ORnY.js → dialog-Dpiwsgfz.js} +1 -1
  47. package/dist/client/assets/{dropdown-menu-uXj8nKiT.js → dropdown-menu-B9xMQj69.js} +1 -1
  48. package/dist/client/assets/{empty-state-N07FE0YG.js → empty-state-BeSrv53i.js} +1 -1
  49. package/dist/client/assets/{env-vars-editor-B7JL_p-V.js → env-vars-editor-CGSk8J9z.js} +1 -1
  50. package/dist/client/assets/{error-boundary-Ce0_dLsG.js → error-boundary-wmq9HPr0.js} +1 -1
  51. package/dist/client/assets/{extract-connection-data-CeT4F9gU.js → extract-connection-data-CpBGc1Lc.js} +1 -1
  52. package/dist/client/assets/{form-BQIYj24w.js → form-D_YgJ7e_.js} +1 -1
  53. package/dist/client/assets/{formatDistanceToNow-CArtWgcP.js → formatDistanceToNow-Ds7vgs-h.js} +1 -1
  54. package/dist/client/assets/{gateway-detail-VCb3jL84.js → gateway-detail-D76LyPqO.js} +1 -1
  55. package/dist/client/assets/{gateways-9p2LLkTK.js → gateways-DNlHFwW1.js} +1 -1
  56. package/dist/client/assets/{home-DgfprghT.js → home-M_DzttVm.js} +1 -1
  57. package/dist/client/assets/{index-BcDKMyjy.css → index-B3GsxHkT.css} +1 -1
  58. package/dist/client/assets/{index-DcMa5gDs.js → index-D0CEOhNr.js} +1 -1
  59. package/dist/client/assets/{index-CVgkE3Gv.js → index-DLujruNe.js} +1 -1
  60. package/dist/client/assets/{index-DEMNtulg.js → index-Ddg6ZSnz.js} +3 -3
  61. package/dist/client/assets/{index-DcvTq0xJ.js → index-SXKJnrpI.js} +1 -1
  62. package/dist/client/assets/{input-YdP8mwrf.js → input-B4ervJqC.js} +1 -1
  63. package/dist/client/assets/json-1el7bQkh.js +1 -0
  64. package/dist/client/assets/{json-syntax-highlighter-Bif-CDya.js → json-syntax-highlighter-C24L-Dcz.js} +2 -2
  65. package/dist/client/assets/{layout-BNxxrCBw.js → layout-DI3tY0Jg.js} +1 -1
  66. package/dist/client/assets/{lazy-highlighter-C0vzyJy5.js → lazy-highlighter-B_9Ne15K.js} +1 -1
  67. package/dist/client/assets/{localstorage-keys-DwKN3_Ky.js → localstorage-keys-B9p3fxpE.js} +1 -1
  68. package/dist/client/assets/{login-UWyl_cxx.js → login-Bb9ke2MY.js} +1 -1
  69. package/dist/client/assets/{mcp-oauth-Dqr97r2H.js → mcp-oauth-DJdQFUv3.js} +1 -1
  70. package/dist/client/assets/{members-C3UV37Kw.js → members-DVNMtilz.js} +1 -1
  71. package/dist/client/assets/{monitoring-Ds52TSSS.js → monitoring-Dtmkvdkl.js} +1 -1
  72. package/dist/client/assets/{oauth-callback-D4M9mHyH.js → oauth-callback-BX9ETVvQ.js} +1 -1
  73. package/dist/client/assets/{page-B7ia0_lh.js → page-DsxVj63x.js} +1 -1
  74. package/dist/client/assets/{pin-to-sidebar-button-BKotT_Nc.js → pin-to-sidebar-button-BKGCvVX6.js} +1 -1
  75. package/dist/client/assets/{popover-7jr0PuXV.js → popover-CgilhutT.js} +1 -1
  76. package/dist/client/assets/prism-light-BjmAUPsT.js +1 -0
  77. package/dist/client/assets/{resizable-qkPSJ31g.js → resizable-DsS5puYc.js} +1 -1
  78. package/dist/client/assets/{resource-tabs-qR3NhTLd.js → resource-tabs-DoDLyAeo.js} +1 -1
  79. package/dist/client/assets/{responsive-select-CJQwNPPj.js → responsive-select-Db26zo9M.js} +1 -1
  80. package/dist/client/assets/{select-L_OjJ9sW.js → select-twBCjq69.js} +1 -1
  81. package/dist/client/assets/{settings-BapAo6i2.js → settings-CVfx5hka.js} +1 -1
  82. package/dist/client/assets/{shell-layout-DqUuQ9gz.js → shell-layout-DCe42qoz.js} +1 -1
  83. package/dist/client/assets/{spinner-CAJeeq5B.js → spinner-Dx5oa4h9.js} +1 -1
  84. package/dist/client/assets/{store-DTMoxgob.js → store-BJT-rcWj.js} +1 -1
  85. package/dist/client/assets/{store-app-detail-CbGg2GlI.js → store-app-detail-BRGaOqlr.js} +1 -1
  86. package/dist/client/assets/{switch-DlwEQXd2.js → switch-CBPgVkl4.js} +1 -1
  87. package/dist/client/assets/{textarea-IOVeLZOt.js → textarea-OX-GeuN9.js} +1 -1
  88. package/dist/client/assets/{thread-history-popover-COjpShBU.js → thread-history-popover-BTd50eKs.js} +35 -35
  89. package/dist/client/assets/{tools-list-l6xtSgWR.js → tools-list-C94gLEYQ.js} +1 -1
  90. package/dist/client/assets/{tooltip-C7B84lYF.js → tooltip-D8OED8cS.js} +1 -1
  91. package/dist/client/assets/{types-BmKCUQAI.js → types-DJryM_sg.js} +1 -1
  92. package/dist/client/assets/{use-binding-Ce8NG0MO.js → use-binding-DALTy821.js} +1 -1
  93. package/dist/client/assets/{use-connection-D-LWel3A.js → use-connection-bHHmK9mi.js} +1 -1
  94. package/dist/client/assets/{use-connection-resources-CJzk5_Wj.js → use-connection-resources-DFv5BDo6.js} +1 -1
  95. package/dist/client/assets/{use-gateway-eXp_1iQc.js → use-gateway-Dz9z17ME.js} +1 -1
  96. package/dist/client/assets/{use-list-state-CmxR0QRn.js → use-list-state-BhMQxwiZ.js} +1 -1
  97. package/dist/client/assets/{use-mcp-Cmlg9h6L.js → use-mcp-DgFeI4fa.js} +1 -1
  98. package/dist/client/assets/{use-members-Drex2zGi.js → use-members-Xa9kgxtY.js} +1 -1
  99. package/dist/client/assets/{use-mobile-B-R7B7Hp.js → use-mobile-oCggWXvr.js} +1 -1
  100. package/dist/client/assets/{use-organization-settings-B_G_DBCR.js → use-organization-settings-cNGS6Euq.js} +1 -1
  101. package/dist/client/assets/{use-tool-call-BN3WED_Z.js → use-tool-call-D3vebIRo.js} +1 -1
  102. package/dist/client/assets/useQuery-BvjuXhZf.js +1 -0
  103. package/dist/client/assets/{useSuspenseInfiniteQuery-DFaXtjFO.js → useSuspenseInfiniteQuery-DbaWYvOU.js} +1 -1
  104. package/dist/client/assets/{view-mode-toggle-BpRlpgBn.js → view-mode-toggle-CKl6PJqr.js} +1 -1
  105. package/dist/client/assets/{workflow-CBeu3WB4.js → workflow-Cx97hdFm.js} +1 -1
  106. package/dist/client/index.html +2 -2
  107. package/package.json +1 -1
  108. package/dist/client/assets/constants-CN4QOiqe.js +0 -1
  109. package/dist/client/assets/json-Bz08jZIq.js +0 -1
  110. package/dist/client/assets/prism-light-CHE2alug.js +0 -1
  111. package/dist/client/assets/useQuery-DLJrS2VC.js +0 -1
@@ -1,4 +1,4 @@
1
- import{r as C,z as Wn,j as h,B as Tn,E as rc,F as ue,H as sc,I as Or,J as ic,L as ac,M as cc,i as lc,c as se,Q as uc,f as ye,V as Zn}from"./index-DEMNtulg.js";import{u as nn,c as je,I as He,n as Gt}from"./use-connection-D-LWel3A.js";import{C as dc}from"./collection-header-od14k6u3.js";import{C as fc}from"./collection-page-BNuNM--s.js";import{E as Ye}from"./error-boundary-Ce0_dLsG.js";import{u as Te}from"./use-tool-call-BN3WED_Z.js";import{u as Se}from"./tooltip-C7B84lYF.js";import{c as on,B as An}from"./button-B13xcF6W.js";import{V as hc}from"./view-mode-toggle-BpRlpgBn.js";import{i as mc}from"./GitBranch01-CEvRlFly.js";import{s as Rr}from"./Plus-CwB-Rc8B.js";import{i as Hr}from"./CpuChip02-BtgBI59l.js";import{u as Vr}from"./use-gateway-eXp_1iQc.js";import{i as ze,a as ko,b as gc,c as Po,d as bn,e as _n,f as Br,s as Fr,D as Kn,g as Gr,h as pc,Z as Un,L as Qn,u as Xr,j as yc,k as xc,l as Dn,m as Yr,n as Jn,o as qr,p as Wr,q as Zr,r as vc,t as wc,v as bc,w as jo,x as _c,y as Kr,z as Ur,R as Sc,S as Nc,A as Ec,B as Qr,C as Cc,E as Mc,F as Ic,G as kc,H as Pc,I as jc,J as Jr,K as To,M as Tc,N as Ac,O as ct,P as Dc,Q as Lc,T as $c,U as zc,V as Oc,W as Rc,X as Hc,Y as Vc,_ as Bc,$ as Ae,a0 as Fc,a1 as Gc,a2 as rn}from"./types-BmKCUQAI.js";import{B as Xc}from"./badge-B-u7R38I.js";import"./collection-display-button-D4VM0KQx.js";import"./dropdown-menu-uXj8nKiT.js";import"./Grid01-CkwdbRed.js";import"./useQuery-DLJrS2VC.js";import"./index-DcMa5gDs.js";import"./popover-7jr0PuXV.js";import"./Copy01-DhXqtugg.js";import"./Key01-BXlD7hmS.js";import"./Play-FKw7EqPO.js";import"./json-syntax-highlighter-Bif-CDya.js";const es=({size:e=24,color:t="currentColor",...n})=>C.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},C.createElement("path",{d:"M18 20V10m-6 10V4M6 20v-6"}));es.displayName="BarChart01";const ts=({size:e=24,color:t="currentColor",...n})=>C.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},C.createElement("path",{d:"M5.52 2.64 3.96 4.72c-.309.412-.463.618-.46.79a.5.5 0 0 0 .192.384C3.828 6 4.085 6 4.6 6h14.8c.515 0 .773 0 .908-.106a.5.5 0 0 0 .192-.384c.003-.172-.151-.378-.46-.79l-1.56-2.08m-12.96 0c.176-.235.264-.352.376-.437a1 1 0 0 1 .33-.165C6.36 2 6.505 2 6.8 2h10.4c.293 0 .44 0 .575.038a1 1 0 0 1 .33.165c.111.085.199.202.375.437m-12.96 0L3.64 5.147c-.237.316-.356.475-.44.649a2 2 0 0 0-.163.487C3 6.473 3 6.671 3 7.067V18.8c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C4.52 22 5.08 22 6.2 22h11.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C21 20.48 21 19.92 21 18.8V7.067c0-.396 0-.594-.037-.784a1.998 1.998 0 0 0-.163-.487c-.084-.174-.203-.333-.44-.65L18.48 2.64M16 10a4 4 0 1 1-8 0"}));ts.displayName="ShoppingBag01";function De(){const e=new Date,t=new Date;t.setHours(e.getHours()-24),t.setSeconds(0,0);const n=new Date(e);return n.setHours(n.getHours()+1),n.setSeconds(0,0),{startDate:t.toISOString(),endDate:n.toISOString()}}var ns="Toggle",os=C.forwardRef((e,t)=>{const{pressed:n,defaultPressed:o,onPressedChange:r,...s}=e,[i,a]=Wn({prop:n,onChange:r,defaultProp:o??!1,caller:ns});return h.jsx(Tn.button,{type:"button","aria-pressed":i,"data-state":i?"on":"off","data-disabled":e.disabled?"":void 0,...s,ref:t,onClick:rc(e.onClick,()=>{e.disabled||a(!i)})})});os.displayName=ns;var Le="ToggleGroup",[rs]=sc(Le,[Or]),ss=Or(),eo=ue.forwardRef((e,t)=>{const{type:n,...o}=e;if(n==="single"){const r=o;return h.jsx(Yc,{...r,ref:t})}if(n==="multiple"){const r=o;return h.jsx(qc,{...r,ref:t})}throw new Error(`Missing prop \`type\` expected on \`${Le}\``)});eo.displayName=Le;var[is,as]=rs(Le),Yc=ue.forwardRef((e,t)=>{const{value:n,defaultValue:o,onValueChange:r=()=>{},...s}=e,[i,a]=Wn({prop:n,defaultProp:o??"",onChange:r,caller:Le});return h.jsx(is,{scope:e.__scopeToggleGroup,type:"single",value:ue.useMemo(()=>i?[i]:[],[i]),onItemActivate:a,onItemDeactivate:ue.useCallback(()=>a(""),[a]),children:h.jsx(cs,{...s,ref:t})})}),qc=ue.forwardRef((e,t)=>{const{value:n,defaultValue:o,onValueChange:r=()=>{},...s}=e,[i,a]=Wn({prop:n,defaultProp:o??[],onChange:r,caller:Le}),l=ue.useCallback(u=>a((d=[])=>[...d,u]),[a]),c=ue.useCallback(u=>a((d=[])=>d.filter(f=>f!==u)),[a]);return h.jsx(is,{scope:e.__scopeToggleGroup,type:"multiple",value:i,onItemActivate:l,onItemDeactivate:c,children:h.jsx(cs,{...s,ref:t})})});eo.displayName=Le;var[Wc,Zc]=rs(Le),cs=ue.forwardRef((e,t)=>{const{__scopeToggleGroup:n,disabled:o=!1,rovingFocus:r=!0,orientation:s,dir:i,loop:a=!0,...l}=e,c=ss(n),u=ac(i),d={role:"group",dir:u,...l};return h.jsx(Wc,{scope:n,rovingFocus:r,disabled:o,children:r?h.jsx(cc,{asChild:!0,...c,orientation:s,dir:u,loop:a,children:h.jsx(Tn.div,{...d,ref:t})}):h.jsx(Tn.div,{...d,ref:t})})}),Xt="ToggleGroupItem",ls=ue.forwardRef((e,t)=>{const n=as(Xt,e.__scopeToggleGroup),o=Zc(Xt,e.__scopeToggleGroup),r=ss(e.__scopeToggleGroup),s=n.value.includes(e.value),i=o.disabled||e.disabled,a={...e,pressed:s,disabled:i},l=ue.useRef(null);return o.rovingFocus?h.jsx(ic,{asChild:!0,...r,focusable:!i,active:s,ref:l,children:h.jsx(Ao,{...a,ref:t})}):h.jsx(Ao,{...a,ref:t})});ls.displayName=Xt;var Ao=ue.forwardRef((e,t)=>{const{__scopeToggleGroup:n,value:o,...r}=e,s=as(Xt,n),i={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},a=s.type==="single"?i:void 0;return h.jsx(os,{...a,...r,ref:t,onPressedChange:l=>{l?s.onItemActivate(o):s.onItemDeactivate(o)}})}),Kc=eo,Uc=ls;const Qc=lc("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-2 min-w-9",sm:"h-7 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}}),us=C.createContext({size:"default",variant:"default"});function ds(e){const t=se.c(20);let n,o,r,s,i;t[0]!==e?({className:o,variant:i,size:s,children:n,...r}=e,t[0]=e,t[1]=n,t[2]=o,t[3]=r,t[4]=s,t[5]=i):(n=t[1],o=t[2],r=t[3],s=t[4],i=t[5]);let a;t[6]!==o?(a=on("group/toggle-group flex w-fit items-center rounded-md data-[variant=outline]:shadow-xs",o),t[6]=o,t[7]=a):a=t[7];let l;t[8]!==s||t[9]!==i?(l={variant:i,size:s},t[8]=s,t[9]=i,t[10]=l):l=t[10];let c;t[11]!==n||t[12]!==l?(c=h.jsx(us.Provider,{value:l,children:n}),t[11]=n,t[12]=l,t[13]=c):c=t[13];let u;return t[14]!==r||t[15]!==s||t[16]!==a||t[17]!==c||t[18]!==i?(u=h.jsx(Kc,{"data-slot":"toggle-group","data-variant":i,"data-size":s,className:a,...r,children:c}),t[14]=r,t[15]=s,t[16]=a,t[17]=c,t[18]=i,t[19]=u):u=t[19],u}function Ze(e){const t=se.c(18);let n,o,r,s,i;t[0]!==e?({className:o,children:n,variant:i,size:s,...r}=e,t[0]=e,t[1]=n,t[2]=o,t[3]=r,t[4]=s,t[5]=i):(n=t[1],o=t[2],r=t[3],s=t[4],i=t[5]);const a=C.useContext(us),l=a.variant||i,c=a.size||s;let u;t[6]!==o||t[7]!==a.size||t[8]!==a.variant||t[9]!==s||t[10]!==i?(u=on(Qc({variant:a.variant||i,size:a.size||s}),"min-w-0 flex-1 shrink-0 rounded-none shadow-none first:rounded-l-md last:rounded-r-md focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0 data-[variant=outline]:first:border-l",o),t[6]=o,t[7]=a.size,t[8]=a.variant,t[9]=s,t[10]=i,t[11]=u):u=t[11];let d;return t[12]!==n||t[13]!==r||t[14]!==l||t[15]!==c||t[16]!==u?(d=h.jsx(Uc,{"data-slot":"toggle-group-item","data-variant":l,"data-size":c,className:u,...r,children:n}),t[12]=n,t[13]=r,t[14]=l,t[15]=c,t[16]=u,t[17]=d):d=t[17],d}function ie(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n<e.length;n++)(o=ie(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Jc={value:()=>{}};function sn(){for(var e=0,t=arguments.length,n={},o;e<t;++e){if(!(o=arguments[e]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new zt(n)}function zt(e){this._=e}function el(e,t){return e.trim().split(/^|\s+/).map(function(n){var o="",r=n.indexOf(".");if(r>=0&&(o=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}zt.prototype=sn.prototype={constructor:zt,on:function(e,t){var n=this._,o=el(e+"",n),r,s=-1,i=o.length;if(arguments.length<2){for(;++s<i;)if((r=(e=o[s]).type)&&(r=tl(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<i;)if(r=(e=o[s]).type)n[r]=Do(n[r],e.name,t);else if(t==null)for(r in n)n[r]=Do(n[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new zt(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,s;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],o=0,r=s.length;o<r;++o)s[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,s=o.length;r<s;++r)o[r].value.apply(t,n)}};function tl(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function Do(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=Jc,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var Ln="http://www.w3.org/1999/xhtml";const Lo={svg:"http://www.w3.org/2000/svg",xhtml:Ln,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function an(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Lo.hasOwnProperty(t)?{space:Lo[t],local:e}:e}function nl(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Ln&&t.documentElement.namespaceURI===Ln?t.createElement(e):t.createElementNS(n,e)}}function ol(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function fs(e){var t=an(e);return(t.local?ol:nl)(t)}function rl(){}function to(e){return e==null?rl:function(){return this.querySelector(e)}}function sl(e){typeof e!="function"&&(e=to(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=new Array(i),l,c,u=0;u<i;++u)(l=s[u])&&(c=e.call(l,l.__data__,u,s))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new le(o,this._parents)}function il(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function al(){return[]}function hs(e){return e==null?al:function(){return this.querySelectorAll(e)}}function cl(e){return function(){return il(e.apply(this,arguments))}}function ll(e){typeof e=="function"?e=cl(e):e=hs(e);for(var t=this._groups,n=t.length,o=[],r=[],s=0;s<n;++s)for(var i=t[s],a=i.length,l,c=0;c<a;++c)(l=i[c])&&(o.push(e.call(l,l.__data__,c,i)),r.push(l));return new le(o,r)}function ms(e){return function(){return this.matches(e)}}function gs(e){return function(t){return t.matches(e)}}var ul=Array.prototype.find;function dl(e){return function(){return ul.call(this.children,e)}}function fl(){return this.firstElementChild}function hl(e){return this.select(e==null?fl:dl(typeof e=="function"?e:gs(e)))}var ml=Array.prototype.filter;function gl(){return Array.from(this.children)}function pl(e){return function(){return ml.call(this.children,e)}}function yl(e){return this.selectAll(e==null?gl:pl(typeof e=="function"?e:gs(e)))}function xl(e){typeof e!="function"&&(e=ms(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=[],l,c=0;c<i;++c)(l=s[c])&&e.call(l,l.__data__,c,s)&&a.push(l);return new le(o,this._parents)}function ps(e){return new Array(e.length)}function vl(){return new le(this._enter||this._groups.map(ps),this._parents)}function Yt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Yt.prototype={constructor:Yt,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function wl(e){return function(){return e}}function bl(e,t,n,o,r,s){for(var i=0,a,l=t.length,c=s.length;i<c;++i)(a=t[i])?(a.__data__=s[i],o[i]=a):n[i]=new Yt(e,s[i]);for(;i<l;++i)(a=t[i])&&(r[i]=a)}function _l(e,t,n,o,r,s,i){var a,l,c=new Map,u=t.length,d=s.length,f=new Array(u),g;for(a=0;a<u;++a)(l=t[a])&&(f[a]=g=i.call(l,l.__data__,a,t)+"",c.has(g)?r[a]=l:c.set(g,l));for(a=0;a<d;++a)g=i.call(e,s[a],a,s)+"",(l=c.get(g))?(o[a]=l,l.__data__=s[a],c.delete(g)):n[a]=new Yt(e,s[a]);for(a=0;a<u;++a)(l=t[a])&&c.get(f[a])===l&&(r[a]=l)}function Sl(e){return e.__data__}function Nl(e,t){if(!arguments.length)return Array.from(this,Sl);var n=t?_l:bl,o=this._parents,r=this._groups;typeof e!="function"&&(e=wl(e));for(var s=r.length,i=new Array(s),a=new Array(s),l=new Array(s),c=0;c<s;++c){var u=o[c],d=r[c],f=d.length,g=El(e.call(u,u&&u.__data__,c,o)),m=g.length,y=a[c]=new Array(m),v=i[c]=new Array(m),x=l[c]=new Array(f);n(u,d,y,v,x,g,t);for(var _=0,p=0,w,M;_<m;++_)if(w=y[_]){for(_>=p&&(p=_+1);!(M=v[p])&&++p<m;);w._next=M||null}}return i=new le(i,o),i._enter=a,i._exit=l,i}function El(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Cl(){return new le(this._exit||this._groups.map(ps),this._parents)}function Ml(e,t,n){var o=this.enter(),r=this,s=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?s.remove():n(s),o&&r?o.merge(r).order():r}function Il(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,s=o.length,i=Math.min(r,s),a=new Array(r),l=0;l<i;++l)for(var c=n[l],u=o[l],d=c.length,f=a[l]=new Array(d),g,m=0;m<d;++m)(g=c[m]||u[m])&&(f[m]=g);for(;l<r;++l)a[l]=n[l];return new le(a,this._parents)}function kl(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,s=o[r],i;--r>=0;)(i=o[r])&&(s&&i.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(i,s),s=i);return this}function Pl(e){e||(e=jl);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,o=n.length,r=new Array(o),s=0;s<o;++s){for(var i=n[s],a=i.length,l=r[s]=new Array(a),c,u=0;u<a;++u)(c=i[u])&&(l[u]=c);l.sort(t)}return new le(r,this._parents).order()}function jl(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Tl(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Al(){return Array.from(this)}function Dl(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,s=o.length;r<s;++r){var i=o[r];if(i)return i}return null}function Ll(){let e=0;for(const t of this)++e;return e}function $l(){return!this.node()}function zl(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],s=0,i=r.length,a;s<i;++s)(a=r[s])&&e.call(a,a.__data__,s,r);return this}function Ol(e){return function(){this.removeAttribute(e)}}function Rl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Hl(e,t){return function(){this.setAttribute(e,t)}}function Vl(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Bl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Fl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Gl(e,t){var n=an(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?Rl:Ol:typeof t=="function"?n.local?Fl:Bl:n.local?Vl:Hl)(n,t))}function ys(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Xl(e){return function(){this.style.removeProperty(e)}}function Yl(e,t,n){return function(){this.style.setProperty(e,t,n)}}function ql(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Wl(e,t,n){return arguments.length>1?this.each((t==null?Xl:typeof t=="function"?ql:Yl)(e,t,n??"")):Ue(this.node(),e)}function Ue(e,t){return e.style.getPropertyValue(t)||ys(e).getComputedStyle(e,null).getPropertyValue(t)}function Zl(e){return function(){delete this[e]}}function Kl(e,t){return function(){this[e]=t}}function Ul(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Ql(e,t){return arguments.length>1?this.each((t==null?Zl:typeof t=="function"?Ul:Kl)(e,t)):this.node()[e]}function xs(e){return e.trim().split(/^|\s+/)}function no(e){return e.classList||new vs(e)}function vs(e){this._node=e,this._names=xs(e.getAttribute("class")||"")}vs.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function ws(e,t){for(var n=no(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function bs(e,t){for(var n=no(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function Jl(e){return function(){ws(this,e)}}function eu(e){return function(){bs(this,e)}}function tu(e,t){return function(){(t.apply(this,arguments)?ws:bs)(this,e)}}function nu(e,t){var n=xs(e+"");if(arguments.length<2){for(var o=no(this.node()),r=-1,s=n.length;++r<s;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?tu:t?Jl:eu)(n,t))}function ou(){this.textContent=""}function ru(e){return function(){this.textContent=e}}function su(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function iu(e){return arguments.length?this.each(e==null?ou:(typeof e=="function"?su:ru)(e)):this.node().textContent}function au(){this.innerHTML=""}function cu(e){return function(){this.innerHTML=e}}function lu(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function uu(e){return arguments.length?this.each(e==null?au:(typeof e=="function"?lu:cu)(e)):this.node().innerHTML}function du(){this.nextSibling&&this.parentNode.appendChild(this)}function fu(){return this.each(du)}function hu(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function mu(){return this.each(hu)}function gu(e){var t=typeof e=="function"?e:fs(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function pu(){return null}function yu(e,t){var n=typeof e=="function"?e:fs(e),o=t==null?pu:typeof t=="function"?t:to(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function xu(){var e=this.parentNode;e&&e.removeChild(this)}function vu(){return this.each(xu)}function wu(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function bu(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function _u(e){return this.select(e?bu:wu)}function Su(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Nu(e){return function(t){e.call(this,t,this.__data__)}}function Eu(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function Cu(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,s;n<r;++n)s=t[n],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++o]=s;++o?t.length=o:delete this.__on}}}function Mu(e,t,n){return function(){var o=this.__on,r,s=Nu(t);if(o){for(var i=0,a=o.length;i<a;++i)if((r=o[i]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=s,r.options=n),r.value=t;return}}this.addEventListener(e.type,s,n),r={type:e.type,name:e.name,value:t,listener:s,options:n},o?o.push(r):this.__on=[r]}}function Iu(e,t,n){var o=Eu(e+""),r,s=o.length,i;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(r=0,u=a[l];r<s;++r)if((i=o[r]).type===u.type&&i.name===u.name)return u.value}return}for(a=t?Mu:Cu,r=0;r<s;++r)this.each(a(o[r],t,n));return this}function _s(e,t,n){var o=ys(e),r=o.CustomEvent;typeof r=="function"?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function ku(e,t){return function(){return _s(this,e,t)}}function Pu(e,t){return function(){return _s(this,e,t.apply(this,arguments))}}function ju(e,t){return this.each((typeof t=="function"?Pu:ku)(e,t))}function*Tu(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,s=o.length,i;r<s;++r)(i=o[r])&&(yield i)}var Ss=[null];function le(e,t){this._groups=e,this._parents=t}function St(){return new le([[document.documentElement]],Ss)}function Au(){return this}le.prototype=St.prototype={constructor:le,select:sl,selectAll:ll,selectChild:hl,selectChildren:yl,filter:xl,data:Nl,enter:vl,exit:Cl,join:Ml,merge:Il,selection:Au,order:kl,sort:Pl,call:Tl,nodes:Al,node:Dl,size:Ll,empty:$l,each:zl,attr:Gl,style:Wl,property:Ql,classed:nu,text:iu,html:uu,raise:fu,lower:mu,append:gu,insert:yu,remove:vu,clone:_u,datum:Su,on:Iu,dispatch:ju,[Symbol.iterator]:Tu};function ce(e){return typeof e=="string"?new le([[document.querySelector(e)]],[document.documentElement]):new le([[e]],Ss)}function Du(e){let t;for(;t=e.sourceEvent;)e=t;return e}function de(e,t){if(e=Du(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}const Lu={passive:!1},gt={capture:!0,passive:!1};function Sn(e){e.stopImmediatePropagation()}function Ke(e){e.preventDefault(),e.stopImmediatePropagation()}function Ns(e){var t=e.document.documentElement,n=ce(e).on("dragstart.drag",Ke,gt);"onselectstart"in t?n.on("selectstart.drag",Ke,gt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Es(e,t){var n=e.document.documentElement,o=ce(e).on("dragstart.drag",null);t&&(o.on("click.drag",Ke,gt),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const kt=e=>()=>e;function $n(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:s,x:i,y:a,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}$n.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function $u(e){return!e.ctrlKey&&!e.button}function zu(){return this.parentNode}function Ou(e,t){return t??{x:e.x,y:e.y}}function Ru(){return navigator.maxTouchPoints||"ontouchstart"in this}function Cs(){var e=$u,t=zu,n=Ou,o=Ru,r={},s=sn("start","drag","end"),i=0,a,l,c,u,d=0;function f(w){w.on("mousedown.drag",g).filter(o).on("touchstart.drag",v).on("touchmove.drag",x,Lu).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(w,M){if(!(u||!e.call(this,w,M))){var S=p(this,t.call(this,w,M),w,M,"mouse");S&&(ce(w.view).on("mousemove.drag",m,gt).on("mouseup.drag",y,gt),Ns(w.view),Sn(w),c=!1,a=w.clientX,l=w.clientY,S("start",w))}}function m(w){if(Ke(w),!c){var M=w.clientX-a,S=w.clientY-l;c=M*M+S*S>d}r.mouse("drag",w)}function y(w){ce(w.view).on("mousemove.drag mouseup.drag",null),Es(w.view,c),Ke(w),r.mouse("end",w)}function v(w,M){if(e.call(this,w,M)){var S=w.changedTouches,N=t.call(this,w,M),D=S.length,T,z;for(T=0;T<D;++T)(z=p(this,N,w,M,S[T].identifier,S[T]))&&(Sn(w),z("start",w,S[T]))}}function x(w){var M=w.changedTouches,S=M.length,N,D;for(N=0;N<S;++N)(D=r[M[N].identifier])&&(Ke(w),D("drag",w,M[N]))}function _(w){var M=w.changedTouches,S=M.length,N,D;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),N=0;N<S;++N)(D=r[M[N].identifier])&&(Sn(w),D("end",w,M[N]))}function p(w,M,S,N,D,T){var z=s.copy(),E=de(T||S,M),L,$,b;if((b=n.call(w,new $n("beforestart",{sourceEvent:S,target:f,identifier:D,active:i,x:E[0],y:E[1],dx:0,dy:0,dispatch:z}),N))!=null)return L=b.x-E[0]||0,$=b.y-E[1]||0,function k(I,A,P){var j=E,O;switch(I){case"start":r[D]=k,O=i++;break;case"end":delete r[D],--i;case"drag":E=de(P||A,M),O=i;break}z.call(I,w,new $n(I,{sourceEvent:A,subject:b,target:f,identifier:D,active:O,x:E[0]+L,y:E[1]+$,dx:E[0]-j[0],dy:E[1]-j[1],dispatch:z}),N)}}return f.filter=function(w){return arguments.length?(e=typeof w=="function"?w:kt(!!w),f):e},f.container=function(w){return arguments.length?(t=typeof w=="function"?w:kt(w),f):t},f.subject=function(w){return arguments.length?(n=typeof w=="function"?w:kt(w),f):n},f.touchable=function(w){return arguments.length?(o=typeof w=="function"?w:kt(!!w),f):o},f.on=function(){var w=s.on.apply(s,arguments);return w===s?f:w},f.clickDistance=function(w){return arguments.length?(d=(w=+w)*w,f):Math.sqrt(d)},f}var $o=180/Math.PI,zn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ms(e,t,n,o,r,s){var i,a,l;return(i=Math.sqrt(e*e+t*t))&&(e/=i,t/=i),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,l/=a),e*o<t*n&&(e=-e,t=-t,l=-l,i=-i),{translateX:r,translateY:s,rotate:Math.atan2(t,e)*$o,skewX:Math.atan(l)*$o,scaleX:i,scaleY:a}}var Pt;function Hu(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?zn:Ms(t.a,t.b,t.c,t.d,t.e,t.f)}function Vu(e){return e==null||(Pt||(Pt=document.createElementNS("http://www.w3.org/2000/svg","g")),Pt.setAttribute("transform",e),!(e=Pt.transform.baseVal.consolidate()))?zn:(e=e.matrix,Ms(e.a,e.b,e.c,e.d,e.e,e.f))}function Is(e,t,n,o){function r(c){return c.length?c.pop()+" ":""}function s(c,u,d,f,g,m){if(c!==d||u!==f){var y=g.push("translate(",null,t,null,n);m.push({i:y-4,x:ze(c,d)},{i:y-2,x:ze(u,f)})}else(d||f)&&g.push("translate("+d+t+f+n)}function i(c,u,d,f){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),f.push({i:d.push(r(d)+"rotate(",null,o)-2,x:ze(c,u)})):u&&d.push(r(d)+"rotate("+u+o)}function a(c,u,d,f){c!==u?f.push({i:d.push(r(d)+"skewX(",null,o)-2,x:ze(c,u)}):u&&d.push(r(d)+"skewX("+u+o)}function l(c,u,d,f,g,m){if(c!==d||u!==f){var y=g.push(r(g)+"scale(",null,",",null,")");m.push({i:y-4,x:ze(c,d)},{i:y-2,x:ze(u,f)})}else(d!==1||f!==1)&&g.push(r(g)+"scale("+d+","+f+")")}return function(c,u){var d=[],f=[];return c=e(c),u=e(u),s(c.translateX,c.translateY,u.translateX,u.translateY,d,f),i(c.rotate,u.rotate,d,f),a(c.skewX,u.skewX,d,f),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,d,f),c=u=null,function(g){for(var m=-1,y=f.length,v;++m<y;)d[(v=f[m]).i]=v.x(g);return d.join("")}}}var Bu=Is(Hu,"px, ","px)","deg)"),Fu=Is(Vu,", ",")",")"),Gu=1e-12;function zo(e){return((e=Math.exp(e))+1/e)/2}function Xu(e){return((e=Math.exp(e))-1/e)/2}function Yu(e){return((e=Math.exp(2*e))-1)/(e+1)}const Ot=(function e(t,n,o){function r(s,i){var a=s[0],l=s[1],c=s[2],u=i[0],d=i[1],f=i[2],g=u-a,m=d-l,y=g*g+m*m,v,x;if(y<Gu)x=Math.log(f/c)/t,v=function(N){return[a+N*g,l+N*m,c*Math.exp(t*N*x)]};else{var _=Math.sqrt(y),p=(f*f-c*c+o*y)/(2*c*n*_),w=(f*f-c*c-o*y)/(2*f*n*_),M=Math.log(Math.sqrt(p*p+1)-p),S=Math.log(Math.sqrt(w*w+1)-w);x=(S-M)/t,v=function(N){var D=N*x,T=zo(M),z=c/(n*_)*(T*Yu(t*D+M)-Xu(M));return[a+z*g,l+z*m,c*T/zo(t*D+M)]}}return v.duration=x*1e3*t/Math.SQRT2,v}return r.rho=function(s){var i=Math.max(.001,+s),a=i*i,l=a*a;return e(i,a,l)},r})(Math.SQRT2,2,4);var Qe=0,dt=0,lt=0,ks=1e3,qt,ft,Wt=0,Ve=0,cn=0,pt=typeof performance=="object"&&performance.now?performance:Date,Ps=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function oo(){return Ve||(Ps(qu),Ve=pt.now()+cn)}function qu(){Ve=0}function Zt(){this._call=this._time=this._next=null}Zt.prototype=js.prototype={constructor:Zt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?oo():+n)+(t==null?0:+t),!this._next&&ft!==this&&(ft?ft._next=this:qt=this,ft=this),this._call=e,this._time=n,On()},stop:function(){this._call&&(this._call=null,this._time=1/0,On())}};function js(e,t,n){var o=new Zt;return o.restart(e,t,n),o}function Wu(){oo(),++Qe;for(var e=qt,t;e;)(t=Ve-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Qe}function Oo(){Ve=(Wt=pt.now())+cn,Qe=dt=0;try{Wu()}finally{Qe=0,Ku(),Ve=0}}function Zu(){var e=pt.now(),t=e-Wt;t>ks&&(cn-=t,Wt=e)}function Ku(){for(var e,t=qt,n,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:qt=n);ft=e,On(o)}function On(e){if(!Qe){dt&&(dt=clearTimeout(dt));var t=e-Ve;t>24?(e<1/0&&(dt=setTimeout(Oo,e-pt.now()-cn)),lt&&(lt=clearInterval(lt))):(lt||(Wt=pt.now(),lt=setInterval(Zu,ks)),Qe=1,Ps(Oo))}}function Ro(e,t,n){var o=new Zt;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var Uu=sn("start","end","cancel","interrupt"),Qu=[],Ts=0,Ho=1,Rn=2,Rt=3,Vo=4,Hn=5,Ht=6;function ln(e,t,n,o,r,s){var i=e.__transition;if(!i)e.__transition={};else if(n in i)return;Ju(e,n,{name:t,index:o,group:r,on:Uu,tween:Qu,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Ts})}function ro(e,t){var n=me(e,t);if(n.state>Ts)throw new Error("too late; already scheduled");return n}function xe(e,t){var n=me(e,t);if(n.state>Rt)throw new Error("too late; already running");return n}function me(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Ju(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=js(s,0,n.time);function s(c){n.state=Ho,n.timer.restart(i,n.delay,n.time),n.delay<=c&&i(c-n.delay)}function i(c){var u,d,f,g;if(n.state!==Ho)return l();for(u in o)if(g=o[u],g.name===n.name){if(g.state===Rt)return Ro(i);g.state===Vo?(g.state=Ht,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete o[u]):+u<t&&(g.state=Ht,g.timer.stop(),g.on.call("cancel",e,e.__data__,g.index,g.group),delete o[u])}if(Ro(function(){n.state===Rt&&(n.state=Vo,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=Rn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Rn){for(n.state=Rt,r=new Array(f=n.tween.length),u=0,d=-1;u<f;++u)(g=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++d]=g);r.length=d+1}}function a(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=Hn,1),d=-1,f=r.length;++d<f;)r[d].call(e,u);n.state===Hn&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=Ht,n.timer.stop(),delete o[t];for(var c in o)return;delete e.__transition}}function Vt(e,t){var n=e.__transition,o,r,s=!0,i;if(n){t=t==null?null:t+"";for(i in n){if((o=n[i]).name!==t){s=!1;continue}r=o.state>Rn&&o.state<Hn,o.state=Ht,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[i]}s&&delete e.__transition}}function ed(e){return this.each(function(){Vt(this,e)})}function td(e,t){var n,o;return function(){var r=xe(this,e),s=r.tween;if(s!==n){o=n=s;for(var i=0,a=o.length;i<a;++i)if(o[i].name===t){o=o.slice(),o.splice(i,1);break}}r.tween=o}}function nd(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var s=xe(this,e),i=s.tween;if(i!==o){r=(o=i).slice();for(var a={name:t,value:n},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=a;break}l===c&&r.push(a)}s.tween=r}}function od(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=me(this.node(),n).tween,r=0,s=o.length,i;r<s;++r)if((i=o[r]).name===e)return i.value;return null}return this.each((t==null?td:nd)(n,e,t))}function so(e,t,n){var o=e._id;return e.each(function(){var r=xe(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return me(r,o).value[t]}}function As(e,t){var n;return(typeof t=="number"?ze:t instanceof Po?ko:(n=Po(t))?(t=n,ko):gc)(e,t)}function rd(e){return function(){this.removeAttribute(e)}}function sd(e){return function(){this.removeAttributeNS(e.space,e.local)}}function id(e,t,n){var o,r=n+"",s;return function(){var i=this.getAttribute(e);return i===r?null:i===o?s:s=t(o=i,n)}}function ad(e,t,n){var o,r=n+"",s;return function(){var i=this.getAttributeNS(e.space,e.local);return i===r?null:i===o?s:s=t(o=i,n)}}function cd(e,t,n){var o,r,s;return function(){var i,a=n(this),l;return a==null?void this.removeAttribute(e):(i=this.getAttribute(e),l=a+"",i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a)))}}function ld(e,t,n){var o,r,s;return function(){var i,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(i=this.getAttributeNS(e.space,e.local),l=a+"",i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a)))}}function ud(e,t){var n=an(e),o=n==="transform"?Fu:As;return this.attrTween(e,typeof t=="function"?(n.local?ld:cd)(n,o,so(this,"attr."+e,t)):t==null?(n.local?sd:rd)(n):(n.local?ad:id)(n,o,t))}function dd(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function fd(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function hd(e,t){var n,o;function r(){var s=t.apply(this,arguments);return s!==o&&(n=(o=s)&&fd(e,s)),n}return r._value=t,r}function md(e,t){var n,o;function r(){var s=t.apply(this,arguments);return s!==o&&(n=(o=s)&&dd(e,s)),n}return r._value=t,r}function gd(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var o=an(e);return this.tween(n,(o.local?hd:md)(o,t))}function pd(e,t){return function(){ro(this,e).delay=+t.apply(this,arguments)}}function yd(e,t){return t=+t,function(){ro(this,e).delay=t}}function xd(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?pd:yd)(t,e)):me(this.node(),t).delay}function vd(e,t){return function(){xe(this,e).duration=+t.apply(this,arguments)}}function wd(e,t){return t=+t,function(){xe(this,e).duration=t}}function bd(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?vd:wd)(t,e)):me(this.node(),t).duration}function _d(e,t){if(typeof t!="function")throw new Error;return function(){xe(this,e).ease=t}}function Sd(e){var t=this._id;return arguments.length?this.each(_d(t,e)):me(this.node(),t).ease}function Nd(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;xe(this,e).ease=n}}function Ed(e){if(typeof e!="function")throw new Error;return this.each(Nd(this._id,e))}function Cd(e){typeof e!="function"&&(e=ms(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=[],l,c=0;c<i;++c)(l=s[c])&&e.call(l,l.__data__,c,s)&&a.push(l);return new _e(o,this._parents,this._name,this._id)}function Md(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,s=Math.min(o,r),i=new Array(o),a=0;a<s;++a)for(var l=t[a],c=n[a],u=l.length,d=i[a]=new Array(u),f,g=0;g<u;++g)(f=l[g]||c[g])&&(d[g]=f);for(;a<o;++a)i[a]=t[a];return new _e(i,this._parents,this._name,this._id)}function Id(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function kd(e,t,n){var o,r,s=Id(t)?ro:xe;return function(){var i=s(this,e),a=i.on;a!==o&&(r=(o=a).copy()).on(t,n),i.on=r}}function Pd(e,t){var n=this._id;return arguments.length<2?me(this.node(),n).on.on(e):this.each(kd(n,e,t))}function jd(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Td(){return this.on("end.remove",jd(this._id))}function Ad(e){var t=this._name,n=this._id;typeof e!="function"&&(e=to(e));for(var o=this._groups,r=o.length,s=new Array(r),i=0;i<r;++i)for(var a=o[i],l=a.length,c=s[i]=new Array(l),u,d,f=0;f<l;++f)(u=a[f])&&(d=e.call(u,u.__data__,f,a))&&("__data__"in u&&(d.__data__=u.__data__),c[f]=d,ln(c[f],t,n,f,c,me(u,n)));return new _e(s,this._parents,t,n)}function Dd(e){var t=this._name,n=this._id;typeof e!="function"&&(e=hs(e));for(var o=this._groups,r=o.length,s=[],i=[],a=0;a<r;++a)for(var l=o[a],c=l.length,u,d=0;d<c;++d)if(u=l[d]){for(var f=e.call(u,u.__data__,d,l),g,m=me(u,n),y=0,v=f.length;y<v;++y)(g=f[y])&&ln(g,t,n,y,f,m);s.push(f),i.push(u)}return new _e(s,i,t,n)}var Ld=St.prototype.constructor;function $d(){return new Ld(this._groups,this._parents)}function zd(e,t){var n,o,r;return function(){var s=Ue(this,e),i=(this.style.removeProperty(e),Ue(this,e));return s===i?null:s===n&&i===o?r:r=t(n=s,o=i)}}function Ds(e){return function(){this.style.removeProperty(e)}}function Od(e,t,n){var o,r=n+"",s;return function(){var i=Ue(this,e);return i===r?null:i===o?s:s=t(o=i,n)}}function Rd(e,t,n){var o,r,s;return function(){var i=Ue(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),Ue(this,e))),i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a))}}function Hd(e,t){var n,o,r,s="style."+t,i="end."+s,a;return function(){var l=xe(this,e),c=l.on,u=l.value[s]==null?a||(a=Ds(t)):void 0;(c!==n||r!==u)&&(o=(n=c).copy()).on(i,r=u),l.on=o}}function Vd(e,t,n){var o=(e+="")=="transform"?Bu:As;return t==null?this.styleTween(e,zd(e,o)).on("end.style."+e,Ds(e)):typeof t=="function"?this.styleTween(e,Rd(e,o,so(this,"style."+e,t))).each(Hd(this._id,e)):this.styleTween(e,Od(e,o,t),n).on("end.style."+e,null)}function Bd(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function Fd(e,t,n){var o,r;function s(){var i=t.apply(this,arguments);return i!==r&&(o=(r=i)&&Bd(e,i,n)),o}return s._value=t,s}function Gd(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,Fd(e,t,n??""))}function Xd(e){return function(){this.textContent=e}}function Yd(e){return function(){var t=e(this);this.textContent=t??""}}function qd(e){return this.tween("text",typeof e=="function"?Yd(so(this,"text",e)):Xd(e==null?"":e+""))}function Wd(e){return function(t){this.textContent=e.call(this,t)}}function Zd(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Wd(r)),t}return o._value=e,o}function Kd(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,Zd(e))}function Ud(){for(var e=this._name,t=this._id,n=Ls(),o=this._groups,r=o.length,s=0;s<r;++s)for(var i=o[s],a=i.length,l,c=0;c<a;++c)if(l=i[c]){var u=me(l,t);ln(l,e,n,c,i,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new _e(o,this._parents,e,n)}function Qd(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(s,i){var a={value:i},l={value:function(){--r===0&&s()}};n.each(function(){var c=xe(this,o),u=c.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),r===0&&s()})}var Jd=0;function _e(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Ls(){return++Jd}var we=St.prototype;_e.prototype={constructor:_e,select:Ad,selectAll:Dd,selectChild:we.selectChild,selectChildren:we.selectChildren,filter:Cd,merge:Md,selection:$d,transition:Ud,call:we.call,nodes:we.nodes,node:we.node,size:we.size,empty:we.empty,each:we.each,on:Pd,attr:ud,attrTween:gd,style:Vd,styleTween:Gd,text:qd,textTween:Kd,remove:Td,tween:od,delay:xd,duration:bd,ease:Sd,easeVarying:Ed,end:Qd,[Symbol.iterator]:we[Symbol.iterator]};function ef(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var tf={time:null,delay:0,duration:250,ease:ef};function nf(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function of(e){var t,n;e instanceof _e?(t=e._id,e=e._name):(t=Ls(),(n=tf).time=oo(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,s=0;s<r;++s)for(var i=o[s],a=i.length,l,c=0;c<a;++c)(l=i[c])&&ln(l,e,t,c,i,n||nf(l,t));return new _e(o,this._parents,e,t)}St.prototype.interrupt=ed;St.prototype.transition=of;const jt=e=>()=>e;function rf(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function be(e,t,n){this.k=e,this.x=t,this.y=n}be.prototype={constructor:be,scale:function(e){return e===1?this:new be(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new be(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var un=new be(1,0,0);$s.prototype=be.prototype;function $s(e){for(;!e.__zoom;)if(!(e=e.parentNode))return un;return e.__zoom}function Nn(e){e.stopImmediatePropagation()}function ut(e){e.preventDefault(),e.stopImmediatePropagation()}function sf(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function af(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Bo(){return this.__zoom||un}function cf(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function lf(){return navigator.maxTouchPoints||"ontouchstart"in this}function uf(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],i=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i))}function zs(){var e=sf,t=af,n=uf,o=cf,r=lf,s=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Ot,c=sn("start","zoom","end"),u,d,f,g=500,m=150,y=0,v=10;function x(b){b.property("__zoom",Bo).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",z).filter(r).on("touchstart.zoom",E).on("touchmove.zoom",L).on("touchend.zoom touchcancel.zoom",$).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}x.transform=function(b,k,I,A){var P=b.selection?b.selection():b;P.property("__zoom",Bo),b!==P?M(b,k,I,A):P.interrupt().each(function(){S(this,arguments).event(A).start().zoom(null,typeof k=="function"?k.apply(this,arguments):k).end()})},x.scaleBy=function(b,k,I,A){x.scaleTo(b,function(){var P=this.__zoom.k,j=typeof k=="function"?k.apply(this,arguments):k;return P*j},I,A)},x.scaleTo=function(b,k,I,A){x.transform(b,function(){var P=t.apply(this,arguments),j=this.__zoom,O=I==null?w(P):typeof I=="function"?I.apply(this,arguments):I,H=j.invert(O),R=typeof k=="function"?k.apply(this,arguments):k;return n(p(_(j,R),O,H),P,i)},I,A)},x.translateBy=function(b,k,I,A){x.transform(b,function(){return n(this.__zoom.translate(typeof k=="function"?k.apply(this,arguments):k,typeof I=="function"?I.apply(this,arguments):I),t.apply(this,arguments),i)},null,A)},x.translateTo=function(b,k,I,A,P){x.transform(b,function(){var j=t.apply(this,arguments),O=this.__zoom,H=A==null?w(j):typeof A=="function"?A.apply(this,arguments):A;return n(un.translate(H[0],H[1]).scale(O.k).translate(typeof k=="function"?-k.apply(this,arguments):-k,typeof I=="function"?-I.apply(this,arguments):-I),j,i)},A,P)};function _(b,k){return k=Math.max(s[0],Math.min(s[1],k)),k===b.k?b:new be(k,b.x,b.y)}function p(b,k,I){var A=k[0]-I[0]*b.k,P=k[1]-I[1]*b.k;return A===b.x&&P===b.y?b:new be(b.k,A,P)}function w(b){return[(+b[0][0]+ +b[1][0])/2,(+b[0][1]+ +b[1][1])/2]}function M(b,k,I,A){b.on("start.zoom",function(){S(this,arguments).event(A).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(A).end()}).tween("zoom",function(){var P=this,j=arguments,O=S(P,j).event(A),H=t.apply(P,j),R=I==null?w(H):typeof I=="function"?I.apply(P,j):I,F=Math.max(H[1][0]-H[0][0],H[1][1]-H[0][1]),B=P.__zoom,q=typeof k=="function"?k.apply(P,j):k,K=l(B.invert(R).concat(F/B.k),q.invert(R).concat(F/q.k));return function(Y){if(Y===1)Y=q;else{var V=K(Y),X=F/V[2];Y=new be(X,R[0]-V[0]*X,R[1]-V[1]*X)}O.zoom(null,Y)}})}function S(b,k,I){return!I&&b.__zooming||new N(b,k)}function N(b,k){this.that=b,this.args=k,this.active=0,this.sourceEvent=null,this.extent=t.apply(b,k),this.taps=0}N.prototype={event:function(b){return b&&(this.sourceEvent=b),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(b,k){return this.mouse&&b!=="mouse"&&(this.mouse[1]=k.invert(this.mouse[0])),this.touch0&&b!=="touch"&&(this.touch0[1]=k.invert(this.touch0[0])),this.touch1&&b!=="touch"&&(this.touch1[1]=k.invert(this.touch1[0])),this.that.__zoom=k,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(b){var k=ce(this.that).datum();c.call(b,this.that,new rf(b,{sourceEvent:this.sourceEvent,target:x,transform:this.that.__zoom,dispatch:c}),k)}};function D(b,...k){if(!e.apply(this,arguments))return;var I=S(this,k).event(b),A=this.__zoom,P=Math.max(s[0],Math.min(s[1],A.k*Math.pow(2,o.apply(this,arguments)))),j=de(b);if(I.wheel)(I.mouse[0][0]!==j[0]||I.mouse[0][1]!==j[1])&&(I.mouse[1]=A.invert(I.mouse[0]=j)),clearTimeout(I.wheel);else{if(A.k===P)return;I.mouse=[j,A.invert(j)],Vt(this),I.start()}ut(b),I.wheel=setTimeout(O,m),I.zoom("mouse",n(p(_(A,P),I.mouse[0],I.mouse[1]),I.extent,i));function O(){I.wheel=null,I.end()}}function T(b,...k){if(f||!e.apply(this,arguments))return;var I=b.currentTarget,A=S(this,k,!0).event(b),P=ce(b.view).on("mousemove.zoom",R,!0).on("mouseup.zoom",F,!0),j=de(b,I),O=b.clientX,H=b.clientY;Ns(b.view),Nn(b),A.mouse=[j,this.__zoom.invert(j)],Vt(this),A.start();function R(B){if(ut(B),!A.moved){var q=B.clientX-O,K=B.clientY-H;A.moved=q*q+K*K>y}A.event(B).zoom("mouse",n(p(A.that.__zoom,A.mouse[0]=de(B,I),A.mouse[1]),A.extent,i))}function F(B){P.on("mousemove.zoom mouseup.zoom",null),Es(B.view,A.moved),ut(B),A.event(B).end()}}function z(b,...k){if(e.apply(this,arguments)){var I=this.__zoom,A=de(b.changedTouches?b.changedTouches[0]:b,this),P=I.invert(A),j=I.k*(b.shiftKey?.5:2),O=n(p(_(I,j),A,P),t.apply(this,k),i);ut(b),a>0?ce(this).transition().duration(a).call(M,O,A,b):ce(this).call(x.transform,O,A,b)}}function E(b,...k){if(e.apply(this,arguments)){var I=b.touches,A=I.length,P=S(this,k,b.changedTouches.length===A).event(b),j,O,H,R;for(Nn(b),O=0;O<A;++O)H=I[O],R=de(H,this),R=[R,this.__zoom.invert(R),H.identifier],P.touch0?!P.touch1&&P.touch0[2]!==R[2]&&(P.touch1=R,P.taps=0):(P.touch0=R,j=!0,P.taps=1+!!u);u&&(u=clearTimeout(u)),j&&(P.taps<2&&(d=R[0],u=setTimeout(function(){u=null},g)),Vt(this),P.start())}}function L(b,...k){if(this.__zooming){var I=S(this,k).event(b),A=b.changedTouches,P=A.length,j,O,H,R;for(ut(b),j=0;j<P;++j)O=A[j],H=de(O,this),I.touch0&&I.touch0[2]===O.identifier?I.touch0[0]=H:I.touch1&&I.touch1[2]===O.identifier&&(I.touch1[0]=H);if(O=I.that.__zoom,I.touch1){var F=I.touch0[0],B=I.touch0[1],q=I.touch1[0],K=I.touch1[1],Y=(Y=q[0]-F[0])*Y+(Y=q[1]-F[1])*Y,V=(V=K[0]-B[0])*V+(V=K[1]-B[1])*V;O=_(O,Math.sqrt(Y/V)),H=[(F[0]+q[0])/2,(F[1]+q[1])/2],R=[(B[0]+K[0])/2,(B[1]+K[1])/2]}else if(I.touch0)H=I.touch0[0],R=I.touch0[1];else return;I.zoom("touch",n(p(O,H,R),I.extent,i))}}function $(b,...k){if(this.__zooming){var I=S(this,k).event(b),A=b.changedTouches,P=A.length,j,O;for(Nn(b),f&&clearTimeout(f),f=setTimeout(function(){f=null},g),j=0;j<P;++j)O=A[j],I.touch0&&I.touch0[2]===O.identifier?delete I.touch0:I.touch1&&I.touch1[2]===O.identifier&&delete I.touch1;if(I.touch1&&!I.touch0&&(I.touch0=I.touch1,delete I.touch1),I.touch0)I.touch0[1]=this.__zoom.invert(I.touch0[0]);else if(I.end(),I.taps===2&&(O=de(O,this),Math.hypot(d[0]-O[0],d[1]-O[1])<v)){var H=ce(this).on("dblclick.zoom");H&&H.apply(this,arguments)}}}return x.wheelDelta=function(b){return arguments.length?(o=typeof b=="function"?b:jt(+b),x):o},x.filter=function(b){return arguments.length?(e=typeof b=="function"?b:jt(!!b),x):e},x.touchable=function(b){return arguments.length?(r=typeof b=="function"?b:jt(!!b),x):r},x.extent=function(b){return arguments.length?(t=typeof b=="function"?b:jt([[+b[0][0],+b[0][1]],[+b[1][0],+b[1][1]]]),x):t},x.scaleExtent=function(b){return arguments.length?(s[0]=+b[0],s[1]=+b[1],x):[s[0],s[1]]},x.translateExtent=function(b){return arguments.length?(i[0][0]=+b[0][0],i[1][0]=+b[1][0],i[0][1]=+b[0][1],i[1][1]=+b[1][1],x):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},x.constrain=function(b){return arguments.length?(n=b,x):n},x.duration=function(b){return arguments.length?(a=+b,x):a},x.interpolate=function(b){return arguments.length?(l=b,x):l},x.on=function(){var b=c.on.apply(c,arguments);return b===c?x:b},x.clickDistance=function(b){return arguments.length?(y=(b=+b)*b,x):Math.sqrt(y)},x.tapDistance=function(b){return arguments.length?(v=+b,x):v},x}const pe={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:o}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},yt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Os=["Enter"," ","Escape"],Rs={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Je;(function(e){e.Strict="strict",e.Loose="loose"})(Je||(Je={}));var Re;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Re||(Re={}));var xt;(function(e){e.Partial="partial",e.Full="full"})(xt||(xt={}));const Hs={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ie;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ie||(Ie={}));var Kt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Kt||(Kt={}));var G;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(G||(G={}));const Fo={[G.Left]:G.Right,[G.Right]:G.Left,[G.Top]:G.Bottom,[G.Bottom]:G.Top};function Vs(e){return e===null?null:e?"valid":"invalid"}const Bs=e=>"id"in e&&"source"in e&&"target"in e,df=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),io=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Nt=(e,t=[0,0])=>{const{width:n,height:o}=Ne(e),r=e.origin??t,s=n*r[0],i=o*r[1];return{x:e.position.x-s,y:e.position.y-i}},ff=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,r)=>{const s=typeof r=="string";let i=!t.nodeLookup&&!s?r:void 0;t.nodeLookup&&(i=s?t.nodeLookup.get(r):io(r)?r:t.nodeLookup.get(r.id));const a=i?Ut(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return dn(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return fn(n)},Et=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=dn(n,Ut(r)),o=!0)}),o?fn(n):{x:0,y:0,width:0,height:0}},ao=(e,t,[n,o,r]=[0,0,1],s=!1,i=!1)=>{const a={...Mt(t,[n,o,r]),width:t.width/r,height:t.height/r},l=[];for(const c of e.values()){const{measured:u,selectable:d=!0,hidden:f=!1}=c;if(i&&!d||f)continue;const g=u.width??c.width??c.initialWidth??null,m=u.height??c.height??c.initialHeight??null,y=vt(a,tt(c)),v=(g??0)*(m??0),x=s&&y>0;(!c.internals.handleBounds||x||y>=v||c.dragging)&&l.push(c)}return l},hf=(e,t)=>{const n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function mf(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&(t?.includeHiddenNodes||!r.hidden)&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function gf({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:s},i){if(e.size===0)return Promise.resolve(!0);const a=mf(e,i),l=Et(a),c=co(l,t,n,i?.minZoom??r,i?.maxZoom??s,i?.padding??.1);return await o.setViewport(c,{duration:i?.duration,ease:i?.ease,interpolate:i?.interpolate}),Promise.resolve(!0)}function Fs({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:s}){const i=n.get(e),a=i.parentId?n.get(i.parentId):void 0,{x:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},u=i.origin??o;let d=i.extent||r;if(i.extent==="parent"&&!i.expandParent)if(!a)s?.("005",pe.error005());else{const g=a.measured.width,m=a.measured.height;g&&m&&(d=[[l,c],[l+g,c+m]])}else a&&nt(i.extent)&&(d=[[i.extent[0][0]+l,i.extent[0][1]+c],[i.extent[1][0]+l,i.extent[1][1]+c]]);const f=nt(d)?Be(t,d,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&s?.("015",pe.error015()),{position:{x:f.x-l+(i.measured.width??0)*u[0],y:f.y-c+(i.measured.height??0)*u[1]},positionAbsolute:f}}async function pf({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const s=new Set(e.map(f=>f.id)),i=[];for(const f of n){if(f.deletable===!1)continue;const g=s.has(f.id),m=!g&&f.parentId&&i.find(y=>y.id===f.parentId);(g||m)&&i.push(f)}const a=new Set(t.map(f=>f.id)),l=o.filter(f=>f.deletable!==!1),u=hf(i,l);for(const f of l)a.has(f.id)&&!u.find(m=>m.id===f.id)&&u.push(f);if(!r)return{edges:u,nodes:i};const d=await r({nodes:i,edges:u});return typeof d=="boolean"?d?{edges:u,nodes:i}:{edges:[],nodes:[]}:d}const et=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Be=(e={x:0,y:0},t,n)=>({x:et(e.x,t[0][0],t[1][0]-(n?.width??0)),y:et(e.y,t[0][1],t[1][1]-(n?.height??0))});function Gs(e,t,n){const{width:o,height:r}=Ne(n),{x:s,y:i}=n.internals.positionAbsolute;return Be(e,[[s,i],[s+o,i+r]],t)}const Go=(e,t,n)=>e<t?et(Math.abs(e-t),1,t)/t:e>n?-et(Math.abs(e-n),1,t)/t:0,Xs=(e,t,n=15,o=40)=>{const r=Go(e.x,o,t.width-o)*n,s=Go(e.y,o,t.height-o)*n;return[r,s]},dn=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Vn=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),fn=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),tt=(e,t=[0,0])=>{const{x:n,y:o}=io(e)?e.internals.positionAbsolute:Nt(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Ut=(e,t=[0,0])=>{const{x:n,y:o}=io(e)?e.internals.positionAbsolute:Nt(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},Ys=(e,t)=>fn(dn(Vn(e),Vn(t))),vt=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},Xo=e=>fe(e.width)&&fe(e.height)&&fe(e.x)&&fe(e.y),fe=e=>!isNaN(e)&&isFinite(e),yf=(e,t)=>{},Ct=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Mt=({x:e,y:t},[n,o,r],s=!1,i=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return s?Ct(a,i):a},Qt=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Xe(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function xf(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=Xe(e,n),r=Xe(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=Xe(e.top??e.y??0,n),r=Xe(e.bottom??e.y??0,n),s=Xe(e.left??e.x??0,t),i=Xe(e.right??e.x??0,t);return{top:o,right:i,bottom:r,left:s,x:s+i,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function vf(e,t,n,o,r,s){const{x:i,y:a}=Qt(e,[t,n,o]),{x:l,y:c}=Qt({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-l,d=s-c;return{left:Math.floor(i),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(d)}}const co=(e,t,n,o,r,s)=>{const i=xf(s,t,n),a=(t-i.x)/e.width,l=(n-i.y)/e.height,c=Math.min(a,l),u=et(c,o,r),d=e.x+e.width/2,f=e.y+e.height/2,g=t/2-d*u,m=n/2-f*u,y=vf(e,g,m,u,t,n),v={left:Math.min(y.left-i.left,0),top:Math.min(y.top-i.top,0),right:Math.min(y.right-i.right,0),bottom:Math.min(y.bottom-i.bottom,0)};return{x:g-v.left+v.right,y:m-v.top+v.bottom,zoom:u}},wt=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function nt(e){return e!=null&&e!=="parent"}function Ne(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function qs(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Ws(e,t={width:0,height:0},n,o,r){const s={...e},i=o.get(n);if(i){const a=i.origin||r;s.x+=i.internals.positionAbsolute.x-(t.width??0)*a[0],s.y+=i.internals.positionAbsolute.y-(t.height??0)*a[1]}return s}function Yo(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function wf(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function bf(e){return{...Rs,...e||{}}}function ht(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:s,y:i}=he(e),a=Mt({x:s-(r?.left??0),y:i-(r?.top??0)},o),{x:l,y:c}=n?Ct(a,t):a;return{xSnapped:l,ySnapped:c,...a}}const lo=e=>({width:e.offsetWidth,height:e.offsetHeight}),Zs=e=>e?.getRootNode?.()||window?.document,_f=["INPUT","SELECT","TEXTAREA"];function Ks(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:_f.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Us=e=>"clientX"in e,he=(e,t)=>{const n=Us(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},qo=(e,t,n,o,r)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(i=>{const a=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:r,position:i.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...lo(i)}})};function Qs({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:s,targetControlX:i,targetControlY:a}){const l=e*.125+r*.375+i*.375+n*.125,c=t*.125+s*.375+a*.375+o*.125,u=Math.abs(l-e),d=Math.abs(c-t);return[l,c,u,d]}function Tt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Wo({pos:e,x1:t,y1:n,x2:o,y2:r,c:s}){switch(e){case G.Left:return[t-Tt(t-o,s),n];case G.Right:return[t+Tt(o-t,s),n];case G.Top:return[t,n-Tt(n-r,s)];case G.Bottom:return[t,n+Tt(r-n,s)]}}function Js({sourceX:e,sourceY:t,sourcePosition:n=G.Bottom,targetX:o,targetY:r,targetPosition:s=G.Top,curvature:i=.25}){const[a,l]=Wo({pos:n,x1:e,y1:t,x2:o,y2:r,c:i}),[c,u]=Wo({pos:s,x1:o,y1:r,x2:e,y2:t,c:i}),[d,f,g,m]=Qs({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${l} ${c},${u} ${o},${r}`,d,f,g,m]}function ei({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,s=n<e?n+r:n-r,i=Math.abs(o-t)/2,a=o<t?o+i:o-i;return[s,a,r,i]}function Sf({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:s="basic"}){if(s==="manual")return o;const i=r&&n?o+1e3:o,a=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return i+a}function Nf({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const s=dn(Ut(e),Ut(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const i={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return vt(i,fn(s))>0}const Ef=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Cf=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Mf=(e,t,n={})=>{if(!e.source||!e.target)return t;const o=n.getEdgeId||Ef;let r;return Bs(e)?r={...e}:r={...e,id:o(e)},Cf(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function ti({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,s,i,a]=ei({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,s,i,a]}const Zo={[G.Left]:{x:-1,y:0},[G.Right]:{x:1,y:0},[G.Top]:{x:0,y:-1},[G.Bottom]:{x:0,y:1}},If=({source:e,sourcePosition:t=G.Bottom,target:n})=>t===G.Left||t===G.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Ko=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function kf({source:e,sourcePosition:t=G.Bottom,target:n,targetPosition:o=G.Top,center:r,offset:s,stepPosition:i}){const a=Zo[t],l=Zo[o],c={x:e.x+a.x*s,y:e.y+a.y*s},u={x:n.x+l.x*s,y:n.y+l.y*s},d=If({source:c,sourcePosition:t,target:u}),f=d.x!==0?"x":"y",g=d[f];let m=[],y,v;const x={x:0,y:0},_={x:0,y:0},[,,p,w]=ei({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*l[f]===-1){f==="x"?(y=r.x??c.x+(u.x-c.x)*i,v=r.y??(c.y+u.y)/2):(y=r.x??(c.x+u.x)/2,v=r.y??c.y+(u.y-c.y)*i);const S=[{x:y,y:c.y},{x:y,y:u.y}],N=[{x:c.x,y:v},{x:u.x,y:v}];a[f]===g?m=f==="x"?S:N:m=f==="x"?N:S}else{const S=[{x:c.x,y:u.y}],N=[{x:u.x,y:c.y}];if(f==="x"?m=a.x===g?N:S:m=a.y===g?S:N,t===o){const L=Math.abs(e[f]-n[f]);if(L<=s){const $=Math.min(s-1,s-L);a[f]===g?x[f]=(c[f]>e[f]?-1:1)*$:_[f]=(u[f]>n[f]?-1:1)*$}}if(t!==o){const L=f==="x"?"y":"x",$=a[f]===l[L],b=c[L]>u[L],k=c[L]<u[L];(a[f]===1&&(!$&&b||$&&k)||a[f]!==1&&(!$&&k||$&&b))&&(m=f==="x"?S:N)}const D={x:c.x+x.x,y:c.y+x.y},T={x:u.x+_.x,y:u.y+_.y},z=Math.max(Math.abs(D.x-m[0].x),Math.abs(T.x-m[0].x)),E=Math.max(Math.abs(D.y-m[0].y),Math.abs(T.y-m[0].y));z>=E?(y=(D.x+T.x)/2,v=m[0].y):(y=m[0].x,v=(D.y+T.y)/2)}return[[e,{x:c.x+x.x,y:c.y+x.y},...m,{x:u.x+_.x,y:u.y+_.y},n],y,v,p,w]}function Pf(e,t,n,o){const r=Math.min(Ko(e,t)/2,Ko(t,n)/2,o),{x:s,y:i}=t;if(e.x===s&&s===n.x||e.y===i&&i===n.y)return`L${s} ${i}`;if(e.y===i){const c=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${s+r*c},${i}Q ${s},${i} ${s},${i+r*u}`}const a=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${s},${i+r*l}Q ${s},${i} ${s+r*a},${i}`}function Bn({sourceX:e,sourceY:t,sourcePosition:n=G.Bottom,targetX:o,targetY:r,targetPosition:s=G.Top,borderRadius:i=5,centerX:a,centerY:l,offset:c=20,stepPosition:u=.5}){const[d,f,g,m,y]=kf({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:s,center:{x:a,y:l},offset:c,stepPosition:u});return[d.reduce((x,_,p)=>{let w="";return p>0&&p<d.length-1?w=Pf(d[p-1],_,d[p+1],i):w=`${p===0?"M":"L"}${_.x} ${_.y}`,x+=w,x},""),f,g,m,y]}function Uo(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function jf(e){const{sourceNode:t,targetNode:n}=e;if(!Uo(t)||!Uo(n))return null;const o=t.internals.handleBounds||Qo(t.handles),r=n.internals.handleBounds||Qo(n.handles),s=Jo(o?.source??[],e.sourceHandle),i=Jo(e.connectionMode===Je.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!s||!i)return e.onError?.("008",pe.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=s?.position||G.Bottom,l=i?.position||G.Top,c=Fe(t,s,a),u=Fe(n,i,l);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:l}}function Qo(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&n.push(o);return{source:t,target:n}}function Fe(e,t,n=G.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,s=(t?.y??0)+e.internals.positionAbsolute.y,{width:i,height:a}=t??Ne(e);if(o)return{x:r+i/2,y:s+a/2};switch(t?.position??n){case G.Top:return{x:r+i/2,y:s};case G.Right:return{x:r+i,y:s+a/2};case G.Bottom:return{x:r+i/2,y:s+a};case G.Left:return{x:r,y:s+a/2}}}function Jo(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Fn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function Tf(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const s=new Set;return e.reduce((i,a)=>([a.markerStart||o,a.markerEnd||r].forEach(l=>{if(l&&typeof l=="object"){const c=Fn(l,t);s.has(c)||(i.push({id:c,color:l.color||n,...l}),s.add(c))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))}const ni=1e3,Af=10,uo={nodeOrigin:[0,0],nodeExtent:yt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Df={...uo,checkEquality:!0};function fo(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function Lf(e,t,n){const o=fo(uo,n);for(const r of e.values())if(r.parentId)mo(r,e,t,o);else{const s=Nt(r,o.nodeOrigin),i=nt(r.extent)?r.extent:o.nodeExtent,a=Be(s,i,Ne(r));r.internals.positionAbsolute=a}}function $f(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const s={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(s):r.type==="target"&&o.push(s)}return{source:n,target:o}}function ho(e){return e==="manual"}function Gn(e,t,n,o={}){const r=fo(Df,o),s={i:0},i=new Map(t),a=r?.elevateNodesOnSelect&&!ho(r.zIndexMode)?ni:0;let l=e.length>0;t.clear(),n.clear();for(const c of e){let u=i.get(c.id);if(r.checkEquality&&c===u?.internals.userNode)t.set(c.id,u);else{const d=Nt(c,r.nodeOrigin),f=nt(c.extent)?c.extent:r.nodeExtent,g=Be(d,f,Ne(c));u={...r.defaults,...c,measured:{width:c.measured?.width,height:c.measured?.height},internals:{positionAbsolute:g,handleBounds:$f(c,u),z:oi(c,a,r.zIndexMode),userNode:c}},t.set(c.id,u)}(u.measured===void 0||u.measured.width===void 0||u.measured.height===void 0)&&!u.hidden&&(l=!1),c.parentId&&mo(u,t,n,o,s)}return l}function zf(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function mo(e,t,n,o,r){const{elevateNodesOnSelect:s,nodeOrigin:i,nodeExtent:a,zIndexMode:l}=fo(uo,o),c=e.parentId,u=t.get(c);if(!u){console.warn(`Parent node ${c} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}zf(e,n),r&&!u.parentId&&u.internals.rootParentIndex===void 0&&l==="auto"&&(u.internals.rootParentIndex=++r.i,u.internals.z=u.internals.z+r.i*Af),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);const d=s&&!ho(l)?ni:0,{x:f,y:g,z:m}=Of(e,u,i,a,d,l),{positionAbsolute:y}=e.internals,v=f!==y.x||g!==y.y;(v||m!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:v?{x:f,y:g}:y,z:m}})}function oi(e,t,n){const o=fe(e.zIndex)?e.zIndex:0;return ho(n)?o:o+(e.selected?t:0)}function Of(e,t,n,o,r,s){const{x:i,y:a}=t.internals.positionAbsolute,l=Ne(e),c=Nt(e,n),u=nt(e.extent)?Be(c,e.extent,l):c;let d=Be({x:i+u.x,y:a+u.y},o,l);e.extent==="parent"&&(d=Gs(d,l,t));const f=oi(e,r,s),g=t.internals.z??0;return{x:d.x,y:d.y,z:g>=f?g+1:f}}function go(e,t,n,o=[0,0]){const r=[],s=new Map;for(const i of e){const a=t.get(i.parentId);if(!a)continue;const l=s.get(i.parentId)?.expandedRect??tt(a),c=Ys(l,i.rect);s.set(i.parentId,{expandedRect:c,parent:a})}return s.size>0&&s.forEach(({expandedRect:i,parent:a},l)=>{const c=a.internals.positionAbsolute,u=Ne(a),d=a.origin??o,f=i.x<c.x?Math.round(Math.abs(c.x-i.x)):0,g=i.y<c.y?Math.round(Math.abs(c.y-i.y)):0,m=Math.max(u.width,Math.round(i.width)),y=Math.max(u.height,Math.round(i.height)),v=(m-u.width)*d[0],x=(y-u.height)*d[1];(f>0||g>0||v||x)&&(r.push({id:l,type:"position",position:{x:a.position.x-f+v,y:a.position.y-g+x}}),n.get(l)?.forEach(_=>{e.some(p=>p.id===_.id)||r.push({id:_.id,type:"position",position:{x:_.position.x+f,y:_.position.y+g}})})),(u.width<i.width||u.height<i.height||f||g)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:m+(f?d[0]*f-v:0),height:y+(g?d[1]*g-x:0)}})}),r}function Rf(e,t,n,o,r,s,i){const a=o?.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const c=[],u=window.getComputedStyle(a),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(const g of e.values()){const m=t.get(g.id);if(!m)continue;if(m.hidden){t.set(m.id,{...m,internals:{...m.internals,handleBounds:void 0}}),l=!0;continue}const y=lo(g.nodeElement),v=m.measured.width!==y.width||m.measured.height!==y.height;if(!!(y.width&&y.height&&(v||!m.internals.handleBounds||g.force))){const _=g.nodeElement.getBoundingClientRect(),p=nt(m.extent)?m.extent:s;let{positionAbsolute:w}=m.internals;m.parentId&&m.extent==="parent"?w=Gs(w,y,t.get(m.parentId)):p&&(w=Be(w,p,y));const M={...m,measured:y,internals:{...m.internals,positionAbsolute:w,handleBounds:{source:qo("source",g.nodeElement,_,d,m.id),target:qo("target",g.nodeElement,_,d,m.id)}}};t.set(m.id,M),m.parentId&&mo(M,t,n,{nodeOrigin:r,zIndexMode:i}),l=!0,v&&(c.push({id:m.id,type:"dimensions",dimensions:y}),m.expandParent&&m.parentId&&f.push({id:m.id,parentId:m.parentId,rect:tt(M,r)}))}}if(f.length>0){const g=go(f,t,n,r);c.push(...g)}return{changes:c,updatedInternals:l}}async function Hf({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:s}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const i=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,s]],o),a=!!i&&(i.x!==n[0]||i.y!==n[1]||i.k!==n[2]);return Promise.resolve(a)}function er(e,t,n,o,r,s){let i=r;const a=o.get(i)||new Map;o.set(i,a.set(n,t)),i=`${r}-${e}`;const l=o.get(i)||new Map;if(o.set(i,l.set(n,t)),s){i=`${r}-${e}-${s}`;const c=o.get(i)||new Map;o.set(i,c.set(n,t))}}function ri(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:s,sourceHandle:i=null,targetHandle:a=null}=o,l={edgeId:o.id,source:r,target:s,sourceHandle:i,targetHandle:a},c=`${r}-${i}--${s}-${a}`,u=`${s}-${a}--${r}-${i}`;er("source",l,u,e,r,i),er("target",l,c,e,s,a),t.set(o.id,o)}}function si(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:si(n,t):!1}function tr(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function Vf(e,t,n,o){const r=new Map;for(const[s,i]of e)if((i.selected||i.id===o)&&(!i.parentId||!si(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){const a=e.get(s);a&&r.set(s,{id:s,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function En({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[i,a]of t){const l=n.get(i)?.internals.userNode;l&&r.push({...l,position:a.position,dragging:o})}if(!e)return[r[0],r];const s=n.get(e)?.internals.userNode;return[s?{...s,position:t.get(e)?.position||s.position,dragging:o}:r[0],r]}function Bf({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const s={x:n-r.distance.x,y:o-r.distance.y},i=Ct(s,t);return{x:i.x-s.x,y:i.y-s.y}}function Ff({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let s={x:null,y:null},i=0,a=new Map,l=!1,c={x:0,y:0},u=null,d=!1,f=null,g=!1,m=!1,y=null;function v({noDragClassName:_,handleSelector:p,domNode:w,isSelectable:M,nodeId:S,nodeClickDistance:N=0}){f=ce(w);function D({x:L,y:$}){const{nodeLookup:b,nodeExtent:k,snapGrid:I,snapToGrid:A,nodeOrigin:P,onNodeDrag:j,onSelectionDrag:O,onError:H,updateNodePositions:R}=t();s={x:L,y:$};let F=!1;const B=a.size>1,q=B&&k?Vn(Et(a)):null,K=B&&A?Bf({dragItems:a,snapGrid:I,x:L,y:$}):null;for(const[Y,V]of a){if(!b.has(Y))continue;let X={x:L-V.distance.x,y:$-V.distance.y};A&&(X=K?{x:Math.round(X.x+K.x),y:Math.round(X.y+K.y)}:Ct(X,I));let Q=null;if(B&&k&&!V.extent&&q){const{positionAbsolute:Z}=V.internals,ee=Z.x-q.x+k[0][0],ne=Z.x+V.measured.width-q.x2+k[1][0],te=Z.y-q.y+k[0][1],ae=Z.y+V.measured.height-q.y2+k[1][1];Q=[[ee,te],[ne,ae]]}const{position:U,positionAbsolute:W}=Fs({nodeId:Y,nextPosition:X,nodeLookup:b,nodeExtent:Q||k,nodeOrigin:P,onError:H});F=F||V.position.x!==U.x||V.position.y!==U.y,V.position=U,V.internals.positionAbsolute=W}if(m=m||F,!!F&&(R(a,!0),y&&(o||j||!S&&O))){const[Y,V]=En({nodeId:S,dragItems:a,nodeLookup:b});o?.(y,a,Y,V),j?.(y,Y,V),S||O?.(y,V)}}async function T(){if(!u)return;const{transform:L,panBy:$,autoPanSpeed:b,autoPanOnNodeDrag:k}=t();if(!k){l=!1,cancelAnimationFrame(i);return}const[I,A]=Xs(c,u,b);(I!==0||A!==0)&&(s.x=(s.x??0)-I/L[2],s.y=(s.y??0)-A/L[2],await $({x:I,y:A})&&D(s)),i=requestAnimationFrame(T)}function z(L){const{nodeLookup:$,multiSelectionActive:b,nodesDraggable:k,transform:I,snapGrid:A,snapToGrid:P,selectNodesOnDrag:j,onNodeDragStart:O,onSelectionDragStart:H,unselectNodesAndEdges:R}=t();d=!0,(!j||!M)&&!b&&S&&($.get(S)?.selected||R()),M&&j&&S&&e?.(S);const F=ht(L.sourceEvent,{transform:I,snapGrid:A,snapToGrid:P,containerBounds:u});if(s=F,a=Vf($,k,F,S),a.size>0&&(n||O||!S&&H)){const[B,q]=En({nodeId:S,dragItems:a,nodeLookup:$});n?.(L.sourceEvent,a,B,q),O?.(L.sourceEvent,B,q),S||H?.(L.sourceEvent,q)}}const E=Cs().clickDistance(N).on("start",L=>{const{domNode:$,nodeDragThreshold:b,transform:k,snapGrid:I,snapToGrid:A}=t();u=$?.getBoundingClientRect()||null,g=!1,m=!1,y=L.sourceEvent,b===0&&z(L),s=ht(L.sourceEvent,{transform:k,snapGrid:I,snapToGrid:A,containerBounds:u}),c=he(L.sourceEvent,u)}).on("drag",L=>{const{autoPanOnNodeDrag:$,transform:b,snapGrid:k,snapToGrid:I,nodeDragThreshold:A,nodeLookup:P}=t(),j=ht(L.sourceEvent,{transform:b,snapGrid:k,snapToGrid:I,containerBounds:u});if(y=L.sourceEvent,(L.sourceEvent.type==="touchmove"&&L.sourceEvent.touches.length>1||S&&!P.has(S))&&(g=!0),!g){if(!l&&$&&d&&(l=!0,T()),!d){const O=he(L.sourceEvent,u),H=O.x-c.x,R=O.y-c.y;Math.sqrt(H*H+R*R)>A&&z(L)}(s.x!==j.xSnapped||s.y!==j.ySnapped)&&a&&d&&(c=he(L.sourceEvent,u),D(j))}}).on("end",L=>{if(!(!d||g)&&(l=!1,d=!1,cancelAnimationFrame(i),a.size>0)){const{nodeLookup:$,updateNodePositions:b,onNodeDragStop:k,onSelectionDragStop:I}=t();if(m&&(b(a,!1),m=!1),r||k||!S&&I){const[A,P]=En({nodeId:S,dragItems:a,nodeLookup:$,dragging:!1});r?.(L.sourceEvent,a,A,P),k?.(L.sourceEvent,A,P),S||I?.(L.sourceEvent,P)}}}).filter(L=>{const $=L.target;return!L.button&&(!_||!tr($,`.${_}`,w))&&(!p||tr($,p,w))});f.call(E)}function x(){f?.on(".drag",null)}return{update:v,destroy:x}}function Gf(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const s of t.values())vt(r,tt(s))>0&&o.push(s);return o}const Xf=250;function Yf(e,t,n,o){let r=[],s=1/0;const i=Gf(e,n,t+Xf);for(const a of i){const l=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(const c of l){if(o.nodeId===c.nodeId&&o.type===c.type&&o.id===c.id)continue;const{x:u,y:d}=Fe(a,c,c.position,!0),f=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(d-e.y,2));f>t||(f<s?(r=[{...c,x:u,y:d}],s=f):f===s&&r.push({...c,x:u,y:d}))}}if(!r.length)return null;if(r.length>1){const a=o.type==="source"?"target":"source";return r.find(l=>l.type===a)??r[0]}return r[0]}function ii(e,t,n,o,r,s=!1){const i=o.get(e);if(!i)return null;const a=r==="strict"?i.internals.handleBounds?.[t]:[...i.internals.handleBounds?.source??[],...i.internals.handleBounds?.target??[]],l=(n?a?.find(c=>c.id===n):a?.[0])??null;return l&&s?{...l,...Fe(i,l,l.position,!0)}:l}function ai(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function qf(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const ci=()=>!0;function Wf(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:s,isTarget:i,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:g,onConnectStart:m,onConnect:y,onConnectEnd:v,isValidConnection:x=ci,onReconnectEnd:_,updateConnection:p,getTransform:w,getFromHandle:M,autoPanSpeed:S,dragThreshold:N=1,handleDomNode:D}){const T=Zs(e.target);let z=0,E;const{x:L,y:$}=he(e),b=ai(s,D),k=a?.getBoundingClientRect();let I=!1;if(!k||!b)return;const A=ii(r,b,o,l,t);if(!A)return;let P=he(e,k),j=!1,O=null,H=!1,R=null;function F(){if(!u||!k)return;const[U,W]=Xs(P,k,S);f({x:U,y:W}),z=requestAnimationFrame(F)}const B={...A,nodeId:r,type:b,position:A.position},q=l.get(r);let Y={inProgress:!0,isValid:null,from:Fe(q,B,G.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:q,to:P,toHandle:null,toPosition:Fo[B.position],toNode:null,pointer:P};function V(){I=!0,p(Y),m?.(e,{nodeId:r,handleId:o,handleType:b})}N===0&&V();function X(U){if(!I){const{x:ae,y:Ee}=he(U),ve=ae-L,$e=Ee-$;if(!(ve*ve+$e*$e>N*N))return;V()}if(!M()||!B){Q(U);return}const W=w();P=he(U,k),E=Yf(Mt(P,W,!1,[1,1]),n,l,B),j||(F(),j=!0);const Z=li(U,{handle:E,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:i?"target":"source",isValidConnection:x,doc:T,lib:c,flowId:d,nodeLookup:l});R=Z.handleDomNode,O=Z.connection,H=qf(!!E,Z.isValid);const ee=l.get(r),ne=ee?Fe(ee,B,G.Left,!0):Y.from,te={...Y,from:ne,isValid:H,to:Z.toHandle&&H?Qt({x:Z.toHandle.x,y:Z.toHandle.y},W):P,toHandle:Z.toHandle,toPosition:H&&Z.toHandle?Z.toHandle.position:Fo[B.position],toNode:Z.toHandle?l.get(Z.toHandle.nodeId):null,pointer:P};p(te),Y=te}function Q(U){if(!("touches"in U&&U.touches.length>0)){if(I){(E||R)&&O&&H&&y?.(O);const{inProgress:W,...Z}=Y,ee={...Z,toPosition:Y.toHandle?Y.toPosition:null};v?.(U,ee),s&&_?.(U,ee)}g(),cancelAnimationFrame(z),j=!1,H=!1,O=null,R=null,T.removeEventListener("mousemove",X),T.removeEventListener("mouseup",Q),T.removeEventListener("touchmove",X),T.removeEventListener("touchend",Q)}}T.addEventListener("mousemove",X),T.addEventListener("mouseup",Q),T.addEventListener("touchmove",X),T.addEventListener("touchend",Q)}function li(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:s,doc:i,lib:a,flowId:l,isValidConnection:c=ci,nodeLookup:u}){const d=s==="target",f=t?i.querySelector(`.${a}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:g,y:m}=he(e),y=i.elementFromPoint(g,m),v=y?.classList.contains(`${a}-flow__handle`)?y:f,x={handleDomNode:v,isValid:!1,connection:null,toHandle:null};if(v){const _=ai(void 0,v),p=v.getAttribute("data-nodeid"),w=v.getAttribute("data-handleid"),M=v.classList.contains("connectable"),S=v.classList.contains("connectableend");if(!p||!_)return x;const N={source:d?p:o,sourceHandle:d?w:r,target:d?o:p,targetHandle:d?r:w};x.connection=N;const T=M&&S&&(n===Je.Strict?d&&_==="source"||!d&&_==="target":p!==o||w!==r);x.isValid=T&&c(N),x.toHandle=ii(p,_,w,u,n,!0)}return x}const Xn={onPointerDown:Wf,isValid:li};function Zf({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=ce(e);function s({translateExtent:a,width:l,height:c,zoomStep:u=1,pannable:d=!0,zoomable:f=!0,inversePan:g=!1}){const m=p=>{if(p.sourceEvent.type!=="wheel"||!t)return;const w=n(),M=p.sourceEvent.ctrlKey&&wt()?10:1,S=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*u,N=w[2]*Math.pow(2,S*M);t.scaleTo(N)};let y=[0,0];const v=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(y=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},x=p=>{const w=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;const M=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],S=[M[0]-y[0],M[1]-y[1]];y=M;const N=o()*Math.max(w[2],Math.log(w[2]))*(g?-1:1),D={x:w[0]-S[0]*N,y:w[1]-S[1]*N},T=[[0,0],[l,c]];t.setViewportConstrained({x:D.x,y:D.y,zoom:w[2]},T,a)},_=zs().on("start",v).on("zoom",d?x:null).on("zoom.wheel",f?m:null);r.call(_,{})}function i(){r.on("zoom",null)}return{update:s,destroy:i,pointer:de}}const hn=e=>({x:e.x,y:e.y,zoom:e.k}),Cn=({x:e,y:t,zoom:n})=>un.translate(e,t).scale(n),qe=(e,t)=>e.target.closest(`.${t}`),ui=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Kf=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Mn=(e,t=0,n=Kf,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},di=e=>{const t=e.ctrlKey&&wt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Uf({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:s,zoomOnPinch:i,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return u=>{if(qe(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(u.ctrlKey&&i){const v=de(u),x=di(u),_=d*Math.pow(2,x);o.scaleTo(n,_,v,u);return}const f=u.deltaMode===1?20:1;let g=r===Re.Vertical?0:u.deltaX*f,m=r===Re.Horizontal?0:u.deltaY*f;!wt()&&u.shiftKey&&r!==Re.Vertical&&(g=u.deltaY*f,m=0),o.translateBy(n,-(g/d)*s,-(m/d)*s,{internal:!0});const y=hn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(l?.(u,y),e.panScrollTimeout=setTimeout(()=>{c?.(u,y),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a?.(u,y))}}function Qf({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const s=o.type==="wheel",i=!t&&s&&!o.ctrlKey,a=qe(o,e);if(o.ctrlKey&&s&&a&&o.preventDefault(),i||a)return null;o.preventDefault(),n.call(this,o,r)}}function Jf({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=hn(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,r)}}function eh({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return s=>{e.usedRightMouseButton=!!(n&&ui(t,e.mouseButton??0)),s.sourceEvent?.sync||o([s.transform.x,s.transform.y,s.transform.k]),r&&!s.sourceEvent?.internal&&r?.(s.sourceEvent,hn(s.transform))}}function th({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:s}){return i=>{if(!i.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,s&&ui(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&s(i.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const a=hn(i.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(i.sourceEvent,a)},n?150:0)}}}function nh({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:s,userSelectionActive:i,noWheelClassName:a,noPanClassName:l,lib:c,connectionInProgress:u}){return d=>{const f=e||t,g=n&&d.ctrlKey,m=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(qe(d,`${c}-flow__node`)||qe(d,`${c}-flow__edge`)))return!0;if(!o&&!f&&!r&&!s&&!n||i||u&&!m||qe(d,a)&&m||qe(d,l)&&(!m||r&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type==="touchstart"&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!r&&!g&&m||!o&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(o)&&!o.includes(d.button)&&d.type==="mousedown")return!1;const y=Array.isArray(o)&&o.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&y}}function oh({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:s,onPanZoomStart:i,onPanZoomEnd:a,onDraggingChange:l}){const c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=zs().scaleExtent([t,n]).translateExtent(o),f=ce(e).call(d);_({x:r.x,y:r.y,zoom:et(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);const g=f.on("wheel.zoom"),m=f.on("dblclick.zoom");d.wheelDelta(di);function y(E,L){return f?new Promise($=>{d?.interpolate(L?.interpolate==="linear"?bn:Ot).transform(Mn(f,L?.duration,L?.ease,()=>$(!0)),E)}):Promise.resolve(!1)}function v({noWheelClassName:E,noPanClassName:L,onPaneContextMenu:$,userSelectionActive:b,panOnScroll:k,panOnDrag:I,panOnScrollMode:A,panOnScrollSpeed:P,preventScrolling:j,zoomOnPinch:O,zoomOnScroll:H,zoomOnDoubleClick:R,zoomActivationKeyPressed:F,lib:B,onTransformChange:q,connectionInProgress:K,paneClickDistance:Y,selectionOnDrag:V}){b&&!c.isZoomingOrPanning&&x();const X=k&&!F&&!b;d.clickDistance(V?1/0:!fe(Y)||Y<0?0:Y);const Q=X?Uf({zoomPanValues:c,noWheelClassName:E,d3Selection:f,d3Zoom:d,panOnScrollMode:A,panOnScrollSpeed:P,zoomOnPinch:O,onPanZoomStart:i,onPanZoom:s,onPanZoomEnd:a}):Qf({noWheelClassName:E,preventScrolling:j,d3ZoomHandler:g});if(f.on("wheel.zoom",Q,{passive:!1}),!b){const W=Jf({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:i});d.on("start",W);const Z=eh({zoomPanValues:c,panOnDrag:I,onPaneContextMenu:!!$,onPanZoom:s,onTransformChange:q});d.on("zoom",Z);const ee=th({zoomPanValues:c,panOnDrag:I,panOnScroll:k,onPaneContextMenu:$,onPanZoomEnd:a,onDraggingChange:l});d.on("end",ee)}const U=nh({zoomActivationKeyPressed:F,panOnDrag:I,zoomOnScroll:H,panOnScroll:k,zoomOnDoubleClick:R,zoomOnPinch:O,userSelectionActive:b,noPanClassName:L,noWheelClassName:E,lib:B,connectionInProgress:K});d.filter(U),R?f.on("dblclick.zoom",m):f.on("dblclick.zoom",null)}function x(){d.on("zoom",null)}async function _(E,L,$){const b=Cn(E),k=d?.constrain()(b,L,$);return k&&await y(k),new Promise(I=>I(k))}async function p(E,L){const $=Cn(E);return await y($,L),new Promise(b=>b($))}function w(E){if(f){const L=Cn(E),$=f.property("__zoom");($.k!==E.zoom||$.x!==E.x||$.y!==E.y)&&d?.transform(f,L,null,{sync:!0})}}function M(){const E=f?$s(f.node()):{x:0,y:0,k:1};return{x:E.x,y:E.y,zoom:E.k}}function S(E,L){return f?new Promise($=>{d?.interpolate(L?.interpolate==="linear"?bn:Ot).scaleTo(Mn(f,L?.duration,L?.ease,()=>$(!0)),E)}):Promise.resolve(!1)}function N(E,L){return f?new Promise($=>{d?.interpolate(L?.interpolate==="linear"?bn:Ot).scaleBy(Mn(f,L?.duration,L?.ease,()=>$(!0)),E)}):Promise.resolve(!1)}function D(E){d?.scaleExtent(E)}function T(E){d?.translateExtent(E)}function z(E){const L=!fe(E)||E<0?0:E;d?.clickDistance(L)}return{update:v,destroy:x,setViewport:p,setViewportConstrained:_,getViewport:M,scaleTo:S,scaleBy:N,setScaleExtent:D,setTranslateExtent:T,syncViewport:w,setClickDistance:z}}var ot;(function(e){e.Line="line",e.Handle="handle"})(ot||(ot={}));function rh({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:s}){const i=e-t,a=n-o,l=[i>0?1:i<0?-1:0,a>0?1:a<0?-1:0];return i&&r&&(l[0]=l[0]*-1),a&&s&&(l[1]=l[1]*-1),l}function nr(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function Ce(e,t){return Math.max(0,t-e)}function Me(e,t){return Math.max(0,e-t)}function At(e,t,n){return Math.max(0,t-e,e-n)}function or(e,t){return e?!t:t}function sh(e,t,n,o,r,s,i,a){let{affectsX:l,affectsY:c}=t;const{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:g,ySnapped:m}=n,{minWidth:y,maxWidth:v,minHeight:x,maxHeight:_}=o,{x:p,y:w,width:M,height:S,aspectRatio:N}=e;let D=Math.floor(u?g-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0);const z=M+(l?-D:D),E=S+(c?-T:T),L=-s[0]*M,$=-s[1]*S;let b=At(z,y,v),k=At(E,x,_);if(i){let P=0,j=0;l&&D<0?P=Ce(p+D+L,i[0][0]):!l&&D>0&&(P=Me(p+z+L,i[1][0])),c&&T<0?j=Ce(w+T+$,i[0][1]):!c&&T>0&&(j=Me(w+E+$,i[1][1])),b=Math.max(b,P),k=Math.max(k,j)}if(a){let P=0,j=0;l&&D>0?P=Me(p+D,a[0][0]):!l&&D<0&&(P=Ce(p+z,a[1][0])),c&&T>0?j=Me(w+T,a[0][1]):!c&&T<0&&(j=Ce(w+E,a[1][1])),b=Math.max(b,P),k=Math.max(k,j)}if(r){if(u){const P=At(z/N,x,_)*N;if(b=Math.max(b,P),i){let j=0;!l&&!c||l&&!c&&f?j=Me(w+$+z/N,i[1][1])*N:j=Ce(w+$+(l?D:-D)/N,i[0][1])*N,b=Math.max(b,j)}if(a){let j=0;!l&&!c||l&&!c&&f?j=Ce(w+z/N,a[1][1])*N:j=Me(w+(l?D:-D)/N,a[0][1])*N,b=Math.max(b,j)}}if(d){const P=At(E*N,y,v)/N;if(k=Math.max(k,P),i){let j=0;!l&&!c||c&&!l&&f?j=Me(p+E*N+L,i[1][0])/N:j=Ce(p+(c?T:-T)*N+L,i[0][0])/N,k=Math.max(k,j)}if(a){let j=0;!l&&!c||c&&!l&&f?j=Ce(p+E*N,a[1][0])/N:j=Me(p+(c?T:-T)*N,a[0][0])/N,k=Math.max(k,j)}}}T=T+(T<0?k:-k),D=D+(D<0?b:-b),r&&(f?z>E*N?T=(or(l,c)?-D:D)/N:D=(or(l,c)?-T:T)*N:u?(T=D/N,c=l):(D=T*N,l=c));const I=l?p+D:p,A=c?w+T:w;return{width:M+(l?-D:D),height:S+(c?-T:T),x:s[0]*D*(l?-1:1)+I,y:s[1]*T*(c?-1:1)+A}}const fi={width:0,height:0,x:0,y:0},ih={...fi,pointerX:0,pointerY:0,aspectRatio:1};function ah(e){return[[0,0],[e.measured.width,e.measured.height]]}function ch(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,s=e.measured.width??0,i=e.measured.height??0,a=n[0]*s,l=n[1]*i;return[[o-a,r-l],[o+s-a,r+i-l]]}function lh({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const s=ce(e);let i={controlDirection:nr("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:c,boundaries:u,keepAspectRatio:d,resizeDirection:f,onResizeStart:g,onResize:m,onResizeEnd:y,shouldResize:v}){let x={...fi},_={...ih};i={boundaries:u,resizeDirection:f,keepAspectRatio:d,controlDirection:nr(c)};let p,w=null,M=[],S,N,D,T=!1;const z=Cs().on("start",E=>{const{nodeLookup:L,transform:$,snapGrid:b,snapToGrid:k,nodeOrigin:I,paneDomNode:A}=n();if(p=L.get(t),!p)return;w=A?.getBoundingClientRect()??null;const{xSnapped:P,ySnapped:j}=ht(E.sourceEvent,{transform:$,snapGrid:b,snapToGrid:k,containerBounds:w});x={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},_={...x,pointerX:P,pointerY:j,aspectRatio:x.width/x.height},S=void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(S=L.get(p.parentId),N=S&&p.extent==="parent"?ah(S):void 0),M=[],D=void 0;for(const[O,H]of L)if(H.parentId===t&&(M.push({id:O,position:{...H.position},extent:H.extent}),H.extent==="parent"||H.expandParent)){const R=ch(H,p,H.origin??I);D?D=[[Math.min(R[0][0],D[0][0]),Math.min(R[0][1],D[0][1])],[Math.max(R[1][0],D[1][0]),Math.max(R[1][1],D[1][1])]]:D=R}g?.(E,{...x})}).on("drag",E=>{const{transform:L,snapGrid:$,snapToGrid:b,nodeOrigin:k}=n(),I=ht(E.sourceEvent,{transform:L,snapGrid:$,snapToGrid:b,containerBounds:w}),A=[];if(!p)return;const{x:P,y:j,width:O,height:H}=x,R={},F=p.origin??k,{width:B,height:q,x:K,y:Y}=sh(_,i.controlDirection,I,i.boundaries,i.keepAspectRatio,F,N,D),V=B!==O,X=q!==H,Q=K!==P&&V,U=Y!==j&&X;if(!Q&&!U&&!V&&!X)return;if((Q||U||F[0]===1||F[1]===1)&&(R.x=Q?K:x.x,R.y=U?Y:x.y,x.x=R.x,x.y=R.y,M.length>0)){const ne=K-P,te=Y-j;for(const ae of M)ae.position={x:ae.position.x-ne+F[0]*(B-O),y:ae.position.y-te+F[1]*(q-H)},A.push(ae)}if((V||X)&&(R.width=V&&(!i.resizeDirection||i.resizeDirection==="horizontal")?B:x.width,R.height=X&&(!i.resizeDirection||i.resizeDirection==="vertical")?q:x.height,x.width=R.width,x.height=R.height),S&&p.expandParent){const ne=F[0]*(R.width??0);R.x&&R.x<ne&&(x.x=ne,_.x=_.x-(R.x-ne));const te=F[1]*(R.height??0);R.y&&R.y<te&&(x.y=te,_.y=_.y-(R.y-te))}const W=rh({width:x.width,prevWidth:O,height:x.height,prevHeight:H,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),Z={...x,direction:W};v?.(E,Z)!==!1&&(T=!0,m?.(E,Z),o(R,A))}).on("end",E=>{T&&(y?.(E,{...x}),r?.({...x}),T=!1)});s.call(z)}function l(){s.on(".drag",null)}return{update:a,destroy:l}}const uh={},rr=e=>{let t;const n=new Set,o=(u,d)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const g=t;t=d??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(m=>m(t,g))}},r=()=>t,l={setState:o,getState:r,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(uh?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},c=t=e(o,r,l);return l},dh=e=>e?rr(e):rr,{useDebugValue:fh}=ue,{useSyncExternalStoreWithSelector:hh}=uc,mh=e=>e;function hi(e,t=mh,n){const o=hh(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return fh(o),o}const sr=(e,t)=>{const n=dh(e),o=(r,s=t)=>hi(n,r,s);return Object.assign(o,n),o},gh=(e,t)=>e?sr(e,t):sr;function oe(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const mn=C.createContext(null),ph=mn.Provider,mi=pe.error001();function J(e,t){const n=C.useContext(mn);if(n===null)throw new Error(mi);return hi(n,e,t)}function re(){const e=C.useContext(mn);if(e===null)throw new Error(mi);return C.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const ir={display:"none"},yh={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},gi="react-flow__node-desc",pi="react-flow__edge-desc",xh="react-flow__aria-live",vh=e=>e.ariaLiveMessage,wh=e=>e.ariaLabelConfig;function bh({rfId:e}){const t=J(vh);return h.jsx("div",{id:`${xh}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:yh,children:t})}function _h({rfId:e,disableKeyboardA11y:t}){const n=J(wh);return h.jsxs(h.Fragment,{children:[h.jsx("div",{id:`${gi}-${e}`,style:ir,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),h.jsx("div",{id:`${pi}-${e}`,style:ir,children:n["edge.a11yDescription.default"]}),!t&&h.jsx(bh,{rfId:e})]})}const gn=C.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},s)=>{const i=`${e}`.split("-");return h.jsx("div",{className:ie(["react-flow__panel",n,...i]),style:o,ref:s,...r,children:t})});gn.displayName="Panel";function Sh({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:h.jsx(gn,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:h.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Nh=e=>{const t=[],n=[];for(const[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(const[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},Dt=e=>e.id;function Eh(e,t){return oe(e.selectedNodes.map(Dt),t.selectedNodes.map(Dt))&&oe(e.selectedEdges.map(Dt),t.selectedEdges.map(Dt))}function Ch({onSelectionChange:e}){const t=re(),{selectedNodes:n,selectedEdges:o}=J(Nh,Eh);return C.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(s=>s(r))},[n,o,e]),null}const Mh=e=>!!e.onSelectionChangeHandlers;function Ih({onSelectionChange:e}){const t=J(Mh);return e||t?h.jsx(Ch,{onSelectionChange:e}):null}const yi=[0,0],kh={x:0,y:0,zoom:1},Ph=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],ar=[...Ph,"rfId"],jh=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),cr={translateExtent:yt,nodeOrigin:yi,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Th(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:s,setNodeExtent:i,reset:a,setDefaultNodesAndEdges:l}=J(jh,oe),c=re();C.useEffect(()=>(l(e.defaultNodes,e.defaultEdges),()=>{u.current=cr,a()}),[]);const u=C.useRef(cr);return C.useEffect(()=>{for(const d of ar){const f=e[d],g=u.current[d];f!==g&&(typeof e[d]>"u"||(d==="nodes"?t(f):d==="edges"?n(f):d==="minZoom"?o(f):d==="maxZoom"?r(f):d==="translateExtent"?s(f):d==="nodeExtent"?i(f):d==="ariaLabelConfig"?c.setState({ariaLabelConfig:bf(f)}):d==="fitView"?c.setState({fitViewQueued:f}):d==="fitViewOptions"?c.setState({fitViewOptions:f}):c.setState({[d]:f})))}u.current=e},ar.map(d=>e[d])),null}function lr(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Ah(e){const[t,n]=C.useState(e==="system"?null:e);return C.useEffect(()=>{if(e!=="system"){n(e);return}const o=lr(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:lr()?.matches?"dark":"light"}const ur=typeof document<"u"?document:null;function bt(e=null,t={target:ur,actInsideInputWithModifier:!0}){const[n,o]=C.useState(!1),r=C.useRef(!1),s=C.useRef(new Set([])),[i,a]=C.useMemo(()=>{if(e!==null){const c=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",`
1
+ import{r as C,z as Wn,j as h,B as Tn,E as rc,F as ue,H as sc,I as Or,J as ic,L as ac,M as cc,i as lc,c as se,Q as uc,f as ye,V as Zn}from"./index-Ddg6ZSnz.js";import{u as nn,c as je,I as He,n as Gt}from"./use-connection-bHHmK9mi.js";import{C as dc}from"./collection-header-BTdNES9r.js";import{C as fc}from"./collection-page-zdZke2gS.js";import{E as Ye}from"./error-boundary-wmq9HPr0.js";import{u as Te}from"./use-tool-call-D3vebIRo.js";import{u as Se}from"./tooltip-D8OED8cS.js";import{c as on,B as An}from"./button-DGQafcd8.js";import{V as hc}from"./view-mode-toggle-CKl6PJqr.js";import{i as mc}from"./GitBranch01-D-IJ3Rmm.js";import{s as Rr}from"./Plus-BICwTwx2.js";import{i as Hr}from"./CpuChip02-C8zbTCUz.js";import{u as Vr}from"./use-gateway-Dz9z17ME.js";import{i as ze,a as ko,b as gc,c as Po,d as bn,e as _n,f as Br,s as Fr,D as Kn,g as Gr,h as pc,Z as Un,L as Qn,u as Xr,j as yc,k as xc,l as Dn,m as Yr,n as Jn,o as qr,p as Wr,q as Zr,r as vc,t as wc,v as bc,w as jo,x as _c,y as Kr,z as Ur,R as Sc,S as Nc,A as Ec,B as Qr,C as Cc,E as Mc,F as Ic,G as kc,H as Pc,I as jc,J as Jr,K as To,M as Tc,N as Ac,O as ct,P as Dc,Q as Lc,T as $c,U as zc,V as Oc,W as Rc,X as Hc,Y as Vc,_ as Bc,$ as Ae,a0 as Fc,a1 as Gc,a2 as rn}from"./types-DJryM_sg.js";import{B as Xc}from"./badge-C1bAg12O.js";import"./collection-display-button-KGOe_g_c.js";import"./dropdown-menu-B9xMQj69.js";import"./Grid01-BGAyn8Yw.js";import"./useQuery-BvjuXhZf.js";import"./index-D0CEOhNr.js";import"./popover-CgilhutT.js";import"./Copy01-Bsnbushh.js";import"./Key01-BVEDd5ss.js";import"./Play-DMQjilHa.js";import"./json-syntax-highlighter-C24L-Dcz.js";const es=({size:e=24,color:t="currentColor",...n})=>C.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},C.createElement("path",{d:"M18 20V10m-6 10V4M6 20v-6"}));es.displayName="BarChart01";const ts=({size:e=24,color:t="currentColor",...n})=>C.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},C.createElement("path",{d:"M5.52 2.64 3.96 4.72c-.309.412-.463.618-.46.79a.5.5 0 0 0 .192.384C3.828 6 4.085 6 4.6 6h14.8c.515 0 .773 0 .908-.106a.5.5 0 0 0 .192-.384c.003-.172-.151-.378-.46-.79l-1.56-2.08m-12.96 0c.176-.235.264-.352.376-.437a1 1 0 0 1 .33-.165C6.36 2 6.505 2 6.8 2h10.4c.293 0 .44 0 .575.038a1 1 0 0 1 .33.165c.111.085.199.202.375.437m-12.96 0L3.64 5.147c-.237.316-.356.475-.44.649a2 2 0 0 0-.163.487C3 6.473 3 6.671 3 7.067V18.8c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C4.52 22 5.08 22 6.2 22h11.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C21 20.48 21 19.92 21 18.8V7.067c0-.396 0-.594-.037-.784a1.998 1.998 0 0 0-.163-.487c-.084-.174-.203-.333-.44-.65L18.48 2.64M16 10a4 4 0 1 1-8 0"}));ts.displayName="ShoppingBag01";function De(){const e=new Date,t=new Date;t.setHours(e.getHours()-24),t.setSeconds(0,0);const n=new Date(e);return n.setHours(n.getHours()+1),n.setSeconds(0,0),{startDate:t.toISOString(),endDate:n.toISOString()}}var ns="Toggle",os=C.forwardRef((e,t)=>{const{pressed:n,defaultPressed:o,onPressedChange:r,...s}=e,[i,a]=Wn({prop:n,onChange:r,defaultProp:o??!1,caller:ns});return h.jsx(Tn.button,{type:"button","aria-pressed":i,"data-state":i?"on":"off","data-disabled":e.disabled?"":void 0,...s,ref:t,onClick:rc(e.onClick,()=>{e.disabled||a(!i)})})});os.displayName=ns;var Le="ToggleGroup",[rs]=sc(Le,[Or]),ss=Or(),eo=ue.forwardRef((e,t)=>{const{type:n,...o}=e;if(n==="single"){const r=o;return h.jsx(Yc,{...r,ref:t})}if(n==="multiple"){const r=o;return h.jsx(qc,{...r,ref:t})}throw new Error(`Missing prop \`type\` expected on \`${Le}\``)});eo.displayName=Le;var[is,as]=rs(Le),Yc=ue.forwardRef((e,t)=>{const{value:n,defaultValue:o,onValueChange:r=()=>{},...s}=e,[i,a]=Wn({prop:n,defaultProp:o??"",onChange:r,caller:Le});return h.jsx(is,{scope:e.__scopeToggleGroup,type:"single",value:ue.useMemo(()=>i?[i]:[],[i]),onItemActivate:a,onItemDeactivate:ue.useCallback(()=>a(""),[a]),children:h.jsx(cs,{...s,ref:t})})}),qc=ue.forwardRef((e,t)=>{const{value:n,defaultValue:o,onValueChange:r=()=>{},...s}=e,[i,a]=Wn({prop:n,defaultProp:o??[],onChange:r,caller:Le}),l=ue.useCallback(u=>a((d=[])=>[...d,u]),[a]),c=ue.useCallback(u=>a((d=[])=>d.filter(f=>f!==u)),[a]);return h.jsx(is,{scope:e.__scopeToggleGroup,type:"multiple",value:i,onItemActivate:l,onItemDeactivate:c,children:h.jsx(cs,{...s,ref:t})})});eo.displayName=Le;var[Wc,Zc]=rs(Le),cs=ue.forwardRef((e,t)=>{const{__scopeToggleGroup:n,disabled:o=!1,rovingFocus:r=!0,orientation:s,dir:i,loop:a=!0,...l}=e,c=ss(n),u=ac(i),d={role:"group",dir:u,...l};return h.jsx(Wc,{scope:n,rovingFocus:r,disabled:o,children:r?h.jsx(cc,{asChild:!0,...c,orientation:s,dir:u,loop:a,children:h.jsx(Tn.div,{...d,ref:t})}):h.jsx(Tn.div,{...d,ref:t})})}),Xt="ToggleGroupItem",ls=ue.forwardRef((e,t)=>{const n=as(Xt,e.__scopeToggleGroup),o=Zc(Xt,e.__scopeToggleGroup),r=ss(e.__scopeToggleGroup),s=n.value.includes(e.value),i=o.disabled||e.disabled,a={...e,pressed:s,disabled:i},l=ue.useRef(null);return o.rovingFocus?h.jsx(ic,{asChild:!0,...r,focusable:!i,active:s,ref:l,children:h.jsx(Ao,{...a,ref:t})}):h.jsx(Ao,{...a,ref:t})});ls.displayName=Xt;var Ao=ue.forwardRef((e,t)=>{const{__scopeToggleGroup:n,value:o,...r}=e,s=as(Xt,n),i={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},a=s.type==="single"?i:void 0;return h.jsx(os,{...a,...r,ref:t,onPressedChange:l=>{l?s.onItemActivate(o):s.onItemDeactivate(o)}})}),Kc=eo,Uc=ls;const Qc=lc("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-2 min-w-9",sm:"h-7 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}}),us=C.createContext({size:"default",variant:"default"});function ds(e){const t=se.c(20);let n,o,r,s,i;t[0]!==e?({className:o,variant:i,size:s,children:n,...r}=e,t[0]=e,t[1]=n,t[2]=o,t[3]=r,t[4]=s,t[5]=i):(n=t[1],o=t[2],r=t[3],s=t[4],i=t[5]);let a;t[6]!==o?(a=on("group/toggle-group flex w-fit items-center rounded-md data-[variant=outline]:shadow-xs",o),t[6]=o,t[7]=a):a=t[7];let l;t[8]!==s||t[9]!==i?(l={variant:i,size:s},t[8]=s,t[9]=i,t[10]=l):l=t[10];let c;t[11]!==n||t[12]!==l?(c=h.jsx(us.Provider,{value:l,children:n}),t[11]=n,t[12]=l,t[13]=c):c=t[13];let u;return t[14]!==r||t[15]!==s||t[16]!==a||t[17]!==c||t[18]!==i?(u=h.jsx(Kc,{"data-slot":"toggle-group","data-variant":i,"data-size":s,className:a,...r,children:c}),t[14]=r,t[15]=s,t[16]=a,t[17]=c,t[18]=i,t[19]=u):u=t[19],u}function Ze(e){const t=se.c(18);let n,o,r,s,i;t[0]!==e?({className:o,children:n,variant:i,size:s,...r}=e,t[0]=e,t[1]=n,t[2]=o,t[3]=r,t[4]=s,t[5]=i):(n=t[1],o=t[2],r=t[3],s=t[4],i=t[5]);const a=C.useContext(us),l=a.variant||i,c=a.size||s;let u;t[6]!==o||t[7]!==a.size||t[8]!==a.variant||t[9]!==s||t[10]!==i?(u=on(Qc({variant:a.variant||i,size:a.size||s}),"min-w-0 flex-1 shrink-0 rounded-none shadow-none first:rounded-l-md last:rounded-r-md focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0 data-[variant=outline]:first:border-l",o),t[6]=o,t[7]=a.size,t[8]=a.variant,t[9]=s,t[10]=i,t[11]=u):u=t[11];let d;return t[12]!==n||t[13]!==r||t[14]!==l||t[15]!==c||t[16]!==u?(d=h.jsx(Uc,{"data-slot":"toggle-group-item","data-variant":l,"data-size":c,className:u,...r,children:n}),t[12]=n,t[13]=r,t[14]=l,t[15]=c,t[16]=u,t[17]=d):d=t[17],d}function ie(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n<e.length;n++)(o=ie(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Jc={value:()=>{}};function sn(){for(var e=0,t=arguments.length,n={},o;e<t;++e){if(!(o=arguments[e]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new zt(n)}function zt(e){this._=e}function el(e,t){return e.trim().split(/^|\s+/).map(function(n){var o="",r=n.indexOf(".");if(r>=0&&(o=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}zt.prototype=sn.prototype={constructor:zt,on:function(e,t){var n=this._,o=el(e+"",n),r,s=-1,i=o.length;if(arguments.length<2){for(;++s<i;)if((r=(e=o[s]).type)&&(r=tl(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<i;)if(r=(e=o[s]).type)n[r]=Do(n[r],e.name,t);else if(t==null)for(r in n)n[r]=Do(n[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new zt(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,s;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],o=0,r=s.length;o<r;++o)s[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,s=o.length;r<s;++r)o[r].value.apply(t,n)}};function tl(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function Do(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=Jc,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var Ln="http://www.w3.org/1999/xhtml";const Lo={svg:"http://www.w3.org/2000/svg",xhtml:Ln,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function an(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Lo.hasOwnProperty(t)?{space:Lo[t],local:e}:e}function nl(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Ln&&t.documentElement.namespaceURI===Ln?t.createElement(e):t.createElementNS(n,e)}}function ol(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function fs(e){var t=an(e);return(t.local?ol:nl)(t)}function rl(){}function to(e){return e==null?rl:function(){return this.querySelector(e)}}function sl(e){typeof e!="function"&&(e=to(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=new Array(i),l,c,u=0;u<i;++u)(l=s[u])&&(c=e.call(l,l.__data__,u,s))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new le(o,this._parents)}function il(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function al(){return[]}function hs(e){return e==null?al:function(){return this.querySelectorAll(e)}}function cl(e){return function(){return il(e.apply(this,arguments))}}function ll(e){typeof e=="function"?e=cl(e):e=hs(e);for(var t=this._groups,n=t.length,o=[],r=[],s=0;s<n;++s)for(var i=t[s],a=i.length,l,c=0;c<a;++c)(l=i[c])&&(o.push(e.call(l,l.__data__,c,i)),r.push(l));return new le(o,r)}function ms(e){return function(){return this.matches(e)}}function gs(e){return function(t){return t.matches(e)}}var ul=Array.prototype.find;function dl(e){return function(){return ul.call(this.children,e)}}function fl(){return this.firstElementChild}function hl(e){return this.select(e==null?fl:dl(typeof e=="function"?e:gs(e)))}var ml=Array.prototype.filter;function gl(){return Array.from(this.children)}function pl(e){return function(){return ml.call(this.children,e)}}function yl(e){return this.selectAll(e==null?gl:pl(typeof e=="function"?e:gs(e)))}function xl(e){typeof e!="function"&&(e=ms(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=[],l,c=0;c<i;++c)(l=s[c])&&e.call(l,l.__data__,c,s)&&a.push(l);return new le(o,this._parents)}function ps(e){return new Array(e.length)}function vl(){return new le(this._enter||this._groups.map(ps),this._parents)}function Yt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Yt.prototype={constructor:Yt,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function wl(e){return function(){return e}}function bl(e,t,n,o,r,s){for(var i=0,a,l=t.length,c=s.length;i<c;++i)(a=t[i])?(a.__data__=s[i],o[i]=a):n[i]=new Yt(e,s[i]);for(;i<l;++i)(a=t[i])&&(r[i]=a)}function _l(e,t,n,o,r,s,i){var a,l,c=new Map,u=t.length,d=s.length,f=new Array(u),g;for(a=0;a<u;++a)(l=t[a])&&(f[a]=g=i.call(l,l.__data__,a,t)+"",c.has(g)?r[a]=l:c.set(g,l));for(a=0;a<d;++a)g=i.call(e,s[a],a,s)+"",(l=c.get(g))?(o[a]=l,l.__data__=s[a],c.delete(g)):n[a]=new Yt(e,s[a]);for(a=0;a<u;++a)(l=t[a])&&c.get(f[a])===l&&(r[a]=l)}function Sl(e){return e.__data__}function Nl(e,t){if(!arguments.length)return Array.from(this,Sl);var n=t?_l:bl,o=this._parents,r=this._groups;typeof e!="function"&&(e=wl(e));for(var s=r.length,i=new Array(s),a=new Array(s),l=new Array(s),c=0;c<s;++c){var u=o[c],d=r[c],f=d.length,g=El(e.call(u,u&&u.__data__,c,o)),m=g.length,y=a[c]=new Array(m),v=i[c]=new Array(m),x=l[c]=new Array(f);n(u,d,y,v,x,g,t);for(var _=0,p=0,w,M;_<m;++_)if(w=y[_]){for(_>=p&&(p=_+1);!(M=v[p])&&++p<m;);w._next=M||null}}return i=new le(i,o),i._enter=a,i._exit=l,i}function El(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Cl(){return new le(this._exit||this._groups.map(ps),this._parents)}function Ml(e,t,n){var o=this.enter(),r=this,s=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?s.remove():n(s),o&&r?o.merge(r).order():r}function Il(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,s=o.length,i=Math.min(r,s),a=new Array(r),l=0;l<i;++l)for(var c=n[l],u=o[l],d=c.length,f=a[l]=new Array(d),g,m=0;m<d;++m)(g=c[m]||u[m])&&(f[m]=g);for(;l<r;++l)a[l]=n[l];return new le(a,this._parents)}function kl(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,s=o[r],i;--r>=0;)(i=o[r])&&(s&&i.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(i,s),s=i);return this}function Pl(e){e||(e=jl);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,o=n.length,r=new Array(o),s=0;s<o;++s){for(var i=n[s],a=i.length,l=r[s]=new Array(a),c,u=0;u<a;++u)(c=i[u])&&(l[u]=c);l.sort(t)}return new le(r,this._parents).order()}function jl(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Tl(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Al(){return Array.from(this)}function Dl(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,s=o.length;r<s;++r){var i=o[r];if(i)return i}return null}function Ll(){let e=0;for(const t of this)++e;return e}function $l(){return!this.node()}function zl(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],s=0,i=r.length,a;s<i;++s)(a=r[s])&&e.call(a,a.__data__,s,r);return this}function Ol(e){return function(){this.removeAttribute(e)}}function Rl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Hl(e,t){return function(){this.setAttribute(e,t)}}function Vl(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Bl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Fl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Gl(e,t){var n=an(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?Rl:Ol:typeof t=="function"?n.local?Fl:Bl:n.local?Vl:Hl)(n,t))}function ys(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Xl(e){return function(){this.style.removeProperty(e)}}function Yl(e,t,n){return function(){this.style.setProperty(e,t,n)}}function ql(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Wl(e,t,n){return arguments.length>1?this.each((t==null?Xl:typeof t=="function"?ql:Yl)(e,t,n??"")):Ue(this.node(),e)}function Ue(e,t){return e.style.getPropertyValue(t)||ys(e).getComputedStyle(e,null).getPropertyValue(t)}function Zl(e){return function(){delete this[e]}}function Kl(e,t){return function(){this[e]=t}}function Ul(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Ql(e,t){return arguments.length>1?this.each((t==null?Zl:typeof t=="function"?Ul:Kl)(e,t)):this.node()[e]}function xs(e){return e.trim().split(/^|\s+/)}function no(e){return e.classList||new vs(e)}function vs(e){this._node=e,this._names=xs(e.getAttribute("class")||"")}vs.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function ws(e,t){for(var n=no(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function bs(e,t){for(var n=no(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function Jl(e){return function(){ws(this,e)}}function eu(e){return function(){bs(this,e)}}function tu(e,t){return function(){(t.apply(this,arguments)?ws:bs)(this,e)}}function nu(e,t){var n=xs(e+"");if(arguments.length<2){for(var o=no(this.node()),r=-1,s=n.length;++r<s;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?tu:t?Jl:eu)(n,t))}function ou(){this.textContent=""}function ru(e){return function(){this.textContent=e}}function su(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function iu(e){return arguments.length?this.each(e==null?ou:(typeof e=="function"?su:ru)(e)):this.node().textContent}function au(){this.innerHTML=""}function cu(e){return function(){this.innerHTML=e}}function lu(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function uu(e){return arguments.length?this.each(e==null?au:(typeof e=="function"?lu:cu)(e)):this.node().innerHTML}function du(){this.nextSibling&&this.parentNode.appendChild(this)}function fu(){return this.each(du)}function hu(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function mu(){return this.each(hu)}function gu(e){var t=typeof e=="function"?e:fs(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function pu(){return null}function yu(e,t){var n=typeof e=="function"?e:fs(e),o=t==null?pu:typeof t=="function"?t:to(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function xu(){var e=this.parentNode;e&&e.removeChild(this)}function vu(){return this.each(xu)}function wu(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function bu(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function _u(e){return this.select(e?bu:wu)}function Su(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Nu(e){return function(t){e.call(this,t,this.__data__)}}function Eu(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function Cu(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,s;n<r;++n)s=t[n],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++o]=s;++o?t.length=o:delete this.__on}}}function Mu(e,t,n){return function(){var o=this.__on,r,s=Nu(t);if(o){for(var i=0,a=o.length;i<a;++i)if((r=o[i]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=s,r.options=n),r.value=t;return}}this.addEventListener(e.type,s,n),r={type:e.type,name:e.name,value:t,listener:s,options:n},o?o.push(r):this.__on=[r]}}function Iu(e,t,n){var o=Eu(e+""),r,s=o.length,i;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(r=0,u=a[l];r<s;++r)if((i=o[r]).type===u.type&&i.name===u.name)return u.value}return}for(a=t?Mu:Cu,r=0;r<s;++r)this.each(a(o[r],t,n));return this}function _s(e,t,n){var o=ys(e),r=o.CustomEvent;typeof r=="function"?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function ku(e,t){return function(){return _s(this,e,t)}}function Pu(e,t){return function(){return _s(this,e,t.apply(this,arguments))}}function ju(e,t){return this.each((typeof t=="function"?Pu:ku)(e,t))}function*Tu(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,s=o.length,i;r<s;++r)(i=o[r])&&(yield i)}var Ss=[null];function le(e,t){this._groups=e,this._parents=t}function St(){return new le([[document.documentElement]],Ss)}function Au(){return this}le.prototype=St.prototype={constructor:le,select:sl,selectAll:ll,selectChild:hl,selectChildren:yl,filter:xl,data:Nl,enter:vl,exit:Cl,join:Ml,merge:Il,selection:Au,order:kl,sort:Pl,call:Tl,nodes:Al,node:Dl,size:Ll,empty:$l,each:zl,attr:Gl,style:Wl,property:Ql,classed:nu,text:iu,html:uu,raise:fu,lower:mu,append:gu,insert:yu,remove:vu,clone:_u,datum:Su,on:Iu,dispatch:ju,[Symbol.iterator]:Tu};function ce(e){return typeof e=="string"?new le([[document.querySelector(e)]],[document.documentElement]):new le([[e]],Ss)}function Du(e){let t;for(;t=e.sourceEvent;)e=t;return e}function de(e,t){if(e=Du(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}const Lu={passive:!1},gt={capture:!0,passive:!1};function Sn(e){e.stopImmediatePropagation()}function Ke(e){e.preventDefault(),e.stopImmediatePropagation()}function Ns(e){var t=e.document.documentElement,n=ce(e).on("dragstart.drag",Ke,gt);"onselectstart"in t?n.on("selectstart.drag",Ke,gt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Es(e,t){var n=e.document.documentElement,o=ce(e).on("dragstart.drag",null);t&&(o.on("click.drag",Ke,gt),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const kt=e=>()=>e;function $n(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:s,x:i,y:a,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}$n.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function $u(e){return!e.ctrlKey&&!e.button}function zu(){return this.parentNode}function Ou(e,t){return t??{x:e.x,y:e.y}}function Ru(){return navigator.maxTouchPoints||"ontouchstart"in this}function Cs(){var e=$u,t=zu,n=Ou,o=Ru,r={},s=sn("start","drag","end"),i=0,a,l,c,u,d=0;function f(w){w.on("mousedown.drag",g).filter(o).on("touchstart.drag",v).on("touchmove.drag",x,Lu).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(w,M){if(!(u||!e.call(this,w,M))){var S=p(this,t.call(this,w,M),w,M,"mouse");S&&(ce(w.view).on("mousemove.drag",m,gt).on("mouseup.drag",y,gt),Ns(w.view),Sn(w),c=!1,a=w.clientX,l=w.clientY,S("start",w))}}function m(w){if(Ke(w),!c){var M=w.clientX-a,S=w.clientY-l;c=M*M+S*S>d}r.mouse("drag",w)}function y(w){ce(w.view).on("mousemove.drag mouseup.drag",null),Es(w.view,c),Ke(w),r.mouse("end",w)}function v(w,M){if(e.call(this,w,M)){var S=w.changedTouches,N=t.call(this,w,M),D=S.length,T,z;for(T=0;T<D;++T)(z=p(this,N,w,M,S[T].identifier,S[T]))&&(Sn(w),z("start",w,S[T]))}}function x(w){var M=w.changedTouches,S=M.length,N,D;for(N=0;N<S;++N)(D=r[M[N].identifier])&&(Ke(w),D("drag",w,M[N]))}function _(w){var M=w.changedTouches,S=M.length,N,D;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),N=0;N<S;++N)(D=r[M[N].identifier])&&(Sn(w),D("end",w,M[N]))}function p(w,M,S,N,D,T){var z=s.copy(),E=de(T||S,M),L,$,b;if((b=n.call(w,new $n("beforestart",{sourceEvent:S,target:f,identifier:D,active:i,x:E[0],y:E[1],dx:0,dy:0,dispatch:z}),N))!=null)return L=b.x-E[0]||0,$=b.y-E[1]||0,function k(I,A,P){var j=E,O;switch(I){case"start":r[D]=k,O=i++;break;case"end":delete r[D],--i;case"drag":E=de(P||A,M),O=i;break}z.call(I,w,new $n(I,{sourceEvent:A,subject:b,target:f,identifier:D,active:O,x:E[0]+L,y:E[1]+$,dx:E[0]-j[0],dy:E[1]-j[1],dispatch:z}),N)}}return f.filter=function(w){return arguments.length?(e=typeof w=="function"?w:kt(!!w),f):e},f.container=function(w){return arguments.length?(t=typeof w=="function"?w:kt(w),f):t},f.subject=function(w){return arguments.length?(n=typeof w=="function"?w:kt(w),f):n},f.touchable=function(w){return arguments.length?(o=typeof w=="function"?w:kt(!!w),f):o},f.on=function(){var w=s.on.apply(s,arguments);return w===s?f:w},f.clickDistance=function(w){return arguments.length?(d=(w=+w)*w,f):Math.sqrt(d)},f}var $o=180/Math.PI,zn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ms(e,t,n,o,r,s){var i,a,l;return(i=Math.sqrt(e*e+t*t))&&(e/=i,t/=i),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,l/=a),e*o<t*n&&(e=-e,t=-t,l=-l,i=-i),{translateX:r,translateY:s,rotate:Math.atan2(t,e)*$o,skewX:Math.atan(l)*$o,scaleX:i,scaleY:a}}var Pt;function Hu(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?zn:Ms(t.a,t.b,t.c,t.d,t.e,t.f)}function Vu(e){return e==null||(Pt||(Pt=document.createElementNS("http://www.w3.org/2000/svg","g")),Pt.setAttribute("transform",e),!(e=Pt.transform.baseVal.consolidate()))?zn:(e=e.matrix,Ms(e.a,e.b,e.c,e.d,e.e,e.f))}function Is(e,t,n,o){function r(c){return c.length?c.pop()+" ":""}function s(c,u,d,f,g,m){if(c!==d||u!==f){var y=g.push("translate(",null,t,null,n);m.push({i:y-4,x:ze(c,d)},{i:y-2,x:ze(u,f)})}else(d||f)&&g.push("translate("+d+t+f+n)}function i(c,u,d,f){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),f.push({i:d.push(r(d)+"rotate(",null,o)-2,x:ze(c,u)})):u&&d.push(r(d)+"rotate("+u+o)}function a(c,u,d,f){c!==u?f.push({i:d.push(r(d)+"skewX(",null,o)-2,x:ze(c,u)}):u&&d.push(r(d)+"skewX("+u+o)}function l(c,u,d,f,g,m){if(c!==d||u!==f){var y=g.push(r(g)+"scale(",null,",",null,")");m.push({i:y-4,x:ze(c,d)},{i:y-2,x:ze(u,f)})}else(d!==1||f!==1)&&g.push(r(g)+"scale("+d+","+f+")")}return function(c,u){var d=[],f=[];return c=e(c),u=e(u),s(c.translateX,c.translateY,u.translateX,u.translateY,d,f),i(c.rotate,u.rotate,d,f),a(c.skewX,u.skewX,d,f),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,d,f),c=u=null,function(g){for(var m=-1,y=f.length,v;++m<y;)d[(v=f[m]).i]=v.x(g);return d.join("")}}}var Bu=Is(Hu,"px, ","px)","deg)"),Fu=Is(Vu,", ",")",")"),Gu=1e-12;function zo(e){return((e=Math.exp(e))+1/e)/2}function Xu(e){return((e=Math.exp(e))-1/e)/2}function Yu(e){return((e=Math.exp(2*e))-1)/(e+1)}const Ot=(function e(t,n,o){function r(s,i){var a=s[0],l=s[1],c=s[2],u=i[0],d=i[1],f=i[2],g=u-a,m=d-l,y=g*g+m*m,v,x;if(y<Gu)x=Math.log(f/c)/t,v=function(N){return[a+N*g,l+N*m,c*Math.exp(t*N*x)]};else{var _=Math.sqrt(y),p=(f*f-c*c+o*y)/(2*c*n*_),w=(f*f-c*c-o*y)/(2*f*n*_),M=Math.log(Math.sqrt(p*p+1)-p),S=Math.log(Math.sqrt(w*w+1)-w);x=(S-M)/t,v=function(N){var D=N*x,T=zo(M),z=c/(n*_)*(T*Yu(t*D+M)-Xu(M));return[a+z*g,l+z*m,c*T/zo(t*D+M)]}}return v.duration=x*1e3*t/Math.SQRT2,v}return r.rho=function(s){var i=Math.max(.001,+s),a=i*i,l=a*a;return e(i,a,l)},r})(Math.SQRT2,2,4);var Qe=0,dt=0,lt=0,ks=1e3,qt,ft,Wt=0,Ve=0,cn=0,pt=typeof performance=="object"&&performance.now?performance:Date,Ps=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function oo(){return Ve||(Ps(qu),Ve=pt.now()+cn)}function qu(){Ve=0}function Zt(){this._call=this._time=this._next=null}Zt.prototype=js.prototype={constructor:Zt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?oo():+n)+(t==null?0:+t),!this._next&&ft!==this&&(ft?ft._next=this:qt=this,ft=this),this._call=e,this._time=n,On()},stop:function(){this._call&&(this._call=null,this._time=1/0,On())}};function js(e,t,n){var o=new Zt;return o.restart(e,t,n),o}function Wu(){oo(),++Qe;for(var e=qt,t;e;)(t=Ve-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Qe}function Oo(){Ve=(Wt=pt.now())+cn,Qe=dt=0;try{Wu()}finally{Qe=0,Ku(),Ve=0}}function Zu(){var e=pt.now(),t=e-Wt;t>ks&&(cn-=t,Wt=e)}function Ku(){for(var e,t=qt,n,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:qt=n);ft=e,On(o)}function On(e){if(!Qe){dt&&(dt=clearTimeout(dt));var t=e-Ve;t>24?(e<1/0&&(dt=setTimeout(Oo,e-pt.now()-cn)),lt&&(lt=clearInterval(lt))):(lt||(Wt=pt.now(),lt=setInterval(Zu,ks)),Qe=1,Ps(Oo))}}function Ro(e,t,n){var o=new Zt;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var Uu=sn("start","end","cancel","interrupt"),Qu=[],Ts=0,Ho=1,Rn=2,Rt=3,Vo=4,Hn=5,Ht=6;function ln(e,t,n,o,r,s){var i=e.__transition;if(!i)e.__transition={};else if(n in i)return;Ju(e,n,{name:t,index:o,group:r,on:Uu,tween:Qu,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Ts})}function ro(e,t){var n=me(e,t);if(n.state>Ts)throw new Error("too late; already scheduled");return n}function xe(e,t){var n=me(e,t);if(n.state>Rt)throw new Error("too late; already running");return n}function me(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Ju(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=js(s,0,n.time);function s(c){n.state=Ho,n.timer.restart(i,n.delay,n.time),n.delay<=c&&i(c-n.delay)}function i(c){var u,d,f,g;if(n.state!==Ho)return l();for(u in o)if(g=o[u],g.name===n.name){if(g.state===Rt)return Ro(i);g.state===Vo?(g.state=Ht,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete o[u]):+u<t&&(g.state=Ht,g.timer.stop(),g.on.call("cancel",e,e.__data__,g.index,g.group),delete o[u])}if(Ro(function(){n.state===Rt&&(n.state=Vo,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=Rn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Rn){for(n.state=Rt,r=new Array(f=n.tween.length),u=0,d=-1;u<f;++u)(g=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++d]=g);r.length=d+1}}function a(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=Hn,1),d=-1,f=r.length;++d<f;)r[d].call(e,u);n.state===Hn&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=Ht,n.timer.stop(),delete o[t];for(var c in o)return;delete e.__transition}}function Vt(e,t){var n=e.__transition,o,r,s=!0,i;if(n){t=t==null?null:t+"";for(i in n){if((o=n[i]).name!==t){s=!1;continue}r=o.state>Rn&&o.state<Hn,o.state=Ht,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[i]}s&&delete e.__transition}}function ed(e){return this.each(function(){Vt(this,e)})}function td(e,t){var n,o;return function(){var r=xe(this,e),s=r.tween;if(s!==n){o=n=s;for(var i=0,a=o.length;i<a;++i)if(o[i].name===t){o=o.slice(),o.splice(i,1);break}}r.tween=o}}function nd(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var s=xe(this,e),i=s.tween;if(i!==o){r=(o=i).slice();for(var a={name:t,value:n},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=a;break}l===c&&r.push(a)}s.tween=r}}function od(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=me(this.node(),n).tween,r=0,s=o.length,i;r<s;++r)if((i=o[r]).name===e)return i.value;return null}return this.each((t==null?td:nd)(n,e,t))}function so(e,t,n){var o=e._id;return e.each(function(){var r=xe(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return me(r,o).value[t]}}function As(e,t){var n;return(typeof t=="number"?ze:t instanceof Po?ko:(n=Po(t))?(t=n,ko):gc)(e,t)}function rd(e){return function(){this.removeAttribute(e)}}function sd(e){return function(){this.removeAttributeNS(e.space,e.local)}}function id(e,t,n){var o,r=n+"",s;return function(){var i=this.getAttribute(e);return i===r?null:i===o?s:s=t(o=i,n)}}function ad(e,t,n){var o,r=n+"",s;return function(){var i=this.getAttributeNS(e.space,e.local);return i===r?null:i===o?s:s=t(o=i,n)}}function cd(e,t,n){var o,r,s;return function(){var i,a=n(this),l;return a==null?void this.removeAttribute(e):(i=this.getAttribute(e),l=a+"",i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a)))}}function ld(e,t,n){var o,r,s;return function(){var i,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(i=this.getAttributeNS(e.space,e.local),l=a+"",i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a)))}}function ud(e,t){var n=an(e),o=n==="transform"?Fu:As;return this.attrTween(e,typeof t=="function"?(n.local?ld:cd)(n,o,so(this,"attr."+e,t)):t==null?(n.local?sd:rd)(n):(n.local?ad:id)(n,o,t))}function dd(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function fd(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function hd(e,t){var n,o;function r(){var s=t.apply(this,arguments);return s!==o&&(n=(o=s)&&fd(e,s)),n}return r._value=t,r}function md(e,t){var n,o;function r(){var s=t.apply(this,arguments);return s!==o&&(n=(o=s)&&dd(e,s)),n}return r._value=t,r}function gd(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var o=an(e);return this.tween(n,(o.local?hd:md)(o,t))}function pd(e,t){return function(){ro(this,e).delay=+t.apply(this,arguments)}}function yd(e,t){return t=+t,function(){ro(this,e).delay=t}}function xd(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?pd:yd)(t,e)):me(this.node(),t).delay}function vd(e,t){return function(){xe(this,e).duration=+t.apply(this,arguments)}}function wd(e,t){return t=+t,function(){xe(this,e).duration=t}}function bd(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?vd:wd)(t,e)):me(this.node(),t).duration}function _d(e,t){if(typeof t!="function")throw new Error;return function(){xe(this,e).ease=t}}function Sd(e){var t=this._id;return arguments.length?this.each(_d(t,e)):me(this.node(),t).ease}function Nd(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;xe(this,e).ease=n}}function Ed(e){if(typeof e!="function")throw new Error;return this.each(Nd(this._id,e))}function Cd(e){typeof e!="function"&&(e=ms(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=[],l,c=0;c<i;++c)(l=s[c])&&e.call(l,l.__data__,c,s)&&a.push(l);return new _e(o,this._parents,this._name,this._id)}function Md(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,s=Math.min(o,r),i=new Array(o),a=0;a<s;++a)for(var l=t[a],c=n[a],u=l.length,d=i[a]=new Array(u),f,g=0;g<u;++g)(f=l[g]||c[g])&&(d[g]=f);for(;a<o;++a)i[a]=t[a];return new _e(i,this._parents,this._name,this._id)}function Id(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function kd(e,t,n){var o,r,s=Id(t)?ro:xe;return function(){var i=s(this,e),a=i.on;a!==o&&(r=(o=a).copy()).on(t,n),i.on=r}}function Pd(e,t){var n=this._id;return arguments.length<2?me(this.node(),n).on.on(e):this.each(kd(n,e,t))}function jd(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Td(){return this.on("end.remove",jd(this._id))}function Ad(e){var t=this._name,n=this._id;typeof e!="function"&&(e=to(e));for(var o=this._groups,r=o.length,s=new Array(r),i=0;i<r;++i)for(var a=o[i],l=a.length,c=s[i]=new Array(l),u,d,f=0;f<l;++f)(u=a[f])&&(d=e.call(u,u.__data__,f,a))&&("__data__"in u&&(d.__data__=u.__data__),c[f]=d,ln(c[f],t,n,f,c,me(u,n)));return new _e(s,this._parents,t,n)}function Dd(e){var t=this._name,n=this._id;typeof e!="function"&&(e=hs(e));for(var o=this._groups,r=o.length,s=[],i=[],a=0;a<r;++a)for(var l=o[a],c=l.length,u,d=0;d<c;++d)if(u=l[d]){for(var f=e.call(u,u.__data__,d,l),g,m=me(u,n),y=0,v=f.length;y<v;++y)(g=f[y])&&ln(g,t,n,y,f,m);s.push(f),i.push(u)}return new _e(s,i,t,n)}var Ld=St.prototype.constructor;function $d(){return new Ld(this._groups,this._parents)}function zd(e,t){var n,o,r;return function(){var s=Ue(this,e),i=(this.style.removeProperty(e),Ue(this,e));return s===i?null:s===n&&i===o?r:r=t(n=s,o=i)}}function Ds(e){return function(){this.style.removeProperty(e)}}function Od(e,t,n){var o,r=n+"",s;return function(){var i=Ue(this,e);return i===r?null:i===o?s:s=t(o=i,n)}}function Rd(e,t,n){var o,r,s;return function(){var i=Ue(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),Ue(this,e))),i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a))}}function Hd(e,t){var n,o,r,s="style."+t,i="end."+s,a;return function(){var l=xe(this,e),c=l.on,u=l.value[s]==null?a||(a=Ds(t)):void 0;(c!==n||r!==u)&&(o=(n=c).copy()).on(i,r=u),l.on=o}}function Vd(e,t,n){var o=(e+="")=="transform"?Bu:As;return t==null?this.styleTween(e,zd(e,o)).on("end.style."+e,Ds(e)):typeof t=="function"?this.styleTween(e,Rd(e,o,so(this,"style."+e,t))).each(Hd(this._id,e)):this.styleTween(e,Od(e,o,t),n).on("end.style."+e,null)}function Bd(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function Fd(e,t,n){var o,r;function s(){var i=t.apply(this,arguments);return i!==r&&(o=(r=i)&&Bd(e,i,n)),o}return s._value=t,s}function Gd(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,Fd(e,t,n??""))}function Xd(e){return function(){this.textContent=e}}function Yd(e){return function(){var t=e(this);this.textContent=t??""}}function qd(e){return this.tween("text",typeof e=="function"?Yd(so(this,"text",e)):Xd(e==null?"":e+""))}function Wd(e){return function(t){this.textContent=e.call(this,t)}}function Zd(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Wd(r)),t}return o._value=e,o}function Kd(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,Zd(e))}function Ud(){for(var e=this._name,t=this._id,n=Ls(),o=this._groups,r=o.length,s=0;s<r;++s)for(var i=o[s],a=i.length,l,c=0;c<a;++c)if(l=i[c]){var u=me(l,t);ln(l,e,n,c,i,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new _e(o,this._parents,e,n)}function Qd(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(s,i){var a={value:i},l={value:function(){--r===0&&s()}};n.each(function(){var c=xe(this,o),u=c.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),r===0&&s()})}var Jd=0;function _e(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Ls(){return++Jd}var we=St.prototype;_e.prototype={constructor:_e,select:Ad,selectAll:Dd,selectChild:we.selectChild,selectChildren:we.selectChildren,filter:Cd,merge:Md,selection:$d,transition:Ud,call:we.call,nodes:we.nodes,node:we.node,size:we.size,empty:we.empty,each:we.each,on:Pd,attr:ud,attrTween:gd,style:Vd,styleTween:Gd,text:qd,textTween:Kd,remove:Td,tween:od,delay:xd,duration:bd,ease:Sd,easeVarying:Ed,end:Qd,[Symbol.iterator]:we[Symbol.iterator]};function ef(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var tf={time:null,delay:0,duration:250,ease:ef};function nf(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function of(e){var t,n;e instanceof _e?(t=e._id,e=e._name):(t=Ls(),(n=tf).time=oo(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,s=0;s<r;++s)for(var i=o[s],a=i.length,l,c=0;c<a;++c)(l=i[c])&&ln(l,e,t,c,i,n||nf(l,t));return new _e(o,this._parents,e,t)}St.prototype.interrupt=ed;St.prototype.transition=of;const jt=e=>()=>e;function rf(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function be(e,t,n){this.k=e,this.x=t,this.y=n}be.prototype={constructor:be,scale:function(e){return e===1?this:new be(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new be(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var un=new be(1,0,0);$s.prototype=be.prototype;function $s(e){for(;!e.__zoom;)if(!(e=e.parentNode))return un;return e.__zoom}function Nn(e){e.stopImmediatePropagation()}function ut(e){e.preventDefault(),e.stopImmediatePropagation()}function sf(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function af(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Bo(){return this.__zoom||un}function cf(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function lf(){return navigator.maxTouchPoints||"ontouchstart"in this}function uf(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],i=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i))}function zs(){var e=sf,t=af,n=uf,o=cf,r=lf,s=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Ot,c=sn("start","zoom","end"),u,d,f,g=500,m=150,y=0,v=10;function x(b){b.property("__zoom",Bo).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",z).filter(r).on("touchstart.zoom",E).on("touchmove.zoom",L).on("touchend.zoom touchcancel.zoom",$).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}x.transform=function(b,k,I,A){var P=b.selection?b.selection():b;P.property("__zoom",Bo),b!==P?M(b,k,I,A):P.interrupt().each(function(){S(this,arguments).event(A).start().zoom(null,typeof k=="function"?k.apply(this,arguments):k).end()})},x.scaleBy=function(b,k,I,A){x.scaleTo(b,function(){var P=this.__zoom.k,j=typeof k=="function"?k.apply(this,arguments):k;return P*j},I,A)},x.scaleTo=function(b,k,I,A){x.transform(b,function(){var P=t.apply(this,arguments),j=this.__zoom,O=I==null?w(P):typeof I=="function"?I.apply(this,arguments):I,H=j.invert(O),R=typeof k=="function"?k.apply(this,arguments):k;return n(p(_(j,R),O,H),P,i)},I,A)},x.translateBy=function(b,k,I,A){x.transform(b,function(){return n(this.__zoom.translate(typeof k=="function"?k.apply(this,arguments):k,typeof I=="function"?I.apply(this,arguments):I),t.apply(this,arguments),i)},null,A)},x.translateTo=function(b,k,I,A,P){x.transform(b,function(){var j=t.apply(this,arguments),O=this.__zoom,H=A==null?w(j):typeof A=="function"?A.apply(this,arguments):A;return n(un.translate(H[0],H[1]).scale(O.k).translate(typeof k=="function"?-k.apply(this,arguments):-k,typeof I=="function"?-I.apply(this,arguments):-I),j,i)},A,P)};function _(b,k){return k=Math.max(s[0],Math.min(s[1],k)),k===b.k?b:new be(k,b.x,b.y)}function p(b,k,I){var A=k[0]-I[0]*b.k,P=k[1]-I[1]*b.k;return A===b.x&&P===b.y?b:new be(b.k,A,P)}function w(b){return[(+b[0][0]+ +b[1][0])/2,(+b[0][1]+ +b[1][1])/2]}function M(b,k,I,A){b.on("start.zoom",function(){S(this,arguments).event(A).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(A).end()}).tween("zoom",function(){var P=this,j=arguments,O=S(P,j).event(A),H=t.apply(P,j),R=I==null?w(H):typeof I=="function"?I.apply(P,j):I,F=Math.max(H[1][0]-H[0][0],H[1][1]-H[0][1]),B=P.__zoom,q=typeof k=="function"?k.apply(P,j):k,K=l(B.invert(R).concat(F/B.k),q.invert(R).concat(F/q.k));return function(Y){if(Y===1)Y=q;else{var V=K(Y),X=F/V[2];Y=new be(X,R[0]-V[0]*X,R[1]-V[1]*X)}O.zoom(null,Y)}})}function S(b,k,I){return!I&&b.__zooming||new N(b,k)}function N(b,k){this.that=b,this.args=k,this.active=0,this.sourceEvent=null,this.extent=t.apply(b,k),this.taps=0}N.prototype={event:function(b){return b&&(this.sourceEvent=b),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(b,k){return this.mouse&&b!=="mouse"&&(this.mouse[1]=k.invert(this.mouse[0])),this.touch0&&b!=="touch"&&(this.touch0[1]=k.invert(this.touch0[0])),this.touch1&&b!=="touch"&&(this.touch1[1]=k.invert(this.touch1[0])),this.that.__zoom=k,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(b){var k=ce(this.that).datum();c.call(b,this.that,new rf(b,{sourceEvent:this.sourceEvent,target:x,transform:this.that.__zoom,dispatch:c}),k)}};function D(b,...k){if(!e.apply(this,arguments))return;var I=S(this,k).event(b),A=this.__zoom,P=Math.max(s[0],Math.min(s[1],A.k*Math.pow(2,o.apply(this,arguments)))),j=de(b);if(I.wheel)(I.mouse[0][0]!==j[0]||I.mouse[0][1]!==j[1])&&(I.mouse[1]=A.invert(I.mouse[0]=j)),clearTimeout(I.wheel);else{if(A.k===P)return;I.mouse=[j,A.invert(j)],Vt(this),I.start()}ut(b),I.wheel=setTimeout(O,m),I.zoom("mouse",n(p(_(A,P),I.mouse[0],I.mouse[1]),I.extent,i));function O(){I.wheel=null,I.end()}}function T(b,...k){if(f||!e.apply(this,arguments))return;var I=b.currentTarget,A=S(this,k,!0).event(b),P=ce(b.view).on("mousemove.zoom",R,!0).on("mouseup.zoom",F,!0),j=de(b,I),O=b.clientX,H=b.clientY;Ns(b.view),Nn(b),A.mouse=[j,this.__zoom.invert(j)],Vt(this),A.start();function R(B){if(ut(B),!A.moved){var q=B.clientX-O,K=B.clientY-H;A.moved=q*q+K*K>y}A.event(B).zoom("mouse",n(p(A.that.__zoom,A.mouse[0]=de(B,I),A.mouse[1]),A.extent,i))}function F(B){P.on("mousemove.zoom mouseup.zoom",null),Es(B.view,A.moved),ut(B),A.event(B).end()}}function z(b,...k){if(e.apply(this,arguments)){var I=this.__zoom,A=de(b.changedTouches?b.changedTouches[0]:b,this),P=I.invert(A),j=I.k*(b.shiftKey?.5:2),O=n(p(_(I,j),A,P),t.apply(this,k),i);ut(b),a>0?ce(this).transition().duration(a).call(M,O,A,b):ce(this).call(x.transform,O,A,b)}}function E(b,...k){if(e.apply(this,arguments)){var I=b.touches,A=I.length,P=S(this,k,b.changedTouches.length===A).event(b),j,O,H,R;for(Nn(b),O=0;O<A;++O)H=I[O],R=de(H,this),R=[R,this.__zoom.invert(R),H.identifier],P.touch0?!P.touch1&&P.touch0[2]!==R[2]&&(P.touch1=R,P.taps=0):(P.touch0=R,j=!0,P.taps=1+!!u);u&&(u=clearTimeout(u)),j&&(P.taps<2&&(d=R[0],u=setTimeout(function(){u=null},g)),Vt(this),P.start())}}function L(b,...k){if(this.__zooming){var I=S(this,k).event(b),A=b.changedTouches,P=A.length,j,O,H,R;for(ut(b),j=0;j<P;++j)O=A[j],H=de(O,this),I.touch0&&I.touch0[2]===O.identifier?I.touch0[0]=H:I.touch1&&I.touch1[2]===O.identifier&&(I.touch1[0]=H);if(O=I.that.__zoom,I.touch1){var F=I.touch0[0],B=I.touch0[1],q=I.touch1[0],K=I.touch1[1],Y=(Y=q[0]-F[0])*Y+(Y=q[1]-F[1])*Y,V=(V=K[0]-B[0])*V+(V=K[1]-B[1])*V;O=_(O,Math.sqrt(Y/V)),H=[(F[0]+q[0])/2,(F[1]+q[1])/2],R=[(B[0]+K[0])/2,(B[1]+K[1])/2]}else if(I.touch0)H=I.touch0[0],R=I.touch0[1];else return;I.zoom("touch",n(p(O,H,R),I.extent,i))}}function $(b,...k){if(this.__zooming){var I=S(this,k).event(b),A=b.changedTouches,P=A.length,j,O;for(Nn(b),f&&clearTimeout(f),f=setTimeout(function(){f=null},g),j=0;j<P;++j)O=A[j],I.touch0&&I.touch0[2]===O.identifier?delete I.touch0:I.touch1&&I.touch1[2]===O.identifier&&delete I.touch1;if(I.touch1&&!I.touch0&&(I.touch0=I.touch1,delete I.touch1),I.touch0)I.touch0[1]=this.__zoom.invert(I.touch0[0]);else if(I.end(),I.taps===2&&(O=de(O,this),Math.hypot(d[0]-O[0],d[1]-O[1])<v)){var H=ce(this).on("dblclick.zoom");H&&H.apply(this,arguments)}}}return x.wheelDelta=function(b){return arguments.length?(o=typeof b=="function"?b:jt(+b),x):o},x.filter=function(b){return arguments.length?(e=typeof b=="function"?b:jt(!!b),x):e},x.touchable=function(b){return arguments.length?(r=typeof b=="function"?b:jt(!!b),x):r},x.extent=function(b){return arguments.length?(t=typeof b=="function"?b:jt([[+b[0][0],+b[0][1]],[+b[1][0],+b[1][1]]]),x):t},x.scaleExtent=function(b){return arguments.length?(s[0]=+b[0],s[1]=+b[1],x):[s[0],s[1]]},x.translateExtent=function(b){return arguments.length?(i[0][0]=+b[0][0],i[1][0]=+b[1][0],i[0][1]=+b[0][1],i[1][1]=+b[1][1],x):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},x.constrain=function(b){return arguments.length?(n=b,x):n},x.duration=function(b){return arguments.length?(a=+b,x):a},x.interpolate=function(b){return arguments.length?(l=b,x):l},x.on=function(){var b=c.on.apply(c,arguments);return b===c?x:b},x.clickDistance=function(b){return arguments.length?(y=(b=+b)*b,x):Math.sqrt(y)},x.tapDistance=function(b){return arguments.length?(v=+b,x):v},x}const pe={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:o}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},yt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Os=["Enter"," ","Escape"],Rs={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Je;(function(e){e.Strict="strict",e.Loose="loose"})(Je||(Je={}));var Re;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Re||(Re={}));var xt;(function(e){e.Partial="partial",e.Full="full"})(xt||(xt={}));const Hs={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ie;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ie||(Ie={}));var Kt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Kt||(Kt={}));var G;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(G||(G={}));const Fo={[G.Left]:G.Right,[G.Right]:G.Left,[G.Top]:G.Bottom,[G.Bottom]:G.Top};function Vs(e){return e===null?null:e?"valid":"invalid"}const Bs=e=>"id"in e&&"source"in e&&"target"in e,df=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),io=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Nt=(e,t=[0,0])=>{const{width:n,height:o}=Ne(e),r=e.origin??t,s=n*r[0],i=o*r[1];return{x:e.position.x-s,y:e.position.y-i}},ff=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,r)=>{const s=typeof r=="string";let i=!t.nodeLookup&&!s?r:void 0;t.nodeLookup&&(i=s?t.nodeLookup.get(r):io(r)?r:t.nodeLookup.get(r.id));const a=i?Ut(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return dn(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return fn(n)},Et=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=dn(n,Ut(r)),o=!0)}),o?fn(n):{x:0,y:0,width:0,height:0}},ao=(e,t,[n,o,r]=[0,0,1],s=!1,i=!1)=>{const a={...Mt(t,[n,o,r]),width:t.width/r,height:t.height/r},l=[];for(const c of e.values()){const{measured:u,selectable:d=!0,hidden:f=!1}=c;if(i&&!d||f)continue;const g=u.width??c.width??c.initialWidth??null,m=u.height??c.height??c.initialHeight??null,y=vt(a,tt(c)),v=(g??0)*(m??0),x=s&&y>0;(!c.internals.handleBounds||x||y>=v||c.dragging)&&l.push(c)}return l},hf=(e,t)=>{const n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function mf(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&(t?.includeHiddenNodes||!r.hidden)&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function gf({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:s},i){if(e.size===0)return Promise.resolve(!0);const a=mf(e,i),l=Et(a),c=co(l,t,n,i?.minZoom??r,i?.maxZoom??s,i?.padding??.1);return await o.setViewport(c,{duration:i?.duration,ease:i?.ease,interpolate:i?.interpolate}),Promise.resolve(!0)}function Fs({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:s}){const i=n.get(e),a=i.parentId?n.get(i.parentId):void 0,{x:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},u=i.origin??o;let d=i.extent||r;if(i.extent==="parent"&&!i.expandParent)if(!a)s?.("005",pe.error005());else{const g=a.measured.width,m=a.measured.height;g&&m&&(d=[[l,c],[l+g,c+m]])}else a&&nt(i.extent)&&(d=[[i.extent[0][0]+l,i.extent[0][1]+c],[i.extent[1][0]+l,i.extent[1][1]+c]]);const f=nt(d)?Be(t,d,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&s?.("015",pe.error015()),{position:{x:f.x-l+(i.measured.width??0)*u[0],y:f.y-c+(i.measured.height??0)*u[1]},positionAbsolute:f}}async function pf({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const s=new Set(e.map(f=>f.id)),i=[];for(const f of n){if(f.deletable===!1)continue;const g=s.has(f.id),m=!g&&f.parentId&&i.find(y=>y.id===f.parentId);(g||m)&&i.push(f)}const a=new Set(t.map(f=>f.id)),l=o.filter(f=>f.deletable!==!1),u=hf(i,l);for(const f of l)a.has(f.id)&&!u.find(m=>m.id===f.id)&&u.push(f);if(!r)return{edges:u,nodes:i};const d=await r({nodes:i,edges:u});return typeof d=="boolean"?d?{edges:u,nodes:i}:{edges:[],nodes:[]}:d}const et=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Be=(e={x:0,y:0},t,n)=>({x:et(e.x,t[0][0],t[1][0]-(n?.width??0)),y:et(e.y,t[0][1],t[1][1]-(n?.height??0))});function Gs(e,t,n){const{width:o,height:r}=Ne(n),{x:s,y:i}=n.internals.positionAbsolute;return Be(e,[[s,i],[s+o,i+r]],t)}const Go=(e,t,n)=>e<t?et(Math.abs(e-t),1,t)/t:e>n?-et(Math.abs(e-n),1,t)/t:0,Xs=(e,t,n=15,o=40)=>{const r=Go(e.x,o,t.width-o)*n,s=Go(e.y,o,t.height-o)*n;return[r,s]},dn=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Vn=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),fn=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),tt=(e,t=[0,0])=>{const{x:n,y:o}=io(e)?e.internals.positionAbsolute:Nt(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Ut=(e,t=[0,0])=>{const{x:n,y:o}=io(e)?e.internals.positionAbsolute:Nt(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},Ys=(e,t)=>fn(dn(Vn(e),Vn(t))),vt=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},Xo=e=>fe(e.width)&&fe(e.height)&&fe(e.x)&&fe(e.y),fe=e=>!isNaN(e)&&isFinite(e),yf=(e,t)=>{},Ct=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Mt=({x:e,y:t},[n,o,r],s=!1,i=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return s?Ct(a,i):a},Qt=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Xe(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function xf(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=Xe(e,n),r=Xe(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=Xe(e.top??e.y??0,n),r=Xe(e.bottom??e.y??0,n),s=Xe(e.left??e.x??0,t),i=Xe(e.right??e.x??0,t);return{top:o,right:i,bottom:r,left:s,x:s+i,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function vf(e,t,n,o,r,s){const{x:i,y:a}=Qt(e,[t,n,o]),{x:l,y:c}=Qt({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-l,d=s-c;return{left:Math.floor(i),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(d)}}const co=(e,t,n,o,r,s)=>{const i=xf(s,t,n),a=(t-i.x)/e.width,l=(n-i.y)/e.height,c=Math.min(a,l),u=et(c,o,r),d=e.x+e.width/2,f=e.y+e.height/2,g=t/2-d*u,m=n/2-f*u,y=vf(e,g,m,u,t,n),v={left:Math.min(y.left-i.left,0),top:Math.min(y.top-i.top,0),right:Math.min(y.right-i.right,0),bottom:Math.min(y.bottom-i.bottom,0)};return{x:g-v.left+v.right,y:m-v.top+v.bottom,zoom:u}},wt=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function nt(e){return e!=null&&e!=="parent"}function Ne(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function qs(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Ws(e,t={width:0,height:0},n,o,r){const s={...e},i=o.get(n);if(i){const a=i.origin||r;s.x+=i.internals.positionAbsolute.x-(t.width??0)*a[0],s.y+=i.internals.positionAbsolute.y-(t.height??0)*a[1]}return s}function Yo(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function wf(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function bf(e){return{...Rs,...e||{}}}function ht(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:s,y:i}=he(e),a=Mt({x:s-(r?.left??0),y:i-(r?.top??0)},o),{x:l,y:c}=n?Ct(a,t):a;return{xSnapped:l,ySnapped:c,...a}}const lo=e=>({width:e.offsetWidth,height:e.offsetHeight}),Zs=e=>e?.getRootNode?.()||window?.document,_f=["INPUT","SELECT","TEXTAREA"];function Ks(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:_f.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Us=e=>"clientX"in e,he=(e,t)=>{const n=Us(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},qo=(e,t,n,o,r)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(i=>{const a=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:r,position:i.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...lo(i)}})};function Qs({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:s,targetControlX:i,targetControlY:a}){const l=e*.125+r*.375+i*.375+n*.125,c=t*.125+s*.375+a*.375+o*.125,u=Math.abs(l-e),d=Math.abs(c-t);return[l,c,u,d]}function Tt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Wo({pos:e,x1:t,y1:n,x2:o,y2:r,c:s}){switch(e){case G.Left:return[t-Tt(t-o,s),n];case G.Right:return[t+Tt(o-t,s),n];case G.Top:return[t,n-Tt(n-r,s)];case G.Bottom:return[t,n+Tt(r-n,s)]}}function Js({sourceX:e,sourceY:t,sourcePosition:n=G.Bottom,targetX:o,targetY:r,targetPosition:s=G.Top,curvature:i=.25}){const[a,l]=Wo({pos:n,x1:e,y1:t,x2:o,y2:r,c:i}),[c,u]=Wo({pos:s,x1:o,y1:r,x2:e,y2:t,c:i}),[d,f,g,m]=Qs({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${l} ${c},${u} ${o},${r}`,d,f,g,m]}function ei({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,s=n<e?n+r:n-r,i=Math.abs(o-t)/2,a=o<t?o+i:o-i;return[s,a,r,i]}function Sf({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:s="basic"}){if(s==="manual")return o;const i=r&&n?o+1e3:o,a=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return i+a}function Nf({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const s=dn(Ut(e),Ut(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const i={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return vt(i,fn(s))>0}const Ef=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Cf=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Mf=(e,t,n={})=>{if(!e.source||!e.target)return t;const o=n.getEdgeId||Ef;let r;return Bs(e)?r={...e}:r={...e,id:o(e)},Cf(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function ti({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,s,i,a]=ei({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,s,i,a]}const Zo={[G.Left]:{x:-1,y:0},[G.Right]:{x:1,y:0},[G.Top]:{x:0,y:-1},[G.Bottom]:{x:0,y:1}},If=({source:e,sourcePosition:t=G.Bottom,target:n})=>t===G.Left||t===G.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Ko=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function kf({source:e,sourcePosition:t=G.Bottom,target:n,targetPosition:o=G.Top,center:r,offset:s,stepPosition:i}){const a=Zo[t],l=Zo[o],c={x:e.x+a.x*s,y:e.y+a.y*s},u={x:n.x+l.x*s,y:n.y+l.y*s},d=If({source:c,sourcePosition:t,target:u}),f=d.x!==0?"x":"y",g=d[f];let m=[],y,v;const x={x:0,y:0},_={x:0,y:0},[,,p,w]=ei({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*l[f]===-1){f==="x"?(y=r.x??c.x+(u.x-c.x)*i,v=r.y??(c.y+u.y)/2):(y=r.x??(c.x+u.x)/2,v=r.y??c.y+(u.y-c.y)*i);const S=[{x:y,y:c.y},{x:y,y:u.y}],N=[{x:c.x,y:v},{x:u.x,y:v}];a[f]===g?m=f==="x"?S:N:m=f==="x"?N:S}else{const S=[{x:c.x,y:u.y}],N=[{x:u.x,y:c.y}];if(f==="x"?m=a.x===g?N:S:m=a.y===g?S:N,t===o){const L=Math.abs(e[f]-n[f]);if(L<=s){const $=Math.min(s-1,s-L);a[f]===g?x[f]=(c[f]>e[f]?-1:1)*$:_[f]=(u[f]>n[f]?-1:1)*$}}if(t!==o){const L=f==="x"?"y":"x",$=a[f]===l[L],b=c[L]>u[L],k=c[L]<u[L];(a[f]===1&&(!$&&b||$&&k)||a[f]!==1&&(!$&&k||$&&b))&&(m=f==="x"?S:N)}const D={x:c.x+x.x,y:c.y+x.y},T={x:u.x+_.x,y:u.y+_.y},z=Math.max(Math.abs(D.x-m[0].x),Math.abs(T.x-m[0].x)),E=Math.max(Math.abs(D.y-m[0].y),Math.abs(T.y-m[0].y));z>=E?(y=(D.x+T.x)/2,v=m[0].y):(y=m[0].x,v=(D.y+T.y)/2)}return[[e,{x:c.x+x.x,y:c.y+x.y},...m,{x:u.x+_.x,y:u.y+_.y},n],y,v,p,w]}function Pf(e,t,n,o){const r=Math.min(Ko(e,t)/2,Ko(t,n)/2,o),{x:s,y:i}=t;if(e.x===s&&s===n.x||e.y===i&&i===n.y)return`L${s} ${i}`;if(e.y===i){const c=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${s+r*c},${i}Q ${s},${i} ${s},${i+r*u}`}const a=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${s},${i+r*l}Q ${s},${i} ${s+r*a},${i}`}function Bn({sourceX:e,sourceY:t,sourcePosition:n=G.Bottom,targetX:o,targetY:r,targetPosition:s=G.Top,borderRadius:i=5,centerX:a,centerY:l,offset:c=20,stepPosition:u=.5}){const[d,f,g,m,y]=kf({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:s,center:{x:a,y:l},offset:c,stepPosition:u});return[d.reduce((x,_,p)=>{let w="";return p>0&&p<d.length-1?w=Pf(d[p-1],_,d[p+1],i):w=`${p===0?"M":"L"}${_.x} ${_.y}`,x+=w,x},""),f,g,m,y]}function Uo(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function jf(e){const{sourceNode:t,targetNode:n}=e;if(!Uo(t)||!Uo(n))return null;const o=t.internals.handleBounds||Qo(t.handles),r=n.internals.handleBounds||Qo(n.handles),s=Jo(o?.source??[],e.sourceHandle),i=Jo(e.connectionMode===Je.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!s||!i)return e.onError?.("008",pe.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=s?.position||G.Bottom,l=i?.position||G.Top,c=Fe(t,s,a),u=Fe(n,i,l);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:l}}function Qo(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&n.push(o);return{source:t,target:n}}function Fe(e,t,n=G.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,s=(t?.y??0)+e.internals.positionAbsolute.y,{width:i,height:a}=t??Ne(e);if(o)return{x:r+i/2,y:s+a/2};switch(t?.position??n){case G.Top:return{x:r+i/2,y:s};case G.Right:return{x:r+i,y:s+a/2};case G.Bottom:return{x:r+i/2,y:s+a};case G.Left:return{x:r,y:s+a/2}}}function Jo(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Fn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function Tf(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const s=new Set;return e.reduce((i,a)=>([a.markerStart||o,a.markerEnd||r].forEach(l=>{if(l&&typeof l=="object"){const c=Fn(l,t);s.has(c)||(i.push({id:c,color:l.color||n,...l}),s.add(c))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))}const ni=1e3,Af=10,uo={nodeOrigin:[0,0],nodeExtent:yt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Df={...uo,checkEquality:!0};function fo(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function Lf(e,t,n){const o=fo(uo,n);for(const r of e.values())if(r.parentId)mo(r,e,t,o);else{const s=Nt(r,o.nodeOrigin),i=nt(r.extent)?r.extent:o.nodeExtent,a=Be(s,i,Ne(r));r.internals.positionAbsolute=a}}function $f(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const s={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(s):r.type==="target"&&o.push(s)}return{source:n,target:o}}function ho(e){return e==="manual"}function Gn(e,t,n,o={}){const r=fo(Df,o),s={i:0},i=new Map(t),a=r?.elevateNodesOnSelect&&!ho(r.zIndexMode)?ni:0;let l=e.length>0;t.clear(),n.clear();for(const c of e){let u=i.get(c.id);if(r.checkEquality&&c===u?.internals.userNode)t.set(c.id,u);else{const d=Nt(c,r.nodeOrigin),f=nt(c.extent)?c.extent:r.nodeExtent,g=Be(d,f,Ne(c));u={...r.defaults,...c,measured:{width:c.measured?.width,height:c.measured?.height},internals:{positionAbsolute:g,handleBounds:$f(c,u),z:oi(c,a,r.zIndexMode),userNode:c}},t.set(c.id,u)}(u.measured===void 0||u.measured.width===void 0||u.measured.height===void 0)&&!u.hidden&&(l=!1),c.parentId&&mo(u,t,n,o,s)}return l}function zf(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function mo(e,t,n,o,r){const{elevateNodesOnSelect:s,nodeOrigin:i,nodeExtent:a,zIndexMode:l}=fo(uo,o),c=e.parentId,u=t.get(c);if(!u){console.warn(`Parent node ${c} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}zf(e,n),r&&!u.parentId&&u.internals.rootParentIndex===void 0&&l==="auto"&&(u.internals.rootParentIndex=++r.i,u.internals.z=u.internals.z+r.i*Af),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);const d=s&&!ho(l)?ni:0,{x:f,y:g,z:m}=Of(e,u,i,a,d,l),{positionAbsolute:y}=e.internals,v=f!==y.x||g!==y.y;(v||m!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:v?{x:f,y:g}:y,z:m}})}function oi(e,t,n){const o=fe(e.zIndex)?e.zIndex:0;return ho(n)?o:o+(e.selected?t:0)}function Of(e,t,n,o,r,s){const{x:i,y:a}=t.internals.positionAbsolute,l=Ne(e),c=Nt(e,n),u=nt(e.extent)?Be(c,e.extent,l):c;let d=Be({x:i+u.x,y:a+u.y},o,l);e.extent==="parent"&&(d=Gs(d,l,t));const f=oi(e,r,s),g=t.internals.z??0;return{x:d.x,y:d.y,z:g>=f?g+1:f}}function go(e,t,n,o=[0,0]){const r=[],s=new Map;for(const i of e){const a=t.get(i.parentId);if(!a)continue;const l=s.get(i.parentId)?.expandedRect??tt(a),c=Ys(l,i.rect);s.set(i.parentId,{expandedRect:c,parent:a})}return s.size>0&&s.forEach(({expandedRect:i,parent:a},l)=>{const c=a.internals.positionAbsolute,u=Ne(a),d=a.origin??o,f=i.x<c.x?Math.round(Math.abs(c.x-i.x)):0,g=i.y<c.y?Math.round(Math.abs(c.y-i.y)):0,m=Math.max(u.width,Math.round(i.width)),y=Math.max(u.height,Math.round(i.height)),v=(m-u.width)*d[0],x=(y-u.height)*d[1];(f>0||g>0||v||x)&&(r.push({id:l,type:"position",position:{x:a.position.x-f+v,y:a.position.y-g+x}}),n.get(l)?.forEach(_=>{e.some(p=>p.id===_.id)||r.push({id:_.id,type:"position",position:{x:_.position.x+f,y:_.position.y+g}})})),(u.width<i.width||u.height<i.height||f||g)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:m+(f?d[0]*f-v:0),height:y+(g?d[1]*g-x:0)}})}),r}function Rf(e,t,n,o,r,s,i){const a=o?.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const c=[],u=window.getComputedStyle(a),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(const g of e.values()){const m=t.get(g.id);if(!m)continue;if(m.hidden){t.set(m.id,{...m,internals:{...m.internals,handleBounds:void 0}}),l=!0;continue}const y=lo(g.nodeElement),v=m.measured.width!==y.width||m.measured.height!==y.height;if(!!(y.width&&y.height&&(v||!m.internals.handleBounds||g.force))){const _=g.nodeElement.getBoundingClientRect(),p=nt(m.extent)?m.extent:s;let{positionAbsolute:w}=m.internals;m.parentId&&m.extent==="parent"?w=Gs(w,y,t.get(m.parentId)):p&&(w=Be(w,p,y));const M={...m,measured:y,internals:{...m.internals,positionAbsolute:w,handleBounds:{source:qo("source",g.nodeElement,_,d,m.id),target:qo("target",g.nodeElement,_,d,m.id)}}};t.set(m.id,M),m.parentId&&mo(M,t,n,{nodeOrigin:r,zIndexMode:i}),l=!0,v&&(c.push({id:m.id,type:"dimensions",dimensions:y}),m.expandParent&&m.parentId&&f.push({id:m.id,parentId:m.parentId,rect:tt(M,r)}))}}if(f.length>0){const g=go(f,t,n,r);c.push(...g)}return{changes:c,updatedInternals:l}}async function Hf({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:s}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const i=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,s]],o),a=!!i&&(i.x!==n[0]||i.y!==n[1]||i.k!==n[2]);return Promise.resolve(a)}function er(e,t,n,o,r,s){let i=r;const a=o.get(i)||new Map;o.set(i,a.set(n,t)),i=`${r}-${e}`;const l=o.get(i)||new Map;if(o.set(i,l.set(n,t)),s){i=`${r}-${e}-${s}`;const c=o.get(i)||new Map;o.set(i,c.set(n,t))}}function ri(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:s,sourceHandle:i=null,targetHandle:a=null}=o,l={edgeId:o.id,source:r,target:s,sourceHandle:i,targetHandle:a},c=`${r}-${i}--${s}-${a}`,u=`${s}-${a}--${r}-${i}`;er("source",l,u,e,r,i),er("target",l,c,e,s,a),t.set(o.id,o)}}function si(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:si(n,t):!1}function tr(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function Vf(e,t,n,o){const r=new Map;for(const[s,i]of e)if((i.selected||i.id===o)&&(!i.parentId||!si(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){const a=e.get(s);a&&r.set(s,{id:s,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function En({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[i,a]of t){const l=n.get(i)?.internals.userNode;l&&r.push({...l,position:a.position,dragging:o})}if(!e)return[r[0],r];const s=n.get(e)?.internals.userNode;return[s?{...s,position:t.get(e)?.position||s.position,dragging:o}:r[0],r]}function Bf({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const s={x:n-r.distance.x,y:o-r.distance.y},i=Ct(s,t);return{x:i.x-s.x,y:i.y-s.y}}function Ff({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let s={x:null,y:null},i=0,a=new Map,l=!1,c={x:0,y:0},u=null,d=!1,f=null,g=!1,m=!1,y=null;function v({noDragClassName:_,handleSelector:p,domNode:w,isSelectable:M,nodeId:S,nodeClickDistance:N=0}){f=ce(w);function D({x:L,y:$}){const{nodeLookup:b,nodeExtent:k,snapGrid:I,snapToGrid:A,nodeOrigin:P,onNodeDrag:j,onSelectionDrag:O,onError:H,updateNodePositions:R}=t();s={x:L,y:$};let F=!1;const B=a.size>1,q=B&&k?Vn(Et(a)):null,K=B&&A?Bf({dragItems:a,snapGrid:I,x:L,y:$}):null;for(const[Y,V]of a){if(!b.has(Y))continue;let X={x:L-V.distance.x,y:$-V.distance.y};A&&(X=K?{x:Math.round(X.x+K.x),y:Math.round(X.y+K.y)}:Ct(X,I));let Q=null;if(B&&k&&!V.extent&&q){const{positionAbsolute:Z}=V.internals,ee=Z.x-q.x+k[0][0],ne=Z.x+V.measured.width-q.x2+k[1][0],te=Z.y-q.y+k[0][1],ae=Z.y+V.measured.height-q.y2+k[1][1];Q=[[ee,te],[ne,ae]]}const{position:U,positionAbsolute:W}=Fs({nodeId:Y,nextPosition:X,nodeLookup:b,nodeExtent:Q||k,nodeOrigin:P,onError:H});F=F||V.position.x!==U.x||V.position.y!==U.y,V.position=U,V.internals.positionAbsolute=W}if(m=m||F,!!F&&(R(a,!0),y&&(o||j||!S&&O))){const[Y,V]=En({nodeId:S,dragItems:a,nodeLookup:b});o?.(y,a,Y,V),j?.(y,Y,V),S||O?.(y,V)}}async function T(){if(!u)return;const{transform:L,panBy:$,autoPanSpeed:b,autoPanOnNodeDrag:k}=t();if(!k){l=!1,cancelAnimationFrame(i);return}const[I,A]=Xs(c,u,b);(I!==0||A!==0)&&(s.x=(s.x??0)-I/L[2],s.y=(s.y??0)-A/L[2],await $({x:I,y:A})&&D(s)),i=requestAnimationFrame(T)}function z(L){const{nodeLookup:$,multiSelectionActive:b,nodesDraggable:k,transform:I,snapGrid:A,snapToGrid:P,selectNodesOnDrag:j,onNodeDragStart:O,onSelectionDragStart:H,unselectNodesAndEdges:R}=t();d=!0,(!j||!M)&&!b&&S&&($.get(S)?.selected||R()),M&&j&&S&&e?.(S);const F=ht(L.sourceEvent,{transform:I,snapGrid:A,snapToGrid:P,containerBounds:u});if(s=F,a=Vf($,k,F,S),a.size>0&&(n||O||!S&&H)){const[B,q]=En({nodeId:S,dragItems:a,nodeLookup:$});n?.(L.sourceEvent,a,B,q),O?.(L.sourceEvent,B,q),S||H?.(L.sourceEvent,q)}}const E=Cs().clickDistance(N).on("start",L=>{const{domNode:$,nodeDragThreshold:b,transform:k,snapGrid:I,snapToGrid:A}=t();u=$?.getBoundingClientRect()||null,g=!1,m=!1,y=L.sourceEvent,b===0&&z(L),s=ht(L.sourceEvent,{transform:k,snapGrid:I,snapToGrid:A,containerBounds:u}),c=he(L.sourceEvent,u)}).on("drag",L=>{const{autoPanOnNodeDrag:$,transform:b,snapGrid:k,snapToGrid:I,nodeDragThreshold:A,nodeLookup:P}=t(),j=ht(L.sourceEvent,{transform:b,snapGrid:k,snapToGrid:I,containerBounds:u});if(y=L.sourceEvent,(L.sourceEvent.type==="touchmove"&&L.sourceEvent.touches.length>1||S&&!P.has(S))&&(g=!0),!g){if(!l&&$&&d&&(l=!0,T()),!d){const O=he(L.sourceEvent,u),H=O.x-c.x,R=O.y-c.y;Math.sqrt(H*H+R*R)>A&&z(L)}(s.x!==j.xSnapped||s.y!==j.ySnapped)&&a&&d&&(c=he(L.sourceEvent,u),D(j))}}).on("end",L=>{if(!(!d||g)&&(l=!1,d=!1,cancelAnimationFrame(i),a.size>0)){const{nodeLookup:$,updateNodePositions:b,onNodeDragStop:k,onSelectionDragStop:I}=t();if(m&&(b(a,!1),m=!1),r||k||!S&&I){const[A,P]=En({nodeId:S,dragItems:a,nodeLookup:$,dragging:!1});r?.(L.sourceEvent,a,A,P),k?.(L.sourceEvent,A,P),S||I?.(L.sourceEvent,P)}}}).filter(L=>{const $=L.target;return!L.button&&(!_||!tr($,`.${_}`,w))&&(!p||tr($,p,w))});f.call(E)}function x(){f?.on(".drag",null)}return{update:v,destroy:x}}function Gf(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const s of t.values())vt(r,tt(s))>0&&o.push(s);return o}const Xf=250;function Yf(e,t,n,o){let r=[],s=1/0;const i=Gf(e,n,t+Xf);for(const a of i){const l=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(const c of l){if(o.nodeId===c.nodeId&&o.type===c.type&&o.id===c.id)continue;const{x:u,y:d}=Fe(a,c,c.position,!0),f=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(d-e.y,2));f>t||(f<s?(r=[{...c,x:u,y:d}],s=f):f===s&&r.push({...c,x:u,y:d}))}}if(!r.length)return null;if(r.length>1){const a=o.type==="source"?"target":"source";return r.find(l=>l.type===a)??r[0]}return r[0]}function ii(e,t,n,o,r,s=!1){const i=o.get(e);if(!i)return null;const a=r==="strict"?i.internals.handleBounds?.[t]:[...i.internals.handleBounds?.source??[],...i.internals.handleBounds?.target??[]],l=(n?a?.find(c=>c.id===n):a?.[0])??null;return l&&s?{...l,...Fe(i,l,l.position,!0)}:l}function ai(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function qf(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const ci=()=>!0;function Wf(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:s,isTarget:i,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:g,onConnectStart:m,onConnect:y,onConnectEnd:v,isValidConnection:x=ci,onReconnectEnd:_,updateConnection:p,getTransform:w,getFromHandle:M,autoPanSpeed:S,dragThreshold:N=1,handleDomNode:D}){const T=Zs(e.target);let z=0,E;const{x:L,y:$}=he(e),b=ai(s,D),k=a?.getBoundingClientRect();let I=!1;if(!k||!b)return;const A=ii(r,b,o,l,t);if(!A)return;let P=he(e,k),j=!1,O=null,H=!1,R=null;function F(){if(!u||!k)return;const[U,W]=Xs(P,k,S);f({x:U,y:W}),z=requestAnimationFrame(F)}const B={...A,nodeId:r,type:b,position:A.position},q=l.get(r);let Y={inProgress:!0,isValid:null,from:Fe(q,B,G.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:q,to:P,toHandle:null,toPosition:Fo[B.position],toNode:null,pointer:P};function V(){I=!0,p(Y),m?.(e,{nodeId:r,handleId:o,handleType:b})}N===0&&V();function X(U){if(!I){const{x:ae,y:Ee}=he(U),ve=ae-L,$e=Ee-$;if(!(ve*ve+$e*$e>N*N))return;V()}if(!M()||!B){Q(U);return}const W=w();P=he(U,k),E=Yf(Mt(P,W,!1,[1,1]),n,l,B),j||(F(),j=!0);const Z=li(U,{handle:E,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:i?"target":"source",isValidConnection:x,doc:T,lib:c,flowId:d,nodeLookup:l});R=Z.handleDomNode,O=Z.connection,H=qf(!!E,Z.isValid);const ee=l.get(r),ne=ee?Fe(ee,B,G.Left,!0):Y.from,te={...Y,from:ne,isValid:H,to:Z.toHandle&&H?Qt({x:Z.toHandle.x,y:Z.toHandle.y},W):P,toHandle:Z.toHandle,toPosition:H&&Z.toHandle?Z.toHandle.position:Fo[B.position],toNode:Z.toHandle?l.get(Z.toHandle.nodeId):null,pointer:P};p(te),Y=te}function Q(U){if(!("touches"in U&&U.touches.length>0)){if(I){(E||R)&&O&&H&&y?.(O);const{inProgress:W,...Z}=Y,ee={...Z,toPosition:Y.toHandle?Y.toPosition:null};v?.(U,ee),s&&_?.(U,ee)}g(),cancelAnimationFrame(z),j=!1,H=!1,O=null,R=null,T.removeEventListener("mousemove",X),T.removeEventListener("mouseup",Q),T.removeEventListener("touchmove",X),T.removeEventListener("touchend",Q)}}T.addEventListener("mousemove",X),T.addEventListener("mouseup",Q),T.addEventListener("touchmove",X),T.addEventListener("touchend",Q)}function li(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:s,doc:i,lib:a,flowId:l,isValidConnection:c=ci,nodeLookup:u}){const d=s==="target",f=t?i.querySelector(`.${a}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:g,y:m}=he(e),y=i.elementFromPoint(g,m),v=y?.classList.contains(`${a}-flow__handle`)?y:f,x={handleDomNode:v,isValid:!1,connection:null,toHandle:null};if(v){const _=ai(void 0,v),p=v.getAttribute("data-nodeid"),w=v.getAttribute("data-handleid"),M=v.classList.contains("connectable"),S=v.classList.contains("connectableend");if(!p||!_)return x;const N={source:d?p:o,sourceHandle:d?w:r,target:d?o:p,targetHandle:d?r:w};x.connection=N;const T=M&&S&&(n===Je.Strict?d&&_==="source"||!d&&_==="target":p!==o||w!==r);x.isValid=T&&c(N),x.toHandle=ii(p,_,w,u,n,!0)}return x}const Xn={onPointerDown:Wf,isValid:li};function Zf({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=ce(e);function s({translateExtent:a,width:l,height:c,zoomStep:u=1,pannable:d=!0,zoomable:f=!0,inversePan:g=!1}){const m=p=>{if(p.sourceEvent.type!=="wheel"||!t)return;const w=n(),M=p.sourceEvent.ctrlKey&&wt()?10:1,S=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*u,N=w[2]*Math.pow(2,S*M);t.scaleTo(N)};let y=[0,0];const v=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(y=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},x=p=>{const w=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;const M=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],S=[M[0]-y[0],M[1]-y[1]];y=M;const N=o()*Math.max(w[2],Math.log(w[2]))*(g?-1:1),D={x:w[0]-S[0]*N,y:w[1]-S[1]*N},T=[[0,0],[l,c]];t.setViewportConstrained({x:D.x,y:D.y,zoom:w[2]},T,a)},_=zs().on("start",v).on("zoom",d?x:null).on("zoom.wheel",f?m:null);r.call(_,{})}function i(){r.on("zoom",null)}return{update:s,destroy:i,pointer:de}}const hn=e=>({x:e.x,y:e.y,zoom:e.k}),Cn=({x:e,y:t,zoom:n})=>un.translate(e,t).scale(n),qe=(e,t)=>e.target.closest(`.${t}`),ui=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Kf=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Mn=(e,t=0,n=Kf,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},di=e=>{const t=e.ctrlKey&&wt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Uf({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:s,zoomOnPinch:i,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return u=>{if(qe(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(u.ctrlKey&&i){const v=de(u),x=di(u),_=d*Math.pow(2,x);o.scaleTo(n,_,v,u);return}const f=u.deltaMode===1?20:1;let g=r===Re.Vertical?0:u.deltaX*f,m=r===Re.Horizontal?0:u.deltaY*f;!wt()&&u.shiftKey&&r!==Re.Vertical&&(g=u.deltaY*f,m=0),o.translateBy(n,-(g/d)*s,-(m/d)*s,{internal:!0});const y=hn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(l?.(u,y),e.panScrollTimeout=setTimeout(()=>{c?.(u,y),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a?.(u,y))}}function Qf({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const s=o.type==="wheel",i=!t&&s&&!o.ctrlKey,a=qe(o,e);if(o.ctrlKey&&s&&a&&o.preventDefault(),i||a)return null;o.preventDefault(),n.call(this,o,r)}}function Jf({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=hn(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,r)}}function eh({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return s=>{e.usedRightMouseButton=!!(n&&ui(t,e.mouseButton??0)),s.sourceEvent?.sync||o([s.transform.x,s.transform.y,s.transform.k]),r&&!s.sourceEvent?.internal&&r?.(s.sourceEvent,hn(s.transform))}}function th({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:s}){return i=>{if(!i.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,s&&ui(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&s(i.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const a=hn(i.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(i.sourceEvent,a)},n?150:0)}}}function nh({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:s,userSelectionActive:i,noWheelClassName:a,noPanClassName:l,lib:c,connectionInProgress:u}){return d=>{const f=e||t,g=n&&d.ctrlKey,m=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(qe(d,`${c}-flow__node`)||qe(d,`${c}-flow__edge`)))return!0;if(!o&&!f&&!r&&!s&&!n||i||u&&!m||qe(d,a)&&m||qe(d,l)&&(!m||r&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type==="touchstart"&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!r&&!g&&m||!o&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(o)&&!o.includes(d.button)&&d.type==="mousedown")return!1;const y=Array.isArray(o)&&o.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&y}}function oh({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:s,onPanZoomStart:i,onPanZoomEnd:a,onDraggingChange:l}){const c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=zs().scaleExtent([t,n]).translateExtent(o),f=ce(e).call(d);_({x:r.x,y:r.y,zoom:et(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);const g=f.on("wheel.zoom"),m=f.on("dblclick.zoom");d.wheelDelta(di);function y(E,L){return f?new Promise($=>{d?.interpolate(L?.interpolate==="linear"?bn:Ot).transform(Mn(f,L?.duration,L?.ease,()=>$(!0)),E)}):Promise.resolve(!1)}function v({noWheelClassName:E,noPanClassName:L,onPaneContextMenu:$,userSelectionActive:b,panOnScroll:k,panOnDrag:I,panOnScrollMode:A,panOnScrollSpeed:P,preventScrolling:j,zoomOnPinch:O,zoomOnScroll:H,zoomOnDoubleClick:R,zoomActivationKeyPressed:F,lib:B,onTransformChange:q,connectionInProgress:K,paneClickDistance:Y,selectionOnDrag:V}){b&&!c.isZoomingOrPanning&&x();const X=k&&!F&&!b;d.clickDistance(V?1/0:!fe(Y)||Y<0?0:Y);const Q=X?Uf({zoomPanValues:c,noWheelClassName:E,d3Selection:f,d3Zoom:d,panOnScrollMode:A,panOnScrollSpeed:P,zoomOnPinch:O,onPanZoomStart:i,onPanZoom:s,onPanZoomEnd:a}):Qf({noWheelClassName:E,preventScrolling:j,d3ZoomHandler:g});if(f.on("wheel.zoom",Q,{passive:!1}),!b){const W=Jf({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:i});d.on("start",W);const Z=eh({zoomPanValues:c,panOnDrag:I,onPaneContextMenu:!!$,onPanZoom:s,onTransformChange:q});d.on("zoom",Z);const ee=th({zoomPanValues:c,panOnDrag:I,panOnScroll:k,onPaneContextMenu:$,onPanZoomEnd:a,onDraggingChange:l});d.on("end",ee)}const U=nh({zoomActivationKeyPressed:F,panOnDrag:I,zoomOnScroll:H,panOnScroll:k,zoomOnDoubleClick:R,zoomOnPinch:O,userSelectionActive:b,noPanClassName:L,noWheelClassName:E,lib:B,connectionInProgress:K});d.filter(U),R?f.on("dblclick.zoom",m):f.on("dblclick.zoom",null)}function x(){d.on("zoom",null)}async function _(E,L,$){const b=Cn(E),k=d?.constrain()(b,L,$);return k&&await y(k),new Promise(I=>I(k))}async function p(E,L){const $=Cn(E);return await y($,L),new Promise(b=>b($))}function w(E){if(f){const L=Cn(E),$=f.property("__zoom");($.k!==E.zoom||$.x!==E.x||$.y!==E.y)&&d?.transform(f,L,null,{sync:!0})}}function M(){const E=f?$s(f.node()):{x:0,y:0,k:1};return{x:E.x,y:E.y,zoom:E.k}}function S(E,L){return f?new Promise($=>{d?.interpolate(L?.interpolate==="linear"?bn:Ot).scaleTo(Mn(f,L?.duration,L?.ease,()=>$(!0)),E)}):Promise.resolve(!1)}function N(E,L){return f?new Promise($=>{d?.interpolate(L?.interpolate==="linear"?bn:Ot).scaleBy(Mn(f,L?.duration,L?.ease,()=>$(!0)),E)}):Promise.resolve(!1)}function D(E){d?.scaleExtent(E)}function T(E){d?.translateExtent(E)}function z(E){const L=!fe(E)||E<0?0:E;d?.clickDistance(L)}return{update:v,destroy:x,setViewport:p,setViewportConstrained:_,getViewport:M,scaleTo:S,scaleBy:N,setScaleExtent:D,setTranslateExtent:T,syncViewport:w,setClickDistance:z}}var ot;(function(e){e.Line="line",e.Handle="handle"})(ot||(ot={}));function rh({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:s}){const i=e-t,a=n-o,l=[i>0?1:i<0?-1:0,a>0?1:a<0?-1:0];return i&&r&&(l[0]=l[0]*-1),a&&s&&(l[1]=l[1]*-1),l}function nr(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function Ce(e,t){return Math.max(0,t-e)}function Me(e,t){return Math.max(0,e-t)}function At(e,t,n){return Math.max(0,t-e,e-n)}function or(e,t){return e?!t:t}function sh(e,t,n,o,r,s,i,a){let{affectsX:l,affectsY:c}=t;const{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:g,ySnapped:m}=n,{minWidth:y,maxWidth:v,minHeight:x,maxHeight:_}=o,{x:p,y:w,width:M,height:S,aspectRatio:N}=e;let D=Math.floor(u?g-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0);const z=M+(l?-D:D),E=S+(c?-T:T),L=-s[0]*M,$=-s[1]*S;let b=At(z,y,v),k=At(E,x,_);if(i){let P=0,j=0;l&&D<0?P=Ce(p+D+L,i[0][0]):!l&&D>0&&(P=Me(p+z+L,i[1][0])),c&&T<0?j=Ce(w+T+$,i[0][1]):!c&&T>0&&(j=Me(w+E+$,i[1][1])),b=Math.max(b,P),k=Math.max(k,j)}if(a){let P=0,j=0;l&&D>0?P=Me(p+D,a[0][0]):!l&&D<0&&(P=Ce(p+z,a[1][0])),c&&T>0?j=Me(w+T,a[0][1]):!c&&T<0&&(j=Ce(w+E,a[1][1])),b=Math.max(b,P),k=Math.max(k,j)}if(r){if(u){const P=At(z/N,x,_)*N;if(b=Math.max(b,P),i){let j=0;!l&&!c||l&&!c&&f?j=Me(w+$+z/N,i[1][1])*N:j=Ce(w+$+(l?D:-D)/N,i[0][1])*N,b=Math.max(b,j)}if(a){let j=0;!l&&!c||l&&!c&&f?j=Ce(w+z/N,a[1][1])*N:j=Me(w+(l?D:-D)/N,a[0][1])*N,b=Math.max(b,j)}}if(d){const P=At(E*N,y,v)/N;if(k=Math.max(k,P),i){let j=0;!l&&!c||c&&!l&&f?j=Me(p+E*N+L,i[1][0])/N:j=Ce(p+(c?T:-T)*N+L,i[0][0])/N,k=Math.max(k,j)}if(a){let j=0;!l&&!c||c&&!l&&f?j=Ce(p+E*N,a[1][0])/N:j=Me(p+(c?T:-T)*N,a[0][0])/N,k=Math.max(k,j)}}}T=T+(T<0?k:-k),D=D+(D<0?b:-b),r&&(f?z>E*N?T=(or(l,c)?-D:D)/N:D=(or(l,c)?-T:T)*N:u?(T=D/N,c=l):(D=T*N,l=c));const I=l?p+D:p,A=c?w+T:w;return{width:M+(l?-D:D),height:S+(c?-T:T),x:s[0]*D*(l?-1:1)+I,y:s[1]*T*(c?-1:1)+A}}const fi={width:0,height:0,x:0,y:0},ih={...fi,pointerX:0,pointerY:0,aspectRatio:1};function ah(e){return[[0,0],[e.measured.width,e.measured.height]]}function ch(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,s=e.measured.width??0,i=e.measured.height??0,a=n[0]*s,l=n[1]*i;return[[o-a,r-l],[o+s-a,r+i-l]]}function lh({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const s=ce(e);let i={controlDirection:nr("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:c,boundaries:u,keepAspectRatio:d,resizeDirection:f,onResizeStart:g,onResize:m,onResizeEnd:y,shouldResize:v}){let x={...fi},_={...ih};i={boundaries:u,resizeDirection:f,keepAspectRatio:d,controlDirection:nr(c)};let p,w=null,M=[],S,N,D,T=!1;const z=Cs().on("start",E=>{const{nodeLookup:L,transform:$,snapGrid:b,snapToGrid:k,nodeOrigin:I,paneDomNode:A}=n();if(p=L.get(t),!p)return;w=A?.getBoundingClientRect()??null;const{xSnapped:P,ySnapped:j}=ht(E.sourceEvent,{transform:$,snapGrid:b,snapToGrid:k,containerBounds:w});x={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},_={...x,pointerX:P,pointerY:j,aspectRatio:x.width/x.height},S=void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(S=L.get(p.parentId),N=S&&p.extent==="parent"?ah(S):void 0),M=[],D=void 0;for(const[O,H]of L)if(H.parentId===t&&(M.push({id:O,position:{...H.position},extent:H.extent}),H.extent==="parent"||H.expandParent)){const R=ch(H,p,H.origin??I);D?D=[[Math.min(R[0][0],D[0][0]),Math.min(R[0][1],D[0][1])],[Math.max(R[1][0],D[1][0]),Math.max(R[1][1],D[1][1])]]:D=R}g?.(E,{...x})}).on("drag",E=>{const{transform:L,snapGrid:$,snapToGrid:b,nodeOrigin:k}=n(),I=ht(E.sourceEvent,{transform:L,snapGrid:$,snapToGrid:b,containerBounds:w}),A=[];if(!p)return;const{x:P,y:j,width:O,height:H}=x,R={},F=p.origin??k,{width:B,height:q,x:K,y:Y}=sh(_,i.controlDirection,I,i.boundaries,i.keepAspectRatio,F,N,D),V=B!==O,X=q!==H,Q=K!==P&&V,U=Y!==j&&X;if(!Q&&!U&&!V&&!X)return;if((Q||U||F[0]===1||F[1]===1)&&(R.x=Q?K:x.x,R.y=U?Y:x.y,x.x=R.x,x.y=R.y,M.length>0)){const ne=K-P,te=Y-j;for(const ae of M)ae.position={x:ae.position.x-ne+F[0]*(B-O),y:ae.position.y-te+F[1]*(q-H)},A.push(ae)}if((V||X)&&(R.width=V&&(!i.resizeDirection||i.resizeDirection==="horizontal")?B:x.width,R.height=X&&(!i.resizeDirection||i.resizeDirection==="vertical")?q:x.height,x.width=R.width,x.height=R.height),S&&p.expandParent){const ne=F[0]*(R.width??0);R.x&&R.x<ne&&(x.x=ne,_.x=_.x-(R.x-ne));const te=F[1]*(R.height??0);R.y&&R.y<te&&(x.y=te,_.y=_.y-(R.y-te))}const W=rh({width:x.width,prevWidth:O,height:x.height,prevHeight:H,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),Z={...x,direction:W};v?.(E,Z)!==!1&&(T=!0,m?.(E,Z),o(R,A))}).on("end",E=>{T&&(y?.(E,{...x}),r?.({...x}),T=!1)});s.call(z)}function l(){s.on(".drag",null)}return{update:a,destroy:l}}const uh={},rr=e=>{let t;const n=new Set,o=(u,d)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const g=t;t=d??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(m=>m(t,g))}},r=()=>t,l={setState:o,getState:r,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(uh?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},c=t=e(o,r,l);return l},dh=e=>e?rr(e):rr,{useDebugValue:fh}=ue,{useSyncExternalStoreWithSelector:hh}=uc,mh=e=>e;function hi(e,t=mh,n){const o=hh(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return fh(o),o}const sr=(e,t)=>{const n=dh(e),o=(r,s=t)=>hi(n,r,s);return Object.assign(o,n),o},gh=(e,t)=>e?sr(e,t):sr;function oe(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const mn=C.createContext(null),ph=mn.Provider,mi=pe.error001();function J(e,t){const n=C.useContext(mn);if(n===null)throw new Error(mi);return hi(n,e,t)}function re(){const e=C.useContext(mn);if(e===null)throw new Error(mi);return C.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const ir={display:"none"},yh={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},gi="react-flow__node-desc",pi="react-flow__edge-desc",xh="react-flow__aria-live",vh=e=>e.ariaLiveMessage,wh=e=>e.ariaLabelConfig;function bh({rfId:e}){const t=J(vh);return h.jsx("div",{id:`${xh}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:yh,children:t})}function _h({rfId:e,disableKeyboardA11y:t}){const n=J(wh);return h.jsxs(h.Fragment,{children:[h.jsx("div",{id:`${gi}-${e}`,style:ir,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),h.jsx("div",{id:`${pi}-${e}`,style:ir,children:n["edge.a11yDescription.default"]}),!t&&h.jsx(bh,{rfId:e})]})}const gn=C.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},s)=>{const i=`${e}`.split("-");return h.jsx("div",{className:ie(["react-flow__panel",n,...i]),style:o,ref:s,...r,children:t})});gn.displayName="Panel";function Sh({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:h.jsx(gn,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:h.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Nh=e=>{const t=[],n=[];for(const[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(const[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},Dt=e=>e.id;function Eh(e,t){return oe(e.selectedNodes.map(Dt),t.selectedNodes.map(Dt))&&oe(e.selectedEdges.map(Dt),t.selectedEdges.map(Dt))}function Ch({onSelectionChange:e}){const t=re(),{selectedNodes:n,selectedEdges:o}=J(Nh,Eh);return C.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(s=>s(r))},[n,o,e]),null}const Mh=e=>!!e.onSelectionChangeHandlers;function Ih({onSelectionChange:e}){const t=J(Mh);return e||t?h.jsx(Ch,{onSelectionChange:e}):null}const yi=[0,0],kh={x:0,y:0,zoom:1},Ph=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],ar=[...Ph,"rfId"],jh=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),cr={translateExtent:yt,nodeOrigin:yi,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Th(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:s,setNodeExtent:i,reset:a,setDefaultNodesAndEdges:l}=J(jh,oe),c=re();C.useEffect(()=>(l(e.defaultNodes,e.defaultEdges),()=>{u.current=cr,a()}),[]);const u=C.useRef(cr);return C.useEffect(()=>{for(const d of ar){const f=e[d],g=u.current[d];f!==g&&(typeof e[d]>"u"||(d==="nodes"?t(f):d==="edges"?n(f):d==="minZoom"?o(f):d==="maxZoom"?r(f):d==="translateExtent"?s(f):d==="nodeExtent"?i(f):d==="ariaLabelConfig"?c.setState({ariaLabelConfig:bf(f)}):d==="fitView"?c.setState({fitViewQueued:f}):d==="fitViewOptions"?c.setState({fitViewOptions:f}):c.setState({[d]:f})))}u.current=e},ar.map(d=>e[d])),null}function lr(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Ah(e){const[t,n]=C.useState(e==="system"?null:e);return C.useEffect(()=>{if(e!=="system"){n(e);return}const o=lr(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:lr()?.matches?"dark":"light"}const ur=typeof document<"u"?document:null;function bt(e=null,t={target:ur,actInsideInputWithModifier:!0}){const[n,o]=C.useState(!1),r=C.useRef(!1),s=C.useRef(new Set([])),[i,a]=C.useMemo(()=>{if(e!==null){const c=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",`
2
2
  `).replace(`
3
3
 
4
4
  `,`
@@ -1 +1 @@
1
- import{r as _,c as v,j as n}from"./index-DEMNtulg.js";import{B as z}from"./button-B13xcF6W.js";import{u as k,b as y,T as E,a as B,c as S}from"./tooltip-C7B84lYF.js";import{u as w,a as A}from"./use-organization-settings-B_G_DBCR.js";const C=({size:c=24,color:e="currentColor",...r})=>_.createElement("svg",{viewBox:"0 0 24 24",width:c,height:c,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},_.createElement("path",{d:"M12 15v7M8 7.308v2.13c0 .209 0 .313-.02.412a1.001 1.001 0 0 1-.09.254c-.045.09-.11.172-.24.334L6.08 12.4c-.666.833-.999 1.249-.999 1.599a1 1 0 0 0 .376.782C5.731 15 6.264 15 7.33 15h9.342c1.066 0 1.599 0 1.873-.219A1 1 0 0 0 18.92 14c0-.35-.333-.766-1-1.599l-1.569-1.962c-.13-.162-.195-.243-.241-.334a1.004 1.004 0 0 1-.09-.254C16 9.75 16 9.647 16 9.44V7.31c0-.116 0-.174.007-.23.006-.05.015-.1.029-.15a2.02 2.02 0 0 1 .079-.215l1.008-2.52c.294-.735.44-1.102.38-1.397a1 1 0 0 0-.427-.63C16.825 2 16.429 2 15.637 2H8.364c-.792 0-1.188 0-1.44.167a1 1 0 0 0-.426.63c-.06.295.086.662.38 1.397l1.008 2.52c.043.107.064.16.08.215a1 1 0 0 1 .028.15c.006.056.006.114.006.23Z"}));C.displayName="Pin01";function O(c){const e=v.c(19),{title:r,url:t,icon:f}=c,{org:P}=k(),i=w(P.id),h=A(P.id);let l;e[0]!==i?.sidebar_items||e[1]!==t?(l=i?.sidebar_items?.some(p=>p.url===t),e[0]=i?.sidebar_items,e[1]=t,e[2]=l):l=e[2];const a=!!l;let d;e[3]!==h.update||e[4]!==f||e[5]!==a||e[6]!==i?.sidebar_items||e[7]!==r||e[8]!==t?(d=async()=>{const p=i?.sidebar_items||[];let j;a?j=p.filter(T=>T.url!==t):j=[...p,{title:r,url:t,icon:f}],await h.update.mutateAsync({sidebar_items:j})},e[3]=h.update,e[4]=f,e[5]=a,e[6]=i?.sidebar_items,e[7]=r,e[8]=t,e[9]=d):d=e[9];const b=d,x=a?"secondary":"outline";let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(C,{size:16}),e[10]=m):m=e[10];let s;e[11]!==b||e[12]!==x?(s=n.jsx(y,{asChild:!0,children:n.jsx(z,{onClick:b,size:"icon",variant:x,className:"size-7 border border-input",children:m})}),e[11]=b,e[12]=x,e[13]=s):s=e[13];const g=a?"Pinned":"Pin to sidebar";let o;e[14]!==g?(o=n.jsx(E,{children:g}),e[14]=g,e[15]=o):o=e[15];let u;return e[16]!==s||e[17]!==o?(u=n.jsx(B,{children:n.jsxs(S,{children:[s,o]})}),e[16]=s,e[17]=o,e[18]=u):u=e[18],u}export{O as P};
1
+ import{r as _,c as v,j as n}from"./index-Ddg6ZSnz.js";import{B as z}from"./button-DGQafcd8.js";import{u as k,b as y,T as E,a as B,c as S}from"./tooltip-D8OED8cS.js";import{u as w,a as A}from"./use-organization-settings-cNGS6Euq.js";const C=({size:c=24,color:e="currentColor",...r})=>_.createElement("svg",{viewBox:"0 0 24 24",width:c,height:c,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},_.createElement("path",{d:"M12 15v7M8 7.308v2.13c0 .209 0 .313-.02.412a1.001 1.001 0 0 1-.09.254c-.045.09-.11.172-.24.334L6.08 12.4c-.666.833-.999 1.249-.999 1.599a1 1 0 0 0 .376.782C5.731 15 6.264 15 7.33 15h9.342c1.066 0 1.599 0 1.873-.219A1 1 0 0 0 18.92 14c0-.35-.333-.766-1-1.599l-1.569-1.962c-.13-.162-.195-.243-.241-.334a1.004 1.004 0 0 1-.09-.254C16 9.75 16 9.647 16 9.44V7.31c0-.116 0-.174.007-.23.006-.05.015-.1.029-.15a2.02 2.02 0 0 1 .079-.215l1.008-2.52c.294-.735.44-1.102.38-1.397a1 1 0 0 0-.427-.63C16.825 2 16.429 2 15.637 2H8.364c-.792 0-1.188 0-1.44.167a1 1 0 0 0-.426.63c-.06.295.086.662.38 1.397l1.008 2.52c.043.107.064.16.08.215a1 1 0 0 1 .028.15c.006.056.006.114.006.23Z"}));C.displayName="Pin01";function O(c){const e=v.c(19),{title:r,url:t,icon:f}=c,{org:P}=k(),i=w(P.id),h=A(P.id);let l;e[0]!==i?.sidebar_items||e[1]!==t?(l=i?.sidebar_items?.some(p=>p.url===t),e[0]=i?.sidebar_items,e[1]=t,e[2]=l):l=e[2];const a=!!l;let d;e[3]!==h.update||e[4]!==f||e[5]!==a||e[6]!==i?.sidebar_items||e[7]!==r||e[8]!==t?(d=async()=>{const p=i?.sidebar_items||[];let j;a?j=p.filter(T=>T.url!==t):j=[...p,{title:r,url:t,icon:f}],await h.update.mutateAsync({sidebar_items:j})},e[3]=h.update,e[4]=f,e[5]=a,e[6]=i?.sidebar_items,e[7]=r,e[8]=t,e[9]=d):d=e[9];const b=d,x=a?"secondary":"outline";let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(C,{size:16}),e[10]=m):m=e[10];let s;e[11]!==b||e[12]!==x?(s=n.jsx(y,{asChild:!0,children:n.jsx(z,{onClick:b,size:"icon",variant:x,className:"size-7 border border-input",children:m})}),e[11]=b,e[12]=x,e[13]=s):s=e[13];const g=a?"Pinned":"Pin to sidebar";let o;e[14]!==g?(o=n.jsx(E,{children:g}),e[14]=g,e[15]=o):o=e[15];let u;return e[16]!==s||e[17]!==o?(u=n.jsx(B,{children:n.jsxs(S,{children:[s,o]})}),e[16]=s,e[17]=o,e[18]=u):u=e[18],u}export{O as P};
@@ -1 +1 @@
1
- import{r as i,an as A,z as $,j as c,aq as z,H,aw as L,Z as _,B as b,E as g,ao as w,$ as E,ap as G,b4 as K,b5 as Z,b6 as q,b7 as B,b8 as U,ar as V,as as W,at as J,c as R}from"./index-DEMNtulg.js";import{c as Q}from"./button-B13xcF6W.js";var m="Popover",[j]=H(m,[A]),P=A(),[X,d]=j(m),N=t=>{const{__scopePopover:e,children:o,open:r,defaultOpen:n,onOpenChange:s,modal:a=!1}=t,p=P(e),l=i.useRef(null),[u,h]=i.useState(!1),[x,f]=$({prop:r,defaultProp:n??!1,onChange:s,caller:m});return c.jsx(z,{...p,children:c.jsx(X,{scope:e,contentId:L(),triggerRef:l,open:x,onOpenChange:f,onOpenToggle:i.useCallback(()=>f(C=>!C),[f]),hasCustomAnchor:u,onCustomAnchorAdd:i.useCallback(()=>h(!0),[]),onCustomAnchorRemove:i.useCallback(()=>h(!1),[]),modal:a,children:o})})};N.displayName=m;var F="PopoverAnchor",Y=i.forwardRef((t,e)=>{const{__scopePopover:o,...r}=t,n=d(F,o),s=P(o),{onCustomAnchorAdd:a,onCustomAnchorRemove:p}=n;return i.useEffect(()=>(a(),()=>p()),[a,p]),c.jsx(w,{...s,...r,ref:e})});Y.displayName=F;var S="PopoverTrigger",y=i.forwardRef((t,e)=>{const{__scopePopover:o,...r}=t,n=d(S,o),s=P(o),a=_(e,n.triggerRef),p=c.jsx(b.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":I(n.open),...r,ref:a,onClick:g(t.onClick,n.onOpenToggle)});return n.hasCustomAnchor?p:c.jsx(w,{asChild:!0,...s,children:p})});y.displayName=S;var O="PopoverPortal",[ee,oe]=j(O,{forceMount:void 0}),D=t=>{const{__scopePopover:e,forceMount:o,children:r,container:n}=t,s=d(O,e);return c.jsx(ee,{scope:e,forceMount:o,children:c.jsx(E,{present:o||s.open,children:c.jsx(G,{asChild:!0,container:n,children:r})})})};D.displayName=O;var v="PopoverContent",M=i.forwardRef((t,e)=>{const o=oe(v,t.__scopePopover),{forceMount:r=o.forceMount,...n}=t,s=d(v,t.__scopePopover);return c.jsx(E,{present:r||s.open,children:s.modal?c.jsx(re,{...n,ref:e}):c.jsx(ne,{...n,ref:e})})});M.displayName=v;var te=q("PopoverContent.RemoveScroll"),re=i.forwardRef((t,e)=>{const o=d(v,t.__scopePopover),r=i.useRef(null),n=_(e,r),s=i.useRef(!1);return i.useEffect(()=>{const a=r.current;if(a)return K(a)},[]),c.jsx(Z,{as:te,allowPinchZoom:!0,children:c.jsx(T,{...t,ref:n,trapFocus:o.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:g(t.onCloseAutoFocus,a=>{a.preventDefault(),s.current||o.triggerRef.current?.focus()}),onPointerDownOutside:g(t.onPointerDownOutside,a=>{const p=a.detail.originalEvent,l=p.button===0&&p.ctrlKey===!0,u=p.button===2||l;s.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:g(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),ne=i.forwardRef((t,e)=>{const o=d(v,t.__scopePopover),r=i.useRef(!1),n=i.useRef(!1);return c.jsx(T,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{t.onCloseAutoFocus?.(s),s.defaultPrevented||(r.current||o.triggerRef.current?.focus(),s.preventDefault()),r.current=!1,n.current=!1},onInteractOutside:s=>{t.onInteractOutside?.(s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const a=s.target;o.triggerRef.current?.contains(a)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&n.current&&s.preventDefault()}})}),T=i.forwardRef((t,e)=>{const{__scopePopover:o,trapFocus:r,onOpenAutoFocus:n,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEscapeKeyDown:p,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:h,...x}=t,f=d(v,o),C=P(o);return B(),c.jsx(U,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:n,onUnmountAutoFocus:s,children:c.jsx(V,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:h,onEscapeKeyDown:p,onPointerDownOutside:l,onFocusOutside:u,onDismiss:()=>f.onOpenChange(!1),children:c.jsx(W,{"data-state":I(f.open),role:"dialog",id:f.contentId,...C,...x,ref:e,style:{...x.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),k="PopoverClose",se=i.forwardRef((t,e)=>{const{__scopePopover:o,...r}=t,n=d(k,o);return c.jsx(b.button,{type:"button",...r,ref:e,onClick:g(t.onClick,()=>n.onOpenChange(!1))})});se.displayName=k;var ae="PopoverArrow",ce=i.forwardRef((t,e)=>{const{__scopePopover:o,...r}=t,n=P(o);return c.jsx(J,{...n,...r,ref:e})});ce.displayName=ae;function I(t){return t?"open":"closed"}var ie=N,pe=y,le=D,ue=M;function ve(t){const e=R.c(4);let o;e[0]!==t?({...o}=t,e[0]=t,e[1]=o):o=e[1];let r;return e[2]!==o?(r=c.jsx(ie,{"data-slot":"popover",...o}),e[2]=o,e[3]=r):r=e[3],r}function ge(t){const e=R.c(4);let o;e[0]!==t?({...o}=t,e[0]=t,e[1]=o):o=e[1];let r;return e[2]!==o?(r=c.jsx(pe,{"data-slot":"popover-trigger",...o}),e[2]=o,e[3]=r):r=e[3],r}function Pe(t){const e=R.c(12);let o,r,n,s;e[0]!==t?({className:o,align:n,sideOffset:s,...r}=t,e[0]=t,e[1]=o,e[2]=r,e[3]=n,e[4]=s):(o=e[1],r=e[2],n=e[3],s=e[4]);const a=n===void 0?"center":n,p=s===void 0?4:s;let l;e[5]!==o?(l=Q("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-lg overflow-hidden border p-4 shadow-md outline-hidden",o),e[5]=o,e[6]=l):l=e[6];let u;return e[7]!==a||e[8]!==r||e[9]!==p||e[10]!==l?(u=c.jsx(le,{children:c.jsx(ue,{"data-slot":"popover-content",align:a,sideOffset:p,className:l,...r})}),e[7]=a,e[8]=r,e[9]=p,e[10]=l,e[11]=u):u=e[11],u}export{ve as P,ge as a,Pe as b};
1
+ import{r as i,an as A,z as $,j as c,aq as z,H,aw as L,Z as _,B as b,E as g,ao as w,$ as E,ap as G,b4 as K,b5 as Z,b6 as q,b7 as B,b8 as U,ar as V,as as W,at as J,c as R}from"./index-Ddg6ZSnz.js";import{c as Q}from"./button-DGQafcd8.js";var m="Popover",[j]=H(m,[A]),P=A(),[X,d]=j(m),N=t=>{const{__scopePopover:e,children:o,open:r,defaultOpen:n,onOpenChange:s,modal:a=!1}=t,p=P(e),l=i.useRef(null),[u,h]=i.useState(!1),[x,f]=$({prop:r,defaultProp:n??!1,onChange:s,caller:m});return c.jsx(z,{...p,children:c.jsx(X,{scope:e,contentId:L(),triggerRef:l,open:x,onOpenChange:f,onOpenToggle:i.useCallback(()=>f(C=>!C),[f]),hasCustomAnchor:u,onCustomAnchorAdd:i.useCallback(()=>h(!0),[]),onCustomAnchorRemove:i.useCallback(()=>h(!1),[]),modal:a,children:o})})};N.displayName=m;var F="PopoverAnchor",Y=i.forwardRef((t,e)=>{const{__scopePopover:o,...r}=t,n=d(F,o),s=P(o),{onCustomAnchorAdd:a,onCustomAnchorRemove:p}=n;return i.useEffect(()=>(a(),()=>p()),[a,p]),c.jsx(w,{...s,...r,ref:e})});Y.displayName=F;var S="PopoverTrigger",y=i.forwardRef((t,e)=>{const{__scopePopover:o,...r}=t,n=d(S,o),s=P(o),a=_(e,n.triggerRef),p=c.jsx(b.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":I(n.open),...r,ref:a,onClick:g(t.onClick,n.onOpenToggle)});return n.hasCustomAnchor?p:c.jsx(w,{asChild:!0,...s,children:p})});y.displayName=S;var O="PopoverPortal",[ee,oe]=j(O,{forceMount:void 0}),D=t=>{const{__scopePopover:e,forceMount:o,children:r,container:n}=t,s=d(O,e);return c.jsx(ee,{scope:e,forceMount:o,children:c.jsx(E,{present:o||s.open,children:c.jsx(G,{asChild:!0,container:n,children:r})})})};D.displayName=O;var v="PopoverContent",M=i.forwardRef((t,e)=>{const o=oe(v,t.__scopePopover),{forceMount:r=o.forceMount,...n}=t,s=d(v,t.__scopePopover);return c.jsx(E,{present:r||s.open,children:s.modal?c.jsx(re,{...n,ref:e}):c.jsx(ne,{...n,ref:e})})});M.displayName=v;var te=q("PopoverContent.RemoveScroll"),re=i.forwardRef((t,e)=>{const o=d(v,t.__scopePopover),r=i.useRef(null),n=_(e,r),s=i.useRef(!1);return i.useEffect(()=>{const a=r.current;if(a)return K(a)},[]),c.jsx(Z,{as:te,allowPinchZoom:!0,children:c.jsx(T,{...t,ref:n,trapFocus:o.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:g(t.onCloseAutoFocus,a=>{a.preventDefault(),s.current||o.triggerRef.current?.focus()}),onPointerDownOutside:g(t.onPointerDownOutside,a=>{const p=a.detail.originalEvent,l=p.button===0&&p.ctrlKey===!0,u=p.button===2||l;s.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:g(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),ne=i.forwardRef((t,e)=>{const o=d(v,t.__scopePopover),r=i.useRef(!1),n=i.useRef(!1);return c.jsx(T,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{t.onCloseAutoFocus?.(s),s.defaultPrevented||(r.current||o.triggerRef.current?.focus(),s.preventDefault()),r.current=!1,n.current=!1},onInteractOutside:s=>{t.onInteractOutside?.(s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const a=s.target;o.triggerRef.current?.contains(a)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&n.current&&s.preventDefault()}})}),T=i.forwardRef((t,e)=>{const{__scopePopover:o,trapFocus:r,onOpenAutoFocus:n,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEscapeKeyDown:p,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:h,...x}=t,f=d(v,o),C=P(o);return B(),c.jsx(U,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:n,onUnmountAutoFocus:s,children:c.jsx(V,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:h,onEscapeKeyDown:p,onPointerDownOutside:l,onFocusOutside:u,onDismiss:()=>f.onOpenChange(!1),children:c.jsx(W,{"data-state":I(f.open),role:"dialog",id:f.contentId,...C,...x,ref:e,style:{...x.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),k="PopoverClose",se=i.forwardRef((t,e)=>{const{__scopePopover:o,...r}=t,n=d(k,o);return c.jsx(b.button,{type:"button",...r,ref:e,onClick:g(t.onClick,()=>n.onOpenChange(!1))})});se.displayName=k;var ae="PopoverArrow",ce=i.forwardRef((t,e)=>{const{__scopePopover:o,...r}=t,n=P(o);return c.jsx(J,{...n,...r,ref:e})});ce.displayName=ae;function I(t){return t?"open":"closed"}var ie=N,pe=y,le=D,ue=M;function ve(t){const e=R.c(4);let o;e[0]!==t?({...o}=t,e[0]=t,e[1]=o):o=e[1];let r;return e[2]!==o?(r=c.jsx(ie,{"data-slot":"popover",...o}),e[2]=o,e[3]=r):r=e[3],r}function ge(t){const e=R.c(4);let o;e[0]!==t?({...o}=t,e[0]=t,e[1]=o):o=e[1];let r;return e[2]!==o?(r=c.jsx(pe,{"data-slot":"popover-trigger",...o}),e[2]=o,e[3]=r):r=e[3],r}function Pe(t){const e=R.c(12);let o,r,n,s;e[0]!==t?({className:o,align:n,sideOffset:s,...r}=t,e[0]=t,e[1]=o,e[2]=r,e[3]=n,e[4]=s):(o=e[1],r=e[2],n=e[3],s=e[4]);const a=n===void 0?"center":n,p=s===void 0?4:s;let l;e[5]!==o?(l=Q("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-lg overflow-hidden border p-4 shadow-md outline-hidden",o),e[5]=o,e[6]=l):l=e[6];let u;return e[7]!==a||e[8]!==r||e[9]!==p||e[10]!==l?(u=c.jsx(le,{children:c.jsx(ue,{"data-slot":"popover-content",align:a,sideOffset:p,className:l,...r})}),e[7]=a,e[8]=r,e[9]=p,e[10]=l,e[11]=u):u=e[11],u}export{ve as P,ge as a,Pe as b};
@@ -0,0 +1 @@
1
+ import{r as o,h as i}from"./core-CqC2GVou.js";import{a3 as s}from"./index-Ddg6ZSnz.js";var g=o();const t=s(g);var e=i(t,{});e.registerLanguage=function(a,r){return t.register(r)};e.alias=function(a,r){return t.alias(a,r)};export{e as default};