@marimo-team/frontend 0.14.11-dev6 → 0.14.11-dev8

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 (90) hide show
  1. package/dist/assets/{ConnectedDataExplorerComponent-C0P31a5y.js → ConnectedDataExplorerComponent-BZCmp5aR.js} +1 -1
  2. package/dist/assets/{ImageComparisonComponent-DXDeGx2f.js → ImageComparisonComponent-COH6lRBM.js} +1 -1
  3. package/dist/assets/{VegaLite-CUqFyetE.js → VegaLite-BRccRtf1.js} +1 -1
  4. package/dist/assets/{_baseEach-BHb51vC7.js → _baseEach-lpPh9W5d.js} +1 -1
  5. package/dist/assets/_baseMap-SEd-6IK0.js +1 -0
  6. package/dist/assets/{_baseUniq-CABXtSlj.js → _baseUniq-DuEzVkFZ.js} +1 -1
  7. package/dist/assets/{_createAggregator-SoA2y5HH.js → _createAggregator-8M5K7ZTQ.js} +1 -1
  8. package/dist/assets/{any-language-editor-Bw2cdBsS.js → any-language-editor-Dx_DmQpj.js} +1 -1
  9. package/dist/assets/{architectureDiagram-IEHRJDOE-rGoAHYH8.js → architectureDiagram-IEHRJDOE-Cjnv8Vq_.js} +1 -1
  10. package/dist/assets/{blockDiagram-JOT3LUYC-ZBJWq8Z_.js → blockDiagram-JOT3LUYC-BEIjTgHI.js} +1 -1
  11. package/dist/assets/{c4Diagram-VJAJSXHY-BHtN7uMz.js → c4Diagram-VJAJSXHY-yQmPFHka.js} +1 -1
  12. package/dist/assets/channel-BRxA1AAC.js +1 -0
  13. package/dist/assets/{chunk-4BMEZGHF-BO5DiwLV.js → chunk-4BMEZGHF-PHya-g-m.js} +1 -1
  14. package/dist/assets/{chunk-A2AXSNBT-B07L-F60.js → chunk-A2AXSNBT-tIg30O59.js} +1 -1
  15. package/dist/assets/{chunk-AEK57VVT-DN2-tsCz.js → chunk-AEK57VVT-BfGK6Ank.js} +1 -1
  16. package/dist/assets/{chunk-D6G4REZN-CbYGlbyQ.js → chunk-D6G4REZN-Cp5gAhaU.js} +1 -1
  17. package/dist/assets/{chunk-RZ5BOZE2-DVex9AD8.js → chunk-RZ5BOZE2-DhqVBY2t.js} +1 -1
  18. package/dist/assets/{chunk-XZIHB7SX-COKmet6t.js → chunk-XZIHB7SX-CJx8F-BK.js} +1 -1
  19. package/dist/assets/{circle-play-DSXPiHO0.js → circle-play-Bj5lce2y.js} +1 -1
  20. package/dist/assets/classDiagram-GIVACNV2-BO83RfZB.js +1 -0
  21. package/dist/assets/classDiagram-v2-COTLJTTW-BO83RfZB.js +1 -0
  22. package/dist/assets/clone-BlzJWayF.js +1 -0
  23. package/dist/assets/{compile-DEz1Y6_F.js → compile-C3U-vg-j.js} +1 -1
  24. package/dist/assets/{dagre-OKDRZEBW-CymbL2JX.js → dagre-OKDRZEBW-NdY44hpH.js} +1 -1
  25. package/dist/assets/{data-editor-CTGVBJdC.js → data-editor-DKntw_rI.js} +1 -1
  26. package/dist/assets/{diagram-SSKATNLV-DY5vs_Bj.js → diagram-SSKATNLV-DF4qzt72.js} +1 -1
  27. package/dist/assets/{diagram-VNBRO52H-ZuQiOKh8.js → diagram-VNBRO52H-Dbdog9oU.js} +1 -1
  28. package/dist/assets/{edit-page-DcQ6ZhfW.js → edit-page-BrfZeOgm.js} +3 -3
  29. package/dist/assets/{erDiagram-Q7BY3M3F-l-V_9Yws.js → erDiagram-Q7BY3M3F-Bdu1RFft.js} +1 -1
  30. package/dist/assets/{flowDiagram-4HSFHLVR-BsHIJJTe.js → flowDiagram-4HSFHLVR-i5Ql-QiJ.js} +1 -1
  31. package/dist/assets/{ganttDiagram-APWFNJXF-2gy5YbWU.js → ganttDiagram-APWFNJXF-Dmuf1Tpo.js} +1 -1
  32. package/dist/assets/{gitGraphDiagram-7IBYFJ6S-B_ELHLbw.js → gitGraphDiagram-7IBYFJ6S-DPM6GuRf.js} +1 -1
  33. package/dist/assets/{graph-DpLAfWzk.js → graph-CobhnVVx.js} +1 -1
  34. package/dist/assets/{home-page-6auHzaGk.js → home-page-HL6VA5dw.js} +1 -1
  35. package/dist/assets/{index-CmVTfWOx.js → index-4adJyO1X.js} +1 -1
  36. package/dist/assets/{index-DP4HiwTU.js → index-8quJWwGd.js} +1 -1
  37. package/dist/assets/{index-kmp97oxc.js → index-BJcBz6ZX.js} +1 -1
  38. package/dist/assets/{index-DAMc4rP9.js → index-Bfo4GfNg.js} +1 -1
  39. package/dist/assets/{index-DQwFB8dN.js → index-BphBwy1v.js} +1 -1
  40. package/dist/assets/{index-N67HDT2u.js → index-BtQD1xRv.js} +1 -1
  41. package/dist/assets/{index-C9EPiaCd.js → index-C-WOu_u0.js} +1 -1
  42. package/dist/assets/{index-DDVWq6NK.js → index-CJaEBn8N.js} +13 -13
  43. package/dist/assets/{index-C9EbJL5c.js → index-CaI_HNZm.js} +1 -1
  44. package/dist/assets/{index-Bz3Lb65G.js → index-CoGECqH1.js} +1 -1
  45. package/dist/assets/{index-FYYNNs_X.js → index-DBaMrMdr.js} +1 -1
  46. package/dist/assets/{index-Cig6xGYH.js → index-DPNo-jY5.js} +1 -1
  47. package/dist/assets/{index-DZWCSqpf.js → index-DVJeqlnb.js} +1 -1
  48. package/dist/assets/{index-Cs9jrmWP.js → index-Dfhr_H2_.js} +1 -1
  49. package/dist/assets/{index-DbunLlvf.js → index-DisN4g0K.js} +1 -1
  50. package/dist/assets/{index-B-mClP__.js → index-DvEXKxQ8.js} +1 -1
  51. package/dist/assets/{index-BuqjbKw0.js → index-O2ELw6Hz.js} +1 -1
  52. package/dist/assets/{index-CxQo8Qlm.js → index-RyqulB0I.js} +1 -1
  53. package/dist/assets/{index-Czo055fo.js → index-kFBaVNpO.js} +1 -1
  54. package/dist/assets/infoDiagram-PH2N3AL5-LArKQ0VO.js +2 -0
  55. package/dist/assets/{journeyDiagram-U35MCT3I-NKSvtlZA.js → journeyDiagram-U35MCT3I-B3lHGKMN.js} +1 -1
  56. package/dist/assets/{kanban-definition-NDS4AKOZ-Cw4Vh4wD.js → kanban-definition-NDS4AKOZ-Q5EE_ssH.js} +1 -1
  57. package/dist/assets/{layout-DodQLUx6.js → layout-CDn8-Krb.js} +1 -1
  58. package/dist/assets/{linear-B_OPGLLI.js → linear-D6T4b48H.js} +1 -1
  59. package/dist/assets/{mermaid-CVRC4Ruz.js → mermaid-CMc1ns6_.js} +4 -4
  60. package/dist/assets/{min-VmgWsmJ_.js → min-rO9M7_m2.js} +1 -1
  61. package/dist/assets/{mindmap-definition-ALO5MXBD-C0KGo_i_.js → mindmap-definition-ALO5MXBD-BIL8Yk33.js} +1 -1
  62. package/dist/assets/{pieDiagram-IB7DONF6-DCnELF9y.js → pieDiagram-IB7DONF6-CXSjueVW.js} +1 -1
  63. package/dist/assets/{quadrantDiagram-7GDLP6J5-D0cP5ixt.js → quadrantDiagram-7GDLP6J5-BpFvASma.js} +1 -1
  64. package/dist/assets/{radar-MK3ICKWK-D8LhkSau.js → radar-MK3ICKWK-_zCJRWdg.js} +1 -1
  65. package/dist/assets/{react-plotly-BmDAcz3M.js → react-plotly-0nDvD8D3.js} +1 -1
  66. package/dist/assets/{requirementDiagram-KVF5MWMF-BTksN04O.js → requirementDiagram-KVF5MWMF-unRzxNJE.js} +1 -1
  67. package/dist/assets/{run-page-17VQxU3e.js → run-page-DtL_9ryc.js} +1 -1
  68. package/dist/assets/{sankeyDiagram-QLVOVGJD-DECOJIMC.js → sankeyDiagram-QLVOVGJD-Cn-XfYiE.js} +1 -1
  69. package/dist/assets/{sequenceDiagram-X6HHIX6F-C5eDWwoH.js → sequenceDiagram-X6HHIX6F-CeDzabVO.js} +1 -1
  70. package/dist/assets/{shutdown-button-QvkERkPd.js → shutdown-button-CiYHSs8n.js} +1 -1
  71. package/dist/assets/{slides-component-DchvPU9C.js → slides-component-DloQyWa5.js} +1 -1
  72. package/dist/assets/{sortBy-7ke7bFD2.js → sortBy-HenacHs2.js} +1 -1
  73. package/dist/assets/{stateDiagram-DGXRK772-D6Kwy963.js → stateDiagram-DGXRK772-PGZIv6yW.js} +1 -1
  74. package/dist/assets/stateDiagram-v2-YXO3MK2T-tCMN3u5q.js +1 -0
  75. package/dist/assets/{storage-BeNhlsrY.js → storage-h-OfQolp.js} +3 -3
  76. package/dist/assets/{terminal-MtCDBvKs.js → terminal-BgXO_ixx.js} +1 -1
  77. package/dist/assets/{time-BoP93jle.js → time-CRNs3SAd.js} +1 -1
  78. package/dist/assets/{timeline-definition-BDJGKUSR-T1la59d1.js → timeline-definition-BDJGKUSR-fax3GFbF.js} +1 -1
  79. package/dist/assets/{tracing-CCltm96L.js → tracing-DJ3yaJpl.js} +2 -2
  80. package/dist/assets/{vega-component-j1BDb2QJ.js → vega-component-Di8oSnQq.js} +1 -1
  81. package/dist/assets/{xychartDiagram-VJFVF3MP-CoJqer7_.js → xychartDiagram-VJFVF3MP-CK-bnFkL.js} +1 -1
  82. package/dist/index.html +1 -1
  83. package/package.json +1 -1
  84. package/dist/assets/_baseMap--rH4lBFQ.js +0 -1
  85. package/dist/assets/channel-C96bdTqW.js +0 -1
  86. package/dist/assets/classDiagram-GIVACNV2-CehC5H1T.js +0 -1
  87. package/dist/assets/classDiagram-v2-COTLJTTW-CehC5H1T.js +0 -1
  88. package/dist/assets/clone-H0gxlZXI.js +0 -1
  89. package/dist/assets/infoDiagram-PH2N3AL5-BwbaSo89.js +0 -2
  90. package/dist/assets/stateDiagram-v2-YXO3MK2T-Bk10XR94.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./tracing-CCltm96L.js","./index-DDVWq6NK.js","./index-8IZtaDUn.css","./compile-DEz1Y6_F.js","./time-BoP93jle.js","./timer-Bqd5yn_a.js","./linear-B_OPGLLI.js","./init-DLRA0X12.js","./range-CtcPcB_L.js","./zoom-COrs4lFh.js","./ordinal-DDUp3AbE.js","./colors-bszWmPJw.js","./step-BwsUM5iJ.js","./arc-CfyY4LWz.js","./storage-BeNhlsrY.js","./index-CmVTfWOx.js","./index-Bz3Lb65G.js","./index-FYYNNs_X.js","./index-C9EPiaCd.js","./index-N67HDT2u.js","./index-Cs9jrmWP.js","./index-Cig6xGYH.js","./index-DZWCSqpf.js","./index-DP4HiwTU.js","./index-Czo055fo.js","./index-C9EbJL5c.js","./index-BuqjbKw0.js","./index-CxQo8Qlm.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","./storage-De8XnUVS.css","./shutdown-button-QvkERkPd.js","./index-DbunLlvf.js","./shutdown-button-C1rhMrxo.css","./circle-play-DSXPiHO0.js","./_createAggregator-SoA2y5HH.js","./_baseEach-BHb51vC7.js","./transform-DetRMEbJ.js","./sortBy-7ke7bFD2.js","./_baseMap--rH4lBFQ.js","./terminal-MtCDBvKs.js","./terminal-WqMRJt5Z.css"])))=>i.map(i=>d[i]);
2
- var cz=Object.defineProperty;var v3=Rt=>{throw TypeError(Rt)};var dz=(Rt,Ct,dn)=>Ct in Rt?cz(Rt,Ct,{enumerable:!0,configurable:!0,writable:!0,value:dn}):Rt[Ct]=dn;var ee=(Rt,Ct,dn)=>dz(Rt,typeof Ct!="symbol"?Ct+"":Ct,dn),uz=(Rt,Ct,dn)=>Ct.has(Rt)||v3("Cannot "+dn);var k3=(Rt,Ct,dn)=>(uz(Rt,Ct,"read from private field"),dn?dn.call(Rt):Ct.get(Rt)),S3=(Rt,Ct,dn)=>Ct.has(Rt)?v3("Cannot add the same private member more than once"):Ct instanceof WeakSet?Ct.add(Rt):Ct.set(Rt,dn);import{u as Oe,Q as M,ib as hz,ic as fz,id as C3,ie as pz,ig as mz,ih as gz,a as K,ii as _z,ij as jr,ik as bz,il as Xf,im as N3,io as yz,ip as xz,iq as j3,ir as Wl,c as X,eA as wz,ar as ut,j as d,ah as Yn,ao as er,an as vs,ap as ks,bs as tr,W as Te,aq as pn,is as Vi,am as nr,aS as Pn,as as $i,a4 as Ae,a0 as Kt,dX as Zf,eK as Ss,it as vz,aN as Xe,a9 as It,iu as kz,eQ as Ln,iv as E3,iw as I3,ix as Qf,iy as A3,iz as Sz,L as kt,dE as ql,aZ as or,iA as Gl,a$ as ep,av as xn,iB as Cz,a7 as Yl,iC as Nz,iD as T3,eP as M3,_ as Ht,b6 as O3,iE as D3,cG as tp,iF as jz,dO as ct,iG as R3,dV as np,iH as Ez,iI as Jl,Z as Be,bd as Fn,iJ as Kl,iK as Xl,eF as Cs,iL as Iz,iM as Hi,iN as Az,eN as Tz,iO as P3,iP as L3,eo as Mz,iQ as ao,iR as Er,aX as Zl,iS as Oz,iT as Ql,iU as F3,a5 as Ns,ec as z3,a6 as Wi,iV as Dz,iW as op,iX as Ir,bu as Ar,eG as Tr,fm as B3,g6 as Mr,fB as Rz,bg as tn,iY as Pz,iZ as Lz,g4 as rp,aP as ec,i_ as sp,i$ as Fz,j0 as U3,j1 as ip,j2 as zz,j3 as Bz,j4 as lo,j5 as V3,ga as ap,j6 as qi,j7 as tc,et as ke,j8 as We,j9 as lp,ja as xt,jb as $3,dy as nc,du as oc,dv as rc,dw as sc,dt as Gi,jc as Uz,fz as cp,b5 as wn,aJ as zn,fp as H3,fr as W3,fs as Vz,fx as $z,ft as q3,V as je,en as Hz,aV as js,b3 as Es,aW as Is,b0 as Wt,eO as co,jd as Wz,fv as G3,je as qz,fn as Y3,fo as J3,jf as As,dx as K3,jg as X3,jh as Gz,ji as Yz,al as Jz,ak as Kz,jj as dp,dB as Xz,dD as up,fb as ic,jk as ac,jl as lc,bx as vn,jm as Zz,eJ as Yi,f8 as cn,bl as Z3,dY as Ft,jn as Qz,ei as eB,ai as hp,jo as Ji,jp as cc,jq as tB,jr as nB,js as Q3,jt as nn,aY as oB,au as fp,g9 as e4,ep as dc,ju as rB,gv as pp,bk as uc,jv as mp,aj as sB,jw as iB,at as Ki,eB as t4,bo as aB,jx as lB,jy as n4,jz as cB,jA as dB,jB as uB,jC as hB,jD as fB,dz as Do,jE as pB,jF as hc,jG as Ts,o as Ro,n as tt,fQ as kn,jH as Sn,jI as dt,jJ as Ms,jK as At,g5 as qt,jL as gp,es as Jn,jM as mB,jN as gB,bi as o4,bj as r4,jO as s4,jP as _B,gx as Os,jQ as fc,bf as pc,gy as Or,eR as _p,jR as bB,jS as yB,jT as xB,jU as wB,jV as i4,jW as Xi,jX as a4,jY as vB,jZ as l4,j_ as c4,j$ as kB,k0 as d4,k1 as u4,eS as mc,k2 as SB,k3 as h4,k4 as Zi,k5 as Qi,k6 as gc,k7 as rr,k8 as f4,k9 as Po,ka as Ds,kb as bp,kc as ea,kd as Rs,ke as yp,kf as xp,kg as p4,kh as _c,ki as CB,S as ta,kj as na,kk as NB,dU as bc,kl as jB,km as wp,kn as EB,ko as IB,kp as yc,e1 as AB,kq as vp,kr as Ps,ks as xc,kt as Ls,fP as Bn,f_ as Lo,fM as m4,cq as g4,ku as kp,fy as _4,kv as Sp,kw as b4,kx as oa,ky as y4,kz as wc,kA as Cp,kB as ra,kC as sa,kD as ia,kE as TB,fI as vc,kF as kc,kG as Sc,eh as MB,fJ as OB,kH as DB,kI as RB,kJ as PB,kK as LB,r as FB,kL as zB,kM as BB,kN as UB,fT as VB,kO as sr,kP as $B,kQ as x4,t as P,kR as HB,kS as WB,kT as qB,kU as GB,kV as YB,kW as JB,kX as KB,kY as XB,kZ as ZB,k_ as QB,k$ as eU,l0 as tU,l1 as nU,l2 as oU,l3 as rU,l4 as sU,l5 as iU,l6 as aU,l7 as lU,l8 as cU,l9 as dU,la as uU,lb as hU,lc as fU,ld as pU,le as mU,lf as gU,lg as _U,lh as bU,li as Np,lj as Cc,lk as w4,ll as yU,lm as xU,ln as v4,lo as wU,lp as Fs,lq as Un,lr as vU,ls as kU,lt as SU,lu as CU,lv as NU,lw as jU,lx as EU,ly as IU,lz as AU,lA as TU,lB as ir,lC as MU,lD as OU,lE as DU,lF as RU,d_ as PU,lG as LU,lH as k4,e2 as FU,lI as Nc,lJ as zU,lK as BU,lL as UU,lM as VU,X as ar,lN as jc,lO as $U,lP as HU,lQ as S4,lR as jp,gw as zs,lS as WU,lT as qU,lU as GU,lV as YU,fY as JU,br as KU,$ as Ep,lW as C4,lX as XU,lY as ZU,lZ as Ip,l_ as Ap,l$ as QU,m0 as N4,m1 as j4,m2 as Ec,fL as eV,ac as E4,dM as tV,m3 as I4,fk as St,m4 as aa,m5 as Bs,m6 as nV,m7 as oV,m8 as Tp,m9 as rV,cp as Mp,ma as sV,U as lr,bh as A4,mb as iV,mc as aV,md as Ic,me as T4,dK as Ac,bt as M4,mf as lV,mg as cV,mh as O4,mi as dV,mj as uV,mk as D4,ad as Op,ml as hV,bv as R4,mm as fV,eI as pV,mn as Fo,el as P4,mo as L4,eM as F4,fC as Tc,mp as Dp,mq as z4,aU as Rp,em as Mc,mr as B4,ms as mV,mt as gV,mu as _V,mv as U4,mw as bV,mx as V4,my as yV,gn as xV,fq as wV,fu as Pp,gq as vV,bq as Oc,mz as kV,mA as $4,mB as Lp,mC as SV,mD as CV,mE as NV,mF as jV,mG as H4,fd as Fp,dG as W4,mH as EV,mI as IV,mJ as AV,aO as TV,mK as MV,mL as OV,mM as DV,mN as RV,aa as PV,mO as Dc,ab as LV,mP as q4,f9 as FV,mQ as G4,ae as Vn,fG as zV,mR as BV,mS as UV,mT as Y4,mU as VV,mV as Us,mW as $V,mX as Rc,mY as HV,mZ as WV,y as J4,m_ as qV,dm as GV,m$ as la,n0 as K4,n1 as X4,n2 as Z4,n3 as Q4,n4 as YV,C as eS,n5 as JV,n6 as KV,n7 as XV,E as Dr,eX as tS,be as ZV,bc as QV,n8 as e$,n9 as t$,a2 as Pc,na as n$,a3 as cr,dJ as nS,nb as zp,nc as o$,dW as oS,nd as r$,ne as rS,nf as s$,ng as sS,nh as i$,ni as a$,nj as iS,nk as aS,nl as lS,f7 as cS,nm as l$,nn as c$,no as dS,np as uS,nq as Lc,nr as hS,ns as fS,nt as d$,nu as pS,nv as u$,nw as h$,nx as mS,ny as f$,nz as p$,nA as m$,nB as g$,nC as _$,nD as b$,dT as y$,nE as x$,nF as w$,fZ as Bp,nG as v$,nH as k$,nI as S$,nJ as C$,nK as N$,nL as j$,nM as E$,nN as I$,nO as A$,nP as T$,nQ as Up,nR as M$,fO as O$,nS as D$,nT as R$,nU as P$,nV as gS,nW as L$,a8 as F$,nX as z$,a1 as B$,eD as U$,gf as V$,nY as $$,nZ as H$,gh as Vp,gd as Vs,gi as Rr,ge as Pr,gj as $p,gk as Hp,n_ as _S,gg as W$,n$ as bS,o0 as q$,o1 as yS,o2 as dr,o3 as xS,gp as G$,o4 as Y$,o5 as J$,o6 as K$,o7 as X$,o8 as Z$,o9 as Q$,oa as wS,eu as eH,ob as Wp,aw as Fc,oc as vS,od as kS,ay as SS,ax as tH,dS as nH,__tla as oH}from"./index-DDVWq6NK.js";import{b as $s,A as rH,L as CS,g as sH,G as iH,s as aH,k as lH,B as NS,a as cH,M as dH,Y as uH,c as mn,u as ca,C as hH,S as fH,K as pH,d as mH,i as gH,e as jS,f as _H,h as bH,j as da,P as qp,l as ES,m as yH,n as xH,o as wH,p as vH,q as IS,r as Gp,T as kH}from"./shutdown-button-QvkERkPd.js";import{V as AS,d as Hs,I as Yp,N as TS,S as MS,e as OS,f as DS,L as RS,g as PS,F as LS,M as SH,l as FS,h as CH,j as uo,k as zc,m as Bc,i as NH,E as zS,n as jH,o as Jp,p as EH,q as IH,s as AH,t as TH,v as MH,w as OH,x as DH,y as RH,a as PH,C as LH,R as BS,A as FH,b as zH,T as BH,z as UH,B as VH,D as $H,G as HH,O as WH,c as qH,P as GH,__tla as YH}from"./storage-BeNhlsrY.js";import{c as JH}from"./_createAggregator-SoA2y5HH.js";import{s as Kn,i as ur,T as Kp,a as Xp}from"./transform-DetRMEbJ.js";import{g as US}from"./timer-Bqd5yn_a.js";import{i as KH}from"./zoom-COrs4lFh.js";import{s as ua}from"./sortBy-7ke7bFD2.js";let Zp,Uc,gn,Vc,VS,ha,XH=Promise.all([(()=>{try{return oH}catch{}})(),(()=>{try{return YH}catch{}})()]).then(async()=>{var Hl,y3;var Rt=JH(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});let Ct,dn,Qp,$c,Ws,Lr,em,tm,nm,om,fa,Hc,rm,pa,sm,Wc,im,am,qc,lm,cm,dm,ma,um,Gc,hm,fm,pm,mm,gm,_m,Yc,bm,Jc,Kc,ym,xm,wm,vm,km,ga,Sm,Cm,Xc,Nm,jm,Em,Zc,Im,Am,Tm,_a,Qc,ed,Mm,Om,Dm,Rm,Pm,Lm,Fm,zm,Bm,td,nd,Um,Vm,$m,ba,hr,fr;Ct=Oe("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),dn=Oe("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"}]]),Qp=Oe("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"}]]),$c=Oe("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),Ws=Oe("ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]),Lr=Oe("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"}]]),em=Oe("chevrons-down",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),tm=Oe("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),Vc=Oe("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),nm=Oe("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),om=Oe("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),fa=Oe("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),Hc=Oe("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"}]]),rm=Oe("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"}]]),pa=Oe("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"}]]),sm=Oe("code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]),Wc=Oe("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"}]]),im=Oe("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"}]]),am=Oe("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"}]]),qc=Oe("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"}]]),lm=Oe("eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]),cm=Oe("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"}]]),dm=Oe("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"}]]),ma=Oe("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"}]]),um=Oe("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"}]]),Gc=Oe("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"}]]),hm=Oe("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"}]]),fm=Oe("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"}]]),pm=Oe("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"}]]),mm=Oe("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"}]]),gm=Oe("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"}]]),_m=Oe("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"}]]),Yc=Oe("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"}]]),bm=Oe("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"}]]),Jc=Oe("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"}]]),Kc=Oe("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"}]]),ym=Oe("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"}]]),xm=Oe("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"}]]),wm=Oe("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"}]]),vm=Oe("message-circle-question",[["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"}]]),km=Oe("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"}]]),ga=Oe("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"}]]),Sm=Oe("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"}]]),Cm=Oe("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"}]]),Xc=Oe("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"}]]),Nm=Oe("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),jm=Oe("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"}]]),Em=Oe("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"}]]),Zc=Oe("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"}]]),Im=Oe("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"}]]),Am=Oe("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"}]]),Tm=Oe("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"}]]),_a=Oe("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"}]]),Qc=Oe("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"}]]),ed=Oe("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"}]]),Mm=Oe("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"}]]),Om=Oe("square-code",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),Dm=Oe("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"}]]),Rm=Oe("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"}]]),Pm=Oe("square-m",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8l4 4 4-4v8",key:"141u4e"}]]),Lm=Oe("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"}]]),Fm=Oe("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"}]]),zm=Oe("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"}]]),Bm=Oe("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"}]]),td=Oe("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"}]]),nd=Oe("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"}]]),Um=Oe("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]),Vm=Oe("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"}]]),$m=Oe("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"}]]),ba=Oe("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"}]]),hr=Oe("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"}]]),fr=Oe("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 $S=M.createContext({}),HS=M.forwardRef(function(t,e){[t,e]=mz(t,e,$S);let{toolbarProps:n}=function(s,i){const{"aria-label":a,"aria-labelledby":l,orientation:c="horizontal"}=s;let[u,h]=M.useState(!1);hz(()=>{var m;h(!(!i.current||!(!((m=i.current.parentElement)===null||m===void 0)&&m.closest('[role="toolbar"]'))))});const{direction:f}=fz(),p=f==="rtl"&&c==="horizontal";let _=pz(i);const g=M.useRef(null);return{toolbarProps:{...C3(s,{labelable:!0}),role:u?"group":"toolbar","aria-orientation":c,"aria-label":a,"aria-labelledby":a==null?l:void 0,onKeyDownCapture:u?void 0:m=>{if(m.currentTarget.contains(m.target)){if(c==="horizontal"&&m.key==="ArrowRight"||c==="vertical"&&m.key==="ArrowDown")p?_.focusPrevious():_.focusNext();else{if(!(c==="horizontal"&&m.key==="ArrowLeft"||c==="vertical"&&m.key==="ArrowUp"))return m.key==="Tab"?(m.stopPropagation(),g.current=document.activeElement,void(m.shiftKey?_.focusFirst():_.focusLast())):void 0;p?_.focusNext():_.focusPrevious()}m.stopPropagation(),m.preventDefault()}},onFocusCapture:u?void 0:m=>{var b,y;g.current&&!m.currentTarget.contains(m.relatedTarget)&&(!((b=i.current)===null||b===void 0)&&b.contains(m.target))&&((y=g.current)===null||y===void 0||y.focus(),g.current=null)},onBlurCapture:u?void 0:m=>{m.currentTarget.contains(m.relatedTarget)||g.current||(g.current=m.target)}}}}(t,e),o=gz({...t,values:{orientation:t.orientation||"horizontal"},defaultClassName:"react-aria-Toolbar"}),r=C3(t);return delete r.id,K.createElement("div",{..._z(n,r),...o,ref:e,slot:t.slot||void 0,"data-orientation":t.orientation||"horizontal"},o.children)});function ya(t,e){const n=+jr(t)-+jr(e);return n<0?-1:n>0?1:n}function WS(t,e){const n=jr(t,e==null?void 0:e.in);return+function(o,r){const s=jr(o,r==null?void 0:r.in);return s.setHours(23,59,59,999),s}(n,e)==+function(o,r){const s=jr(o,r==null?void 0:r.in),i=s.getMonth();return s.setFullYear(s.getFullYear(),i+1,0),s.setHours(23,59,59,999),s}(n,e)}function qS(t,e,n){const[o,r,s]=Xf(n==null?void 0:n.in,t,t,e),i=ya(r,s),a=Math.abs(function(u,h,f){const[p,_]=Xf(f==null?void 0:f.in,u,h);return 12*(p.getFullYear()-_.getFullYear())+(p.getMonth()-_.getMonth())}(r,s));if(a<1)return 0;r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-i*a);let l=ya(r,s)===-i;WS(o)&&a===1&&ya(o,s)===1&&(l=!1);const c=i*(a-+l);return c===0?0:c}function GS(t,e,n){const o=function(r,s){return+jr(r)-+jr(s)}(t,e)/1e3;return(r=>{const s=(0,Math.trunc)(r);return s===0?0:s})(o)}function YS(t,e){return function(n,o,r){const s=yz(),i=(r==null?void 0:r.locale)??s.locale??xz,a=ya(n,o);if(isNaN(a))throw new RangeError("Invalid time value");const l=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:a}),[c,u]=Xf(r==null?void 0:r.in,...a>0?[o,n]:[n,o]),h=GS(u,c),f=(N3(u)-N3(c))/1e3,p=Math.round((h-f)/60);let _;if(p<2)return p===0?i.formatDistance("lessThanXMinutes",1,l):i.formatDistance("xMinutes",p,l);if(p<45)return i.formatDistance("xMinutes",p,l);if(p<90)return i.formatDistance("aboutXHours",1,l);if(p<j3){const g=Math.round(p/60);return i.formatDistance("aboutXHours",g,l)}if(p<2520)return i.formatDistance("xDays",1,l);if(p<Wl){const g=Math.round(p/j3);return i.formatDistance("xDays",g,l)}if(p<2*Wl)return _=Math.round(p/Wl),i.formatDistance("aboutXMonths",_,l);if(_=qS(u,c),_<12){const g=Math.round(p/Wl);return i.formatDistance("xMonths",g,l)}{const g=_%12,m=Math.trunc(_/12);return g<3?i.formatDistance("aboutXYears",m,l):g<9?i.formatDistance("overXYears",m,l):i.formatDistance("almostXYears",m+1,l)}}(t,function(n){return bz(n,Date.now())}(t),e)}const xa="https://static.marimo.app",JS=t=>{const e=X.c(24),{onClose:n}=t,[o,r]=M.useState("");let s;s=Math.random().toString(36).slice(2,6);const i=`${o}-${s}`,a=`${xa}/static/${i}`;let l,c,u,h,f,p,_,g,m,b,y;return e[0]!==n||e[1]!==i?(l=async x=>{x.preventDefault(),n();const v=await wz({download:!1,includeCode:!0,files:AS.INSTANCE.filenames()}),C=ut({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${xa}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:v,path:i})}).catch(()=>{C.dismiss(),ut({title:"Error uploading static page",description:d.jsxs("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",d.jsx("a",{href:Yn.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),C.dismiss(),ut({title:"Static page uploaded!",description:d.jsxs("div",{children:["The URL has been copied to your clipboard.",d.jsx("br",{}),"You can share it with anyone."]})})},e[0]=n,e[1]=i,e[2]=l):l=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(er,{children:"Share static notebook"}),e[3]=c):c=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(u=d.jsxs(vs,{children:[c,d.jsxs(ks,{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"," ",d.jsx("a",{href:xa,target:"_blank",children:xa}),"."]})]}),e[4]=u):u=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(h=x=>{const v=x.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,"");r(v)},e[5]=h):h=e[5],e[6]!==o?(f=d.jsx(tr,{"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]!==a?(p=d.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:",d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(KS,{text:a}),d.jsx("span",{className:"text-primary",children:a})]})]}),e[8]=a,e[9]=p):p=e[9],e[10]!==f||e[11]!==p?(_=d.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[f,p]}),e[10]=f,e[11]=p,e[12]=_):_=e[12],e[13]!==n?(g=d.jsx(Te,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),e[13]=n,e[14]=g):g=e[14],e[15]!==a?(m=d.jsx(Te,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await pn(a)},children:"Create"}),e[15]=a,e[16]=m):m=e[16],e[17]!==m||e[18]!==g?(b=d.jsxs(Vi,{children:[g,m]}),e[17]=m,e[18]=g,e[19]=b):b=e[19],e[20]!==b||e[21]!==l||e[22]!==_?(y=d.jsx(nr,{className:"w-fit",children:d.jsxs("form",{onSubmit:l,children:[u,_,b]})}),e[20]=b,e[21]=l,e[22]=_,e[23]=y):y=e[23],y},KS=t=>{const e=X.c(8),[n,o]=K.useState(!1);let r;e[0]!==t.text?(r=Pn.stopPropagation(async c=>{c.preventDefault(),await pn(t.text),o(!0),setTimeout(()=>o(!1),2e3)}),e[0]=t.text,e[1]=r):r=e[1];const s=r;let i,a,l;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsx($i,{size:14,strokeWidth:1.5}),e[2]=i):i=e[2],e[3]!==s?(a=d.jsx(Te,{"data-testid":"copy-static-notebook-url-button",onClick:s,size:"xs",variant:"secondary",children:i}),e[3]=s,e[4]=a):a=e[4],e[5]!==n||e[6]!==a?(l=d.jsx(Ae,{content:"Copied!",open:n,children:a}),e[5]=n,e[6]=a,e[7]=l):l=e[7],l};function Hm(){const t=X.c(2),e=Kt(Zf);let n;return t[0]!==e?(n=()=>{const o=document.getElementsByClassName("output-area"),r=window.innerHeight||document.documentElement.clientHeight;let s;s=null;for(const i of Array.from(o)){const a=i.getBoundingClientRect();if(a.top>=0&&a.top<=r||a.bottom>=0&&a.bottom<=r){s=Ss.parse(i.parentNode.id);break}}e(i=>({mode:vz(i.mode),cellAnchor:s})),requestAnimationFrame(()=>{var i;s!==null&&((i=document.getElementById(Ss.create(s)))==null||i.scrollIntoView())})},t[0]=e,t[1]=n):n=t[1],n}function od(t){const e=X.c(3),n=rd();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],Xe(o)}function Wm(){const t=X.c(2),e=rd();let n;return t[0]!==e?(n=()=>e(E3(Ln())),t[0]=e,t[1]=n):n=t[1],Xe(n)}function rd(){const t=X.c(2),{prepareForRun:e}=It();let n;return t[0]!==e?(n=async o=>{var a,l;if(o.length===0)return;const{cellHandles:r,cellData:s}=Ln(),i=[];for(const c of o){const u=r[c],h=(a=u==null?void 0:u.current)==null?void 0:a.editorView;let f;h?(I3(h)!=="markdown"&&Qf(h),f=A3(h)):f=((l=s[c])==null?void 0:l.code)||"",i.push(f),e({cellId:c})}await Sz({cellIds:o,codes:i}).catch(XS)},t[0]=e,t[1]=n):n=t[1],Xe(n)}function XS(t){kt.error(t)}const sd=[{type:"files",Icon:hm,tooltip:"View files",position:"sidebar"},{type:"variables",Icon:ql,tooltip:"Explore variables",position:"sidebar"},{type:"datasources",Icon:or,tooltip:"Explore data sources",position:"sidebar"},{type:"dependencies",Icon:ga,tooltip:"Explore dependencies",position:"sidebar"},{type:"packages",Icon:$s,tooltip:"Manage packages",position:"sidebar"},{type:"outline",Icon:ed,tooltip:"View outline",position:"sidebar"},{type:"chat",Icon:Gl,tooltip:"Chat with AI",position:"sidebar"},{type:"documentation",Icon:td,tooltip:"View live docs",position:"sidebar"},{type:"logs",Icon:ep,tooltip:"Notebook logs",position:"sidebar"},{type:"tracing",Icon:rH,tooltip:"Tracing",position:"sidebar"},{type:"snippets",Icon:Dm,tooltip:"Snippets",position:"sidebar"},{type:"secrets",Icon:_m,tooltip:"Secrets",hidden:xn(),position:"sidebar"},{type:"scratchpad",Icon:Cz,tooltip:"Scratchpad",position:"sidebar"},{type:"errors",Icon:Yl,tooltip:"View errors",position:"footer"}];function ZS(){const t=X.c(7);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0];const[n,o]=function(i,a){const l=X.c(11);let c;l[0]!==a?(c=new Nz(a),l[0]=a,l[1]=c):c=l[1];const u=c;let h;l[2]!==i||l[3]!==u?(h=()=>u.get(i),l[2]=i,l[3]=u,l[4]=h):h=l[4];const[f,p]=M.useState(h);let _;l[5]!==i||l[6]!==u?(_=b=>{p(b),u.set(i,b)},l[5]=i,l[6]=u,l[7]=_):_=l[7];const g=_;let m;return l[8]!==g||l[9]!==f?(m=[f,g],l[8]=g,l[9]=f,l[10]=m):m=l[10],m}("marimo:commands",e);let r,s;return t[1]!==n||t[2]!==o?(r=i=>{const a=(l=[i,...n],[...new Set(l)]);var l;o(a.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 qm(t){return t.dropdown!==void 0}function wa(t,e=""){return t.flatMap(n=>n.label?qm(n)?wa(n.dropdown,`${e+n.label} > `):{...n,label:e+n.label}:[])}const qs=t=>{const e=X.c(8),{children:n,layerTop:o}=t,r=o!==void 0&&o;let s;e[0]!==n?(s=K.Children.toArray(n),e[0]=n,e[1]=s):s=e[1];const[i,a]=s,l=`second-icon absolute ${r?"top-[-2px] left-[-2px]":"bottom-[-2px] right-[-2px]"} rounded-full`;let c,u;return e[2]!==a||e[3]!==l?(c=d.jsx("div",{className:l,children:a}),e[2]=a,e[3]=l,e[4]=c):c=e[4],e[5]!==i||e[6]!==c?(u=d.jsxs("div",{className:"multi-icon relative w-fit",children:[i,c]}),e[5]=i,e[6]=c,e[7]=u):u=e[7],u},va=Ht(null),QS=Ht(!1),id=O3("marimo:ai:chatState:v3",{chats:[],activeChatId:null}),eC=Ht(t=>{const e=t(id);return e.chats.find(n=>n.id===e.activeChatId)},(t,e,n)=>{e(id,o=>({...o,activeChatId:n}))});function Gm(t){return t!==D3&&!!(t&&t.trim().length>0)}const ad=t=>{const e=X.c(7);let n,o;e[0]!==t?(n=a=>{var l;(a.ctrlKey||a.metaKey)&&a.key==="z"&&(a.preventDefault(),a.stopPropagation(),(l=t.onClick)==null||l.call(t,a))},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],tp(window,"keydown",n,o);const r=t.children??"Undo";let s,i;return e[3]===Symbol.for("react.memo_cache_sentinel")?(s=d.jsx(jz,{className:"ml-2",shortcut:"cmd-z"}),e[3]=s):s=e[3],e[4]!==r||e[5]!==t?(i=d.jsxs(Te,{"data-testid":"undo-button",size:"sm",variant:"outline",...t,children:[r," ",s]}),e[4]=r,e[5]=t,e[6]=i):i=e[6],i};function ld(){const t=X.c(3),{deleteCell:e,undoDeleteCell:n}=It();let o;return t[0]!==e||t[1]!==n?(o=r=>{var l;if(ct.get(R3))return;const{cellId:s}=r,i=ct.get(np),a=(((l=i.cellData[s])==null?void 0:l.code)??"").trim()==="";if(e({cellId:s}),Ez({cellId:s}).catch(()=>{n()}),!a){const{dismiss:c}=ut({title:"Cell deleted",description:"You can bring it back by clicking undo or through the command palette.",action:d.jsx(ad,{"data-testid":"undo-delete-button",onClick:()=>{n(),u()}})}),u=c}},t[0]=e,t[1]=n,t[2]=o):o=t[2],Xe(o)}function Ym(){const t=X.c(3),{splitCell:e,undoSplitCell:n}=It();let o;return t[0]!==e||t[1]!==n?(o=r=>{const s=Jl(r.cellId);if(!s)return;const i=A3(s);e(r);const{dismiss:a}=ut({title:"Cell split",action:d.jsx(ad,{"data-testid":"undo-split-button",size:"sm",variant:"outline",onClick:()=>{n({...r,snapshot:i}),l()},children:"Undo"})}),l=a},t[0]=e,t[1]=n,t[2]=o):o=t[2],Xe(o)}function cd(t){const e=X.c(49),{cell:n}=t,{createNewCell:o,updateCellConfig:r,updateCellName:s,moveCell:i,sendToTop:a,sendToBottom:l,addColumnBreakpoint:c,clearCellOutput:u}=It(),h=Ym(),f=od(n==null?void 0:n.cellId),p=!Be(R3),_=ld(),{openModal:g}=Fn(),m=Kt(va),b=Be(Kl),y=Be(Xl),x=Be(Cs),v=Be(Iz);if(!n||x){let E;return e[0]===Symbol.for("react.memo_cache_sentinel")?(E=[],e[0]=E):E=e[0],E}const{cellId:C,config:k,getEditorView:j,name:N,hasOutput:I,hasConsoleOutput:A,status:T}=n;let R;e[1]!==C||e[2]!==k.disabled||e[3]!==r?(R=async()=>{const E={disabled:!k.disabled};await Ir({configs:{[C]:E}}),r({cellId:C,config:E})},e[1]=C,e[2]=k.disabled,e[3]=r,e[4]=R):R=e[4];const z=R;let D;e[5]!==C||e[6]!==k.hide_code||e[7]!==j||e[8]!==r?(D=async()=>{const E={hide_code:!k.hide_code};await Ir({configs:{[C]:E}}),r({cellId:C,config:E});const W=j();W&&(E.hide_code?W.contentDOM.blur():W.focus())},e[5]=C,e[6]=k.hide_code,e[7]=j,e[8]=r,e[9]=D):D=e[9];const F=D;let B,U,O,S,$;return e[10]===Symbol.for("react.memo_cache_sentinel")?(B=d.jsx(Bm,{size:13,strokeWidth:1.5}),e[10]=B):B=e[10],e[11]!==C||e[12]!==N||e[13]!==g||e[14]!==s?(U=()=>{g(d.jsxs(nr,{children:[d.jsx(vs,{children:d.jsx(er,{children:"Rename cell"})}),d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx(Ar,{htmlFor:"cell-name",children:"Cell name"}),d.jsx(TS,{placeholder:"cell name",value:N,onKeyDown:E=>{E.key==="Enter"&&(E.preventDefault(),E.stopPropagation(),g(null))},onChange:E=>s({cellId:C,name:E})})]})]}))},e[11]=C,e[12]=N,e[13]=g,e[14]=s,e[15]=U):U=e[15],e[16]!==C||e[17]!==s?(O=E=>s({cellId:C,name:E}),e[16]=C,e[17]=s,e[18]=O):O=e[18],e[19]!==N||e[20]!==O?(S=d.jsx(TS,{placeholder:"cell name",value:N,onChange:O}),e[19]=N,e[20]=O,e[21]=S):S=e[21],e[22]!==c||e[23]!==b||e[24]!==v||e[25]!==y||e[26]!==p||e[27]!==C||e[28]!==u||e[29]!==k.disabled||e[30]!==k.hide_code||e[31]!==o||e[32]!==_||e[33]!==j||e[34]!==A||e[35]!==I||e[36]!==i||e[37]!==N||e[38]!==f||e[39]!==l||e[40]!==a||e[41]!==m||e[42]!==h||e[43]!==T||e[44]!==U||e[45]!==S||e[46]!==z||e[47]!==F?($=[[{icon:B,label:"Name",disableClick:!0,handle:rC,handleHeadless:U,rightElement:S},{icon:d.jsx(Hs,{size:13,strokeWidth:1.5}),label:"Run cell",hotkey:"cell.run",hidden:T==="running"||T==="queued"||T==="disabled-transitively"||k.disabled,handle:()=>f()},{icon:d.jsx(Hi,{size:13,strokeWidth:1.5}),label:"AI completion",hidden:!b,handle:()=>{m(E=>(E==null?void 0:E.cellId)===C?null:{cellId:C})},hotkey:"cell.aiCompletion"},{icon:d.jsx(Qc,{size:13,strokeWidth:1.5}),label:"Split cell",hotkey:"cell.splitCell",handle:()=>h({cellId:C})},{icon:d.jsx(Yp,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!I,handle:()=>function(E){const W=document.getElementById(T3.create(E));W&&(W.classList.add("printing-output"),M3(W,"result.png").finally(()=>{W.classList.remove("printing-output")}))}(C)},{icon:d.jsx(Tz,{size:13,strokeWidth:1.5}),label:"Format cell",hotkey:"cell.format",handle:()=>{const E=j();E&&Az({[C]:E})}},{icon:k.hide_code?d.jsx(P3,{size:13,strokeWidth:1.5}):d.jsx(L3,{size:13,strokeWidth:1.5}),label:k.hide_code?"Show code":"Hide code",handle:F,hotkey:"cell.hideCode"},{icon:k.disabled?d.jsx(hr,{size:13,strokeWidth:1.5}):d.jsx(fr,{size:13,strokeWidth:1.5}),label:"Reactive execution",rightElement:d.jsx(Mz,{"data-testid":"cell-disable-switch",checked:!k.disabled,size:"sm",onCheckedChange:z}),handle:z},{icon:d.jsx(Yl,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(I||A),handle:()=>{u({cellId:C})}}],[{icon:d.jsx(Zl,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:()=>{const E=j();E&&(ao(y,o),Er(E,"markdown",{keepCodeAsIs:!1}))}},{icon:d.jsx(or,{size:13,strokeWidth:1.5}),label:"Convert to SQL",handle:()=>{const E=j();E&&(ao(y,o),Er(E,"sql",{keepCodeAsIs:!1}))}},{icon:d.jsx(Ql,{}),label:"Toggle as Python",handle:()=>{const E=j();E&&(ao(y,o),Oz(E,"python",{force:!0}))}}],[{icon:d.jsxs(qs,{children:[d.jsx(fa,{size:13,strokeWidth:1.5}),d.jsx(F3,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>o({cellId:C,before:!0})},{icon:d.jsxs(qs,{children:[d.jsx(fa,{size:13,strokeWidth:1.5}),d.jsx(Ns,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>o({cellId:C,before:!1})},{icon:d.jsx(F3,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>i({cellId:C,before:!0})},{icon:d.jsx(Ns,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>i({cellId:C,before:!1})},{icon:d.jsx(z3,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>i({cellId:C,direction:"left"}),hidden:v!=="columns"},{icon:d.jsx(Wi,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>i({cellId:C,direction:"right"}),hidden:v!=="columns"},{icon:d.jsx(tm,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>a({cellId:C})},{icon:d.jsx(em,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>l({cellId:C})},{icon:d.jsx(Dz,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",hidden:v!=="columns",handle:()=>c({cellId:C})}],[{icon:d.jsx(CS,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!Gm(N),tooltip:Gm(N)?void 0:"Only named cells can be linked to",handle:async()=>{await pn(function(E){const W=new URL(window.location.href);return W.hash=`scrollTo=${encodeURIComponent(E)}`,W.toString()}(N)),ut({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!p,variant:"danger",icon:d.jsx(op,{size:13,strokeWidth:1.5}),handle:()=>{_({cellId:C})}}]].map(nC).filter(tC),e[22]=c,e[23]=b,e[24]=v,e[25]=y,e[26]=p,e[27]=C,e[28]=u,e[29]=k.disabled,e[30]=k.hide_code,e[31]=o,e[32]=_,e[33]=j,e[34]=A,e[35]=I,e[36]=i,e[37]=N,e[38]=f,e[39]=l,e[40]=a,e[41]=m,e[42]=h,e[43]=T,e[44]=U,e[45]=S,e[46]=z,e[47]=F,e[48]=$):$=e[48],$}function tC(t){return t.length>0}function nC(t){return t.filter(oC)}function oC(t){return!t.hidden}function rC(t){t==null||t.stopPropagation(),t==null||t.preventDefault()}function sC(t){return!t.hidden}const dd=Ht(!1),Jm=()=>{const t=X.c(37),[e,n]=tn(dd),o=Pz(),r=Be(Lz),s=Be(rp);let i;t[0]!==r?(i={cell:r},t[0]=r,t[1]=i):i=t[1];let a=cd(i).flat();a=wa(a);const l=function(){const O=X.c(61),[S,$]=Tr(),[E,W]=B3();let G;O[0]!==$?(G=async te=>{await Mr({config:te}).then(()=>{$(te)})},O[0]=$,O[1]=G):G=O[1];const q=G;let Y;O[2]!==W?(Y=async te=>{await Rz({config:te}).then(()=>{W(te)})},O[2]=W,O[3]=Y):Y=O[3];const Q=Y;let re;if(O[4]!==E||O[5]!==S||O[6]!==Q||O[7]!==q){let te,ue,me,de,fe;O[9]!==E?(te=De=>De!==E.width,O[9]=E,O[10]=te):te=O[10],O[11]!==E||O[12]!==Q?(ue=De=>({label:`App config > Set width=${De}`,handle:()=>{Q({...E,width:De})}}),O[11]=E,O[12]=Q,O[13]=ue):ue=O[13],O[14]!==S||O[15]!==q?(me={label:"Config > Set theme: dark",handle:()=>{q({...S,display:{...S.display,theme:"dark"}})}},O[14]=S,O[15]=q,O[16]=me):me=O[16],O[17]!==S||O[18]!==q?(de={label:"Config > Set theme: light",handle:()=>{q({...S,display:{...S.display,theme:"light"}})}},O[17]=S,O[18]=q,O[19]=de):de=O[19],O[20]!==S||O[21]!==q?(fe={label:"Config > Set theme: system",handle:()=>{q({...S,display:{...S.display,theme:"system"}})}},O[20]=S,O[21]=q,O[22]=fe):fe=O[22];const he=S.keymap.preset==="vim";let Ce,Ee;O[23]!==S||O[24]!==q?(Ce=()=>{q({...S,keymap:{...S.keymap,preset:"vim"}})},O[23]=S,O[24]=q,O[25]=Ce):Ce=O[25],O[26]!==he||O[27]!==Ce?(Ee={label:"Config > Switch keymap to VIM",hidden:he,handle:Ce},O[26]=he,O[27]=Ce,O[28]=Ee):Ee=O[28];const ie=S.keymap.preset==="default";let Me,xe,Re;O[29]!==S||O[30]!==q?(Me=()=>{q({...S,keymap:{...S.keymap,preset:"default"}})},O[29]=S,O[30]=q,O[31]=Me):Me=O[31],O[32]!==ie||O[33]!==Me?(xe={label:"Config > Switch keymap to default (current: VIM)",hidden:ie,handle:Me},O[32]=ie,O[33]=Me,O[34]=xe):xe=O[34],O[35]!==S||O[36]!==q?(Re=()=>{q({...S,completion:{...S.completion,copilot:!1}})},O[35]=S,O[36]=q,O[37]=Re):Re=O[37];const Ue=S.completion.copilot!=="github";let Je,Ke;O[38]!==Re||O[39]!==Ue?(Je={label:"Config > Disable GitHub Copilot",handle:Re,hidden:Ue},O[38]=Re,O[39]=Ue,O[40]=Je):Je=O[40],O[41]!==S||O[42]!==q?(Ke=()=>{q({...S,completion:{...S.completion,copilot:"github"}})},O[41]=S,O[42]=q,O[43]=Ke):Ke=O[43];const Pe=S.completion.copilot==="github";let st;O[44]!==Ke||O[45]!==Pe?(st={label:"Config > Enable GitHub Copilot",handle:Ke,hidden:Pe},O[44]=Ke,O[45]=Pe,O[46]=st):st=O[46];const et=!S.display.reference_highlighting;let nt,ne,ve,Se;O[47]!==S||O[48]!==q?(nt=()=>{q({...S,display:{...S.display,reference_highlighting:!1}})},O[47]=S,O[48]=q,O[49]=nt):nt=O[49],O[50]!==et||O[51]!==nt?(ne={label:"Config > Disable reference highlighting",hidden:et,handle:nt},O[50]=et,O[51]=nt,O[52]=ne):ne=O[52],O[53]!==S||O[54]!==q?(ve=()=>{q({...S,display:{...S.display,reference_highlighting:!0}})},O[53]=S,O[54]=q,O[55]=ve):ve=O[55],O[56]!==S.display.reference_highlighting||O[57]!==ve?(Se={label:"Config > Enable reference highlighting",hidden:S.display.reference_highlighting,handle:ve},O[56]=S.display.reference_highlighting,O[57]=ve,O[58]=Se):Se=O[58],re=[...sH().filter(te).map(ue),me,de,fe,Ee,xe,Je,st,ne,Se],O[4]=E,O[5]=S,O[6]=Q,O[7]=q,O[8]=re}else re=O[8];const ae=re;let Z;return O[59]!==ae?(Z=ae.filter(sC),O[59]=ae,O[60]=Z):Z=O[60],Z}();let c=Cg();c=[...wa(c),...wa(l)];const u=c.filter(iC),h=ec.keyBy(u,aC),{recentCommands:f,addRecentCommand:p}=ZS();let _;t[2]!==f?(_=new Set(f),t[2]=f,t[3]=_):_=t[3];const g=_;let m,b;t[4]!==s||t[5]!==n?(m=O=>{Bz(s.getHotkey("global.commandPalette").key)(O)&&(O.preventDefault(),n(lC))},t[4]=s,t[5]=n,t[6]=m):m=t[6],tp(document,"keydown",m),t[7]!==p||t[8]!==s||t[9]!==o||t[10]!==n?(b=(O,S)=>{const $=o[O];if(!$)return null;const E=s.getHotkey(O);return d.jsxs(lo,{disabled:S.disabled,onSelect:()=>{p(O),n(!1),requestAnimationFrame(()=>{$()})},value:E.name,children:[d.jsxs("span",{children:[E.name,S.tooltip&&d.jsx("span",{className:"ml-2",children:S.tooltip})]}),d.jsx(V3,{children:d.jsx(ap,{shortcut:E.key})})]},O)},t[7]=p,t[8]=s,t[9]=o,t[10]=n,t[11]=b):b=t[11];const y=b;let x;t[12]!==p||t[13]!==s||t[14]!==n?(x=(O,S,$,E)=>{const W=$===void 0?{}:$;return d.jsxs(lo,{disabled:W.disabled,onSelect:()=>{p(O),n(!1),requestAnimationFrame(()=>{S()})},value:O,children:[d.jsxs("span",{children:[O,W.tooltip&&d.jsxs("span",{className:"ml-2",children:["(",W.tooltip,")"]})]}),E&&d.jsx(V3,{children:d.jsx(ap,{shortcut:s.getHotkey(E).key})})]},O)},t[12]=p,t[13]=s,t[14]=n,t[15]=x):x=t[15];const v=x,C=zz;let k;t[16]===Symbol.for("react.memo_cache_sentinel")?(k=d.jsx(qi,{placeholder:"Type to search..."}),t[16]=k):k=t[16];const j=ip;let N;t[17]===Symbol.for("react.memo_cache_sentinel")?(N=d.jsx(tc,{children:"No results found."}),t[17]=N):N=t[17];const I=f.length>0&&d.jsxs(d.Fragment,{children:[d.jsx(sp,{heading:"Recently Used",children:f.map(O=>{const S=h[O];return Fz(O)?y(O,{disabled:S==null?void 0:S.disabled,tooltip:S==null?void 0:S.tooltip}):S&&!qm(S)?v(S.label,S.handleHeadless||S.handle,{disabled:S.disabled,tooltip:S.tooltip}):null})}),d.jsx(U3,{})]}),A=sp,T=s.iterate().map(O=>{if(g.has(O))return null;const S=h[O];return y(O,{disabled:S==null?void 0:S.disabled,tooltip:S==null?void 0:S.tooltip})}),R=u.map(O=>g.has(O.label)?null:v(O.label,O.handleHeadless||O.handle,{disabled:O.disabled,tooltip:O.tooltip}));let z;t[18]!==g||t[19]!==v?(z=O=>g.has(O.label)?null:v(`Cell > ${O.label}`,O.handleHeadless||O.handle,{disabled:O.disabled,tooltip:O.tooltip}),t[18]=g,t[19]=v,t[20]=z):z=t[20];const D=a.map(z);let F,B,U;return t[21]!==A||t[22]!==R||t[23]!==D||t[24]!==T?(F=d.jsxs(A,{heading:"Commands",children:[T,R,D]}),t[21]=A,t[22]=R,t[23]=D,t[24]=T,t[25]=F):F=t[25],t[26]!==j||t[27]!==F||t[28]!==N||t[29]!==I?(B=d.jsxs(j,{children:[N,I,F]}),t[26]=j,t[27]=F,t[28]=N,t[29]=I,t[30]=B):B=t[30],t[31]!==C||t[32]!==e||t[33]!==n||t[34]!==B||t[35]!==k?(U=d.jsxs(C,{open:e,onOpenChange:n,children:[k,B]}),t[31]=C,t[32]=e,t[33]=n,t[34]=B,t[35]=k,t[36]=U):U=t[36],U};function iC(t){return!t.hotkey}function aC(t){return t.label}function lC(t){return!t}function pr(){return ke.string().optional().describe(We.of({label:"Password",inputType:"password",placeholder:"password",optionRegex:".*password.*"}))}function Km(){return ke.string().optional().describe(We.of({label:"Token",inputType:"password",placeholder:"token",optionRegex:".*token.*"}))}function ka(){return ke.string().optional().describe(We.of({label:"Warehouse Name",placeholder:"warehouse",optionRegex:".*warehouse.*"}))}function Xm(){return ke.string().optional().describe(We.of({label:"URI",optionRegex:".*uri.*"}))}function mr(){return ke.string().nonempty().describe(We.of({label:"Host",placeholder:"localhost",optionRegex:".*host.*"}))}function ho(){return ke.string().describe(We.of({label:"Database",placeholder:"db name",optionRegex:".*database.*"}))}function gr(){return ke.string().nonempty().describe(We.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function _r(t){const e=ke.coerce.string().describe(We.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 Zm(){return ke.boolean().default(!1).describe(We.of({label:"Read Only"}))}const Qm=ke.object({type:ke.literal("postgres"),host:mr(),port:_r(5432).optional(),database:ho(),username:gr(),password:pr(),ssl:ke.boolean().default(!1).describe(We.of({label:"Use SSL"}))}).describe(We.of({direction:"two-columns"})),eg=ke.object({type:ke.literal("mysql"),host:mr(),port:_r(3306),database:ho(),username:gr(),password:pr(),ssl:ke.boolean().default(!1).describe(We.of({label:"Use SSL"}))}).describe(We.of({direction:"two-columns"})),tg=ke.object({type:ke.literal("sqlite"),database:ho().describe(We.of({label:"Database Path"}))}).describe(We.of({direction:"two-columns"})),ng=ke.object({type:ke.literal("duckdb"),database:ho().describe(We.of({label:"Database Path"})),read_only:Zm()}).describe(We.of({direction:"two-columns"})),og=ke.object({type:ke.literal("motherduck"),database:ho().default("my_db").describe(We.of({label:"Database Name"})),token:Km()}).describe(We.of({direction:"two-columns"})),rg=ke.object({type:ke.literal("snowflake"),account:ke.string().nonempty().describe(We.of({label:"Account",optionRegex:".*snowflake.*"})),warehouse:ke.string().optional().describe(We.of({label:"Warehouse",optionRegex:".*snowflake.*"})),database:ho(),schema:ke.string().optional().describe(We.of({label:"Schema",optionRegex:".*snowflake.*"})),username:gr(),password:pr(),role:ke.string().optional().describe(We.of({label:"Role"}))}).describe(We.of({direction:"two-columns"})),sg=ke.object({type:ke.literal("bigquery"),project:ke.string().nonempty().describe(We.of({label:"Project ID",optionRegex:".*bigquery.*"})),dataset:ke.string().nonempty().describe(We.of({label:"Dataset",optionRegex:".*bigquery.*"})),credentials_json:ke.string().describe(We.of({label:"Credentials JSON",inputType:"textarea"}))}).describe(We.of({direction:"two-columns"})),ig=ke.object({type:ke.literal("clickhouse_connect"),host:mr(),port:_r(8123).optional(),username:gr(),password:pr(),secure:ke.boolean().default(!1).describe(We.of({label:"Use HTTPs"}))}).describe(We.of({direction:"two-columns"})),ag=ke.object({type:ke.literal("timeplus"),host:mr().default("localhost"),port:_r(8123).optional(),username:gr().default("default"),password:pr().default("")}).describe(We.of({direction:"two-columns"})),lg=ke.object({type:ke.literal("chdb"),database:ho().describe(We.of({label:"Database Path"})),read_only:Zm()}).describe(We.of({direction:"two-columns"})),cg=ke.object({type:ke.literal("trino"),host:mr(),port:_r(8080),database:ho(),schema:ke.string().describe(We.of({label:"Schema",placeholder:"schema name",optionRegex:".*schema.*"})).optional(),username:gr(),password:pr(),async_support:ke.boolean().default(!1).describe(We.of({label:"Async Support"}))}).describe(We.of({direction:"two-columns"})),dg=ke.object({type:ke.literal("iceberg"),name:ke.string().describe(We.of({label:"Catalog Name"})),catalog:ke.discriminatedUnion("type",[ke.object({type:ke.literal("REST"),warehouse:ka(),uri:ke.string().optional().describe(We.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:Km()}),ke.object({type:ke.literal("SQL"),warehouse:ka(),uri:ke.string().optional().describe(We.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),ke.object({type:ke.literal("Hive"),warehouse:ka(),uri:Xm()}),ke.object({type:ke.literal("Glue"),warehouse:ka(),uri:Xm()}),ke.object({type:ke.literal("DynamoDB"),"dynamodb.profile-name":ke.string().optional().describe(We.of({label:"Profile Name"})),"dynamodb.region":ke.string().optional().describe(We.of({label:"Region"})),"dynamodb.access-key-id":ke.string().optional().describe(We.of({label:"Access Key ID"})),"dynamodb.secret-access-key":ke.string().optional().describe(We.of({label:"Secret Access Key",inputType:"password"})),"dynamodb.session-token":ke.string().optional().describe(We.of({label:"Session Token",inputType:"password"}))})]).default({type:"REST"}).describe(We.of({special:"tabs"}))}),ug=ke.object({type:ke.literal("datafusion"),sessionContext:ke.boolean().optional().describe(We.of({label:"Use Session Context"}))}),hg=ke.object({type:ke.literal("pyspark"),host:mr().optional(),port:_r().optional()}),fg=ke.object({type:ke.literal("redshift"),host:mr(),port:_r(5439),connectionType:ke.discriminatedUnion("type",[ke.object({type:ke.literal("IAM credentials"),region:ke.string().describe(We.of({label:"Region"})),aws_access_key_id:ke.string().nonempty().describe(We.of({label:"AWS Access Key ID",inputType:"password",optionRegex:".*aws_access_key_id.*"})),aws_secret_access_key:ke.string().nonempty().describe(We.of({label:"AWS Secret Access Key",inputType:"password",optionRegex:".*aws_secret_access_key.*"})),aws_session_token:ke.string().optional().describe(We.of({label:"AWS Session Token",inputType:"password",optionRegex:".*aws_session_token.*"}))}),ke.object({type:ke.literal("DB credentials"),user:gr(),password:pr()})]).default({type:"IAM credentials",aws_access_key_id:"",aws_secret_access_key:"",region:""}),database:ho()}).describe(We.of({direction:"two-columns"})),cC=ke.discriminatedUnion("type",[Qm,eg,tg,ng,og,rg,sg,ig,ag,lg,cg,dg,ug,hg,fg]),ud="env:";function Sa(t){return typeof t=="string"&&t.startsWith(ud)}function hd(t){return`${ud}${t}`}const pg={sqlmodel:"SQLModel",sqlalchemy:"SQLAlchemy",duckdb:"DuckDB",clickhouse_connect:"ClickHouse Connect",chdb:"chDB",pyiceberg:"PyIceberg",ibis:"Ibis",motherduck:"MotherDuck",redshift:"Redshift"};class on{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 dC{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),Sa(n)){const r=n.replace(ud,""),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"?Fr(n):n?`"${n}"`:""}printInFString(e,n,o){if(n===void 0)return"";if(typeof n=="number")return`${n}`;if(typeof n=="boolean")return Fr(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 Sa(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-DJ3yaJpl.js","./index-CJaEBn8N.js","./index-8IZtaDUn.css","./compile-C3U-vg-j.js","./time-CRNs3SAd.js","./timer-Bqd5yn_a.js","./linear-D6T4b48H.js","./init-DLRA0X12.js","./range-CtcPcB_L.js","./zoom-COrs4lFh.js","./ordinal-DDUp3AbE.js","./colors-bszWmPJw.js","./step-BwsUM5iJ.js","./arc-CfyY4LWz.js","./storage-h-OfQolp.js","./index-4adJyO1X.js","./index-CoGECqH1.js","./index-DBaMrMdr.js","./index-C-WOu_u0.js","./index-BtQD1xRv.js","./index-Dfhr_H2_.js","./index-DPNo-jY5.js","./index-DVJeqlnb.js","./index-8quJWwGd.js","./index-kFBaVNpO.js","./index-CaI_HNZm.js","./index-O2ELw6Hz.js","./index-RyqulB0I.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","./storage-De8XnUVS.css","./shutdown-button-CiYHSs8n.js","./index-DisN4g0K.js","./shutdown-button-C1rhMrxo.css","./circle-play-Bj5lce2y.js","./_createAggregator-8M5K7ZTQ.js","./_baseEach-lpPh9W5d.js","./transform-DetRMEbJ.js","./sortBy-HenacHs2.js","./_baseMap-SEd-6IK0.js","./terminal-BgXO_ixx.js","./terminal-WqMRJt5Z.css"])))=>i.map(i=>d[i]);
2
+ var cz=Object.defineProperty;var v3=Rt=>{throw TypeError(Rt)};var dz=(Rt,Ct,dn)=>Ct in Rt?cz(Rt,Ct,{enumerable:!0,configurable:!0,writable:!0,value:dn}):Rt[Ct]=dn;var ee=(Rt,Ct,dn)=>dz(Rt,typeof Ct!="symbol"?Ct+"":Ct,dn),uz=(Rt,Ct,dn)=>Ct.has(Rt)||v3("Cannot "+dn);var k3=(Rt,Ct,dn)=>(uz(Rt,Ct,"read from private field"),dn?dn.call(Rt):Ct.get(Rt)),S3=(Rt,Ct,dn)=>Ct.has(Rt)?v3("Cannot add the same private member more than once"):Ct instanceof WeakSet?Ct.add(Rt):Ct.set(Rt,dn);import{u as Oe,Q as M,ib as hz,ic as fz,id as C3,ie as pz,ig as mz,ih as gz,a as K,ii as _z,ij as jr,ik as bz,il as Xf,im as N3,io as yz,ip as xz,iq as j3,ir as Wl,c as X,eA as wz,ar as ut,j as d,ah as Yn,ao as er,an as vs,ap as ks,bs as tr,W as Te,aq as pn,is as Vi,am as nr,aS as Pn,as as $i,a4 as Ae,a0 as Kt,dX as Zf,eK as Ss,it as vz,aN as Xe,a9 as It,iu as kz,eQ as Ln,iv as E3,iw as I3,ix as Qf,iy as A3,iz as Sz,L as kt,dE as ql,aZ as or,iA as Gl,a$ as ep,av as xn,iB as Cz,a7 as Yl,iC as Nz,iD as T3,eP as M3,_ as Ht,b6 as O3,iE as D3,cG as tp,iF as jz,dO as ct,iG as R3,dV as np,iH as Ez,iI as Jl,Z as Be,bd as Fn,iJ as Kl,iK as Xl,eF as Cs,iL as Iz,iM as Hi,iN as Az,eN as Tz,iO as P3,iP as L3,eo as Mz,iQ as ao,iR as Er,aX as Zl,iS as Oz,iT as Ql,iU as F3,a5 as Ns,ec as z3,a6 as Wi,iV as Dz,iW as op,iX as Ir,bu as Ar,eG as Tr,fm as B3,g6 as Mr,fB as Rz,bg as tn,iY as Pz,iZ as Lz,g4 as rp,aP as ec,i_ as sp,i$ as Fz,j0 as U3,j1 as ip,j2 as zz,j3 as Bz,j4 as lo,j5 as V3,ga as ap,j6 as qi,j7 as tc,et as ke,j8 as We,j9 as lp,ja as xt,jb as $3,dy as nc,du as oc,dv as rc,dw as sc,dt as Gi,jc as Uz,fz as cp,b5 as wn,aJ as zn,fp as H3,fr as W3,fs as Vz,fx as $z,ft as q3,V as je,en as Hz,aV as js,b3 as Es,aW as Is,b0 as Wt,eO as co,jd as Wz,fv as G3,je as qz,fn as Y3,fo as J3,jf as As,dx as K3,jg as X3,jh as Gz,ji as Yz,al as Jz,ak as Kz,jj as dp,dB as Xz,dD as up,fb as ic,jk as ac,jl as lc,bx as vn,jm as Zz,eJ as Yi,f8 as cn,bl as Z3,dY as Ft,jn as Qz,ei as eB,ai as hp,jo as Ji,jp as cc,jq as tB,jr as nB,js as Q3,jt as nn,aY as oB,au as fp,g9 as e4,ep as dc,ju as rB,gv as pp,bk as uc,jv as mp,aj as sB,jw as iB,at as Ki,eB as t4,bo as aB,jx as lB,jy as n4,jz as cB,jA as dB,jB as uB,jC as hB,jD as fB,dz as Do,jE as pB,jF as hc,jG as Ts,o as Ro,n as tt,fQ as kn,jH as Sn,jI as dt,jJ as Ms,jK as At,g5 as qt,jL as gp,es as Jn,jM as mB,jN as gB,bi as o4,bj as r4,jO as s4,jP as _B,gx as Os,jQ as fc,bf as pc,gy as Or,eR as _p,jR as bB,jS as yB,jT as xB,jU as wB,jV as i4,jW as Xi,jX as a4,jY as vB,jZ as l4,j_ as c4,j$ as kB,k0 as d4,k1 as u4,eS as mc,k2 as SB,k3 as h4,k4 as Zi,k5 as Qi,k6 as gc,k7 as rr,k8 as f4,k9 as Po,ka as Ds,kb as bp,kc as ea,kd as Rs,ke as yp,kf as xp,kg as p4,kh as _c,ki as CB,S as ta,kj as na,kk as NB,dU as bc,kl as jB,km as wp,kn as EB,ko as IB,kp as yc,e1 as AB,kq as vp,kr as Ps,ks as xc,kt as Ls,fP as Bn,f_ as Lo,fM as m4,cq as g4,ku as kp,fy as _4,kv as Sp,kw as b4,kx as oa,ky as y4,kz as wc,kA as Cp,kB as ra,kC as sa,kD as ia,kE as TB,fI as vc,kF as kc,kG as Sc,eh as MB,fJ as OB,kH as DB,kI as RB,kJ as PB,kK as LB,r as FB,kL as zB,kM as BB,kN as UB,fT as VB,kO as sr,kP as $B,kQ as x4,t as P,kR as HB,kS as WB,kT as qB,kU as GB,kV as YB,kW as JB,kX as KB,kY as XB,kZ as ZB,k_ as QB,k$ as eU,l0 as tU,l1 as nU,l2 as oU,l3 as rU,l4 as sU,l5 as iU,l6 as aU,l7 as lU,l8 as cU,l9 as dU,la as uU,lb as hU,lc as fU,ld as pU,le as mU,lf as gU,lg as _U,lh as bU,li as Np,lj as Cc,lk as w4,ll as yU,lm as xU,ln as v4,lo as wU,lp as Fs,lq as Un,lr as vU,ls as kU,lt as SU,lu as CU,lv as NU,lw as jU,lx as EU,ly as IU,lz as AU,lA as TU,lB as ir,lC as MU,lD as OU,lE as DU,lF as RU,d_ as PU,lG as LU,lH as k4,e2 as FU,lI as Nc,lJ as zU,lK as BU,lL as UU,lM as VU,X as ar,lN as jc,lO as $U,lP as HU,lQ as S4,lR as jp,gw as zs,lS as WU,lT as qU,lU as GU,lV as YU,fY as JU,br as KU,$ as Ep,lW as C4,lX as XU,lY as ZU,lZ as Ip,l_ as Ap,l$ as QU,m0 as N4,m1 as j4,m2 as Ec,fL as eV,ac as E4,dM as tV,m3 as I4,fk as St,m4 as aa,m5 as Bs,m6 as nV,m7 as oV,m8 as Tp,m9 as rV,cp as Mp,ma as sV,U as lr,bh as A4,mb as iV,mc as aV,md as Ic,me as T4,dK as Ac,bt as M4,mf as lV,mg as cV,mh as O4,mi as dV,mj as uV,mk as D4,ad as Op,ml as hV,bv as R4,mm as fV,eI as pV,mn as Fo,el as P4,mo as L4,eM as F4,fC as Tc,mp as Dp,mq as z4,aU as Rp,em as Mc,mr as B4,ms as mV,mt as gV,mu as _V,mv as U4,mw as bV,mx as V4,my as yV,gn as xV,fq as wV,fu as Pp,gq as vV,bq as Oc,mz as kV,mA as $4,mB as Lp,mC as SV,mD as CV,mE as NV,mF as jV,mG as H4,fd as Fp,dG as W4,mH as EV,mI as IV,mJ as AV,aO as TV,mK as MV,mL as OV,mM as DV,mN as RV,aa as PV,mO as Dc,ab as LV,mP as q4,f9 as FV,mQ as G4,ae as Vn,fG as zV,mR as BV,mS as UV,mT as Y4,mU as VV,mV as Us,mW as $V,mX as Rc,mY as HV,mZ as WV,y as J4,m_ as qV,dm as GV,m$ as la,n0 as K4,n1 as X4,n2 as Z4,n3 as Q4,n4 as YV,C as eS,n5 as JV,n6 as KV,n7 as XV,E as Dr,eX as tS,be as ZV,bc as QV,n8 as e$,n9 as t$,a2 as Pc,na as n$,a3 as cr,dJ as nS,nb as zp,nc as o$,dW as oS,nd as r$,ne as rS,nf as s$,ng as sS,nh as i$,ni as a$,nj as iS,nk as aS,nl as lS,f7 as cS,nm as l$,nn as c$,no as dS,np as uS,nq as Lc,nr as hS,ns as fS,nt as d$,nu as pS,nv as u$,nw as h$,nx as mS,ny as f$,nz as p$,nA as m$,nB as g$,nC as _$,nD as b$,dT as y$,nE as x$,nF as w$,fZ as Bp,nG as v$,nH as k$,nI as S$,nJ as C$,nK as N$,nL as j$,nM as E$,nN as I$,nO as A$,nP as T$,nQ as Up,nR as M$,fO as O$,nS as D$,nT as R$,nU as P$,nV as gS,nW as L$,a8 as F$,nX as z$,a1 as B$,eD as U$,gf as V$,nY as $$,nZ as H$,gh as Vp,gd as Vs,gi as Rr,ge as Pr,gj as $p,gk as Hp,n_ as _S,gg as W$,n$ as bS,o0 as q$,o1 as yS,o2 as dr,o3 as xS,gp as G$,o4 as Y$,o5 as J$,o6 as K$,o7 as X$,o8 as Z$,o9 as Q$,oa as wS,eu as eH,ob as Wp,aw as Fc,oc as vS,od as kS,ay as SS,ax as tH,dS as nH,__tla as oH}from"./index-CJaEBn8N.js";import{b as $s,A as rH,L as CS,g as sH,G as iH,s as aH,k as lH,B as NS,a as cH,M as dH,Y as uH,c as mn,u as ca,C as hH,S as fH,K as pH,d as mH,i as gH,e as jS,f as _H,h as bH,j as da,P as qp,l as ES,m as yH,n as xH,o as wH,p as vH,q as IS,r as Gp,T as kH}from"./shutdown-button-CiYHSs8n.js";import{V as AS,d as Hs,I as Yp,N as TS,S as MS,e as OS,f as DS,L as RS,g as PS,F as LS,M as SH,l as FS,h as CH,j as uo,k as zc,m as Bc,i as NH,E as zS,n as jH,o as Jp,p as EH,q as IH,s as AH,t as TH,v as MH,w as OH,x as DH,y as RH,a as PH,C as LH,R as BS,A as FH,b as zH,T as BH,z as UH,B as VH,D as $H,G as HH,O as WH,c as qH,P as GH,__tla as YH}from"./storage-h-OfQolp.js";import{c as JH}from"./_createAggregator-8M5K7ZTQ.js";import{s as Kn,i as ur,T as Kp,a as Xp}from"./transform-DetRMEbJ.js";import{g as US}from"./timer-Bqd5yn_a.js";import{i as KH}from"./zoom-COrs4lFh.js";import{s as ua}from"./sortBy-HenacHs2.js";let Zp,Uc,gn,Vc,VS,ha,XH=Promise.all([(()=>{try{return oH}catch{}})(),(()=>{try{return YH}catch{}})()]).then(async()=>{var Hl,y3;var Rt=JH(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});let Ct,dn,Qp,$c,Ws,Lr,em,tm,nm,om,fa,Hc,rm,pa,sm,Wc,im,am,qc,lm,cm,dm,ma,um,Gc,hm,fm,pm,mm,gm,_m,Yc,bm,Jc,Kc,ym,xm,wm,vm,km,ga,Sm,Cm,Xc,Nm,jm,Em,Zc,Im,Am,Tm,_a,Qc,ed,Mm,Om,Dm,Rm,Pm,Lm,Fm,zm,Bm,td,nd,Um,Vm,$m,ba,hr,fr;Ct=Oe("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),dn=Oe("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"}]]),Qp=Oe("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"}]]),$c=Oe("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),Ws=Oe("ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]),Lr=Oe("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"}]]),em=Oe("chevrons-down",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),tm=Oe("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),Vc=Oe("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),nm=Oe("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),om=Oe("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),fa=Oe("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),Hc=Oe("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"}]]),rm=Oe("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"}]]),pa=Oe("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"}]]),sm=Oe("code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]),Wc=Oe("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"}]]),im=Oe("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"}]]),am=Oe("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"}]]),qc=Oe("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"}]]),lm=Oe("eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]),cm=Oe("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"}]]),dm=Oe("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"}]]),ma=Oe("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"}]]),um=Oe("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"}]]),Gc=Oe("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"}]]),hm=Oe("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"}]]),fm=Oe("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"}]]),pm=Oe("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"}]]),mm=Oe("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"}]]),gm=Oe("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"}]]),_m=Oe("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"}]]),Yc=Oe("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"}]]),bm=Oe("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"}]]),Jc=Oe("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"}]]),Kc=Oe("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"}]]),ym=Oe("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"}]]),xm=Oe("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"}]]),wm=Oe("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"}]]),vm=Oe("message-circle-question",[["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"}]]),km=Oe("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"}]]),ga=Oe("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"}]]),Sm=Oe("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"}]]),Cm=Oe("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"}]]),Xc=Oe("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"}]]),Nm=Oe("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),jm=Oe("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"}]]),Em=Oe("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"}]]),Zc=Oe("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"}]]),Im=Oe("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"}]]),Am=Oe("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"}]]),Tm=Oe("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"}]]),_a=Oe("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"}]]),Qc=Oe("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"}]]),ed=Oe("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"}]]),Mm=Oe("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"}]]),Om=Oe("square-code",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),Dm=Oe("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"}]]),Rm=Oe("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"}]]),Pm=Oe("square-m",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8l4 4 4-4v8",key:"141u4e"}]]),Lm=Oe("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"}]]),Fm=Oe("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"}]]),zm=Oe("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"}]]),Bm=Oe("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"}]]),td=Oe("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"}]]),nd=Oe("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"}]]),Um=Oe("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]),Vm=Oe("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"}]]),$m=Oe("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"}]]),ba=Oe("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"}]]),hr=Oe("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"}]]),fr=Oe("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 $S=M.createContext({}),HS=M.forwardRef(function(t,e){[t,e]=mz(t,e,$S);let{toolbarProps:n}=function(s,i){const{"aria-label":a,"aria-labelledby":l,orientation:c="horizontal"}=s;let[u,h]=M.useState(!1);hz(()=>{var m;h(!(!i.current||!(!((m=i.current.parentElement)===null||m===void 0)&&m.closest('[role="toolbar"]'))))});const{direction:f}=fz(),p=f==="rtl"&&c==="horizontal";let _=pz(i);const g=M.useRef(null);return{toolbarProps:{...C3(s,{labelable:!0}),role:u?"group":"toolbar","aria-orientation":c,"aria-label":a,"aria-labelledby":a==null?l:void 0,onKeyDownCapture:u?void 0:m=>{if(m.currentTarget.contains(m.target)){if(c==="horizontal"&&m.key==="ArrowRight"||c==="vertical"&&m.key==="ArrowDown")p?_.focusPrevious():_.focusNext();else{if(!(c==="horizontal"&&m.key==="ArrowLeft"||c==="vertical"&&m.key==="ArrowUp"))return m.key==="Tab"?(m.stopPropagation(),g.current=document.activeElement,void(m.shiftKey?_.focusFirst():_.focusLast())):void 0;p?_.focusNext():_.focusPrevious()}m.stopPropagation(),m.preventDefault()}},onFocusCapture:u?void 0:m=>{var b,y;g.current&&!m.currentTarget.contains(m.relatedTarget)&&(!((b=i.current)===null||b===void 0)&&b.contains(m.target))&&((y=g.current)===null||y===void 0||y.focus(),g.current=null)},onBlurCapture:u?void 0:m=>{m.currentTarget.contains(m.relatedTarget)||g.current||(g.current=m.target)}}}}(t,e),o=gz({...t,values:{orientation:t.orientation||"horizontal"},defaultClassName:"react-aria-Toolbar"}),r=C3(t);return delete r.id,K.createElement("div",{..._z(n,r),...o,ref:e,slot:t.slot||void 0,"data-orientation":t.orientation||"horizontal"},o.children)});function ya(t,e){const n=+jr(t)-+jr(e);return n<0?-1:n>0?1:n}function WS(t,e){const n=jr(t,e==null?void 0:e.in);return+function(o,r){const s=jr(o,r==null?void 0:r.in);return s.setHours(23,59,59,999),s}(n,e)==+function(o,r){const s=jr(o,r==null?void 0:r.in),i=s.getMonth();return s.setFullYear(s.getFullYear(),i+1,0),s.setHours(23,59,59,999),s}(n,e)}function qS(t,e,n){const[o,r,s]=Xf(n==null?void 0:n.in,t,t,e),i=ya(r,s),a=Math.abs(function(u,h,f){const[p,_]=Xf(f==null?void 0:f.in,u,h);return 12*(p.getFullYear()-_.getFullYear())+(p.getMonth()-_.getMonth())}(r,s));if(a<1)return 0;r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-i*a);let l=ya(r,s)===-i;WS(o)&&a===1&&ya(o,s)===1&&(l=!1);const c=i*(a-+l);return c===0?0:c}function GS(t,e,n){const o=function(r,s){return+jr(r)-+jr(s)}(t,e)/1e3;return(r=>{const s=(0,Math.trunc)(r);return s===0?0:s})(o)}function YS(t,e){return function(n,o,r){const s=yz(),i=(r==null?void 0:r.locale)??s.locale??xz,a=ya(n,o);if(isNaN(a))throw new RangeError("Invalid time value");const l=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:a}),[c,u]=Xf(r==null?void 0:r.in,...a>0?[o,n]:[n,o]),h=GS(u,c),f=(N3(u)-N3(c))/1e3,p=Math.round((h-f)/60);let _;if(p<2)return p===0?i.formatDistance("lessThanXMinutes",1,l):i.formatDistance("xMinutes",p,l);if(p<45)return i.formatDistance("xMinutes",p,l);if(p<90)return i.formatDistance("aboutXHours",1,l);if(p<j3){const g=Math.round(p/60);return i.formatDistance("aboutXHours",g,l)}if(p<2520)return i.formatDistance("xDays",1,l);if(p<Wl){const g=Math.round(p/j3);return i.formatDistance("xDays",g,l)}if(p<2*Wl)return _=Math.round(p/Wl),i.formatDistance("aboutXMonths",_,l);if(_=qS(u,c),_<12){const g=Math.round(p/Wl);return i.formatDistance("xMonths",g,l)}{const g=_%12,m=Math.trunc(_/12);return g<3?i.formatDistance("aboutXYears",m,l):g<9?i.formatDistance("overXYears",m,l):i.formatDistance("almostXYears",m+1,l)}}(t,function(n){return bz(n,Date.now())}(t),e)}const xa="https://static.marimo.app",JS=t=>{const e=X.c(24),{onClose:n}=t,[o,r]=M.useState("");let s;s=Math.random().toString(36).slice(2,6);const i=`${o}-${s}`,a=`${xa}/static/${i}`;let l,c,u,h,f,p,_,g,m,b,y;return e[0]!==n||e[1]!==i?(l=async x=>{x.preventDefault(),n();const v=await wz({download:!1,includeCode:!0,files:AS.INSTANCE.filenames()}),C=ut({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${xa}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:v,path:i})}).catch(()=>{C.dismiss(),ut({title:"Error uploading static page",description:d.jsxs("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",d.jsx("a",{href:Yn.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),C.dismiss(),ut({title:"Static page uploaded!",description:d.jsxs("div",{children:["The URL has been copied to your clipboard.",d.jsx("br",{}),"You can share it with anyone."]})})},e[0]=n,e[1]=i,e[2]=l):l=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(er,{children:"Share static notebook"}),e[3]=c):c=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(u=d.jsxs(vs,{children:[c,d.jsxs(ks,{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"," ",d.jsx("a",{href:xa,target:"_blank",children:xa}),"."]})]}),e[4]=u):u=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(h=x=>{const v=x.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,"");r(v)},e[5]=h):h=e[5],e[6]!==o?(f=d.jsx(tr,{"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]!==a?(p=d.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:",d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(KS,{text:a}),d.jsx("span",{className:"text-primary",children:a})]})]}),e[8]=a,e[9]=p):p=e[9],e[10]!==f||e[11]!==p?(_=d.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[f,p]}),e[10]=f,e[11]=p,e[12]=_):_=e[12],e[13]!==n?(g=d.jsx(Te,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),e[13]=n,e[14]=g):g=e[14],e[15]!==a?(m=d.jsx(Te,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await pn(a)},children:"Create"}),e[15]=a,e[16]=m):m=e[16],e[17]!==m||e[18]!==g?(b=d.jsxs(Vi,{children:[g,m]}),e[17]=m,e[18]=g,e[19]=b):b=e[19],e[20]!==b||e[21]!==l||e[22]!==_?(y=d.jsx(nr,{className:"w-fit",children:d.jsxs("form",{onSubmit:l,children:[u,_,b]})}),e[20]=b,e[21]=l,e[22]=_,e[23]=y):y=e[23],y},KS=t=>{const e=X.c(8),[n,o]=K.useState(!1);let r;e[0]!==t.text?(r=Pn.stopPropagation(async c=>{c.preventDefault(),await pn(t.text),o(!0),setTimeout(()=>o(!1),2e3)}),e[0]=t.text,e[1]=r):r=e[1];const s=r;let i,a,l;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsx($i,{size:14,strokeWidth:1.5}),e[2]=i):i=e[2],e[3]!==s?(a=d.jsx(Te,{"data-testid":"copy-static-notebook-url-button",onClick:s,size:"xs",variant:"secondary",children:i}),e[3]=s,e[4]=a):a=e[4],e[5]!==n||e[6]!==a?(l=d.jsx(Ae,{content:"Copied!",open:n,children:a}),e[5]=n,e[6]=a,e[7]=l):l=e[7],l};function Hm(){const t=X.c(2),e=Kt(Zf);let n;return t[0]!==e?(n=()=>{const o=document.getElementsByClassName("output-area"),r=window.innerHeight||document.documentElement.clientHeight;let s;s=null;for(const i of Array.from(o)){const a=i.getBoundingClientRect();if(a.top>=0&&a.top<=r||a.bottom>=0&&a.bottom<=r){s=Ss.parse(i.parentNode.id);break}}e(i=>({mode:vz(i.mode),cellAnchor:s})),requestAnimationFrame(()=>{var i;s!==null&&((i=document.getElementById(Ss.create(s)))==null||i.scrollIntoView())})},t[0]=e,t[1]=n):n=t[1],n}function od(t){const e=X.c(3),n=rd();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],Xe(o)}function Wm(){const t=X.c(2),e=rd();let n;return t[0]!==e?(n=()=>e(E3(Ln())),t[0]=e,t[1]=n):n=t[1],Xe(n)}function rd(){const t=X.c(2),{prepareForRun:e}=It();let n;return t[0]!==e?(n=async o=>{var a,l;if(o.length===0)return;const{cellHandles:r,cellData:s}=Ln(),i=[];for(const c of o){const u=r[c],h=(a=u==null?void 0:u.current)==null?void 0:a.editorView;let f;h?(I3(h)!=="markdown"&&Qf(h),f=A3(h)):f=((l=s[c])==null?void 0:l.code)||"",i.push(f),e({cellId:c})}await Sz({cellIds:o,codes:i}).catch(XS)},t[0]=e,t[1]=n):n=t[1],Xe(n)}function XS(t){kt.error(t)}const sd=[{type:"files",Icon:hm,tooltip:"View files",position:"sidebar"},{type:"variables",Icon:ql,tooltip:"Explore variables",position:"sidebar"},{type:"datasources",Icon:or,tooltip:"Explore data sources",position:"sidebar"},{type:"dependencies",Icon:ga,tooltip:"Explore dependencies",position:"sidebar"},{type:"packages",Icon:$s,tooltip:"Manage packages",position:"sidebar"},{type:"outline",Icon:ed,tooltip:"View outline",position:"sidebar"},{type:"chat",Icon:Gl,tooltip:"Chat with AI",position:"sidebar"},{type:"documentation",Icon:td,tooltip:"View live docs",position:"sidebar"},{type:"logs",Icon:ep,tooltip:"Notebook logs",position:"sidebar"},{type:"tracing",Icon:rH,tooltip:"Tracing",position:"sidebar"},{type:"snippets",Icon:Dm,tooltip:"Snippets",position:"sidebar"},{type:"secrets",Icon:_m,tooltip:"Secrets",hidden:xn(),position:"sidebar"},{type:"scratchpad",Icon:Cz,tooltip:"Scratchpad",position:"sidebar"},{type:"errors",Icon:Yl,tooltip:"View errors",position:"footer"}];function ZS(){const t=X.c(7);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0];const[n,o]=function(i,a){const l=X.c(11);let c;l[0]!==a?(c=new Nz(a),l[0]=a,l[1]=c):c=l[1];const u=c;let h;l[2]!==i||l[3]!==u?(h=()=>u.get(i),l[2]=i,l[3]=u,l[4]=h):h=l[4];const[f,p]=M.useState(h);let _;l[5]!==i||l[6]!==u?(_=b=>{p(b),u.set(i,b)},l[5]=i,l[6]=u,l[7]=_):_=l[7];const g=_;let m;return l[8]!==g||l[9]!==f?(m=[f,g],l[8]=g,l[9]=f,l[10]=m):m=l[10],m}("marimo:commands",e);let r,s;return t[1]!==n||t[2]!==o?(r=i=>{const a=(l=[i,...n],[...new Set(l)]);var l;o(a.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 qm(t){return t.dropdown!==void 0}function wa(t,e=""){return t.flatMap(n=>n.label?qm(n)?wa(n.dropdown,`${e+n.label} > `):{...n,label:e+n.label}:[])}const qs=t=>{const e=X.c(8),{children:n,layerTop:o}=t,r=o!==void 0&&o;let s;e[0]!==n?(s=K.Children.toArray(n),e[0]=n,e[1]=s):s=e[1];const[i,a]=s,l=`second-icon absolute ${r?"top-[-2px] left-[-2px]":"bottom-[-2px] right-[-2px]"} rounded-full`;let c,u;return e[2]!==a||e[3]!==l?(c=d.jsx("div",{className:l,children:a}),e[2]=a,e[3]=l,e[4]=c):c=e[4],e[5]!==i||e[6]!==c?(u=d.jsxs("div",{className:"multi-icon relative w-fit",children:[i,c]}),e[5]=i,e[6]=c,e[7]=u):u=e[7],u},va=Ht(null),QS=Ht(!1),id=O3("marimo:ai:chatState:v3",{chats:[],activeChatId:null}),eC=Ht(t=>{const e=t(id);return e.chats.find(n=>n.id===e.activeChatId)},(t,e,n)=>{e(id,o=>({...o,activeChatId:n}))});function Gm(t){return t!==D3&&!!(t&&t.trim().length>0)}const ad=t=>{const e=X.c(7);let n,o;e[0]!==t?(n=a=>{var l;(a.ctrlKey||a.metaKey)&&a.key==="z"&&(a.preventDefault(),a.stopPropagation(),(l=t.onClick)==null||l.call(t,a))},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],tp(window,"keydown",n,o);const r=t.children??"Undo";let s,i;return e[3]===Symbol.for("react.memo_cache_sentinel")?(s=d.jsx(jz,{className:"ml-2",shortcut:"cmd-z"}),e[3]=s):s=e[3],e[4]!==r||e[5]!==t?(i=d.jsxs(Te,{"data-testid":"undo-button",size:"sm",variant:"outline",...t,children:[r," ",s]}),e[4]=r,e[5]=t,e[6]=i):i=e[6],i};function ld(){const t=X.c(3),{deleteCell:e,undoDeleteCell:n}=It();let o;return t[0]!==e||t[1]!==n?(o=r=>{var l;if(ct.get(R3))return;const{cellId:s}=r,i=ct.get(np),a=(((l=i.cellData[s])==null?void 0:l.code)??"").trim()==="";if(e({cellId:s}),Ez({cellId:s}).catch(()=>{n()}),!a){const{dismiss:c}=ut({title:"Cell deleted",description:"You can bring it back by clicking undo or through the command palette.",action:d.jsx(ad,{"data-testid":"undo-delete-button",onClick:()=>{n(),u()}})}),u=c}},t[0]=e,t[1]=n,t[2]=o):o=t[2],Xe(o)}function Ym(){const t=X.c(3),{splitCell:e,undoSplitCell:n}=It();let o;return t[0]!==e||t[1]!==n?(o=r=>{const s=Jl(r.cellId);if(!s)return;const i=A3(s);e(r);const{dismiss:a}=ut({title:"Cell split",action:d.jsx(ad,{"data-testid":"undo-split-button",size:"sm",variant:"outline",onClick:()=>{n({...r,snapshot:i}),l()},children:"Undo"})}),l=a},t[0]=e,t[1]=n,t[2]=o):o=t[2],Xe(o)}function cd(t){const e=X.c(49),{cell:n}=t,{createNewCell:o,updateCellConfig:r,updateCellName:s,moveCell:i,sendToTop:a,sendToBottom:l,addColumnBreakpoint:c,clearCellOutput:u}=It(),h=Ym(),f=od(n==null?void 0:n.cellId),p=!Be(R3),_=ld(),{openModal:g}=Fn(),m=Kt(va),b=Be(Kl),y=Be(Xl),x=Be(Cs),v=Be(Iz);if(!n||x){let E;return e[0]===Symbol.for("react.memo_cache_sentinel")?(E=[],e[0]=E):E=e[0],E}const{cellId:C,config:k,getEditorView:j,name:N,hasOutput:I,hasConsoleOutput:A,status:T}=n;let R;e[1]!==C||e[2]!==k.disabled||e[3]!==r?(R=async()=>{const E={disabled:!k.disabled};await Ir({configs:{[C]:E}}),r({cellId:C,config:E})},e[1]=C,e[2]=k.disabled,e[3]=r,e[4]=R):R=e[4];const z=R;let D;e[5]!==C||e[6]!==k.hide_code||e[7]!==j||e[8]!==r?(D=async()=>{const E={hide_code:!k.hide_code};await Ir({configs:{[C]:E}}),r({cellId:C,config:E});const W=j();W&&(E.hide_code?W.contentDOM.blur():W.focus())},e[5]=C,e[6]=k.hide_code,e[7]=j,e[8]=r,e[9]=D):D=e[9];const F=D;let B,U,O,S,$;return e[10]===Symbol.for("react.memo_cache_sentinel")?(B=d.jsx(Bm,{size:13,strokeWidth:1.5}),e[10]=B):B=e[10],e[11]!==C||e[12]!==N||e[13]!==g||e[14]!==s?(U=()=>{g(d.jsxs(nr,{children:[d.jsx(vs,{children:d.jsx(er,{children:"Rename cell"})}),d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx(Ar,{htmlFor:"cell-name",children:"Cell name"}),d.jsx(TS,{placeholder:"cell name",value:N,onKeyDown:E=>{E.key==="Enter"&&(E.preventDefault(),E.stopPropagation(),g(null))},onChange:E=>s({cellId:C,name:E})})]})]}))},e[11]=C,e[12]=N,e[13]=g,e[14]=s,e[15]=U):U=e[15],e[16]!==C||e[17]!==s?(O=E=>s({cellId:C,name:E}),e[16]=C,e[17]=s,e[18]=O):O=e[18],e[19]!==N||e[20]!==O?(S=d.jsx(TS,{placeholder:"cell name",value:N,onChange:O}),e[19]=N,e[20]=O,e[21]=S):S=e[21],e[22]!==c||e[23]!==b||e[24]!==v||e[25]!==y||e[26]!==p||e[27]!==C||e[28]!==u||e[29]!==k.disabled||e[30]!==k.hide_code||e[31]!==o||e[32]!==_||e[33]!==j||e[34]!==A||e[35]!==I||e[36]!==i||e[37]!==N||e[38]!==f||e[39]!==l||e[40]!==a||e[41]!==m||e[42]!==h||e[43]!==T||e[44]!==U||e[45]!==S||e[46]!==z||e[47]!==F?($=[[{icon:B,label:"Name",disableClick:!0,handle:rC,handleHeadless:U,rightElement:S},{icon:d.jsx(Hs,{size:13,strokeWidth:1.5}),label:"Run cell",hotkey:"cell.run",hidden:T==="running"||T==="queued"||T==="disabled-transitively"||k.disabled,handle:()=>f()},{icon:d.jsx(Hi,{size:13,strokeWidth:1.5}),label:"AI completion",hidden:!b,handle:()=>{m(E=>(E==null?void 0:E.cellId)===C?null:{cellId:C})},hotkey:"cell.aiCompletion"},{icon:d.jsx(Qc,{size:13,strokeWidth:1.5}),label:"Split cell",hotkey:"cell.splitCell",handle:()=>h({cellId:C})},{icon:d.jsx(Yp,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!I,handle:()=>function(E){const W=document.getElementById(T3.create(E));W&&(W.classList.add("printing-output"),M3(W,"result.png").finally(()=>{W.classList.remove("printing-output")}))}(C)},{icon:d.jsx(Tz,{size:13,strokeWidth:1.5}),label:"Format cell",hotkey:"cell.format",handle:()=>{const E=j();E&&Az({[C]:E})}},{icon:k.hide_code?d.jsx(P3,{size:13,strokeWidth:1.5}):d.jsx(L3,{size:13,strokeWidth:1.5}),label:k.hide_code?"Show code":"Hide code",handle:F,hotkey:"cell.hideCode"},{icon:k.disabled?d.jsx(hr,{size:13,strokeWidth:1.5}):d.jsx(fr,{size:13,strokeWidth:1.5}),label:"Reactive execution",rightElement:d.jsx(Mz,{"data-testid":"cell-disable-switch",checked:!k.disabled,size:"sm",onCheckedChange:z}),handle:z},{icon:d.jsx(Yl,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(I||A),handle:()=>{u({cellId:C})}}],[{icon:d.jsx(Zl,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:()=>{const E=j();E&&(ao(y,o),Er(E,"markdown",{keepCodeAsIs:!1}))}},{icon:d.jsx(or,{size:13,strokeWidth:1.5}),label:"Convert to SQL",handle:()=>{const E=j();E&&(ao(y,o),Er(E,"sql",{keepCodeAsIs:!1}))}},{icon:d.jsx(Ql,{}),label:"Toggle as Python",handle:()=>{const E=j();E&&(ao(y,o),Oz(E,"python",{force:!0}))}}],[{icon:d.jsxs(qs,{children:[d.jsx(fa,{size:13,strokeWidth:1.5}),d.jsx(F3,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>o({cellId:C,before:!0})},{icon:d.jsxs(qs,{children:[d.jsx(fa,{size:13,strokeWidth:1.5}),d.jsx(Ns,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>o({cellId:C,before:!1})},{icon:d.jsx(F3,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>i({cellId:C,before:!0})},{icon:d.jsx(Ns,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>i({cellId:C,before:!1})},{icon:d.jsx(z3,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>i({cellId:C,direction:"left"}),hidden:v!=="columns"},{icon:d.jsx(Wi,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>i({cellId:C,direction:"right"}),hidden:v!=="columns"},{icon:d.jsx(tm,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>a({cellId:C,scroll:!1})},{icon:d.jsx(em,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>l({cellId:C,scroll:!1})},{icon:d.jsx(Dz,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",hidden:v!=="columns",handle:()=>c({cellId:C})}],[{icon:d.jsx(CS,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!Gm(N),tooltip:Gm(N)?void 0:"Only named cells can be linked to",handle:async()=>{await pn(function(E){const W=new URL(window.location.href);return W.hash=`scrollTo=${encodeURIComponent(E)}`,W.toString()}(N)),ut({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!p,variant:"danger",icon:d.jsx(op,{size:13,strokeWidth:1.5}),handle:()=>{_({cellId:C})}}]].map(nC).filter(tC),e[22]=c,e[23]=b,e[24]=v,e[25]=y,e[26]=p,e[27]=C,e[28]=u,e[29]=k.disabled,e[30]=k.hide_code,e[31]=o,e[32]=_,e[33]=j,e[34]=A,e[35]=I,e[36]=i,e[37]=N,e[38]=f,e[39]=l,e[40]=a,e[41]=m,e[42]=h,e[43]=T,e[44]=U,e[45]=S,e[46]=z,e[47]=F,e[48]=$):$=e[48],$}function tC(t){return t.length>0}function nC(t){return t.filter(oC)}function oC(t){return!t.hidden}function rC(t){t==null||t.stopPropagation(),t==null||t.preventDefault()}function sC(t){return!t.hidden}const dd=Ht(!1),Jm=()=>{const t=X.c(37),[e,n]=tn(dd),o=Pz(),r=Be(Lz),s=Be(rp);let i;t[0]!==r?(i={cell:r},t[0]=r,t[1]=i):i=t[1];let a=cd(i).flat();a=wa(a);const l=function(){const O=X.c(61),[S,$]=Tr(),[E,W]=B3();let G;O[0]!==$?(G=async te=>{await Mr({config:te}).then(()=>{$(te)})},O[0]=$,O[1]=G):G=O[1];const q=G;let Y;O[2]!==W?(Y=async te=>{await Rz({config:te}).then(()=>{W(te)})},O[2]=W,O[3]=Y):Y=O[3];const Q=Y;let re;if(O[4]!==E||O[5]!==S||O[6]!==Q||O[7]!==q){let te,ue,me,de,fe;O[9]!==E?(te=De=>De!==E.width,O[9]=E,O[10]=te):te=O[10],O[11]!==E||O[12]!==Q?(ue=De=>({label:`App config > Set width=${De}`,handle:()=>{Q({...E,width:De})}}),O[11]=E,O[12]=Q,O[13]=ue):ue=O[13],O[14]!==S||O[15]!==q?(me={label:"Config > Set theme: dark",handle:()=>{q({...S,display:{...S.display,theme:"dark"}})}},O[14]=S,O[15]=q,O[16]=me):me=O[16],O[17]!==S||O[18]!==q?(de={label:"Config > Set theme: light",handle:()=>{q({...S,display:{...S.display,theme:"light"}})}},O[17]=S,O[18]=q,O[19]=de):de=O[19],O[20]!==S||O[21]!==q?(fe={label:"Config > Set theme: system",handle:()=>{q({...S,display:{...S.display,theme:"system"}})}},O[20]=S,O[21]=q,O[22]=fe):fe=O[22];const he=S.keymap.preset==="vim";let Ce,Ee;O[23]!==S||O[24]!==q?(Ce=()=>{q({...S,keymap:{...S.keymap,preset:"vim"}})},O[23]=S,O[24]=q,O[25]=Ce):Ce=O[25],O[26]!==he||O[27]!==Ce?(Ee={label:"Config > Switch keymap to VIM",hidden:he,handle:Ce},O[26]=he,O[27]=Ce,O[28]=Ee):Ee=O[28];const ie=S.keymap.preset==="default";let Me,xe,Re;O[29]!==S||O[30]!==q?(Me=()=>{q({...S,keymap:{...S.keymap,preset:"default"}})},O[29]=S,O[30]=q,O[31]=Me):Me=O[31],O[32]!==ie||O[33]!==Me?(xe={label:"Config > Switch keymap to default (current: VIM)",hidden:ie,handle:Me},O[32]=ie,O[33]=Me,O[34]=xe):xe=O[34],O[35]!==S||O[36]!==q?(Re=()=>{q({...S,completion:{...S.completion,copilot:!1}})},O[35]=S,O[36]=q,O[37]=Re):Re=O[37];const Ue=S.completion.copilot!=="github";let Je,Ke;O[38]!==Re||O[39]!==Ue?(Je={label:"Config > Disable GitHub Copilot",handle:Re,hidden:Ue},O[38]=Re,O[39]=Ue,O[40]=Je):Je=O[40],O[41]!==S||O[42]!==q?(Ke=()=>{q({...S,completion:{...S.completion,copilot:"github"}})},O[41]=S,O[42]=q,O[43]=Ke):Ke=O[43];const Pe=S.completion.copilot==="github";let st;O[44]!==Ke||O[45]!==Pe?(st={label:"Config > Enable GitHub Copilot",handle:Ke,hidden:Pe},O[44]=Ke,O[45]=Pe,O[46]=st):st=O[46];const et=!S.display.reference_highlighting;let nt,ne,ve,Se;O[47]!==S||O[48]!==q?(nt=()=>{q({...S,display:{...S.display,reference_highlighting:!1}})},O[47]=S,O[48]=q,O[49]=nt):nt=O[49],O[50]!==et||O[51]!==nt?(ne={label:"Config > Disable reference highlighting",hidden:et,handle:nt},O[50]=et,O[51]=nt,O[52]=ne):ne=O[52],O[53]!==S||O[54]!==q?(ve=()=>{q({...S,display:{...S.display,reference_highlighting:!0}})},O[53]=S,O[54]=q,O[55]=ve):ve=O[55],O[56]!==S.display.reference_highlighting||O[57]!==ve?(Se={label:"Config > Enable reference highlighting",hidden:S.display.reference_highlighting,handle:ve},O[56]=S.display.reference_highlighting,O[57]=ve,O[58]=Se):Se=O[58],re=[...sH().filter(te).map(ue),me,de,fe,Ee,xe,Je,st,ne,Se],O[4]=E,O[5]=S,O[6]=Q,O[7]=q,O[8]=re}else re=O[8];const ae=re;let Z;return O[59]!==ae?(Z=ae.filter(sC),O[59]=ae,O[60]=Z):Z=O[60],Z}();let c=Cg();c=[...wa(c),...wa(l)];const u=c.filter(iC),h=ec.keyBy(u,aC),{recentCommands:f,addRecentCommand:p}=ZS();let _;t[2]!==f?(_=new Set(f),t[2]=f,t[3]=_):_=t[3];const g=_;let m,b;t[4]!==s||t[5]!==n?(m=O=>{Bz(s.getHotkey("global.commandPalette").key)(O)&&(O.preventDefault(),n(lC))},t[4]=s,t[5]=n,t[6]=m):m=t[6],tp(document,"keydown",m),t[7]!==p||t[8]!==s||t[9]!==o||t[10]!==n?(b=(O,S)=>{const $=o[O];if(!$)return null;const E=s.getHotkey(O);return d.jsxs(lo,{disabled:S.disabled,onSelect:()=>{p(O),n(!1),requestAnimationFrame(()=>{$()})},value:E.name,children:[d.jsxs("span",{children:[E.name,S.tooltip&&d.jsx("span",{className:"ml-2",children:S.tooltip})]}),d.jsx(V3,{children:d.jsx(ap,{shortcut:E.key})})]},O)},t[7]=p,t[8]=s,t[9]=o,t[10]=n,t[11]=b):b=t[11];const y=b;let x;t[12]!==p||t[13]!==s||t[14]!==n?(x=(O,S,$,E)=>{const W=$===void 0?{}:$;return d.jsxs(lo,{disabled:W.disabled,onSelect:()=>{p(O),n(!1),requestAnimationFrame(()=>{S()})},value:O,children:[d.jsxs("span",{children:[O,W.tooltip&&d.jsxs("span",{className:"ml-2",children:["(",W.tooltip,")"]})]}),E&&d.jsx(V3,{children:d.jsx(ap,{shortcut:s.getHotkey(E).key})})]},O)},t[12]=p,t[13]=s,t[14]=n,t[15]=x):x=t[15];const v=x,C=zz;let k;t[16]===Symbol.for("react.memo_cache_sentinel")?(k=d.jsx(qi,{placeholder:"Type to search..."}),t[16]=k):k=t[16];const j=ip;let N;t[17]===Symbol.for("react.memo_cache_sentinel")?(N=d.jsx(tc,{children:"No results found."}),t[17]=N):N=t[17];const I=f.length>0&&d.jsxs(d.Fragment,{children:[d.jsx(sp,{heading:"Recently Used",children:f.map(O=>{const S=h[O];return Fz(O)?y(O,{disabled:S==null?void 0:S.disabled,tooltip:S==null?void 0:S.tooltip}):S&&!qm(S)?v(S.label,S.handleHeadless||S.handle,{disabled:S.disabled,tooltip:S.tooltip}):null})}),d.jsx(U3,{})]}),A=sp,T=s.iterate().map(O=>{if(g.has(O))return null;const S=h[O];return y(O,{disabled:S==null?void 0:S.disabled,tooltip:S==null?void 0:S.tooltip})}),R=u.map(O=>g.has(O.label)?null:v(O.label,O.handleHeadless||O.handle,{disabled:O.disabled,tooltip:O.tooltip}));let z;t[18]!==g||t[19]!==v?(z=O=>g.has(O.label)?null:v(`Cell > ${O.label}`,O.handleHeadless||O.handle,{disabled:O.disabled,tooltip:O.tooltip}),t[18]=g,t[19]=v,t[20]=z):z=t[20];const D=a.map(z);let F,B,U;return t[21]!==A||t[22]!==R||t[23]!==D||t[24]!==T?(F=d.jsxs(A,{heading:"Commands",children:[T,R,D]}),t[21]=A,t[22]=R,t[23]=D,t[24]=T,t[25]=F):F=t[25],t[26]!==j||t[27]!==F||t[28]!==N||t[29]!==I?(B=d.jsxs(j,{children:[N,I,F]}),t[26]=j,t[27]=F,t[28]=N,t[29]=I,t[30]=B):B=t[30],t[31]!==C||t[32]!==e||t[33]!==n||t[34]!==B||t[35]!==k?(U=d.jsxs(C,{open:e,onOpenChange:n,children:[k,B]}),t[31]=C,t[32]=e,t[33]=n,t[34]=B,t[35]=k,t[36]=U):U=t[36],U};function iC(t){return!t.hotkey}function aC(t){return t.label}function lC(t){return!t}function pr(){return ke.string().optional().describe(We.of({label:"Password",inputType:"password",placeholder:"password",optionRegex:".*password.*"}))}function Km(){return ke.string().optional().describe(We.of({label:"Token",inputType:"password",placeholder:"token",optionRegex:".*token.*"}))}function ka(){return ke.string().optional().describe(We.of({label:"Warehouse Name",placeholder:"warehouse",optionRegex:".*warehouse.*"}))}function Xm(){return ke.string().optional().describe(We.of({label:"URI",optionRegex:".*uri.*"}))}function mr(){return ke.string().nonempty().describe(We.of({label:"Host",placeholder:"localhost",optionRegex:".*host.*"}))}function ho(){return ke.string().describe(We.of({label:"Database",placeholder:"db name",optionRegex:".*database.*"}))}function gr(){return ke.string().nonempty().describe(We.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function _r(t){const e=ke.coerce.string().describe(We.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 Zm(){return ke.boolean().default(!1).describe(We.of({label:"Read Only"}))}const Qm=ke.object({type:ke.literal("postgres"),host:mr(),port:_r(5432).optional(),database:ho(),username:gr(),password:pr(),ssl:ke.boolean().default(!1).describe(We.of({label:"Use SSL"}))}).describe(We.of({direction:"two-columns"})),eg=ke.object({type:ke.literal("mysql"),host:mr(),port:_r(3306),database:ho(),username:gr(),password:pr(),ssl:ke.boolean().default(!1).describe(We.of({label:"Use SSL"}))}).describe(We.of({direction:"two-columns"})),tg=ke.object({type:ke.literal("sqlite"),database:ho().describe(We.of({label:"Database Path"}))}).describe(We.of({direction:"two-columns"})),ng=ke.object({type:ke.literal("duckdb"),database:ho().describe(We.of({label:"Database Path"})),read_only:Zm()}).describe(We.of({direction:"two-columns"})),og=ke.object({type:ke.literal("motherduck"),database:ho().default("my_db").describe(We.of({label:"Database Name"})),token:Km()}).describe(We.of({direction:"two-columns"})),rg=ke.object({type:ke.literal("snowflake"),account:ke.string().nonempty().describe(We.of({label:"Account",optionRegex:".*snowflake.*"})),warehouse:ke.string().optional().describe(We.of({label:"Warehouse",optionRegex:".*snowflake.*"})),database:ho(),schema:ke.string().optional().describe(We.of({label:"Schema",optionRegex:".*snowflake.*"})),username:gr(),password:pr(),role:ke.string().optional().describe(We.of({label:"Role"}))}).describe(We.of({direction:"two-columns"})),sg=ke.object({type:ke.literal("bigquery"),project:ke.string().nonempty().describe(We.of({label:"Project ID",optionRegex:".*bigquery.*"})),dataset:ke.string().nonempty().describe(We.of({label:"Dataset",optionRegex:".*bigquery.*"})),credentials_json:ke.string().describe(We.of({label:"Credentials JSON",inputType:"textarea"}))}).describe(We.of({direction:"two-columns"})),ig=ke.object({type:ke.literal("clickhouse_connect"),host:mr(),port:_r(8123).optional(),username:gr(),password:pr(),secure:ke.boolean().default(!1).describe(We.of({label:"Use HTTPs"}))}).describe(We.of({direction:"two-columns"})),ag=ke.object({type:ke.literal("timeplus"),host:mr().default("localhost"),port:_r(8123).optional(),username:gr().default("default"),password:pr().default("")}).describe(We.of({direction:"two-columns"})),lg=ke.object({type:ke.literal("chdb"),database:ho().describe(We.of({label:"Database Path"})),read_only:Zm()}).describe(We.of({direction:"two-columns"})),cg=ke.object({type:ke.literal("trino"),host:mr(),port:_r(8080),database:ho(),schema:ke.string().describe(We.of({label:"Schema",placeholder:"schema name",optionRegex:".*schema.*"})).optional(),username:gr(),password:pr(),async_support:ke.boolean().default(!1).describe(We.of({label:"Async Support"}))}).describe(We.of({direction:"two-columns"})),dg=ke.object({type:ke.literal("iceberg"),name:ke.string().describe(We.of({label:"Catalog Name"})),catalog:ke.discriminatedUnion("type",[ke.object({type:ke.literal("REST"),warehouse:ka(),uri:ke.string().optional().describe(We.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:Km()}),ke.object({type:ke.literal("SQL"),warehouse:ka(),uri:ke.string().optional().describe(We.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),ke.object({type:ke.literal("Hive"),warehouse:ka(),uri:Xm()}),ke.object({type:ke.literal("Glue"),warehouse:ka(),uri:Xm()}),ke.object({type:ke.literal("DynamoDB"),"dynamodb.profile-name":ke.string().optional().describe(We.of({label:"Profile Name"})),"dynamodb.region":ke.string().optional().describe(We.of({label:"Region"})),"dynamodb.access-key-id":ke.string().optional().describe(We.of({label:"Access Key ID"})),"dynamodb.secret-access-key":ke.string().optional().describe(We.of({label:"Secret Access Key",inputType:"password"})),"dynamodb.session-token":ke.string().optional().describe(We.of({label:"Session Token",inputType:"password"}))})]).default({type:"REST"}).describe(We.of({special:"tabs"}))}),ug=ke.object({type:ke.literal("datafusion"),sessionContext:ke.boolean().optional().describe(We.of({label:"Use Session Context"}))}),hg=ke.object({type:ke.literal("pyspark"),host:mr().optional(),port:_r().optional()}),fg=ke.object({type:ke.literal("redshift"),host:mr(),port:_r(5439),connectionType:ke.discriminatedUnion("type",[ke.object({type:ke.literal("IAM credentials"),region:ke.string().describe(We.of({label:"Region"})),aws_access_key_id:ke.string().nonempty().describe(We.of({label:"AWS Access Key ID",inputType:"password",optionRegex:".*aws_access_key_id.*"})),aws_secret_access_key:ke.string().nonempty().describe(We.of({label:"AWS Secret Access Key",inputType:"password",optionRegex:".*aws_secret_access_key.*"})),aws_session_token:ke.string().optional().describe(We.of({label:"AWS Session Token",inputType:"password",optionRegex:".*aws_session_token.*"}))}),ke.object({type:ke.literal("DB credentials"),user:gr(),password:pr()})]).default({type:"IAM credentials",aws_access_key_id:"",aws_secret_access_key:"",region:""}),database:ho()}).describe(We.of({direction:"two-columns"})),cC=ke.discriminatedUnion("type",[Qm,eg,tg,ng,og,rg,sg,ig,ag,lg,cg,dg,ug,hg,fg]),ud="env:";function Sa(t){return typeof t=="string"&&t.startsWith(ud)}function hd(t){return`${ud}${t}`}const pg={sqlmodel:"SQLModel",sqlalchemy:"SQLAlchemy",duckdb:"DuckDB",clickhouse_connect:"ClickHouse Connect",chdb:"chDB",pyiceberg:"PyIceberg",ibis:"Ibis",motherduck:"MotherDuck",redshift:"Redshift"};class on{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 dC{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),Sa(n)){const r=n.replace(ud,""),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"?Fr(n):n?`"${n}"`:""}printInFString(e,n,o){if(n===void 0)return"";if(typeof n=="number")return`${n}`;if(typeof n=="boolean")return Fr(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 Sa(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 uC extends on{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),i=this.secrets.printInFString("database",this.connection.database);return xt(`
4
4
  DATABASE_URL = f"postgresql://${o}:${n}@${r}:${s}/${i}"
5
5
  engine = ${this.orm}.create_engine(DATABASE_URL${e})
@@ -141,4 +141,4 @@ ${A}
141
141
  `)}),includeOtherCode:vc("")}),onFinish:A=>{e(T=>Ju(T,T.activeChatId,A.id,"assistant",A.content,A.parts))},onToolCall:async({toolCall:A})=>{try{const T=await XV({toolName:A.toolName,arguments:A.args});return T.result||T.error}catch(T){return kt.error("Tool call failed:",T),`Error: ${T instanceof Error?T.message:String(T)}`}},onError:A=>{kt.error("An error occurred:",A)},onResponse:A=>{kt.debug("Received HTTP response from server:",A)}}),k=x==="submitted"||x==="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 T=t.chats.find(D=>D.id===t.activeChatId);if(!T)return;const R=new Set(T.messages.map(D=>D.id)),z=f.filter(D=>D.role==="user"&&!R.has(D.id));z.length>0&&e(D=>{let F=D;for(const B of z)F=Ju(F,D.activeChatId,B.id,"user",B.content);return F})},[f,t.activeChatId,t.chats,e]);const j=k&&f.length>0&&(A=>{if(A.length===0)return!1;const T=A.at(-1);if(!T||T.role!=="assistant"||!T.parts)return!1;const R=T.parts;return R.length===0?!1:R[R.length-1].type==="reasoning"})(f);M.useEffect(()=>{requestAnimationFrame(()=>{if(l.current){const A=l.current;A.scrollTop=A.scrollHeight}})},[t.activeChatId]);const N=(A,T)=>{g(R=>R.slice(0,A)),t.activeChatId&&e(R=>({...R,chats:R.chats.map(z=>z.id===t.activeChatId?{...z,messages:z.messages.slice(0,A),updatedAt:Date.now()}:z)})),m({role:"user",content:T})},I=()=>{r.trim()&&(A=>{const T=Date.now(),R={id:tS(),title:A.length>50?`${A.slice(0,50)}...`:A,messages:[],createdAt:T,updatedAt:T};e(D=>({...D,chats:[...D.chats,R],activeChatId:R.id}));const z=tS();m({id:z,role:"user",content:A}),_("")})(r.trim())};return d.jsxs("div",{className:"flex flex-col h-[calc(100%-53px)]",children:[d.jsx(Dp,{children:d.jsx(WD,{onNewChat:()=>{o(null),_(""),s("")},activeChatId:n==null?void 0:n.id,setActiveChat:o,chats:[...t.chats].sort((A,T)=>T.updatedAt-A.updatedAt)})}),d.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)&&d.jsxs("div",{className:"flex flex-col rounded-md border bg-background",children:[d.jsx("div",{className:"px-1",children:d.jsx(Ic,{value:r,placeholder:"Ask anything, @ to include context about tables or dataframes",theme:u,onClose:()=>{var A,T;return(T=(A=i.current)==null?void 0:A.editor)==null?void 0:T.blur()},onChange:s,onSubmit:I},"new-thread-input")}),d.jsx(Eh,{input:r,onSendClick:I,isLoading:k,onStop:C})]}),f.map((A,T)=>d.jsx(dv,{message:A,index:T,theme:u,onEdit:N,setChatState:e,chatState:t,isStreamingReasoning:j,totalMessages:f.length},T)),k&&d.jsx("div",{className:"flex justify-center py-4",children:d.jsx(Ac,{className:"h-4 w-4 animate-spin"})}),y&&d.jsxs("div",{className:"flex items-center justify-center space-x-2 mb-4",children:[d.jsx(Dr,{error:y}),d.jsx(Te,{variant:"outline",size:"sm",onClick:()=>{v()},children:"Retry"})]}),d.jsx("div",{ref:c})]}),k&&d.jsx("div",{className:"w-full flex justify-center items-center z-20 border-t",children:d.jsx(Te,{variant:"linkDestructive",size:"sm",onClick:C,children:"Stop"})}),f&&f.length>0&&d.jsx(uv,{input:p,setInput:_,onSubmit:(A,T)=>{T.trim()&&b(A)},theme:u,inputRef:a,isLoading:k,onStop:C})]})};function YD(){}function JD(){}function KD(t){return d.jsx(Gi,{value:t,className:"text-sm",children:t},t)}function ln(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=ln(t[o]))!==""&&(e+=(e&&" ")+n);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}const{useDebugValue:XD}=K,{useSyncExternalStoreWithSelector:ZD}=e$,QD=t=>t;function hv(t,e=QD,n){const o=ZD(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return XD(o),o}const fv=(t,e)=>{const n=t$(t),o=(r,s=e)=>hv(n,r,s);return Object.assign(o,n),o};function Qt(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 so(t,e){if(t=function(s){let i;for(;i=s.sourceEvent;)s=i;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 eR={passive:!1},Ai={capture:!0,passive:!1};function Ih(t){t.stopImmediatePropagation()}function cs(t){t.preventDefault(),t.stopImmediatePropagation()}function pv(t){var e=t.document.documentElement,n=Kn(t).on("dragstart.drag",cs,Ai);"onselectstart"in e?n.on("selectstart.drag",cs,Ai):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function mv(t,e){var n=t.document.documentElement,o=Kn(t).on("dragstart.drag",null);e&&(o.on("click.drag",cs,Ai),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 Al=t=>()=>t;function Ah(t,{sourceEvent:e,subject:n,target:o,identifier:r,active:s,x:i,y:a,dx:l,dy:c,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:i,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}function tR(t){return!t.ctrlKey&&!t.button}function nR(){return this.parentNode}function oR(t,e){return e??{x:t.x,y:t.y}}function rR(){return navigator.maxTouchPoints||"ontouchstart"in this}Ah.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};const Tl=t=>()=>t;function sR(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 Th(t){t.stopImmediatePropagation()}function Ti(t){t.preventDefault(),t.stopImmediatePropagation()}function iR(t){return!(t.ctrlKey&&t.type!=="wheel"||t.button)}function aR(){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 gv(){return this.__zoom||ur}function lR(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function cR(){return navigator.maxTouchPoints||"ontouchstart"in this}function dR(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],i=t.invertY(e[1][1])-n[1][1];return t.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i))}const Ml=M.createContext(null),uR=Ml.Provider,hR=t=>`Node type "${t}" not found. Using fallback type "default".`,fR=()=>"The React Flow parent container needs a width and a height to render the graph.",pR=()=>"Only child nodes can use a parent extent.",mR=t=>`Marker type "${t}" doesn't exist.`,gR=(t,e)=>`Couldn't create edge for ${t?"target":"source"} handle id: "${t?e.targetHandle:e.sourceHandle}", edge id: ${e.id}.`,_R=()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",bR=t=>`Edge type "${t}" not found. Using fallback type "default".`,yR=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.`,_v="[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001";function pt(t,e){const n=M.useContext(Ml);if(n===null)throw new Error(_v);return hv(n,t,e)}const Vt=()=>{const t=M.useContext(Ml);if(t===null)throw new Error(_v);return M.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe,destroy:t.destroy}),[t])},xR=t=>t.userSelectionActive?"none":"all";function Ol({position:t,children:e,className:n,style:o,...r}){const s=pt(xR),i=`${t}`.split("-");return K.createElement("div",{className:ln(["react-flow__panel",n,...i]),style:{...o,pointerEvents:s},...r},e)}function wR({proOptions:t,position:e="bottom-right"}){return t!=null&&t.hideAttribution?null:K.createElement(Ol,{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"},K.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}var vR=M.memo(({x:t,y:e,label:n,labelStyle:o={},labelShowBg:r=!0,labelBgStyle:s={},labelBgPadding:i=[2,4],labelBgBorderRadius:a=2,children:l,className:c,...u})=>{const h=M.useRef(null),[f,p]=M.useState({x:0,y:0,width:0,height:0}),_=ln(["react-flow__edge-textwrapper",c]);return M.useEffect(()=>{if(h.current){const g=h.current.getBBox();p({x:g.x,y:g.y,width:g.width,height:g.height})}},[n]),n!==void 0&&n?K.createElement("g",{transform:`translate(${t-f.width/2} ${e-f.height/2})`,className:_,visibility:f.width?"visible":"hidden",...u},r&&K.createElement("rect",{width:f.width+2*i[0],x:-i[0],y:-i[1],height:f.height+2*i[1],className:"react-flow__edge-textbg",style:s,rx:a,ry:a}),K.createElement("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:h,style:o},n),l):null});const Mh=t=>({width:t.offsetWidth,height:t.offsetHeight}),ds=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),Oh=(t={x:0,y:0},e)=>({x:ds(t.x,e[0][0],e[1][0]),y:ds(t.y,e[0][1],e[1][1])}),bv=(t,e,n)=>t<e?ds(Math.abs(t-e),1,50)/50:t>n?-ds(Math.abs(t-n),1,50)/50:0,yv=(t,e)=>[20*bv(t.x,35,e.width-35),20*bv(t.y,35,e.height-35)],xv=t=>{var e;return((e=t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},Dh=({x:t,y:e,width:n,height:o})=>({x:t,y:e,x2:t+n,y2:e+o}),wv=t=>({...t.positionAbsolute||{x:0,y:0},width:t.width||0,height:t.height||0}),Rh=(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)},On=t=>!isNaN(t)&&isFinite(t),vt=Symbol.for("internals"),vv=["Enter"," ","Escape"];function Ph(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 kv=t=>"clientX"in t,Yo=(t,e)=>{var s,i;const n=kv(t),o=n?t.clientX:(s=t.touches)==null?void 0:s[0].clientX,r=n?t.clientY:(i=t.touches)==null?void 0:i[0].clientY;return{x:o-((e==null?void 0:e.left)??0),y:r-((e==null?void 0:e.top)??0)}},Dl=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0},Mi=({id:t,path:e,labelX:n,labelY:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:u,markerEnd:h,markerStart:f,interactionWidth:p=20})=>K.createElement(K.Fragment,null,K.createElement("path",{id:t,style:u,d:e,fill:"none",className:"react-flow__edge-path",markerEnd:h,markerStart:f}),p&&K.createElement("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:p,className:"react-flow__edge-interaction"}),r&&On(n)&&On(o)?K.createElement(vR,{x:n,y:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null);function Oi(t,e,n){return n===void 0?n:o=>{const r=e().edges.find(s=>s.id===t);r&&n(o,{...r})}}function Sv({sourceX:t,sourceY:e,targetX:n,targetY:o}){const r=Math.abs(n-t)/2,s=n<t?n+r:n-r,i=Math.abs(o-e)/2;return[s,o<e?o+i:o-i,r,i]}function Cv({sourceX:t,sourceY:e,targetX:n,targetY:o,sourceControlX:r,sourceControlY:s,targetControlX:i,targetControlY:a}){const l=.125*t+.375*r+.375*i+.125*n,c=.125*e+.375*s+.375*a+.125*o;return[l,c,Math.abs(l-t),Math.abs(c-e)]}var Cr,Nv,Jo,Lh,Di,jv,Ko,Ri,us,Ev,ze,Rl;function Iv({pos:t,x1:e,y1:n,x2:o,y2:r}){return t===ze.Left||t===ze.Right?[.5*(e+o),n]:[e,.5*(n+r)]}function Av({sourceX:t,sourceY:e,sourcePosition:n=ze.Bottom,targetX:o,targetY:r,targetPosition:s=ze.Top}){const[i,a]=Iv({pos:n,x1:t,y1:e,x2:o,y2:r}),[l,c]=Iv({pos:s,x1:o,y1:r,x2:t,y2:e}),[u,h,f,p]=Cv({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:l,targetControlY:c});return[`M${t},${e} C${i},${a} ${l},${c} ${o},${r}`,u,h,f,p]}Mi.displayName="BaseEdge",(Nv=Cr||(Cr={})).Strict="strict",Nv.Loose="loose",(Lh=Jo||(Jo={})).Free="free",Lh.Vertical="vertical",Lh.Horizontal="horizontal",(jv=Di||(Di={})).Partial="partial",jv.Full="full",(Ri=Ko||(Ko={})).Bezier="default",Ri.Straight="straight",Ri.Step="step",Ri.SmoothStep="smoothstep",Ri.SimpleBezier="simplebezier",(Ev=us||(us={})).Arrow="arrow",Ev.ArrowClosed="arrowclosed",(Rl=ze||(ze={})).Left="left",Rl.Top="top",Rl.Right="right",Rl.Bottom="bottom";const Fh=M.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,sourcePosition:r=ze.Bottom,targetPosition:s=ze.Top,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:h,style:f,markerEnd:p,markerStart:_,interactionWidth:g})=>{const[m,b,y]=Av({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:o,targetPosition:s});return K.createElement(Mi,{path:m,labelX:b,labelY:y,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:h,style:f,markerEnd:p,markerStart:_,interactionWidth:g})});Fh.displayName="SimpleBezierEdge";const Tv={[ze.Left]:{x:-1,y:0},[ze.Right]:{x:1,y:0},[ze.Top]:{x:0,y:-1},[ze.Bottom]:{x:0,y:1}},Mv=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function kR({source:t,sourcePosition:e=ze.Bottom,target:n,targetPosition:o=ze.Top,center:r,offset:s}){const i=Tv[e],a=Tv[o],l={x:t.x+i.x*s,y:t.y+i.y*s},c={x:n.x+a.x*s,y:n.y+a.y*s},u=(({source:k,sourcePosition:j=ze.Bottom,target:N})=>j===ze.Left||j===ze.Right?k.x<N.x?{x:1,y:0}:{x:-1,y:0}:k.y<N.y?{x:0,y:1}:{x:0,y:-1})({source:l,sourcePosition:e,target:c}),h=u.x!==0?"x":"y",f=u[h];let p,_,g=[];const m={x:0,y:0},b={x:0,y:0},[y,x,v,C]=Sv({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(i[h]*a[h]===-1){p=r.x??y,_=r.y??x;const k=[{x:p,y:l.y},{x:p,y:c.y}],j=[{x:l.x,y:_},{x:c.x,y:_}];g=i[h]===f?h==="x"?k:j:h==="x"?j:k}else{const k=[{x:l.x,y:c.y}],j=[{x:c.x,y:l.y}];if(g=h==="x"?i.x===f?j:k:i.y===f?k:j,e===o){const A=Math.abs(t[h]-n[h]);if(A<=s){const T=Math.min(s-1,s-A);i[h]===f?m[h]=(l[h]>t[h]?-1:1)*T:b[h]=(c[h]>n[h]?-1:1)*T}}if(e!==o){const A=h==="x"?"y":"x",T=i[h]===a[A],R=l[A]>c[A],z=l[A]<c[A];(i[h]===1&&(!T&&R||T&&z)||i[h]!==1&&(!T&&z||T&&R))&&(g=h==="x"?k:j)}const N={x:l.x+m.x,y:l.y+m.y},I={x:c.x+b.x,y:c.y+b.y};Math.max(Math.abs(N.x-g[0].x),Math.abs(I.x-g[0].x))>=Math.max(Math.abs(N.y-g[0].y),Math.abs(I.y-g[0].y))?(p=(N.x+I.x)/2,_=g[0].y):(p=g[0].x,_=(N.y+I.y)/2)}return[[t,{x:l.x+m.x,y:l.y+m.y},...g,{x:c.x+b.x,y:c.y+b.y},n],p,_,v,C]}function zh({sourceX:t,sourceY:e,sourcePosition:n=ze.Bottom,targetX:o,targetY:r,targetPosition:s=ze.Top,borderRadius:i=5,centerX:a,centerY:l,offset:c=20}){const[u,h,f,p,_]=kR({source:{x:t,y:e},sourcePosition:n,target:{x:o,y:r},targetPosition:s,center:{x:a,y:l},offset:c});return[u.reduce((g,m,b)=>{let y="";return y=b>0&&b<u.length-1?function(x,v,C,k){const j=Math.min(Mv(x,v)/2,Mv(v,C)/2,k),{x:N,y:I}=v;if(x.x===N&&N===C.x||x.y===I&&I===C.y)return`L${N} ${I}`;if(x.y===I)return`L ${N+j*(x.x<C.x?-1:1)},${I}Q ${N},${I} ${N},${I+j*(x.y<C.y?1:-1)}`;const A=x.x<C.x?1:-1;return`L ${N},${I+j*(x.y<C.y?-1:1)}Q ${N},${I} ${N+j*A},${I}`}(u[b-1],m,u[b+1],i):`${b===0?"M":"L"}${m.x} ${m.y}`,g+=y},""),h,f,p,_]}const Pl=M.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:u,sourcePosition:h=ze.Bottom,targetPosition:f=ze.Top,markerEnd:p,markerStart:_,pathOptions:g,interactionWidth:m})=>{const[b,y,x]=zh({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 K.createElement(Mi,{path:b,labelX:y,labelY:x,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:u,markerEnd:p,markerStart:_,interactionWidth:m})});Pl.displayName="SmoothStepEdge";const Bh=M.memo(t=>{var e;return K.createElement(Pl,{...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])})});Bh.displayName="StepEdge";const Uh=M.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:u,markerEnd:h,markerStart:f,interactionWidth:p})=>{const[_,g,m]=function({sourceX:b,sourceY:y,targetX:x,targetY:v}){const[C,k,j,N]=Sv({sourceX:b,sourceY:y,targetX:x,targetY:v});return[`M ${b},${y}L ${x},${v}`,C,k,j,N]}({sourceX:t,sourceY:e,targetX:n,targetY:o});return K.createElement(Mi,{path:_,labelX:g,labelY:m,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:u,markerEnd:h,markerStart:f,interactionWidth:p})});function Ll(t,e){return t>=0?.5*t:25*e*Math.sqrt(-t)}function Ov({pos:t,x1:e,y1:n,x2:o,y2:r,c:s}){switch(t){case ze.Left:return[e-Ll(e-o,s),n];case ze.Right:return[e+Ll(o-e,s),n];case ze.Top:return[e,n-Ll(n-r,s)];case ze.Bottom:return[e,n+Ll(r-n,s)]}}function Dv({sourceX:t,sourceY:e,sourcePosition:n=ze.Bottom,targetX:o,targetY:r,targetPosition:s=ze.Top,curvature:i=.25}){const[a,l]=Ov({pos:n,x1:t,y1:e,x2:o,y2:r,c:i}),[c,u]=Ov({pos:s,x1:o,y1:r,x2:t,y2:e,c:i}),[h,f,p,_]=Cv({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${t},${e} C${a},${l} ${c},${u} ${o},${r}`,h,f,p,_]}Uh.displayName="StraightEdge";const Fl=M.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,sourcePosition:r=ze.Bottom,targetPosition:s=ze.Top,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:h,style:f,markerEnd:p,markerStart:_,pathOptions:g,interactionWidth:m})=>{const[b,y,x]=Dv({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:o,targetPosition:s,curvature:g==null?void 0:g.curvature});return K.createElement(Mi,{path:b,labelX:y,labelY:x,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:h,style:f,markerEnd:p,markerStart:_,interactionWidth:m})});Fl.displayName="BezierEdge";const Vh=M.createContext(null),SR=Vh.Provider;Vh.Consumer;const CR=({source:t,sourceHandle:e,target:n,targetHandle:o})=>`reactflow__edge-${t}${e||""}-${n}${o||""}`,$h=(t,e)=>t===void 0?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(n=>`${n}=${t[n]}`).join("&")}`,Hh=({x:t,y:e},[n,o,r],s,[i,a])=>{const l={x:(t-n)/r,y:(e-o)/r};return s?{x:i*Math.round(l.x/i),y:a*Math.round(l.y/a)}:l},Rv=({x:t,y:e},[n,o,r])=>({x:t*r+n,y:e*r+o}),hs=(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}},Wh=(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:i}=hs(r,e).positionAbsolute;return a=o,l=Dh({x:s,y:i,width:r.width||0,height:r.height||0}),{x:Math.min(a.x,l.x),y:Math.min(a.y,l.y),x2:Math.max(a.x2,l.x2),y2:Math.max(a.y2,l.y2)};var a,l},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return(({x:o,y:r,x2:s,y2:i})=>({x:o,y:r,width:s-o,height:i-r}))(n)},Pv=(t,e,[n,o,r]=[0,0,1],s=!1,i=!1,a=[0,0])=>{const l={x:(e.x-n)/r,y:(e.y-o)/r,width:e.width/r,height:e.height/r},c=[];return t.forEach(u=>{const{width:h,height:f,selectable:p=!0,hidden:_=!1}=u;if(i&&!p||_)return!1;const{positionAbsolute:g}=hs(u,a),m={x:g.x,y:g.y,width:h||0,height:f||0},b=Rh(l,m);(h===void 0||f===void 0||h===null||f===null||s&&b>0||b>=(h||0)*(f||0)||u.dragging)&&c.push(u)}),c},Lv=(t,e)=>{const n=t.map(o=>o.id);return e.filter(o=>n.includes(o.source)||n.includes(o.target))},Fv=(t,e,n,o,r,s=.1)=>{const i=e/(t.width*(1+s)),a=n/(t.height*(1+s)),l=Math.min(i,a),c=ds(l,o,r);return{x:e/2-(t.x+t.width/2)*c,y:n/2-(t.y+t.height/2)*c,zoom:c}},Nr=(t,e=0)=>t.transition().duration(e);function zv(t,e,n,o){return(e[n]||[]).reduce((r,s)=>{var i,a;return`${t.id}-${s.id}-${n}`!==o&&r.push({id:s.id||null,type:n,nodeId:t.id,x:(((i=t.positionAbsolute)==null?void 0:i.x)??0)+s.x+s.width/2,y:(((a=t.positionAbsolute)==null?void 0:a.y)??0)+s.y+s.height/2}),r},[])}const NR={source:null,target:null,sourceHandle:null,targetHandle:null},Bv=()=>({handleDomNode:null,isValid:!1,connection:NR,endHandle:null});function Uv(t,e,n,o,r,s,i){const a=r==="target",l=i.querySelector(`.react-flow__handle[data-id="${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`),c={...Bv(),handleDomNode:l};if(l){const u=qh(void 0,l),h=l.getAttribute("data-nodeid"),f=l.getAttribute("data-handleid"),p=l.classList.contains("connectable"),_=l.classList.contains("connectableend"),g={source:a?h:n,sourceHandle:a?f:o,target:a?n:h,targetHandle:a?o:f};c.connection=g,p&&_&&(e===Cr.Strict?a&&u==="source"||!a&&u==="target":h!==n||f!==o)&&(c.endHandle={nodeId:h,handleId:f,type:u},c.isValid=s(g))}return c}function qh(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function Gh(t){t==null||t.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function jR(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function Vv({event:t,handleId:e,nodeId:n,onConnect:o,isTarget:r,getState:s,setState:i,isValidConnection:a,edgeUpdaterType:l,onReconnectEnd:c}){const u=xv(t.target),{connectionMode:h,domNode:f,autoPanOnConnect:p,connectionRadius:_,onConnectStart:g,panBy:m,getNodes:b,cancelConnection:y}=s();let x,v=0;const{x:C,y:k}=Yo(t),j=u==null?void 0:u.elementFromPoint(C,k),N=qh(l,j),I=f==null?void 0:f.getBoundingClientRect();if(!I||!N)return;let A,T=Yo(t,I),R=!1,z=null,D=!1,F=null;const B=function({nodes:$,nodeId:E,handleId:W,handleType:G}){return $.reduce((q,Y)=>{if(Y[vt]){const{handleBounds:Q}=Y[vt];let re=[],ae=[];Q&&(re=zv(Y,Q,"source",`${E}-${W}-${G}`),ae=zv(Y,Q,"target",`${E}-${W}-${G}`)),q.push(...re,...ae)}return q},[])}({nodes:b(),nodeId:n,handleId:e,handleType:N}),U=()=>{if(!p)return;const[$,E]=yv(T,I);m({x:$,y:E}),v=requestAnimationFrame(U)};function O($){const{transform:E}=s();T=Yo($,I);const{handle:W,validHandleResult:G}=function(q,Y,Q,re,ae,Z){const{x:te,y:ue}=Yo(q),me=Y.elementsFromPoint(te,ue).find(Ee=>Ee.classList.contains("react-flow__handle"));if(me){const Ee=me.getAttribute("data-nodeid");if(Ee){const ie=qh(void 0,me),Me=me.getAttribute("data-handleid"),xe=Z({nodeId:Ee,id:Me,type:ie});if(xe){const Re=ae.find(Ue=>Ue.nodeId===Ee&&Ue.type===ie&&Ue.id===Me);return{handle:{id:Me,type:ie,nodeId:Ee,x:(Re==null?void 0:Re.x)||Q.x,y:(Re==null?void 0:Re.y)||Q.y},validHandleResult:xe}}}}let de=[],fe=1/0;if(ae.forEach(Ee=>{const ie=Math.sqrt((Ee.x-Q.x)**2+(Ee.y-Q.y)**2);if(ie<=re){const Me=Z(Ee);ie<=fe&&(ie<fe?de=[{handle:Ee,validHandleResult:Me}]:ie===fe&&de.push({handle:Ee,validHandleResult:Me}),fe=ie)}}),!de.length)return{handle:null,validHandleResult:Bv()};if(de.length===1)return de[0];const he=de.some(({validHandleResult:Ee})=>Ee.isValid),Ce=de.some(({handle:Ee})=>Ee.type==="target");return de.find(({handle:Ee,validHandleResult:ie})=>Ce?Ee.type==="target":!he||ie.isValid)||de[0]}($,u,Hh(T,E,!1,[1,1]),_,B,q=>Uv(q,h,n,e,r?"target":"source",a,u));if(x=W,R||(U(),R=!0),F=G.handleDomNode,z=G.connection,D=G.isValid,i({connectionPosition:x&&D?Rv({x:x.x,y:x.y},E):T,connectionStatus:jR(!!x,D),connectionEndHandle:G.endHandle}),!x&&!D&&!F)return Gh(A);z.source!==z.target&&F&&(Gh(A),A=F,F.classList.add("connecting","react-flow__handle-connecting"),F.classList.toggle("valid",D),F.classList.toggle("react-flow__handle-valid",D))}function S($){var E,W;(x||F)&&z&&D&&(o==null||o(z)),(W=(E=s()).onConnectEnd)==null||W.call(E,$),l&&(c==null||c($)),Gh(A),y(),cancelAnimationFrame(v),R=!1,D=!1,z=null,F=null,u.removeEventListener("mousemove",O),u.removeEventListener("mouseup",S),u.removeEventListener("touchmove",O),u.removeEventListener("touchend",S)}i({connectionPosition:T,connectionStatus:null,connectionNodeId:n,connectionHandleId:e,connectionHandleType:N,connectionStartHandle:{nodeId:n,handleId:e,type:N},connectionEndHandle:null}),g==null||g(t,{nodeId:n,handleId:e,handleType:N}),u.addEventListener("mousemove",O),u.addEventListener("mouseup",S),u.addEventListener("touchmove",O),u.addEventListener("touchend",S)}const $v=()=>!0,ER=t=>({connectionStartHandle:t.connectionStartHandle,connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName}),Hv=M.forwardRef(({type:t="source",position:e=ze.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:s=!0,id:i,onConnect:a,children:l,className:c,onMouseDown:u,onTouchStart:h,...f},p)=>{var N,I;const _=i||null,g=t==="target",m=Vt(),b=M.useContext(Vh),{connectOnClick:y,noPanClassName:x}=pt(ER,Qt),{connecting:v,clickConnecting:C}=pt(((A,T,R)=>z=>{const{connectionStartHandle:D,connectionEndHandle:F,connectionClickStartHandle:B}=z;return{connecting:(D==null?void 0:D.nodeId)===A&&(D==null?void 0:D.handleId)===T&&(D==null?void 0:D.type)===R||(F==null?void 0:F.nodeId)===A&&(F==null?void 0:F.handleId)===T&&(F==null?void 0:F.type)===R,clickConnecting:(B==null?void 0:B.nodeId)===A&&(B==null?void 0:B.handleId)===T&&(B==null?void 0:B.type)===R}})(b,_,t),Qt);b||((I=(N=m.getState()).onError)==null||I.call(N,"010",_R()));const k=A=>{const{defaultEdgeOptions:T,onConnect:R,hasDefaultEdges:z}=m.getState(),D={...T,...A};if(z){const{edges:F,setEdges:B}=m.getState();B(((U,O)=>{if(!U.source||!U.target)return O;let S;return S=($=>"id"in $&&"source"in $&&"target"in $)(U)?{...U}:{...U,id:CR(U)},(($,E)=>E.some(W=>!(W.source!==$.source||W.target!==$.target||W.sourceHandle!==$.sourceHandle&&(W.sourceHandle||$.sourceHandle)||W.targetHandle!==$.targetHandle&&(W.targetHandle||$.targetHandle))))(S,O)?O:O.concat(S)})(D,F))}R==null||R(D),a==null||a(D)},j=A=>{if(!b)return;const T=kv(A);r&&(T&&A.button===0||!T)&&Vv({event:A,handleId:_,nodeId:b,onConnect:k,isTarget:g,getState:m.getState,setState:m.setState,isValidConnection:n||m.getState().isValidConnection||$v}),T?u==null||u(A):h==null||h(A)};return K.createElement("div",{"data-handleid":_,"data-nodeid":b,"data-handlepos":e,"data-id":`${b}-${_}-${t}`,className:ln(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",x,c,{source:!g,target:g,connectable:o,connectablestart:r,connectableend:s,connecting:C,connectionindicator:o&&(r&&!v||s&&v)}]),onMouseDown:j,onTouchStart:j,onClick:y?A=>{const{onClickConnectStart:T,onClickConnectEnd:R,connectionClickStartHandle:z,connectionMode:D,isValidConnection:F}=m.getState();if(!b||!z&&!r)return;if(!z)return T==null||T(A,{nodeId:b,handleId:_,handleType:t}),void m.setState({connectionClickStartHandle:{nodeId:b,type:t,handleId:_}});const B=xv(A.target),U=n||F||$v,{connection:O,isValid:S}=Uv({nodeId:b,id:_,type:t},D,z.nodeId,z.handleId||null,z.type,U,B);S&&k(O),R==null||R(A),m.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f},l)});Hv.displayName="Handle";var Xo=M.memo(Hv);const Wv=({data:t,isConnectable:e,targetPosition:n=ze.Top,sourcePosition:o=ze.Bottom})=>K.createElement(K.Fragment,null,K.createElement(Xo,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label,K.createElement(Xo,{type:"source",position:o,isConnectable:e}));Wv.displayName="DefaultNode";var Yh=M.memo(Wv);const qv=({data:t,isConnectable:e,sourcePosition:n=ze.Bottom})=>K.createElement(K.Fragment,null,t==null?void 0:t.label,K.createElement(Xo,{type:"source",position:n,isConnectable:e}));qv.displayName="InputNode";var Gv=M.memo(qv);const Yv=({data:t,isConnectable:e,targetPosition:n=ze.Top})=>K.createElement(K.Fragment,null,K.createElement(Xo,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label);Yv.displayName="OutputNode";var Jv=M.memo(Yv);const Jh=()=>null;Jh.displayName="GroupNode";const IR=t=>({selectedNodes:t.getNodes().filter(e=>e.selected),selectedEdges:t.edges.filter(e=>e.selected).map(e=>({...e}))}),zl=t=>t.id;function AR(t,e){return Qt(t.selectedNodes.map(zl),e.selectedNodes.map(zl))&&Qt(t.selectedEdges.map(zl),e.selectedEdges.map(zl))}const Kv=M.memo(({onSelectionChange:t})=>{const e=Vt(),{selectedNodes:n,selectedEdges:o}=pt(IR,AR);return M.useEffect(()=>{const r={nodes:n,edges:o};t==null||t(r),e.getState().onSelectionChange.forEach(s=>s(r))},[n,o,t]),null});Kv.displayName="SelectionListener";const TR=t=>!!t.onSelectionChange;function MR({onSelectionChange:t}){const e=pt(TR);return t||e?K.createElement(Kv,{onSelectionChange:t}):null}const OR=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 fs(t,e){M.useEffect(()=>{t!==void 0&&e(t)},[t])}function rt(t,e,n){M.useEffect(()=>{e!==void 0&&n({[t]:e})},[e])}const DR=({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,onConnect:r,onConnectStart:s,onConnectEnd:i,onClickConnectStart:a,onClickConnectEnd:l,nodesDraggable:c,nodesConnectable:u,nodesFocusable:h,edgesFocusable:f,edgesUpdatable:p,elevateNodesOnSelect:_,minZoom:g,maxZoom:m,nodeExtent:b,onNodesChange:y,onEdgesChange:x,elementsSelectable:v,connectionMode:C,snapGrid:k,snapToGrid:j,translateExtent:N,connectOnClick:I,defaultEdgeOptions:A,fitView:T,fitViewOptions:R,onNodesDelete:z,onEdgesDelete:D,onNodeDrag:F,onNodeDragStart:B,onNodeDragStop:U,onSelectionDrag:O,onSelectionDragStart:S,onSelectionDragStop:$,noPanClassName:E,nodeOrigin:W,rfId:G,autoPanOnConnect:q,autoPanOnNodeDrag:Y,onError:Q,connectionRadius:re,isValidConnection:ae,nodeDragThreshold:Z})=>{const{setNodes:te,setEdges:ue,setDefaultNodesAndEdges:me,setMinZoom:de,setMaxZoom:fe,setTranslateExtent:he,setNodeExtent:Ce,reset:Ee}=pt(OR,Qt),ie=Vt();return M.useEffect(()=>{const Me=o==null?void 0:o.map(xe=>({...xe,...A}));return me(n,Me),()=>{Ee()}},[]),rt("defaultEdgeOptions",A,ie.setState),rt("connectionMode",C,ie.setState),rt("onConnect",r,ie.setState),rt("onConnectStart",s,ie.setState),rt("onConnectEnd",i,ie.setState),rt("onClickConnectStart",a,ie.setState),rt("onClickConnectEnd",l,ie.setState),rt("nodesDraggable",c,ie.setState),rt("nodesConnectable",u,ie.setState),rt("nodesFocusable",h,ie.setState),rt("edgesFocusable",f,ie.setState),rt("edgesUpdatable",p,ie.setState),rt("elementsSelectable",v,ie.setState),rt("elevateNodesOnSelect",_,ie.setState),rt("snapToGrid",j,ie.setState),rt("snapGrid",k,ie.setState),rt("onNodesChange",y,ie.setState),rt("onEdgesChange",x,ie.setState),rt("connectOnClick",I,ie.setState),rt("fitViewOnInit",T,ie.setState),rt("fitViewOnInitOptions",R,ie.setState),rt("onNodesDelete",z,ie.setState),rt("onEdgesDelete",D,ie.setState),rt("onNodeDrag",F,ie.setState),rt("onNodeDragStart",B,ie.setState),rt("onNodeDragStop",U,ie.setState),rt("onSelectionDrag",O,ie.setState),rt("onSelectionDragStart",S,ie.setState),rt("onSelectionDragStop",$,ie.setState),rt("noPanClassName",E,ie.setState),rt("nodeOrigin",W,ie.setState),rt("rfId",G,ie.setState),rt("autoPanOnConnect",q,ie.setState),rt("autoPanOnNodeDrag",Y,ie.setState),rt("onError",Q,ie.setState),rt("connectionRadius",re,ie.setState),rt("isValidConnection",ae,ie.setState),rt("nodeDragThreshold",Z,ie.setState),fs(t,te),fs(e,ue),fs(g,de),fs(m,fe),fs(N,he),fs(b,Ce),null},Xv={display:"none"},RR={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Zv="react-flow__node-desc",Qv="react-flow__edge-desc",PR=t=>t.ariaLiveMessage;function LR({rfId:t}){const e=pt(PR);return K.createElement("div",{id:`react-flow__aria-live-${t}`,"aria-live":"assertive","aria-atomic":"true",style:RR},e)}function FR({rfId:t,disableKeyboardA11y:e}){return K.createElement(K.Fragment,null,K.createElement("div",{id:`${Zv}-${t}`,style:Xv},"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."," "),K.createElement("div",{id:`${Qv}-${t}`,style:Xv},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!e&&K.createElement(LR,{rfId:t}))}var Pi=(t=null,e={actInsideInputWithModifier:!0})=>{const[n,o]=M.useState(!1),r=M.useRef(!1),s=M.useRef(new Set([])),[i,a]=M.useMemo(()=>{if(t!==null){const l=(Array.isArray(t)?t:[t]).filter(u=>typeof u=="string").map(u=>u.split("+")),c=l.reduce((u,h)=>u.concat(...h),[]);return[l,c]}return[[],[]]},[t]);return M.useEffect(()=>{const l=typeof document<"u"?document:null,c=(e==null?void 0:e.target)||l;if(t!==null){const u=p=>{if(r.current=p.ctrlKey||p.metaKey||p.shiftKey,(!r.current||r.current&&!e.actInsideInputWithModifier)&&Ph(p))return!1;const _=t2(p.code,a);s.current.add(p[_]),e2(i,s.current,!1)&&(p.preventDefault(),o(!0))},h=p=>{if((!r.current||r.current&&!e.actInsideInputWithModifier)&&Ph(p))return!1;const _=t2(p.code,a);e2(i,s.current,!0)?(o(!1),s.current.clear()):s.current.delete(p[_]),p.key==="Meta"&&s.current.clear(),r.current=!1},f=()=>{s.current.clear(),o(!1)};return c==null||c.addEventListener("keydown",u),c==null||c.addEventListener("keyup",h),window.addEventListener("blur",f),()=>{c==null||c.removeEventListener("keydown",u),c==null||c.removeEventListener("keyup",h),window.removeEventListener("blur",f)}}},[t,o]),n};function e2(t,e,n){return t.filter(o=>n||o.length===e.size).some(o=>o.every(r=>e.has(r)))}function t2(t,e){return e.includes(t)?"code":"key"}function n2(t,e,n,o){var a,l;const r=t.parentNode||t.parentId;if(!r)return n;const s=e.get(r),i=hs(s,o);return n2(s,e,{x:(n.x??0)+i.x,y:(n.y??0)+i.y,z:(((a=s[vt])==null?void 0:a.z)??0)>(n.z??0)?((l=s[vt])==null?void 0:l.z)??0:n.z??0},o)}function o2(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:i,y:a,z:l}=n2(o,t,{...o.position,z:((s=o[vt])==null?void 0:s.z)??0},e);o.positionAbsolute={x:i,y:a},o[vt].z=l,n!=null&&n[o.id]&&(o[vt].isParent=!0)}})}function Kh(t,e,n,o){const r=new Map,s={},i=o?1e3:0;return t.forEach(a=>{var p;const l=(On(a.zIndex)?a.zIndex:0)+(a.selected?i:0),c=e.get(a.id),u={...a,positionAbsolute:{x:a.position.x,y:a.position.y}},h=a.parentNode||a.parentId;h&&(s[h]=!0);const f=(c==null?void 0:c.type)&&(c==null?void 0:c.type)!==a.type;Object.defineProperty(u,vt,{enumerable:!1,value:{handleBounds:f||(p=c==null?void 0:c[vt])==null?void 0:p.handleBounds,z:l}}),r.set(a.id,u)}),o2(r,n,s),r}function r2(t,e={}){const{getNodes:n,width:o,height:r,minZoom:s,maxZoom:i,d3Zoom:a,d3Selection:l,fitViewOnInitDone:c,fitViewOnInit:u,nodeOrigin:h}=t(),f=e.initial&&!c&&u;if(a&&l&&(f||!e.initial)){const p=n().filter(g=>{var b;const m=e.includeHiddenNodes?g.width&&g.height:!g.hidden;return(b=e.nodes)!=null&&b.length?m&&e.nodes.some(y=>y.id===g.id):m}),_=p.every(g=>g.width&&g.height);if(p.length>0&&_){const g=Wh(p,h),{x:m,y:b,zoom:y}=Fv(g,o,r,e.minZoom??s,e.maxZoom??i,e.padding??.1),x=ur.translate(m,b).scale(y);return typeof e.duration=="number"&&e.duration>0?a.transform(Nr(l,e.duration),x):a.transform(l,x),!0}}return!1}function zR(t,e){return t.forEach(n=>{const o=e.get(n.id);o&&e.set(o.id,{...o,[vt]:o[vt],selected:n.selected})}),new Map(e)}function BR(t,e){return e.map(n=>{const o=t.find(r=>r.id===n.id);return o&&(n.selected=o.selected),n})}function Bl({changedNodes:t,changedEdges:e,get:n,set:o}){const{nodeInternals:r,edges:s,onNodesChange:i,onEdgesChange:a,hasDefaultNodes:l,hasDefaultEdges:c}=n();t!=null&&t.length&&(l&&o({nodeInternals:zR(t,r)}),i==null||i(t)),e!=null&&e.length&&(c&&o({edges:BR(e,s)}),a==null||a(e))}const ps=()=>{},UR={zoomIn:ps,zoomOut:ps,zoomTo:ps,getZoom:()=>1,setViewport:ps,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:ps,fitBounds:ps,project:t=>t,screenToFlowPosition:t=>t,flowToScreenPosition:t=>t,viewportInitialized:!1},VR=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection});function Li(){const t=(()=>{const g=Vt(),{d3Zoom:m,d3Selection:b}=pt(VR,Qt);return M.useMemo(()=>b&&m?{zoomIn:x=>m.scaleBy(Nr(b,x==null?void 0:x.duration),1.2),zoomOut:x=>m.scaleBy(Nr(b,x==null?void 0:x.duration),1/1.2),zoomTo:(x,v)=>m.scaleTo(Nr(b,v==null?void 0:v.duration),x),getZoom:()=>g.getState().transform[2],setViewport:(x,v)=>{const[C,k,j]=g.getState().transform,N=ur.translate(x.x??C,x.y??k).scale(x.zoom??j);m.transform(Nr(b,v==null?void 0:v.duration),N)},getViewport:()=>{const[x,v,C]=g.getState().transform;return{x,y:v,zoom:C}},fitView:x=>r2(g.getState,x),setCenter:(x,v,C)=>{const{width:k,height:j,maxZoom:N}=g.getState(),I=(C==null?void 0:C.zoom)!==void 0?C.zoom:N,A=k/2-x*I,T=j/2-v*I,R=ur.translate(A,T).scale(I);m.transform(Nr(b,C==null?void 0:C.duration),R)},fitBounds:(x,v)=>{const{width:C,height:k,minZoom:j,maxZoom:N}=g.getState(),{x:I,y:A,zoom:T}=Fv(x,C,k,j,N,(v==null?void 0:v.padding)??.1),R=ur.translate(I,A).scale(T);m.transform(Nr(b,v==null?void 0:v.duration),R)},project:x=>{const{transform:v,snapToGrid:C,snapGrid:k}=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"),Hh(x,v,C,k)},screenToFlowPosition:x=>{const{transform:v,snapToGrid:C,snapGrid:k,domNode:j}=g.getState();if(!j)return x;const{x:N,y:I}=j.getBoundingClientRect(),A={x:x.x-N,y:x.y-I};return Hh(A,v,C,k)},flowToScreenPosition:x=>{const{transform:v,domNode:C}=g.getState();if(!C)return x;const{x:k,y:j}=C.getBoundingClientRect(),N=Rv(x,v);return{x:N.x+k,y:N.y+j}},viewportInitialized:!0}:UR,[m,b])})(),e=Vt(),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(m=>({...m}))},[]),s=M.useCallback(g=>{const{edges:m=[]}=e.getState();return m.find(b=>b.id===g)},[]),i=M.useCallback(g=>{const{getNodes:m,setNodes:b,hasDefaultNodes:y,onNodesChange:x}=e.getState(),v=m(),C=typeof g=="function"?g(v):g;if(y)b(C);else if(x){const k=C.length===0?v.map(j=>({type:"remove",id:j.id})):C.map(j=>({item:j,type:"reset"}));x(k)}},[]),a=M.useCallback(g=>{const{edges:m=[],setEdges:b,hasDefaultEdges:y,onEdgesChange:x}=e.getState(),v=typeof g=="function"?g(m):g;y?b(v):x&&x(v.length===0?m.map(C=>({type:"remove",id:C.id})):v.map(C=>({item:C,type:"reset"})))},[]),l=M.useCallback(g=>{const m=Array.isArray(g)?g:[g],{getNodes:b,setNodes:y,hasDefaultNodes:x,onNodesChange:v}=e.getState();if(x)y([...b(),...m]);else if(v){const C=m.map(k=>({item:k,type:"add"}));v(C)}},[]),c=M.useCallback(g=>{const m=Array.isArray(g)?g:[g],{edges:b=[],setEdges:y,hasDefaultEdges:x,onEdgesChange:v}=e.getState();x?y([...b,...m]):v&&v(m.map(C=>({item:C,type:"add"})))},[]),u=M.useCallback(()=>{const{getNodes:g,edges:m=[],transform:b}=e.getState(),[y,x,v]=b;return{nodes:g().map(C=>({...C})),edges:m.map(C=>({...C})),viewport:{x:y,y:x,zoom:v}}},[]),h=M.useCallback(({nodes:g,edges:m})=>{const{nodeInternals:b,getNodes:y,edges:x,hasDefaultNodes:v,hasDefaultEdges:C,onNodesDelete:k,onEdgesDelete:j,onNodesChange:N,onEdgesChange:I}=e.getState(),A=(g||[]).map(F=>F.id),T=(m||[]).map(F=>F.id),R=y().reduce((F,B)=>{const U=B.parentNode||B.parentId,O=!A.includes(B.id)&&U&&F.find(S=>S.id===U);return(typeof B.deletable!="boolean"||B.deletable)&&(A.includes(B.id)||O)&&F.push(B),F},[]),z=x.filter(F=>typeof F.deletable!="boolean"||F.deletable),D=z.filter(F=>T.includes(F.id));if(R||D){const F=Lv(R,z),B=[...D,...F],U=B.reduce((O,S)=>(O.includes(S.id)||O.push(S.id),O),[]);(C||v)&&(C&&e.setState({edges:x.filter(O=>!U.includes(O.id))}),v&&(R.forEach(O=>{b.delete(O.id)}),e.setState({nodeInternals:new Map(b)}))),U.length>0&&(j==null||j(B),I&&I(U.map(O=>({id:O,type:"remove"})))),R.length>0&&(k==null||k(R),N)&&N(R.map(O=>({id:O.id,type:"remove"})))}},[]),f=M.useCallback(g=>{const m=On((b=g).width)&&On(b.height)&&On(b.x)&&On(b.y);var b;const y=m?null:e.getState().nodeInternals.get(g.id);return!m&&!y?[null,null,m]:[m?g:wv(y),y,m]},[]),p=M.useCallback((g,m=!0,b)=>{const[y,x,v]=f(g);return y?(b||e.getState().getNodes()).filter(C=>{if(!(v||C.id!==x.id&&C.positionAbsolute))return!1;const k=wv(C),j=Rh(k,y);return m&&j>0||j>=y.width*y.height}):[]},[]),_=M.useCallback((g,m,b=!0)=>{const[y]=f(g);if(!y)return!1;const x=Rh(y,m);return b&&x>0||x>=y.width*y.height},[]);return M.useMemo(()=>({...t,getNodes:n,getNode:o,getEdges:r,getEdge:s,setNodes:i,setEdges:a,addNodes:l,addEdges:c,toObject:u,deleteElements:h,getIntersectingNodes:p,isNodeIntersecting:_}),[t,n,o,r,s,i,a,l,c,u,h,p,_])}const $R={actInsideInputWithModifier:!1},Xh={position:"absolute",width:"100%",height:"100%",top:0,left:0},Ul=t=>({x:t.x,y:t.y,zoom:t.k}),ms=(t,e)=>t.target.closest(`.${e}`),s2=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),i2=t=>{const e=t.ctrlKey&&Dl()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e},HR=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection,d3ZoomHandler:t.d3ZoomHandler,userSelectionActive:t.userSelectionActive}),WR=({onMove:t,onMoveStart:e,onMoveEnd:n,onPaneContextMenu:o,zoomOnScroll:r=!0,zoomOnPinch:s=!0,panOnScroll:i=!1,panOnScrollSpeed:a=.5,panOnScrollMode:l=Jo.Free,zoomOnDoubleClick:c=!0,elementsSelectable:u,panOnDrag:h=!0,defaultViewport:f,translateExtent:p,minZoom:_,maxZoom:g,zoomActivationKeyCode:m,preventScrolling:b=!0,children:y,noWheelClassName:x,noPanClassName:v})=>{const C=M.useRef(),k=Vt(),j=M.useRef(!1),N=M.useRef(!1),I=M.useRef(null),A=M.useRef({x:0,y:0,zoom:0}),{d3Zoom:T,d3Selection:R,d3ZoomHandler:z,userSelectionActive:D}=pt(HR,Qt),F=Pi(m),B=M.useRef(0),U=M.useRef(!1),O=M.useRef();return function(S){const $=Vt();M.useEffect(()=>{let E;const W=()=>{var q,Y;if(!S.current)return;const G=Mh(S.current);G.height!==0&&G.width!==0||((Y=(q=$.getState()).onError)==null||Y.call(q,"004",fR())),$.setState({width:G.width||500,height:G.height||500})};return W(),window.addEventListener("resize",W),S.current&&(E=new ResizeObserver(()=>W()),E.observe(S.current)),()=>{window.removeEventListener("resize",W),E&&S.current&&E.unobserve(S.current)}},[])}(I),M.useEffect(()=>{if(I.current){const S=I.current.getBoundingClientRect(),$=function(){var Y,Q,re,ae=iR,Z=aR,te=dR,ue=lR,me=cR,de=[0,1/0],fe=[[-1/0,-1/0],[1/0,1/0]],he=250,Ce=KH,Ee=US("start","zoom","end"),ie=0,Me=10;function xe(J){J.property("__zoom",gv).on("wheel.zoom",et,{passive:!1}).on("mousedown.zoom",nt).on("dblclick.zoom",ne).filter(me).on("touchstart.zoom",ve).on("touchmove.zoom",Se).on("touchend.zoom touchcancel.zoom",De).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function Re(J,ge){return(ge=Math.max(de[0],Math.min(de[1],ge)))===J.k?J:new Kp(ge,J.x,J.y)}function Ue(J,ge,_e){var pe=ge[0]-_e[0]*J.k,le=ge[1]-_e[1]*J.k;return pe===J.x&&le===J.y?J:new Kp(J.k,pe,le)}function Je(J){return[(+J[0][0]+ +J[1][0])/2,(+J[0][1]+ +J[1][1])/2]}function Ke(J,ge,_e,pe){J.on("start.zoom",function(){Pe(this,arguments).event(pe).start()}).on("interrupt.zoom end.zoom",function(){Pe(this,arguments).event(pe).end()}).tween("zoom",function(){var le=this,He=arguments,Fe=Pe(le,He).event(pe),Ze=Z.apply(le,He),se=_e==null?Je(Ze):typeof _e=="function"?_e.apply(le,He):_e,Ne=Math.max(Ze[1][0]-Ze[0][0],Ze[1][1]-Ze[0][1]),Ie=le.__zoom,Ve=typeof ge=="function"?ge.apply(le,He):ge,Ye=Ce(Ie.invert(se).concat(Ne/Ie.k),Ve.invert(se).concat(Ne/Ve.k));return function(Le){if(Le===1)Le=Ve;else{var qe=Ye(Le),it=Ne/qe[2];Le=new Kp(it,se[0]-qe[0]*it,se[1]-qe[1]*it)}Fe.zoom(null,Le)}})}function Pe(J,ge,_e){return!_e&&J.__zooming||new st(J,ge)}function st(J,ge){this.that=J,this.args=ge,this.active=0,this.sourceEvent=null,this.extent=Z.apply(J,ge),this.taps=0}function et(J,...ge){if(ae.apply(this,arguments)){var _e=Pe(this,ge).event(J),pe=this.__zoom,le=Math.max(de[0],Math.min(de[1],pe.k*Math.pow(2,ue.apply(this,arguments)))),He=so(J);if(_e.wheel)_e.mouse[0][0]===He[0]&&_e.mouse[0][1]===He[1]||(_e.mouse[1]=pe.invert(_e.mouse[0]=He)),clearTimeout(_e.wheel);else{if(pe.k===le)return;_e.mouse=[He,pe.invert(He)],Xp(this),_e.start()}Ti(J),_e.wheel=setTimeout(function(){_e.wheel=null,_e.end()},150),_e.zoom("mouse",te(Ue(Re(pe,le),_e.mouse[0],_e.mouse[1]),_e.extent,fe))}}function nt(J,...ge){if(!re&&ae.apply(this,arguments)){var _e=J.currentTarget,pe=Pe(this,ge,!0).event(J),le=Kn(J.view).on("mousemove.zoom",function(se){if(Ti(se),!pe.moved){var Ne=se.clientX-Fe,Ie=se.clientY-Ze;pe.moved=Ne*Ne+Ie*Ie>ie}pe.event(se).zoom("mouse",te(Ue(pe.that.__zoom,pe.mouse[0]=so(se,_e),pe.mouse[1]),pe.extent,fe))},!0).on("mouseup.zoom",function(se){le.on("mousemove.zoom mouseup.zoom",null),mv(se.view,pe.moved),Ti(se),pe.event(se).end()},!0),He=so(J,_e),Fe=J.clientX,Ze=J.clientY;pv(J.view),Th(J),pe.mouse=[He,this.__zoom.invert(He)],Xp(this),pe.start()}}function ne(J,...ge){if(ae.apply(this,arguments)){var _e=this.__zoom,pe=so(J.changedTouches?J.changedTouches[0]:J,this),le=_e.invert(pe),He=_e.k*(J.shiftKey?.5:2),Fe=te(Ue(Re(_e,He),pe,le),Z.apply(this,ge),fe);Ti(J),he>0?Kn(this).transition().duration(he).call(Ke,Fe,pe,J):Kn(this).call(xe.transform,Fe,pe,J)}}function ve(J,...ge){if(ae.apply(this,arguments)){var _e,pe,le,He,Fe=J.touches,Ze=Fe.length,se=Pe(this,ge,J.changedTouches.length===Ze).event(J);for(Th(J),pe=0;pe<Ze;++pe)He=[He=so(le=Fe[pe],this),this.__zoom.invert(He),le.identifier],se.touch0?se.touch1||se.touch0[2]===He[2]||(se.touch1=He,se.taps=0):(se.touch0=He,_e=!0,se.taps=1+!!Y);Y&&(Y=clearTimeout(Y)),_e&&(se.taps<2&&(Q=He[0],Y=setTimeout(function(){Y=null},500)),Xp(this),se.start())}}function Se(J,...ge){if(this.__zooming){var _e,pe,le,He,Fe=Pe(this,ge).event(J),Ze=J.changedTouches,se=Ze.length;for(Ti(J),_e=0;_e<se;++_e)le=so(pe=Ze[_e],this),Fe.touch0&&Fe.touch0[2]===pe.identifier?Fe.touch0[0]=le:Fe.touch1&&Fe.touch1[2]===pe.identifier&&(Fe.touch1[0]=le);if(pe=Fe.that.__zoom,Fe.touch1){var Ne=Fe.touch0[0],Ie=Fe.touch0[1],Ve=Fe.touch1[0],Ye=Fe.touch1[1],Le=(Le=Ve[0]-Ne[0])*Le+(Le=Ve[1]-Ne[1])*Le,qe=(qe=Ye[0]-Ie[0])*qe+(qe=Ye[1]-Ie[1])*qe;pe=Re(pe,Math.sqrt(Le/qe)),le=[(Ne[0]+Ve[0])/2,(Ne[1]+Ve[1])/2],He=[(Ie[0]+Ye[0])/2,(Ie[1]+Ye[1])/2]}else{if(!Fe.touch0)return;le=Fe.touch0[0],He=Fe.touch0[1]}Fe.zoom("touch",te(Ue(pe,le,He),Fe.extent,fe))}}function De(J,...ge){if(this.__zooming){var _e,pe,le=Pe(this,ge).event(J),He=J.changedTouches,Fe=He.length;for(Th(J),re&&clearTimeout(re),re=setTimeout(function(){re=null},500),_e=0;_e<Fe;++_e)pe=He[_e],le.touch0&&le.touch0[2]===pe.identifier?delete le.touch0:le.touch1&&le.touch1[2]===pe.identifier&&delete le.touch1;if(le.touch1&&!le.touch0&&(le.touch0=le.touch1,delete le.touch1),le.touch0)le.touch0[1]=this.__zoom.invert(le.touch0[0]);else if(le.end(),le.taps===2&&(pe=so(pe,this),Math.hypot(Q[0]-pe[0],Q[1]-pe[1])<Me)){var Ze=Kn(this).on("dblclick.zoom");Ze&&Ze.apply(this,arguments)}}}return xe.transform=function(J,ge,_e,pe){var le=J.selection?J.selection():J;le.property("__zoom",gv),J!==le?Ke(J,ge,_e,pe):le.interrupt().each(function(){Pe(this,arguments).event(pe).start().zoom(null,typeof ge=="function"?ge.apply(this,arguments):ge).end()})},xe.scaleBy=function(J,ge,_e,pe){xe.scaleTo(J,function(){return this.__zoom.k*(typeof ge=="function"?ge.apply(this,arguments):ge)},_e,pe)},xe.scaleTo=function(J,ge,_e,pe){xe.transform(J,function(){var le=Z.apply(this,arguments),He=this.__zoom,Fe=_e==null?Je(le):typeof _e=="function"?_e.apply(this,arguments):_e,Ze=He.invert(Fe),se=typeof ge=="function"?ge.apply(this,arguments):ge;return te(Ue(Re(He,se),Fe,Ze),le,fe)},_e,pe)},xe.translateBy=function(J,ge,_e,pe){xe.transform(J,function(){return te(this.__zoom.translate(typeof ge=="function"?ge.apply(this,arguments):ge,typeof _e=="function"?_e.apply(this,arguments):_e),Z.apply(this,arguments),fe)},null,pe)},xe.translateTo=function(J,ge,_e,pe,le){xe.transform(J,function(){var He=Z.apply(this,arguments),Fe=this.__zoom,Ze=pe==null?Je(He):typeof pe=="function"?pe.apply(this,arguments):pe;return te(ur.translate(Ze[0],Ze[1]).scale(Fe.k).translate(typeof ge=="function"?-ge.apply(this,arguments):-ge,typeof _e=="function"?-_e.apply(this,arguments):-_e),He,fe)},pe,le)},st.prototype={event:function(J){return J&&(this.sourceEvent=J),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(J,ge){return this.mouse&&J!=="mouse"&&(this.mouse[1]=ge.invert(this.mouse[0])),this.touch0&&J!=="touch"&&(this.touch0[1]=ge.invert(this.touch0[0])),this.touch1&&J!=="touch"&&(this.touch1[1]=ge.invert(this.touch1[0])),this.that.__zoom=ge,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(J){var ge=Kn(this.that).datum();Ee.call(J,this.that,new sR(J,{sourceEvent:this.sourceEvent,target:xe,transform:this.that.__zoom,dispatch:Ee}),ge)}},xe.wheelDelta=function(J){return arguments.length?(ue=typeof J=="function"?J:Tl(+J),xe):ue},xe.filter=function(J){return arguments.length?(ae=typeof J=="function"?J:Tl(!!J),xe):ae},xe.touchable=function(J){return arguments.length?(me=typeof J=="function"?J:Tl(!!J),xe):me},xe.extent=function(J){return arguments.length?(Z=typeof J=="function"?J:Tl([[+J[0][0],+J[0][1]],[+J[1][0],+J[1][1]]]),xe):Z},xe.scaleExtent=function(J){return arguments.length?(de[0]=+J[0],de[1]=+J[1],xe):[de[0],de[1]]},xe.translateExtent=function(J){return arguments.length?(fe[0][0]=+J[0][0],fe[1][0]=+J[1][0],fe[0][1]=+J[0][1],fe[1][1]=+J[1][1],xe):[[fe[0][0],fe[0][1]],[fe[1][0],fe[1][1]]]},xe.constrain=function(J){return arguments.length?(te=J,xe):te},xe.duration=function(J){return arguments.length?(he=+J,xe):he},xe.interpolate=function(J){return arguments.length?(Ce=J,xe):Ce},xe.on=function(){var J=Ee.on.apply(Ee,arguments);return J===Ee?xe:J},xe.clickDistance=function(J){return arguments.length?(ie=(J=+J)*J,xe):Math.sqrt(ie)},xe.tapDistance=function(J){return arguments.length?(Me=+J,xe):Me},xe}().scaleExtent([_,g]).translateExtent(p),E=Kn(I.current).call($),W=ur.translate(f.x,f.y).scale(ds(f.zoom,_,g)),G=[[0,0],[S.width,S.height]],q=$.constrain()(W,G,p);$.transform(E,q),$.wheelDelta(i2),k.setState({d3Zoom:$,d3Selection:E,d3ZoomHandler:E.on("wheel.zoom"),transform:[q.x,q.y,q.k],domNode:I.current.closest(".react-flow")})}},[]),M.useEffect(()=>{R&&T&&(!i||F||D?z!==void 0&&R.on("wheel.zoom",function(S,$){if(!b&&S.type==="wheel"&&!S.ctrlKey||ms(S,x))return null;S.preventDefault(),z.call(this,S,$)},{passive:!1}):R.on("wheel.zoom",S=>{if(ms(S,x))return!1;S.preventDefault(),S.stopImmediatePropagation();const $=R.property("__zoom").k||1;if(S.ctrlKey&&s){const ae=so(S),Z=i2(S),te=$*Math.pow(2,Z);return void T.scaleTo(R,te,ae,S)}const E=S.deltaMode===1?20:1;let W=l===Jo.Vertical?0:S.deltaX*E,G=l===Jo.Horizontal?0:S.deltaY*E;!Dl()&&S.shiftKey&&l!==Jo.Vertical&&(W=S.deltaY*E,G=0),T.translateBy(R,-W/$*a,-G/$*a,{internal:!0});const q=Ul(R.property("__zoom")),{onViewportChangeStart:Y,onViewportChange:Q,onViewportChangeEnd:re}=k.getState();clearTimeout(O.current),U.current||(U.current=!0,e==null||e(S,q),Y==null||Y(q)),U.current&&(t==null||t(S,q),Q==null||Q(q),O.current=setTimeout(()=>{n==null||n(S,q),re==null||re(q),U.current=!1},150))},{passive:!1}))},[D,i,l,R,T,z,F,s,b,x,e,t,n]),M.useEffect(()=>{T&&T.on("start",S=>{var W,G;if(!S.sourceEvent||S.sourceEvent.internal)return null;B.current=(W=S.sourceEvent)==null?void 0:W.button;const{onViewportChangeStart:$}=k.getState(),E=Ul(S.transform);j.current=!0,A.current=E,((G=S.sourceEvent)==null?void 0:G.type)==="mousedown"&&k.setState({paneDragging:!0}),$==null||$(E),e==null||e(S.sourceEvent,E)})},[T,e]),M.useEffect(()=>{T&&(D&&!j.current?T.on("zoom",null):D||T.on("zoom",S=>{var E;const{onViewportChange:$}=k.getState();if(k.setState({transform:[S.transform.x,S.transform.y,S.transform.k]}),N.current=!(!o||!s2(h,B.current??0)),(t||$)&&!((E=S.sourceEvent)!=null&&E.internal)){const W=Ul(S.transform);$==null||$(W),t==null||t(S.sourceEvent,W)}}))},[D,T,t,h,o]),M.useEffect(()=>{T&&T.on("end",S=>{if(!S.sourceEvent||S.sourceEvent.internal)return null;const{onViewportChangeEnd:$}=k.getState();if(j.current=!1,k.setState({paneDragging:!1}),o&&s2(h,B.current??0)&&!N.current&&o(S.sourceEvent),N.current=!1,(n||$)&&(E=A.current,W=S.transform,E.x!==W.x||E.y!==W.y||E.zoom!==W.k)){const G=Ul(S.transform);A.current=G,clearTimeout(C.current),C.current=setTimeout(()=>{$==null||$(G),n==null||n(S.sourceEvent,G)},i?150:0)}var E,W})},[T,i,h,n,o]),M.useEffect(()=>{T&&T.filter(S=>{const $=F||r,E=s&&S.ctrlKey;if((h===!0||Array.isArray(h)&&h.includes(1))&&S.button===1&&S.type==="mousedown"&&(ms(S,"react-flow__node")||ms(S,"react-flow__edge")))return!0;if(!(h||$||i||c||s)||D||!c&&S.type==="dblclick"||ms(S,x)&&S.type==="wheel"||ms(S,v)&&(S.type!=="wheel"||i&&S.type==="wheel"&&!F)||!s&&S.ctrlKey&&S.type==="wheel"||!$&&!i&&!E&&S.type==="wheel"||!h&&(S.type==="mousedown"||S.type==="touchstart")||Array.isArray(h)&&!h.includes(S.button)&&S.type==="mousedown")return!1;const W=Array.isArray(h)&&h.includes(S.button)||!S.button||S.button<=1;return(!S.ctrlKey||S.type==="wheel")&&W})},[D,T,r,s,i,c,h,u,F]),K.createElement("div",{className:"react-flow__renderer",ref:I,style:Xh},y)},qR=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function GR(){const{userSelectionActive:t,userSelectionRect:e}=pt(qR,Qt);return t&&e?K.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 a2(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 i=Math.abs(e.position.x);o.position.x=o.position.x-i,o.style.width+=i,e.position.x=0}if(e.position.y<0){const i=Math.abs(e.position.y);o.position.y=o.position.y-i,o.style.height+=i,e.position.y=0}o.width=o.style.width,o.height=o.style.height}}}function l2(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(a=>a.id===r.id);if(s.length===0)return o.push(r),o;const i={...r};for(const a of s)if(a)switch(a.type){case"select":i.selected=a.selected;break;case"position":a.position!==void 0&&(i.position=a.position),a.positionAbsolute!==void 0&&(i.positionAbsolute=a.positionAbsolute),a.dragging!==void 0&&(i.dragging=a.dragging),i.expandParent&&a2(o,i);break;case"dimensions":a.dimensions!==void 0&&(i.width=a.dimensions.width,i.height=a.dimensions.height),a.updateStyle!==void 0&&(i.style={...i.style||{},...a.dimensions}),typeof a.resizing=="boolean"&&(i.resizing=a.resizing),i.expandParent&&a2(o,i);break;case"remove":return o}return o.push(i),o},n)}function c2(t,e){return l2(t,e)}const Zo=(t,e)=>({id:t,type:"select",selected:e});function gs(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 Zh=(t,e)=>n=>{n.target===e.current&&(t==null||t(n))},YR=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,dragging:t.paneDragging}),d2=M.memo(({isSelecting:t,selectionMode:e=Di.Full,panOnDrag:n,onSelectionStart:o,onSelectionEnd:r,onPaneClick:s,onPaneContextMenu:i,onPaneScroll:a,onPaneMouseEnter:l,onPaneMouseMove:c,onPaneMouseLeave:u,children:h})=>{const f=M.useRef(null),p=Vt(),_=M.useRef(0),g=M.useRef(0),m=M.useRef(),{userSelectionActive:b,elementsSelectable:y,dragging:x}=pt(YR,Qt),v=()=>{p.setState({userSelectionActive:!1,userSelectionRect:null}),_.current=0,g.current=0},C=N=>{s==null||s(N),p.getState().resetSelectedElements(),p.setState({nodesSelectionActive:!1})},k=a?N=>a(N):void 0,j=y&&(t||b);return K.createElement("div",{className:ln(["react-flow__pane",{dragging:x,selection:t}]),onClick:j?void 0:Zh(C,f),onContextMenu:Zh(N=>{Array.isArray(n)&&(n!=null&&n.includes(2))?N.preventDefault():i==null||i(N)},f),onWheel:Zh(k,f),onMouseEnter:j?void 0:l,onMouseDown:j?N=>{const{resetSelectedElements:I,domNode:A}=p.getState();if(m.current=A==null?void 0:A.getBoundingClientRect(),!y||!t||N.button!==0||N.target!==f.current||!m.current)return;const{x:T,y:R}=Yo(N,m.current);I(),p.setState({userSelectionRect:{width:0,height:0,startX:T,startY:R,x:T,y:R}}),o==null||o(N)}:void 0,onMouseMove:j?N=>{const{userSelectionRect:I,nodeInternals:A,edges:T,transform:R,onNodesChange:z,onEdgesChange:D,nodeOrigin:F,getNodes:B}=p.getState();if(!t||!m.current||!I)return;p.setState({userSelectionActive:!0,nodesSelectionActive:!1});const U=Yo(N,m.current),O=I.startX??0,S=I.startY??0,$={...I,x:U.x<O?U.x:O,y:U.y<S?U.y:S,width:Math.abs(U.x-O),height:Math.abs(U.y-S)},E=B(),W=Pv(A,$,R,e===Di.Partial,!0,F),G=Lv(W,T).map(Y=>Y.id),q=W.map(Y=>Y.id);if(_.current!==q.length){_.current=q.length;const Y=gs(E,q);Y.length&&(z==null||z(Y))}if(g.current!==G.length){g.current=G.length;const Y=gs(T,G);Y.length&&(D==null||D(Y))}p.setState({userSelectionRect:$})}:c,onMouseUp:j?N=>{if(N.button!==0)return;const{userSelectionRect:I}=p.getState();!b&&I&&N.target===f.current&&(C==null||C(N)),p.setState({nodesSelectionActive:_.current>0}),v(),r==null||r(N)}:void 0,onMouseLeave:j?N=>{b&&(p.setState({nodesSelectionActive:_.current>0}),r==null||r(N)),v()}:u,ref:f,style:Xh},h,K.createElement(GR,null))});function u2(t,e){const n=t.parentNode||t.parentId;if(!n)return!1;const o=e.get(n);return!!o&&(!!o.selected||u2(o,e))}function h2(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 JR(t,e,n,o){return Array.from(t.values()).filter(r=>(r.selected||r.id===o)&&(!r.parentNode||r.parentId||!u2(r,t))&&(r.draggable||e&&r.draggable===void 0)).map(r=>{var s,i;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-(((i=r.positionAbsolute)==null?void 0:i.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 f2(t,e,n,o,r=[0,0],s){const i=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 a=i;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:p}=hs(h,r).positionAbsolute;a=[[t.extent[0][0]+f,t.extent[0][1]+p],[t.extent[1][0]+f,t.extent[1][1]+p]]}}else if(l&&t.width&&t.height){const h=n.get(l),{x:f,y:p}=hs(h,r).positionAbsolute;a=h&&On(f)&&On(p)&&On(h.width)&&On(h.height)?[[f+t.width*r[0],p+t.height*r[1]],[f+h.width-t.width+t.width*r[0],p+h.height-t.height+t.height*r[1]]]:a}else s==null||s("005",pR()),a=i;let c={x:0,y:0};if(l){const h=n.get(l);c=hs(h,r).positionAbsolute}const u=a&&a!=="parent"?Oh(e,a):e;return{position:{x:u.x-c.x,y:u.y-c.y},positionAbsolute:u}}function Qh({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]}d2.displayName="Pane";const p2=(t,e,n,o)=>{const r=e.querySelectorAll(t);if(!r||!r.length)return null;const s=Array.from(r),i=e.getBoundingClientRect(),a=i.width*o[0],l=i.height*o[1];return s.map(c=>{const u=c.getBoundingClientRect();return{id:c.getAttribute("data-handleid"),position:c.getAttribute("data-handlepos"),x:(u.left-i.left-a)/n,y:(u.top-i.top-l)/n,...Mh(c)}})};function Fi(t,e,n){return n===void 0?n:o=>{const r=e().nodeInternals.get(t);r&&n(o,{...r})}}function ef({id:t,store:e,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:s,multiSelectionActive:i,nodeInternals:a,onError:l}=e.getState(),c=a.get(t);c?(e.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&i)&&(s({nodes:[c],edges:[]}),requestAnimationFrame(()=>{var u;return(u=o==null?void 0:o.current)==null?void 0:u.blur()})):r([t])):l==null||l("012",yR(t))}function tf(t){return(e,n,o)=>t==null?void 0:t(e,o)}function m2({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:s,selectNodesOnDrag:i}){const a=Vt(),[l,c]=M.useState(!1),u=M.useRef([]),h=M.useRef({x:null,y:null}),f=M.useRef(0),p=M.useRef(null),_=M.useRef({x:0,y:0}),g=M.useRef(null),m=M.useRef(!1),b=M.useRef(!1),y=M.useRef(!1),x=function(){const v=Vt();return M.useCallback(({sourceEvent:k})=>{const{transform:j,snapGrid:N,snapToGrid:I}=v.getState(),A=k.touches?k.touches[0].clientX:k.clientX,T=k.touches?k.touches[0].clientY:k.clientY,R={x:(A-j[0])/j[2],y:(T-j[1])/j[2]};return{xSnapped:I?N[0]*Math.round(R.x/N[0]):R.x,ySnapped:I?N[1]*Math.round(R.y/N[1]):R.y,...R}},[])}();return M.useEffect(()=>{if(t!=null&&t.current){const v=Kn(t.current),C=({x:N,y:I})=>{const{nodeInternals:A,onNodeDrag:T,onSelectionDrag:R,updateNodePositions:z,nodeExtent:D,snapGrid:F,snapToGrid:B,nodeOrigin:U,onError:O}=a.getState();h.current={x:N,y:I};let S=!1,$={x:0,y:0,x2:0,y2:0};if(u.current.length>1&&D){const W=Wh(u.current,U);$=Dh(W)}if(u.current=u.current.map(W=>{const G={x:N-W.distance.x,y:I-W.distance.y};B&&(G.x=F[0]*Math.round(G.x/F[0]),G.y=F[1]*Math.round(G.y/F[1]));const q=[[D[0][0],D[0][1]],[D[1][0],D[1][1]]];u.current.length>1&&D&&!W.extent&&(q[0][0]=W.positionAbsolute.x-$.x+D[0][0],q[1][0]=W.positionAbsolute.x+(W.width??0)-$.x2+D[1][0],q[0][1]=W.positionAbsolute.y-$.y+D[0][1],q[1][1]=W.positionAbsolute.y+(W.height??0)-$.y2+D[1][1]);const Y=f2(W,G,A,q,U,O);return S=S||W.position.x!==Y.position.x||W.position.y!==Y.position.y,W.position=Y.position,W.positionAbsolute=Y.positionAbsolute,W}),!S)return;z(u.current,!0,!0),c(!0);const E=r?T:tf(R);if(E&&g.current){const[W,G]=Qh({nodeId:r,dragItems:u.current,nodeInternals:A});E(g.current,W,G)}},k=()=>{if(!p.current)return;const[N,I]=yv(_.current,p.current);if(N!==0||I!==0){const{transform:A,panBy:T}=a.getState();h.current.x=(h.current.x??0)-N/A[2],h.current.y=(h.current.y??0)-I/A[2],T({x:N,y:I})&&C(h.current)}f.current=requestAnimationFrame(k)},j=N=>{var U;const{nodeInternals:I,multiSelectionActive:A,nodesDraggable:T,unselectNodesAndEdges:R,onNodeDragStart:z,onSelectionDragStart:D}=a.getState();b.current=!0;const F=r?z:tf(D);i&&s||A||!r||(U=I.get(r))!=null&&U.selected||R(),r&&s&&i&&ef({id:r,store:a,nodeRef:t});const B=x(N);if(h.current=B,u.current=JR(I,T,B,r),F&&u.current){const[O,S]=Qh({nodeId:r,dragItems:u.current,nodeInternals:I});F(N.sourceEvent,O,S)}};if(!e){const N=function(){var I,A,T,R,z=tR,D=nR,F=oR,B=rR,U={},O=US("start","drag","end"),S=0,$=0;function E(Z){Z.on("mousedown.drag",W).filter(B).on("touchstart.drag",Y).on("touchmove.drag",Q,eR).on("touchend.drag touchcancel.drag",re).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function W(Z,te){if(!R&&z.call(this,Z,te)){var ue=ae(this,D.call(this,Z,te),Z,te,"mouse");ue&&(Kn(Z.view).on("mousemove.drag",G,Ai).on("mouseup.drag",q,Ai),pv(Z.view),Ih(Z),T=!1,I=Z.clientX,A=Z.clientY,ue("start",Z))}}function G(Z){if(cs(Z),!T){var te=Z.clientX-I,ue=Z.clientY-A;T=te*te+ue*ue>$}U.mouse("drag",Z)}function q(Z){Kn(Z.view).on("mousemove.drag mouseup.drag",null),mv(Z.view,T),cs(Z),U.mouse("end",Z)}function Y(Z,te){if(z.call(this,Z,te)){var ue,me,de=Z.changedTouches,fe=D.call(this,Z,te),he=de.length;for(ue=0;ue<he;++ue)(me=ae(this,fe,Z,te,de[ue].identifier,de[ue]))&&(Ih(Z),me("start",Z,de[ue]))}}function Q(Z){var te,ue,me=Z.changedTouches,de=me.length;for(te=0;te<de;++te)(ue=U[me[te].identifier])&&(cs(Z),ue("drag",Z,me[te]))}function re(Z){var te,ue,me=Z.changedTouches,de=me.length;for(R&&clearTimeout(R),R=setTimeout(function(){R=null},500),te=0;te<de;++te)(ue=U[me[te].identifier])&&(Ih(Z),ue("end",Z,me[te]))}function ae(Z,te,ue,me,de,fe){var he,Ce,Ee,ie=O.copy(),Me=so(fe||ue,te);if((Ee=F.call(Z,new Ah("beforestart",{sourceEvent:ue,target:E,identifier:de,active:S,x:Me[0],y:Me[1],dx:0,dy:0,dispatch:ie}),me))!=null)return he=Ee.x-Me[0]||0,Ce=Ee.y-Me[1]||0,function xe(Re,Ue,Je){var Ke,Pe=Me;switch(Re){case"start":U[de]=xe,Ke=S++;break;case"end":delete U[de],--S;case"drag":Me=so(Je||Ue,te),Ke=S}ie.call(Re,Z,new Ah(Re,{sourceEvent:Ue,subject:Ee,target:E,identifier:de,active:Ke,x:Me[0]+he,y:Me[1]+Ce,dx:Me[0]-Pe[0],dy:Me[1]-Pe[1],dispatch:ie}),me)}}return E.filter=function(Z){return arguments.length?(z=typeof Z=="function"?Z:Al(!!Z),E):z},E.container=function(Z){return arguments.length?(D=typeof Z=="function"?Z:Al(Z),E):D},E.subject=function(Z){return arguments.length?(F=typeof Z=="function"?Z:Al(Z),E):F},E.touchable=function(Z){return arguments.length?(B=typeof Z=="function"?Z:Al(!!Z),E):B},E.on=function(){var Z=O.on.apply(O,arguments);return Z===O?E:Z},E.clickDistance=function(Z){return arguments.length?($=(Z=+Z)*Z,E):Math.sqrt($)},E}().on("start",I=>{const{domNode:A,nodeDragThreshold:T}=a.getState();T===0&&j(I),y.current=!1;const R=x(I);h.current=R,p.current=(A==null?void 0:A.getBoundingClientRect())||null,_.current=Yo(I.sourceEvent,p.current)}).on("drag",I=>{var z,D;const A=x(I),{autoPanOnNodeDrag:T,nodeDragThreshold:R}=a.getState();if(I.sourceEvent.type==="touchmove"&&I.sourceEvent.touches.length>1&&(y.current=!0),!y.current){if(!m.current&&b.current&&T&&(m.current=!0,k()),!b.current){const F=A.xSnapped-(((z=h==null?void 0:h.current)==null?void 0:z.x)??0),B=A.ySnapped-(((D=h==null?void 0:h.current)==null?void 0:D.y)??0);Math.sqrt(F*F+B*B)>R&&j(I)}(h.current.x!==A.xSnapped||h.current.y!==A.ySnapped)&&u.current&&b.current&&(g.current=I.sourceEvent,_.current=Yo(I.sourceEvent,p.current),C(A))}}).on("end",I=>{if(b.current&&!y.current&&(c(!1),m.current=!1,b.current=!1,cancelAnimationFrame(f.current),u.current)){const{updateNodePositions:A,nodeInternals:T,onNodeDragStop:R,onSelectionDragStop:z}=a.getState(),D=r?R:tf(z);if(A(u.current,!1,!1),D){const[F,B]=Qh({nodeId:r,dragItems:u.current,nodeInternals:T});D(I.sourceEvent,F,B)}}}).filter(I=>{const A=I.target;return!I.button&&(!n||!h2(A,`.${n}`,t))&&(!o||h2(A,o,t))});return v.call(N),()=>{v.on(".drag",null)}}v.on(".drag",null)}},[t,e,n,o,s,a,r,i,x]),l}function g2(){const t=Vt();return M.useCallback(n=>{const{nodeInternals:o,nodeExtent:r,updateNodePositions:s,getNodes:i,snapToGrid:a,snapGrid:l,onError:c,nodesDraggable:u}=t.getState(),h=i().filter(y=>y.selected&&(y.draggable||u&&y.draggable===void 0)),f=a?l[0]:5,p=a?l[1]:5,_=n.isShiftPressed?4:1,g=n.x*f*_,m=n.y*p*_,b=h.map(y=>{if(y.positionAbsolute){const x={x:y.positionAbsolute.x+g,y:y.positionAbsolute.y+m};a&&(x.x=l[0]*Math.round(x.x/l[0]),x.y=l[1]*Math.round(x.y/l[1]));const{positionAbsolute:v,position:C}=f2(y,x,o,r,void 0,c);y.position=C,y.positionAbsolute=v}return y});s(b,!0,!1)},[])}const _s={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var zi=t=>{const e=({id:n,type:o,data:r,xPos:s,yPos:i,xPosOrigin:a,yPosOrigin:l,selected:c,onClick:u,onMouseEnter:h,onMouseMove:f,onMouseLeave:p,onContextMenu:_,onDoubleClick:g,style:m,className:b,isDraggable:y,isSelectable:x,isConnectable:v,isFocusable:C,selectNodesOnDrag:k,sourcePosition:j,targetPosition:N,hidden:I,resizeObserver:A,dragHandle:T,zIndex:R,isParent:z,noDragClassName:D,noPanClassName:F,initialized:B,disableKeyboardA11y:U,ariaLabel:O,rfId:S,hasHandleBounds:$})=>{const E=Vt(),W=M.useRef(null),G=M.useRef(null),q=M.useRef(j),Y=M.useRef(N),Q=M.useRef(o),re=x||y||u||h||f||p,ae=g2(),Z=Fi(n,E.getState,h),te=Fi(n,E.getState,f),ue=Fi(n,E.getState,p),me=Fi(n,E.getState,_),de=Fi(n,E.getState,g);M.useEffect(()=>()=>{G.current&&(A==null||A.unobserve(G.current),G.current=null)},[]),M.useEffect(()=>{if(W.current&&!I){const he=W.current;B&&$&&G.current===he||(G.current&&(A==null||A.unobserve(G.current)),A==null||A.observe(he),G.current=he)}},[I,B,$]),M.useEffect(()=>{const he=Q.current!==o,Ce=q.current!==j,Ee=Y.current!==N;W.current&&(he||Ce||Ee)&&(he&&(Q.current=o),Ce&&(q.current=j),Ee&&(Y.current=N),E.getState().updateNodeDimensions([{id:n,nodeElement:W.current,forceUpdate:!0}]))},[n,o,j,N]);const fe=m2({nodeRef:W,disabled:I||!y,noDragClassName:D,handleSelector:T,nodeId:n,isSelectable:x,selectNodesOnDrag:k});return I?null:K.createElement("div",{className:ln(["react-flow__node",`react-flow__node-${o}`,{[F]:y},b,{selected:c,selectable:x,parent:z,dragging:fe}]),ref:W,style:{zIndex:R,transform:`translate(${a}px,${l}px)`,pointerEvents:re?"all":"none",visibility:B?"visible":"hidden",...m},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:Z,onMouseMove:te,onMouseLeave:ue,onContextMenu:me,onClick:he=>{const{nodeDragThreshold:Ce}=E.getState();if(x&&(!k||!y||Ce>0)&&ef({id:n,store:E,nodeRef:W}),u){const Ee=E.getState().nodeInternals.get(n);Ee&&u(he,{...Ee})}},onDoubleClick:de,onKeyDown:C?he=>{if(!Ph(he)&&!U)if(vv.includes(he.key)&&x){const Ce=he.key==="Escape";ef({id:n,store:E,unselect:Ce,nodeRef:W})}else y&&c&&Object.prototype.hasOwnProperty.call(_s,he.key)&&(E.setState({ariaLiveMessage:`Moved selected node ${he.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~s}, y: ${~~i}`}),ae({x:_s[he.key].x,y:_s[he.key].y,isShiftPressed:he.shiftKey}))}:void 0,tabIndex:C?0:void 0,role:C?"button":void 0,"aria-describedby":U?void 0:`${Zv}-${S}`,"aria-label":O},K.createElement(SR,{value:n},K.createElement(t,{id:n,data:r,type:o,xPos:s,yPos:i,selected:c,isConnectable:v,sourcePosition:j,targetPosition:N,dragging:fe,dragHandle:T,zIndex:R})))};return e.displayName="NodeWrapper",M.memo(e)};const KR=t=>{const e=t.getNodes().filter(n=>n.selected);return{...Wh(e,t.nodeOrigin),transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`,userSelectionActive:t.userSelectionActive}};var XR=M.memo(function({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const o=Vt(),{width:r,height:s,x:i,y:a,transformString:l,userSelectionActive:c}=pt(KR,Qt),u=g2(),h=M.useRef(null);if(M.useEffect(()=>{var p;n||((p=h.current)==null||p.focus({preventScroll:!0}))},[n]),m2({nodeRef:h}),c||!r||!s)return null;const f=t?p=>{const _=o.getState().getNodes().filter(g=>g.selected);t(p,_)}:void 0;return K.createElement("div",{className:ln(["react-flow__nodesselection","react-flow__container",e]),style:{transform:l}},K.createElement("div",{ref:h,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:p=>{Object.prototype.hasOwnProperty.call(_s,p.key)&&u({x:_s[p.key].x,y:_s[p.key].y,isShiftPressed:p.shiftKey})},style:{width:r,height:s,top:a,left:i}}))});const ZR=t=>t.nodesSelectionActive,_2=({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:i,deleteKeyCode:a,onMove:l,onMoveStart:c,onMoveEnd:u,selectionKeyCode:h,selectionOnDrag:f,selectionMode:p,onSelectionStart:_,onSelectionEnd:g,multiSelectionKeyCode:m,panActivationKeyCode:b,zoomActivationKeyCode:y,elementsSelectable:x,zoomOnScroll:v,zoomOnPinch:C,panOnScroll:k,panOnScrollSpeed:j,panOnScrollMode:N,zoomOnDoubleClick:I,panOnDrag:A,defaultViewport:T,translateExtent:R,minZoom:z,maxZoom:D,preventScrolling:F,onSelectionContextMenu:B,noWheelClassName:U,noPanClassName:O,disableKeyboardA11y:S})=>{const $=pt(ZR),E=Pi(h),W=Pi(b),G=W||A,q=W||k,Y=E||f&&G!==!0;return(({deleteKeyCode:Q,multiSelectionKeyCode:re})=>{const ae=Vt(),{deleteElements:Z}=Li(),te=Pi(Q,$R),ue=Pi(re);M.useEffect(()=>{if(te){const{edges:me,getNodes:de}=ae.getState(),fe=de().filter(Ce=>Ce.selected),he=me.filter(Ce=>Ce.selected);Z({nodes:fe,edges:he}),ae.setState({nodesSelectionActive:!1})}},[te]),M.useEffect(()=>{ae.setState({multiSelectionActive:ue})},[ue])})({deleteKeyCode:a,multiSelectionKeyCode:m}),K.createElement(WR,{onMove:l,onMoveStart:c,onMoveEnd:u,onPaneContextMenu:s,elementsSelectable:x,zoomOnScroll:v,zoomOnPinch:C,panOnScroll:q,panOnScrollSpeed:j,panOnScrollMode:N,zoomOnDoubleClick:I,panOnDrag:!E&&G,defaultViewport:T,translateExtent:R,minZoom:z,maxZoom:D,zoomActivationKeyCode:y,preventScrolling:F,noWheelClassName:U,noPanClassName:O},K.createElement(d2,{onSelectionStart:_,onSelectionEnd:g,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:i,panOnDrag:G,isSelecting:!!Y,selectionMode:p},t,$&&K.createElement(XR,{onSelectionContextMenu:B,noPanClassName:O,disableKeyboardA11y:S})))};_2.displayName="FlowRenderer";var QR=M.memo(_2);function eP(t){return{input:zi(t.input||Gv),default:zi(t.default||Yh),output:zi(t.output||Jv),group:zi(t.group||Jh),...Object.keys(t).filter(e=>!["input","default","output","group"].includes(e)).reduce((e,n)=>(e[n]=zi(t[n]||Yh),e),{})}}const tP=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,updateNodeDimensions:t.updateNodeDimensions,onError:t.onError}),b2=t=>{const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,updateNodeDimensions:s,onError:i}=pt(tP,Qt),a=(l=t.onlyRenderVisibleElements,pt(M.useCallback(h=>l?Pv(h.nodeInternals,{x:0,y:0,width:h.width,height:h.height},h.transform,!0):h.getNodes(),[l])));var l;const c=M.useRef(),u=M.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const h=new ResizeObserver(f=>{const p=f.map(_=>({id:_.target.getAttribute("data-id"),nodeElement:_.target,forceUpdate:!0}));s(p)});return c.current=h,h},[]);return M.useEffect(()=>()=>{var h;(h=c==null?void 0:c.current)==null||h.disconnect()},[]),K.createElement("div",{className:"react-flow__nodes",style:Xh},a.map(h=>{var k,j,N;let f=h.type||"default";t.nodeTypes[f]||(i==null||i("003",hR(f)),f="default");const p=t.nodeTypes[f]||t.nodeTypes.default,_=!!(h.draggable||e&&h.draggable===void 0),g=!!(h.selectable||r&&h.selectable===void 0),m=!!(h.connectable||n&&h.connectable===void 0),b=!!(h.focusable||o&&h.focusable===void 0),y=t.nodeExtent?Oh(h.positionAbsolute,t.nodeExtent):h.positionAbsolute,x=(y==null?void 0:y.x)??0,v=(y==null?void 0:y.y)??0,C=(({x:I,y:A,width:T,height:R,origin:z})=>T&&R?z[0]<0||z[1]<0||z[0]>1||z[1]>1?{x:I,y:A}:{x:I-T*z[0],y:A-R*z[1]}:{x:I,y:A})({x,y:v,width:h.width??0,height:h.height??0,origin:t.nodeOrigin});return K.createElement(p,{key:h.id,id:h.id,className:h.className,style:h.style,type:f,data:h.data,sourcePosition:h.sourcePosition||ze.Bottom,targetPosition:h.targetPosition||ze.Top,hidden:h.hidden,xPos:x,yPos:v,xPosOrigin:C.x,yPosOrigin:C.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:_,isSelectable:g,isConnectable:m,isFocusable:b,resizeObserver:u,dragHandle:h.dragHandle,zIndex:((k=h[vt])==null?void 0:k.z)??0,isParent:!!((j=h[vt])!=null&&j.isParent),noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,initialized:!!h.width&&!!h.height,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,ariaLabel:h.ariaLabel,hasHandleBounds:!!((N=h[vt])!=null&&N.handleBounds)})}))};b2.displayName="NodeRenderer";var nP=M.memo(b2);const oP=(t,e,n)=>n===ze.Left?t-e:n===ze.Right?t+e:t,rP=(t,e,n)=>n===ze.Top?t-e:n===ze.Bottom?t+e:t,y2="react-flow__edgeupdater",x2=({position:t,centerX:e,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:s,onMouseOut:i,type:a})=>K.createElement("circle",{onMouseDown:r,onMouseEnter:s,onMouseOut:i,className:ln([y2,`${y2}-${a}`]),cx:oP(e,o,t),cy:rP(n,o,t),r:o,stroke:"transparent",fill:"transparent"}),sP=()=>!0;var bs=t=>{const e=({id:n,className:o,type:r,data:s,onClick:i,onEdgeDoubleClick:a,selected:l,animated:c,label:u,labelStyle:h,labelShowBg:f,labelBgStyle:p,labelBgPadding:_,labelBgBorderRadius:g,style:m,source:b,target:y,sourceX:x,sourceY:v,targetX:C,targetY:k,sourcePosition:j,targetPosition:N,elementsSelectable:I,hidden:A,sourceHandleId:T,targetHandleId:R,onContextMenu:z,onMouseEnter:D,onMouseMove:F,onMouseLeave:B,reconnectRadius:U,onReconnect:O,onReconnectStart:S,onReconnectEnd:$,markerEnd:E,markerStart:W,rfId:G,ariaLabel:q,isFocusable:Y,isReconnectable:Q,pathOptions:re,interactionWidth:ae,disableKeyboardA11y:Z})=>{const te=M.useRef(null),[ue,me]=M.useState(!1),[de,fe]=M.useState(!1),he=Vt(),Ce=M.useMemo(()=>`url('#${$h(W,G)}')`,[W,G]),Ee=M.useMemo(()=>`url('#${$h(E,G)}')`,[E,G]);if(A)return null;const ie=Oi(n,he.getState,a),Me=Oi(n,he.getState,z),xe=Oi(n,he.getState,D),Re=Oi(n,he.getState,F),Ue=Oi(n,he.getState,B),Je=(et,nt)=>{if(et.button!==0)return;const{edges:ne,isValidConnection:ve}=he.getState(),Se=nt?y:b,De=(nt?R:T)||null,J=nt?"target":"source",ge=ve||sP,_e=nt,pe=ne.find(le=>le.id===n);fe(!0),S==null||S(et,pe,J),Vv({event:et,handleId:De,nodeId:Se,onConnect:le=>O==null?void 0:O(pe,le),isTarget:_e,getState:he.getState,setState:he.setState,isValidConnection:ge,edgeUpdaterType:J,onReconnectEnd:le=>{fe(!1),$==null||$(le,pe,J)}})},Ke=()=>me(!0),Pe=()=>me(!1),st=!I&&!i;return K.createElement("g",{className:ln(["react-flow__edge",`react-flow__edge-${r}`,o,{selected:l,animated:c,inactive:st,updating:ue}]),onClick:et=>{var J;const{edges:nt,addSelectedEdges:ne,unselectNodesAndEdges:ve,multiSelectionActive:Se}=he.getState(),De=nt.find(ge=>ge.id===n);De&&(I&&(he.setState({nodesSelectionActive:!1}),De.selected&&Se?(ve({nodes:[],edges:[De]}),(J=te.current)==null||J.blur()):ne([n])),i&&i(et,De))},onDoubleClick:ie,onContextMenu:Me,onMouseEnter:xe,onMouseMove:Re,onMouseLeave:Ue,onKeyDown:Y?et=>{var nt;if(!Z&&vv.includes(et.key)&&I){const{unselectNodesAndEdges:ne,addSelectedEdges:ve,edges:Se}=he.getState();et.key==="Escape"?((nt=te.current)==null||nt.blur(),ne({edges:[Se.find(De=>De.id===n)]})):ve([n])}}:void 0,tabIndex:Y?0:void 0,role:Y?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":q===null?void 0:q||`Edge from ${b} to ${y}`,"aria-describedby":Y?`${Qv}-${G}`:void 0,ref:te},!de&&K.createElement(t,{id:n,source:b,target:y,selected:l,animated:c,label:u,labelStyle:h,labelShowBg:f,labelBgStyle:p,labelBgPadding:_,labelBgBorderRadius:g,data:s,style:m,sourceX:x,sourceY:v,targetX:C,targetY:k,sourcePosition:j,targetPosition:N,sourceHandleId:T,targetHandleId:R,markerStart:Ce,markerEnd:Ee,pathOptions:re,interactionWidth:ae}),Q&&K.createElement(K.Fragment,null,(Q==="source"||Q===!0)&&K.createElement(x2,{position:j,centerX:x,centerY:v,radius:U,onMouseDown:et=>Je(et,!0),onMouseEnter:Ke,onMouseOut:Pe,type:"source"}),(Q==="target"||Q===!0)&&K.createElement(x2,{position:N,centerX:C,centerY:k,radius:U,onMouseDown:et=>Je(et,!1),onMouseEnter:Ke,onMouseOut:Pe,type:"target"})))};return e.displayName="EdgeWrapper",M.memo(e)};function iP(t){return{default:bs(t.default||Fl),straight:bs(t.bezier||Uh),step:bs(t.step||Bh),smoothstep:bs(t.step||Pl),simplebezier:bs(t.simplebezier||Fh),...Object.keys(t).filter(e=>!["default","bezier"].includes(e)).reduce((e,n)=>(e[n]=bs(t[n]||Fl),e),{})}}function w2(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,i=(n==null?void 0:n.height)||e.height;switch(t){case ze.Top:return{x:o+s/2,y:r};case ze.Right:return{x:o+s,y:r+i/2};case ze.Bottom:return{x:o+s/2,y:r+i};case ze.Left:return{x:o,y:r+i/2}}}function v2(t,e){return t?t.length!==1&&e?e&&t.find(n=>n.id===e)||null:t[0]:null}function k2(t){var o,r,s,i,a;const e=((o=t==null?void 0:t[vt])==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:((i=t==null?void 0:t.positionAbsolute)==null?void 0:i.x)||0,y:((a=t==null?void 0:t.positionAbsolute)==null?void 0:a.y)||0,width:(t==null?void 0:t.width)||0,height:(t==null?void 0:t.height)||0},e,!!n]}const aP=[{level:0,isMaxLevel:!0,edges:[]}];function lP(t,e,n){return function(o,r,s=!1){let i=-1;const a=o.reduce((c,u)=>{var p,_;const h=On(u.zIndex);let f=h?u.zIndex:0;if(s){const g=r.get(u.target),m=r.get(u.source),b=u.selected||(g==null?void 0:g.selected)||(m==null?void 0:m.selected),y=Math.max(((p=m==null?void 0:m[vt])==null?void 0:p.z)||0,((_=g==null?void 0:g[vt])==null?void 0:_.z)||0,1e3);f=(h?u.zIndex:0)+(b?y:0)}return c[f]?c[f].push(u):c[f]=[u],i=f>i?f:i,c},{}),l=Object.entries(a).map(([c,u])=>{const h=+c;return{edges:u,level:h,isMaxLevel:h===i}});return l.length===0?aP:l}(pt(M.useCallback(o=>t?o.edges.filter(r=>{const s=e.get(r.source),i=e.get(r.target);return(s==null?void 0:s.width)&&(s==null?void 0:s.height)&&(i==null?void 0:i.width)&&(i==null?void 0:i.height)&&function({sourcePos:a,targetPos:l,sourceWidth:c,sourceHeight:u,targetWidth:h,targetHeight:f,width:p,height:_,transform:g}){const m={x:Math.min(a.x,l.x),y:Math.min(a.y,l.y),x2:Math.max(a.x+c,l.x+h),y2:Math.max(a.y+u,l.y+f)};m.x===m.x2&&(m.x2+=1),m.y===m.y2&&(m.y2+=1);const b=Dh({x:(0-g[0])/g[2],y:(0-g[1])/g[2],width:p/g[2],height:_/g[2]}),y=Math.max(0,Math.min(b.x2,m.x2)-Math.max(b.x,m.x)),x=Math.max(0,Math.min(b.y2,m.y2)-Math.max(b.y,m.y));return Math.ceil(y*x)>0}({sourcePos:s.positionAbsolute||{x:0,y:0},targetPos:i.positionAbsolute||{x:0,y:0},sourceWidth:s.width,sourceHeight:s.height,targetWidth:i.width,targetHeight:i.height,width:o.width,height:o.height,transform:o.transform})}):o.edges,[t,e])),e,n)}const S2={[us.Arrow]:({color:t="none",strokeWidth:e=1})=>K.createElement("polyline",{style:{stroke:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),[us.ArrowClosed]:({color:t="none",strokeWidth:e=1})=>K.createElement("polyline",{style:{stroke:t,fill:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},cP=({id:t,type:e,color:n,width:o=12.5,height:r=12.5,markerUnits:s="strokeWidth",strokeWidth:i,orient:a="auto-start-reverse"})=>{const l=function(c){const u=Vt();return M.useMemo(()=>{var h,f;return Object.prototype.hasOwnProperty.call(S2,c)?S2[c]:((f=(h=u.getState()).onError)==null||f.call(h,"009",mR(c)),null)},[c])}(e);return l?K.createElement("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${o}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:a,refX:"0",refY:"0"},K.createElement(l,{color:n,strokeWidth:i})):null},C2=({defaultColor:t,rfId:e})=>{const n=pt(M.useCallback((({defaultColor:o,rfId:r})=>s=>{const i=[];return s.edges.reduce((a,l)=>([l.markerStart,l.markerEnd].forEach(c=>{if(c&&typeof c=="object"){const u=$h(c,r);i.includes(u)||(a.push({id:u,color:c.color||o,...c}),i.push(u))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))})({defaultColor:t,rfId:e}),[t,e]),(o,r)=>!(o.length!==r.length||o.some((s,i)=>s.id!==r[i].id)));return K.createElement("defs",null,n.map(o=>K.createElement(cP,{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})))};C2.displayName="MarkerDefinitions";var dP=M.memo(C2);const uP=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}),N2=({defaultMarkerColor:t,onlyRenderVisibleElements:e,elevateEdgesOnSelect:n,rfId:o,edgeTypes:r,noPanClassName:s,onEdgeContextMenu:i,onEdgeMouseEnter:a,onEdgeMouseMove:l,onEdgeMouseLeave:c,onEdgeClick:u,onEdgeDoubleClick:h,onReconnect:f,onReconnectStart:p,onReconnectEnd:_,reconnectRadius:g,children:m,disableKeyboardA11y:b})=>{const{edgesFocusable:y,edgesUpdatable:x,elementsSelectable:v,width:C,height:k,connectionMode:j,nodeInternals:N,onError:I}=pt(uP,Qt),A=lP(e,N,n);return C?K.createElement(K.Fragment,null,A.map(({level:T,edges:R,isMaxLevel:z})=>K.createElement("svg",{key:T,style:{zIndex:T},width:C,height:k,className:"react-flow__edges react-flow__container"},z&&K.createElement(dP,{defaultColor:t,rfId:o}),K.createElement("g",null,R.map(D=>{const[F,B,U]=k2(N.get(D.source)),[O,S,$]=k2(N.get(D.target));if(!U||!$)return null;let E=D.type||"default";r[E]||(I==null||I("011",bR(E)),E="default");const W=r[E]||r.default,G=j===Cr.Strict?S.target:(S.target??[]).concat(S.source??[]),q=v2(B.source,D.sourceHandle),Y=v2(G,D.targetHandle),Q=(q==null?void 0:q.position)||ze.Bottom,re=(Y==null?void 0:Y.position)||ze.Top,ae=!!(D.focusable||y&&D.focusable===void 0),Z=D.reconnectable||D.updatable,te=f!==void 0&&(Z||x&&Z===void 0);if(!q||!Y)return I==null||I("008",gR(q,D)),null;const{sourceX:ue,sourceY:me,targetX:de,targetY:fe}=((he,Ce,Ee,ie,Me,xe)=>{const Re=w2(Ee,he,Ce),Ue=w2(xe,ie,Me);return{sourceX:Re.x,sourceY:Re.y,targetX:Ue.x,targetY:Ue.y}})(F,q,Q,O,Y,re);return K.createElement(W,{key:D.id,id:D.id,className:ln([D.className,s]),type:E,data:D.data,selected:!!D.selected,animated:!!D.animated,hidden:!!D.hidden,label:D.label,labelStyle:D.labelStyle,labelShowBg:D.labelShowBg,labelBgStyle:D.labelBgStyle,labelBgPadding:D.labelBgPadding,labelBgBorderRadius:D.labelBgBorderRadius,style:D.style,source:D.source,target:D.target,sourceHandleId:D.sourceHandle,targetHandleId:D.targetHandle,markerEnd:D.markerEnd,markerStart:D.markerStart,sourceX:ue,sourceY:me,targetX:de,targetY:fe,sourcePosition:Q,targetPosition:re,elementsSelectable:v,onContextMenu:i,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,onClick:u,onEdgeDoubleClick:h,onReconnect:f,onReconnectStart:p,onReconnectEnd:_,reconnectRadius:g,rfId:o,ariaLabel:D.ariaLabel,isFocusable:ae,isReconnectable:te,pathOptions:"pathOptions"in D?D.pathOptions:void 0,interactionWidth:D.interactionWidth,disableKeyboardA11y:b})})))),m):null};N2.displayName="EdgeRenderer";var hP=M.memo(N2);const fP=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function pP({children:t}){const e=pt(fP);return K.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:e}},t)}const mP={[ze.Left]:ze.Right,[ze.Right]:ze.Left,[ze.Top]:ze.Bottom,[ze.Bottom]:ze.Top},j2=({nodeId:t,handleType:e,style:n,type:o=Ko.Bezier,CustomComponent:r,connectionStatus:s})=>{var k,j,N;const{fromNode:i,handleId:a,toX:l,toY:c,connectionMode:u}=pt(M.useCallback(I=>({fromNode:I.nodeInternals.get(t),handleId:I.connectionHandleId,toX:(I.connectionPosition.x-I.transform[0])/I.transform[2],toY:(I.connectionPosition.y-I.transform[1])/I.transform[2],connectionMode:I.connectionMode}),[t]),Qt),h=(k=i==null?void 0:i[vt])==null?void 0:k.handleBounds;let f=h==null?void 0:h[e];if(u===Cr.Loose&&(f=f||(h==null?void 0:h[e==="source"?"target":"source"])),!i||!f)return null;const p=a?f.find(I=>I.id===a):f[0],_=p?p.x+p.width/2:(i.width??0)/2,g=p?p.y+p.height/2:i.height??0,m=(((j=i.positionAbsolute)==null?void 0:j.x)??0)+_,b=(((N=i.positionAbsolute)==null?void 0:N.y)??0)+g,y=p==null?void 0:p.position,x=y?mP[y]:null;if(!y||!x)return null;if(r)return K.createElement(r,{connectionLineType:o,connectionLineStyle:n,fromNode:i,fromHandle:p,fromX:m,fromY:b,toX:l,toY:c,fromPosition:y,toPosition:x,connectionStatus:s});let v="";const C={sourceX:m,sourceY:b,sourcePosition:y,targetX:l,targetY:c,targetPosition:x};return o===Ko.Bezier?[v]=Dv(C):o===Ko.Step?[v]=zh({...C,borderRadius:0}):o===Ko.SmoothStep?[v]=zh(C):o===Ko.SimpleBezier?[v]=Av(C):v=`M${m},${b} ${l},${c}`,K.createElement("path",{d:v,fill:"none",className:"react-flow__connection-path",style:n})};j2.displayName="ConnectionLine";const gP=t=>({nodeId:t.connectionNodeId,handleType:t.connectionHandleType,nodesConnectable:t.nodesConnectable,connectionStatus:t.connectionStatus,width:t.width,height:t.height});function _P({containerStyle:t,style:e,type:n,component:o}){const{nodeId:r,handleType:s,nodesConnectable:i,width:a,height:l,connectionStatus:c}=pt(gP,Qt);return r&&s&&a&&i?K.createElement("svg",{style:t,width:a,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container"},K.createElement("g",{className:ln(["react-flow__connection",c])},K.createElement(j2,{nodeId:r,handleType:s,style:e,type:n,CustomComponent:o,connectionStatus:c}))):null}function E2(t,e){return M.useRef(null),Vt(),M.useMemo(()=>e(t),[t])}const I2=({nodeTypes:t,edgeTypes:e,onMove:n,onMoveStart:o,onMoveEnd:r,onInit:s,onNodeClick:i,onEdgeClick:a,onNodeDoubleClick:l,onEdgeDoubleClick:c,onNodeMouseEnter:u,onNodeMouseMove:h,onNodeMouseLeave:f,onNodeContextMenu:p,onSelectionContextMenu:_,onSelectionStart:g,onSelectionEnd:m,connectionLineType:b,connectionLineStyle:y,connectionLineComponent:x,connectionLineContainerStyle:v,selectionKeyCode:C,selectionOnDrag:k,selectionMode:j,multiSelectionKeyCode:N,panActivationKeyCode:I,zoomActivationKeyCode:A,deleteKeyCode:T,onlyRenderVisibleElements:R,elementsSelectable:z,selectNodesOnDrag:D,defaultViewport:F,translateExtent:B,minZoom:U,maxZoom:O,preventScrolling:S,defaultMarkerColor:$,zoomOnScroll:E,zoomOnPinch:W,panOnScroll:G,panOnScrollSpeed:q,panOnScrollMode:Y,zoomOnDoubleClick:Q,panOnDrag:re,onPaneClick:ae,onPaneMouseEnter:Z,onPaneMouseMove:te,onPaneMouseLeave:ue,onPaneScroll:me,onPaneContextMenu:de,onEdgeContextMenu:fe,onEdgeMouseEnter:he,onEdgeMouseMove:Ce,onEdgeMouseLeave:Ee,onReconnect:ie,onReconnectStart:Me,onReconnectEnd:xe,reconnectRadius:Re,noDragClassName:Ue,noWheelClassName:Je,noPanClassName:Ke,elevateEdgesOnSelect:Pe,disableKeyboardA11y:st,nodeOrigin:et,nodeExtent:nt,rfId:ne})=>{const ve=E2(t,eP),Se=E2(e,iP);return function(De){const J=Li(),ge=M.useRef(!1);M.useEffect(()=>{!ge.current&&J.viewportInitialized&&De&&(setTimeout(()=>De(J),1),ge.current=!0)},[De,J.viewportInitialized])}(s),K.createElement(QR,{onPaneClick:ae,onPaneMouseEnter:Z,onPaneMouseMove:te,onPaneMouseLeave:ue,onPaneContextMenu:de,onPaneScroll:me,deleteKeyCode:T,selectionKeyCode:C,selectionOnDrag:k,selectionMode:j,onSelectionStart:g,onSelectionEnd:m,multiSelectionKeyCode:N,panActivationKeyCode:I,zoomActivationKeyCode:A,elementsSelectable:z,onMove:n,onMoveStart:o,onMoveEnd:r,zoomOnScroll:E,zoomOnPinch:W,zoomOnDoubleClick:Q,panOnScroll:G,panOnScrollSpeed:q,panOnScrollMode:Y,panOnDrag:re,defaultViewport:F,translateExtent:B,minZoom:U,maxZoom:O,onSelectionContextMenu:_,preventScrolling:S,noDragClassName:Ue,noWheelClassName:Je,noPanClassName:Ke,disableKeyboardA11y:st},K.createElement(pP,null,K.createElement(hP,{edgeTypes:Se,onEdgeClick:a,onEdgeDoubleClick:c,onlyRenderVisibleElements:R,onEdgeContextMenu:fe,onEdgeMouseEnter:he,onEdgeMouseMove:Ce,onEdgeMouseLeave:Ee,onReconnect:ie,onReconnectStart:Me,onReconnectEnd:xe,reconnectRadius:Re,defaultMarkerColor:$,noPanClassName:Ke,elevateEdgesOnSelect:!!Pe,disableKeyboardA11y:st,rfId:ne},K.createElement(_P,{style:y,type:b,component:x,containerStyle:v})),K.createElement("div",{className:"react-flow__edgelabel-renderer"}),K.createElement(nP,{nodeTypes:ve,onNodeClick:i,onNodeDoubleClick:l,onNodeMouseEnter:u,onNodeMouseMove:h,onNodeMouseLeave:f,onNodeContextMenu:p,selectNodesOnDrag:D,onlyRenderVisibleElements:R,noPanClassName:Ke,noDragClassName:Ue,disableKeyboardA11y:st,nodeOrigin:et,nodeExtent:nt,rfId:ne})))};I2.displayName="GraphView";var bP=M.memo(I2);const nf=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Qo={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:nf,nodeExtent:nf,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Cr.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},yP=()=>((t,e)=>t?fv(t,e):fv)((t,e)=>({...Qo,setNodes:n=>{const{nodeInternals:o,nodeOrigin:r,elevateNodesOnSelect:s}=e();t({nodeInternals:Kh(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,i=r?Kh(n,new Map,e().nodeOrigin,e().elevateNodesOnSelect):new Map;t({nodeInternals:i,edges:s?o:[],hasDefaultNodes:r,hasDefaultEdges:s})},updateNodeDimensions:n=>{const{onNodesChange:o,nodeInternals:r,fitViewOnInit:s,fitViewOnInitDone:i,fitViewOnInitOptions:a,domNode:l,nodeOrigin:c}=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),p=n.reduce((g,m)=>{const b=r.get(m.id);if(b!=null&&b.hidden)r.set(b.id,{...b,[vt]:{...b[vt],handleBounds:void 0}});else if(b){const y=Mh(m.nodeElement);!(!y.width||!y.height||b.width===y.width&&b.height===y.height&&!m.forceUpdate)&&(r.set(b.id,{...b,[vt]:{...b[vt],handleBounds:{source:p2(".source",m.nodeElement,f,c),target:p2(".target",m.nodeElement,f,c)}},...y}),g.push({id:b.id,type:"dimensions",dimensions:y}))}return g},[]);o2(r,c);const _=i||s&&!i&&r2(e,{initial:!0,...a});t({nodeInternals:new Map(r),fitViewOnInitDone:_}),(p==null?void 0:p.length)>0&&(o==null||o(p))},updateNodePositions:(n,o=!0,r=!1)=>{const{triggerNodeChanges:s}=e(),i=n.map(a=>{const l={id:a.id,type:"position",dragging:r};return o&&(l.positionAbsolute=a.positionAbsolute,l.position=a.position),l});s(i)},triggerNodeChanges:n=>{const{onNodesChange:o,nodeInternals:r,hasDefaultNodes:s,nodeOrigin:i,getNodes:a,elevateNodesOnSelect:l}=e();if(n!=null&&n.length){if(s){const c=Kh(c2(n,a()),r,i,l);t({nodeInternals:c})}o==null||o(n)}},addSelectedNodes:n=>{const{multiSelectionActive:o,edges:r,getNodes:s}=e();let i,a=null;o?i=n.map(l=>Zo(l,!0)):(i=gs(s(),n),a=gs(r,[])),Bl({changedNodes:i,changedEdges:a,get:e,set:t})},addSelectedEdges:n=>{const{multiSelectionActive:o,edges:r,getNodes:s}=e();let i,a=null;o?i=n.map(l=>Zo(l,!0)):(i=gs(r,n),a=gs(s(),[])),Bl({changedNodes:a,changedEdges:i,get:e,set:t})},unselectNodesAndEdges:({nodes:n,edges:o}={})=>{const{edges:r,getNodes:s}=e(),i=o||r;Bl({changedNodes:(n||s()).map(a=>(a.selected=!1,Zo(a.id,!1))),changedEdges:i.map(a=>Zo(a.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();Bl({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=Oh(r.position,n)}),t({nodeExtent:n,nodeInternals:new Map(o)})},panBy:n=>{const{transform:o,width:r,height:s,d3Zoom:i,d3Selection:a,translateExtent:l}=e();if(!i||!a||!n.x&&!n.y)return!1;const c=ur.translate(o[0]+n.x,o[1]+n.y).scale(o[2]),u=[[0,0],[r,s]],h=i==null?void 0:i.constrain()(c,u,l);return i.transform(a,h),o[0]!==h.x||o[1]!==h.y||o[2]!==h.k},cancelConnection:()=>t({connectionNodeId:Qo.connectionNodeId,connectionHandleId:Qo.connectionHandleId,connectionHandleType:Qo.connectionHandleType,connectionStatus:Qo.connectionStatus,connectionStartHandle:Qo.connectionStartHandle,connectionEndHandle:Qo.connectionEndHandle}),reset:()=>t({...Qo})}),Object.is),of=({children:t})=>{const e=M.useRef(null);return e.current||(e.current=yP()),K.createElement(uR,{value:e.current},t)};of.displayName="ReactFlowProvider";const A2=({children:t})=>M.useContext(Ml)?K.createElement(K.Fragment,null,t):K.createElement(of,null,t);A2.displayName="ReactFlowWrapper";const xP={input:Gv,default:Yh,output:Jv,group:Jh},wP={default:Fl,straight:Uh,step:Bh,smoothstep:Pl,simplebezier:Fh},vP=[0,0],kP=[15,15],SP={x:0,y:0,zoom:1},CP={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},rf=M.forwardRef(({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:s=xP,edgeTypes:i=wP,onNodeClick:a,onEdgeClick:l,onInit:c,onMove:u,onMoveStart:h,onMoveEnd:f,onConnect:p,onConnectStart:_,onConnectEnd:g,onClickConnectStart:m,onClickConnectEnd:b,onNodeMouseEnter:y,onNodeMouseMove:x,onNodeMouseLeave:v,onNodeContextMenu:C,onNodeDoubleClick:k,onNodeDragStart:j,onNodeDrag:N,onNodeDragStop:I,onNodesDelete:A,onEdgesDelete:T,onSelectionChange:R,onSelectionDragStart:z,onSelectionDrag:D,onSelectionDragStop:F,onSelectionContextMenu:B,onSelectionStart:U,onSelectionEnd:O,connectionMode:S=Cr.Strict,connectionLineType:$=Ko.Bezier,connectionLineStyle:E,connectionLineComponent:W,connectionLineContainerStyle:G,deleteKeyCode:q="Backspace",selectionKeyCode:Y="Shift",selectionOnDrag:Q=!1,selectionMode:re=Di.Full,panActivationKeyCode:ae="Space",multiSelectionKeyCode:Z=Dl()?"Meta":"Control",zoomActivationKeyCode:te=Dl()?"Meta":"Control",snapToGrid:ue=!1,snapGrid:me=kP,onlyRenderVisibleElements:de=!1,selectNodesOnDrag:fe=!0,nodesDraggable:he,nodesConnectable:Ce,nodesFocusable:Ee,nodeOrigin:ie=vP,edgesFocusable:Me,edgesUpdatable:xe,elementsSelectable:Re,defaultViewport:Ue=SP,minZoom:Je=.5,maxZoom:Ke=2,translateExtent:Pe=nf,preventScrolling:st=!0,nodeExtent:et,defaultMarkerColor:nt="#b1b1b7",zoomOnScroll:ne=!0,zoomOnPinch:ve=!0,panOnScroll:Se=!1,panOnScrollSpeed:De=.5,panOnScrollMode:J=Jo.Free,zoomOnDoubleClick:ge=!0,panOnDrag:_e=!0,onPaneClick:pe,onPaneMouseEnter:le,onPaneMouseMove:He,onPaneMouseLeave:Fe,onPaneScroll:Ze,onPaneContextMenu:se,children:Ne,onEdgeContextMenu:Ie,onEdgeDoubleClick:Ve,onEdgeMouseEnter:Ye,onEdgeMouseMove:Le,onEdgeMouseLeave:qe,onEdgeUpdate:it,onEdgeUpdateStart:ot,onEdgeUpdateEnd:at,onReconnect:Dt,onReconnectStart:Lt,onReconnectEnd:en,reconnectRadius:$t=10,edgeUpdaterRadius:Gn=10,onNodesChange:xs,onEdgesChange:io,noDragClassName:Oo="nodrag",noWheelClassName:Rn="nowheel",noPanClassName:ws="nopan",fitView:Ui=!1,fitViewOptions:GF,connectOnClick:YF=!0,attributionPosition:JF,proOptions:KF,defaultEdgeOptions:XF,elevateNodesOnSelect:ZF=!0,elevateEdgesOnSelect:QF=!1,disableKeyboardA11y:x3=!1,autoPanOnConnect:ez=!0,autoPanOnNodeDrag:tz=!0,connectionRadius:nz=20,isValidConnection:oz,onError:rz,style:sz,id:w3,nodeDragThreshold:iz,...az},lz)=>{const Kf=w3||"1";return K.createElement("div",{...az,style:{...sz,...CP},ref:lz,className:ln(["react-flow",r]),"data-testid":"rf__wrapper",id:w3},K.createElement(A2,null,K.createElement(bP,{onInit:c,onMove:u,onMoveStart:h,onMoveEnd:f,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:y,onNodeMouseMove:x,onNodeMouseLeave:v,onNodeContextMenu:C,onNodeDoubleClick:k,nodeTypes:s,edgeTypes:i,connectionLineType:$,connectionLineStyle:E,connectionLineComponent:W,connectionLineContainerStyle:G,selectionKeyCode:Y,selectionOnDrag:Q,selectionMode:re,deleteKeyCode:q,multiSelectionKeyCode:Z,panActivationKeyCode:ae,zoomActivationKeyCode:te,onlyRenderVisibleElements:de,selectNodesOnDrag:fe,defaultViewport:Ue,translateExtent:Pe,minZoom:Je,maxZoom:Ke,preventScrolling:st,zoomOnScroll:ne,zoomOnPinch:ve,zoomOnDoubleClick:ge,panOnScroll:Se,panOnScrollSpeed:De,panOnScrollMode:J,panOnDrag:_e,onPaneClick:pe,onPaneMouseEnter:le,onPaneMouseMove:He,onPaneMouseLeave:Fe,onPaneScroll:Ze,onPaneContextMenu:se,onSelectionContextMenu:B,onSelectionStart:U,onSelectionEnd:O,onEdgeContextMenu:Ie,onEdgeDoubleClick:Ve,onEdgeMouseEnter:Ye,onEdgeMouseMove:Le,onEdgeMouseLeave:qe,onReconnect:Dt??it,onReconnectStart:Lt??ot,onReconnectEnd:en??at,reconnectRadius:$t??Gn,defaultMarkerColor:nt,noDragClassName:Oo,noWheelClassName:Rn,noPanClassName:ws,elevateEdgesOnSelect:QF,rfId:Kf,disableKeyboardA11y:x3,nodeOrigin:ie,nodeExtent:et}),K.createElement(DR,{nodes:t,edges:e,defaultNodes:n,defaultEdges:o,onConnect:p,onConnectStart:_,onConnectEnd:g,onClickConnectStart:m,onClickConnectEnd:b,nodesDraggable:he,nodesConnectable:Ce,nodesFocusable:Ee,edgesFocusable:Me,edgesUpdatable:xe,elementsSelectable:Re,elevateNodesOnSelect:ZF,minZoom:Je,maxZoom:Ke,nodeExtent:et,onNodesChange:xs,onEdgesChange:io,snapToGrid:ue,snapGrid:me,connectionMode:S,translateExtent:Pe,connectOnClick:YF,defaultEdgeOptions:XF,fitView:Ui,fitViewOptions:GF,onNodesDelete:A,onEdgesDelete:T,onNodeDragStart:j,onNodeDrag:N,onNodeDragStop:I,onSelectionDrag:D,onSelectionDragStart:z,onSelectionDragStop:F,noPanClassName:ws,nodeOrigin:ie,rfId:Kf,autoPanOnConnect:ez,autoPanOnNodeDrag:tz,onError:rz,connectionRadius:nz,isValidConnection:oz,nodeDragThreshold:iz}),K.createElement(MR,{onSelectionChange:R}),Ne,K.createElement(wR,{proOptions:KF,position:JF}),K.createElement(FR,{rfId:Kf,disableKeyboardA11y:x3})))});function T2(t){return e=>{const[n,o]=M.useState(e),r=M.useCallback(s=>o(i=>t(s,i)),[]);return[n,o,r]}}rf.displayName="ReactFlow";const M2=T2(c2),O2=T2(function(t,e){return l2(t,e)});function NP(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},K.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function jP(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},K.createElement("path",{d:"M0 0h32v4.2H0z"}))}function EP(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},K.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 IP(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},K.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 AP(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},K.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 ys=({children:t,className:e,...n})=>K.createElement("button",{type:"button",className:ln(["react-flow__controls-button",e]),...n},t);ys.displayName="ControlButton";const TP=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom}),D2=({style:t,showZoom:e=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:s,onZoomOut:i,onFitView:a,onInteractiveChange:l,className:c,children:u,position:h="bottom-left"})=>{const f=Vt(),[p,_]=M.useState(!1),{isInteractive:g,minZoomReached:m,maxZoomReached:b}=pt(TP,Qt),{zoomIn:y,zoomOut:x,fitView:v}=Li();return M.useEffect(()=>{_(!0)},[]),p?K.createElement(Ol,{className:ln(["react-flow__controls",c]),position:h,style:t,"data-testid":"rf__controls"},e&&K.createElement(K.Fragment,null,K.createElement(ys,{onClick:()=>{y(),s==null||s()},className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:b},K.createElement(NP,null)),K.createElement(ys,{onClick:()=>{x(),i==null||i()},className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:m},K.createElement(jP,null))),n&&K.createElement(ys,{className:"react-flow__controls-fitview",onClick:()=>{v(r),a==null||a()},title:"fit view","aria-label":"fit view"},K.createElement(EP,null)),o&&K.createElement(ys,{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?K.createElement(AP,null):K.createElement(IP,null)),u):null};D2.displayName="Controls";var Dn,MP=M.memo(D2);function OP({color:t,dimensions:e,lineWidth:n}){return K.createElement("path",{stroke:t,strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})}function DP({color:t,radius:e}){return K.createElement("circle",{cx:e,cy:e,r:e,fill:t})}(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(Dn||(Dn={}));const RP={[Dn.Dots]:"#91919a",[Dn.Lines]:"#eee",[Dn.Cross]:"#e2e2e2"},PP={[Dn.Dots]:1,[Dn.Lines]:1,[Dn.Cross]:6},LP=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function R2({id:t,variant:e=Dn.Dots,gap:n=20,size:o,lineWidth:r=1,offset:s=2,color:i,style:a,className:l}){const c=M.useRef(null),{transform:u,patternId:h}=pt(LP,Qt),f=i||RP[e],p=o||PP[e],_=e===Dn.Dots,g=e===Dn.Cross,m=Array.isArray(n)?n:[n,n],b=[m[0]*u[2]||1,m[1]*u[2]||1],y=p*u[2],x=g?[y,y]:b,v=_?[y/s,y/s]:[x[0]/s,x[1]/s];return K.createElement("svg",{className:ln(["react-flow__background",l]),style:{...a,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:c,"data-testid":"rf__background"},K.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(-${v[0]},-${v[1]})`},_?K.createElement(DP,{color:f,radius:y/s}):K.createElement(OP,{dimensions:x,color:f,lineWidth:r})),K.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${h+t})`}))}R2.displayName="Background";var FP=M.memo(R2);function sf(t){return Math.min(11*t+35,200)}const P2=K.createContext("LR"),L2=M.memo(t=>{const e=X.c(51),{data:n,selected:o}=t,r=Be(n.atom),s=Pc().inOrderIds.indexOf(r.id),i=o?"var(--gray-9)":"var(--gray-3)",a=pt(zP),l=M.use(P2);let c,u,h,f,p;if(e[0]!==r.code||e[1]!==i||e[2]!==l||e[3]!==o){const T=r.code.split(`
142
142
  `).length,R=l==="LR"?ze.Left:ze.Top;let z;e[8]!==i?(z={background:i},e[8]=i,e[9]=z):z=e[9],e[10]!==R||e[11]!==z?(h=d.jsx(Xo,{type:"target",id:"inputs",position:R,style:z}),e[10]=R,e[11]=z,e[12]=h):h=e[12];const D=l==="LR"?ze.Left:ze.Top;let F;e[13]!==i?(F={background:i},e[13]=i,e[14]=F):F=e[14],e[15]!==D||e[16]!==F?(f=d.jsx(Xo,{type:"source",id:"inputs",position:D,style:F}),e[15]=D,e[16]=F,e[17]=f):f=e[17];const B=o&&"border-primary";e[18]!==B?(u=je("flex flex-col bg-card border border-input/50 rounded-md mx-[2px] overflow-hidden",B),e[18]=B,e[19]=u):u=e[19],c=sf(T),e[0]=r.code,e[1]=i,e[2]=l,e[3]=o,e[4]=c,e[5]=u,e[6]=h,e[7]=f}else c=e[4],u=e[5],h=e[6],f=e[7];var _;let g;e[20]!==n.forceWidth||e[21]!==a?(p=n.forceWidth||(_=a,Math.min(Math.max(_-100,100),400)),e[20]=n.forceWidth,e[21]=a,e[22]=p):p=e[22],e[23]!==c||e[24]!==p?(g={height:c,width:p},e[23]=c,e[24]=p,e[25]=g):g=e[25];const m=n$(r.name,s);let b,y,x;e[26]!==m?(b=d.jsx("div",{className:"text-muted-foreground font-semibold text-xs py-1 px-2 bg-muted border-b",children:m}),e[26]=m,e[27]=b):b=e[27],e[28]!==r.code?(y=d.jsx(BH,{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?(x=d.jsxs("div",{className:u,style:g,children:[b,y]}),e[30]=u,e[31]=g,e[32]=b,e[33]=y,e[34]=x):x=e[34];const v=l==="LR"?ze.Right:ze.Bottom;let C,k;e[35]!==i?(C={background:i},e[35]=i,e[36]=C):C=e[36],e[37]!==v||e[38]!==C?(k=d.jsx(Xo,{type:"source",id:"outputs",position:v,style:C}),e[37]=v,e[38]=C,e[39]=k):k=e[39];const j=l==="LR"?ze.Right:ze.Bottom;let N,I,A;return e[40]!==i?(N={background:i},e[40]=i,e[41]=N):N=e[41],e[42]!==j||e[43]!==N?(I=d.jsx(Xo,{type:"target",id:"outputs",position:j,style:N}),e[42]=j,e[43]=N,e[44]=I):I=e[44],e[45]!==x||e[46]!==k||e[47]!==I||e[48]!==h||e[49]!==f?(A=d.jsxs("div",{children:[h,f,x,k,I]}),e[45]=x,e[46]=k,e[47]=I,e[48]=h,e[49]=f,e[50]=A):A=e[50],A},(t,e)=>["data","selected","id"].every(n=>t[n]===e[n]));L2.displayName="CustomNode";const F2={custom:L2};function zP(t){const{width:e}=t;return e}const z2=t=>{const e=X.c(18),{maxCount:n,cellIds:o,onClick:r,skipScroll:s}=t,i=Pc();let a,l,c,u;if(e[0]!==o||e[1]!==i||e[2]!==n||e[3]!==r||e[4]!==s){c=Symbol.for("react.early_return_sentinel");e:{let h;e[8]!==i?(h=(_,g)=>i.inOrderIds.indexOf(_)-i.inOrderIds.indexOf(g),e[8]=i,e[9]=h):h=e[9];const f=[...o].sort(h);if(o.length===0){let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=d.jsx("div",{className:"text-muted-foreground",children:"--"}),e[10]=_):_=e[10],c=_;break e}let p;e[11]!==o.length||e[12]!==r||e[13]!==s?(p=(_,g)=>d.jsxs("span",{className:"truncate",children:[d.jsx(cr,{variant:"focus",cellId:_,skipScroll:s,className:"whitespace-nowrap",onClick:r?()=>r(_):void 0},_),g<o.length-1&&", "]},_),e[11]=o.length,e[12]=r,e[13]=s,e[14]=p):p=e[14],a=f.slice(0,n).map(p),l=o.length>n&&d.jsxs(Or,{children:[d.jsx(zs,{asChild:!0,children:d.jsxs("span",{className:"whitespace-nowrap text-muted-foreground text-xs hover:underline cursor-pointer",children:["+",o.length-n," more"]})}),d.jsx(Os,{className:"w-auto",children:d.jsx("div",{className:"flex flex-col gap-1 py-1",children:f.slice(n).map(_=>d.jsx(cr,{variant:"focus",cellId:_,className:"whitespace-nowrap",onClick:r?()=>r(_):void 0},_))})})]})}e[0]=o,e[1]=i,e[2]=n,e[3]=r,e[4]=s,e[5]=a,e[6]=l,e[7]=c}else a=e[5],l=e[6],c=e[7];return c!==Symbol.for("react.early_return_sentinel")?c:(e[15]!==a||e[16]!==l?(u=d.jsxs(d.Fragment,{children:[a,l]}),e[15]=a,e[16]=l,e[17]=u):u=e[17],u)},af=t=>{const e=X.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 i=n.length>1?"destructive":"outline";let a,l,c;return e[5]!==o||e[6]!==r?(a=async u=>{r?r(u):(await pn(o),ut({title:"Copied to clipboard"}))},e[5]=o,e[6]=r,e[7]=a):a=e[7],e[8]!==o||e[9]!==i||e[10]!==a?(l=d.jsx(nS,{title:o,variant:i,className:"rounded-sm text-ellipsis block overflow-hidden max-w-fit cursor-pointer font-medium",onClick:a,children:o}),e[8]=o,e[9]=i,e[10]=a,e[11]=l):l=e[11],e[12]!==s||e[13]!==l?(c=d.jsx("div",{className:"max-w-[130px]",...s,children:l}),e[12]=s,e[13]=l,e[14]=c):c=e[14],c},lf=M.memo(t=>{const e=X.c(38),{onChange:n,view:o,settings:r,onSettingsChange:s}=t;let i;e[0]!==s||e[1]!==r?(i=(D,F)=>{s({...r,[D]:F})},e[0]=s,e[1]=r,e[2]=i):i=e[2];const a=i;let l,c,u,h,f,p;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=d.jsx(zs,{asChild:!0,children:d.jsx(Te,{variant:"text",size:"xs",children:d.jsx(pp,{className:"w-4 h-4"})})}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx("div",{className:"font-semibold pb-4",children:"Settings"}),e[4]=c):c=e[4],e[5]!==a?(u=D=>a("hidePureMarkdown",!!D),e[5]=a,e[6]=u):u=e[6],e[7]!==r.hidePureMarkdown||e[8]!==u?(h=d.jsx(M4,{"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=d.jsx(Ar,{htmlFor:"hide-pure-markdown",children:"Hide pure markdown"}),e[10]=f):f=e[10],e[11]!==h?(p=d.jsxs(Or,{children:[l,d.jsxs(Os,{className:"w-auto p-2 text-muted-foreground",children:[c,d.jsxs("div",{className:"flex items-center gap-2",children:[h,f]})]})]}),e[11]=h,e[12]=p):p=e[12];const _=p,g=o==="_minimap_";let m,b,y;e[13]!==n?(m=()=>n("_minimap_"),e[13]=n,e[14]=m):m=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(b=d.jsx(Tm,{className:"w-4 h-4 mr-1"}),e[15]=b):b=e[15],e[16]!==g||e[17]!==m?(y=d.jsxs(Te,{variant:"outline",className:"bg-background","aria-selected":g,size:"xs",onClick:m,children:[b,"Mini Map"]}),e[16]=g,e[17]=m,e[18]=y):y=e[18];const x=o==="TB";let v,C,k;e[19]!==n?(v=()=>n("TB"),e[19]=n,e[20]=v):v=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(C=d.jsx(ga,{className:"w-4 h-4 mr-1"}),e[21]=C):C=e[21],e[22]!==x||e[23]!==v?(k=d.jsxs(Te,{variant:"outline",className:"bg-background","aria-selected":x,size:"xs",onClick:v,children:[C,"Vertical Tree"]}),e[22]=x,e[23]=v,e[24]=k):k=e[24];const j=o==="LR";let N,I,A,T;e[25]!==n?(N=()=>n("LR"),e[25]=n,e[26]=N):N=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(I=d.jsx(ga,{className:"w-4 h-4 mr-1 transform -rotate-90"}),e[27]=I):I=e[27],e[28]!==j||e[29]!==N?(A=d.jsxs(Te,{variant:"outline",className:"bg-background","aria-selected":j,size:"xs",onClick:N,children:[I," ","Horizontal Tree"]}),e[28]=j,e[29]=N,e[30]=A):A=e[30],e[31]!==y||e[32]!==k||e[33]!==A?(T=d.jsxs("div",{className:"flex gap-2",children:[y,k,A]}),e[31]=y,e[32]=k,e[33]=A,e[34]=T):T=e[34];const R=o!=="_minimap_"&&_;let z;return e[35]!==T||e[36]!==R?(z=d.jsxs(Ol,{position:"top-right",className:"flex flex-col items-end gap-2",children:[T,R]}),e[35]=T,e[36]=R,e[37]=z):z=e[37],z});lf.displayName="GraphToolbar";const Vl=M.memo(t=>{const e=X.c(11),{selection:n,variables:o,onClearSelection:r}=t;if(!n)return null;const s=BP;let i;e[0]!==r||e[1]!==n.id||e[2]!==n.source||e[3]!==n.target||e[4]!==n.type||e[5]!==o?(i=()=>{if(n.type==="node"){const u=Object.values(o).filter(p=>p.usedBy.includes(n.id)),h=Object.values(o).filter(p=>p.declaredBy.includes(n.id)),f=(p,_)=>d.jsxs(d.Fragment,{children:[p.length===0&&d.jsx("div",{className:"text-muted-foreground text-sm text-center",children:"--"}),d.jsx("div",{className:"grid grid-cols-5 gap-3 items-center text-sm py-1 flex-1 empty:hidden",children:p.map(g=>d.jsxs(K.Fragment,{children:[d.jsx(af,{declaredBy:g.declaredBy,name:g.name}),d.jsxs("div",{className:"truncate col-span-2",title:g.value??"",children:[g.value,d.jsxs("span",{className:"ml-1 truncate text-foreground/60 font-mono",children:["(",g.dataType,")"]})]}),d.jsx("div",{className:"truncate col-span-2 gap-1 items-center",children:d.jsx(z2,{skipScroll:!0,onClick:()=>s(_==="in"?g.declaredBy[0]:g.usedBy[0],g.name),maxCount:3,cellIds:g.usedBy})})]},g.name))})]});return d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[d.jsx(ql,{className:"w-5 h-5"}),d.jsx(cr,{cellId:n.id}),d.jsx("div",{className:"flex-1"}),d.jsx(h0,{cellId:n.id,children:d.jsx(Te,{variant:"ghost",size:"icon",children:d.jsx(qc,{className:"w-4 h-4"})})}),d.jsx(Te,{variant:"text",size:"icon",onClick:()=>{r()},children:d.jsx(Jn,{className:"w-4 h-4"})})]}),d.jsxs("div",{className:"text-sm flex flex-col py-3 pl-2 pr-4 flex-1 justify-center",children:[d.jsxs("div",{className:"flex flex-col gap-2",children:[d.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[d.jsx(dn,{className:"w-4 h-4"}),"Outputs"]}),f(h,"out")]}),d.jsx("hr",{className:"border-divider my-3"}),d.jsxs("div",{className:"flex flex-col gap-2",children:[d.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[d.jsx(Qp,{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 d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[d.jsx(ba,{className:"w-4 h-4"}),d.jsx(cr,{cellId:n.source}),d.jsx($c,{className:"w-4 h-4"}),d.jsx(cr,{cellId:n.target})]}),d.jsx("div",{className:"grid grid-cols-4 gap-3 max-w-[350px] items-center text-sm p-3 flex-1",children:u.map(h=>d.jsxs(K.Fragment,{children:[d.jsx(af,{declaredBy:h.declaredBy,name:h.name,onClick:()=>{s(h.declaredBy[0],h.name)}}),d.jsx("div",{className:"truncate text-foreground/60 font-mono",children:h.dataType}),d.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]=i):i=e[6];const a=i;let l,c;return e[7]!==a?(l=a(),e[7]=a,e[8]=l):l=e[8],e[9]!==l?(c=d.jsx(Ol,{position:"bottom-left",className:"max-h-[90%] flex flex-col w-[calc(100%-5rem)]",children:d.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]=c):c=e[10],c});function BP(t,e){const n=Jl(t);n&&zp(n,e)}function B2(){const t=X.c(7),e=Li(),n=pt(VP),o=pt(UP);let r;t[0]!==e?(r=()=>{e.fitView({duration:100})},t[0]=e,t[1]=r):r=t[1];const s=o$(r,100);let i,a;t[2]!==s||t[3]!==o||t[4]!==n?(i=()=>{n&&o&&s()},a=[n,o,s],t[2]=s,t[3]=o,t[4]=n,t[5]=i,t[6]=a):(i=t[5],a=t[6]),M.useEffect(i,a)}function UP(t){const{height:e}=t;return e}function VP(t){const{width:e}=t;return e}Vl.displayName="GraphSelectionPanel";const U2=new class{createEdge(t,e,n){return{type:"smoothstep",pathOptions:{offset:20,borderRadius:100},data:{direction:n},markerEnd:{type:us.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:sf(ct.get(e).code.trim().split(`
143
143
  `).length),position:{x:0,y:n+20}}}createElements(t,e,n,o){let r=0;const s=[],i=[];for(const[l,c]of Lp.zip(t,e)){const u=this.createNode(l,c,r);s.push(u),r=u.position.y+(u.height||0)}const a=new Set;for(const l of Object.values(n)){const{declaredBy:c,usedBy:u}=l;for(const h of c)for(const f of u){const p=`${h}-${f}`;a.has(p)||(a.add(p),i.push(this.createEdge(h,f,"inputs"),this.createEdge(h,f,"outputs")))}}return{nodes:s,edges:i}}},$P=t=>{const e=X.c(37),{cellIds:n,variables:o,cellAtoms:r,children:s}=t;let i;e[0]!==r||e[1]!==n||e[2]!==o?(i=U2.createElements(n,r,o,!1),e[0]=r,e[1]=n,e[2]=o,e[3]=i):i=e[3];const{nodes:a,edges:l}=i;let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=[],e[4]=c):c=e[4];const[u,h]=O2(c),[f,p]=M2(a),[_,g]=M.useState(),[m,b]=M.useState(),y=M.useRef(!1);B2();const x=pt(HP);let v;e[5]!==h||e[6]!==p?(v=S=>{p(S.nodes),h([])},e[5]=h,e[6]=p,e[7]=v):v=e[7];const C=Xe(v);let k,j,N,I;e[8]!==r||e[9]!==n||e[10]!==C||e[11]!==o?(k=()=>{y.current?C(U2.createElements(n,r,o,!1)):y.current=!0},j=[n,o,r,C],e[8]=r,e[9]=n,e[10]=C,e[11]=o,e[12]=k,e[13]=j):(k=e[12],j=e[13]),M.useEffect(k,j),e[14]!==l||e[15]!==_||e[16]!==h?(N=()=>{if(_){const S=l.filter($=>{const{source:E,target:W,data:G}=$;return E===_&&G.direction==="outputs"||W===_&&G.direction==="inputs"});h(S)}},I=[_,h,l],e[14]=l,e[15]=_,e[16]=h,e[17]=N,e[18]=I):(N=e[17],I=e[18]),M.useEffect(N,I);const A=function(S,$){const E=X.c(17);let W,G;if(E[0]!==$||E[1]!==S){let te;E[3]!==$?(te=(ue,me)=>{const{position:de}=me;return Math.min(ue,de.y-$/2-10)},E[3]=$,E[4]=te):te=E[4],G=S.reduce(te,Number.POSITIVE_INFINITY),E[0]=$,E[1]=S,E[2]=G}else G=E[2];const q=G;let Y;if(E[5]!==$||E[6]!==S){let te;E[8]!==$?(te=(ue,me)=>{const{position:de}=me;return Math.max(ue,de.y+$/2+10)},E[8]=$,E[9]=te):te=E[9],Y=S.reduce(te,Number.NEGATIVE_INFINITY),E[5]=$,E[6]=S,E[7]=Y}else Y=E[7];const Q=Y;let re,ae,Z;return E[10]!==q?(re=[Number.NEGATIVE_INFINITY,q],E[10]=q,E[11]=re):re=E[11],E[12]!==Q?(ae=[Number.POSITIVE_INFINITY,Q],E[12]=Q,E[13]=ae):ae=E[13],E[14]!==re||E[15]!==ae?(Z=[re,ae],E[14]=re,E[15]=ae,E[16]=Z):Z=E[16],W=Z,W}(f,x);let T;e[19]===Symbol.for("react.memo_cache_sentinel")?(T=()=>{g(void 0),b(void 0)},e[19]=T):T=e[19];const R=T;let z;e[20]!==u||e[21]!==m||e[22]!==_||e[23]!==o?(z=()=>m?d.jsx(Vl,{selection:{type:"edge",source:m.source,target:m.target},onClearSelection:R,variables:o,edges:u}):_?d.jsx(Vl,{selection:{type:"node",id:_},variables:o,edges:u,onClearSelection:R}):null,e[20]=u,e[21]=m,e[22]=_,e[23]=o,e[24]=z):z=e[24];const D=z;let F,B,U,O;return e[25]!==h?(F=(S,$)=>{const E=$.id;g(E),b(void 0),h([])},e[25]=h,e[26]=F):F=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(B=(S,$)=>{b($)},e[27]=B):B=e[27],e[28]!==D?(U=D(),e[28]=D,e[29]=U):U=e[29],e[30]!==s||e[31]!==u||e[32]!==f||e[33]!==F||e[34]!==U||e[35]!==A?(O=d.jsxs(rf,{nodes:f,edges:u,nodeTypes:F2,translateExtent:A,onNodeClick:F,onNodeDoubleClick:WP,onEdgeClick:B,snapToGrid:!0,fitView:!0,elementsSelectable:!0,minZoom:1,maxZoom:1,draggable:!1,panOnScrollMode:Jo.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:[U,s]}),e[30]=s,e[31]=u,e[32]=f,e[33]=F,e[34]=U,e[35]=A,e[36]=O):O=e[36],O};function HP(t){const{height:e}=t;return e}function WP(t,e){oS(e.id,"focus")}var cf,V2,$2,H2,W2,q2,df,G2,uf,Y2,hf,J2,ff,K2,pf,X2,mf,Z2,gf,Q2,_f,ek,bf,tk,yf,nk,xf,ok,wf,rk,vf,sk,kf,ik,ak,lk,ck,dk,uk,hk,Sf,fk,Cf,pk,Nf,mk,jf,gk,Ef,_k,If,bk,Af,yk,Tf,xk,Mf,wk,Of,vk,Df,kk,Rf,Sk,Pf,Ck,Lf,Nk,jk,Ek,Ik,Ak,Tk,Mk,Ff,Ok,zf,Dk,Rk,Pk,Bf,Lk,Uf,Fk,Vf,zk,$f,Bk,Hf,Uk,Vk,$k,Hk,Wk;function Wf(){if(V2)return cf;V2=1;var t="\0";function e(s,i){s[i]?s[i]++:s[i]=1}function n(s,i){--s[i]||delete s[i]}function o(s,i,a,l){var c=""+i,u=""+a;if(!s&&c>u){var h=c;c=u,u=h}return c+""+u+""+(l===void 0?"\0":l)}function r(s,i){return o(s,i.v,i.w,i.name)}return cf=class{constructor(s){ee(this,"_isDirected",!0);ee(this,"_isMultigraph",!1);ee(this,"_isCompound",!1);ee(this,"_label");ee(this,"_defaultNodeLabelFn",()=>{});ee(this,"_defaultEdgeLabelFn",()=>{});ee(this,"_nodes",{});ee(this,"_in",{});ee(this,"_preds",{});ee(this,"_out",{});ee(this,"_sucs",{});ee(this,"_edgeObjs",{});ee(this,"_edgeLabels",{});ee(this,"_nodeCount",0);ee(this,"_edgeCount",0);ee(this,"_parent");ee(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(i=>Object.keys(s._in[i]).length===0)}sinks(){var s=this;return this.nodes().filter(i=>Object.keys(s._out[i]).length===0)}setNodes(s,i){var a=arguments,l=this;return s.forEach(function(c){a.length>1?l.setNode(c,i):l.setNode(c)}),this}setNode(s,i){return Object.hasOwn(this._nodes,s)?(arguments.length>1&&(this._nodes[s]=i),this):(this._nodes[s]=arguments.length>1?i: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 i=this;if(Object.hasOwn(this._nodes,s)){var a=l=>i.removeEdge(i._edgeObjs[l]);delete this._nodes[s],this._isCompound&&(this._removeFromParentsChildList(s),delete this._parent[s],this.children(s).forEach(function(l){i.setParent(l)}),delete this._children[s]),Object.keys(this._in[s]).forEach(a),delete this._in[s],delete this._preds[s],Object.keys(this._out[s]).forEach(a),delete this._out[s],delete this._sucs[s],--this._nodeCount}return this}setParent(s,i){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(i===void 0)i=t;else{for(var a=i+="";a!==void 0;a=this.parent(a))if(a===s)throw new Error("Setting "+i+" as parent of "+s+" would create a cycle");this.setNode(i)}return this.setNode(s),this._removeFromParentsChildList(s),this._parent[s]=i,this._children[i][s]=!0,this}_removeFromParentsChildList(s){delete this._children[this._parent[s]][s]}parent(s){if(this._isCompound){var i=this._parent[s];if(i!==t)return i}}children(s=t){if(this._isCompound){var i=this._children[s];if(i)return Object.keys(i)}else{if(s===t)return this.nodes();if(this.hasNode(s))return[]}}predecessors(s){var i=this._preds[s];if(i)return Object.keys(i)}successors(s){var i=this._sucs[s];if(i)return Object.keys(i)}neighbors(s){var i=this.predecessors(s);if(i){const l=new Set(i);for(var a of this.successors(s))l.add(a);return Array.from(l.values())}}isLeaf(s){return(this.isDirected()?this.successors(s):this.neighbors(s)).length===0}filterNodes(s){var i=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});i.setGraph(this.graph());var a=this;Object.entries(this._nodes).forEach(function([u,h]){s(u)&&i.setNode(u,h)}),Object.values(this._edgeObjs).forEach(function(u){i.hasNode(u.v)&&i.hasNode(u.w)&&i.setEdge(u,a.edge(u))});var l={};function c(u){var h=a.parent(u);return h===void 0||i.hasNode(h)?(l[u]=h,h):h in l?l[h]:c(h)}return this._isCompound&&i.nodes().forEach(u=>i.setParent(u,c(u))),i}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,i){var a=this,l=arguments;return s.reduce(function(c,u){return l.length>1?a.setEdge(c,u,i):a.setEdge(c,u),u}),this}setEdge(){var s,i,a,l,c=!1,u=arguments[0];typeof u=="object"&&u!==null&&"v"in u?(s=u.v,i=u.w,a=u.name,arguments.length===2&&(l=arguments[1],c=!0)):(s=u,i=arguments[1],a=arguments[3],arguments.length>2&&(l=arguments[2],c=!0)),s=""+s,i=""+i,a!==void 0&&(a=""+a);var h=o(this._isDirected,s,i,a);if(Object.hasOwn(this._edgeLabels,h))return c&&(this._edgeLabels[h]=l),this;if(a!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(s),this.setNode(i),this._edgeLabels[h]=c?l:this._defaultEdgeLabelFn(s,i,a);var f=function(p,_,g,m){var b=""+_,y=""+g;if(!p&&b>y){var x=b;b=y,y=x}var v={v:b,w:y};return m&&(v.name=m),v}(this._isDirected,s,i,a);return s=f.v,i=f.w,Object.freeze(f),this._edgeObjs[h]=f,e(this._preds[i],s),e(this._sucs[s],i),this._in[i][h]=f,this._out[s][h]=f,this._edgeCount++,this}edge(s,i,a){var l=arguments.length===1?r(this._isDirected,arguments[0]):o(this._isDirected,s,i,a);return this._edgeLabels[l]}edgeAsObj(){const s=this.edge(...arguments);return typeof s!="object"?{label:s}:s}hasEdge(s,i,a){var l=arguments.length===1?r(this._isDirected,arguments[0]):o(this._isDirected,s,i,a);return Object.hasOwn(this._edgeLabels,l)}removeEdge(s,i,a){var l=arguments.length===1?r(this._isDirected,arguments[0]):o(this._isDirected,s,i,a),c=this._edgeObjs[l];return c&&(s=c.v,i=c.w,delete this._edgeLabels[l],delete this._edgeObjs[l],n(this._preds[i],s),n(this._sucs[s],i),delete this._in[i][l],delete this._out[s][l],this._edgeCount--),this}inEdges(s,i){var a=this._in[s];if(a){var l=Object.values(a);return i?l.filter(c=>c.v===i):l}}outEdges(s,i){var a=this._out[s];if(a){var l=Object.values(a);return i?l.filter(c=>c.w===i):l}}nodeEdges(s,i){var a=this.inEdges(s,i);if(a)return a.concat(this.outEdges(s,i))}},cf}function qP(){return q2?W2:(q2=1,W2={Graph:Wf(),version:H2?$2:(H2=1,$2="2.2.4")})}function GP(){if(G2)return df;G2=1;var t=Wf();function e(o){return o.nodes().map(function(r){var s=o.node(r),i=o.parent(r),a={v:r};return s!==void 0&&(a.value=s),i!==void 0&&(a.parent=i),a})}function n(o){return o.edges().map(function(r){var s=o.edge(r),i={v:r.v,w:r.w};return r.name!==void 0&&(i.name=r.name),s!==void 0&&(i.value=s),i})}return df={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}},df}function YP(){return Y2||(Y2=1,uf=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}),uf}function qk(){return J2?hf:(J2=1,hf=class{constructor(){ee(this,"_arr",[]);ee(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}},hf)}function Gk(){if(K2)return ff;K2=1;var t=qk();ff=function(n,o,r,s){return function(i,a,l,c){var u,h,f={},p=new t,_=function(g){var m=g.v!==u?g.v:g.w,b=f[m],y=l(g),x=h.distance+y;if(y<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+g+" Weight: "+y);x<b.distance&&(b.distance=x,b.predecessor=u,p.decrease(m,x))};for(i.nodes().forEach(function(g){var m=g===a?0:Number.POSITIVE_INFINITY;f[g]={distance:m},p.add(g,m)});p.size()>0&&(u=p.removeMin(),(h=f[u]).distance!==Number.POSITIVE_INFINITY);)c(u).forEach(_);return f}(n,String(o),r||e,s||function(i){return n.outEdges(i)})};var e=()=>1;return ff}function JP(){if(X2)return pf;X2=1;var t=Gk();return pf=function(e,n,o){return e.nodes().reduce(function(r,s){return r[s]=t(e,s,n,o),r},{})},pf}function Yk(){return Z2||(Z2=1,mf=function(t){var e=0,n=[],o={},r=[];function s(i){var a=o[i]={onStack:!0,lowlink:e,index:e++};if(n.push(i),t.successors(i).forEach(function(u){Object.hasOwn(o,u)?o[u].onStack&&(a.lowlink=Math.min(a.lowlink,o[u].index)):(s(u),a.lowlink=Math.min(a.lowlink,o[u].lowlink))}),a.lowlink===a.index){var l,c=[];do l=n.pop(),o[l].onStack=!1,c.push(l);while(i!==l);r.push(c)}}return t.nodes().forEach(function(i){Object.hasOwn(o,i)||s(i)}),r}),mf}function KP(){if(Q2)return gf;Q2=1;var t=Yk();return gf=function(e){return t(e).filter(function(n){return n.length>1||n.length===1&&e.hasEdge(n[0],n[0])})},gf}function XP(){if(ek)return _f;ek=1,_f=function(e,n,o){return function(r,s,i){var a={},l=r.nodes();return l.forEach(function(c){a[c]={},a[c][c]={distance:0},l.forEach(function(u){c!==u&&(a[c][u]={distance:Number.POSITIVE_INFINITY})}),i(c).forEach(function(u){var h=u.v===c?u.w:u.v,f=s(u);a[c][h]={distance:f,predecessor:c}})}),l.forEach(function(c){var u=a[c];l.forEach(function(h){var f=a[h];l.forEach(function(p){var _=f[c],g=u[p],m=f[p],b=_.distance+g.distance;b<m.distance&&(m.distance=b,m.predecessor=g.predecessor)})})}),a}(e,n||t,o||function(r){return e.outEdges(r)})};var t=()=>1;return _f}function Jk(){if(tk)return bf;function t(n){var o={},r={},s=[];if(n.sinks().forEach(function i(a){if(Object.hasOwn(r,a))throw new e;Object.hasOwn(o,a)||(r[a]=!0,o[a]=!0,n.predecessors(a).forEach(i),delete r[a],s.push(a))}),Object.keys(o).length!==n.nodeCount())throw new e;return s}tk=1;class e extends Error{constructor(){super(...arguments)}}return bf=t,t.CycleException=e,bf}function ZP(){if(nk)return yf;nk=1;var t=Jk();return yf=function(e){try{t(e)}catch(n){if(n instanceof t.CycleException)return!1;throw n}return!0},yf}function Kk(){if(ok)return xf;function t(o,r,s,i){for(var a=[[o,!1]];a.length>0;){var l=a.pop();l[1]?i.push(l[0]):Object.hasOwn(s,l[0])||(s[l[0]]=!0,a.push([l[0],!0]),n(r(l[0]),c=>a.push([c,!1])))}}function e(o,r,s,i){for(var a=[o];a.length>0;){var l=a.pop();Object.hasOwn(s,l)||(s[l]=!0,i.push(l),n(r(l),c=>a.push(c)))}}function n(o,r){for(var s=o.length;s--;)r(o[s],s,o);return o}return ok=1,xf=function(o,r,s){Array.isArray(r)||(r=[r]);var i=o.isDirected()?u=>o.successors(u):u=>o.neighbors(u),a=s==="post"?t:e,l=[],c={};return r.forEach(u=>{if(!o.hasNode(u))throw new Error("Graph does not have node: "+u);a(u,i,c,l)}),l},xf}function QP(){if(rk)return wf;rk=1;var t=Kk();return wf=function(e,n){return t(e,n,"post")},wf}function eL(){if(sk)return vf;sk=1;var t=Kk();return vf=function(e,n){return t(e,n,"pre")},vf}function tL(){if(ik)return kf;ik=1;var t=Wf(),e=qk();return kf=function(n,o){var r,s=new t,i={},a=new e;function l(u){var h=u.v===r?u.w:u.v,f=a.priority(h);if(f!==void 0){var p=o(u);p<f&&(i[h]=r,a.decrease(h,p))}}if(n.nodeCount()===0)return s;n.nodes().forEach(function(u){a.add(u,Number.POSITIVE_INFINITY),s.setNode(u)}),a.decrease(n.nodes()[0],0);for(var c=!1;a.size()>0;){if(r=a.removeMin(),Object.hasOwn(i,r))s.setEdge(r,i[r]);else{if(c)throw new Error("Input graph is not connected: "+n);c=!0}n.nodeEdges(r).forEach(l)}return s},kf}function qn(){if(dk)return ck;dk=1;var t=qP();return ck={Graph:t.Graph,json:GP(),alg:lk?ak:(lk=1,ak={components:YP(),dijkstra:Gk(),dijkstraAll:JP(),findCycles:KP(),floydWarshall:XP(),isAcyclic:ZP(),postorder:QP(),preorder:eL(),prim:tL(),tarjan:Yk(),topsort:Jk()}),version:t.version}}function nL(){if(fk)return Sf;fk=1;let t=qn().Graph,e=function(){if(hk)return uk;function s(a){a._prev._next=a._next,a._next._prev=a._prev,delete a._next,delete a._prev}function i(a,l){if(a!=="_next"&&a!=="_prev")return l}return hk=1,uk=class{constructor(){let a={};a._next=a._prev=a,this._sentinel=a}dequeue(){let a=this._sentinel,l=a._prev;if(l!==a)return s(l),l}enqueue(a){let l=this._sentinel;a._prev&&a._next&&s(a),a._next=l._next,l._next._prev=a,l._next=a,a._prev=l}toString(){let a=[],l=this._sentinel,c=l._prev;for(;c!==l;)a.push(JSON.stringify(c,i)),c=c._prev;return"["+a.join(", ")+"]"}}}();Sf=function(s,i){if(s.nodeCount()<=1)return[];let a=function(l,c){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 m=u.edge(g.v,g.w)||0,b=c(g),y=m+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 p=function(g){const m=[];for(let b=0;b<g;b++)m.push(b);return m}(f+h+3).map(()=>new e),_=h+1;return u.nodes().forEach(g=>{r(p,_,u.node(g))}),{graph:u,buckets:p,zeroIdx:_}}(s,i||n);return function(l,c,u){let h,f=[],p=c[c.length-1],_=c[0];for(;l.nodeCount();){for(;h=_.dequeue();)o(l,c,u,h);for(;h=p.dequeue();)o(l,c,u,h);if(l.nodeCount()){for(let g=c.length-2;g>0;--g)if(h=c[g].dequeue(),h){f=f.concat(o(l,c,u,h,!0));break}}}return f}(a.graph,a.buckets,a.zeroIdx).flatMap(l=>s.outEdges(l.v,l.w))};let n=()=>1;function o(s,i,a,l,c){let u=c?[]:void 0;return s.inEdges(l.v).forEach(h=>{let f=s.edge(h),p=s.node(h.v);c&&u.push({v:h.v,w:h.w}),p.out-=f,r(i,a,p)}),s.outEdges(l.v).forEach(h=>{let f=s.edge(h),p=h.w,_=s.node(p);_.in-=f,r(i,a,_)}),s.removeNode(l.v),u}function r(s,i,a){a.out?a.in?s[a.out-a.in+i].enqueue(a):s[s.length-1].enqueue(a):s[0].enqueue(a)}return Sf}function Ot(){if(pk)return Cf;pk=1;let t=qn().Graph;function e(c,u,h,f){let p;do p=i(f);while(c.hasNode(p));return h.dummy=u,c.setNode(p,h),p}Cf={addBorderNode:function(c,u,h,f){let p={width:0,height:0};return arguments.length>=4&&(p.rank=h,p.order=f),e(c,"border",p,u)},addDummyNode:e,applyWithChunking:o,asNonCompoundGraph:function(c){let u=new t({multigraph:c.isMultigraph()}).setGraph(c.graph());return c.nodes().forEach(h=>{c.children(h).length||u.setNode(h,c.node(h))}),c.edges().forEach(h=>{u.setEdge(h,c.edge(h))}),u},buildLayerMatrix:function(c){let u=a(r(c)+1).map(()=>[]);return c.nodes().forEach(h=>{let f=c.node(h),p=f.rank;p!==void 0&&(u[p][f.order]=h)}),u},intersectRect:function(c,u){let h,f,p=c.x,_=c.y,g=u.x-p,m=u.y-_,b=c.width/2,y=c.height/2;if(!g&&!m)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(m)*b>Math.abs(g)*y?(m<0&&(y=-y),h=y*g/m,f=y):(g<0&&(b=-b),h=b,f=b*m/g),{x:p+h,y:_+f}},mapValues:function(c,u){let h=u;return typeof u=="string"&&(h=f=>f[u]),Object.entries(c).reduce((f,[p,_])=>(f[p]=h(_,p),f),{})},maxRank:r,normalizeRanks:function(c){let u=c.nodes().map(f=>{let p=c.node(f).rank;return p===void 0?Number.MAX_VALUE:p}),h=o(Math.min,u);c.nodes().forEach(f=>{let p=c.node(f);Object.hasOwn(p,"rank")&&(p.rank-=h)})},notime:function(c,u){return u()},partition:function(c,u){let h={lhs:[],rhs:[]};return c.forEach(f=>{u(f)?h.lhs.push(f):h.rhs.push(f)}),h},pick:function(c,u){const h={};for(const f of u)c[f]!==void 0&&(h[f]=c[f]);return h},predecessorWeights:function(c){let u=c.nodes().map(h=>{let f={};return c.inEdges(h).forEach(p=>{f[p.v]=(f[p.v]||0)+c.edge(p).weight}),f});return l(c.nodes(),u)},range:a,removeEmptyRanks:function(c){let u=c.nodes().map(g=>c.node(g).rank),h=o(Math.min,u),f=[];c.nodes().forEach(g=>{let m=c.node(g).rank-h;f[m]||(f[m]=[]),f[m].push(g)});let p=0,_=c.graph().nodeRankFactor;Array.from(f).forEach((g,m)=>{g===void 0&&m%_!==0?--p:g!==void 0&&p&&g.forEach(b=>c.node(b).rank+=p)})},simplify:function(c){let u=new t().setGraph(c.graph());return c.nodes().forEach(h=>u.setNode(h,c.node(h))),c.edges().forEach(h=>{let f=u.edge(h.v,h.w)||{weight:0,minlen:1},p=c.edge(h);u.setEdge(h.v,h.w,{weight:f.weight+p.weight,minlen:Math.max(f.minlen,p.minlen)})}),u},successorWeights:function(c){let u=c.nodes().map(h=>{let f={};return c.outEdges(h).forEach(p=>{f[p.w]=(f[p.w]||0)+c.edge(p).weight}),f});return l(c.nodes(),u)},time:function(c,u){let h=Date.now();try{return u()}finally{console.log(c+" time: "+(Date.now()-h)+"ms")}},uniqueId:i,zipObject:l};const n=65535;function o(c,u){if(u.length>n){const h=function(f,p=n){const _=[];for(let g=0;g<f.length;g+=p){const m=f.slice(g,g+p);_.push(m)}return _}(u);return c.apply(null,h.map(f=>c.apply(null,f)))}return c.apply(null,u)}function r(c){const u=c.nodes().map(h=>{let f=c.node(h).rank;return f===void 0?Number.MIN_VALUE:f});return o(Math.max,u)}let s=0;function i(c){var u=++s;return toString(c)+u}function a(c,u,h=1){u==null&&(u=c,c=0);let f=_=>_<u;h<0&&(f=_=>u<_);const p=[];for(let _=c;f(_);_+=h)p.push(_);return p}function l(c,u){return c.reduce((h,f,p)=>(h[f]=u[p],h),{})}return Cf}function oL(){if(mk)return Nf;mk=1;let t=nL(),e=Ot().uniqueId;return Nf={run:function(n){(n.graph().acyclicer==="greedy"?t(n,function(r){return s=>r.edge(s).weight}(n)):function(r){let s=[],i={},a={};function l(c){Object.hasOwn(a,c)||(a[c]=!0,i[c]=!0,r.outEdges(c).forEach(u=>{Object.hasOwn(i,u.w)?s.push(u):l(u.w)}),delete i[c])}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)}})}},Nf}function rL(){if(gk)return jf;gk=1;let t=Ot();return jf={run:function(e){e.graph().dummyChains=[],e.edges().forEach(n=>function(o,r){let s,i,a,l=r.v,c=o.node(l).rank,u=r.w,h=o.node(u).rank,f=r.name,p=o.edge(r),_=p.labelRank;if(h!==c+1){for(o.removeEdge(r),a=0,++c;c<h;++a,++c)p.points=[],i={width:0,height:0,edgeLabel:p,edgeObj:r,rank:c},s=t.addDummyNode(o,"edge",i,"_d"),c===_&&(i.width=p.width,i.height=p.height,i.dummy="edge-label",i.labelpos=p.labelpos),o.setEdge(l,s,{weight:p.weight},f),a===0&&o.graph().dummyChains.push(s),l=s;o.setEdge(l,u,{weight:p.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)})}},jf}function $l(){if(_k)return Ef;_k=1;const{applyWithChunking:t}=Ot();return Ef={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 i=e.outEdges(r).map(l=>l==null?Number.POSITIVE_INFINITY:o(l.w)-e.edge(l).minlen);var a=t(Math.min,i);return a===Number.POSITIVE_INFINITY&&(a=0),s.rank=a})},slack:function(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen}},Ef}function Xk(){if(bk)return If;bk=1;var t=qn().Graph,e=$l().slack;function n(s,i){return s.nodes().forEach(function a(l){i.nodeEdges(l).forEach(c=>{var u=c.v,h=l===u?c.w:u;s.hasNode(h)||e(i,c)||(s.setNode(h,{}),s.setEdge(l,h,{}),a(h))})}),s.nodeCount()}function o(s,i){return i.edges().reduce((a,l)=>{let c=Number.POSITIVE_INFINITY;return s.hasNode(l.v)!==s.hasNode(l.w)&&(c=e(i,l)),c<a[0]?[c,l]:a},[Number.POSITIVE_INFINITY,null])[1]}function r(s,i,a){s.nodes().forEach(l=>i.node(l).rank+=a)}return If=function(s){var i,a,l=new t({directed:!1}),c=s.nodes()[0],u=s.nodeCount();for(l.setNode(c,{});n(l,s)<u;)i=o(l,s),a=l.hasNode(i.v)?e(s,i):-e(s,i),r(l,s,a);return l},If}function sL(){if(yk)return Af;yk=1;var t=Xk(),e=$l().slack,n=$l().longestPath,o=qn().alg.preorder,r=qn().alg.postorder,s=Ot().simplify;function i(g){g=s(g),n(g);var m,b=t(g);for(c(b),a(b,g);m=h(b);)p(b,g,m,f(b,g,m))}function a(g,m){var b=r(g,g.nodes());(b=b.slice(0,b.length-1)).forEach(y=>function(x,v,C){var k=x.node(C),j=k.parent;x.edge(C,j).cutvalue=l(x,v,C)}(g,m,y))}function l(g,m,b){var y=g.node(b).parent,x=!0,v=m.edge(b,y),C=0;return v||(x=!1,v=m.edge(y,b)),C=v.weight,m.nodeEdges(b).forEach(k=>{var j,N,I=k.v===b,A=I?k.w:k.v;if(A!==y){var T=I===x,R=m.edge(k).weight;if(C+=T?R:-R,j=b,N=A,g.hasEdge(j,N)){var z=g.edge(b,A).cutvalue;C+=T?-z:z}}}),C}function c(g,m){arguments.length<2&&(m=g.nodes()[0]),u(g,{},1,m)}function u(g,m,b,y,x){var v=b,C=g.node(y);return m[y]=!0,g.neighbors(y).forEach(k=>{Object.hasOwn(m,k)||(b=u(g,m,b,k,y))}),C.low=v,C.lim=b++,x?C.parent=x:delete C.parent,b}function h(g){return g.edges().find(m=>g.edge(m).cutvalue<0)}function f(g,m,b){var y=b.v,x=b.w;m.hasEdge(y,x)||(y=b.w,x=b.v);var v=g.node(y),C=g.node(x),k=v,j=!1;v.lim>C.lim&&(k=C,j=!0);var N=m.edges().filter(I=>j===_(g,g.node(I.v),k)&&j!==_(g,g.node(I.w),k));return N.reduce((I,A)=>e(m,A)<e(m,I)?A:I)}function p(g,m,b,y){var x=b.v,v=b.w;g.removeEdge(x,v),g.setEdge(y.v,y.w,{}),c(g),a(g,m),function(C,k){var j=C.nodes().find(I=>!k.node(I).parent),N=o(C,j);(N=N.slice(1)).forEach(I=>{var A=C.node(I).parent,T=k.edge(I,A),R=!1;T||(T=k.edge(A,I),R=!0),k.node(I).rank=k.node(A).rank+(R?T.minlen:-T.minlen)})}(g,m)}function _(g,m,b){return b.low<=m.lim&&m.lim<=b.lim}return Af=i,i.initLowLimValues=c,i.initCutValues=a,i.calcCutValue=l,i.leaveEdge=h,i.enterEdge=f,i.exchangeEdges=p,Af}function iL(){if(xk)return Tf;xk=1;var t=$l().longestPath,e=Xk(),n=sL();Tf=function(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)}};var o=t;function r(s){n(s)}return Tf}function aL(){return wk||(wk=1,Mf=function(t){let e=function(n){let o={},r=0;function s(i){let a=r;n.children(i).forEach(s),o[i]={low:a,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,p,_){let g,m,b=[],y=[],x=Math.min(f[p].low,f[_].low),v=Math.max(f[p].lim,f[_].lim);g=p;do g=h.parent(g),b.push(g);while(g&&(f[g].low>x||v>f[g].lim));for(m=g,g=_;(g=h.parent(g))!==m;)y.push(g);return{path:b.concat(y.reverse()),lca:m}}(t,e,r.v,r.w),i=s.path,a=s.lca,l=0,c=i[l],u=!0;for(;n!==r.w;){if(o=t.node(n),u){for(;(c=i[l])!==a&&t.node(c).maxRank<o.rank;)l++;c===a&&(u=!1)}if(!u){for(;l<i.length-1&&t.node(c=i[l+1]).minRank<=o.rank;)l++;c=i[l]}t.setParent(n,c),n=t.successors(n)[0]}})}),Mf}function lL(){if(vk)return Of;vk=1;let t=Ot();function e(n,o,r,s,i,a,l){let c=n.children(l);if(!c.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,c.forEach(p=>{e(n,o,r,s,i,a,p);let _=n.node(p),g=_.borderTop?_.borderTop:p,m=_.borderBottom?_.borderBottom:p,b=_.borderTop?s:2*s,y=g!==m?1:i-a[l]+1;n.setEdge(u,g,{weight:b,minlen:y,nestingEdge:!0}),n.setEdge(m,h,{weight:b,minlen:y,nestingEdge:!0})}),n.parent(l)||n.setEdge(o,u,{weight:0,minlen:i+a[l]})}return Of={run:function(n){let o=t.addDummyNode(n,"root",{},"_root"),r=function(c){var u={};function h(f,p){var _=c.children(f);_&&_.length&&_.forEach(g=>h(g,p+1)),u[f]=p}return c.children().forEach(f=>h(f,1)),u}(n),s=Object.values(r),i=t.applyWithChunking(Math.max,s)-1,a=2*i+1;n.graph().nestingRoot=o,n.edges().forEach(c=>n.edge(c).minlen*=a);let l=function(c){return c.edges().reduce((u,h)=>u+c.edge(h).weight,0)}(n)+1;n.children().forEach(c=>e(n,o,a,l,i,r,c)),n.graph().nodeRankFactor=a},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)})}},Of}function cL(){if(Sk)return Rf;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 Sk=1,Rf={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(i){i.nodes().forEach(a=>n(i.node(a))),i.edges().forEach(a=>{let l=i.edge(a);l.points.forEach(n),Object.hasOwn(l,"y")&&n(l)})}(r),s!=="lr"&&s!=="rl"||(function(i){i.nodes().forEach(a=>o(i.node(a))),i.edges().forEach(a=>{let l=i.edge(a);l.points.forEach(o),Object.hasOwn(l,"x")&&o(l)})}(r),t(r))}},Rf}function dL(){if(Ak)return Ik;Ak=1;let t=Ot();return Ik=function(e,n){let o={};return e.forEach((r,s)=>{let i=o[r.v]={indegree:0,in:[],out:[],vs:[r.v],i:s};r.barycenter!==void 0&&(i.barycenter=r.barycenter,i.weight=r.weight)}),n.edges().forEach(r=>{let s=o[r.v],i=o[r.w];s!==void 0&&i!==void 0&&(i.indegree++,s.out.push(o[r.w]))}),function(r){let s=[];function i(l){return c=>{c.merged||(c.barycenter===void 0||l.barycenter===void 0||c.barycenter>=l.barycenter)&&function(u,h){let f=0,p=0;u.weight&&(f+=u.barycenter*u.weight,p+=u.weight),h.weight&&(f+=h.barycenter*h.weight,p+=h.weight),u.vs=h.vs.concat(u.vs),u.barycenter=f/p,u.weight=p,u.i=Math.min(h.i,u.i),h.merged=!0}(l,c)}}function a(l){return c=>{c.in.push(l),--c.indegree===0&&r.push(c)}}for(;r.length;){let l=r.pop();s.push(l),l.in.reverse().forEach(i(l)),l.out.forEach(a(l))}return s.filter(l=>!l.merged).map(l=>t.pick(l,["vs","i","barycenter","weight"]))}(Object.values(o).filter(r=>!r.indegree))}}function uL(){if(Ok)return Ff;Ok=1;let t=(Ek||(Ek=1,jk=function(o,r=[]){return r.map(s=>{let i=o.inEdges(s);if(i.length){let a=i.reduce((l,c)=>{let u=o.edge(c),h=o.node(c.v);return{sum:l.sum+u.weight*h.order,weight:l.weight+u.weight}},{sum:0,weight:0});return{v:s,barycenter:a.sum/a.weight,weight:a.weight}}return{v:s}})}),jk),e=dL(),n=function(){if(Mk)return Tk;Mk=1;let o=Ot();function r(s,i,a){let l;for(;i.length&&(l=i[i.length-1]).i<=a;)i.pop(),s.push(l.vs),a++;return a}return Tk=function(s,i){let a=o.partition(s,m=>Object.hasOwn(m,"barycenter")),l=a.lhs,c=a.rhs.sort((m,b)=>b.i-m.i),u=[],h=0,f=0,p=0;var _;l.sort((_=!!i,(m,b)=>m.barycenter<b.barycenter?-1:m.barycenter>b.barycenter?1:_?b.i-m.i:m.i-b.i)),p=r(u,c,p),l.forEach(m=>{p+=m.vs.length,u.push(m.vs),h+=m.barycenter*m.weight,f+=m.weight,p=r(u,c,p)});let g={vs:u.flat(!0)};return f&&(g.barycenter=h/f,g.weight=f),g}}();return Ff=function o(r,s,i,a){let l=r.children(s),c=r.node(s),u=c?c.borderLeft:void 0,h=c?c.borderRight:void 0,f={};u&&(l=l.filter(m=>m!==u&&m!==h));let p=t(r,l);p.forEach(m=>{if(r.children(m.v).length){let x=o(r,m.v,i,a);f[m.v]=x,Object.hasOwn(x,"barycenter")&&(y=x,(b=m).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 _=e(p,i);(function(m,b){m.forEach(y=>{y.vs=y.vs.flatMap(x=>b[x]?b[x].vs:x)})})(_,f);let g=n(_,a);if(u&&(g.vs=[u,g.vs,h].flat(!0),r.predecessors(u).length)){let m=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+m.order+b.order)/(g.weight+2),g.weight+=2}return g},Ff}function hL(){if(Dk)return zf;Dk=1;let t=qn().Graph,e=Ot();return zf=function(n,o,r){let s=function(a){for(var l;a.hasNode(l=e.uniqueId("_root")););return l}(n),i=new t({compound:!0}).setGraph({root:s}).setDefaultNodeLabel(a=>n.node(a));return n.nodes().forEach(a=>{let l=n.node(a),c=n.parent(a);(l.rank===o||l.minRank<=o&&o<=l.maxRank)&&(i.setNode(a),i.setParent(a,c||s),n[r](a).forEach(u=>{let h=u.v===a?u.w:u.v,f=i.edge(h,a),p=f!==void 0?f.weight:0;i.setEdge(h,a,{weight:n.edge(u).weight+p})}),Object.hasOwn(l,"minRank")&&i.setNode(a,{borderLeft:l.borderLeft[o],borderRight:l.borderRight[o]}))}),i},zf}function fL(){if(Lk)return Bf;Lk=1;let t=function(){if(Ck)return Pf;Ck=1;let u=Ot();return Pf=function(h){let f={},p=h.nodes().filter(y=>!h.children(y).length),_=p.map(y=>h.node(y).rank),g=u.applyWithChunking(Math.max,_),m=u.range(g+1).map(()=>[]);function b(y){if(f[y])return;f[y]=!0;let x=h.node(y);m[x.rank].push(y),h.successors(y).forEach(b)}return p.sort((y,x)=>h.node(y).rank-h.node(x).rank).forEach(b),m},Pf}(),e=function(){if(Nk)return Lf;Nk=1;let u=Ot().zipObject;function h(f,p,_){let g=u(_,_.map((C,k)=>k)),m=p.flatMap(C=>f.outEdges(C).map(k=>({pos:g[k.w],weight:f.edge(k).weight})).sort((k,j)=>k.pos-j.pos)),b=1;for(;b<_.length;)b<<=1;let y=2*b-1;b-=1;let x=new Array(y).fill(0),v=0;return m.forEach(C=>{let k=C.pos+b;x[k]+=C.weight;let j=0;for(;k>0;)k%2&&(j+=x[k+1]),k=k-1>>1,x[k]+=C.weight;v+=C.weight*j}),v}return Lf=function(f,p){let _=0;for(let g=1;g<p.length;++g)_+=h(f,p[g-1],p[g]);return _},Lf}(),n=uL(),o=hL(),r=(Pk||(Pk=1,Rk=function(u,h,f){let p,_={};f.forEach(g=>{let m,b,y=u.parent(g);for(;y;){if(m=u.parent(y),m?(b=_[m],_[m]=y):(b=p,p=y),b&&b!==y)return void h.setEdge(b,y);y=m}})}),Rk),s=qn().Graph,i=Ot();function a(u,h,f){return h.map(function(p){return o(u,p,f)})}function l(u,h){let f=new s;u.forEach(function(p){let _=p.graph().root,g=n(p,_,f,h);g.vs.forEach((m,b)=>p.node(m).order=b),r(p,f,g.vs)})}function c(u,h){Object.values(h).forEach(f=>f.forEach((p,_)=>u.node(p).order=_))}return Bf=function u(h,f){if(f&&typeof f.customOrder=="function")return void f.customOrder(h,u);let p=i.maxRank(h),_=a(h,i.range(1,p+1),"inEdges"),g=a(h,i.range(p-1,-1,-1),"outEdges"),m=t(h);if(c(h,m),f&&f.disableOptimalOrderHeuristic)return;let b,y=Number.POSITIVE_INFINITY;for(let x=0,v=0;v<4;++x,++v){l(x%2?_:g,x%4>=2),m=i.buildLayerMatrix(h);let C=e(h,m);C<y&&(v=0,b=Object.assign({},m),y=C)}c(h,b)},Bf}function pL(){if(Fk)return Uf;Fk=1;let t=qn().Graph,e=Ot();function n(h,f){let p={};return f.length&&f.reduce(function(_,g){let m=0,b=0,y=_.length,x=g[g.length-1];return g.forEach((v,C)=>{let k=function(N,I){if(N.node(I).dummy)return N.predecessors(I).find(A=>N.node(A).dummy)}(h,v),j=k?h.node(k).order:y;(k||v===x)&&(g.slice(b,C+1).forEach(N=>{h.predecessors(N).forEach(I=>{let A=h.node(I),T=A.order;!(T<m||j<T)||A.dummy&&h.node(N).dummy||r(p,I,N)})}),b=C+1,m=j)}),g}),p}function o(h,f){let p={};function _(g,m,b,y,x){let v;e.range(m,b).forEach(C=>{v=g[C],h.node(v).dummy&&h.predecessors(v).forEach(k=>{let j=h.node(k);j.dummy&&(j.order<y||j.order>x)&&r(p,k,v)})})}return f.length&&f.reduce(function(g,m){let b,y=-1,x=0;return m.forEach((v,C)=>{if(h.node(v).dummy==="border"){let k=h.predecessors(v);k.length&&(b=h.node(k[0]).order,_(m,x,C,y,b),x=C,y=b)}_(m,x,m.length,b,g.length)}),m}),p}function r(h,f,p){if(f>p){let g=f;f=p,p=g}let _=h[f];_||(h[f]=_={}),_[p]=!0}function s(h,f,p){if(f>p){let _=f;f=p,p=_}return!!h[f]&&Object.hasOwn(h[f],p)}function i(h,f,p,_){let g={},m={},b={};return f.forEach(y=>{y.forEach((x,v)=>{g[x]=x,m[x]=x,b[x]=v})}),f.forEach(y=>{let x=-1;y.forEach(v=>{let C=_(v);if(C.length){C=C.sort((j,N)=>b[j]-b[N]);let k=(C.length-1)/2;for(let j=Math.floor(k),N=Math.ceil(k);j<=N;++j){let I=C[j];m[v]===v&&x<b[I]&&!s(p,v,I)&&(m[I]=v,m[v]=g[v]=g[I],x=b[I])}}})}),{root:g,align:m}}function a(h,f,p,_,g){let m={},b=function(v,C,k,j){let N=new t,I=v.graph(),A=function(T,R,z){return(D,F,B)=>{let U,O=D.node(F),S=D.node(B),$=0;if($+=O.width/2,Object.hasOwn(O,"labelpos"))switch(O.labelpos.toLowerCase()){case"l":U=-O.width/2;break;case"r":U=O.width/2}if(U&&($+=z?U:-U),U=0,$+=(O.dummy?R:T)/2,$+=(S.dummy?R:T)/2,$+=S.width/2,Object.hasOwn(S,"labelpos"))switch(S.labelpos.toLowerCase()){case"l":U=S.width/2;break;case"r":U=-S.width/2}return U&&($+=z?U:-U),U=0,$}}(I.nodesep,I.edgesep,j);return C.forEach(T=>{let R;T.forEach(z=>{let D=k[z];if(N.setNode(D),R){var F=k[R],B=N.edge(F,D);N.setEdge(F,D,Math.max(A(v,z,R),B||0))}R=z})}),N}(h,f,p,g),y=g?"borderLeft":"borderRight";function x(v,C){let k=b.nodes(),j=k.pop(),N={};for(;j;)N[j]?v(j):(N[j]=!0,k.push(j),k=k.concat(C(j))),j=k.pop()}return x(function(v){m[v]=b.inEdges(v).reduce((C,k)=>Math.max(C,m[k.v]+b.edge(k)),0)},b.predecessors.bind(b)),x(function(v){let C=b.outEdges(v).reduce((j,N)=>Math.min(j,m[N.w]-b.edge(N)),Number.POSITIVE_INFINITY),k=h.node(v);C!==Number.POSITIVE_INFINITY&&k.borderType!==y&&(m[v]=Math.max(m[v],C))},b.successors.bind(b)),Object.keys(_).forEach(v=>m[v]=m[p[v]]),m}function l(h,f){return Object.values(f).reduce((p,_)=>{let g=Number.NEGATIVE_INFINITY,m=Number.POSITIVE_INFINITY;Object.entries(_).forEach(([y,x])=>{let v=function(C,k){return C.node(k).width}(h,y)/2;g=Math.max(x+v,g),m=Math.min(x-v,m)});const b=g-m;return b<p[0]&&(p=[b,_]),p},[Number.POSITIVE_INFINITY,null])[1]}function c(h,f){let p=Object.values(f),_=e.applyWithChunking(Math.min,p),g=e.applyWithChunking(Math.max,p);["u","d"].forEach(m=>{["l","r"].forEach(b=>{let y=m+b,x=h[y];if(x===f)return;let v=Object.values(x),C=_-e.applyWithChunking(Math.min,v);b!=="l"&&(C=g-e.applyWithChunking(Math.max,v)),C&&(h[y]=e.mapValues(x,k=>k+C))})})}function u(h,f){return e.mapValues(h.ul,(p,_)=>{if(f)return h[f.toLowerCase()][_];{let g=Object.values(h).map(m=>m[_]).sort((m,b)=>m-b);return(g[1]+g[2])/2}})}return Uf={positionX:function(h){let f,p=e.buildLayerMatrix(h),_=Object.assign(n(h,p),o(h,p)),g={};["u","d"].forEach(b=>{f=b==="u"?p:Object.values(p).reverse(),["l","r"].forEach(y=>{y==="r"&&(f=f.map(k=>Object.values(k).reverse()));let x=(b==="u"?h.predecessors:h.successors).bind(h),v=i(h,f,_,x),C=a(h,f,v.root,v.align,y==="r");y==="r"&&(C=e.mapValues(C,k=>-k)),g[b+y]=C})});let m=l(h,g);return c(g,m),u(g,h.graph().align)},findType1Conflicts:n,findType2Conflicts:o,addConflict:r,hasConflict:s,verticalAlignment:i,horizontalCompaction:a,alignCoordinates:c,findSmallestWidthAlignment:l,balance:u},Uf}function mL(){if(zk)return Vf;zk=1;let t=Ot(),e=pL().positionX;return Vf=function(n){n=t.asNonCompoundGraph(n),function(o){let r=t.buildLayerMatrix(o),s=o.graph().ranksep,i=0;r.forEach(a=>{const l=a.reduce((c,u)=>{const h=o.node(u).height;return c>h?c:h},0);a.forEach(c=>o.node(c).y=i+l/2),i+=l+s})}(n),Object.entries(e(n)).forEach(([o,r])=>n.node(o).x=r)},Vf}function gL(){if(Bk)return $f;Bk=1;let t=oL(),e=rL(),n=iL(),o=Ot().normalizeRanks,r=aL(),s=Ot().removeEmptyRanks,i=lL(),a=function(){if(kk)return Df;kk=1;let j=Ot();function N(I,A,T,R,z,D){let F={width:0,height:0,rank:D,borderType:A},B=z[A][D-1],U=j.addDummyNode(I,"border",F,T);z[A][D]=U,I.setParent(U,R),B&&I.setEdge(B,U,{weight:1})}return Df=function(I){I.children().forEach(function A(T){let R=I.children(T),z=I.node(T);if(R.length&&R.forEach(A),Object.hasOwn(z,"minRank")){z.borderLeft=[],z.borderRight=[];for(let D=z.minRank,F=z.maxRank+1;D<F;++D)N(I,"borderLeft","_bl",T,z,D),N(I,"borderRight","_br",T,z,D)}})},Df}(),l=cL(),c=fL(),u=mL(),h=Ot(),f=qn().Graph;$f=function(j,N){let I=N&&N.debugTiming?h.time:h.notime;I("layout",()=>{let A=I(" buildLayoutGraph",()=>function(T){let R=new f({multigraph:!0,compound:!0}),z=k(T.graph());return R.setGraph(Object.assign({},_,C(z,p),h.pick(z,g))),T.nodes().forEach(D=>{const F=C(k(T.node(D)),m);Object.keys(b).forEach(B=>{F[B]===void 0&&(F[B]=b[B])}),R.setNode(D,F),R.setParent(D,T.parent(D))}),T.edges().forEach(D=>{let F=k(T.edge(D));R.setEdge(D,Object.assign({},x,C(F,y),h.pick(F,v)))}),R}(j));I(" runLayout",()=>function(T,R,z){R(" makeSpaceForEdgeLabels",()=>function(D){let F=D.graph();F.ranksep/=2,D.edges().forEach(B=>{let U=D.edge(B);U.minlen*=2,U.labelpos.toLowerCase()!=="c"&&(F.rankdir==="TB"||F.rankdir==="BT"?U.width+=U.labeloffset:U.height+=U.labeloffset)})}(T)),R(" removeSelfEdges",()=>function(D){D.edges().forEach(F=>{if(F.v===F.w){var B=D.node(F.v);B.selfEdges||(B.selfEdges=[]),B.selfEdges.push({e:F,label:D.edge(F)}),D.removeEdge(F)}})}(T)),R(" acyclic",()=>t.run(T)),R(" nestingGraph.run",()=>i.run(T)),R(" rank",()=>n(h.asNonCompoundGraph(T))),R(" injectEdgeLabelProxies",()=>function(D){D.edges().forEach(F=>{let B=D.edge(F);if(B.width&&B.height){let U=D.node(F.v),O={rank:(D.node(F.w).rank-U.rank)/2+U.rank,e:F};h.addDummyNode(D,"edge-proxy",O,"_ep")}})}(T)),R(" removeEmptyRanks",()=>s(T)),R(" nestingGraph.cleanup",()=>i.cleanup(T)),R(" normalizeRanks",()=>o(T)),R(" assignRankMinMax",()=>function(D){let F=0;D.nodes().forEach(B=>{let U=D.node(B);U.borderTop&&(U.minRank=D.node(U.borderTop).rank,U.maxRank=D.node(U.borderBottom).rank,F=Math.max(F,U.maxRank))}),D.graph().maxRank=F}(T)),R(" removeEdgeLabelProxies",()=>function(D){D.nodes().forEach(F=>{let B=D.node(F);B.dummy==="edge-proxy"&&(D.edge(B.e).labelRank=B.rank,D.removeNode(F))})}(T)),R(" normalize.run",()=>e.run(T)),R(" parentDummyChains",()=>r(T)),R(" addBorderSegments",()=>a(T)),R(" order",()=>c(T,z)),R(" insertSelfEdges",()=>function(D){var F=h.buildLayerMatrix(D);F.forEach(B=>{var U=0;B.forEach((O,S)=>{var $=D.node(O);$.order=S+U,($.selfEdges||[]).forEach(E=>{h.addDummyNode(D,"selfedge",{width:E.label.width,height:E.label.height,rank:$.rank,order:S+ ++U,e:E.e,label:E.label},"_se")}),delete $.selfEdges})})}(T)),R(" adjustCoordinateSystem",()=>l.adjust(T)),R(" position",()=>u(T)),R(" positionSelfEdges",()=>function(D){D.nodes().forEach(F=>{var B=D.node(F);if(B.dummy==="selfedge"){var U=D.node(B.e.v),O=U.x+U.width/2,S=U.y,$=B.x-O,E=U.height/2;D.setEdge(B.e,B.label),D.removeNode(F),B.label.points=[{x:O+2*$/3,y:S-E},{x:O+5*$/6,y:S-E},{x:O+$,y:S},{x:O+5*$/6,y:S+E},{x:O+2*$/3,y:S+E}],B.label.x=B.x,B.label.y=B.y}})}(T)),R(" removeBorderNodes",()=>function(D){D.nodes().forEach(F=>{if(D.children(F).length){let B=D.node(F),U=D.node(B.borderTop),O=D.node(B.borderBottom),S=D.node(B.borderLeft[B.borderLeft.length-1]),$=D.node(B.borderRight[B.borderRight.length-1]);B.width=Math.abs($.x-S.x),B.height=Math.abs(O.y-U.y),B.x=S.x+B.width/2,B.y=U.y+B.height/2}}),D.nodes().forEach(F=>{D.node(F).dummy==="border"&&D.removeNode(F)})}(T)),R(" normalize.undo",()=>e.undo(T)),R(" fixupEdgeLabelCoords",()=>function(D){D.edges().forEach(F=>{let B=D.edge(F);if(Object.hasOwn(B,"x"))switch(B.labelpos!=="l"&&B.labelpos!=="r"||(B.width-=B.labeloffset),B.labelpos){case"l":B.x-=B.width/2+B.labeloffset;break;case"r":B.x+=B.width/2+B.labeloffset}})}(T)),R(" undoCoordinateSystem",()=>l.undo(T)),R(" translateGraph",()=>function(D){let F=Number.POSITIVE_INFINITY,B=0,U=Number.POSITIVE_INFINITY,O=0,S=D.graph(),$=S.marginx||0,E=S.marginy||0;function W(G){let q=G.x,Y=G.y,Q=G.width,re=G.height;F=Math.min(F,q-Q/2),B=Math.max(B,q+Q/2),U=Math.min(U,Y-re/2),O=Math.max(O,Y+re/2)}D.nodes().forEach(G=>W(D.node(G))),D.edges().forEach(G=>{let q=D.edge(G);Object.hasOwn(q,"x")&&W(q)}),F-=$,U-=E,D.nodes().forEach(G=>{let q=D.node(G);q.x-=F,q.y-=U}),D.edges().forEach(G=>{let q=D.edge(G);q.points.forEach(Y=>{Y.x-=F,Y.y-=U}),Object.hasOwn(q,"x")&&(q.x-=F),Object.hasOwn(q,"y")&&(q.y-=U)}),S.width=B-F+$,S.height=O-U+E}(T)),R(" assignNodeIntersects",()=>function(D){D.edges().forEach(F=>{let B,U,O=D.edge(F),S=D.node(F.v),$=D.node(F.w);O.points?(B=O.points[0],U=O.points[O.points.length-1]):(O.points=[],B=$,U=S),O.points.unshift(h.intersectRect(S,B)),O.points.push(h.intersectRect($,U))})}(T)),R(" reversePoints",()=>function(D){D.edges().forEach(F=>{let B=D.edge(F);B.reversed&&B.points.reverse()})}(T)),R(" acyclic.undo",()=>t.undo(T))}(A,I,N)),I(" updateInputGraph",()=>function(T,R){T.nodes().forEach(z=>{let D=T.node(z),F=R.node(z);D&&(D.x=F.x,D.y=F.y,D.rank=F.rank,R.children(z).length&&(D.width=F.width,D.height=F.height))}),T.edges().forEach(z=>{let D=T.edge(z),F=R.edge(z);D.points=F.points,Object.hasOwn(F,"x")&&(D.x=F.x,D.y=F.y)}),T.graph().width=R.graph().width,T.graph().height=R.graph().height}(j,A))})};let p=["nodesep","edgesep","ranksep","marginx","marginy"],_={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},g=["acyclicer","ranker","rankdir","align"],m=["width","height"],b={width:0,height:0},y=["minlen","weight","width","height","labeloffset"],x={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},v=["labelpos"];function C(j,N){return h.mapValues(h.pick(j,N),Number)}function k(j){var N={};return j&&Object.entries(j).forEach(([I,A])=>{typeof I=="string"&&(I=I.toLowerCase()),N[I]=A}),N}return $f}function _L(){if(Uk)return Hf;Uk=1;let t=Ot(),e=qn().Graph;return Hf={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,i)=>{let a="layer"+i;r.setNode(a,{rank:"same"}),s.reduce((l,c)=>(r.setEdge(l,c,{style:"invis"}),c))}),r}},Hf}var Zk=Wk?Hk:(Wk=1,Hk={graphlib:qn(),layout:gL(),debug:_L(),util:{time:Ot().time,notime:Ot().notime},version:$k?Vk:($k=1,Vk="1.1.4")});const Bi=new Zk.graphlib.Graph().setDefaultEdgeLabel(()=>({})),Qk=(t,e,n)=>(Bi.setGraph({rankdir:n.direction,nodesep:150,ranksep:200,ranker:"longest-path"}),e.forEach(o=>Bi.setEdge(o.source,o.target)),t.forEach(o=>Bi.setNode(o.id,{...o,width:o.width??0,height:o.height??0})),Zk.layout(Bi),{nodes:t.map(o=>{const{x:r,y:s}=Bi.node(o.id);return{...o,position:{x:r,y:s}}}),edges:e}),e3=new class{createEdge(t,e){return{animated:!0,markerEnd:{type:us.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:sf(ct.get(e).code.trim().split(`
144
- `).length),position:{x:0,y:0}}}createElements(t,e,n,o){const r=[],s=[],i=new Set,a=new Set;for(const l of Object.values(n)){if(l.value==="marimo"&&l.name==="mo")continue;const{declaredBy:c,usedBy:u}=l;for(const h of c)for(const f of u){const p=`${h}-${f}`;a.has(p)||(a.add(p),i.add(h),i.add(f),s.push(this.createEdge(h,f)))}}for(const[l,c]of Lp.zip(t,e)){o||r.push(this.createNode(l,c));const u=i.has(l),h=ct.get(c).code.trim().startsWith("mo.md");!u&&h||r.push(this.createNode(l,c))}return{nodes:r,edges:s}}},bL=t=>{const e=X.c(43),{cellIds:n,variables:o,cellAtoms:r,children:s,layoutDirection:i,settings:a}=t;let l;e[0]!==r||e[1]!==n||e[2]!==i||e[3]!==a.hidePureMarkdown||e[4]!==o?(l=()=>{let S=e3.createElements(n,r,o,a.hidePureMarkdown);return S=Qk(S.nodes,S.edges,{direction:i}),S},e[0]=r,e[1]=n,e[2]=i,e[3]=a.hidePureMarkdown,e[4]=o,e[5]=l):l=e[5];const[c]=M.useState(l),[u,h,f]=M2(c.nodes),[p,_,g]=O2(c.edges),m=Li();let b;e[6]!==i||e[7]!==_||e[8]!==h?(b=S=>{const $=Qk(S.nodes,S.edges,{direction:i});h($.nodes),_($.edges)},e[6]=i,e[7]=_,e[8]=h,e[9]=b):b=e[9];const y=Xe(b);let x,v;e[10]!==r||e[11]!==n||e[12]!==a.hidePureMarkdown||e[13]!==y||e[14]!==o?(x=()=>{y(e3.createElements(n,r,o,a.hidePureMarkdown))},v=[n,o,r,y,a.hidePureMarkdown],e[10]=r,e[11]=n,e[12]=a.hidePureMarkdown,e[13]=y,e[14]=o,e[15]=x,e[16]=v):(x=e[15],v=e[16]),M.useEffect(x,v);const[C,k]=M.useState();let j;B2(),e[17]===Symbol.for("react.memo_cache_sentinel")?(j=()=>{k(void 0)},e[17]=j):j=e[17];const N=j;let I,A,T,R,z,D,F,B,U,O;return e[18]===Symbol.for("react.memo_cache_sentinel")?(I={minZoom:.5,maxZoom:1.5},A=(S,$)=>{k({type:"node",id:$.id})},T=(S,$)=>{const{source:E,target:W}=$;k({type:"edge",source:E,target:W})},e[18]=I,e[19]=A,e[20]=T):(I=e[18],A=e[19],T=e[20]),e[21]===Symbol.for("react.memo_cache_sentinel")?(R=d.jsx(FP,{color:"#ccc",variant:Dn.Dots}),e[21]=R):R=e[21],e[22]!==m||e[23]!==u?(z=()=>{const S=ct.get(r$);if(S){const $=u.find(E=>E.id===S);$&&(m.fitView({padding:1,duration:600,nodes:[$]}),k({type:"node",id:S}))}},e[22]=m,e[23]=u,e[24]=z):z=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(D=d.jsx(xm,{className:"size-4"}),e[25]=D):D=e[25],e[26]!==z?(F=d.jsx(MP,{position:"bottom-right",showInteractive:!1,children:d.jsx(Ae,{content:"Jump to focused cell",delayDuration:200,side:"left",asChild:!1,children:d.jsx(ys,{onMouseDown:Pn.preventFocus,onClick:z,children:D})})}),e[26]=z,e[27]=F):F=e[27],e[28]!==p||e[29]!==C||e[30]!==o?(B=d.jsx(Vl,{selection:C,variables:o,edges:p,onClearSelection:N}),e[28]=p,e[29]=C,e[30]=o,e[31]=B):B=e[31],e[32]!==s||e[33]!==p||e[34]!==u||e[35]!==g||e[36]!==f||e[37]!==F||e[38]!==B?(U=d.jsxs(rf,{nodes:u,edges:p,nodeTypes:F2,minZoom:.2,fitViewOptions:I,onNodeClick:A,onEdgeClick:T,onNodeDoubleClick:yL,fitView:!0,onNodesChange:f,onEdgesChange:g,zoomOnDoubleClick:!1,nodesConnectable:!1,children:[R,F,B,s]}),e[32]=s,e[33]=p,e[34]=u,e[35]=g,e[36]=f,e[37]=F,e[38]=B,e[39]=U):U=e[39],e[40]!==i||e[41]!==U?(O=d.jsx(P2,{value:i,children:U}),e[40]=i,e[41]=U,e[42]=O):O=e[42],O};function yL(t,e){oS(e.id,"focus")}const xL=Ht("_minimap_"),wL=Ht({hidePureMarkdown:!0}),vL=t=>{const e=X.c(11),[n,o]=tn(xL),[r,s]=tn(wL);let i;e[0]!==n||e[1]!==t||e[2]!==o||e[3]!==s||e[4]!==r?(i=()=>n==="_minimap_"?d.jsx($P,{...t,children:d.jsx(lf,{settings:r,onSettingsChange:s,view:n,onChange:o})}):d.jsx(bL,{...t,settings:r,layoutDirection:n,children:d.jsx(lf,{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]=i):i=e[5];const a=i;let l,c;return e[6]!==a?(l=a(),e[6]=a,e[7]=l):l=e[7],e[8]!==n||e[9]!==l?(c=d.jsx(of,{children:l},n),e[8]=n,e[9]=l,e[10]=c):c=e[10],c},kL=()=>{const t=X.c(5),e=rS(),n=Pc(),[o]=s$();let r,s;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=je("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=d.jsx("div",{className:r,children:d.jsx(vL,{cellAtoms:o,variables:e,cellIds:n.inOrderIds})}),t[1]=n.inOrderIds,t[2]=o,t[3]=e,t[4]=s):s=t[4],s},SL=t=>{const e=X.c(4),{isOpen:n,children:o}=t,[r,s]=K.useState(!1);let i,a;return e[0]!==r||e[1]!==n?(i=()=>{n&&!r&&s(!0)},a=[n,r],e[0]=r,e[1]=n,e[2]=i,e[3]=a):(i=e[2],a=e[3]),K.useEffect(i,a),r?o:null},CL=t=>{const e=X.c(8),{variableName:n,className:o}=t;let r;e[0]!==n?(r=()=>{const l=function(u){const h=ct.get(sS)[u];if(h)return h.declaredBy[0]}(n);if(!l)return;const c=Jl(l);c&&zp(c,n)},e[0]=n,e[1]=r):r=e[1];const s=r;let i,a;return e[2]!==o?(i=je("text-link opacity-80 hover:opacity-100 hover:underline",o),e[2]=o,e[3]=i):i=e[3],e[4]!==s||e[5]!==i||e[6]!==n?(a=d.jsx("button",{type:"button",onClick:s,className:i,children:n}),e[4]=s,e[5]=i,e[6]=n,e[7]=a):a=e[7],a},NL=Ht(t=>{const e=t(i$),n=t(sS),o=t(q4);return ua(e,r=>{if(!r.variable_name)return-1;const s=Object.values(n).find(a=>a.name===r.variable_name);if(!s)return 0;const i=o.inOrderIds.indexOf(s.declaredBy[0]);return i===-1?0:i})}),jL=Ht(t=>{const e=new Map(t(a$));for(const n of iS){const o=e.get(n);o&&o.databases.length===0&&e.delete(n)}return ua([...e.values()],n=>iS.has(n.name)?1:0)}),EL=()=>{const t=X.c(32),[e,n]=K.useState(""),o=Kt(aS),r=Be(NL),s=Be(jL);if(r.length===0&&s.length===0){let b;return t[0]===Symbol.for("react.memo_cache_sentinel")?(b=d.jsx(gn,{title:"No tables found",description:"Any datasets/dataframes in the global scope will be shown here.",action:d.jsx(xg,{children:d.jsxs(Te,{variant:"outline",size:"sm",children:["Add database or catalog",d.jsx(ar,{className:"h-4 w-4 ml-2"})]})}),icon:d.jsx(or,{})}),t[0]=b):b=t[0],b}const i=!!e.trim();let a,l,c,u,h,f,p,_,g,m;if(t[1]!==o?(a=b=>{o(b.length>0),n(b)},t[1]=o,t[2]=a):a=t[2],t[3]!==e||t[4]!==a?(l=d.jsx(qi,{placeholder:"Search tables...",className:"h-6 m-1",value:e,onValueChange:a,rootClassName:"flex-1 border-r"}),t[3]=e,t[4]=a,t[5]=l):l=t[5],t[6]!==i?(c=i&&d.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:d.jsx(Jn,{className:"h-4 w-4"})}),t[6]=i,t[7]=c):c=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(u=d.jsx(xg,{children:d.jsx("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:d.jsx(ar,{className:"h-4 w-4"})})}),t[8]=u):u=t[8],t[9]!==l||t[10]!==c?(h=d.jsxs("div",{className:"flex items-center w-full",children:[l,c,u]}),t[9]=l,t[10]=c,t[11]=h):h=t[11],t[12]!==s||t[13]!==i||t[14]!==e){let b;t[16]!==i||t[17]!==e?(b=y=>d.jsx(IL,{connection:y,hasChildren:y.databases.length>0,children:y.databases.map(x=>d.jsx(AL,{engineName:y.name,database:x,hasSearch:i,children:d.jsx(TL,{schemas:x.schemas,defaultSchema:y.default_schema,defaultDatabase:y.default_database,engineName:y.name,databaseName:x.name,hasSearch:i,searchValue:e})},x.name))},y.name),t[16]=i,t[17]=e,t[18]=b):b=t[18],f=s.map(b),t[12]=s,t[13]=i,t[14]=e,t[15]=f}else f=t[15];return t[19]!==s.length||t[20]!==r.length?(p=s.length>0&&r.length>0&&d.jsxs(lS,{children:[d.jsx(Ql,{className:"h-4 w-4 text-muted-foreground"}),d.jsx("span",{className:"text-xs",children:"Python"})]}),t[19]=s.length,t[20]=r.length,t[21]=p):p=t[21],t[22]!==e||t[23]!==r?(_=r.length>0&&d.jsx(t3,{tables:r,searchValue:e}),t[22]=e,t[23]=r,t[24]=_):_=t[24],t[25]!==f||t[26]!==p||t[27]!==_?(g=d.jsxs(jp,{className:"flex flex-col",children:[f,p,_]}),t[25]=f,t[26]=p,t[27]=_,t[28]=g):g=t[28],t[29]!==h||t[30]!==g?(m=d.jsxs(fc,{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]=m):m=t[31],m},IL=t=>{const e=X.c(25),{connection:n,children:o,hasChildren:r}=t,s=n.name===l$,i=s?"In-Memory":n.name,[a,l]=K.useState(!1);let c;e[0]!==n.name?(c=async()=>{l(!0),await d$({engine:n.name}),setTimeout(()=>l(!1),500)},e[0]=n.name,e[1]=c):c=e[1];const u=c;let h,f,p;e[2]!==n.dialect?(h=d.jsx(X3,{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=c$(n.dialect),e[4]=n.dialect,e[5]=f):f=e[5],e[6]!==f?(p=d.jsx("span",{className:"text-xs",children:f}),e[6]=f,e[7]=p):p=e[7];const _=i;let g,m,b,y,x;return e[8]!==_?(g=d.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",d.jsx(CL,{variableName:_}),")"]}),e[8]=_,e[9]=g):g=e[9],e[10]!==u||e[11]!==s||e[12]!==a?(m=!s&&d.jsx(Ae,{content:"Refresh connection",children:d.jsx(Te,{variant:"ghost",size:"icon",className:"ml-auto hover:bg-transparent hover:shadow-none",onClick:u,children:d.jsx(Cc,{className:je("h-4 w-4 text-muted-foreground hover:text-foreground",a&&"animate-[spin_0.5s]")})})}),e[10]=u,e[11]=s,e[12]=a,e[13]=m):m=e[13],e[14]!==h||e[15]!==p||e[16]!==g||e[17]!==m?(b=d.jsxs(lS,{children:[h,p,g,m]}),e[14]=h,e[15]=p,e[16]=g,e[17]=m,e[18]=b):b=e[18],e[19]!==o||e[20]!==r?(y=r?o:d.jsx(Lc,{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?(x=d.jsxs(d.Fragment,{children:[b,y]}),e[22]=b,e[23]=y,e[24]=x):x=e[24],x},AL=t=>{const e=X.c(28),{hasSearch:n,engineName:o,database:r,children:s}=t,[i,a]=K.useState(!1),[l,c]=K.useState(!1);let u,h,f;e[0]!==n?(u=()=>{a(n)},h=[n],e[0]=n,e[1]=u,e[2]=h):(u=e[1],h=e[2]),K.useEffect(u,h),e[3]!==i||e[4]!==l?(f=()=>{a(!i),c(!l)},e[3]=i,e[4]=l,e[5]=f):f=e[5];const p=`${o}:${r.name}`;let _;e[6]!==i?(_=d.jsx(pS,{isExpanded:i}),e[6]=i,e[7]=_):_=e[7];const g=l&&i?"text-foreground":"text-muted-foreground";let m,b;e[8]!==g?(m=je("h-4 w-4",g),e[8]=g,e[9]=m):m=e[9],e[10]!==m?(b=d.jsx(or,{className:m}),e[10]=m,e[11]=b):b=e[11];const y=l&&i&&"font-semibold";let x,v,C,k;e[12]!==y?(x=je(y),e[12]=y,e[13]=x):x=e[13],e[14]!==r.name?(v=r.name===""?d.jsx("i",{children:"Not connected"}):r.name,e[14]=r.name,e[15]=v):v=e[15],e[16]!==x||e[17]!==v?(C=d.jsx("span",{className:x,children:v}),e[16]=x,e[17]=v,e[18]=C):C=e[18],e[19]!==C||e[20]!==f||e[21]!==p||e[22]!==_||e[23]!==b?(k=d.jsxs(lo,{className:"text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",onSelect:f,value:p,children:[_,b,C]}),e[19]=C,e[20]=f,e[21]=p,e[22]=_,e[23]=b,e[24]=k):k=e[24];const j=i&&s;let N;return e[25]!==k||e[26]!==j?(N=d.jsxs(d.Fragment,{children:[k,j]}),e[25]=k,e[26]=j,e[27]=N):N=e[27],N},TL=t=>{const e=X.c(20),{schemas:n,defaultSchema:o,defaultDatabase:r,engineName:s,databaseName:i,hasSearch:a,searchValue:l}=t;if(n.length===0){let h;return e[0]===Symbol.for("react.memo_cache_sentinel")?(h=d.jsx(Lc,{content:"No schemas available",className:"pl-6"}),e[0]=h):h=e[0],h}let c,u;if(e[1]!==i||e[2]!==r||e[3]!==o||e[4]!==s||e[5]!==a||e[6]!==n||e[7]!==l){let h;e[9]!==l?(h=_=>!l||_.tables.some(g=>g.name.toLowerCase().includes(l.toLowerCase())),e[9]=l,e[10]=h):h=e[10];const f=n.filter(h);let p;e[11]!==i||e[12]!==r||e[13]!==o||e[14]!==s||e[15]!==a||e[16]!==l?(p=_=>d.jsx(ML,{databaseName:i,schema:_,hasSearch:a,children:d.jsx(t3,{tables:_.tables,searchValue:l,sqlTableContext:{engine:s,database:i,schema:_.name,defaultSchema:o,defaultDatabase:r}})},_.name),e[11]=i,e[12]=r,e[13]=o,e[14]=s,e[15]=a,e[16]=l,e[17]=p):p=e[17],c=f.map(p),e[1]=i,e[2]=r,e[3]=o,e[4]=s,e[5]=a,e[6]=n,e[7]=l,e[8]=c}else c=e[8];return e[18]!==c?(u=d.jsx(d.Fragment,{children:c}),e[18]=c,e[19]=u):u=e[19],u},ML=t=>{const e=X.c(26),{databaseName:n,schema:o,children:r,hasSearch:s}=t,[i,a]=K.useState(!1),[l,c]=K.useState(!1),u=`${n}:${o.name}`;let h,f,p,_;if(e[0]!==s?(h=()=>{a(s)},f=[s],e[0]=s,e[1]=h,e[2]=f):(h=e[1],f=e[2]),K.useEffect(h,f),fS(o.name))return r;e[3]!==i||e[4]!==l?(p=()=>{a(!i),c(!l)},e[3]=i,e[4]=l,e[5]=p):p=e[5],e[6]!==i?(_=d.jsx(pS,{isExpanded:i}),e[6]=i,e[7]=_):_=e[7];const g=l&&i&&"text-foreground";let m,b;e[8]!==g?(m=je("h-4 w-4 text-muted-foreground",g),e[8]=g,e[9]=m):m=e[9],e[10]!==m?(b=d.jsx(_$,{className:m}),e[10]=m,e[11]=b):b=e[11];const y=l&&i&&"font-semibold";let x,v,C;e[12]!==y?(x=je(y),e[12]=y,e[13]=x):x=e[13],e[14]!==o.name||e[15]!==x?(v=d.jsx("span",{className:x,children:o.name}),e[14]=o.name,e[15]=x,e[16]=v):v=e[16],e[17]!==v||e[18]!==p||e[19]!==_||e[20]!==b||e[21]!==u?(C=d.jsxs(lo,{className:"text-sm flex flex-row gap-1 items-center pl-5 cursor-pointer rounded-none",onSelect:p,value:u,children:[_,b,v]}),e[17]=v,e[18]=p,e[19]=_,e[20]=b,e[21]=u,e[22]=C):C=e[22];const k=i&&r;let j;return e[23]!==C||e[24]!==k?(j=d.jsxs(d.Fragment,{children:[C,k]}),e[23]=C,e[24]=k,e[25]=j):j=e[25],j},t3=t=>{const e=X.c(24),{tables:n,sqlTableContext:o,searchValue:r}=t,{addTableList:s}=cS(),[i,a]=K.useState(!1),[l,c]=K.useState(!1);let u,h;e[0]!==s||e[1]!==o||e[2]!==n.length||e[3]!==i?(u=async()=>{if(n.length===0&&o&&!i){a(!0),c(!0);const{engine:m,database:b,schema:y}=o,x=await UH.request({engine:m,database:b,schema:y});if(!(x!=null&&x.tables))throw c(!1),new Error("No tables available");s({tables:x.tables,sqlTableContext:o}),c(!1)}},e[0]=s,e[1]=o,e[2]=n.length,e[3]=i,e[4]=u):u=e[4],e[5]!==o||e[6]!==n.length||e[7]!==i?(h=[n.length,o,i],e[5]=o,e[6]=n.length,e[7]=i,e[8]=h):h=e[8];const{isPending:f,error:p}=zn(u,h);if(f||l){let m;return e[9]===Symbol.for("react.memo_cache_sentinel")?(m=d.jsx(dS,{message:"Loading tables...",className:"pl-12"}),e[9]=m):m=e[9],m}if(p){let m;return e[10]!==p?(m=d.jsx(uS,{error:p,className:"pl-12"}),e[10]=p,e[11]=m):m=e[11],m}if(n.length===0){let m;return e[12]===Symbol.for("react.memo_cache_sentinel")?(m=d.jsx(Lc,{content:"No tables found",className:"pl-9"}),e[12]=m):m=e[12],m}let _,g;if(e[13]!==r||e[14]!==o||e[15]!==n){let m;e[17]!==r?(m=x=>!r||x.name.toLowerCase().includes(r.toLowerCase()),e[17]=r,e[18]=m):m=e[18];const b=n.filter(m);let y;e[19]!==r||e[20]!==o?(y=x=>d.jsx(OL,{table:x,sqlTableContext:o,isSearching:!!r},x.name),e[19]=r,e[20]=o,e[21]=y):y=e[21],_=b.map(y),e[13]=r,e[14]=o,e[15]=n,e[16]=_}else _=e[16];return e[22]!==_?(g=d.jsx(d.Fragment,{children:_}),e[22]=_,e[23]=g):g=e[23],g},OL=t=>{const e=X.c(63),{table:n,sqlTableContext:o,isSearching:r}=t,{addTable:s}=cS(),[i,a]=K.useState(!1),[l,c]=K.useState(!1),u=n.columns.length>0;let h,f;e[0]!==s||e[1]!==i||e[2]!==o||e[3]!==n.name||e[4]!==u||e[5]!==l?(h=async()=>{if(i&&!u&&o&&!l){c(!0);const{engine:Q,database:re,schema:ae}=o,Z=await VH.request({engine:Q,database:re,schema:ae,tableName:n.name});if(!(Z!=null&&Z.table))throw new Error("No table details available");s({table:Z.table,sqlTableContext:o})}},e[0]=s,e[1]=i,e[2]=o,e[3]=n.name,e[4]=u,e[5]=l,e[6]=h):h=e[6],e[7]!==i||e[8]!==u?(f=[i,u],e[7]=i,e[8]=u,e[9]=f):f=e[9];const{isPending:p,error:_}=zn(h,f),g=Be(Xl),m=As(),{createNewCell:b}=It(),y=hS();let x;e[10]!==y||e[11]!==g||e[12]!==b||e[13]!==m||e[14]!==o||e[15]!==n?(x=()=>{ao(g,b,m),y((()=>{if(n.source_type==="catalog"){const Q=o!=null&&o.database?`${o.database}.${n.name}`:n.name;return`${n.engine}.load_table("${Q}")`}if(o)return mS(n,"*",o);switch(n.source_type){case"local":return`mo.ui.table(${n.name})`;case"duckdb":case"connection":return mS(n,"*",o);default:return ic(n.source_type),""}})())},e[10]=y,e[11]=g,e[12]=b,e[13]=m,e[14]=o,e[15]=n,e[16]=x):x=e[16];const v=x;let C;e[17]!==n.num_columns||e[18]!==n.num_rows?(C=()=>{const Q=[];return n.num_rows!=null&&Q.push(`${n.num_rows} rows`),n.num_columns!=null&&Q.push(`${n.num_columns} columns`),Q.length===0?null:d.jsx("div",{className:"flex flex-row gap-2 items-center pl-6 group-hover:hidden",children:d.jsx("span",{className:"text-xs text-muted-foreground",children:Q.join(", ")})})},e[17]=n.num_columns,e[18]=n.num_rows,e[19]=C):C=e[19];const k=C;let j;e[20]!==_||e[21]!==p||e[22]!==o||e[23]!==n?(j=()=>{if(p)return d.jsx(dS,{message:"Loading columns...",className:"pl-12"});if(_)return d.jsx(uS,{error:_,className:"pl-12"});const Q=n.columns;return Q.length===0?d.jsx(Lc,{content:"No columns found",className:"pl-12"}):Q.map(re=>d.jsx(DL,{table:n,column:re,sqlTableContext:o},re.name))},e[20]=_,e[21]=p,e[22]=o,e[23]=n,e[24]=j):j=e[24];const N=j;let I;e[25]!==i||e[26]!==r||e[27]!==n.source_type||e[28]!==n.type?(I=()=>{if(n.source_type==="local")return;const Q=n.type==="table"?u$:P3;return d.jsx(Q,{className:"h-3 w-3",strokeWidth:i||r?2.5:void 0})},e[25]=i,e[26]=r,e[27]=n.source_type,e[28]=n.type,e[29]=I):I=e[29];const A=I,T=o?`${o.database}.${o.schema}.${n.name}`:n.name,R=o&&(fS(o.schema)?"pl-9":"pl-12"),z=(i||r)&&"font-semibold";let D,F,B,U,O,S,$,E,W,G,q,Y;return e[30]!==R||e[31]!==z?(D=je("rounded-none group h-8 cursor-pointer",R,z),e[30]=R,e[31]=z,e[32]=D):D=e[32],e[33]!==i?(F=()=>a(!i),e[33]=i,e[34]=F):F=e[34],e[35]!==A?(B=A(),e[35]=A,e[36]=B):B=e[36],e[37]!==n.name?(U=d.jsx("span",{className:"text-sm",children:n.name}),e[37]=n.name,e[38]=U):U=e[38],e[39]!==B||e[40]!==U?(O=d.jsxs("div",{className:"flex gap-2 items-center flex-1",children:[B,U]}),e[39]=B,e[40]=U,e[41]=O):O=e[41],e[42]!==k?(S=k(),e[42]=k,e[43]=S):S=e[43],e[44]!==v?($=Pn.stopPropagation(()=>v()),e[44]=v,e[45]=$):$=e[45],e[46]===Symbol.for("react.memo_cache_sentinel")?(E=d.jsx(h$,{className:"h-3 w-3"}),e[46]=E):E=e[46],e[47]!==$?(W=d.jsx(Ae,{content:"Add table to notebook",delayDuration:400,children:d.jsx(Te,{className:"group-hover:inline-flex hidden",variant:"text",size:"icon",onClick:$,children:E})}),e[47]=$,e[48]=W):W=e[48],e[49]!==i||e[50]!==F||e[51]!==O||e[52]!==S||e[53]!==W||e[54]!==D||e[55]!==T?(G=d.jsxs(lo,{className:D,value:T,"aria-selected":i,forceMount:!0,onSelect:F,children:[O,S,W]}),e[49]=i,e[50]=F,e[51]=O,e[52]=S,e[53]=W,e[54]=D,e[55]=T,e[56]=G):G=e[56],e[57]!==i||e[58]!==N?(q=i&&N(),e[57]=i,e[58]=N,e[59]=q):q=e[59],e[60]!==G||e[61]!==q?(Y=d.jsxs(d.Fragment,{children:[G,q]}),e[60]=G,e[61]=q,e[62]=Y):Y=e[62],Y},DL=t=>{var E,W;const e=X.c(51),{table:n,column:o,sqlTableContext:r}=t,[s,i]=K.useState(!1),a=Be(aS),l=Kt(f$);let c,u;e[0]!==a?(c=()=>{a&&i(!1)},u=[a],e[0]=a,e[1]=c,e[2]=u):(c=e[1],u=e[2]),K.useEffect(c,u),l(s?G=>new Set([...G,`${n.name}:${o.name}`]):G=>(G.delete(`${n.name}:${o.name}`),new Set(G)));const h=hS(),{columnsPreviews:f}=p$();let p;e[3]!==o.name||e[4]!==n.primary_keys?(p=((E=n.primary_keys)==null?void 0:E.includes(o.name))||!1,e[3]=o.name,e[4]=n.primary_keys,e[5]=p):p=e[5];const _=p;let g;e[6]!==o.name||e[7]!==n.indexes?(g=((W=n.indexes)==null?void 0:W.includes(o.name))||!1,e[6]=o.name,e[7]=n.indexes,e[8]=g):g=e[8];const m=g;let b;e[9]!==h?(b=G=>{h(G)},e[9]=h,e[10]=b):b=e[10];const y=b,x=RL,v=s?"font-semibold":"";let C;e[11]!==o.name||e[12]!==v?(C=d.jsx("span",{className:v,children:o.name}),e[11]=o.name,e[12]=v,e[13]=C):C=e[13];const k=C,j=`${n.name}.${o.name}`,N=`${n.name}.${o.name}`;let I;e[14]!==s?(I=()=>i(!s),e[14]=s,e[15]=I):I=e[15];const A=r?"pl-14":"pl-7";let T,R,z,D,F,B,U,O,S,$;return e[16]!==A?(T=je("flex flex-row gap-2 items-center flex-1",A),e[16]=A,e[17]=T):T=e[17],e[18]!==o.type||e[19]!==k?(R=d.jsx(m$,{columnName:k,dataType:o.type}),e[18]=o.type,e[19]=k,e[20]=R):R=e[20],e[21]!==_?(z=_&&x({tooltipContent:"Primary key",content:"PK"}),e[21]=_,e[22]=z):z=e[22],e[23]!==m?(D=m&&x({tooltipContent:"Indexed",content:"IDX"}),e[23]=m,e[24]=D):D=e[24],e[25]!==T||e[26]!==R||e[27]!==z||e[28]!==D?(F=d.jsxs("div",{className:T,children:[R,z,D]}),e[25]=T,e[26]=R,e[27]=z,e[28]=D,e[29]=F):F=e[29],e[30]!==o.name?(B=d.jsx(Ae,{content:"Copy column name",delayDuration:400,children:d.jsx(Te,{variant:"text",size:"icon",className:"group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground",children:d.jsx(eS,{tooltip:!1,value:o.name,className:"h-3 w-3"})})}),e[30]=o.name,e[31]=B):B=e[31],e[32]!==o.external_type?(U=d.jsx("span",{className:"text-xs text-muted-foreground",children:o.external_type}),e[32]=o.external_type,e[33]=U):U=e[33],e[34]!==I||e[35]!==F||e[36]!==B||e[37]!==U||e[38]!==j||e[39]!==N?(O=d.jsxs(lo,{className:"rounded-none py-1 group cursor-pointer",value:N,onSelect:I,children:[F,B,U]},j),e[34]=I,e[35]=F,e[36]=B,e[37]=U,e[38]=j,e[39]=N,e[40]=O):O=e[40],e[41]!==o||e[42]!==f||e[43]!==y||e[44]!==s||e[45]!==r||e[46]!==n?(S=s&&d.jsx("div",{className:"pl-10 pr-2 py-2 bg-[var(--slate-1)] shadow-inner border-b",children:d.jsx(pc,{children:d.jsx(g$,{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]=S):S=e[47],e[48]!==O||e[49]!==S?($=d.jsxs(d.Fragment,{children:[O,S]}),e[48]=O,e[49]=S,e[50]=$):$=e[50],$};function RL(t){const{tooltipContent:e,content:n}=t;return d.jsx(Ae,{content:e,delayDuration:100,children:d.jsx("span",{className:"text-xs text-black bg-gray-100 dark:invert rounded px-1",children:n})})}const PL=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=d.jsx(EL,{}),t[0]=e):e=t[0],e},LL=()=>{const t=X.c(5),{documentation:e}=Be(b$);if(!e){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=d.jsx(gn,{title:"View docs as you type",description:"Move your text cursor over a symbol to see its documentation.",icon:d.jsx(td,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=Fp({html:e}),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=d.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},FL=()=>{const t=X.c(5),e=y$();if(e.length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=d.jsx(gn,{title:"No errors!",icon:d.jsx(jm,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=e.map(zL),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=d.jsx("div",{className:"flex flex-col overflow-auto",children:n}),t[3]=n,t[4]=o):o=t[4],o};function zL(t){return d.jsxs("div",{children:[d.jsx("div",{className:"text-xs font-mono font-semibold bg-muted border-y px-2 py-1",children:d.jsx(x$,{cellId:t.cellId})}),d.jsx("div",{className:"px-2",children:d.jsx(w$,{errors:t.output.data,cellId:t.cellId},t.cellId)},t.cellId)]},t.cellId)}const qf=new Map,BL=({file:t,onOpenNotebook:e})=>{const{theme:n}=lr(),o=Be(rp),[r,s]=M.useState(""),{data:i,isPending:a,error:l,setData:c}=zn(async()=>{const g=await Bp({path:t.path}),m=g.contents||"";return s(qf.get(t.path)||m),g},[t.path]),u=async()=>{r!==(i==null?void 0:i.contents)&&await I$({path:t.path,contents:r}).then(g=>{g.success&&(c(m=>({...m,contents:r})),s(r))})},h=M.useRef(r);if(h.current=r,M.useEffect(()=>()=>{if(!(i!=null&&i.contents))return;const g=h.current;g===i.contents?qf.delete(t.path):qf.set(t.path,g)},[t.path,i==null?void 0:i.contents]),l)return d.jsx(Dr,{error:l});if(a||!i)return null;const f=i.mimeType||"text/plain",p=f in Gf;if(!i.contents&&!p)return d.jsxs("div",{className:"grid grid-cols-2 gap-2 p-6",children:[d.jsx("div",{className:"font-bold text-muted-foreground",children:"Name"}),d.jsx("div",{children:i.file.name}),d.jsx("div",{className:"font-bold text-muted-foreground",children:"Type"}),d.jsx("div",{children:f})]});const _=d.jsxs("div",{className:"text-xs text-muted-foreground p-1 flex justify-end gap-2 border-b",children:[t.isMarimoFile&&!xn()&&d.jsx(Ae,{content:"Open notebook",children:d.jsx(mn,{size:"small",onClick:g=>e(g),children:d.jsx(uc,{})})}),d.jsx(Ae,{content:"Download",children:d.jsx(mn,{size:"small",onClick:()=>{if(n3(f)){const g=j$(i.contents,f);return void E$(g,i.file.name)}Ki(new Blob([i.contents||r],{type:f}),i.file.name)},children:d.jsx(fp,{})})}),!n3(f)&&d.jsxs(d.Fragment,{children:[d.jsx(Ae,{content:"Copy contents to clipboard",children:d.jsx(mn,{size:"small",onClick:async()=>{await pn(r)},children:d.jsx($i,{})})}),d.jsx(Ae,{content:nn("global.save"),children:d.jsx(mn,{size:"small",color:r===i.contents?void 0:"green",onClick:u,disabled:r===i.contents,children:d.jsx(_a,{})})})]})]});return f.startsWith("image/")?d.jsxs(d.Fragment,{children:[_,d.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:d.jsx(v$,{base64:i.contents,mime:f})})]}):f==="text/csv"&&i.contents?d.jsxs(d.Fragment,{children:[_,d.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:d.jsx(k$,{contents:i.contents})})]}):f.startsWith("audio/")?d.jsxs(d.Fragment,{children:[_,d.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:d.jsx(S$,{base64:i.contents,mime:f})})]}):f.startsWith("video/")?d.jsxs(d.Fragment,{children:[_,d.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:d.jsx(C$,{base64:i.contents,mime:f})})]}):f.startsWith("application/pdf")?d.jsxs(d.Fragment,{children:[_,d.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:d.jsx(N$,{base64:i.contents,mime:f})})]}):d.jsxs(d.Fragment,{children:[_,d.jsx("div",{className:"flex-1 overflow-auto",children:d.jsx(M.Suspense,{children:d.jsx(la,{theme:n==="dark"?"dark":"light",language:Gf[f]||Gf.default,className:"border-b",extensions:[tt.lineWrapping,Bn.of([{key:o.getHotkey("global.save").key,stopPropagation:!0,run:()=>r!==i.contents&&(u(),!0)}])],value:r,onChange:s})})})]})},n3=t=>t.startsWith("image/")||t.startsWith("audio/")||t.startsWith("video/")||t.startsWith("application/pdf"),Gf={"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"},o3=Ht(new class{constructor(t){this.callbacks=t,this.delegate=new Gp([]),this.rootPath="",this.onChange=wn.NOOP,this.path=new lc("/"),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 Gp(n.files),this.rootPath=n.root,this.path=lc.guessDeliminator(n.root)}catch(n){ut({title:"Failed",description:A4(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 i=o[r];s===this.rootPath?this.delegate=new Gp(i.files):this.delegate.update({id:s,changes:{children:i.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:(ut({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 i=this.path.join(n,this.path.basename(s.data.path));return this.delegate.update({id:r,changes:{path:i}}),this.callbacks.renameFileOrFolder({path:s.data.path,newPath:i}).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:s4,createFileOrFolder:Up,deleteFileOrFolder:T$,renameFileOrFolder:A$})),UL=Ht({});function VL(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 r3(t){const e=X.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:GL,onDropRejected:HL,onDrop:$L,...o},e[2]=o,e[3]=r):r=e[3],M$(r)}async function $L(t){for(const e of t){const n=JL(YL(e));let o="";n&&(o=lc.guessDeliminator(n).dirname(n));const r=(await VL(e)).split(",")[1];await Up({path:o,type:"file",name:e.name,contents:r})}await async function(){await ct.get(o3).refreshAll([])}()}function HL(t){ut({title:"File upload failed",description:d.jsx("div",{className:"flex flex-col gap-1",children:t.map(WL)}),variant:"danger"})}function WL(t){return d.jsxs("div",{children:[t.file.name," (",t.errors.map(qL).join(", "),")"]},t.file.name)}function qL(t){return t.message}function GL(t){kt.error(t),ut({title:"File upload failed",description:t.message,variant:"danger"})}function YL(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 JL(t){if(t)return t.replace(/^\/+/,"")}const s3=K.createContext(null),KL=t=>{const e=X.c(60),{height:n}=t,o=M.useRef(null),[r]=tn(o3);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=[],e[0]=s):s=e[0];const[i,a]=M.useState(s),[l,c]=M.useState(null),{openPrompt:u}=Fn(),[h,f]=tn(UL);let p,_;e[1]!==r?(p=()=>r.initialize(a),e[1]=r,e[2]=p):p=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(_=[],e[3]=_):_=e[3];const{isPending:g,error:m}=zn(p,_);let b;e[4]!==h||e[5]!==r?(b=()=>{r.refreshAll(Object.keys(h).filter(S=>h[S]))},e[4]=h,e[5]=r,e[6]=b):b=e[6];const y=Xe(b);let x;e[7]!==u||e[8]!==r?(x=async()=>{u({title:"Folder name",onConfirm:async S=>{r.createFolder(S,null)}})},e[7]=u,e[8]=r,e[9]=x):x=e[9];const v=Xe(x);let C;e[10]!==u||e[11]!==r?(C=async()=>{u({title:"File name",onConfirm:async S=>{r.createFile(S,null)}})},e[10]=u,e[11]=r,e[12]=C):C=e[12];const k=Xe(C);let j;e[13]!==f?(j=()=>{var S;(S=o.current)==null||S.closeAll(),f({})},e[13]=f,e[14]=j):j=e[14];const N=Xe(j);if(g){let S;return e[15]===Symbol.for("react.memo_cache_sentinel")?(S=d.jsx(Vn,{size:"medium",centered:!0}),e[15]=S):S=e[15],S}if(m){let S;return e[16]!==m?(S=d.jsx(Dr,{error:m}),e[16]=m,e[17]=S):S=e[17],S}if(l){let S,$,E,W,G,q;return e[18]===Symbol.for("react.memo_cache_sentinel")?(S=()=>c(null),e[18]=S):S=e[18],e[19]===Symbol.for("react.memo_cache_sentinel")?($=d.jsx(Te,{onClick:S,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:d.jsx(Ct,{size:16})}),e[19]=$):$=e[19],e[20]!==l.name?(E=d.jsxs("div",{className:"flex items-center pl-1 pr-3 flex-shrink-0 border-b justify-between",children:[$,d.jsx("span",{className:"font-bold",children:l.name})]}),e[20]=l.name,e[21]=E):E=e[21],e[22]!==l.path||e[23]!==r?(W=Y=>i3(Y,r.relativeFromRoot(l.path)),e[22]=l.path,e[23]=r,e[24]=W):W=e[24],e[25]!==l||e[26]!==W?(G=d.jsx(M.Suspense,{children:d.jsx(BL,{onOpenNotebook:W,file:l})}),e[25]=l,e[26]=W,e[27]=G):G=e[27],e[28]!==E||e[29]!==G?(q=d.jsxs(d.Fragment,{children:[E,G]}),e[28]=E,e[29]=G,e[30]=q):q=e[30],q}let I;e[31]!==N||e[32]!==k||e[33]!==v||e[34]!==y||e[35]!==r?(I=d.jsx(ZL,{onRefresh:y,onCreateFile:k,onCreateFolder:v,onCollapseAll:N,tree:r}),e[31]=N,e[32]=k,e[33]=v,e[34]=y,e[35]=r,e[36]=I):I=e[36];const A=n-33;let T,R,z,D,F,B,U,O;return e[37]!==r?(T=async S=>{const{ids:$}=S;for(const E of $)await r.delete(E)},R=async S=>{const{id:$,name:E}=S;await r.rename($,E)},z=async S=>{const{dragIds:$,parentId:E}=S;await r.move($,E)},e[37]=r,e[38]=T,e[39]=R,e[40]=z):(T=e[38],R=e[39],z=e[40]),e[41]===Symbol.for("react.memo_cache_sentinel")?(D=S=>{const $=S[0];$&&($.data.isDirectory||c($.data))},e[41]=D):D=e[41],e[42]!==h||e[43]!==f||e[44]!==r?(F=async S=>{if(await r.expand(S)){const $=h[S]??!1;f({...h,[S]:!$})}},e[42]=h,e[43]=f,e[44]=r,e[45]=F):F=e[45],e[46]!==i||e[47]!==h||e[48]!==T||e[49]!==R||e[50]!==z||e[51]!==F||e[52]!==A?(B=d.jsx(kH,{width:"100%",ref:o,height:A,className:"h-full",data:i,initialOpenState:h,openByDefault:!1,renderCursor:oF,disableDrop:rF,onDelete:T,onRename:R,onMove:z,onSelect:D,onToggle:F,padding:15,rowHeight:30,indent:XL,overscanCount:1e3,disableMultiSelection:!0,children:tF}),e[46]=i,e[47]=h,e[48]=T,e[49]=R,e[50]=z,e[51]=F,e[52]=A,e[53]=B):B=e[53],e[54]!==B||e[55]!==r?(U=d.jsx(s3,{value:r,children:B}),e[54]=B,e[55]=r,e[56]=U):U=e[56],e[57]!==U||e[58]!==I?(O=d.jsxs(d.Fragment,{children:[I,U]}),e[57]=U,e[58]=I,e[59]=O):O=e[59],O},XL=15,ZL=t=>{const e=X.c(30),{onRefresh:n,onCreateFile:o,onCreateFolder:r,onCollapseAll:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={noDrag:!0,noDragEventsBubbling:!0},e[0]=i):i=e[0];const{getRootProps:a,getInputProps:l}=r3(i);let c,u,h,f,p,_,g,m,b,y,x,v,C,k,j;return e[1]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(ma,{size:16}),e[1]=c):c=e[1],e[2]!==o?(u=d.jsx(Ae,{content:"Add file",children:d.jsx(Te,{"data-testid":"file-explorer-add-file-button",onClick:o,variant:"text",size:"xs",children:c})}),e[2]=o,e[3]=u):u=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(h=d.jsx(Gc,{size:16}),e[4]=h):h=e[4],e[5]!==r?(f=d.jsx(Ae,{content:"Add folder",children:d.jsx(Te,{"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]!==a?(p=a({}),e[7]=a,e[8]=p):p=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(_=O$({variant:"text",size:"xs"}),g=d.jsx(R$,{size:16}),e[9]=_,e[10]=g):(_=e[9],g=e[10]),e[11]!==p?(m=d.jsx(Ae,{content:"Upload file",children:d.jsx("button",{"data-testid":"file-explorer-upload-button",...p,className:_,children:g})}),e[11]=p,e[12]=m):m=e[12],e[13]!==l?(b=l({}),e[13]=l,e[14]=b):b=e[14],e[15]!==b?(y=d.jsx("input",{...b,type:"file"}),e[15]=b,e[16]=y):y=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(x=d.jsx(R4,{size:16}),e[17]=x):x=e[17],e[18]!==n?(v=d.jsx(Ae,{content:"Refresh",children:d.jsx(Te,{"data-testid":"file-explorer-refresh-button",onClick:n,variant:"text",size:"xs",children:x})}),e[18]=n,e[19]=v):v=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(C=d.jsx(im,{size:16}),e[20]=C):C=e[20],e[21]!==s?(k=d.jsx(Ae,{content:"Collapse all folders",children:d.jsx(Te,{"data-testid":"file-explorer-collapse-button",onClick:s,variant:"text",size:"xs",children:C})}),e[21]=s,e[22]=k):k=e[22],e[23]!==y||e[24]!==v||e[25]!==k||e[26]!==u||e[27]!==f||e[28]!==m?(j=d.jsxs("div",{className:"flex items-center justify-end px-2 flex-shrink-0 border-b",children:[u,f,m,y,v,k]}),e[23]=y,e[24]=v,e[25]=k,e[26]=u,e[27]=f,e[28]=m,e[29]=j):j=e[29],j},QL=t=>{const e=X.c(9),{node:n,onOpenMarimoFile:o}=t;let r,s,i;return e[0]!==n?(r=a=>{n.data.isDirectory||(a.stopPropagation(),n.select())},e[0]=n,e[1]=r):r=e[1],e[2]!==n.data.isMarimoFile||e[3]!==o?(s=n.data.isMarimoFile&&!xn()&&d.jsxs("span",{className:"flex-shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline",onClick:o,children:["open ",d.jsx(uc,{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?(i=d.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]=i):i=e[8],i},eF=t=>{const e=X.c(10),{node:n}=t,o=M.useRef(null);let r,s,i,a,l;return e[0]!==n.data.name?(r=()=>{var c,u;(c=o.current)==null||c.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?(i=()=>n.reset(),a=c=>{c.key==="Escape"&&n.reset(),c.key==="Enter"&&n.submit(c.currentTarget.value)},e[3]=n,e[4]=i,e[5]=a):(i=e[4],a=e[5]),e[6]!==n.data.name||e[7]!==i||e[8]!==a?(l=d.jsx("input",{ref:o,className:"flex-1 bg-transparent border border-border text-muted-foreground",defaultValue:n.data.name,onClick:sF,onBlur:i,onKeyDown:a}),e[6]=n.data.name,e[7]=i,e[8]=a,e[9]=l):l=e[9],l},tF=({node:t,style:e,dragHandle:n})=>{const o=t.data.isDirectory?"directory":o4(t.data.name),r=r4[o],{openConfirm:s,openPrompt:i}=Fn(),{createNewCell:a}=It(),l=As(),c=M.use(s3),u=async g=>{i3(g,c?c.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:d.jsx(Z3,{onClick:async()=>{await t.tree.delete(t.id)},"aria-label":"Confirm",children:"Delete"})})},f=Xe(async()=>{t.open(),i({title:"Folder name",onConfirm:async g=>{c==null||c.createFolder(g,t.id)}})}),p=Xe(async()=>{t.open(),i({title:"File name",onConfirm:async g=>{c==null||c.createFile(g,t.id)}})}),_=Xe(async()=>{var y;if(!c||t.data.isDirectory)return;const[g,m]=D$(t.data.name),b=`${g}_copy${m}`;try{const x=await Bp({path:t.data.path}),v=((y=t.parent)==null?void 0:y.data.path)||"";await Up({path:v,type:"file",name:b,contents:x.contents?btoa(x.contents):void 0}),await c.refreshAll([v])}catch{ut({title:"Failed to duplicate file",description:"Unable to create a duplicate of the file",variant:"danger"})}});return d.jsxs("div",{style:e,ref:n,className:je("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:[d.jsx(nF,{node:t}),d.jsxs("span",{className:je("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?d.jsx("img",{src:"./favicon.ico",className:"w-5 h-5 flex-shrink-0 mr-2 filter grayscale",alt:"Marimo"}):d.jsx(r,{className:"w-5 h-5 flex-shrink-0 mr-2",strokeWidth:1.5}),t.isEditing?d.jsx(eF,{node:t}):d.jsx(QL,{node:t,onOpenMarimoFile:u}),d.jsxs(js,{modal:!1,children:[d.jsx(Es,{asChild:!0,tabIndex:-1,onClick:g=>g.stopPropagation(),children:d.jsx(Te,{"data-testid":"file-explorer-more-button",variant:"text",tabIndex:-1,size:"xs",className:"mb-0","aria-label":"More options",children:d.jsx(qc,{strokeWidth:2,className:"w-5 h-5 hidden group-hover:block"})})}),(()=>{const g={size:14,strokeWidth:1.5,className:"mr-2"};return d.jsxs(Is,{align:"end",className:"no-print w-[220px]",onClick:m=>m.stopPropagation(),onCloseAutoFocus:m=>m.preventDefault(),children:[!t.data.isDirectory&&d.jsxs(Wt,{onSelect:()=>t.select(),children:[d.jsx(Vm,{...g}),"Open file"]}),!t.data.isDirectory&&!xn()&&d.jsxs(Wt,{onSelect:()=>{P$({path:t.data.path})},children:[d.jsx(uc,{...g}),"Open file in external editor"]}),t.data.isDirectory&&d.jsxs(d.Fragment,{children:[d.jsxs(Wt,{onSelect:()=>p(),children:[d.jsx(ma,{...g}),"Create file"]}),d.jsxs(Wt,{onSelect:()=>f(),children:[d.jsx(Gc,{...g}),"Create folder"]}),d.jsx(co,{})]}),d.jsxs(Wt,{onSelect:()=>t.edit(),children:[d.jsx(Em,{...g}),"Rename"]}),!t.data.isDirectory&&d.jsxs(Wt,{onSelect:_,children:[d.jsx($i,{...g}),"Duplicate"]}),d.jsxs(Wt,{onSelect:async()=>{await pn(t.data.path),ut({title:"Copied to clipboard"})},children:[d.jsx(Kc,{...g}),"Copy path"]}),c&&d.jsxs(Wt,{onSelect:async()=>{await pn(c.relativeFromRoot(t.data.path)),ut({title:"Copied to clipboard"})},children:[d.jsx(Kc,{...g}),"Copy relative path"]}),d.jsx(co,{}),d.jsxs(Wt,{onSelect:()=>{const{path:m}=t.data;(b=>{a({code:b,before:!1,cellId:l??"__end__"})})(gS[o](m))},children:[d.jsx(Lr,{...g}),"Insert snippet for reading file"]}),d.jsxs(Wt,{onSelect:async()=>{ut({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:m}=t.data,b=gS[o](m);await pn(b)},children:[d.jsx(L$,{...g}),"Copy snippet for reading file"]}),t.data.isMarimoFile&&!xn()&&d.jsxs(d.Fragment,{children:[d.jsx(co,{}),d.jsxs(Wt,{onSelect:u,children:[d.jsx(Lm,{...g}),"Open notebook"]})]}),d.jsx(co,{}),!t.data.isDirectory&&d.jsxs(d.Fragment,{children:[d.jsxs(Wt,{onSelect:async()=>{const m=(await Bp({path:t.data.path})).contents||"";Ki(new Blob([m]),t.data.name)},children:[d.jsx(fp,{...g}),"Download"]}),d.jsx(co,{})]}),d.jsxs(Wt,{onSelect:h,variant:"danger",children:[d.jsx(op,{...g}),"Delete"]})]})})()]})]})]})},nF=t=>{const e=X.c(3),{node:n}=t;if(!n.data.isDirectory){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=d.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?d.jsx(Ns,{className:"w-5 h-5 flex-shrink-0"}):d.jsx(Wi,{className:"w-5 h-5 flex-shrink-0"}),e[1]=n.isOpen,e[2]=o):o=e[2],o};function i3(t,e){t.stopPropagation(),t.preventDefault(),window.open(`/?file=${e}`,"_blank")}function oF(){return null}function rF(t){const{parentNode:e}=t;return!e.data.isDirectory}function sF(t){return t.stopPropagation()}let a3,l3,c3;a3=()=>{const t=X.c(20),{ref:e,height:n}=F$(),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:i,isDragActive:a}=r3(r);let l,c,u,h,f,p,_,g;return t[1]!==s?(l=s(),t[1]=s,t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(c=je("flex flex-col flex-1 overflow-hidden relative"),t[3]=c):c=t[3],t[4]!==i?(u=i(),t[4]=i,t[5]=u):u=t[5],t[6]!==u?(h=d.jsx("input",{...u}),t[6]=u,t[7]=h):h=t[7],t[8]!==a?(f=a&&d.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]=a,t[9]=f):f=t[9],t[10]!==o?(p=d.jsx(KL,{height:o}),t[10]=o,t[11]=p):p=t[11],t[12]!==e||t[13]!==p?(_=d.jsx("div",{ref:e,className:"flex flex-col flex-1 overflow-hidden",children:p}),t[12]=e,t[13]=p,t[14]=_):_=t[14],t[15]!==l||t[16]!==h||t[17]!==f||t[18]!==_?(g=d.jsxs("div",{...l,className:c,children:[h,f,_]}),t[15]=l,t[16]=h,t[17]=f,t[18]=_,t[19]=g):g=t[19],g},Zp=t=>{const e=X.c(6),n=t.dataTestId;let o,r;return e[0]!==t.className?(o=je("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=d.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},l3=()=>{const t=X.c(9),e=z$(),{clearLogs:n}=It();if(e.length===0){let i,a;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsx("code",{className:"border rounded px-1",children:"stdout"}),t[0]=i):i=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsx(gn,{title:"No logs",description:d.jsxs("span",{children:[i," and"," ",d.jsx("code",{className:"border rounded px-1",children:"stderr"})," logs will appear here."]}),icon:d.jsx(ep,{})}),t[1]=a):a=t[1],a}let o,r,s;return t[2]!==n?(o=d.jsx("div",{className:"flex flex-row justify-end px-2 py-1",children:d.jsx(Zp,{dataTestId:"clear-logs-button",onClick:n})}),t[2]=n,t[3]=o):o=t[3],t[4]!==e?(r=d.jsx("div",{className:"overflow-auto flex-1",children:d.jsx(c3,{logs:e,className:"min-w-[300px]"})}),t[4]=e,t[5]=r):r=t[5],t[6]!==o||t[7]!==r?(s=d.jsxs(d.Fragment,{children:[o,r]}),t[6]=o,t[7]=r,t[8]=s):s=t[8],s},c3=t=>{const e=X.c(10),{logs:n,className:o}=t;let r,s,i,a,l;return e[0]!==o?(r=je("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?(i=n.map(lF),e[3]=n,e[4]=i):i=e[4],e[5]!==i?(a=d.jsx("pre",{className:"grid text-xs font-mono gap-1 whitespace-break-spaces font-semibold align-left",children:d.jsx("div",{className:"grid grid-cols-[30px,1fr]",style:s,children:i})}),e[5]=i,e[6]=a):a=e[6],e[7]!==r||e[8]!==a?(l=d.jsx("div",{className:r,children:a}),e[7]=r,e[8]=a,e[9]=l):l=e[9],l};function iF(t){const e=B$(t.timestamp),n=aF[t.level],o=t.level.toUpperCase();return d.jsxs(d.Fragment,{children:[d.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)] dark:text-[var(--gray-11)]",children:["[",e,"]"]}),d.jsx("span",{className:je("flex-shrink-0",n),children:o}),d.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)]",children:["(",d.jsx(cr,{cellId:t.cellId}),")"]}),t.message]})}const aF={stdout:"text-[var(--grass-9)]",stderr:"text-[var(--red-9)]"};function lF(t,e){return d.jsxs("div",{className:"contents group",children:[d.jsx("span",{className:je("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","text-right col-span-1 py-1 pr-1"),children:e+1}),d.jsx("span",{className:je("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","px-2 flex gap-x-1.5 py-1 flex-wrap"),children:iF(t)})]},e)}const cF=()=>{const t=X.c(7),{items:e}=Be(U$);let n,o;t[0]!==e?(o=$H(e),t[0]=e,t[1]=o):o=t[1],n=o;const r=n,{activeHeaderId:s,activeOccurrences:i}=HH(r);if(e.length===0){let l;return t[2]===Symbol.for("react.memo_cache_sentinel")?(l=d.jsx(gn,{title:"No outline",description:"Add markdown headings to your notebook to create an outline.",icon:d.jsx(ed,{})}),t[2]=l):l=t[2],l}let a;return t[3]!==s||t[4]!==i||t[5]!==e?(a=d.jsx(WH,{items:e,activeHeaderId:s,activeOccurrences:i}),t[3]=s,t[4]=i,t[5]=e,t[6]=a):a=t[6],a},d3=Ht(null),u3=t=>{const e=X.c(9),{onClick:n,loading:o,children:r,className:s}=t;if(o){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(Vn,{size:"small",className:"h-4 w-4 shrink-0 opacity-50"}),e[0]=c):c=e[0],c}let i,a,l;return e[1]!==s?(i=je("px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible",s),e[1]=s,e[2]=i):i=e[2],e[3]!==n?(a=Pn.stopPropagation(n),e[3]=n,e[4]=a):a=e[4],e[5]!==r||e[6]!==i||e[7]!==a?(l=d.jsx("button",{type:"button",className:i,onClick:a,children:r}),e[5]=r,e[6]=i,e[7]=a,e[8]=l):l=e[8],l},dF=()=>{var v,C;const t=X.c(27),[e]=Tr(),n=e.package_management.manager,[o,r]=K.useState(null);let s;t[0]!==n?(s=[n],t[0]=n,t[1]=s):s=t[1];const{data:i,error:a,refetch:l,isPending:c}=zn(pF,s);if(c){let k;return t[2]===Symbol.for("react.memo_cache_sentinel")?(k=d.jsx(Vn,{size:"medium",centered:!0}),t[2]=k):k=t[2],k}if(a){let k;return t[3]!==a?(k=d.jsx(Dr,{error:a}),t[3]=a,t[4]=k):k=t[4],k}const u=i.tree!=null;let h;t[5]!==u||t[6]!==o?(h=function(k,j){return k==="list"?"list":j?k||"tree":"list"}(o,u),t[5]=u,t[6]=o,t[7]=h):h=t[7];const f=h,p=(v=i.tree)==null?void 0:v.name,_=(C=i==null?void 0:i.tree)==null?void 0:C.version,g=p==="<root>";let m,b,y,x;return t[8]!==n||t[9]!==l?(m=d.jsx(uF,{packageManager:n,onSuccess:l}),t[8]=n,t[9]=l,t[10]=m):m=t[10],t[11]!==g||t[12]!==u||t[13]!==p||t[14]!==_||t[15]!==f?(b=u&&d.jsxs("div",{className:"flex items-center justify-between px-2 py-1 border-b",children:[d.jsxs("div",{className:"flex gap-1",children:[d.jsx("button",{type:"button",className:je("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"}),d.jsx("button",{type:"button",className:je("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"})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.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"}),p&&!g&&d.jsxs("span",{className:"text-xs text-muted-foreground",children:[p,_&&` v${_}`]})]})]}),t[11]=g,t[12]=u,t[13]=p,t[14]=_,t[15]=f,t[16]=b):b=t[16],t[17]!==i.list||t[18]!==i.tree||t[19]!==a||t[20]!==l||t[21]!==f?(y=f==="list"?d.jsx(hF,{packages:i.list,onSuccess:l}):d.jsx(fF,{tree:i.tree,error:a,onSuccess:l}),t[17]=i.list,t[18]=i.tree,t[19]=a,t[20]=l,t[21]=f,t[22]=y):y=t[22],t[23]!==m||t[24]!==b||t[25]!==y?(x=d.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[m,b,y]}),t[23]=m,t[24]=b,t[25]=y,t[26]=x):x=t[26],x},uF=t=>{const e=X.c(40),{onSuccess:n,packageManager:o}=t,[r,s]=K.useState(""),{handleClick:i}=da(),a=Be(d3),l=Kt(d3);let c,u;e[0]!==a||e[1]!==l?(c=()=>{a&&(s(a),l(null))},u=[a,l],e[0]=a,e[1]=l,e[2]=c,e[3]=u):(c=e[2],u=e[3]),K.useEffect(c,u);const{loading:h,handleInstallPackages:f}=H$();let p;e[4]!==n?(p=()=>{n(),s("")},e[4]=n,e[5]=p):p=e[5];const _=p;let g;e[6]!==f||e[7]!==r||e[8]!==_?(g=()=>{f(r.split(",").map(mF),_)},e[6]=f,e[7]=r,e[8]=_,e[9]=g):g=e[9];const m=g,b=`Install packages with ${o}...`;let y,x,v,C,k,j,N,I,A,T,R,z,D,F;e[10]!==h||e[11]!==i?(y=h?d.jsx(Vn,{size:"small",className:"mr-2 h-4 w-4 shrink-0 opacity-50"}):d.jsx(Ae,{content:"Change package manager",children:d.jsx($s,{onClick:()=>i("packageManagement"),className:"mr-2 h-4 w-4 shrink-0 opacity-50 hover:opacity-80 cursor-pointer"})}),e[10]=h,e[11]=i,e[12]=y):y=e[12],e[13]!==m?(x=E=>{E.key==="Enter"&&(E.preventDefault(),m())},e[13]=m,e[14]=x):x=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(v=E=>s(E.target.value),e[15]=v):v=e[15],e[16]!==r||e[17]!==b||e[18]!==y||e[19]!==x?(C=d.jsx(_S,{placeholder:b,id:v1,icon:y,rootClassName:"flex-1 border-none",value:r,onKeyDown:x,onChange:v}),e[16]=r,e[17]=b,e[18]=y,e[19]=x,e[20]=C):C=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(k=d.jsx("span",{className:"font-bold tracking-wide",children:"Package name:"}),e[21]=k):k=e[21],e[22]===Symbol.for("react.memo_cache_sentinel")?(j=d.jsxs("div",{children:[k," A package name; this will install the latest version.",d.jsx("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),N=d.jsx("span",{className:"font-bold tracking-wide",children:"Package and version:"}),e[22]=j,e[23]=N):(j=e[22],N=e[23]),e[24]===Symbol.for("react.memo_cache_sentinel")?(I=d.jsxs("div",{children:[N," ","A package with a specific version or version range.",d.jsx("div",{className:"text-muted-foreground",children:"Examples: httpx==0.27.0, httpx>=0.27.0"})]}),A=d.jsx("span",{className:"font-bold tracking-wide",children:"Git:"}),e[24]=I,e[25]=A):(I=e[24],A=e[25]),e[26]===Symbol.for("react.memo_cache_sentinel")?(T=d.jsxs("div",{children:[A," A Git repository",d.jsx("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),R=d.jsx("span",{className:"font-bold tracking-wide",children:"URL:"}),e[26]=T,e[27]=R):(T=e[26],R=e[27]),e[28]===Symbol.for("react.memo_cache_sentinel")?(z=d.jsxs("div",{children:[R," A remote wheel or source distribution.",d.jsx("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),D=d.jsx("span",{className:"font-bold tracking-wide",children:"Path:"}),e[28]=z,e[29]=D):(z=e[28],D=e[29]),e[30]===Symbol.for("react.memo_cache_sentinel")?(F=d.jsx(Ae,{delayDuration:300,side:"left",align:"start",content:d.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:",d.jsxs("div",{className:"flex flex-col gap-2 mt-2",children:[j,I,T,z,d.jsxs("div",{children:[D," A local wheel, source distribution, or project directory.",d.jsx("div",{className:"text-muted-foreground",children:"Example: /example/foo-0.1.0-py3-none-any.whl"})]})]})]}),children:d.jsx(Rp,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),e[30]=F):F=e[30];const B=r&&"bg-accent text-accent-foreground";let U;e[31]!==B?(U=je("float-right px-2 m-0 h-full text-sm text-secondary-foreground ml-2",B,"disabled:cursor-not-allowed disabled:opacity-50"),e[31]=B,e[32]=U):U=e[32];const O=!r;let S,$;return e[33]!==m||e[34]!==U||e[35]!==O?(S=d.jsx("button",{type:"button",className:U,onClick:m,disabled:O,children:"Add"}),e[33]=m,e[34]=U,e[35]=O,e[36]=S):S=e[36],e[37]!==S||e[38]!==C?($=d.jsxs("div",{className:"flex items-center w-full border-b",children:[C,F,S]}),e[37]=S,e[38]=C,e[39]=$):$=e[39],$},hF=t=>{const e=X.c(9),{onSuccess:n,packages:o}=t;if(o.length===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsx(gn,{title:"No packages",description:"No packages are installed in this environment.",icon:d.jsx($s,{})}),e[0]=a):a=e[0],a}let r,s,i;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(r=d.jsx(Vp,{children:d.jsxs(Vs,{children:[d.jsx(Rr,{children:"Name"}),d.jsx(Rr,{children:"Version"}),d.jsx(Rr,{})]})}),e[1]=r):r=e[1],e[2]!==n||e[3]!==o){let a;e[5]!==n?(a=l=>d.jsxs(Vs,{className:"group",onClick:async()=>{await pn(`${l.name}==${l.version}`),ut({title:"Copied to clipboard"})},children:[d.jsx(Pr,{children:l.name}),d.jsx(Pr,{children:l.version}),d.jsxs(Pr,{className:"flex justify-end",children:[d.jsx(h3,{packageName:l.name,onSuccess:n}),d.jsx(f3,{packageName:l.name,onSuccess:n})]})]},l.name),e[5]=n,e[6]=a):a=e[6],s=o.map(a),e[2]=n,e[3]=o,e[4]=s}else s=e[4];return e[7]!==s?(i=d.jsxs($p,{className:"overflow-auto flex-1",children:[r,d.jsx(Hp,{children:s})]}),e[7]=s,e[8]=i):i=e[8],i},h3=({packageName:t,onSuccess:e})=>{const[n,o]=K.useState(!1);return xn()?null:d.jsx(u3,{onClick:async()=>{try{o(!0);const r=await W$({package:t,upgrade:!0});r.success?(e(),bS(t)):bS(t,r.error)}finally{o(!1)}},loading:n,children:"Upgrade"})},f3=({packageName:t,onSuccess:e})=>{const[n,o]=K.useState(!1);return d.jsx(u3,{onClick:async()=>{try{o(!0);const r=await q$({package:t});r.success?(e(),yS(t)):yS(t,r.error)}finally{o(!1)}},loading:n,children:"Remove"})},fF=t=>{const e=X.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[i,a]=K.useState(s);let l,c,u;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{a(new Set)},e[1]=l):l=e[1],e[2]!==n?(c=[n],e[2]=n,e[3]=c):c=e[3],K.useEffect(l,c),o){let _;return e[4]!==o?(_=d.jsx(Dr,{error:o}),e[4]=o,e[5]=_):_=e[5],_}if(!n){let _;return e[6]===Symbol.for("react.memo_cache_sentinel")?(_=d.jsx(Vn,{size:"medium",centered:!0}),e[6]=_):_=e[6],_}if(n.dependencies.length===0){let _;return e[7]===Symbol.for("react.memo_cache_sentinel")?(_=d.jsx(gn,{title:"No dependencies",description:"No package dependencies found in this environment.",icon:d.jsx($s,{})}),e[7]=_):_=e[7],_}e[8]===Symbol.for("react.memo_cache_sentinel")?(u=_=>{a(g=>{const m=new Set(g);return m.has(_)?m.delete(_):m.add(_),m})},e[8]=u):u=e[8];const h=u;let f,p;if(e[9]!==i||e[10]!==r||e[11]!==n.dependencies){let _;e[13]!==i||e[14]!==r?(_=(g,m)=>d.jsx("div",{className:"border-b",children:d.jsx(p3,{nodeId:`root-${m}`,node:g,level:0,isTopLevel:!0,expandedNodes:i,onToggle:h,onSuccess:r})},`${g.name}-${m}`),e[13]=i,e[14]=r,e[15]=_):_=e[15],f=n.dependencies.map(_),e[9]=i,e[10]=r,e[11]=n.dependencies,e[12]=f}else f=e[12];return e[16]!==f?(p=d.jsx("div",{className:"flex-1 overflow-auto",children:d.jsx("div",{children:f})}),e[16]=f,e[17]=p):p=e[17],p},p3=t=>{const e=X.c(57),{nodeId:n,node:o,level:r,isTopLevel:s,expandedNodes:i,onToggle:a,onSuccess:l}=t,c=s!==void 0&&s,u=o.dependencies.length>0;let h;e[0]!==i||e[1]!==n?(h=i.has(n),e[0]=i,e[1]=n,e[2]=h):h=e[2];const f=h,p=c?0:16+16*r;let _;e[3]!==u||e[4]!==n||e[5]!==a?(_=U=>{U.key!=="Enter"&&U.key!==" "||(U.preventDefault(),u&&a(n))},e[3]=u,e[4]=n,e[5]=a,e[6]=_):_=e[6];const g=_;let m;e[7]!==u||e[8]!==n||e[9]!==a?(m=U=>{U.stopPropagation(),u&&a(n)},e[7]=u,e[8]=n,e[9]=a,e[10]=m):m=e[10];const b=m,y=u&&"select-none",x=c?"px-2 py-0.5":"";let v,C;e[11]!==y||e[12]!==x?(v=je("flex items-center group cursor-pointer text-sm whitespace-nowrap","hover:bg-[var(--slate-2)] focus:bg-[var(--slate-2)] focus:outline-none",y,x),e[11]=y,e[12]=x,e[13]=v):v=e[13],e[14]!==p||e[15]!==c?(C=c?{}:{paddingLeft:`${p}px`},e[14]=p,e[15]=c,e[16]=C):C=e[16];const k=u?f:void 0;let j,N,I,A,T,R,z,D,F,B;return e[17]!==u||e[18]!==f?(j=u?f?d.jsx(Ns,{className:"w-4 h-4 mr-2 flex-shrink-0"}):d.jsx(Wi,{className:"w-4 h-4 mr-2 flex-shrink-0"}):d.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?(N=d.jsx("span",{className:"font-medium truncate",children:o.name}),e[20]=o.name,e[21]=N):N=e[21],e[22]!==o.version?(I=o.version&&d.jsxs("span",{className:"text-muted-foreground text-xs",children:["v",o.version]}),e[22]=o.version,e[23]=I):I=e[23],e[24]!==N||e[25]!==I?(A=d.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 py-1.5",children:[N,I]}),e[24]=N,e[25]=I,e[26]=A):A=e[26],e[27]!==o.tags?(T=o.tags.map(gF),e[27]=o.tags,e[28]=T):T=e[28],e[29]!==T?(R=d.jsx("div",{className:"flex items-center gap-1 ml-2",children:T}),e[29]=T,e[30]=R):R=e[30],e[31]!==c||e[32]!==o.name||e[33]!==l?(z=c&&d.jsxs("div",{className:"flex gap-1 invisible group-hover:visible",children:[d.jsx(h3,{packageName:o.name,onSuccess:l}),d.jsx(f3,{packageName:o.name,onSuccess:l})]}),e[31]=c,e[32]=o.name,e[33]=l,e[34]=z):z=e[34],e[35]!==b||e[36]!==g||e[37]!==j||e[38]!==A||e[39]!==R||e[40]!==z||e[41]!==v||e[42]!==C||e[43]!==k?(D=d.jsxs("div",{className:v,style:C,onClick:b,onKeyDown:g,tabIndex:0,role:"treeitem","aria-selected":!1,"aria-expanded":k,children:[j,A,R,z]}),e[35]=b,e[36]=g,e[37]=j,e[38]=A,e[39]=R,e[40]=z,e[41]=v,e[42]=C,e[43]=k,e[44]=D):D=e[44],e[45]!==i||e[46]!==u||e[47]!==f||e[48]!==r||e[49]!==o.dependencies||e[50]!==n||e[51]!==l||e[52]!==a?(F=u&&f&&d.jsx("div",{role:"group",children:o.dependencies.map((U,O)=>d.jsx(p3,{nodeId:`${n}-${O}`,node:U,level:r+1,isTopLevel:!1,expandedNodes:i,onToggle:a,onSuccess:l},`${U.name}-${O}`))}),e[45]=i,e[46]=u,e[47]=f,e[48]=r,e[49]=o.dependencies,e[50]=n,e[51]=l,e[52]=a,e[53]=F):F=e[53],e[54]!==D||e[55]!==F?(B=d.jsxs("div",{children:[D,F]}),e[54]=D,e[55]=F,e[56]=B):B=e[56],B};async function pF(){const[t,e]=await Promise.all([V$(),$$()]);return{list:t.packages,tree:e.tree}}function mF(t){return t.trim()}function gF(t,e){return t.kind==="cycle"?d.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"?d.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"?d.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 Yf=O3("marimo:scratchpadHistory:v1",[]),_F=Ht(!1),bF=Ht(null,(t,e,n)=>{if(!(n=n.trim()))return;const o=t(Yf),r=[n,...o.filter(s=>s!==n)].slice(0,15);e(Yf,r)}),yF={hide_code:!1,disabled:!1},xF=()=>{const t=X.c(69),e=mc(),[n]=Tr(),{theme:o}=lr(),r=M.useRef(null),s=As(),{createNewCell:i,updateCellCode:a}=It(),l=e.cellRuntime[dr],c=l==null?void 0:l.output,u=l==null?void 0:l.status,h=l==null?void 0:l.consoleOutputs,f=e.cellData[dr],p=(f==null?void 0:f.code)??"",_=Kt(bF),[g,m]=tn(_F),b=Be(Yf);let y;t[0]!==_||t[1]!==p?(y=()=>{xS({code:p}),_(p)},t[0]=_,t[1]=p,t[2]=y):y=t[2];const x=Xe(y);let v;t[3]!==p||t[4]!==i||t[5]!==s?(v=()=>{p.trim()&&i({code:p,before:!1,cellId:s??"__end__"})},t[3]=p,t[4]=i,t[5]=s,t[6]=v):v=t[6];const C=Xe(v);let k;t[7]!==a?(k=()=>{a({cellId:dr,code:"",formattingChange:!1}),xS({code:""});const ie=r.current;ie&&ie.dispatch({changes:{from:0,to:ie.state.doc.length,insert:""}})},t[7]=a,t[8]=k):k=t[8];const j=Xe(k);let N;t[9]!==m||t[10]!==a?(N=ie=>{m(!1),a({cellId:dr,code:ie,formattingChange:!1});const Me=r.current;Me&&Me.dispatch({changes:{from:0,to:Me.state.doc.length,insert:ie}})},t[9]=m,t[10]=a,t[11]=N):N=t[11];const I=Xe(N),[A,T]=M.useState();let R;t[12]!==p||t[13]!==h||t[14]!==x||t[15]!==A||t[16]!==c||t[17]!==o||t[18]!==n?(R=()=>d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[40%]",children:d.jsx(Uu,{theme:o,showPlaceholder:!1,id:dr,code:p,config:yF,status:"idle",serializedEditorState:null,runCell:x,userConfig:n,editorViewRef:r,setEditorView:ie=>{r.current=ie},hidden:!1,temporarilyShowCode:wn.NOOP,languageAdapter:A,setLanguageAdapter:T})}),d.jsx("div",{className:"flex-1 overflow-auto flex-shrink-0",children:d.jsx(Mc,{allowExpand:!1,output:c,className:"output-area",cellId:dr,stale:!1,loading:!1})}),d.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[35%]",children:d.jsx(Jp,{consoleOutputs:h,className:"overflow-auto",stale:!1,cellName:D3,onSubmitDebugger:wn.NOOP,cellId:dr,debuggerActive:!1})})]}),t[12]=p,t[13]=h,t[14]=x,t[15]=A,t[16]=c,t[17]=o,t[18]=n,t[19]=R):R=t[19];const z=R;let D;t[20]!==I||t[21]!==b||t[22]!==g||t[23]!==o?(D=()=>g?d.jsx("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:d.jsx("div",{className:"overflow-auto flex flex-col gap-3",children:b.map((ie,Me)=>d.jsx("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>I(ie),children:d.jsx(M.Suspense,{children:d.jsx(la,{language:"python",theme:o,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:ie.trim(),editable:!1,readOnly:!0})})},Me))})}):null,t[20]=I,t[21]=b,t[22]=g,t[23]=o,t[24]=D):D=t[24];const F=D;let B,U,O,S,$,E,W,G,q,Y,Q;t[25]===Symbol.for("react.memo_cache_sentinel")?(B=Ss.create(dr),U=d.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]=B,t[26]=U):(B=t[25],U=t[26]),t[27]===Symbol.for("react.memo_cache_sentinel")?(O=nn("cell.run"),t[27]=O):O=t[27],t[28]===Symbol.for("react.memo_cache_sentinel")?(S=d.jsx(Hs,{color:"var(--grass-11)",size:16}),t[28]=S):S=t[28],t[29]!==x||t[30]!==g?($=d.jsx(Ae,{content:O,children:d.jsx(Te,{"data-testid":"scratchpad-run-button",onClick:x,disabled:g,variant:"text",size:"xs",children:S})}),t[29]=x,t[30]=g,t[31]=$):$=t[31],t[32]===Symbol.for("react.memo_cache_sentinel")?(E=d.jsx(lm,{size:16}),t[32]=E):E=t[32],t[33]!==j||t[34]!==g?(W=d.jsx(Ae,{content:"Clear code and outputs",children:d.jsx(Te,{disabled:g,size:"xs",variant:"text",onClick:j,children:E})}),t[33]=j,t[34]=g,t[35]=W):W=t[35],t[36]===Symbol.for("react.memo_cache_sentinel")?(G=d.jsx(Lr,{size:16}),t[36]=G):G=t[36],t[37]!==C||t[38]!==g?(q=d.jsx(Ys,{children:d.jsx(Ae,{content:"Insert code",children:d.jsx(Te,{disabled:g,size:"xs",variant:"text",onClick:C,children:G})})}),t[37]=C,t[38]=g,t[39]=q):q=t[39],t[40]!==u?(Y=(u==="running"||u==="queued")&&d.jsx(Vn,{className:"inline",size:"small"}),t[40]=u,t[41]=Y):Y=t[41],t[42]===Symbol.for("react.memo_cache_sentinel")?(Q=d.jsx("div",{className:"flex-1"}),t[42]=Q):Q=t[42];const re=g&&"bg-[var(--sky-3)] rounded-none";let ae,Z;t[43]!==re?(ae=je(re),t[43]=re,t[44]=ae):ae=t[44],t[45]!==g||t[46]!==m?(Z=()=>m(!g),t[45]=g,t[46]=m,t[47]=Z):Z=t[47];const te=b.length===0;let ue,me,de,fe,he,Ce,Ee;return t[48]===Symbol.for("react.memo_cache_sentinel")?(ue=d.jsx(mm,{size:16}),t[48]=ue):ue=t[48],t[49]!==ae||t[50]!==Z||t[51]!==te?(me=d.jsx(Ae,{content:"Toggle history",children:d.jsx(Te,{size:"xs",variant:"text",className:ae,onClick:Z,disabled:te,children:ue})}),t[49]=ae,t[50]=Z,t[51]=te,t[52]=me):me=t[52],t[53]!==$||t[54]!==W||t[55]!==q||t[56]!==Y||t[57]!==me?(de=d.jsxs("div",{className:"flex items-center flex-shrink-0",children:[$,W,q,Y,Q,me]}),t[53]=$,t[54]=W,t[55]=q,t[56]=Y,t[57]=me,t[58]=de):de=t[58],t[59]!==z?(fe=z(),t[59]=z,t[60]=fe):fe=t[60],t[61]!==F?(he=F(),t[61]=F,t[62]=he):he=t[62],t[63]!==fe||t[64]!==he?(Ce=d.jsxs("div",{className:"flex-1 divide-y relative overflow-hidden flex flex-col",children:[fe,he]}),t[63]=fe,t[64]=he,t[65]=Ce):Ce=t[65],t[66]!==de||t[67]!==Ce?(Ee=d.jsxs("div",{className:"flex flex-col h-full overflow-hidden divide-y",id:B,children:[U,de,Ce]}),t[66]=de,t[67]=Ce,t[68]=Ee):Ee=t[68],Ee},wF=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=d.jsx(xF,{}),t[0]=e):e=t[0],e},vF=()=>{const t=X.c(23),{openModal:e,closeModal:n}=Fn();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const{data:r,isPending:s,error:i,refetch:a}=zn(SF,o);if(s){let b;return t[1]===Symbol.for("react.memo_cache_sentinel")?(b=d.jsx(Vn,{size:"medium",centered:!0}),t[1]=b):b=t[1],b}if(i){let b;return t[2]!==i?(b=d.jsx(Dr,{error:i}),t[2]=i,t[3]=b):b=t[3],b}let l;t[4]!==r?(l=r.filter(CF).map(NF),t[4]=r,t[5]=l):l=t[5];const c=l;if(r.length===0){let b;return t[6]===Symbol.for("react.memo_cache_sentinel")?(b=d.jsx(gn,{title:"No environment variables",description:"No environment variables are available in this notebook.",icon:d.jsx(Yc,{})}),t[6]=b):b=t[6],b}let u,h,f,p,_,g,m;return t[7]!==n||t[8]!==e||t[9]!==c||t[10]!==a?(u=()=>e(d.jsx(gg,{providerNames:c,onSuccess:()=>{a(),n()},onClose:n})),t[7]=n,t[8]=e,t[9]=c,t[10]=a,t[11]=u):u=t[11],t[12]===Symbol.for("react.memo_cache_sentinel")?(h=d.jsx(ar,{className:"h-4 w-4"}),t[12]=h):h=t[12],t[13]!==u?(f=d.jsx("div",{className:"flex justify-end h-8 border-b",children:d.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")?(p=d.jsx(Vp,{children:d.jsxs(Vs,{children:[d.jsx(Rr,{children:"Environment Variable"}),d.jsx(Rr,{children:"Source"}),d.jsx(Rr,{})]})}),t[15]=p):p=t[15],t[16]!==r?(_=r.map(jF),t[16]=r,t[17]=_):_=t[17],t[18]!==_?(g=d.jsxs($p,{className:"overflow-auto flex-1 mb-16",children:[p,d.jsx(Hp,{children:_})]}),t[18]=_,t[19]=g):g=t[19],t[20]!==f||t[21]!==g?(m=d.jsxs("div",{className:"flex flex-col h-full",children:[f,g]}),t[20]=f,t[21]=g,t[22]=m):m=t[22],m},kF=t=>{const e=X.c(9),{className:n,ariaLabel:o,onCopy:r}=t,[s,i]=K.useState(!1);let a;e[0]!==r?(a=()=>{r(),i(!0),setTimeout(()=>i(!1),1e3)},e[0]=r,e[1]=a):a=e[1];const l=a;let c,u;return e[2]!==s?(c=s?d.jsx(dc,{className:"w-3 h-3 text-green-700 rounded"}):d.jsx($i,{className:"w-3 h-3 hover:bg-muted rounded"}),e[2]=s,e[3]=c):c=e[3],e[4]!==o||e[5]!==n||e[6]!==l||e[7]!==c?(u=d.jsx("button",{type:"button",className:n,onClick:l,"aria-label":o,children:c}),e[4]=o,e[5]=n,e[6]=l,e[7]=c,e[8]=u):u=e[8],u};async function SF(){return mg((await MS.request({})).secrets)}function CF(t){return t.provider!=="env"}function NF(t){return t.name}function jF(t){return t.keys.map(e=>d.jsxs(Vs,{className:"group",children:[d.jsx(Pr,{children:e}),d.jsx(Pr,{children:t.provider!=="env"&&d.jsx(nS,{variant:"outline",className:"select-none",children:t.name})}),d.jsx(Pr,{children:d.jsx(kF,{ariaLabel:`Copy ${e}`,onCopy:async()=>{await pn(`os.environ["${e}"]`),ut({title:"Copied to clipboard",description:`os.environ["${e}"] has been copied to your clipboard.`})},className:je("float-right px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible")})})]},`${t.name}-${e}`))}const EF=t=>{const e=X.c(6),{children:n}=t,{openModal:o,closeModal:r}=Fn();let s,i;return e[0]!==r||e[1]!==o?(s=()=>o(d.jsx(AF,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(i=d.jsx(Y4,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=i):i=e[5],i},IF=[tt.lineWrapping],AF=t=>{const e=X.c(23),{onClose:n}=t,[o,r]=M.useState(""),{theme:s}=lr();let i,a,l,c,u,h;e[0]!==n?(i=async x=>{x.preventDefault();const v=new FormData(x.target),C=v.get("title"),k=v.get("description"),j=v.get("code");fetch("https://marimo.io/api/suggest-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:C,description:k,code:j})}),n(),ut({title:"Snippet Submitted",description:"Thank you for contributing! We will review your snippet shortly."})},e[0]=n,e[1]=i):i=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsx(er,{children:"Contribute a Snippet"}),e[2]=a):a=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(l=d.jsxs(vs,{children:[a,d.jsxs(ks,{children:["Have a useful snippet you want to share with the community? Submit it here or make a pull request"," ",d.jsx("a",{href:Yn.githubPage,target:"_blank",className:"underline",children:"on GitHub"}),"."]})]}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(tr,{id:"title",name:"title",autoFocus:!0,placeholder:"Title",required:!0,autoComplete:"off"}),u=d.jsx(G$,{id:"description",name:"description",autoFocus:!0,placeholder:"Description",rows:5,required:!0,autoComplete:"off"}),e[4]=c,e[5]=u):(c=e[4],u=e[5]),e[6]!==o?(h=d.jsx("input",{type:"hidden",name:"code",value:o}),e[6]=o,e[7]=h):h=e[7];const f=s==="dark"?"dark":"light";let p,_,g,m,b,y;return e[8]!==o||e[9]!==f?(p=d.jsx(la,{theme:f,language:"python",className:"cm border rounded overflow-hidden",extensions:IF,value:o,onChange:r}),e[8]=o,e[9]=f,e[10]=p):p=e[10],e[11]!==h||e[12]!==p?(_=d.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[c,u,h,p]}),e[11]=h,e[12]=p,e[13]=_):_=e[13],e[14]!==n?(g=d.jsx(Te,{"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")?(m=d.jsx(Te,{"data-testid":"snippet-send-button","aria-label":"Save",variant:"default",type:"submit",children:"Send"}),e[16]=m):m=e[16],e[17]!==g?(b=d.jsxs(Vi,{children:[g,m]}),e[17]=g,e[18]=b):b=e[18],e[19]!==i||e[20]!==b||e[21]!==_?(y=d.jsx(nr,{className:"w-fit",children:d.jsxs("form",{onSubmit:i,children:[l,_,b]})}),e[19]=i,e[20]=b,e[21]=_,e[22]=y):y=e[22],y},TF=[tt.lineWrapping],MF=()=>{const t=X.c(20),[e,n]=K.useState();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const{data:r,error:s,isPending:i}=zn(RF,o);if(s){let b;return t[1]!==s?(b=d.jsx(Dr,{error:s}),t[1]=s,t[2]=b):b=t[2],b}if(i||!r){let b;return t[3]===Symbol.for("react.memo_cache_sentinel")?(b=d.jsx(Vn,{size:"medium",centered:!0}),t[3]=b):b=t[3],b}const a=e?"h-1/3":"h-full";let l,c,u,h,f,p,_,g,m;return t[4]!==a?(l=je("border-b rounded-none",a),t[4]=a,t[5]=l):l=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(qi,{placeholder:"Search snippets...",className:"h-6 m-1",rootClassName:"flex-1 border-r"}),t[6]=c):c=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(u=d.jsxs("div",{className:"flex items-center w-full",children:[c,d.jsx(EF,{children:d.jsx("button",{className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:d.jsx(ar,{className:"h-4 w-4"})})})]}),h=d.jsx(tc,{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?(p=d.jsx(DF,{onSelect:f,snippets:r.snippets}),t[10]=r.snippets,t[11]=p):p=t[11],t[12]!==l||t[13]!==p?(_=d.jsxs(fc,{className:l,children:[u,h,p]}),t[12]=l,t[13]=p,t[14]=_):_=t[14],t[15]!==e?(g=d.jsx(M.Suspense,{children:d.jsx("div",{className:"h-2/3 snippet-viewer flex flex-col",children:e?d.jsx(OF,{snippet:e},e.title):d.jsx(gn,{title:"",description:"Click on a snippet to view its content."})})}),t[15]=e,t[16]=g):g=t[16],t[17]!==_||t[18]!==g?(m=d.jsxs("div",{className:"flex-1 overflow-hidden",children:[_,g]}),t[17]=_,t[18]=g,t[19]=m):m=t[19],m},OF=t=>{const e=X.c(27),{snippet:n}=t,{theme:o}=lr(),{createNewCell:r}=It(),s=As();let i;e[0]!==r||e[1]!==s||e[2]!==n.sections?(i=()=>{for(const m of[...n.sections].reverse())m.code&&r({code:m.code,before:!1,cellId:s??"__end__",skipIfCodeExists:!0})},e[0]=r,e[1]=s,e[2]=n.sections,e[3]=i):i=e[3];const a=i;let l;e[4]!==r||e[5]!==s?(l=m=>{r({code:m,before:!1,cellId:s??"__end__"})},e[4]=r,e[5]=s,e[6]=l):l=e[6];const c=l;let u,h,f,p,_,g;if(e[7]!==n.title?(u=d.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=d.jsx(Lr,{className:"ml-2 h-4 w-4"}),e[9]=h):h=e[9],e[10]!==a?(f=d.jsx("div",{className:"flex justify-end",children:d.jsx(Ys,{children:d.jsxs(Te,{className:"float-right",size:"xs",variant:"outline",onClick:a,children:["Insert snippet",h]})})}),e[10]=a,e[11]=f):f=e[11],e[12]!==c||e[13]!==n.sections||e[14]!==n.title||e[15]!==o){let m;e[17]!==c||e[18]!==n.title||e[19]!==o?(m=b=>{const{code:y,html:x,id:v}=b;return x?d.jsx("div",{children:Fp({html:x})},`${n.title}-${v}`):y?d.jsxs("div",{className:"relative hover-actions-parent pr-2",children:[d.jsx(Ys,{children:d.jsx(Ae,{content:"Insert snippet",children:d.jsx(Te,{className:"absolute -top-2 -right-1 z-10 hover-action px-2 bg-background",size:"sm",variant:"outline",onClick:()=>{c(y)},children:d.jsx(Lr,{className:"h-5 w-5"})})})}),d.jsx(M.Suspense,{children:d.jsx(la,{theme:o==="dark"?"dark":"light",language:"python",className:"cm border rounded overflow-hidden",extensions:TF,value:y,readOnly:!0},`${n.title}-${v}`)})]},`${n.title}-${v}`):null},e[17]=c,e[18]=n.title,e[19]=o,e[20]=m):m=e[20],p=n.sections.map(m),e[12]=c,e[13]=n.sections,e[14]=n.title,e[15]=o,e[16]=p}else p=e[16];return e[21]!==f||e[22]!==p?(_=d.jsxs("div",{className:"px-2 py-2 space-y-4 overflow-auto flex-1",children:[f,p]}),e[21]=f,e[22]=p,e[23]=_):_=e[23],e[24]!==u||e[25]!==_?(g=d.jsxs(d.Fragment,{children:[u,_]}),e[24]=u,e[25]=_,e[26]=g):g=e[26],g},DF=t=>{const e=X.c(7),{snippets:n,onSelect:o}=t;let r,s;if(e[0]!==o||e[1]!==n){let i;e[3]!==o?(i=a=>d.jsx(lo,{className:"rounded-none",onSelect:()=>o(a),children:d.jsx("div",{className:"flex flex-row gap-2 items-center",children:d.jsx("span",{className:"mt-1 text-accent-foreground",children:a.title})})},a.title),e[3]=o,e[4]=i):i=e[4],r=n.map(i),e[0]=o,e[1]=n,e[2]=r}else r=e[2];return e[5]!==r?(s=d.jsx(jp,{className:"flex flex-col overflow-auto",children:r}),e[5]=r,e[6]=s):s=e[6],s};function RF(){return Y$()}const PF=K.lazy(()=>Ep(()=>import("./tracing-CCltm96L.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]),import.meta.url).then(t=>({default:t.Tracing}))),LF=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=d.jsx(K.Suspense,{fallback:d.jsx(FF,{}),children:d.jsx(PF,{})}),t[0]=e):e=t[0],e},FF=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=d.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:d.jsx(Vn,{})}),t[0]=e):e=t[0],e},m3="name",g3="type-value",Jf="defs-refs",zF=[{id:m3,accessorFn:t=>[t.name,t.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>d.jsx(Wp,{header:"Name",column:t}),cell:({getValue:t})=>{const[e,n]=t();return d.jsx(af,{name:e,declaredBy:n})}},{id:g3,accessorFn:t=>[t.dataType,t.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>d.jsx(Wp,{header:d.jsxs("div",{className:"flex flex-col gap-1",children:[d.jsx("span",{children:"Type"}),d.jsx("span",{children:"Value"})]}),column:t}),cell:({getValue:t})=>{const[e,n]=t();return d.jsxs("div",{className:"max-w-[150px]",children:[d.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs",children:e}),d.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap",title:n??"",children:n})]})}},{id:Jf,accessorFn:t=>[t.declaredBy,t.usedBy,t.name,t.declaredByNames,t.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:t})=>d.jsx(Wp,{header:d.jsxs("div",{className:"flex flex-col gap-1",children:[d.jsx("span",{children:"Declared By"}),d.jsx("span",{children:"Used By"})]}),column:t}),cell:({getValue:t})=>{const[e,n,o]=t(),r=s=>{const i=Jl(s);i&&zp(i,o)};return d.jsxs("div",{className:"flex flex-col gap-1 py-1",children:[d.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-center",children:[d.jsx("span",{title:"Declared by",children:d.jsx(Rm,{className:"w-3.5 h-3.5 text-muted-foreground"})}),e.length===1?d.jsx(cr,{variant:"focus",cellId:e[0],skipScroll:!0,onClick:()=>r(e[0])}):d.jsx("div",{className:"text-destructive flex flex-row gap-2",children:e.slice(0,3).map((s,i)=>d.jsxs("span",{className:"flex",children:[d.jsx(cr,{variant:"focus",cellId:s,skipScroll:!0,className:"whitespace-nowrap text-destructive",onClick:()=>r(s)},s),i<e.length-1&&", "]},s))})]}),d.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-baseline",children:[d.jsx("span",{title:"Used by",children:d.jsx(ba,{className:"w-3.5 h-3.5 text-muted-foreground"})}),d.jsx(z2,{maxCount:3,cellIds:n,skipScroll:!0,onClick:r})]})]})}}],_3=M.memo(({className:t,cellIds:e,variables:n})=>{const[o,r]=K.useState([]),[s,i]=K.useState(""),a=J$(),l=M.useMemo(()=>{const h=f=>{const p=a[f];return eH(p)?`cell-${e.indexOf(f)}`:p??`cell-${e.indexOf(f)}`};return Object.values(n).map(f=>({...f,declaredByNames:f.declaredBy.map(h),usedByNames:f.usedBy.map(h)}))},[n,a,e]),c=M.useMemo(()=>{const h=new Map;return e.forEach((f,p)=>h.set(f,p)),function(f,p,_){p||(p={id:Jf,desc:!1});let g=[];switch(p.id){case m3:g=ua(f,m=>m.name);break;case g3:g=ua(f,m=>m.dataType);break;case Jf:g=ua(f,m=>_.get(m.declaredBy[0]))}return p.desc?g.reverse():g}(l,o[0],h)},[l,o,e]),u=K$({data:c,columns:zF,getCoreRowModel:Q$(),onGlobalFilterChange:i,getFilteredRowModel:Z$(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter:h=>h.columnDef.enableGlobalFilter??!0,globalFilterFn:"auto",manualSorting:!0,onSortingChange:r,getSortedRowModel:X$(),state:{sorting:o,globalFilter:s}});return d.jsxs(d.Fragment,{children:[d.jsx(_S,{className:"w-full",placeholder:"Search",value:s,onChange:h=>i(h.target.value)}),d.jsxs($p,{className:je("w-full text-sm flex-1 border-separate border-spacing-0",t),children:[d.jsx(Vp,{children:d.jsx(Vs,{className:"whitespace-nowrap text-xs",children:u.getFlatHeaders().map(h=>d.jsx(Rr,{className:"sticky top-0 bg-background border-b",children:wS(h.column.columnDef.header,h.getContext())},h.id))})}),d.jsx(Hp,{children:u.getRowModel().rows.map(h=>d.jsx(Vs,{className:"hover:bg-accent",children:h.getVisibleCells().map(f=>d.jsx(Pr,{className:"border-b",children:wS(f.column.columnDef.cell,f.getContext())},f.id))},h.id))})]})]})});_3.displayName="VariableTable";const BF=()=>{const t=X.c(4),e=rS(),n=Pc();if(Object.keys(e).length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=d.jsx(gn,{title:"No variables",description:"Global variables will appear here.",icon:d.jsx(ql,{})}),t[0]=r):r=t[0],r}let o;return t[1]!==n.inOrderIds||t[2]!==e?(o=d.jsx(_3,{className:"flex-1",cellIds:n.inOrderIds,variables:e}),t[1]=n.inOrderIds,t[2]=e,t[3]=o):o=t[3],o},UF=K.lazy(()=>Ep(()=>import("./terminal-MtCDBvKs.js"),__vite__mapDeps([123,1,2,124]),import.meta.url)),VF=t=>{const e=X.c(121),{children:n}=t,{isSidebarOpen:o,isTerminalOpen:r,selectedPanel:s}=cc(),{setIsSidebarOpen:i,setIsTerminalOpen:a}=Ji(),l=K.useRef(null),c=K.useRef(null);let u,h,f,p,_;e[0]!==o?(u=()=>{if(!l.current)return;const le=l.current.isCollapsed();o&&le&&l.current.expand(),o||le||l.current.collapse(),requestAnimationFrame(HF)},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(!c.current)return;const le=c.current.isCollapsed();r&&le&&c.current.expand(),r||le||c.current.collapse(),requestAnimationFrame(qF)},p=[r],e[3]=r,e[4]=f,e[5]=p):(f=e[4],p=e[5]),M.useEffect(f,p),e[6]!==n?(_=d.jsx(Fc,{id:"app",className:"relative h-full",children:d.jsx(M.Suspense,{children:n})},"app"),e[6]=n,e[7]=_):_=e[7];const g=_,m=o?"resize-handle":"resize-handle-collapsed";let b,y;e[8]!==m?(b=je("border-border no-print z-10",m,"vertical"),e[8]=m,e[9]=b):b=e[9],e[10]!==b?(y=d.jsx(vS,{onDragging:kS,className:b}),e[10]=b,e[11]=y):y=e[11];const x=y,v=r?"resize-handle":"resize-handle-collapsed";let C,k;e[12]!==v?(C=je("border-border no-print z-20",v,"horizontal"),e[12]=v,e[13]=C):C=e[13],e[14]!==C?(k=d.jsx(vS,{onDragging:kS,className:C}),e[14]=C,e[15]=k):k=e[15];const j=k;let N,I,A,T,R,z,D,F,B,U,O,S,$,E,W,G,q,Y,Q,re,ae;e[16]!==s?(N=d.jsx("div",{className:"text-sm text-[var(--slate-11)] uppercase tracking-wide font-semibold flex-1",children:s}),e[16]=s,e[17]=N):N=e[17],e[18]!==i?(I=()=>i(!1),e[18]=i,e[19]=I):I=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(A=d.jsx(Jn,{className:"w-4 h-4"}),e[20]=A):A=e[20],e[21]!==I?(T=d.jsx(Te,{"data-testid":"close-helper-pane",className:"m-0",size:"xs",variant:"text",onClick:I,children:A}),e[21]=I,e[22]=T):T=e[22],e[23]!==N||e[24]!==T?(R=d.jsxs("div",{className:"p-3 border-b flex justify-between items-center",children:[N,T]}),e[23]=N,e[24]=T,e[25]=R):R=e[25],e[26]!==s?(z=s==="files"&&d.jsx(a3,{}),e[26]=s,e[27]=z):z=e[27],e[28]!==s?(D=s==="errors"&&d.jsx(FL,{}),e[28]=s,e[29]=D):D=e[29],e[30]!==s?(F=s==="variables"&&d.jsx(BF,{}),e[30]=s,e[31]=F):F=e[31],e[32]!==s?(B=s==="dependencies"&&d.jsx(kL,{}),e[32]=s,e[33]=B):B=e[33],e[34]!==s?(U=s==="packages"&&d.jsx(dF,{}),e[34]=s,e[35]=U):U=e[35],e[36]!==s?(O=s==="outline"&&d.jsx(cF,{}),e[36]=s,e[37]=O):O=e[37],e[38]!==s?(S=s==="datasources"&&d.jsx(PL,{}),e[38]=s,e[39]=S):S=e[39],e[40]!==s?($=s==="documentation"&&d.jsx(LL,{}),e[40]=s,e[41]=$):$=e[41],e[42]!==s?(E=s==="snippets"&&d.jsx(MF,{}),e[42]=s,e[43]=E):E=e[43],e[44]!==s?(W=s==="scratchpad"&&d.jsx(wF,{}),e[44]=s,e[45]=W):W=e[45],e[46]!==s?(G=s==="chat"&&d.jsx(qD,{}),e[46]=s,e[47]=G):G=e[47],e[48]!==s?(q=s==="logs"&&d.jsx(l3,{}),e[48]=s,e[49]=q):q=e[49],e[50]!==s?(Y=s==="tracing"&&d.jsx(LF,{}),e[50]=s,e[51]=Y):Y=e[51],e[52]!==s?(Q=s==="secrets"&&d.jsx(vF,{}),e[52]=s,e[53]=Q):Q=e[53],e[54]!==z||e[55]!==D||e[56]!==F||e[57]!==B||e[58]!==U||e[59]!==O||e[60]!==S||e[61]!==$||e[62]!==E||e[63]!==W||e[64]!==G||e[65]!==q||e[66]!==Y||e[67]!==Q?(re=d.jsx(M.Suspense,{children:d.jsxs(Dc,{children:[z,D,F,B,U,O,S,$,E,W,G,q,Y,Q]})}),e[54]=z,e[55]=D,e[56]=F,e[57]=B,e[58]=U,e[59]=O,e[60]=S,e[61]=$,e[62]=E,e[63]=W,e[64]=G,e[65]=q,e[66]=Y,e[67]=Q,e[68]=re):re=e[68],e[69]!==R||e[70]!==re?(ae=d.jsx(pc,{children:d.jsxs("div",{className:"flex flex-col h-full flex-1 overflow-hidden mr-[-4px]",children:[R,re]})}),e[69]=R,e[70]=re,e[71]=ae):ae=e[71];const Z=ae,te=o&&"border-r border-l border-[var(--slate-7)]";let ue,me,de,fe,he,Ce;e[72]!==te?(ue=je("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",te),e[72]=te,e[73]=ue):ue=e[73],e[74]===Symbol.for("react.memo_cache_sentinel")?(me=(le,He)=>{var Fe;He===0&&le===10&&((Fe=l.current)==null||Fe.resize(30))},e[74]=me):me=e[74],e[75]!==i?(de=()=>i(!1),fe=()=>i(!0),e[75]=i,e[76]=de,e[77]=fe):(de=e[76],fe=e[77]),e[78]!==Z||e[79]!==x?(he=d.jsxs("span",{className:"flex flex-row h-full",children:[Z," ",x]}),e[78]=Z,e[79]=x,e[80]=he):he=e[80],e[81]!==ue||e[82]!==de||e[83]!==fe||e[84]!==he?(Ce=d.jsx(Fc,{ref:l,id:"helper",collapsedSize:0,collapsible:!0,className:ue,minSize:10,defaultSize:0,maxSize:75,onResize:me,onCollapse:de,onExpand:fe,children:he},"helper"),e[81]=ue,e[82]=de,e[83]=fe,e[84]=he,e[85]=Ce):Ce=e[85];const Ee=Ce,ie=r&&"border-[var(--slate-7)]";let Me,xe,Re,Ue,Je,Ke,Pe,st,et;e[86]!==ie?(Me=je("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",ie),e[86]=ie,e[87]=Me):Me=e[87],e[88]===Symbol.for("react.memo_cache_sentinel")?(xe=(le,He)=>{var Fe;He===0&&le===10&&((Fe=c.current)==null||Fe.resize(30))},e[88]=xe):xe=e[88],e[89]!==a?(Re=()=>a(!1),Ue=()=>a(!0),e[89]=a,e[90]=Re,e[91]=Ue):(Re=e[90],Ue=e[91]),e[92]===Symbol.for("react.memo_cache_sentinel")?(Je=d.jsx("div",{}),e[92]=Je):Je=e[92],e[93]!==a?(Ke=()=>a(!1),e[93]=a,e[94]=Ke):Ke=e[94],e[95]!==r||e[96]!==Ke?(Pe=d.jsx(M.Suspense,{fallback:Je,children:d.jsx(UF,{visible:r,onClose:Ke})}),e[95]=r,e[96]=Ke,e[97]=Pe):Pe=e[97],e[98]!==r||e[99]!==Pe?(st=d.jsx(SL,{isOpen:r,children:Pe}),e[98]=r,e[99]=Pe,e[100]=st):st=e[100],e[101]!==Me||e[102]!==Re||e[103]!==Ue||e[104]!==st||e[105]!==j?(et=d.jsxs(Fc,{ref:c,id:"terminal",collapsedSize:0,collapsible:!0,className:Me,minSize:10,defaultSize:0,maxSize:75,onResize:xe,onCollapse:Re,onExpand:Ue,children:[j,st]},"terminal"),e[101]=Me,e[102]=Re,e[103]=Ue,e[104]=st,e[105]=j,e[106]=et):et=e[106];const nt=et;let ne,ve,Se,De,J,ge,_e,pe;return e[107]===Symbol.for("react.memo_cache_sentinel")?(ne=qH(),e[107]=ne):ne=e[107],e[108]===Symbol.for("react.memo_cache_sentinel")?(ve=d.jsx(Dc,{children:d.jsx(jO,{})}),e[108]=ve):ve=e[108],e[109]!==nt?(Se=d.jsx(Mx,{capability:"terminal",children:nt}),e[109]=nt,e[110]=Se):Se=e[110],e[111]!==g||e[112]!==Se?(De=d.jsx(Fc,{children:d.jsxs(SS,{autoSaveId:"marimo:chrome:v1:l1",direction:"vertical",children:[g,Se]})}),e[111]=g,e[112]=Se,e[113]=De):De=e[113],e[114]===Symbol.for("react.memo_cache_sentinel")?(J=d.jsx(tH,{}),e[114]=J):J=e[114],e[115]!==Ee||e[116]!==De?(ge=d.jsxs(SS,{autoSaveId:"marimo:chrome:v1:l2",direction:"horizontal",storage:ne,children:[ve,Ee,De,J]}),e[115]=Ee,e[116]=De,e[117]=ge):ge=e[117],e[118]===Symbol.for("react.memo_cache_sentinel")?(_e=d.jsx(pc,{children:d.jsx(Dc,{children:d.jsx(vO,{})})}),e[118]=_e):_e=e[118],e[119]!==ge?(pe=d.jsxs(GH,{children:[ge,_e]}),e[119]=ge,e[120]=pe):pe=e[120],pe};function $F(){window.dispatchEvent(new Event("resize"))}function HF(){requestAnimationFrame($F)}function WF(){window.dispatchEvent(new Event("resize"))}function qF(){requestAnimationFrame(WF)}let b3;b3=new URL(window.location.href).searchParams.get(nH.showChrome)==="false",VS=Object.freeze(Object.defineProperty({__proto__:null,default:t=>{const e=X.c(10);if(b3){let s,i,a;return e[0]!==t?(s=d.jsx(Tx,{hideControls:!0,...t}),e[0]=t,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsx(Jm,{}),e[2]=i):i=e[2],e[3]!==s?(a=d.jsxs(d.Fragment,{children:[s,i]}),e[3]=s,e[4]=a):a=e[4],a}let n,o,r;return e[5]!==t?(n=d.jsx(Tx,{...t}),e[5]=t,e[6]=n):n=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(o=d.jsx(Jm,{}),e[7]=o):o=e[7],e[8]!==n?(r=d.jsxs(VF,{children:[n,o]}),e[8]=n,e[9]=r):r=e[9],r}},Symbol.toStringTag,{value:"Module"}))});export{Zp as C,Uc as E,gn as P,XH as __tla,Vc as a,VS as e,ha as f};
144
+ `).length),position:{x:0,y:0}}}createElements(t,e,n,o){const r=[],s=[],i=new Set,a=new Set;for(const l of Object.values(n)){if(l.value==="marimo"&&l.name==="mo")continue;const{declaredBy:c,usedBy:u}=l;for(const h of c)for(const f of u){const p=`${h}-${f}`;a.has(p)||(a.add(p),i.add(h),i.add(f),s.push(this.createEdge(h,f)))}}for(const[l,c]of Lp.zip(t,e)){o||r.push(this.createNode(l,c));const u=i.has(l),h=ct.get(c).code.trim().startsWith("mo.md");!u&&h||r.push(this.createNode(l,c))}return{nodes:r,edges:s}}},bL=t=>{const e=X.c(43),{cellIds:n,variables:o,cellAtoms:r,children:s,layoutDirection:i,settings:a}=t;let l;e[0]!==r||e[1]!==n||e[2]!==i||e[3]!==a.hidePureMarkdown||e[4]!==o?(l=()=>{let S=e3.createElements(n,r,o,a.hidePureMarkdown);return S=Qk(S.nodes,S.edges,{direction:i}),S},e[0]=r,e[1]=n,e[2]=i,e[3]=a.hidePureMarkdown,e[4]=o,e[5]=l):l=e[5];const[c]=M.useState(l),[u,h,f]=M2(c.nodes),[p,_,g]=O2(c.edges),m=Li();let b;e[6]!==i||e[7]!==_||e[8]!==h?(b=S=>{const $=Qk(S.nodes,S.edges,{direction:i});h($.nodes),_($.edges)},e[6]=i,e[7]=_,e[8]=h,e[9]=b):b=e[9];const y=Xe(b);let x,v;e[10]!==r||e[11]!==n||e[12]!==a.hidePureMarkdown||e[13]!==y||e[14]!==o?(x=()=>{y(e3.createElements(n,r,o,a.hidePureMarkdown))},v=[n,o,r,y,a.hidePureMarkdown],e[10]=r,e[11]=n,e[12]=a.hidePureMarkdown,e[13]=y,e[14]=o,e[15]=x,e[16]=v):(x=e[15],v=e[16]),M.useEffect(x,v);const[C,k]=M.useState();let j;B2(),e[17]===Symbol.for("react.memo_cache_sentinel")?(j=()=>{k(void 0)},e[17]=j):j=e[17];const N=j;let I,A,T,R,z,D,F,B,U,O;return e[18]===Symbol.for("react.memo_cache_sentinel")?(I={minZoom:.5,maxZoom:1.5},A=(S,$)=>{k({type:"node",id:$.id})},T=(S,$)=>{const{source:E,target:W}=$;k({type:"edge",source:E,target:W})},e[18]=I,e[19]=A,e[20]=T):(I=e[18],A=e[19],T=e[20]),e[21]===Symbol.for("react.memo_cache_sentinel")?(R=d.jsx(FP,{color:"#ccc",variant:Dn.Dots}),e[21]=R):R=e[21],e[22]!==m||e[23]!==u?(z=()=>{const S=ct.get(r$);if(S){const $=u.find(E=>E.id===S);$&&(m.fitView({padding:1,duration:600,nodes:[$]}),k({type:"node",id:S}))}},e[22]=m,e[23]=u,e[24]=z):z=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(D=d.jsx(xm,{className:"size-4"}),e[25]=D):D=e[25],e[26]!==z?(F=d.jsx(MP,{position:"bottom-right",showInteractive:!1,children:d.jsx(Ae,{content:"Jump to focused cell",delayDuration:200,side:"left",asChild:!1,children:d.jsx(ys,{onMouseDown:Pn.preventFocus,onClick:z,children:D})})}),e[26]=z,e[27]=F):F=e[27],e[28]!==p||e[29]!==C||e[30]!==o?(B=d.jsx(Vl,{selection:C,variables:o,edges:p,onClearSelection:N}),e[28]=p,e[29]=C,e[30]=o,e[31]=B):B=e[31],e[32]!==s||e[33]!==p||e[34]!==u||e[35]!==g||e[36]!==f||e[37]!==F||e[38]!==B?(U=d.jsxs(rf,{nodes:u,edges:p,nodeTypes:F2,minZoom:.2,fitViewOptions:I,onNodeClick:A,onEdgeClick:T,onNodeDoubleClick:yL,fitView:!0,onNodesChange:f,onEdgesChange:g,zoomOnDoubleClick:!1,nodesConnectable:!1,children:[R,F,B,s]}),e[32]=s,e[33]=p,e[34]=u,e[35]=g,e[36]=f,e[37]=F,e[38]=B,e[39]=U):U=e[39],e[40]!==i||e[41]!==U?(O=d.jsx(P2,{value:i,children:U}),e[40]=i,e[41]=U,e[42]=O):O=e[42],O};function yL(t,e){oS(e.id,"focus")}const xL=Ht("_minimap_"),wL=Ht({hidePureMarkdown:!0}),vL=t=>{const e=X.c(11),[n,o]=tn(xL),[r,s]=tn(wL);let i;e[0]!==n||e[1]!==t||e[2]!==o||e[3]!==s||e[4]!==r?(i=()=>n==="_minimap_"?d.jsx($P,{...t,children:d.jsx(lf,{settings:r,onSettingsChange:s,view:n,onChange:o})}):d.jsx(bL,{...t,settings:r,layoutDirection:n,children:d.jsx(lf,{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]=i):i=e[5];const a=i;let l,c;return e[6]!==a?(l=a(),e[6]=a,e[7]=l):l=e[7],e[8]!==n||e[9]!==l?(c=d.jsx(of,{children:l},n),e[8]=n,e[9]=l,e[10]=c):c=e[10],c},kL=()=>{const t=X.c(5),e=rS(),n=Pc(),[o]=s$();let r,s;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=je("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=d.jsx("div",{className:r,children:d.jsx(vL,{cellAtoms:o,variables:e,cellIds:n.inOrderIds})}),t[1]=n.inOrderIds,t[2]=o,t[3]=e,t[4]=s):s=t[4],s},SL=t=>{const e=X.c(4),{isOpen:n,children:o}=t,[r,s]=K.useState(!1);let i,a;return e[0]!==r||e[1]!==n?(i=()=>{n&&!r&&s(!0)},a=[n,r],e[0]=r,e[1]=n,e[2]=i,e[3]=a):(i=e[2],a=e[3]),K.useEffect(i,a),r?o:null},CL=t=>{const e=X.c(8),{variableName:n,className:o}=t;let r;e[0]!==n?(r=()=>{const l=function(u){const h=ct.get(sS)[u];if(h)return h.declaredBy[0]}(n);if(!l)return;const c=Jl(l);c&&zp(c,n)},e[0]=n,e[1]=r):r=e[1];const s=r;let i,a;return e[2]!==o?(i=je("text-link opacity-80 hover:opacity-100 hover:underline",o),e[2]=o,e[3]=i):i=e[3],e[4]!==s||e[5]!==i||e[6]!==n?(a=d.jsx("button",{type:"button",onClick:s,className:i,children:n}),e[4]=s,e[5]=i,e[6]=n,e[7]=a):a=e[7],a},NL=Ht(t=>{const e=t(i$),n=t(sS),o=t(q4);return ua(e,r=>{if(!r.variable_name)return-1;const s=Object.values(n).find(a=>a.name===r.variable_name);if(!s)return 0;const i=o.inOrderIds.indexOf(s.declaredBy[0]);return i===-1?0:i})}),jL=Ht(t=>{const e=new Map(t(a$));for(const n of iS){const o=e.get(n);o&&o.databases.length===0&&e.delete(n)}return ua([...e.values()],n=>iS.has(n.name)?1:0)}),EL=()=>{const t=X.c(32),[e,n]=K.useState(""),o=Kt(aS),r=Be(NL),s=Be(jL);if(r.length===0&&s.length===0){let b;return t[0]===Symbol.for("react.memo_cache_sentinel")?(b=d.jsx(gn,{title:"No tables found",description:"Any datasets/dataframes in the global scope will be shown here.",action:d.jsx(xg,{children:d.jsxs(Te,{variant:"outline",size:"sm",children:["Add database or catalog",d.jsx(ar,{className:"h-4 w-4 ml-2"})]})}),icon:d.jsx(or,{})}),t[0]=b):b=t[0],b}const i=!!e.trim();let a,l,c,u,h,f,p,_,g,m;if(t[1]!==o?(a=b=>{o(b.length>0),n(b)},t[1]=o,t[2]=a):a=t[2],t[3]!==e||t[4]!==a?(l=d.jsx(qi,{placeholder:"Search tables...",className:"h-6 m-1",value:e,onValueChange:a,rootClassName:"flex-1 border-r"}),t[3]=e,t[4]=a,t[5]=l):l=t[5],t[6]!==i?(c=i&&d.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:d.jsx(Jn,{className:"h-4 w-4"})}),t[6]=i,t[7]=c):c=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(u=d.jsx(xg,{children:d.jsx("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:d.jsx(ar,{className:"h-4 w-4"})})}),t[8]=u):u=t[8],t[9]!==l||t[10]!==c?(h=d.jsxs("div",{className:"flex items-center w-full",children:[l,c,u]}),t[9]=l,t[10]=c,t[11]=h):h=t[11],t[12]!==s||t[13]!==i||t[14]!==e){let b;t[16]!==i||t[17]!==e?(b=y=>d.jsx(IL,{connection:y,hasChildren:y.databases.length>0,children:y.databases.map(x=>d.jsx(AL,{engineName:y.name,database:x,hasSearch:i,children:d.jsx(TL,{schemas:x.schemas,defaultSchema:y.default_schema,defaultDatabase:y.default_database,engineName:y.name,databaseName:x.name,hasSearch:i,searchValue:e})},x.name))},y.name),t[16]=i,t[17]=e,t[18]=b):b=t[18],f=s.map(b),t[12]=s,t[13]=i,t[14]=e,t[15]=f}else f=t[15];return t[19]!==s.length||t[20]!==r.length?(p=s.length>0&&r.length>0&&d.jsxs(lS,{children:[d.jsx(Ql,{className:"h-4 w-4 text-muted-foreground"}),d.jsx("span",{className:"text-xs",children:"Python"})]}),t[19]=s.length,t[20]=r.length,t[21]=p):p=t[21],t[22]!==e||t[23]!==r?(_=r.length>0&&d.jsx(t3,{tables:r,searchValue:e}),t[22]=e,t[23]=r,t[24]=_):_=t[24],t[25]!==f||t[26]!==p||t[27]!==_?(g=d.jsxs(jp,{className:"flex flex-col",children:[f,p,_]}),t[25]=f,t[26]=p,t[27]=_,t[28]=g):g=t[28],t[29]!==h||t[30]!==g?(m=d.jsxs(fc,{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]=m):m=t[31],m},IL=t=>{const e=X.c(25),{connection:n,children:o,hasChildren:r}=t,s=n.name===l$,i=s?"In-Memory":n.name,[a,l]=K.useState(!1);let c;e[0]!==n.name?(c=async()=>{l(!0),await d$({engine:n.name}),setTimeout(()=>l(!1),500)},e[0]=n.name,e[1]=c):c=e[1];const u=c;let h,f,p;e[2]!==n.dialect?(h=d.jsx(X3,{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=c$(n.dialect),e[4]=n.dialect,e[5]=f):f=e[5],e[6]!==f?(p=d.jsx("span",{className:"text-xs",children:f}),e[6]=f,e[7]=p):p=e[7];const _=i;let g,m,b,y,x;return e[8]!==_?(g=d.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",d.jsx(CL,{variableName:_}),")"]}),e[8]=_,e[9]=g):g=e[9],e[10]!==u||e[11]!==s||e[12]!==a?(m=!s&&d.jsx(Ae,{content:"Refresh connection",children:d.jsx(Te,{variant:"ghost",size:"icon",className:"ml-auto hover:bg-transparent hover:shadow-none",onClick:u,children:d.jsx(Cc,{className:je("h-4 w-4 text-muted-foreground hover:text-foreground",a&&"animate-[spin_0.5s]")})})}),e[10]=u,e[11]=s,e[12]=a,e[13]=m):m=e[13],e[14]!==h||e[15]!==p||e[16]!==g||e[17]!==m?(b=d.jsxs(lS,{children:[h,p,g,m]}),e[14]=h,e[15]=p,e[16]=g,e[17]=m,e[18]=b):b=e[18],e[19]!==o||e[20]!==r?(y=r?o:d.jsx(Lc,{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?(x=d.jsxs(d.Fragment,{children:[b,y]}),e[22]=b,e[23]=y,e[24]=x):x=e[24],x},AL=t=>{const e=X.c(28),{hasSearch:n,engineName:o,database:r,children:s}=t,[i,a]=K.useState(!1),[l,c]=K.useState(!1);let u,h,f;e[0]!==n?(u=()=>{a(n)},h=[n],e[0]=n,e[1]=u,e[2]=h):(u=e[1],h=e[2]),K.useEffect(u,h),e[3]!==i||e[4]!==l?(f=()=>{a(!i),c(!l)},e[3]=i,e[4]=l,e[5]=f):f=e[5];const p=`${o}:${r.name}`;let _;e[6]!==i?(_=d.jsx(pS,{isExpanded:i}),e[6]=i,e[7]=_):_=e[7];const g=l&&i?"text-foreground":"text-muted-foreground";let m,b;e[8]!==g?(m=je("h-4 w-4",g),e[8]=g,e[9]=m):m=e[9],e[10]!==m?(b=d.jsx(or,{className:m}),e[10]=m,e[11]=b):b=e[11];const y=l&&i&&"font-semibold";let x,v,C,k;e[12]!==y?(x=je(y),e[12]=y,e[13]=x):x=e[13],e[14]!==r.name?(v=r.name===""?d.jsx("i",{children:"Not connected"}):r.name,e[14]=r.name,e[15]=v):v=e[15],e[16]!==x||e[17]!==v?(C=d.jsx("span",{className:x,children:v}),e[16]=x,e[17]=v,e[18]=C):C=e[18],e[19]!==C||e[20]!==f||e[21]!==p||e[22]!==_||e[23]!==b?(k=d.jsxs(lo,{className:"text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",onSelect:f,value:p,children:[_,b,C]}),e[19]=C,e[20]=f,e[21]=p,e[22]=_,e[23]=b,e[24]=k):k=e[24];const j=i&&s;let N;return e[25]!==k||e[26]!==j?(N=d.jsxs(d.Fragment,{children:[k,j]}),e[25]=k,e[26]=j,e[27]=N):N=e[27],N},TL=t=>{const e=X.c(20),{schemas:n,defaultSchema:o,defaultDatabase:r,engineName:s,databaseName:i,hasSearch:a,searchValue:l}=t;if(n.length===0){let h;return e[0]===Symbol.for("react.memo_cache_sentinel")?(h=d.jsx(Lc,{content:"No schemas available",className:"pl-6"}),e[0]=h):h=e[0],h}let c,u;if(e[1]!==i||e[2]!==r||e[3]!==o||e[4]!==s||e[5]!==a||e[6]!==n||e[7]!==l){let h;e[9]!==l?(h=_=>!l||_.tables.some(g=>g.name.toLowerCase().includes(l.toLowerCase())),e[9]=l,e[10]=h):h=e[10];const f=n.filter(h);let p;e[11]!==i||e[12]!==r||e[13]!==o||e[14]!==s||e[15]!==a||e[16]!==l?(p=_=>d.jsx(ML,{databaseName:i,schema:_,hasSearch:a,children:d.jsx(t3,{tables:_.tables,searchValue:l,sqlTableContext:{engine:s,database:i,schema:_.name,defaultSchema:o,defaultDatabase:r}})},_.name),e[11]=i,e[12]=r,e[13]=o,e[14]=s,e[15]=a,e[16]=l,e[17]=p):p=e[17],c=f.map(p),e[1]=i,e[2]=r,e[3]=o,e[4]=s,e[5]=a,e[6]=n,e[7]=l,e[8]=c}else c=e[8];return e[18]!==c?(u=d.jsx(d.Fragment,{children:c}),e[18]=c,e[19]=u):u=e[19],u},ML=t=>{const e=X.c(26),{databaseName:n,schema:o,children:r,hasSearch:s}=t,[i,a]=K.useState(!1),[l,c]=K.useState(!1),u=`${n}:${o.name}`;let h,f,p,_;if(e[0]!==s?(h=()=>{a(s)},f=[s],e[0]=s,e[1]=h,e[2]=f):(h=e[1],f=e[2]),K.useEffect(h,f),fS(o.name))return r;e[3]!==i||e[4]!==l?(p=()=>{a(!i),c(!l)},e[3]=i,e[4]=l,e[5]=p):p=e[5],e[6]!==i?(_=d.jsx(pS,{isExpanded:i}),e[6]=i,e[7]=_):_=e[7];const g=l&&i&&"text-foreground";let m,b;e[8]!==g?(m=je("h-4 w-4 text-muted-foreground",g),e[8]=g,e[9]=m):m=e[9],e[10]!==m?(b=d.jsx(_$,{className:m}),e[10]=m,e[11]=b):b=e[11];const y=l&&i&&"font-semibold";let x,v,C;e[12]!==y?(x=je(y),e[12]=y,e[13]=x):x=e[13],e[14]!==o.name||e[15]!==x?(v=d.jsx("span",{className:x,children:o.name}),e[14]=o.name,e[15]=x,e[16]=v):v=e[16],e[17]!==v||e[18]!==p||e[19]!==_||e[20]!==b||e[21]!==u?(C=d.jsxs(lo,{className:"text-sm flex flex-row gap-1 items-center pl-5 cursor-pointer rounded-none",onSelect:p,value:u,children:[_,b,v]}),e[17]=v,e[18]=p,e[19]=_,e[20]=b,e[21]=u,e[22]=C):C=e[22];const k=i&&r;let j;return e[23]!==C||e[24]!==k?(j=d.jsxs(d.Fragment,{children:[C,k]}),e[23]=C,e[24]=k,e[25]=j):j=e[25],j},t3=t=>{const e=X.c(24),{tables:n,sqlTableContext:o,searchValue:r}=t,{addTableList:s}=cS(),[i,a]=K.useState(!1),[l,c]=K.useState(!1);let u,h;e[0]!==s||e[1]!==o||e[2]!==n.length||e[3]!==i?(u=async()=>{if(n.length===0&&o&&!i){a(!0),c(!0);const{engine:m,database:b,schema:y}=o,x=await UH.request({engine:m,database:b,schema:y});if(!(x!=null&&x.tables))throw c(!1),new Error("No tables available");s({tables:x.tables,sqlTableContext:o}),c(!1)}},e[0]=s,e[1]=o,e[2]=n.length,e[3]=i,e[4]=u):u=e[4],e[5]!==o||e[6]!==n.length||e[7]!==i?(h=[n.length,o,i],e[5]=o,e[6]=n.length,e[7]=i,e[8]=h):h=e[8];const{isPending:f,error:p}=zn(u,h);if(f||l){let m;return e[9]===Symbol.for("react.memo_cache_sentinel")?(m=d.jsx(dS,{message:"Loading tables...",className:"pl-12"}),e[9]=m):m=e[9],m}if(p){let m;return e[10]!==p?(m=d.jsx(uS,{error:p,className:"pl-12"}),e[10]=p,e[11]=m):m=e[11],m}if(n.length===0){let m;return e[12]===Symbol.for("react.memo_cache_sentinel")?(m=d.jsx(Lc,{content:"No tables found",className:"pl-9"}),e[12]=m):m=e[12],m}let _,g;if(e[13]!==r||e[14]!==o||e[15]!==n){let m;e[17]!==r?(m=x=>!r||x.name.toLowerCase().includes(r.toLowerCase()),e[17]=r,e[18]=m):m=e[18];const b=n.filter(m);let y;e[19]!==r||e[20]!==o?(y=x=>d.jsx(OL,{table:x,sqlTableContext:o,isSearching:!!r},x.name),e[19]=r,e[20]=o,e[21]=y):y=e[21],_=b.map(y),e[13]=r,e[14]=o,e[15]=n,e[16]=_}else _=e[16];return e[22]!==_?(g=d.jsx(d.Fragment,{children:_}),e[22]=_,e[23]=g):g=e[23],g},OL=t=>{const e=X.c(63),{table:n,sqlTableContext:o,isSearching:r}=t,{addTable:s}=cS(),[i,a]=K.useState(!1),[l,c]=K.useState(!1),u=n.columns.length>0;let h,f;e[0]!==s||e[1]!==i||e[2]!==o||e[3]!==n.name||e[4]!==u||e[5]!==l?(h=async()=>{if(i&&!u&&o&&!l){c(!0);const{engine:Q,database:re,schema:ae}=o,Z=await VH.request({engine:Q,database:re,schema:ae,tableName:n.name});if(!(Z!=null&&Z.table))throw new Error("No table details available");s({table:Z.table,sqlTableContext:o})}},e[0]=s,e[1]=i,e[2]=o,e[3]=n.name,e[4]=u,e[5]=l,e[6]=h):h=e[6],e[7]!==i||e[8]!==u?(f=[i,u],e[7]=i,e[8]=u,e[9]=f):f=e[9];const{isPending:p,error:_}=zn(h,f),g=Be(Xl),m=As(),{createNewCell:b}=It(),y=hS();let x;e[10]!==y||e[11]!==g||e[12]!==b||e[13]!==m||e[14]!==o||e[15]!==n?(x=()=>{ao(g,b,m),y((()=>{if(n.source_type==="catalog"){const Q=o!=null&&o.database?`${o.database}.${n.name}`:n.name;return`${n.engine}.load_table("${Q}")`}if(o)return mS(n,"*",o);switch(n.source_type){case"local":return`mo.ui.table(${n.name})`;case"duckdb":case"connection":return mS(n,"*",o);default:return ic(n.source_type),""}})())},e[10]=y,e[11]=g,e[12]=b,e[13]=m,e[14]=o,e[15]=n,e[16]=x):x=e[16];const v=x;let C;e[17]!==n.num_columns||e[18]!==n.num_rows?(C=()=>{const Q=[];return n.num_rows!=null&&Q.push(`${n.num_rows} rows`),n.num_columns!=null&&Q.push(`${n.num_columns} columns`),Q.length===0?null:d.jsx("div",{className:"flex flex-row gap-2 items-center pl-6 group-hover:hidden",children:d.jsx("span",{className:"text-xs text-muted-foreground",children:Q.join(", ")})})},e[17]=n.num_columns,e[18]=n.num_rows,e[19]=C):C=e[19];const k=C;let j;e[20]!==_||e[21]!==p||e[22]!==o||e[23]!==n?(j=()=>{if(p)return d.jsx(dS,{message:"Loading columns...",className:"pl-12"});if(_)return d.jsx(uS,{error:_,className:"pl-12"});const Q=n.columns;return Q.length===0?d.jsx(Lc,{content:"No columns found",className:"pl-12"}):Q.map(re=>d.jsx(DL,{table:n,column:re,sqlTableContext:o},re.name))},e[20]=_,e[21]=p,e[22]=o,e[23]=n,e[24]=j):j=e[24];const N=j;let I;e[25]!==i||e[26]!==r||e[27]!==n.source_type||e[28]!==n.type?(I=()=>{if(n.source_type==="local")return;const Q=n.type==="table"?u$:P3;return d.jsx(Q,{className:"h-3 w-3",strokeWidth:i||r?2.5:void 0})},e[25]=i,e[26]=r,e[27]=n.source_type,e[28]=n.type,e[29]=I):I=e[29];const A=I,T=o?`${o.database}.${o.schema}.${n.name}`:n.name,R=o&&(fS(o.schema)?"pl-9":"pl-12"),z=(i||r)&&"font-semibold";let D,F,B,U,O,S,$,E,W,G,q,Y;return e[30]!==R||e[31]!==z?(D=je("rounded-none group h-8 cursor-pointer",R,z),e[30]=R,e[31]=z,e[32]=D):D=e[32],e[33]!==i?(F=()=>a(!i),e[33]=i,e[34]=F):F=e[34],e[35]!==A?(B=A(),e[35]=A,e[36]=B):B=e[36],e[37]!==n.name?(U=d.jsx("span",{className:"text-sm",children:n.name}),e[37]=n.name,e[38]=U):U=e[38],e[39]!==B||e[40]!==U?(O=d.jsxs("div",{className:"flex gap-2 items-center flex-1",children:[B,U]}),e[39]=B,e[40]=U,e[41]=O):O=e[41],e[42]!==k?(S=k(),e[42]=k,e[43]=S):S=e[43],e[44]!==v?($=Pn.stopPropagation(()=>v()),e[44]=v,e[45]=$):$=e[45],e[46]===Symbol.for("react.memo_cache_sentinel")?(E=d.jsx(h$,{className:"h-3 w-3"}),e[46]=E):E=e[46],e[47]!==$?(W=d.jsx(Ae,{content:"Add table to notebook",delayDuration:400,children:d.jsx(Te,{className:"group-hover:inline-flex hidden",variant:"text",size:"icon",onClick:$,children:E})}),e[47]=$,e[48]=W):W=e[48],e[49]!==i||e[50]!==F||e[51]!==O||e[52]!==S||e[53]!==W||e[54]!==D||e[55]!==T?(G=d.jsxs(lo,{className:D,value:T,"aria-selected":i,forceMount:!0,onSelect:F,children:[O,S,W]}),e[49]=i,e[50]=F,e[51]=O,e[52]=S,e[53]=W,e[54]=D,e[55]=T,e[56]=G):G=e[56],e[57]!==i||e[58]!==N?(q=i&&N(),e[57]=i,e[58]=N,e[59]=q):q=e[59],e[60]!==G||e[61]!==q?(Y=d.jsxs(d.Fragment,{children:[G,q]}),e[60]=G,e[61]=q,e[62]=Y):Y=e[62],Y},DL=t=>{var E,W;const e=X.c(51),{table:n,column:o,sqlTableContext:r}=t,[s,i]=K.useState(!1),a=Be(aS),l=Kt(f$);let c,u;e[0]!==a?(c=()=>{a&&i(!1)},u=[a],e[0]=a,e[1]=c,e[2]=u):(c=e[1],u=e[2]),K.useEffect(c,u),l(s?G=>new Set([...G,`${n.name}:${o.name}`]):G=>(G.delete(`${n.name}:${o.name}`),new Set(G)));const h=hS(),{columnsPreviews:f}=p$();let p;e[3]!==o.name||e[4]!==n.primary_keys?(p=((E=n.primary_keys)==null?void 0:E.includes(o.name))||!1,e[3]=o.name,e[4]=n.primary_keys,e[5]=p):p=e[5];const _=p;let g;e[6]!==o.name||e[7]!==n.indexes?(g=((W=n.indexes)==null?void 0:W.includes(o.name))||!1,e[6]=o.name,e[7]=n.indexes,e[8]=g):g=e[8];const m=g;let b;e[9]!==h?(b=G=>{h(G)},e[9]=h,e[10]=b):b=e[10];const y=b,x=RL,v=s?"font-semibold":"";let C;e[11]!==o.name||e[12]!==v?(C=d.jsx("span",{className:v,children:o.name}),e[11]=o.name,e[12]=v,e[13]=C):C=e[13];const k=C,j=`${n.name}.${o.name}`,N=`${n.name}.${o.name}`;let I;e[14]!==s?(I=()=>i(!s),e[14]=s,e[15]=I):I=e[15];const A=r?"pl-14":"pl-7";let T,R,z,D,F,B,U,O,S,$;return e[16]!==A?(T=je("flex flex-row gap-2 items-center flex-1",A),e[16]=A,e[17]=T):T=e[17],e[18]!==o.type||e[19]!==k?(R=d.jsx(m$,{columnName:k,dataType:o.type}),e[18]=o.type,e[19]=k,e[20]=R):R=e[20],e[21]!==_?(z=_&&x({tooltipContent:"Primary key",content:"PK"}),e[21]=_,e[22]=z):z=e[22],e[23]!==m?(D=m&&x({tooltipContent:"Indexed",content:"IDX"}),e[23]=m,e[24]=D):D=e[24],e[25]!==T||e[26]!==R||e[27]!==z||e[28]!==D?(F=d.jsxs("div",{className:T,children:[R,z,D]}),e[25]=T,e[26]=R,e[27]=z,e[28]=D,e[29]=F):F=e[29],e[30]!==o.name?(B=d.jsx(Ae,{content:"Copy column name",delayDuration:400,children:d.jsx(Te,{variant:"text",size:"icon",className:"group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground",children:d.jsx(eS,{tooltip:!1,value:o.name,className:"h-3 w-3"})})}),e[30]=o.name,e[31]=B):B=e[31],e[32]!==o.external_type?(U=d.jsx("span",{className:"text-xs text-muted-foreground",children:o.external_type}),e[32]=o.external_type,e[33]=U):U=e[33],e[34]!==I||e[35]!==F||e[36]!==B||e[37]!==U||e[38]!==j||e[39]!==N?(O=d.jsxs(lo,{className:"rounded-none py-1 group cursor-pointer",value:N,onSelect:I,children:[F,B,U]},j),e[34]=I,e[35]=F,e[36]=B,e[37]=U,e[38]=j,e[39]=N,e[40]=O):O=e[40],e[41]!==o||e[42]!==f||e[43]!==y||e[44]!==s||e[45]!==r||e[46]!==n?(S=s&&d.jsx("div",{className:"pl-10 pr-2 py-2 bg-[var(--slate-1)] shadow-inner border-b",children:d.jsx(pc,{children:d.jsx(g$,{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]=S):S=e[47],e[48]!==O||e[49]!==S?($=d.jsxs(d.Fragment,{children:[O,S]}),e[48]=O,e[49]=S,e[50]=$):$=e[50],$};function RL(t){const{tooltipContent:e,content:n}=t;return d.jsx(Ae,{content:e,delayDuration:100,children:d.jsx("span",{className:"text-xs text-black bg-gray-100 dark:invert rounded px-1",children:n})})}const PL=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=d.jsx(EL,{}),t[0]=e):e=t[0],e},LL=()=>{const t=X.c(5),{documentation:e}=Be(b$);if(!e){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=d.jsx(gn,{title:"View docs as you type",description:"Move your text cursor over a symbol to see its documentation.",icon:d.jsx(td,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=Fp({html:e}),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=d.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},FL=()=>{const t=X.c(5),e=y$();if(e.length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=d.jsx(gn,{title:"No errors!",icon:d.jsx(jm,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=e.map(zL),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=d.jsx("div",{className:"flex flex-col overflow-auto",children:n}),t[3]=n,t[4]=o):o=t[4],o};function zL(t){return d.jsxs("div",{children:[d.jsx("div",{className:"text-xs font-mono font-semibold bg-muted border-y px-2 py-1",children:d.jsx(x$,{cellId:t.cellId})}),d.jsx("div",{className:"px-2",children:d.jsx(w$,{errors:t.output.data,cellId:t.cellId},t.cellId)},t.cellId)]},t.cellId)}const qf=new Map,BL=({file:t,onOpenNotebook:e})=>{const{theme:n}=lr(),o=Be(rp),[r,s]=M.useState(""),{data:i,isPending:a,error:l,setData:c}=zn(async()=>{const g=await Bp({path:t.path}),m=g.contents||"";return s(qf.get(t.path)||m),g},[t.path]),u=async()=>{r!==(i==null?void 0:i.contents)&&await I$({path:t.path,contents:r}).then(g=>{g.success&&(c(m=>({...m,contents:r})),s(r))})},h=M.useRef(r);if(h.current=r,M.useEffect(()=>()=>{if(!(i!=null&&i.contents))return;const g=h.current;g===i.contents?qf.delete(t.path):qf.set(t.path,g)},[t.path,i==null?void 0:i.contents]),l)return d.jsx(Dr,{error:l});if(a||!i)return null;const f=i.mimeType||"text/plain",p=f in Gf;if(!i.contents&&!p)return d.jsxs("div",{className:"grid grid-cols-2 gap-2 p-6",children:[d.jsx("div",{className:"font-bold text-muted-foreground",children:"Name"}),d.jsx("div",{children:i.file.name}),d.jsx("div",{className:"font-bold text-muted-foreground",children:"Type"}),d.jsx("div",{children:f})]});const _=d.jsxs("div",{className:"text-xs text-muted-foreground p-1 flex justify-end gap-2 border-b",children:[t.isMarimoFile&&!xn()&&d.jsx(Ae,{content:"Open notebook",children:d.jsx(mn,{size:"small",onClick:g=>e(g),children:d.jsx(uc,{})})}),d.jsx(Ae,{content:"Download",children:d.jsx(mn,{size:"small",onClick:()=>{if(n3(f)){const g=j$(i.contents,f);return void E$(g,i.file.name)}Ki(new Blob([i.contents||r],{type:f}),i.file.name)},children:d.jsx(fp,{})})}),!n3(f)&&d.jsxs(d.Fragment,{children:[d.jsx(Ae,{content:"Copy contents to clipboard",children:d.jsx(mn,{size:"small",onClick:async()=>{await pn(r)},children:d.jsx($i,{})})}),d.jsx(Ae,{content:nn("global.save"),children:d.jsx(mn,{size:"small",color:r===i.contents?void 0:"green",onClick:u,disabled:r===i.contents,children:d.jsx(_a,{})})})]})]});return f.startsWith("image/")?d.jsxs(d.Fragment,{children:[_,d.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:d.jsx(v$,{base64:i.contents,mime:f})})]}):f==="text/csv"&&i.contents?d.jsxs(d.Fragment,{children:[_,d.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:d.jsx(k$,{contents:i.contents})})]}):f.startsWith("audio/")?d.jsxs(d.Fragment,{children:[_,d.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:d.jsx(S$,{base64:i.contents,mime:f})})]}):f.startsWith("video/")?d.jsxs(d.Fragment,{children:[_,d.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:d.jsx(C$,{base64:i.contents,mime:f})})]}):f.startsWith("application/pdf")?d.jsxs(d.Fragment,{children:[_,d.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:d.jsx(N$,{base64:i.contents,mime:f})})]}):d.jsxs(d.Fragment,{children:[_,d.jsx("div",{className:"flex-1 overflow-auto",children:d.jsx(M.Suspense,{children:d.jsx(la,{theme:n==="dark"?"dark":"light",language:Gf[f]||Gf.default,className:"border-b",extensions:[tt.lineWrapping,Bn.of([{key:o.getHotkey("global.save").key,stopPropagation:!0,run:()=>r!==i.contents&&(u(),!0)}])],value:r,onChange:s})})})]})},n3=t=>t.startsWith("image/")||t.startsWith("audio/")||t.startsWith("video/")||t.startsWith("application/pdf"),Gf={"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"},o3=Ht(new class{constructor(t){this.callbacks=t,this.delegate=new Gp([]),this.rootPath="",this.onChange=wn.NOOP,this.path=new lc("/"),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 Gp(n.files),this.rootPath=n.root,this.path=lc.guessDeliminator(n.root)}catch(n){ut({title:"Failed",description:A4(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 i=o[r];s===this.rootPath?this.delegate=new Gp(i.files):this.delegate.update({id:s,changes:{children:i.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:(ut({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 i=this.path.join(n,this.path.basename(s.data.path));return this.delegate.update({id:r,changes:{path:i}}),this.callbacks.renameFileOrFolder({path:s.data.path,newPath:i}).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:s4,createFileOrFolder:Up,deleteFileOrFolder:T$,renameFileOrFolder:A$})),UL=Ht({});function VL(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 r3(t){const e=X.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:GL,onDropRejected:HL,onDrop:$L,...o},e[2]=o,e[3]=r):r=e[3],M$(r)}async function $L(t){for(const e of t){const n=JL(YL(e));let o="";n&&(o=lc.guessDeliminator(n).dirname(n));const r=(await VL(e)).split(",")[1];await Up({path:o,type:"file",name:e.name,contents:r})}await async function(){await ct.get(o3).refreshAll([])}()}function HL(t){ut({title:"File upload failed",description:d.jsx("div",{className:"flex flex-col gap-1",children:t.map(WL)}),variant:"danger"})}function WL(t){return d.jsxs("div",{children:[t.file.name," (",t.errors.map(qL).join(", "),")"]},t.file.name)}function qL(t){return t.message}function GL(t){kt.error(t),ut({title:"File upload failed",description:t.message,variant:"danger"})}function YL(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 JL(t){if(t)return t.replace(/^\/+/,"")}const s3=K.createContext(null),KL=t=>{const e=X.c(60),{height:n}=t,o=M.useRef(null),[r]=tn(o3);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=[],e[0]=s):s=e[0];const[i,a]=M.useState(s),[l,c]=M.useState(null),{openPrompt:u}=Fn(),[h,f]=tn(UL);let p,_;e[1]!==r?(p=()=>r.initialize(a),e[1]=r,e[2]=p):p=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(_=[],e[3]=_):_=e[3];const{isPending:g,error:m}=zn(p,_);let b;e[4]!==h||e[5]!==r?(b=()=>{r.refreshAll(Object.keys(h).filter(S=>h[S]))},e[4]=h,e[5]=r,e[6]=b):b=e[6];const y=Xe(b);let x;e[7]!==u||e[8]!==r?(x=async()=>{u({title:"Folder name",onConfirm:async S=>{r.createFolder(S,null)}})},e[7]=u,e[8]=r,e[9]=x):x=e[9];const v=Xe(x);let C;e[10]!==u||e[11]!==r?(C=async()=>{u({title:"File name",onConfirm:async S=>{r.createFile(S,null)}})},e[10]=u,e[11]=r,e[12]=C):C=e[12];const k=Xe(C);let j;e[13]!==f?(j=()=>{var S;(S=o.current)==null||S.closeAll(),f({})},e[13]=f,e[14]=j):j=e[14];const N=Xe(j);if(g){let S;return e[15]===Symbol.for("react.memo_cache_sentinel")?(S=d.jsx(Vn,{size:"medium",centered:!0}),e[15]=S):S=e[15],S}if(m){let S;return e[16]!==m?(S=d.jsx(Dr,{error:m}),e[16]=m,e[17]=S):S=e[17],S}if(l){let S,$,E,W,G,q;return e[18]===Symbol.for("react.memo_cache_sentinel")?(S=()=>c(null),e[18]=S):S=e[18],e[19]===Symbol.for("react.memo_cache_sentinel")?($=d.jsx(Te,{onClick:S,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:d.jsx(Ct,{size:16})}),e[19]=$):$=e[19],e[20]!==l.name?(E=d.jsxs("div",{className:"flex items-center pl-1 pr-3 flex-shrink-0 border-b justify-between",children:[$,d.jsx("span",{className:"font-bold",children:l.name})]}),e[20]=l.name,e[21]=E):E=e[21],e[22]!==l.path||e[23]!==r?(W=Y=>i3(Y,r.relativeFromRoot(l.path)),e[22]=l.path,e[23]=r,e[24]=W):W=e[24],e[25]!==l||e[26]!==W?(G=d.jsx(M.Suspense,{children:d.jsx(BL,{onOpenNotebook:W,file:l})}),e[25]=l,e[26]=W,e[27]=G):G=e[27],e[28]!==E||e[29]!==G?(q=d.jsxs(d.Fragment,{children:[E,G]}),e[28]=E,e[29]=G,e[30]=q):q=e[30],q}let I;e[31]!==N||e[32]!==k||e[33]!==v||e[34]!==y||e[35]!==r?(I=d.jsx(ZL,{onRefresh:y,onCreateFile:k,onCreateFolder:v,onCollapseAll:N,tree:r}),e[31]=N,e[32]=k,e[33]=v,e[34]=y,e[35]=r,e[36]=I):I=e[36];const A=n-33;let T,R,z,D,F,B,U,O;return e[37]!==r?(T=async S=>{const{ids:$}=S;for(const E of $)await r.delete(E)},R=async S=>{const{id:$,name:E}=S;await r.rename($,E)},z=async S=>{const{dragIds:$,parentId:E}=S;await r.move($,E)},e[37]=r,e[38]=T,e[39]=R,e[40]=z):(T=e[38],R=e[39],z=e[40]),e[41]===Symbol.for("react.memo_cache_sentinel")?(D=S=>{const $=S[0];$&&($.data.isDirectory||c($.data))},e[41]=D):D=e[41],e[42]!==h||e[43]!==f||e[44]!==r?(F=async S=>{if(await r.expand(S)){const $=h[S]??!1;f({...h,[S]:!$})}},e[42]=h,e[43]=f,e[44]=r,e[45]=F):F=e[45],e[46]!==i||e[47]!==h||e[48]!==T||e[49]!==R||e[50]!==z||e[51]!==F||e[52]!==A?(B=d.jsx(kH,{width:"100%",ref:o,height:A,className:"h-full",data:i,initialOpenState:h,openByDefault:!1,renderCursor:oF,disableDrop:rF,onDelete:T,onRename:R,onMove:z,onSelect:D,onToggle:F,padding:15,rowHeight:30,indent:XL,overscanCount:1e3,disableMultiSelection:!0,children:tF}),e[46]=i,e[47]=h,e[48]=T,e[49]=R,e[50]=z,e[51]=F,e[52]=A,e[53]=B):B=e[53],e[54]!==B||e[55]!==r?(U=d.jsx(s3,{value:r,children:B}),e[54]=B,e[55]=r,e[56]=U):U=e[56],e[57]!==U||e[58]!==I?(O=d.jsxs(d.Fragment,{children:[I,U]}),e[57]=U,e[58]=I,e[59]=O):O=e[59],O},XL=15,ZL=t=>{const e=X.c(30),{onRefresh:n,onCreateFile:o,onCreateFolder:r,onCollapseAll:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={noDrag:!0,noDragEventsBubbling:!0},e[0]=i):i=e[0];const{getRootProps:a,getInputProps:l}=r3(i);let c,u,h,f,p,_,g,m,b,y,x,v,C,k,j;return e[1]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(ma,{size:16}),e[1]=c):c=e[1],e[2]!==o?(u=d.jsx(Ae,{content:"Add file",children:d.jsx(Te,{"data-testid":"file-explorer-add-file-button",onClick:o,variant:"text",size:"xs",children:c})}),e[2]=o,e[3]=u):u=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(h=d.jsx(Gc,{size:16}),e[4]=h):h=e[4],e[5]!==r?(f=d.jsx(Ae,{content:"Add folder",children:d.jsx(Te,{"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]!==a?(p=a({}),e[7]=a,e[8]=p):p=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(_=O$({variant:"text",size:"xs"}),g=d.jsx(R$,{size:16}),e[9]=_,e[10]=g):(_=e[9],g=e[10]),e[11]!==p?(m=d.jsx(Ae,{content:"Upload file",children:d.jsx("button",{"data-testid":"file-explorer-upload-button",...p,className:_,children:g})}),e[11]=p,e[12]=m):m=e[12],e[13]!==l?(b=l({}),e[13]=l,e[14]=b):b=e[14],e[15]!==b?(y=d.jsx("input",{...b,type:"file"}),e[15]=b,e[16]=y):y=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(x=d.jsx(R4,{size:16}),e[17]=x):x=e[17],e[18]!==n?(v=d.jsx(Ae,{content:"Refresh",children:d.jsx(Te,{"data-testid":"file-explorer-refresh-button",onClick:n,variant:"text",size:"xs",children:x})}),e[18]=n,e[19]=v):v=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(C=d.jsx(im,{size:16}),e[20]=C):C=e[20],e[21]!==s?(k=d.jsx(Ae,{content:"Collapse all folders",children:d.jsx(Te,{"data-testid":"file-explorer-collapse-button",onClick:s,variant:"text",size:"xs",children:C})}),e[21]=s,e[22]=k):k=e[22],e[23]!==y||e[24]!==v||e[25]!==k||e[26]!==u||e[27]!==f||e[28]!==m?(j=d.jsxs("div",{className:"flex items-center justify-end px-2 flex-shrink-0 border-b",children:[u,f,m,y,v,k]}),e[23]=y,e[24]=v,e[25]=k,e[26]=u,e[27]=f,e[28]=m,e[29]=j):j=e[29],j},QL=t=>{const e=X.c(9),{node:n,onOpenMarimoFile:o}=t;let r,s,i;return e[0]!==n?(r=a=>{n.data.isDirectory||(a.stopPropagation(),n.select())},e[0]=n,e[1]=r):r=e[1],e[2]!==n.data.isMarimoFile||e[3]!==o?(s=n.data.isMarimoFile&&!xn()&&d.jsxs("span",{className:"flex-shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline",onClick:o,children:["open ",d.jsx(uc,{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?(i=d.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]=i):i=e[8],i},eF=t=>{const e=X.c(10),{node:n}=t,o=M.useRef(null);let r,s,i,a,l;return e[0]!==n.data.name?(r=()=>{var c,u;(c=o.current)==null||c.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?(i=()=>n.reset(),a=c=>{c.key==="Escape"&&n.reset(),c.key==="Enter"&&n.submit(c.currentTarget.value)},e[3]=n,e[4]=i,e[5]=a):(i=e[4],a=e[5]),e[6]!==n.data.name||e[7]!==i||e[8]!==a?(l=d.jsx("input",{ref:o,className:"flex-1 bg-transparent border border-border text-muted-foreground",defaultValue:n.data.name,onClick:sF,onBlur:i,onKeyDown:a}),e[6]=n.data.name,e[7]=i,e[8]=a,e[9]=l):l=e[9],l},tF=({node:t,style:e,dragHandle:n})=>{const o=t.data.isDirectory?"directory":o4(t.data.name),r=r4[o],{openConfirm:s,openPrompt:i}=Fn(),{createNewCell:a}=It(),l=As(),c=M.use(s3),u=async g=>{i3(g,c?c.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:d.jsx(Z3,{onClick:async()=>{await t.tree.delete(t.id)},"aria-label":"Confirm",children:"Delete"})})},f=Xe(async()=>{t.open(),i({title:"Folder name",onConfirm:async g=>{c==null||c.createFolder(g,t.id)}})}),p=Xe(async()=>{t.open(),i({title:"File name",onConfirm:async g=>{c==null||c.createFile(g,t.id)}})}),_=Xe(async()=>{var y;if(!c||t.data.isDirectory)return;const[g,m]=D$(t.data.name),b=`${g}_copy${m}`;try{const x=await Bp({path:t.data.path}),v=((y=t.parent)==null?void 0:y.data.path)||"";await Up({path:v,type:"file",name:b,contents:x.contents?btoa(x.contents):void 0}),await c.refreshAll([v])}catch{ut({title:"Failed to duplicate file",description:"Unable to create a duplicate of the file",variant:"danger"})}});return d.jsxs("div",{style:e,ref:n,className:je("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:[d.jsx(nF,{node:t}),d.jsxs("span",{className:je("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?d.jsx("img",{src:"./favicon.ico",className:"w-5 h-5 flex-shrink-0 mr-2 filter grayscale",alt:"Marimo"}):d.jsx(r,{className:"w-5 h-5 flex-shrink-0 mr-2",strokeWidth:1.5}),t.isEditing?d.jsx(eF,{node:t}):d.jsx(QL,{node:t,onOpenMarimoFile:u}),d.jsxs(js,{modal:!1,children:[d.jsx(Es,{asChild:!0,tabIndex:-1,onClick:g=>g.stopPropagation(),children:d.jsx(Te,{"data-testid":"file-explorer-more-button",variant:"text",tabIndex:-1,size:"xs",className:"mb-0","aria-label":"More options",children:d.jsx(qc,{strokeWidth:2,className:"w-5 h-5 hidden group-hover:block"})})}),(()=>{const g={size:14,strokeWidth:1.5,className:"mr-2"};return d.jsxs(Is,{align:"end",className:"no-print w-[220px]",onClick:m=>m.stopPropagation(),onCloseAutoFocus:m=>m.preventDefault(),children:[!t.data.isDirectory&&d.jsxs(Wt,{onSelect:()=>t.select(),children:[d.jsx(Vm,{...g}),"Open file"]}),!t.data.isDirectory&&!xn()&&d.jsxs(Wt,{onSelect:()=>{P$({path:t.data.path})},children:[d.jsx(uc,{...g}),"Open file in external editor"]}),t.data.isDirectory&&d.jsxs(d.Fragment,{children:[d.jsxs(Wt,{onSelect:()=>p(),children:[d.jsx(ma,{...g}),"Create file"]}),d.jsxs(Wt,{onSelect:()=>f(),children:[d.jsx(Gc,{...g}),"Create folder"]}),d.jsx(co,{})]}),d.jsxs(Wt,{onSelect:()=>t.edit(),children:[d.jsx(Em,{...g}),"Rename"]}),!t.data.isDirectory&&d.jsxs(Wt,{onSelect:_,children:[d.jsx($i,{...g}),"Duplicate"]}),d.jsxs(Wt,{onSelect:async()=>{await pn(t.data.path),ut({title:"Copied to clipboard"})},children:[d.jsx(Kc,{...g}),"Copy path"]}),c&&d.jsxs(Wt,{onSelect:async()=>{await pn(c.relativeFromRoot(t.data.path)),ut({title:"Copied to clipboard"})},children:[d.jsx(Kc,{...g}),"Copy relative path"]}),d.jsx(co,{}),d.jsxs(Wt,{onSelect:()=>{const{path:m}=t.data;(b=>{a({code:b,before:!1,cellId:l??"__end__"})})(gS[o](m))},children:[d.jsx(Lr,{...g}),"Insert snippet for reading file"]}),d.jsxs(Wt,{onSelect:async()=>{ut({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:m}=t.data,b=gS[o](m);await pn(b)},children:[d.jsx(L$,{...g}),"Copy snippet for reading file"]}),t.data.isMarimoFile&&!xn()&&d.jsxs(d.Fragment,{children:[d.jsx(co,{}),d.jsxs(Wt,{onSelect:u,children:[d.jsx(Lm,{...g}),"Open notebook"]})]}),d.jsx(co,{}),!t.data.isDirectory&&d.jsxs(d.Fragment,{children:[d.jsxs(Wt,{onSelect:async()=>{const m=(await Bp({path:t.data.path})).contents||"";Ki(new Blob([m]),t.data.name)},children:[d.jsx(fp,{...g}),"Download"]}),d.jsx(co,{})]}),d.jsxs(Wt,{onSelect:h,variant:"danger",children:[d.jsx(op,{...g}),"Delete"]})]})})()]})]})]})},nF=t=>{const e=X.c(3),{node:n}=t;if(!n.data.isDirectory){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=d.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?d.jsx(Ns,{className:"w-5 h-5 flex-shrink-0"}):d.jsx(Wi,{className:"w-5 h-5 flex-shrink-0"}),e[1]=n.isOpen,e[2]=o):o=e[2],o};function i3(t,e){t.stopPropagation(),t.preventDefault(),window.open(`/?file=${e}`,"_blank")}function oF(){return null}function rF(t){const{parentNode:e}=t;return!e.data.isDirectory}function sF(t){return t.stopPropagation()}let a3,l3,c3;a3=()=>{const t=X.c(20),{ref:e,height:n}=F$(),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:i,isDragActive:a}=r3(r);let l,c,u,h,f,p,_,g;return t[1]!==s?(l=s(),t[1]=s,t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(c=je("flex flex-col flex-1 overflow-hidden relative"),t[3]=c):c=t[3],t[4]!==i?(u=i(),t[4]=i,t[5]=u):u=t[5],t[6]!==u?(h=d.jsx("input",{...u}),t[6]=u,t[7]=h):h=t[7],t[8]!==a?(f=a&&d.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]=a,t[9]=f):f=t[9],t[10]!==o?(p=d.jsx(KL,{height:o}),t[10]=o,t[11]=p):p=t[11],t[12]!==e||t[13]!==p?(_=d.jsx("div",{ref:e,className:"flex flex-col flex-1 overflow-hidden",children:p}),t[12]=e,t[13]=p,t[14]=_):_=t[14],t[15]!==l||t[16]!==h||t[17]!==f||t[18]!==_?(g=d.jsxs("div",{...l,className:c,children:[h,f,_]}),t[15]=l,t[16]=h,t[17]=f,t[18]=_,t[19]=g):g=t[19],g},Zp=t=>{const e=X.c(6),n=t.dataTestId;let o,r;return e[0]!==t.className?(o=je("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=d.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},l3=()=>{const t=X.c(9),e=z$(),{clearLogs:n}=It();if(e.length===0){let i,a;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsx("code",{className:"border rounded px-1",children:"stdout"}),t[0]=i):i=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsx(gn,{title:"No logs",description:d.jsxs("span",{children:[i," and"," ",d.jsx("code",{className:"border rounded px-1",children:"stderr"})," logs will appear here."]}),icon:d.jsx(ep,{})}),t[1]=a):a=t[1],a}let o,r,s;return t[2]!==n?(o=d.jsx("div",{className:"flex flex-row justify-end px-2 py-1",children:d.jsx(Zp,{dataTestId:"clear-logs-button",onClick:n})}),t[2]=n,t[3]=o):o=t[3],t[4]!==e?(r=d.jsx("div",{className:"overflow-auto flex-1",children:d.jsx(c3,{logs:e,className:"min-w-[300px]"})}),t[4]=e,t[5]=r):r=t[5],t[6]!==o||t[7]!==r?(s=d.jsxs(d.Fragment,{children:[o,r]}),t[6]=o,t[7]=r,t[8]=s):s=t[8],s},c3=t=>{const e=X.c(10),{logs:n,className:o}=t;let r,s,i,a,l;return e[0]!==o?(r=je("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?(i=n.map(lF),e[3]=n,e[4]=i):i=e[4],e[5]!==i?(a=d.jsx("pre",{className:"grid text-xs font-mono gap-1 whitespace-break-spaces font-semibold align-left",children:d.jsx("div",{className:"grid grid-cols-[30px,1fr]",style:s,children:i})}),e[5]=i,e[6]=a):a=e[6],e[7]!==r||e[8]!==a?(l=d.jsx("div",{className:r,children:a}),e[7]=r,e[8]=a,e[9]=l):l=e[9],l};function iF(t){const e=B$(t.timestamp),n=aF[t.level],o=t.level.toUpperCase();return d.jsxs(d.Fragment,{children:[d.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)] dark:text-[var(--gray-11)]",children:["[",e,"]"]}),d.jsx("span",{className:je("flex-shrink-0",n),children:o}),d.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)]",children:["(",d.jsx(cr,{cellId:t.cellId}),")"]}),t.message]})}const aF={stdout:"text-[var(--grass-9)]",stderr:"text-[var(--red-9)]"};function lF(t,e){return d.jsxs("div",{className:"contents group",children:[d.jsx("span",{className:je("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","text-right col-span-1 py-1 pr-1"),children:e+1}),d.jsx("span",{className:je("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","px-2 flex gap-x-1.5 py-1 flex-wrap"),children:iF(t)})]},e)}const cF=()=>{const t=X.c(7),{items:e}=Be(U$);let n,o;t[0]!==e?(o=$H(e),t[0]=e,t[1]=o):o=t[1],n=o;const r=n,{activeHeaderId:s,activeOccurrences:i}=HH(r);if(e.length===0){let l;return t[2]===Symbol.for("react.memo_cache_sentinel")?(l=d.jsx(gn,{title:"No outline",description:"Add markdown headings to your notebook to create an outline.",icon:d.jsx(ed,{})}),t[2]=l):l=t[2],l}let a;return t[3]!==s||t[4]!==i||t[5]!==e?(a=d.jsx(WH,{items:e,activeHeaderId:s,activeOccurrences:i}),t[3]=s,t[4]=i,t[5]=e,t[6]=a):a=t[6],a},d3=Ht(null),u3=t=>{const e=X.c(9),{onClick:n,loading:o,children:r,className:s}=t;if(o){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(Vn,{size:"small",className:"h-4 w-4 shrink-0 opacity-50"}),e[0]=c):c=e[0],c}let i,a,l;return e[1]!==s?(i=je("px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible",s),e[1]=s,e[2]=i):i=e[2],e[3]!==n?(a=Pn.stopPropagation(n),e[3]=n,e[4]=a):a=e[4],e[5]!==r||e[6]!==i||e[7]!==a?(l=d.jsx("button",{type:"button",className:i,onClick:a,children:r}),e[5]=r,e[6]=i,e[7]=a,e[8]=l):l=e[8],l},dF=()=>{var v,C;const t=X.c(27),[e]=Tr(),n=e.package_management.manager,[o,r]=K.useState(null);let s;t[0]!==n?(s=[n],t[0]=n,t[1]=s):s=t[1];const{data:i,error:a,refetch:l,isPending:c}=zn(pF,s);if(c){let k;return t[2]===Symbol.for("react.memo_cache_sentinel")?(k=d.jsx(Vn,{size:"medium",centered:!0}),t[2]=k):k=t[2],k}if(a){let k;return t[3]!==a?(k=d.jsx(Dr,{error:a}),t[3]=a,t[4]=k):k=t[4],k}const u=i.tree!=null;let h;t[5]!==u||t[6]!==o?(h=function(k,j){return k==="list"?"list":j?k||"tree":"list"}(o,u),t[5]=u,t[6]=o,t[7]=h):h=t[7];const f=h,p=(v=i.tree)==null?void 0:v.name,_=(C=i==null?void 0:i.tree)==null?void 0:C.version,g=p==="<root>";let m,b,y,x;return t[8]!==n||t[9]!==l?(m=d.jsx(uF,{packageManager:n,onSuccess:l}),t[8]=n,t[9]=l,t[10]=m):m=t[10],t[11]!==g||t[12]!==u||t[13]!==p||t[14]!==_||t[15]!==f?(b=u&&d.jsxs("div",{className:"flex items-center justify-between px-2 py-1 border-b",children:[d.jsxs("div",{className:"flex gap-1",children:[d.jsx("button",{type:"button",className:je("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"}),d.jsx("button",{type:"button",className:je("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"})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.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"}),p&&!g&&d.jsxs("span",{className:"text-xs text-muted-foreground",children:[p,_&&` v${_}`]})]})]}),t[11]=g,t[12]=u,t[13]=p,t[14]=_,t[15]=f,t[16]=b):b=t[16],t[17]!==i.list||t[18]!==i.tree||t[19]!==a||t[20]!==l||t[21]!==f?(y=f==="list"?d.jsx(hF,{packages:i.list,onSuccess:l}):d.jsx(fF,{tree:i.tree,error:a,onSuccess:l}),t[17]=i.list,t[18]=i.tree,t[19]=a,t[20]=l,t[21]=f,t[22]=y):y=t[22],t[23]!==m||t[24]!==b||t[25]!==y?(x=d.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[m,b,y]}),t[23]=m,t[24]=b,t[25]=y,t[26]=x):x=t[26],x},uF=t=>{const e=X.c(40),{onSuccess:n,packageManager:o}=t,[r,s]=K.useState(""),{handleClick:i}=da(),a=Be(d3),l=Kt(d3);let c,u;e[0]!==a||e[1]!==l?(c=()=>{a&&(s(a),l(null))},u=[a,l],e[0]=a,e[1]=l,e[2]=c,e[3]=u):(c=e[2],u=e[3]),K.useEffect(c,u);const{loading:h,handleInstallPackages:f}=H$();let p;e[4]!==n?(p=()=>{n(),s("")},e[4]=n,e[5]=p):p=e[5];const _=p;let g;e[6]!==f||e[7]!==r||e[8]!==_?(g=()=>{f(r.split(",").map(mF),_)},e[6]=f,e[7]=r,e[8]=_,e[9]=g):g=e[9];const m=g,b=`Install packages with ${o}...`;let y,x,v,C,k,j,N,I,A,T,R,z,D,F;e[10]!==h||e[11]!==i?(y=h?d.jsx(Vn,{size:"small",className:"mr-2 h-4 w-4 shrink-0 opacity-50"}):d.jsx(Ae,{content:"Change package manager",children:d.jsx($s,{onClick:()=>i("packageManagement"),className:"mr-2 h-4 w-4 shrink-0 opacity-50 hover:opacity-80 cursor-pointer"})}),e[10]=h,e[11]=i,e[12]=y):y=e[12],e[13]!==m?(x=E=>{E.key==="Enter"&&(E.preventDefault(),m())},e[13]=m,e[14]=x):x=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(v=E=>s(E.target.value),e[15]=v):v=e[15],e[16]!==r||e[17]!==b||e[18]!==y||e[19]!==x?(C=d.jsx(_S,{placeholder:b,id:v1,icon:y,rootClassName:"flex-1 border-none",value:r,onKeyDown:x,onChange:v}),e[16]=r,e[17]=b,e[18]=y,e[19]=x,e[20]=C):C=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(k=d.jsx("span",{className:"font-bold tracking-wide",children:"Package name:"}),e[21]=k):k=e[21],e[22]===Symbol.for("react.memo_cache_sentinel")?(j=d.jsxs("div",{children:[k," A package name; this will install the latest version.",d.jsx("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),N=d.jsx("span",{className:"font-bold tracking-wide",children:"Package and version:"}),e[22]=j,e[23]=N):(j=e[22],N=e[23]),e[24]===Symbol.for("react.memo_cache_sentinel")?(I=d.jsxs("div",{children:[N," ","A package with a specific version or version range.",d.jsx("div",{className:"text-muted-foreground",children:"Examples: httpx==0.27.0, httpx>=0.27.0"})]}),A=d.jsx("span",{className:"font-bold tracking-wide",children:"Git:"}),e[24]=I,e[25]=A):(I=e[24],A=e[25]),e[26]===Symbol.for("react.memo_cache_sentinel")?(T=d.jsxs("div",{children:[A," A Git repository",d.jsx("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),R=d.jsx("span",{className:"font-bold tracking-wide",children:"URL:"}),e[26]=T,e[27]=R):(T=e[26],R=e[27]),e[28]===Symbol.for("react.memo_cache_sentinel")?(z=d.jsxs("div",{children:[R," A remote wheel or source distribution.",d.jsx("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),D=d.jsx("span",{className:"font-bold tracking-wide",children:"Path:"}),e[28]=z,e[29]=D):(z=e[28],D=e[29]),e[30]===Symbol.for("react.memo_cache_sentinel")?(F=d.jsx(Ae,{delayDuration:300,side:"left",align:"start",content:d.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:",d.jsxs("div",{className:"flex flex-col gap-2 mt-2",children:[j,I,T,z,d.jsxs("div",{children:[D," A local wheel, source distribution, or project directory.",d.jsx("div",{className:"text-muted-foreground",children:"Example: /example/foo-0.1.0-py3-none-any.whl"})]})]})]}),children:d.jsx(Rp,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),e[30]=F):F=e[30];const B=r&&"bg-accent text-accent-foreground";let U;e[31]!==B?(U=je("float-right px-2 m-0 h-full text-sm text-secondary-foreground ml-2",B,"disabled:cursor-not-allowed disabled:opacity-50"),e[31]=B,e[32]=U):U=e[32];const O=!r;let S,$;return e[33]!==m||e[34]!==U||e[35]!==O?(S=d.jsx("button",{type:"button",className:U,onClick:m,disabled:O,children:"Add"}),e[33]=m,e[34]=U,e[35]=O,e[36]=S):S=e[36],e[37]!==S||e[38]!==C?($=d.jsxs("div",{className:"flex items-center w-full border-b",children:[C,F,S]}),e[37]=S,e[38]=C,e[39]=$):$=e[39],$},hF=t=>{const e=X.c(9),{onSuccess:n,packages:o}=t;if(o.length===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsx(gn,{title:"No packages",description:"No packages are installed in this environment.",icon:d.jsx($s,{})}),e[0]=a):a=e[0],a}let r,s,i;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(r=d.jsx(Vp,{children:d.jsxs(Vs,{children:[d.jsx(Rr,{children:"Name"}),d.jsx(Rr,{children:"Version"}),d.jsx(Rr,{})]})}),e[1]=r):r=e[1],e[2]!==n||e[3]!==o){let a;e[5]!==n?(a=l=>d.jsxs(Vs,{className:"group",onClick:async()=>{await pn(`${l.name}==${l.version}`),ut({title:"Copied to clipboard"})},children:[d.jsx(Pr,{children:l.name}),d.jsx(Pr,{children:l.version}),d.jsxs(Pr,{className:"flex justify-end",children:[d.jsx(h3,{packageName:l.name,onSuccess:n}),d.jsx(f3,{packageName:l.name,onSuccess:n})]})]},l.name),e[5]=n,e[6]=a):a=e[6],s=o.map(a),e[2]=n,e[3]=o,e[4]=s}else s=e[4];return e[7]!==s?(i=d.jsxs($p,{className:"overflow-auto flex-1",children:[r,d.jsx(Hp,{children:s})]}),e[7]=s,e[8]=i):i=e[8],i},h3=({packageName:t,onSuccess:e})=>{const[n,o]=K.useState(!1);return xn()?null:d.jsx(u3,{onClick:async()=>{try{o(!0);const r=await W$({package:t,upgrade:!0});r.success?(e(),bS(t)):bS(t,r.error)}finally{o(!1)}},loading:n,children:"Upgrade"})},f3=({packageName:t,onSuccess:e})=>{const[n,o]=K.useState(!1);return d.jsx(u3,{onClick:async()=>{try{o(!0);const r=await q$({package:t});r.success?(e(),yS(t)):yS(t,r.error)}finally{o(!1)}},loading:n,children:"Remove"})},fF=t=>{const e=X.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[i,a]=K.useState(s);let l,c,u;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{a(new Set)},e[1]=l):l=e[1],e[2]!==n?(c=[n],e[2]=n,e[3]=c):c=e[3],K.useEffect(l,c),o){let _;return e[4]!==o?(_=d.jsx(Dr,{error:o}),e[4]=o,e[5]=_):_=e[5],_}if(!n){let _;return e[6]===Symbol.for("react.memo_cache_sentinel")?(_=d.jsx(Vn,{size:"medium",centered:!0}),e[6]=_):_=e[6],_}if(n.dependencies.length===0){let _;return e[7]===Symbol.for("react.memo_cache_sentinel")?(_=d.jsx(gn,{title:"No dependencies",description:"No package dependencies found in this environment.",icon:d.jsx($s,{})}),e[7]=_):_=e[7],_}e[8]===Symbol.for("react.memo_cache_sentinel")?(u=_=>{a(g=>{const m=new Set(g);return m.has(_)?m.delete(_):m.add(_),m})},e[8]=u):u=e[8];const h=u;let f,p;if(e[9]!==i||e[10]!==r||e[11]!==n.dependencies){let _;e[13]!==i||e[14]!==r?(_=(g,m)=>d.jsx("div",{className:"border-b",children:d.jsx(p3,{nodeId:`root-${m}`,node:g,level:0,isTopLevel:!0,expandedNodes:i,onToggle:h,onSuccess:r})},`${g.name}-${m}`),e[13]=i,e[14]=r,e[15]=_):_=e[15],f=n.dependencies.map(_),e[9]=i,e[10]=r,e[11]=n.dependencies,e[12]=f}else f=e[12];return e[16]!==f?(p=d.jsx("div",{className:"flex-1 overflow-auto",children:d.jsx("div",{children:f})}),e[16]=f,e[17]=p):p=e[17],p},p3=t=>{const e=X.c(57),{nodeId:n,node:o,level:r,isTopLevel:s,expandedNodes:i,onToggle:a,onSuccess:l}=t,c=s!==void 0&&s,u=o.dependencies.length>0;let h;e[0]!==i||e[1]!==n?(h=i.has(n),e[0]=i,e[1]=n,e[2]=h):h=e[2];const f=h,p=c?0:16+16*r;let _;e[3]!==u||e[4]!==n||e[5]!==a?(_=U=>{U.key!=="Enter"&&U.key!==" "||(U.preventDefault(),u&&a(n))},e[3]=u,e[4]=n,e[5]=a,e[6]=_):_=e[6];const g=_;let m;e[7]!==u||e[8]!==n||e[9]!==a?(m=U=>{U.stopPropagation(),u&&a(n)},e[7]=u,e[8]=n,e[9]=a,e[10]=m):m=e[10];const b=m,y=u&&"select-none",x=c?"px-2 py-0.5":"";let v,C;e[11]!==y||e[12]!==x?(v=je("flex items-center group cursor-pointer text-sm whitespace-nowrap","hover:bg-[var(--slate-2)] focus:bg-[var(--slate-2)] focus:outline-none",y,x),e[11]=y,e[12]=x,e[13]=v):v=e[13],e[14]!==p||e[15]!==c?(C=c?{}:{paddingLeft:`${p}px`},e[14]=p,e[15]=c,e[16]=C):C=e[16];const k=u?f:void 0;let j,N,I,A,T,R,z,D,F,B;return e[17]!==u||e[18]!==f?(j=u?f?d.jsx(Ns,{className:"w-4 h-4 mr-2 flex-shrink-0"}):d.jsx(Wi,{className:"w-4 h-4 mr-2 flex-shrink-0"}):d.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?(N=d.jsx("span",{className:"font-medium truncate",children:o.name}),e[20]=o.name,e[21]=N):N=e[21],e[22]!==o.version?(I=o.version&&d.jsxs("span",{className:"text-muted-foreground text-xs",children:["v",o.version]}),e[22]=o.version,e[23]=I):I=e[23],e[24]!==N||e[25]!==I?(A=d.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 py-1.5",children:[N,I]}),e[24]=N,e[25]=I,e[26]=A):A=e[26],e[27]!==o.tags?(T=o.tags.map(gF),e[27]=o.tags,e[28]=T):T=e[28],e[29]!==T?(R=d.jsx("div",{className:"flex items-center gap-1 ml-2",children:T}),e[29]=T,e[30]=R):R=e[30],e[31]!==c||e[32]!==o.name||e[33]!==l?(z=c&&d.jsxs("div",{className:"flex gap-1 invisible group-hover:visible",children:[d.jsx(h3,{packageName:o.name,onSuccess:l}),d.jsx(f3,{packageName:o.name,onSuccess:l})]}),e[31]=c,e[32]=o.name,e[33]=l,e[34]=z):z=e[34],e[35]!==b||e[36]!==g||e[37]!==j||e[38]!==A||e[39]!==R||e[40]!==z||e[41]!==v||e[42]!==C||e[43]!==k?(D=d.jsxs("div",{className:v,style:C,onClick:b,onKeyDown:g,tabIndex:0,role:"treeitem","aria-selected":!1,"aria-expanded":k,children:[j,A,R,z]}),e[35]=b,e[36]=g,e[37]=j,e[38]=A,e[39]=R,e[40]=z,e[41]=v,e[42]=C,e[43]=k,e[44]=D):D=e[44],e[45]!==i||e[46]!==u||e[47]!==f||e[48]!==r||e[49]!==o.dependencies||e[50]!==n||e[51]!==l||e[52]!==a?(F=u&&f&&d.jsx("div",{role:"group",children:o.dependencies.map((U,O)=>d.jsx(p3,{nodeId:`${n}-${O}`,node:U,level:r+1,isTopLevel:!1,expandedNodes:i,onToggle:a,onSuccess:l},`${U.name}-${O}`))}),e[45]=i,e[46]=u,e[47]=f,e[48]=r,e[49]=o.dependencies,e[50]=n,e[51]=l,e[52]=a,e[53]=F):F=e[53],e[54]!==D||e[55]!==F?(B=d.jsxs("div",{children:[D,F]}),e[54]=D,e[55]=F,e[56]=B):B=e[56],B};async function pF(){const[t,e]=await Promise.all([V$(),$$()]);return{list:t.packages,tree:e.tree}}function mF(t){return t.trim()}function gF(t,e){return t.kind==="cycle"?d.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"?d.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"?d.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 Yf=O3("marimo:scratchpadHistory:v1",[]),_F=Ht(!1),bF=Ht(null,(t,e,n)=>{if(!(n=n.trim()))return;const o=t(Yf),r=[n,...o.filter(s=>s!==n)].slice(0,15);e(Yf,r)}),yF={hide_code:!1,disabled:!1},xF=()=>{const t=X.c(69),e=mc(),[n]=Tr(),{theme:o}=lr(),r=M.useRef(null),s=As(),{createNewCell:i,updateCellCode:a}=It(),l=e.cellRuntime[dr],c=l==null?void 0:l.output,u=l==null?void 0:l.status,h=l==null?void 0:l.consoleOutputs,f=e.cellData[dr],p=(f==null?void 0:f.code)??"",_=Kt(bF),[g,m]=tn(_F),b=Be(Yf);let y;t[0]!==_||t[1]!==p?(y=()=>{xS({code:p}),_(p)},t[0]=_,t[1]=p,t[2]=y):y=t[2];const x=Xe(y);let v;t[3]!==p||t[4]!==i||t[5]!==s?(v=()=>{p.trim()&&i({code:p,before:!1,cellId:s??"__end__"})},t[3]=p,t[4]=i,t[5]=s,t[6]=v):v=t[6];const C=Xe(v);let k;t[7]!==a?(k=()=>{a({cellId:dr,code:"",formattingChange:!1}),xS({code:""});const ie=r.current;ie&&ie.dispatch({changes:{from:0,to:ie.state.doc.length,insert:""}})},t[7]=a,t[8]=k):k=t[8];const j=Xe(k);let N;t[9]!==m||t[10]!==a?(N=ie=>{m(!1),a({cellId:dr,code:ie,formattingChange:!1});const Me=r.current;Me&&Me.dispatch({changes:{from:0,to:Me.state.doc.length,insert:ie}})},t[9]=m,t[10]=a,t[11]=N):N=t[11];const I=Xe(N),[A,T]=M.useState();let R;t[12]!==p||t[13]!==h||t[14]!==x||t[15]!==A||t[16]!==c||t[17]!==o||t[18]!==n?(R=()=>d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[40%]",children:d.jsx(Uu,{theme:o,showPlaceholder:!1,id:dr,code:p,config:yF,status:"idle",serializedEditorState:null,runCell:x,userConfig:n,editorViewRef:r,setEditorView:ie=>{r.current=ie},hidden:!1,temporarilyShowCode:wn.NOOP,languageAdapter:A,setLanguageAdapter:T})}),d.jsx("div",{className:"flex-1 overflow-auto flex-shrink-0",children:d.jsx(Mc,{allowExpand:!1,output:c,className:"output-area",cellId:dr,stale:!1,loading:!1})}),d.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[35%]",children:d.jsx(Jp,{consoleOutputs:h,className:"overflow-auto",stale:!1,cellName:D3,onSubmitDebugger:wn.NOOP,cellId:dr,debuggerActive:!1})})]}),t[12]=p,t[13]=h,t[14]=x,t[15]=A,t[16]=c,t[17]=o,t[18]=n,t[19]=R):R=t[19];const z=R;let D;t[20]!==I||t[21]!==b||t[22]!==g||t[23]!==o?(D=()=>g?d.jsx("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:d.jsx("div",{className:"overflow-auto flex flex-col gap-3",children:b.map((ie,Me)=>d.jsx("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>I(ie),children:d.jsx(M.Suspense,{children:d.jsx(la,{language:"python",theme:o,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:ie.trim(),editable:!1,readOnly:!0})})},Me))})}):null,t[20]=I,t[21]=b,t[22]=g,t[23]=o,t[24]=D):D=t[24];const F=D;let B,U,O,S,$,E,W,G,q,Y,Q;t[25]===Symbol.for("react.memo_cache_sentinel")?(B=Ss.create(dr),U=d.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]=B,t[26]=U):(B=t[25],U=t[26]),t[27]===Symbol.for("react.memo_cache_sentinel")?(O=nn("cell.run"),t[27]=O):O=t[27],t[28]===Symbol.for("react.memo_cache_sentinel")?(S=d.jsx(Hs,{color:"var(--grass-11)",size:16}),t[28]=S):S=t[28],t[29]!==x||t[30]!==g?($=d.jsx(Ae,{content:O,children:d.jsx(Te,{"data-testid":"scratchpad-run-button",onClick:x,disabled:g,variant:"text",size:"xs",children:S})}),t[29]=x,t[30]=g,t[31]=$):$=t[31],t[32]===Symbol.for("react.memo_cache_sentinel")?(E=d.jsx(lm,{size:16}),t[32]=E):E=t[32],t[33]!==j||t[34]!==g?(W=d.jsx(Ae,{content:"Clear code and outputs",children:d.jsx(Te,{disabled:g,size:"xs",variant:"text",onClick:j,children:E})}),t[33]=j,t[34]=g,t[35]=W):W=t[35],t[36]===Symbol.for("react.memo_cache_sentinel")?(G=d.jsx(Lr,{size:16}),t[36]=G):G=t[36],t[37]!==C||t[38]!==g?(q=d.jsx(Ys,{children:d.jsx(Ae,{content:"Insert code",children:d.jsx(Te,{disabled:g,size:"xs",variant:"text",onClick:C,children:G})})}),t[37]=C,t[38]=g,t[39]=q):q=t[39],t[40]!==u?(Y=(u==="running"||u==="queued")&&d.jsx(Vn,{className:"inline",size:"small"}),t[40]=u,t[41]=Y):Y=t[41],t[42]===Symbol.for("react.memo_cache_sentinel")?(Q=d.jsx("div",{className:"flex-1"}),t[42]=Q):Q=t[42];const re=g&&"bg-[var(--sky-3)] rounded-none";let ae,Z;t[43]!==re?(ae=je(re),t[43]=re,t[44]=ae):ae=t[44],t[45]!==g||t[46]!==m?(Z=()=>m(!g),t[45]=g,t[46]=m,t[47]=Z):Z=t[47];const te=b.length===0;let ue,me,de,fe,he,Ce,Ee;return t[48]===Symbol.for("react.memo_cache_sentinel")?(ue=d.jsx(mm,{size:16}),t[48]=ue):ue=t[48],t[49]!==ae||t[50]!==Z||t[51]!==te?(me=d.jsx(Ae,{content:"Toggle history",children:d.jsx(Te,{size:"xs",variant:"text",className:ae,onClick:Z,disabled:te,children:ue})}),t[49]=ae,t[50]=Z,t[51]=te,t[52]=me):me=t[52],t[53]!==$||t[54]!==W||t[55]!==q||t[56]!==Y||t[57]!==me?(de=d.jsxs("div",{className:"flex items-center flex-shrink-0",children:[$,W,q,Y,Q,me]}),t[53]=$,t[54]=W,t[55]=q,t[56]=Y,t[57]=me,t[58]=de):de=t[58],t[59]!==z?(fe=z(),t[59]=z,t[60]=fe):fe=t[60],t[61]!==F?(he=F(),t[61]=F,t[62]=he):he=t[62],t[63]!==fe||t[64]!==he?(Ce=d.jsxs("div",{className:"flex-1 divide-y relative overflow-hidden flex flex-col",children:[fe,he]}),t[63]=fe,t[64]=he,t[65]=Ce):Ce=t[65],t[66]!==de||t[67]!==Ce?(Ee=d.jsxs("div",{className:"flex flex-col h-full overflow-hidden divide-y",id:B,children:[U,de,Ce]}),t[66]=de,t[67]=Ce,t[68]=Ee):Ee=t[68],Ee},wF=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=d.jsx(xF,{}),t[0]=e):e=t[0],e},vF=()=>{const t=X.c(23),{openModal:e,closeModal:n}=Fn();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const{data:r,isPending:s,error:i,refetch:a}=zn(SF,o);if(s){let b;return t[1]===Symbol.for("react.memo_cache_sentinel")?(b=d.jsx(Vn,{size:"medium",centered:!0}),t[1]=b):b=t[1],b}if(i){let b;return t[2]!==i?(b=d.jsx(Dr,{error:i}),t[2]=i,t[3]=b):b=t[3],b}let l;t[4]!==r?(l=r.filter(CF).map(NF),t[4]=r,t[5]=l):l=t[5];const c=l;if(r.length===0){let b;return t[6]===Symbol.for("react.memo_cache_sentinel")?(b=d.jsx(gn,{title:"No environment variables",description:"No environment variables are available in this notebook.",icon:d.jsx(Yc,{})}),t[6]=b):b=t[6],b}let u,h,f,p,_,g,m;return t[7]!==n||t[8]!==e||t[9]!==c||t[10]!==a?(u=()=>e(d.jsx(gg,{providerNames:c,onSuccess:()=>{a(),n()},onClose:n})),t[7]=n,t[8]=e,t[9]=c,t[10]=a,t[11]=u):u=t[11],t[12]===Symbol.for("react.memo_cache_sentinel")?(h=d.jsx(ar,{className:"h-4 w-4"}),t[12]=h):h=t[12],t[13]!==u?(f=d.jsx("div",{className:"flex justify-end h-8 border-b",children:d.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")?(p=d.jsx(Vp,{children:d.jsxs(Vs,{children:[d.jsx(Rr,{children:"Environment Variable"}),d.jsx(Rr,{children:"Source"}),d.jsx(Rr,{})]})}),t[15]=p):p=t[15],t[16]!==r?(_=r.map(jF),t[16]=r,t[17]=_):_=t[17],t[18]!==_?(g=d.jsxs($p,{className:"overflow-auto flex-1 mb-16",children:[p,d.jsx(Hp,{children:_})]}),t[18]=_,t[19]=g):g=t[19],t[20]!==f||t[21]!==g?(m=d.jsxs("div",{className:"flex flex-col h-full",children:[f,g]}),t[20]=f,t[21]=g,t[22]=m):m=t[22],m},kF=t=>{const e=X.c(9),{className:n,ariaLabel:o,onCopy:r}=t,[s,i]=K.useState(!1);let a;e[0]!==r?(a=()=>{r(),i(!0),setTimeout(()=>i(!1),1e3)},e[0]=r,e[1]=a):a=e[1];const l=a;let c,u;return e[2]!==s?(c=s?d.jsx(dc,{className:"w-3 h-3 text-green-700 rounded"}):d.jsx($i,{className:"w-3 h-3 hover:bg-muted rounded"}),e[2]=s,e[3]=c):c=e[3],e[4]!==o||e[5]!==n||e[6]!==l||e[7]!==c?(u=d.jsx("button",{type:"button",className:n,onClick:l,"aria-label":o,children:c}),e[4]=o,e[5]=n,e[6]=l,e[7]=c,e[8]=u):u=e[8],u};async function SF(){return mg((await MS.request({})).secrets)}function CF(t){return t.provider!=="env"}function NF(t){return t.name}function jF(t){return t.keys.map(e=>d.jsxs(Vs,{className:"group",children:[d.jsx(Pr,{children:e}),d.jsx(Pr,{children:t.provider!=="env"&&d.jsx(nS,{variant:"outline",className:"select-none",children:t.name})}),d.jsx(Pr,{children:d.jsx(kF,{ariaLabel:`Copy ${e}`,onCopy:async()=>{await pn(`os.environ["${e}"]`),ut({title:"Copied to clipboard",description:`os.environ["${e}"] has been copied to your clipboard.`})},className:je("float-right px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible")})})]},`${t.name}-${e}`))}const EF=t=>{const e=X.c(6),{children:n}=t,{openModal:o,closeModal:r}=Fn();let s,i;return e[0]!==r||e[1]!==o?(s=()=>o(d.jsx(AF,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(i=d.jsx(Y4,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=i):i=e[5],i},IF=[tt.lineWrapping],AF=t=>{const e=X.c(23),{onClose:n}=t,[o,r]=M.useState(""),{theme:s}=lr();let i,a,l,c,u,h;e[0]!==n?(i=async x=>{x.preventDefault();const v=new FormData(x.target),C=v.get("title"),k=v.get("description"),j=v.get("code");fetch("https://marimo.io/api/suggest-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:C,description:k,code:j})}),n(),ut({title:"Snippet Submitted",description:"Thank you for contributing! We will review your snippet shortly."})},e[0]=n,e[1]=i):i=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsx(er,{children:"Contribute a Snippet"}),e[2]=a):a=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(l=d.jsxs(vs,{children:[a,d.jsxs(ks,{children:["Have a useful snippet you want to share with the community? Submit it here or make a pull request"," ",d.jsx("a",{href:Yn.githubPage,target:"_blank",className:"underline",children:"on GitHub"}),"."]})]}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(tr,{id:"title",name:"title",autoFocus:!0,placeholder:"Title",required:!0,autoComplete:"off"}),u=d.jsx(G$,{id:"description",name:"description",autoFocus:!0,placeholder:"Description",rows:5,required:!0,autoComplete:"off"}),e[4]=c,e[5]=u):(c=e[4],u=e[5]),e[6]!==o?(h=d.jsx("input",{type:"hidden",name:"code",value:o}),e[6]=o,e[7]=h):h=e[7];const f=s==="dark"?"dark":"light";let p,_,g,m,b,y;return e[8]!==o||e[9]!==f?(p=d.jsx(la,{theme:f,language:"python",className:"cm border rounded overflow-hidden",extensions:IF,value:o,onChange:r}),e[8]=o,e[9]=f,e[10]=p):p=e[10],e[11]!==h||e[12]!==p?(_=d.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[c,u,h,p]}),e[11]=h,e[12]=p,e[13]=_):_=e[13],e[14]!==n?(g=d.jsx(Te,{"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")?(m=d.jsx(Te,{"data-testid":"snippet-send-button","aria-label":"Save",variant:"default",type:"submit",children:"Send"}),e[16]=m):m=e[16],e[17]!==g?(b=d.jsxs(Vi,{children:[g,m]}),e[17]=g,e[18]=b):b=e[18],e[19]!==i||e[20]!==b||e[21]!==_?(y=d.jsx(nr,{className:"w-fit",children:d.jsxs("form",{onSubmit:i,children:[l,_,b]})}),e[19]=i,e[20]=b,e[21]=_,e[22]=y):y=e[22],y},TF=[tt.lineWrapping],MF=()=>{const t=X.c(20),[e,n]=K.useState();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const{data:r,error:s,isPending:i}=zn(RF,o);if(s){let b;return t[1]!==s?(b=d.jsx(Dr,{error:s}),t[1]=s,t[2]=b):b=t[2],b}if(i||!r){let b;return t[3]===Symbol.for("react.memo_cache_sentinel")?(b=d.jsx(Vn,{size:"medium",centered:!0}),t[3]=b):b=t[3],b}const a=e?"h-1/3":"h-full";let l,c,u,h,f,p,_,g,m;return t[4]!==a?(l=je("border-b rounded-none",a),t[4]=a,t[5]=l):l=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(qi,{placeholder:"Search snippets...",className:"h-6 m-1",rootClassName:"flex-1 border-r"}),t[6]=c):c=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(u=d.jsxs("div",{className:"flex items-center w-full",children:[c,d.jsx(EF,{children:d.jsx("button",{className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:d.jsx(ar,{className:"h-4 w-4"})})})]}),h=d.jsx(tc,{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?(p=d.jsx(DF,{onSelect:f,snippets:r.snippets}),t[10]=r.snippets,t[11]=p):p=t[11],t[12]!==l||t[13]!==p?(_=d.jsxs(fc,{className:l,children:[u,h,p]}),t[12]=l,t[13]=p,t[14]=_):_=t[14],t[15]!==e?(g=d.jsx(M.Suspense,{children:d.jsx("div",{className:"h-2/3 snippet-viewer flex flex-col",children:e?d.jsx(OF,{snippet:e},e.title):d.jsx(gn,{title:"",description:"Click on a snippet to view its content."})})}),t[15]=e,t[16]=g):g=t[16],t[17]!==_||t[18]!==g?(m=d.jsxs("div",{className:"flex-1 overflow-hidden",children:[_,g]}),t[17]=_,t[18]=g,t[19]=m):m=t[19],m},OF=t=>{const e=X.c(27),{snippet:n}=t,{theme:o}=lr(),{createNewCell:r}=It(),s=As();let i;e[0]!==r||e[1]!==s||e[2]!==n.sections?(i=()=>{for(const m of[...n.sections].reverse())m.code&&r({code:m.code,before:!1,cellId:s??"__end__",skipIfCodeExists:!0})},e[0]=r,e[1]=s,e[2]=n.sections,e[3]=i):i=e[3];const a=i;let l;e[4]!==r||e[5]!==s?(l=m=>{r({code:m,before:!1,cellId:s??"__end__"})},e[4]=r,e[5]=s,e[6]=l):l=e[6];const c=l;let u,h,f,p,_,g;if(e[7]!==n.title?(u=d.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=d.jsx(Lr,{className:"ml-2 h-4 w-4"}),e[9]=h):h=e[9],e[10]!==a?(f=d.jsx("div",{className:"flex justify-end",children:d.jsx(Ys,{children:d.jsxs(Te,{className:"float-right",size:"xs",variant:"outline",onClick:a,children:["Insert snippet",h]})})}),e[10]=a,e[11]=f):f=e[11],e[12]!==c||e[13]!==n.sections||e[14]!==n.title||e[15]!==o){let m;e[17]!==c||e[18]!==n.title||e[19]!==o?(m=b=>{const{code:y,html:x,id:v}=b;return x?d.jsx("div",{children:Fp({html:x})},`${n.title}-${v}`):y?d.jsxs("div",{className:"relative hover-actions-parent pr-2",children:[d.jsx(Ys,{children:d.jsx(Ae,{content:"Insert snippet",children:d.jsx(Te,{className:"absolute -top-2 -right-1 z-10 hover-action px-2 bg-background",size:"sm",variant:"outline",onClick:()=>{c(y)},children:d.jsx(Lr,{className:"h-5 w-5"})})})}),d.jsx(M.Suspense,{children:d.jsx(la,{theme:o==="dark"?"dark":"light",language:"python",className:"cm border rounded overflow-hidden",extensions:TF,value:y,readOnly:!0},`${n.title}-${v}`)})]},`${n.title}-${v}`):null},e[17]=c,e[18]=n.title,e[19]=o,e[20]=m):m=e[20],p=n.sections.map(m),e[12]=c,e[13]=n.sections,e[14]=n.title,e[15]=o,e[16]=p}else p=e[16];return e[21]!==f||e[22]!==p?(_=d.jsxs("div",{className:"px-2 py-2 space-y-4 overflow-auto flex-1",children:[f,p]}),e[21]=f,e[22]=p,e[23]=_):_=e[23],e[24]!==u||e[25]!==_?(g=d.jsxs(d.Fragment,{children:[u,_]}),e[24]=u,e[25]=_,e[26]=g):g=e[26],g},DF=t=>{const e=X.c(7),{snippets:n,onSelect:o}=t;let r,s;if(e[0]!==o||e[1]!==n){let i;e[3]!==o?(i=a=>d.jsx(lo,{className:"rounded-none",onSelect:()=>o(a),children:d.jsx("div",{className:"flex flex-row gap-2 items-center",children:d.jsx("span",{className:"mt-1 text-accent-foreground",children:a.title})})},a.title),e[3]=o,e[4]=i):i=e[4],r=n.map(i),e[0]=o,e[1]=n,e[2]=r}else r=e[2];return e[5]!==r?(s=d.jsx(jp,{className:"flex flex-col overflow-auto",children:r}),e[5]=r,e[6]=s):s=e[6],s};function RF(){return Y$()}const PF=K.lazy(()=>Ep(()=>import("./tracing-DJ3yaJpl.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]),import.meta.url).then(t=>({default:t.Tracing}))),LF=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=d.jsx(K.Suspense,{fallback:d.jsx(FF,{}),children:d.jsx(PF,{})}),t[0]=e):e=t[0],e},FF=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=d.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:d.jsx(Vn,{})}),t[0]=e):e=t[0],e},m3="name",g3="type-value",Jf="defs-refs",zF=[{id:m3,accessorFn:t=>[t.name,t.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>d.jsx(Wp,{header:"Name",column:t}),cell:({getValue:t})=>{const[e,n]=t();return d.jsx(af,{name:e,declaredBy:n})}},{id:g3,accessorFn:t=>[t.dataType,t.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>d.jsx(Wp,{header:d.jsxs("div",{className:"flex flex-col gap-1",children:[d.jsx("span",{children:"Type"}),d.jsx("span",{children:"Value"})]}),column:t}),cell:({getValue:t})=>{const[e,n]=t();return d.jsxs("div",{className:"max-w-[150px]",children:[d.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs",children:e}),d.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap",title:n??"",children:n})]})}},{id:Jf,accessorFn:t=>[t.declaredBy,t.usedBy,t.name,t.declaredByNames,t.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:t})=>d.jsx(Wp,{header:d.jsxs("div",{className:"flex flex-col gap-1",children:[d.jsx("span",{children:"Declared By"}),d.jsx("span",{children:"Used By"})]}),column:t}),cell:({getValue:t})=>{const[e,n,o]=t(),r=s=>{const i=Jl(s);i&&zp(i,o)};return d.jsxs("div",{className:"flex flex-col gap-1 py-1",children:[d.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-center",children:[d.jsx("span",{title:"Declared by",children:d.jsx(Rm,{className:"w-3.5 h-3.5 text-muted-foreground"})}),e.length===1?d.jsx(cr,{variant:"focus",cellId:e[0],skipScroll:!0,onClick:()=>r(e[0])}):d.jsx("div",{className:"text-destructive flex flex-row gap-2",children:e.slice(0,3).map((s,i)=>d.jsxs("span",{className:"flex",children:[d.jsx(cr,{variant:"focus",cellId:s,skipScroll:!0,className:"whitespace-nowrap text-destructive",onClick:()=>r(s)},s),i<e.length-1&&", "]},s))})]}),d.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-baseline",children:[d.jsx("span",{title:"Used by",children:d.jsx(ba,{className:"w-3.5 h-3.5 text-muted-foreground"})}),d.jsx(z2,{maxCount:3,cellIds:n,skipScroll:!0,onClick:r})]})]})}}],_3=M.memo(({className:t,cellIds:e,variables:n})=>{const[o,r]=K.useState([]),[s,i]=K.useState(""),a=J$(),l=M.useMemo(()=>{const h=f=>{const p=a[f];return eH(p)?`cell-${e.indexOf(f)}`:p??`cell-${e.indexOf(f)}`};return Object.values(n).map(f=>({...f,declaredByNames:f.declaredBy.map(h),usedByNames:f.usedBy.map(h)}))},[n,a,e]),c=M.useMemo(()=>{const h=new Map;return e.forEach((f,p)=>h.set(f,p)),function(f,p,_){p||(p={id:Jf,desc:!1});let g=[];switch(p.id){case m3:g=ua(f,m=>m.name);break;case g3:g=ua(f,m=>m.dataType);break;case Jf:g=ua(f,m=>_.get(m.declaredBy[0]))}return p.desc?g.reverse():g}(l,o[0],h)},[l,o,e]),u=K$({data:c,columns:zF,getCoreRowModel:Q$(),onGlobalFilterChange:i,getFilteredRowModel:Z$(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter:h=>h.columnDef.enableGlobalFilter??!0,globalFilterFn:"auto",manualSorting:!0,onSortingChange:r,getSortedRowModel:X$(),state:{sorting:o,globalFilter:s}});return d.jsxs(d.Fragment,{children:[d.jsx(_S,{className:"w-full",placeholder:"Search",value:s,onChange:h=>i(h.target.value)}),d.jsxs($p,{className:je("w-full text-sm flex-1 border-separate border-spacing-0",t),children:[d.jsx(Vp,{children:d.jsx(Vs,{className:"whitespace-nowrap text-xs",children:u.getFlatHeaders().map(h=>d.jsx(Rr,{className:"sticky top-0 bg-background border-b",children:wS(h.column.columnDef.header,h.getContext())},h.id))})}),d.jsx(Hp,{children:u.getRowModel().rows.map(h=>d.jsx(Vs,{className:"hover:bg-accent",children:h.getVisibleCells().map(f=>d.jsx(Pr,{className:"border-b",children:wS(f.column.columnDef.cell,f.getContext())},f.id))},h.id))})]})]})});_3.displayName="VariableTable";const BF=()=>{const t=X.c(4),e=rS(),n=Pc();if(Object.keys(e).length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=d.jsx(gn,{title:"No variables",description:"Global variables will appear here.",icon:d.jsx(ql,{})}),t[0]=r):r=t[0],r}let o;return t[1]!==n.inOrderIds||t[2]!==e?(o=d.jsx(_3,{className:"flex-1",cellIds:n.inOrderIds,variables:e}),t[1]=n.inOrderIds,t[2]=e,t[3]=o):o=t[3],o},UF=K.lazy(()=>Ep(()=>import("./terminal-BgXO_ixx.js"),__vite__mapDeps([123,1,2,124]),import.meta.url)),VF=t=>{const e=X.c(121),{children:n}=t,{isSidebarOpen:o,isTerminalOpen:r,selectedPanel:s}=cc(),{setIsSidebarOpen:i,setIsTerminalOpen:a}=Ji(),l=K.useRef(null),c=K.useRef(null);let u,h,f,p,_;e[0]!==o?(u=()=>{if(!l.current)return;const le=l.current.isCollapsed();o&&le&&l.current.expand(),o||le||l.current.collapse(),requestAnimationFrame(HF)},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(!c.current)return;const le=c.current.isCollapsed();r&&le&&c.current.expand(),r||le||c.current.collapse(),requestAnimationFrame(qF)},p=[r],e[3]=r,e[4]=f,e[5]=p):(f=e[4],p=e[5]),M.useEffect(f,p),e[6]!==n?(_=d.jsx(Fc,{id:"app",className:"relative h-full",children:d.jsx(M.Suspense,{children:n})},"app"),e[6]=n,e[7]=_):_=e[7];const g=_,m=o?"resize-handle":"resize-handle-collapsed";let b,y;e[8]!==m?(b=je("border-border no-print z-10",m,"vertical"),e[8]=m,e[9]=b):b=e[9],e[10]!==b?(y=d.jsx(vS,{onDragging:kS,className:b}),e[10]=b,e[11]=y):y=e[11];const x=y,v=r?"resize-handle":"resize-handle-collapsed";let C,k;e[12]!==v?(C=je("border-border no-print z-20",v,"horizontal"),e[12]=v,e[13]=C):C=e[13],e[14]!==C?(k=d.jsx(vS,{onDragging:kS,className:C}),e[14]=C,e[15]=k):k=e[15];const j=k;let N,I,A,T,R,z,D,F,B,U,O,S,$,E,W,G,q,Y,Q,re,ae;e[16]!==s?(N=d.jsx("div",{className:"text-sm text-[var(--slate-11)] uppercase tracking-wide font-semibold flex-1",children:s}),e[16]=s,e[17]=N):N=e[17],e[18]!==i?(I=()=>i(!1),e[18]=i,e[19]=I):I=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(A=d.jsx(Jn,{className:"w-4 h-4"}),e[20]=A):A=e[20],e[21]!==I?(T=d.jsx(Te,{"data-testid":"close-helper-pane",className:"m-0",size:"xs",variant:"text",onClick:I,children:A}),e[21]=I,e[22]=T):T=e[22],e[23]!==N||e[24]!==T?(R=d.jsxs("div",{className:"p-3 border-b flex justify-between items-center",children:[N,T]}),e[23]=N,e[24]=T,e[25]=R):R=e[25],e[26]!==s?(z=s==="files"&&d.jsx(a3,{}),e[26]=s,e[27]=z):z=e[27],e[28]!==s?(D=s==="errors"&&d.jsx(FL,{}),e[28]=s,e[29]=D):D=e[29],e[30]!==s?(F=s==="variables"&&d.jsx(BF,{}),e[30]=s,e[31]=F):F=e[31],e[32]!==s?(B=s==="dependencies"&&d.jsx(kL,{}),e[32]=s,e[33]=B):B=e[33],e[34]!==s?(U=s==="packages"&&d.jsx(dF,{}),e[34]=s,e[35]=U):U=e[35],e[36]!==s?(O=s==="outline"&&d.jsx(cF,{}),e[36]=s,e[37]=O):O=e[37],e[38]!==s?(S=s==="datasources"&&d.jsx(PL,{}),e[38]=s,e[39]=S):S=e[39],e[40]!==s?($=s==="documentation"&&d.jsx(LL,{}),e[40]=s,e[41]=$):$=e[41],e[42]!==s?(E=s==="snippets"&&d.jsx(MF,{}),e[42]=s,e[43]=E):E=e[43],e[44]!==s?(W=s==="scratchpad"&&d.jsx(wF,{}),e[44]=s,e[45]=W):W=e[45],e[46]!==s?(G=s==="chat"&&d.jsx(qD,{}),e[46]=s,e[47]=G):G=e[47],e[48]!==s?(q=s==="logs"&&d.jsx(l3,{}),e[48]=s,e[49]=q):q=e[49],e[50]!==s?(Y=s==="tracing"&&d.jsx(LF,{}),e[50]=s,e[51]=Y):Y=e[51],e[52]!==s?(Q=s==="secrets"&&d.jsx(vF,{}),e[52]=s,e[53]=Q):Q=e[53],e[54]!==z||e[55]!==D||e[56]!==F||e[57]!==B||e[58]!==U||e[59]!==O||e[60]!==S||e[61]!==$||e[62]!==E||e[63]!==W||e[64]!==G||e[65]!==q||e[66]!==Y||e[67]!==Q?(re=d.jsx(M.Suspense,{children:d.jsxs(Dc,{children:[z,D,F,B,U,O,S,$,E,W,G,q,Y,Q]})}),e[54]=z,e[55]=D,e[56]=F,e[57]=B,e[58]=U,e[59]=O,e[60]=S,e[61]=$,e[62]=E,e[63]=W,e[64]=G,e[65]=q,e[66]=Y,e[67]=Q,e[68]=re):re=e[68],e[69]!==R||e[70]!==re?(ae=d.jsx(pc,{children:d.jsxs("div",{className:"flex flex-col h-full flex-1 overflow-hidden mr-[-4px]",children:[R,re]})}),e[69]=R,e[70]=re,e[71]=ae):ae=e[71];const Z=ae,te=o&&"border-r border-l border-[var(--slate-7)]";let ue,me,de,fe,he,Ce;e[72]!==te?(ue=je("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",te),e[72]=te,e[73]=ue):ue=e[73],e[74]===Symbol.for("react.memo_cache_sentinel")?(me=(le,He)=>{var Fe;He===0&&le===10&&((Fe=l.current)==null||Fe.resize(30))},e[74]=me):me=e[74],e[75]!==i?(de=()=>i(!1),fe=()=>i(!0),e[75]=i,e[76]=de,e[77]=fe):(de=e[76],fe=e[77]),e[78]!==Z||e[79]!==x?(he=d.jsxs("span",{className:"flex flex-row h-full",children:[Z," ",x]}),e[78]=Z,e[79]=x,e[80]=he):he=e[80],e[81]!==ue||e[82]!==de||e[83]!==fe||e[84]!==he?(Ce=d.jsx(Fc,{ref:l,id:"helper",collapsedSize:0,collapsible:!0,className:ue,minSize:10,defaultSize:0,maxSize:75,onResize:me,onCollapse:de,onExpand:fe,children:he},"helper"),e[81]=ue,e[82]=de,e[83]=fe,e[84]=he,e[85]=Ce):Ce=e[85];const Ee=Ce,ie=r&&"border-[var(--slate-7)]";let Me,xe,Re,Ue,Je,Ke,Pe,st,et;e[86]!==ie?(Me=je("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",ie),e[86]=ie,e[87]=Me):Me=e[87],e[88]===Symbol.for("react.memo_cache_sentinel")?(xe=(le,He)=>{var Fe;He===0&&le===10&&((Fe=c.current)==null||Fe.resize(30))},e[88]=xe):xe=e[88],e[89]!==a?(Re=()=>a(!1),Ue=()=>a(!0),e[89]=a,e[90]=Re,e[91]=Ue):(Re=e[90],Ue=e[91]),e[92]===Symbol.for("react.memo_cache_sentinel")?(Je=d.jsx("div",{}),e[92]=Je):Je=e[92],e[93]!==a?(Ke=()=>a(!1),e[93]=a,e[94]=Ke):Ke=e[94],e[95]!==r||e[96]!==Ke?(Pe=d.jsx(M.Suspense,{fallback:Je,children:d.jsx(UF,{visible:r,onClose:Ke})}),e[95]=r,e[96]=Ke,e[97]=Pe):Pe=e[97],e[98]!==r||e[99]!==Pe?(st=d.jsx(SL,{isOpen:r,children:Pe}),e[98]=r,e[99]=Pe,e[100]=st):st=e[100],e[101]!==Me||e[102]!==Re||e[103]!==Ue||e[104]!==st||e[105]!==j?(et=d.jsxs(Fc,{ref:c,id:"terminal",collapsedSize:0,collapsible:!0,className:Me,minSize:10,defaultSize:0,maxSize:75,onResize:xe,onCollapse:Re,onExpand:Ue,children:[j,st]},"terminal"),e[101]=Me,e[102]=Re,e[103]=Ue,e[104]=st,e[105]=j,e[106]=et):et=e[106];const nt=et;let ne,ve,Se,De,J,ge,_e,pe;return e[107]===Symbol.for("react.memo_cache_sentinel")?(ne=qH(),e[107]=ne):ne=e[107],e[108]===Symbol.for("react.memo_cache_sentinel")?(ve=d.jsx(Dc,{children:d.jsx(jO,{})}),e[108]=ve):ve=e[108],e[109]!==nt?(Se=d.jsx(Mx,{capability:"terminal",children:nt}),e[109]=nt,e[110]=Se):Se=e[110],e[111]!==g||e[112]!==Se?(De=d.jsx(Fc,{children:d.jsxs(SS,{autoSaveId:"marimo:chrome:v1:l1",direction:"vertical",children:[g,Se]})}),e[111]=g,e[112]=Se,e[113]=De):De=e[113],e[114]===Symbol.for("react.memo_cache_sentinel")?(J=d.jsx(tH,{}),e[114]=J):J=e[114],e[115]!==Ee||e[116]!==De?(ge=d.jsxs(SS,{autoSaveId:"marimo:chrome:v1:l2",direction:"horizontal",storage:ne,children:[ve,Ee,De,J]}),e[115]=Ee,e[116]=De,e[117]=ge):ge=e[117],e[118]===Symbol.for("react.memo_cache_sentinel")?(_e=d.jsx(pc,{children:d.jsx(Dc,{children:d.jsx(vO,{})})}),e[118]=_e):_e=e[118],e[119]!==ge?(pe=d.jsxs(GH,{children:[ge,_e]}),e[119]=ge,e[120]=pe):pe=e[120],pe};function $F(){window.dispatchEvent(new Event("resize"))}function HF(){requestAnimationFrame($F)}function WF(){window.dispatchEvent(new Event("resize"))}function qF(){requestAnimationFrame(WF)}let b3;b3=new URL(window.location.href).searchParams.get(nH.showChrome)==="false",VS=Object.freeze(Object.defineProperty({__proto__:null,default:t=>{const e=X.c(10);if(b3){let s,i,a;return e[0]!==t?(s=d.jsx(Tx,{hideControls:!0,...t}),e[0]=t,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsx(Jm,{}),e[2]=i):i=e[2],e[3]!==s?(a=d.jsxs(d.Fragment,{children:[s,i]}),e[3]=s,e[4]=a):a=e[4],a}let n,o,r;return e[5]!==t?(n=d.jsx(Tx,{...t}),e[5]=t,e[6]=n):n=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(o=d.jsx(Jm,{}),e[7]=o):o=e[7],e[8]!==n?(r=d.jsxs(VF,{children:[n,o]}),e[8]=n,e[9]=r):r=e[9],r}},Symbol.toStringTag,{value:"Module"}))});export{Zp as C,Uc as E,gn as P,XH as __tla,Vc as a,VS as e,ha as f};