@marimo-team/frontend 0.14.11-dev72 → 0.14.11-dev74

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 (96) hide show
  1. package/dist/assets/{ConnectedDataExplorerComponent-QNSg3r9O.js → ConnectedDataExplorerComponent-B9BmPz9a.js} +1 -1
  2. package/dist/assets/{ImageComparisonComponent-CP5Cy_nl.js → ImageComparisonComponent-CNTqLdnf.js} +1 -1
  3. package/dist/assets/{VegaLite-Dfe0Urmt.js → VegaLite-DLKRDJvl.js} +1 -1
  4. package/dist/assets/{_baseEach-Oq1b6Vj7.js → _baseEach-BjDLzUwG.js} +1 -1
  5. package/dist/assets/_baseMap-CuZ-LBtv.js +1 -0
  6. package/dist/assets/{_baseUniq-B_mvr7GI.js → _baseUniq-DqHaT24V.js} +1 -1
  7. package/dist/assets/{_createAggregator-DYHbrJKw.js → _createAggregator-C_WhAECr.js} +1 -1
  8. package/dist/assets/{any-language-editor-Bz6ZWwU_.js → any-language-editor-DrZjy7mH.js} +1 -1
  9. package/dist/assets/{architectureDiagram-NQ2NVSRB-dvHYur4M.js → architectureDiagram-NQ2NVSRB-DqJfNlvg.js} +1 -1
  10. package/dist/assets/{blockDiagram-PHRCVELO-DuGlfCPb.js → blockDiagram-PHRCVELO-BMyZ52bP.js} +1 -1
  11. package/dist/assets/{c4Diagram-6F6E4RAY-C1bcLnUs.js → c4Diagram-6F6E4RAY-DveKwcb7.js} +1 -1
  12. package/dist/assets/channel-LYGgdr1R.js +1 -0
  13. package/dist/assets/{chunk-353BL4L5-Z9QK1Sy2.js → chunk-353BL4L5-DBdJb07A.js} +1 -1
  14. package/dist/assets/{chunk-67H74DCK-BfbQjnIB.js → chunk-67H74DCK-DG8iWVJ-.js} +1 -1
  15. package/dist/assets/{chunk-6OLS64BW-DwBkid2_.js → chunk-6OLS64BW-Dmt4rYEQ.js} +1 -1
  16. package/dist/assets/{chunk-AACKK3MU-EMbcCDOG.js → chunk-AACKK3MU-CDOdA9eC.js} +1 -1
  17. package/dist/assets/{chunk-BFAMUDN2-Smdd-nnU.js → chunk-BFAMUDN2-Cf6198RO.js} +1 -1
  18. package/dist/assets/{chunk-E2GYISFI-CkjiRzlT.js → chunk-E2GYISFI-fSvIEcyU.js} +1 -1
  19. package/dist/assets/{chunk-QEP2MXWD-DXF9XFhg.js → chunk-QEP2MXWD-D6FP1cQC.js} +1 -1
  20. package/dist/assets/{chunk-SKB7J2MH-amgUtKom.js → chunk-SKB7J2MH-B7Z1FsaJ.js} +1 -1
  21. package/dist/assets/{circle-play-DXMV_zw8.js → circle-play-CBftacWk.js} +1 -1
  22. package/dist/assets/classDiagram-BGRH5UQR-BQbZmSV-.js +1 -0
  23. package/dist/assets/classDiagram-v2-O24JOBDK-BQbZmSV-.js +1 -0
  24. package/dist/assets/clone-DD3sG0_1.js +1 -0
  25. package/dist/assets/{compile-OQmqyn3d.js → compile-mbjlQ5nn.js} +1 -1
  26. package/dist/assets/{dagre-FFZHY6LT-Dm7KedkK.js → dagre-FFZHY6LT-DX9cGWLP.js} +1 -1
  27. package/dist/assets/{data-grid-overlay-editor-0MMb3ORz.js → data-grid-overlay-editor-C4fyHnn1.js} +1 -1
  28. package/dist/assets/{diagram-3EMPZRKU-D4ptO8ZX.js → diagram-3EMPZRKU-BwXQu6c-.js} +1 -1
  29. package/dist/assets/{diagram-5UYTHUR4-DBDXUsko.js → diagram-5UYTHUR4-BgOShMim.js} +1 -1
  30. package/dist/assets/{diagram-ZTM2IBQH-DwVHm-a7.js → diagram-ZTM2IBQH-m55tqkSF.js} +1 -1
  31. package/dist/assets/{edit-page-rhiVKwbK.js → edit-page-BMW2Fhcz.js} +5 -5
  32. package/dist/assets/{erDiagram-R3QVA2FD-CF2j_ghF.js → erDiagram-R3QVA2FD-B8SQvwhp.js} +1 -1
  33. package/dist/assets/{flowDiagram-PKI6S5ZS-J8Af8aQY.js → flowDiagram-PKI6S5ZS-BTbZVZp0.js} +1 -1
  34. package/dist/assets/{ganttDiagram-EK5VF46D-BvmXCoQK.js → ganttDiagram-EK5VF46D-Dkuqvb7b.js} +1 -1
  35. package/dist/assets/{gitGraphDiagram-GW3U2K7C-Cr7iejkN.js → gitGraphDiagram-GW3U2K7C-BMQ8L_am.js} +1 -1
  36. package/dist/assets/{glide-data-editor-dRdzyJuS.js → glide-data-editor-BKZWFNVv.js} +4 -4
  37. package/dist/assets/{graph-DQMI2Eqq.js → graph-CFDemIXQ.js} +1 -1
  38. package/dist/assets/{home-page-DnThjRcD.js → home-page-DUbYTF9g.js} +1 -1
  39. package/dist/assets/{index-DntrNFd9.js → index-1az6nvpO.js} +1 -1
  40. package/dist/assets/{index-DcLIgqZD.js → index-B0-K_sX8.js} +1 -1
  41. package/dist/assets/{index-C75-E0Wz.js → index-B9WlbtVk.js} +1 -1
  42. package/dist/assets/{index-BRkwCtw_.js → index-BWEPJWCF.js} +1 -1
  43. package/dist/assets/{index-CfmtzcxT.js → index-CE3mbf8H.js} +1 -1
  44. package/dist/assets/{index-Cn4DIfCi.js → index-CH2sakSJ.js} +1 -1
  45. package/dist/assets/{index-T57zmtXp.js → index-CRY746sV.js} +1 -1
  46. package/dist/assets/{index-BYFCOF0M.js → index-C_e9XjpS.js} +1 -1
  47. package/dist/assets/{index-8PMBSacA.js → index-CaHkXpUp.js} +1 -1
  48. package/dist/assets/{index-D6n-fNiw.js → index-CfvA7bvb.js} +1 -1
  49. package/dist/assets/{index-8OV_Dw5k.js → index-ChVO1Vdj.js} +1 -1
  50. package/dist/assets/{index-nJgUkZhZ.js → index-CylrdBnG.js} +1 -1
  51. package/dist/assets/{index-Cj-dQTQ3.js → index-D3Er-byj.js} +1 -1
  52. package/dist/assets/{index-DMYp6bTi.js → index-D_Dmmo5g.js} +1 -1
  53. package/dist/assets/{index-BgVLJCds.js → index-Drq4Lpl3.js} +1 -1
  54. package/dist/assets/{index-B7HBR2mZ.js → index-MUMVp22V.js} +1 -1
  55. package/dist/assets/{index-BDA641Ri.js → index-NLK5-sPO.js} +1 -1
  56. package/dist/assets/{index-DUfE3Ygv.js → index-_lj65MZR.js} +13 -13
  57. package/dist/assets/{index-C1UTJg_P.js → index-d0CXXxee.js} +1 -1
  58. package/dist/assets/infoDiagram-RLU2ROGC-DAW5X38W.js +2 -0
  59. package/dist/assets/{journeyDiagram-EWQZEKCU-CufyRuPd.js → journeyDiagram-EWQZEKCU--6lJjuiM.js} +1 -1
  60. package/dist/assets/{kanban-definition-ILFWEQ3N-BMVZp5Z-.js → kanban-definition-ILFWEQ3N-CXNPWHB8.js} +1 -1
  61. package/dist/assets/{layout-D6cZFix-.js → layout-Jgv95YSr.js} +1 -1
  62. package/dist/assets/{linear-CwIDADia.js → linear-DtgEMbrz.js} +1 -1
  63. package/dist/assets/{links-BNNDBIJj.js → links-Bjf-1I2i.js} +1 -1
  64. package/dist/assets/{mermaid-Bhkvxu54.js → mermaid-DCMac0Ai.js} +4 -4
  65. package/dist/assets/{min-BCL-6Bwx.js → min-VDyC-auF.js} +1 -1
  66. package/dist/assets/{mindmap-definition-CZNETY7S-C_MYXj4X.js → mindmap-definition-CZNETY7S-BEd6cR16.js} +1 -1
  67. package/dist/assets/{number-overlay-editor-Df2FevAR.js → number-overlay-editor-C3hemckO.js} +1 -1
  68. package/dist/assets/{pieDiagram-NIOCPIFQ-Bk9T2le2.js → pieDiagram-NIOCPIFQ-B-zGF99A.js} +1 -1
  69. package/dist/assets/{quadrantDiagram-2OG54O6I-NgH_B06m.js → quadrantDiagram-2OG54O6I-2tF9b_2b.js} +1 -1
  70. package/dist/assets/{react-plotly-CXOmDiE0.js → react-plotly-CdJaKwaj.js} +1 -1
  71. package/dist/assets/{requirementDiagram-SO3GGRV7-HvEJIPC2.js → requirementDiagram-SO3GGRV7-DEa34SeY.js} +1 -1
  72. package/dist/assets/{run-page-Mq0VpxGL.js → run-page-Bg1x8WTa.js} +1 -1
  73. package/dist/assets/{sankeyDiagram-4UZDY2LN-CBGiR7n-.js → sankeyDiagram-4UZDY2LN-DUIUN-K8.js} +1 -1
  74. package/dist/assets/{sequenceDiagram-ZIKVLSP4-C7hXviAB.js → sequenceDiagram-ZIKVLSP4-BZGddaB9.js} +1 -1
  75. package/dist/assets/{slides-component-1Y9n5Gm1.js → slides-component-C2uc6kmf.js} +1 -1
  76. package/dist/assets/{sortBy-DvcUtmWI.js → sortBy-Bob7dKSt.js} +1 -1
  77. package/dist/assets/{stateDiagram-XX37X6EN-BDbxDzSy.js → stateDiagram-XX37X6EN-DUi_goR8.js} +1 -1
  78. package/dist/assets/stateDiagram-v2-GD6S3NHB-CdRNmgeb.js +1 -0
  79. package/dist/assets/{storage-lmv2DjR1.js → storage-CTvz5ejZ.js} +3 -3
  80. package/dist/assets/{terminal-DKZoyrP7.js → terminal-BkOhnp-S.js} +1 -1
  81. package/dist/assets/{time-y8i94pyX.js → time-BXb9z1yv.js} +1 -1
  82. package/dist/assets/{timeline-definition-RI47OAVP-DYNkDwyx.js → timeline-definition-RI47OAVP-CTWn3WQu.js} +1 -1
  83. package/dist/assets/{tracing-DGevMtzp.js → tracing-Z4QREdu3.js} +2 -2
  84. package/dist/assets/{trash-CtRVuIVX.js → trash-BWRVB_br.js} +1 -1
  85. package/dist/assets/{treemap-FKARHQ26-BVbfYHyM.js → treemap-FKARHQ26-AlpUch0p.js} +1 -1
  86. package/dist/assets/{vega-component-DQf7Z9TU.js → vega-component-CX_u3Hhp.js} +1 -1
  87. package/dist/assets/{xychartDiagram-H2YORKM3-BZbRNiRy.js → xychartDiagram-H2YORKM3-D0JoLNE8.js} +1 -1
  88. package/dist/index.html +1 -1
  89. package/package.json +2 -2
  90. package/dist/assets/_baseMap-NO7KiGEP.js +0 -1
  91. package/dist/assets/channel-DO4c6oXE.js +0 -1
  92. package/dist/assets/classDiagram-BGRH5UQR-CqrI7fcr.js +0 -1
  93. package/dist/assets/classDiagram-v2-O24JOBDK-CqrI7fcr.js +0 -1
  94. package/dist/assets/clone-DmicZLVp.js +0 -1
  95. package/dist/assets/infoDiagram-RLU2ROGC-6ayEwNHi.js +0 -2
  96. package/dist/assets/stateDiagram-v2-GD6S3NHB-omlXEd8A.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./tracing-DGevMtzp.js","./index-DUfE3Ygv.js","./index-CsdFJkJw.css","./compile-OQmqyn3d.js","./time-y8i94pyX.js","./timer-Bqd5yn_a.js","./linear-CwIDADia.js","./init-DLRA0X12.js","./range-CtcPcB_L.js","./zoom-COrs4lFh.js","./ordinal-DDUp3AbE.js","./colors-bszWmPJw.js","./step-BwsUM5iJ.js","./arc-ZB5pDULS.js","./index-BEQfoZiP.js","./storage-lmv2DjR1.js","./index-T57zmtXp.js","./index-8OV_Dw5k.js","./index-CfmtzcxT.js","./index-D6n-fNiw.js","./index-nJgUkZhZ.js","./index-BgVLJCds.js","./index-DcLIgqZD.js","./index-C75-E0Wz.js","./index-BRkwCtw_.js","./index-DMYp6bTi.js","./index-BDA641Ri.js","./index-DntrNFd9.js","./index-8PMBSacA.js","./apl-CXdQSnD-.js","./asciiarmor-D5V0T9Cu.js","./asterisk-B46aRdXb.js","./brainfuck-CtZaYBKt.js","./clike-BgBwzOhw.js","./cmake-DXn5xaP-.js","./cobol-stawOqaz.js","./coffeescript-BTDxI-eT.js","./commonlisp-vq6DHwts.js","./crystal-CRzZ78HM.js","./cypher-gJDei3ni.js","./d-BShv7fp-.js","./diff-UJJ5BM9S.js","./dockerfile-knGOOxt4.js","./simple-mode-C3vEBAcb.js","./dtd-DI9Herc-.js","./dylan-DkEP81N9.js","./ebnf-B-Df8AvO.js","./ecl-DPFc0Uaf.js","./eiffel-DR5c0IrL.js","./elm-DompmV0j.js","./erlang-BuqgqA5h.js","./factor-CFXhaUWb.js","./fcl-CVaBTCzQ.js","./forth-POgR1ypr.js","./fortran-DL7KluxX.js","./gas-bV0CklSb.js","./gherkin-B6X1vGSW.js","./groovy-DnIzCrpZ.js","./haskell-CLQs6EAM.js","./haxe-D25e-2l-.js","./http-BKJkqRj4.js","./idl-pcmmZuaN.js","./jinja2-DhgKlfW7.js","./julia-DjdwvFuI.js","./livescript-HO6ttBFx.js","./lua-8DXOpKDz.js","./mathematica-IIbmv7SK.js","./mbox-z_N2Mo3d.js","./mirc-DkvFAiy5.js","./modelica-DSrSSXCg.js","./mscgen-B2igx18G.js","./mumps-zvxmGV4l.js","./nginx-B4hAVlXN.js","./nsis-BvKfQ9lQ.js","./ntriples-BSwWqoLa.js","./octave-C4hdQ5Hf.js","./oz-qQq7irPq.js","./pascal-CafrKXZF.js","./perl-tdMlh9QA.js","./pig-CwGJVRC4.js","./powershell-D1ly3AHC.js","./properties-_nPj978X.js","./protobuf-B4y9do6W.js","./puppet-Bc-yJKzi.js","./q-B0kTJ4cI.js","./r-BA4EbLKE.js","./ruby-CR-u2WLS.js","./sas-Bqaci40L.js","./scheme-qjP0V5Ag.js","./shell-BLav31RL.js","./sieve-r025o_jW.js","./smalltalk-C7J3IyEP.js","./solr-78MBEUkU.js","./sparql-BRLJFz69.js","./spreadsheet-CGlWr0eM.js","./stylus-Bdo_Aemu.js","./swift-B_XXVlXX.js","./tcl-B2fODqDH.js","./textile-BuVhTOzU.js","./tiddlywiki-BgR6AEZu.js","./tiki-CI-ztowC.js","./toml-wcPdHu67.js","./troff-Ce85hlLp.js","./ttcn-BxnYHtq8.js","./turtle-BkSuIpt-.js","./vb-BHgjm0DN.js","./vbscript-Dawdd5GZ.js","./velocity-BdD_26Jv.js","./verilog-B4LBqg_1.js","./vhdl-CWWH2SUo.js","./webidl-CGwyPRYs.js","./xquery-CVDBqZPY.js","./yacas-I8QjZlxf.js","./z80-D8p3gKXp.js","./trash-CtRVuIVX.js","./storage-De8XnUVS.css","./links-BNNDBIJj.js","./index-Cn4DIfCi.js","./links-C1rhMrxo.css","./circle-play-DXMV_zw8.js","./_createAggregator-DYHbrJKw.js","./_baseEach-Oq1b6Vj7.js","./transform-CDNfLgV5.js","./sortBy-DvcUtmWI.js","./_baseMap-NO7KiGEP.js","./terminal-DKZoyrP7.js","./terminal-WqMRJt5Z.css"])))=>i.map(i=>d[i]);
2
- var Zz=Object.defineProperty;var H3=Bt=>{throw TypeError(Bt)};var Qz=(Bt,It,fn)=>It in Bt?Zz(Bt,It,{enumerable:!0,configurable:!0,writable:!0,value:fn}):Bt[It]=fn;var te=(Bt,It,fn)=>Qz(Bt,typeof It!="symbol"?It+"":It,fn),eB=(Bt,It,fn)=>It.has(Bt)||H3("Cannot "+fn);var W3=(Bt,It,fn)=>(eB(Bt,It,"read from private field"),fn?fn.call(Bt):It.get(Bt)),q3=(Bt,It,fn)=>It.has(Bt)?H3("Cannot add the same private member more than once"):It instanceof WeakSet?It.add(Bt):It.set(Bt,fn);import{c as De,W as O,it as tB,iu as nB,iv as G3,iw as oB,ix as rB,iy as sB,b as X,iz as pm,iA as Pr,iB,iC as gm,iD as Y3,iE as aB,iF as lB,iG as J3,iH as rc,a as K,eD as cB,aq as nt,j as c,af as Zn,an as sr,am as Ts,ao as Ms,br as ir,ak as Ae,ap as _n,iI as Ki,al as ar,aR as Qn,ar as Xi,a1 as Te,X as Ot,dV as _m,eH as bm,iJ as dB,aM as qe,a7 as bt,iK as uB,eU as Nn,iL as K3,iM as X3,iN as xm,iO as Z3,iP as hB,L as vt,dC as sc,aY as lr,iQ as ic,a_ as ym,au as un,iR as fB,a4 as Zi,iS as mB,iT as Q3,eT as e4,U as zt,b4 as t4,iU as n4,cE as ac,iV as pB,dM as at,iW as lc,dT as cr,iX as o4,iY as Qi,T as Le,bc as $n,iZ as cc,i_ as dc,eK as Os,i$ as gB,j0 as ea,j1 as r4,eR as s4,j2 as wm,j3 as vm,em as km,j4 as fo,j5 as Lr,aW as uc,j6 as _B,j7 as hc,j8 as Sm,a2 as dr,ea as i4,a3 as ta,j9 as bB,ja as fc,jb as ur,bt as Fr,eL as zr,fr as a4,gb as Br,fG as xB,bf as Qt,jc as yB,jd as wB,g9 as mc,aO as pc,je as Cm,jf as vB,jg as l4,jh as Nm,ji as kB,jj as jm,jk as mo,jl as c4,gf as Em,jm as na,jn as gc,er as xt,et as Ds,jo as kt,jp as Ge,jq as ht,jr as Im,js as SB,jt as Am,ju as St,jv as d4,dw as _c,ds as bc,dt as xc,du as yc,dr as oa,jw as CB,fE as Tm,b3 as Hn,aI as Wn,fu as u4,fw as h4,fx as NB,fC as jB,fy as f4,jx as m4,$ as Ne,el as EB,aU as hr,b1 as fr,aV as mr,a$ as Vt,eS as bn,jy as p4,fA as g4,jz as IB,jA as AB,fs as _4,ft as b4,jB as Rs,dv as x4,jC as y4,jD as TB,jE as MB,aj as OB,ai as DB,jF as Mm,dz as RB,dB as Om,ff as wc,jG as vc,jH as kc,bw as jn,jI as PB,eO as ra,fc as hn,bk as w4,dW as $t,jJ as LB,eg as FB,ag as Dm,jK as sa,jL as Sc,jM as zB,jN as BB,jO as v4,jP as on,aX as UB,at as Rm,ge as k4,en as Cc,jQ as VB,gA as Pm,bj as Nc,jR as Lm,ah as $B,jS as HB,as as ia,eE as S4,bn as WB,jT as qB,jU as C4,gK as GB,gI as YB,gL as JB,gM as KB,jV as XB,dx as zo,jW as ZB,jX as jc,jY as Ps,q as Bo,o as et,fV as En,jZ as In,j_ as dt,j$ as Ls,k0 as Dt,ga as Jt,k1 as Fm,eq as eo,k2 as QB,k3 as eU,bh as N4,bi as j4,k4 as E4,k5 as tU,gC as Fs,k6 as Ec,be as Ic,gD as Ur,eV as zm,k7 as nU,k8 as oU,k9 as rU,ka as sU,kb as I4,kc as aa,kd as A4,ke as T4,kf as M4,kg as O4,kh as iU,ki as D4,kj as R4,eW as Ac,kk as aU,kl as P4,dy as lU,km as la,kn as ca,ko as Tc,kp as pr,kq as L4,kr as Uo,ks as zs,kt as Bm,ku as da,kv as Bs,kw as Um,kx as Vm,ky as F4,kz as Mc,kA as cU,a6 as ua,kB as ha,kC as dU,dS as Oc,kD as uU,kE as $m,kF as hU,kG as fU,kH as Dc,d$ as mU,kI as Hm,kJ as Us,kK as Rc,kL as Vs,fU as qn,g3 as Vo,fR as z4,cp as B4,kM as Wm,fD as U4,kN as qm,kO as V4,kP as fa,kQ as $4,kR as Pc,kS as Gm,kT as ma,kU as pa,kV as ga,kW as pU,fN as Lc,kX as Fc,kY as zc,ef as gU,fO as _U,kZ as bU,k_ as xU,k$ as yU,l0 as wU,u as vU,l1 as kU,l2 as SU,l3 as CU,fY as NU,l4 as gr,l5 as jU,l6 as H4,t as F,l7 as EU,l8 as IU,l9 as AU,la as TU,lb as MU,lc as OU,ld as DU,le as RU,lf as PU,lg as LU,lh as FU,li as zU,lj as BU,lk as UU,ll as VU,lm as $U,ln as HU,lo as WU,lp as qU,lq as GU,lr as YU,ls as JU,lt as KU,lu as XU,lv as ZU,lw as QU,lx as eV,ly as tV,lz as nV,lA as Ym,lB as Bc,lC as W4,lD as oV,lE as rV,lF as q4,lG as sV,lH as $s,lI as Gn,lJ as iV,lK as aV,lL as lV,lM as cV,lN as dV,lO as uV,lP as hV,lQ as fV,lR as mV,lS as pV,lT as _r,lU as gV,lV as _V,lW as bV,lX as xV,dY as yV,lY as wV,lZ as G4,e0 as vV,l_ as Uc,l$ as kV,m0 as SV,m1 as CV,m2 as NV,gN as br,m3 as Vc,m4 as jV,m5 as EV,m6 as Y4,m7 as Jm,gB as Hs,m8 as IV,m9 as AV,ma as TV,mb as MV,g1 as OV,bq as DV,_ as Km,mc as J4,md as RV,me as PV,mf as Xm,mg as Zm,mh as LV,mi as K4,mj as X4,mk as $c,fQ as FV,aa as Z4,dK as zV,ml as Q4,fp as Et,mm as _a,mn as Ws,mo as BV,mp as UV,mq as Qm,mr as VV,co as ep,ms as $V,V as xr,bg as eS,mt as HV,mu as WV,mv as qV,mw as Hc,mx as tS,dI as Wc,bs as nS,es as GV,my as YV,mz as oS,mA as JV,mB as KV,mC as rS,mD as sS,mE as qc,mF as XV,mG as iS,mH as ZV,mI as QV,mJ as aS,ab as Gc,mK as e$,bu as lS,mL as t$,eN as n$,mM as $o,mN as o$,ej as cS,mO as dS,eQ as uS,fH as Yc,mP as tp,mQ as hS,aT as np,ek as Jc,mR as fS,mS as r$,mT as s$,fo as i$,mU as a$,gs as l$,fv as c$,fz as op,gv as d$,bp as ba,mV as u$,mW as mS,mX as rp,mY as h$,mZ as f$,m_ as m$,ac as An,m$ as p$,n0 as g$,n1 as pS,fh as sp,dE as gS,n2 as _$,n3 as b$,n4 as x$,aN as y$,n5 as w$,n6 as v$,n7 as k$,n8 as S$,a8 as C$,n9 as Kc,a9 as N$,fd as j$,na as _S,fL as E$,nb as I$,gq as A$,nc as T$,nd as bS,ne as M$,nf as qs,ng as O$,nh as Xc,ni as D$,nj as R$,z as xS,nk as P$,dk as L$,nl as xa,nm as yS,nn as wS,no as vS,np as kS,nq as F$,C as SS,nr as z$,ns as B$,nt as U$,E as Vr,e$ as CS,bd as V$,bb as $$,nu as H$,nv as W$,Z as Zc,nw as q$,a0 as yr,dH as NS,nx as ip,ny as G$,dU as jS,nz as Y$,nA as ES,nB as J$,nC as IS,nD as K$,nE as X$,nF as AS,nG as TS,nH as MS,fb as OS,nI as Z$,nJ as Q$,nK as DS,nL as RS,nM as Qc,nN as PS,nO as LS,nP as eH,nQ as FS,nR as tH,nS as nH,nT as zS,nU as oH,nV as rH,nW as sH,nX as iH,nY as aH,nZ as lH,dR as cH,n_ as dH,n$ as uH,g2 as ap,o0 as hH,o1 as fH,o2 as mH,o3 as pH,o4 as gH,o5 as _H,o6 as bH,o7 as xH,o8 as yH,o9 as wH,oa as lp,ob as vH,fT as kH,oc as SH,od as CH,oe as NH,of as BS,og as jH,a5 as EH,oh as IH,Y as AH,eG as TH,gk as MH,oi as OH,oj as DH,gm as cp,gi as Gs,gn as $r,gj as Hr,go as dp,gp as up,ok as US,gl as RH,ol as VS,om as PH,on as $S,oo as wr,op as HS,gu as LH,oq as FH,or as zH,os as BH,ot as UH,ou as VH,ov as $H,ow as WS,ex as HH,ox as hp,av as ed,oy as qS,oz as GS,ax as YS,aw as WH,dQ as qH,__tla as GH}from"./index-DUfE3Ygv.js";import{b as Ys,A as YH,L as JS,g as JH,G as KH,o as KS,s as XH,k as ZH,B as XS,a as QH,M as eW,Y as tW,c as xn,u as ya,C as nW,S as oW,K as rW,d as sW,i as iW,e as ZS,f as aW,h as lW,j as wa,P as va,l as QS,m as cW,n as dW,p as uW,q as hW,r as eC,t as fp,T as fW}from"./links-BNNDBIJj.js";import{V as tC,d as Wr,I as mp,N as nC,S as oC,e as rC,f as sC,L as iC,g as aC,F as lC,M as mW,l as cC,h as pW,j as po,k as td,E as pp,m as nd,i as gW,n as _W,o as gp,p as _p,q as bW,s as xW,t as yW,v as wW,w as vW,x as kW,y as SW,z as CW,a as NW,C as jW,R as dC,A as EW,b as IW,T as AW,B as TW,D as MW,G as OW,H as DW,O as RW,c as PW,P as LW,__tla as FW}from"./storage-lmv2DjR1.js";import{c as zW}from"./_createAggregator-DYHbrJKw.js";import{s as to,i as vr,T as bp,a as xp}from"./transform-CDNfLgV5.js";import{g as uC}from"./timer-Bqd5yn_a.js";import{i as BW}from"./zoom-COrs4lFh.js";import{s as ka}from"./sortBy-DvcUtmWI.js";let yp,od,yn,rd,hC,Sa,UW=Promise.all([(()=>{try{return GH}catch{}})(),(()=>{try{return FW}catch{}})()]).then(async()=>{var oc,U3;var Bt=zW(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});let It,fn,wp,sd,Js,qr,vp,kp,Sp,Cp,Ca,id,Np,Na,jp,ad,Ep,Ip,ld,Ap,Tp,Mp,ja,Op,cd,Dp,Rp,Pp,Lp,Fp,zp,dd,Bp,ud,hd,Up,Vp,$p,Hp,Wp,Ea,qp,Gp,fd,Yp,Jp,Kp,md,Xp,Zp,Qp,Ia,pd,gd,eg,tg,ng,og,rg,sg,ig,ag,lg,_d,bd,cg,dg,ug,Aa,wn,vn;It=De("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),fn=De("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"}]]),wp=De("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"}]]),sd=De("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),Js=De("ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]),qr=De("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"}]]),vp=De("chevrons-down",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),kp=De("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),rd=De("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),Sp=De("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),Cp=De("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Ca=De("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),id=De("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"}]]),Np=De("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"}]]),Na=De("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"}]]),jp=De("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]),ad=De("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"}]]),Ep=De("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"}]]),Ip=De("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"}]]),ld=De("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"}]]),Ap=De("eraser",[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]]),Tp=De("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"}]]),Mp=De("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"}]]),ja=De("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"}]]),Op=De("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"}]]),cd=De("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"}]]),Dp=De("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"}]]),Rp=De("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"}]]),Pp=De("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"}]]),Lp=De("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"}]]),Fp=De("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"}]]),zp=De("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"}]]),dd=De("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"}]]),Bp=De("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"}]]),ud=De("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"}]]),hd=De("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"}]]),Up=De("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"}]]),Vp=De("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"}]]),$p=De("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"}]]),Hp=De("message-circle-question-mark",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),Wp=De("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"}]]),Ea=De("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"}]]),qp=De("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"}]]),Gp=De("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"}]]),fd=De("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"}]]),Yp=De("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Jp=De("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"}]]),Kp=De("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"}]]),md=De("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"}]]),Xp=De("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"}]]),Zp=De("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"}]]),Qp=De("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"}]]),Ia=De("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"}]]),pd=De("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"}]]),gd=De("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"}]]),eg=De("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"}]]),tg=De("square-code",[["path",{d:"m10 9-3 3 3 3",key:"1oro0q"}],["path",{d:"m14 15 3-3-3-3",key:"bz13h7"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),ng=De("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"}]]),og=De("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"}]]),rg=De("square-m",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8l4 4 4-4v8",key:"141u4e"}]]),sg=De("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"}]]),ig=De("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"}]]),ag=De("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"}]]),lg=De("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"}]]),_d=De("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"}]]),bd=De("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"}]]),cg=De("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),dg=De("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"}]]),ug=De("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"}]]),Aa=De("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"}]]),wn=De("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"}]]),vn=De("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 fC=O.createContext({}),mC=O.forwardRef(function(t,e){[t,e]=rB(t,e,fC);let{toolbarProps:n}=function(s,i){const{"aria-label":a,"aria-labelledby":l,orientation:d="horizontal"}=s;let[u,h]=O.useState(!1);tB(()=>{var p;h(!(!i.current||!(!((p=i.current.parentElement)===null||p===void 0)&&p.closest('[role="toolbar"]'))))});const{direction:f}=nB(),m=f==="rtl"&&d==="horizontal";let _=oB(i);const g=O.useRef(null);return{toolbarProps:{...G3(s,{labelable:!0}),role:u?"group":"toolbar","aria-orientation":d,"aria-label":a,"aria-labelledby":a==null?l:void 0,onKeyDownCapture:u?void 0:p=>{if(p.currentTarget.contains(p.target)){if(d==="horizontal"&&p.key==="ArrowRight"||d==="vertical"&&p.key==="ArrowDown")m?_.focusPrevious():_.focusNext();else{if(!(d==="horizontal"&&p.key==="ArrowLeft"||d==="vertical"&&p.key==="ArrowUp"))return p.key==="Tab"?(p.stopPropagation(),g.current=document.activeElement,void(p.shiftKey?_.focusFirst():_.focusLast())):void 0;m?_.focusNext():_.focusPrevious()}p.stopPropagation(),p.preventDefault()}},onFocusCapture:u?void 0:p=>{var b,x;g.current&&!p.currentTarget.contains(p.relatedTarget)&&(!((b=i.current)===null||b===void 0)&&b.contains(p.target))&&((x=g.current)===null||x===void 0||x.focus(),g.current=null)},onBlurCapture:u?void 0:p=>{p.currentTarget.contains(p.relatedTarget)||g.current||(g.current=p.target)}}}}(t,e),o=sB({...t,values:{orientation:t.orientation||"horizontal"},defaultClassName:"react-aria-Toolbar"}),r=G3(t);return delete r.id,X.createElement("div",{...pm(n,r),...o,ref:e,slot:t.slot||void 0,"data-orientation":t.orientation||"horizontal"},o.children)});function Ta(t,e){const n=+Pr(t)-+Pr(e);return n<0?-1:n>0?1:n}function pC(t,e){const n=Pr(t,e==null?void 0:e.in);return+function(o,r){const s=Pr(o,r==null?void 0:r.in);return s.setHours(23,59,59,999),s}(n,e)==+function(o,r){const s=Pr(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 gC(t,e,n){const[o,r,s]=gm(n==null?void 0:n.in,t,t,e),i=Ta(r,s),a=Math.abs(function(u,h,f){const[m,_]=gm(f==null?void 0:f.in,u,h);return 12*(m.getFullYear()-_.getFullYear())+(m.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=Ta(r,s)===-i;pC(o)&&a===1&&Ta(o,s)===1&&(l=!1);const d=i*(a-+l);return d===0?0:d}function _C(t,e,n){const o=function(r,s){return+Pr(r)-+Pr(s)}(t,e)/1e3;return(r=>{const s=(0,Math.trunc)(r);return s===0?0:s})(o)}function bC(t,e){return function(n,o,r){const s=aB(),i=(r==null?void 0:r.locale)??s.locale??lB,a=Ta(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}),[d,u]=gm(r==null?void 0:r.in,...a>0?[o,n]:[n,o]),h=_C(u,d),f=(Y3(u)-Y3(d))/1e3,m=Math.round((h-f)/60);let _;if(m<2)return m===0?i.formatDistance("lessThanXMinutes",1,l):i.formatDistance("xMinutes",m,l);if(m<45)return i.formatDistance("xMinutes",m,l);if(m<90)return i.formatDistance("aboutXHours",1,l);if(m<J3){const g=Math.round(m/60);return i.formatDistance("aboutXHours",g,l)}if(m<2520)return i.formatDistance("xDays",1,l);if(m<rc){const g=Math.round(m/J3);return i.formatDistance("xDays",g,l)}if(m<2*rc)return _=Math.round(m/rc),i.formatDistance("aboutXMonths",_,l);if(_=gC(u,d),_<12){const g=Math.round(m/rc);return i.formatDistance("xMonths",g,l)}{const g=_%12,p=Math.trunc(_/12);return g<3?i.formatDistance("aboutXYears",p,l):g<9?i.formatDistance("overXYears",p,l):i.formatDistance("almostXYears",p+1,l)}}(t,function(n){return iB(n,Date.now())}(t),e)}const Ma="https://static.marimo.app",xC=t=>{const e=K.c(24),{onClose:n}=t,[o,r]=O.useState("");let s;s=Math.random().toString(36).slice(2,6);const i=`${o}-${s}`,a=`${Ma}/static/${i}`;let l,d,u,h,f,m,_,g,p,b,x;return e[0]!==n||e[1]!==i?(l=async y=>{y.preventDefault(),n();const v=await cB({download:!1,includeCode:!0,files:tC.INSTANCE.filenames()}),C=nt({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${Ma}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:v,path:i})}).catch(()=>{C.dismiss(),nt({title:"Error uploading static page",description:c.jsxs("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",c.jsx("a",{href:Zn.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),C.dismiss(),nt({title:"Static page uploaded!",description:c.jsxs("div",{children:["The URL has been copied to your clipboard.",c.jsx("br",{}),"You can share it with anyone."]})})},e[0]=n,e[1]=i,e[2]=l):l=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(sr,{children:"Share static notebook"}),e[3]=d):d=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsxs(Ts,{children:[d,c.jsxs(Ms,{children:["You can publish a static, non-interactive version of this notebook to the public web. We will create a link for you that lives on"," ",c.jsx("a",{href:Ma,target:"_blank",children:Ma}),"."]})]}),e[4]=u):u=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(h=y=>{const v=y.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,"");r(v)},e[5]=h):h=e[5],e[6]!==o?(f=c.jsx(ir,{"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?(m=c.jsxs("div",{className:"font-semibold text-sm text-muted-foreground gap-2 flex flex-col",children:["Anyone will be able to access your notebook at this URL:",c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(yC,{text:a}),c.jsx("span",{className:"text-primary",children:a})]})]}),e[8]=a,e[9]=m):m=e[9],e[10]!==f||e[11]!==m?(_=c.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[f,m]}),e[10]=f,e[11]=m,e[12]=_):_=e[12],e[13]!==n?(g=c.jsx(Ae,{"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?(p=c.jsx(Ae,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await _n(a)},children:"Create"}),e[15]=a,e[16]=p):p=e[16],e[17]!==p||e[18]!==g?(b=c.jsxs(Ki,{children:[g,p]}),e[17]=p,e[18]=g,e[19]=b):b=e[19],e[20]!==b||e[21]!==l||e[22]!==_?(x=c.jsx(ar,{className:"w-fit",children:c.jsxs("form",{onSubmit:l,children:[u,_,b]})}),e[20]=b,e[21]=l,e[22]=_,e[23]=x):x=e[23],x},yC=t=>{const e=K.c(8),[n,o]=X.useState(!1);let r;e[0]!==t.text?(r=Qn.stopPropagation(async d=>{d.preventDefault(),await _n(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=c.jsx(Xi,{size:14,strokeWidth:1.5}),e[2]=i):i=e[2],e[3]!==s?(a=c.jsx(Ae,{"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=c.jsx(Te,{content:"Copied!",open:n,children:a}),e[5]=n,e[6]=a,e[7]=l):l=e[7],l};function hg(){const t=K.c(2),e=Ot(_m);let n;return t[0]!==e?(n=()=>{const o=document.getElementsByClassName("output-area"),r=window.innerHeight||document.documentElement.clientHeight;let 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=bm.parse(i.parentNode.id);break}}e(i=>({mode:dB(i.mode),cellAnchor:s})),requestAnimationFrame(()=>{var i;s!==null&&((i=document.getElementById(bm.create(s)))==null||i.scrollIntoView())})},t[0]=e,t[1]=n):n=t[1],n}function xd(t){const e=K.c(3),n=Ks();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],qe(o)}function fg(){const t=K.c(2),e=Ks();let n;return t[0]!==e?(n=()=>e(K3(Nn())),t[0]=e,t[1]=n):n=t[1],qe(n)}function Ks(){const t=K.c(2),{prepareForRun:e}=bt();let n;return t[0]!==e?(n=async o=>{var a,l;if(o.length===0)return;const{cellHandles:r,cellData:s}=Nn(),i=[];for(const d of o){const u=r[d],h=(a=u==null?void 0:u.current)==null?void 0:a.editorView;let f;h?(X3(h)!=="markdown"&&xm(h),f=Z3(h)):f=((l=s[d])==null?void 0:l.code)||"",i.push(f),e({cellId:d})}await hB({cellIds:o,codes:i}).catch(wC)},t[0]=e,t[1]=n):n=t[1],qe(n)}function wC(t){vt.error(t)}const yd=[{type:"files",Icon:Dp,tooltip:"View files",position:"sidebar"},{type:"variables",Icon:sc,tooltip:"Explore variables",position:"sidebar"},{type:"datasources",Icon:lr,tooltip:"Explore data sources",position:"sidebar"},{type:"dependencies",Icon:Ea,tooltip:"Explore dependencies",position:"sidebar"},{type:"packages",Icon:Ys,tooltip:"Manage packages",position:"sidebar"},{type:"outline",Icon:gd,tooltip:"View outline",position:"sidebar"},{type:"chat",Icon:ic,tooltip:"Chat with AI",position:"sidebar"},{type:"documentation",Icon:_d,tooltip:"View live docs",position:"sidebar"},{type:"logs",Icon:ym,tooltip:"Notebook logs",position:"sidebar"},{type:"tracing",Icon:YH,tooltip:"Tracing",position:"sidebar"},{type:"snippets",Icon:ng,tooltip:"Snippets",position:"sidebar"},{type:"secrets",Icon:zp,tooltip:"Secrets",hidden:un(),position:"sidebar"},{type:"scratchpad",Icon:fB,tooltip:"Scratchpad",position:"sidebar"},{type:"errors",Icon:Zi,tooltip:"View errors",position:"footer"}];function vC(){const t=K.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=K.c(11);let d;l[0]!==a?(d=new mB(a),l[0]=a,l[1]=d):d=l[1];const u=d;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,m]=O.useState(h);let _;l[5]!==i||l[6]!==u?(_=b=>{m(b),u.set(i,b)},l[5]=i,l[6]=u,l[7]=_):_=l[7];const g=_;let p;return l[8]!==g||l[9]!==f?(p=[f,g],l[8]=g,l[9]=f,l[10]=p):p=l[10],p}("marimo:commands",e);let r,s;return t[1]!==n||t[2]!==o?(r=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 mg(t){return t.dropdown!==void 0}function Oa(t,e=""){return t.flatMap(n=>n.label?mg(n)?Oa(n.dropdown,`${e+n.label} > `):{...n,label:e+n.label}:[])}const Xs=t=>{const e=K.c(8),{children:n,layerTop:o}=t,r=o!==void 0&&o;let s;e[0]!==n?(s=X.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 d,u;return e[2]!==a||e[3]!==l?(d=c.jsx("div",{className:l,children:a}),e[2]=a,e[3]=l,e[4]=d):d=e[4],e[5]!==i||e[6]!==d?(u=c.jsxs("div",{className:"multi-icon relative w-fit",children:[i,d]}),e[5]=i,e[6]=d,e[7]=u):u=e[7],u},Zs=zt(null),kC=zt(!1),wd=t4("marimo:ai:chatState:v3",{chats:[],activeChatId:null}),SC=zt(t=>{const e=t(wd);return e.chats.find(n=>n.id===e.activeChatId)},(t,e,n)=>{e(wd,o=>({...o,activeChatId:n}))});function pg(t){return t!==n4&&!!(t&&t.trim().length>0)}const Da=t=>{const e=K.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],ac(window,"keydown",n,o);const r=t.children??"Undo";let s,i;return e[3]===Symbol.for("react.memo_cache_sentinel")?(s=c.jsx(pB,{className:"ml-2",shortcut:"cmd-z"}),e[3]=s):s=e[3],e[4]!==r||e[5]!==t?(i=c.jsxs(Ae,{"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 vd(){const t=K.c(3),{deleteCell:e,undoDeleteCell:n}=bt();let o;return t[0]!==e||t[1]!==n?(o=r=>{var l;if(at.get(lc))return;const{cellId:s}=r,i=at.get(cr),a=(((l=i.cellData[s])==null?void 0:l.code)??"").trim()==="";if(e({cellId:s}),o4({cellId:s}).catch(()=>{n()}),!a){const{dismiss:d}=nt({title:"Cell deleted",description:"You can bring it back by clicking undo or through the command palette.",action:c.jsx(Da,{"data-testid":"undo-delete-button",onClick:()=>{n(),u()}})}),u=d}},t[0]=e,t[1]=n,t[2]=o):o=t[2],qe(o)}function gg(){const t=K.c(3),{splitCell:e,undoSplitCell:n}=bt();let o;return t[0]!==e||t[1]!==n?(o=r=>{const s=Qi(r.cellId);if(!s)return;const i=Z3(s);e(r);const{dismiss:a}=nt({title:"Cell split",action:c.jsx(Da,{"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],qe(o)}function kd(t){const e=K.c(49),{cell:n}=t,{createNewCell:o,updateCellConfig:r,updateCellName:s,moveCell:i,sendToTop:a,sendToBottom:l,addColumnBreakpoint:d,clearCellOutput:u}=bt(),h=gg(),f=xd(n==null?void 0:n.cellId),m=!Le(lc),_=vd(),{openModal:g}=$n(),p=Ot(Zs),b=Le(cc),x=Le(dc),y=Le(Os),v=Le(gB);if(!n||y){let I;return e[0]===Symbol.for("react.memo_cache_sentinel")?(I=[],e[0]=I):I=e[0],I}const{cellId:C,config:S,getEditorView:E,name:N,hasOutput:j,hasConsoleOutput:T,status:A}=n;let M;e[1]!==C||e[2]!==S.disabled||e[3]!==r?(M=async()=>{const I={disabled:!S.disabled};await ur({configs:{[C]:I}}),r({cellId:C,config:I})},e[1]=C,e[2]=S.disabled,e[3]=r,e[4]=M):M=e[4];const P=M;let R;e[5]!==C||e[6]!==S.hide_code||e[7]!==E||e[8]!==r?(R=async()=>{const I={hide_code:!S.hide_code};await ur({configs:{[C]:I}}),r({cellId:C,config:I});const W=E();W&&(I.hide_code?W.contentDOM.blur():W.focus())},e[5]=C,e[6]=S.hide_code,e[7]=E,e[8]=r,e[9]=R):R=e[9];const L=R;let B,U,D,k,$;return e[10]===Symbol.for("react.memo_cache_sentinel")?(B=c.jsx(lg,{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(c.jsxs(ar,{children:[c.jsx(Ts,{children:c.jsx(sr,{children:"Rename cell"})}),c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx(Fr,{htmlFor:"cell-name",children:"Cell name"}),c.jsx(nC,{placeholder:"cell name",value:N,onKeyDown:I=>{I.key==="Enter"&&(I.preventDefault(),I.stopPropagation(),g(null))},onChange:I=>s({cellId:C,name:I})})]})]}))},e[11]=C,e[12]=N,e[13]=g,e[14]=s,e[15]=U):U=e[15],e[16]!==C||e[17]!==s?(D=I=>s({cellId:C,name:I}),e[16]=C,e[17]=s,e[18]=D):D=e[18],e[19]!==N||e[20]!==D?(k=c.jsx(nC,{placeholder:"cell name",value:N,onChange:D}),e[19]=N,e[20]=D,e[21]=k):k=e[21],e[22]!==d||e[23]!==b||e[24]!==v||e[25]!==x||e[26]!==m||e[27]!==C||e[28]!==u||e[29]!==S.disabled||e[30]!==S.hide_code||e[31]!==o||e[32]!==_||e[33]!==E||e[34]!==T||e[35]!==j||e[36]!==i||e[37]!==N||e[38]!==f||e[39]!==l||e[40]!==a||e[41]!==p||e[42]!==h||e[43]!==A||e[44]!==U||e[45]!==k||e[46]!==P||e[47]!==L?($=[[{icon:B,label:"Name",disableClick:!0,handle:EC,handleHeadless:U,rightElement:k},{icon:c.jsx(Wr,{size:13,strokeWidth:1.5}),label:"Run cell",hotkey:"cell.run",hidden:A==="running"||A==="queued"||A==="disabled-transitively"||S.disabled,handle:()=>f()},{icon:c.jsx(ea,{size:13,strokeWidth:1.5}),label:"AI completion",hidden:!b,handle:()=>{p(I=>(I==null?void 0:I.cellId)===C?null:{cellId:C})},hotkey:"cell.aiCompletion"},{icon:c.jsx(pd,{size:13,strokeWidth:1.5}),label:"Split cell",hotkey:"cell.splitCell",handle:()=>h({cellId:C})},{icon:c.jsx(mp,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!j,handle:()=>function(I){const W=document.getElementById(Q3.create(I));W&&(W.classList.add("printing-output"),e4(W,"result.png").finally(()=>{W.classList.remove("printing-output")}))}(C)},{icon:c.jsx(s4,{size:13,strokeWidth:1.5}),label:"Format cell",hotkey:"cell.format",handle:()=>{const I=E();I&&r4({[C]:I})}},{icon:S.hide_code?c.jsx(wm,{size:13,strokeWidth:1.5}):c.jsx(vm,{size:13,strokeWidth:1.5}),label:S.hide_code?"Show code":"Hide code",handle:L,hotkey:"cell.hideCode"},{icon:S.disabled?c.jsx(wn,{size:13,strokeWidth:1.5}):c.jsx(vn,{size:13,strokeWidth:1.5}),label:"Reactive execution",rightElement:c.jsx(km,{"data-testid":"cell-disable-switch",checked:!S.disabled,size:"sm",onCheckedChange:P}),handle:P},{icon:c.jsx(Zi,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(j||T),handle:()=>{u({cellId:C})}}],[{icon:c.jsx(uc,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:()=>{const I=E();I&&(fo({autoInstantiate:x,createNewCell:o}),Lr(I,{language:"markdown",keepCodeAsIs:!1}))}},{icon:c.jsx(lr,{size:13,strokeWidth:1.5}),label:"Convert to SQL",handle:()=>{const I=E();I&&(fo({autoInstantiate:x,createNewCell:o}),Lr(I,{language:"markdown",keepCodeAsIs:!1}))}},{icon:c.jsx(hc,{}),label:"Toggle as Python",handle:()=>{const I=E();I&&(fo({autoInstantiate:x,createNewCell:o}),_B(I,"python",{force:!0}))}}],[{icon:c.jsxs(Xs,{children:[c.jsx(Ca,{size:13,strokeWidth:1.5}),c.jsx(Sm,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>o({cellId:C,before:!0})},{icon:c.jsxs(Xs,{children:[c.jsx(Ca,{size:13,strokeWidth:1.5}),c.jsx(dr,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>o({cellId:C,before:!1})},{icon:c.jsx(Sm,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>i({cellId:C,before:!0})},{icon:c.jsx(dr,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>i({cellId:C,before:!1})},{icon:c.jsx(i4,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>i({cellId:C,direction:"left"}),hidden:v!=="columns"},{icon:c.jsx(ta,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>i({cellId:C,direction:"right"}),hidden:v!=="columns"},{icon:c.jsx(kp,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>a({cellId:C,scroll:!1})},{icon:c.jsx(vp,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>l({cellId:C,scroll:!1})},{icon:c.jsx(bB,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",hidden:v!=="columns",handle:()=>d({cellId:C})}],[{icon:c.jsx(JS,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!pg(N),tooltip:pg(N)?void 0:"Only named cells can be linked to",handle:async()=>{await _n(function(I){const W=new URL(window.location.href);return W.hash=`scrollTo=${encodeURIComponent(I)}`,W.toString()}(N)),nt({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!m,variant:"danger",icon:c.jsx(fc,{size:13,strokeWidth:1.5}),handle:()=>{_({cellId:C})}}]].map(NC).filter(CC),e[22]=d,e[23]=b,e[24]=v,e[25]=x,e[26]=m,e[27]=C,e[28]=u,e[29]=S.disabled,e[30]=S.hide_code,e[31]=o,e[32]=_,e[33]=E,e[34]=T,e[35]=j,e[36]=i,e[37]=N,e[38]=f,e[39]=l,e[40]=a,e[41]=p,e[42]=h,e[43]=A,e[44]=U,e[45]=k,e[46]=P,e[47]=L,e[48]=$):$=e[48],$}function CC(t){return t.length>0}function NC(t){return t.filter(jC)}function jC(t){return!t.hidden}function EC(t){t==null||t.stopPropagation(),t==null||t.preventDefault()}function IC(t){return!t.hidden}const Sd=zt(!1),_g=()=>{const t=K.c(37),[e,n]=Qt(Sd),o=yB(),r=Le(wB),s=Le(mc);let i;t[0]!==r?(i={cell:r},t[0]=r,t[1]=i):i=t[1];let a=kd(i).flat();a=Oa(a);const l=function(){const D=K.c(73),[k,$]=zr(),[I,W]=a4();let G;D[0]!==$?(G=async Q=>{await Br({config:Q}).then(()=>{$(Q)})},D[0]=$,D[1]=G):G=D[1];const q=G;let Y;D[2]!==W?(Y=async Q=>{await xB({config:Q}).then(()=>{W(Q)})},D[2]=W,D[3]=Y):Y=D[3];const ee=Y;let oe;if(D[4]!==I||D[5]!==k||D[6]!==ee||D[7]!==q){let Q,me,fe,de,ue;D[9]!==I?(Q=Ve=>Ve!==I.width,D[9]=I,D[10]=Q):Q=D[10],D[11]!==I||D[12]!==ee?(me=Ve=>({label:`App config > Set width=${Ve}`,handle:()=>{ee({...I,width:Ve})}}),D[11]=I,D[12]=ee,D[13]=me):me=D[13],D[14]!==k||D[15]!==q?(fe={label:"Config > Set theme: dark",handle:()=>{q({...k,display:{...k.display,theme:"dark"}})}},D[14]=k,D[15]=q,D[16]=fe):fe=D[16],D[17]!==k||D[18]!==q?(de={label:"Config > Set theme: light",handle:()=>{q({...k,display:{...k.display,theme:"light"}})}},D[17]=k,D[18]=q,D[19]=de):de=D[19],D[20]!==k||D[21]!==q?(ue={label:"Config > Set theme: system",handle:()=>{q({...k,display:{...k.display,theme:"system"}})}},D[20]=k,D[21]=q,D[22]=ue):ue=D[22];const ce=k.keymap.preset==="vim";let ke,Se;D[23]!==k||D[24]!==q?(ke=()=>{q({...k,keymap:{...k.keymap,preset:"vim"}})},D[23]=k,D[24]=q,D[25]=ke):ke=D[25],D[26]!==ce||D[27]!==ke?(Se={label:"Config > Switch keymap to VIM",hidden:ce,handle:ke},D[26]=ce,D[27]=ke,D[28]=Se):Se=D[28];const ae=k.keymap.preset==="default";let Ce,_e,Ee;D[29]!==k||D[30]!==q?(Ce=()=>{q({...k,keymap:{...k.keymap,preset:"default"}})},D[29]=k,D[30]=q,D[31]=Ce):Ce=D[31],D[32]!==ae||D[33]!==Ce?(_e={label:"Config > Switch keymap to default (current: VIM)",hidden:ae,handle:Ce},D[32]=ae,D[33]=Ce,D[34]=_e):_e=D[34],D[35]!==k||D[36]!==q?(Ee=()=>{q({...k,completion:{...k.completion,copilot:!1}})},D[35]=k,D[36]=q,D[37]=Ee):Ee=D[37];const ze=k.completion.copilot!=="github";let Oe,He;D[38]!==Ee||D[39]!==ze?(Oe={label:"Config > Disable GitHub Copilot",handle:Ee,hidden:ze},D[38]=Ee,D[39]=ze,D[40]=Oe):Oe=D[40],D[41]!==k||D[42]!==q?(He=()=>{q({...k,completion:{...k.completion,copilot:"github"}})},D[41]=k,D[42]=q,D[43]=He):He=D[43];const Fe=k.completion.copilot==="github";let it;D[44]!==He||D[45]!==Fe?(it={label:"Config > Enable GitHub Copilot",handle:He,hidden:Fe},D[44]=He,D[45]=Fe,D[46]=it):it=D[46];const Qe=!k.display.reference_highlighting;let tt,ne,ve,je;D[47]!==k||D[48]!==q?(tt=()=>{q({...k,display:{...k.display,reference_highlighting:!1}})},D[47]=k,D[48]=q,D[49]=tt):tt=D[49],D[50]!==Qe||D[51]!==tt?(ne={label:"Config > Disable reference highlighting",hidden:Qe,handle:tt},D[50]=Qe,D[51]=tt,D[52]=ne):ne=D[52],D[53]!==k||D[54]!==q?(ve=()=>{q({...k,display:{...k.display,reference_highlighting:!0}})},D[53]=k,D[54]=q,D[55]=ve):ve=D[55],D[56]!==k.display.reference_highlighting||D[57]!==ve?(je={label:"Config > Enable reference highlighting",hidden:k.display.reference_highlighting,handle:ve},D[56]=k.display.reference_highlighting,D[57]=ve,D[58]=je):je=D[58];const Re=k.display.cell_output==="above";let J,se;D[59]!==k||D[60]!==q?(J=()=>{q({...k,display:{...k.display,cell_output:"above"}})},D[59]=k,D[60]=q,D[61]=J):J=D[61],D[62]!==Re||D[63]!==J?(se={label:"Config > Set cell output area: above",hidden:Re,handle:J},D[62]=Re,D[63]=J,D[64]=se):se=D[64];const ge=k.display.cell_output==="below";let pe,xe;D[65]!==k||D[66]!==q?(pe=()=>{q({...k,display:{...k.display,cell_output:"below"}})},D[65]=k,D[66]=q,D[67]=pe):pe=D[67],D[68]!==ge||D[69]!==pe?(xe={label:"Config > Set cell output area: below",hidden:ge,handle:pe},D[68]=ge,D[69]=pe,D[70]=xe):xe=D[70],oe=[...JH().filter(Q).map(me),fe,de,ue,Se,_e,Oe,it,ne,je,se,xe],D[4]=I,D[5]=k,D[6]=ee,D[7]=q,D[8]=oe}else oe=D[8];const ie=oe;let Z;return D[71]!==ie?(Z=ie.filter(IC),D[71]=ie,D[72]=Z):Z=D[72],Z}();let d=Gg();d=[...Oa(d),...Oa(l)];const u=d.filter(AC),h=pc.keyBy(u,TC),{recentCommands:f,addRecentCommand:m}=vC();let _;t[2]!==f?(_=new Set(f),t[2]=f,t[3]=_):_=t[3];const g=_;let p,b;t[4]!==s||t[5]!==n?(p=D=>{jm(s.getHotkey("global.commandPalette").key)(D)&&(D.preventDefault(),n(MC))},t[4]=s,t[5]=n,t[6]=p):p=t[6],ac(document,"keydown",p),t[7]!==m||t[8]!==s||t[9]!==o||t[10]!==n?(b=(D,k)=>{const $=o[D];if(!$)return null;const I=s.getHotkey(D);return c.jsxs(mo,{disabled:k.disabled,onSelect:()=>{m(D),n(!1),requestAnimationFrame(()=>{$()})},value:I.name,children:[c.jsxs("span",{children:[I.name,k.tooltip&&c.jsx("span",{className:"ml-2",children:k.tooltip})]}),c.jsx(c4,{children:c.jsx(Em,{shortcut:I.key})})]},D)},t[7]=m,t[8]=s,t[9]=o,t[10]=n,t[11]=b):b=t[11];const x=b;let y;t[12]!==m||t[13]!==s||t[14]!==n?(y=D=>{const{label:k,handle:$,props:I,hotkey:W}=D,G=I===void 0?{}:I;return c.jsxs(mo,{disabled:G.disabled,onSelect:()=>{m(k),n(!1),requestAnimationFrame(()=>{$()})},value:k,children:[c.jsxs("span",{children:[k,G.tooltip&&c.jsxs("span",{className:"ml-2",children:["(",G.tooltip,")"]})]}),W&&c.jsx(c4,{children:c.jsx(Em,{shortcut:s.getHotkey(W).key})})]},k)},t[12]=m,t[13]=s,t[14]=n,t[15]=y):y=t[15];const v=y,C=kB;let S;t[16]===Symbol.for("react.memo_cache_sentinel")?(S=c.jsx(na,{placeholder:"Type to search..."}),t[16]=S):S=t[16];const E=Nm;let N;t[17]===Symbol.for("react.memo_cache_sentinel")?(N=c.jsx(gc,{children:"No results found."}),t[17]=N):N=t[17];const j=f.length>0&&c.jsxs(c.Fragment,{children:[c.jsx(Cm,{heading:"Recently Used",children:f.map(D=>{const k=h[D];return vB(D)?x(D,{disabled:k==null?void 0:k.disabled,tooltip:k==null?void 0:k.tooltip}):k&&!mg(k)?v({label:k.label,handle:k.handleHeadless||k.handle,props:{disabled:k.disabled,tooltip:k.tooltip}}):null})}),c.jsx(l4,{})]}),T=Cm,A=s.iterate().map(D=>{if(g.has(D))return null;const k=h[D];return x(D,{disabled:k==null?void 0:k.disabled,tooltip:k==null?void 0:k.tooltip})}),M=u.map(D=>g.has(D.label)?null:v({label:D.label,handle:D.handleHeadless||D.handle,props:{disabled:D.disabled,tooltip:D.tooltip}}));let P;t[18]!==g||t[19]!==v?(P=D=>g.has(D.label)?null:v({label:`Cell > ${D.label}`,handle:D.handleHeadless||D.handle,props:{disabled:D.disabled,tooltip:D.tooltip}}),t[18]=g,t[19]=v,t[20]=P):P=t[20];const R=a.map(P);let L,B,U;return t[21]!==T||t[22]!==M||t[23]!==R||t[24]!==A?(L=c.jsxs(T,{heading:"Commands",children:[A,M,R]}),t[21]=T,t[22]=M,t[23]=R,t[24]=A,t[25]=L):L=t[25],t[26]!==E||t[27]!==L||t[28]!==N||t[29]!==j?(B=c.jsxs(E,{children:[N,j,L]}),t[26]=E,t[27]=L,t[28]=N,t[29]=j,t[30]=B):B=t[30],t[31]!==C||t[32]!==e||t[33]!==n||t[34]!==B||t[35]!==S?(U=c.jsxs(C,{open:e,onOpenChange:n,children:[S,B]}),t[31]=C,t[32]=e,t[33]=n,t[34]=B,t[35]=S,t[36]=U):U=t[36],U};function AC(t){return!t.hotkey}function TC(t){return t.label}function MC(t){return!t}function kr(){return ht().optional().describe(Ge.of({label:"Password",inputType:"password",placeholder:"password",optionRegex:".*password.*"}))}function bg(){return ht().optional().describe(Ge.of({label:"Token",inputType:"password",placeholder:"token",optionRegex:".*token.*"}))}function Ra(){return ht().optional().describe(Ge.of({label:"Warehouse Name",placeholder:"warehouse",optionRegex:".*warehouse.*"}))}function xg(){return ht().optional().describe(Ge.of({label:"URI",optionRegex:".*uri.*"}))}function Sr(){return ht().nonempty().describe(Ge.of({label:"Host",placeholder:"localhost",optionRegex:".*host.*"}))}function go(){return ht().describe(Ge.of({label:"Database",placeholder:"db name",optionRegex:".*database.*"}))}function Cr(){return ht().nonempty().describe(Ge.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function Nr(t){const e=SB.string().describe(Ge.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 yg(){return Ds().default(!1).describe(Ge.of({label:"Read Only"}))}const wg=xt({type:kt("postgres"),host:Sr(),port:Nr(5432).optional(),database:go(),username:Cr(),password:kr(),ssl:Ds().default(!1).describe(Ge.of({label:"Use SSL"}))}).describe(Ge.of({direction:"two-columns"})),vg=xt({type:kt("mysql"),host:Sr(),port:Nr(3306),database:go(),username:Cr(),password:kr(),ssl:Ds().default(!1).describe(Ge.of({label:"Use SSL"}))}).describe(Ge.of({direction:"two-columns"})),kg=xt({type:kt("sqlite"),database:go().describe(Ge.of({label:"Database Path"}))}).describe(Ge.of({direction:"two-columns"})),Sg=xt({type:kt("duckdb"),database:go().describe(Ge.of({label:"Database Path"})),read_only:yg()}).describe(Ge.of({direction:"two-columns"})),Cg=xt({type:kt("motherduck"),database:go().default("my_db").describe(Ge.of({label:"Database Name"})),token:bg()}).describe(Ge.of({direction:"two-columns"})),Ng=xt({type:kt("snowflake"),account:ht().nonempty().describe(Ge.of({label:"Account",optionRegex:".*snowflake.*"})),warehouse:ht().optional().describe(Ge.of({label:"Warehouse",optionRegex:".*snowflake.*"})),database:go(),schema:ht().optional().describe(Ge.of({label:"Schema",optionRegex:".*snowflake.*"})),username:Cr(),password:kr(),role:ht().optional().describe(Ge.of({label:"Role"}))}).describe(Ge.of({direction:"two-columns"})),jg=xt({type:kt("bigquery"),project:ht().nonempty().describe(Ge.of({label:"Project ID",optionRegex:".*bigquery.*"})),dataset:ht().nonempty().describe(Ge.of({label:"Dataset",optionRegex:".*bigquery.*"})),credentials_json:ht().describe(Ge.of({label:"Credentials JSON",inputType:"textarea"}))}).describe(Ge.of({direction:"two-columns"})),Eg=xt({type:kt("clickhouse_connect"),host:Sr(),port:Nr(8123).optional(),username:Cr(),password:kr(),secure:Ds().default(!1).describe(Ge.of({label:"Use HTTPs"}))}).describe(Ge.of({direction:"two-columns"})),Ig=xt({type:kt("timeplus"),host:Sr().default("localhost"),port:Nr(8123).optional(),username:Cr().default("default"),password:kr().default("")}).describe(Ge.of({direction:"two-columns"})),Ag=xt({type:kt("chdb"),database:go().describe(Ge.of({label:"Database Path"})),read_only:yg()}).describe(Ge.of({direction:"two-columns"})),Tg=xt({type:kt("trino"),host:Sr(),port:Nr(8080),database:go(),schema:ht().describe(Ge.of({label:"Schema",placeholder:"schema name",optionRegex:".*schema.*"})).optional(),username:Cr(),password:kr(),async_support:Ds().default(!1).describe(Ge.of({label:"Async Support"}))}).describe(Ge.of({direction:"two-columns"})),Mg=xt({type:kt("iceberg"),name:ht().describe(Ge.of({label:"Catalog Name"})),catalog:Im("type",[xt({type:kt("REST"),warehouse:Ra(),uri:ht().optional().describe(Ge.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:bg()}),xt({type:kt("SQL"),warehouse:Ra(),uri:ht().optional().describe(Ge.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),xt({type:kt("Hive"),warehouse:Ra(),uri:xg()}),xt({type:kt("Glue"),warehouse:Ra(),uri:xg()}),xt({type:kt("DynamoDB"),"dynamodb.profile-name":ht().optional().describe(Ge.of({label:"Profile Name"})),"dynamodb.region":ht().optional().describe(Ge.of({label:"Region"})),"dynamodb.access-key-id":ht().optional().describe(Ge.of({label:"Access Key ID"})),"dynamodb.secret-access-key":ht().optional().describe(Ge.of({label:"Secret Access Key",inputType:"password"})),"dynamodb.session-token":ht().optional().describe(Ge.of({label:"Session Token",inputType:"password"}))})]).default({type:"REST"}).describe(Ge.of({special:"tabs"}))}),Og=xt({type:kt("datafusion"),sessionContext:Ds().optional().describe(Ge.of({label:"Use Session Context"}))}),Dg=xt({type:kt("pyspark"),host:Sr().optional(),port:Nr().optional()}),Rg=xt({type:kt("redshift"),host:Sr(),port:Nr(5439),connectionType:Im("type",[xt({type:kt("IAM credentials"),region:ht().describe(Ge.of({label:"Region"})),aws_access_key_id:ht().nonempty().describe(Ge.of({label:"AWS Access Key ID",inputType:"password",optionRegex:".*aws_access_key_id.*"})),aws_secret_access_key:ht().nonempty().describe(Ge.of({label:"AWS Secret Access Key",inputType:"password",optionRegex:".*aws_secret_access_key.*"})),aws_session_token:ht().optional().describe(Ge.of({label:"AWS Session Token",inputType:"password",optionRegex:".*aws_session_token.*"}))}),xt({type:kt("DB credentials"),user:Cr(),password:kr()})]).default({type:"IAM credentials",aws_access_key_id:"",aws_secret_access_key:"",region:""}),database:go()}).describe(Ge.of({direction:"two-columns"})),OC=Im("type",[wg,vg,kg,Sg,Cg,Ng,jg,Eg,Ig,Ag,Tg,Mg,Og,Dg,Rg]),Cd="env:";function Pa(t){return typeof t=="string"&&t.startsWith(Cd)}function Nd(t){return`${Cd}${t}`}const Pg={sqlmodel:"SQLModel",sqlalchemy:"SQLAlchemy",duckdb:"DuckDB",clickhouse_connect:"ClickHouse Connect",chdb:"chDB",pyiceberg:"PyIceberg",ibis:"Ibis",motherduck:"MotherDuck",redshift:"Redshift"};class rn{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),Pa(n)){const r=n.replace(Cd,""),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"?Gr(n):n?`"${n}"`:""}printInFString(e,n,o){if(n===void 0)return"";if(typeof n=="number")return`${n}`;if(typeof n=="boolean")return Gr(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 Pa(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-Z4QREdu3.js","./index-_lj65MZR.js","./index-CsdFJkJw.css","./compile-mbjlQ5nn.js","./time-BXb9z1yv.js","./timer-Bqd5yn_a.js","./linear-DtgEMbrz.js","./init-DLRA0X12.js","./range-CtcPcB_L.js","./zoom-COrs4lFh.js","./ordinal-DDUp3AbE.js","./colors-bszWmPJw.js","./step-BwsUM5iJ.js","./arc-ZB5pDULS.js","./index-BEQfoZiP.js","./storage-CTvz5ejZ.js","./index-CRY746sV.js","./index-ChVO1Vdj.js","./index-CE3mbf8H.js","./index-CfvA7bvb.js","./index-CylrdBnG.js","./index-Drq4Lpl3.js","./index-B0-K_sX8.js","./index-B9WlbtVk.js","./index-BWEPJWCF.js","./index-D_Dmmo5g.js","./index-NLK5-sPO.js","./index-1az6nvpO.js","./index-CaHkXpUp.js","./apl-CXdQSnD-.js","./asciiarmor-D5V0T9Cu.js","./asterisk-B46aRdXb.js","./brainfuck-CtZaYBKt.js","./clike-BgBwzOhw.js","./cmake-DXn5xaP-.js","./cobol-stawOqaz.js","./coffeescript-BTDxI-eT.js","./commonlisp-vq6DHwts.js","./crystal-CRzZ78HM.js","./cypher-gJDei3ni.js","./d-BShv7fp-.js","./diff-UJJ5BM9S.js","./dockerfile-knGOOxt4.js","./simple-mode-C3vEBAcb.js","./dtd-DI9Herc-.js","./dylan-DkEP81N9.js","./ebnf-B-Df8AvO.js","./ecl-DPFc0Uaf.js","./eiffel-DR5c0IrL.js","./elm-DompmV0j.js","./erlang-BuqgqA5h.js","./factor-CFXhaUWb.js","./fcl-CVaBTCzQ.js","./forth-POgR1ypr.js","./fortran-DL7KluxX.js","./gas-bV0CklSb.js","./gherkin-B6X1vGSW.js","./groovy-DnIzCrpZ.js","./haskell-CLQs6EAM.js","./haxe-D25e-2l-.js","./http-BKJkqRj4.js","./idl-pcmmZuaN.js","./jinja2-DhgKlfW7.js","./julia-DjdwvFuI.js","./livescript-HO6ttBFx.js","./lua-8DXOpKDz.js","./mathematica-IIbmv7SK.js","./mbox-z_N2Mo3d.js","./mirc-DkvFAiy5.js","./modelica-DSrSSXCg.js","./mscgen-B2igx18G.js","./mumps-zvxmGV4l.js","./nginx-B4hAVlXN.js","./nsis-BvKfQ9lQ.js","./ntriples-BSwWqoLa.js","./octave-C4hdQ5Hf.js","./oz-qQq7irPq.js","./pascal-CafrKXZF.js","./perl-tdMlh9QA.js","./pig-CwGJVRC4.js","./powershell-D1ly3AHC.js","./properties-_nPj978X.js","./protobuf-B4y9do6W.js","./puppet-Bc-yJKzi.js","./q-B0kTJ4cI.js","./r-BA4EbLKE.js","./ruby-CR-u2WLS.js","./sas-Bqaci40L.js","./scheme-qjP0V5Ag.js","./shell-BLav31RL.js","./sieve-r025o_jW.js","./smalltalk-C7J3IyEP.js","./solr-78MBEUkU.js","./sparql-BRLJFz69.js","./spreadsheet-CGlWr0eM.js","./stylus-Bdo_Aemu.js","./swift-B_XXVlXX.js","./tcl-B2fODqDH.js","./textile-BuVhTOzU.js","./tiddlywiki-BgR6AEZu.js","./tiki-CI-ztowC.js","./toml-wcPdHu67.js","./troff-Ce85hlLp.js","./ttcn-BxnYHtq8.js","./turtle-BkSuIpt-.js","./vb-BHgjm0DN.js","./vbscript-Dawdd5GZ.js","./velocity-BdD_26Jv.js","./verilog-B4LBqg_1.js","./vhdl-CWWH2SUo.js","./webidl-CGwyPRYs.js","./xquery-CVDBqZPY.js","./yacas-I8QjZlxf.js","./z80-D8p3gKXp.js","./trash-BWRVB_br.js","./storage-De8XnUVS.css","./links-Bjf-1I2i.js","./index-CH2sakSJ.js","./links-C1rhMrxo.css","./circle-play-CBftacWk.js","./_createAggregator-C_WhAECr.js","./_baseEach-BjDLzUwG.js","./transform-CDNfLgV5.js","./sortBy-Bob7dKSt.js","./_baseMap-CuZ-LBtv.js","./terminal-BkOhnp-S.js","./terminal-WqMRJt5Z.css"])))=>i.map(i=>d[i]);
2
+ var Zz=Object.defineProperty;var H3=Bt=>{throw TypeError(Bt)};var Qz=(Bt,It,fn)=>It in Bt?Zz(Bt,It,{enumerable:!0,configurable:!0,writable:!0,value:fn}):Bt[It]=fn;var te=(Bt,It,fn)=>Qz(Bt,typeof It!="symbol"?It+"":It,fn),eB=(Bt,It,fn)=>It.has(Bt)||H3("Cannot "+fn);var W3=(Bt,It,fn)=>(eB(Bt,It,"read from private field"),fn?fn.call(Bt):It.get(Bt)),q3=(Bt,It,fn)=>It.has(Bt)?H3("Cannot add the same private member more than once"):It instanceof WeakSet?It.add(Bt):It.set(Bt,fn);import{c as De,W as O,it as tB,iu as nB,iv as G3,iw as oB,ix as rB,iy as sB,b as X,iz as pm,iA as Pr,iB,iC as gm,iD as Y3,iE as aB,iF as lB,iG as J3,iH as rc,a as K,eD as cB,aq as nt,j as c,af as Zn,an as sr,am as Ts,ao as Ms,br as ir,ak as Ae,ap as _n,iI as Ki,al as ar,aR as Qn,ar as Xi,a1 as Te,X as Ot,dV as _m,eH as bm,iJ as dB,aM as qe,a7 as bt,iK as uB,eU as Nn,iL as K3,iM as X3,iN as xm,iO as Z3,iP as hB,L as vt,dC as sc,aY as lr,iQ as ic,a_ as ym,au as un,iR as fB,a4 as Zi,iS as mB,iT as Q3,eT as e4,U as zt,b4 as t4,iU as n4,cE as ac,iV as pB,dM as at,iW as lc,dT as cr,iX as o4,iY as Qi,T as Le,bc as $n,iZ as cc,i_ as dc,eK as Os,i$ as gB,j0 as ea,j1 as r4,eR as s4,j2 as wm,j3 as vm,em as km,j4 as fo,j5 as Lr,aW as uc,j6 as _B,j7 as hc,j8 as Sm,a2 as dr,ea as i4,a3 as ta,j9 as bB,ja as fc,jb as ur,bt as Fr,eL as zr,fr as a4,gb as Br,fG as xB,bf as Qt,jc as yB,jd as wB,g9 as mc,aO as pc,je as Cm,jf as vB,jg as l4,jh as Nm,ji as kB,jj as jm,jk as mo,jl as c4,gf as Em,jm as na,jn as gc,er as xt,et as Ds,jo as kt,jp as Ge,jq as ht,jr as Im,js as SB,jt as Am,ju as St,jv as d4,dw as _c,ds as bc,dt as xc,du as yc,dr as oa,jw as CB,fE as Tm,b3 as Hn,aI as Wn,fu as u4,fw as h4,fx as NB,fC as jB,fy as f4,jx as m4,$ as Ne,el as EB,aU as hr,b1 as fr,aV as mr,a$ as Vt,eS as bn,jy as p4,fA as g4,jz as IB,jA as AB,fs as _4,ft as b4,jB as Rs,dv as x4,jC as y4,jD as TB,jE as MB,aj as OB,ai as DB,jF as Mm,dz as RB,dB as Om,ff as wc,jG as vc,jH as kc,bw as jn,jI as PB,eO as ra,fc as hn,bk as w4,dW as $t,jJ as LB,eg as FB,ag as Dm,jK as sa,jL as Sc,jM as zB,jN as BB,jO as v4,jP as on,aX as UB,at as Rm,ge as k4,en as Cc,jQ as VB,gA as Pm,bj as Nc,jR as Lm,ah as $B,jS as HB,as as ia,eE as S4,bn as WB,jT as qB,jU as C4,gK as GB,gI as YB,gL as JB,gM as KB,jV as XB,dx as zo,jW as ZB,jX as jc,jY as Ps,q as Bo,o as et,fV as En,jZ as In,j_ as dt,j$ as Ls,k0 as Dt,ga as Jt,k1 as Fm,eq as eo,k2 as QB,k3 as eU,bh as N4,bi as j4,k4 as E4,k5 as tU,gC as Fs,k6 as Ec,be as Ic,gD as Ur,eV as zm,k7 as nU,k8 as oU,k9 as rU,ka as sU,kb as I4,kc as aa,kd as A4,ke as T4,kf as M4,kg as O4,kh as iU,ki as D4,kj as R4,eW as Ac,kk as aU,kl as P4,dy as lU,km as la,kn as ca,ko as Tc,kp as pr,kq as L4,kr as Uo,ks as zs,kt as Bm,ku as da,kv as Bs,kw as Um,kx as Vm,ky as F4,kz as Mc,kA as cU,a6 as ua,kB as ha,kC as dU,dS as Oc,kD as uU,kE as $m,kF as hU,kG as fU,kH as Dc,d$ as mU,kI as Hm,kJ as Us,kK as Rc,kL as Vs,fU as qn,g3 as Vo,fR as z4,cp as B4,kM as Wm,fD as U4,kN as qm,kO as V4,kP as fa,kQ as $4,kR as Pc,kS as Gm,kT as ma,kU as pa,kV as ga,kW as pU,fN as Lc,kX as Fc,kY as zc,ef as gU,fO as _U,kZ as bU,k_ as xU,k$ as yU,l0 as wU,u as vU,l1 as kU,l2 as SU,l3 as CU,fY as NU,l4 as gr,l5 as jU,l6 as H4,t as F,l7 as EU,l8 as IU,l9 as AU,la as TU,lb as MU,lc as OU,ld as DU,le as RU,lf as PU,lg as LU,lh as FU,li as zU,lj as BU,lk as UU,ll as VU,lm as $U,ln as HU,lo as WU,lp as qU,lq as GU,lr as YU,ls as JU,lt as KU,lu as XU,lv as ZU,lw as QU,lx as eV,ly as tV,lz as nV,lA as Ym,lB as Bc,lC as W4,lD as oV,lE as rV,lF as q4,lG as sV,lH as $s,lI as Gn,lJ as iV,lK as aV,lL as lV,lM as cV,lN as dV,lO as uV,lP as hV,lQ as fV,lR as mV,lS as pV,lT as _r,lU as gV,lV as _V,lW as bV,lX as xV,dY as yV,lY as wV,lZ as G4,e0 as vV,l_ as Uc,l$ as kV,m0 as SV,m1 as CV,m2 as NV,gN as br,m3 as Vc,m4 as jV,m5 as EV,m6 as Y4,m7 as Jm,gB as Hs,m8 as IV,m9 as AV,ma as TV,mb as MV,g1 as OV,bq as DV,_ as Km,mc as J4,md as RV,me as PV,mf as Xm,mg as Zm,mh as LV,mi as K4,mj as X4,mk as $c,fQ as FV,aa as Z4,dK as zV,ml as Q4,fp as Et,mm as _a,mn as Ws,mo as BV,mp as UV,mq as Qm,mr as VV,co as ep,ms as $V,V as xr,bg as eS,mt as HV,mu as WV,mv as qV,mw as Hc,mx as tS,dI as Wc,bs as nS,es as GV,my as YV,mz as oS,mA as JV,mB as KV,mC as rS,mD as sS,mE as qc,mF as XV,mG as iS,mH as ZV,mI as QV,mJ as aS,ab as Gc,mK as e$,bu as lS,mL as t$,eN as n$,mM as $o,mN as o$,ej as cS,mO as dS,eQ as uS,fH as Yc,mP as tp,mQ as hS,aT as np,ek as Jc,mR as fS,mS as r$,mT as s$,fo as i$,mU as a$,gs as l$,fv as c$,fz as op,gv as d$,bp as ba,mV as u$,mW as mS,mX as rp,mY as h$,mZ as f$,m_ as m$,ac as An,m$ as p$,n0 as g$,n1 as pS,fh as sp,dE as gS,n2 as _$,n3 as b$,n4 as x$,aN as y$,n5 as w$,n6 as v$,n7 as k$,n8 as S$,a8 as C$,n9 as Kc,a9 as N$,fd as j$,na as _S,fL as E$,nb as I$,gq as A$,nc as T$,nd as bS,ne as M$,nf as qs,ng as O$,nh as Xc,ni as D$,nj as R$,z as xS,nk as P$,dk as L$,nl as xa,nm as yS,nn as wS,no as vS,np as kS,nq as F$,C as SS,nr as z$,ns as B$,nt as U$,E as Vr,e$ as CS,bd as V$,bb as $$,nu as H$,nv as W$,Z as Zc,nw as q$,a0 as yr,dH as NS,nx as ip,ny as G$,dU as jS,nz as Y$,nA as ES,nB as J$,nC as IS,nD as K$,nE as X$,nF as AS,nG as TS,nH as MS,fb as OS,nI as Z$,nJ as Q$,nK as DS,nL as RS,nM as Qc,nN as PS,nO as LS,nP as eH,nQ as FS,nR as tH,nS as nH,nT as zS,nU as oH,nV as rH,nW as sH,nX as iH,nY as aH,nZ as lH,dR as cH,n_ as dH,n$ as uH,g2 as ap,o0 as hH,o1 as fH,o2 as mH,o3 as pH,o4 as gH,o5 as _H,o6 as bH,o7 as xH,o8 as yH,o9 as wH,oa as lp,ob as vH,fT as kH,oc as SH,od as CH,oe as NH,of as BS,og as jH,a5 as EH,oh as IH,Y as AH,eG as TH,gk as MH,oi as OH,oj as DH,gm as cp,gi as Gs,gn as $r,gj as Hr,go as dp,gp as up,ok as US,gl as RH,ol as VS,om as PH,on as $S,oo as wr,op as HS,gu as LH,oq as FH,or as zH,os as BH,ot as UH,ou as VH,ov as $H,ow as WS,ex as HH,ox as hp,av as ed,oy as qS,oz as GS,ax as YS,aw as WH,dQ as qH,__tla as GH}from"./index-_lj65MZR.js";import{b as Ys,A as YH,L as JS,g as JH,G as KH,o as KS,s as XH,k as ZH,B as XS,a as QH,M as eW,Y as tW,c as xn,u as ya,C as nW,S as oW,K as rW,d as sW,i as iW,e as ZS,f as aW,h as lW,j as wa,P as va,l as QS,m as cW,n as dW,p as uW,q as hW,r as eC,t as fp,T as fW}from"./links-Bjf-1I2i.js";import{V as tC,d as Wr,I as mp,N as nC,S as oC,e as rC,f as sC,L as iC,g as aC,F as lC,M as mW,l as cC,h as pW,j as po,k as td,E as pp,m as nd,i as gW,n as _W,o as gp,p as _p,q as bW,s as xW,t as yW,v as wW,w as vW,x as kW,y as SW,z as CW,a as NW,C as jW,R as dC,A as EW,b as IW,T as AW,B as TW,D as MW,G as OW,H as DW,O as RW,c as PW,P as LW,__tla as FW}from"./storage-CTvz5ejZ.js";import{c as zW}from"./_createAggregator-C_WhAECr.js";import{s as to,i as vr,T as bp,a as xp}from"./transform-CDNfLgV5.js";import{g as uC}from"./timer-Bqd5yn_a.js";import{i as BW}from"./zoom-COrs4lFh.js";import{s as ka}from"./sortBy-Bob7dKSt.js";let yp,od,yn,rd,hC,Sa,UW=Promise.all([(()=>{try{return GH}catch{}})(),(()=>{try{return FW}catch{}})()]).then(async()=>{var oc,U3;var Bt=zW(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});let It,fn,wp,sd,Js,qr,vp,kp,Sp,Cp,Ca,id,Np,Na,jp,ad,Ep,Ip,ld,Ap,Tp,Mp,ja,Op,cd,Dp,Rp,Pp,Lp,Fp,zp,dd,Bp,ud,hd,Up,Vp,$p,Hp,Wp,Ea,qp,Gp,fd,Yp,Jp,Kp,md,Xp,Zp,Qp,Ia,pd,gd,eg,tg,ng,og,rg,sg,ig,ag,lg,_d,bd,cg,dg,ug,Aa,wn,vn;It=De("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),fn=De("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"}]]),wp=De("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"}]]),sd=De("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),Js=De("ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]),qr=De("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"}]]),vp=De("chevrons-down",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),kp=De("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),rd=De("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),Sp=De("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),Cp=De("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Ca=De("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),id=De("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"}]]),Np=De("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"}]]),Na=De("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"}]]),jp=De("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]),ad=De("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"}]]),Ep=De("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"}]]),Ip=De("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"}]]),ld=De("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"}]]),Ap=De("eraser",[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]]),Tp=De("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"}]]),Mp=De("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"}]]),ja=De("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"}]]),Op=De("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"}]]),cd=De("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"}]]),Dp=De("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"}]]),Rp=De("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"}]]),Pp=De("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"}]]),Lp=De("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"}]]),Fp=De("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"}]]),zp=De("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"}]]),dd=De("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"}]]),Bp=De("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"}]]),ud=De("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"}]]),hd=De("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"}]]),Up=De("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"}]]),Vp=De("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"}]]),$p=De("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"}]]),Hp=De("message-circle-question-mark",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),Wp=De("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"}]]),Ea=De("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"}]]),qp=De("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"}]]),Gp=De("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"}]]),fd=De("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"}]]),Yp=De("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Jp=De("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"}]]),Kp=De("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"}]]),md=De("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"}]]),Xp=De("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"}]]),Zp=De("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"}]]),Qp=De("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"}]]),Ia=De("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"}]]),pd=De("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"}]]),gd=De("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"}]]),eg=De("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"}]]),tg=De("square-code",[["path",{d:"m10 9-3 3 3 3",key:"1oro0q"}],["path",{d:"m14 15 3-3-3-3",key:"bz13h7"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),ng=De("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"}]]),og=De("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"}]]),rg=De("square-m",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8l4 4 4-4v8",key:"141u4e"}]]),sg=De("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"}]]),ig=De("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"}]]),ag=De("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"}]]),lg=De("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"}]]),_d=De("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"}]]),bd=De("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"}]]),cg=De("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),dg=De("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"}]]),ug=De("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"}]]),Aa=De("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"}]]),wn=De("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"}]]),vn=De("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 fC=O.createContext({}),mC=O.forwardRef(function(t,e){[t,e]=rB(t,e,fC);let{toolbarProps:n}=function(s,i){const{"aria-label":a,"aria-labelledby":l,orientation:d="horizontal"}=s;let[u,h]=O.useState(!1);tB(()=>{var p;h(!(!i.current||!(!((p=i.current.parentElement)===null||p===void 0)&&p.closest('[role="toolbar"]'))))});const{direction:f}=nB(),m=f==="rtl"&&d==="horizontal";let _=oB(i);const g=O.useRef(null);return{toolbarProps:{...G3(s,{labelable:!0}),role:u?"group":"toolbar","aria-orientation":d,"aria-label":a,"aria-labelledby":a==null?l:void 0,onKeyDownCapture:u?void 0:p=>{if(p.currentTarget.contains(p.target)){if(d==="horizontal"&&p.key==="ArrowRight"||d==="vertical"&&p.key==="ArrowDown")m?_.focusPrevious():_.focusNext();else{if(!(d==="horizontal"&&p.key==="ArrowLeft"||d==="vertical"&&p.key==="ArrowUp"))return p.key==="Tab"?(p.stopPropagation(),g.current=document.activeElement,void(p.shiftKey?_.focusFirst():_.focusLast())):void 0;m?_.focusNext():_.focusPrevious()}p.stopPropagation(),p.preventDefault()}},onFocusCapture:u?void 0:p=>{var b,x;g.current&&!p.currentTarget.contains(p.relatedTarget)&&(!((b=i.current)===null||b===void 0)&&b.contains(p.target))&&((x=g.current)===null||x===void 0||x.focus(),g.current=null)},onBlurCapture:u?void 0:p=>{p.currentTarget.contains(p.relatedTarget)||g.current||(g.current=p.target)}}}}(t,e),o=sB({...t,values:{orientation:t.orientation||"horizontal"},defaultClassName:"react-aria-Toolbar"}),r=G3(t);return delete r.id,X.createElement("div",{...pm(n,r),...o,ref:e,slot:t.slot||void 0,"data-orientation":t.orientation||"horizontal"},o.children)});function Ta(t,e){const n=+Pr(t)-+Pr(e);return n<0?-1:n>0?1:n}function pC(t,e){const n=Pr(t,e==null?void 0:e.in);return+function(o,r){const s=Pr(o,r==null?void 0:r.in);return s.setHours(23,59,59,999),s}(n,e)==+function(o,r){const s=Pr(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 gC(t,e,n){const[o,r,s]=gm(n==null?void 0:n.in,t,t,e),i=Ta(r,s),a=Math.abs(function(u,h,f){const[m,_]=gm(f==null?void 0:f.in,u,h);return 12*(m.getFullYear()-_.getFullYear())+(m.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=Ta(r,s)===-i;pC(o)&&a===1&&Ta(o,s)===1&&(l=!1);const d=i*(a-+l);return d===0?0:d}function _C(t,e,n){const o=function(r,s){return+Pr(r)-+Pr(s)}(t,e)/1e3;return(r=>{const s=(0,Math.trunc)(r);return s===0?0:s})(o)}function bC(t,e){return function(n,o,r){const s=aB(),i=(r==null?void 0:r.locale)??s.locale??lB,a=Ta(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}),[d,u]=gm(r==null?void 0:r.in,...a>0?[o,n]:[n,o]),h=_C(u,d),f=(Y3(u)-Y3(d))/1e3,m=Math.round((h-f)/60);let _;if(m<2)return m===0?i.formatDistance("lessThanXMinutes",1,l):i.formatDistance("xMinutes",m,l);if(m<45)return i.formatDistance("xMinutes",m,l);if(m<90)return i.formatDistance("aboutXHours",1,l);if(m<J3){const g=Math.round(m/60);return i.formatDistance("aboutXHours",g,l)}if(m<2520)return i.formatDistance("xDays",1,l);if(m<rc){const g=Math.round(m/J3);return i.formatDistance("xDays",g,l)}if(m<2*rc)return _=Math.round(m/rc),i.formatDistance("aboutXMonths",_,l);if(_=gC(u,d),_<12){const g=Math.round(m/rc);return i.formatDistance("xMonths",g,l)}{const g=_%12,p=Math.trunc(_/12);return g<3?i.formatDistance("aboutXYears",p,l):g<9?i.formatDistance("overXYears",p,l):i.formatDistance("almostXYears",p+1,l)}}(t,function(n){return iB(n,Date.now())}(t),e)}const Ma="https://static.marimo.app",xC=t=>{const e=K.c(24),{onClose:n}=t,[o,r]=O.useState("");let s;s=Math.random().toString(36).slice(2,6);const i=`${o}-${s}`,a=`${Ma}/static/${i}`;let l,d,u,h,f,m,_,g,p,b,x;return e[0]!==n||e[1]!==i?(l=async y=>{y.preventDefault(),n();const v=await cB({download:!1,includeCode:!0,files:tC.INSTANCE.filenames()}),C=nt({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${Ma}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:v,path:i})}).catch(()=>{C.dismiss(),nt({title:"Error uploading static page",description:c.jsxs("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",c.jsx("a",{href:Zn.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),C.dismiss(),nt({title:"Static page uploaded!",description:c.jsxs("div",{children:["The URL has been copied to your clipboard.",c.jsx("br",{}),"You can share it with anyone."]})})},e[0]=n,e[1]=i,e[2]=l):l=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(sr,{children:"Share static notebook"}),e[3]=d):d=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsxs(Ts,{children:[d,c.jsxs(Ms,{children:["You can publish a static, non-interactive version of this notebook to the public web. We will create a link for you that lives on"," ",c.jsx("a",{href:Ma,target:"_blank",children:Ma}),"."]})]}),e[4]=u):u=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(h=y=>{const v=y.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,"");r(v)},e[5]=h):h=e[5],e[6]!==o?(f=c.jsx(ir,{"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?(m=c.jsxs("div",{className:"font-semibold text-sm text-muted-foreground gap-2 flex flex-col",children:["Anyone will be able to access your notebook at this URL:",c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(yC,{text:a}),c.jsx("span",{className:"text-primary",children:a})]})]}),e[8]=a,e[9]=m):m=e[9],e[10]!==f||e[11]!==m?(_=c.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[f,m]}),e[10]=f,e[11]=m,e[12]=_):_=e[12],e[13]!==n?(g=c.jsx(Ae,{"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?(p=c.jsx(Ae,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await _n(a)},children:"Create"}),e[15]=a,e[16]=p):p=e[16],e[17]!==p||e[18]!==g?(b=c.jsxs(Ki,{children:[g,p]}),e[17]=p,e[18]=g,e[19]=b):b=e[19],e[20]!==b||e[21]!==l||e[22]!==_?(x=c.jsx(ar,{className:"w-fit",children:c.jsxs("form",{onSubmit:l,children:[u,_,b]})}),e[20]=b,e[21]=l,e[22]=_,e[23]=x):x=e[23],x},yC=t=>{const e=K.c(8),[n,o]=X.useState(!1);let r;e[0]!==t.text?(r=Qn.stopPropagation(async d=>{d.preventDefault(),await _n(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=c.jsx(Xi,{size:14,strokeWidth:1.5}),e[2]=i):i=e[2],e[3]!==s?(a=c.jsx(Ae,{"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=c.jsx(Te,{content:"Copied!",open:n,children:a}),e[5]=n,e[6]=a,e[7]=l):l=e[7],l};function hg(){const t=K.c(2),e=Ot(_m);let n;return t[0]!==e?(n=()=>{const o=document.getElementsByClassName("output-area"),r=window.innerHeight||document.documentElement.clientHeight;let 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=bm.parse(i.parentNode.id);break}}e(i=>({mode:dB(i.mode),cellAnchor:s})),requestAnimationFrame(()=>{var i;s!==null&&((i=document.getElementById(bm.create(s)))==null||i.scrollIntoView())})},t[0]=e,t[1]=n):n=t[1],n}function xd(t){const e=K.c(3),n=Ks();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],qe(o)}function fg(){const t=K.c(2),e=Ks();let n;return t[0]!==e?(n=()=>e(K3(Nn())),t[0]=e,t[1]=n):n=t[1],qe(n)}function Ks(){const t=K.c(2),{prepareForRun:e}=bt();let n;return t[0]!==e?(n=async o=>{var a,l;if(o.length===0)return;const{cellHandles:r,cellData:s}=Nn(),i=[];for(const d of o){const u=r[d],h=(a=u==null?void 0:u.current)==null?void 0:a.editorView;let f;h?(X3(h)!=="markdown"&&xm(h),f=Z3(h)):f=((l=s[d])==null?void 0:l.code)||"",i.push(f),e({cellId:d})}await hB({cellIds:o,codes:i}).catch(wC)},t[0]=e,t[1]=n):n=t[1],qe(n)}function wC(t){vt.error(t)}const yd=[{type:"files",Icon:Dp,tooltip:"View files",position:"sidebar"},{type:"variables",Icon:sc,tooltip:"Explore variables",position:"sidebar"},{type:"datasources",Icon:lr,tooltip:"Explore data sources",position:"sidebar"},{type:"dependencies",Icon:Ea,tooltip:"Explore dependencies",position:"sidebar"},{type:"packages",Icon:Ys,tooltip:"Manage packages",position:"sidebar"},{type:"outline",Icon:gd,tooltip:"View outline",position:"sidebar"},{type:"chat",Icon:ic,tooltip:"Chat with AI",position:"sidebar"},{type:"documentation",Icon:_d,tooltip:"View live docs",position:"sidebar"},{type:"logs",Icon:ym,tooltip:"Notebook logs",position:"sidebar"},{type:"tracing",Icon:YH,tooltip:"Tracing",position:"sidebar"},{type:"snippets",Icon:ng,tooltip:"Snippets",position:"sidebar"},{type:"secrets",Icon:zp,tooltip:"Secrets",hidden:un(),position:"sidebar"},{type:"scratchpad",Icon:fB,tooltip:"Scratchpad",position:"sidebar"},{type:"errors",Icon:Zi,tooltip:"View errors",position:"footer"}];function vC(){const t=K.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=K.c(11);let d;l[0]!==a?(d=new mB(a),l[0]=a,l[1]=d):d=l[1];const u=d;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,m]=O.useState(h);let _;l[5]!==i||l[6]!==u?(_=b=>{m(b),u.set(i,b)},l[5]=i,l[6]=u,l[7]=_):_=l[7];const g=_;let p;return l[8]!==g||l[9]!==f?(p=[f,g],l[8]=g,l[9]=f,l[10]=p):p=l[10],p}("marimo:commands",e);let r,s;return t[1]!==n||t[2]!==o?(r=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 mg(t){return t.dropdown!==void 0}function Oa(t,e=""){return t.flatMap(n=>n.label?mg(n)?Oa(n.dropdown,`${e+n.label} > `):{...n,label:e+n.label}:[])}const Xs=t=>{const e=K.c(8),{children:n,layerTop:o}=t,r=o!==void 0&&o;let s;e[0]!==n?(s=X.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 d,u;return e[2]!==a||e[3]!==l?(d=c.jsx("div",{className:l,children:a}),e[2]=a,e[3]=l,e[4]=d):d=e[4],e[5]!==i||e[6]!==d?(u=c.jsxs("div",{className:"multi-icon relative w-fit",children:[i,d]}),e[5]=i,e[6]=d,e[7]=u):u=e[7],u},Zs=zt(null),kC=zt(!1),wd=t4("marimo:ai:chatState:v3",{chats:[],activeChatId:null}),SC=zt(t=>{const e=t(wd);return e.chats.find(n=>n.id===e.activeChatId)},(t,e,n)=>{e(wd,o=>({...o,activeChatId:n}))});function pg(t){return t!==n4&&!!(t&&t.trim().length>0)}const Da=t=>{const e=K.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],ac(window,"keydown",n,o);const r=t.children??"Undo";let s,i;return e[3]===Symbol.for("react.memo_cache_sentinel")?(s=c.jsx(pB,{className:"ml-2",shortcut:"cmd-z"}),e[3]=s):s=e[3],e[4]!==r||e[5]!==t?(i=c.jsxs(Ae,{"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 vd(){const t=K.c(3),{deleteCell:e,undoDeleteCell:n}=bt();let o;return t[0]!==e||t[1]!==n?(o=r=>{var l;if(at.get(lc))return;const{cellId:s}=r,i=at.get(cr),a=(((l=i.cellData[s])==null?void 0:l.code)??"").trim()==="";if(e({cellId:s}),o4({cellId:s}).catch(()=>{n()}),!a){const{dismiss:d}=nt({title:"Cell deleted",description:"You can bring it back by clicking undo or through the command palette.",action:c.jsx(Da,{"data-testid":"undo-delete-button",onClick:()=>{n(),u()}})}),u=d}},t[0]=e,t[1]=n,t[2]=o):o=t[2],qe(o)}function gg(){const t=K.c(3),{splitCell:e,undoSplitCell:n}=bt();let o;return t[0]!==e||t[1]!==n?(o=r=>{const s=Qi(r.cellId);if(!s)return;const i=Z3(s);e(r);const{dismiss:a}=nt({title:"Cell split",action:c.jsx(Da,{"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],qe(o)}function kd(t){const e=K.c(49),{cell:n}=t,{createNewCell:o,updateCellConfig:r,updateCellName:s,moveCell:i,sendToTop:a,sendToBottom:l,addColumnBreakpoint:d,clearCellOutput:u}=bt(),h=gg(),f=xd(n==null?void 0:n.cellId),m=!Le(lc),_=vd(),{openModal:g}=$n(),p=Ot(Zs),b=Le(cc),x=Le(dc),y=Le(Os),v=Le(gB);if(!n||y){let I;return e[0]===Symbol.for("react.memo_cache_sentinel")?(I=[],e[0]=I):I=e[0],I}const{cellId:C,config:S,getEditorView:E,name:N,hasOutput:j,hasConsoleOutput:T,status:A}=n;let M;e[1]!==C||e[2]!==S.disabled||e[3]!==r?(M=async()=>{const I={disabled:!S.disabled};await ur({configs:{[C]:I}}),r({cellId:C,config:I})},e[1]=C,e[2]=S.disabled,e[3]=r,e[4]=M):M=e[4];const P=M;let R;e[5]!==C||e[6]!==S.hide_code||e[7]!==E||e[8]!==r?(R=async()=>{const I={hide_code:!S.hide_code};await ur({configs:{[C]:I}}),r({cellId:C,config:I});const W=E();W&&(I.hide_code?W.contentDOM.blur():W.focus())},e[5]=C,e[6]=S.hide_code,e[7]=E,e[8]=r,e[9]=R):R=e[9];const L=R;let B,U,D,k,$;return e[10]===Symbol.for("react.memo_cache_sentinel")?(B=c.jsx(lg,{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(c.jsxs(ar,{children:[c.jsx(Ts,{children:c.jsx(sr,{children:"Rename cell"})}),c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx(Fr,{htmlFor:"cell-name",children:"Cell name"}),c.jsx(nC,{placeholder:"cell name",value:N,onKeyDown:I=>{I.key==="Enter"&&(I.preventDefault(),I.stopPropagation(),g(null))},onChange:I=>s({cellId:C,name:I})})]})]}))},e[11]=C,e[12]=N,e[13]=g,e[14]=s,e[15]=U):U=e[15],e[16]!==C||e[17]!==s?(D=I=>s({cellId:C,name:I}),e[16]=C,e[17]=s,e[18]=D):D=e[18],e[19]!==N||e[20]!==D?(k=c.jsx(nC,{placeholder:"cell name",value:N,onChange:D}),e[19]=N,e[20]=D,e[21]=k):k=e[21],e[22]!==d||e[23]!==b||e[24]!==v||e[25]!==x||e[26]!==m||e[27]!==C||e[28]!==u||e[29]!==S.disabled||e[30]!==S.hide_code||e[31]!==o||e[32]!==_||e[33]!==E||e[34]!==T||e[35]!==j||e[36]!==i||e[37]!==N||e[38]!==f||e[39]!==l||e[40]!==a||e[41]!==p||e[42]!==h||e[43]!==A||e[44]!==U||e[45]!==k||e[46]!==P||e[47]!==L?($=[[{icon:B,label:"Name",disableClick:!0,handle:EC,handleHeadless:U,rightElement:k},{icon:c.jsx(Wr,{size:13,strokeWidth:1.5}),label:"Run cell",hotkey:"cell.run",hidden:A==="running"||A==="queued"||A==="disabled-transitively"||S.disabled,handle:()=>f()},{icon:c.jsx(ea,{size:13,strokeWidth:1.5}),label:"AI completion",hidden:!b,handle:()=>{p(I=>(I==null?void 0:I.cellId)===C?null:{cellId:C})},hotkey:"cell.aiCompletion"},{icon:c.jsx(pd,{size:13,strokeWidth:1.5}),label:"Split cell",hotkey:"cell.splitCell",handle:()=>h({cellId:C})},{icon:c.jsx(mp,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!j,handle:()=>function(I){const W=document.getElementById(Q3.create(I));W&&(W.classList.add("printing-output"),e4(W,"result.png").finally(()=>{W.classList.remove("printing-output")}))}(C)},{icon:c.jsx(s4,{size:13,strokeWidth:1.5}),label:"Format cell",hotkey:"cell.format",handle:()=>{const I=E();I&&r4({[C]:I})}},{icon:S.hide_code?c.jsx(wm,{size:13,strokeWidth:1.5}):c.jsx(vm,{size:13,strokeWidth:1.5}),label:S.hide_code?"Show code":"Hide code",handle:L,hotkey:"cell.hideCode"},{icon:S.disabled?c.jsx(wn,{size:13,strokeWidth:1.5}):c.jsx(vn,{size:13,strokeWidth:1.5}),label:"Reactive execution",rightElement:c.jsx(km,{"data-testid":"cell-disable-switch",checked:!S.disabled,size:"sm",onCheckedChange:P}),handle:P},{icon:c.jsx(Zi,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(j||T),handle:()=>{u({cellId:C})}}],[{icon:c.jsx(uc,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:()=>{const I=E();I&&(fo({autoInstantiate:x,createNewCell:o}),Lr(I,{language:"markdown",keepCodeAsIs:!1}))}},{icon:c.jsx(lr,{size:13,strokeWidth:1.5}),label:"Convert to SQL",handle:()=>{const I=E();I&&(fo({autoInstantiate:x,createNewCell:o}),Lr(I,{language:"markdown",keepCodeAsIs:!1}))}},{icon:c.jsx(hc,{}),label:"Toggle as Python",handle:()=>{const I=E();I&&(fo({autoInstantiate:x,createNewCell:o}),_B(I,"python",{force:!0}))}}],[{icon:c.jsxs(Xs,{children:[c.jsx(Ca,{size:13,strokeWidth:1.5}),c.jsx(Sm,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>o({cellId:C,before:!0})},{icon:c.jsxs(Xs,{children:[c.jsx(Ca,{size:13,strokeWidth:1.5}),c.jsx(dr,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>o({cellId:C,before:!1})},{icon:c.jsx(Sm,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>i({cellId:C,before:!0})},{icon:c.jsx(dr,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>i({cellId:C,before:!1})},{icon:c.jsx(i4,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>i({cellId:C,direction:"left"}),hidden:v!=="columns"},{icon:c.jsx(ta,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>i({cellId:C,direction:"right"}),hidden:v!=="columns"},{icon:c.jsx(kp,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>a({cellId:C,scroll:!1})},{icon:c.jsx(vp,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>l({cellId:C,scroll:!1})},{icon:c.jsx(bB,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",hidden:v!=="columns",handle:()=>d({cellId:C})}],[{icon:c.jsx(JS,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!pg(N),tooltip:pg(N)?void 0:"Only named cells can be linked to",handle:async()=>{await _n(function(I){const W=new URL(window.location.href);return W.hash=`scrollTo=${encodeURIComponent(I)}`,W.toString()}(N)),nt({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!m,variant:"danger",icon:c.jsx(fc,{size:13,strokeWidth:1.5}),handle:()=>{_({cellId:C})}}]].map(NC).filter(CC),e[22]=d,e[23]=b,e[24]=v,e[25]=x,e[26]=m,e[27]=C,e[28]=u,e[29]=S.disabled,e[30]=S.hide_code,e[31]=o,e[32]=_,e[33]=E,e[34]=T,e[35]=j,e[36]=i,e[37]=N,e[38]=f,e[39]=l,e[40]=a,e[41]=p,e[42]=h,e[43]=A,e[44]=U,e[45]=k,e[46]=P,e[47]=L,e[48]=$):$=e[48],$}function CC(t){return t.length>0}function NC(t){return t.filter(jC)}function jC(t){return!t.hidden}function EC(t){t==null||t.stopPropagation(),t==null||t.preventDefault()}function IC(t){return!t.hidden}const Sd=zt(!1),_g=()=>{const t=K.c(37),[e,n]=Qt(Sd),o=yB(),r=Le(wB),s=Le(mc);let i;t[0]!==r?(i={cell:r},t[0]=r,t[1]=i):i=t[1];let a=kd(i).flat();a=Oa(a);const l=function(){const D=K.c(73),[k,$]=zr(),[I,W]=a4();let G;D[0]!==$?(G=async Q=>{await Br({config:Q}).then(()=>{$(Q)})},D[0]=$,D[1]=G):G=D[1];const q=G;let Y;D[2]!==W?(Y=async Q=>{await xB({config:Q}).then(()=>{W(Q)})},D[2]=W,D[3]=Y):Y=D[3];const ee=Y;let oe;if(D[4]!==I||D[5]!==k||D[6]!==ee||D[7]!==q){let Q,me,fe,de,ue;D[9]!==I?(Q=Ve=>Ve!==I.width,D[9]=I,D[10]=Q):Q=D[10],D[11]!==I||D[12]!==ee?(me=Ve=>({label:`App config > Set width=${Ve}`,handle:()=>{ee({...I,width:Ve})}}),D[11]=I,D[12]=ee,D[13]=me):me=D[13],D[14]!==k||D[15]!==q?(fe={label:"Config > Set theme: dark",handle:()=>{q({...k,display:{...k.display,theme:"dark"}})}},D[14]=k,D[15]=q,D[16]=fe):fe=D[16],D[17]!==k||D[18]!==q?(de={label:"Config > Set theme: light",handle:()=>{q({...k,display:{...k.display,theme:"light"}})}},D[17]=k,D[18]=q,D[19]=de):de=D[19],D[20]!==k||D[21]!==q?(ue={label:"Config > Set theme: system",handle:()=>{q({...k,display:{...k.display,theme:"system"}})}},D[20]=k,D[21]=q,D[22]=ue):ue=D[22];const ce=k.keymap.preset==="vim";let ke,Se;D[23]!==k||D[24]!==q?(ke=()=>{q({...k,keymap:{...k.keymap,preset:"vim"}})},D[23]=k,D[24]=q,D[25]=ke):ke=D[25],D[26]!==ce||D[27]!==ke?(Se={label:"Config > Switch keymap to VIM",hidden:ce,handle:ke},D[26]=ce,D[27]=ke,D[28]=Se):Se=D[28];const ae=k.keymap.preset==="default";let Ce,_e,Ee;D[29]!==k||D[30]!==q?(Ce=()=>{q({...k,keymap:{...k.keymap,preset:"default"}})},D[29]=k,D[30]=q,D[31]=Ce):Ce=D[31],D[32]!==ae||D[33]!==Ce?(_e={label:"Config > Switch keymap to default (current: VIM)",hidden:ae,handle:Ce},D[32]=ae,D[33]=Ce,D[34]=_e):_e=D[34],D[35]!==k||D[36]!==q?(Ee=()=>{q({...k,completion:{...k.completion,copilot:!1}})},D[35]=k,D[36]=q,D[37]=Ee):Ee=D[37];const ze=k.completion.copilot!=="github";let Oe,He;D[38]!==Ee||D[39]!==ze?(Oe={label:"Config > Disable GitHub Copilot",handle:Ee,hidden:ze},D[38]=Ee,D[39]=ze,D[40]=Oe):Oe=D[40],D[41]!==k||D[42]!==q?(He=()=>{q({...k,completion:{...k.completion,copilot:"github"}})},D[41]=k,D[42]=q,D[43]=He):He=D[43];const Fe=k.completion.copilot==="github";let it;D[44]!==He||D[45]!==Fe?(it={label:"Config > Enable GitHub Copilot",handle:He,hidden:Fe},D[44]=He,D[45]=Fe,D[46]=it):it=D[46];const Qe=!k.display.reference_highlighting;let tt,ne,ve,je;D[47]!==k||D[48]!==q?(tt=()=>{q({...k,display:{...k.display,reference_highlighting:!1}})},D[47]=k,D[48]=q,D[49]=tt):tt=D[49],D[50]!==Qe||D[51]!==tt?(ne={label:"Config > Disable reference highlighting",hidden:Qe,handle:tt},D[50]=Qe,D[51]=tt,D[52]=ne):ne=D[52],D[53]!==k||D[54]!==q?(ve=()=>{q({...k,display:{...k.display,reference_highlighting:!0}})},D[53]=k,D[54]=q,D[55]=ve):ve=D[55],D[56]!==k.display.reference_highlighting||D[57]!==ve?(je={label:"Config > Enable reference highlighting",hidden:k.display.reference_highlighting,handle:ve},D[56]=k.display.reference_highlighting,D[57]=ve,D[58]=je):je=D[58];const Re=k.display.cell_output==="above";let J,se;D[59]!==k||D[60]!==q?(J=()=>{q({...k,display:{...k.display,cell_output:"above"}})},D[59]=k,D[60]=q,D[61]=J):J=D[61],D[62]!==Re||D[63]!==J?(se={label:"Config > Set cell output area: above",hidden:Re,handle:J},D[62]=Re,D[63]=J,D[64]=se):se=D[64];const ge=k.display.cell_output==="below";let pe,xe;D[65]!==k||D[66]!==q?(pe=()=>{q({...k,display:{...k.display,cell_output:"below"}})},D[65]=k,D[66]=q,D[67]=pe):pe=D[67],D[68]!==ge||D[69]!==pe?(xe={label:"Config > Set cell output area: below",hidden:ge,handle:pe},D[68]=ge,D[69]=pe,D[70]=xe):xe=D[70],oe=[...JH().filter(Q).map(me),fe,de,ue,Se,_e,Oe,it,ne,je,se,xe],D[4]=I,D[5]=k,D[6]=ee,D[7]=q,D[8]=oe}else oe=D[8];const ie=oe;let Z;return D[71]!==ie?(Z=ie.filter(IC),D[71]=ie,D[72]=Z):Z=D[72],Z}();let d=Gg();d=[...Oa(d),...Oa(l)];const u=d.filter(AC),h=pc.keyBy(u,TC),{recentCommands:f,addRecentCommand:m}=vC();let _;t[2]!==f?(_=new Set(f),t[2]=f,t[3]=_):_=t[3];const g=_;let p,b;t[4]!==s||t[5]!==n?(p=D=>{jm(s.getHotkey("global.commandPalette").key)(D)&&(D.preventDefault(),n(MC))},t[4]=s,t[5]=n,t[6]=p):p=t[6],ac(document,"keydown",p),t[7]!==m||t[8]!==s||t[9]!==o||t[10]!==n?(b=(D,k)=>{const $=o[D];if(!$)return null;const I=s.getHotkey(D);return c.jsxs(mo,{disabled:k.disabled,onSelect:()=>{m(D),n(!1),requestAnimationFrame(()=>{$()})},value:I.name,children:[c.jsxs("span",{children:[I.name,k.tooltip&&c.jsx("span",{className:"ml-2",children:k.tooltip})]}),c.jsx(c4,{children:c.jsx(Em,{shortcut:I.key})})]},D)},t[7]=m,t[8]=s,t[9]=o,t[10]=n,t[11]=b):b=t[11];const x=b;let y;t[12]!==m||t[13]!==s||t[14]!==n?(y=D=>{const{label:k,handle:$,props:I,hotkey:W}=D,G=I===void 0?{}:I;return c.jsxs(mo,{disabled:G.disabled,onSelect:()=>{m(k),n(!1),requestAnimationFrame(()=>{$()})},value:k,children:[c.jsxs("span",{children:[k,G.tooltip&&c.jsxs("span",{className:"ml-2",children:["(",G.tooltip,")"]})]}),W&&c.jsx(c4,{children:c.jsx(Em,{shortcut:s.getHotkey(W).key})})]},k)},t[12]=m,t[13]=s,t[14]=n,t[15]=y):y=t[15];const v=y,C=kB;let S;t[16]===Symbol.for("react.memo_cache_sentinel")?(S=c.jsx(na,{placeholder:"Type to search..."}),t[16]=S):S=t[16];const E=Nm;let N;t[17]===Symbol.for("react.memo_cache_sentinel")?(N=c.jsx(gc,{children:"No results found."}),t[17]=N):N=t[17];const j=f.length>0&&c.jsxs(c.Fragment,{children:[c.jsx(Cm,{heading:"Recently Used",children:f.map(D=>{const k=h[D];return vB(D)?x(D,{disabled:k==null?void 0:k.disabled,tooltip:k==null?void 0:k.tooltip}):k&&!mg(k)?v({label:k.label,handle:k.handleHeadless||k.handle,props:{disabled:k.disabled,tooltip:k.tooltip}}):null})}),c.jsx(l4,{})]}),T=Cm,A=s.iterate().map(D=>{if(g.has(D))return null;const k=h[D];return x(D,{disabled:k==null?void 0:k.disabled,tooltip:k==null?void 0:k.tooltip})}),M=u.map(D=>g.has(D.label)?null:v({label:D.label,handle:D.handleHeadless||D.handle,props:{disabled:D.disabled,tooltip:D.tooltip}}));let P;t[18]!==g||t[19]!==v?(P=D=>g.has(D.label)?null:v({label:`Cell > ${D.label}`,handle:D.handleHeadless||D.handle,props:{disabled:D.disabled,tooltip:D.tooltip}}),t[18]=g,t[19]=v,t[20]=P):P=t[20];const R=a.map(P);let L,B,U;return t[21]!==T||t[22]!==M||t[23]!==R||t[24]!==A?(L=c.jsxs(T,{heading:"Commands",children:[A,M,R]}),t[21]=T,t[22]=M,t[23]=R,t[24]=A,t[25]=L):L=t[25],t[26]!==E||t[27]!==L||t[28]!==N||t[29]!==j?(B=c.jsxs(E,{children:[N,j,L]}),t[26]=E,t[27]=L,t[28]=N,t[29]=j,t[30]=B):B=t[30],t[31]!==C||t[32]!==e||t[33]!==n||t[34]!==B||t[35]!==S?(U=c.jsxs(C,{open:e,onOpenChange:n,children:[S,B]}),t[31]=C,t[32]=e,t[33]=n,t[34]=B,t[35]=S,t[36]=U):U=t[36],U};function AC(t){return!t.hotkey}function TC(t){return t.label}function MC(t){return!t}function kr(){return ht().optional().describe(Ge.of({label:"Password",inputType:"password",placeholder:"password",optionRegex:".*password.*"}))}function bg(){return ht().optional().describe(Ge.of({label:"Token",inputType:"password",placeholder:"token",optionRegex:".*token.*"}))}function Ra(){return ht().optional().describe(Ge.of({label:"Warehouse Name",placeholder:"warehouse",optionRegex:".*warehouse.*"}))}function xg(){return ht().optional().describe(Ge.of({label:"URI",optionRegex:".*uri.*"}))}function Sr(){return ht().nonempty().describe(Ge.of({label:"Host",placeholder:"localhost",optionRegex:".*host.*"}))}function go(){return ht().describe(Ge.of({label:"Database",placeholder:"db name",optionRegex:".*database.*"}))}function Cr(){return ht().nonempty().describe(Ge.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function Nr(t){const e=SB.string().describe(Ge.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 yg(){return Ds().default(!1).describe(Ge.of({label:"Read Only"}))}const wg=xt({type:kt("postgres"),host:Sr(),port:Nr(5432).optional(),database:go(),username:Cr(),password:kr(),ssl:Ds().default(!1).describe(Ge.of({label:"Use SSL"}))}).describe(Ge.of({direction:"two-columns"})),vg=xt({type:kt("mysql"),host:Sr(),port:Nr(3306),database:go(),username:Cr(),password:kr(),ssl:Ds().default(!1).describe(Ge.of({label:"Use SSL"}))}).describe(Ge.of({direction:"two-columns"})),kg=xt({type:kt("sqlite"),database:go().describe(Ge.of({label:"Database Path"}))}).describe(Ge.of({direction:"two-columns"})),Sg=xt({type:kt("duckdb"),database:go().describe(Ge.of({label:"Database Path"})),read_only:yg()}).describe(Ge.of({direction:"two-columns"})),Cg=xt({type:kt("motherduck"),database:go().default("my_db").describe(Ge.of({label:"Database Name"})),token:bg()}).describe(Ge.of({direction:"two-columns"})),Ng=xt({type:kt("snowflake"),account:ht().nonempty().describe(Ge.of({label:"Account",optionRegex:".*snowflake.*"})),warehouse:ht().optional().describe(Ge.of({label:"Warehouse",optionRegex:".*snowflake.*"})),database:go(),schema:ht().optional().describe(Ge.of({label:"Schema",optionRegex:".*snowflake.*"})),username:Cr(),password:kr(),role:ht().optional().describe(Ge.of({label:"Role"}))}).describe(Ge.of({direction:"two-columns"})),jg=xt({type:kt("bigquery"),project:ht().nonempty().describe(Ge.of({label:"Project ID",optionRegex:".*bigquery.*"})),dataset:ht().nonempty().describe(Ge.of({label:"Dataset",optionRegex:".*bigquery.*"})),credentials_json:ht().describe(Ge.of({label:"Credentials JSON",inputType:"textarea"}))}).describe(Ge.of({direction:"two-columns"})),Eg=xt({type:kt("clickhouse_connect"),host:Sr(),port:Nr(8123).optional(),username:Cr(),password:kr(),secure:Ds().default(!1).describe(Ge.of({label:"Use HTTPs"}))}).describe(Ge.of({direction:"two-columns"})),Ig=xt({type:kt("timeplus"),host:Sr().default("localhost"),port:Nr(8123).optional(),username:Cr().default("default"),password:kr().default("")}).describe(Ge.of({direction:"two-columns"})),Ag=xt({type:kt("chdb"),database:go().describe(Ge.of({label:"Database Path"})),read_only:yg()}).describe(Ge.of({direction:"two-columns"})),Tg=xt({type:kt("trino"),host:Sr(),port:Nr(8080),database:go(),schema:ht().describe(Ge.of({label:"Schema",placeholder:"schema name",optionRegex:".*schema.*"})).optional(),username:Cr(),password:kr(),async_support:Ds().default(!1).describe(Ge.of({label:"Async Support"}))}).describe(Ge.of({direction:"two-columns"})),Mg=xt({type:kt("iceberg"),name:ht().describe(Ge.of({label:"Catalog Name"})),catalog:Im("type",[xt({type:kt("REST"),warehouse:Ra(),uri:ht().optional().describe(Ge.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:bg()}),xt({type:kt("SQL"),warehouse:Ra(),uri:ht().optional().describe(Ge.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),xt({type:kt("Hive"),warehouse:Ra(),uri:xg()}),xt({type:kt("Glue"),warehouse:Ra(),uri:xg()}),xt({type:kt("DynamoDB"),"dynamodb.profile-name":ht().optional().describe(Ge.of({label:"Profile Name"})),"dynamodb.region":ht().optional().describe(Ge.of({label:"Region"})),"dynamodb.access-key-id":ht().optional().describe(Ge.of({label:"Access Key ID"})),"dynamodb.secret-access-key":ht().optional().describe(Ge.of({label:"Secret Access Key",inputType:"password"})),"dynamodb.session-token":ht().optional().describe(Ge.of({label:"Session Token",inputType:"password"}))})]).default({type:"REST"}).describe(Ge.of({special:"tabs"}))}),Og=xt({type:kt("datafusion"),sessionContext:Ds().optional().describe(Ge.of({label:"Use Session Context"}))}),Dg=xt({type:kt("pyspark"),host:Sr().optional(),port:Nr().optional()}),Rg=xt({type:kt("redshift"),host:Sr(),port:Nr(5439),connectionType:Im("type",[xt({type:kt("IAM credentials"),region:ht().describe(Ge.of({label:"Region"})),aws_access_key_id:ht().nonempty().describe(Ge.of({label:"AWS Access Key ID",inputType:"password",optionRegex:".*aws_access_key_id.*"})),aws_secret_access_key:ht().nonempty().describe(Ge.of({label:"AWS Secret Access Key",inputType:"password",optionRegex:".*aws_secret_access_key.*"})),aws_session_token:ht().optional().describe(Ge.of({label:"AWS Session Token",inputType:"password",optionRegex:".*aws_session_token.*"}))}),xt({type:kt("DB credentials"),user:Cr(),password:kr()})]).default({type:"IAM credentials",aws_access_key_id:"",aws_secret_access_key:"",region:""}),database:go()}).describe(Ge.of({direction:"two-columns"})),OC=Im("type",[wg,vg,kg,Sg,Cg,Ng,jg,Eg,Ig,Ag,Tg,Mg,Og,Dg,Rg]),Cd="env:";function Pa(t){return typeof t=="string"&&t.startsWith(Cd)}function Nd(t){return`${Cd}${t}`}const Pg={sqlmodel:"SQLModel",sqlalchemy:"SQLAlchemy",duckdb:"DuckDB",clickhouse_connect:"ClickHouse Connect",chdb:"chDB",pyiceberg:"PyIceberg",ibis:"Ibis",motherduck:"MotherDuck",redshift:"Redshift"};class rn{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),Pa(n)){const r=n.replace(Cd,""),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"?Gr(n):n?`"${n}"`:""}printInFString(e,n,o){if(n===void 0)return"";if(typeof n=="number")return`${n}`;if(typeof n=="boolean")return Gr(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 Pa(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 RC extends rn{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 St(`
4
4
  DATABASE_URL = f"postgresql://${o}:${n}@${r}:${s}/${i}"
5
5
  engine = ${this.orm}.create_engine(DATABASE_URL${e})
@@ -95,7 +95,7 @@ ${La(i,a=>` ${a}`)},
95
95
  )
96
96
  `)}}class KC{constructor(){this.secrets=new DC}createGenerator(e,n){switch(e.type){case"postgres":return new RC(e,n,this.secrets);case"mysql":return new PC(e,n,this.secrets);case"sqlite":return new LC(e,n,this.secrets);case"snowflake":return new FC(e,n,this.secrets);case"bigquery":return new zC(e,n,this.secrets);case"duckdb":return new BC(e,n,this.secrets);case"motherduck":return new UC(e,n,this.secrets);case"clickhouse_connect":return new VC(e,n,this.secrets);case"timeplus":return new $C(e,n,this.secrets);case"chdb":return new HC(e,n,this.secrets);case"trino":return new WC(e,n,this.secrets);case"iceberg":return new qC(e,n,this.secrets);case"datafusion":return new GC(e,n,this.secrets);case"pyspark":return new YC(e,n,this.secrets);case"redshift":return new JC(e,n,this.secrets);default:Am(e)}}}function Gr(t){return t.toString().charAt(0).toUpperCase()+t.toString().slice(1)}function La(t,e){return Object.entries(t).filter(([,n])=>n!=null&&n!=="").map(([n,o])=>e(typeof o=="boolean"?`${n}=${Gr(o)}`:`${n}=${o}`)).join(`,
97
97
  `)}function Lg(t){return t.sort((e,n)=>e.provider==="env"?1:n.provider==="env"?-1:0)}const Fg=t=>{const e=K.c(42),{providerNames:n,onClose:o,onSuccess:r}=t,[s,i]=X.useState(""),[a,l]=X.useState(""),[d,u]=X.useState(n[0]);let h;e[0]!==s||e[1]!==d||e[2]!==r||e[3]!==a?(h=async U=>{if(U.preventDefault(),d)if(s&&a&&d)try{await CB({key:s,value:a,provider:"dotenv",name:d}),nt({title:"Secret created",description:"The secret has been created successfully."}),r(s)}catch{nt({title:"Error",description:"Failed to create secret. Please try again.",variant:"danger"})}else nt({title:"Error",description:"Please fill in all fields.",variant:"danger"});else nt({title:"Error",description:"No location selected for the secret.",variant:"danger"})},e[0]=s,e[1]=d,e[2]=r,e[3]=a,e[4]=h):h=e[4];const f=h;let m,_,g,p,b,x,y,v,C,S,E,N,j,T,A,M;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=c.jsxs(Ts,{children:[c.jsx(sr,{children:"Add Secret"}),c.jsx(Ms,{children:"Add a new secret to your environment variables."})]}),e[5]=m):m=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(_=c.jsx(Fr,{htmlFor:"key",children:"Key"}),e[6]=_):_=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(g=U=>{i(U.target.value.replaceAll(/\W/g,"_"))},e[7]=g):g=e[7],e[8]!==s?(p=c.jsxs("div",{className:"grid gap-2",children:[_,c.jsx(ir,{id:"key",value:s,onChange:g,placeholder:"MY_SECRET_KEY",required:!0})]}),e[8]=s,e[9]=p):p=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(Fr,{htmlFor:"value",children:"Value"}),e[10]=b):b=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(x=U=>l(U.target.value),e[11]=x):x=e[11],e[12]!==a?(y=c.jsx(ir,{id:"value",type:"text",value:a,onChange:x,required:!0,autoComplete:"off"}),e[12]=a,e[13]=y):y=e[13],e[14]===Symbol.for("react.memo_cache_sentinel")?(v=window.location.href.startsWith("http://")&&c.jsx(d4,{children:"Note: You are sending this key over http."}),e[14]=v):v=e[14],e[15]!==y?(C=c.jsxs("div",{className:"grid gap-2",children:[b,y,v]}),e[15]=y,e[16]=C):C=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(S=c.jsx(Fr,{htmlFor:"location",children:"Location"}),e[17]=S):S=e[17],e[18]!==n.length?(E=n.length===0&&c.jsx("p",{className:"text-sm text-muted-foreground",children:"No dotenv locations configured."}),e[18]=n.length,e[19]=E):E=e[19],e[20]!==d||e[21]!==n?(N=n.length>0&&c.jsxs(_c,{value:d,onValueChange:U=>u(U),children:[c.jsx(bc,{children:c.jsx(xc,{placeholder:"Select a provider"})}),c.jsx(yc,{children:n.map(XC)})]}),e[20]=d,e[21]=n,e[22]=N):N=e[22],e[23]===Symbol.for("react.memo_cache_sentinel")?(j=c.jsxs(d4,{children:["You can configure the location by setting the"," ",c.jsx(Tm,{href:"https://links.marimo.app/dotenv",children:"dotenv configuration"}),"."]}),e[23]=j):j=e[23],e[24]!==E||e[25]!==N?(T=c.jsxs("div",{className:"grid gap-2",children:[S,E,N,j]}),e[24]=E,e[25]=N,e[26]=T):T=e[26],e[27]!==C||e[28]!==T||e[29]!==p?(A=c.jsxs("div",{className:"grid gap-4 py-4",children:[p,C,T]}),e[27]=C,e[28]=T,e[29]=p,e[30]=A):A=e[30],e[31]!==o?(M=c.jsx(Ae,{type:"button",variant:"outline",onClick:o,children:"Cancel"}),e[31]=o,e[32]=M):M=e[32];const P=!s||!a||!d;let R,L,B;return e[33]!==P?(R=c.jsx(Ae,{type:"submit",disabled:P,children:"Add Secret"}),e[33]=P,e[34]=R):R=e[34],e[35]!==M||e[36]!==R?(L=c.jsxs(Ki,{children:[M,R]}),e[35]=M,e[36]=R,e[37]=L):L=e[37],e[38]!==f||e[39]!==A||e[40]!==L?(B=c.jsx(ar,{children:c.jsxs("form",{onSubmit:f,children:[m,A,L]})}),e[38]=f,e[39]=A,e[40]=L,e[41]=B):B=e[41],B};function XC(t){return c.jsx(oa,{value:t,children:t},t)}const zg=O.createContext({providerNames:[],secretKeys:[],loading:!1,error:void 0,refreshSecrets:Hn.NOOP}),ZC=t=>{const e=K.c(14),{children:n}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],e[0]=o):o=e[0];const{data:r,isPending:s,error:i,refetch:a}=Wn(nN,o);let l,d,u,h;return e[1]!==(r==null?void 0:r.secretKeys)?(l=(r==null?void 0:r.secretKeys)||[],e[1]=r==null?void 0:r.secretKeys,e[2]=l):l=e[2],e[3]!==(r==null?void 0:r.providerNames)?(d=(r==null?void 0:r.providerNames)||[],e[3]=r==null?void 0:r.providerNames,e[4]=d):d=e[4],e[5]!==i||e[6]!==s||e[7]!==a||e[8]!==l||e[9]!==d?(u={secretKeys:l,providerNames:d,loading:s,error:i,refreshSecrets:a},e[5]=i,e[6]=s,e[7]=a,e[8]=l,e[9]=d,e[10]=u):u=e[10],e[11]!==n||e[12]!==u?(h=c.jsx(zg,{value:u,children:n}),e[11]=n,e[12]=u,e[13]=h):h=e[13],h};function QC(t){return t.provider!=="env"}function eN(t){return t.name}function tN(t){return t.keys}async function nN(){const t=await oC.request({}),e=Lg(t.secrets).filter(QC).map(eN);return{secretKeys:t.secrets.flatMap(tN).sort(),providerNames:e}}const Bg=[{name:"PostgreSQL",schema:wg,color:"#336791",logo:"postgres",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"MySQL",schema:vg,color:"#00758F",logo:"mysql",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"SQLite",schema:kg,color:"#003B57",logo:"sqlite",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"DuckDB",schema:Sg,color:"#FFD700",logo:"duckdb",connectionLibraries:{libraries:["duckdb"],preferred:"duckdb"}},{name:"MotherDuck",schema:Cg,color:"#ff9538",logo:"motherduck",connectionLibraries:{libraries:["duckdb"],preferred:"duckdb"}},{name:"Snowflake",schema:Ng,color:"#29B5E8",logo:"snowflake",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"ClickHouse",schema:Eg,color:"#2C2C1D",logo:"clickhouse",connectionLibraries:{libraries:["clickhouse_connect"],preferred:"clickhouse_connect"}},{name:"Timeplus",schema:Ig,color:"#B83280",logo:"timeplus",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"BigQuery",schema:jg,color:"#4285F4",logo:"bigquery",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"ClickHouse Embedded",schema:Ag,color:"#f2b611",logo:"clickhouse",connectionLibraries:{libraries:["chdb"],preferred:"chdb"}},{name:"Trino",schema:Tg,color:"#d466b6",logo:"trino",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"DataFusion",schema:Og,color:"#202A37",logo:"datafusion",connectionLibraries:{libraries:["ibis"],preferred:"ibis"}},{name:"PySpark",schema:Dg,color:"#1C5162",logo:"pyspark",connectionLibraries:{libraries:["ibis"],preferred:"ibis"}},{name:"Redshift",schema:Rg,color:"#522BAE",logo:"redshift",connectionLibraries:{libraries:["redshift"],preferred:"redshift"}}],Ug=[{name:"Iceberg",schema:Mg,color:"#000000",logo:"iceberg",connectionLibraries:{libraries:["pyiceberg"],preferred:"pyiceberg"}}],oN=t=>{const e=K.c(14),{onSelect:n}=t;let o;e[0]!==n?(o=h=>{const{name:f,schema:m,color:_,logo:g}=h;return c.jsxs("button",{type:"button",className:"py-3 flex flex-col items-center justify-center gap-1 transition-all hover:scale-105 hover:brightness-110 rounded shadow-smSolid hover:shadow-mdSolid",style:{backgroundColor:_},onClick:()=>n(m),children:[c.jsx(y4,{name:g,className:"w-8 h-8 text-white brightness-0 invert dark:invert"}),c.jsx("span",{className:"text-white font-medium text-lg",children:f})]},f)},e[0]=n,e[1]=o):o=e[1];const r=o;let s,i,a,l,d,u;return e[2]!==r?(s=Bg.map(r),e[2]=r,e[3]=s):s=e[3],e[4]!==s?(i=c.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:s}),e[4]=s,e[5]=i):i=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsxs("h4",{className:"font-semibold text-muted-foreground text-lg flex items-center gap-4",children:["Data Catalogs",c.jsx("hr",{className:"flex-1"})]}),e[6]=a):a=e[6],e[7]!==r?(l=Ug.map(r),e[7]=r,e[8]=l):l=e[8],e[9]!==l?(d=c.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:l}),e[9]=l,e[10]=d):d=e[10],e[11]!==i||e[12]!==d?(u=c.jsxs(c.Fragment,{children:[i,a,d]}),e[11]=i,e[12]=d,e[13]=u):u=e[13],u},rN=[{isMatch:t=>{if(t instanceof m4||t instanceof IB){const{optionRegex:e}=Ge.parse(t._def.description||"");return!!e}return!1},Component:({schema:t,form:e,path:n})=>{const{secretKeys:o,providerNames:r,refreshSecrets:s}=O.use(zg),{openModal:i,closeModal:a}=$n(),{label:l,description:d,optionRegex:u=""}=Ge.parse(t._def.description||""),[h,f]=Bt(o,m=>new RegExp(u,"i").test(m));return c.jsx(u4,{control:e.control,name:n,render:({field:m})=>c.jsxs(h4,{children:[c.jsx(NB,{children:l}),c.jsx(jB,{children:d}),c.jsx(f4,{children:c.jsxs("div",{className:"flex gap-2",children:[t instanceof m4?c.jsx(ir,{...m,value:m.value,onChange:m.onChange,className:Ne("flex-1")}):c.jsx(EB,{...m,value:m.value,onChange:m.onChange,className:"flex-1"}),c.jsxs(hr,{children:[c.jsx(fr,{asChild:!0,children:c.jsx(Ae,{variant:"outline",size:"icon",className:Ne(Pa(m.value)&&"bg-accent"),children:c.jsx(dd,{className:"h-3 w-3"})})}),c.jsxs(mr,{align:"end",className:"max-h-60 overflow-y-auto",children:[c.jsxs(Vt,{onSelect:()=>{i(c.jsx(Fg,{providerNames:r,onSuccess:_=>{s(),m.onChange(Nd(_)),a()},onClose:a}))},children:[c.jsx(Ca,{className:"mr-2 h-3.5 w-3.5"}),"Create a new secret"]}),h.length>0&&c.jsxs(c.Fragment,{children:[c.jsx(bn,{}),c.jsx(p4,{children:"Recommended"})]}),h.map(_=>c.jsx(Vt,{onSelect:()=>m.onChange(Nd(_)),children:_},_)),f.length>0&&c.jsx(bn,{}),f.map(_=>c.jsx(Vt,{onSelect:()=>m.onChange(Nd(_)),children:_},_))]})]})]})}),c.jsx(g4,{})]})})}}],sN=t=>{var $;const e=K.c(49),{schema:n,onSubmit:o,onBack:r}=t;let s,i,a;e[0]!==n?(s=AB(n),e[0]=n,e[1]=s):s=e[1],e[2]!==n?(i=_4(n),e[2]=n,e[3]=i):i=e[3],e[4]!==s||e[5]!==i?(a={defaultValues:s,resolver:i,reValidateMode:"onChange"},e[4]=s,e[5]=i,e[6]=a):a=e[6];const l=b4(a),d=($=[...Bg,...Ug].find(I=>I.schema===n))==null?void 0:$.connectionLibraries,[u,h]=O.useState((d==null?void 0:d.preferred)??"sqlalchemy"),{createNewCell:f}=bt(),m=Rs();let _;e[7]!==f||e[8]!==m?(_=I=>{f({code:I,before:!1,cellId:m??"__end__",skipIfCodeExists:!0})},e[7]=f,e[8]=m,e[9]=_):_=e[9];const g=_;let p;e[10]!==g||e[11]!==o||e[12]!==u?(p=I=>{g(function(W,G){if(!(G in Pg))throw new Error(`Unsupported library: ${G}`);OC.parse(W);const q=new KC,Y=q.createGenerator(W,G),ee=Y.generateConnectionCode(),oe=q.secrets,ie=[...new Set([...oe.imports,...Y.imports])].sort();ie.push("");const Z=oe.formatSecrets();return Z&&ie.push(Z),ie.push(ee.trim()),ie.join(`
98
- `)}(I,u)),o()},e[10]=g,e[11]=o,e[12]=u,e[13]=p):p=e[13];const b=p;let x;e[14]!==l||e[15]!==b?(x=l.handleSubmit(b),e[14]=l,e[15]=b,e[16]=x):x=e[16];let y,v;e[17]===Symbol.for("react.memo_cache_sentinel")?(y=c.jsx(TB,{}),e[17]=y):y=e[17],e[18]!==l||e[19]!==n?(v=c.jsx(ZC,{children:c.jsx(MB,{schema:n,form:l,renderers:rN,children:y})}),e[18]=l,e[19]=n,e[20]=v):v=e[20];let C;e[21]!==r?(C=c.jsx(Ae,{type:"button",variant:"outline",onClick:r,children:"Back"}),e[21]=r,e[22]=C):C=e[22];const S=!l.formState.isValid;let E,N;e[23]!==S?(E=c.jsx(Ae,{type:"submit",disabled:S,children:"Add"}),e[23]=S,e[24]=E):E=e[24],e[25]!==C||e[26]!==E?(N=c.jsxs("div",{className:"flex gap-2",children:[C,E]}),e[25]=C,e[26]=E,e[27]=N):N=e[27];const j=_c;let T,A;e[28]===Symbol.for("react.memo_cache_sentinel")?(T=I=>h(I),e[28]=T):T=e[28],e[29]===Symbol.for("react.memo_cache_sentinel")?(A=c.jsxs("div",{className:"flex flex-col gap-1 items-end",children:[c.jsx(bc,{children:c.jsx(xc,{placeholder:"Select a library"})}),c.jsx("span",{className:"text-xs text-muted-foreground",children:"Preferred connection library"})]}),e[29]=A):A=e[29];const M=yc,P=x4,R=d==null?void 0:d.libraries.map(aN);let L,B,U,D,k;return e[30]!==P||e[31]!==R?(L=c.jsx(P,{children:R}),e[30]=P,e[31]=R,e[32]=L):L=e[32],e[33]!==M||e[34]!==L?(B=c.jsx(M,{children:L}),e[33]=M,e[34]=L,e[35]=B):B=e[35],e[36]!==j||e[37]!==u||e[38]!==T||e[39]!==A||e[40]!==B?(U=c.jsx("div",{children:c.jsxs(j,{value:u,onValueChange:T,children:[A,B]})}),e[36]=j,e[37]=u,e[38]=T,e[39]=A,e[40]=B,e[41]=U):U=e[41],e[42]!==N||e[43]!==U?(D=c.jsxs("div",{className:"flex gap-2 justify-between",children:[N,U]}),e[42]=N,e[43]=U,e[44]=D):D=e[44],e[45]!==D||e[46]!==x||e[47]!==v?(k=c.jsxs("form",{onSubmit:x,className:"space-y-4",children:[v,D]}),e[45]=D,e[46]=x,e[47]=v,e[48]=k):k=e[48],k},iN=t=>{const e=K.c(5),{onSubmit:n}=t,[o,r]=O.useState(null);if(!o){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx(oN,{onSelect:r}),e[0]=a):a=e[0],a}let s,i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(s=()=>r(null),e[1]=s):s=e[1],e[2]!==n||e[3]!==o?(i=c.jsx(sN,{schema:o,onSubmit:n,onBack:s}),e[2]=n,e[3]=o,e[4]=i):i=e[4],i},Vg=t=>{const e=K.c(6),{children:n}=t,[o,r]=O.useState(!1);let s,i,a;return e[0]!==n?(s=c.jsx(OB,{asChild:!0,children:n}),e[0]=n,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx($g,{onClose:()=>r(!1)}),e[2]=i):i=e[2],e[3]!==o||e[4]!==s?(a=c.jsxs(DB,{open:o,onOpenChange:r,children:[s,i]}),e[3]=o,e[4]=s,e[5]=a):a=e[5],a},$g=t=>{const e=K.c(4),{onClose:n}=t;let o,r,s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=c.jsx(sr,{children:"Add Connection"}),e[0]=o):o=e[0],e[1]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsxs(Ts,{className:"mb-4",children:[o,c.jsxs(Ms,{children:["Connect to your database or data catalog to query data directly from your notebook. Learn more about how to connect to your database in our"," ",c.jsx(Tm,{href:"https://docs.marimo.io/guides/working_with_data/sql/#connecting-to-a-custom-database",children:"docs."})]})]}),e[1]=r):r=e[1],e[2]!==n?(s=c.jsxs(ar,{className:"max-h-[75vh] overflow-y-auto",children:[r,c.jsx(iN,{onSubmit:()=>n()})]}),e[2]=n,e[3]=s):s=e[3],s};function aN(t){return c.jsx(oa,{value:t,children:Pg[t]},t)}const lN=()=>{const t=K.c(7),{selectedLayout:e}=rC(),{setLayoutView:n}=sC();if(un()&&!Mm("wasm_layouts"))return null;let o,r,s,i;return t[0]!==n?(o=a=>n(a),t[0]=n,t[1]=o):o=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(bc,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:c.jsx(xc,{placeholder:"Select a view"})}),t[2]=r):r=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(s=c.jsx(yc,{children:c.jsxs(x4,{children:[c.jsx(RB,{children:"View as"}),iC.map(dN)]})}),t[3]=s):s=t[3],t[4]!==e||t[5]!==o?(i=c.jsxs(_c,{"data-testid":"layout-select",value:e,onValueChange:o,children:[r,s]}),t[4]=e,t[5]=o,t[6]=i):i=t[6],i};function cN(t){const e=Hg(t);return c.jsx(e,{className:"h-4 w-4"})}function Hg(t){switch(t){case"vertical":return Up;case"grid":return KH;case"slides":return md;default:return wc(t),vc}}function Wg(t){return Om(t)}function dN(t){return c.jsx(oa,{value:t,children:c.jsxs("div",{className:"flex items-center gap-1.5 leading-5",children:[cN(t),c.jsx("span",{children:Wg(t)})]})},t)}const uN=()=>{const t=K.c(2),{updateCellConfig:e}=bt();let n;return t[0]!==e?(n=async()=>{const o=new ra,r=Nn(),s=r.cellIds.inOrderIds,i={};for(const l of s){if(r.cellData[l]===void 0)continue;const{code:d,config:u}=r.cellData[l];u.hide_code||o.isSupported(d)&&(i[l]={hide_code:!0})}const a=pc.entries(i);if(a.length!==0){await ur({configs:i});for(const[l,d]of a)e({cellId:l,config:d})}},t[0]=e,t[1]=n):n=t[1],n};function qg(){const t=K.c(3),{openConfirm:e}=$n(),n=Ot(hn);let o;return t[0]!==e||t[1]!==n?(o=()=>{e({title:"Restart Kernel",description:"This will restart the Python kernel. You'll lose all data that's in memory. You will also lose any unsaved changes, so make sure to save your work before restarting.",variant:"destructive",confirmAction:c.jsx(w4,{onClick:async()=>{n({state:$t.CLOSING}),await LB(),FB()},"aria-label":"Confirm Restart",children:"Restart"})})},t[0]=e,t[1]=n,t[2]=o):o=t[2],o}const Qs=t=>{t==null||t.preventDefault(),t==null||t.stopPropagation()};function Gg(){var I,W;const t=K.c(36),e=Dm(),{openModal:n,closeModal:o}=$n(),{toggleApplication:r}=sa(),{selectedPanel:s}=Sc(),[i]=Qt(_m),a=Le(Os),l=uN(),[d]=zr(),{updateCellConfig:u,undoDeleteCell:h,clearAllCellOutputs:f,upsertSetupCell:m,collapseAllCells:_,expandAllCells:g}=bt(),p=qg(),b=fg(),x=function(G){const q=K.c(4),{openPrompt:Y,closeModal:ee}=$n();let oe;return q[0]!==ee||q[1]!==Y||q[2]!==G?(oe=()=>{if(!G)return null;const ie=kc.guessDeliminator(G),Z=jn.basename(G);Y({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${Z}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:Q=>{const me=ie.join(jn.dirname(G),Q);PB({source:G,destination:me}).then(()=>{ee(),nt({title:"Notebook copied",description:"A copy of the notebook has been created."}),KS(me)})}})},q[0]=ee,q[1]=Y,q[2]=G,q[3]=oe):oe=q[3],oe}(e),y=Ot(Sd),v=Ot(XH),C=Ot(ZH),S=Le(zB),E=Le(BB),N=Le(v4),{selectedLayout:j}=rC(),{setLayoutView:T}=sC(),A=hg(),M=((I=d.sharing)==null?void 0:I.html)??!0,P=((W=d.sharing)==null?void 0:W.wasm)??!0,R=RN;let L;t[0]===Symbol.for("react.memo_cache_sentinel")?(L=c.jsx(eg,{size:14,strokeWidth:1.5}),t[0]=L):L=t[0];const B=!M&&!P;let U;t[1]===Symbol.for("react.memo_cache_sentinel")?(U=c.jsx(qB,{size:14,strokeWidth:1.5}),t[1]=U):U=t[1];const D=!M;let k,$;return t[2]!==o||t[3]!==n?(k=async()=>{n(c.jsx(xC,{onClose:o}))},t[2]=o,t[3]=n,t[4]=k):k=t[4],t[5]!==N||t[6]!==f||t[7]!==o||t[8]!==_||t[9]!==x||t[10]!==g||t[11]!==e||t[12]!==S||t[13]!==E||t[14]!==l||t[15]!==a||t[16]!==n||t[17]!==p||t[18]!==b||t[19]!==j||t[20]!==s||t[21]!==y||t[22]!==C||t[23]!==T||t[24]!==v||t[25]!==P||t[26]!==B||t[27]!==D||t[28]!==k||t[29]!==r||t[30]!==A||t[31]!==h||t[32]!==u||t[33]!==m||t[34]!==i.mode?($=[{icon:L,label:"Share",handle:Qs,hidden:B,dropdown:[{icon:U,label:"Publish HTML to web",hidden:D,handle:k},{icon:c.jsx(JS,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!P,handle:DN}]},{icon:c.jsx(Rm,{size:14,strokeWidth:1.5}),label:"Download",handle:Qs,dropdown:[{icon:c.jsx(lC,{size:14,strokeWidth:1.5}),label:"Download as HTML",handle:async()=>{e?await aC({filename:e,includeCode:!0}):nt({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."})}},{icon:c.jsx(lC,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{e?await aC({filename:e,includeCode:!1}):nt({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."})}},{icon:c.jsx(uc,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:ON},{icon:c.jsx(jp,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:MN},{divider:!0,icon:c.jsx(mp,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:i.mode!=="present",tooltip:i.mode==="present"?void 0:c.jsxs("span",{children:["Only available in app view. ",c.jsx("br",{}),"Toggle with: ",on("global.hideCode",!1)]}),handle:TN},{icon:c.jsx(UB,{size:14,strokeWidth:1.5}),label:"Download as PDF",disabled:i.mode!=="present",tooltip:i.mode==="present"?void 0:c.jsxs("span",{children:["Only available in app view. ",c.jsx("br",{}),"Toggle with: ",on("global.hideCode",!1)]}),handle:IN}]},{divider:!0,icon:c.jsx(Yp,{size:14,strokeWidth:1.5}),label:"Helper panel",handle:Qs,dropdown:yd.flatMap(G=>{const{type:q,Icon:Y,hidden:ee}=G;return ee?[]:{label:Om(q),rightElement:R(s===q),icon:c.jsx(Y,{size:14,strokeWidth:1.5}),handle:()=>r(q)}})},{icon:c.jsx(md,{size:14,strokeWidth:1.5}),label:"Present as",handle:Qs,dropdown:[{icon:i.mode==="present"?c.jsx(k4,{size:14,strokeWidth:1.5}):c.jsx(ud,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{A()}},...iC.map((G,q)=>{const Y=Hg(G);return{divider:q===0,label:Wg(G),icon:c.jsx(Y,{size:14,strokeWidth:1.5}),rightElement:c.jsx("div",{className:"w-8 flex justify-end",children:j===G&&c.jsx(Cc,{size:14})}),handle:()=>{T(G),i.mode==="edit"&&A()}}})]},{icon:c.jsx(Op,{size:14,strokeWidth:1.5}),label:"Create notebook copy",hidden:!e||un(),handle:x},{icon:c.jsx(id,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!e,handle:EN},{icon:c.jsx(vn,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!S||a,handle:async()=>{const G=Nn(),q=VB(G),Y=pc.fromEntries(q.map(jN));await ur({configs:Y});for(const ee of q)u({cellId:ee,config:{disabled:!1}})}},{icon:c.jsx(wn,{size:14,strokeWidth:1.5}),label:"Disable all cells",hidden:!E||a,handle:async()=>{const G=Nn(),q=K3(G),Y=pc.fromEntries(q.map(NN));await ur({configs:Y});for(const ee of q)u({cellId:ee,config:{disabled:!0}})}},{icon:c.jsx(vm,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:l},{icon:c.jsx(Cp,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:_},{icon:c.jsx(Sp,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:g},{icon:c.jsx(Ip,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{m({code:"# Initialization code that runs before all other cells"})}},{icon:c.jsx(Zi,{size:14,strokeWidth:1.5}),label:"Clear all outputs",handle:()=>{f()}},{icon:c.jsx(Tp,{size:14,strokeWidth:1.5}),label:"Re-run all cells",hotkey:"global.runAll",handle:async()=>{b()}},{icon:c.jsx(bd,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!N||a,handle:()=>{h()}},{icon:c.jsx(lr,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n(c.jsx($g,{onClose:o}))}},{divider:!0,icon:c.jsx(ad,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>y(CN)},{icon:c.jsx(Pm,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>v(SN)},{icon:c.jsx(Bp,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>C(kN)},{icon:c.jsx(XS,{size:14,strokeWidth:1.5}),label:"Open documentation",handle:vN},{icon:c.jsx(Nc,{size:14,strokeWidth:1.5}),label:"Resources",handle:Qs,dropdown:[{icon:c.jsx(XS,{size:14,strokeWidth:1.5}),label:"Documentation",handle:wN},{icon:c.jsx(QH,{size:14,strokeWidth:1.5}),label:"GitHub",handle:yN},{icon:c.jsx(eW,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:xN},{icon:c.jsx(tW,{size:14,strokeWidth:1.5}),label:"YouTube",handle:bN},{icon:c.jsx(ym,{size:14,strokeWidth:1.5}),label:"Changelog",handle:_N}]},{divider:!0,icon:c.jsx(Fp,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:gN},{icon:c.jsx(ja,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:pN},{icon:c.jsx(ig,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:p}].filter(mN).map(hN),t[5]=N,t[6]=f,t[7]=o,t[8]=_,t[9]=x,t[10]=g,t[11]=e,t[12]=S,t[13]=E,t[14]=l,t[15]=a,t[16]=n,t[17]=p,t[18]=b,t[19]=j,t[20]=s,t[21]=y,t[22]=C,t[23]=T,t[24]=v,t[25]=P,t[26]=B,t[27]=D,t[28]=k,t[29]=r,t[30]=A,t[31]=h,t[32]=u,t[33]=m,t[34]=i.mode,t[35]=$):$=t[35],$}function hN(t){return t.dropdown?{...t,dropdown:t.dropdown.filter(fN)}:t}function fN(t){return!t.hidden}function mN(t){return!t.hidden}function pN(){const t=WB();window.open(t,"_blank")}function gN(){const t=document.baseURI.split("?")[0];window.open(t,"_self")}function _N(){window.open(Zn.releasesPage,"_blank")}function bN(){window.open(Zn.youtube,"_blank")}function xN(){window.open(Zn.discordLink,"_blank")}function yN(){window.open(Zn.githubPage,"_blank")}function wN(){window.open(Zn.docsPage,"_blank")}function vN(){window.open(Zn.docsPage,"_blank")}function kN(t){return!t}function SN(t){return!t}function CN(t){return!t}function NN(t){return[t,{disabled:!0}]}function jN(t){return[t,{disabled:!1}]}async function EN(){const t=await Lm();await _n(t.contents),nt({title:"Copied",description:"Code copied to clipboard."})}async function IN(){const t=new Event("export-beforeprint"),e=new Event("export-afterprint");window.dispatchEvent(t),setTimeout(AN,0),setTimeout(()=>window.dispatchEvent(e),0)}function AN(){return window.print()}async function TN(){const t=document.getElementById("App");t&&await e4(t,document.title)}async function MN(){const t=await Lm();ia(new Blob([t.contents],{type:"text/plain"}),S4.toPY(document.title))}async function ON(){const t=await HB({download:!1});ia(new Blob([t],{type:"text/plain"}),S4.toMarkdown(document.title))}async function DN(){const t=await Lm(),e=$B({code:t.contents});await _n(e),nt({title:"Copied",description:"Link copied to clipboard."})}function RN(t){return c.jsx("div",{className:"w-8 flex justify-end",children:t&&c.jsx(Cc,{size:14})})}const PN=t=>{const e=K.c(28),{disabled:n,tooltip:o}=t,r=n!==void 0&&n,s=o===void 0?"Actions":o,i=Gg();let a,l,d;e[0]!==s?(a=c.jsx("div",{children:s}),e[0]=s,e[1]=a):a=e[1],e[2]!==r?(l=!r&&c.jsxs("div",{className:"text-xs text-muted-foreground font-medium pt-1 -mt-2 border-t border-border flex items-center gap-2",children:[c.jsx("span",{children:"Open command palette"}),on("global.commandPalette",!1)]}),e[2]=r,e[3]=l):l=e[3],e[4]!==a||e[5]!==l?(d=c.jsxs("div",{className:"flex flex-col gap-2",children:[a,l]}),e[4]=a,e[5]=l,e[6]=d):d=e[6];const u=d,h=r?"disabled":"hint-green";let f,m,_;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=c.jsx(mW,{strokeWidth:1.8}),e[7]=f):f=e[7],e[8]!==u?(m=c.jsx(Te,{content:u,children:f}),e[8]=u,e[9]=m):m=e[9],e[10]!==r||e[11]!==h||e[12]!==m?(_=c.jsx(xn,{"aria-label":"Config",shape:"circle",size:"small",className:"h-[27px] w-[27px]","data-testid":"notebook-menu-dropdown",disabled:r,color:h,children:m}),e[10]=r,e[11]=h,e[12]=m,e[13]=_):_=e[13];const g=_,p=LN;let b;e[14]===Symbol.for("react.memo_cache_sentinel")?(b=j=>{const T=c.jsx(Vt,{variant:j.variant,disabled:j.disabled,onSelect:A=>j.handle(A),"data-testid":`notebook-menu-dropdown-${j.label}`,children:p(j)},j.label);return j.tooltip?c.jsx(Te,{content:j.tooltip,side:"left",delayDuration:100,children:c.jsx("span",{children:T})},j.label):T},e[14]=b):b=e[14];const x=b;let y,v,C,S,E,N;if(e[15]!==g||e[16]!==r?(y=c.jsx(fr,{asChild:!0,disabled:r,children:g}),e[15]=g,e[16]=r,e[17]=y):y=e[17],e[18]!==i){let j;e[20]===Symbol.for("react.memo_cache_sentinel")?(j=T=>T.hidden?null:T.dropdown?c.jsxs(GB,{children:[c.jsx(YB,{"data-testid":`notebook-menu-dropdown-${T.label}`,children:p(T)}),c.jsx(JB,{children:c.jsx(KB,{children:T.dropdown.map(A=>c.jsxs(X.Fragment,{children:[A.divider&&c.jsx(bn,{}),x(A)]},A.label))})})]},T.label):c.jsxs(X.Fragment,{children:[T.divider&&c.jsx(bn,{}),x(T)]},T.label),e[20]=j):j=e[20],v=i.map(j),e[18]=i,e[19]=v}else v=e[19];return e[21]===Symbol.for("react.memo_cache_sentinel")?(C=c.jsx(bn,{}),e[21]=C):C=e[21],e[22]===Symbol.for("react.memo_cache_sentinel")?(S=c.jsx("div",{className:"flex-1 px-2 text-xs text-muted-foreground",children:c.jsxs("span",{children:["Version: ",C4()]})}),e[22]=S):S=e[22],e[23]!==v?(E=c.jsxs(mr,{align:"end",className:"no-print w-[240px]",children:[v,C,S]}),e[23]=v,e[24]=E):E=e[24],e[25]!==y||e[26]!==E?(N=c.jsxs(hr,{modal:!1,children:[y,E]}),e[25]=y,e[26]=E,e[27]=N):N=e[27],N};function LN(t){return c.jsxs(c.Fragment,{children:[t.icon&&c.jsx("span",{className:"flex-0 mr-2",children:t.icon}),c.jsx("span",{className:"flex-1",children:t.labelElement||t.label}),t.hotkey&&c.jsx(XB,{shortcut:t.hotkey,className:"ml-4"}),t.rightElement]})}function jd(t){return zo("create"in t,'Expected query to have a "create" method'),t}const en=ZB({findText:"",replaceText:"",caseSensitive:!1,wholeWord:!1,regexp:!1,isOpen:!1,currentView:void 0},(t,e)=>{if(e===void 0)return t;switch(e.type){case"setFind":return{...t,findText:e.find};case"setReplace":return{...t,replaceText:e.replace};case"setCaseSensitive":return{...t,caseSensitive:e.caseSensitive};case"setWholeWord":return{...t,wholeWord:e.wholeWord};case"setRegex":return{...t,regexp:e.regexp};case"setIsOpen":return{...t,isOpen:e.isOpen};case"setCurrentView":return{...t,currentView:{view:e.view,range:e.range}};case"clearCurrentView":return{...t,currentView:void 0}}});function Yg(t){if([...document.querySelectorAll('[role="dialog"][data-state="open"]')].some(e=>e instanceof HTMLElement&&e.childNodes.length>0))return!1;if(t){const e=t.state.selection.main,n=t.state.sliceDoc(e.from,e.to);n?(at.set(en,{type:"setFind",find:n}),at.set(en,{type:"setCurrentView",view:t,range:{from:e.from,to:e.to}})):at.set(en,{type:"setCurrentView",view:t,range:{from:0,to:0}})}return at.get(en).isOpen?(at.set(en,{type:"setIsOpen",isOpen:!1}),requestAnimationFrame(()=>{at.set(en,{type:"setIsOpen",isOpen:!0})}),!0):(at.set(en,{type:"setIsOpen",isOpen:!0}),!0)}function FN(){return!!at.get(en).isOpen&&(at.set(en,{type:"setIsOpen",isOpen:!1}),!0)}function Fa(t){return()=>{const e=at.get(en),n=new jc({search:e.findText,caseSensitive:e.caseSensitive,regexp:e.regexp,replace:e.replaceText,wholeWord:e.wholeWord});return!!n.valid&&t({query:jd(n).create(),search:n})}}const Jg=t=>Fa(({query:e})=>{const n=Ps(),o=at.get(en).currentView||{view:n[0],range:{from:0,to:0}};let r=o.range.to;t==="prev"&&(n.reverse(),r=o.range.from);let s=n.indexOf(o.view);s<0&&(s=0);const i=[...n,...n].slice(s);for(const a of i){const l=t==="next"?e.nextMatch(a.state,0,r??0):e.prevMatch(a.state,r??a.state.doc.length,a.state.doc.length);if(!l){r=null,a.dispatch({selection:Bo.single(0)});continue}const d=Bo.single(l.from,l.to);return a.dispatch({selection:d,effects:[et.scrollIntoView(d.main,{y:"center"})],userEvent:"select.search"}),at.set(en,{type:"setCurrentView",view:a,range:{from:l.from,to:l.to}}),l}return!1}),Ed=Jg("next"),Kg=Jg("prev"),zN=Fa(({query:t})=>{var o;const e=Ps(),n=[];for(const r of e){if(r.state.readOnly)continue;const s=(o=t.matchAll(r.state,1e9))==null?void 0:o.map(a=>{const{from:l,to:d}=a;return{from:l,to:d,insert:t.getReplacement(a)}});if(!s||s.length===0)continue;const i=r.state.doc.toString();n.push(()=>{r.dispatch({changes:[{from:0,to:r.state.doc.length,insert:i}],userEvent:"input.replace.all"})}),r.dispatch({changes:s,userEvent:"input.replace.all"})}return()=>{for(const r of n)r()}}),BN=Fa(({query:t})=>{const e=Ps(),n=at.get(en).currentView||{view:e[0],range:{from:0}};let o=n.range.from,r=e.indexOf(n.view);r<0&&(r=0);const s=[...e,...e].slice(r);for(const i of s){const a=t.nextMatch(i.state,0,o??0);if(!a){o=null,i.dispatch({selection:Bo.single(0)});continue}const l=i.state.toText(t.getReplacement(a));return i.dispatch({changes:[{from:a.from,to:a.to,insert:l}],userEvent:"input.replace"}),Ed()}return!1}),UN=Fa(({query:t})=>{const e=Ps();let n=0;const o=new Map;for(const r of e){const s=t.matchAll(r.state,1e9)||[];for(const i of s){const{from:a,to:l}=i,d=o.get(r)||new Map;d.set(`${a}:${l}`,n++),o.set(r,d)}}return{count:n,position:o}}),Id=Dt.define();function Xg(){const t=Ps();for(const e of t)e.state.readOnly||e.dispatch({effects:Id.of(new jc({search:""}))})}const za=In.define({create(){const t=at.get(en);return jd(new jc({search:t.findText,caseSensitive:t.caseSensitive,regexp:t.regexp,replace:t.replaceText,wholeWord:t.wholeWord})).create()},update(t,e){for(const n of e.effects)n.is(Id)&&(t=jd(n.value).create());return t}}),VN=dt.mark({class:"cm-searchMatch"}),$N=dt.mark({class:"cm-searchMatch cm-searchMatch-selected"}),HN=En.fromClass(class{constructor(t){this.view=t,this.decorations=void 0,this.decorations=this.highlight(t.state.field(za))}update(t){const e=t.state.field(za);(e!==t.startState.field(za)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight(t){if(!t.spec.valid)return dt.none;const{view:e}=this,n=new Ls,o=e.visibleRanges,r=o.length;for(let s=0;s<r;s++){let{to:i}=o[s];const{from:a}=o[s];for(;s<r-1&&i>o[s+1].from-500;)i=o[++s].to;t.highlight(e.state,a,i,(l,d)=>{const u=e.state.selection.ranges.some(h=>h.from===l&&h.to===d);n.add(l,d,u?$N:VN)})}return n.finish()}},{decorations:t=>t.decorations}),WN=et.baseTheme({"&light .cm-searchMatch":{backgroundColor:"#99ff7780"},"&dark .cm-searchMatch":{backgroundColor:"#22bb0070"},"&light .cm-searchMatch-selected":{backgroundColor:"transparent"},"&dark .cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff88 !important"}}),qN=()=>{var He;const t=K.c(102),[e,n]=O.useState(!1),[o,r]=Qt(en),[s,i]=O.useState(),a=O.useRef(null),l=Le(mc);let d,u;t[0]!==e||t[1]!==o.isOpen?(d=()=>(!e||!o.isOpen)&&Yg(),t[0]=e,t[1]=o.isOpen,t[2]=d):d=t[2],Jt("cell.findAndReplace",d),t[3]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{const Fe=UN();i(Fe===!1?void 0:Fe)},t[3]=u):u=t[3];const h=u;let f,m,_,g;if(t[4]!==o.isOpen?(f=()=>{o.isOpen&&a.current&&(a.current.focus(),a.current.select())},m=[o.isOpen],t[4]=o.isOpen,t[5]=f,t[6]=m):(f=t[5],m=t[6]),O.useEffect(f,m),t[7]!==o.findText||t[8]!==o.isOpen?(_=()=>{if(o.isOpen){if(o.findText==="")return i(void 0),void Xg();h(),function(){const Fe=at.get(en),it=Ps();for(const Qe of it)Qe.state.readOnly||Qe.dispatch({effects:Id.of(new jc({search:Fe.findText,caseSensitive:Fe.caseSensitive,regexp:Fe.regexp,replace:Fe.replaceText,wholeWord:Fe.wholeWord}))})}()}else Xg()},t[7]=o.findText,t[8]=o.isOpen,t[9]=_):_=t[9],t[10]!==o.caseSensitive||t[11]!==o.findText||t[12]!==o.isOpen||t[13]!==o.regexp||t[14]!==o.wholeWord?(g=[o.findText,o.isOpen,o.caseSensitive,o.regexp,o.wholeWord],t[10]=o.caseSensitive,t[11]=o.findText,t[12]=o.isOpen,t[13]=o.regexp,t[14]=o.wholeWord,t[15]=g):g=t[15],O.useEffect(_,g),!o.isOpen)return null;const p=o.currentView;let b;t[16]!==s||t[17]!==p?(b=p&&s?(He=s.position.get(p.view))==null?void 0:He.get(`${p.range.from}:${p.range.to}`):void 0,t[16]=s,t[17]=p,t[18]=b):b=t[18];const x=b;let y,v,C,S,E,N,j,T,A,M,P;t[19]===Symbol.for("react.memo_cache_sentinel")?(y=()=>n(!0),t[19]=y):y=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(v=()=>n(!1),t[20]=v):v=t[20],t[21]!==r?(C=Fe=>{Fe.key==="Escape"&&r({type:"setIsOpen",isOpen:!1})},t[21]=r,t[22]=C):C=t[22],t[23]!==r?(S=()=>r({type:"setIsOpen",isOpen:!1}),t[23]=r,t[24]=S):S=t[24],t[25]===Symbol.for("react.memo_cache_sentinel")?(E=c.jsx(eo,{className:"w-4 h-4"}),t[25]=E):E=t[25],t[26]!==S?(N=c.jsx("div",{className:"absolute top-0 right-0",children:c.jsx(Ae,{"data-testid":"close-find-replace-button",onClick:S,size:"xs",variant:"text",children:E})}),t[26]=S,t[27]=N):N=t[27],t[28]!==r?(j=Fe=>{r({type:"setFind",find:Fe.target.value})},t[28]=r,t[29]=j):j=t[29],t[30]!==o.findText||t[31]!==j?(T=c.jsx(ir,{ref:a,"data-testid":"find-input",value:o.findText,autoFocus:!0,className:"mr-2 mb-0",placeholder:"Find",onKeyDown:YN,onChange:j}),t[30]=o.findText,t[31]=j,t[32]=T):T=t[32],t[33]!==r?(A=Fe=>{r({type:"setReplace",replace:Fe.target.value})},t[33]=r,t[34]=A):A=t[34],t[35]!==o.replaceText||t[36]!==A?(M=c.jsx(ir,{"data-testid":"replace-input",value:o.replaceText,placeholder:"Replace",onChange:A}),t[35]=o.replaceText,t[36]=A,t[37]=M):M=t[37],t[38]!==T||t[39]!==M?(P=c.jsxs("div",{className:"flex flex-col flex-2 gap-2 w-[55%]",children:[T,M]}),t[38]=T,t[39]=M,t[40]=P):P=t[40];const R=o.caseSensitive?"on":"off";let L,B,U;t[41]!==r?(L=Fe=>r({type:"setCaseSensitive",caseSensitive:Fe}),t[41]=r,t[42]=L):L=t[42],t[43]===Symbol.for("react.memo_cache_sentinel")?(B=c.jsx(QB,{className:"w-4 h-4"}),t[43]=B):B=t[43],t[44]!==o.caseSensitive||t[45]!==R||t[46]!==L?(U=c.jsx(Te,{content:"Case Sensitive",children:c.jsx(Fm,{size:"sm",pressed:o.caseSensitive,"data-state":R,onPressedChange:L,children:B})}),t[44]=o.caseSensitive,t[45]=R,t[46]=L,t[47]=U):U=t[47];const D=o.wholeWord?"on":"off";let k,$,I;t[48]!==r?(k=Fe=>r({type:"setWholeWord",wholeWord:Fe}),t[48]=r,t[49]=k):k=t[49],t[50]===Symbol.for("react.memo_cache_sentinel")?($=c.jsx(ug,{className:"w-4 h-4"}),t[50]=$):$=t[50],t[51]!==o.wholeWord||t[52]!==D||t[53]!==k?(I=c.jsx(Te,{content:"Match Whole Word",children:c.jsx(Fm,{size:"sm",pressed:o.wholeWord,"data-state":D,onPressedChange:k,children:$})}),t[51]=o.wholeWord,t[52]=D,t[53]=k,t[54]=I):I=t[54];const W=o.regexp?"on":"off";let G,q,Y,ee,oe;t[55]!==r?(G=Fe=>r({type:"setRegex",regexp:Fe}),t[55]=r,t[56]=G):G=t[56],t[57]===Symbol.for("react.memo_cache_sentinel")?(q=c.jsx(Xp,{className:"w-4 h-4"}),t[57]=q):q=t[57],t[58]!==o.regexp||t[59]!==W||t[60]!==G?(Y=c.jsx(Te,{content:"Use Regular Expression",children:c.jsx(Fm,{size:"sm",pressed:o.regexp,"data-state":W,onPressedChange:G,children:q})}),t[58]=o.regexp,t[59]=W,t[60]=G,t[61]=Y):Y=t[61],t[62]!==U||t[63]!==I||t[64]!==Y?(ee=c.jsxs("div",{className:"flex items-center gap-[2px]",children:[U,I,Y]}),t[62]=U,t[63]=I,t[64]=Y,t[65]=ee):ee=t[65],t[66]===Symbol.for("react.memo_cache_sentinel")?(oe=()=>{BN()&&h()},t[66]=oe):oe=t[66];const ie=o.findText==="";let Z,Q;t[67]!==ie?(Z=c.jsx(Ae,{"data-testid":"replace-next-button",size:"xs",variant:"outline",className:"h-6 text-xs",onClick:oe,disabled:ie,children:"Replace Next"}),t[67]=ie,t[68]=Z):Z=t[68],t[69]===Symbol.for("react.memo_cache_sentinel")?(Q=()=>{const Fe=zN();if(!Fe)return;h();const{dismiss:it}=nt({title:"Replaced all occurrences",action:c.jsx(Da,{"data-testid":"undo-replace-all-button",onClick:()=>{Fe(),Qe()}})}),Qe=it},t[69]=Q):Q=t[69];const me=o.findText==="";let fe,de,ue,ce,ke,Se,ae,Ce,_e,Ee,ze,Oe;return t[70]!==me?(fe=c.jsx(Ae,{"data-testid":"replace-all-button",size:"xs",variant:"outline",className:"h-6 text-xs",onClick:Q,disabled:me,children:"Replace All"}),t[70]=me,t[71]=fe):fe=t[71],t[72]!==Z||t[73]!==fe?(de=c.jsxs("div",{className:"flex items-center gap-[2px]",children:[Z,fe]}),t[72]=Z,t[73]=fe,t[74]=de):de=t[74],t[75]!==ee||t[76]!==de?(ue=c.jsxs("div",{className:"flex flex-col gap-2",children:[ee,de]}),t[75]=ee,t[76]=de,t[77]=ue):ue=t[77],t[78]!==P||t[79]!==ue?(ce=c.jsxs("div",{className:"flex items-center gap-3",children:[P,ue]}),t[78]=P,t[79]=ue,t[80]=ce):ce=t[80],t[81]===Symbol.for("react.memo_cache_sentinel")?(ke=c.jsx(Te,{content:"Find Previous",children:c.jsx(Ae,{"data-testid":"find-prev-button",size:"xs",variant:"secondary",onClick:JN,children:c.jsx(It,{className:"w-4 h-4"})})}),t[81]=ke):ke=t[81],t[82]===Symbol.for("react.memo_cache_sentinel")?(Se=c.jsx(Te,{content:"Find Next",children:c.jsx(Ae,{"data-testid":"find-next-button",size:"xs",variant:"secondary",onClick:KN,children:c.jsx(sd,{className:"w-4 h-4"})})}),t[82]=Se):Se=t[82],t[83]!==x||t[84]!==s?(ae=s!=null&&x==null&&c.jsxs("span",{className:"text-sm",children:[s.count," matches"]}),t[83]=x,t[84]=s,t[85]=ae):ae=t[85],t[86]!==x||t[87]!==s?(Ce=s!=null&&x!=null&&c.jsxs("span",{className:"text-sm",children:[x+1," of ",s.count]}),t[86]=x,t[87]=s,t[88]=Ce):Ce=t[88],t[89]!==ae||t[90]!==Ce?(_e=c.jsxs("div",{className:"flex items-center gap-2",children:[ke,Se,ae,Ce]}),t[89]=ae,t[90]=Ce,t[91]=_e):_e=t[91],t[92]!==l?(Ee=l.getHotkey("cell.findAndReplace"),t[92]=l,t[93]=Ee):Ee=t[93],t[94]!==Ee.key?(ze=c.jsxs("div",{className:"text-xs text-muted-foreground flex gap-1 mt-2",children:["Press"," ",c.jsx(Em,{shortcut:Ee.key})," ","again to open the native browser search."]}),t[94]=Ee.key,t[95]=ze):ze=t[95],t[96]!==N||t[97]!==ce||t[98]!==_e||t[99]!==ze||t[100]!==C?(Oe=c.jsx(eU,{restoreFocus:!0,autoFocus:!0,children:c.jsxs("div",{onFocus:y,onClick:GN,onBlur:v,className:"fixed top-0 right-0 w-[500px] flex flex-col bg-[var(--sage-1)] p-4 z-50 mt-2 mr-3 rounded-md shadow-lg border gap-2 print:hidden",onKeyDown:C,children:[N,ce,_e,ze]})}),t[96]=N,t[97]=ce,t[98]=_e,t[99]=ze,t[100]=C,t[101]=Oe):Oe=t[101],Oe};function GN(t){t.stopPropagation(),t.preventDefault()}function YN(t){t.key==="Enter"&&(t.shiftKey?Kg():Ed())}function JN(){return Kg()}function KN(){return Ed()}const Zg=t=>{const e=K.c(38),{resetOnBlur:n,placeholderText:o,initialValue:r,flexibleWidth:s,onNameChange:i,className:a}=t,l=n!==void 0&&n,d=r===void 0?null:r,u=s!==void 0&&s,[h,f]=O.useState(d);let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=[],e[0]=m):m=e[0];const[_,g]=O.useState(m),[p,b]=O.useState(!1),x=O.useRef(null),y=O.useRef(!1);let v,C,S;e[1]!==d?(v=()=>{f(d)},C=[d],e[1]=d,e[2]=v,e[3]=C):(v=e[2],C=e[3]),O.useEffect(v,C),e[4]===Symbol.for("react.memo_cache_sentinel")?(S=()=>{b(!0)},e[4]=S):S=e[4];const E=S;let N;e[5]!==d||e[6]!==l?(N=Q=>{var me;(me=Q.relatedTarget)!=null&&me.closest(".filename-input")||(b(!1),l&&f(d))},e[5]=d,e[6]=l,e[7]=N):N=e[7];const j=N;let T;e[8]!==h?(T=jn.dirname(h||""),e[8]=h,e[9]=T):T=e[9];const A=T,M=jn.basename(h||""),P=_.filter(Q=>jn.basename(Q.path).startsWith(M));let R,L;e[10]!==A||e[11]!==p?(R=async()=>{if(!p)return void g([]);const Q=await E4({path:A});g(Q.files)},L=[A,p],e[10]=A,e[11]=p,e[12]=R,e[13]=L):(R=e[12],L=e[13]);const{isPending:B}=Wn(R,L),U=function(Q,me,fe){if(Q&&!Q.endsWith("/")&&((Mm("markdown")?new Set(["py","md","markdown","qmd"]):new Set(["py"])).has(jn.extension(Q))||(Q=Q.endsWith(".")?`${Q}py`:Q.endsWith(".p")?`${Q}y`:`${Q}.py`),!me.some(de=>de.path===Q||jn.basename(de.path)===Q)&&!(fe&&(fe===Q||jn.basename(fe)===Q))))return Q}(h,_,d),D=(U||P.length>0)&&c.jsxs(Nm,{className:"font-mono",children:[!B&&c.jsx(gc,{children:"No files"}),U&&c.jsxs(mo,{variant:"success",className:"py-2 px-3",onSelect:()=>{var Q;U&&(y.current=!0,i(U),(Q=x.current)==null||Q.blur())},children:[c.jsx(Mp,{className:"w-4 h-4 mr-2"})," ",c.jsxs("span",{className:"text-sm",children:[d?"Rename to: ":"Save as: ",c.jsx("span",{className:"font-medium text-sm",children:jn.basename(U)})]})]},"_rename_"),P.map(Q=>{const me=Q.isDirectory?"directory":N4(Q.path),fe=j4[me];return c.jsxs(mo,{variant:Q.isDirectory?"default":"muted",className:"py-2 px-3",onSelect:()=>{Q.isDirectory?f(`${Q.path}/`):f(Q.path)},children:[c.jsx(fe,{className:"w-4 h-4 mr-2"})," ",jn.basename(Q.path)]},Q.path)})]}),k=10*Math.max(20,(h==null?void 0:h.length)||(o==null?void 0:o.length)||0),$=p?h||"":d||"";let I,W,G;e[14]!==u||e[15]!==k?(I=u?{maxWidth:k}:void 0,e[14]=u,e[15]=k,e[16]=I):I=e[16],e[17]!==a?(W=Ne(a,"w-full px-4 py-1 my-1 h-9 font-mono text-foreground/60"),e[17]=a,e[18]=W):W=e[18],e[19]!==o||e[20]!==$||e[21]!==I||e[22]!==W?(G=c.jsx(tU,{children:c.jsx(na,{"data-testid":"dir-completion-input",tabIndex:-1,rootClassName:"border-none justify-center px-1",spellCheck:"false",value:$,onKeyDown:XN,icon:null,ref:x,onValueChange:f,placeholder:o,autoComplete:"off",style:I,className:W})}),e[19]=o,e[20]=$,e[21]=I,e[22]=W,e[23]=G):G=e[23];const q=D&&"group-focus-within:block";let Y,ee,oe,ie,Z;return e[24]!==q?(Y=Ne("p-0 w-full min-w-80 max-w-80vw hidden",q),e[24]=q,e[25]=Y):Y=e[25],e[26]!==D||e[27]!==Y?(ee=c.jsx(Fs,{side:"bottom",className:Y,portal:!1,children:D}),e[26]=D,e[27]=Y,e[28]=ee):ee=e[28],e[29]!==G||e[30]!==ee?(oe=c.jsxs(Nm,{children:[G,ee]}),e[29]=G,e[30]=ee,e[31]=oe):oe=e[31],e[32]!==j||e[33]!==oe?(ie=c.jsx(Ec,{onFocus:E,onBlur:j,shouldFilter:!1,id:"filename-input",className:"bg-transparent group filename-input",children:oe}),e[32]=j,e[33]=oe,e[34]=ie):ie=e[34],e[35]!==p||e[36]!==ie?(Z=c.jsx(Ic,{children:c.jsx(Ur,{open:p,modal:!1,children:ie})}),e[35]=p,e[36]=ie,e[37]=Z):Z=e[37],Z};function XN(t){t.key==="Escape"&&t.currentTarget.blur()}const ZN=t=>{const e=K.c(33),n=()=>{ia(new Blob([o()],{type:"text/plain"}),`${t.proposedName}.json`)},o=qe(tj);let r,s,i,a,l,d,u,h,f,m,_,g,p,b,x,y,v;return e[0]!==n||e[1]!==t?(r=C=>{C.preventDefault(),n(),t.closeModal()},e[0]=n,e[1]=t,e[2]=r):r=e[2],e[3]!==t?(s=C=>{C.key==="Escape"&&t.closeModal()},e[3]=t,e[4]=s):s=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(sr,{className:"text-accent-foreground mb-6",children:"Download unsaved changes?"}),e[5]=i):i=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(a={wordBreak:"break-word"},e[6]=a):a=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx("p",{children:"This app has unsaved changes. To recover:"}),d={paddingBottom:"10px"},e[7]=l,e[8]=d):(l=e[7],d=e[8]),e[9]!==t.proposedName?(u=c.jsxs("li",{style:d,children:['Click the "Download" button. This will download a file called\xA0',c.jsxs("code",{children:[t.proposedName,".json"]}),". This file contains your code."]}),e[9]=t.proposedName,e[10]=u):u=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(h={paddingBottom:"10px"},e[11]=h):h=e[11],e[12]===Symbol.for("react.memo_cache_sentinel")?(f={display:"block",padding:"10px"},e[12]=f):f=e[12],e[13]!==t.proposedName?(m=c.jsxs("code",{style:f,children:["marimo recover ",t.proposedName,".json ",">"," ",t.proposedName,".py"]}),e[13]=t.proposedName,e[14]=m):m=e[14],e[15]!==t.proposedName?(_=c.jsxs("code",{children:[t.proposedName,".py"]}),e[15]=t.proposedName,e[16]=_):_=e[16],e[17]!==_||e[18]!==m?(g=c.jsxs("li",{style:h,children:["In your terminal, type",m,"to overwrite ",_," with the recovered changes."]}),e[17]=_,e[18]=m,e[19]=g):g=e[19],e[20]!==g||e[21]!==u?(p=c.jsx(Ms,{className:"markdown break-words",style:a,children:c.jsxs("div",{className:"prose dark:prose-invert",children:[l,c.jsxs("ol",{children:[u,g]})]})}),e[20]=g,e[21]=u,e[22]=p):p=e[22],e[23]!==t.closeModal?(b=c.jsx(Ae,{"aria-label":"Cancel",variant:"secondary","data-testid":"cancel-recovery-button",onClick:t.closeModal,children:"Cancel"}),e[23]=t.closeModal,e[24]=b):b=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(x=c.jsx(Ae,{"data-testid":"download-recovery-button","aria-label":"Download",variant:"default",type:"submit",children:"Download"}),e[25]=x):x=e[25],e[26]!==b?(y=c.jsxs(Ki,{children:[b,x]}),e[26]=b,e[27]=y):y=e[27],e[28]!==r||e[29]!==s||e[30]!==p||e[31]!==y?(v=c.jsx(ar,{className:"w-fit",children:c.jsxs("form",{onSubmit:r,onKeyDown:s,children:[i,p,y]})}),e[28]=r,e[29]=s,e[30]=p,e[31]=y,e[32]=v):v=e[32],v},QN=t=>{const e=K.c(12),{filename:n,needsSave:o}=t,{openModal:r,closeModal:s}=$n();let i;e[0]!==n?(i=n===null?"app":jn.basename(n).split(".")[0],e[0]=n,e[1]=i):i=e[1];const a=i;let l;e[2]!==s||e[3]!==o||e[4]!==r||e[5]!==a?(l=()=>{o&&r(c.jsx(ZN,{proposedName:a,closeModal:s}))},e[2]=s,e[3]=o,e[4]=r,e[5]=a,e[6]=l):l=e[6];const d=l;let u;Jt("global.save",d),e[7]===Symbol.for("react.memo_cache_sentinel")?(u=on("global.save"),e[7]=u):u=e[7];const h=o?"yellow":"gray";let f,m;return e[8]===Symbol.for("react.memo_cache_sentinel")?(f=c.jsx(Ia,{strokeWidth:1.5,size:18}),e[8]=f):f=e[8],e[9]!==d||e[10]!==h?(m=c.jsx(Te,{content:u,children:c.jsx(xn,{onClick:d,id:"save-button","aria-label":"Save",className:"rectangle",color:h,children:f})}),e[9]=d,e[10]=h,e[11]=m):m=e[11],m};function ej(t){return{id:t.id,name:t.name,code:t.code,code_hash:null,config:{column:0,...t.config}}}function tj(){const t=Nn(),e=zm(t),n={version:"1",metadata:{marimo_version:C4()},cells:e.map(ej)};return JSON.stringify(n,null,2)}const Ad=5e3;async function nj(){await sU({download:!1})}async function oj(){await rU({download:!1,includeCode:!0,files:tC.INSTANCE.filenames()})}async function rj(){await oU({download:!1})}const Td=zt(void 0),Qg=zt(t=>{const e=t(Td);return function({state:n,layout:o,lastSavedNotebook:r}){if(!r)return!1;const{cellIds:s,cellData:i}=n,a=s.inOrderIds.map(h=>i[h]),l=a.map(h=>h.code),d=a.map(h=>h.config),u=a.map(h=>h.name);return!(I4(l,r.codes)&&I4(u,r.names)&&aa(d,r.configs)&&aa(o.selectedLayout,r.layout.selectedLayout)&&aa(o.layoutData,r.layout.layoutData))}({state:t(cr),layout:t(cC),lastSavedNotebook:e})});function sj(t){return JSON.stringify(t)}const ij=t=>{const e=K.c(15),{kioskMode:n}=t,o=Dm(),r=Le(Qg),s=Le(hn).state===$t.CLOSED,{saveOrNameNotebook:i,saveIfNotebookIsPersistent:a}=Md();let l,d,u;e[0]!==n||e[1]!==a?(l={onSave:a,kioskMode:n},e[0]=n,e[1]=a,e[2]=l):l=e[2],function(p){const b=K.c(14),x=Le(O4),y=Ac(),[v]=Qt(hn),C=Le(Qg);let S,E;if(b[0]!==y){const M=zm(y);S=M.map(uj),E=M.map(dj),b[0]=y,b[1]=S,b[2]=E}else S=b[1],E=b[2];const N=E;let j;b[3]!==y?(j=M4(y),b[3]=y,b[4]=j):j=b[4];const T=j;let A;b[5]!==x||b[6]!==N||b[7]!==S||b[8]!==T||b[9]!==v||b[10]!==C||b[11]!==p.kioskMode||b[12]!==p.onSave?(A={onSave:p.onSave,needsSave:C,codes:S,cellConfigs:T,cellNames:N,connStatus:v,config:x,kioskMode:p.kioskMode},b[5]=x,b[6]=N,b[7]=S,b[8]=T,b[9]=v,b[10]=C,b[11]=p.kioskMode,b[12]=p.onSave,b[13]=A):A=b[13],function(M){const P=K.c(21),{codes:R,cellConfigs:L,config:B,connStatus:U,cellNames:D,needsSave:k,kioskMode:$,onSave:I}=M,W=O.useRef(null);let G;P[0]!==R?(G=R.join(":"),P[0]=R,P[1]=G):G=P[1];const q=G;let Y;P[2]!==L?(Y=L.map(sj).join(":"),P[2]=L,P[3]=Y):Y=P[3];const ee=Y;let oe;P[4]!==D?(oe=D.join(":"),P[4]=D,P[5]=oe):oe=P[5];const ie=oe;let Z,Q;P[6]!==B||P[7]!==U.state||P[8]!==$||P[9]!==k||P[10]!==I?(Z=()=>{if(!$)return B.autosave==="after_delay"&&(W.current!==null&&clearTimeout(W.current),k&&U.state===$t.OPEN&&(W.current=setTimeout(I,B.autosave_delay))),()=>{W.current!==null&&clearTimeout(W.current)}},P[6]=B,P[7]=U.state,P[8]=$,P[9]=k,P[10]=I,P[11]=Z):Z=P[11],P[12]!==ee||P[13]!==ie||P[14]!==q||P[15]!==B||P[16]!==U.state||P[17]!==$||P[18]!==k||P[19]!==I?(Q=[q,ee,ie,B,U.state,I,$,k],P[12]=ee,P[13]=ie,P[14]=q,P[15]=B,P[16]=U.state,P[17]=$,P[18]=k,P[19]=I,P[20]=Q):Q=P[20],O.useEffect(Z,Q)}(A)}(l),function(){const p=K.c(6),b=Le(nU),{state:x}=Le(hn),y=b.auto_download.includes("markdown"),v=b.auto_download.includes("html"),C=b.auto_download.includes("ipynb"),S=!y||x!==$t.OPEN,E=!v||x!==$t.OPEN,N=!C||x!==$t.OPEN;let j,T,A;p[0]!==S?(j={delayMs:Ad,whenVisible:!0,disabled:S},p[0]=S,p[1]=j):j=p[1],ya(rj,j),p[2]!==E?(T={delayMs:Ad,whenVisible:!0,disabled:E},p[2]=E,p[3]=T):T=p[3],ya(oj,T),p[4]!==N?(A={delayMs:Ad,whenVisible:!0,disabled:N},p[4]=N,p[5]=A):A=p[5],ya(nj,A)}(),e[3]!==r?(d=p=>{if(r)return p.preventDefault(),p.returnValue="You have unsaved changes. Are you sure you want to leave?",p.returnValue},e[3]=r,e[4]=d):d=e[4],ac(window,"beforeunload",d),e[5]!==i?(u=p=>{p.preventDefault(),p.stopPropagation(),i()},e[5]=i,e[6]=u):u=e[6];const h=u;if(Jt("global.save",i),s){let p;return e[7]!==o||e[8]!==r?(p=c.jsx(QN,{filename:o,needsSave:r}),e[7]=o,e[8]=r,e[9]=p):p=e[9],p}let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=on("global.save"),e[10]=f):f=e[10];const m=r?"yellow":"hint-green";let _,g;return e[11]===Symbol.for("react.memo_cache_sentinel")?(_=c.jsx(Ia,{strokeWidth:1.5,size:18}),e[11]=_):_=e[11],e[12]!==h||e[13]!==m?(g=c.jsx(Te,{content:f,children:c.jsx(xn,{"data-testid":"save-button",id:"save-button",shape:"rectangle",color:m,onClick:h,children:_})}),e[12]=h,e[13]=m,e[14]=g):g=e[14],g};function Md(){const t=K.c(19),{openModal:e,closeModal:n,openAlert:o}=$n(),r=Ot(Td),s=A4(),i=T4();let a;t[0]!==o||t[1]!==r||t[2]!==i?(a=(p,b)=>{const x=Nn(),y=zm(x),v=y.map(cj),C=y.map(lj),S=y.map(aj),E=M4(x),N=i.get(hn),j=i.get(O4),T=i.get(cC);i.get(Os)||C.length!==0&&(N.state===$t.OPEN?(vt.log("saving to ",p),iU({cellIds:v,codes:C,names:S,filename:p,configs:E,layout:pW(),persist:!0}).then(()=>{b&&j.format_on_save&&D4(),r({names:S,codes:C,configs:E,layout:T})})):o("Failed to save notebook: not connected to a kernel."))},t[0]=o,t[1]=r,t[2]=i,t[3]=a):a=t[3];const l=qe(a);let d;t[4]!==l||t[5]!==i?(d=p=>{const b=p!==void 0&&p,x=i.get(R4),y=i.get(hn);e1(x)&&y.state===$t.OPEN&&l(x,b)},t[4]=l,t[5]=i,t[6]=d):d=t[6];const u=qe(d);let h;t[7]!==l||t[8]!==s?(h=p=>{s(p).then(b=>{b!==null&&l(b,!0)})},t[7]=l,t[8]=s,t[9]=h):h=t[9];const f=h;let m;t[10]!==n||t[11]!==f||t[12]!==e||t[13]!==u||t[14]!==i?(m=()=>{const p=i.get(R4),b=i.get(hn);u(!0),e1(p)||b.state===$t.CLOSED||e(c.jsx(hj,{onClose:n,onSave:f}))},t[10]=n,t[11]=f,t[12]=e,t[13]=u,t[14]=i,t[15]=m):m=t[15];const _=qe(m);let g;return t[16]!==u||t[17]!==_?(g={saveOrNameNotebook:_,saveIfNotebookIsPersistent:u},t[16]=u,t[17]=_,t[18]=g):g=t[18],g}function aj(t){return t.name}function lj(t){return t.code}function cj(t){return t.id}function e1(t){return t!==null&&!t.startsWith("/tmp")&&!t.startsWith("/var/folders")&&!t.includes("AppData\\Local\\Temp")}function dj(t){return t.name}function uj(t){return t.code}const hj=t=>{const e=K.c(17),{onClose:n,onSave:o}=t,[r,s]=O.useState();let i;e[0]!==n||e[1]!==o?(i=p=>{s(p),p.trim()&&(o(p),n())},e[0]=n,e[1]=o,e[2]=i):i=e[2];const a=i;let l,d,u,h;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(sr,{children:"Save notebook"}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(Fr,{className:"text-md pt-6 px-1",children:"Save as"}),e[4]=d):d=e[4],e[5]!==a?(u=c.jsxs("div",{className:"flex flex-col",children:[d,c.jsx(Zg,{onNameChange:a,placeholderText:"filename",className:"missing-filename"})]}),e[5]=a,e[6]=u):u=e[6],e[7]!==n?(h=c.jsx(Ae,{"data-testid":"cancel-save-dialog-button","aria-label":"Cancel",variant:"secondary",onClick:n,children:"Cancel"}),e[7]=n,e[8]=h):h=e[8];const f=!r;let m,_,g;return e[9]!==f?(m=c.jsx(Ae,{"data-testid":"submit-save-dialog-button","aria-label":"Save",variant:"default",disabled:f,type:"submit",children:"Save"}),e[9]=f,e[10]=m):m=e[10],e[11]!==h||e[12]!==m?(_=c.jsxs(Ki,{children:[h,m]}),e[11]=h,e[12]=m,e[13]=_):_=e[13],e[14]!==u||e[15]!==_?(g=c.jsxs(ar,{children:[l,u,_]}),e[14]=u,e[15]=_,e[16]=g):g=e[16],g};function t1(t){const e=K.c(3),[n,o]=O.useState(!1);let r,s;return e[0]!==t?(r=()=>{if(!t)return;o(!1);const i=setTimeout(()=>{o(!0)},200);return()=>clearTimeout(i)},s=[t],e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]),O.useEffect(r,s),t&&n}const ei=t=>{const{children:e}=t;return Le(Os)?null:e},fj=t=>{const{children:e}=t;return Le(Os)?e:null},mj=()=>{const t=K.c(6),e=Ot(Sd);let n;t[0]!==e?(n=()=>e(pj),t[0]=e,t[1]=n):n=t[1];const o=n;let r,s,i;return t[2]===Symbol.for("react.memo_cache_sentinel")?(r=on("global.commandPalette"),t[2]=r):r=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(s=c.jsx(ad,{strokeWidth:1.5,size:18}),t[3]=s):s=t[3],t[4]!==o?(i=c.jsx(Te,{content:r,children:c.jsx(xn,{"data-testid":"command-palette-button",onClick:o,shape:"rectangle",color:"hint-green",children:s})}),t[4]=o,t[5]=i):i=t[5],i};function pj(t){return!t}const gj=t=>{const e=K.c(47),{presenting:n,onTogglePresenting:o,onInterrupt:r,onRun:s,connectionState:i,running:a,appConfig:l}=t,d=l.width,u=Le(v4),h=Le(aU),{undoDeleteCell:f}=bt(),m=i===$t.CLOSED;let _,g=null;if(!m&&u){let k,$;e[0]===Symbol.for("react.memo_cache_sentinel")?(k=c.jsx(bd,{size:16,strokeWidth:1.5}),e[0]=k):k=e[0],e[1]!==f?($=c.jsx(Te,{content:"Undo cell deletion",children:c.jsx(xn,{"data-testid":"undo-delete-cell",size:"medium",color:"hint-green",shape:"circle",onClick:f,children:k})}),e[1]=f,e[2]=$):$=e[2],g=$}e[3]!==i?(_=po(i),e[3]=i,e[4]=_):_=e[4];const p=_;let b;e[5]!==i||e[6]!==p?(b=p?td(i):void 0,e[5]=i,e[6]=p,e[7]=b):b=e[7];const x=b;let y,v;e[8]!==n?(y=!n&&c.jsx(qN,{}),e[8]=n,e[9]=y):y=e[9],e[10]!==m||e[11]!==x||e[12]!==p||e[13]!==n?(v=!m&&c.jsxs("div",{className:xj,children:[n&&c.jsx(lN,{}),c.jsx(PN,{disabled:p,tooltip:x}),c.jsx(nW,{disabled:p,tooltip:x}),c.jsx(oW,{description:"This will terminate the Python kernel. You'll lose all data that's in memory.",disabled:p,tooltip:x})]}),e[10]=m,e[11]=x,e[12]=p,e[13]=n,e[14]=v):v=e[14];const C=d==="compact"&&"xl:flex-row items-end";let S,E,N,j,T,A,M,P,R,L,B,U,D;return e[15]!==C?(S=Ne(yj,C),e[15]=C,e[16]=S):S=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(E=c.jsx(ei,{children:c.jsx(ij,{kioskMode:!1})}),e[17]=E):E=e[17],e[18]===Symbol.for("react.memo_cache_sentinel")?(N=on("global.hideCode"),e[18]=N):N=e[18],e[19]!==n?(j=n?c.jsx(k4,{strokeWidth:1.5,size:18}):c.jsx(ud,{strokeWidth:1.5,size:18}),e[19]=n,e[20]=j):j=e[20],e[21]!==o||e[22]!==j?(T=c.jsx(Te,{content:N,children:c.jsx(xn,{"data-testid":"hide-code-button",id:"preview-button",shape:"rectangle",color:"hint-green",onClick:o,children:j})}),e[21]=o,e[22]=j,e[23]=T):T=e[23],e[24]===Symbol.for("react.memo_cache_sentinel")?(A=c.jsx(mj,{}),M=c.jsx(rW,{}),P=c.jsx("div",{}),e[24]=A,e[25]=M,e[26]=P):(A=e[24],M=e[25],P=e[26]),e[27]!==m||e[28]!==r||e[29]!==a?(R=!m&&c.jsx(bj,{running:a,onInterrupt:r}),e[27]=m,e[28]=r,e[29]=a,e[30]=R):R=e[30],e[31]!==m||e[32]!==h||e[33]!==s?(L=!m&&c.jsx(_j,{needsRun:h,onRun:s}),e[31]=m,e[32]=h,e[33]=s,e[34]=L):L=e[34],e[35]!==R||e[36]!==L||e[37]!==g?(B=c.jsx(ei,{children:c.jsxs("div",{className:"flex flex-col gap-2 items-center",children:[g,R,L]})}),e[35]=R,e[36]=L,e[37]=g,e[38]=B):B=e[38],e[39]!==T||e[40]!==B||e[41]!==S?(U=c.jsxs("div",{className:S,children:[E,T,A,M,P,B]}),e[39]=T,e[40]=B,e[41]=S,e[42]=U):U=e[42],e[43]!==U||e[44]!==y||e[45]!==v?(D=c.jsxs(c.Fragment,{children:[y,v,U]}),e[43]=U,e[44]=y,e[45]=v,e[46]=D):D=e[46],D},_j=t=>{const e=K.c(8),{needsRun:n,onRun:o}=t,r=Le(P4);if(n){let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=on("global.runStale"),e[0]=l):l=e[0];const d=r?o:void 0,u=!r;let h,f;return e[1]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(Wr,{strokeWidth:1.5,size:16}),e[1]=h):h=e[1],e[2]!==d||e[3]!==u?(f=c.jsx(Te,{content:l,children:c.jsx(xn,{"data-testid":"run-button",size:"medium",color:"yellow",shape:"circle",onClick:d,disabled:u,children:h})}),e[2]=d,e[3]=u,e[4]=f):f=e[4],f}const s=!r;let i,a;return e[5]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(Wr,{strokeWidth:1.5,size:16}),e[5]=i):i=e[5],e[6]!==s?(a=c.jsx(Te,{content:"Nothing to run",children:c.jsx(xn,{"data-testid":"run-button",className:"inactive-button",color:"disabled",size:"medium",shape:"circle",disabled:s,children:i})}),e[6]=s,e[7]=a):a=e[7],a},bj=t=>{const e=K.c(8),{running:n,onInterrupt:o}=t,r=t1(n);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=on("global.interrupt"),e[0]=s):s=e[0];const i=!r&&"inactive-button active:shadow-xsSolid";let a;e[1]!==i?(a=Ne(i),e[1]=i,e[2]=a):a=e[2];const l=r?"yellow":"disabled",d=r?o:Hn.NOOP;let u,h;return e[3]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx(vc,{strokeWidth:1.5,size:16}),e[3]=u):u=e[3],e[4]!==a||e[5]!==l||e[6]!==d?(h=c.jsx(Te,{content:s,children:c.jsx(xn,{className:a,"data-testid":"interrupt-button",size:"medium",color:l,shape:"circle",onClick:d,children:u})}),e[4]=a,e[5]=l,e[6]=d,e[7]=h):h=e[7],h},xj="absolute top-3 right-5 m-0 flex items-center space-x-3 min-h-[28px] no-print pointer-events-auto z-30 print:hidden",yj="absolute bottom-5 right-5 flex flex-col gap-2 items-center no-print pointer-events-auto z-30 print:hidden",wj=t=>{const e=K.c(7),{filename:n}=t,o=A4();let r;e[0]!==n?(r=n?jn.basename(n):"untitled marimo notebook",e[0]=n,e[1]=r):r=e[1];const s=n===null?"missing-filename":"filename";let i;return e[2]!==n||e[3]!==o||e[4]!==r||e[5]!==s?(i=c.jsx(Zg,{placeholderText:r,initialValue:n,onNameChange:o,flexibleWidth:!0,resetOnBlur:!0,"data-testid":"filename-input",className:s}),e[2]=n,e[3]=o,e[4]=r,e[5]=s,e[6]=i):i=e[6],i};function n1(){return{selectionStart:null,selectionEnd:null,selected:new Set}}const{valueAtom:Od,useActions:vj}=lU(n1,{select:(t,e)=>({selectionStart:e.cellId,selectionEnd:e.cellId,selected:new Set([e.cellId])}),extend:(t,e)=>{if(!t.selectionStart)return{selectionStart:e.cellId,selectionEnd:e.cellId,selected:new Set([e.cellId])};const{cellId:n,allCellIds:o}=e;try{const r=o.findWithId(t.selectionStart),s=r.indexOfOrThrow(t.selectionStart),i=r.indexOfOrThrow(n),[a,l]=s<i?[s,i]:[i,s],d=r.slice(a,l+1);return{selectionStart:t.selectionStart,selectionEnd:n,selected:new Set(d)}}catch{return{selectionStart:n,selectionEnd:n,selected:new Set([n])}}},clear:t=>t.selected.size===0?t:n1()});function Dd(){return vj()}const kj=t=>{const e=K.c(9),{actions:n,cellIds:o}=t;let r,s,i;if(e[0]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(fr,{asChild:!0,children:c.jsx(Ae,{variant:"ghost",size:"sm",className:"h-8 px-2 gap-1",title:"More actions",children:c.jsx(pp,{size:13,strokeWidth:1.5})})}),e[0]=r):r=e[0],e[1]!==n||e[2]!==o){let a;e[4]!==n.length||e[5]!==o?(a=(l,d)=>{const u=l.map(h=>c.jsx(Vt,{onSelect:()=>h.handle(o),className:"flex items-center gap-2",children:c.jsxs("div",{className:"flex items-center gap-2",children:[h.icon,c.jsx("span",{className:"text-xs",children:h.label})]})},h.label));return c.jsxs(X.Fragment,{children:[u,d<n.length-1&&c.jsx(bn,{})]},d)},e[4]=n.length,e[5]=o,e[6]=a):a=e[6],s=n.flatMap(a),e[1]=n,e[2]=o,e[3]=s}else s=e[3];return e[7]!==s?(i=c.jsxs(hr,{children:[r,c.jsx(mr,{align:"start","data-keep-cell-selection":!0,children:s})]}),e[7]=s,e[8]=i):i=e[8],i};function Sj(t){const e=K.c(22),{updateCellConfig:n,moveCell:o,clearCellOutput:r}=bt(),s=function(){const E=K.c(3),{deleteCell:N,undoDeleteCell:j}=bt();let T;return E[0]!==N||E[1]!==j?(T=async A=>{if(at.get(lc))return;const{cellIds:M}=A;for(const L of M)await o4({cellId:L}).then(()=>{N({cellId:L})});const{dismiss:P}=nt({title:"Cells deleted",action:c.jsx(Da,{"data-testid":"undo-delete-button",onClick:()=>{for(const L of M)j();R()}})}),R=P},E[0]=N,E[1]=j,E[2]=T):T=E[2],qe(T)}(),i=Le(lc),a=Dd(),l=Ks(),d=t.length,u=!i||d<t.length;let h;e[0]!==s||e[1]!==a?(h=E=>{s({cellIds:E}),a.clear()},e[0]=s,e[1]=a,e[2]=h):h=e[2];const f=qe(h);let m;e[3]!==o?(m=(E,N)=>{if(N==="down"){const j=E[E.length-1];if(at.get(cr).cellIds.findWithId(j).last()===j)return}if(N==="up"){const j=E[0];if(at.get(cr).cellIds.findWithId(j).first()===j)return}(N==="up"?E:[...E].reverse()).forEach(j=>{o({cellId:j,before:N==="up"})})},e[3]=o,e[4]=m):m=e[4];const _=qe(m),g=qe(Tj);let p;e[5]!==r?(p=E=>{E.forEach(N=>{r({cellId:N})})},e[5]=r,e[6]=p):p=e[6];const b=qe(p);let x;e[7]!==n?(x=async(E,N,j)=>{const T={};E.forEach(A=>{T[A]={[N]:j}}),await ur({configs:T}),E.forEach(A=>{n({cellId:A,config:T[A]})})},e[7]=n,e[8]=x):x=e[8];const y=qe(x);let v,C,S;if(e[9]===Symbol.for("react.memo_cache_sentinel")?(v=c.jsx(Wr,{size:13,strokeWidth:1.5}),e[9]=v):v=e[9],e[10]!==l?(C=E=>l(E),e[10]=l,e[11]=C):C=e[11],e[12]!==u||e[13]!==b||e[14]!==f||e[15]!==g||e[16]!==_||e[17]!==C||e[18]!==y){const E=[[{icon:v,label:"Run cells",handle:C}],[{icon:c.jsx(Sm,{size:13,strokeWidth:1.5}),label:"Move up",handle:A=>_(A,"up")},{icon:c.jsx(dr,{size:13,strokeWidth:1.5}),label:"Move down",handle:A=>_(A,"down")}],[{icon:c.jsx(fc,{size:13,strokeWidth:1.5}),label:"Delete cells",variant:"danger",hidden:!u,handle:f}]],N=[[{icon:c.jsx(s4,{size:13,strokeWidth:1.5}),label:"Format cells",handle:g},{icon:c.jsx(Zi,{size:13,strokeWidth:1.5}),label:"Clear outputs",handle:b}],[{icon:c.jsx(vm,{size:13,strokeWidth:1.5}),label:"Hide cells",handle:A=>y(A,"hide_code",!0)},{icon:c.jsx(wm,{size:13,strokeWidth:1.5}),label:"Show cells",handle:A=>y(A,"hide_code",!1)}],[{icon:c.jsx(wn,{size:13,strokeWidth:1.5}),label:"Disable cells",handle:A=>y(A,"disabled",!0)},{icon:c.jsx(vn,{size:13,strokeWidth:1.5}),label:"Enable cells",handle:A=>y(A,"disabled",!1)}]],j=E.map(Ij);let T;e[20]!==j?(T=j.filter(Ej),e[20]=j,e[21]=T):T=e[21],S={actions:T,moreActions:N.map(Nj).filter(Cj)},e[12]=u,e[13]=b,e[14]=f,e[15]=g,e[16]=_,e[17]=C,e[18]=y,e[19]=S}else S=e[19];return S}function Cj(t){return t.length>0}function Nj(t){return t.filter(jj)}function jj(t){return!t.hidden}function Ej(t){return t.length>0}function Ij(t){return t.filter(Aj)}function Aj(t){return!t.hidden}function Tj(t){const e={};t.forEach(n=>{const o=Qi(n);o&&(e[n]=o)}),r4(e)}const Mj=()=>{const t=K.c(4),e=Le(Od);let n;t[0]!==e.selected?(n=[...e.selected],t[0]=e.selected,t[1]=n):n=t[1];const o=n;if(o.length<2)return null;let r;return t[2]!==o?(r=c.jsx(Oj,{cellIds:o}),t[2]=o,t[3]=r):r=t[3],r},Rd=()=>{const t=K.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx("div",{className:"h-4 w-px bg-border mx-1"}),t[0]=e):e=t[0],e},Oj=t=>{const e=K.c(19),{cellIds:n}=t,o=Dd(),{actions:r,moreActions:s}=Sj(n),i=n.length;let a,l,d,u,h,f,m;if(e[0]!==o?(a=_=>{(_.target instanceof HTMLElement||_.target instanceof SVGElement)&&_.target.closest("[data-keep-cell-selection]")!==null||_.target instanceof HTMLHtmlElement||o.clear()},e[0]=o,e[1]=a):a=e[1],ac(window,"mousedown",a),e[2]!==i?(l=c.jsxs("span",{className:"text-sm font-medium text-muted-foreground px-2 flex-shrink-0",children:[i," cells selected"]}),e[2]=i,e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(Rd,{}),e[4]=d):d=e[4],e[5]!==r||e[6]!==n){let _;e[8]!==r.length||e[9]!==n?(_=(g,p)=>c.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[g.map(b=>c.jsxs(Ae,{variant:b.variant==="danger"?"linkDestructive":"ghost",size:"sm",onClick:()=>b.handle(n),className:"h-8 px-2 gap-1 flex-shrink-0",title:b.label,children:[b.icon,c.jsx("span",{className:"text-xs",children:b.label})]},b.label)),p<r.length-1&&c.jsx(Rd,{})]},p),e[8]=r.length,e[9]=n,e[10]=_):_=e[10],u=r.map(_),e[5]=r,e[6]=n,e[7]=u}else u=e[7];return e[11]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(Rd,{}),e[11]=h):h=e[11],e[12]!==n||e[13]!==s?(f=c.jsx(kj,{actions:s,cellIds:n}),e[12]=n,e[13]=s,e[14]=f):f=e[14],e[15]!==l||e[16]!==u||e[17]!==f?(m=c.jsx("div",{className:"fixed top-12 justify-center flex w-full left-0 right-0 z-50","data-keep-cell-selection":!0,children:c.jsx("div",{className:"bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 border border-[var(--slate-7)] rounded-lg shadow-lg p-2 overflow-x-auto overflow-y-hidden mx-20 scrollbar-thin",children:c.jsxs("div",{className:"flex items-center gap-1",children:[l,d,u,h,f]})})}),e[15]=l,e[16]=u,e[17]=f,e[18]=m):m=e[18],m},Dj={display:"none"};function Rj(t){let{id:e,value:n}=t;return X.createElement("div",{id:e,style:Dj},n)}function Pj(t){let{id:e,announcement:n,ariaLiveType:o="assertive"}=t;return X.createElement("div",{id:e,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":o,"aria-atomic":!0},n)}const o1=O.createContext(null),Lj={draggable:`
98
+ `)}(I,u)),o()},e[10]=g,e[11]=o,e[12]=u,e[13]=p):p=e[13];const b=p;let x;e[14]!==l||e[15]!==b?(x=l.handleSubmit(b),e[14]=l,e[15]=b,e[16]=x):x=e[16];let y,v;e[17]===Symbol.for("react.memo_cache_sentinel")?(y=c.jsx(TB,{}),e[17]=y):y=e[17],e[18]!==l||e[19]!==n?(v=c.jsx(ZC,{children:c.jsx(MB,{schema:n,form:l,renderers:rN,children:y})}),e[18]=l,e[19]=n,e[20]=v):v=e[20];let C;e[21]!==r?(C=c.jsx(Ae,{type:"button",variant:"outline",onClick:r,children:"Back"}),e[21]=r,e[22]=C):C=e[22];const S=!l.formState.isValid;let E,N;e[23]!==S?(E=c.jsx(Ae,{type:"submit",disabled:S,children:"Add"}),e[23]=S,e[24]=E):E=e[24],e[25]!==C||e[26]!==E?(N=c.jsxs("div",{className:"flex gap-2",children:[C,E]}),e[25]=C,e[26]=E,e[27]=N):N=e[27];const j=_c;let T,A;e[28]===Symbol.for("react.memo_cache_sentinel")?(T=I=>h(I),e[28]=T):T=e[28],e[29]===Symbol.for("react.memo_cache_sentinel")?(A=c.jsxs("div",{className:"flex flex-col gap-1 items-end",children:[c.jsx(bc,{children:c.jsx(xc,{placeholder:"Select a library"})}),c.jsx("span",{className:"text-xs text-muted-foreground",children:"Preferred connection library"})]}),e[29]=A):A=e[29];const M=yc,P=x4,R=d==null?void 0:d.libraries.map(aN);let L,B,U,D,k;return e[30]!==P||e[31]!==R?(L=c.jsx(P,{children:R}),e[30]=P,e[31]=R,e[32]=L):L=e[32],e[33]!==M||e[34]!==L?(B=c.jsx(M,{children:L}),e[33]=M,e[34]=L,e[35]=B):B=e[35],e[36]!==j||e[37]!==u||e[38]!==T||e[39]!==A||e[40]!==B?(U=c.jsx("div",{children:c.jsxs(j,{value:u,onValueChange:T,children:[A,B]})}),e[36]=j,e[37]=u,e[38]=T,e[39]=A,e[40]=B,e[41]=U):U=e[41],e[42]!==N||e[43]!==U?(D=c.jsxs("div",{className:"flex gap-2 justify-between",children:[N,U]}),e[42]=N,e[43]=U,e[44]=D):D=e[44],e[45]!==D||e[46]!==x||e[47]!==v?(k=c.jsxs("form",{onSubmit:x,className:"space-y-4",children:[v,D]}),e[45]=D,e[46]=x,e[47]=v,e[48]=k):k=e[48],k},iN=t=>{const e=K.c(5),{onSubmit:n}=t,[o,r]=O.useState(null);if(!o){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx(oN,{onSelect:r}),e[0]=a):a=e[0],a}let s,i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(s=()=>r(null),e[1]=s):s=e[1],e[2]!==n||e[3]!==o?(i=c.jsx(sN,{schema:o,onSubmit:n,onBack:s}),e[2]=n,e[3]=o,e[4]=i):i=e[4],i},Vg=t=>{const e=K.c(6),{children:n}=t,[o,r]=O.useState(!1);let s,i,a;return e[0]!==n?(s=c.jsx(OB,{asChild:!0,children:n}),e[0]=n,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx($g,{onClose:()=>r(!1)}),e[2]=i):i=e[2],e[3]!==o||e[4]!==s?(a=c.jsxs(DB,{open:o,onOpenChange:r,children:[s,i]}),e[3]=o,e[4]=s,e[5]=a):a=e[5],a},$g=t=>{const e=K.c(4),{onClose:n}=t;let o,r,s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=c.jsx(sr,{children:"Add Connection"}),e[0]=o):o=e[0],e[1]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsxs(Ts,{className:"mb-4",children:[o,c.jsxs(Ms,{children:["Connect to your database or data catalog to query data directly from your notebook. Learn more about how to connect to your database in our"," ",c.jsx(Tm,{href:"https://docs.marimo.io/guides/working_with_data/sql/#connecting-to-a-custom-database",children:"docs."})]})]}),e[1]=r):r=e[1],e[2]!==n?(s=c.jsxs(ar,{className:"max-h-[75vh] overflow-y-auto",children:[r,c.jsx(iN,{onSubmit:()=>n()})]}),e[2]=n,e[3]=s):s=e[3],s};function aN(t){return c.jsx(oa,{value:t,children:Pg[t]},t)}const lN=()=>{const t=K.c(7),{selectedLayout:e}=rC(),{setLayoutView:n}=sC();if(un()&&!Mm("wasm_layouts"))return null;let o,r,s,i;return t[0]!==n?(o=a=>n(a),t[0]=n,t[1]=o):o=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(bc,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:c.jsx(xc,{placeholder:"Select a view"})}),t[2]=r):r=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(s=c.jsx(yc,{children:c.jsxs(x4,{children:[c.jsx(RB,{children:"View as"}),iC.map(dN)]})}),t[3]=s):s=t[3],t[4]!==e||t[5]!==o?(i=c.jsxs(_c,{"data-testid":"layout-select",value:e,onValueChange:o,children:[r,s]}),t[4]=e,t[5]=o,t[6]=i):i=t[6],i};function cN(t){const e=Hg(t);return c.jsx(e,{className:"h-4 w-4"})}function Hg(t){switch(t){case"vertical":return Up;case"grid":return KH;case"slides":return md;default:return wc(t),vc}}function Wg(t){return Om(t)}function dN(t){return c.jsx(oa,{value:t,children:c.jsxs("div",{className:"flex items-center gap-1.5 leading-5",children:[cN(t),c.jsx("span",{children:Wg(t)})]})},t)}const uN=()=>{const t=K.c(2),{updateCellConfig:e}=bt();let n;return t[0]!==e?(n=async()=>{const o=new ra,r=Nn(),s=r.cellIds.inOrderIds,i={};for(const l of s){if(r.cellData[l]===void 0)continue;const{code:d,config:u}=r.cellData[l];u.hide_code||o.isSupported(d)&&(i[l]={hide_code:!0})}const a=pc.entries(i);if(a.length!==0){await ur({configs:i});for(const[l,d]of a)e({cellId:l,config:d})}},t[0]=e,t[1]=n):n=t[1],n};function qg(){const t=K.c(3),{openConfirm:e}=$n(),n=Ot(hn);let o;return t[0]!==e||t[1]!==n?(o=()=>{e({title:"Restart Kernel",description:"This will restart the Python kernel. You'll lose all data that's in memory. You will also lose any unsaved changes, so make sure to save your work before restarting.",variant:"destructive",confirmAction:c.jsx(w4,{onClick:async()=>{n({state:$t.CLOSING}),await LB(),FB()},"aria-label":"Confirm Restart",children:"Restart"})})},t[0]=e,t[1]=n,t[2]=o):o=t[2],o}const Qs=t=>{t==null||t.preventDefault(),t==null||t.stopPropagation()};function Gg(){var I,W;const t=K.c(36),e=Dm(),{openModal:n,closeModal:o}=$n(),{toggleApplication:r}=sa(),{selectedPanel:s}=Sc(),[i]=Qt(_m),a=Le(Os),l=uN(),[d]=zr(),{updateCellConfig:u,undoDeleteCell:h,clearAllCellOutputs:f,upsertSetupCell:m,collapseAllCells:_,expandAllCells:g}=bt(),p=qg(),b=fg(),x=function(G){const q=K.c(4),{openPrompt:Y,closeModal:ee}=$n();let oe;return q[0]!==ee||q[1]!==Y||q[2]!==G?(oe=()=>{if(!G)return null;const ie=kc.guessDeliminator(G),Z=jn.basename(G);Y({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${Z}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:Q=>{const me=ie.join(jn.dirname(G),Q);PB({source:G,destination:me}).then(()=>{ee(),nt({title:"Notebook copied",description:"A copy of the notebook has been created."}),KS(me)})}})},q[0]=ee,q[1]=Y,q[2]=G,q[3]=oe):oe=q[3],oe}(e),y=Ot(Sd),v=Ot(XH),C=Ot(ZH),S=Le(zB),E=Le(BB),N=Le(v4),{selectedLayout:j}=rC(),{setLayoutView:T}=sC(),A=hg(),M=((I=d.sharing)==null?void 0:I.html)??!0,P=((W=d.sharing)==null?void 0:W.wasm)??!0,R=RN;let L;t[0]===Symbol.for("react.memo_cache_sentinel")?(L=c.jsx(eg,{size:14,strokeWidth:1.5}),t[0]=L):L=t[0];const B=!M&&!P;let U;t[1]===Symbol.for("react.memo_cache_sentinel")?(U=c.jsx(qB,{size:14,strokeWidth:1.5}),t[1]=U):U=t[1];const D=!M;let k,$;return t[2]!==o||t[3]!==n?(k=async()=>{n(c.jsx(xC,{onClose:o}))},t[2]=o,t[3]=n,t[4]=k):k=t[4],t[5]!==N||t[6]!==f||t[7]!==o||t[8]!==_||t[9]!==x||t[10]!==g||t[11]!==e||t[12]!==S||t[13]!==E||t[14]!==l||t[15]!==a||t[16]!==n||t[17]!==p||t[18]!==b||t[19]!==j||t[20]!==s||t[21]!==y||t[22]!==C||t[23]!==T||t[24]!==v||t[25]!==P||t[26]!==B||t[27]!==D||t[28]!==k||t[29]!==r||t[30]!==A||t[31]!==h||t[32]!==u||t[33]!==m||t[34]!==i.mode?($=[{icon:L,label:"Share",handle:Qs,hidden:B,dropdown:[{icon:U,label:"Publish HTML to web",hidden:D,handle:k},{icon:c.jsx(JS,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!P,handle:DN}]},{icon:c.jsx(Rm,{size:14,strokeWidth:1.5}),label:"Download",handle:Qs,dropdown:[{icon:c.jsx(lC,{size:14,strokeWidth:1.5}),label:"Download as HTML",handle:async()=>{e?await aC({filename:e,includeCode:!0}):nt({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."})}},{icon:c.jsx(lC,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{e?await aC({filename:e,includeCode:!1}):nt({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."})}},{icon:c.jsx(uc,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:ON},{icon:c.jsx(jp,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:MN},{divider:!0,icon:c.jsx(mp,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:i.mode!=="present",tooltip:i.mode==="present"?void 0:c.jsxs("span",{children:["Only available in app view. ",c.jsx("br",{}),"Toggle with: ",on("global.hideCode",!1)]}),handle:TN},{icon:c.jsx(UB,{size:14,strokeWidth:1.5}),label:"Download as PDF",disabled:i.mode!=="present",tooltip:i.mode==="present"?void 0:c.jsxs("span",{children:["Only available in app view. ",c.jsx("br",{}),"Toggle with: ",on("global.hideCode",!1)]}),handle:IN}]},{divider:!0,icon:c.jsx(Yp,{size:14,strokeWidth:1.5}),label:"Helper panel",handle:Qs,dropdown:yd.flatMap(G=>{const{type:q,Icon:Y,hidden:ee}=G;return ee?[]:{label:Om(q),rightElement:R(s===q),icon:c.jsx(Y,{size:14,strokeWidth:1.5}),handle:()=>r(q)}})},{icon:c.jsx(md,{size:14,strokeWidth:1.5}),label:"Present as",handle:Qs,dropdown:[{icon:i.mode==="present"?c.jsx(k4,{size:14,strokeWidth:1.5}):c.jsx(ud,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{A()}},...iC.map((G,q)=>{const Y=Hg(G);return{divider:q===0,label:Wg(G),icon:c.jsx(Y,{size:14,strokeWidth:1.5}),rightElement:c.jsx("div",{className:"w-8 flex justify-end",children:j===G&&c.jsx(Cc,{size:14})}),handle:()=>{T(G),i.mode==="edit"&&A()}}})]},{icon:c.jsx(Op,{size:14,strokeWidth:1.5}),label:"Create notebook copy",hidden:!e||un(),handle:x},{icon:c.jsx(id,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!e,handle:EN},{icon:c.jsx(vn,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!S||a,handle:async()=>{const G=Nn(),q=VB(G),Y=pc.fromEntries(q.map(jN));await ur({configs:Y});for(const ee of q)u({cellId:ee,config:{disabled:!1}})}},{icon:c.jsx(wn,{size:14,strokeWidth:1.5}),label:"Disable all cells",hidden:!E||a,handle:async()=>{const G=Nn(),q=K3(G),Y=pc.fromEntries(q.map(NN));await ur({configs:Y});for(const ee of q)u({cellId:ee,config:{disabled:!0}})}},{icon:c.jsx(vm,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:l},{icon:c.jsx(Cp,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:_},{icon:c.jsx(Sp,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:g},{icon:c.jsx(Ip,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{m({code:"# Initialization code that runs before all other cells"})}},{icon:c.jsx(Zi,{size:14,strokeWidth:1.5}),label:"Clear all outputs",handle:()=>{f()}},{icon:c.jsx(Tp,{size:14,strokeWidth:1.5}),label:"Re-run all cells",hotkey:"global.runAll",handle:async()=>{b()}},{icon:c.jsx(bd,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!N||a,handle:()=>{h()}},{icon:c.jsx(lr,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n(c.jsx($g,{onClose:o}))}},{divider:!0,icon:c.jsx(ad,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>y(CN)},{icon:c.jsx(Pm,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>v(SN)},{icon:c.jsx(Bp,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>C(kN)},{icon:c.jsx(XS,{size:14,strokeWidth:1.5}),label:"Open documentation",handle:vN},{icon:c.jsx(Nc,{size:14,strokeWidth:1.5}),label:"Resources",handle:Qs,dropdown:[{icon:c.jsx(XS,{size:14,strokeWidth:1.5}),label:"Documentation",handle:wN},{icon:c.jsx(QH,{size:14,strokeWidth:1.5}),label:"GitHub",handle:yN},{icon:c.jsx(eW,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:xN},{icon:c.jsx(tW,{size:14,strokeWidth:1.5}),label:"YouTube",handle:bN},{icon:c.jsx(ym,{size:14,strokeWidth:1.5}),label:"Changelog",handle:_N}]},{divider:!0,icon:c.jsx(Fp,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:gN},{icon:c.jsx(ja,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:pN},{icon:c.jsx(ig,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:p}].filter(mN).map(hN),t[5]=N,t[6]=f,t[7]=o,t[8]=_,t[9]=x,t[10]=g,t[11]=e,t[12]=S,t[13]=E,t[14]=l,t[15]=a,t[16]=n,t[17]=p,t[18]=b,t[19]=j,t[20]=s,t[21]=y,t[22]=C,t[23]=T,t[24]=v,t[25]=P,t[26]=B,t[27]=D,t[28]=k,t[29]=r,t[30]=A,t[31]=h,t[32]=u,t[33]=m,t[34]=i.mode,t[35]=$):$=t[35],$}function hN(t){return t.dropdown?{...t,dropdown:t.dropdown.filter(fN)}:t}function fN(t){return!t.hidden}function mN(t){return!t.hidden}function pN(){const t=WB();window.open(t,"_blank")}function gN(){const t=document.baseURI.split("?")[0];window.open(t,"_self")}function _N(){window.open(Zn.releasesPage,"_blank")}function bN(){window.open(Zn.youtube,"_blank")}function xN(){window.open(Zn.discordLink,"_blank")}function yN(){window.open(Zn.githubPage,"_blank")}function wN(){window.open(Zn.docsPage,"_blank")}function vN(){window.open(Zn.docsPage,"_blank")}function kN(t){return!t}function SN(t){return!t}function CN(t){return!t}function NN(t){return[t,{disabled:!0}]}function jN(t){return[t,{disabled:!1}]}async function EN(){const t=await Lm();await _n(t.contents),nt({title:"Copied",description:"Code copied to clipboard."})}async function IN(){const t=new Event("export-beforeprint"),e=new Event("export-afterprint");window.dispatchEvent(t),setTimeout(AN,0),setTimeout(()=>window.dispatchEvent(e),0)}function AN(){return window.print()}async function TN(){const t=document.getElementById("App");t&&await e4(t,document.title)}async function MN(){const t=await Lm();ia(new Blob([t.contents],{type:"text/plain"}),S4.toPY(document.title))}async function ON(){const t=await HB({download:!1});ia(new Blob([t],{type:"text/plain"}),S4.toMarkdown(document.title))}async function DN(){const t=await Lm(),e=$B({code:t.contents});await _n(e),nt({title:"Copied",description:"Link copied to clipboard."})}function RN(t){return c.jsx("div",{className:"w-8 flex justify-end",children:t&&c.jsx(Cc,{size:14})})}const PN=t=>{const e=K.c(28),{disabled:n,tooltip:o}=t,r=n!==void 0&&n,s=o===void 0?"Actions":o,i=Gg();let a,l,d;e[0]!==s?(a=c.jsx("div",{children:s}),e[0]=s,e[1]=a):a=e[1],e[2]!==r?(l=!r&&c.jsxs("div",{className:"text-xs text-muted-foreground font-medium pt-1 -mt-2 border-t border-border flex items-center gap-2",children:[c.jsx("span",{children:"Open command palette"}),on("global.commandPalette",!1)]}),e[2]=r,e[3]=l):l=e[3],e[4]!==a||e[5]!==l?(d=c.jsxs("div",{className:"flex flex-col gap-2",children:[a,l]}),e[4]=a,e[5]=l,e[6]=d):d=e[6];const u=d,h=r?"disabled":"hint-green";let f,m,_;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=c.jsx(mW,{strokeWidth:1.8}),e[7]=f):f=e[7],e[8]!==u?(m=c.jsx(Te,{content:u,children:f}),e[8]=u,e[9]=m):m=e[9],e[10]!==r||e[11]!==h||e[12]!==m?(_=c.jsx(xn,{"aria-label":"Config",shape:"circle",size:"small",className:"h-[27px] w-[27px]","data-testid":"notebook-menu-dropdown",disabled:r,color:h,children:m}),e[10]=r,e[11]=h,e[12]=m,e[13]=_):_=e[13];const g=_,p=LN;let b;e[14]===Symbol.for("react.memo_cache_sentinel")?(b=j=>{const T=c.jsx(Vt,{variant:j.variant,disabled:j.disabled,onSelect:A=>j.handle(A),"data-testid":`notebook-menu-dropdown-${j.label}`,children:p(j)},j.label);return j.tooltip?c.jsx(Te,{content:j.tooltip,side:"left",delayDuration:100,children:c.jsx("span",{children:T})},j.label):T},e[14]=b):b=e[14];const x=b;let y,v,C,S,E,N;if(e[15]!==g||e[16]!==r?(y=c.jsx(fr,{asChild:!0,disabled:r,children:g}),e[15]=g,e[16]=r,e[17]=y):y=e[17],e[18]!==i){let j;e[20]===Symbol.for("react.memo_cache_sentinel")?(j=T=>T.hidden?null:T.dropdown?c.jsxs(GB,{children:[c.jsx(YB,{"data-testid":`notebook-menu-dropdown-${T.label}`,children:p(T)}),c.jsx(JB,{children:c.jsx(KB,{children:T.dropdown.map(A=>c.jsxs(X.Fragment,{children:[A.divider&&c.jsx(bn,{}),x(A)]},A.label))})})]},T.label):c.jsxs(X.Fragment,{children:[T.divider&&c.jsx(bn,{}),x(T)]},T.label),e[20]=j):j=e[20],v=i.map(j),e[18]=i,e[19]=v}else v=e[19];return e[21]===Symbol.for("react.memo_cache_sentinel")?(C=c.jsx(bn,{}),e[21]=C):C=e[21],e[22]===Symbol.for("react.memo_cache_sentinel")?(S=c.jsx("div",{className:"flex-1 px-2 text-xs text-muted-foreground",children:c.jsxs("span",{children:["Version: ",C4()]})}),e[22]=S):S=e[22],e[23]!==v?(E=c.jsxs(mr,{align:"end",className:"no-print w-[240px]",children:[v,C,S]}),e[23]=v,e[24]=E):E=e[24],e[25]!==y||e[26]!==E?(N=c.jsxs(hr,{modal:!1,children:[y,E]}),e[25]=y,e[26]=E,e[27]=N):N=e[27],N};function LN(t){return c.jsxs(c.Fragment,{children:[t.icon&&c.jsx("span",{className:"flex-0 mr-2",children:t.icon}),c.jsx("span",{className:"flex-1",children:t.labelElement||t.label}),t.hotkey&&c.jsx(XB,{shortcut:t.hotkey,className:"ml-4"}),t.rightElement]})}function jd(t){return zo("create"in t,'Expected query to have a "create" method'),t}const en=ZB({findText:"",replaceText:"",caseSensitive:!1,wholeWord:!1,regexp:!1,isOpen:!1,currentView:void 0},(t,e)=>{if(e===void 0)return t;switch(e.type){case"setFind":return{...t,findText:e.find};case"setReplace":return{...t,replaceText:e.replace};case"setCaseSensitive":return{...t,caseSensitive:e.caseSensitive};case"setWholeWord":return{...t,wholeWord:e.wholeWord};case"setRegex":return{...t,regexp:e.regexp};case"setIsOpen":return{...t,isOpen:e.isOpen};case"setCurrentView":return{...t,currentView:{view:e.view,range:e.range}};case"clearCurrentView":return{...t,currentView:void 0}}});function Yg(t){if([...document.querySelectorAll('[role="dialog"][data-state="open"]')].some(e=>e instanceof HTMLElement&&e.childNodes.length>0))return!1;if(t){const e=t.state.selection.main,n=t.state.sliceDoc(e.from,e.to);n?(at.set(en,{type:"setFind",find:n}),at.set(en,{type:"setCurrentView",view:t,range:{from:e.from,to:e.to}})):at.set(en,{type:"setCurrentView",view:t,range:{from:0,to:0}})}return at.get(en).isOpen?(at.set(en,{type:"setIsOpen",isOpen:!1}),requestAnimationFrame(()=>{at.set(en,{type:"setIsOpen",isOpen:!0})}),!0):(at.set(en,{type:"setIsOpen",isOpen:!0}),!0)}function FN(){return!!at.get(en).isOpen&&(at.set(en,{type:"setIsOpen",isOpen:!1}),!0)}function Fa(t){return()=>{const e=at.get(en),n=new jc({search:e.findText,caseSensitive:e.caseSensitive,regexp:e.regexp,replace:e.replaceText,wholeWord:e.wholeWord});return!!n.valid&&t({query:jd(n).create(),search:n})}}const Jg=t=>Fa(({query:e})=>{const n=Ps(),o=at.get(en).currentView||{view:n[0],range:{from:0,to:0}};let r=o.range.to;t==="prev"&&(n.reverse(),r=o.range.from);let s=n.indexOf(o.view);s<0&&(s=0);const i=[...n,...n].slice(s);for(const a of i){const l=t==="next"?e.nextMatch(a.state,0,r??0):e.prevMatch(a.state,r??a.state.doc.length,a.state.doc.length);if(!l){r=null,a.dispatch({selection:Bo.single(0)});continue}const d=Bo.single(l.from,l.to);return a.dispatch({selection:d,effects:[et.scrollIntoView(d.main,{y:"center"})],userEvent:"select.search"}),at.set(en,{type:"setCurrentView",view:a,range:{from:l.from,to:l.to}}),l}return!1}),Ed=Jg("next"),Kg=Jg("prev"),zN=Fa(({query:t})=>{var o;const e=Ps(),n=[];for(const r of e){if(r.state.readOnly)continue;const s=(o=t.matchAll(r.state,1e9))==null?void 0:o.map(a=>{const{from:l,to:d}=a;return{from:l,to:d,insert:t.getReplacement(a)}});if(!s||s.length===0)continue;const i=r.state.doc.toString();n.push(()=>{r.dispatch({changes:[{from:0,to:r.state.doc.length,insert:i}],userEvent:"input.replace.all"})}),r.dispatch({changes:s,userEvent:"input.replace.all"})}return()=>{for(const r of n)r()}}),BN=Fa(({query:t})=>{const e=Ps(),n=at.get(en).currentView||{view:e[0],range:{from:0}};let o=n.range.from,r=e.indexOf(n.view);r<0&&(r=0);const s=[...e,...e].slice(r);for(const i of s){const a=t.nextMatch(i.state,0,o??0);if(!a){o=null,i.dispatch({selection:Bo.single(0)});continue}const l=i.state.toText(t.getReplacement(a));return i.dispatch({changes:[{from:a.from,to:a.to,insert:l}],userEvent:"input.replace"}),Ed()}return!1}),UN=Fa(({query:t})=>{const e=Ps();let n=0;const o=new Map;for(const r of e){const s=t.matchAll(r.state,1e9)||[];for(const i of s){const{from:a,to:l}=i,d=o.get(r)||new Map;d.set(`${a}:${l}`,n++),o.set(r,d)}}return{count:n,position:o}}),Id=Dt.define();function Xg(){const t=Ps();for(const e of t)e.state.readOnly||e.dispatch({effects:Id.of(new jc({search:""}))})}const za=In.define({create(){const t=at.get(en);return jd(new jc({search:t.findText,caseSensitive:t.caseSensitive,regexp:t.regexp,replace:t.replaceText,wholeWord:t.wholeWord})).create()},update(t,e){for(const n of e.effects)n.is(Id)&&(t=jd(n.value).create());return t}}),VN=dt.mark({class:"cm-searchMatch"}),$N=dt.mark({class:"cm-searchMatch cm-searchMatch-selected"}),HN=En.fromClass(class{constructor(t){this.view=t,this.decorations=void 0,this.decorations=this.highlight(t.state.field(za))}update(t){const e=t.state.field(za);(e!==t.startState.field(za)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight(t){if(!t.spec.valid)return dt.none;const{view:e}=this,n=new Ls,o=e.visibleRanges,r=o.length;for(let s=0;s<r;s++){let{to:i}=o[s];const{from:a}=o[s];for(;s<r-1&&i>o[s+1].from-500;)i=o[++s].to;t.highlight(e.state,a,i,(l,d)=>{const u=e.state.selection.ranges.some(h=>h.from===l&&h.to===d);n.add(l,d,u?$N:VN)})}return n.finish()}},{decorations:t=>t.decorations}),WN=et.baseTheme({"&light .cm-searchMatch":{backgroundColor:"#99ff7780"},"&dark .cm-searchMatch":{backgroundColor:"#22bb0070"},"&light .cm-searchMatch-selected":{backgroundColor:"transparent"},"&dark .cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff88 !important"}}),qN=()=>{var He;const t=K.c(102),[e,n]=O.useState(!1),[o,r]=Qt(en),[s,i]=O.useState(),a=O.useRef(null),l=Le(mc);let d,u;t[0]!==e||t[1]!==o.isOpen?(d=()=>(!e||!o.isOpen)&&Yg(),t[0]=e,t[1]=o.isOpen,t[2]=d):d=t[2],Jt("cell.findAndReplace",d),t[3]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{const Fe=UN();i(Fe===!1?void 0:Fe)},t[3]=u):u=t[3];const h=u;let f,m,_,g;if(t[4]!==o.isOpen?(f=()=>{o.isOpen&&a.current&&(a.current.focus(),a.current.select())},m=[o.isOpen],t[4]=o.isOpen,t[5]=f,t[6]=m):(f=t[5],m=t[6]),O.useEffect(f,m),t[7]!==o.findText||t[8]!==o.isOpen?(_=()=>{if(o.isOpen){if(o.findText==="")return i(void 0),void Xg();h(),function(){const Fe=at.get(en),it=Ps();for(const Qe of it)Qe.state.readOnly||Qe.dispatch({effects:Id.of(new jc({search:Fe.findText,caseSensitive:Fe.caseSensitive,regexp:Fe.regexp,replace:Fe.replaceText,wholeWord:Fe.wholeWord}))})}()}else Xg()},t[7]=o.findText,t[8]=o.isOpen,t[9]=_):_=t[9],t[10]!==o.caseSensitive||t[11]!==o.findText||t[12]!==o.isOpen||t[13]!==o.regexp||t[14]!==o.wholeWord?(g=[o.findText,o.isOpen,o.caseSensitive,o.regexp,o.wholeWord],t[10]=o.caseSensitive,t[11]=o.findText,t[12]=o.isOpen,t[13]=o.regexp,t[14]=o.wholeWord,t[15]=g):g=t[15],O.useEffect(_,g),!o.isOpen)return null;const p=o.currentView;let b;t[16]!==s||t[17]!==p?(b=p&&s?(He=s.position.get(p.view))==null?void 0:He.get(`${p.range.from}:${p.range.to}`):void 0,t[16]=s,t[17]=p,t[18]=b):b=t[18];const x=b;let y,v,C,S,E,N,j,T,A,M,P;t[19]===Symbol.for("react.memo_cache_sentinel")?(y=()=>n(!0),t[19]=y):y=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(v=()=>n(!1),t[20]=v):v=t[20],t[21]!==r?(C=Fe=>{Fe.key==="Escape"&&r({type:"setIsOpen",isOpen:!1})},t[21]=r,t[22]=C):C=t[22],t[23]!==r?(S=()=>r({type:"setIsOpen",isOpen:!1}),t[23]=r,t[24]=S):S=t[24],t[25]===Symbol.for("react.memo_cache_sentinel")?(E=c.jsx(eo,{className:"w-4 h-4"}),t[25]=E):E=t[25],t[26]!==S?(N=c.jsx("div",{className:"absolute top-0 right-0",children:c.jsx(Ae,{"data-testid":"close-find-replace-button",onClick:S,size:"xs",variant:"text",children:E})}),t[26]=S,t[27]=N):N=t[27],t[28]!==r?(j=Fe=>{r({type:"setFind",find:Fe.target.value})},t[28]=r,t[29]=j):j=t[29],t[30]!==o.findText||t[31]!==j?(T=c.jsx(ir,{ref:a,"data-testid":"find-input",value:o.findText,autoFocus:!0,className:"mr-2 mb-0",placeholder:"Find",onKeyDown:YN,onChange:j}),t[30]=o.findText,t[31]=j,t[32]=T):T=t[32],t[33]!==r?(A=Fe=>{r({type:"setReplace",replace:Fe.target.value})},t[33]=r,t[34]=A):A=t[34],t[35]!==o.replaceText||t[36]!==A?(M=c.jsx(ir,{"data-testid":"replace-input",value:o.replaceText,placeholder:"Replace",onChange:A}),t[35]=o.replaceText,t[36]=A,t[37]=M):M=t[37],t[38]!==T||t[39]!==M?(P=c.jsxs("div",{className:"flex flex-col flex-2 gap-2 w-[55%]",children:[T,M]}),t[38]=T,t[39]=M,t[40]=P):P=t[40];const R=o.caseSensitive?"on":"off";let L,B,U;t[41]!==r?(L=Fe=>r({type:"setCaseSensitive",caseSensitive:Fe}),t[41]=r,t[42]=L):L=t[42],t[43]===Symbol.for("react.memo_cache_sentinel")?(B=c.jsx(QB,{className:"w-4 h-4"}),t[43]=B):B=t[43],t[44]!==o.caseSensitive||t[45]!==R||t[46]!==L?(U=c.jsx(Te,{content:"Case Sensitive",children:c.jsx(Fm,{size:"sm",pressed:o.caseSensitive,"data-state":R,onPressedChange:L,children:B})}),t[44]=o.caseSensitive,t[45]=R,t[46]=L,t[47]=U):U=t[47];const D=o.wholeWord?"on":"off";let k,$,I;t[48]!==r?(k=Fe=>r({type:"setWholeWord",wholeWord:Fe}),t[48]=r,t[49]=k):k=t[49],t[50]===Symbol.for("react.memo_cache_sentinel")?($=c.jsx(ug,{className:"w-4 h-4"}),t[50]=$):$=t[50],t[51]!==o.wholeWord||t[52]!==D||t[53]!==k?(I=c.jsx(Te,{content:"Match Whole Word",children:c.jsx(Fm,{size:"sm",pressed:o.wholeWord,"data-state":D,onPressedChange:k,children:$})}),t[51]=o.wholeWord,t[52]=D,t[53]=k,t[54]=I):I=t[54];const W=o.regexp?"on":"off";let G,q,Y,ee,oe;t[55]!==r?(G=Fe=>r({type:"setRegex",regexp:Fe}),t[55]=r,t[56]=G):G=t[56],t[57]===Symbol.for("react.memo_cache_sentinel")?(q=c.jsx(Xp,{className:"w-4 h-4"}),t[57]=q):q=t[57],t[58]!==o.regexp||t[59]!==W||t[60]!==G?(Y=c.jsx(Te,{content:"Use Regular Expression",children:c.jsx(Fm,{size:"sm",pressed:o.regexp,"data-state":W,onPressedChange:G,children:q})}),t[58]=o.regexp,t[59]=W,t[60]=G,t[61]=Y):Y=t[61],t[62]!==U||t[63]!==I||t[64]!==Y?(ee=c.jsxs("div",{className:"flex items-center gap-[2px]",children:[U,I,Y]}),t[62]=U,t[63]=I,t[64]=Y,t[65]=ee):ee=t[65],t[66]===Symbol.for("react.memo_cache_sentinel")?(oe=()=>{BN()&&h()},t[66]=oe):oe=t[66];const ie=o.findText==="";let Z,Q;t[67]!==ie?(Z=c.jsx(Ae,{"data-testid":"replace-next-button",size:"xs",variant:"outline",className:"h-6 text-xs",onClick:oe,disabled:ie,children:"Replace Next"}),t[67]=ie,t[68]=Z):Z=t[68],t[69]===Symbol.for("react.memo_cache_sentinel")?(Q=()=>{const Fe=zN();if(!Fe)return;h();const{dismiss:it}=nt({title:"Replaced all occurrences",action:c.jsx(Da,{"data-testid":"undo-replace-all-button",onClick:()=>{Fe(),Qe()}})}),Qe=it},t[69]=Q):Q=t[69];const me=o.findText==="";let fe,de,ue,ce,ke,Se,ae,Ce,_e,Ee,ze,Oe;return t[70]!==me?(fe=c.jsx(Ae,{"data-testid":"replace-all-button",size:"xs",variant:"outline",className:"h-6 text-xs",onClick:Q,disabled:me,children:"Replace All"}),t[70]=me,t[71]=fe):fe=t[71],t[72]!==Z||t[73]!==fe?(de=c.jsxs("div",{className:"flex items-center gap-[2px]",children:[Z,fe]}),t[72]=Z,t[73]=fe,t[74]=de):de=t[74],t[75]!==ee||t[76]!==de?(ue=c.jsxs("div",{className:"flex flex-col gap-2",children:[ee,de]}),t[75]=ee,t[76]=de,t[77]=ue):ue=t[77],t[78]!==P||t[79]!==ue?(ce=c.jsxs("div",{className:"flex items-center gap-3",children:[P,ue]}),t[78]=P,t[79]=ue,t[80]=ce):ce=t[80],t[81]===Symbol.for("react.memo_cache_sentinel")?(ke=c.jsx(Te,{content:"Find Previous",children:c.jsx(Ae,{"data-testid":"find-prev-button",size:"xs",variant:"secondary",onClick:JN,children:c.jsx(It,{className:"w-4 h-4"})})}),t[81]=ke):ke=t[81],t[82]===Symbol.for("react.memo_cache_sentinel")?(Se=c.jsx(Te,{content:"Find Next",children:c.jsx(Ae,{"data-testid":"find-next-button",size:"xs",variant:"secondary",onClick:KN,children:c.jsx(sd,{className:"w-4 h-4"})})}),t[82]=Se):Se=t[82],t[83]!==x||t[84]!==s?(ae=s!=null&&x==null&&c.jsxs("span",{className:"text-sm",children:[s.count," matches"]}),t[83]=x,t[84]=s,t[85]=ae):ae=t[85],t[86]!==x||t[87]!==s?(Ce=s!=null&&x!=null&&c.jsxs("span",{className:"text-sm",children:[x+1," of ",s.count]}),t[86]=x,t[87]=s,t[88]=Ce):Ce=t[88],t[89]!==ae||t[90]!==Ce?(_e=c.jsxs("div",{className:"flex items-center gap-2",children:[ke,Se,ae,Ce]}),t[89]=ae,t[90]=Ce,t[91]=_e):_e=t[91],t[92]!==l?(Ee=l.getHotkey("cell.findAndReplace"),t[92]=l,t[93]=Ee):Ee=t[93],t[94]!==Ee.key?(ze=c.jsxs("div",{className:"text-xs text-muted-foreground flex gap-1 mt-2",children:["Press"," ",c.jsx(Em,{shortcut:Ee.key})," ","again to open the native browser search."]}),t[94]=Ee.key,t[95]=ze):ze=t[95],t[96]!==N||t[97]!==ce||t[98]!==_e||t[99]!==ze||t[100]!==C?(Oe=c.jsx(eU,{restoreFocus:!0,autoFocus:!0,children:c.jsxs("div",{onFocus:y,onClick:GN,onBlur:v,className:"fixed top-0 right-0 w-[500px] flex flex-col bg-[var(--sage-1)] p-4 z-50 mt-2 mr-3 rounded-md shadow-lg border gap-2 print:hidden",onKeyDown:C,children:[N,ce,_e,ze]})}),t[96]=N,t[97]=ce,t[98]=_e,t[99]=ze,t[100]=C,t[101]=Oe):Oe=t[101],Oe};function GN(t){t.stopPropagation(),t.preventDefault()}function YN(t){t.key==="Enter"&&(t.shiftKey?Kg():Ed())}function JN(){return Kg()}function KN(){return Ed()}const Zg=t=>{const e=K.c(38),{resetOnBlur:n,placeholderText:o,initialValue:r,flexibleWidth:s,onNameChange:i,className:a}=t,l=n!==void 0&&n,d=r===void 0?null:r,u=s!==void 0&&s,[h,f]=O.useState(d);let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=[],e[0]=m):m=e[0];const[_,g]=O.useState(m),[p,b]=O.useState(!1),x=O.useRef(null),y=O.useRef(!1);let v,C,S;e[1]!==d?(v=()=>{f(d)},C=[d],e[1]=d,e[2]=v,e[3]=C):(v=e[2],C=e[3]),O.useEffect(v,C),e[4]===Symbol.for("react.memo_cache_sentinel")?(S=()=>{b(!0)},e[4]=S):S=e[4];const E=S;let N;e[5]!==d||e[6]!==l?(N=Q=>{var me;(me=Q.relatedTarget)!=null&&me.closest(".filename-input")||(b(!1),l&&f(d))},e[5]=d,e[6]=l,e[7]=N):N=e[7];const j=N;let T;e[8]!==h?(T=jn.dirname(h||""),e[8]=h,e[9]=T):T=e[9];const A=T,M=jn.basename(h||""),P=_.filter(Q=>jn.basename(Q.path).startsWith(M));let R,L;e[10]!==A||e[11]!==p?(R=async()=>{if(!p)return void g([]);const Q=await E4({path:A});g(Q.files)},L=[A,p],e[10]=A,e[11]=p,e[12]=R,e[13]=L):(R=e[12],L=e[13]);const{isPending:B}=Wn(R,L),U=function(Q,me,fe){if(Q&&!Q.endsWith("/")&&((Mm("markdown")?new Set(["py","md","markdown","qmd"]):new Set(["py"])).has(jn.extension(Q))||(Q=Q.endsWith(".")?`${Q}py`:Q.endsWith(".p")?`${Q}y`:`${Q}.py`),!me.some(de=>de.path===Q||jn.basename(de.path)===Q)&&!(fe&&(fe===Q||jn.basename(fe)===Q))))return Q}(h,_,d),D=(U||P.length>0)&&c.jsxs(Nm,{className:"font-mono",children:[!B&&c.jsx(gc,{children:"No files"}),U&&c.jsxs(mo,{variant:"success",className:"py-2 px-3",onSelect:()=>{var Q;U&&(y.current=!0,i(U),(Q=x.current)==null||Q.blur())},children:[c.jsx(Mp,{className:"w-4 h-4 mr-2"})," ",c.jsxs("span",{className:"text-sm",children:[d?"Rename to: ":"Save as: ",c.jsx("span",{className:"font-medium text-sm",children:jn.basename(U)})]})]},"_rename_"),P.map(Q=>{const me=Q.isDirectory?"directory":N4(Q.path),fe=j4[me];return c.jsxs(mo,{variant:Q.isDirectory?"default":"muted",className:"py-2 px-3",onSelect:()=>{Q.isDirectory?f(`${Q.path}/`):f(Q.path)},children:[c.jsx(fe,{className:"w-4 h-4 mr-2"})," ",jn.basename(Q.path)]},Q.path)})]}),k=10*Math.max(20,(h==null?void 0:h.length)||(o==null?void 0:o.length)||0),$=p?h||"":d||"";let I,W,G;e[14]!==u||e[15]!==k?(I=u?{maxWidth:k}:void 0,e[14]=u,e[15]=k,e[16]=I):I=e[16],e[17]!==a?(W=Ne(a,"w-full px-4 py-1 my-1 h-9 font-mono text-foreground/60"),e[17]=a,e[18]=W):W=e[18],e[19]!==o||e[20]!==$||e[21]!==I||e[22]!==W?(G=c.jsx(tU,{children:c.jsx(na,{"data-testid":"dir-completion-input",tabIndex:-1,rootClassName:"border-none justify-center px-1",spellCheck:"false",value:$,onKeyDown:XN,icon:null,ref:x,onValueChange:f,placeholder:o,autoComplete:"off",style:I,className:W})}),e[19]=o,e[20]=$,e[21]=I,e[22]=W,e[23]=G):G=e[23];const q=D&&"group-focus-within:block";let Y,ee,oe,ie,Z;return e[24]!==q?(Y=Ne("p-0 w-full min-w-80 max-w-80vw hidden",q),e[24]=q,e[25]=Y):Y=e[25],e[26]!==D||e[27]!==Y?(ee=c.jsx(Fs,{side:"bottom",className:Y,portal:!1,children:D}),e[26]=D,e[27]=Y,e[28]=ee):ee=e[28],e[29]!==G||e[30]!==ee?(oe=c.jsxs(Nm,{children:[G,ee]}),e[29]=G,e[30]=ee,e[31]=oe):oe=e[31],e[32]!==j||e[33]!==oe?(ie=c.jsx(Ec,{onFocus:E,onBlur:j,shouldFilter:!1,id:"filename-input",className:"bg-transparent group filename-input",children:oe}),e[32]=j,e[33]=oe,e[34]=ie):ie=e[34],e[35]!==p||e[36]!==ie?(Z=c.jsx(Ic,{children:c.jsx(Ur,{open:p,modal:!1,children:ie})}),e[35]=p,e[36]=ie,e[37]=Z):Z=e[37],Z};function XN(t){t.key==="Escape"&&t.currentTarget.blur()}const ZN=t=>{const e=K.c(33),n=()=>{ia(new Blob([o()],{type:"text/plain"}),`${t.proposedName}.json`)},o=qe(tj);let r,s,i,a,l,d,u,h,f,m,_,g,p,b,x,y,v;return e[0]!==n||e[1]!==t?(r=C=>{C.preventDefault(),n(),t.closeModal()},e[0]=n,e[1]=t,e[2]=r):r=e[2],e[3]!==t?(s=C=>{C.key==="Escape"&&t.closeModal()},e[3]=t,e[4]=s):s=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(sr,{className:"text-accent-foreground mb-6",children:"Download unsaved changes?"}),e[5]=i):i=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(a={wordBreak:"break-word"},e[6]=a):a=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx("p",{children:"This app has unsaved changes. To recover:"}),d={paddingBottom:"10px"},e[7]=l,e[8]=d):(l=e[7],d=e[8]),e[9]!==t.proposedName?(u=c.jsxs("li",{style:d,children:['Click the "Download" button. This will download a file called\xA0',c.jsxs("code",{children:[t.proposedName,".json"]}),". This file contains your code."]}),e[9]=t.proposedName,e[10]=u):u=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(h={paddingBottom:"10px"},e[11]=h):h=e[11],e[12]===Symbol.for("react.memo_cache_sentinel")?(f={display:"block",padding:"10px"},e[12]=f):f=e[12],e[13]!==t.proposedName?(m=c.jsxs("code",{style:f,children:["marimo recover ",t.proposedName,".json ",">"," ",t.proposedName,".py"]}),e[13]=t.proposedName,e[14]=m):m=e[14],e[15]!==t.proposedName?(_=c.jsxs("code",{children:[t.proposedName,".py"]}),e[15]=t.proposedName,e[16]=_):_=e[16],e[17]!==_||e[18]!==m?(g=c.jsxs("li",{style:h,children:["In your terminal, type",m,"to overwrite ",_," with the recovered changes."]}),e[17]=_,e[18]=m,e[19]=g):g=e[19],e[20]!==g||e[21]!==u?(p=c.jsx(Ms,{className:"markdown break-words",style:a,children:c.jsxs("div",{className:"prose dark:prose-invert",children:[l,c.jsxs("ol",{children:[u,g]})]})}),e[20]=g,e[21]=u,e[22]=p):p=e[22],e[23]!==t.closeModal?(b=c.jsx(Ae,{"aria-label":"Cancel",variant:"secondary","data-testid":"cancel-recovery-button",onClick:t.closeModal,children:"Cancel"}),e[23]=t.closeModal,e[24]=b):b=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(x=c.jsx(Ae,{"data-testid":"download-recovery-button","aria-label":"Download",variant:"default",type:"submit",children:"Download"}),e[25]=x):x=e[25],e[26]!==b?(y=c.jsxs(Ki,{children:[b,x]}),e[26]=b,e[27]=y):y=e[27],e[28]!==r||e[29]!==s||e[30]!==p||e[31]!==y?(v=c.jsx(ar,{className:"w-fit",children:c.jsxs("form",{onSubmit:r,onKeyDown:s,children:[i,p,y]})}),e[28]=r,e[29]=s,e[30]=p,e[31]=y,e[32]=v):v=e[32],v},QN=t=>{const e=K.c(12),{filename:n,needsSave:o}=t,{openModal:r,closeModal:s}=$n();let i;e[0]!==n?(i=n===null?"app":jn.basename(n).split(".")[0],e[0]=n,e[1]=i):i=e[1];const a=i;let l;e[2]!==s||e[3]!==o||e[4]!==r||e[5]!==a?(l=()=>{o&&r(c.jsx(ZN,{proposedName:a,closeModal:s}))},e[2]=s,e[3]=o,e[4]=r,e[5]=a,e[6]=l):l=e[6];const d=l;let u;Jt("global.save",d),e[7]===Symbol.for("react.memo_cache_sentinel")?(u=on("global.save"),e[7]=u):u=e[7];const h=o?"yellow":"gray";let f,m;return e[8]===Symbol.for("react.memo_cache_sentinel")?(f=c.jsx(Ia,{strokeWidth:1.5,size:18}),e[8]=f):f=e[8],e[9]!==d||e[10]!==h?(m=c.jsx(Te,{content:u,children:c.jsx(xn,{onClick:d,id:"save-button","aria-label":"Save",className:"rectangle",color:h,children:f})}),e[9]=d,e[10]=h,e[11]=m):m=e[11],m};function ej(t){return{id:t.id,name:t.name,code:t.code,code_hash:null,config:{column:0,...t.config}}}function tj(){const t=Nn(),e=zm(t),n={version:"1",metadata:{marimo_version:C4()},cells:e.map(ej)};return JSON.stringify(n,null,2)}const Ad=5e3;async function nj(){await sU({download:!1})}async function oj(){await rU({download:!1,includeCode:!0,files:tC.INSTANCE.filenames()})}async function rj(){await oU({download:!1})}const Td=zt(void 0),Qg=zt(t=>{const e=t(Td);return function({state:n,layout:o,lastSavedNotebook:r}){if(!r)return!1;const{cellIds:s,cellData:i}=n,a=s.inOrderIds.map(h=>i[h]),l=a.map(h=>h.code),d=a.map(h=>h.config),u=a.map(h=>h.name);return!(I4(l,r.codes)&&I4(u,r.names)&&aa(d,r.configs)&&aa(o.selectedLayout,r.layout.selectedLayout)&&aa(o.layoutData,r.layout.layoutData))}({state:t(cr),layout:t(cC),lastSavedNotebook:e})});function sj(t){return JSON.stringify(t)}const ij=t=>{const e=K.c(15),{kioskMode:n}=t,o=Dm(),r=Le(Qg),s=Le(hn).state===$t.CLOSED,{saveOrNameNotebook:i,saveIfNotebookIsPersistent:a}=Md();let l,d,u;e[0]!==n||e[1]!==a?(l={onSave:a,kioskMode:n},e[0]=n,e[1]=a,e[2]=l):l=e[2],function(p){const b=K.c(14),x=Le(O4),y=Ac(),[v]=Qt(hn),C=Le(Qg);let S,E;if(b[0]!==y){const M=zm(y);S=M.map(uj),E=M.map(dj),b[0]=y,b[1]=S,b[2]=E}else S=b[1],E=b[2];const N=E;let j;b[3]!==y?(j=M4(y),b[3]=y,b[4]=j):j=b[4];const T=j;let A;b[5]!==x||b[6]!==N||b[7]!==S||b[8]!==T||b[9]!==v||b[10]!==C||b[11]!==p.kioskMode||b[12]!==p.onSave?(A={onSave:p.onSave,needsSave:C,codes:S,cellConfigs:T,cellNames:N,connStatus:v,config:x,kioskMode:p.kioskMode},b[5]=x,b[6]=N,b[7]=S,b[8]=T,b[9]=v,b[10]=C,b[11]=p.kioskMode,b[12]=p.onSave,b[13]=A):A=b[13],function(M){const P=K.c(21),{codes:R,cellConfigs:L,config:B,connStatus:U,cellNames:D,needsSave:k,kioskMode:$,onSave:I}=M,W=O.useRef(null);let G;P[0]!==R?(G=R.join(":"),P[0]=R,P[1]=G):G=P[1];const q=G;let Y;P[2]!==L?(Y=L.map(sj).join(":"),P[2]=L,P[3]=Y):Y=P[3];const ee=Y;let oe;P[4]!==D?(oe=D.join(":"),P[4]=D,P[5]=oe):oe=P[5];const ie=oe;let Z,Q;P[6]!==B||P[7]!==U.state||P[8]!==$||P[9]!==k||P[10]!==I?(Z=()=>{if(!$)return B.autosave==="after_delay"&&(W.current!==null&&clearTimeout(W.current),k&&U.state===$t.OPEN&&(W.current=setTimeout(I,B.autosave_delay))),()=>{W.current!==null&&clearTimeout(W.current)}},P[6]=B,P[7]=U.state,P[8]=$,P[9]=k,P[10]=I,P[11]=Z):Z=P[11],P[12]!==ee||P[13]!==ie||P[14]!==q||P[15]!==B||P[16]!==U.state||P[17]!==$||P[18]!==k||P[19]!==I?(Q=[q,ee,ie,B,U.state,I,$,k],P[12]=ee,P[13]=ie,P[14]=q,P[15]=B,P[16]=U.state,P[17]=$,P[18]=k,P[19]=I,P[20]=Q):Q=P[20],O.useEffect(Z,Q)}(A)}(l),function(){const p=K.c(6),b=Le(nU),{state:x}=Le(hn),y=b.auto_download.includes("markdown"),v=b.auto_download.includes("html"),C=b.auto_download.includes("ipynb"),S=!y||x!==$t.OPEN,E=!v||x!==$t.OPEN,N=!C||x!==$t.OPEN;let j,T,A;p[0]!==S?(j={delayMs:Ad,whenVisible:!0,disabled:S},p[0]=S,p[1]=j):j=p[1],ya(rj,j),p[2]!==E?(T={delayMs:Ad,whenVisible:!0,disabled:E},p[2]=E,p[3]=T):T=p[3],ya(oj,T),p[4]!==N?(A={delayMs:Ad,whenVisible:!0,disabled:N},p[4]=N,p[5]=A):A=p[5],ya(nj,A)}(),e[3]!==r?(d=p=>{if(r)return p.preventDefault(),p.returnValue="You have unsaved changes. Are you sure you want to leave?",p.returnValue},e[3]=r,e[4]=d):d=e[4],ac(window,"beforeunload",d),e[5]!==i?(u=p=>{p.preventDefault(),p.stopPropagation(),i()},e[5]=i,e[6]=u):u=e[6];const h=u;if(Jt("global.save",i),s){let p;return e[7]!==o||e[8]!==r?(p=c.jsx(QN,{filename:o,needsSave:r}),e[7]=o,e[8]=r,e[9]=p):p=e[9],p}let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=on("global.save"),e[10]=f):f=e[10];const m=r?"yellow":"hint-green";let _,g;return e[11]===Symbol.for("react.memo_cache_sentinel")?(_=c.jsx(Ia,{strokeWidth:1.5,size:18}),e[11]=_):_=e[11],e[12]!==h||e[13]!==m?(g=c.jsx(Te,{content:f,children:c.jsx(xn,{"data-testid":"save-button",id:"save-button",shape:"rectangle",color:m,onClick:h,children:_})}),e[12]=h,e[13]=m,e[14]=g):g=e[14],g};function Md(){const t=K.c(19),{openModal:e,closeModal:n,openAlert:o}=$n(),r=Ot(Td),s=A4(),i=T4();let a;t[0]!==o||t[1]!==r||t[2]!==i?(a=(p,b)=>{const x=Nn(),y=zm(x),v=y.map(cj),C=y.map(lj),S=y.map(aj),E=M4(x),N=i.get(hn),j=i.get(O4),T=i.get(cC);i.get(Os)||C.length!==0&&(N.state===$t.OPEN?(vt.log("saving to ",p),iU({cellIds:v,codes:C,names:S,filename:p,configs:E,layout:pW(),persist:!0}).then(()=>{b&&j.format_on_save&&D4(),r({names:S,codes:C,configs:E,layout:T})})):o("Failed to save notebook: not connected to a kernel."))},t[0]=o,t[1]=r,t[2]=i,t[3]=a):a=t[3];const l=qe(a);let d;t[4]!==l||t[5]!==i?(d=p=>{const b=p!==void 0&&p,x=i.get(R4),y=i.get(hn);e1(x)&&y.state===$t.OPEN&&l(x,b)},t[4]=l,t[5]=i,t[6]=d):d=t[6];const u=qe(d);let h;t[7]!==l||t[8]!==s?(h=p=>{s(p).then(b=>{b!==null&&l(b,!0)})},t[7]=l,t[8]=s,t[9]=h):h=t[9];const f=h;let m;t[10]!==n||t[11]!==f||t[12]!==e||t[13]!==u||t[14]!==i?(m=()=>{const p=i.get(R4),b=i.get(hn);u(!0),e1(p)||b.state===$t.CLOSED||e(c.jsx(hj,{onClose:n,onSave:f}))},t[10]=n,t[11]=f,t[12]=e,t[13]=u,t[14]=i,t[15]=m):m=t[15];const _=qe(m);let g;return t[16]!==u||t[17]!==_?(g={saveOrNameNotebook:_,saveIfNotebookIsPersistent:u},t[16]=u,t[17]=_,t[18]=g):g=t[18],g}function aj(t){return t.name}function lj(t){return t.code}function cj(t){return t.id}function e1(t){return t!==null&&!t.startsWith("/tmp")&&!t.startsWith("/var/folders")&&!t.includes("AppData\\Local\\Temp")}function dj(t){return t.name}function uj(t){return t.code}const hj=t=>{const e=K.c(17),{onClose:n,onSave:o}=t,[r,s]=O.useState();let i;e[0]!==n||e[1]!==o?(i=p=>{s(p),p.trim()&&(o(p),n())},e[0]=n,e[1]=o,e[2]=i):i=e[2];const a=i;let l,d,u,h;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(sr,{children:"Save notebook"}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(Fr,{className:"text-md pt-6 px-1",children:"Save as"}),e[4]=d):d=e[4],e[5]!==a?(u=c.jsxs("div",{className:"flex flex-col",children:[d,c.jsx(Zg,{onNameChange:a,placeholderText:"filename",className:"missing-filename"})]}),e[5]=a,e[6]=u):u=e[6],e[7]!==n?(h=c.jsx(Ae,{"data-testid":"cancel-save-dialog-button","aria-label":"Cancel",variant:"secondary",onClick:n,children:"Cancel"}),e[7]=n,e[8]=h):h=e[8];const f=!r;let m,_,g;return e[9]!==f?(m=c.jsx(Ae,{"data-testid":"submit-save-dialog-button","aria-label":"Save",variant:"default",disabled:f,type:"submit",children:"Save"}),e[9]=f,e[10]=m):m=e[10],e[11]!==h||e[12]!==m?(_=c.jsxs(Ki,{children:[h,m]}),e[11]=h,e[12]=m,e[13]=_):_=e[13],e[14]!==u||e[15]!==_?(g=c.jsxs(ar,{children:[l,u,_]}),e[14]=u,e[15]=_,e[16]=g):g=e[16],g};function t1(t){const e=K.c(3),[n,o]=O.useState(!1);let r,s;return e[0]!==t?(r=()=>{if(!t)return;o(!1);const i=setTimeout(()=>{o(!0)},200);return()=>clearTimeout(i)},s=[t],e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]),O.useEffect(r,s),t&&n}const ei=t=>{const{children:e}=t;return Le(Os)?null:e},fj=t=>{const{children:e}=t;return Le(Os)?e:null},mj=()=>{const t=K.c(6),e=Ot(Sd);let n;t[0]!==e?(n=()=>e(pj),t[0]=e,t[1]=n):n=t[1];const o=n;let r,s,i;return t[2]===Symbol.for("react.memo_cache_sentinel")?(r=on("global.commandPalette"),t[2]=r):r=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(s=c.jsx(ad,{strokeWidth:1.5,size:18}),t[3]=s):s=t[3],t[4]!==o?(i=c.jsx(Te,{content:r,children:c.jsx(xn,{"data-testid":"command-palette-button",onClick:o,shape:"rectangle",color:"hint-green",children:s})}),t[4]=o,t[5]=i):i=t[5],i};function pj(t){return!t}const gj=t=>{const e=K.c(47),{presenting:n,onTogglePresenting:o,onInterrupt:r,onRun:s,connectionState:i,running:a,appConfig:l}=t,d=l.width,u=Le(v4),h=Le(aU),{undoDeleteCell:f}=bt(),m=i===$t.CLOSED;let _,g=null;if(!m&&u){let k,$;e[0]===Symbol.for("react.memo_cache_sentinel")?(k=c.jsx(bd,{size:16,strokeWidth:1.5}),e[0]=k):k=e[0],e[1]!==f?($=c.jsx(Te,{content:"Undo cell deletion",children:c.jsx(xn,{"data-testid":"undo-delete-cell",size:"medium",color:"hint-green",shape:"circle",onClick:f,children:k})}),e[1]=f,e[2]=$):$=e[2],g=$}e[3]!==i?(_=po(i),e[3]=i,e[4]=_):_=e[4];const p=_;let b;e[5]!==i||e[6]!==p?(b=p?td(i):void 0,e[5]=i,e[6]=p,e[7]=b):b=e[7];const x=b;let y,v;e[8]!==n?(y=!n&&c.jsx(qN,{}),e[8]=n,e[9]=y):y=e[9],e[10]!==m||e[11]!==x||e[12]!==p||e[13]!==n?(v=!m&&c.jsxs("div",{className:xj,children:[n&&c.jsx(lN,{}),c.jsx(PN,{disabled:p,tooltip:x}),c.jsx(nW,{disabled:p,tooltip:x}),c.jsx(oW,{description:"This will terminate the Python kernel. You'll lose all data that's in memory.",disabled:p,tooltip:x})]}),e[10]=m,e[11]=x,e[12]=p,e[13]=n,e[14]=v):v=e[14];const C=d==="compact"&&"xl:flex-row items-end";let S,E,N,j,T,A,M,P,R,L,B,U,D;return e[15]!==C?(S=Ne(yj,C),e[15]=C,e[16]=S):S=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(E=c.jsx(ei,{children:c.jsx(ij,{kioskMode:!1})}),e[17]=E):E=e[17],e[18]===Symbol.for("react.memo_cache_sentinel")?(N=on("global.hideCode"),e[18]=N):N=e[18],e[19]!==n?(j=n?c.jsx(k4,{strokeWidth:1.5,size:18}):c.jsx(ud,{strokeWidth:1.5,size:18}),e[19]=n,e[20]=j):j=e[20],e[21]!==o||e[22]!==j?(T=c.jsx(Te,{content:N,children:c.jsx(xn,{"data-testid":"hide-code-button",id:"preview-button",shape:"rectangle",color:"hint-green",onClick:o,children:j})}),e[21]=o,e[22]=j,e[23]=T):T=e[23],e[24]===Symbol.for("react.memo_cache_sentinel")?(A=c.jsx(mj,{}),M=c.jsx(rW,{}),P=c.jsx("div",{}),e[24]=A,e[25]=M,e[26]=P):(A=e[24],M=e[25],P=e[26]),e[27]!==m||e[28]!==r||e[29]!==a?(R=!m&&c.jsx(bj,{running:a,onInterrupt:r}),e[27]=m,e[28]=r,e[29]=a,e[30]=R):R=e[30],e[31]!==m||e[32]!==h||e[33]!==s?(L=!m&&c.jsx(_j,{needsRun:h,onRun:s}),e[31]=m,e[32]=h,e[33]=s,e[34]=L):L=e[34],e[35]!==R||e[36]!==L||e[37]!==g?(B=c.jsx(ei,{children:c.jsxs("div",{className:"flex flex-col gap-2 items-center",children:[g,R,L]})}),e[35]=R,e[36]=L,e[37]=g,e[38]=B):B=e[38],e[39]!==T||e[40]!==B||e[41]!==S?(U=c.jsxs("div",{className:S,children:[E,T,A,M,P,B]}),e[39]=T,e[40]=B,e[41]=S,e[42]=U):U=e[42],e[43]!==U||e[44]!==y||e[45]!==v?(D=c.jsxs(c.Fragment,{children:[y,v,U]}),e[43]=U,e[44]=y,e[45]=v,e[46]=D):D=e[46],D},_j=t=>{const e=K.c(8),{needsRun:n,onRun:o}=t,r=Le(P4);if(n){let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=on("global.runStale"),e[0]=l):l=e[0];const d=r?o:void 0,u=!r;let h,f;return e[1]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(Wr,{strokeWidth:1.5,size:16}),e[1]=h):h=e[1],e[2]!==d||e[3]!==u?(f=c.jsx(Te,{content:l,children:c.jsx(xn,{"data-testid":"run-button",size:"medium",color:"yellow",shape:"circle",onClick:d,disabled:u,children:h})}),e[2]=d,e[3]=u,e[4]=f):f=e[4],f}const s=!r;let i,a;return e[5]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(Wr,{strokeWidth:1.5,size:16}),e[5]=i):i=e[5],e[6]!==s?(a=c.jsx(Te,{content:"Nothing to run",children:c.jsx(xn,{"data-testid":"run-button",className:"inactive-button",color:"disabled",size:"medium",shape:"circle",disabled:s,children:i})}),e[6]=s,e[7]=a):a=e[7],a},bj=t=>{const e=K.c(8),{running:n,onInterrupt:o}=t,r=t1(n);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=on("global.interrupt"),e[0]=s):s=e[0];const i=!r&&"inactive-button active:shadow-xsSolid";let a;e[1]!==i?(a=Ne(i),e[1]=i,e[2]=a):a=e[2];const l=r?"yellow":"disabled",d=r?o:Hn.NOOP;let u,h;return e[3]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx(vc,{strokeWidth:1.5,size:16}),e[3]=u):u=e[3],e[4]!==a||e[5]!==l||e[6]!==d?(h=c.jsx(Te,{content:s,children:c.jsx(xn,{className:a,"data-testid":"interrupt-button",size:"medium",color:l,shape:"circle",onClick:d,children:u})}),e[4]=a,e[5]=l,e[6]=d,e[7]=h):h=e[7],h},xj="absolute top-3 right-5 m-0 flex items-center space-x-3 min-h-[28px] no-print pointer-events-auto z-30 print:hidden",yj="absolute bottom-5 right-5 flex flex-col gap-2 items-center no-print pointer-events-auto z-30 print:hidden",wj=t=>{const e=K.c(7),{filename:n}=t,o=A4();let r;e[0]!==n?(r=n?jn.basename(n):"untitled marimo notebook",e[0]=n,e[1]=r):r=e[1];const s=n===null?"missing-filename":"filename";let i;return e[2]!==n||e[3]!==o||e[4]!==r||e[5]!==s?(i=c.jsx(Zg,{placeholderText:r,initialValue:n,onNameChange:o,flexibleWidth:!0,resetOnBlur:!0,"data-testid":"filename-input",className:s}),e[2]=n,e[3]=o,e[4]=r,e[5]=s,e[6]=i):i=e[6],i};function n1(){return{selectionStart:null,selectionEnd:null,selected:new Set}}const{valueAtom:Od,useActions:vj}=lU(n1,{select:(t,e)=>({selectionStart:e.cellId,selectionEnd:e.cellId,selected:new Set([e.cellId])}),extend:(t,e)=>{if(!t.selectionStart)return{selectionStart:e.cellId,selectionEnd:e.cellId,selected:new Set([e.cellId])};const{cellId:n,allCellIds:o}=e;try{const r=o.findWithId(t.selectionStart),s=r.indexOfOrThrow(t.selectionStart),i=r.indexOfOrThrow(n),[a,l]=s<i?[s,i]:[i,s],d=r.slice(a,l+1);return{selectionStart:t.selectionStart,selectionEnd:n,selected:new Set(d)}}catch{return{selectionStart:n,selectionEnd:n,selected:new Set([n])}}},clear:t=>t.selected.size===0?t:n1()});function Dd(){return vj()}const kj=t=>{const e=K.c(9),{actions:n,cellIds:o}=t;let r,s,i;if(e[0]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(fr,{asChild:!0,children:c.jsx(Ae,{variant:"ghost",size:"sm",className:"h-8 px-2 gap-1",title:"More actions",children:c.jsx(pp,{size:13,strokeWidth:1.5})})}),e[0]=r):r=e[0],e[1]!==n||e[2]!==o){let a;e[4]!==n.length||e[5]!==o?(a=(l,d)=>{const u=l.map(h=>c.jsx(Vt,{onSelect:()=>h.handle(o),className:"flex items-center gap-2",children:c.jsxs("div",{className:"flex items-center gap-2",children:[h.icon,c.jsx("span",{className:"text-xs",children:h.label})]})},h.label));return c.jsxs(X.Fragment,{children:[u,d<n.length-1&&c.jsx(bn,{})]},d)},e[4]=n.length,e[5]=o,e[6]=a):a=e[6],s=n.flatMap(a),e[1]=n,e[2]=o,e[3]=s}else s=e[3];return e[7]!==s?(i=c.jsxs(hr,{children:[r,c.jsx(mr,{align:"start","data-keep-cell-selection":!0,children:s})]}),e[7]=s,e[8]=i):i=e[8],i};function Sj(t){const e=K.c(22),{updateCellConfig:n,moveCell:o,clearCellOutput:r}=bt(),s=function(){const E=K.c(3),{deleteCell:N,undoDeleteCell:j}=bt();let T;return E[0]!==N||E[1]!==j?(T=async A=>{if(at.get(lc))return;const{cellIds:M}=A;for(const L of M)await o4({cellId:L}).then(()=>{N({cellId:L})});const{dismiss:P}=nt({title:"Cells deleted",action:c.jsx(Da,{"data-testid":"undo-delete-button",onClick:()=>{for(const L of M)j();R()}})}),R=P},E[0]=N,E[1]=j,E[2]=T):T=E[2],qe(T)}(),i=Le(lc),a=Dd(),l=Ks(),d=t.length,u=!i||d<t.length;let h;e[0]!==s||e[1]!==a?(h=E=>{s({cellIds:E}),a.clear()},e[0]=s,e[1]=a,e[2]=h):h=e[2];const f=qe(h);let m;e[3]!==o?(m=(E,N)=>{if(N==="down"){const j=E[E.length-1];if(at.get(cr).cellIds.findWithId(j).last()===j)return}if(N==="up"){const j=E[0];if(at.get(cr).cellIds.findWithId(j).first()===j)return}(N==="up"?E:[...E].reverse()).forEach(j=>{o({cellId:j,before:N==="up"})})},e[3]=o,e[4]=m):m=e[4];const _=qe(m),g=qe(Tj);let p;e[5]!==r?(p=E=>{E.forEach(N=>{r({cellId:N})})},e[5]=r,e[6]=p):p=e[6];const b=qe(p);let x;e[7]!==n?(x=async(E,N,j)=>{const T={};E.forEach(A=>{T[A]={[N]:j}}),await ur({configs:T}),E.forEach(A=>{n({cellId:A,config:T[A]})})},e[7]=n,e[8]=x):x=e[8];const y=qe(x);let v,C,S;if(e[9]===Symbol.for("react.memo_cache_sentinel")?(v=c.jsx(Wr,{size:13,strokeWidth:1.5}),e[9]=v):v=e[9],e[10]!==l?(C=E=>l(E),e[10]=l,e[11]=C):C=e[11],e[12]!==u||e[13]!==b||e[14]!==f||e[15]!==g||e[16]!==_||e[17]!==C||e[18]!==y){const E=[[{icon:v,label:"Run cells",handle:C}],[{icon:c.jsx(Sm,{size:13,strokeWidth:1.5}),label:"Move up",handle:A=>_(A,"up")},{icon:c.jsx(dr,{size:13,strokeWidth:1.5}),label:"Move down",handle:A=>_(A,"down")}],[{icon:c.jsx(fc,{size:13,strokeWidth:1.5}),label:"Delete cells",variant:"danger",hidden:!u,handle:f}]],N=[[{icon:c.jsx(s4,{size:13,strokeWidth:1.5}),label:"Format cells",handle:g},{icon:c.jsx(Zi,{size:13,strokeWidth:1.5}),label:"Clear outputs",handle:b}],[{icon:c.jsx(vm,{size:13,strokeWidth:1.5}),label:"Hide cells",handle:A=>y(A,"hide_code",!0)},{icon:c.jsx(wm,{size:13,strokeWidth:1.5}),label:"Show cells",handle:A=>y(A,"hide_code",!1)}],[{icon:c.jsx(wn,{size:13,strokeWidth:1.5}),label:"Disable cells",handle:A=>y(A,"disabled",!0)},{icon:c.jsx(vn,{size:13,strokeWidth:1.5}),label:"Enable cells",handle:A=>y(A,"disabled",!1)}]],j=E.map(Ij);let T;e[20]!==j?(T=j.filter(Ej),e[20]=j,e[21]=T):T=e[21],S={actions:T,moreActions:N.map(Nj).filter(Cj)},e[12]=u,e[13]=b,e[14]=f,e[15]=g,e[16]=_,e[17]=C,e[18]=y,e[19]=S}else S=e[19];return S}function Cj(t){return t.length>0}function Nj(t){return t.filter(jj)}function jj(t){return!t.hidden}function Ej(t){return t.length>0}function Ij(t){return t.filter(Aj)}function Aj(t){return!t.hidden}function Tj(t){const e={};t.forEach(n=>{const o=Qi(n);o&&(e[n]=o)}),r4(e)}const Mj=()=>{const t=K.c(4),e=Le(Od);let n;t[0]!==e.selected?(n=[...e.selected],t[0]=e.selected,t[1]=n):n=t[1];const o=n;if(o.length<2)return null;let r;return t[2]!==o?(r=c.jsx(Oj,{cellIds:o}),t[2]=o,t[3]=r):r=t[3],r},Rd=()=>{const t=K.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx("div",{className:"h-4 w-px bg-border mx-1"}),t[0]=e):e=t[0],e},Oj=t=>{const e=K.c(19),{cellIds:n}=t,o=Dd(),{actions:r,moreActions:s}=Sj(n),i=n.length;let a,l,d,u,h,f,m;if(e[0]!==o?(a=_=>{(_.target instanceof HTMLElement||_.target instanceof SVGElement)&&_.target.closest("[data-keep-cell-selection]")!==null||_.target instanceof HTMLHtmlElement||o.clear()},e[0]=o,e[1]=a):a=e[1],ac(window,"mousedown",a),e[2]!==i?(l=c.jsxs("span",{className:"text-sm font-medium text-muted-foreground px-2 flex-shrink-0",children:[i," cells selected"]}),e[2]=i,e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(Rd,{}),e[4]=d):d=e[4],e[5]!==r||e[6]!==n){let _;e[8]!==r.length||e[9]!==n?(_=(g,p)=>c.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[g.map(b=>c.jsxs(Ae,{variant:b.variant==="danger"?"linkDestructive":"ghost",size:"sm",onClick:()=>b.handle(n),className:"h-8 px-2 gap-1 flex-shrink-0",title:b.label,children:[b.icon,c.jsx("span",{className:"text-xs",children:b.label})]},b.label)),p<r.length-1&&c.jsx(Rd,{})]},p),e[8]=r.length,e[9]=n,e[10]=_):_=e[10],u=r.map(_),e[5]=r,e[6]=n,e[7]=u}else u=e[7];return e[11]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(Rd,{}),e[11]=h):h=e[11],e[12]!==n||e[13]!==s?(f=c.jsx(kj,{actions:s,cellIds:n}),e[12]=n,e[13]=s,e[14]=f):f=e[14],e[15]!==l||e[16]!==u||e[17]!==f?(m=c.jsx("div",{className:"absolute top-12 justify-center flex w-full left-0 right-0 z-50","data-keep-cell-selection":!0,children:c.jsx("div",{className:"bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 border border-[var(--slate-7)] rounded-lg shadow-lg p-2 overflow-x-auto overflow-y-hidden mx-20 scrollbar-thin",children:c.jsxs("div",{className:"flex items-center gap-1",children:[l,d,u,h,f]})})}),e[15]=l,e[16]=u,e[17]=f,e[18]=m):m=e[18],m},Dj={display:"none"};function Rj(t){let{id:e,value:n}=t;return X.createElement("div",{id:e,style:Dj},n)}function Pj(t){let{id:e,announcement:n,ariaLiveType:o="assertive"}=t;return X.createElement("div",{id:e,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":o,"aria-atomic":!0},n)}const o1=O.createContext(null),Lj={draggable:`
99
99
  To pick up a draggable item, press the space bar.
100
100
  While dragging, use the arrow keys to move the item.
101
101
  Press space again to drop the item in its new position, or press escape to cancel.
@@ -125,7 +125,7 @@ ${t.stack}`:o}function oo(t,e){return t>>>=0,ts().subarray(t/1,t/1+e)}function Y
125
125
  relative before:content-[''] before:absolute before:inset-y-0 before:-left-[3px]
126
126
  before:right-[-3px] before:w-[9px] before:z-[-1]
127
127
  hover/column:bg-[var(--slate-3)] dark:hover/column:bg-[var(--slate-5)]
128
- hover/column:hover:bg-primary/60 dark:hover/column:hover:bg-primary/60`})}const IO=t=>{const e=K.c(10),{width:n}=t,{banners:o}=vW(),{removeBanner:r}=kW();if(o.length===0)return null;const s=n==="columns"&&"sticky left-12 w-full max-w-[80vw]";let i,a,l;if(e[0]!==s?(i=Ne("flex flex-col gap-4 mb-5 print:hidden",s),e[0]=s,e[1]=i):i=e[1],e[2]!==o||e[3]!==r){let d;e[5]!==r?(d=u=>c.jsxs(ba,{kind:u.variant||"info",className:"flex flex-col rounded p-3",children:[c.jsxs("div",{className:"flex justify-between",children:[c.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[c.jsx(pS,{className:"w-5 h-5 inline-block mr-2"}),u.title]}),c.jsx(Ae,{"data-testid":"remove-banner-button",variant:"text",size:"icon",onClick:()=>r(u.id),children:c.jsx(eo,{className:"w-5 h-5"})})]}),c.jsxs("div",{className:"flex justify-between items-end",children:[c.jsx("span",{children:sp({html:u.description})}),u.action==="restart"&&c.jsx(AO,{})]})]},u.id),e[5]=r,e[6]=d):d=e[6],a=o.map(d),e[2]=o,e[3]=r,e[4]=a}else a=e[4];return e[7]!==i||e[8]!==a?(l=c.jsx("div",{className:i,children:a}),e[7]=i,e[8]=a,e[9]=l):l=e[9],l},AO=()=>{const t=K.c(3),e=qg();let n,o;return t[0]===Symbol.for("react.memo_cache_sentinel")?(n=c.jsx(Zp,{className:"w-3 h-3 mr-2"}),t[0]=n):n=t[0],t[1]!==e?(o=c.jsxs(Ae,{"data-testid":"restart-session-button",variant:"link",size:"xs",onClick:e,children:[n,"Restart"]}),t[1]=e,t[2]=o):o=t[2],o},TO=zt(t=>{const e=t(cr);for(const n of e.cellIds.inOrderIds){const o=e.cellRuntime[n];if(o.status==="idle"&&o.consoleOutputs.some(r=>r.channel==="stdin"&&r.response===void 0))return!0}return!1}),MO=()=>{const t=K.c(3),e=OO;if(!Le(TO))return null;let n,o,r;if(t[0]===Symbol.for("react.memo_cache_sentinel")?(n=c.jsx("div",{className:"flex justify-between",children:c.jsx("span",{className:"font-bold text-lg flex items-center mb-1",children:"Program waiting for input"})}),t[0]=n):n=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(o=c.jsx(U4,{className:"inline",children:"stdin"}),t[1]=o):o=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")){const s=c.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-1/2 transform -translate-x-1/2 z-[200] opacity-95",children:c.jsxs(ba,{kind:"info",className:"flex flex-col rounded py-2 px-4 animate-in slide-in-from-top w-fit",children:[n,c.jsx("div",{className:"flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",children:c.jsx("div",{children:c.jsxs("p",{children:["The program is still running, but blocked on"," ",o,".",c.jsx(Ae,{variant:"link",className:"h-auto font-normal",onClick:e,children:"Jump to the cell"})]})})})]})});r=c.jsx(Gc,{milliseconds:2e3,children:s}),t[2]=r}else r=t[2];return r};function OO(){const t=document.querySelector("[data-stdin-blocking]");t?(t.scrollIntoView({behavior:"smooth",block:"center"}),requestAnimationFrame(()=>{t.focus()})):vt.error("No element with data-stdin-blocking found")}function DO(){const t=setTimeout(RO,100);return()=>clearTimeout(t)}function RO(){requestAnimationFrame(PO)}function PO(){const t=function(e){const n=e.match(/scrollTo=([^&]+)/),o=n==null?void 0:n[1];return o?decodeURIComponent(o.split("&")[0]):null}(window.location.hash);if(t)(function(e){var o,r;if(Zy)return;const n=document.querySelector(`[data-cell-name="${e}"]`);if(n){if(n.scrollIntoView({behavior:"smooth",block:"start"}),Zy=!0,n instanceof HTMLElement){n.focus();const{cellHandles:s}=Nn(),i=n.dataset.cellId;if(!i)return void vt.error(`Missing cellId for cell with name ${e}`);const a=(r=(o=s[i])==null?void 0:o.current)==null?void 0:r.editorView;a&&a.focus()}}else vt.warn(`Cannot focus cell with name ${e} because it was not found`),Xy()})(t);else try{Xy()}catch(e){const n=e;vt.warn("Error focusing first editor",n)}}function Xy(){var o,r;const{cellIds:t,cellData:e,cellHandles:n}=Nn();for(const s of t.iterateTopLevelIds){const i=n[s];if(!((o=e[s])==null?void 0:o.config.hide_code)&&((r=i==null?void 0:i.current)!=null&&r.editorView))return void i.current.editorView.focus()}}let Zy=!1;const LO=t=>{const e=K.c(8),n=Le(_$),o=t.appConfig.width==="columns";let r,s,i;return e[0]!==t?(r=c.jsx(FO,{...t}),e[0]=t,e[1]=r):r=e[1],e[2]!==n||e[3]!==r?(s=c.jsx(O1,{id:"column-container",items:n,strategy:gE,children:r}),e[2]=n,e[3]=r,e[4]=s):s=e[4],e[5]!==o||e[6]!==s?(i=c.jsx(xO,{multiColumn:o,children:s}),e[5]=o,e[6]=s,e[7]=i):i=e[7],i},FO=t=>{const e=K.c(52),{mode:n,userConfig:o,appConfig:r,connStatus:s}=t,i=Ac(),a=bt(),{theme:l}=xr(),{toggleSidebarPanel:d}=sa();gS(DO),Jt("global.focusTop",a.focusTopCell),Jt("global.focusBottom",a.focusBottomCell),Jt("global.toggleSidebar",d),Jt("global.foldCode",a.foldAll),Jt("global.unfoldCode",a.unfoldAll),Jt("global.formatAll",UO),Jt("cell.hideCode",Hn.NOOP),Jt("cell.format",Hn.NOOP);const u=vd(),h=a.scrollToTarget;let f,m,_,g,p,b,x,y,v,C,S,E,N,j,T,A;if(e[0]!==i.scrollKey||e[1]!==h?(f=()=>{i.scrollKey!==null&&h()},e[0]=i.scrollKey,e[1]=h,e[2]=f):f=e[2],e[3]!==i.cellIds||e[4]!==i.scrollKey||e[5]!==h?(m=[i.cellIds,i.scrollKey,h],e[3]=i.cellIds,e[4]=i.scrollKey,e[5]=h,e[6]=m):m=e[6],O.useEffect(f,m),e[7]!==a||e[8]!==r||e[9]!==s||e[10]!==n||e[11]!==i||e[12]!==u||e[13]!==l||e[14]!==o){const M=i.cellIds.getColumns();let P;e[26]!==i.cellIds?(P=i.cellIds.hasOnlyOneId(),e[26]=i.cellIds,e[27]=P):P=e[27];const R=P;let L;e[28]!==i.cellIds.inOrderIds?(L=i.cellIds.inOrderIds.includes($o),e[28]=i.cellIds.inOrderIds,e[29]=L):L=e[29];const B=L;_=SW,v="pb-[40vh]",C=!1,S=r,E="pr-4",e[30]===Symbol.for("react.memo_cache_sentinel")?(N=c.jsx(rO,{}),g=c.jsx(MO,{}),p=c.jsx(vO,{}),e[30]=g,e[31]=p,e[32]=N):(g=e[30],p=e[31],N=e[32]),e[33]!==r.width?(b=c.jsx(IO,{width:r.width}),e[33]=r.width,e[34]=b):b=e[34];const U=r.width==="columns"&&"grid grid-flow-col auto-cols-min gap-6";e[35]!==U?(x=Ne(U),e[35]=U,e[36]=x):x=e[36],y=M.map((D,k)=>c.jsx(zO,{column:D,index:k,columnsLength:M.length,appConfig:r,notebook:i,mode:n,userConfig:o,connStatus:s,actions:a,theme:l,hasOnlyOneCell:R,hasSetupCell:B,onDeleteCell:u},D.id)),e[7]=a,e[8]=r,e[9]=s,e[10]=n,e[11]=i,e[12]=u,e[13]=l,e[14]=o,e[15]=_,e[16]=g,e[17]=p,e[18]=b,e[19]=x,e[20]=y,e[21]=v,e[22]=C,e[23]=S,e[24]=E,e[25]=N}else _=e[15],g=e[16],p=e[17],b=e[18],x=e[19],y=e[20],v=e[21],C=e[22],S=e[23],E=e[24],N=e[25];return e[37]!==x||e[38]!==y?(j=c.jsx("div",{className:x,children:y}),e[37]=x,e[38]=y,e[39]=j):j=e[39],e[40]===Symbol.for("react.memo_cache_sentinel")?(T=c.jsx(CW,{}),e[40]=T):T=e[40],e[41]!==_||e[42]!==g||e[43]!==p||e[44]!==b||e[45]!==j||e[46]!==v||e[47]!==C||e[48]!==S||e[49]!==E||e[50]!==N?(A=c.jsxs(_,{className:v,invisible:C,appConfig:S,innerClassName:E,children:[N,g,p,b,j,T]}),e[41]=_,e[42]=g,e[43]=p,e[44]=b,e[45]=j,e[46]=v,e[47]=C,e[48]=S,e[49]=E,e[50]=N,e[51]=A):A=e[51],A},zO=t=>{const e=K.c(40),{column:n,index:o,columnsLength:r,appConfig:s,notebook:i,mode:a,userConfig:l,connStatus:d,actions:u,theme:h,hasOnlyOneCell:f,hasSetupCell:m,onDeleteCell:_}=t,g=d.state,p=n.id,b=o>0,x=o<r-1,y=s.width,v=r>1,C=n.id,S=s.width==="columns"&&"opacity-0 group-hover/column:opacity-100";let E,N;e[0]!==S?(E=Ne(S),e[0]=S,e[1]=E):E=e[1],e[2]!==n.id||e[3]!==E?(N=c.jsx(BO,{columnId:C,className:E}),e[2]=n.id,e[3]=E,e[4]=N):N=e[4];const j=`column-${o+1}`,T=n.topLevelIds;let A,M,P,R;return e[5]!==u||e[6]!==g||e[7]!==m||e[8]!==o||e[9]!==a||e[10]!==i||e[11]!==_||e[12]!==h||e[13]!==l?(A=o===0&&m&&c.jsx(Hy,{theme:h,showPlaceholder:!1,...i.cellData[$o],...i.cellRuntime[$o],...u,runElapsedTimeMs:i.cellRuntime[$o].runElapsedTimeMs??i.cellData[$o].lastExecutionTime,canDelete:!0,mode:a,connectionState:g,ref:i.cellHandles[$o],userConfig:l,isCollapsed:!1,collapseCount:0,canMoveX:!1,actions:u,deleteCell:_},$o),e[5]=u,e[6]=g,e[7]=m,e[8]=o,e[9]=a,e[10]=i,e[11]=_,e[12]=h,e[13]=l,e[14]=A):A=e[14],e[15]!==u||e[16]!==s.width||e[17]!==n||e[18]!==g||e[19]!==f||e[20]!==a||e[21]!==i||e[22]!==_||e[23]!==h||e[24]!==l?(M=n.topLevelIds.map(L=>{if(L===$o)return null;const B=i.cellData[L],U=i.cellRuntime[L];return c.jsx(Hy,{theme:h,showPlaceholder:f,...B,...U,runElapsedTimeMs:U.runElapsedTimeMs??B.lastExecutionTime,canDelete:!f,mode:a,connectionState:g,ref:i.cellHandles[L],userConfig:l,config:B.config,name:B.name,isCollapsed:n.isCollapsed(L),collapseCount:n.getCount(L),canMoveX:s.width==="columns",actions:u,deleteCell:_},B.id.toString())}),e[15]=u,e[16]=s.width,e[17]=n,e[18]=g,e[19]=f,e[20]=a,e[21]=i,e[22]=_,e[23]=h,e[24]=l,e[25]=M):M=e[25],e[26]!==n.topLevelIds||e[27]!==j||e[28]!==A||e[29]!==M?(P=c.jsxs(O1,{id:j,items:T,strategy:_E,children:[A,M]}),e[26]=n.topLevelIds,e[27]=j,e[28]=A,e[29]=M,e[30]=P):P=e[30],e[31]!==s.width||e[32]!==n.id||e[33]!==o||e[34]!==P||e[35]!==b||e[36]!==x||e[37]!==v||e[38]!==N?(R=c.jsx(Ky,{columnId:p,index:o,canMoveLeft:b,canMoveRight:x,width:y,canDelete:v,footer:N,children:P}),e[31]=s.width,e[32]=n.id,e[33]=o,e[34]=P,e[35]=b,e[36]=x,e[37]=v,e[38]=N,e[39]=R):R=e[39],R},BO=t=>{const e=K.c(17),{columnId:n,className:o}=t,{createNewCell:r}=bt(),[s,i]=b$(!1),a=Le(cc),l=Le(P4);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=Ne("mb-0 rounded-none sm:px-4 md:px-5 lg:px-8 tracking-wide no-wrap whitespace-nowrap","hover:bg-accent hover:text-accent-foreground font-semibold uppercase text-xs"),e[0]=d):d=e[0];const u=d;let h;e[1]!==a||e[2]!==n||e[3]!==r||e[4]!==s||e[5]!==i.toggle||e[6]!==l?(h=()=>s?c.jsx(x$,{onClose:i.toggle}):c.jsxs(c.Fragment,{children:[c.jsxs(Ae,{className:u,variant:"text",size:"sm",disabled:!l,onClick:()=>r({cellId:{type:"__end__",columnId:n},before:!1}),children:[c.jsx(tg,{className:"mr-2 size-4 flex-shrink-0"}),"Python"]}),c.jsxs(Ae,{className:u,variant:"text",size:"sm",disabled:!l,onClick:()=>{fo({autoInstantiate:!0,createNewCell:r}),r({cellId:{type:"__end__",columnId:n},before:!1,code:new ra().defaultCode,hideCode:!0})},children:[c.jsx(rg,{className:"mr-2 size-4 flex-shrink-0"}),"Markdown"]}),c.jsxs(Ae,{className:u,variant:"text",size:"sm",disabled:!l,onClick:()=>{fo({autoInstantiate:!0,createNewCell:r}),r({cellId:{type:"__end__",columnId:n},before:!1,code:new Vc().defaultCode})},children:[c.jsx(lr,{className:"mr-2 size-4 flex-shrink-0"}),"SQL"]}),c.jsx(Te,{content:a?null:c.jsx("span",{children:"Enable via settings under AI Assist"}),delayDuration:100,asChild:!1,children:c.jsxs(Ae,{className:u,variant:"text",size:"sm",disabled:!a||!l,onClick:i.toggle,children:[c.jsx(ea,{className:"mr-2 size-4 flex-shrink-0"}),"Generate with AI"]})})]}),e[1]=a,e[2]=n,e[3]=r,e[4]=s,e[5]=i.toggle,e[6]=l,e[7]=h):h=e[7];const f=h,m=!s&&"w-fit",_=s&&"opacity-100 w-full max-w-4xl shadow-lg shadow-[var(--blue-3)]";let g,p,b;return e[8]!==o||e[9]!==m||e[10]!==_?(g=Ne("shadow-sm border border-border rounded transition-all duration-200 overflow-hidden divide-x divide-border flex",m,_,o),e[8]=o,e[9]=m,e[10]=_,e[11]=g):g=e[11],e[12]!==f?(p=f(),e[12]=f,e[13]=p):p=e[13],e[14]!==g||e[15]!==p?(b=c.jsx("div",{className:"flex justify-center mt-4 pt-6 pb-32 group gap-4 w-full print:hidden",children:c.jsx("div",{className:g,children:p})}),e[14]=g,e[15]=p,e[16]=b):b=e[16],b};function UO(){D4()}const VO=y$(w$,400),$O=(t,e)=>{at.get(Os)||t.isEmpty()||e.isEmpty()||aa(t.inOrderIds,e.inOrderIds)||VO({cell_ids:t.inOrderIds})},Qy=t=>{const e=K.c(66),{userConfig:n,appConfig:o,hideControls:r}=t,s=r!==void 0&&r;v$(qc,$O);const{setCells:i,mergeAllColumns:a,collapseAllCells:l,expandAllCells:d}=bt(),u=Le(_m),h=Le(k$),f=Le(S$),m=Dm(),_=Ot(Td),g=u.mode==="edit",p=u.mode==="present",b=Le(C$);let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=[],e[0]=x):x=e[0],O.useEffect(WO,x);const y=n.runtime.auto_instantiate;let v,C,S;e[1]!==i||e[2]!==_?(v=(fe,de)=>{i(fe);const ue=fe.map(qO),ce=fe.map(GO),ke=fe.map(YO);_({names:ue,codes:ce,configs:ke,layout:de})},e[1]=i,e[2]=_,e[3]=v):v=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(C=Z4(),e[4]=C):C=e[4],e[5]!==v||e[6]!==n.runtime.auto_instantiate?(S={autoInstantiate:y,setCells:v,sessionId:C},e[5]=v,e[6]=n.runtime.auto_instantiate,e[7]=S):S=e[7];const{connection:E}=NW(S);let N,j;e[8]!==o.app_title||e[9]!==m?(N=()=>{document.title=o.app_title||jn.basename(m??"")||"Untitled Notebook"},j=[o.app_title,m],e[8]=o.app_title,e[9]=m,e[10]=N,e[11]=j):(N=e[10],j=e[11]),O.useEffect(N,j);const T=Oc(o.width);let A,M;e[12]!==o.width||e[13]!==a||e[14]!==T?(A=()=>{T==="columns"&&o.width!=="columns"&&a()},e[12]=o.width,e[13]=a,e[14]=T,e[15]=A):A=e[15],e[16]!==o.width||e[17]!==a||e[18]!==h||e[19]!==T?(M=[o.width,T,a,h],e[16]=o.width,e[17]=a,e[18]=h,e[19]=T,e[20]=M):M=e[20],O.useEffect(A,M);const P=function(){const fe=K.c(2),de=Ks();let ue;return fe[0]!==de?(ue=()=>de(uB(Nn())),fe[0]=de,fe[1]=ue):ue=fe[1],qe(ue)}(),R=fg(),L=hg();let B,U,D,k,$,I;e[21]!==P?(B=()=>{P()},e[21]=P,e[22]=B):B=e[22],Jt("global.runStale",B),Jt("global.interrupt",JO),e[23]!==L?(U=()=>{L()},e[23]=L,e[24]=U):U=e[24],Jt("global.hideCode",U),e[25]!==R?(D=()=>{R()},e[25]=R,e[26]=D):D=e[26],Jt("global.runAll",D),e[27]!==l?(k=()=>{l()},e[27]=l,e[28]=k):k=e[28],Jt("global.collapseAllSections",k),e[29]!==d?($=()=>{d()},e[29]=d,e[30]=$):$=e[30],Jt("global.expandAllSections",$),e[31]!==o||e[32]!==E||e[33]!==n||e[34]!==u.mode?(I=c.jsx(LO,{connStatus:E,mode:u.mode,userConfig:n,appConfig:o}),e[31]=o,e[32]=E,e[33]=n,e[34]=u.mode,e[35]=I):I=e[35];const W=I,G=o.width;let q,Y,ee,oe,ie,Z,Q,me;return e[36]===Symbol.for("react.memo_cache_sentinel")?(q=Ne("pt-4 sm:pt-12 pb-2 mb-4 print:hidden z-50","sticky left-0"),e[36]=q):q=e[36],e[37]!==m||e[38]!==g?(Y=g&&c.jsx("div",{className:"flex items-center justify-center container",children:c.jsx(wj,{filename:m})}),e[37]=m,e[38]=g,e[39]=Y):Y=e[39],e[40]!==E||e[41]!==Y?(ee=c.jsx(EW,{connection:E,className:q,children:Y}),e[40]=E,e[41]=Y,e[42]=ee):ee=e[42],e[43]!==o||e[44]!==W||e[45]!==f||e[46]!==u.mode?(oe=f&&c.jsx(jW,{appConfig:o,mode:u.mode,children:W}),e[43]=o,e[44]=W,e[45]=f,e[46]=u.mode,e[47]=oe):oe=e[47],e[48]===Symbol.for("react.memo_cache_sentinel")?(ie=c.jsx(Mj,{}),e[48]=ie):ie=e[48],e[49]!==o.width||e[50]!==E||e[51]!==b||e[52]!==ee||e[53]!==oe?(Z=c.jsxs(IW,{connection:E,isRunning:b,width:G,children:[ee,oe,ie]}),e[49]=o.width,e[50]=E,e[51]=b,e[52]=ee,e[53]=oe,e[54]=Z):Z=e[54],e[55]!==o||e[56]!==E||e[57]!==s||e[58]!==p||e[59]!==b||e[60]!==P||e[61]!==L?(Q=!s&&c.jsx(Kc,{children:c.jsx(gj,{presenting:p,onTogglePresenting:L,onInterrupt:Hm,onRun:P,connectionState:E.state,running:b,appConfig:o})}),e[55]=o,e[56]=E,e[57]=s,e[58]=p,e[59]=b,e[60]=P,e[61]=L,e[62]=Q):Q=e[62],e[63]!==Z||e[64]!==Q?(me=c.jsxs(c.Fragment,{children:[Z,Q]}),e[63]=Z,e[64]=Q,e[65]=me):me=e[65],me};function HO(){dC.INSTANCE.stop()}function WO(){return dC.INSTANCE.start(N$),HO}function qO(t){return t.name}function GO(t){return t.code}function YO(t){return t.config}function JO(){Hm()}const ew=t=>Le(j$)[t.capability]?t.children:null,Pn=O.forwardRef((t,e)=>{const n=K.c(18);let o,r,s,i,a;n[0]!==t?({children:o,tooltip:a,selected:i,className:r,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i,n[5]=a):(o=n[1],r=n[2],s=n[3],i=n[4],a=n[5]);const l=!i&&"hover:bg-[var(--sage-3)]",d=i&&"bg-[var(--sage-4)]";let u,h;n[6]!==r||n[7]!==l||n[8]!==d?(u=Ne("h-full flex items-center p-2 text-sm shadow-inset font-mono cursor-pointer rounded",l,d,r),n[6]=r,n[7]=l,n[8]=d,n[9]=u):u=n[9],n[10]!==o||n[11]!==e||n[12]!==s||n[13]!==u?(h=c.jsx("div",{ref:e,className:u,...s,children:o}),n[10]=o,n[11]=e,n[12]=s,n[13]=u,n[14]=h):h=n[14];const f=h;if(a){let m;return n[15]!==f||n[16]!==a?(m=c.jsx(Te,{content:a,side:"top",delayDuration:200,children:f}),n[15]=f,n[16]=a,n[17]=m):m=n[17],m}return f});Pn.displayName="FooterItem";const KO=()=>{var u;const t=K.c(14),e=Le(_S),n=Le(cc),o=((u=e==null?void 0:e.open_ai)==null?void 0:u.model)||"gpt-4-turbo",{handleClick:r}=wa();if(!n){let h,f,m;return t[0]!==r?(h=()=>r("ai"),t[0]=r,t[1]=h):h=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(f=c.jsx(ea,{className:"h-4 w-4 opacity-60"}),t[2]=f):f=t[2],t[3]!==h?(m=c.jsx(Pn,{tooltip:"Assist is disabled",selected:!1,onClick:h,"data-testid":"footer-ai-disabled",children:f}),t[3]=h,t[4]=m):m=t[4],m}let s,i,a,l,d;return t[5]===Symbol.for("react.memo_cache_sentinel")?(s=c.jsx("b",{children:"Assist model:"}),t[5]=s):s=t[5],t[6]!==o?(i=c.jsxs(c.Fragment,{children:[s," ",o]}),t[6]=o,t[7]=i):i=t[7],t[8]!==r?(a=()=>r("ai"),t[8]=r,t[9]=a):a=t[9],t[10]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(ea,{className:"h-4 w-4"}),t[10]=l):l=t[10],t[11]!==i||t[12]!==a?(d=c.jsx(Pn,{tooltip:i,onClick:a,selected:!1,"data-testid":"footer-ai-enabled",children:l}),t[11]=i,t[12]=a,t[13]=d):d=t[13],d},XO=()=>{const t=K.c(26),e=Le(hn).state,n=ep();let o,r;t[0]!==e||t[1]!==n?(o=async()=>{if(e===$t.OPEN){if(un())return{isHealthy:!0,lastChecked:new Date,error:void 0};try{return{isHealthy:await n.isHealthy(),lastChecked:new Date,error:void 0}}catch(v){const C=v;return{isHealthy:!1,lastChecked:new Date,error:C instanceof Error?C.message:"Unknown error"}}}},r=[n,e],t[0]=e,t[1]=n,t[2]=o,t[3]=r):(o=t[2],r=t[3]);const{isFetching:s,error:i,data:a,refetch:l}=Wn(o,r),d=e===$t.OPEN?3e4:null;let u,h;t[4]!==d?(u={delayMs:d,whenVisible:!0},t[4]=d,t[5]=u):u=t[5],ya(l,u),t[6]!==e||t[7]!==a||t[8]!==i?(h=()=>[Om(e.toLowerCase()),a!=null&&a.lastChecked?a.isHealthy?"\u2713 Healthy":"\u2717 Unhealthy":"Health: Unknown",i?`Error: ${i}`:""].filter(Boolean).join(`
128
+ hover/column:hover:bg-primary/60 dark:hover/column:hover:bg-primary/60`})}const IO=t=>{const e=K.c(10),{width:n}=t,{banners:o}=vW(),{removeBanner:r}=kW();if(o.length===0)return null;const s=n==="columns"&&"sticky left-12 w-full max-w-[80vw]";let i,a,l;if(e[0]!==s?(i=Ne("flex flex-col gap-4 mb-5 print:hidden",s),e[0]=s,e[1]=i):i=e[1],e[2]!==o||e[3]!==r){let d;e[5]!==r?(d=u=>c.jsxs(ba,{kind:u.variant||"info",className:"flex flex-col rounded p-3",children:[c.jsxs("div",{className:"flex justify-between",children:[c.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[c.jsx(pS,{className:"w-5 h-5 inline-block mr-2"}),u.title]}),c.jsx(Ae,{"data-testid":"remove-banner-button",variant:"text",size:"icon",onClick:()=>r(u.id),children:c.jsx(eo,{className:"w-5 h-5"})})]}),c.jsxs("div",{className:"flex justify-between items-end",children:[c.jsx("span",{children:sp({html:u.description})}),u.action==="restart"&&c.jsx(AO,{})]})]},u.id),e[5]=r,e[6]=d):d=e[6],a=o.map(d),e[2]=o,e[3]=r,e[4]=a}else a=e[4];return e[7]!==i||e[8]!==a?(l=c.jsx("div",{className:i,children:a}),e[7]=i,e[8]=a,e[9]=l):l=e[9],l},AO=()=>{const t=K.c(3),e=qg();let n,o;return t[0]===Symbol.for("react.memo_cache_sentinel")?(n=c.jsx(Zp,{className:"w-3 h-3 mr-2"}),t[0]=n):n=t[0],t[1]!==e?(o=c.jsxs(Ae,{"data-testid":"restart-session-button",variant:"link",size:"xs",onClick:e,children:[n,"Restart"]}),t[1]=e,t[2]=o):o=t[2],o},TO=zt(t=>{const e=t(cr);for(const n of e.cellIds.inOrderIds){const o=e.cellRuntime[n];if(o.status==="idle"&&o.consoleOutputs.some(r=>r.channel==="stdin"&&r.response===void 0))return!0}return!1}),MO=()=>{const t=K.c(3),e=OO;if(!Le(TO))return null;let n,o,r;if(t[0]===Symbol.for("react.memo_cache_sentinel")?(n=c.jsx("div",{className:"flex justify-between",children:c.jsx("span",{className:"font-bold text-lg flex items-center mb-1",children:"Program waiting for input"})}),t[0]=n):n=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(o=c.jsx(U4,{className:"inline",children:"stdin"}),t[1]=o):o=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")){const s=c.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-1/2 transform -translate-x-1/2 z-[200] opacity-95",children:c.jsxs(ba,{kind:"info",className:"flex flex-col rounded py-2 px-4 animate-in slide-in-from-top w-fit",children:[n,c.jsx("div",{className:"flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",children:c.jsx("div",{children:c.jsxs("p",{children:["The program is still running, but blocked on"," ",o,".",c.jsx(Ae,{variant:"link",className:"h-auto font-normal",onClick:e,children:"Jump to the cell"})]})})})]})});r=c.jsx(Gc,{milliseconds:2e3,children:s}),t[2]=r}else r=t[2];return r};function OO(){const t=document.querySelector("[data-stdin-blocking]");t?(t.scrollIntoView({behavior:"smooth",block:"center"}),requestAnimationFrame(()=>{t.focus()})):vt.error("No element with data-stdin-blocking found")}function DO(){const t=setTimeout(RO,100);return()=>clearTimeout(t)}function RO(){requestAnimationFrame(PO)}function PO(){const t=function(e){const n=e.match(/scrollTo=([^&]+)/),o=n==null?void 0:n[1];return o?decodeURIComponent(o.split("&")[0]):null}(window.location.hash);if(t)(function(e){var o,r;if(Zy)return;const n=document.querySelector(`[data-cell-name="${e}"]`);if(n){if(n.scrollIntoView({behavior:"smooth",block:"start"}),Zy=!0,n instanceof HTMLElement){n.focus();const{cellHandles:s}=Nn(),i=n.dataset.cellId;if(!i)return void vt.error(`Missing cellId for cell with name ${e}`);const a=(r=(o=s[i])==null?void 0:o.current)==null?void 0:r.editorView;a&&a.focus()}}else vt.warn(`Cannot focus cell with name ${e} because it was not found`),Xy()})(t);else try{Xy()}catch(e){const n=e;vt.warn("Error focusing first editor",n)}}function Xy(){var o,r;const{cellIds:t,cellData:e,cellHandles:n}=Nn();for(const s of t.iterateTopLevelIds){const i=n[s];if(!((o=e[s])==null?void 0:o.config.hide_code)&&((r=i==null?void 0:i.current)!=null&&r.editorView))return void i.current.editorView.focus()}}let Zy=!1;const LO=t=>{const e=K.c(8),n=Le(_$),o=t.appConfig.width==="columns";let r,s,i;return e[0]!==t?(r=c.jsx(FO,{...t}),e[0]=t,e[1]=r):r=e[1],e[2]!==n||e[3]!==r?(s=c.jsx(O1,{id:"column-container",items:n,strategy:gE,children:r}),e[2]=n,e[3]=r,e[4]=s):s=e[4],e[5]!==o||e[6]!==s?(i=c.jsx(xO,{multiColumn:o,children:s}),e[5]=o,e[6]=s,e[7]=i):i=e[7],i},FO=t=>{const e=K.c(52),{mode:n,userConfig:o,appConfig:r,connStatus:s}=t,i=Ac(),a=bt(),{theme:l}=xr(),{toggleSidebarPanel:d}=sa();gS(DO),Jt("global.focusTop",a.focusTopCell),Jt("global.focusBottom",a.focusBottomCell),Jt("global.toggleSidebar",d),Jt("global.foldCode",a.foldAll),Jt("global.unfoldCode",a.unfoldAll),Jt("global.formatAll",UO),Jt("cell.hideCode",Hn.NOOP),Jt("cell.format",Hn.NOOP);const u=vd(),h=a.scrollToTarget;let f,m,_,g,p,b,x,y,v,C,S,E,N,j,T,A;if(e[0]!==i.scrollKey||e[1]!==h?(f=()=>{i.scrollKey!==null&&h()},e[0]=i.scrollKey,e[1]=h,e[2]=f):f=e[2],e[3]!==i.cellIds||e[4]!==i.scrollKey||e[5]!==h?(m=[i.cellIds,i.scrollKey,h],e[3]=i.cellIds,e[4]=i.scrollKey,e[5]=h,e[6]=m):m=e[6],O.useEffect(f,m),e[7]!==a||e[8]!==r||e[9]!==s||e[10]!==n||e[11]!==i||e[12]!==u||e[13]!==l||e[14]!==o){const M=i.cellIds.getColumns();let P;e[26]!==i.cellIds?(P=i.cellIds.hasOnlyOneId(),e[26]=i.cellIds,e[27]=P):P=e[27];const R=P;let L;e[28]!==i.cellIds.inOrderIds?(L=i.cellIds.inOrderIds.includes($o),e[28]=i.cellIds.inOrderIds,e[29]=L):L=e[29];const B=L;_=SW,v="pb-[40vh]",C=!1,S=r,E="pr-4",e[30]===Symbol.for("react.memo_cache_sentinel")?(N=c.jsx(rO,{}),g=c.jsx(MO,{}),p=c.jsx(vO,{}),e[30]=g,e[31]=p,e[32]=N):(g=e[30],p=e[31],N=e[32]),e[33]!==r.width?(b=c.jsx(IO,{width:r.width}),e[33]=r.width,e[34]=b):b=e[34];const U=r.width==="columns"&&"grid grid-flow-col auto-cols-min gap-6";e[35]!==U?(x=Ne(U),e[35]=U,e[36]=x):x=e[36],y=M.map((D,k)=>c.jsx(zO,{column:D,index:k,columnsLength:M.length,appConfig:r,notebook:i,mode:n,userConfig:o,connStatus:s,actions:a,theme:l,hasOnlyOneCell:R,hasSetupCell:B,onDeleteCell:u},D.id)),e[7]=a,e[8]=r,e[9]=s,e[10]=n,e[11]=i,e[12]=u,e[13]=l,e[14]=o,e[15]=_,e[16]=g,e[17]=p,e[18]=b,e[19]=x,e[20]=y,e[21]=v,e[22]=C,e[23]=S,e[24]=E,e[25]=N}else _=e[15],g=e[16],p=e[17],b=e[18],x=e[19],y=e[20],v=e[21],C=e[22],S=e[23],E=e[24],N=e[25];return e[37]!==x||e[38]!==y?(j=c.jsx("div",{className:x,children:y}),e[37]=x,e[38]=y,e[39]=j):j=e[39],e[40]===Symbol.for("react.memo_cache_sentinel")?(T=c.jsx(CW,{}),e[40]=T):T=e[40],e[41]!==_||e[42]!==g||e[43]!==p||e[44]!==b||e[45]!==j||e[46]!==v||e[47]!==C||e[48]!==S||e[49]!==E||e[50]!==N?(A=c.jsxs(_,{className:v,invisible:C,appConfig:S,innerClassName:E,children:[N,g,p,b,j,T]}),e[41]=_,e[42]=g,e[43]=p,e[44]=b,e[45]=j,e[46]=v,e[47]=C,e[48]=S,e[49]=E,e[50]=N,e[51]=A):A=e[51],A},zO=t=>{const e=K.c(40),{column:n,index:o,columnsLength:r,appConfig:s,notebook:i,mode:a,userConfig:l,connStatus:d,actions:u,theme:h,hasOnlyOneCell:f,hasSetupCell:m,onDeleteCell:_}=t,g=d.state,p=n.id,b=o>0,x=o<r-1,y=s.width,v=r>1,C=n.id,S=s.width==="columns"&&"opacity-0 group-hover/column:opacity-100";let E,N;e[0]!==S?(E=Ne(S),e[0]=S,e[1]=E):E=e[1],e[2]!==n.id||e[3]!==E?(N=c.jsx(BO,{columnId:C,className:E}),e[2]=n.id,e[3]=E,e[4]=N):N=e[4];const j=`column-${o+1}`,T=n.topLevelIds;let A,M,P,R;return e[5]!==u||e[6]!==g||e[7]!==m||e[8]!==o||e[9]!==a||e[10]!==i||e[11]!==_||e[12]!==h||e[13]!==l?(A=o===0&&m&&c.jsx(Hy,{theme:h,showPlaceholder:!1,...i.cellData[$o],...i.cellRuntime[$o],...u,runElapsedTimeMs:i.cellRuntime[$o].runElapsedTimeMs??i.cellData[$o].lastExecutionTime,canDelete:!0,mode:a,connectionState:g,ref:i.cellHandles[$o],userConfig:l,isCollapsed:!1,collapseCount:0,canMoveX:!1,actions:u,deleteCell:_},$o),e[5]=u,e[6]=g,e[7]=m,e[8]=o,e[9]=a,e[10]=i,e[11]=_,e[12]=h,e[13]=l,e[14]=A):A=e[14],e[15]!==u||e[16]!==s.width||e[17]!==n||e[18]!==g||e[19]!==f||e[20]!==a||e[21]!==i||e[22]!==_||e[23]!==h||e[24]!==l?(M=n.topLevelIds.map(L=>{if(L===$o)return null;const B=i.cellData[L],U=i.cellRuntime[L];return c.jsx(Hy,{theme:h,showPlaceholder:f,...B,...U,runElapsedTimeMs:U.runElapsedTimeMs??B.lastExecutionTime,canDelete:!f,mode:a,connectionState:g,ref:i.cellHandles[L],userConfig:l,config:B.config,name:B.name,isCollapsed:n.isCollapsed(L),collapseCount:n.getCount(L),canMoveX:s.width==="columns",actions:u,deleteCell:_},B.id.toString())}),e[15]=u,e[16]=s.width,e[17]=n,e[18]=g,e[19]=f,e[20]=a,e[21]=i,e[22]=_,e[23]=h,e[24]=l,e[25]=M):M=e[25],e[26]!==n.topLevelIds||e[27]!==j||e[28]!==A||e[29]!==M?(P=c.jsxs(O1,{id:j,items:T,strategy:_E,children:[A,M]}),e[26]=n.topLevelIds,e[27]=j,e[28]=A,e[29]=M,e[30]=P):P=e[30],e[31]!==s.width||e[32]!==n.id||e[33]!==o||e[34]!==P||e[35]!==b||e[36]!==x||e[37]!==v||e[38]!==N?(R=c.jsx(Ky,{columnId:p,index:o,canMoveLeft:b,canMoveRight:x,width:y,canDelete:v,footer:N,children:P}),e[31]=s.width,e[32]=n.id,e[33]=o,e[34]=P,e[35]=b,e[36]=x,e[37]=v,e[38]=N,e[39]=R):R=e[39],R},BO=t=>{const e=K.c(17),{columnId:n,className:o}=t,{createNewCell:r}=bt(),[s,i]=b$(!1),a=Le(cc),l=Le(P4);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=Ne("mb-0 rounded-none sm:px-4 md:px-5 lg:px-8 tracking-wide no-wrap whitespace-nowrap","hover:bg-accent hover:text-accent-foreground font-semibold uppercase text-xs"),e[0]=d):d=e[0];const u=d;let h;e[1]!==a||e[2]!==n||e[3]!==r||e[4]!==s||e[5]!==i.toggle||e[6]!==l?(h=()=>s?c.jsx(x$,{onClose:i.toggle}):c.jsxs(c.Fragment,{children:[c.jsxs(Ae,{className:u,variant:"text",size:"sm",disabled:!l,onClick:()=>r({cellId:{type:"__end__",columnId:n},before:!1}),children:[c.jsx(tg,{className:"mr-2 size-4 flex-shrink-0"}),"Python"]}),c.jsxs(Ae,{className:u,variant:"text",size:"sm",disabled:!l,onClick:()=>{fo({autoInstantiate:!0,createNewCell:r}),r({cellId:{type:"__end__",columnId:n},before:!1,code:new ra().defaultCode,hideCode:!0})},children:[c.jsx(rg,{className:"mr-2 size-4 flex-shrink-0"}),"Markdown"]}),c.jsxs(Ae,{className:u,variant:"text",size:"sm",disabled:!l,onClick:()=>{fo({autoInstantiate:!0,createNewCell:r}),r({cellId:{type:"__end__",columnId:n},before:!1,code:new Vc().defaultCode})},children:[c.jsx(lr,{className:"mr-2 size-4 flex-shrink-0"}),"SQL"]}),c.jsx(Te,{content:a?null:c.jsx("span",{children:"Enable via settings under AI Assist"}),delayDuration:100,asChild:!1,children:c.jsxs(Ae,{className:u,variant:"text",size:"sm",disabled:!a||!l,onClick:i.toggle,children:[c.jsx(ea,{className:"mr-2 size-4 flex-shrink-0"}),"Generate with AI"]})})]}),e[1]=a,e[2]=n,e[3]=r,e[4]=s,e[5]=i.toggle,e[6]=l,e[7]=h):h=e[7];const f=h,m=!s&&"w-fit",_=s&&"opacity-100 w-full max-w-4xl shadow-lg shadow-[var(--blue-3)]";let g,p,b;return e[8]!==o||e[9]!==m||e[10]!==_?(g=Ne("shadow-sm border border-border rounded transition-all duration-200 overflow-hidden divide-x divide-border flex",m,_,o),e[8]=o,e[9]=m,e[10]=_,e[11]=g):g=e[11],e[12]!==f?(p=f(),e[12]=f,e[13]=p):p=e[13],e[14]!==g||e[15]!==p?(b=c.jsx("div",{className:"flex justify-center mt-4 pt-6 pb-32 group gap-4 w-full print:hidden",children:c.jsx("div",{className:g,children:p})}),e[14]=g,e[15]=p,e[16]=b):b=e[16],b};function UO(){D4()}const VO=y$(w$,400),$O=(t,e)=>{at.get(Os)||t.isEmpty()||e.isEmpty()||aa(t.inOrderIds,e.inOrderIds)||VO({cell_ids:t.inOrderIds})},Qy=t=>{const e=K.c(66),{userConfig:n,appConfig:o,hideControls:r}=t,s=r!==void 0&&r;v$(qc,$O);const{setCells:i,mergeAllColumns:a,collapseAllCells:l,expandAllCells:d}=bt(),u=Le(_m),h=Le(k$),f=Le(S$),m=Dm(),_=Ot(Td),g=u.mode==="edit",p=u.mode==="present",b=Le(C$);let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=[],e[0]=x):x=e[0],O.useEffect(WO,x);const y=n.runtime.auto_instantiate;let v,C,S;e[1]!==i||e[2]!==_?(v=(fe,de)=>{i(fe);const ue=fe.map(qO),ce=fe.map(GO),ke=fe.map(YO);_({names:ue,codes:ce,configs:ke,layout:de})},e[1]=i,e[2]=_,e[3]=v):v=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(C=Z4(),e[4]=C):C=e[4],e[5]!==v||e[6]!==n.runtime.auto_instantiate?(S={autoInstantiate:y,setCells:v,sessionId:C},e[5]=v,e[6]=n.runtime.auto_instantiate,e[7]=S):S=e[7];const{connection:E}=NW(S);let N,j;e[8]!==o.app_title||e[9]!==m?(N=()=>{document.title=o.app_title||jn.basename(m??"")||"Untitled Notebook"},j=[o.app_title,m],e[8]=o.app_title,e[9]=m,e[10]=N,e[11]=j):(N=e[10],j=e[11]),O.useEffect(N,j);const T=Oc(o.width);let A,M;e[12]!==o.width||e[13]!==a||e[14]!==T?(A=()=>{T==="columns"&&o.width!=="columns"&&a()},e[12]=o.width,e[13]=a,e[14]=T,e[15]=A):A=e[15],e[16]!==o.width||e[17]!==a||e[18]!==h||e[19]!==T?(M=[o.width,T,a,h],e[16]=o.width,e[17]=a,e[18]=h,e[19]=T,e[20]=M):M=e[20],O.useEffect(A,M);const P=function(){const fe=K.c(2),de=Ks();let ue;return fe[0]!==de?(ue=()=>de(uB(Nn())),fe[0]=de,fe[1]=ue):ue=fe[1],qe(ue)}(),R=fg(),L=hg();let B,U,D,k,$,I;e[21]!==P?(B=()=>{P()},e[21]=P,e[22]=B):B=e[22],Jt("global.runStale",B),Jt("global.interrupt",JO),e[23]!==L?(U=()=>{L()},e[23]=L,e[24]=U):U=e[24],Jt("global.hideCode",U),e[25]!==R?(D=()=>{R()},e[25]=R,e[26]=D):D=e[26],Jt("global.runAll",D),e[27]!==l?(k=()=>{l()},e[27]=l,e[28]=k):k=e[28],Jt("global.collapseAllSections",k),e[29]!==d?($=()=>{d()},e[29]=d,e[30]=$):$=e[30],Jt("global.expandAllSections",$),e[31]!==o||e[32]!==E||e[33]!==n||e[34]!==u.mode?(I=c.jsx(LO,{connStatus:E,mode:u.mode,userConfig:n,appConfig:o}),e[31]=o,e[32]=E,e[33]=n,e[34]=u.mode,e[35]=I):I=e[35];const W=I,G=o.width;let q,Y,ee,oe,ie,Z,Q,me;return e[36]===Symbol.for("react.memo_cache_sentinel")?(q=Ne("pt-4 sm:pt-12 pb-2 mb-4 print:hidden z-50","sticky left-0"),e[36]=q):q=e[36],e[37]!==m||e[38]!==g?(Y=g&&c.jsx("div",{className:"flex items-center justify-center container",children:c.jsx(wj,{filename:m})}),e[37]=m,e[38]=g,e[39]=Y):Y=e[39],e[40]!==E||e[41]!==Y?(ee=c.jsx(EW,{connection:E,className:q,children:Y}),e[40]=E,e[41]=Y,e[42]=ee):ee=e[42],e[43]!==o||e[44]!==W||e[45]!==f||e[46]!==u.mode?(oe=f&&c.jsx(jW,{appConfig:o,mode:u.mode,children:W}),e[43]=o,e[44]=W,e[45]=f,e[46]=u.mode,e[47]=oe):oe=e[47],e[48]!==o.width||e[49]!==E||e[50]!==b||e[51]!==ee||e[52]!==oe?(ie=c.jsxs(IW,{connection:E,isRunning:b,width:G,children:[ee,oe]}),e[48]=o.width,e[49]=E,e[50]=b,e[51]=ee,e[52]=oe,e[53]=ie):ie=e[53],e[54]===Symbol.for("react.memo_cache_sentinel")?(Z=c.jsx(Mj,{}),e[54]=Z):Z=e[54],e[55]!==o||e[56]!==E||e[57]!==s||e[58]!==p||e[59]!==b||e[60]!==P||e[61]!==L?(Q=!s&&c.jsx(Kc,{children:c.jsx(gj,{presenting:p,onTogglePresenting:L,onInterrupt:Hm,onRun:P,connectionState:E.state,running:b,appConfig:o})}),e[55]=o,e[56]=E,e[57]=s,e[58]=p,e[59]=b,e[60]=P,e[61]=L,e[62]=Q):Q=e[62],e[63]!==ie||e[64]!==Q?(me=c.jsxs(c.Fragment,{children:[ie,Z,Q]}),e[63]=ie,e[64]=Q,e[65]=me):me=e[65],me};function HO(){dC.INSTANCE.stop()}function WO(){return dC.INSTANCE.start(N$),HO}function qO(t){return t.name}function GO(t){return t.code}function YO(t){return t.config}function JO(){Hm()}const ew=t=>Le(j$)[t.capability]?t.children:null,Pn=O.forwardRef((t,e)=>{const n=K.c(18);let o,r,s,i,a;n[0]!==t?({children:o,tooltip:a,selected:i,className:r,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i,n[5]=a):(o=n[1],r=n[2],s=n[3],i=n[4],a=n[5]);const l=!i&&"hover:bg-[var(--sage-3)]",d=i&&"bg-[var(--sage-4)]";let u,h;n[6]!==r||n[7]!==l||n[8]!==d?(u=Ne("h-full flex items-center p-2 text-sm shadow-inset font-mono cursor-pointer rounded",l,d,r),n[6]=r,n[7]=l,n[8]=d,n[9]=u):u=n[9],n[10]!==o||n[11]!==e||n[12]!==s||n[13]!==u?(h=c.jsx("div",{ref:e,className:u,...s,children:o}),n[10]=o,n[11]=e,n[12]=s,n[13]=u,n[14]=h):h=n[14];const f=h;if(a){let m;return n[15]!==f||n[16]!==a?(m=c.jsx(Te,{content:a,side:"top",delayDuration:200,children:f}),n[15]=f,n[16]=a,n[17]=m):m=n[17],m}return f});Pn.displayName="FooterItem";const KO=()=>{var u;const t=K.c(14),e=Le(_S),n=Le(cc),o=((u=e==null?void 0:e.open_ai)==null?void 0:u.model)||"gpt-4-turbo",{handleClick:r}=wa();if(!n){let h,f,m;return t[0]!==r?(h=()=>r("ai"),t[0]=r,t[1]=h):h=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(f=c.jsx(ea,{className:"h-4 w-4 opacity-60"}),t[2]=f):f=t[2],t[3]!==h?(m=c.jsx(Pn,{tooltip:"Assist is disabled",selected:!1,onClick:h,"data-testid":"footer-ai-disabled",children:f}),t[3]=h,t[4]=m):m=t[4],m}let s,i,a,l,d;return t[5]===Symbol.for("react.memo_cache_sentinel")?(s=c.jsx("b",{children:"Assist model:"}),t[5]=s):s=t[5],t[6]!==o?(i=c.jsxs(c.Fragment,{children:[s," ",o]}),t[6]=o,t[7]=i):i=t[7],t[8]!==r?(a=()=>r("ai"),t[8]=r,t[9]=a):a=t[9],t[10]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(ea,{className:"h-4 w-4"}),t[10]=l):l=t[10],t[11]!==i||t[12]!==a?(d=c.jsx(Pn,{tooltip:i,onClick:a,selected:!1,"data-testid":"footer-ai-enabled",children:l}),t[11]=i,t[12]=a,t[13]=d):d=t[13],d},XO=()=>{const t=K.c(26),e=Le(hn).state,n=ep();let o,r;t[0]!==e||t[1]!==n?(o=async()=>{if(e===$t.OPEN){if(un())return{isHealthy:!0,lastChecked:new Date,error:void 0};try{return{isHealthy:await n.isHealthy(),lastChecked:new Date,error:void 0}}catch(v){const C=v;return{isHealthy:!1,lastChecked:new Date,error:C instanceof Error?C.message:"Unknown error"}}}},r=[n,e],t[0]=e,t[1]=n,t[2]=o,t[3]=r):(o=t[2],r=t[3]);const{isFetching:s,error:i,data:a,refetch:l}=Wn(o,r),d=e===$t.OPEN?3e4:null;let u,h;t[4]!==d?(u={delayMs:d,whenVisible:!0},t[4]=d,t[5]=u):u=t[5],ya(l,u),t[6]!==e||t[7]!==a||t[8]!==i?(h=()=>[Om(e.toLowerCase()),a!=null&&a.lastChecked?a.isHealthy?"\u2713 Healthy":"\u2717 Unhealthy":"Health: Unknown",i?`Error: ${i}`:""].filter(Boolean).join(`
129
129
  `),t[6]=e,t[7]=a,t[8]=i,t[9]=h):h=t[9];const f=h;let m;t[10]!==e||t[11]!==(a==null?void 0:a.isHealthy)||t[12]!==(a==null?void 0:a.lastChecked)||t[13]!==s?(m=()=>s||e===$t.CONNECTING?c.jsx(An,{size:"small"}):e===$t.CLOSING?c.jsx(An,{className:"text-destructive",size:"small"}):e===$t.OPEN?a!=null&&a.isHealthy?c.jsx(rd,{className:"w-4 h-4 text-[var(--green-9)]"}):a!=null&&a.lastChecked?c.jsx(pS,{className:"w-4 h-4 text-[var(--yellow-9)]"}):c.jsx(rd,{className:"w-4 h-4"}):c.jsx(va,{className:"w-4 h-4 text-red-500"}),t[10]=e,t[11]=a==null?void 0:a.isHealthy,t[12]=a==null?void 0:a.lastChecked,t[13]=s,t[14]=m):m=t[14];const _=m,g=f();let p,b,x,y;return t[15]!==e?(p=e===$t.OPEN&&c.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:"Click to refresh health status"}),t[15]=e,t[16]=p):p=t[16],t[17]!==g||t[18]!==p?(b=c.jsxs("div",{className:"text-sm whitespace-pre-line",children:[g,p]}),t[17]=g,t[18]=p,t[19]=b):b=t[19],t[20]!==_?(x=_(),t[20]=_,t[21]=x):x=t[21],t[22]!==l||t[23]!==b||t[24]!==x?(y=c.jsx(Pn,{tooltip:b,selected:!1,onClick:l,"data-testid":"footer-backend-status",children:x}),t[22]=l,t[23]=b,t[24]=x,t[25]=y):y=t[25],y},ZO=t=>{const e=K.c(3);let n,o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=c.jsx("path",{d:"M205.28 31.36c14.096 14.88 20.016 35.2 22.512 63.68c6.626 0 12.805 1.47 16.976 7.152l7.792 10.56A17.55 17.55 0 0 1 256 123.2v28.688c-.008 3.704-1.843 7.315-4.832 9.504C215.885 187.222 172.35 208 128 208c-49.066 0-98.19-28.273-123.168-46.608c-2.989-2.189-4.825-5.8-4.832-9.504V123.2c0-3.776 1.2-7.424 3.424-10.464l7.792-10.544c4.173-5.657 10.38-7.152 16.992-7.152c2.496-28.48 8.4-48.8 22.512-63.68C77.331 3.165 112.567.06 127.552 0H128c14.72 0 50.4 2.88 77.28 31.36m-77.264 47.376c-3.04 0-6.544.176-10.272.544c-1.312 4.896-3.248 9.312-6.08 12.128c-11.2 11.2-24.704 12.928-31.936 12.928c-6.802 0-13.927-1.42-19.744-5.088c-5.502 1.808-10.786 4.415-11.136 10.912c-.586 12.28-.637 24.55-.688 36.824c-.026 6.16-.05 12.322-.144 18.488c.024 3.579 2.182 6.903 5.44 8.384C79.936 185.92 104.976 192 128.016 192c23.008 0 48.048-6.08 74.512-18.144c3.258-1.48 5.415-4.805 5.44-8.384c.317-18.418.062-36.912-.816-55.312h.016c-.342-6.534-5.648-9.098-11.168-10.912c-5.82 3.652-12.927 5.088-19.728 5.088c-7.232 0-20.72-1.728-31.936-12.928c-2.832-2.816-4.768-7.232-6.08-12.128a106 106 0 0 0-10.24-.544m-26.941 43.93c5.748 0 10.408 4.66 10.408 10.409v19.183c0 5.749-4.66 10.409-10.408 10.409s-10.408-4.66-10.408-10.409v-19.183c0-5.748 4.66-10.408 10.408-10.408m53.333 0c5.749 0 10.409 4.66 10.409 10.409v19.183c0 5.749-4.66 10.409-10.409 10.409c-5.748 0-10.408-4.66-10.408-10.409v-19.183c0-5.748 4.66-10.408 10.408-10.408M81.44 28.32c-11.2 1.12-20.64 4.8-25.44 9.92c-10.4 11.36-8.16 40.16-2.24 46.24c4.32 4.32 12.48 7.2 21.28 7.2c6.72 0 19.52-1.44 30.08-12.16c4.64-4.48 7.52-15.68 7.2-27.04c-.32-9.12-2.88-16.64-6.72-19.84c-4.16-3.68-13.6-5.28-24.16-4.32m68.96 4.32c-3.84 3.2-6.4 10.72-6.72 19.84c-.32 11.36 2.56 22.56 7.2 27.04c10.56 10.72 23.36 12.16 30.08 12.16c8.8 0 16.96-2.88 21.28-7.2c5.92-6.08 8.16-34.88-2.24-46.24c-4.8-5.12-14.24-8.8-25.44-9.92c-10.56-.96-20 .64-24.16 4.32M128 56c-2.56 0-5.6.16-8.96.48c.32 1.76.48 3.68.64 5.76c0 1.44 0 2.88-.16 4.48c3.2-.32 5.92-.32 8.48-.32s5.28 0 8.48.32c-.16-1.6-.16-3.04-.16-4.48c.16-2.08.32-4 .64-5.76c-3.36-.32-6.4-.48-8.96-.48"}),e[0]=n):n=e[0],e[1]!==t?(o=c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.24em",height:"1em",viewBox:"0 0 256 208",fill:"currentColor",...t,children:n}),e[1]=t,e[2]=o):o=e[2],o},QO=zt(t=>t(E$).completion.copilot),e9=()=>{const t=K.c(1);if(Le(QO)==="github"){let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx(t9,{}),t[0]=e):e=t[0],e}return null},tw=vt.get("[copilot-status-bar]"),t9=()=>{const t=Le(QS),e=Le(cW)!==null,{handleClick:n}=wa(),o=()=>n("ai"),r=t?"Ready":"Not connected",s=Ot(QS),i=Ot(dW);return gS(()=>{const a=ZS();let l=!0;return(async()=>{try{if(await a.initializePromise.catch(u=>{throw tw.error("Failed to initialize",u),a.close(),u}),!l)return;const d=await a.signedIn();if(!l)return;s(d),i(d?"signedIn":"signedOut")}catch(d){if(!l)return;tw.warn("Connection failed",d),s(!1),i("connectionError"),nt({title:"GitHub Copilot Connection Error",description:"Failed to connect to GitHub Copilot. Check settings and try again.",variant:"danger",action:c.jsx(Ae,{variant:"link",onClick:o,children:"Settings"})})}})(),()=>{l=!1}}),c.jsx(Pn,{tooltip:c.jsxs(c.Fragment,{children:[c.jsx("b",{children:"GitHub Copilot:"})," ",r]}),selected:!1,onClick:o,"data-testid":"footer-copilot-status",children:c.jsx("span",{children:e?c.jsx(An,{className:"h-4 w-4"}):c.jsx(ZO,{className:Ne("h-4 w-4",!t&&"opacity-60")})})})},n9=t=>{const e=K.c(17),[n,o]=O.useState(0),r=Le(hn);let s,i,a,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=()=>o(i9),i={delayMs:1e4,whenVisible:!0},e[0]=s,e[1]=i):(s=e[0],i=e[1]),ya(s,i),e[2]!==r.state?(a=async()=>un()||r.state!==$t.OPEN?null:I$(),e[2]=r.state,e[3]=a):a=e[3],e[4]!==r.state||e[5]!==n?(l=[n,r.state],e[4]=r.state,e[5]=n,e[6]=l):l=e[6];const{data:d}=Wn(a,l);let u,h,f,m;return e[7]!==d?(u=(d==null?void 0:d.gpu)&&d.gpu.length>0&&c.jsx(s9,{gpus:d.gpu}),e[7]=d,e[8]=u):u=e[8],e[9]!==d?(h=d&&c.jsx(o9,{memory:d.memory,kernel:d.kernel,server:d.server}),e[9]=d,e[10]=h):h=e[10],e[11]!==d?(f=d&&c.jsx(r9,{cpu:d.cpu}),e[11]=d,e[12]=f):f=e[12],e[13]!==u||e[14]!==h||e[15]!==f?(m=c.jsxs("div",{className:"flex gap-2 items-center px-1",children:[u,h,f]}),e[13]=u,e[14]=h,e[15]=f,e[16]=m):m=e[16],m},o9=t=>{const e=K.c(25),{memory:n,kernel:o,server:r}=t,{percent:s,total:i,available:a}=n;let l;e[0]!==s?(l=Math.round(s),e[0]=s,e[1]=l):l=e[1];const d=l;let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx("b",{children:"computer memory:"}),e[2]=u):u=e[2];const h=i-a;let f,m,_,g,p,b,x,y,v;return e[3]!==h?(f=lh(h),e[3]=h,e[4]=f):f=e[4],e[5]!==i?(m=lh(i),e[5]=i,e[6]=m):m=e[6],e[7]!==d||e[8]!==f||e[9]!==m?(_=c.jsxs("span",{children:[u," ",f," / ",m," GB (",d,"%)"]}),e[7]=d,e[8]=f,e[9]=m,e[10]=_):_=e[10],e[11]!==r?(g=(r==null?void 0:r.memory)&&c.jsxs("span",{children:[c.jsx("b",{children:"marimo server:"})," ",Al(r.memory)]}),e[11]=r,e[12]=g):g=e[12],e[13]!==o?(p=(o==null?void 0:o.memory)&&c.jsxs("span",{children:[c.jsx("b",{children:"kernel:"})," ",Al(o.memory)]}),e[13]=o,e[14]=p):p=e[14],e[15]!==_||e[16]!==g||e[17]!==p?(b=c.jsxs("div",{className:"flex flex-col gap-1",children:[_,g,p]}),e[15]=_,e[16]=g,e[17]=p,e[18]=b):b=e[18],e[19]===Symbol.for("react.memo_cache_sentinel")?(x=c.jsx($p,{className:"w-4 h-4"}),e[19]=x):x=e[19],e[20]!==d?(y=c.jsxs("div",{className:"flex items-center gap-1","data-testid":"memory-usage-bar",children:[x,c.jsx(ah,{percent:d,colorClassName:"bg-primary"})]}),e[20]=d,e[21]=y):y=e[21],e[22]!==y||e[23]!==b?(v=c.jsx(Te,{delayDuration:200,content:b,children:y}),e[22]=y,e[23]=b,e[24]=v):v=e[24],v},r9=t=>{const e=K.c(11),{cpu:n}=t,{percent:o}=n;let r;e[0]!==o?(r=Math.round(o),e[0]=o,e[1]=r):r=e[1];const s=r;let i,a,l,d,u;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx("b",{children:"CPU:"}),e[2]=i):i=e[2],e[3]!==s?(a=c.jsxs("span",{children:[i," ",s,"%"]}),e[3]=s,e[4]=a):a=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(uW,{className:"w-4 h-4"}),e[5]=l):l=e[5],e[6]!==s?(d=c.jsxs("div",{className:"flex items-center gap-1","data-testid":"cpu-bar",children:[l,c.jsx(ah,{percent:s,colorClassName:"bg-primary"})]}),e[6]=s,e[7]=d):d=e[7],e[8]!==a||e[9]!==d?(u=c.jsx(Te,{delayDuration:200,content:a,children:d}),e[8]=a,e[9]=d,e[10]=u):u=e[10],u},s9=t=>{const e=K.c(12),{gpus:n}=t;let o;e[0]!==n?(o=Math.round(n.reduce(a9,0)/n.length),e[0]=n,e[1]=o):o=e[1];const r=o;let s,i,a,l,d;return e[2]!==n?(s=n.map(l9),e[2]=n,e[3]=s):s=e[3],e[4]!==s?(i=c.jsx("div",{className:"flex flex-col gap-1",children:s}),e[4]=s,e[5]=i):i=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx(Wp,{className:"w-4 h-4"}),e[6]=a):a=e[6],e[7]!==r?(l=c.jsxs("div",{className:"flex items-center gap-1","data-testid":"gpu-bar",children:[a,c.jsx(ah,{percent:r,colorClassName:"bg-[var(--grass-9)]"})]}),e[7]=r,e[8]=l):l=e[8],e[9]!==i||e[10]!==l?(d=c.jsx(Te,{delayDuration:200,content:i,children:l}),e[9]=i,e[10]=l,e[11]=d):d=e[11],d},ah=t=>{const e=K.c(7),{percent:n,colorClassName:o}=t;let r;e[0]!==o?(r=Ne("h-full bg-primary",o),e[0]=o,e[1]=r):r=e[1];const s=`${n}%`;let i,a;return e[2]!==s?(i={width:s},e[2]=s,e[3]=i):i=e[3],e[4]!==r||e[5]!==i?(a=c.jsx("div",{className:"h-3 w-20 bg-[var(--slate-4)] rounded-lg overflow-hidden border",children:c.jsx("div",{className:r,style:i})}),e[4]=r,e[5]=i,e[6]=a):a=e[6],a};function Al(t){return t>1073741824?`${lh(t)} GB`:`${function(e){return new Intl.NumberFormat("en-US",{maximumFractionDigits:0}).format(e/1048576)}(t)} MB`}function lh(t){return new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(t/1073741824)}function i9(t){return t+1}function a9(t,e){return t+e.memory.percent}function l9(t){return c.jsxs("span",{children:[c.jsxs("b",{children:["GPU ",t.index," (",t.name,"):"]})," ",Al(t.memory.used)," / ",Al(t.memory.total)," GB (",Math.round(t.memory.percent),"%)"]},t.index)}const c9=()=>{const t=K.c(13),e=Le(is),[n,o]=Qt(Q4),[r,s]=O.useState(!1);if(!$c()||e==="disabled")return null;const i=e?"Real-time collaboration active":"Connecting to real-time collaboration";let a,l,d,u,h,f;return t[0]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx(cg,{className:"w-4 h-4"}),t[0]=a):a=t[0],t[1]!==i?(l=c.jsx(Hs,{asChild:!0,children:c.jsx(Pn,{tooltip:i,selected:!1,"data-testid":"footer-rtc-status",children:a})}),t[1]=i,t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsxs("div",{className:"space-y-2",children:[c.jsx("h4",{className:"font-medium leading-none",children:"Username"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Set your username for real-time collaboration"})]}),t[3]=d):d=t[3],t[4]!==o?(u=m=>o(m.target.value),t[4]=o,t[5]=u):u=t[5],t[6]!==u||t[7]!==n?(h=c.jsx(Fs,{className:"w-80",children:c.jsxs("div",{className:"space-y-4",children:[d,c.jsx(ir,{value:n,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",onChange:u,placeholder:"Enter your username"})]})}),t[6]=u,t[7]=n,t[8]=h):h=t[8],t[9]!==r||t[10]!==l||t[11]!==h?(f=c.jsxs(Ur,{open:r,onOpenChange:s,children:[l,h]}),t[9]=r,t[10]=l,t[11]=h,t[12]=f):f=t[12],f},d9=t=>{const e=K.c(101),{className:n}=t,[o,r]=A$(),s=zr()[0],[i,a]=O.useState(!1);let l,d,u;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{const Oe=window.matchMedia("(min-width: 768px)"),He=()=>{Oe.matches&&a(!1)};return Oe.addEventListener("change",He),()=>Oe.removeEventListener("change",He)},d=[],e[0]=l,e[1]=d):(l=e[0],d=e[1]),O.useEffect(l,d),e[2]!==s||e[3]!==r?(u=async Oe=>{const He={...s,runtime:{...s.runtime,auto_instantiate:Oe}};await Br({config:He}).then(()=>r(He))},e[2]=s,e[3]=r,e[4]=u):u=e[4];const h=u;let f;e[5]!==r||e[6]!==o?(f=async Oe=>{const He={...o,runtime:{...o.runtime,on_cell_change:Oe?"autorun":"lazy"}};await Br({config:He}).then(()=>r(He))},e[5]=r,e[6]=o,e[7]=f):f=e[7];const m=f;let _;e[8]!==r||e[9]!==o?(_=async Oe=>{const He={...o,runtime:{...o.runtime,auto_reload:Oe}};await Br({config:He}).then(()=>r(He))},e[8]=r,e[9]=o,e[10]=_):_=e[10];const g=_;let p;e[11]!==s.runtime.auto_instantiate||e[12]!==s.runtime.auto_reload||e[13]!==s.runtime.on_cell_change?(p=!s.runtime.auto_instantiate&&s.runtime.on_cell_change==="lazy"&&(un()||s.runtime.auto_reload!=="autorun"),e[11]=s.runtime.auto_instantiate,e[12]=s.runtime.auto_reload,e[13]=s.runtime.on_cell_change,e[14]=p):p=e[14];const b=p;let x;e[15]!==n?(x=Ne("flex items-center",n),e[15]=n,e[16]=x):x=e[16];const y=s.runtime.auto_instantiate?"Disable autorun on startup":"Enable autorun on startup";let v,C,S;e[17]!==s.runtime.auto_instantiate||e[18]!==h?(v=()=>h(!s.runtime.auto_instantiate),e[17]=s.runtime.auto_instantiate,e[18]=h,e[19]=v):v=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(C=c.jsx("span",{children:"on startup: "}),e[20]=C):C=e[20],e[21]!==s.runtime.auto_instantiate?(S=s.runtime.auto_instantiate?c.jsx(vn,{size:14}):c.jsx(wn,{size:14}),e[21]=s.runtime.auto_instantiate,e[22]=S):S=e[22];const E=s.runtime.auto_instantiate?"autorun":"lazy";let N,j,T,A;e[23]!==E?(N=c.jsx("span",{children:E}),e[23]=E,e[24]=N):N=e[24],e[25]!==S||e[26]!==N?(j=c.jsxs("div",{className:"font-prose text-sm flex items-center gap-1 whitespace-nowrap",children:[C,S,N]}),e[25]=S,e[26]=N,e[27]=j):j=e[27],e[28]!==j||e[29]!==y||e[30]!==v?(T=c.jsx(Pn,{tooltip:y,selected:!1,onClick:v,"data-testid":"footer-autorun-startup",children:j}),e[28]=j,e[29]=y,e[30]=v,e[31]=T):T=e[31],e[32]===Symbol.for("react.memo_cache_sentinel")?(A=c.jsx("div",{className:"border-r border-border h-6 mx-1"}),e[32]=A):A=e[32];const M=s.runtime.on_cell_change==="autorun"?"Disable autorun":"Enable autorun";let P,R,L,B,U,D,k,$,I,W,G,q,Y;e[33]!==s.runtime.on_cell_change||e[34]!==m?(P=()=>m(s.runtime.on_cell_change!=="autorun"),e[33]=s.runtime.on_cell_change,e[34]=m,e[35]=P):P=e[35],e[36]===Symbol.for("react.memo_cache_sentinel")?(R=c.jsx("span",{children:"on cell change: "}),e[36]=R):R=e[36],e[37]!==s.runtime.on_cell_change?(L=c.jsxs("div",{className:"font-prose text-sm flex items-center gap-1 whitespace-nowrap",children:[R,s.runtime.on_cell_change==="autorun"?c.jsx(vn,{size:14}):c.jsx(wn,{size:14}),c.jsx("span",{children:s.runtime.on_cell_change})]}),e[37]=s.runtime.on_cell_change,e[38]=L):L=e[38],e[39]!==M||e[40]!==P||e[41]!==L?(B=c.jsx(Pn,{tooltip:M,selected:!1,onClick:P,"data-testid":"footer-autorun-cell-change",children:L}),e[39]=M,e[40]=P,e[41]=L,e[42]=B):B=e[42],e[43]!==s.runtime.auto_reload||e[44]!==g?(U=!un()&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"border-r border-border h-6 mx-1"}),c.jsx(Pn,{tooltip:null,selected:!1,"data-testid":"footer-module-reload",children:c.jsxs(hr,{children:[c.jsxs(fr,{className:"font-prose text-sm flex items-center gap-1 whitespace-nowrap",children:[c.jsx("span",{children:"on module change: "}),s.runtime.auto_reload==="off"&&c.jsx(va,{size:14}),s.runtime.auto_reload==="lazy"&&c.jsx(wn,{size:14}),s.runtime.auto_reload==="autorun"&&c.jsx(vn,{size:14}),c.jsx("span",{children:s.runtime.auto_reload}),c.jsx(dr,{size:14})]}),c.jsx(mr,{children:["off","lazy","autorun"].map(Oe=>c.jsxs(Vt,{onClick:()=>g(Oe),children:[Oe==="off"&&c.jsx(va,{size:14,className:"mr-2 text-muted-foreground"}),Oe==="lazy"&&c.jsx(wn,{size:14,className:"mr-2 text-muted-foreground"}),Oe==="autorun"&&c.jsx(vn,{size:14,className:"mr-2 text-muted-foreground"}),Oe]},Oe))})]})})]}),e[43]=s.runtime.auto_reload,e[44]=g,e[45]=U):U=e[45],e[46]!==T||e[47]!==B||e[48]!==U?(D=c.jsxs("div",{className:"hidden md:flex md:items-center",children:[T,A,B,U]}),e[46]=T,e[47]=B,e[48]=U,e[49]=D):D=e[49],e[50]!==b?(k=b?c.jsx(wn,{size:16,className:"text-muted-foreground"}):c.jsx(vn,{size:16,className:"text-amber-500"}),e[50]=b,e[51]=k):k=e[51],e[52]===Symbol.for("react.memo_cache_sentinel")?($=c.jsx(dr,{size:14}),e[52]=$):$=e[52],e[53]!==k?(I=c.jsx(fr,{asChild:!0,children:c.jsx(Pn,{tooltip:"Runtime reactivity",selected:!1,"data-testid":"footer-runtime-settings",children:c.jsxs("div",{className:"flex items-center gap-1",children:[k,$]})})}),e[53]=k,e[54]=I):I=e[54],e[55]===Symbol.for("react.memo_cache_sentinel")?(W=c.jsx(p4,{children:"Runtime reactivity"}),G=c.jsx(bn,{}),e[55]=W,e[56]=G):(W=e[55],G=e[56]),e[57]!==s.runtime.auto_instantiate?(q=s.runtime.auto_instantiate?c.jsx(vn,{size:14,className:"text-amber-500"}):c.jsx(wn,{size:14,className:"text-muted-foreground"}),e[57]=s.runtime.auto_instantiate,e[58]=q):q=e[58],e[59]===Symbol.for("react.memo_cache_sentinel")?(Y=c.jsx("div",{className:"text-sm font-medium",children:"On startup"}),e[59]=Y):Y=e[59];const ee=s.runtime.auto_instantiate?"autorun":"lazy";let oe,ie,Z,Q,me,fe,de,ue,ce;e[60]!==ee?(oe=c.jsxs("div",{children:[Y,c.jsx("div",{className:"text-xs text-muted-foreground",children:ee})]}),e[60]=ee,e[61]=oe):oe=e[61],e[62]!==q||e[63]!==oe?(ie=c.jsxs("div",{className:"flex items-center space-x-2",children:[q,oe]}),e[62]=q,e[63]=oe,e[64]=ie):ie=e[64],e[65]!==s.runtime.auto_instantiate||e[66]!==h?(Z=c.jsx(km,{checked:s.runtime.auto_instantiate,onCheckedChange:h,size:"sm"}),e[65]=s.runtime.auto_instantiate,e[66]=h,e[67]=Z):Z=e[67],e[68]!==ie||e[69]!==Z?(Q=c.jsxs("div",{className:"flex items-center justify-between px-2 py-2",children:[ie,Z]}),e[68]=ie,e[69]=Z,e[70]=Q):Q=e[70],e[71]===Symbol.for("react.memo_cache_sentinel")?(me=c.jsx(bn,{}),e[71]=me):me=e[71],e[72]!==s.runtime.on_cell_change?(fe=s.runtime.on_cell_change==="autorun"?c.jsx(vn,{size:14,className:"text-amber-500"}):c.jsx(wn,{size:14,className:"text-muted-foreground"}),e[72]=s.runtime.on_cell_change,e[73]=fe):fe=e[73],e[74]===Symbol.for("react.memo_cache_sentinel")?(de=c.jsx("div",{className:"text-sm font-medium",children:"On cell change"}),e[74]=de):de=e[74],e[75]!==s.runtime.on_cell_change?(ue=c.jsxs("div",{children:[de,c.jsx("div",{className:"text-xs text-muted-foreground",children:s.runtime.on_cell_change})]}),e[75]=s.runtime.on_cell_change,e[76]=ue):ue=e[76],e[77]!==fe||e[78]!==ue?(ce=c.jsxs("div",{className:"flex items-center space-x-2",children:[fe,ue]}),e[77]=fe,e[78]=ue,e[79]=ce):ce=e[79];const ke=s.runtime.on_cell_change==="autorun";let Se,ae,Ce,_e,Ee,ze;return e[80]!==m||e[81]!==ke?(Se=c.jsx(km,{checked:ke,onCheckedChange:m,size:"sm"}),e[80]=m,e[81]=ke,e[82]=Se):Se=e[82],e[83]!==ce||e[84]!==Se?(ae=c.jsxs("div",{className:"flex items-center justify-between px-2 py-2",children:[ce,Se]}),e[83]=ce,e[84]=Se,e[85]=ae):ae=e[85],e[86]!==s.runtime.auto_reload||e[87]!==g?(Ce=!un()&&c.jsxs(c.Fragment,{children:[c.jsx(bn,{}),c.jsxs("div",{className:"px-2 py-1",children:[c.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[s.runtime.auto_reload==="off"&&c.jsx(va,{size:14,className:"text-muted-foreground"}),s.runtime.auto_reload==="lazy"&&c.jsx(wn,{size:14,className:"text-muted-foreground"}),s.runtime.auto_reload==="autorun"&&c.jsx(vn,{size:14,className:"text-amber-500"}),c.jsxs("div",{children:[c.jsx("div",{className:"text-sm font-medium",children:"On module change"}),c.jsx("div",{className:"text-xs text-muted-foreground",children:s.runtime.auto_reload})]})]}),c.jsx("div",{className:"space-y-1",children:["off","lazy","autorun"].map(Oe=>c.jsxs("button",{onClick:()=>g(Oe),className:Ne("w-full flex items-center px-2 py-1 text-sm rounded hover:bg-accent",Oe===s.runtime.auto_reload&&"bg-accent"),children:[Oe==="off"&&c.jsx(va,{size:12,className:"mr-2"}),Oe==="lazy"&&c.jsx(wn,{size:12,className:"mr-2"}),Oe==="autorun"&&c.jsx(vn,{size:12,className:"mr-2"}),c.jsx("span",{className:"capitalize",children:Oe}),Oe===s.runtime.auto_reload&&c.jsx("span",{className:"ml-auto",children:"\u2713"})]},Oe))})]})]}),e[86]=s.runtime.auto_reload,e[87]=g,e[88]=Ce):Ce=e[88],e[89]!==Q||e[90]!==ae||e[91]!==Ce?(_e=c.jsxs(mr,{align:"start",className:"w-64",children:[W,G,Q,me,ae,Ce]}),e[89]=Q,e[90]=ae,e[91]=Ce,e[92]=_e):_e=e[92],e[93]!==i||e[94]!==I||e[95]!==_e?(Ee=c.jsx("div",{className:"flex md:hidden",children:c.jsxs(hr,{open:i,onOpenChange:a,children:[I,_e]})}),e[93]=i,e[94]=I,e[95]=_e,e[96]=Ee):Ee=e[96],e[97]!==D||e[98]!==Ee||e[99]!==x?(ze=c.jsxs("div",{className:x,children:[D,Ee]}),e[97]=D,e[98]=Ee,e[99]=x,e[100]=ze):ze=e[100],ze},u9=()=>{const t=K.c(24),{selectedPanel:e,isTerminalOpen:n}=Sc(),{toggleApplication:o,toggleTerminal:r}=sa(),s=Le(T$),i=h9,a=yd.find(f9);let l;zo(a,"Error panel not found"),t[0]!==r?(l=()=>{r()},t[0]=r,t[1]=l):l=t[1],Jt("global.toggleTerminal",l);const d=Pn,u=a.tooltip,h=e===a.type,f=()=>o(a.type),m=i(a,s>0?"text-destructive":"");let _,g,p,b,x,y,v,C,S,E;return t[2]!==s?(_=c.jsx("span",{className:"ml-1 font-mono mt-[0.125rem]",children:s}),t[2]=s,t[3]=_):_=t[3],t[4]!==d||t[5]!==a||t[6]!==h||t[7]!==f||t[8]!==m||t[9]!==_?(g=c.jsxs(d,{tooltip:u,selected:h,onClick:f,"data-testid":"footer-errors",children:[m,_]}),t[4]=d,t[5]=a,t[6]=h,t[7]=f,t[8]=m,t[9]=_,t[10]=g):g=t[10],t[11]!==r?(p=()=>r(),t[11]=r,t[12]=p):p=t[12],t[13]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(ag,{className:"h-5 w-5"}),t[13]=b):b=t[13],t[14]!==n||t[15]!==p?(x=c.jsx(ew,{capability:"terminal",children:c.jsx(Pn,{tooltip:"Open terminal",selected:n,onClick:p,"data-testid":"footer-terminal",children:b})}),t[14]=n,t[15]=p,t[16]=x):x=t[16],t[17]===Symbol.for("react.memo_cache_sentinel")?(y=c.jsx(d9,{}),v=c.jsx("div",{className:"mx-auto"}),t[17]=y,t[18]=v):(y=t[17],v=t[18]),t[19]===Symbol.for("react.memo_cache_sentinel")?(C=c.jsx(fj,{children:c.jsx(Te,{content:c.jsx("div",{className:"w-[200px]",children:"Kiosk mode is enabled. This allows you to view the outputs of the cells without the ability to edit them."}),children:c.jsx("span",{className:"text-muted-foreground text-sm mr-4",children:"kiosk mode"})})}),t[19]=C):C=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(S=c.jsxs("div",{className:"flex items-center flex-shrink-0 min-w-0",children:[c.jsx(n9,{}),c.jsx(KO,{}),c.jsx(e9,{}),c.jsx(c9,{}),c.jsx(XO,{})]}),t[20]=S):S=t[20],t[21]!==x||t[22]!==g?(E=c.jsxs("footer",{className:"h-10 py-2 bg-background flex items-center text-muted-foreground text-md px-1 border-t border-border select-none no-print text-sm shadow-[0_0_4px_1px_rgba(0,0,0,0.1)] z-50 print:hidden hide-on-fullscreen overflow-x-auto overflow-y-hidden scrollbar-thin",children:[g,x,y,v,C,S]}),t[21]=x,t[22]=g,t[23]=E):E=t[23],E};function h9(t,e){const{Icon:n}=t;return c.jsx(n,{className:Ne("h-5 w-5",e)})}function f9(t){return t.type==="errors"}const m9=t=>{const e=K.c(6),{children:n}=t,{openModal:o,closeModal:r}=$n();let s,i;return e[0]!==r||e[1]!==o?(s=()=>o(c.jsx(p9,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(i=c.jsx(bS,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=i):i=e[5],i},p9=t=>{const e=K.c(9),{onClose:n}=t;let o,r,s,i,a,l,d;return e[0]!==n?(o=async u=>{u.preventDefault();const h=new FormData(u.target),f=h.get("rating"),m=h.get("message");fetch("https://marimo.io/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({rating:f,message:m})}),n(),nt({title:"Feedback sent!",description:"Thank you for your feedback!"})},e[0]=n,e[1]=o):o=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(sr,{children:"Send Feedback"}),e[2]=r):r=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(s=c.jsx("p",{className:"my-2 prose dark:prose-invert",children:"We want to hear from you \u2014 from minor bug reports to wishlist features and everything in between. Here are some ways you can get in touch:"}),e[3]=s):s=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsxs("li",{className:"my-0",children:["Take our"," ",c.jsx("a",{href:Zn.feedbackForm,target:"_blank",className:"underline",children:"two-minute survey."})]}),e[4]=i):i=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsxs("li",{className:"my-0",children:["File a"," ",c.jsx("a",{href:Zn.issuesPage,target:"_blank",className:"underline",children:"GitHub issue."})]}),e[5]=a):a=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsxs(Ts,{children:[r,c.jsxs(Ms,{children:[s,c.jsxs("ul",{className:"list-disc ml-8 my-2 prose dark:prose-invert",children:[i,a,c.jsxs("li",{className:"my-0",children:["Chat with us on"," ",c.jsx("a",{href:Zn.discordLink,target:"_blank",className:"underline",children:"Discord."})]})]}),c.jsx("p",{className:"my-2 prose dark:prose-invert",children:"We're excited you're here as we build the future of Python data tooling. Thanks for being part of our community!"})]})]}),e[6]=l):l=e[6],e[7]!==o?(d=c.jsx(ar,{className:"w-fit",children:c.jsx("form",{onSubmit:o,children:l})}),e[7]=o,e[8]=d):d=e[8],d},g9=()=>{const t=K.c(10),{selectedPanel:e}=Sc(),{toggleApplication:n}=sa(),o=b9;let r,s,i,a,l,d;return t[0]!==e||t[1]!==n?(r="h-full pt-4 pb-1 px-1 flex flex-col items-start text-muted-foreground text-md select-none no-print text-sm z-50 dark:bg-background print:hidden hide-on-fullscreen",s=yd.filter(x9).map(u=>c.jsx(nw,{tooltip:u.tooltip,selected:e===u.type,onClick:()=>n(u.type),children:o(u)},u.type)),t[0]=e,t[1]=n,t[2]=r,t[3]=s):(r=t[2],s=t[3]),t[4]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(m9,{children:c.jsx(nw,{tooltip:"Send feedback!",selected:!1,children:c.jsx(Hp,{className:"h-5 w-5"})})}),a=c.jsx("div",{className:"flex-1"}),l=c.jsx(_9,{}),t[4]=i,t[5]=a,t[6]=l):(i=t[4],a=t[5],l=t[6]),t[7]!==r||t[8]!==s?(d=c.jsxs("div",{className:r,children:[s,i,a,l]}),t[7]=r,t[8]=s,t[9]=d):d=t[9],d},_9=()=>{const t=K.c(7),e=Le(M$);let n,o,r;return t[0]!==e?(n=e>0?c.jsxs("span",{children:[e," cell",e>1?"s":""," queued or running"]}):"No cells queued or running",t[0]=e,t[1]=n):n=t[1],t[2]!==e?(o=c.jsx("div",{className:"flex flex-col-reverse gap-[1px] overflow-hidden",children:Array.from({length:e}).map(y9)}),t[2]=e,t[3]=o):o=t[3],t[4]!==n||t[5]!==o?(r=c.jsx(Te,{content:n,side:"right",delayDuration:200,children:o}),t[4]=n,t[5]=o,t[6]=r):r=t[6],r},nw=t=>{const e=K.c(17);let n,o,r,s,i;e[0]!==t?({children:n,tooltip:i,selected:s,className:o,...r}=t,e[0]=t,e[1]=n,e[2]=o,e[3]=r,e[4]=s,e[5]=i):(n=e[1],o=e[2],r=e[3],s=e[4],i=e[5]);const a=!s&&"hover:bg-[var(--sage-3)]",l=s&&"bg-[var(--sage-4)]";let d,u,h;return e[6]!==o||e[7]!==a||e[8]!==l?(d=Ne("flex items-center p-2 text-sm mx-[1px] shadow-inset font-mono cursor-pointer rounded",a,l,o),e[6]=o,e[7]=a,e[8]=l,e[9]=d):d=e[9],e[10]!==n||e[11]!==r||e[12]!==d?(u=c.jsx("div",{className:d,...r,children:n}),e[10]=n,e[11]=r,e[12]=d,e[13]=u):u=e[13],e[14]!==u||e[15]!==i?(h=c.jsx(Te,{content:i,side:"right",delayDuration:200,children:u}),e[14]=u,e[15]=i,e[16]=h):h=e[16],h};function b9(t,e){const{Icon:n}=t;return c.jsx(n,{className:Ne("h-5 w-5",e)})}function x9(t){return!t.hidden&&t.position==="sidebar"}function y9(t,e){return c.jsx("div",{className:"flex-shrink-0 h-1 w-2 bg-[var(--grass-6)] border border-[var(--grass-7)]"},e.toString())}var ch="ScrollArea",[ow,$W]=q4(ch),[w9,Ln]=ow(ch),rw=O.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:o="hover",dir:r,scrollHideDelay:s=600,...i}=t,[a,l]=O.useState(null),[d,u]=O.useState(null),[h,f]=O.useState(null),[m,_]=O.useState(null),[g,p]=O.useState(null),[b,x]=O.useState(0),[y,v]=O.useState(0),[C,S]=O.useState(!1),[E,N]=O.useState(!1),j=qs(e,A=>l(A)),T=O$(r);return c.jsx(w9,{scope:n,type:o,dir:T,scrollHideDelay:s,scrollArea:a,viewport:d,onViewportChange:u,content:h,onContentChange:f,scrollbarX:m,onScrollbarXChange:_,scrollbarXEnabled:C,onScrollbarXEnabledChange:S,scrollbarY:g,onScrollbarYChange:p,scrollbarYEnabled:E,onScrollbarYEnabledChange:N,onCornerWidthChange:x,onCornerHeightChange:v,children:c.jsx($s.div,{dir:T,...i,ref:j,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":y+"px",...t.style}})})});rw.displayName=ch;var sw="ScrollAreaViewport",iw=O.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:o,nonce:r,...s}=t,i=Ln(sw,n),a=O.useRef(null),l=qs(e,a,i.onViewportChange);return c.jsxs(c.Fragment,{children:[c.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),c.jsx($s.div,{"data-radix-scroll-area-viewport":"",...s,ref:l,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...t.style},children:c.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:o})})]})});iw.displayName=sw;var io="ScrollAreaScrollbar",dh=O.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=Ln(io,t.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=r,a=t.orientation==="horizontal";return O.useEffect(()=>(a?s(!0):i(!0),()=>{a?s(!1):i(!1)}),[a,s,i]),r.type==="hover"?c.jsx(v9,{...o,ref:e,forceMount:n}):r.type==="scroll"?c.jsx(k9,{...o,ref:e,forceMount:n}):r.type==="auto"?c.jsx(aw,{...o,ref:e,forceMount:n}):r.type==="always"?c.jsx(uh,{...o,ref:e}):null});dh.displayName=io;var v9=O.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=Ln(io,t.__scopeScrollArea),[s,i]=O.useState(!1);return O.useEffect(()=>{const a=r.scrollArea;let l=0;if(a){const d=()=>{window.clearTimeout(l),i(!0)},u=()=>{l=window.setTimeout(()=>i(!1),r.scrollHideDelay)};return a.addEventListener("pointerenter",d),a.addEventListener("pointerleave",u),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",d),a.removeEventListener("pointerleave",u)}}},[r.scrollArea,r.scrollHideDelay]),c.jsx(Xc,{present:n||s,children:c.jsx(aw,{"data-state":s?"visible":"hidden",...o,ref:e})})}),k9=O.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=Ln(io,t.__scopeScrollArea),s=t.orientation==="horizontal",i=Dl(()=>l("SCROLL_END"),100),[a,l]=function(d,u){return O.useReducer((h,f)=>u[h][f]??h,d)}("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return O.useEffect(()=>{if(a==="idle"){const d=window.setTimeout(()=>l("HIDE"),r.scrollHideDelay);return()=>window.clearTimeout(d)}},[a,r.scrollHideDelay,l]),O.useEffect(()=>{const d=r.viewport,u=s?"scrollLeft":"scrollTop";if(d){let h=d[u];const f=()=>{const m=d[u];h!==m&&(l("SCROLL"),i()),h=m};return d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}},[r.viewport,s,l,i]),c.jsx(Xc,{present:n||a!=="hidden",children:c.jsx(uh,{"data-state":a==="hidden"?"hidden":"visible",...o,ref:e,onPointerEnter:Gn(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:Gn(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),aw=O.forwardRef((t,e)=>{const n=Ln(io,t.__scopeScrollArea),{forceMount:o,...r}=t,[s,i]=O.useState(!1),a=t.orientation==="horizontal",l=Dl(()=>{if(n.viewport){const d=n.viewport.offsetWidth<n.viewport.scrollWidth,u=n.viewport.offsetHeight<n.viewport.scrollHeight;i(a?d:u)}},10);return hs(n.viewport,l),hs(n.content,l),c.jsx(Xc,{present:o||s,children:c.jsx(uh,{"data-state":s?"visible":"hidden",...r,ref:e})})}),uh=O.forwardRef((t,e)=>{const{orientation:n="vertical",...o}=t,r=Ln(io,t.__scopeScrollArea),s=O.useRef(null),i=O.useRef(0),[a,l]=O.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=hw(a.viewport,a.content),u={...o,sizes:a,onSizesChange:l,hasThumb:d>0&&d<1,onThumbChange:f=>s.current=f,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:f=>i.current=f};function h(f,m){return function(_,g,p,b="ltr"){const x=Ol(p),y=x/2,v=g||y,C=x-v,S=p.scrollbar.paddingStart+v,E=p.scrollbar.size-p.scrollbar.paddingEnd-C,N=p.content-p.viewport,j=b==="ltr"?[0,N]:[-1*N,0];return mw([S,E],j)(_)}(f,i.current,a,m)}return n==="horizontal"?c.jsx(S9,{...u,ref:e,onThumbPositionChange:()=>{if(r.viewport&&s.current){const f=fw(r.viewport.scrollLeft,a,r.dir);s.current.style.transform=`translate3d(${f}px, 0, 0)`}},onWheelScroll:f=>{r.viewport&&(r.viewport.scrollLeft=f)},onDragScroll:f=>{r.viewport&&(r.viewport.scrollLeft=h(f,r.dir))}}):n==="vertical"?c.jsx(C9,{...u,ref:e,onThumbPositionChange:()=>{if(r.viewport&&s.current){const f=fw(r.viewport.scrollTop,a);s.current.style.transform=`translate3d(0, ${f}px, 0)`}},onWheelScroll:f=>{r.viewport&&(r.viewport.scrollTop=f)},onDragScroll:f=>{r.viewport&&(r.viewport.scrollTop=h(f))}}):null}),S9=O.forwardRef((t,e)=>{const{sizes:n,onSizesChange:o,...r}=t,s=Ln(io,t.__scopeScrollArea),[i,a]=O.useState(),l=O.useRef(null),d=qs(e,l,s.onScrollbarXChange);return O.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),c.jsx(cw,{"data-orientation":"horizontal",...r,ref:d,sizes:n,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Ol(n)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.x),onDragScroll:u=>t.onDragScroll(u.x),onWheelScroll:(u,h)=>{if(s.viewport){const f=s.viewport.scrollLeft+u.deltaX;t.onWheelScroll(f),pw(f,h)&&u.preventDefault()}},onResize:()=>{l.current&&s.viewport&&i&&o({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:Ml(i.paddingLeft),paddingEnd:Ml(i.paddingRight)}})}})}),C9=O.forwardRef((t,e)=>{const{sizes:n,onSizesChange:o,...r}=t,s=Ln(io,t.__scopeScrollArea),[i,a]=O.useState(),l=O.useRef(null),d=qs(e,l,s.onScrollbarYChange);return O.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),c.jsx(cw,{"data-orientation":"vertical",...r,ref:d,sizes:n,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Ol(n)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.y),onDragScroll:u=>t.onDragScroll(u.y),onWheelScroll:(u,h)=>{if(s.viewport){const f=s.viewport.scrollTop+u.deltaY;t.onWheelScroll(f),pw(f,h)&&u.preventDefault()}},onResize:()=>{l.current&&s.viewport&&i&&o({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:Ml(i.paddingTop),paddingEnd:Ml(i.paddingBottom)}})}})}),[N9,lw]=ow(io),cw=O.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:o,hasThumb:r,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:d,onWheelScroll:u,onResize:h,...f}=t,m=Ln(io,n),[_,g]=O.useState(null),p=qs(e,j=>g(j)),b=O.useRef(null),x=O.useRef(""),y=m.viewport,v=o.content-o.viewport,C=_r(u),S=_r(l),E=Dl(h,10);function N(j){if(b.current){const T=j.clientX-b.current.left,A=j.clientY-b.current.top;d({x:T,y:A})}}return O.useEffect(()=>{const j=T=>{const A=T.target;(_==null?void 0:_.contains(A))&&C(T,v)};return document.addEventListener("wheel",j,{passive:!1}),()=>document.removeEventListener("wheel",j,{passive:!1})},[y,_,v,C]),O.useEffect(S,[o,S]),hs(_,E),hs(m.content,E),c.jsx(N9,{scope:n,scrollbar:_,hasThumb:r,onThumbChange:_r(s),onThumbPointerUp:_r(i),onThumbPositionChange:S,onThumbPointerDown:_r(a),children:c.jsx($s.div,{...f,ref:p,style:{position:"absolute",...f.style},onPointerDown:Gn(t.onPointerDown,j=>{j.button===0&&(j.target.setPointerCapture(j.pointerId),b.current=_.getBoundingClientRect(),x.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",m.viewport&&(m.viewport.style.scrollBehavior="auto"),N(j))}),onPointerMove:Gn(t.onPointerMove,N),onPointerUp:Gn(t.onPointerUp,j=>{const T=j.target;T.hasPointerCapture(j.pointerId)&&T.releasePointerCapture(j.pointerId),document.body.style.webkitUserSelect=x.current,m.viewport&&(m.viewport.style.scrollBehavior=""),b.current=null})})})}),Tl="ScrollAreaThumb",dw=O.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=lw(Tl,t.__scopeScrollArea);return c.jsx(Xc,{present:n||r.hasThumb,children:c.jsx(j9,{ref:e,...o})})}),j9=O.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:o,...r}=t,s=Ln(Tl,n),i=lw(Tl,n),{onThumbPositionChange:a}=i,l=qs(e,h=>i.onThumbChange(h)),d=O.useRef(void 0),u=Dl(()=>{d.current&&(d.current(),d.current=void 0)},100);return O.useEffect(()=>{const h=s.viewport;if(h){const f=()=>{if(u(),!d.current){const m=I9(h,a);d.current=m,a()}};return a(),h.addEventListener("scroll",f),()=>h.removeEventListener("scroll",f)}},[s.viewport,u,a]),c.jsx($s.div,{"data-state":i.hasThumb?"visible":"hidden",...r,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...o},onPointerDownCapture:Gn(t.onPointerDownCapture,h=>{const f=h.target.getBoundingClientRect(),m=h.clientX-f.left,_=h.clientY-f.top;i.onThumbPointerDown({x:m,y:_})}),onPointerUp:Gn(t.onPointerUp,i.onThumbPointerUp)})});dw.displayName=Tl;var hh="ScrollAreaCorner",uw=O.forwardRef((t,e)=>{const n=Ln(hh,t.__scopeScrollArea),o=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&o?c.jsx(E9,{...t,ref:e}):null});uw.displayName=hh;var E9=O.forwardRef((t,e)=>{const{__scopeScrollArea:n,...o}=t,r=Ln(hh,n),[s,i]=O.useState(0),[a,l]=O.useState(0),d=!!(s&&a);return hs(r.scrollbarX,()=>{var h;const u=((h=r.scrollbarX)==null?void 0:h.offsetHeight)||0;r.onCornerHeightChange(u),l(u)}),hs(r.scrollbarY,()=>{var h;const u=((h=r.scrollbarY)==null?void 0:h.offsetWidth)||0;r.onCornerWidthChange(u),i(u)}),d?c.jsx($s.div,{...o,ref:e,style:{width:s,height:a,position:"absolute",right:r.dir==="ltr"?0:void 0,left:r.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function Ml(t){return t?parseInt(t,10):0}function hw(t,e){const n=t/e;return isNaN(n)?0:n}function Ol(t){const e=hw(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=(t.scrollbar.size-n)*e;return Math.max(o,18)}function fw(t,e,n="ltr"){const o=Ol(e),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=e.scrollbar.size-r,i=e.content-e.viewport,a=s-o,l=R$(t,n==="ltr"?[0,i]:[-1*i,0]);return mw([0,i],[0,a])(l)}function mw(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const o=(e[1]-e[0])/(t[1]-t[0]);return e[0]+o*(n-t[0])}}function pw(t,e){return t>0&&t<e}var I9=(t,e=()=>{})=>{let n={left:t.scrollLeft,top:t.scrollTop},o=0;return function r(){const s={left:t.scrollLeft,top:t.scrollTop},i=n.left!==s.left,a=n.top!==s.top;(i||a)&&e(),n=s,o=window.requestAnimationFrame(r)}(),()=>window.cancelAnimationFrame(o)};function Dl(t,e){const n=_r(t),o=O.useRef(0);return O.useEffect(()=>()=>window.clearTimeout(o.current),[]),O.useCallback(()=>{window.clearTimeout(o.current),o.current=window.setTimeout(n,e)},[n,e])}function hs(t,e){const n=_r(e);D$(()=>{let o=0;if(t){const r=new ResizeObserver(()=>{cancelAnimationFrame(o),o=window.requestAnimationFrame(n)});return r.observe(t),()=>{window.cancelAnimationFrame(o),r.unobserve(t)}}},[t,n])}var gw=rw,A9=iw,T9=uw;const _w=O.forwardRef((t,e)=>{const n=K.c(15);let o,r,s,i,a,l,d,u;return n[0]!==t?({className:r,children:o,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]),n[4]!==r?(i=Ne("relative overflow-hidden",r),n[4]=r,n[5]=i):i=n[5],n[6]!==o?(a=c.jsx(A9,{className:"h-full w-full rounded-[inherit]",children:o}),n[6]=o,n[7]=a):a=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(bw,{}),d=c.jsx(T9,{}),n[8]=l,n[9]=d):(l=n[8],d=n[9]),n[10]!==s||n[11]!==e||n[12]!==i||n[13]!==a?(u=c.jsxs(gw,{ref:e,className:i,...s,children:[a,l,d]}),n[10]=s,n[11]=e,n[12]=i,n[13]=a,n[14]=u):u=n[14],u});_w.displayName=gw.displayName;const bw=O.forwardRef((t,e)=>{const n=K.c(14);let o,r,s;n[0]!==t?({className:o,orientation:s,...r}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]);const i=s===void 0?"vertical":s,a=i==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",l=i==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]";let d,u,h;return n[4]!==o||n[5]!==a||n[6]!==l?(d=Ne("flex touch-none select-none transition-colors",a,l,o),n[4]=o,n[5]=a,n[6]=l,n[7]=d):d=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx(dw,{className:"relative flex-1 rounded-full bg-border"}),n[8]=u):u=n[8],n[9]!==i||n[10]!==r||n[11]!==e||n[12]!==d?(h=c.jsx(dh,{ref:e,orientation:i,className:d,...r,children:u}),n[9]=i,n[10]=r,n[11]=e,n[12]=d,n[13]=h):h=n[13],h});bw.displayName=dh.displayName;let fh;fh=(t,e,n,o,r,s)=>{if(!e)return vt.warn("No active chat"),t;const i=t.chats.findIndex(h=>h.id===e);if(i===-1)return vt.warn("No active chat"),t;const a=t.chats[i],l=a.messages.findIndex(h=>h.id===n),d=[...t.chats],u=Date.now();if(l===-1)d[i]={...a,messages:[...a.messages,{id:n,role:o,content:r,timestamp:u,parts:s}],updatedAt:u};else{const h=[...a.messages];h[l]={...h[l],content:r,parts:s},d[i]={...a,messages:h,updatedAt:u}}return{...t,chats:d}},yn=t=>{const e=K.c(15),{title:n,description:o,icon:r,action:s}=t;let i,a,l,d,u,h;return e[0]!==r?(i=r&&X.cloneElement(r,{className:"text-accent-foreground"}),e[0]=r,e[1]=i):i=e[1],e[2]!==n?(a=c.jsx("span",{className:"mt-1 text-accent-foreground",children:n}),e[2]=n,e[3]=a):a=e[3],e[4]!==i||e[5]!==a?(l=c.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[i,a]}),e[4]=i,e[5]=a,e[6]=l):l=e[6],e[7]!==o?(d=c.jsx("span",{className:"text-muted-foreground text-sm",children:o}),e[7]=o,e[8]=d):d=e[8],e[9]!==s?(u=s&&c.jsx("div",{className:"mt-2",children:s}),e[9]=s,e[10]=u):u=e[10],e[11]!==l||e[12]!==d||e[13]!==u?(h=c.jsxs("div",{className:"mx-6 my-6 flex flex-col gap-2",children:[l,d,u]}),e[11]=l,e[12]=d,e[13]=u,e[14]=h):h=e[14],h};function HW(){}function WW(){}const M9=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,O9=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,D9={};function xw(t,e){return(D9.jsx?O9:M9).test(t)}const R9=/[ \t\n\f\r]/g;function yw(t){return t.replace(R9,"")===""}class Ti{constructor(e,n,o){this.property=e,this.normal=n,o&&(this.space=o)}}function ww(t,e){const n={},o={};let r=-1;for(;++r<t.length;)Object.assign(n,t[r].property),Object.assign(o,t[r].normal);return new Ti(n,o,e)}function mh(t){return t.toLowerCase()}Ti.prototype.property={},Ti.prototype.normal={},Ti.prototype.space=null;class Fn{constructor(e,n){this.property=e,this.attribute=n}}Fn.prototype.space=null,Fn.prototype.boolean=!1,Fn.prototype.booleanish=!1,Fn.prototype.overloadedBoolean=!1,Fn.prototype.number=!1,Fn.prototype.commaSeparated=!1,Fn.prototype.spaceSeparated=!1,Fn.prototype.commaOrSpaceSeparated=!1,Fn.prototype.mustUseProperty=!1,Fn.prototype.defined=!1;let P9=0;const Ze=Or(),Pt=Or(),vw=Or(),ye=Or(),gt=Or(),fs=Or(),Sn=Or();function Or(){return 2**++P9}const ph=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ze,booleanish:Pt,commaOrSpaceSeparated:Sn,commaSeparated:fs,number:ye,overloadedBoolean:vw,spaceSeparated:gt},Symbol.toStringTag,{value:"Module"})),gh=Object.keys(ph);class _h extends Fn{constructor(e,n,o,r){let s=-1;if(super(e,n),kw(this,"space",r),typeof o=="number")for(;++s<gh.length;){const i=gh[s];kw(this,gh[s],(o&ph[i])===ph[i])}}}function kw(t,e,n){n&&(t[e]=n)}_h.prototype.defined=!0;const L9={}.hasOwnProperty;function ms(t){const e={},n={};let o;for(o in t.properties)if(L9.call(t.properties,o)){const r=t.properties[o],s=new _h(o,t.transform(t.attributes||{},o),r,t.space);t.mustUseProperty&&t.mustUseProperty.includes(o)&&(s.mustUseProperty=!0),e[o]=s,n[mh(o)]=o,n[mh(s.attribute)]=o}return new Ti(e,n,t.space)}const Sw=ms({space:"xlink",transform:(t,e)=>"xlink:"+e.slice(5).toLowerCase(),properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}}),Cw=ms({space:"xml",transform:(t,e)=>"xml:"+e.slice(3).toLowerCase(),properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function Nw(t,e){return e in t?t[e]:e}function jw(t,e){return Nw(t,e.toLowerCase())}const Ew=ms({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:jw,properties:{xmlns:null,xmlnsXLink:null}}),Iw=ms({transform:(t,e)=>e==="role"?e:"aria-"+e.slice(4).toLowerCase(),properties:{ariaActiveDescendant:null,ariaAtomic:Pt,ariaAutoComplete:null,ariaBusy:Pt,ariaChecked:Pt,ariaColCount:ye,ariaColIndex:ye,ariaColSpan:ye,ariaControls:gt,ariaCurrent:null,ariaDescribedBy:gt,ariaDetails:null,ariaDisabled:Pt,ariaDropEffect:gt,ariaErrorMessage:null,ariaExpanded:Pt,ariaFlowTo:gt,ariaGrabbed:Pt,ariaHasPopup:null,ariaHidden:Pt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:gt,ariaLevel:ye,ariaLive:null,ariaModal:Pt,ariaMultiLine:Pt,ariaMultiSelectable:Pt,ariaOrientation:null,ariaOwns:gt,ariaPlaceholder:null,ariaPosInSet:ye,ariaPressed:Pt,ariaReadOnly:Pt,ariaRelevant:null,ariaRequired:Pt,ariaRoleDescription:gt,ariaRowCount:ye,ariaRowIndex:ye,ariaRowSpan:ye,ariaSelected:Pt,ariaSetSize:ye,ariaSort:null,ariaValueMax:ye,ariaValueMin:ye,ariaValueNow:ye,ariaValueText:null,role:null}}),F9=ms({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:jw,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:fs,acceptCharset:gt,accessKey:gt,action:null,allow:null,allowFullScreen:Ze,allowPaymentRequest:Ze,allowUserMedia:Ze,alt:null,as:null,async:Ze,autoCapitalize:null,autoComplete:gt,autoFocus:Ze,autoPlay:Ze,blocking:gt,capture:null,charSet:null,checked:Ze,cite:null,className:gt,cols:ye,colSpan:null,content:null,contentEditable:Pt,controls:Ze,controlsList:gt,coords:ye|fs,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ze,defer:Ze,dir:null,dirName:null,disabled:Ze,download:vw,draggable:Pt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ze,formTarget:null,headers:gt,height:ye,hidden:Ze,high:ye,href:null,hrefLang:null,htmlFor:gt,httpEquiv:gt,id:null,imageSizes:null,imageSrcSet:null,inert:Ze,inputMode:null,integrity:null,is:null,isMap:Ze,itemId:null,itemProp:gt,itemRef:gt,itemScope:Ze,itemType:gt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ze,low:ye,manifest:null,max:null,maxLength:ye,media:null,method:null,min:null,minLength:ye,multiple:Ze,muted:Ze,name:null,nonce:null,noModule:Ze,noValidate:Ze,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ze,optimum:ye,pattern:null,ping:gt,placeholder:null,playsInline:Ze,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ze,referrerPolicy:null,rel:gt,required:Ze,reversed:Ze,rows:ye,rowSpan:ye,sandbox:gt,scope:null,scoped:Ze,seamless:Ze,selected:Ze,shadowRootClonable:Ze,shadowRootDelegatesFocus:Ze,shadowRootMode:null,shape:null,size:ye,sizes:null,slot:null,span:ye,spellCheck:Pt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ye,step:null,style:null,tabIndex:ye,target:null,title:null,translate:null,type:null,typeMustMatch:Ze,useMap:null,value:Pt,width:ye,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:gt,axis:null,background:null,bgColor:null,border:ye,borderColor:null,bottomMargin:ye,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ze,declare:Ze,event:null,face:null,frame:null,frameBorder:null,hSpace:ye,leftMargin:ye,link:null,longDesc:null,lowSrc:null,marginHeight:ye,marginWidth:ye,noResize:Ze,noHref:Ze,noShade:Ze,noWrap:Ze,object:null,profile:null,prompt:null,rev:null,rightMargin:ye,rules:null,scheme:null,scrolling:Pt,standby:null,summary:null,text:null,topMargin:ye,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ye,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ze,disableRemotePlayback:Ze,prefix:null,property:null,results:ye,security:null,unselectable:null}}),z9=ms({space:"svg",attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},transform:Nw,properties:{about:Sn,accentHeight:ye,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ye,amplitude:ye,arabicForm:null,ascent:ye,attributeName:null,attributeType:null,azimuth:ye,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ye,by:null,calcMode:null,capHeight:ye,className:gt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ye,diffuseConstant:ye,direction:null,display:null,dur:null,divisor:ye,dominantBaseline:null,download:Ze,dx:null,dy:null,edgeMode:null,editable:null,elevation:ye,enableBackground:null,end:null,event:null,exponent:ye,externalResourcesRequired:null,fill:null,fillOpacity:ye,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:fs,g2:fs,glyphName:fs,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ye,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ye,horizOriginX:ye,horizOriginY:ye,id:null,ideographic:ye,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ye,k:ye,k1:ye,k2:ye,k3:ye,k4:ye,kernelMatrix:Sn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ye,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ye,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ye,overlineThickness:ye,paintOrder:null,panose1:null,path:null,pathLength:ye,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:gt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ye,pointsAtY:ye,pointsAtZ:ye,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Sn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Sn,rev:Sn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Sn,requiredFeatures:Sn,requiredFonts:Sn,requiredFormats:Sn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ye,specularExponent:ye,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ye,strikethroughThickness:ye,string:null,stroke:null,strokeDashArray:Sn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ye,strokeOpacity:ye,strokeWidth:null,style:null,surfaceScale:ye,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Sn,tabIndex:ye,tableValues:null,target:null,targetX:ye,targetY:ye,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Sn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ye,underlineThickness:ye,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ye,values:null,vAlphabetic:ye,vMathematical:ye,vectorEffect:null,vHanging:ye,vIdeographic:ye,version:null,vertAdvY:ye,vertOriginX:ye,vertOriginY:ye,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ye,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}}),B9=/^data[-\w.:]+$/i,Aw=/-[a-z]/g,U9=/[A-Z]/g;function V9(t){return"-"+t.toLowerCase()}function $9(t){return t.charAt(1).toUpperCase()}const H9={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},W9=ww([Cw,Sw,Ew,Iw,F9],"html"),bh=ww([Cw,Sw,Ew,Iw,z9],"svg"),Tw=xS(P$()),q9=Tw.default||Tw,Mw=Ow("end"),xh=Ow("start");function Ow(t){return function(e){const n=e&&e.position&&e.position[t]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function Mi(t){return t&&typeof t=="object"?"position"in t||"type"in t?Dw(t.position):"start"in t||"end"in t?Dw(t):"line"in t||"column"in t?yh(t):"":""}function yh(t){return Rw(t&&t.line)+":"+Rw(t&&t.column)}function Dw(t){return yh(t&&t.start)+"-"+yh(t&&t.end)}function Rw(t){return t&&typeof t=="number"?t:1}class tn extends Error{constructor(e,n,o){super(),typeof n=="string"&&(o=n,n=void 0);let r="",s={},i=!1;if(n&&(s="line"in n&&"column"in n||"start"in n&&"end"in n?{place:n}:"type"in n?{ancestors:[n],place:n.position}:{...n}),typeof e=="string"?r=e:!s.cause&&e&&(i=!0,r=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof o=="string"){const l=o.indexOf(":");l===-1?s.ruleId=o:(s.source=o.slice(0,l),s.ruleId=o.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file,this.message=r,this.line=a?a.line:void 0,this.name=Mi(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=i&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual,this.expected,this.note,this.url}}tn.prototype.file="",tn.prototype.name="",tn.prototype.reason="",tn.prototype.message="",tn.prototype.stack="",tn.prototype.column=void 0,tn.prototype.line=void 0,tn.prototype.ancestors=void 0,tn.prototype.cause=void 0,tn.prototype.fatal=void 0,tn.prototype.place=void 0,tn.prototype.ruleId=void 0,tn.prototype.source=void 0;const wh={}.hasOwnProperty,G9=new Map,Y9=/[A-Z]/g,J9=/-([a-z])/g,K9=new Set(["table","tbody","thead","tfoot","tr"]),X9=new Set(["td","th"]),Pw="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Z9(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let o;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");o=function(i,a){return l;function l(d,u,h,f){const m=Array.isArray(h.children),_=xh(d);return a(u,h,f,m,{columnNumber:_?_.column-1:void 0,fileName:i,lineNumber:_?_.line:void 0},void 0)}}(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");o=function(i,a,l){return d;function d(u,h,f,m){const _=Array.isArray(f.children)?l:a;return m?_(h,f,m):_(h,f)}}(0,e.jsx,e.jsxs)}const r={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:o,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?bh:W9,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=Lw(r,t,void 0);return s&&typeof s!="string"?s:r.create(t,r.Fragment,{children:s||void 0},void 0)}function Lw(t,e,n){return e.type==="element"?function(o,r,s){const i=o.schema;let a=i;r.tagName.toLowerCase()==="svg"&&i.space==="html"&&(a=bh,o.schema=a),o.ancestors.push(r);const l=zw(o,r.tagName,!1),d=function(h,f){const m={};let _,g;for(g in f.properties)if(g!=="children"&&wh.call(f.properties,g)){const p=Q9(h,g,f.properties[g]);if(p){const[b,x]=p;h.tableCellAlignToStyle&&b==="align"&&typeof x=="string"&&X9.has(f.tagName)?_=x:m[b]=x}}return _&&((m.style||(m.style={}))[h.stylePropertyNameCase==="css"?"text-align":"textAlign"]=_),m}(o,r);let u=kh(o,r);return K9.has(r.tagName)&&(u=u.filter(function(h){return typeof h!="string"||!(typeof(f=h)=="object"?f.type==="text"&&yw(f.value):yw(f));var f})),Fw(o,d,l,r),vh(d,u),o.ancestors.pop(),o.schema=i,o.create(r,l,d,s)}(t,e,n):e.type==="mdxFlowExpression"||e.type==="mdxTextExpression"?function(o,r){if(r.data&&r.data.estree&&o.evaluater){const s=r.data.estree.body[0];return s.type,o.evaluater.evaluateExpression(s.expression)}Oi(o,r.position)}(t,e):e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement"?function(o,r,s){const i=o.schema;let a=i;r.name==="svg"&&i.space==="html"&&(a=bh,o.schema=a),o.ancestors.push(r);const l=r.name===null?o.Fragment:zw(o,r.name,!0),d=function(h,f){const m={};for(const _ of f.attributes)if(_.type==="mdxJsxExpressionAttribute")if(_.data&&_.data.estree&&h.evaluater){const g=_.data.estree.body[0];g.type;const p=g.expression;p.type;const b=p.properties[0];b.type,Object.assign(m,h.evaluater.evaluateExpression(b.argument))}else Oi(h,f.position);else{const g=_.name;let p;if(_.value&&typeof _.value=="object")if(_.value.data&&_.value.data.estree&&h.evaluater){const b=_.value.data.estree.body[0];b.type,p=h.evaluater.evaluateExpression(b.expression)}else Oi(h,f.position);else p=_.value===null||_.value;m[g]=p}return m}(o,r),u=kh(o,r);return Fw(o,d,l,r),vh(d,u),o.ancestors.pop(),o.schema=i,o.create(r,l,d,s)}(t,e,n):e.type==="mdxjsEsm"?function(o,r){if(r.data&&r.data.estree&&o.evaluater)return o.evaluater.evaluateProgram(r.data.estree);Oi(o,r.position)}(t,e):e.type==="root"?function(o,r,s){const i={};return vh(i,kh(o,r)),o.create(r,o.Fragment,i,s)}(t,e,n):e.type==="text"?function(o,r){return r.value}(0,e):void 0}function Fw(t,e,n,o){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=o)}function vh(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function kh(t,e){const n=[];let o=-1;const r=t.passKeys?new Map:G9;for(;++o<e.children.length;){const s=e.children[o];let i;if(t.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const d=r.get(l)||0;i=l+"-"+d,r.set(l,d+1)}}const a=Lw(t,s,i);a!==void 0&&n.push(a)}return n}function Q9(t,e,n){const o=function(r,s){const i=mh(s);let a=s,l=Fn;if(i in r.normal)return r.property[r.normal[i]];if(i.length>4&&i.slice(0,4)==="data"&&B9.test(s)){if(s.charAt(4)==="-"){const d=s.slice(5).replace(Aw,$9);a="data"+d.charAt(0).toUpperCase()+d.slice(1)}else{const d=s.slice(4);if(!Aw.test(d)){let u=d.replace(U9,V9);u.charAt(0)!=="-"&&(u="-"+u),s="data"+u}}l=_h}return new l(a,s)}(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=o.commaSeparated?function(r){const s={};return(r[r.length-1]===""?[...r,""]:r).join((s.padRight?" ":"")+","+(s.padLeft===!1?"":" ")).trim()}(n):n.join(" ").trim()),o.property==="style"){let r=typeof n=="object"?n:function(s,i){const a={};try{q9(i,l)}catch(d){if(!s.ignoreInvalidStyle){const u=d,h=new tn("Cannot parse `style` attribute",{ancestors:s.ancestors,cause:u,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw h.file=s.filePath||void 0,h.url=Pw+"#cannot-parse-style-attribute",h}}return a;function l(d,u){let h=d;h.slice(0,2)!=="--"&&(h.slice(0,4)==="-ms-"&&(h="ms-"+h.slice(4)),h=h.replace(J9,tD)),a[h]=u}}(t,String(n));return t.stylePropertyNameCase==="css"&&(r=function(s){const i={};let a;for(a in s)wh.call(s,a)&&(i[eD(a)]=s[a]);return i}(r)),["style",r]}return[t.elementAttributeNameCase==="react"&&o.space?H9[o.property]||o.property:o.attribute,n]}}function zw(t,e,n){let o;if(n)if(e.includes(".")){const r=e.split(".");let s,i=-1;for(;++i<r.length;){const a=xw(r[i])?{type:"Identifier",name:r[i]}:{type:"Literal",value:r[i]};s=s?{type:"MemberExpression",object:s,property:a,computed:!!(i&&a.type==="Literal"),optional:!1}:a}o=s}else o=xw(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};else o={type:"Literal",value:e};if(o.type==="Literal"){const r=o.value;return wh.call(t.components,r)?t.components[r]:r}if(t.evaluater)return t.evaluater.evaluateExpression(o);Oi(t)}function Oi(t,e){const n=new tn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=t.filePath||void 0,n.url=Pw+"#cannot-handle-mdx-estrees-without-createevaluater",n}function eD(t){let e=t.replace(Y9,nD);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function tD(t,e){return e.toUpperCase()}function nD(t){return"-"+t.toLowerCase()}const Sh={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Rl={};function Bw(t,e,n){if(function(o){return!!(o&&typeof o=="object")}(t)){if("value"in t)return t.type!=="html"||n?t.value:"";if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return Uw(t.children,e,n)}return Array.isArray(t)?Uw(t,e,n):""}function Uw(t,e,n){const o=[];let r=-1;for(;++r<t.length;)o[r]=Bw(t[r],e,n);return o.join("")}const Vw=document.createElement("i");function Ch(t){const e="&"+t+";";Vw.innerHTML=e;const n=Vw.textContent;return(n.charCodeAt(n.length-1)!==59||t==="semi")&&n!==e&&n}function ao(t,e,n,o){const r=t.length;let s,i=0;if(e=e<0?-e>r?0:r+e:e>r?r:e,n=n>0?n:0,o.length<1e4)s=Array.from(o),s.unshift(e,n),t.splice(...s);else for(n&&t.splice(e,n);i<o.length;)s=o.slice(i,i+1e4),s.unshift(e,0),t.splice(...s),i+=1e4,e+=1e4}function zn(t,e){return t.length>0?(ao(t,t.length,0,e),t):e}const $w={}.hasOwnProperty;function oD(t,e){let n;for(n in e){const o=($w.call(t,n)?t[n]:void 0)||(t[n]={}),r=e[n];let s;if(r)for(s in r){$w.call(o,s)||(o[s]=[]);const i=r[s];rD(o[s],Array.isArray(i)?i:i?[i]:[])}}}function rD(t,e){let n=-1;const o=[];for(;++n<e.length;)(e[n].add==="after"?t:o).push(e[n]);ao(t,0,0,o)}function Hw(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||!(65535&~n)||(65535&n)==65534||n>1114111?"\uFFFD":String.fromCodePoint(n)}function ps(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const lo=Xo(/[A-Za-z]/),Cn=Xo(/[\dA-Za-z]/),sD=Xo(/[#-'*+\--9=?A-Z^-~]/);function Nh(t){return t!==null&&(t<32||t===127)}const jh=Xo(/\d/),iD=Xo(/[\dA-Fa-f]/),aD=Xo(/[!-/:-@[-`{-~]/);function Je(t){return t!==null&&t<-2}function pn(t){return t!==null&&(t<0||t===32)}function ut(t){return t===-2||t===-1||t===32}const lD=Xo(new RegExp("\\p{P}|\\p{S}","u")),cD=Xo(/\s/);function Xo(t){return function(e){return e!==null&&e>-1&&t.test(String.fromCharCode(e))}}function gs(t){const e=[];let n=-1,o=0,r=0;for(;++n<t.length;){const s=t.charCodeAt(n);let i="";if(s===37&&Cn(t.charCodeAt(n+1))&&Cn(t.charCodeAt(n+2)))r=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(i=String.fromCharCode(s));else if(s>55295&&s<57344){const a=t.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(i=String.fromCharCode(s,a),r=1):i="\uFFFD"}else i=String.fromCharCode(s);i&&(e.push(t.slice(o,n),encodeURIComponent(i)),o=n+r+1,i=""),r&&(n+=r,r=0)}return e.join("")+t.slice(o)}function _t(t,e,n,o){const r=o?o-1:Number.POSITIVE_INFINITY;let s=0;return function(a){return ut(a)?(t.enter(n),i(a)):e(a)};function i(a){return ut(a)&&s++<r?(t.consume(a),i):(t.exit(n),e(a))}}const dD={tokenize:function(t){const e=t.attempt(this.parser.constructs.contentInitial,function(s){return s===null?void t.consume(s):(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),_t(t,e,"linePrefix"))},function(s){return t.enter("paragraph"),o(s)});let n;return e;function o(s){const i=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=i),n=i,r(s)}function r(s){return s===null?(t.exit("chunkText"),t.exit("paragraph"),void t.consume(s)):Je(s)?(t.consume(s),t.exit("chunkText"),o):(t.consume(s),r)}}},uD={tokenize:function(t){const e=this,n=[];let o,r,s,i=0;return a;function a(y){if(i<n.length){const v=n[i];return e.containerState=v[1],t.attempt(v[0].continuation,l,d)(y)}return d(y)}function l(y){if(i++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,o&&x();const v=e.events.length;let C,S=v;for(;S--;)if(e.events[S][0]==="exit"&&e.events[S][1].type==="chunkFlow"){C=e.events[S][1].end;break}b(i);let E=v;for(;E<e.events.length;)e.events[E][1].end={...C},E++;return ao(e.events,S+1,0,e.events.slice(v)),e.events.length=E,d(y)}return a(y)}function d(y){if(i===n.length){if(!o)return f(y);if(o.currentConstruct&&o.currentConstruct.concrete)return _(y);e.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(Ww,u,h)(y)}function u(y){return o&&x(),b(i),f(y)}function h(y){return e.parser.lazy[e.now().line]=i!==n.length,s=e.now().offset,_(y)}function f(y){return e.containerState={},t.attempt(Ww,m,_)(y)}function m(y){return i++,n.push([e.currentConstruct,e.containerState]),f(y)}function _(y){return y===null?(o&&x(),b(0),void t.consume(y)):(o=o||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:r}),g(y))}function g(y){return y===null?(p(t.exit("chunkFlow"),!0),b(0),void t.consume(y)):Je(y)?(t.consume(y),p(t.exit("chunkFlow")),i=0,e.interrupt=void 0,a):(t.consume(y),g)}function p(y,v){const C=e.sliceStream(y);if(v&&C.push(null),y.previous=r,r&&(r.next=y),r=y,o.defineSkip(y.start),o.write(C),e.parser.lazy[y.start.line]){let S=o.events.length;for(;S--;)if(o.events[S][1].start.offset<s&&(!o.events[S][1].end||o.events[S][1].end.offset>s))return;const E=e.events.length;let N,j,T=E;for(;T--;)if(e.events[T][0]==="exit"&&e.events[T][1].type==="chunkFlow"){if(N){j=e.events[T][1].end;break}N=!0}for(b(i),S=E;S<e.events.length;)e.events[S][1].end={...j},S++;ao(e.events,T+1,0,e.events.slice(E)),e.events.length=S}}function b(y){let v=n.length;for(;v-- >y;){const C=n[v];e.containerState=C[1],C[0].exit.call(e,t)}n.length=y}function x(){o.write([null]),r=void 0,o=void 0,e.containerState._closeFlow=void 0}}},Ww={tokenize:function(t,e,n){return _t(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};function qw(t){return t===null||pn(t)||cD(t)?1:lD(t)?2:void 0}function Eh(t,e,n){const o=[];let r=-1;for(;++r<t.length;){const s=t[r].resolveAll;s&&!o.includes(s)&&(e=s(e,n),o.push(s))}return e}const Ih={name:"attention",resolveAll:function(t,e){let n,o,r,s,i,a,l,d,u=-1;for(;++u<t.length;)if(t[u][0]==="enter"&&t[u][1].type==="attentionSequence"&&t[u][1]._close){for(n=u;n--;)if(t[n][0]==="exit"&&t[n][1].type==="attentionSequence"&&t[n][1]._open&&e.sliceSerialize(t[n][1]).charCodeAt(0)===e.sliceSerialize(t[u][1]).charCodeAt(0)){if((t[n][1]._close||t[u][1]._open)&&(t[u][1].end.offset-t[u][1].start.offset)%3&&!((t[n][1].end.offset-t[n][1].start.offset+t[u][1].end.offset-t[u][1].start.offset)%3))continue;a=t[n][1].end.offset-t[n][1].start.offset>1&&t[u][1].end.offset-t[u][1].start.offset>1?2:1;const h={...t[n][1].end},f={...t[u][1].start};Gw(h,-a),Gw(f,a),s={type:a>1?"strongSequence":"emphasisSequence",start:h,end:{...t[n][1].end}},i={type:a>1?"strongSequence":"emphasisSequence",start:{...t[u][1].start},end:f},r={type:a>1?"strongText":"emphasisText",start:{...t[n][1].end},end:{...t[u][1].start}},o={type:a>1?"strong":"emphasis",start:{...s.start},end:{...i.end}},t[n][1].end={...s.start},t[u][1].start={...i.end},l=[],t[n][1].end.offset-t[n][1].start.offset&&(l=zn(l,[["enter",t[n][1],e],["exit",t[n][1],e]])),l=zn(l,[["enter",o,e],["enter",s,e],["exit",s,e],["enter",r,e]]),l=zn(l,Eh(e.parser.constructs.insideSpan.null,t.slice(n+1,u),e)),l=zn(l,[["exit",r,e],["enter",i,e],["exit",i,e],["exit",o,e]]),t[u][1].end.offset-t[u][1].start.offset?(d=2,l=zn(l,[["enter",t[u][1],e],["exit",t[u][1],e]])):d=0,ao(t,n-1,u-n+3,l),u=n+l.length-d-2;break}}for(u=-1;++u<t.length;)t[u][1].type==="attentionSequence"&&(t[u][1].type="data");return t},tokenize:function(t,e){const n=this.parser.constructs.attentionMarkers.null,o=this.previous,r=qw(o);let s;return function(a){return s=a,t.enter("attentionSequence"),i(a)};function i(a){if(a===s)return t.consume(a),i;const l=t.exit("attentionSequence"),d=qw(a),u=!d||d===2&&r||n.includes(a),h=!r||r===2&&d||n.includes(o);return l._open=!!(s===42?u:u&&(r||!h)),l._close=!!(s===42?h:h&&(d||!u)),e(a)}}};function Gw(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const hD={name:"autolink",tokenize:function(t,e,n){let o=0;return function(f){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),r};function r(f){return lo(f)?(t.consume(f),s):f===64?n(f):l(f)}function s(f){return f===43||f===45||f===46||Cn(f)?(o=1,i(f)):l(f)}function i(f){return f===58?(t.consume(f),o=0,a):(f===43||f===45||f===46||Cn(f))&&o++<32?(t.consume(f),i):(o=0,l(f))}function a(f){return f===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):f===null||f===32||f===60||Nh(f)?n(f):(t.consume(f),a)}function l(f){return f===64?(t.consume(f),d):sD(f)?(t.consume(f),l):n(f)}function d(f){return Cn(f)?u(f):n(f)}function u(f){return f===46?(t.consume(f),o=0,d):f===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):h(f)}function h(f){if((f===45||Cn(f))&&o++<63){const m=f===45?h:u;return t.consume(f),m}return n(f)}}},Pl={partial:!0,tokenize:function(t,e,n){return function(r){return ut(r)?_t(t,o,"linePrefix")(r):o(r)};function o(r){return r===null||Je(r)?e(r):n(r)}}},Yw={continuation:{tokenize:function(t,e,n){const o=this;return function(s){return ut(s)?_t(t,r,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):r(s)};function r(s){return t.attempt(Yw,e,n)(s)}}},exit:function(t){t.exit("blockQuote")},name:"blockQuote",tokenize:function(t,e,n){const o=this;return function(s){if(s===62){const i=o.containerState;return i.open||(t.enter("blockQuote",{_container:!0}),i.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(s),t.exit("blockQuoteMarker"),r}return n(s)};function r(s){return ut(s)?(t.enter("blockQuotePrefixWhitespace"),t.consume(s),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(s))}}},Jw={name:"characterEscape",tokenize:function(t,e,n){return function(r){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(r),t.exit("escapeMarker"),o};function o(r){return aD(r)?(t.enter("characterEscapeValue"),t.consume(r),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(r)}}},Kw={name:"characterReference",tokenize:function(t,e,n){const o=this;let r,s,i=0;return function(u){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(u),t.exit("characterReferenceMarker"),a};function a(u){return u===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(u),t.exit("characterReferenceMarkerNumeric"),l):(t.enter("characterReferenceValue"),r=31,s=Cn,d(u))}function l(u){return u===88||u===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(u),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),r=6,s=iD,d):(t.enter("characterReferenceValue"),r=7,s=jh,d(u))}function d(u){if(u===59&&i){const h=t.exit("characterReferenceValue");return s!==Cn||Ch(o.sliceSerialize(h))?(t.enter("characterReferenceMarker"),t.consume(u),t.exit("characterReferenceMarker"),t.exit("characterReference"),e):n(u)}return s(u)&&i++<r?(t.consume(u),d):n(u)}}},Xw={partial:!0,tokenize:function(t,e,n){const o=this;return function(s){return s===null?n(s):(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),r)};function r(s){return o.parser.lazy[o.now().line]?n(s):e(s)}}},Zw={concrete:!0,name:"codeFenced",tokenize:function(t,e,n){const o=this,r={partial:!0,tokenize:function(y,v,C){let S=0;return E;function E(M){return y.enter("lineEnding"),y.consume(M),y.exit("lineEnding"),N}function N(M){return y.enter("codeFencedFence"),ut(M)?_t(y,j,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):j(M)}function j(M){return M===s?(y.enter("codeFencedFenceSequence"),T(M)):C(M)}function T(M){return M===s?(S++,y.consume(M),T):S>=a?(y.exit("codeFencedFenceSequence"),ut(M)?_t(y,A,"whitespace")(M):A(M)):C(M)}function A(M){return M===null||Je(M)?(y.exit("codeFencedFence"),v(M)):C(M)}}};let s,i=0,a=0;return function(y){return function(v){const C=o.events[o.events.length-1];return i=C&&C[1].type==="linePrefix"?C[2].sliceSerialize(C[1],!0).length:0,s=v,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),l(v)}(y)};function l(y){return y===s?(a++,t.consume(y),l):a<3?n(y):(t.exit("codeFencedFenceSequence"),ut(y)?_t(t,d,"whitespace")(y):d(y))}function d(y){return y===null||Je(y)?(t.exit("codeFencedFence"),o.interrupt?e(y):t.check(Xw,m,x)(y)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),u(y))}function u(y){return y===null||Je(y)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),d(y)):ut(y)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),_t(t,h,"whitespace")(y)):y===96&&y===s?n(y):(t.consume(y),u)}function h(y){return y===null||Je(y)?d(y):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),f(y))}function f(y){return y===null||Je(y)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),d(y)):y===96&&y===s?n(y):(t.consume(y),f)}function m(y){return t.attempt(r,x,_)(y)}function _(y){return t.enter("lineEnding"),t.consume(y),t.exit("lineEnding"),g}function g(y){return i>0&&ut(y)?_t(t,p,"linePrefix",i+1)(y):p(y)}function p(y){return y===null||Je(y)?t.check(Xw,m,x)(y):(t.enter("codeFlowValue"),b(y))}function b(y){return y===null||Je(y)?(t.exit("codeFlowValue"),p(y)):(t.consume(y),b)}function x(y){return t.exit("codeFenced"),e(y)}}},Ah={name:"codeIndented",tokenize:function(t,e,n){const o=this;return function(l){return t.enter("codeIndented"),_t(t,r,"linePrefix",5)(l)};function r(l){const d=o.events[o.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?s(l):n(l)}function s(l){return l===null?a(l):Je(l)?t.attempt(fD,s,a)(l):(t.enter("codeFlowValue"),i(l))}function i(l){return l===null||Je(l)?(t.exit("codeFlowValue"),s(l)):(t.consume(l),i)}function a(l){return t.exit("codeIndented"),e(l)}}},fD={partial:!0,tokenize:function(t,e,n){const o=this;return r;function r(i){return o.parser.lazy[o.now().line]?n(i):Je(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),r):_t(t,s,"linePrefix",5)(i)}function s(i){const a=o.events[o.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(i):Je(i)?r(i):n(i)}}},mD={name:"codeText",previous:function(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"},resolve:function(t){let e,n,o=t.length-4,r=3;if(!(t[r][1].type!=="lineEnding"&&t[r][1].type!=="space"||t[o][1].type!=="lineEnding"&&t[o][1].type!=="space")){for(e=r;++e<o;)if(t[e][1].type==="codeTextData"){t[r][1].type="codeTextPadding",t[o][1].type="codeTextPadding",r+=2,o-=2;break}}for(e=r-1,o++;++e<=o;)n===void 0?e!==o&&t[e][1].type!=="lineEnding"&&(n=e):e!==o&&t[e][1].type!=="lineEnding"||(t[n][1].type="codeTextData",e!==n+2&&(t[n][1].end=t[e-1][1].end,t.splice(n+2,e-n-2),o-=e-n-2,e=n+2),n=void 0);return t},tokenize:function(t,e,n){let o,r,s=0;return function(u){return t.enter("codeText"),t.enter("codeTextSequence"),i(u)};function i(u){return u===96?(t.consume(u),s++,i):(t.exit("codeTextSequence"),a(u))}function a(u){return u===null?n(u):u===32?(t.enter("space"),t.consume(u),t.exit("space"),a):u===96?(r=t.enter("codeTextSequence"),o=0,d(u)):Je(u)?(t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),a):(t.enter("codeTextData"),l(u))}function l(u){return u===null||u===32||u===96||Je(u)?(t.exit("codeTextData"),a(u)):(t.consume(u),l)}function d(u){return u===96?(t.consume(u),o++,d):o===s?(t.exit("codeTextSequence"),t.exit("codeText"),e(u)):(r.type="codeTextData",l(u))}}};class pD{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const o=n??Number.POSITIVE_INFINITY;return o<this.left.length?this.left.slice(e,o):e>this.left.length?this.right.slice(this.right.length-o+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-o+this.left.length).reverse())}splice(e,n,o){const r=n||0;this.setCursor(Math.trunc(e));const s=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return o&&Di(this.left,o),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Di(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Di(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);Di(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Di(this.left,n.reverse())}}}function Di(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function Qw(t){const e={};let n,o,r,s,i,a,l,d=-1;const u=new pD(t);for(;++d<u.length;){for(;d in e;)d=e[d];if(n=u.get(d),d&&n[1].type==="chunkFlow"&&u.get(d-1)[1].type==="listItemPrefix"&&(a=n[1]._tokenizer.events,r=0,r<a.length&&a[r][1].type==="lineEndingBlank"&&(r+=2),r<a.length&&a[r][1].type==="content"))for(;++r<a.length&&a[r][1].type!=="content";)a[r][1].type==="chunkText"&&(a[r][1]._isInFirstContentOfListItem=!0,r++);if(n[0]==="enter")n[1].contentType&&(Object.assign(e,gD(u,d)),d=e[d],l=!0);else if(n[1]._container){for(r=d,o=void 0;r--&&(s=u.get(r),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(o&&(u.get(o)[1].type="lineEndingBlank"),s[1].type="lineEnding",o=r);o&&(n[1].end={...u.get(o)[1].start},i=u.slice(o,d),i.unshift(n),u.splice(o,d-o+1,i))}}return ao(t,0,Number.POSITIVE_INFINITY,u.slice(0)),!l}function gD(t,e){const n=t.get(e)[1],o=t.get(e)[2];let r=e-1;const s=[],i=n._tokenizer||o.parser[n.contentType](n.start),a=i.events,l=[],d={};let u,h,f=-1,m=n,_=0,g=0;const p=[g];for(;m;){for(;t.get(++r)[1]!==m;);s.push(r),m._tokenizer||(u=o.sliceStream(m),m.next||u.push(null),h&&i.defineSkip(m.start),m._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=!0),i.write(u),m._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=void 0)),h=m,m=m.next}for(m=n;++f<a.length;)a[f][0]==="exit"&&a[f-1][0]==="enter"&&a[f][1].type===a[f-1][1].type&&a[f][1].start.line!==a[f][1].end.line&&(g=f+1,p.push(g),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(i.events=[],m?(m._tokenizer=void 0,m.previous=void 0):p.pop(),f=p.length;f--;){const b=a.slice(p[f],p[f+1]),x=s.pop();l.push([x,x+b.length-1]),t.splice(x,2,b)}for(l.reverse(),f=-1;++f<l.length;)d[_+l[f][0]]=_+l[f][1],_+=l[f][1]-l[f][0]-1;return d}const _D={resolve:function(t){return Qw(t),t},tokenize:function(t,e){let n;return function(i){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),o(i)};function o(i){return i===null?r(i):Je(i)?t.check(bD,s,r)(i):(t.consume(i),o)}function r(i){return t.exit("chunkContent"),t.exit("content"),e(i)}function s(i){return t.consume(i),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}},bD={partial:!0,tokenize:function(t,e,n){const o=this;return function(s){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),_t(t,r,"linePrefix")};function r(s){if(s===null||Je(s))return n(s);const i=o.events[o.events.length-1];return!o.parser.constructs.disable.null.includes("codeIndented")&&i&&i[1].type==="linePrefix"&&i[2].sliceSerialize(i[1],!0).length>=4?e(s):t.interrupt(o.parser.constructs.flow,n,e)(s)}}};function ev(t,e,n,o,r,s,i,a,l){const d=l||Number.POSITIVE_INFINITY;let u=0;return function(p){return p===60?(t.enter(o),t.enter(r),t.enter(s),t.consume(p),t.exit(s),h):p===null||p===32||p===41||Nh(p)?n(p):(t.enter(o),t.enter(i),t.enter(a),t.enter("chunkString",{contentType:"string"}),_(p))};function h(p){return p===62?(t.enter(s),t.consume(p),t.exit(s),t.exit(r),t.exit(o),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===62?(t.exit("chunkString"),t.exit(a),h(p)):p===null||p===60||Je(p)?n(p):(t.consume(p),p===92?m:f)}function m(p){return p===60||p===62||p===92?(t.consume(p),f):f(p)}function _(p){return u||p!==null&&p!==41&&!pn(p)?u<d&&p===40?(t.consume(p),u++,_):p===41?(t.consume(p),u--,_):p===null||p===32||p===40||Nh(p)?n(p):(t.consume(p),p===92?g:_):(t.exit("chunkString"),t.exit(a),t.exit(i),t.exit(o),e(p))}function g(p){return p===40||p===41||p===92?(t.consume(p),_):_(p)}}function tv(t,e,n,o,r,s){const i=this;let a,l=0;return function(f){return t.enter(o),t.enter(r),t.consume(f),t.exit(r),t.enter(s),d};function d(f){return l>999||f===null||f===91||f===93&&!a||f===94&&!l&&"_hiddenFootnoteSupport"in i.parser.constructs?n(f):f===93?(t.exit(s),t.enter(r),t.consume(f),t.exit(r),t.exit(o),e):Je(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),d):(t.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===null||f===91||f===93||Je(f)||l++>999?(t.exit("chunkString"),d(f)):(t.consume(f),a||(a=!ut(f)),f===92?h:u)}function h(f){return f===91||f===92||f===93?(t.consume(f),l++,u):u(f)}}function nv(t,e,n,o,r,s){let i;return function(h){return h===34||h===39||h===40?(t.enter(o),t.enter(r),t.consume(h),t.exit(r),i=h===40?41:h,a):n(h)};function a(h){return h===i?(t.enter(r),t.consume(h),t.exit(r),t.exit(o),e):(t.enter(s),l(h))}function l(h){return h===i?(t.exit(s),a(i)):h===null?n(h):Je(h)?(t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),_t(t,l,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===i||h===null||Je(h)?(t.exit("chunkString"),l(h)):(t.consume(h),h===92?u:d)}function u(h){return h===i||h===92?(t.consume(h),d):d(h)}}function Ri(t,e){let n;return function o(r){return Je(r)?(t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),n=!0,o):ut(r)?_t(t,o,n?"linePrefix":"lineSuffix")(r):e(r)}}const xD={name:"definition",tokenize:function(t,e,n){const o=this;let r;return function(h){return t.enter("definition"),function(f){return tv.call(o,t,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}(h)};function s(h){return r=ps(o.sliceSerialize(o.events[o.events.length-1][1]).slice(1,-1)),h===58?(t.enter("definitionMarker"),t.consume(h),t.exit("definitionMarker"),i):n(h)}function i(h){return pn(h)?Ri(t,a)(h):a(h)}function a(h){return ev(t,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function l(h){return t.attempt(yD,d,d)(h)}function d(h){return ut(h)?_t(t,u,"whitespace")(h):u(h)}function u(h){return h===null||Je(h)?(t.exit("definition"),o.parser.defined.push(r),e(h)):n(h)}}},yD={partial:!0,tokenize:function(t,e,n){return function(i){return pn(i)?Ri(t,o)(i):n(i)};function o(i){return nv(t,r,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(i)}function r(i){return ut(i)?_t(t,s,"whitespace")(i):s(i)}function s(i){return i===null||Je(i)?e(i):n(i)}}},wD={name:"hardBreakEscape",tokenize:function(t,e,n){return function(r){return t.enter("hardBreakEscape"),t.consume(r),o};function o(r){return Je(r)?(t.exit("hardBreakEscape"),e(r)):n(r)}}},vD={name:"headingAtx",resolve:function(t,e){let n,o,r=t.length-2,s=3;return t[s][1].type==="whitespace"&&(s+=2),r-2>s&&t[r][1].type==="whitespace"&&(r-=2),t[r][1].type==="atxHeadingSequence"&&(s===r-1||r-4>s&&t[r-2][1].type==="whitespace")&&(r-=s+1===r?2:4),r>s&&(n={type:"atxHeadingText",start:t[s][1].start,end:t[r][1].end},o={type:"chunkText",start:t[s][1].start,end:t[r][1].end,contentType:"text"},ao(t,s,r-s+1,[["enter",n,e],["enter",o,e],["exit",o,e],["exit",n,e]])),t},tokenize:function(t,e,n){let o=0;return function(l){return t.enter("atxHeading"),function(d){return t.enter("atxHeadingSequence"),r(d)}(l)};function r(l){return l===35&&o++<6?(t.consume(l),r):l===null||pn(l)?(t.exit("atxHeadingSequence"),s(l)):n(l)}function s(l){return l===35?(t.enter("atxHeadingSequence"),i(l)):l===null||Je(l)?(t.exit("atxHeading"),e(l)):ut(l)?_t(t,s,"whitespace")(l):(t.enter("atxHeadingText"),a(l))}function i(l){return l===35?(t.consume(l),i):(t.exit("atxHeadingSequence"),s(l))}function a(l){return l===null||l===35||pn(l)?(t.exit("atxHeadingText"),s(l)):(t.consume(l),a)}}},kD=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],ov=["pre","script","style","textarea"],SD={concrete:!0,name:"htmlFlow",resolveTo:function(t){let e=t.length;for(;e--&&(t[e][0]!=="enter"||t[e][1].type!=="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t},tokenize:function(t,e,n){const o=this;let r,s,i,a,l;return function(I){return function(W){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(W),d}(I)};function d(I){return I===33?(t.consume(I),u):I===47?(t.consume(I),s=!0,m):I===63?(t.consume(I),r=3,o.interrupt?e:D):lo(I)?(t.consume(I),i=String.fromCharCode(I),_):n(I)}function u(I){return I===45?(t.consume(I),r=2,h):I===91?(t.consume(I),r=5,a=0,f):lo(I)?(t.consume(I),r=4,o.interrupt?e:D):n(I)}function h(I){return I===45?(t.consume(I),o.interrupt?e:D):n(I)}function f(I){return I==="CDATA[".charCodeAt(a++)?(t.consume(I),a===6?o.interrupt?e:T:f):n(I)}function m(I){return lo(I)?(t.consume(I),i=String.fromCharCode(I),_):n(I)}function _(I){if(I===null||I===47||I===62||pn(I)){const W=I===47,G=i.toLowerCase();return W||s||!ov.includes(G)?kD.includes(i.toLowerCase())?(r=6,W?(t.consume(I),g):o.interrupt?e(I):T(I)):(r=7,o.interrupt&&!o.parser.lazy[o.now().line]?n(I):s?p(I):b(I)):(r=1,o.interrupt?e(I):T(I))}return I===45||Cn(I)?(t.consume(I),i+=String.fromCharCode(I),_):n(I)}function g(I){return I===62?(t.consume(I),o.interrupt?e:T):n(I)}function p(I){return ut(I)?(t.consume(I),p):N(I)}function b(I){return I===47?(t.consume(I),N):I===58||I===95||lo(I)?(t.consume(I),x):ut(I)?(t.consume(I),b):N(I)}function x(I){return I===45||I===46||I===58||I===95||Cn(I)?(t.consume(I),x):y(I)}function y(I){return I===61?(t.consume(I),v):ut(I)?(t.consume(I),y):b(I)}function v(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(t.consume(I),l=I,C):ut(I)?(t.consume(I),v):S(I)}function C(I){return I===l?(t.consume(I),l=null,E):I===null||Je(I)?n(I):(t.consume(I),C)}function S(I){return I===null||I===34||I===39||I===47||I===60||I===61||I===62||I===96||pn(I)?y(I):(t.consume(I),S)}function E(I){return I===47||I===62||ut(I)?b(I):n(I)}function N(I){return I===62?(t.consume(I),j):n(I)}function j(I){return I===null||Je(I)?T(I):ut(I)?(t.consume(I),j):n(I)}function T(I){return I===45&&r===2?(t.consume(I),R):I===60&&r===1?(t.consume(I),L):I===62&&r===4?(t.consume(I),k):I===63&&r===3?(t.consume(I),D):I===93&&r===5?(t.consume(I),U):!Je(I)||r!==6&&r!==7?I===null||Je(I)?(t.exit("htmlFlowData"),A(I)):(t.consume(I),T):(t.exit("htmlFlowData"),t.check(CD,$,A)(I))}function A(I){return t.check(ND,M,$)(I)}function M(I){return t.enter("lineEnding"),t.consume(I),t.exit("lineEnding"),P}function P(I){return I===null||Je(I)?A(I):(t.enter("htmlFlowData"),T(I))}function R(I){return I===45?(t.consume(I),D):T(I)}function L(I){return I===47?(t.consume(I),i="",B):T(I)}function B(I){if(I===62){const W=i.toLowerCase();return ov.includes(W)?(t.consume(I),k):T(I)}return lo(I)&&i.length<8?(t.consume(I),i+=String.fromCharCode(I),B):T(I)}function U(I){return I===93?(t.consume(I),D):T(I)}function D(I){return I===62?(t.consume(I),k):I===45&&r===2?(t.consume(I),D):T(I)}function k(I){return I===null||Je(I)?(t.exit("htmlFlowData"),$(I)):(t.consume(I),k)}function $(I){return t.exit("htmlFlow"),e(I)}}},CD={partial:!0,tokenize:function(t,e,n){return function(o){return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),t.attempt(Pl,e,n)}}},ND={partial:!0,tokenize:function(t,e,n){const o=this;return function(s){return Je(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),r):n(s)};function r(s){return o.parser.lazy[o.now().line]?n(s):e(s)}}},jD={name:"htmlText",tokenize:function(t,e,n){const o=this;let r,s,i;return function(k){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(k),a};function a(k){return k===33?(t.consume(k),l):k===47?(t.consume(k),v):k===63?(t.consume(k),x):lo(k)?(t.consume(k),E):n(k)}function l(k){return k===45?(t.consume(k),d):k===91?(t.consume(k),s=0,m):lo(k)?(t.consume(k),b):n(k)}function d(k){return k===45?(t.consume(k),f):n(k)}function u(k){return k===null?n(k):k===45?(t.consume(k),h):Je(k)?(i=u,B(k)):(t.consume(k),u)}function h(k){return k===45?(t.consume(k),f):u(k)}function f(k){return k===62?L(k):k===45?h(k):u(k)}function m(k){return k==="CDATA[".charCodeAt(s++)?(t.consume(k),s===6?_:m):n(k)}function _(k){return k===null?n(k):k===93?(t.consume(k),g):Je(k)?(i=_,B(k)):(t.consume(k),_)}function g(k){return k===93?(t.consume(k),p):_(k)}function p(k){return k===62?L(k):k===93?(t.consume(k),p):_(k)}function b(k){return k===null||k===62?L(k):Je(k)?(i=b,B(k)):(t.consume(k),b)}function x(k){return k===null?n(k):k===63?(t.consume(k),y):Je(k)?(i=x,B(k)):(t.consume(k),x)}function y(k){return k===62?L(k):x(k)}function v(k){return lo(k)?(t.consume(k),C):n(k)}function C(k){return k===45||Cn(k)?(t.consume(k),C):S(k)}function S(k){return Je(k)?(i=S,B(k)):ut(k)?(t.consume(k),S):L(k)}function E(k){return k===45||Cn(k)?(t.consume(k),E):k===47||k===62||pn(k)?N(k):n(k)}function N(k){return k===47?(t.consume(k),L):k===58||k===95||lo(k)?(t.consume(k),j):Je(k)?(i=N,B(k)):ut(k)?(t.consume(k),N):L(k)}function j(k){return k===45||k===46||k===58||k===95||Cn(k)?(t.consume(k),j):T(k)}function T(k){return k===61?(t.consume(k),A):Je(k)?(i=T,B(k)):ut(k)?(t.consume(k),T):N(k)}function A(k){return k===null||k===60||k===61||k===62||k===96?n(k):k===34||k===39?(t.consume(k),r=k,M):Je(k)?(i=A,B(k)):ut(k)?(t.consume(k),A):(t.consume(k),P)}function M(k){return k===r?(t.consume(k),r=void 0,R):k===null?n(k):Je(k)?(i=M,B(k)):(t.consume(k),M)}function P(k){return k===null||k===34||k===39||k===60||k===61||k===96?n(k):k===47||k===62||pn(k)?N(k):(t.consume(k),P)}function R(k){return k===47||k===62||pn(k)?N(k):n(k)}function L(k){return k===62?(t.consume(k),t.exit("htmlTextData"),t.exit("htmlText"),e):n(k)}function B(k){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(k),t.exit("lineEnding"),U}function U(k){return ut(k)?_t(t,D,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(k):D(k)}function D(k){return t.enter("htmlTextData"),i(k)}}},Th={name:"labelEnd",resolveAll:function(t){let e=-1;const n=[];for(;++e<t.length;){const o=t[e][1];if(n.push(t[e]),o.type==="labelImage"||o.type==="labelLink"||o.type==="labelEnd"){const r=o.type==="labelImage"?4:2;o.type="data",e+=r}}return t.length!==n.length&&ao(t,0,t.length,n),t},resolveTo:function(t,e){let n,o,r,s,i=t.length,a=0;for(;i--;)if(n=t[i][1],o){if(n.type==="link"||n.type==="labelLink"&&n._inactive)break;t[i][0]==="enter"&&n.type==="labelLink"&&(n._inactive=!0)}else if(r){if(t[i][0]==="enter"&&(n.type==="labelImage"||n.type==="labelLink")&&!n._balanced&&(o=i,n.type!=="labelLink")){a=2;break}}else n.type==="labelEnd"&&(r=i);const l={type:t[o][1].type==="labelLink"?"link":"image",start:{...t[o][1].start},end:{...t[t.length-1][1].end}},d={type:"label",start:{...t[o][1].start},end:{...t[r][1].end}},u={type:"labelText",start:{...t[o+a+2][1].end},end:{...t[r-2][1].start}};return s=[["enter",l,e],["enter",d,e]],s=zn(s,t.slice(o+1,o+a+3)),s=zn(s,[["enter",u,e]]),s=zn(s,Eh(e.parser.constructs.insideSpan.null,t.slice(o+a+4,r-3),e)),s=zn(s,[["exit",u,e],t[r-2],t[r-1],["exit",d,e]]),s=zn(s,t.slice(r+1)),s=zn(s,[["exit",l,e]]),ao(t,o,t.length,s),t},tokenize:function(t,e,n){const o=this;let r,s,i=o.events.length;for(;i--;)if((o.events[i][1].type==="labelImage"||o.events[i][1].type==="labelLink")&&!o.events[i][1]._balanced){r=o.events[i][1];break}return function(h){return r?r._inactive?u(h):(s=o.parser.defined.includes(ps(o.sliceSerialize({start:r.end,end:o.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(h),t.exit("labelMarker"),t.exit("labelEnd"),a):n(h)};function a(h){return h===40?t.attempt(ED,d,s?d:u)(h):h===91?t.attempt(ID,d,s?l:u)(h):s?d(h):u(h)}function l(h){return t.attempt(AD,d,u)(h)}function d(h){return e(h)}function u(h){return r._balanced=!0,n(h)}}},ED={tokenize:function(t,e,n){return function(u){return t.enter("resource"),t.enter("resourceMarker"),t.consume(u),t.exit("resourceMarker"),o};function o(u){return pn(u)?Ri(t,r)(u):r(u)}function r(u){return u===41?d(u):ev(t,s,i,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(u)}function s(u){return pn(u)?Ri(t,a)(u):d(u)}function i(u){return n(u)}function a(u){return u===34||u===39||u===40?nv(t,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(u):d(u)}function l(u){return pn(u)?Ri(t,d)(u):d(u)}function d(u){return u===41?(t.enter("resourceMarker"),t.consume(u),t.exit("resourceMarker"),t.exit("resource"),e):n(u)}}},ID={tokenize:function(t,e,n){const o=this;return function(i){return tv.call(o,t,r,s,"reference","referenceMarker","referenceString")(i)};function r(i){return o.parser.defined.includes(ps(o.sliceSerialize(o.events[o.events.length-1][1]).slice(1,-1)))?e(i):n(i)}function s(i){return n(i)}}},AD={tokenize:function(t,e,n){return function(r){return t.enter("reference"),t.enter("referenceMarker"),t.consume(r),t.exit("referenceMarker"),o};function o(r){return r===93?(t.enter("referenceMarker"),t.consume(r),t.exit("referenceMarker"),t.exit("reference"),e):n(r)}}},TD={name:"labelStartImage",resolveAll:Th.resolveAll,tokenize:function(t,e,n){const o=this;return function(i){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(i),t.exit("labelImageMarker"),r};function r(i){return i===91?(t.enter("labelMarker"),t.consume(i),t.exit("labelMarker"),t.exit("labelImage"),s):n(i)}function s(i){return i===94&&"_hiddenFootnoteSupport"in o.parser.constructs?n(i):e(i)}}},MD={name:"labelStartLink",resolveAll:Th.resolveAll,tokenize:function(t,e,n){const o=this;return function(s){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(s),t.exit("labelMarker"),t.exit("labelLink"),r};function r(s){return s===94&&"_hiddenFootnoteSupport"in o.parser.constructs?n(s):e(s)}}},Mh={name:"lineEnding",tokenize:function(t,e){return function(n){return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),_t(t,e,"linePrefix")}}},Ll={name:"thematicBreak",tokenize:function(t,e,n){let o,r=0;return function(a){return t.enter("thematicBreak"),function(l){return o=l,s(l)}(a)};function s(a){return a===o?(t.enter("thematicBreakSequence"),i(a)):r>=3&&(a===null||Je(a))?(t.exit("thematicBreak"),e(a)):n(a)}function i(a){return a===o?(t.consume(a),r++,i):(t.exit("thematicBreakSequence"),ut(a)?_t(t,s,"whitespace")(a):s(a))}}},gn={continuation:{tokenize:function(t,e,n){const o=this;return o.containerState._closeFlow=void 0,t.check(Pl,r,s);function r(a){return o.containerState.furtherBlankLines=o.containerState.furtherBlankLines||o.containerState.initialBlankLine,_t(t,e,"listItemIndent",o.containerState.size+1)(a)}function s(a){return o.containerState.furtherBlankLines||!ut(a)?(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,i(a)):(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,t.attempt(DD,e,i)(a))}function i(a){return o.containerState._closeFlow=!0,o.interrupt=void 0,_t(t,t.attempt(gn,e,n),"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}},exit:function(t){t.exit(this.containerState.type)},name:"list",tokenize:function(t,e,n){const o=this,r=o.events[o.events.length-1];let s=r&&r[1].type==="linePrefix"?r[2].sliceSerialize(r[1],!0).length:0,i=0;return function(f){const m=o.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!o.containerState.marker||f===o.containerState.marker:jh(f)){if(o.containerState.type||(o.containerState.type=m,t.enter(m,{_container:!0})),m==="listUnordered")return t.enter("listItemPrefix"),f===42||f===45?t.check(Ll,n,l)(f):l(f);if(!o.interrupt||f===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),a(f)}return n(f)};function a(f){return jh(f)&&++i<10?(t.consume(f),a):(!o.interrupt||i<2)&&(o.containerState.marker?f===o.containerState.marker:f===41||f===46)?(t.exit("listItemValue"),l(f)):n(f)}function l(f){return t.enter("listItemMarker"),t.consume(f),t.exit("listItemMarker"),o.containerState.marker=o.containerState.marker||f,t.check(Pl,o.interrupt?n:d,t.attempt(OD,h,u))}function d(f){return o.containerState.initialBlankLine=!0,s++,h(f)}function u(f){return ut(f)?(t.enter("listItemPrefixWhitespace"),t.consume(f),t.exit("listItemPrefixWhitespace"),h):n(f)}function h(f){return o.containerState.size=s+o.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(f)}}},OD={partial:!0,tokenize:function(t,e,n){const o=this;return _t(t,function(r){const s=o.events[o.events.length-1];return!ut(r)&&s&&s[1].type==="listItemPrefixWhitespace"?e(r):n(r)},"listItemPrefixWhitespace",o.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},DD={partial:!0,tokenize:function(t,e,n){const o=this;return _t(t,function(r){const s=o.events[o.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===o.containerState.size?e(r):n(r)},"listItemIndent",o.containerState.size+1)}},rv={name:"setextUnderline",resolveTo:function(t,e){let n,o,r,s=t.length;for(;s--;)if(t[s][0]==="enter"){if(t[s][1].type==="content"){n=s;break}t[s][1].type==="paragraph"&&(o=s)}else t[s][1].type==="content"&&t.splice(s,1),r||t[s][1].type!=="definition"||(r=s);const i={type:"setextHeading",start:{...t[o][1].start},end:{...t[t.length-1][1].end}};return t[o][1].type="setextHeadingText",r?(t.splice(o,0,["enter",i,e]),t.splice(r+1,0,["exit",t[n][1],e]),t[n][1].end={...t[r][1].end}):t[n][1]=i,t.push(["exit",i,e]),t},tokenize:function(t,e,n){const o=this;let r;return function(a){let l,d=o.events.length;for(;d--;)if(o.events[d][1].type!=="lineEnding"&&o.events[d][1].type!=="linePrefix"&&o.events[d][1].type!=="content"){l=o.events[d][1].type==="paragraph";break}return!o.parser.lazy[o.now().line]&&(o.interrupt||l)?(t.enter("setextHeadingLine"),r=a,function(u){return t.enter("setextHeadingLineSequence"),s(u)}(a)):n(a)};function s(a){return a===r?(t.consume(a),s):(t.exit("setextHeadingLineSequence"),ut(a)?_t(t,i,"lineSuffix")(a):i(a))}function i(a){return a===null||Je(a)?(t.exit("setextHeadingLine"),e(a)):n(a)}}},RD={tokenize:function(t){const e=this,n=t.attempt(Pl,function(r){return r===null?void t.consume(r):(t.enter("lineEndingBlank"),t.consume(r),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n)},t.attempt(this.parser.constructs.flowInitial,o,_t(t,t.attempt(this.parser.constructs.flow,o,t.attempt(_D,o)),"linePrefix")));return n;function o(r){if(r!==null)return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),e.currentConstruct=void 0,n;t.consume(r)}}},PD={resolveAll:iv()},LD=sv("string"),FD=sv("text");function sv(t){return{resolveAll:iv(t==="text"?zD:void 0),tokenize:function(e){const n=this,o=this.parser.constructs[t],r=e.attempt(o,s,i);return s;function s(d){return l(d)?r(d):i(d)}function i(d){if(d!==null)return e.enter("data"),e.consume(d),a;e.consume(d)}function a(d){return l(d)?(e.exit("data"),r(d)):(e.consume(d),a)}function l(d){if(d===null)return!0;const u=o[d];let h=-1;if(u)for(;++h<u.length;){const f=u[h];if(!f.previous||f.previous.call(n,n.previous))return!0}return!1}}}}function iv(t){return function(e,n){let o,r=-1;for(;++r<=e.length;)o===void 0?e[r]&&e[r][1].type==="data"&&(o=r,r++):e[r]&&e[r][1].type==="data"||(r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),r=o+2),o=void 0);return t?t(e,n):e}}function zD(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const o=t[n-1][1],r=e.sliceStream(o);let s,i=r.length,a=-1,l=0;for(;i--;){const d=r[i];if(typeof d=="string"){for(a=d.length;d.charCodeAt(a-1)===32;)l++,a--;if(a)break;a=-1}else if(d===-2)s=!0,l++;else if(d!==-1){i++;break}}if(l){const d={type:n===t.length||s||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?a:o.start._bufferIndex+a,_index:o.start._index+i,line:o.end.line,column:o.end.column-l,offset:o.end.offset-l},end:{...o.end}};o.end={...d.start},o.start.offset===o.end.offset?Object.assign(o,d):(t.splice(n,0,["enter",d,e],["exit",d,e]),n+=2)}n++}return t}const BD={42:gn,43:gn,45:gn,48:gn,49:gn,50:gn,51:gn,52:gn,53:gn,54:gn,55:gn,56:gn,57:gn,62:Yw},UD={91:xD},VD={[-2]:Ah,[-1]:Ah,32:Ah},$D={35:vD,42:Ll,45:[rv,Ll],60:SD,61:rv,95:Ll,96:Zw,126:Zw},HD={38:Kw,92:Jw},WD={[-5]:Mh,[-4]:Mh,[-3]:Mh,33:TD,38:Kw,42:Ih,60:[hD,jD],91:MD,92:[wD,Jw],93:Th,95:Ih,96:mD},qD={null:[Ih,PD]},GD=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:{null:[42,95]},contentInitial:UD,disable:{null:[]},document:BD,flow:$D,flowInitial:VD,insideSpan:qD,string:HD,text:WD},Symbol.toStringTag,{value:"Module"}));function YD(t,e,n){let o={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const r={},s=[];let i=[],a=[];const l={attempt:p(function(y,v){b(y,v.from)}),check:p(g),consume:function(y){Je(y)?(o.line++,o.column=1,o.offset+=y===-3?2:1,x()):y!==-1&&(o.column++,o.offset++),o._bufferIndex<0?o._index++:(o._bufferIndex++,o._bufferIndex===i[o._index].length&&(o._bufferIndex=-1,o._index++)),d.previous=y},enter:function(y,v){const C=v||{};return C.type=y,C.start=f(),d.events.push(["enter",C,d]),a.push(C),C},exit:function(y){const v=a.pop();return v.end=f(),d.events.push(["exit",v,d]),v},interrupt:p(g,{interrupt:!0})},d={code:null,containerState:{},defineSkip:function(y){r[y.line]=y.column,x()},events:[],now:f,parser:t,previous:null,sliceSerialize:function(y,v){return function(C,S){let E=-1;const N=[];let j;for(;++E<C.length;){const T=C[E];let A;if(typeof T=="string")A=T;else switch(T){case-5:A="\r";break;case-4:A=`
130
130
  `;break;case-3:A=`\r
131
131
  `;break;case-2:A=S?" ":" ";break;case-1:if(!S&&j)continue;A=" ";break;default:A=String.fromCharCode(T)}j=T===-2,N.push(A)}return N.join("")}(h(y),v)},sliceStream:h,write:function(y){return i=zn(i,y),m(),i[i.length-1]!==null?[]:(b(e,0),d.events=Eh(s,d.events,d),d.events)}};let u=e.tokenize.call(d,l);return e.resolveAll&&s.push(e),d;function h(y){return function(v,C){const S=C.start._index,E=C.start._bufferIndex,N=C.end._index,j=C.end._bufferIndex;let T;if(S===N)T=[v[S].slice(E,j)];else{if(T=v.slice(S,N),E>-1){const A=T[0];typeof A=="string"?T[0]=A.slice(E):T.shift()}j>0&&T.push(v[N].slice(0,j))}return T}(i,y)}function f(){const{_bufferIndex:y,_index:v,line:C,column:S,offset:E}=o;return{_bufferIndex:y,_index:v,line:C,column:S,offset:E}}function m(){let y;for(;o._index<i.length;){const v=i[o._index];if(typeof v=="string")for(y=o._index,o._bufferIndex<0&&(o._bufferIndex=0);o._index===y&&o._bufferIndex<v.length;)_(v.charCodeAt(o._bufferIndex));else _(v)}}function _(y){u=u(y)}function g(y,v){v.restore()}function p(y,v){return function(C,S,E){let N,j,T,A;return Array.isArray(C)?M(C):"tokenize"in C?M([C]):function(B){return U;function U(D){const k=D!==null&&B[D],$=D!==null&&B.null;return M([...Array.isArray(k)?k:k?[k]:[],...Array.isArray($)?$:$?[$]:[]])(D)}}(C);function M(B){return N=B,j=0,B.length===0?E:P(B[j])}function P(B){return function(U){return A=function(){const D=f(),k=d.previous,$=d.currentConstruct,I=d.events.length,W=Array.from(a);return{from:I,restore:G};function G(){o=D,d.previous=k,d.currentConstruct=$,d.events.length=I,a=W,x()}}(),T=B,B.partial||(d.currentConstruct=B),B.name&&d.parser.constructs.disable.null.includes(B.name)?L():B.tokenize.call(v?Object.assign(Object.create(d),v):d,l,R,L)(U)}}function R(B){return y(T,A),S}function L(B){return A.restore(),++j<N.length?P(N[j]):E}}}function b(y,v){y.resolveAll&&!s.includes(y)&&s.push(y),y.resolve&&ao(d.events,v,d.events.length-v,y.resolve(d.events.slice(v),d)),y.resolveTo&&(d.events=y.resolveTo(d.events,d))}function x(){o.line in r&&o.column<2&&(o.column=r[o.line],o.offset+=r[o.line]-1)}}function JD(t){const e=function(r){const s={};let i=-1;for(;++i<r.length;)oD(s,r[i]);return s}([GD,...(t||{}).extensions||[]]),n={constructs:e,content:o(dD),defined:[],document:o(uD),flow:o(RD),lazy:{},string:o(LD),text:o(FD)};return n;function o(r){return function(s){return YD(n,r,s)}}}const av=/[\0\t\n\r]/g,KD=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function XD(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),r=o===120||o===88;return Hw(n.slice(r?2:1),r?16:10)}return Ch(n)||t}const lv={}.hasOwnProperty;function ZD(t,e,n){return typeof e!="string"&&(n=e,e=void 0),function(o){const r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(ze),autolinkProtocol:M,autolinkEmail:M,atxHeading:l(ae),blockQuote:l(de),characterEscape:M,characterReference:M,codeFenced:l(ue),codeFencedFenceInfo:d,codeFencedFenceMeta:d,codeIndented:l(ue,d),codeText:l(ce,d),codeTextData:M,data:M,codeFlowValue:M,definition:l(ke),definitionDestinationString:d,definitionLabelString:d,definitionTitleString:d,emphasis:l(Se),hardBreakEscape:l(Ce),hardBreakTrailing:l(Ce),htmlFlow:l(_e,d),htmlFlowData:M,htmlText:l(_e,d),htmlTextData:M,image:l(Ee),label:d,link:l(ze),listItem:l(He),listItemValue:g,listOrdered:l(Oe,_),listUnordered:l(Oe),paragraph:l(Fe),reference:ee,referenceString:d,resourceDestinationString:d,resourceTitleString:d,setextHeading:l(ae),strong:l(it),thematicBreak:l(tt)},exit:{atxHeading:h(),atxHeadingSequence:N,autolink:h(),autolinkEmail:fe,autolinkProtocol:me,blockQuote:h(),characterEscapeValue:P,characterReferenceMarkerHexadecimal:ie,characterReferenceMarkerNumeric:ie,characterReferenceValue:Z,characterReference:Q,codeFenced:h(y),codeFencedFence:x,codeFencedFenceInfo:p,codeFencedFenceMeta:b,codeFlowValue:P,codeIndented:h(v),codeText:h(D),codeTextData:P,data:P,definition:h(),definitionDestinationString:E,definitionLabelString:C,definitionTitleString:S,emphasis:h(),hardBreakEscape:h(L),hardBreakTrailing:h(L),htmlFlow:h(B),htmlFlowData:P,htmlText:h(U),htmlTextData:P,image:h($),label:W,labelText:I,lineEnding:R,link:h(k),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:oe,resourceDestinationString:G,resourceTitleString:q,resource:Y,setextHeading:h(A),setextHeadingLineSequence:T,setextHeadingText:j,strong:h(),thematicBreak:h()}};cv(r,(o||{}).mdastExtensions||[]);const s={};return i;function i(ne){let ve={type:"root",children:[]};const je={stack:[ve],tokenStack:[],config:r,enter:u,exit:f,buffer:d,resume:m,data:s},Re=[];let J=-1;for(;++J<ne.length;)(ne[J][1].type==="listOrdered"||ne[J][1].type==="listUnordered")&&(ne[J][0]==="enter"?Re.push(J):J=a(ne,Re.pop(),J));for(J=-1;++J<ne.length;){const se=r[ne[J][0]];lv.call(se,ne[J][1].type)&&se[ne[J][1].type].call(Object.assign({sliceSerialize:ne[J][2].sliceSerialize},je),ne[J][1])}if(je.tokenStack.length>0){const se=je.tokenStack[je.tokenStack.length-1];(se[1]||dv).call(je,void 0,se[0])}for(ve.position={start:Zo(ne.length>0?ne[0][1].start:{line:1,column:1,offset:0}),end:Zo(ne.length>0?ne[ne.length-2][1].end:{line:1,column:1,offset:0})},J=-1;++J<r.transforms.length;)ve=r.transforms[J](ve)||ve;return ve}function a(ne,ve,je){let Re,J,se,ge,pe=ve-1,xe=-1,Ve=!1;for(;++pe<=je;){const Be=ne[pe];switch(Be[1].type){case"listUnordered":case"listOrdered":case"blockQuote":Be[0]==="enter"?xe++:xe--,ge=void 0;break;case"lineEndingBlank":Be[0]==="enter"&&(!Re||ge||xe||se||(se=pe),ge=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ge=void 0}if(!xe&&Be[0]==="enter"&&Be[1].type==="listItemPrefix"||xe===-1&&Be[0]==="exit"&&(Be[1].type==="listUnordered"||Be[1].type==="listOrdered")){if(Re){let rt=pe;for(J=void 0;rt--;){const le=ne[rt];if(le[1].type==="lineEnding"||le[1].type==="lineEndingBlank"){if(le[0]==="exit")continue;J&&(ne[J][1].type="lineEndingBlank",Ve=!0),le[1].type="lineEnding",J=rt}else if(le[1].type!=="linePrefix"&&le[1].type!=="blockQuotePrefix"&&le[1].type!=="blockQuotePrefixWhitespace"&&le[1].type!=="blockQuoteMarker"&&le[1].type!=="listItemIndent")break}se&&(!J||se<J)&&(Re._spread=!0),Re.end=Object.assign({},J?ne[J][1].start:Be[1].end),ne.splice(J||pe,0,["exit",Re,Be[2]]),pe++,je++}if(Be[1].type==="listItemPrefix"){const rt={type:"listItem",_spread:!1,start:Object.assign({},Be[1].start),end:void 0};Re=rt,ne.splice(pe,0,["enter",rt,Be[2]]),pe++,je++,se=void 0,ge=!0}}}return ne[ve][1]._spread=Ve,je}function l(ne,ve){return je;function je(Re){u.call(this,ne(Re),Re),ve&&ve.call(this,Re)}}function d(){this.stack.push({type:"fragment",children:[]})}function u(ne,ve,je){this.stack[this.stack.length-1].children.push(ne),this.stack.push(ne),this.tokenStack.push([ve,je||void 0]),ne.position={start:Zo(ve.start),end:void 0}}function h(ne){return ve;function ve(je){ne&&ne.call(this,je),f.call(this,je)}}function f(ne,ve){const je=this.stack.pop(),Re=this.tokenStack.pop();if(!Re)throw new Error("Cannot close `"+ne.type+"` ("+Mi({start:ne.start,end:ne.end})+"): it\u2019s not open");Re[0].type!==ne.type&&(ve?ve.call(this,ne,Re[0]):(Re[1]||dv).call(this,ne,Re[0])),je.position.end=Zo(ne.end)}function m(){return function(ne){return Bw(ne,typeof Rl.includeImageAlt!="boolean"||Rl.includeImageAlt,typeof Rl.includeHtml!="boolean"||Rl.includeHtml)}(this.stack.pop())}function _(){this.data.expectingFirstListItemValue=!0}function g(ne){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(ne),10),this.data.expectingFirstListItemValue=void 0)}function p(){const ne=this.resume();this.stack[this.stack.length-1].lang=ne}function b(){const ne=this.resume();this.stack[this.stack.length-1].meta=ne}function x(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){const ne=this.resume();this.stack[this.stack.length-1].value=ne.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const ne=this.resume();this.stack[this.stack.length-1].value=ne.replace(/(\r?\n|\r)$/g,"")}function C(ne){const ve=this.resume(),je=this.stack[this.stack.length-1];je.label=ve,je.identifier=ps(this.sliceSerialize(ne)).toLowerCase()}function S(){const ne=this.resume();this.stack[this.stack.length-1].title=ne}function E(){const ne=this.resume();this.stack[this.stack.length-1].url=ne}function N(ne){const ve=this.stack[this.stack.length-1];if(!ve.depth){const je=this.sliceSerialize(ne).length;ve.depth=je}}function j(){this.data.setextHeadingSlurpLineEnding=!0}function T(ne){this.stack[this.stack.length-1].depth=this.sliceSerialize(ne).codePointAt(0)===61?1:2}function A(){this.data.setextHeadingSlurpLineEnding=void 0}function M(ne){const ve=this.stack[this.stack.length-1].children;let je=ve[ve.length-1];je&&je.type==="text"||(je=Qe(),je.position={start:Zo(ne.start),end:void 0},ve.push(je)),this.stack.push(je)}function P(ne){const ve=this.stack.pop();ve.value+=this.sliceSerialize(ne),ve.position.end=Zo(ne.end)}function R(ne){const ve=this.stack[this.stack.length-1];if(this.data.atHardBreak)return ve.children[ve.children.length-1].position.end=Zo(ne.end),void(this.data.atHardBreak=void 0);!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(ve.type)&&(M.call(this,ne),P.call(this,ne))}function L(){this.data.atHardBreak=!0}function B(){const ne=this.resume();this.stack[this.stack.length-1].value=ne}function U(){const ne=this.resume();this.stack[this.stack.length-1].value=ne}function D(){const ne=this.resume();this.stack[this.stack.length-1].value=ne}function k(){const ne=this.stack[this.stack.length-1];if(this.data.inReference){const ve=this.data.referenceType||"shortcut";ne.type+="Reference",ne.referenceType=ve,delete ne.url,delete ne.title}else delete ne.identifier,delete ne.label;this.data.referenceType=void 0}function $(){const ne=this.stack[this.stack.length-1];if(this.data.inReference){const ve=this.data.referenceType||"shortcut";ne.type+="Reference",ne.referenceType=ve,delete ne.url,delete ne.title}else delete ne.identifier,delete ne.label;this.data.referenceType=void 0}function I(ne){const ve=this.sliceSerialize(ne),je=this.stack[this.stack.length-2];je.label=function(Re){return Re.replace(KD,XD)}(ve),je.identifier=ps(ve).toLowerCase()}function W(){const ne=this.stack[this.stack.length-1],ve=this.resume(),je=this.stack[this.stack.length-1];if(this.data.inReference=!0,je.type==="link"){const Re=ne.children;je.children=Re}else je.alt=ve}function G(){const ne=this.resume();this.stack[this.stack.length-1].url=ne}function q(){const ne=this.resume();this.stack[this.stack.length-1].title=ne}function Y(){this.data.inReference=void 0}function ee(){this.data.referenceType="collapsed"}function oe(ne){const ve=this.resume(),je=this.stack[this.stack.length-1];je.label=ve,je.identifier=ps(this.sliceSerialize(ne)).toLowerCase(),this.data.referenceType="full"}function ie(ne){this.data.characterReferenceType=ne.type}function Z(ne){const ve=this.sliceSerialize(ne),je=this.data.characterReferenceType;let Re;je?(Re=Hw(ve,je==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Re=Ch(ve),this.stack[this.stack.length-1].value+=Re}function Q(ne){this.stack.pop().position.end=Zo(ne.end)}function me(ne){P.call(this,ne),this.stack[this.stack.length-1].url=this.sliceSerialize(ne)}function fe(ne){P.call(this,ne),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(ne)}function de(){return{type:"blockquote",children:[]}}function ue(){return{type:"code",lang:null,meta:null,value:""}}function ce(){return{type:"inlineCode",value:""}}function ke(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Se(){return{type:"emphasis",children:[]}}function ae(){return{type:"heading",depth:0,children:[]}}function Ce(){return{type:"break"}}function _e(){return{type:"html",value:""}}function Ee(){return{type:"image",title:null,url:"",alt:null}}function ze(){return{type:"link",title:null,url:"",children:[]}}function Oe(ne){return{type:"list",ordered:ne.type==="listOrdered",start:null,spread:ne._spread,children:[]}}function He(ne){return{type:"listItem",spread:ne._spread,checked:null,children:[]}}function Fe(){return{type:"paragraph",children:[]}}function it(){return{type:"strong",children:[]}}function Qe(){return{type:"text",value:""}}function tt(){return{type:"thematicBreak"}}}(n)(function(o){for(;!Qw(o););return o}(JD(n).document().write(function(){let o,r=1,s="",i=!0;return function(a,l,d){const u=[];let h,f,m,_,g;for(a=s+(typeof a=="string"?a.toString():new TextDecoder(l||void 0).decode(a)),m=0,s="",i&&(a.charCodeAt(0)===65279&&m++,i=void 0);m<a.length;){if(av.lastIndex=m,h=av.exec(a),_=h&&h.index!==void 0?h.index:a.length,g=a.charCodeAt(_),!h){s=a.slice(m);break}if(g===10&&m===_&&o)u.push(-3),o=void 0;else switch(o&&(u.push(-5),o=void 0),m<_&&(u.push(a.slice(m,_)),r+=_-m),g){case 0:u.push(65533),r++;break;case 9:for(f=4*Math.ceil(r/4),u.push(-2);r++<f;)u.push(-1);break;case 10:u.push(-4),r=1;break;default:o=!0,r=1}m=_+1}return d&&(o&&u.push(-5),s&&u.push(s),u.push(null)),u}}()(t,e,!0))))}function Zo(t){return{line:t.line,column:t.column,offset:t.offset}}function cv(t,e){let n=-1;for(;++n<e.length;){const o=e[n];Array.isArray(o)?cv(t,o):QD(t,o)}}function QD(t,e){let n;for(n in e)if(lv.call(e,n))switch(n){case"canContainEols":{const o=e[n];o&&t[n].push(...o);break}case"transforms":{const o=e[n];o&&t[n].push(...o);break}case"enter":case"exit":{const o=e[n];o&&Object.assign(t[n],o);break}}}function dv(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+Mi({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+Mi({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+Mi({start:e.start,end:e.end})+") is still open")}function eR(t){const e=this;e.parser=function(n){return ZD(n,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function uv(t,e){const n=e.referenceType;let o="]";if(n==="collapsed"?o+="[]":n==="full"&&(o+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+o}];const r=t.all(e),s=r[0];s&&s.type==="text"?s.value="["+s.value:r.unshift({type:"text",value:"["});const i=r[r.length-1];return i&&i.type==="text"?i.value+=o:r.push({type:"text",value:o}),r}function hv(t){const e=t.spread;return e??t.children.length>1}function tR(t){const e=String(t),n=/\r?\n|\r/g;let o=n.exec(e),r=0;const s=[];for(;o;)s.push(fv(e.slice(r,o.index),r>0,!0),o[0]),r=o.index+o[0].length,o=n.exec(e);return s.push(fv(e.slice(r),r>0,!1)),s.join("")}function fv(t,e,n){let o=0,r=t.length;if(e){let s=t.codePointAt(o);for(;s===9||s===32;)o++,s=t.codePointAt(o)}if(n){let s=t.codePointAt(r-1);for(;s===9||s===32;)r--,s=t.codePointAt(r-1)}return r>o?t.slice(o,r):""}const nR={blockquote:function(t,e){const n={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,n),t.applyData(e,n)},break:function(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
@@ -145,4 +145,4 @@ ${T}
145
145
  `)}),includeOtherCode:Lc("")}),onFinish:T=>{e(A=>fh(A,A.activeChatId,T.id,"assistant",T.content,T.parts))},onToolCall:async({toolCall:T})=>{try{const A=await U$({toolName:T.toolName,arguments:T.args});return A.result||A.error}catch(A){return vt.error("Tool call failed:",A),`Error: ${A instanceof Error?A.message:String(A)}`}},onError:T=>{vt.error("An error occurred:",T)},onResponse:T=>{vt.debug("Received HTTP response from server:",T)}}),S=y==="submitted"||y==="streaming";O.useEffect(()=>{if(!t.activeChatId||f.length===0)return;const T=f[f.length-1];if((T==null?void 0:T.role)!=="user")return;const A=t.chats.find(R=>R.id===t.activeChatId);if(!A)return;const M=new Set(A.messages.map(R=>R.id)),P=f.filter(R=>R.role==="user"&&!M.has(R.id));P.length>0&&e(R=>{let L=R;for(const B of P)L=fh(L,R.activeChatId,B.id,"user",B.content);return L})},[f,t.activeChatId,t.chats,e]);const E=S&&f.length>0&&(T=>{if(T.length===0)return!1;const A=T.at(-1);if(!A||A.role!=="assistant"||!A.parts)return!1;const M=A.parts;return M.length===0?!1:M[M.length-1].type==="reasoning"})(f);O.useEffect(()=>{requestAnimationFrame(()=>{if(l.current){const T=l.current;T.scrollTop=T.scrollHeight}})},[t.activeChatId]);const N=(T,A)=>{g(M=>M.slice(0,T)),t.activeChatId&&e(M=>({...M,chats:M.chats.map(P=>P.id===t.activeChatId?{...P,messages:P.messages.slice(0,T),updatedAt:Date.now()}:P)})),p({role:"user",content:A})},j=()=>{r.trim()&&(T=>{const A=Date.now(),M={id:CS(),title:T.length>50?`${T.slice(0,50)}...`:T,messages:[],createdAt:A,updatedAt:A};e(R=>({...R,chats:[...R.chats,M],activeChatId:M.id}));const P=CS();p({id:P,role:"user",content:T}),_("")})(r.trim())};return c.jsxs("div",{className:"flex flex-col h-[calc(100%-53px)]",children:[c.jsx(tp,{children:c.jsx(DR,{onNewChat:()=>{o(null),_(""),s("")},activeChatId:n==null?void 0:n.id,setActiveChat:o,chats:[...t.chats].sort((T,A)=>A.updatedAt-T.updatedAt)})}),c.jsxs("div",{className:"flex-1 px-3 bg-[var(--slate-1)] gap-4 py-3 flex flex-col overflow-y-auto",ref:l,children:[(!f||f.length===0)&&c.jsxs("div",{className:"flex flex-col rounded-md border bg-background",children:[c.jsx("div",{className:"px-1",children:c.jsx(Hc,{value:r,placeholder:"Ask anything, @ to include context about tables or dataframes",theme:u,onClose:()=>{var T,A;return(A=(T=i.current)==null?void 0:T.editor)==null?void 0:A.blur()},onChange:s,onSubmit:j},"new-thread-input")}),c.jsx(qh,{input:r,onSendClick:j,isLoading:S,onStop:C})]}),f.map((T,A)=>c.jsx(Mv,{message:T,index:A,theme:u,onEdit:N,setChatState:e,chatState:t,isStreamingReasoning:E,totalMessages:f.length},A)),S&&c.jsx("div",{className:"flex justify-center py-4",children:c.jsx(Wc,{className:"h-4 w-4 animate-spin"})}),x&&c.jsxs("div",{className:"flex items-center justify-center space-x-2 mb-4",children:[c.jsx(Vr,{error:x}),c.jsx(Ae,{variant:"outline",size:"sm",onClick:()=>{v()},children:"Retry"})]}),c.jsx("div",{ref:d})]}),S&&c.jsx("div",{className:"w-full flex justify-center items-center z-20 border-t",children:c.jsx(Ae,{variant:"linkDestructive",size:"sm",onClick:C,children:"Stop"})}),f&&f.length>0&&c.jsx(Ov,{input:m,setInput:_,onSubmit:(T,A)=>{A.trim()&&b(T)},theme:u,inputRef:a,isLoading:S,onStop:C})]})};function LR(){}function FR(){}function zR(t){return c.jsx(oa,{value:t,className:"text-sm",children:t},t)}function cn(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=cn(t[o]))!==""&&(e+=(e&&" ")+n);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}const{useDebugValue:BR}=X,{useSyncExternalStoreWithSelector:UR}=H$,VR=t=>t;function Dv(t,e=VR,n){const o=UR(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return BR(o),o}const Rv=(t,e)=>{const n=W$(t),o=(r,s=e)=>Dv(n,r,s);return Object.assign(o,n),o};function nn(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 uo(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 $R={passive:!1},Fi={capture:!0,passive:!1};function Gh(t){t.stopImmediatePropagation()}function bs(t){t.preventDefault(),t.stopImmediatePropagation()}function Pv(t){var e=t.document.documentElement,n=to(t).on("dragstart.drag",bs,Fi);"onselectstart"in e?n.on("selectstart.drag",bs,Fi):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Lv(t,e){var n=t.document.documentElement,o=to(t).on("dragstart.drag",null);e&&(o.on("click.drag",bs,Fi),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 $l=t=>()=>t;function Yh(t,{sourceEvent:e,subject:n,target:o,identifier:r,active:s,x:i,y:a,dx:l,dy:d,dispatch:u}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:u}})}function HR(t){return!t.ctrlKey&&!t.button}function WR(){return this.parentNode}function qR(t,e){return e??{x:t.x,y:t.y}}function GR(){return navigator.maxTouchPoints||"ontouchstart"in this}Yh.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};const Hl=t=>()=>t;function YR(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 Jh(t){t.stopImmediatePropagation()}function zi(t){t.preventDefault(),t.stopImmediatePropagation()}function JR(t){return!(t.ctrlKey&&t.type!=="wheel"||t.button)}function KR(){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 Fv(){return this.__zoom||vr}function XR(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function ZR(){return navigator.maxTouchPoints||"ontouchstart"in this}function QR(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 Wl=O.createContext(null),eP=Wl.Provider,tP=t=>`Node type "${t}" not found. Using fallback type "default".`,nP=()=>"The React Flow parent container needs a width and a height to render the graph.",oP=()=>"Only child nodes can use a parent extent.",rP=t=>`Marker type "${t}" doesn't exist.`,sP=(t,e)=>`Couldn't create edge for ${t?"target":"source"} handle id: "${t?e.targetHandle:e.sourceHandle}", edge id: ${e.id}.`,iP=()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",aP=t=>`Edge type "${t}" not found. Using fallback type "default".`,lP=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.`,zv="[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001";function mt(t,e){const n=O.useContext(Wl);if(n===null)throw new Error(zv);return Dv(n,t,e)}const Gt=()=>{const t=O.useContext(Wl);if(t===null)throw new Error(zv);return O.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe,destroy:t.destroy}),[t])},cP=t=>t.userSelectionActive?"none":"all";function ql({position:t,children:e,className:n,style:o,...r}){const s=mt(cP),i=`${t}`.split("-");return X.createElement("div",{className:cn(["react-flow__panel",n,...i]),style:{...o,pointerEvents:s},...r},e)}function dP({proOptions:t,position:e="bottom-right"}){return t!=null&&t.hideAttribution?null:X.createElement(ql,{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"},X.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}var uP=O.memo(({x:t,y:e,label:n,labelStyle:o={},labelShowBg:r=!0,labelBgStyle:s={},labelBgPadding:i=[2,4],labelBgBorderRadius:a=2,children:l,className:d,...u})=>{const h=O.useRef(null),[f,m]=O.useState({x:0,y:0,width:0,height:0}),_=cn(["react-flow__edge-textwrapper",d]);return O.useEffect(()=>{if(h.current){const g=h.current.getBBox();m({x:g.x,y:g.y,width:g.width,height:g.height})}},[n]),n!==void 0&&n?X.createElement("g",{transform:`translate(${t-f.width/2} ${e-f.height/2})`,className:_,visibility:f.width?"visible":"hidden",...u},r&&X.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}),X.createElement("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:h,style:o},n),l):null});const Kh=t=>({width:t.offsetWidth,height:t.offsetHeight}),xs=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),Xh=(t={x:0,y:0},e)=>({x:xs(t.x,e[0][0],e[1][0]),y:xs(t.y,e[0][1],e[1][1])}),Bv=(t,e,n)=>t<e?xs(Math.abs(t-e),1,50)/50:t>n?-xs(Math.abs(t-n),1,50)/50:0,Uv=(t,e)=>[20*Bv(t.x,35,e.width-35),20*Bv(t.y,35,e.height-35)],Vv=t=>{var e;return((e=t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},Zh=({x:t,y:e,width:n,height:o})=>({x:t,y:e,x2:t+n,y2:e+o}),$v=t=>({...t.positionAbsolute||{x:0,y:0},width:t.width||0,height:t.height||0}),Qh=(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)},Bn=t=>!isNaN(t)&&isFinite(t),Nt=Symbol.for("internals"),Hv=["Enter"," ","Escape"];function ef(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 Wv=t=>"clientX"in t,Qo=(t,e)=>{var s,i;const n=Wv(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)}},Gl=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0},Bi=({id:t,path:e,labelX:n,labelY:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:d,style:u,markerEnd:h,markerStart:f,interactionWidth:m=20})=>X.createElement(X.Fragment,null,X.createElement("path",{id:t,style:u,d:e,fill:"none",className:"react-flow__edge-path",markerEnd:h,markerStart:f}),m&&X.createElement("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:m,className:"react-flow__edge-interaction"}),r&&Bn(n)&&Bn(o)?X.createElement(uP,{x:n,y:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:d}):null);function Ui(t,e,n){return n===void 0?n:o=>{const r=e().edges.find(s=>s.id===t);r&&n(o,{...r})}}function qv({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 Gv({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,d=.125*e+.375*s+.375*a+.125*o;return[l,d,Math.abs(l-t),Math.abs(d-e)]}var Dr,Yv,er,tf,Vi,Jv,tr,$i,ys,Kv,Ue,Yl;function Xv({pos:t,x1:e,y1:n,x2:o,y2:r}){return t===Ue.Left||t===Ue.Right?[.5*(e+o),n]:[e,.5*(n+r)]}function Zv({sourceX:t,sourceY:e,sourcePosition:n=Ue.Bottom,targetX:o,targetY:r,targetPosition:s=Ue.Top}){const[i,a]=Xv({pos:n,x1:t,y1:e,x2:o,y2:r}),[l,d]=Xv({pos:s,x1:o,y1:r,x2:t,y2:e}),[u,h,f,m]=Gv({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:l,targetControlY:d});return[`M${t},${e} C${i},${a} ${l},${d} ${o},${r}`,u,h,f,m]}Bi.displayName="BaseEdge",(Yv=Dr||(Dr={})).Strict="strict",Yv.Loose="loose",(tf=er||(er={})).Free="free",tf.Vertical="vertical",tf.Horizontal="horizontal",(Jv=Vi||(Vi={})).Partial="partial",Jv.Full="full",($i=tr||(tr={})).Bezier="default",$i.Straight="straight",$i.Step="step",$i.SmoothStep="smoothstep",$i.SimpleBezier="simplebezier",(Kv=ys||(ys={})).Arrow="arrow",Kv.ArrowClosed="arrowclosed",(Yl=Ue||(Ue={})).Left="left",Yl.Top="top",Yl.Right="right",Yl.Bottom="bottom";const nf=O.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,sourcePosition:r=Ue.Bottom,targetPosition:s=Ue.Top,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:_,interactionWidth:g})=>{const[p,b,x]=Zv({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:o,targetPosition:s});return X.createElement(Bi,{path:p,labelX:b,labelY:x,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:_,interactionWidth:g})});nf.displayName="SimpleBezierEdge";const Qv={[Ue.Left]:{x:-1,y:0},[Ue.Right]:{x:1,y:0},[Ue.Top]:{x:0,y:-1},[Ue.Bottom]:{x:0,y:1}},e2=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function hP({source:t,sourcePosition:e=Ue.Bottom,target:n,targetPosition:o=Ue.Top,center:r,offset:s}){const i=Qv[e],a=Qv[o],l={x:t.x+i.x*s,y:t.y+i.y*s},d={x:n.x+a.x*s,y:n.y+a.y*s},u=(({source:S,sourcePosition:E=Ue.Bottom,target:N})=>E===Ue.Left||E===Ue.Right?S.x<N.x?{x:1,y:0}:{x:-1,y:0}:S.y<N.y?{x:0,y:1}:{x:0,y:-1})({source:l,sourcePosition:e,target:d}),h=u.x!==0?"x":"y",f=u[h];let m,_,g=[];const p={x:0,y:0},b={x:0,y:0},[x,y,v,C]=qv({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(i[h]*a[h]===-1){m=r.x??x,_=r.y??y;const S=[{x:m,y:l.y},{x:m,y:d.y}],E=[{x:l.x,y:_},{x:d.x,y:_}];g=i[h]===f?h==="x"?S:E:h==="x"?E:S}else{const S=[{x:l.x,y:d.y}],E=[{x:d.x,y:l.y}];if(g=h==="x"?i.x===f?E:S:i.y===f?S:E,e===o){const T=Math.abs(t[h]-n[h]);if(T<=s){const A=Math.min(s-1,s-T);i[h]===f?p[h]=(l[h]>t[h]?-1:1)*A:b[h]=(d[h]>n[h]?-1:1)*A}}if(e!==o){const T=h==="x"?"y":"x",A=i[h]===a[T],M=l[T]>d[T],P=l[T]<d[T];(i[h]===1&&(!A&&M||A&&P)||i[h]!==1&&(!A&&P||A&&M))&&(g=h==="x"?S:E)}const N={x:l.x+p.x,y:l.y+p.y},j={x:d.x+b.x,y:d.y+b.y};Math.max(Math.abs(N.x-g[0].x),Math.abs(j.x-g[0].x))>=Math.max(Math.abs(N.y-g[0].y),Math.abs(j.y-g[0].y))?(m=(N.x+j.x)/2,_=g[0].y):(m=g[0].x,_=(N.y+j.y)/2)}return[[t,{x:l.x+p.x,y:l.y+p.y},...g,{x:d.x+b.x,y:d.y+b.y},n],m,_,v,C]}function of({sourceX:t,sourceY:e,sourcePosition:n=Ue.Bottom,targetX:o,targetY:r,targetPosition:s=Ue.Top,borderRadius:i=5,centerX:a,centerY:l,offset:d=20}){const[u,h,f,m,_]=hP({source:{x:t,y:e},sourcePosition:n,target:{x:o,y:r},targetPosition:s,center:{x:a,y:l},offset:d});return[u.reduce((g,p,b)=>{let x="";return x=b>0&&b<u.length-1?function(y,v,C,S){const E=Math.min(e2(y,v)/2,e2(v,C)/2,S),{x:N,y:j}=v;if(y.x===N&&N===C.x||y.y===j&&j===C.y)return`L${N} ${j}`;if(y.y===j)return`L ${N+E*(y.x<C.x?-1:1)},${j}Q ${N},${j} ${N},${j+E*(y.y<C.y?1:-1)}`;const T=y.x<C.x?1:-1;return`L ${N},${j+E*(y.y<C.y?-1:1)}Q ${N},${j} ${N+E*T},${j}`}(u[b-1],p,u[b+1],i):`${b===0?"M":"L"}${p.x} ${p.y}`,g+=x},""),h,f,m,_]}const Jl=O.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:d,style:u,sourcePosition:h=Ue.Bottom,targetPosition:f=Ue.Top,markerEnd:m,markerStart:_,pathOptions:g,interactionWidth:p})=>{const[b,x,y]=of({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 X.createElement(Bi,{path:b,labelX:x,labelY:y,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:d,style:u,markerEnd:m,markerStart:_,interactionWidth:p})});Jl.displayName="SmoothStepEdge";const rf=O.memo(t=>{var e;return X.createElement(Jl,{...t,pathOptions:O.useMemo(()=>{var n;return{borderRadius:0,offset:(n=t.pathOptions)==null?void 0:n.offset}},[(e=t.pathOptions)==null?void 0:e.offset])})});rf.displayName="StepEdge";const sf=O.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:d,style:u,markerEnd:h,markerStart:f,interactionWidth:m})=>{const[_,g,p]=function({sourceX:b,sourceY:x,targetX:y,targetY:v}){const[C,S,E,N]=qv({sourceX:b,sourceY:x,targetX:y,targetY:v});return[`M ${b},${x}L ${y},${v}`,C,S,E,N]}({sourceX:t,sourceY:e,targetX:n,targetY:o});return X.createElement(Bi,{path:_,labelX:g,labelY:p,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:d,style:u,markerEnd:h,markerStart:f,interactionWidth:m})});function Kl(t,e){return t>=0?.5*t:25*e*Math.sqrt(-t)}function t2({pos:t,x1:e,y1:n,x2:o,y2:r,c:s}){switch(t){case Ue.Left:return[e-Kl(e-o,s),n];case Ue.Right:return[e+Kl(o-e,s),n];case Ue.Top:return[e,n-Kl(n-r,s)];case Ue.Bottom:return[e,n+Kl(r-n,s)]}}function n2({sourceX:t,sourceY:e,sourcePosition:n=Ue.Bottom,targetX:o,targetY:r,targetPosition:s=Ue.Top,curvature:i=.25}){const[a,l]=t2({pos:n,x1:t,y1:e,x2:o,y2:r,c:i}),[d,u]=t2({pos:s,x1:o,y1:r,x2:t,y2:e,c:i}),[h,f,m,_]=Gv({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:d,targetControlY:u});return[`M${t},${e} C${a},${l} ${d},${u} ${o},${r}`,h,f,m,_]}sf.displayName="StraightEdge";const Xl=O.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,sourcePosition:r=Ue.Bottom,targetPosition:s=Ue.Top,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:_,pathOptions:g,interactionWidth:p})=>{const[b,x,y]=n2({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:o,targetPosition:s,curvature:g==null?void 0:g.curvature});return X.createElement(Bi,{path:b,labelX:x,labelY:y,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:_,interactionWidth:p})});Xl.displayName="BezierEdge";const af=O.createContext(null),fP=af.Provider;af.Consumer;const mP=({source:t,sourceHandle:e,target:n,targetHandle:o})=>`reactflow__edge-${t}${e||""}-${n}${o||""}`,lf=(t,e)=>t===void 0?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(n=>`${n}=${t[n]}`).join("&")}`,cf=({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},o2=({x:t,y:e},[n,o,r])=>({x:t*r+n,y:e*r+o}),ws=(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}},df=(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}=ws(r,e).positionAbsolute;return a=o,l=Zh({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)},r2=(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},d=[];return t.forEach(u=>{const{width:h,height:f,selectable:m=!0,hidden:_=!1}=u;if(i&&!m||_)return!1;const{positionAbsolute:g}=ws(u,a),p={x:g.x,y:g.y,width:h||0,height:f||0},b=Qh(l,p);(h===void 0||f===void 0||h===null||f===null||s&&b>0||b>=(h||0)*(f||0)||u.dragging)&&d.push(u)}),d},s2=(t,e)=>{const n=t.map(o=>o.id);return e.filter(o=>n.includes(o.source)||n.includes(o.target))},i2=(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),d=xs(l,o,r);return{x:e/2-(t.x+t.width/2)*d,y:n/2-(t.y+t.height/2)*d,zoom:d}},Rr=(t,e=0)=>t.transition().duration(e);function a2(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 pP={source:null,target:null,sourceHandle:null,targetHandle:null},l2=()=>({handleDomNode:null,isValid:!1,connection:pP,endHandle:null});function c2(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}"]`),d={...l2(),handleDomNode:l};if(l){const u=uf(void 0,l),h=l.getAttribute("data-nodeid"),f=l.getAttribute("data-handleid"),m=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};d.connection=g,m&&_&&(e===Dr.Strict?a&&u==="source"||!a&&u==="target":h!==n||f!==o)&&(d.endHandle={nodeId:h,handleId:f,type:u},d.isValid=s(g))}return d}function uf(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function hf(t){t==null||t.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function gP(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function d2({event:t,handleId:e,nodeId:n,onConnect:o,isTarget:r,getState:s,setState:i,isValidConnection:a,edgeUpdaterType:l,onReconnectEnd:d}){const u=Vv(t.target),{connectionMode:h,domNode:f,autoPanOnConnect:m,connectionRadius:_,onConnectStart:g,panBy:p,getNodes:b,cancelConnection:x}=s();let y,v=0;const{x:C,y:S}=Qo(t),E=u==null?void 0:u.elementFromPoint(C,S),N=uf(l,E),j=f==null?void 0:f.getBoundingClientRect();if(!j||!N)return;let T,A=Qo(t,j),M=!1,P=null,R=!1,L=null;const B=function({nodes:$,nodeId:I,handleId:W,handleType:G}){return $.reduce((q,Y)=>{if(Y[Nt]){const{handleBounds:ee}=Y[Nt];let oe=[],ie=[];ee&&(oe=a2(Y,ee,"source",`${I}-${W}-${G}`),ie=a2(Y,ee,"target",`${I}-${W}-${G}`)),q.push(...oe,...ie)}return q},[])}({nodes:b(),nodeId:n,handleId:e,handleType:N}),U=()=>{if(!m)return;const[$,I]=Uv(A,j);p({x:$,y:I}),v=requestAnimationFrame(U)};function D($){const{transform:I}=s();A=Qo($,j);const{handle:W,validHandleResult:G}=function(q,Y,ee,oe,ie,Z){const{x:Q,y:me}=Qo(q),fe=Y.elementsFromPoint(Q,me).find(Se=>Se.classList.contains("react-flow__handle"));if(fe){const Se=fe.getAttribute("data-nodeid");if(Se){const ae=uf(void 0,fe),Ce=fe.getAttribute("data-handleid"),_e=Z({nodeId:Se,id:Ce,type:ae});if(_e){const Ee=ie.find(ze=>ze.nodeId===Se&&ze.type===ae&&ze.id===Ce);return{handle:{id:Ce,type:ae,nodeId:Se,x:(Ee==null?void 0:Ee.x)||ee.x,y:(Ee==null?void 0:Ee.y)||ee.y},validHandleResult:_e}}}}let de=[],ue=1/0;if(ie.forEach(Se=>{const ae=Math.sqrt((Se.x-ee.x)**2+(Se.y-ee.y)**2);if(ae<=oe){const Ce=Z(Se);ae<=ue&&(ae<ue?de=[{handle:Se,validHandleResult:Ce}]:ae===ue&&de.push({handle:Se,validHandleResult:Ce}),ue=ae)}}),!de.length)return{handle:null,validHandleResult:l2()};if(de.length===1)return de[0];const ce=de.some(({validHandleResult:Se})=>Se.isValid),ke=de.some(({handle:Se})=>Se.type==="target");return de.find(({handle:Se,validHandleResult:ae})=>ke?Se.type==="target":!ce||ae.isValid)||de[0]}($,u,cf(A,I,!1,[1,1]),_,B,q=>c2(q,h,n,e,r?"target":"source",a,u));if(y=W,M||(U(),M=!0),L=G.handleDomNode,P=G.connection,R=G.isValid,i({connectionPosition:y&&R?o2({x:y.x,y:y.y},I):A,connectionStatus:gP(!!y,R),connectionEndHandle:G.endHandle}),!y&&!R&&!L)return hf(T);P.source!==P.target&&L&&(hf(T),T=L,L.classList.add("connecting","react-flow__handle-connecting"),L.classList.toggle("valid",R),L.classList.toggle("react-flow__handle-valid",R))}function k($){var I,W;(y||L)&&P&&R&&(o==null||o(P)),(W=(I=s()).onConnectEnd)==null||W.call(I,$),l&&(d==null||d($)),hf(T),x(),cancelAnimationFrame(v),M=!1,R=!1,P=null,L=null,u.removeEventListener("mousemove",D),u.removeEventListener("mouseup",k),u.removeEventListener("touchmove",D),u.removeEventListener("touchend",k)}i({connectionPosition:A,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",D),u.addEventListener("mouseup",k),u.addEventListener("touchmove",D),u.addEventListener("touchend",k)}const u2=()=>!0,_P=t=>({connectionStartHandle:t.connectionStartHandle,connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName}),h2=O.forwardRef(({type:t="source",position:e=Ue.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:s=!0,id:i,onConnect:a,children:l,className:d,onMouseDown:u,onTouchStart:h,...f},m)=>{var N,j;const _=i||null,g=t==="target",p=Gt(),b=O.useContext(af),{connectOnClick:x,noPanClassName:y}=mt(_P,nn),{connecting:v,clickConnecting:C}=mt(((T,A,M)=>P=>{const{connectionStartHandle:R,connectionEndHandle:L,connectionClickStartHandle:B}=P;return{connecting:(R==null?void 0:R.nodeId)===T&&(R==null?void 0:R.handleId)===A&&(R==null?void 0:R.type)===M||(L==null?void 0:L.nodeId)===T&&(L==null?void 0:L.handleId)===A&&(L==null?void 0:L.type)===M,clickConnecting:(B==null?void 0:B.nodeId)===T&&(B==null?void 0:B.handleId)===A&&(B==null?void 0:B.type)===M}})(b,_,t),nn);b||((j=(N=p.getState()).onError)==null||j.call(N,"010",iP()));const S=T=>{const{defaultEdgeOptions:A,onConnect:M,hasDefaultEdges:P}=p.getState(),R={...A,...T};if(P){const{edges:L,setEdges:B}=p.getState();B(((U,D)=>{if(!U.source||!U.target)return D;let k;return k=($=>"id"in $&&"source"in $&&"target"in $)(U)?{...U}:{...U,id:mP(U)},(($,I)=>I.some(W=>!(W.source!==$.source||W.target!==$.target||W.sourceHandle!==$.sourceHandle&&(W.sourceHandle||$.sourceHandle)||W.targetHandle!==$.targetHandle&&(W.targetHandle||$.targetHandle))))(k,D)?D:D.concat(k)})(R,L))}M==null||M(R),a==null||a(R)},E=T=>{if(!b)return;const A=Wv(T);r&&(A&&T.button===0||!A)&&d2({event:T,handleId:_,nodeId:b,onConnect:S,isTarget:g,getState:p.getState,setState:p.setState,isValidConnection:n||p.getState().isValidConnection||u2}),A?u==null||u(T):h==null||h(T)};return X.createElement("div",{"data-handleid":_,"data-nodeid":b,"data-handlepos":e,"data-id":`${b}-${_}-${t}`,className:cn(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",y,d,{source:!g,target:g,connectable:o,connectablestart:r,connectableend:s,connecting:C,connectionindicator:o&&(r&&!v||s&&v)}]),onMouseDown:E,onTouchStart:E,onClick:x?T=>{const{onClickConnectStart:A,onClickConnectEnd:M,connectionClickStartHandle:P,connectionMode:R,isValidConnection:L}=p.getState();if(!b||!P&&!r)return;if(!P)return A==null||A(T,{nodeId:b,handleId:_,handleType:t}),void p.setState({connectionClickStartHandle:{nodeId:b,type:t,handleId:_}});const B=Vv(T.target),U=n||L||u2,{connection:D,isValid:k}=c2({nodeId:b,id:_,type:t},R,P.nodeId,P.handleId||null,P.type,U,B);k&&S(D),M==null||M(T),p.setState({connectionClickStartHandle:null})}:void 0,ref:m,...f},l)});h2.displayName="Handle";var nr=O.memo(h2);const f2=({data:t,isConnectable:e,targetPosition:n=Ue.Top,sourcePosition:o=Ue.Bottom})=>X.createElement(X.Fragment,null,X.createElement(nr,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label,X.createElement(nr,{type:"source",position:o,isConnectable:e}));f2.displayName="DefaultNode";var ff=O.memo(f2);const m2=({data:t,isConnectable:e,sourcePosition:n=Ue.Bottom})=>X.createElement(X.Fragment,null,t==null?void 0:t.label,X.createElement(nr,{type:"source",position:n,isConnectable:e}));m2.displayName="InputNode";var p2=O.memo(m2);const g2=({data:t,isConnectable:e,targetPosition:n=Ue.Top})=>X.createElement(X.Fragment,null,X.createElement(nr,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label);g2.displayName="OutputNode";var _2=O.memo(g2);const mf=()=>null;mf.displayName="GroupNode";const bP=t=>({selectedNodes:t.getNodes().filter(e=>e.selected),selectedEdges:t.edges.filter(e=>e.selected).map(e=>({...e}))}),Zl=t=>t.id;function xP(t,e){return nn(t.selectedNodes.map(Zl),e.selectedNodes.map(Zl))&&nn(t.selectedEdges.map(Zl),e.selectedEdges.map(Zl))}const b2=O.memo(({onSelectionChange:t})=>{const e=Gt(),{selectedNodes:n,selectedEdges:o}=mt(bP,xP);return O.useEffect(()=>{const r={nodes:n,edges:o};t==null||t(r),e.getState().onSelectionChange.forEach(s=>s(r))},[n,o,t]),null});b2.displayName="SelectionListener";const yP=t=>!!t.onSelectionChange;function wP({onSelectionChange:t}){const e=mt(yP);return t||e?X.createElement(b2,{onSelectionChange:t}):null}const vP=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 vs(t,e){O.useEffect(()=>{t!==void 0&&e(t)},[t])}function st(t,e,n){O.useEffect(()=>{e!==void 0&&n({[t]:e})},[e])}const kP=({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,onConnect:r,onConnectStart:s,onConnectEnd:i,onClickConnectStart:a,onClickConnectEnd:l,nodesDraggable:d,nodesConnectable:u,nodesFocusable:h,edgesFocusable:f,edgesUpdatable:m,elevateNodesOnSelect:_,minZoom:g,maxZoom:p,nodeExtent:b,onNodesChange:x,onEdgesChange:y,elementsSelectable:v,connectionMode:C,snapGrid:S,snapToGrid:E,translateExtent:N,connectOnClick:j,defaultEdgeOptions:T,fitView:A,fitViewOptions:M,onNodesDelete:P,onEdgesDelete:R,onNodeDrag:L,onNodeDragStart:B,onNodeDragStop:U,onSelectionDrag:D,onSelectionDragStart:k,onSelectionDragStop:$,noPanClassName:I,nodeOrigin:W,rfId:G,autoPanOnConnect:q,autoPanOnNodeDrag:Y,onError:ee,connectionRadius:oe,isValidConnection:ie,nodeDragThreshold:Z})=>{const{setNodes:Q,setEdges:me,setDefaultNodesAndEdges:fe,setMinZoom:de,setMaxZoom:ue,setTranslateExtent:ce,setNodeExtent:ke,reset:Se}=mt(vP,nn),ae=Gt();return O.useEffect(()=>{const Ce=o==null?void 0:o.map(_e=>({..._e,...T}));return fe(n,Ce),()=>{Se()}},[]),st("defaultEdgeOptions",T,ae.setState),st("connectionMode",C,ae.setState),st("onConnect",r,ae.setState),st("onConnectStart",s,ae.setState),st("onConnectEnd",i,ae.setState),st("onClickConnectStart",a,ae.setState),st("onClickConnectEnd",l,ae.setState),st("nodesDraggable",d,ae.setState),st("nodesConnectable",u,ae.setState),st("nodesFocusable",h,ae.setState),st("edgesFocusable",f,ae.setState),st("edgesUpdatable",m,ae.setState),st("elementsSelectable",v,ae.setState),st("elevateNodesOnSelect",_,ae.setState),st("snapToGrid",E,ae.setState),st("snapGrid",S,ae.setState),st("onNodesChange",x,ae.setState),st("onEdgesChange",y,ae.setState),st("connectOnClick",j,ae.setState),st("fitViewOnInit",A,ae.setState),st("fitViewOnInitOptions",M,ae.setState),st("onNodesDelete",P,ae.setState),st("onEdgesDelete",R,ae.setState),st("onNodeDrag",L,ae.setState),st("onNodeDragStart",B,ae.setState),st("onNodeDragStop",U,ae.setState),st("onSelectionDrag",D,ae.setState),st("onSelectionDragStart",k,ae.setState),st("onSelectionDragStop",$,ae.setState),st("noPanClassName",I,ae.setState),st("nodeOrigin",W,ae.setState),st("rfId",G,ae.setState),st("autoPanOnConnect",q,ae.setState),st("autoPanOnNodeDrag",Y,ae.setState),st("onError",ee,ae.setState),st("connectionRadius",oe,ae.setState),st("isValidConnection",ie,ae.setState),st("nodeDragThreshold",Z,ae.setState),vs(t,Q),vs(e,me),vs(g,de),vs(p,ue),vs(N,ce),vs(b,ke),null},x2={display:"none"},SP={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},y2="react-flow__node-desc",w2="react-flow__edge-desc",CP=t=>t.ariaLiveMessage;function NP({rfId:t}){const e=mt(CP);return X.createElement("div",{id:`react-flow__aria-live-${t}`,"aria-live":"assertive","aria-atomic":"true",style:SP},e)}function jP({rfId:t,disableKeyboardA11y:e}){return X.createElement(X.Fragment,null,X.createElement("div",{id:`${y2}-${t}`,style:x2},"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."," "),X.createElement("div",{id:`${w2}-${t}`,style:x2},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!e&&X.createElement(NP,{rfId:t}))}var Hi=(t=null,e={actInsideInputWithModifier:!0})=>{const[n,o]=O.useState(!1),r=O.useRef(!1),s=O.useRef(new Set([])),[i,a]=O.useMemo(()=>{if(t!==null){const l=(Array.isArray(t)?t:[t]).filter(u=>typeof u=="string").map(u=>u.split("+")),d=l.reduce((u,h)=>u.concat(...h),[]);return[l,d]}return[[],[]]},[t]);return O.useEffect(()=>{const l=typeof document<"u"?document:null,d=(e==null?void 0:e.target)||l;if(t!==null){const u=m=>{if(r.current=m.ctrlKey||m.metaKey||m.shiftKey,(!r.current||r.current&&!e.actInsideInputWithModifier)&&ef(m))return!1;const _=k2(m.code,a);s.current.add(m[_]),v2(i,s.current,!1)&&(m.preventDefault(),o(!0))},h=m=>{if((!r.current||r.current&&!e.actInsideInputWithModifier)&&ef(m))return!1;const _=k2(m.code,a);v2(i,s.current,!0)?(o(!1),s.current.clear()):s.current.delete(m[_]),m.key==="Meta"&&s.current.clear(),r.current=!1},f=()=>{s.current.clear(),o(!1)};return d==null||d.addEventListener("keydown",u),d==null||d.addEventListener("keyup",h),window.addEventListener("blur",f),()=>{d==null||d.removeEventListener("keydown",u),d==null||d.removeEventListener("keyup",h),window.removeEventListener("blur",f)}}},[t,o]),n};function v2(t,e,n){return t.filter(o=>n||o.length===e.size).some(o=>o.every(r=>e.has(r)))}function k2(t,e){return e.includes(t)?"code":"key"}function S2(t,e,n,o){var a,l;const r=t.parentNode||t.parentId;if(!r)return n;const s=e.get(r),i=ws(s,o);return S2(s,e,{x:(n.x??0)+i.x,y:(n.y??0)+i.y,z:(((a=s[Nt])==null?void 0:a.z)??0)>(n.z??0)?((l=s[Nt])==null?void 0:l.z)??0:n.z??0},o)}function C2(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}=S2(o,t,{...o.position,z:((s=o[Nt])==null?void 0:s.z)??0},e);o.positionAbsolute={x:i,y:a},o[Nt].z=l,n!=null&&n[o.id]&&(o[Nt].isParent=!0)}})}function pf(t,e,n,o){const r=new Map,s={},i=o?1e3:0;return t.forEach(a=>{var m;const l=(Bn(a.zIndex)?a.zIndex:0)+(a.selected?i:0),d=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=(d==null?void 0:d.type)&&(d==null?void 0:d.type)!==a.type;Object.defineProperty(u,Nt,{enumerable:!1,value:{handleBounds:f||(m=d==null?void 0:d[Nt])==null?void 0:m.handleBounds,z:l}}),r.set(a.id,u)}),C2(r,n,s),r}function N2(t,e={}){const{getNodes:n,width:o,height:r,minZoom:s,maxZoom:i,d3Zoom:a,d3Selection:l,fitViewOnInitDone:d,fitViewOnInit:u,nodeOrigin:h}=t(),f=e.initial&&!d&&u;if(a&&l&&(f||!e.initial)){const m=n().filter(g=>{var b;const p=e.includeHiddenNodes?g.width&&g.height:!g.hidden;return(b=e.nodes)!=null&&b.length?p&&e.nodes.some(x=>x.id===g.id):p}),_=m.every(g=>g.width&&g.height);if(m.length>0&&_){const g=df(m,h),{x:p,y:b,zoom:x}=i2(g,o,r,e.minZoom??s,e.maxZoom??i,e.padding??.1),y=vr.translate(p,b).scale(x);return typeof e.duration=="number"&&e.duration>0?a.transform(Rr(l,e.duration),y):a.transform(l,y),!0}}return!1}function EP(t,e){return t.forEach(n=>{const o=e.get(n.id);o&&e.set(o.id,{...o,[Nt]:o[Nt],selected:n.selected})}),new Map(e)}function IP(t,e){return e.map(n=>{const o=t.find(r=>r.id===n.id);return o&&(n.selected=o.selected),n})}function Ql({changedNodes:t,changedEdges:e,get:n,set:o}){const{nodeInternals:r,edges:s,onNodesChange:i,onEdgesChange:a,hasDefaultNodes:l,hasDefaultEdges:d}=n();t!=null&&t.length&&(l&&o({nodeInternals:EP(t,r)}),i==null||i(t)),e!=null&&e.length&&(d&&o({edges:IP(e,s)}),a==null||a(e))}const ks=()=>{},AP={zoomIn:ks,zoomOut:ks,zoomTo:ks,getZoom:()=>1,setViewport:ks,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:ks,fitBounds:ks,project:t=>t,screenToFlowPosition:t=>t,flowToScreenPosition:t=>t,viewportInitialized:!1},TP=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection});function Wi(){const t=(()=>{const g=Gt(),{d3Zoom:p,d3Selection:b}=mt(TP,nn);return O.useMemo(()=>b&&p?{zoomIn:y=>p.scaleBy(Rr(b,y==null?void 0:y.duration),1.2),zoomOut:y=>p.scaleBy(Rr(b,y==null?void 0:y.duration),1/1.2),zoomTo:(y,v)=>p.scaleTo(Rr(b,v==null?void 0:v.duration),y),getZoom:()=>g.getState().transform[2],setViewport:(y,v)=>{const[C,S,E]=g.getState().transform,N=vr.translate(y.x??C,y.y??S).scale(y.zoom??E);p.transform(Rr(b,v==null?void 0:v.duration),N)},getViewport:()=>{const[y,v,C]=g.getState().transform;return{x:y,y:v,zoom:C}},fitView:y=>N2(g.getState,y),setCenter:(y,v,C)=>{const{width:S,height:E,maxZoom:N}=g.getState(),j=(C==null?void 0:C.zoom)!==void 0?C.zoom:N,T=S/2-y*j,A=E/2-v*j,M=vr.translate(T,A).scale(j);p.transform(Rr(b,C==null?void 0:C.duration),M)},fitBounds:(y,v)=>{const{width:C,height:S,minZoom:E,maxZoom:N}=g.getState(),{x:j,y:T,zoom:A}=i2(y,C,S,E,N,(v==null?void 0:v.padding)??.1),M=vr.translate(j,T).scale(A);p.transform(Rr(b,v==null?void 0:v.duration),M)},project:y=>{const{transform:v,snapToGrid:C,snapGrid:S}=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"),cf(y,v,C,S)},screenToFlowPosition:y=>{const{transform:v,snapToGrid:C,snapGrid:S,domNode:E}=g.getState();if(!E)return y;const{x:N,y:j}=E.getBoundingClientRect(),T={x:y.x-N,y:y.y-j};return cf(T,v,C,S)},flowToScreenPosition:y=>{const{transform:v,domNode:C}=g.getState();if(!C)return y;const{x:S,y:E}=C.getBoundingClientRect(),N=o2(y,v);return{x:N.x+S,y:N.y+E}},viewportInitialized:!0}:AP,[p,b])})(),e=Gt(),n=O.useCallback(()=>e.getState().getNodes().map(g=>({...g})),[]),o=O.useCallback(g=>e.getState().nodeInternals.get(g),[]),r=O.useCallback(()=>{const{edges:g=[]}=e.getState();return g.map(p=>({...p}))},[]),s=O.useCallback(g=>{const{edges:p=[]}=e.getState();return p.find(b=>b.id===g)},[]),i=O.useCallback(g=>{const{getNodes:p,setNodes:b,hasDefaultNodes:x,onNodesChange:y}=e.getState(),v=p(),C=typeof g=="function"?g(v):g;if(x)b(C);else if(y){const S=C.length===0?v.map(E=>({type:"remove",id:E.id})):C.map(E=>({item:E,type:"reset"}));y(S)}},[]),a=O.useCallback(g=>{const{edges:p=[],setEdges:b,hasDefaultEdges:x,onEdgesChange:y}=e.getState(),v=typeof g=="function"?g(p):g;x?b(v):y&&y(v.length===0?p.map(C=>({type:"remove",id:C.id})):v.map(C=>({item:C,type:"reset"})))},[]),l=O.useCallback(g=>{const p=Array.isArray(g)?g:[g],{getNodes:b,setNodes:x,hasDefaultNodes:y,onNodesChange:v}=e.getState();if(y)x([...b(),...p]);else if(v){const C=p.map(S=>({item:S,type:"add"}));v(C)}},[]),d=O.useCallback(g=>{const p=Array.isArray(g)?g:[g],{edges:b=[],setEdges:x,hasDefaultEdges:y,onEdgesChange:v}=e.getState();y?x([...b,...p]):v&&v(p.map(C=>({item:C,type:"add"})))},[]),u=O.useCallback(()=>{const{getNodes:g,edges:p=[],transform:b}=e.getState(),[x,y,v]=b;return{nodes:g().map(C=>({...C})),edges:p.map(C=>({...C})),viewport:{x,y,zoom:v}}},[]),h=O.useCallback(({nodes:g,edges:p})=>{const{nodeInternals:b,getNodes:x,edges:y,hasDefaultNodes:v,hasDefaultEdges:C,onNodesDelete:S,onEdgesDelete:E,onNodesChange:N,onEdgesChange:j}=e.getState(),T=(g||[]).map(L=>L.id),A=(p||[]).map(L=>L.id),M=x().reduce((L,B)=>{const U=B.parentNode||B.parentId,D=!T.includes(B.id)&&U&&L.find(k=>k.id===U);return(typeof B.deletable!="boolean"||B.deletable)&&(T.includes(B.id)||D)&&L.push(B),L},[]),P=y.filter(L=>typeof L.deletable!="boolean"||L.deletable),R=P.filter(L=>A.includes(L.id));if(M||R){const L=s2(M,P),B=[...R,...L],U=B.reduce((D,k)=>(D.includes(k.id)||D.push(k.id),D),[]);(C||v)&&(C&&e.setState({edges:y.filter(D=>!U.includes(D.id))}),v&&(M.forEach(D=>{b.delete(D.id)}),e.setState({nodeInternals:new Map(b)}))),U.length>0&&(E==null||E(B),j&&j(U.map(D=>({id:D,type:"remove"})))),M.length>0&&(S==null||S(M),N)&&N(M.map(D=>({id:D.id,type:"remove"})))}},[]),f=O.useCallback(g=>{const p=Bn((b=g).width)&&Bn(b.height)&&Bn(b.x)&&Bn(b.y);var b;const x=p?null:e.getState().nodeInternals.get(g.id);return!p&&!x?[null,null,p]:[p?g:$v(x),x,p]},[]),m=O.useCallback((g,p=!0,b)=>{const[x,y,v]=f(g);return x?(b||e.getState().getNodes()).filter(C=>{if(!(v||C.id!==y.id&&C.positionAbsolute))return!1;const S=$v(C),E=Qh(S,x);return p&&E>0||E>=x.width*x.height}):[]},[]),_=O.useCallback((g,p,b=!0)=>{const[x]=f(g);if(!x)return!1;const y=Qh(x,p);return b&&y>0||y>=x.width*x.height},[]);return O.useMemo(()=>({...t,getNodes:n,getNode:o,getEdges:r,getEdge:s,setNodes:i,setEdges:a,addNodes:l,addEdges:d,toObject:u,deleteElements:h,getIntersectingNodes:m,isNodeIntersecting:_}),[t,n,o,r,s,i,a,l,d,u,h,m,_])}const MP={actInsideInputWithModifier:!1},gf={position:"absolute",width:"100%",height:"100%",top:0,left:0},ec=t=>({x:t.x,y:t.y,zoom:t.k}),Ss=(t,e)=>t.target.closest(`.${e}`),j2=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),E2=t=>{const e=t.ctrlKey&&Gl()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e},OP=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection,d3ZoomHandler:t.d3ZoomHandler,userSelectionActive:t.userSelectionActive}),DP=({onMove:t,onMoveStart:e,onMoveEnd:n,onPaneContextMenu:o,zoomOnScroll:r=!0,zoomOnPinch:s=!0,panOnScroll:i=!1,panOnScrollSpeed:a=.5,panOnScrollMode:l=er.Free,zoomOnDoubleClick:d=!0,elementsSelectable:u,panOnDrag:h=!0,defaultViewport:f,translateExtent:m,minZoom:_,maxZoom:g,zoomActivationKeyCode:p,preventScrolling:b=!0,children:x,noWheelClassName:y,noPanClassName:v})=>{const C=O.useRef(),S=Gt(),E=O.useRef(!1),N=O.useRef(!1),j=O.useRef(null),T=O.useRef({x:0,y:0,zoom:0}),{d3Zoom:A,d3Selection:M,d3ZoomHandler:P,userSelectionActive:R}=mt(OP,nn),L=Hi(p),B=O.useRef(0),U=O.useRef(!1),D=O.useRef();return function(k){const $=Gt();O.useEffect(()=>{let I;const W=()=>{var q,Y;if(!k.current)return;const G=Kh(k.current);G.height!==0&&G.width!==0||((Y=(q=$.getState()).onError)==null||Y.call(q,"004",nP())),$.setState({width:G.width||500,height:G.height||500})};return W(),window.addEventListener("resize",W),k.current&&(I=new ResizeObserver(()=>W()),I.observe(k.current)),()=>{window.removeEventListener("resize",W),I&&k.current&&I.unobserve(k.current)}},[])}(j),O.useEffect(()=>{if(j.current){const k=j.current.getBoundingClientRect(),$=function(){var Y,ee,oe,ie=JR,Z=KR,Q=QR,me=XR,fe=ZR,de=[0,1/0],ue=[[-1/0,-1/0],[1/0,1/0]],ce=250,ke=BW,Se=uC("start","zoom","end"),ae=0,Ce=10;function _e(J){J.property("__zoom",Fv).on("wheel.zoom",Qe,{passive:!1}).on("mousedown.zoom",tt).on("dblclick.zoom",ne).filter(fe).on("touchstart.zoom",ve).on("touchmove.zoom",je).on("touchend.zoom touchcancel.zoom",Re).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function Ee(J,se){return(se=Math.max(de[0],Math.min(de[1],se)))===J.k?J:new bp(se,J.x,J.y)}function ze(J,se,ge){var pe=se[0]-ge[0]*J.k,xe=se[1]-ge[1]*J.k;return pe===J.x&&xe===J.y?J:new bp(J.k,pe,xe)}function Oe(J){return[(+J[0][0]+ +J[1][0])/2,(+J[0][1]+ +J[1][1])/2]}function He(J,se,ge,pe){J.on("start.zoom",function(){Fe(this,arguments).event(pe).start()}).on("interrupt.zoom end.zoom",function(){Fe(this,arguments).event(pe).end()}).tween("zoom",function(){var xe=this,Ve=arguments,Be=Fe(xe,Ve).event(pe),rt=Z.apply(xe,Ve),le=ge==null?Oe(rt):typeof ge=="function"?ge.apply(xe,Ve):ge,Ie=Math.max(rt[1][0]-rt[0][0],rt[1][1]-rt[0][1]),Me=xe.__zoom,$e=typeof se=="function"?se.apply(xe,Ve):se,Ke=ke(Me.invert(le).concat(Ie/Me.k),$e.invert(le).concat(Ie/$e.k));return function(Pe){if(Pe===1)Pe=$e;else{var Ye=Ke(Pe),ot=Ie/Ye[2];Pe=new bp(ot,le[0]-Ye[0]*ot,le[1]-Ye[1]*ot)}Be.zoom(null,Pe)}})}function Fe(J,se,ge){return!ge&&J.__zooming||new it(J,se)}function it(J,se){this.that=J,this.args=se,this.active=0,this.sourceEvent=null,this.extent=Z.apply(J,se),this.taps=0}function Qe(J,...se){if(ie.apply(this,arguments)){var ge=Fe(this,se).event(J),pe=this.__zoom,xe=Math.max(de[0],Math.min(de[1],pe.k*Math.pow(2,me.apply(this,arguments)))),Ve=uo(J);if(ge.wheel)ge.mouse[0][0]===Ve[0]&&ge.mouse[0][1]===Ve[1]||(ge.mouse[1]=pe.invert(ge.mouse[0]=Ve)),clearTimeout(ge.wheel);else{if(pe.k===xe)return;ge.mouse=[Ve,pe.invert(Ve)],xp(this),ge.start()}zi(J),ge.wheel=setTimeout(function(){ge.wheel=null,ge.end()},150),ge.zoom("mouse",Q(ze(Ee(pe,xe),ge.mouse[0],ge.mouse[1]),ge.extent,ue))}}function tt(J,...se){if(!oe&&ie.apply(this,arguments)){var ge=J.currentTarget,pe=Fe(this,se,!0).event(J),xe=to(J.view).on("mousemove.zoom",function(le){if(zi(le),!pe.moved){var Ie=le.clientX-Be,Me=le.clientY-rt;pe.moved=Ie*Ie+Me*Me>ae}pe.event(le).zoom("mouse",Q(ze(pe.that.__zoom,pe.mouse[0]=uo(le,ge),pe.mouse[1]),pe.extent,ue))},!0).on("mouseup.zoom",function(le){xe.on("mousemove.zoom mouseup.zoom",null),Lv(le.view,pe.moved),zi(le),pe.event(le).end()},!0),Ve=uo(J,ge),Be=J.clientX,rt=J.clientY;Pv(J.view),Jh(J),pe.mouse=[Ve,this.__zoom.invert(Ve)],xp(this),pe.start()}}function ne(J,...se){if(ie.apply(this,arguments)){var ge=this.__zoom,pe=uo(J.changedTouches?J.changedTouches[0]:J,this),xe=ge.invert(pe),Ve=ge.k*(J.shiftKey?.5:2),Be=Q(ze(Ee(ge,Ve),pe,xe),Z.apply(this,se),ue);zi(J),ce>0?to(this).transition().duration(ce).call(He,Be,pe,J):to(this).call(_e.transform,Be,pe,J)}}function ve(J,...se){if(ie.apply(this,arguments)){var ge,pe,xe,Ve,Be=J.touches,rt=Be.length,le=Fe(this,se,J.changedTouches.length===rt).event(J);for(Jh(J),pe=0;pe<rt;++pe)Ve=[Ve=uo(xe=Be[pe],this),this.__zoom.invert(Ve),xe.identifier],le.touch0?le.touch1||le.touch0[2]===Ve[2]||(le.touch1=Ve,le.taps=0):(le.touch0=Ve,ge=!0,le.taps=1+!!Y);Y&&(Y=clearTimeout(Y)),ge&&(le.taps<2&&(ee=Ve[0],Y=setTimeout(function(){Y=null},500)),xp(this),le.start())}}function je(J,...se){if(this.__zooming){var ge,pe,xe,Ve,Be=Fe(this,se).event(J),rt=J.changedTouches,le=rt.length;for(zi(J),ge=0;ge<le;++ge)xe=uo(pe=rt[ge],this),Be.touch0&&Be.touch0[2]===pe.identifier?Be.touch0[0]=xe:Be.touch1&&Be.touch1[2]===pe.identifier&&(Be.touch1[0]=xe);if(pe=Be.that.__zoom,Be.touch1){var Ie=Be.touch0[0],Me=Be.touch0[1],$e=Be.touch1[0],Ke=Be.touch1[1],Pe=(Pe=$e[0]-Ie[0])*Pe+(Pe=$e[1]-Ie[1])*Pe,Ye=(Ye=Ke[0]-Me[0])*Ye+(Ye=Ke[1]-Me[1])*Ye;pe=Ee(pe,Math.sqrt(Pe/Ye)),xe=[(Ie[0]+$e[0])/2,(Ie[1]+$e[1])/2],Ve=[(Me[0]+Ke[0])/2,(Me[1]+Ke[1])/2]}else{if(!Be.touch0)return;xe=Be.touch0[0],Ve=Be.touch0[1]}Be.zoom("touch",Q(ze(pe,xe,Ve),Be.extent,ue))}}function Re(J,...se){if(this.__zooming){var ge,pe,xe=Fe(this,se).event(J),Ve=J.changedTouches,Be=Ve.length;for(Jh(J),oe&&clearTimeout(oe),oe=setTimeout(function(){oe=null},500),ge=0;ge<Be;++ge)pe=Ve[ge],xe.touch0&&xe.touch0[2]===pe.identifier?delete xe.touch0:xe.touch1&&xe.touch1[2]===pe.identifier&&delete xe.touch1;if(xe.touch1&&!xe.touch0&&(xe.touch0=xe.touch1,delete xe.touch1),xe.touch0)xe.touch0[1]=this.__zoom.invert(xe.touch0[0]);else if(xe.end(),xe.taps===2&&(pe=uo(pe,this),Math.hypot(ee[0]-pe[0],ee[1]-pe[1])<Ce)){var rt=to(this).on("dblclick.zoom");rt&&rt.apply(this,arguments)}}}return _e.transform=function(J,se,ge,pe){var xe=J.selection?J.selection():J;xe.property("__zoom",Fv),J!==xe?He(J,se,ge,pe):xe.interrupt().each(function(){Fe(this,arguments).event(pe).start().zoom(null,typeof se=="function"?se.apply(this,arguments):se).end()})},_e.scaleBy=function(J,se,ge,pe){_e.scaleTo(J,function(){return this.__zoom.k*(typeof se=="function"?se.apply(this,arguments):se)},ge,pe)},_e.scaleTo=function(J,se,ge,pe){_e.transform(J,function(){var xe=Z.apply(this,arguments),Ve=this.__zoom,Be=ge==null?Oe(xe):typeof ge=="function"?ge.apply(this,arguments):ge,rt=Ve.invert(Be),le=typeof se=="function"?se.apply(this,arguments):se;return Q(ze(Ee(Ve,le),Be,rt),xe,ue)},ge,pe)},_e.translateBy=function(J,se,ge,pe){_e.transform(J,function(){return Q(this.__zoom.translate(typeof se=="function"?se.apply(this,arguments):se,typeof ge=="function"?ge.apply(this,arguments):ge),Z.apply(this,arguments),ue)},null,pe)},_e.translateTo=function(J,se,ge,pe,xe){_e.transform(J,function(){var Ve=Z.apply(this,arguments),Be=this.__zoom,rt=pe==null?Oe(Ve):typeof pe=="function"?pe.apply(this,arguments):pe;return Q(vr.translate(rt[0],rt[1]).scale(Be.k).translate(typeof se=="function"?-se.apply(this,arguments):-se,typeof ge=="function"?-ge.apply(this,arguments):-ge),Ve,ue)},pe,xe)},it.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,se){return this.mouse&&J!=="mouse"&&(this.mouse[1]=se.invert(this.mouse[0])),this.touch0&&J!=="touch"&&(this.touch0[1]=se.invert(this.touch0[0])),this.touch1&&J!=="touch"&&(this.touch1[1]=se.invert(this.touch1[0])),this.that.__zoom=se,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(J){var se=to(this.that).datum();Se.call(J,this.that,new YR(J,{sourceEvent:this.sourceEvent,target:_e,transform:this.that.__zoom,dispatch:Se}),se)}},_e.wheelDelta=function(J){return arguments.length?(me=typeof J=="function"?J:Hl(+J),_e):me},_e.filter=function(J){return arguments.length?(ie=typeof J=="function"?J:Hl(!!J),_e):ie},_e.touchable=function(J){return arguments.length?(fe=typeof J=="function"?J:Hl(!!J),_e):fe},_e.extent=function(J){return arguments.length?(Z=typeof J=="function"?J:Hl([[+J[0][0],+J[0][1]],[+J[1][0],+J[1][1]]]),_e):Z},_e.scaleExtent=function(J){return arguments.length?(de[0]=+J[0],de[1]=+J[1],_e):[de[0],de[1]]},_e.translateExtent=function(J){return arguments.length?(ue[0][0]=+J[0][0],ue[1][0]=+J[1][0],ue[0][1]=+J[0][1],ue[1][1]=+J[1][1],_e):[[ue[0][0],ue[0][1]],[ue[1][0],ue[1][1]]]},_e.constrain=function(J){return arguments.length?(Q=J,_e):Q},_e.duration=function(J){return arguments.length?(ce=+J,_e):ce},_e.interpolate=function(J){return arguments.length?(ke=J,_e):ke},_e.on=function(){var J=Se.on.apply(Se,arguments);return J===Se?_e:J},_e.clickDistance=function(J){return arguments.length?(ae=(J=+J)*J,_e):Math.sqrt(ae)},_e.tapDistance=function(J){return arguments.length?(Ce=+J,_e):Ce},_e}().scaleExtent([_,g]).translateExtent(m),I=to(j.current).call($),W=vr.translate(f.x,f.y).scale(xs(f.zoom,_,g)),G=[[0,0],[k.width,k.height]],q=$.constrain()(W,G,m);$.transform(I,q),$.wheelDelta(E2),S.setState({d3Zoom:$,d3Selection:I,d3ZoomHandler:I.on("wheel.zoom"),transform:[q.x,q.y,q.k],domNode:j.current.closest(".react-flow")})}},[]),O.useEffect(()=>{M&&A&&(!i||L||R?P!==void 0&&M.on("wheel.zoom",function(k,$){if(!b&&k.type==="wheel"&&!k.ctrlKey||Ss(k,y))return null;k.preventDefault(),P.call(this,k,$)},{passive:!1}):M.on("wheel.zoom",k=>{if(Ss(k,y))return!1;k.preventDefault(),k.stopImmediatePropagation();const $=M.property("__zoom").k||1;if(k.ctrlKey&&s){const ie=uo(k),Z=E2(k),Q=$*Math.pow(2,Z);return void A.scaleTo(M,Q,ie,k)}const I=k.deltaMode===1?20:1;let W=l===er.Vertical?0:k.deltaX*I,G=l===er.Horizontal?0:k.deltaY*I;!Gl()&&k.shiftKey&&l!==er.Vertical&&(W=k.deltaY*I,G=0),A.translateBy(M,-W/$*a,-G/$*a,{internal:!0});const q=ec(M.property("__zoom")),{onViewportChangeStart:Y,onViewportChange:ee,onViewportChangeEnd:oe}=S.getState();clearTimeout(D.current),U.current||(U.current=!0,e==null||e(k,q),Y==null||Y(q)),U.current&&(t==null||t(k,q),ee==null||ee(q),D.current=setTimeout(()=>{n==null||n(k,q),oe==null||oe(q),U.current=!1},150))},{passive:!1}))},[R,i,l,M,A,P,L,s,b,y,e,t,n]),O.useEffect(()=>{A&&A.on("start",k=>{var W,G;if(!k.sourceEvent||k.sourceEvent.internal)return null;B.current=(W=k.sourceEvent)==null?void 0:W.button;const{onViewportChangeStart:$}=S.getState(),I=ec(k.transform);E.current=!0,T.current=I,((G=k.sourceEvent)==null?void 0:G.type)==="mousedown"&&S.setState({paneDragging:!0}),$==null||$(I),e==null||e(k.sourceEvent,I)})},[A,e]),O.useEffect(()=>{A&&(R&&!E.current?A.on("zoom",null):R||A.on("zoom",k=>{var I;const{onViewportChange:$}=S.getState();if(S.setState({transform:[k.transform.x,k.transform.y,k.transform.k]}),N.current=!(!o||!j2(h,B.current??0)),(t||$)&&!((I=k.sourceEvent)!=null&&I.internal)){const W=ec(k.transform);$==null||$(W),t==null||t(k.sourceEvent,W)}}))},[R,A,t,h,o]),O.useEffect(()=>{A&&A.on("end",k=>{if(!k.sourceEvent||k.sourceEvent.internal)return null;const{onViewportChangeEnd:$}=S.getState();if(E.current=!1,S.setState({paneDragging:!1}),o&&j2(h,B.current??0)&&!N.current&&o(k.sourceEvent),N.current=!1,(n||$)&&(I=T.current,W=k.transform,I.x!==W.x||I.y!==W.y||I.zoom!==W.k)){const G=ec(k.transform);T.current=G,clearTimeout(C.current),C.current=setTimeout(()=>{$==null||$(G),n==null||n(k.sourceEvent,G)},i?150:0)}var I,W})},[A,i,h,n,o]),O.useEffect(()=>{A&&A.filter(k=>{const $=L||r,I=s&&k.ctrlKey;if((h===!0||Array.isArray(h)&&h.includes(1))&&k.button===1&&k.type==="mousedown"&&(Ss(k,"react-flow__node")||Ss(k,"react-flow__edge")))return!0;if(!(h||$||i||d||s)||R||!d&&k.type==="dblclick"||Ss(k,y)&&k.type==="wheel"||Ss(k,v)&&(k.type!=="wheel"||i&&k.type==="wheel"&&!L)||!s&&k.ctrlKey&&k.type==="wheel"||!$&&!i&&!I&&k.type==="wheel"||!h&&(k.type==="mousedown"||k.type==="touchstart")||Array.isArray(h)&&!h.includes(k.button)&&k.type==="mousedown")return!1;const W=Array.isArray(h)&&h.includes(k.button)||!k.button||k.button<=1;return(!k.ctrlKey||k.type==="wheel")&&W})},[R,A,r,s,i,d,h,u,L]),X.createElement("div",{className:"react-flow__renderer",ref:j,style:gf},x)},RP=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function PP(){const{userSelectionActive:t,userSelectionRect:e}=mt(RP,nn);return t&&e?X.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 I2(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 A2(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&&I2(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&&I2(o,i);break;case"remove":return o}return o.push(i),o},n)}function T2(t,e){return A2(t,e)}const or=(t,e)=>({id:t,type:"select",selected:e});function Cs(t,e){return t.reduce((n,o)=>{const r=e.includes(o.id);return!o.selected&&r?(o.selected=!0,n.push(or(o.id,!0))):o.selected&&!r&&(o.selected=!1,n.push(or(o.id,!1))),n},[])}const _f=(t,e)=>n=>{n.target===e.current&&(t==null||t(n))},LP=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,dragging:t.paneDragging}),M2=O.memo(({isSelecting:t,selectionMode:e=Vi.Full,panOnDrag:n,onSelectionStart:o,onSelectionEnd:r,onPaneClick:s,onPaneContextMenu:i,onPaneScroll:a,onPaneMouseEnter:l,onPaneMouseMove:d,onPaneMouseLeave:u,children:h})=>{const f=O.useRef(null),m=Gt(),_=O.useRef(0),g=O.useRef(0),p=O.useRef(),{userSelectionActive:b,elementsSelectable:x,dragging:y}=mt(LP,nn),v=()=>{m.setState({userSelectionActive:!1,userSelectionRect:null}),_.current=0,g.current=0},C=N=>{s==null||s(N),m.getState().resetSelectedElements(),m.setState({nodesSelectionActive:!1})},S=a?N=>a(N):void 0,E=x&&(t||b);return X.createElement("div",{className:cn(["react-flow__pane",{dragging:y,selection:t}]),onClick:E?void 0:_f(C,f),onContextMenu:_f(N=>{Array.isArray(n)&&(n!=null&&n.includes(2))?N.preventDefault():i==null||i(N)},f),onWheel:_f(S,f),onMouseEnter:E?void 0:l,onMouseDown:E?N=>{const{resetSelectedElements:j,domNode:T}=m.getState();if(p.current=T==null?void 0:T.getBoundingClientRect(),!x||!t||N.button!==0||N.target!==f.current||!p.current)return;const{x:A,y:M}=Qo(N,p.current);j(),m.setState({userSelectionRect:{width:0,height:0,startX:A,startY:M,x:A,y:M}}),o==null||o(N)}:void 0,onMouseMove:E?N=>{const{userSelectionRect:j,nodeInternals:T,edges:A,transform:M,onNodesChange:P,onEdgesChange:R,nodeOrigin:L,getNodes:B}=m.getState();if(!t||!p.current||!j)return;m.setState({userSelectionActive:!0,nodesSelectionActive:!1});const U=Qo(N,p.current),D=j.startX??0,k=j.startY??0,$={...j,x:U.x<D?U.x:D,y:U.y<k?U.y:k,width:Math.abs(U.x-D),height:Math.abs(U.y-k)},I=B(),W=r2(T,$,M,e===Vi.Partial,!0,L),G=s2(W,A).map(Y=>Y.id),q=W.map(Y=>Y.id);if(_.current!==q.length){_.current=q.length;const Y=Cs(I,q);Y.length&&(P==null||P(Y))}if(g.current!==G.length){g.current=G.length;const Y=Cs(A,G);Y.length&&(R==null||R(Y))}m.setState({userSelectionRect:$})}:d,onMouseUp:E?N=>{if(N.button!==0)return;const{userSelectionRect:j}=m.getState();!b&&j&&N.target===f.current&&(C==null||C(N)),m.setState({nodesSelectionActive:_.current>0}),v(),r==null||r(N)}:void 0,onMouseLeave:E?N=>{b&&(m.setState({nodesSelectionActive:_.current>0}),r==null||r(N)),v()}:u,ref:f,style:gf},h,X.createElement(PP,null))});function O2(t,e){const n=t.parentNode||t.parentId;if(!n)return!1;const o=e.get(n);return!!o&&(!!o.selected||O2(o,e))}function D2(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 FP(t,e,n,o){return Array.from(t.values()).filter(r=>(r.selected||r.id===o)&&(!r.parentNode||r.parentId||!O2(r,t))&&(r.draggable||e&&r.draggable===void 0)).map(r=>{var s,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 R2(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:m}=ws(h,r).positionAbsolute;a=[[t.extent[0][0]+f,t.extent[0][1]+m],[t.extent[1][0]+f,t.extent[1][1]+m]]}}else if(l&&t.width&&t.height){const h=n.get(l),{x:f,y:m}=ws(h,r).positionAbsolute;a=h&&Bn(f)&&Bn(m)&&Bn(h.width)&&Bn(h.height)?[[f+t.width*r[0],m+t.height*r[1]],[f+h.width-t.width+t.width*r[0],m+h.height-t.height+t.height*r[1]]]:a}else s==null||s("005",oP()),a=i;let d={x:0,y:0};if(l){const h=n.get(l);d=ws(h,r).positionAbsolute}const u=a&&a!=="parent"?Xh(e,a):e;return{position:{x:u.x-d.x,y:u.y-d.y},positionAbsolute:u}}function bf({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]}M2.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(d=>{const u=d.getBoundingClientRect();return{id:d.getAttribute("data-handleid"),position:d.getAttribute("data-handlepos"),x:(u.left-i.left-a)/n,y:(u.top-i.top-l)/n,...Kh(d)}})};function qi(t,e,n){return n===void 0?n:o=>{const r=e().nodeInternals.get(t);r&&n(o,{...r})}}function xf({id:t,store:e,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:s,multiSelectionActive:i,nodeInternals:a,onError:l}=e.getState(),d=a.get(t);d?(e.setState({nodesSelectionActive:!1}),d.selected?(n||d.selected&&i)&&(s({nodes:[d],edges:[]}),requestAnimationFrame(()=>{var u;return(u=o==null?void 0:o.current)==null?void 0:u.blur()})):r([t])):l==null||l("012",lP(t))}function yf(t){return(e,n,o)=>t==null?void 0:t(e,o)}function L2({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:s,selectNodesOnDrag:i}){const a=Gt(),[l,d]=O.useState(!1),u=O.useRef([]),h=O.useRef({x:null,y:null}),f=O.useRef(0),m=O.useRef(null),_=O.useRef({x:0,y:0}),g=O.useRef(null),p=O.useRef(!1),b=O.useRef(!1),x=O.useRef(!1),y=function(){const v=Gt();return O.useCallback(({sourceEvent:S})=>{const{transform:E,snapGrid:N,snapToGrid:j}=v.getState(),T=S.touches?S.touches[0].clientX:S.clientX,A=S.touches?S.touches[0].clientY:S.clientY,M={x:(T-E[0])/E[2],y:(A-E[1])/E[2]};return{xSnapped:j?N[0]*Math.round(M.x/N[0]):M.x,ySnapped:j?N[1]*Math.round(M.y/N[1]):M.y,...M}},[])}();return O.useEffect(()=>{if(t!=null&&t.current){const v=to(t.current),C=({x:N,y:j})=>{const{nodeInternals:T,onNodeDrag:A,onSelectionDrag:M,updateNodePositions:P,nodeExtent:R,snapGrid:L,snapToGrid:B,nodeOrigin:U,onError:D}=a.getState();h.current={x:N,y:j};let k=!1,$={x:0,y:0,x2:0,y2:0};if(u.current.length>1&&R){const W=df(u.current,U);$=Zh(W)}if(u.current=u.current.map(W=>{const G={x:N-W.distance.x,y:j-W.distance.y};B&&(G.x=L[0]*Math.round(G.x/L[0]),G.y=L[1]*Math.round(G.y/L[1]));const q=[[R[0][0],R[0][1]],[R[1][0],R[1][1]]];u.current.length>1&&R&&!W.extent&&(q[0][0]=W.positionAbsolute.x-$.x+R[0][0],q[1][0]=W.positionAbsolute.x+(W.width??0)-$.x2+R[1][0],q[0][1]=W.positionAbsolute.y-$.y+R[0][1],q[1][1]=W.positionAbsolute.y+(W.height??0)-$.y2+R[1][1]);const Y=R2(W,G,T,q,U,D);return k=k||W.position.x!==Y.position.x||W.position.y!==Y.position.y,W.position=Y.position,W.positionAbsolute=Y.positionAbsolute,W}),!k)return;P(u.current,!0,!0),d(!0);const I=r?A:yf(M);if(I&&g.current){const[W,G]=bf({nodeId:r,dragItems:u.current,nodeInternals:T});I(g.current,W,G)}},S=()=>{if(!m.current)return;const[N,j]=Uv(_.current,m.current);if(N!==0||j!==0){const{transform:T,panBy:A}=a.getState();h.current.x=(h.current.x??0)-N/T[2],h.current.y=(h.current.y??0)-j/T[2],A({x:N,y:j})&&C(h.current)}f.current=requestAnimationFrame(S)},E=N=>{var U;const{nodeInternals:j,multiSelectionActive:T,nodesDraggable:A,unselectNodesAndEdges:M,onNodeDragStart:P,onSelectionDragStart:R}=a.getState();b.current=!0;const L=r?P:yf(R);i&&s||T||!r||(U=j.get(r))!=null&&U.selected||M(),r&&s&&i&&xf({id:r,store:a,nodeRef:t});const B=y(N);if(h.current=B,u.current=FP(j,A,B,r),L&&u.current){const[D,k]=bf({nodeId:r,dragItems:u.current,nodeInternals:j});L(N.sourceEvent,D,k)}};if(!e){const N=function(){var j,T,A,M,P=HR,R=WR,L=qR,B=GR,U={},D=uC("start","drag","end"),k=0,$=0;function I(Z){Z.on("mousedown.drag",W).filter(B).on("touchstart.drag",Y).on("touchmove.drag",ee,$R).on("touchend.drag touchcancel.drag",oe).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function W(Z,Q){if(!M&&P.call(this,Z,Q)){var me=ie(this,R.call(this,Z,Q),Z,Q,"mouse");me&&(to(Z.view).on("mousemove.drag",G,Fi).on("mouseup.drag",q,Fi),Pv(Z.view),Gh(Z),A=!1,j=Z.clientX,T=Z.clientY,me("start",Z))}}function G(Z){if(bs(Z),!A){var Q=Z.clientX-j,me=Z.clientY-T;A=Q*Q+me*me>$}U.mouse("drag",Z)}function q(Z){to(Z.view).on("mousemove.drag mouseup.drag",null),Lv(Z.view,A),bs(Z),U.mouse("end",Z)}function Y(Z,Q){if(P.call(this,Z,Q)){var me,fe,de=Z.changedTouches,ue=R.call(this,Z,Q),ce=de.length;for(me=0;me<ce;++me)(fe=ie(this,ue,Z,Q,de[me].identifier,de[me]))&&(Gh(Z),fe("start",Z,de[me]))}}function ee(Z){var Q,me,fe=Z.changedTouches,de=fe.length;for(Q=0;Q<de;++Q)(me=U[fe[Q].identifier])&&(bs(Z),me("drag",Z,fe[Q]))}function oe(Z){var Q,me,fe=Z.changedTouches,de=fe.length;for(M&&clearTimeout(M),M=setTimeout(function(){M=null},500),Q=0;Q<de;++Q)(me=U[fe[Q].identifier])&&(Gh(Z),me("end",Z,fe[Q]))}function ie(Z,Q,me,fe,de,ue){var ce,ke,Se,ae=D.copy(),Ce=uo(ue||me,Q);if((Se=L.call(Z,new Yh("beforestart",{sourceEvent:me,target:I,identifier:de,active:k,x:Ce[0],y:Ce[1],dx:0,dy:0,dispatch:ae}),fe))!=null)return ce=Se.x-Ce[0]||0,ke=Se.y-Ce[1]||0,function _e(Ee,ze,Oe){var He,Fe=Ce;switch(Ee){case"start":U[de]=_e,He=k++;break;case"end":delete U[de],--k;case"drag":Ce=uo(Oe||ze,Q),He=k}ae.call(Ee,Z,new Yh(Ee,{sourceEvent:ze,subject:Se,target:I,identifier:de,active:He,x:Ce[0]+ce,y:Ce[1]+ke,dx:Ce[0]-Fe[0],dy:Ce[1]-Fe[1],dispatch:ae}),fe)}}return I.filter=function(Z){return arguments.length?(P=typeof Z=="function"?Z:$l(!!Z),I):P},I.container=function(Z){return arguments.length?(R=typeof Z=="function"?Z:$l(Z),I):R},I.subject=function(Z){return arguments.length?(L=typeof Z=="function"?Z:$l(Z),I):L},I.touchable=function(Z){return arguments.length?(B=typeof Z=="function"?Z:$l(!!Z),I):B},I.on=function(){var Z=D.on.apply(D,arguments);return Z===D?I:Z},I.clickDistance=function(Z){return arguments.length?($=(Z=+Z)*Z,I):Math.sqrt($)},I}().on("start",j=>{const{domNode:T,nodeDragThreshold:A}=a.getState();A===0&&E(j),x.current=!1;const M=y(j);h.current=M,m.current=(T==null?void 0:T.getBoundingClientRect())||null,_.current=Qo(j.sourceEvent,m.current)}).on("drag",j=>{var P,R;const T=y(j),{autoPanOnNodeDrag:A,nodeDragThreshold:M}=a.getState();if(j.sourceEvent.type==="touchmove"&&j.sourceEvent.touches.length>1&&(x.current=!0),!x.current){if(!p.current&&b.current&&A&&(p.current=!0,S()),!b.current){const L=T.xSnapped-(((P=h==null?void 0:h.current)==null?void 0:P.x)??0),B=T.ySnapped-(((R=h==null?void 0:h.current)==null?void 0:R.y)??0);Math.sqrt(L*L+B*B)>M&&E(j)}(h.current.x!==T.xSnapped||h.current.y!==T.ySnapped)&&u.current&&b.current&&(g.current=j.sourceEvent,_.current=Qo(j.sourceEvent,m.current),C(T))}}).on("end",j=>{if(b.current&&!x.current&&(d(!1),p.current=!1,b.current=!1,cancelAnimationFrame(f.current),u.current)){const{updateNodePositions:T,nodeInternals:A,onNodeDragStop:M,onSelectionDragStop:P}=a.getState(),R=r?M:yf(P);if(T(u.current,!1,!1),R){const[L,B]=bf({nodeId:r,dragItems:u.current,nodeInternals:A});R(j.sourceEvent,L,B)}}}).filter(j=>{const T=j.target;return!j.button&&(!n||!D2(T,`.${n}`,t))&&(!o||D2(T,o,t))});return v.call(N),()=>{v.on(".drag",null)}}v.on(".drag",null)}},[t,e,n,o,s,a,r,i,y]),l}function F2(){const t=Gt();return O.useCallback(n=>{const{nodeInternals:o,nodeExtent:r,updateNodePositions:s,getNodes:i,snapToGrid:a,snapGrid:l,onError:d,nodesDraggable:u}=t.getState(),h=i().filter(x=>x.selected&&(x.draggable||u&&x.draggable===void 0)),f=a?l[0]:5,m=a?l[1]:5,_=n.isShiftPressed?4:1,g=n.x*f*_,p=n.y*m*_,b=h.map(x=>{if(x.positionAbsolute){const y={x:x.positionAbsolute.x+g,y:x.positionAbsolute.y+p};a&&(y.x=l[0]*Math.round(y.x/l[0]),y.y=l[1]*Math.round(y.y/l[1]));const{positionAbsolute:v,position:C}=R2(x,y,o,r,void 0,d);x.position=C,x.positionAbsolute=v}return x});s(b,!0,!1)},[])}const Ns={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Gi=t=>{const e=({id:n,type:o,data:r,xPos:s,yPos:i,xPosOrigin:a,yPosOrigin:l,selected:d,onClick:u,onMouseEnter:h,onMouseMove:f,onMouseLeave:m,onContextMenu:_,onDoubleClick:g,style:p,className:b,isDraggable:x,isSelectable:y,isConnectable:v,isFocusable:C,selectNodesOnDrag:S,sourcePosition:E,targetPosition:N,hidden:j,resizeObserver:T,dragHandle:A,zIndex:M,isParent:P,noDragClassName:R,noPanClassName:L,initialized:B,disableKeyboardA11y:U,ariaLabel:D,rfId:k,hasHandleBounds:$})=>{const I=Gt(),W=O.useRef(null),G=O.useRef(null),q=O.useRef(E),Y=O.useRef(N),ee=O.useRef(o),oe=y||x||u||h||f||m,ie=F2(),Z=qi(n,I.getState,h),Q=qi(n,I.getState,f),me=qi(n,I.getState,m),fe=qi(n,I.getState,_),de=qi(n,I.getState,g);O.useEffect(()=>()=>{G.current&&(T==null||T.unobserve(G.current),G.current=null)},[]),O.useEffect(()=>{if(W.current&&!j){const ce=W.current;B&&$&&G.current===ce||(G.current&&(T==null||T.unobserve(G.current)),T==null||T.observe(ce),G.current=ce)}},[j,B,$]),O.useEffect(()=>{const ce=ee.current!==o,ke=q.current!==E,Se=Y.current!==N;W.current&&(ce||ke||Se)&&(ce&&(ee.current=o),ke&&(q.current=E),Se&&(Y.current=N),I.getState().updateNodeDimensions([{id:n,nodeElement:W.current,forceUpdate:!0}]))},[n,o,E,N]);const ue=L2({nodeRef:W,disabled:j||!x,noDragClassName:R,handleSelector:A,nodeId:n,isSelectable:y,selectNodesOnDrag:S});return j?null:X.createElement("div",{className:cn(["react-flow__node",`react-flow__node-${o}`,{[L]:x},b,{selected:d,selectable:y,parent:P,dragging:ue}]),ref:W,style:{zIndex:M,transform:`translate(${a}px,${l}px)`,pointerEvents:oe?"all":"none",visibility:B?"visible":"hidden",...p},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:Z,onMouseMove:Q,onMouseLeave:me,onContextMenu:fe,onClick:ce=>{const{nodeDragThreshold:ke}=I.getState();if(y&&(!S||!x||ke>0)&&xf({id:n,store:I,nodeRef:W}),u){const Se=I.getState().nodeInternals.get(n);Se&&u(ce,{...Se})}},onDoubleClick:de,onKeyDown:C?ce=>{if(!ef(ce)&&!U)if(Hv.includes(ce.key)&&y){const ke=ce.key==="Escape";xf({id:n,store:I,unselect:ke,nodeRef:W})}else x&&d&&Object.prototype.hasOwnProperty.call(Ns,ce.key)&&(I.setState({ariaLiveMessage:`Moved selected node ${ce.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~s}, y: ${~~i}`}),ie({x:Ns[ce.key].x,y:Ns[ce.key].y,isShiftPressed:ce.shiftKey}))}:void 0,tabIndex:C?0:void 0,role:C?"button":void 0,"aria-describedby":U?void 0:`${y2}-${k}`,"aria-label":D},X.createElement(fP,{value:n},X.createElement(t,{id:n,data:r,type:o,xPos:s,yPos:i,selected:d,isConnectable:v,sourcePosition:E,targetPosition:N,dragging:ue,dragHandle:A,zIndex:M})))};return e.displayName="NodeWrapper",O.memo(e)};const zP=t=>{const e=t.getNodes().filter(n=>n.selected);return{...df(e,t.nodeOrigin),transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`,userSelectionActive:t.userSelectionActive}};var BP=O.memo(function({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const o=Gt(),{width:r,height:s,x:i,y:a,transformString:l,userSelectionActive:d}=mt(zP,nn),u=F2(),h=O.useRef(null);if(O.useEffect(()=>{var m;n||((m=h.current)==null||m.focus({preventScroll:!0}))},[n]),L2({nodeRef:h}),d||!r||!s)return null;const f=t?m=>{const _=o.getState().getNodes().filter(g=>g.selected);t(m,_)}:void 0;return X.createElement("div",{className:cn(["react-flow__nodesselection","react-flow__container",e]),style:{transform:l}},X.createElement("div",{ref:h,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:m=>{Object.prototype.hasOwnProperty.call(Ns,m.key)&&u({x:Ns[m.key].x,y:Ns[m.key].y,isShiftPressed:m.shiftKey})},style:{width:r,height:s,top:a,left:i}}))});const UP=t=>t.nodesSelectionActive,z2=({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:i,deleteKeyCode:a,onMove:l,onMoveStart:d,onMoveEnd:u,selectionKeyCode:h,selectionOnDrag:f,selectionMode:m,onSelectionStart:_,onSelectionEnd:g,multiSelectionKeyCode:p,panActivationKeyCode:b,zoomActivationKeyCode:x,elementsSelectable:y,zoomOnScroll:v,zoomOnPinch:C,panOnScroll:S,panOnScrollSpeed:E,panOnScrollMode:N,zoomOnDoubleClick:j,panOnDrag:T,defaultViewport:A,translateExtent:M,minZoom:P,maxZoom:R,preventScrolling:L,onSelectionContextMenu:B,noWheelClassName:U,noPanClassName:D,disableKeyboardA11y:k})=>{const $=mt(UP),I=Hi(h),W=Hi(b),G=W||T,q=W||S,Y=I||f&&G!==!0;return(({deleteKeyCode:ee,multiSelectionKeyCode:oe})=>{const ie=Gt(),{deleteElements:Z}=Wi(),Q=Hi(ee,MP),me=Hi(oe);O.useEffect(()=>{if(Q){const{edges:fe,getNodes:de}=ie.getState(),ue=de().filter(ke=>ke.selected),ce=fe.filter(ke=>ke.selected);Z({nodes:ue,edges:ce}),ie.setState({nodesSelectionActive:!1})}},[Q]),O.useEffect(()=>{ie.setState({multiSelectionActive:me})},[me])})({deleteKeyCode:a,multiSelectionKeyCode:p}),X.createElement(DP,{onMove:l,onMoveStart:d,onMoveEnd:u,onPaneContextMenu:s,elementsSelectable:y,zoomOnScroll:v,zoomOnPinch:C,panOnScroll:q,panOnScrollSpeed:E,panOnScrollMode:N,zoomOnDoubleClick:j,panOnDrag:!I&&G,defaultViewport:A,translateExtent:M,minZoom:P,maxZoom:R,zoomActivationKeyCode:x,preventScrolling:L,noWheelClassName:U,noPanClassName:D},X.createElement(M2,{onSelectionStart:_,onSelectionEnd:g,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:i,panOnDrag:G,isSelecting:!!Y,selectionMode:m},t,$&&X.createElement(BP,{onSelectionContextMenu:B,noPanClassName:D,disableKeyboardA11y:k})))};z2.displayName="FlowRenderer";var VP=O.memo(z2);function $P(t){return{input:Gi(t.input||p2),default:Gi(t.default||ff),output:Gi(t.output||_2),group:Gi(t.group||mf),...Object.keys(t).filter(e=>!["input","default","output","group"].includes(e)).reduce((e,n)=>(e[n]=Gi(t[n]||ff),e),{})}}const HP=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}=mt(HP,nn),a=(l=t.onlyRenderVisibleElements,mt(O.useCallback(h=>l?r2(h.nodeInternals,{x:0,y:0,width:h.width,height:h.height},h.transform,!0):h.getNodes(),[l])));var l;const d=O.useRef(),u=O.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const h=new ResizeObserver(f=>{const m=f.map(_=>({id:_.target.getAttribute("data-id"),nodeElement:_.target,forceUpdate:!0}));s(m)});return d.current=h,h},[]);return O.useEffect(()=>()=>{var h;(h=d==null?void 0:d.current)==null||h.disconnect()},[]),X.createElement("div",{className:"react-flow__nodes",style:gf},a.map(h=>{var S,E,N;let f=h.type||"default";t.nodeTypes[f]||(i==null||i("003",tP(f)),f="default");const m=t.nodeTypes[f]||t.nodeTypes.default,_=!!(h.draggable||e&&h.draggable===void 0),g=!!(h.selectable||r&&h.selectable===void 0),p=!!(h.connectable||n&&h.connectable===void 0),b=!!(h.focusable||o&&h.focusable===void 0),x=t.nodeExtent?Xh(h.positionAbsolute,t.nodeExtent):h.positionAbsolute,y=(x==null?void 0:x.x)??0,v=(x==null?void 0:x.y)??0,C=(({x:j,y:T,width:A,height:M,origin:P})=>A&&M?P[0]<0||P[1]<0||P[0]>1||P[1]>1?{x:j,y:T}:{x:j-A*P[0],y:T-M*P[1]}:{x:j,y:T})({x:y,y:v,width:h.width??0,height:h.height??0,origin:t.nodeOrigin});return X.createElement(m,{key:h.id,id:h.id,className:h.className,style:h.style,type:f,data:h.data,sourcePosition:h.sourcePosition||Ue.Bottom,targetPosition:h.targetPosition||Ue.Top,hidden:h.hidden,xPos:y,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:p,isFocusable:b,resizeObserver:u,dragHandle:h.dragHandle,zIndex:((S=h[Nt])==null?void 0:S.z)??0,isParent:!!((E=h[Nt])!=null&&E.isParent),noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,initialized:!!h.width&&!!h.height,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,ariaLabel:h.ariaLabel,hasHandleBounds:!!((N=h[Nt])!=null&&N.handleBounds)})}))};B2.displayName="NodeRenderer";var WP=O.memo(B2);const qP=(t,e,n)=>n===Ue.Left?t-e:n===Ue.Right?t+e:t,GP=(t,e,n)=>n===Ue.Top?t-e:n===Ue.Bottom?t+e:t,U2="react-flow__edgeupdater",V2=({position:t,centerX:e,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:s,onMouseOut:i,type:a})=>X.createElement("circle",{onMouseDown:r,onMouseEnter:s,onMouseOut:i,className:cn([U2,`${U2}-${a}`]),cx:qP(e,o,t),cy:GP(n,o,t),r:o,stroke:"transparent",fill:"transparent"}),YP=()=>!0;var js=t=>{const e=({id:n,className:o,type:r,data:s,onClick:i,onEdgeDoubleClick:a,selected:l,animated:d,label:u,labelStyle:h,labelShowBg:f,labelBgStyle:m,labelBgPadding:_,labelBgBorderRadius:g,style:p,source:b,target:x,sourceX:y,sourceY:v,targetX:C,targetY:S,sourcePosition:E,targetPosition:N,elementsSelectable:j,hidden:T,sourceHandleId:A,targetHandleId:M,onContextMenu:P,onMouseEnter:R,onMouseMove:L,onMouseLeave:B,reconnectRadius:U,onReconnect:D,onReconnectStart:k,onReconnectEnd:$,markerEnd:I,markerStart:W,rfId:G,ariaLabel:q,isFocusable:Y,isReconnectable:ee,pathOptions:oe,interactionWidth:ie,disableKeyboardA11y:Z})=>{const Q=O.useRef(null),[me,fe]=O.useState(!1),[de,ue]=O.useState(!1),ce=Gt(),ke=O.useMemo(()=>`url('#${lf(W,G)}')`,[W,G]),Se=O.useMemo(()=>`url('#${lf(I,G)}')`,[I,G]);if(T)return null;const ae=Ui(n,ce.getState,a),Ce=Ui(n,ce.getState,P),_e=Ui(n,ce.getState,R),Ee=Ui(n,ce.getState,L),ze=Ui(n,ce.getState,B),Oe=(Qe,tt)=>{if(Qe.button!==0)return;const{edges:ne,isValidConnection:ve}=ce.getState(),je=tt?x:b,Re=(tt?M:A)||null,J=tt?"target":"source",se=ve||YP,ge=tt,pe=ne.find(xe=>xe.id===n);ue(!0),k==null||k(Qe,pe,J),d2({event:Qe,handleId:Re,nodeId:je,onConnect:xe=>D==null?void 0:D(pe,xe),isTarget:ge,getState:ce.getState,setState:ce.setState,isValidConnection:se,edgeUpdaterType:J,onReconnectEnd:xe=>{ue(!1),$==null||$(xe,pe,J)}})},He=()=>fe(!0),Fe=()=>fe(!1),it=!j&&!i;return X.createElement("g",{className:cn(["react-flow__edge",`react-flow__edge-${r}`,o,{selected:l,animated:d,inactive:it,updating:me}]),onClick:Qe=>{var J;const{edges:tt,addSelectedEdges:ne,unselectNodesAndEdges:ve,multiSelectionActive:je}=ce.getState(),Re=tt.find(se=>se.id===n);Re&&(j&&(ce.setState({nodesSelectionActive:!1}),Re.selected&&je?(ve({nodes:[],edges:[Re]}),(J=Q.current)==null||J.blur()):ne([n])),i&&i(Qe,Re))},onDoubleClick:ae,onContextMenu:Ce,onMouseEnter:_e,onMouseMove:Ee,onMouseLeave:ze,onKeyDown:Y?Qe=>{var tt;if(!Z&&Hv.includes(Qe.key)&&j){const{unselectNodesAndEdges:ne,addSelectedEdges:ve,edges:je}=ce.getState();Qe.key==="Escape"?((tt=Q.current)==null||tt.blur(),ne({edges:[je.find(Re=>Re.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 ${x}`,"aria-describedby":Y?`${w2}-${G}`:void 0,ref:Q},!de&&X.createElement(t,{id:n,source:b,target:x,selected:l,animated:d,label:u,labelStyle:h,labelShowBg:f,labelBgStyle:m,labelBgPadding:_,labelBgBorderRadius:g,data:s,style:p,sourceX:y,sourceY:v,targetX:C,targetY:S,sourcePosition:E,targetPosition:N,sourceHandleId:A,targetHandleId:M,markerStart:ke,markerEnd:Se,pathOptions:oe,interactionWidth:ie}),ee&&X.createElement(X.Fragment,null,(ee==="source"||ee===!0)&&X.createElement(V2,{position:E,centerX:y,centerY:v,radius:U,onMouseDown:Qe=>Oe(Qe,!0),onMouseEnter:He,onMouseOut:Fe,type:"source"}),(ee==="target"||ee===!0)&&X.createElement(V2,{position:N,centerX:C,centerY:S,radius:U,onMouseDown:Qe=>Oe(Qe,!1),onMouseEnter:He,onMouseOut:Fe,type:"target"})))};return e.displayName="EdgeWrapper",O.memo(e)};function JP(t){return{default:js(t.default||Xl),straight:js(t.bezier||sf),step:js(t.step||rf),smoothstep:js(t.step||Jl),simplebezier:js(t.simplebezier||nf),...Object.keys(t).filter(e=>!["default","bezier"].includes(e)).reduce((e,n)=>(e[n]=js(t[n]||Xl),e),{})}}function $2(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 Ue.Top:return{x:o+s/2,y:r};case Ue.Right:return{x:o+s,y:r+i/2};case Ue.Bottom:return{x:o+s/2,y:r+i};case Ue.Left:return{x:o,y:r+i/2}}}function H2(t,e){return t?t.length!==1&&e?e&&t.find(n=>n.id===e)||null:t[0]:null}function W2(t){var o,r,s,i,a;const e=((o=t==null?void 0:t[Nt])==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 KP=[{level:0,isMaxLevel:!0,edges:[]}];function XP(t,e,n){return function(o,r,s=!1){let i=-1;const a=o.reduce((d,u)=>{var m,_;const h=Bn(u.zIndex);let f=h?u.zIndex:0;if(s){const g=r.get(u.target),p=r.get(u.source),b=u.selected||(g==null?void 0:g.selected)||(p==null?void 0:p.selected),x=Math.max(((m=p==null?void 0:p[Nt])==null?void 0:m.z)||0,((_=g==null?void 0:g[Nt])==null?void 0:_.z)||0,1e3);f=(h?u.zIndex:0)+(b?x:0)}return d[f]?d[f].push(u):d[f]=[u],i=f>i?f:i,d},{}),l=Object.entries(a).map(([d,u])=>{const h=+d;return{edges:u,level:h,isMaxLevel:h===i}});return l.length===0?KP:l}(mt(O.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:d,sourceHeight:u,targetWidth:h,targetHeight:f,width:m,height:_,transform:g}){const p={x:Math.min(a.x,l.x),y:Math.min(a.y,l.y),x2:Math.max(a.x+d,l.x+h),y2:Math.max(a.y+u,l.y+f)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const b=Zh({x:(0-g[0])/g[2],y:(0-g[1])/g[2],width:m/g[2],height:_/g[2]}),x=Math.max(0,Math.min(b.x2,p.x2)-Math.max(b.x,p.x)),y=Math.max(0,Math.min(b.y2,p.y2)-Math.max(b.y,p.y));return Math.ceil(x*y)>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 q2={[ys.Arrow]:({color:t="none",strokeWidth:e=1})=>X.createElement("polyline",{style:{stroke:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),[ys.ArrowClosed]:({color:t="none",strokeWidth:e=1})=>X.createElement("polyline",{style:{stroke:t,fill:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},ZP=({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(d){const u=Gt();return O.useMemo(()=>{var h,f;return Object.prototype.hasOwnProperty.call(q2,d)?q2[d]:((f=(h=u.getState()).onError)==null||f.call(h,"009",rP(d)),null)},[d])}(e);return l?X.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"},X.createElement(l,{color:n,strokeWidth:i})):null},G2=({defaultColor:t,rfId:e})=>{const n=mt(O.useCallback((({defaultColor:o,rfId:r})=>s=>{const i=[];return s.edges.reduce((a,l)=>([l.markerStart,l.markerEnd].forEach(d=>{if(d&&typeof d=="object"){const u=lf(d,r);i.includes(u)||(a.push({id:u,color:d.color||o,...d}),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 X.createElement("defs",null,n.map(o=>X.createElement(ZP,{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})))};G2.displayName="MarkerDefinitions";var QP=O.memo(G2);const eL=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}),Y2=({defaultMarkerColor:t,onlyRenderVisibleElements:e,elevateEdgesOnSelect:n,rfId:o,edgeTypes:r,noPanClassName:s,onEdgeContextMenu:i,onEdgeMouseEnter:a,onEdgeMouseMove:l,onEdgeMouseLeave:d,onEdgeClick:u,onEdgeDoubleClick:h,onReconnect:f,onReconnectStart:m,onReconnectEnd:_,reconnectRadius:g,children:p,disableKeyboardA11y:b})=>{const{edgesFocusable:x,edgesUpdatable:y,elementsSelectable:v,width:C,height:S,connectionMode:E,nodeInternals:N,onError:j}=mt(eL,nn),T=XP(e,N,n);return C?X.createElement(X.Fragment,null,T.map(({level:A,edges:M,isMaxLevel:P})=>X.createElement("svg",{key:A,style:{zIndex:A},width:C,height:S,className:"react-flow__edges react-flow__container"},P&&X.createElement(QP,{defaultColor:t,rfId:o}),X.createElement("g",null,M.map(R=>{const[L,B,U]=W2(N.get(R.source)),[D,k,$]=W2(N.get(R.target));if(!U||!$)return null;let I=R.type||"default";r[I]||(j==null||j("011",aP(I)),I="default");const W=r[I]||r.default,G=E===Dr.Strict?k.target:(k.target??[]).concat(k.source??[]),q=H2(B.source,R.sourceHandle),Y=H2(G,R.targetHandle),ee=(q==null?void 0:q.position)||Ue.Bottom,oe=(Y==null?void 0:Y.position)||Ue.Top,ie=!!(R.focusable||x&&R.focusable===void 0),Z=R.reconnectable||R.updatable,Q=f!==void 0&&(Z||y&&Z===void 0);if(!q||!Y)return j==null||j("008",sP(q,R)),null;const{sourceX:me,sourceY:fe,targetX:de,targetY:ue}=((ce,ke,Se,ae,Ce,_e)=>{const Ee=$2(Se,ce,ke),ze=$2(_e,ae,Ce);return{sourceX:Ee.x,sourceY:Ee.y,targetX:ze.x,targetY:ze.y}})(L,q,ee,D,Y,oe);return X.createElement(W,{key:R.id,id:R.id,className:cn([R.className,s]),type:I,data:R.data,selected:!!R.selected,animated:!!R.animated,hidden:!!R.hidden,label:R.label,labelStyle:R.labelStyle,labelShowBg:R.labelShowBg,labelBgStyle:R.labelBgStyle,labelBgPadding:R.labelBgPadding,labelBgBorderRadius:R.labelBgBorderRadius,style:R.style,source:R.source,target:R.target,sourceHandleId:R.sourceHandle,targetHandleId:R.targetHandle,markerEnd:R.markerEnd,markerStart:R.markerStart,sourceX:me,sourceY:fe,targetX:de,targetY:ue,sourcePosition:ee,targetPosition:oe,elementsSelectable:v,onContextMenu:i,onMouseEnter:a,onMouseMove:l,onMouseLeave:d,onClick:u,onEdgeDoubleClick:h,onReconnect:f,onReconnectStart:m,onReconnectEnd:_,reconnectRadius:g,rfId:o,ariaLabel:R.ariaLabel,isFocusable:ie,isReconnectable:Q,pathOptions:"pathOptions"in R?R.pathOptions:void 0,interactionWidth:R.interactionWidth,disableKeyboardA11y:b})})))),p):null};Y2.displayName="EdgeRenderer";var tL=O.memo(Y2);const nL=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function oL({children:t}){const e=mt(nL);return X.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:e}},t)}const rL={[Ue.Left]:Ue.Right,[Ue.Right]:Ue.Left,[Ue.Top]:Ue.Bottom,[Ue.Bottom]:Ue.Top},J2=({nodeId:t,handleType:e,style:n,type:o=tr.Bezier,CustomComponent:r,connectionStatus:s})=>{var S,E,N;const{fromNode:i,handleId:a,toX:l,toY:d,connectionMode:u}=mt(O.useCallback(j=>({fromNode:j.nodeInternals.get(t),handleId:j.connectionHandleId,toX:(j.connectionPosition.x-j.transform[0])/j.transform[2],toY:(j.connectionPosition.y-j.transform[1])/j.transform[2],connectionMode:j.connectionMode}),[t]),nn),h=(S=i==null?void 0:i[Nt])==null?void 0:S.handleBounds;let f=h==null?void 0:h[e];if(u===Dr.Loose&&(f=f||(h==null?void 0:h[e==="source"?"target":"source"])),!i||!f)return null;const m=a?f.find(j=>j.id===a):f[0],_=m?m.x+m.width/2:(i.width??0)/2,g=m?m.y+m.height/2:i.height??0,p=(((E=i.positionAbsolute)==null?void 0:E.x)??0)+_,b=(((N=i.positionAbsolute)==null?void 0:N.y)??0)+g,x=m==null?void 0:m.position,y=x?rL[x]:null;if(!x||!y)return null;if(r)return X.createElement(r,{connectionLineType:o,connectionLineStyle:n,fromNode:i,fromHandle:m,fromX:p,fromY:b,toX:l,toY:d,fromPosition:x,toPosition:y,connectionStatus:s});let v="";const C={sourceX:p,sourceY:b,sourcePosition:x,targetX:l,targetY:d,targetPosition:y};return o===tr.Bezier?[v]=n2(C):o===tr.Step?[v]=of({...C,borderRadius:0}):o===tr.SmoothStep?[v]=of(C):o===tr.SimpleBezier?[v]=Zv(C):v=`M${p},${b} ${l},${d}`,X.createElement("path",{d:v,fill:"none",className:"react-flow__connection-path",style:n})};J2.displayName="ConnectionLine";const sL=t=>({nodeId:t.connectionNodeId,handleType:t.connectionHandleType,nodesConnectable:t.nodesConnectable,connectionStatus:t.connectionStatus,width:t.width,height:t.height});function iL({containerStyle:t,style:e,type:n,component:o}){const{nodeId:r,handleType:s,nodesConnectable:i,width:a,height:l,connectionStatus:d}=mt(sL,nn);return r&&s&&a&&i?X.createElement("svg",{style:t,width:a,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container"},X.createElement("g",{className:cn(["react-flow__connection",d])},X.createElement(J2,{nodeId:r,handleType:s,style:e,type:n,CustomComponent:o,connectionStatus:d}))):null}function K2(t,e){return O.useRef(null),Gt(),O.useMemo(()=>e(t),[t])}const X2=({nodeTypes:t,edgeTypes:e,onMove:n,onMoveStart:o,onMoveEnd:r,onInit:s,onNodeClick:i,onEdgeClick:a,onNodeDoubleClick:l,onEdgeDoubleClick:d,onNodeMouseEnter:u,onNodeMouseMove:h,onNodeMouseLeave:f,onNodeContextMenu:m,onSelectionContextMenu:_,onSelectionStart:g,onSelectionEnd:p,connectionLineType:b,connectionLineStyle:x,connectionLineComponent:y,connectionLineContainerStyle:v,selectionKeyCode:C,selectionOnDrag:S,selectionMode:E,multiSelectionKeyCode:N,panActivationKeyCode:j,zoomActivationKeyCode:T,deleteKeyCode:A,onlyRenderVisibleElements:M,elementsSelectable:P,selectNodesOnDrag:R,defaultViewport:L,translateExtent:B,minZoom:U,maxZoom:D,preventScrolling:k,defaultMarkerColor:$,zoomOnScroll:I,zoomOnPinch:W,panOnScroll:G,panOnScrollSpeed:q,panOnScrollMode:Y,zoomOnDoubleClick:ee,panOnDrag:oe,onPaneClick:ie,onPaneMouseEnter:Z,onPaneMouseMove:Q,onPaneMouseLeave:me,onPaneScroll:fe,onPaneContextMenu:de,onEdgeContextMenu:ue,onEdgeMouseEnter:ce,onEdgeMouseMove:ke,onEdgeMouseLeave:Se,onReconnect:ae,onReconnectStart:Ce,onReconnectEnd:_e,reconnectRadius:Ee,noDragClassName:ze,noWheelClassName:Oe,noPanClassName:He,elevateEdgesOnSelect:Fe,disableKeyboardA11y:it,nodeOrigin:Qe,nodeExtent:tt,rfId:ne})=>{const ve=K2(t,$P),je=K2(e,JP);return function(Re){const J=Wi(),se=O.useRef(!1);O.useEffect(()=>{!se.current&&J.viewportInitialized&&Re&&(setTimeout(()=>Re(J),1),se.current=!0)},[Re,J.viewportInitialized])}(s),X.createElement(VP,{onPaneClick:ie,onPaneMouseEnter:Z,onPaneMouseMove:Q,onPaneMouseLeave:me,onPaneContextMenu:de,onPaneScroll:fe,deleteKeyCode:A,selectionKeyCode:C,selectionOnDrag:S,selectionMode:E,onSelectionStart:g,onSelectionEnd:p,multiSelectionKeyCode:N,panActivationKeyCode:j,zoomActivationKeyCode:T,elementsSelectable:P,onMove:n,onMoveStart:o,onMoveEnd:r,zoomOnScroll:I,zoomOnPinch:W,zoomOnDoubleClick:ee,panOnScroll:G,panOnScrollSpeed:q,panOnScrollMode:Y,panOnDrag:oe,defaultViewport:L,translateExtent:B,minZoom:U,maxZoom:D,onSelectionContextMenu:_,preventScrolling:k,noDragClassName:ze,noWheelClassName:Oe,noPanClassName:He,disableKeyboardA11y:it},X.createElement(oL,null,X.createElement(tL,{edgeTypes:je,onEdgeClick:a,onEdgeDoubleClick:d,onlyRenderVisibleElements:M,onEdgeContextMenu:ue,onEdgeMouseEnter:ce,onEdgeMouseMove:ke,onEdgeMouseLeave:Se,onReconnect:ae,onReconnectStart:Ce,onReconnectEnd:_e,reconnectRadius:Ee,defaultMarkerColor:$,noPanClassName:He,elevateEdgesOnSelect:!!Fe,disableKeyboardA11y:it,rfId:ne},X.createElement(iL,{style:x,type:b,component:y,containerStyle:v})),X.createElement("div",{className:"react-flow__edgelabel-renderer"}),X.createElement(WP,{nodeTypes:ve,onNodeClick:i,onNodeDoubleClick:l,onNodeMouseEnter:u,onNodeMouseMove:h,onNodeMouseLeave:f,onNodeContextMenu:m,selectNodesOnDrag:R,onlyRenderVisibleElements:M,noPanClassName:He,noDragClassName:ze,disableKeyboardA11y:it,nodeOrigin:Qe,nodeExtent:tt,rfId:ne})))};X2.displayName="GraphView";var aL=O.memo(X2);const wf=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],rr={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:wf,nodeExtent:wf,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Dr.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},lL=()=>((t,e)=>t?Rv(t,e):Rv)((t,e)=>({...rr,setNodes:n=>{const{nodeInternals:o,nodeOrigin:r,elevateNodesOnSelect:s}=e();t({nodeInternals:pf(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?pf(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:d}=e(),u=l==null?void 0:l.querySelector(".react-flow__viewport");if(!u)return;const h=window.getComputedStyle(u),{m22:f}=new window.DOMMatrixReadOnly(h.transform),m=n.reduce((g,p)=>{const b=r.get(p.id);if(b!=null&&b.hidden)r.set(b.id,{...b,[Nt]:{...b[Nt],handleBounds:void 0}});else if(b){const x=Kh(p.nodeElement);!(!x.width||!x.height||b.width===x.width&&b.height===x.height&&!p.forceUpdate)&&(r.set(b.id,{...b,[Nt]:{...b[Nt],handleBounds:{source:P2(".source",p.nodeElement,f,d),target:P2(".target",p.nodeElement,f,d)}},...x}),g.push({id:b.id,type:"dimensions",dimensions:x}))}return g},[]);C2(r,d);const _=i||s&&!i&&N2(e,{initial:!0,...a});t({nodeInternals:new Map(r),fitViewOnInitDone:_}),(m==null?void 0:m.length)>0&&(o==null||o(m))},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 d=pf(T2(n,a()),r,i,l);t({nodeInternals:d})}o==null||o(n)}},addSelectedNodes:n=>{const{multiSelectionActive:o,edges:r,getNodes:s}=e();let i,a=null;o?i=n.map(l=>or(l,!0)):(i=Cs(s(),n),a=Cs(r,[])),Ql({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=>or(l,!0)):(i=Cs(r,n),a=Cs(s(),[])),Ql({changedNodes:a,changedEdges:i,get:e,set:t})},unselectNodesAndEdges:({nodes:n,edges:o}={})=>{const{edges:r,getNodes:s}=e(),i=o||r;Ql({changedNodes:(n||s()).map(a=>(a.selected=!1,or(a.id,!1))),changedEdges:i.map(a=>or(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();Ql({changedNodes:o().filter(r=>r.selected).map(r=>or(r.id,!1)),changedEdges:n.filter(r=>r.selected).map(r=>or(r.id,!1)),get:e,set:t})},setNodeExtent:n=>{const{nodeInternals:o}=e();o.forEach(r=>{r.positionAbsolute=Xh(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 d=vr.translate(o[0]+n.x,o[1]+n.y).scale(o[2]),u=[[0,0],[r,s]],h=i==null?void 0:i.constrain()(d,u,l);return i.transform(a,h),o[0]!==h.x||o[1]!==h.y||o[2]!==h.k},cancelConnection:()=>t({connectionNodeId:rr.connectionNodeId,connectionHandleId:rr.connectionHandleId,connectionHandleType:rr.connectionHandleType,connectionStatus:rr.connectionStatus,connectionStartHandle:rr.connectionStartHandle,connectionEndHandle:rr.connectionEndHandle}),reset:()=>t({...rr})}),Object.is),vf=({children:t})=>{const e=O.useRef(null);return e.current||(e.current=lL()),X.createElement(eP,{value:e.current},t)};vf.displayName="ReactFlowProvider";const Z2=({children:t})=>O.useContext(Wl)?X.createElement(X.Fragment,null,t):X.createElement(vf,null,t);Z2.displayName="ReactFlowWrapper";const cL={input:p2,default:ff,output:_2,group:mf},dL={default:Xl,straight:sf,step:rf,smoothstep:Jl,simplebezier:nf},uL=[0,0],hL=[15,15],fL={x:0,y:0,zoom:1},mL={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},kf=O.forwardRef(({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:s=cL,edgeTypes:i=dL,onNodeClick:a,onEdgeClick:l,onInit:d,onMove:u,onMoveStart:h,onMoveEnd:f,onConnect:m,onConnectStart:_,onConnectEnd:g,onClickConnectStart:p,onClickConnectEnd:b,onNodeMouseEnter:x,onNodeMouseMove:y,onNodeMouseLeave:v,onNodeContextMenu:C,onNodeDoubleClick:S,onNodeDragStart:E,onNodeDrag:N,onNodeDragStop:j,onNodesDelete:T,onEdgesDelete:A,onSelectionChange:M,onSelectionDragStart:P,onSelectionDrag:R,onSelectionDragStop:L,onSelectionContextMenu:B,onSelectionStart:U,onSelectionEnd:D,connectionMode:k=Dr.Strict,connectionLineType:$=tr.Bezier,connectionLineStyle:I,connectionLineComponent:W,connectionLineContainerStyle:G,deleteKeyCode:q="Backspace",selectionKeyCode:Y="Shift",selectionOnDrag:ee=!1,selectionMode:oe=Vi.Full,panActivationKeyCode:ie="Space",multiSelectionKeyCode:Z=Gl()?"Meta":"Control",zoomActivationKeyCode:Q=Gl()?"Meta":"Control",snapToGrid:me=!1,snapGrid:fe=hL,onlyRenderVisibleElements:de=!1,selectNodesOnDrag:ue=!0,nodesDraggable:ce,nodesConnectable:ke,nodesFocusable:Se,nodeOrigin:ae=uL,edgesFocusable:Ce,edgesUpdatable:_e,elementsSelectable:Ee,defaultViewport:ze=fL,minZoom:Oe=.5,maxZoom:He=2,translateExtent:Fe=wf,preventScrolling:it=!0,nodeExtent:Qe,defaultMarkerColor:tt="#b1b1b7",zoomOnScroll:ne=!0,zoomOnPinch:ve=!0,panOnScroll:je=!1,panOnScrollSpeed:Re=.5,panOnScrollMode:J=er.Free,zoomOnDoubleClick:se=!0,panOnDrag:ge=!0,onPaneClick:pe,onPaneMouseEnter:xe,onPaneMouseMove:Ve,onPaneMouseLeave:Be,onPaneScroll:rt,onPaneContextMenu:le,children:Ie,onEdgeContextMenu:Me,onEdgeDoubleClick:$e,onEdgeMouseEnter:Ke,onEdgeMouseMove:Pe,onEdgeMouseLeave:Ye,onEdgeUpdate:ot,onEdgeUpdateStart:Xe,onEdgeUpdateEnd:ct,onReconnect:jt,onReconnectStart:Ft,onReconnectEnd:dn,reconnectRadius:Yt=10,edgeUpdaterRadius:Xn=10,onNodesChange:Is,onEdgesChange:ho,noDragClassName:Fo="nodrag",noWheelClassName:Vn="nowheel",noPanClassName:As="nopan",fitView:Ji=!1,fitViewOptions:Pz,connectOnClick:Lz=!0,attributionPosition:Fz,proOptions:zz,defaultEdgeOptions:Bz,elevateNodesOnSelect:Uz=!0,elevateEdgesOnSelect:Vz=!1,disableKeyboardA11y:V3=!1,autoPanOnConnect:$z=!0,autoPanOnNodeDrag:Hz=!0,connectionRadius:Wz=20,isValidConnection:qz,onError:Gz,style:Yz,id:$3,nodeDragThreshold:Jz,...Kz},Xz)=>{const mm=$3||"1";return X.createElement("div",{...Kz,style:{...Yz,...mL},ref:Xz,className:cn(["react-flow",r]),"data-testid":"rf__wrapper",id:$3},X.createElement(Z2,null,X.createElement(aL,{onInit:d,onMove:u,onMoveStart:h,onMoveEnd:f,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:x,onNodeMouseMove:y,onNodeMouseLeave:v,onNodeContextMenu:C,onNodeDoubleClick:S,nodeTypes:s,edgeTypes:i,connectionLineType:$,connectionLineStyle:I,connectionLineComponent:W,connectionLineContainerStyle:G,selectionKeyCode:Y,selectionOnDrag:ee,selectionMode:oe,deleteKeyCode:q,multiSelectionKeyCode:Z,panActivationKeyCode:ie,zoomActivationKeyCode:Q,onlyRenderVisibleElements:de,selectNodesOnDrag:ue,defaultViewport:ze,translateExtent:Fe,minZoom:Oe,maxZoom:He,preventScrolling:it,zoomOnScroll:ne,zoomOnPinch:ve,zoomOnDoubleClick:se,panOnScroll:je,panOnScrollSpeed:Re,panOnScrollMode:J,panOnDrag:ge,onPaneClick:pe,onPaneMouseEnter:xe,onPaneMouseMove:Ve,onPaneMouseLeave:Be,onPaneScroll:rt,onPaneContextMenu:le,onSelectionContextMenu:B,onSelectionStart:U,onSelectionEnd:D,onEdgeContextMenu:Me,onEdgeDoubleClick:$e,onEdgeMouseEnter:Ke,onEdgeMouseMove:Pe,onEdgeMouseLeave:Ye,onReconnect:jt??ot,onReconnectStart:Ft??Xe,onReconnectEnd:dn??ct,reconnectRadius:Yt??Xn,defaultMarkerColor:tt,noDragClassName:Fo,noWheelClassName:Vn,noPanClassName:As,elevateEdgesOnSelect:Vz,rfId:mm,disableKeyboardA11y:V3,nodeOrigin:ae,nodeExtent:Qe}),X.createElement(kP,{nodes:t,edges:e,defaultNodes:n,defaultEdges:o,onConnect:m,onConnectStart:_,onConnectEnd:g,onClickConnectStart:p,onClickConnectEnd:b,nodesDraggable:ce,nodesConnectable:ke,nodesFocusable:Se,edgesFocusable:Ce,edgesUpdatable:_e,elementsSelectable:Ee,elevateNodesOnSelect:Uz,minZoom:Oe,maxZoom:He,nodeExtent:Qe,onNodesChange:Is,onEdgesChange:ho,snapToGrid:me,snapGrid:fe,connectionMode:k,translateExtent:Fe,connectOnClick:Lz,defaultEdgeOptions:Bz,fitView:Ji,fitViewOptions:Pz,onNodesDelete:T,onEdgesDelete:A,onNodeDragStart:E,onNodeDrag:N,onNodeDragStop:j,onSelectionDrag:R,onSelectionDragStart:P,onSelectionDragStop:L,noPanClassName:As,nodeOrigin:ae,rfId:mm,autoPanOnConnect:$z,autoPanOnNodeDrag:Hz,onError:Gz,connectionRadius:Wz,isValidConnection:qz,nodeDragThreshold:Jz}),X.createElement(wP,{onSelectionChange:M}),Ie,X.createElement(dP,{proOptions:zz,position:Fz}),X.createElement(jP,{rfId:mm,disableKeyboardA11y:V3})))});function Q2(t){return e=>{const[n,o]=O.useState(e),r=O.useCallback(s=>o(i=>t(s,i)),[]);return[n,o,r]}}kf.displayName="ReactFlow";const ek=Q2(T2),tk=Q2(function(t,e){return A2(t,e)});function pL(){return X.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},X.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function gL(){return X.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},X.createElement("path",{d:"M0 0h32v4.2H0z"}))}function _L(){return X.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},X.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 bL(){return X.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},X.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 xL(){return X.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},X.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 Es=({children:t,className:e,...n})=>X.createElement("button",{type:"button",className:cn(["react-flow__controls-button",e]),...n},t);Es.displayName="ControlButton";const yL=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom}),nk=({style:t,showZoom:e=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:s,onZoomOut:i,onFitView:a,onInteractiveChange:l,className:d,children:u,position:h="bottom-left"})=>{const f=Gt(),[m,_]=O.useState(!1),{isInteractive:g,minZoomReached:p,maxZoomReached:b}=mt(yL,nn),{zoomIn:x,zoomOut:y,fitView:v}=Wi();return O.useEffect(()=>{_(!0)},[]),m?X.createElement(ql,{className:cn(["react-flow__controls",d]),position:h,style:t,"data-testid":"rf__controls"},e&&X.createElement(X.Fragment,null,X.createElement(Es,{onClick:()=>{x(),s==null||s()},className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:b},X.createElement(pL,null)),X.createElement(Es,{onClick:()=>{y(),i==null||i()},className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:p},X.createElement(gL,null))),n&&X.createElement(Es,{className:"react-flow__controls-fitview",onClick:()=>{v(r),a==null||a()},title:"fit view","aria-label":"fit view"},X.createElement(_L,null)),o&&X.createElement(Es,{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?X.createElement(xL,null):X.createElement(bL,null)),u):null};nk.displayName="Controls";var Un,wL=O.memo(nk);function vL({color:t,dimensions:e,lineWidth:n}){return X.createElement("path",{stroke:t,strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})}function kL({color:t,radius:e}){return X.createElement("circle",{cx:e,cy:e,r:e,fill:t})}(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(Un||(Un={}));const SL={[Un.Dots]:"#91919a",[Un.Lines]:"#eee",[Un.Cross]:"#e2e2e2"},CL={[Un.Dots]:1,[Un.Lines]:1,[Un.Cross]:6},NL=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function ok({id:t,variant:e=Un.Dots,gap:n=20,size:o,lineWidth:r=1,offset:s=2,color:i,style:a,className:l}){const d=O.useRef(null),{transform:u,patternId:h}=mt(NL,nn),f=i||SL[e],m=o||CL[e],_=e===Un.Dots,g=e===Un.Cross,p=Array.isArray(n)?n:[n,n],b=[p[0]*u[2]||1,p[1]*u[2]||1],x=m*u[2],y=g?[x,x]:b,v=_?[x/s,x/s]:[y[0]/s,y[1]/s];return X.createElement("svg",{className:cn(["react-flow__background",l]),style:{...a,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:d,"data-testid":"rf__background"},X.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]})`},_?X.createElement(kL,{color:f,radius:x/s}):X.createElement(vL,{dimensions:y,color:f,lineWidth:r})),X.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${h+t})`}))}ok.displayName="Background";var jL=O.memo(ok);function Sf(t){return Math.min(11*t+35,200)}const rk=X.createContext("LR"),sk=O.memo(t=>{const e=K.c(51),{data:n,selected:o}=t,r=Le(n.atom),s=Zc().inOrderIds.indexOf(r.id),i=o?"var(--gray-9)":"var(--gray-3)",a=mt(EL),l=O.use(rk);let d,u,h,f,m;if(e[0]!==r.code||e[1]!==i||e[2]!==l||e[3]!==o){const A=r.code.split(`
146
146
  `).length,M=l==="LR"?Ue.Left:Ue.Top;let P;e[8]!==i?(P={background:i},e[8]=i,e[9]=P):P=e[9],e[10]!==M||e[11]!==P?(h=c.jsx(nr,{type:"target",id:"inputs",position:M,style:P}),e[10]=M,e[11]=P,e[12]=h):h=e[12];const R=l==="LR"?Ue.Left:Ue.Top;let L;e[13]!==i?(L={background:i},e[13]=i,e[14]=L):L=e[14],e[15]!==R||e[16]!==L?(f=c.jsx(nr,{type:"source",id:"inputs",position:R,style:L}),e[15]=R,e[16]=L,e[17]=f):f=e[17];const B=o&&"border-primary";e[18]!==B?(u=Ne("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],d=Sf(A),e[0]=r.code,e[1]=i,e[2]=l,e[3]=o,e[4]=d,e[5]=u,e[6]=h,e[7]=f}else d=e[4],u=e[5],h=e[6],f=e[7];var _;let g;e[20]!==n.forceWidth||e[21]!==a?(m=n.forceWidth||(_=a,Math.min(Math.max(_-100,100),400)),e[20]=n.forceWidth,e[21]=a,e[22]=m):m=e[22],e[23]!==d||e[24]!==m?(g={height:d,width:m},e[23]=d,e[24]=m,e[25]=g):g=e[25];const p=q$(r.name,s);let b,x,y;e[26]!==p?(b=c.jsx("div",{className:"text-muted-foreground font-semibold text-xs py-1 px-2 bg-muted border-b",children:p}),e[26]=p,e[27]=b):b=e[27],e[28]!==r.code?(x=c.jsx(AW,{code:r.code}),e[28]=r.code,e[29]=x):x=e[29],e[30]!==u||e[31]!==g||e[32]!==b||e[33]!==x?(y=c.jsxs("div",{className:u,style:g,children:[b,x]}),e[30]=u,e[31]=g,e[32]=b,e[33]=x,e[34]=y):y=e[34];const v=l==="LR"?Ue.Right:Ue.Bottom;let C,S;e[35]!==i?(C={background:i},e[35]=i,e[36]=C):C=e[36],e[37]!==v||e[38]!==C?(S=c.jsx(nr,{type:"source",id:"outputs",position:v,style:C}),e[37]=v,e[38]=C,e[39]=S):S=e[39];const E=l==="LR"?Ue.Right:Ue.Bottom;let N,j,T;return e[40]!==i?(N={background:i},e[40]=i,e[41]=N):N=e[41],e[42]!==E||e[43]!==N?(j=c.jsx(nr,{type:"target",id:"outputs",position:E,style:N}),e[42]=E,e[43]=N,e[44]=j):j=e[44],e[45]!==y||e[46]!==S||e[47]!==j||e[48]!==h||e[49]!==f?(T=c.jsxs("div",{children:[h,f,y,S,j]}),e[45]=y,e[46]=S,e[47]=j,e[48]=h,e[49]=f,e[50]=T):T=e[50],T},(t,e)=>["data","selected","id"].every(n=>t[n]===e[n]));sk.displayName="CustomNode";const ik={custom:sk};function EL(t){const{width:e}=t;return e}const ak=t=>{const e=K.c(18),{maxCount:n,cellIds:o,onClick:r,skipScroll:s}=t,i=Zc();let a,l,d,u;if(e[0]!==o||e[1]!==i||e[2]!==n||e[3]!==r||e[4]!==s){d=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")?(_=c.jsx("div",{className:"text-muted-foreground",children:"--"}),e[10]=_):_=e[10],d=_;break e}let m;e[11]!==o.length||e[12]!==r||e[13]!==s?(m=(_,g)=>c.jsxs("span",{className:"truncate",children:[c.jsx(yr,{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]=m):m=e[14],a=f.slice(0,n).map(m),l=o.length>n&&c.jsxs(Ur,{children:[c.jsx(Hs,{asChild:!0,children:c.jsxs("span",{className:"whitespace-nowrap text-muted-foreground text-xs hover:underline cursor-pointer",children:["+",o.length-n," more"]})}),c.jsx(Fs,{className:"w-auto",children:c.jsx("div",{className:"flex flex-col gap-1 py-1",children:f.slice(n).map(_=>c.jsx(yr,{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]=d}else a=e[5],l=e[6],d=e[7];return d!==Symbol.for("react.early_return_sentinel")?d:(e[15]!==a||e[16]!==l?(u=c.jsxs(c.Fragment,{children:[a,l]}),e[15]=a,e[16]=l,e[17]=u):u=e[17],u)},Cf=t=>{const e=K.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,d;return e[5]!==o||e[6]!==r?(a=async u=>{r?r(u):(await _n(o),nt({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=c.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?(d=c.jsx("div",{className:"max-w-[130px]",...s,children:l}),e[12]=s,e[13]=l,e[14]=d):d=e[14],d},Nf=O.memo(t=>{const e=K.c(38),{onChange:n,view:o,settings:r,onSettingsChange:s}=t;let i;e[0]!==s||e[1]!==r?(i=(R,L)=>{s({...r,[R]:L})},e[0]=s,e[1]=r,e[2]=i):i=e[2];const a=i;let l,d,u,h,f,m;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(Hs,{asChild:!0,children:c.jsx(Ae,{variant:"text",size:"xs",children:c.jsx(Pm,{className:"w-4 h-4"})})}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx("div",{className:"font-semibold pb-4",children:"Settings"}),e[4]=d):d=e[4],e[5]!==a?(u=R=>a("hidePureMarkdown",!!R),e[5]=a,e[6]=u):u=e[6],e[7]!==r.hidePureMarkdown||e[8]!==u?(h=c.jsx(nS,{"data-testid":"hide-pure-markdown-checkbox",id:"hide-pure-markdown",checked:r.hidePureMarkdown,onCheckedChange:u}),e[7]=r.hidePureMarkdown,e[8]=u,e[9]=h):h=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(f=c.jsx(Fr,{htmlFor:"hide-pure-markdown",children:"Hide pure markdown"}),e[10]=f):f=e[10],e[11]!==h?(m=c.jsxs(Ur,{children:[l,c.jsxs(Fs,{className:"w-auto p-2 text-muted-foreground",children:[d,c.jsxs("div",{className:"flex items-center gap-2",children:[h,f]})]})]}),e[11]=h,e[12]=m):m=e[12];const _=m,g=o==="_minimap_";let p,b,x;e[13]!==n?(p=()=>n("_minimap_"),e[13]=n,e[14]=p):p=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(Qp,{className:"w-4 h-4 mr-1"}),e[15]=b):b=e[15],e[16]!==g||e[17]!==p?(x=c.jsxs(Ae,{variant:"outline",className:"bg-background","aria-selected":g,size:"xs",onClick:p,children:[b,"Mini Map"]}),e[16]=g,e[17]=p,e[18]=x):x=e[18];const y=o==="TB";let v,C,S;e[19]!==n?(v=()=>n("TB"),e[19]=n,e[20]=v):v=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(C=c.jsx(Ea,{className:"w-4 h-4 mr-1"}),e[21]=C):C=e[21],e[22]!==y||e[23]!==v?(S=c.jsxs(Ae,{variant:"outline",className:"bg-background","aria-selected":y,size:"xs",onClick:v,children:[C,"Vertical Tree"]}),e[22]=y,e[23]=v,e[24]=S):S=e[24];const E=o==="LR";let N,j,T,A;e[25]!==n?(N=()=>n("LR"),e[25]=n,e[26]=N):N=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(j=c.jsx(Ea,{className:"w-4 h-4 mr-1 transform -rotate-90"}),e[27]=j):j=e[27],e[28]!==E||e[29]!==N?(T=c.jsxs(Ae,{variant:"outline",className:"bg-background","aria-selected":E,size:"xs",onClick:N,children:[j," ","Horizontal Tree"]}),e[28]=E,e[29]=N,e[30]=T):T=e[30],e[31]!==x||e[32]!==S||e[33]!==T?(A=c.jsxs("div",{className:"flex gap-2",children:[x,S,T]}),e[31]=x,e[32]=S,e[33]=T,e[34]=A):A=e[34];const M=o!=="_minimap_"&&_;let P;return e[35]!==A||e[36]!==M?(P=c.jsxs(ql,{position:"top-right",className:"flex flex-col items-end gap-2",children:[A,M]}),e[35]=A,e[36]=M,e[37]=P):P=e[37],P});Nf.displayName="GraphToolbar";const tc=O.memo(t=>{const e=K.c(11),{selection:n,variables:o,onClearSelection:r}=t;if(!n)return null;const s=IL;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(m=>m.usedBy.includes(n.id)),h=Object.values(o).filter(m=>m.declaredBy.includes(n.id)),f=(m,_)=>c.jsxs(c.Fragment,{children:[m.length===0&&c.jsx("div",{className:"text-muted-foreground text-sm text-center",children:"--"}),c.jsx("div",{className:"grid grid-cols-5 gap-3 items-center text-sm py-1 flex-1 empty:hidden",children:m.map(g=>c.jsxs(X.Fragment,{children:[c.jsx(Cf,{declaredBy:g.declaredBy,name:g.name}),c.jsxs("div",{className:"truncate col-span-2",title:g.value??"",children:[g.value,c.jsxs("span",{className:"ml-1 truncate text-foreground/60 font-mono",children:["(",g.dataType,")"]})]}),c.jsx("div",{className:"truncate col-span-2 gap-1 items-center",children:c.jsx(ak,{skipScroll:!0,onClick:()=>s(_==="in"?g.declaredBy[0]:g.usedBy[0],g.name),maxCount:3,cellIds:g.usedBy})})]},g.name))})]});return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[c.jsx(sc,{className:"w-5 h-5"}),c.jsx(yr,{cellId:n.id}),c.jsx("div",{className:"flex-1"}),c.jsx(O0,{cellId:n.id,children:c.jsx(Ae,{variant:"ghost",size:"icon",children:c.jsx(ld,{className:"w-4 h-4"})})}),c.jsx(Ae,{variant:"text",size:"icon",onClick:()=>{r()},children:c.jsx(eo,{className:"w-4 h-4"})})]}),c.jsxs("div",{className:"text-sm flex flex-col py-3 pl-2 pr-4 flex-1 justify-center",children:[c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[c.jsx(wp,{className:"w-4 h-4"}),"Outputs"]}),f(h,"out")]}),c.jsx("hr",{className:"border-divider my-3"}),c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[c.jsx(fn,{className:"w-4 h-4"}),"Inputs"]}),f(u,"in")]})]})]})}if(n.type==="edge"){const u=Object.values(o).filter(h=>h.declaredBy.includes(n.source)&&h.usedBy.includes(n.target));return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[c.jsx(Aa,{className:"w-4 h-4"}),c.jsx(yr,{cellId:n.source}),c.jsx(sd,{className:"w-4 h-4"}),c.jsx(yr,{cellId:n.target})]}),c.jsx("div",{className:"grid grid-cols-4 gap-3 max-w-[350px] items-center text-sm p-3 flex-1",children:u.map(h=>c.jsxs(X.Fragment,{children:[c.jsx(Cf,{declaredBy:h.declaredBy,name:h.name,onClick:()=>{s(h.declaredBy[0],h.name)}}),c.jsx("div",{className:"truncate text-foreground/60 font-mono",children:h.dataType}),c.jsx("div",{className:"truncate col-span-2",title:h.value??"",children:h.value})]},h.name))})]})}},e[0]=r,e[1]=n.id,e[2]=n.source,e[3]=n.target,e[4]=n.type,e[5]=o,e[6]=i):i=e[6];const a=i;let l,d;return e[7]!==a?(l=a(),e[7]=a,e[8]=l):l=e[8],e[9]!==l?(d=c.jsx(ql,{position:"bottom-left",className:"max-h-[90%] flex flex-col w-[calc(100%-5rem)]",children:c.jsx("div",{className:"min-h-[100px] shadow-md rounded-md border max-w-[550px] border-primary/40 my-4 min-w-[240px] bg-[var(--slate-1)] text-muted-foreground/80 flex flex-col overflow-y-auto",children:l})}),e[9]=l,e[10]=d):d=e[10],d});function IL(t,e){const n=Qi(t);n&&ip(n,e)}function lk(){const t=K.c(7),e=Wi(),n=mt(TL),o=mt(AL);let r;t[0]!==e?(r=()=>{e.fitView({duration:100})},t[0]=e,t[1]=r):r=t[1];const s=G$(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]),O.useEffect(i,a)}function AL(t){const{height:e}=t;return e}function TL(t){const{width:e}=t;return e}tc.displayName="GraphSelectionPanel";const ck=new class{createEdge(t,e,n){return{type:"smoothstep",pathOptions:{offset:20,borderRadius:100},data:{direction:n},markerEnd:{type:ys.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(at.get(e).code.trim().split(`
147
147
  `).length),position:{x:0,y:n+20}}}createElements(t,e,n,o){let r=0;const s=[],i=[];for(const[l,d]of rp.zip(t,e)){const u=this.createNode(l,d,r);s.push(u),r=u.position.y+(u.height||0)}const a=new Set;for(const l of Object.values(n)){const{declaredBy:d,usedBy:u}=l;for(const h of d)for(const f of u){const m=`${h}-${f}`;a.has(m)||(a.add(m),i.push(this.createEdge(h,f,"inputs"),this.createEdge(h,f,"outputs")))}}return{nodes:s,edges:i}}},ML=t=>{const e=K.c(37),{cellIds:n,variables:o,cellAtoms:r,children:s}=t;let i;e[0]!==r||e[1]!==n||e[2]!==o?(i=ck.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 d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=[],e[4]=d):d=e[4];const[u,h]=tk(d),[f,m]=ek(a),[_,g]=O.useState(),[p,b]=O.useState(),x=O.useRef(!1);lk();const y=mt(OL);let v;e[5]!==h||e[6]!==m?(v=k=>{m(k.nodes),h([])},e[5]=h,e[6]=m,e[7]=v):v=e[7];const C=qe(v);let S,E,N,j;e[8]!==r||e[9]!==n||e[10]!==C||e[11]!==o?(S=()=>{x.current?C(ck.createElements(n,r,o,!1)):x.current=!0},E=[n,o,r,C],e[8]=r,e[9]=n,e[10]=C,e[11]=o,e[12]=S,e[13]=E):(S=e[12],E=e[13]),O.useEffect(S,E),e[14]!==l||e[15]!==_||e[16]!==h?(N=()=>{if(_){const k=l.filter($=>{const{source:I,target:W,data:G}=$;return I===_&&G.direction==="outputs"||W===_&&G.direction==="inputs"});h(k)}},j=[_,h,l],e[14]=l,e[15]=_,e[16]=h,e[17]=N,e[18]=j):(N=e[17],j=e[18]),O.useEffect(N,j);const T=function(k,$){const I=K.c(17);let W,G;if(I[0]!==$||I[1]!==k){let Q;I[3]!==$?(Q=(me,fe)=>{const{position:de}=fe;return Math.min(me,de.y-$/2-10)},I[3]=$,I[4]=Q):Q=I[4],G=k.reduce(Q,Number.POSITIVE_INFINITY),I[0]=$,I[1]=k,I[2]=G}else G=I[2];const q=G;let Y;if(I[5]!==$||I[6]!==k){let Q;I[8]!==$?(Q=(me,fe)=>{const{position:de}=fe;return Math.max(me,de.y+$/2+10)},I[8]=$,I[9]=Q):Q=I[9],Y=k.reduce(Q,Number.NEGATIVE_INFINITY),I[5]=$,I[6]=k,I[7]=Y}else Y=I[7];const ee=Y;let oe,ie,Z;return I[10]!==q?(oe=[Number.NEGATIVE_INFINITY,q],I[10]=q,I[11]=oe):oe=I[11],I[12]!==ee?(ie=[Number.POSITIVE_INFINITY,ee],I[12]=ee,I[13]=ie):ie=I[13],I[14]!==oe||I[15]!==ie?(Z=[oe,ie],I[14]=oe,I[15]=ie,I[16]=Z):Z=I[16],W=Z,W}(f,y);let A;e[19]===Symbol.for("react.memo_cache_sentinel")?(A=()=>{g(void 0),b(void 0)},e[19]=A):A=e[19];const M=A;let P;e[20]!==u||e[21]!==p||e[22]!==_||e[23]!==o?(P=()=>p?c.jsx(tc,{selection:{type:"edge",source:p.source,target:p.target},onClearSelection:M,variables:o,edges:u}):_?c.jsx(tc,{selection:{type:"node",id:_},variables:o,edges:u,onClearSelection:M}):null,e[20]=u,e[21]=p,e[22]=_,e[23]=o,e[24]=P):P=e[24];const R=P;let L,B,U,D;return e[25]!==h?(L=(k,$)=>{const I=$.id;g(I),b(void 0),h([])},e[25]=h,e[26]=L):L=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(B=(k,$)=>{b($)},e[27]=B):B=e[27],e[28]!==R?(U=R(),e[28]=R,e[29]=U):U=e[29],e[30]!==s||e[31]!==u||e[32]!==f||e[33]!==L||e[34]!==U||e[35]!==T?(D=c.jsxs(kf,{nodes:f,edges:u,nodeTypes:ik,translateExtent:T,onNodeClick:L,onNodeDoubleClick:DL,onEdgeClick:B,snapToGrid:!0,fitView:!0,elementsSelectable:!0,minZoom:1,maxZoom:1,draggable:!1,panOnScrollMode:er.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]=L,e[34]=U,e[35]=T,e[36]=D):D=e[36],D};function OL(t){const{height:e}=t;return e}function DL(t,e){jS(e.id,"focus")}var jf,dk,uk,hk,fk,mk,Ef,pk,If,gk,Af,_k,Tf,bk,Mf,xk,Of,yk,Df,wk,Rf,vk,Pf,kk,Lf,Sk,Ff,Ck,zf,Nk,Bf,jk,Uf,Ek,Ik,Ak,Tk,Mk,Ok,Dk,Vf,Rk,$f,Pk,Hf,Lk,Wf,Fk,qf,zk,Gf,Bk,Yf,Uk,Jf,Vk,Kf,$k,Xf,Hk,Zf,Wk,Qf,qk,em,Gk,tm,Yk,Jk,Kk,Xk,Zk,Qk,e3,nm,t3,om,n3,o3,r3,rm,s3,sm,i3,im,a3,am,l3,lm,c3,d3,u3,h3,f3;function cm(){if(dk)return jf;dk=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 d=""+i,u=""+a;if(!s&&d>u){var h=d;d=u,u=h}return d+""+u+""+(l===void 0?"\0":l)}function r(s,i){return o(s,i.v,i.w,i.name)}return jf=class{constructor(s){te(this,"_isDirected",!0);te(this,"_isMultigraph",!1);te(this,"_isCompound",!1);te(this,"_label");te(this,"_defaultNodeLabelFn",()=>{});te(this,"_defaultEdgeLabelFn",()=>{});te(this,"_nodes",{});te(this,"_in",{});te(this,"_preds",{});te(this,"_out",{});te(this,"_sucs",{});te(this,"_edgeObjs",{});te(this,"_edgeLabels",{});te(this,"_nodeCount",0);te(this,"_edgeCount",0);te(this,"_parent");te(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(d){a.length>1?l.setNode(d,i):l.setNode(d)}),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 d(u){var h=a.parent(u);return h===void 0||i.hasNode(h)?(l[u]=h,h):h in l?l[h]:d(h)}return this._isCompound&&i.nodes().forEach(u=>i.setParent(u,d(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(d,u){return l.length>1?a.setEdge(d,u,i):a.setEdge(d,u),u}),this}setEdge(){var s,i,a,l,d=!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],d=!0)):(s=u,i=arguments[1],a=arguments[3],arguments.length>2&&(l=arguments[2],d=!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 d&&(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]=d?l:this._defaultEdgeLabelFn(s,i,a);var f=function(m,_,g,p){var b=""+_,x=""+g;if(!m&&b>x){var y=b;b=x,x=y}var v={v:b,w:x};return p&&(v.name=p),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),d=this._edgeObjs[l];return d&&(s=d.v,i=d.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(d=>d.v===i):l}}outEdges(s,i){var a=this._out[s];if(a){var l=Object.values(a);return i?l.filter(d=>d.w===i):l}}nodeEdges(s,i){var a=this.inEdges(s,i);if(a)return a.concat(this.outEdges(s,i))}},jf}function RL(){return mk?fk:(mk=1,fk={Graph:cm(),version:hk?uk:(hk=1,uk="2.2.4")})}function PL(){if(pk)return Ef;pk=1;var t=cm();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 Ef={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}},Ef}function LL(){return gk||(gk=1,If=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}),If}function m3(){return _k?Af:(_k=1,Af=class{constructor(){te(this,"_arr",[]);te(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}},Af)}function p3(){if(bk)return Tf;bk=1;var t=m3();Tf=function(n,o,r,s){return function(i,a,l,d){var u,h,f={},m=new t,_=function(g){var p=g.v!==u?g.v:g.w,b=f[p],x=l(g),y=h.distance+x;if(x<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+g+" Weight: "+x);y<b.distance&&(b.distance=y,b.predecessor=u,m.decrease(p,y))};for(i.nodes().forEach(function(g){var p=g===a?0:Number.POSITIVE_INFINITY;f[g]={distance:p},m.add(g,p)});m.size()>0&&(u=m.removeMin(),(h=f[u]).distance!==Number.POSITIVE_INFINITY);)d(u).forEach(_);return f}(n,String(o),r||e,s||function(i){return n.outEdges(i)})};var e=()=>1;return Tf}function FL(){if(xk)return Mf;xk=1;var t=p3();return Mf=function(e,n,o){return e.nodes().reduce(function(r,s){return r[s]=t(e,s,n,o),r},{})},Mf}function g3(){return yk||(yk=1,Of=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,d=[];do l=n.pop(),o[l].onStack=!1,d.push(l);while(i!==l);r.push(d)}}return t.nodes().forEach(function(i){Object.hasOwn(o,i)||s(i)}),r}),Of}function zL(){if(wk)return Df;wk=1;var t=g3();return Df=function(e){return t(e).filter(function(n){return n.length>1||n.length===1&&e.hasEdge(n[0],n[0])})},Df}function BL(){if(vk)return Rf;vk=1,Rf=function(e,n,o){return function(r,s,i){var a={},l=r.nodes();return l.forEach(function(d){a[d]={},a[d][d]={distance:0},l.forEach(function(u){d!==u&&(a[d][u]={distance:Number.POSITIVE_INFINITY})}),i(d).forEach(function(u){var h=u.v===d?u.w:u.v,f=s(u);a[d][h]={distance:f,predecessor:d}})}),l.forEach(function(d){var u=a[d];l.forEach(function(h){var f=a[h];l.forEach(function(m){var _=f[d],g=u[m],p=f[m],b=_.distance+g.distance;b<p.distance&&(p.distance=b,p.predecessor=g.predecessor)})})}),a}(e,n||t,o||function(r){return e.outEdges(r)})};var t=()=>1;return Rf}function _3(){if(kk)return Pf;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}kk=1;class e extends Error{constructor(){super(...arguments)}}return Pf=t,t.CycleException=e,Pf}function UL(){if(Sk)return Lf;Sk=1;var t=_3();return Lf=function(e){try{t(e)}catch(n){if(n instanceof t.CycleException)return!1;throw n}return!0},Lf}function b3(){if(Ck)return Ff;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]),d=>a.push([d,!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),d=>a.push(d)))}}function n(o,r){for(var s=o.length;s--;)r(o[s],s,o);return o}return Ck=1,Ff=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=[],d={};return r.forEach(u=>{if(!o.hasNode(u))throw new Error("Graph does not have node: "+u);a(u,i,d,l)}),l},Ff}function VL(){if(Nk)return zf;Nk=1;var t=b3();return zf=function(e,n){return t(e,n,"post")},zf}function $L(){if(jk)return Bf;jk=1;var t=b3();return Bf=function(e,n){return t(e,n,"pre")},Bf}function HL(){if(Ek)return Uf;Ek=1;var t=cm(),e=m3();return Uf=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 m=o(u);m<f&&(i[h]=r,a.decrease(h,m))}}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 d=!1;a.size()>0;){if(r=a.removeMin(),Object.hasOwn(i,r))s.setEdge(r,i[r]);else{if(d)throw new Error("Input graph is not connected: "+n);d=!0}n.nodeEdges(r).forEach(l)}return s},Uf}function Kn(){if(Mk)return Tk;Mk=1;var t=RL();return Tk={Graph:t.Graph,json:PL(),alg:Ak?Ik:(Ak=1,Ik={components:LL(),dijkstra:p3(),dijkstraAll:FL(),findCycles:zL(),floydWarshall:BL(),isAcyclic:UL(),postorder:VL(),preorder:$L(),prim:HL(),tarjan:g3(),topsort:_3()}),version:t.version}}function WL(){if(Rk)return Vf;Rk=1;let t=Kn().Graph,e=function(){if(Dk)return Ok;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 Dk=1,Ok=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,d=l._prev;for(;d!==l;)a.push(JSON.stringify(d,i)),d=d._prev;return"["+a.join(", ")+"]"}}}();Vf=function(s,i){if(s.nodeCount()<=1)return[];let a=function(l,d){let u=new t,h=0,f=0;l.nodes().forEach(g=>{u.setNode(g,{v:g,in:0,out:0})}),l.edges().forEach(g=>{let p=u.edge(g.v,g.w)||0,b=d(g),x=p+b;u.setEdge(g.v,g.w,x),f=Math.max(f,u.node(g.v).out+=b),h=Math.max(h,u.node(g.w).in+=b)});let m=function(g){const p=[];for(let b=0;b<g;b++)p.push(b);return p}(f+h+3).map(()=>new e),_=h+1;return u.nodes().forEach(g=>{r(m,_,u.node(g))}),{graph:u,buckets:m,zeroIdx:_}}(s,i||n);return function(l,d,u){let h,f=[],m=d[d.length-1],_=d[0];for(;l.nodeCount();){for(;h=_.dequeue();)o(l,d,u,h);for(;h=m.dequeue();)o(l,d,u,h);if(l.nodeCount()){for(let g=d.length-2;g>0;--g)if(h=d[g].dequeue(),h){f=f.concat(o(l,d,u,h,!0));break}}}return f}(a.graph,a.buckets,a.zeroIdx).flatMap(l=>s.outEdges(l.v,l.w))};let n=()=>1;function o(s,i,a,l,d){let u=d?[]:void 0;return s.inEdges(l.v).forEach(h=>{let f=s.edge(h),m=s.node(h.v);d&&u.push({v:h.v,w:h.w}),m.out-=f,r(i,a,m)}),s.outEdges(l.v).forEach(h=>{let f=s.edge(h),m=h.w,_=s.node(m);_.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 Vf}function Lt(){if(Pk)return $f;Pk=1;let t=Kn().Graph;function e(d,u,h,f){for(var m=f;d.hasNode(m);)m=i(f);return h.dummy=u,d.setNode(m,h),m}$f={addBorderNode:function(d,u,h,f){let m={width:0,height:0};return arguments.length>=4&&(m.rank=h,m.order=f),e(d,"border",m,u)},addDummyNode:e,applyWithChunking:o,asNonCompoundGraph:function(d){let u=new t({multigraph:d.isMultigraph()}).setGraph(d.graph());return d.nodes().forEach(h=>{d.children(h).length||u.setNode(h,d.node(h))}),d.edges().forEach(h=>{u.setEdge(h,d.edge(h))}),u},buildLayerMatrix:function(d){let u=a(r(d)+1).map(()=>[]);return d.nodes().forEach(h=>{let f=d.node(h),m=f.rank;m!==void 0&&(u[m][f.order]=h)}),u},intersectRect:function(d,u){let h,f,m=d.x,_=d.y,g=u.x-m,p=u.y-_,b=d.width/2,x=d.height/2;if(!g&&!p)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(p)*b>Math.abs(g)*x?(p<0&&(x=-x),h=x*g/p,f=x):(g<0&&(b=-b),h=b,f=b*p/g),{x:m+h,y:_+f}},mapValues:function(d,u){let h=u;return typeof u=="string"&&(h=f=>f[u]),Object.entries(d).reduce((f,[m,_])=>(f[m]=h(_,m),f),{})},maxRank:r,normalizeRanks:function(d){let u=d.nodes().map(f=>{let m=d.node(f).rank;return m===void 0?Number.MAX_VALUE:m}),h=o(Math.min,u);d.nodes().forEach(f=>{let m=d.node(f);Object.hasOwn(m,"rank")&&(m.rank-=h)})},notime:function(d,u){return u()},partition:function(d,u){let h={lhs:[],rhs:[]};return d.forEach(f=>{u(f)?h.lhs.push(f):h.rhs.push(f)}),h},pick:function(d,u){const h={};for(const f of u)d[f]!==void 0&&(h[f]=d[f]);return h},predecessorWeights:function(d){let u=d.nodes().map(h=>{let f={};return d.inEdges(h).forEach(m=>{f[m.v]=(f[m.v]||0)+d.edge(m).weight}),f});return l(d.nodes(),u)},range:a,removeEmptyRanks:function(d){let u=d.nodes().map(g=>d.node(g).rank),h=o(Math.min,u),f=[];d.nodes().forEach(g=>{let p=d.node(g).rank-h;f[p]||(f[p]=[]),f[p].push(g)});let m=0,_=d.graph().nodeRankFactor;Array.from(f).forEach((g,p)=>{g===void 0&&p%_!==0?--m:g!==void 0&&m&&g.forEach(b=>d.node(b).rank+=m)})},simplify:function(d){let u=new t().setGraph(d.graph());return d.nodes().forEach(h=>u.setNode(h,d.node(h))),d.edges().forEach(h=>{let f=u.edge(h.v,h.w)||{weight:0,minlen:1},m=d.edge(h);u.setEdge(h.v,h.w,{weight:f.weight+m.weight,minlen:Math.max(f.minlen,m.minlen)})}),u},successorWeights:function(d){let u=d.nodes().map(h=>{let f={};return d.outEdges(h).forEach(m=>{f[m.w]=(f[m.w]||0)+d.edge(m).weight}),f});return l(d.nodes(),u)},time:function(d,u){let h=Date.now();try{return u()}finally{console.log(d+" time: "+(Date.now()-h)+"ms")}},uniqueId:i,zipObject:l};const n=65535;function o(d,u){if(u.length>n){const h=function(f,m=n){const _=[];for(let g=0;g<f.length;g+=m){const p=f.slice(g,g+m);_.push(p)}return _}(u);return d.apply(null,h.map(f=>d.apply(null,f)))}return d.apply(null,u)}function r(d){const u=d.nodes().map(h=>{let f=d.node(h).rank;return f===void 0?Number.MIN_VALUE:f});return o(Math.max,u)}let s=0;function i(d){return d+""+ ++s}function a(d,u,h=1){u==null&&(u=d,d=0);let f=_=>_<u;h<0&&(f=_=>u<_);const m=[];for(let _=d;f(_);_+=h)m.push(_);return m}function l(d,u){return d.reduce((h,f,m)=>(h[f]=u[m],h),{})}return $f}function qL(){if(Lk)return Hf;Lk=1;let t=WL(),e=Lt().uniqueId;return Hf={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(d){Object.hasOwn(a,d)||(a[d]=!0,i[d]=!0,r.outEdges(d).forEach(u=>{Object.hasOwn(i,u.w)?s.push(u):l(u.w)}),delete i[d])}return r.nodes().forEach(l),s}(n)).forEach(r=>{let s=n.edge(r);n.removeEdge(r),s.forwardName=r.name,s.reversed=!0,n.setEdge(r.w,r.v,s,e("rev"))})},undo:function(n){n.edges().forEach(o=>{let r=n.edge(o);if(r.reversed){n.removeEdge(o);let s=r.forwardName;delete r.reversed,delete r.forwardName,n.setEdge(o.w,o.v,r,s)}})}},Hf}function GL(){if(Fk)return Wf;Fk=1;let t=Lt();return Wf={run:function(e){e.graph().dummyChains=[],e.edges().forEach(n=>function(o,r){let s,i,a,l=r.v,d=o.node(l).rank,u=r.w,h=o.node(u).rank,f=r.name,m=o.edge(r),_=m.labelRank;if(h!==d+1){for(o.removeEdge(r),a=0,++d;d<h;++a,++d)m.points=[],i={width:0,height:0,edgeLabel:m,edgeObj:r,rank:d},s=t.addDummyNode(o,"edge",i,"_d"),d===_&&(i.width=m.width,i.height=m.height,i.dummy="edge-label",i.labelpos=m.labelpos),o.setEdge(l,s,{weight:m.weight},f),a===0&&o.graph().dummyChains.push(s),l=s;o.setEdge(l,u,{weight:m.weight},f)}}(e,n))},undo:function(e){e.graph().dummyChains.forEach(n=>{let o,r=e.node(n),s=r.edgeLabel;for(e.setEdge(r.edgeObj,s);r.dummy;)o=e.successors(n)[0],e.removeNode(n),s.points.push({x:r.x,y:r.y}),r.dummy==="edge-label"&&(s.x=r.x,s.y=r.y,s.width=r.width,s.height=r.height),n=o,r=e.node(n)})}},Wf}function nc(){if(zk)return qf;zk=1;const{applyWithChunking:t}=Lt();return qf={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}},qf}function x3(){if(Bk)return Gf;Bk=1;var t=Kn().Graph,e=nc().slack;function n(s,i){return s.nodes().forEach(function a(l){i.nodeEdges(l).forEach(d=>{var u=d.v,h=l===u?d.w:u;s.hasNode(h)||e(i,d)||(s.setNode(h,{}),s.setEdge(l,h,{}),a(h))})}),s.nodeCount()}function o(s,i){return i.edges().reduce((a,l)=>{let d=Number.POSITIVE_INFINITY;return s.hasNode(l.v)!==s.hasNode(l.w)&&(d=e(i,l)),d<a[0]?[d,l]:a},[Number.POSITIVE_INFINITY,null])[1]}function r(s,i,a){s.nodes().forEach(l=>i.node(l).rank+=a)}return Gf=function(s){var i,a,l=new t({directed:!1}),d=s.nodes()[0],u=s.nodeCount();for(l.setNode(d,{});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},Gf}function YL(){if(Uk)return Yf;Uk=1;var t=x3(),e=nc().slack,n=nc().longestPath,o=Kn().alg.preorder,r=Kn().alg.postorder,s=Lt().simplify;function i(g){g=s(g),n(g);var p,b=t(g);for(d(b),a(b,g);p=h(b);)m(b,g,p,f(b,g,p))}function a(g,p){var b=r(g,g.nodes());(b=b.slice(0,b.length-1)).forEach(x=>function(y,v,C){var S=y.node(C),E=S.parent;y.edge(C,E).cutvalue=l(y,v,C)}(g,p,x))}function l(g,p,b){var x=g.node(b).parent,y=!0,v=p.edge(b,x),C=0;return v||(y=!1,v=p.edge(x,b)),C=v.weight,p.nodeEdges(b).forEach(S=>{var E,N,j=S.v===b,T=j?S.w:S.v;if(T!==x){var A=j===y,M=p.edge(S).weight;if(C+=A?M:-M,E=b,N=T,g.hasEdge(E,N)){var P=g.edge(b,T).cutvalue;C+=A?-P:P}}}),C}function d(g,p){arguments.length<2&&(p=g.nodes()[0]),u(g,{},1,p)}function u(g,p,b,x,y){var v=b,C=g.node(x);return p[x]=!0,g.neighbors(x).forEach(S=>{Object.hasOwn(p,S)||(b=u(g,p,b,S,x))}),C.low=v,C.lim=b++,y?C.parent=y:delete C.parent,b}function h(g){return g.edges().find(p=>g.edge(p).cutvalue<0)}function f(g,p,b){var x=b.v,y=b.w;p.hasEdge(x,y)||(x=b.w,y=b.v);var v=g.node(x),C=g.node(y),S=v,E=!1;v.lim>C.lim&&(S=C,E=!0);var N=p.edges().filter(j=>E===_(g,g.node(j.v),S)&&E!==_(g,g.node(j.w),S));return N.reduce((j,T)=>e(p,T)<e(p,j)?T:j)}function m(g,p,b,x){var y=b.v,v=b.w;g.removeEdge(y,v),g.setEdge(x.v,x.w,{}),d(g),a(g,p),function(C,S){var E=C.nodes().find(j=>!S.node(j).parent),N=o(C,E);(N=N.slice(1)).forEach(j=>{var T=C.node(j).parent,A=S.edge(j,T),M=!1;A||(A=S.edge(T,j),M=!0),S.node(j).rank=S.node(T).rank+(M?A.minlen:-A.minlen)})}(g,p)}function _(g,p,b){return b.low<=p.lim&&p.lim<=b.lim}return Yf=i,i.initLowLimValues=d,i.initCutValues=a,i.calcCutValue=l,i.leaveEdge=h,i.enterEdge=f,i.exchangeEdges=m,Yf}function JL(){if(Vk)return Jf;Vk=1;var t=nc().longestPath,e=x3(),n=YL();Jf=function(s){var i=s.graph().ranker;if(i instanceof Function)return i(s);switch(s.graph().ranker){case"network-simplex":default:r(s);break;case"tight-tree":(function(a){t(a),e(a)})(s);break;case"longest-path":o(s);case"none":}};var o=t;function r(s){n(s)}return Jf}function KL(){return $k||($k=1,Kf=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,m,_){let g,p,b=[],x=[],y=Math.min(f[m].low,f[_].low),v=Math.max(f[m].lim,f[_].lim);g=m;do g=h.parent(g),b.push(g);while(g&&(f[g].low>y||v>f[g].lim));for(p=g,g=_;(g=h.parent(g))!==p;)x.push(g);return{path:b.concat(x.reverse()),lca:p}}(t,e,r.v,r.w),i=s.path,a=s.lca,l=0,d=i[l],u=!0;for(;n!==r.w;){if(o=t.node(n),u){for(;(d=i[l])!==a&&t.node(d).maxRank<o.rank;)l++;d===a&&(u=!1)}if(!u){for(;l<i.length-1&&t.node(d=i[l+1]).minRank<=o.rank;)l++;d=i[l]}t.setParent(n,d),n=t.successors(n)[0]}})}),Kf}function XL(){if(Hk)return Xf;Hk=1;let t=Lt();function e(n,o,r,s,i,a,l){let d=n.children(l);if(!d.length)return void(l!==o&&n.setEdge(o,l,{weight:0,minlen:r}));let u=t.addBorderNode(n,"_bt"),h=t.addBorderNode(n,"_bb"),f=n.node(l);n.setParent(u,l),f.borderTop=u,n.setParent(h,l),f.borderBottom=h,d.forEach(m=>{e(n,o,r,s,i,a,m);let _=n.node(m),g=_.borderTop?_.borderTop:m,p=_.borderBottom?_.borderBottom:m,b=_.borderTop?s:2*s,x=g!==p?1:i-a[l]+1;n.setEdge(u,g,{weight:b,minlen:x,nestingEdge:!0}),n.setEdge(p,h,{weight:b,minlen:x,nestingEdge:!0})}),n.parent(l)||n.setEdge(o,u,{weight:0,minlen:i+a[l]})}return Xf={run:function(n){let o=t.addDummyNode(n,"root",{},"_root"),r=function(d){var u={};function h(f,m){var _=d.children(f);_&&_.length&&_.forEach(g=>h(g,m+1)),u[f]=m}return d.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(d=>n.edge(d).minlen*=a);let l=function(d){return d.edges().reduce((u,h)=>u+d.edge(h).weight,0)}(n)+1;n.children().forEach(d=>e(n,o,a,l,i,r,d)),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)})}},Xf}function ZL(){if(qk)return Qf;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 qk=1,Qf={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))}},Qf}function QL(){if(Zk)return Xk;Zk=1;let t=Lt();return Xk=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 d=>{d.merged||(d.barycenter===void 0||l.barycenter===void 0||d.barycenter>=l.barycenter)&&function(u,h){let f=0,m=0;u.weight&&(f+=u.barycenter*u.weight,m+=u.weight),h.weight&&(f+=h.barycenter*h.weight,m+=h.weight),u.vs=h.vs.concat(u.vs),u.barycenter=f/m,u.weight=m,u.i=Math.min(h.i,u.i),h.merged=!0}(l,d)}}function a(l){return d=>{d.in.push(l),--d.indegree===0&&r.push(d)}}for(;r.length;){let l=r.pop();s.push(l),l.in.reverse().forEach(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 eF(){if(t3)return nm;t3=1;let t=(Kk||(Kk=1,Jk=function(o,r=[]){return r.map(s=>{let i=o.inEdges(s);if(i.length){let a=i.reduce((l,d)=>{let u=o.edge(d),h=o.node(d.v);return{sum:l.sum+u.weight*h.order,weight:l.weight+u.weight}},{sum:0,weight:0});return{v:s,barycenter:a.sum/a.weight,weight:a.weight}}return{v:s}})}),Jk),e=QL(),n=function(){if(e3)return Qk;e3=1;let o=Lt();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 Qk=function(s,i){let a=o.partition(s,p=>Object.hasOwn(p,"barycenter")),l=a.lhs,d=a.rhs.sort((p,b)=>b.i-p.i),u=[],h=0,f=0,m=0;var _;l.sort((_=!!i,(p,b)=>p.barycenter<b.barycenter?-1:p.barycenter>b.barycenter?1:_?b.i-p.i:p.i-b.i)),m=r(u,d,m),l.forEach(p=>{m+=p.vs.length,u.push(p.vs),h+=p.barycenter*p.weight,f+=p.weight,m=r(u,d,m)});let g={vs:u.flat(!0)};return f&&(g.barycenter=h/f,g.weight=f),g}}();return nm=function o(r,s,i,a){let l=r.children(s),d=r.node(s),u=d?d.borderLeft:void 0,h=d?d.borderRight:void 0,f={};u&&(l=l.filter(p=>p!==u&&p!==h));let m=t(r,l);m.forEach(p=>{if(r.children(p.v).length){let y=o(r,p.v,i,a);f[p.v]=y,Object.hasOwn(y,"barycenter")&&(x=y,(b=p).barycenter!==void 0?(b.barycenter=(b.barycenter*b.weight+x.barycenter*x.weight)/(b.weight+x.weight),b.weight+=x.weight):(b.barycenter=x.barycenter,b.weight=x.weight))}var b,x});let _=e(m,i);(function(p,b){p.forEach(x=>{x.vs=x.vs.flatMap(y=>b[y]?b[y].vs:y)})})(_,f);let g=n(_,a);if(u&&(g.vs=[u,g.vs,h].flat(!0),r.predecessors(u).length)){let p=r.node(r.predecessors(u)[0]),b=r.node(r.predecessors(h)[0]);Object.hasOwn(g,"barycenter")||(g.barycenter=0,g.weight=0),g.barycenter=(g.barycenter*g.weight+p.order+b.order)/(g.weight+2),g.weight+=2}return g},nm}function tF(){if(n3)return om;n3=1;let t=Kn().Graph,e=Lt();return om=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),d=n.parent(a);(l.rank===o||l.minRank<=o&&o<=l.maxRank)&&(i.setNode(a),i.setParent(a,d||s),n[r](a).forEach(u=>{let h=u.v===a?u.w:u.v,f=i.edge(h,a),m=f!==void 0?f.weight:0;i.setEdge(h,a,{weight:n.edge(u).weight+m})}),Object.hasOwn(l,"minRank")&&i.setNode(a,{borderLeft:l.borderLeft[o],borderRight:l.borderRight[o]}))}),i},om}function nF(){if(s3)return rm;s3=1;let t=function(){if(Gk)return em;Gk=1;let u=Lt();return em=function(h){let f={},m=h.nodes().filter(x=>!h.children(x).length),_=m.map(x=>h.node(x).rank),g=u.applyWithChunking(Math.max,_),p=u.range(g+1).map(()=>[]);function b(x){if(f[x])return;f[x]=!0;let y=h.node(x);p[y.rank].push(x),h.successors(x).forEach(b)}return m.sort((x,y)=>h.node(x).rank-h.node(y).rank).forEach(b),p},em}(),e=function(){if(Yk)return tm;Yk=1;let u=Lt().zipObject;function h(f,m,_){let g=u(_,_.map((C,S)=>S)),p=m.flatMap(C=>f.outEdges(C).map(S=>({pos:g[S.w],weight:f.edge(S).weight})).sort((S,E)=>S.pos-E.pos)),b=1;for(;b<_.length;)b<<=1;let x=2*b-1;b-=1;let y=new Array(x).fill(0),v=0;return p.forEach(C=>{let S=C.pos+b;y[S]+=C.weight;let E=0;for(;S>0;)S%2&&(E+=y[S+1]),S=S-1>>1,y[S]+=C.weight;v+=C.weight*E}),v}return tm=function(f,m){let _=0;for(let g=1;g<m.length;++g)_+=h(f,m[g-1],m[g]);return _},tm}(),n=eF(),o=tF(),r=(r3||(r3=1,o3=function(u,h,f){let m,_={};f.forEach(g=>{let p,b,x=u.parent(g);for(;x;){if(p=u.parent(x),p?(b=_[p],_[p]=x):(b=m,m=x),b&&b!==x)return void h.setEdge(b,x);x=p}})}),o3),s=Kn().Graph,i=Lt();function a(u,h,f){return h.map(function(m){return o(u,m,f)})}function l(u,h){let f=new s;u.forEach(function(m){let _=m.graph().root,g=n(m,_,f,h);g.vs.forEach((p,b)=>m.node(p).order=b),r(m,f,g.vs)})}function d(u,h){Object.values(h).forEach(f=>f.forEach((m,_)=>u.node(m).order=_))}return rm=function u(h,f){if(f&&typeof f.customOrder=="function")return void f.customOrder(h,u);let m=i.maxRank(h),_=a(h,i.range(1,m+1),"inEdges"),g=a(h,i.range(m-1,-1,-1),"outEdges"),p=t(h);if(d(h,p),f&&f.disableOptimalOrderHeuristic)return;let b,x=Number.POSITIVE_INFINITY;for(let y=0,v=0;v<4;++y,++v){l(y%2?_:g,y%4>=2),p=i.buildLayerMatrix(h);let C=e(h,p);C<x&&(v=0,b=Object.assign({},p),x=C)}d(h,b)},rm}function oF(){if(i3)return sm;i3=1;let t=Kn().Graph,e=Lt();function n(h,f){let m={};return f.length&&f.reduce(function(_,g){let p=0,b=0,x=_.length,y=g[g.length-1];return g.forEach((v,C)=>{let S=function(N,j){if(N.node(j).dummy)return N.predecessors(j).find(T=>N.node(T).dummy)}(h,v),E=S?h.node(S).order:x;(S||v===y)&&(g.slice(b,C+1).forEach(N=>{h.predecessors(N).forEach(j=>{let T=h.node(j),A=T.order;!(A<p||E<A)||T.dummy&&h.node(N).dummy||r(m,j,N)})}),b=C+1,p=E)}),g}),m}function o(h,f){let m={};function _(g,p,b,x,y){let v;e.range(p,b).forEach(C=>{v=g[C],h.node(v).dummy&&h.predecessors(v).forEach(S=>{let E=h.node(S);E.dummy&&(E.order<x||E.order>y)&&r(m,S,v)})})}return f.length&&f.reduce(function(g,p){let b,x=-1,y=0;return p.forEach((v,C)=>{if(h.node(v).dummy==="border"){let S=h.predecessors(v);S.length&&(b=h.node(S[0]).order,_(p,y,C,x,b),y=C,x=b)}_(p,y,p.length,b,g.length)}),p}),m}function r(h,f,m){if(f>m){let g=f;f=m,m=g}let _=h[f];_||(h[f]=_={}),_[m]=!0}function s(h,f,m){if(f>m){let _=f;f=m,m=_}return!!h[f]&&Object.hasOwn(h[f],m)}function i(h,f,m,_){let g={},p={},b={};return f.forEach(x=>{x.forEach((y,v)=>{g[y]=y,p[y]=y,b[y]=v})}),f.forEach(x=>{let y=-1;x.forEach(v=>{let C=_(v);if(C.length){C=C.sort((E,N)=>b[E]-b[N]);let S=(C.length-1)/2;for(let E=Math.floor(S),N=Math.ceil(S);E<=N;++E){let j=C[E];p[v]===v&&y<b[j]&&!s(m,v,j)&&(p[j]=v,p[v]=g[v]=g[j],y=b[j])}}})}),{root:g,align:p}}function a(h,f,m,_,g){let p={},b=function(v,C,S,E){let N=new t,j=v.graph(),T=function(A,M,P){return(R,L,B)=>{let U,D=R.node(L),k=R.node(B),$=0;if($+=D.width/2,Object.hasOwn(D,"labelpos"))switch(D.labelpos.toLowerCase()){case"l":U=-D.width/2;break;case"r":U=D.width/2}if(U&&($+=P?U:-U),U=0,$+=(D.dummy?M:A)/2,$+=(k.dummy?M:A)/2,$+=k.width/2,Object.hasOwn(k,"labelpos"))switch(k.labelpos.toLowerCase()){case"l":U=k.width/2;break;case"r":U=-k.width/2}return U&&($+=P?U:-U),U=0,$}}(j.nodesep,j.edgesep,E);return C.forEach(A=>{let M;A.forEach(P=>{let R=S[P];if(N.setNode(R),M){var L=S[M],B=N.edge(L,R);N.setEdge(L,R,Math.max(T(v,P,M),B||0))}M=P})}),N}(h,f,m,g),x=g?"borderLeft":"borderRight";function y(v,C){let S=b.nodes(),E=S.pop(),N={};for(;E;)N[E]?v(E):(N[E]=!0,S.push(E),S=S.concat(C(E))),E=S.pop()}return y(function(v){p[v]=b.inEdges(v).reduce((C,S)=>Math.max(C,p[S.v]+b.edge(S)),0)},b.predecessors.bind(b)),y(function(v){let C=b.outEdges(v).reduce((E,N)=>Math.min(E,p[N.w]-b.edge(N)),Number.POSITIVE_INFINITY),S=h.node(v);C!==Number.POSITIVE_INFINITY&&S.borderType!==x&&(p[v]=Math.max(p[v],C))},b.successors.bind(b)),Object.keys(_).forEach(v=>p[v]=p[m[v]]),p}function l(h,f){return Object.values(f).reduce((m,_)=>{let g=Number.NEGATIVE_INFINITY,p=Number.POSITIVE_INFINITY;Object.entries(_).forEach(([x,y])=>{let v=function(C,S){return C.node(S).width}(h,x)/2;g=Math.max(y+v,g),p=Math.min(y-v,p)});const b=g-p;return b<m[0]&&(m=[b,_]),m},[Number.POSITIVE_INFINITY,null])[1]}function d(h,f){let m=Object.values(f),_=e.applyWithChunking(Math.min,m),g=e.applyWithChunking(Math.max,m);["u","d"].forEach(p=>{["l","r"].forEach(b=>{let x=p+b,y=h[x];if(y===f)return;let v=Object.values(y),C=_-e.applyWithChunking(Math.min,v);b!=="l"&&(C=g-e.applyWithChunking(Math.max,v)),C&&(h[x]=e.mapValues(y,S=>S+C))})})}function u(h,f){return e.mapValues(h.ul,(m,_)=>{if(f)return h[f.toLowerCase()][_];{let g=Object.values(h).map(p=>p[_]).sort((p,b)=>p-b);return(g[1]+g[2])/2}})}return sm={positionX:function(h){let f,m=e.buildLayerMatrix(h),_=Object.assign(n(h,m),o(h,m)),g={};["u","d"].forEach(b=>{f=b==="u"?m:Object.values(m).reverse(),["l","r"].forEach(x=>{x==="r"&&(f=f.map(S=>Object.values(S).reverse()));let y=(b==="u"?h.predecessors:h.successors).bind(h),v=i(h,f,_,y),C=a(h,f,v.root,v.align,x==="r");x==="r"&&(C=e.mapValues(C,S=>-S)),g[b+x]=C})});let p=l(h,g);return d(g,p),u(g,h.graph().align)},findType1Conflicts:n,findType2Conflicts:o,addConflict:r,hasConflict:s,verticalAlignment:i,horizontalCompaction:a,alignCoordinates:d,findSmallestWidthAlignment:l,balance:u},sm}function rF(){if(a3)return im;a3=1;let t=Lt(),e=oF().positionX;return im=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((d,u)=>{const h=o.node(u).height;return d>h?d:h},0);a.forEach(d=>o.node(d).y=i+l/2),i+=l+s})}(n),Object.entries(e(n)).forEach(([o,r])=>n.node(o).x=r)},im}function sF(){if(l3)return am;l3=1;let t=qL(),e=GL(),n=JL(),o=Lt().normalizeRanks,r=KL(),s=Lt().removeEmptyRanks,i=XL(),a=function(){if(Wk)return Zf;Wk=1;let E=Lt();function N(j,T,A,M,P,R){let L={width:0,height:0,rank:R,borderType:T},B=P[T][R-1],U=E.addDummyNode(j,"border",L,A);P[T][R]=U,j.setParent(U,M),B&&j.setEdge(B,U,{weight:1})}return Zf=function(j){j.children().forEach(function T(A){let M=j.children(A),P=j.node(A);if(M.length&&M.forEach(T),Object.hasOwn(P,"minRank")){P.borderLeft=[],P.borderRight=[];for(let R=P.minRank,L=P.maxRank+1;R<L;++R)N(j,"borderLeft","_bl",A,P,R),N(j,"borderRight","_br",A,P,R)}})},Zf}(),l=ZL(),d=nF(),u=rF(),h=Lt(),f=Kn().Graph;am=function(E,N){let j=N&&N.debugTiming?h.time:h.notime;j("layout",()=>{let T=j(" buildLayoutGraph",()=>function(A){let M=new f({multigraph:!0,compound:!0}),P=S(A.graph());return M.setGraph(Object.assign({},_,C(P,m),h.pick(P,g))),A.nodes().forEach(R=>{const L=C(S(A.node(R)),p);Object.keys(b).forEach(B=>{L[B]===void 0&&(L[B]=b[B])}),M.setNode(R,L),M.setParent(R,A.parent(R))}),A.edges().forEach(R=>{let L=S(A.edge(R));M.setEdge(R,Object.assign({},y,C(L,x),h.pick(L,v)))}),M}(E));j(" runLayout",()=>function(A,M,P){M(" makeSpaceForEdgeLabels",()=>function(R){let L=R.graph();L.ranksep/=2,R.edges().forEach(B=>{let U=R.edge(B);U.minlen*=2,U.labelpos.toLowerCase()!=="c"&&(L.rankdir==="TB"||L.rankdir==="BT"?U.width+=U.labeloffset:U.height+=U.labeloffset)})}(A)),M(" removeSelfEdges",()=>function(R){R.edges().forEach(L=>{if(L.v===L.w){var B=R.node(L.v);B.selfEdges||(B.selfEdges=[]),B.selfEdges.push({e:L,label:R.edge(L)}),R.removeEdge(L)}})}(A)),M(" acyclic",()=>t.run(A)),M(" nestingGraph.run",()=>i.run(A)),M(" rank",()=>n(h.asNonCompoundGraph(A))),M(" injectEdgeLabelProxies",()=>function(R){R.edges().forEach(L=>{let B=R.edge(L);if(B.width&&B.height){let U=R.node(L.v),D={rank:(R.node(L.w).rank-U.rank)/2+U.rank,e:L};h.addDummyNode(R,"edge-proxy",D,"_ep")}})}(A)),M(" removeEmptyRanks",()=>s(A)),M(" nestingGraph.cleanup",()=>i.cleanup(A)),M(" normalizeRanks",()=>o(A)),M(" assignRankMinMax",()=>function(R){let L=0;R.nodes().forEach(B=>{let U=R.node(B);U.borderTop&&(U.minRank=R.node(U.borderTop).rank,U.maxRank=R.node(U.borderBottom).rank,L=Math.max(L,U.maxRank))}),R.graph().maxRank=L}(A)),M(" removeEdgeLabelProxies",()=>function(R){R.nodes().forEach(L=>{let B=R.node(L);B.dummy==="edge-proxy"&&(R.edge(B.e).labelRank=B.rank,R.removeNode(L))})}(A)),M(" normalize.run",()=>e.run(A)),M(" parentDummyChains",()=>r(A)),M(" addBorderSegments",()=>a(A)),M(" order",()=>d(A,P)),M(" insertSelfEdges",()=>function(R){var L=h.buildLayerMatrix(R);L.forEach(B=>{var U=0;B.forEach((D,k)=>{var $=R.node(D);$.order=k+U,($.selfEdges||[]).forEach(I=>{h.addDummyNode(R,"selfedge",{width:I.label.width,height:I.label.height,rank:$.rank,order:k+ ++U,e:I.e,label:I.label},"_se")}),delete $.selfEdges})})}(A)),M(" adjustCoordinateSystem",()=>l.adjust(A)),M(" position",()=>u(A)),M(" positionSelfEdges",()=>function(R){R.nodes().forEach(L=>{var B=R.node(L);if(B.dummy==="selfedge"){var U=R.node(B.e.v),D=U.x+U.width/2,k=U.y,$=B.x-D,I=U.height/2;R.setEdge(B.e,B.label),R.removeNode(L),B.label.points=[{x:D+2*$/3,y:k-I},{x:D+5*$/6,y:k-I},{x:D+$,y:k},{x:D+5*$/6,y:k+I},{x:D+2*$/3,y:k+I}],B.label.x=B.x,B.label.y=B.y}})}(A)),M(" removeBorderNodes",()=>function(R){R.nodes().forEach(L=>{if(R.children(L).length){let B=R.node(L),U=R.node(B.borderTop),D=R.node(B.borderBottom),k=R.node(B.borderLeft[B.borderLeft.length-1]),$=R.node(B.borderRight[B.borderRight.length-1]);B.width=Math.abs($.x-k.x),B.height=Math.abs(D.y-U.y),B.x=k.x+B.width/2,B.y=U.y+B.height/2}}),R.nodes().forEach(L=>{R.node(L).dummy==="border"&&R.removeNode(L)})}(A)),M(" normalize.undo",()=>e.undo(A)),M(" fixupEdgeLabelCoords",()=>function(R){R.edges().forEach(L=>{let B=R.edge(L);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}})}(A)),M(" undoCoordinateSystem",()=>l.undo(A)),M(" translateGraph",()=>function(R){let L=Number.POSITIVE_INFINITY,B=0,U=Number.POSITIVE_INFINITY,D=0,k=R.graph(),$=k.marginx||0,I=k.marginy||0;function W(G){let q=G.x,Y=G.y,ee=G.width,oe=G.height;L=Math.min(L,q-ee/2),B=Math.max(B,q+ee/2),U=Math.min(U,Y-oe/2),D=Math.max(D,Y+oe/2)}R.nodes().forEach(G=>W(R.node(G))),R.edges().forEach(G=>{let q=R.edge(G);Object.hasOwn(q,"x")&&W(q)}),L-=$,U-=I,R.nodes().forEach(G=>{let q=R.node(G);q.x-=L,q.y-=U}),R.edges().forEach(G=>{let q=R.edge(G);q.points.forEach(Y=>{Y.x-=L,Y.y-=U}),Object.hasOwn(q,"x")&&(q.x-=L),Object.hasOwn(q,"y")&&(q.y-=U)}),k.width=B-L+$,k.height=D-U+I}(A)),M(" assignNodeIntersects",()=>function(R){R.edges().forEach(L=>{let B,U,D=R.edge(L),k=R.node(L.v),$=R.node(L.w);D.points?(B=D.points[0],U=D.points[D.points.length-1]):(D.points=[],B=$,U=k),D.points.unshift(h.intersectRect(k,B)),D.points.push(h.intersectRect($,U))})}(A)),M(" reversePoints",()=>function(R){R.edges().forEach(L=>{let B=R.edge(L);B.reversed&&B.points.reverse()})}(A)),M(" acyclic.undo",()=>t.undo(A))}(T,j,N)),j(" updateInputGraph",()=>function(A,M){A.nodes().forEach(P=>{let R=A.node(P),L=M.node(P);R&&(R.x=L.x,R.y=L.y,R.rank=L.rank,M.children(P).length&&(R.width=L.width,R.height=L.height))}),A.edges().forEach(P=>{let R=A.edge(P),L=M.edge(P);R.points=L.points,Object.hasOwn(L,"x")&&(R.x=L.x,R.y=L.y)}),A.graph().width=M.graph().width,A.graph().height=M.graph().height}(E,T))})};let m=["nodesep","edgesep","ranksep","marginx","marginy"],_={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},g=["acyclicer","ranker","rankdir","align"],p=["width","height","rank"],b={width:0,height:0},x=["minlen","weight","width","height","labeloffset"],y={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},v=["labelpos"];function C(E,N){return h.mapValues(h.pick(E,N),Number)}function S(E){var N={};return E&&Object.entries(E).forEach(([j,T])=>{typeof j=="string"&&(j=j.toLowerCase()),N[j]=T}),N}return am}function iF(){if(c3)return lm;c3=1;let t=Lt(),e=Kn().Graph;return lm={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,d)=>(r.setEdge(l,d,{style:"invis"}),d))}),r}},lm}var y3=f3?h3:(f3=1,h3={graphlib:Kn(),layout:sF(),debug:iF(),util:{time:Lt().time,notime:Lt().notime},version:u3?d3:(u3=1,d3="1.1.5")});const Yi=new y3.graphlib.Graph().setDefaultEdgeLabel(()=>({})),w3=({nodes:t,edges:e,direction:n})=>(Yi.setGraph({rankdir:n,nodesep:150,ranksep:200,ranker:"longest-path"}),e.forEach(o=>Yi.setEdge(o.source,o.target)),t.forEach(o=>Yi.setNode(o.id,{...o,width:o.width??0,height:o.height??0})),y3.layout(Yi),{nodes:t.map(o=>{const{x:r,y:s}=Yi.node(o.id);return{...o,position:{x:r,y:s}}}),edges:e}),v3=new class{createEdge(t,e){return{animated:!0,markerEnd:{type:ys.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(at.get(e).code.trim().split(`
148
- `).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:d,usedBy:u}=l;for(const h of d)for(const f of u){const m=`${h}-${f}`;a.has(m)||(a.add(m),i.add(h),i.add(f),s.push(this.createEdge(h,f)))}}for(const[l,d]of rp.zip(t,e)){o||r.push(this.createNode(l,d));const u=i.has(l),h=at.get(d).code.trim().startsWith("mo.md");!u&&h||r.push(this.createNode(l,d))}return{nodes:r,edges:s}}},aF=t=>{const e=K.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 k=v3.createElements(n,r,o,a.hidePureMarkdown);return k=w3({nodes:k.nodes,edges:k.edges,direction:i}),k},e[0]=r,e[1]=n,e[2]=i,e[3]=a.hidePureMarkdown,e[4]=o,e[5]=l):l=e[5];const[d]=O.useState(l),[u,h,f]=ek(d.nodes),[m,_,g]=tk(d.edges),p=Wi();let b;e[6]!==i||e[7]!==_||e[8]!==h?(b=k=>{const $=w3({nodes:k.nodes,edges:k.edges,direction:i});h($.nodes),_($.edges)},e[6]=i,e[7]=_,e[8]=h,e[9]=b):b=e[9];const x=qe(b);let y,v;e[10]!==r||e[11]!==n||e[12]!==a.hidePureMarkdown||e[13]!==x||e[14]!==o?(y=()=>{x(v3.createElements(n,r,o,a.hidePureMarkdown))},v=[n,o,r,x,a.hidePureMarkdown],e[10]=r,e[11]=n,e[12]=a.hidePureMarkdown,e[13]=x,e[14]=o,e[15]=y,e[16]=v):(y=e[15],v=e[16]),O.useEffect(y,v);const[C,S]=O.useState();let E;lk(),e[17]===Symbol.for("react.memo_cache_sentinel")?(E=()=>{S(void 0)},e[17]=E):E=e[17];const N=E;let j,T,A,M,P,R,L,B,U,D;return e[18]===Symbol.for("react.memo_cache_sentinel")?(j={minZoom:.5,maxZoom:1.5},T=(k,$)=>{S({type:"node",id:$.id})},A=(k,$)=>{const{source:I,target:W}=$;S({type:"edge",source:I,target:W})},e[18]=j,e[19]=T,e[20]=A):(j=e[18],T=e[19],A=e[20]),e[21]===Symbol.for("react.memo_cache_sentinel")?(M=c.jsx(jL,{color:"#ccc",variant:Un.Dots}),e[21]=M):M=e[21],e[22]!==p||e[23]!==u?(P=()=>{const k=at.get(Y$);if(k){const $=u.find(I=>I.id===k);$&&(p.fitView({padding:1,duration:600,nodes:[$]}),S({type:"node",id:k}))}},e[22]=p,e[23]=u,e[24]=P):P=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(R=c.jsx(Vp,{className:"size-4"}),e[25]=R):R=e[25],e[26]!==P?(L=c.jsx(wL,{position:"bottom-right",showInteractive:!1,children:c.jsx(Te,{content:"Jump to focused cell",delayDuration:200,side:"left",asChild:!1,children:c.jsx(Es,{onMouseDown:Qn.preventFocus,onClick:P,children:R})})}),e[26]=P,e[27]=L):L=e[27],e[28]!==m||e[29]!==C||e[30]!==o?(B=c.jsx(tc,{selection:C,variables:o,edges:m,onClearSelection:N}),e[28]=m,e[29]=C,e[30]=o,e[31]=B):B=e[31],e[32]!==s||e[33]!==m||e[34]!==u||e[35]!==g||e[36]!==f||e[37]!==L||e[38]!==B?(U=c.jsxs(kf,{nodes:u,edges:m,nodeTypes:ik,minZoom:.2,fitViewOptions:j,onNodeClick:T,onEdgeClick:A,onNodeDoubleClick:lF,fitView:!0,onNodesChange:f,onEdgesChange:g,zoomOnDoubleClick:!1,nodesConnectable:!1,children:[M,L,B,s]}),e[32]=s,e[33]=m,e[34]=u,e[35]=g,e[36]=f,e[37]=L,e[38]=B,e[39]=U):U=e[39],e[40]!==i||e[41]!==U?(D=c.jsx(rk,{value:i,children:U}),e[40]=i,e[41]=U,e[42]=D):D=e[42],D};function lF(t,e){jS(e.id,"focus")}const cF=zt("_minimap_"),dF=zt({hidePureMarkdown:!0}),uF=t=>{const e=K.c(11),[n,o]=Qt(cF),[r,s]=Qt(dF);let i;e[0]!==n||e[1]!==t||e[2]!==o||e[3]!==s||e[4]!==r?(i=()=>n==="_minimap_"?c.jsx(ML,{...t,children:c.jsx(Nf,{settings:r,onSettingsChange:s,view:n,onChange:o})}):c.jsx(aF,{...t,settings:r,layoutDirection:n,children:c.jsx(Nf,{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,d;return e[6]!==a?(l=a(),e[6]=a,e[7]=l):l=e[7],e[8]!==n||e[9]!==l?(d=c.jsx(vf,{children:l},n),e[8]=n,e[9]=l,e[10]=d):d=e[10],d},hF=()=>{const t=K.c(5),e=ES(),n=Zc(),[o]=J$();let r,s;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=Ne("w-full h-full flex-1 mx-auto -mb-4 relative"),t[0]=r):r=t[0],t[1]!==n.inOrderIds||t[2]!==o||t[3]!==e?(s=c.jsx("div",{className:r,children:c.jsx(uF,{cellAtoms:o,variables:e,cellIds:n.inOrderIds})}),t[1]=n.inOrderIds,t[2]=o,t[3]=e,t[4]=s):s=t[4],s},fF=t=>{const e=K.c(4),{isOpen:n,children:o}=t,[r,s]=X.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]),X.useEffect(i,a),r?o:null},mF=t=>{const e=K.c(8),{variableName:n,className:o}=t;let r;e[0]!==n?(r=()=>{const l=function(u){const h=at.get(IS)[u];if(h)return h.declaredBy[0]}(n);if(!l)return;const d=Qi(l);d&&ip(d,n)},e[0]=n,e[1]=r):r=e[1];const s=r;let i,a;return e[2]!==o?(i=Ne("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=c.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},pF=zt(t=>{const e=t(K$),n=t(IS),o=t(qc);return ka(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})}),gF=zt(t=>{const e=new Map(t(X$));for(const n of AS){const o=e.get(n);o&&o.databases.length===0&&e.delete(n)}return ka([...e.values()],n=>AS.has(n.name)?1:0)}),_F=()=>{const t=K.c(32),[e,n]=X.useState(""),o=Ot(TS),r=Le(pF),s=Le(gF);if(r.length===0&&s.length===0){let b;return t[0]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(yn,{title:"No tables found",description:"Any datasets/dataframes in the global scope will be shown here.",action:c.jsx(Vg,{children:c.jsxs(Ae,{variant:"outline",size:"sm",children:["Add database or catalog",c.jsx(br,{className:"h-4 w-4 ml-2"})]})}),icon:c.jsx(lr,{})}),t[0]=b):b=t[0],b}const i=!!e.trim();let a,l,d,u,h,f,m,_,g,p;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=c.jsx(na,{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?(d=i&&c.jsx("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:()=>n(""),children:c.jsx(eo,{className:"h-4 w-4"})}),t[6]=i,t[7]=d):d=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx(Vg,{children:c.jsx("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:c.jsx(br,{className:"h-4 w-4"})})}),t[8]=u):u=t[8],t[9]!==l||t[10]!==d?(h=c.jsxs("div",{className:"flex items-center w-full",children:[l,d,u]}),t[9]=l,t[10]=d,t[11]=h):h=t[11],t[12]!==s||t[13]!==i||t[14]!==e){let b;t[16]!==i||t[17]!==e?(b=x=>c.jsx(bF,{connection:x,hasChildren:x.databases.length>0,children:x.databases.map(y=>c.jsx(xF,{engineName:x.name,database:y,hasSearch:i,children:c.jsx(yF,{schemas:y.schemas,defaultSchema:x.default_schema,defaultDatabase:x.default_database,engineName:x.name,databaseName:y.name,hasSearch:i,searchValue:e})},y.name))},x.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?(m=s.length>0&&r.length>0&&c.jsxs(MS,{children:[c.jsx(hc,{className:"h-4 w-4 text-muted-foreground"}),c.jsx("span",{className:"text-xs",children:"Python"})]}),t[19]=s.length,t[20]=r.length,t[21]=m):m=t[21],t[22]!==e||t[23]!==r?(_=r.length>0&&c.jsx(k3,{tables:r,searchValue:e}),t[22]=e,t[23]=r,t[24]=_):_=t[24],t[25]!==f||t[26]!==m||t[27]!==_?(g=c.jsxs(Jm,{className:"flex flex-col",children:[f,m,_]}),t[25]=f,t[26]=m,t[27]=_,t[28]=g):g=t[28],t[29]!==h||t[30]!==g?(p=c.jsxs(Ec,{className:"border-b bg-background rounded-none h-full pb-10 overflow-auto outline-none",shouldFilter:!1,children:[h,g]}),t[29]=h,t[30]=g,t[31]=p):p=t[31],p},bF=t=>{const e=K.c(25),{connection:n,children:o,hasChildren:r}=t,s=n.name===Z$,i=s?"In-Memory":n.name,[a,l]=X.useState(!1);let d;e[0]!==n.name?(d=async()=>{l(!0),await eH({engine:n.name}),setTimeout(()=>l(!1),500)},e[0]=n.name,e[1]=d):d=e[1];const u=d;let h,f,m;e[2]!==n.dialect?(h=c.jsx(y4,{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=Q$(n.dialect),e[4]=n.dialect,e[5]=f):f=e[5],e[6]!==f?(m=c.jsx("span",{className:"text-xs",children:f}),e[6]=f,e[7]=m):m=e[7];const _=i;let g,p,b,x,y;return e[8]!==_?(g=c.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",c.jsx(mF,{variableName:_}),")"]}),e[8]=_,e[9]=g):g=e[9],e[10]!==u||e[11]!==s||e[12]!==a?(p=!s&&c.jsx(Te,{content:"Refresh connection",children:c.jsx(Ae,{variant:"ghost",size:"icon",className:"ml-auto hover:bg-transparent hover:shadow-none",onClick:u,children:c.jsx(Bc,{className:Ne("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]=p):p=e[13],e[14]!==h||e[15]!==m||e[16]!==g||e[17]!==p?(b=c.jsxs(MS,{children:[h,m,g,p]}),e[14]=h,e[15]=m,e[16]=g,e[17]=p,e[18]=b):b=e[18],e[19]!==o||e[20]!==r?(x=r?o:c.jsx(Qc,{content:"No databases available",className:"pl-2"}),e[19]=o,e[20]=r,e[21]=x):x=e[21],e[22]!==b||e[23]!==x?(y=c.jsxs(c.Fragment,{children:[b,x]}),e[22]=b,e[23]=x,e[24]=y):y=e[24],y},xF=t=>{const e=K.c(28),{hasSearch:n,engineName:o,database:r,children:s}=t,[i,a]=X.useState(!1),[l,d]=X.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]),X.useEffect(u,h),e[3]!==i||e[4]!==l?(f=()=>{a(!i),d(!l)},e[3]=i,e[4]=l,e[5]=f):f=e[5];const m=`${o}:${r.name}`;let _;e[6]!==i?(_=c.jsx(FS,{isExpanded:i}),e[6]=i,e[7]=_):_=e[7];const g=l&&i?"text-foreground":"text-muted-foreground";let p,b;e[8]!==g?(p=Ne("h-4 w-4",g),e[8]=g,e[9]=p):p=e[9],e[10]!==p?(b=c.jsx(lr,{className:p}),e[10]=p,e[11]=b):b=e[11];const x=l&&i&&"font-semibold";let y,v,C,S;e[12]!==x?(y=Ne(x),e[12]=x,e[13]=y):y=e[13],e[14]!==r.name?(v=r.name===""?c.jsx("i",{children:"Not connected"}):r.name,e[14]=r.name,e[15]=v):v=e[15],e[16]!==y||e[17]!==v?(C=c.jsx("span",{className:y,children:v}),e[16]=y,e[17]=v,e[18]=C):C=e[18],e[19]!==C||e[20]!==f||e[21]!==m||e[22]!==_||e[23]!==b?(S=c.jsxs(mo,{className:"text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",onSelect:f,value:m,children:[_,b,C]}),e[19]=C,e[20]=f,e[21]=m,e[22]=_,e[23]=b,e[24]=S):S=e[24];const E=i&&s;let N;return e[25]!==S||e[26]!==E?(N=c.jsxs(c.Fragment,{children:[S,E]}),e[25]=S,e[26]=E,e[27]=N):N=e[27],N},yF=t=>{const e=K.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=c.jsx(Qc,{content:"No schemas available",className:"pl-6"}),e[0]=h):h=e[0],h}let d,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 m;e[11]!==i||e[12]!==r||e[13]!==o||e[14]!==s||e[15]!==a||e[16]!==l?(m=_=>c.jsx(wF,{databaseName:i,schema:_,hasSearch:a,children:c.jsx(k3,{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]=m):m=e[17],d=f.map(m),e[1]=i,e[2]=r,e[3]=o,e[4]=s,e[5]=a,e[6]=n,e[7]=l,e[8]=d}else d=e[8];return e[18]!==d?(u=c.jsx(c.Fragment,{children:d}),e[18]=d,e[19]=u):u=e[19],u},wF=t=>{const e=K.c(26),{databaseName:n,schema:o,children:r,hasSearch:s}=t,[i,a]=X.useState(!1),[l,d]=X.useState(!1),u=`${n}:${o.name}`;let h,f,m,_;if(e[0]!==s?(h=()=>{a(s)},f=[s],e[0]=s,e[1]=h,e[2]=f):(h=e[1],f=e[2]),X.useEffect(h,f),LS(o.name))return r;e[3]!==i||e[4]!==l?(m=()=>{a(!i),d(!l)},e[3]=i,e[4]=l,e[5]=m):m=e[5],e[6]!==i?(_=c.jsx(FS,{isExpanded:i}),e[6]=i,e[7]=_):_=e[7];const g=l&&i&&"text-foreground";let p,b;e[8]!==g?(p=Ne("h-4 w-4 text-muted-foreground",g),e[8]=g,e[9]=p):p=e[9],e[10]!==p?(b=c.jsx(aH,{className:p}),e[10]=p,e[11]=b):b=e[11];const x=l&&i&&"font-semibold";let y,v,C;e[12]!==x?(y=Ne(x),e[12]=x,e[13]=y):y=e[13],e[14]!==o.name||e[15]!==y?(v=c.jsx("span",{className:y,children:o.name}),e[14]=o.name,e[15]=y,e[16]=v):v=e[16],e[17]!==v||e[18]!==m||e[19]!==_||e[20]!==b||e[21]!==u?(C=c.jsxs(mo,{className:"text-sm flex flex-row gap-1 items-center pl-5 cursor-pointer rounded-none",onSelect:m,value:u,children:[_,b,v]}),e[17]=v,e[18]=m,e[19]=_,e[20]=b,e[21]=u,e[22]=C):C=e[22];const S=i&&r;let E;return e[23]!==C||e[24]!==S?(E=c.jsxs(c.Fragment,{children:[C,S]}),e[23]=C,e[24]=S,e[25]=E):E=e[25],E},k3=t=>{const e=K.c(24),{tables:n,sqlTableContext:o,searchValue:r}=t,{addTableList:s}=OS(),[i,a]=X.useState(!1),[l,d]=X.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),d(!0);const{engine:p,database:b,schema:x}=o,y=await TW.request({engine:p,database:b,schema:x});if(!(y!=null&&y.tables))throw d(!1),new Error("No tables available");s({tables:y.tables,sqlTableContext:o}),d(!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:m}=Wn(u,h);if(f||l){let p;return e[9]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx(DS,{message:"Loading tables...",className:"pl-12"}),e[9]=p):p=e[9],p}if(m){let p;return e[10]!==m?(p=c.jsx(RS,{error:m,className:"pl-12"}),e[10]=m,e[11]=p):p=e[11],p}if(n.length===0){let p;return e[12]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx(Qc,{content:"No tables found",className:"pl-9"}),e[12]=p):p=e[12],p}let _,g;if(e[13]!==r||e[14]!==o||e[15]!==n){let p;e[17]!==r?(p=y=>!r||y.name.toLowerCase().includes(r.toLowerCase()),e[17]=r,e[18]=p):p=e[18];const b=n.filter(p);let x;e[19]!==r||e[20]!==o?(x=y=>c.jsx(vF,{table:y,sqlTableContext:o,isSearching:!!r},y.name),e[19]=r,e[20]=o,e[21]=x):x=e[21],_=b.map(x),e[13]=r,e[14]=o,e[15]=n,e[16]=_}else _=e[16];return e[22]!==_?(g=c.jsx(c.Fragment,{children:_}),e[22]=_,e[23]=g):g=e[23],g},vF=t=>{const e=K.c(64),{table:n,sqlTableContext:o,isSearching:r}=t,{addTable:s}=OS(),[i,a]=X.useState(!1),[l,d]=X.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){d(!0);const{engine:oe,database:ie,schema:Z}=o,Q=await MW.request({engine:oe,database:ie,schema:Z,tableName:n.name});if(!(Q!=null&&Q.table))throw new Error("No table details available");s({table:Q.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{isFetching:m,isPending:_,error:g}=Wn(h,f),p=Le(dc),b=Rs(),{createNewCell:x}=bt(),y=PS();let v;e[10]!==y||e[11]!==p||e[12]!==x||e[13]!==b||e[14]!==o||e[15]!==n?(v=()=>{fo({autoInstantiate:p,createNewCell:x,fromCellId:b}),y((()=>{if(n.source_type==="catalog"){const oe=o!=null&&o.database?`${o.database}.${n.name}`:n.name;return`${n.engine}.load_table("${oe}")`}if(o)return zS({table:n,columnName:"*",sqlTableContext:o});switch(n.source_type){case"local":return`mo.ui.table(${n.name})`;case"duckdb":case"connection":return zS({table:n,columnName:"*",sqlTableContext:o});default:return wc(n.source_type),""}})())},e[10]=y,e[11]=p,e[12]=x,e[13]=b,e[14]=o,e[15]=n,e[16]=v):v=e[16];const C=v;let S;e[17]!==n.num_columns||e[18]!==n.num_rows?(S=()=>{const oe=[];return n.num_rows!=null&&oe.push(`${n.num_rows} rows`),n.num_columns!=null&&oe.push(`${n.num_columns} columns`),oe.length===0?null:c.jsx("div",{className:"flex flex-row gap-2 items-center pl-6 group-hover:hidden",children:c.jsx("span",{className:"text-xs text-muted-foreground",children:oe.join(", ")})})},e[17]=n.num_columns,e[18]=n.num_rows,e[19]=S):S=e[19];const E=S;let N;e[20]!==g||e[21]!==m||e[22]!==_||e[23]!==o||e[24]!==n?(N=()=>{if(_||m)return c.jsx(DS,{message:"Loading columns...",className:"pl-12"});if(g)return c.jsx(RS,{error:g,className:"pl-12"});const oe=n.columns;return oe.length===0?c.jsx(Qc,{content:"No columns found",className:"pl-12"}):oe.map(ie=>c.jsx(kF,{table:n,column:ie,sqlTableContext:o},ie.name))},e[20]=g,e[21]=m,e[22]=_,e[23]=o,e[24]=n,e[25]=N):N=e[25];const j=N;let T;e[26]!==i||e[27]!==r||e[28]!==n.source_type||e[29]!==n.type?(T=()=>{if(n.source_type==="local")return;const oe=n.type==="table"?tH:wm;return c.jsx(oe,{className:"h-3 w-3",strokeWidth:i||r?2.5:void 0})},e[26]=i,e[27]=r,e[28]=n.source_type,e[29]=n.type,e[30]=T):T=e[30];const A=T,M=o?`${o.database}.${o.schema}.${n.name}`:n.name,P=o&&(LS(o.schema)?"pl-9":"pl-12"),R=(i||r)&&"font-semibold";let L,B,U,D,k,$,I,W,G,q,Y,ee;return e[31]!==P||e[32]!==R?(L=Ne("rounded-none group h-8 cursor-pointer",P,R),e[31]=P,e[32]=R,e[33]=L):L=e[33],e[34]!==i?(B=()=>a(!i),e[34]=i,e[35]=B):B=e[35],e[36]!==A?(U=A(),e[36]=A,e[37]=U):U=e[37],e[38]!==n.name?(D=c.jsx("span",{className:"text-sm",children:n.name}),e[38]=n.name,e[39]=D):D=e[39],e[40]!==U||e[41]!==D?(k=c.jsxs("div",{className:"flex gap-2 items-center flex-1",children:[U,D]}),e[40]=U,e[41]=D,e[42]=k):k=e[42],e[43]!==E?($=E(),e[43]=E,e[44]=$):$=e[44],e[45]!==C?(I=Qn.stopPropagation(()=>C()),e[45]=C,e[46]=I):I=e[46],e[47]===Symbol.for("react.memo_cache_sentinel")?(W=c.jsx(nH,{className:"h-3 w-3"}),e[47]=W):W=e[47],e[48]!==I?(G=c.jsx(Te,{content:"Add table to notebook",delayDuration:400,children:c.jsx(Ae,{className:"group-hover:inline-flex hidden",variant:"text",size:"icon",onClick:I,children:W})}),e[48]=I,e[49]=G):G=e[49],e[50]!==i||e[51]!==B||e[52]!==k||e[53]!==$||e[54]!==G||e[55]!==L||e[56]!==M?(q=c.jsxs(mo,{className:L,value:M,"aria-selected":i,forceMount:!0,onSelect:B,children:[k,$,G]}),e[50]=i,e[51]=B,e[52]=k,e[53]=$,e[54]=G,e[55]=L,e[56]=M,e[57]=q):q=e[57],e[58]!==i||e[59]!==j?(Y=i&&j(),e[58]=i,e[59]=j,e[60]=Y):Y=e[60],e[61]!==q||e[62]!==Y?(ee=c.jsxs(c.Fragment,{children:[q,Y]}),e[61]=q,e[62]=Y,e[63]=ee):ee=e[63],ee},kF=t=>{var I,W;const e=K.c(51),{table:n,column:o,sqlTableContext:r}=t,[s,i]=X.useState(!1),a=Le(TS),l=Ot(oH);let d,u;e[0]!==a?(d=()=>{a&&i(!1)},u=[a],e[0]=a,e[1]=d,e[2]=u):(d=e[1],u=e[2]),X.useEffect(d,u),l(s?G=>new Set([...G,`${n.name}:${o.name}`]):G=>(G.delete(`${n.name}:${o.name}`),new Set(G)));const h=PS(),{columnsPreviews:f}=rH();let m;e[3]!==o.name||e[4]!==n.primary_keys?(m=((I=n.primary_keys)==null?void 0:I.includes(o.name))||!1,e[3]=o.name,e[4]=n.primary_keys,e[5]=m):m=e[5];const _=m;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 p=g;let b;e[9]!==h?(b=G=>{h(G)},e[9]=h,e[10]=b):b=e[10];const x=b,y=SF,v=s?"font-semibold":"";let C;e[11]!==o.name||e[12]!==v?(C=c.jsx("span",{className:v,children:o.name}),e[11]=o.name,e[12]=v,e[13]=C):C=e[13];const S=C,E=`${n.name}.${o.name}`,N=`${n.name}.${o.name}`;let j;e[14]!==s?(j=()=>i(!s),e[14]=s,e[15]=j):j=e[15];const T=r?"pl-14":"pl-7";let A,M,P,R,L,B,U,D,k,$;return e[16]!==T?(A=Ne("flex flex-row gap-2 items-center flex-1",T),e[16]=T,e[17]=A):A=e[17],e[18]!==o.type||e[19]!==S?(M=c.jsx(sH,{columnName:S,dataType:o.type}),e[18]=o.type,e[19]=S,e[20]=M):M=e[20],e[21]!==_?(P=_&&y({tooltipContent:"Primary key",content:"PK"}),e[21]=_,e[22]=P):P=e[22],e[23]!==p?(R=p&&y({tooltipContent:"Indexed",content:"IDX"}),e[23]=p,e[24]=R):R=e[24],e[25]!==A||e[26]!==M||e[27]!==P||e[28]!==R?(L=c.jsxs("div",{className:A,children:[M,P,R]}),e[25]=A,e[26]=M,e[27]=P,e[28]=R,e[29]=L):L=e[29],e[30]!==o.name?(B=c.jsx(Te,{content:"Copy column name",delayDuration:400,children:c.jsx(Ae,{variant:"text",size:"icon",className:"group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground",children:c.jsx(SS,{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=c.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]!==j||e[35]!==L||e[36]!==B||e[37]!==U||e[38]!==E||e[39]!==N?(D=c.jsxs(mo,{className:"rounded-none py-1 group cursor-pointer",value:N,onSelect:j,children:[L,B,U]},E),e[34]=j,e[35]=L,e[36]=B,e[37]=U,e[38]=E,e[39]=N,e[40]=D):D=e[40],e[41]!==o||e[42]!==f||e[43]!==x||e[44]!==s||e[45]!==r||e[46]!==n?(k=s&&c.jsx("div",{className:"pl-10 pr-2 py-2 bg-[var(--slate-1)] shadow-inner border-b",children:c.jsx(Ic,{children:c.jsx(iH,{table:n,column:o,onAddColumnChart:x,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]=x,e[44]=s,e[45]=r,e[46]=n,e[47]=k):k=e[47],e[48]!==D||e[49]!==k?($=c.jsxs(c.Fragment,{children:[D,k]}),e[48]=D,e[49]=k,e[50]=$):$=e[50],$};function SF(t){const{tooltipContent:e,content:n}=t;return c.jsx(Te,{content:e,delayDuration:100,children:c.jsx("span",{className:"text-xs text-black bg-gray-100 dark:invert rounded px-1",children:n})})}const CF=()=>{const t=K.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx(_F,{}),t[0]=e):e=t[0],e},NF=()=>{const t=K.c(5),{documentation:e}=Le(lH);if(!e){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(yn,{title:"View docs as you type",description:"Move your text cursor over a symbol to see its documentation.",icon:c.jsx(_d,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=sp({html:e}),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=c.jsx("div",{className:"p-3 overflow-y-auto overflow-x-hidden h-full docs-documentation flex flex-col gap-4",children:n}),t[3]=n,t[4]=o):o=t[4],o},jF=()=>{const t=K.c(5),e=cH();if(e.length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(yn,{title:"No errors!",icon:c.jsx(Jp,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=e.map(EF),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=c.jsx("div",{className:"flex flex-col overflow-auto",children:n}),t[3]=n,t[4]=o):o=t[4],o};function EF(t){return c.jsxs("div",{children:[c.jsx("div",{className:"text-xs font-mono font-semibold bg-muted border-y px-2 py-1",children:c.jsx(dH,{cellId:t.cellId})}),c.jsx("div",{className:"px-2",children:c.jsx(uH,{errors:t.output.data,cellId:t.cellId},t.cellId)},t.cellId)]},t.cellId)}const dm=new Map,IF=({file:t,onOpenNotebook:e})=>{const{theme:n}=xr(),o=Le(mc),[r,s]=O.useState(""),{data:i,isPending:a,error:l,setData:d}=Wn(async()=>{const g=await ap({path:t.path}),p=g.contents||"";return s(dm.get(t.path)||p),g},[t.path]),u=async()=>{r!==(i==null?void 0:i.contents)&&await xH({path:t.path,contents:r}).then(g=>{g.success&&(d(p=>({...p,contents:r})),s(r))})},h=O.useRef(r);if(h.current=r,O.useEffect(()=>()=>{if(!(i!=null&&i.contents))return;const g=h.current;g===i.contents?dm.delete(t.path):dm.set(t.path,g)},[t.path,i==null?void 0:i.contents]),l)return c.jsx(Vr,{error:l});if(a||!i)return null;const f=i.mimeType||"text/plain",m=f in um;if(!i.contents&&!m)return c.jsxs("div",{className:"grid grid-cols-2 gap-2 p-6",children:[c.jsx("div",{className:"font-bold text-muted-foreground",children:"Name"}),c.jsx("div",{children:i.file.name}),c.jsx("div",{className:"font-bold text-muted-foreground",children:"Type"}),c.jsx("div",{children:f})]});const _=c.jsxs("div",{className:"text-xs text-muted-foreground p-1 flex justify-end gap-2 border-b",children:[t.isMarimoFile&&!un()&&c.jsx(Te,{content:"Open notebook",children:c.jsx(xn,{size:"small",onClick:g=>e(g),children:c.jsx(Nc,{})})}),c.jsx(Te,{content:"Download",children:c.jsx(xn,{size:"small",onClick:()=>{if(S3(f)){const g=_H(i.contents,f);return void bH(g,i.file.name)}ia(new Blob([i.contents||r],{type:f}),i.file.name)},children:c.jsx(Rm,{})})}),!S3(f)&&c.jsxs(c.Fragment,{children:[c.jsx(Te,{content:"Copy contents to clipboard",children:c.jsx(xn,{size:"small",onClick:async()=>{await _n(r)},children:c.jsx(Xi,{})})}),c.jsx(Te,{content:on("global.save"),children:c.jsx(xn,{size:"small",color:r===i.contents?void 0:"green",onClick:u,disabled:r===i.contents,children:c.jsx(Ia,{})})})]})]});return f.startsWith("image/")?c.jsxs(c.Fragment,{children:[_,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(hH,{base64:i.contents,mime:f})})]}):f==="text/csv"&&i.contents?c.jsxs(c.Fragment,{children:[_,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(fH,{contents:i.contents})})]}):f.startsWith("audio/")?c.jsxs(c.Fragment,{children:[_,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(mH,{base64:i.contents,mime:f})})]}):f.startsWith("video/")?c.jsxs(c.Fragment,{children:[_,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(pH,{base64:i.contents,mime:f})})]}):f.startsWith("application/pdf")?c.jsxs(c.Fragment,{children:[_,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(gH,{base64:i.contents,mime:f})})]}):c.jsxs(c.Fragment,{children:[_,c.jsx("div",{className:"flex-1 overflow-auto",children:c.jsx(O.Suspense,{children:c.jsx(xa,{theme:n==="dark"?"dark":"light",language:um[f]||um.default,className:"border-b",extensions:[et.lineWrapping,qn.of([{key:o.getHotkey("global.save").key,stopPropagation:!0,run:()=>r!==i.contents&&(u(),!0)}])],value:r,onChange:s})})})]})},S3=t=>t.startsWith("image/")||t.startsWith("audio/")||t.startsWith("video/")||t.startsWith("application/pdf"),um={"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"},C3=zt(new class{constructor(t){this.callbacks=t,this.delegate=new fp([]),this.rootPath="",this.onChange=Hn.NOOP,this.path=new kc("/"),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 fp(n.files),this.rootPath=n.root,this.path=kc.guessDeliminator(n.root)}catch(n){nt({title:"Failed",description:eS(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 fp(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:(nt({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:E4,createFileOrFolder:lp,deleteFileOrFolder:wH,renameFileOrFolder:yH})),AF=zt({});function TF(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 N3(t){const e=K.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:PF,onDropRejected:OF,onDrop:MF,...o},e[2]=o,e[3]=r):r=e[3],vH(r)}async function MF(t){for(const e of t){const n=FF(LF(e));let o="";n&&(o=kc.guessDeliminator(n).dirname(n));const r=(await TF(e)).split(",")[1];await lp({path:o,type:"file",name:e.name,contents:r})}await async function(){await at.get(C3).refreshAll([])}()}function OF(t){nt({title:"File upload failed",description:c.jsx("div",{className:"flex flex-col gap-1",children:t.map(DF)}),variant:"danger"})}function DF(t){return c.jsxs("div",{children:[t.file.name," (",t.errors.map(RF).join(", "),")"]},t.file.name)}function RF(t){return t.message}function PF(t){vt.error(t),nt({title:"File upload failed",description:t.message,variant:"danger"})}function LF(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 FF(t){if(t)return t.replace(/^\/+/,"")}const j3=X.createContext(null),zF=t=>{const e=K.c(60),{height:n}=t,o=O.useRef(null),[r]=Qt(C3);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=[],e[0]=s):s=e[0];const[i,a]=O.useState(s),[l,d]=O.useState(null),{openPrompt:u}=$n(),[h,f]=Qt(AF);let m,_;e[1]!==r?(m=()=>r.initialize(a),e[1]=r,e[2]=m):m=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(_=[],e[3]=_):_=e[3];const{isPending:g,error:p}=Wn(m,_);let b;e[4]!==h||e[5]!==r?(b=()=>{r.refreshAll(Object.keys(h).filter(k=>h[k]))},e[4]=h,e[5]=r,e[6]=b):b=e[6];const x=qe(b);let y;e[7]!==u||e[8]!==r?(y=async()=>{u({title:"Folder name",onConfirm:async k=>{r.createFolder(k,null)}})},e[7]=u,e[8]=r,e[9]=y):y=e[9];const v=qe(y);let C;e[10]!==u||e[11]!==r?(C=async()=>{u({title:"File name",onConfirm:async k=>{r.createFile(k,null)}})},e[10]=u,e[11]=r,e[12]=C):C=e[12];const S=qe(C);let E;e[13]!==f?(E=()=>{var k;(k=o.current)==null||k.closeAll(),f({})},e[13]=f,e[14]=E):E=e[14];const N=qe(E);if(g){let k;return e[15]===Symbol.for("react.memo_cache_sentinel")?(k=c.jsx(An,{size:"medium",centered:!0}),e[15]=k):k=e[15],k}if(p){let k;return e[16]!==p?(k=c.jsx(Vr,{error:p}),e[16]=p,e[17]=k):k=e[17],k}if(l){let k,$,I,W,G,q;return e[18]===Symbol.for("react.memo_cache_sentinel")?(k=()=>d(null),e[18]=k):k=e[18],e[19]===Symbol.for("react.memo_cache_sentinel")?($=c.jsx(Ae,{onClick:k,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:c.jsx(It,{size:16})}),e[19]=$):$=e[19],e[20]!==l.name?(I=c.jsxs("div",{className:"flex items-center pl-1 pr-3 flex-shrink-0 border-b justify-between",children:[$,c.jsx("span",{className:"font-bold",children:l.name})]}),e[20]=l.name,e[21]=I):I=e[21],e[22]!==l.path||e[23]!==r?(W=Y=>E3(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=c.jsx(O.Suspense,{children:c.jsx(IF,{onOpenNotebook:W,file:l})}),e[25]=l,e[26]=W,e[27]=G):G=e[27],e[28]!==I||e[29]!==G?(q=c.jsxs(c.Fragment,{children:[I,G]}),e[28]=I,e[29]=G,e[30]=q):q=e[30],q}let j;e[31]!==N||e[32]!==S||e[33]!==v||e[34]!==x||e[35]!==r?(j=c.jsx(UF,{onRefresh:x,onCreateFile:S,onCreateFolder:v,onCollapseAll:N,tree:r}),e[31]=N,e[32]=S,e[33]=v,e[34]=x,e[35]=r,e[36]=j):j=e[36];const T=n-33;let A,M,P,R,L,B,U,D;return e[37]!==r?(A=async k=>{const{ids:$}=k;for(const I of $)await r.delete(I)},M=async k=>{const{id:$,name:I}=k;await r.rename($,I)},P=async k=>{const{dragIds:$,parentId:I}=k;await r.move($,I)},e[37]=r,e[38]=A,e[39]=M,e[40]=P):(A=e[38],M=e[39],P=e[40]),e[41]===Symbol.for("react.memo_cache_sentinel")?(R=k=>{const $=k[0];$&&($.data.isDirectory||d($.data))},e[41]=R):R=e[41],e[42]!==h||e[43]!==f||e[44]!==r?(L=async k=>{if(await r.expand(k)){const $=h[k]??!1;f({...h,[k]:!$})}},e[42]=h,e[43]=f,e[44]=r,e[45]=L):L=e[45],e[46]!==i||e[47]!==h||e[48]!==A||e[49]!==M||e[50]!==P||e[51]!==L||e[52]!==T?(B=c.jsx(fW,{width:"100%",ref:o,height:T,className:"h-full",data:i,initialOpenState:h,openByDefault:!1,renderCursor:qF,disableDrop:GF,onDelete:A,onRename:M,onMove:P,onSelect:R,onToggle:L,padding:15,rowHeight:30,indent:BF,overscanCount:1e3,disableMultiSelection:!0,children:HF}),e[46]=i,e[47]=h,e[48]=A,e[49]=M,e[50]=P,e[51]=L,e[52]=T,e[53]=B):B=e[53],e[54]!==B||e[55]!==r?(U=c.jsx(j3,{value:r,children:B}),e[54]=B,e[55]=r,e[56]=U):U=e[56],e[57]!==U||e[58]!==j?(D=c.jsxs(c.Fragment,{children:[j,U]}),e[57]=U,e[58]=j,e[59]=D):D=e[59],D},BF=15,UF=t=>{const e=K.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}=N3(i);let d,u,h,f,m,_,g,p,b,x,y,v,C,S,E;return e[1]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(ja,{size:16}),e[1]=d):d=e[1],e[2]!==o?(u=c.jsx(Te,{content:"Add file",children:c.jsx(Ae,{"data-testid":"file-explorer-add-file-button",onClick:o,variant:"text",size:"xs",children:d})}),e[2]=o,e[3]=u):u=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(cd,{size:16}),e[4]=h):h=e[4],e[5]!==r?(f=c.jsx(Te,{content:"Add folder",children:c.jsx(Ae,{"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?(m=a({}),e[7]=a,e[8]=m):m=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(_=kH({variant:"text",size:"xs"}),g=c.jsx(CH,{size:16}),e[9]=_,e[10]=g):(_=e[9],g=e[10]),e[11]!==m?(p=c.jsx(Te,{content:"Upload file",children:c.jsx("button",{"data-testid":"file-explorer-upload-button",...m,className:_,children:g})}),e[11]=m,e[12]=p):p=e[12],e[13]!==l?(b=l({}),e[13]=l,e[14]=b):b=e[14],e[15]!==b?(x=c.jsx("input",{...b,type:"file"}),e[15]=b,e[16]=x):x=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(y=c.jsx(lS,{size:16}),e[17]=y):y=e[17],e[18]!==n?(v=c.jsx(Te,{content:"Refresh",children:c.jsx(Ae,{"data-testid":"file-explorer-refresh-button",onClick:n,variant:"text",size:"xs",children:y})}),e[18]=n,e[19]=v):v=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(C=c.jsx(Ep,{size:16}),e[20]=C):C=e[20],e[21]!==s?(S=c.jsx(Te,{content:"Collapse all folders",children:c.jsx(Ae,{"data-testid":"file-explorer-collapse-button",onClick:s,variant:"text",size:"xs",children:C})}),e[21]=s,e[22]=S):S=e[22],e[23]!==x||e[24]!==v||e[25]!==S||e[26]!==u||e[27]!==f||e[28]!==p?(E=c.jsxs("div",{className:"flex items-center justify-end px-2 flex-shrink-0 border-b",children:[u,f,p,x,v,S]}),e[23]=x,e[24]=v,e[25]=S,e[26]=u,e[27]=f,e[28]=p,e[29]=E):E=e[29],E},VF=t=>{const e=K.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&&!un()&&c.jsxs("span",{className:"flex-shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline",onClick:o,children:["open ",c.jsx(Nc,{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=c.jsxs("span",{className:"flex-1 overflow-hidden text-ellipsis",onClick:r,children:[n.data.name,s]}),e[5]=n.data.name,e[6]=r,e[7]=s,e[8]=i):i=e[8],i},$F=t=>{const e=K.c(10),{node:n}=t,o=O.useRef(null);let r,s,i,a,l;return e[0]!==n.data.name?(r=()=>{var d,u;(d=o.current)==null||d.focus(),(u=o.current)==null||u.setSelectionRange(0,n.data.name.lastIndexOf("."))},s=[n.data.name],e[0]=n.data.name,e[1]=r,e[2]=s):(r=e[1],s=e[2]),O.useEffect(r,s),e[3]!==n?(i=()=>n.reset(),a=d=>{d.key==="Escape"&&n.reset(),d.key==="Enter"&&n.submit(d.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=c.jsx("input",{ref:o,className:"flex-1 bg-transparent border border-border text-muted-foreground",defaultValue:n.data.name,onClick:YF,onBlur:i,onKeyDown:a}),e[6]=n.data.name,e[7]=i,e[8]=a,e[9]=l):l=e[9],l},HF=({node:t,style:e,dragHandle:n})=>{const o=t.data.isDirectory?"directory":N4(t.data.name),r=j4[o],{openConfirm:s,openPrompt:i}=$n(),{createNewCell:a}=bt(),l=Rs(),d=O.use(j3),u=async g=>{E3(g,d?d.relativeFromRoot(t.data.path):t.data.path)},h=async g=>{g.stopPropagation(),g.preventDefault(),s({title:"Delete file",description:`Are you sure you want to delete ${t.data.name}?`,confirmAction:c.jsx(w4,{onClick:async()=>{await t.tree.delete(t.id)},"aria-label":"Confirm",children:"Delete"})})},f=qe(async()=>{t.open(),i({title:"Folder name",onConfirm:async g=>{d==null||d.createFolder(g,t.id)}})}),m=qe(async()=>{t.open(),i({title:"File name",onConfirm:async g=>{d==null||d.createFile(g,t.id)}})}),_=qe(async()=>{var x;if(!d||t.data.isDirectory)return;const[g,p]=SH(t.data.name),b=`${g}_copy${p}`;try{const y=await ap({path:t.data.path}),v=((x=t.parent)==null?void 0:x.data.path)||"";await lp({path:v,type:"file",name:b,contents:y.contents?btoa(y.contents):void 0}),await d.refreshAll([v])}catch{nt({title:"Failed to duplicate file",description:"Unable to create a duplicate of the file",variant:"danger"})}});return c.jsxs("div",{style:e,ref:n,className:Ne("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group"),draggable:!0,onClick:g=>{g.stopPropagation(),t.data.isDirectory&&t.toggle()},children:[c.jsx(WF,{node:t}),c.jsxs("span",{className:Ne("flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group",t.willReceiveDrop&&t.data.isDirectory&&"bg-accent/80 hover:bg-accent/80 text-accent-foreground"),children:[t.data.isMarimoFile?c.jsx("img",{src:"./favicon.ico",className:"w-5 h-5 flex-shrink-0 mr-2 filter grayscale",alt:"Marimo"}):c.jsx(r,{className:"w-5 h-5 flex-shrink-0 mr-2",strokeWidth:1.5}),t.isEditing?c.jsx($F,{node:t}):c.jsx(VF,{node:t,onOpenMarimoFile:u}),c.jsxs(hr,{modal:!1,children:[c.jsx(fr,{asChild:!0,tabIndex:-1,onClick:g=>g.stopPropagation(),children:c.jsx(Ae,{"data-testid":"file-explorer-more-button",variant:"text",tabIndex:-1,size:"xs",className:"mb-0","aria-label":"More options",children:c.jsx(ld,{strokeWidth:2,className:"w-5 h-5 hidden group-hover:block"})})}),(()=>{const g={size:14,strokeWidth:1.5,className:"mr-2"};return c.jsxs(mr,{align:"end",className:"no-print w-[220px]",onClick:p=>p.stopPropagation(),onCloseAutoFocus:p=>p.preventDefault(),children:[!t.data.isDirectory&&c.jsxs(Vt,{onSelect:()=>t.select(),children:[c.jsx(dg,{...g}),"Open file"]}),!t.data.isDirectory&&!un()&&c.jsxs(Vt,{onSelect:()=>{NH({path:t.data.path})},children:[c.jsx(Nc,{...g}),"Open file in external editor"]}),t.data.isDirectory&&c.jsxs(c.Fragment,{children:[c.jsxs(Vt,{onSelect:()=>m(),children:[c.jsx(ja,{...g}),"Create file"]}),c.jsxs(Vt,{onSelect:()=>f(),children:[c.jsx(cd,{...g}),"Create folder"]}),c.jsx(bn,{})]}),c.jsxs(Vt,{onSelect:()=>t.edit(),children:[c.jsx(Kp,{...g}),"Rename"]}),!t.data.isDirectory&&c.jsxs(Vt,{onSelect:_,children:[c.jsx(Xi,{...g}),"Duplicate"]}),c.jsxs(Vt,{onSelect:async()=>{await _n(t.data.path),nt({title:"Copied to clipboard"})},children:[c.jsx(hd,{...g}),"Copy path"]}),d&&c.jsxs(Vt,{onSelect:async()=>{await _n(d.relativeFromRoot(t.data.path)),nt({title:"Copied to clipboard"})},children:[c.jsx(hd,{...g}),"Copy relative path"]}),c.jsx(bn,{}),c.jsxs(Vt,{onSelect:()=>{const{path:p}=t.data;(b=>{a({code:b,before:!1,cellId:l??"__end__"})})(BS[o](p))},children:[c.jsx(qr,{...g}),"Insert snippet for reading file"]}),c.jsxs(Vt,{onSelect:async()=>{nt({title:"Copied to clipboard",description:"Code to open the file has been copied to your clipboard. You can also drag and drop this file into the editor"});const{path:p}=t.data,b=BS[o](p);await _n(b)},children:[c.jsx(jH,{...g}),"Copy snippet for reading file"]}),t.data.isMarimoFile&&!un()&&c.jsxs(c.Fragment,{children:[c.jsx(bn,{}),c.jsxs(Vt,{onSelect:u,children:[c.jsx(sg,{...g}),"Open notebook"]})]}),c.jsx(bn,{}),!t.data.isDirectory&&c.jsxs(c.Fragment,{children:[c.jsxs(Vt,{onSelect:async()=>{const p=(await ap({path:t.data.path})).contents||"";ia(new Blob([p]),t.data.name)},children:[c.jsx(Rm,{...g}),"Download"]}),c.jsx(bn,{})]}),c.jsxs(Vt,{onSelect:h,variant:"danger",children:[c.jsx(fc,{...g}),"Delete"]})]})})()]})]})]})},WF=t=>{const e=K.c(3),{node:n}=t;if(!n.data.isDirectory){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx("span",{className:"w-5 h-5 flex-shrink-0"}),e[0]=r):r=e[0],r}let o;return e[1]!==n.isOpen?(o=n.isOpen?c.jsx(dr,{className:"w-5 h-5 flex-shrink-0"}):c.jsx(ta,{className:"w-5 h-5 flex-shrink-0"}),e[1]=n.isOpen,e[2]=o):o=e[2],o};function E3(t,e){t.stopPropagation(),t.preventDefault(),KS(e)}function qF(){return null}function GF(t){const{parentNode:e}=t;return!e.data.isDirectory}function YF(t){return t.stopPropagation()}let I3,A3,T3;I3=()=>{const t=K.c(20),{ref:e,height:n}=EH(),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}=N3(r);let l,d,u,h,f,m,_,g;return t[1]!==s?(l=s(),t[1]=s,t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(d=Ne("flex flex-col flex-1 overflow-hidden relative"),t[3]=d):d=t[3],t[4]!==i?(u=i(),t[4]=i,t[5]=u):u=t[5],t[6]!==u?(h=c.jsx("input",{...u}),t[6]=u,t[7]=h):h=t[7],t[8]!==a?(f=a&&c.jsx("div",{className:"absolute inset-0 flex items-center uppercase justify-center text-xl font-bold text-primary/90 bg-accent/85 z-10 border-2 border-dashed border-primary/90 rounded-lg pointer-events-none",children:"Drop files here"}),t[8]=a,t[9]=f):f=t[9],t[10]!==o?(m=c.jsx(zF,{height:o}),t[10]=o,t[11]=m):m=t[11],t[12]!==e||t[13]!==m?(_=c.jsx("div",{ref:e,className:"flex flex-col flex-1 overflow-hidden",children:m}),t[12]=e,t[13]=m,t[14]=_):_=t[14],t[15]!==l||t[16]!==h||t[17]!==f||t[18]!==_?(g=c.jsxs("div",{...l,className:d,children:[h,f,_]}),t[15]=l,t[16]=h,t[17]=f,t[18]=_,t[19]=g):g=t[19],g},yp=t=>{const e=K.c(6),n=t.dataTestId;let o,r;return e[0]!==t.className?(o=Ne("text-xs font-semibold text-accent-foreground",t.className),e[0]=t.className,e[1]=o):o=e[1],e[2]!==t.dataTestId||e[3]!==t.onClick||e[4]!==o?(r=c.jsx("button",{type:"button","data-testid":n,className:o,onClick:t.onClick,children:"Clear"}),e[2]=t.dataTestId,e[3]=t.onClick,e[4]=o,e[5]=r):r=e[5],r},A3=()=>{const t=K.c(9),e=IH(),{clearLogs:n}=bt();if(e.length===0){let i,a;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx("code",{className:"border rounded px-1",children:"stdout"}),t[0]=i):i=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx(yn,{title:"No logs",description:c.jsxs("span",{children:[i," and"," ",c.jsx("code",{className:"border rounded px-1",children:"stderr"})," logs will appear here."]}),icon:c.jsx(ym,{})}),t[1]=a):a=t[1],a}let o,r,s;return t[2]!==n?(o=c.jsx("div",{className:"flex flex-row justify-end px-2 py-1",children:c.jsx(yp,{dataTestId:"clear-logs-button",onClick:n})}),t[2]=n,t[3]=o):o=t[3],t[4]!==e?(r=c.jsx("div",{className:"overflow-auto flex-1",children:c.jsx(T3,{logs:e,className:"min-w-[300px]"})}),t[4]=e,t[5]=r):r=t[5],t[6]!==o||t[7]!==r?(s=c.jsxs(c.Fragment,{children:[o,r]}),t[6]=o,t[7]=r,t[8]=s):s=t[8],s},T3=t=>{const e=K.c(10),{logs:n,className:o}=t;let r,s,i,a,l;return e[0]!==o?(r=Ne("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(XF),e[3]=n,e[4]=i):i=e[4],e[5]!==i?(a=c.jsx("pre",{className:"grid text-xs font-mono gap-1 whitespace-break-spaces font-semibold align-left",children:c.jsx("div",{className:"grid grid-cols-[30px,1fr]",style:s,children:i})}),e[5]=i,e[6]=a):a=e[6],e[7]!==r||e[8]!==a?(l=c.jsx("div",{className:r,children:a}),e[7]=r,e[8]=a,e[9]=l):l=e[9],l};function JF(t){const e=AH(t.timestamp),n=KF[t.level],o=t.level.toUpperCase();return c.jsxs(c.Fragment,{children:[c.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)] dark:text-[var(--gray-11)]",children:["[",e,"]"]}),c.jsx("span",{className:Ne("flex-shrink-0",n),children:o}),c.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)]",children:["(",c.jsx(yr,{cellId:t.cellId}),")"]}),t.message]})}const KF={stdout:"text-[var(--grass-9)]",stderr:"text-[var(--red-9)]"};function XF(t,e){return c.jsxs("div",{className:"contents group",children:[c.jsx("span",{className:Ne("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","text-right col-span-1 py-1 pr-1"),children:e+1}),c.jsx("span",{className:Ne("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","px-2 flex gap-x-1.5 py-1 flex-wrap"),children:JF(t)})]},e)}const ZF=()=>{const t=K.c(7),{items:e}=Le(TH);let n,o;t[0]!==e?(o=OW(e),t[0]=e,t[1]=o):o=t[1],n=o;const r=n,{activeHeaderId:s,activeOccurrences:i}=DW(r);if(e.length===0){let l;return t[2]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(yn,{title:"No outline",description:"Add markdown headings to your notebook to create an outline.",icon:c.jsx(gd,{})}),t[2]=l):l=t[2],l}let a;return t[3]!==s||t[4]!==i||t[5]!==e?(a=c.jsx(RW,{items:e,activeHeaderId:s,activeOccurrences:i}),t[3]=s,t[4]=i,t[5]=e,t[6]=a):a=t[6],a},M3=zt(null),O3=t=>{const e=K.c(9),{onClick:n,loading:o,children:r,className:s}=t;if(o){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(An,{size:"small",className:"h-4 w-4 shrink-0 opacity-50"}),e[0]=d):d=e[0],d}let i,a,l;return e[1]!==s?(i=Ne("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=Qn.stopPropagation(n),e[3]=n,e[4]=a):a=e[4],e[5]!==r||e[6]!==i||e[7]!==a?(l=c.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},QF=()=>{var v,C;const t=K.c(27),[e]=zr(),n=e.package_management.manager,[o,r]=X.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:d}=Wn(oz,s);if(d){let S;return t[2]===Symbol.for("react.memo_cache_sentinel")?(S=c.jsx(An,{size:"medium",centered:!0}),t[2]=S):S=t[2],S}if(a){let S;return t[3]!==a?(S=c.jsx(Vr,{error:a}),t[3]=a,t[4]=S):S=t[4],S}const u=i.tree!=null;let h;t[5]!==u||t[6]!==o?(h=function(S,E){return S==="list"?"list":E?S||"tree":"list"}(o,u),t[5]=u,t[6]=o,t[7]=h):h=t[7];const f=h,m=(v=i.tree)==null?void 0:v.name,_=(C=i==null?void 0:i.tree)==null?void 0:C.version,g=m==="<root>";let p,b,x,y;return t[8]!==n||t[9]!==l?(p=c.jsx(ez,{packageManager:n,onSuccess:l}),t[8]=n,t[9]=l,t[10]=p):p=t[10],t[11]!==g||t[12]!==u||t[13]!==m||t[14]!==_||t[15]!==f?(b=u&&c.jsxs("div",{className:"flex items-center justify-between px-2 py-1 border-b",children:[c.jsxs("div",{className:"flex gap-1",children:[c.jsx("button",{type:"button",className:Ne("px-2 py-1 text-xs rounded",f==="list"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>r("list"),children:"List"}),c.jsx("button",{type:"button",className:Ne("px-2 py-1 text-xs rounded",f==="tree"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>r("tree"),children:"Tree"})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium",title:g?"sandbox":"project",children:g?"sandbox":"project"}),m&&!g&&c.jsxs("span",{className:"text-xs text-muted-foreground",children:[m,_&&` v${_}`]})]})]}),t[11]=g,t[12]=u,t[13]=m,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?(x=f==="list"?c.jsx(tz,{packages:i.list,onSuccess:l}):c.jsx(nz,{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]=x):x=t[22],t[23]!==p||t[24]!==b||t[25]!==x?(y=c.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[p,b,x]}),t[23]=p,t[24]=b,t[25]=x,t[26]=y):y=t[26],y},ez=t=>{const e=K.c(40),{onSuccess:n,packageManager:o}=t,[r,s]=X.useState(""),{handleClick:i}=wa(),a=Le(M3),l=Ot(M3);let d,u;e[0]!==a||e[1]!==l?(d=()=>{a&&(s(a),l(null))},u=[a,l],e[0]=a,e[1]=l,e[2]=d,e[3]=u):(d=e[2],u=e[3]),X.useEffect(d,u);const{loading:h,handleInstallPackages:f}=DH();let m;e[4]!==n?(m=()=>{n(),s("")},e[4]=n,e[5]=m):m=e[5];const _=m;let g;e[6]!==f||e[7]!==r||e[8]!==_?(g=()=>{f(r.split(",").map(rz),_)},e[6]=f,e[7]=r,e[8]=_,e[9]=g):g=e[9];const p=g,b=`Install packages with ${o}...`;let x,y,v,C,S,E,N,j,T,A,M,P,R,L;e[10]!==h||e[11]!==i?(x=h?c.jsx(An,{size:"small",className:"mr-2 h-4 w-4 shrink-0 opacity-50"}):c.jsx(Te,{content:"Change package manager",children:c.jsx(Ys,{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]=x):x=e[12],e[13]!==p?(y=I=>{I.key==="Enter"&&(I.preventDefault(),p())},e[13]=p,e[14]=y):y=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(v=I=>s(I.target.value),e[15]=v):v=e[15],e[16]!==r||e[17]!==b||e[18]!==x||e[19]!==y?(C=c.jsx(US,{placeholder:b,id:H1,icon:x,rootClassName:"flex-1 border-none",value:r,onKeyDown:y,onChange:v}),e[16]=r,e[17]=b,e[18]=x,e[19]=y,e[20]=C):C=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(S=c.jsx("span",{className:"font-bold tracking-wide",children:"Package name:"}),e[21]=S):S=e[21],e[22]===Symbol.for("react.memo_cache_sentinel")?(E=c.jsxs("div",{children:[S," A package name; this will install the latest version.",c.jsx("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),N=c.jsx("span",{className:"font-bold tracking-wide",children:"Package and version:"}),e[22]=E,e[23]=N):(E=e[22],N=e[23]),e[24]===Symbol.for("react.memo_cache_sentinel")?(j=c.jsxs("div",{children:[N," ","A package with a specific version or version range.",c.jsx("div",{className:"text-muted-foreground",children:"Examples: httpx==0.27.0, httpx>=0.27.0"})]}),T=c.jsx("span",{className:"font-bold tracking-wide",children:"Git:"}),e[24]=j,e[25]=T):(j=e[24],T=e[25]),e[26]===Symbol.for("react.memo_cache_sentinel")?(A=c.jsxs("div",{children:[T," A Git repository",c.jsx("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),M=c.jsx("span",{className:"font-bold tracking-wide",children:"URL:"}),e[26]=A,e[27]=M):(A=e[26],M=e[27]),e[28]===Symbol.for("react.memo_cache_sentinel")?(P=c.jsxs("div",{children:[M," A remote wheel or source distribution.",c.jsx("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),R=c.jsx("span",{className:"font-bold tracking-wide",children:"Path:"}),e[28]=P,e[29]=R):(P=e[28],R=e[29]),e[30]===Symbol.for("react.memo_cache_sentinel")?(L=c.jsx(Te,{delayDuration:300,side:"left",align:"start",content:c.jsxs("div",{className:"text-sm flex flex-col w-full max-w-[360px]",children:["Packages are installed using the package manager specified in your user configuration. Depending on your package manager, you can install packages with various formats:",c.jsxs("div",{className:"flex flex-col gap-2 mt-2",children:[E,j,A,P,c.jsxs("div",{children:[R," A local wheel, source distribution, or project directory.",c.jsx("div",{className:"text-muted-foreground",children:"Example: /example/foo-0.1.0-py3-none-any.whl"})]})]})]}),children:c.jsx(np,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),e[30]=L):L=e[30];const B=r&&"bg-accent text-accent-foreground";let U;e[31]!==B?(U=Ne("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 D=!r;let k,$;return e[33]!==p||e[34]!==U||e[35]!==D?(k=c.jsx("button",{type:"button",className:U,onClick:p,disabled:D,children:"Add"}),e[33]=p,e[34]=U,e[35]=D,e[36]=k):k=e[36],e[37]!==k||e[38]!==C?($=c.jsxs("div",{className:"flex items-center w-full border-b",children:[C,L,k]}),e[37]=k,e[38]=C,e[39]=$):$=e[39],$},tz=t=>{const e=K.c(9),{onSuccess:n,packages:o}=t;if(o.length===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx(yn,{title:"No packages",description:"No packages are installed in this environment.",icon:c.jsx(Ys,{})}),e[0]=a):a=e[0],a}let r,s,i;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(cp,{children:c.jsxs(Gs,{children:[c.jsx($r,{children:"Name"}),c.jsx($r,{children:"Version"}),c.jsx($r,{})]})}),e[1]=r):r=e[1],e[2]!==n||e[3]!==o){let a;e[5]!==n?(a=l=>c.jsxs(Gs,{className:"group",onClick:async()=>{await _n(`${l.name}==${l.version}`),nt({title:"Copied to clipboard"})},children:[c.jsx(Hr,{children:l.name}),c.jsx(Hr,{children:l.version}),c.jsxs(Hr,{className:"flex justify-end",children:[c.jsx(D3,{packageName:l.name,onSuccess:n}),c.jsx(R3,{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=c.jsxs(dp,{className:"overflow-auto flex-1",children:[r,c.jsx(up,{children:s})]}),e[7]=s,e[8]=i):i=e[8],i},D3=({packageName:t,onSuccess:e})=>{const[n,o]=X.useState(!1);return un()?null:c.jsx(O3,{onClick:async()=>{try{o(!0);const r=await RH({package:t,upgrade:!0});r.success?(e(),VS(t)):VS(t,r.error)}finally{o(!1)}},loading:n,children:"Upgrade"})},R3=({packageName:t,onSuccess:e})=>{const[n,o]=X.useState(!1);return c.jsx(O3,{onClick:async()=>{try{o(!0);const r=await PH({package:t});r.success?(e(),$S(t)):$S(t,r.error)}finally{o(!1)}},loading:n,children:"Remove"})},nz=t=>{const e=K.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]=X.useState(s);let l,d,u;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{a(new Set)},e[1]=l):l=e[1],e[2]!==n?(d=[n],e[2]=n,e[3]=d):d=e[3],X.useEffect(l,d),o){let _;return e[4]!==o?(_=c.jsx(Vr,{error:o}),e[4]=o,e[5]=_):_=e[5],_}if(!n){let _;return e[6]===Symbol.for("react.memo_cache_sentinel")?(_=c.jsx(An,{size:"medium",centered:!0}),e[6]=_):_=e[6],_}if(n.dependencies.length===0){let _;return e[7]===Symbol.for("react.memo_cache_sentinel")?(_=c.jsx(yn,{title:"No dependencies",description:"No package dependencies found in this environment.",icon:c.jsx(Ys,{})}),e[7]=_):_=e[7],_}e[8]===Symbol.for("react.memo_cache_sentinel")?(u=_=>{a(g=>{const p=new Set(g);return p.has(_)?p.delete(_):p.add(_),p})},e[8]=u):u=e[8];const h=u;let f,m;if(e[9]!==i||e[10]!==r||e[11]!==n.dependencies){let _;e[13]!==i||e[14]!==r?(_=(g,p)=>c.jsx("div",{className:"border-b",children:c.jsx(P3,{nodeId:`root-${p}`,node:g,level:0,isTopLevel:!0,expandedNodes:i,onToggle:h,onSuccess:r})},`${g.name}-${p}`),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?(m=c.jsx("div",{className:"flex-1 overflow-auto",children:c.jsx("div",{children:f})}),e[16]=f,e[17]=m):m=e[17],m},P3=t=>{const e=K.c(57),{nodeId:n,node:o,level:r,isTopLevel:s,expandedNodes:i,onToggle:a,onSuccess:l}=t,d=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,m=d?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 p;e[7]!==u||e[8]!==n||e[9]!==a?(p=U=>{U.stopPropagation(),u&&a(n)},e[7]=u,e[8]=n,e[9]=a,e[10]=p):p=e[10];const b=p,x=u&&"select-none",y=d?"px-2 py-0.5":"";let v,C;e[11]!==x||e[12]!==y?(v=Ne("flex items-center group cursor-pointer text-sm whitespace-nowrap","hover:bg-[var(--slate-2)] focus:bg-[var(--slate-2)] focus:outline-none",x,y),e[11]=x,e[12]=y,e[13]=v):v=e[13],e[14]!==m||e[15]!==d?(C=d?{}:{paddingLeft:`${m}px`},e[14]=m,e[15]=d,e[16]=C):C=e[16];const S=u?f:void 0;let E,N,j,T,A,M,P,R,L,B;return e[17]!==u||e[18]!==f?(E=u?f?c.jsx(dr,{className:"w-4 h-4 mr-2 flex-shrink-0"}):c.jsx(ta,{className:"w-4 h-4 mr-2 flex-shrink-0"}):c.jsx("div",{className:"w-4 mr-2 flex-shrink-0"}),e[17]=u,e[18]=f,e[19]=E):E=e[19],e[20]!==o.name?(N=c.jsx("span",{className:"font-medium truncate",children:o.name}),e[20]=o.name,e[21]=N):N=e[21],e[22]!==o.version?(j=o.version&&c.jsxs("span",{className:"text-muted-foreground text-xs",children:["v",o.version]}),e[22]=o.version,e[23]=j):j=e[23],e[24]!==N||e[25]!==j?(T=c.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 py-1.5",children:[N,j]}),e[24]=N,e[25]=j,e[26]=T):T=e[26],e[27]!==o.tags?(A=o.tags.map(sz),e[27]=o.tags,e[28]=A):A=e[28],e[29]!==A?(M=c.jsx("div",{className:"flex items-center gap-1 ml-2",children:A}),e[29]=A,e[30]=M):M=e[30],e[31]!==d||e[32]!==o.name||e[33]!==l?(P=d&&c.jsxs("div",{className:"flex gap-1 invisible group-hover:visible",children:[c.jsx(D3,{packageName:o.name,onSuccess:l}),c.jsx(R3,{packageName:o.name,onSuccess:l})]}),e[31]=d,e[32]=o.name,e[33]=l,e[34]=P):P=e[34],e[35]!==b||e[36]!==g||e[37]!==E||e[38]!==T||e[39]!==M||e[40]!==P||e[41]!==v||e[42]!==C||e[43]!==S?(R=c.jsxs("div",{className:v,style:C,onClick:b,onKeyDown:g,tabIndex:0,role:"treeitem","aria-selected":!1,"aria-expanded":S,children:[E,T,M,P]}),e[35]=b,e[36]=g,e[37]=E,e[38]=T,e[39]=M,e[40]=P,e[41]=v,e[42]=C,e[43]=S,e[44]=R):R=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?(L=u&&f&&c.jsx("div",{role:"group",children:o.dependencies.map((U,D)=>c.jsx(P3,{nodeId:`${n}-${D}`,node:U,level:r+1,isTopLevel:!1,expandedNodes:i,onToggle:a,onSuccess:l},`${U.name}-${D}`))}),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]=L):L=e[53],e[54]!==R||e[55]!==L?(B=c.jsxs("div",{children:[R,L]}),e[54]=R,e[55]=L,e[56]=B):B=e[56],B};async function oz(){const[t,e]=await Promise.all([MH(),OH()]);return{list:t.packages,tree:e.tree}}function rz(t){return t.trim()}function sz(t,e){return t.kind==="cycle"?c.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-orange-300 dark:border-orange-700 text-orange-700 dark:text-orange-300",title:"cycle",children:"cycle"},e):t.kind==="extra"?c.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-blue-300 dark:border-blue-700 text-blue-700 dark:text-blue-300",title:t.value,children:t.value},e):t.kind==="group"?c.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-green-300 dark:border-green-700 text-green-700 dark:text-green-300",title:t.value,children:t.value},e):null}const hm=t4("marimo:scratchpadHistory:v1",[]),iz=zt(!1),az=zt(null,(t,e,n)=>{if(!(n=n.trim()))return;const o=t(hm),r=[n,...o.filter(s=>s!==n)].slice(0,15);e(hm,r)}),lz={hide_code:!1,disabled:!1},cz=()=>{const t=K.c(69),e=Ac(),[n]=zr(),{theme:o}=xr(),r=O.useRef(null),s=Rs(),{createNewCell:i,updateCellCode:a}=bt(),l=e.cellRuntime[wr],d=l==null?void 0:l.output,u=l==null?void 0:l.status,h=l==null?void 0:l.consoleOutputs,f=e.cellData[wr],m=(f==null?void 0:f.code)??"",_=Ot(az),[g,p]=Qt(iz),b=Le(hm);let x;t[0]!==_||t[1]!==m?(x=()=>{HS({code:m}),_(m)},t[0]=_,t[1]=m,t[2]=x):x=t[2];const y=qe(x);let v;t[3]!==m||t[4]!==i||t[5]!==s?(v=()=>{m.trim()&&i({code:m,before:!1,cellId:s??"__end__"})},t[3]=m,t[4]=i,t[5]=s,t[6]=v):v=t[6];const C=qe(v);let S;t[7]!==a?(S=()=>{a({cellId:wr,code:"",formattingChange:!1}),HS({code:""});const ae=r.current;ae&&ae.dispatch({changes:{from:0,to:ae.state.doc.length,insert:""}})},t[7]=a,t[8]=S):S=t[8];const E=qe(S);let N;t[9]!==p||t[10]!==a?(N=ae=>{p(!1),a({cellId:wr,code:ae,formattingChange:!1});const Ce=r.current;Ce&&Ce.dispatch({changes:{from:0,to:Ce.state.doc.length,insert:ae}})},t[9]=p,t[10]=a,t[11]=N):N=t[11];const j=qe(N),[T,A]=O.useState();let M;t[12]!==m||t[13]!==h||t[14]!==y||t[15]!==T||t[16]!==d||t[17]!==o||t[18]!==n?(M=()=>c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[40%]",children:c.jsx(sh,{theme:o,showPlaceholder:!1,id:wr,code:m,config:lz,status:"idle",serializedEditorState:null,runCell:y,userConfig:n,editorViewRef:r,setEditorView:ae=>{r.current=ae},hidden:!1,showHiddenCode:Hn.NOOP,languageAdapter:T,setLanguageAdapter:A})}),c.jsx("div",{className:"flex-1 overflow-auto flex-shrink-0",children:c.jsx(Jc,{allowExpand:!1,output:d,className:"output-area",cellId:wr,stale:!1,loading:!1})}),c.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[35%]",children:c.jsx(_p,{consoleOutputs:h,className:"overflow-auto",stale:!1,cellName:n4,onSubmitDebugger:Hn.NOOP,cellId:wr,debuggerActive:!1})})]}),t[12]=m,t[13]=h,t[14]=y,t[15]=T,t[16]=d,t[17]=o,t[18]=n,t[19]=M):M=t[19];const P=M;let R;t[20]!==j||t[21]!==b||t[22]!==g||t[23]!==o?(R=()=>g?c.jsx("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:c.jsx("div",{className:"overflow-auto flex flex-col gap-3",children:b.map((ae,Ce)=>c.jsx("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>j(ae),children:c.jsx(O.Suspense,{children:c.jsx(xa,{language:"python",theme:o,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:ae.trim(),editable:!1,readOnly:!0})})},Ce))})}):null,t[20]=j,t[21]=b,t[22]=g,t[23]=o,t[24]=R):R=t[24];const L=R;let B,U,D,k,$,I,W,G,q,Y,ee;t[25]===Symbol.for("react.memo_cache_sentinel")?(B=bm.create(wr),U=c.jsx("p",{className:"mx-2 my-2 text-muted-foreground text-sm",children:"Use this scratchpad cell to experiment with code without restrictions on variable names. Scratchpad code is ephemeral: variables defined in the scratchpad aren't saved to notebook memory, and the code is not saved in the notebook file."}),t[25]=B,t[26]=U):(B=t[25],U=t[26]),t[27]===Symbol.for("react.memo_cache_sentinel")?(D=on("cell.run"),t[27]=D):D=t[27],t[28]===Symbol.for("react.memo_cache_sentinel")?(k=c.jsx(Wr,{color:"var(--grass-11)",size:16}),t[28]=k):k=t[28],t[29]!==y||t[30]!==g?($=c.jsx(Te,{content:D,children:c.jsx(Ae,{"data-testid":"scratchpad-run-button",onClick:y,disabled:g,variant:"text",size:"xs",children:k})}),t[29]=y,t[30]=g,t[31]=$):$=t[31],t[32]===Symbol.for("react.memo_cache_sentinel")?(I=c.jsx(Ap,{size:16}),t[32]=I):I=t[32],t[33]!==E||t[34]!==g?(W=c.jsx(Te,{content:"Clear code and outputs",children:c.jsx(Ae,{disabled:g,size:"xs",variant:"text",onClick:E,children:I})}),t[33]=E,t[34]=g,t[35]=W):W=t[35],t[36]===Symbol.for("react.memo_cache_sentinel")?(G=c.jsx(qr,{size:16}),t[36]=G):G=t[36],t[37]!==C||t[38]!==g?(q=c.jsx(ei,{children:c.jsx(Te,{content:"Insert code",children:c.jsx(Ae,{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")&&c.jsx(An,{className:"inline",size:"small"}),t[40]=u,t[41]=Y):Y=t[41],t[42]===Symbol.for("react.memo_cache_sentinel")?(ee=c.jsx("div",{className:"flex-1"}),t[42]=ee):ee=t[42];const oe=g&&"bg-[var(--sky-3)] rounded-none";let ie,Z;t[43]!==oe?(ie=Ne(oe),t[43]=oe,t[44]=ie):ie=t[44],t[45]!==g||t[46]!==p?(Z=()=>p(!g),t[45]=g,t[46]=p,t[47]=Z):Z=t[47];const Q=b.length===0;let me,fe,de,ue,ce,ke,Se;return t[48]===Symbol.for("react.memo_cache_sentinel")?(me=c.jsx(Lp,{size:16}),t[48]=me):me=t[48],t[49]!==ie||t[50]!==Z||t[51]!==Q?(fe=c.jsx(Te,{content:"Toggle history",children:c.jsx(Ae,{size:"xs",variant:"text",className:ie,onClick:Z,disabled:Q,children:me})}),t[49]=ie,t[50]=Z,t[51]=Q,t[52]=fe):fe=t[52],t[53]!==$||t[54]!==W||t[55]!==q||t[56]!==Y||t[57]!==fe?(de=c.jsxs("div",{className:"flex items-center flex-shrink-0",children:[$,W,q,Y,ee,fe]}),t[53]=$,t[54]=W,t[55]=q,t[56]=Y,t[57]=fe,t[58]=de):de=t[58],t[59]!==P?(ue=P(),t[59]=P,t[60]=ue):ue=t[60],t[61]!==L?(ce=L(),t[61]=L,t[62]=ce):ce=t[62],t[63]!==ue||t[64]!==ce?(ke=c.jsxs("div",{className:"flex-1 divide-y relative overflow-hidden flex flex-col",children:[ue,ce]}),t[63]=ue,t[64]=ce,t[65]=ke):ke=t[65],t[66]!==de||t[67]!==ke?(Se=c.jsxs("div",{className:"flex flex-col h-full overflow-hidden divide-y",id:B,children:[U,de,ke]}),t[66]=de,t[67]=ke,t[68]=Se):Se=t[68],Se},dz=()=>{const t=K.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx(cz,{}),t[0]=e):e=t[0],e},uz=()=>{const t=K.c(23),{openModal:e,closeModal:n}=$n();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}=Wn(fz,o);if(s){let b;return t[1]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(An,{size:"medium",centered:!0}),t[1]=b):b=t[1],b}if(i){let b;return t[2]!==i?(b=c.jsx(Vr,{error:i}),t[2]=i,t[3]=b):b=t[3],b}let l;t[4]!==r?(l=r.filter(mz).map(pz),t[4]=r,t[5]=l):l=t[5];const d=l;if(r.length===0){let b;return t[6]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(yn,{title:"No environment variables",description:"No environment variables are available in this notebook.",icon:c.jsx(dd,{})}),t[6]=b):b=t[6],b}let u,h,f,m,_,g,p;return t[7]!==n||t[8]!==e||t[9]!==d||t[10]!==a?(u=()=>e(c.jsx(Fg,{providerNames:d,onSuccess:()=>{a(),n()},onClose:n})),t[7]=n,t[8]=e,t[9]=d,t[10]=a,t[11]=u):u=t[11],t[12]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(br,{className:"h-4 w-4"}),t[12]=h):h=t[12],t[13]!==u?(f=c.jsx("div",{className:"flex justify-end h-8 border-b",children:c.jsx("button",{type:"button",className:"float-right border-l px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:u,children:h})}),t[13]=u,t[14]=f):f=t[14],t[15]===Symbol.for("react.memo_cache_sentinel")?(m=c.jsx(cp,{children:c.jsxs(Gs,{children:[c.jsx($r,{children:"Environment Variable"}),c.jsx($r,{children:"Source"}),c.jsx($r,{})]})}),t[15]=m):m=t[15],t[16]!==r?(_=r.map(gz),t[16]=r,t[17]=_):_=t[17],t[18]!==_?(g=c.jsxs(dp,{className:"overflow-auto flex-1 mb-16",children:[m,c.jsx(up,{children:_})]}),t[18]=_,t[19]=g):g=t[19],t[20]!==f||t[21]!==g?(p=c.jsxs("div",{className:"flex flex-col h-full",children:[f,g]}),t[20]=f,t[21]=g,t[22]=p):p=t[22],p},hz=t=>{const e=K.c(9),{className:n,ariaLabel:o,onCopy:r}=t,[s,i]=X.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 d,u;return e[2]!==s?(d=s?c.jsx(Cc,{className:"w-3 h-3 text-green-700 rounded"}):c.jsx(Xi,{className:"w-3 h-3 hover:bg-muted rounded"}),e[2]=s,e[3]=d):d=e[3],e[4]!==o||e[5]!==n||e[6]!==l||e[7]!==d?(u=c.jsx("button",{type:"button",className:n,onClick:l,"aria-label":o,children:d}),e[4]=o,e[5]=n,e[6]=l,e[7]=d,e[8]=u):u=e[8],u};async function fz(){return Lg((await oC.request({})).secrets)}function mz(t){return t.provider!=="env"}function pz(t){return t.name}function gz(t){return t.keys.map(e=>c.jsxs(Gs,{className:"group",children:[c.jsx(Hr,{children:e}),c.jsx(Hr,{children:t.provider!=="env"&&c.jsx(NS,{variant:"outline",className:"select-none",children:t.name})}),c.jsx(Hr,{children:c.jsx(hz,{ariaLabel:`Copy ${e}`,onCopy:async()=>{await _n(`os.environ["${e}"]`),nt({title:"Copied to clipboard",description:`os.environ["${e}"] has been copied to your clipboard.`})},className:Ne("float-right px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible")})})]},`${t.name}-${e}`))}const _z=t=>{const e=K.c(6),{children:n}=t,{openModal:o,closeModal:r}=$n();let s,i;return e[0]!==r||e[1]!==o?(s=()=>o(c.jsx(xz,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(i=c.jsx(bS,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=i):i=e[5],i},bz=[et.lineWrapping],xz=t=>{const e=K.c(23),{onClose:n}=t,[o,r]=O.useState(""),{theme:s}=xr();let i,a,l,d,u,h;e[0]!==n?(i=async y=>{y.preventDefault();const v=new FormData(y.target),C=v.get("title"),S=v.get("description"),E=v.get("code");fetch("https://marimo.io/api/suggest-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:C,description:S,code:E})}),n(),nt({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=c.jsx(sr,{children:"Contribute a Snippet"}),e[2]=a):a=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsxs(Ts,{children:[a,c.jsxs(Ms,{children:["Have a useful snippet you want to share with the community? Submit it here or make a pull request"," ",c.jsx("a",{href:Zn.githubPage,target:"_blank",className:"underline",children:"on GitHub"}),"."]})]}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(ir,{id:"title",name:"title",autoFocus:!0,placeholder:"Title",required:!0,autoComplete:"off"}),u=c.jsx(LH,{id:"description",name:"description",autoFocus:!0,placeholder:"Description",rows:5,required:!0,autoComplete:"off"}),e[4]=d,e[5]=u):(d=e[4],u=e[5]),e[6]!==o?(h=c.jsx("input",{type:"hidden",name:"code",value:o}),e[6]=o,e[7]=h):h=e[7];const f=s==="dark"?"dark":"light";let m,_,g,p,b,x;return e[8]!==o||e[9]!==f?(m=c.jsx(xa,{theme:f,language:"python",className:"cm border rounded overflow-hidden",extensions:bz,value:o,onChange:r}),e[8]=o,e[9]=f,e[10]=m):m=e[10],e[11]!==h||e[12]!==m?(_=c.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[d,u,h,m]}),e[11]=h,e[12]=m,e[13]=_):_=e[13],e[14]!==n?(g=c.jsx(Ae,{"data-testid":"snippet-cancel-button",variant:"secondary",onClick:n,children:"Cancel"}),e[14]=n,e[15]=g):g=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx(Ae,{"data-testid":"snippet-send-button","aria-label":"Save",variant:"default",type:"submit",children:"Send"}),e[16]=p):p=e[16],e[17]!==g?(b=c.jsxs(Ki,{children:[g,p]}),e[17]=g,e[18]=b):b=e[18],e[19]!==i||e[20]!==b||e[21]!==_?(x=c.jsx(ar,{className:"w-fit",children:c.jsxs("form",{onSubmit:i,children:[l,_,b]})}),e[19]=i,e[20]=b,e[21]=_,e[22]=x):x=e[22],x},yz=[et.lineWrapping],wz=()=>{const t=K.c(20),[e,n]=X.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}=Wn(Sz,o);if(s){let b;return t[1]!==s?(b=c.jsx(Vr,{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=c.jsx(An,{size:"medium",centered:!0}),t[3]=b):b=t[3],b}const a=e?"h-1/3":"h-full";let l,d,u,h,f,m,_,g,p;return t[4]!==a?(l=Ne("border-b rounded-none",a),t[4]=a,t[5]=l):l=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(na,{placeholder:"Search snippets...",className:"h-6 m-1",rootClassName:"flex-1 border-r"}),t[6]=d):d=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsxs("div",{className:"flex items-center w-full",children:[d,c.jsx(_z,{children:c.jsx("button",{className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:c.jsx(br,{className:"h-4 w-4"})})})]}),h=c.jsx(gc,{children:"No results"}),t[7]=u,t[8]=h):(u=t[7],h=t[8]),t[9]===Symbol.for("react.memo_cache_sentinel")?(f=b=>n(b),t[9]=f):f=t[9],t[10]!==r.snippets?(m=c.jsx(kz,{onSelect:f,snippets:r.snippets}),t[10]=r.snippets,t[11]=m):m=t[11],t[12]!==l||t[13]!==m?(_=c.jsxs(Ec,{className:l,children:[u,h,m]}),t[12]=l,t[13]=m,t[14]=_):_=t[14],t[15]!==e?(g=c.jsx(O.Suspense,{children:c.jsx("div",{className:"h-2/3 snippet-viewer flex flex-col",children:e?c.jsx(vz,{snippet:e},e.title):c.jsx(yn,{title:"",description:"Click on a snippet to view its content."})})}),t[15]=e,t[16]=g):g=t[16],t[17]!==_||t[18]!==g?(p=c.jsxs("div",{className:"flex-1 overflow-hidden",children:[_,g]}),t[17]=_,t[18]=g,t[19]=p):p=t[19],p},vz=t=>{const e=K.c(27),{snippet:n}=t,{theme:o}=xr(),{createNewCell:r}=bt(),s=Rs();let i;e[0]!==r||e[1]!==s||e[2]!==n.sections?(i=()=>{for(const p of[...n.sections].reverse())p.code&&r({code:p.code,before:!1,cellId:s??"__end__",skipIfCodeExists:!0})},e[0]=r,e[1]=s,e[2]=n.sections,e[3]=i):i=e[3];const a=i;let l;e[4]!==r||e[5]!==s?(l=p=>{r({code:p,before:!1,cellId:s??"__end__"})},e[4]=r,e[5]=s,e[6]=l):l=e[6];const d=l;let u,h,f,m,_,g;if(e[7]!==n.title?(u=c.jsx("div",{className:"text-sm font-semibold bg-muted border-y px-2 py-1",children:n.title}),e[7]=n.title,e[8]=u):u=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(qr,{className:"ml-2 h-4 w-4"}),e[9]=h):h=e[9],e[10]!==a?(f=c.jsx("div",{className:"flex justify-end",children:c.jsx(ei,{children:c.jsxs(Ae,{className:"float-right",size:"xs",variant:"outline",onClick:a,children:["Insert snippet",h]})})}),e[10]=a,e[11]=f):f=e[11],e[12]!==d||e[13]!==n.sections||e[14]!==n.title||e[15]!==o){let p;e[17]!==d||e[18]!==n.title||e[19]!==o?(p=b=>{const{code:x,html:y,id:v}=b;return y?c.jsx("div",{children:sp({html:y})},`${n.title}-${v}`):x?c.jsxs("div",{className:"relative hover-actions-parent pr-2",children:[c.jsx(ei,{children:c.jsx(Te,{content:"Insert snippet",children:c.jsx(Ae,{className:"absolute -top-2 -right-1 z-10 hover-action px-2 bg-background",size:"sm",variant:"outline",onClick:()=>{d(x)},children:c.jsx(qr,{className:"h-5 w-5"})})})}),c.jsx(O.Suspense,{children:c.jsx(xa,{theme:o==="dark"?"dark":"light",language:"python",className:"cm border rounded overflow-hidden",extensions:yz,value:x,readOnly:!0},`${n.title}-${v}`)})]},`${n.title}-${v}`):null},e[17]=d,e[18]=n.title,e[19]=o,e[20]=p):p=e[20],m=n.sections.map(p),e[12]=d,e[13]=n.sections,e[14]=n.title,e[15]=o,e[16]=m}else m=e[16];return e[21]!==f||e[22]!==m?(_=c.jsxs("div",{className:"px-2 py-2 space-y-4 overflow-auto flex-1",children:[f,m]}),e[21]=f,e[22]=m,e[23]=_):_=e[23],e[24]!==u||e[25]!==_?(g=c.jsxs(c.Fragment,{children:[u,_]}),e[24]=u,e[25]=_,e[26]=g):g=e[26],g},kz=t=>{const e=K.c(7),{snippets:n,onSelect:o}=t;let r,s;if(e[0]!==o||e[1]!==n){let i;e[3]!==o?(i=a=>c.jsx(mo,{className:"rounded-none",onSelect:()=>o(a),children:c.jsx("div",{className:"flex flex-row gap-2 items-center",children:c.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=c.jsx(Jm,{className:"flex flex-col overflow-auto",children:r}),e[5]=r,e[6]=s):s=e[6],s};function Sz(){return FH()}const Cz=X.lazy(()=>Km(()=>import("./tracing-DGevMtzp.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124]),import.meta.url).then(t=>({default:t.Tracing}))),Nz=()=>{const t=K.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx(X.Suspense,{fallback:c.jsx(jz,{}),children:c.jsx(Cz,{})}),t[0]=e):e=t[0],e},jz=()=>{const t=K.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:c.jsx(An,{})}),t[0]=e):e=t[0],e},L3="name",F3="type-value",fm="defs-refs",Ez=[{id:L3,accessorFn:t=>[t.name,t.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>c.jsx(hp,{header:"Name",column:t}),cell:({getValue:t})=>{const[e,n]=t();return c.jsx(Cf,{name:e,declaredBy:n})}},{id:F3,accessorFn:t=>[t.dataType,t.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>c.jsx(hp,{header:c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("span",{children:"Type"}),c.jsx("span",{children:"Value"})]}),column:t}),cell:({getValue:t})=>{const[e,n]=t();return c.jsxs("div",{className:"max-w-[150px]",children:[c.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs",children:e}),c.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap",title:n??"",children:n})]})}},{id:fm,accessorFn:t=>[t.declaredBy,t.usedBy,t.name,t.declaredByNames,t.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:t})=>c.jsx(hp,{header:c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("span",{children:"Declared By"}),c.jsx("span",{children:"Used By"})]}),column:t}),cell:({getValue:t})=>{const[e,n,o]=t(),r=s=>{const i=Qi(s);i&&ip(i,o)};return c.jsxs("div",{className:"flex flex-col gap-1 py-1",children:[c.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-center",children:[c.jsx("span",{title:"Declared by",children:c.jsx(og,{className:"w-3.5 h-3.5 text-muted-foreground"})}),e.length===1?c.jsx(yr,{variant:"focus",cellId:e[0],skipScroll:!0,onClick:()=>r(e[0])}):c.jsx("div",{className:"text-destructive flex flex-row gap-2",children:e.slice(0,3).map((s,i)=>c.jsxs("span",{className:"flex",children:[c.jsx(yr,{variant:"focus",cellId:s,skipScroll:!0,className:"whitespace-nowrap text-destructive",onClick:()=>r(s)},s),i<e.length-1&&", "]},s))})]}),c.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-baseline",children:[c.jsx("span",{title:"Used by",children:c.jsx(Aa,{className:"w-3.5 h-3.5 text-muted-foreground"})}),c.jsx(ak,{maxCount:3,cellIds:n,skipScroll:!0,onClick:r})]})]})}}],z3=O.memo(({className:t,cellIds:e,variables:n})=>{const[o,r]=X.useState([]),[s,i]=X.useState(""),a=zH(),l=O.useMemo(()=>{const h=f=>{const m=a[f];return HH(m)?`cell-${e.indexOf(f)}`:m??`cell-${e.indexOf(f)}`};return Object.values(n).map(f=>({...f,declaredByNames:f.declaredBy.map(h),usedByNames:f.usedBy.map(h)}))},[n,a,e]),d=O.useMemo(()=>{const h=new Map;return e.forEach((f,m)=>h.set(f,m)),function({variables:f,sort:m,cellIdToIndex:_}){m||(m={id:fm,desc:!1});let g=[];switch(m.id){case L3:g=ka(f,p=>p.name);break;case F3:g=ka(f,p=>p.dataType);break;case fm:g=ka(f,p=>_.get(p.declaredBy[0]))}return m.desc?g.reverse():g}({variables:l,sort:o[0],cellIdToIndex:h})},[l,o,e]),u=BH({data:d,columns:Ez,getCoreRowModel:$H(),onGlobalFilterChange:i,getFilteredRowModel:VH(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter:h=>h.columnDef.enableGlobalFilter??!0,globalFilterFn:"auto",manualSorting:!0,onSortingChange:r,getSortedRowModel:UH(),state:{sorting:o,globalFilter:s}});return c.jsxs(c.Fragment,{children:[c.jsx(US,{className:"w-full",placeholder:"Search",value:s,onChange:h=>i(h.target.value)}),c.jsxs(dp,{className:Ne("w-full text-sm flex-1 border-separate border-spacing-0",t),children:[c.jsx(cp,{children:c.jsx(Gs,{className:"whitespace-nowrap text-xs",children:u.getFlatHeaders().map(h=>c.jsx($r,{className:"sticky top-0 bg-background border-b",children:WS(h.column.columnDef.header,h.getContext())},h.id))})}),c.jsx(up,{children:u.getRowModel().rows.map(h=>c.jsx(Gs,{className:"hover:bg-accent",children:h.getVisibleCells().map(f=>c.jsx(Hr,{className:"border-b",children:WS(f.column.columnDef.cell,f.getContext())},f.id))},h.id))})]})]})});z3.displayName="VariableTable";const Iz=()=>{const t=K.c(4),e=ES(),n=Zc();if(Object.keys(e).length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(yn,{title:"No variables",description:"Global variables will appear here.",icon:c.jsx(sc,{})}),t[0]=r):r=t[0],r}let o;return t[1]!==n.inOrderIds||t[2]!==e?(o=c.jsx(z3,{className:"flex-1",cellIds:n.inOrderIds,variables:e}),t[1]=n.inOrderIds,t[2]=e,t[3]=o):o=t[3],o},Az=X.lazy(()=>Km(()=>import("./terminal-DKZoyrP7.js"),__vite__mapDeps([125,1,2,126]),import.meta.url)),Tz=t=>{const e=K.c(121),{children:n}=t,{isSidebarOpen:o,isTerminalOpen:r,selectedPanel:s}=Sc(),{setIsSidebarOpen:i,setIsTerminalOpen:a}=sa(),l=X.useRef(null),d=X.useRef(null);let u,h,f,m,_;e[0]!==o?(u=()=>{if(!l.current)return;const xe=l.current.isCollapsed();o&&xe&&l.current.expand(),o||xe||l.current.collapse(),requestAnimationFrame(Oz)},h=[o],e[0]=o,e[1]=u,e[2]=h):(u=e[1],h=e[2]),O.useEffect(u,h),e[3]!==r?(f=()=>{if(!d.current)return;const xe=d.current.isCollapsed();r&&xe&&d.current.expand(),r||xe||d.current.collapse(),requestAnimationFrame(Rz)},m=[r],e[3]=r,e[4]=f,e[5]=m):(f=e[4],m=e[5]),O.useEffect(f,m),e[6]!==n?(_=c.jsx(ed,{id:"app",className:"relative h-full",children:c.jsx(O.Suspense,{children:n})},"app"),e[6]=n,e[7]=_):_=e[7];const g=_,p=o?"resize-handle":"resize-handle-collapsed";let b,x;e[8]!==p?(b=Ne("border-border no-print z-10",p,"vertical"),e[8]=p,e[9]=b):b=e[9],e[10]!==b?(x=c.jsx(qS,{onDragging:GS,className:b}),e[10]=b,e[11]=x):x=e[11];const y=x,v=r?"resize-handle":"resize-handle-collapsed";let C,S;e[12]!==v?(C=Ne("border-border no-print z-20",v,"horizontal"),e[12]=v,e[13]=C):C=e[13],e[14]!==C?(S=c.jsx(qS,{onDragging:GS,className:C}),e[14]=C,e[15]=S):S=e[15];const E=S;let N,j,T,A,M,P,R,L,B,U,D,k,$,I,W,G,q,Y,ee,oe,ie;e[16]!==s?(N=c.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?(j=()=>i(!1),e[18]=i,e[19]=j):j=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(T=c.jsx(eo,{className:"w-4 h-4"}),e[20]=T):T=e[20],e[21]!==j?(A=c.jsx(Ae,{"data-testid":"close-helper-pane",className:"m-0",size:"xs",variant:"text",onClick:j,children:T}),e[21]=j,e[22]=A):A=e[22],e[23]!==N||e[24]!==A?(M=c.jsxs("div",{className:"p-3 border-b flex justify-between items-center",children:[N,A]}),e[23]=N,e[24]=A,e[25]=M):M=e[25],e[26]!==s?(P=s==="files"&&c.jsx(I3,{}),e[26]=s,e[27]=P):P=e[27],e[28]!==s?(R=s==="errors"&&c.jsx(jF,{}),e[28]=s,e[29]=R):R=e[29],e[30]!==s?(L=s==="variables"&&c.jsx(Iz,{}),e[30]=s,e[31]=L):L=e[31],e[32]!==s?(B=s==="dependencies"&&c.jsx(hF,{}),e[32]=s,e[33]=B):B=e[33],e[34]!==s?(U=s==="packages"&&c.jsx(QF,{}),e[34]=s,e[35]=U):U=e[35],e[36]!==s?(D=s==="outline"&&c.jsx(ZF,{}),e[36]=s,e[37]=D):D=e[37],e[38]!==s?(k=s==="datasources"&&c.jsx(CF,{}),e[38]=s,e[39]=k):k=e[39],e[40]!==s?($=s==="documentation"&&c.jsx(NF,{}),e[40]=s,e[41]=$):$=e[41],e[42]!==s?(I=s==="snippets"&&c.jsx(wz,{}),e[42]=s,e[43]=I):I=e[43],e[44]!==s?(W=s==="scratchpad"&&c.jsx(dz,{}),e[44]=s,e[45]=W):W=e[45],e[46]!==s?(G=s==="chat"&&c.jsx(RR,{}),e[46]=s,e[47]=G):G=e[47],e[48]!==s?(q=s==="logs"&&c.jsx(A3,{}),e[48]=s,e[49]=q):q=e[49],e[50]!==s?(Y=s==="tracing"&&c.jsx(Nz,{}),e[50]=s,e[51]=Y):Y=e[51],e[52]!==s?(ee=s==="secrets"&&c.jsx(uz,{}),e[52]=s,e[53]=ee):ee=e[53],e[54]!==P||e[55]!==R||e[56]!==L||e[57]!==B||e[58]!==U||e[59]!==D||e[60]!==k||e[61]!==$||e[62]!==I||e[63]!==W||e[64]!==G||e[65]!==q||e[66]!==Y||e[67]!==ee?(oe=c.jsx(O.Suspense,{children:c.jsxs(Kc,{children:[P,R,L,B,U,D,k,$,I,W,G,q,Y,ee]})}),e[54]=P,e[55]=R,e[56]=L,e[57]=B,e[58]=U,e[59]=D,e[60]=k,e[61]=$,e[62]=I,e[63]=W,e[64]=G,e[65]=q,e[66]=Y,e[67]=ee,e[68]=oe):oe=e[68],e[69]!==M||e[70]!==oe?(ie=c.jsx(Ic,{children:c.jsxs("div",{className:"flex flex-col h-full flex-1 overflow-hidden mr-[-4px]",children:[M,oe]})}),e[69]=M,e[70]=oe,e[71]=ie):ie=e[71];const Z=ie,Q=o&&"border-r border-l border-[var(--slate-7)]";let me,fe,de,ue,ce,ke;e[72]!==Q?(me=Ne("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",Q),e[72]=Q,e[73]=me):me=e[73],e[74]===Symbol.for("react.memo_cache_sentinel")?(fe=(xe,Ve)=>{var Be;Ve===0&&xe===10&&((Be=l.current)==null||Be.resize(30))},e[74]=fe):fe=e[74],e[75]!==i?(de=()=>i(!1),ue=()=>i(!0),e[75]=i,e[76]=de,e[77]=ue):(de=e[76],ue=e[77]),e[78]!==Z||e[79]!==y?(ce=c.jsxs("span",{className:"flex flex-row h-full",children:[Z," ",y]}),e[78]=Z,e[79]=y,e[80]=ce):ce=e[80],e[81]!==me||e[82]!==de||e[83]!==ue||e[84]!==ce?(ke=c.jsx(ed,{ref:l,id:"helper",collapsedSize:0,collapsible:!0,className:me,minSize:10,defaultSize:0,maxSize:75,onResize:fe,onCollapse:de,onExpand:ue,children:ce},"helper"),e[81]=me,e[82]=de,e[83]=ue,e[84]=ce,e[85]=ke):ke=e[85];const Se=ke,ae=r&&"border-[var(--slate-7)]";let Ce,_e,Ee,ze,Oe,He,Fe,it,Qe;e[86]!==ae?(Ce=Ne("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",ae),e[86]=ae,e[87]=Ce):Ce=e[87],e[88]===Symbol.for("react.memo_cache_sentinel")?(_e=(xe,Ve)=>{var Be;Ve===0&&xe===10&&((Be=d.current)==null||Be.resize(30))},e[88]=_e):_e=e[88],e[89]!==a?(Ee=()=>a(!1),ze=()=>a(!0),e[89]=a,e[90]=Ee,e[91]=ze):(Ee=e[90],ze=e[91]),e[92]===Symbol.for("react.memo_cache_sentinel")?(Oe=c.jsx("div",{}),e[92]=Oe):Oe=e[92],e[93]!==a?(He=()=>a(!1),e[93]=a,e[94]=He):He=e[94],e[95]!==r||e[96]!==He?(Fe=c.jsx(O.Suspense,{fallback:Oe,children:c.jsx(Az,{visible:r,onClose:He})}),e[95]=r,e[96]=He,e[97]=Fe):Fe=e[97],e[98]!==r||e[99]!==Fe?(it=c.jsx(fF,{isOpen:r,children:Fe}),e[98]=r,e[99]=Fe,e[100]=it):it=e[100],e[101]!==Ce||e[102]!==Ee||e[103]!==ze||e[104]!==it||e[105]!==E?(Qe=c.jsxs(ed,{ref:d,id:"terminal",collapsedSize:0,collapsible:!0,className:Ce,minSize:10,defaultSize:0,maxSize:75,onResize:_e,onCollapse:Ee,onExpand:ze,children:[E,it]},"terminal"),e[101]=Ce,e[102]=Ee,e[103]=ze,e[104]=it,e[105]=E,e[106]=Qe):Qe=e[106];const tt=Qe;let ne,ve,je,Re,J,se,ge,pe;return e[107]===Symbol.for("react.memo_cache_sentinel")?(ne=PW(),e[107]=ne):ne=e[107],e[108]===Symbol.for("react.memo_cache_sentinel")?(ve=c.jsx(Kc,{children:c.jsx(g9,{})}),e[108]=ve):ve=e[108],e[109]!==tt?(je=c.jsx(ew,{capability:"terminal",children:tt}),e[109]=tt,e[110]=je):je=e[110],e[111]!==g||e[112]!==je?(Re=c.jsx(ed,{children:c.jsxs(YS,{autoSaveId:"marimo:chrome:v1:l1",direction:"vertical",children:[g,je]})}),e[111]=g,e[112]=je,e[113]=Re):Re=e[113],e[114]===Symbol.for("react.memo_cache_sentinel")?(J=c.jsx(WH,{}),e[114]=J):J=e[114],e[115]!==Se||e[116]!==Re?(se=c.jsxs(YS,{autoSaveId:"marimo:chrome:v1:l2",direction:"horizontal",storage:ne,children:[ve,Se,Re,J]}),e[115]=Se,e[116]=Re,e[117]=se):se=e[117],e[118]===Symbol.for("react.memo_cache_sentinel")?(ge=c.jsx(Ic,{children:c.jsx(Kc,{children:c.jsx(u9,{})})}),e[118]=ge):ge=e[118],e[119]!==se?(pe=c.jsxs(LW,{children:[se,ge]}),e[119]=se,e[120]=pe):pe=e[120],pe};function Mz(){window.dispatchEvent(new Event("resize"))}function Oz(){requestAnimationFrame(Mz)}function Dz(){window.dispatchEvent(new Event("resize"))}function Rz(){requestAnimationFrame(Dz)}let B3;B3=new URL(window.location.href).searchParams.get(qH.showChrome)==="false",hC=Object.freeze(Object.defineProperty({__proto__:null,default:t=>{const e=K.c(10);if(B3){let s,i,a;return e[0]!==t?(s=c.jsx(Qy,{hideControls:!0,...t}),e[0]=t,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(_g,{}),e[2]=i):i=e[2],e[3]!==s?(a=c.jsxs(c.Fragment,{children:[s,i]}),e[3]=s,e[4]=a):a=e[4],a}let n,o,r;return e[5]!==t?(n=c.jsx(Qy,{...t}),e[5]=t,e[6]=n):n=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(o=c.jsx(_g,{}),e[7]=o):o=e[7],e[8]!==n?(r=c.jsxs(Tz,{children:[n,o]}),e[8]=n,e[9]=r):r=e[9],r}},Symbol.toStringTag,{value:"Module"}))});export{yp as C,od as E,yn as P,UW as __tla,rd as a,hC as e,Sa as f};
148
+ `).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:d,usedBy:u}=l;for(const h of d)for(const f of u){const m=`${h}-${f}`;a.has(m)||(a.add(m),i.add(h),i.add(f),s.push(this.createEdge(h,f)))}}for(const[l,d]of rp.zip(t,e)){o||r.push(this.createNode(l,d));const u=i.has(l),h=at.get(d).code.trim().startsWith("mo.md");!u&&h||r.push(this.createNode(l,d))}return{nodes:r,edges:s}}},aF=t=>{const e=K.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 k=v3.createElements(n,r,o,a.hidePureMarkdown);return k=w3({nodes:k.nodes,edges:k.edges,direction:i}),k},e[0]=r,e[1]=n,e[2]=i,e[3]=a.hidePureMarkdown,e[4]=o,e[5]=l):l=e[5];const[d]=O.useState(l),[u,h,f]=ek(d.nodes),[m,_,g]=tk(d.edges),p=Wi();let b;e[6]!==i||e[7]!==_||e[8]!==h?(b=k=>{const $=w3({nodes:k.nodes,edges:k.edges,direction:i});h($.nodes),_($.edges)},e[6]=i,e[7]=_,e[8]=h,e[9]=b):b=e[9];const x=qe(b);let y,v;e[10]!==r||e[11]!==n||e[12]!==a.hidePureMarkdown||e[13]!==x||e[14]!==o?(y=()=>{x(v3.createElements(n,r,o,a.hidePureMarkdown))},v=[n,o,r,x,a.hidePureMarkdown],e[10]=r,e[11]=n,e[12]=a.hidePureMarkdown,e[13]=x,e[14]=o,e[15]=y,e[16]=v):(y=e[15],v=e[16]),O.useEffect(y,v);const[C,S]=O.useState();let E;lk(),e[17]===Symbol.for("react.memo_cache_sentinel")?(E=()=>{S(void 0)},e[17]=E):E=e[17];const N=E;let j,T,A,M,P,R,L,B,U,D;return e[18]===Symbol.for("react.memo_cache_sentinel")?(j={minZoom:.5,maxZoom:1.5},T=(k,$)=>{S({type:"node",id:$.id})},A=(k,$)=>{const{source:I,target:W}=$;S({type:"edge",source:I,target:W})},e[18]=j,e[19]=T,e[20]=A):(j=e[18],T=e[19],A=e[20]),e[21]===Symbol.for("react.memo_cache_sentinel")?(M=c.jsx(jL,{color:"#ccc",variant:Un.Dots}),e[21]=M):M=e[21],e[22]!==p||e[23]!==u?(P=()=>{const k=at.get(Y$);if(k){const $=u.find(I=>I.id===k);$&&(p.fitView({padding:1,duration:600,nodes:[$]}),S({type:"node",id:k}))}},e[22]=p,e[23]=u,e[24]=P):P=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(R=c.jsx(Vp,{className:"size-4"}),e[25]=R):R=e[25],e[26]!==P?(L=c.jsx(wL,{position:"bottom-right",showInteractive:!1,children:c.jsx(Te,{content:"Jump to focused cell",delayDuration:200,side:"left",asChild:!1,children:c.jsx(Es,{onMouseDown:Qn.preventFocus,onClick:P,children:R})})}),e[26]=P,e[27]=L):L=e[27],e[28]!==m||e[29]!==C||e[30]!==o?(B=c.jsx(tc,{selection:C,variables:o,edges:m,onClearSelection:N}),e[28]=m,e[29]=C,e[30]=o,e[31]=B):B=e[31],e[32]!==s||e[33]!==m||e[34]!==u||e[35]!==g||e[36]!==f||e[37]!==L||e[38]!==B?(U=c.jsxs(kf,{nodes:u,edges:m,nodeTypes:ik,minZoom:.2,fitViewOptions:j,onNodeClick:T,onEdgeClick:A,onNodeDoubleClick:lF,fitView:!0,onNodesChange:f,onEdgesChange:g,zoomOnDoubleClick:!1,nodesConnectable:!1,children:[M,L,B,s]}),e[32]=s,e[33]=m,e[34]=u,e[35]=g,e[36]=f,e[37]=L,e[38]=B,e[39]=U):U=e[39],e[40]!==i||e[41]!==U?(D=c.jsx(rk,{value:i,children:U}),e[40]=i,e[41]=U,e[42]=D):D=e[42],D};function lF(t,e){jS(e.id,"focus")}const cF=zt("_minimap_"),dF=zt({hidePureMarkdown:!0}),uF=t=>{const e=K.c(11),[n,o]=Qt(cF),[r,s]=Qt(dF);let i;e[0]!==n||e[1]!==t||e[2]!==o||e[3]!==s||e[4]!==r?(i=()=>n==="_minimap_"?c.jsx(ML,{...t,children:c.jsx(Nf,{settings:r,onSettingsChange:s,view:n,onChange:o})}):c.jsx(aF,{...t,settings:r,layoutDirection:n,children:c.jsx(Nf,{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,d;return e[6]!==a?(l=a(),e[6]=a,e[7]=l):l=e[7],e[8]!==n||e[9]!==l?(d=c.jsx(vf,{children:l},n),e[8]=n,e[9]=l,e[10]=d):d=e[10],d},hF=()=>{const t=K.c(5),e=ES(),n=Zc(),[o]=J$();let r,s;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=Ne("w-full h-full flex-1 mx-auto -mb-4 relative"),t[0]=r):r=t[0],t[1]!==n.inOrderIds||t[2]!==o||t[3]!==e?(s=c.jsx("div",{className:r,children:c.jsx(uF,{cellAtoms:o,variables:e,cellIds:n.inOrderIds})}),t[1]=n.inOrderIds,t[2]=o,t[3]=e,t[4]=s):s=t[4],s},fF=t=>{const e=K.c(4),{isOpen:n,children:o}=t,[r,s]=X.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]),X.useEffect(i,a),r?o:null},mF=t=>{const e=K.c(8),{variableName:n,className:o}=t;let r;e[0]!==n?(r=()=>{const l=function(u){const h=at.get(IS)[u];if(h)return h.declaredBy[0]}(n);if(!l)return;const d=Qi(l);d&&ip(d,n)},e[0]=n,e[1]=r):r=e[1];const s=r;let i,a;return e[2]!==o?(i=Ne("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=c.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},pF=zt(t=>{const e=t(K$),n=t(IS),o=t(qc);return ka(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})}),gF=zt(t=>{const e=new Map(t(X$));for(const n of AS){const o=e.get(n);o&&o.databases.length===0&&e.delete(n)}return ka([...e.values()],n=>AS.has(n.name)?1:0)}),_F=()=>{const t=K.c(32),[e,n]=X.useState(""),o=Ot(TS),r=Le(pF),s=Le(gF);if(r.length===0&&s.length===0){let b;return t[0]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(yn,{title:"No tables found",description:"Any datasets/dataframes in the global scope will be shown here.",action:c.jsx(Vg,{children:c.jsxs(Ae,{variant:"outline",size:"sm",children:["Add database or catalog",c.jsx(br,{className:"h-4 w-4 ml-2"})]})}),icon:c.jsx(lr,{})}),t[0]=b):b=t[0],b}const i=!!e.trim();let a,l,d,u,h,f,m,_,g,p;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=c.jsx(na,{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?(d=i&&c.jsx("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:()=>n(""),children:c.jsx(eo,{className:"h-4 w-4"})}),t[6]=i,t[7]=d):d=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx(Vg,{children:c.jsx("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:c.jsx(br,{className:"h-4 w-4"})})}),t[8]=u):u=t[8],t[9]!==l||t[10]!==d?(h=c.jsxs("div",{className:"flex items-center w-full",children:[l,d,u]}),t[9]=l,t[10]=d,t[11]=h):h=t[11],t[12]!==s||t[13]!==i||t[14]!==e){let b;t[16]!==i||t[17]!==e?(b=x=>c.jsx(bF,{connection:x,hasChildren:x.databases.length>0,children:x.databases.map(y=>c.jsx(xF,{engineName:x.name,database:y,hasSearch:i,children:c.jsx(yF,{schemas:y.schemas,defaultSchema:x.default_schema,defaultDatabase:x.default_database,engineName:x.name,databaseName:y.name,hasSearch:i,searchValue:e})},y.name))},x.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?(m=s.length>0&&r.length>0&&c.jsxs(MS,{children:[c.jsx(hc,{className:"h-4 w-4 text-muted-foreground"}),c.jsx("span",{className:"text-xs",children:"Python"})]}),t[19]=s.length,t[20]=r.length,t[21]=m):m=t[21],t[22]!==e||t[23]!==r?(_=r.length>0&&c.jsx(k3,{tables:r,searchValue:e}),t[22]=e,t[23]=r,t[24]=_):_=t[24],t[25]!==f||t[26]!==m||t[27]!==_?(g=c.jsxs(Jm,{className:"flex flex-col",children:[f,m,_]}),t[25]=f,t[26]=m,t[27]=_,t[28]=g):g=t[28],t[29]!==h||t[30]!==g?(p=c.jsxs(Ec,{className:"border-b bg-background rounded-none h-full pb-10 overflow-auto outline-none",shouldFilter:!1,children:[h,g]}),t[29]=h,t[30]=g,t[31]=p):p=t[31],p},bF=t=>{const e=K.c(25),{connection:n,children:o,hasChildren:r}=t,s=n.name===Z$,i=s?"In-Memory":n.name,[a,l]=X.useState(!1);let d;e[0]!==n.name?(d=async()=>{l(!0),await eH({engine:n.name}),setTimeout(()=>l(!1),500)},e[0]=n.name,e[1]=d):d=e[1];const u=d;let h,f,m;e[2]!==n.dialect?(h=c.jsx(y4,{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=Q$(n.dialect),e[4]=n.dialect,e[5]=f):f=e[5],e[6]!==f?(m=c.jsx("span",{className:"text-xs",children:f}),e[6]=f,e[7]=m):m=e[7];const _=i;let g,p,b,x,y;return e[8]!==_?(g=c.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",c.jsx(mF,{variableName:_}),")"]}),e[8]=_,e[9]=g):g=e[9],e[10]!==u||e[11]!==s||e[12]!==a?(p=!s&&c.jsx(Te,{content:"Refresh connection",children:c.jsx(Ae,{variant:"ghost",size:"icon",className:"ml-auto hover:bg-transparent hover:shadow-none",onClick:u,children:c.jsx(Bc,{className:Ne("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]=p):p=e[13],e[14]!==h||e[15]!==m||e[16]!==g||e[17]!==p?(b=c.jsxs(MS,{children:[h,m,g,p]}),e[14]=h,e[15]=m,e[16]=g,e[17]=p,e[18]=b):b=e[18],e[19]!==o||e[20]!==r?(x=r?o:c.jsx(Qc,{content:"No databases available",className:"pl-2"}),e[19]=o,e[20]=r,e[21]=x):x=e[21],e[22]!==b||e[23]!==x?(y=c.jsxs(c.Fragment,{children:[b,x]}),e[22]=b,e[23]=x,e[24]=y):y=e[24],y},xF=t=>{const e=K.c(28),{hasSearch:n,engineName:o,database:r,children:s}=t,[i,a]=X.useState(!1),[l,d]=X.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]),X.useEffect(u,h),e[3]!==i||e[4]!==l?(f=()=>{a(!i),d(!l)},e[3]=i,e[4]=l,e[5]=f):f=e[5];const m=`${o}:${r.name}`;let _;e[6]!==i?(_=c.jsx(FS,{isExpanded:i}),e[6]=i,e[7]=_):_=e[7];const g=l&&i?"text-foreground":"text-muted-foreground";let p,b;e[8]!==g?(p=Ne("h-4 w-4",g),e[8]=g,e[9]=p):p=e[9],e[10]!==p?(b=c.jsx(lr,{className:p}),e[10]=p,e[11]=b):b=e[11];const x=l&&i&&"font-semibold";let y,v,C,S;e[12]!==x?(y=Ne(x),e[12]=x,e[13]=y):y=e[13],e[14]!==r.name?(v=r.name===""?c.jsx("i",{children:"Not connected"}):r.name,e[14]=r.name,e[15]=v):v=e[15],e[16]!==y||e[17]!==v?(C=c.jsx("span",{className:y,children:v}),e[16]=y,e[17]=v,e[18]=C):C=e[18],e[19]!==C||e[20]!==f||e[21]!==m||e[22]!==_||e[23]!==b?(S=c.jsxs(mo,{className:"text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",onSelect:f,value:m,children:[_,b,C]}),e[19]=C,e[20]=f,e[21]=m,e[22]=_,e[23]=b,e[24]=S):S=e[24];const E=i&&s;let N;return e[25]!==S||e[26]!==E?(N=c.jsxs(c.Fragment,{children:[S,E]}),e[25]=S,e[26]=E,e[27]=N):N=e[27],N},yF=t=>{const e=K.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=c.jsx(Qc,{content:"No schemas available",className:"pl-6"}),e[0]=h):h=e[0],h}let d,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 m;e[11]!==i||e[12]!==r||e[13]!==o||e[14]!==s||e[15]!==a||e[16]!==l?(m=_=>c.jsx(wF,{databaseName:i,schema:_,hasSearch:a,children:c.jsx(k3,{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]=m):m=e[17],d=f.map(m),e[1]=i,e[2]=r,e[3]=o,e[4]=s,e[5]=a,e[6]=n,e[7]=l,e[8]=d}else d=e[8];return e[18]!==d?(u=c.jsx(c.Fragment,{children:d}),e[18]=d,e[19]=u):u=e[19],u},wF=t=>{const e=K.c(26),{databaseName:n,schema:o,children:r,hasSearch:s}=t,[i,a]=X.useState(!1),[l,d]=X.useState(!1),u=`${n}:${o.name}`;let h,f,m,_;if(e[0]!==s?(h=()=>{a(s)},f=[s],e[0]=s,e[1]=h,e[2]=f):(h=e[1],f=e[2]),X.useEffect(h,f),LS(o.name))return r;e[3]!==i||e[4]!==l?(m=()=>{a(!i),d(!l)},e[3]=i,e[4]=l,e[5]=m):m=e[5],e[6]!==i?(_=c.jsx(FS,{isExpanded:i}),e[6]=i,e[7]=_):_=e[7];const g=l&&i&&"text-foreground";let p,b;e[8]!==g?(p=Ne("h-4 w-4 text-muted-foreground",g),e[8]=g,e[9]=p):p=e[9],e[10]!==p?(b=c.jsx(aH,{className:p}),e[10]=p,e[11]=b):b=e[11];const x=l&&i&&"font-semibold";let y,v,C;e[12]!==x?(y=Ne(x),e[12]=x,e[13]=y):y=e[13],e[14]!==o.name||e[15]!==y?(v=c.jsx("span",{className:y,children:o.name}),e[14]=o.name,e[15]=y,e[16]=v):v=e[16],e[17]!==v||e[18]!==m||e[19]!==_||e[20]!==b||e[21]!==u?(C=c.jsxs(mo,{className:"text-sm flex flex-row gap-1 items-center pl-5 cursor-pointer rounded-none",onSelect:m,value:u,children:[_,b,v]}),e[17]=v,e[18]=m,e[19]=_,e[20]=b,e[21]=u,e[22]=C):C=e[22];const S=i&&r;let E;return e[23]!==C||e[24]!==S?(E=c.jsxs(c.Fragment,{children:[C,S]}),e[23]=C,e[24]=S,e[25]=E):E=e[25],E},k3=t=>{const e=K.c(24),{tables:n,sqlTableContext:o,searchValue:r}=t,{addTableList:s}=OS(),[i,a]=X.useState(!1),[l,d]=X.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),d(!0);const{engine:p,database:b,schema:x}=o,y=await TW.request({engine:p,database:b,schema:x});if(!(y!=null&&y.tables))throw d(!1),new Error("No tables available");s({tables:y.tables,sqlTableContext:o}),d(!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:m}=Wn(u,h);if(f||l){let p;return e[9]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx(DS,{message:"Loading tables...",className:"pl-12"}),e[9]=p):p=e[9],p}if(m){let p;return e[10]!==m?(p=c.jsx(RS,{error:m,className:"pl-12"}),e[10]=m,e[11]=p):p=e[11],p}if(n.length===0){let p;return e[12]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx(Qc,{content:"No tables found",className:"pl-9"}),e[12]=p):p=e[12],p}let _,g;if(e[13]!==r||e[14]!==o||e[15]!==n){let p;e[17]!==r?(p=y=>!r||y.name.toLowerCase().includes(r.toLowerCase()),e[17]=r,e[18]=p):p=e[18];const b=n.filter(p);let x;e[19]!==r||e[20]!==o?(x=y=>c.jsx(vF,{table:y,sqlTableContext:o,isSearching:!!r},y.name),e[19]=r,e[20]=o,e[21]=x):x=e[21],_=b.map(x),e[13]=r,e[14]=o,e[15]=n,e[16]=_}else _=e[16];return e[22]!==_?(g=c.jsx(c.Fragment,{children:_}),e[22]=_,e[23]=g):g=e[23],g},vF=t=>{const e=K.c(64),{table:n,sqlTableContext:o,isSearching:r}=t,{addTable:s}=OS(),[i,a]=X.useState(!1),[l,d]=X.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){d(!0);const{engine:oe,database:ie,schema:Z}=o,Q=await MW.request({engine:oe,database:ie,schema:Z,tableName:n.name});if(!(Q!=null&&Q.table))throw new Error("No table details available");s({table:Q.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{isFetching:m,isPending:_,error:g}=Wn(h,f),p=Le(dc),b=Rs(),{createNewCell:x}=bt(),y=PS();let v;e[10]!==y||e[11]!==p||e[12]!==x||e[13]!==b||e[14]!==o||e[15]!==n?(v=()=>{fo({autoInstantiate:p,createNewCell:x,fromCellId:b}),y((()=>{if(n.source_type==="catalog"){const oe=o!=null&&o.database?`${o.database}.${n.name}`:n.name;return`${n.engine}.load_table("${oe}")`}if(o)return zS({table:n,columnName:"*",sqlTableContext:o});switch(n.source_type){case"local":return`mo.ui.table(${n.name})`;case"duckdb":case"connection":return zS({table:n,columnName:"*",sqlTableContext:o});default:return wc(n.source_type),""}})())},e[10]=y,e[11]=p,e[12]=x,e[13]=b,e[14]=o,e[15]=n,e[16]=v):v=e[16];const C=v;let S;e[17]!==n.num_columns||e[18]!==n.num_rows?(S=()=>{const oe=[];return n.num_rows!=null&&oe.push(`${n.num_rows} rows`),n.num_columns!=null&&oe.push(`${n.num_columns} columns`),oe.length===0?null:c.jsx("div",{className:"flex flex-row gap-2 items-center pl-6 group-hover:hidden",children:c.jsx("span",{className:"text-xs text-muted-foreground",children:oe.join(", ")})})},e[17]=n.num_columns,e[18]=n.num_rows,e[19]=S):S=e[19];const E=S;let N;e[20]!==g||e[21]!==m||e[22]!==_||e[23]!==o||e[24]!==n?(N=()=>{if(_||m)return c.jsx(DS,{message:"Loading columns...",className:"pl-12"});if(g)return c.jsx(RS,{error:g,className:"pl-12"});const oe=n.columns;return oe.length===0?c.jsx(Qc,{content:"No columns found",className:"pl-12"}):oe.map(ie=>c.jsx(kF,{table:n,column:ie,sqlTableContext:o},ie.name))},e[20]=g,e[21]=m,e[22]=_,e[23]=o,e[24]=n,e[25]=N):N=e[25];const j=N;let T;e[26]!==i||e[27]!==r||e[28]!==n.source_type||e[29]!==n.type?(T=()=>{if(n.source_type==="local")return;const oe=n.type==="table"?tH:wm;return c.jsx(oe,{className:"h-3 w-3",strokeWidth:i||r?2.5:void 0})},e[26]=i,e[27]=r,e[28]=n.source_type,e[29]=n.type,e[30]=T):T=e[30];const A=T,M=o?`${o.database}.${o.schema}.${n.name}`:n.name,P=o&&(LS(o.schema)?"pl-9":"pl-12"),R=(i||r)&&"font-semibold";let L,B,U,D,k,$,I,W,G,q,Y,ee;return e[31]!==P||e[32]!==R?(L=Ne("rounded-none group h-8 cursor-pointer",P,R),e[31]=P,e[32]=R,e[33]=L):L=e[33],e[34]!==i?(B=()=>a(!i),e[34]=i,e[35]=B):B=e[35],e[36]!==A?(U=A(),e[36]=A,e[37]=U):U=e[37],e[38]!==n.name?(D=c.jsx("span",{className:"text-sm",children:n.name}),e[38]=n.name,e[39]=D):D=e[39],e[40]!==U||e[41]!==D?(k=c.jsxs("div",{className:"flex gap-2 items-center flex-1",children:[U,D]}),e[40]=U,e[41]=D,e[42]=k):k=e[42],e[43]!==E?($=E(),e[43]=E,e[44]=$):$=e[44],e[45]!==C?(I=Qn.stopPropagation(()=>C()),e[45]=C,e[46]=I):I=e[46],e[47]===Symbol.for("react.memo_cache_sentinel")?(W=c.jsx(nH,{className:"h-3 w-3"}),e[47]=W):W=e[47],e[48]!==I?(G=c.jsx(Te,{content:"Add table to notebook",delayDuration:400,children:c.jsx(Ae,{className:"group-hover:inline-flex hidden",variant:"text",size:"icon",onClick:I,children:W})}),e[48]=I,e[49]=G):G=e[49],e[50]!==i||e[51]!==B||e[52]!==k||e[53]!==$||e[54]!==G||e[55]!==L||e[56]!==M?(q=c.jsxs(mo,{className:L,value:M,"aria-selected":i,forceMount:!0,onSelect:B,children:[k,$,G]}),e[50]=i,e[51]=B,e[52]=k,e[53]=$,e[54]=G,e[55]=L,e[56]=M,e[57]=q):q=e[57],e[58]!==i||e[59]!==j?(Y=i&&j(),e[58]=i,e[59]=j,e[60]=Y):Y=e[60],e[61]!==q||e[62]!==Y?(ee=c.jsxs(c.Fragment,{children:[q,Y]}),e[61]=q,e[62]=Y,e[63]=ee):ee=e[63],ee},kF=t=>{var I,W;const e=K.c(51),{table:n,column:o,sqlTableContext:r}=t,[s,i]=X.useState(!1),a=Le(TS),l=Ot(oH);let d,u;e[0]!==a?(d=()=>{a&&i(!1)},u=[a],e[0]=a,e[1]=d,e[2]=u):(d=e[1],u=e[2]),X.useEffect(d,u),l(s?G=>new Set([...G,`${n.name}:${o.name}`]):G=>(G.delete(`${n.name}:${o.name}`),new Set(G)));const h=PS(),{columnsPreviews:f}=rH();let m;e[3]!==o.name||e[4]!==n.primary_keys?(m=((I=n.primary_keys)==null?void 0:I.includes(o.name))||!1,e[3]=o.name,e[4]=n.primary_keys,e[5]=m):m=e[5];const _=m;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 p=g;let b;e[9]!==h?(b=G=>{h(G)},e[9]=h,e[10]=b):b=e[10];const x=b,y=SF,v=s?"font-semibold":"";let C;e[11]!==o.name||e[12]!==v?(C=c.jsx("span",{className:v,children:o.name}),e[11]=o.name,e[12]=v,e[13]=C):C=e[13];const S=C,E=`${n.name}.${o.name}`,N=`${n.name}.${o.name}`;let j;e[14]!==s?(j=()=>i(!s),e[14]=s,e[15]=j):j=e[15];const T=r?"pl-14":"pl-7";let A,M,P,R,L,B,U,D,k,$;return e[16]!==T?(A=Ne("flex flex-row gap-2 items-center flex-1",T),e[16]=T,e[17]=A):A=e[17],e[18]!==o.type||e[19]!==S?(M=c.jsx(sH,{columnName:S,dataType:o.type}),e[18]=o.type,e[19]=S,e[20]=M):M=e[20],e[21]!==_?(P=_&&y({tooltipContent:"Primary key",content:"PK"}),e[21]=_,e[22]=P):P=e[22],e[23]!==p?(R=p&&y({tooltipContent:"Indexed",content:"IDX"}),e[23]=p,e[24]=R):R=e[24],e[25]!==A||e[26]!==M||e[27]!==P||e[28]!==R?(L=c.jsxs("div",{className:A,children:[M,P,R]}),e[25]=A,e[26]=M,e[27]=P,e[28]=R,e[29]=L):L=e[29],e[30]!==o.name?(B=c.jsx(Te,{content:"Copy column name",delayDuration:400,children:c.jsx(Ae,{variant:"text",size:"icon",className:"group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground",children:c.jsx(SS,{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=c.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]!==j||e[35]!==L||e[36]!==B||e[37]!==U||e[38]!==E||e[39]!==N?(D=c.jsxs(mo,{className:"rounded-none py-1 group cursor-pointer",value:N,onSelect:j,children:[L,B,U]},E),e[34]=j,e[35]=L,e[36]=B,e[37]=U,e[38]=E,e[39]=N,e[40]=D):D=e[40],e[41]!==o||e[42]!==f||e[43]!==x||e[44]!==s||e[45]!==r||e[46]!==n?(k=s&&c.jsx("div",{className:"pl-10 pr-2 py-2 bg-[var(--slate-1)] shadow-inner border-b",children:c.jsx(Ic,{children:c.jsx(iH,{table:n,column:o,onAddColumnChart:x,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]=x,e[44]=s,e[45]=r,e[46]=n,e[47]=k):k=e[47],e[48]!==D||e[49]!==k?($=c.jsxs(c.Fragment,{children:[D,k]}),e[48]=D,e[49]=k,e[50]=$):$=e[50],$};function SF(t){const{tooltipContent:e,content:n}=t;return c.jsx(Te,{content:e,delayDuration:100,children:c.jsx("span",{className:"text-xs text-black bg-gray-100 dark:invert rounded px-1",children:n})})}const CF=()=>{const t=K.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx(_F,{}),t[0]=e):e=t[0],e},NF=()=>{const t=K.c(5),{documentation:e}=Le(lH);if(!e){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(yn,{title:"View docs as you type",description:"Move your text cursor over a symbol to see its documentation.",icon:c.jsx(_d,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=sp({html:e}),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=c.jsx("div",{className:"p-3 overflow-y-auto overflow-x-hidden h-full docs-documentation flex flex-col gap-4",children:n}),t[3]=n,t[4]=o):o=t[4],o},jF=()=>{const t=K.c(5),e=cH();if(e.length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(yn,{title:"No errors!",icon:c.jsx(Jp,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=e.map(EF),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=c.jsx("div",{className:"flex flex-col overflow-auto",children:n}),t[3]=n,t[4]=o):o=t[4],o};function EF(t){return c.jsxs("div",{children:[c.jsx("div",{className:"text-xs font-mono font-semibold bg-muted border-y px-2 py-1",children:c.jsx(dH,{cellId:t.cellId})}),c.jsx("div",{className:"px-2",children:c.jsx(uH,{errors:t.output.data,cellId:t.cellId},t.cellId)},t.cellId)]},t.cellId)}const dm=new Map,IF=({file:t,onOpenNotebook:e})=>{const{theme:n}=xr(),o=Le(mc),[r,s]=O.useState(""),{data:i,isPending:a,error:l,setData:d}=Wn(async()=>{const g=await ap({path:t.path}),p=g.contents||"";return s(dm.get(t.path)||p),g},[t.path]),u=async()=>{r!==(i==null?void 0:i.contents)&&await xH({path:t.path,contents:r}).then(g=>{g.success&&(d(p=>({...p,contents:r})),s(r))})},h=O.useRef(r);if(h.current=r,O.useEffect(()=>()=>{if(!(i!=null&&i.contents))return;const g=h.current;g===i.contents?dm.delete(t.path):dm.set(t.path,g)},[t.path,i==null?void 0:i.contents]),l)return c.jsx(Vr,{error:l});if(a||!i)return null;const f=i.mimeType||"text/plain",m=f in um;if(!i.contents&&!m)return c.jsxs("div",{className:"grid grid-cols-2 gap-2 p-6",children:[c.jsx("div",{className:"font-bold text-muted-foreground",children:"Name"}),c.jsx("div",{children:i.file.name}),c.jsx("div",{className:"font-bold text-muted-foreground",children:"Type"}),c.jsx("div",{children:f})]});const _=c.jsxs("div",{className:"text-xs text-muted-foreground p-1 flex justify-end gap-2 border-b",children:[t.isMarimoFile&&!un()&&c.jsx(Te,{content:"Open notebook",children:c.jsx(xn,{size:"small",onClick:g=>e(g),children:c.jsx(Nc,{})})}),c.jsx(Te,{content:"Download",children:c.jsx(xn,{size:"small",onClick:()=>{if(S3(f)){const g=_H(i.contents,f);return void bH(g,i.file.name)}ia(new Blob([i.contents||r],{type:f}),i.file.name)},children:c.jsx(Rm,{})})}),!S3(f)&&c.jsxs(c.Fragment,{children:[c.jsx(Te,{content:"Copy contents to clipboard",children:c.jsx(xn,{size:"small",onClick:async()=>{await _n(r)},children:c.jsx(Xi,{})})}),c.jsx(Te,{content:on("global.save"),children:c.jsx(xn,{size:"small",color:r===i.contents?void 0:"green",onClick:u,disabled:r===i.contents,children:c.jsx(Ia,{})})})]})]});return f.startsWith("image/")?c.jsxs(c.Fragment,{children:[_,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(hH,{base64:i.contents,mime:f})})]}):f==="text/csv"&&i.contents?c.jsxs(c.Fragment,{children:[_,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(fH,{contents:i.contents})})]}):f.startsWith("audio/")?c.jsxs(c.Fragment,{children:[_,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(mH,{base64:i.contents,mime:f})})]}):f.startsWith("video/")?c.jsxs(c.Fragment,{children:[_,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(pH,{base64:i.contents,mime:f})})]}):f.startsWith("application/pdf")?c.jsxs(c.Fragment,{children:[_,c.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:c.jsx(gH,{base64:i.contents,mime:f})})]}):c.jsxs(c.Fragment,{children:[_,c.jsx("div",{className:"flex-1 overflow-auto",children:c.jsx(O.Suspense,{children:c.jsx(xa,{theme:n==="dark"?"dark":"light",language:um[f]||um.default,className:"border-b",extensions:[et.lineWrapping,qn.of([{key:o.getHotkey("global.save").key,stopPropagation:!0,run:()=>r!==i.contents&&(u(),!0)}])],value:r,onChange:s})})})]})},S3=t=>t.startsWith("image/")||t.startsWith("audio/")||t.startsWith("video/")||t.startsWith("application/pdf"),um={"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"},C3=zt(new class{constructor(t){this.callbacks=t,this.delegate=new fp([]),this.rootPath="",this.onChange=Hn.NOOP,this.path=new kc("/"),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 fp(n.files),this.rootPath=n.root,this.path=kc.guessDeliminator(n.root)}catch(n){nt({title:"Failed",description:eS(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 fp(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:(nt({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:E4,createFileOrFolder:lp,deleteFileOrFolder:wH,renameFileOrFolder:yH})),AF=zt({});function TF(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 N3(t){const e=K.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:PF,onDropRejected:OF,onDrop:MF,...o},e[2]=o,e[3]=r):r=e[3],vH(r)}async function MF(t){for(const e of t){const n=FF(LF(e));let o="";n&&(o=kc.guessDeliminator(n).dirname(n));const r=(await TF(e)).split(",")[1];await lp({path:o,type:"file",name:e.name,contents:r})}await async function(){await at.get(C3).refreshAll([])}()}function OF(t){nt({title:"File upload failed",description:c.jsx("div",{className:"flex flex-col gap-1",children:t.map(DF)}),variant:"danger"})}function DF(t){return c.jsxs("div",{children:[t.file.name," (",t.errors.map(RF).join(", "),")"]},t.file.name)}function RF(t){return t.message}function PF(t){vt.error(t),nt({title:"File upload failed",description:t.message,variant:"danger"})}function LF(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 FF(t){if(t)return t.replace(/^\/+/,"")}const j3=X.createContext(null),zF=t=>{const e=K.c(60),{height:n}=t,o=O.useRef(null),[r]=Qt(C3);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=[],e[0]=s):s=e[0];const[i,a]=O.useState(s),[l,d]=O.useState(null),{openPrompt:u}=$n(),[h,f]=Qt(AF);let m,_;e[1]!==r?(m=()=>r.initialize(a),e[1]=r,e[2]=m):m=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(_=[],e[3]=_):_=e[3];const{isPending:g,error:p}=Wn(m,_);let b;e[4]!==h||e[5]!==r?(b=()=>{r.refreshAll(Object.keys(h).filter(k=>h[k]))},e[4]=h,e[5]=r,e[6]=b):b=e[6];const x=qe(b);let y;e[7]!==u||e[8]!==r?(y=async()=>{u({title:"Folder name",onConfirm:async k=>{r.createFolder(k,null)}})},e[7]=u,e[8]=r,e[9]=y):y=e[9];const v=qe(y);let C;e[10]!==u||e[11]!==r?(C=async()=>{u({title:"File name",onConfirm:async k=>{r.createFile(k,null)}})},e[10]=u,e[11]=r,e[12]=C):C=e[12];const S=qe(C);let E;e[13]!==f?(E=()=>{var k;(k=o.current)==null||k.closeAll(),f({})},e[13]=f,e[14]=E):E=e[14];const N=qe(E);if(g){let k;return e[15]===Symbol.for("react.memo_cache_sentinel")?(k=c.jsx(An,{size:"medium",centered:!0}),e[15]=k):k=e[15],k}if(p){let k;return e[16]!==p?(k=c.jsx(Vr,{error:p}),e[16]=p,e[17]=k):k=e[17],k}if(l){let k,$,I,W,G,q;return e[18]===Symbol.for("react.memo_cache_sentinel")?(k=()=>d(null),e[18]=k):k=e[18],e[19]===Symbol.for("react.memo_cache_sentinel")?($=c.jsx(Ae,{onClick:k,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:c.jsx(It,{size:16})}),e[19]=$):$=e[19],e[20]!==l.name?(I=c.jsxs("div",{className:"flex items-center pl-1 pr-3 flex-shrink-0 border-b justify-between",children:[$,c.jsx("span",{className:"font-bold",children:l.name})]}),e[20]=l.name,e[21]=I):I=e[21],e[22]!==l.path||e[23]!==r?(W=Y=>E3(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=c.jsx(O.Suspense,{children:c.jsx(IF,{onOpenNotebook:W,file:l})}),e[25]=l,e[26]=W,e[27]=G):G=e[27],e[28]!==I||e[29]!==G?(q=c.jsxs(c.Fragment,{children:[I,G]}),e[28]=I,e[29]=G,e[30]=q):q=e[30],q}let j;e[31]!==N||e[32]!==S||e[33]!==v||e[34]!==x||e[35]!==r?(j=c.jsx(UF,{onRefresh:x,onCreateFile:S,onCreateFolder:v,onCollapseAll:N,tree:r}),e[31]=N,e[32]=S,e[33]=v,e[34]=x,e[35]=r,e[36]=j):j=e[36];const T=n-33;let A,M,P,R,L,B,U,D;return e[37]!==r?(A=async k=>{const{ids:$}=k;for(const I of $)await r.delete(I)},M=async k=>{const{id:$,name:I}=k;await r.rename($,I)},P=async k=>{const{dragIds:$,parentId:I}=k;await r.move($,I)},e[37]=r,e[38]=A,e[39]=M,e[40]=P):(A=e[38],M=e[39],P=e[40]),e[41]===Symbol.for("react.memo_cache_sentinel")?(R=k=>{const $=k[0];$&&($.data.isDirectory||d($.data))},e[41]=R):R=e[41],e[42]!==h||e[43]!==f||e[44]!==r?(L=async k=>{if(await r.expand(k)){const $=h[k]??!1;f({...h,[k]:!$})}},e[42]=h,e[43]=f,e[44]=r,e[45]=L):L=e[45],e[46]!==i||e[47]!==h||e[48]!==A||e[49]!==M||e[50]!==P||e[51]!==L||e[52]!==T?(B=c.jsx(fW,{width:"100%",ref:o,height:T,className:"h-full",data:i,initialOpenState:h,openByDefault:!1,renderCursor:qF,disableDrop:GF,onDelete:A,onRename:M,onMove:P,onSelect:R,onToggle:L,padding:15,rowHeight:30,indent:BF,overscanCount:1e3,disableMultiSelection:!0,children:HF}),e[46]=i,e[47]=h,e[48]=A,e[49]=M,e[50]=P,e[51]=L,e[52]=T,e[53]=B):B=e[53],e[54]!==B||e[55]!==r?(U=c.jsx(j3,{value:r,children:B}),e[54]=B,e[55]=r,e[56]=U):U=e[56],e[57]!==U||e[58]!==j?(D=c.jsxs(c.Fragment,{children:[j,U]}),e[57]=U,e[58]=j,e[59]=D):D=e[59],D},BF=15,UF=t=>{const e=K.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}=N3(i);let d,u,h,f,m,_,g,p,b,x,y,v,C,S,E;return e[1]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(ja,{size:16}),e[1]=d):d=e[1],e[2]!==o?(u=c.jsx(Te,{content:"Add file",children:c.jsx(Ae,{"data-testid":"file-explorer-add-file-button",onClick:o,variant:"text",size:"xs",children:d})}),e[2]=o,e[3]=u):u=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(cd,{size:16}),e[4]=h):h=e[4],e[5]!==r?(f=c.jsx(Te,{content:"Add folder",children:c.jsx(Ae,{"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?(m=a({}),e[7]=a,e[8]=m):m=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(_=kH({variant:"text",size:"xs"}),g=c.jsx(CH,{size:16}),e[9]=_,e[10]=g):(_=e[9],g=e[10]),e[11]!==m?(p=c.jsx(Te,{content:"Upload file",children:c.jsx("button",{"data-testid":"file-explorer-upload-button",...m,className:_,children:g})}),e[11]=m,e[12]=p):p=e[12],e[13]!==l?(b=l({}),e[13]=l,e[14]=b):b=e[14],e[15]!==b?(x=c.jsx("input",{...b,type:"file"}),e[15]=b,e[16]=x):x=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(y=c.jsx(lS,{size:16}),e[17]=y):y=e[17],e[18]!==n?(v=c.jsx(Te,{content:"Refresh",children:c.jsx(Ae,{"data-testid":"file-explorer-refresh-button",onClick:n,variant:"text",size:"xs",children:y})}),e[18]=n,e[19]=v):v=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(C=c.jsx(Ep,{size:16}),e[20]=C):C=e[20],e[21]!==s?(S=c.jsx(Te,{content:"Collapse all folders",children:c.jsx(Ae,{"data-testid":"file-explorer-collapse-button",onClick:s,variant:"text",size:"xs",children:C})}),e[21]=s,e[22]=S):S=e[22],e[23]!==x||e[24]!==v||e[25]!==S||e[26]!==u||e[27]!==f||e[28]!==p?(E=c.jsxs("div",{className:"flex items-center justify-end px-2 flex-shrink-0 border-b",children:[u,f,p,x,v,S]}),e[23]=x,e[24]=v,e[25]=S,e[26]=u,e[27]=f,e[28]=p,e[29]=E):E=e[29],E},VF=t=>{const e=K.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&&!un()&&c.jsxs("span",{className:"flex-shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline",onClick:o,children:["open ",c.jsx(Nc,{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=c.jsxs("span",{className:"flex-1 overflow-hidden text-ellipsis",onClick:r,children:[n.data.name,s]}),e[5]=n.data.name,e[6]=r,e[7]=s,e[8]=i):i=e[8],i},$F=t=>{const e=K.c(10),{node:n}=t,o=O.useRef(null);let r,s,i,a,l;return e[0]!==n.data.name?(r=()=>{var d,u;(d=o.current)==null||d.focus(),(u=o.current)==null||u.setSelectionRange(0,n.data.name.lastIndexOf("."))},s=[n.data.name],e[0]=n.data.name,e[1]=r,e[2]=s):(r=e[1],s=e[2]),O.useEffect(r,s),e[3]!==n?(i=()=>n.reset(),a=d=>{d.key==="Escape"&&n.reset(),d.key==="Enter"&&n.submit(d.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=c.jsx("input",{ref:o,className:"flex-1 bg-transparent border border-border text-muted-foreground",defaultValue:n.data.name,onClick:YF,onBlur:i,onKeyDown:a}),e[6]=n.data.name,e[7]=i,e[8]=a,e[9]=l):l=e[9],l},HF=({node:t,style:e,dragHandle:n})=>{const o=t.data.isDirectory?"directory":N4(t.data.name),r=j4[o],{openConfirm:s,openPrompt:i}=$n(),{createNewCell:a}=bt(),l=Rs(),d=O.use(j3),u=async g=>{E3(g,d?d.relativeFromRoot(t.data.path):t.data.path)},h=async g=>{g.stopPropagation(),g.preventDefault(),s({title:"Delete file",description:`Are you sure you want to delete ${t.data.name}?`,confirmAction:c.jsx(w4,{onClick:async()=>{await t.tree.delete(t.id)},"aria-label":"Confirm",children:"Delete"})})},f=qe(async()=>{t.open(),i({title:"Folder name",onConfirm:async g=>{d==null||d.createFolder(g,t.id)}})}),m=qe(async()=>{t.open(),i({title:"File name",onConfirm:async g=>{d==null||d.createFile(g,t.id)}})}),_=qe(async()=>{var x;if(!d||t.data.isDirectory)return;const[g,p]=SH(t.data.name),b=`${g}_copy${p}`;try{const y=await ap({path:t.data.path}),v=((x=t.parent)==null?void 0:x.data.path)||"";await lp({path:v,type:"file",name:b,contents:y.contents?btoa(y.contents):void 0}),await d.refreshAll([v])}catch{nt({title:"Failed to duplicate file",description:"Unable to create a duplicate of the file",variant:"danger"})}});return c.jsxs("div",{style:e,ref:n,className:Ne("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group"),draggable:!0,onClick:g=>{g.stopPropagation(),t.data.isDirectory&&t.toggle()},children:[c.jsx(WF,{node:t}),c.jsxs("span",{className:Ne("flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group",t.willReceiveDrop&&t.data.isDirectory&&"bg-accent/80 hover:bg-accent/80 text-accent-foreground"),children:[t.data.isMarimoFile?c.jsx("img",{src:"./favicon.ico",className:"w-5 h-5 flex-shrink-0 mr-2 filter grayscale",alt:"Marimo"}):c.jsx(r,{className:"w-5 h-5 flex-shrink-0 mr-2",strokeWidth:1.5}),t.isEditing?c.jsx($F,{node:t}):c.jsx(VF,{node:t,onOpenMarimoFile:u}),c.jsxs(hr,{modal:!1,children:[c.jsx(fr,{asChild:!0,tabIndex:-1,onClick:g=>g.stopPropagation(),children:c.jsx(Ae,{"data-testid":"file-explorer-more-button",variant:"text",tabIndex:-1,size:"xs",className:"mb-0","aria-label":"More options",children:c.jsx(ld,{strokeWidth:2,className:"w-5 h-5 hidden group-hover:block"})})}),(()=>{const g={size:14,strokeWidth:1.5,className:"mr-2"};return c.jsxs(mr,{align:"end",className:"no-print w-[220px]",onClick:p=>p.stopPropagation(),onCloseAutoFocus:p=>p.preventDefault(),children:[!t.data.isDirectory&&c.jsxs(Vt,{onSelect:()=>t.select(),children:[c.jsx(dg,{...g}),"Open file"]}),!t.data.isDirectory&&!un()&&c.jsxs(Vt,{onSelect:()=>{NH({path:t.data.path})},children:[c.jsx(Nc,{...g}),"Open file in external editor"]}),t.data.isDirectory&&c.jsxs(c.Fragment,{children:[c.jsxs(Vt,{onSelect:()=>m(),children:[c.jsx(ja,{...g}),"Create file"]}),c.jsxs(Vt,{onSelect:()=>f(),children:[c.jsx(cd,{...g}),"Create folder"]}),c.jsx(bn,{})]}),c.jsxs(Vt,{onSelect:()=>t.edit(),children:[c.jsx(Kp,{...g}),"Rename"]}),!t.data.isDirectory&&c.jsxs(Vt,{onSelect:_,children:[c.jsx(Xi,{...g}),"Duplicate"]}),c.jsxs(Vt,{onSelect:async()=>{await _n(t.data.path),nt({title:"Copied to clipboard"})},children:[c.jsx(hd,{...g}),"Copy path"]}),d&&c.jsxs(Vt,{onSelect:async()=>{await _n(d.relativeFromRoot(t.data.path)),nt({title:"Copied to clipboard"})},children:[c.jsx(hd,{...g}),"Copy relative path"]}),c.jsx(bn,{}),c.jsxs(Vt,{onSelect:()=>{const{path:p}=t.data;(b=>{a({code:b,before:!1,cellId:l??"__end__"})})(BS[o](p))},children:[c.jsx(qr,{...g}),"Insert snippet for reading file"]}),c.jsxs(Vt,{onSelect:async()=>{nt({title:"Copied to clipboard",description:"Code to open the file has been copied to your clipboard. You can also drag and drop this file into the editor"});const{path:p}=t.data,b=BS[o](p);await _n(b)},children:[c.jsx(jH,{...g}),"Copy snippet for reading file"]}),t.data.isMarimoFile&&!un()&&c.jsxs(c.Fragment,{children:[c.jsx(bn,{}),c.jsxs(Vt,{onSelect:u,children:[c.jsx(sg,{...g}),"Open notebook"]})]}),c.jsx(bn,{}),!t.data.isDirectory&&c.jsxs(c.Fragment,{children:[c.jsxs(Vt,{onSelect:async()=>{const p=(await ap({path:t.data.path})).contents||"";ia(new Blob([p]),t.data.name)},children:[c.jsx(Rm,{...g}),"Download"]}),c.jsx(bn,{})]}),c.jsxs(Vt,{onSelect:h,variant:"danger",children:[c.jsx(fc,{...g}),"Delete"]})]})})()]})]})]})},WF=t=>{const e=K.c(3),{node:n}=t;if(!n.data.isDirectory){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx("span",{className:"w-5 h-5 flex-shrink-0"}),e[0]=r):r=e[0],r}let o;return e[1]!==n.isOpen?(o=n.isOpen?c.jsx(dr,{className:"w-5 h-5 flex-shrink-0"}):c.jsx(ta,{className:"w-5 h-5 flex-shrink-0"}),e[1]=n.isOpen,e[2]=o):o=e[2],o};function E3(t,e){t.stopPropagation(),t.preventDefault(),KS(e)}function qF(){return null}function GF(t){const{parentNode:e}=t;return!e.data.isDirectory}function YF(t){return t.stopPropagation()}let I3,A3,T3;I3=()=>{const t=K.c(20),{ref:e,height:n}=EH(),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}=N3(r);let l,d,u,h,f,m,_,g;return t[1]!==s?(l=s(),t[1]=s,t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(d=Ne("flex flex-col flex-1 overflow-hidden relative"),t[3]=d):d=t[3],t[4]!==i?(u=i(),t[4]=i,t[5]=u):u=t[5],t[6]!==u?(h=c.jsx("input",{...u}),t[6]=u,t[7]=h):h=t[7],t[8]!==a?(f=a&&c.jsx("div",{className:"absolute inset-0 flex items-center uppercase justify-center text-xl font-bold text-primary/90 bg-accent/85 z-10 border-2 border-dashed border-primary/90 rounded-lg pointer-events-none",children:"Drop files here"}),t[8]=a,t[9]=f):f=t[9],t[10]!==o?(m=c.jsx(zF,{height:o}),t[10]=o,t[11]=m):m=t[11],t[12]!==e||t[13]!==m?(_=c.jsx("div",{ref:e,className:"flex flex-col flex-1 overflow-hidden",children:m}),t[12]=e,t[13]=m,t[14]=_):_=t[14],t[15]!==l||t[16]!==h||t[17]!==f||t[18]!==_?(g=c.jsxs("div",{...l,className:d,children:[h,f,_]}),t[15]=l,t[16]=h,t[17]=f,t[18]=_,t[19]=g):g=t[19],g},yp=t=>{const e=K.c(6),n=t.dataTestId;let o,r;return e[0]!==t.className?(o=Ne("text-xs font-semibold text-accent-foreground",t.className),e[0]=t.className,e[1]=o):o=e[1],e[2]!==t.dataTestId||e[3]!==t.onClick||e[4]!==o?(r=c.jsx("button",{type:"button","data-testid":n,className:o,onClick:t.onClick,children:"Clear"}),e[2]=t.dataTestId,e[3]=t.onClick,e[4]=o,e[5]=r):r=e[5],r},A3=()=>{const t=K.c(9),e=IH(),{clearLogs:n}=bt();if(e.length===0){let i,a;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx("code",{className:"border rounded px-1",children:"stdout"}),t[0]=i):i=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx(yn,{title:"No logs",description:c.jsxs("span",{children:[i," and"," ",c.jsx("code",{className:"border rounded px-1",children:"stderr"})," logs will appear here."]}),icon:c.jsx(ym,{})}),t[1]=a):a=t[1],a}let o,r,s;return t[2]!==n?(o=c.jsx("div",{className:"flex flex-row justify-end px-2 py-1",children:c.jsx(yp,{dataTestId:"clear-logs-button",onClick:n})}),t[2]=n,t[3]=o):o=t[3],t[4]!==e?(r=c.jsx("div",{className:"overflow-auto flex-1",children:c.jsx(T3,{logs:e,className:"min-w-[300px]"})}),t[4]=e,t[5]=r):r=t[5],t[6]!==o||t[7]!==r?(s=c.jsxs(c.Fragment,{children:[o,r]}),t[6]=o,t[7]=r,t[8]=s):s=t[8],s},T3=t=>{const e=K.c(10),{logs:n,className:o}=t;let r,s,i,a,l;return e[0]!==o?(r=Ne("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(XF),e[3]=n,e[4]=i):i=e[4],e[5]!==i?(a=c.jsx("pre",{className:"grid text-xs font-mono gap-1 whitespace-break-spaces font-semibold align-left",children:c.jsx("div",{className:"grid grid-cols-[30px,1fr]",style:s,children:i})}),e[5]=i,e[6]=a):a=e[6],e[7]!==r||e[8]!==a?(l=c.jsx("div",{className:r,children:a}),e[7]=r,e[8]=a,e[9]=l):l=e[9],l};function JF(t){const e=AH(t.timestamp),n=KF[t.level],o=t.level.toUpperCase();return c.jsxs(c.Fragment,{children:[c.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)] dark:text-[var(--gray-11)]",children:["[",e,"]"]}),c.jsx("span",{className:Ne("flex-shrink-0",n),children:o}),c.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)]",children:["(",c.jsx(yr,{cellId:t.cellId}),")"]}),t.message]})}const KF={stdout:"text-[var(--grass-9)]",stderr:"text-[var(--red-9)]"};function XF(t,e){return c.jsxs("div",{className:"contents group",children:[c.jsx("span",{className:Ne("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","text-right col-span-1 py-1 pr-1"),children:e+1}),c.jsx("span",{className:Ne("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","px-2 flex gap-x-1.5 py-1 flex-wrap"),children:JF(t)})]},e)}const ZF=()=>{const t=K.c(7),{items:e}=Le(TH);let n,o;t[0]!==e?(o=OW(e),t[0]=e,t[1]=o):o=t[1],n=o;const r=n,{activeHeaderId:s,activeOccurrences:i}=DW(r);if(e.length===0){let l;return t[2]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(yn,{title:"No outline",description:"Add markdown headings to your notebook to create an outline.",icon:c.jsx(gd,{})}),t[2]=l):l=t[2],l}let a;return t[3]!==s||t[4]!==i||t[5]!==e?(a=c.jsx(RW,{items:e,activeHeaderId:s,activeOccurrences:i}),t[3]=s,t[4]=i,t[5]=e,t[6]=a):a=t[6],a},M3=zt(null),O3=t=>{const e=K.c(9),{onClick:n,loading:o,children:r,className:s}=t;if(o){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(An,{size:"small",className:"h-4 w-4 shrink-0 opacity-50"}),e[0]=d):d=e[0],d}let i,a,l;return e[1]!==s?(i=Ne("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=Qn.stopPropagation(n),e[3]=n,e[4]=a):a=e[4],e[5]!==r||e[6]!==i||e[7]!==a?(l=c.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},QF=()=>{var v,C;const t=K.c(27),[e]=zr(),n=e.package_management.manager,[o,r]=X.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:d}=Wn(oz,s);if(d){let S;return t[2]===Symbol.for("react.memo_cache_sentinel")?(S=c.jsx(An,{size:"medium",centered:!0}),t[2]=S):S=t[2],S}if(a){let S;return t[3]!==a?(S=c.jsx(Vr,{error:a}),t[3]=a,t[4]=S):S=t[4],S}const u=i.tree!=null;let h;t[5]!==u||t[6]!==o?(h=function(S,E){return S==="list"?"list":E?S||"tree":"list"}(o,u),t[5]=u,t[6]=o,t[7]=h):h=t[7];const f=h,m=(v=i.tree)==null?void 0:v.name,_=(C=i==null?void 0:i.tree)==null?void 0:C.version,g=m==="<root>";let p,b,x,y;return t[8]!==n||t[9]!==l?(p=c.jsx(ez,{packageManager:n,onSuccess:l}),t[8]=n,t[9]=l,t[10]=p):p=t[10],t[11]!==g||t[12]!==u||t[13]!==m||t[14]!==_||t[15]!==f?(b=u&&c.jsxs("div",{className:"flex items-center justify-between px-2 py-1 border-b",children:[c.jsxs("div",{className:"flex gap-1",children:[c.jsx("button",{type:"button",className:Ne("px-2 py-1 text-xs rounded",f==="list"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>r("list"),children:"List"}),c.jsx("button",{type:"button",className:Ne("px-2 py-1 text-xs rounded",f==="tree"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>r("tree"),children:"Tree"})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium",title:g?"sandbox":"project",children:g?"sandbox":"project"}),m&&!g&&c.jsxs("span",{className:"text-xs text-muted-foreground",children:[m,_&&` v${_}`]})]})]}),t[11]=g,t[12]=u,t[13]=m,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?(x=f==="list"?c.jsx(tz,{packages:i.list,onSuccess:l}):c.jsx(nz,{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]=x):x=t[22],t[23]!==p||t[24]!==b||t[25]!==x?(y=c.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[p,b,x]}),t[23]=p,t[24]=b,t[25]=x,t[26]=y):y=t[26],y},ez=t=>{const e=K.c(40),{onSuccess:n,packageManager:o}=t,[r,s]=X.useState(""),{handleClick:i}=wa(),a=Le(M3),l=Ot(M3);let d,u;e[0]!==a||e[1]!==l?(d=()=>{a&&(s(a),l(null))},u=[a,l],e[0]=a,e[1]=l,e[2]=d,e[3]=u):(d=e[2],u=e[3]),X.useEffect(d,u);const{loading:h,handleInstallPackages:f}=DH();let m;e[4]!==n?(m=()=>{n(),s("")},e[4]=n,e[5]=m):m=e[5];const _=m;let g;e[6]!==f||e[7]!==r||e[8]!==_?(g=()=>{f(r.split(",").map(rz),_)},e[6]=f,e[7]=r,e[8]=_,e[9]=g):g=e[9];const p=g,b=`Install packages with ${o}...`;let x,y,v,C,S,E,N,j,T,A,M,P,R,L;e[10]!==h||e[11]!==i?(x=h?c.jsx(An,{size:"small",className:"mr-2 h-4 w-4 shrink-0 opacity-50"}):c.jsx(Te,{content:"Change package manager",children:c.jsx(Ys,{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]=x):x=e[12],e[13]!==p?(y=I=>{I.key==="Enter"&&(I.preventDefault(),p())},e[13]=p,e[14]=y):y=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(v=I=>s(I.target.value),e[15]=v):v=e[15],e[16]!==r||e[17]!==b||e[18]!==x||e[19]!==y?(C=c.jsx(US,{placeholder:b,id:H1,icon:x,rootClassName:"flex-1 border-none",value:r,onKeyDown:y,onChange:v}),e[16]=r,e[17]=b,e[18]=x,e[19]=y,e[20]=C):C=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(S=c.jsx("span",{className:"font-bold tracking-wide",children:"Package name:"}),e[21]=S):S=e[21],e[22]===Symbol.for("react.memo_cache_sentinel")?(E=c.jsxs("div",{children:[S," A package name; this will install the latest version.",c.jsx("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),N=c.jsx("span",{className:"font-bold tracking-wide",children:"Package and version:"}),e[22]=E,e[23]=N):(E=e[22],N=e[23]),e[24]===Symbol.for("react.memo_cache_sentinel")?(j=c.jsxs("div",{children:[N," ","A package with a specific version or version range.",c.jsx("div",{className:"text-muted-foreground",children:"Examples: httpx==0.27.0, httpx>=0.27.0"})]}),T=c.jsx("span",{className:"font-bold tracking-wide",children:"Git:"}),e[24]=j,e[25]=T):(j=e[24],T=e[25]),e[26]===Symbol.for("react.memo_cache_sentinel")?(A=c.jsxs("div",{children:[T," A Git repository",c.jsx("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),M=c.jsx("span",{className:"font-bold tracking-wide",children:"URL:"}),e[26]=A,e[27]=M):(A=e[26],M=e[27]),e[28]===Symbol.for("react.memo_cache_sentinel")?(P=c.jsxs("div",{children:[M," A remote wheel or source distribution.",c.jsx("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),R=c.jsx("span",{className:"font-bold tracking-wide",children:"Path:"}),e[28]=P,e[29]=R):(P=e[28],R=e[29]),e[30]===Symbol.for("react.memo_cache_sentinel")?(L=c.jsx(Te,{delayDuration:300,side:"left",align:"start",content:c.jsxs("div",{className:"text-sm flex flex-col w-full max-w-[360px]",children:["Packages are installed using the package manager specified in your user configuration. Depending on your package manager, you can install packages with various formats:",c.jsxs("div",{className:"flex flex-col gap-2 mt-2",children:[E,j,A,P,c.jsxs("div",{children:[R," A local wheel, source distribution, or project directory.",c.jsx("div",{className:"text-muted-foreground",children:"Example: /example/foo-0.1.0-py3-none-any.whl"})]})]})]}),children:c.jsx(np,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),e[30]=L):L=e[30];const B=r&&"bg-accent text-accent-foreground";let U;e[31]!==B?(U=Ne("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 D=!r;let k,$;return e[33]!==p||e[34]!==U||e[35]!==D?(k=c.jsx("button",{type:"button",className:U,onClick:p,disabled:D,children:"Add"}),e[33]=p,e[34]=U,e[35]=D,e[36]=k):k=e[36],e[37]!==k||e[38]!==C?($=c.jsxs("div",{className:"flex items-center w-full border-b",children:[C,L,k]}),e[37]=k,e[38]=C,e[39]=$):$=e[39],$},tz=t=>{const e=K.c(9),{onSuccess:n,packages:o}=t;if(o.length===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx(yn,{title:"No packages",description:"No packages are installed in this environment.",icon:c.jsx(Ys,{})}),e[0]=a):a=e[0],a}let r,s,i;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(cp,{children:c.jsxs(Gs,{children:[c.jsx($r,{children:"Name"}),c.jsx($r,{children:"Version"}),c.jsx($r,{})]})}),e[1]=r):r=e[1],e[2]!==n||e[3]!==o){let a;e[5]!==n?(a=l=>c.jsxs(Gs,{className:"group",onClick:async()=>{await _n(`${l.name}==${l.version}`),nt({title:"Copied to clipboard"})},children:[c.jsx(Hr,{children:l.name}),c.jsx(Hr,{children:l.version}),c.jsxs(Hr,{className:"flex justify-end",children:[c.jsx(D3,{packageName:l.name,onSuccess:n}),c.jsx(R3,{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=c.jsxs(dp,{className:"overflow-auto flex-1",children:[r,c.jsx(up,{children:s})]}),e[7]=s,e[8]=i):i=e[8],i},D3=({packageName:t,onSuccess:e})=>{const[n,o]=X.useState(!1);return un()?null:c.jsx(O3,{onClick:async()=>{try{o(!0);const r=await RH({package:t,upgrade:!0});r.success?(e(),VS(t)):VS(t,r.error)}finally{o(!1)}},loading:n,children:"Upgrade"})},R3=({packageName:t,onSuccess:e})=>{const[n,o]=X.useState(!1);return c.jsx(O3,{onClick:async()=>{try{o(!0);const r=await PH({package:t});r.success?(e(),$S(t)):$S(t,r.error)}finally{o(!1)}},loading:n,children:"Remove"})},nz=t=>{const e=K.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]=X.useState(s);let l,d,u;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{a(new Set)},e[1]=l):l=e[1],e[2]!==n?(d=[n],e[2]=n,e[3]=d):d=e[3],X.useEffect(l,d),o){let _;return e[4]!==o?(_=c.jsx(Vr,{error:o}),e[4]=o,e[5]=_):_=e[5],_}if(!n){let _;return e[6]===Symbol.for("react.memo_cache_sentinel")?(_=c.jsx(An,{size:"medium",centered:!0}),e[6]=_):_=e[6],_}if(n.dependencies.length===0){let _;return e[7]===Symbol.for("react.memo_cache_sentinel")?(_=c.jsx(yn,{title:"No dependencies",description:"No package dependencies found in this environment.",icon:c.jsx(Ys,{})}),e[7]=_):_=e[7],_}e[8]===Symbol.for("react.memo_cache_sentinel")?(u=_=>{a(g=>{const p=new Set(g);return p.has(_)?p.delete(_):p.add(_),p})},e[8]=u):u=e[8];const h=u;let f,m;if(e[9]!==i||e[10]!==r||e[11]!==n.dependencies){let _;e[13]!==i||e[14]!==r?(_=(g,p)=>c.jsx("div",{className:"border-b",children:c.jsx(P3,{nodeId:`root-${p}`,node:g,level:0,isTopLevel:!0,expandedNodes:i,onToggle:h,onSuccess:r})},`${g.name}-${p}`),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?(m=c.jsx("div",{className:"flex-1 overflow-auto",children:c.jsx("div",{children:f})}),e[16]=f,e[17]=m):m=e[17],m},P3=t=>{const e=K.c(57),{nodeId:n,node:o,level:r,isTopLevel:s,expandedNodes:i,onToggle:a,onSuccess:l}=t,d=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,m=d?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 p;e[7]!==u||e[8]!==n||e[9]!==a?(p=U=>{U.stopPropagation(),u&&a(n)},e[7]=u,e[8]=n,e[9]=a,e[10]=p):p=e[10];const b=p,x=u&&"select-none",y=d?"px-2 py-0.5":"";let v,C;e[11]!==x||e[12]!==y?(v=Ne("flex items-center group cursor-pointer text-sm whitespace-nowrap","hover:bg-[var(--slate-2)] focus:bg-[var(--slate-2)] focus:outline-none",x,y),e[11]=x,e[12]=y,e[13]=v):v=e[13],e[14]!==m||e[15]!==d?(C=d?{}:{paddingLeft:`${m}px`},e[14]=m,e[15]=d,e[16]=C):C=e[16];const S=u?f:void 0;let E,N,j,T,A,M,P,R,L,B;return e[17]!==u||e[18]!==f?(E=u?f?c.jsx(dr,{className:"w-4 h-4 mr-2 flex-shrink-0"}):c.jsx(ta,{className:"w-4 h-4 mr-2 flex-shrink-0"}):c.jsx("div",{className:"w-4 mr-2 flex-shrink-0"}),e[17]=u,e[18]=f,e[19]=E):E=e[19],e[20]!==o.name?(N=c.jsx("span",{className:"font-medium truncate",children:o.name}),e[20]=o.name,e[21]=N):N=e[21],e[22]!==o.version?(j=o.version&&c.jsxs("span",{className:"text-muted-foreground text-xs",children:["v",o.version]}),e[22]=o.version,e[23]=j):j=e[23],e[24]!==N||e[25]!==j?(T=c.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 py-1.5",children:[N,j]}),e[24]=N,e[25]=j,e[26]=T):T=e[26],e[27]!==o.tags?(A=o.tags.map(sz),e[27]=o.tags,e[28]=A):A=e[28],e[29]!==A?(M=c.jsx("div",{className:"flex items-center gap-1 ml-2",children:A}),e[29]=A,e[30]=M):M=e[30],e[31]!==d||e[32]!==o.name||e[33]!==l?(P=d&&c.jsxs("div",{className:"flex gap-1 invisible group-hover:visible",children:[c.jsx(D3,{packageName:o.name,onSuccess:l}),c.jsx(R3,{packageName:o.name,onSuccess:l})]}),e[31]=d,e[32]=o.name,e[33]=l,e[34]=P):P=e[34],e[35]!==b||e[36]!==g||e[37]!==E||e[38]!==T||e[39]!==M||e[40]!==P||e[41]!==v||e[42]!==C||e[43]!==S?(R=c.jsxs("div",{className:v,style:C,onClick:b,onKeyDown:g,tabIndex:0,role:"treeitem","aria-selected":!1,"aria-expanded":S,children:[E,T,M,P]}),e[35]=b,e[36]=g,e[37]=E,e[38]=T,e[39]=M,e[40]=P,e[41]=v,e[42]=C,e[43]=S,e[44]=R):R=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?(L=u&&f&&c.jsx("div",{role:"group",children:o.dependencies.map((U,D)=>c.jsx(P3,{nodeId:`${n}-${D}`,node:U,level:r+1,isTopLevel:!1,expandedNodes:i,onToggle:a,onSuccess:l},`${U.name}-${D}`))}),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]=L):L=e[53],e[54]!==R||e[55]!==L?(B=c.jsxs("div",{children:[R,L]}),e[54]=R,e[55]=L,e[56]=B):B=e[56],B};async function oz(){const[t,e]=await Promise.all([MH(),OH()]);return{list:t.packages,tree:e.tree}}function rz(t){return t.trim()}function sz(t,e){return t.kind==="cycle"?c.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-orange-300 dark:border-orange-700 text-orange-700 dark:text-orange-300",title:"cycle",children:"cycle"},e):t.kind==="extra"?c.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-blue-300 dark:border-blue-700 text-blue-700 dark:text-blue-300",title:t.value,children:t.value},e):t.kind==="group"?c.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-green-300 dark:border-green-700 text-green-700 dark:text-green-300",title:t.value,children:t.value},e):null}const hm=t4("marimo:scratchpadHistory:v1",[]),iz=zt(!1),az=zt(null,(t,e,n)=>{if(!(n=n.trim()))return;const o=t(hm),r=[n,...o.filter(s=>s!==n)].slice(0,15);e(hm,r)}),lz={hide_code:!1,disabled:!1},cz=()=>{const t=K.c(69),e=Ac(),[n]=zr(),{theme:o}=xr(),r=O.useRef(null),s=Rs(),{createNewCell:i,updateCellCode:a}=bt(),l=e.cellRuntime[wr],d=l==null?void 0:l.output,u=l==null?void 0:l.status,h=l==null?void 0:l.consoleOutputs,f=e.cellData[wr],m=(f==null?void 0:f.code)??"",_=Ot(az),[g,p]=Qt(iz),b=Le(hm);let x;t[0]!==_||t[1]!==m?(x=()=>{HS({code:m}),_(m)},t[0]=_,t[1]=m,t[2]=x):x=t[2];const y=qe(x);let v;t[3]!==m||t[4]!==i||t[5]!==s?(v=()=>{m.trim()&&i({code:m,before:!1,cellId:s??"__end__"})},t[3]=m,t[4]=i,t[5]=s,t[6]=v):v=t[6];const C=qe(v);let S;t[7]!==a?(S=()=>{a({cellId:wr,code:"",formattingChange:!1}),HS({code:""});const ae=r.current;ae&&ae.dispatch({changes:{from:0,to:ae.state.doc.length,insert:""}})},t[7]=a,t[8]=S):S=t[8];const E=qe(S);let N;t[9]!==p||t[10]!==a?(N=ae=>{p(!1),a({cellId:wr,code:ae,formattingChange:!1});const Ce=r.current;Ce&&Ce.dispatch({changes:{from:0,to:Ce.state.doc.length,insert:ae}})},t[9]=p,t[10]=a,t[11]=N):N=t[11];const j=qe(N),[T,A]=O.useState();let M;t[12]!==m||t[13]!==h||t[14]!==y||t[15]!==T||t[16]!==d||t[17]!==o||t[18]!==n?(M=()=>c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[40%]",children:c.jsx(sh,{theme:o,showPlaceholder:!1,id:wr,code:m,config:lz,status:"idle",serializedEditorState:null,runCell:y,userConfig:n,editorViewRef:r,setEditorView:ae=>{r.current=ae},hidden:!1,showHiddenCode:Hn.NOOP,languageAdapter:T,setLanguageAdapter:A})}),c.jsx("div",{className:"flex-1 overflow-auto flex-shrink-0",children:c.jsx(Jc,{allowExpand:!1,output:d,className:"output-area",cellId:wr,stale:!1,loading:!1})}),c.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[35%]",children:c.jsx(_p,{consoleOutputs:h,className:"overflow-auto",stale:!1,cellName:n4,onSubmitDebugger:Hn.NOOP,cellId:wr,debuggerActive:!1})})]}),t[12]=m,t[13]=h,t[14]=y,t[15]=T,t[16]=d,t[17]=o,t[18]=n,t[19]=M):M=t[19];const P=M;let R;t[20]!==j||t[21]!==b||t[22]!==g||t[23]!==o?(R=()=>g?c.jsx("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:c.jsx("div",{className:"overflow-auto flex flex-col gap-3",children:b.map((ae,Ce)=>c.jsx("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>j(ae),children:c.jsx(O.Suspense,{children:c.jsx(xa,{language:"python",theme:o,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:ae.trim(),editable:!1,readOnly:!0})})},Ce))})}):null,t[20]=j,t[21]=b,t[22]=g,t[23]=o,t[24]=R):R=t[24];const L=R;let B,U,D,k,$,I,W,G,q,Y,ee;t[25]===Symbol.for("react.memo_cache_sentinel")?(B=bm.create(wr),U=c.jsx("p",{className:"mx-2 my-2 text-muted-foreground text-sm",children:"Use this scratchpad cell to experiment with code without restrictions on variable names. Scratchpad code is ephemeral: variables defined in the scratchpad aren't saved to notebook memory, and the code is not saved in the notebook file."}),t[25]=B,t[26]=U):(B=t[25],U=t[26]),t[27]===Symbol.for("react.memo_cache_sentinel")?(D=on("cell.run"),t[27]=D):D=t[27],t[28]===Symbol.for("react.memo_cache_sentinel")?(k=c.jsx(Wr,{color:"var(--grass-11)",size:16}),t[28]=k):k=t[28],t[29]!==y||t[30]!==g?($=c.jsx(Te,{content:D,children:c.jsx(Ae,{"data-testid":"scratchpad-run-button",onClick:y,disabled:g,variant:"text",size:"xs",children:k})}),t[29]=y,t[30]=g,t[31]=$):$=t[31],t[32]===Symbol.for("react.memo_cache_sentinel")?(I=c.jsx(Ap,{size:16}),t[32]=I):I=t[32],t[33]!==E||t[34]!==g?(W=c.jsx(Te,{content:"Clear code and outputs",children:c.jsx(Ae,{disabled:g,size:"xs",variant:"text",onClick:E,children:I})}),t[33]=E,t[34]=g,t[35]=W):W=t[35],t[36]===Symbol.for("react.memo_cache_sentinel")?(G=c.jsx(qr,{size:16}),t[36]=G):G=t[36],t[37]!==C||t[38]!==g?(q=c.jsx(ei,{children:c.jsx(Te,{content:"Insert code",children:c.jsx(Ae,{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")&&c.jsx(An,{className:"inline",size:"small"}),t[40]=u,t[41]=Y):Y=t[41],t[42]===Symbol.for("react.memo_cache_sentinel")?(ee=c.jsx("div",{className:"flex-1"}),t[42]=ee):ee=t[42];const oe=g&&"bg-[var(--sky-3)] rounded-none";let ie,Z;t[43]!==oe?(ie=Ne(oe),t[43]=oe,t[44]=ie):ie=t[44],t[45]!==g||t[46]!==p?(Z=()=>p(!g),t[45]=g,t[46]=p,t[47]=Z):Z=t[47];const Q=b.length===0;let me,fe,de,ue,ce,ke,Se;return t[48]===Symbol.for("react.memo_cache_sentinel")?(me=c.jsx(Lp,{size:16}),t[48]=me):me=t[48],t[49]!==ie||t[50]!==Z||t[51]!==Q?(fe=c.jsx(Te,{content:"Toggle history",children:c.jsx(Ae,{size:"xs",variant:"text",className:ie,onClick:Z,disabled:Q,children:me})}),t[49]=ie,t[50]=Z,t[51]=Q,t[52]=fe):fe=t[52],t[53]!==$||t[54]!==W||t[55]!==q||t[56]!==Y||t[57]!==fe?(de=c.jsxs("div",{className:"flex items-center flex-shrink-0",children:[$,W,q,Y,ee,fe]}),t[53]=$,t[54]=W,t[55]=q,t[56]=Y,t[57]=fe,t[58]=de):de=t[58],t[59]!==P?(ue=P(),t[59]=P,t[60]=ue):ue=t[60],t[61]!==L?(ce=L(),t[61]=L,t[62]=ce):ce=t[62],t[63]!==ue||t[64]!==ce?(ke=c.jsxs("div",{className:"flex-1 divide-y relative overflow-hidden flex flex-col",children:[ue,ce]}),t[63]=ue,t[64]=ce,t[65]=ke):ke=t[65],t[66]!==de||t[67]!==ke?(Se=c.jsxs("div",{className:"flex flex-col h-full overflow-hidden divide-y",id:B,children:[U,de,ke]}),t[66]=de,t[67]=ke,t[68]=Se):Se=t[68],Se},dz=()=>{const t=K.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx(cz,{}),t[0]=e):e=t[0],e},uz=()=>{const t=K.c(23),{openModal:e,closeModal:n}=$n();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}=Wn(fz,o);if(s){let b;return t[1]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(An,{size:"medium",centered:!0}),t[1]=b):b=t[1],b}if(i){let b;return t[2]!==i?(b=c.jsx(Vr,{error:i}),t[2]=i,t[3]=b):b=t[3],b}let l;t[4]!==r?(l=r.filter(mz).map(pz),t[4]=r,t[5]=l):l=t[5];const d=l;if(r.length===0){let b;return t[6]===Symbol.for("react.memo_cache_sentinel")?(b=c.jsx(yn,{title:"No environment variables",description:"No environment variables are available in this notebook.",icon:c.jsx(dd,{})}),t[6]=b):b=t[6],b}let u,h,f,m,_,g,p;return t[7]!==n||t[8]!==e||t[9]!==d||t[10]!==a?(u=()=>e(c.jsx(Fg,{providerNames:d,onSuccess:()=>{a(),n()},onClose:n})),t[7]=n,t[8]=e,t[9]=d,t[10]=a,t[11]=u):u=t[11],t[12]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(br,{className:"h-4 w-4"}),t[12]=h):h=t[12],t[13]!==u?(f=c.jsx("div",{className:"flex justify-end h-8 border-b",children:c.jsx("button",{type:"button",className:"float-right border-l px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:u,children:h})}),t[13]=u,t[14]=f):f=t[14],t[15]===Symbol.for("react.memo_cache_sentinel")?(m=c.jsx(cp,{children:c.jsxs(Gs,{children:[c.jsx($r,{children:"Environment Variable"}),c.jsx($r,{children:"Source"}),c.jsx($r,{})]})}),t[15]=m):m=t[15],t[16]!==r?(_=r.map(gz),t[16]=r,t[17]=_):_=t[17],t[18]!==_?(g=c.jsxs(dp,{className:"overflow-auto flex-1 mb-16",children:[m,c.jsx(up,{children:_})]}),t[18]=_,t[19]=g):g=t[19],t[20]!==f||t[21]!==g?(p=c.jsxs("div",{className:"flex flex-col h-full",children:[f,g]}),t[20]=f,t[21]=g,t[22]=p):p=t[22],p},hz=t=>{const e=K.c(9),{className:n,ariaLabel:o,onCopy:r}=t,[s,i]=X.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 d,u;return e[2]!==s?(d=s?c.jsx(Cc,{className:"w-3 h-3 text-green-700 rounded"}):c.jsx(Xi,{className:"w-3 h-3 hover:bg-muted rounded"}),e[2]=s,e[3]=d):d=e[3],e[4]!==o||e[5]!==n||e[6]!==l||e[7]!==d?(u=c.jsx("button",{type:"button",className:n,onClick:l,"aria-label":o,children:d}),e[4]=o,e[5]=n,e[6]=l,e[7]=d,e[8]=u):u=e[8],u};async function fz(){return Lg((await oC.request({})).secrets)}function mz(t){return t.provider!=="env"}function pz(t){return t.name}function gz(t){return t.keys.map(e=>c.jsxs(Gs,{className:"group",children:[c.jsx(Hr,{children:e}),c.jsx(Hr,{children:t.provider!=="env"&&c.jsx(NS,{variant:"outline",className:"select-none",children:t.name})}),c.jsx(Hr,{children:c.jsx(hz,{ariaLabel:`Copy ${e}`,onCopy:async()=>{await _n(`os.environ["${e}"]`),nt({title:"Copied to clipboard",description:`os.environ["${e}"] has been copied to your clipboard.`})},className:Ne("float-right px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible")})})]},`${t.name}-${e}`))}const _z=t=>{const e=K.c(6),{children:n}=t,{openModal:o,closeModal:r}=$n();let s,i;return e[0]!==r||e[1]!==o?(s=()=>o(c.jsx(xz,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(i=c.jsx(bS,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=i):i=e[5],i},bz=[et.lineWrapping],xz=t=>{const e=K.c(23),{onClose:n}=t,[o,r]=O.useState(""),{theme:s}=xr();let i,a,l,d,u,h;e[0]!==n?(i=async y=>{y.preventDefault();const v=new FormData(y.target),C=v.get("title"),S=v.get("description"),E=v.get("code");fetch("https://marimo.io/api/suggest-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:C,description:S,code:E})}),n(),nt({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=c.jsx(sr,{children:"Contribute a Snippet"}),e[2]=a):a=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsxs(Ts,{children:[a,c.jsxs(Ms,{children:["Have a useful snippet you want to share with the community? Submit it here or make a pull request"," ",c.jsx("a",{href:Zn.githubPage,target:"_blank",className:"underline",children:"on GitHub"}),"."]})]}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(ir,{id:"title",name:"title",autoFocus:!0,placeholder:"Title",required:!0,autoComplete:"off"}),u=c.jsx(LH,{id:"description",name:"description",autoFocus:!0,placeholder:"Description",rows:5,required:!0,autoComplete:"off"}),e[4]=d,e[5]=u):(d=e[4],u=e[5]),e[6]!==o?(h=c.jsx("input",{type:"hidden",name:"code",value:o}),e[6]=o,e[7]=h):h=e[7];const f=s==="dark"?"dark":"light";let m,_,g,p,b,x;return e[8]!==o||e[9]!==f?(m=c.jsx(xa,{theme:f,language:"python",className:"cm border rounded overflow-hidden",extensions:bz,value:o,onChange:r}),e[8]=o,e[9]=f,e[10]=m):m=e[10],e[11]!==h||e[12]!==m?(_=c.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[d,u,h,m]}),e[11]=h,e[12]=m,e[13]=_):_=e[13],e[14]!==n?(g=c.jsx(Ae,{"data-testid":"snippet-cancel-button",variant:"secondary",onClick:n,children:"Cancel"}),e[14]=n,e[15]=g):g=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(p=c.jsx(Ae,{"data-testid":"snippet-send-button","aria-label":"Save",variant:"default",type:"submit",children:"Send"}),e[16]=p):p=e[16],e[17]!==g?(b=c.jsxs(Ki,{children:[g,p]}),e[17]=g,e[18]=b):b=e[18],e[19]!==i||e[20]!==b||e[21]!==_?(x=c.jsx(ar,{className:"w-fit",children:c.jsxs("form",{onSubmit:i,children:[l,_,b]})}),e[19]=i,e[20]=b,e[21]=_,e[22]=x):x=e[22],x},yz=[et.lineWrapping],wz=()=>{const t=K.c(20),[e,n]=X.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}=Wn(Sz,o);if(s){let b;return t[1]!==s?(b=c.jsx(Vr,{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=c.jsx(An,{size:"medium",centered:!0}),t[3]=b):b=t[3],b}const a=e?"h-1/3":"h-full";let l,d,u,h,f,m,_,g,p;return t[4]!==a?(l=Ne("border-b rounded-none",a),t[4]=a,t[5]=l):l=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(d=c.jsx(na,{placeholder:"Search snippets...",className:"h-6 m-1",rootClassName:"flex-1 border-r"}),t[6]=d):d=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsxs("div",{className:"flex items-center w-full",children:[d,c.jsx(_z,{children:c.jsx("button",{className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:c.jsx(br,{className:"h-4 w-4"})})})]}),h=c.jsx(gc,{children:"No results"}),t[7]=u,t[8]=h):(u=t[7],h=t[8]),t[9]===Symbol.for("react.memo_cache_sentinel")?(f=b=>n(b),t[9]=f):f=t[9],t[10]!==r.snippets?(m=c.jsx(kz,{onSelect:f,snippets:r.snippets}),t[10]=r.snippets,t[11]=m):m=t[11],t[12]!==l||t[13]!==m?(_=c.jsxs(Ec,{className:l,children:[u,h,m]}),t[12]=l,t[13]=m,t[14]=_):_=t[14],t[15]!==e?(g=c.jsx(O.Suspense,{children:c.jsx("div",{className:"h-2/3 snippet-viewer flex flex-col",children:e?c.jsx(vz,{snippet:e},e.title):c.jsx(yn,{title:"",description:"Click on a snippet to view its content."})})}),t[15]=e,t[16]=g):g=t[16],t[17]!==_||t[18]!==g?(p=c.jsxs("div",{className:"flex-1 overflow-hidden",children:[_,g]}),t[17]=_,t[18]=g,t[19]=p):p=t[19],p},vz=t=>{const e=K.c(27),{snippet:n}=t,{theme:o}=xr(),{createNewCell:r}=bt(),s=Rs();let i;e[0]!==r||e[1]!==s||e[2]!==n.sections?(i=()=>{for(const p of[...n.sections].reverse())p.code&&r({code:p.code,before:!1,cellId:s??"__end__",skipIfCodeExists:!0})},e[0]=r,e[1]=s,e[2]=n.sections,e[3]=i):i=e[3];const a=i;let l;e[4]!==r||e[5]!==s?(l=p=>{r({code:p,before:!1,cellId:s??"__end__"})},e[4]=r,e[5]=s,e[6]=l):l=e[6];const d=l;let u,h,f,m,_,g;if(e[7]!==n.title?(u=c.jsx("div",{className:"text-sm font-semibold bg-muted border-y px-2 py-1",children:n.title}),e[7]=n.title,e[8]=u):u=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(qr,{className:"ml-2 h-4 w-4"}),e[9]=h):h=e[9],e[10]!==a?(f=c.jsx("div",{className:"flex justify-end",children:c.jsx(ei,{children:c.jsxs(Ae,{className:"float-right",size:"xs",variant:"outline",onClick:a,children:["Insert snippet",h]})})}),e[10]=a,e[11]=f):f=e[11],e[12]!==d||e[13]!==n.sections||e[14]!==n.title||e[15]!==o){let p;e[17]!==d||e[18]!==n.title||e[19]!==o?(p=b=>{const{code:x,html:y,id:v}=b;return y?c.jsx("div",{children:sp({html:y})},`${n.title}-${v}`):x?c.jsxs("div",{className:"relative hover-actions-parent pr-2",children:[c.jsx(ei,{children:c.jsx(Te,{content:"Insert snippet",children:c.jsx(Ae,{className:"absolute -top-2 -right-1 z-10 hover-action px-2 bg-background",size:"sm",variant:"outline",onClick:()=>{d(x)},children:c.jsx(qr,{className:"h-5 w-5"})})})}),c.jsx(O.Suspense,{children:c.jsx(xa,{theme:o==="dark"?"dark":"light",language:"python",className:"cm border rounded overflow-hidden",extensions:yz,value:x,readOnly:!0},`${n.title}-${v}`)})]},`${n.title}-${v}`):null},e[17]=d,e[18]=n.title,e[19]=o,e[20]=p):p=e[20],m=n.sections.map(p),e[12]=d,e[13]=n.sections,e[14]=n.title,e[15]=o,e[16]=m}else m=e[16];return e[21]!==f||e[22]!==m?(_=c.jsxs("div",{className:"px-2 py-2 space-y-4 overflow-auto flex-1",children:[f,m]}),e[21]=f,e[22]=m,e[23]=_):_=e[23],e[24]!==u||e[25]!==_?(g=c.jsxs(c.Fragment,{children:[u,_]}),e[24]=u,e[25]=_,e[26]=g):g=e[26],g},kz=t=>{const e=K.c(7),{snippets:n,onSelect:o}=t;let r,s;if(e[0]!==o||e[1]!==n){let i;e[3]!==o?(i=a=>c.jsx(mo,{className:"rounded-none",onSelect:()=>o(a),children:c.jsx("div",{className:"flex flex-row gap-2 items-center",children:c.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=c.jsx(Jm,{className:"flex flex-col overflow-auto",children:r}),e[5]=r,e[6]=s):s=e[6],s};function Sz(){return FH()}const Cz=X.lazy(()=>Km(()=>import("./tracing-Z4QREdu3.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124]),import.meta.url).then(t=>({default:t.Tracing}))),Nz=()=>{const t=K.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx(X.Suspense,{fallback:c.jsx(jz,{}),children:c.jsx(Cz,{})}),t[0]=e):e=t[0],e},jz=()=>{const t=K.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:c.jsx(An,{})}),t[0]=e):e=t[0],e},L3="name",F3="type-value",fm="defs-refs",Ez=[{id:L3,accessorFn:t=>[t.name,t.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>c.jsx(hp,{header:"Name",column:t}),cell:({getValue:t})=>{const[e,n]=t();return c.jsx(Cf,{name:e,declaredBy:n})}},{id:F3,accessorFn:t=>[t.dataType,t.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>c.jsx(hp,{header:c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("span",{children:"Type"}),c.jsx("span",{children:"Value"})]}),column:t}),cell:({getValue:t})=>{const[e,n]=t();return c.jsxs("div",{className:"max-w-[150px]",children:[c.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs",children:e}),c.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap",title:n??"",children:n})]})}},{id:fm,accessorFn:t=>[t.declaredBy,t.usedBy,t.name,t.declaredByNames,t.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:t})=>c.jsx(hp,{header:c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("span",{children:"Declared By"}),c.jsx("span",{children:"Used By"})]}),column:t}),cell:({getValue:t})=>{const[e,n,o]=t(),r=s=>{const i=Qi(s);i&&ip(i,o)};return c.jsxs("div",{className:"flex flex-col gap-1 py-1",children:[c.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-center",children:[c.jsx("span",{title:"Declared by",children:c.jsx(og,{className:"w-3.5 h-3.5 text-muted-foreground"})}),e.length===1?c.jsx(yr,{variant:"focus",cellId:e[0],skipScroll:!0,onClick:()=>r(e[0])}):c.jsx("div",{className:"text-destructive flex flex-row gap-2",children:e.slice(0,3).map((s,i)=>c.jsxs("span",{className:"flex",children:[c.jsx(yr,{variant:"focus",cellId:s,skipScroll:!0,className:"whitespace-nowrap text-destructive",onClick:()=>r(s)},s),i<e.length-1&&", "]},s))})]}),c.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-baseline",children:[c.jsx("span",{title:"Used by",children:c.jsx(Aa,{className:"w-3.5 h-3.5 text-muted-foreground"})}),c.jsx(ak,{maxCount:3,cellIds:n,skipScroll:!0,onClick:r})]})]})}}],z3=O.memo(({className:t,cellIds:e,variables:n})=>{const[o,r]=X.useState([]),[s,i]=X.useState(""),a=zH(),l=O.useMemo(()=>{const h=f=>{const m=a[f];return HH(m)?`cell-${e.indexOf(f)}`:m??`cell-${e.indexOf(f)}`};return Object.values(n).map(f=>({...f,declaredByNames:f.declaredBy.map(h),usedByNames:f.usedBy.map(h)}))},[n,a,e]),d=O.useMemo(()=>{const h=new Map;return e.forEach((f,m)=>h.set(f,m)),function({variables:f,sort:m,cellIdToIndex:_}){m||(m={id:fm,desc:!1});let g=[];switch(m.id){case L3:g=ka(f,p=>p.name);break;case F3:g=ka(f,p=>p.dataType);break;case fm:g=ka(f,p=>_.get(p.declaredBy[0]))}return m.desc?g.reverse():g}({variables:l,sort:o[0],cellIdToIndex:h})},[l,o,e]),u=BH({data:d,columns:Ez,getCoreRowModel:$H(),onGlobalFilterChange:i,getFilteredRowModel:VH(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter:h=>h.columnDef.enableGlobalFilter??!0,globalFilterFn:"auto",manualSorting:!0,onSortingChange:r,getSortedRowModel:UH(),state:{sorting:o,globalFilter:s}});return c.jsxs(c.Fragment,{children:[c.jsx(US,{className:"w-full",placeholder:"Search",value:s,onChange:h=>i(h.target.value)}),c.jsxs(dp,{className:Ne("w-full text-sm flex-1 border-separate border-spacing-0",t),children:[c.jsx(cp,{children:c.jsx(Gs,{className:"whitespace-nowrap text-xs",children:u.getFlatHeaders().map(h=>c.jsx($r,{className:"sticky top-0 bg-background border-b",children:WS(h.column.columnDef.header,h.getContext())},h.id))})}),c.jsx(up,{children:u.getRowModel().rows.map(h=>c.jsx(Gs,{className:"hover:bg-accent",children:h.getVisibleCells().map(f=>c.jsx(Hr,{className:"border-b",children:WS(f.column.columnDef.cell,f.getContext())},f.id))},h.id))})]})]})});z3.displayName="VariableTable";const Iz=()=>{const t=K.c(4),e=ES(),n=Zc();if(Object.keys(e).length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=c.jsx(yn,{title:"No variables",description:"Global variables will appear here.",icon:c.jsx(sc,{})}),t[0]=r):r=t[0],r}let o;return t[1]!==n.inOrderIds||t[2]!==e?(o=c.jsx(z3,{className:"flex-1",cellIds:n.inOrderIds,variables:e}),t[1]=n.inOrderIds,t[2]=e,t[3]=o):o=t[3],o},Az=X.lazy(()=>Km(()=>import("./terminal-BkOhnp-S.js"),__vite__mapDeps([125,1,2,126]),import.meta.url)),Tz=t=>{const e=K.c(121),{children:n}=t,{isSidebarOpen:o,isTerminalOpen:r,selectedPanel:s}=Sc(),{setIsSidebarOpen:i,setIsTerminalOpen:a}=sa(),l=X.useRef(null),d=X.useRef(null);let u,h,f,m,_;e[0]!==o?(u=()=>{if(!l.current)return;const xe=l.current.isCollapsed();o&&xe&&l.current.expand(),o||xe||l.current.collapse(),requestAnimationFrame(Oz)},h=[o],e[0]=o,e[1]=u,e[2]=h):(u=e[1],h=e[2]),O.useEffect(u,h),e[3]!==r?(f=()=>{if(!d.current)return;const xe=d.current.isCollapsed();r&&xe&&d.current.expand(),r||xe||d.current.collapse(),requestAnimationFrame(Rz)},m=[r],e[3]=r,e[4]=f,e[5]=m):(f=e[4],m=e[5]),O.useEffect(f,m),e[6]!==n?(_=c.jsx(ed,{id:"app",className:"relative h-full",children:c.jsx(O.Suspense,{children:n})},"app"),e[6]=n,e[7]=_):_=e[7];const g=_,p=o?"resize-handle":"resize-handle-collapsed";let b,x;e[8]!==p?(b=Ne("border-border no-print z-10",p,"vertical"),e[8]=p,e[9]=b):b=e[9],e[10]!==b?(x=c.jsx(qS,{onDragging:GS,className:b}),e[10]=b,e[11]=x):x=e[11];const y=x,v=r?"resize-handle":"resize-handle-collapsed";let C,S;e[12]!==v?(C=Ne("border-border no-print z-20",v,"horizontal"),e[12]=v,e[13]=C):C=e[13],e[14]!==C?(S=c.jsx(qS,{onDragging:GS,className:C}),e[14]=C,e[15]=S):S=e[15];const E=S;let N,j,T,A,M,P,R,L,B,U,D,k,$,I,W,G,q,Y,ee,oe,ie;e[16]!==s?(N=c.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?(j=()=>i(!1),e[18]=i,e[19]=j):j=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(T=c.jsx(eo,{className:"w-4 h-4"}),e[20]=T):T=e[20],e[21]!==j?(A=c.jsx(Ae,{"data-testid":"close-helper-pane",className:"m-0",size:"xs",variant:"text",onClick:j,children:T}),e[21]=j,e[22]=A):A=e[22],e[23]!==N||e[24]!==A?(M=c.jsxs("div",{className:"p-3 border-b flex justify-between items-center",children:[N,A]}),e[23]=N,e[24]=A,e[25]=M):M=e[25],e[26]!==s?(P=s==="files"&&c.jsx(I3,{}),e[26]=s,e[27]=P):P=e[27],e[28]!==s?(R=s==="errors"&&c.jsx(jF,{}),e[28]=s,e[29]=R):R=e[29],e[30]!==s?(L=s==="variables"&&c.jsx(Iz,{}),e[30]=s,e[31]=L):L=e[31],e[32]!==s?(B=s==="dependencies"&&c.jsx(hF,{}),e[32]=s,e[33]=B):B=e[33],e[34]!==s?(U=s==="packages"&&c.jsx(QF,{}),e[34]=s,e[35]=U):U=e[35],e[36]!==s?(D=s==="outline"&&c.jsx(ZF,{}),e[36]=s,e[37]=D):D=e[37],e[38]!==s?(k=s==="datasources"&&c.jsx(CF,{}),e[38]=s,e[39]=k):k=e[39],e[40]!==s?($=s==="documentation"&&c.jsx(NF,{}),e[40]=s,e[41]=$):$=e[41],e[42]!==s?(I=s==="snippets"&&c.jsx(wz,{}),e[42]=s,e[43]=I):I=e[43],e[44]!==s?(W=s==="scratchpad"&&c.jsx(dz,{}),e[44]=s,e[45]=W):W=e[45],e[46]!==s?(G=s==="chat"&&c.jsx(RR,{}),e[46]=s,e[47]=G):G=e[47],e[48]!==s?(q=s==="logs"&&c.jsx(A3,{}),e[48]=s,e[49]=q):q=e[49],e[50]!==s?(Y=s==="tracing"&&c.jsx(Nz,{}),e[50]=s,e[51]=Y):Y=e[51],e[52]!==s?(ee=s==="secrets"&&c.jsx(uz,{}),e[52]=s,e[53]=ee):ee=e[53],e[54]!==P||e[55]!==R||e[56]!==L||e[57]!==B||e[58]!==U||e[59]!==D||e[60]!==k||e[61]!==$||e[62]!==I||e[63]!==W||e[64]!==G||e[65]!==q||e[66]!==Y||e[67]!==ee?(oe=c.jsx(O.Suspense,{children:c.jsxs(Kc,{children:[P,R,L,B,U,D,k,$,I,W,G,q,Y,ee]})}),e[54]=P,e[55]=R,e[56]=L,e[57]=B,e[58]=U,e[59]=D,e[60]=k,e[61]=$,e[62]=I,e[63]=W,e[64]=G,e[65]=q,e[66]=Y,e[67]=ee,e[68]=oe):oe=e[68],e[69]!==M||e[70]!==oe?(ie=c.jsx(Ic,{children:c.jsxs("div",{className:"flex flex-col h-full flex-1 overflow-hidden mr-[-4px]",children:[M,oe]})}),e[69]=M,e[70]=oe,e[71]=ie):ie=e[71];const Z=ie,Q=o&&"border-r border-l border-[var(--slate-7)]";let me,fe,de,ue,ce,ke;e[72]!==Q?(me=Ne("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",Q),e[72]=Q,e[73]=me):me=e[73],e[74]===Symbol.for("react.memo_cache_sentinel")?(fe=(xe,Ve)=>{var Be;Ve===0&&xe===10&&((Be=l.current)==null||Be.resize(30))},e[74]=fe):fe=e[74],e[75]!==i?(de=()=>i(!1),ue=()=>i(!0),e[75]=i,e[76]=de,e[77]=ue):(de=e[76],ue=e[77]),e[78]!==Z||e[79]!==y?(ce=c.jsxs("span",{className:"flex flex-row h-full",children:[Z," ",y]}),e[78]=Z,e[79]=y,e[80]=ce):ce=e[80],e[81]!==me||e[82]!==de||e[83]!==ue||e[84]!==ce?(ke=c.jsx(ed,{ref:l,id:"helper",collapsedSize:0,collapsible:!0,className:me,minSize:10,defaultSize:0,maxSize:75,onResize:fe,onCollapse:de,onExpand:ue,children:ce},"helper"),e[81]=me,e[82]=de,e[83]=ue,e[84]=ce,e[85]=ke):ke=e[85];const Se=ke,ae=r&&"border-[var(--slate-7)]";let Ce,_e,Ee,ze,Oe,He,Fe,it,Qe;e[86]!==ae?(Ce=Ne("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",ae),e[86]=ae,e[87]=Ce):Ce=e[87],e[88]===Symbol.for("react.memo_cache_sentinel")?(_e=(xe,Ve)=>{var Be;Ve===0&&xe===10&&((Be=d.current)==null||Be.resize(30))},e[88]=_e):_e=e[88],e[89]!==a?(Ee=()=>a(!1),ze=()=>a(!0),e[89]=a,e[90]=Ee,e[91]=ze):(Ee=e[90],ze=e[91]),e[92]===Symbol.for("react.memo_cache_sentinel")?(Oe=c.jsx("div",{}),e[92]=Oe):Oe=e[92],e[93]!==a?(He=()=>a(!1),e[93]=a,e[94]=He):He=e[94],e[95]!==r||e[96]!==He?(Fe=c.jsx(O.Suspense,{fallback:Oe,children:c.jsx(Az,{visible:r,onClose:He})}),e[95]=r,e[96]=He,e[97]=Fe):Fe=e[97],e[98]!==r||e[99]!==Fe?(it=c.jsx(fF,{isOpen:r,children:Fe}),e[98]=r,e[99]=Fe,e[100]=it):it=e[100],e[101]!==Ce||e[102]!==Ee||e[103]!==ze||e[104]!==it||e[105]!==E?(Qe=c.jsxs(ed,{ref:d,id:"terminal",collapsedSize:0,collapsible:!0,className:Ce,minSize:10,defaultSize:0,maxSize:75,onResize:_e,onCollapse:Ee,onExpand:ze,children:[E,it]},"terminal"),e[101]=Ce,e[102]=Ee,e[103]=ze,e[104]=it,e[105]=E,e[106]=Qe):Qe=e[106];const tt=Qe;let ne,ve,je,Re,J,se,ge,pe;return e[107]===Symbol.for("react.memo_cache_sentinel")?(ne=PW(),e[107]=ne):ne=e[107],e[108]===Symbol.for("react.memo_cache_sentinel")?(ve=c.jsx(Kc,{children:c.jsx(g9,{})}),e[108]=ve):ve=e[108],e[109]!==tt?(je=c.jsx(ew,{capability:"terminal",children:tt}),e[109]=tt,e[110]=je):je=e[110],e[111]!==g||e[112]!==je?(Re=c.jsx(ed,{children:c.jsxs(YS,{autoSaveId:"marimo:chrome:v1:l1",direction:"vertical",children:[g,je]})}),e[111]=g,e[112]=je,e[113]=Re):Re=e[113],e[114]===Symbol.for("react.memo_cache_sentinel")?(J=c.jsx(WH,{}),e[114]=J):J=e[114],e[115]!==Se||e[116]!==Re?(se=c.jsxs(YS,{autoSaveId:"marimo:chrome:v1:l2",direction:"horizontal",storage:ne,children:[ve,Se,Re,J]}),e[115]=Se,e[116]=Re,e[117]=se):se=e[117],e[118]===Symbol.for("react.memo_cache_sentinel")?(ge=c.jsx(Ic,{children:c.jsx(Kc,{children:c.jsx(u9,{})})}),e[118]=ge):ge=e[118],e[119]!==se?(pe=c.jsxs(LW,{children:[se,ge]}),e[119]=se,e[120]=pe):pe=e[120],pe};function Mz(){window.dispatchEvent(new Event("resize"))}function Oz(){requestAnimationFrame(Mz)}function Dz(){window.dispatchEvent(new Event("resize"))}function Rz(){requestAnimationFrame(Dz)}let B3;B3=new URL(window.location.href).searchParams.get(qH.showChrome)==="false",hC=Object.freeze(Object.defineProperty({__proto__:null,default:t=>{const e=K.c(10);if(B3){let s,i,a;return e[0]!==t?(s=c.jsx(Qy,{hideControls:!0,...t}),e[0]=t,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(_g,{}),e[2]=i):i=e[2],e[3]!==s?(a=c.jsxs(c.Fragment,{children:[s,i]}),e[3]=s,e[4]=a):a=e[4],a}let n,o,r;return e[5]!==t?(n=c.jsx(Qy,{...t}),e[5]=t,e[6]=n):n=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(o=c.jsx(_g,{}),e[7]=o):o=e[7],e[8]!==n?(r=c.jsxs(Tz,{children:[n,o]}),e[8]=n,e[9]=r):r=e[9],r}},Symbol.toStringTag,{value:"Module"}))});export{yp as C,od as E,yn as P,UW as __tla,rd as a,hC as e,Sa as f};