@marimo-team/frontend 0.14.17-dev47 → 0.14.17-dev49

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 (97) hide show
  1. package/dist/assets/{ConnectedDataExplorerComponent-Det2Qs1c.js → ConnectedDataExplorerComponent-Bgv2RzKj.js} +1 -1
  2. package/dist/assets/{ImageComparisonComponent-wQ5lMG8-.js → ImageComparisonComponent-B3Lop5IR.js} +1 -1
  3. package/dist/assets/{VegaLite-Cpkd57Y-.js → VegaLite-MfrhziFO.js} +1 -1
  4. package/dist/assets/{_baseEach-DnuZagGt.js → _baseEach-CboOLHt8.js} +1 -1
  5. package/dist/assets/_baseMap-D8-XMZET.js +1 -0
  6. package/dist/assets/{_baseUniq-CElDhOne.js → _baseUniq-Cqj9yJG5.js} +1 -1
  7. package/dist/assets/{_createAggregator-DHnXKuMt.js → _createAggregator-BdwfkdDz.js} +1 -1
  8. package/dist/assets/{any-language-editor-CVJTLC5u.js → any-language-editor-_x1nYh2r.js} +1 -1
  9. package/dist/assets/{architectureDiagram-SUXI7LT5-D4eBUBui.js → architectureDiagram-SUXI7LT5-CPVzBEsP.js} +1 -1
  10. package/dist/assets/{blockDiagram-6J76NXCF-pm7dv074.js → blockDiagram-6J76NXCF-DlfkUKz7.js} +1 -1
  11. package/dist/assets/{c4Diagram-6F6E4RAY-DNy2-Qgr.js → c4Diagram-6F6E4RAY-Bu7UQIzr.js} +1 -1
  12. package/dist/assets/channel-B9v8j4Go.js +1 -0
  13. package/dist/assets/{chunk-353BL4L5-Ds3UZacH.js → chunk-353BL4L5-CtcYO28B.js} +1 -1
  14. package/dist/assets/{chunk-67H74DCK-DZtVhLm7.js → chunk-67H74DCK-DKXTXWx2.js} +1 -1
  15. package/dist/assets/{chunk-AACKK3MU-B7Lph287.js → chunk-AACKK3MU-BxuQfJ4s.js} +1 -1
  16. package/dist/assets/{chunk-BFAMUDN2-DHVNKU2O.js → chunk-BFAMUDN2-DLw7_my1.js} +1 -1
  17. package/dist/assets/{chunk-E2GYISFI-BZpHUp5F.js → chunk-E2GYISFI-Cxyy8eSP.js} +1 -1
  18. package/dist/assets/{chunk-OW32GOEJ-xVZ49m3p.js → chunk-OW32GOEJ-DDuE24xr.js} +1 -1
  19. package/dist/assets/{chunk-SKB7J2MH-DejhZ-rT.js → chunk-SKB7J2MH-B1B6VrEO.js} +1 -1
  20. package/dist/assets/{chunk-SZ463SBG-BxG5boZ6.js → chunk-SZ463SBG-NTADSLqj.js} +1 -1
  21. package/dist/assets/{circle-play-Cdub6J0o.js → circle-play-DVfQ0l2S.js} +1 -1
  22. package/dist/assets/classDiagram-M3E45YP4-CLERWJgt.js +1 -0
  23. package/dist/assets/classDiagram-v2-YAWTLIQI-CLERWJgt.js +1 -0
  24. package/dist/assets/clone-1ScLKy47.js +1 -0
  25. package/dist/assets/{compile-4787jcQl.js → compile-D75j0isW.js} +1 -1
  26. package/dist/assets/{dagre-JOIXM2OF-OXumzUDg.js → dagre-JOIXM2OF-4td_jetM.js} +1 -1
  27. package/dist/assets/{data-grid-overlay-editor-BMJHjnsa.js → data-grid-overlay-editor-Dt4zi2L_.js} +1 -1
  28. package/dist/assets/{diagram-5UYTHUR4-DHbJ5_U7.js → diagram-5UYTHUR4-CfYnxrPe.js} +1 -1
  29. package/dist/assets/{diagram-VMROVX33-CjmFddcY.js → diagram-VMROVX33-Owrh1Wu8.js} +1 -1
  30. package/dist/assets/{diagram-ZTM2IBQH-52WnjOVT.js → diagram-ZTM2IBQH-CIOJmGkz.js} +1 -1
  31. package/dist/assets/{edit-page-C9bgVPDv.js → edit-page-grJp0wly.js} +4 -4
  32. package/dist/assets/{erDiagram-3M52JZNH-J5ljahIX.js → erDiagram-3M52JZNH-BV86gyLB.js} +1 -1
  33. package/dist/assets/{flowDiagram-KYDEHFYC-CQbkdfjT.js → flowDiagram-KYDEHFYC-B926KrIE.js} +1 -1
  34. package/dist/assets/{ganttDiagram-EK5VF46D-DW3mHv1y.js → ganttDiagram-EK5VF46D-DaWJo_Ql.js} +1 -1
  35. package/dist/assets/{gitGraphDiagram-GW3U2K7C-_Vzi6GeD.js → gitGraphDiagram-GW3U2K7C-D1sUVH9V.js} +1 -1
  36. package/dist/assets/{glide-data-editor-C_N-U7Mu.js → glide-data-editor-_yVfxM3x.js} +4 -4
  37. package/dist/assets/{graph-C3B7YDHO.js → graph-D8fpekCC.js} +1 -1
  38. package/dist/assets/{home-page-nppQiuX5.js → home-page-CxZoKwo4.js} +1 -1
  39. package/dist/assets/{index-6nVmX_6h.js → index-B0m3HDH9.js} +1 -1
  40. package/dist/assets/{index-CaLVovXl.js → index-B7irOs44.js} +1 -1
  41. package/dist/assets/{index-CrtFsv6w.js → index-BKWYj35Z.js} +1 -1
  42. package/dist/assets/{index-CiQrkvZ0.js → index-BMbozX59.js} +1 -1
  43. package/dist/assets/{index-wz5T6Nco.js → index-BXZZRoXP.js} +1 -1
  44. package/dist/assets/{index-Tz0Xgsro.js → index-B_Qwrnrr.js} +1 -1
  45. package/dist/assets/{index-BsCiyfR2.js → index-Bv_wuJ0R.js} +1 -1
  46. package/dist/assets/{index-CRKROh-3.js → index-CBoReLW5.js} +1 -1
  47. package/dist/assets/{index-aCNNZAjk.js → index-CIQ2C6YR.js} +1 -1
  48. package/dist/assets/{index-Ds4nlPEO.js → index-Ca6vQbH7.js} +1 -1
  49. package/dist/assets/{index-Xr2H6d88.js → index-CcmfV0-G.js} +1 -1
  50. package/dist/assets/{index-BmuId5ZP.js → index-CsGsaGUs.js} +1 -1
  51. package/dist/assets/{index-CK89j-U-.js → index-CvTyqOPR.js} +12 -12
  52. package/dist/assets/{index-DODp33hf.js → index-D-2M1Khu.js} +1 -1
  53. package/dist/assets/{index-CBqlhOvi.js → index-DTYFkcD0.js} +1 -1
  54. package/dist/assets/{index-Bita2c0m.js → index-DYxMy9V4.js} +1 -1
  55. package/dist/assets/{index-Df1n9EKB.js → index-DmwbVsry.js} +1 -1
  56. package/dist/assets/{index-mBDjbLY9.js → index-DpOJh00p.js} +1 -1
  57. package/dist/assets/{index-tecH80M8.js → index-mrTNfOde.js} +1 -1
  58. package/dist/assets/infoDiagram-LHK5PUON-DDkC3tWc.js +2 -0
  59. package/dist/assets/{journeyDiagram-EWQZEKCU-D0dBZR5d.js → journeyDiagram-EWQZEKCU-ClzsEVzX.js} +1 -1
  60. package/dist/assets/{kanban-definition-ZSS6B67P-DdRncWrt.js → kanban-definition-ZSS6B67P-Df8NINOC.js} +1 -1
  61. package/dist/assets/{layout-Dhua0FpY.js → layout-DQOF6B8z.js} +1 -1
  62. package/dist/assets/{linear-6rqHV0qR.js → linear-L6-tpfTv.js} +1 -1
  63. package/dist/assets/{links-CzvxZCrI.js → links-C-KWV9g4.js} +1 -1
  64. package/dist/assets/{mermaid-CHXOPYJ4.js → mermaid-B7GOWzrF.js} +4 -4
  65. package/dist/assets/{min-DEJJphfJ.js → min-GNZm1UWV.js} +1 -1
  66. package/dist/assets/{mindmap-definition-6CBA2TL7-K5FN2acH.js → mindmap-definition-6CBA2TL7-CTwk3LzX.js} +1 -1
  67. package/dist/assets/{number-overlay-editor-Dwz6_GqB.js → number-overlay-editor-CX5ncqMg.js} +1 -1
  68. package/dist/assets/{pieDiagram-NIOCPIFQ-3sYhW3DL.js → pieDiagram-NIOCPIFQ-BQzCdRQS.js} +1 -1
  69. package/dist/assets/{quadrantDiagram-2OG54O6I-PwqZotaF.js → quadrantDiagram-2OG54O6I-DnvXvD4E.js} +1 -1
  70. package/dist/assets/{react-plotly-VAc3fYBt.js → react-plotly-DXqFN-Zg.js} +1 -1
  71. package/dist/assets/{requirementDiagram-QOLK2EJ7-Pyd18-LI.js → requirementDiagram-QOLK2EJ7-BqixW5ms.js} +1 -1
  72. package/dist/assets/{run-page-BG1prWi7.js → run-page-BPkoYoMM.js} +1 -1
  73. package/dist/assets/{sankeyDiagram-4UZDY2LN-mWa32ad9.js → sankeyDiagram-4UZDY2LN-LwRYw1zp.js} +1 -1
  74. package/dist/assets/{sequenceDiagram-SKLFT4DO-CxLWoSwK.js → sequenceDiagram-SKLFT4DO-DAu_UuPr.js} +1 -1
  75. package/dist/assets/{slides-component-DfyvJu2g.js → slides-component-DDi6XxbL.js} +1 -1
  76. package/dist/assets/{sortBy-D-UeDU1v.js → sortBy-DhhDrZQN.js} +1 -1
  77. package/dist/assets/{stateDiagram-MI5ZYTHO-C4P_Rjr3.js → stateDiagram-MI5ZYTHO-CoXJoC5F.js} +1 -1
  78. package/dist/assets/stateDiagram-v2-5AN5P6BG-C0ayTZHg.js +1 -0
  79. package/dist/assets/{storage-Dd2tRMUM.js → storage-C11KBeUF.js} +3 -3
  80. package/dist/assets/{terminal-CVJhAvK-.js → terminal-BLngv0_q.js} +1 -1
  81. package/dist/assets/{time-CR6ekb7V.js → time-DtWAMngE.js} +1 -1
  82. package/dist/assets/{timeline-definition-MYPXXCX6-CyAnxDj3.js → timeline-definition-MYPXXCX6-BH-V-LLg.js} +1 -1
  83. package/dist/assets/tracing-G-LeT7iS.js +2 -0
  84. package/dist/assets/{trash-CR7uFPRR.js → trash-DM6o8PTQ.js} +1 -1
  85. package/dist/assets/{treemap-75Q7IDZK-DM6fmH_r.js → treemap-75Q7IDZK-DdCykUt_.js} +1 -1
  86. package/dist/assets/{vega-component-DJP6v042.js → vega-component-CJXKJypk.js} +1 -1
  87. package/dist/assets/{xychartDiagram-H2YORKM3-C3WPYKvR.js → xychartDiagram-H2YORKM3-D7WP79jG.js} +1 -1
  88. package/dist/index.html +1 -1
  89. package/package.json +1 -1
  90. package/dist/assets/_baseMap-9ng_I44R.js +0 -1
  91. package/dist/assets/channel-BQ4bQhYJ.js +0 -1
  92. package/dist/assets/classDiagram-M3E45YP4-DftR84gd.js +0 -1
  93. package/dist/assets/classDiagram-v2-YAWTLIQI-DftR84gd.js +0 -1
  94. package/dist/assets/clone-sJfSuWKA.js +0 -1
  95. package/dist/assets/infoDiagram-LHK5PUON-C9gnWDtM.js +0 -2
  96. package/dist/assets/stateDiagram-v2-5AN5P6BG-BztwbKkn.js +0 -1
  97. package/dist/assets/tracing-LdOjU5ad.js +0 -2
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./tracing-LdOjU5ad.js","./index-CK89j-U-.js","./index-B-OhZVlA.css","./compile-4787jcQl.js","./time-CR6ekb7V.js","./timer-Bqd5yn_a.js","./linear-6rqHV0qR.js","./init-DLRA0X12.js","./range-CtcPcB_L.js","./zoom-COrs4lFh.js","./ordinal-DDUp3AbE.js","./colors-bszWmPJw.js","./step-BwsUM5iJ.js","./arc-ZB5pDULS.js","./index-BEQfoZiP.js","./storage-Dd2tRMUM.js","./index-Df1n9EKB.js","./index-tecH80M8.js","./index-DODp33hf.js","./index-Xr2H6d88.js","./index-CBqlhOvi.js","./index-CRKROh-3.js","./index-Bita2c0m.js","./index-CrtFsv6w.js","./index-BsCiyfR2.js","./index-CaLVovXl.js","./index-wz5T6Nco.js","./index-CiQrkvZ0.js","./index-BmuId5ZP.js","./apl-CXdQSnD-.js","./asciiarmor-D5V0T9Cu.js","./asterisk-B46aRdXb.js","./brainfuck-CtZaYBKt.js","./clike-BgBwzOhw.js","./cmake-DXn5xaP-.js","./cobol-stawOqaz.js","./coffeescript-BTDxI-eT.js","./commonlisp-vq6DHwts.js","./crystal-CRzZ78HM.js","./cypher-gJDei3ni.js","./d-BShv7fp-.js","./diff-UJJ5BM9S.js","./dockerfile-knGOOxt4.js","./simple-mode-C3vEBAcb.js","./dtd-DI9Herc-.js","./dylan-DkEP81N9.js","./ebnf-B-Df8AvO.js","./ecl-DPFc0Uaf.js","./eiffel-DR5c0IrL.js","./elm-DompmV0j.js","./erlang-BuqgqA5h.js","./factor-CFXhaUWb.js","./fcl-CVaBTCzQ.js","./forth-POgR1ypr.js","./fortran-DL7KluxX.js","./gas-bV0CklSb.js","./gherkin-B6X1vGSW.js","./groovy-DnIzCrpZ.js","./haskell-CLQs6EAM.js","./haxe-D25e-2l-.js","./http-BKJkqRj4.js","./idl-pcmmZuaN.js","./jinja2-DhgKlfW7.js","./julia-DjdwvFuI.js","./livescript-HO6ttBFx.js","./lua-8DXOpKDz.js","./mathematica-IIbmv7SK.js","./mbox-z_N2Mo3d.js","./mirc-DkvFAiy5.js","./modelica-DSrSSXCg.js","./mscgen-B2igx18G.js","./mumps-zvxmGV4l.js","./nginx-B4hAVlXN.js","./nsis-BvKfQ9lQ.js","./ntriples-BSwWqoLa.js","./octave-C4hdQ5Hf.js","./oz-qQq7irPq.js","./pascal-CafrKXZF.js","./perl-tdMlh9QA.js","./pig-CwGJVRC4.js","./powershell-D1ly3AHC.js","./properties-_nPj978X.js","./protobuf-B4y9do6W.js","./puppet-Bc-yJKzi.js","./q-B0kTJ4cI.js","./r-BA4EbLKE.js","./ruby-CR-u2WLS.js","./sas-Bqaci40L.js","./scheme-qjP0V5Ag.js","./shell-BLav31RL.js","./sieve-r025o_jW.js","./smalltalk-C7J3IyEP.js","./solr-78MBEUkU.js","./sparql-BRLJFz69.js","./spreadsheet-CGlWr0eM.js","./stylus-Bdo_Aemu.js","./swift-B_XXVlXX.js","./tcl-B2fODqDH.js","./textile-BuVhTOzU.js","./tiddlywiki-BgR6AEZu.js","./tiki-CI-ztowC.js","./toml-wcPdHu67.js","./troff-Ce85hlLp.js","./ttcn-BxnYHtq8.js","./turtle-BkSuIpt-.js","./vb-BHgjm0DN.js","./vbscript-Dawdd5GZ.js","./velocity-BdD_26Jv.js","./verilog-B4LBqg_1.js","./vhdl-CWWH2SUo.js","./webidl-CGwyPRYs.js","./xquery-CVDBqZPY.js","./yacas-I8QjZlxf.js","./z80-D8p3gKXp.js","./trash-CR7uFPRR.js","./storage-De8XnUVS.css","./links-CzvxZCrI.js","./index-Ds4nlPEO.js","./links-C1rhMrxo.css","./circle-play-Cdub6J0o.js","./_createAggregator-DHnXKuMt.js","./_baseEach-DnuZagGt.js","./loro_wasm_bg-C3hKWL9L.js","./transform-CDNfLgV5.js","./sortBy-D-UeDU1v.js","./_baseMap-9ng_I44R.js","./terminal-CVJhAvK-.js","./terminal-WqMRJt5Z.css"])))=>i.map(i=>d[i]);
2
- var t9=Object.defineProperty;var gk=At=>{throw TypeError(At)};var n9=(At,vt,Zt)=>vt in At?t9(At,vt,{enumerable:!0,configurable:!0,writable:!0,value:Zt}):At[vt]=Zt;var Z=(At,vt,Zt)=>n9(At,typeof vt!="symbol"?vt+"":vt,Zt),o9=(At,vt,Zt)=>vt.has(At)||gk("Cannot "+Zt);var xk=(At,vt,Zt)=>(o9(At,vt,"read from private field"),Zt?Zt.call(At):vt.get(At)),bk=(At,vt,Zt)=>vt.has(At)?gk("Cannot add the same private member more than once"):vt instanceof WeakSet?vt.add(At):vt.set(At,Zt);import{c as Ce,T as M,iH as r9,iI as s9,iJ as yk,iK as a9,dM as i9,dP as l9,b as q,dK as Bf,iL as dr,iM as c9,iN as Uf,iO as vk,iP as d9,iQ as u9,iR as wk,iS as $l,a as H,eN as h9,ac as Xe,j as c,a1 as Dn,a9 as Uo,a8 as rs,aa as ss,bs as $o,a6 as ve,ab as nn,iT as Ca,a7 as Vo,aS as Pn,ad as Ea,at as je,ao as kt,e1 as $f,eR as _a,iU as f9,aN as Fe,S as at,iV as m9,f3 as pn,iW as kk,iX as Sk,iY as Vl,iZ as Nk,i_ as p9,L as ht,dC as Hl,aZ as Ho,i$ as Wl,a$ as Vf,ag as Jt,j0 as g9,aw as Ia,j1 as x9,j2 as jk,f2 as Ck,al as bt,b5 as Ek,j3 as _k,cF as ql,j4 as b9,dU as Qe,j5 as Gl,d$ as jn,j6 as Ik,j7 as Aa,U as Ne,bd as Cn,j8 as Yl,j9 as Kl,eU as as,ja as y9,jb as Ta,jc as Ak,f0 as Tk,jd as Hf,je as Wf,eu as qf,jf as Gn,jg as ur,aX as Xl,jh as v9,ji as Jl,jj as Zl,au as ko,ei as Mk,av as Ma,jk as w9,jl as Ql,jm as Wo,bu as hr,eV as fr,fC as Ok,gp as mr,fR as k9,bg as Mt,jn as S9,jo as N9,gl as ec,aP as tc,jp as Gf,jq as j9,jr as Dk,js as Yf,jt as C9,ju as Kf,jv as Yn,jw as Pk,gn as Xf,jx as Oa,jy as nc,ez as dt,eB as is,jz as mt,jA as ze,jB as st,jC as Jf,jD as E9,jE as Zf,jF as pt,jG as Rk,dw as Da,ds as Pa,dt as Ra,du as La,dr as ls,jH as _9,fP as Qf,b4 as Rn,aJ as En,fF as Lk,fH as Fk,fI as I9,fN as A9,fJ as zk,jI as Bk,ar as pe,et as T9,aV as So,b2 as No,aW as jo,b0 as _t,f1 as on,jJ as Uk,fL as $k,jK as M9,jL as O9,fD as Vk,fE as Hk,jM as cs,dv as Wk,jN as qk,jO as D9,jP as P9,a5 as R9,a4 as L9,jQ as em,dz as F9,dB as tm,fq as oc,jR as rc,jS as sc,bx as gn,jT as z9,eY as Fa,fn as rn,bl as Gk,e2 as Ft,jU as B9,eo as U9,a2 as nm,jV as za,jW as ac,jX as $9,jY as V9,jZ as Yk,j_ as Ht,aY as H9,af as om,gr as Kk,ev as ic,j$ as W9,gN as rm,bk as lc,k0 as sm,a3 as q9,k1 as G9,ae as Ba,eO as Xk,bo as Y9,k2 as K9,k3 as Jk,gY as X9,gW as J9,gZ as Z9,g_ as Q9,k4 as am,dx as Kn,k5 as eO,k6 as cc,k7 as ds,q as Xn,o as He,g5 as Ln,k8 as xn,k9 as tt,ka as us,kb as It,gm as Ot,kc as im,ey as _n,kd as tO,ke as lm,bi as Zk,bj as Qk,kf as e3,kg as nO,gP as hs,kh as dc,bf as uc,gQ as pr,f4 as cm,ki as oO,kj as rO,kk as sO,kl as aO,km as t3,kn as Ua,ko as n3,kp as dm,kq as o3,kr as r3,ks as iO,kt as s3,ku as a3,f5 as um,kv as lO,kw as Jn,kx as hc,ky as i3,dy as l3,kz as fc,gK as hm,kA as $a,kB as Va,kC as Ha,kD as mc,kE as qo,kF as c3,kG as Co,kH as fs,kI as fm,kJ as Wa,kK as ms,kL as mm,kM as pm,kN as d3,kO as pc,kP as cO,ay as qa,kQ as Ga,kR as dO,d_ as gc,kS as uO,kT as gm,kU as hO,kV as fO,kW as xc,e7 as mO,kX as xm,kY as gr,kZ as bc,k_ as ps,g4 as In,gf as Eo,g0 as u3,cq as h3,k$ as bm,fO as f3,l0 as m3,l1 as Ya,l2 as p3,l3 as yc,l4 as ym,l5 as gs,l6 as Ka,l7 as Xa,l8 as pO,fY as vc,l9 as vm,la as wc,en as gO,fZ as xO,lb as bO,lc as yO,ld as vO,le as wO,u as kO,lf as SO,lg as NO,lh as jO,g8 as CO,li as EO,lj as g3,t as z,lk as _O,ll as IO,lm as AO,ln as TO,lo as MO,lp as OO,lq as DO,lr as PO,ls as RO,lt as LO,lu as FO,lv as zO,lw as BO,lx as UO,ly as $O,lz as VO,lA as HO,lB as WO,lC as qO,lD as GO,lE as YO,lF as KO,lG as Ja,lH as XO,lI as JO,lJ as ZO,lK as QO,lL as eD,lM as tD,lN as nD,lO as oD,lP as wm,lQ as kc,lR as x3,lS as rD,lT as sD,lU as b3,lV as aD,lW as xs,lX as An,lY as iD,lZ as lD,l_ as cD,l$ as dD,m0 as uD,m1 as hD,m2 as fD,m3 as mD,m4 as pD,m5 as gD,m6 as Go,m7 as xD,m8 as bD,m9 as yD,ma as vD,e4 as wD,mb as kD,mc as y3,e8 as SD,md as Sc,me as ND,mf as jD,mg as CD,mh as ED,g$ as Yo,mi as Nc,mj as _D,mk as ID,ml as v3,mm as km,gO as bs,mn as AD,mo as TD,mp as MD,mq as Za,mr as Qa,e$ as Sm,ms as OD,gd as DD,br as PD,an as Nm,mt as w3,mu as RD,mv as LD,mw as jm,mx as Cm,my as FD,mz as k3,mA as S3,mB as jc,f$ as zD,Y as N3,dS as BD,mC as j3,fA as yt,mD as ei,mE as ys,mF as UD,mG as $D,mH as VD,mI as HD,cp as Em,mJ as WD,am as Ko,bh as C3,mK as qD,mL as GD,mM as YD,mN as Cc,mO as E3,dQ as Ec,bt as _3,eA as KD,mP as I3,mQ as A3,mR as T3,mS as XD,mT as M3,mU as O3,mV as ti,mW as JD,mX as D3,mY as ZD,mZ as QD,m_ as P3,Z as _c,m$ as eP,bv as R3,n0 as tP,as as _o,n1 as nP,n2 as ni,n3 as oP,n4 as L3,e_ as F3,fS as Ic,n5 as _m,aU as Im,es as Ac,n6 as z3,er as Am,n7 as rP,eX as B3,n8 as sP,n9 as U3,fz as aP,na as iP,gF as lP,fG as cP,fK as Tm,gI as dP,bq as oi,nb as uP,nc as $3,nd as Mm,ne as hP,nf as fP,ng as mP,_ as bn,ew as pP,nh as gP,ni as xP,nj as V3,fs as Om,dE as H3,nk as bP,aq as xr,nl as yP,nm as vP,nn as wP,aO as kP,no as SP,np as NP,nq as jP,nr as CP,V as EP,ns as Tc,X as _P,fo as IP,nt as W3,fW as AP,nu as TP,gv as MP,nv as OP,nw as q3,nx as DP,ny as vs,nz as PP,nA as Mc,nB as RP,nC as LP,nD as FP,z as G3,gU as zP,nE as ri,nF as Y3,nG as K3,nH as X3,nI as J3,nJ as BP,C as Z3,nK as UP,nL as $P,nM as VP,nN as HP,E as br,fa as Q3,be as WP,bc as qP,nO as GP,nP as YP,nQ as KP,dH as eS,nR as Dm,nS as XP,e0 as tS,nT as JP,nU as Pm,nV as ZP,nW as QP,nX as eR,nY as nS,nZ as oS,n_ as rS,fm as sS,n$ as tR,o0 as nR,o1 as aS,o2 as iS,o3 as Oc,o4 as lS,o5 as cS,o6 as oR,o7 as dS,o8 as rR,o9 as sR,oa as uS,ob as aR,oc as iR,od as lR,oe as cR,of as dR,og as uR,dZ as hR,oh as fR,oi as mR,ge as Rm,oj as pR,ok as gR,ol as xR,om as bR,on as yR,oo as vR,op as wR,oq as kR,or as SR,os as NR,ot as Lm,ou as jR,g2 as CR,ov as ER,ow as _R,ox as IR,oy as hS,oz as AR,ax as TR,oA as MR,ap as OR,eQ as DR,gy as PR,oB as RR,oC as LR,gA as Fm,gw as ws,gB as yr,gx as vr,gC as zm,gD as Bm,oD as fS,gz as FR,oE as mS,oF as zR,oG as pS,oH as Xo,oI as gS,gH as BR,oJ as UR,oK as $R,oL as VR,oM as HR,oN as WR,oO as qR,oP as xS,eF as GR,oQ as Um,oR as YR,ah as Dc,oS as bS,oT as yS,aj as vS,ai as KR,dY as XR,__tla as JR}from"./index-CK89j-U-.js";import{b as ks,A as ZR,L as wS,g as QR,G as eL,o as kS,s as tL,k as nL,B as SS,a as oL,M as rL,Y as sL,c as sn,u as si,C as aL,S as iL,K as lL,d as cL,i as dL,e as NS,f as uL,h as hL,j as ai,P as ii,l as jS,m as fL,n as mL,p as pL,D as Ss,q as gL,r as CS,t as $m,T as xL}from"./links-CzvxZCrI.js";import{V as ES,d as wr,I as Vm,N as _S,S as IS,e as AS,f as TS,L as MS,g as OS,F as DS,M as bL,l as PS,h as yL,E as Pc,i as vL,j as Hm,k as Wm,n as wL,o as kL,p as SL,q as NL,s as jL,t as CL,v as EL,w as _L,u as IL,C as AL,R as RS,A as TL,a as ML,T as OL,x as DL,y as PL,m as RL,z as LL,B as FL,O as zL,c as BL,P as UL,__tla as $L}from"./storage-Dd2tRMUM.js";import{c as VL}from"./_createAggregator-DHnXKuMt.js";import{_ as LS,a as FS,i as HL,w as WL,L as zS,A as qL,C as BS,b as qm,c as US,__tla as GL}from"./loro_wasm_bg-C3hKWL9L.js";import{s as Fn,i as Jo,T as Gm,a as Ym}from"./transform-CDNfLgV5.js";import{g as $S}from"./timer-Bqd5yn_a.js";import{i as YL}from"./zoom-COrs4lFh.js";import{s as li}from"./sortBy-D-UeDU1v.js";let Km,Rc,an,Lc,VS,Ns,KL=Promise.all([(()=>{try{return JR}catch{}})(),(()=>{try{return $L}catch{}})(),(()=>{try{return GL}catch{}})()]).then(async()=>{var Ul,fk;var At=VL(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});let vt,Zt,Xm,Fc,js,kr,zc,Bc,Jm,Zm,ci,Uc,Qm,di,ep,$c,tp,np,Vc,op,rp,sp,ui,ap,Hc,ip,lp,cp,dp,up,hp,Wc,fp,qc,Gc,mp,pp,gp,xp,bp,yp,hi,vp,wp,Yc,kp,Sp,Np,Kc,jp,Cp,Ep,fi,Xc,Jc,_p,Ip,Ap,Tp,Mp,Op,Dp,Pp,Rp,Zc,Qc,Lp,Fp,zp,mi,ln,cn;vt=Ce("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),Zt=Ce("arrow-right-to-line",[["path",{d:"M17 12H3",key:"8awo09"}],["path",{d:"m11 18 6-6-6-6",key:"8c2y43"}],["path",{d:"M21 5v14",key:"nzette"}]]),Xm=Ce("arrow-right-from-line",[["path",{d:"M3 5v14",key:"1nt18q"}],["path",{d:"M21 12H7",key:"13ipq5"}],["path",{d:"m15 18 6-6-6-6",key:"6tx3qv"}]]),Fc=Ce("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),js=Ce("ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]),kr=Ce("between-horizontal-start",[["rect",{width:"13",height:"7",x:"8",y:"3",rx:"1",key:"pkso9a"}],["path",{d:"m2 9 3 3-3 3",key:"1agib5"}],["rect",{width:"13",height:"7",x:"8",y:"14",rx:"1",key:"1q5fc1"}]]),zc=Ce("chevrons-down",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),Bc=Ce("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),Lc=Ce("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),Jm=Ce("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),Zm=Ce("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),ci=Ce("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),Uc=Ce("clipboard-copy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]),Qm=Ce("clipboard-paste",[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]]),di=Ce("cloud-download",[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]]),ep=Ce("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]),$c=Ce("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]),tp=Ce("copy-minus",[["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),np=Ce("diamond-plus",[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]),Vc=Ce("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]),op=Ce("eraser",[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]]),rp=Ce("fast-forward",[["polygon",{points:"13 19 22 12 13 5 13 19",key:"587y9g"}],["polygon",{points:"2 19 11 12 2 5 2 19",key:"3pweh0"}]]),sp=Ce("file-pen",[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]),ui=Ce("file-plus-2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]]),ap=Ce("files",[["path",{d:"M20 7h-3a2 2 0 0 1-2-2V2",key:"x099mo"}],["path",{d:"M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z",key:"18t6ie"}],["path",{d:"M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8",key:"1nja0z"}]]),Hc=Ce("folder-plus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),ip=Ce("folder-tree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]),lp=Ce("grip-vertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]),cp=Ce("hard-drive-download",[["path",{d:"M12 2v8",key:"1q4o3n"}],["path",{d:"m16 6-4 4-4-4",key:"6wukr"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 18h.01",key:"h775k"}]]),dp=Ce("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]),up=Ce("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]),hp=Ce("key-round",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]),Wc=Ce("key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]),fp=Ce("keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]),qc=Ce("layout-template",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]),Gc=Ce("list-tree",[["path",{d:"M21 12h-8",key:"1bmf0i"}],["path",{d:"M21 6H8",key:"1pqkrb"}],["path",{d:"M21 18h-8",key:"1tm79t"}],["path",{d:"M3 6v4c0 1.1.9 2 2 2h3",key:"1ywdgy"}],["path",{d:"M3 10v6c0 1.1.9 2 2 2h3",key:"2wc746"}]]),mp=Ce("list",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]),pp=Ce("map-pin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]),gp=Ce("map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]),xp=Ce("memory-stick",[["path",{d:"M6 19v-3",key:"1nvgqn"}],["path",{d:"M10 19v-3",key:"iu8nkm"}],["path",{d:"M14 19v-3",key:"kcehxu"}],["path",{d:"M18 19v-3",key:"1vh91z"}],["path",{d:"M8 11V9",key:"63erz4"}],["path",{d:"M16 11V9",key:"fru6f3"}],["path",{d:"M12 11V9",key:"ha00sb"}],["path",{d:"M2 15h20",key:"16ne18"}],["path",{d:"M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z",key:"lhddv3"}]]),bp=Ce("message-circle-question-mark",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),yp=Ce("microchip",[["path",{d:"M18 12h2",key:"quuxs7"}],["path",{d:"M18 16h2",key:"zsn3lv"}],["path",{d:"M18 20h2",key:"9x5y9y"}],["path",{d:"M18 4h2",key:"1luxfb"}],["path",{d:"M18 8h2",key:"nxqzg"}],["path",{d:"M4 12h2",key:"1ltxp0"}],["path",{d:"M4 16h2",key:"8a5zha"}],["path",{d:"M4 20h2",key:"27dk57"}],["path",{d:"M4 4h2",key:"10groj"}],["path",{d:"M4 8h2",key:"18vq6w"}],["path",{d:"M8 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2h-1.5c-.276 0-.494.227-.562.495a2 2 0 0 1-3.876 0C9.994 2.227 9.776 2 9.5 2z",key:"1681fp"}]]),hi=Ce("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]),vp=Ce("octagon-alert",[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]]),wp=Ce("package-check",[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]),Yc=Ce("package-x",[["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["path",{d:"m17 13 5 5m-5 0 5-5",key:"im3w4b"}]]),kp=Ce("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Sp=Ce("party-popper",[["path",{d:"M5.8 11.3 2 22l10.7-3.79",key:"gwxi1d"}],["path",{d:"M4 3h.01",key:"1vcuye"}],["path",{d:"M22 8h.01",key:"1mrtc2"}],["path",{d:"M15 2h.01",key:"1cjtqr"}],["path",{d:"M22 20h.01",key:"1mrys2"}],["path",{d:"m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10",key:"hbicv8"}],["path",{d:"m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17",key:"1i94pl"}],["path",{d:"m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7",key:"1cofks"}],["path",{d:"M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z",key:"4kbmks"}]]),Np=Ce("pen-line",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]),Kc=Ce("presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]),jp=Ce("regex",[["path",{d:"M17 3v10",key:"15fgeh"}],["path",{d:"m12.67 5.5 8.66 5",key:"1gpheq"}],["path",{d:"m12.67 10.5 8.66-5",key:"1dkfa6"}],["path",{d:"M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z",key:"swwfx4"}]]),Cp=Ce("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]),Ep=Ce("rows-3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]),fi=Ce("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]),Xc=Ce("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]),Jc=Ce("scroll-text",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]),_p=Ce("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),Ip=Ce("square-code",[["path",{d:"m10 9-3 3 3 3",key:"1oro0q"}],["path",{d:"m14 15 3-3-3-3",key:"bz13h7"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),Ap=Ce("square-dashed-bottom-code",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["path",{d:"M5 21a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2",key:"as5y1o"}],["path",{d:"M9 21h1",key:"15o7lz"}]]),Tp=Ce("square-equal",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M7 14h10",key:"1mhdw3"}]]),Mp=Ce("square-m",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8l4 4 4-4v8",key:"141u4e"}]]),Op=Ce("square-play",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m9 8 6 4-6 4Z",key:"f1r3lt"}]]),Dp=Ce("square-power",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),Pp=Ce("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]),Rp=Ce("text-cursor-input",[["path",{d:"M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6",key:"1528k5"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1",key:"1mj8rg"}],["path",{d:"M9 6v12",key:"velyjx"}]]),Zc=Ce("text-search",[["path",{d:"M21 6H3",key:"1jwq7v"}],["path",{d:"M10 12H3",key:"1ulcyk"}],["path",{d:"M10 18H3",key:"13769t"}],["circle",{cx:"17",cy:"15",r:"3",key:"1upz2a"}],["path",{d:"m21 19-1.9-1.9",key:"dwi7p8"}]]),Qc=Ce("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),Lp=Ce("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),Fp=Ce("view",[["path",{d:"M21 17v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-2",key:"mrq65r"}],["path",{d:"M21 7V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2",key:"be3xqs"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]]),zp=Ce("whole-word",[["circle",{cx:"7",cy:"12",r:"3",key:"12clwm"}],["path",{d:"M10 9v6",key:"17i7lo"}],["circle",{cx:"17",cy:"12",r:"3",key:"gl7c2s"}],["path",{d:"M14 7v8",key:"dl84cr"}],["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]]),mi=Ce("workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]),ln=Ce("zap-off",[["path",{d:"M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317",key:"193nxd"}],["path",{d:"M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773",key:"27a7lr"}],["path",{d:"M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643",key:"1e0qe9"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),cn=Ce("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);const HS=M.createContext({}),WS=M.forwardRef(function(t,e){[t,e]=i9(t,e,HS);let{toolbarProps:n}=function(s,a){const{"aria-label":i,"aria-labelledby":l,orientation:d="horizontal"}=s;let[u,h]=M.useState(!1);r9(()=>{var p;h(!(!a.current||!(!((p=a.current.parentElement)===null||p===void 0)&&p.closest('[role="toolbar"]'))))});const{direction:f}=s9(),m=f==="rtl"&&d==="horizontal";let x=a9(a);const g=M.useRef(null);return{toolbarProps:{...yk(s,{labelable:!0}),role:u?"group":"toolbar","aria-orientation":d,"aria-label":i,"aria-labelledby":i==null?l:void 0,onKeyDownCapture:u?void 0:p=>{if(p.currentTarget.contains(p.target)){if(d==="horizontal"&&p.key==="ArrowRight"||d==="vertical"&&p.key==="ArrowDown")m?x.focusPrevious():x.focusNext();else{if(!(d==="horizontal"&&p.key==="ArrowLeft"||d==="vertical"&&p.key==="ArrowUp"))return p.key==="Tab"?(p.stopPropagation(),g.current=document.activeElement,void(p.shiftKey?x.focusFirst():x.focusLast())):void 0;m?x.focusNext():x.focusPrevious()}p.stopPropagation(),p.preventDefault()}},onFocusCapture:u?void 0:p=>{var b,y;g.current&&!p.currentTarget.contains(p.relatedTarget)&&(!((b=a.current)===null||b===void 0)&&b.contains(p.target))&&((y=g.current)===null||y===void 0||y.focus(),g.current=null)},onBlurCapture:u?void 0:p=>{p.currentTarget.contains(p.relatedTarget)||g.current||(g.current=p.target)}}}}(t,e),o=l9({...t,values:{orientation:t.orientation||"horizontal"},defaultClassName:"react-aria-Toolbar"}),r=yk(t);return delete r.id,q.createElement("div",{...Bf(n,r),...o,ref:e,slot:t.slot||void 0,"data-orientation":t.orientation||"horizontal"},o.children)});function pi(t,e){const n=+dr(t)-+dr(e);return n<0?-1:n>0?1:n}function qS(t,e){const n=dr(t,e==null?void 0:e.in);return+function(o,r){const s=dr(o,r==null?void 0:r.in);return s.setHours(23,59,59,999),s}(n,e)==+function(o,r){const s=dr(o,r==null?void 0:r.in),a=s.getMonth();return s.setFullYear(s.getFullYear(),a+1,0),s.setHours(23,59,59,999),s}(n,e)}function GS(t,e,n){const[o,r,s]=Uf(n==null?void 0:n.in,t,t,e),a=pi(r,s),i=Math.abs(function(u,h,f){const[m,x]=Uf(f==null?void 0:f.in,u,h);return 12*(m.getFullYear()-x.getFullYear())+(m.getMonth()-x.getMonth())}(r,s));if(i<1)return 0;r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-a*i);let l=pi(r,s)===-a;qS(o)&&i===1&&pi(o,s)===1&&(l=!1);const d=a*(i-+l);return d===0?0:d}function YS(t,e,n){const o=function(r,s){return+dr(r)-+dr(s)}(t,e)/1e3;return(r=>{const s=(0,Math.trunc)(r);return s===0?0:s})(o)}function KS(t,e){return function(n,o,r){const s=d9(),a=(r==null?void 0:r.locale)??s.locale??u9,i=pi(n,o);if(isNaN(i))throw new RangeError("Invalid time value");const l=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:i}),[d,u]=Uf(r==null?void 0:r.in,...i>0?[o,n]:[n,o]),h=YS(u,d),f=(vk(u)-vk(d))/1e3,m=Math.round((h-f)/60);let x;if(m<2)return m===0?a.formatDistance("lessThanXMinutes",1,l):a.formatDistance("xMinutes",m,l);if(m<45)return a.formatDistance("xMinutes",m,l);if(m<90)return a.formatDistance("aboutXHours",1,l);if(m<wk){const g=Math.round(m/60);return a.formatDistance("aboutXHours",g,l)}if(m<2520)return a.formatDistance("xDays",1,l);if(m<$l){const g=Math.round(m/wk);return a.formatDistance("xDays",g,l)}if(m<2*$l)return x=Math.round(m/$l),a.formatDistance("aboutXMonths",x,l);if(x=GS(u,d),x<12){const g=Math.round(m/$l);return a.formatDistance("xMonths",g,l)}{const g=x%12,p=Math.trunc(x/12);return g<3?a.formatDistance("aboutXYears",p,l):g<9?a.formatDistance("overXYears",p,l):a.formatDistance("almostXYears",p+1,l)}}(t,function(n){return c9(n,Date.now())}(t),e)}const gi="https://static.marimo.app",XS=t=>{const e=H.c(24),{onClose:n}=t,[o,r]=M.useState("");let s;s=Math.random().toString(36).slice(2,6);const a=`${o}-${s}`,i=`${gi}/static/${a}`;let l,d,u,h,f,m,x,g,p,b,y;return e[0]!==n||e[1]!==a?(l=async v=>{v.preventDefault(),n();const w=await h9({download:!1,includeCode:!0,files:ES.INSTANCE.filenames()}),S=Xe({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${gi}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:w,path:a})}).catch(()=>{S.dismiss(),Xe({title:"Error uploading static page",description:c.jsxs("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",c.jsx("a",{href:Dn.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),S.dismiss(),Xe({title:"Static page uploaded!",description:c.jsxs("div",{children:["The URL has been copied to your clipboard.",c.jsx("br",{}),"You can share it with anyone."]})})},e[0]=n,e[1]=a,e[2]=l):l=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(Uo,{children:"Share static notebook"}),e[3]=d):d=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsxs(rs,{children:[d,c.jsxs(ss,{children:["You can publish a static, non-interactive version of this notebook to the public web. We will create a link for you that lives on"," ",c.jsx("a",{href:gi,target:"_blank",children:gi}),"."]})]}),e[4]=u):u=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(h=v=>{const w=v.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,"");r(w)},e[5]=h):h=e[5],e[6]!==o?(f=c.jsx($o,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:h,required:!0,autoComplete:"off"}),e[6]=o,e[7]=f):f=e[7],e[8]!==i?(m=c.jsxs("div",{className:"font-semibold text-sm text-muted-foreground gap-2 flex flex-col",children:["Anyone will be able to access your notebook at this URL:",c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(JS,{text:i}),c.jsx("span",{className:"text-primary",children:i})]})]}),e[8]=i,e[9]=m):m=e[9],e[10]!==f||e[11]!==m?(x=c.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[f,m]}),e[10]=f,e[11]=m,e[12]=x):x=e[12],e[13]!==n?(g=c.jsx(ve,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),e[13]=n,e[14]=g):g=e[14],e[15]!==i?(p=c.jsx(ve,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await nn(i)},children:"Create"}),e[15]=i,e[16]=p):p=e[16],e[17]!==p||e[18]!==g?(b=c.jsxs(Ca,{children:[g,p]}),e[17]=p,e[18]=g,e[19]=b):b=e[19],e[20]!==b||e[21]!==l||e[22]!==x?(y=c.jsx(Vo,{className:"w-fit",children:c.jsxs("form",{onSubmit:l,children:[u,x,b]})}),e[20]=b,e[21]=l,e[22]=x,e[23]=y):y=e[23],y},JS=t=>{const e=H.c(8),[n,o]=q.useState(!1);let r;e[0]!==t.text?(r=Pn.stopPropagation(async d=>{d.preventDefault(),await nn(t.text),o(!0),setTimeout(()=>o(!1),2e3)}),e[0]=t.text,e[1]=r):r=e[1];const s=r;let a,i,l;return e[2]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx(Ea,{size:14,strokeWidth:1.5}),e[2]=a):a=e[2],e[3]!==s?(i=c.jsx(ve,{"data-testid":"copy-static-notebook-url-button",onClick:s,size:"xs",variant:"secondary",children:a}),e[3]=s,e[4]=i):i=e[4],e[5]!==n||e[6]!==i?(l=c.jsx(je,{content:"Copied!",open:n,children:i}),e[5]=n,e[6]=i,e[7]=l):l=e[7],l};function Bp(){const t=H.c(2),e=kt($f);let n;return t[0]!==e?(n=()=>{const o=document.getElementsByClassName("output-area"),r=window.innerHeight||document.documentElement.clientHeight;let s=null;for(const a of Array.from(o)){const i=a.getBoundingClientRect();if(i.top>=0&&i.top<=r||i.bottom>=0&&i.bottom<=r){s=_a.parse(a.parentNode.id);break}}e(a=>({mode:f9(a.mode),cellAnchor:s})),requestAnimationFrame(()=>{var a;s!==null&&((a=document.getElementById(_a.create(s)))==null||a.scrollIntoView())})},t[0]=e,t[1]=n):n=t[1],n}function ed(t){const e=H.c(3),n=Cs();let o;return e[0]!==t||e[1]!==n?(o=()=>{t!==void 0&&n([t])},e[0]=t,e[1]=n,e[2]=o):o=e[2],Fe(o)}function Up(){const t=H.c(2),e=Cs();let n;return t[0]!==e?(n=()=>e(kk(pn())),t[0]=e,t[1]=n):n=t[1],Fe(n)}function Cs(){const t=H.c(2),{prepareForRun:e}=at();let n;return t[0]!==e?(n=async o=>{var i,l;if(o.length===0)return;const{cellHandles:r,cellData:s}=pn(),a=[];for(const d of o){const u=r[d],h=(i=u==null?void 0:u.current)==null?void 0:i.editorView;let f;h?(Sk(h)!=="markdown"&&Vl(h),f=Nk(h)):f=((l=s[d])==null?void 0:l.code)||"",a.push(f),e({cellId:d})}await p9({cellIds:o,codes:a}).catch(ZS)},t[0]=e,t[1]=n):n=t[1],Fe(n)}function ZS(t){ht.error(t)}const td=[{type:"files",Icon:ip,tooltip:"View files",position:"sidebar"},{type:"variables",Icon:Hl,tooltip:"Explore variables",position:"sidebar"},{type:"datasources",Icon:Ho,tooltip:"Explore data sources",position:"sidebar"},{type:"dependencies",Icon:hi,tooltip:"Explore dependencies",position:"sidebar"},{type:"packages",Icon:ks,tooltip:"Manage packages",position:"sidebar"},{type:"outline",Icon:Jc,tooltip:"View outline",position:"sidebar"},{type:"chat",Icon:Wl,tooltip:"Chat with AI",position:"sidebar"},{type:"documentation",Icon:Zc,tooltip:"View live docs",position:"sidebar"},{type:"logs",Icon:Vf,tooltip:"Notebook logs",position:"sidebar"},{type:"tracing",Icon:ZR,tooltip:"Tracing",position:"sidebar"},{type:"snippets",Icon:Ap,tooltip:"Snippets",position:"sidebar"},{type:"secrets",Icon:hp,tooltip:"Secrets",hidden:Jt(),position:"sidebar"},{type:"scratchpad",Icon:g9,tooltip:"Scratchpad",position:"sidebar"},{type:"errors",Icon:Ia,tooltip:"View errors",position:"footer"}];function QS(){const t=H.c(7);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0];const[n,o]=function(a,i){const l=H.c(11);let d;l[0]!==i?(d=new x9(i),l[0]=i,l[1]=d):d=l[1];const u=d;let h;l[2]!==a||l[3]!==u?(h=()=>u.get(a),l[2]=a,l[3]=u,l[4]=h):h=l[4];const[f,m]=M.useState(h);let x;l[5]!==a||l[6]!==u?(x=b=>{m(b),u.set(a,b)},l[5]=a,l[6]=u,l[7]=x):x=l[7];const g=x;let p;return l[8]!==g||l[9]!==f?(p=[f,g],l[8]=g,l[9]=f,l[10]=p):p=l[10],p}("marimo:commands",e);let r,s;return t[1]!==n||t[2]!==o?(r=a=>{const i=(l=[a,...n],[...new Set(l)]);var l;o(i.slice(0,3))},t[1]=n,t[2]=o,t[3]=r):r=t[3],t[4]!==n||t[5]!==r?(s={recentCommands:n,addRecentCommand:r},t[4]=n,t[5]=r,t[6]=s):s=t[6],s}function $p(t){return t.dropdown!==void 0}function xi(t,e=""){return t.flatMap(n=>n.label?$p(n)?xi(n.dropdown,`${e+n.label} > `):{...n,label:e+n.label}:[])}const Es=t=>{const e=H.c(8),{children:n,layerTop:o}=t,r=o!==void 0&&o;let s;e[0]!==n?(s=q.Children.toArray(n),e[0]=n,e[1]=s):s=e[1];const[a,i]=s,l=`second-icon absolute ${r?"top-[-2px] left-[-2px]":"bottom-[-2px] right-[-2px]"} rounded-full`;let d,u;return e[2]!==i||e[3]!==l?(d=c.jsx("div",{className:l,children:i}),e[2]=i,e[3]=l,e[4]=d):d=e[4],e[5]!==a||e[6]!==d?(u=c.jsxs("div",{className:"multi-icon relative w-fit",children:[a,d]}),e[5]=a,e[6]=d,e[7]=u):u=e[7],u},_s=bt(null),eN=bt(!1),nd=Ek("marimo:ai:chatState:v3",{chats:[],activeChatId:null}),tN=bt(t=>{const e=t(nd);return e.chats.find(n=>n.id===e.activeChatId)},(t,e,n)=>{e(nd,o=>({...o,activeChatId:n}))});function Vp(t){return t!==_k&&!!(t&&t.trim().length>0)}const bi=t=>{const e=H.c(7);let n,o;e[0]!==t?(n=i=>{var l;(i.ctrlKey||i.metaKey)&&i.key==="z"&&(i.preventDefault(),i.stopPropagation(),(l=t.onClick)==null||l.call(t,i))},e[0]=t,e[1]=n):n=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(o={capture:!0},e[2]=o):o=e[2],ql(window,"keydown",n,o);const r=t.children??"Undo";let s,a;return e[3]===Symbol.for("react.memo_cache_sentinel")?(s=c.jsx(b9,{className:"ml-2",shortcut:"cmd-z"}),e[3]=s):s=e[3],e[4]!==r||e[5]!==t?(a=c.jsxs(ve,{"data-testid":"undo-button",size:"sm",variant:"outline",...t,children:[r," ",s]}),e[4]=r,e[5]=t,e[6]=a):a=e[6],a};function Is(){const t=H.c(3),{deleteCell:e,undoDeleteCell:n}=at();let o;return t[0]!==e||t[1]!==n?(o=r=>{var l;if(Qe.get(Gl))return;const{cellId:s}=r,a=Qe.get(jn),i=(((l=a.cellData[s])==null?void 0:l.code)??"").trim()==="";if(e({cellId:s}),Ik({cellId:s}).catch(()=>{n()}),!i){const{dismiss:d}=Xe({title:"Cell deleted",description:"You can bring it back by clicking undo or through the command palette.",action:c.jsx(bi,{"data-testid":"undo-delete-button",onClick:()=>{n(),u()}})}),u=d}},t[0]=e,t[1]=n,t[2]=o):o=t[2],Fe(o)}function As(){const t=H.c(3),{deleteCell:e,undoDeleteCell:n}=at();let o;return t[0]!==e||t[1]!==n?(o=async r=>{if(Qe.get(Gl))return;const{cellIds:s}=r;for(const l of s)await Ik({cellId:l}).then(()=>{e({cellId:l})});const{dismiss:a}=Xe({title:"Cells deleted",action:c.jsx(bi,{"data-testid":"undo-delete-button",onClick:()=>{for(const l of s)n();i()}})}),i=a},t[0]=e,t[1]=n,t[2]=o):o=t[2],Fe(o)}function Hp(){const t=H.c(3),{splitCell:e,undoSplitCell:n}=at();let o;return t[0]!==e||t[1]!==n?(o=r=>{const s=Aa(r.cellId);if(!s)return;const a=Nk(s);e(r);const{dismiss:i}=Xe({title:"Cell split",action:c.jsx(bi,{"data-testid":"undo-split-button",size:"sm",variant:"outline",onClick:()=>{n({...r,snapshot:a}),l()},children:"Undo"})}),l=i},t[0]=e,t[1]=n,t[2]=o):o=t[2],Fe(o)}function od(t){const e=H.c(49),{cell:n}=t,{createNewCell:o,updateCellConfig:r,updateCellName:s,moveCell:a,sendToTop:i,sendToBottom:l,addColumnBreakpoint:d,clearCellOutput:u}=at(),h=Hp(),f=ed(n==null?void 0:n.cellId),m=!Ne(Gl),x=Is(),{openModal:g}=Cn(),p=kt(_s),b=Ne(Yl),y=Ne(Kl),v=Ne(as),w=Ne(y9);if(!n||v){let C;return e[0]===Symbol.for("react.memo_cache_sentinel")?(C=[],e[0]=C):C=e[0],C}const{cellId:S,config:N,getEditorView:j,name:E,hasOutput:_,hasConsoleOutput:A,status:I}=n;let P;e[1]!==S||e[2]!==N.disabled||e[3]!==r?(P=async()=>{const C={disabled:!N.disabled};await Wo({configs:{[S]:C}}),r({cellId:S,config:C})},e[1]=S,e[2]=N.disabled,e[3]=r,e[4]=P):P=e[4];const L=P;let O;e[5]!==S||e[6]!==N.hide_code||e[7]!==j||e[8]!==r?(O=async()=>{const C={hide_code:!N.hide_code};await Wo({configs:{[S]:C}}),r({cellId:S,config:C});const U=j();U&&(C.hide_code?U.contentDOM.blur():U.focus())},e[5]=S,e[6]=N.hide_code,e[7]=j,e[8]=r,e[9]=O):O=e[9];const R=O;let F,D,T,k,B;return e[10]===Symbol.for("react.memo_cache_sentinel")?(F=c.jsx(Rp,{size:13,strokeWidth:1.5}),e[10]=F):F=e[10],e[11]!==S||e[12]!==E||e[13]!==g||e[14]!==s?(D=()=>{g(c.jsxs(Vo,{children:[c.jsx(rs,{children:c.jsx(Uo,{children:"Rename cell"})}),c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx(hr,{htmlFor:"cell-name",children:"Cell name"}),c.jsx(_S,{placeholder:"cell name",value:E,onKeyDown:C=>{C.key==="Enter"&&(C.preventDefault(),C.stopPropagation(),g(null))},onChange:C=>s({cellId:S,name:C})})]})]}))},e[11]=S,e[12]=E,e[13]=g,e[14]=s,e[15]=D):D=e[15],e[16]!==S||e[17]!==s?(T=C=>s({cellId:S,name:C}),e[16]=S,e[17]=s,e[18]=T):T=e[18],e[19]!==E||e[20]!==T?(k=c.jsx(_S,{placeholder:"cell name",value:E,onChange:T}),e[19]=E,e[20]=T,e[21]=k):k=e[21],e[22]!==d||e[23]!==b||e[24]!==w||e[25]!==y||e[26]!==m||e[27]!==S||e[28]!==u||e[29]!==N.disabled||e[30]!==N.hide_code||e[31]!==o||e[32]!==x||e[33]!==j||e[34]!==A||e[35]!==_||e[36]!==a||e[37]!==E||e[38]!==f||e[39]!==l||e[40]!==i||e[41]!==p||e[42]!==h||e[43]!==I||e[44]!==D||e[45]!==k||e[46]!==L||e[47]!==R?(B=[[{icon:F,label:"Name",disableClick:!0,handle:sN,handleHeadless:D,rightElement:k},{icon:c.jsx(wr,{size:13,strokeWidth:1.5}),label:"Run cell",hotkey:"cell.run",hidden:I==="running"||I==="queued"||I==="disabled-transitively"||N.disabled,handle:()=>f()},{icon:c.jsx(Ta,{size:13,strokeWidth:1.5}),label:"AI completion",hidden:!b,handle:()=>{p(C=>(C==null?void 0:C.cellId)===S?null:{cellId:S})},hotkey:"cell.aiCompletion"},{icon:c.jsx(Xc,{size:13,strokeWidth:1.5}),label:"Split cell",hotkey:"cell.splitCell",handle:()=>h({cellId:S})},{icon:c.jsx(Vm,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!_,handle:()=>function(C){const U=document.getElementById(jk.create(C));U&&(U.classList.add("printing-output"),Ck(U,"result.png").finally(()=>{U.classList.remove("printing-output")}))}(S)},{icon:c.jsx(Tk,{size:13,strokeWidth:1.5}),label:"Format cell",hotkey:"cell.format",handle:()=>{const C=j();C&&Ak({[S]:C})}},{icon:N.hide_code?c.jsx(Hf,{size:13,strokeWidth:1.5}):c.jsx(Wf,{size:13,strokeWidth:1.5}),label:N.hide_code?"Show code":"Hide code",handle:R,hotkey:"cell.hideCode"},{icon:N.disabled?c.jsx(ln,{size:13,strokeWidth:1.5}):c.jsx(cn,{size:13,strokeWidth:1.5}),label:"Reactive execution",rightElement:c.jsx(qf,{"data-testid":"cell-disable-switch",checked:!N.disabled,size:"sm",onCheckedChange:L}),handle:L},{icon:c.jsx(Ia,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(_||A),handle:()=>{u({cellId:S})}}],[{icon:c.jsx(Xl,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:()=>{const C=j();C&&(Gn({autoInstantiate:y,createNewCell:o}),ur(C,{language:"markdown",keepCodeAsIs:!1}))}},{icon:c.jsx(Ho,{size:13,strokeWidth:1.5}),label:"Convert to SQL",handle:()=>{const C=j();C&&(Gn({autoInstantiate:y,createNewCell:o}),ur(C,{language:"sql",keepCodeAsIs:!1}))}},{icon:c.jsx(Jl,{}),label:"Toggle as Python",handle:()=>{const C=j();C&&(Gn({autoInstantiate:y,createNewCell:o}),v9(C,"python",{force:!0}))}}],[{icon:c.jsxs(Es,{children:[c.jsx(ci,{size:13,strokeWidth:1.5}),c.jsx(Zl,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>o({cellId:S,before:!0})},{icon:c.jsxs(Es,{children:[c.jsx(ci,{size:13,strokeWidth:1.5}),c.jsx(ko,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>o({cellId:S,before:!1})},{icon:c.jsx(Zl,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>a({cellId:S,before:!0})},{icon:c.jsx(ko,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>a({cellId:S,before:!1})},{icon:c.jsx(Mk,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>a({cellId:S,direction:"left"}),hidden:w!=="columns"},{icon:c.jsx(Ma,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>a({cellId:S,direction:"right"}),hidden:w!=="columns"},{icon:c.jsx(Bc,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>i({cellId:S,scroll:!1})},{icon:c.jsx(zc,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>l({cellId:S,scroll:!1})},{icon:c.jsx(w9,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",hidden:w!=="columns",handle:()=>d({cellId:S})}],[{icon:c.jsx(wS,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!Vp(E),tooltip:Vp(E)?void 0:"Only named cells can be linked to",handle:async()=>{await nn(function(C){const U=new URL(window.location.href);return U.hash=`scrollTo=${encodeURIComponent(C)}`,U.toString()}(E)),Xe({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!m,variant:"danger",icon:c.jsx(Ql,{size:13,strokeWidth:1.5}),handle:()=>{x({cellId:S})}}]].map(oN).filter(nN),e[22]=d,e[23]=b,e[24]=w,e[25]=y,e[26]=m,e[27]=S,e[28]=u,e[29]=N.disabled,e[30]=N.hide_code,e[31]=o,e[32]=x,e[33]=j,e[34]=A,e[35]=_,e[36]=a,e[37]=E,e[38]=f,e[39]=l,e[40]=i,e[41]=p,e[42]=h,e[43]=I,e[44]=D,e[45]=k,e[46]=L,e[47]=R,e[48]=B):B=e[48],B}function nN(t){return t.length>0}function oN(t){return t.filter(rN)}function rN(t){return!t.hidden}function sN(t){t==null||t.stopPropagation(),t==null||t.preventDefault()}function aN(t){return!t.hidden}const rd=bt(!1),Wp=()=>{const t=H.c(37),[e,n]=Mt(rd),o=S9(),r=Ne(N9),s=Ne(ec);let a;t[0]!==r?(a={cell:r},t[0]=r,t[1]=a):a=t[1];let i=od(a).flat();i=xi(i);const l=function(){const T=H.c(73),[k,B]=fr(),[C,U]=Ok();let V;T[0]!==B?(V=async K=>{await mr({config:K}).then(()=>{B(K)})},T[0]=B,T[1]=V):V=T[1];const $=V;let X;T[2]!==U?(X=async K=>{await k9({config:K}).then(()=>{U(K)})},T[2]=U,T[3]=X):X=T[3];const Y=X;let J;if(T[4]!==C||T[5]!==k||T[6]!==Y||T[7]!==$){let K,oe,re,ne,ae;T[9]!==C?(K=Pe=>Pe!==C.width,T[9]=C,T[10]=K):K=T[10],T[11]!==C||T[12]!==Y?(oe=Pe=>({label:`App config > Set width=${Pe}`,handle:()=>{Y({...C,width:Pe})}}),T[11]=C,T[12]=Y,T[13]=oe):oe=T[13],T[14]!==k||T[15]!==$?(re={label:"Config > Set theme: dark",handle:()=>{$({...k,display:{...k.display,theme:"dark"}})}},T[14]=k,T[15]=$,T[16]=re):re=T[16],T[17]!==k||T[18]!==$?(ne={label:"Config > Set theme: light",handle:()=>{$({...k,display:{...k.display,theme:"light"}})}},T[17]=k,T[18]=$,T[19]=ne):ne=T[19],T[20]!==k||T[21]!==$?(ae={label:"Config > Set theme: system",handle:()=>{$({...k,display:{...k.display,theme:"system"}})}},T[20]=k,T[21]=$,T[22]=ae):ae=T[22];const te=k.keymap.preset==="vim";let me,ce;T[23]!==k||T[24]!==$?(me=()=>{$({...k,keymap:{...k.keymap,preset:"vim"}})},T[23]=k,T[24]=$,T[25]=me):me=T[25],T[26]!==te||T[27]!==me?(ce={label:"Config > Switch keymap to VIM",hidden:te,handle:me},T[26]=te,T[27]=me,T[28]=ce):ce=T[28];const se=k.keymap.preset==="default";let be,ue,Se;T[29]!==k||T[30]!==$?(be=()=>{$({...k,keymap:{...k.keymap,preset:"default"}})},T[29]=k,T[30]=$,T[31]=be):be=T[31],T[32]!==se||T[33]!==be?(ue={label:"Config > Switch keymap to default (current: VIM)",hidden:se,handle:be},T[32]=se,T[33]=be,T[34]=ue):ue=T[34],T[35]!==k||T[36]!==$?(Se=()=>{$({...k,completion:{...k.completion,copilot:!1}})},T[35]=k,T[36]=$,T[37]=Se):Se=T[37];const Me=k.completion.copilot!=="github";let Ee,Re;T[38]!==Se||T[39]!==Me?(Ee={label:"Config > Disable GitHub Copilot",handle:Se,hidden:Me},T[38]=Se,T[39]=Me,T[40]=Ee):Ee=T[40],T[41]!==k||T[42]!==$?(Re=()=>{$({...k,completion:{...k.completion,copilot:"github"}})},T[41]=k,T[42]=$,T[43]=Re):Re=T[43];const Ae=k.completion.copilot==="github";let Ye;T[44]!==Re||T[45]!==Ae?(Ye={label:"Config > Enable GitHub Copilot",handle:Re,hidden:Ae},T[44]=Re,T[45]=Ae,T[46]=Ye):Ye=T[46];const Ve=!k.display.reference_highlighting;let Ge,ee,ye,we;T[47]!==k||T[48]!==$?(Ge=()=>{$({...k,display:{...k.display,reference_highlighting:!1}})},T[47]=k,T[48]=$,T[49]=Ge):Ge=T[49],T[50]!==Ve||T[51]!==Ge?(ee={label:"Config > Disable reference highlighting",hidden:Ve,handle:Ge},T[50]=Ve,T[51]=Ge,T[52]=ee):ee=T[52],T[53]!==k||T[54]!==$?(ye=()=>{$({...k,display:{...k.display,reference_highlighting:!0}})},T[53]=k,T[54]=$,T[55]=ye):ye=T[55],T[56]!==k.display.reference_highlighting||T[57]!==ye?(we={label:"Config > Enable reference highlighting",hidden:k.display.reference_highlighting,handle:ye},T[56]=k.display.reference_highlighting,T[57]=ye,T[58]=we):we=T[58];const Te=k.display.cell_output==="above";let G,he;T[59]!==k||T[60]!==$?(G=()=>{$({...k,display:{...k.display,cell_output:"above"}})},T[59]=k,T[60]=$,T[61]=G):G=T[61],T[62]!==Te||T[63]!==G?(he={label:"Config > Set cell output area: above",hidden:Te,handle:G},T[62]=Te,T[63]=G,T[64]=he):he=T[64];const xe=k.display.cell_output==="below";let de,ke;T[65]!==k||T[66]!==$?(de=()=>{$({...k,display:{...k.display,cell_output:"below"}})},T[65]=k,T[66]=$,T[67]=de):de=T[67],T[68]!==xe||T[69]!==de?(ke={label:"Config > Set cell output area: below",hidden:xe,handle:de},T[68]=xe,T[69]=de,T[70]=ke):ke=T[70],J=[...QR().filter(K).map(oe),re,ne,ae,ce,ue,Ee,Ye,ee,we,he,ke],T[4]=C,T[5]=k,T[6]=Y,T[7]=$,T[8]=J}else J=T[8];const Q=J;let W;return T[71]!==Q?(W=Q.filter(aN),T[71]=Q,T[72]=W):W=T[72],W}();let d=wg();d=[...xi(d),...xi(l)];const u=d.filter(iN),h=tc.keyBy(u,lN),{recentCommands:f,addRecentCommand:m}=QS();let x;t[2]!==f?(x=new Set(f),t[2]=f,t[3]=x):x=t[3];const g=x;let p,b;t[4]!==s||t[5]!==n?(p=T=>{Kf(s.getHotkey("global.commandPalette").key)(T)&&(T.preventDefault(),n(cN))},t[4]=s,t[5]=n,t[6]=p):p=t[6],ql(document,"keydown",p),t[7]!==m||t[8]!==s||t[9]!==o||t[10]!==n?(b=(T,k)=>{const B=o[T];if(!B)return null;const C=s.getHotkey(T);return c.jsxs(Yn,{disabled:k.disabled,onSelect:()=>{m(T),n(!1),requestAnimationFrame(()=>{B()})},value:C.name,children:[c.jsxs("span",{children:[C.name,k.tooltip&&c.jsx("span",{className:"ml-2",children:k.tooltip})]}),c.jsx(Pk,{children:c.jsx(Xf,{shortcut:C.key})})]},T)},t[7]=m,t[8]=s,t[9]=o,t[10]=n,t[11]=b):b=t[11];const y=b;let v;t[12]!==m||t[13]!==s||t[14]!==n?(v=T=>{const{label:k,handle:B,props:C,hotkey:U}=T,V=C===void 0?{}:C;return c.jsxs(Yn,{disabled:V.disabled,onSelect:()=>{m(k),n(!1),requestAnimationFrame(()=>{B()})},value:k,children:[c.jsxs("span",{children:[k,V.tooltip&&c.jsxs("span",{className:"ml-2",children:["(",V.tooltip,")"]})]}),U&&c.jsx(Pk,{children:c.jsx(Xf,{shortcut:s.getHotkey(U).key})})]},k)},t[12]=m,t[13]=s,t[14]=n,t[15]=v):v=t[15];const w=v,S=C9;let N;t[16]===Symbol.for("react.memo_cache_sentinel")?(N=c.jsx(Oa,{placeholder:"Type to search..."}),t[16]=N):N=t[16];const j=Yf;let E;t[17]===Symbol.for("react.memo_cache_sentinel")?(E=c.jsx(nc,{children:"No results found."}),t[17]=E):E=t[17];const _=f.length>0&&c.jsxs(c.Fragment,{children:[c.jsx(Gf,{heading:"Recently Used",children:f.map(T=>{const k=h[T];return j9(T)?y(T,{disabled:k==null?void 0:k.disabled,tooltip:k==null?void 0:k.tooltip}):k&&!$p(k)?w({label:k.label,handle:k.handleHeadless||k.handle,props:{disabled:k.disabled,tooltip:k.tooltip}}):null})}),c.jsx(Dk,{})]}),A=Gf,I=s.iterate().map(T=>{if(g.has(T))return null;const k=h[T];return y(T,{disabled:k==null?void 0:k.disabled,tooltip:k==null?void 0:k.tooltip})}),P=u.map(T=>g.has(T.label)?null:w({label:T.label,handle:T.handleHeadless||T.handle,props:{disabled:T.disabled,tooltip:T.tooltip}}));let L;t[18]!==g||t[19]!==w?(L=T=>g.has(T.label)?null:w({label:`Cell > ${T.label}`,handle:T.handleHeadless||T.handle,props:{disabled:T.disabled,tooltip:T.tooltip}}),t[18]=g,t[19]=w,t[20]=L):L=t[20];const O=i.map(L);let R,F,D;return t[21]!==A||t[22]!==P||t[23]!==O||t[24]!==I?(R=c.jsxs(A,{heading:"Commands",children:[I,P,O]}),t[21]=A,t[22]=P,t[23]=O,t[24]=I,t[25]=R):R=t[25],t[26]!==j||t[27]!==R||t[28]!==E||t[29]!==_?(F=c.jsxs(j,{children:[E,_,R]}),t[26]=j,t[27]=R,t[28]=E,t[29]=_,t[30]=F):F=t[30],t[31]!==S||t[32]!==e||t[33]!==n||t[34]!==F||t[35]!==N?(D=c.jsxs(S,{open:e,onOpenChange:n,children:[N,F]}),t[31]=S,t[32]=e,t[33]=n,t[34]=F,t[35]=N,t[36]=D):D=t[36],D};function iN(t){return!t.hotkey}function lN(t){return t.label}function cN(t){return!t}function Zo(){return st().optional().describe(ze.of({label:"Password",inputType:"password",placeholder:"password",optionRegex:".*password.*"}))}function qp(){return st().optional().describe(ze.of({label:"Token",inputType:"password",placeholder:"token",optionRegex:".*token.*"}))}function yi(){return st().optional().describe(ze.of({label:"Warehouse Name",placeholder:"warehouse",optionRegex:".*warehouse.*"}))}function Gp(){return st().optional().describe(ze.of({label:"URI",optionRegex:".*uri.*"}))}function Qo(){return st().nonempty().describe(ze.of({label:"Host",placeholder:"localhost",optionRegex:".*host.*"}))}function Zn(){return st().describe(ze.of({label:"Database",placeholder:"db name",optionRegex:".*database.*"}))}function er(){return st().nonempty().describe(ze.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function tr(t){const e=E9.string().describe(ze.of({label:"Port",inputType:"number",placeholder:t==null?void 0:t.toString()})).transform(Number).refine(n=>n>=0&&n<=65535,{message:"Port must be between 0 and 65535"});return t!==void 0?e.default(t.toString()):e}function Yp(){return is().default(!1).describe(ze.of({label:"Read Only"}))}const Kp=dt({type:mt("postgres"),host:Qo(),port:tr(5432).optional(),database:Zn(),username:er(),password:Zo(),ssl:is().default(!1).describe(ze.of({label:"Use SSL"}))}).describe(ze.of({direction:"two-columns"})),Xp=dt({type:mt("mysql"),host:Qo(),port:tr(3306),database:Zn(),username:er(),password:Zo(),ssl:is().default(!1).describe(ze.of({label:"Use SSL"}))}).describe(ze.of({direction:"two-columns"})),Jp=dt({type:mt("sqlite"),database:Zn().describe(ze.of({label:"Database Path"}))}).describe(ze.of({direction:"two-columns"})),Zp=dt({type:mt("duckdb"),database:Zn().describe(ze.of({label:"Database Path"})),read_only:Yp()}).describe(ze.of({direction:"two-columns"})),Qp=dt({type:mt("motherduck"),database:Zn().default("my_db").describe(ze.of({label:"Database Name"})),token:qp()}).describe(ze.of({direction:"two-columns"})),eg=dt({type:mt("snowflake"),account:st().nonempty().describe(ze.of({label:"Account",optionRegex:".*snowflake.*"})),warehouse:st().optional().describe(ze.of({label:"Warehouse",optionRegex:".*snowflake.*"})),database:Zn(),schema:st().optional().describe(ze.of({label:"Schema",optionRegex:".*snowflake.*"})),username:er(),password:Zo(),role:st().optional().describe(ze.of({label:"Role"}))}).describe(ze.of({direction:"two-columns"})),tg=dt({type:mt("bigquery"),project:st().nonempty().describe(ze.of({label:"Project ID",optionRegex:".*bigquery.*"})),dataset:st().nonempty().describe(ze.of({label:"Dataset",optionRegex:".*bigquery.*"})),credentials_json:st().describe(ze.of({label:"Credentials JSON",inputType:"textarea"}))}).describe(ze.of({direction:"two-columns"})),ng=dt({type:mt("clickhouse_connect"),host:Qo(),port:tr(8123).optional(),username:er(),password:Zo(),secure:is().default(!1).describe(ze.of({label:"Use HTTPs"}))}).describe(ze.of({direction:"two-columns"})),og=dt({type:mt("timeplus"),host:Qo().default("localhost"),port:tr(8123).optional(),username:er().default("default"),password:Zo().default("")}).describe(ze.of({direction:"two-columns"})),rg=dt({type:mt("chdb"),database:Zn().describe(ze.of({label:"Database Path"})),read_only:Yp()}).describe(ze.of({direction:"two-columns"})),sg=dt({type:mt("trino"),host:Qo(),port:tr(8080),database:Zn(),schema:st().describe(ze.of({label:"Schema",placeholder:"schema name",optionRegex:".*schema.*"})).optional(),username:er(),password:Zo(),async_support:is().default(!1).describe(ze.of({label:"Async Support"}))}).describe(ze.of({direction:"two-columns"})),ag=dt({type:mt("iceberg"),name:st().describe(ze.of({label:"Catalog Name"})),catalog:Jf("type",[dt({type:mt("REST"),warehouse:yi(),uri:st().optional().describe(ze.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:qp()}),dt({type:mt("SQL"),warehouse:yi(),uri:st().optional().describe(ze.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),dt({type:mt("Hive"),warehouse:yi(),uri:Gp()}),dt({type:mt("Glue"),warehouse:yi(),uri:Gp()}),dt({type:mt("DynamoDB"),"dynamodb.profile-name":st().optional().describe(ze.of({label:"Profile Name"})),"dynamodb.region":st().optional().describe(ze.of({label:"Region"})),"dynamodb.access-key-id":st().optional().describe(ze.of({label:"Access Key ID"})),"dynamodb.secret-access-key":st().optional().describe(ze.of({label:"Secret Access Key",inputType:"password"})),"dynamodb.session-token":st().optional().describe(ze.of({label:"Session Token",inputType:"password"}))})]).default({type:"REST"}).describe(ze.of({special:"tabs"}))}),ig=dt({type:mt("datafusion"),sessionContext:is().optional().describe(ze.of({label:"Use Session Context"}))}),lg=dt({type:mt("pyspark"),host:Qo().optional(),port:tr().optional()}),cg=dt({type:mt("redshift"),host:Qo(),port:tr(5439),connectionType:Jf("type",[dt({type:mt("IAM credentials"),region:st().describe(ze.of({label:"Region"})),aws_access_key_id:st().nonempty().describe(ze.of({label:"AWS Access Key ID",inputType:"password",optionRegex:".*aws_access_key_id.*"})),aws_secret_access_key:st().nonempty().describe(ze.of({label:"AWS Secret Access Key",inputType:"password",optionRegex:".*aws_secret_access_key.*"})),aws_session_token:st().optional().describe(ze.of({label:"AWS Session Token",inputType:"password",optionRegex:".*aws_session_token.*"}))}),dt({type:mt("DB credentials"),user:er(),password:Zo()})]).default({type:"IAM credentials",aws_access_key_id:"",aws_secret_access_key:"",region:""}),database:Zn()}).describe(ze.of({direction:"two-columns"})),dN=Jf("type",[Kp,Xp,Jp,Zp,Qp,eg,tg,ng,og,rg,sg,ag,ig,lg,cg]),sd="env:";function vi(t){return typeof t=="string"&&t.startsWith(sd)}function ad(t){return`${sd}${t}`}const dg={sqlmodel:"SQLModel",sqlalchemy:"SQLAlchemy",duckdb:"DuckDB",clickhouse_connect:"ClickHouse Connect",chdb:"chDB",pyiceberg:"PyIceberg",ibis:"Ibis",motherduck:"MotherDuck",redshift:"Redshift"};class Wt{constructor(e,n,o){this.connection=void 0,this.orm=void 0,this.secrets=void 0,this.connection=e,this.orm=n,this.secrets=o}get imports(){const e=new Set(this.generateImports());switch(this.orm){case"sqlalchemy":e.add("import sqlalchemy");break;case"sqlmodel":e.add("import sqlmodel");break;case"duckdb":e.add("import duckdb")}return e}}class uN{constructor(){this.secrets={}}get imports(){return Object.keys(this.secrets).length===0?new Set:new Set(["import os"])}print(e,n,o){if(e=(r=>`_${r}`)(e),vi(n)){const r=n.replace(sd,""),s=o?`os.environ.get("${r}", "${o}")`:`os.environ.get("${r}")`;return this.secrets[e]=s,e}if(o!=null){const r=`os.environ.get("${n}", "${o}")`;return this.secrets[e]=r,e}return typeof n=="number"||typeof n=="number"?`${n}`:typeof n=="boolean"?Sr(n):n?`"${n}"`:""}printInFString(e,n,o){if(n===void 0)return"";if(typeof n=="number")return`${n}`;if(typeof n=="boolean")return Sr(n);const r=this.print(e,n,o);return r.startsWith('"')&&r.endsWith('"')?r.slice(1,-1):`{${r}}`}printPassword(e,n,o){const r=o?this.printInFString.bind(this):this.print.bind(this);return vi(e)?r("password",e):r("password",n,e)}getSecrets(){return this.secrets}formatSecrets(){return Object.keys(this.secrets).length===0?"":Object.entries(this.secrets).map(([e,n])=>`${e} = ${n}`).join(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./tracing-G-LeT7iS.js","./index-CvTyqOPR.js","./index-B-OhZVlA.css","./compile-D75j0isW.js","./time-DtWAMngE.js","./timer-Bqd5yn_a.js","./linear-L6-tpfTv.js","./init-DLRA0X12.js","./range-CtcPcB_L.js","./zoom-COrs4lFh.js","./ordinal-DDUp3AbE.js","./colors-bszWmPJw.js","./step-BwsUM5iJ.js","./arc-ZB5pDULS.js","./index-BEQfoZiP.js","./storage-C11KBeUF.js","./index-DmwbVsry.js","./index-mrTNfOde.js","./index-D-2M1Khu.js","./index-CcmfV0-G.js","./index-DTYFkcD0.js","./index-CBoReLW5.js","./index-DYxMy9V4.js","./index-BKWYj35Z.js","./index-Bv_wuJ0R.js","./index-B7irOs44.js","./index-BXZZRoXP.js","./index-BMbozX59.js","./index-CsGsaGUs.js","./apl-CXdQSnD-.js","./asciiarmor-D5V0T9Cu.js","./asterisk-B46aRdXb.js","./brainfuck-CtZaYBKt.js","./clike-BgBwzOhw.js","./cmake-DXn5xaP-.js","./cobol-stawOqaz.js","./coffeescript-BTDxI-eT.js","./commonlisp-vq6DHwts.js","./crystal-CRzZ78HM.js","./cypher-gJDei3ni.js","./d-BShv7fp-.js","./diff-UJJ5BM9S.js","./dockerfile-knGOOxt4.js","./simple-mode-C3vEBAcb.js","./dtd-DI9Herc-.js","./dylan-DkEP81N9.js","./ebnf-B-Df8AvO.js","./ecl-DPFc0Uaf.js","./eiffel-DR5c0IrL.js","./elm-DompmV0j.js","./erlang-BuqgqA5h.js","./factor-CFXhaUWb.js","./fcl-CVaBTCzQ.js","./forth-POgR1ypr.js","./fortran-DL7KluxX.js","./gas-bV0CklSb.js","./gherkin-B6X1vGSW.js","./groovy-DnIzCrpZ.js","./haskell-CLQs6EAM.js","./haxe-D25e-2l-.js","./http-BKJkqRj4.js","./idl-pcmmZuaN.js","./jinja2-DhgKlfW7.js","./julia-DjdwvFuI.js","./livescript-HO6ttBFx.js","./lua-8DXOpKDz.js","./mathematica-IIbmv7SK.js","./mbox-z_N2Mo3d.js","./mirc-DkvFAiy5.js","./modelica-DSrSSXCg.js","./mscgen-B2igx18G.js","./mumps-zvxmGV4l.js","./nginx-B4hAVlXN.js","./nsis-BvKfQ9lQ.js","./ntriples-BSwWqoLa.js","./octave-C4hdQ5Hf.js","./oz-qQq7irPq.js","./pascal-CafrKXZF.js","./perl-tdMlh9QA.js","./pig-CwGJVRC4.js","./powershell-D1ly3AHC.js","./properties-_nPj978X.js","./protobuf-B4y9do6W.js","./puppet-Bc-yJKzi.js","./q-B0kTJ4cI.js","./r-BA4EbLKE.js","./ruby-CR-u2WLS.js","./sas-Bqaci40L.js","./scheme-qjP0V5Ag.js","./shell-BLav31RL.js","./sieve-r025o_jW.js","./smalltalk-C7J3IyEP.js","./solr-78MBEUkU.js","./sparql-BRLJFz69.js","./spreadsheet-CGlWr0eM.js","./stylus-Bdo_Aemu.js","./swift-B_XXVlXX.js","./tcl-B2fODqDH.js","./textile-BuVhTOzU.js","./tiddlywiki-BgR6AEZu.js","./tiki-CI-ztowC.js","./toml-wcPdHu67.js","./troff-Ce85hlLp.js","./ttcn-BxnYHtq8.js","./turtle-BkSuIpt-.js","./vb-BHgjm0DN.js","./vbscript-Dawdd5GZ.js","./velocity-BdD_26Jv.js","./verilog-B4LBqg_1.js","./vhdl-CWWH2SUo.js","./webidl-CGwyPRYs.js","./xquery-CVDBqZPY.js","./yacas-I8QjZlxf.js","./z80-D8p3gKXp.js","./trash-DM6o8PTQ.js","./storage-De8XnUVS.css","./links-C-KWV9g4.js","./index-Ca6vQbH7.js","./links-C1rhMrxo.css","./circle-play-DVfQ0l2S.js","./_createAggregator-BdwfkdDz.js","./_baseEach-CboOLHt8.js","./loro_wasm_bg-C3hKWL9L.js","./transform-CDNfLgV5.js","./sortBy-DhhDrZQN.js","./_baseMap-D8-XMZET.js","./terminal-BLngv0_q.js","./terminal-WqMRJt5Z.css"])))=>i.map(i=>d[i]);
2
+ var t9=Object.defineProperty;var gk=At=>{throw TypeError(At)};var n9=(At,vt,Zt)=>vt in At?t9(At,vt,{enumerable:!0,configurable:!0,writable:!0,value:Zt}):At[vt]=Zt;var Z=(At,vt,Zt)=>n9(At,typeof vt!="symbol"?vt+"":vt,Zt),o9=(At,vt,Zt)=>vt.has(At)||gk("Cannot "+Zt);var xk=(At,vt,Zt)=>(o9(At,vt,"read from private field"),Zt?Zt.call(At):vt.get(At)),bk=(At,vt,Zt)=>vt.has(At)?gk("Cannot add the same private member more than once"):vt instanceof WeakSet?vt.add(At):vt.set(At,Zt);import{c as Ce,T as M,iH as r9,iI as s9,iJ as yk,iK as a9,dM as i9,dP as l9,b as q,dK as Bf,iL as dr,iM as c9,iN as Uf,iO as vk,iP as d9,iQ as u9,iR as wk,iS as $l,a as H,eN as h9,ac as Xe,j as c,a1 as Dn,a9 as Uo,a8 as rs,aa as ss,bs as $o,a6 as ve,ab as nn,iT as Ca,a7 as Vo,aS as Pn,ad as Ea,at as je,ao as kt,e1 as $f,eR as _a,iU as f9,aN as Fe,S as at,iV as m9,f3 as pn,iW as kk,iX as Sk,iY as Vl,iZ as Nk,i_ as p9,L as ht,dC as Hl,aZ as Ho,i$ as Wl,a$ as Vf,ag as Jt,j0 as g9,aw as Ia,j1 as x9,j2 as jk,f2 as Ck,al as bt,b5 as Ek,j3 as _k,cF as ql,j4 as b9,dU as Qe,j5 as Gl,d$ as jn,j6 as Ik,j7 as Aa,U as Ne,bd as Cn,j8 as Yl,j9 as Kl,eU as as,ja as y9,jb as Ta,jc as Ak,f0 as Tk,jd as Hf,je as Wf,eu as qf,jf as Gn,jg as ur,aX as Xl,jh as v9,ji as Jl,jj as Zl,au as ko,ei as Mk,av as Ma,jk as w9,jl as Ql,jm as Wo,bu as hr,eV as fr,fC as Ok,gp as mr,fR as k9,bg as Mt,jn as S9,jo as N9,gl as ec,aP as tc,jp as Gf,jq as j9,jr as Dk,js as Yf,jt as C9,ju as Kf,jv as Yn,jw as Pk,gn as Xf,jx as Oa,jy as nc,ez as dt,eB as is,jz as mt,jA as ze,jB as st,jC as Jf,jD as E9,jE as Zf,jF as pt,jG as Rk,dw as Da,ds as Pa,dt as Ra,du as La,dr as ls,jH as _9,fP as Qf,b4 as Rn,aJ as En,fF as Lk,fH as Fk,fI as I9,fN as A9,fJ as zk,jI as Bk,ar as pe,et as T9,aV as So,b2 as No,aW as jo,b0 as _t,f1 as on,jJ as Uk,fL as $k,jK as M9,jL as O9,fD as Vk,fE as Hk,jM as cs,dv as Wk,jN as qk,jO as D9,jP as P9,a5 as R9,a4 as L9,jQ as em,dz as F9,dB as tm,fq as oc,jR as rc,jS as sc,bx as gn,jT as z9,eY as Fa,fn as rn,bl as Gk,e2 as Ft,jU as B9,eo as U9,a2 as nm,jV as za,jW as ac,jX as $9,jY as V9,jZ as Yk,j_ as Ht,aY as H9,af as om,gr as Kk,ev as ic,j$ as W9,gN as rm,bk as lc,k0 as sm,a3 as q9,k1 as G9,ae as Ba,eO as Xk,bo as Y9,k2 as K9,k3 as Jk,gY as X9,gW as J9,gZ as Z9,g_ as Q9,k4 as am,dx as Kn,k5 as eO,k6 as cc,k7 as ds,q as Xn,o as He,g5 as Ln,k8 as xn,k9 as tt,ka as us,kb as It,gm as Ot,kc as im,ey as _n,kd as tO,ke as lm,bi as Zk,bj as Qk,kf as e3,kg as nO,gP as hs,kh as dc,bf as uc,gQ as pr,f4 as cm,ki as oO,kj as rO,kk as sO,kl as aO,km as t3,kn as Ua,ko as n3,kp as dm,kq as o3,kr as r3,ks as iO,kt as s3,ku as a3,f5 as um,kv as lO,kw as Jn,kx as hc,ky as i3,dy as l3,kz as fc,gK as hm,kA as $a,kB as Va,kC as Ha,kD as mc,kE as qo,kF as c3,kG as Co,kH as fs,kI as fm,kJ as Wa,kK as ms,kL as mm,kM as pm,kN as d3,kO as pc,kP as cO,ay as qa,kQ as Ga,kR as dO,d_ as gc,kS as uO,kT as gm,kU as hO,kV as fO,kW as xc,e7 as mO,kX as xm,kY as gr,kZ as bc,k_ as ps,g4 as In,gf as Eo,g0 as u3,cq as h3,k$ as bm,fO as f3,l0 as m3,l1 as Ya,l2 as p3,l3 as yc,l4 as ym,l5 as gs,l6 as Ka,l7 as Xa,l8 as pO,fY as vc,l9 as vm,la as wc,en as gO,fZ as xO,lb as bO,lc as yO,ld as vO,le as wO,u as kO,lf as SO,lg as NO,lh as jO,g8 as CO,li as EO,lj as g3,t as z,lk as _O,ll as IO,lm as AO,ln as TO,lo as MO,lp as OO,lq as DO,lr as PO,ls as RO,lt as LO,lu as FO,lv as zO,lw as BO,lx as UO,ly as $O,lz as VO,lA as HO,lB as WO,lC as qO,lD as GO,lE as YO,lF as KO,lG as Ja,lH as XO,lI as JO,lJ as ZO,lK as QO,lL as eD,lM as tD,lN as nD,lO as oD,lP as wm,lQ as kc,lR as x3,lS as rD,lT as sD,lU as b3,lV as aD,lW as xs,lX as An,lY as iD,lZ as lD,l_ as cD,l$ as dD,m0 as uD,m1 as hD,m2 as fD,m3 as mD,m4 as pD,m5 as gD,m6 as Go,m7 as xD,m8 as bD,m9 as yD,ma as vD,e4 as wD,mb as kD,mc as y3,e8 as SD,md as Sc,me as ND,mf as jD,mg as CD,mh as ED,g$ as Yo,mi as Nc,mj as _D,mk as ID,ml as v3,mm as km,gO as bs,mn as AD,mo as TD,mp as MD,mq as Za,mr as Qa,e$ as Sm,ms as OD,gd as DD,br as PD,an as Nm,mt as w3,mu as RD,mv as LD,mw as jm,mx as Cm,my as FD,mz as k3,mA as S3,mB as jc,f$ as zD,Y as N3,dS as BD,mC as j3,fA as yt,mD as ei,mE as ys,mF as UD,mG as $D,mH as VD,mI as HD,cp as Em,mJ as WD,am as Ko,bh as C3,mK as qD,mL as GD,mM as YD,mN as Cc,mO as E3,dQ as Ec,bt as _3,eA as KD,mP as I3,mQ as A3,mR as T3,mS as XD,mT as M3,mU as O3,mV as ti,mW as JD,mX as D3,mY as ZD,mZ as QD,m_ as P3,Z as _c,m$ as eP,bv as R3,n0 as tP,as as _o,n1 as nP,n2 as ni,n3 as oP,n4 as L3,e_ as F3,fS as Ic,n5 as _m,aU as Im,es as Ac,n6 as z3,er as Am,n7 as rP,eX as B3,n8 as sP,n9 as U3,fz as aP,na as iP,gF as lP,fG as cP,fK as Tm,gI as dP,bq as oi,nb as uP,nc as $3,nd as Mm,ne as hP,nf as fP,ng as mP,_ as bn,ew as pP,nh as gP,ni as xP,nj as V3,fs as Om,dE as H3,nk as bP,aq as xr,nl as yP,nm as vP,nn as wP,aO as kP,no as SP,np as NP,nq as jP,nr as CP,V as EP,ns as Tc,X as _P,fo as IP,nt as W3,fW as AP,nu as TP,gv as MP,nv as OP,nw as q3,nx as DP,ny as vs,nz as PP,nA as Mc,nB as RP,nC as LP,nD as FP,z as G3,gU as zP,nE as ri,nF as Y3,nG as K3,nH as X3,nI as J3,nJ as BP,C as Z3,nK as UP,nL as $P,nM as VP,nN as HP,E as br,fa as Q3,be as WP,bc as qP,nO as GP,nP as YP,nQ as KP,dH as eS,nR as Dm,nS as XP,e0 as tS,nT as JP,nU as Pm,nV as ZP,nW as QP,nX as eR,nY as nS,nZ as oS,n_ as rS,fm as sS,n$ as tR,o0 as nR,o1 as aS,o2 as iS,o3 as Oc,o4 as lS,o5 as cS,o6 as oR,o7 as dS,o8 as rR,o9 as sR,oa as uS,ob as aR,oc as iR,od as lR,oe as cR,of as dR,og as uR,dZ as hR,oh as fR,oi as mR,ge as Rm,oj as pR,ok as gR,ol as xR,om as bR,on as yR,oo as vR,op as wR,oq as kR,or as SR,os as NR,ot as Lm,ou as jR,g2 as CR,ov as ER,ow as _R,ox as IR,oy as hS,oz as AR,ax as TR,oA as MR,ap as OR,eQ as DR,gy as PR,oB as RR,oC as LR,gA as Fm,gw as ws,gB as yr,gx as vr,gC as zm,gD as Bm,oD as fS,gz as FR,oE as mS,oF as zR,oG as pS,oH as Xo,oI as gS,gH as BR,oJ as UR,oK as $R,oL as VR,oM as HR,oN as WR,oO as qR,oP as xS,eF as GR,oQ as Um,oR as YR,ah as Dc,oS as bS,oT as yS,aj as vS,ai as KR,dY as XR,__tla as JR}from"./index-CvTyqOPR.js";import{b as ks,A as ZR,L as wS,g as QR,G as eL,o as kS,s as tL,k as nL,B as SS,a as oL,M as rL,Y as sL,c as sn,u as si,C as aL,S as iL,K as lL,d as cL,i as dL,e as NS,f as uL,h as hL,j as ai,P as ii,l as jS,m as fL,n as mL,p as pL,D as Ss,q as gL,r as CS,t as $m,T as xL}from"./links-C-KWV9g4.js";import{V as ES,d as wr,I as Vm,N as _S,S as IS,e as AS,f as TS,L as MS,g as OS,F as DS,M as bL,l as PS,h as yL,E as Pc,i as vL,j as Hm,k as Wm,n as wL,o as kL,p as SL,q as NL,s as jL,t as CL,v as EL,w as _L,u as IL,C as AL,R as RS,A as TL,a as ML,T as OL,x as DL,y as PL,m as RL,z as LL,B as FL,O as zL,c as BL,P as UL,__tla as $L}from"./storage-C11KBeUF.js";import{c as VL}from"./_createAggregator-BdwfkdDz.js";import{_ as LS,a as FS,i as HL,w as WL,L as zS,A as qL,C as BS,b as qm,c as US,__tla as GL}from"./loro_wasm_bg-C3hKWL9L.js";import{s as Fn,i as Jo,T as Gm,a as Ym}from"./transform-CDNfLgV5.js";import{g as $S}from"./timer-Bqd5yn_a.js";import{i as YL}from"./zoom-COrs4lFh.js";import{s as li}from"./sortBy-DhhDrZQN.js";let Km,Rc,an,Lc,VS,Ns,KL=Promise.all([(()=>{try{return JR}catch{}})(),(()=>{try{return $L}catch{}})(),(()=>{try{return GL}catch{}})()]).then(async()=>{var Ul,fk;var At=VL(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});let vt,Zt,Xm,Fc,js,kr,zc,Bc,Jm,Zm,ci,Uc,Qm,di,ep,$c,tp,np,Vc,op,rp,sp,ui,ap,Hc,ip,lp,cp,dp,up,hp,Wc,fp,qc,Gc,mp,pp,gp,xp,bp,yp,hi,vp,wp,Yc,kp,Sp,Np,Kc,jp,Cp,Ep,fi,Xc,Jc,_p,Ip,Ap,Tp,Mp,Op,Dp,Pp,Rp,Zc,Qc,Lp,Fp,zp,mi,ln,cn;vt=Ce("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),Zt=Ce("arrow-right-to-line",[["path",{d:"M17 12H3",key:"8awo09"}],["path",{d:"m11 18 6-6-6-6",key:"8c2y43"}],["path",{d:"M21 5v14",key:"nzette"}]]),Xm=Ce("arrow-right-from-line",[["path",{d:"M3 5v14",key:"1nt18q"}],["path",{d:"M21 12H7",key:"13ipq5"}],["path",{d:"m15 18 6-6-6-6",key:"6tx3qv"}]]),Fc=Ce("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),js=Ce("ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]),kr=Ce("between-horizontal-start",[["rect",{width:"13",height:"7",x:"8",y:"3",rx:"1",key:"pkso9a"}],["path",{d:"m2 9 3 3-3 3",key:"1agib5"}],["rect",{width:"13",height:"7",x:"8",y:"14",rx:"1",key:"1q5fc1"}]]),zc=Ce("chevrons-down",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),Bc=Ce("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),Lc=Ce("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),Jm=Ce("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),Zm=Ce("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),ci=Ce("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),Uc=Ce("clipboard-copy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]),Qm=Ce("clipboard-paste",[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]]),di=Ce("cloud-download",[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]]),ep=Ce("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]),$c=Ce("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]),tp=Ce("copy-minus",[["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),np=Ce("diamond-plus",[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]),Vc=Ce("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]),op=Ce("eraser",[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]]),rp=Ce("fast-forward",[["polygon",{points:"13 19 22 12 13 5 13 19",key:"587y9g"}],["polygon",{points:"2 19 11 12 2 5 2 19",key:"3pweh0"}]]),sp=Ce("file-pen",[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]),ui=Ce("file-plus-2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]]),ap=Ce("files",[["path",{d:"M20 7h-3a2 2 0 0 1-2-2V2",key:"x099mo"}],["path",{d:"M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z",key:"18t6ie"}],["path",{d:"M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8",key:"1nja0z"}]]),Hc=Ce("folder-plus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),ip=Ce("folder-tree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]),lp=Ce("grip-vertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]),cp=Ce("hard-drive-download",[["path",{d:"M12 2v8",key:"1q4o3n"}],["path",{d:"m16 6-4 4-4-4",key:"6wukr"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 18h.01",key:"h775k"}]]),dp=Ce("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]),up=Ce("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]),hp=Ce("key-round",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]),Wc=Ce("key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]),fp=Ce("keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]),qc=Ce("layout-template",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]),Gc=Ce("list-tree",[["path",{d:"M21 12h-8",key:"1bmf0i"}],["path",{d:"M21 6H8",key:"1pqkrb"}],["path",{d:"M21 18h-8",key:"1tm79t"}],["path",{d:"M3 6v4c0 1.1.9 2 2 2h3",key:"1ywdgy"}],["path",{d:"M3 10v6c0 1.1.9 2 2 2h3",key:"2wc746"}]]),mp=Ce("list",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]),pp=Ce("map-pin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]),gp=Ce("map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]),xp=Ce("memory-stick",[["path",{d:"M6 19v-3",key:"1nvgqn"}],["path",{d:"M10 19v-3",key:"iu8nkm"}],["path",{d:"M14 19v-3",key:"kcehxu"}],["path",{d:"M18 19v-3",key:"1vh91z"}],["path",{d:"M8 11V9",key:"63erz4"}],["path",{d:"M16 11V9",key:"fru6f3"}],["path",{d:"M12 11V9",key:"ha00sb"}],["path",{d:"M2 15h20",key:"16ne18"}],["path",{d:"M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z",key:"lhddv3"}]]),bp=Ce("message-circle-question-mark",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),yp=Ce("microchip",[["path",{d:"M18 12h2",key:"quuxs7"}],["path",{d:"M18 16h2",key:"zsn3lv"}],["path",{d:"M18 20h2",key:"9x5y9y"}],["path",{d:"M18 4h2",key:"1luxfb"}],["path",{d:"M18 8h2",key:"nxqzg"}],["path",{d:"M4 12h2",key:"1ltxp0"}],["path",{d:"M4 16h2",key:"8a5zha"}],["path",{d:"M4 20h2",key:"27dk57"}],["path",{d:"M4 4h2",key:"10groj"}],["path",{d:"M4 8h2",key:"18vq6w"}],["path",{d:"M8 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2h-1.5c-.276 0-.494.227-.562.495a2 2 0 0 1-3.876 0C9.994 2.227 9.776 2 9.5 2z",key:"1681fp"}]]),hi=Ce("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]),vp=Ce("octagon-alert",[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]]),wp=Ce("package-check",[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]),Yc=Ce("package-x",[["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["path",{d:"m17 13 5 5m-5 0 5-5",key:"im3w4b"}]]),kp=Ce("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Sp=Ce("party-popper",[["path",{d:"M5.8 11.3 2 22l10.7-3.79",key:"gwxi1d"}],["path",{d:"M4 3h.01",key:"1vcuye"}],["path",{d:"M22 8h.01",key:"1mrtc2"}],["path",{d:"M15 2h.01",key:"1cjtqr"}],["path",{d:"M22 20h.01",key:"1mrys2"}],["path",{d:"m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10",key:"hbicv8"}],["path",{d:"m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17",key:"1i94pl"}],["path",{d:"m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7",key:"1cofks"}],["path",{d:"M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z",key:"4kbmks"}]]),Np=Ce("pen-line",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]),Kc=Ce("presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]),jp=Ce("regex",[["path",{d:"M17 3v10",key:"15fgeh"}],["path",{d:"m12.67 5.5 8.66 5",key:"1gpheq"}],["path",{d:"m12.67 10.5 8.66-5",key:"1dkfa6"}],["path",{d:"M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z",key:"swwfx4"}]]),Cp=Ce("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]),Ep=Ce("rows-3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]),fi=Ce("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]),Xc=Ce("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]),Jc=Ce("scroll-text",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]),_p=Ce("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),Ip=Ce("square-code",[["path",{d:"m10 9-3 3 3 3",key:"1oro0q"}],["path",{d:"m14 15 3-3-3-3",key:"bz13h7"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),Ap=Ce("square-dashed-bottom-code",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["path",{d:"M5 21a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2",key:"as5y1o"}],["path",{d:"M9 21h1",key:"15o7lz"}]]),Tp=Ce("square-equal",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M7 14h10",key:"1mhdw3"}]]),Mp=Ce("square-m",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8l4 4 4-4v8",key:"141u4e"}]]),Op=Ce("square-play",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m9 8 6 4-6 4Z",key:"f1r3lt"}]]),Dp=Ce("square-power",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),Pp=Ce("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]),Rp=Ce("text-cursor-input",[["path",{d:"M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6",key:"1528k5"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1",key:"1mj8rg"}],["path",{d:"M9 6v12",key:"velyjx"}]]),Zc=Ce("text-search",[["path",{d:"M21 6H3",key:"1jwq7v"}],["path",{d:"M10 12H3",key:"1ulcyk"}],["path",{d:"M10 18H3",key:"13769t"}],["circle",{cx:"17",cy:"15",r:"3",key:"1upz2a"}],["path",{d:"m21 19-1.9-1.9",key:"dwi7p8"}]]),Qc=Ce("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),Lp=Ce("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),Fp=Ce("view",[["path",{d:"M21 17v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-2",key:"mrq65r"}],["path",{d:"M21 7V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2",key:"be3xqs"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]]),zp=Ce("whole-word",[["circle",{cx:"7",cy:"12",r:"3",key:"12clwm"}],["path",{d:"M10 9v6",key:"17i7lo"}],["circle",{cx:"17",cy:"12",r:"3",key:"gl7c2s"}],["path",{d:"M14 7v8",key:"dl84cr"}],["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]]),mi=Ce("workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]),ln=Ce("zap-off",[["path",{d:"M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317",key:"193nxd"}],["path",{d:"M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773",key:"27a7lr"}],["path",{d:"M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643",key:"1e0qe9"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),cn=Ce("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);const HS=M.createContext({}),WS=M.forwardRef(function(t,e){[t,e]=i9(t,e,HS);let{toolbarProps:n}=function(s,a){const{"aria-label":i,"aria-labelledby":l,orientation:d="horizontal"}=s;let[u,h]=M.useState(!1);r9(()=>{var p;h(!(!a.current||!(!((p=a.current.parentElement)===null||p===void 0)&&p.closest('[role="toolbar"]'))))});const{direction:f}=s9(),m=f==="rtl"&&d==="horizontal";let x=a9(a);const g=M.useRef(null);return{toolbarProps:{...yk(s,{labelable:!0}),role:u?"group":"toolbar","aria-orientation":d,"aria-label":i,"aria-labelledby":i==null?l:void 0,onKeyDownCapture:u?void 0:p=>{if(p.currentTarget.contains(p.target)){if(d==="horizontal"&&p.key==="ArrowRight"||d==="vertical"&&p.key==="ArrowDown")m?x.focusPrevious():x.focusNext();else{if(!(d==="horizontal"&&p.key==="ArrowLeft"||d==="vertical"&&p.key==="ArrowUp"))return p.key==="Tab"?(p.stopPropagation(),g.current=document.activeElement,void(p.shiftKey?x.focusFirst():x.focusLast())):void 0;m?x.focusNext():x.focusPrevious()}p.stopPropagation(),p.preventDefault()}},onFocusCapture:u?void 0:p=>{var b,y;g.current&&!p.currentTarget.contains(p.relatedTarget)&&(!((b=a.current)===null||b===void 0)&&b.contains(p.target))&&((y=g.current)===null||y===void 0||y.focus(),g.current=null)},onBlurCapture:u?void 0:p=>{p.currentTarget.contains(p.relatedTarget)||g.current||(g.current=p.target)}}}}(t,e),o=l9({...t,values:{orientation:t.orientation||"horizontal"},defaultClassName:"react-aria-Toolbar"}),r=yk(t);return delete r.id,q.createElement("div",{...Bf(n,r),...o,ref:e,slot:t.slot||void 0,"data-orientation":t.orientation||"horizontal"},o.children)});function pi(t,e){const n=+dr(t)-+dr(e);return n<0?-1:n>0?1:n}function qS(t,e){const n=dr(t,e==null?void 0:e.in);return+function(o,r){const s=dr(o,r==null?void 0:r.in);return s.setHours(23,59,59,999),s}(n,e)==+function(o,r){const s=dr(o,r==null?void 0:r.in),a=s.getMonth();return s.setFullYear(s.getFullYear(),a+1,0),s.setHours(23,59,59,999),s}(n,e)}function GS(t,e,n){const[o,r,s]=Uf(n==null?void 0:n.in,t,t,e),a=pi(r,s),i=Math.abs(function(u,h,f){const[m,x]=Uf(f==null?void 0:f.in,u,h);return 12*(m.getFullYear()-x.getFullYear())+(m.getMonth()-x.getMonth())}(r,s));if(i<1)return 0;r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-a*i);let l=pi(r,s)===-a;qS(o)&&i===1&&pi(o,s)===1&&(l=!1);const d=a*(i-+l);return d===0?0:d}function YS(t,e,n){const o=function(r,s){return+dr(r)-+dr(s)}(t,e)/1e3;return(r=>{const s=(0,Math.trunc)(r);return s===0?0:s})(o)}function KS(t,e){return function(n,o,r){const s=d9(),a=(r==null?void 0:r.locale)??s.locale??u9,i=pi(n,o);if(isNaN(i))throw new RangeError("Invalid time value");const l=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:i}),[d,u]=Uf(r==null?void 0:r.in,...i>0?[o,n]:[n,o]),h=YS(u,d),f=(vk(u)-vk(d))/1e3,m=Math.round((h-f)/60);let x;if(m<2)return m===0?a.formatDistance("lessThanXMinutes",1,l):a.formatDistance("xMinutes",m,l);if(m<45)return a.formatDistance("xMinutes",m,l);if(m<90)return a.formatDistance("aboutXHours",1,l);if(m<wk){const g=Math.round(m/60);return a.formatDistance("aboutXHours",g,l)}if(m<2520)return a.formatDistance("xDays",1,l);if(m<$l){const g=Math.round(m/wk);return a.formatDistance("xDays",g,l)}if(m<2*$l)return x=Math.round(m/$l),a.formatDistance("aboutXMonths",x,l);if(x=GS(u,d),x<12){const g=Math.round(m/$l);return a.formatDistance("xMonths",g,l)}{const g=x%12,p=Math.trunc(x/12);return g<3?a.formatDistance("aboutXYears",p,l):g<9?a.formatDistance("overXYears",p,l):a.formatDistance("almostXYears",p+1,l)}}(t,function(n){return c9(n,Date.now())}(t),e)}const gi="https://static.marimo.app",XS=t=>{const e=H.c(24),{onClose:n}=t,[o,r]=M.useState("");let s;s=Math.random().toString(36).slice(2,6);const a=`${o}-${s}`,i=`${gi}/static/${a}`;let l,d,u,h,f,m,x,g,p,b,y;return e[0]!==n||e[1]!==a?(l=async v=>{v.preventDefault(),n();const w=await h9({download:!1,includeCode:!0,files:ES.INSTANCE.filenames()}),S=Xe({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${gi}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:w,path:a})}).catch(()=>{S.dismiss(),Xe({title:"Error uploading static page",description:c.jsxs("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",c.jsx("a",{href:Dn.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),S.dismiss(),Xe({title:"Static page uploaded!",description:c.jsxs("div",{children:["The URL has been copied to your clipboard.",c.jsx("br",{}),"You can share it with anyone."]})})},e[0]=n,e[1]=a,e[2]=l):l=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(Uo,{children:"Share static notebook"}),e[3]=d):d=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsxs(rs,{children:[d,c.jsxs(ss,{children:["You can publish a static, non-interactive version of this notebook to the public web. We will create a link for you that lives on"," ",c.jsx("a",{href:gi,target:"_blank",children:gi}),"."]})]}),e[4]=u):u=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(h=v=>{const w=v.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,"");r(w)},e[5]=h):h=e[5],e[6]!==o?(f=c.jsx($o,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:h,required:!0,autoComplete:"off"}),e[6]=o,e[7]=f):f=e[7],e[8]!==i?(m=c.jsxs("div",{className:"font-semibold text-sm text-muted-foreground gap-2 flex flex-col",children:["Anyone will be able to access your notebook at this URL:",c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(JS,{text:i}),c.jsx("span",{className:"text-primary",children:i})]})]}),e[8]=i,e[9]=m):m=e[9],e[10]!==f||e[11]!==m?(x=c.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[f,m]}),e[10]=f,e[11]=m,e[12]=x):x=e[12],e[13]!==n?(g=c.jsx(ve,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),e[13]=n,e[14]=g):g=e[14],e[15]!==i?(p=c.jsx(ve,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await nn(i)},children:"Create"}),e[15]=i,e[16]=p):p=e[16],e[17]!==p||e[18]!==g?(b=c.jsxs(Ca,{children:[g,p]}),e[17]=p,e[18]=g,e[19]=b):b=e[19],e[20]!==b||e[21]!==l||e[22]!==x?(y=c.jsx(Vo,{className:"w-fit",children:c.jsxs("form",{onSubmit:l,children:[u,x,b]})}),e[20]=b,e[21]=l,e[22]=x,e[23]=y):y=e[23],y},JS=t=>{const e=H.c(8),[n,o]=q.useState(!1);let r;e[0]!==t.text?(r=Pn.stopPropagation(async d=>{d.preventDefault(),await nn(t.text),o(!0),setTimeout(()=>o(!1),2e3)}),e[0]=t.text,e[1]=r):r=e[1];const s=r;let a,i,l;return e[2]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx(Ea,{size:14,strokeWidth:1.5}),e[2]=a):a=e[2],e[3]!==s?(i=c.jsx(ve,{"data-testid":"copy-static-notebook-url-button",onClick:s,size:"xs",variant:"secondary",children:a}),e[3]=s,e[4]=i):i=e[4],e[5]!==n||e[6]!==i?(l=c.jsx(je,{content:"Copied!",open:n,children:i}),e[5]=n,e[6]=i,e[7]=l):l=e[7],l};function Bp(){const t=H.c(2),e=kt($f);let n;return t[0]!==e?(n=()=>{const o=document.getElementsByClassName("output-area"),r=window.innerHeight||document.documentElement.clientHeight;let s=null;for(const a of Array.from(o)){const i=a.getBoundingClientRect();if(i.top>=0&&i.top<=r||i.bottom>=0&&i.bottom<=r){s=_a.parse(a.parentNode.id);break}}e(a=>({mode:f9(a.mode),cellAnchor:s})),requestAnimationFrame(()=>{var a;s!==null&&((a=document.getElementById(_a.create(s)))==null||a.scrollIntoView())})},t[0]=e,t[1]=n):n=t[1],n}function ed(t){const e=H.c(3),n=Cs();let o;return e[0]!==t||e[1]!==n?(o=()=>{t!==void 0&&n([t])},e[0]=t,e[1]=n,e[2]=o):o=e[2],Fe(o)}function Up(){const t=H.c(2),e=Cs();let n;return t[0]!==e?(n=()=>e(kk(pn())),t[0]=e,t[1]=n):n=t[1],Fe(n)}function Cs(){const t=H.c(2),{prepareForRun:e}=at();let n;return t[0]!==e?(n=async o=>{var i,l;if(o.length===0)return;const{cellHandles:r,cellData:s}=pn(),a=[];for(const d of o){const u=r[d],h=(i=u==null?void 0:u.current)==null?void 0:i.editorView;let f;h?(Sk(h)!=="markdown"&&Vl(h),f=Nk(h)):f=((l=s[d])==null?void 0:l.code)||"",a.push(f),e({cellId:d})}await p9({cellIds:o,codes:a}).catch(ZS)},t[0]=e,t[1]=n):n=t[1],Fe(n)}function ZS(t){ht.error(t)}const td=[{type:"files",Icon:ip,tooltip:"View files",position:"sidebar"},{type:"variables",Icon:Hl,tooltip:"Explore variables",position:"sidebar"},{type:"datasources",Icon:Ho,tooltip:"Explore data sources",position:"sidebar"},{type:"dependencies",Icon:hi,tooltip:"Explore dependencies",position:"sidebar"},{type:"packages",Icon:ks,tooltip:"Manage packages",position:"sidebar"},{type:"outline",Icon:Jc,tooltip:"View outline",position:"sidebar"},{type:"chat",Icon:Wl,tooltip:"Chat with AI",position:"sidebar"},{type:"documentation",Icon:Zc,tooltip:"View live docs",position:"sidebar"},{type:"logs",Icon:Vf,tooltip:"Notebook logs",position:"sidebar"},{type:"tracing",Icon:ZR,tooltip:"Tracing",position:"sidebar"},{type:"snippets",Icon:Ap,tooltip:"Snippets",position:"sidebar"},{type:"secrets",Icon:hp,tooltip:"Secrets",hidden:Jt(),position:"sidebar"},{type:"scratchpad",Icon:g9,tooltip:"Scratchpad",position:"sidebar"},{type:"errors",Icon:Ia,tooltip:"View errors",position:"footer"}];function QS(){const t=H.c(7);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0];const[n,o]=function(a,i){const l=H.c(11);let d;l[0]!==i?(d=new x9(i),l[0]=i,l[1]=d):d=l[1];const u=d;let h;l[2]!==a||l[3]!==u?(h=()=>u.get(a),l[2]=a,l[3]=u,l[4]=h):h=l[4];const[f,m]=M.useState(h);let x;l[5]!==a||l[6]!==u?(x=b=>{m(b),u.set(a,b)},l[5]=a,l[6]=u,l[7]=x):x=l[7];const g=x;let p;return l[8]!==g||l[9]!==f?(p=[f,g],l[8]=g,l[9]=f,l[10]=p):p=l[10],p}("marimo:commands",e);let r,s;return t[1]!==n||t[2]!==o?(r=a=>{const i=(l=[a,...n],[...new Set(l)]);var l;o(i.slice(0,3))},t[1]=n,t[2]=o,t[3]=r):r=t[3],t[4]!==n||t[5]!==r?(s={recentCommands:n,addRecentCommand:r},t[4]=n,t[5]=r,t[6]=s):s=t[6],s}function $p(t){return t.dropdown!==void 0}function xi(t,e=""){return t.flatMap(n=>n.label?$p(n)?xi(n.dropdown,`${e+n.label} > `):{...n,label:e+n.label}:[])}const Es=t=>{const e=H.c(8),{children:n,layerTop:o}=t,r=o!==void 0&&o;let s;e[0]!==n?(s=q.Children.toArray(n),e[0]=n,e[1]=s):s=e[1];const[a,i]=s,l=`second-icon absolute ${r?"top-[-2px] left-[-2px]":"bottom-[-2px] right-[-2px]"} rounded-full`;let d,u;return e[2]!==i||e[3]!==l?(d=c.jsx("div",{className:l,children:i}),e[2]=i,e[3]=l,e[4]=d):d=e[4],e[5]!==a||e[6]!==d?(u=c.jsxs("div",{className:"multi-icon relative w-fit",children:[a,d]}),e[5]=a,e[6]=d,e[7]=u):u=e[7],u},_s=bt(null),eN=bt(!1),nd=Ek("marimo:ai:chatState:v3",{chats:[],activeChatId:null}),tN=bt(t=>{const e=t(nd);return e.chats.find(n=>n.id===e.activeChatId)},(t,e,n)=>{e(nd,o=>({...o,activeChatId:n}))});function Vp(t){return t!==_k&&!!(t&&t.trim().length>0)}const bi=t=>{const e=H.c(7);let n,o;e[0]!==t?(n=i=>{var l;(i.ctrlKey||i.metaKey)&&i.key==="z"&&(i.preventDefault(),i.stopPropagation(),(l=t.onClick)==null||l.call(t,i))},e[0]=t,e[1]=n):n=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(o={capture:!0},e[2]=o):o=e[2],ql(window,"keydown",n,o);const r=t.children??"Undo";let s,a;return e[3]===Symbol.for("react.memo_cache_sentinel")?(s=c.jsx(b9,{className:"ml-2",shortcut:"cmd-z"}),e[3]=s):s=e[3],e[4]!==r||e[5]!==t?(a=c.jsxs(ve,{"data-testid":"undo-button",size:"sm",variant:"outline",...t,children:[r," ",s]}),e[4]=r,e[5]=t,e[6]=a):a=e[6],a};function Is(){const t=H.c(3),{deleteCell:e,undoDeleteCell:n}=at();let o;return t[0]!==e||t[1]!==n?(o=r=>{var l;if(Qe.get(Gl))return;const{cellId:s}=r,a=Qe.get(jn),i=(((l=a.cellData[s])==null?void 0:l.code)??"").trim()==="";if(e({cellId:s}),Ik({cellId:s}).catch(()=>{n()}),!i){const{dismiss:d}=Xe({title:"Cell deleted",description:"You can bring it back by clicking undo or through the command palette.",action:c.jsx(bi,{"data-testid":"undo-delete-button",onClick:()=>{n(),u()}})}),u=d}},t[0]=e,t[1]=n,t[2]=o):o=t[2],Fe(o)}function As(){const t=H.c(3),{deleteCell:e,undoDeleteCell:n}=at();let o;return t[0]!==e||t[1]!==n?(o=async r=>{if(Qe.get(Gl))return;const{cellIds:s}=r;for(const l of s)await Ik({cellId:l}).then(()=>{e({cellId:l})});const{dismiss:a}=Xe({title:"Cells deleted",action:c.jsx(bi,{"data-testid":"undo-delete-button",onClick:()=>{for(const l of s)n();i()}})}),i=a},t[0]=e,t[1]=n,t[2]=o):o=t[2],Fe(o)}function Hp(){const t=H.c(3),{splitCell:e,undoSplitCell:n}=at();let o;return t[0]!==e||t[1]!==n?(o=r=>{const s=Aa(r.cellId);if(!s)return;const a=Nk(s);e(r);const{dismiss:i}=Xe({title:"Cell split",action:c.jsx(bi,{"data-testid":"undo-split-button",size:"sm",variant:"outline",onClick:()=>{n({...r,snapshot:a}),l()},children:"Undo"})}),l=i},t[0]=e,t[1]=n,t[2]=o):o=t[2],Fe(o)}function od(t){const e=H.c(49),{cell:n}=t,{createNewCell:o,updateCellConfig:r,updateCellName:s,moveCell:a,sendToTop:i,sendToBottom:l,addColumnBreakpoint:d,clearCellOutput:u}=at(),h=Hp(),f=ed(n==null?void 0:n.cellId),m=!Ne(Gl),x=Is(),{openModal:g}=Cn(),p=kt(_s),b=Ne(Yl),y=Ne(Kl),v=Ne(as),w=Ne(y9);if(!n||v){let C;return e[0]===Symbol.for("react.memo_cache_sentinel")?(C=[],e[0]=C):C=e[0],C}const{cellId:S,config:N,getEditorView:j,name:E,hasOutput:_,hasConsoleOutput:A,status:I}=n;let P;e[1]!==S||e[2]!==N.disabled||e[3]!==r?(P=async()=>{const C={disabled:!N.disabled};await Wo({configs:{[S]:C}}),r({cellId:S,config:C})},e[1]=S,e[2]=N.disabled,e[3]=r,e[4]=P):P=e[4];const L=P;let O;e[5]!==S||e[6]!==N.hide_code||e[7]!==j||e[8]!==r?(O=async()=>{const C={hide_code:!N.hide_code};await Wo({configs:{[S]:C}}),r({cellId:S,config:C});const U=j();U&&(C.hide_code?U.contentDOM.blur():U.focus())},e[5]=S,e[6]=N.hide_code,e[7]=j,e[8]=r,e[9]=O):O=e[9];const R=O;let F,D,T,k,B;return e[10]===Symbol.for("react.memo_cache_sentinel")?(F=c.jsx(Rp,{size:13,strokeWidth:1.5}),e[10]=F):F=e[10],e[11]!==S||e[12]!==E||e[13]!==g||e[14]!==s?(D=()=>{g(c.jsxs(Vo,{children:[c.jsx(rs,{children:c.jsx(Uo,{children:"Rename cell"})}),c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx(hr,{htmlFor:"cell-name",children:"Cell name"}),c.jsx(_S,{placeholder:"cell name",value:E,onKeyDown:C=>{C.key==="Enter"&&(C.preventDefault(),C.stopPropagation(),g(null))},onChange:C=>s({cellId:S,name:C})})]})]}))},e[11]=S,e[12]=E,e[13]=g,e[14]=s,e[15]=D):D=e[15],e[16]!==S||e[17]!==s?(T=C=>s({cellId:S,name:C}),e[16]=S,e[17]=s,e[18]=T):T=e[18],e[19]!==E||e[20]!==T?(k=c.jsx(_S,{placeholder:"cell name",value:E,onChange:T}),e[19]=E,e[20]=T,e[21]=k):k=e[21],e[22]!==d||e[23]!==b||e[24]!==w||e[25]!==y||e[26]!==m||e[27]!==S||e[28]!==u||e[29]!==N.disabled||e[30]!==N.hide_code||e[31]!==o||e[32]!==x||e[33]!==j||e[34]!==A||e[35]!==_||e[36]!==a||e[37]!==E||e[38]!==f||e[39]!==l||e[40]!==i||e[41]!==p||e[42]!==h||e[43]!==I||e[44]!==D||e[45]!==k||e[46]!==L||e[47]!==R?(B=[[{icon:F,label:"Name",disableClick:!0,handle:sN,handleHeadless:D,rightElement:k},{icon:c.jsx(wr,{size:13,strokeWidth:1.5}),label:"Run cell",hotkey:"cell.run",hidden:I==="running"||I==="queued"||I==="disabled-transitively"||N.disabled,handle:()=>f()},{icon:c.jsx(Ta,{size:13,strokeWidth:1.5}),label:"AI completion",hidden:!b,handle:()=>{p(C=>(C==null?void 0:C.cellId)===S?null:{cellId:S})},hotkey:"cell.aiCompletion"},{icon:c.jsx(Xc,{size:13,strokeWidth:1.5}),label:"Split cell",hotkey:"cell.splitCell",handle:()=>h({cellId:S})},{icon:c.jsx(Vm,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!_,handle:()=>function(C){const U=document.getElementById(jk.create(C));U&&(U.classList.add("printing-output"),Ck(U,"result.png").finally(()=>{U.classList.remove("printing-output")}))}(S)},{icon:c.jsx(Tk,{size:13,strokeWidth:1.5}),label:"Format cell",hotkey:"cell.format",handle:()=>{const C=j();C&&Ak({[S]:C})}},{icon:N.hide_code?c.jsx(Hf,{size:13,strokeWidth:1.5}):c.jsx(Wf,{size:13,strokeWidth:1.5}),label:N.hide_code?"Show code":"Hide code",handle:R,hotkey:"cell.hideCode"},{icon:N.disabled?c.jsx(ln,{size:13,strokeWidth:1.5}):c.jsx(cn,{size:13,strokeWidth:1.5}),label:"Reactive execution",rightElement:c.jsx(qf,{"data-testid":"cell-disable-switch",checked:!N.disabled,size:"sm",onCheckedChange:L}),handle:L},{icon:c.jsx(Ia,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(_||A),handle:()=>{u({cellId:S})}}],[{icon:c.jsx(Xl,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:()=>{const C=j();C&&(Gn({autoInstantiate:y,createNewCell:o}),ur(C,{language:"markdown",keepCodeAsIs:!1}))}},{icon:c.jsx(Ho,{size:13,strokeWidth:1.5}),label:"Convert to SQL",handle:()=>{const C=j();C&&(Gn({autoInstantiate:y,createNewCell:o}),ur(C,{language:"sql",keepCodeAsIs:!1}))}},{icon:c.jsx(Jl,{}),label:"Toggle as Python",handle:()=>{const C=j();C&&(Gn({autoInstantiate:y,createNewCell:o}),v9(C,"python",{force:!0}))}}],[{icon:c.jsxs(Es,{children:[c.jsx(ci,{size:13,strokeWidth:1.5}),c.jsx(Zl,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>o({cellId:S,before:!0})},{icon:c.jsxs(Es,{children:[c.jsx(ci,{size:13,strokeWidth:1.5}),c.jsx(ko,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>o({cellId:S,before:!1})},{icon:c.jsx(Zl,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>a({cellId:S,before:!0})},{icon:c.jsx(ko,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>a({cellId:S,before:!1})},{icon:c.jsx(Mk,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>a({cellId:S,direction:"left"}),hidden:w!=="columns"},{icon:c.jsx(Ma,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>a({cellId:S,direction:"right"}),hidden:w!=="columns"},{icon:c.jsx(Bc,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>i({cellId:S,scroll:!1})},{icon:c.jsx(zc,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>l({cellId:S,scroll:!1})},{icon:c.jsx(w9,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",hidden:w!=="columns",handle:()=>d({cellId:S})}],[{icon:c.jsx(wS,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!Vp(E),tooltip:Vp(E)?void 0:"Only named cells can be linked to",handle:async()=>{await nn(function(C){const U=new URL(window.location.href);return U.hash=`scrollTo=${encodeURIComponent(C)}`,U.toString()}(E)),Xe({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!m,variant:"danger",icon:c.jsx(Ql,{size:13,strokeWidth:1.5}),handle:()=>{x({cellId:S})}}]].map(oN).filter(nN),e[22]=d,e[23]=b,e[24]=w,e[25]=y,e[26]=m,e[27]=S,e[28]=u,e[29]=N.disabled,e[30]=N.hide_code,e[31]=o,e[32]=x,e[33]=j,e[34]=A,e[35]=_,e[36]=a,e[37]=E,e[38]=f,e[39]=l,e[40]=i,e[41]=p,e[42]=h,e[43]=I,e[44]=D,e[45]=k,e[46]=L,e[47]=R,e[48]=B):B=e[48],B}function nN(t){return t.length>0}function oN(t){return t.filter(rN)}function rN(t){return!t.hidden}function sN(t){t==null||t.stopPropagation(),t==null||t.preventDefault()}function aN(t){return!t.hidden}const rd=bt(!1),Wp=()=>{const t=H.c(37),[e,n]=Mt(rd),o=S9(),r=Ne(N9),s=Ne(ec);let a;t[0]!==r?(a={cell:r},t[0]=r,t[1]=a):a=t[1];let i=od(a).flat();i=xi(i);const l=function(){const T=H.c(73),[k,B]=fr(),[C,U]=Ok();let V;T[0]!==B?(V=async K=>{await mr({config:K}).then(()=>{B(K)})},T[0]=B,T[1]=V):V=T[1];const $=V;let X;T[2]!==U?(X=async K=>{await k9({config:K}).then(()=>{U(K)})},T[2]=U,T[3]=X):X=T[3];const Y=X;let J;if(T[4]!==C||T[5]!==k||T[6]!==Y||T[7]!==$){let K,oe,re,ne,ae;T[9]!==C?(K=Pe=>Pe!==C.width,T[9]=C,T[10]=K):K=T[10],T[11]!==C||T[12]!==Y?(oe=Pe=>({label:`App config > Set width=${Pe}`,handle:()=>{Y({...C,width:Pe})}}),T[11]=C,T[12]=Y,T[13]=oe):oe=T[13],T[14]!==k||T[15]!==$?(re={label:"Config > Set theme: dark",handle:()=>{$({...k,display:{...k.display,theme:"dark"}})}},T[14]=k,T[15]=$,T[16]=re):re=T[16],T[17]!==k||T[18]!==$?(ne={label:"Config > Set theme: light",handle:()=>{$({...k,display:{...k.display,theme:"light"}})}},T[17]=k,T[18]=$,T[19]=ne):ne=T[19],T[20]!==k||T[21]!==$?(ae={label:"Config > Set theme: system",handle:()=>{$({...k,display:{...k.display,theme:"system"}})}},T[20]=k,T[21]=$,T[22]=ae):ae=T[22];const te=k.keymap.preset==="vim";let me,ce;T[23]!==k||T[24]!==$?(me=()=>{$({...k,keymap:{...k.keymap,preset:"vim"}})},T[23]=k,T[24]=$,T[25]=me):me=T[25],T[26]!==te||T[27]!==me?(ce={label:"Config > Switch keymap to VIM",hidden:te,handle:me},T[26]=te,T[27]=me,T[28]=ce):ce=T[28];const se=k.keymap.preset==="default";let be,ue,Se;T[29]!==k||T[30]!==$?(be=()=>{$({...k,keymap:{...k.keymap,preset:"default"}})},T[29]=k,T[30]=$,T[31]=be):be=T[31],T[32]!==se||T[33]!==be?(ue={label:"Config > Switch keymap to default (current: VIM)",hidden:se,handle:be},T[32]=se,T[33]=be,T[34]=ue):ue=T[34],T[35]!==k||T[36]!==$?(Se=()=>{$({...k,completion:{...k.completion,copilot:!1}})},T[35]=k,T[36]=$,T[37]=Se):Se=T[37];const Me=k.completion.copilot!=="github";let Ee,Re;T[38]!==Se||T[39]!==Me?(Ee={label:"Config > Disable GitHub Copilot",handle:Se,hidden:Me},T[38]=Se,T[39]=Me,T[40]=Ee):Ee=T[40],T[41]!==k||T[42]!==$?(Re=()=>{$({...k,completion:{...k.completion,copilot:"github"}})},T[41]=k,T[42]=$,T[43]=Re):Re=T[43];const Ae=k.completion.copilot==="github";let Ye;T[44]!==Re||T[45]!==Ae?(Ye={label:"Config > Enable GitHub Copilot",handle:Re,hidden:Ae},T[44]=Re,T[45]=Ae,T[46]=Ye):Ye=T[46];const Ve=!k.display.reference_highlighting;let Ge,ee,ye,we;T[47]!==k||T[48]!==$?(Ge=()=>{$({...k,display:{...k.display,reference_highlighting:!1}})},T[47]=k,T[48]=$,T[49]=Ge):Ge=T[49],T[50]!==Ve||T[51]!==Ge?(ee={label:"Config > Disable reference highlighting",hidden:Ve,handle:Ge},T[50]=Ve,T[51]=Ge,T[52]=ee):ee=T[52],T[53]!==k||T[54]!==$?(ye=()=>{$({...k,display:{...k.display,reference_highlighting:!0}})},T[53]=k,T[54]=$,T[55]=ye):ye=T[55],T[56]!==k.display.reference_highlighting||T[57]!==ye?(we={label:"Config > Enable reference highlighting",hidden:k.display.reference_highlighting,handle:ye},T[56]=k.display.reference_highlighting,T[57]=ye,T[58]=we):we=T[58];const Te=k.display.cell_output==="above";let G,he;T[59]!==k||T[60]!==$?(G=()=>{$({...k,display:{...k.display,cell_output:"above"}})},T[59]=k,T[60]=$,T[61]=G):G=T[61],T[62]!==Te||T[63]!==G?(he={label:"Config > Set cell output area: above",hidden:Te,handle:G},T[62]=Te,T[63]=G,T[64]=he):he=T[64];const xe=k.display.cell_output==="below";let de,ke;T[65]!==k||T[66]!==$?(de=()=>{$({...k,display:{...k.display,cell_output:"below"}})},T[65]=k,T[66]=$,T[67]=de):de=T[67],T[68]!==xe||T[69]!==de?(ke={label:"Config > Set cell output area: below",hidden:xe,handle:de},T[68]=xe,T[69]=de,T[70]=ke):ke=T[70],J=[...QR().filter(K).map(oe),re,ne,ae,ce,ue,Ee,Ye,ee,we,he,ke],T[4]=C,T[5]=k,T[6]=Y,T[7]=$,T[8]=J}else J=T[8];const Q=J;let W;return T[71]!==Q?(W=Q.filter(aN),T[71]=Q,T[72]=W):W=T[72],W}();let d=wg();d=[...xi(d),...xi(l)];const u=d.filter(iN),h=tc.keyBy(u,lN),{recentCommands:f,addRecentCommand:m}=QS();let x;t[2]!==f?(x=new Set(f),t[2]=f,t[3]=x):x=t[3];const g=x;let p,b;t[4]!==s||t[5]!==n?(p=T=>{Kf(s.getHotkey("global.commandPalette").key)(T)&&(T.preventDefault(),n(cN))},t[4]=s,t[5]=n,t[6]=p):p=t[6],ql(document,"keydown",p),t[7]!==m||t[8]!==s||t[9]!==o||t[10]!==n?(b=(T,k)=>{const B=o[T];if(!B)return null;const C=s.getHotkey(T);return c.jsxs(Yn,{disabled:k.disabled,onSelect:()=>{m(T),n(!1),requestAnimationFrame(()=>{B()})},value:C.name,children:[c.jsxs("span",{children:[C.name,k.tooltip&&c.jsx("span",{className:"ml-2",children:k.tooltip})]}),c.jsx(Pk,{children:c.jsx(Xf,{shortcut:C.key})})]},T)},t[7]=m,t[8]=s,t[9]=o,t[10]=n,t[11]=b):b=t[11];const y=b;let v;t[12]!==m||t[13]!==s||t[14]!==n?(v=T=>{const{label:k,handle:B,props:C,hotkey:U}=T,V=C===void 0?{}:C;return c.jsxs(Yn,{disabled:V.disabled,onSelect:()=>{m(k),n(!1),requestAnimationFrame(()=>{B()})},value:k,children:[c.jsxs("span",{children:[k,V.tooltip&&c.jsxs("span",{className:"ml-2",children:["(",V.tooltip,")"]})]}),U&&c.jsx(Pk,{children:c.jsx(Xf,{shortcut:s.getHotkey(U).key})})]},k)},t[12]=m,t[13]=s,t[14]=n,t[15]=v):v=t[15];const w=v,S=C9;let N;t[16]===Symbol.for("react.memo_cache_sentinel")?(N=c.jsx(Oa,{placeholder:"Type to search..."}),t[16]=N):N=t[16];const j=Yf;let E;t[17]===Symbol.for("react.memo_cache_sentinel")?(E=c.jsx(nc,{children:"No results found."}),t[17]=E):E=t[17];const _=f.length>0&&c.jsxs(c.Fragment,{children:[c.jsx(Gf,{heading:"Recently Used",children:f.map(T=>{const k=h[T];return j9(T)?y(T,{disabled:k==null?void 0:k.disabled,tooltip:k==null?void 0:k.tooltip}):k&&!$p(k)?w({label:k.label,handle:k.handleHeadless||k.handle,props:{disabled:k.disabled,tooltip:k.tooltip}}):null})}),c.jsx(Dk,{})]}),A=Gf,I=s.iterate().map(T=>{if(g.has(T))return null;const k=h[T];return y(T,{disabled:k==null?void 0:k.disabled,tooltip:k==null?void 0:k.tooltip})}),P=u.map(T=>g.has(T.label)?null:w({label:T.label,handle:T.handleHeadless||T.handle,props:{disabled:T.disabled,tooltip:T.tooltip}}));let L;t[18]!==g||t[19]!==w?(L=T=>g.has(T.label)?null:w({label:`Cell > ${T.label}`,handle:T.handleHeadless||T.handle,props:{disabled:T.disabled,tooltip:T.tooltip}}),t[18]=g,t[19]=w,t[20]=L):L=t[20];const O=i.map(L);let R,F,D;return t[21]!==A||t[22]!==P||t[23]!==O||t[24]!==I?(R=c.jsxs(A,{heading:"Commands",children:[I,P,O]}),t[21]=A,t[22]=P,t[23]=O,t[24]=I,t[25]=R):R=t[25],t[26]!==j||t[27]!==R||t[28]!==E||t[29]!==_?(F=c.jsxs(j,{children:[E,_,R]}),t[26]=j,t[27]=R,t[28]=E,t[29]=_,t[30]=F):F=t[30],t[31]!==S||t[32]!==e||t[33]!==n||t[34]!==F||t[35]!==N?(D=c.jsxs(S,{open:e,onOpenChange:n,children:[N,F]}),t[31]=S,t[32]=e,t[33]=n,t[34]=F,t[35]=N,t[36]=D):D=t[36],D};function iN(t){return!t.hotkey}function lN(t){return t.label}function cN(t){return!t}function Zo(){return st().optional().describe(ze.of({label:"Password",inputType:"password",placeholder:"password",optionRegex:".*password.*"}))}function qp(){return st().optional().describe(ze.of({label:"Token",inputType:"password",placeholder:"token",optionRegex:".*token.*"}))}function yi(){return st().optional().describe(ze.of({label:"Warehouse Name",placeholder:"warehouse",optionRegex:".*warehouse.*"}))}function Gp(){return st().optional().describe(ze.of({label:"URI",optionRegex:".*uri.*"}))}function Qo(){return st().nonempty().describe(ze.of({label:"Host",placeholder:"localhost",optionRegex:".*host.*"}))}function Zn(){return st().describe(ze.of({label:"Database",placeholder:"db name",optionRegex:".*database.*"}))}function er(){return st().nonempty().describe(ze.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function tr(t){const e=E9.string().describe(ze.of({label:"Port",inputType:"number",placeholder:t==null?void 0:t.toString()})).transform(Number).refine(n=>n>=0&&n<=65535,{message:"Port must be between 0 and 65535"});return t!==void 0?e.default(t.toString()):e}function Yp(){return is().default(!1).describe(ze.of({label:"Read Only"}))}const Kp=dt({type:mt("postgres"),host:Qo(),port:tr(5432).optional(),database:Zn(),username:er(),password:Zo(),ssl:is().default(!1).describe(ze.of({label:"Use SSL"}))}).describe(ze.of({direction:"two-columns"})),Xp=dt({type:mt("mysql"),host:Qo(),port:tr(3306),database:Zn(),username:er(),password:Zo(),ssl:is().default(!1).describe(ze.of({label:"Use SSL"}))}).describe(ze.of({direction:"two-columns"})),Jp=dt({type:mt("sqlite"),database:Zn().describe(ze.of({label:"Database Path"}))}).describe(ze.of({direction:"two-columns"})),Zp=dt({type:mt("duckdb"),database:Zn().describe(ze.of({label:"Database Path"})),read_only:Yp()}).describe(ze.of({direction:"two-columns"})),Qp=dt({type:mt("motherduck"),database:Zn().default("my_db").describe(ze.of({label:"Database Name"})),token:qp()}).describe(ze.of({direction:"two-columns"})),eg=dt({type:mt("snowflake"),account:st().nonempty().describe(ze.of({label:"Account",optionRegex:".*snowflake.*"})),warehouse:st().optional().describe(ze.of({label:"Warehouse",optionRegex:".*snowflake.*"})),database:Zn(),schema:st().optional().describe(ze.of({label:"Schema",optionRegex:".*snowflake.*"})),username:er(),password:Zo(),role:st().optional().describe(ze.of({label:"Role"}))}).describe(ze.of({direction:"two-columns"})),tg=dt({type:mt("bigquery"),project:st().nonempty().describe(ze.of({label:"Project ID",optionRegex:".*bigquery.*"})),dataset:st().nonempty().describe(ze.of({label:"Dataset",optionRegex:".*bigquery.*"})),credentials_json:st().describe(ze.of({label:"Credentials JSON",inputType:"textarea"}))}).describe(ze.of({direction:"two-columns"})),ng=dt({type:mt("clickhouse_connect"),host:Qo(),port:tr(8123).optional(),username:er(),password:Zo(),secure:is().default(!1).describe(ze.of({label:"Use HTTPs"}))}).describe(ze.of({direction:"two-columns"})),og=dt({type:mt("timeplus"),host:Qo().default("localhost"),port:tr(8123).optional(),username:er().default("default"),password:Zo().default("")}).describe(ze.of({direction:"two-columns"})),rg=dt({type:mt("chdb"),database:Zn().describe(ze.of({label:"Database Path"})),read_only:Yp()}).describe(ze.of({direction:"two-columns"})),sg=dt({type:mt("trino"),host:Qo(),port:tr(8080),database:Zn(),schema:st().describe(ze.of({label:"Schema",placeholder:"schema name",optionRegex:".*schema.*"})).optional(),username:er(),password:Zo(),async_support:is().default(!1).describe(ze.of({label:"Async Support"}))}).describe(ze.of({direction:"two-columns"})),ag=dt({type:mt("iceberg"),name:st().describe(ze.of({label:"Catalog Name"})),catalog:Jf("type",[dt({type:mt("REST"),warehouse:yi(),uri:st().optional().describe(ze.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:qp()}),dt({type:mt("SQL"),warehouse:yi(),uri:st().optional().describe(ze.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),dt({type:mt("Hive"),warehouse:yi(),uri:Gp()}),dt({type:mt("Glue"),warehouse:yi(),uri:Gp()}),dt({type:mt("DynamoDB"),"dynamodb.profile-name":st().optional().describe(ze.of({label:"Profile Name"})),"dynamodb.region":st().optional().describe(ze.of({label:"Region"})),"dynamodb.access-key-id":st().optional().describe(ze.of({label:"Access Key ID"})),"dynamodb.secret-access-key":st().optional().describe(ze.of({label:"Secret Access Key",inputType:"password"})),"dynamodb.session-token":st().optional().describe(ze.of({label:"Session Token",inputType:"password"}))})]).default({type:"REST"}).describe(ze.of({special:"tabs"}))}),ig=dt({type:mt("datafusion"),sessionContext:is().optional().describe(ze.of({label:"Use Session Context"}))}),lg=dt({type:mt("pyspark"),host:Qo().optional(),port:tr().optional()}),cg=dt({type:mt("redshift"),host:Qo(),port:tr(5439),connectionType:Jf("type",[dt({type:mt("IAM credentials"),region:st().describe(ze.of({label:"Region"})),aws_access_key_id:st().nonempty().describe(ze.of({label:"AWS Access Key ID",inputType:"password",optionRegex:".*aws_access_key_id.*"})),aws_secret_access_key:st().nonempty().describe(ze.of({label:"AWS Secret Access Key",inputType:"password",optionRegex:".*aws_secret_access_key.*"})),aws_session_token:st().optional().describe(ze.of({label:"AWS Session Token",inputType:"password",optionRegex:".*aws_session_token.*"}))}),dt({type:mt("DB credentials"),user:er(),password:Zo()})]).default({type:"IAM credentials",aws_access_key_id:"",aws_secret_access_key:"",region:""}),database:Zn()}).describe(ze.of({direction:"two-columns"})),dN=Jf("type",[Kp,Xp,Jp,Zp,Qp,eg,tg,ng,og,rg,sg,ag,ig,lg,cg]),sd="env:";function vi(t){return typeof t=="string"&&t.startsWith(sd)}function ad(t){return`${sd}${t}`}const dg={sqlmodel:"SQLModel",sqlalchemy:"SQLAlchemy",duckdb:"DuckDB",clickhouse_connect:"ClickHouse Connect",chdb:"chDB",pyiceberg:"PyIceberg",ibis:"Ibis",motherduck:"MotherDuck",redshift:"Redshift"};class Wt{constructor(e,n,o){this.connection=void 0,this.orm=void 0,this.secrets=void 0,this.connection=e,this.orm=n,this.secrets=o}get imports(){const e=new Set(this.generateImports());switch(this.orm){case"sqlalchemy":e.add("import sqlalchemy");break;case"sqlmodel":e.add("import sqlmodel");break;case"duckdb":e.add("import duckdb")}return e}}class uN{constructor(){this.secrets={}}get imports(){return Object.keys(this.secrets).length===0?new Set:new Set(["import os"])}print(e,n,o){if(e=(r=>`_${r}`)(e),vi(n)){const r=n.replace(sd,""),s=o?`os.environ.get("${r}", "${o}")`:`os.environ.get("${r}")`;return this.secrets[e]=s,e}if(o!=null){const r=`os.environ.get("${n}", "${o}")`;return this.secrets[e]=r,e}return typeof n=="number"||typeof n=="number"?`${n}`:typeof n=="boolean"?Sr(n):n?`"${n}"`:""}printInFString(e,n,o){if(n===void 0)return"";if(typeof n=="number")return`${n}`;if(typeof n=="boolean")return Sr(n);const r=this.print(e,n,o);return r.startsWith('"')&&r.endsWith('"')?r.slice(1,-1):`{${r}}`}printPassword(e,n,o){const r=o?this.printInFString.bind(this):this.print.bind(this);return vi(e)?r("password",e):r("password",n,e)}getSecrets(){return this.secrets}formatSecrets(){return Object.keys(this.secrets).length===0?"":Object.entries(this.secrets).map(([e,n])=>`${e} = ${n}`).join(`
3
3
  `)}}class hN extends Wt{generateImports(){return[]}generateConnectionCode(){const e=this.connection.ssl?", connect_args={'sslmode': 'require'}":"",n=this.secrets.printPassword(this.connection.password,"POSTGRES_PASSWORD",!0),o=this.secrets.printInFString("username",this.connection.username),r=this.secrets.printInFString("host",this.connection.host),s=this.secrets.printInFString("port",this.connection.port),a=this.secrets.printInFString("database",this.connection.database);return pt(`
4
4
  DATABASE_URL = f"postgresql://${o}:${n}@${r}:${s}/${a}"
5
5
  engine = ${this.orm}.create_engine(DATABASE_URL${e})
@@ -144,5 +144,5 @@ ${A}
144
144
  `)}),includeOtherCode:vc("")}),onFinish:A=>{e(I=>Lu(I,I.activeChatId,A.id,"assistant",A.content,A.parts))},onToolCall:async({toolCall:A})=>{try{const I=await HP({toolName:A.toolName,arguments:A.args});return I.result||I.error}catch(I){return ht.error("Tool call failed:",I),`Error: ${I instanceof Error?I.message:String(I)}`}},onError:A=>{ht.error("An error occurred:",A)},onResponse:A=>{ht.debug("Received HTTP response from server:",A)}}),N=v==="submitted"||v==="streaming";M.useEffect(()=>{if(!t.activeChatId||f.length===0)return;const A=f[f.length-1];if((A==null?void 0:A.role)!=="user")return;const I=t.chats.find(O=>O.id===t.activeChatId);if(!I)return;const P=new Set(I.messages.map(O=>O.id)),L=f.filter(O=>O.role==="user"&&!P.has(O.id));L.length>0&&e(O=>{let R=O;for(const F of L)R=Lu(R,O.activeChatId,F.id,"user",F.content);return R})},[f,t.activeChatId,t.chats,e]);const j=N&&f.length>0&&(A=>{if(A.length===0)return!1;const I=A.at(-1);if(!I||I.role!=="assistant"||!I.parts)return!1;const P=I.parts;return P.length===0?!1:P[P.length-1].type==="reasoning"})(f);M.useEffect(()=>{requestAnimationFrame(()=>{if(l.current){const A=l.current;A.scrollTop=A.scrollHeight}})},[t.activeChatId]);const E=(A,I)=>{g(P=>P.slice(0,A)),t.activeChatId&&e(P=>({...P,chats:P.chats.map(L=>L.id===t.activeChatId?{...L,messages:L.messages.slice(0,A),updatedAt:Date.now()}:L)})),p({role:"user",content:I})},_=()=>{r.trim()&&(A=>{const I=Date.now(),P={id:Q3(),title:A.length>50?`${A.slice(0,50)}...`:A,messages:[],createdAt:I,updatedAt:I};e(O=>({...O,chats:[...O.chats,P],activeChatId:P.id}));const L=Q3();p({id:L,role:"user",content:A}),x("")})(r.trim())};return c.jsxs("div",{className:"flex flex-col h-[calc(100%-53px)]",children:[c.jsx(_m,{children:c.jsx(C8,{onNewChat:()=>{o(null),x(""),s("")},activeChatId:n==null?void 0:n.id,setActiveChat:o,chats:[...t.chats].sort((A,I)=>I.updatedAt-A.updatedAt)})}),c.jsxs("div",{className:"flex-1 px-3 bg-[var(--slate-1)] gap-4 py-3 flex flex-col overflow-y-auto",ref:l,children:[(!f||f.length===0)&&c.jsxs("div",{className:"flex flex-col rounded-md border bg-background",children:[c.jsx("div",{className:"px-1",children:c.jsx(Cc,{value:r,placeholder:"Ask anything, @ to include context about tables or dataframes",theme:u,onClose:()=>{var A,I;return(I=(A=a.current)==null?void 0:A.editor)==null?void 0:I.blur()},onChange:s,onSubmit:_},"new-thread-input")}),c.jsx(xh,{input:r,onSendClick:_,isLoading:N,onStop:S})]}),f.map((A,I)=>c.jsx(nv,{message:A,index:I,theme:u,onEdit:E,setChatState:e,chatState:t,isStreamingReasoning:j,totalMessages:f.length},I)),N&&c.jsx("div",{className:"flex justify-center py-4",children:c.jsx(Ec,{className:"h-4 w-4 animate-spin"})}),y&&c.jsxs("div",{className:"flex items-center justify-center space-x-2 mb-4",children:[c.jsx(br,{error:y}),c.jsx(ve,{variant:"outline",size:"sm",onClick:()=>{w()},children:"Retry"})]}),c.jsx("div",{ref:d})]}),N&&c.jsx("div",{className:"w-full flex justify-center items-center z-20 border-t",children:c.jsx(ve,{variant:"linkDestructive",size:"sm",onClick:S,children:"Stop"})}),f&&f.length>0&&c.jsx(ov,{input:m,setInput:x,onSubmit:(A,I)=>{I.trim()&&b(A)},theme:u,inputRef:i,isLoading:N,onStop:S})]})};function I8(){}function A8(){}function T8(t){return c.jsx(ls,{value:t.value,className:"text-xs",subtitle:c.jsx("div",{className:"text-muted-foreground text-xs pl-2",children:t.subtitle}),children:t.label},t.value)}function M8(t){return c.jsx(ls,{value:t,className:"text-sm",children:t},t)}function Kt(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n,o=0;o<t.length;o++)(n=Kt(t[o]))!==""&&(e+=(e&&" ")+n);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}const{useDebugValue:O8}=q,{useSyncExternalStoreWithSelector:D8}=GP,P8=t=>t;function rv(t,e=P8,n){const o=D8(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return O8(o),o}const sv=(t,e)=>{const n=YP(t),o=(r,s=e)=>rv(n,r,s);return Object.assign(o,n),o};function $t(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[o,r]of t)if(!Object.is(r,e.get(o)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const o of t)if(!e.has(o))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(e,o)||!Object.is(t[o],e[o]))return!1;return!0}function Wn(t,e){if(t=function(s){let a;for(;a=s.sourceEvent;)s=a;return s}(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=t.clientX,o.y=t.clientY,[(o=o.matrixTransform(e.getScreenCTM().inverse())).x,o.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}}return[t.pageX,t.pageY]}const R8={passive:!1},ma={capture:!0,passive:!1};function bh(t){t.stopImmediatePropagation()}function Wr(t){t.preventDefault(),t.stopImmediatePropagation()}function av(t){var e=t.document.documentElement,n=Fn(t).on("dragstart.drag",Wr,ma);"onselectstart"in e?n.on("selectstart.drag",Wr,ma):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function iv(t,e){var n=t.document.documentElement,o=Fn(t).on("dragstart.drag",null);e&&(o.on("click.drag",Wr,ma),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 El=t=>()=>t;function yh(t,{sourceEvent:e,subject:n,target:o,identifier:r,active:s,x:a,y:i,dx:l,dy:d,dispatch:u}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,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:a,enumerable:!0,configurable:!0},y:{value:i,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:u}})}function L8(t){return!t.ctrlKey&&!t.button}function F8(){return this.parentNode}function z8(t,e){return e??{x:t.x,y:t.y}}function B8(){return navigator.maxTouchPoints||"ontouchstart"in this}yh.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};const _l=t=>()=>t;function U8(t,{sourceEvent:e,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function vh(t){t.stopImmediatePropagation()}function pa(t){t.preventDefault(),t.stopImmediatePropagation()}function $8(t){return!(t.ctrlKey&&t.type!=="wheel"||t.button)}function V8(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]:[[0,0],[t.clientWidth,t.clientHeight]]}function lv(){return this.__zoom||Jo}function H8(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function W8(){return navigator.maxTouchPoints||"ontouchstart"in this}function q8(t,e,n){var o=t.invertX(e[0][0])-n[0][0],r=t.invertX(e[1][0])-n[1][0],s=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a))}const Il=M.createContext(null),G8=Il.Provider,Y8=t=>`Node type "${t}" not found. Using fallback type "default".`,K8=()=>"The React Flow parent container needs a width and a height to render the graph.",X8=()=>"Only child nodes can use a parent extent.",J8=t=>`Marker type "${t}" doesn't exist.`,Z8=(t,e)=>`Couldn't create edge for ${t?"target":"source"} handle id: "${t?e.targetHandle:e.sourceHandle}", edge id: ${e.id}.`,Q8=()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",eA=t=>`Edge type "${t}" not found. Using fallback type "default".`,tA=t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,cv="[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001";function it(t,e){const n=M.useContext(Il);if(n===null)throw new Error(cv);return rv(n,t,e)}const Lt=()=>{const t=M.useContext(Il);if(t===null)throw new Error(cv);return M.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe,destroy:t.destroy}),[t])},nA=t=>t.userSelectionActive?"none":"all";function Al({position:t,children:e,className:n,style:o,...r}){const s=it(nA),a=`${t}`.split("-");return q.createElement("div",{className:Kt(["react-flow__panel",n,...a]),style:{...o,pointerEvents:s},...r},e)}function oA({proOptions:t,position:e="bottom-right"}){return t!=null&&t.hideAttribution?null:q.createElement(Al,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},q.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}var rA=M.memo(({x:t,y:e,label:n,labelStyle:o={},labelShowBg:r=!0,labelBgStyle:s={},labelBgPadding:a=[2,4],labelBgBorderRadius:i=2,children:l,className:d,...u})=>{const h=M.useRef(null),[f,m]=M.useState({x:0,y:0,width:0,height:0}),x=Kt(["react-flow__edge-textwrapper",d]);return M.useEffect(()=>{if(h.current){const g=h.current.getBBox();m({x:g.x,y:g.y,width:g.width,height:g.height})}},[n]),n!==void 0&&n?q.createElement("g",{transform:`translate(${t-f.width/2} ${e-f.height/2})`,className:x,visibility:f.width?"visible":"hidden",...u},r&&q.createElement("rect",{width:f.width+2*a[0],x:-a[0],y:-a[1],height:f.height+2*a[1],className:"react-flow__edge-textbg",style:s,rx:i,ry:i}),q.createElement("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:h,style:o},n),l):null});const wh=t=>({width:t.offsetWidth,height:t.offsetHeight}),qr=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),kh=(t={x:0,y:0},e)=>({x:qr(t.x,e[0][0],e[1][0]),y:qr(t.y,e[0][1],e[1][1])}),dv=(t,e,n)=>t<e?qr(Math.abs(t-e),1,50)/50:t>n?-qr(Math.abs(t-n),1,50)/50:0,uv=(t,e)=>[20*dv(t.x,35,e.width-35),20*dv(t.y,35,e.height-35)],hv=t=>{var e;return((e=t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},Sh=({x:t,y:e,width:n,height:o})=>({x:t,y:e,x2:t+n,y2:e+o}),fv=t=>({...t.positionAbsolute||{x:0,y:0},width:t.width||0,height:t.height||0}),Nh=(t,e)=>{const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),o=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*o)},kn=t=>!isNaN(t)&&isFinite(t),xt=Symbol.for("internals"),mv=["Enter"," ","Escape"];function jh(t){var o,r;const e=(s=>"nativeEvent"in s)(t)?t.nativeEvent:t,n=((r=(o=e.composedPath)==null?void 0:o.call(e))==null?void 0:r[0])||t.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const pv=t=>"clientX"in t,Po=(t,e)=>{var s,a;const n=pv(t),o=n?t.clientX:(s=t.touches)==null?void 0:s[0].clientX,r=n?t.clientY:(a=t.touches)==null?void 0:a[0].clientY;return{x:o-((e==null?void 0:e.left)??0),y:r-((e==null?void 0:e.top)??0)}},Tl=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0},ga=({id:t,path:e,labelX:n,labelY:o,label:r,labelStyle:s,labelShowBg:a,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:d,style:u,markerEnd:h,markerStart:f,interactionWidth:m=20})=>q.createElement(q.Fragment,null,q.createElement("path",{id:t,style:u,d:e,fill:"none",className:"react-flow__edge-path",markerEnd:h,markerStart:f}),m&&q.createElement("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:m,className:"react-flow__edge-interaction"}),r&&kn(n)&&kn(o)?q.createElement(rA,{x:n,y:o,label:r,labelStyle:s,labelShowBg:a,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:d}):null);function xa(t,e,n){return n===void 0?n:o=>{const r=e().edges.find(s=>s.id===t);r&&n(o,{...r})}}function gv({sourceX:t,sourceY:e,targetX:n,targetY:o}){const r=Math.abs(n-t)/2,s=n<t?n+r:n-r,a=Math.abs(o-e)/2;return[s,o<e?o+a:o-a,r,a]}function xv({sourceX:t,sourceY:e,targetX:n,targetY:o,sourceControlX:r,sourceControlY:s,targetControlX:a,targetControlY:i}){const l=.125*t+.375*r+.375*a+.125*n,d=.125*e+.375*s+.375*i+.125*o;return[l,d,Math.abs(l-t),Math.abs(d-e)]}var lr,bv,Ro,Ch,ba,yv,Lo,ya,Gr,vv,Oe,Ml;function wv({pos:t,x1:e,y1:n,x2:o,y2:r}){return t===Oe.Left||t===Oe.Right?[.5*(e+o),n]:[e,.5*(n+r)]}function kv({sourceX:t,sourceY:e,sourcePosition:n=Oe.Bottom,targetX:o,targetY:r,targetPosition:s=Oe.Top}){const[a,i]=wv({pos:n,x1:t,y1:e,x2:o,y2:r}),[l,d]=wv({pos:s,x1:o,y1:r,x2:t,y2:e}),[u,h,f,m]=xv({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:a,sourceControlY:i,targetControlX:l,targetControlY:d});return[`M${t},${e} C${a},${i} ${l},${d} ${o},${r}`,u,h,f,m]}ga.displayName="BaseEdge",(bv=lr||(lr={})).Strict="strict",bv.Loose="loose",(Ch=Ro||(Ro={})).Free="free",Ch.Vertical="vertical",Ch.Horizontal="horizontal",(yv=ba||(ba={})).Partial="partial",yv.Full="full",(ya=Lo||(Lo={})).Bezier="default",ya.Straight="straight",ya.Step="step",ya.SmoothStep="smoothstep",ya.SimpleBezier="simplebezier",(vv=Gr||(Gr={})).Arrow="arrow",vv.ArrowClosed="arrowclosed",(Ml=Oe||(Oe={})).Left="left",Ml.Top="top",Ml.Right="right",Ml.Bottom="bottom";const Eh=M.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,sourcePosition:r=Oe.Bottom,targetPosition:s=Oe.Top,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:x,interactionWidth:g})=>{const[p,b,y]=kv({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:o,targetPosition:s});return q.createElement(ga,{path:p,labelX:b,labelY:y,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:x,interactionWidth:g})});Eh.displayName="SimpleBezierEdge";const Sv={[Oe.Left]:{x:-1,y:0},[Oe.Right]:{x:1,y:0},[Oe.Top]:{x:0,y:-1},[Oe.Bottom]:{x:0,y:1}},Nv=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function sA({source:t,sourcePosition:e=Oe.Bottom,target:n,targetPosition:o=Oe.Top,center:r,offset:s}){const a=Sv[e],i=Sv[o],l={x:t.x+a.x*s,y:t.y+a.y*s},d={x:n.x+i.x*s,y:n.y+i.y*s},u=(({source:N,sourcePosition:j=Oe.Bottom,target:E})=>j===Oe.Left||j===Oe.Right?N.x<E.x?{x:1,y:0}:{x:-1,y:0}:N.y<E.y?{x:0,y:1}:{x:0,y:-1})({source:l,sourcePosition:e,target:d}),h=u.x!==0?"x":"y",f=u[h];let m,x,g=[];const p={x:0,y:0},b={x:0,y:0},[y,v,w,S]=gv({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(a[h]*i[h]===-1){m=r.x??y,x=r.y??v;const N=[{x:m,y:l.y},{x:m,y:d.y}],j=[{x:l.x,y:x},{x:d.x,y:x}];g=a[h]===f?h==="x"?N:j:h==="x"?j:N}else{const N=[{x:l.x,y:d.y}],j=[{x:d.x,y:l.y}];if(g=h==="x"?a.x===f?j:N:a.y===f?N:j,e===o){const A=Math.abs(t[h]-n[h]);if(A<=s){const I=Math.min(s-1,s-A);a[h]===f?p[h]=(l[h]>t[h]?-1:1)*I:b[h]=(d[h]>n[h]?-1:1)*I}}if(e!==o){const A=h==="x"?"y":"x",I=a[h]===i[A],P=l[A]>d[A],L=l[A]<d[A];(a[h]===1&&(!I&&P||I&&L)||a[h]!==1&&(!I&&L||I&&P))&&(g=h==="x"?N:j)}const E={x:l.x+p.x,y:l.y+p.y},_={x:d.x+b.x,y:d.y+b.y};Math.max(Math.abs(E.x-g[0].x),Math.abs(_.x-g[0].x))>=Math.max(Math.abs(E.y-g[0].y),Math.abs(_.y-g[0].y))?(m=(E.x+_.x)/2,x=g[0].y):(m=g[0].x,x=(E.y+_.y)/2)}return[[t,{x:l.x+p.x,y:l.y+p.y},...g,{x:d.x+b.x,y:d.y+b.y},n],m,x,w,S]}function _h({sourceX:t,sourceY:e,sourcePosition:n=Oe.Bottom,targetX:o,targetY:r,targetPosition:s=Oe.Top,borderRadius:a=5,centerX:i,centerY:l,offset:d=20}){const[u,h,f,m,x]=sA({source:{x:t,y:e},sourcePosition:n,target:{x:o,y:r},targetPosition:s,center:{x:i,y:l},offset:d});return[u.reduce((g,p,b)=>{let y="";return y=b>0&&b<u.length-1?function(v,w,S,N){const j=Math.min(Nv(v,w)/2,Nv(w,S)/2,N),{x:E,y:_}=w;if(v.x===E&&E===S.x||v.y===_&&_===S.y)return`L${E} ${_}`;if(v.y===_)return`L ${E+j*(v.x<S.x?-1:1)},${_}Q ${E},${_} ${E},${_+j*(v.y<S.y?1:-1)}`;const A=v.x<S.x?1:-1;return`L ${E},${_+j*(v.y<S.y?-1:1)}Q ${E},${_} ${E+j*A},${_}`}(u[b-1],p,u[b+1],a):`${b===0?"M":"L"}${p.x} ${p.y}`,g+=y},""),h,f,m,x]}const Ol=M.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,label:r,labelStyle:s,labelShowBg:a,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:d,style:u,sourcePosition:h=Oe.Bottom,targetPosition:f=Oe.Top,markerEnd:m,markerStart:x,pathOptions:g,interactionWidth:p})=>{const[b,y,v]=_h({sourceX:t,sourceY:e,sourcePosition:h,targetX:n,targetY:o,targetPosition:f,borderRadius:g==null?void 0:g.borderRadius,offset:g==null?void 0:g.offset});return q.createElement(ga,{path:b,labelX:y,labelY:v,label:r,labelStyle:s,labelShowBg:a,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:d,style:u,markerEnd:m,markerStart:x,interactionWidth:p})});Ol.displayName="SmoothStepEdge";const Ih=M.memo(t=>{var e;return q.createElement(Ol,{...t,pathOptions:M.useMemo(()=>{var n;return{borderRadius:0,offset:(n=t.pathOptions)==null?void 0:n.offset}},[(e=t.pathOptions)==null?void 0:e.offset])})});Ih.displayName="StepEdge";const Ah=M.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,label:r,labelStyle:s,labelShowBg:a,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:d,style:u,markerEnd:h,markerStart:f,interactionWidth:m})=>{const[x,g,p]=function({sourceX:b,sourceY:y,targetX:v,targetY:w}){const[S,N,j,E]=gv({sourceX:b,sourceY:y,targetX:v,targetY:w});return[`M ${b},${y}L ${v},${w}`,S,N,j,E]}({sourceX:t,sourceY:e,targetX:n,targetY:o});return q.createElement(ga,{path:x,labelX:g,labelY:p,label:r,labelStyle:s,labelShowBg:a,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:d,style:u,markerEnd:h,markerStart:f,interactionWidth:m})});function Dl(t,e){return t>=0?.5*t:25*e*Math.sqrt(-t)}function jv({pos:t,x1:e,y1:n,x2:o,y2:r,c:s}){switch(t){case Oe.Left:return[e-Dl(e-o,s),n];case Oe.Right:return[e+Dl(o-e,s),n];case Oe.Top:return[e,n-Dl(n-r,s)];case Oe.Bottom:return[e,n+Dl(r-n,s)]}}function Cv({sourceX:t,sourceY:e,sourcePosition:n=Oe.Bottom,targetX:o,targetY:r,targetPosition:s=Oe.Top,curvature:a=.25}){const[i,l]=jv({pos:n,x1:t,y1:e,x2:o,y2:r,c:a}),[d,u]=jv({pos:s,x1:o,y1:r,x2:t,y2:e,c:a}),[h,f,m,x]=xv({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:i,sourceControlY:l,targetControlX:d,targetControlY:u});return[`M${t},${e} C${i},${l} ${d},${u} ${o},${r}`,h,f,m,x]}Ah.displayName="StraightEdge";const Pl=M.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,sourcePosition:r=Oe.Bottom,targetPosition:s=Oe.Top,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:x,pathOptions:g,interactionWidth:p})=>{const[b,y,v]=Cv({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:o,targetPosition:s,curvature:g==null?void 0:g.curvature});return q.createElement(ga,{path:b,labelX:y,labelY:v,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:x,interactionWidth:p})});Pl.displayName="BezierEdge";const Th=M.createContext(null),aA=Th.Provider;Th.Consumer;const iA=({source:t,sourceHandle:e,target:n,targetHandle:o})=>`reactflow__edge-${t}${e||""}-${n}${o||""}`,Mh=(t,e)=>t===void 0?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(n=>`${n}=${t[n]}`).join("&")}`,Oh=({x:t,y:e},[n,o,r],s,[a,i])=>{const l={x:(t-n)/r,y:(e-o)/r};return s?{x:a*Math.round(l.x/a),y:i*Math.round(l.y/i)}:l},Ev=({x:t,y:e},[n,o,r])=>({x:t*r+n,y:e*r+o}),Yr=(t,e=[0,0])=>{if(!t)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(t.width??0)*e[0],o=(t.height??0)*e[1],r={x:t.position.x-n,y:t.position.y-o};return{...r,positionAbsolute:t.positionAbsolute?{x:t.positionAbsolute.x-n,y:t.positionAbsolute.y-o}:r}},Dh=(t,e=[0,0])=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((o,r)=>{const{x:s,y:a}=Yr(r,e).positionAbsolute;return i=o,l=Sh({x:s,y:a,width:r.width||0,height:r.height||0}),{x:Math.min(i.x,l.x),y:Math.min(i.y,l.y),x2:Math.max(i.x2,l.x2),y2:Math.max(i.y2,l.y2)};var i,l},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return(({x:o,y:r,x2:s,y2:a})=>({x:o,y:r,width:s-o,height:a-r}))(n)},_v=(t,e,[n,o,r]=[0,0,1],s=!1,a=!1,i=[0,0])=>{const l={x:(e.x-n)/r,y:(e.y-o)/r,width:e.width/r,height:e.height/r},d=[];return t.forEach(u=>{const{width:h,height:f,selectable:m=!0,hidden:x=!1}=u;if(a&&!m||x)return!1;const{positionAbsolute:g}=Yr(u,i),p={x:g.x,y:g.y,width:h||0,height:f||0},b=Nh(l,p);(h===void 0||f===void 0||h===null||f===null||s&&b>0||b>=(h||0)*(f||0)||u.dragging)&&d.push(u)}),d},Iv=(t,e)=>{const n=t.map(o=>o.id);return e.filter(o=>n.includes(o.source)||n.includes(o.target))},Av=(t,e,n,o,r,s=.1)=>{const a=e/(t.width*(1+s)),i=n/(t.height*(1+s)),l=Math.min(a,i),d=qr(l,o,r);return{x:e/2-(t.x+t.width/2)*d,y:n/2-(t.y+t.height/2)*d,zoom:d}},cr=(t,e=0)=>t.transition().duration(e);function Tv(t,e,n,o){return(e[n]||[]).reduce((r,s)=>{var a,i;return`${t.id}-${s.id}-${n}`!==o&&r.push({id:s.id||null,type:n,nodeId:t.id,x:(((a=t.positionAbsolute)==null?void 0:a.x)??0)+s.x+s.width/2,y:(((i=t.positionAbsolute)==null?void 0:i.y)??0)+s.y+s.height/2}),r},[])}const lA={source:null,target:null,sourceHandle:null,targetHandle:null},Mv=()=>({handleDomNode:null,isValid:!1,connection:lA,endHandle:null});function Ov(t,e,n,o,r,s,a){const i=r==="target",l=a.querySelector(`.react-flow__handle[data-id="${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`),d={...Mv(),handleDomNode:l};if(l){const u=Ph(void 0,l),h=l.getAttribute("data-nodeid"),f=l.getAttribute("data-handleid"),m=l.classList.contains("connectable"),x=l.classList.contains("connectableend"),g={source:i?h:n,sourceHandle:i?f:o,target:i?n:h,targetHandle:i?o:f};d.connection=g,m&&x&&(e===lr.Strict?i&&u==="source"||!i&&u==="target":h!==n||f!==o)&&(d.endHandle={nodeId:h,handleId:f,type:u},d.isValid=s(g))}return d}function Ph(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function Rh(t){t==null||t.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function cA(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function Dv({event:t,handleId:e,nodeId:n,onConnect:o,isTarget:r,getState:s,setState:a,isValidConnection:i,edgeUpdaterType:l,onReconnectEnd:d}){const u=hv(t.target),{connectionMode:h,domNode:f,autoPanOnConnect:m,connectionRadius:x,onConnectStart:g,panBy:p,getNodes:b,cancelConnection:y}=s();let v,w=0;const{x:S,y:N}=Po(t),j=u==null?void 0:u.elementFromPoint(S,N),E=Ph(l,j),_=f==null?void 0:f.getBoundingClientRect();if(!_||!E)return;let A,I=Po(t,_),P=!1,L=null,O=!1,R=null;const F=function({nodes:B,nodeId:C,handleId:U,handleType:V}){return B.reduce(($,X)=>{if(X[xt]){const{handleBounds:Y}=X[xt];let J=[],Q=[];Y&&(J=Tv(X,Y,"source",`${C}-${U}-${V}`),Q=Tv(X,Y,"target",`${C}-${U}-${V}`)),$.push(...J,...Q)}return $},[])}({nodes:b(),nodeId:n,handleId:e,handleType:E}),D=()=>{if(!m)return;const[B,C]=uv(I,_);p({x:B,y:C}),w=requestAnimationFrame(D)};function T(B){const{transform:C}=s();I=Po(B,_);const{handle:U,validHandleResult:V}=function($,X,Y,J,Q,W){const{x:K,y:oe}=Po($),re=X.elementsFromPoint(K,oe).find(ce=>ce.classList.contains("react-flow__handle"));if(re){const ce=re.getAttribute("data-nodeid");if(ce){const se=Ph(void 0,re),be=re.getAttribute("data-handleid"),ue=W({nodeId:ce,id:be,type:se});if(ue){const Se=Q.find(Me=>Me.nodeId===ce&&Me.type===se&&Me.id===be);return{handle:{id:be,type:se,nodeId:ce,x:(Se==null?void 0:Se.x)||Y.x,y:(Se==null?void 0:Se.y)||Y.y},validHandleResult:ue}}}}let ne=[],ae=1/0;if(Q.forEach(ce=>{const se=Math.sqrt((ce.x-Y.x)**2+(ce.y-Y.y)**2);if(se<=J){const be=W(ce);se<=ae&&(se<ae?ne=[{handle:ce,validHandleResult:be}]:se===ae&&ne.push({handle:ce,validHandleResult:be}),ae=se)}}),!ne.length)return{handle:null,validHandleResult:Mv()};if(ne.length===1)return ne[0];const te=ne.some(({validHandleResult:ce})=>ce.isValid),me=ne.some(({handle:ce})=>ce.type==="target");return ne.find(({handle:ce,validHandleResult:se})=>me?ce.type==="target":!te||se.isValid)||ne[0]}(B,u,Oh(I,C,!1,[1,1]),x,F,$=>Ov($,h,n,e,r?"target":"source",i,u));if(v=U,P||(D(),P=!0),R=V.handleDomNode,L=V.connection,O=V.isValid,a({connectionPosition:v&&O?Ev({x:v.x,y:v.y},C):I,connectionStatus:cA(!!v,O),connectionEndHandle:V.endHandle}),!v&&!O&&!R)return Rh(A);L.source!==L.target&&R&&(Rh(A),A=R,R.classList.add("connecting","react-flow__handle-connecting"),R.classList.toggle("valid",O),R.classList.toggle("react-flow__handle-valid",O))}function k(B){var C,U;(v||R)&&L&&O&&(o==null||o(L)),(U=(C=s()).onConnectEnd)==null||U.call(C,B),l&&(d==null||d(B)),Rh(A),y(),cancelAnimationFrame(w),P=!1,O=!1,L=null,R=null,u.removeEventListener("mousemove",T),u.removeEventListener("mouseup",k),u.removeEventListener("touchmove",T),u.removeEventListener("touchend",k)}a({connectionPosition:I,connectionStatus:null,connectionNodeId:n,connectionHandleId:e,connectionHandleType:E,connectionStartHandle:{nodeId:n,handleId:e,type:E},connectionEndHandle:null}),g==null||g(t,{nodeId:n,handleId:e,handleType:E}),u.addEventListener("mousemove",T),u.addEventListener("mouseup",k),u.addEventListener("touchmove",T),u.addEventListener("touchend",k)}const Pv=()=>!0,dA=t=>({connectionStartHandle:t.connectionStartHandle,connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName}),Rv=M.forwardRef(({type:t="source",position:e=Oe.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:s=!0,id:a,onConnect:i,children:l,className:d,onMouseDown:u,onTouchStart:h,...f},m)=>{var E,_;const x=a||null,g=t==="target",p=Lt(),b=M.useContext(Th),{connectOnClick:y,noPanClassName:v}=it(dA,$t),{connecting:w,clickConnecting:S}=it(((A,I,P)=>L=>{const{connectionStartHandle:O,connectionEndHandle:R,connectionClickStartHandle:F}=L;return{connecting:(O==null?void 0:O.nodeId)===A&&(O==null?void 0:O.handleId)===I&&(O==null?void 0:O.type)===P||(R==null?void 0:R.nodeId)===A&&(R==null?void 0:R.handleId)===I&&(R==null?void 0:R.type)===P,clickConnecting:(F==null?void 0:F.nodeId)===A&&(F==null?void 0:F.handleId)===I&&(F==null?void 0:F.type)===P}})(b,x,t),$t);b||((_=(E=p.getState()).onError)==null||_.call(E,"010",Q8()));const N=A=>{const{defaultEdgeOptions:I,onConnect:P,hasDefaultEdges:L}=p.getState(),O={...I,...A};if(L){const{edges:R,setEdges:F}=p.getState();F(((D,T)=>{if(!D.source||!D.target)return T;let k;return k=(B=>"id"in B&&"source"in B&&"target"in B)(D)?{...D}:{...D,id:iA(D)},((B,C)=>C.some(U=>!(U.source!==B.source||U.target!==B.target||U.sourceHandle!==B.sourceHandle&&(U.sourceHandle||B.sourceHandle)||U.targetHandle!==B.targetHandle&&(U.targetHandle||B.targetHandle))))(k,T)?T:T.concat(k)})(O,R))}P==null||P(O),i==null||i(O)},j=A=>{if(!b)return;const I=pv(A);r&&(I&&A.button===0||!I)&&Dv({event:A,handleId:x,nodeId:b,onConnect:N,isTarget:g,getState:p.getState,setState:p.setState,isValidConnection:n||p.getState().isValidConnection||Pv}),I?u==null||u(A):h==null||h(A)};return q.createElement("div",{"data-handleid":x,"data-nodeid":b,"data-handlepos":e,"data-id":`${b}-${x}-${t}`,className:Kt(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",v,d,{source:!g,target:g,connectable:o,connectablestart:r,connectableend:s,connecting:S,connectionindicator:o&&(r&&!w||s&&w)}]),onMouseDown:j,onTouchStart:j,onClick:y?A=>{const{onClickConnectStart:I,onClickConnectEnd:P,connectionClickStartHandle:L,connectionMode:O,isValidConnection:R}=p.getState();if(!b||!L&&!r)return;if(!L)return I==null||I(A,{nodeId:b,handleId:x,handleType:t}),void p.setState({connectionClickStartHandle:{nodeId:b,type:t,handleId:x}});const F=hv(A.target),D=n||R||Pv,{connection:T,isValid:k}=Ov({nodeId:b,id:x,type:t},O,L.nodeId,L.handleId||null,L.type,D,F);k&&N(T),P==null||P(A),p.setState({connectionClickStartHandle:null})}:void 0,ref:m,...f},l)});Rv.displayName="Handle";var Fo=M.memo(Rv);const Lv=({data:t,isConnectable:e,targetPosition:n=Oe.Top,sourcePosition:o=Oe.Bottom})=>q.createElement(q.Fragment,null,q.createElement(Fo,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label,q.createElement(Fo,{type:"source",position:o,isConnectable:e}));Lv.displayName="DefaultNode";var Lh=M.memo(Lv);const Fv=({data:t,isConnectable:e,sourcePosition:n=Oe.Bottom})=>q.createElement(q.Fragment,null,t==null?void 0:t.label,q.createElement(Fo,{type:"source",position:n,isConnectable:e}));Fv.displayName="InputNode";var zv=M.memo(Fv);const Bv=({data:t,isConnectable:e,targetPosition:n=Oe.Top})=>q.createElement(q.Fragment,null,q.createElement(Fo,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label);Bv.displayName="OutputNode";var Uv=M.memo(Bv);const Fh=()=>null;Fh.displayName="GroupNode";const uA=t=>({selectedNodes:t.getNodes().filter(e=>e.selected),selectedEdges:t.edges.filter(e=>e.selected).map(e=>({...e}))}),Rl=t=>t.id;function hA(t,e){return $t(t.selectedNodes.map(Rl),e.selectedNodes.map(Rl))&&$t(t.selectedEdges.map(Rl),e.selectedEdges.map(Rl))}const $v=M.memo(({onSelectionChange:t})=>{const e=Lt(),{selectedNodes:n,selectedEdges:o}=it(uA,hA);return M.useEffect(()=>{const r={nodes:n,edges:o};t==null||t(r),e.getState().onSelectionChange.forEach(s=>s(r))},[n,o,t]),null});$v.displayName="SelectionListener";const fA=t=>!!t.onSelectionChange;function mA({onSelectionChange:t}){const e=it(fA);return t||e?q.createElement($v,{onSelectionChange:t}):null}const pA=t=>({setNodes:t.setNodes,setEdges:t.setEdges,setDefaultNodesAndEdges:t.setDefaultNodesAndEdges,setMinZoom:t.setMinZoom,setMaxZoom:t.setMaxZoom,setTranslateExtent:t.setTranslateExtent,setNodeExtent:t.setNodeExtent,reset:t.reset});function Kr(t,e){M.useEffect(()=>{t!==void 0&&e(t)},[t])}function Je(t,e,n){M.useEffect(()=>{e!==void 0&&n({[t]:e})},[e])}const gA=({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,onConnect:r,onConnectStart:s,onConnectEnd:a,onClickConnectStart:i,onClickConnectEnd:l,nodesDraggable:d,nodesConnectable:u,nodesFocusable:h,edgesFocusable:f,edgesUpdatable:m,elevateNodesOnSelect:x,minZoom:g,maxZoom:p,nodeExtent:b,onNodesChange:y,onEdgesChange:v,elementsSelectable:w,connectionMode:S,snapGrid:N,snapToGrid:j,translateExtent:E,connectOnClick:_,defaultEdgeOptions:A,fitView:I,fitViewOptions:P,onNodesDelete:L,onEdgesDelete:O,onNodeDrag:R,onNodeDragStart:F,onNodeDragStop:D,onSelectionDrag:T,onSelectionDragStart:k,onSelectionDragStop:B,noPanClassName:C,nodeOrigin:U,rfId:V,autoPanOnConnect:$,autoPanOnNodeDrag:X,onError:Y,connectionRadius:J,isValidConnection:Q,nodeDragThreshold:W})=>{const{setNodes:K,setEdges:oe,setDefaultNodesAndEdges:re,setMinZoom:ne,setMaxZoom:ae,setTranslateExtent:te,setNodeExtent:me,reset:ce}=it(pA,$t),se=Lt();return M.useEffect(()=>{const be=o==null?void 0:o.map(ue=>({...ue,...A}));return re(n,be),()=>{ce()}},[]),Je("defaultEdgeOptions",A,se.setState),Je("connectionMode",S,se.setState),Je("onConnect",r,se.setState),Je("onConnectStart",s,se.setState),Je("onConnectEnd",a,se.setState),Je("onClickConnectStart",i,se.setState),Je("onClickConnectEnd",l,se.setState),Je("nodesDraggable",d,se.setState),Je("nodesConnectable",u,se.setState),Je("nodesFocusable",h,se.setState),Je("edgesFocusable",f,se.setState),Je("edgesUpdatable",m,se.setState),Je("elementsSelectable",w,se.setState),Je("elevateNodesOnSelect",x,se.setState),Je("snapToGrid",j,se.setState),Je("snapGrid",N,se.setState),Je("onNodesChange",y,se.setState),Je("onEdgesChange",v,se.setState),Je("connectOnClick",_,se.setState),Je("fitViewOnInit",I,se.setState),Je("fitViewOnInitOptions",P,se.setState),Je("onNodesDelete",L,se.setState),Je("onEdgesDelete",O,se.setState),Je("onNodeDrag",R,se.setState),Je("onNodeDragStart",F,se.setState),Je("onNodeDragStop",D,se.setState),Je("onSelectionDrag",T,se.setState),Je("onSelectionDragStart",k,se.setState),Je("onSelectionDragStop",B,se.setState),Je("noPanClassName",C,se.setState),Je("nodeOrigin",U,se.setState),Je("rfId",V,se.setState),Je("autoPanOnConnect",$,se.setState),Je("autoPanOnNodeDrag",X,se.setState),Je("onError",Y,se.setState),Je("connectionRadius",J,se.setState),Je("isValidConnection",Q,se.setState),Je("nodeDragThreshold",W,se.setState),Kr(t,K),Kr(e,oe),Kr(g,ne),Kr(p,ae),Kr(E,te),Kr(b,me),null},Vv={display:"none"},xA={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Hv="react-flow__node-desc",Wv="react-flow__edge-desc",bA=t=>t.ariaLiveMessage;function yA({rfId:t}){const e=it(bA);return q.createElement("div",{id:`react-flow__aria-live-${t}`,"aria-live":"assertive","aria-atomic":"true",style:xA},e)}function vA({rfId:t,disableKeyboardA11y:e}){return q.createElement(q.Fragment,null,q.createElement("div",{id:`${Hv}-${t}`,style:Vv},"Press enter or space to select a node.",!e&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),q.createElement("div",{id:`${Wv}-${t}`,style:Vv},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!e&&q.createElement(yA,{rfId:t}))}var va=(t=null,e={actInsideInputWithModifier:!0})=>{const[n,o]=M.useState(!1),r=M.useRef(!1),s=M.useRef(new Set([])),[a,i]=M.useMemo(()=>{if(t!==null){const l=(Array.isArray(t)?t:[t]).filter(u=>typeof u=="string").map(u=>u.split("+")),d=l.reduce((u,h)=>u.concat(...h),[]);return[l,d]}return[[],[]]},[t]);return M.useEffect(()=>{const l=typeof document<"u"?document:null,d=(e==null?void 0:e.target)||l;if(t!==null){const u=m=>{if(r.current=m.ctrlKey||m.metaKey||m.shiftKey,(!r.current||r.current&&!e.actInsideInputWithModifier)&&jh(m))return!1;const x=Gv(m.code,i);s.current.add(m[x]),qv(a,s.current,!1)&&(m.preventDefault(),o(!0))},h=m=>{if((!r.current||r.current&&!e.actInsideInputWithModifier)&&jh(m))return!1;const x=Gv(m.code,i);qv(a,s.current,!0)?(o(!1),s.current.clear()):s.current.delete(m[x]),m.key==="Meta"&&s.current.clear(),r.current=!1},f=()=>{s.current.clear(),o(!1)};return d==null||d.addEventListener("keydown",u),d==null||d.addEventListener("keyup",h),window.addEventListener("blur",f),()=>{d==null||d.removeEventListener("keydown",u),d==null||d.removeEventListener("keyup",h),window.removeEventListener("blur",f)}}},[t,o]),n};function qv(t,e,n){return t.filter(o=>n||o.length===e.size).some(o=>o.every(r=>e.has(r)))}function Gv(t,e){return e.includes(t)?"code":"key"}function Yv(t,e,n,o){var i,l;const r=t.parentNode||t.parentId;if(!r)return n;const s=e.get(r),a=Yr(s,o);return Yv(s,e,{x:(n.x??0)+a.x,y:(n.y??0)+a.y,z:(((i=s[xt])==null?void 0:i.z)??0)>(n.z??0)?((l=s[xt])==null?void 0:l.z)??0:n.z??0},o)}function Kv(t,e,n){t.forEach(o=>{var s;const r=o.parentNode||o.parentId;if(r&&!t.has(r))throw new Error(`Parent node ${r} not found`);if(r||n!=null&&n[o.id]){const{x:a,y:i,z:l}=Yv(o,t,{...o.position,z:((s=o[xt])==null?void 0:s.z)??0},e);o.positionAbsolute={x:a,y:i},o[xt].z=l,n!=null&&n[o.id]&&(o[xt].isParent=!0)}})}function zh(t,e,n,o){const r=new Map,s={},a=o?1e3:0;return t.forEach(i=>{var m;const l=(kn(i.zIndex)?i.zIndex:0)+(i.selected?a:0),d=e.get(i.id),u={...i,positionAbsolute:{x:i.position.x,y:i.position.y}},h=i.parentNode||i.parentId;h&&(s[h]=!0);const f=(d==null?void 0:d.type)&&(d==null?void 0:d.type)!==i.type;Object.defineProperty(u,xt,{enumerable:!1,value:{handleBounds:f||(m=d==null?void 0:d[xt])==null?void 0:m.handleBounds,z:l}}),r.set(i.id,u)}),Kv(r,n,s),r}function Xv(t,e={}){const{getNodes:n,width:o,height:r,minZoom:s,maxZoom:a,d3Zoom:i,d3Selection:l,fitViewOnInitDone:d,fitViewOnInit:u,nodeOrigin:h}=t(),f=e.initial&&!d&&u;if(i&&l&&(f||!e.initial)){const m=n().filter(g=>{var b;const p=e.includeHiddenNodes?g.width&&g.height:!g.hidden;return(b=e.nodes)!=null&&b.length?p&&e.nodes.some(y=>y.id===g.id):p}),x=m.every(g=>g.width&&g.height);if(m.length>0&&x){const g=Dh(m,h),{x:p,y:b,zoom:y}=Av(g,o,r,e.minZoom??s,e.maxZoom??a,e.padding??.1),v=Jo.translate(p,b).scale(y);return typeof e.duration=="number"&&e.duration>0?i.transform(cr(l,e.duration),v):i.transform(l,v),!0}}return!1}function wA(t,e){return t.forEach(n=>{const o=e.get(n.id);o&&e.set(o.id,{...o,[xt]:o[xt],selected:n.selected})}),new Map(e)}function kA(t,e){return e.map(n=>{const o=t.find(r=>r.id===n.id);return o&&(n.selected=o.selected),n})}function Ll({changedNodes:t,changedEdges:e,get:n,set:o}){const{nodeInternals:r,edges:s,onNodesChange:a,onEdgesChange:i,hasDefaultNodes:l,hasDefaultEdges:d}=n();t!=null&&t.length&&(l&&o({nodeInternals:wA(t,r)}),a==null||a(t)),e!=null&&e.length&&(d&&o({edges:kA(e,s)}),i==null||i(e))}const Xr=()=>{},SA={zoomIn:Xr,zoomOut:Xr,zoomTo:Xr,getZoom:()=>1,setViewport:Xr,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Xr,fitBounds:Xr,project:t=>t,screenToFlowPosition:t=>t,flowToScreenPosition:t=>t,viewportInitialized:!1},NA=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection});function wa(){const t=(()=>{const g=Lt(),{d3Zoom:p,d3Selection:b}=it(NA,$t);return M.useMemo(()=>b&&p?{zoomIn:v=>p.scaleBy(cr(b,v==null?void 0:v.duration),1.2),zoomOut:v=>p.scaleBy(cr(b,v==null?void 0:v.duration),1/1.2),zoomTo:(v,w)=>p.scaleTo(cr(b,w==null?void 0:w.duration),v),getZoom:()=>g.getState().transform[2],setViewport:(v,w)=>{const[S,N,j]=g.getState().transform,E=Jo.translate(v.x??S,v.y??N).scale(v.zoom??j);p.transform(cr(b,w==null?void 0:w.duration),E)},getViewport:()=>{const[v,w,S]=g.getState().transform;return{x:v,y:w,zoom:S}},fitView:v=>Xv(g.getState,v),setCenter:(v,w,S)=>{const{width:N,height:j,maxZoom:E}=g.getState(),_=(S==null?void 0:S.zoom)!==void 0?S.zoom:E,A=N/2-v*_,I=j/2-w*_,P=Jo.translate(A,I).scale(_);p.transform(cr(b,S==null?void 0:S.duration),P)},fitBounds:(v,w)=>{const{width:S,height:N,minZoom:j,maxZoom:E}=g.getState(),{x:_,y:A,zoom:I}=Av(v,S,N,j,E,(w==null?void 0:w.padding)??.1),P=Jo.translate(_,A).scale(I);p.transform(cr(b,w==null?void 0:w.duration),P)},project:v=>{const{transform:w,snapToGrid:S,snapGrid:N}=g.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),Oh(v,w,S,N)},screenToFlowPosition:v=>{const{transform:w,snapToGrid:S,snapGrid:N,domNode:j}=g.getState();if(!j)return v;const{x:E,y:_}=j.getBoundingClientRect(),A={x:v.x-E,y:v.y-_};return Oh(A,w,S,N)},flowToScreenPosition:v=>{const{transform:w,domNode:S}=g.getState();if(!S)return v;const{x:N,y:j}=S.getBoundingClientRect(),E=Ev(v,w);return{x:E.x+N,y:E.y+j}},viewportInitialized:!0}:SA,[p,b])})(),e=Lt(),n=M.useCallback(()=>e.getState().getNodes().map(g=>({...g})),[]),o=M.useCallback(g=>e.getState().nodeInternals.get(g),[]),r=M.useCallback(()=>{const{edges:g=[]}=e.getState();return g.map(p=>({...p}))},[]),s=M.useCallback(g=>{const{edges:p=[]}=e.getState();return p.find(b=>b.id===g)},[]),a=M.useCallback(g=>{const{getNodes:p,setNodes:b,hasDefaultNodes:y,onNodesChange:v}=e.getState(),w=p(),S=typeof g=="function"?g(w):g;if(y)b(S);else if(v){const N=S.length===0?w.map(j=>({type:"remove",id:j.id})):S.map(j=>({item:j,type:"reset"}));v(N)}},[]),i=M.useCallback(g=>{const{edges:p=[],setEdges:b,hasDefaultEdges:y,onEdgesChange:v}=e.getState(),w=typeof g=="function"?g(p):g;y?b(w):v&&v(w.length===0?p.map(S=>({type:"remove",id:S.id})):w.map(S=>({item:S,type:"reset"})))},[]),l=M.useCallback(g=>{const p=Array.isArray(g)?g:[g],{getNodes:b,setNodes:y,hasDefaultNodes:v,onNodesChange:w}=e.getState();if(v)y([...b(),...p]);else if(w){const S=p.map(N=>({item:N,type:"add"}));w(S)}},[]),d=M.useCallback(g=>{const p=Array.isArray(g)?g:[g],{edges:b=[],setEdges:y,hasDefaultEdges:v,onEdgesChange:w}=e.getState();v?y([...b,...p]):w&&w(p.map(S=>({item:S,type:"add"})))},[]),u=M.useCallback(()=>{const{getNodes:g,edges:p=[],transform:b}=e.getState(),[y,v,w]=b;return{nodes:g().map(S=>({...S})),edges:p.map(S=>({...S})),viewport:{x:y,y:v,zoom:w}}},[]),h=M.useCallback(({nodes:g,edges:p})=>{const{nodeInternals:b,getNodes:y,edges:v,hasDefaultNodes:w,hasDefaultEdges:S,onNodesDelete:N,onEdgesDelete:j,onNodesChange:E,onEdgesChange:_}=e.getState(),A=(g||[]).map(R=>R.id),I=(p||[]).map(R=>R.id),P=y().reduce((R,F)=>{const D=F.parentNode||F.parentId,T=!A.includes(F.id)&&D&&R.find(k=>k.id===D);return(typeof F.deletable!="boolean"||F.deletable)&&(A.includes(F.id)||T)&&R.push(F),R},[]),L=v.filter(R=>typeof R.deletable!="boolean"||R.deletable),O=L.filter(R=>I.includes(R.id));if(P||O){const R=Iv(P,L),F=[...O,...R],D=F.reduce((T,k)=>(T.includes(k.id)||T.push(k.id),T),[]);(S||w)&&(S&&e.setState({edges:v.filter(T=>!D.includes(T.id))}),w&&(P.forEach(T=>{b.delete(T.id)}),e.setState({nodeInternals:new Map(b)}))),D.length>0&&(j==null||j(F),_&&_(D.map(T=>({id:T,type:"remove"})))),P.length>0&&(N==null||N(P),E)&&E(P.map(T=>({id:T.id,type:"remove"})))}},[]),f=M.useCallback(g=>{const p=kn((b=g).width)&&kn(b.height)&&kn(b.x)&&kn(b.y);var b;const y=p?null:e.getState().nodeInternals.get(g.id);return!p&&!y?[null,null,p]:[p?g:fv(y),y,p]},[]),m=M.useCallback((g,p=!0,b)=>{const[y,v,w]=f(g);return y?(b||e.getState().getNodes()).filter(S=>{if(!(w||S.id!==v.id&&S.positionAbsolute))return!1;const N=fv(S),j=Nh(N,y);return p&&j>0||j>=y.width*y.height}):[]},[]),x=M.useCallback((g,p,b=!0)=>{const[y]=f(g);if(!y)return!1;const v=Nh(y,p);return b&&v>0||v>=y.width*y.height},[]);return M.useMemo(()=>({...t,getNodes:n,getNode:o,getEdges:r,getEdge:s,setNodes:a,setEdges:i,addNodes:l,addEdges:d,toObject:u,deleteElements:h,getIntersectingNodes:m,isNodeIntersecting:x}),[t,n,o,r,s,a,i,l,d,u,h,m,x])}const jA={actInsideInputWithModifier:!1},Bh={position:"absolute",width:"100%",height:"100%",top:0,left:0},Fl=t=>({x:t.x,y:t.y,zoom:t.k}),Jr=(t,e)=>t.target.closest(`.${e}`),Jv=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),Zv=t=>{const e=t.ctrlKey&&Tl()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e},CA=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection,d3ZoomHandler:t.d3ZoomHandler,userSelectionActive:t.userSelectionActive}),EA=({onMove:t,onMoveStart:e,onMoveEnd:n,onPaneContextMenu:o,zoomOnScroll:r=!0,zoomOnPinch:s=!0,panOnScroll:a=!1,panOnScrollSpeed:i=.5,panOnScrollMode:l=Ro.Free,zoomOnDoubleClick:d=!0,elementsSelectable:u,panOnDrag:h=!0,defaultViewport:f,translateExtent:m,minZoom:x,maxZoom:g,zoomActivationKeyCode:p,preventScrolling:b=!0,children:y,noWheelClassName:v,noPanClassName:w})=>{const S=M.useRef(),N=Lt(),j=M.useRef(!1),E=M.useRef(!1),_=M.useRef(null),A=M.useRef({x:0,y:0,zoom:0}),{d3Zoom:I,d3Selection:P,d3ZoomHandler:L,userSelectionActive:O}=it(CA,$t),R=va(p),F=M.useRef(0),D=M.useRef(!1),T=M.useRef();return function(k){const B=Lt();M.useEffect(()=>{let C;const U=()=>{var $,X;if(!k.current)return;const V=wh(k.current);V.height!==0&&V.width!==0||((X=($=B.getState()).onError)==null||X.call($,"004",K8())),B.setState({width:V.width||500,height:V.height||500})};return U(),window.addEventListener("resize",U),k.current&&(C=new ResizeObserver(()=>U()),C.observe(k.current)),()=>{window.removeEventListener("resize",U),C&&k.current&&C.unobserve(k.current)}},[])}(_),M.useEffect(()=>{if(_.current){const k=_.current.getBoundingClientRect(),B=function(){var X,Y,J,Q=$8,W=V8,K=q8,oe=H8,re=W8,ne=[0,1/0],ae=[[-1/0,-1/0],[1/0,1/0]],te=250,me=YL,ce=$S("start","zoom","end"),se=0,be=10;function ue(G){G.property("__zoom",lv).on("wheel.zoom",Ve,{passive:!1}).on("mousedown.zoom",Ge).on("dblclick.zoom",ee).filter(re).on("touchstart.zoom",ye).on("touchmove.zoom",we).on("touchend.zoom touchcancel.zoom",Te).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function Se(G,he){return(he=Math.max(ne[0],Math.min(ne[1],he)))===G.k?G:new Gm(he,G.x,G.y)}function Me(G,he,xe){var de=he[0]-xe[0]*G.k,ke=he[1]-xe[1]*G.k;return de===G.x&&ke===G.y?G:new Gm(G.k,de,ke)}function Ee(G){return[(+G[0][0]+ +G[1][0])/2,(+G[0][1]+ +G[1][1])/2]}function Re(G,he,xe,de){G.on("start.zoom",function(){Ae(this,arguments).event(de).start()}).on("interrupt.zoom end.zoom",function(){Ae(this,arguments).event(de).end()}).tween("zoom",function(){var ke=this,Pe=arguments,Le=Ae(ke,Pe).event(de),Ze=W.apply(ke,Pe),ie=xe==null?Ee(Ze):typeof xe=="function"?xe.apply(ke,Pe):xe,_e=Math.max(Ze[1][0]-Ze[0][0],Ze[1][1]-Ze[0][1]),Ie=ke.__zoom,Be=typeof he=="function"?he.apply(ke,Pe):he,We=me(Ie.invert(ie).concat(_e/Ie.k),Be.invert(ie).concat(_e/Be.k));return function(De){if(De===1)De=Be;else{var $e=We(De),nt=_e/$e[2];De=new Gm(nt,ie[0]-$e[0]*nt,ie[1]-$e[1]*nt)}Le.zoom(null,De)}})}function Ae(G,he,xe){return!xe&&G.__zooming||new Ye(G,he)}function Ye(G,he){this.that=G,this.args=he,this.active=0,this.sourceEvent=null,this.extent=W.apply(G,he),this.taps=0}function Ve(G,...he){if(Q.apply(this,arguments)){var xe=Ae(this,he).event(G),de=this.__zoom,ke=Math.max(ne[0],Math.min(ne[1],de.k*Math.pow(2,oe.apply(this,arguments)))),Pe=Wn(G);if(xe.wheel)xe.mouse[0][0]===Pe[0]&&xe.mouse[0][1]===Pe[1]||(xe.mouse[1]=de.invert(xe.mouse[0]=Pe)),clearTimeout(xe.wheel);else{if(de.k===ke)return;xe.mouse=[Pe,de.invert(Pe)],Ym(this),xe.start()}pa(G),xe.wheel=setTimeout(function(){xe.wheel=null,xe.end()},150),xe.zoom("mouse",K(Me(Se(de,ke),xe.mouse[0],xe.mouse[1]),xe.extent,ae))}}function Ge(G,...he){if(!J&&Q.apply(this,arguments)){var xe=G.currentTarget,de=Ae(this,he,!0).event(G),ke=Fn(G.view).on("mousemove.zoom",function(ie){if(pa(ie),!de.moved){var _e=ie.clientX-Le,Ie=ie.clientY-Ze;de.moved=_e*_e+Ie*Ie>se}de.event(ie).zoom("mouse",K(Me(de.that.__zoom,de.mouse[0]=Wn(ie,xe),de.mouse[1]),de.extent,ae))},!0).on("mouseup.zoom",function(ie){ke.on("mousemove.zoom mouseup.zoom",null),iv(ie.view,de.moved),pa(ie),de.event(ie).end()},!0),Pe=Wn(G,xe),Le=G.clientX,Ze=G.clientY;av(G.view),vh(G),de.mouse=[Pe,this.__zoom.invert(Pe)],Ym(this),de.start()}}function ee(G,...he){if(Q.apply(this,arguments)){var xe=this.__zoom,de=Wn(G.changedTouches?G.changedTouches[0]:G,this),ke=xe.invert(de),Pe=xe.k*(G.shiftKey?.5:2),Le=K(Me(Se(xe,Pe),de,ke),W.apply(this,he),ae);pa(G),te>0?Fn(this).transition().duration(te).call(Re,Le,de,G):Fn(this).call(ue.transform,Le,de,G)}}function ye(G,...he){if(Q.apply(this,arguments)){var xe,de,ke,Pe,Le=G.touches,Ze=Le.length,ie=Ae(this,he,G.changedTouches.length===Ze).event(G);for(vh(G),de=0;de<Ze;++de)Pe=[Pe=Wn(ke=Le[de],this),this.__zoom.invert(Pe),ke.identifier],ie.touch0?ie.touch1||ie.touch0[2]===Pe[2]||(ie.touch1=Pe,ie.taps=0):(ie.touch0=Pe,xe=!0,ie.taps=1+!!X);X&&(X=clearTimeout(X)),xe&&(ie.taps<2&&(Y=Pe[0],X=setTimeout(function(){X=null},500)),Ym(this),ie.start())}}function we(G,...he){if(this.__zooming){var xe,de,ke,Pe,Le=Ae(this,he).event(G),Ze=G.changedTouches,ie=Ze.length;for(pa(G),xe=0;xe<ie;++xe)ke=Wn(de=Ze[xe],this),Le.touch0&&Le.touch0[2]===de.identifier?Le.touch0[0]=ke:Le.touch1&&Le.touch1[2]===de.identifier&&(Le.touch1[0]=ke);if(de=Le.that.__zoom,Le.touch1){var _e=Le.touch0[0],Ie=Le.touch0[1],Be=Le.touch1[0],We=Le.touch1[1],De=(De=Be[0]-_e[0])*De+(De=Be[1]-_e[1])*De,$e=($e=We[0]-Ie[0])*$e+($e=We[1]-Ie[1])*$e;de=Se(de,Math.sqrt(De/$e)),ke=[(_e[0]+Be[0])/2,(_e[1]+Be[1])/2],Pe=[(Ie[0]+We[0])/2,(Ie[1]+We[1])/2]}else{if(!Le.touch0)return;ke=Le.touch0[0],Pe=Le.touch0[1]}Le.zoom("touch",K(Me(de,ke,Pe),Le.extent,ae))}}function Te(G,...he){if(this.__zooming){var xe,de,ke=Ae(this,he).event(G),Pe=G.changedTouches,Le=Pe.length;for(vh(G),J&&clearTimeout(J),J=setTimeout(function(){J=null},500),xe=0;xe<Le;++xe)de=Pe[xe],ke.touch0&&ke.touch0[2]===de.identifier?delete ke.touch0:ke.touch1&&ke.touch1[2]===de.identifier&&delete ke.touch1;if(ke.touch1&&!ke.touch0&&(ke.touch0=ke.touch1,delete ke.touch1),ke.touch0)ke.touch0[1]=this.__zoom.invert(ke.touch0[0]);else if(ke.end(),ke.taps===2&&(de=Wn(de,this),Math.hypot(Y[0]-de[0],Y[1]-de[1])<be)){var Ze=Fn(this).on("dblclick.zoom");Ze&&Ze.apply(this,arguments)}}}return ue.transform=function(G,he,xe,de){var ke=G.selection?G.selection():G;ke.property("__zoom",lv),G!==ke?Re(G,he,xe,de):ke.interrupt().each(function(){Ae(this,arguments).event(de).start().zoom(null,typeof he=="function"?he.apply(this,arguments):he).end()})},ue.scaleBy=function(G,he,xe,de){ue.scaleTo(G,function(){return this.__zoom.k*(typeof he=="function"?he.apply(this,arguments):he)},xe,de)},ue.scaleTo=function(G,he,xe,de){ue.transform(G,function(){var ke=W.apply(this,arguments),Pe=this.__zoom,Le=xe==null?Ee(ke):typeof xe=="function"?xe.apply(this,arguments):xe,Ze=Pe.invert(Le),ie=typeof he=="function"?he.apply(this,arguments):he;return K(Me(Se(Pe,ie),Le,Ze),ke,ae)},xe,de)},ue.translateBy=function(G,he,xe,de){ue.transform(G,function(){return K(this.__zoom.translate(typeof he=="function"?he.apply(this,arguments):he,typeof xe=="function"?xe.apply(this,arguments):xe),W.apply(this,arguments),ae)},null,de)},ue.translateTo=function(G,he,xe,de,ke){ue.transform(G,function(){var Pe=W.apply(this,arguments),Le=this.__zoom,Ze=de==null?Ee(Pe):typeof de=="function"?de.apply(this,arguments):de;return K(Jo.translate(Ze[0],Ze[1]).scale(Le.k).translate(typeof he=="function"?-he.apply(this,arguments):-he,typeof xe=="function"?-xe.apply(this,arguments):-xe),Pe,ae)},de,ke)},Ye.prototype={event:function(G){return G&&(this.sourceEvent=G),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(G,he){return this.mouse&&G!=="mouse"&&(this.mouse[1]=he.invert(this.mouse[0])),this.touch0&&G!=="touch"&&(this.touch0[1]=he.invert(this.touch0[0])),this.touch1&&G!=="touch"&&(this.touch1[1]=he.invert(this.touch1[0])),this.that.__zoom=he,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(G){var he=Fn(this.that).datum();ce.call(G,this.that,new U8(G,{sourceEvent:this.sourceEvent,target:ue,transform:this.that.__zoom,dispatch:ce}),he)}},ue.wheelDelta=function(G){return arguments.length?(oe=typeof G=="function"?G:_l(+G),ue):oe},ue.filter=function(G){return arguments.length?(Q=typeof G=="function"?G:_l(!!G),ue):Q},ue.touchable=function(G){return arguments.length?(re=typeof G=="function"?G:_l(!!G),ue):re},ue.extent=function(G){return arguments.length?(W=typeof G=="function"?G:_l([[+G[0][0],+G[0][1]],[+G[1][0],+G[1][1]]]),ue):W},ue.scaleExtent=function(G){return arguments.length?(ne[0]=+G[0],ne[1]=+G[1],ue):[ne[0],ne[1]]},ue.translateExtent=function(G){return arguments.length?(ae[0][0]=+G[0][0],ae[1][0]=+G[1][0],ae[0][1]=+G[0][1],ae[1][1]=+G[1][1],ue):[[ae[0][0],ae[0][1]],[ae[1][0],ae[1][1]]]},ue.constrain=function(G){return arguments.length?(K=G,ue):K},ue.duration=function(G){return arguments.length?(te=+G,ue):te},ue.interpolate=function(G){return arguments.length?(me=G,ue):me},ue.on=function(){var G=ce.on.apply(ce,arguments);return G===ce?ue:G},ue.clickDistance=function(G){return arguments.length?(se=(G=+G)*G,ue):Math.sqrt(se)},ue.tapDistance=function(G){return arguments.length?(be=+G,ue):be},ue}().scaleExtent([x,g]).translateExtent(m),C=Fn(_.current).call(B),U=Jo.translate(f.x,f.y).scale(qr(f.zoom,x,g)),V=[[0,0],[k.width,k.height]],$=B.constrain()(U,V,m);B.transform(C,$),B.wheelDelta(Zv),N.setState({d3Zoom:B,d3Selection:C,d3ZoomHandler:C.on("wheel.zoom"),transform:[$.x,$.y,$.k],domNode:_.current.closest(".react-flow")})}},[]),M.useEffect(()=>{P&&I&&(!a||R||O?L!==void 0&&P.on("wheel.zoom",function(k,B){if(!b&&k.type==="wheel"&&!k.ctrlKey||Jr(k,v))return null;k.preventDefault(),L.call(this,k,B)},{passive:!1}):P.on("wheel.zoom",k=>{if(Jr(k,v))return!1;k.preventDefault(),k.stopImmediatePropagation();const B=P.property("__zoom").k||1;if(k.ctrlKey&&s){const Q=Wn(k),W=Zv(k),K=B*Math.pow(2,W);return void I.scaleTo(P,K,Q,k)}const C=k.deltaMode===1?20:1;let U=l===Ro.Vertical?0:k.deltaX*C,V=l===Ro.Horizontal?0:k.deltaY*C;!Tl()&&k.shiftKey&&l!==Ro.Vertical&&(U=k.deltaY*C,V=0),I.translateBy(P,-U/B*i,-V/B*i,{internal:!0});const $=Fl(P.property("__zoom")),{onViewportChangeStart:X,onViewportChange:Y,onViewportChangeEnd:J}=N.getState();clearTimeout(T.current),D.current||(D.current=!0,e==null||e(k,$),X==null||X($)),D.current&&(t==null||t(k,$),Y==null||Y($),T.current=setTimeout(()=>{n==null||n(k,$),J==null||J($),D.current=!1},150))},{passive:!1}))},[O,a,l,P,I,L,R,s,b,v,e,t,n]),M.useEffect(()=>{I&&I.on("start",k=>{var U,V;if(!k.sourceEvent||k.sourceEvent.internal)return null;F.current=(U=k.sourceEvent)==null?void 0:U.button;const{onViewportChangeStart:B}=N.getState(),C=Fl(k.transform);j.current=!0,A.current=C,((V=k.sourceEvent)==null?void 0:V.type)==="mousedown"&&N.setState({paneDragging:!0}),B==null||B(C),e==null||e(k.sourceEvent,C)})},[I,e]),M.useEffect(()=>{I&&(O&&!j.current?I.on("zoom",null):O||I.on("zoom",k=>{var C;const{onViewportChange:B}=N.getState();if(N.setState({transform:[k.transform.x,k.transform.y,k.transform.k]}),E.current=!(!o||!Jv(h,F.current??0)),(t||B)&&!((C=k.sourceEvent)!=null&&C.internal)){const U=Fl(k.transform);B==null||B(U),t==null||t(k.sourceEvent,U)}}))},[O,I,t,h,o]),M.useEffect(()=>{I&&I.on("end",k=>{if(!k.sourceEvent||k.sourceEvent.internal)return null;const{onViewportChangeEnd:B}=N.getState();if(j.current=!1,N.setState({paneDragging:!1}),o&&Jv(h,F.current??0)&&!E.current&&o(k.sourceEvent),E.current=!1,(n||B)&&(C=A.current,U=k.transform,C.x!==U.x||C.y!==U.y||C.zoom!==U.k)){const V=Fl(k.transform);A.current=V,clearTimeout(S.current),S.current=setTimeout(()=>{B==null||B(V),n==null||n(k.sourceEvent,V)},a?150:0)}var C,U})},[I,a,h,n,o]),M.useEffect(()=>{I&&I.filter(k=>{const B=R||r,C=s&&k.ctrlKey;if((h===!0||Array.isArray(h)&&h.includes(1))&&k.button===1&&k.type==="mousedown"&&(Jr(k,"react-flow__node")||Jr(k,"react-flow__edge")))return!0;if(!(h||B||a||d||s)||O||!d&&k.type==="dblclick"||Jr(k,v)&&k.type==="wheel"||Jr(k,w)&&(k.type!=="wheel"||a&&k.type==="wheel"&&!R)||!s&&k.ctrlKey&&k.type==="wheel"||!B&&!a&&!C&&k.type==="wheel"||!h&&(k.type==="mousedown"||k.type==="touchstart")||Array.isArray(h)&&!h.includes(k.button)&&k.type==="mousedown")return!1;const U=Array.isArray(h)&&h.includes(k.button)||!k.button||k.button<=1;return(!k.ctrlKey||k.type==="wheel")&&U})},[O,I,r,s,a,d,h,u,R]),q.createElement("div",{className:"react-flow__renderer",ref:_,style:Bh},y)},_A=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function IA(){const{userSelectionActive:t,userSelectionRect:e}=it(_A,$t);return t&&e?q.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}function Qv(t,e){const n=e.parentNode||e.parentId,o=t.find(r=>r.id===n);if(o){const r=e.position.x+e.width-o.width,s=e.position.y+e.height-o.height;if(r>0||s>0||e.position.x<0||e.position.y<0){if(o.style={...o.style},o.style.width=o.style.width??o.width,o.style.height=o.style.height??o.height,r>0&&(o.style.width+=r),s>0&&(o.style.height+=s),e.position.x<0){const a=Math.abs(e.position.x);o.position.x=o.position.x-a,o.style.width+=a,e.position.x=0}if(e.position.y<0){const a=Math.abs(e.position.y);o.position.y=o.position.y-a,o.style.height+=a,e.position.y=0}o.width=o.style.width,o.height=o.style.height}}}function e2(t,e){if(t.some(o=>o.type==="reset"))return t.filter(o=>o.type==="reset").map(o=>o.item);const n=t.filter(o=>o.type==="add").map(o=>o.item);return e.reduce((o,r)=>{const s=t.filter(i=>i.id===r.id);if(s.length===0)return o.push(r),o;const a={...r};for(const i of s)if(i)switch(i.type){case"select":a.selected=i.selected;break;case"position":i.position!==void 0&&(a.position=i.position),i.positionAbsolute!==void 0&&(a.positionAbsolute=i.positionAbsolute),i.dragging!==void 0&&(a.dragging=i.dragging),a.expandParent&&Qv(o,a);break;case"dimensions":i.dimensions!==void 0&&(a.width=i.dimensions.width,a.height=i.dimensions.height),i.updateStyle!==void 0&&(a.style={...a.style||{},...i.dimensions}),typeof i.resizing=="boolean"&&(a.resizing=i.resizing),a.expandParent&&Qv(o,a);break;case"remove":return o}return o.push(a),o},n)}function t2(t,e){return e2(t,e)}const zo=(t,e)=>({id:t,type:"select",selected:e});function Zr(t,e){return t.reduce((n,o)=>{const r=e.includes(o.id);return!o.selected&&r?(o.selected=!0,n.push(zo(o.id,!0))):o.selected&&!r&&(o.selected=!1,n.push(zo(o.id,!1))),n},[])}const Uh=(t,e)=>n=>{n.target===e.current&&(t==null||t(n))},AA=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,dragging:t.paneDragging}),n2=M.memo(({isSelecting:t,selectionMode:e=ba.Full,panOnDrag:n,onSelectionStart:o,onSelectionEnd:r,onPaneClick:s,onPaneContextMenu:a,onPaneScroll:i,onPaneMouseEnter:l,onPaneMouseMove:d,onPaneMouseLeave:u,children:h})=>{const f=M.useRef(null),m=Lt(),x=M.useRef(0),g=M.useRef(0),p=M.useRef(),{userSelectionActive:b,elementsSelectable:y,dragging:v}=it(AA,$t),w=()=>{m.setState({userSelectionActive:!1,userSelectionRect:null}),x.current=0,g.current=0},S=E=>{s==null||s(E),m.getState().resetSelectedElements(),m.setState({nodesSelectionActive:!1})},N=i?E=>i(E):void 0,j=y&&(t||b);return q.createElement("div",{className:Kt(["react-flow__pane",{dragging:v,selection:t}]),onClick:j?void 0:Uh(S,f),onContextMenu:Uh(E=>{Array.isArray(n)&&(n!=null&&n.includes(2))?E.preventDefault():a==null||a(E)},f),onWheel:Uh(N,f),onMouseEnter:j?void 0:l,onMouseDown:j?E=>{const{resetSelectedElements:_,domNode:A}=m.getState();if(p.current=A==null?void 0:A.getBoundingClientRect(),!y||!t||E.button!==0||E.target!==f.current||!p.current)return;const{x:I,y:P}=Po(E,p.current);_(),m.setState({userSelectionRect:{width:0,height:0,startX:I,startY:P,x:I,y:P}}),o==null||o(E)}:void 0,onMouseMove:j?E=>{const{userSelectionRect:_,nodeInternals:A,edges:I,transform:P,onNodesChange:L,onEdgesChange:O,nodeOrigin:R,getNodes:F}=m.getState();if(!t||!p.current||!_)return;m.setState({userSelectionActive:!0,nodesSelectionActive:!1});const D=Po(E,p.current),T=_.startX??0,k=_.startY??0,B={..._,x:D.x<T?D.x:T,y:D.y<k?D.y:k,width:Math.abs(D.x-T),height:Math.abs(D.y-k)},C=F(),U=_v(A,B,P,e===ba.Partial,!0,R),V=Iv(U,I).map(X=>X.id),$=U.map(X=>X.id);if(x.current!==$.length){x.current=$.length;const X=Zr(C,$);X.length&&(L==null||L(X))}if(g.current!==V.length){g.current=V.length;const X=Zr(I,V);X.length&&(O==null||O(X))}m.setState({userSelectionRect:B})}:d,onMouseUp:j?E=>{if(E.button!==0)return;const{userSelectionRect:_}=m.getState();!b&&_&&E.target===f.current&&(S==null||S(E)),m.setState({nodesSelectionActive:x.current>0}),w(),r==null||r(E)}:void 0,onMouseLeave:j?E=>{b&&(m.setState({nodesSelectionActive:x.current>0}),r==null||r(E)),w()}:u,ref:f,style:Bh},h,q.createElement(IA,null))});function o2(t,e){const n=t.parentNode||t.parentId;if(!n)return!1;const o=e.get(n);return!!o&&(!!o.selected||o2(o,e))}function r2(t,e,n){let o=t;do{if(o!=null&&o.matches(e))return!0;if(o===n.current)return!1;o=o.parentElement}while(o);return!1}function TA(t,e,n,o){return Array.from(t.values()).filter(r=>(r.selected||r.id===o)&&(!r.parentNode||r.parentId||!o2(r,t))&&(r.draggable||e&&r.draggable===void 0)).map(r=>{var s,a;return{id:r.id,position:r.position||{x:0,y:0},positionAbsolute:r.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((s=r.positionAbsolute)==null?void 0:s.x)??0),y:n.y-(((a=r.positionAbsolute)==null?void 0:a.y)??0)},delta:{x:0,y:0},extent:r.extent,parentNode:r.parentNode||r.parentId,parentId:r.parentNode||r.parentId,width:r.width,height:r.height,expandParent:r.expandParent}})}function s2(t,e,n,o,r=[0,0],s){const a=function(h,f){return f&&f!=="parent"?[f[0],[f[1][0]-(h.width||0),f[1][1]-(h.height||0)]]:f}(t,t.extent||o);let i=a;const l=t.parentNode||t.parentId;if(t.extent!=="parent"||t.expandParent){if(t.extent&&l&&t.extent!=="parent"){const h=n.get(l),{x:f,y:m}=Yr(h,r).positionAbsolute;i=[[t.extent[0][0]+f,t.extent[0][1]+m],[t.extent[1][0]+f,t.extent[1][1]+m]]}}else if(l&&t.width&&t.height){const h=n.get(l),{x:f,y:m}=Yr(h,r).positionAbsolute;i=h&&kn(f)&&kn(m)&&kn(h.width)&&kn(h.height)?[[f+t.width*r[0],m+t.height*r[1]],[f+h.width-t.width+t.width*r[0],m+h.height-t.height+t.height*r[1]]]:i}else s==null||s("005",X8()),i=a;let d={x:0,y:0};if(l){const h=n.get(l);d=Yr(h,r).positionAbsolute}const u=i&&i!=="parent"?kh(e,i):e;return{position:{x:u.x-d.x,y:u.y-d.y},positionAbsolute:u}}function $h({nodeId:t,dragItems:e,nodeInternals:n}){const o=e.map(r=>({...n.get(r.id),position:r.position,positionAbsolute:r.positionAbsolute}));return[t?o.find(r=>r.id===t):o[0],o]}n2.displayName="Pane";const a2=(t,e,n,o)=>{const r=e.querySelectorAll(t);if(!r||!r.length)return null;const s=Array.from(r),a=e.getBoundingClientRect(),i=a.width*o[0],l=a.height*o[1];return s.map(d=>{const u=d.getBoundingClientRect();return{id:d.getAttribute("data-handleid"),position:d.getAttribute("data-handlepos"),x:(u.left-a.left-i)/n,y:(u.top-a.top-l)/n,...wh(d)}})};function ka(t,e,n){return n===void 0?n:o=>{const r=e().nodeInternals.get(t);r&&n(o,{...r})}}function Vh({id:t,store:e,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:s,multiSelectionActive:a,nodeInternals:i,onError:l}=e.getState(),d=i.get(t);d?(e.setState({nodesSelectionActive:!1}),d.selected?(n||d.selected&&a)&&(s({nodes:[d],edges:[]}),requestAnimationFrame(()=>{var u;return(u=o==null?void 0:o.current)==null?void 0:u.blur()})):r([t])):l==null||l("012",tA(t))}function Hh(t){return(e,n,o)=>t==null?void 0:t(e,o)}function i2({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:s,selectNodesOnDrag:a}){const i=Lt(),[l,d]=M.useState(!1),u=M.useRef([]),h=M.useRef({x:null,y:null}),f=M.useRef(0),m=M.useRef(null),x=M.useRef({x:0,y:0}),g=M.useRef(null),p=M.useRef(!1),b=M.useRef(!1),y=M.useRef(!1),v=function(){const w=Lt();return M.useCallback(({sourceEvent:N})=>{const{transform:j,snapGrid:E,snapToGrid:_}=w.getState(),A=N.touches?N.touches[0].clientX:N.clientX,I=N.touches?N.touches[0].clientY:N.clientY,P={x:(A-j[0])/j[2],y:(I-j[1])/j[2]};return{xSnapped:_?E[0]*Math.round(P.x/E[0]):P.x,ySnapped:_?E[1]*Math.round(P.y/E[1]):P.y,...P}},[])}();return M.useEffect(()=>{if(t!=null&&t.current){const w=Fn(t.current),S=({x:E,y:_})=>{const{nodeInternals:A,onNodeDrag:I,onSelectionDrag:P,updateNodePositions:L,nodeExtent:O,snapGrid:R,snapToGrid:F,nodeOrigin:D,onError:T}=i.getState();h.current={x:E,y:_};let k=!1,B={x:0,y:0,x2:0,y2:0};if(u.current.length>1&&O){const U=Dh(u.current,D);B=Sh(U)}if(u.current=u.current.map(U=>{const V={x:E-U.distance.x,y:_-U.distance.y};F&&(V.x=R[0]*Math.round(V.x/R[0]),V.y=R[1]*Math.round(V.y/R[1]));const $=[[O[0][0],O[0][1]],[O[1][0],O[1][1]]];u.current.length>1&&O&&!U.extent&&($[0][0]=U.positionAbsolute.x-B.x+O[0][0],$[1][0]=U.positionAbsolute.x+(U.width??0)-B.x2+O[1][0],$[0][1]=U.positionAbsolute.y-B.y+O[0][1],$[1][1]=U.positionAbsolute.y+(U.height??0)-B.y2+O[1][1]);const X=s2(U,V,A,$,D,T);return k=k||U.position.x!==X.position.x||U.position.y!==X.position.y,U.position=X.position,U.positionAbsolute=X.positionAbsolute,U}),!k)return;L(u.current,!0,!0),d(!0);const C=r?I:Hh(P);if(C&&g.current){const[U,V]=$h({nodeId:r,dragItems:u.current,nodeInternals:A});C(g.current,U,V)}},N=()=>{if(!m.current)return;const[E,_]=uv(x.current,m.current);if(E!==0||_!==0){const{transform:A,panBy:I}=i.getState();h.current.x=(h.current.x??0)-E/A[2],h.current.y=(h.current.y??0)-_/A[2],I({x:E,y:_})&&S(h.current)}f.current=requestAnimationFrame(N)},j=E=>{var D;const{nodeInternals:_,multiSelectionActive:A,nodesDraggable:I,unselectNodesAndEdges:P,onNodeDragStart:L,onSelectionDragStart:O}=i.getState();b.current=!0;const R=r?L:Hh(O);a&&s||A||!r||(D=_.get(r))!=null&&D.selected||P(),r&&s&&a&&Vh({id:r,store:i,nodeRef:t});const F=v(E);if(h.current=F,u.current=TA(_,I,F,r),R&&u.current){const[T,k]=$h({nodeId:r,dragItems:u.current,nodeInternals:_});R(E.sourceEvent,T,k)}};if(!e){const E=function(){var _,A,I,P,L=L8,O=F8,R=z8,F=B8,D={},T=$S("start","drag","end"),k=0,B=0;function C(W){W.on("mousedown.drag",U).filter(F).on("touchstart.drag",X).on("touchmove.drag",Y,R8).on("touchend.drag touchcancel.drag",J).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function U(W,K){if(!P&&L.call(this,W,K)){var oe=Q(this,O.call(this,W,K),W,K,"mouse");oe&&(Fn(W.view).on("mousemove.drag",V,ma).on("mouseup.drag",$,ma),av(W.view),bh(W),I=!1,_=W.clientX,A=W.clientY,oe("start",W))}}function V(W){if(Wr(W),!I){var K=W.clientX-_,oe=W.clientY-A;I=K*K+oe*oe>B}D.mouse("drag",W)}function $(W){Fn(W.view).on("mousemove.drag mouseup.drag",null),iv(W.view,I),Wr(W),D.mouse("end",W)}function X(W,K){if(L.call(this,W,K)){var oe,re,ne=W.changedTouches,ae=O.call(this,W,K),te=ne.length;for(oe=0;oe<te;++oe)(re=Q(this,ae,W,K,ne[oe].identifier,ne[oe]))&&(bh(W),re("start",W,ne[oe]))}}function Y(W){var K,oe,re=W.changedTouches,ne=re.length;for(K=0;K<ne;++K)(oe=D[re[K].identifier])&&(Wr(W),oe("drag",W,re[K]))}function J(W){var K,oe,re=W.changedTouches,ne=re.length;for(P&&clearTimeout(P),P=setTimeout(function(){P=null},500),K=0;K<ne;++K)(oe=D[re[K].identifier])&&(bh(W),oe("end",W,re[K]))}function Q(W,K,oe,re,ne,ae){var te,me,ce,se=T.copy(),be=Wn(ae||oe,K);if((ce=R.call(W,new yh("beforestart",{sourceEvent:oe,target:C,identifier:ne,active:k,x:be[0],y:be[1],dx:0,dy:0,dispatch:se}),re))!=null)return te=ce.x-be[0]||0,me=ce.y-be[1]||0,function ue(Se,Me,Ee){var Re,Ae=be;switch(Se){case"start":D[ne]=ue,Re=k++;break;case"end":delete D[ne],--k;case"drag":be=Wn(Ee||Me,K),Re=k}se.call(Se,W,new yh(Se,{sourceEvent:Me,subject:ce,target:C,identifier:ne,active:Re,x:be[0]+te,y:be[1]+me,dx:be[0]-Ae[0],dy:be[1]-Ae[1],dispatch:se}),re)}}return C.filter=function(W){return arguments.length?(L=typeof W=="function"?W:El(!!W),C):L},C.container=function(W){return arguments.length?(O=typeof W=="function"?W:El(W),C):O},C.subject=function(W){return arguments.length?(R=typeof W=="function"?W:El(W),C):R},C.touchable=function(W){return arguments.length?(F=typeof W=="function"?W:El(!!W),C):F},C.on=function(){var W=T.on.apply(T,arguments);return W===T?C:W},C.clickDistance=function(W){return arguments.length?(B=(W=+W)*W,C):Math.sqrt(B)},C}().on("start",_=>{const{domNode:A,nodeDragThreshold:I}=i.getState();I===0&&j(_),y.current=!1;const P=v(_);h.current=P,m.current=(A==null?void 0:A.getBoundingClientRect())||null,x.current=Po(_.sourceEvent,m.current)}).on("drag",_=>{var L,O;const A=v(_),{autoPanOnNodeDrag:I,nodeDragThreshold:P}=i.getState();if(_.sourceEvent.type==="touchmove"&&_.sourceEvent.touches.length>1&&(y.current=!0),!y.current){if(!p.current&&b.current&&I&&(p.current=!0,N()),!b.current){const R=A.xSnapped-(((L=h==null?void 0:h.current)==null?void 0:L.x)??0),F=A.ySnapped-(((O=h==null?void 0:h.current)==null?void 0:O.y)??0);Math.sqrt(R*R+F*F)>P&&j(_)}(h.current.x!==A.xSnapped||h.current.y!==A.ySnapped)&&u.current&&b.current&&(g.current=_.sourceEvent,x.current=Po(_.sourceEvent,m.current),S(A))}}).on("end",_=>{if(b.current&&!y.current&&(d(!1),p.current=!1,b.current=!1,cancelAnimationFrame(f.current),u.current)){const{updateNodePositions:A,nodeInternals:I,onNodeDragStop:P,onSelectionDragStop:L}=i.getState(),O=r?P:Hh(L);if(A(u.current,!1,!1),O){const[R,F]=$h({nodeId:r,dragItems:u.current,nodeInternals:I});O(_.sourceEvent,R,F)}}}).filter(_=>{const A=_.target;return!_.button&&(!n||!r2(A,`.${n}`,t))&&(!o||r2(A,o,t))});return w.call(E),()=>{w.on(".drag",null)}}w.on(".drag",null)}},[t,e,n,o,s,i,r,a,v]),l}function l2(){const t=Lt();return M.useCallback(n=>{const{nodeInternals:o,nodeExtent:r,updateNodePositions:s,getNodes:a,snapToGrid:i,snapGrid:l,onError:d,nodesDraggable:u}=t.getState(),h=a().filter(y=>y.selected&&(y.draggable||u&&y.draggable===void 0)),f=i?l[0]:5,m=i?l[1]:5,x=n.isShiftPressed?4:1,g=n.x*f*x,p=n.y*m*x,b=h.map(y=>{if(y.positionAbsolute){const v={x:y.positionAbsolute.x+g,y:y.positionAbsolute.y+p};i&&(v.x=l[0]*Math.round(v.x/l[0]),v.y=l[1]*Math.round(v.y/l[1]));const{positionAbsolute:w,position:S}=s2(y,v,o,r,void 0,d);y.position=S,y.positionAbsolute=w}return y});s(b,!0,!1)},[])}const Qr={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Sa=t=>{const e=({id:n,type:o,data:r,xPos:s,yPos:a,xPosOrigin:i,yPosOrigin:l,selected:d,onClick:u,onMouseEnter:h,onMouseMove:f,onMouseLeave:m,onContextMenu:x,onDoubleClick:g,style:p,className:b,isDraggable:y,isSelectable:v,isConnectable:w,isFocusable:S,selectNodesOnDrag:N,sourcePosition:j,targetPosition:E,hidden:_,resizeObserver:A,dragHandle:I,zIndex:P,isParent:L,noDragClassName:O,noPanClassName:R,initialized:F,disableKeyboardA11y:D,ariaLabel:T,rfId:k,hasHandleBounds:B})=>{const C=Lt(),U=M.useRef(null),V=M.useRef(null),$=M.useRef(j),X=M.useRef(E),Y=M.useRef(o),J=v||y||u||h||f||m,Q=l2(),W=ka(n,C.getState,h),K=ka(n,C.getState,f),oe=ka(n,C.getState,m),re=ka(n,C.getState,x),ne=ka(n,C.getState,g);M.useEffect(()=>()=>{V.current&&(A==null||A.unobserve(V.current),V.current=null)},[]),M.useEffect(()=>{if(U.current&&!_){const te=U.current;F&&B&&V.current===te||(V.current&&(A==null||A.unobserve(V.current)),A==null||A.observe(te),V.current=te)}},[_,F,B]),M.useEffect(()=>{const te=Y.current!==o,me=$.current!==j,ce=X.current!==E;U.current&&(te||me||ce)&&(te&&(Y.current=o),me&&($.current=j),ce&&(X.current=E),C.getState().updateNodeDimensions([{id:n,nodeElement:U.current,forceUpdate:!0}]))},[n,o,j,E]);const ae=i2({nodeRef:U,disabled:_||!y,noDragClassName:O,handleSelector:I,nodeId:n,isSelectable:v,selectNodesOnDrag:N});return _?null:q.createElement("div",{className:Kt(["react-flow__node",`react-flow__node-${o}`,{[R]:y},b,{selected:d,selectable:v,parent:L,dragging:ae}]),ref:U,style:{zIndex:P,transform:`translate(${i}px,${l}px)`,pointerEvents:J?"all":"none",visibility:F?"visible":"hidden",...p},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:W,onMouseMove:K,onMouseLeave:oe,onContextMenu:re,onClick:te=>{const{nodeDragThreshold:me}=C.getState();if(v&&(!N||!y||me>0)&&Vh({id:n,store:C,nodeRef:U}),u){const ce=C.getState().nodeInternals.get(n);ce&&u(te,{...ce})}},onDoubleClick:ne,onKeyDown:S?te=>{if(!jh(te)&&!D)if(mv.includes(te.key)&&v){const me=te.key==="Escape";Vh({id:n,store:C,unselect:me,nodeRef:U})}else y&&d&&Object.prototype.hasOwnProperty.call(Qr,te.key)&&(C.setState({ariaLiveMessage:`Moved selected node ${te.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~s}, y: ${~~a}`}),Q({x:Qr[te.key].x,y:Qr[te.key].y,isShiftPressed:te.shiftKey}))}:void 0,tabIndex:S?0:void 0,role:S?"button":void 0,"aria-describedby":D?void 0:`${Hv}-${k}`,"aria-label":T},q.createElement(aA,{value:n},q.createElement(t,{id:n,data:r,type:o,xPos:s,yPos:a,selected:d,isConnectable:w,sourcePosition:j,targetPosition:E,dragging:ae,dragHandle:I,zIndex:P})))};return e.displayName="NodeWrapper",M.memo(e)};const MA=t=>{const e=t.getNodes().filter(n=>n.selected);return{...Dh(e,t.nodeOrigin),transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`,userSelectionActive:t.userSelectionActive}};var OA=M.memo(function({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const o=Lt(),{width:r,height:s,x:a,y:i,transformString:l,userSelectionActive:d}=it(MA,$t),u=l2(),h=M.useRef(null);if(M.useEffect(()=>{var m;n||((m=h.current)==null||m.focus({preventScroll:!0}))},[n]),i2({nodeRef:h}),d||!r||!s)return null;const f=t?m=>{const x=o.getState().getNodes().filter(g=>g.selected);t(m,x)}:void 0;return q.createElement("div",{className:Kt(["react-flow__nodesselection","react-flow__container",e]),style:{transform:l}},q.createElement("div",{ref:h,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:m=>{Object.prototype.hasOwnProperty.call(Qr,m.key)&&u({x:Qr[m.key].x,y:Qr[m.key].y,isShiftPressed:m.shiftKey})},style:{width:r,height:s,top:i,left:a}}))});const DA=t=>t.nodesSelectionActive,c2=({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:a,deleteKeyCode:i,onMove:l,onMoveStart:d,onMoveEnd:u,selectionKeyCode:h,selectionOnDrag:f,selectionMode:m,onSelectionStart:x,onSelectionEnd:g,multiSelectionKeyCode:p,panActivationKeyCode:b,zoomActivationKeyCode:y,elementsSelectable:v,zoomOnScroll:w,zoomOnPinch:S,panOnScroll:N,panOnScrollSpeed:j,panOnScrollMode:E,zoomOnDoubleClick:_,panOnDrag:A,defaultViewport:I,translateExtent:P,minZoom:L,maxZoom:O,preventScrolling:R,onSelectionContextMenu:F,noWheelClassName:D,noPanClassName:T,disableKeyboardA11y:k})=>{const B=it(DA),C=va(h),U=va(b),V=U||A,$=U||N,X=C||f&&V!==!0;return(({deleteKeyCode:Y,multiSelectionKeyCode:J})=>{const Q=Lt(),{deleteElements:W}=wa(),K=va(Y,jA),oe=va(J);M.useEffect(()=>{if(K){const{edges:re,getNodes:ne}=Q.getState(),ae=ne().filter(me=>me.selected),te=re.filter(me=>me.selected);W({nodes:ae,edges:te}),Q.setState({nodesSelectionActive:!1})}},[K]),M.useEffect(()=>{Q.setState({multiSelectionActive:oe})},[oe])})({deleteKeyCode:i,multiSelectionKeyCode:p}),q.createElement(EA,{onMove:l,onMoveStart:d,onMoveEnd:u,onPaneContextMenu:s,elementsSelectable:v,zoomOnScroll:w,zoomOnPinch:S,panOnScroll:$,panOnScrollSpeed:j,panOnScrollMode:E,zoomOnDoubleClick:_,panOnDrag:!C&&V,defaultViewport:I,translateExtent:P,minZoom:L,maxZoom:O,zoomActivationKeyCode:y,preventScrolling:R,noWheelClassName:D,noPanClassName:T},q.createElement(n2,{onSelectionStart:x,onSelectionEnd:g,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:a,panOnDrag:V,isSelecting:!!X,selectionMode:m},t,B&&q.createElement(OA,{onSelectionContextMenu:F,noPanClassName:T,disableKeyboardA11y:k})))};c2.displayName="FlowRenderer";var PA=M.memo(c2);function RA(t){return{input:Sa(t.input||zv),default:Sa(t.default||Lh),output:Sa(t.output||Uv),group:Sa(t.group||Fh),...Object.keys(t).filter(e=>!["input","default","output","group"].includes(e)).reduce((e,n)=>(e[n]=Sa(t[n]||Lh),e),{})}}const LA=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,updateNodeDimensions:t.updateNodeDimensions,onError:t.onError}),d2=t=>{const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,updateNodeDimensions:s,onError:a}=it(LA,$t),i=(l=t.onlyRenderVisibleElements,it(M.useCallback(h=>l?_v(h.nodeInternals,{x:0,y:0,width:h.width,height:h.height},h.transform,!0):h.getNodes(),[l])));var l;const d=M.useRef(),u=M.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const h=new ResizeObserver(f=>{const m=f.map(x=>({id:x.target.getAttribute("data-id"),nodeElement:x.target,forceUpdate:!0}));s(m)});return d.current=h,h},[]);return M.useEffect(()=>()=>{var h;(h=d==null?void 0:d.current)==null||h.disconnect()},[]),q.createElement("div",{className:"react-flow__nodes",style:Bh},i.map(h=>{var N,j,E;let f=h.type||"default";t.nodeTypes[f]||(a==null||a("003",Y8(f)),f="default");const m=t.nodeTypes[f]||t.nodeTypes.default,x=!!(h.draggable||e&&h.draggable===void 0),g=!!(h.selectable||r&&h.selectable===void 0),p=!!(h.connectable||n&&h.connectable===void 0),b=!!(h.focusable||o&&h.focusable===void 0),y=t.nodeExtent?kh(h.positionAbsolute,t.nodeExtent):h.positionAbsolute,v=(y==null?void 0:y.x)??0,w=(y==null?void 0:y.y)??0,S=(({x:_,y:A,width:I,height:P,origin:L})=>I&&P?L[0]<0||L[1]<0||L[0]>1||L[1]>1?{x:_,y:A}:{x:_-I*L[0],y:A-P*L[1]}:{x:_,y:A})({x:v,y:w,width:h.width??0,height:h.height??0,origin:t.nodeOrigin});return q.createElement(m,{key:h.id,id:h.id,className:h.className,style:h.style,type:f,data:h.data,sourcePosition:h.sourcePosition||Oe.Bottom,targetPosition:h.targetPosition||Oe.Top,hidden:h.hidden,xPos:v,yPos:w,xPosOrigin:S.x,yPosOrigin:S.y,selectNodesOnDrag:t.selectNodesOnDrag,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,selected:!!h.selected,isDraggable:x,isSelectable:g,isConnectable:p,isFocusable:b,resizeObserver:u,dragHandle:h.dragHandle,zIndex:((N=h[xt])==null?void 0:N.z)??0,isParent:!!((j=h[xt])!=null&&j.isParent),noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,initialized:!!h.width&&!!h.height,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,ariaLabel:h.ariaLabel,hasHandleBounds:!!((E=h[xt])!=null&&E.handleBounds)})}))};d2.displayName="NodeRenderer";var FA=M.memo(d2);const zA=(t,e,n)=>n===Oe.Left?t-e:n===Oe.Right?t+e:t,BA=(t,e,n)=>n===Oe.Top?t-e:n===Oe.Bottom?t+e:t,u2="react-flow__edgeupdater",h2=({position:t,centerX:e,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:s,onMouseOut:a,type:i})=>q.createElement("circle",{onMouseDown:r,onMouseEnter:s,onMouseOut:a,className:Kt([u2,`${u2}-${i}`]),cx:zA(e,o,t),cy:BA(n,o,t),r:o,stroke:"transparent",fill:"transparent"}),UA=()=>!0;var es=t=>{const e=({id:n,className:o,type:r,data:s,onClick:a,onEdgeDoubleClick:i,selected:l,animated:d,label:u,labelStyle:h,labelShowBg:f,labelBgStyle:m,labelBgPadding:x,labelBgBorderRadius:g,style:p,source:b,target:y,sourceX:v,sourceY:w,targetX:S,targetY:N,sourcePosition:j,targetPosition:E,elementsSelectable:_,hidden:A,sourceHandleId:I,targetHandleId:P,onContextMenu:L,onMouseEnter:O,onMouseMove:R,onMouseLeave:F,reconnectRadius:D,onReconnect:T,onReconnectStart:k,onReconnectEnd:B,markerEnd:C,markerStart:U,rfId:V,ariaLabel:$,isFocusable:X,isReconnectable:Y,pathOptions:J,interactionWidth:Q,disableKeyboardA11y:W})=>{const K=M.useRef(null),[oe,re]=M.useState(!1),[ne,ae]=M.useState(!1),te=Lt(),me=M.useMemo(()=>`url('#${Mh(U,V)}')`,[U,V]),ce=M.useMemo(()=>`url('#${Mh(C,V)}')`,[C,V]);if(A)return null;const se=xa(n,te.getState,i),be=xa(n,te.getState,L),ue=xa(n,te.getState,O),Se=xa(n,te.getState,R),Me=xa(n,te.getState,F),Ee=(Ve,Ge)=>{if(Ve.button!==0)return;const{edges:ee,isValidConnection:ye}=te.getState(),we=Ge?y:b,Te=(Ge?P:I)||null,G=Ge?"target":"source",he=ye||UA,xe=Ge,de=ee.find(ke=>ke.id===n);ae(!0),k==null||k(Ve,de,G),Dv({event:Ve,handleId:Te,nodeId:we,onConnect:ke=>T==null?void 0:T(de,ke),isTarget:xe,getState:te.getState,setState:te.setState,isValidConnection:he,edgeUpdaterType:G,onReconnectEnd:ke=>{ae(!1),B==null||B(ke,de,G)}})},Re=()=>re(!0),Ae=()=>re(!1),Ye=!_&&!a;return q.createElement("g",{className:Kt(["react-flow__edge",`react-flow__edge-${r}`,o,{selected:l,animated:d,inactive:Ye,updating:oe}]),onClick:Ve=>{var G;const{edges:Ge,addSelectedEdges:ee,unselectNodesAndEdges:ye,multiSelectionActive:we}=te.getState(),Te=Ge.find(he=>he.id===n);Te&&(_&&(te.setState({nodesSelectionActive:!1}),Te.selected&&we?(ye({nodes:[],edges:[Te]}),(G=K.current)==null||G.blur()):ee([n])),a&&a(Ve,Te))},onDoubleClick:se,onContextMenu:be,onMouseEnter:ue,onMouseMove:Se,onMouseLeave:Me,onKeyDown:X?Ve=>{var Ge;if(!W&&mv.includes(Ve.key)&&_){const{unselectNodesAndEdges:ee,addSelectedEdges:ye,edges:we}=te.getState();Ve.key==="Escape"?((Ge=K.current)==null||Ge.blur(),ee({edges:[we.find(Te=>Te.id===n)]})):ye([n])}}:void 0,tabIndex:X?0:void 0,role:X?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":$===null?void 0:$||`Edge from ${b} to ${y}`,"aria-describedby":X?`${Wv}-${V}`:void 0,ref:K},!ne&&q.createElement(t,{id:n,source:b,target:y,selected:l,animated:d,label:u,labelStyle:h,labelShowBg:f,labelBgStyle:m,labelBgPadding:x,labelBgBorderRadius:g,data:s,style:p,sourceX:v,sourceY:w,targetX:S,targetY:N,sourcePosition:j,targetPosition:E,sourceHandleId:I,targetHandleId:P,markerStart:me,markerEnd:ce,pathOptions:J,interactionWidth:Q}),Y&&q.createElement(q.Fragment,null,(Y==="source"||Y===!0)&&q.createElement(h2,{position:j,centerX:v,centerY:w,radius:D,onMouseDown:Ve=>Ee(Ve,!0),onMouseEnter:Re,onMouseOut:Ae,type:"source"}),(Y==="target"||Y===!0)&&q.createElement(h2,{position:E,centerX:S,centerY:N,radius:D,onMouseDown:Ve=>Ee(Ve,!1),onMouseEnter:Re,onMouseOut:Ae,type:"target"})))};return e.displayName="EdgeWrapper",M.memo(e)};function $A(t){return{default:es(t.default||Pl),straight:es(t.bezier||Ah),step:es(t.step||Ih),smoothstep:es(t.step||Ol),simplebezier:es(t.simplebezier||Eh),...Object.keys(t).filter(e=>!["default","bezier"].includes(e)).reduce((e,n)=>(e[n]=es(t[n]||Pl),e),{})}}function f2(t,e,n=null){const o=((n==null?void 0:n.x)||0)+e.x,r=((n==null?void 0:n.y)||0)+e.y,s=(n==null?void 0:n.width)||e.width,a=(n==null?void 0:n.height)||e.height;switch(t){case Oe.Top:return{x:o+s/2,y:r};case Oe.Right:return{x:o+s,y:r+a/2};case Oe.Bottom:return{x:o+s/2,y:r+a};case Oe.Left:return{x:o,y:r+a/2}}}function m2(t,e){return t?t.length!==1&&e?e&&t.find(n=>n.id===e)||null:t[0]:null}function p2(t){var o,r,s,a,i;const e=((o=t==null?void 0:t[xt])==null?void 0:o.handleBounds)||null,n=e&&(t==null?void 0:t.width)&&(t==null?void 0:t.height)&&((r=t==null?void 0:t.positionAbsolute)==null?void 0:r.x)!==void 0&&((s=t==null?void 0:t.positionAbsolute)==null?void 0:s.y)!==void 0;return[{x:((a=t==null?void 0:t.positionAbsolute)==null?void 0:a.x)||0,y:((i=t==null?void 0:t.positionAbsolute)==null?void 0:i.y)||0,width:(t==null?void 0:t.width)||0,height:(t==null?void 0:t.height)||0},e,!!n]}const VA=[{level:0,isMaxLevel:!0,edges:[]}];function HA(t,e,n){return function(o,r,s=!1){let a=-1;const i=o.reduce((d,u)=>{var m,x;const h=kn(u.zIndex);let f=h?u.zIndex:0;if(s){const g=r.get(u.target),p=r.get(u.source),b=u.selected||(g==null?void 0:g.selected)||(p==null?void 0:p.selected),y=Math.max(((m=p==null?void 0:p[xt])==null?void 0:m.z)||0,((x=g==null?void 0:g[xt])==null?void 0:x.z)||0,1e3);f=(h?u.zIndex:0)+(b?y:0)}return d[f]?d[f].push(u):d[f]=[u],a=f>a?f:a,d},{}),l=Object.entries(i).map(([d,u])=>{const h=+d;return{edges:u,level:h,isMaxLevel:h===a}});return l.length===0?VA:l}(it(M.useCallback(o=>t?o.edges.filter(r=>{const s=e.get(r.source),a=e.get(r.target);return(s==null?void 0:s.width)&&(s==null?void 0:s.height)&&(a==null?void 0:a.width)&&(a==null?void 0:a.height)&&function({sourcePos:i,targetPos:l,sourceWidth:d,sourceHeight:u,targetWidth:h,targetHeight:f,width:m,height:x,transform:g}){const p={x:Math.min(i.x,l.x),y:Math.min(i.y,l.y),x2:Math.max(i.x+d,l.x+h),y2:Math.max(i.y+u,l.y+f)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const b=Sh({x:(0-g[0])/g[2],y:(0-g[1])/g[2],width:m/g[2],height:x/g[2]}),y=Math.max(0,Math.min(b.x2,p.x2)-Math.max(b.x,p.x)),v=Math.max(0,Math.min(b.y2,p.y2)-Math.max(b.y,p.y));return Math.ceil(y*v)>0}({sourcePos:s.positionAbsolute||{x:0,y:0},targetPos:a.positionAbsolute||{x:0,y:0},sourceWidth:s.width,sourceHeight:s.height,targetWidth:a.width,targetHeight:a.height,width:o.width,height:o.height,transform:o.transform})}):o.edges,[t,e])),e,n)}const g2={[Gr.Arrow]:({color:t="none",strokeWidth:e=1})=>q.createElement("polyline",{style:{stroke:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),[Gr.ArrowClosed]:({color:t="none",strokeWidth:e=1})=>q.createElement("polyline",{style:{stroke:t,fill:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},WA=({id:t,type:e,color:n,width:o=12.5,height:r=12.5,markerUnits:s="strokeWidth",strokeWidth:a,orient:i="auto-start-reverse"})=>{const l=function(d){const u=Lt();return M.useMemo(()=>{var h,f;return Object.prototype.hasOwnProperty.call(g2,d)?g2[d]:((f=(h=u.getState()).onError)==null||f.call(h,"009",J8(d)),null)},[d])}(e);return l?q.createElement("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${o}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:i,refX:"0",refY:"0"},q.createElement(l,{color:n,strokeWidth:a})):null},x2=({defaultColor:t,rfId:e})=>{const n=it(M.useCallback((({defaultColor:o,rfId:r})=>s=>{const a=[];return s.edges.reduce((i,l)=>([l.markerStart,l.markerEnd].forEach(d=>{if(d&&typeof d=="object"){const u=Mh(d,r);a.includes(u)||(i.push({id:u,color:d.color||o,...d}),a.push(u))}}),i),[]).sort((i,l)=>i.id.localeCompare(l.id))})({defaultColor:t,rfId:e}),[t,e]),(o,r)=>!(o.length!==r.length||o.some((s,a)=>s.id!==r[a].id)));return q.createElement("defs",null,n.map(o=>q.createElement(WA,{id:o.id,key:o.id,type:o.type,color:o.color,width:o.width,height:o.height,markerUnits:o.markerUnits,strokeWidth:o.strokeWidth,orient:o.orient})))};x2.displayName="MarkerDefinitions";var qA=M.memo(x2);const GA=t=>({nodesConnectable:t.nodesConnectable,edgesFocusable:t.edgesFocusable,edgesUpdatable:t.edgesUpdatable,elementsSelectable:t.elementsSelectable,width:t.width,height:t.height,connectionMode:t.connectionMode,nodeInternals:t.nodeInternals,onError:t.onError}),b2=({defaultMarkerColor:t,onlyRenderVisibleElements:e,elevateEdgesOnSelect:n,rfId:o,edgeTypes:r,noPanClassName:s,onEdgeContextMenu:a,onEdgeMouseEnter:i,onEdgeMouseMove:l,onEdgeMouseLeave:d,onEdgeClick:u,onEdgeDoubleClick:h,onReconnect:f,onReconnectStart:m,onReconnectEnd:x,reconnectRadius:g,children:p,disableKeyboardA11y:b})=>{const{edgesFocusable:y,edgesUpdatable:v,elementsSelectable:w,width:S,height:N,connectionMode:j,nodeInternals:E,onError:_}=it(GA,$t),A=HA(e,E,n);return S?q.createElement(q.Fragment,null,A.map(({level:I,edges:P,isMaxLevel:L})=>q.createElement("svg",{key:I,style:{zIndex:I},width:S,height:N,className:"react-flow__edges react-flow__container"},L&&q.createElement(qA,{defaultColor:t,rfId:o}),q.createElement("g",null,P.map(O=>{const[R,F,D]=p2(E.get(O.source)),[T,k,B]=p2(E.get(O.target));if(!D||!B)return null;let C=O.type||"default";r[C]||(_==null||_("011",eA(C)),C="default");const U=r[C]||r.default,V=j===lr.Strict?k.target:(k.target??[]).concat(k.source??[]),$=m2(F.source,O.sourceHandle),X=m2(V,O.targetHandle),Y=($==null?void 0:$.position)||Oe.Bottom,J=(X==null?void 0:X.position)||Oe.Top,Q=!!(O.focusable||y&&O.focusable===void 0),W=O.reconnectable||O.updatable,K=f!==void 0&&(W||v&&W===void 0);if(!$||!X)return _==null||_("008",Z8($,O)),null;const{sourceX:oe,sourceY:re,targetX:ne,targetY:ae}=((te,me,ce,se,be,ue)=>{const Se=f2(ce,te,me),Me=f2(ue,se,be);return{sourceX:Se.x,sourceY:Se.y,targetX:Me.x,targetY:Me.y}})(R,$,Y,T,X,J);return q.createElement(U,{key:O.id,id:O.id,className:Kt([O.className,s]),type:C,data:O.data,selected:!!O.selected,animated:!!O.animated,hidden:!!O.hidden,label:O.label,labelStyle:O.labelStyle,labelShowBg:O.labelShowBg,labelBgStyle:O.labelBgStyle,labelBgPadding:O.labelBgPadding,labelBgBorderRadius:O.labelBgBorderRadius,style:O.style,source:O.source,target:O.target,sourceHandleId:O.sourceHandle,targetHandleId:O.targetHandle,markerEnd:O.markerEnd,markerStart:O.markerStart,sourceX:oe,sourceY:re,targetX:ne,targetY:ae,sourcePosition:Y,targetPosition:J,elementsSelectable:w,onContextMenu:a,onMouseEnter:i,onMouseMove:l,onMouseLeave:d,onClick:u,onEdgeDoubleClick:h,onReconnect:f,onReconnectStart:m,onReconnectEnd:x,reconnectRadius:g,rfId:o,ariaLabel:O.ariaLabel,isFocusable:Q,isReconnectable:K,pathOptions:"pathOptions"in O?O.pathOptions:void 0,interactionWidth:O.interactionWidth,disableKeyboardA11y:b})})))),p):null};b2.displayName="EdgeRenderer";var YA=M.memo(b2);const KA=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function XA({children:t}){const e=it(KA);return q.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:e}},t)}const JA={[Oe.Left]:Oe.Right,[Oe.Right]:Oe.Left,[Oe.Top]:Oe.Bottom,[Oe.Bottom]:Oe.Top},y2=({nodeId:t,handleType:e,style:n,type:o=Lo.Bezier,CustomComponent:r,connectionStatus:s})=>{var N,j,E;const{fromNode:a,handleId:i,toX:l,toY:d,connectionMode:u}=it(M.useCallback(_=>({fromNode:_.nodeInternals.get(t),handleId:_.connectionHandleId,toX:(_.connectionPosition.x-_.transform[0])/_.transform[2],toY:(_.connectionPosition.y-_.transform[1])/_.transform[2],connectionMode:_.connectionMode}),[t]),$t),h=(N=a==null?void 0:a[xt])==null?void 0:N.handleBounds;let f=h==null?void 0:h[e];if(u===lr.Loose&&(f=f||(h==null?void 0:h[e==="source"?"target":"source"])),!a||!f)return null;const m=i?f.find(_=>_.id===i):f[0],x=m?m.x+m.width/2:(a.width??0)/2,g=m?m.y+m.height/2:a.height??0,p=(((j=a.positionAbsolute)==null?void 0:j.x)??0)+x,b=(((E=a.positionAbsolute)==null?void 0:E.y)??0)+g,y=m==null?void 0:m.position,v=y?JA[y]:null;if(!y||!v)return null;if(r)return q.createElement(r,{connectionLineType:o,connectionLineStyle:n,fromNode:a,fromHandle:m,fromX:p,fromY:b,toX:l,toY:d,fromPosition:y,toPosition:v,connectionStatus:s});let w="";const S={sourceX:p,sourceY:b,sourcePosition:y,targetX:l,targetY:d,targetPosition:v};return o===Lo.Bezier?[w]=Cv(S):o===Lo.Step?[w]=_h({...S,borderRadius:0}):o===Lo.SmoothStep?[w]=_h(S):o===Lo.SimpleBezier?[w]=kv(S):w=`M${p},${b} ${l},${d}`,q.createElement("path",{d:w,fill:"none",className:"react-flow__connection-path",style:n})};y2.displayName="ConnectionLine";const ZA=t=>({nodeId:t.connectionNodeId,handleType:t.connectionHandleType,nodesConnectable:t.nodesConnectable,connectionStatus:t.connectionStatus,width:t.width,height:t.height});function QA({containerStyle:t,style:e,type:n,component:o}){const{nodeId:r,handleType:s,nodesConnectable:a,width:i,height:l,connectionStatus:d}=it(ZA,$t);return r&&s&&i&&a?q.createElement("svg",{style:t,width:i,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container"},q.createElement("g",{className:Kt(["react-flow__connection",d])},q.createElement(y2,{nodeId:r,handleType:s,style:e,type:n,CustomComponent:o,connectionStatus:d}))):null}function v2(t,e){return M.useRef(null),Lt(),M.useMemo(()=>e(t),[t])}const w2=({nodeTypes:t,edgeTypes:e,onMove:n,onMoveStart:o,onMoveEnd:r,onInit:s,onNodeClick:a,onEdgeClick:i,onNodeDoubleClick:l,onEdgeDoubleClick:d,onNodeMouseEnter:u,onNodeMouseMove:h,onNodeMouseLeave:f,onNodeContextMenu:m,onSelectionContextMenu:x,onSelectionStart:g,onSelectionEnd:p,connectionLineType:b,connectionLineStyle:y,connectionLineComponent:v,connectionLineContainerStyle:w,selectionKeyCode:S,selectionOnDrag:N,selectionMode:j,multiSelectionKeyCode:E,panActivationKeyCode:_,zoomActivationKeyCode:A,deleteKeyCode:I,onlyRenderVisibleElements:P,elementsSelectable:L,selectNodesOnDrag:O,defaultViewport:R,translateExtent:F,minZoom:D,maxZoom:T,preventScrolling:k,defaultMarkerColor:B,zoomOnScroll:C,zoomOnPinch:U,panOnScroll:V,panOnScrollSpeed:$,panOnScrollMode:X,zoomOnDoubleClick:Y,panOnDrag:J,onPaneClick:Q,onPaneMouseEnter:W,onPaneMouseMove:K,onPaneMouseLeave:oe,onPaneScroll:re,onPaneContextMenu:ne,onEdgeContextMenu:ae,onEdgeMouseEnter:te,onEdgeMouseMove:me,onEdgeMouseLeave:ce,onReconnect:se,onReconnectStart:be,onReconnectEnd:ue,reconnectRadius:Se,noDragClassName:Me,noWheelClassName:Ee,noPanClassName:Re,elevateEdgesOnSelect:Ae,disableKeyboardA11y:Ye,nodeOrigin:Ve,nodeExtent:Ge,rfId:ee})=>{const ye=v2(t,RA),we=v2(e,$A);return function(Te){const G=wa(),he=M.useRef(!1);M.useEffect(()=>{!he.current&&G.viewportInitialized&&Te&&(setTimeout(()=>Te(G),1),he.current=!0)},[Te,G.viewportInitialized])}(s),q.createElement(PA,{onPaneClick:Q,onPaneMouseEnter:W,onPaneMouseMove:K,onPaneMouseLeave:oe,onPaneContextMenu:ne,onPaneScroll:re,deleteKeyCode:I,selectionKeyCode:S,selectionOnDrag:N,selectionMode:j,onSelectionStart:g,onSelectionEnd:p,multiSelectionKeyCode:E,panActivationKeyCode:_,zoomActivationKeyCode:A,elementsSelectable:L,onMove:n,onMoveStart:o,onMoveEnd:r,zoomOnScroll:C,zoomOnPinch:U,zoomOnDoubleClick:Y,panOnScroll:V,panOnScrollSpeed:$,panOnScrollMode:X,panOnDrag:J,defaultViewport:R,translateExtent:F,minZoom:D,maxZoom:T,onSelectionContextMenu:x,preventScrolling:k,noDragClassName:Me,noWheelClassName:Ee,noPanClassName:Re,disableKeyboardA11y:Ye},q.createElement(XA,null,q.createElement(YA,{edgeTypes:we,onEdgeClick:i,onEdgeDoubleClick:d,onlyRenderVisibleElements:P,onEdgeContextMenu:ae,onEdgeMouseEnter:te,onEdgeMouseMove:me,onEdgeMouseLeave:ce,onReconnect:se,onReconnectStart:be,onReconnectEnd:ue,reconnectRadius:Se,defaultMarkerColor:B,noPanClassName:Re,elevateEdgesOnSelect:!!Ae,disableKeyboardA11y:Ye,rfId:ee},q.createElement(QA,{style:y,type:b,component:v,containerStyle:w})),q.createElement("div",{className:"react-flow__edgelabel-renderer"}),q.createElement(FA,{nodeTypes:ye,onNodeClick:a,onNodeDoubleClick:l,onNodeMouseEnter:u,onNodeMouseMove:h,onNodeMouseLeave:f,onNodeContextMenu:m,selectNodesOnDrag:O,onlyRenderVisibleElements:P,noPanClassName:Re,noDragClassName:Me,disableKeyboardA11y:Ye,nodeOrigin:Ve,nodeExtent:Ge,rfId:ee})))};w2.displayName="GraphView";var eT=M.memo(w2);const Wh=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Bo={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:Wh,nodeExtent:Wh,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:lr.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:(t,e)=>{},isValidConnection:void 0},tT=()=>((t,e)=>t?sv(t,e):sv)((t,e)=>({...Bo,setNodes:n=>{const{nodeInternals:o,nodeOrigin:r,elevateNodesOnSelect:s}=e();t({nodeInternals:zh(n,o,r,s)})},getNodes:()=>Array.from(e().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:o={}}=e();t({edges:n.map(r=>({...o,...r}))})},setDefaultNodesAndEdges:(n,o)=>{const r=n!==void 0,s=o!==void 0,a=r?zh(n,new Map,e().nodeOrigin,e().elevateNodesOnSelect):new Map;t({nodeInternals:a,edges:s?o:[],hasDefaultNodes:r,hasDefaultEdges:s})},updateNodeDimensions:n=>{const{onNodesChange:o,nodeInternals:r,fitViewOnInit:s,fitViewOnInitDone:a,fitViewOnInitOptions:i,domNode:l,nodeOrigin:d}=e(),u=l==null?void 0:l.querySelector(".react-flow__viewport");if(!u)return;const h=window.getComputedStyle(u),{m22:f}=new window.DOMMatrixReadOnly(h.transform),m=n.reduce((g,p)=>{const b=r.get(p.id);if(b!=null&&b.hidden)r.set(b.id,{...b,[xt]:{...b[xt],handleBounds:void 0}});else if(b){const y=wh(p.nodeElement);!(!y.width||!y.height||b.width===y.width&&b.height===y.height&&!p.forceUpdate)&&(r.set(b.id,{...b,[xt]:{...b[xt],handleBounds:{source:a2(".source",p.nodeElement,f,d),target:a2(".target",p.nodeElement,f,d)}},...y}),g.push({id:b.id,type:"dimensions",dimensions:y}))}return g},[]);Kv(r,d);const x=a||s&&!a&&Xv(e,{initial:!0,...i});t({nodeInternals:new Map(r),fitViewOnInitDone:x}),(m==null?void 0:m.length)>0&&(o==null||o(m))},updateNodePositions:(n,o=!0,r=!1)=>{const{triggerNodeChanges:s}=e(),a=n.map(i=>{const l={id:i.id,type:"position",dragging:r};return o&&(l.positionAbsolute=i.positionAbsolute,l.position=i.position),l});s(a)},triggerNodeChanges:n=>{const{onNodesChange:o,nodeInternals:r,hasDefaultNodes:s,nodeOrigin:a,getNodes:i,elevateNodesOnSelect:l}=e();if(n!=null&&n.length){if(s){const d=zh(t2(n,i()),r,a,l);t({nodeInternals:d})}o==null||o(n)}},addSelectedNodes:n=>{const{multiSelectionActive:o,edges:r,getNodes:s}=e();let a,i=null;o?a=n.map(l=>zo(l,!0)):(a=Zr(s(),n),i=Zr(r,[])),Ll({changedNodes:a,changedEdges:i,get:e,set:t})},addSelectedEdges:n=>{const{multiSelectionActive:o,edges:r,getNodes:s}=e();let a,i=null;o?a=n.map(l=>zo(l,!0)):(a=Zr(r,n),i=Zr(s(),[])),Ll({changedNodes:i,changedEdges:a,get:e,set:t})},unselectNodesAndEdges:({nodes:n,edges:o}={})=>{const{edges:r,getNodes:s}=e(),a=o||r;Ll({changedNodes:(n||s()).map(i=>(i.selected=!1,zo(i.id,!1))),changedEdges:a.map(i=>zo(i.id,!1)),get:e,set:t})},setMinZoom:n=>{const{d3Zoom:o,maxZoom:r}=e();o==null||o.scaleExtent([n,r]),t({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:o,minZoom:r}=e();o==null||o.scaleExtent([r,n]),t({maxZoom:n})},setTranslateExtent:n=>{var o;(o=e().d3Zoom)==null||o.translateExtent(n),t({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:o}=e();Ll({changedNodes:o().filter(r=>r.selected).map(r=>zo(r.id,!1)),changedEdges:n.filter(r=>r.selected).map(r=>zo(r.id,!1)),get:e,set:t})},setNodeExtent:n=>{const{nodeInternals:o}=e();o.forEach(r=>{r.positionAbsolute=kh(r.position,n)}),t({nodeExtent:n,nodeInternals:new Map(o)})},panBy:n=>{const{transform:o,width:r,height:s,d3Zoom:a,d3Selection:i,translateExtent:l}=e();if(!a||!i||!n.x&&!n.y)return!1;const d=Jo.translate(o[0]+n.x,o[1]+n.y).scale(o[2]),u=[[0,0],[r,s]],h=a==null?void 0:a.constrain()(d,u,l);return a.transform(i,h),o[0]!==h.x||o[1]!==h.y||o[2]!==h.k},cancelConnection:()=>t({connectionNodeId:Bo.connectionNodeId,connectionHandleId:Bo.connectionHandleId,connectionHandleType:Bo.connectionHandleType,connectionStatus:Bo.connectionStatus,connectionStartHandle:Bo.connectionStartHandle,connectionEndHandle:Bo.connectionEndHandle}),reset:()=>t({...Bo})}),Object.is),qh=({children:t})=>{const e=M.useRef(null);return e.current||(e.current=tT()),q.createElement(G8,{value:e.current},t)};qh.displayName="ReactFlowProvider";const k2=({children:t})=>M.useContext(Il)?q.createElement(q.Fragment,null,t):q.createElement(qh,null,t);k2.displayName="ReactFlowWrapper";const nT={input:zv,default:Lh,output:Uv,group:Fh},oT={default:Pl,straight:Ah,step:Ih,smoothstep:Ol,simplebezier:Eh},rT=[0,0],sT=[15,15],aT={x:0,y:0,zoom:1},iT={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},Gh=M.forwardRef(({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:s=nT,edgeTypes:a=oT,onNodeClick:i,onEdgeClick:l,onInit:d,onMove:u,onMoveStart:h,onMoveEnd:f,onConnect:m,onConnectStart:x,onConnectEnd:g,onClickConnectStart:p,onClickConnectEnd:b,onNodeMouseEnter:y,onNodeMouseMove:v,onNodeMouseLeave:w,onNodeContextMenu:S,onNodeDoubleClick:N,onNodeDragStart:j,onNodeDrag:E,onNodeDragStop:_,onNodesDelete:A,onEdgesDelete:I,onSelectionChange:P,onSelectionDragStart:L,onSelectionDrag:O,onSelectionDragStop:R,onSelectionContextMenu:F,onSelectionStart:D,onSelectionEnd:T,connectionMode:k=lr.Strict,connectionLineType:B=Lo.Bezier,connectionLineStyle:C,connectionLineComponent:U,connectionLineContainerStyle:V,deleteKeyCode:$="Backspace",selectionKeyCode:X="Shift",selectionOnDrag:Y=!1,selectionMode:J=ba.Full,panActivationKeyCode:Q="Space",multiSelectionKeyCode:W=Tl()?"Meta":"Control",zoomActivationKeyCode:K=Tl()?"Meta":"Control",snapToGrid:oe=!1,snapGrid:re=sT,onlyRenderVisibleElements:ne=!1,selectNodesOnDrag:ae=!0,nodesDraggable:te,nodesConnectable:me,nodesFocusable:ce,nodeOrigin:se=rT,edgesFocusable:be,edgesUpdatable:ue,elementsSelectable:Se,defaultViewport:Me=aT,minZoom:Ee=.5,maxZoom:Re=2,translateExtent:Ae=Wh,preventScrolling:Ye=!0,nodeExtent:Ve,defaultMarkerColor:Ge="#b1b1b7",zoomOnScroll:ee=!0,zoomOnPinch:ye=!0,panOnScroll:we=!1,panOnScrollSpeed:Te=.5,panOnScrollMode:G=Ro.Free,zoomOnDoubleClick:he=!0,panOnDrag:xe=!0,onPaneClick:de,onPaneMouseEnter:ke,onPaneMouseMove:Pe,onPaneMouseLeave:Le,onPaneScroll:Ze,onPaneContextMenu:ie,children:_e,onEdgeContextMenu:Ie,onEdgeDoubleClick:Be,onEdgeMouseEnter:We,onEdgeMouseMove:De,onEdgeMouseLeave:$e,onEdgeUpdate:nt,onEdgeUpdateStart:Ke,onEdgeUpdateEnd:rt,onReconnect:zt,onReconnectStart:Vt,onReconnectEnd:mn,reconnectRadius:Xt=10,edgeUpdaterRadius:On=10,onNodesChange:ns,onEdgesChange:qn,noDragClassName:wo="nodrag",noWheelClassName:Nn="nowheel",noPanClassName:os="nopan",fitView:ja=!1,fitViewOptions:z7,connectOnClick:B7=!0,attributionPosition:U7,proOptions:$7,defaultEdgeOptions:V7,elevateNodesOnSelect:H7=!0,elevateEdgesOnSelect:W7=!1,disableKeyboardA11y:mk=!1,autoPanOnConnect:q7=!0,autoPanOnNodeDrag:G7=!0,connectionRadius:Y7=20,isValidConnection:K7,onError:X7,style:J7,id:pk,nodeDragThreshold:Z7,...Q7},e9)=>{const zf=pk||"1";return q.createElement("div",{...Q7,style:{...J7,...iT},ref:e9,className:Kt(["react-flow",r]),"data-testid":"rf__wrapper",id:pk},q.createElement(k2,null,q.createElement(eT,{onInit:d,onMove:u,onMoveStart:h,onMoveEnd:f,onNodeClick:i,onEdgeClick:l,onNodeMouseEnter:y,onNodeMouseMove:v,onNodeMouseLeave:w,onNodeContextMenu:S,onNodeDoubleClick:N,nodeTypes:s,edgeTypes:a,connectionLineType:B,connectionLineStyle:C,connectionLineComponent:U,connectionLineContainerStyle:V,selectionKeyCode:X,selectionOnDrag:Y,selectionMode:J,deleteKeyCode:$,multiSelectionKeyCode:W,panActivationKeyCode:Q,zoomActivationKeyCode:K,onlyRenderVisibleElements:ne,selectNodesOnDrag:ae,defaultViewport:Me,translateExtent:Ae,minZoom:Ee,maxZoom:Re,preventScrolling:Ye,zoomOnScroll:ee,zoomOnPinch:ye,zoomOnDoubleClick:he,panOnScroll:we,panOnScrollSpeed:Te,panOnScrollMode:G,panOnDrag:xe,onPaneClick:de,onPaneMouseEnter:ke,onPaneMouseMove:Pe,onPaneMouseLeave:Le,onPaneScroll:Ze,onPaneContextMenu:ie,onSelectionContextMenu:F,onSelectionStart:D,onSelectionEnd:T,onEdgeContextMenu:Ie,onEdgeDoubleClick:Be,onEdgeMouseEnter:We,onEdgeMouseMove:De,onEdgeMouseLeave:$e,onReconnect:zt??nt,onReconnectStart:Vt??Ke,onReconnectEnd:mn??rt,reconnectRadius:Xt??On,defaultMarkerColor:Ge,noDragClassName:wo,noWheelClassName:Nn,noPanClassName:os,elevateEdgesOnSelect:W7,rfId:zf,disableKeyboardA11y:mk,nodeOrigin:se,nodeExtent:Ve}),q.createElement(gA,{nodes:t,edges:e,defaultNodes:n,defaultEdges:o,onConnect:m,onConnectStart:x,onConnectEnd:g,onClickConnectStart:p,onClickConnectEnd:b,nodesDraggable:te,nodesConnectable:me,nodesFocusable:ce,edgesFocusable:be,edgesUpdatable:ue,elementsSelectable:Se,elevateNodesOnSelect:H7,minZoom:Ee,maxZoom:Re,nodeExtent:Ve,onNodesChange:ns,onEdgesChange:qn,snapToGrid:oe,snapGrid:re,connectionMode:k,translateExtent:Ae,connectOnClick:B7,defaultEdgeOptions:V7,fitView:ja,fitViewOptions:z7,onNodesDelete:A,onEdgesDelete:I,onNodeDragStart:j,onNodeDrag:E,onNodeDragStop:_,onSelectionDrag:O,onSelectionDragStart:L,onSelectionDragStop:R,noPanClassName:os,nodeOrigin:se,rfId:zf,autoPanOnConnect:q7,autoPanOnNodeDrag:G7,onError:X7,connectionRadius:Y7,isValidConnection:K7,nodeDragThreshold:Z7}),q.createElement(mA,{onSelectionChange:P}),_e,q.createElement(oA,{proOptions:$7,position:U7}),q.createElement(vA,{rfId:zf,disableKeyboardA11y:mk})))});function S2(t){return e=>{const[n,o]=M.useState(e),r=M.useCallback(s=>o(a=>t(s,a)),[]);return[n,o,r]}}Gh.displayName="ReactFlow";const N2=S2(t2),j2=S2(function(t,e){return e2(t,e)});function lT(){return q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},q.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function cT(){return q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},q.createElement("path",{d:"M0 0h32v4.2H0z"}))}function dT(){return q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},q.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function uT(){return q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},q.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function hT(){return q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},q.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const ts=({children:t,className:e,...n})=>q.createElement("button",{type:"button",className:Kt(["react-flow__controls-button",e]),...n},t);ts.displayName="ControlButton";const fT=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom}),C2=({style:t,showZoom:e=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:s,onZoomOut:a,onFitView:i,onInteractiveChange:l,className:d,children:u,position:h="bottom-left"})=>{const f=Lt(),[m,x]=M.useState(!1),{isInteractive:g,minZoomReached:p,maxZoomReached:b}=it(fT,$t),{zoomIn:y,zoomOut:v,fitView:w}=wa();return M.useEffect(()=>{x(!0)},[]),m?q.createElement(Al,{className:Kt(["react-flow__controls",d]),position:h,style:t,"data-testid":"rf__controls"},e&&q.createElement(q.Fragment,null,q.createElement(ts,{onClick:()=>{y(),s==null||s()},className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:b},q.createElement(lT,null)),q.createElement(ts,{onClick:()=>{v(),a==null||a()},className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:p},q.createElement(cT,null))),n&&q.createElement(ts,{className:"react-flow__controls-fitview",onClick:()=>{w(r),i==null||i()},title:"fit view","aria-label":"fit view"},q.createElement(dT,null)),o&&q.createElement(ts,{className:"react-flow__controls-interactive",onClick:()=>{f.setState({nodesDraggable:!g,nodesConnectable:!g,elementsSelectable:!g}),l==null||l(!g)},title:"toggle interactivity","aria-label":"toggle interactivity"},g?q.createElement(hT,null):q.createElement(uT,null)),u):null};C2.displayName="Controls";var Sn,mT=M.memo(C2);function pT({color:t,dimensions:e,lineWidth:n}){return q.createElement("path",{stroke:t,strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})}function gT({color:t,radius:e}){return q.createElement("circle",{cx:e,cy:e,r:e,fill:t})}(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(Sn||(Sn={}));const xT={[Sn.Dots]:"#91919a",[Sn.Lines]:"#eee",[Sn.Cross]:"#e2e2e2"},bT={[Sn.Dots]:1,[Sn.Lines]:1,[Sn.Cross]:6},yT=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function E2({id:t,variant:e=Sn.Dots,gap:n=20,size:o,lineWidth:r=1,offset:s=2,color:a,style:i,className:l}){const d=M.useRef(null),{transform:u,patternId:h}=it(yT,$t),f=a||xT[e],m=o||bT[e],x=e===Sn.Dots,g=e===Sn.Cross,p=Array.isArray(n)?n:[n,n],b=[p[0]*u[2]||1,p[1]*u[2]||1],y=m*u[2],v=g?[y,y]:b,w=x?[y/s,y/s]:[v[0]/s,v[1]/s];return q.createElement("svg",{className:Kt(["react-flow__background",l]),style:{...i,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:d,"data-testid":"rf__background"},q.createElement("pattern",{id:h+t,x:u[0]%b[0],y:u[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${w[0]},-${w[1]})`},x?q.createElement(gT,{color:f,radius:y/s}):q.createElement(pT,{dimensions:v,color:f,lineWidth:r})),q.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${h+t})`}))}E2.displayName="Background";var vT=M.memo(E2);function Yh(t){return Math.min(11*t+35,200)}const _2=q.createContext("LR"),I2=M.memo(t=>{const e=H.c(51),{data:n,selected:o}=t,r=Ne(n.atom),s=xr().inOrderIds.indexOf(r.id),a=o?"var(--gray-9)":"var(--gray-3)",i=it(wT),l=M.use(_2);let d,u,h,f,m;if(e[0]!==r.code||e[1]!==a||e[2]!==l||e[3]!==o){const I=r.code.split(`
145
145
  `).length,P=l==="LR"?Oe.Left:Oe.Top;let L;e[8]!==a?(L={background:a},e[8]=a,e[9]=L):L=e[9],e[10]!==P||e[11]!==L?(h=c.jsx(Fo,{type:"target",id:"inputs",position:P,style:L}),e[10]=P,e[11]=L,e[12]=h):h=e[12];const O=l==="LR"?Oe.Left:Oe.Top;let R;e[13]!==a?(R={background:a},e[13]=a,e[14]=R):R=e[14],e[15]!==O||e[16]!==R?(f=c.jsx(Fo,{type:"source",id:"inputs",position:O,style:R}),e[15]=O,e[16]=R,e[17]=f):f=e[17];const F=o&&"border-primary";e[18]!==F?(u=pe("flex flex-col bg-card border border-input/50 rounded-md mx-[2px] overflow-hidden",F),e[18]=F,e[19]=u):u=e[19],d=Yh(I),e[0]=r.code,e[1]=a,e[2]=l,e[3]=o,e[4]=d,e[5]=u,e[6]=h,e[7]=f}else d=e[4],u=e[5],h=e[6],f=e[7];var x;let g;e[20]!==n.forceWidth||e[21]!==i?(m=n.forceWidth||(x=i,Math.min(Math.max(x-100,100),400)),e[20]=n.forceWidth,e[21]=i,e[22]=m):m=e[22],e[23]!==d||e[24]!==m?(g={height:d,width:m},e[23]=d,e[24]=m,e[25]=g):g=e[25];const p=KP(r.name,s);let b,y,v;e[26]!==p?(b=c.jsx("div",{className:"text-muted-foreground font-semibold text-xs py-1 px-2 bg-muted border-b",children:p}),e[26]=p,e[27]=b):b=e[27],e[28]!==r.code?(y=c.jsx(OL,{code:r.code}),e[28]=r.code,e[29]=y):y=e[29],e[30]!==u||e[31]!==g||e[32]!==b||e[33]!==y?(v=c.jsxs("div",{className:u,style:g,children:[b,y]}),e[30]=u,e[31]=g,e[32]=b,e[33]=y,e[34]=v):v=e[34];const w=l==="LR"?Oe.Right:Oe.Bottom;let S,N;e[35]!==a?(S={background:a},e[35]=a,e[36]=S):S=e[36],e[37]!==w||e[38]!==S?(N=c.jsx(Fo,{type:"source",id:"outputs",position:w,style:S}),e[37]=w,e[38]=S,e[39]=N):N=e[39];const j=l==="LR"?Oe.Right:Oe.Bottom;let E,_,A;return e[40]!==a?(E={background:a},e[40]=a,e[41]=E):E=e[41],e[42]!==j||e[43]!==E?(_=c.jsx(Fo,{type:"target",id:"outputs",position:j,style:E}),e[42]=j,e[43]=E,e[44]=_):_=e[44],e[45]!==v||e[46]!==N||e[47]!==_||e[48]!==h||e[49]!==f?(A=c.jsxs("div",{children:[h,f,v,N,_]}),e[45]=v,e[46]=N,e[47]=_,e[48]=h,e[49]=f,e[50]=A):A=e[50],A},(t,e)=>["data","selected","id"].every(n=>t[n]===e[n]));I2.displayName="CustomNode";const A2={custom:I2};function wT(t){const{width:e}=t;return e}const T2=t=>{const e=H.c(18),{maxCount:n,cellIds:o,onClick:r,skipScroll:s}=t,a=xr();let i,l,d,u;if(e[0]!==o||e[1]!==a||e[2]!==n||e[3]!==r||e[4]!==s){d=Symbol.for("react.early_return_sentinel");e:{let h;e[8]!==a?(h=(x,g)=>a.inOrderIds.indexOf(x)-a.inOrderIds.indexOf(g),e[8]=a,e[9]=h):h=e[9];const f=[...o].sort(h);if(o.length===0){let x;e[10]===Symbol.for("react.memo_cache_sentinel")?(x=c.jsx("div",{className:"text-muted-foreground",children:"--"}),e[10]=x):x=e[10],d=x;break e}let m;e[11]!==o.length||e[12]!==r||e[13]!==s?(m=(x,g)=>c.jsxs("span",{className:"truncate",children:[c.jsx(_o,{variant:"focus",cellId:x,skipScroll:s,className:"whitespace-nowrap",onClick:r?()=>r(x):void 0},x),g<o.length-1&&", "]},x),e[11]=o.length,e[12]=r,e[13]=s,e[14]=m):m=e[14],i=f.slice(0,n).map(m),l=o.length>n&&c.jsxs(pr,{children:[c.jsx(bs,{asChild:!0,children:c.jsxs("span",{className:"whitespace-nowrap text-muted-foreground text-xs hover:underline cursor-pointer",children:["+",o.length-n," more"]})}),c.jsx(hs,{className:"w-auto",children:c.jsx("div",{className:"flex flex-col gap-1 py-1",children:f.slice(n).map(x=>c.jsx(_o,{variant:"focus",cellId:x,className:"whitespace-nowrap",onClick:r?()=>r(x):void 0},x))})})]})}e[0]=o,e[1]=a,e[2]=n,e[3]=r,e[4]=s,e[5]=i,e[6]=l,e[7]=d}else i=e[5],l=e[6],d=e[7];return d!==Symbol.for("react.early_return_sentinel")?d:(e[15]!==i||e[16]!==l?(u=c.jsxs(c.Fragment,{children:[i,l]}),e[15]=i,e[16]=l,e[17]=u):u=e[17],u)},Kh=t=>{const e=H.c(15);let n,o,r,s;e[0]!==t?({name:o,declaredBy:n,onClick:r,...s}=t,e[0]=t,e[1]=n,e[2]=o,e[3]=r,e[4]=s):(n=e[1],o=e[2],r=e[3],s=e[4]);const a=n.length>1?"destructive":"outline";let i,l,d;return e[5]!==o||e[6]!==r?(i=async u=>{r?r(u):(await nn(o),Xe({title:"Copied to clipboard"}))},e[5]=o,e[6]=r,e[7]=i):i=e[7],e[8]!==o||e[9]!==a||e[10]!==i?(l=c.jsx(eS,{title:o,variant:a,className:"rounded-sm text-ellipsis block overflow-hidden max-w-fit cursor-pointer font-medium",onClick:i,children:o}),e[8]=o,e[9]=a,e[10]=i,e[11]=l):l=e[11],e[12]!==s||e[13]!==l?(d=c.jsx("div",{className:"max-w-[130px]",...s,children:l}),e[12]=s,e[13]=l,e[14]=d):d=e[14],d},Xh=M.memo(t=>{const e=H.c(38),{onChange:n,view:o,settings:r,onSettingsChange:s}=t;let a;e[0]!==s||e[1]!==r?(a=(O,R)=>{s({...r,[O]:R})},e[0]=s,e[1]=r,e[2]=a):a=e[2];const i=a;let l,d,u,h,f,m;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(bs,{asChild:!0,children:c.jsx(ve,{variant:"text",size:"xs",children:c.jsx(rm,{className:"w-4 h-4"})})}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx("div",{className:"font-semibold pb-4",children:"Settings"}),e[4]=d):d=e[4],e[5]!==i?(u=O=>i("hidePureMarkdown",!!O),e[5]=i,e[6]=u):u=e[6],e[7]!==r.hidePureMarkdown||e[8]!==u?(h=c.jsx(_3,{"data-testid":"hide-pure-markdown-checkbox",id:"hide-pure-markdown",checked:r.hidePureMarkdown,onCheckedChange:u}),e[7]=r.hidePureMarkdown,e[8]=u,e[9]=h):h=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(f=c.jsx(hr,{htmlFor:"hide-pure-markdown",children:"Hide pure markdown"}),e[10]=f):f=e[10],e[11]!==h?(m=c.jsxs(pr,{children:[l,c.jsxs(hs,{className:"w-auto p-2 text-muted-foreground",children:[d,c.jsxs("div",{className:"flex items-center gap-2",children:[h,f]})]})]}),e[11]=h,e[12]=m):m=e[12];const x=m,g=o==="_minimap_";let p,b,y;e[13]!==n?(p=()=>n("_minimap_"),e[13]=n,e[14]=p):p=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(Ep,{className:"w-4 h-4 mr-1"}),e[15]=b):b=e[15],e[16]!==g||e[17]!==p?(y=c.jsxs(ve,{variant:"outline",className:"bg-background","aria-selected":g,size:"xs",onClick:p,children:[b,"Mini Map"]}),e[16]=g,e[17]=p,e[18]=y):y=e[18];const v=o==="TB";let w,S,N;e[19]!==n?(w=()=>n("TB"),e[19]=n,e[20]=w):w=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(S=c.jsx(hi,{className:"w-4 h-4 mr-1"}),e[21]=S):S=e[21],e[22]!==v||e[23]!==w?(N=c.jsxs(ve,{variant:"outline",className:"bg-background","aria-selected":v,size:"xs",onClick:w,children:[S,"Vertical Tree"]}),e[22]=v,e[23]=w,e[24]=N):N=e[24];const j=o==="LR";let E,_,A,I;e[25]!==n?(E=()=>n("LR"),e[25]=n,e[26]=E):E=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(_=c.jsx(hi,{className:"w-4 h-4 mr-1 transform -rotate-90"}),e[27]=_):_=e[27],e[28]!==j||e[29]!==E?(A=c.jsxs(ve,{variant:"outline",className:"bg-background","aria-selected":j,size:"xs",onClick:E,children:[_," ","Horizontal Tree"]}),e[28]=j,e[29]=E,e[30]=A):A=e[30],e[31]!==y||e[32]!==N||e[33]!==A?(I=c.jsxs("div",{className:"flex gap-2",children:[y,N,A]}),e[31]=y,e[32]=N,e[33]=A,e[34]=I):I=e[34];const P=o!=="_minimap_"&&x;let L;return e[35]!==I||e[36]!==P?(L=c.jsxs(Al,{position:"top-right",className:"flex flex-col items-end gap-2",children:[I,P]}),e[35]=I,e[36]=P,e[37]=L):L=e[37],L});Xh.displayName="GraphToolbar";const zl=M.memo(t=>{const e=H.c(11),{selection:n,variables:o,onClearSelection:r}=t;if(!n)return null;const s=kT;let a;e[0]!==r||e[1]!==n.id||e[2]!==n.source||e[3]!==n.target||e[4]!==n.type||e[5]!==o?(a=()=>{if(n.type==="node"){const u=Object.values(o).filter(m=>m.usedBy.includes(n.id)),h=Object.values(o).filter(m=>m.declaredBy.includes(n.id)),f=(m,x)=>c.jsxs(c.Fragment,{children:[m.length===0&&c.jsx("div",{className:"text-muted-foreground text-sm text-center",children:"--"}),c.jsx("div",{className:"grid grid-cols-5 gap-3 items-center text-sm py-1 flex-1 empty:hidden",children:m.map(g=>c.jsxs(q.Fragment,{children:[c.jsx(Kh,{declaredBy:g.declaredBy,name:g.name}),c.jsxs("div",{className:"truncate col-span-2",title:g.value??"",children:[g.value,c.jsxs("span",{className:"ml-1 truncate text-foreground/60 font-mono",children:["(",g.dataType,")"]})]}),c.jsx("div",{className:"truncate col-span-2 gap-1 items-center",children:c.jsx(T2,{skipScroll:!0,onClick:()=>s(x==="in"?g.declaredBy[0]:g.usedBy[0],g.name),maxCount:3,cellIds:g.usedBy})})]},g.name))})]});return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[c.jsx(Hl,{className:"w-5 h-5"}),c.jsx(_o,{cellId:n.id}),c.jsx("div",{className:"flex-1"}),c.jsx(ax,{cellId:n.id,children:c.jsx(ve,{variant:"ghost",size:"icon",children:c.jsx(Vc,{className:"w-4 h-4"})})}),c.jsx(ve,{variant:"text",size:"icon",onClick:()=>{r()},children:c.jsx(_n,{className:"w-4 h-4"})})]}),c.jsxs("div",{className:"text-sm flex flex-col py-3 pl-2 pr-4 flex-1 justify-center",children:[c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[c.jsx(Xm,{className:"w-4 h-4"}),"Outputs"]}),f(h,"out")]}),c.jsx("hr",{className:"border-divider my-3"}),c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[c.jsx(Zt,{className:"w-4 h-4"}),"Inputs"]}),f(u,"in")]})]})]})}if(n.type==="edge"){const u=Object.values(o).filter(h=>h.declaredBy.includes(n.source)&&h.usedBy.includes(n.target));return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[c.jsx(mi,{className:"w-4 h-4"}),c.jsx(_o,{cellId:n.source}),c.jsx(Fc,{className:"w-4 h-4"}),c.jsx(_o,{cellId:n.target})]}),c.jsx("div",{className:"grid grid-cols-4 gap-3 max-w-[350px] items-center text-sm p-3 flex-1",children:u.map(h=>c.jsxs(q.Fragment,{children:[c.jsx(Kh,{declaredBy:h.declaredBy,name:h.name,onClick:()=>{s(h.declaredBy[0],h.name)}}),c.jsx("div",{className:"truncate text-foreground/60 font-mono",children:h.dataType}),c.jsx("div",{className:"truncate col-span-2",title:h.value??"",children:h.value})]},h.name))})]})}},e[0]=r,e[1]=n.id,e[2]=n.source,e[3]=n.target,e[4]=n.type,e[5]=o,e[6]=a):a=e[6];const i=a;let l,d;return e[7]!==i?(l=i(),e[7]=i,e[8]=l):l=e[8],e[9]!==l?(d=c.jsx(Al,{position:"bottom-left",className:"max-h-[90%] flex flex-col w-[calc(100%-5rem)]",children:c.jsx("div",{className:"min-h-[100px] shadow-md rounded-md border max-w-[550px] border-primary/40 my-4 min-w-[240px] bg-[var(--slate-1)] text-muted-foreground/80 flex flex-col overflow-y-auto",children:l})}),e[9]=l,e[10]=d):d=e[10],d});function kT(t,e){const n=Aa(t);n&&Dm(n,e)}function M2(){const t=H.c(7),e=wa(),n=it(NT),o=it(ST);let r;t[0]!==e?(r=()=>{e.fitView({duration:100})},t[0]=e,t[1]=r):r=t[1];const s=XP(r,100);let a,i;t[2]!==s||t[3]!==o||t[4]!==n?(a=()=>{n&&o&&s()},i=[n,o,s],t[2]=s,t[3]=o,t[4]=n,t[5]=a,t[6]=i):(a=t[5],i=t[6]),M.useEffect(a,i)}function ST(t){const{height:e}=t;return e}function NT(t){const{width:e}=t;return e}zl.displayName="GraphSelectionPanel";const O2=new class{createEdge(t,e,n){return{type:"smoothstep",pathOptions:{offset:20,borderRadius:100},data:{direction:n},markerEnd:{type:Gr.Arrow},id:`${t}-${e}-${n}`,source:t,sourceHandle:n,targetHandle:n,target:e}}createNode(t,e,n){return{id:t,data:{atom:e},width:250,type:"custom",height:Yh(Qe.get(e).code.trim().split(`
146
146
  `).length),position:{x:0,y:n+20}}}createElements(t,e,n,o){let r=0;const s=[],a=[];for(const[l,d]of Mm.zip(t,e)){const u=this.createNode(l,d,r);s.push(u),r=u.position.y+(u.height||0)}const i=new Set;for(const l of Object.values(n)){const{declaredBy:d,usedBy:u}=l;for(const h of d)for(const f of u){const m=`${h}-${f}`;i.has(m)||(i.add(m),a.push(this.createEdge(h,f,"inputs"),this.createEdge(h,f,"outputs")))}}return{nodes:s,edges:a}}},jT=t=>{const e=H.c(37),{cellIds:n,variables:o,cellAtoms:r,children:s}=t;let a;e[0]!==r||e[1]!==n||e[2]!==o?(a=O2.createElements(n,r,o,!1),e[0]=r,e[1]=n,e[2]=o,e[3]=a):a=e[3];const{nodes:i,edges:l}=a;let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=[],e[4]=d):d=e[4];const[u,h]=j2(d),[f,m]=N2(i),[x,g]=M.useState(),[p,b]=M.useState(),y=M.useRef(!1);M2();const v=it(CT);let w;e[5]!==h||e[6]!==m?(w=k=>{m(k.nodes),h([])},e[5]=h,e[6]=m,e[7]=w):w=e[7];const S=Fe(w);let N,j,E,_;e[8]!==r||e[9]!==n||e[10]!==S||e[11]!==o?(N=()=>{y.current?S(O2.createElements(n,r,o,!1)):y.current=!0},j=[n,o,r,S],e[8]=r,e[9]=n,e[10]=S,e[11]=o,e[12]=N,e[13]=j):(N=e[12],j=e[13]),M.useEffect(N,j),e[14]!==l||e[15]!==x||e[16]!==h?(E=()=>{if(x){const k=l.filter(B=>{const{source:C,target:U,data:V}=B;return C===x&&V.direction==="outputs"||U===x&&V.direction==="inputs"});h(k)}},_=[x,h,l],e[14]=l,e[15]=x,e[16]=h,e[17]=E,e[18]=_):(E=e[17],_=e[18]),M.useEffect(E,_);const A=function(k,B){const C=H.c(17);let U,V;if(C[0]!==B||C[1]!==k){let K;C[3]!==B?(K=(oe,re)=>{const{position:ne}=re;return Math.min(oe,ne.y-B/2-10)},C[3]=B,C[4]=K):K=C[4],V=k.reduce(K,Number.POSITIVE_INFINITY),C[0]=B,C[1]=k,C[2]=V}else V=C[2];const $=V;let X;if(C[5]!==B||C[6]!==k){let K;C[8]!==B?(K=(oe,re)=>{const{position:ne}=re;return Math.max(oe,ne.y+B/2+10)},C[8]=B,C[9]=K):K=C[9],X=k.reduce(K,Number.NEGATIVE_INFINITY),C[5]=B,C[6]=k,C[7]=X}else X=C[7];const Y=X;let J,Q,W;return C[10]!==$?(J=[Number.NEGATIVE_INFINITY,$],C[10]=$,C[11]=J):J=C[11],C[12]!==Y?(Q=[Number.POSITIVE_INFINITY,Y],C[12]=Y,C[13]=Q):Q=C[13],C[14]!==J||C[15]!==Q?(W=[J,Q],C[14]=J,C[15]=Q,C[16]=W):W=C[16],U=W,U}(f,v);let I;e[19]===Symbol.for("react.memo_cache_sentinel")?(I=()=>{g(void 0),b(void 0)},e[19]=I):I=e[19];const P=I;let L;e[20]!==u||e[21]!==p||e[22]!==x||e[23]!==o?(L=()=>p?c.jsx(zl,{selection:{type:"edge",source:p.source,target:p.target},onClearSelection:P,variables:o,edges:u}):x?c.jsx(zl,{selection:{type:"node",id:x},variables:o,edges:u,onClearSelection:P}):null,e[20]=u,e[21]=p,e[22]=x,e[23]=o,e[24]=L):L=e[24];const O=L;let R,F,D,T;return e[25]!==h?(R=(k,B)=>{const C=B.id;g(C),b(void 0),h([])},e[25]=h,e[26]=R):R=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(F=(k,B)=>{b(B)},e[27]=F):F=e[27],e[28]!==O?(D=O(),e[28]=O,e[29]=D):D=e[29],e[30]!==s||e[31]!==u||e[32]!==f||e[33]!==R||e[34]!==D||e[35]!==A?(T=c.jsxs(Gh,{nodes:f,edges:u,nodeTypes:A2,translateExtent:A,onNodeClick:R,onNodeDoubleClick:ET,onEdgeClick:F,snapToGrid:!0,fitView:!0,elementsSelectable:!0,minZoom:1,maxZoom:1,draggable:!1,panOnScrollMode:Ro.Vertical,zoomOnDoubleClick:!1,nodesDraggable:!1,nodesConnectable:!1,nodesFocusable:!1,edgesFocusable:!1,selectNodesOnDrag:!1,panOnDrag:!1,preventScrolling:!1,zoomOnPinch:!1,panOnScroll:!0,autoPanOnNodeDrag:!1,autoPanOnConnect:!1,children:[D,s]}),e[30]=s,e[31]=u,e[32]=f,e[33]=R,e[34]=D,e[35]=A,e[36]=T):T=e[36],T};function CT(t){const{height:e}=t;return e}function ET(t,e){tS(e.id,"focus")}var Jh,D2,P2,R2,L2,F2,Zh,z2,Qh,B2,ef,U2,tf,$2,nf,V2,of,H2,rf,W2,sf,q2,af,G2,lf,Y2,cf,K2,df,X2,uf,J2,hf,Z2,Q2,ew,tw,nw,ow,rw,ff,sw,mf,aw,pf,iw,gf,lw,xf,cw,bf,dw,yf,uw,vf,hw,wf,fw,kf,mw,Sf,pw,Nf,gw,jf,xw,Cf,bw,yw,vw,ww,kw,Sw,Nw,Ef,jw,_f,Cw,Ew,_w,If,Iw,Af,Aw,Tf,Tw,Mf,Mw,Of,Ow,Dw,Pw,Rw,Lw;function Df(){if(D2)return Jh;D2=1;var t="\0";function e(s,a){s[a]?s[a]++:s[a]=1}function n(s,a){--s[a]||delete s[a]}function o(s,a,i,l){var d=""+a,u=""+i;if(!s&&d>u){var h=d;d=u,u=h}return d+""+u+""+(l===void 0?"\0":l)}function r(s,a){return o(s,a.v,a.w,a.name)}return Jh=class{constructor(s){Z(this,"_isDirected",!0);Z(this,"_isMultigraph",!1);Z(this,"_isCompound",!1);Z(this,"_label");Z(this,"_defaultNodeLabelFn",()=>{});Z(this,"_defaultEdgeLabelFn",()=>{});Z(this,"_nodes",{});Z(this,"_in",{});Z(this,"_preds",{});Z(this,"_out",{});Z(this,"_sucs",{});Z(this,"_edgeObjs",{});Z(this,"_edgeLabels",{});Z(this,"_nodeCount",0);Z(this,"_edgeCount",0);Z(this,"_parent");Z(this,"_children");s&&(this._isDirected=!Object.hasOwn(s,"directed")||s.directed,this._isMultigraph=!!Object.hasOwn(s,"multigraph")&&s.multigraph,this._isCompound=!!Object.hasOwn(s,"compound")&&s.compound),this._isCompound&&(this._parent={},this._children={},this._children[t]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(s){return this._label=s,this}graph(){return this._label}setDefaultNodeLabel(s){return this._defaultNodeLabelFn=s,typeof s!="function"&&(this._defaultNodeLabelFn=()=>s),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var s=this;return this.nodes().filter(a=>Object.keys(s._in[a]).length===0)}sinks(){var s=this;return this.nodes().filter(a=>Object.keys(s._out[a]).length===0)}setNodes(s,a){var i=arguments,l=this;return s.forEach(function(d){i.length>1?l.setNode(d,a):l.setNode(d)}),this}setNode(s,a){return Object.hasOwn(this._nodes,s)?(arguments.length>1&&(this._nodes[s]=a),this):(this._nodes[s]=arguments.length>1?a:this._defaultNodeLabelFn(s),this._isCompound&&(this._parent[s]=t,this._children[s]={},this._children[t][s]=!0),this._in[s]={},this._preds[s]={},this._out[s]={},this._sucs[s]={},++this._nodeCount,this)}node(s){return this._nodes[s]}hasNode(s){return Object.hasOwn(this._nodes,s)}removeNode(s){var a=this;if(Object.hasOwn(this._nodes,s)){var i=l=>a.removeEdge(a._edgeObjs[l]);delete this._nodes[s],this._isCompound&&(this._removeFromParentsChildList(s),delete this._parent[s],this.children(s).forEach(function(l){a.setParent(l)}),delete this._children[s]),Object.keys(this._in[s]).forEach(i),delete this._in[s],delete this._preds[s],Object.keys(this._out[s]).forEach(i),delete this._out[s],delete this._sucs[s],--this._nodeCount}return this}setParent(s,a){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(a===void 0)a=t;else{for(var i=a+="";i!==void 0;i=this.parent(i))if(i===s)throw new Error("Setting "+a+" as parent of "+s+" would create a cycle");this.setNode(a)}return this.setNode(s),this._removeFromParentsChildList(s),this._parent[s]=a,this._children[a][s]=!0,this}_removeFromParentsChildList(s){delete this._children[this._parent[s]][s]}parent(s){if(this._isCompound){var a=this._parent[s];if(a!==t)return a}}children(s=t){if(this._isCompound){var a=this._children[s];if(a)return Object.keys(a)}else{if(s===t)return this.nodes();if(this.hasNode(s))return[]}}predecessors(s){var a=this._preds[s];if(a)return Object.keys(a)}successors(s){var a=this._sucs[s];if(a)return Object.keys(a)}neighbors(s){var a=this.predecessors(s);if(a){const l=new Set(a);for(var i of this.successors(s))l.add(i);return Array.from(l.values())}}isLeaf(s){return(this.isDirected()?this.successors(s):this.neighbors(s)).length===0}filterNodes(s){var a=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});a.setGraph(this.graph());var i=this;Object.entries(this._nodes).forEach(function([u,h]){s(u)&&a.setNode(u,h)}),Object.values(this._edgeObjs).forEach(function(u){a.hasNode(u.v)&&a.hasNode(u.w)&&a.setEdge(u,i.edge(u))});var l={};function d(u){var h=i.parent(u);return h===void 0||a.hasNode(h)?(l[u]=h,h):h in l?l[h]:d(h)}return this._isCompound&&a.nodes().forEach(u=>a.setParent(u,d(u))),a}setDefaultEdgeLabel(s){return this._defaultEdgeLabelFn=s,typeof s!="function"&&(this._defaultEdgeLabelFn=()=>s),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(s,a){var i=this,l=arguments;return s.reduce(function(d,u){return l.length>1?i.setEdge(d,u,a):i.setEdge(d,u),u}),this}setEdge(){var s,a,i,l,d=!1,u=arguments[0];typeof u=="object"&&u!==null&&"v"in u?(s=u.v,a=u.w,i=u.name,arguments.length===2&&(l=arguments[1],d=!0)):(s=u,a=arguments[1],i=arguments[3],arguments.length>2&&(l=arguments[2],d=!0)),s=""+s,a=""+a,i!==void 0&&(i=""+i);var h=o(this._isDirected,s,a,i);if(Object.hasOwn(this._edgeLabels,h))return d&&(this._edgeLabels[h]=l),this;if(i!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(s),this.setNode(a),this._edgeLabels[h]=d?l:this._defaultEdgeLabelFn(s,a,i);var f=function(m,x,g,p){var b=""+x,y=""+g;if(!m&&b>y){var v=b;b=y,y=v}var w={v:b,w:y};return p&&(w.name=p),w}(this._isDirected,s,a,i);return s=f.v,a=f.w,Object.freeze(f),this._edgeObjs[h]=f,e(this._preds[a],s),e(this._sucs[s],a),this._in[a][h]=f,this._out[s][h]=f,this._edgeCount++,this}edge(s,a,i){var l=arguments.length===1?r(this._isDirected,arguments[0]):o(this._isDirected,s,a,i);return this._edgeLabels[l]}edgeAsObj(){const s=this.edge(...arguments);return typeof s!="object"?{label:s}:s}hasEdge(s,a,i){var l=arguments.length===1?r(this._isDirected,arguments[0]):o(this._isDirected,s,a,i);return Object.hasOwn(this._edgeLabels,l)}removeEdge(s,a,i){var l=arguments.length===1?r(this._isDirected,arguments[0]):o(this._isDirected,s,a,i),d=this._edgeObjs[l];return d&&(s=d.v,a=d.w,delete this._edgeLabels[l],delete this._edgeObjs[l],n(this._preds[a],s),n(this._sucs[s],a),delete this._in[a][l],delete this._out[s][l],this._edgeCount--),this}inEdges(s,a){var i=this._in[s];if(i){var l=Object.values(i);return a?l.filter(d=>d.v===a):l}}outEdges(s,a){var i=this._out[s];if(i){var l=Object.values(i);return a?l.filter(d=>d.w===a):l}}nodeEdges(s,a){var i=this.inEdges(s,a);if(i)return i.concat(this.outEdges(s,a))}},Jh}function _T(){return F2?L2:(F2=1,L2={Graph:Df(),version:R2?P2:(R2=1,P2="2.2.4")})}function IT(){if(z2)return Zh;z2=1;var t=Df();function e(o){return o.nodes().map(function(r){var s=o.node(r),a=o.parent(r),i={v:r};return s!==void 0&&(i.value=s),a!==void 0&&(i.parent=a),i})}function n(o){return o.edges().map(function(r){var s=o.edge(r),a={v:r.v,w:r.w};return r.name!==void 0&&(a.name=r.name),s!==void 0&&(a.value=s),a})}return Zh={write:function(o){var r={options:{directed:o.isDirected(),multigraph:o.isMultigraph(),compound:o.isCompound()},nodes:e(o),edges:n(o)};return o.graph()!==void 0&&(r.value=structuredClone(o.graph())),r},read:function(o){var r=new t(o.options).setGraph(o.value);return o.nodes.forEach(function(s){r.setNode(s.v,s.value),s.parent&&r.setParent(s.v,s.parent)}),o.edges.forEach(function(s){r.setEdge({v:s.v,w:s.w,name:s.name},s.value)}),r}},Zh}function AT(){return B2||(B2=1,Qh=function(t){var e,n={},o=[];function r(s){Object.hasOwn(n,s)||(n[s]=!0,e.push(s),t.successors(s).forEach(r),t.predecessors(s).forEach(r))}return t.nodes().forEach(function(s){e=[],r(s),e.length&&o.push(e)}),o}),Qh}function Fw(){return U2?ef:(U2=1,ef=class{constructor(){Z(this,"_arr",[]);Z(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(t){return t.key})}has(t){return Object.hasOwn(this._keyIndices,t)}priority(t){var e=this._keyIndices[t];if(e!==void 0)return this._arr[e].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(t,e){var n=this._keyIndices;if(t=String(t),!Object.hasOwn(n,t)){var o=this._arr,r=o.length;return n[t]=r,o.push({key:t,priority:e}),this._decrease(r),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key}decrease(t,e){var n=this._keyIndices[t];if(e>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[n].priority+" New: "+e);this._arr[n].priority=e,this._decrease(n)}_heapify(t){var e=this._arr,n=2*t,o=n+1,r=t;n<e.length&&(r=e[n].priority<e[r].priority?n:r,o<e.length&&(r=e[o].priority<e[r].priority?o:r),r!==t&&(this._swap(t,r),this._heapify(r)))}_decrease(t){for(var e,n=this._arr,o=n[t].priority;t!==0&&!(n[e=t>>1].priority<o);)this._swap(t,e),t=e}_swap(t,e){var n=this._arr,o=this._keyIndices,r=n[t],s=n[e];n[t]=s,n[e]=r,o[s.key]=t,o[r.key]=e}},ef)}function zw(){if($2)return tf;$2=1;var t=Fw();tf=function(n,o,r,s){return function(a,i,l,d){var u,h,f={},m=new t,x=function(g){var p=g.v!==u?g.v:g.w,b=f[p],y=l(g),v=h.distance+y;if(y<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+g+" Weight: "+y);v<b.distance&&(b.distance=v,b.predecessor=u,m.decrease(p,v))};for(a.nodes().forEach(function(g){var p=g===i?0:Number.POSITIVE_INFINITY;f[g]={distance:p},m.add(g,p)});m.size()>0&&(u=m.removeMin(),(h=f[u]).distance!==Number.POSITIVE_INFINITY);)d(u).forEach(x);return f}(n,String(o),r||e,s||function(a){return n.outEdges(a)})};var e=()=>1;return tf}function TT(){if(V2)return nf;V2=1;var t=zw();return nf=function(e,n,o){return e.nodes().reduce(function(r,s){return r[s]=t(e,s,n,o),r},{})},nf}function Bw(){return H2||(H2=1,of=function(t){var e=0,n=[],o={},r=[];function s(a){var i=o[a]={onStack:!0,lowlink:e,index:e++};if(n.push(a),t.successors(a).forEach(function(u){Object.hasOwn(o,u)?o[u].onStack&&(i.lowlink=Math.min(i.lowlink,o[u].index)):(s(u),i.lowlink=Math.min(i.lowlink,o[u].lowlink))}),i.lowlink===i.index){var l,d=[];do l=n.pop(),o[l].onStack=!1,d.push(l);while(a!==l);r.push(d)}}return t.nodes().forEach(function(a){Object.hasOwn(o,a)||s(a)}),r}),of}function MT(){if(W2)return rf;W2=1;var t=Bw();return rf=function(e){return t(e).filter(function(n){return n.length>1||n.length===1&&e.hasEdge(n[0],n[0])})},rf}function OT(){if(q2)return sf;q2=1,sf=function(e,n,o){return function(r,s,a){var i={},l=r.nodes();return l.forEach(function(d){i[d]={},i[d][d]={distance:0},l.forEach(function(u){d!==u&&(i[d][u]={distance:Number.POSITIVE_INFINITY})}),a(d).forEach(function(u){var h=u.v===d?u.w:u.v,f=s(u);i[d][h]={distance:f,predecessor:d}})}),l.forEach(function(d){var u=i[d];l.forEach(function(h){var f=i[h];l.forEach(function(m){var x=f[d],g=u[m],p=f[m],b=x.distance+g.distance;b<p.distance&&(p.distance=b,p.predecessor=g.predecessor)})})}),i}(e,n||t,o||function(r){return e.outEdges(r)})};var t=()=>1;return sf}function Uw(){if(G2)return af;function t(n){var o={},r={},s=[];if(n.sinks().forEach(function a(i){if(Object.hasOwn(r,i))throw new e;Object.hasOwn(o,i)||(r[i]=!0,o[i]=!0,n.predecessors(i).forEach(a),delete r[i],s.push(i))}),Object.keys(o).length!==n.nodeCount())throw new e;return s}G2=1;class e extends Error{constructor(){super(...arguments)}}return af=t,t.CycleException=e,af}function DT(){if(Y2)return lf;Y2=1;var t=Uw();return lf=function(e){try{t(e)}catch(n){if(n instanceof t.CycleException)return!1;throw n}return!0},lf}function $w(){if(K2)return cf;function t(o,r,s,a){for(var i=[[o,!1]];i.length>0;){var l=i.pop();l[1]?a.push(l[0]):Object.hasOwn(s,l[0])||(s[l[0]]=!0,i.push([l[0],!0]),n(r(l[0]),d=>i.push([d,!1])))}}function e(o,r,s,a){for(var i=[o];i.length>0;){var l=i.pop();Object.hasOwn(s,l)||(s[l]=!0,a.push(l),n(r(l),d=>i.push(d)))}}function n(o,r){for(var s=o.length;s--;)r(o[s],s,o);return o}return K2=1,cf=function(o,r,s){Array.isArray(r)||(r=[r]);var a=o.isDirected()?u=>o.successors(u):u=>o.neighbors(u),i=s==="post"?t:e,l=[],d={};return r.forEach(u=>{if(!o.hasNode(u))throw new Error("Graph does not have node: "+u);i(u,a,d,l)}),l},cf}function PT(){if(X2)return df;X2=1;var t=$w();return df=function(e,n){return t(e,n,"post")},df}function RT(){if(J2)return uf;J2=1;var t=$w();return uf=function(e,n){return t(e,n,"pre")},uf}function LT(){if(Z2)return hf;Z2=1;var t=Df(),e=Fw();return hf=function(n,o){var r,s=new t,a={},i=new e;function l(u){var h=u.v===r?u.w:u.v,f=i.priority(h);if(f!==void 0){var m=o(u);m<f&&(a[h]=r,i.decrease(h,m))}}if(n.nodeCount()===0)return s;n.nodes().forEach(function(u){i.add(u,Number.POSITIVE_INFINITY),s.setNode(u)}),i.decrease(n.nodes()[0],0);for(var d=!1;i.size()>0;){if(r=i.removeMin(),Object.hasOwn(a,r))s.setEdge(r,a[r]);else{if(d)throw new Error("Input graph is not connected: "+n);d=!0}n.nodeEdges(r).forEach(l)}return s},hf}function Mn(){if(nw)return tw;nw=1;var t=_T();return tw={Graph:t.Graph,json:IT(),alg:ew?Q2:(ew=1,Q2={components:AT(),dijkstra:zw(),dijkstraAll:TT(),findCycles:MT(),floydWarshall:OT(),isAcyclic:DT(),postorder:PT(),preorder:RT(),prim:LT(),tarjan:Bw(),topsort:Uw()}),version:t.version}}function FT(){if(sw)return ff;sw=1;let t=Mn().Graph,e=function(){if(rw)return ow;function s(i){i._prev._next=i._next,i._next._prev=i._prev,delete i._next,delete i._prev}function a(i,l){if(i!=="_next"&&i!=="_prev")return l}return rw=1,ow=class{constructor(){let i={};i._next=i._prev=i,this._sentinel=i}dequeue(){let i=this._sentinel,l=i._prev;if(l!==i)return s(l),l}enqueue(i){let l=this._sentinel;i._prev&&i._next&&s(i),i._next=l._next,l._next._prev=i,l._next=i,i._prev=l}toString(){let i=[],l=this._sentinel,d=l._prev;for(;d!==l;)i.push(JSON.stringify(d,a)),d=d._prev;return"["+i.join(", ")+"]"}}}();ff=function(s,a){if(s.nodeCount()<=1)return[];let i=function(l,d){let u=new t,h=0,f=0;l.nodes().forEach(g=>{u.setNode(g,{v:g,in:0,out:0})}),l.edges().forEach(g=>{let p=u.edge(g.v,g.w)||0,b=d(g),y=p+b;u.setEdge(g.v,g.w,y),f=Math.max(f,u.node(g.v).out+=b),h=Math.max(h,u.node(g.w).in+=b)});let m=function(g){const p=[];for(let b=0;b<g;b++)p.push(b);return p}(f+h+3).map(()=>new e),x=h+1;return u.nodes().forEach(g=>{r(m,x,u.node(g))}),{graph:u,buckets:m,zeroIdx:x}}(s,a||n);return function(l,d,u){let h,f=[],m=d[d.length-1],x=d[0];for(;l.nodeCount();){for(;h=x.dequeue();)o(l,d,u,h);for(;h=m.dequeue();)o(l,d,u,h);if(l.nodeCount()){for(let g=d.length-2;g>0;--g)if(h=d[g].dequeue(),h){f=f.concat(o(l,d,u,h,!0));break}}}return f}(i.graph,i.buckets,i.zeroIdx).flatMap(l=>s.outEdges(l.v,l.w))};let n=()=>1;function o(s,a,i,l,d){let u=d?[]:void 0;return s.inEdges(l.v).forEach(h=>{let f=s.edge(h),m=s.node(h.v);d&&u.push({v:h.v,w:h.w}),m.out-=f,r(a,i,m)}),s.outEdges(l.v).forEach(h=>{let f=s.edge(h),m=h.w,x=s.node(m);x.in-=f,r(a,i,x)}),s.removeNode(l.v),u}function r(s,a,i){i.out?i.in?s[i.out-i.in+a].enqueue(i):s[s.length-1].enqueue(i):s[0].enqueue(i)}return ff}function Et(){if(aw)return mf;aw=1;let t=Mn().Graph;function e(d,u,h,f){for(var m=f;d.hasNode(m);)m=a(f);return h.dummy=u,d.setNode(m,h),m}mf={addBorderNode:function(d,u,h,f){let m={width:0,height:0};return arguments.length>=4&&(m.rank=h,m.order=f),e(d,"border",m,u)},addDummyNode:e,applyWithChunking:o,asNonCompoundGraph:function(d){let u=new t({multigraph:d.isMultigraph()}).setGraph(d.graph());return d.nodes().forEach(h=>{d.children(h).length||u.setNode(h,d.node(h))}),d.edges().forEach(h=>{u.setEdge(h,d.edge(h))}),u},buildLayerMatrix:function(d){let u=i(r(d)+1).map(()=>[]);return d.nodes().forEach(h=>{let f=d.node(h),m=f.rank;m!==void 0&&(u[m][f.order]=h)}),u},intersectRect:function(d,u){let h,f,m=d.x,x=d.y,g=u.x-m,p=u.y-x,b=d.width/2,y=d.height/2;if(!g&&!p)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(p)*b>Math.abs(g)*y?(p<0&&(y=-y),h=y*g/p,f=y):(g<0&&(b=-b),h=b,f=b*p/g),{x:m+h,y:x+f}},mapValues:function(d,u){let h=u;return typeof u=="string"&&(h=f=>f[u]),Object.entries(d).reduce((f,[m,x])=>(f[m]=h(x,m),f),{})},maxRank:r,normalizeRanks:function(d){let u=d.nodes().map(f=>{let m=d.node(f).rank;return m===void 0?Number.MAX_VALUE:m}),h=o(Math.min,u);d.nodes().forEach(f=>{let m=d.node(f);Object.hasOwn(m,"rank")&&(m.rank-=h)})},notime:function(d,u){return u()},partition:function(d,u){let h={lhs:[],rhs:[]};return d.forEach(f=>{u(f)?h.lhs.push(f):h.rhs.push(f)}),h},pick:function(d,u){const h={};for(const f of u)d[f]!==void 0&&(h[f]=d[f]);return h},predecessorWeights:function(d){let u=d.nodes().map(h=>{let f={};return d.inEdges(h).forEach(m=>{f[m.v]=(f[m.v]||0)+d.edge(m).weight}),f});return l(d.nodes(),u)},range:i,removeEmptyRanks:function(d){let u=d.nodes().map(g=>d.node(g).rank),h=o(Math.min,u),f=[];d.nodes().forEach(g=>{let p=d.node(g).rank-h;f[p]||(f[p]=[]),f[p].push(g)});let m=0,x=d.graph().nodeRankFactor;Array.from(f).forEach((g,p)=>{g===void 0&&p%x!==0?--m:g!==void 0&&m&&g.forEach(b=>d.node(b).rank+=m)})},simplify:function(d){let u=new t().setGraph(d.graph());return d.nodes().forEach(h=>u.setNode(h,d.node(h))),d.edges().forEach(h=>{let f=u.edge(h.v,h.w)||{weight:0,minlen:1},m=d.edge(h);u.setEdge(h.v,h.w,{weight:f.weight+m.weight,minlen:Math.max(f.minlen,m.minlen)})}),u},successorWeights:function(d){let u=d.nodes().map(h=>{let f={};return d.outEdges(h).forEach(m=>{f[m.w]=(f[m.w]||0)+d.edge(m).weight}),f});return l(d.nodes(),u)},time:function(d,u){let h=Date.now();try{return u()}finally{console.log(d+" time: "+(Date.now()-h)+"ms")}},uniqueId:a,zipObject:l};const n=65535;function o(d,u){if(u.length>n){const h=function(f,m=n){const x=[];for(let g=0;g<f.length;g+=m){const p=f.slice(g,g+m);x.push(p)}return x}(u);return d.apply(null,h.map(f=>d.apply(null,f)))}return d.apply(null,u)}function r(d){const u=d.nodes().map(h=>{let f=d.node(h).rank;return f===void 0?Number.MIN_VALUE:f});return o(Math.max,u)}let s=0;function a(d){return d+""+ ++s}function i(d,u,h=1){u==null&&(u=d,d=0);let f=x=>x<u;h<0&&(f=x=>u<x);const m=[];for(let x=d;f(x);x+=h)m.push(x);return m}function l(d,u){return d.reduce((h,f,m)=>(h[f]=u[m],h),{})}return mf}function zT(){if(iw)return pf;iw=1;let t=FT(),e=Et().uniqueId;return pf={run:function(n){(n.graph().acyclicer==="greedy"?t(n,function(r){return s=>r.edge(s).weight}(n)):function(r){let s=[],a={},i={};function l(d){Object.hasOwn(i,d)||(i[d]=!0,a[d]=!0,r.outEdges(d).forEach(u=>{Object.hasOwn(a,u.w)?s.push(u):l(u.w)}),delete a[d])}return r.nodes().forEach(l),s}(n)).forEach(r=>{let s=n.edge(r);n.removeEdge(r),s.forwardName=r.name,s.reversed=!0,n.setEdge(r.w,r.v,s,e("rev"))})},undo:function(n){n.edges().forEach(o=>{let r=n.edge(o);if(r.reversed){n.removeEdge(o);let s=r.forwardName;delete r.reversed,delete r.forwardName,n.setEdge(o.w,o.v,r,s)}})}},pf}function BT(){if(lw)return gf;lw=1;let t=Et();return gf={run:function(e){e.graph().dummyChains=[],e.edges().forEach(n=>function(o,r){let s,a,i,l=r.v,d=o.node(l).rank,u=r.w,h=o.node(u).rank,f=r.name,m=o.edge(r),x=m.labelRank;if(h!==d+1){for(o.removeEdge(r),i=0,++d;d<h;++i,++d)m.points=[],a={width:0,height:0,edgeLabel:m,edgeObj:r,rank:d},s=t.addDummyNode(o,"edge",a,"_d"),d===x&&(a.width=m.width,a.height=m.height,a.dummy="edge-label",a.labelpos=m.labelpos),o.setEdge(l,s,{weight:m.weight},f),i===0&&o.graph().dummyChains.push(s),l=s;o.setEdge(l,u,{weight:m.weight},f)}}(e,n))},undo:function(e){e.graph().dummyChains.forEach(n=>{let o,r=e.node(n),s=r.edgeLabel;for(e.setEdge(r.edgeObj,s);r.dummy;)o=e.successors(n)[0],e.removeNode(n),s.points.push({x:r.x,y:r.y}),r.dummy==="edge-label"&&(s.x=r.x,s.y=r.y,s.width=r.width,s.height=r.height),n=o,r=e.node(n)})}},gf}function Bl(){if(cw)return xf;cw=1;const{applyWithChunking:t}=Et();return xf={longestPath:function(e){var n={};e.sources().forEach(function o(r){var s=e.node(r);if(Object.hasOwn(n,r))return s.rank;n[r]=!0;let a=e.outEdges(r).map(l=>l==null?Number.POSITIVE_INFINITY:o(l.w)-e.edge(l).minlen);var i=t(Math.min,a);return i===Number.POSITIVE_INFINITY&&(i=0),s.rank=i})},slack:function(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen}},xf}function Vw(){if(dw)return bf;dw=1;var t=Mn().Graph,e=Bl().slack;function n(s,a){return s.nodes().forEach(function i(l){a.nodeEdges(l).forEach(d=>{var u=d.v,h=l===u?d.w:u;s.hasNode(h)||e(a,d)||(s.setNode(h,{}),s.setEdge(l,h,{}),i(h))})}),s.nodeCount()}function o(s,a){return a.edges().reduce((i,l)=>{let d=Number.POSITIVE_INFINITY;return s.hasNode(l.v)!==s.hasNode(l.w)&&(d=e(a,l)),d<i[0]?[d,l]:i},[Number.POSITIVE_INFINITY,null])[1]}function r(s,a,i){s.nodes().forEach(l=>a.node(l).rank+=i)}return bf=function(s){var a,i,l=new t({directed:!1}),d=s.nodes()[0],u=s.nodeCount();for(l.setNode(d,{});n(l,s)<u;)a=o(l,s),i=l.hasNode(a.v)?e(s,a):-e(s,a),r(l,s,i);return l},bf}function UT(){if(uw)return yf;uw=1;var t=Vw(),e=Bl().slack,n=Bl().longestPath,o=Mn().alg.preorder,r=Mn().alg.postorder,s=Et().simplify;function a(g){g=s(g),n(g);var p,b=t(g);for(d(b),i(b,g);p=h(b);)m(b,g,p,f(b,g,p))}function i(g,p){var b=r(g,g.nodes());(b=b.slice(0,b.length-1)).forEach(y=>function(v,w,S){var N=v.node(S),j=N.parent;v.edge(S,j).cutvalue=l(v,w,S)}(g,p,y))}function l(g,p,b){var y=g.node(b).parent,v=!0,w=p.edge(b,y),S=0;return w||(v=!1,w=p.edge(y,b)),S=w.weight,p.nodeEdges(b).forEach(N=>{var j,E,_=N.v===b,A=_?N.w:N.v;if(A!==y){var I=_===v,P=p.edge(N).weight;if(S+=I?P:-P,j=b,E=A,g.hasEdge(j,E)){var L=g.edge(b,A).cutvalue;S+=I?-L:L}}}),S}function d(g,p){arguments.length<2&&(p=g.nodes()[0]),u(g,{},1,p)}function u(g,p,b,y,v){var w=b,S=g.node(y);return p[y]=!0,g.neighbors(y).forEach(N=>{Object.hasOwn(p,N)||(b=u(g,p,b,N,y))}),S.low=w,S.lim=b++,v?S.parent=v:delete S.parent,b}function h(g){return g.edges().find(p=>g.edge(p).cutvalue<0)}function f(g,p,b){var y=b.v,v=b.w;p.hasEdge(y,v)||(y=b.w,v=b.v);var w=g.node(y),S=g.node(v),N=w,j=!1;w.lim>S.lim&&(N=S,j=!0);var E=p.edges().filter(_=>j===x(g,g.node(_.v),N)&&j!==x(g,g.node(_.w),N));return E.reduce((_,A)=>e(p,A)<e(p,_)?A:_)}function m(g,p,b,y){var v=b.v,w=b.w;g.removeEdge(v,w),g.setEdge(y.v,y.w,{}),d(g),i(g,p),function(S,N){var j=S.nodes().find(_=>!N.node(_).parent),E=o(S,j);(E=E.slice(1)).forEach(_=>{var A=S.node(_).parent,I=N.edge(_,A),P=!1;I||(I=N.edge(A,_),P=!0),N.node(_).rank=N.node(A).rank+(P?I.minlen:-I.minlen)})}(g,p)}function x(g,p,b){return b.low<=p.lim&&p.lim<=b.lim}return yf=a,a.initLowLimValues=d,a.initCutValues=i,a.calcCutValue=l,a.leaveEdge=h,a.enterEdge=f,a.exchangeEdges=m,yf}function $T(){if(hw)return vf;hw=1;var t=Bl().longestPath,e=Vw(),n=UT();vf=function(s){var a=s.graph().ranker;if(a instanceof Function)return a(s);switch(s.graph().ranker){case"network-simplex":default:r(s);break;case"tight-tree":(function(i){t(i),e(i)})(s);break;case"longest-path":o(s);case"none":}};var o=t;function r(s){n(s)}return vf}function VT(){return fw||(fw=1,wf=function(t){let e=function(n){let o={},r=0;function s(a){let i=r;n.children(a).forEach(s),o[a]={low:i,lim:r++}}return n.children().forEach(s),o}(t);t.graph().dummyChains.forEach(n=>{let o=t.node(n),r=o.edgeObj,s=function(h,f,m,x){let g,p,b=[],y=[],v=Math.min(f[m].low,f[x].low),w=Math.max(f[m].lim,f[x].lim);g=m;do g=h.parent(g),b.push(g);while(g&&(f[g].low>v||w>f[g].lim));for(p=g,g=x;(g=h.parent(g))!==p;)y.push(g);return{path:b.concat(y.reverse()),lca:p}}(t,e,r.v,r.w),a=s.path,i=s.lca,l=0,d=a[l],u=!0;for(;n!==r.w;){if(o=t.node(n),u){for(;(d=a[l])!==i&&t.node(d).maxRank<o.rank;)l++;d===i&&(u=!1)}if(!u){for(;l<a.length-1&&t.node(d=a[l+1]).minRank<=o.rank;)l++;d=a[l]}t.setParent(n,d),n=t.successors(n)[0]}})}),wf}function HT(){if(mw)return kf;mw=1;let t=Et();function e(n,o,r,s,a,i,l){let d=n.children(l);if(!d.length)return void(l!==o&&n.setEdge(o,l,{weight:0,minlen:r}));let u=t.addBorderNode(n,"_bt"),h=t.addBorderNode(n,"_bb"),f=n.node(l);n.setParent(u,l),f.borderTop=u,n.setParent(h,l),f.borderBottom=h,d.forEach(m=>{e(n,o,r,s,a,i,m);let x=n.node(m),g=x.borderTop?x.borderTop:m,p=x.borderBottom?x.borderBottom:m,b=x.borderTop?s:2*s,y=g!==p?1:a-i[l]+1;n.setEdge(u,g,{weight:b,minlen:y,nestingEdge:!0}),n.setEdge(p,h,{weight:b,minlen:y,nestingEdge:!0})}),n.parent(l)||n.setEdge(o,u,{weight:0,minlen:a+i[l]})}return kf={run:function(n){let o=t.addDummyNode(n,"root",{},"_root"),r=function(d){var u={};function h(f,m){var x=d.children(f);x&&x.length&&x.forEach(g=>h(g,m+1)),u[f]=m}return d.children().forEach(f=>h(f,1)),u}(n),s=Object.values(r),a=t.applyWithChunking(Math.max,s)-1,i=2*a+1;n.graph().nestingRoot=o,n.edges().forEach(d=>n.edge(d).minlen*=i);let l=function(d){return d.edges().reduce((u,h)=>u+d.edge(h).weight,0)}(n)+1;n.children().forEach(d=>e(n,o,i,l,a,r,d)),n.graph().nodeRankFactor=i},cleanup:function(n){var o=n.graph();n.removeNode(o.nestingRoot),delete o.nestingRoot,n.edges().forEach(r=>{n.edge(r).nestingEdge&&n.removeEdge(r)})}},kf}function WT(){if(gw)return Nf;function t(r){r.nodes().forEach(s=>e(r.node(s))),r.edges().forEach(s=>e(r.edge(s)))}function e(r){let s=r.width;r.width=r.height,r.height=s}function n(r){r.y=-r.y}function o(r){let s=r.x;r.x=r.y,r.y=s}return gw=1,Nf={adjust:function(r){let s=r.graph().rankdir.toLowerCase();s!=="lr"&&s!=="rl"||t(r)},undo:function(r){let s=r.graph().rankdir.toLowerCase();s!=="bt"&&s!=="rl"||function(a){a.nodes().forEach(i=>n(a.node(i))),a.edges().forEach(i=>{let l=a.edge(i);l.points.forEach(n),Object.hasOwn(l,"y")&&n(l)})}(r),s!=="lr"&&s!=="rl"||(function(a){a.nodes().forEach(i=>o(a.node(i))),a.edges().forEach(i=>{let l=a.edge(i);l.points.forEach(o),Object.hasOwn(l,"x")&&o(l)})}(r),t(r))}},Nf}function qT(){if(kw)return ww;kw=1;let t=Et();return ww=function(e,n){let o={};return e.forEach((r,s)=>{let a=o[r.v]={indegree:0,in:[],out:[],vs:[r.v],i:s};r.barycenter!==void 0&&(a.barycenter=r.barycenter,a.weight=r.weight)}),n.edges().forEach(r=>{let s=o[r.v],a=o[r.w];s!==void 0&&a!==void 0&&(a.indegree++,s.out.push(o[r.w]))}),function(r){let s=[];function a(l){return d=>{d.merged||(d.barycenter===void 0||l.barycenter===void 0||d.barycenter>=l.barycenter)&&function(u,h){let f=0,m=0;u.weight&&(f+=u.barycenter*u.weight,m+=u.weight),h.weight&&(f+=h.barycenter*h.weight,m+=h.weight),u.vs=h.vs.concat(u.vs),u.barycenter=f/m,u.weight=m,u.i=Math.min(h.i,u.i),h.merged=!0}(l,d)}}function i(l){return d=>{d.in.push(l),--d.indegree===0&&r.push(d)}}for(;r.length;){let l=r.pop();s.push(l),l.in.reverse().forEach(a(l)),l.out.forEach(i(l))}return s.filter(l=>!l.merged).map(l=>t.pick(l,["vs","i","barycenter","weight"]))}(Object.values(o).filter(r=>!r.indegree))}}function GT(){if(jw)return Ef;jw=1;let t=(vw||(vw=1,yw=function(o,r=[]){return r.map(s=>{let a=o.inEdges(s);if(a.length){let i=a.reduce((l,d)=>{let u=o.edge(d),h=o.node(d.v);return{sum:l.sum+u.weight*h.order,weight:l.weight+u.weight}},{sum:0,weight:0});return{v:s,barycenter:i.sum/i.weight,weight:i.weight}}return{v:s}})}),yw),e=qT(),n=function(){if(Nw)return Sw;Nw=1;let o=Et();function r(s,a,i){let l;for(;a.length&&(l=a[a.length-1]).i<=i;)a.pop(),s.push(l.vs),i++;return i}return Sw=function(s,a){let i=o.partition(s,p=>Object.hasOwn(p,"barycenter")),l=i.lhs,d=i.rhs.sort((p,b)=>b.i-p.i),u=[],h=0,f=0,m=0;var x;l.sort((x=!!a,(p,b)=>p.barycenter<b.barycenter?-1:p.barycenter>b.barycenter?1:x?b.i-p.i:p.i-b.i)),m=r(u,d,m),l.forEach(p=>{m+=p.vs.length,u.push(p.vs),h+=p.barycenter*p.weight,f+=p.weight,m=r(u,d,m)});let g={vs:u.flat(!0)};return f&&(g.barycenter=h/f,g.weight=f),g}}();return Ef=function o(r,s,a,i){let l=r.children(s),d=r.node(s),u=d?d.borderLeft:void 0,h=d?d.borderRight:void 0,f={};u&&(l=l.filter(p=>p!==u&&p!==h));let m=t(r,l);m.forEach(p=>{if(r.children(p.v).length){let v=o(r,p.v,a,i);f[p.v]=v,Object.hasOwn(v,"barycenter")&&(y=v,(b=p).barycenter!==void 0?(b.barycenter=(b.barycenter*b.weight+y.barycenter*y.weight)/(b.weight+y.weight),b.weight+=y.weight):(b.barycenter=y.barycenter,b.weight=y.weight))}var b,y});let x=e(m,a);(function(p,b){p.forEach(y=>{y.vs=y.vs.flatMap(v=>b[v]?b[v].vs:v)})})(x,f);let g=n(x,i);if(u&&(g.vs=[u,g.vs,h].flat(!0),r.predecessors(u).length)){let p=r.node(r.predecessors(u)[0]),b=r.node(r.predecessors(h)[0]);Object.hasOwn(g,"barycenter")||(g.barycenter=0,g.weight=0),g.barycenter=(g.barycenter*g.weight+p.order+b.order)/(g.weight+2),g.weight+=2}return g},Ef}function YT(){if(Cw)return _f;Cw=1;let t=Mn().Graph,e=Et();return _f=function(n,o,r){let s=function(i){for(var l;i.hasNode(l=e.uniqueId("_root")););return l}(n),a=new t({compound:!0}).setGraph({root:s}).setDefaultNodeLabel(i=>n.node(i));return n.nodes().forEach(i=>{let l=n.node(i),d=n.parent(i);(l.rank===o||l.minRank<=o&&o<=l.maxRank)&&(a.setNode(i),a.setParent(i,d||s),n[r](i).forEach(u=>{let h=u.v===i?u.w:u.v,f=a.edge(h,i),m=f!==void 0?f.weight:0;a.setEdge(h,i,{weight:n.edge(u).weight+m})}),Object.hasOwn(l,"minRank")&&a.setNode(i,{borderLeft:l.borderLeft[o],borderRight:l.borderRight[o]}))}),a},_f}function KT(){if(Iw)return If;Iw=1;let t=function(){if(xw)return jf;xw=1;let u=Et();return jf=function(h){let f={},m=h.nodes().filter(y=>!h.children(y).length),x=m.map(y=>h.node(y).rank),g=u.applyWithChunking(Math.max,x),p=u.range(g+1).map(()=>[]);function b(y){if(f[y])return;f[y]=!0;let v=h.node(y);p[v.rank].push(y),h.successors(y).forEach(b)}return m.sort((y,v)=>h.node(y).rank-h.node(v).rank).forEach(b),p},jf}(),e=function(){if(bw)return Cf;bw=1;let u=Et().zipObject;function h(f,m,x){let g=u(x,x.map((S,N)=>N)),p=m.flatMap(S=>f.outEdges(S).map(N=>({pos:g[N.w],weight:f.edge(N).weight})).sort((N,j)=>N.pos-j.pos)),b=1;for(;b<x.length;)b<<=1;let y=2*b-1;b-=1;let v=new Array(y).fill(0),w=0;return p.forEach(S=>{let N=S.pos+b;v[N]+=S.weight;let j=0;for(;N>0;)N%2&&(j+=v[N+1]),N=N-1>>1,v[N]+=S.weight;w+=S.weight*j}),w}return Cf=function(f,m){let x=0;for(let g=1;g<m.length;++g)x+=h(f,m[g-1],m[g]);return x},Cf}(),n=GT(),o=YT(),r=(_w||(_w=1,Ew=function(u,h,f){let m,x={};f.forEach(g=>{let p,b,y=u.parent(g);for(;y;){if(p=u.parent(y),p?(b=x[p],x[p]=y):(b=m,m=y),b&&b!==y)return void h.setEdge(b,y);y=p}})}),Ew),s=Mn().Graph,a=Et();function i(u,h,f){return h.map(function(m){return o(u,m,f)})}function l(u,h){let f=new s;u.forEach(function(m){let x=m.graph().root,g=n(m,x,f,h);g.vs.forEach((p,b)=>m.node(p).order=b),r(m,f,g.vs)})}function d(u,h){Object.values(h).forEach(f=>f.forEach((m,x)=>u.node(m).order=x))}return If=function u(h,f){if(f&&typeof f.customOrder=="function")return void f.customOrder(h,u);let m=a.maxRank(h),x=i(h,a.range(1,m+1),"inEdges"),g=i(h,a.range(m-1,-1,-1),"outEdges"),p=t(h);if(d(h,p),f&&f.disableOptimalOrderHeuristic)return;let b,y=Number.POSITIVE_INFINITY;for(let v=0,w=0;w<4;++v,++w){l(v%2?x:g,v%4>=2),p=a.buildLayerMatrix(h);let S=e(h,p);S<y&&(w=0,b=Object.assign({},p),y=S)}d(h,b)},If}function XT(){if(Aw)return Af;Aw=1;let t=Mn().Graph,e=Et();function n(h,f){let m={};return f.length&&f.reduce(function(x,g){let p=0,b=0,y=x.length,v=g[g.length-1];return g.forEach((w,S)=>{let N=function(E,_){if(E.node(_).dummy)return E.predecessors(_).find(A=>E.node(A).dummy)}(h,w),j=N?h.node(N).order:y;(N||w===v)&&(g.slice(b,S+1).forEach(E=>{h.predecessors(E).forEach(_=>{let A=h.node(_),I=A.order;!(I<p||j<I)||A.dummy&&h.node(E).dummy||r(m,_,E)})}),b=S+1,p=j)}),g}),m}function o(h,f){let m={};function x(g,p,b,y,v){let w;e.range(p,b).forEach(S=>{w=g[S],h.node(w).dummy&&h.predecessors(w).forEach(N=>{let j=h.node(N);j.dummy&&(j.order<y||j.order>v)&&r(m,N,w)})})}return f.length&&f.reduce(function(g,p){let b,y=-1,v=0;return p.forEach((w,S)=>{if(h.node(w).dummy==="border"){let N=h.predecessors(w);N.length&&(b=h.node(N[0]).order,x(p,v,S,y,b),v=S,y=b)}x(p,v,p.length,b,g.length)}),p}),m}function r(h,f,m){if(f>m){let g=f;f=m,m=g}let x=h[f];x||(h[f]=x={}),x[m]=!0}function s(h,f,m){if(f>m){let x=f;f=m,m=x}return!!h[f]&&Object.hasOwn(h[f],m)}function a(h,f,m,x){let g={},p={},b={};return f.forEach(y=>{y.forEach((v,w)=>{g[v]=v,p[v]=v,b[v]=w})}),f.forEach(y=>{let v=-1;y.forEach(w=>{let S=x(w);if(S.length){S=S.sort((j,E)=>b[j]-b[E]);let N=(S.length-1)/2;for(let j=Math.floor(N),E=Math.ceil(N);j<=E;++j){let _=S[j];p[w]===w&&v<b[_]&&!s(m,w,_)&&(p[_]=w,p[w]=g[w]=g[_],v=b[_])}}})}),{root:g,align:p}}function i(h,f,m,x,g){let p={},b=function(w,S,N,j){let E=new t,_=w.graph(),A=function(I,P,L){return(O,R,F)=>{let D,T=O.node(R),k=O.node(F),B=0;if(B+=T.width/2,Object.hasOwn(T,"labelpos"))switch(T.labelpos.toLowerCase()){case"l":D=-T.width/2;break;case"r":D=T.width/2}if(D&&(B+=L?D:-D),D=0,B+=(T.dummy?P:I)/2,B+=(k.dummy?P:I)/2,B+=k.width/2,Object.hasOwn(k,"labelpos"))switch(k.labelpos.toLowerCase()){case"l":D=k.width/2;break;case"r":D=-k.width/2}return D&&(B+=L?D:-D),D=0,B}}(_.nodesep,_.edgesep,j);return S.forEach(I=>{let P;I.forEach(L=>{let O=N[L];if(E.setNode(O),P){var R=N[P],F=E.edge(R,O);E.setEdge(R,O,Math.max(A(w,L,P),F||0))}P=L})}),E}(h,f,m,g),y=g?"borderLeft":"borderRight";function v(w,S){let N=b.nodes(),j=N.pop(),E={};for(;j;)E[j]?w(j):(E[j]=!0,N.push(j),N=N.concat(S(j))),j=N.pop()}return v(function(w){p[w]=b.inEdges(w).reduce((S,N)=>Math.max(S,p[N.v]+b.edge(N)),0)},b.predecessors.bind(b)),v(function(w){let S=b.outEdges(w).reduce((j,E)=>Math.min(j,p[E.w]-b.edge(E)),Number.POSITIVE_INFINITY),N=h.node(w);S!==Number.POSITIVE_INFINITY&&N.borderType!==y&&(p[w]=Math.max(p[w],S))},b.successors.bind(b)),Object.keys(x).forEach(w=>p[w]=p[m[w]]),p}function l(h,f){return Object.values(f).reduce((m,x)=>{let g=Number.NEGATIVE_INFINITY,p=Number.POSITIVE_INFINITY;Object.entries(x).forEach(([y,v])=>{let w=function(S,N){return S.node(N).width}(h,y)/2;g=Math.max(v+w,g),p=Math.min(v-w,p)});const b=g-p;return b<m[0]&&(m=[b,x]),m},[Number.POSITIVE_INFINITY,null])[1]}function d(h,f){let m=Object.values(f),x=e.applyWithChunking(Math.min,m),g=e.applyWithChunking(Math.max,m);["u","d"].forEach(p=>{["l","r"].forEach(b=>{let y=p+b,v=h[y];if(v===f)return;let w=Object.values(v),S=x-e.applyWithChunking(Math.min,w);b!=="l"&&(S=g-e.applyWithChunking(Math.max,w)),S&&(h[y]=e.mapValues(v,N=>N+S))})})}function u(h,f){return e.mapValues(h.ul,(m,x)=>{if(f)return h[f.toLowerCase()][x];{let g=Object.values(h).map(p=>p[x]).sort((p,b)=>p-b);return(g[1]+g[2])/2}})}return Af={positionX:function(h){let f,m=e.buildLayerMatrix(h),x=Object.assign(n(h,m),o(h,m)),g={};["u","d"].forEach(b=>{f=b==="u"?m:Object.values(m).reverse(),["l","r"].forEach(y=>{y==="r"&&(f=f.map(N=>Object.values(N).reverse()));let v=(b==="u"?h.predecessors:h.successors).bind(h),w=a(h,f,x,v),S=i(h,f,w.root,w.align,y==="r");y==="r"&&(S=e.mapValues(S,N=>-N)),g[b+y]=S})});let p=l(h,g);return d(g,p),u(g,h.graph().align)},findType1Conflicts:n,findType2Conflicts:o,addConflict:r,hasConflict:s,verticalAlignment:a,horizontalCompaction:i,alignCoordinates:d,findSmallestWidthAlignment:l,balance:u},Af}function JT(){if(Tw)return Tf;Tw=1;let t=Et(),e=XT().positionX;return Tf=function(n){n=t.asNonCompoundGraph(n),function(o){let r=t.buildLayerMatrix(o),s=o.graph().ranksep,a=0;r.forEach(i=>{const l=i.reduce((d,u)=>{const h=o.node(u).height;return d>h?d:h},0);i.forEach(d=>o.node(d).y=a+l/2),a+=l+s})}(n),Object.entries(e(n)).forEach(([o,r])=>n.node(o).x=r)},Tf}function ZT(){if(Mw)return Mf;Mw=1;let t=zT(),e=BT(),n=$T(),o=Et().normalizeRanks,r=VT(),s=Et().removeEmptyRanks,a=HT(),i=function(){if(pw)return Sf;pw=1;let j=Et();function E(_,A,I,P,L,O){let R={width:0,height:0,rank:O,borderType:A},F=L[A][O-1],D=j.addDummyNode(_,"border",R,I);L[A][O]=D,_.setParent(D,P),F&&_.setEdge(F,D,{weight:1})}return Sf=function(_){_.children().forEach(function A(I){let P=_.children(I),L=_.node(I);if(P.length&&P.forEach(A),Object.hasOwn(L,"minRank")){L.borderLeft=[],L.borderRight=[];for(let O=L.minRank,R=L.maxRank+1;O<R;++O)E(_,"borderLeft","_bl",I,L,O),E(_,"borderRight","_br",I,L,O)}})},Sf}(),l=WT(),d=KT(),u=JT(),h=Et(),f=Mn().Graph;Mf=function(j,E){let _=E&&E.debugTiming?h.time:h.notime;_("layout",()=>{let A=_(" buildLayoutGraph",()=>function(I){let P=new f({multigraph:!0,compound:!0}),L=N(I.graph());return P.setGraph(Object.assign({},x,S(L,m),h.pick(L,g))),I.nodes().forEach(O=>{const R=S(N(I.node(O)),p);Object.keys(b).forEach(F=>{R[F]===void 0&&(R[F]=b[F])}),P.setNode(O,R),P.setParent(O,I.parent(O))}),I.edges().forEach(O=>{let R=N(I.edge(O));P.setEdge(O,Object.assign({},v,S(R,y),h.pick(R,w)))}),P}(j));_(" runLayout",()=>function(I,P,L){P(" makeSpaceForEdgeLabels",()=>function(O){let R=O.graph();R.ranksep/=2,O.edges().forEach(F=>{let D=O.edge(F);D.minlen*=2,D.labelpos.toLowerCase()!=="c"&&(R.rankdir==="TB"||R.rankdir==="BT"?D.width+=D.labeloffset:D.height+=D.labeloffset)})}(I)),P(" removeSelfEdges",()=>function(O){O.edges().forEach(R=>{if(R.v===R.w){var F=O.node(R.v);F.selfEdges||(F.selfEdges=[]),F.selfEdges.push({e:R,label:O.edge(R)}),O.removeEdge(R)}})}(I)),P(" acyclic",()=>t.run(I)),P(" nestingGraph.run",()=>a.run(I)),P(" rank",()=>n(h.asNonCompoundGraph(I))),P(" injectEdgeLabelProxies",()=>function(O){O.edges().forEach(R=>{let F=O.edge(R);if(F.width&&F.height){let D=O.node(R.v),T={rank:(O.node(R.w).rank-D.rank)/2+D.rank,e:R};h.addDummyNode(O,"edge-proxy",T,"_ep")}})}(I)),P(" removeEmptyRanks",()=>s(I)),P(" nestingGraph.cleanup",()=>a.cleanup(I)),P(" normalizeRanks",()=>o(I)),P(" assignRankMinMax",()=>function(O){let R=0;O.nodes().forEach(F=>{let D=O.node(F);D.borderTop&&(D.minRank=O.node(D.borderTop).rank,D.maxRank=O.node(D.borderBottom).rank,R=Math.max(R,D.maxRank))}),O.graph().maxRank=R}(I)),P(" removeEdgeLabelProxies",()=>function(O){O.nodes().forEach(R=>{let F=O.node(R);F.dummy==="edge-proxy"&&(O.edge(F.e).labelRank=F.rank,O.removeNode(R))})}(I)),P(" normalize.run",()=>e.run(I)),P(" parentDummyChains",()=>r(I)),P(" addBorderSegments",()=>i(I)),P(" order",()=>d(I,L)),P(" insertSelfEdges",()=>function(O){var R=h.buildLayerMatrix(O);R.forEach(F=>{var D=0;F.forEach((T,k)=>{var B=O.node(T);B.order=k+D,(B.selfEdges||[]).forEach(C=>{h.addDummyNode(O,"selfedge",{width:C.label.width,height:C.label.height,rank:B.rank,order:k+ ++D,e:C.e,label:C.label},"_se")}),delete B.selfEdges})})}(I)),P(" adjustCoordinateSystem",()=>l.adjust(I)),P(" position",()=>u(I)),P(" positionSelfEdges",()=>function(O){O.nodes().forEach(R=>{var F=O.node(R);if(F.dummy==="selfedge"){var D=O.node(F.e.v),T=D.x+D.width/2,k=D.y,B=F.x-T,C=D.height/2;O.setEdge(F.e,F.label),O.removeNode(R),F.label.points=[{x:T+2*B/3,y:k-C},{x:T+5*B/6,y:k-C},{x:T+B,y:k},{x:T+5*B/6,y:k+C},{x:T+2*B/3,y:k+C}],F.label.x=F.x,F.label.y=F.y}})}(I)),P(" removeBorderNodes",()=>function(O){O.nodes().forEach(R=>{if(O.children(R).length){let F=O.node(R),D=O.node(F.borderTop),T=O.node(F.borderBottom),k=O.node(F.borderLeft[F.borderLeft.length-1]),B=O.node(F.borderRight[F.borderRight.length-1]);F.width=Math.abs(B.x-k.x),F.height=Math.abs(T.y-D.y),F.x=k.x+F.width/2,F.y=D.y+F.height/2}}),O.nodes().forEach(R=>{O.node(R).dummy==="border"&&O.removeNode(R)})}(I)),P(" normalize.undo",()=>e.undo(I)),P(" fixupEdgeLabelCoords",()=>function(O){O.edges().forEach(R=>{let F=O.edge(R);if(Object.hasOwn(F,"x"))switch(F.labelpos!=="l"&&F.labelpos!=="r"||(F.width-=F.labeloffset),F.labelpos){case"l":F.x-=F.width/2+F.labeloffset;break;case"r":F.x+=F.width/2+F.labeloffset}})}(I)),P(" undoCoordinateSystem",()=>l.undo(I)),P(" translateGraph",()=>function(O){let R=Number.POSITIVE_INFINITY,F=0,D=Number.POSITIVE_INFINITY,T=0,k=O.graph(),B=k.marginx||0,C=k.marginy||0;function U(V){let $=V.x,X=V.y,Y=V.width,J=V.height;R=Math.min(R,$-Y/2),F=Math.max(F,$+Y/2),D=Math.min(D,X-J/2),T=Math.max(T,X+J/2)}O.nodes().forEach(V=>U(O.node(V))),O.edges().forEach(V=>{let $=O.edge(V);Object.hasOwn($,"x")&&U($)}),R-=B,D-=C,O.nodes().forEach(V=>{let $=O.node(V);$.x-=R,$.y-=D}),O.edges().forEach(V=>{let $=O.edge(V);$.points.forEach(X=>{X.x-=R,X.y-=D}),Object.hasOwn($,"x")&&($.x-=R),Object.hasOwn($,"y")&&($.y-=D)}),k.width=F-R+B,k.height=T-D+C}(I)),P(" assignNodeIntersects",()=>function(O){O.edges().forEach(R=>{let F,D,T=O.edge(R),k=O.node(R.v),B=O.node(R.w);T.points?(F=T.points[0],D=T.points[T.points.length-1]):(T.points=[],F=B,D=k),T.points.unshift(h.intersectRect(k,F)),T.points.push(h.intersectRect(B,D))})}(I)),P(" reversePoints",()=>function(O){O.edges().forEach(R=>{let F=O.edge(R);F.reversed&&F.points.reverse()})}(I)),P(" acyclic.undo",()=>t.undo(I))}(A,_,E)),_(" updateInputGraph",()=>function(I,P){I.nodes().forEach(L=>{let O=I.node(L),R=P.node(L);O&&(O.x=R.x,O.y=R.y,O.rank=R.rank,P.children(L).length&&(O.width=R.width,O.height=R.height))}),I.edges().forEach(L=>{let O=I.edge(L),R=P.edge(L);O.points=R.points,Object.hasOwn(R,"x")&&(O.x=R.x,O.y=R.y)}),I.graph().width=P.graph().width,I.graph().height=P.graph().height}(j,A))})};let m=["nodesep","edgesep","ranksep","marginx","marginy"],x={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},g=["acyclicer","ranker","rankdir","align"],p=["width","height","rank"],b={width:0,height:0},y=["minlen","weight","width","height","labeloffset"],v={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},w=["labelpos"];function S(j,E){return h.mapValues(h.pick(j,E),Number)}function N(j){var E={};return j&&Object.entries(j).forEach(([_,A])=>{typeof _=="string"&&(_=_.toLowerCase()),E[_]=A}),E}return Mf}function QT(){if(Ow)return Of;Ow=1;let t=Et(),e=Mn().Graph;return Of={debugOrdering:function(n){let o=t.buildLayerMatrix(n),r=new e({compound:!0,multigraph:!0}).setGraph({});return n.nodes().forEach(s=>{r.setNode(s,{label:s}),r.setParent(s,"layer"+n.node(s).rank)}),n.edges().forEach(s=>r.setEdge(s.v,s.w,{},s.name)),o.forEach((s,a)=>{let i="layer"+a;r.setNode(i,{rank:"same"}),s.reduce((l,d)=>(r.setEdge(l,d,{style:"invis"}),d))}),r}},Of}var Hw=Lw?Rw:(Lw=1,Rw={graphlib:Mn(),layout:ZT(),debug:QT(),util:{time:Et().time,notime:Et().notime},version:Pw?Dw:(Pw=1,Dw="1.1.5")});const Na=new Hw.graphlib.Graph().setDefaultEdgeLabel(()=>({})),Ww=({nodes:t,edges:e,direction:n})=>(Na.setGraph({rankdir:n,nodesep:150,ranksep:200,ranker:"longest-path"}),e.forEach(o=>Na.setEdge(o.source,o.target)),t.forEach(o=>Na.setNode(o.id,{...o,width:o.width??0,height:o.height??0})),Hw.layout(Na),{nodes:t.map(o=>{const{x:r,y:s}=Na.node(o.id);return{...o,position:{x:r,y:s}}}),edges:e}),qw=new class{createEdge(t,e){return{animated:!0,markerEnd:{type:Gr.ArrowClosed},id:`${t}-${e}`,style:{strokeWidth:2},source:t,sourceHandle:"outputs",targetHandle:"inputs",target:e}}createNode(t,e){return{id:t,data:{atom:e,forceWidth:300},width:300,type:"custom",height:Yh(Qe.get(e).code.trim().split(`
147
- `).length),position:{x:0,y:0}}}createElements(t,e,n,o){const r=[],s=[],a=new Set,i=new Set;for(const l of Object.values(n)){if(l.value==="marimo"&&l.name==="mo")continue;const{declaredBy:d,usedBy:u}=l;for(const h of d)for(const f of u){const m=`${h}-${f}`;i.has(m)||(i.add(m),a.add(h),a.add(f),s.push(this.createEdge(h,f)))}}for(const[l,d]of Mm.zip(t,e)){o||r.push(this.createNode(l,d));const u=a.has(l),h=Qe.get(d).code.trim().startsWith("mo.md");!u&&h||r.push(this.createNode(l,d))}return{nodes:r,edges:s}}},eM=t=>{const e=H.c(43),{cellIds:n,variables:o,cellAtoms:r,children:s,layoutDirection:a,settings:i}=t;let l;e[0]!==r||e[1]!==n||e[2]!==a||e[3]!==i.hidePureMarkdown||e[4]!==o?(l=()=>{let k=qw.createElements(n,r,o,i.hidePureMarkdown);return k=Ww({nodes:k.nodes,edges:k.edges,direction:a}),k},e[0]=r,e[1]=n,e[2]=a,e[3]=i.hidePureMarkdown,e[4]=o,e[5]=l):l=e[5];const[d]=M.useState(l),[u,h,f]=N2(d.nodes),[m,x,g]=j2(d.edges),p=wa();let b;e[6]!==a||e[7]!==x||e[8]!==h?(b=k=>{const B=Ww({nodes:k.nodes,edges:k.edges,direction:a});h(B.nodes),x(B.edges)},e[6]=a,e[7]=x,e[8]=h,e[9]=b):b=e[9];const y=Fe(b);let v,w;e[10]!==r||e[11]!==n||e[12]!==i.hidePureMarkdown||e[13]!==y||e[14]!==o?(v=()=>{y(qw.createElements(n,r,o,i.hidePureMarkdown))},w=[n,o,r,y,i.hidePureMarkdown],e[10]=r,e[11]=n,e[12]=i.hidePureMarkdown,e[13]=y,e[14]=o,e[15]=v,e[16]=w):(v=e[15],w=e[16]),M.useEffect(v,w);const[S,N]=M.useState();let j;M2(),e[17]===Symbol.for("react.memo_cache_sentinel")?(j=()=>{N(void 0)},e[17]=j):j=e[17];const E=j;let _,A,I,P,L,O,R,F,D,T;return e[18]===Symbol.for("react.memo_cache_sentinel")?(_={minZoom:.5,maxZoom:1.5},A=(k,B)=>{N({type:"node",id:B.id})},I=(k,B)=>{const{source:C,target:U}=B;N({type:"edge",source:C,target:U})},e[18]=_,e[19]=A,e[20]=I):(_=e[18],A=e[19],I=e[20]),e[21]===Symbol.for("react.memo_cache_sentinel")?(P=c.jsx(vT,{color:"#ccc",variant:Sn.Dots}),e[21]=P):P=e[21],e[22]!==p||e[23]!==u?(L=()=>{const k=Qe.get(JP);if(k){const B=u.find(C=>C.id===k);B&&(p.fitView({padding:1,duration:600,nodes:[B]}),N({type:"node",id:k}))}},e[22]=p,e[23]=u,e[24]=L):L=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(O=c.jsx(pp,{className:"size-4"}),e[25]=O):O=e[25],e[26]!==L?(R=c.jsx(mT,{position:"bottom-right",showInteractive:!1,children:c.jsx(je,{content:"Jump to focused cell",delayDuration:200,side:"left",asChild:!1,children:c.jsx(ts,{onMouseDown:Pn.preventFocus,onClick:L,children:O})})}),e[26]=L,e[27]=R):R=e[27],e[28]!==m||e[29]!==S||e[30]!==o?(F=c.jsx(zl,{selection:S,variables:o,edges:m,onClearSelection:E}),e[28]=m,e[29]=S,e[30]=o,e[31]=F):F=e[31],e[32]!==s||e[33]!==m||e[34]!==u||e[35]!==g||e[36]!==f||e[37]!==R||e[38]!==F?(D=c.jsxs(Gh,{nodes:u,edges:m,nodeTypes:A2,minZoom:.2,fitViewOptions:_,onNodeClick:A,onEdgeClick:I,onNodeDoubleClick:tM,fitView:!0,onNodesChange:f,onEdgesChange:g,zoomOnDoubleClick:!1,nodesConnectable:!1,children:[P,R,F,s]}),e[32]=s,e[33]=m,e[34]=u,e[35]=g,e[36]=f,e[37]=R,e[38]=F,e[39]=D):D=e[39],e[40]!==a||e[41]!==D?(T=c.jsx(_2,{value:a,children:D}),e[40]=a,e[41]=D,e[42]=T):T=e[42],T};function tM(t,e){tS(e.id,"focus")}const nM=bt("_minimap_"),oM=bt({hidePureMarkdown:!0}),rM=t=>{const e=H.c(11),[n,o]=Mt(nM),[r,s]=Mt(oM);let a;e[0]!==n||e[1]!==t||e[2]!==o||e[3]!==s||e[4]!==r?(a=()=>n==="_minimap_"?c.jsx(jT,{...t,children:c.jsx(Xh,{settings:r,onSettingsChange:s,view:n,onChange:o})}):c.jsx(eM,{...t,settings:r,layoutDirection:n,children:c.jsx(Xh,{settings:r,onSettingsChange:s,view:n,onChange:o})}),e[0]=n,e[1]=t,e[2]=o,e[3]=s,e[4]=r,e[5]=a):a=e[5];const i=a;let l,d;return e[6]!==i?(l=i(),e[6]=i,e[7]=l):l=e[7],e[8]!==n||e[9]!==l?(d=c.jsx(qh,{children:l},n),e[8]=n,e[9]=l,e[10]=d):d=e[10],d},sM=()=>{const t=H.c(5),e=Pm(),n=xr(),[o]=ZP();let r,s;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=pe("w-full h-full flex-1 mx-auto -mb-4 relative"),t[0]=r):r=t[0],t[1]!==n.inOrderIds||t[2]!==o||t[3]!==e?(s=c.jsx("div",{className:r,children:c.jsx(rM,{cellAtoms:o,variables:e,cellIds:n.inOrderIds})}),t[1]=n.inOrderIds,t[2]=o,t[3]=e,t[4]=s):s=t[4],s},aM=t=>{const e=H.c(4),{isOpen:n,children:o}=t,[r,s]=q.useState(!1);let a,i;return e[0]!==r||e[1]!==n?(a=()=>{n&&!r&&s(!0)},i=[n,r],e[0]=r,e[1]=n,e[2]=a,e[3]=i):(a=e[2],i=e[3]),q.useEffect(a,i),r?o:null},iM=t=>{const e=H.c(8),{variableName:n,className:o}=t;let r;e[0]!==n?(r=()=>{const l=function(u){const h=Qe.get(fc)[u];if(h)return h.declaredBy[0]}(n);if(!l)return;const d=Aa(l);d&&Dm(d,n)},e[0]=n,e[1]=r):r=e[1];const s=r;let a,i;return e[2]!==o?(a=pe("text-link opacity-80 hover:opacity-100 hover:underline",o),e[2]=o,e[3]=a):a=e[3],e[4]!==s||e[5]!==a||e[6]!==n?(i=c.jsx("button",{type:"button",onClick:s,className:a,children:n}),e[4]=s,e[5]=a,e[6]=n,e[7]=i):i=e[7],i},lM=bt(t=>{const e=t(QP),n=t(fc),o=t(ti);return li(e,r=>{if(!r.variable_name)return-1;const s=Object.values(n).find(i=>i.name===r.variable_name);if(!s)return 0;const a=o.inOrderIds.indexOf(s.declaredBy[0]);return a===-1?0:a})}),cM=bt(t=>{const e=new Map(t(eR));for(const n of nS){const o=e.get(n);o&&o.databases.length===0&&e.delete(n)}return li([...e.values()],n=>nS.has(n.name)?1:0)}),dM=()=>{const t=H.c(32),[e,n]=q.useState(""),o=kt(oS),r=Ne(lM),s=Ne(cM);if(r.length===0&&s.length===0){let b;return t[0]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(an,{title:"No tables found",description:"Any datasets/dataframes in the global scope will be shown here.",action:c.jsx(gg,{children:c.jsxs(ve,{variant:"outline",size:"sm",children:["Add database or catalog",c.jsx(Yo,{className:"h-4 w-4 ml-2"})]})}),icon:c.jsx(Ho,{})}),t[0]=b):b=t[0],b}const a=!!e.trim();let i,l,d,u,h,f,m,x,g,p;if(t[1]!==o?(i=b=>{o(b.length>0),n(b)},t[1]=o,t[2]=i):i=t[2],t[3]!==e||t[4]!==i?(l=c.jsx(Oa,{placeholder:"Search tables...",className:"h-6 m-1",value:e,onValueChange:i,rootClassName:"flex-1 border-r"}),t[3]=e,t[4]=i,t[5]=l):l=t[5],t[6]!==a?(d=a&&c.jsx("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:()=>n(""),children:c.jsx(_n,{className:"h-4 w-4"})}),t[6]=a,t[7]=d):d=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx(gg,{children:c.jsx("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:c.jsx(Yo,{className:"h-4 w-4"})})}),t[8]=u):u=t[8],t[9]!==l||t[10]!==d?(h=c.jsxs("div",{className:"flex items-center w-full",children:[l,d,u]}),t[9]=l,t[10]=d,t[11]=h):h=t[11],t[12]!==s||t[13]!==a||t[14]!==e){let b;t[16]!==a||t[17]!==e?(b=y=>c.jsx(uM,{connection:y,hasChildren:y.databases.length>0,children:y.databases.map(v=>c.jsx(hM,{engineName:y.name,database:v,hasSearch:a,children:c.jsx(fM,{schemas:v.schemas,defaultSchema:y.default_schema,defaultDatabase:y.default_database,engineName:y.name,databaseName:v.name,hasSearch:a,searchValue:e})},v.name))},y.name),t[16]=a,t[17]=e,t[18]=b):b=t[18],f=s.map(b),t[12]=s,t[13]=a,t[14]=e,t[15]=f}else f=t[15];return t[19]!==s.length||t[20]!==r.length?(m=s.length>0&&r.length>0&&c.jsxs(rS,{children:[c.jsx(Jl,{className:"h-4 w-4 text-muted-foreground"}),c.jsx("span",{className:"text-xs",children:"Python"})]}),t[19]=s.length,t[20]=r.length,t[21]=m):m=t[21],t[22]!==e||t[23]!==r?(x=r.length>0&&c.jsx(Gw,{tables:r,searchValue:e}),t[22]=e,t[23]=r,t[24]=x):x=t[24],t[25]!==f||t[26]!==m||t[27]!==x?(g=c.jsxs(km,{className:"flex flex-col",children:[f,m,x]}),t[25]=f,t[26]=m,t[27]=x,t[28]=g):g=t[28],t[29]!==h||t[30]!==g?(p=c.jsxs(dc,{className:"border-b bg-background rounded-none h-full pb-10 overflow-auto outline-none",shouldFilter:!1,children:[h,g]}),t[29]=h,t[30]=g,t[31]=p):p=t[31],p},uM=t=>{const e=H.c(25),{connection:n,children:o,hasChildren:r}=t,s=n.name===tR,a=s?"In-Memory":n.name,[i,l]=q.useState(!1);let d;e[0]!==n.name?(d=async()=>{l(!0),await oR({engine:n.name}),setTimeout(()=>l(!1),500)},e[0]=n.name,e[1]=d):d=e[1];const u=d;let h,f,m;e[2]!==n.dialect?(h=c.jsx(qk,{className:"h-4 w-4 text-muted-foreground",name:n.dialect}),e[2]=n.dialect,e[3]=h):h=e[3],e[4]!==n.dialect?(f=nR(n.dialect),e[4]=n.dialect,e[5]=f):f=e[5],e[6]!==f?(m=c.jsx("span",{className:"text-xs",children:f}),e[6]=f,e[7]=m):m=e[7];const x=a;let g,p,b,y,v;return e[8]!==x?(g=c.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",c.jsx(iM,{variableName:x}),")"]}),e[8]=x,e[9]=g):g=e[9],e[10]!==u||e[11]!==s||e[12]!==i?(p=!s&&c.jsx(je,{content:"Refresh connection",children:c.jsx(ve,{variant:"ghost",size:"icon",className:"ml-auto hover:bg-transparent hover:shadow-none",onClick:u,children:c.jsx(kc,{className:pe("h-4 w-4 text-muted-foreground hover:text-foreground",i&&"animate-[spin_0.5s]")})})}),e[10]=u,e[11]=s,e[12]=i,e[13]=p):p=e[13],e[14]!==h||e[15]!==m||e[16]!==g||e[17]!==p?(b=c.jsxs(rS,{children:[h,m,g,p]}),e[14]=h,e[15]=m,e[16]=g,e[17]=p,e[18]=b):b=e[18],e[19]!==o||e[20]!==r?(y=r?o:c.jsx(Oc,{content:"No databases available",className:"pl-2"}),e[19]=o,e[20]=r,e[21]=y):y=e[21],e[22]!==b||e[23]!==y?(v=c.jsxs(c.Fragment,{children:[b,y]}),e[22]=b,e[23]=y,e[24]=v):v=e[24],v},hM=t=>{const e=H.c(28),{hasSearch:n,engineName:o,database:r,children:s}=t,[a,i]=q.useState(!1),[l,d]=q.useState(!1);let u,h,f;e[0]!==n?(u=()=>{i(n)},h=[n],e[0]=n,e[1]=u,e[2]=h):(u=e[1],h=e[2]),q.useEffect(u,h),e[3]!==a||e[4]!==l?(f=()=>{i(!a),d(!l)},e[3]=a,e[4]=l,e[5]=f):f=e[5];const m=`${o}:${r.name}`;let x;e[6]!==a?(x=c.jsx(dS,{isExpanded:a}),e[6]=a,e[7]=x):x=e[7];const g=l&&a?"text-foreground":"text-muted-foreground";let p,b;e[8]!==g?(p=pe("h-4 w-4",g),e[8]=g,e[9]=p):p=e[9],e[10]!==p?(b=c.jsx(Ho,{className:p}),e[10]=p,e[11]=b):b=e[11];const y=l&&a&&"font-semibold";let v,w,S,N;e[12]!==y?(v=pe(y),e[12]=y,e[13]=v):v=e[13],e[14]!==r.name?(w=r.name===""?c.jsx("i",{children:"Not connected"}):r.name,e[14]=r.name,e[15]=w):w=e[15],e[16]!==v||e[17]!==w?(S=c.jsx("span",{className:v,children:w}),e[16]=v,e[17]=w,e[18]=S):S=e[18],e[19]!==S||e[20]!==f||e[21]!==m||e[22]!==x||e[23]!==b?(N=c.jsxs(Yn,{className:"text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",onSelect:f,value:m,children:[x,b,S]}),e[19]=S,e[20]=f,e[21]=m,e[22]=x,e[23]=b,e[24]=N):N=e[24];const j=a&&s;let E;return e[25]!==N||e[26]!==j?(E=c.jsxs(c.Fragment,{children:[N,j]}),e[25]=N,e[26]=j,e[27]=E):E=e[27],E},fM=t=>{const e=H.c(20),{schemas:n,defaultSchema:o,defaultDatabase:r,engineName:s,databaseName:a,hasSearch:i,searchValue:l}=t;if(n.length===0){let h;return e[0]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(Oc,{content:"No schemas available",className:"pl-6"}),e[0]=h):h=e[0],h}let d,u;if(e[1]!==a||e[2]!==r||e[3]!==o||e[4]!==s||e[5]!==i||e[6]!==n||e[7]!==l){let h;e[9]!==l?(h=x=>!l||x.tables.some(g=>g.name.toLowerCase().includes(l.toLowerCase())),e[9]=l,e[10]=h):h=e[10];const f=n.filter(h);let m;e[11]!==a||e[12]!==r||e[13]!==o||e[14]!==s||e[15]!==i||e[16]!==l?(m=x=>c.jsx(mM,{databaseName:a,schema:x,hasSearch:i,children:c.jsx(Gw,{tables:x.tables,searchValue:l,sqlTableContext:{engine:s,database:a,schema:x.name,defaultSchema:o,defaultDatabase:r}})},x.name),e[11]=a,e[12]=r,e[13]=o,e[14]=s,e[15]=i,e[16]=l,e[17]=m):m=e[17],d=f.map(m),e[1]=a,e[2]=r,e[3]=o,e[4]=s,e[5]=i,e[6]=n,e[7]=l,e[8]=d}else d=e[8];return e[18]!==d?(u=c.jsx(c.Fragment,{children:d}),e[18]=d,e[19]=u):u=e[19],u},mM=t=>{const e=H.c(26),{databaseName:n,schema:o,children:r,hasSearch:s}=t,[a,i]=q.useState(!1),[l,d]=q.useState(!1),u=`${n}:${o.name}`;let h,f,m,x;if(e[0]!==s?(h=()=>{i(s)},f=[s],e[0]=s,e[1]=h,e[2]=f):(h=e[1],f=e[2]),q.useEffect(h,f),cS(o.name))return r;e[3]!==a||e[4]!==l?(m=()=>{i(!a),d(!l)},e[3]=a,e[4]=l,e[5]=m):m=e[5],e[6]!==a?(x=c.jsx(dS,{isExpanded:a}),e[6]=a,e[7]=x):x=e[7];const g=l&&a&&"text-foreground";let p,b;e[8]!==g?(p=pe("h-4 w-4 text-muted-foreground",g),e[8]=g,e[9]=p):p=e[9],e[10]!==p?(b=c.jsx(dR,{className:p}),e[10]=p,e[11]=b):b=e[11];const y=l&&a&&"font-semibold";let v,w,S;e[12]!==y?(v=pe(y),e[12]=y,e[13]=v):v=e[13],e[14]!==o.name||e[15]!==v?(w=c.jsx("span",{className:v,children:o.name}),e[14]=o.name,e[15]=v,e[16]=w):w=e[16],e[17]!==w||e[18]!==m||e[19]!==x||e[20]!==b||e[21]!==u?(S=c.jsxs(Yn,{className:"text-sm flex flex-row gap-1 items-center pl-5 cursor-pointer rounded-none",onSelect:m,value:u,children:[x,b,w]}),e[17]=w,e[18]=m,e[19]=x,e[20]=b,e[21]=u,e[22]=S):S=e[22];const N=a&&r;let j;return e[23]!==S||e[24]!==N?(j=c.jsxs(c.Fragment,{children:[S,N]}),e[23]=S,e[24]=N,e[25]=j):j=e[25],j},Gw=t=>{const e=H.c(24),{tables:n,sqlTableContext:o,searchValue:r}=t,{addTableList:s}=sS(),[a,i]=q.useState(!1),[l,d]=q.useState(!1);let u,h;e[0]!==s||e[1]!==o||e[2]!==n.length||e[3]!==a?(u=async()=>{if(n.length===0&&o&&!a){i(!0),d(!0);const{engine:p,database:b,schema:y}=o,v=await DL.request({engine:p,database:b,schema:y});if(!(v!=null&&v.tables))throw d(!1),new Error("No tables available");s({tables:v.tables,sqlTableContext:o}),d(!1)}},e[0]=s,e[1]=o,e[2]=n.length,e[3]=a,e[4]=u):u=e[4],e[5]!==o||e[6]!==n.length||e[7]!==a?(h=[n.length,o,a],e[5]=o,e[6]=n.length,e[7]=a,e[8]=h):h=e[8];const{isPending:f,error:m}=En(u,h);if(f||l){let p;return e[9]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx(aS,{message:"Loading tables...",className:"pl-12"}),e[9]=p):p=e[9],p}if(m){let p;return e[10]!==m?(p=c.jsx(iS,{error:m,className:"pl-12"}),e[10]=m,e[11]=p):p=e[11],p}if(n.length===0){let p;return e[12]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx(Oc,{content:"No tables found",className:"pl-9"}),e[12]=p):p=e[12],p}let x,g;if(e[13]!==r||e[14]!==o||e[15]!==n){let p;e[17]!==r?(p=v=>!r||v.name.toLowerCase().includes(r.toLowerCase()),e[17]=r,e[18]=p):p=e[18];const b=n.filter(p);let y;e[19]!==r||e[20]!==o?(y=v=>c.jsx(pM,{table:v,sqlTableContext:o,isSearching:!!r},v.name),e[19]=r,e[20]=o,e[21]=y):y=e[21],x=b.map(y),e[13]=r,e[14]=o,e[15]=n,e[16]=x}else x=e[16];return e[22]!==x?(g=c.jsx(c.Fragment,{children:x}),e[22]=x,e[23]=g):g=e[23],g},pM=t=>{const e=H.c(64),{table:n,sqlTableContext:o,isSearching:r}=t,{addTable:s}=sS(),[a,i]=q.useState(!1),[l,d]=q.useState(!1),u=n.columns.length>0;let h,f;e[0]!==s||e[1]!==a||e[2]!==o||e[3]!==n.name||e[4]!==u||e[5]!==l?(h=async()=>{if(a&&!u&&o&&!l){d(!0);const{engine:J,database:Q,schema:W}=o,K=await PL.request({engine:J,database:Q,schema:W,tableName:n.name});if(!(K!=null&&K.table))throw new Error("No table details available");s({table:K.table,sqlTableContext:o})}},e[0]=s,e[1]=a,e[2]=o,e[3]=n.name,e[4]=u,e[5]=l,e[6]=h):h=e[6],e[7]!==a||e[8]!==u?(f=[a,u],e[7]=a,e[8]=u,e[9]=f):f=e[9];const{isFetching:m,isPending:x,error:g}=En(h,f),p=Ne(Kl),b=cs(),{createNewCell:y}=at(),v=lS();let w;e[10]!==v||e[11]!==p||e[12]!==y||e[13]!==b||e[14]!==o||e[15]!==n?(w=()=>{Gn({autoInstantiate:p,createNewCell:y,fromCellId:b}),v((()=>{if(n.source_type==="catalog"){const J=o!=null&&o.database?`${o.database}.${n.name}`:n.name;return`${n.engine}.load_table("${J}")`}if(o)return uS({table:n,columnName:"*",sqlTableContext:o});switch(n.source_type){case"local":return`mo.ui.table(${n.name})`;case"duckdb":case"connection":return uS({table:n,columnName:"*",sqlTableContext:o});default:return oc(n.source_type),""}})())},e[10]=v,e[11]=p,e[12]=y,e[13]=b,e[14]=o,e[15]=n,e[16]=w):w=e[16];const S=w;let N;e[17]!==n.num_columns||e[18]!==n.num_rows?(N=()=>{const J=[];return n.num_rows!=null&&J.push(`${n.num_rows} rows`),n.num_columns!=null&&J.push(`${n.num_columns} columns`),J.length===0?null:c.jsx("div",{className:"flex flex-row gap-2 items-center pl-6 group-hover:hidden",children:c.jsx("span",{className:"text-xs text-muted-foreground",children:J.join(", ")})})},e[17]=n.num_columns,e[18]=n.num_rows,e[19]=N):N=e[19];const j=N;let E;e[20]!==g||e[21]!==m||e[22]!==x||e[23]!==o||e[24]!==n?(E=()=>{if(x||m)return c.jsx(aS,{message:"Loading columns...",className:"pl-12"});if(g)return c.jsx(iS,{error:g,className:"pl-12"});const J=n.columns;return J.length===0?c.jsx(Oc,{content:"No columns found",className:"pl-12"}):J.map(Q=>c.jsx(gM,{table:n,column:Q,sqlTableContext:o},Q.name))},e[20]=g,e[21]=m,e[22]=x,e[23]=o,e[24]=n,e[25]=E):E=e[25];const _=E;let A;e[26]!==a||e[27]!==r||e[28]!==n.source_type||e[29]!==n.type?(A=()=>{if(n.source_type==="local")return;const J=n.type==="table"?rR:Hf;return c.jsx(J,{className:"h-3 w-3",strokeWidth:a||r?2.5:void 0})},e[26]=a,e[27]=r,e[28]=n.source_type,e[29]=n.type,e[30]=A):A=e[30];const I=A,P=o?`${o.database}.${o.schema}.${n.name}`:n.name,L=o&&(cS(o.schema)?"pl-9":"pl-12"),O=(a||r)&&"font-semibold";let R,F,D,T,k,B,C,U,V,$,X,Y;return e[31]!==L||e[32]!==O?(R=pe("rounded-none group h-8 cursor-pointer",L,O),e[31]=L,e[32]=O,e[33]=R):R=e[33],e[34]!==a?(F=()=>i(!a),e[34]=a,e[35]=F):F=e[35],e[36]!==I?(D=I(),e[36]=I,e[37]=D):D=e[37],e[38]!==n.name?(T=c.jsx("span",{className:"text-sm",children:n.name}),e[38]=n.name,e[39]=T):T=e[39],e[40]!==D||e[41]!==T?(k=c.jsxs("div",{className:"flex gap-2 items-center flex-1",children:[D,T]}),e[40]=D,e[41]=T,e[42]=k):k=e[42],e[43]!==j?(B=j(),e[43]=j,e[44]=B):B=e[44],e[45]!==S?(C=Pn.stopPropagation(()=>S()),e[45]=S,e[46]=C):C=e[46],e[47]===Symbol.for("react.memo_cache_sentinel")?(U=c.jsx(sR,{className:"h-3 w-3"}),e[47]=U):U=e[47],e[48]!==C?(V=c.jsx(je,{content:"Add table to notebook",delayDuration:400,children:c.jsx(ve,{className:"group-hover:inline-flex hidden",variant:"text",size:"icon",onClick:C,children:U})}),e[48]=C,e[49]=V):V=e[49],e[50]!==a||e[51]!==F||e[52]!==k||e[53]!==B||e[54]!==V||e[55]!==R||e[56]!==P?($=c.jsxs(Yn,{className:R,value:P,"aria-selected":a,forceMount:!0,onSelect:F,children:[k,B,V]}),e[50]=a,e[51]=F,e[52]=k,e[53]=B,e[54]=V,e[55]=R,e[56]=P,e[57]=$):$=e[57],e[58]!==a||e[59]!==_?(X=a&&_(),e[58]=a,e[59]=_,e[60]=X):X=e[60],e[61]!==$||e[62]!==X?(Y=c.jsxs(c.Fragment,{children:[$,X]}),e[61]=$,e[62]=X,e[63]=Y):Y=e[63],Y},gM=t=>{var C,U;const e=H.c(51),{table:n,column:o,sqlTableContext:r}=t,[s,a]=q.useState(!1),i=Ne(oS),l=kt(aR);let d,u;e[0]!==i?(d=()=>{i&&a(!1)},u=[i],e[0]=i,e[1]=d,e[2]=u):(d=e[1],u=e[2]),q.useEffect(d,u),l(s?V=>new Set([...V,`${n.name}:${o.name}`]):V=>(V.delete(`${n.name}:${o.name}`),new Set(V)));const h=lS(),{columnsPreviews:f}=iR();let m;e[3]!==o.name||e[4]!==n.primary_keys?(m=((C=n.primary_keys)==null?void 0:C.includes(o.name))||!1,e[3]=o.name,e[4]=n.primary_keys,e[5]=m):m=e[5];const x=m;let g;e[6]!==o.name||e[7]!==n.indexes?(g=((U=n.indexes)==null?void 0:U.includes(o.name))||!1,e[6]=o.name,e[7]=n.indexes,e[8]=g):g=e[8];const p=g;let b;e[9]!==h?(b=V=>{h(V)},e[9]=h,e[10]=b):b=e[10];const y=b,v=xM,w=s?"font-semibold":"";let S;e[11]!==o.name||e[12]!==w?(S=c.jsx("span",{className:w,children:o.name}),e[11]=o.name,e[12]=w,e[13]=S):S=e[13];const N=S,j=`${n.name}.${o.name}`,E=`${n.name}.${o.name}`;let _;e[14]!==s?(_=()=>a(!s),e[14]=s,e[15]=_):_=e[15];const A=r?"pl-14":"pl-7";let I,P,L,O,R,F,D,T,k,B;return e[16]!==A?(I=pe("flex flex-row gap-2 items-center flex-1",A),e[16]=A,e[17]=I):I=e[17],e[18]!==o.type||e[19]!==N?(P=c.jsx(lR,{columnName:N,dataType:o.type}),e[18]=o.type,e[19]=N,e[20]=P):P=e[20],e[21]!==x?(L=x&&v({tooltipContent:"Primary key",content:"PK"}),e[21]=x,e[22]=L):L=e[22],e[23]!==p?(O=p&&v({tooltipContent:"Indexed",content:"IDX"}),e[23]=p,e[24]=O):O=e[24],e[25]!==I||e[26]!==P||e[27]!==L||e[28]!==O?(R=c.jsxs("div",{className:I,children:[P,L,O]}),e[25]=I,e[26]=P,e[27]=L,e[28]=O,e[29]=R):R=e[29],e[30]!==o.name?(F=c.jsx(je,{content:"Copy column name",delayDuration:400,children:c.jsx(ve,{variant:"text",size:"icon",className:"group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground",children:c.jsx(Z3,{tooltip:!1,value:o.name,className:"h-3 w-3"})})}),e[30]=o.name,e[31]=F):F=e[31],e[32]!==o.external_type?(D=c.jsx("span",{className:"text-xs text-muted-foreground",children:o.external_type}),e[32]=o.external_type,e[33]=D):D=e[33],e[34]!==_||e[35]!==R||e[36]!==F||e[37]!==D||e[38]!==j||e[39]!==E?(T=c.jsxs(Yn,{className:"rounded-none py-1 group cursor-pointer",value:E,onSelect:_,children:[R,F,D]},j),e[34]=_,e[35]=R,e[36]=F,e[37]=D,e[38]=j,e[39]=E,e[40]=T):T=e[40],e[41]!==o||e[42]!==f||e[43]!==y||e[44]!==s||e[45]!==r||e[46]!==n?(k=s&&c.jsx("div",{className:"pl-10 pr-2 py-2 bg-[var(--slate-1)] shadow-inner border-b",children:c.jsx(uc,{children:c.jsx(cR,{table:n,column:o,onAddColumnChart:y,preview:f.get(r?`${r.database}.${r.schema}.${n.name}:${o.name}`:`${n.name}:${o.name}`),sqlTableContext:r})})}),e[41]=o,e[42]=f,e[43]=y,e[44]=s,e[45]=r,e[46]=n,e[47]=k):k=e[47],e[48]!==T||e[49]!==k?(B=c.jsxs(c.Fragment,{children:[T,k]}),e[48]=T,e[49]=k,e[50]=B):B=e[50],B};function xM(t){const{tooltipContent:e,content:n}=t;return c.jsx(je,{content:e,delayDuration:100,children:c.jsx("span",{className:"text-xs text-black bg-gray-100 dark:invert rounded px-1",children:n})})}const bM=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx(dM,{}),t[0]=e):e=t[0],e},yM=()=>{const t=H.c(5),{documentation:e}=Ne(uR);if(!e){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(an,{title:"View docs as you type",description:"Move your text cursor over a symbol to see its documentation.",icon:c.jsx(Zc,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=Om({html:e}),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=c.jsx("div",{className:"p-3 overflow-y-auto overflow-x-hidden h-full docs-documentation flex flex-col gap-4",children:n}),t[3]=n,t[4]=o):o=t[4],o},vM=()=>{const t=H.c(5),e=hR();if(e.length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(an,{title:"No errors!",icon:c.jsx(Sp,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=e.map(wM),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=c.jsx("div",{className:"flex flex-col overflow-auto",children:n}),t[3]=n,t[4]=o):o=t[4],o};function wM(t){return c.jsxs("div",{children:[c.jsx("div",{className:"text-xs font-mono font-semibold bg-muted border-y px-2 py-1",children:c.jsx(fR,{cellId:t.cellId})}),c.jsx("div",{className:"px-2",children:c.jsx(mR,{errors:t.output.data,cellId:t.cellId},t.cellId)},t.cellId)]},t.cellId)}const Pf=new Map,kM=({file:t,onOpenNotebook:e})=>{const{theme:n}=Ko(),o=Ne(ec),[r,s]=M.useState(""),{data:a,isPending:i,error:l,setData:d}=En(async()=>{const g=await Rm({path:t.path}),p=g.contents||"";return s(Pf.get(t.path)||p),g},[t.path]),u=async()=>{r!==(a==null?void 0:a.contents)&&await kR({path:t.path,contents:r}).then(g=>{g.success&&(d(p=>({...p,contents:r})),s(r))})},h=M.useRef(r);if(h.current=r,M.useEffect(()=>()=>{if(!(a!=null&&a.contents))return;const g=h.current;g===a.contents?Pf.delete(t.path):Pf.set(t.path,g)},[t.path,a==null?void 0:a.contents]),l)return c.jsx(br,{error:l});if(i||!a)return null;const f=a.mimeType||"text/plain",m=f in Rf;if(!a.contents&&!m)return c.jsxs("div",{className:"grid grid-cols-2 gap-2 p-6",children:[c.jsx("div",{className:"font-bold text-muted-foreground",children:"Name"}),c.jsx("div",{children:a.file.name}),c.jsx("div",{className:"font-bold text-muted-foreground",children:"Type"}),c.jsx("div",{children:f})]});const x=c.jsxs("div",{className:"text-xs text-muted-foreground p-1 flex justify-end gap-2 border-b",children:[t.isMarimoFile&&!Jt()&&c.jsx(je,{content:"Open notebook",children:c.jsx(sn,{size:"small",onClick:g=>e(g),children:c.jsx(lc,{})})}),c.jsx(je,{content:"Download",children:c.jsx(sn,{size:"small",onClick:()=>{if(Yw(f)){const g=vR(a.contents,f);return void wR(g,a.file.name)}Ba(new Blob([a.contents||r],{type:f}),a.file.name)},children:c.jsx(om,{})})}),!Yw(f)&&c.jsxs(c.Fragment,{children:[c.jsx(je,{content:"Copy contents to clipboard",children:c.jsx(sn,{size:"small",onClick:async()=>{await nn(r)},children:c.jsx(Ea,{})})}),c.jsx(je,{content:Ht("global.save"),children:c.jsx(sn,{size:"small",color:r===a.contents?void 0:"green",onClick:u,disabled:r===a.contents,children:c.jsx(fi,{})})})]})]});return f.startsWith("image/")?c.jsxs(c.Fragment,{children:[x,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(pR,{base64:a.contents,mime:f})})]}):f==="text/csv"&&a.contents?c.jsxs(c.Fragment,{children:[x,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(gR,{contents:a.contents})})]}):f.startsWith("audio/")?c.jsxs(c.Fragment,{children:[x,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(xR,{base64:a.contents,mime:f})})]}):f.startsWith("video/")?c.jsxs(c.Fragment,{children:[x,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(bR,{base64:a.contents,mime:f})})]}):f.startsWith("application/pdf")?c.jsxs(c.Fragment,{children:[x,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(yR,{base64:a.contents,mime:f})})]}):c.jsxs(c.Fragment,{children:[x,c.jsx("div",{className:"flex-1 overflow-auto",children:c.jsx(M.Suspense,{children:c.jsx(ri,{theme:n==="dark"?"dark":"light",language:Rf[f]||Rf.default,className:"border-b",extensions:[He.lineWrapping,In.of([{key:o.getHotkey("global.save").key,stopPropagation:!0,run:()=>r!==a.contents&&(u(),!0)}])],value:r,onChange:s})})})]})},Yw=t=>t.startsWith("image/")||t.startsWith("audio/")||t.startsWith("video/")||t.startsWith("application/pdf"),Rf={"application/javascript":"javascript","text/markdown":"markdown","text/html":"html","text/css":"css","text/x-python":"python","application/json":"json","application/xml":"xml","text/x-yaml":"yaml","text/csv":"markdown","text/plain":"markdown",default:"markdown"},Kw=bt(new class{constructor(t){this.callbacks=t,this.delegate=new $m([]),this.rootPath="",this.onChange=Rn.NOOP,this.path=new sc("/"),this.initialize=async e=>{if(this.onChange=e,this.delegate.data.length===0)try{const n=await this.callbacks.listFiles({path:this.rootPath});this.delegate=new $m(n.files),this.rootPath=n.root,this.path=sc.guessDeliminator(n.root)}catch(n){Xe({title:"Failed",description:C3(n)})}this.onChange(this.delegate.data)},this.refreshAll=async e=>{const n=[this.rootPath,...e.map(r=>{var s;return(s=this.delegate.find(r))==null?void 0:s.data.path})].filter(Boolean),o=await Promise.all(n.map(r=>this.callbacks.listFiles({path:r}).catch(()=>({files:[]}))));for(const[r,s]of n.entries()){const a=o[r];s===this.rootPath?this.delegate=new $m(a.files):this.delegate.update({id:s,changes:{children:a.files}})}this.onChange(this.delegate.data)},this.relativeFromRoot=e=>{const n=this.rootPath.endsWith(this.path.deliminator)?this.rootPath:`${this.rootPath}${this.path.deliminator}`;return e.startsWith(n)?e.slice(n.length):e},this.handleResponse=e=>e.success?e:(Xe({title:"Failed",description:e.message}),null)}async expand(t){const e=this.delegate.find(t);if(!e||!e.data.isDirectory)return!1;if(e.children&&e.children.length>0)return!0;const n=await this.callbacks.listFiles({path:e.data.path});return this.delegate.update({id:t,changes:{children:n.files}}),this.onChange(this.delegate.data),!0}async rename(t,e){const n=this.delegate.find(t);if(!n)return;const o=n.data.path,r=this.path.join(this.path.dirname(o),e);await this.callbacks.renameFileOrFolder({path:o,newPath:r}).then(this.handleResponse),this.delegate.update({id:t,changes:{name:e,path:r}}),this.onChange(this.delegate.data),await this.refreshAll([r])}async move(t,e){var o;const n=e?((o=this.delegate.find(e))==null?void 0:o.data.path)??e:this.rootPath;await Promise.all(t.map(r=>{this.delegate.move({id:r,parentId:e,index:0});const s=this.delegate.find(r);if(!s)return Promise.resolve();const a=this.path.join(n,this.path.basename(s.data.path));return this.delegate.update({id:r,changes:{path:a}}),this.callbacks.renameFileOrFolder({path:s.data.path,newPath:a}).then(this.handleResponse)})),this.onChange(this.delegate.data),await this.refreshAll([n])}async createFile(t,e){var r;const n=e?((r=this.delegate.find(e))==null?void 0:r.data.path)??e:this.rootPath,o=await this.callbacks.createFileOrFolder({path:n,type:"file",name:t}).then(this.handleResponse);o!=null&&o.info&&(this.delegate.create({parentId:e,index:0,data:o.info}),this.onChange(this.delegate.data),await this.refreshAll([n]))}async createFolder(t,e){var r;const n=e?((r=this.delegate.find(e))==null?void 0:r.data.path)??e:this.rootPath,o=await this.callbacks.createFileOrFolder({path:n,type:"directory",name:t}).then(this.handleResponse);o!=null&&o.info&&(this.delegate.create({parentId:e,index:0,data:o.info}),this.onChange(this.delegate.data),await this.refreshAll([n]))}async delete(t){const e=this.delegate.find(t);e&&(await this.callbacks.deleteFileOrFolder({path:e.data.path}).then(this.handleResponse),this.delegate.drop({id:t}),this.onChange(this.delegate.data))}}({listFiles:e3,createFileOrFolder:Lm,deleteFileOrFolder:NR,renameFileOrFolder:SR})),SM=bt({});function NM(t){return new Promise((e,n)=>{const o=new FileReader;o.onload=r=>{var s;e((s=r.target)==null?void 0:s.result)},o.onerror=r=>{n(new Error(`Failed to read blob: ${r.type}`))},o.readAsDataURL(t)})}function Xw(t){const e=H.c(4);let n;e[0]!==t?(n=t===void 0?{}:t,e[0]=t,e[1]=n):n=e[1];const o=n;let r;return e[2]!==o?(r={multiple:!0,maxSize:104857600,onError:IM,onDropRejected:CM,onDrop:jM,...o},e[2]=o,e[3]=r):r=e[3],jR(r)}async function jM(t){for(const e of t){const n=TM(AM(e));let o="";n&&(o=sc.guessDeliminator(n).dirname(n));const r=(await NM(e)).split(",")[1];await Lm({path:o,type:"file",name:e.name,contents:r})}await async function(){await Qe.get(Kw).refreshAll([])}()}function CM(t){Xe({title:"File upload failed",description:c.jsx("div",{className:"flex flex-col gap-1",children:t.map(EM)}),variant:"danger"})}function EM(t){return c.jsxs("div",{children:[t.file.name," (",t.errors.map(_M).join(", "),")"]},t.file.name)}function _M(t){return t.message}function IM(t){ht.error(t),Xe({title:"File upload failed",description:t.message,variant:"danger"})}function AM(t){return t.webkitRelativePath?t.webkitRelativePath:"path"in t&&typeof t.path=="string"?t.path:"relativePath"in t&&typeof t.relativePath=="string"?t.relativePath:void 0}function TM(t){if(t)return t.replace(/^\/+/,"")}const Jw=q.createContext(null),MM=t=>{const e=H.c(60),{height:n}=t,o=M.useRef(null),[r]=Mt(Kw);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=[],e[0]=s):s=e[0];const[a,i]=M.useState(s),[l,d]=M.useState(null),{openPrompt:u}=Cn(),[h,f]=Mt(SM);let m,x;e[1]!==r?(m=()=>r.initialize(i),e[1]=r,e[2]=m):m=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(x=[],e[3]=x):x=e[3];const{isPending:g,error:p}=En(m,x);let b;e[4]!==h||e[5]!==r?(b=()=>{r.refreshAll(Object.keys(h).filter(k=>h[k]))},e[4]=h,e[5]=r,e[6]=b):b=e[6];const y=Fe(b);let v;e[7]!==u||e[8]!==r?(v=async()=>{u({title:"Folder name",onConfirm:async k=>{r.createFolder(k,null)}})},e[7]=u,e[8]=r,e[9]=v):v=e[9];const w=Fe(v);let S;e[10]!==u||e[11]!==r?(S=async()=>{u({title:"File name",onConfirm:async k=>{r.createFile(k,null)}})},e[10]=u,e[11]=r,e[12]=S):S=e[12];const N=Fe(S);let j;e[13]!==f?(j=()=>{var k;(k=o.current)==null||k.closeAll(),f({})},e[13]=f,e[14]=j):j=e[14];const E=Fe(j);if(g){let k;return e[15]===Symbol.for("react.memo_cache_sentinel")?(k=c.jsx(bn,{size:"medium",centered:!0}),e[15]=k):k=e[15],k}if(p){let k;return e[16]!==p?(k=c.jsx(br,{error:p}),e[16]=p,e[17]=k):k=e[17],k}if(l){let k,B,C,U,V,$;return e[18]===Symbol.for("react.memo_cache_sentinel")?(k=()=>d(null),e[18]=k):k=e[18],e[19]===Symbol.for("react.memo_cache_sentinel")?(B=c.jsx(ve,{onClick:k,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:c.jsx(vt,{size:16})}),e[19]=B):B=e[19],e[20]!==l.name?(C=c.jsxs("div",{className:"flex items-center pl-1 pr-3 flex-shrink-0 border-b justify-between",children:[B,c.jsx("span",{className:"font-bold",children:l.name})]}),e[20]=l.name,e[21]=C):C=e[21],e[22]!==l.path||e[23]!==r?(U=X=>Zw(X,r.relativeFromRoot(l.path)),e[22]=l.path,e[23]=r,e[24]=U):U=e[24],e[25]!==l||e[26]!==U?(V=c.jsx(M.Suspense,{children:c.jsx(kM,{onOpenNotebook:U,file:l})}),e[25]=l,e[26]=U,e[27]=V):V=e[27],e[28]!==C||e[29]!==V?($=c.jsxs(c.Fragment,{children:[C,V]}),e[28]=C,e[29]=V,e[30]=$):$=e[30],$}let _;e[31]!==E||e[32]!==N||e[33]!==w||e[34]!==y||e[35]!==r?(_=c.jsx(DM,{onRefresh:y,onCreateFile:N,onCreateFolder:w,onCollapseAll:E,tree:r}),e[31]=E,e[32]=N,e[33]=w,e[34]=y,e[35]=r,e[36]=_):_=e[36];const A=n-33;let I,P,L,O,R,F,D,T;return e[37]!==r?(I=async k=>{const{ids:B}=k;for(const C of B)await r.delete(C)},P=async k=>{const{id:B,name:C}=k;await r.rename(B,C)},L=async k=>{const{dragIds:B,parentId:C}=k;await r.move(B,C)},e[37]=r,e[38]=I,e[39]=P,e[40]=L):(I=e[38],P=e[39],L=e[40]),e[41]===Symbol.for("react.memo_cache_sentinel")?(O=k=>{const B=k[0];B&&(B.data.isDirectory||d(B.data))},e[41]=O):O=e[41],e[42]!==h||e[43]!==f||e[44]!==r?(R=async k=>{if(await r.expand(k)){const B=h[k]??!1;f({...h,[k]:!B})}},e[42]=h,e[43]=f,e[44]=r,e[45]=R):R=e[45],e[46]!==a||e[47]!==h||e[48]!==I||e[49]!==P||e[50]!==L||e[51]!==R||e[52]!==A?(F=c.jsx(xL,{width:"100%",ref:o,height:A,className:"h-full",data:a,initialOpenState:h,openByDefault:!1,renderCursor:zM,disableDrop:BM,onDelete:I,onRename:P,onMove:L,onSelect:O,onToggle:R,padding:15,rowHeight:30,indent:OM,overscanCount:1e3,disableMultiSelection:!0,children:LM}),e[46]=a,e[47]=h,e[48]=I,e[49]=P,e[50]=L,e[51]=R,e[52]=A,e[53]=F):F=e[53],e[54]!==F||e[55]!==r?(D=c.jsx(Jw,{value:r,children:F}),e[54]=F,e[55]=r,e[56]=D):D=e[56],e[57]!==D||e[58]!==_?(T=c.jsxs(c.Fragment,{children:[_,D]}),e[57]=D,e[58]=_,e[59]=T):T=e[59],T},OM=15,DM=t=>{const e=H.c(30),{onRefresh:n,onCreateFile:o,onCreateFolder:r,onCollapseAll:s}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={noDrag:!0,noDragEventsBubbling:!0},e[0]=a):a=e[0];const{getRootProps:i,getInputProps:l}=Xw(a);let d,u,h,f,m,x,g,p,b,y,v,w,S,N,j;return e[1]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(ui,{size:16}),e[1]=d):d=e[1],e[2]!==o?(u=c.jsx(je,{content:"Add file",children:c.jsx(ve,{"data-testid":"file-explorer-add-file-button",onClick:o,variant:"text",size:"xs",children:d})}),e[2]=o,e[3]=u):u=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(Hc,{size:16}),e[4]=h):h=e[4],e[5]!==r?(f=c.jsx(je,{content:"Add folder",children:c.jsx(ve,{"data-testid":"file-explorer-add-folder-button",onClick:r,variant:"text",size:"xs",children:h})}),e[5]=r,e[6]=f):f=e[6],e[7]!==i?(m=i({}),e[7]=i,e[8]=m):m=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(x=CR({variant:"text",size:"xs"}),g=c.jsx(_R,{size:16}),e[9]=x,e[10]=g):(x=e[9],g=e[10]),e[11]!==m?(p=c.jsx(je,{content:"Upload file",children:c.jsx("button",{"data-testid":"file-explorer-upload-button",...m,className:x,children:g})}),e[11]=m,e[12]=p):p=e[12],e[13]!==l?(b=l({}),e[13]=l,e[14]=b):b=e[14],e[15]!==b?(y=c.jsx("input",{...b,type:"file"}),e[15]=b,e[16]=y):y=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(v=c.jsx(R3,{size:16}),e[17]=v):v=e[17],e[18]!==n?(w=c.jsx(je,{content:"Refresh",children:c.jsx(ve,{"data-testid":"file-explorer-refresh-button",onClick:n,variant:"text",size:"xs",children:v})}),e[18]=n,e[19]=w):w=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(S=c.jsx(tp,{size:16}),e[20]=S):S=e[20],e[21]!==s?(N=c.jsx(je,{content:"Collapse all folders",children:c.jsx(ve,{"data-testid":"file-explorer-collapse-button",onClick:s,variant:"text",size:"xs",children:S})}),e[21]=s,e[22]=N):N=e[22],e[23]!==y||e[24]!==w||e[25]!==N||e[26]!==u||e[27]!==f||e[28]!==p?(j=c.jsxs("div",{className:"flex items-center justify-end px-2 flex-shrink-0 border-b",children:[u,f,p,y,w,N]}),e[23]=y,e[24]=w,e[25]=N,e[26]=u,e[27]=f,e[28]=p,e[29]=j):j=e[29],j},PM=t=>{const e=H.c(9),{node:n,onOpenMarimoFile:o}=t;let r,s,a;return e[0]!==n?(r=i=>{n.data.isDirectory||(i.stopPropagation(),n.select())},e[0]=n,e[1]=r):r=e[1],e[2]!==n.data.isMarimoFile||e[3]!==o?(s=n.data.isMarimoFile&&!Jt()&&c.jsxs("span",{className:"flex-shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline",onClick:o,children:["open ",c.jsx(lc,{className:"inline ml-1",size:12})]}),e[2]=n.data.isMarimoFile,e[3]=o,e[4]=s):s=e[4],e[5]!==n.data.name||e[6]!==r||e[7]!==s?(a=c.jsxs("span",{className:"flex-1 overflow-hidden text-ellipsis",onClick:r,children:[n.data.name,s]}),e[5]=n.data.name,e[6]=r,e[7]=s,e[8]=a):a=e[8],a},RM=t=>{const e=H.c(10),{node:n}=t,o=M.useRef(null);let r,s,a,i,l;return e[0]!==n.data.name?(r=()=>{var d,u;(d=o.current)==null||d.focus(),(u=o.current)==null||u.setSelectionRange(0,n.data.name.lastIndexOf("."))},s=[n.data.name],e[0]=n.data.name,e[1]=r,e[2]=s):(r=e[1],s=e[2]),M.useEffect(r,s),e[3]!==n?(a=()=>n.reset(),i=d=>{d.key==="Escape"&&n.reset(),d.key==="Enter"&&n.submit(d.currentTarget.value)},e[3]=n,e[4]=a,e[5]=i):(a=e[4],i=e[5]),e[6]!==n.data.name||e[7]!==a||e[8]!==i?(l=c.jsx("input",{ref:o,className:"flex-1 bg-transparent border border-border text-muted-foreground",defaultValue:n.data.name,onClick:UM,onBlur:a,onKeyDown:i}),e[6]=n.data.name,e[7]=a,e[8]=i,e[9]=l):l=e[9],l},LM=({node:t,style:e,dragHandle:n})=>{const o=t.data.isDirectory?"directory":Zk(t.data.name),r=Qk[o],{openConfirm:s,openPrompt:a}=Cn(),{createNewCell:i}=at(),l=cs(),d=M.use(Jw),u=async g=>{Zw(g,d?d.relativeFromRoot(t.data.path):t.data.path)},h=async g=>{g.stopPropagation(),g.preventDefault(),s({title:"Delete file",description:`Are you sure you want to delete ${t.data.name}?`,confirmAction:c.jsx(Gk,{onClick:async()=>{await t.tree.delete(t.id)},"aria-label":"Confirm",children:"Delete"})})},f=Fe(async()=>{t.open(),a({title:"Folder name",onConfirm:async g=>{d==null||d.createFolder(g,t.id)}})}),m=Fe(async()=>{t.open(),a({title:"File name",onConfirm:async g=>{d==null||d.createFile(g,t.id)}})}),x=Fe(async()=>{var y;if(!d||t.data.isDirectory)return;const[g,p]=ER(t.data.name),b=`${g}_copy${p}`;try{const v=await Rm({path:t.data.path}),w=((y=t.parent)==null?void 0:y.data.path)||"";await Lm({path:w,type:"file",name:b,contents:v.contents?btoa(v.contents):void 0}),await d.refreshAll([w])}catch{Xe({title:"Failed to duplicate file",description:"Unable to create a duplicate of the file",variant:"danger"})}});return c.jsxs("div",{style:e,ref:n,className:pe("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group"),draggable:!0,onClick:g=>{g.stopPropagation(),t.data.isDirectory&&t.toggle()},children:[c.jsx(FM,{node:t}),c.jsxs("span",{className:pe("flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group",t.willReceiveDrop&&t.data.isDirectory&&"bg-accent/80 hover:bg-accent/80 text-accent-foreground"),children:[t.data.isMarimoFile?c.jsx("img",{src:RL,className:"w-5 h-5 flex-shrink-0 mr-2 filter grayscale",alt:"Marimo"}):c.jsx(r,{className:"w-5 h-5 flex-shrink-0 mr-2",strokeWidth:1.5}),t.isEditing?c.jsx(RM,{node:t}):c.jsx(PM,{node:t,onOpenMarimoFile:u}),c.jsxs(So,{modal:!1,children:[c.jsx(No,{asChild:!0,tabIndex:-1,onClick:g=>g.stopPropagation(),children:c.jsx(ve,{"data-testid":"file-explorer-more-button",variant:"text",tabIndex:-1,size:"xs",className:"mb-0","aria-label":"More options",children:c.jsx(Vc,{strokeWidth:2,className:"w-5 h-5 hidden group-hover:block"})})}),(()=>{const g={size:14,strokeWidth:1.5,className:"mr-2"};return c.jsxs(jo,{align:"end",className:"no-print w-[220px]",onClick:p=>p.stopPropagation(),onCloseAutoFocus:p=>p.preventDefault(),children:[!t.data.isDirectory&&c.jsxs(_t,{onSelect:()=>t.select(),children:[c.jsx(Fp,{...g}),"Open file"]}),!t.data.isDirectory&&!Jt()&&c.jsxs(_t,{onSelect:()=>{IR({path:t.data.path})},children:[c.jsx(lc,{...g}),"Open file in external editor"]}),t.data.isDirectory&&c.jsxs(c.Fragment,{children:[c.jsxs(_t,{onSelect:()=>m(),children:[c.jsx(ui,{...g}),"Create file"]}),c.jsxs(_t,{onSelect:()=>f(),children:[c.jsx(Hc,{...g}),"Create folder"]}),c.jsx(on,{})]}),c.jsxs(_t,{onSelect:()=>t.edit(),children:[c.jsx(Np,{...g}),"Rename"]}),!t.data.isDirectory&&c.jsxs(_t,{onSelect:x,children:[c.jsx(Ea,{...g}),"Duplicate"]}),c.jsxs(_t,{onSelect:async()=>{await nn(t.data.path),Xe({title:"Copied to clipboard"})},children:[c.jsx(Gc,{...g}),"Copy path"]}),d&&c.jsxs(_t,{onSelect:async()=>{await nn(d.relativeFromRoot(t.data.path)),Xe({title:"Copied to clipboard"})},children:[c.jsx(Gc,{...g}),"Copy relative path"]}),c.jsx(on,{}),c.jsxs(_t,{onSelect:()=>{const{path:p}=t.data;(b=>{i({code:b,before:!1,cellId:l??"__end__"})})(hS[o](p))},children:[c.jsx(kr,{...g}),"Insert snippet for reading file"]}),c.jsxs(_t,{onSelect:async()=>{Xe({title:"Copied to clipboard",description:"Code to open the file has been copied to your clipboard. You can also drag and drop this file into the editor"});const{path:p}=t.data,b=hS[o](p);await nn(b)},children:[c.jsx(AR,{...g}),"Copy snippet for reading file"]}),t.data.isMarimoFile&&!Jt()&&c.jsxs(c.Fragment,{children:[c.jsx(on,{}),c.jsxs(_t,{onSelect:u,children:[c.jsx(Op,{...g}),"Open notebook"]})]}),c.jsx(on,{}),!t.data.isDirectory&&c.jsxs(c.Fragment,{children:[c.jsxs(_t,{onSelect:async()=>{const p=(await Rm({path:t.data.path})).contents||"";Ba(new Blob([p]),t.data.name)},children:[c.jsx(om,{...g}),"Download"]}),c.jsx(on,{})]}),c.jsxs(_t,{onSelect:h,variant:"danger",children:[c.jsx(Ql,{...g}),"Delete"]})]})})()]})]})]})},FM=t=>{const e=H.c(3),{node:n}=t;if(!n.data.isDirectory){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx("span",{className:"w-5 h-5 flex-shrink-0"}),e[0]=r):r=e[0],r}let o;return e[1]!==n.isOpen?(o=n.isOpen?c.jsx(ko,{className:"w-5 h-5 flex-shrink-0"}):c.jsx(Ma,{className:"w-5 h-5 flex-shrink-0"}),e[1]=n.isOpen,e[2]=o):o=e[2],o};function Zw(t,e){t.stopPropagation(),t.preventDefault(),kS(e)}function zM(){return null}function BM(t){const{parentNode:e}=t;return!e.data.isDirectory}function UM(t){return t.stopPropagation()}let Qw,ek,tk;Qw=()=>{const t=H.c(20),{ref:e,height:n}=TR(),o=n===void 0?1:n;let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={noClick:!0,noKeyboard:!0},t[0]=r):r=t[0];const{getRootProps:s,getInputProps:a,isDragActive:i}=Xw(r);let l,d,u,h,f,m,x,g;return t[1]!==s?(l=s(),t[1]=s,t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(d=pe("flex flex-col flex-1 overflow-hidden relative"),t[3]=d):d=t[3],t[4]!==a?(u=a(),t[4]=a,t[5]=u):u=t[5],t[6]!==u?(h=c.jsx("input",{...u}),t[6]=u,t[7]=h):h=t[7],t[8]!==i?(f=i&&c.jsx("div",{className:"absolute inset-0 flex items-center uppercase justify-center text-xl font-bold text-primary/90 bg-accent/85 z-10 border-2 border-dashed border-primary/90 rounded-lg pointer-events-none",children:"Drop files here"}),t[8]=i,t[9]=f):f=t[9],t[10]!==o?(m=c.jsx(MM,{height:o}),t[10]=o,t[11]=m):m=t[11],t[12]!==e||t[13]!==m?(x=c.jsx("div",{ref:e,className:"flex flex-col flex-1 overflow-hidden",children:m}),t[12]=e,t[13]=m,t[14]=x):x=t[14],t[15]!==l||t[16]!==h||t[17]!==f||t[18]!==x?(g=c.jsxs("div",{...l,className:d,children:[h,f,x]}),t[15]=l,t[16]=h,t[17]=f,t[18]=x,t[19]=g):g=t[19],g},Km=t=>{const e=H.c(6),n=t.dataTestId;let o,r;return e[0]!==t.className?(o=pe("text-xs font-semibold text-accent-foreground",t.className),e[0]=t.className,e[1]=o):o=e[1],e[2]!==t.dataTestId||e[3]!==t.onClick||e[4]!==o?(r=c.jsx("button",{type:"button","data-testid":n,className:o,onClick:t.onClick,children:"Clear"}),e[2]=t.dataTestId,e[3]=t.onClick,e[4]=o,e[5]=r):r=e[5],r},ek=()=>{const t=H.c(9),e=MR(),{clearLogs:n}=at();if(e.length===0){let a,i;return t[0]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx("code",{className:"border rounded px-1",children:"stdout"}),t[0]=a):a=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(an,{title:"No logs",description:c.jsxs("span",{children:[a," and"," ",c.jsx("code",{className:"border rounded px-1",children:"stderr"})," logs will appear here."]}),icon:c.jsx(Vf,{})}),t[1]=i):i=t[1],i}let o,r,s;return t[2]!==n?(o=c.jsx("div",{className:"flex flex-row justify-end px-2 py-1",children:c.jsx(Km,{dataTestId:"clear-logs-button",onClick:n})}),t[2]=n,t[3]=o):o=t[3],t[4]!==e?(r=c.jsx("div",{className:"overflow-auto flex-1",children:c.jsx(tk,{logs:e,className:"min-w-[300px]"})}),t[4]=e,t[5]=r):r=t[5],t[6]!==o||t[7]!==r?(s=c.jsxs(c.Fragment,{children:[o,r]}),t[6]=o,t[7]=r,t[8]=s):s=t[8],s},tk=t=>{const e=H.c(10),{logs:n,className:o}=t;let r,s,a,i,l;return e[0]!==o?(r=pe("flex flex-col",o),e[0]=o,e[1]=r):r=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(s={whiteSpace:"pre-wrap"},e[2]=s):s=e[2],e[3]!==n?(a=n.map(HM),e[3]=n,e[4]=a):a=e[4],e[5]!==a?(i=c.jsx("pre",{className:"grid text-xs font-mono gap-1 whitespace-break-spaces font-semibold align-left",children:c.jsx("div",{className:"grid grid-cols-[30px,1fr]",style:s,children:a})}),e[5]=a,e[6]=i):i=e[6],e[7]!==r||e[8]!==i?(l=c.jsx("div",{className:r,children:i}),e[7]=r,e[8]=i,e[9]=l):l=e[9],l};function $M(t){const e=OR(t.timestamp),n=VM[t.level],o=t.level.toUpperCase();return c.jsxs(c.Fragment,{children:[c.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)] dark:text-[var(--gray-11)]",children:["[",e,"]"]}),c.jsx("span",{className:pe("flex-shrink-0",n),children:o}),c.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)]",children:["(",c.jsx(_o,{cellId:t.cellId}),")"]}),t.message]})}const VM={stdout:"text-[var(--grass-9)]",stderr:"text-[var(--red-9)]"};function HM(t,e){return c.jsxs("div",{className:"contents group",children:[c.jsx("span",{className:pe("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","text-right col-span-1 py-1 pr-1"),children:e+1}),c.jsx("span",{className:pe("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","px-2 flex gap-x-1.5 py-1 flex-wrap"),children:$M(t)})]},e)}const WM=()=>{const t=H.c(7),{items:e}=Ne(DR);let n,o;t[0]!==e?(o=LL(e),t[0]=e,t[1]=o):o=t[1],n=o;const r=n,{activeHeaderId:s,activeOccurrences:a}=FL(r);if(e.length===0){let l;return t[2]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(an,{title:"No outline",description:"Add markdown headings to your notebook to create an outline.",icon:c.jsx(Jc,{})}),t[2]=l):l=t[2],l}let i;return t[3]!==s||t[4]!==a||t[5]!==e?(i=c.jsx(zL,{items:e,activeHeaderId:s,activeOccurrences:a}),t[3]=s,t[4]=a,t[5]=e,t[6]=i):i=t[6],i},nk=bt(null),ok=t=>{const e=H.c(9),{onClick:n,loading:o,children:r,className:s}=t;if(o){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(bn,{size:"small",className:"h-4 w-4 shrink-0 opacity-50"}),e[0]=d):d=e[0],d}let a,i,l;return e[1]!==s?(a=pe("px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible",s),e[1]=s,e[2]=a):a=e[2],e[3]!==n?(i=Pn.stopPropagation(n),e[3]=n,e[4]=i):i=e[4],e[5]!==r||e[6]!==a||e[7]!==i?(l=c.jsx("button",{type:"button",className:a,onClick:i,children:r}),e[5]=r,e[6]=a,e[7]=i,e[8]=l):l=e[8],l},qM=()=>{var w,S;const t=H.c(27),[e]=fr(),n=e.package_management.manager,[o,r]=q.useState(null);let s;t[0]!==n?(s=[n],t[0]=n,t[1]=s):s=t[1];const{data:a,error:i,refetch:l,isPending:d}=En(XM,s);if(d){let N;return t[2]===Symbol.for("react.memo_cache_sentinel")?(N=c.jsx(bn,{size:"medium",centered:!0}),t[2]=N):N=t[2],N}if(i){let N;return t[3]!==i?(N=c.jsx(br,{error:i}),t[3]=i,t[4]=N):N=t[4],N}const u=a.tree!=null;let h;t[5]!==u||t[6]!==o?(h=function(N,j){return N==="list"?"list":j?N||"tree":"list"}(o,u),t[5]=u,t[6]=o,t[7]=h):h=t[7];const f=h,m=(w=a.tree)==null?void 0:w.name,x=(S=a==null?void 0:a.tree)==null?void 0:S.version,g=m==="<root>";let p,b,y,v;return t[8]!==n||t[9]!==l?(p=c.jsx(GM,{packageManager:n,onSuccess:l}),t[8]=n,t[9]=l,t[10]=p):p=t[10],t[11]!==g||t[12]!==u||t[13]!==m||t[14]!==x||t[15]!==f?(b=u&&c.jsxs("div",{className:"flex items-center justify-between px-2 py-1 border-b",children:[c.jsxs("div",{className:"flex gap-1",children:[c.jsx("button",{type:"button",className:pe("px-2 py-1 text-xs rounded",f==="list"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>r("list"),children:"List"}),c.jsx("button",{type:"button",className:pe("px-2 py-1 text-xs rounded",f==="tree"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>r("tree"),children:"Tree"})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium",title:g?"sandbox":"project",children:g?"sandbox":"project"}),m&&!g&&c.jsxs("span",{className:"text-xs text-muted-foreground",children:[m,x&&` v${x}`]})]})]}),t[11]=g,t[12]=u,t[13]=m,t[14]=x,t[15]=f,t[16]=b):b=t[16],t[17]!==a.list||t[18]!==a.tree||t[19]!==i||t[20]!==l||t[21]!==f?(y=f==="list"?c.jsx(YM,{packages:a.list,onSuccess:l}):c.jsx(KM,{tree:a.tree,error:i,onSuccess:l}),t[17]=a.list,t[18]=a.tree,t[19]=i,t[20]=l,t[21]=f,t[22]=y):y=t[22],t[23]!==p||t[24]!==b||t[25]!==y?(v=c.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[p,b,y]}),t[23]=p,t[24]=b,t[25]=y,t[26]=v):v=t[26],v},GM=t=>{const e=H.c(40),{onSuccess:n,packageManager:o}=t,[r,s]=q.useState(""),{handleClick:a}=ai(),i=Ne(nk),l=kt(nk);let d,u;e[0]!==i||e[1]!==l?(d=()=>{i&&(s(i),l(null))},u=[i,l],e[0]=i,e[1]=l,e[2]=d,e[3]=u):(d=e[2],u=e[3]),q.useEffect(d,u);const{loading:h,handleInstallPackages:f}=LR();let m;e[4]!==n?(m=()=>{n(),s("")},e[4]=n,e[5]=m):m=e[5];const x=m;let g;e[6]!==f||e[7]!==r||e[8]!==x?(g=()=>{f(r.split(",").map(JM),x)},e[6]=f,e[7]=r,e[8]=x,e[9]=g):g=e[9];const p=g,b=`Install packages with ${o}...`;let y,v,w,S,N,j,E,_,A,I,P,L,O,R;e[10]!==h||e[11]!==a?(y=h?c.jsx(bn,{size:"small",className:"mr-2 h-4 w-4 shrink-0 opacity-50"}):c.jsx(je,{content:"Change package manager",children:c.jsx(ks,{onClick:()=>a("packageManagement"),className:"mr-2 h-4 w-4 shrink-0 opacity-50 hover:opacity-80 cursor-pointer"})}),e[10]=h,e[11]=a,e[12]=y):y=e[12],e[13]!==p?(v=C=>{C.key==="Enter"&&(C.preventDefault(),p())},e[13]=p,e[14]=v):v=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(w=C=>s(C.target.value),e[15]=w):w=e[15],e[16]!==r||e[17]!==b||e[18]!==y||e[19]!==v?(S=c.jsx(fS,{placeholder:b,id:v1,icon:y,rootClassName:"flex-1 border-none",value:r,onKeyDown:v,onChange:w}),e[16]=r,e[17]=b,e[18]=y,e[19]=v,e[20]=S):S=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(N=c.jsx("span",{className:"font-bold tracking-wide",children:"Package name:"}),e[21]=N):N=e[21],e[22]===Symbol.for("react.memo_cache_sentinel")?(j=c.jsxs("div",{children:[N," A package name; this will install the latest version.",c.jsx("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),E=c.jsx("span",{className:"font-bold tracking-wide",children:"Package and version:"}),e[22]=j,e[23]=E):(j=e[22],E=e[23]),e[24]===Symbol.for("react.memo_cache_sentinel")?(_=c.jsxs("div",{children:[E," ","A package with a specific version or version range.",c.jsx("div",{className:"text-muted-foreground",children:"Examples: httpx==0.27.0, httpx>=0.27.0"})]}),A=c.jsx("span",{className:"font-bold tracking-wide",children:"Git:"}),e[24]=_,e[25]=A):(_=e[24],A=e[25]),e[26]===Symbol.for("react.memo_cache_sentinel")?(I=c.jsxs("div",{children:[A," A Git repository",c.jsx("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),P=c.jsx("span",{className:"font-bold tracking-wide",children:"URL:"}),e[26]=I,e[27]=P):(I=e[26],P=e[27]),e[28]===Symbol.for("react.memo_cache_sentinel")?(L=c.jsxs("div",{children:[P," A remote wheel or source distribution.",c.jsx("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),O=c.jsx("span",{className:"font-bold tracking-wide",children:"Path:"}),e[28]=L,e[29]=O):(L=e[28],O=e[29]),e[30]===Symbol.for("react.memo_cache_sentinel")?(R=c.jsx(je,{delayDuration:300,side:"left",align:"start",content:c.jsxs("div",{className:"text-sm flex flex-col w-full max-w-[360px]",children:["Packages are installed using the package manager specified in your user configuration. Depending on your package manager, you can install packages with various formats:",c.jsxs("div",{className:"flex flex-col gap-2 mt-2",children:[j,_,I,L,c.jsxs("div",{children:[O," A local wheel, source distribution, or project directory.",c.jsx("div",{className:"text-muted-foreground",children:"Example: /example/foo-0.1.0-py3-none-any.whl"})]})]})]}),children:c.jsx(Im,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),e[30]=R):R=e[30];const F=r&&"bg-accent text-accent-foreground";let D;e[31]!==F?(D=pe("float-right px-2 m-0 h-full text-sm text-secondary-foreground ml-2",F,"disabled:cursor-not-allowed disabled:opacity-50"),e[31]=F,e[32]=D):D=e[32];const T=!r;let k,B;return e[33]!==p||e[34]!==D||e[35]!==T?(k=c.jsx("button",{type:"button",className:D,onClick:p,disabled:T,children:"Add"}),e[33]=p,e[34]=D,e[35]=T,e[36]=k):k=e[36],e[37]!==k||e[38]!==S?(B=c.jsxs("div",{className:"flex items-center w-full border-b",children:[S,R,k]}),e[37]=k,e[38]=S,e[39]=B):B=e[39],B},YM=t=>{const e=H.c(9),{onSuccess:n,packages:o}=t;if(o.length===0){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(an,{title:"No packages",description:"No packages are installed in this environment.",icon:c.jsx(ks,{})}),e[0]=i):i=e[0],i}let r,s,a;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(Fm,{children:c.jsxs(ws,{children:[c.jsx(yr,{children:"Name"}),c.jsx(yr,{children:"Version"}),c.jsx(yr,{})]})}),e[1]=r):r=e[1],e[2]!==n||e[3]!==o){let i;e[5]!==n?(i=l=>c.jsxs(ws,{className:"group",onClick:async()=>{await nn(`${l.name}==${l.version}`),Xe({title:"Copied to clipboard"})},children:[c.jsx(vr,{children:l.name}),c.jsx(vr,{children:l.version}),c.jsxs(vr,{className:"flex justify-end",children:[c.jsx(rk,{packageName:l.name,onSuccess:n}),c.jsx(sk,{packageName:l.name,onSuccess:n})]})]},l.name),e[5]=n,e[6]=i):i=e[6],s=o.map(i),e[2]=n,e[3]=o,e[4]=s}else s=e[4];return e[7]!==s?(a=c.jsxs(zm,{className:"overflow-auto flex-1",children:[r,c.jsx(Bm,{children:s})]}),e[7]=s,e[8]=a):a=e[8],a},rk=({packageName:t,onSuccess:e})=>{const[n,o]=q.useState(!1);return Jt()?null:c.jsx(ok,{onClick:async()=>{try{o(!0);const r=await FR({package:t,upgrade:!0});r.success?(e(),mS(t)):mS(t,r.error)}finally{o(!1)}},loading:n,children:"Upgrade"})},sk=({packageName:t,onSuccess:e})=>{const[n,o]=q.useState(!1);return c.jsx(ok,{onClick:async()=>{try{o(!0);const r=await zR({package:t});r.success?(e(),pS(t)):pS(t,r.error)}finally{o(!1)}},loading:n,children:"Remove"})},KM=t=>{const e=H.c(18),{tree:n,error:o,onSuccess:r}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=new Set,e[0]=s):s=e[0];const[a,i]=q.useState(s);let l,d,u;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{i(new Set)},e[1]=l):l=e[1],e[2]!==n?(d=[n],e[2]=n,e[3]=d):d=e[3],q.useEffect(l,d),o){let x;return e[4]!==o?(x=c.jsx(br,{error:o}),e[4]=o,e[5]=x):x=e[5],x}if(!n){let x;return e[6]===Symbol.for("react.memo_cache_sentinel")?(x=c.jsx(bn,{size:"medium",centered:!0}),e[6]=x):x=e[6],x}if(n.dependencies.length===0){let x;return e[7]===Symbol.for("react.memo_cache_sentinel")?(x=c.jsx(an,{title:"No dependencies",description:"No package dependencies found in this environment.",icon:c.jsx(ks,{})}),e[7]=x):x=e[7],x}e[8]===Symbol.for("react.memo_cache_sentinel")?(u=x=>{i(g=>{const p=new Set(g);return p.has(x)?p.delete(x):p.add(x),p})},e[8]=u):u=e[8];const h=u;let f,m;if(e[9]!==a||e[10]!==r||e[11]!==n.dependencies){let x;e[13]!==a||e[14]!==r?(x=(g,p)=>c.jsx("div",{className:"border-b",children:c.jsx(ak,{nodeId:`root-${p}`,node:g,level:0,isTopLevel:!0,expandedNodes:a,onToggle:h,onSuccess:r})},`${g.name}-${p}`),e[13]=a,e[14]=r,e[15]=x):x=e[15],f=n.dependencies.map(x),e[9]=a,e[10]=r,e[11]=n.dependencies,e[12]=f}else f=e[12];return e[16]!==f?(m=c.jsx("div",{className:"flex-1 overflow-auto",children:c.jsx("div",{children:f})}),e[16]=f,e[17]=m):m=e[17],m},ak=t=>{const e=H.c(57),{nodeId:n,node:o,level:r,isTopLevel:s,expandedNodes:a,onToggle:i,onSuccess:l}=t,d=s!==void 0&&s,u=o.dependencies.length>0;let h;e[0]!==a||e[1]!==n?(h=a.has(n),e[0]=a,e[1]=n,e[2]=h):h=e[2];const f=h,m=d?0:16+16*r;let x;e[3]!==u||e[4]!==n||e[5]!==i?(x=D=>{D.key!=="Enter"&&D.key!==" "||(D.preventDefault(),u&&i(n))},e[3]=u,e[4]=n,e[5]=i,e[6]=x):x=e[6];const g=x;let p;e[7]!==u||e[8]!==n||e[9]!==i?(p=D=>{D.stopPropagation(),u&&i(n)},e[7]=u,e[8]=n,e[9]=i,e[10]=p):p=e[10];const b=p,y=u&&"select-none",v=d?"px-2 py-0.5":"";let w,S;e[11]!==y||e[12]!==v?(w=pe("flex items-center group cursor-pointer text-sm whitespace-nowrap","hover:bg-[var(--slate-2)] focus:bg-[var(--slate-2)] focus:outline-none",y,v),e[11]=y,e[12]=v,e[13]=w):w=e[13],e[14]!==m||e[15]!==d?(S=d?{}:{paddingLeft:`${m}px`},e[14]=m,e[15]=d,e[16]=S):S=e[16];const N=u?f:void 0;let j,E,_,A,I,P,L,O,R,F;return e[17]!==u||e[18]!==f?(j=u?f?c.jsx(ko,{className:"w-4 h-4 mr-2 flex-shrink-0"}):c.jsx(Ma,{className:"w-4 h-4 mr-2 flex-shrink-0"}):c.jsx("div",{className:"w-4 mr-2 flex-shrink-0"}),e[17]=u,e[18]=f,e[19]=j):j=e[19],e[20]!==o.name?(E=c.jsx("span",{className:"font-medium truncate",children:o.name}),e[20]=o.name,e[21]=E):E=e[21],e[22]!==o.version?(_=o.version&&c.jsxs("span",{className:"text-muted-foreground text-xs",children:["v",o.version]}),e[22]=o.version,e[23]=_):_=e[23],e[24]!==E||e[25]!==_?(A=c.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 py-1.5",children:[E,_]}),e[24]=E,e[25]=_,e[26]=A):A=e[26],e[27]!==o.tags?(I=o.tags.map(ZM),e[27]=o.tags,e[28]=I):I=e[28],e[29]!==I?(P=c.jsx("div",{className:"flex items-center gap-1 ml-2",children:I}),e[29]=I,e[30]=P):P=e[30],e[31]!==d||e[32]!==o.name||e[33]!==l?(L=d&&c.jsxs("div",{className:"flex gap-1 invisible group-hover:visible",children:[c.jsx(rk,{packageName:o.name,onSuccess:l}),c.jsx(sk,{packageName:o.name,onSuccess:l})]}),e[31]=d,e[32]=o.name,e[33]=l,e[34]=L):L=e[34],e[35]!==b||e[36]!==g||e[37]!==j||e[38]!==A||e[39]!==P||e[40]!==L||e[41]!==w||e[42]!==S||e[43]!==N?(O=c.jsxs("div",{className:w,style:S,onClick:b,onKeyDown:g,tabIndex:0,role:"treeitem","aria-selected":!1,"aria-expanded":N,children:[j,A,P,L]}),e[35]=b,e[36]=g,e[37]=j,e[38]=A,e[39]=P,e[40]=L,e[41]=w,e[42]=S,e[43]=N,e[44]=O):O=e[44],e[45]!==a||e[46]!==u||e[47]!==f||e[48]!==r||e[49]!==o.dependencies||e[50]!==n||e[51]!==l||e[52]!==i?(R=u&&f&&c.jsx("div",{role:"group",children:o.dependencies.map((D,T)=>c.jsx(ak,{nodeId:`${n}-${T}`,node:D,level:r+1,isTopLevel:!1,expandedNodes:a,onToggle:i,onSuccess:l},`${D.name}-${T}`))}),e[45]=a,e[46]=u,e[47]=f,e[48]=r,e[49]=o.dependencies,e[50]=n,e[51]=l,e[52]=i,e[53]=R):R=e[53],e[54]!==O||e[55]!==R?(F=c.jsxs("div",{children:[O,R]}),e[54]=O,e[55]=R,e[56]=F):F=e[56],F};async function XM(){const[t,e]=await Promise.all([PR(),RR()]);return{list:t.packages,tree:e.tree}}function JM(t){return t.trim()}function ZM(t,e){return t.kind==="cycle"?c.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-orange-300 dark:border-orange-700 text-orange-700 dark:text-orange-300",title:"cycle",children:"cycle"},e):t.kind==="extra"?c.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-blue-300 dark:border-blue-700 text-blue-700 dark:text-blue-300",title:t.value,children:t.value},e):t.kind==="group"?c.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-green-300 dark:border-green-700 text-green-700 dark:text-green-300",title:t.value,children:t.value},e):null}const Lf=Ek("marimo:scratchpadHistory:v1",[]),QM=bt(!1),e7=bt(null,(t,e,n)=>{if(!(n=n.trim()))return;const o=t(Lf),r=[n,...o.filter(s=>s!==n)].slice(0,15);e(Lf,r)}),t7={hide_code:!1,disabled:!1},n7=()=>{const t=H.c(69),e=um(),[n]=fr(),{theme:o}=Ko(),r=M.useRef(null),s=cs(),{createNewCell:a,updateCellCode:i}=at(),l=e.cellRuntime[Xo],d=l==null?void 0:l.output,u=l==null?void 0:l.status,h=l==null?void 0:l.consoleOutputs,f=e.cellData[Xo],m=(f==null?void 0:f.code)??"",x=kt(e7),[g,p]=Mt(QM),b=Ne(Lf);let y;t[0]!==x||t[1]!==m?(y=()=>{gS({code:m}),x(m)},t[0]=x,t[1]=m,t[2]=y):y=t[2];const v=Fe(y);let w;t[3]!==m||t[4]!==a||t[5]!==s?(w=()=>{m.trim()&&a({code:m,before:!1,cellId:s??"__end__"})},t[3]=m,t[4]=a,t[5]=s,t[6]=w):w=t[6];const S=Fe(w);let N;t[7]!==i?(N=()=>{i({cellId:Xo,code:"",formattingChange:!1}),gS({code:""});const se=r.current;se&&se.dispatch({changes:{from:0,to:se.state.doc.length,insert:""}})},t[7]=i,t[8]=N):N=t[8];const j=Fe(N);let E;t[9]!==p||t[10]!==i?(E=se=>{p(!1),i({cellId:Xo,code:se,formattingChange:!1});const be=r.current;be&&be.dispatch({changes:{from:0,to:be.state.doc.length,insert:se}})},t[9]=p,t[10]=i,t[11]=E):E=t[11];const _=Fe(E),[A,I]=M.useState();let P;t[12]!==m||t[13]!==h||t[14]!==v||t[15]!==A||t[16]!==d||t[17]!==o||t[18]!==n?(P=()=>c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[40%]",children:c.jsx(Cu,{theme:o,showPlaceholder:!1,id:Xo,code:m,config:t7,status:"idle",serializedEditorState:null,runCell:v,userConfig:n,editorViewRef:r,setEditorView:se=>{r.current=se},hidden:!1,showHiddenCode:Rn.NOOP,languageAdapter:A,setLanguageAdapter:I})}),c.jsx("div",{className:"flex-1 overflow-auto flex-shrink-0",children:c.jsx(Ac,{allowExpand:!1,output:d,className:"output-area",cellId:Xo,stale:!1,loading:!1})}),c.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[35%]",children:c.jsx(Wm,{consoleOutputs:h,className:"overflow-auto",stale:!1,cellName:_k,onSubmitDebugger:Rn.NOOP,cellId:Xo,debuggerActive:!1})})]}),t[12]=m,t[13]=h,t[14]=v,t[15]=A,t[16]=d,t[17]=o,t[18]=n,t[19]=P):P=t[19];const L=P;let O;t[20]!==_||t[21]!==b||t[22]!==g||t[23]!==o?(O=()=>g?c.jsx("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:c.jsx("div",{className:"overflow-auto flex flex-col gap-3",children:b.map((se,be)=>c.jsx("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>_(se),children:c.jsx(M.Suspense,{children:c.jsx(ri,{language:"python",theme:o,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:se.trim(),editable:!1,readOnly:!0})})},be))})}):null,t[20]=_,t[21]=b,t[22]=g,t[23]=o,t[24]=O):O=t[24];const R=O;let F,D,T,k,B,C,U,V,$,X,Y;t[25]===Symbol.for("react.memo_cache_sentinel")?(F=_a.create(Xo),D=c.jsx("p",{className:"mx-2 my-2 text-muted-foreground text-sm",children:"Use this scratchpad cell to experiment with code without restrictions on variable names. Scratchpad code is ephemeral: variables defined in the scratchpad aren't saved to notebook memory, and the code is not saved in the notebook file."}),t[25]=F,t[26]=D):(F=t[25],D=t[26]),t[27]===Symbol.for("react.memo_cache_sentinel")?(T=Ht("cell.run"),t[27]=T):T=t[27],t[28]===Symbol.for("react.memo_cache_sentinel")?(k=c.jsx(wr,{color:"var(--grass-11)",size:16}),t[28]=k):k=t[28],t[29]!==v||t[30]!==g?(B=c.jsx(je,{content:T,children:c.jsx(ve,{"data-testid":"scratchpad-run-button",onClick:v,disabled:g,variant:"text",size:"xs",children:k})}),t[29]=v,t[30]=g,t[31]=B):B=t[31],t[32]===Symbol.for("react.memo_cache_sentinel")?(C=c.jsx(op,{size:16}),t[32]=C):C=t[32],t[33]!==j||t[34]!==g?(U=c.jsx(je,{content:"Clear code and outputs",children:c.jsx(ve,{disabled:g,size:"xs",variant:"text",onClick:j,children:C})}),t[33]=j,t[34]=g,t[35]=U):U=t[35],t[36]===Symbol.for("react.memo_cache_sentinel")?(V=c.jsx(kr,{size:16}),t[36]=V):V=t[36],t[37]!==S||t[38]!==g?($=c.jsx(Ms,{children:c.jsx(je,{content:"Insert code",children:c.jsx(ve,{disabled:g,size:"xs",variant:"text",onClick:S,children:V})})}),t[37]=S,t[38]=g,t[39]=$):$=t[39],t[40]!==u?(X=(u==="running"||u==="queued")&&c.jsx(bn,{className:"inline",size:"small"}),t[40]=u,t[41]=X):X=t[41],t[42]===Symbol.for("react.memo_cache_sentinel")?(Y=c.jsx("div",{className:"flex-1"}),t[42]=Y):Y=t[42];const J=g&&"bg-[var(--sky-3)] rounded-none";let Q,W;t[43]!==J?(Q=pe(J),t[43]=J,t[44]=Q):Q=t[44],t[45]!==g||t[46]!==p?(W=()=>p(!g),t[45]=g,t[46]=p,t[47]=W):W=t[47];const K=b.length===0;let oe,re,ne,ae,te,me,ce;return t[48]===Symbol.for("react.memo_cache_sentinel")?(oe=c.jsx(dp,{size:16}),t[48]=oe):oe=t[48],t[49]!==Q||t[50]!==W||t[51]!==K?(re=c.jsx(je,{content:"Toggle history",children:c.jsx(ve,{size:"xs",variant:"text",className:Q,onClick:W,disabled:K,children:oe})}),t[49]=Q,t[50]=W,t[51]=K,t[52]=re):re=t[52],t[53]!==B||t[54]!==U||t[55]!==$||t[56]!==X||t[57]!==re?(ne=c.jsxs("div",{className:"flex items-center flex-shrink-0",children:[B,U,$,X,Y,re]}),t[53]=B,t[54]=U,t[55]=$,t[56]=X,t[57]=re,t[58]=ne):ne=t[58],t[59]!==L?(ae=L(),t[59]=L,t[60]=ae):ae=t[60],t[61]!==R?(te=R(),t[61]=R,t[62]=te):te=t[62],t[63]!==ae||t[64]!==te?(me=c.jsxs("div",{className:"flex-1 divide-y relative overflow-hidden flex flex-col",children:[ae,te]}),t[63]=ae,t[64]=te,t[65]=me):me=t[65],t[66]!==ne||t[67]!==me?(ce=c.jsxs("div",{className:"flex flex-col h-full overflow-hidden divide-y",id:F,children:[D,ne,me]}),t[66]=ne,t[67]=me,t[68]=ce):ce=t[68],ce},o7=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx(n7,{}),t[0]=e):e=t[0],e},r7=()=>{const t=H.c(23),{openModal:e,closeModal:n}=Cn();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const{data:r,isPending:s,error:a,refetch:i}=En(a7,o);if(s){let b;return t[1]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(bn,{size:"medium",centered:!0}),t[1]=b):b=t[1],b}if(a){let b;return t[2]!==a?(b=c.jsx(br,{error:a}),t[2]=a,t[3]=b):b=t[3],b}let l;t[4]!==r?(l=r.filter(i7).map(l7),t[4]=r,t[5]=l):l=t[5];const d=l;if(r.length===0){let b;return t[6]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(an,{title:"No environment variables",description:"No environment variables are available in this notebook.",icon:c.jsx(Wc,{})}),t[6]=b):b=t[6],b}let u,h,f,m,x,g,p;return t[7]!==n||t[8]!==e||t[9]!==d||t[10]!==i?(u=()=>e(c.jsx(hg,{providerNames:d,onSuccess:()=>{i(),n()},onClose:n})),t[7]=n,t[8]=e,t[9]=d,t[10]=i,t[11]=u):u=t[11],t[12]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(Yo,{className:"h-4 w-4"}),t[12]=h):h=t[12],t[13]!==u?(f=c.jsx("div",{className:"flex justify-end h-8 border-b",children:c.jsx("button",{type:"button",className:"float-right border-l px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:u,children:h})}),t[13]=u,t[14]=f):f=t[14],t[15]===Symbol.for("react.memo_cache_sentinel")?(m=c.jsx(Fm,{children:c.jsxs(ws,{children:[c.jsx(yr,{children:"Environment Variable"}),c.jsx(yr,{children:"Source"}),c.jsx(yr,{})]})}),t[15]=m):m=t[15],t[16]!==r?(x=r.map(c7),t[16]=r,t[17]=x):x=t[17],t[18]!==x?(g=c.jsxs(zm,{className:"overflow-auto flex-1 mb-16",children:[m,c.jsx(Bm,{children:x})]}),t[18]=x,t[19]=g):g=t[19],t[20]!==f||t[21]!==g?(p=c.jsxs("div",{className:"flex flex-col h-full",children:[f,g]}),t[20]=f,t[21]=g,t[22]=p):p=t[22],p},s7=t=>{const e=H.c(9),{className:n,ariaLabel:o,onCopy:r}=t,[s,a]=q.useState(!1);let i;e[0]!==r?(i=()=>{r(),a(!0),setTimeout(()=>a(!1),1e3)},e[0]=r,e[1]=i):i=e[1];const l=i;let d,u;return e[2]!==s?(d=s?c.jsx(ic,{className:"w-3 h-3 text-green-700 rounded"}):c.jsx(Ea,{className:"w-3 h-3 hover:bg-muted rounded"}),e[2]=s,e[3]=d):d=e[3],e[4]!==o||e[5]!==n||e[6]!==l||e[7]!==d?(u=c.jsx("button",{type:"button",className:n,onClick:l,"aria-label":o,children:d}),e[4]=o,e[5]=n,e[6]=l,e[7]=d,e[8]=u):u=e[8],u};async function a7(){return ug((await IS.request({})).secrets)}function i7(t){return t.provider!=="env"}function l7(t){return t.name}function c7(t){return t.keys.map(e=>c.jsxs(ws,{className:"group",children:[c.jsx(vr,{children:e}),c.jsx(vr,{children:t.provider!=="env"&&c.jsx(eS,{variant:"outline",className:"select-none",children:t.name})}),c.jsx(vr,{children:c.jsx(s7,{ariaLabel:`Copy ${e}`,onCopy:async()=>{await nn(`os.environ["${e}"]`),Xe({title:"Copied to clipboard",description:`os.environ["${e}"] has been copied to your clipboard.`})},className:pe("float-right px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible")})})]},`${t.name}-${e}`))}const d7=t=>{const e=H.c(6),{children:n}=t,{openModal:o,closeModal:r}=Cn();let s,a;return e[0]!==r||e[1]!==o?(s=()=>o(c.jsx(h7,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(a=c.jsx(q3,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=a):a=e[5],a},u7=[He.lineWrapping],h7=t=>{const e=H.c(23),{onClose:n}=t,[o,r]=M.useState(""),{theme:s}=Ko();let a,i,l,d,u,h;e[0]!==n?(a=async v=>{v.preventDefault();const w=new FormData(v.target),S=w.get("title"),N=w.get("description"),j=w.get("code");fetch("https://marimo.io/api/suggest-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:S,description:N,code:j})}),n(),Xe({title:"Snippet Submitted",description:"Thank you for contributing! We will review your snippet shortly."})},e[0]=n,e[1]=a):a=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(Uo,{children:"Contribute a Snippet"}),e[2]=i):i=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsxs(rs,{children:[i,c.jsxs(ss,{children:["Have a useful snippet you want to share with the community? Submit it here or make a pull request"," ",c.jsx("a",{href:Dn.githubPage,target:"_blank",className:"underline",children:"on GitHub"}),"."]})]}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx($o,{id:"title",name:"title",autoFocus:!0,placeholder:"Title",required:!0,autoComplete:"off"}),u=c.jsx(BR,{id:"description",name:"description",autoFocus:!0,placeholder:"Description",rows:5,required:!0,autoComplete:"off"}),e[4]=d,e[5]=u):(d=e[4],u=e[5]),e[6]!==o?(h=c.jsx("input",{type:"hidden",name:"code",value:o}),e[6]=o,e[7]=h):h=e[7];const f=s==="dark"?"dark":"light";let m,x,g,p,b,y;return e[8]!==o||e[9]!==f?(m=c.jsx(ri,{theme:f,language:"python",className:"cm border rounded overflow-hidden",extensions:u7,value:o,onChange:r}),e[8]=o,e[9]=f,e[10]=m):m=e[10],e[11]!==h||e[12]!==m?(x=c.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[d,u,h,m]}),e[11]=h,e[12]=m,e[13]=x):x=e[13],e[14]!==n?(g=c.jsx(ve,{"data-testid":"snippet-cancel-button",variant:"secondary",onClick:n,children:"Cancel"}),e[14]=n,e[15]=g):g=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx(ve,{"data-testid":"snippet-send-button","aria-label":"Save",variant:"default",type:"submit",children:"Send"}),e[16]=p):p=e[16],e[17]!==g?(b=c.jsxs(Ca,{children:[g,p]}),e[17]=g,e[18]=b):b=e[18],e[19]!==a||e[20]!==b||e[21]!==x?(y=c.jsx(Vo,{className:"w-fit",children:c.jsxs("form",{onSubmit:a,children:[l,x,b]})}),e[19]=a,e[20]=b,e[21]=x,e[22]=y):y=e[22],y},f7=[He.lineWrapping],m7=()=>{const t=H.c(20),[e,n]=q.useState();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const{data:r,error:s,isPending:a}=En(x7,o);if(s){let b;return t[1]!==s?(b=c.jsx(br,{error:s}),t[1]=s,t[2]=b):b=t[2],b}if(a||!r){let b;return t[3]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(bn,{size:"medium",centered:!0}),t[3]=b):b=t[3],b}const i=e?"h-1/3":"h-full";let l,d,u,h,f,m,x,g,p;return t[4]!==i?(l=pe("border-b rounded-none",i),t[4]=i,t[5]=l):l=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(Oa,{placeholder:"Search snippets...",className:"h-6 m-1",rootClassName:"flex-1 border-r"}),t[6]=d):d=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsxs("div",{className:"flex items-center w-full",children:[d,c.jsx(d7,{children:c.jsx("button",{className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:c.jsx(Yo,{className:"h-4 w-4"})})})]}),h=c.jsx(nc,{children:"No results"}),t[7]=u,t[8]=h):(u=t[7],h=t[8]),t[9]===Symbol.for("react.memo_cache_sentinel")?(f=b=>n(b),t[9]=f):f=t[9],t[10]!==r.snippets?(m=c.jsx(g7,{onSelect:f,snippets:r.snippets}),t[10]=r.snippets,t[11]=m):m=t[11],t[12]!==l||t[13]!==m?(x=c.jsxs(dc,{className:l,children:[u,h,m]}),t[12]=l,t[13]=m,t[14]=x):x=t[14],t[15]!==e?(g=c.jsx(M.Suspense,{children:c.jsx("div",{className:"h-2/3 snippet-viewer flex flex-col",children:e?c.jsx(p7,{snippet:e},e.title):c.jsx(an,{title:"",description:"Click on a snippet to view its content."})})}),t[15]=e,t[16]=g):g=t[16],t[17]!==x||t[18]!==g?(p=c.jsxs("div",{className:"flex-1 overflow-hidden",children:[x,g]}),t[17]=x,t[18]=g,t[19]=p):p=t[19],p},p7=t=>{const e=H.c(27),{snippet:n}=t,{theme:o}=Ko(),{createNewCell:r}=at(),s=cs();let a;e[0]!==r||e[1]!==s||e[2]!==n.sections?(a=()=>{for(const p of[...n.sections].reverse())p.code&&r({code:p.code,before:!1,cellId:s??"__end__",skipIfCodeExists:!0})},e[0]=r,e[1]=s,e[2]=n.sections,e[3]=a):a=e[3];const i=a;let l;e[4]!==r||e[5]!==s?(l=p=>{r({code:p,before:!1,cellId:s??"__end__"})},e[4]=r,e[5]=s,e[6]=l):l=e[6];const d=l;let u,h,f,m,x,g;if(e[7]!==n.title?(u=c.jsx("div",{className:"text-sm font-semibold bg-muted border-y px-2 py-1",children:n.title}),e[7]=n.title,e[8]=u):u=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(kr,{className:"ml-2 h-4 w-4"}),e[9]=h):h=e[9],e[10]!==i?(f=c.jsx("div",{className:"flex justify-end",children:c.jsx(Ms,{children:c.jsxs(ve,{className:"float-right",size:"xs",variant:"outline",onClick:i,children:["Insert snippet",h]})})}),e[10]=i,e[11]=f):f=e[11],e[12]!==d||e[13]!==n.sections||e[14]!==n.title||e[15]!==o){let p;e[17]!==d||e[18]!==n.title||e[19]!==o?(p=b=>{const{code:y,html:v,id:w}=b;return v?c.jsx("div",{children:Om({html:v})},`${n.title}-${w}`):y?c.jsxs("div",{className:"relative hover-actions-parent pr-2",children:[c.jsx(Ms,{children:c.jsx(je,{content:"Insert snippet",children:c.jsx(ve,{className:"absolute -top-2 -right-1 z-10 hover-action px-2 bg-background",size:"sm",variant:"outline",onClick:()=>{d(y)},children:c.jsx(kr,{className:"h-5 w-5"})})})}),c.jsx(M.Suspense,{children:c.jsx(ri,{theme:o==="dark"?"dark":"light",language:"python",className:"cm border rounded overflow-hidden",extensions:f7,value:y,readOnly:!0},`${n.title}-${w}`)})]},`${n.title}-${w}`):null},e[17]=d,e[18]=n.title,e[19]=o,e[20]=p):p=e[20],m=n.sections.map(p),e[12]=d,e[13]=n.sections,e[14]=n.title,e[15]=o,e[16]=m}else m=e[16];return e[21]!==f||e[22]!==m?(x=c.jsxs("div",{className:"px-2 py-2 space-y-4 overflow-auto flex-1",children:[f,m]}),e[21]=f,e[22]=m,e[23]=x):x=e[23],e[24]!==u||e[25]!==x?(g=c.jsxs(c.Fragment,{children:[u,x]}),e[24]=u,e[25]=x,e[26]=g):g=e[26],g},g7=t=>{const e=H.c(7),{snippets:n,onSelect:o}=t;let r,s;if(e[0]!==o||e[1]!==n){let a;e[3]!==o?(a=i=>c.jsx(Yn,{className:"rounded-none",onSelect:()=>o(i),children:c.jsx("div",{className:"flex flex-row gap-2 items-center",children:c.jsx("span",{className:"mt-1 text-accent-foreground",children:i.title})})},i.title),e[3]=o,e[4]=a):a=e[4],r=n.map(a),e[0]=o,e[1]=n,e[2]=r}else r=e[2];return e[5]!==r?(s=c.jsx(km,{className:"flex flex-col overflow-auto",children:r}),e[5]=r,e[6]=s):s=e[6],s};function x7(){return UR()}const b7=q.lazy(()=>Nm(()=>import("./tracing-LdOjU5ad.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125]),import.meta.url).then(t=>({default:t.Tracing}))),y7=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx(q.Suspense,{fallback:c.jsx(v7,{}),children:c.jsx(b7,{})}),t[0]=e):e=t[0],e},v7=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:c.jsx(bn,{})}),t[0]=e):e=t[0],e},ik="name",lk="type-value",Ff="defs-refs",w7=[{id:ik,accessorFn:t=>[t.name,t.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>c.jsx(Um,{header:"Name",column:t}),cell:({getValue:t})=>{const[e,n]=t();return c.jsx(Kh,{name:e,declaredBy:n})}},{id:lk,accessorFn:t=>[t.dataType,t.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>c.jsx(Um,{header:c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("span",{children:"Type"}),c.jsx("span",{children:"Value"})]}),column:t}),cell:({getValue:t})=>{const[e,n]=t();return c.jsxs("div",{className:"max-w-[150px]",children:[c.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs",children:e}),c.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap",title:n??"",children:n})]})}},{id:Ff,accessorFn:t=>[t.declaredBy,t.usedBy,t.name,t.declaredByNames,t.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:t})=>c.jsx(Um,{header:c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("span",{children:"Declared By"}),c.jsx("span",{children:"Used By"})]}),column:t}),cell:({getValue:t})=>{const[e,n,o]=t(),r=s=>{const a=Aa(s);a&&Dm(a,o)};return c.jsxs("div",{className:"flex flex-col gap-1 py-1",children:[c.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-center",children:[c.jsx("span",{title:"Declared by",children:c.jsx(Tp,{className:"w-3.5 h-3.5 text-muted-foreground"})}),e.length===1?c.jsx(_o,{variant:"focus",cellId:e[0],skipScroll:!0,onClick:()=>r(e[0])}):c.jsx("div",{className:"text-destructive flex flex-row gap-2",children:e.slice(0,3).map((s,a)=>c.jsxs("span",{className:"flex",children:[c.jsx(_o,{variant:"focus",cellId:s,skipScroll:!0,className:"whitespace-nowrap text-destructive",onClick:()=>r(s)},s),a<e.length-1&&", "]},s))})]}),c.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-baseline",children:[c.jsx("span",{title:"Used by",children:c.jsx(mi,{className:"w-3.5 h-3.5 text-muted-foreground"})}),c.jsx(T2,{maxCount:3,cellIds:n,skipScroll:!0,onClick:r})]})]})}}],ck=M.memo(({className:t,cellIds:e,variables:n})=>{const[o,r]=q.useState([]),[s,a]=q.useState(""),i=$R(),l=M.useMemo(()=>{const h=f=>{const m=i[f];return GR(m)?`cell-${e.indexOf(f)}`:m??`cell-${e.indexOf(f)}`};return Object.values(n).map(f=>({...f,declaredByNames:f.declaredBy.map(h),usedByNames:f.usedBy.map(h)}))},[n,i,e]),d=M.useMemo(()=>{const h=new Map;return e.forEach((f,m)=>h.set(f,m)),function({variables:f,sort:m,cellIdToIndex:x}){m||(m={id:Ff,desc:!1});let g=[];switch(m.id){case ik:g=li(f,p=>p.name);break;case lk:g=li(f,p=>p.dataType);break;case Ff:g=li(f,p=>x.get(p.declaredBy[0]))}return m.desc?g.reverse():g}({variables:l,sort:o[0],cellIdToIndex:h})},[l,o,e]),u=VR({data:d,columns:w7,getCoreRowModel:qR(),onGlobalFilterChange:a,getFilteredRowModel:WR(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter:h=>h.columnDef.enableGlobalFilter??!0,globalFilterFn:"auto",manualSorting:!0,onSortingChange:r,getSortedRowModel:HR(),state:{sorting:o,globalFilter:s}});return c.jsxs(c.Fragment,{children:[c.jsx(fS,{className:"w-full",placeholder:"Search",value:s,onChange:h=>a(h.target.value)}),c.jsxs(zm,{className:pe("w-full text-sm flex-1 border-separate border-spacing-0",t),children:[c.jsx(Fm,{children:c.jsx(ws,{className:"whitespace-nowrap text-xs",children:u.getFlatHeaders().map(h=>c.jsx(yr,{className:"sticky top-0 bg-background border-b",children:xS(h.column.columnDef.header,h.getContext())},h.id))})}),c.jsx(Bm,{children:u.getRowModel().rows.map(h=>c.jsx(ws,{className:"hover:bg-accent",children:h.getVisibleCells().map(f=>c.jsx(vr,{className:"border-b",children:xS(f.column.columnDef.cell,f.getContext())},f.id))},h.id))})]})]})});ck.displayName="VariableTable";const k7=()=>{const t=H.c(4),e=Pm(),n=xr();if(Object.keys(e).length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(an,{title:"No variables",description:"Global variables will appear here.",icon:c.jsx(Hl,{})}),t[0]=r):r=t[0],r}let o;return t[1]!==n.inOrderIds||t[2]!==e?(o=c.jsx(ck,{className:"flex-1",cellIds:n.inOrderIds,variables:e}),t[1]=n.inOrderIds,t[2]=e,t[3]=o):o=t[3],o},S7=t=>{const e=H.c(54),n=Ne(YR),o=Ne(Z_),r=at(),s=T3(),a=t.cellId,i=o[t.cellId],l=Za(t.cellId),d=l.code,u=Qa(t.cellId);let h,f,m,x,g,p,b,y,v,w,S,N,j,E;if(e[0]!==r||e[1]!==s||e[2]!==n.focusedCellId||e[3]!==o||e[4]!==t.cellId||e[5]!==i||e[6]!==l.code||e[7]!==u.errored){if(h={id:a,graph:i,code:d,hasError:u.errored},n.focusedCellId&&o[n.focusedCellId]){const D=o[n.focusedCellId];let T;e[20]!==n.focusedCellId||e[21]!==D?(T={id:n.focusedCellId,graph:D},e[20]=n.focusedCellId,e[21]=D,e[22]=T):T=e[22],x=T}m=(x==null?void 0:x.id)===h.id,f=uk(h.graph)?1.5:3;const O=()=>{m?s.blurCell():(r.focusCell({cellId:h.id,where:"exact"}),s.focusCell({cellId:h.id}))};N=h.id;const R=m?"text-primary-foreground":"text-[var(--gray-8)] hover:text-[var(--gray-9)]";e[23]!==R?(g=pe("group bg-transparent text-left w-full flex relative justify-between items-center","border-none rounded cursor-pointer","h-[21px] pl-[51px] font-inherit",R),e[23]=R,e[24]=g):g=e[24],p=O,b=A7;const F=m&&"bg-primary group-hover:bg-primary";e[25]!==F?(S=pe("group-hover:bg-[var(--gray-2)] flex h-full w-full px-0.5 items-center rounded",F),e[25]=F,e[26]=S):S=e[26],y="truncate px-1 font-mono text-sm flex gap-1",v=h.code,w=h.graph.variables.length>0?c.jsx(E7,{cell:h,selectedCell:x}):c.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap max-w-full",children:C7(h.code)??c.jsx("span",{className:"italic",children:"empty"})}),e[0]=r,e[1]=s,e[2]=n.focusedCellId,e[3]=o,e[4]=t.cellId,e[5]=i,e[6]=l.code,e[7]=u.errored,e[8]=h,e[9]=f,e[10]=m,e[11]=x,e[12]=g,e[13]=p,e[14]=b,e[15]=y,e[16]=v,e[17]=w,e[18]=S,e[19]=N}else h=e[8],f=e[9],m=e[10],x=e[11],g=e[12],p=e[13],b=e[14],y=e[15],v=e[16],w=e[17],S=e[18],N=e[19];e[27]!==y||e[28]!==v||e[29]!==w?(j=c.jsx("div",{className:y,title:v,children:w}),e[27]=y,e[28]=v,e[29]=w,e[30]=j):j=e[30],e[31]!==j||e[32]!==S?(E=c.jsx("div",{className:S,children:j}),e[31]=j,e[32]=S,e[33]=E):E=e[33];const _=m?"z-30":"z-20";let A,I,P,L;return e[34]!==h||e[35]!==x||e[36]!==_?(A=pe("absolute overflow-visible top-[10.5px] left-[calc(var(--spacing-extra-small,8px)_+_17px)] pointer-events-none",_,function({cell:O,selectedCell:R}){return O.hasError?"text-destructive":!R&&!uk(O.graph)?"text-foreground":(R==null?void 0:R.id)===O.id||R!=null&&R.graph.parents.has(O.id)||R!=null&&R.graph.children.has(O.id)?"text-primary":"text-[var(--gray-8)]"}({cell:h,selectedCell:x})),e[34]=h,e[35]=x,e[36]=_,e[37]=A):A=e[37],e[38]!==h||e[39]!==f||e[40]!==m||e[41]!==t.cellPositions||e[42]!==x?(I=m?c.jsx(_7,{cell:h,cellPositions:t.cellPositions,circleRadius:f}):c.jsx(I7,{cell:h,selectedCell:x,circleRadius:f}),e[38]=h,e[39]=f,e[40]=m,e[41]=t.cellPositions,e[42]=x,e[43]=I):I=e[43],e[44]!==A||e[45]!==I?(P=c.jsx("svg",{className:A,width:"1",height:"1",children:I}),e[44]=A,e[45]=I,e[46]=P):P=e[46],e[47]!==g||e[48]!==p||e[49]!==b||e[50]!==E||e[51]!==P||e[52]!==N?(L=c.jsxs("button",{"data-node-id":N,className:g,onClick:p,onMouseDown:b,children:[E,P]}),e[47]=g,e[48]=p,e[49]=b,e[50]=E,e[51]=P,e[52]=N,e[53]=L):L=e[53],L},N7=t=>{const e=H.c(28),{open:n,setOpen:o}=t,r=xr();let s;e[0]!==r.inOrderIds?(s=Object.fromEntries(r.inOrderIds.map(T7)),e[0]=r.inOrderIds,e[1]=s):s=e[1];const a=s;let i;if(e[2]!==r){i=[];let v=0;for(const[w,S]of r.getColumns().entries())w>0&&i.push(v),v+=S.inOrderIds.length;e[2]=r,e[3]=i}else i=e[3];const l=n?"translate-x-0":"translate-x-[calc(100%+20px)]";let d,u,h,f,m,x,g,p,b,y;if(e[4]!==l?(d=pe("fixed top-14 right-5 z-50 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 rounded-lg border shadow-lg w-64 flex flex-col max-h-[58vh]","motion-safe:transition-transform motion-safe:duration-200 motion-safe:ease-in-out",l),e[4]=l,e[5]=d):d=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx("span",{className:"text-sm font-semibold",children:"Minimap"}),e[6]=u):u=e[6],e[7]!==o?(h=()=>o(!1),e[7]=o,e[8]=h):h=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(f=c.jsx(_n,{className:"h-4 w-4"}),e[9]=f):f=e[9],e[10]!==h?(m=c.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[u,c.jsx(ve,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:h,children:f})]}),e[10]=h,e[11]=m):m=e[11],e[12]!==r.inOrderIds||e[13]!==a||e[14]!==i){let v;e[16]!==a||e[17]!==i?(v=(w,S)=>{const N=i.includes(S);return c.jsxs(M.Fragment,{children:[N&&c.jsx("div",{className:"absolute left-5 w-[36px] h-px bg-[var(--gray-4)] pointer-events-none","aria-hidden":"true"}),c.jsx(S7,{cellId:w,cellPositions:a})]},w)},e[16]=a,e[17]=i,e[18]=v):v=e[18],x=r.inOrderIds.map(v),e[12]=r.inOrderIds,e[13]=a,e[14]=i,e[15]=x}else x=e[15];return e[19]!==x?(g=c.jsx("div",{className:"py-3 pl-3 pr-4 relative min-h-full",children:x}),e[19]=x,e[20]=g):g=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx("div",{className:"h-0 overflow-hidden","aria-hidden":"true"}),e[21]=p):p=e[21],e[22]!==g?(b=c.jsxs("div",{className:"overflow-y-auto overflow-x-hidden flex-1 scrollbar-none",children:[g,p]}),e[22]=g,e[23]=b):b=e[23],e[24]!==b||e[25]!==d||e[26]!==m?(y=c.jsxs("div",{className:d,children:[m,b]}),e[24]=b,e[25]=d,e[26]=m,e[27]=y):y=e[27],y},j7=()=>{const t=H.c(5),[e,n]=Mt(Nb);let o,r;return t[0]!==n?(o=()=>n(M7),t[0]=n,t[1]=o):o=t[1],Ot("global.toggleMinimap",o),t[2]!==e||t[3]!==n?(r=c.jsx(N7,{open:e,setOpen:n}),t[2]=e,t[3]=n,t[4]=r):r=t[4],r};function C7(t){return t.split(`
148
- `)[0].trim()||void 0}const E7=t=>{const e=H.c(11),{cell:n,selectedCell:o}=t,r=Pm(),s=n.id===(o==null?void 0:o.id);let a,i;if(e[0]!==n.graph.variables||e[1]!==s||e[2]!==o||e[3]!==r){let l;e[5]!==s||e[6]!==o||e[7]!==r?(l=(d,u)=>{const h=r[d];return c.jsxs(M.Fragment,{children:[u>0&&", ",c.jsx("span",{className:pe({"font-bold":s,"text-foreground":o===void 0,"text-primary font-medium":!s&&Q_(h,o)}),children:d})]},d)},e[5]=s,e[6]=o,e[7]=r,e[8]=l):l=e[8],a=n.graph.variables.map(l),e[0]=n.graph.variables,e[1]=s,e[2]=o,e[3]=r,e[4]=a}else a=e[4];return e[9]!==a?(i=c.jsx(c.Fragment,{children:a}),e[9]=a,e[10]=i):i=e[10],i},_7=t=>{const e=H.c(12),{cell:n,cellPositions:o,circleRadius:r}=t;let s,a,i,l;if(e[0]!==n.graph.children||e[1]!==n.graph.parents||e[2]!==n.id||e[3]!==o){s=[];const d=o[n.id]??0,u=new Set;for(const h of n.graph.parents)n.graph.children.has(h)&&u.add(h);for(const h of u){const f=o[h];if(f!==void 0){const m=21*(f-d);s.push(c.jsx("path",{d:`M -3 0 H -7 v ${m} h 14 v ${-m} H 3`,fill:"none",strokeWidth:"2",stroke:"currentColor"},`${n.id}-cycle-${h}`))}}for(const h of n.graph.parents){if(u.has(h))continue;const f=o[h];if(f!==void 0){const m=21*(f-d);s.push(c.jsx("path",{d:`M -3 0 H -7 v ${m} h -4`,fill:"none",strokeWidth:"2",stroke:"currentColor"},`${n.id}-up-${h}`))}}for(const h of n.graph.children){if(u.has(h))continue;const f=o[h];if(f!==void 0){const m=21*(f-d);s.push(c.jsx("path",{d:`M 3 0 H 7 v ${m} h 4`,fill:"none",strokeWidth:"2",stroke:"currentColor"},`${n.id}-down-${h}`))}}e[0]=n.graph.children,e[1]=n.graph.parents,e[2]=n.id,e[3]=o,e[4]=s}else s=e[4];return e[5]!==r?(a=c.jsx("circle",{r,fill:"currentColor",className:"pointer-events-auto"}),e[5]=r,e[6]=a):a=e[6],e[7]!==s?(i=c.jsx("g",{className:"pen pointer-events-auto",children:s}),e[7]=s,e[8]=i):i=e[8],e[9]!==a||e[10]!==i?(l=c.jsxs("g",{transform:"translate(0, 0)",children:[a,i]}),e[9]=a,e[10]=i,e[11]=l):l=e[11],l};function I7(t){const{cell:e,selectedCell:n,circleRadius:o}=t,r=e.graph.ancestors.size>0,s=e.graph.descendants.size>0;if(!n)return dk({circleRadius:o,leftWisker:r,rightWisker:s});const a=n.graph.ancestors.has(e.id),i=n.graph.descendants.has(e.id);return dk(a||i?{circleRadius:o,leftWisker:r,rightWisker:s,shift:a&&i?void 0:a?"left":"right"}:{circleRadius:o,leftWisker:!1,rightWisker:!1})}function dk(t){const{circleRadius:e,leftWisker:n,rightWisker:o,shift:r}=t,s=r===void 0?0:r==="left"?-14:14;return c.jsxs("g",{transform:`translate(${s}, 0)`,children:[c.jsxs("g",{children:[n&&c.jsx("path",{d:"M 0 0 h -8",fill:"none",strokeWidth:"2",stroke:"currentColor"}),o&&c.jsx("path",{d:"M 0 0 h 8",fill:"none",strokeWidth:"2",stroke:"currentColor"})]}),c.jsx("circle",{r:e,fill:"currentColor",className:"pointer-events-auto"})]})}function uk(t){return t.variables.length===0&&t.ancestors.size===0&&t.descendants.size===0}function A7(t){return t.preventDefault()}function T7(t,e){return[t,e]}function M7(t){return!t}const O7=q.lazy(()=>Nm(()=>import("./terminal-CVJhAvK-.js"),__vite__mapDeps([126,1,2,127]),import.meta.url)),D7=t=>{const e=H.c(122),{children:n}=t,{isSidebarOpen:o,isTerminalOpen:r,selectedPanel:s}=ac(),{setIsSidebarOpen:a,setIsTerminalOpen:i}=za(),l=q.useRef(null),d=q.useRef(null);let u,h,f,m,x;e[0]!==o?(u=()=>{if(!l.current)return;const Pe=l.current.isCollapsed();o&&Pe&&l.current.expand(),o||Pe||l.current.collapse(),requestAnimationFrame(R7)},h=[o],e[0]=o,e[1]=u,e[2]=h):(u=e[1],h=e[2]),M.useEffect(u,h),e[3]!==r?(f=()=>{if(!d.current)return;const Pe=d.current.isCollapsed();r&&Pe&&d.current.expand(),r||Pe||d.current.collapse(),requestAnimationFrame(F7)},m=[r],e[3]=r,e[4]=f,e[5]=m):(f=e[4],m=e[5]),M.useEffect(f,m),e[6]!==n?(x=c.jsx(Dc,{id:"app",className:"relative h-full",children:c.jsx(M.Suspense,{children:n})},"app"),e[6]=n,e[7]=x):x=e[7];const g=x,p=o?"resize-handle":"resize-handle-collapsed";let b,y;e[8]!==p?(b=pe("border-border no-print z-10",p,"vertical"),e[8]=p,e[9]=b):b=e[9],e[10]!==b?(y=c.jsx(bS,{onDragging:yS,className:b}),e[10]=b,e[11]=y):y=e[11];const v=y,w=r?"resize-handle":"resize-handle-collapsed";let S,N;e[12]!==w?(S=pe("border-border no-print z-20",w,"horizontal"),e[12]=w,e[13]=S):S=e[13],e[14]!==S?(N=c.jsx(bS,{onDragging:yS,className:S}),e[14]=S,e[15]=N):N=e[15];const j=N;let E,_,A,I,P,L,O,R,F,D,T,k,B,C,U,V,$,X,Y,J,Q;e[16]!==s?(E=c.jsx("div",{className:"text-sm text-[var(--slate-11)] uppercase tracking-wide font-semibold flex-1",children:s}),e[16]=s,e[17]=E):E=e[17],e[18]!==a?(_=()=>a(!1),e[18]=a,e[19]=_):_=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(A=c.jsx(_n,{className:"w-4 h-4"}),e[20]=A):A=e[20],e[21]!==_?(I=c.jsx(ve,{"data-testid":"close-helper-pane",className:"m-0",size:"xs",variant:"text",onClick:_,children:A}),e[21]=_,e[22]=I):I=e[22],e[23]!==E||e[24]!==I?(P=c.jsxs("div",{className:"p-3 border-b flex justify-between items-center",children:[E,I]}),e[23]=E,e[24]=I,e[25]=P):P=e[25],e[26]!==s?(L=s==="files"&&c.jsx(Qw,{}),e[26]=s,e[27]=L):L=e[27],e[28]!==s?(O=s==="errors"&&c.jsx(vM,{}),e[28]=s,e[29]=O):O=e[29],e[30]!==s?(R=s==="variables"&&c.jsx(k7,{}),e[30]=s,e[31]=R):R=e[31],e[32]!==s?(F=s==="dependencies"&&c.jsx(sM,{}),e[32]=s,e[33]=F):F=e[33],e[34]!==s?(D=s==="packages"&&c.jsx(qM,{}),e[34]=s,e[35]=D):D=e[35],e[36]!==s?(T=s==="outline"&&c.jsx(WM,{}),e[36]=s,e[37]=T):T=e[37],e[38]!==s?(k=s==="datasources"&&c.jsx(bM,{}),e[38]=s,e[39]=k):k=e[39],e[40]!==s?(B=s==="documentation"&&c.jsx(yM,{}),e[40]=s,e[41]=B):B=e[41],e[42]!==s?(C=s==="snippets"&&c.jsx(m7,{}),e[42]=s,e[43]=C):C=e[43],e[44]!==s?(U=s==="scratchpad"&&c.jsx(o7,{}),e[44]=s,e[45]=U):U=e[45],e[46]!==s?(V=s==="chat"&&c.jsx(E8,{}),e[46]=s,e[47]=V):V=e[47],e[48]!==s?($=s==="logs"&&c.jsx(ek,{}),e[48]=s,e[49]=$):$=e[49],e[50]!==s?(X=s==="tracing"&&c.jsx(y7,{}),e[50]=s,e[51]=X):X=e[51],e[52]!==s?(Y=s==="secrets"&&c.jsx(r7,{}),e[52]=s,e[53]=Y):Y=e[53],e[54]!==L||e[55]!==O||e[56]!==R||e[57]!==F||e[58]!==D||e[59]!==T||e[60]!==k||e[61]!==B||e[62]!==C||e[63]!==U||e[64]!==V||e[65]!==$||e[66]!==X||e[67]!==Y?(J=c.jsx(M.Suspense,{children:c.jsxs(Tc,{children:[L,O,R,F,D,T,k,B,C,U,V,$,X,Y]})}),e[54]=L,e[55]=O,e[56]=R,e[57]=F,e[58]=D,e[59]=T,e[60]=k,e[61]=B,e[62]=C,e[63]=U,e[64]=V,e[65]=$,e[66]=X,e[67]=Y,e[68]=J):J=e[68],e[69]!==P||e[70]!==J?(Q=c.jsx(uc,{children:c.jsxs("div",{className:"flex flex-col h-full flex-1 overflow-hidden mr-[-4px]",children:[P,J]})}),e[69]=P,e[70]=J,e[71]=Q):Q=e[71];const W=Q,K=o&&"border-r border-l border-[var(--slate-7)]";let oe,re,ne,ae,te,me;e[72]!==K?(oe=pe("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",K),e[72]=K,e[73]=oe):oe=e[73],e[74]===Symbol.for("react.memo_cache_sentinel")?(re=(Pe,Le)=>{var Ze;Le===0&&Pe===10&&((Ze=l.current)==null||Ze.resize(30))},e[74]=re):re=e[74],e[75]!==a?(ne=()=>a(!1),ae=()=>a(!0),e[75]=a,e[76]=ne,e[77]=ae):(ne=e[76],ae=e[77]),e[78]!==W||e[79]!==v?(te=c.jsxs("span",{className:"flex flex-row h-full",children:[W," ",v]}),e[78]=W,e[79]=v,e[80]=te):te=e[80],e[81]!==oe||e[82]!==ne||e[83]!==ae||e[84]!==te?(me=c.jsx(Dc,{ref:l,id:"helper",collapsedSize:0,collapsible:!0,className:oe,minSize:10,defaultSize:0,maxSize:75,onResize:re,onCollapse:ne,onExpand:ae,children:te},"helper"),e[81]=oe,e[82]=ne,e[83]=ae,e[84]=te,e[85]=me):me=e[85];const ce=me,se=r&&"border-[var(--slate-7)]";let be,ue,Se,Me,Ee,Re,Ae,Ye,Ve;e[86]!==se?(be=pe("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",se),e[86]=se,e[87]=be):be=e[87],e[88]===Symbol.for("react.memo_cache_sentinel")?(ue=(Pe,Le)=>{var Ze;Le===0&&Pe===10&&((Ze=d.current)==null||Ze.resize(30))},e[88]=ue):ue=e[88],e[89]!==i?(Se=()=>i(!1),Me=()=>i(!0),e[89]=i,e[90]=Se,e[91]=Me):(Se=e[90],Me=e[91]),e[92]===Symbol.for("react.memo_cache_sentinel")?(Ee=c.jsx("div",{}),e[92]=Ee):Ee=e[92],e[93]!==i?(Re=()=>i(!1),e[93]=i,e[94]=Re):Re=e[94],e[95]!==r||e[96]!==Re?(Ae=c.jsx(M.Suspense,{fallback:Ee,children:c.jsx(O7,{visible:r,onClose:Re})}),e[95]=r,e[96]=Re,e[97]=Ae):Ae=e[97],e[98]!==r||e[99]!==Ae?(Ye=c.jsx(aM,{isOpen:r,children:Ae}),e[98]=r,e[99]=Ae,e[100]=Ye):Ye=e[100],e[101]!==be||e[102]!==Se||e[103]!==Me||e[104]!==Ye||e[105]!==j?(Ve=c.jsxs(Dc,{ref:d,id:"terminal",collapsedSize:0,collapsible:!0,className:be,minSize:10,defaultSize:0,maxSize:75,onResize:ue,onCollapse:Se,onExpand:Me,children:[j,Ye]},"terminal"),e[101]=be,e[102]=Se,e[103]=Me,e[104]=Ye,e[105]=j,e[106]=Ve):Ve=e[106];const Ge=Ve;let ee,ye,we,Te,G,he,xe,de,ke;return e[107]===Symbol.for("react.memo_cache_sentinel")?(ee=BL(),e[107]=ee):ee=e[107],e[108]===Symbol.for("react.memo_cache_sentinel")?(ye=c.jsx(Tc,{children:c.jsx(c6,{})}),e[108]=ye):ye=e[108],e[109]!==Ge?(we=c.jsx(kb,{capability:"terminal",children:Ge}),e[109]=Ge,e[110]=we):we=e[110],e[111]!==g||e[112]!==we?(Te=c.jsx(Dc,{children:c.jsxs(vS,{autoSaveId:"marimo:chrome:v1:l1",direction:"vertical",children:[g,we]})}),e[111]=g,e[112]=we,e[113]=Te):Te=e[113],e[114]===Symbol.for("react.memo_cache_sentinel")?(G=c.jsx(KR,{}),e[114]=G):G=e[114],e[115]!==ce||e[116]!==Te?(he=c.jsxs(vS,{autoSaveId:"marimo:chrome:v1:l2",direction:"horizontal",storage:ee,children:[ye,ce,Te,G]}),e[115]=ce,e[116]=Te,e[117]=he):he=e[117],e[118]===Symbol.for("react.memo_cache_sentinel")?(xe=c.jsx(j7,{}),e[118]=xe):xe=e[118],e[119]===Symbol.for("react.memo_cache_sentinel")?(de=c.jsx(uc,{children:c.jsx(Tc,{children:c.jsx(r6,{})})}),e[119]=de):de=e[119],e[120]!==he?(ke=c.jsxs(UL,{children:[he,xe,de]}),e[120]=he,e[121]=ke):ke=e[121],ke};function P7(){window.dispatchEvent(new Event("resize"))}function R7(){requestAnimationFrame(P7)}function L7(){window.dispatchEvent(new Event("resize"))}function F7(){requestAnimationFrame(L7)}let hk;hk=new URL(window.location.href).searchParams.get(XR.showChrome)==="false",VS=Object.freeze(Object.defineProperty({__proto__:null,default:t=>{const e=H.c(10);if(hk){let s,a,i;return e[0]!==t?(s=c.jsx(wb,{hideControls:!0,...t}),e[0]=t,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx(Wp,{}),e[2]=a):a=e[2],e[3]!==s?(i=c.jsxs(c.Fragment,{children:[s,a]}),e[3]=s,e[4]=i):i=e[4],i}let n,o,r;return e[5]!==t?(n=c.jsx(wb,{...t}),e[5]=t,e[6]=n):n=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(o=c.jsx(Wp,{}),e[7]=o):o=e[7],e[8]!==n?(r=c.jsxs(D7,{children:[n,o]}),e[8]=n,e[9]=r):r=e[9],r}},Symbol.toStringTag,{value:"Module"}))});export{Km as C,Rc as E,an as P,KL as __tla,Lc as a,VS as e,Ns as f};
147
+ `).length),position:{x:0,y:0}}}createElements(t,e,n,o){const r=[],s=[],a=new Set,i=new Set;for(const l of Object.values(n)){if(l.value==="marimo"&&l.name==="mo")continue;const{declaredBy:d,usedBy:u}=l;for(const h of d)for(const f of u){const m=`${h}-${f}`;i.has(m)||(i.add(m),a.add(h),a.add(f),s.push(this.createEdge(h,f)))}}for(const[l,d]of Mm.zip(t,e)){o||r.push(this.createNode(l,d));const u=a.has(l),h=Qe.get(d).code.trim().startsWith("mo.md");!u&&h||r.push(this.createNode(l,d))}return{nodes:r,edges:s}}},eM=t=>{const e=H.c(43),{cellIds:n,variables:o,cellAtoms:r,children:s,layoutDirection:a,settings:i}=t;let l;e[0]!==r||e[1]!==n||e[2]!==a||e[3]!==i.hidePureMarkdown||e[4]!==o?(l=()=>{let k=qw.createElements(n,r,o,i.hidePureMarkdown);return k=Ww({nodes:k.nodes,edges:k.edges,direction:a}),k},e[0]=r,e[1]=n,e[2]=a,e[3]=i.hidePureMarkdown,e[4]=o,e[5]=l):l=e[5];const[d]=M.useState(l),[u,h,f]=N2(d.nodes),[m,x,g]=j2(d.edges),p=wa();let b;e[6]!==a||e[7]!==x||e[8]!==h?(b=k=>{const B=Ww({nodes:k.nodes,edges:k.edges,direction:a});h(B.nodes),x(B.edges)},e[6]=a,e[7]=x,e[8]=h,e[9]=b):b=e[9];const y=Fe(b);let v,w;e[10]!==r||e[11]!==n||e[12]!==i.hidePureMarkdown||e[13]!==y||e[14]!==o?(v=()=>{y(qw.createElements(n,r,o,i.hidePureMarkdown))},w=[n,o,r,y,i.hidePureMarkdown],e[10]=r,e[11]=n,e[12]=i.hidePureMarkdown,e[13]=y,e[14]=o,e[15]=v,e[16]=w):(v=e[15],w=e[16]),M.useEffect(v,w);const[S,N]=M.useState();let j;M2(),e[17]===Symbol.for("react.memo_cache_sentinel")?(j=()=>{N(void 0)},e[17]=j):j=e[17];const E=j;let _,A,I,P,L,O,R,F,D,T;return e[18]===Symbol.for("react.memo_cache_sentinel")?(_={minZoom:.5,maxZoom:1.5},A=(k,B)=>{N({type:"node",id:B.id})},I=(k,B)=>{const{source:C,target:U}=B;N({type:"edge",source:C,target:U})},e[18]=_,e[19]=A,e[20]=I):(_=e[18],A=e[19],I=e[20]),e[21]===Symbol.for("react.memo_cache_sentinel")?(P=c.jsx(vT,{color:"#ccc",variant:Sn.Dots}),e[21]=P):P=e[21],e[22]!==p||e[23]!==u?(L=()=>{const k=Qe.get(JP);if(k){const B=u.find(C=>C.id===k);B&&(p.fitView({padding:1,duration:600,nodes:[B]}),N({type:"node",id:k}))}},e[22]=p,e[23]=u,e[24]=L):L=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(O=c.jsx(pp,{className:"size-4"}),e[25]=O):O=e[25],e[26]!==L?(R=c.jsx(mT,{position:"bottom-right",showInteractive:!1,children:c.jsx(je,{content:"Jump to focused cell",delayDuration:200,side:"left",asChild:!1,children:c.jsx(ts,{onMouseDown:Pn.preventFocus,onClick:L,children:O})})}),e[26]=L,e[27]=R):R=e[27],e[28]!==m||e[29]!==S||e[30]!==o?(F=c.jsx(zl,{selection:S,variables:o,edges:m,onClearSelection:E}),e[28]=m,e[29]=S,e[30]=o,e[31]=F):F=e[31],e[32]!==s||e[33]!==m||e[34]!==u||e[35]!==g||e[36]!==f||e[37]!==R||e[38]!==F?(D=c.jsxs(Gh,{nodes:u,edges:m,nodeTypes:A2,minZoom:.2,fitViewOptions:_,onNodeClick:A,onEdgeClick:I,onNodeDoubleClick:tM,fitView:!0,onNodesChange:f,onEdgesChange:g,zoomOnDoubleClick:!1,nodesConnectable:!1,children:[P,R,F,s]}),e[32]=s,e[33]=m,e[34]=u,e[35]=g,e[36]=f,e[37]=R,e[38]=F,e[39]=D):D=e[39],e[40]!==a||e[41]!==D?(T=c.jsx(_2,{value:a,children:D}),e[40]=a,e[41]=D,e[42]=T):T=e[42],T};function tM(t,e){tS(e.id,"focus")}const nM=bt("_minimap_"),oM=bt({hidePureMarkdown:!0}),rM=t=>{const e=H.c(11),[n,o]=Mt(nM),[r,s]=Mt(oM);let a;e[0]!==n||e[1]!==t||e[2]!==o||e[3]!==s||e[4]!==r?(a=()=>n==="_minimap_"?c.jsx(jT,{...t,children:c.jsx(Xh,{settings:r,onSettingsChange:s,view:n,onChange:o})}):c.jsx(eM,{...t,settings:r,layoutDirection:n,children:c.jsx(Xh,{settings:r,onSettingsChange:s,view:n,onChange:o})}),e[0]=n,e[1]=t,e[2]=o,e[3]=s,e[4]=r,e[5]=a):a=e[5];const i=a;let l,d;return e[6]!==i?(l=i(),e[6]=i,e[7]=l):l=e[7],e[8]!==n||e[9]!==l?(d=c.jsx(qh,{children:l},n),e[8]=n,e[9]=l,e[10]=d):d=e[10],d},sM=()=>{const t=H.c(5),e=Pm(),n=xr(),[o]=ZP();let r,s;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=pe("w-full h-full flex-1 mx-auto -mb-4 relative"),t[0]=r):r=t[0],t[1]!==n.inOrderIds||t[2]!==o||t[3]!==e?(s=c.jsx("div",{className:r,children:c.jsx(rM,{cellAtoms:o,variables:e,cellIds:n.inOrderIds})}),t[1]=n.inOrderIds,t[2]=o,t[3]=e,t[4]=s):s=t[4],s},aM=t=>{const e=H.c(4),{isOpen:n,children:o}=t,[r,s]=q.useState(!1);let a,i;return e[0]!==r||e[1]!==n?(a=()=>{n&&!r&&s(!0)},i=[n,r],e[0]=r,e[1]=n,e[2]=a,e[3]=i):(a=e[2],i=e[3]),q.useEffect(a,i),r?o:null},iM=t=>{const e=H.c(8),{variableName:n,className:o}=t;let r;e[0]!==n?(r=()=>{const l=function(u){const h=Qe.get(fc)[u];if(h)return h.declaredBy[0]}(n);if(!l)return;const d=Aa(l);d&&Dm(d,n)},e[0]=n,e[1]=r):r=e[1];const s=r;let a,i;return e[2]!==o?(a=pe("text-link opacity-80 hover:opacity-100 hover:underline",o),e[2]=o,e[3]=a):a=e[3],e[4]!==s||e[5]!==a||e[6]!==n?(i=c.jsx("button",{type:"button",onClick:s,className:a,children:n}),e[4]=s,e[5]=a,e[6]=n,e[7]=i):i=e[7],i},lM=bt(t=>{const e=t(QP),n=t(fc),o=t(ti);return li(e,r=>{if(!r.variable_name)return-1;const s=Object.values(n).find(i=>i.name===r.variable_name);if(!s)return 0;const a=o.inOrderIds.indexOf(s.declaredBy[0]);return a===-1?0:a})}),cM=bt(t=>{const e=new Map(t(eR));for(const n of nS){const o=e.get(n);o&&o.databases.length===0&&e.delete(n)}return li([...e.values()],n=>nS.has(n.name)?1:0)}),dM=()=>{const t=H.c(32),[e,n]=q.useState(""),o=kt(oS),r=Ne(lM),s=Ne(cM);if(r.length===0&&s.length===0){let b;return t[0]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(an,{title:"No tables found",description:"Any datasets/dataframes in the global scope will be shown here.",action:c.jsx(gg,{children:c.jsxs(ve,{variant:"outline",size:"sm",children:["Add database or catalog",c.jsx(Yo,{className:"h-4 w-4 ml-2"})]})}),icon:c.jsx(Ho,{})}),t[0]=b):b=t[0],b}const a=!!e.trim();let i,l,d,u,h,f,m,x,g,p;if(t[1]!==o?(i=b=>{o(b.length>0),n(b)},t[1]=o,t[2]=i):i=t[2],t[3]!==e||t[4]!==i?(l=c.jsx(Oa,{placeholder:"Search tables...",className:"h-6 m-1",value:e,onValueChange:i,rootClassName:"flex-1 border-r"}),t[3]=e,t[4]=i,t[5]=l):l=t[5],t[6]!==a?(d=a&&c.jsx("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:()=>n(""),children:c.jsx(_n,{className:"h-4 w-4"})}),t[6]=a,t[7]=d):d=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx(gg,{children:c.jsx("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:c.jsx(Yo,{className:"h-4 w-4"})})}),t[8]=u):u=t[8],t[9]!==l||t[10]!==d?(h=c.jsxs("div",{className:"flex items-center w-full",children:[l,d,u]}),t[9]=l,t[10]=d,t[11]=h):h=t[11],t[12]!==s||t[13]!==a||t[14]!==e){let b;t[16]!==a||t[17]!==e?(b=y=>c.jsx(uM,{connection:y,hasChildren:y.databases.length>0,children:y.databases.map(v=>c.jsx(hM,{engineName:y.name,database:v,hasSearch:a,children:c.jsx(fM,{schemas:v.schemas,defaultSchema:y.default_schema,defaultDatabase:y.default_database,engineName:y.name,databaseName:v.name,hasSearch:a,searchValue:e})},v.name))},y.name),t[16]=a,t[17]=e,t[18]=b):b=t[18],f=s.map(b),t[12]=s,t[13]=a,t[14]=e,t[15]=f}else f=t[15];return t[19]!==s.length||t[20]!==r.length?(m=s.length>0&&r.length>0&&c.jsxs(rS,{children:[c.jsx(Jl,{className:"h-4 w-4 text-muted-foreground"}),c.jsx("span",{className:"text-xs",children:"Python"})]}),t[19]=s.length,t[20]=r.length,t[21]=m):m=t[21],t[22]!==e||t[23]!==r?(x=r.length>0&&c.jsx(Gw,{tables:r,searchValue:e}),t[22]=e,t[23]=r,t[24]=x):x=t[24],t[25]!==f||t[26]!==m||t[27]!==x?(g=c.jsxs(km,{className:"flex flex-col",children:[f,m,x]}),t[25]=f,t[26]=m,t[27]=x,t[28]=g):g=t[28],t[29]!==h||t[30]!==g?(p=c.jsxs(dc,{className:"border-b bg-background rounded-none h-full pb-10 overflow-auto outline-none",shouldFilter:!1,children:[h,g]}),t[29]=h,t[30]=g,t[31]=p):p=t[31],p},uM=t=>{const e=H.c(25),{connection:n,children:o,hasChildren:r}=t,s=n.name===tR,a=s?"In-Memory":n.name,[i,l]=q.useState(!1);let d;e[0]!==n.name?(d=async()=>{l(!0),await oR({engine:n.name}),setTimeout(()=>l(!1),500)},e[0]=n.name,e[1]=d):d=e[1];const u=d;let h,f,m;e[2]!==n.dialect?(h=c.jsx(qk,{className:"h-4 w-4 text-muted-foreground",name:n.dialect}),e[2]=n.dialect,e[3]=h):h=e[3],e[4]!==n.dialect?(f=nR(n.dialect),e[4]=n.dialect,e[5]=f):f=e[5],e[6]!==f?(m=c.jsx("span",{className:"text-xs",children:f}),e[6]=f,e[7]=m):m=e[7];const x=a;let g,p,b,y,v;return e[8]!==x?(g=c.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",c.jsx(iM,{variableName:x}),")"]}),e[8]=x,e[9]=g):g=e[9],e[10]!==u||e[11]!==s||e[12]!==i?(p=!s&&c.jsx(je,{content:"Refresh connection",children:c.jsx(ve,{variant:"ghost",size:"icon",className:"ml-auto hover:bg-transparent hover:shadow-none",onClick:u,children:c.jsx(kc,{className:pe("h-4 w-4 text-muted-foreground hover:text-foreground",i&&"animate-[spin_0.5s]")})})}),e[10]=u,e[11]=s,e[12]=i,e[13]=p):p=e[13],e[14]!==h||e[15]!==m||e[16]!==g||e[17]!==p?(b=c.jsxs(rS,{children:[h,m,g,p]}),e[14]=h,e[15]=m,e[16]=g,e[17]=p,e[18]=b):b=e[18],e[19]!==o||e[20]!==r?(y=r?o:c.jsx(Oc,{content:"No databases available",className:"pl-2"}),e[19]=o,e[20]=r,e[21]=y):y=e[21],e[22]!==b||e[23]!==y?(v=c.jsxs(c.Fragment,{children:[b,y]}),e[22]=b,e[23]=y,e[24]=v):v=e[24],v},hM=t=>{const e=H.c(28),{hasSearch:n,engineName:o,database:r,children:s}=t,[a,i]=q.useState(!1),[l,d]=q.useState(!1);let u,h,f;e[0]!==n?(u=()=>{i(n)},h=[n],e[0]=n,e[1]=u,e[2]=h):(u=e[1],h=e[2]),q.useEffect(u,h),e[3]!==a||e[4]!==l?(f=()=>{i(!a),d(!l)},e[3]=a,e[4]=l,e[5]=f):f=e[5];const m=`${o}:${r.name}`;let x;e[6]!==a?(x=c.jsx(dS,{isExpanded:a}),e[6]=a,e[7]=x):x=e[7];const g=l&&a?"text-foreground":"text-muted-foreground";let p,b;e[8]!==g?(p=pe("h-4 w-4",g),e[8]=g,e[9]=p):p=e[9],e[10]!==p?(b=c.jsx(Ho,{className:p}),e[10]=p,e[11]=b):b=e[11];const y=l&&a&&"font-semibold";let v,w,S,N;e[12]!==y?(v=pe(y),e[12]=y,e[13]=v):v=e[13],e[14]!==r.name?(w=r.name===""?c.jsx("i",{children:"Not connected"}):r.name,e[14]=r.name,e[15]=w):w=e[15],e[16]!==v||e[17]!==w?(S=c.jsx("span",{className:v,children:w}),e[16]=v,e[17]=w,e[18]=S):S=e[18],e[19]!==S||e[20]!==f||e[21]!==m||e[22]!==x||e[23]!==b?(N=c.jsxs(Yn,{className:"text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",onSelect:f,value:m,children:[x,b,S]}),e[19]=S,e[20]=f,e[21]=m,e[22]=x,e[23]=b,e[24]=N):N=e[24];const j=a&&s;let E;return e[25]!==N||e[26]!==j?(E=c.jsxs(c.Fragment,{children:[N,j]}),e[25]=N,e[26]=j,e[27]=E):E=e[27],E},fM=t=>{const e=H.c(20),{schemas:n,defaultSchema:o,defaultDatabase:r,engineName:s,databaseName:a,hasSearch:i,searchValue:l}=t;if(n.length===0){let h;return e[0]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(Oc,{content:"No schemas available",className:"pl-6"}),e[0]=h):h=e[0],h}let d,u;if(e[1]!==a||e[2]!==r||e[3]!==o||e[4]!==s||e[5]!==i||e[6]!==n||e[7]!==l){let h;e[9]!==l?(h=x=>!l||x.tables.some(g=>g.name.toLowerCase().includes(l.toLowerCase())),e[9]=l,e[10]=h):h=e[10];const f=n.filter(h);let m;e[11]!==a||e[12]!==r||e[13]!==o||e[14]!==s||e[15]!==i||e[16]!==l?(m=x=>c.jsx(mM,{databaseName:a,schema:x,hasSearch:i,children:c.jsx(Gw,{tables:x.tables,searchValue:l,sqlTableContext:{engine:s,database:a,schema:x.name,defaultSchema:o,defaultDatabase:r}})},x.name),e[11]=a,e[12]=r,e[13]=o,e[14]=s,e[15]=i,e[16]=l,e[17]=m):m=e[17],d=f.map(m),e[1]=a,e[2]=r,e[3]=o,e[4]=s,e[5]=i,e[6]=n,e[7]=l,e[8]=d}else d=e[8];return e[18]!==d?(u=c.jsx(c.Fragment,{children:d}),e[18]=d,e[19]=u):u=e[19],u},mM=t=>{const e=H.c(26),{databaseName:n,schema:o,children:r,hasSearch:s}=t,[a,i]=q.useState(!1),[l,d]=q.useState(!1),u=`${n}:${o.name}`;let h,f,m,x;if(e[0]!==s?(h=()=>{i(s)},f=[s],e[0]=s,e[1]=h,e[2]=f):(h=e[1],f=e[2]),q.useEffect(h,f),cS(o.name))return r;e[3]!==a||e[4]!==l?(m=()=>{i(!a),d(!l)},e[3]=a,e[4]=l,e[5]=m):m=e[5],e[6]!==a?(x=c.jsx(dS,{isExpanded:a}),e[6]=a,e[7]=x):x=e[7];const g=l&&a&&"text-foreground";let p,b;e[8]!==g?(p=pe("h-4 w-4 text-muted-foreground",g),e[8]=g,e[9]=p):p=e[9],e[10]!==p?(b=c.jsx(dR,{className:p}),e[10]=p,e[11]=b):b=e[11];const y=l&&a&&"font-semibold";let v,w,S;e[12]!==y?(v=pe(y),e[12]=y,e[13]=v):v=e[13],e[14]!==o.name||e[15]!==v?(w=c.jsx("span",{className:v,children:o.name}),e[14]=o.name,e[15]=v,e[16]=w):w=e[16],e[17]!==w||e[18]!==m||e[19]!==x||e[20]!==b||e[21]!==u?(S=c.jsxs(Yn,{className:"text-sm flex flex-row gap-1 items-center pl-5 cursor-pointer rounded-none",onSelect:m,value:u,children:[x,b,w]}),e[17]=w,e[18]=m,e[19]=x,e[20]=b,e[21]=u,e[22]=S):S=e[22];const N=a&&r;let j;return e[23]!==S||e[24]!==N?(j=c.jsxs(c.Fragment,{children:[S,N]}),e[23]=S,e[24]=N,e[25]=j):j=e[25],j},Gw=t=>{const e=H.c(24),{tables:n,sqlTableContext:o,searchValue:r}=t,{addTableList:s}=sS(),[a,i]=q.useState(!1),[l,d]=q.useState(!1);let u,h;e[0]!==s||e[1]!==o||e[2]!==n.length||e[3]!==a?(u=async()=>{if(n.length===0&&o&&!a){i(!0),d(!0);const{engine:p,database:b,schema:y}=o,v=await DL.request({engine:p,database:b,schema:y});if(!(v!=null&&v.tables))throw d(!1),new Error("No tables available");s({tables:v.tables,sqlTableContext:o}),d(!1)}},e[0]=s,e[1]=o,e[2]=n.length,e[3]=a,e[4]=u):u=e[4],e[5]!==o||e[6]!==n.length||e[7]!==a?(h=[n.length,o,a],e[5]=o,e[6]=n.length,e[7]=a,e[8]=h):h=e[8];const{isPending:f,error:m}=En(u,h);if(f||l){let p;return e[9]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx(aS,{message:"Loading tables...",className:"pl-12"}),e[9]=p):p=e[9],p}if(m){let p;return e[10]!==m?(p=c.jsx(iS,{error:m,className:"pl-12"}),e[10]=m,e[11]=p):p=e[11],p}if(n.length===0){let p;return e[12]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx(Oc,{content:"No tables found",className:"pl-9"}),e[12]=p):p=e[12],p}let x,g;if(e[13]!==r||e[14]!==o||e[15]!==n){let p;e[17]!==r?(p=v=>!r||v.name.toLowerCase().includes(r.toLowerCase()),e[17]=r,e[18]=p):p=e[18];const b=n.filter(p);let y;e[19]!==r||e[20]!==o?(y=v=>c.jsx(pM,{table:v,sqlTableContext:o,isSearching:!!r},v.name),e[19]=r,e[20]=o,e[21]=y):y=e[21],x=b.map(y),e[13]=r,e[14]=o,e[15]=n,e[16]=x}else x=e[16];return e[22]!==x?(g=c.jsx(c.Fragment,{children:x}),e[22]=x,e[23]=g):g=e[23],g},pM=t=>{const e=H.c(64),{table:n,sqlTableContext:o,isSearching:r}=t,{addTable:s}=sS(),[a,i]=q.useState(!1),[l,d]=q.useState(!1),u=n.columns.length>0;let h,f;e[0]!==s||e[1]!==a||e[2]!==o||e[3]!==n.name||e[4]!==u||e[5]!==l?(h=async()=>{if(a&&!u&&o&&!l){d(!0);const{engine:J,database:Q,schema:W}=o,K=await PL.request({engine:J,database:Q,schema:W,tableName:n.name});if(!(K!=null&&K.table))throw new Error("No table details available");s({table:K.table,sqlTableContext:o})}},e[0]=s,e[1]=a,e[2]=o,e[3]=n.name,e[4]=u,e[5]=l,e[6]=h):h=e[6],e[7]!==a||e[8]!==u?(f=[a,u],e[7]=a,e[8]=u,e[9]=f):f=e[9];const{isFetching:m,isPending:x,error:g}=En(h,f),p=Ne(Kl),b=cs(),{createNewCell:y}=at(),v=lS();let w;e[10]!==v||e[11]!==p||e[12]!==y||e[13]!==b||e[14]!==o||e[15]!==n?(w=()=>{Gn({autoInstantiate:p,createNewCell:y,fromCellId:b}),v((()=>{if(n.source_type==="catalog"){const J=o!=null&&o.database?`${o.database}.${n.name}`:n.name;return`${n.engine}.load_table("${J}")`}if(o)return uS({table:n,columnName:"*",sqlTableContext:o});switch(n.source_type){case"local":return`mo.ui.table(${n.name})`;case"duckdb":case"connection":return uS({table:n,columnName:"*",sqlTableContext:o});default:return oc(n.source_type),""}})())},e[10]=v,e[11]=p,e[12]=y,e[13]=b,e[14]=o,e[15]=n,e[16]=w):w=e[16];const S=w;let N;e[17]!==n.num_columns||e[18]!==n.num_rows?(N=()=>{const J=[];return n.num_rows!=null&&J.push(`${n.num_rows} rows`),n.num_columns!=null&&J.push(`${n.num_columns} columns`),J.length===0?null:c.jsx("div",{className:"flex flex-row gap-2 items-center pl-6 group-hover:hidden",children:c.jsx("span",{className:"text-xs text-muted-foreground",children:J.join(", ")})})},e[17]=n.num_columns,e[18]=n.num_rows,e[19]=N):N=e[19];const j=N;let E;e[20]!==g||e[21]!==m||e[22]!==x||e[23]!==o||e[24]!==n?(E=()=>{if(x||m)return c.jsx(aS,{message:"Loading columns...",className:"pl-12"});if(g)return c.jsx(iS,{error:g,className:"pl-12"});const J=n.columns;return J.length===0?c.jsx(Oc,{content:"No columns found",className:"pl-12"}):J.map(Q=>c.jsx(gM,{table:n,column:Q,sqlTableContext:o},Q.name))},e[20]=g,e[21]=m,e[22]=x,e[23]=o,e[24]=n,e[25]=E):E=e[25];const _=E;let A;e[26]!==a||e[27]!==r||e[28]!==n.source_type||e[29]!==n.type?(A=()=>{if(n.source_type==="local")return;const J=n.type==="table"?rR:Hf;return c.jsx(J,{className:"h-3 w-3",strokeWidth:a||r?2.5:void 0})},e[26]=a,e[27]=r,e[28]=n.source_type,e[29]=n.type,e[30]=A):A=e[30];const I=A,P=o?`${o.database}.${o.schema}.${n.name}`:n.name,L=o&&(cS(o.schema)?"pl-9":"pl-12"),O=(a||r)&&"font-semibold";let R,F,D,T,k,B,C,U,V,$,X,Y;return e[31]!==L||e[32]!==O?(R=pe("rounded-none group h-8 cursor-pointer",L,O),e[31]=L,e[32]=O,e[33]=R):R=e[33],e[34]!==a?(F=()=>i(!a),e[34]=a,e[35]=F):F=e[35],e[36]!==I?(D=I(),e[36]=I,e[37]=D):D=e[37],e[38]!==n.name?(T=c.jsx("span",{className:"text-sm",children:n.name}),e[38]=n.name,e[39]=T):T=e[39],e[40]!==D||e[41]!==T?(k=c.jsxs("div",{className:"flex gap-2 items-center flex-1",children:[D,T]}),e[40]=D,e[41]=T,e[42]=k):k=e[42],e[43]!==j?(B=j(),e[43]=j,e[44]=B):B=e[44],e[45]!==S?(C=Pn.stopPropagation(()=>S()),e[45]=S,e[46]=C):C=e[46],e[47]===Symbol.for("react.memo_cache_sentinel")?(U=c.jsx(sR,{className:"h-3 w-3"}),e[47]=U):U=e[47],e[48]!==C?(V=c.jsx(je,{content:"Add table to notebook",delayDuration:400,children:c.jsx(ve,{className:"group-hover:inline-flex hidden",variant:"text",size:"icon",onClick:C,children:U})}),e[48]=C,e[49]=V):V=e[49],e[50]!==a||e[51]!==F||e[52]!==k||e[53]!==B||e[54]!==V||e[55]!==R||e[56]!==P?($=c.jsxs(Yn,{className:R,value:P,"aria-selected":a,forceMount:!0,onSelect:F,children:[k,B,V]}),e[50]=a,e[51]=F,e[52]=k,e[53]=B,e[54]=V,e[55]=R,e[56]=P,e[57]=$):$=e[57],e[58]!==a||e[59]!==_?(X=a&&_(),e[58]=a,e[59]=_,e[60]=X):X=e[60],e[61]!==$||e[62]!==X?(Y=c.jsxs(c.Fragment,{children:[$,X]}),e[61]=$,e[62]=X,e[63]=Y):Y=e[63],Y},gM=t=>{var C,U;const e=H.c(51),{table:n,column:o,sqlTableContext:r}=t,[s,a]=q.useState(!1),i=Ne(oS),l=kt(aR);let d,u;e[0]!==i?(d=()=>{i&&a(!1)},u=[i],e[0]=i,e[1]=d,e[2]=u):(d=e[1],u=e[2]),q.useEffect(d,u),l(s?V=>new Set([...V,`${n.name}:${o.name}`]):V=>(V.delete(`${n.name}:${o.name}`),new Set(V)));const h=lS(),{columnsPreviews:f}=iR();let m;e[3]!==o.name||e[4]!==n.primary_keys?(m=((C=n.primary_keys)==null?void 0:C.includes(o.name))||!1,e[3]=o.name,e[4]=n.primary_keys,e[5]=m):m=e[5];const x=m;let g;e[6]!==o.name||e[7]!==n.indexes?(g=((U=n.indexes)==null?void 0:U.includes(o.name))||!1,e[6]=o.name,e[7]=n.indexes,e[8]=g):g=e[8];const p=g;let b;e[9]!==h?(b=V=>{h(V)},e[9]=h,e[10]=b):b=e[10];const y=b,v=xM,w=s?"font-semibold":"";let S;e[11]!==o.name||e[12]!==w?(S=c.jsx("span",{className:w,children:o.name}),e[11]=o.name,e[12]=w,e[13]=S):S=e[13];const N=S,j=`${n.name}.${o.name}`,E=`${n.name}.${o.name}`;let _;e[14]!==s?(_=()=>a(!s),e[14]=s,e[15]=_):_=e[15];const A=r?"pl-14":"pl-7";let I,P,L,O,R,F,D,T,k,B;return e[16]!==A?(I=pe("flex flex-row gap-2 items-center flex-1",A),e[16]=A,e[17]=I):I=e[17],e[18]!==o.type||e[19]!==N?(P=c.jsx(lR,{columnName:N,dataType:o.type}),e[18]=o.type,e[19]=N,e[20]=P):P=e[20],e[21]!==x?(L=x&&v({tooltipContent:"Primary key",content:"PK"}),e[21]=x,e[22]=L):L=e[22],e[23]!==p?(O=p&&v({tooltipContent:"Indexed",content:"IDX"}),e[23]=p,e[24]=O):O=e[24],e[25]!==I||e[26]!==P||e[27]!==L||e[28]!==O?(R=c.jsxs("div",{className:I,children:[P,L,O]}),e[25]=I,e[26]=P,e[27]=L,e[28]=O,e[29]=R):R=e[29],e[30]!==o.name?(F=c.jsx(je,{content:"Copy column name",delayDuration:400,children:c.jsx(ve,{variant:"text",size:"icon",className:"group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground",children:c.jsx(Z3,{tooltip:!1,value:o.name,className:"h-3 w-3"})})}),e[30]=o.name,e[31]=F):F=e[31],e[32]!==o.external_type?(D=c.jsx("span",{className:"text-xs text-muted-foreground",children:o.external_type}),e[32]=o.external_type,e[33]=D):D=e[33],e[34]!==_||e[35]!==R||e[36]!==F||e[37]!==D||e[38]!==j||e[39]!==E?(T=c.jsxs(Yn,{className:"rounded-none py-1 group cursor-pointer",value:E,onSelect:_,children:[R,F,D]},j),e[34]=_,e[35]=R,e[36]=F,e[37]=D,e[38]=j,e[39]=E,e[40]=T):T=e[40],e[41]!==o||e[42]!==f||e[43]!==y||e[44]!==s||e[45]!==r||e[46]!==n?(k=s&&c.jsx("div",{className:"pl-10 pr-2 py-2 bg-[var(--slate-1)] shadow-inner border-b",children:c.jsx(uc,{children:c.jsx(cR,{table:n,column:o,onAddColumnChart:y,preview:f.get(r?`${r.database}.${r.schema}.${n.name}:${o.name}`:`${n.name}:${o.name}`),sqlTableContext:r})})}),e[41]=o,e[42]=f,e[43]=y,e[44]=s,e[45]=r,e[46]=n,e[47]=k):k=e[47],e[48]!==T||e[49]!==k?(B=c.jsxs(c.Fragment,{children:[T,k]}),e[48]=T,e[49]=k,e[50]=B):B=e[50],B};function xM(t){const{tooltipContent:e,content:n}=t;return c.jsx(je,{content:e,delayDuration:100,children:c.jsx("span",{className:"text-xs text-black bg-gray-100 dark:invert rounded px-1",children:n})})}const bM=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx(dM,{}),t[0]=e):e=t[0],e},yM=()=>{const t=H.c(5),{documentation:e}=Ne(uR);if(!e){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(an,{title:"View docs as you type",description:"Move your text cursor over a symbol to see its documentation.",icon:c.jsx(Zc,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=Om({html:e}),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=c.jsx("div",{className:"p-3 overflow-y-auto overflow-x-hidden h-full docs-documentation flex flex-col gap-4",children:n}),t[3]=n,t[4]=o):o=t[4],o},vM=()=>{const t=H.c(5),e=hR();if(e.length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(an,{title:"No errors!",icon:c.jsx(Sp,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=e.map(wM),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=c.jsx("div",{className:"flex flex-col overflow-auto",children:n}),t[3]=n,t[4]=o):o=t[4],o};function wM(t){return c.jsxs("div",{children:[c.jsx("div",{className:"text-xs font-mono font-semibold bg-muted border-y px-2 py-1",children:c.jsx(fR,{cellId:t.cellId})}),c.jsx("div",{className:"px-2",children:c.jsx(mR,{errors:t.output.data,cellId:t.cellId},t.cellId)},t.cellId)]},t.cellId)}const Pf=new Map,kM=({file:t,onOpenNotebook:e})=>{const{theme:n}=Ko(),o=Ne(ec),[r,s]=M.useState(""),{data:a,isPending:i,error:l,setData:d}=En(async()=>{const g=await Rm({path:t.path}),p=g.contents||"";return s(Pf.get(t.path)||p),g},[t.path]),u=async()=>{r!==(a==null?void 0:a.contents)&&await kR({path:t.path,contents:r}).then(g=>{g.success&&(d(p=>({...p,contents:r})),s(r))})},h=M.useRef(r);if(h.current=r,M.useEffect(()=>()=>{if(!(a!=null&&a.contents))return;const g=h.current;g===a.contents?Pf.delete(t.path):Pf.set(t.path,g)},[t.path,a==null?void 0:a.contents]),l)return c.jsx(br,{error:l});if(i||!a)return null;const f=a.mimeType||"text/plain",m=f in Rf;if(!a.contents&&!m)return c.jsxs("div",{className:"grid grid-cols-2 gap-2 p-6",children:[c.jsx("div",{className:"font-bold text-muted-foreground",children:"Name"}),c.jsx("div",{children:a.file.name}),c.jsx("div",{className:"font-bold text-muted-foreground",children:"Type"}),c.jsx("div",{children:f})]});const x=c.jsxs("div",{className:"text-xs text-muted-foreground p-1 flex justify-end gap-2 border-b",children:[t.isMarimoFile&&!Jt()&&c.jsx(je,{content:"Open notebook",children:c.jsx(sn,{size:"small",onClick:g=>e(g),children:c.jsx(lc,{})})}),c.jsx(je,{content:"Download",children:c.jsx(sn,{size:"small",onClick:()=>{if(Yw(f)){const g=vR(a.contents,f);return void wR(g,a.file.name)}Ba(new Blob([a.contents||r],{type:f}),a.file.name)},children:c.jsx(om,{})})}),!Yw(f)&&c.jsxs(c.Fragment,{children:[c.jsx(je,{content:"Copy contents to clipboard",children:c.jsx(sn,{size:"small",onClick:async()=>{await nn(r)},children:c.jsx(Ea,{})})}),c.jsx(je,{content:Ht("global.save"),children:c.jsx(sn,{size:"small",color:r===a.contents?void 0:"green",onClick:u,disabled:r===a.contents,children:c.jsx(fi,{})})})]})]});return f.startsWith("image/")?c.jsxs(c.Fragment,{children:[x,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(pR,{base64:a.contents,mime:f})})]}):f==="text/csv"&&a.contents?c.jsxs(c.Fragment,{children:[x,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(gR,{contents:a.contents})})]}):f.startsWith("audio/")?c.jsxs(c.Fragment,{children:[x,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(xR,{base64:a.contents,mime:f})})]}):f.startsWith("video/")?c.jsxs(c.Fragment,{children:[x,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(bR,{base64:a.contents,mime:f})})]}):f.startsWith("application/pdf")?c.jsxs(c.Fragment,{children:[x,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(yR,{base64:a.contents,mime:f})})]}):c.jsxs(c.Fragment,{children:[x,c.jsx("div",{className:"flex-1 overflow-auto",children:c.jsx(M.Suspense,{children:c.jsx(ri,{theme:n==="dark"?"dark":"light",language:Rf[f]||Rf.default,className:"border-b",extensions:[He.lineWrapping,In.of([{key:o.getHotkey("global.save").key,stopPropagation:!0,run:()=>r!==a.contents&&(u(),!0)}])],value:r,onChange:s})})})]})},Yw=t=>t.startsWith("image/")||t.startsWith("audio/")||t.startsWith("video/")||t.startsWith("application/pdf"),Rf={"application/javascript":"javascript","text/markdown":"markdown","text/html":"html","text/css":"css","text/x-python":"python","application/json":"json","application/xml":"xml","text/x-yaml":"yaml","text/csv":"markdown","text/plain":"markdown",default:"markdown"},Kw=bt(new class{constructor(t){this.callbacks=t,this.delegate=new $m([]),this.rootPath="",this.onChange=Rn.NOOP,this.path=new sc("/"),this.initialize=async e=>{if(this.onChange=e,this.delegate.data.length===0)try{const n=await this.callbacks.listFiles({path:this.rootPath});this.delegate=new $m(n.files),this.rootPath=n.root,this.path=sc.guessDeliminator(n.root)}catch(n){Xe({title:"Failed",description:C3(n)})}this.onChange(this.delegate.data)},this.refreshAll=async e=>{const n=[this.rootPath,...e.map(r=>{var s;return(s=this.delegate.find(r))==null?void 0:s.data.path})].filter(Boolean),o=await Promise.all(n.map(r=>this.callbacks.listFiles({path:r}).catch(()=>({files:[]}))));for(const[r,s]of n.entries()){const a=o[r];s===this.rootPath?this.delegate=new $m(a.files):this.delegate.update({id:s,changes:{children:a.files}})}this.onChange(this.delegate.data)},this.relativeFromRoot=e=>{const n=this.rootPath.endsWith(this.path.deliminator)?this.rootPath:`${this.rootPath}${this.path.deliminator}`;return e.startsWith(n)?e.slice(n.length):e},this.handleResponse=e=>e.success?e:(Xe({title:"Failed",description:e.message}),null)}async expand(t){const e=this.delegate.find(t);if(!e||!e.data.isDirectory)return!1;if(e.children&&e.children.length>0)return!0;const n=await this.callbacks.listFiles({path:e.data.path});return this.delegate.update({id:t,changes:{children:n.files}}),this.onChange(this.delegate.data),!0}async rename(t,e){const n=this.delegate.find(t);if(!n)return;const o=n.data.path,r=this.path.join(this.path.dirname(o),e);await this.callbacks.renameFileOrFolder({path:o,newPath:r}).then(this.handleResponse),this.delegate.update({id:t,changes:{name:e,path:r}}),this.onChange(this.delegate.data),await this.refreshAll([r])}async move(t,e){var o;const n=e?((o=this.delegate.find(e))==null?void 0:o.data.path)??e:this.rootPath;await Promise.all(t.map(r=>{this.delegate.move({id:r,parentId:e,index:0});const s=this.delegate.find(r);if(!s)return Promise.resolve();const a=this.path.join(n,this.path.basename(s.data.path));return this.delegate.update({id:r,changes:{path:a}}),this.callbacks.renameFileOrFolder({path:s.data.path,newPath:a}).then(this.handleResponse)})),this.onChange(this.delegate.data),await this.refreshAll([n])}async createFile(t,e){var r;const n=e?((r=this.delegate.find(e))==null?void 0:r.data.path)??e:this.rootPath,o=await this.callbacks.createFileOrFolder({path:n,type:"file",name:t}).then(this.handleResponse);o!=null&&o.info&&(this.delegate.create({parentId:e,index:0,data:o.info}),this.onChange(this.delegate.data),await this.refreshAll([n]))}async createFolder(t,e){var r;const n=e?((r=this.delegate.find(e))==null?void 0:r.data.path)??e:this.rootPath,o=await this.callbacks.createFileOrFolder({path:n,type:"directory",name:t}).then(this.handleResponse);o!=null&&o.info&&(this.delegate.create({parentId:e,index:0,data:o.info}),this.onChange(this.delegate.data),await this.refreshAll([n]))}async delete(t){const e=this.delegate.find(t);e&&(await this.callbacks.deleteFileOrFolder({path:e.data.path}).then(this.handleResponse),this.delegate.drop({id:t}),this.onChange(this.delegate.data))}}({listFiles:e3,createFileOrFolder:Lm,deleteFileOrFolder:NR,renameFileOrFolder:SR})),SM=bt({});function NM(t){return new Promise((e,n)=>{const o=new FileReader;o.onload=r=>{var s;e((s=r.target)==null?void 0:s.result)},o.onerror=r=>{n(new Error(`Failed to read blob: ${r.type}`))},o.readAsDataURL(t)})}function Xw(t){const e=H.c(4);let n;e[0]!==t?(n=t===void 0?{}:t,e[0]=t,e[1]=n):n=e[1];const o=n;let r;return e[2]!==o?(r={multiple:!0,maxSize:104857600,onError:IM,onDropRejected:CM,onDrop:jM,...o},e[2]=o,e[3]=r):r=e[3],jR(r)}async function jM(t){for(const e of t){const n=TM(AM(e));let o="";n&&(o=sc.guessDeliminator(n).dirname(n));const r=(await NM(e)).split(",")[1];await Lm({path:o,type:"file",name:e.name,contents:r})}await async function(){await Qe.get(Kw).refreshAll([])}()}function CM(t){Xe({title:"File upload failed",description:c.jsx("div",{className:"flex flex-col gap-1",children:t.map(EM)}),variant:"danger"})}function EM(t){return c.jsxs("div",{children:[t.file.name," (",t.errors.map(_M).join(", "),")"]},t.file.name)}function _M(t){return t.message}function IM(t){ht.error(t),Xe({title:"File upload failed",description:t.message,variant:"danger"})}function AM(t){return t.webkitRelativePath?t.webkitRelativePath:"path"in t&&typeof t.path=="string"?t.path:"relativePath"in t&&typeof t.relativePath=="string"?t.relativePath:void 0}function TM(t){if(t)return t.replace(/^\/+/,"")}const Jw=q.createContext(null),MM=t=>{const e=H.c(60),{height:n}=t,o=M.useRef(null),[r]=Mt(Kw);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=[],e[0]=s):s=e[0];const[a,i]=M.useState(s),[l,d]=M.useState(null),{openPrompt:u}=Cn(),[h,f]=Mt(SM);let m,x;e[1]!==r?(m=()=>r.initialize(i),e[1]=r,e[2]=m):m=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(x=[],e[3]=x):x=e[3];const{isPending:g,error:p}=En(m,x);let b;e[4]!==h||e[5]!==r?(b=()=>{r.refreshAll(Object.keys(h).filter(k=>h[k]))},e[4]=h,e[5]=r,e[6]=b):b=e[6];const y=Fe(b);let v;e[7]!==u||e[8]!==r?(v=async()=>{u({title:"Folder name",onConfirm:async k=>{r.createFolder(k,null)}})},e[7]=u,e[8]=r,e[9]=v):v=e[9];const w=Fe(v);let S;e[10]!==u||e[11]!==r?(S=async()=>{u({title:"File name",onConfirm:async k=>{r.createFile(k,null)}})},e[10]=u,e[11]=r,e[12]=S):S=e[12];const N=Fe(S);let j;e[13]!==f?(j=()=>{var k;(k=o.current)==null||k.closeAll(),f({})},e[13]=f,e[14]=j):j=e[14];const E=Fe(j);if(g){let k;return e[15]===Symbol.for("react.memo_cache_sentinel")?(k=c.jsx(bn,{size:"medium",centered:!0}),e[15]=k):k=e[15],k}if(p){let k;return e[16]!==p?(k=c.jsx(br,{error:p}),e[16]=p,e[17]=k):k=e[17],k}if(l){let k,B,C,U,V,$;return e[18]===Symbol.for("react.memo_cache_sentinel")?(k=()=>d(null),e[18]=k):k=e[18],e[19]===Symbol.for("react.memo_cache_sentinel")?(B=c.jsx(ve,{onClick:k,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:c.jsx(vt,{size:16})}),e[19]=B):B=e[19],e[20]!==l.name?(C=c.jsxs("div",{className:"flex items-center pl-1 pr-3 flex-shrink-0 border-b justify-between",children:[B,c.jsx("span",{className:"font-bold",children:l.name})]}),e[20]=l.name,e[21]=C):C=e[21],e[22]!==l.path||e[23]!==r?(U=X=>Zw(X,r.relativeFromRoot(l.path)),e[22]=l.path,e[23]=r,e[24]=U):U=e[24],e[25]!==l||e[26]!==U?(V=c.jsx(M.Suspense,{children:c.jsx(kM,{onOpenNotebook:U,file:l})}),e[25]=l,e[26]=U,e[27]=V):V=e[27],e[28]!==C||e[29]!==V?($=c.jsxs(c.Fragment,{children:[C,V]}),e[28]=C,e[29]=V,e[30]=$):$=e[30],$}let _;e[31]!==E||e[32]!==N||e[33]!==w||e[34]!==y||e[35]!==r?(_=c.jsx(DM,{onRefresh:y,onCreateFile:N,onCreateFolder:w,onCollapseAll:E,tree:r}),e[31]=E,e[32]=N,e[33]=w,e[34]=y,e[35]=r,e[36]=_):_=e[36];const A=n-33;let I,P,L,O,R,F,D,T;return e[37]!==r?(I=async k=>{const{ids:B}=k;for(const C of B)await r.delete(C)},P=async k=>{const{id:B,name:C}=k;await r.rename(B,C)},L=async k=>{const{dragIds:B,parentId:C}=k;await r.move(B,C)},e[37]=r,e[38]=I,e[39]=P,e[40]=L):(I=e[38],P=e[39],L=e[40]),e[41]===Symbol.for("react.memo_cache_sentinel")?(O=k=>{const B=k[0];B&&(B.data.isDirectory||d(B.data))},e[41]=O):O=e[41],e[42]!==h||e[43]!==f||e[44]!==r?(R=async k=>{if(await r.expand(k)){const B=h[k]??!1;f({...h,[k]:!B})}},e[42]=h,e[43]=f,e[44]=r,e[45]=R):R=e[45],e[46]!==a||e[47]!==h||e[48]!==I||e[49]!==P||e[50]!==L||e[51]!==R||e[52]!==A?(F=c.jsx(xL,{width:"100%",ref:o,height:A,className:"h-full",data:a,initialOpenState:h,openByDefault:!1,renderCursor:zM,disableDrop:BM,onDelete:I,onRename:P,onMove:L,onSelect:O,onToggle:R,padding:15,rowHeight:30,indent:OM,overscanCount:1e3,disableMultiSelection:!0,children:LM}),e[46]=a,e[47]=h,e[48]=I,e[49]=P,e[50]=L,e[51]=R,e[52]=A,e[53]=F):F=e[53],e[54]!==F||e[55]!==r?(D=c.jsx(Jw,{value:r,children:F}),e[54]=F,e[55]=r,e[56]=D):D=e[56],e[57]!==D||e[58]!==_?(T=c.jsxs(c.Fragment,{children:[_,D]}),e[57]=D,e[58]=_,e[59]=T):T=e[59],T},OM=15,DM=t=>{const e=H.c(30),{onRefresh:n,onCreateFile:o,onCreateFolder:r,onCollapseAll:s}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={noDrag:!0,noDragEventsBubbling:!0},e[0]=a):a=e[0];const{getRootProps:i,getInputProps:l}=Xw(a);let d,u,h,f,m,x,g,p,b,y,v,w,S,N,j;return e[1]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(ui,{size:16}),e[1]=d):d=e[1],e[2]!==o?(u=c.jsx(je,{content:"Add file",children:c.jsx(ve,{"data-testid":"file-explorer-add-file-button",onClick:o,variant:"text",size:"xs",children:d})}),e[2]=o,e[3]=u):u=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(Hc,{size:16}),e[4]=h):h=e[4],e[5]!==r?(f=c.jsx(je,{content:"Add folder",children:c.jsx(ve,{"data-testid":"file-explorer-add-folder-button",onClick:r,variant:"text",size:"xs",children:h})}),e[5]=r,e[6]=f):f=e[6],e[7]!==i?(m=i({}),e[7]=i,e[8]=m):m=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(x=CR({variant:"text",size:"xs"}),g=c.jsx(_R,{size:16}),e[9]=x,e[10]=g):(x=e[9],g=e[10]),e[11]!==m?(p=c.jsx(je,{content:"Upload file",children:c.jsx("button",{"data-testid":"file-explorer-upload-button",...m,className:x,children:g})}),e[11]=m,e[12]=p):p=e[12],e[13]!==l?(b=l({}),e[13]=l,e[14]=b):b=e[14],e[15]!==b?(y=c.jsx("input",{...b,type:"file"}),e[15]=b,e[16]=y):y=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(v=c.jsx(R3,{size:16}),e[17]=v):v=e[17],e[18]!==n?(w=c.jsx(je,{content:"Refresh",children:c.jsx(ve,{"data-testid":"file-explorer-refresh-button",onClick:n,variant:"text",size:"xs",children:v})}),e[18]=n,e[19]=w):w=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(S=c.jsx(tp,{size:16}),e[20]=S):S=e[20],e[21]!==s?(N=c.jsx(je,{content:"Collapse all folders",children:c.jsx(ve,{"data-testid":"file-explorer-collapse-button",onClick:s,variant:"text",size:"xs",children:S})}),e[21]=s,e[22]=N):N=e[22],e[23]!==y||e[24]!==w||e[25]!==N||e[26]!==u||e[27]!==f||e[28]!==p?(j=c.jsxs("div",{className:"flex items-center justify-end px-2 flex-shrink-0 border-b",children:[u,f,p,y,w,N]}),e[23]=y,e[24]=w,e[25]=N,e[26]=u,e[27]=f,e[28]=p,e[29]=j):j=e[29],j},PM=t=>{const e=H.c(9),{node:n,onOpenMarimoFile:o}=t;let r,s,a;return e[0]!==n?(r=i=>{n.data.isDirectory||(i.stopPropagation(),n.select())},e[0]=n,e[1]=r):r=e[1],e[2]!==n.data.isMarimoFile||e[3]!==o?(s=n.data.isMarimoFile&&!Jt()&&c.jsxs("span",{className:"flex-shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline",onClick:o,children:["open ",c.jsx(lc,{className:"inline ml-1",size:12})]}),e[2]=n.data.isMarimoFile,e[3]=o,e[4]=s):s=e[4],e[5]!==n.data.name||e[6]!==r||e[7]!==s?(a=c.jsxs("span",{className:"flex-1 overflow-hidden text-ellipsis",onClick:r,children:[n.data.name,s]}),e[5]=n.data.name,e[6]=r,e[7]=s,e[8]=a):a=e[8],a},RM=t=>{const e=H.c(10),{node:n}=t,o=M.useRef(null);let r,s,a,i,l;return e[0]!==n.data.name?(r=()=>{var d,u;(d=o.current)==null||d.focus(),(u=o.current)==null||u.setSelectionRange(0,n.data.name.lastIndexOf("."))},s=[n.data.name],e[0]=n.data.name,e[1]=r,e[2]=s):(r=e[1],s=e[2]),M.useEffect(r,s),e[3]!==n?(a=()=>n.reset(),i=d=>{d.key==="Escape"&&n.reset(),d.key==="Enter"&&n.submit(d.currentTarget.value)},e[3]=n,e[4]=a,e[5]=i):(a=e[4],i=e[5]),e[6]!==n.data.name||e[7]!==a||e[8]!==i?(l=c.jsx("input",{ref:o,className:"flex-1 bg-transparent border border-border text-muted-foreground",defaultValue:n.data.name,onClick:UM,onBlur:a,onKeyDown:i}),e[6]=n.data.name,e[7]=a,e[8]=i,e[9]=l):l=e[9],l},LM=({node:t,style:e,dragHandle:n})=>{const o=t.data.isDirectory?"directory":Zk(t.data.name),r=Qk[o],{openConfirm:s,openPrompt:a}=Cn(),{createNewCell:i}=at(),l=cs(),d=M.use(Jw),u=async g=>{Zw(g,d?d.relativeFromRoot(t.data.path):t.data.path)},h=async g=>{g.stopPropagation(),g.preventDefault(),s({title:"Delete file",description:`Are you sure you want to delete ${t.data.name}?`,confirmAction:c.jsx(Gk,{onClick:async()=>{await t.tree.delete(t.id)},"aria-label":"Confirm",children:"Delete"})})},f=Fe(async()=>{t.open(),a({title:"Folder name",onConfirm:async g=>{d==null||d.createFolder(g,t.id)}})}),m=Fe(async()=>{t.open(),a({title:"File name",onConfirm:async g=>{d==null||d.createFile(g,t.id)}})}),x=Fe(async()=>{var y;if(!d||t.data.isDirectory)return;const[g,p]=ER(t.data.name),b=`${g}_copy${p}`;try{const v=await Rm({path:t.data.path}),w=((y=t.parent)==null?void 0:y.data.path)||"";await Lm({path:w,type:"file",name:b,contents:v.contents?btoa(v.contents):void 0}),await d.refreshAll([w])}catch{Xe({title:"Failed to duplicate file",description:"Unable to create a duplicate of the file",variant:"danger"})}});return c.jsxs("div",{style:e,ref:n,className:pe("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group"),draggable:!0,onClick:g=>{g.stopPropagation(),t.data.isDirectory&&t.toggle()},children:[c.jsx(FM,{node:t}),c.jsxs("span",{className:pe("flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group",t.willReceiveDrop&&t.data.isDirectory&&"bg-accent/80 hover:bg-accent/80 text-accent-foreground"),children:[t.data.isMarimoFile?c.jsx("img",{src:RL,className:"w-5 h-5 flex-shrink-0 mr-2 filter grayscale",alt:"Marimo"}):c.jsx(r,{className:"w-5 h-5 flex-shrink-0 mr-2",strokeWidth:1.5}),t.isEditing?c.jsx(RM,{node:t}):c.jsx(PM,{node:t,onOpenMarimoFile:u}),c.jsxs(So,{modal:!1,children:[c.jsx(No,{asChild:!0,tabIndex:-1,onClick:g=>g.stopPropagation(),children:c.jsx(ve,{"data-testid":"file-explorer-more-button",variant:"text",tabIndex:-1,size:"xs",className:"mb-0","aria-label":"More options",children:c.jsx(Vc,{strokeWidth:2,className:"w-5 h-5 hidden group-hover:block"})})}),(()=>{const g={size:14,strokeWidth:1.5,className:"mr-2"};return c.jsxs(jo,{align:"end",className:"no-print w-[220px]",onClick:p=>p.stopPropagation(),onCloseAutoFocus:p=>p.preventDefault(),children:[!t.data.isDirectory&&c.jsxs(_t,{onSelect:()=>t.select(),children:[c.jsx(Fp,{...g}),"Open file"]}),!t.data.isDirectory&&!Jt()&&c.jsxs(_t,{onSelect:()=>{IR({path:t.data.path})},children:[c.jsx(lc,{...g}),"Open file in external editor"]}),t.data.isDirectory&&c.jsxs(c.Fragment,{children:[c.jsxs(_t,{onSelect:()=>m(),children:[c.jsx(ui,{...g}),"Create file"]}),c.jsxs(_t,{onSelect:()=>f(),children:[c.jsx(Hc,{...g}),"Create folder"]}),c.jsx(on,{})]}),c.jsxs(_t,{onSelect:()=>t.edit(),children:[c.jsx(Np,{...g}),"Rename"]}),!t.data.isDirectory&&c.jsxs(_t,{onSelect:x,children:[c.jsx(Ea,{...g}),"Duplicate"]}),c.jsxs(_t,{onSelect:async()=>{await nn(t.data.path),Xe({title:"Copied to clipboard"})},children:[c.jsx(Gc,{...g}),"Copy path"]}),d&&c.jsxs(_t,{onSelect:async()=>{await nn(d.relativeFromRoot(t.data.path)),Xe({title:"Copied to clipboard"})},children:[c.jsx(Gc,{...g}),"Copy relative path"]}),c.jsx(on,{}),c.jsxs(_t,{onSelect:()=>{const{path:p}=t.data;(b=>{i({code:b,before:!1,cellId:l??"__end__"})})(hS[o](p))},children:[c.jsx(kr,{...g}),"Insert snippet for reading file"]}),c.jsxs(_t,{onSelect:async()=>{Xe({title:"Copied to clipboard",description:"Code to open the file has been copied to your clipboard. You can also drag and drop this file into the editor"});const{path:p}=t.data,b=hS[o](p);await nn(b)},children:[c.jsx(AR,{...g}),"Copy snippet for reading file"]}),t.data.isMarimoFile&&!Jt()&&c.jsxs(c.Fragment,{children:[c.jsx(on,{}),c.jsxs(_t,{onSelect:u,children:[c.jsx(Op,{...g}),"Open notebook"]})]}),c.jsx(on,{}),!t.data.isDirectory&&c.jsxs(c.Fragment,{children:[c.jsxs(_t,{onSelect:async()=>{const p=(await Rm({path:t.data.path})).contents||"";Ba(new Blob([p]),t.data.name)},children:[c.jsx(om,{...g}),"Download"]}),c.jsx(on,{})]}),c.jsxs(_t,{onSelect:h,variant:"danger",children:[c.jsx(Ql,{...g}),"Delete"]})]})})()]})]})]})},FM=t=>{const e=H.c(3),{node:n}=t;if(!n.data.isDirectory){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx("span",{className:"w-5 h-5 flex-shrink-0"}),e[0]=r):r=e[0],r}let o;return e[1]!==n.isOpen?(o=n.isOpen?c.jsx(ko,{className:"w-5 h-5 flex-shrink-0"}):c.jsx(Ma,{className:"w-5 h-5 flex-shrink-0"}),e[1]=n.isOpen,e[2]=o):o=e[2],o};function Zw(t,e){t.stopPropagation(),t.preventDefault(),kS(e)}function zM(){return null}function BM(t){const{parentNode:e}=t;return!e.data.isDirectory}function UM(t){return t.stopPropagation()}let Qw,ek,tk;Qw=()=>{const t=H.c(20),{ref:e,height:n}=TR(),o=n===void 0?1:n;let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={noClick:!0,noKeyboard:!0},t[0]=r):r=t[0];const{getRootProps:s,getInputProps:a,isDragActive:i}=Xw(r);let l,d,u,h,f,m,x,g;return t[1]!==s?(l=s(),t[1]=s,t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(d=pe("flex flex-col flex-1 overflow-hidden relative"),t[3]=d):d=t[3],t[4]!==a?(u=a(),t[4]=a,t[5]=u):u=t[5],t[6]!==u?(h=c.jsx("input",{...u}),t[6]=u,t[7]=h):h=t[7],t[8]!==i?(f=i&&c.jsx("div",{className:"absolute inset-0 flex items-center uppercase justify-center text-xl font-bold text-primary/90 bg-accent/85 z-10 border-2 border-dashed border-primary/90 rounded-lg pointer-events-none",children:"Drop files here"}),t[8]=i,t[9]=f):f=t[9],t[10]!==o?(m=c.jsx(MM,{height:o}),t[10]=o,t[11]=m):m=t[11],t[12]!==e||t[13]!==m?(x=c.jsx("div",{ref:e,className:"flex flex-col flex-1 overflow-hidden",children:m}),t[12]=e,t[13]=m,t[14]=x):x=t[14],t[15]!==l||t[16]!==h||t[17]!==f||t[18]!==x?(g=c.jsxs("div",{...l,className:d,children:[h,f,x]}),t[15]=l,t[16]=h,t[17]=f,t[18]=x,t[19]=g):g=t[19],g},Km=t=>{const e=H.c(6),n=t.dataTestId;let o,r;return e[0]!==t.className?(o=pe("text-xs font-semibold text-accent-foreground",t.className),e[0]=t.className,e[1]=o):o=e[1],e[2]!==t.dataTestId||e[3]!==t.onClick||e[4]!==o?(r=c.jsx("button",{type:"button","data-testid":n,className:o,onClick:t.onClick,children:"Clear"}),e[2]=t.dataTestId,e[3]=t.onClick,e[4]=o,e[5]=r):r=e[5],r},ek=()=>{const t=H.c(9),e=MR(),{clearLogs:n}=at();if(e.length===0){let a,i;return t[0]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx("code",{className:"border rounded px-1",children:"stdout"}),t[0]=a):a=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(an,{title:"No logs",description:c.jsxs("span",{children:[a," and"," ",c.jsx("code",{className:"border rounded px-1",children:"stderr"})," logs will appear here."]}),icon:c.jsx(Vf,{})}),t[1]=i):i=t[1],i}let o,r,s;return t[2]!==n?(o=c.jsx("div",{className:"flex flex-row justify-end px-2 py-1",children:c.jsx(Km,{dataTestId:"clear-logs-button",onClick:n})}),t[2]=n,t[3]=o):o=t[3],t[4]!==e?(r=c.jsx("div",{className:"overflow-auto flex-1",children:c.jsx(tk,{logs:e,className:"min-w-[300px]"})}),t[4]=e,t[5]=r):r=t[5],t[6]!==o||t[7]!==r?(s=c.jsxs(c.Fragment,{children:[o,r]}),t[6]=o,t[7]=r,t[8]=s):s=t[8],s},tk=t=>{const e=H.c(10),{logs:n,className:o}=t;let r,s,a,i,l;return e[0]!==o?(r=pe("flex flex-col",o),e[0]=o,e[1]=r):r=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(s={whiteSpace:"pre-wrap"},e[2]=s):s=e[2],e[3]!==n?(a=n.map(HM),e[3]=n,e[4]=a):a=e[4],e[5]!==a?(i=c.jsx("pre",{className:"grid text-xs font-mono gap-1 whitespace-break-spaces font-semibold align-left",children:c.jsx("div",{className:"grid grid-cols-[30px,1fr]",style:s,children:a})}),e[5]=a,e[6]=i):i=e[6],e[7]!==r||e[8]!==i?(l=c.jsx("div",{className:r,children:i}),e[7]=r,e[8]=i,e[9]=l):l=e[9],l};function $M(t){const e=OR(t.timestamp),n=VM[t.level],o=t.level.toUpperCase();return c.jsxs(c.Fragment,{children:[c.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)] dark:text-[var(--gray-11)]",children:["[",e,"]"]}),c.jsx("span",{className:pe("flex-shrink-0",n),children:o}),c.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)]",children:["(",c.jsx(_o,{cellId:t.cellId}),")"]}),t.message]})}const VM={stdout:"text-[var(--grass-9)]",stderr:"text-[var(--red-9)]"};function HM(t,e){return c.jsxs("div",{className:"contents group",children:[c.jsx("span",{className:pe("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","text-right col-span-1 py-1 pr-1"),children:e+1}),c.jsx("span",{className:pe("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","px-2 flex gap-x-1.5 py-1 flex-wrap"),children:$M(t)})]},e)}const WM=()=>{const t=H.c(7),{items:e}=Ne(DR);let n,o;t[0]!==e?(o=LL(e),t[0]=e,t[1]=o):o=t[1],n=o;const r=n,{activeHeaderId:s,activeOccurrences:a}=FL(r);if(e.length===0){let l;return t[2]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(an,{title:"No outline",description:"Add markdown headings to your notebook to create an outline.",icon:c.jsx(Jc,{})}),t[2]=l):l=t[2],l}let i;return t[3]!==s||t[4]!==a||t[5]!==e?(i=c.jsx(zL,{items:e,activeHeaderId:s,activeOccurrences:a}),t[3]=s,t[4]=a,t[5]=e,t[6]=i):i=t[6],i},nk=bt(null),ok=t=>{const e=H.c(9),{onClick:n,loading:o,children:r,className:s}=t;if(o){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(bn,{size:"small",className:"h-4 w-4 shrink-0 opacity-50"}),e[0]=d):d=e[0],d}let a,i,l;return e[1]!==s?(a=pe("px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible",s),e[1]=s,e[2]=a):a=e[2],e[3]!==n?(i=Pn.stopPropagation(n),e[3]=n,e[4]=i):i=e[4],e[5]!==r||e[6]!==a||e[7]!==i?(l=c.jsx("button",{type:"button",className:a,onClick:i,children:r}),e[5]=r,e[6]=a,e[7]=i,e[8]=l):l=e[8],l},qM=()=>{var w,S;const t=H.c(27),[e]=fr(),n=e.package_management.manager,[o,r]=q.useState(null);let s;t[0]!==n?(s=[n],t[0]=n,t[1]=s):s=t[1];const{data:a,error:i,refetch:l,isPending:d}=En(XM,s);if(d){let N;return t[2]===Symbol.for("react.memo_cache_sentinel")?(N=c.jsx(bn,{size:"medium",centered:!0}),t[2]=N):N=t[2],N}if(i){let N;return t[3]!==i?(N=c.jsx(br,{error:i}),t[3]=i,t[4]=N):N=t[4],N}const u=a.tree!=null;let h;t[5]!==u||t[6]!==o?(h=function(N,j){return N==="list"?"list":j?N||"tree":"list"}(o,u),t[5]=u,t[6]=o,t[7]=h):h=t[7];const f=h,m=(w=a.tree)==null?void 0:w.name,x=(S=a==null?void 0:a.tree)==null?void 0:S.version,g=m==="<root>";let p,b,y,v;return t[8]!==n||t[9]!==l?(p=c.jsx(GM,{packageManager:n,onSuccess:l}),t[8]=n,t[9]=l,t[10]=p):p=t[10],t[11]!==g||t[12]!==u||t[13]!==m||t[14]!==x||t[15]!==f?(b=u&&c.jsxs("div",{className:"flex items-center justify-between px-2 py-1 border-b",children:[c.jsxs("div",{className:"flex gap-1",children:[c.jsx("button",{type:"button",className:pe("px-2 py-1 text-xs rounded",f==="list"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>r("list"),children:"List"}),c.jsx("button",{type:"button",className:pe("px-2 py-1 text-xs rounded",f==="tree"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>r("tree"),children:"Tree"})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium",title:g?"sandbox":"project",children:g?"sandbox":"project"}),m&&!g&&c.jsxs("span",{className:"text-xs text-muted-foreground",children:[m,x&&` v${x}`]})]})]}),t[11]=g,t[12]=u,t[13]=m,t[14]=x,t[15]=f,t[16]=b):b=t[16],t[17]!==a.list||t[18]!==a.tree||t[19]!==i||t[20]!==l||t[21]!==f?(y=f==="list"?c.jsx(YM,{packages:a.list,onSuccess:l}):c.jsx(KM,{tree:a.tree,error:i,onSuccess:l}),t[17]=a.list,t[18]=a.tree,t[19]=i,t[20]=l,t[21]=f,t[22]=y):y=t[22],t[23]!==p||t[24]!==b||t[25]!==y?(v=c.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[p,b,y]}),t[23]=p,t[24]=b,t[25]=y,t[26]=v):v=t[26],v},GM=t=>{const e=H.c(40),{onSuccess:n,packageManager:o}=t,[r,s]=q.useState(""),{handleClick:a}=ai(),i=Ne(nk),l=kt(nk);let d,u;e[0]!==i||e[1]!==l?(d=()=>{i&&(s(i),l(null))},u=[i,l],e[0]=i,e[1]=l,e[2]=d,e[3]=u):(d=e[2],u=e[3]),q.useEffect(d,u);const{loading:h,handleInstallPackages:f}=LR();let m;e[4]!==n?(m=()=>{n(),s("")},e[4]=n,e[5]=m):m=e[5];const x=m;let g;e[6]!==f||e[7]!==r||e[8]!==x?(g=()=>{f(r.split(",").map(JM),x)},e[6]=f,e[7]=r,e[8]=x,e[9]=g):g=e[9];const p=g,b=`Install packages with ${o}...`;let y,v,w,S,N,j,E,_,A,I,P,L,O,R;e[10]!==h||e[11]!==a?(y=h?c.jsx(bn,{size:"small",className:"mr-2 h-4 w-4 shrink-0 opacity-50"}):c.jsx(je,{content:"Change package manager",children:c.jsx(ks,{onClick:()=>a("packageManagement"),className:"mr-2 h-4 w-4 shrink-0 opacity-50 hover:opacity-80 cursor-pointer"})}),e[10]=h,e[11]=a,e[12]=y):y=e[12],e[13]!==p?(v=C=>{C.key==="Enter"&&(C.preventDefault(),p())},e[13]=p,e[14]=v):v=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(w=C=>s(C.target.value),e[15]=w):w=e[15],e[16]!==r||e[17]!==b||e[18]!==y||e[19]!==v?(S=c.jsx(fS,{placeholder:b,id:v1,icon:y,rootClassName:"flex-1 border-none",value:r,onKeyDown:v,onChange:w}),e[16]=r,e[17]=b,e[18]=y,e[19]=v,e[20]=S):S=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(N=c.jsx("span",{className:"font-bold tracking-wide",children:"Package name:"}),e[21]=N):N=e[21],e[22]===Symbol.for("react.memo_cache_sentinel")?(j=c.jsxs("div",{children:[N," A package name; this will install the latest version.",c.jsx("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),E=c.jsx("span",{className:"font-bold tracking-wide",children:"Package and version:"}),e[22]=j,e[23]=E):(j=e[22],E=e[23]),e[24]===Symbol.for("react.memo_cache_sentinel")?(_=c.jsxs("div",{children:[E," ","A package with a specific version or version range.",c.jsx("div",{className:"text-muted-foreground",children:"Examples: httpx==0.27.0, httpx>=0.27.0"})]}),A=c.jsx("span",{className:"font-bold tracking-wide",children:"Git:"}),e[24]=_,e[25]=A):(_=e[24],A=e[25]),e[26]===Symbol.for("react.memo_cache_sentinel")?(I=c.jsxs("div",{children:[A," A Git repository",c.jsx("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),P=c.jsx("span",{className:"font-bold tracking-wide",children:"URL:"}),e[26]=I,e[27]=P):(I=e[26],P=e[27]),e[28]===Symbol.for("react.memo_cache_sentinel")?(L=c.jsxs("div",{children:[P," A remote wheel or source distribution.",c.jsx("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),O=c.jsx("span",{className:"font-bold tracking-wide",children:"Path:"}),e[28]=L,e[29]=O):(L=e[28],O=e[29]),e[30]===Symbol.for("react.memo_cache_sentinel")?(R=c.jsx(je,{delayDuration:300,side:"left",align:"start",content:c.jsxs("div",{className:"text-sm flex flex-col w-full max-w-[360px]",children:["Packages are installed using the package manager specified in your user configuration. Depending on your package manager, you can install packages with various formats:",c.jsxs("div",{className:"flex flex-col gap-2 mt-2",children:[j,_,I,L,c.jsxs("div",{children:[O," A local wheel, source distribution, or project directory.",c.jsx("div",{className:"text-muted-foreground",children:"Example: /example/foo-0.1.0-py3-none-any.whl"})]})]})]}),children:c.jsx(Im,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),e[30]=R):R=e[30];const F=r&&"bg-accent text-accent-foreground";let D;e[31]!==F?(D=pe("float-right px-2 m-0 h-full text-sm text-secondary-foreground ml-2",F,"disabled:cursor-not-allowed disabled:opacity-50"),e[31]=F,e[32]=D):D=e[32];const T=!r;let k,B;return e[33]!==p||e[34]!==D||e[35]!==T?(k=c.jsx("button",{type:"button",className:D,onClick:p,disabled:T,children:"Add"}),e[33]=p,e[34]=D,e[35]=T,e[36]=k):k=e[36],e[37]!==k||e[38]!==S?(B=c.jsxs("div",{className:"flex items-center w-full border-b",children:[S,R,k]}),e[37]=k,e[38]=S,e[39]=B):B=e[39],B},YM=t=>{const e=H.c(9),{onSuccess:n,packages:o}=t;if(o.length===0){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(an,{title:"No packages",description:"No packages are installed in this environment.",icon:c.jsx(ks,{})}),e[0]=i):i=e[0],i}let r,s,a;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(Fm,{children:c.jsxs(ws,{children:[c.jsx(yr,{children:"Name"}),c.jsx(yr,{children:"Version"}),c.jsx(yr,{})]})}),e[1]=r):r=e[1],e[2]!==n||e[3]!==o){let i;e[5]!==n?(i=l=>c.jsxs(ws,{className:"group",onClick:async()=>{await nn(`${l.name}==${l.version}`),Xe({title:"Copied to clipboard"})},children:[c.jsx(vr,{children:l.name}),c.jsx(vr,{children:l.version}),c.jsxs(vr,{className:"flex justify-end",children:[c.jsx(rk,{packageName:l.name,onSuccess:n}),c.jsx(sk,{packageName:l.name,onSuccess:n})]})]},l.name),e[5]=n,e[6]=i):i=e[6],s=o.map(i),e[2]=n,e[3]=o,e[4]=s}else s=e[4];return e[7]!==s?(a=c.jsxs(zm,{className:"overflow-auto flex-1",children:[r,c.jsx(Bm,{children:s})]}),e[7]=s,e[8]=a):a=e[8],a},rk=({packageName:t,onSuccess:e})=>{const[n,o]=q.useState(!1);return Jt()?null:c.jsx(ok,{onClick:async()=>{try{o(!0);const r=await FR({package:t,upgrade:!0});r.success?(e(),mS(t)):mS(t,r.error)}finally{o(!1)}},loading:n,children:"Upgrade"})},sk=({packageName:t,onSuccess:e})=>{const[n,o]=q.useState(!1);return c.jsx(ok,{onClick:async()=>{try{o(!0);const r=await zR({package:t});r.success?(e(),pS(t)):pS(t,r.error)}finally{o(!1)}},loading:n,children:"Remove"})},KM=t=>{const e=H.c(18),{tree:n,error:o,onSuccess:r}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=new Set,e[0]=s):s=e[0];const[a,i]=q.useState(s);let l,d,u;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{i(new Set)},e[1]=l):l=e[1],e[2]!==n?(d=[n],e[2]=n,e[3]=d):d=e[3],q.useEffect(l,d),o){let x;return e[4]!==o?(x=c.jsx(br,{error:o}),e[4]=o,e[5]=x):x=e[5],x}if(!n){let x;return e[6]===Symbol.for("react.memo_cache_sentinel")?(x=c.jsx(bn,{size:"medium",centered:!0}),e[6]=x):x=e[6],x}if(n.dependencies.length===0){let x;return e[7]===Symbol.for("react.memo_cache_sentinel")?(x=c.jsx(an,{title:"No dependencies",description:"No package dependencies found in this environment.",icon:c.jsx(ks,{})}),e[7]=x):x=e[7],x}e[8]===Symbol.for("react.memo_cache_sentinel")?(u=x=>{i(g=>{const p=new Set(g);return p.has(x)?p.delete(x):p.add(x),p})},e[8]=u):u=e[8];const h=u;let f,m;if(e[9]!==a||e[10]!==r||e[11]!==n.dependencies){let x;e[13]!==a||e[14]!==r?(x=(g,p)=>c.jsx("div",{className:"border-b",children:c.jsx(ak,{nodeId:`root-${p}`,node:g,level:0,isTopLevel:!0,expandedNodes:a,onToggle:h,onSuccess:r})},`${g.name}-${p}`),e[13]=a,e[14]=r,e[15]=x):x=e[15],f=n.dependencies.map(x),e[9]=a,e[10]=r,e[11]=n.dependencies,e[12]=f}else f=e[12];return e[16]!==f?(m=c.jsx("div",{className:"flex-1 overflow-auto",children:c.jsx("div",{children:f})}),e[16]=f,e[17]=m):m=e[17],m},ak=t=>{const e=H.c(57),{nodeId:n,node:o,level:r,isTopLevel:s,expandedNodes:a,onToggle:i,onSuccess:l}=t,d=s!==void 0&&s,u=o.dependencies.length>0;let h;e[0]!==a||e[1]!==n?(h=a.has(n),e[0]=a,e[1]=n,e[2]=h):h=e[2];const f=h,m=d?0:16+16*r;let x;e[3]!==u||e[4]!==n||e[5]!==i?(x=D=>{D.key!=="Enter"&&D.key!==" "||(D.preventDefault(),u&&i(n))},e[3]=u,e[4]=n,e[5]=i,e[6]=x):x=e[6];const g=x;let p;e[7]!==u||e[8]!==n||e[9]!==i?(p=D=>{D.stopPropagation(),u&&i(n)},e[7]=u,e[8]=n,e[9]=i,e[10]=p):p=e[10];const b=p,y=u&&"select-none",v=d?"px-2 py-0.5":"";let w,S;e[11]!==y||e[12]!==v?(w=pe("flex items-center group cursor-pointer text-sm whitespace-nowrap","hover:bg-[var(--slate-2)] focus:bg-[var(--slate-2)] focus:outline-none",y,v),e[11]=y,e[12]=v,e[13]=w):w=e[13],e[14]!==m||e[15]!==d?(S=d?{}:{paddingLeft:`${m}px`},e[14]=m,e[15]=d,e[16]=S):S=e[16];const N=u?f:void 0;let j,E,_,A,I,P,L,O,R,F;return e[17]!==u||e[18]!==f?(j=u?f?c.jsx(ko,{className:"w-4 h-4 mr-2 flex-shrink-0"}):c.jsx(Ma,{className:"w-4 h-4 mr-2 flex-shrink-0"}):c.jsx("div",{className:"w-4 mr-2 flex-shrink-0"}),e[17]=u,e[18]=f,e[19]=j):j=e[19],e[20]!==o.name?(E=c.jsx("span",{className:"font-medium truncate",children:o.name}),e[20]=o.name,e[21]=E):E=e[21],e[22]!==o.version?(_=o.version&&c.jsxs("span",{className:"text-muted-foreground text-xs",children:["v",o.version]}),e[22]=o.version,e[23]=_):_=e[23],e[24]!==E||e[25]!==_?(A=c.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 py-1.5",children:[E,_]}),e[24]=E,e[25]=_,e[26]=A):A=e[26],e[27]!==o.tags?(I=o.tags.map(ZM),e[27]=o.tags,e[28]=I):I=e[28],e[29]!==I?(P=c.jsx("div",{className:"flex items-center gap-1 ml-2",children:I}),e[29]=I,e[30]=P):P=e[30],e[31]!==d||e[32]!==o.name||e[33]!==l?(L=d&&c.jsxs("div",{className:"flex gap-1 invisible group-hover:visible",children:[c.jsx(rk,{packageName:o.name,onSuccess:l}),c.jsx(sk,{packageName:o.name,onSuccess:l})]}),e[31]=d,e[32]=o.name,e[33]=l,e[34]=L):L=e[34],e[35]!==b||e[36]!==g||e[37]!==j||e[38]!==A||e[39]!==P||e[40]!==L||e[41]!==w||e[42]!==S||e[43]!==N?(O=c.jsxs("div",{className:w,style:S,onClick:b,onKeyDown:g,tabIndex:0,role:"treeitem","aria-selected":!1,"aria-expanded":N,children:[j,A,P,L]}),e[35]=b,e[36]=g,e[37]=j,e[38]=A,e[39]=P,e[40]=L,e[41]=w,e[42]=S,e[43]=N,e[44]=O):O=e[44],e[45]!==a||e[46]!==u||e[47]!==f||e[48]!==r||e[49]!==o.dependencies||e[50]!==n||e[51]!==l||e[52]!==i?(R=u&&f&&c.jsx("div",{role:"group",children:o.dependencies.map((D,T)=>c.jsx(ak,{nodeId:`${n}-${T}`,node:D,level:r+1,isTopLevel:!1,expandedNodes:a,onToggle:i,onSuccess:l},`${D.name}-${T}`))}),e[45]=a,e[46]=u,e[47]=f,e[48]=r,e[49]=o.dependencies,e[50]=n,e[51]=l,e[52]=i,e[53]=R):R=e[53],e[54]!==O||e[55]!==R?(F=c.jsxs("div",{children:[O,R]}),e[54]=O,e[55]=R,e[56]=F):F=e[56],F};async function XM(){const[t,e]=await Promise.all([PR(),RR()]);return{list:t.packages,tree:e.tree}}function JM(t){return t.trim()}function ZM(t,e){return t.kind==="cycle"?c.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-orange-300 dark:border-orange-700 text-orange-700 dark:text-orange-300",title:"cycle",children:"cycle"},e):t.kind==="extra"?c.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-blue-300 dark:border-blue-700 text-blue-700 dark:text-blue-300",title:t.value,children:t.value},e):t.kind==="group"?c.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-green-300 dark:border-green-700 text-green-700 dark:text-green-300",title:t.value,children:t.value},e):null}const Lf=Ek("marimo:scratchpadHistory:v1",[]),QM=bt(!1),e7=bt(null,(t,e,n)=>{if(!(n=n.trim()))return;const o=t(Lf),r=[n,...o.filter(s=>s!==n)].slice(0,15);e(Lf,r)}),t7={hide_code:!1,disabled:!1},n7=()=>{const t=H.c(69),e=um(),[n]=fr(),{theme:o}=Ko(),r=M.useRef(null),s=cs(),{createNewCell:a,updateCellCode:i}=at(),l=e.cellRuntime[Xo],d=l==null?void 0:l.output,u=l==null?void 0:l.status,h=l==null?void 0:l.consoleOutputs,f=e.cellData[Xo],m=(f==null?void 0:f.code)??"",x=kt(e7),[g,p]=Mt(QM),b=Ne(Lf);let y;t[0]!==x||t[1]!==m?(y=()=>{gS({code:m}),x(m)},t[0]=x,t[1]=m,t[2]=y):y=t[2];const v=Fe(y);let w;t[3]!==m||t[4]!==a||t[5]!==s?(w=()=>{m.trim()&&a({code:m,before:!1,cellId:s??"__end__"})},t[3]=m,t[4]=a,t[5]=s,t[6]=w):w=t[6];const S=Fe(w);let N;t[7]!==i?(N=()=>{i({cellId:Xo,code:"",formattingChange:!1}),gS({code:""});const se=r.current;se&&se.dispatch({changes:{from:0,to:se.state.doc.length,insert:""}})},t[7]=i,t[8]=N):N=t[8];const j=Fe(N);let E;t[9]!==p||t[10]!==i?(E=se=>{p(!1),i({cellId:Xo,code:se,formattingChange:!1});const be=r.current;be&&be.dispatch({changes:{from:0,to:be.state.doc.length,insert:se}})},t[9]=p,t[10]=i,t[11]=E):E=t[11];const _=Fe(E),[A,I]=M.useState();let P;t[12]!==m||t[13]!==h||t[14]!==v||t[15]!==A||t[16]!==d||t[17]!==o||t[18]!==n?(P=()=>c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[40%]",children:c.jsx(Cu,{theme:o,showPlaceholder:!1,id:Xo,code:m,config:t7,status:"idle",serializedEditorState:null,runCell:v,userConfig:n,editorViewRef:r,setEditorView:se=>{r.current=se},hidden:!1,showHiddenCode:Rn.NOOP,languageAdapter:A,setLanguageAdapter:I})}),c.jsx("div",{className:"flex-1 overflow-auto flex-shrink-0",children:c.jsx(Ac,{allowExpand:!1,output:d,className:"output-area",cellId:Xo,stale:!1,loading:!1})}),c.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[35%]",children:c.jsx(Wm,{consoleOutputs:h,className:"overflow-auto",stale:!1,cellName:_k,onSubmitDebugger:Rn.NOOP,cellId:Xo,debuggerActive:!1})})]}),t[12]=m,t[13]=h,t[14]=v,t[15]=A,t[16]=d,t[17]=o,t[18]=n,t[19]=P):P=t[19];const L=P;let O;t[20]!==_||t[21]!==b||t[22]!==g||t[23]!==o?(O=()=>g?c.jsx("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:c.jsx("div",{className:"overflow-auto flex flex-col gap-3",children:b.map((se,be)=>c.jsx("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>_(se),children:c.jsx(M.Suspense,{children:c.jsx(ri,{language:"python",theme:o,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:se.trim(),editable:!1,readOnly:!0})})},be))})}):null,t[20]=_,t[21]=b,t[22]=g,t[23]=o,t[24]=O):O=t[24];const R=O;let F,D,T,k,B,C,U,V,$,X,Y;t[25]===Symbol.for("react.memo_cache_sentinel")?(F=_a.create(Xo),D=c.jsx("p",{className:"mx-2 my-2 text-muted-foreground text-sm",children:"Use this scratchpad cell to experiment with code without restrictions on variable names. Scratchpad code is ephemeral: variables defined in the scratchpad aren't saved to notebook memory, and the code is not saved in the notebook file."}),t[25]=F,t[26]=D):(F=t[25],D=t[26]),t[27]===Symbol.for("react.memo_cache_sentinel")?(T=Ht("cell.run"),t[27]=T):T=t[27],t[28]===Symbol.for("react.memo_cache_sentinel")?(k=c.jsx(wr,{color:"var(--grass-11)",size:16}),t[28]=k):k=t[28],t[29]!==v||t[30]!==g?(B=c.jsx(je,{content:T,children:c.jsx(ve,{"data-testid":"scratchpad-run-button",onClick:v,disabled:g,variant:"text",size:"xs",children:k})}),t[29]=v,t[30]=g,t[31]=B):B=t[31],t[32]===Symbol.for("react.memo_cache_sentinel")?(C=c.jsx(op,{size:16}),t[32]=C):C=t[32],t[33]!==j||t[34]!==g?(U=c.jsx(je,{content:"Clear code and outputs",children:c.jsx(ve,{disabled:g,size:"xs",variant:"text",onClick:j,children:C})}),t[33]=j,t[34]=g,t[35]=U):U=t[35],t[36]===Symbol.for("react.memo_cache_sentinel")?(V=c.jsx(kr,{size:16}),t[36]=V):V=t[36],t[37]!==S||t[38]!==g?($=c.jsx(Ms,{children:c.jsx(je,{content:"Insert code",children:c.jsx(ve,{disabled:g,size:"xs",variant:"text",onClick:S,children:V})})}),t[37]=S,t[38]=g,t[39]=$):$=t[39],t[40]!==u?(X=(u==="running"||u==="queued")&&c.jsx(bn,{className:"inline",size:"small"}),t[40]=u,t[41]=X):X=t[41],t[42]===Symbol.for("react.memo_cache_sentinel")?(Y=c.jsx("div",{className:"flex-1"}),t[42]=Y):Y=t[42];const J=g&&"bg-[var(--sky-3)] rounded-none";let Q,W;t[43]!==J?(Q=pe(J),t[43]=J,t[44]=Q):Q=t[44],t[45]!==g||t[46]!==p?(W=()=>p(!g),t[45]=g,t[46]=p,t[47]=W):W=t[47];const K=b.length===0;let oe,re,ne,ae,te,me,ce;return t[48]===Symbol.for("react.memo_cache_sentinel")?(oe=c.jsx(dp,{size:16}),t[48]=oe):oe=t[48],t[49]!==Q||t[50]!==W||t[51]!==K?(re=c.jsx(je,{content:"Toggle history",children:c.jsx(ve,{size:"xs",variant:"text",className:Q,onClick:W,disabled:K,children:oe})}),t[49]=Q,t[50]=W,t[51]=K,t[52]=re):re=t[52],t[53]!==B||t[54]!==U||t[55]!==$||t[56]!==X||t[57]!==re?(ne=c.jsxs("div",{className:"flex items-center flex-shrink-0",children:[B,U,$,X,Y,re]}),t[53]=B,t[54]=U,t[55]=$,t[56]=X,t[57]=re,t[58]=ne):ne=t[58],t[59]!==L?(ae=L(),t[59]=L,t[60]=ae):ae=t[60],t[61]!==R?(te=R(),t[61]=R,t[62]=te):te=t[62],t[63]!==ae||t[64]!==te?(me=c.jsxs("div",{className:"flex-1 divide-y relative overflow-hidden flex flex-col",children:[ae,te]}),t[63]=ae,t[64]=te,t[65]=me):me=t[65],t[66]!==ne||t[67]!==me?(ce=c.jsxs("div",{className:"flex flex-col h-full overflow-hidden divide-y",id:F,children:[D,ne,me]}),t[66]=ne,t[67]=me,t[68]=ce):ce=t[68],ce},o7=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx(n7,{}),t[0]=e):e=t[0],e},r7=()=>{const t=H.c(23),{openModal:e,closeModal:n}=Cn();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const{data:r,isPending:s,error:a,refetch:i}=En(a7,o);if(s){let b;return t[1]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(bn,{size:"medium",centered:!0}),t[1]=b):b=t[1],b}if(a){let b;return t[2]!==a?(b=c.jsx(br,{error:a}),t[2]=a,t[3]=b):b=t[3],b}let l;t[4]!==r?(l=r.filter(i7).map(l7),t[4]=r,t[5]=l):l=t[5];const d=l;if(r.length===0){let b;return t[6]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(an,{title:"No environment variables",description:"No environment variables are available in this notebook.",icon:c.jsx(Wc,{})}),t[6]=b):b=t[6],b}let u,h,f,m,x,g,p;return t[7]!==n||t[8]!==e||t[9]!==d||t[10]!==i?(u=()=>e(c.jsx(hg,{providerNames:d,onSuccess:()=>{i(),n()},onClose:n})),t[7]=n,t[8]=e,t[9]=d,t[10]=i,t[11]=u):u=t[11],t[12]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(Yo,{className:"h-4 w-4"}),t[12]=h):h=t[12],t[13]!==u?(f=c.jsx("div",{className:"flex justify-end h-8 border-b",children:c.jsx("button",{type:"button",className:"float-right border-l px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:u,children:h})}),t[13]=u,t[14]=f):f=t[14],t[15]===Symbol.for("react.memo_cache_sentinel")?(m=c.jsx(Fm,{children:c.jsxs(ws,{children:[c.jsx(yr,{children:"Environment Variable"}),c.jsx(yr,{children:"Source"}),c.jsx(yr,{})]})}),t[15]=m):m=t[15],t[16]!==r?(x=r.map(c7),t[16]=r,t[17]=x):x=t[17],t[18]!==x?(g=c.jsxs(zm,{className:"overflow-auto flex-1 mb-16",children:[m,c.jsx(Bm,{children:x})]}),t[18]=x,t[19]=g):g=t[19],t[20]!==f||t[21]!==g?(p=c.jsxs("div",{className:"flex flex-col h-full",children:[f,g]}),t[20]=f,t[21]=g,t[22]=p):p=t[22],p},s7=t=>{const e=H.c(9),{className:n,ariaLabel:o,onCopy:r}=t,[s,a]=q.useState(!1);let i;e[0]!==r?(i=()=>{r(),a(!0),setTimeout(()=>a(!1),1e3)},e[0]=r,e[1]=i):i=e[1];const l=i;let d,u;return e[2]!==s?(d=s?c.jsx(ic,{className:"w-3 h-3 text-green-700 rounded"}):c.jsx(Ea,{className:"w-3 h-3 hover:bg-muted rounded"}),e[2]=s,e[3]=d):d=e[3],e[4]!==o||e[5]!==n||e[6]!==l||e[7]!==d?(u=c.jsx("button",{type:"button",className:n,onClick:l,"aria-label":o,children:d}),e[4]=o,e[5]=n,e[6]=l,e[7]=d,e[8]=u):u=e[8],u};async function a7(){return ug((await IS.request({})).secrets)}function i7(t){return t.provider!=="env"}function l7(t){return t.name}function c7(t){return t.keys.map(e=>c.jsxs(ws,{className:"group",children:[c.jsx(vr,{children:e}),c.jsx(vr,{children:t.provider!=="env"&&c.jsx(eS,{variant:"outline",className:"select-none",children:t.name})}),c.jsx(vr,{children:c.jsx(s7,{ariaLabel:`Copy ${e}`,onCopy:async()=>{await nn(`os.environ["${e}"]`),Xe({title:"Copied to clipboard",description:`os.environ["${e}"] has been copied to your clipboard.`})},className:pe("float-right px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible")})})]},`${t.name}-${e}`))}const d7=t=>{const e=H.c(6),{children:n}=t,{openModal:o,closeModal:r}=Cn();let s,a;return e[0]!==r||e[1]!==o?(s=()=>o(c.jsx(h7,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(a=c.jsx(q3,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=a):a=e[5],a},u7=[He.lineWrapping],h7=t=>{const e=H.c(23),{onClose:n}=t,[o,r]=M.useState(""),{theme:s}=Ko();let a,i,l,d,u,h;e[0]!==n?(a=async v=>{v.preventDefault();const w=new FormData(v.target),S=w.get("title"),N=w.get("description"),j=w.get("code");fetch("https://marimo.io/api/suggest-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:S,description:N,code:j})}),n(),Xe({title:"Snippet Submitted",description:"Thank you for contributing! We will review your snippet shortly."})},e[0]=n,e[1]=a):a=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(Uo,{children:"Contribute a Snippet"}),e[2]=i):i=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsxs(rs,{children:[i,c.jsxs(ss,{children:["Have a useful snippet you want to share with the community? Submit it here or make a pull request"," ",c.jsx("a",{href:Dn.githubPage,target:"_blank",className:"underline",children:"on GitHub"}),"."]})]}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx($o,{id:"title",name:"title",autoFocus:!0,placeholder:"Title",required:!0,autoComplete:"off"}),u=c.jsx(BR,{id:"description",name:"description",autoFocus:!0,placeholder:"Description",rows:5,required:!0,autoComplete:"off"}),e[4]=d,e[5]=u):(d=e[4],u=e[5]),e[6]!==o?(h=c.jsx("input",{type:"hidden",name:"code",value:o}),e[6]=o,e[7]=h):h=e[7];const f=s==="dark"?"dark":"light";let m,x,g,p,b,y;return e[8]!==o||e[9]!==f?(m=c.jsx(ri,{theme:f,language:"python",className:"cm border rounded overflow-hidden",extensions:u7,value:o,onChange:r}),e[8]=o,e[9]=f,e[10]=m):m=e[10],e[11]!==h||e[12]!==m?(x=c.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[d,u,h,m]}),e[11]=h,e[12]=m,e[13]=x):x=e[13],e[14]!==n?(g=c.jsx(ve,{"data-testid":"snippet-cancel-button",variant:"secondary",onClick:n,children:"Cancel"}),e[14]=n,e[15]=g):g=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx(ve,{"data-testid":"snippet-send-button","aria-label":"Save",variant:"default",type:"submit",children:"Send"}),e[16]=p):p=e[16],e[17]!==g?(b=c.jsxs(Ca,{children:[g,p]}),e[17]=g,e[18]=b):b=e[18],e[19]!==a||e[20]!==b||e[21]!==x?(y=c.jsx(Vo,{className:"w-fit",children:c.jsxs("form",{onSubmit:a,children:[l,x,b]})}),e[19]=a,e[20]=b,e[21]=x,e[22]=y):y=e[22],y},f7=[He.lineWrapping],m7=()=>{const t=H.c(20),[e,n]=q.useState();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const{data:r,error:s,isPending:a}=En(x7,o);if(s){let b;return t[1]!==s?(b=c.jsx(br,{error:s}),t[1]=s,t[2]=b):b=t[2],b}if(a||!r){let b;return t[3]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(bn,{size:"medium",centered:!0}),t[3]=b):b=t[3],b}const i=e?"h-1/3":"h-full";let l,d,u,h,f,m,x,g,p;return t[4]!==i?(l=pe("border-b rounded-none",i),t[4]=i,t[5]=l):l=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(Oa,{placeholder:"Search snippets...",className:"h-6 m-1",rootClassName:"flex-1 border-r"}),t[6]=d):d=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsxs("div",{className:"flex items-center w-full",children:[d,c.jsx(d7,{children:c.jsx("button",{className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:c.jsx(Yo,{className:"h-4 w-4"})})})]}),h=c.jsx(nc,{children:"No results"}),t[7]=u,t[8]=h):(u=t[7],h=t[8]),t[9]===Symbol.for("react.memo_cache_sentinel")?(f=b=>n(b),t[9]=f):f=t[9],t[10]!==r.snippets?(m=c.jsx(g7,{onSelect:f,snippets:r.snippets}),t[10]=r.snippets,t[11]=m):m=t[11],t[12]!==l||t[13]!==m?(x=c.jsxs(dc,{className:l,children:[u,h,m]}),t[12]=l,t[13]=m,t[14]=x):x=t[14],t[15]!==e?(g=c.jsx(M.Suspense,{children:c.jsx("div",{className:"h-2/3 snippet-viewer flex flex-col",children:e?c.jsx(p7,{snippet:e},e.title):c.jsx(an,{title:"",description:"Click on a snippet to view its content."})})}),t[15]=e,t[16]=g):g=t[16],t[17]!==x||t[18]!==g?(p=c.jsxs("div",{className:"flex-1 overflow-hidden",children:[x,g]}),t[17]=x,t[18]=g,t[19]=p):p=t[19],p},p7=t=>{const e=H.c(27),{snippet:n}=t,{theme:o}=Ko(),{createNewCell:r}=at(),s=cs();let a;e[0]!==r||e[1]!==s||e[2]!==n.sections?(a=()=>{for(const p of[...n.sections].reverse())p.code&&r({code:p.code,before:!1,cellId:s??"__end__",skipIfCodeExists:!0})},e[0]=r,e[1]=s,e[2]=n.sections,e[3]=a):a=e[3];const i=a;let l;e[4]!==r||e[5]!==s?(l=p=>{r({code:p,before:!1,cellId:s??"__end__"})},e[4]=r,e[5]=s,e[6]=l):l=e[6];const d=l;let u,h,f,m,x,g;if(e[7]!==n.title?(u=c.jsx("div",{className:"text-sm font-semibold bg-muted border-y px-2 py-1",children:n.title}),e[7]=n.title,e[8]=u):u=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(kr,{className:"ml-2 h-4 w-4"}),e[9]=h):h=e[9],e[10]!==i?(f=c.jsx("div",{className:"flex justify-end",children:c.jsx(Ms,{children:c.jsxs(ve,{className:"float-right",size:"xs",variant:"outline",onClick:i,children:["Insert snippet",h]})})}),e[10]=i,e[11]=f):f=e[11],e[12]!==d||e[13]!==n.sections||e[14]!==n.title||e[15]!==o){let p;e[17]!==d||e[18]!==n.title||e[19]!==o?(p=b=>{const{code:y,html:v,id:w}=b;return v?c.jsx("div",{children:Om({html:v})},`${n.title}-${w}`):y?c.jsxs("div",{className:"relative hover-actions-parent pr-2",children:[c.jsx(Ms,{children:c.jsx(je,{content:"Insert snippet",children:c.jsx(ve,{className:"absolute -top-2 -right-1 z-10 hover-action px-2 bg-background",size:"sm",variant:"outline",onClick:()=>{d(y)},children:c.jsx(kr,{className:"h-5 w-5"})})})}),c.jsx(M.Suspense,{children:c.jsx(ri,{theme:o==="dark"?"dark":"light",language:"python",className:"cm border rounded overflow-hidden",extensions:f7,value:y,readOnly:!0},`${n.title}-${w}`)})]},`${n.title}-${w}`):null},e[17]=d,e[18]=n.title,e[19]=o,e[20]=p):p=e[20],m=n.sections.map(p),e[12]=d,e[13]=n.sections,e[14]=n.title,e[15]=o,e[16]=m}else m=e[16];return e[21]!==f||e[22]!==m?(x=c.jsxs("div",{className:"px-2 py-2 space-y-4 overflow-auto flex-1",children:[f,m]}),e[21]=f,e[22]=m,e[23]=x):x=e[23],e[24]!==u||e[25]!==x?(g=c.jsxs(c.Fragment,{children:[u,x]}),e[24]=u,e[25]=x,e[26]=g):g=e[26],g},g7=t=>{const e=H.c(7),{snippets:n,onSelect:o}=t;let r,s;if(e[0]!==o||e[1]!==n){let a;e[3]!==o?(a=i=>c.jsx(Yn,{className:"rounded-none",onSelect:()=>o(i),children:c.jsx("div",{className:"flex flex-row gap-2 items-center",children:c.jsx("span",{className:"mt-1 text-accent-foreground",children:i.title})})},i.title),e[3]=o,e[4]=a):a=e[4],r=n.map(a),e[0]=o,e[1]=n,e[2]=r}else r=e[2];return e[5]!==r?(s=c.jsx(km,{className:"flex flex-col overflow-auto",children:r}),e[5]=r,e[6]=s):s=e[6],s};function x7(){return UR()}const b7=q.lazy(()=>Nm(()=>import("./tracing-G-LeT7iS.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125]),import.meta.url).then(t=>({default:t.Tracing}))),y7=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx(q.Suspense,{fallback:c.jsx(v7,{}),children:c.jsx(b7,{})}),t[0]=e):e=t[0],e},v7=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:c.jsx(bn,{})}),t[0]=e):e=t[0],e},ik="name",lk="type-value",Ff="defs-refs",w7=[{id:ik,accessorFn:t=>[t.name,t.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>c.jsx(Um,{header:"Name",column:t}),cell:({getValue:t})=>{const[e,n]=t();return c.jsx(Kh,{name:e,declaredBy:n})}},{id:lk,accessorFn:t=>[t.dataType,t.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>c.jsx(Um,{header:c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("span",{children:"Type"}),c.jsx("span",{children:"Value"})]}),column:t}),cell:({getValue:t})=>{const[e,n]=t();return c.jsxs("div",{className:"max-w-[150px]",children:[c.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs",children:e}),c.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap",title:n??"",children:n})]})}},{id:Ff,accessorFn:t=>[t.declaredBy,t.usedBy,t.name,t.declaredByNames,t.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:t})=>c.jsx(Um,{header:c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("span",{children:"Declared By"}),c.jsx("span",{children:"Used By"})]}),column:t}),cell:({getValue:t})=>{const[e,n,o]=t(),r=s=>{const a=Aa(s);a&&Dm(a,o)};return c.jsxs("div",{className:"flex flex-col gap-1 py-1",children:[c.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-center",children:[c.jsx("span",{title:"Declared by",children:c.jsx(Tp,{className:"w-3.5 h-3.5 text-muted-foreground"})}),e.length===1?c.jsx(_o,{variant:"focus",cellId:e[0],skipScroll:!0,onClick:()=>r(e[0])}):c.jsx("div",{className:"text-destructive flex flex-row gap-2",children:e.slice(0,3).map((s,a)=>c.jsxs("span",{className:"flex",children:[c.jsx(_o,{variant:"focus",cellId:s,skipScroll:!0,className:"whitespace-nowrap text-destructive",onClick:()=>r(s)},s),a<e.length-1&&", "]},s))})]}),c.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-baseline",children:[c.jsx("span",{title:"Used by",children:c.jsx(mi,{className:"w-3.5 h-3.5 text-muted-foreground"})}),c.jsx(T2,{maxCount:3,cellIds:n,skipScroll:!0,onClick:r})]})]})}}],ck=M.memo(({className:t,cellIds:e,variables:n})=>{const[o,r]=q.useState([]),[s,a]=q.useState(""),i=$R(),l=M.useMemo(()=>{const h=f=>{const m=i[f];return GR(m)?`cell-${e.indexOf(f)}`:m??`cell-${e.indexOf(f)}`};return Object.values(n).map(f=>({...f,declaredByNames:f.declaredBy.map(h),usedByNames:f.usedBy.map(h)}))},[n,i,e]),d=M.useMemo(()=>{const h=new Map;return e.forEach((f,m)=>h.set(f,m)),function({variables:f,sort:m,cellIdToIndex:x}){m||(m={id:Ff,desc:!1});let g=[];switch(m.id){case ik:g=li(f,p=>p.name);break;case lk:g=li(f,p=>p.dataType);break;case Ff:g=li(f,p=>x.get(p.declaredBy[0]))}return m.desc?g.reverse():g}({variables:l,sort:o[0],cellIdToIndex:h})},[l,o,e]),u=VR({data:d,columns:w7,getCoreRowModel:qR(),onGlobalFilterChange:a,getFilteredRowModel:WR(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter:h=>h.columnDef.enableGlobalFilter??!0,globalFilterFn:"auto",manualSorting:!0,onSortingChange:r,getSortedRowModel:HR(),state:{sorting:o,globalFilter:s}});return c.jsxs(c.Fragment,{children:[c.jsx(fS,{className:"w-full",placeholder:"Search",value:s,onChange:h=>a(h.target.value)}),c.jsxs(zm,{className:pe("w-full text-sm flex-1 border-separate border-spacing-0",t),children:[c.jsx(Fm,{children:c.jsx(ws,{className:"whitespace-nowrap text-xs",children:u.getFlatHeaders().map(h=>c.jsx(yr,{className:"sticky top-0 bg-background border-b",children:xS(h.column.columnDef.header,h.getContext())},h.id))})}),c.jsx(Bm,{children:u.getRowModel().rows.map(h=>c.jsx(ws,{className:"hover:bg-accent",children:h.getVisibleCells().map(f=>c.jsx(vr,{className:"border-b",children:xS(f.column.columnDef.cell,f.getContext())},f.id))},h.id))})]})]})});ck.displayName="VariableTable";const k7=()=>{const t=H.c(4),e=Pm(),n=xr();if(Object.keys(e).length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(an,{title:"No variables",description:"Global variables will appear here.",icon:c.jsx(Hl,{})}),t[0]=r):r=t[0],r}let o;return t[1]!==n.inOrderIds||t[2]!==e?(o=c.jsx(ck,{className:"flex-1",cellIds:n.inOrderIds,variables:e}),t[1]=n.inOrderIds,t[2]=e,t[3]=o):o=t[3],o},S7=t=>{const e=H.c(54),n=Ne(YR),o=Ne(Z_),r=at(),s=T3(),a=t.cellId,i=o[t.cellId],l=Za(t.cellId),d=l.code,u=Qa(t.cellId);let h,f,m,x,g,p,b,y,v,w,S,N,j,E;if(e[0]!==r||e[1]!==s||e[2]!==n.focusedCellId||e[3]!==o||e[4]!==t.cellId||e[5]!==i||e[6]!==l.code||e[7]!==u.errored){if(h={id:a,graph:i,code:d,hasError:u.errored},n.focusedCellId&&o[n.focusedCellId]){const D=o[n.focusedCellId];let T;e[20]!==n.focusedCellId||e[21]!==D?(T={id:n.focusedCellId,graph:D},e[20]=n.focusedCellId,e[21]=D,e[22]=T):T=e[22],x=T}m=(x==null?void 0:x.id)===h.id,f=uk(h.graph)?1.5:3;const O=()=>{m?s.blurCell():(r.focusCell({cellId:h.id,where:"exact"}),s.focusCell({cellId:h.id}))};N=h.id;const R=m?"text-primary-foreground":"text-[var(--gray-8)] hover:text-[var(--gray-9)]";e[23]!==R?(g=pe("group bg-transparent text-left w-full flex relative justify-between items-center","border-none rounded cursor-pointer","h-[21px] pl-[51px] font-inherit",R),e[23]=R,e[24]=g):g=e[24],p=O,b=A7;const F=m&&"bg-primary group-hover:bg-primary";e[25]!==F?(S=pe("group-hover:bg-[var(--gray-2)] flex h-full w-full px-0.5 items-center rounded",F),e[25]=F,e[26]=S):S=e[26],y="truncate px-1 font-mono text-sm flex gap-1",v=h.code,w=h.graph.variables.length>0?c.jsx(E7,{cell:h,selectedCell:x}):c.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap max-w-full",children:C7(h.code)??c.jsx("span",{className:"italic",children:"empty"})}),e[0]=r,e[1]=s,e[2]=n.focusedCellId,e[3]=o,e[4]=t.cellId,e[5]=i,e[6]=l.code,e[7]=u.errored,e[8]=h,e[9]=f,e[10]=m,e[11]=x,e[12]=g,e[13]=p,e[14]=b,e[15]=y,e[16]=v,e[17]=w,e[18]=S,e[19]=N}else h=e[8],f=e[9],m=e[10],x=e[11],g=e[12],p=e[13],b=e[14],y=e[15],v=e[16],w=e[17],S=e[18],N=e[19];e[27]!==y||e[28]!==v||e[29]!==w?(j=c.jsx("div",{className:y,title:v,children:w}),e[27]=y,e[28]=v,e[29]=w,e[30]=j):j=e[30],e[31]!==j||e[32]!==S?(E=c.jsx("div",{className:S,children:j}),e[31]=j,e[32]=S,e[33]=E):E=e[33];const _=m?"z-30":"z-20";let A,I,P,L;return e[34]!==h||e[35]!==x||e[36]!==_?(A=pe("absolute overflow-visible top-[10.5px] left-[calc(var(--spacing-extra-small,8px)_+_17px)] pointer-events-none",_,function({cell:O,selectedCell:R}){return O.hasError?"text-destructive":!R&&!uk(O.graph)?"text-foreground":(R==null?void 0:R.id)===O.id||R!=null&&R.graph.parents.has(O.id)||R!=null&&R.graph.children.has(O.id)?"text-primary":"text-[var(--gray-8)]"}({cell:h,selectedCell:x})),e[34]=h,e[35]=x,e[36]=_,e[37]=A):A=e[37],e[38]!==h||e[39]!==f||e[40]!==m||e[41]!==t.cellPositions||e[42]!==x?(I=m?c.jsx(_7,{cell:h,cellPositions:t.cellPositions,circleRadius:f}):c.jsx(I7,{cell:h,selectedCell:x,circleRadius:f}),e[38]=h,e[39]=f,e[40]=m,e[41]=t.cellPositions,e[42]=x,e[43]=I):I=e[43],e[44]!==A||e[45]!==I?(P=c.jsx("svg",{className:A,width:"1",height:"1",children:I}),e[44]=A,e[45]=I,e[46]=P):P=e[46],e[47]!==g||e[48]!==p||e[49]!==b||e[50]!==E||e[51]!==P||e[52]!==N?(L=c.jsxs("button",{"data-node-id":N,className:g,onClick:p,onMouseDown:b,children:[E,P]}),e[47]=g,e[48]=p,e[49]=b,e[50]=E,e[51]=P,e[52]=N,e[53]=L):L=e[53],L},N7=t=>{const e=H.c(28),{open:n,setOpen:o}=t,r=xr();let s;e[0]!==r.inOrderIds?(s=Object.fromEntries(r.inOrderIds.map(T7)),e[0]=r.inOrderIds,e[1]=s):s=e[1];const a=s;let i;if(e[2]!==r){i=[];let v=0;for(const[w,S]of r.getColumns().entries())w>0&&i.push(v),v+=S.inOrderIds.length;e[2]=r,e[3]=i}else i=e[3];const l=n?"translate-x-0":"translate-x-[calc(100%+20px)]";let d,u,h,f,m,x,g,p,b,y;if(e[4]!==l?(d=pe("fixed top-14 right-5 z-50 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 rounded-lg border shadow-lg w-64 flex flex-col max-h-[58vh]","motion-safe:transition-transform motion-safe:duration-200 motion-safe:ease-in-out",l),e[4]=l,e[5]=d):d=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx("span",{className:"text-sm font-semibold",children:"Minimap"}),e[6]=u):u=e[6],e[7]!==o?(h=()=>o(!1),e[7]=o,e[8]=h):h=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(f=c.jsx(_n,{className:"h-4 w-4"}),e[9]=f):f=e[9],e[10]!==h?(m=c.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[u,c.jsx(ve,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:h,children:f})]}),e[10]=h,e[11]=m):m=e[11],e[12]!==r.inOrderIds||e[13]!==a||e[14]!==i){let v;e[16]!==a||e[17]!==i?(v=(w,S)=>{const N=i.includes(S);return c.jsxs(M.Fragment,{children:[N&&c.jsx("div",{className:"absolute left-5 w-[36px] h-px bg-[var(--gray-4)] pointer-events-none","aria-hidden":"true"}),c.jsx(S7,{cellId:w,cellPositions:a})]},w)},e[16]=a,e[17]=i,e[18]=v):v=e[18],x=r.inOrderIds.map(v),e[12]=r.inOrderIds,e[13]=a,e[14]=i,e[15]=x}else x=e[15];return e[19]!==x?(g=c.jsx("div",{className:"py-3 pl-3 pr-4 relative min-h-full",children:x}),e[19]=x,e[20]=g):g=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx("div",{className:"h-0 overflow-hidden","aria-hidden":"true"}),e[21]=p):p=e[21],e[22]!==g?(b=c.jsxs("div",{className:"overflow-y-auto overflow-x-hidden flex-1 scrollbar-none",children:[g,p]}),e[22]=g,e[23]=b):b=e[23],e[24]!==b||e[25]!==d||e[26]!==m?(y=c.jsxs("div",{className:d,children:[m,b]}),e[24]=b,e[25]=d,e[26]=m,e[27]=y):y=e[27],y},j7=()=>{const t=H.c(5),[e,n]=Mt(Nb);let o,r;return t[0]!==n?(o=()=>n(M7),t[0]=n,t[1]=o):o=t[1],Ot("global.toggleMinimap",o),t[2]!==e||t[3]!==n?(r=c.jsx(N7,{open:e,setOpen:n}),t[2]=e,t[3]=n,t[4]=r):r=t[4],r};function C7(t){return t.split(`
148
+ `)[0].trim()||void 0}const E7=t=>{const e=H.c(11),{cell:n,selectedCell:o}=t,r=Pm(),s=n.id===(o==null?void 0:o.id);let a,i;if(e[0]!==n.graph.variables||e[1]!==s||e[2]!==o||e[3]!==r){let l;e[5]!==s||e[6]!==o||e[7]!==r?(l=(d,u)=>{const h=r[d];return c.jsxs(M.Fragment,{children:[u>0&&", ",c.jsx("span",{className:pe({"font-bold":s,"text-foreground":o===void 0,"text-primary font-medium":!s&&Q_(h,o)}),children:d})]},d)},e[5]=s,e[6]=o,e[7]=r,e[8]=l):l=e[8],a=n.graph.variables.map(l),e[0]=n.graph.variables,e[1]=s,e[2]=o,e[3]=r,e[4]=a}else a=e[4];return e[9]!==a?(i=c.jsx(c.Fragment,{children:a}),e[9]=a,e[10]=i):i=e[10],i},_7=t=>{const e=H.c(12),{cell:n,cellPositions:o,circleRadius:r}=t;let s,a,i,l;if(e[0]!==n.graph.children||e[1]!==n.graph.parents||e[2]!==n.id||e[3]!==o){s=[];const d=o[n.id]??0,u=new Set;for(const h of n.graph.parents)n.graph.children.has(h)&&u.add(h);for(const h of u){const f=o[h];if(f!==void 0){const m=21*(f-d);s.push(c.jsx("path",{d:`M -3 0 H -7 v ${m} h 14 v ${-m} H 3`,fill:"none",strokeWidth:"2",stroke:"currentColor"},`${n.id}-cycle-${h}`))}}for(const h of n.graph.parents){if(u.has(h))continue;const f=o[h];if(f!==void 0){const m=21*(f-d);s.push(c.jsx("path",{d:`M -3 0 H -7 v ${m} h -4`,fill:"none",strokeWidth:"2",stroke:"currentColor"},`${n.id}-up-${h}`))}}for(const h of n.graph.children){if(u.has(h))continue;const f=o[h];if(f!==void 0){const m=21*(f-d);s.push(c.jsx("path",{d:`M 3 0 H 7 v ${m} h 4`,fill:"none",strokeWidth:"2",stroke:"currentColor"},`${n.id}-down-${h}`))}}e[0]=n.graph.children,e[1]=n.graph.parents,e[2]=n.id,e[3]=o,e[4]=s}else s=e[4];return e[5]!==r?(a=c.jsx("circle",{r,fill:"currentColor",className:"pointer-events-auto"}),e[5]=r,e[6]=a):a=e[6],e[7]!==s?(i=c.jsx("g",{className:"pen pointer-events-auto",children:s}),e[7]=s,e[8]=i):i=e[8],e[9]!==a||e[10]!==i?(l=c.jsxs("g",{transform:"translate(0, 0)",children:[a,i]}),e[9]=a,e[10]=i,e[11]=l):l=e[11],l};function I7(t){const{cell:e,selectedCell:n,circleRadius:o}=t,r=e.graph.ancestors.size>0,s=e.graph.descendants.size>0;if(!n)return dk({circleRadius:o,leftWisker:r,rightWisker:s});const a=n.graph.ancestors.has(e.id),i=n.graph.descendants.has(e.id);return dk(a||i?{circleRadius:o,leftWisker:r,rightWisker:s,shift:a&&i?void 0:a?"left":"right"}:{circleRadius:o,leftWisker:!1,rightWisker:!1})}function dk(t){const{circleRadius:e,leftWisker:n,rightWisker:o,shift:r}=t,s=r===void 0?0:r==="left"?-14:14;return c.jsxs("g",{transform:`translate(${s}, 0)`,children:[c.jsxs("g",{children:[n&&c.jsx("path",{d:"M 0 0 h -8",fill:"none",strokeWidth:"2",stroke:"currentColor"}),o&&c.jsx("path",{d:"M 0 0 h 8",fill:"none",strokeWidth:"2",stroke:"currentColor"})]}),c.jsx("circle",{r:e,fill:"currentColor",className:"pointer-events-auto"})]})}function uk(t){return t.variables.length===0&&t.ancestors.size===0&&t.descendants.size===0}function A7(t){return t.preventDefault()}function T7(t,e){return[t,e]}function M7(t){return!t}const O7=q.lazy(()=>Nm(()=>import("./terminal-BLngv0_q.js"),__vite__mapDeps([126,1,2,127]),import.meta.url)),D7=t=>{const e=H.c(122),{children:n}=t,{isSidebarOpen:o,isTerminalOpen:r,selectedPanel:s}=ac(),{setIsSidebarOpen:a,setIsTerminalOpen:i}=za(),l=q.useRef(null),d=q.useRef(null);let u,h,f,m,x;e[0]!==o?(u=()=>{if(!l.current)return;const Pe=l.current.isCollapsed();o&&Pe&&l.current.expand(),o||Pe||l.current.collapse(),requestAnimationFrame(R7)},h=[o],e[0]=o,e[1]=u,e[2]=h):(u=e[1],h=e[2]),M.useEffect(u,h),e[3]!==r?(f=()=>{if(!d.current)return;const Pe=d.current.isCollapsed();r&&Pe&&d.current.expand(),r||Pe||d.current.collapse(),requestAnimationFrame(F7)},m=[r],e[3]=r,e[4]=f,e[5]=m):(f=e[4],m=e[5]),M.useEffect(f,m),e[6]!==n?(x=c.jsx(Dc,{id:"app",className:"relative h-full",children:c.jsx(M.Suspense,{children:n})},"app"),e[6]=n,e[7]=x):x=e[7];const g=x,p=o?"resize-handle":"resize-handle-collapsed";let b,y;e[8]!==p?(b=pe("border-border no-print z-10",p,"vertical"),e[8]=p,e[9]=b):b=e[9],e[10]!==b?(y=c.jsx(bS,{onDragging:yS,className:b}),e[10]=b,e[11]=y):y=e[11];const v=y,w=r?"resize-handle":"resize-handle-collapsed";let S,N;e[12]!==w?(S=pe("border-border no-print z-20",w,"horizontal"),e[12]=w,e[13]=S):S=e[13],e[14]!==S?(N=c.jsx(bS,{onDragging:yS,className:S}),e[14]=S,e[15]=N):N=e[15];const j=N;let E,_,A,I,P,L,O,R,F,D,T,k,B,C,U,V,$,X,Y,J,Q;e[16]!==s?(E=c.jsx("div",{className:"text-sm text-[var(--slate-11)] uppercase tracking-wide font-semibold flex-1",children:s}),e[16]=s,e[17]=E):E=e[17],e[18]!==a?(_=()=>a(!1),e[18]=a,e[19]=_):_=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(A=c.jsx(_n,{className:"w-4 h-4"}),e[20]=A):A=e[20],e[21]!==_?(I=c.jsx(ve,{"data-testid":"close-helper-pane",className:"m-0",size:"xs",variant:"text",onClick:_,children:A}),e[21]=_,e[22]=I):I=e[22],e[23]!==E||e[24]!==I?(P=c.jsxs("div",{className:"p-3 border-b flex justify-between items-center",children:[E,I]}),e[23]=E,e[24]=I,e[25]=P):P=e[25],e[26]!==s?(L=s==="files"&&c.jsx(Qw,{}),e[26]=s,e[27]=L):L=e[27],e[28]!==s?(O=s==="errors"&&c.jsx(vM,{}),e[28]=s,e[29]=O):O=e[29],e[30]!==s?(R=s==="variables"&&c.jsx(k7,{}),e[30]=s,e[31]=R):R=e[31],e[32]!==s?(F=s==="dependencies"&&c.jsx(sM,{}),e[32]=s,e[33]=F):F=e[33],e[34]!==s?(D=s==="packages"&&c.jsx(qM,{}),e[34]=s,e[35]=D):D=e[35],e[36]!==s?(T=s==="outline"&&c.jsx(WM,{}),e[36]=s,e[37]=T):T=e[37],e[38]!==s?(k=s==="datasources"&&c.jsx(bM,{}),e[38]=s,e[39]=k):k=e[39],e[40]!==s?(B=s==="documentation"&&c.jsx(yM,{}),e[40]=s,e[41]=B):B=e[41],e[42]!==s?(C=s==="snippets"&&c.jsx(m7,{}),e[42]=s,e[43]=C):C=e[43],e[44]!==s?(U=s==="scratchpad"&&c.jsx(o7,{}),e[44]=s,e[45]=U):U=e[45],e[46]!==s?(V=s==="chat"&&c.jsx(E8,{}),e[46]=s,e[47]=V):V=e[47],e[48]!==s?($=s==="logs"&&c.jsx(ek,{}),e[48]=s,e[49]=$):$=e[49],e[50]!==s?(X=s==="tracing"&&c.jsx(y7,{}),e[50]=s,e[51]=X):X=e[51],e[52]!==s?(Y=s==="secrets"&&c.jsx(r7,{}),e[52]=s,e[53]=Y):Y=e[53],e[54]!==L||e[55]!==O||e[56]!==R||e[57]!==F||e[58]!==D||e[59]!==T||e[60]!==k||e[61]!==B||e[62]!==C||e[63]!==U||e[64]!==V||e[65]!==$||e[66]!==X||e[67]!==Y?(J=c.jsx(M.Suspense,{children:c.jsxs(Tc,{children:[L,O,R,F,D,T,k,B,C,U,V,$,X,Y]})}),e[54]=L,e[55]=O,e[56]=R,e[57]=F,e[58]=D,e[59]=T,e[60]=k,e[61]=B,e[62]=C,e[63]=U,e[64]=V,e[65]=$,e[66]=X,e[67]=Y,e[68]=J):J=e[68],e[69]!==P||e[70]!==J?(Q=c.jsx(uc,{children:c.jsxs("div",{className:"flex flex-col h-full flex-1 overflow-hidden mr-[-4px]",children:[P,J]})}),e[69]=P,e[70]=J,e[71]=Q):Q=e[71];const W=Q,K=o&&"border-r border-l border-[var(--slate-7)]";let oe,re,ne,ae,te,me;e[72]!==K?(oe=pe("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",K),e[72]=K,e[73]=oe):oe=e[73],e[74]===Symbol.for("react.memo_cache_sentinel")?(re=(Pe,Le)=>{var Ze;Le===0&&Pe===10&&((Ze=l.current)==null||Ze.resize(30))},e[74]=re):re=e[74],e[75]!==a?(ne=()=>a(!1),ae=()=>a(!0),e[75]=a,e[76]=ne,e[77]=ae):(ne=e[76],ae=e[77]),e[78]!==W||e[79]!==v?(te=c.jsxs("span",{className:"flex flex-row h-full",children:[W," ",v]}),e[78]=W,e[79]=v,e[80]=te):te=e[80],e[81]!==oe||e[82]!==ne||e[83]!==ae||e[84]!==te?(me=c.jsx(Dc,{ref:l,id:"helper",collapsedSize:0,collapsible:!0,className:oe,minSize:10,defaultSize:0,maxSize:75,onResize:re,onCollapse:ne,onExpand:ae,children:te},"helper"),e[81]=oe,e[82]=ne,e[83]=ae,e[84]=te,e[85]=me):me=e[85];const ce=me,se=r&&"border-[var(--slate-7)]";let be,ue,Se,Me,Ee,Re,Ae,Ye,Ve;e[86]!==se?(be=pe("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",se),e[86]=se,e[87]=be):be=e[87],e[88]===Symbol.for("react.memo_cache_sentinel")?(ue=(Pe,Le)=>{var Ze;Le===0&&Pe===10&&((Ze=d.current)==null||Ze.resize(30))},e[88]=ue):ue=e[88],e[89]!==i?(Se=()=>i(!1),Me=()=>i(!0),e[89]=i,e[90]=Se,e[91]=Me):(Se=e[90],Me=e[91]),e[92]===Symbol.for("react.memo_cache_sentinel")?(Ee=c.jsx("div",{}),e[92]=Ee):Ee=e[92],e[93]!==i?(Re=()=>i(!1),e[93]=i,e[94]=Re):Re=e[94],e[95]!==r||e[96]!==Re?(Ae=c.jsx(M.Suspense,{fallback:Ee,children:c.jsx(O7,{visible:r,onClose:Re})}),e[95]=r,e[96]=Re,e[97]=Ae):Ae=e[97],e[98]!==r||e[99]!==Ae?(Ye=c.jsx(aM,{isOpen:r,children:Ae}),e[98]=r,e[99]=Ae,e[100]=Ye):Ye=e[100],e[101]!==be||e[102]!==Se||e[103]!==Me||e[104]!==Ye||e[105]!==j?(Ve=c.jsxs(Dc,{ref:d,id:"terminal",collapsedSize:0,collapsible:!0,className:be,minSize:10,defaultSize:0,maxSize:75,onResize:ue,onCollapse:Se,onExpand:Me,children:[j,Ye]},"terminal"),e[101]=be,e[102]=Se,e[103]=Me,e[104]=Ye,e[105]=j,e[106]=Ve):Ve=e[106];const Ge=Ve;let ee,ye,we,Te,G,he,xe,de,ke;return e[107]===Symbol.for("react.memo_cache_sentinel")?(ee=BL(),e[107]=ee):ee=e[107],e[108]===Symbol.for("react.memo_cache_sentinel")?(ye=c.jsx(Tc,{children:c.jsx(c6,{})}),e[108]=ye):ye=e[108],e[109]!==Ge?(we=c.jsx(kb,{capability:"terminal",children:Ge}),e[109]=Ge,e[110]=we):we=e[110],e[111]!==g||e[112]!==we?(Te=c.jsx(Dc,{children:c.jsxs(vS,{autoSaveId:"marimo:chrome:v1:l1",direction:"vertical",children:[g,we]})}),e[111]=g,e[112]=we,e[113]=Te):Te=e[113],e[114]===Symbol.for("react.memo_cache_sentinel")?(G=c.jsx(KR,{}),e[114]=G):G=e[114],e[115]!==ce||e[116]!==Te?(he=c.jsxs(vS,{autoSaveId:"marimo:chrome:v1:l2",direction:"horizontal",storage:ee,children:[ye,ce,Te,G]}),e[115]=ce,e[116]=Te,e[117]=he):he=e[117],e[118]===Symbol.for("react.memo_cache_sentinel")?(xe=c.jsx(j7,{}),e[118]=xe):xe=e[118],e[119]===Symbol.for("react.memo_cache_sentinel")?(de=c.jsx(uc,{children:c.jsx(Tc,{children:c.jsx(r6,{})})}),e[119]=de):de=e[119],e[120]!==he?(ke=c.jsxs(UL,{children:[he,xe,de]}),e[120]=he,e[121]=ke):ke=e[121],ke};function P7(){window.dispatchEvent(new Event("resize"))}function R7(){requestAnimationFrame(P7)}function L7(){window.dispatchEvent(new Event("resize"))}function F7(){requestAnimationFrame(L7)}let hk;hk=new URL(window.location.href).searchParams.get(XR.showChrome)==="false",VS=Object.freeze(Object.defineProperty({__proto__:null,default:t=>{const e=H.c(10);if(hk){let s,a,i;return e[0]!==t?(s=c.jsx(wb,{hideControls:!0,...t}),e[0]=t,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx(Wp,{}),e[2]=a):a=e[2],e[3]!==s?(i=c.jsxs(c.Fragment,{children:[s,a]}),e[3]=s,e[4]=i):i=e[4],i}let n,o,r;return e[5]!==t?(n=c.jsx(wb,{...t}),e[5]=t,e[6]=n):n=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(o=c.jsx(Wp,{}),e[7]=o):o=e[7],e[8]!==n?(r=c.jsxs(D7,{children:[n,o]}),e[8]=n,e[9]=r):r=e[9],r}},Symbol.toStringTag,{value:"Module"}))});export{Km as C,Rc as E,an as P,KL as __tla,Lc as a,VS as e,Ns as f};