@marimo-team/frontend 0.14.8-dev10 → 0.14.8-dev11

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 (89) hide show
  1. package/dist/assets/{ConnectedDataExplorerComponent-Dgb4evDM.js → ConnectedDataExplorerComponent-DAOAasPc.js} +1 -1
  2. package/dist/assets/{ImageComparisonComponent-CYLLP2Ek.js → ImageComparisonComponent-CJ4x7l6s.js} +1 -1
  3. package/dist/assets/{VegaLite-Byuc9HjF.js → VegaLite-BNxwGIA4.js} +1 -1
  4. package/dist/assets/{_baseEach-6MHNR_Pm.js → _baseEach-BAujYd__.js} +1 -1
  5. package/dist/assets/_baseMap-DKdm6mVj.js +1 -0
  6. package/dist/assets/{_baseUniq-Bsn6wvQA.js → _baseUniq-Cdvt8Z6y.js} +1 -1
  7. package/dist/assets/{_createAggregator-CLwaUrk2.js → _createAggregator-Bs-_blwP.js} +1 -1
  8. package/dist/assets/{any-language-editor-D1-wajW_.js → any-language-editor-BS39U8nj.js} +1 -1
  9. package/dist/assets/{architectureDiagram-IEHRJDOE-C0U1Eedd.js → architectureDiagram-IEHRJDOE-DuskhPR9.js} +1 -1
  10. package/dist/assets/{blockDiagram-JOT3LUYC-BrSo70tz.js → blockDiagram-JOT3LUYC-CttlE8VI.js} +1 -1
  11. package/dist/assets/{c4Diagram-VJAJSXHY-CD6JO-0Q.js → c4Diagram-VJAJSXHY-DgF_V3p_.js} +1 -1
  12. package/dist/assets/channel-C7LI1UkY.js +1 -0
  13. package/dist/assets/{chunk-4BMEZGHF-BVhacirt.js → chunk-4BMEZGHF-e5OmS8P0.js} +1 -1
  14. package/dist/assets/{chunk-A2AXSNBT-Bhagzotk.js → chunk-A2AXSNBT-Co-eallF.js} +1 -1
  15. package/dist/assets/{chunk-AEK57VVT-BUt4fWBU.js → chunk-AEK57VVT-BKInJ-BT.js} +1 -1
  16. package/dist/assets/{chunk-D6G4REZN-3A-1N-Bx.js → chunk-D6G4REZN-oSjYr7o4.js} +1 -1
  17. package/dist/assets/{chunk-RZ5BOZE2-BvGg5Ad5.js → chunk-RZ5BOZE2-JcOb43k6.js} +1 -1
  18. package/dist/assets/{chunk-XZIHB7SX-qFX3K-h3.js → chunk-XZIHB7SX-B4seOfw1.js} +1 -1
  19. package/dist/assets/{circle-play-C-FzGo4q.js → circle-play-B6y1m7EA.js} +1 -1
  20. package/dist/assets/classDiagram-GIVACNV2-DSvybOCU.js +1 -0
  21. package/dist/assets/classDiagram-v2-COTLJTTW-DSvybOCU.js +1 -0
  22. package/dist/assets/clone-DzPVm_mz.js +1 -0
  23. package/dist/assets/{compile-BkD0vkR5.js → compile-DfGIq8QQ.js} +1 -1
  24. package/dist/assets/{dagre-OKDRZEBW-Cizv3xrb.js → dagre-OKDRZEBW-CygSRRBb.js} +1 -1
  25. package/dist/assets/{data-editor-pNYnj_rT.js → data-editor-qA1yXu7P.js} +1 -1
  26. package/dist/assets/{diagram-SSKATNLV-BqqwfmYX.js → diagram-SSKATNLV-Cyhq-0PL.js} +1 -1
  27. package/dist/assets/{diagram-VNBRO52H-DuciCp2W.js → diagram-VNBRO52H-DhnrIvNu.js} +1 -1
  28. package/dist/assets/{edit-page-BLaffrTE.js → edit-page-D5lXdnoW.js} +4 -4
  29. package/dist/assets/{erDiagram-Q7BY3M3F-P6axxYAk.js → erDiagram-Q7BY3M3F-BXMPOTMB.js} +1 -1
  30. package/dist/assets/{flowDiagram-4HSFHLVR-Bnsq5u-0.js → flowDiagram-4HSFHLVR-CTrmGyQM.js} +1 -1
  31. package/dist/assets/{ganttDiagram-APWFNJXF-Ld8jhdTu.js → ganttDiagram-APWFNJXF-CICjyIJj.js} +1 -1
  32. package/dist/assets/{gitGraphDiagram-7IBYFJ6S-Cqs2EjRy.js → gitGraphDiagram-7IBYFJ6S-CJI7vnCn.js} +1 -1
  33. package/dist/assets/{graph-CIH2GQ51.js → graph-DksV8atB.js} +1 -1
  34. package/dist/assets/{home-page-CrCjPLno.js → home-page-Gh1NmX8L.js} +1 -1
  35. package/dist/assets/{index-CfektYKc.js → index-B1gOFJ1L.js} +1 -1
  36. package/dist/assets/{index-BzqZ_6cl.js → index-BCeOTe2J.js} +1 -1
  37. package/dist/assets/{index-BuPaMPZS.js → index-CAZiqVIb.js} +1 -1
  38. package/dist/assets/{index-uKHcJyiC.js → index-CC-KWEgM.js} +1 -1
  39. package/dist/assets/{index-BgVM0N6Q.js → index-CERRmQOA.js} +1 -1
  40. package/dist/assets/{index-BQaHnozn.js → index-CLovC4of.js} +1 -1
  41. package/dist/assets/{index-Bim2uhxc.js → index-CS9KB_8y.js} +1 -1
  42. package/dist/assets/{index-BIHhaFPx.js → index-CZi8wzDD.js} +1 -1
  43. package/dist/assets/{index-B725LHBp.js → index-ClcSAiSX.js} +1 -1
  44. package/dist/assets/{index-2juiKmzh.js → index-CyNQsjGm.js} +1 -1
  45. package/dist/assets/{index-7fo-bO1b.css → index-CyNqYU8O.css} +1 -1
  46. package/dist/assets/{index-QthAcefu.js → index-Cz1ljwAO.js} +1 -1
  47. package/dist/assets/{index-BgUxY5Si.js → index-DGURU9F8.js} +1 -1
  48. package/dist/assets/{index-xggWyI0a.js → index-DRWNLi-k.js} +1 -1
  49. package/dist/assets/{index-CX02FBw9.js → index-DcJSYvMO.js} +1 -1
  50. package/dist/assets/{index-DIOux9Rd.js → index-DffxjBLQ.js} +1 -1
  51. package/dist/assets/{index-DuRflRhD.js → index-DwjgiEyx.js} +1 -1
  52. package/dist/assets/{index-C9s7wpCG.js → index-Dy5su9i-.js} +1 -1
  53. package/dist/assets/{index-eTpeTAvV.js → index-EsQ5t29p.js} +1 -1
  54. package/dist/assets/{index-jgUiUrDR.js → index-JTQ5d09l.js} +12 -12
  55. package/dist/assets/{infoDiagram-PH2N3AL5-Du_lo9xe.js → infoDiagram-PH2N3AL5-BhVFnj6r.js} +1 -1
  56. package/dist/assets/{journeyDiagram-U35MCT3I-CwfdkzJ0.js → journeyDiagram-U35MCT3I-Bm41y7pa.js} +1 -1
  57. package/dist/assets/{kanban-definition-NDS4AKOZ-B_lx6PJd.js → kanban-definition-NDS4AKOZ-CZiYHN2D.js} +1 -1
  58. package/dist/assets/{layout-C5kPa4yS.js → layout-C_QIOduE.js} +1 -1
  59. package/dist/assets/{mermaid-B7Nz4kzp.js → mermaid-CNrjY7T1.js} +4 -4
  60. package/dist/assets/{min-M3nZZf4_.js → min-v5DlcV1z.js} +1 -1
  61. package/dist/assets/{mindmap-definition-ALO5MXBD-DjXnAr08.js → mindmap-definition-ALO5MXBD-BfNRFnHE.js} +1 -1
  62. package/dist/assets/{pieDiagram-IB7DONF6-DKAAam0A.js → pieDiagram-IB7DONF6-CO349i2b.js} +1 -1
  63. package/dist/assets/{quadrantDiagram-7GDLP6J5-C8jEDsmL.js → quadrantDiagram-7GDLP6J5-BIpueW5o.js} +1 -1
  64. package/dist/assets/{radar-MK3ICKWK-BQ7QRUVq.js → radar-MK3ICKWK-BWn7HGvD.js} +1 -1
  65. package/dist/assets/{react-plotly-Reh2raq7.js → react-plotly-DIWkASrI.js} +1 -1
  66. package/dist/assets/{requirementDiagram-KVF5MWMF-AEggFxKQ.js → requirementDiagram-KVF5MWMF-Dm40E2a1.js} +1 -1
  67. package/dist/assets/{run-page-CjDDCCGY.js → run-page-7-kV9YiW.js} +1 -1
  68. package/dist/assets/{sankeyDiagram-QLVOVGJD-gX20aHSj.js → sankeyDiagram-QLVOVGJD-DejQDL-a.js} +1 -1
  69. package/dist/assets/{sequenceDiagram-X6HHIX6F-B3rT7R0R.js → sequenceDiagram-X6HHIX6F-CDUSp8Mw.js} +1 -1
  70. package/dist/assets/{shutdown-button-Bj1uRucX.js → shutdown-button-Cur0MGs-.js} +1 -1
  71. package/dist/assets/{slides-component-S7_QnsnB.js → slides-component-B1CuwNzp.js} +1 -1
  72. package/dist/assets/{sortBy-EwO_LOkf.js → sortBy-DqhQZbXm.js} +1 -1
  73. package/dist/assets/{stateDiagram-DGXRK772-D6PN5xO7.js → stateDiagram-DGXRK772-BGGdA-w2.js} +1 -1
  74. package/dist/assets/stateDiagram-v2-YXO3MK2T-CHxbtmOd.js +1 -0
  75. package/dist/assets/{storage-mO56v_mR.js → storage-fxaFqup0.js} +3 -3
  76. package/dist/assets/{terminal-87tuZyuY.js → terminal-neRs7iG8.js} +1 -1
  77. package/dist/assets/{timeline-definition-BDJGKUSR-BoKGEjbf.js → timeline-definition-BDJGKUSR-CE7d_AW3.js} +1 -1
  78. package/dist/assets/{tracing-Bk2J7-fB.js → tracing-c8X_pryg.js} +2 -2
  79. package/dist/assets/{transform-DDoQUs93.js → transform-CzNIik03.js} +1 -1
  80. package/dist/assets/{vega-component-D35_Bdao.js → vega-component-I-w2H28-.js} +1 -1
  81. package/dist/assets/{xychartDiagram-VJFVF3MP-BOUSi4dh.js → xychartDiagram-VJFVF3MP-DYecGsC9.js} +1 -1
  82. package/dist/index.html +2 -2
  83. package/package.json +1 -1
  84. package/dist/assets/_baseMap-_1wf2RNm.js +0 -1
  85. package/dist/assets/channel-Bj1QAQF4.js +0 -1
  86. package/dist/assets/classDiagram-GIVACNV2-UVDFb9da.js +0 -1
  87. package/dist/assets/classDiagram-v2-COTLJTTW-UVDFb9da.js +0 -1
  88. package/dist/assets/clone-BlkjaVo9.js +0 -1
  89. package/dist/assets/stateDiagram-v2-YXO3MK2T-UBeNvudT.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./tracing-Bk2J7-fB.js","./index-jgUiUrDR.js","./index-7fo-bO1b.css","./compile-BkD0vkR5.js","./storage-mO56v_mR.js","./index-BuPaMPZS.js","./index-C9s7wpCG.js","./index-xggWyI0a.js","./index-Bim2uhxc.js","./index-DuRflRhD.js","./index-BIHhaFPx.js","./index-BgVM0N6Q.js","./index-QthAcefu.js","./index-DIOux9Rd.js","./index-BzqZ_6cl.js","./index-eTpeTAvV.js","./index-BQaHnozn.js","./index-CX02FBw9.js","./apl-CXdQSnD-.js","./asciiarmor-D5V0T9Cu.js","./asterisk-B46aRdXb.js","./brainfuck-CtZaYBKt.js","./clike-BgBwzOhw.js","./cmake-DXn5xaP-.js","./cobol-stawOqaz.js","./coffeescript-BTDxI-eT.js","./commonlisp-vq6DHwts.js","./crystal-CRzZ78HM.js","./cypher-gJDei3ni.js","./d-BShv7fp-.js","./diff-UJJ5BM9S.js","./dockerfile-knGOOxt4.js","./simple-mode-C3vEBAcb.js","./dtd-DI9Herc-.js","./dylan-DkEP81N9.js","./ebnf-B-Df8AvO.js","./ecl-DPFc0Uaf.js","./eiffel-DR5c0IrL.js","./elm-DompmV0j.js","./erlang-BuqgqA5h.js","./factor-CFXhaUWb.js","./fcl-CVaBTCzQ.js","./forth-POgR1ypr.js","./fortran-DL7KluxX.js","./gas-bV0CklSb.js","./gherkin-B6X1vGSW.js","./groovy-DnIzCrpZ.js","./haskell-CLQs6EAM.js","./haxe-D25e-2l-.js","./http-BKJkqRj4.js","./idl-pcmmZuaN.js","./jinja2-DhgKlfW7.js","./julia-DjdwvFuI.js","./livescript-HO6ttBFx.js","./lua-8DXOpKDz.js","./mathematica-IIbmv7SK.js","./mbox-z_N2Mo3d.js","./mirc-DkvFAiy5.js","./modelica-DSrSSXCg.js","./mscgen-B2igx18G.js","./mumps-zvxmGV4l.js","./nginx-B4hAVlXN.js","./nsis-BvKfQ9lQ.js","./ntriples-BSwWqoLa.js","./octave-C4hdQ5Hf.js","./oz-qQq7irPq.js","./pascal-CafrKXZF.js","./perl-tdMlh9QA.js","./pig-CwGJVRC4.js","./powershell-D1ly3AHC.js","./properties-_nPj978X.js","./protobuf-B4y9do6W.js","./puppet-Bc-yJKzi.js","./q-B0kTJ4cI.js","./r-BA4EbLKE.js","./ruby-CR-u2WLS.js","./sas-Bqaci40L.js","./scheme-qjP0V5Ag.js","./shell-BLav31RL.js","./sieve-r025o_jW.js","./smalltalk-C7J3IyEP.js","./solr-78MBEUkU.js","./sparql-BRLJFz69.js","./spreadsheet-CGlWr0eM.js","./stylus-Bdo_Aemu.js","./swift-B_XXVlXX.js","./tcl-B2fODqDH.js","./textile-BuVhTOzU.js","./tiddlywiki-BgR6AEZu.js","./tiki-CI-ztowC.js","./toml-wcPdHu67.js","./troff-Ce85hlLp.js","./ttcn-BxnYHtq8.js","./turtle-BkSuIpt-.js","./vb-BHgjm0DN.js","./vbscript-Dawdd5GZ.js","./velocity-BdD_26Jv.js","./verilog-B4LBqg_1.js","./vhdl-CWWH2SUo.js","./webidl-CGwyPRYs.js","./xquery-CVDBqZPY.js","./yacas-I8QjZlxf.js","./z80-D8p3gKXp.js","./storage-De8XnUVS.css","./shutdown-button-Bj1uRucX.js","./index-CfektYKc.js","./shutdown-button-C1rhMrxo.css","./circle-play-C-FzGo4q.js","./_createAggregator-CLwaUrk2.js","./_baseEach-6MHNR_Pm.js","./transform-DDoQUs93.js","./sortBy-EwO_LOkf.js","./_baseMap-_1wf2RNm.js","./terminal-87tuZyuY.js","./terminal-WqMRJt5Z.css"])))=>i.map(i=>d[i]);
2
- var nz=Object.defineProperty;var U3=Bt=>{throw TypeError(Bt)};var oz=(Bt,Et,gn)=>Et in Bt?nz(Bt,Et,{enumerable:!0,configurable:!0,writable:!0,value:gn}):Bt[Et]=gn;var Q=(Bt,Et,gn)=>oz(Bt,typeof Et!="symbol"?Et+"":Et,gn),rz=(Bt,Et,gn)=>Et.has(Bt)||U3("Cannot "+gn);var V3=(Bt,Et,gn)=>(rz(Bt,Et,"read from private field"),gn?gn.call(Bt):Et.get(Bt)),$3=(Bt,Et,gn)=>Et.has(Bt)?U3("Cannot add the same private member more than once"):Et instanceof WeakSet?Et.add(Bt):Et.set(Bt,gn);import{u as De,Y as A,g$ as sz,h0 as iz,h1 as H3,h2 as az,h3 as lz,h4 as cz,a as Y,h5 as dz,h6 as Rr,h7 as uz,h8 as um,h9 as W3,ha as hz,hb as fz,hc as q3,hd as cc,c as J,eR as mz,ax as lt,j as u,an as no,au as ar,at as Ls,av as Fs,bB as lr,a1 as Me,aw as xn,he as oa,as as cr,a$ as Hn,ay as ra,ab as Te,a7 as Qt,ec as hm,e$ as zs,hf as pz,aW as et,af as Ot,hg as gz,f5 as Wn,hh as G3,hi as Y3,hj as fm,hk as J3,hl as _z,L as Dt,dV as dc,b6 as dr,hm as uc,b8 as mm,aB as In,hn as bz,ae as pm,ho as yz,hp as K3,f4 as X3,a5 as en,bf as Z3,hq as Q3,cv as gm,hr as xz,e3 as dt,hs as e4,ea as _m,ht as wz,hu as hc,a4 as $e,bm as qn,hv as fc,hw as Bs,eW as Us,hx as vz,hy as sa,hz as kz,f2 as Sz,hA as t4,hB as n4,eF as Cz,hC as ur,hD as Pr,b4 as mc,hE as Nz,hF as pc,hG as o4,ac as Vs,et as r4,ad as ia,hH as jz,hI as bm,hJ as Lr,bD as Fr,$ as zo,eX as $s,fD as s4,gn as zr,fS as Ez,bp as an,hK as Iz,hL as Az,gl as ym,aY as gc,hM as xm,hN as Tz,hO as i4,hP as wm,hQ as Mz,hR as Oz,hS as go,hT as a4,gr as vm,hU as aa,hV as _c,eK as Ce,hW as Ge,hX as km,hY as St,hZ as l4,dP as bc,dL as yc,dM as xc,dN as wc,dK as la,h_ as Dz,fQ as Sm,be as An,aS as Gn,fG as c4,fI as d4,fJ as Rz,fO as Pz,fK as u4,a0 as Ie,eE as Lz,b2 as Hs,bc as Ws,b3 as qs,b9 as Gt,f3 as _o,h$ as Fz,fM as h4,i0 as zz,fE as f4,fF as m4,i1 as Br,dO as p4,i2 as g4,i3 as Bz,i4 as Uz,ar as Vz,aq as $z,i5 as Cm,dS as Hz,dU as Nm,fs as vc,i6 as kc,i7 as Sc,bG as Tn,i8 as Wz,e_ as ca,fp as mn,bu as _4,ed as Vt,i9 as qz,ez as Gz,ao as jm,ia as da,ib as Cc,ic as Yz,id as Jz,ie as b4,ig as pn,gq as y4,eG as Nc,bx as Kz,ih as Xz,aA as Em,b5 as Zz,ii as Qz,gM as Im,bt as jc,ij as Am,az as ua,eS as x4,ik as eB,ap as tB,il as w4,im as nB,io as oB,ip as rB,iq as sB,ir as iB,dQ as Bo,is as aB,it as Ec,iu as Gs,o as Uo,n as st,g5 as Mn,iv as On,iw as ut,ix as Ys,iy as Rt,gm as Yt,iz as Tm,eJ as oo,iA as lB,iB as cB,br as v4,bs as k4,iC as S4,iD as dB,gP as Js,iE as Ic,bo as Ac,gO as Ur,f6 as Mm,iF as uB,iG as hB,iH as fB,iI as mB,iJ as C4,iK as ha,iL as N4,iM as pB,iN as j4,iO as E4,iP as gB,iQ as I4,iR as A4,f7 as Tc,iS as _B,iT as T4,iU as fa,iV as ma,iW as Mc,iX as hr,iY as M4,iZ as Vo,i_ as Ks,i$ as Om,j0 as pa,j1 as Xs,j2 as Dm,j3 as Rm,j4 as O4,j5 as Oc,j6 as bB,Z as ga,j7 as _a,j8 as yB,e9 as Dc,j9 as xB,ja as Pm,jb as wB,jc as vB,jd as Rc,ei as kB,je as Lm,jf as Zs,jg as Pc,jh as Qs,g4 as Yn,gf as $o,g1 as D4,cb as R4,ji as Fm,fP as ba,jj as zm,jk as P4,jl as L4,jm as Bm,jn as ya,jo as xa,jp as wa,jq as SB,fZ as Lc,jr as Fc,js as zc,ey as CB,f_ as NB,jt as jB,ju as EB,jv as IB,jw as AB,r as TB,jx as MB,jy as OB,jz as DB,g8 as RB,jA as fr,jB as PB,jC as F4,t as P,jD as LB,jE as FB,jF as zB,jG as BB,jH as UB,jI as VB,jJ as $B,jK as HB,jL as WB,jM as qB,jN as GB,jO as YB,jP as JB,jQ as KB,jR as XB,jS as ZB,jT as QB,jU as eU,jV as tU,jW as nU,jX as oU,jY as rU,jZ as sU,j_ as iU,j$ as aU,k0 as lU,k1 as cU,k2 as z4,k3 as dU,k4 as uU,k5 as hU,k6 as Um,k7 as Bc,k8 as B4,k9 as fU,ka as mU,kb as U4,kc as pU,kd as ei,ke as Jn,kf as gU,kg as _U,kh as bU,ki as yU,kj as xU,kk as wU,kl as vU,km as kU,kn as SU,ko as CU,kp as mr,kq as NU,kr as jU,ks as EU,kt as IU,ef as AU,ku as TU,kv as V4,ej as MU,kw as Uc,kx as OU,ky as DU,kz as RU,kA as PU,a2 as pr,kB as Vc,kC as LU,kD as FU,kE as $4,kF as Vm,gN as ti,kG as zU,kH as BU,kI as UU,kJ as VU,gd as $U,bA as HU,a6 as $m,kK as H4,kL as WU,kM as qU,kN as Hm,kO as Wm,kP as GU,kQ as W4,kR as q4,kS as $c,g0 as YU,ai as G4,e1 as JU,kT as Y4,fB as jt,kU as va,kV as ni,kW as KU,kX as XU,kY as qm,kZ as ZU,ca as Gm,k_ as QU,bq as J4,k$ as eV,l0 as tV,l1 as Hc,l2 as K4,d$ as Ym,bC as X4,l3 as nV,l4 as oV,l5 as Z4,l6 as rV,l7 as sV,l8 as Q4,aj as Jm,l9 as iV,bE as eS,la as aV,eZ as lV,lb as Ho,eC as tS,lc as nS,f1 as oS,fT as Wc,ld as Km,le as rS,b1 as Xm,eD as qc,lf as sS,lg as cV,lh as dV,li as uV,lj as iS,lk as hV,ll as aS,lm as fV,gE as mV,fH as pV,fL as Zm,gH as gV,bz as Gc,ln as _V,lo as lS,lp as Qm,lq as bV,lr as yV,ls as xV,lt as wV,lu as cS,fu as ep,dX as dS,lv as vV,lw as kV,lx as SV,aX as CV,ly as NV,lz as jV,lA as EV,lB as IV,ag as AV,lC as Yc,ah as TV,lD as uS,fq as MV,lE as hS,ak as Kn,fX as OV,lF as DV,lG as RV,lH as fS,lI as PV,lJ as oi,lK as LV,lL as Jc,lM as FV,lN as zV,D as mS,lO as BV,du as UV,lP as ka,lQ as VV,lR as $V,lS as HV,lT as WV,C as pS,lU as qV,lV as GV,lW as YV,E as Vr,fc as JV,bn as KV,bl as XV,lX as ZV,lY as QV,dx as gS,lZ as e$,a9 as Kc,l_ as t$,aa as gr,d_ as _S,l$ as tp,m0 as n$,eb as bS,m1 as o$,m2 as yS,m3 as r$,m4 as xS,m5 as s$,m6 as i$,m7 as wS,m8 as vS,m9 as kS,fo as SS,ma as a$,mb as l$,mc as CS,md as NS,me as Xc,mf as jS,mg as c$,mh as ES,mi as d$,mj as u$,mk as IS,ml as h$,mm as f$,mn as m$,mo as p$,mp as g$,mq as _$,mr as b$,e8 as y$,ms as x$,mt as w$,ge as np,mu as v$,mv as k$,mw as S$,mx as C$,my as N$,mz as j$,mA as E$,mB as I$,mC as A$,mD as T$,mE as op,mF as M$,g3 as O$,mG as D$,mH as R$,mI as P$,mJ as AS,mK as L$,mL as F$,a8 as z$,eU as B$,gw as U$,mM as V$,mN as TS,mO as MS,gy as rp,gu as ri,gz as $r,gv as Hr,gA as sp,gB as ip,gx as OS,mP as $$,mQ as _r,mR as DS,gG as H$,mS as W$,mT as q$,mU as G$,mV as Y$,mW as J$,mX as K$,mY as RS,eL as X$,mZ as ap,aC as Zc,m_ as PS,m$ as LS,aE as FS,aD as Z$,e7 as Q$,__tla as eH}from"./index-jgUiUrDR.js";import{b as si,A as tH,L as zS,g as nH,G as oH,s as rH,k as sH,B as BS,a as iH,M as aH,Y as lH,c as wn,u as Sa,C as cH,S as dH,K as uH,d as hH,i as fH,e as US,f as mH,h as pH,j as Ca,P as lp,l as VS,m as gH,n as _H,o as bH,p as $S,q as cp,T as yH}from"./shutdown-button-Bj1uRucX.js";import{V as HS,d as ii,I as dp,N as WS,S as qS,e as GS,f as YS,L as JS,F as KS,g as XS,M as xH,l as ZS,h as wH,j as br,k as Qc,i as vH,E as QS,m as up,n as kH,o as hp,p as SH,q as CH,s as NH,t as jH,v as EH,w as IH,x as AH,y as TH,a as MH,C as OH,R as eC,A as DH,b as RH,T as PH,z as LH,B as FH,D as zH,G as BH,O as UH,c as VH,P as $H,__tla as HH}from"./storage-mO56v_mR.js";import{c as WH}from"./_createAggregator-CLwaUrk2.js";import{s as ro,i as yr,T as fp,a as mp}from"./transform-DDoQUs93.js";import{s as Na}from"./sortBy-EwO_LOkf.js";let pp,ed,vn,td,tC,ja,gp,qH=Promise.all([(()=>{try{return eH}catch{}})(),(()=>{try{return HH}catch{}})()]).then(async()=>{var ic,B3;var Bt=WH(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});let Et,gn,_p,nd,ai,Wr,bp,yp,xp,wp,Ea,od,vp,Ia,kp,rd,Sp,Cp,sd,Np,jp,Ep,Aa,Ip,id,Ap,Tp,Mp,Op,Dp,Rp,ad,Pp,ld,cd,Lp,Fp,zp,Bp,Up,Ta,Vp,$p,dd,Hp,Wp,qp,ud,Gp,Yp,Jp,Ma,hd,fd,Kp,Xp,Zp,Qp,eg,tg,ng,og,rg,md,pd,sg,ig,ag,Oa,xr,wr;Et=De("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),gn=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"}]]),_p=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"}]]),nd=De("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),ai=De("ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]),Wr=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"}]]),bp=De("chevrons-down",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),yp=De("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),td=De("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),xp=De("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),wp=De("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Ea=De("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),od=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"}]]),vp=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"}]]),Ia=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"}]]),kp=De("code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]),rd=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"}]]),Sp=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"}]]),Cp=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"}]]),sd=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"}]]),Np=De("eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]),jp=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"}]]),Ep=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"}]]),Aa=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"}]]),Ip=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"}]]),id=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"}]]),Ap=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"}]]),Tp=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"}]]),Mp=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"}]]),Op=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"}]]),Dp=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"}]]),Rp=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"}]]),ad=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"}]]),Pp=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"}]]),ld=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"}]]),cd=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"}]]),Lp=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"}]]),Fp=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"}]]),zp=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"}]]),Bp=De("message-circle-question",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),Up=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"}]]),Ta=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"}]]),Vp=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"}]]),$p=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"}]]),dd=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"}]]),Hp=De("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Wp=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"}]]),qp=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"}]]),ud=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"}]]),Gp=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"}]]),Yp=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"}]]),Jp=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"}]]),Ma=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"}]]),hd=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"}]]),fd=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"}]]),Kp=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"}]]),Xp=De("square-code",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),Zp=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"}]]),Qp=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"}]]),eg=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"}]]),tg=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"}]]),ng=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"}]]),og=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"}]]),rg=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"}]]),md=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"}]]),pd=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"}]]),sg=De("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]),ig=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"}]]),ag=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"}]]),Oa=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"}]]),xr=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"}]]),wr=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 nC=A.createContext({}),oC=A.forwardRef(function(t,e){[t,e]=lz(t,e,nC);let{toolbarProps:n}=function(s,i){const{"aria-label":a,"aria-labelledby":l,orientation:c="horizontal"}=s;let[d,h]=A.useState(!1);sz(()=>{var p;h(!(!i.current||!(!((p=i.current.parentElement)===null||p===void 0)&&p.closest('[role="toolbar"]'))))});const{direction:f}=iz(),m=f==="rtl"&&c==="horizontal";let _=az(i);const g=A.useRef(null);return{toolbarProps:{...H3(s,{labelable:!0}),role:d?"group":"toolbar","aria-orientation":c,"aria-label":a,"aria-labelledby":a==null?l:void 0,onKeyDownCapture:d?void 0:p=>{if(p.currentTarget.contains(p.target)){if(c==="horizontal"&&p.key==="ArrowRight"||c==="vertical"&&p.key==="ArrowDown")m?_.focusPrevious():_.focusNext();else{if(!(c==="horizontal"&&p.key==="ArrowLeft"||c==="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:d?void 0:p=>{var b,y;g.current&&!p.currentTarget.contains(p.relatedTarget)&&(!((b=i.current)===null||b===void 0)&&b.contains(p.target))&&((y=g.current)===null||y===void 0||y.focus(),g.current=null)},onBlurCapture:d?void 0:p=>{p.currentTarget.contains(p.relatedTarget)||g.current||(g.current=p.target)}}}}(t,e),o=cz({...t,values:{orientation:t.orientation||"horizontal"},defaultClassName:"react-aria-Toolbar"}),r=H3(t);return delete r.id,Y.createElement("div",{...dz(n,r),...o,ref:e,slot:t.slot||void 0,"data-orientation":t.orientation||"horizontal"},o.children)});function Da(t,e){const n=+Rr(t)-+Rr(e);return n<0?-1:n>0?1:n}function rC(t,e){const n=Rr(t,e==null?void 0:e.in);return+function(o,r){const s=Rr(o,r==null?void 0:r.in);return s.setHours(23,59,59,999),s}(n,e)==+function(o,r){const s=Rr(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 sC(t,e,n){const[o,r,s]=um(n==null?void 0:n.in,t,t,e),i=Da(r,s),a=Math.abs(function(d,h,f){const[m,_]=um(f==null?void 0:f.in,d,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=Da(r,s)===-i;rC(o)&&a===1&&Da(o,s)===1&&(l=!1);const c=i*(a-+l);return c===0?0:c}function iC(t,e,n){const o=function(r,s){return+Rr(r)-+Rr(s)}(t,e)/1e3;return(r=>{const s=(0,Math.trunc)(r);return s===0?0:s})(o)}function aC(t,e){return function(n,o,r){const s=hz(),i=(r==null?void 0:r.locale)??s.locale??fz,a=Da(n,o);if(isNaN(a))throw new RangeError("Invalid time value");const l=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:a}),[c,d]=um(r==null?void 0:r.in,...a>0?[o,n]:[n,o]),h=iC(d,c),f=(W3(d)-W3(c))/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<q3){const g=Math.round(m/60);return i.formatDistance("aboutXHours",g,l)}if(m<2520)return i.formatDistance("xDays",1,l);if(m<cc){const g=Math.round(m/q3);return i.formatDistance("xDays",g,l)}if(m<2*cc)return _=Math.round(m/cc),i.formatDistance("aboutXMonths",_,l);if(_=sC(d,c),_<12){const g=Math.round(m/cc);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 uz(n,Date.now())}(t),e)}const Ra="https://static.marimo.app",lC=t=>{const e=J.c(24),{onClose:n}=t,[o,r]=A.useState("");let s;s=Math.random().toString(36).slice(2,6);const i=`${o}-${s}`,a=`${Ra}/static/${i}`;let l,c,d,h,f,m,_,g,p,b,y;return e[0]!==n||e[1]!==i?(l=async x=>{x.preventDefault(),n();const v=await mz({download:!1,includeCode:!0,files:HS.INSTANCE.filenames()}),S=lt({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${Ra}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:v,path:i})}).catch(()=>{S.dismiss(),lt({title:"Error uploading static page",description:u.jsxs("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",u.jsx("a",{href:no.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),S.dismiss(),lt({title:"Static page uploaded!",description:u.jsxs("div",{children:["The URL has been copied to your clipboard.",u.jsx("br",{}),"You can share it with anyone."]})})},e[0]=n,e[1]=i,e[2]=l):l=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(ar,{children:"Share static notebook"}),e[3]=c):c=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsxs(Ls,{children:[c,u.jsxs(Fs,{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"," ",u.jsx("a",{href:Ra,target:"_blank",children:Ra}),"."]})]}),e[4]=d):d=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(h=x=>{const v=x.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,"");r(v)},e[5]=h):h=e[5],e[6]!==o?(f=u.jsx(lr,{"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=u.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:",u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(cC,{text:a}),u.jsx("span",{className:"text-primary",children:a})]})]}),e[8]=a,e[9]=m):m=e[9],e[10]!==f||e[11]!==m?(_=u.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=u.jsx(Me,{"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=u.jsx(Me,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await xn(a)},children:"Create"}),e[15]=a,e[16]=p):p=e[16],e[17]!==p||e[18]!==g?(b=u.jsxs(oa,{children:[g,p]}),e[17]=p,e[18]=g,e[19]=b):b=e[19],e[20]!==b||e[21]!==l||e[22]!==_?(y=u.jsx(cr,{className:"w-fit",children:u.jsxs("form",{onSubmit:l,children:[d,_,b]})}),e[20]=b,e[21]=l,e[22]=_,e[23]=y):y=e[23],y},cC=t=>{const e=J.c(8),[n,o]=Y.useState(!1);let r;e[0]!==t.text?(r=Hn.stopPropagation(async c=>{c.preventDefault(),await xn(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=u.jsx(ra,{size:14,strokeWidth:1.5}),e[2]=i):i=e[2],e[3]!==s?(a=u.jsx(Me,{"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=u.jsx(Te,{content:"Copied!",open:n,children:a}),e[5]=n,e[6]=a,e[7]=l):l=e[7],l};function lg(){const t=J.c(2),e=Qt(hm);let n;return t[0]!==e?(n=()=>{const o=document.getElementsByClassName("output-area"),r=window.innerHeight||document.documentElement.clientHeight;let s;s=null;for(const i of Array.from(o)){const a=i.getBoundingClientRect();if(a.top>=0&&a.top<=r||a.bottom>=0&&a.bottom<=r){s=zs.parse(i.parentNode.id);break}}e(i=>({mode:pz(i.mode),cellAnchor:s})),requestAnimationFrame(()=>{var i;s!==null&&((i=document.getElementById(zs.create(s)))==null||i.scrollIntoView())})},t[0]=e,t[1]=n):n=t[1],n}function gd(t){const e=J.c(3),n=_d();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],et(o)}function cg(){const t=J.c(2),e=_d();let n;return t[0]!==e?(n=()=>e(G3(Wn())),t[0]=e,t[1]=n):n=t[1],et(n)}function _d(){const t=J.c(2),{prepareForRun:e}=Ot();let n;return t[0]!==e?(n=async o=>{var a,l;if(o.length===0)return;const{cellHandles:r,cellData:s}=Wn(),i=[];for(const c of o){const d=r[c],h=(a=d==null?void 0:d.current)==null?void 0:a.editorView;let f;h?(Y3(h)!=="markdown"&&fm(h),f=J3(h)):f=((l=s[c])==null?void 0:l.code)||"",i.push(f),e({cellId:c})}await _z({cellIds:o,codes:i}).catch(dC)},t[0]=e,t[1]=n):n=t[1],et(n)}function dC(t){Dt.error(t)}const bd=[{type:"files",Icon:Ap,tooltip:"View files",position:"sidebar"},{type:"variables",Icon:dc,tooltip:"Explore variables",position:"sidebar"},{type:"datasources",Icon:dr,tooltip:"Explore data sources",position:"sidebar"},{type:"dependencies",Icon:Ta,tooltip:"Explore dependencies",position:"sidebar"},{type:"packages",Icon:si,tooltip:"Manage packages",position:"sidebar"},{type:"outline",Icon:fd,tooltip:"View outline",position:"sidebar"},{type:"chat",Icon:uc,tooltip:"Chat with AI",position:"sidebar"},{type:"documentation",Icon:md,tooltip:"View live docs",position:"sidebar"},{type:"logs",Icon:mm,tooltip:"Notebook logs",position:"sidebar"},{type:"tracing",Icon:tH,tooltip:"Tracing",position:"sidebar"},{type:"snippets",Icon:Zp,tooltip:"Snippets",position:"sidebar"},{type:"secrets",Icon:Rp,tooltip:"Secrets",hidden:In(),position:"sidebar"},{type:"scratchpad",Icon:bz,tooltip:"Scratchpad",position:"sidebar"},{type:"errors",Icon:pm,tooltip:"View errors",position:"footer"}];function uC(){const t=J.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=J.c(11);let c;l[0]!==a?(c=new yz(a),l[0]=a,l[1]=c):c=l[1];const d=c;let h;l[2]!==i||l[3]!==d?(h=()=>d.get(i),l[2]=i,l[3]=d,l[4]=h):h=l[4];const[f,m]=A.useState(h);let _;l[5]!==i||l[6]!==d?(_=b=>{m(b),d.set(i,b)},l[5]=i,l[6]=d,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 dg(t){return t.dropdown!==void 0}function Pa(t,e=""){return t.flatMap(n=>n.label?dg(n)?Pa(n.dropdown,`${e+n.label} > `):{...n,label:e+n.label}:[])}const li=t=>{const e=J.c(8),{children:n,layerTop:o}=t,r=o!==void 0&&o;let s;e[0]!==n?(s=Y.Children.toArray(n),e[0]=n,e[1]=s):s=e[1];const[i,a]=s,l=`second-icon absolute ${r?"top-[-2px] left-[-2px]":"bottom-[-2px] right-[-2px]"} rounded-full`;let c,d;return e[2]!==a||e[3]!==l?(c=u.jsx("div",{className:l,children:a}),e[2]=a,e[3]=l,e[4]=c):c=e[4],e[5]!==i||e[6]!==c?(d=u.jsxs("div",{className:"multi-icon relative w-fit",children:[i,c]}),e[5]=i,e[6]=c,e[7]=d):d=e[7],d},La=en(null),hC=en(!1),yd=Z3("marimo:ai:chatState:v2",{chats:[],activeChatId:null}),fC=en(t=>{const e=t(yd);return e.chats.find(n=>n.id===e.activeChatId)},(t,e,n)=>{e(yd,o=>({...o,activeChatId:n}))});function ug(t){return t!==Q3&&!!(t&&t.trim().length>0)}const xd=t=>{const e=J.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],gm(window,"keydown",n,o);const r=t.children??"Undo";let s,i;return e[3]===Symbol.for("react.memo_cache_sentinel")?(s=u.jsx(xz,{className:"ml-2",shortcut:"cmd-z"}),e[3]=s):s=e[3],e[4]!==r||e[5]!==t?(i=u.jsxs(Me,{"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 wd(){const t=J.c(3),{deleteCell:e,undoDeleteCell:n}=Ot();let o;return t[0]!==e||t[1]!==n?(o=r=>{var l;if(dt.get(e4))return;const{cellId:s}=r,i=dt.get(_m),a=(((l=i.cellData[s])==null?void 0:l.code)??"").trim()==="";if(e({cellId:s}),wz({cellId:s}).catch(()=>{n()}),!a){const{dismiss:c}=lt({title:"Cell deleted",description:"You can bring it back by clicking undo or through the command palette.",action:u.jsx(xd,{"data-testid":"undo-delete-button",onClick:()=>{n(),d()}})}),d=c}},t[0]=e,t[1]=n,t[2]=o):o=t[2],et(o)}function hg(){const t=J.c(3),{splitCell:e,undoSplitCell:n}=Ot();let o;return t[0]!==e||t[1]!==n?(o=r=>{const s=hc(r.cellId);if(!s)return;const i=J3(s);e(r);const{dismiss:a}=lt({title:"Cell split",action:u.jsx(xd,{"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],et(o)}function vd(t){const e=J.c(49),{cell:n}=t,{createNewCell:o,updateCellConfig:r,updateCellName:s,moveCell:i,sendToTop:a,sendToBottom:l,addColumnBreakpoint:c,clearCellOutput:d}=Ot(),h=hg(),f=gd(n==null?void 0:n.cellId),m=!$e(e4),_=wd(),{openModal:g}=qn(),p=Qt(La),b=$e(fc),y=$e(Bs),x=$e(Us),v=$e(vz);if(!n||x){let j;return e[0]===Symbol.for("react.memo_cache_sentinel")?(j=[],e[0]=j):j=e[0],j}const{cellId:S,config:k,getEditorView:E,name:N,hasOutput:I,hasConsoleOutput:T,status:M}=n;let R;e[1]!==S||e[2]!==k.disabled||e[3]!==r?(R=async()=>{const j={disabled:!k.disabled};await Lr({configs:{[S]:j}}),r({cellId:S,config:j})},e[1]=S,e[2]=k.disabled,e[3]=r,e[4]=R):R=e[4];const z=R;let D;e[5]!==S||e[6]!==k.hide_code||e[7]!==E||e[8]!==r?(D=async()=>{const j={hide_code:!k.hide_code};await Lr({configs:{[S]:j}}),r({cellId:S,config:j});const W=E();W&&(j.hide_code?W.contentDOM.blur():W.focus())},e[5]=S,e[6]=k.hide_code,e[7]=E,e[8]=r,e[9]=D):D=e[9];const F=D;let B,V,O,C,$;return e[10]===Symbol.for("react.memo_cache_sentinel")?(B=u.jsx(rg,{size:13,strokeWidth:1.5}),e[10]=B):B=e[10],e[11]!==S||e[12]!==N||e[13]!==g||e[14]!==s?(V=()=>{g(u.jsxs(cr,{children:[u.jsx(Ls,{children:u.jsx(ar,{children:"Rename cell"})}),u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx(Fr,{htmlFor:"cell-name",children:"Cell name"}),u.jsx(WS,{placeholder:"cell name",value:N,onKeyDown:j=>{j.key==="Enter"&&(j.preventDefault(),j.stopPropagation(),g(null))},onChange:j=>s({cellId:S,name:j})})]})]}))},e[11]=S,e[12]=N,e[13]=g,e[14]=s,e[15]=V):V=e[15],e[16]!==S||e[17]!==s?(O=j=>s({cellId:S,name:j}),e[16]=S,e[17]=s,e[18]=O):O=e[18],e[19]!==N||e[20]!==O?(C=u.jsx(WS,{placeholder:"cell name",value:N,onChange:O}),e[19]=N,e[20]=O,e[21]=C):C=e[21],e[22]!==c||e[23]!==b||e[24]!==v||e[25]!==y||e[26]!==m||e[27]!==S||e[28]!==d||e[29]!==k.disabled||e[30]!==k.hide_code||e[31]!==o||e[32]!==_||e[33]!==E||e[34]!==T||e[35]!==I||e[36]!==i||e[37]!==N||e[38]!==f||e[39]!==l||e[40]!==a||e[41]!==p||e[42]!==h||e[43]!==M||e[44]!==V||e[45]!==C||e[46]!==z||e[47]!==F?($=[[{icon:B,label:"Name",disableClick:!0,handle:_C,handleHeadless:V,rightElement:C},{icon:u.jsx(ii,{size:13,strokeWidth:1.5}),label:"Run cell",hotkey:"cell.run",hidden:M==="running"||M==="queued"||M==="disabled-transitively"||k.disabled,handle:()=>f()},{icon:u.jsx(sa,{size:13,strokeWidth:1.5}),label:"AI completion",hidden:!b,handle:()=>{p(j=>(j==null?void 0:j.cellId)===S?null:{cellId:S})},hotkey:"cell.aiCompletion"},{icon:u.jsx(hd,{size:13,strokeWidth:1.5}),label:"Split cell",hotkey:"cell.splitCell",handle:()=>h({cellId:S})},{icon:u.jsx(dp,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!I,handle:()=>function(j){const W=document.getElementById(K3.create(j));W&&(W.classList.add("printing-output"),X3(W,"result.png").finally(()=>{W.classList.remove("printing-output")}))}(S)},{icon:u.jsx(Sz,{size:13,strokeWidth:1.5}),label:"Format cell",hotkey:"cell.format",handle:()=>{const j=E();j&&kz({[S]:j})}},{icon:k.hide_code?u.jsx(t4,{size:13,strokeWidth:1.5}):u.jsx(n4,{size:13,strokeWidth:1.5}),label:k.hide_code?"Show code":"Hide code",handle:F,hotkey:"cell.hideCode"},{icon:k.disabled?u.jsx(xr,{size:13,strokeWidth:1.5}):u.jsx(wr,{size:13,strokeWidth:1.5}),label:"Reactive execution",rightElement:u.jsx(Cz,{"data-testid":"cell-disable-switch",checked:!k.disabled,size:"sm",onCheckedChange:z}),handle:z},{icon:u.jsx(pm,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(I||T),handle:()=>{d({cellId:S})}}],[{icon:u.jsx(mc,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:()=>{const j=E();j&&(ur(y,o),Pr(j,"markdown",{keepCodeAsIs:!1}))}},{icon:u.jsx(dr,{size:13,strokeWidth:1.5}),label:"Convert to SQL",handle:()=>{const j=E();j&&(ur(y,o),Pr(j,"sql",{keepCodeAsIs:!1}))}},{icon:u.jsx(pc,{}),label:"Toggle as Python",handle:()=>{const j=E();j&&(ur(y,o),Nz(j,"python",{force:!0}))}}],[{icon:u.jsxs(li,{children:[u.jsx(Ea,{size:13,strokeWidth:1.5}),u.jsx(o4,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>o({cellId:S,before:!0})},{icon:u.jsxs(li,{children:[u.jsx(Ea,{size:13,strokeWidth:1.5}),u.jsx(Vs,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>o({cellId:S,before:!1})},{icon:u.jsx(o4,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>i({cellId:S,before:!0})},{icon:u.jsx(Vs,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>i({cellId:S,before:!1})},{icon:u.jsx(r4,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>i({cellId:S,direction:"left"}),hidden:v!=="columns"},{icon:u.jsx(ia,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>i({cellId:S,direction:"right"}),hidden:v!=="columns"},{icon:u.jsx(yp,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>a({cellId:S})},{icon:u.jsx(bp,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>l({cellId:S})},{icon:u.jsx(jz,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",hidden:v!=="columns",handle:()=>c({cellId:S})}],[{icon:u.jsx(zS,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!ug(N),tooltip:ug(N)?void 0:"Only named cells can be linked to",handle:async()=>{await xn(function(j){const W=new URL(window.location.href);return W.hash=`scrollTo=${encodeURIComponent(j)}`,W.toString()}(N)),lt({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!m,variant:"danger",icon:u.jsx(bm,{size:13,strokeWidth:1.5}),handle:()=>{_({cellId:S})}}]].map(pC).filter(mC),e[22]=c,e[23]=b,e[24]=v,e[25]=y,e[26]=m,e[27]=S,e[28]=d,e[29]=k.disabled,e[30]=k.hide_code,e[31]=o,e[32]=_,e[33]=E,e[34]=T,e[35]=I,e[36]=i,e[37]=N,e[38]=f,e[39]=l,e[40]=a,e[41]=p,e[42]=h,e[43]=M,e[44]=V,e[45]=C,e[46]=z,e[47]=F,e[48]=$):$=e[48],$}function mC(t){return t.length>0}function pC(t){return t.filter(gC)}function gC(t){return!t.hidden}function _C(t){t==null||t.stopPropagation(),t==null||t.preventDefault()}function bC(t){return!t.hidden}const kd=en(!1),fg=()=>{const t=J.c(37),[e,n]=an(kd),o=Iz(),r=$e(Az),s=$e(ym);let i;t[0]!==r?(i={cell:r},t[0]=r,t[1]=i):i=t[1];let a=vd(i).flat();a=Pa(a);const l=function(){const O=J.c(57),{theme:C}=zo(),[$,j]=$s(),[W,K]=s4();let Z;O[0]!==j?(Z=async ce=>{await zr({config:ce}).then(()=>{j(ce)})},O[0]=j,O[1]=Z):Z=O[1];const q=Z;let ne;O[2]!==K?(ne=async ce=>{await Ez({config:ce}).then(()=>{K(ce)})},O[2]=K,O[3]=ne):ne=O[3];const re=ne;let ae;if(O[4]!==W||O[5]!==$||O[6]!==re||O[7]!==q||O[8]!==C){let ce,me,ue;O[10]!==W?(ce=ke=>ke!==W.width,O[10]=W,O[11]=ce):ce=O[11],O[12]!==W||O[13]!==re?(me=ke=>({label:`App config > Set width=${ke}`,handle:()=>{re({...W,width:ke})}}),O[12]=W,O[13]=re,O[14]=me):me=O[14],O[15]!==$||O[16]!==q||O[17]!==C?(ue={label:"Config > Toggle dark mode",handle:()=>{q({...$,display:{...$.display,theme:C==="dark"?"light":"dark"}})}},O[15]=$,O[16]=q,O[17]=C,O[18]=ue):ue=O[18];const pe=$.keymap.preset==="vim";let de,Ne;O[19]!==$||O[20]!==q?(de=()=>{q({...$,keymap:{...$.keymap,preset:"vim"}})},O[19]=$,O[20]=q,O[21]=de):de=O[21],O[22]!==pe||O[23]!==de?(Ne={label:"Config > Switch keymap to VIM",hidden:pe,handle:de},O[22]=pe,O[23]=de,O[24]=Ne):Ne=O[24];const je=$.keymap.preset==="default";let se,Ae,be;O[25]!==$||O[26]!==q?(se=()=>{q({...$,keymap:{...$.keymap,preset:"default"}})},O[25]=$,O[26]=q,O[27]=se):se=O[27],O[28]!==se||O[29]!==je?(Ae={label:"Config > Switch keymap to default (current: VIM)",hidden:je,handle:se},O[28]=se,O[29]=je,O[30]=Ae):Ae=O[30],O[31]!==$||O[32]!==q?(be=()=>{q({...$,completion:{...$.completion,copilot:!1}})},O[31]=$,O[32]=q,O[33]=be):be=O[33];const Re=$.completion.copilot!=="github";let ze,qe;O[34]!==be||O[35]!==Re?(ze={label:"Config > Disable GitHub Copilot",handle:be,hidden:Re},O[34]=be,O[35]=Re,O[36]=ze):ze=O[36],O[37]!==$||O[38]!==q?(qe=()=>{q({...$,completion:{...$.completion,copilot:"github"}})},O[37]=$,O[38]=q,O[39]=qe):qe=O[39];const Qe=$.completion.copilot==="github";let Pe;O[40]!==qe||O[41]!==Qe?(Pe={label:"Config > Enable GitHub Copilot",handle:qe,hidden:Qe},O[40]=qe,O[41]=Qe,O[42]=Pe):Pe=O[42];const tt=!$.display.reference_highlighting;let Je,nt,te,we;O[43]!==$||O[44]!==q?(Je=()=>{q({...$,display:{...$.display,reference_highlighting:!1}})},O[43]=$,O[44]=q,O[45]=Je):Je=O[45],O[46]!==tt||O[47]!==Je?(nt={label:"Config > Disable reference highlighting",hidden:tt,handle:Je},O[46]=tt,O[47]=Je,O[48]=nt):nt=O[48],O[49]!==$||O[50]!==q?(te=()=>{q({...$,display:{...$.display,reference_highlighting:!0}})},O[49]=$,O[50]=q,O[51]=te):te=O[51],O[52]!==$.display.reference_highlighting||O[53]!==te?(we={label:"Config > Enable reference highlighting",hidden:$.display.reference_highlighting,handle:te},O[52]=$.display.reference_highlighting,O[53]=te,O[54]=we):we=O[54],ae=[...nH().filter(ce).map(me),ue,Ne,Ae,ze,Pe,nt,we],O[4]=W,O[5]=$,O[6]=re,O[7]=q,O[8]=C,O[9]=ae}else ae=O[9];const X=ae;let ee;return O[55]!==X?(ee=X.filter(bC),O[55]=X,O[56]=ee):ee=O[56],ee}();let c=$g();c=[...Pa(c),...Pa(l)];const d=c.filter(yC),h=gc.keyBy(d,xC),{recentCommands:f,addRecentCommand:m}=uC();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=O=>{Oz(s.getHotkey("global.commandPalette").key)(O)&&(O.preventDefault(),n(wC))},t[4]=s,t[5]=n,t[6]=p):p=t[6],gm(document,"keydown",p),t[7]!==m||t[8]!==s||t[9]!==o||t[10]!==n?(b=(O,C)=>{const $=o[O];if(!$)return null;const j=s.getHotkey(O);return u.jsxs(go,{disabled:C.disabled,onSelect:()=>{m(O),n(!1),requestAnimationFrame(()=>{$()})},value:j.name,children:[u.jsxs("span",{children:[j.name,C.tooltip&&u.jsx("span",{className:"ml-2",children:C.tooltip})]}),u.jsx(a4,{children:u.jsx(vm,{shortcut:j.key})})]},O)},t[7]=m,t[8]=s,t[9]=o,t[10]=n,t[11]=b):b=t[11];const y=b;let x;t[12]!==m||t[13]!==s||t[14]!==n?(x=(O,C,$,j)=>{const W=$===void 0?{}:$;return u.jsxs(go,{disabled:W.disabled,onSelect:()=>{m(O),n(!1),requestAnimationFrame(()=>{C()})},value:O,children:[u.jsxs("span",{children:[O,W.tooltip&&u.jsxs("span",{className:"ml-2",children:["(",W.tooltip,")"]})]}),j&&u.jsx(a4,{children:u.jsx(vm,{shortcut:s.getHotkey(j).key})})]},O)},t[12]=m,t[13]=s,t[14]=n,t[15]=x):x=t[15];const v=x,S=Mz;let k;t[16]===Symbol.for("react.memo_cache_sentinel")?(k=u.jsx(aa,{placeholder:"Type to search..."}),t[16]=k):k=t[16];const E=wm;let N;t[17]===Symbol.for("react.memo_cache_sentinel")?(N=u.jsx(_c,{children:"No results found."}),t[17]=N):N=t[17];const I=f.length>0&&u.jsxs(u.Fragment,{children:[u.jsx(xm,{heading:"Recently Used",children:f.map(O=>{const C=h[O];return Tz(O)?y(O,{disabled:C==null?void 0:C.disabled,tooltip:C==null?void 0:C.tooltip}):C&&!dg(C)?v(C.label,C.handleHeadless||C.handle,{disabled:C.disabled,tooltip:C.tooltip}):null})}),u.jsx(i4,{})]}),T=xm,M=s.iterate().map(O=>{if(g.has(O))return null;const C=h[O];return y(O,{disabled:C==null?void 0:C.disabled,tooltip:C==null?void 0:C.tooltip})}),R=d.map(O=>g.has(O.label)?null:v(O.label,O.handleHeadless||O.handle,{disabled:O.disabled,tooltip:O.tooltip}));let z;t[18]!==g||t[19]!==v?(z=O=>g.has(O.label)?null:v(`Cell > ${O.label}`,O.handleHeadless||O.handle,{disabled:O.disabled,tooltip:O.tooltip}),t[18]=g,t[19]=v,t[20]=z):z=t[20];const D=a.map(z);let F,B,V;return t[21]!==T||t[22]!==R||t[23]!==D||t[24]!==M?(F=u.jsxs(T,{heading:"Commands",children:[M,R,D]}),t[21]=T,t[22]=R,t[23]=D,t[24]=M,t[25]=F):F=t[25],t[26]!==E||t[27]!==F||t[28]!==N||t[29]!==I?(B=u.jsxs(E,{children:[N,I,F]}),t[26]=E,t[27]=F,t[28]=N,t[29]=I,t[30]=B):B=t[30],t[31]!==S||t[32]!==e||t[33]!==n||t[34]!==B||t[35]!==k?(V=u.jsxs(S,{open:e,onOpenChange:n,children:[k,B]}),t[31]=S,t[32]=e,t[33]=n,t[34]=B,t[35]=k,t[36]=V):V=t[36],V};function yC(t){return!t.hotkey}function xC(t){return t.label}function wC(t){return!t}function vr(){return Ce.string().optional().describe(Ge.of({label:"Password",inputType:"password",placeholder:"password",optionRegex:".*password.*"}))}function mg(){return Ce.string().optional().describe(Ge.of({label:"Token",inputType:"password",placeholder:"token",optionRegex:".*token.*"}))}function Fa(){return Ce.string().optional().describe(Ge.of({label:"Warehouse Name",placeholder:"warehouse",optionRegex:".*warehouse.*"}))}function pg(){return Ce.string().optional().describe(Ge.of({label:"URI",optionRegex:".*uri.*"}))}function kr(){return Ce.string().nonempty().describe(Ge.of({label:"Host",placeholder:"localhost",optionRegex:".*host.*"}))}function bo(){return Ce.string().describe(Ge.of({label:"Database",placeholder:"db name",optionRegex:".*database.*"}))}function Sr(){return Ce.string().nonempty().describe(Ge.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function Cr(t){const e=Ce.coerce.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 gg(){return Ce.boolean().default(!1).describe(Ge.of({label:"Read Only"}))}const _g=Ce.object({type:Ce.literal("postgres"),host:kr(),port:Cr(5432).optional(),database:bo(),username:Sr(),password:vr(),ssl:Ce.boolean().default(!1).describe(Ge.of({label:"Use SSL"}))}).describe(Ge.of({direction:"two-columns"})),bg=Ce.object({type:Ce.literal("mysql"),host:kr(),port:Cr(3306),database:bo(),username:Sr(),password:vr(),ssl:Ce.boolean().default(!1).describe(Ge.of({label:"Use SSL"}))}).describe(Ge.of({direction:"two-columns"})),yg=Ce.object({type:Ce.literal("sqlite"),database:bo().describe(Ge.of({label:"Database Path"}))}).describe(Ge.of({direction:"two-columns"})),xg=Ce.object({type:Ce.literal("duckdb"),database:bo().describe(Ge.of({label:"Database Path"})),read_only:gg()}).describe(Ge.of({direction:"two-columns"})),wg=Ce.object({type:Ce.literal("motherduck"),database:bo().default("my_db").describe(Ge.of({label:"Database Name"})),token:mg()}).describe(Ge.of({direction:"two-columns"})),vg=Ce.object({type:Ce.literal("snowflake"),account:Ce.string().nonempty().describe(Ge.of({label:"Account",optionRegex:".*snowflake.*"})),warehouse:Ce.string().optional().describe(Ge.of({label:"Warehouse",optionRegex:".*snowflake.*"})),database:bo(),schema:Ce.string().optional().describe(Ge.of({label:"Schema",optionRegex:".*snowflake.*"})),username:Sr(),password:vr(),role:Ce.string().optional().describe(Ge.of({label:"Role"}))}).describe(Ge.of({direction:"two-columns"})),kg=Ce.object({type:Ce.literal("bigquery"),project:Ce.string().nonempty().describe(Ge.of({label:"Project ID",optionRegex:".*bigquery.*"})),dataset:Ce.string().nonempty().describe(Ge.of({label:"Dataset",optionRegex:".*bigquery.*"})),credentials_json:Ce.string().describe(Ge.of({label:"Credentials JSON",inputType:"textarea"}))}).describe(Ge.of({direction:"two-columns"})),Sg=Ce.object({type:Ce.literal("clickhouse_connect"),host:kr(),port:Cr(8123).optional(),username:Sr(),password:vr(),secure:Ce.boolean().default(!1).describe(Ge.of({label:"Use HTTPs"}))}).describe(Ge.of({direction:"two-columns"})),Cg=Ce.object({type:Ce.literal("timeplus"),host:kr().default("localhost"),port:Cr(8123).optional(),username:Sr().default("default"),password:vr().default("")}).describe(Ge.of({direction:"two-columns"})),Ng=Ce.object({type:Ce.literal("chdb"),database:bo().describe(Ge.of({label:"Database Path"})),read_only:gg()}).describe(Ge.of({direction:"two-columns"})),jg=Ce.object({type:Ce.literal("trino"),host:kr(),port:Cr(8080),database:bo(),schema:Ce.string().describe(Ge.of({label:"Schema",placeholder:"schema name",optionRegex:".*schema.*"})).optional(),username:Sr(),password:vr(),async_support:Ce.boolean().default(!1).describe(Ge.of({label:"Async Support"}))}).describe(Ge.of({direction:"two-columns"})),Eg=Ce.object({type:Ce.literal("iceberg"),name:Ce.string().describe(Ge.of({label:"Catalog Name"})),catalog:Ce.discriminatedUnion("type",[Ce.object({type:Ce.literal("REST"),warehouse:Fa(),uri:Ce.string().optional().describe(Ge.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:mg()}),Ce.object({type:Ce.literal("SQL"),warehouse:Fa(),uri:Ce.string().optional().describe(Ge.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),Ce.object({type:Ce.literal("Hive"),warehouse:Fa(),uri:pg()}),Ce.object({type:Ce.literal("Glue"),warehouse:Fa(),uri:pg()}),Ce.object({type:Ce.literal("DynamoDB"),"dynamodb.profile-name":Ce.string().optional().describe(Ge.of({label:"Profile Name"})),"dynamodb.region":Ce.string().optional().describe(Ge.of({label:"Region"})),"dynamodb.access-key-id":Ce.string().optional().describe(Ge.of({label:"Access Key ID"})),"dynamodb.secret-access-key":Ce.string().optional().describe(Ge.of({label:"Secret Access Key",inputType:"password"})),"dynamodb.session-token":Ce.string().optional().describe(Ge.of({label:"Session Token",inputType:"password"}))})]).default({type:"REST"}).describe(Ge.of({special:"tabs"}))}),Ig=Ce.object({type:Ce.literal("datafusion"),sessionContext:Ce.boolean().optional().describe(Ge.of({label:"Use Session Context"}))}),Ag=Ce.object({type:Ce.literal("pyspark"),host:kr().optional(),port:Cr().optional()}),Tg=Ce.object({type:Ce.literal("redshift"),host:kr(),port:Cr(5439),connectionType:Ce.discriminatedUnion("type",[Ce.object({type:Ce.literal("IAM credentials"),region:Ce.string().describe(Ge.of({label:"Region"})),aws_access_key_id:Ce.string().nonempty().describe(Ge.of({label:"AWS Access Key ID",inputType:"password",optionRegex:".*aws_access_key_id.*"})),aws_secret_access_key:Ce.string().nonempty().describe(Ge.of({label:"AWS Secret Access Key",inputType:"password",optionRegex:".*aws_secret_access_key.*"})),aws_session_token:Ce.string().optional().describe(Ge.of({label:"AWS Session Token",inputType:"password",optionRegex:".*aws_session_token.*"}))}),Ce.object({type:Ce.literal("DB credentials"),user:Sr(),password:vr()})]).default({type:"IAM credentials",aws_access_key_id:"",aws_secret_access_key:"",region:""}),database:bo()}).describe(Ge.of({direction:"two-columns"})),vC=Ce.discriminatedUnion("type",[_g,bg,yg,xg,wg,vg,kg,Sg,Cg,Ng,jg,Eg,Ig,Ag,Tg]),Sd="env:";function za(t){return typeof t=="string"&&t.startsWith(Sd)}function Cd(t){return`${Sd}${t}`}const Mg={sqlmodel:"SQLModel",sqlalchemy:"SQLAlchemy",duckdb:"DuckDB",clickhouse_connect:"ClickHouse Connect",chdb:"chDB",pyiceberg:"PyIceberg",ibis:"Ibis",motherduck:"MotherDuck",redshift:"Redshift"};class ln{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 kC{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),za(n)){const r=n.replace(Sd,""),s=o?`os.environ.get("${r}", "${o}")`:`os.environ.get("${r}")`;return this.secrets[e]=s,e}if(o!=null){const r=`os.environ.get("${n}", "${o}")`;return this.secrets[e]=r,e}return typeof n=="number"||typeof n=="number"?`${n}`:typeof n=="boolean"?qr(n):n?`"${n}"`:""}printInFString(e,n,o){if(n===void 0)return"";if(typeof n=="number")return`${n}`;if(typeof n=="boolean")return qr(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 za(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-c8X_pryg.js","./index-JTQ5d09l.js","./index-CyNqYU8O.css","./compile-DfGIq8QQ.js","./storage-fxaFqup0.js","./index-CAZiqVIb.js","./index-Dy5su9i-.js","./index-DRWNLi-k.js","./index-CS9KB_8y.js","./index-DwjgiEyx.js","./index-CZi8wzDD.js","./index-CERRmQOA.js","./index-Cz1ljwAO.js","./index-DffxjBLQ.js","./index-BCeOTe2J.js","./index-EsQ5t29p.js","./index-CLovC4of.js","./index-DcJSYvMO.js","./apl-CXdQSnD-.js","./asciiarmor-D5V0T9Cu.js","./asterisk-B46aRdXb.js","./brainfuck-CtZaYBKt.js","./clike-BgBwzOhw.js","./cmake-DXn5xaP-.js","./cobol-stawOqaz.js","./coffeescript-BTDxI-eT.js","./commonlisp-vq6DHwts.js","./crystal-CRzZ78HM.js","./cypher-gJDei3ni.js","./d-BShv7fp-.js","./diff-UJJ5BM9S.js","./dockerfile-knGOOxt4.js","./simple-mode-C3vEBAcb.js","./dtd-DI9Herc-.js","./dylan-DkEP81N9.js","./ebnf-B-Df8AvO.js","./ecl-DPFc0Uaf.js","./eiffel-DR5c0IrL.js","./elm-DompmV0j.js","./erlang-BuqgqA5h.js","./factor-CFXhaUWb.js","./fcl-CVaBTCzQ.js","./forth-POgR1ypr.js","./fortran-DL7KluxX.js","./gas-bV0CklSb.js","./gherkin-B6X1vGSW.js","./groovy-DnIzCrpZ.js","./haskell-CLQs6EAM.js","./haxe-D25e-2l-.js","./http-BKJkqRj4.js","./idl-pcmmZuaN.js","./jinja2-DhgKlfW7.js","./julia-DjdwvFuI.js","./livescript-HO6ttBFx.js","./lua-8DXOpKDz.js","./mathematica-IIbmv7SK.js","./mbox-z_N2Mo3d.js","./mirc-DkvFAiy5.js","./modelica-DSrSSXCg.js","./mscgen-B2igx18G.js","./mumps-zvxmGV4l.js","./nginx-B4hAVlXN.js","./nsis-BvKfQ9lQ.js","./ntriples-BSwWqoLa.js","./octave-C4hdQ5Hf.js","./oz-qQq7irPq.js","./pascal-CafrKXZF.js","./perl-tdMlh9QA.js","./pig-CwGJVRC4.js","./powershell-D1ly3AHC.js","./properties-_nPj978X.js","./protobuf-B4y9do6W.js","./puppet-Bc-yJKzi.js","./q-B0kTJ4cI.js","./r-BA4EbLKE.js","./ruby-CR-u2WLS.js","./sas-Bqaci40L.js","./scheme-qjP0V5Ag.js","./shell-BLav31RL.js","./sieve-r025o_jW.js","./smalltalk-C7J3IyEP.js","./solr-78MBEUkU.js","./sparql-BRLJFz69.js","./spreadsheet-CGlWr0eM.js","./stylus-Bdo_Aemu.js","./swift-B_XXVlXX.js","./tcl-B2fODqDH.js","./textile-BuVhTOzU.js","./tiddlywiki-BgR6AEZu.js","./tiki-CI-ztowC.js","./toml-wcPdHu67.js","./troff-Ce85hlLp.js","./ttcn-BxnYHtq8.js","./turtle-BkSuIpt-.js","./vb-BHgjm0DN.js","./vbscript-Dawdd5GZ.js","./velocity-BdD_26Jv.js","./verilog-B4LBqg_1.js","./vhdl-CWWH2SUo.js","./webidl-CGwyPRYs.js","./xquery-CVDBqZPY.js","./yacas-I8QjZlxf.js","./z80-D8p3gKXp.js","./storage-De8XnUVS.css","./shutdown-button-Cur0MGs-.js","./index-B1gOFJ1L.js","./shutdown-button-C1rhMrxo.css","./circle-play-B6y1m7EA.js","./_createAggregator-Bs-_blwP.js","./_baseEach-BAujYd__.js","./transform-CzNIik03.js","./sortBy-DqhQZbXm.js","./_baseMap-DKdm6mVj.js","./terminal-neRs7iG8.js","./terminal-WqMRJt5Z.css"])))=>i.map(i=>d[i]);
2
+ var nz=Object.defineProperty;var U3=Bt=>{throw TypeError(Bt)};var oz=(Bt,Et,gn)=>Et in Bt?nz(Bt,Et,{enumerable:!0,configurable:!0,writable:!0,value:gn}):Bt[Et]=gn;var Q=(Bt,Et,gn)=>oz(Bt,typeof Et!="symbol"?Et+"":Et,gn),rz=(Bt,Et,gn)=>Et.has(Bt)||U3("Cannot "+gn);var V3=(Bt,Et,gn)=>(rz(Bt,Et,"read from private field"),gn?gn.call(Bt):Et.get(Bt)),$3=(Bt,Et,gn)=>Et.has(Bt)?U3("Cannot add the same private member more than once"):Et instanceof WeakSet?Et.add(Bt):Et.set(Bt,gn);import{u as De,Y as A,g$ as sz,h0 as iz,h1 as H3,h2 as az,h3 as lz,h4 as cz,a as Y,h5 as dz,h6 as Rr,h7 as uz,h8 as um,h9 as W3,ha as hz,hb as fz,hc as q3,hd as cc,c as J,eR as mz,ax as lt,j as u,an as no,au as ar,at as Ls,av as Fs,bB as lr,a1 as Me,aw as xn,he as oa,as as cr,a$ as Hn,ay as ra,ab as Te,a7 as Qt,ec as hm,e$ as zs,hf as pz,aW as et,af as Ot,hg as gz,f5 as Wn,hh as G3,hi as Y3,hj as fm,hk as J3,hl as _z,L as Dt,dV as dc,b6 as dr,hm as uc,b8 as mm,aB as In,hn as bz,ae as pm,ho as yz,hp as K3,f4 as X3,a5 as en,bf as Z3,hq as Q3,cv as gm,hr as xz,e3 as dt,hs as e4,ea as _m,ht as wz,hu as hc,a4 as $e,bm as qn,hv as fc,hw as Bs,eW as Us,hx as vz,hy as sa,hz as kz,f2 as Sz,hA as t4,hB as n4,eF as Cz,hC as ur,hD as Pr,b4 as mc,hE as Nz,hF as pc,hG as o4,ac as Vs,et as r4,ad as ia,hH as jz,hI as bm,hJ as Lr,bD as Fr,$ as zo,eX as $s,fD as s4,gn as zr,fS as Ez,bp as an,hK as Iz,hL as Az,gl as ym,aY as gc,hM as xm,hN as Tz,hO as i4,hP as wm,hQ as Mz,hR as Oz,hS as go,hT as a4,gr as vm,hU as aa,hV as _c,eK as Ce,hW as Ge,hX as km,hY as St,hZ as l4,dP as bc,dL as yc,dM as xc,dN as wc,dK as la,h_ as Dz,fQ as Sm,be as An,aS as Gn,fG as c4,fI as d4,fJ as Rz,fO as Pz,fK as u4,a0 as Ie,eE as Lz,b2 as Hs,bc as Ws,b3 as qs,b9 as Gt,f3 as _o,h$ as Fz,fM as h4,i0 as zz,fE as f4,fF as m4,i1 as Br,dO as p4,i2 as g4,i3 as Bz,i4 as Uz,ar as Vz,aq as $z,i5 as Cm,dS as Hz,dU as Nm,fs as vc,i6 as kc,i7 as Sc,bG as Tn,i8 as Wz,e_ as ca,fp as mn,bu as _4,ed as Vt,i9 as qz,ez as Gz,ao as jm,ia as da,ib as Cc,ic as Yz,id as Jz,ie as b4,ig as pn,gq as y4,eG as Nc,bx as Kz,ih as Xz,aA as Em,b5 as Zz,ii as Qz,gM as Im,bt as jc,ij as Am,az as ua,eS as x4,ik as eB,ap as tB,il as w4,im as nB,io as oB,ip as rB,iq as sB,ir as iB,dQ as Bo,is as aB,it as Ec,iu as Gs,o as Uo,n as st,g5 as Mn,iv as On,iw as ut,ix as Ys,iy as Rt,gm as Yt,iz as Tm,eJ as oo,iA as lB,iB as cB,br as v4,bs as k4,iC as S4,iD as dB,gP as Js,iE as Ic,bo as Ac,gO as Ur,f6 as Mm,iF as uB,iG as hB,iH as fB,iI as mB,iJ as C4,iK as ha,iL as N4,iM as pB,iN as j4,iO as E4,iP as gB,iQ as I4,iR as A4,f7 as Tc,iS as _B,iT as T4,iU as fa,iV as ma,iW as Mc,iX as hr,iY as M4,iZ as Vo,i_ as Ks,i$ as Om,j0 as pa,j1 as Xs,j2 as Dm,j3 as Rm,j4 as O4,j5 as Oc,j6 as bB,Z as ga,j7 as _a,j8 as yB,e9 as Dc,j9 as xB,ja as Pm,jb as wB,jc as vB,jd as Rc,ei as kB,je as Lm,jf as Zs,jg as Pc,jh as Qs,g4 as Yn,gf as $o,g1 as D4,cb as R4,ji as Fm,fP as ba,jj as zm,jk as P4,jl as L4,jm as Bm,jn as ya,jo as xa,jp as wa,jq as SB,fZ as Lc,jr as Fc,js as zc,ey as CB,f_ as NB,jt as jB,ju as EB,jv as IB,jw as AB,r as TB,jx as MB,jy as OB,jz as DB,g8 as RB,jA as fr,jB as PB,jC as F4,t as P,jD as LB,jE as FB,jF as zB,jG as BB,jH as UB,jI as VB,jJ as $B,jK as HB,jL as WB,jM as qB,jN as GB,jO as YB,jP as JB,jQ as KB,jR as XB,jS as ZB,jT as QB,jU as eU,jV as tU,jW as nU,jX as oU,jY as rU,jZ as sU,j_ as iU,j$ as aU,k0 as lU,k1 as cU,k2 as z4,k3 as dU,k4 as uU,k5 as hU,k6 as Um,k7 as Bc,k8 as B4,k9 as fU,ka as mU,kb as U4,kc as pU,kd as ei,ke as Jn,kf as gU,kg as _U,kh as bU,ki as yU,kj as xU,kk as wU,kl as vU,km as kU,kn as SU,ko as CU,kp as mr,kq as NU,kr as jU,ks as EU,kt as IU,ef as AU,ku as TU,kv as V4,ej as MU,kw as Uc,kx as OU,ky as DU,kz as RU,kA as PU,a2 as pr,kB as Vc,kC as LU,kD as FU,kE as $4,kF as Vm,gN as ti,kG as zU,kH as BU,kI as UU,kJ as VU,gd as $U,bA as HU,a6 as $m,kK as H4,kL as WU,kM as qU,kN as Hm,kO as Wm,kP as GU,kQ as W4,kR as q4,kS as $c,g0 as YU,ai as G4,e1 as JU,kT as Y4,fB as jt,kU as va,kV as ni,kW as KU,kX as XU,kY as qm,kZ as ZU,ca as Gm,k_ as QU,bq as J4,k$ as eV,l0 as tV,l1 as Hc,l2 as K4,d$ as Ym,bC as X4,l3 as nV,l4 as oV,l5 as Z4,l6 as rV,l7 as sV,l8 as Q4,aj as Jm,l9 as iV,bE as eS,la as aV,eZ as lV,lb as Ho,eC as tS,lc as nS,f1 as oS,fT as Wc,ld as Km,le as rS,b1 as Xm,eD as qc,lf as sS,lg as cV,lh as dV,li as uV,lj as iS,lk as hV,ll as aS,lm as fV,gE as mV,fH as pV,fL as Zm,gH as gV,bz as Gc,ln as _V,lo as lS,lp as Qm,lq as bV,lr as yV,ls as xV,lt as wV,lu as cS,fu as ep,dX as dS,lv as vV,lw as kV,lx as SV,aX as CV,ly as NV,lz as jV,lA as EV,lB as IV,ag as AV,lC as Yc,ah as TV,lD as uS,fq as MV,lE as hS,ak as Kn,fX as OV,lF as DV,lG as RV,lH as fS,lI as PV,lJ as oi,lK as LV,lL as Jc,lM as FV,lN as zV,D as mS,lO as BV,du as UV,lP as ka,lQ as VV,lR as $V,lS as HV,lT as WV,C as pS,lU as qV,lV as GV,lW as YV,E as Vr,fc as JV,bn as KV,bl as XV,lX as ZV,lY as QV,dx as gS,lZ as e$,a9 as Kc,l_ as t$,aa as gr,d_ as _S,l$ as tp,m0 as n$,eb as bS,m1 as o$,m2 as yS,m3 as r$,m4 as xS,m5 as s$,m6 as i$,m7 as wS,m8 as vS,m9 as kS,fo as SS,ma as a$,mb as l$,mc as CS,md as NS,me as Xc,mf as jS,mg as c$,mh as ES,mi as d$,mj as u$,mk as IS,ml as h$,mm as f$,mn as m$,mo as p$,mp as g$,mq as _$,mr as b$,e8 as y$,ms as x$,mt as w$,ge as np,mu as v$,mv as k$,mw as S$,mx as C$,my as N$,mz as j$,mA as E$,mB as I$,mC as A$,mD as T$,mE as op,mF as M$,g3 as O$,mG as D$,mH as R$,mI as P$,mJ as AS,mK as L$,mL as F$,a8 as z$,eU as B$,gw as U$,mM as V$,mN as TS,mO as MS,gy as rp,gu as ri,gz as $r,gv as Hr,gA as sp,gB as ip,gx as OS,mP as $$,mQ as _r,mR as DS,gG as H$,mS as W$,mT as q$,mU as G$,mV as Y$,mW as J$,mX as K$,mY as RS,eL as X$,mZ as ap,aC as Zc,m_ as PS,m$ as LS,aE as FS,aD as Z$,e7 as Q$,__tla as eH}from"./index-JTQ5d09l.js";import{b as si,A as tH,L as zS,g as nH,G as oH,s as rH,k as sH,B as BS,a as iH,M as aH,Y as lH,c as wn,u as Sa,C as cH,S as dH,K as uH,d as hH,i as fH,e as US,f as mH,h as pH,j as Ca,P as lp,l as VS,m as gH,n as _H,o as bH,p as $S,q as cp,T as yH}from"./shutdown-button-Cur0MGs-.js";import{V as HS,d as ii,I as dp,N as WS,S as qS,e as GS,f as YS,L as JS,F as KS,g as XS,M as xH,l as ZS,h as wH,j as br,k as Qc,i as vH,E as QS,m as up,n as kH,o as hp,p as SH,q as CH,s as NH,t as jH,v as EH,w as IH,x as AH,y as TH,a as MH,C as OH,R as eC,A as DH,b as RH,T as PH,z as LH,B as FH,D as zH,G as BH,O as UH,c as VH,P as $H,__tla as HH}from"./storage-fxaFqup0.js";import{c as WH}from"./_createAggregator-Bs-_blwP.js";import{s as ro,i as yr,T as fp,a as mp}from"./transform-CzNIik03.js";import{s as Na}from"./sortBy-DqhQZbXm.js";let pp,ed,vn,td,tC,ja,gp,qH=Promise.all([(()=>{try{return eH}catch{}})(),(()=>{try{return HH}catch{}})()]).then(async()=>{var ic,B3;var Bt=WH(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});let Et,gn,_p,nd,ai,Wr,bp,yp,xp,wp,Ea,od,vp,Ia,kp,rd,Sp,Cp,sd,Np,jp,Ep,Aa,Ip,id,Ap,Tp,Mp,Op,Dp,Rp,ad,Pp,ld,cd,Lp,Fp,zp,Bp,Up,Ta,Vp,$p,dd,Hp,Wp,qp,ud,Gp,Yp,Jp,Ma,hd,fd,Kp,Xp,Zp,Qp,eg,tg,ng,og,rg,md,pd,sg,ig,ag,Oa,xr,wr;Et=De("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),gn=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"}]]),_p=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"}]]),nd=De("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),ai=De("ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]),Wr=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"}]]),bp=De("chevrons-down",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),yp=De("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),td=De("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),xp=De("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),wp=De("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Ea=De("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),od=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"}]]),vp=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"}]]),Ia=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"}]]),kp=De("code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]),rd=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"}]]),Sp=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"}]]),Cp=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"}]]),sd=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"}]]),Np=De("eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]),jp=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"}]]),Ep=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"}]]),Aa=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"}]]),Ip=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"}]]),id=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"}]]),Ap=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"}]]),Tp=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"}]]),Mp=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"}]]),Op=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"}]]),Dp=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"}]]),Rp=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"}]]),ad=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"}]]),Pp=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"}]]),ld=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"}]]),cd=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"}]]),Lp=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"}]]),Fp=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"}]]),zp=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"}]]),Bp=De("message-circle-question",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),Up=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"}]]),Ta=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"}]]),Vp=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"}]]),$p=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"}]]),dd=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"}]]),Hp=De("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Wp=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"}]]),qp=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"}]]),ud=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"}]]),Gp=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"}]]),Yp=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"}]]),Jp=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"}]]),Ma=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"}]]),hd=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"}]]),fd=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"}]]),Kp=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"}]]),Xp=De("square-code",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),Zp=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"}]]),Qp=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"}]]),eg=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"}]]),tg=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"}]]),ng=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"}]]),og=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"}]]),rg=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"}]]),md=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"}]]),pd=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"}]]),sg=De("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]),ig=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"}]]),ag=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"}]]),Oa=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"}]]),xr=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"}]]),wr=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 nC=A.createContext({}),oC=A.forwardRef(function(t,e){[t,e]=lz(t,e,nC);let{toolbarProps:n}=function(s,i){const{"aria-label":a,"aria-labelledby":l,orientation:c="horizontal"}=s;let[d,h]=A.useState(!1);sz(()=>{var p;h(!(!i.current||!(!((p=i.current.parentElement)===null||p===void 0)&&p.closest('[role="toolbar"]'))))});const{direction:f}=iz(),m=f==="rtl"&&c==="horizontal";let _=az(i);const g=A.useRef(null);return{toolbarProps:{...H3(s,{labelable:!0}),role:d?"group":"toolbar","aria-orientation":c,"aria-label":a,"aria-labelledby":a==null?l:void 0,onKeyDownCapture:d?void 0:p=>{if(p.currentTarget.contains(p.target)){if(c==="horizontal"&&p.key==="ArrowRight"||c==="vertical"&&p.key==="ArrowDown")m?_.focusPrevious():_.focusNext();else{if(!(c==="horizontal"&&p.key==="ArrowLeft"||c==="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:d?void 0:p=>{var b,y;g.current&&!p.currentTarget.contains(p.relatedTarget)&&(!((b=i.current)===null||b===void 0)&&b.contains(p.target))&&((y=g.current)===null||y===void 0||y.focus(),g.current=null)},onBlurCapture:d?void 0:p=>{p.currentTarget.contains(p.relatedTarget)||g.current||(g.current=p.target)}}}}(t,e),o=cz({...t,values:{orientation:t.orientation||"horizontal"},defaultClassName:"react-aria-Toolbar"}),r=H3(t);return delete r.id,Y.createElement("div",{...dz(n,r),...o,ref:e,slot:t.slot||void 0,"data-orientation":t.orientation||"horizontal"},o.children)});function Da(t,e){const n=+Rr(t)-+Rr(e);return n<0?-1:n>0?1:n}function rC(t,e){const n=Rr(t,e==null?void 0:e.in);return+function(o,r){const s=Rr(o,r==null?void 0:r.in);return s.setHours(23,59,59,999),s}(n,e)==+function(o,r){const s=Rr(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 sC(t,e,n){const[o,r,s]=um(n==null?void 0:n.in,t,t,e),i=Da(r,s),a=Math.abs(function(d,h,f){const[m,_]=um(f==null?void 0:f.in,d,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=Da(r,s)===-i;rC(o)&&a===1&&Da(o,s)===1&&(l=!1);const c=i*(a-+l);return c===0?0:c}function iC(t,e,n){const o=function(r,s){return+Rr(r)-+Rr(s)}(t,e)/1e3;return(r=>{const s=(0,Math.trunc)(r);return s===0?0:s})(o)}function aC(t,e){return function(n,o,r){const s=hz(),i=(r==null?void 0:r.locale)??s.locale??fz,a=Da(n,o);if(isNaN(a))throw new RangeError("Invalid time value");const l=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:a}),[c,d]=um(r==null?void 0:r.in,...a>0?[o,n]:[n,o]),h=iC(d,c),f=(W3(d)-W3(c))/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<q3){const g=Math.round(m/60);return i.formatDistance("aboutXHours",g,l)}if(m<2520)return i.formatDistance("xDays",1,l);if(m<cc){const g=Math.round(m/q3);return i.formatDistance("xDays",g,l)}if(m<2*cc)return _=Math.round(m/cc),i.formatDistance("aboutXMonths",_,l);if(_=sC(d,c),_<12){const g=Math.round(m/cc);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 uz(n,Date.now())}(t),e)}const Ra="https://static.marimo.app",lC=t=>{const e=J.c(24),{onClose:n}=t,[o,r]=A.useState("");let s;s=Math.random().toString(36).slice(2,6);const i=`${o}-${s}`,a=`${Ra}/static/${i}`;let l,c,d,h,f,m,_,g,p,b,y;return e[0]!==n||e[1]!==i?(l=async x=>{x.preventDefault(),n();const v=await mz({download:!1,includeCode:!0,files:HS.INSTANCE.filenames()}),S=lt({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${Ra}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:v,path:i})}).catch(()=>{S.dismiss(),lt({title:"Error uploading static page",description:u.jsxs("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",u.jsx("a",{href:no.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),S.dismiss(),lt({title:"Static page uploaded!",description:u.jsxs("div",{children:["The URL has been copied to your clipboard.",u.jsx("br",{}),"You can share it with anyone."]})})},e[0]=n,e[1]=i,e[2]=l):l=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(ar,{children:"Share static notebook"}),e[3]=c):c=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsxs(Ls,{children:[c,u.jsxs(Fs,{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"," ",u.jsx("a",{href:Ra,target:"_blank",children:Ra}),"."]})]}),e[4]=d):d=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(h=x=>{const v=x.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,"");r(v)},e[5]=h):h=e[5],e[6]!==o?(f=u.jsx(lr,{"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=u.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:",u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(cC,{text:a}),u.jsx("span",{className:"text-primary",children:a})]})]}),e[8]=a,e[9]=m):m=e[9],e[10]!==f||e[11]!==m?(_=u.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=u.jsx(Me,{"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=u.jsx(Me,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await xn(a)},children:"Create"}),e[15]=a,e[16]=p):p=e[16],e[17]!==p||e[18]!==g?(b=u.jsxs(oa,{children:[g,p]}),e[17]=p,e[18]=g,e[19]=b):b=e[19],e[20]!==b||e[21]!==l||e[22]!==_?(y=u.jsx(cr,{className:"w-fit",children:u.jsxs("form",{onSubmit:l,children:[d,_,b]})}),e[20]=b,e[21]=l,e[22]=_,e[23]=y):y=e[23],y},cC=t=>{const e=J.c(8),[n,o]=Y.useState(!1);let r;e[0]!==t.text?(r=Hn.stopPropagation(async c=>{c.preventDefault(),await xn(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=u.jsx(ra,{size:14,strokeWidth:1.5}),e[2]=i):i=e[2],e[3]!==s?(a=u.jsx(Me,{"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=u.jsx(Te,{content:"Copied!",open:n,children:a}),e[5]=n,e[6]=a,e[7]=l):l=e[7],l};function lg(){const t=J.c(2),e=Qt(hm);let n;return t[0]!==e?(n=()=>{const o=document.getElementsByClassName("output-area"),r=window.innerHeight||document.documentElement.clientHeight;let s;s=null;for(const i of Array.from(o)){const a=i.getBoundingClientRect();if(a.top>=0&&a.top<=r||a.bottom>=0&&a.bottom<=r){s=zs.parse(i.parentNode.id);break}}e(i=>({mode:pz(i.mode),cellAnchor:s})),requestAnimationFrame(()=>{var i;s!==null&&((i=document.getElementById(zs.create(s)))==null||i.scrollIntoView())})},t[0]=e,t[1]=n):n=t[1],n}function gd(t){const e=J.c(3),n=_d();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],et(o)}function cg(){const t=J.c(2),e=_d();let n;return t[0]!==e?(n=()=>e(G3(Wn())),t[0]=e,t[1]=n):n=t[1],et(n)}function _d(){const t=J.c(2),{prepareForRun:e}=Ot();let n;return t[0]!==e?(n=async o=>{var a,l;if(o.length===0)return;const{cellHandles:r,cellData:s}=Wn(),i=[];for(const c of o){const d=r[c],h=(a=d==null?void 0:d.current)==null?void 0:a.editorView;let f;h?(Y3(h)!=="markdown"&&fm(h),f=J3(h)):f=((l=s[c])==null?void 0:l.code)||"",i.push(f),e({cellId:c})}await _z({cellIds:o,codes:i}).catch(dC)},t[0]=e,t[1]=n):n=t[1],et(n)}function dC(t){Dt.error(t)}const bd=[{type:"files",Icon:Ap,tooltip:"View files",position:"sidebar"},{type:"variables",Icon:dc,tooltip:"Explore variables",position:"sidebar"},{type:"datasources",Icon:dr,tooltip:"Explore data sources",position:"sidebar"},{type:"dependencies",Icon:Ta,tooltip:"Explore dependencies",position:"sidebar"},{type:"packages",Icon:si,tooltip:"Manage packages",position:"sidebar"},{type:"outline",Icon:fd,tooltip:"View outline",position:"sidebar"},{type:"chat",Icon:uc,tooltip:"Chat with AI",position:"sidebar"},{type:"documentation",Icon:md,tooltip:"View live docs",position:"sidebar"},{type:"logs",Icon:mm,tooltip:"Notebook logs",position:"sidebar"},{type:"tracing",Icon:tH,tooltip:"Tracing",position:"sidebar"},{type:"snippets",Icon:Zp,tooltip:"Snippets",position:"sidebar"},{type:"secrets",Icon:Rp,tooltip:"Secrets",hidden:In(),position:"sidebar"},{type:"scratchpad",Icon:bz,tooltip:"Scratchpad",position:"sidebar"},{type:"errors",Icon:pm,tooltip:"View errors",position:"footer"}];function uC(){const t=J.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=J.c(11);let c;l[0]!==a?(c=new yz(a),l[0]=a,l[1]=c):c=l[1];const d=c;let h;l[2]!==i||l[3]!==d?(h=()=>d.get(i),l[2]=i,l[3]=d,l[4]=h):h=l[4];const[f,m]=A.useState(h);let _;l[5]!==i||l[6]!==d?(_=b=>{m(b),d.set(i,b)},l[5]=i,l[6]=d,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 dg(t){return t.dropdown!==void 0}function Pa(t,e=""){return t.flatMap(n=>n.label?dg(n)?Pa(n.dropdown,`${e+n.label} > `):{...n,label:e+n.label}:[])}const li=t=>{const e=J.c(8),{children:n,layerTop:o}=t,r=o!==void 0&&o;let s;e[0]!==n?(s=Y.Children.toArray(n),e[0]=n,e[1]=s):s=e[1];const[i,a]=s,l=`second-icon absolute ${r?"top-[-2px] left-[-2px]":"bottom-[-2px] right-[-2px]"} rounded-full`;let c,d;return e[2]!==a||e[3]!==l?(c=u.jsx("div",{className:l,children:a}),e[2]=a,e[3]=l,e[4]=c):c=e[4],e[5]!==i||e[6]!==c?(d=u.jsxs("div",{className:"multi-icon relative w-fit",children:[i,c]}),e[5]=i,e[6]=c,e[7]=d):d=e[7],d},La=en(null),hC=en(!1),yd=Z3("marimo:ai:chatState:v2",{chats:[],activeChatId:null}),fC=en(t=>{const e=t(yd);return e.chats.find(n=>n.id===e.activeChatId)},(t,e,n)=>{e(yd,o=>({...o,activeChatId:n}))});function ug(t){return t!==Q3&&!!(t&&t.trim().length>0)}const xd=t=>{const e=J.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],gm(window,"keydown",n,o);const r=t.children??"Undo";let s,i;return e[3]===Symbol.for("react.memo_cache_sentinel")?(s=u.jsx(xz,{className:"ml-2",shortcut:"cmd-z"}),e[3]=s):s=e[3],e[4]!==r||e[5]!==t?(i=u.jsxs(Me,{"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 wd(){const t=J.c(3),{deleteCell:e,undoDeleteCell:n}=Ot();let o;return t[0]!==e||t[1]!==n?(o=r=>{var l;if(dt.get(e4))return;const{cellId:s}=r,i=dt.get(_m),a=(((l=i.cellData[s])==null?void 0:l.code)??"").trim()==="";if(e({cellId:s}),wz({cellId:s}).catch(()=>{n()}),!a){const{dismiss:c}=lt({title:"Cell deleted",description:"You can bring it back by clicking undo or through the command palette.",action:u.jsx(xd,{"data-testid":"undo-delete-button",onClick:()=>{n(),d()}})}),d=c}},t[0]=e,t[1]=n,t[2]=o):o=t[2],et(o)}function hg(){const t=J.c(3),{splitCell:e,undoSplitCell:n}=Ot();let o;return t[0]!==e||t[1]!==n?(o=r=>{const s=hc(r.cellId);if(!s)return;const i=J3(s);e(r);const{dismiss:a}=lt({title:"Cell split",action:u.jsx(xd,{"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],et(o)}function vd(t){const e=J.c(49),{cell:n}=t,{createNewCell:o,updateCellConfig:r,updateCellName:s,moveCell:i,sendToTop:a,sendToBottom:l,addColumnBreakpoint:c,clearCellOutput:d}=Ot(),h=hg(),f=gd(n==null?void 0:n.cellId),m=!$e(e4),_=wd(),{openModal:g}=qn(),p=Qt(La),b=$e(fc),y=$e(Bs),x=$e(Us),v=$e(vz);if(!n||x){let j;return e[0]===Symbol.for("react.memo_cache_sentinel")?(j=[],e[0]=j):j=e[0],j}const{cellId:S,config:k,getEditorView:E,name:N,hasOutput:I,hasConsoleOutput:T,status:M}=n;let R;e[1]!==S||e[2]!==k.disabled||e[3]!==r?(R=async()=>{const j={disabled:!k.disabled};await Lr({configs:{[S]:j}}),r({cellId:S,config:j})},e[1]=S,e[2]=k.disabled,e[3]=r,e[4]=R):R=e[4];const z=R;let D;e[5]!==S||e[6]!==k.hide_code||e[7]!==E||e[8]!==r?(D=async()=>{const j={hide_code:!k.hide_code};await Lr({configs:{[S]:j}}),r({cellId:S,config:j});const W=E();W&&(j.hide_code?W.contentDOM.blur():W.focus())},e[5]=S,e[6]=k.hide_code,e[7]=E,e[8]=r,e[9]=D):D=e[9];const F=D;let B,V,O,C,$;return e[10]===Symbol.for("react.memo_cache_sentinel")?(B=u.jsx(rg,{size:13,strokeWidth:1.5}),e[10]=B):B=e[10],e[11]!==S||e[12]!==N||e[13]!==g||e[14]!==s?(V=()=>{g(u.jsxs(cr,{children:[u.jsx(Ls,{children:u.jsx(ar,{children:"Rename cell"})}),u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx(Fr,{htmlFor:"cell-name",children:"Cell name"}),u.jsx(WS,{placeholder:"cell name",value:N,onKeyDown:j=>{j.key==="Enter"&&(j.preventDefault(),j.stopPropagation(),g(null))},onChange:j=>s({cellId:S,name:j})})]})]}))},e[11]=S,e[12]=N,e[13]=g,e[14]=s,e[15]=V):V=e[15],e[16]!==S||e[17]!==s?(O=j=>s({cellId:S,name:j}),e[16]=S,e[17]=s,e[18]=O):O=e[18],e[19]!==N||e[20]!==O?(C=u.jsx(WS,{placeholder:"cell name",value:N,onChange:O}),e[19]=N,e[20]=O,e[21]=C):C=e[21],e[22]!==c||e[23]!==b||e[24]!==v||e[25]!==y||e[26]!==m||e[27]!==S||e[28]!==d||e[29]!==k.disabled||e[30]!==k.hide_code||e[31]!==o||e[32]!==_||e[33]!==E||e[34]!==T||e[35]!==I||e[36]!==i||e[37]!==N||e[38]!==f||e[39]!==l||e[40]!==a||e[41]!==p||e[42]!==h||e[43]!==M||e[44]!==V||e[45]!==C||e[46]!==z||e[47]!==F?($=[[{icon:B,label:"Name",disableClick:!0,handle:_C,handleHeadless:V,rightElement:C},{icon:u.jsx(ii,{size:13,strokeWidth:1.5}),label:"Run cell",hotkey:"cell.run",hidden:M==="running"||M==="queued"||M==="disabled-transitively"||k.disabled,handle:()=>f()},{icon:u.jsx(sa,{size:13,strokeWidth:1.5}),label:"AI completion",hidden:!b,handle:()=>{p(j=>(j==null?void 0:j.cellId)===S?null:{cellId:S})},hotkey:"cell.aiCompletion"},{icon:u.jsx(hd,{size:13,strokeWidth:1.5}),label:"Split cell",hotkey:"cell.splitCell",handle:()=>h({cellId:S})},{icon:u.jsx(dp,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!I,handle:()=>function(j){const W=document.getElementById(K3.create(j));W&&(W.classList.add("printing-output"),X3(W,"result.png").finally(()=>{W.classList.remove("printing-output")}))}(S)},{icon:u.jsx(Sz,{size:13,strokeWidth:1.5}),label:"Format cell",hotkey:"cell.format",handle:()=>{const j=E();j&&kz({[S]:j})}},{icon:k.hide_code?u.jsx(t4,{size:13,strokeWidth:1.5}):u.jsx(n4,{size:13,strokeWidth:1.5}),label:k.hide_code?"Show code":"Hide code",handle:F,hotkey:"cell.hideCode"},{icon:k.disabled?u.jsx(xr,{size:13,strokeWidth:1.5}):u.jsx(wr,{size:13,strokeWidth:1.5}),label:"Reactive execution",rightElement:u.jsx(Cz,{"data-testid":"cell-disable-switch",checked:!k.disabled,size:"sm",onCheckedChange:z}),handle:z},{icon:u.jsx(pm,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(I||T),handle:()=>{d({cellId:S})}}],[{icon:u.jsx(mc,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:()=>{const j=E();j&&(ur(y,o),Pr(j,"markdown",{keepCodeAsIs:!1}))}},{icon:u.jsx(dr,{size:13,strokeWidth:1.5}),label:"Convert to SQL",handle:()=>{const j=E();j&&(ur(y,o),Pr(j,"sql",{keepCodeAsIs:!1}))}},{icon:u.jsx(pc,{}),label:"Toggle as Python",handle:()=>{const j=E();j&&(ur(y,o),Nz(j,"python",{force:!0}))}}],[{icon:u.jsxs(li,{children:[u.jsx(Ea,{size:13,strokeWidth:1.5}),u.jsx(o4,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>o({cellId:S,before:!0})},{icon:u.jsxs(li,{children:[u.jsx(Ea,{size:13,strokeWidth:1.5}),u.jsx(Vs,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>o({cellId:S,before:!1})},{icon:u.jsx(o4,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>i({cellId:S,before:!0})},{icon:u.jsx(Vs,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>i({cellId:S,before:!1})},{icon:u.jsx(r4,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>i({cellId:S,direction:"left"}),hidden:v!=="columns"},{icon:u.jsx(ia,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>i({cellId:S,direction:"right"}),hidden:v!=="columns"},{icon:u.jsx(yp,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>a({cellId:S})},{icon:u.jsx(bp,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>l({cellId:S})},{icon:u.jsx(jz,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",hidden:v!=="columns",handle:()=>c({cellId:S})}],[{icon:u.jsx(zS,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!ug(N),tooltip:ug(N)?void 0:"Only named cells can be linked to",handle:async()=>{await xn(function(j){const W=new URL(window.location.href);return W.hash=`scrollTo=${encodeURIComponent(j)}`,W.toString()}(N)),lt({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!m,variant:"danger",icon:u.jsx(bm,{size:13,strokeWidth:1.5}),handle:()=>{_({cellId:S})}}]].map(pC).filter(mC),e[22]=c,e[23]=b,e[24]=v,e[25]=y,e[26]=m,e[27]=S,e[28]=d,e[29]=k.disabled,e[30]=k.hide_code,e[31]=o,e[32]=_,e[33]=E,e[34]=T,e[35]=I,e[36]=i,e[37]=N,e[38]=f,e[39]=l,e[40]=a,e[41]=p,e[42]=h,e[43]=M,e[44]=V,e[45]=C,e[46]=z,e[47]=F,e[48]=$):$=e[48],$}function mC(t){return t.length>0}function pC(t){return t.filter(gC)}function gC(t){return!t.hidden}function _C(t){t==null||t.stopPropagation(),t==null||t.preventDefault()}function bC(t){return!t.hidden}const kd=en(!1),fg=()=>{const t=J.c(37),[e,n]=an(kd),o=Iz(),r=$e(Az),s=$e(ym);let i;t[0]!==r?(i={cell:r},t[0]=r,t[1]=i):i=t[1];let a=vd(i).flat();a=Pa(a);const l=function(){const O=J.c(57),{theme:C}=zo(),[$,j]=$s(),[W,K]=s4();let Z;O[0]!==j?(Z=async ce=>{await zr({config:ce}).then(()=>{j(ce)})},O[0]=j,O[1]=Z):Z=O[1];const q=Z;let ne;O[2]!==K?(ne=async ce=>{await Ez({config:ce}).then(()=>{K(ce)})},O[2]=K,O[3]=ne):ne=O[3];const re=ne;let ae;if(O[4]!==W||O[5]!==$||O[6]!==re||O[7]!==q||O[8]!==C){let ce,me,ue;O[10]!==W?(ce=ke=>ke!==W.width,O[10]=W,O[11]=ce):ce=O[11],O[12]!==W||O[13]!==re?(me=ke=>({label:`App config > Set width=${ke}`,handle:()=>{re({...W,width:ke})}}),O[12]=W,O[13]=re,O[14]=me):me=O[14],O[15]!==$||O[16]!==q||O[17]!==C?(ue={label:"Config > Toggle dark mode",handle:()=>{q({...$,display:{...$.display,theme:C==="dark"?"light":"dark"}})}},O[15]=$,O[16]=q,O[17]=C,O[18]=ue):ue=O[18];const pe=$.keymap.preset==="vim";let de,Ne;O[19]!==$||O[20]!==q?(de=()=>{q({...$,keymap:{...$.keymap,preset:"vim"}})},O[19]=$,O[20]=q,O[21]=de):de=O[21],O[22]!==pe||O[23]!==de?(Ne={label:"Config > Switch keymap to VIM",hidden:pe,handle:de},O[22]=pe,O[23]=de,O[24]=Ne):Ne=O[24];const je=$.keymap.preset==="default";let se,Ae,be;O[25]!==$||O[26]!==q?(se=()=>{q({...$,keymap:{...$.keymap,preset:"default"}})},O[25]=$,O[26]=q,O[27]=se):se=O[27],O[28]!==se||O[29]!==je?(Ae={label:"Config > Switch keymap to default (current: VIM)",hidden:je,handle:se},O[28]=se,O[29]=je,O[30]=Ae):Ae=O[30],O[31]!==$||O[32]!==q?(be=()=>{q({...$,completion:{...$.completion,copilot:!1}})},O[31]=$,O[32]=q,O[33]=be):be=O[33];const Re=$.completion.copilot!=="github";let ze,qe;O[34]!==be||O[35]!==Re?(ze={label:"Config > Disable GitHub Copilot",handle:be,hidden:Re},O[34]=be,O[35]=Re,O[36]=ze):ze=O[36],O[37]!==$||O[38]!==q?(qe=()=>{q({...$,completion:{...$.completion,copilot:"github"}})},O[37]=$,O[38]=q,O[39]=qe):qe=O[39];const Qe=$.completion.copilot==="github";let Pe;O[40]!==qe||O[41]!==Qe?(Pe={label:"Config > Enable GitHub Copilot",handle:qe,hidden:Qe},O[40]=qe,O[41]=Qe,O[42]=Pe):Pe=O[42];const tt=!$.display.reference_highlighting;let Je,nt,te,we;O[43]!==$||O[44]!==q?(Je=()=>{q({...$,display:{...$.display,reference_highlighting:!1}})},O[43]=$,O[44]=q,O[45]=Je):Je=O[45],O[46]!==tt||O[47]!==Je?(nt={label:"Config > Disable reference highlighting",hidden:tt,handle:Je},O[46]=tt,O[47]=Je,O[48]=nt):nt=O[48],O[49]!==$||O[50]!==q?(te=()=>{q({...$,display:{...$.display,reference_highlighting:!0}})},O[49]=$,O[50]=q,O[51]=te):te=O[51],O[52]!==$.display.reference_highlighting||O[53]!==te?(we={label:"Config > Enable reference highlighting",hidden:$.display.reference_highlighting,handle:te},O[52]=$.display.reference_highlighting,O[53]=te,O[54]=we):we=O[54],ae=[...nH().filter(ce).map(me),ue,Ne,Ae,ze,Pe,nt,we],O[4]=W,O[5]=$,O[6]=re,O[7]=q,O[8]=C,O[9]=ae}else ae=O[9];const X=ae;let ee;return O[55]!==X?(ee=X.filter(bC),O[55]=X,O[56]=ee):ee=O[56],ee}();let c=$g();c=[...Pa(c),...Pa(l)];const d=c.filter(yC),h=gc.keyBy(d,xC),{recentCommands:f,addRecentCommand:m}=uC();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=O=>{Oz(s.getHotkey("global.commandPalette").key)(O)&&(O.preventDefault(),n(wC))},t[4]=s,t[5]=n,t[6]=p):p=t[6],gm(document,"keydown",p),t[7]!==m||t[8]!==s||t[9]!==o||t[10]!==n?(b=(O,C)=>{const $=o[O];if(!$)return null;const j=s.getHotkey(O);return u.jsxs(go,{disabled:C.disabled,onSelect:()=>{m(O),n(!1),requestAnimationFrame(()=>{$()})},value:j.name,children:[u.jsxs("span",{children:[j.name,C.tooltip&&u.jsx("span",{className:"ml-2",children:C.tooltip})]}),u.jsx(a4,{children:u.jsx(vm,{shortcut:j.key})})]},O)},t[7]=m,t[8]=s,t[9]=o,t[10]=n,t[11]=b):b=t[11];const y=b;let x;t[12]!==m||t[13]!==s||t[14]!==n?(x=(O,C,$,j)=>{const W=$===void 0?{}:$;return u.jsxs(go,{disabled:W.disabled,onSelect:()=>{m(O),n(!1),requestAnimationFrame(()=>{C()})},value:O,children:[u.jsxs("span",{children:[O,W.tooltip&&u.jsxs("span",{className:"ml-2",children:["(",W.tooltip,")"]})]}),j&&u.jsx(a4,{children:u.jsx(vm,{shortcut:s.getHotkey(j).key})})]},O)},t[12]=m,t[13]=s,t[14]=n,t[15]=x):x=t[15];const v=x,S=Mz;let k;t[16]===Symbol.for("react.memo_cache_sentinel")?(k=u.jsx(aa,{placeholder:"Type to search..."}),t[16]=k):k=t[16];const E=wm;let N;t[17]===Symbol.for("react.memo_cache_sentinel")?(N=u.jsx(_c,{children:"No results found."}),t[17]=N):N=t[17];const I=f.length>0&&u.jsxs(u.Fragment,{children:[u.jsx(xm,{heading:"Recently Used",children:f.map(O=>{const C=h[O];return Tz(O)?y(O,{disabled:C==null?void 0:C.disabled,tooltip:C==null?void 0:C.tooltip}):C&&!dg(C)?v(C.label,C.handleHeadless||C.handle,{disabled:C.disabled,tooltip:C.tooltip}):null})}),u.jsx(i4,{})]}),T=xm,M=s.iterate().map(O=>{if(g.has(O))return null;const C=h[O];return y(O,{disabled:C==null?void 0:C.disabled,tooltip:C==null?void 0:C.tooltip})}),R=d.map(O=>g.has(O.label)?null:v(O.label,O.handleHeadless||O.handle,{disabled:O.disabled,tooltip:O.tooltip}));let z;t[18]!==g||t[19]!==v?(z=O=>g.has(O.label)?null:v(`Cell > ${O.label}`,O.handleHeadless||O.handle,{disabled:O.disabled,tooltip:O.tooltip}),t[18]=g,t[19]=v,t[20]=z):z=t[20];const D=a.map(z);let F,B,V;return t[21]!==T||t[22]!==R||t[23]!==D||t[24]!==M?(F=u.jsxs(T,{heading:"Commands",children:[M,R,D]}),t[21]=T,t[22]=R,t[23]=D,t[24]=M,t[25]=F):F=t[25],t[26]!==E||t[27]!==F||t[28]!==N||t[29]!==I?(B=u.jsxs(E,{children:[N,I,F]}),t[26]=E,t[27]=F,t[28]=N,t[29]=I,t[30]=B):B=t[30],t[31]!==S||t[32]!==e||t[33]!==n||t[34]!==B||t[35]!==k?(V=u.jsxs(S,{open:e,onOpenChange:n,children:[k,B]}),t[31]=S,t[32]=e,t[33]=n,t[34]=B,t[35]=k,t[36]=V):V=t[36],V};function yC(t){return!t.hotkey}function xC(t){return t.label}function wC(t){return!t}function vr(){return Ce.string().optional().describe(Ge.of({label:"Password",inputType:"password",placeholder:"password",optionRegex:".*password.*"}))}function mg(){return Ce.string().optional().describe(Ge.of({label:"Token",inputType:"password",placeholder:"token",optionRegex:".*token.*"}))}function Fa(){return Ce.string().optional().describe(Ge.of({label:"Warehouse Name",placeholder:"warehouse",optionRegex:".*warehouse.*"}))}function pg(){return Ce.string().optional().describe(Ge.of({label:"URI",optionRegex:".*uri.*"}))}function kr(){return Ce.string().nonempty().describe(Ge.of({label:"Host",placeholder:"localhost",optionRegex:".*host.*"}))}function bo(){return Ce.string().describe(Ge.of({label:"Database",placeholder:"db name",optionRegex:".*database.*"}))}function Sr(){return Ce.string().nonempty().describe(Ge.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function Cr(t){const e=Ce.coerce.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 gg(){return Ce.boolean().default(!1).describe(Ge.of({label:"Read Only"}))}const _g=Ce.object({type:Ce.literal("postgres"),host:kr(),port:Cr(5432).optional(),database:bo(),username:Sr(),password:vr(),ssl:Ce.boolean().default(!1).describe(Ge.of({label:"Use SSL"}))}).describe(Ge.of({direction:"two-columns"})),bg=Ce.object({type:Ce.literal("mysql"),host:kr(),port:Cr(3306),database:bo(),username:Sr(),password:vr(),ssl:Ce.boolean().default(!1).describe(Ge.of({label:"Use SSL"}))}).describe(Ge.of({direction:"two-columns"})),yg=Ce.object({type:Ce.literal("sqlite"),database:bo().describe(Ge.of({label:"Database Path"}))}).describe(Ge.of({direction:"two-columns"})),xg=Ce.object({type:Ce.literal("duckdb"),database:bo().describe(Ge.of({label:"Database Path"})),read_only:gg()}).describe(Ge.of({direction:"two-columns"})),wg=Ce.object({type:Ce.literal("motherduck"),database:bo().default("my_db").describe(Ge.of({label:"Database Name"})),token:mg()}).describe(Ge.of({direction:"two-columns"})),vg=Ce.object({type:Ce.literal("snowflake"),account:Ce.string().nonempty().describe(Ge.of({label:"Account",optionRegex:".*snowflake.*"})),warehouse:Ce.string().optional().describe(Ge.of({label:"Warehouse",optionRegex:".*snowflake.*"})),database:bo(),schema:Ce.string().optional().describe(Ge.of({label:"Schema",optionRegex:".*snowflake.*"})),username:Sr(),password:vr(),role:Ce.string().optional().describe(Ge.of({label:"Role"}))}).describe(Ge.of({direction:"two-columns"})),kg=Ce.object({type:Ce.literal("bigquery"),project:Ce.string().nonempty().describe(Ge.of({label:"Project ID",optionRegex:".*bigquery.*"})),dataset:Ce.string().nonempty().describe(Ge.of({label:"Dataset",optionRegex:".*bigquery.*"})),credentials_json:Ce.string().describe(Ge.of({label:"Credentials JSON",inputType:"textarea"}))}).describe(Ge.of({direction:"two-columns"})),Sg=Ce.object({type:Ce.literal("clickhouse_connect"),host:kr(),port:Cr(8123).optional(),username:Sr(),password:vr(),secure:Ce.boolean().default(!1).describe(Ge.of({label:"Use HTTPs"}))}).describe(Ge.of({direction:"two-columns"})),Cg=Ce.object({type:Ce.literal("timeplus"),host:kr().default("localhost"),port:Cr(8123).optional(),username:Sr().default("default"),password:vr().default("")}).describe(Ge.of({direction:"two-columns"})),Ng=Ce.object({type:Ce.literal("chdb"),database:bo().describe(Ge.of({label:"Database Path"})),read_only:gg()}).describe(Ge.of({direction:"two-columns"})),jg=Ce.object({type:Ce.literal("trino"),host:kr(),port:Cr(8080),database:bo(),schema:Ce.string().describe(Ge.of({label:"Schema",placeholder:"schema name",optionRegex:".*schema.*"})).optional(),username:Sr(),password:vr(),async_support:Ce.boolean().default(!1).describe(Ge.of({label:"Async Support"}))}).describe(Ge.of({direction:"two-columns"})),Eg=Ce.object({type:Ce.literal("iceberg"),name:Ce.string().describe(Ge.of({label:"Catalog Name"})),catalog:Ce.discriminatedUnion("type",[Ce.object({type:Ce.literal("REST"),warehouse:Fa(),uri:Ce.string().optional().describe(Ge.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:mg()}),Ce.object({type:Ce.literal("SQL"),warehouse:Fa(),uri:Ce.string().optional().describe(Ge.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),Ce.object({type:Ce.literal("Hive"),warehouse:Fa(),uri:pg()}),Ce.object({type:Ce.literal("Glue"),warehouse:Fa(),uri:pg()}),Ce.object({type:Ce.literal("DynamoDB"),"dynamodb.profile-name":Ce.string().optional().describe(Ge.of({label:"Profile Name"})),"dynamodb.region":Ce.string().optional().describe(Ge.of({label:"Region"})),"dynamodb.access-key-id":Ce.string().optional().describe(Ge.of({label:"Access Key ID"})),"dynamodb.secret-access-key":Ce.string().optional().describe(Ge.of({label:"Secret Access Key",inputType:"password"})),"dynamodb.session-token":Ce.string().optional().describe(Ge.of({label:"Session Token",inputType:"password"}))})]).default({type:"REST"}).describe(Ge.of({special:"tabs"}))}),Ig=Ce.object({type:Ce.literal("datafusion"),sessionContext:Ce.boolean().optional().describe(Ge.of({label:"Use Session Context"}))}),Ag=Ce.object({type:Ce.literal("pyspark"),host:kr().optional(),port:Cr().optional()}),Tg=Ce.object({type:Ce.literal("redshift"),host:kr(),port:Cr(5439),connectionType:Ce.discriminatedUnion("type",[Ce.object({type:Ce.literal("IAM credentials"),region:Ce.string().describe(Ge.of({label:"Region"})),aws_access_key_id:Ce.string().nonempty().describe(Ge.of({label:"AWS Access Key ID",inputType:"password",optionRegex:".*aws_access_key_id.*"})),aws_secret_access_key:Ce.string().nonempty().describe(Ge.of({label:"AWS Secret Access Key",inputType:"password",optionRegex:".*aws_secret_access_key.*"})),aws_session_token:Ce.string().optional().describe(Ge.of({label:"AWS Session Token",inputType:"password",optionRegex:".*aws_session_token.*"}))}),Ce.object({type:Ce.literal("DB credentials"),user:Sr(),password:vr()})]).default({type:"IAM credentials",aws_access_key_id:"",aws_secret_access_key:"",region:""}),database:bo()}).describe(Ge.of({direction:"two-columns"})),vC=Ce.discriminatedUnion("type",[_g,bg,yg,xg,wg,vg,kg,Sg,Cg,Ng,jg,Eg,Ig,Ag,Tg]),Sd="env:";function za(t){return typeof t=="string"&&t.startsWith(Sd)}function Cd(t){return`${Sd}${t}`}const Mg={sqlmodel:"SQLModel",sqlalchemy:"SQLAlchemy",duckdb:"DuckDB",clickhouse_connect:"ClickHouse Connect",chdb:"chDB",pyiceberg:"PyIceberg",ibis:"Ibis",motherduck:"MotherDuck",redshift:"Redshift"};class ln{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 kC{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),za(n)){const r=n.replace(Sd,""),s=o?`os.environ.get("${r}", "${o}")`:`os.environ.get("${r}")`;return this.secrets[e]=s,e}if(o!=null){const r=`os.environ.get("${n}", "${o}")`;return this.secrets[e]=r,e}return typeof n=="number"||typeof n=="number"?`${n}`:typeof n=="boolean"?qr(n):n?`"${n}"`:""}printInFString(e,n,o){if(n===void 0)return"";if(typeof n=="number")return`${n}`;if(typeof n=="boolean")return qr(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 za(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 SC extends ln{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})
@@ -117,7 +117,7 @@ ${m.selection}
117
117
  ${m.codeAfter}
118
118
  `.trim(),g=D4();await R4();const p=await fetch(g.getAiURL("completion").toString(),{method:"POST",headers:g.headers(),body:JSON.stringify({prompt:m.prompt,code:_,selectedText:m.selection,includeOtherCode:"",language:m.language})}),b=((v=m.selection.match(/^\s*/))==null?void 0:v[0])||"",y=(S=p.body)==null?void 0:S.getReader();if(!y)throw new Error("Failed to get response reader");let x="";for(;;){const{done:k,value:E}=await y.read();if(k)break;x+=new TextDecoder().decode(E)}return x.startsWith(b)||(x=b+x),x}({prompt:f.prompt,selection:f.selection,codeBefore:f.codeBefore,codeAfter:f.codeAfter,language:Y3(f.editorView)})}):[],C5(dt),BB(e,c.reference_highlighting??!1)];var h},I5=t=>{const{theme:e,hotkeys:n,completionConfig:o,cellId:r,lspConfig:s,diagnosticsConfig:i}=t,a=G_(t);return[st.lineWrapping,UB(),VB(),$B(),HB(),WB(),qB(),GB(),YB({position:"fixed",parent:document.querySelector("#App")??void 0}),JB(),e==="dark"?N5:j5,KB(s),y5(o),XB(),ZB(),NE(),$o.high(Yn.of(rU)),QB(),eU(),tU.of(" "),F4(sU,{fallback:!0}),Yn.of(iU),nU({placeholderType:a,completionConfig:o,hotkeys:n,cellId:r,lspConfig:{...s,diagnostics:i}}),oU.of(aU()),fr.allowMultipleSelections.of(!0),x5(n),Yn.of([{key:"Tab",run:l=>lU(l)||(c=>{const{from:d,to:h}=c.state.selection.main;if(d!==h)return!1;const f=c.state.doc.lineAt(h);return f.text.slice(0,h-f.from).trim()!==""&&hU(c)})(l)||cU(l),preventDefault:!0},{key:n.getHotkey("completion.moveDown").key,run:l=>ya(l.state)!==null&&(z4(!0)(l),!0),preventDefault:!0},{key:n.getHotkey("completion.moveUp").key,run:l=>ya(l.state)!==null&&(z4(!1)(l),!0),preventDefault:!0}]),Yn.of([...dU,uU])]},A5={width:void 0,height:void 0};function Y_(t,e,n){return t[e]?Array.isArray(t[e])?t[e][0][n]:t[e][n]:e==="contentBoxSize"?t.contentRect[n==="inlineSize"?"width":"height"]:void 0}function J_(t){const e=t.current;if(e===null)throw new ReferenceError("Attempting to dereference null object.");return e}let K_,X_,Z_,Q_;K_=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!0}),X_=new Intl.DateTimeFormat("en-US",{month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!0}),Z_=t=>{const e=J.c(79),{editing:n,status:o,disabled:r,staleInputs:s,edited:i,interrupted:a,elapsedTime:l,runStartTimestamp:c,lastRunStartTimestamp:d,uninstantiated:h}=t;if(!n)return null;const f=c??d;let m;e[0]!==f?(m=f?u.jsx(Q_,{lastRanTime:f}):null,e[0]=f,e[1]=m):m=e[1];const _=m;if(r&&o==="running")return Dt.error("CellStatusComponent: disabled and running"),null;if(r&&s){let g,p,b,y;return e[2]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("span",{children:"This cell is stale, but it's disabled and can't be run"}),e[2]=g):g=e[2],e[3]!==_?(p=u.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[3]=_,e[4]=p):p=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"stale",children:u.jsxs(li,{children:[u.jsx(ai,{className:"h-5 w-5",strokeWidth:1.5}),u.jsx(Bc,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[5]=b):b=e[5],e[6]!==p?(y=u.jsx(Te,{content:p,usePortal:!0,children:b}),e[6]=p,e[7]=y):y=e[7],y}if(r){let g,p,b,y;return e[8]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("span",{children:"This cell is disabled"}),e[8]=g):g=e[8],e[9]!==_?(p=u.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[9]=_,e[10]=p):p=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx("div",{className:"cell-status-icon cell-status-disabled","data-testid":"cell-status","data-status":"disabled",children:u.jsx(ai,{className:"h-5 w-5",strokeWidth:1.5})}),e[11]=b):b=e[11],e[12]!==p?(y=u.jsx(Te,{content:p,usePortal:!0,children:b}),e[12]=p,e[13]=y):y=e[13],y}if(!s&&o==="disabled-transitively"){let g,p,b,y;return e[14]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("span",{children:"An ancestor of this cell is disabled, so it can't be run"}),e[14]=g):g=e[14],e[15]!==_?(p=u.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[15]=_,e[16]=p):p=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"disabled-transitively",children:u.jsxs(li,{layerTop:!0,children:[u.jsx(Oa,{className:"h-5 w-5",strokeWidth:1.5}),u.jsx(ai,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[17]=b):b=e[17],e[18]!==p?(y=u.jsx(Te,{content:p,usePortal:!0,children:b}),e[18]=p,e[19]=y):y=e[19],y}if(s&&o==="disabled-transitively"){let g,p,b,y;return e[20]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("span",{children:"This cell is stale, but an ancestor is disabled so it can't be run"}),e[20]=g):g=e[20],e[21]!==_?(p=u.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[21]=_,e[22]=p):p=e[22],e[23]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"stale",children:u.jsxs(li,{children:[u.jsx(Bc,{className:"h-5 w-5",strokeWidth:1}),u.jsx(ai,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[23]=b):b=e[23],e[24]!==p?(y=u.jsx(Te,{content:p,usePortal:!0,children:b}),e[24]=p,e[25]=y):y=e[25],y}if(o==="running"){let g,p,b,y,x;return e[26]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("span",{children:"This cell is running"}),e[26]=g):g=e[26],e[27]!==_?(p=u.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[27]=_,e[28]=p):p=e[28],e[29]!==c?(b=Um.fromSeconds(c)||Um.now(),e[29]=c,e[30]=b):b=e[30],e[31]!==b?(y=u.jsx("div",{className:"cell-status-icon elapsed-time running","data-testid":"cell-status","data-status":"running",children:u.jsx(T5,{startTime:b})}),e[31]=b,e[32]=y):y=e[32],e[33]!==p||e[34]!==y?(x=u.jsx(Te,{content:p,usePortal:!0,children:y}),e[33]=p,e[34]=y,e[35]=x):x=e[35],x}if(o==="queued"){let g,p,b,y;return e[36]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("span",{children:"This cell is queued to run"}),e[36]=g):g=e[36],e[37]!==_?(p=u.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[37]=_,e[38]=p):p=e[38],e[39]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx("div",{className:"cell-status-icon cell-status-queued","data-testid":"cell-status","data-status":"queued",children:u.jsx(QS,{className:"h-5 w-5",strokeWidth:1.5})}),e[39]=b):b=e[39],e[40]!==p?(y=u.jsx(Te,{content:p,usePortal:!0,children:b}),e[40]=p,e[41]=y):y=e[41],y}if(i||a||s||h){let g;e[42]!==l?(g=ja(l),e[42]=l,e[43]=g):g=e[43];const p=g;let b;e[44]!==l||e[45]!==p?(b=l?u.jsx(ed,{elapsedTime:p}):null,e[44]=l,e[45]=p,e[46]=b):b=e[46];const y=b;let x,v,S,k,E,N="";if(h)x="This cell has not yet been run";else if(a){let I;x="This cell was interrupted when it was last run",e[47]!==y?(I=u.jsxs("span",{children:["This cell ran for ",y," before being interrupted"]}),e[47]=y,e[48]=I):I=e[48],N=I}else if(i){let I;x="This cell has been modified since it was last run",e[49]!==y?(I=u.jsxs("span",{children:["This cell took ",y," to run"]}),e[49]=y,e[50]=I):I=e[50],N=I}else{let I;x="This cell has not been run with the latest inputs",e[51]!==y?(I=u.jsxs("span",{children:["This cell took ",y," to run"]}),e[51]=y,e[52]=I):I=e[52],N=I}return e[53]===Symbol.for("react.memo_cache_sentinel")?(v=u.jsx("div",{className:"cell-status-stale","data-testid":"cell-status","data-status":"outdated",children:u.jsx(Bc,{className:"h-5 w-5",strokeWidth:1.5})}),e[53]=v):v=e[53],e[54]!==x?(S=u.jsx(Te,{content:x,usePortal:!0,children:v}),e[54]=x,e[55]=S):S=e[55],e[56]!==l||e[57]!==p||e[58]!==_||e[59]!==N?(k=l&&u.jsx(Te,{content:u.jsxs("div",{className:"flex flex-col gap-1",children:[N,_]}),usePortal:!0,children:u.jsx("div",{className:"elapsed-time hover-action","data-testid":"cell-status","data-status":"outdated",children:u.jsx("span",{children:p})})}),e[56]=l,e[57]=p,e[58]=_,e[59]=N,e[60]=k):k=e[60],e[61]!==S||e[62]!==k?(E=u.jsxs("div",{className:"cell-status-icon flex items-center gap-2",children:[S,k]}),e[61]=S,e[62]=k,e[63]=E):E=e[63],E}if(l!==null){let g;e[64]!==l?(g=ja(l),e[64]=l,e[65]=g):g=e[65];const p=g;let b;e[66]!==l||e[67]!==p?(b=l?u.jsx(ed,{elapsedTime:p}):null,e[66]=l,e[67]=p,e[68]=b):b=e[68];const y=b;let x,v,S,k;return e[69]!==y?(x=u.jsxs("span",{children:["This cell took ",y," to run"]}),e[69]=y,e[70]=x):x=e[70],e[71]!==_||e[72]!==x?(v=u.jsxs("div",{className:"flex flex-col gap-1",children:[x,_]}),e[71]=_,e[72]=x,e[73]=v):v=e[73],e[74]!==p?(S=u.jsx("div",{className:"cell-status-icon elapsed-time hover-action","data-testid":"cell-status","data-status":"idle",children:u.jsx("span",{children:p})}),e[74]=p,e[75]=S):S=e[75],e[76]!==v||e[77]!==S?(k=u.jsx(Te,{content:v,usePortal:!0,children:S}),e[76]=v,e[77]=S,e[78]=k):k=e[78],k}return null},ed=t=>{const e=J.c(2);let n;return e[0]!==t.elapsedTime?(n=u.jsx("span",{className:"tracking-wide font-semibold",children:t.elapsedTime}),e[0]=t.elapsedTime,e[1]=n):n=e[1],n},Q_=t=>{const e=J.c(18),n=1e3*t.lastRanTime;let o,r,s,i,a,l,c,d,h;if(e[0]!==n){const f=new Date(n),m=new Date,_=f.toDateString()===m.toDateString()?K_:X_;i="Ran at",a=" ",l=u.jsx("strong",{className:"tracking-wide font-semibold",children:_.format(f)}),c=" ",o="text-muted-foreground",r="(",s=aC(f),e[0]=n,e[1]=o,e[2]=r,e[3]=s,e[4]=i,e[5]=a,e[6]=l,e[7]=c}else o=e[1],r=e[2],s=e[3],i=e[4],a=e[5],l=e[6],c=e[7];return e[8]!==o||e[9]!==r||e[10]!==s?(d=u.jsxs("span",{className:o,children:[r,s," ago)"]}),e[8]=o,e[9]=r,e[10]=s,e[11]=d):d=e[11],e[12]!==i||e[13]!==a||e[14]!==l||e[15]!==c||e[16]!==d?(h=u.jsxs("span",{children:[i,a,l,c,d]}),e[12]=i,e[13]=a,e[14]=l,e[15]=c,e[16]=d,e[17]=h):h=e[17],h},ja=function(t){if(t===null)return"";const e=t,n=e/1e3;return n>=60?`${Math.floor(n/60)}m${Math.floor(n%60)}s`:n>=1?`${n.toFixed(2).toString()}s`:`${e.toFixed(0).toString()}ms`};const T5=t=>{const e=J.c(6);let n;e[0]!==t.startTime?(n=t.startTime.toMilliseconds(),e[0]=t.startTime,e[1]=n):n=e[1];const o=function(i){const a=A.useRef(i),[l,c]=A.useState(i);return A.useEffect(()=>{const d=setInterval(()=>{c(Um.now().toMilliseconds())},17);return()=>clearInterval(d)},[]),l-a.current}(n);let r,s;return e[2]!==o?(r=ja(o),e[2]=o,e[3]=r):r=e[3],e[4]!==r?(s=u.jsx("span",{children:r}),e[4]=r,e[5]=s):s=e[5],s};var ju="ContextMenu",[M5,GH]=U4(ju,[B4]),dn=B4(),[O5,e0]=M5(ju),t0=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:o,dir:r,modal:s=!0}=t,[i,a]=A.useState(!1),l=dn(e),c=mr(o),d=A.useCallback(h=>{a(h),c(h)},[c]);return u.jsx(O5,{scope:e,open:i,onOpenChange:d,modal:s,children:u.jsx(NU,{...l,dir:r,open:i,onOpenChange:d,modal:s,children:n})})};t0.displayName=ju;var n0="ContextMenuTrigger",o0=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:o=!1,...r}=t,s=e0(n0,n),i=dn(n),a=A.useRef({x:0,y:0}),l=A.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...a.current})}),c=A.useRef(0),d=A.useCallback(()=>window.clearTimeout(c.current),[]),h=f=>{a.current={x:f.clientX,y:f.clientY},s.onOpenChange(!0)};return A.useEffect(()=>d,[d]),A.useEffect(()=>{o&&d()},[o,d]),u.jsxs(u.Fragment,{children:[u.jsx(pU,{...i,virtualRef:l}),u.jsx(ei.span,{"data-state":s.open?"open":"closed","data-disabled":o?"":void 0,...r,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:o?t.onContextMenu:Jn(t.onContextMenu,f=>{d(),h(f),f.preventDefault()}),onPointerDown:o?t.onPointerDown:Jn(t.onPointerDown,xl(f=>{d(),c.current=window.setTimeout(()=>h(f),700)})),onPointerMove:o?t.onPointerMove:Jn(t.onPointerMove,xl(d)),onPointerCancel:o?t.onPointerCancel:Jn(t.onPointerCancel,xl(d)),onPointerUp:o?t.onPointerUp:Jn(t.onPointerUp,xl(d))})]})});o0.displayName=n0;var r0=t=>{const{__scopeContextMenu:e,...n}=t,o=dn(e);return u.jsx(jU,{...o,...n})};r0.displayName="ContextMenuPortal";var s0="ContextMenuContent",i0=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=e0(s0,n),s=dn(n),i=A.useRef(!1);return u.jsx(gU,{...s,...o,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:a=>{var l;(l=t.onCloseAutoFocus)==null||l.call(t,a),!a.defaultPrevented&&i.current&&a.preventDefault(),i.current=!1},onInteractOutside:a=>{var l;(l=t.onInteractOutside)==null||l.call(t,a),a.defaultPrevented||r.modal||(i.current=!0)},style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});i0.displayName=s0,A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=dn(n);return u.jsx(_U,{...r,...o,ref:e})}).displayName="ContextMenuGroup";var a0=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=dn(n);return u.jsx(bU,{...r,...o,ref:e})});a0.displayName="ContextMenuLabel";var l0=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=dn(n);return u.jsx(mU,{...r,...o,ref:e})});l0.displayName="ContextMenuItem";var c0=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=dn(n);return u.jsx(yU,{...r,...o,ref:e})});c0.displayName="ContextMenuCheckboxItem",A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=dn(n);return u.jsx(xU,{...r,...o,ref:e})}).displayName="ContextMenuRadioGroup";var d0=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=dn(n);return u.jsx(wU,{...r,...o,ref:e})});d0.displayName="ContextMenuRadioItem";var u0=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=dn(n);return u.jsx(vU,{...r,...o,ref:e})});u0.displayName="ContextMenuItemIndicator";var h0=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=dn(n);return u.jsx(fU,{...r,...o,ref:e})});h0.displayName="ContextMenuSeparator",A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=dn(n);return u.jsx(kU,{...r,...o,ref:e})}).displayName="ContextMenuArrow";var f0=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=dn(n);return u.jsx(SU,{...r,...o,ref:e})});f0.displayName="ContextMenuSubTrigger";var m0=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=dn(n);return u.jsx(CU,{...r,...o,ref:e,style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});function xl(t){return e=>e.pointerType!=="mouse"?t(e):void 0}m0.displayName="ContextMenuSubContent";var p0=i0,g0=a0,_0=l0,b0=c0,y0=d0,x0=u0,w0=h0,v0=f0,k0=m0;const S0=t0,C0=o0,D5=AU(r0);A.forwardRef((t,e)=>{const n=J.c(14);let o,r,s,i,a,l,c;return n[0]!==t?({className:r,inset:s,children:o,...i}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i):(o=n[1],r=n[2],s=n[3],i=n[4]),n[5]!==r||n[6]!==s?(a=TU({className:r,inset:s}),n[5]=r,n[6]=s,n[7]=a):a=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx(DU,{className:"ml-auto h-4 w-4"}),n[8]=l):l=n[8],n[9]!==o||n[10]!==i||n[11]!==e||n[12]!==a?(c=u.jsxs(v0,{ref:e,className:a,...i,children:[o,l]}),n[9]=o,n[10]=i,n[11]=e,n[12]=a,n[13]=c):c=n[13],c}).displayName=v0.displayName;const N0="data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2";A.forwardRef((t,e)=>{const n=J.c(9);let o,r,s,i;return n[0]!==t?({className:o,...r}=t,n[0]=t,n[1]=o,n[2]=r):(o=n[1],r=n[2]),n[3]!==o?(s=Ie(V4({subcontent:!0}),N0,o),n[3]=o,n[4]=s):s=n[4],n[5]!==r||n[6]!==e||n[7]!==s?(i=u.jsx(k0,{ref:e,className:s,...r}),n[5]=r,n[6]=e,n[7]=s,n[8]=i):i=n[8],i}).displayName=k0.displayName;const Eu=A.forwardRef((t,e)=>{const n=J.c(15);let o,r,s;n[0]!==t?({className:o,scrollable: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||s;let a;n[4]!==o||n[5]!==i?(a=Ie(V4(),N0,i&&"overflow-auto",o),n[4]=o,n[5]=i,n[6]=a):a=n[6];const l=i?"calc(var(--radix-context-menu-content-available-height) - 30px)":void 0;let c,d;return n[7]!==r.style||n[8]!==l?(c={...r.style,maxHeight:l},n[7]=r.style,n[8]=l,n[9]=c):c=n[9],n[10]!==r||n[11]!==e||n[12]!==a||n[13]!==c?(d=u.jsx(D5,{children:u.jsx(MU,{children:u.jsx(p0,{ref:e,className:a,style:c,...r})})}),n[10]=r,n[11]=e,n[12]=a,n[13]=c,n[14]=d):d=n[14],d});Eu.displayName=p0.displayName;const Ai=A.forwardRef((t,e)=>{const n=J.c(13);let o,r,s,i,a,l;return n[0]!==t?({className:o,inset:r,variant:i,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i):(o=n[1],r=n[2],s=n[3],i=n[4]),n[5]!==o||n[6]!==r||n[7]!==i?(a=IU({className:o,inset:r,variant:i}),n[5]=o,n[6]=r,n[7]=i,n[8]=a):a=n[8],n[9]!==s||n[10]!==e||n[11]!==a?(l=u.jsx(_0,{ref:e,className:a,...s}),n[9]=s,n[10]=e,n[11]=a,n[12]=l):l=n[12],l});Ai.displayName=_0.displayName,A.forwardRef((t,e)=>{const n=J.c(15);let o,r,s,i,a,l,c,d;return n[0]!==t?({className:s,children:r,checked:o,...i}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i):(o=n[1],r=n[2],s=n[3],i=n[4]),n[5]!==s?(a=Uc({className:s}),n[5]=s,n[6]=a):a=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(l=Uc(),n[7]=l):l=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx("span",{className:l,children:u.jsx(x0,{children:u.jsx(RU,{className:"h-4 w-4"})})}),n[8]=c):c=n[8],n[9]!==o||n[10]!==r||n[11]!==i||n[12]!==e||n[13]!==a?(d=u.jsxs(b0,{ref:e,className:a,checked:o,...i,children:[c,r]}),n[9]=o,n[10]=r,n[11]=i,n[12]=e,n[13]=a,n[14]=d):d=n[14],d}).displayName=b0.displayName,A.forwardRef((t,e)=>{const n=J.c(13);let o,r,s,i,a,l,c;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=Uc({className:r}),n[4]=r,n[5]=i):i=n[5],n[6]===Symbol.for("react.memo_cache_sentinel")?(a=Uc(),n[6]=a):a=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx("span",{className:a,children:u.jsx(x0,{children:u.jsx(PU,{className:"h-4 w-4 fill-current"})})}),n[7]=l):l=n[7],n[8]!==o||n[9]!==s||n[10]!==e||n[11]!==i?(c=u.jsxs(y0,{ref:e,className:i,...s,children:[l,o]}),n[8]=o,n[9]=s,n[10]=e,n[11]=i,n[12]=c):c=n[12],c}).displayName=y0.displayName,A.forwardRef((t,e)=>{const n=J.c(11);let o,r,s,i,a;return n[0]!==t?({className:o,inset:r,...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]!==o||n[5]!==r?(i=OU({className:o,inset:r}),n[4]=o,n[5]=r,n[6]=i):i=n[6],n[7]!==s||n[8]!==e||n[9]!==i?(a=u.jsx(g0,{ref:e,className:i,...s}),n[7]=s,n[8]=e,n[9]=i,n[10]=a):a=n[10],a}).displayName=g0.displayName;const j0=A.forwardRef((t,e)=>{const n=J.c(9);let o,r,s,i;return n[0]!==t?({className:o,...r}=t,n[0]=t,n[1]=o,n[2]=r):(o=n[1],r=n[2]),n[3]!==o?(s=Ie(EU({className:o})),n[3]=o,n[4]=s):s=n[4],n[5]!==r||n[6]!==e||n[7]!==s?(i=u.jsx(w0,{ref:e,className:s,...r}),n[5]=r,n[6]=e,n[7]=s,n[8]=i):i=n[8],i});j0.displayName=w0.displayName;const E0=t=>{const e=J.c(17),{connectionState:n,onClick:o,tooltipContent:r}=t;let s;e[0]!==n||e[1]!==r?(s=up(n)||r,e[0]=n,e[1]=r,e[2]=s):s=e[2];const i=s;let a,l,c,d,h,f;return e[3]!==o?(a=()=>o==null?void 0:o({code:""}),e[3]=o,e[4]=a):a=e[4],e[5]!==n?(l=Ie("shoulder-button hover-action",br(n)&&" inactive-button"),e[5]=n,e[6]=l):l=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(pr,{strokeWidth:1.8}),e[7]=c):c=e[7],e[8]!==a||e[9]!==l?(d=u.jsx(wn,{onClick:a,className:l,onMouseDown:Hn.preventFocus,shape:"circle",size:"small",color:"hint-green","data-testid":"create-cell-button",children:c}),e[8]=a,e[9]=l,e[10]=d):d=e[10],e[11]!==i||e[12]!==d?(h=u.jsx(Te,{content:i,usePortal:!1,children:d}),e[11]=i,e[12]=d,e[13]=h):h=e[13],e[14]!==o||e[15]!==h?(f=u.jsx(R5,{onClick:o,children:h}),e[14]=o,e[15]=h,e[16]=f):f=e[16],f},R5=t=>{const e=J.c(24),{children:n,onClick:o}=t;if(!o)return n;let r,s,i,a,l,c,d,h,f,m,_,g;return e[0]!==n?(r=u.jsx(C0,{children:n}),e[0]=n,e[1]=r):r=e[1],e[2]!==o?(s=p=>{p.stopPropagation(),o({code:""})},e[2]=o,e[3]=s):s=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx("div",{className:"mr-3 text-muted-foreground",children:u.jsx(pc,{})}),e[4]=i):i=e[4],e[5]!==s?(a=u.jsxs(Ai,{onSelect:s,children:[i,"Python cell"]},"python"),e[5]=s,e[6]=a):a=e[6],e[7]!==o?(l=p=>{p.stopPropagation(),o({code:new ca().defaultCode})},e[7]=o,e[8]=l):l=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx("div",{className:"mr-3 text-muted-foreground",children:u.jsx(mc,{})}),e[9]=c):c=e[9],e[10]!==l?(d=u.jsxs(Ai,{onSelect:l,children:[c,"Markdown cell"]},"markdown"),e[10]=l,e[11]=d):d=e[11],e[12]!==o?(h=p=>{p.stopPropagation(),o({code:new Vc().defaultCode})},e[12]=o,e[13]=h):h=e[13],e[14]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsx("div",{className:"mr-3 text-muted-foreground",children:u.jsx(dr,{size:13,strokeWidth:1.5})}),e[14]=f):f=e[14],e[15]!==h?(m=u.jsxs(Ai,{onSelect:h,children:[f,"SQL cell"]},"sql"),e[15]=h,e[16]=m):m=e[16],e[17]!==a||e[18]!==d||e[19]!==m?(_=u.jsxs(Eu,{children:[a,d,m]}),e[17]=a,e[18]=d,e[19]=m,e[20]=_):_=e[20],e[21]!==r||e[22]!==_?(g=u.jsxs(S0,{children:[r,_]}),e[21]=r,e[22]=_,e[23]=g):g=e[23],g},I0=Y.memo(Y.forwardRef((t,e)=>{const n=J.c(34);let o,r,s;n[0]!==t?({children:o,showTooltip: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||s,[a,l]=A.useState(!1);let c;n[4]!==r?(c={cell:r},n[4]=r,n[5]=c):c=n[5];const d=vd(c),h=FU();let f,m,_,g,p,b;if(n[6]===Symbol.for("react.memo_cache_sentinel")?(f=()=>({toggle:()=>l(P5)}),n[6]=f):f=n[6],A.useImperativeHandle(e,f),n[7]===Symbol.for("react.memo_cache_sentinel")?(m=u.jsx(aa,{placeholder:"Search actions...",className:"h-6 m-1"}),n[7]=m):m=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(_=u.jsx(_c,{children:"No results"}),n[8]=_):_=n[8],n[9]!==d){let N;n[11]!==d.length?(N=(I,T)=>u.jsxs(A.Fragment,{children:[u.jsx(xm,{children:I.map(M=>{let R=u.jsxs("div",{className:"flex items-center flex-1",children:[M.icon&&u.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:M.icon}),u.jsx("div",{className:"flex-1",children:M.label}),u.jsxs("div",{className:"flex-shrink-0 text-sm",children:[M.hotkey&&$4(M.hotkey),M.rightElement]})]});return M.tooltip&&(R=u.jsx(Te,{content:M.tooltip,delayDuration:100,children:R})),u.jsx(go,{className:Ie(M.disabled&&"!opacity-50"),onSelect:()=>{M.disableClick||M.disabled||(M.handle(),l(!1))},variant:M.variant,children:R},M.label)})},T),T<d.length-1&&u.jsx(i4,{})]},T),n[11]=d.length,n[12]=N):N=n[12],g=d.map(N),n[9]=d,n[10]=g}else g=n[10];n[13]!==g?(p=u.jsxs(Ic,{children:[m,u.jsxs(Vm,{children:[_,g]})]}),n[13]=g,n[14]=p):p=n[14],n[15]!==h||n[16]!==p?(b=u.jsx(Js,{className:"w-[300px] p-0 pt-1 overflow-auto",scrollable:!0,...h,children:p}),n[15]=h,n[16]=p,n[17]=b):b=n[17];const y=b;if(!i){let N,I;return n[18]!==o?(N=u.jsx(ti,{asChild:!0,children:o}),n[18]=o,n[19]=N):N=n[19],n[20]!==y||n[21]!==a||n[22]!==N?(I=u.jsxs(Ur,{open:a,onOpenChange:l,children:[N,y]}),n[20]=y,n[21]=a,n[22]=N,n[23]=I):I=n[23],I}let x;n[24]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx(zU,{tabIndex:-1,children:pn("cell.cellActions")}),n[24]=x):x=n[24];const v=!a&&x;let S,k,E;return n[25]!==o?(S=u.jsx(BU,{children:u.jsx(ti,{className:"flex",children:o})}),n[25]=o,n[26]=S):S=n[26],n[27]!==v||n[28]!==S?(k=u.jsxs(UU,{delayDuration:200,disableHoverableContent:!0,children:[v,S]}),n[27]=v,n[28]=S,n[29]=k):k=n[29],n[30]!==y||n[31]!==a||n[32]!==k?(E=u.jsxs(Ur,{open:a,onOpenChange:l,children:[k,y]}),n[30]=y,n[31]=a,n[32]=k,n[33]=E):E=n[33],E})),A0=Y.memo(t=>{const e=J.c(5),{children:n,cellId:o}=t;let r,s;e[0]!==o?(s=LU(o),e[0]=o,e[1]=s):s=e[1],r=s;const i=$e(r);if(!i)return null;let a;return e[2]!==n||e[3]!==i?(a=u.jsx(I0,{showTooltip:!1,...i,children:n}),e[2]=n,e[3]=i,e[4]=a):a=e[4],a});function P5(t){return!t}A0.displayName="ConnectionCellActionsDropdown";const T0=t=>{const e=J.c(32);let n,o,r;e[0]!==t?({children:n,...o}=t,e[0]=t,e[1]=n,e[2]=o):(n=e[1],o=e[2]),e[3]!==o?(r={cell:o},e[3]=o,e[4]=r):r=e[4];const s=vd(r),[i,a]=Y.useState(),l=!!i;let c,d,h,f,m,_,g,p,b,y;if(e[5]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(ra,{size:13,strokeWidth:1.5}),e[5]=c):c=e[5],e[6]!==o?(d=async()=>{var S;if((S=window.getSelection())==null?void 0:S.toString())return void document.execCommand("copy");const v=document.getElementById(K3.create(o.cellId));v?await xn(v.textContent??""):Dt.warn("cell-context-menu: output not found")},e[6]=o,e[7]=d):d=e[7],e[8]!==s||e[9]!==n||e[10]!==i||e[11]!==o||e[12]!==l||e[13]!==d){const x=[{label:"Copy",hidden:l,icon:c,handle:d},{label:"Cut",hidden:!!i,icon:u.jsx(hd,{size:13,strokeWidth:1.5}),handle:L5},{label:"Paste",hidden:!!i,icon:u.jsx(vp,{size:13,strokeWidth:1.5}),handle:async()=>{const{getEditorView:k}=o,E=k();if(E)try{const N=await navigator.clipboard.readText();if(N){const{from:I,to:T}=E.state.selection.main,M=E.state.update({changes:{from:I,to:T,insert:N}});E.dispatch(M)}}catch(N){const I=N;Dt.error("Failed to paste from clipboard",I),VU({command:"paste"})}}},{label:"Copy image",hidden:!i,icon:u.jsx(od,{size:13,strokeWidth:1.5}),handle:async()=>{if(i){const k=await fetch(i.src),E=await k.blob(),N=new ClipboardItem({[E.type]:E});await navigator.clipboard.write([N]).then(F5).catch(z5)}}},{icon:u.jsx(dp,{size:13,strokeWidth:1.5}),label:"Download image",hidden:!i,handle:()=>{if(i){const k=document.createElement("a");k.download="image.png",k.href=i.src,k.click()}}},{label:"Go to Definition",icon:u.jsx(HU,{size:13,strokeWidth:1.5}),handle:()=>{const{getEditorView:k}=o,E=k();E&&$U(E)}}],v=[x,...s];let S;f=S0,e[20]===Symbol.for("react.memo_cache_sentinel")?(S=k=>{k.target instanceof HTMLImageElement?a(k.target):a(void 0)},e[20]=S):S=e[20],e[21]!==n?(p=u.jsx(C0,{onContextMenu:S,asChild:!0,children:n}),e[21]=n,e[22]=p):p=e[22],h=Eu,m="w-[300px]",_=!0,g=v.map((k,E)=>u.jsxs(A.Fragment,{children:[k.map(B5),E<v.length-1&&u.jsx(j0,{})]},E)),e[8]=s,e[9]=n,e[10]=i,e[11]=o,e[12]=l,e[13]=d,e[14]=h,e[15]=f,e[16]=m,e[17]=_,e[18]=g,e[19]=p}else h=e[14],f=e[15],m=e[16],_=e[17],g=e[18],p=e[19];return e[23]!==h||e[24]!==m||e[25]!==_||e[26]!==g?(b=u.jsx(h,{className:m,scrollable:_,children:g}),e[23]=h,e[24]=m,e[25]=_,e[26]=g,e[27]=b):b=e[27],e[28]!==f||e[29]!==p||e[30]!==b?(y=u.jsxs(f,{children:[p,b]}),e[28]=f,e[29]=p,e[30]=b,e[31]=y):y=e[31],y};function L5(){document.execCommand("cut")}function F5(){lt({title:"Copied image to clipboard"})}function z5(t){lt({title:"Failed to copy image to clipboard. Try downloading instead.",description:t.message}),Dt.error("Failed to copy image to clipboard",t)}function B5(t){if(t.hidden)return null;let e=u.jsxs("div",{className:"flex items-center flex-1",children:[t.icon&&u.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:t.icon}),u.jsx("div",{className:"flex-1",children:t.label}),u.jsxs("div",{className:"flex-shrink-0 text-sm",children:[t.hotkey&&$4(t.hotkey),t.rightElement]})]});return t.tooltip&&(e=u.jsx(Te,{delayDuration:100,content:t.tooltip,children:e})),u.jsx(Ai,{className:t.disabled?"!opacity-50":"",onSelect:n=>{t.disableClick||t.disabled||t.handle(n)},variant:t.variant,children:e},t.label)}const U5=""+new URL("loro_wasm_bg-DHBNbovs.wasm",import.meta.url).href;let w;function Iu(t){w=t}const kt=new Array(128).fill(void 0);function ye(t){return kt[t]}kt.push(void 0,null,!0,!1);let We=0,wl=null;function es(){return wl!==null&&wl.byteLength!==0||(wl=new Uint8Array(w.memory.buffer)),wl}let vl=new(typeof TextEncoder>"u"?(0,module.require)("util").TextEncoder:TextEncoder)("utf-8");const V5=typeof vl.encodeInto=="function"?function(t,e){return vl.encodeInto(t,e)}:function(t,e){const n=vl.encode(t);return e.set(n),{read:t.length,written:n.length}};function ft(t,e,n){if(n===void 0){const a=vl.encode(t),l=e(a.length,1)>>>0;return es().subarray(l,l+a.length).set(a),We=a.length,l}let o=t.length,r=e(o,1)>>>0;const s=es();let i=0;for(;i<o;i++){const a=t.charCodeAt(i);if(a>127)break;s[r+i]=a}if(i!==o){i!==0&&(t=t.slice(i)),r=n(r,o,o=i+3*t.length,1)>>>0;const a=es().subarray(r+i,r+o);i+=V5(t,a).written,r=n(r,o,i,1)>>>0}return We=i,r}let ts=null;function L(){return(ts===null||ts.buffer.detached===!0||ts.buffer.detached===void 0&&ts.buffer!==w.memory.buffer)&&(ts=new DataView(w.memory.buffer)),ts}let Ti=kt.length;function oe(t){Ti===kt.length&&kt.push(kt.length+1);const e=Ti;return Ti=kt[e],kt[e]=t,e}function Kt(t,e){try{return t.apply(this,e)}catch(n){w.__wbindgen_export_2(oe(n))}}let M0=new(typeof TextDecoder>"u"?(0,module.require)("util").TextDecoder:TextDecoder)("utf-8",{ignoreBOM:!0,fatal:!0});function At(t,e){return t>>>=0,M0.decode(es().subarray(t,t+e))}function H(t){const e=ye(t);return function(n){n<132||(kt[n]=Ti,Ti=n)}(t),e}function Pn(t){return t==null}M0.decode();const O0=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>{w.__wbindgen_export_4.get(t.dtor)(t.a,t.b)});function D0(t,e,n,o){const r={a:t,b:e,cnt:1,dtor:n},s=(...i)=>{r.cnt++;const a=r.a;r.a=0;try{return o(a,r.b,...i)}finally{--r.cnt===0?(w.__wbindgen_export_4.get(r.dtor)(a,r.b),O0.unregister(r)):r.a=a}};return s.original=r,O0.register(s,r,r),s}function Au(t){const e=typeof t;if(e=="number"||e=="boolean"||t==null)return`${t}`;if(e=="string")return`"${t}"`;if(e=="symbol"){const r=t.description;return r==null?"Symbol":`Symbol(${r})`}if(e=="function"){const r=t.name;return typeof r=="string"&&r.length>0?`Function(${r})`:"Function"}if(Array.isArray(t)){const r=t.length;let s="[";r>0&&(s+=Au(t[0]));for(let i=1;i<r;i++)s+=", "+Au(t[i]);return s+="]",s}const n=/\[object ([^\]]+)\]/.exec(toString.call(t));let o;if(!(n&&n.length>1))return toString.call(t);if(o=n[1],o=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message}
119
119
  ${t.stack}`:o}function io(t,e){return t>>>=0,es().subarray(t/1,t/1+e)}function Jo(t,e){const n=e(1*t.length,1)>>>0;return es().set(t,n/1),We=t.length,n}function Ln(t,e){t>>>=0;const n=L(),o=[];for(let r=t;r<t+4*e;r+=4)o.push(H(n.getUint32(r,!0)));return o}function kn(t,e){const n=e(4*t.length,4)>>>0,o=L();for(let r=0;r<t.length;r++)o.setUint32(n+4*r,oe(t[r]),!0);return We=t.length,n}let Xt=128;function _n(t){if(Xt==1)throw new Error("out of js stack");return kt[--Xt]=t,Xt}function ns(t,e){if(!(t instanceof e))throw new Error(`expected instance of ${e.name}`)}function $5(t,e,n){w.__wbindgen_export_5(t,e,oe(n))}function H5(t,e){w.__wbindgen_export_6(t,e)}const R0=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_awarenesswasm_free(t>>>0,1));class P0{__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,R0.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_awarenesswasm_free(e,0)}constructor(e,n){const o=w.awarenesswasm_new(oe(e),n);return this.__wbg_ptr=o>>>0,R0.register(this,this.__wbg_ptr,this),this}encode(e){try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.awarenesswasm_encode(s,this.__wbg_ptr,oe(e));var n=L().getInt32(s+0,!0),o=L().getInt32(s+4,!0),r=io(n,o).slice();return w.__wbindgen_export_3(n,1*o,1),r}finally{w.__wbindgen_add_to_stack_pointer(16)}}encodeAll(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.awarenesswasm_encodeAll(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=io(e,n).slice();return w.__wbindgen_export_3(e,1*n,1),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}apply(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=Jo(e,w.__wbindgen_export_0),i=We;w.awarenesswasm_apply(r,this.__wbg_ptr,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}setLocalState(e){w.awarenesswasm_setLocalState(this.__wbg_ptr,oe(e))}peer(){return H(w.awarenesswasm_peer(this.__wbg_ptr))}getAllStates(){return H(w.awarenesswasm_getAllStates(this.__wbg_ptr))}getState(e){return H(w.awarenesswasm_getState(this.__wbg_ptr,oe(e)))}getTimestamp(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.awarenesswasm_getTimestamp(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getFloat64(r+8,!0);return n===0?void 0:o}finally{w.__wbindgen_add_to_stack_pointer(16)}}removeOutdated(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.awarenesswasm_removeOutdated(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=Ln(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}length(){return w.awarenesswasm_length(this.__wbg_ptr)}isEmpty(){return w.awarenesswasm_isEmpty(this.__wbg_ptr)!==0}peers(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.awarenesswasm_peers(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=Ln(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}}const L0=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_changemodifier_free(t>>>0,1));class os{static __wrap(e){e>>>=0;const n=Object.create(os.prototype);return n.__wbg_ptr=e,L0.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,L0.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_changemodifier_free(e,0)}setMessage(e){const n=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=We,r=w.changemodifier_setMessage(this.__wbg_ptr,n,o);return os.__wrap(r)}setTimestamp(e){const n=w.changemodifier_setTimestamp(this.__wbg_ptr,e);return os.__wrap(n)}}const F0=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_cursor_free(t>>>0,1));class Zn{static __wrap(e){e>>>=0;const n=Object.create(Zn.prototype);return n.__wbg_ptr=e,F0.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,F0.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_cursor_free(e,0)}containerId(){return H(w.cursor_containerId(this.__wbg_ptr))}pos(){return H(w.cursor_pos(this.__wbg_ptr))}side(){return H(w.cursor_side(this.__wbg_ptr))}encode(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.cursor_encode(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=io(e,n).slice();return w.__wbindgen_export_3(e,1*n,1),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}static decode(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=Jo(e,w.__wbindgen_export_0),i=We;w.cursor_decode(r,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return Zn.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}kind(){return H(w.cursor_kind(this.__wbg_ptr))}}const z0=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_ephemeralstorewasm_free(t>>>0,1)),Tu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorocounter_free(t>>>0,1));class Mi{static __wrap(e){e>>>=0;const n=Object.create(Mi.prototype);return n.__wbg_ptr=e,Tu.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Tu.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_lorocounter_free(e,0)}constructor(){const e=w.lorocounter_new();return this.__wbg_ptr=e>>>0,Tu.register(this,this.__wbg_ptr,this),this}kind(){return H(w.lorocounter_kind(this.__wbg_ptr))}get id(){return H(w.lorocounter_id(this.__wbg_ptr))}increment(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorocounter_increment(o,this.__wbg_ptr,e);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}decrement(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorocounter_decrement(o,this.__wbg_ptr,e);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get value(){return w.lorocounter_value(this.__wbg_ptr)}subscribe(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorocounter_subscribe(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}parent(){return H(w.lorocounter_parent(this.__wbg_ptr))}isAttached(){return w.lorocounter_isAttached(this.__wbg_ptr)!==0}getAttached(){return H(w.lorocounter_getAttached(this.__wbg_ptr))}getShallowValue(){return w.lorocounter_getShallowValue(this.__wbg_ptr)}}const Mu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorodoc_free(t>>>0,1));class xo{static __wrap(e){e>>>=0;const n=Object.create(xo.prototype);return n.__wbg_ptr=e,Mu.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Mu.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_lorodoc_free(e,0)}constructor(){const e=w.lorodoc_new();return this.__wbg_ptr=e>>>0,Mu.register(this,this.__wbg_ptr,this),this}setDetachedEditing(e){w.lorodoc_setDetachedEditing(this.__wbg_ptr,e)}isDetachedEditingEnabled(){return w.lorodoc_isDetachedEditingEnabled(this.__wbg_ptr)!==0}setRecordTimestamp(e){w.lorodoc_setRecordTimestamp(this.__wbg_ptr,e)}setChangeMergeInterval(e){w.lorodoc_setChangeMergeInterval(this.__wbg_ptr,e)}configTextStyle(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_configTextStyle(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}configDefaultTextStyle(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_configDefaultTextStyle(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}static fromSnapshot(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=Jo(e,w.__wbindgen_export_0),i=We;w.lorodoc_fromSnapshot(r,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return xo.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}attach(){w.lorodoc_attach(this.__wbg_ptr)}isDetached(){return w.lorodoc_isDetached(this.__wbg_ptr)!==0}detach(){w.lorodoc_detach(this.__wbg_ptr)}fork(){const e=w.lorodoc_fork(this.__wbg_ptr);return xo.__wrap(e)}forkAt(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=kn(e,w.__wbindgen_export_0),i=We;w.lorodoc_forkAt(r,this.__wbg_ptr,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return xo.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}checkoutToLatest(){try{const n=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_checkoutToLatest(n,this.__wbg_ptr);var e=L().getInt32(n+0,!0);if(L().getInt32(n+4,!0))throw H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}travelChangeAncestors(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=kn(e,w.__wbindgen_export_0),i=We;w.lorodoc_travelChangeAncestors(r,this.__wbg_ptr,s,i,oe(n));var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}findIdSpansBetween(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16),i=kn(e,w.__wbindgen_export_0),a=We,l=kn(n,w.__wbindgen_export_0),c=We;w.lorodoc_findIdSpansBetween(s,this.__wbg_ptr,i,a,l,c);var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}checkout(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16),r=kn(e,w.__wbindgen_export_0),s=We;w.lorodoc_checkout(o,this.__wbg_ptr,r,s);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get peerId(){const e=w.lorodoc_peerId(this.__wbg_ptr);return BigInt.asUintN(64,e)}get peerIdStr(){return H(w.lorodoc_peerIdStr(this.__wbg_ptr))}setPeerId(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_setPeerId(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}commit(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_commit(o,this.__wbg_ptr,Pn(e)?0:oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getPendingTxnLength(){return w.lorodoc_getPendingTxnLength(this.__wbg_ptr)>>>0}getText(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getText(r,this.__wbg_ptr,_n(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return Xo.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Xt++]=void 0}}getMap(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getMap(r,this.__wbg_ptr,_n(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return Ko.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Xt++]=void 0}}getList(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getList(r,this.__wbg_ptr,_n(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return Oi.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Xt++]=void 0}}getMovableList(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getMovableList(r,this.__wbg_ptr,_n(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return Di.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Xt++]=void 0}}getCounter(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getCounter(r,this.__wbg_ptr,_n(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return Mi.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Xt++]=void 0}}getTree(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getTree(r,this.__wbg_ptr,_n(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return Ri.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Xt++]=void 0}}hasContainer(e){return w.lorodoc_hasContainer(this.__wbg_ptr,oe(e))!==0}getContainerById(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getContainerById(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}setNextCommitMessage(e){const n=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=We;w.lorodoc_setNextCommitMessage(this.__wbg_ptr,n,o)}setNextCommitOrigin(e){const n=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=We;w.lorodoc_setNextCommitOrigin(this.__wbg_ptr,n,o)}setNextCommitTimestamp(e){w.lorodoc_setNextCommitTimestamp(this.__wbg_ptr,e)}setNextCommitOptions(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_setNextCommitOptions(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}clearNextCommitOptions(){w.lorodoc_clearNextCommitOptions(this.__wbg_ptr)}getDeepValueWithID(){return H(w.lorodoc_getDeepValueWithID(this.__wbg_ptr))}getPathToContainer(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getPathToContainer(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}JSONPath(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),i=We;w.lorodoc_JSONPath(r,this.__wbg_ptr,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}version(){const e=w.lorodoc_version(this.__wbg_ptr);return Fn.__wrap(e)}shallowSinceVV(){const e=w.lorodoc_shallowSinceVV(this.__wbg_ptr);return Fn.__wrap(e)}isShallow(){return w.lorodoc_isShallow(this.__wbg_ptr)!==0}shallowSinceFrontiers(){return H(w.lorodoc_shallowSinceFrontiers(this.__wbg_ptr))}oplogVersion(){const e=w.lorodoc_oplogVersion(this.__wbg_ptr);return Fn.__wrap(e)}frontiers(){return H(w.lorodoc_frontiers(this.__wbg_ptr))}oplogFrontiers(){return H(w.lorodoc_oplogFrontiers(this.__wbg_ptr))}cmpWithFrontiers(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=kn(e,w.__wbindgen_export_0),i=We;w.lorodoc_cmpWithFrontiers(r,this.__wbg_ptr,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return n}finally{w.__wbindgen_add_to_stack_pointer(16)}}cmpFrontiers(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16),i=kn(e,w.__wbindgen_export_0),a=We,l=kn(n,w.__wbindgen_export_0),c=We;w.lorodoc_cmpFrontiers(s,this.__wbg_ptr,i,a,l,c);var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}exportSnapshot(){try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_exportSnapshot(s,this.__wbg_ptr);var e=L().getInt32(s+0,!0),n=L().getInt32(s+4,!0),o=L().getInt32(s+8,!0);if(L().getInt32(s+12,!0))throw H(o);var r=io(e,n).slice();return w.__wbindgen_export_3(e,1*n,1),r}finally{w.__wbindgen_add_to_stack_pointer(16)}}exportFrom(e){try{const i=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_exportFrom(i,this.__wbg_ptr,oe(e));var n=L().getInt32(i+0,!0),o=L().getInt32(i+4,!0),r=L().getInt32(i+8,!0);if(L().getInt32(i+12,!0))throw H(r);var s=io(n,o).slice();return w.__wbindgen_export_3(n,1*o,1),s}finally{w.__wbindgen_add_to_stack_pointer(16)}}export(e){try{const i=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_export(i,this.__wbg_ptr,oe(e));var n=L().getInt32(i+0,!0),o=L().getInt32(i+4,!0),r=L().getInt32(i+8,!0);if(L().getInt32(i+12,!0))throw H(r);var s=io(n,o).slice();return w.__wbindgen_export_3(n,1*o,1),s}finally{w.__wbindgen_add_to_stack_pointer(16)}}exportJsonUpdates(e,n,o){try{const i=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_exportJsonUpdates(i,this.__wbg_ptr,oe(e),oe(n),Pn(o)?16777215:o?1:0);var r=L().getInt32(i+0,!0),s=L().getInt32(i+4,!0);if(L().getInt32(i+8,!0))throw H(s);return H(r)}finally{w.__wbindgen_add_to_stack_pointer(16)}}exportJsonInIdSpan(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_exportJsonInIdSpan(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}importJsonUpdates(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_importJsonUpdates(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}import(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=Jo(e,w.__wbindgen_export_0),i=We;w.lorodoc_import(r,this.__wbg_ptr,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}importUpdateBatch(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_importBatch(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}importBatch(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_importBatch(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getShallowValue(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getShallowValue(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_toJSON(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}subscribe(e){return H(w.lorodoc_subscribe(this.__wbg_ptr,oe(e)))}subscribeLocalUpdates(e){return H(w.lorodoc_subscribeLocalUpdates(this.__wbg_ptr,oe(e)))}debugHistory(){w.lorodoc_debugHistory(this.__wbg_ptr)}changeCount(){return w.lorodoc_changeCount(this.__wbg_ptr)>>>0}opCount(){return w.lorodoc_opCount(this.__wbg_ptr)>>>0}getAllChanges(){return H(w.lorodoc_getAllChanges(this.__wbg_ptr))}getChangeAt(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getChangeAt(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getChangeAtLamport(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16),i=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),a=We;w.lorodoc_getChangeAtLamport(s,this.__wbg_ptr,i,a,n);var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getOpsInChange(e){try{const i=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getOpsInChange(i,this.__wbg_ptr,oe(e));var n=L().getInt32(i+0,!0),o=L().getInt32(i+4,!0),r=L().getInt32(i+8,!0);if(L().getInt32(i+12,!0))throw H(r);var s=Ln(n,o).slice();return w.__wbindgen_export_3(n,4*o,4),s}finally{w.__wbindgen_add_to_stack_pointer(16)}}frontiersToVV(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=kn(e,w.__wbindgen_export_0),i=We;w.lorodoc_frontiersToVV(r,this.__wbg_ptr,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return Fn.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}vvToFrontiers(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);ns(e,Fn),w.lorodoc_vvToFrontiers(r,this.__wbg_ptr,e.__wbg_ptr);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getByPath(e){const n=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=We;return H(w.lorodoc_getByPath(this.__wbg_ptr,n,o))}getCursorPos(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);ns(e,Zn),w.lorodoc_getCursorPos(r,this.__wbg_ptr,e.__wbg_ptr);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getChangedContainersIn(e,n){try{const a=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getChangedContainersIn(a,this.__wbg_ptr,oe(e),n);var o=L().getInt32(a+0,!0),r=L().getInt32(a+4,!0),s=L().getInt32(a+8,!0);if(L().getInt32(a+12,!0))throw H(s);var i=Ln(o,r).slice();return w.__wbindgen_export_3(o,4*r,4),i}finally{w.__wbindgen_add_to_stack_pointer(16)}}revertTo(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16),r=kn(e,w.__wbindgen_export_0),s=We;w.lorodoc_revertTo(o,this.__wbg_ptr,r,s);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}applyDiff(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_applyDiff(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}diff(e,n,o){try{const i=w.__wbindgen_add_to_stack_pointer(-16),a=kn(e,w.__wbindgen_export_0),l=We,c=kn(n,w.__wbindgen_export_0),d=We;w.lorodoc_diff(i,this.__wbg_ptr,a,l,c,d,Pn(o)?16777215:o?1:0);var r=L().getInt32(i+0,!0),s=L().getInt32(i+4,!0);if(L().getInt32(i+8,!0))throw H(s);return H(r)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getUncommittedOpsAsJson(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getUncommittedOpsAsJson(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}subscribeFirstCommitFromPeer(e){return H(w.lorodoc_subscribeFirstCommitFromPeer(this.__wbg_ptr,oe(e)))}subscribePreCommit(e){return H(w.lorodoc_subscribePreCommit(this.__wbg_ptr,oe(e)))}deleteRootContainer(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_deleteRootContainer(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}setHideEmptyRootContainers(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_setHideEmptyRootContainers(o,this.__wbg_ptr,e);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}}const Ou=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorolist_free(t>>>0,1));class Oi{static __wrap(e){e>>>=0;const n=Object.create(Oi.prototype);return n.__wbg_ptr=e,Ou.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Ou.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_lorolist_free(e,0)}constructor(){const e=w.lorolist_new();return this.__wbg_ptr=e>>>0,Ou.register(this,this.__wbg_ptr,this),this}kind(){return H(w.lorolist_kind(this.__wbg_ptr))}insert(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_insert(r,this.__wbg_ptr,e,oe(n));var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}delete(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_delete(r,this.__wbg_ptr,e,n);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get(e){return H(w.lorolist_get(this.__wbg_ptr,e))}get id(){return H(w.lorolist_id(this.__wbg_ptr))}toArray(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_toArray(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=Ln(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return H(w.lorolist_toJSON(this.__wbg_ptr))}insertContainer(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_insertContainer(s,this.__wbg_ptr,e,oe(n));var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}pushContainer(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_pushContainer(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}subscribe(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_subscribe(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get length(){return w.lorolist_length(this.__wbg_ptr)>>>0}parent(){return H(w.lorolist_parent(this.__wbg_ptr))}isAttached(){return w.lorolist_isAttached(this.__wbg_ptr)!==0}getAttached(){return H(w.lorolist_getAttached(this.__wbg_ptr))}getCursor(e,n){const o=w.lorolist_getCursor(this.__wbg_ptr,e,oe(n));return o===0?void 0:Zn.__wrap(o)}push(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_push(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}pop(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_pop(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}clear(){try{const n=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_clear(n,this.__wbg_ptr);var e=L().getInt32(n+0,!0);if(L().getInt32(n+4,!0))throw H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getIdAt(e){return H(w.lorolist_getIdAt(this.__wbg_ptr,e))}isDeleted(){return w.lorolist_isDeleted(this.__wbg_ptr)!==0}getShallowValue(){return H(w.lorolist_getShallowValue(this.__wbg_ptr))}}const Du=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_loromap_free(t>>>0,1));class Ko{static __wrap(e){e>>>=0;const n=Object.create(Ko.prototype);return n.__wbg_ptr=e,Du.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Du.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_loromap_free(e,0)}constructor(){const e=w.loromap_new();return this.__wbg_ptr=e>>>0,Du.register(this,this.__wbg_ptr,this),this}kind(){return H(w.loromap_kind(this.__wbg_ptr))}set(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),i=We;w.loromap_set(r,this.__wbg_ptr,s,i,oe(n));var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}delete(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16),r=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),s=We;w.loromap_delete(o,this.__wbg_ptr,r,s);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get(e){const n=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=We;return H(w.loromap_get(this.__wbg_ptr,n,o))}getOrCreateContainer(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16),i=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),a=We;w.loromap_getOrCreateContainer(s,this.__wbg_ptr,i,a,oe(n));var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}keys(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromap_keys(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=Ln(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}values(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromap_values(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=Ln(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}entries(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromap_entries(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=Ln(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}get id(){return H(w.loromap_id(this.__wbg_ptr))}toJSON(){return H(w.loromap_toJSON(this.__wbg_ptr))}setContainer(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16),i=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),a=We;w.loromap_setContainer(s,this.__wbg_ptr,i,a,oe(n));var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}subscribe(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromap_subscribe(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get size(){return w.loromap_size(this.__wbg_ptr)>>>0}parent(){return H(w.loromap_parent(this.__wbg_ptr))}isAttached(){return w.loromap_isAttached(this.__wbg_ptr)!==0}getAttached(){return H(w.loromap_getAttached(this.__wbg_ptr))}clear(){try{const n=w.__wbindgen_add_to_stack_pointer(-16);w.loromap_clear(n,this.__wbg_ptr);var e=L().getInt32(n+0,!0);if(L().getInt32(n+4,!0))throw H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getLastEditor(e){const n=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=We;return H(w.loromap_getLastEditor(this.__wbg_ptr,n,o))}isDeleted(){return w.loromap_isDeleted(this.__wbg_ptr)!==0}getShallowValue(){return H(w.loromap_getShallowValue(this.__wbg_ptr))}}const Ru=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_loromovablelist_free(t>>>0,1));class Di{static __wrap(e){e>>>=0;const n=Object.create(Di.prototype);return n.__wbg_ptr=e,Ru.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Ru.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_loromovablelist_free(e,0)}constructor(){const e=w.loromovablelist_new();return this.__wbg_ptr=e>>>0,Ru.register(this,this.__wbg_ptr,this),this}kind(){return H(w.loromovablelist_kind(this.__wbg_ptr))}insert(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_insert(r,this.__wbg_ptr,e,oe(n));var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}delete(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_delete(r,this.__wbg_ptr,e,n);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get(e){return H(w.loromovablelist_get(this.__wbg_ptr,e))}get id(){return H(w.loromovablelist_id(this.__wbg_ptr))}toArray(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_toArray(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=Ln(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return H(w.loromovablelist_toJSON(this.__wbg_ptr))}insertContainer(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_insertContainer(s,this.__wbg_ptr,e,oe(n));var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}pushContainer(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_pushContainer(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}subscribe(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_subscribe(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get length(){return w.loromovablelist_length(this.__wbg_ptr)>>>0}parent(){return H(w.loromovablelist_parent(this.__wbg_ptr))}isAttached(){return w.loromovablelist_isAttached(this.__wbg_ptr)!==0}getAttached(){return H(w.loromovablelist_getAttached(this.__wbg_ptr))}getCursor(e,n){const o=w.loromovablelist_getCursor(this.__wbg_ptr,e,oe(n));return o===0?void 0:Zn.__wrap(o)}move(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_move(r,this.__wbg_ptr,e,n);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}set(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_set(r,this.__wbg_ptr,e,oe(n));var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}setContainer(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_setContainer(s,this.__wbg_ptr,e,oe(n));var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}push(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_push(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}pop(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_pop(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}clear(){try{const n=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_clear(n,this.__wbg_ptr);var e=L().getInt32(n+0,!0);if(L().getInt32(n+4,!0))throw H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getCreatorAt(e){return H(w.loromovablelist_getCreatorAt(this.__wbg_ptr,e))}getLastMoverAt(e){return H(w.loromovablelist_getLastMoverAt(this.__wbg_ptr,e))}getLastEditorAt(e){return H(w.loromovablelist_getLastEditorAt(this.__wbg_ptr,e))}isDeleted(){return w.loromovablelist_isDeleted(this.__wbg_ptr)!==0}getShallowValue(){return H(w.loromovablelist_getShallowValue(this.__wbg_ptr))}}const Pu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorotext_free(t>>>0,1));class Xo{static __wrap(e){e>>>=0;const n=Object.create(Xo.prototype);return n.__wbg_ptr=e,Pu.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Pu.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_lorotext_free(e,0)}constructor(){const e=w.lorotext_new();return this.__wbg_ptr=e>>>0,Pu.register(this,this.__wbg_ptr,this),this}kind(){return H(w.lorotext_kind(this.__wbg_ptr))}iter(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_iter(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}update(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),i=We;w.lorotext_update(r,this.__wbg_ptr,s,i,oe(n));var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}updateByLine(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),i=We;w.lorotext_updateByLine(r,this.__wbg_ptr,s,i,oe(n));var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}insert(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=ft(n,w.__wbindgen_export_0,w.__wbindgen_export_1),i=We;w.lorotext_insert(r,this.__wbg_ptr,e,s,i);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}slice(e,n){let o,r;try{const h=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_slice(h,this.__wbg_ptr,e,n);var s=L().getInt32(h+0,!0),i=L().getInt32(h+4,!0),a=L().getInt32(h+8,!0),l=L().getInt32(h+12,!0),c=s,d=i;if(l)throw c=0,d=0,H(a);return o=c,r=d,At(c,d)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(o,r,1)}}charAt(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_charAt(r,this.__wbg_ptr,e);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return String.fromCodePoint(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}splice(e,n,o){let r,s;try{const f=w.__wbindgen_add_to_stack_pointer(-16),m=ft(o,w.__wbindgen_export_0,w.__wbindgen_export_1),_=We;w.lorotext_splice(f,this.__wbg_ptr,e,n,m,_);var i=L().getInt32(f+0,!0),a=L().getInt32(f+4,!0),l=L().getInt32(f+8,!0),c=L().getInt32(f+12,!0),d=i,h=a;if(c)throw d=0,h=0,H(l);return r=d,s=h,At(d,h)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(r,s,1)}}insertUtf8(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=ft(n,w.__wbindgen_export_0,w.__wbindgen_export_1),i=We;w.lorotext_insertUtf8(r,this.__wbg_ptr,e,s,i);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}delete(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_delete(r,this.__wbg_ptr,e,n);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}deleteUtf8(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_deleteUtf8(r,this.__wbg_ptr,e,n);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}mark(e,n,o){try{const s=w.__wbindgen_add_to_stack_pointer(-16),i=ft(n,w.__wbindgen_export_0,w.__wbindgen_export_1),a=We;w.lorotext_mark(s,this.__wbg_ptr,oe(e),i,a,oe(o));var r=L().getInt32(s+0,!0);if(L().getInt32(s+4,!0))throw H(r)}finally{w.__wbindgen_add_to_stack_pointer(16)}}unmark(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=ft(n,w.__wbindgen_export_0,w.__wbindgen_export_1),i=We;w.lorotext_unmark(r,this.__wbg_ptr,oe(e),s,i);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}toString(){let e,n;try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_toString(s,this.__wbg_ptr);var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);return e=o,n=r,At(o,r)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(e,n,1)}}toDelta(){return H(w.lorotext_toDelta(this.__wbg_ptr))}get id(){return H(w.lorotext_id(this.__wbg_ptr))}get length(){return w.lorotext_length(this.__wbg_ptr)>>>0}subscribe(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_subscribe(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}applyDelta(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_applyDelta(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}parent(){return H(w.lorotext_parent(this.__wbg_ptr))}isAttached(){return w.lorotext_isAttached(this.__wbg_ptr)!==0}getAttached(){return H(w.lorotext_getAttached(this.__wbg_ptr))}getCursor(e,n){const o=w.lorotext_getCursor(this.__wbg_ptr,e,oe(n));return o===0?void 0:Zn.__wrap(o)}push(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16),r=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),s=We;w.lorotext_push(o,this.__wbg_ptr,r,s);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getEditorOf(e){return H(w.lorotext_getEditorOf(this.__wbg_ptr,e))}isDeleted(){return w.lorotext_isDeleted(this.__wbg_ptr)!==0}getShallowValue(){let e,n;try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_getShallowValue(s,this.__wbg_ptr);var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);return e=o,n=r,At(o,r)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(e,n,1)}}toJSON(){return H(w.lorotext_toJSON(this.__wbg_ptr))}}const Lu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorotree_free(t>>>0,1));class Ri{static __wrap(e){e>>>=0;const n=Object.create(Ri.prototype);return n.__wbg_ptr=e,Lu.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Lu.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_lorotree_free(e,0)}constructor(){const e=w.lorotree_new();return this.__wbg_ptr=e>>>0,Lu.register(this,this.__wbg_ptr,this),this}kind(){return H(w.lorotree_kind(this.__wbg_ptr))}createNode(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_createNode(s,this.__wbg_ptr,_n(e),Pn(n)?4294967297:n>>>0);var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return ao.__wrap(o)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Xt++]=void 0}}move(e,n,o){try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_move(s,this.__wbg_ptr,_n(e),_n(n),Pn(o)?4294967297:o>>>0);var r=L().getInt32(s+0,!0);if(L().getInt32(s+4,!0))throw H(r)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Xt++]=void 0,kt[Xt++]=void 0}}delete(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_delete(o,this.__wbg_ptr,_n(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Xt++]=void 0}}getNodeByID(e){try{const n=w.lorotree_getNodeByID(this.__wbg_ptr,_n(e));return n===0?void 0:ao.__wrap(n)}finally{kt[Xt++]=void 0}}get id(){return H(w.lorotree_id(this.__wbg_ptr))}has(e){try{return w.lorotree_has(this.__wbg_ptr,_n(e))!==0}finally{kt[Xt++]=void 0}}isNodeDeleted(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_isNodeDeleted(r,this.__wbg_ptr,_n(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return n!==0}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Xt++]=void 0}}toArray(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_toArray(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getNodes(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_getNodes(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return H(w.lorotree_toJSON(this.__wbg_ptr))}nodes(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_nodes(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=Ln(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}roots(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_roots(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=Ln(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}subscribe(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_subscribe(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}parent(){return H(w.lorotree_parent(this.__wbg_ptr))}isAttached(){return w.lorotree_isAttached(this.__wbg_ptr)!==0}getAttached(){return H(w.lorotree_getAttached(this.__wbg_ptr))}enableFractionalIndex(e){w.lorotree_enableFractionalIndex(this.__wbg_ptr,e)}disableFractionalIndex(){w.lorotree_disableFractionalIndex(this.__wbg_ptr)}isFractionalIndexEnabled(){return w.lorotree_isFractionalIndexEnabled(this.__wbg_ptr)!==0}isDeleted(){return w.lorotree_isDeleted(this.__wbg_ptr)!==0}getShallowValue(){return H(w.lorotree_getShallowValue(this.__wbg_ptr))}}const B0=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorotreenode_free(t>>>0,1));class ao{static __wrap(e){e>>>=0;const n=Object.create(ao.prototype);return n.__wbg_ptr=e,B0.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,B0.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_lorotreenode_free(e,0)}__getClassname(){let e,n;try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode___getClassname(s,this.__wbg_ptr);var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);return e=o,n=r,At(o,r)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(e,n,1)}}get id(){return H(w.lorotreenode_id(this.__wbg_ptr))}createNode(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_createNode(r,this.__wbg_ptr,Pn(e)?4294967297:e>>>0);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return ao.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}move(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_move(r,this.__wbg_ptr,_n(e),Pn(n)?4294967297:n>>>0);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Xt++]=void 0}}moveAfter(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);ns(e,ao),w.lorotreenode_moveAfter(o,this.__wbg_ptr,e.__wbg_ptr);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}moveBefore(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);ns(e,ao),w.lorotreenode_moveBefore(o,this.__wbg_ptr,e.__wbg_ptr);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}index(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_index(o,this.__wbg_ptr);var e=L().getFloat64(o+0,!0),n=L().getInt32(o+8,!0);if(L().getInt32(o+12,!0))throw H(n);return e===4294967297?void 0:e}finally{w.__wbindgen_add_to_stack_pointer(16)}}fractionalIndex(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_fractionalIndex(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get data(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_data(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return Ko.__wrap(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_toJSON(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}parent(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_parent(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return e===0?void 0:ao.__wrap(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}children(){return H(w.lorotreenode_children(this.__wbg_ptr))}isDeleted(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_isDeleted(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return e!==0}finally{w.__wbindgen_add_to_stack_pointer(16)}}getLastMoveId(){return H(w.lorotreenode_getLastMoveId(this.__wbg_ptr))}creationId(){return H(w.lorotreenode_creationId(this.__wbg_ptr))}creator(){return H(w.lorotreenode_creator(this.__wbg_ptr))}}const U0=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_undomanager_free(t>>>0,1)),Fu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_versionvector_free(t>>>0,1));class Fn{static __wrap(e){e>>>=0;const n=Object.create(Fn.prototype);return n.__wbg_ptr=e,Fu.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Fu.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_versionvector_free(e,0)}constructor(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_new(r,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return this.__wbg_ptr=n>>>0,Fu.register(this,this.__wbg_ptr,this),this}finally{w.__wbindgen_add_to_stack_pointer(16)}}static parseJSON(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_parseJSON(r,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return Fn.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return H(w.versionvector_toJSON(this.__wbg_ptr))}encode(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_encode(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=io(e,n).slice();return w.__wbindgen_export_3(e,1*n,1),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}static decode(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=Jo(e,w.__wbindgen_export_0),i=We;w.versionvector_decode(r,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return Fn.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_get(r,this.__wbg_ptr,oe(e));var n=L().getFloat64(r+0,!0),o=L().getInt32(r+8,!0);if(L().getInt32(r+12,!0))throw H(o);return n===4294967297?void 0:n}finally{w.__wbindgen_add_to_stack_pointer(16)}}compare(e){ns(e,Fn);const n=w.versionvector_compare(this.__wbg_ptr,e.__wbg_ptr);return n===4294967297?void 0:n}setEnd(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_setEnd(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}setLast(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_setLast(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}remove(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_remove(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}length(){return w.versionvector_length(this.__wbg_ptr)>>>0}}function V0(t,e){const n=ft(String(ye(e)),w.__wbindgen_export_0,w.__wbindgen_export_1),o=We;L().setInt32(t+4,o,!0),L().setInt32(t+0,n,!0)}function $0(){return Kt(function(t,e,n){return oe(Reflect.apply(ye(t),ye(e),ye(n)))},arguments)}function H0(t){return oe(ye(t).buffer)}function W0(){return Kt(function(t,e){return oe(ye(t).call(ye(e)))},arguments)}function q0(){return Kt(function(t,e,n){return oe(ye(t).call(ye(e),ye(n)))},arguments)}function G0(){return Kt(function(t,e,n,o,r){return oe(ye(t).call(ye(e),ye(n),ye(o),ye(r)))},arguments)}function Y0(){return Kt(function(t,e,n,o){return oe(ye(t).call(ye(e),ye(n),ye(o)))},arguments)}function J0(t){return oe(os.__wrap(t))}function K0(t){return oe(ye(t).crypto)}function X0(t){return oe(Zn.__wrap(t))}function Z0(t){return ye(t).done}function Q0(t){return oe(ye(t).entries())}function eb(t){return oe(Object.entries(ye(t)))}function tb(t,e){let n,o;try{n=t,o=e,console.error(At(t,e))}finally{w.__wbindgen_export_3(n,o,1)}}function nb(t,e){console.error(At(t,e))}function ob(t){return oe(Array.from(ye(t)))}function rb(){return Kt(function(t,e){ye(t).getRandomValues(ye(e))},arguments)}function sb(t,e){return oe(ye(t)[e>>>0])}function ib(){return Kt(function(t,e){return oe(Reflect.get(ye(t),ye(e)))},arguments)}function ab(t,e){return ye(t)[e>>>0]}function lb(t,e){return oe(ye(t)[ye(e)])}function cb(){return Kt(function(){return oe(globalThis.globalThis)},arguments)}function db(){return Kt(function(){return oe(global.global)},arguments)}function ub(t){let e;try{e=ye(t)instanceof ArrayBuffer}catch{e=!1}return e}function hb(t){let e;try{e=ye(t)instanceof Map}catch{e=!1}return e}function fb(t){let e;try{e=ye(t)instanceof Object}catch{e=!1}return e}function mb(t){let e;try{e=ye(t)instanceof Uint8Array}catch{e=!1}return e}function pb(t){return Array.isArray(ye(t))}function gb(t){return Number.isSafeInteger(ye(t))}function _b(){return oe(Symbol.iterator)}function bb(t){return ye(t).length}function yb(t){return ye(t).length}function xb(t,e,n,o,r,s,i,a){let l,c;try{l=t,c=e,console.log(At(t,e),At(n,o),At(r,s),At(i,a))}finally{w.__wbindgen_export_3(l,c,1)}}function wb(t,e){console.log(At(t,e))}function vb(t,e){let n,o;try{n=t,o=e,console.log(At(t,e))}finally{w.__wbindgen_export_3(n,o,1)}}function kb(t){return oe(Mi.__wrap(t))}function Sb(t){return oe(Oi.__wrap(t))}function Cb(t){return oe(Ko.__wrap(t))}function Nb(t){return oe(Di.__wrap(t))}function jb(t){return oe(Xo.__wrap(t))}function Eb(t){return oe(Ri.__wrap(t))}function Ib(t){return oe(ao.__wrap(t))}function Ab(t,e){performance.mark(At(t,e))}function Tb(){return Kt(function(t,e,n,o){let r,s,i,a;try{r=t,s=e,i=n,a=o,performance.measure(At(t,e),At(n,o))}finally{w.__wbindgen_export_3(r,s,1),w.__wbindgen_export_3(i,a,1)}},arguments)}function Mb(t){return oe(ye(t).msCrypto)}function Ob(){return oe(new Map)}function Db(t){return oe(new Uint8Array(ye(t)))}function Rb(){return oe(new Object)}function Pb(){return oe(new Error)}function Lb(){return oe(new Array)}function Fb(t,e){return oe(new Function(At(t,e)))}function zb(t,e,n){return oe(new Uint8Array(ye(t),e>>>0,n>>>0))}function Bb(t){return oe(new Uint8Array(t>>>0))}function Ub(t){return oe(new Array(t>>>0))}function Vb(t){return oe(ye(t).next)}function $b(){return Kt(function(t){return oe(ye(t).next())},arguments)}function Hb(t){return oe(ye(t).node)}function Wb(){return Date.now()}function qb(){return Kt(function(t){return oe(Reflect.ownKeys(ye(t)))},arguments)}function Gb(t){return oe(ye(t).process)}function Yb(t,e){return ye(t).push(ye(e))}function Jb(){return Kt(function(t,e){ye(t).randomFillSync(H(e))},arguments)}function Kb(){return Kt(function(){return oe(module.require)},arguments)}function Xb(t){return oe(Promise.resolve(ye(t)))}function Zb(){return Kt(function(){return oe(self.self)},arguments)}function Qb(){return Kt(function(t,e,n){return Reflect.set(ye(t),ye(e),ye(n))},arguments)}function ey(t,e,n){return oe(ye(t).set(ye(e),ye(n)))}function ty(t,e,n){ye(t)[H(e)]=H(n)}function ny(t,e,n){ye(t).set(ye(e),n>>>0)}function oy(t,e,n){ye(t)[e>>>0]=H(n)}function ry(t,e,n){ye(t)[e>>>0]=n}function sy(t,e){const n=ft(ye(e).stack,w.__wbindgen_export_0,w.__wbindgen_export_1),o=We;L().setInt32(t+4,o,!0),L().setInt32(t+0,n,!0)}function iy(t,e,n){return oe(ye(t).subarray(e>>>0,n>>>0))}function ay(t,e){return oe(ye(t).then(ye(e)))}function ly(t){return oe(ye(t).value)}function cy(t){return oe(ye(t).versions)}function dy(t){return oe(Fn.__wrap(t))}function uy(){return Kt(function(){return oe(window.window)},arguments)}function hy(t){return+ye(t)}function fy(t){return oe(t)}function my(t){return oe(BigInt.asUintN(64,t))}function py(t,e){const n=ye(e),o=typeof n=="bigint"?n:void 0;L().setBigInt64(t+8,Pn(o)?BigInt(0):o,!0),L().setInt32(t+0,!Pn(o),!0)}function gy(t){const e=ye(t);return typeof e=="boolean"?e?1:0:2}function _y(t){const e=H(t).original;return e.cnt--==1?(e.a=0,!0):!1}function by(t,e,n){return oe(D0(t,e,10,$5))}function yy(t,e,n){return oe(D0(t,e,8,H5))}function xy(t,e){const n=ft(Au(ye(e)),w.__wbindgen_export_0,w.__wbindgen_export_1),o=We;L().setInt32(t+4,o,!0),L().setInt32(t+0,n,!0)}function wy(t,e){return oe(new Error(At(t,e)))}function vy(t,e){return ye(t)in ye(e)}function ky(t){return Array.isArray(ye(t))}function Sy(t){return typeof ye(t)=="bigint"}function Cy(t){return!ye(t)}function Ny(t){return typeof ye(t)=="function"}function jy(t){return ye(t)===null}function Ey(t){const e=ye(t);return typeof e=="object"&&e!==null}function Iy(t){return typeof ye(t)=="string"}function Ay(t){return ye(t)===void 0}function Ty(t,e){return ye(t)===ye(e)}function My(t,e){return ye(t)==ye(e)}function Oy(){return oe(w.memory)}function Dy(t,e){const n=ye(e),o=typeof n=="number"?n:void 0;L().setFloat64(t+8,Pn(o)?0:o,!0),L().setInt32(t+0,!Pn(o),!0)}function Ry(t){return oe(t)}function Py(t){return oe(ye(t))}function Ly(t){H(t)}function Fy(t){throw H(t)}function zy(t,e){const n=ye(e),o=typeof n=="string"?n:void 0;var r=Pn(o)?0:ft(o,w.__wbindgen_export_0,w.__wbindgen_export_1),s=We;L().setInt32(t+4,s,!0),L().setInt32(t+0,r,!0)}function By(t,e){return oe(At(t,e))}function Uy(t,e){throw new Error(At(t,e))}function Vy(t){return oe(typeof ye(t))}const W5=Object.freeze(Object.defineProperty({__proto__:null,AwarenessWasm:P0,ChangeModifier:os,Cursor:Zn,EphemeralStoreWasm:class{__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,z0.unregister(this),t}free(){const t=this.__destroy_into_raw();w.__wbg_ephemeralstorewasm_free(t,0)}constructor(t){const e=w.ephemeralstorewasm_new(t);return this.__wbg_ptr=e>>>0,z0.register(this,this.__wbg_ptr,this),this}set(t,e){const n=ft(t,w.__wbindgen_export_0,w.__wbindgen_export_1),o=We;w.ephemeralstorewasm_set(this.__wbg_ptr,n,o,oe(e))}delete(t){const e=ft(t,w.__wbindgen_export_0,w.__wbindgen_export_1),n=We;w.ephemeralstorewasm_delete(this.__wbg_ptr,e,n)}get(t){const e=ft(t,w.__wbindgen_export_0,w.__wbindgen_export_1),n=We;return H(w.ephemeralstorewasm_get(this.__wbg_ptr,e,n))}getAllStates(){return H(w.ephemeralstorewasm_getAllStates(this.__wbg_ptr))}subscribeLocalUpdates(t){return H(w.ephemeralstorewasm_subscribeLocalUpdates(this.__wbg_ptr,oe(t)))}subscribe(t){return H(w.ephemeralstorewasm_subscribe(this.__wbg_ptr,oe(t)))}encode(t){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=ft(t,w.__wbindgen_export_0,w.__wbindgen_export_1),i=We;w.ephemeralstorewasm_encode(r,this.__wbg_ptr,s,i);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=io(e,n).slice();return w.__wbindgen_export_3(e,1*n,1),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}encodeAll(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.ephemeralstorewasm_encodeAll(o,this.__wbg_ptr);var t=L().getInt32(o+0,!0),e=L().getInt32(o+4,!0),n=io(t,e).slice();return w.__wbindgen_export_3(t,1*e,1),n}finally{w.__wbindgen_add_to_stack_pointer(16)}}apply(t){const e=Jo(t,w.__wbindgen_export_0),n=We;w.ephemeralstorewasm_apply(this.__wbg_ptr,e,n)}removeOutdated(){w.ephemeralstorewasm_removeOutdated(this.__wbg_ptr)}isEmpty(){return w.ephemeralstorewasm_isEmpty(this.__wbg_ptr)!==0}keys(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.ephemeralstorewasm_keys(o,this.__wbg_ptr);var t=L().getInt32(o+0,!0),e=L().getInt32(o+4,!0),n=Ln(t,e).slice();return w.__wbindgen_export_3(t,4*e,4),n}finally{w.__wbindgen_add_to_stack_pointer(16)}}},LORO_VERSION:function(){let t,e;try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.LORO_VERSION(r);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);return t=n,e=o,At(n,o)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(t,e,1)}},LoroCounter:Mi,LoroDoc:xo,LoroList:Oi,LoroMap:Ko,LoroMovableList:Di,LoroText:Xo,LoroTree:Ri,LoroTreeNode:ao,UndoManager:class{__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,U0.unregister(this),t}free(){const t=this.__destroy_into_raw();w.__wbg_undomanager_free(t,0)}constructor(t,e){ns(t,xo);const n=w.undomanager_new(t.__wbg_ptr,oe(e));return this.__wbg_ptr=n>>>0,U0.register(this,this.__wbg_ptr,this),this}undo(){try{const n=w.__wbindgen_add_to_stack_pointer(-16);w.undomanager_undo(n,this.__wbg_ptr);var t=L().getInt32(n+0,!0),e=L().getInt32(n+4,!0);if(L().getInt32(n+8,!0))throw H(e);return t!==0}finally{w.__wbindgen_add_to_stack_pointer(16)}}redo(){try{const n=w.__wbindgen_add_to_stack_pointer(-16);w.undomanager_redo(n,this.__wbg_ptr);var t=L().getInt32(n+0,!0),e=L().getInt32(n+4,!0);if(L().getInt32(n+8,!0))throw H(e);return t!==0}finally{w.__wbindgen_add_to_stack_pointer(16)}}canUndo(){return w.undomanager_canUndo(this.__wbg_ptr)!==0}canRedo(){return w.undomanager_canRedo(this.__wbg_ptr)!==0}setMaxUndoSteps(t){w.undomanager_setMaxUndoSteps(this.__wbg_ptr,t)}setMergeInterval(t){w.undomanager_setMergeInterval(this.__wbg_ptr,t)}addExcludeOriginPrefix(t){const e=ft(t,w.__wbindgen_export_0,w.__wbindgen_export_1),n=We;w.undomanager_addExcludeOriginPrefix(this.__wbg_ptr,e,n)}setOnPush(t){w.undomanager_setOnPush(this.__wbg_ptr,oe(t))}setOnPop(t){w.undomanager_setOnPop(this.__wbg_ptr,oe(t))}clear(){w.undomanager_clear(this.__wbg_ptr)}},VersionVector:Fn,__wbg_String_8f0eb39a4a4c2f66:V0,__wbg_apply_9bb7fe8fff013a3f:$0,__wbg_buffer_ef9774282e5dab94:H0,__wbg_call_0ad083564791763a:W0,__wbg_call_a34b6b4765f27be0:q0,__wbg_call_d00953b926be4879:G0,__wbg_call_efe5a4db7065d1a2:Y0,__wbg_changemodifier_new:J0,__wbg_crypto_ed58b8e10a292839:K0,__wbg_cursor_new:X0,__wbg_done_f4c254830a095eaf:Z0,__wbg_entries_4dce6361e3ba6fbc:Q0,__wbg_entries_83beb641792ccb9c:eb,__wbg_error_7534b8e9a36f1ab4:tb,__wbg_error_9912f7d6d7835a4b:nb,__wbg_from_3aa0fcaa8eef0104:ob,__wbg_getRandomValues_bcb4912f16000dc4:rb,__wbg_get_0c3cc364764a0b98:sb,__wbg_get_b996a12be035ef4f:ib,__wbg_getindex_a471648b3037c750:ab,__wbg_getwithrefkey_1dc361bd10053bfe:lb,__wbg_globalThis_6b4d52a0b6aaeaea:cb,__wbg_global_49324ce12193de77:db,__wbg_instanceof_ArrayBuffer_ff40e55b5978e215:ub,__wbg_instanceof_Map_0f3f3653f757ced1:hb,__wbg_instanceof_Object_9108547bac1f91b1:fb,__wbg_instanceof_Uint8Array_db97368f94b1373f:mb,__wbg_isArray_8738f1062fa88586:pb,__wbg_isSafeInteger_a1b3e0811faecf2f:gb,__wbg_iterator_c0c688f37fa815e6:_b,__wbg_length_12246a78d2f65d3a:bb,__wbg_length_c24da17096edfe57:yb,__wbg_log_0cc1b7768397bcfe:xb,__wbg_log_0fd6c49475c7bece:wb,__wbg_log_cb9e190acc5753fb:vb,__wbg_lorocounter_new:kb,__wbg_lorolist_new:Sb,__wbg_loromap_new:Cb,__wbg_loromovablelist_new:Nb,__wbg_lorotext_new:jb,__wbg_lorotree_new:Eb,__wbg_lorotreenode_new:Ib,__wbg_mark_7438147ce31e9d4b:Ab,__wbg_measure_fb7825c11612c823:Tb,__wbg_msCrypto_0a36e2ec3a343d26:Mb,__wbg_new_518e2184725aa711:Ob,__wbg_new_59845962d1127937:Db,__wbg_new_67abf4a77618ee3e:Rb,__wbg_new_8a6f238a6ece86ea:Pb,__wbg_new_e2d07398d7689006:Lb,__wbg_newnoargs_a136448eeb7d48ac:Fb,__wbg_newwithbyteoffsetandlength_84908302a4c137cf:zb,__wbg_newwithlength_4c216eaaf23f2f9a:Bb,__wbg_newwithlength_88b49de1eb24d63e:Ub,__wbg_next_928df8c15fc0c9b0:Vb,__wbg_next_9dc0926f351c7090:$b,__wbg_node_02999533c4ea02e3:Hb,__wbg_now_3e8577e703add0ba:Wb,__wbg_ownKeys_b16312a839a4152c:qb,__wbg_process_5c1d670bc53614b8:Gb,__wbg_push_e7d7247e69dad3ee:Yb,__wbg_randomFillSync_ab2cfe79ebbf2740:Jb,__wbg_require_79b1e9274cde3c87:Kb,__wbg_resolve_267ff08e7e1d2ce4:Xb,__wbg_self_cca3ca60d61220f4:Zb,__wbg_set_1b50d2de855a9d50:Qb,__wbg_set_393f510a6b7e9da5:ey,__wbg_set_3f1d0b984ed272ed:ty,__wbg_set_5deee49b10b2b780:ny,__wbg_set_93ba9407b5476ec6:oy,__wbg_set_wasm:Iu,__wbg_setindex_e0b7b31bfc87ba3f:ry,__wbg_stack_0ed75d68575b0f3c:sy,__wbg_subarray_2dc34705c0dc7cdb:iy,__wbg_then_84907e7a6730461e:ay,__wbg_value_51f8a88d4a1805fb:ly,__wbg_versions_c71aa1626a93e0a1:cy,__wbg_versionvector_new:dy,__wbg_window_2aba046d3fc4ad7c:uy,__wbindgen_as_number:hy,__wbindgen_bigint_from_i64:fy,__wbindgen_bigint_from_u64:my,__wbindgen_bigint_get_as_i64:py,__wbindgen_boolean_get:gy,__wbindgen_cb_drop:_y,__wbindgen_closure_wrapper483:by,__wbindgen_closure_wrapper486:yy,__wbindgen_debug_string:xy,__wbindgen_error_new:wy,__wbindgen_in:vy,__wbindgen_is_array:ky,__wbindgen_is_bigint:Sy,__wbindgen_is_falsy:Cy,__wbindgen_is_function:Ny,__wbindgen_is_null:jy,__wbindgen_is_object:Ey,__wbindgen_is_string:Iy,__wbindgen_is_undefined:Ay,__wbindgen_jsval_eq:Ty,__wbindgen_jsval_loose_eq:My,__wbindgen_memory:Oy,__wbindgen_number_get:Dy,__wbindgen_number_new:Ry,__wbindgen_object_clone_ref:Py,__wbindgen_object_drop_ref:Ly,__wbindgen_rethrow:Fy,__wbindgen_string_get:zy,__wbindgen_string_new:By,__wbindgen_throw:Uy,__wbindgen_typeof:Vy,decodeFrontiers:function(t){try{const o=w.__wbindgen_add_to_stack_pointer(-16),r=Jo(t,w.__wbindgen_export_0),s=We;w.decodeFrontiers(o,r,s);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}},decodeImportBlobMeta:function(t,e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=Jo(t,w.__wbindgen_export_0),i=We;w.decodeImportBlobMeta(r,s,i,e);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}},encodeFrontiers:function(t){try{const s=w.__wbindgen_add_to_stack_pointer(-16),i=kn(t,w.__wbindgen_export_0),a=We;w.encodeFrontiers(s,i,a);var e=L().getInt32(s+0,!0),n=L().getInt32(s+4,!0),o=L().getInt32(s+8,!0);if(L().getInt32(s+12,!0))throw H(o);var r=io(e,n).slice();return w.__wbindgen_export_3(e,1*n,1),r}finally{w.__wbindgen_add_to_stack_pointer(16)}},run:function(){w.run()},setDebug:function(){w.setDebug()}},Symbol.toStringTag,{value:"Module"}));URL=globalThis.URL;const U=await(async(t={},e)=>{let n;if(e.startsWith("data:")){const o=e.replace(/^data:.*?base64,/,"");let r;if(typeof Buffer=="function"&&typeof Buffer.from=="function")r=Buffer.from(o,"base64");else{if(typeof atob!="function")throw new Error("Cannot decode base64-encoded data URL");{const s=atob(o);r=new Uint8Array(s.length);for(let i=0;i<s.length;i++)r[i]=s.charCodeAt(i)}}n=await WebAssembly.instantiate(r,t)}else{const o=await fetch(e),r=o.headers.get("Content-Type")||"";if("instantiateStreaming"in WebAssembly&&r.startsWith("application/wasm"))n=await WebAssembly.instantiateStreaming(o,t);else{const s=await o.arrayBuffer();n=await WebAssembly.instantiate(s,t)}}return n.instance.exports})({"./loro_wasm_bg.js":{__wbindgen_object_drop_ref:Ly,__wbg_lorotree_new:Eb,__wbg_lorocounter_new:kb,__wbg_loromovablelist_new:Nb,__wbg_lorotreenode_new:Ib,__wbg_cursor_new:X0,__wbg_lorolist_new:Sb,__wbg_lorotext_new:jb,__wbg_loromap_new:Cb,__wbg_versionvector_new:dy,__wbg_changemodifier_new:J0,__wbindgen_is_function:Ny,__wbindgen_string_new:By,__wbindgen_boolean_get:gy,__wbindgen_error_new:wy,__wbindgen_object_clone_ref:Py,__wbindgen_string_get:zy,__wbindgen_is_undefined:Ay,__wbindgen_in:vy,__wbindgen_is_bigint:Sy,__wbindgen_number_get:Dy,__wbindgen_bigint_from_i64:fy,__wbindgen_jsval_eq:Ty,__wbindgen_is_object:Ey,__wbindgen_bigint_from_u64:my,__wbindgen_cb_drop:_y,__wbindgen_as_number:hy,__wbindgen_is_string:Iy,__wbindgen_is_null:jy,__wbindgen_number_new:Ry,__wbindgen_is_array:ky,__wbindgen_typeof:Vy,__wbg_error_9912f7d6d7835a4b:nb,__wbg_log_0fd6c49475c7bece:wb,__wbindgen_is_falsy:Cy,__wbindgen_jsval_loose_eq:My,__wbg_String_8f0eb39a4a4c2f66:V0,__wbg_getwithrefkey_1dc361bd10053bfe:lb,__wbg_set_3f1d0b984ed272ed:ty,__wbg_log_cb9e190acc5753fb:vb,__wbg_log_0cc1b7768397bcfe:xb,__wbg_mark_7438147ce31e9d4b:Ab,__wbg_measure_fb7825c11612c823:Tb,__wbg_new_8a6f238a6ece86ea:Pb,__wbg_stack_0ed75d68575b0f3c:sy,__wbg_error_7534b8e9a36f1ab4:tb,__wbg_now_3e8577e703add0ba:Wb,__wbg_crypto_ed58b8e10a292839:K0,__wbg_process_5c1d670bc53614b8:Gb,__wbg_versions_c71aa1626a93e0a1:cy,__wbg_node_02999533c4ea02e3:Hb,__wbg_require_79b1e9274cde3c87:Kb,__wbg_msCrypto_0a36e2ec3a343d26:Mb,__wbg_randomFillSync_ab2cfe79ebbf2740:Jb,__wbg_getRandomValues_bcb4912f16000dc4:rb,__wbg_self_cca3ca60d61220f4:Zb,__wbg_window_2aba046d3fc4ad7c:uy,__wbg_globalThis_6b4d52a0b6aaeaea:cb,__wbg_global_49324ce12193de77:db,__wbg_newnoargs_a136448eeb7d48ac:Fb,__wbg_call_0ad083564791763a:W0,__wbg_get_0c3cc364764a0b98:sb,__wbg_length_12246a78d2f65d3a:bb,__wbg_new_e2d07398d7689006:Lb,__wbg_new_518e2184725aa711:Ob,__wbg_next_928df8c15fc0c9b0:Vb,__wbg_next_9dc0926f351c7090:$b,__wbg_done_f4c254830a095eaf:Z0,__wbg_value_51f8a88d4a1805fb:ly,__wbg_iterator_c0c688f37fa815e6:_b,__wbg_get_b996a12be035ef4f:ib,__wbg_new_67abf4a77618ee3e:Rb,__wbg_newwithlength_88b49de1eb24d63e:Ub,__wbg_set_93ba9407b5476ec6:oy,__wbg_from_3aa0fcaa8eef0104:ob,__wbg_isArray_8738f1062fa88586:pb,__wbg_push_e7d7247e69dad3ee:Yb,__wbg_instanceof_ArrayBuffer_ff40e55b5978e215:ub,__wbg_call_a34b6b4765f27be0:q0,__wbg_call_efe5a4db7065d1a2:Y0,__wbg_call_d00953b926be4879:G0,__wbg_instanceof_Map_0f3f3653f757ced1:hb,__wbg_set_393f510a6b7e9da5:ey,__wbg_entries_4dce6361e3ba6fbc:Q0,__wbg_isSafeInteger_a1b3e0811faecf2f:gb,__wbg_instanceof_Object_9108547bac1f91b1:fb,__wbg_entries_83beb641792ccb9c:eb,__wbg_apply_9bb7fe8fff013a3f:$0,__wbg_ownKeys_b16312a839a4152c:qb,__wbg_set_1b50d2de855a9d50:Qb,__wbg_buffer_ef9774282e5dab94:H0,__wbg_resolve_267ff08e7e1d2ce4:Xb,__wbg_then_84907e7a6730461e:ay,__wbg_newwithbyteoffsetandlength_84908302a4c137cf:zb,__wbg_new_59845962d1127937:Db,__wbg_set_5deee49b10b2b780:ny,__wbg_length_c24da17096edfe57:yb,__wbg_instanceof_Uint8Array_db97368f94b1373f:mb,__wbg_newwithlength_4c216eaaf23f2f9a:Bb,__wbg_subarray_2dc34705c0dc7cdb:iy,__wbg_getindex_a471648b3037c750:ab,__wbg_setindex_e0b7b31bfc87ba3f:ry,__wbindgen_bigint_get_as_i64:py,__wbindgen_debug_string:xy,__wbindgen_throw:Uy,__wbindgen_rethrow:Fy,__wbindgen_memory:Oy,__wbindgen_closure_wrapper483:by,__wbindgen_closure_wrapper486:yy}},U5),q5=U.memory,G5=U.__wbg_lorocounter_free,Y5=U.lorocounter_new,J5=U.lorocounter_kind,K5=U.lorocounter_id,X5=U.lorocounter_increment,Z5=U.lorocounter_decrement,Q5=U.lorocounter_value,e6=U.lorocounter_subscribe,t6=U.lorocounter_parent,n6=U.lorocounter_isAttached,o6=U.lorocounter_getAttached,r6=U.lorocounter_getShallowValue,s6=U.__wbg_awarenesswasm_free,i6=U.awarenesswasm_new,a6=U.awarenesswasm_encode,l6=U.awarenesswasm_encodeAll,c6=U.awarenesswasm_apply,d6=U.awarenesswasm_setLocalState,u6=U.awarenesswasm_peer,h6=U.awarenesswasm_getAllStates,f6=U.awarenesswasm_getState,m6=U.awarenesswasm_getTimestamp,p6=U.awarenesswasm_removeOutdated,g6=U.awarenesswasm_length,_6=U.awarenesswasm_isEmpty,b6=U.awarenesswasm_peers,y6=U.__wbg_ephemeralstorewasm_free,x6=U.ephemeralstorewasm_new,w6=U.ephemeralstorewasm_set,v6=U.ephemeralstorewasm_delete,k6=U.ephemeralstorewasm_get,S6=U.ephemeralstorewasm_getAllStates,C6=U.ephemeralstorewasm_subscribeLocalUpdates,N6=U.ephemeralstorewasm_subscribe,j6=U.ephemeralstorewasm_encode,E6=U.ephemeralstorewasm_encodeAll,I6=U.ephemeralstorewasm_apply,A6=U.ephemeralstorewasm_removeOutdated,T6=U.ephemeralstorewasm_isEmpty,M6=U.ephemeralstorewasm_keys,O6=U.LORO_VERSION,D6=U.run,R6=U.encodeFrontiers,P6=U.decodeFrontiers,L6=U.setDebug,F6=U.__wbg_lorodoc_free,z6=U.lorodoc_new,B6=U.lorodoc_setDetachedEditing,U6=U.lorodoc_isDetachedEditingEnabled,V6=U.lorodoc_setRecordTimestamp,$6=U.lorodoc_setChangeMergeInterval,H6=U.lorodoc_configTextStyle,W6=U.lorodoc_configDefaultTextStyle,q6=U.lorodoc_fromSnapshot,G6=U.lorodoc_attach,Y6=U.lorodoc_isDetached,J6=U.lorodoc_detach,K6=U.lorodoc_fork,X6=U.lorodoc_forkAt,Z6=U.lorodoc_checkoutToLatest,Q6=U.lorodoc_travelChangeAncestors,eI=U.lorodoc_findIdSpansBetween,tI=U.lorodoc_checkout,nI=U.lorodoc_peerId,oI=U.lorodoc_peerIdStr,rI=U.lorodoc_setPeerId,sI=U.lorodoc_commit,iI=U.lorodoc_getPendingTxnLength,aI=U.lorodoc_getText,lI=U.lorodoc_getMap,cI=U.lorodoc_getList,dI=U.lorodoc_getMovableList,uI=U.lorodoc_getCounter,hI=U.lorodoc_getTree,fI=U.lorodoc_hasContainer,mI=U.lorodoc_getContainerById,pI=U.lorodoc_setNextCommitMessage,gI=U.lorodoc_setNextCommitOrigin,_I=U.lorodoc_setNextCommitTimestamp,bI=U.lorodoc_setNextCommitOptions,yI=U.lorodoc_clearNextCommitOptions,xI=U.lorodoc_getDeepValueWithID,wI=U.lorodoc_getPathToContainer,vI=U.lorodoc_JSONPath,kI=U.lorodoc_version,SI=U.lorodoc_shallowSinceVV,CI=U.lorodoc_isShallow,NI=U.lorodoc_shallowSinceFrontiers,jI=U.lorodoc_oplogVersion,EI=U.lorodoc_frontiers,II=U.lorodoc_oplogFrontiers,AI=U.lorodoc_cmpWithFrontiers,TI=U.lorodoc_cmpFrontiers,MI=U.lorodoc_exportSnapshot,OI=U.lorodoc_exportFrom,DI=U.lorodoc_export,RI=U.lorodoc_exportJsonUpdates,PI=U.lorodoc_exportJsonInIdSpan,LI=U.lorodoc_importJsonUpdates,FI=U.lorodoc_import,zI=U.lorodoc_importBatch,BI=U.lorodoc_getShallowValue,UI=U.lorodoc_toJSON,VI=U.lorodoc_subscribe,$I=U.lorodoc_subscribeLocalUpdates,HI=U.lorodoc_debugHistory,WI=U.lorodoc_changeCount,qI=U.lorodoc_opCount,GI=U.lorodoc_getAllChanges,YI=U.lorodoc_getChangeAt,JI=U.lorodoc_getChangeAtLamport,KI=U.lorodoc_getOpsInChange,XI=U.lorodoc_frontiersToVV,ZI=U.lorodoc_vvToFrontiers,QI=U.lorodoc_getByPath,e8=U.lorodoc_getCursorPos,t8=U.lorodoc_getChangedContainersIn,n8=U.lorodoc_revertTo,o8=U.lorodoc_applyDiff,r8=U.lorodoc_diff,s8=U.lorodoc_getUncommittedOpsAsJson,i8=U.lorodoc_subscribeFirstCommitFromPeer,a8=U.lorodoc_subscribePreCommit,l8=U.lorodoc_deleteRootContainer,c8=U.lorodoc_setHideEmptyRootContainers,d8=U.__wbg_lorotext_free,u8=U.lorotext_new,h8=U.lorotext_kind,f8=U.lorotext_iter,m8=U.lorotext_update,p8=U.lorotext_updateByLine,g8=U.lorotext_insert,_8=U.lorotext_slice,b8=U.lorotext_charAt,y8=U.lorotext_splice,x8=U.lorotext_insertUtf8,w8=U.lorotext_delete,v8=U.lorotext_deleteUtf8,k8=U.lorotext_mark,S8=U.lorotext_unmark,C8=U.lorotext_toString,N8=U.lorotext_toDelta,j8=U.lorotext_id,E8=U.lorotext_length,I8=U.lorotext_subscribe,A8=U.lorotext_applyDelta,T8=U.lorotext_parent,M8=U.lorotext_isAttached,O8=U.lorotext_getAttached,D8=U.lorotext_getCursor,R8=U.lorotext_push,P8=U.lorotext_getEditorOf,L8=U.lorotext_isDeleted,F8=U.lorotext_getShallowValue,z8=U.lorotext_toJSON,B8=U.__wbg_loromap_free,U8=U.loromap_new,V8=U.loromap_kind,$8=U.loromap_set,H8=U.loromap_delete,W8=U.loromap_get,q8=U.loromap_getOrCreateContainer,G8=U.loromap_keys,Y8=U.loromap_values,J8=U.loromap_entries,K8=U.loromap_id,X8=U.loromap_toJSON,Z8=U.loromap_setContainer,Q8=U.loromap_subscribe,eA=U.loromap_size,tA=U.loromap_parent,nA=U.loromap_isAttached,oA=U.loromap_getAttached,rA=U.loromap_clear,sA=U.loromap_getLastEditor,iA=U.loromap_isDeleted,aA=U.loromap_getShallowValue,lA=U.__wbg_lorolist_free,cA=U.lorolist_new,dA=U.lorolist_kind,uA=U.lorolist_insert,hA=U.lorolist_delete,fA=U.lorolist_get,mA=U.lorolist_id,pA=U.lorolist_toArray,gA=U.lorolist_toJSON,_A=U.lorolist_insertContainer,bA=U.lorolist_pushContainer,yA=U.lorolist_subscribe,xA=U.lorolist_length,wA=U.lorolist_parent,vA=U.lorolist_isAttached,kA=U.lorolist_getAttached,SA=U.lorolist_getCursor,CA=U.lorolist_push,NA=U.lorolist_pop,jA=U.lorolist_clear,EA=U.lorolist_getIdAt,IA=U.lorolist_isDeleted,AA=U.lorolist_getShallowValue,TA=U.loromovablelist_new,MA=U.loromovablelist_kind,OA=U.loromovablelist_insert,DA=U.loromovablelist_delete,RA=U.loromovablelist_get,PA=U.loromovablelist_id,LA=U.loromovablelist_toArray,FA=U.loromovablelist_toJSON,zA=U.loromovablelist_insertContainer,BA=U.loromovablelist_pushContainer,UA=U.loromovablelist_subscribe,VA=U.loromovablelist_length,$A=U.loromovablelist_parent,HA=U.loromovablelist_isAttached,WA=U.loromovablelist_getAttached,qA=U.loromovablelist_getCursor,GA=U.loromovablelist_move,YA=U.loromovablelist_set,JA=U.loromovablelist_setContainer,KA=U.loromovablelist_push,XA=U.loromovablelist_pop,ZA=U.loromovablelist_clear,QA=U.loromovablelist_getCreatorAt,eT=U.loromovablelist_getLastMoverAt,tT=U.loromovablelist_getLastEditorAt,nT=U.loromovablelist_isDeleted,oT=U.loromovablelist_getShallowValue,rT=U.__wbg_lorotree_free,sT=U.lorotreenode___getClassname,iT=U.__wbg_lorotreenode_free,aT=U.lorotreenode_id,lT=U.lorotreenode_createNode,cT=U.lorotreenode_move,dT=U.lorotreenode_moveAfter,uT=U.lorotreenode_moveBefore,hT=U.lorotreenode_index,fT=U.lorotreenode_fractionalIndex,mT=U.lorotreenode_data,pT=U.lorotreenode_toJSON,gT=U.lorotreenode_parent,_T=U.lorotreenode_children,bT=U.lorotreenode_isDeleted,yT=U.lorotreenode_getLastMoveId,xT=U.lorotreenode_creationId,wT=U.lorotreenode_creator,vT=U.lorotree_new,kT=U.lorotree_kind,ST=U.lorotree_createNode,CT=U.lorotree_move,NT=U.lorotree_delete,jT=U.lorotree_getNodeByID,ET=U.lorotree_id,IT=U.lorotree_has,AT=U.lorotree_isNodeDeleted,TT=U.lorotree_toArray,MT=U.lorotree_getNodes,OT=U.lorotree_toJSON,DT=U.lorotree_nodes,RT=U.lorotree_roots,PT=U.lorotree_subscribe,LT=U.lorotree_parent,FT=U.lorotree_isAttached,zT=U.lorotree_getAttached,BT=U.lorotree_enableFractionalIndex,UT=U.lorotree_disableFractionalIndex,VT=U.lorotree_isFractionalIndexEnabled,$T=U.lorotree_isDeleted,HT=U.lorotree_getShallowValue,WT=U.__wbg_cursor_free,qT=U.cursor_containerId,GT=U.cursor_pos,YT=U.cursor_side,JT=U.cursor_encode,KT=U.cursor_decode,XT=U.cursor_kind,ZT=U.__wbg_undomanager_free,QT=U.undomanager_new,e7=U.undomanager_undo,t7=U.undomanager_redo,n7=U.undomanager_canUndo,o7=U.undomanager_canRedo,r7=U.undomanager_setMaxUndoSteps,s7=U.undomanager_setMergeInterval,i7=U.undomanager_addExcludeOriginPrefix,a7=U.undomanager_setOnPush,l7=U.undomanager_setOnPop,c7=U.undomanager_clear,d7=U.__wbg_versionvector_free,u7=U.versionvector_new,h7=U.versionvector_parseJSON,f7=U.versionvector_toJSON,m7=U.versionvector_encode,p7=U.versionvector_decode,g7=U.versionvector_get,_7=U.versionvector_compare,b7=U.versionvector_setEnd,y7=U.versionvector_setLast,x7=U.versionvector_remove,w7=U.versionvector_length,v7=U.decodeImportBlobMeta,k7=U.__wbg_changemodifier_free,S7=U.changemodifier_setMessage,C7=U.changemodifier_setTimestamp,N7=U.lorodoc_importUpdateBatch,j7=U.__wbg_loromovablelist_free,E7=U.__wbindgen_export_0,I7=U.__wbindgen_export_1,A7=U.__wbindgen_export_2,T7=U.__wbindgen_export_3,M7=U.__wbindgen_export_4,O7=U.__wbindgen_add_to_stack_pointer,D7=U.__wbindgen_export_5,R7=U.__wbindgen_export_6,zu=U.__wbindgen_start,$y=Object.freeze(Object.defineProperty({__proto__:null,LORO_VERSION:O6,__wbg_awarenesswasm_free:s6,__wbg_changemodifier_free:k7,__wbg_cursor_free:WT,__wbg_ephemeralstorewasm_free:y6,__wbg_lorocounter_free:G5,__wbg_lorodoc_free:F6,__wbg_lorolist_free:lA,__wbg_loromap_free:B8,__wbg_loromovablelist_free:j7,__wbg_lorotext_free:d8,__wbg_lorotree_free:rT,__wbg_lorotreenode_free:iT,__wbg_undomanager_free:ZT,__wbg_versionvector_free:d7,__wbindgen_add_to_stack_pointer:O7,__wbindgen_export_0:E7,__wbindgen_export_1:I7,__wbindgen_export_2:A7,__wbindgen_export_3:T7,__wbindgen_export_4:M7,__wbindgen_export_5:D7,__wbindgen_export_6:R7,__wbindgen_start:zu,awarenesswasm_apply:c6,awarenesswasm_encode:a6,awarenesswasm_encodeAll:l6,awarenesswasm_getAllStates:h6,awarenesswasm_getState:f6,awarenesswasm_getTimestamp:m6,awarenesswasm_isEmpty:_6,awarenesswasm_length:g6,awarenesswasm_new:i6,awarenesswasm_peer:u6,awarenesswasm_peers:b6,awarenesswasm_removeOutdated:p6,awarenesswasm_setLocalState:d6,changemodifier_setMessage:S7,changemodifier_setTimestamp:C7,cursor_containerId:qT,cursor_decode:KT,cursor_encode:JT,cursor_kind:XT,cursor_pos:GT,cursor_side:YT,decodeFrontiers:P6,decodeImportBlobMeta:v7,encodeFrontiers:R6,ephemeralstorewasm_apply:I6,ephemeralstorewasm_delete:v6,ephemeralstorewasm_encode:j6,ephemeralstorewasm_encodeAll:E6,ephemeralstorewasm_get:k6,ephemeralstorewasm_getAllStates:S6,ephemeralstorewasm_isEmpty:T6,ephemeralstorewasm_keys:M6,ephemeralstorewasm_new:x6,ephemeralstorewasm_removeOutdated:A6,ephemeralstorewasm_set:w6,ephemeralstorewasm_subscribe:N6,ephemeralstorewasm_subscribeLocalUpdates:C6,lorocounter_decrement:Z5,lorocounter_getAttached:o6,lorocounter_getShallowValue:r6,lorocounter_id:K5,lorocounter_increment:X5,lorocounter_isAttached:n6,lorocounter_kind:J5,lorocounter_new:Y5,lorocounter_parent:t6,lorocounter_subscribe:e6,lorocounter_value:Q5,lorodoc_JSONPath:vI,lorodoc_applyDiff:o8,lorodoc_attach:G6,lorodoc_changeCount:WI,lorodoc_checkout:tI,lorodoc_checkoutToLatest:Z6,lorodoc_clearNextCommitOptions:yI,lorodoc_cmpFrontiers:TI,lorodoc_cmpWithFrontiers:AI,lorodoc_commit:sI,lorodoc_configDefaultTextStyle:W6,lorodoc_configTextStyle:H6,lorodoc_debugHistory:HI,lorodoc_deleteRootContainer:l8,lorodoc_detach:J6,lorodoc_diff:r8,lorodoc_export:DI,lorodoc_exportFrom:OI,lorodoc_exportJsonInIdSpan:PI,lorodoc_exportJsonUpdates:RI,lorodoc_exportSnapshot:MI,lorodoc_findIdSpansBetween:eI,lorodoc_fork:K6,lorodoc_forkAt:X6,lorodoc_fromSnapshot:q6,lorodoc_frontiers:EI,lorodoc_frontiersToVV:XI,lorodoc_getAllChanges:GI,lorodoc_getByPath:QI,lorodoc_getChangeAt:YI,lorodoc_getChangeAtLamport:JI,lorodoc_getChangedContainersIn:t8,lorodoc_getContainerById:mI,lorodoc_getCounter:uI,lorodoc_getCursorPos:e8,lorodoc_getDeepValueWithID:xI,lorodoc_getList:cI,lorodoc_getMap:lI,lorodoc_getMovableList:dI,lorodoc_getOpsInChange:KI,lorodoc_getPathToContainer:wI,lorodoc_getPendingTxnLength:iI,lorodoc_getShallowValue:BI,lorodoc_getText:aI,lorodoc_getTree:hI,lorodoc_getUncommittedOpsAsJson:s8,lorodoc_hasContainer:fI,lorodoc_import:FI,lorodoc_importBatch:zI,lorodoc_importJsonUpdates:LI,lorodoc_importUpdateBatch:N7,lorodoc_isDetached:Y6,lorodoc_isDetachedEditingEnabled:U6,lorodoc_isShallow:CI,lorodoc_new:z6,lorodoc_opCount:qI,lorodoc_oplogFrontiers:II,lorodoc_oplogVersion:jI,lorodoc_peerId:nI,lorodoc_peerIdStr:oI,lorodoc_revertTo:n8,lorodoc_setChangeMergeInterval:$6,lorodoc_setDetachedEditing:B6,lorodoc_setHideEmptyRootContainers:c8,lorodoc_setNextCommitMessage:pI,lorodoc_setNextCommitOptions:bI,lorodoc_setNextCommitOrigin:gI,lorodoc_setNextCommitTimestamp:_I,lorodoc_setPeerId:rI,lorodoc_setRecordTimestamp:V6,lorodoc_shallowSinceFrontiers:NI,lorodoc_shallowSinceVV:SI,lorodoc_subscribe:VI,lorodoc_subscribeFirstCommitFromPeer:i8,lorodoc_subscribeLocalUpdates:$I,lorodoc_subscribePreCommit:a8,lorodoc_toJSON:UI,lorodoc_travelChangeAncestors:Q6,lorodoc_version:kI,lorodoc_vvToFrontiers:ZI,lorolist_clear:jA,lorolist_delete:hA,lorolist_get:fA,lorolist_getAttached:kA,lorolist_getCursor:SA,lorolist_getIdAt:EA,lorolist_getShallowValue:AA,lorolist_id:mA,lorolist_insert:uA,lorolist_insertContainer:_A,lorolist_isAttached:vA,lorolist_isDeleted:IA,lorolist_kind:dA,lorolist_length:xA,lorolist_new:cA,lorolist_parent:wA,lorolist_pop:NA,lorolist_push:CA,lorolist_pushContainer:bA,lorolist_subscribe:yA,lorolist_toArray:pA,lorolist_toJSON:gA,loromap_clear:rA,loromap_delete:H8,loromap_entries:J8,loromap_get:W8,loromap_getAttached:oA,loromap_getLastEditor:sA,loromap_getOrCreateContainer:q8,loromap_getShallowValue:aA,loromap_id:K8,loromap_isAttached:nA,loromap_isDeleted:iA,loromap_keys:G8,loromap_kind:V8,loromap_new:U8,loromap_parent:tA,loromap_set:$8,loromap_setContainer:Z8,loromap_size:eA,loromap_subscribe:Q8,loromap_toJSON:X8,loromap_values:Y8,loromovablelist_clear:ZA,loromovablelist_delete:DA,loromovablelist_get:RA,loromovablelist_getAttached:WA,loromovablelist_getCreatorAt:QA,loromovablelist_getCursor:qA,loromovablelist_getLastEditorAt:tT,loromovablelist_getLastMoverAt:eT,loromovablelist_getShallowValue:oT,loromovablelist_id:PA,loromovablelist_insert:OA,loromovablelist_insertContainer:zA,loromovablelist_isAttached:HA,loromovablelist_isDeleted:nT,loromovablelist_kind:MA,loromovablelist_length:VA,loromovablelist_move:GA,loromovablelist_new:TA,loromovablelist_parent:$A,loromovablelist_pop:XA,loromovablelist_push:KA,loromovablelist_pushContainer:BA,loromovablelist_set:YA,loromovablelist_setContainer:JA,loromovablelist_subscribe:UA,loromovablelist_toArray:LA,loromovablelist_toJSON:FA,lorotext_applyDelta:A8,lorotext_charAt:b8,lorotext_delete:w8,lorotext_deleteUtf8:v8,lorotext_getAttached:O8,lorotext_getCursor:D8,lorotext_getEditorOf:P8,lorotext_getShallowValue:F8,lorotext_id:j8,lorotext_insert:g8,lorotext_insertUtf8:x8,lorotext_isAttached:M8,lorotext_isDeleted:L8,lorotext_iter:f8,lorotext_kind:h8,lorotext_length:E8,lorotext_mark:k8,lorotext_new:u8,lorotext_parent:T8,lorotext_push:R8,lorotext_slice:_8,lorotext_splice:y8,lorotext_subscribe:I8,lorotext_toDelta:N8,lorotext_toJSON:z8,lorotext_toString:C8,lorotext_unmark:S8,lorotext_update:m8,lorotext_updateByLine:p8,lorotree_createNode:ST,lorotree_delete:NT,lorotree_disableFractionalIndex:UT,lorotree_enableFractionalIndex:BT,lorotree_getAttached:zT,lorotree_getNodeByID:jT,lorotree_getNodes:MT,lorotree_getShallowValue:HT,lorotree_has:IT,lorotree_id:ET,lorotree_isAttached:FT,lorotree_isDeleted:$T,lorotree_isFractionalIndexEnabled:VT,lorotree_isNodeDeleted:AT,lorotree_kind:kT,lorotree_move:CT,lorotree_new:vT,lorotree_nodes:DT,lorotree_parent:LT,lorotree_roots:RT,lorotree_subscribe:PT,lorotree_toArray:TT,lorotree_toJSON:OT,lorotreenode___getClassname:sT,lorotreenode_children:_T,lorotreenode_createNode:lT,lorotreenode_creationId:xT,lorotreenode_creator:wT,lorotreenode_data:mT,lorotreenode_fractionalIndex:fT,lorotreenode_getLastMoveId:yT,lorotreenode_id:aT,lorotreenode_index:hT,lorotreenode_isDeleted:bT,lorotreenode_move:cT,lorotreenode_moveAfter:dT,lorotreenode_moveBefore:uT,lorotreenode_parent:gT,lorotreenode_toJSON:pT,memory:q5,run:D6,setDebug:L6,undomanager_addExcludeOriginPrefix:i7,undomanager_canRedo:o7,undomanager_canUndo:n7,undomanager_clear:c7,undomanager_new:QT,undomanager_redo:t7,undomanager_setMaxUndoSteps:r7,undomanager_setMergeInterval:s7,undomanager_setOnPop:l7,undomanager_setOnPush:a7,undomanager_undo:e7,versionvector_compare:_7,versionvector_decode:p7,versionvector_encode:m7,versionvector_get:g7,versionvector_length:w7,versionvector_new:u7,versionvector_parseJSON:h7,versionvector_remove:x7,versionvector_setEnd:b7,versionvector_setLast:y7,versionvector_toJSON:f7},Symbol.toStringTag,{value:"Module"}));if(zu)Iu($y),zu();else{const t=await $m(()=>Promise.resolve().then(()=>$y),void 0,import.meta.url);Iu(new WebAssembly.Instance(t.default,{"./loro_wasm_bg.js":W5}).exports)}const P7=["Map","Text","List","Tree","MovableList","Counter"];function Hy(t){if(typeof t!="object"||t==null)return!1;const e=Object.getPrototypeOf(t);return e!=null&&typeof e=="object"&&typeof e.kind=="function"&&P7.includes(t.kind())}xo.prototype.toJsonWithReplacer=function(t){const e=new Set,n=this,o=(i,a)=>{if(typeof a=="string"&&a.startsWith("cid:")&&!e.has(a)){e.add(a);const c=n.getContainerById(a);if(c==null)throw new Error(`ContainerID not found: ${a}`);const d=t(i,c);if(d===c){const h=c.getShallowValue();return typeof h=="object"?r(h):h}if(Hy(d))throw new Error("Using new container is not allowed in toJsonWithReplacer");return typeof d=="object"&&d!=null?r(d):d}if(typeof a=="object"&&a!=null)return r(a);const l=t(i,a);if(Hy(l))throw new Error("Using new container is not allowed in toJsonWithReplacer");return l},r=i=>{if(Array.isArray(i))return i.map((l,c)=>o(c,l)).filter(l=>l!==void 0);const a={};for(const[l,c]of Object.entries(i)){const d=o(l,c);d!==void 0&&(a[l]=d)}return a},s=n.getShallowValue();return r(s)};const L7=st.baseTheme({".loro-cursor":{position:"absolute",width:"2px",display:"inline-block",height:"1.2em"},".loro-cursor::before":{position:"absolute",top:"1.3em",left:"0",content:"var(--rtc-name)",padding:"2px 6px",fontSize:"12px",borderRadius:"3px",whiteSpace:"nowrap",userSelect:"none",backgroundColor:"inherit",opacity:"0.7"},".loro-selection":{opacity:"0.5"}}),Pi=Rt.define(),Bu=On.define({create:()=>({remoteCursors:new Map,isCheckout:!1}),update(t,e){for(const n of e.effects)if(n.is(Pi))switch(n.value.type){case"update":{const{peer:o,user:r,cursor:s}=n.value;t.remoteCursors.set(o,{uid:o,cursor:s,user:r});break}case"delete":t.remoteCursors.delete(n.value.peer);break;case"checkout":t.isCheckout=n.value.checkout}return t}}),Wy=t=>{const e=t.transactions.flatMap(n=>n.effects).filter(n=>n.is(Pi));return t.docChanged||t.viewportChanged||e.length>0};class kl{constructor(e,n,o,r,s){this.left=e,this.top=n,this.height=o,this.name=r,this.colorClassName=s}draw(){const e=document.createElement("div");return this.adjust(e),e}update(e){return this.adjust(e),!0}adjust(e){e.style.left=`${this.left}px`,e.style.top=`${this.top}px`,e.style.height=`${this.height}px`,e.className=`loro-cursor ${this.colorClassName}`,e.style.setProperty("--rtc-name",`"${this.name}"`)}eq(e){return this.left===e.left&&this.top===e.top&&this.height===e.height&&this.name===e.name}static createCursor(e,n,o,r){const s=kl.calculateAbsoluteCursorPosition(n,e);if(!s)return[];const i=e.scrollDOM.getBoundingClientRect(),a=(e.textDirection===qU.LTR?i.left:i.right-e.scrollDOM.clientWidth)-e.scrollDOM.scrollLeft,l=i.top-e.scrollDOM.scrollTop;return[new kl(s.left-a,s.top-l,s.bottom-s.top,o,r)]}static calculateAbsoluteCursorPosition(e,n){const o=Math.max(0,Math.min(n.state.doc.length,e.anchor));return n.coordsAtPos(o,e.assoc||1)}}const F7=(t,e,n,o)=>{const r=[],{updated:s,added:i}=n;for(const a of[...s,...i]){const l=qy(t,e,a,o);l&&r.push(l)}return r},qy=(t,e,n,o)=>{const r=e.getAllStates()[n];if(!r||n===t.peerIdStr||r.scopeId!==o)return;if(r.type==="delete")return Pi.of({type:"delete",peer:r.uid,scopeId:r.scopeId});const s=Zn.decode(r.cursor.anchor),i=t.getCursorPos(s).offset;let a=i;if(r.cursor.head){const l=Zn.decode(r.cursor.head);a=t.getCursorPos(l).offset}return Pi.of({type:"update",peer:r.uid,scopeId:r.scopeId,cursor:{anchor:i,head:a},user:r.user})};class z7{constructor(e,n,o,r,s,i,a){this.view=e,this.doc=n,this.user=o,this.awareness=r,this.getTextFromDoc=s,this.scopeId=i,this.getUserId=a,this.sub=void 0,this.sub=this.doc.subscribe(l=>{if(l.by==="local"){const c=[];for(const d of this.awareness.peers()){const h=qy(this.doc,this.awareness,d,this.scopeId);h&&c.push(h)}this.view.dispatch({effects:c})}else l.by==="checkout"&&this.view.dispatch({effects:[Pi.of({type:"checkout",checkout:this.doc.isDetached()})]})})}update(e){if(!e.selectionSet&&!e.focusChanged&&!e.docChanged)return;const n=e.state.selection.main;if(this.view.hasFocus&&!this.doc.isDetached()){const o=U7(this.doc,this.getTextFromDoc,n.anchor,n.head);this.awareness.setLocalState({type:"update",uid:this.getUserId?this.getUserId():this.doc.peerIdStr,scopeId:this.scopeId,cursor:o,user:this.user})}else this.awareness.setLocalState({type:"delete",uid:this.getUserId?this.getUserId():this.doc.peerIdStr,scopeId:this.scopeId})}destroy(){var e;(e=this.sub)==null||e.call(this),this.awareness.setLocalState({type:"delete",uid:this.getUserId?this.getUserId():this.doc.peerIdStr,scopeId:this.scopeId})}}class B7{constructor(e,n,o,r){this.view=e,this.doc=n,this.awareness=o,this.scopeId=r,this._awarenessListener=void 0;const s=async(i,a)=>{a!=="local"&&this.view.dispatch({effects:F7(this.doc,this.awareness,i,this.scopeId)})};this._awarenessListener=s,this.awareness.addListener(s)}destroy(){this._awarenessListener&&this.awareness.removeListener(this._awarenessListener)}}const U7=(t,e,n,o)=>{var i,a;n===o&&(o=void 0);const r=(i=e(t).getCursor(n))==null?void 0:i.encode();if(!r)throw new Error("cursor head not found");let s;return o!==void 0&&(s=(a=e(t).getCursor(o))==null?void 0:a.encode()),{anchor:r,head:s}},Sl=["bg-[var(--amber-6)]","bg-[var(--blue-6)]","bg-[var(--crimson-6)]","bg-[var(--cyan-6)]","bg-[var(--grass-6)]","bg-[var(--gray-6)]","bg-[var(--green-6)]","bg-[var(--lime-6)]","bg-[var(--orange-6)]","bg-[var(--purple-6)]","bg-[var(--red-6)]","bg-[var(--sage-6)]","bg-[var(--sky-6)]","bg-[var(--slate-6)]"],V7=(t,e,n)=>Mn.define(o=>new $7(o,t,e,n)),rs=Bm.define();class $7{constructor(e,n,o,r){this.view=e,this.doc=n,this.docPath=o,this.getTextFromDoc=r,this.sub=void 0,this.isInitDispatch=!1,this.onRemoteUpdate=s=>{if(s.by!=="local")if(s.by!=="checkout"){if(s.by==="import"){const i=[];let a=0;for(const{diff:l,path:c}of s.events){if(c.join("/")!==this.docPath.join("/")||l.type!=="text")continue;const d=l.diff;for(const h of d)h.insert?i.push({from:a,to:a,insert:h.insert}):h.delete?(i.push({from:a,to:a+h.delete}),a+=h.delete):h.retain!=null&&(a+=h.retain);i.length>0&&this.view.dispatch({changes:i,annotations:[rs.of(this)]})}}}else this.view.dispatch({changes:[{from:0,to:this.view.state.doc.length,insert:this.getTextFromDoc(this.doc).toString()}],annotations:[rs.of(this)]})},this.sub=n.subscribe(this.onRemoteUpdate),Promise.resolve().then(()=>{this.isInitDispatch=!0;const s=this.view.state.doc.toString(),i=this.getTextFromDoc(this.doc);s!==i.toString()&&e.dispatch({changes:[{from:0,to:this.view.state.doc.length,insert:i.toString()}]})})}update(e){if(this.isInitDispatch)return void(this.isInitDispatch=!1);if(!e.docChanged||e.transactions.length>0&&(e.transactions[0].annotation(rs)===this||e.transactions[0].annotation(rs)==="undo"))return;let n=0;e.changes.iterChanges((o,r,s,i,a)=>{const l=a.sliceString(0,a.length,`
120
- `);o!==r&&this.getTextFromDoc(this.doc).delete(o+n,r-o),l.length>0&&this.getTextFromDoc(this.doc).insert(o+n,l),n+=l.length-(r-o)}),this.doc.commit()}destroy(){var e;(e=this.sub)==null||e.call(this),this.sub=void 0}}const un=Dt.get("rtc"),Gy=un.get("awareness").disabled(),Uu="awareness:",ss=en(void 0),Wt=new xo,Cl=new class{constructor(t,e=3e4){this.listeners=new Set,this.inner=new P0(t,e),this.peer=t,this.timeout=e}apply(t,e="remote"){const{updated:n,added:o}=this.inner.apply(t);this.listeners.forEach(r=>{r({updated:n,added:o,removed:[]},e)}),this.startTimerIfNotEmpty()}setLocalState(t){const e=this.inner.getState(this.peer)==null;this.inner.setLocalState(t),e?this.listeners.forEach(n=>{n({updated:[],added:[this.inner.peer()],removed:[]},"local")}):this.listeners.forEach(n=>{n({updated:[this.inner.peer()],added:[],removed:[]},"local")}),this.startTimerIfNotEmpty()}getLocalState(){return this.inner.getState(this.peer)}getAllStates(){return this.inner.getAllStates()}encode(t){return this.inner.encode(t)}encodeAll(){return this.inner.encodeAll()}addListener(t){this.listeners.add(t)}removeListener(t){this.listeners.delete(t)}peers(){return this.inner.peers()}destroy(){clearInterval(this.timer),this.listeners.clear()}startTimerIfNotEmpty(){this.inner.isEmpty()||this.timer!=null||(this.timer=setInterval(()=>{const t=this.inner.removeOutdated();t.length>0&&this.listeners.forEach(e=>{e({updated:[],added:[],removed:t},"timeout")}),this.inner.isEmpty()&&(clearInterval(this.timer),this.timer=void 0)},this.timeout/2))}}(Wt.peerIdStr),Vu=YU(()=>{un.debug("creating websocket");const t=D4().getWsSyncURL(G4()).toString(),e=new kH(t,void 0,{maxRetries:10,debug:!1,startClosed:!0,connectionTimeout:1e4});return Promise.resolve().then(async()=>{await R4(),JU()==="edit"&&e.reconnect()}),e.addEventListener("message",async n=>{const o=n.data,r=await o.arrayBuffer(),s=new Uint8Array(r);if(function(i,a){return new TextDecoder().decode(i.slice(0,a.length))===a}(s,Uu)){const i=function(a,l){return a.slice(l.length)}(s,Uu);return Cl.apply(i),void Gy.debug("applied awareness update")}Wt.import(s),un.debug("imported doc change. new doc:",Wt.toJSON()),dt.get(ss)!==Wt&&dt.set(ss,Wt)}),e.addEventListener("open",()=>{un.debug("websocket open")}),e.addEventListener("close",n=>{un.warn("websocket close",n),dt.get(ss)===Wt&&dt.set(ss,void 0)}),e});function $u(t,e,n=""){if(In())return{extension:[],code:n};const o=Wt.getByPath(`codes/${t}`)!==void 0,r=Wt.getMap("codes").getOrCreateContainer(t,new Xo);o||(un.log("initializing code for new cell",n),r.insert(0,n));const s={get name(){return dt.get(Y4)||"Anonymous"},get colorClassName(){return(i=>{if(typeof i=="string"){let a=0;for(let l=0;l<i.length;l++)a=(a<<5)-a+i.charCodeAt(l),a=Math.trunc(a);return Sl[Math.abs(a)%Sl.length]}return Sl[i%Sl.length]})(this.name)}};return{code:n.toString(),extension:[H7(t),W7(t),q7(Wt,Cl,s,()=>r,t),V7(Wt,["codes",t],()=>r)]}}function H7(t){const e=(o,r)=>{const s=o.state.field(zc).type,i=r.toString();i&&i!==s&&(un.debug(`[incoming] setting language type: ${s} -> ${i}`),Pr(o,i,{keepCodeAsIs:!0}))},n=(o,r)=>{const s=o.state.field(Wm),i=r.toJSON();ha(s,i)||o.dispatch({effects:[W4.of(i)],annotations:[rs.of(!0)]})};return Mn.define(o=>{let r;return Promise.resolve().then(()=>{const s=Wt.getByPath(`languages/${t}`);if(!s)return void un.error("no language container found for cell",t);Bo(s instanceof Xo,"language type is not a LoroText");const i=Wt.getByPath(`language_metadata/${t}`);i?(Bo(i instanceof Ko,"language metadata is not a LoroMap"),e(o,s),n(o,i),r=Wt.subscribe(a=>{if(a.origin==="local")return;const l=a.events.some(d=>d.target===s.id),c=a.events.some(d=>d.target===i.id);l&&e(o,s),c&&n(o,i)})):un.error("no language metadata container found for cell",t)}),{destroy(){r()}}})}function W7(t){const e=Wt.getMap("languages").getOrCreateContainer(t,new Xo),n=Wt.getMap("language_metadata").getOrCreateContainer(t,new Ko);return st.updateListener.of(o=>{const r=e.toString()!=="";if(!o.docChanged&&r)return;if(!r){const i=Hm(o.state).type;Pr(o.view,i),un.debug("no initial language, setting default to",i),e.delete(0,e.length),e.insert(0,i),un.debug("no initial language metadata, setting default to",o.state.field(Wm));const a=o.state.field(Wm);for(const l of Object.keys(a))n.set(l,a[l]);return void Wt.commit()}let s=!1;for(const i of o.transactions)if(!i.annotation(rs)){for(const a of i.effects)if(a.is(GU)&&e.toString()!==a.value.type&&(un.debug(`[outgoing] language change: ${e} -> ${a.value.type}`),e.delete(0,e.length),e.insert(0,a.value.type),s=!0),a.is(W4)||a.is(q4)){const l=a.value;a.is(q4)?(un.debug("[outgoing] setting language metadata: ",l),n.clear()):un.debug("[outgoing] updating language metadata: ",l);for(const c of Object.keys(l))n.set(c,l[c]);s=!0}}s&&Wt.commit()})}function q7(t,e,n,o,r,s){const i=`loro:cell:${r}`;return[Bu,H4({above:!0,class:"loro-cursor-layer",update:Wy,markers:a=>{const{remoteCursors:l,isCheckout:c}=a.state.field(Bu);return c?[]:[...l.values()].flatMap(d=>{var f,m;const h=Uo.cursor(d.cursor.anchor);return kl.createCursor(a,h,((f=d.user)==null?void 0:f.name)||"unknown",((m=d.user)==null?void 0:m.colorClassName)||"")})}}),H4({above:!1,class:"loro-selection-layer",update:Wy,markers:a=>{const{remoteCursors:l,isCheckout:c}=a.state.field(Bu);return c?[]:[...l.entries()].filter(([,d])=>d.cursor.head!==void 0&&d.cursor.anchor!==d.cursor.head).flatMap(([,d])=>{var f;const h=Uo.range(d.cursor.anchor,d.cursor.head);return WU.forRange(a,`loro-selection ${((f=d.user)==null?void 0:f.colorClassName)||""}`,h)})}}),Mn.define(a=>new z7(a,t,n,e,o,i,s)),Mn.define(a=>new B7(a,t,e,i)),L7]}function Nl(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}$c()&&Vu(),Wt.subscribeLocalUpdates(t=>{un.debug("local update, sending to server"),Vu().send(t)}),Cl.addListener((t,e)=>{const n=[...t.added,...t.removed,...t.updated];e==="local"&&(Gy.debug("awareness changes",n),Vu().send(function(o,r){const s=new TextEncoder().encode(o);return new Uint8Array([...s,...r])}(Uu,Cl.encode(n))))});var Yy={modified:{doc:""},original:{doc:""}},Jy=A.createContext(Yy);function G7(t,e){return jt({},t,e,{modified:jt({},t.modified,e.modified),original:jt({},t.original,e.original)})}var Hu=()=>A.useContext(Jy),Y7=t=>{var{children:e,theme:n}=t,[o,r]=A.useReducer(G7,jt({},Yy,{theme:n}));return A.useEffect(()=>r({theme:n}),[n]),u.jsx(Jy.Provider,{value:jt({},o,{dispatch:r}),children:e})},J7=["extensions","value","selection","onChange"],Ky=t=>{var{extensions:e=[],value:n,selection:o,onChange:r}=t,s=va(t,J7),{theme:i,dispatch:a}=Hu(),l=ni(jt({},s,{theme:i}));return A.useEffect(()=>a({original:{doc:n,selection:o,extensions:[...l,...e]},originalExtension:{onChange:r,option:s,extension:[e]}}),[t]),null};Ky.displayName="CodeMirrorMerge.Original";var K7=["extensions","value","selection","onChange"],Xy=t=>{var{extensions:e=[],value:n,selection:o,onChange:r}=t,s=va(t,K7),{theme:i,dispatch:a}=Hu(),l=ni(jt({},s,{theme:i}));return A.useEffect(()=>{a({modified:{doc:n,selection:o,extensions:[...l,...e]},modifiedExtension:{onChange:r,option:s,extension:[e]}})},[t]),null};Xy.displayName="CodeMirrorMerge.Modified";class Tt{constructor(e,n,o,r){this.fromA=e,this.toA=n,this.fromB=o,this.toB=r}offset(e,n){return new Tt(this.fromA+e,this.toA+e,this.fromB+n,this.toB+n)}}function Ar(t,e,n,o,r,s){if(t==o)return[];let i=Gu(t,e,n,o,r,s),a=Yu(t,e+i,n,o,r+i,s),l=(n-=a)-(e+=i),c=(s-=a)-(r+=i);if(!l||!c)return[new Tt(e,n,r,s)];if(l>c){let h=t.slice(e,n).indexOf(o.slice(r,s));if(h>-1)return[new Tt(e,e+h,r,r),new Tt(e+h+c,n,s,s)]}else if(c>l){let h=o.slice(r,s).indexOf(t.slice(e,n));if(h>-1)return[new Tt(e,e,r,r+h),new Tt(n,n,r+h+l,s)]}if(l==1||c==1)return[new Tt(e,n,r,s)];let d=ex(t,e,n,o,r,s);if(d){let[h,f,m]=d;return Ar(t,e,h,o,r,f).concat(Ar(t,h+m,n,o,f+m,s))}return function(h,f,m,_,g,p){let b=m-f,y=p-g;if(Li<1e9&&Math.min(b,y)>16*Li)return Math.min(b,y)>64*Li?[new Tt(f,m,g,p)]:tx(h,f,m,_,g,p);let x=Math.ceil((b+y)/2);Wu.reset(x),qu.reset(x);let v=(N,I)=>h.charCodeAt(f+N)==_.charCodeAt(g+I),S=(N,I)=>h.charCodeAt(m-N-1)==_.charCodeAt(p-I-1),k=(b-y)%2!=0?qu:null,E=k?null:Wu;for(let N=0;N<x;N++){if(N>Li)return tx(h,f,m,_,g,p);let I=Wu.advance(N,b,y,x,k,!1,v)||qu.advance(N,b,y,x,E,!0,S);if(I)return X7(h,f,m,f+I[0],_,g,p,g+I[1])}return[new Tt(f,m,g,p)]}(t,e,n,o,r,s)}let Li=1e9;class Zy{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let n=0;n<this.len;n++)this.vec[n]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,n,o,r,s,i,a){for(let l=-e+this.start;l<=e-this.end;l+=2){let c=r+l,d=l==-e||l!=e&&this.vec[c-1]<this.vec[c+1]?this.vec[c+1]:this.vec[c-1]+1,h=d-l;for(;d<n&&h<o&&a(d,h);)d++,h++;if(this.vec[c]=d,d>n)this.end+=2;else if(h>o)this.start+=2;else if(s){let f=r+(n-o)-l;if(f>=0&&f<this.len&&s.vec[f]!=-1){if(i){let m=s.vec[f];if(m>=n-d)return[m,r+m-f]}else if(d>=n-s.vec[f])return[d,h]}}}return null}}const Wu=new Zy,qu=new Zy;function X7(t,e,n,o,r,s,i,a){let l=!1;return is(t,o)||++o!=n||(l=!0),is(r,a)||++a!=i||(l=!0),l?[new Tt(e,n,s,i)]:Ar(t,e,o,r,s,a).concat(Ar(t,o,n,r,a,i))}function Qy(t,e){let n=1,o=Math.min(t,e);for(;n<o;)n<<=1;return n}function Gu(t,e,n,o,r,s){if(e==n||e==s||t.charCodeAt(e)!=o.charCodeAt(r))return 0;let i=Qy(n-e,s-r);for(let a=e,l=r;;){let c=a+i,d=l+i;if(c>n||d>s||t.slice(a,c)!=o.slice(l,d)){if(i==1)return a-e-(is(t,a)?0:1);i>>=1}else{if(c==n||d==s)return c-e;a=c,l=d}}}function Yu(t,e,n,o,r,s){if(e==n||r==s||t.charCodeAt(n-1)!=o.charCodeAt(s-1))return 0;let i=Qy(n-e,s-r);for(let a=n,l=s;;){let c=a-i,d=l-i;if(c<e||d<r||t.slice(c,a)!=o.slice(d,l)){if(i==1)return n-a-(is(t,a)?0:1);i>>=1}else{if(c==e||d==r)return n-c;a=c,l=d}}}function Ju(t,e,n,o,r,s,i,a){let l=o.slice(r,s),c=null;for(;;){if(c||i<a)return c;for(let d=e+i;;){is(t,d)||d++;let h=d+i;if(is(t,h)||(h+=h==d+1?1:-1),h>=n)break;let f=t.slice(d,h),m=-1;for(;(m=l.indexOf(f,m+1))!=-1;){let _=Gu(t,h,n,o,r+m+f.length,s),g=Yu(t,e,d,o,r,r+m),p=f.length+_+g;(!c||c[2]<p)&&(c=[d-g,r+m-g,p])}d=h}if(a<0)return c;i>>=1}}function ex(t,e,n,o,r,s){let i=n-e,a=s-r;if(i<a){let l=ex(o,r,s,t,e,n);return l&&[l[1],l[0],l[2]]}return i<4||2*a<i?null:Ju(t,e,n,o,r,s,Math.floor(i/4),-1)}function tx(t,e,n,o,r,s){let i,a=n-e,l=s-r;if(a<l){let f=Ju(o,r,s,t,e,n,Math.floor(a/6),50);i=f&&[f[1],f[0],f[2]]}else i=Ju(t,e,n,o,r,s,Math.floor(l/6),50);if(!i)return[new Tt(e,n,r,s)];let[c,d,h]=i;return Ar(t,e,c,o,r,d).concat(Ar(t,c+h,n,o,d+h,s))}function nx(t,e){for(let n=1;n<t.length;n++){let o=t[n-1],r=t[n];o.toA>r.fromA-e&&o.toB>r.fromB-e&&(t[n-1]=new Tt(o.fromA,r.toA,o.fromB,r.toB),t.splice(n--,1))}}let Tr;try{Tr=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function ox(t){return t>48&&t<58||t>64&&t<91||t>96&&t<123}function rx(t,e){if(e==t.length)return 0;let n=t.charCodeAt(e);return n<192?ox(n)?1:0:Tr?lx(n)&&e!=t.length-1?Tr.test(t.slice(e,e+2))?2:0:Tr.test(String.fromCharCode(n))?1:0:0}function sx(t,e){if(!e)return 0;let n=t.charCodeAt(e-1);return n<192?ox(n)?1:0:Tr?cx(n)&&e!=1?Tr.test(t.slice(e-2,e))?2:0:Tr.test(String.fromCharCode(n))?1:0:0}function ix(t,e,n){if(e==t.length||!sx(t,e))return e;for(let o=e,r=e+n;;){let s=rx(t,o);if(!s)return o;if(o+=s,o>r)return e}}function ax(t,e,n){if(!e||!rx(t,e))return e;for(let o=e,r=e-n;;){let s=sx(t,o);if(!s)return o;if(o-=s,o<r)return e}}function Z7(t,e,n){for(let o=e,r=e-n;;){let s=o?t.charCodeAt(o-1):10;if(s==10)return o;if(o--,o<r||s!=32&&s!=9)return e}}const lx=t=>t>=55296&&t<=56319,cx=t=>t>=56320&&t<=57343;function is(t,e){return!e||e==t.length||!lx(t.charCodeAt(e-1))||!cx(t.charCodeAt(e))}function Q7(t,e,n){var o;return Li=((o=n==null?void 0:n.scanLimit)!==null&&o!==void 0?o:1e9)>>1,function(r,s,i){for(;;){nx(i,1);let a=!1;for(let l=0;l<i.length;l++){let c,d,h=i[l];(c=Gu(r,h.fromA,h.toA,s,h.fromB,h.toB))&&(h=i[l]=new Tt(h.fromA+c,h.toA,h.fromB+c,h.toB)),(d=Yu(r,h.fromA,h.toA,s,h.fromB,h.toB))&&(h=i[l]=new Tt(h.fromA,h.toA-d,h.fromB,h.toB-d));let f=h.toA-h.fromA,m=h.toB-h.fromB;if(f&&m)continue;let _=h.fromA-(l?i[l-1].toA:0),g=(l<i.length-1?i[l+1].fromA:r.length)-h.toA;if(!_||!g)continue;let p=f?r.slice(h.fromA,h.toA):s.slice(h.fromB,h.toB);_<=p.length&&r.slice(h.fromA-_,h.fromA)==p.slice(p.length-_)?(i[l]=new Tt(h.fromA-_,h.toA-_,h.fromB-_,h.toB-_),a=!0):g<=p.length&&r.slice(h.toA,h.toA+g)==p.slice(0,g)&&(i[l]=new Tt(h.fromA+g,h.toA+g,h.fromB+g,h.toB+g),a=!0)}if(!a)break}return i}(t,e,Ar(t,0,t.length,e,0,e.length))}function dx(t,e,n){return function(o,r,s){for(let i=0,a=0;a<o.length;a++){let l=o[a],c=l.toA-l.fromA,d=l.toB-l.fromB;if(c&&d||c>3||d>3){let h=a==o.length-1?r.length:o[a+1].fromA,f=l.fromA-i,m=h-l.toA,_=ax(r,l.fromA,Math.min(f,5)),g=ix(r,l.toA,Math.min(m,5)),p=l.fromA-_,b=g-l.toA;if(!c||!d){let y,x,v=Math.max(c,d),[S,k,E]=c?[r,l.fromA,l.toA]:[s,l.fromB,l.toB];p&&b?(v>p&&r.slice(_,l.fromA)==S.slice(E-p,E)?(l=o[a]=new Tt(_,_+c,l.fromB-p,l.toB-p),_=l.fromA,g=ix(r,l.toA,Math.min(h-l.toA,5))):v>b&&r.slice(l.toA,g)==S.slice(k,k+b)&&(l=o[a]=new Tt(g-c,g,l.fromB+b,l.toB+b),g=l.toA,_=ax(r,l.fromA,Math.min(l.fromA-i,5))),p=l.fromA-_,b=g-l.toA):p||b||!(x=l.fromA-(y=Z7(r,l.fromA,f)))||r.slice(y,l.fromA)!=S.slice(E-x,E)||(l=o[a]=new Tt(y,y+c,l.fromB-x,l.toB-x))}(p||b)&&(l=o[a]=new Tt(l.fromA-p,l.toA+b,l.fromB-p,l.toB+b)),i=l.toA}}return nx(o,3),o}(Q7(t,e,n),t,e)}const lo=Zs.define({combine:t=>t[0]}),Ku=Rt.define(),as=On.define({create:t=>null,update(t,e){for(let n of e.effects)n.is(Ku)&&(t=n.value);return t}});class ls{constructor(e,n,o,r,s){this.changes=e,this.fromA=n,this.toA=o,this.fromB=r,this.toB=s}offset(e,n){return e||n?new ls(this.changes,this.fromA+e,this.toA+e,this.fromB+n,this.toB+n):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,n,o){return fx(dx(e.toString(),n.toString(),o),e,n,0,0)}static updateA(e,n,o,r,s){return gx(px(e,r,!0,o.length),e,n,o,s)}static updateB(e,n,o,r,s){return gx(px(e,r,!1,n.length),e,n,o,s)}}function ux(t,e,n,o){let r=n.lineAt(t),s=o.lineAt(e);return r.to==t&&s.to==e&&t<n.length&&e<o.length?[t+1,e+1]:[r.from,s.from]}function hx(t,e,n,o){let r=n.lineAt(t),s=o.lineAt(e);return r.from==t&&s.from==e?[t,e]:[r.to+1,s.to+1]}function fx(t,e,n,o,r){let s=[];for(let i=0;i<t.length;i++){let a=t[i],[l,c]=ux(a.fromA+o,a.fromB+r,e,n),[d,h]=hx(a.toA+o,a.toB+r,e,n),f=[a.offset(-l+o,-c+r)];for(;i<t.length-1;){let m=t[i+1],[_,g]=ux(m.fromA+o,m.fromB+r,e,n);if(_>d+1&&g>h+1)break;f.push(m.offset(-l+o,-c+r)),[d,h]=hx(m.toA+o,m.toB+r,e,n),i++}s.push(new ls(f,l,Math.max(l,d),c,Math.max(c,h)))}return s}const jl=1e3;function mx(t,e,n,o){let r=0,s=t.length;for(;;){if(r==s){let d=0,h=0;r&&({toA:d,toB:h}=t[r-1]);let f=e-(n?d:h);return[d+f,h+f]}let i=r+s>>1,a=t[i],[l,c]=n?[a.fromA,a.toA]:[a.fromB,a.toB];if(l>e)s=i;else{if(!(c<=e))return o?[a.fromA,a.fromB]:[a.toA,a.toB];r=i+1}}}function px(t,e,n,o){let r=[];return e.iterChangedRanges((s,i,a,l)=>{let c=0,d=n?e.length:o,h=0,f=n?o:e.length;s>jl&&([c,h]=mx(t,s-jl,n,!0)),i<e.length-jl&&([d,f]=mx(t,i+jl,n,!1));let m,_=l-a-(i-s),[g,p]=n?[_,0]:[0,_];r.length&&(m=r[r.length-1]).toA>=c?r[r.length-1]={fromA:m.fromA,fromB:m.fromB,toA:d,toB:f,diffA:m.diffA+g,diffB:m.diffB+p}:r.push({fromA:c,toA:d,fromB:h,toB:f,diffA:g,diffB:p})}),r}function gx(t,e,n,o,r){if(!t.length)return e;let s=0,i=0,a=0,l=[];for(let c of t){let d=c.fromA+i,h=c.toA+i+c.diffA,f=c.fromB+a,m=c.toB+a+c.diffB;for(;s<e.length;){let _=e[s];if(_.toA+i<=d&&_.toB+a<=f)l.push(_.offset(i,a));else if(_.fromA+i>h)break;s++}for(let _ of fx(dx(n.sliceString(d,h),o.sliceString(f,m),r),n,o,d,f))l.push(_);for(i+=c.diffA,a+=c.diffB;s<e.length;){let _=e[s];if(_.fromA>h+i&&_.fromB>m+a)break;s++}}for(;s<e.length;)l.push(e[s++].offset(i,a));return l}const _x=Mn.fromClass(class{constructor(t){({deco:this.deco,gutter:this.gutter}=xx(t))}update(t){var e,n;(t.docChanged||t.viewportChanged||(e=t.startState,n=t.state,e.field(as,!1)!=n.field(as,!1))||function(o,r){return o.facet(lo)!=r.facet(lo)}(t.startState,t.state))&&({deco:this.deco,gutter:this.gutter}=xx(t.view))}},{decorations:t=>t.deco}),El=$o.low(XU({class:"cm-changeGutter",markers:t=>{var e;return((e=t.plugin(_x))===null||e===void 0?void 0:e.gutter)||qm.empty}})),bx=ut.line({class:"cm-changedLine"}),eM=ut.mark({class:"cm-changedText"}),tM=ut.mark({tagName:"ins",class:"cm-insertedLine"}),nM=ut.mark({tagName:"del",class:"cm-deletedLine"}),yx=new class extends ZU{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function oM(t,e,n,o,r,s){let i=n?t.fromA:t.fromB,a=n?t.toA:t.toB,l=0;if(i!=a){r.add(i,i,bx),r.add(i,a,n?nM:tM),s&&s.add(i,i,yx);for(let c=e.iterRange(i,a-1),d=i;!c.next().done;){if(c.lineBreak){d++,r.add(d,d,bx),s&&s.add(d,d,yx);continue}let h=d+c.value.length;if(o)for(;l<t.changes.length;){let f=t.changes[l],m=i+(n?f.fromA:f.fromB),_=i+(n?f.toA:f.toB),g=Math.max(d,m),p=Math.min(h,_);if(g<p&&r.add(g,p,eM),!(_<h))break;l++}d=h}}}function xx(t){let e=t.state.field(as),{side:n,highlightChanges:o,markGutter:r}=t.state.facet(lo),s=n=="a",i=new Ys,a=r?new Ys:null,{from:l,to:c}=t.viewport;for(let d of e){if((s?d.fromA:d.fromB)>=c)break;(s?d.toA:d.toB)>l&&oM(d,t.state.doc,s,o,i,a)}return{deco:i.finish(),gutter:a&&a.finish()}}class Il extends Qs{constructor(e){super(),this.height=e}eq(e){return this.height==e.height}toDOM(){let e=document.createElement("div");return e.className="cm-mergeSpacer",e.style.height=this.height+"px",e}updateDOM(e){return e.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}const Al=Rt.define({map:(t,e)=>t.map(e)}),Fi=On.define({create:()=>ut.none,update:(t,e)=>{for(let n of e.effects)if(n.is(Al))return n.value;return t.map(e.changes)},provide:t=>st.decorations.from(t)}),Xu=.01,Zu=Rt.define({map:(t,e)=>e.mapPos(t)});class rM extends Qs{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let n=document.createElement("div");return n.className="cm-collapsedLines",n.textContent="\u299A "+e.state.phrase("$ unchanged lines",this.lines)+" \u299A",n.addEventListener("click",o=>{let r=e.posAtDOM(o.target);e.dispatch({effects:Zu.of(r)});let{side:s,sibling:i}=e.state.facet(lo);i&&i().dispatch({effects:Zu.of(sM(r,e.state.field(as),s=="a"))})}),n}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}}function sM(t,e,n){let o=0,r=0;for(let s=0;;s++){let i=s<e.length?e[s]:null;if(!i||(n?i.fromA:i.fromB)>=t)return r+(t-o);[o,r]=n?[i.toA,i.toB]:[i.toB,i.toA]}}const iM=On.define({create:t=>ut.none,update(t,e){t=t.map(e.changes);for(let n of e.effects)n.is(Zu)&&(t=t.update({filter:o=>o!=n.value}));return t},provide:t=>st.decorations.from(t)});function wx({margin:t=3,minSize:e=4}){return iM.init(n=>function(o,r,s){let i=new Ys,a=o.facet(lo).side=="a",l=o.field(as),c=1;for(let d=0;;d++){let h=d<l.length?l[d]:null,f=d?c+r:1,m=h?o.doc.lineAt(a?h.fromA:h.fromB).number-1-r:o.doc.lines,_=m-f+1;if(_>=s&&i.add(o.doc.line(f).from,o.doc.line(m).to,ut.replace({widget:new rM(_),block:!0})),!h)break;c=o.doc.lineAt(Math.min(o.doc.length,a?h.toA:h.toB)).number}return i.finish()}(n,t,e))}const aM=st.styleModule.of(new KU({".cm-mergeView":{overflowY:"auto"},".cm-mergeViewEditors":{display:"flex",alignItems:"stretch"},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:"hidden"},".cm-merge-revert":{width:"1.6em",flexGrow:0,flexShrink:0,position:"relative"},".cm-merge-revert button":{position:"absolute",display:"block",width:"100%",boxSizing:"border-box",textAlign:"center",background:"none",border:"none",font:"inherit",cursor:"pointer"}})),lM=st.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:"auto !important",overflowY:"visible !important"},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:"rgba(160, 128, 100, .08)"},"&.cm-merge-b .cm-changedLine":{backgroundColor:"rgba(100, 160, 128, .08)"},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat"},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat"},"&light.cm-merge-b .cm-changedText":{background:"linear-gradient(#22bb2266, #22bb2266) bottom/100% 2px no-repeat"},"&dark.cm-merge-b .cm-changedText":{background:"linear-gradient(#88ff8866, #88ff8866) bottom/100% 2px no-repeat"},".cm-insertedLine, .cm-deletedLine":{textDecoration:"none"},".cm-deletedChunk":{paddingLeft:"6px","& .cm-chunkButtons":{position:"absolute",insetInlineEnd:"5px"},"& button":{border:"none",cursor:"pointer",color:"white",margin:"0 2px",borderRadius:"3px","&[name=accept]":{background:"#2a2"},"&[name=reject]":{background:"#d43"}}},".cm-collapsedLines":{padding:"5px 5px 5px 10px",cursor:"pointer"},"&light .cm-collapsedLines":{color:"#444",background:"linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)"},"&dark .cm-collapsedLines":{color:"#ddd",background:"linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)"},".cm-changeGutter":{width:"3px",paddingLeft:"1px"},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:"#e43"},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:"#fa9"},"&light.cm-merge-b .cm-changedLineGutter":{background:"#2b2"},"&dark.cm-merge-b .cm-changedLineGutter":{background:"#8f8"}}),vx=new Fc,Tl=new Fc;class kx{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig;let n=[$o.low(_x),lM,aM,Fi,st.updateListener.of(h=>{this.measuring<0&&(h.heightChanged||h.viewportChanged)&&!h.transactions.some(f=>f.effects.some(m=>m.is(Al)))&&this.measure()})],o=[lo.of({side:"a",sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&o.push(El);let r=fr.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],st.editorAttributes.of({class:"cm-merge-a"}),Tl.of(o),n]}),s=[lo.of({side:"b",sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&s.push(El);let i=fr.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],st.editorAttributes.of({class:"cm-merge-b"}),Tl.of(s),n]});this.chunks=ls.build(r.doc,i.doc,this.diffConf);let a=[as.init(()=>this.chunks),vx.of(e.collapseUnchanged?wx(e.collapseUnchanged):[])];r=r.update({effects:Rt.appendConfig.of(a)}).state,i=i.update({effects:Rt.appendConfig.of(a)}).state,this.dom=document.createElement("div"),this.dom.className="cm-mergeView",this.editorDOM=this.dom.appendChild(document.createElement("div")),this.editorDOM.className="cm-mergeViewEditors";let l=e.orientation||"a-b",c=document.createElement("div");c.className="cm-mergeViewEditor";let d=document.createElement("div");d.className="cm-mergeViewEditor",this.editorDOM.appendChild(l=="a-b"?c:d),this.editorDOM.appendChild(l=="a-b"?d:c),this.a=new st({state:r,parent:c,root:e.root,dispatchTransactions:h=>this.dispatch(h,this.a)}),this.b=new st({state:i,parent:d,root:e.root,dispatchTransactions:h=>this.dispatch(h,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls=="b-to-a",e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,n){if(e.some(o=>o.docChanged)){let o=e[e.length-1],r=e.reduce((i,a)=>i.compose(a.changes),xa.empty(e[0].startState.doc.length));this.chunks=n==this.a?ls.updateA(this.chunks,o.newDoc,this.b.state.doc,r,this.diffConf):ls.updateB(this.chunks,this.a.state.doc,o.newDoc,r,this.diffConf),n.update([...e,o.state.update({effects:Ku.of(this.chunks)})]);let s=n==this.a?this.b:this.a;s.update([s.state.update({effects:Ku.of(this.chunks)})]),this.scheduleMeasure()}else n.update(e)}reconfigure(e){if("diffConfig"in e&&(this.diffConf=e.diffConfig),"orientation"in e){let s=e.orientation!="b-a";if(s!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let i=this.a.dom.parentNode,a=this.b.dom.parentNode;i.remove(),a.remove(),this.editorDOM.insertBefore(s?i:a,this.editorDOM.firstChild),this.editorDOM.appendChild(s?a:i),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in e||"renderRevertControl"in e){let s=!!this.revertDOM,i=this.revertToA,a=this.renderRevert;"revertControls"in e&&(s=!!e.revertControls,i=e.revertControls=="b-to-a"),"renderRevertControl"in e&&(a=e.renderRevertControl),this.setupRevertControls(s,i,a)}let n="highlightChanges"in e,o="gutter"in e,r="collapseUnchanged"in e;if(n||o||r){let s=[],i=[];if(n||o){let a=this.a.state.facet(lo),l=o?e.gutter!==!1:a.markGutter,c=n?e.highlightChanges!==!1:a.highlightChanges;s.push(Tl.reconfigure([lo.of({side:"a",sibling:()=>this.b,highlightChanges:c,markGutter:l}),l?El:[]])),i.push(Tl.reconfigure([lo.of({side:"b",sibling:()=>this.a,highlightChanges:c,markGutter:l}),l?El:[]]))}if(r){let a=vx.reconfigure(e.collapseUnchanged?wx(e.collapseUnchanged):[]);s.push(a),i.push(a)}this.a.dispatch({effects:s}),this.b.dispatch({effects:i})}this.scheduleMeasure()}setupRevertControls(e,n,o){this.revertToA=n,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=o,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement("div"),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener("mousedown",r=>this.revertClicked(r)),this.revertDOM.className="cm-merge-revert"):this.revertDOM&&(this.revertDOM.textContent="")}scheduleMeasure(){if(this.measuring<0){let e=this.dom.ownerDocument.defaultView||window;this.measuring=e.requestAnimationFrame(()=>{this.measuring=-1,this.measure()})}}measure(){(function(e,n,o){let r=new Ys,s=new Ys,i=e.state.field(Fi).iter(),a=n.state.field(Fi).iter(),l=0,c=0,d=0,h=0;for(let g=0;;g++){let p=g<o.length?o[g]:null;if(l<(p?p.fromA:e.state.doc.length)){let b=e.lineBlockAt(l).top+d-(n.lineBlockAt(c).top+h);b<-.01?(d-=b,r.add(l,l,ut.widget({widget:new Il(-b),block:!0,side:-1}))):b>Xu&&(h+=b,s.add(c,c,ut.widget({widget:new Il(b),block:!0,side:-1})))}if(!p)break;for(l=p.toA,c=p.toB;i.value&&i.from<l;)d-=i.value.spec.widget.height,i.next();for(;a.value&&a.from<c;)h-=a.value.spec.widget.height,a.next()}for(;i.value;)d-=i.value.spec.widget.height,i.next();for(;a.value;)h-=a.value.spec.widget.height,a.next();let f=e.contentHeight+d-(n.contentHeight+h);f<Xu?r.add(e.state.doc.length,e.state.doc.length,ut.widget({widget:new Il(-f),block:!0,side:1})):f>Xu&&s.add(n.state.doc.length,n.state.doc.length,ut.widget({widget:new Il(f),block:!0,side:1}));let m=r.finish(),_=s.finish();qm.eq([m],[e.state.field(Fi)])||e.dispatch({effects:Al.of(m)}),qm.eq([_],[n.state.field(Fi)])||n.dispatch({effects:Al.of(_)})})(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,n=e.firstChild,o=this.a.viewport,r=this.b.viewport;for(let s=0;s<this.chunks.length;s++){let i=this.chunks[s];if(i.fromA>o.to||i.fromB>r.to)break;if(i.fromA<o.from||i.fromB<r.from)continue;let a=this.a.lineBlockAt(i.fromA).top+"px";for(;n&&+n.dataset.chunk<s;)n=Sx(n);n&&n.dataset.chunk==String(s)?(n.style.top!=a&&(n.style.top=a),n=n.nextSibling):e.insertBefore(this.renderRevertButton(a,s),n)}for(;n;)n=Sx(n)}renderRevertButton(e,n){let o;if(this.renderRevert)o=this.renderRevert();else{o=document.createElement("button");let r=this.a.state.phrase("Revert this chunk");o.setAttribute("aria-label",r),o.setAttribute("title",r),o.textContent=this.revertToLeft?"\u21DC":"\u21DD"}return o.style.top=e,o.setAttribute("data-chunk",String(n)),o}revertClicked(e){let n,o=e.target;for(;o&&o.parentNode!=this.revertDOM;)o=o.parentNode;if(o&&(n=this.chunks[o.dataset.chunk])){let[r,s,i,a,l,c]=this.revertToA?[this.b,this.a,n.fromB,n.toB,n.fromA,n.toA]:[this.a,this.b,n.fromA,n.toA,n.fromB,n.toB],d=r.state.sliceDoc(i,Math.max(i,a-1));i!=a&&c<=s.state.doc.length&&(d+=r.state.lineBreak),s.dispatch({changes:{from:l,to:Math.min(s.state.doc.length,c),insert:d},userEvent:"revert"}),e.preventDefault()}}destroy(){this.a.destroy(),this.b.destroy(),this.measuring>-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}}function Sx(t){let e=t.nextSibling;return t.remove(),e}var cM=["className","children","orientation","revertControls","highlightChanges","gutter","collapseUnchanged","destroyRerender","renderRevertControl","diffConfig"],dM=["modified","modifiedExtension","original","originalExtension","theme","dispatch"],Cx=Y.forwardRef((t,e)=>{var{className:n,children:o,orientation:r,revertControls:s,highlightChanges:i,gutter:a,collapseUnchanged:l,destroyRerender:c=!0,renderRevertControl:d,diffConfig:h}=t,f=va(t,cM),m=Hu(),{modified:_,modifiedExtension:g,original:p,originalExtension:b,theme:y,dispatch:x}=m,v=va(m,dM),S=A.useRef(null),k=A.useRef(),E={orientation:r,revertControls:s,highlightChanges:i,gutter:a,collapseUnchanged:l,renderRevertControl:d,diffConfig:h};A.useImperativeHandle(e,()=>({container:S.current,view:k.current,modified:_,original:p,config:jt({a:p,b:_,parent:S.current},E)}),[S,k,_,p,E]);var N=st.updateListener.of(T=>{if(T.docChanged&&typeof(b==null?void 0:b.onChange)=="function"){var M=T.state.doc.toString();b==null||b.onChange(M,T)}}),I=st.updateListener.of(T=>{if(T.docChanged&&typeof(g==null?void 0:g.onChange)=="function"){var M=T.state.doc.toString();g==null||g.onChange(M,T)}});return A.useEffect(()=>{!k.current&&S.current&&b&&g&&(k.current=new kx(jt({a:jt({},p,{extensions:[...(b==null?void 0:b.extension)||[],...ni(jt({},b==null?void 0:b.option,{theme:y})),N]}),b:jt({},_,{extensions:[...(g==null?void 0:g.extension)||[],...ni(jt({},g==null?void 0:g.option,{theme:y})),I]}),parent:S.current},E)),x({view:k.current}))},[k,S,b,g]),A.useEffect(()=>{if(p&&p.doc&&k.current){var T,M,R=(T=k.current)==null?void 0:T.a.state.doc.toString();R!==p.doc&&((M=k.current)==null||M.a.dispatch({changes:{from:0,to:R.length,insert:p.doc||""}}))}if(_&&_.doc&&k.current){var z,D,F=(z=k.current)==null?void 0:z.b.state.doc.toString();F!==_.doc&&((D=k.current)==null||D.b.dispatch({changes:{from:0,to:F.length,insert:_.doc||""}}))}if(c&&k.current){var B=k.current.a.state.selection.ranges[0].from,V=k.current.b.state.selection.ranges[0].from;k.current.destroy(),k.current=new kx(jt({a:jt({},p,{extensions:[...(b==null?void 0:b.extension)||[],...ni(jt({},b==null?void 0:b.option,{theme:y}))]}),b:jt({},_,{extensions:[...(g==null?void 0:g.extension)||[],...ni(jt({},g==null?void 0:g.option,{theme:y}))]}),parent:S.current},E)),B&&(k.current.a.focus(),k.current.a.dispatch({selection:{anchor:B,head:B}})),V&&(k.current.b.focus(),k.current.b.dispatch({selection:{anchor:V,head:V}}))}},[k,y,S.current,p,_,b,g,c]),A.useEffect(()=>()=>k.current&&k.current.destroy(),[]),A.useEffect(()=>{if(k.current){var T={};v.orientation!==r&&(T.orientation=r),v.revertControls!==s&&(T.revertControls=s),v.highlightChanges!==i&&(T.highlightChanges=i),v.gutter!==a&&(T.gutter=a),v.collapseUnchanged!==l&&(T.collapseUnchanged=l),v.renderRevertControl!==d&&(T.collapseUnchanged=l),Object.keys(T).length&&x&&k.current&&(k.current.reconfigure(jt({},T)),x(jt({},T)))}},[x,k,r,s,i,a,l,d]),u.jsx("div",jt({ref:S,className:"cm-merge-theme"+(n?" "+n:"")},f,{children:o}))});Cx.displayName="CodeMirrorMerge.Internal";var uM=["theme"],cs=Y.forwardRef((t,e)=>{var{theme:n}=t,o=va(t,uM);return u.jsx(Y7,{theme:n,children:u.jsx(Cx,jt({},o,{ref:e}))})});cs.Original=Ky,cs.Modified=Xy,cs.displayName="CodeMirrorMerge";const hM=cs.Original,fM=cs.Modified,Nx=[eV(),st.lineWrapping],mM=t=>{const e=J.c(42),{className:n,onChange:o,initialPrompt:r,currentLanguageAdapter:s,currentCode:i,declineChange:a,acceptChange:l,enabled:c,children:d}=t;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={},e[0]=h):h=e[0];const[f,m]=A.useState(h),[_,g]=an(hC),p=Gm(),{completion:b,input:y,stop:x,isLoading:v,setCompletion:S,setInput:k,handleSubmit:E}=QU({api:p.getAiURL("completion").toString(),headers:p.headers(),initialInput:r,streamProtocol:"text",experimental_throttle:100,body:{...f,includeOtherCode:_?Lc(i):"",code:i,language:s},onError:pM,onFinish:(Z,q)=>{N(q.trimEnd())}}),N=S,I=Y.useRef(null);let T,M,R,z;e[1]!==c?(T=()=>{var q;const Z=I.current;c&&Z&&(requestAnimationFrame(()=>{var ne;(ne=Z.view)==null||ne.focus()}),tV((q=I.current)==null?void 0:q.view))},M=[c],e[1]=c,e[2]=T,e[3]=M):(T=e[2],M=e[3]),A.useEffect(T,M),e[4]!==c||e[5]!==r||e[6]!==k?(R=()=>{c&&k(r||"")},z=[c,r,k],e[4]=c,e[5]=r,e[6]=k,e[7]=R,e[8]=z):(R=e[7],z=e[8]),A.useEffect(R,z);const{theme:D}=zo();let F;e[9]!==n?(F=Ie("flex flex-col w-full rounded-[inherit]",n),e[9]=n,e[10]=F):F=e[10];const B=c&&"max-h-[400px] min-h-11 visible",V=!c&&"max-h-0 min-h-0 invisible";let O,C,$,j;e[11]!==B||e[12]!==V?(O=Ie("flex items-center gap-2 border-b px-3 transition-all rounded-[inherit] rounded-b-none duration-300",B,V),e[11]=B,e[12]=V,e[13]=O):O=e[13],e[14]!==l||e[15]!==b||e[16]!==a||e[17]!==c||e[18]!==E||e[19]!==_||e[20]!==y||e[21]!==v||e[22]!==N||e[23]!==g||e[24]!==k||e[25]!==x||e[26]!==D?(C=c&&u.jsxs(u.Fragment,{children:[u.jsx(sa,{className:"text-[var(--blue-10)] flex-shrink-0",size:16}),u.jsx(Hc,{inputRef:I,theme:D,onClose:()=>{a(),N("")},value:y,onChange:Z=>{k(Z),m(K4({input:Z}))},onSubmit:()=>{v||E()}}),v&&u.jsxs(Me,{"data-testid":"stop-completion-button",variant:"text",size:"xs",className:"mb-0",onClick:x,children:[u.jsx(Ym,{className:"animate-spin mr-1",size:14}),"Stop"]}),!v&&b&&u.jsx(Me,{"data-testid":"accept-completion-button",variant:"text",size:"xs",className:"mb-0",disabled:v,onClick:()=>{l(b),N("")},children:u.jsx("span",{className:"text-[var(--grass-11)] opacity-100",children:"Accept"})}),u.jsx("div",{className:"h-full w-px bg-border mx-2"}),u.jsx(Te,{content:"Include code from other cells",children:u.jsxs("div",{className:"flex flex-row items-start gap-1 overflow-hidden",children:[u.jsx(X4,{"data-testid":"include-other-cells-checkbox",id:"include-other-cells",checked:_,onCheckedChange:Z=>g(!!Z)}),u.jsx(Fr,{htmlFor:"include-other-cells",className:"text-muted-foreground text-xs whitespace-nowrap ellipsis",children:"Include all code"})]})}),u.jsx(Me,{"data-testid":"decline-completion-button",variant:"text",size:"icon",disabled:v,onClick:()=>{x(),a(),N("")},children:u.jsx(oo,{className:"text-[var(--red-10)]",size:16})})]}),e[14]=l,e[15]=b,e[16]=a,e[17]=c,e[18]=E,e[19]=_,e[20]=y,e[21]=v,e[22]=N,e[23]=g,e[24]=k,e[25]=x,e[26]=D,e[27]=C):C=e[27],e[28]!==O||e[29]!==C?($=u.jsx("div",{className:O,children:C}),e[28]=O,e[29]=C,e[30]=$):$=e[30],e[31]!==b||e[32]!==i||e[33]!==c||e[34]!==o||e[35]!==D?(j=b&&c&&u.jsxs(cs,{className:"cm",theme:D,children:[u.jsx(hM,{onChange:o,value:i,extensions:Nx}),u.jsx(fM,{value:b,editable:!1,readOnly:!0,extensions:Nx})]}),e[31]=b,e[32]=i,e[33]=c,e[34]=o,e[35]=D,e[36]=j):j=e[36];const W=(!b||!c)&&d;let K;return e[37]!==$||e[38]!==j||e[39]!==W||e[40]!==F?(K=u.jsxs("div",{className:F,children:[$,j,W]}),e[37]=$,e[38]=j,e[39]=W,e[40]=F,e[41]=K):K=e[41],K};function pM(t){lt({title:"Completion failed",description:J4(t)})}const gM=t=>{const e=J.c(24),{editorView:n,code:o,currentLanguageAdapter:r,onAfterToggle:s}=t;let i,a;e[0]!==o?(a=new ca().isSupported(o)||o.trim()==="",e[0]=o,e[1]=a):a=e[1],i=a;const l=i;let c,d;e[2]!==o?(d=new Vc().isSupported(o)||o.trim()==="",e[2]=o,e[3]=d):d=e[3],c=d;const h=c&&r==="python";let f,m;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsx(dr,{color:"var(--sky-11)",strokeWidth:2.5,className:"w-4 h-4"}),e[4]=f):f=e[4],e[5]!==r||e[6]!==n||e[7]!==s||e[8]!==h?(m=u.jsx(Qu,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:h,icon:f,toType:"sql",displayName:"SQL",onAfterToggle:s}),e[5]=r,e[6]=n,e[7]=s,e[8]=h,e[9]=m):m=e[9];const _=l&&r==="python";let g,p,b,y,x;return e[10]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx(mc,{fill:"var(--sky-11)",color:"black",className:"w-4 h-4"}),e[10]=g):g=e[10],e[11]!==r||e[12]!==n||e[13]!==s||e[14]!==_?(p=u.jsx(Qu,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:_,icon:g,toType:"markdown",displayName:"Markdown",onAfterToggle:s}),e[11]=r,e[12]=n,e[13]=s,e[14]=_,e[15]=p):p=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(pc,{fill:"var(--sky-11)",color:"black",className:"w-4 h-4"}),e[16]=b):b=e[16],e[17]!==r||e[18]!==n?(y=u.jsx(Qu,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:!0,icon:b,toType:"python",displayName:"Python",onAfterToggle:An.NOOP}),e[17]=r,e[18]=n,e[19]=y):y=e[19],e[20]!==p||e[21]!==y||e[22]!==m?(x=u.jsxs("div",{className:"absolute right-3 top-2 z-20 flex hover-action gap-1",children:[m,p,y]}),e[20]=p,e[21]=y,e[22]=m,e[23]=x):x=e[23],x},Qu=t=>{const e=J.c(10),{editorView:n,currentLanguageAdapter:o,canSwitchToLanguage:r,icon:s,toType:i,displayName:a,onAfterToggle:l}=t;let c;e[0]!==n||e[1]!==l||e[2]!==i?(c=()=>{n&&(Pr(n,i),l())},e[0]=n,e[1]=l,e[2]=i,e[3]=c):c=e[3];const d=c;if(!r||o===i)return null;const h=`View as ${a}`;let f,m;return e[4]!==d||e[5]!==s?(f=u.jsx(Me,{"data-testid":"language-toggle-button",variant:"text",size:"xs",className:"opacity-80 px-1",onClick:d,children:s}),e[4]=d,e[5]=s,e[6]=f):f=e[6],e[7]!==h||e[8]!==f?(m=u.jsx(Te,{content:h,children:f}),e[7]=h,e[8]=f,e[9]=m):m=e[9],m},jx=({theme:t,showPlaceholder:e,id:n,config:o,code:r,status:s,serializedEditorState:i,setEditorView:a,runCell:l,userConfig:c,editorViewRef:d,editorViewParentRef:h,hidden:f,hasOutput:m,temporarilyShowCode:_,languageAdapter:g,setLanguageAdapter:p,showLanguageToggles:b=!0})=>{var Z;const[y,x]=an(La),v=nV(),S=wd(),{saveOrNameNotebook:k}=Kg(),E=s==="running"||s==="queued",N=Ot(),I=hg(),T=g==="markdown",M=et(()=>!E&&(S({cellId:n}),!0)),R=et(()=>!E&&(l(),!0)),z=et(()=>{const q=!o.hide_code;return Lr({configs:{[n]:{hide_code:q}}}),N.updateCellConfig({cellId:n,config:{hide_code:q}}),q}),D=$e(Bs),F=et(()=>{ur(D,N.createNewCell)}),B=oV(c),V=A.useMemo(()=>{const q=E5({cellId:n,showPlaceholder:e,enableAI:B,cellActions:{...N,afterToggleMarkdown:F,onRun:R,deleteCell:M,saveNotebook:k,createManyBelow:ne=>{for(const re of[...ne].reverse())N.createNewCell({code:re,before:!1,cellId:n,skipIfCodeExists:!0})},splitCell:I,toggleHideCode:z,aiCellCompletion:()=>{let ne=!1;return x(re=>(re==null?void 0:re.cellId)===n?(ne=!0,null):{cellId:n}),ne}},completionConfig:c.completion,keymapConfig:c.keymap,lspConfig:c.language_servers,theme:t,hotkeys:new Z4(c.keymap.overrides??{}),diagnosticsConfig:c.diagnostics,displayConfig:c.display});return q.push(Mn.define(ne=>{const re=ne.state.field(zc);return p(re.type),{update(ae){const X=ae.state.field(zc);p(X.type)}}}),st.updateListener.of(ne=>{ne.selectionSet&&ne.state.selection.ranges.some(re=>re.from!==re.to)&&_({focus:!1})})),q},[n,c.keymap,c.completion,c.language_servers,c.diagnostics,B,t,e,N,I,z,M,R,x,F,p,_,k]),O=$c(),C=et(()=>{if(O){const ne=$u(n,0,r);V.push(ne.extension),r=ne.code}const q=new st({state:fr.create({doc:r,extensions:V})});a(q),O||Pr(q,Hm(q.state).type)}),$=et(()=>{if(Bo(d.current!==null,"Editor view is not initialized"),O){const q=$u(n);V.push(q.extension)}d.current.dispatch({effects:[Rt.reconfigure.of([V]),rV(d.current,c.completion,new Z4(c.keymap.overrides??{}),{...c.language_servers,diagnostics:c.diagnostics})]})}),j=et(()=>{if(Bo(i,"Editor view is not initialized"),O){const ne=$u(n,0,r);V.push(ne.extension),r=ne.code}const q=new st({state:fr.fromJSON(i,{doc:r,extensions:V},{history:sV})});O||Pr(q,Hm(q.state).type),a(q),N.clearSerializedEditorState({cellId:n})});A.useEffect(()=>{i===null?d.current===null?C():$():j(),d.current!==null&&h&&h.current!==null&&h.current.replaceChildren(d.current.dom)},[C,$,j,d,h,i,V]),A.useEffect(()=>{const q=d.current;return()=>{q==null||q.destroy()}},[d]);const W=f&&!T||f&&T&&!m;let K="";return T&&f&&m?K="h-0 overflow-hidden":f&&(K="opacity-20 h-8 overflow-hidden"),u.jsx(mM,{enabled:(y==null?void 0:y.cellId)===n,initialPrompt:y==null?void 0:y.initialPrompt,currentCode:((Z=d.current)==null?void 0:Z.state.doc.toString())??r,currentLanguageAdapter:g,declineChange:et(()=>{var q;x(null),(q=d.current)==null||q.focus()}),onChange:et(q=>{var ne;(ne=d.current)==null||ne.dispatch({changes:{from:0,to:d.current.state.doc.length,insert:q}})}),acceptChange:et(q=>{var ne,re;(ne=d.current)==null||ne.dispatch({changes:{from:0,to:d.current.state.doc.length,insert:q}}),(re=d.current)==null||re.focus(),x(null)}),children:u.jsxs("div",{className:"relative w-full",onFocus:()=>v(n),children:[W&&u.jsx(Q4,{tooltip:"Edit code",className:"absolute inset-0 z-10",onClick:_}),u.jsx(Ex,{className:K,editorView:d.current,ref:h}),!f&&b&&u.jsx("div",{className:"absolute top-1 right-5",children:u.jsx(gM,{code:r,editorView:d.current,currentLanguageAdapter:g,onAfterToggle:F})})]})})},Ex=Y.forwardRef((t,e)=>{const n=J.c(10),{className:o,editorView:r}=t,s=A.useRef(null);let i,a,l,c,d;return n[0]!==r?(i=()=>{r!==null&&s.current!==null&&s.current.children.length===0&&s.current.append(r.dom)},a=[r,s],n[0]=r,n[1]=i,n[2]=a):(i=n[1],a=n[2]),A.useEffect(i,a),n[3]!==o?(l=Ie("cm mathjax_ignore",o),n[3]=o,n[4]=l):l=n[4],n[5]!==e?(c=h=>{e?Nl(e,s)(h):Nl(s)(h)},n[5]=e,n[6]=c):c=n[6],n[7]!==l||n[8]!==c?(d=u.jsx("div",{className:l,ref:c,"data-testid":"cell-editor"}),n[7]=l,n[8]=c,n[9]=d):d=n[9],d});Ex.displayName="CellCodeMirrorEditor";const eh=$c()?function(t){const e=n=>{const o=J.c(5),r=$e(mn),[s,i]=an(ss);if(r.state===Vt.CONNECTING||s===void 0){let l,c;return o[0]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx("span",{children:"Waiting for real-time collaboration connection..."}),o[0]=l):l=o[0],o[1]!==i?(c=u.jsx("div",{className:"flex h-full w-full items-baseline p-4",children:u.jsxs(Jm,{milliseconds:1e3,fallback:null,children:[l,u.jsx(Me,{variant:"link",onClick:()=>{i("disabled")},children:"Turn off real-time collaboration"})]})}),o[1]=i,o[2]=c):c=o[2],c}let a;return o[3]!==n?(a=u.jsx(t,{...n}),o[3]=n,o[4]=a):a=o[4],a};return e.displayName=`WithWaitUntilConnected(${t.displayName})`,e}(A.memo(jx)):A.memo(jx),_M=t=>{const e=J.c(10);let n,o,r,s;return e[0]!==t.left?(n=u.jsx("div",{className:"flex-1 flex item-center gap-2",children:t.left}),e[0]=t.left,e[1]=n):n=e[1],e[2]!==t.center?(o=u.jsx("div",{className:"flex-1 flex item-center gap-2 justify-center",children:t.center}),e[2]=t.center,e[3]=o):o=e[3],e[4]!==t.right?(r=u.jsx("div",{className:"flex-1 flex item-center gap-2 justify-end",children:t.right}),e[4]=t.right,e[5]=r):r=e[5],e[6]!==n||e[7]!==o||e[8]!==r?(s=u.jsxs("div",{className:"flex items-center gap-2 w-full px-3",children:[n,o,r]}),e[6]=n,e[7]=o,e[8]=r,e[9]=s):s=e[9],s},bM=t=>{const e=J.c(8);if(!t.canCollapse&&!t.isCollapsed)return null;const n=t.isCollapsed?"Expand":"Collapse";let o,r,s;return e[0]!==t.isCollapsed?(o=u.jsx("span",{children:u.jsx(yM,{isCollapsed:t.isCollapsed})}),e[0]=t.isCollapsed,e[1]=o):o=e[1],e[2]!==n||e[3]!==o?(r=u.jsx(Te,{content:n,children:o}),e[2]=n,e[3]=o,e[4]=r):r=e[4],e[5]!==t.onClick||e[6]!==r?(s=u.jsx(Me,{variant:"text",size:"icon",onClick:t.onClick,children:r}),e[5]=t.onClick,e[6]=r,e[7]=s):s=e[7],s},yM=t=>{const e=J.c(2),{isCollapsed:n}=t;let o;return e[0]!==n?(o=n?u.jsx(ia,{className:"w-5 h-5 flex-shrink-0"}):u.jsx(Vs,{className:"w-5 h-5 flex-shrink-0"}),e[0]=n,e[1]=o):o=e[1],o},Ix=A.memo(t=>{const e=J.c(24),{onClick:n,count:o,cellId:r}=t,s=Tc();let i;e[0]!==r||e[1]!==s?(i=iV(s,r),e[0]=r,e[1]=s,e[2]=i):i=e[2];const a=i;let l,c;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=Ie("flex items-center justify-between w-[calc(100%-2rem)] h-9 bg-muted rounded-b mx-4 opacity-80 hover:opacity-100 cursor-pointer"),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(aV,{className:"w-4 h-4 flex-shrink-0"}),e[4]=c):c=e[4];const d=o===1?"cell":"cells";let h,f,m,_,g,p,b;return e[5]!==o||e[6]!==d?(h=u.jsxs(u.Fragment,{children:[c,u.jsxs("span",{className:"text-sm text-gray-500",children:[o," ",d," collapsed"]})]}),e[5]=o,e[6]=d,e[7]=h):h=e[7],e[8]!==a.errored?(f=a.errored&&u.jsx(Te,{content:"Has errors",delayDuration:100,children:u.jsx(Vp,{className:"w-4 h-4 flex-shrink-0 text-destructive"})}),e[8]=a.errored,e[9]=f):f=e[9],e[10]!==a.stale?(m=a.stale&&u.jsx(Te,{content:"Has stale cells",delayDuration:100,children:u.jsx(eS,{className:"w-4 h-4 flex-shrink-0 text-[var(--yellow-11)]"})}),e[10]=a.stale,e[11]=m):m=e[11],e[12]!==a.runningOrQueued?(_=a.runningOrQueued&&u.jsx(Te,{content:"Running",delayDuration:100,children:u.jsx(Ym,{className:"w-4 h-4 flex-shrink-0 animate-spin"})}),e[12]=a.runningOrQueued,e[13]=_):_=e[13],e[14]!==f||e[15]!==m||e[16]!==_?(g=u.jsxs(u.Fragment,{children:[f,m,_]}),e[14]=f,e[15]=m,e[16]=_,e[17]=g):g=e[17],e[18]!==h||e[19]!==g?(p=u.jsx(_M,{center:h,right:g}),e[18]=h,e[19]=g,e[20]=p):p=e[20],e[21]!==n||e[22]!==p?(b=u.jsx("div",{onClick:n,className:l,children:p}),e[21]=n,e[22]=p,e[23]=b):b=e[23],b});Ix.displayName="CollapsedCellBanner";const Ax=t=>{const e=J.c(31),{status:n,connectionState:o,onClick:r}=t,s=n==="running"||n==="queued";let i,a,l,c,d,h,f,m,_,g,p,b,y,x;if(e[0]!==o||e[1]!==s||e[2]!==r||e[3]!==n){const v=br(o);let S;if(v){let k;e[14]!==o?(k=up(o),e[14]=o,e[15]=k):k=e[15],S=k}else S=n==="running"?"A cell can't be deleted when it's running":n==="queued"?"A cell can't be deleted when it's queued to run":"Delete";a=Te,_=S,g=!1,i=Me,l="ghost",c="icon",d=r,h="delete-button",f=Hn.preventFocus,m=Ie("hover:bg-transparent text-destructive/60 hover:text-destructive",(v||s)&&"inactive-button"),e[0]=o,e[1]=s,e[2]=r,e[3]=n,e[4]=i,e[5]=a,e[6]=l,e[7]=c,e[8]=d,e[9]=h,e[10]=f,e[11]=m,e[12]=_,e[13]=g}else i=e[4],a=e[5],l=e[6],c=e[7],d=e[8],h=e[9],f=e[10],m=e[11],_=e[12],g=e[13];return e[16]===Symbol.for("react.memo_cache_sentinel")?(p={boxShadow:"none"},b=u.jsx(bm,{size:14}),e[16]=p,e[17]=b):(p=e[16],b=e[17]),e[18]!==i||e[19]!==l||e[20]!==c||e[21]!==d||e[22]!==h||e[23]!==f||e[24]!==m?(y=u.jsx(i,{variant:l,size:c,onClick:d,"data-testid":h,onMouseDown:f,className:m,style:p,children:b}),e[18]=i,e[19]=l,e[20]=c,e[21]=d,e[22]=h,e[23]=f,e[24]=m,e[25]=y):y=e[25],e[26]!==a||e[27]!==y||e[28]!==_||e[29]!==g?(x=u.jsx(a,{content:_,usePortal:g,children:y}),e[26]=a,e[27]=y,e[28]=_,e[29]=g,e[30]=x):x=e[30],x},xM=t=>{const e=J.c(27),{onClick:n,connectionState:o,needsRun:r,status:s,config:i,edited:a}=t,l=s==="disabled-transitively",c=s==="running"||s==="queued";let d,h;e[0]!==l||e[1]!==i.disabled||e[2]!==o||e[3]!==a||e[4]!==c||e[5]!==r?(d=br(o)||c||!i.disabled&&l&&!a,h=function(p,b,y,x){return br(p)?"disabled":b&&!y?"stale":y||x?"disabled":"green"}(o,r,c,d),e[0]=l,e[1]=i.disabled,e[2]=o,e[3]=a,e[4]=c,e[5]=r,e[6]=d,e[7]=h):(d=e[6],h=e[7]);const f=h;if(i.disabled){let p,b;return e[8]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx(Mp,{}),e[8]=p):p=e[8],e[9]!==d||e[10]!==n||e[11]!==f?(b=u.jsx(pi,{tooltip:"Add code to notebook",disabled:d,onClick:n,variant:f,"data-testid":"run-button",children:p}),e[9]=d,e[10]=n,e[11]=f,e[12]=b):b=e[12],b}if(!i.disabled&&l&&!a){let p,b;return e[13]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx(ii,{strokeWidth:1.2}),e[13]=p):p=e[13],e[14]!==d||e[15]!==n||e[16]!==f?(b=u.jsx(pi,{disabled:d,tooltip:"This cell can't be run because it has a disabled ancestor",onClick:n,variant:f,"data-testid":"run-button",children:p}),e[14]=d,e[15]=n,e[16]=f,e[17]=b):b=e[17],b}let m,_,g;if(br(o)){let p;e[18]!==o?(p=up(o),e[18]=o,e[19]=p):p=e[19],m=p}else if(s==="queued")m="This cell is already queued to run";else if(s==="running")m="This cell is already running.";else{let p;e[20]===Symbol.for("react.memo_cache_sentinel")?(p=pn("cell.run"),e[20]=p):p=e[20],m=p}return e[21]===Symbol.for("react.memo_cache_sentinel")?(_=u.jsx(ii,{strokeWidth:1.2}),e[21]=_):_=e[21],e[22]!==d||e[23]!==n||e[24]!==m||e[25]!==f?(g=u.jsx(pi,{tooltip:m,disabled:d,onClick:n,variant:f,"data-testid":"run-button",children:_}),e[22]=d,e[23]=n,e[24]=m,e[25]=f,e[26]=g):g=e[26],g},Tx=Y.createContext(null),Mx=A.memo(()=>A.use(Tx));Mx.displayName="DragHandle";const Ox=Y.forwardRef((t,e)=>{const n=J.c(21);let o,r,s,i,a;n[0]!==t?({cellId:r,canMoveX: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=r.toString(),n[4]=r,n[5]=i):i=n[5],n[6]!==i?(a={id:i},n[6]=i,n[7]=a):a=n[7];const{attributes:l,listeners:c,setNodeRef:d,transform:h,transition:f,isDragging:m}=T1(a);let _;n[8]!==h?(_=function(y){return!y||y.x===0&&y.y===0&&y.scaleX===1&&y.scaleY===1}(h)?null:h,n[8]=h,n[9]=_):_=n[9];const g=_,p=g==null?void 0:f;let b;return n[10]!==l||n[11]!==o||n[12]!==r||n[13]!==m||n[14]!==c||n[15]!==s||n[16]!==e||n[17]!==d||n[18]!==g||n[19]!==p?(b=u.jsx(Dx,{ref:e,cellId:r,canMoveX:o,...s,attributes:l,listeners:c,setNodeRef:d,transform:g,transition:p,isDragging:m}),n[10]=l,n[11]=o,n[12]=r,n[13]=m,n[14]=c,n[15]=s,n[16]=e,n[17]=d,n[18]=g,n[19]=p,n[20]=b):b=n[20],b});Ox.displayName="SortableCell";const Dx=Y.forwardRef((t,e)=>{const n=J.c(37);let o,r,s,i,a,l,c,d,h,f;if(n[0]!==t){const{cellId:I,canMoveX:T,children:M,attributes:R,listeners:z,setNodeRef:D,transform:F,transition:B,isDragging:V,...O}=t;r=T,s=M,o=R,a=z,c=D,d=F,h=B,i=V,l=O,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i,n[5]=a,n[6]=l,n[7]=c,n[8]=d,n[9]=h}else o=n[1],r=n[2],s=n[3],i=n[4],a=n[5],l=n[6],c=n[7],d=n[8],h=n[9];n[10]!==r||n[11]!==d?(f=d?Rc.Transform.toString({x:r?d.x:0,y:d.y,scaleX:1,scaleY:1}):void 0,n[10]=r,n[11]=d,n[12]=f):f=n[12];const m=i?2:void 0;let _;n[13]!==f||n[14]!==m||n[15]!==h?(_={transform:f,transition:h,zIndex:m,position:"relative"},n[13]=f,n[14]=m,n[15]=h,n[16]=_):_=n[16];const g=_;let p,b;n[17]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx(Tp,{strokeWidth:1,size:20}),n[17]=p):p=n[17],n[18]!==o||n[19]!==a?(b=u.jsx("div",{...o,...a,onMouseDown:Hn.preventFocus,"data-testid":"drag-button",className:"py-[1px] cursor-grab opacity-50 hover:opacity-100 hover-action hover:bg-muted rounded border border-transparent hover:border-border active:bg-accent",children:p}),n[18]=o,n[19]=a,n[20]=b):b=n[20];const y=b,x=!!d;let v;n[21]!==e||n[22]!==c?(v=I=>{Nl(e,c)(I)},n[21]=e,n[22]=c,n[23]=v):v=n[23];const S=x&&"is-moving";let k,E,N;return n[24]!==l.className||n[25]!==S?(k=Ie(l.className,S,"outline-offset-4 outline-primary/40 rounded-lg"),n[24]=l.className,n[25]=S,n[26]=k):k=n[26],n[27]!==s||n[28]!==y?(E=u.jsx(Tx.Provider,{value:y,children:s}),n[27]=s,n[28]=y,n[29]=E):E=n[29],n[30]!==i||n[31]!==l||n[32]!==g||n[33]!==v||n[34]!==k||n[35]!==E?(N=u.jsx("div",{tabIndex:-1,ref:v,...l,"data-is-dragging":i,className:k,style:g,children:E}),n[30]=i,n[31]=l,n[32]=g,n[33]=v,n[34]=k,n[35]=E,n[36]=N):N=n[36],N});function Rx(t,e){const n=J.c(9);let o;n[0]!==t.current||n[1]!==e?(o=l=>{t.current===null||t.current.contains(l.relatedTarget)||e.current===null||fm(e.current)},n[0]=t.current,n[1]=e,n[2]=o):o=n[2];const r=et(o);let s;n[3]!==t.current||n[4]!==e?(s=l=>{if(t.current===document.activeElement&&e.current!==null&&ya(e.current.state)==="active"){for(const c of P4)if(l.key===c.key&&c.run){c.run(e.current),l.preventDefault(),l.stopPropagation();break}e.current.focus()}},n[3]=t.current,n[4]=e,n[5]=s):s=n[5];const i=et(s);let a;return n[6]!==r||n[7]!==i?(a={closeCompletionHandler:r,resumeCompletionHandler:i},n[6]=r,n[7]=i,n[8]=a):a=n[8],a}function Px(t,e,n,o,r,s,i,a,l){const c=J.c(51);let d,h,f,m,_,g,p,b,y,x,v,S,k,E,N,I;c[0]!==o||c[1]!==e||c[2]!==n?(d=()=>{n(),o.moveToNextCell({cellId:e,before:!1})},h=()=>{n(),o.moveToNextCell({cellId:e,before:!0})},c[0]=o,c[1]=e,c[2]=n,c[3]=d,c[4]=h):(d=c[3],h=c[4]),c[5]!==o||c[6]!==e?(f=()=>o.createNewCell({cellId:e,before:!0}),m=()=>o.createNewCell({cellId:e,before:!1}),_=()=>o.moveCell({cellId:e,before:!0}),g=()=>o.moveCell({cellId:e,before:!1}),c[5]=o,c[6]=e,c[7]=f,c[8]=m,c[9]=_,c[10]=g):(f=c[7],m=c[8],_=c[9],g=c[10]),c[11]!==o||c[12]!==r||c[13]!==e?(p=()=>r?o.moveCell({cellId:e,direction:"left"}):void 0,b=()=>r?o.moveCell({cellId:e,direction:"right"}):void 0,c[11]=o,c[12]=r,c[13]=e,c[14]=p,c[15]=b):(p=c[14],b=c[15]),c[16]!==o||c[17]!==s||c[18]!==e||c[19]!==(t==null?void 0:t.current)||c[20]!==i?(y=()=>{var M,R,z;const T=!s.hide_code;Lr({configs:{[e]:{hide_code:T}}}),o.updateCellConfig({cellId:e,config:{hide_code:T}}),T?((M=i.current)==null||M.contentDOM.blur(),(R=t==null?void 0:t.current)==null||R.focus()):(z=i.current)==null||z.focus()},c[16]=o,c[17]=s,c[18]=e,c[19]=t==null?void 0:t.current,c[20]=i,c[21]=y):y=c[21],c[22]!==o||c[23]!==e?(k=()=>o.moveToNextCell({cellId:e,before:!1,noCreate:!0}),x=()=>o.moveToNextCell({cellId:e,before:!0,noCreate:!0}),v=()=>o.sendToBottom({cellId:e}),S=()=>o.sendToTop({cellId:e}),c[22]=o,c[23]=e,c[24]=x,c[25]=v,c[26]=S,c[27]=k):(x=c[24],v=c[25],S=c[26],k=c[27]),c[28]!==e||c[29]!==i||c[30]!==a?(E=()=>{let T;T=!1,a(M=>(M==null?void 0:M.cellId)===e?(T=!0,null):{cellId:e}),T&&J_(i).focus()},c[28]=e,c[29]=i,c[30]=a,c[31]=E):E=c[31],c[32]!==l?(N=()=>{var T;(T=l.current)==null||T.toggle()},c[32]=l,c[33]=N):N=c[33],c[34]!==n||c[35]!==d||c[36]!==h||c[37]!==x||c[38]!==v||c[39]!==S||c[40]!==E||c[41]!==N||c[42]!==f||c[43]!==m||c[44]!==_||c[45]!==g||c[46]!==p||c[47]!==b||c[48]!==y||c[49]!==k?(I={"cell.run":n,"cell.runAndNewBelow":d,"cell.runAndNewAbove":h,"cell.createAbove":f,"cell.createBelow":m,"cell.moveUp":_,"cell.moveDown":g,"cell.moveLeft":p,"cell.moveRight":b,"cell.hideCode":y,"cell.focusDown":k,"cell.focusUp":x,"cell.sendToBottom":v,"cell.sendToTop":S,"cell.aiCompletion":E,"cell.cellActions":N},c[34]=n,c[35]=d,c[36]=h,c[37]=x,c[38]=v,c[39]=S,c[40]=E,c[41]=N,c[42]=f,c[43]=m,c[44]=_,c[45]=g,c[46]=p,c[47]=b,c[48]=y,c[49]=k,c[50]=I):I=c[50],dV(t,I)}function Lx(t,e,n,o,r,s){const i=J.c(16);let a,l,c,d,h;i[0]!==n||i[1]!==e?(a=f=>(!f||!Hn.fromInput(f))&&(n.moveToNextCell({cellId:e,before:!1,noCreate:!0}),!0),l=f=>(!f||!Hn.fromInput(f))&&(n.moveToNextCell({cellId:e,before:!0,noCreate:!0}),!0),i[0]=n,i[1]=e,i[2]=a,i[3]=l):(a=i[2],l=i[3]),i[4]!==o?(c=()=>(o(),!1),i[4]=o,i[5]=c):c=i[5],i[6]!==n||i[7]!==e||i[8]!==s||i[9]!==r.keymap.preset?(d=r.keymap.preset!=="vim"||s?{}:{j:f=>(!f||!Hn.fromInput(f))&&(n.moveToNextCell({cellId:e,before:!1,noCreate:!0}),!0),k:f=>(!f||!Hn.fromInput(f))&&(n.moveToNextCell({cellId:e,before:!0,noCreate:!0}),!0)},i[6]=n,i[7]=e,i[8]=s,i[9]=r.keymap.preset,i[10]=d):d=i[10],i[11]!==a||i[12]!==l||i[13]!==c||i[14]!==d?(h={ArrowDown:a,ArrowUp:l,Enter:c,...d},i[11]=a,i[12]=l,i[13]=c,i[14]=d,i[15]=h):h=i[15],uV(t,h)}Dx.displayName="SortableCellInternal";const Fx=A.forwardRef((t,e)=>{const n=J.c(14),{id:o,output:r,interrupted:s,errored:i,stopped:a,name:l,outputStale:c,outputLoading:d}=t;let h;n[0]===Symbol.for("react.memo_cache_sentinel")?(h=Wc("marimo-cell","hover-actions-parent z-10",{published:!0}),n[0]=h):h=n[0];const f=h;let m;n[1]!==o?(m=zs.create(o),n[1]=o,n[2]=m):m=n[2];const _=m,g=oS(r==null?void 0:r.mimetype);if(i||s||a||g)return null;let p,b;return n[3]!==o||n[4]!==r||n[5]!==d||n[6]!==c?(p=u.jsx(qc,{allowExpand:!1,forceExpand:!0,output:r,className:"output-area",cellId:o,stale:c,loading:d}),n[3]=o,n[4]=r,n[5]=d,n[6]=c,n[7]=p):p=n[7],n[8]!==_||n[9]!==o||n[10]!==l||n[11]!==e||n[12]!==p?(b=u.jsx("div",{tabIndex:-1,id:_,ref:e,className:f,"data-cell-id":o,"data-cell-name":l,children:p}),n[8]=_,n[9]=o,n[10]=l,n[11]=e,n[12]=p,n[13]=b):b=n[13],b});Fx.displayName="ReadonlyCellComponent";const wM=({theme:t,showPlaceholder:e,id:n,code:o,output:r,consoleOutputs:s,status:i,runStartTimestamp:a,lastRunStartTimestamp:l,runElapsedTimeMs:c,edited:d,interrupted:h,errored:f,stopped:m,staleInputs:_,serializedEditorState:g,serialization:p,debuggerActive:b,connectionState:y,canDelete:x,actions:v,deleteCell:S,userConfig:k,outline:E,isCollapsed:N,collapseCount:I,config:T,canMoveX:M,name:R,editorView:z,setEditorView:D,outputStale:F})=>{const B=A.useRef(null),V=A.useRef(null),O=A.useRef(null),C=A.useRef(null),$=Qt(La),j=gd(n),[W,K]=A.useState(),Z=T.disabled||i==="disabled-transitively",q=rS({executionTime:c,status:i,errored:f,interrupted:h,stopped:m}),ne=d||h||_&&!Z,re=tS(i),ae=(i==="queued"||d||_)&&!h,X=A.useCallback(()=>z.current,[z]),{closeCompletionHandler:ee,resumeCompletionHandler:ce}=Rx(B,z),{isCellCodeShown:me,isMarkdown:ue,isMarkdownCodeHidden:pe,temporarilyShowCode:de,showHiddenMarkdownCode:Ne}=function(G,ge,_e,fe){const le=J.c(13),[Ve,Fe]=A.useState(!1),Ke=!G.hide_code||Ve,ie=ge==="markdown",Se=ie&&!Ke;let Ee;le[0]!==_e||le[1]!==fe||le[2]!==Ke?(Ee=it=>{var bt,Mt;if(Ke)return;const Xe=(it==null?void 0:it.focus)??!0;Fe(!0),Xe&&((bt=_e.current)==null||bt.focus());const ot=(Mt=fe.current)==null?void 0:Mt.parentElement;if(!ot)return void Dt.error("Cell: No parent element found for editor view");const yt=()=>{requestAnimationFrame(()=>{var xt;ot.contains(document.activeElement)||(Fe(!1),(xt=_e.current)==null||xt.dom.blur(),ot.removeEventListener("focusout",yt))})};ot.addEventListener("focusout",yt)},le[0]=_e,le[1]=fe,le[2]=Ke,le[3]=Ee):Ee=le[3];const Be=et(Ee);let Ye;le[4]!==Se||le[5]!==Be?(Ye=()=>{Se&&Be({focus:!0})},le[4]=Se,le[5]=Be,le[6]=Ye):Ye=le[6];const Oe=et(Ye);let He;return le[7]!==Ke||le[8]!==ie||le[9]!==Se||le[10]!==Oe||le[11]!==Be?(He={isCellCodeShown:Ke,isMarkdown:ie,isMarkdownCodeHidden:Se,temporarilyShowCode:Be,showHiddenMarkdownCode:Oe},le[7]=Ke,le[8]=ie,le[9]=Se,le[10]=Oe,le[11]=Be,le[12]=He):He=le[12],He}(T,W,z,O);Px(B,n,j,v,M,T,z,$,V),Lx(B,n,v,Ne,k,me);const je=cV(E),se=!nS(r),Ae=s.length>0,be=k.display.cell_output,Re=se&&be==="above",ze=se&&be==="below",[qe,Qe]=A.useState(!1),[Pe,tt]=A.useState(!1);(function(G){const{ref:ge,box:_e="content-box",skip:fe}=G,le=A.useRef({...A5}),Ve=A.useRef(void 0);Ve.current=G.onResize,A.useEffect(()=>{if(!ge.current||fe||typeof window>"u"||!("ResizeObserver"in window))return;const Fe=new ResizeObserver(([Ke])=>{const ie=_e==="border-box"?"borderBoxSize":_e==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",Se=Y_(Ke,ie,"inlineSize"),Ee=Y_(Ke,ie,"blockSize");if(le.current.width!==Se||le.current.height!==Ee){const Be={width:Se,height:Ee};le.current.width=Se,le.current.height=Ee,Ve.current&&Ve.current(Be)}});return Fe.observe(ge.current,{box:_e}),()=>{Fe.disconnect()}},[_e,ge,fe])})({ref:C,skip:!ue,onResize:G=>{const ge=G.height&&G.height<68,_e=pe&&(ge||be==="below");Qe(_e),je&&_e?tt(!0):Pe&&tt(!1)}});const Je=G=>u.jsx(Q4,{tooltip:"Edit markdown",className:Ie("z-20 relative",G),onClick:de}),nt=se&&u.jsxs("div",{className:"relative",onDoubleClick:Ne,children:[u.jsx("div",{className:"absolute top-5 -left-8 z-10 print:hidden",children:u.jsx(bM,{isCollapsed:N,onClick:()=>{N?v.expandCell({cellId:n}):v.collapseCell({cellId:n})},canCollapse:je})}),pe&&ze&&Je("top-3"),u.jsx(qc,{allowExpand:!0,forceExpand:pe,output:r,className:"output-area",cellId:n,stale:F,loading:re}),pe&&Re&&Je("bottom-3")]}),te=Wc("marimo-cell","hover-actions-parent z-10",{interactive:!0,"needs-run":ne,"has-error":f,stopped:m,disabled:T.disabled,stale:i==="disabled-transitively",borderless:pe&&se}),we=zs.create(n),ke=et(G=>{$({cellId:n,initialPrompt:G.prompt})}),Le=!(!p||p.toLowerCase()!=="valid");return u.jsx(Km,{children:u.jsx(T0,{cellId:n,config:T,status:i,getEditorView:X,hasOutput:se,hasConsoleOutput:Ae,name:R,children:u.jsxs(Ox,{tabIndex:-1,ref:B,"data-status":i,onBlur:ee,onKeyDown:ce,cellId:n,canMoveX:M,title:T.disabled?"This cell is disabled":i==="disabled-transitively"?"This cell has a disabled ancestor":void 0,children:[u.jsxs("div",{className:te,id:we,ref:C,"data-cell-id":n,"data-cell-name":R,children:[be==="above"&&nt,u.jsxs("div",{className:Ie("tray"),"data-hidden":pe,children:[u.jsx("div",{className:"absolute right-2 -top-4 z-10",children:u.jsx(Bx,{edited:d,connectionState:y,status:i,cellConfig:T,needsRun:ne,hasOutput:se,hasConsoleOutput:Ae,cellActionDropdownRef:V,cellId:n,name:R,getEditorView:X,onRun:j})}),u.jsx(vM,{cellId:n,className:Ie(pe&&Re&&"-top-7",pe&&ze&&"-bottom-8",pe&&Pe&&"-left-[3.8rem]"),connectionState:y,actions:v}),u.jsx(eh,{theme:t,showPlaceholder:e,id:n,code:o,config:T,status:i,serializedEditorState:g,runCell:j,setEditorView:D,userConfig:k,editorViewRef:z,editorViewParentRef:O,hidden:!me,hasOutput:se,temporarilyShowCode:de,languageAdapter:W,setLanguageAdapter:K}),u.jsx(zx,{className:Ie(pe&&be==="below"&&"top-14"),edited:d,status:i,isCellStatusInline:qe,uninstantiated:q,disabled:T.disabled,runElapsedTimeMs:c,runStartTimestamp:a,lastRunStartTimestamp:l,staleInputs:_,interrupted:h}),u.jsx("div",{className:"shoulder-bottom hover-action",children:x&&me&&u.jsx(Ax,{connectionState:y,status:i,onClick:()=>{re||br(y)||S({cellId:n})}})})]}),be==="below"&&nt,p&&u.jsxs("a",{href:"https://links.marimo.app/reusable-definitions",target:"_blank",className:"hover:underline py-1 px-2 flex items-center justify-end gap-2 last:rounded-b",rel:"noopener",children:[Le&&u.jsx("span",{className:"text-muted-foreground text-xs font-bold",children:"reusable"}),u.jsx(Te,{content:u.jsx("span",{className:"max-w-16 text-xs",children:Le?"This function or class can be imported into other Python notebooks or modules.":u.jsxs(u.Fragment,{children:["This definition can't be reused in other Python modules:",u.jsx("br",{}),u.jsx("br",{}),u.jsx("pre",{children:p}),u.jsx("br",{}),"Click this icon to learn more."]})}),children:Le&&u.jsx(dc,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})||u.jsx(Xm,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})})]}),u.jsx(hp,{consoleOutputs:s,stale:ae,cellName:p?"_":R,onRefactorWithAI:ke,onClear:()=>{v.clearCellConsoleOutput({cellId:n})},onSubmitDebugger:(G,ge)=>{v.setStdinResponse({cellId:n,response:G,outputIndex:ge}),sS({text:G})},cellId:n,debuggerActive:b})]}),N&&u.jsx(Ix,{onClick:()=>v.expandCell({cellId:n}),count:I,cellId:n})]})})})},zx=t=>{const e=J.c(19),{className:n,disabled:o,edited:r,interrupted:s,isCellStatusInline:i,lastRunStartTimestamp:a,runElapsedTimeMs:l,runStartTimestamp:c,staleInputs:d,status:h,uninstantiated:f}=t,m=o!==void 0&&o;let _;e[0]!==m||e[1]!==r||e[2]!==s||e[3]!==a||e[4]!==l||e[5]!==c||e[6]!==d||e[7]!==h||e[8]!==f?(_=u.jsx(Z_,{status:h,staleInputs:d,interrupted:s,editing:!0,edited:r,disabled:m,elapsedTime:l,runStartTimestamp:c,uninstantiated:f,lastRunStartTimestamp:a}),e[0]=m,e[1]=r,e[2]=s,e[3]=a,e[4]=l,e[5]=c,e[6]=d,e[7]=h,e[8]=f,e[9]=_):_=e[9];const g=_;let p;e[10]!==n?(p=Ie("shoulder-right z-20",n),e[10]=n,e[11]=p):p=e[11];const b=!i&&g;let y;e[12]===Symbol.for("react.memo_cache_sentinel")?(y=u.jsx(Mx,{}),e[12]=y):y=e[12];const x=i&&g;let v,S;return e[13]!==x?(v=u.jsxs("div",{className:"flex gap-2 items-end",children:[y,x]}),e[13]=x,e[14]=v):v=e[14],e[15]!==p||e[16]!==b||e[17]!==v?(S=u.jsxs("div",{className:p,children:[b,v]}),e[15]=p,e[16]=b,e[17]=v,e[18]=S):S=e[18],S},vM=t=>{const e=J.c(21),{className:n,connectionState:o,actions:r,cellId:s}=t;let i;e[0]!==r||e[1]!==s?(i=v=>{const S=v===void 0?{}:v;return r.createNewCell({cellId:s,before:!1,...S})},e[0]=r,e[1]=s,e[2]=i):i=e[2];const a=et(i);let l;e[3]!==r||e[4]!==s?(l=v=>{const S=v===void 0?{}:v;return r.createNewCell({cellId:s,before:!0,...S})},e[3]=r,e[4]=s,e[5]=l):l=e[5];const c=et(l),d=Qc(o);let h,f;e[6]!==n?(h=Ie("absolute flex flex-col gap-[2px] justify-center h-full left-[-34px] z-20",n),e[6]=n,e[7]=h):h=e[7],e[8]===Symbol.for("react.memo_cache_sentinel")?(f=pn("cell.createAbove"),e[8]=f):f=e[8];const m=d?c:void 0;let _,g,p;e[9]!==o||e[10]!==m?(_=u.jsx(E0,{tooltipContent:f,connectionState:o,onClick:m}),e[9]=o,e[10]=m,e[11]=_):_=e[11],e[12]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("div",{className:"flex-1"}),e[12]=g):g=e[12],e[13]===Symbol.for("react.memo_cache_sentinel")?(p=pn("cell.createBelow"),e[13]=p):p=e[13];const b=d?a:void 0;let y,x;return e[14]!==o||e[15]!==b?(y=u.jsx(E0,{tooltipContent:p,connectionState:o,onClick:b}),e[14]=o,e[15]=b,e[16]=y):y=e[16],e[17]!==h||e[18]!==_||e[19]!==y?(x=u.jsxs("div",{className:h,children:[_,g,y]}),e[17]=h,e[18]=_,e[19]=y,e[20]=x):x=e[20],x},Bx=t=>{const e=J.c(27),{edited:n,connectionState:o,status:r,cellConfig:s,needsRun:i,hasOutput:a,hasConsoleOutput:l,onRun:c,cellActionDropdownRef:d,cellId:h,getEditorView:f,name:m,includeCellActions:_}=t,g=_===void 0||_,p=Qc(o),b=!i&&"hover-action";let y;e[0]!==b?(y=Ie(b),e[0]=b,e[1]=y):y=e[1];const x=p?c:An.NOOP;let v,S,k,E;return e[2]!==s||e[3]!==o||e[4]!==n||e[5]!==i||e[6]!==r||e[7]!==x?(v=u.jsx(xM,{edited:n,onClick:x,connectionState:o,status:r,config:s,needsRun:i}),e[2]=s,e[3]=o,e[4]=n,e[5]=i,e[6]=r,e[7]=x,e[8]=v):v=e[8],e[9]!==o||e[10]!==r?(S=u.jsx(nE,{status:r,connectionState:o}),e[9]=o,e[10]=r,e[11]=S):S=e[11],e[12]!==d||e[13]!==s||e[14]!==h||e[15]!==f||e[16]!==l||e[17]!==a||e[18]!==g||e[19]!==m||e[20]!==r?(k=g&&u.jsx(I0,{ref:d,cellId:h,status:r,getEditorView:f,name:m,config:s,hasOutput:a,hasConsoleOutput:l,children:u.jsx(pi,{variant:"green",tooltip:null,"data-testid":"cell-actions-button",children:u.jsx(QS,{strokeWidth:1.5})})}),e[12]=d,e[13]=s,e[14]=h,e[15]=f,e[16]=l,e[17]=a,e[18]=g,e[19]=m,e[20]=r,e[21]=k):k=e[21],e[22]!==y||e[23]!==v||e[24]!==S||e[25]!==k?(E=u.jsxs(tE,{className:y,children:[v,S,k]}),e[22]=y,e[23]=v,e[24]=S,e[25]=k,e[26]=E):E=e[26],E},kM=({theme:t,showPlaceholder:e,id:n,code:o,output:r,consoleOutputs:s,status:i,runStartTimestamp:a,lastRunStartTimestamp:l,runElapsedTimeMs:c,edited:d,interrupted:h,errored:f,stopped:m,staleInputs:_,serializedEditorState:g,debuggerActive:p,connectionState:b,canDelete:y,actions:x,deleteCell:v,userConfig:S,config:k,canMoveX:E,name:N,editorView:I,setEditorView:T})=>{const M=A.useRef(null),R=A.useRef(null),z=A.useRef(null),D=Qt(La),F=gd(n),B=k.disabled||i==="disabled-transitively",V=rS({executionTime:c,status:i,errored:f,interrupted:h,stopped:m}),O=d||h||_&&!B,C=i==="running"||i==="queued",$=(i==="queued"||d||_)&&!h,j=A.useCallback(()=>I.current,[I]),{closeCompletionHandler:W,resumeCompletionHandler:K}=Rx(M,I);Px(M,n,F,x,E,k,I,D,R),Lx(M,n,x,An.NOOP,S,!0);const Z=!nS(r),q=s.length>0,ne=oS(r==null?void 0:r.mimetype),re=Wc("marimo-cell","hover-actions-parent z-10 border shadow-sm","!border-[var(--blue-5)] !rounded-sm",{"needs-run":O,"has-error":f,stopped:m}),ae=zs.create(n),X=et(ee=>{D({cellId:n,initialPrompt:ee.prompt})});return u.jsx(Km,{children:u.jsx(T0,{cellId:n,config:k,status:i,getEditorView:j,hasOutput:Z,hasConsoleOutput:q,name:N,children:u.jsxs("div",{className:re,"data-status":i,id:ae,ref:M,onBlur:W,onKeyDown:K,title:k.disabled?"This cell is disabled":i==="disabled-transitively"?"This cell has a disabled ancestor":void 0,"data-cell-id":n,"data-cell-name":N,"data-setup-cell":!0,children:[u.jsxs("div",{className:Ie("tray"),"data-hidden":!1,children:[u.jsx("div",{className:"absolute right-2 -top-4 z-10",children:u.jsx(Bx,{edited:d,connectionState:b,status:i,cellConfig:k,needsRun:O,hasOutput:Z,hasConsoleOutput:q,cellActionDropdownRef:R,cellId:n,name:N,getEditorView:j,onRun:F,includeCellActions:!1})}),u.jsx(eh,{theme:t,showPlaceholder:e,id:n,code:o,config:k,status:i,serializedEditorState:g,runCell:F,setEditorView:T,userConfig:S,editorViewRef:I,editorViewParentRef:z,hidden:!1,hasOutput:Z,temporarilyShowCode:An.NOOP,languageAdapter:"python",setLanguageAdapter:An.NOOP,showLanguageToggles:!1}),u.jsx(zx,{edited:d,status:i,isCellStatusInline:!1,uninstantiated:V,disabled:k.disabled,runElapsedTimeMs:c,runStartTimestamp:a,lastRunStartTimestamp:l,staleInputs:_,interrupted:h}),u.jsx("div",{className:"shoulder-bottom hover-action",children:y&&u.jsx(Ax,{connectionState:b,status:i,onClick:()=>{C||br(b)||v({cellId:n})}})})]}),u.jsxs("div",{className:"py-1 px-2 flex justify-end gap-2 last:rounded-b",children:[u.jsx("span",{className:"text-muted-foreground text-xs font-bold",children:"setup cell"}),u.jsx(Te,{content:u.jsxs("span",{className:"max-w-16",children:["This ",u.jsx("b",{children:"setup cell"})," is guaranteed to run before all other cells. Include ",u.jsx("br",{}),"initialization or imports and constants required by top-level functions."]}),children:u.jsx(Xm,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})})]}),ne&&u.jsx(qc,{allowExpand:!0,forceExpand:!0,output:r,className:"output-area",cellId:n,stale:!1,loading:C}),u.jsx(hp,{consoleOutputs:s,stale:$,cellName:"_",onRefactorWithAI:X,onClear:()=>{x.clearCellConsoleOutput({cellId:n})},onSubmitDebugger:(ee,ce)=>{x.setStdinResponse({cellId:n,response:ee,outputIndex:ce}),sS({text:ee})},cellId:n,debuggerActive:p})]})})})},Ux=A.memo(A.forwardRef((t,e)=>{const{status:n,output:o,runStartTimestamp:r,interrupted:s,staleInputs:i,edited:a,id:l,mode:c}=t;Dt.debug("Rendering Cell",l);const d=A.useRef(null);A.useImperativeHandle(e,()=>({get editorView(){return J_(d)},get editorViewOrNull(){return d.current}}),[d]);const h=lV({status:n,output:o,runStartTimestamp:r,interrupted:s,staleInputs:i},a),f=tS(n);return l===Ho?u.jsx(kM,{...t,editorView:d,setEditorView:m=>{d.current=m},outputStale:h}):c==="edit"?u.jsx(wM,{...t,editorView:d,setEditorView:m=>{d.current=m},outputStale:h}):u.jsx(Fx,{...t,outputStale:h,outputLoading:f})})),SM=(t,e)=>function(n,o){const r=/^(\d+)\.(\d+)\.(\d+)(?:-([\w.-]+))?(?:\+([\w.-]+))?$/,s=i=>{const a=i.match(r);if(!a)return null;const[,l,c,d,h]=a;return{major:Number.parseInt(l,10),minor:Number.parseInt(c,10),patch:Number.parseInt(d,10),preRelease:h||""}};try{const i=s(n),a=s(o);return i&&a?i.major!==a.major?i.major-a.major:i.minor!==a.minor?i.minor-a.minor:i.patch!==a.patch?i.patch-a.patch:i.preRelease===""&&a.preRelease!==""?1:i.preRelease!==""&&a.preRelease===""?-1:i.preRelease.localeCompare(a.preRelease):n.localeCompare(o,void 0,{numeric:!0,sensitivity:"base"})}catch{return n.localeCompare(o,void 0,{numeric:!0,sensitivity:"base"})}}(e,t),Vx=new class{constructor(t){this.ttl=void 0,this.cache=new Map,this.ttl=t.ttl}cleanupExpiredEntries(){const t=Date.now();for(const[e,n]of this.cache.entries())t-n.timestamp>this.ttl&&this.cache.delete(e)}get(t){this.cleanupExpiredEntries();const e=this.cache.get(t);if(e){if(!(Date.now()-e.timestamp>this.ttl))return e.data;this.cache.delete(t)}}set(t,e){this.cache.set(t,{data:e,timestamp:Date.now()})}clear(){this.cache.clear()}}({ttl:3e5}),CM=iS({info:iS({provides_extra:aS().array().nullable()}),releases:hV(aS(),fV())});function $x(t){const e=J.c(5);let n;e[0]!==t?(n=function(i){return i.replaceAll(/\[.*]/g,"").trim()}(t),e[0]=t,e[1]=n):n=e[1];const o=n;let r,s;return e[2]!==o?(r=async()=>{const i=Vx.get(o);if(i)return i;const a=await fetch(`https://pypi.org/pypi/${o}/json`,{method:"GET"});if(!a.ok)throw new Error(`HTTP ${a.status}: ${a.statusText}`);const l=CM.transform(NM).parse(await a.json());return Vx.set(o,l),l},s=[o],e[2]=o,e[3]=r,e[4]=s):(r=e[3],s=e[4]),Gn(r,s)}function NM(t){return{versions:Object.keys(t.releases).toSorted(SM),extras:t.info.provides_extra??[]}}function Hx(t){const e=t.match(/^([^[]+)(?:\[([^\]]+)])?$/);if(!e)return{name:t,extras:[]};const[,n,o]=e;return{name:n,extras:o?o.split(",").map(r=>r.trim()):[]}}const jM=()=>{const t=J.c(70),{packageAlert:e}=SH(),{clearPackageAlert:n}=CH(),[o]=$s();let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={},t[0]=r):r=t[0];const[s,i]=A.useState(r);let a;t[1]===Symbol.for("react.memo_cache_sentinel")?(a={},t[1]=a):a=t[1];const[l,c]=A.useState(a);if(e===null)return null;const d=o.package_management.manager!=="pixi";if(NH(e)){let h,f,m,_,g,p,b,y,x,v;if(t[2]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[u.jsx(dd,{className:"w-5 h-5 inline-block mr-2"}),"Missing packages"]}),t[2]=h):h=t[2],t[3]!==n||t[4]!==e.id?(f=()=>n(e.id),t[3]=n,t[4]=e.id,t[5]=f):f=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(m=u.jsx(oo,{className:"w-5 h-5"}),t[6]=m):m=t[6],t[7]!==f?(_=u.jsxs("div",{className:"flex justify-between",children:[h,u.jsx(Me,{variant:"text","data-testid":"remove-banner-button",size:"icon",onClick:f,children:m})]}),t[7]=f,t[8]=_):_=t[8],t[9]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("p",{children:"The following packages were not found:"}),t[9]=g):g=t[9],t[10]!==s||t[11]!==d||t[12]!==e.packages||t[13]!==l){let S;t[15]!==s||t[16]!==d||t[17]!==l?(S=(k,E)=>{const N=Hx(k),I=l[k]||N.extras;return u.jsxs("li",{className:"flex items-center gap-2 font-mono text-sm",children:[u.jsx(si,{size:"1rem"}),u.jsx(TM,{packageName:N.name,selectedExtras:I,onExtrasChange:T=>c(M=>({...M,[k]:T}))}),d&&u.jsx(MM,{value:s[k]??"latest",onChange:T=>i(M=>({...M,[k]:T})),packageName:N.name})]},E)},t[15]=s,t[16]=d,t[17]=l,t[18]=S):S=t[18],p=e.packages.map(S),t[10]=s,t[11]=d,t[12]=e.packages,t[13]=l,t[14]=p}else p=t[14];return t[19]!==p?(b=u.jsxs("div",{children:[g,u.jsx("ul",{className:"list-disc ml-4 mt-1",children:p})]}),t[19]=p,t[20]=b):b=t[20],t[21]!==n||t[22]!==s||t[23]!==e.id||t[24]!==e.isolated||t[25]!==e.packages||t[26]!==l||t[27]!==o.package_management.manager?(y=u.jsx("div",{className:"ml-auto flex flex-row items-baseline",children:e.isolated?u.jsxs(u.Fragment,{children:[u.jsx(IM,{manager:o.package_management.manager,packages:e.packages.map(S=>{const k=Hx(S),E=l[S]||k.extras;return function(N,I){return I.length===0?N:`${N}[${I.join(",")}]`}(k.name,E)}),versions:s,clearPackageAlert:()=>n(e.id)}),!In()&&u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"px-2 text-sm",children:"with"})," ",u.jsx(AM,{})]})]}):u.jsxs("p",{children:["If you set up a"," ",u.jsx(Sm,{href:"https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments",children:"virtual environment"}),", marimo can install these packages for you."]})}),t[21]=n,t[22]=s,t[23]=e.id,t[24]=e.isolated,t[25]=e.packages,t[26]=l,t[27]=o.package_management.manager,t[28]=y):y=t[28],t[29]!==b||t[30]!==y?(x=u.jsxs("div",{className:"flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",children:[b,y]}),t[29]=b,t[30]=y,t[31]=x):x=t[31],t[32]!==x||t[33]!==_?(v=u.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-12 min-w-[400px] z-[200] opacity-95",children:u.jsxs(Gc,{kind:"danger",className:"flex flex-col rounded py-3 px-5 animate-in slide-in-from-left",children:[_,x]})}),t[32]=x,t[33]=_,t[34]=v):v=t[34],v}if(jH(e)){let h;t[35]!==e.packages?(h=function(D){const F=new Set(Object.values(D)),B=F.has("queued")||F.has("installing")?"installing":F.has("failed")?"failed":"installed";return B==="installing"?{status:"installing",title:"Installing packages",titleIcon:u.jsx(Ia,{className:"w-5 h-5 inline-block mr-2"}),description:"Installing packages:"}:B==="installed"?{status:"installed",title:"All packages installed!",titleIcon:u.jsx($p,{className:"w-5 h-5 inline-block mr-2"}),description:"Installed packages:"}:{status:"failed",title:"Some packages failed to install",titleIcon:u.jsx(dd,{className:"w-5 h-5 inline-block mr-2"}),description:"See terminal for error logs."}}(e.packages),t[35]=e.packages,t[36]=h):h=t[36];const{status:f,title:m,titleIcon:_,description:g}=h;f==="installed"&&setTimeout(()=>n(e.id),1e4);const p=f==="failed"?"danger":"info";let b,y,x,v,S;t[37]!==m||t[38]!==_?(b=u.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[_,m]}),t[37]=m,t[38]=_,t[39]=b):b=t[39],t[40]!==n||t[41]!==e.id?(y=()=>n(e.id),t[40]=n,t[41]=e.id,t[42]=y):y=t[42],t[43]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx(oo,{className:"w-5 h-5"}),t[43]=x):x=t[43],t[44]!==y?(v=u.jsx(Me,{variant:"text","data-testid":"remove-banner-button",size:"icon",onClick:y,children:x}),t[44]=y,t[45]=v):v=t[45],t[46]!==b||t[47]!==v?(S=u.jsxs("div",{className:"flex justify-between",children:[b,v]}),t[46]=b,t[47]=v,t[48]=S):S=t[48];const k=f==="installed"&&"text-accent-foreground";let E,N,I,T,M,R,z;if(t[49]!==k?(E=Ie("flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",k),t[49]=k,t[50]=E):E=t[50],t[51]!==g?(N=u.jsx("p",{children:g}),t[51]=g,t[52]=N):N=t[52],t[53]!==e.packages||t[54]!==f){let D;t[56]!==f?(D=(F,B)=>{const[V,O]=F;return u.jsxs("li",{className:Ie("flex items-center gap-1 font-mono text-sm",O==="installing"&&"font-semibold",O==="failed"&&"text-destructive",O==="installed"&&"text-accent-foreground",O==="installed"&&f==="failed"&&"text-muted-foreground"),children:[u.jsx(EM,{status:O}),V]},B)},t[56]=f,t[57]=D):D=t[57],I=Object.entries(e.packages).map(D),t[53]=e.packages,t[54]=f,t[55]=I}else I=t[55];return t[58]!==I?(T=u.jsx("ul",{className:"list-disc ml-4 mt-1",children:I}),t[58]=I,t[59]=T):T=t[59],t[60]!==N||t[61]!==T?(M=u.jsxs("div",{children:[N,T]}),t[60]=N,t[61]=T,t[62]=M):M=t[62],t[63]!==E||t[64]!==M?(R=u.jsx("div",{className:E,children:M}),t[63]=E,t[64]=M,t[65]=R):R=t[65],t[66]!==R||t[67]!==p||t[68]!==S?(z=u.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-12 min-w-[400px] z-[200] opacity-95",children:u.jsxs(Gc,{kind:p,className:"flex flex-col rounded pt-3 pb-4 px-5",children:[S,R]})}),t[66]=R,t[67]=p,t[68]=S,t[69]=z):z=t[69],z}return vc(e),null},EM=t=>{const e=J.c(4),{status:n}=t;switch(n){case"queued":{let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(si,{size:"1rem"}),e[0]=o):o=e[0],o}case"installing":{let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(Ia,{size:"1rem"}),e[1]=o):o=e[1],o}case"installed":{let o;return e[2]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(Nc,{size:"1rem"}),e[2]=o):o=e[2],o}case"failed":{let o;return e[3]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(oo,{size:"1rem"}),e[3]=o):o=e[3],o}default:return vc(n),null}},IM=t=>{const e=J.c(9),{manager:n,packages:o,versions:r,clearPackageAlert:s}=t;let i,a,l,c;return e[0]!==s||e[1]!==n||e[2]!==o||e[3]!==r?(i=async()=>{s();const d={...r};for(const h of o)d[h]=d[h]??"";await _V({manager:n,versions:d}).catch(OM)},e[0]=s,e[1]=n,e[2]=o,e[3]=r,e[4]=i):i=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx(Ia,{className:"w-4 h-4 mr-2"}),l=u.jsx("span",{className:"font-semibold",children:"Install"}),e[5]=a,e[6]=l):(a=e[5],l=e[6]),e[7]!==i?(c=u.jsxs(Me,{variant:"outline","data-testid":"install-packages-button",size:"sm",onClick:i,children:[a,l]}),e[7]=i,e[8]=c):c=e[8],c},AM=()=>{const t=J.c(16),[e,n]=$s();let o,r;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=f4(mV),t[0]=o):o=t[0],t[1]!==e?(r={resolver:o,defaultValues:e},t[1]=e,t[2]=r):r=t[2];const s=m4(r);let i;t[3]!==n?(i=async f=>{await zr({config:f}).then(()=>{n(f)})},t[3]=n,t[4]=i):i=t[4];const a=i;let l,c,d,h;return t[5]!==s||t[6]!==a?(l=s.handleSubmit(a),t[5]=s,t[6]=a,t[7]=l):l=t[7],t[8]!==s.control?(c=u.jsx("div",{className:"flex flex-col gap-3",children:u.jsx(c4,{control:s.control,name:"package_management.manager",render:RM})}),t[8]=s.control,t[9]=c):c=t[9],t[10]!==l||t[11]!==c?(d=u.jsx("form",{onChange:l,className:"flex flex-col gap-5",children:c}),t[10]=l,t[11]=c,t[12]=d):d=t[12],t[13]!==s||t[14]!==d?(h=u.jsx(pV,{...s,children:d}),t[13]=s,t[14]=d,t[15]=h):h=t[15],h},TM=t=>{const e=J.c(14),{packageName:n,selectedExtras:o,onExtrasChange:r}=t,[s,i]=A.useState(!1),{isPending:a,error:l,data:c}=$x(n);let d;e[0]!==r||e[1]!==o?(d=(g,p)=>{r(p?[...o,g]:o.filter(b=>b!==g))},e[0]=r,e[1]=o,e[2]=d):d=e[2];const h=d,f=!a&&!l;let m,_;if(e[3]!==(c==null?void 0:c.extras)?(m=(c==null?void 0:c.extras)??[],e[3]=c==null?void 0:c.extras,e[4]=m):m=e[4],e[5]!==f||e[6]!==h||e[7]!==s||e[8]!==n||e[9]!==o||e[10]!==m){const g=m.filter(PM);let p;e[12]!==n?(p=u.jsx("span",{className:"shrink-0",children:n}),e[12]=n,e[13]=p):p=e[13],_=u.jsxs("div",{className:"flex items-center max-w-72",children:[p,o.length>0?u.jsxs("span",{className:"flex items-center min-w-0 flex-1",children:[u.jsx("span",{className:"shrink-0",children:"["}),u.jsxs(Hs,{open:s&&f,onOpenChange:b=>{f&&i(b)},children:[u.jsx(Ws,{asChild:!0,children:u.jsx("button",{className:"hover:bg-muted/50 rounded text-sm px-1 transition-colors border border-muted-foreground/30 hover:border-muted-foreground/60 min-w-0 flex-1 truncate text-left",title:`Selected extras: ${o.join(", ")}`,children:o.join(",")})}),u.jsxs(qs,{align:"start",className:"w-64 p-0 max-h-96 flex flex-col",children:[o.length>0&&u.jsx("div",{className:"p-2 bg-popover border-b border-border",children:u.jsx("div",{className:"flex flex-wrap gap-1 p-1 min-h-[24px]",children:o.map(b=>u.jsxs("span",{className:"inline-flex items-center gap-1 px-1 py-0.5 text-sm font-mono border border-muted-foreground/30 hover:border-muted-foreground/60 rounded-sm cursor-pointer group transition-colors",onClick:()=>h(b,!1),children:[b,u.jsx(oo,{className:"w-3 h-3 opacity-60 group-hover:opacity-100"})]},b))})}),u.jsx("div",{className:"overflow-y-auto flex-1",children:g.map(b=>u.jsx(lS,{checked:o.includes(b),onCheckedChange:y=>{h(b,y)},className:"font-mono text-sm",onSelect:LM,children:b},b))})]})]}),u.jsx("span",{className:"shrink-0",children:"]"})]}):g.length>0?u.jsxs(Hs,{open:s&&f,onOpenChange:b=>{f&&i(b)},children:[u.jsx(Ws,{asChild:!0,children:u.jsx("button",{disabled:!f,className:Ie("hover:bg-muted/50 rounded text-sm ml-2 transition-colors border border-muted-foreground/30 hover:border-muted-foreground/60 h-5 w-5 flex items-center justify-center p-0",!f&&"opacity-50 cursor-not-allowed"),title:f?"Add extras":"Loading extras...",children:u.jsx(pr,{className:"w-3 h-3 flex-shrink-0"})})}),u.jsxs(qs,{align:"start",className:"w-64 p-0 max-h-96 flex flex-col",children:[u.jsx("div",{className:"p-2 bg-popover border-b border-border",children:u.jsx("span",{className:"text-muted-foreground italic text-sm",children:"Package extras"})}),u.jsx("div",{className:"overflow-y-auto flex-1",children:g.map(b=>u.jsx(lS,{checked:o.includes(b),onCheckedChange:y=>{h(b,y)},className:"font-mono text-sm",onSelect:FM,children:b},b))})]})]}):null]}),e[5]=f,e[6]=h,e[7]=s,e[8]=n,e[9]=o,e[10]=m,e[11]=_}else _=e[11];return _},MM=t=>{const e=J.c(16),{value:n,onChange:o,packageName:r}=t,{error:s,isPending:i,data:a}=$x(r);if(s){let h,f,m;return e[0]!==o?(h=_=>o(_.target.value),e[0]=o,e[1]=h):h=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsx("option",{value:"latest",children:"latest"}),e[2]=f):f=e[2],e[3]!==h||e[4]!==n?(m=u.jsx(Te,{content:"Failed to fetch package versions",children:u.jsx(Zm,{value:n,onChange:h,disabled:!0,className:"inline-flex ml-2 w-24 text-ellipsis",children:f})}),e[3]=h,e[4]=n,e[5]=m):m=e[5],m}let l,c,d;return e[6]!==o?(l=h=>o(h.target.value),e[6]=o,e[7]=l):l=e[7],e[8]!==i||e[9]!==a?(c=i?u.jsx("option",{value:"latest",children:"latest"}):["latest",...a.versions.slice(0,100)].map(zM),e[8]=i,e[9]=a,e[10]=c):c=e[10],e[11]!==i||e[12]!==l||e[13]!==c||e[14]!==n?(d=u.jsx(Zm,{value:n,onChange:l,disabled:i,className:"inline-flex ml-2 w-24 text-ellipsis",children:c}),e[11]=i,e[12]=l,e[13]=c,e[14]=n,e[15]=d):d=e[15],d};function OM(t){Dt.error(t)}function DM(t){return u.jsx("option",{value:t,children:t},t)}function RM(t){const{field:e}=t;return u.jsxs(d4,{children:[u.jsx(u4,{children:u.jsx(Zm,{"data-testid":"install-package-manager-select",onChange:n=>e.onChange(n.target.value),value:e.value,disabled:e.disabled,className:"inline-flex mr-2",children:gV.map(DM)})}),u.jsx(h4,{})]})}function PM(t){return!/^(dev|test|testing)$/i.test(t)}function LM(t){return t.preventDefault()}function FM(t){return t.preventDefault()}function zM(t){return u.jsx("option",{value:t,children:t},t)}const BM=t=>{let{transform:e}=t;return{...e,x:0}},UM={threshold:{x:0,y:.1}},VM=Y.memo(t=>{const e=J.c(23),{children:n,multiColumn:o}=t,{dropCellOverCell:r,dropCellOverColumn:s,moveColumn:i,compactColumns:a}=Ot(),[l,c]=A.useState(null),[d,h]=A.useState(null),[f]=s4();let m;e:{if(f.width==="columns"){m=Qm.EMPTY;break e}let D;e[0]===Symbol.for("react.memo_cache_sentinel")?(D=[BM],e[0]=D):D=e[0],m=D}const _=m;let g,p;e[1]===Symbol.for("react.memo_cache_sentinel")?(g={activationConstraint:{distance:8}},e[1]=g):g=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(p={coordinateGetter:Qj},e[2]=p):p=e[2];const b=function(){for(var D=arguments.length,F=new Array(D),B=0;B<D;B++)F[B]=arguments[B];return A.useMemo(()=>[...F].filter(V=>V!=null),[...F])}(e1(Vd,g),e1(Bd,p));let y;e[3]===Symbol.for("react.memo_cache_sentinel")?(y=D=>{c(D.active.id);const F=Wn();h(F.cellIds)},e[3]=y):y=e[3];const x=et(y);let v;e[4]!==d?(v=()=>{c(null),h(null)},e[4]=d,e[5]=v):v=e[5];const S=et(v);let k;e[6]!==l?(k=D=>{const F=D.droppableContainers.filter($M);if(l&&ds(l))return Rd({...D,droppableContainers:F});const B=(j=>{let{droppableContainers:W,droppableRects:K,pointerCoordinates:Z}=j;if(!Z)return[];const q=[];for(const ne of W){const{id:re}=ne,ae=K.get(re);if(ae&&_j(Z,ae)){const X=Od(ae).reduce((ce,me)=>ce+Td(Z,me),0),ee=Number((X/4).toFixed(4));q.push({id:re,data:{droppableContainer:ne,value:ee}})}}return q.sort(Md)})({...D,droppableContainers:F}),V=Dd(B.length>0?B:n1({...D,droppableContainers:F}),"id");if(!V)return[];Bo(ds(V),`Expected column id. Got: ${V}`);const O=Wn().cellIds.get(V);if(Bo(O,`Expected column. Got: ${V}`),O&&O.topLevelIds.length===0)return[{id:V}];const C=new Set(O.topLevelIds),$=Rd({...D,droppableContainers:D.droppableContainers.filter(j=>j.id!==V&&C.has(j.id))});if($.length>0){const j=$[0].id;return Bo(th(j),`Expected cell id. Got: ${j}`),[{id:j}]}return[]},e[6]=l,e[7]=k):k=e[7];const E=k;let N;e[8]!==r||e[9]!==s||e[10]!==i?(N=D=>{const{active:F,over:B}=D,V=B==null?void 0:B.id;if(V!=null&&F.id!==V){if(th(F.id)){if(ds(V))return void s({cellId:F.id,columnId:V});if(th(V))return void r({cellId:F.id,overCellId:V})}ds(F.id)&&ds(V)&&i({column:F.id,overColumn:V})}},e[8]=r,e[9]=s,e[10]=i,e[11]=N):N=e[11];const I=et(N);let T;e[12]!==a?(T=D=>{const{active:F,over:B}=D;B!==null&&F.id!==B.id&&a()},e[12]=a,e[13]=T):T=e[13];const M=et(T),R=o?E:Rd;let z;return e[14]!==n||e[15]!==S||e[16]!==M||e[17]!==I||e[18]!==x||e[19]!==_||e[20]!==b||e[21]!==R?(z=u.jsx(Bj,{autoScroll:UM,sensors:b,collisionDetection:R,modifiers:_,onDragEnd:M,onDragStart:x,onDragCancel:S,onDragOver:I,children:n}),e[14]=n,e[15]=S,e[16]=M,e[17]=I,e[18]=x,e[19]=_,e[20]=b,e[21]=R,e[22]=z):z=e[22],z});function th(t){return typeof t=="string"&&!t.startsWith("tree_")}function ds(t){return typeof t=="string"&&t.startsWith("tree_")}function $M(t){return ds(t.id)}const HM=t=>{const e=J.c(13),{className:n,size:o,gap:r,durationMs:s}=t,i=o===void 0?8:o,a=r===void 0?"gap-1":r,l=s===void 0?1200:s,c=`${l}ms`;let d;e[0]!==c?(d={animationDuration:c},e[0]=c,e[1]=d):d=e[1];const h=d;let f,m,_,g;return e[2]!==n||e[3]!==a?(f=Wc("flex",a,n),e[2]=n,e[3]=a,e[4]=f):f=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(m=[0,1,2],e[5]=m):m=e[5],e[6]!==h||e[7]!==l||e[8]!==i?(_=m.map(p=>u.jsx(bV,{width:i,height:i,className:"fill-current text-current animate-ellipsis-dot",style:{...h,animationDelay:l/3*p+"ms"}},p)),e[6]=h,e[7]=l,e[8]=i,e[9]=_):_=e[9],e[10]!==f||e[11]!==_?(g=u.jsx("div",{className:f,"aria-label":"Loading",children:_}),e[10]=f,e[11]=_,e[12]=g):g=e[12],g},WM=()=>{const t=J.c(2),e=$e(yV);let n;return t[0]!==e?(n=e&&u.jsx(Jm,{milliseconds:1e3,children:u.jsx("div",{className:"absolute top-4 m-0 flex items-center min-h-[28px] left-1/2 transform -translate-x-1/2 z-[200] ",children:u.jsx(Te,{content:"Connecting to a marimo runtime",children:u.jsx("div",{className:"flex items-center",children:u.jsx(HM,{size:5,className:"text-yellow-500"})})})})}),t[0]=e,t[1]=n):n=t[1],n},Wx=Y.forwardRef((t,e)=>{const n=J.c(62);let o,r,s,i,a,l;n[0]!==t?({columnId:i,canDelete:o,canMoveLeft:r,canMoveRight:s,...a}=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]),n[6]!==i?(l={id:i},n[6]=i,n[7]=l):l=n[7];const{attributes:c,listeners:d,setNodeRef:h,transform:f,transition:m,isDragging:_,isOver:g}=T1(l);let p;n[8]!==f?(p=f?Rc.Transform.toString({x:f.x,y:0,scaleX:1,scaleY:1}):void 0,n[8]=f,n[9]=p):p=n[9];const b=_?2:void 0;let y;n[10]!==p||n[11]!==b||n[12]!==m?(y={transform:p,transition:m,zIndex:b,position:"relative","--gutter-width":"50px"},n[10]=p,n[11]=b,n[12]=m,n[13]=y):y=n[13];const x=y,{deleteColumn:v,moveColumn:S,addColumn:k}=Ot();let E;n[14]===Symbol.for("react.memo_cache_sentinel")?(E=Ie("h-full hover:bg-muted rounded-none"),n[14]=E):E=n[14];const N=E,I=GM;let T;n[15]!==i||n[16]!==S?(T=()=>S({column:i,overColumn:"_left_"}),n[15]=i,n[16]=S,n[17]=T):T=n[17];const M=!r;let R,z,D;n[18]===Symbol.for("react.memo_cache_sentinel")?(R=u.jsx(r4,{className:"size-4"}),n[18]=R):R=n[18],n[19]!==T||n[20]!==M?(z=u.jsx(Te,{content:"Move column left",side:"top",delayDuration:300,children:u.jsx(Me,{variant:"text",size:"sm",className:N,onClick:T,disabled:M,children:R})}),n[19]=T,n[20]=M,n[21]=z):z=n[21],n[22]!==i||n[23]!==S?(D=()=>S({column:i,overColumn:"_right_"}),n[22]=i,n[23]=S,n[24]=D):D=n[24];const F=!s;let B,V,O,C,$,j,W,K;n[25]===Symbol.for("react.memo_cache_sentinel")?(B=u.jsx(ia,{className:"size-4"}),n[25]=B):B=n[25],n[26]!==D||n[27]!==F?(V=u.jsx(Te,{content:"Move column right",side:"top",delayDuration:300,children:u.jsx(Me,{variant:"text",size:"sm",className:N,onClick:D,disabled:F,children:B})}),n[26]=D,n[27]=F,n[28]=V):V=n[28],n[29]!==c||n[30]!==d?(O=u.jsx("div",{className:"flex gap-2 h-full flex-grow active:bg-accent cursor-grab",...c,...d,"data-testid":"column-drag-button"}),n[29]=c,n[30]=d,n[31]=O):O=n[31],n[32]!==o||n[33]!==i||n[34]!==v?(C=o&&u.jsx(Te,{content:"Delete column",side:"top",delayDuration:300,children:u.jsx(Me,{variant:"text",size:"sm",className:"opacity-0 group-hover:opacity-70 group-hover:hover:opacity-100 text-destructive h-full hover:bg-destructive/20 rounded-none",onClick:()=>v({columnId:i}),children:u.jsx(oo,{className:"size-4"})})}),n[32]=o,n[33]=i,n[34]=v,n[35]=C):C=n[35],n[36]!==k||n[37]!==i?($=()=>{k({columnId:i}),requestAnimationFrame(I)},n[36]=k,n[37]=i,n[38]=$):$=n[38],n[39]===Symbol.for("react.memo_cache_sentinel")?(j=u.jsx(pr,{className:"size-4"}),n[39]=j):j=n[39],n[40]!==$?(W=u.jsx(Te,{content:"Add column",side:"top",delayDuration:300,children:u.jsx(Me,{variant:"text",size:"sm",className:N,onClick:$,children:j})}),n[40]=$,n[41]=W):W=n[41],n[42]!==V||n[43]!==O||n[44]!==C||n[45]!==W||n[46]!==z?(K=u.jsxs("div",{className:"h-6 group flex items-center rounded-t-lg border hover:border-border border-[var(--slate-3)] overflow-hidden bg-[var(--slate-1)]",children:[z,V,O,C,W]}),n[42]=V,n[43]=O,n[44]=C,n[45]=W,n[46]=z,n[47]=K):K=n[47];const Z=K;let q;n[48]!==e||n[49]!==h?(q=ce=>{Nl(e,h)(ce)},n[48]=e,n[49]=h,n[50]=q):q=n[50];const ne=_?"":a.className,re=_?"z-20":"z-1 hover:z-10 focus-within:z-10",ae=g&&"bg-accent/20";let X,ee;return n[51]!==ne||n[52]!==re||n[53]!==ae?(X=Ie(ne,re,ae),n[51]=ne,n[52]=re,n[53]=ae,n[54]=X):X=n[54],n[55]!==Z||n[56]!==_||n[57]!==a||n[58]!==x||n[59]!==q||n[60]!==X?(ee=u.jsxs("div",{tabIndex:-1,ref:q,...a,style:x,"data-is-dragging":_,className:X,children:[Z,a.children]}),n[55]=Z,n[56]=_,n[57]=a,n[58]=x,n[59]=q,n[60]=X,n[61]=ee):ee=n[61],ee});Wx.displayName="SortableColumn";const qM=A.memo(Wx);function GM(){const t=document.getElementById("App");t&&t.scrollTo({left:t.scrollLeft+1e3,behavior:"smooth"})}const{getColumnWidth:YM,saveColumnWidth:JM}=xV,qx=A.memo(t=>{const e=J.c(14),n=A.useRef(null);let o;e[0]!==t.children||e[1]!==t.index||e[2]!==t.width?(o=t.width==="columns"?u.jsx(KM,{startingWidth:YM(t.index),onResize:i=>{JM(t.index,i)},children:t.children}):u.jsx("div",{className:"flex flex-col gap-5",children:t.children}),e[0]=t.children,e[1]=t.index,e[2]=t.width,e[3]=o):o=e[3];const r=o;if(t.width==="columns"){let i;return e[4]!==r||e[5]!==t.canDelete||e[6]!==t.canMoveLeft||e[7]!==t.canMoveRight||e[8]!==t.columnId||e[9]!==t.footer?(i=u.jsxs(qM,{tabIndex:-1,ref:n,canDelete:t.canDelete,columnId:t.columnId,canMoveLeft:t.canMoveLeft,canMoveRight:t.canMoveRight,className:"group/column",children:[r,t.footer]}),e[4]=r,e[5]=t.canDelete,e[6]=t.canMoveLeft,e[7]=t.canMoveRight,e[8]=t.columnId,e[9]=t.footer,e[10]=i):i=e[10],i}let s;return e[11]!==r||e[12]!==t.footer?(s=u.jsxs(u.Fragment,{children:[r,t.footer]}),e[11]=r,e[12]=t.footer,e[13]=s):s=e[13],s});qx.displayName="Column";const KM=t=>{const e=J.c(15),{startingWidth:n,onResize:o,children:r}=t;let s;e[0]!==o||e[1]!==n?(s={startingWidth:n,onResize:o},e[0]=o,e[1]=n,e[2]=s):s=e[2];const{resizableDivRef:i,handleRefs:a,style:l}=wV(s),c=XM;let d,h,f,m;return e[3]!==a.left?(d=c(a.left),e[3]=a.left,e[4]=d):d=e[4],e[5]!==r||e[6]!==i||e[7]!==l?(h=u.jsx("div",{ref:i,className:"flex flex-col gap-5 box-content min-h-[100px] px-11 py-6 min-w-[500px] z-1",style:l,children:r}),e[5]=r,e[6]=i,e[7]=l,e[8]=h):h=e[8],e[9]!==a.right?(f=c(a.right),e[9]=a.right,e[10]=f):f=e[10],e[11]!==d||e[12]!==h||e[13]!==f?(m=u.jsxs("div",{className:"flex flex-row",children:[d,h,f]}),e[11]=d,e[12]=h,e[13]=f,e[14]=m):m=e[14],m};function XM(t){return u.jsx("div",{ref:t,className:`w-[3px] cursor-col-resize transition-colors duration-200 z-[100]
120
+ `);o!==r&&this.getTextFromDoc(this.doc).delete(o+n,r-o),l.length>0&&this.getTextFromDoc(this.doc).insert(o+n,l),n+=l.length-(r-o)}),this.doc.commit()}destroy(){var e;(e=this.sub)==null||e.call(this),this.sub=void 0}}const un=Dt.get("rtc"),Gy=un.get("awareness").disabled(),Uu="awareness:",ss=en(void 0),Wt=new xo,Cl=new class{constructor(t,e=3e4){this.listeners=new Set,this.inner=new P0(t,e),this.peer=t,this.timeout=e}apply(t,e="remote"){const{updated:n,added:o}=this.inner.apply(t);this.listeners.forEach(r=>{r({updated:n,added:o,removed:[]},e)}),this.startTimerIfNotEmpty()}setLocalState(t){const e=this.inner.getState(this.peer)==null;this.inner.setLocalState(t),e?this.listeners.forEach(n=>{n({updated:[],added:[this.inner.peer()],removed:[]},"local")}):this.listeners.forEach(n=>{n({updated:[this.inner.peer()],added:[],removed:[]},"local")}),this.startTimerIfNotEmpty()}getLocalState(){return this.inner.getState(this.peer)}getAllStates(){return this.inner.getAllStates()}encode(t){return this.inner.encode(t)}encodeAll(){return this.inner.encodeAll()}addListener(t){this.listeners.add(t)}removeListener(t){this.listeners.delete(t)}peers(){return this.inner.peers()}destroy(){clearInterval(this.timer),this.listeners.clear()}startTimerIfNotEmpty(){this.inner.isEmpty()||this.timer!=null||(this.timer=setInterval(()=>{const t=this.inner.removeOutdated();t.length>0&&this.listeners.forEach(e=>{e({updated:[],added:[],removed:t},"timeout")}),this.inner.isEmpty()&&(clearInterval(this.timer),this.timer=void 0)},this.timeout/2))}}(Wt.peerIdStr),Vu=YU(()=>{un.debug("creating websocket");const t=D4().getWsSyncURL(G4()).toString(),e=new kH(t,void 0,{maxRetries:10,debug:!1,startClosed:!0,connectionTimeout:1e4});return Promise.resolve().then(async()=>{await R4(),JU()==="edit"&&e.reconnect()}),e.addEventListener("message",async n=>{const o=n.data,r=await o.arrayBuffer(),s=new Uint8Array(r);if(function(i,a){return new TextDecoder().decode(i.slice(0,a.length))===a}(s,Uu)){const i=function(a,l){return a.slice(l.length)}(s,Uu);return Cl.apply(i),void Gy.debug("applied awareness update")}Wt.import(s),un.debug("imported doc change. new doc:",Wt.toJSON()),dt.get(ss)!==Wt&&dt.set(ss,Wt)}),e.addEventListener("open",()=>{un.debug("websocket open")}),e.addEventListener("close",n=>{un.warn("websocket close",n),dt.get(ss)===Wt&&dt.set(ss,void 0)}),e});function $u(t,e,n=""){if(In())return{extension:[],code:n};const o=Wt.getByPath(`codes/${t}`)!==void 0,r=Wt.getMap("codes").getOrCreateContainer(t,new Xo);o||(un.log("initializing code for new cell",n),r.insert(0,n));const s={get name(){return dt.get(Y4)||"Anonymous"},get colorClassName(){return(i=>{if(typeof i=="string"){let a=0;for(let l=0;l<i.length;l++)a=(a<<5)-a+i.charCodeAt(l),a=Math.trunc(a);return Sl[Math.abs(a)%Sl.length]}return Sl[i%Sl.length]})(this.name)}};return{code:n.toString(),extension:[H7(t),W7(t),q7(Wt,Cl,s,()=>r,t),V7(Wt,["codes",t],()=>r)]}}function H7(t){const e=(o,r)=>{const s=o.state.field(zc).type,i=r.toString();i&&i!==s&&(un.debug(`[incoming] setting language type: ${s} -> ${i}`),Pr(o,i,{keepCodeAsIs:!0}))},n=(o,r)=>{const s=o.state.field(Wm),i=r.toJSON();ha(s,i)||o.dispatch({effects:[W4.of(i)],annotations:[rs.of(!0)]})};return Mn.define(o=>{let r;return Promise.resolve().then(()=>{const s=Wt.getByPath(`languages/${t}`);if(!s)return void un.error("no language container found for cell",t);Bo(s instanceof Xo,"language type is not a LoroText");const i=Wt.getByPath(`language_metadata/${t}`);i?(Bo(i instanceof Ko,"language metadata is not a LoroMap"),e(o,s),n(o,i),r=Wt.subscribe(a=>{if(a.origin==="local")return;const l=a.events.some(d=>d.target===s.id),c=a.events.some(d=>d.target===i.id);l&&e(o,s),c&&n(o,i)})):un.error("no language metadata container found for cell",t)}),{destroy(){r()}}})}function W7(t){const e=Wt.getMap("languages").getOrCreateContainer(t,new Xo),n=Wt.getMap("language_metadata").getOrCreateContainer(t,new Ko);return st.updateListener.of(o=>{const r=e.toString()!=="";if(!o.docChanged&&r)return;if(!r){const i=Hm(o.state).type;Pr(o.view,i),un.debug("no initial language, setting default to",i),e.delete(0,e.length),e.insert(0,i),un.debug("no initial language metadata, setting default to",o.state.field(Wm));const a=o.state.field(Wm);for(const l of Object.keys(a))n.set(l,a[l]);return void Wt.commit()}let s=!1;for(const i of o.transactions)if(!i.annotation(rs)){for(const a of i.effects)if(a.is(GU)&&e.toString()!==a.value.type&&(un.debug(`[outgoing] language change: ${e} -> ${a.value.type}`),e.delete(0,e.length),e.insert(0,a.value.type),s=!0),a.is(W4)||a.is(q4)){const l=a.value;a.is(q4)?(un.debug("[outgoing] setting language metadata: ",l),n.clear()):un.debug("[outgoing] updating language metadata: ",l);for(const c of Object.keys(l))n.set(c,l[c]);s=!0}}s&&Wt.commit()})}function q7(t,e,n,o,r,s){const i=`loro:cell:${r}`;return[Bu,H4({above:!0,class:"loro-cursor-layer",update:Wy,markers:a=>{const{remoteCursors:l,isCheckout:c}=a.state.field(Bu);return c?[]:[...l.values()].flatMap(d=>{var f,m;const h=Uo.cursor(d.cursor.anchor);return kl.createCursor(a,h,((f=d.user)==null?void 0:f.name)||"unknown",((m=d.user)==null?void 0:m.colorClassName)||"")})}}),H4({above:!1,class:"loro-selection-layer",update:Wy,markers:a=>{const{remoteCursors:l,isCheckout:c}=a.state.field(Bu);return c?[]:[...l.entries()].filter(([,d])=>d.cursor.head!==void 0&&d.cursor.anchor!==d.cursor.head).flatMap(([,d])=>{var f;const h=Uo.range(d.cursor.anchor,d.cursor.head);return WU.forRange(a,`loro-selection ${((f=d.user)==null?void 0:f.colorClassName)||""}`,h)})}}),Mn.define(a=>new z7(a,t,n,e,o,i,s)),Mn.define(a=>new B7(a,t,e,i)),L7]}function Nl(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}$c()&&Vu(),Wt.subscribeLocalUpdates(t=>{un.debug("local update, sending to server"),Vu().send(t)}),Cl.addListener((t,e)=>{const n=[...t.added,...t.removed,...t.updated];e==="local"&&(Gy.debug("awareness changes",n),Vu().send(function(o,r){const s=new TextEncoder().encode(o);return new Uint8Array([...s,...r])}(Uu,Cl.encode(n))))});var Yy={modified:{doc:""},original:{doc:""}},Jy=A.createContext(Yy);function G7(t,e){return jt({},t,e,{modified:jt({},t.modified,e.modified),original:jt({},t.original,e.original)})}var Hu=()=>A.useContext(Jy),Y7=t=>{var{children:e,theme:n}=t,[o,r]=A.useReducer(G7,jt({},Yy,{theme:n}));return A.useEffect(()=>r({theme:n}),[n]),u.jsx(Jy.Provider,{value:jt({},o,{dispatch:r}),children:e})},J7=["extensions","value","selection","onChange"],Ky=t=>{var{extensions:e=[],value:n,selection:o,onChange:r}=t,s=va(t,J7),{theme:i,dispatch:a}=Hu(),l=ni(jt({},s,{theme:i}));return A.useEffect(()=>a({original:{doc:n,selection:o,extensions:[...l,...e]},originalExtension:{onChange:r,option:s,extension:[e]}}),[t]),null};Ky.displayName="CodeMirrorMerge.Original";var K7=["extensions","value","selection","onChange"],Xy=t=>{var{extensions:e=[],value:n,selection:o,onChange:r}=t,s=va(t,K7),{theme:i,dispatch:a}=Hu(),l=ni(jt({},s,{theme:i}));return A.useEffect(()=>{a({modified:{doc:n,selection:o,extensions:[...l,...e]},modifiedExtension:{onChange:r,option:s,extension:[e]}})},[t]),null};Xy.displayName="CodeMirrorMerge.Modified";class Tt{constructor(e,n,o,r){this.fromA=e,this.toA=n,this.fromB=o,this.toB=r}offset(e,n){return new Tt(this.fromA+e,this.toA+e,this.fromB+n,this.toB+n)}}function Ar(t,e,n,o,r,s){if(t==o)return[];let i=Gu(t,e,n,o,r,s),a=Yu(t,e+i,n,o,r+i,s),l=(n-=a)-(e+=i),c=(s-=a)-(r+=i);if(!l||!c)return[new Tt(e,n,r,s)];if(l>c){let h=t.slice(e,n).indexOf(o.slice(r,s));if(h>-1)return[new Tt(e,e+h,r,r),new Tt(e+h+c,n,s,s)]}else if(c>l){let h=o.slice(r,s).indexOf(t.slice(e,n));if(h>-1)return[new Tt(e,e,r,r+h),new Tt(n,n,r+h+l,s)]}if(l==1||c==1)return[new Tt(e,n,r,s)];let d=ex(t,e,n,o,r,s);if(d){let[h,f,m]=d;return Ar(t,e,h,o,r,f).concat(Ar(t,h+m,n,o,f+m,s))}return function(h,f,m,_,g,p){let b=m-f,y=p-g;if(Li<1e9&&Math.min(b,y)>16*Li)return Math.min(b,y)>64*Li?[new Tt(f,m,g,p)]:tx(h,f,m,_,g,p);let x=Math.ceil((b+y)/2);Wu.reset(x),qu.reset(x);let v=(N,I)=>h.charCodeAt(f+N)==_.charCodeAt(g+I),S=(N,I)=>h.charCodeAt(m-N-1)==_.charCodeAt(p-I-1),k=(b-y)%2!=0?qu:null,E=k?null:Wu;for(let N=0;N<x;N++){if(N>Li)return tx(h,f,m,_,g,p);let I=Wu.advance(N,b,y,x,k,!1,v)||qu.advance(N,b,y,x,E,!0,S);if(I)return X7(h,f,m,f+I[0],_,g,p,g+I[1])}return[new Tt(f,m,g,p)]}(t,e,n,o,r,s)}let Li=1e9;class Zy{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let n=0;n<this.len;n++)this.vec[n]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,n,o,r,s,i,a){for(let l=-e+this.start;l<=e-this.end;l+=2){let c=r+l,d=l==-e||l!=e&&this.vec[c-1]<this.vec[c+1]?this.vec[c+1]:this.vec[c-1]+1,h=d-l;for(;d<n&&h<o&&a(d,h);)d++,h++;if(this.vec[c]=d,d>n)this.end+=2;else if(h>o)this.start+=2;else if(s){let f=r+(n-o)-l;if(f>=0&&f<this.len&&s.vec[f]!=-1){if(i){let m=s.vec[f];if(m>=n-d)return[m,r+m-f]}else if(d>=n-s.vec[f])return[d,h]}}}return null}}const Wu=new Zy,qu=new Zy;function X7(t,e,n,o,r,s,i,a){let l=!1;return is(t,o)||++o!=n||(l=!0),is(r,a)||++a!=i||(l=!0),l?[new Tt(e,n,s,i)]:Ar(t,e,o,r,s,a).concat(Ar(t,o,n,r,a,i))}function Qy(t,e){let n=1,o=Math.min(t,e);for(;n<o;)n<<=1;return n}function Gu(t,e,n,o,r,s){if(e==n||e==s||t.charCodeAt(e)!=o.charCodeAt(r))return 0;let i=Qy(n-e,s-r);for(let a=e,l=r;;){let c=a+i,d=l+i;if(c>n||d>s||t.slice(a,c)!=o.slice(l,d)){if(i==1)return a-e-(is(t,a)?0:1);i>>=1}else{if(c==n||d==s)return c-e;a=c,l=d}}}function Yu(t,e,n,o,r,s){if(e==n||r==s||t.charCodeAt(n-1)!=o.charCodeAt(s-1))return 0;let i=Qy(n-e,s-r);for(let a=n,l=s;;){let c=a-i,d=l-i;if(c<e||d<r||t.slice(c,a)!=o.slice(d,l)){if(i==1)return n-a-(is(t,a)?0:1);i>>=1}else{if(c==e||d==r)return n-c;a=c,l=d}}}function Ju(t,e,n,o,r,s,i,a){let l=o.slice(r,s),c=null;for(;;){if(c||i<a)return c;for(let d=e+i;;){is(t,d)||d++;let h=d+i;if(is(t,h)||(h+=h==d+1?1:-1),h>=n)break;let f=t.slice(d,h),m=-1;for(;(m=l.indexOf(f,m+1))!=-1;){let _=Gu(t,h,n,o,r+m+f.length,s),g=Yu(t,e,d,o,r,r+m),p=f.length+_+g;(!c||c[2]<p)&&(c=[d-g,r+m-g,p])}d=h}if(a<0)return c;i>>=1}}function ex(t,e,n,o,r,s){let i=n-e,a=s-r;if(i<a){let l=ex(o,r,s,t,e,n);return l&&[l[1],l[0],l[2]]}return i<4||2*a<i?null:Ju(t,e,n,o,r,s,Math.floor(i/4),-1)}function tx(t,e,n,o,r,s){let i,a=n-e,l=s-r;if(a<l){let f=Ju(o,r,s,t,e,n,Math.floor(a/6),50);i=f&&[f[1],f[0],f[2]]}else i=Ju(t,e,n,o,r,s,Math.floor(l/6),50);if(!i)return[new Tt(e,n,r,s)];let[c,d,h]=i;return Ar(t,e,c,o,r,d).concat(Ar(t,c+h,n,o,d+h,s))}function nx(t,e){for(let n=1;n<t.length;n++){let o=t[n-1],r=t[n];o.toA>r.fromA-e&&o.toB>r.fromB-e&&(t[n-1]=new Tt(o.fromA,r.toA,o.fromB,r.toB),t.splice(n--,1))}}let Tr;try{Tr=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function ox(t){return t>48&&t<58||t>64&&t<91||t>96&&t<123}function rx(t,e){if(e==t.length)return 0;let n=t.charCodeAt(e);return n<192?ox(n)?1:0:Tr?lx(n)&&e!=t.length-1?Tr.test(t.slice(e,e+2))?2:0:Tr.test(String.fromCharCode(n))?1:0:0}function sx(t,e){if(!e)return 0;let n=t.charCodeAt(e-1);return n<192?ox(n)?1:0:Tr?cx(n)&&e!=1?Tr.test(t.slice(e-2,e))?2:0:Tr.test(String.fromCharCode(n))?1:0:0}function ix(t,e,n){if(e==t.length||!sx(t,e))return e;for(let o=e,r=e+n;;){let s=rx(t,o);if(!s)return o;if(o+=s,o>r)return e}}function ax(t,e,n){if(!e||!rx(t,e))return e;for(let o=e,r=e-n;;){let s=sx(t,o);if(!s)return o;if(o-=s,o<r)return e}}function Z7(t,e,n){for(let o=e,r=e-n;;){let s=o?t.charCodeAt(o-1):10;if(s==10)return o;if(o--,o<r||s!=32&&s!=9)return e}}const lx=t=>t>=55296&&t<=56319,cx=t=>t>=56320&&t<=57343;function is(t,e){return!e||e==t.length||!lx(t.charCodeAt(e-1))||!cx(t.charCodeAt(e))}function Q7(t,e,n){var o;return Li=((o=n==null?void 0:n.scanLimit)!==null&&o!==void 0?o:1e9)>>1,function(r,s,i){for(;;){nx(i,1);let a=!1;for(let l=0;l<i.length;l++){let c,d,h=i[l];(c=Gu(r,h.fromA,h.toA,s,h.fromB,h.toB))&&(h=i[l]=new Tt(h.fromA+c,h.toA,h.fromB+c,h.toB)),(d=Yu(r,h.fromA,h.toA,s,h.fromB,h.toB))&&(h=i[l]=new Tt(h.fromA,h.toA-d,h.fromB,h.toB-d));let f=h.toA-h.fromA,m=h.toB-h.fromB;if(f&&m)continue;let _=h.fromA-(l?i[l-1].toA:0),g=(l<i.length-1?i[l+1].fromA:r.length)-h.toA;if(!_||!g)continue;let p=f?r.slice(h.fromA,h.toA):s.slice(h.fromB,h.toB);_<=p.length&&r.slice(h.fromA-_,h.fromA)==p.slice(p.length-_)?(i[l]=new Tt(h.fromA-_,h.toA-_,h.fromB-_,h.toB-_),a=!0):g<=p.length&&r.slice(h.toA,h.toA+g)==p.slice(0,g)&&(i[l]=new Tt(h.fromA+g,h.toA+g,h.fromB+g,h.toB+g),a=!0)}if(!a)break}return i}(t,e,Ar(t,0,t.length,e,0,e.length))}function dx(t,e,n){return function(o,r,s){for(let i=0,a=0;a<o.length;a++){let l=o[a],c=l.toA-l.fromA,d=l.toB-l.fromB;if(c&&d||c>3||d>3){let h=a==o.length-1?r.length:o[a+1].fromA,f=l.fromA-i,m=h-l.toA,_=ax(r,l.fromA,Math.min(f,5)),g=ix(r,l.toA,Math.min(m,5)),p=l.fromA-_,b=g-l.toA;if(!c||!d){let y,x,v=Math.max(c,d),[S,k,E]=c?[r,l.fromA,l.toA]:[s,l.fromB,l.toB];p&&b?(v>p&&r.slice(_,l.fromA)==S.slice(E-p,E)?(l=o[a]=new Tt(_,_+c,l.fromB-p,l.toB-p),_=l.fromA,g=ix(r,l.toA,Math.min(h-l.toA,5))):v>b&&r.slice(l.toA,g)==S.slice(k,k+b)&&(l=o[a]=new Tt(g-c,g,l.fromB+b,l.toB+b),g=l.toA,_=ax(r,l.fromA,Math.min(l.fromA-i,5))),p=l.fromA-_,b=g-l.toA):p||b||!(x=l.fromA-(y=Z7(r,l.fromA,f)))||r.slice(y,l.fromA)!=S.slice(E-x,E)||(l=o[a]=new Tt(y,y+c,l.fromB-x,l.toB-x))}(p||b)&&(l=o[a]=new Tt(l.fromA-p,l.toA+b,l.fromB-p,l.toB+b)),i=l.toA}}return nx(o,3),o}(Q7(t,e,n),t,e)}const lo=Zs.define({combine:t=>t[0]}),Ku=Rt.define(),as=On.define({create:t=>null,update(t,e){for(let n of e.effects)n.is(Ku)&&(t=n.value);return t}});class ls{constructor(e,n,o,r,s){this.changes=e,this.fromA=n,this.toA=o,this.fromB=r,this.toB=s}offset(e,n){return e||n?new ls(this.changes,this.fromA+e,this.toA+e,this.fromB+n,this.toB+n):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,n,o){return fx(dx(e.toString(),n.toString(),o),e,n,0,0)}static updateA(e,n,o,r,s){return gx(px(e,r,!0,o.length),e,n,o,s)}static updateB(e,n,o,r,s){return gx(px(e,r,!1,n.length),e,n,o,s)}}function ux(t,e,n,o){let r=n.lineAt(t),s=o.lineAt(e);return r.to==t&&s.to==e&&t<n.length&&e<o.length?[t+1,e+1]:[r.from,s.from]}function hx(t,e,n,o){let r=n.lineAt(t),s=o.lineAt(e);return r.from==t&&s.from==e?[t,e]:[r.to+1,s.to+1]}function fx(t,e,n,o,r){let s=[];for(let i=0;i<t.length;i++){let a=t[i],[l,c]=ux(a.fromA+o,a.fromB+r,e,n),[d,h]=hx(a.toA+o,a.toB+r,e,n),f=[a.offset(-l+o,-c+r)];for(;i<t.length-1;){let m=t[i+1],[_,g]=ux(m.fromA+o,m.fromB+r,e,n);if(_>d+1&&g>h+1)break;f.push(m.offset(-l+o,-c+r)),[d,h]=hx(m.toA+o,m.toB+r,e,n),i++}s.push(new ls(f,l,Math.max(l,d),c,Math.max(c,h)))}return s}const jl=1e3;function mx(t,e,n,o){let r=0,s=t.length;for(;;){if(r==s){let d=0,h=0;r&&({toA:d,toB:h}=t[r-1]);let f=e-(n?d:h);return[d+f,h+f]}let i=r+s>>1,a=t[i],[l,c]=n?[a.fromA,a.toA]:[a.fromB,a.toB];if(l>e)s=i;else{if(!(c<=e))return o?[a.fromA,a.fromB]:[a.toA,a.toB];r=i+1}}}function px(t,e,n,o){let r=[];return e.iterChangedRanges((s,i,a,l)=>{let c=0,d=n?e.length:o,h=0,f=n?o:e.length;s>jl&&([c,h]=mx(t,s-jl,n,!0)),i<e.length-jl&&([d,f]=mx(t,i+jl,n,!1));let m,_=l-a-(i-s),[g,p]=n?[_,0]:[0,_];r.length&&(m=r[r.length-1]).toA>=c?r[r.length-1]={fromA:m.fromA,fromB:m.fromB,toA:d,toB:f,diffA:m.diffA+g,diffB:m.diffB+p}:r.push({fromA:c,toA:d,fromB:h,toB:f,diffA:g,diffB:p})}),r}function gx(t,e,n,o,r){if(!t.length)return e;let s=0,i=0,a=0,l=[];for(let c of t){let d=c.fromA+i,h=c.toA+i+c.diffA,f=c.fromB+a,m=c.toB+a+c.diffB;for(;s<e.length;){let _=e[s];if(_.toA+i<=d&&_.toB+a<=f)l.push(_.offset(i,a));else if(_.fromA+i>h)break;s++}for(let _ of fx(dx(n.sliceString(d,h),o.sliceString(f,m),r),n,o,d,f))l.push(_);for(i+=c.diffA,a+=c.diffB;s<e.length;){let _=e[s];if(_.fromA>h+i&&_.fromB>m+a)break;s++}}for(;s<e.length;)l.push(e[s++].offset(i,a));return l}const _x=Mn.fromClass(class{constructor(t){({deco:this.deco,gutter:this.gutter}=xx(t))}update(t){var e,n;(t.docChanged||t.viewportChanged||(e=t.startState,n=t.state,e.field(as,!1)!=n.field(as,!1))||function(o,r){return o.facet(lo)!=r.facet(lo)}(t.startState,t.state))&&({deco:this.deco,gutter:this.gutter}=xx(t.view))}},{decorations:t=>t.deco}),El=$o.low(XU({class:"cm-changeGutter",markers:t=>{var e;return((e=t.plugin(_x))===null||e===void 0?void 0:e.gutter)||qm.empty}})),bx=ut.line({class:"cm-changedLine"}),eM=ut.mark({class:"cm-changedText"}),tM=ut.mark({tagName:"ins",class:"cm-insertedLine"}),nM=ut.mark({tagName:"del",class:"cm-deletedLine"}),yx=new class extends ZU{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function oM(t,e,n,o,r,s){let i=n?t.fromA:t.fromB,a=n?t.toA:t.toB,l=0;if(i!=a){r.add(i,i,bx),r.add(i,a,n?nM:tM),s&&s.add(i,i,yx);for(let c=e.iterRange(i,a-1),d=i;!c.next().done;){if(c.lineBreak){d++,r.add(d,d,bx),s&&s.add(d,d,yx);continue}let h=d+c.value.length;if(o)for(;l<t.changes.length;){let f=t.changes[l],m=i+(n?f.fromA:f.fromB),_=i+(n?f.toA:f.toB),g=Math.max(d,m),p=Math.min(h,_);if(g<p&&r.add(g,p,eM),!(_<h))break;l++}d=h}}}function xx(t){let e=t.state.field(as),{side:n,highlightChanges:o,markGutter:r}=t.state.facet(lo),s=n=="a",i=new Ys,a=r?new Ys:null,{from:l,to:c}=t.viewport;for(let d of e){if((s?d.fromA:d.fromB)>=c)break;(s?d.toA:d.toB)>l&&oM(d,t.state.doc,s,o,i,a)}return{deco:i.finish(),gutter:a&&a.finish()}}class Il extends Qs{constructor(e){super(),this.height=e}eq(e){return this.height==e.height}toDOM(){let e=document.createElement("div");return e.className="cm-mergeSpacer",e.style.height=this.height+"px",e}updateDOM(e){return e.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}const Al=Rt.define({map:(t,e)=>t.map(e)}),Fi=On.define({create:()=>ut.none,update:(t,e)=>{for(let n of e.effects)if(n.is(Al))return n.value;return t.map(e.changes)},provide:t=>st.decorations.from(t)}),Xu=.01,Zu=Rt.define({map:(t,e)=>e.mapPos(t)});class rM extends Qs{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let n=document.createElement("div");return n.className="cm-collapsedLines",n.textContent="\u299A "+e.state.phrase("$ unchanged lines",this.lines)+" \u299A",n.addEventListener("click",o=>{let r=e.posAtDOM(o.target);e.dispatch({effects:Zu.of(r)});let{side:s,sibling:i}=e.state.facet(lo);i&&i().dispatch({effects:Zu.of(sM(r,e.state.field(as),s=="a"))})}),n}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}}function sM(t,e,n){let o=0,r=0;for(let s=0;;s++){let i=s<e.length?e[s]:null;if(!i||(n?i.fromA:i.fromB)>=t)return r+(t-o);[o,r]=n?[i.toA,i.toB]:[i.toB,i.toA]}}const iM=On.define({create:t=>ut.none,update(t,e){t=t.map(e.changes);for(let n of e.effects)n.is(Zu)&&(t=t.update({filter:o=>o!=n.value}));return t},provide:t=>st.decorations.from(t)});function wx({margin:t=3,minSize:e=4}){return iM.init(n=>function(o,r,s){let i=new Ys,a=o.facet(lo).side=="a",l=o.field(as),c=1;for(let d=0;;d++){let h=d<l.length?l[d]:null,f=d?c+r:1,m=h?o.doc.lineAt(a?h.fromA:h.fromB).number-1-r:o.doc.lines,_=m-f+1;if(_>=s&&i.add(o.doc.line(f).from,o.doc.line(m).to,ut.replace({widget:new rM(_),block:!0})),!h)break;c=o.doc.lineAt(Math.min(o.doc.length,a?h.toA:h.toB)).number}return i.finish()}(n,t,e))}const aM=st.styleModule.of(new KU({".cm-mergeView":{overflowY:"auto"},".cm-mergeViewEditors":{display:"flex",alignItems:"stretch"},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:"hidden"},".cm-merge-revert":{width:"1.6em",flexGrow:0,flexShrink:0,position:"relative"},".cm-merge-revert button":{position:"absolute",display:"block",width:"100%",boxSizing:"border-box",textAlign:"center",background:"none",border:"none",font:"inherit",cursor:"pointer"}})),lM=st.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:"auto !important",overflowY:"visible !important"},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:"rgba(160, 128, 100, .08)"},"&.cm-merge-b .cm-changedLine":{backgroundColor:"rgba(100, 160, 128, .08)"},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat"},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat"},"&light.cm-merge-b .cm-changedText":{background:"linear-gradient(#22bb2266, #22bb2266) bottom/100% 2px no-repeat"},"&dark.cm-merge-b .cm-changedText":{background:"linear-gradient(#88ff8866, #88ff8866) bottom/100% 2px no-repeat"},".cm-insertedLine, .cm-deletedLine":{textDecoration:"none"},".cm-deletedChunk":{paddingLeft:"6px","& .cm-chunkButtons":{position:"absolute",insetInlineEnd:"5px"},"& button":{border:"none",cursor:"pointer",color:"white",margin:"0 2px",borderRadius:"3px","&[name=accept]":{background:"#2a2"},"&[name=reject]":{background:"#d43"}}},".cm-collapsedLines":{padding:"5px 5px 5px 10px",cursor:"pointer"},"&light .cm-collapsedLines":{color:"#444",background:"linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)"},"&dark .cm-collapsedLines":{color:"#ddd",background:"linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)"},".cm-changeGutter":{width:"3px",paddingLeft:"1px"},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:"#e43"},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:"#fa9"},"&light.cm-merge-b .cm-changedLineGutter":{background:"#2b2"},"&dark.cm-merge-b .cm-changedLineGutter":{background:"#8f8"}}),vx=new Fc,Tl=new Fc;class kx{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig;let n=[$o.low(_x),lM,aM,Fi,st.updateListener.of(h=>{this.measuring<0&&(h.heightChanged||h.viewportChanged)&&!h.transactions.some(f=>f.effects.some(m=>m.is(Al)))&&this.measure()})],o=[lo.of({side:"a",sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&o.push(El);let r=fr.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],st.editorAttributes.of({class:"cm-merge-a"}),Tl.of(o),n]}),s=[lo.of({side:"b",sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&s.push(El);let i=fr.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],st.editorAttributes.of({class:"cm-merge-b"}),Tl.of(s),n]});this.chunks=ls.build(r.doc,i.doc,this.diffConf);let a=[as.init(()=>this.chunks),vx.of(e.collapseUnchanged?wx(e.collapseUnchanged):[])];r=r.update({effects:Rt.appendConfig.of(a)}).state,i=i.update({effects:Rt.appendConfig.of(a)}).state,this.dom=document.createElement("div"),this.dom.className="cm-mergeView",this.editorDOM=this.dom.appendChild(document.createElement("div")),this.editorDOM.className="cm-mergeViewEditors";let l=e.orientation||"a-b",c=document.createElement("div");c.className="cm-mergeViewEditor";let d=document.createElement("div");d.className="cm-mergeViewEditor",this.editorDOM.appendChild(l=="a-b"?c:d),this.editorDOM.appendChild(l=="a-b"?d:c),this.a=new st({state:r,parent:c,root:e.root,dispatchTransactions:h=>this.dispatch(h,this.a)}),this.b=new st({state:i,parent:d,root:e.root,dispatchTransactions:h=>this.dispatch(h,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls=="b-to-a",e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,n){if(e.some(o=>o.docChanged)){let o=e[e.length-1],r=e.reduce((i,a)=>i.compose(a.changes),xa.empty(e[0].startState.doc.length));this.chunks=n==this.a?ls.updateA(this.chunks,o.newDoc,this.b.state.doc,r,this.diffConf):ls.updateB(this.chunks,this.a.state.doc,o.newDoc,r,this.diffConf),n.update([...e,o.state.update({effects:Ku.of(this.chunks)})]);let s=n==this.a?this.b:this.a;s.update([s.state.update({effects:Ku.of(this.chunks)})]),this.scheduleMeasure()}else n.update(e)}reconfigure(e){if("diffConfig"in e&&(this.diffConf=e.diffConfig),"orientation"in e){let s=e.orientation!="b-a";if(s!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let i=this.a.dom.parentNode,a=this.b.dom.parentNode;i.remove(),a.remove(),this.editorDOM.insertBefore(s?i:a,this.editorDOM.firstChild),this.editorDOM.appendChild(s?a:i),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in e||"renderRevertControl"in e){let s=!!this.revertDOM,i=this.revertToA,a=this.renderRevert;"revertControls"in e&&(s=!!e.revertControls,i=e.revertControls=="b-to-a"),"renderRevertControl"in e&&(a=e.renderRevertControl),this.setupRevertControls(s,i,a)}let n="highlightChanges"in e,o="gutter"in e,r="collapseUnchanged"in e;if(n||o||r){let s=[],i=[];if(n||o){let a=this.a.state.facet(lo),l=o?e.gutter!==!1:a.markGutter,c=n?e.highlightChanges!==!1:a.highlightChanges;s.push(Tl.reconfigure([lo.of({side:"a",sibling:()=>this.b,highlightChanges:c,markGutter:l}),l?El:[]])),i.push(Tl.reconfigure([lo.of({side:"b",sibling:()=>this.a,highlightChanges:c,markGutter:l}),l?El:[]]))}if(r){let a=vx.reconfigure(e.collapseUnchanged?wx(e.collapseUnchanged):[]);s.push(a),i.push(a)}this.a.dispatch({effects:s}),this.b.dispatch({effects:i})}this.scheduleMeasure()}setupRevertControls(e,n,o){this.revertToA=n,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=o,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement("div"),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener("mousedown",r=>this.revertClicked(r)),this.revertDOM.className="cm-merge-revert"):this.revertDOM&&(this.revertDOM.textContent="")}scheduleMeasure(){if(this.measuring<0){let e=this.dom.ownerDocument.defaultView||window;this.measuring=e.requestAnimationFrame(()=>{this.measuring=-1,this.measure()})}}measure(){(function(e,n,o){let r=new Ys,s=new Ys,i=e.state.field(Fi).iter(),a=n.state.field(Fi).iter(),l=0,c=0,d=0,h=0;for(let g=0;;g++){let p=g<o.length?o[g]:null;if(l<(p?p.fromA:e.state.doc.length)){let b=e.lineBlockAt(l).top+d-(n.lineBlockAt(c).top+h);b<-.01?(d-=b,r.add(l,l,ut.widget({widget:new Il(-b),block:!0,side:-1}))):b>Xu&&(h+=b,s.add(c,c,ut.widget({widget:new Il(b),block:!0,side:-1})))}if(!p)break;for(l=p.toA,c=p.toB;i.value&&i.from<l;)d-=i.value.spec.widget.height,i.next();for(;a.value&&a.from<c;)h-=a.value.spec.widget.height,a.next()}for(;i.value;)d-=i.value.spec.widget.height,i.next();for(;a.value;)h-=a.value.spec.widget.height,a.next();let f=e.contentHeight+d-(n.contentHeight+h);f<Xu?r.add(e.state.doc.length,e.state.doc.length,ut.widget({widget:new Il(-f),block:!0,side:1})):f>Xu&&s.add(n.state.doc.length,n.state.doc.length,ut.widget({widget:new Il(f),block:!0,side:1}));let m=r.finish(),_=s.finish();qm.eq([m],[e.state.field(Fi)])||e.dispatch({effects:Al.of(m)}),qm.eq([_],[n.state.field(Fi)])||n.dispatch({effects:Al.of(_)})})(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,n=e.firstChild,o=this.a.viewport,r=this.b.viewport;for(let s=0;s<this.chunks.length;s++){let i=this.chunks[s];if(i.fromA>o.to||i.fromB>r.to)break;if(i.fromA<o.from||i.fromB<r.from)continue;let a=this.a.lineBlockAt(i.fromA).top+"px";for(;n&&+n.dataset.chunk<s;)n=Sx(n);n&&n.dataset.chunk==String(s)?(n.style.top!=a&&(n.style.top=a),n=n.nextSibling):e.insertBefore(this.renderRevertButton(a,s),n)}for(;n;)n=Sx(n)}renderRevertButton(e,n){let o;if(this.renderRevert)o=this.renderRevert();else{o=document.createElement("button");let r=this.a.state.phrase("Revert this chunk");o.setAttribute("aria-label",r),o.setAttribute("title",r),o.textContent=this.revertToLeft?"\u21DC":"\u21DD"}return o.style.top=e,o.setAttribute("data-chunk",String(n)),o}revertClicked(e){let n,o=e.target;for(;o&&o.parentNode!=this.revertDOM;)o=o.parentNode;if(o&&(n=this.chunks[o.dataset.chunk])){let[r,s,i,a,l,c]=this.revertToA?[this.b,this.a,n.fromB,n.toB,n.fromA,n.toA]:[this.a,this.b,n.fromA,n.toA,n.fromB,n.toB],d=r.state.sliceDoc(i,Math.max(i,a-1));i!=a&&c<=s.state.doc.length&&(d+=r.state.lineBreak),s.dispatch({changes:{from:l,to:Math.min(s.state.doc.length,c),insert:d},userEvent:"revert"}),e.preventDefault()}}destroy(){this.a.destroy(),this.b.destroy(),this.measuring>-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}}function Sx(t){let e=t.nextSibling;return t.remove(),e}var cM=["className","children","orientation","revertControls","highlightChanges","gutter","collapseUnchanged","destroyRerender","renderRevertControl","diffConfig"],dM=["modified","modifiedExtension","original","originalExtension","theme","dispatch"],Cx=Y.forwardRef((t,e)=>{var{className:n,children:o,orientation:r,revertControls:s,highlightChanges:i,gutter:a,collapseUnchanged:l,destroyRerender:c=!0,renderRevertControl:d,diffConfig:h}=t,f=va(t,cM),m=Hu(),{modified:_,modifiedExtension:g,original:p,originalExtension:b,theme:y,dispatch:x}=m,v=va(m,dM),S=A.useRef(null),k=A.useRef(),E={orientation:r,revertControls:s,highlightChanges:i,gutter:a,collapseUnchanged:l,renderRevertControl:d,diffConfig:h};A.useImperativeHandle(e,()=>({container:S.current,view:k.current,modified:_,original:p,config:jt({a:p,b:_,parent:S.current},E)}),[S,k,_,p,E]);var N=st.updateListener.of(T=>{if(T.docChanged&&typeof(b==null?void 0:b.onChange)=="function"){var M=T.state.doc.toString();b==null||b.onChange(M,T)}}),I=st.updateListener.of(T=>{if(T.docChanged&&typeof(g==null?void 0:g.onChange)=="function"){var M=T.state.doc.toString();g==null||g.onChange(M,T)}});return A.useEffect(()=>{!k.current&&S.current&&b&&g&&(k.current=new kx(jt({a:jt({},p,{extensions:[...(b==null?void 0:b.extension)||[],...ni(jt({},b==null?void 0:b.option,{theme:y})),N]}),b:jt({},_,{extensions:[...(g==null?void 0:g.extension)||[],...ni(jt({},g==null?void 0:g.option,{theme:y})),I]}),parent:S.current},E)),x({view:k.current}))},[k,S,b,g]),A.useEffect(()=>{if(p&&p.doc&&k.current){var T,M,R=(T=k.current)==null?void 0:T.a.state.doc.toString();R!==p.doc&&((M=k.current)==null||M.a.dispatch({changes:{from:0,to:R.length,insert:p.doc||""}}))}if(_&&_.doc&&k.current){var z,D,F=(z=k.current)==null?void 0:z.b.state.doc.toString();F!==_.doc&&((D=k.current)==null||D.b.dispatch({changes:{from:0,to:F.length,insert:_.doc||""}}))}if(c&&k.current){var B=k.current.a.state.selection.ranges[0].from,V=k.current.b.state.selection.ranges[0].from;k.current.destroy(),k.current=new kx(jt({a:jt({},p,{extensions:[...(b==null?void 0:b.extension)||[],...ni(jt({},b==null?void 0:b.option,{theme:y}))]}),b:jt({},_,{extensions:[...(g==null?void 0:g.extension)||[],...ni(jt({},g==null?void 0:g.option,{theme:y}))]}),parent:S.current},E)),B&&(k.current.a.focus(),k.current.a.dispatch({selection:{anchor:B,head:B}})),V&&(k.current.b.focus(),k.current.b.dispatch({selection:{anchor:V,head:V}}))}},[k,y,S.current,p,_,b,g,c]),A.useEffect(()=>()=>k.current&&k.current.destroy(),[]),A.useEffect(()=>{if(k.current){var T={};v.orientation!==r&&(T.orientation=r),v.revertControls!==s&&(T.revertControls=s),v.highlightChanges!==i&&(T.highlightChanges=i),v.gutter!==a&&(T.gutter=a),v.collapseUnchanged!==l&&(T.collapseUnchanged=l),v.renderRevertControl!==d&&(T.collapseUnchanged=l),Object.keys(T).length&&x&&k.current&&(k.current.reconfigure(jt({},T)),x(jt({},T)))}},[x,k,r,s,i,a,l,d]),u.jsx("div",jt({ref:S,className:"cm-merge-theme"+(n?" "+n:"")},f,{children:o}))});Cx.displayName="CodeMirrorMerge.Internal";var uM=["theme"],cs=Y.forwardRef((t,e)=>{var{theme:n}=t,o=va(t,uM);return u.jsx(Y7,{theme:n,children:u.jsx(Cx,jt({},o,{ref:e}))})});cs.Original=Ky,cs.Modified=Xy,cs.displayName="CodeMirrorMerge";const hM=cs.Original,fM=cs.Modified,Nx=[eV(),st.lineWrapping],mM=t=>{const e=J.c(42),{className:n,onChange:o,initialPrompt:r,currentLanguageAdapter:s,currentCode:i,declineChange:a,acceptChange:l,enabled:c,children:d}=t;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={},e[0]=h):h=e[0];const[f,m]=A.useState(h),[_,g]=an(hC),p=Gm(),{completion:b,input:y,stop:x,isLoading:v,setCompletion:S,setInput:k,handleSubmit:E}=QU({api:p.getAiURL("completion").toString(),headers:p.headers(),initialInput:r,streamProtocol:"text",experimental_throttle:100,body:{...f,includeOtherCode:_?Lc(i):"",code:i,language:s},onError:pM,onFinish:(Z,q)=>{N(q.trimEnd())}}),N=S,I=Y.useRef(null);let T,M,R,z;e[1]!==c?(T=()=>{var q;const Z=I.current;c&&Z&&(requestAnimationFrame(()=>{var ne;(ne=Z.view)==null||ne.focus()}),tV((q=I.current)==null?void 0:q.view))},M=[c],e[1]=c,e[2]=T,e[3]=M):(T=e[2],M=e[3]),A.useEffect(T,M),e[4]!==c||e[5]!==r||e[6]!==k?(R=()=>{c&&k(r||"")},z=[c,r,k],e[4]=c,e[5]=r,e[6]=k,e[7]=R,e[8]=z):(R=e[7],z=e[8]),A.useEffect(R,z);const{theme:D}=zo();let F;e[9]!==n?(F=Ie("flex flex-col w-full rounded-[inherit]",n),e[9]=n,e[10]=F):F=e[10];const B=c&&"max-h-[400px] min-h-11 visible",V=!c&&"max-h-0 min-h-0 invisible";let O,C,$,j;e[11]!==B||e[12]!==V?(O=Ie("flex items-center gap-2 border-b px-3 transition-all rounded-[inherit] rounded-b-none duration-300",B,V),e[11]=B,e[12]=V,e[13]=O):O=e[13],e[14]!==l||e[15]!==b||e[16]!==a||e[17]!==c||e[18]!==E||e[19]!==_||e[20]!==y||e[21]!==v||e[22]!==N||e[23]!==g||e[24]!==k||e[25]!==x||e[26]!==D?(C=c&&u.jsxs(u.Fragment,{children:[u.jsx(sa,{className:"text-[var(--blue-10)] flex-shrink-0",size:16}),u.jsx(Hc,{inputRef:I,theme:D,onClose:()=>{a(),N("")},value:y,onChange:Z=>{k(Z),m(K4({input:Z}))},onSubmit:()=>{v||E()}}),v&&u.jsxs(Me,{"data-testid":"stop-completion-button",variant:"text",size:"xs",className:"mb-0",onClick:x,children:[u.jsx(Ym,{className:"animate-spin mr-1",size:14}),"Stop"]}),!v&&b&&u.jsx(Me,{"data-testid":"accept-completion-button",variant:"text",size:"xs",className:"mb-0",disabled:v,onClick:()=>{l(b),N("")},children:u.jsx("span",{className:"text-[var(--grass-11)] opacity-100",children:"Accept"})}),u.jsx("div",{className:"h-full w-px bg-border mx-2"}),u.jsx(Te,{content:"Include code from other cells",children:u.jsxs("div",{className:"flex flex-row items-start gap-1 overflow-hidden",children:[u.jsx(X4,{"data-testid":"include-other-cells-checkbox",id:"include-other-cells",checked:_,onCheckedChange:Z=>g(!!Z)}),u.jsx(Fr,{htmlFor:"include-other-cells",className:"text-muted-foreground text-xs whitespace-nowrap ellipsis",children:"Include all code"})]})}),u.jsx(Me,{"data-testid":"decline-completion-button",variant:"text",size:"icon",disabled:v,onClick:()=>{x(),a(),N("")},children:u.jsx(oo,{className:"text-[var(--red-10)]",size:16})})]}),e[14]=l,e[15]=b,e[16]=a,e[17]=c,e[18]=E,e[19]=_,e[20]=y,e[21]=v,e[22]=N,e[23]=g,e[24]=k,e[25]=x,e[26]=D,e[27]=C):C=e[27],e[28]!==O||e[29]!==C?($=u.jsx("div",{className:O,children:C}),e[28]=O,e[29]=C,e[30]=$):$=e[30],e[31]!==b||e[32]!==i||e[33]!==c||e[34]!==o||e[35]!==D?(j=b&&c&&u.jsxs(cs,{className:"cm",theme:D,children:[u.jsx(hM,{onChange:o,value:i,extensions:Nx}),u.jsx(fM,{value:b,editable:!1,readOnly:!0,extensions:Nx})]}),e[31]=b,e[32]=i,e[33]=c,e[34]=o,e[35]=D,e[36]=j):j=e[36];const W=(!b||!c)&&d;let K;return e[37]!==$||e[38]!==j||e[39]!==W||e[40]!==F?(K=u.jsxs("div",{className:F,children:[$,j,W]}),e[37]=$,e[38]=j,e[39]=W,e[40]=F,e[41]=K):K=e[41],K};function pM(t){lt({title:"Completion failed",description:J4(t)})}const gM=t=>{const e=J.c(24),{editorView:n,code:o,currentLanguageAdapter:r,onAfterToggle:s}=t;let i,a;e[0]!==o?(a=new ca().isSupported(o)||o.trim()==="",e[0]=o,e[1]=a):a=e[1],i=a;const l=i;let c,d;e[2]!==o?(d=new Vc().isSupported(o)||o.trim()==="",e[2]=o,e[3]=d):d=e[3],c=d;const h=c&&r==="python";let f,m;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsx(dr,{color:"var(--sky-11)",strokeWidth:2.5,className:"w-4 h-4"}),e[4]=f):f=e[4],e[5]!==r||e[6]!==n||e[7]!==s||e[8]!==h?(m=u.jsx(Qu,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:h,icon:f,toType:"sql",displayName:"SQL",onAfterToggle:s}),e[5]=r,e[6]=n,e[7]=s,e[8]=h,e[9]=m):m=e[9];const _=l&&r==="python";let g,p,b,y,x;return e[10]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx(mc,{fill:"var(--sky-11)",color:"black",className:"w-4 h-4"}),e[10]=g):g=e[10],e[11]!==r||e[12]!==n||e[13]!==s||e[14]!==_?(p=u.jsx(Qu,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:_,icon:g,toType:"markdown",displayName:"Markdown",onAfterToggle:s}),e[11]=r,e[12]=n,e[13]=s,e[14]=_,e[15]=p):p=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(pc,{fill:"var(--sky-11)",color:"black",className:"w-4 h-4"}),e[16]=b):b=e[16],e[17]!==r||e[18]!==n?(y=u.jsx(Qu,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:!0,icon:b,toType:"python",displayName:"Python",onAfterToggle:An.NOOP}),e[17]=r,e[18]=n,e[19]=y):y=e[19],e[20]!==p||e[21]!==y||e[22]!==m?(x=u.jsxs("div",{className:"absolute right-3 top-2 z-20 flex hover-action gap-1",children:[m,p,y]}),e[20]=p,e[21]=y,e[22]=m,e[23]=x):x=e[23],x},Qu=t=>{const e=J.c(10),{editorView:n,currentLanguageAdapter:o,canSwitchToLanguage:r,icon:s,toType:i,displayName:a,onAfterToggle:l}=t;let c;e[0]!==n||e[1]!==l||e[2]!==i?(c=()=>{n&&(Pr(n,i),l())},e[0]=n,e[1]=l,e[2]=i,e[3]=c):c=e[3];const d=c;if(!r||o===i)return null;const h=`View as ${a}`;let f,m;return e[4]!==d||e[5]!==s?(f=u.jsx(Me,{"data-testid":"language-toggle-button",variant:"text",size:"xs",className:"opacity-80 px-1",onClick:d,children:s}),e[4]=d,e[5]=s,e[6]=f):f=e[6],e[7]!==h||e[8]!==f?(m=u.jsx(Te,{content:h,children:f}),e[7]=h,e[8]=f,e[9]=m):m=e[9],m},jx=({theme:t,showPlaceholder:e,id:n,config:o,code:r,status:s,serializedEditorState:i,setEditorView:a,runCell:l,userConfig:c,editorViewRef:d,editorViewParentRef:h,hidden:f,hasOutput:m,temporarilyShowCode:_,languageAdapter:g,setLanguageAdapter:p,showLanguageToggles:b=!0})=>{var Z;const[y,x]=an(La),v=nV(),S=wd(),{saveOrNameNotebook:k}=Kg(),E=s==="running"||s==="queued",N=Ot(),I=hg(),T=g==="markdown",M=et(()=>!E&&(S({cellId:n}),!0)),R=et(()=>!E&&(l(),!0)),z=et(()=>{const q=!o.hide_code;return Lr({configs:{[n]:{hide_code:q}}}),N.updateCellConfig({cellId:n,config:{hide_code:q}}),q}),D=$e(Bs),F=et(()=>{ur(D,N.createNewCell)}),B=oV(c),V=A.useMemo(()=>{const q=E5({cellId:n,showPlaceholder:e,enableAI:B,cellActions:{...N,afterToggleMarkdown:F,onRun:R,deleteCell:M,saveNotebook:k,createManyBelow:ne=>{for(const re of[...ne].reverse())N.createNewCell({code:re,before:!1,cellId:n,skipIfCodeExists:!0})},splitCell:I,toggleHideCode:z,aiCellCompletion:()=>{let ne=!1;return x(re=>(re==null?void 0:re.cellId)===n?(ne=!0,null):{cellId:n}),ne}},completionConfig:c.completion,keymapConfig:c.keymap,lspConfig:c.language_servers,theme:t,hotkeys:new Z4(c.keymap.overrides??{}),diagnosticsConfig:c.diagnostics,displayConfig:c.display});return q.push(Mn.define(ne=>{const re=ne.state.field(zc);return p(re.type),{update(ae){const X=ae.state.field(zc);p(X.type)}}}),st.updateListener.of(ne=>{ne.selectionSet&&ne.state.selection.ranges.some(re=>re.from!==re.to)&&_({focus:!1})})),q},[n,c.keymap,c.completion,c.language_servers,c.diagnostics,B,t,e,N,I,z,M,R,x,F,p,_,k]),O=$c(),C=et(()=>{if(O){const ne=$u(n,0,r);V.push(ne.extension),r=ne.code}const q=new st({state:fr.create({doc:r,extensions:V})});a(q),O||Pr(q,Hm(q.state).type)}),$=et(()=>{if(Bo(d.current!==null,"Editor view is not initialized"),O){const q=$u(n);V.push(q.extension)}d.current.dispatch({effects:[Rt.reconfigure.of([V]),rV(d.current,c.completion,new Z4(c.keymap.overrides??{}),{...c.language_servers,diagnostics:c.diagnostics})]})}),j=et(()=>{if(Bo(i,"Editor view is not initialized"),O){const ne=$u(n,0,r);V.push(ne.extension),r=ne.code}const q=new st({state:fr.fromJSON(i,{doc:r,extensions:V},{history:sV})});O||Pr(q,Hm(q.state).type),a(q),N.clearSerializedEditorState({cellId:n})});A.useEffect(()=>{i===null?d.current===null?C():$():j(),d.current!==null&&h&&h.current!==null&&h.current.replaceChildren(d.current.dom)},[C,$,j,d,h,i,V]),A.useEffect(()=>{const q=d.current;return()=>{q==null||q.destroy()}},[d]);const W=f&&!T||f&&T&&!m;let K="";return T&&f&&m?K="h-0 overflow-hidden":f&&(K="opacity-20 h-8 [&>div.cm-editor]:h-full [&>div.cm-editor]:overflow-hidden"),u.jsx(mM,{enabled:(y==null?void 0:y.cellId)===n,initialPrompt:y==null?void 0:y.initialPrompt,currentCode:((Z=d.current)==null?void 0:Z.state.doc.toString())??r,currentLanguageAdapter:g,declineChange:et(()=>{var q;x(null),(q=d.current)==null||q.focus()}),onChange:et(q=>{var ne;(ne=d.current)==null||ne.dispatch({changes:{from:0,to:d.current.state.doc.length,insert:q}})}),acceptChange:et(q=>{var ne,re;(ne=d.current)==null||ne.dispatch({changes:{from:0,to:d.current.state.doc.length,insert:q}}),(re=d.current)==null||re.focus(),x(null)}),children:u.jsxs("div",{className:"relative w-full",onFocus:()=>v(n),children:[W&&u.jsx(Q4,{tooltip:"Edit code",className:"absolute inset-0 z-10",onClick:_}),u.jsx(Ex,{className:K,editorView:d.current,ref:h}),!f&&b&&u.jsx("div",{className:"absolute top-1 right-5",children:u.jsx(gM,{code:r,editorView:d.current,currentLanguageAdapter:g,onAfterToggle:F})})]})})},Ex=Y.forwardRef((t,e)=>{const n=J.c(10),{className:o,editorView:r}=t,s=A.useRef(null);let i,a,l,c,d;return n[0]!==r?(i=()=>{r!==null&&s.current!==null&&s.current.children.length===0&&s.current.append(r.dom)},a=[r,s],n[0]=r,n[1]=i,n[2]=a):(i=n[1],a=n[2]),A.useEffect(i,a),n[3]!==o?(l=Ie("cm mathjax_ignore",o),n[3]=o,n[4]=l):l=n[4],n[5]!==e?(c=h=>{e?Nl(e,s)(h):Nl(s)(h)},n[5]=e,n[6]=c):c=n[6],n[7]!==l||n[8]!==c?(d=u.jsx("div",{className:l,ref:c,"data-testid":"cell-editor"}),n[7]=l,n[8]=c,n[9]=d):d=n[9],d});Ex.displayName="CellCodeMirrorEditor";const eh=$c()?function(t){const e=n=>{const o=J.c(5),r=$e(mn),[s,i]=an(ss);if(r.state===Vt.CONNECTING||s===void 0){let l,c;return o[0]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx("span",{children:"Waiting for real-time collaboration connection..."}),o[0]=l):l=o[0],o[1]!==i?(c=u.jsx("div",{className:"flex h-full w-full items-baseline p-4",children:u.jsxs(Jm,{milliseconds:1e3,fallback:null,children:[l,u.jsx(Me,{variant:"link",onClick:()=>{i("disabled")},children:"Turn off real-time collaboration"})]})}),o[1]=i,o[2]=c):c=o[2],c}let a;return o[3]!==n?(a=u.jsx(t,{...n}),o[3]=n,o[4]=a):a=o[4],a};return e.displayName=`WithWaitUntilConnected(${t.displayName})`,e}(A.memo(jx)):A.memo(jx),_M=t=>{const e=J.c(10);let n,o,r,s;return e[0]!==t.left?(n=u.jsx("div",{className:"flex-1 flex item-center gap-2",children:t.left}),e[0]=t.left,e[1]=n):n=e[1],e[2]!==t.center?(o=u.jsx("div",{className:"flex-1 flex item-center gap-2 justify-center",children:t.center}),e[2]=t.center,e[3]=o):o=e[3],e[4]!==t.right?(r=u.jsx("div",{className:"flex-1 flex item-center gap-2 justify-end",children:t.right}),e[4]=t.right,e[5]=r):r=e[5],e[6]!==n||e[7]!==o||e[8]!==r?(s=u.jsxs("div",{className:"flex items-center gap-2 w-full px-3",children:[n,o,r]}),e[6]=n,e[7]=o,e[8]=r,e[9]=s):s=e[9],s},bM=t=>{const e=J.c(8);if(!t.canCollapse&&!t.isCollapsed)return null;const n=t.isCollapsed?"Expand":"Collapse";let o,r,s;return e[0]!==t.isCollapsed?(o=u.jsx("span",{children:u.jsx(yM,{isCollapsed:t.isCollapsed})}),e[0]=t.isCollapsed,e[1]=o):o=e[1],e[2]!==n||e[3]!==o?(r=u.jsx(Te,{content:n,children:o}),e[2]=n,e[3]=o,e[4]=r):r=e[4],e[5]!==t.onClick||e[6]!==r?(s=u.jsx(Me,{variant:"text",size:"icon",onClick:t.onClick,children:r}),e[5]=t.onClick,e[6]=r,e[7]=s):s=e[7],s},yM=t=>{const e=J.c(2),{isCollapsed:n}=t;let o;return e[0]!==n?(o=n?u.jsx(ia,{className:"w-5 h-5 flex-shrink-0"}):u.jsx(Vs,{className:"w-5 h-5 flex-shrink-0"}),e[0]=n,e[1]=o):o=e[1],o},Ix=A.memo(t=>{const e=J.c(24),{onClick:n,count:o,cellId:r}=t,s=Tc();let i;e[0]!==r||e[1]!==s?(i=iV(s,r),e[0]=r,e[1]=s,e[2]=i):i=e[2];const a=i;let l,c;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=Ie("flex items-center justify-between w-[calc(100%-2rem)] h-9 bg-muted rounded-b mx-4 opacity-80 hover:opacity-100 cursor-pointer"),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(aV,{className:"w-4 h-4 flex-shrink-0"}),e[4]=c):c=e[4];const d=o===1?"cell":"cells";let h,f,m,_,g,p,b;return e[5]!==o||e[6]!==d?(h=u.jsxs(u.Fragment,{children:[c,u.jsxs("span",{className:"text-sm text-gray-500",children:[o," ",d," collapsed"]})]}),e[5]=o,e[6]=d,e[7]=h):h=e[7],e[8]!==a.errored?(f=a.errored&&u.jsx(Te,{content:"Has errors",delayDuration:100,children:u.jsx(Vp,{className:"w-4 h-4 flex-shrink-0 text-destructive"})}),e[8]=a.errored,e[9]=f):f=e[9],e[10]!==a.stale?(m=a.stale&&u.jsx(Te,{content:"Has stale cells",delayDuration:100,children:u.jsx(eS,{className:"w-4 h-4 flex-shrink-0 text-[var(--yellow-11)]"})}),e[10]=a.stale,e[11]=m):m=e[11],e[12]!==a.runningOrQueued?(_=a.runningOrQueued&&u.jsx(Te,{content:"Running",delayDuration:100,children:u.jsx(Ym,{className:"w-4 h-4 flex-shrink-0 animate-spin"})}),e[12]=a.runningOrQueued,e[13]=_):_=e[13],e[14]!==f||e[15]!==m||e[16]!==_?(g=u.jsxs(u.Fragment,{children:[f,m,_]}),e[14]=f,e[15]=m,e[16]=_,e[17]=g):g=e[17],e[18]!==h||e[19]!==g?(p=u.jsx(_M,{center:h,right:g}),e[18]=h,e[19]=g,e[20]=p):p=e[20],e[21]!==n||e[22]!==p?(b=u.jsx("div",{onClick:n,className:l,children:p}),e[21]=n,e[22]=p,e[23]=b):b=e[23],b});Ix.displayName="CollapsedCellBanner";const Ax=t=>{const e=J.c(31),{status:n,connectionState:o,onClick:r}=t,s=n==="running"||n==="queued";let i,a,l,c,d,h,f,m,_,g,p,b,y,x;if(e[0]!==o||e[1]!==s||e[2]!==r||e[3]!==n){const v=br(o);let S;if(v){let k;e[14]!==o?(k=up(o),e[14]=o,e[15]=k):k=e[15],S=k}else S=n==="running"?"A cell can't be deleted when it's running":n==="queued"?"A cell can't be deleted when it's queued to run":"Delete";a=Te,_=S,g=!1,i=Me,l="ghost",c="icon",d=r,h="delete-button",f=Hn.preventFocus,m=Ie("hover:bg-transparent text-destructive/60 hover:text-destructive",(v||s)&&"inactive-button"),e[0]=o,e[1]=s,e[2]=r,e[3]=n,e[4]=i,e[5]=a,e[6]=l,e[7]=c,e[8]=d,e[9]=h,e[10]=f,e[11]=m,e[12]=_,e[13]=g}else i=e[4],a=e[5],l=e[6],c=e[7],d=e[8],h=e[9],f=e[10],m=e[11],_=e[12],g=e[13];return e[16]===Symbol.for("react.memo_cache_sentinel")?(p={boxShadow:"none"},b=u.jsx(bm,{size:14}),e[16]=p,e[17]=b):(p=e[16],b=e[17]),e[18]!==i||e[19]!==l||e[20]!==c||e[21]!==d||e[22]!==h||e[23]!==f||e[24]!==m?(y=u.jsx(i,{variant:l,size:c,onClick:d,"data-testid":h,onMouseDown:f,className:m,style:p,children:b}),e[18]=i,e[19]=l,e[20]=c,e[21]=d,e[22]=h,e[23]=f,e[24]=m,e[25]=y):y=e[25],e[26]!==a||e[27]!==y||e[28]!==_||e[29]!==g?(x=u.jsx(a,{content:_,usePortal:g,children:y}),e[26]=a,e[27]=y,e[28]=_,e[29]=g,e[30]=x):x=e[30],x},xM=t=>{const e=J.c(27),{onClick:n,connectionState:o,needsRun:r,status:s,config:i,edited:a}=t,l=s==="disabled-transitively",c=s==="running"||s==="queued";let d,h;e[0]!==l||e[1]!==i.disabled||e[2]!==o||e[3]!==a||e[4]!==c||e[5]!==r?(d=br(o)||c||!i.disabled&&l&&!a,h=function(p,b,y,x){return br(p)?"disabled":b&&!y?"stale":y||x?"disabled":"green"}(o,r,c,d),e[0]=l,e[1]=i.disabled,e[2]=o,e[3]=a,e[4]=c,e[5]=r,e[6]=d,e[7]=h):(d=e[6],h=e[7]);const f=h;if(i.disabled){let p,b;return e[8]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx(Mp,{}),e[8]=p):p=e[8],e[9]!==d||e[10]!==n||e[11]!==f?(b=u.jsx(pi,{tooltip:"Add code to notebook",disabled:d,onClick:n,variant:f,"data-testid":"run-button",children:p}),e[9]=d,e[10]=n,e[11]=f,e[12]=b):b=e[12],b}if(!i.disabled&&l&&!a){let p,b;return e[13]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx(ii,{strokeWidth:1.2}),e[13]=p):p=e[13],e[14]!==d||e[15]!==n||e[16]!==f?(b=u.jsx(pi,{disabled:d,tooltip:"This cell can't be run because it has a disabled ancestor",onClick:n,variant:f,"data-testid":"run-button",children:p}),e[14]=d,e[15]=n,e[16]=f,e[17]=b):b=e[17],b}let m,_,g;if(br(o)){let p;e[18]!==o?(p=up(o),e[18]=o,e[19]=p):p=e[19],m=p}else if(s==="queued")m="This cell is already queued to run";else if(s==="running")m="This cell is already running.";else{let p;e[20]===Symbol.for("react.memo_cache_sentinel")?(p=pn("cell.run"),e[20]=p):p=e[20],m=p}return e[21]===Symbol.for("react.memo_cache_sentinel")?(_=u.jsx(ii,{strokeWidth:1.2}),e[21]=_):_=e[21],e[22]!==d||e[23]!==n||e[24]!==m||e[25]!==f?(g=u.jsx(pi,{tooltip:m,disabled:d,onClick:n,variant:f,"data-testid":"run-button",children:_}),e[22]=d,e[23]=n,e[24]=m,e[25]=f,e[26]=g):g=e[26],g},Tx=Y.createContext(null),Mx=A.memo(()=>A.use(Tx));Mx.displayName="DragHandle";const Ox=Y.forwardRef((t,e)=>{const n=J.c(21);let o,r,s,i,a;n[0]!==t?({cellId:r,canMoveX: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=r.toString(),n[4]=r,n[5]=i):i=n[5],n[6]!==i?(a={id:i},n[6]=i,n[7]=a):a=n[7];const{attributes:l,listeners:c,setNodeRef:d,transform:h,transition:f,isDragging:m}=T1(a);let _;n[8]!==h?(_=function(y){return!y||y.x===0&&y.y===0&&y.scaleX===1&&y.scaleY===1}(h)?null:h,n[8]=h,n[9]=_):_=n[9];const g=_,p=g==null?void 0:f;let b;return n[10]!==l||n[11]!==o||n[12]!==r||n[13]!==m||n[14]!==c||n[15]!==s||n[16]!==e||n[17]!==d||n[18]!==g||n[19]!==p?(b=u.jsx(Dx,{ref:e,cellId:r,canMoveX:o,...s,attributes:l,listeners:c,setNodeRef:d,transform:g,transition:p,isDragging:m}),n[10]=l,n[11]=o,n[12]=r,n[13]=m,n[14]=c,n[15]=s,n[16]=e,n[17]=d,n[18]=g,n[19]=p,n[20]=b):b=n[20],b});Ox.displayName="SortableCell";const Dx=Y.forwardRef((t,e)=>{const n=J.c(37);let o,r,s,i,a,l,c,d,h,f;if(n[0]!==t){const{cellId:I,canMoveX:T,children:M,attributes:R,listeners:z,setNodeRef:D,transform:F,transition:B,isDragging:V,...O}=t;r=T,s=M,o=R,a=z,c=D,d=F,h=B,i=V,l=O,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i,n[5]=a,n[6]=l,n[7]=c,n[8]=d,n[9]=h}else o=n[1],r=n[2],s=n[3],i=n[4],a=n[5],l=n[6],c=n[7],d=n[8],h=n[9];n[10]!==r||n[11]!==d?(f=d?Rc.Transform.toString({x:r?d.x:0,y:d.y,scaleX:1,scaleY:1}):void 0,n[10]=r,n[11]=d,n[12]=f):f=n[12];const m=i?2:void 0;let _;n[13]!==f||n[14]!==m||n[15]!==h?(_={transform:f,transition:h,zIndex:m,position:"relative"},n[13]=f,n[14]=m,n[15]=h,n[16]=_):_=n[16];const g=_;let p,b;n[17]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx(Tp,{strokeWidth:1,size:20}),n[17]=p):p=n[17],n[18]!==o||n[19]!==a?(b=u.jsx("div",{...o,...a,onMouseDown:Hn.preventFocus,"data-testid":"drag-button",className:"py-[1px] cursor-grab opacity-50 hover:opacity-100 hover-action hover:bg-muted rounded border border-transparent hover:border-border active:bg-accent",children:p}),n[18]=o,n[19]=a,n[20]=b):b=n[20];const y=b,x=!!d;let v;n[21]!==e||n[22]!==c?(v=I=>{Nl(e,c)(I)},n[21]=e,n[22]=c,n[23]=v):v=n[23];const S=x&&"is-moving";let k,E,N;return n[24]!==l.className||n[25]!==S?(k=Ie(l.className,S,"outline-offset-4 outline-primary/40 rounded-lg"),n[24]=l.className,n[25]=S,n[26]=k):k=n[26],n[27]!==s||n[28]!==y?(E=u.jsx(Tx.Provider,{value:y,children:s}),n[27]=s,n[28]=y,n[29]=E):E=n[29],n[30]!==i||n[31]!==l||n[32]!==g||n[33]!==v||n[34]!==k||n[35]!==E?(N=u.jsx("div",{tabIndex:-1,ref:v,...l,"data-is-dragging":i,className:k,style:g,children:E}),n[30]=i,n[31]=l,n[32]=g,n[33]=v,n[34]=k,n[35]=E,n[36]=N):N=n[36],N});function Rx(t,e){const n=J.c(9);let o;n[0]!==t.current||n[1]!==e?(o=l=>{t.current===null||t.current.contains(l.relatedTarget)||e.current===null||fm(e.current)},n[0]=t.current,n[1]=e,n[2]=o):o=n[2];const r=et(o);let s;n[3]!==t.current||n[4]!==e?(s=l=>{if(t.current===document.activeElement&&e.current!==null&&ya(e.current.state)==="active"){for(const c of P4)if(l.key===c.key&&c.run){c.run(e.current),l.preventDefault(),l.stopPropagation();break}e.current.focus()}},n[3]=t.current,n[4]=e,n[5]=s):s=n[5];const i=et(s);let a;return n[6]!==r||n[7]!==i?(a={closeCompletionHandler:r,resumeCompletionHandler:i},n[6]=r,n[7]=i,n[8]=a):a=n[8],a}function Px(t,e,n,o,r,s,i,a,l){const c=J.c(51);let d,h,f,m,_,g,p,b,y,x,v,S,k,E,N,I;c[0]!==o||c[1]!==e||c[2]!==n?(d=()=>{n(),o.moveToNextCell({cellId:e,before:!1})},h=()=>{n(),o.moveToNextCell({cellId:e,before:!0})},c[0]=o,c[1]=e,c[2]=n,c[3]=d,c[4]=h):(d=c[3],h=c[4]),c[5]!==o||c[6]!==e?(f=()=>o.createNewCell({cellId:e,before:!0}),m=()=>o.createNewCell({cellId:e,before:!1}),_=()=>o.moveCell({cellId:e,before:!0}),g=()=>o.moveCell({cellId:e,before:!1}),c[5]=o,c[6]=e,c[7]=f,c[8]=m,c[9]=_,c[10]=g):(f=c[7],m=c[8],_=c[9],g=c[10]),c[11]!==o||c[12]!==r||c[13]!==e?(p=()=>r?o.moveCell({cellId:e,direction:"left"}):void 0,b=()=>r?o.moveCell({cellId:e,direction:"right"}):void 0,c[11]=o,c[12]=r,c[13]=e,c[14]=p,c[15]=b):(p=c[14],b=c[15]),c[16]!==o||c[17]!==s||c[18]!==e||c[19]!==(t==null?void 0:t.current)||c[20]!==i?(y=()=>{var M,R,z;const T=!s.hide_code;Lr({configs:{[e]:{hide_code:T}}}),o.updateCellConfig({cellId:e,config:{hide_code:T}}),T?((M=i.current)==null||M.contentDOM.blur(),(R=t==null?void 0:t.current)==null||R.focus()):(z=i.current)==null||z.focus()},c[16]=o,c[17]=s,c[18]=e,c[19]=t==null?void 0:t.current,c[20]=i,c[21]=y):y=c[21],c[22]!==o||c[23]!==e?(k=()=>o.moveToNextCell({cellId:e,before:!1,noCreate:!0}),x=()=>o.moveToNextCell({cellId:e,before:!0,noCreate:!0}),v=()=>o.sendToBottom({cellId:e}),S=()=>o.sendToTop({cellId:e}),c[22]=o,c[23]=e,c[24]=x,c[25]=v,c[26]=S,c[27]=k):(x=c[24],v=c[25],S=c[26],k=c[27]),c[28]!==e||c[29]!==i||c[30]!==a?(E=()=>{let T;T=!1,a(M=>(M==null?void 0:M.cellId)===e?(T=!0,null):{cellId:e}),T&&J_(i).focus()},c[28]=e,c[29]=i,c[30]=a,c[31]=E):E=c[31],c[32]!==l?(N=()=>{var T;(T=l.current)==null||T.toggle()},c[32]=l,c[33]=N):N=c[33],c[34]!==n||c[35]!==d||c[36]!==h||c[37]!==x||c[38]!==v||c[39]!==S||c[40]!==E||c[41]!==N||c[42]!==f||c[43]!==m||c[44]!==_||c[45]!==g||c[46]!==p||c[47]!==b||c[48]!==y||c[49]!==k?(I={"cell.run":n,"cell.runAndNewBelow":d,"cell.runAndNewAbove":h,"cell.createAbove":f,"cell.createBelow":m,"cell.moveUp":_,"cell.moveDown":g,"cell.moveLeft":p,"cell.moveRight":b,"cell.hideCode":y,"cell.focusDown":k,"cell.focusUp":x,"cell.sendToBottom":v,"cell.sendToTop":S,"cell.aiCompletion":E,"cell.cellActions":N},c[34]=n,c[35]=d,c[36]=h,c[37]=x,c[38]=v,c[39]=S,c[40]=E,c[41]=N,c[42]=f,c[43]=m,c[44]=_,c[45]=g,c[46]=p,c[47]=b,c[48]=y,c[49]=k,c[50]=I):I=c[50],dV(t,I)}function Lx(t,e,n,o,r,s){const i=J.c(16);let a,l,c,d,h;i[0]!==n||i[1]!==e?(a=f=>(!f||!Hn.fromInput(f))&&(n.moveToNextCell({cellId:e,before:!1,noCreate:!0}),!0),l=f=>(!f||!Hn.fromInput(f))&&(n.moveToNextCell({cellId:e,before:!0,noCreate:!0}),!0),i[0]=n,i[1]=e,i[2]=a,i[3]=l):(a=i[2],l=i[3]),i[4]!==o?(c=()=>(o(),!1),i[4]=o,i[5]=c):c=i[5],i[6]!==n||i[7]!==e||i[8]!==s||i[9]!==r.keymap.preset?(d=r.keymap.preset!=="vim"||s?{}:{j:f=>(!f||!Hn.fromInput(f))&&(n.moveToNextCell({cellId:e,before:!1,noCreate:!0}),!0),k:f=>(!f||!Hn.fromInput(f))&&(n.moveToNextCell({cellId:e,before:!0,noCreate:!0}),!0)},i[6]=n,i[7]=e,i[8]=s,i[9]=r.keymap.preset,i[10]=d):d=i[10],i[11]!==a||i[12]!==l||i[13]!==c||i[14]!==d?(h={ArrowDown:a,ArrowUp:l,Enter:c,...d},i[11]=a,i[12]=l,i[13]=c,i[14]=d,i[15]=h):h=i[15],uV(t,h)}Dx.displayName="SortableCellInternal";const Fx=A.forwardRef((t,e)=>{const n=J.c(14),{id:o,output:r,interrupted:s,errored:i,stopped:a,name:l,outputStale:c,outputLoading:d}=t;let h;n[0]===Symbol.for("react.memo_cache_sentinel")?(h=Wc("marimo-cell","hover-actions-parent z-10",{published:!0}),n[0]=h):h=n[0];const f=h;let m;n[1]!==o?(m=zs.create(o),n[1]=o,n[2]=m):m=n[2];const _=m,g=oS(r==null?void 0:r.mimetype);if(i||s||a||g)return null;let p,b;return n[3]!==o||n[4]!==r||n[5]!==d||n[6]!==c?(p=u.jsx(qc,{allowExpand:!1,forceExpand:!0,output:r,className:"output-area",cellId:o,stale:c,loading:d}),n[3]=o,n[4]=r,n[5]=d,n[6]=c,n[7]=p):p=n[7],n[8]!==_||n[9]!==o||n[10]!==l||n[11]!==e||n[12]!==p?(b=u.jsx("div",{tabIndex:-1,id:_,ref:e,className:f,"data-cell-id":o,"data-cell-name":l,children:p}),n[8]=_,n[9]=o,n[10]=l,n[11]=e,n[12]=p,n[13]=b):b=n[13],b});Fx.displayName="ReadonlyCellComponent";const wM=({theme:t,showPlaceholder:e,id:n,code:o,output:r,consoleOutputs:s,status:i,runStartTimestamp:a,lastRunStartTimestamp:l,runElapsedTimeMs:c,edited:d,interrupted:h,errored:f,stopped:m,staleInputs:_,serializedEditorState:g,serialization:p,debuggerActive:b,connectionState:y,canDelete:x,actions:v,deleteCell:S,userConfig:k,outline:E,isCollapsed:N,collapseCount:I,config:T,canMoveX:M,name:R,editorView:z,setEditorView:D,outputStale:F})=>{const B=A.useRef(null),V=A.useRef(null),O=A.useRef(null),C=A.useRef(null),$=Qt(La),j=gd(n),[W,K]=A.useState(),Z=T.disabled||i==="disabled-transitively",q=rS({executionTime:c,status:i,errored:f,interrupted:h,stopped:m}),ne=d||h||_&&!Z,re=tS(i),ae=(i==="queued"||d||_)&&!h,X=A.useCallback(()=>z.current,[z]),{closeCompletionHandler:ee,resumeCompletionHandler:ce}=Rx(B,z),{isCellCodeShown:me,isMarkdown:ue,isMarkdownCodeHidden:pe,temporarilyShowCode:de,showHiddenMarkdownCode:Ne}=function(G,ge,_e,fe){const le=J.c(13),[Ve,Fe]=A.useState(!1),Ke=!G.hide_code||Ve,ie=ge==="markdown",Se=ie&&!Ke;let Ee;le[0]!==_e||le[1]!==fe||le[2]!==Ke?(Ee=it=>{var bt,Mt;if(Ke)return;const Xe=(it==null?void 0:it.focus)??!0;Fe(!0),Xe&&((bt=_e.current)==null||bt.focus());const ot=(Mt=fe.current)==null?void 0:Mt.parentElement;if(!ot)return void Dt.error("Cell: No parent element found for editor view");const yt=()=>{requestAnimationFrame(()=>{var xt;ot.contains(document.activeElement)||(Fe(!1),(xt=_e.current)==null||xt.dom.blur(),ot.removeEventListener("focusout",yt))})};ot.addEventListener("focusout",yt)},le[0]=_e,le[1]=fe,le[2]=Ke,le[3]=Ee):Ee=le[3];const Be=et(Ee);let Ye;le[4]!==Se||le[5]!==Be?(Ye=()=>{Se&&Be({focus:!0})},le[4]=Se,le[5]=Be,le[6]=Ye):Ye=le[6];const Oe=et(Ye);let He;return le[7]!==Ke||le[8]!==ie||le[9]!==Se||le[10]!==Oe||le[11]!==Be?(He={isCellCodeShown:Ke,isMarkdown:ie,isMarkdownCodeHidden:Se,temporarilyShowCode:Be,showHiddenMarkdownCode:Oe},le[7]=Ke,le[8]=ie,le[9]=Se,le[10]=Oe,le[11]=Be,le[12]=He):He=le[12],He}(T,W,z,O);Px(B,n,j,v,M,T,z,$,V),Lx(B,n,v,Ne,k,me);const je=cV(E),se=!nS(r),Ae=s.length>0,be=k.display.cell_output,Re=se&&be==="above",ze=se&&be==="below",[qe,Qe]=A.useState(!1),[Pe,tt]=A.useState(!1);(function(G){const{ref:ge,box:_e="content-box",skip:fe}=G,le=A.useRef({...A5}),Ve=A.useRef(void 0);Ve.current=G.onResize,A.useEffect(()=>{if(!ge.current||fe||typeof window>"u"||!("ResizeObserver"in window))return;const Fe=new ResizeObserver(([Ke])=>{const ie=_e==="border-box"?"borderBoxSize":_e==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",Se=Y_(Ke,ie,"inlineSize"),Ee=Y_(Ke,ie,"blockSize");if(le.current.width!==Se||le.current.height!==Ee){const Be={width:Se,height:Ee};le.current.width=Se,le.current.height=Ee,Ve.current&&Ve.current(Be)}});return Fe.observe(ge.current,{box:_e}),()=>{Fe.disconnect()}},[_e,ge,fe])})({ref:C,skip:!ue,onResize:G=>{const ge=G.height&&G.height<68,_e=pe&&(ge||be==="below");Qe(_e),je&&_e?tt(!0):Pe&&tt(!1)}});const Je=G=>u.jsx(Q4,{tooltip:"Edit markdown",className:Ie("z-20 relative",G),onClick:de}),nt=se&&u.jsxs("div",{className:"relative",onDoubleClick:Ne,children:[u.jsx("div",{className:"absolute top-5 -left-8 z-10 print:hidden",children:u.jsx(bM,{isCollapsed:N,onClick:()=>{N?v.expandCell({cellId:n}):v.collapseCell({cellId:n})},canCollapse:je})}),pe&&ze&&Je("top-3"),u.jsx(qc,{allowExpand:!0,forceExpand:pe,output:r,className:"output-area",cellId:n,stale:F,loading:re}),pe&&Re&&Je("bottom-3")]}),te=Wc("marimo-cell","hover-actions-parent z-10",{interactive:!0,"needs-run":ne,"has-error":f,stopped:m,disabled:T.disabled,stale:i==="disabled-transitively",borderless:pe&&se}),we=zs.create(n),ke=et(G=>{$({cellId:n,initialPrompt:G.prompt})}),Le=!(!p||p.toLowerCase()!=="valid");return u.jsx(Km,{children:u.jsx(T0,{cellId:n,config:T,status:i,getEditorView:X,hasOutput:se,hasConsoleOutput:Ae,name:R,children:u.jsxs(Ox,{tabIndex:-1,ref:B,"data-status":i,onBlur:ee,onKeyDown:ce,cellId:n,canMoveX:M,title:T.disabled?"This cell is disabled":i==="disabled-transitively"?"This cell has a disabled ancestor":void 0,children:[u.jsxs("div",{className:te,id:we,ref:C,"data-cell-id":n,"data-cell-name":R,children:[be==="above"&&nt,u.jsxs("div",{className:Ie("tray"),"data-hidden":pe,children:[u.jsx("div",{className:"absolute right-2 -top-4 z-10",children:u.jsx(Bx,{edited:d,connectionState:y,status:i,cellConfig:T,needsRun:ne,hasOutput:se,hasConsoleOutput:Ae,cellActionDropdownRef:V,cellId:n,name:R,getEditorView:X,onRun:j})}),u.jsx(vM,{cellId:n,className:Ie(pe&&Re&&"-top-7",pe&&ze&&"-bottom-8",pe&&Pe&&"-left-[3.8rem]"),connectionState:y,actions:v}),u.jsx(eh,{theme:t,showPlaceholder:e,id:n,code:o,config:T,status:i,serializedEditorState:g,runCell:j,setEditorView:D,userConfig:k,editorViewRef:z,editorViewParentRef:O,hidden:!me,hasOutput:se,temporarilyShowCode:de,languageAdapter:W,setLanguageAdapter:K}),u.jsx(zx,{className:Ie(pe&&be==="below"&&"top-14"),edited:d,status:i,isCellStatusInline:qe,uninstantiated:q,disabled:T.disabled,runElapsedTimeMs:c,runStartTimestamp:a,lastRunStartTimestamp:l,staleInputs:_,interrupted:h}),u.jsx("div",{className:"shoulder-bottom hover-action",children:x&&me&&u.jsx(Ax,{connectionState:y,status:i,onClick:()=>{re||br(y)||S({cellId:n})}})})]}),be==="below"&&nt,p&&u.jsxs("a",{href:"https://links.marimo.app/reusable-definitions",target:"_blank",className:"hover:underline py-1 px-2 flex items-center justify-end gap-2 last:rounded-b",rel:"noopener",children:[Le&&u.jsx("span",{className:"text-muted-foreground text-xs font-bold",children:"reusable"}),u.jsx(Te,{content:u.jsx("span",{className:"max-w-16 text-xs",children:Le?"This function or class can be imported into other Python notebooks or modules.":u.jsxs(u.Fragment,{children:["This definition can't be reused in other Python modules:",u.jsx("br",{}),u.jsx("br",{}),u.jsx("pre",{children:p}),u.jsx("br",{}),"Click this icon to learn more."]})}),children:Le&&u.jsx(dc,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})||u.jsx(Xm,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})})]}),u.jsx(hp,{consoleOutputs:s,stale:ae,cellName:p?"_":R,onRefactorWithAI:ke,onClear:()=>{v.clearCellConsoleOutput({cellId:n})},onSubmitDebugger:(G,ge)=>{v.setStdinResponse({cellId:n,response:G,outputIndex:ge}),sS({text:G})},cellId:n,debuggerActive:b})]}),N&&u.jsx(Ix,{onClick:()=>v.expandCell({cellId:n}),count:I,cellId:n})]})})})},zx=t=>{const e=J.c(19),{className:n,disabled:o,edited:r,interrupted:s,isCellStatusInline:i,lastRunStartTimestamp:a,runElapsedTimeMs:l,runStartTimestamp:c,staleInputs:d,status:h,uninstantiated:f}=t,m=o!==void 0&&o;let _;e[0]!==m||e[1]!==r||e[2]!==s||e[3]!==a||e[4]!==l||e[5]!==c||e[6]!==d||e[7]!==h||e[8]!==f?(_=u.jsx(Z_,{status:h,staleInputs:d,interrupted:s,editing:!0,edited:r,disabled:m,elapsedTime:l,runStartTimestamp:c,uninstantiated:f,lastRunStartTimestamp:a}),e[0]=m,e[1]=r,e[2]=s,e[3]=a,e[4]=l,e[5]=c,e[6]=d,e[7]=h,e[8]=f,e[9]=_):_=e[9];const g=_;let p;e[10]!==n?(p=Ie("shoulder-right z-20",n),e[10]=n,e[11]=p):p=e[11];const b=!i&&g;let y;e[12]===Symbol.for("react.memo_cache_sentinel")?(y=u.jsx(Mx,{}),e[12]=y):y=e[12];const x=i&&g;let v,S;return e[13]!==x?(v=u.jsxs("div",{className:"flex gap-2 items-end",children:[y,x]}),e[13]=x,e[14]=v):v=e[14],e[15]!==p||e[16]!==b||e[17]!==v?(S=u.jsxs("div",{className:p,children:[b,v]}),e[15]=p,e[16]=b,e[17]=v,e[18]=S):S=e[18],S},vM=t=>{const e=J.c(21),{className:n,connectionState:o,actions:r,cellId:s}=t;let i;e[0]!==r||e[1]!==s?(i=v=>{const S=v===void 0?{}:v;return r.createNewCell({cellId:s,before:!1,...S})},e[0]=r,e[1]=s,e[2]=i):i=e[2];const a=et(i);let l;e[3]!==r||e[4]!==s?(l=v=>{const S=v===void 0?{}:v;return r.createNewCell({cellId:s,before:!0,...S})},e[3]=r,e[4]=s,e[5]=l):l=e[5];const c=et(l),d=Qc(o);let h,f;e[6]!==n?(h=Ie("absolute flex flex-col gap-[2px] justify-center h-full left-[-34px] z-20",n),e[6]=n,e[7]=h):h=e[7],e[8]===Symbol.for("react.memo_cache_sentinel")?(f=pn("cell.createAbove"),e[8]=f):f=e[8];const m=d?c:void 0;let _,g,p;e[9]!==o||e[10]!==m?(_=u.jsx(E0,{tooltipContent:f,connectionState:o,onClick:m}),e[9]=o,e[10]=m,e[11]=_):_=e[11],e[12]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("div",{className:"flex-1"}),e[12]=g):g=e[12],e[13]===Symbol.for("react.memo_cache_sentinel")?(p=pn("cell.createBelow"),e[13]=p):p=e[13];const b=d?a:void 0;let y,x;return e[14]!==o||e[15]!==b?(y=u.jsx(E0,{tooltipContent:p,connectionState:o,onClick:b}),e[14]=o,e[15]=b,e[16]=y):y=e[16],e[17]!==h||e[18]!==_||e[19]!==y?(x=u.jsxs("div",{className:h,children:[_,g,y]}),e[17]=h,e[18]=_,e[19]=y,e[20]=x):x=e[20],x},Bx=t=>{const e=J.c(27),{edited:n,connectionState:o,status:r,cellConfig:s,needsRun:i,hasOutput:a,hasConsoleOutput:l,onRun:c,cellActionDropdownRef:d,cellId:h,getEditorView:f,name:m,includeCellActions:_}=t,g=_===void 0||_,p=Qc(o),b=!i&&"hover-action";let y;e[0]!==b?(y=Ie(b),e[0]=b,e[1]=y):y=e[1];const x=p?c:An.NOOP;let v,S,k,E;return e[2]!==s||e[3]!==o||e[4]!==n||e[5]!==i||e[6]!==r||e[7]!==x?(v=u.jsx(xM,{edited:n,onClick:x,connectionState:o,status:r,config:s,needsRun:i}),e[2]=s,e[3]=o,e[4]=n,e[5]=i,e[6]=r,e[7]=x,e[8]=v):v=e[8],e[9]!==o||e[10]!==r?(S=u.jsx(nE,{status:r,connectionState:o}),e[9]=o,e[10]=r,e[11]=S):S=e[11],e[12]!==d||e[13]!==s||e[14]!==h||e[15]!==f||e[16]!==l||e[17]!==a||e[18]!==g||e[19]!==m||e[20]!==r?(k=g&&u.jsx(I0,{ref:d,cellId:h,status:r,getEditorView:f,name:m,config:s,hasOutput:a,hasConsoleOutput:l,children:u.jsx(pi,{variant:"green",tooltip:null,"data-testid":"cell-actions-button",children:u.jsx(QS,{strokeWidth:1.5})})}),e[12]=d,e[13]=s,e[14]=h,e[15]=f,e[16]=l,e[17]=a,e[18]=g,e[19]=m,e[20]=r,e[21]=k):k=e[21],e[22]!==y||e[23]!==v||e[24]!==S||e[25]!==k?(E=u.jsxs(tE,{className:y,children:[v,S,k]}),e[22]=y,e[23]=v,e[24]=S,e[25]=k,e[26]=E):E=e[26],E},kM=({theme:t,showPlaceholder:e,id:n,code:o,output:r,consoleOutputs:s,status:i,runStartTimestamp:a,lastRunStartTimestamp:l,runElapsedTimeMs:c,edited:d,interrupted:h,errored:f,stopped:m,staleInputs:_,serializedEditorState:g,debuggerActive:p,connectionState:b,canDelete:y,actions:x,deleteCell:v,userConfig:S,config:k,canMoveX:E,name:N,editorView:I,setEditorView:T})=>{const M=A.useRef(null),R=A.useRef(null),z=A.useRef(null),D=Qt(La),F=gd(n),B=k.disabled||i==="disabled-transitively",V=rS({executionTime:c,status:i,errored:f,interrupted:h,stopped:m}),O=d||h||_&&!B,C=i==="running"||i==="queued",$=(i==="queued"||d||_)&&!h,j=A.useCallback(()=>I.current,[I]),{closeCompletionHandler:W,resumeCompletionHandler:K}=Rx(M,I);Px(M,n,F,x,E,k,I,D,R),Lx(M,n,x,An.NOOP,S,!0);const Z=!nS(r),q=s.length>0,ne=oS(r==null?void 0:r.mimetype),re=Wc("marimo-cell","hover-actions-parent z-10 border shadow-sm","!border-[var(--blue-5)] !rounded-sm",{"needs-run":O,"has-error":f,stopped:m}),ae=zs.create(n),X=et(ee=>{D({cellId:n,initialPrompt:ee.prompt})});return u.jsx(Km,{children:u.jsx(T0,{cellId:n,config:k,status:i,getEditorView:j,hasOutput:Z,hasConsoleOutput:q,name:N,children:u.jsxs("div",{className:re,"data-status":i,id:ae,ref:M,onBlur:W,onKeyDown:K,title:k.disabled?"This cell is disabled":i==="disabled-transitively"?"This cell has a disabled ancestor":void 0,"data-cell-id":n,"data-cell-name":N,"data-setup-cell":!0,children:[u.jsxs("div",{className:Ie("tray"),"data-hidden":!1,children:[u.jsx("div",{className:"absolute right-2 -top-4 z-10",children:u.jsx(Bx,{edited:d,connectionState:b,status:i,cellConfig:k,needsRun:O,hasOutput:Z,hasConsoleOutput:q,cellActionDropdownRef:R,cellId:n,name:N,getEditorView:j,onRun:F,includeCellActions:!1})}),u.jsx(eh,{theme:t,showPlaceholder:e,id:n,code:o,config:k,status:i,serializedEditorState:g,runCell:F,setEditorView:T,userConfig:S,editorViewRef:I,editorViewParentRef:z,hidden:!1,hasOutput:Z,temporarilyShowCode:An.NOOP,languageAdapter:"python",setLanguageAdapter:An.NOOP,showLanguageToggles:!1}),u.jsx(zx,{edited:d,status:i,isCellStatusInline:!1,uninstantiated:V,disabled:k.disabled,runElapsedTimeMs:c,runStartTimestamp:a,lastRunStartTimestamp:l,staleInputs:_,interrupted:h}),u.jsx("div",{className:"shoulder-bottom hover-action",children:y&&u.jsx(Ax,{connectionState:b,status:i,onClick:()=>{C||br(b)||v({cellId:n})}})})]}),u.jsxs("div",{className:"py-1 px-2 flex justify-end gap-2 last:rounded-b",children:[u.jsx("span",{className:"text-muted-foreground text-xs font-bold",children:"setup cell"}),u.jsx(Te,{content:u.jsxs("span",{className:"max-w-16",children:["This ",u.jsx("b",{children:"setup cell"})," is guaranteed to run before all other cells. Include ",u.jsx("br",{}),"initialization or imports and constants required by top-level functions."]}),children:u.jsx(Xm,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})})]}),ne&&u.jsx(qc,{allowExpand:!0,forceExpand:!0,output:r,className:"output-area",cellId:n,stale:!1,loading:C}),u.jsx(hp,{consoleOutputs:s,stale:$,cellName:"_",onRefactorWithAI:X,onClear:()=>{x.clearCellConsoleOutput({cellId:n})},onSubmitDebugger:(ee,ce)=>{x.setStdinResponse({cellId:n,response:ee,outputIndex:ce}),sS({text:ee})},cellId:n,debuggerActive:p})]})})})},Ux=A.memo(A.forwardRef((t,e)=>{const{status:n,output:o,runStartTimestamp:r,interrupted:s,staleInputs:i,edited:a,id:l,mode:c}=t;Dt.debug("Rendering Cell",l);const d=A.useRef(null);A.useImperativeHandle(e,()=>({get editorView(){return J_(d)},get editorViewOrNull(){return d.current}}),[d]);const h=lV({status:n,output:o,runStartTimestamp:r,interrupted:s,staleInputs:i},a),f=tS(n);return l===Ho?u.jsx(kM,{...t,editorView:d,setEditorView:m=>{d.current=m},outputStale:h}):c==="edit"?u.jsx(wM,{...t,editorView:d,setEditorView:m=>{d.current=m},outputStale:h}):u.jsx(Fx,{...t,outputStale:h,outputLoading:f})})),SM=(t,e)=>function(n,o){const r=/^(\d+)\.(\d+)\.(\d+)(?:-([\w.-]+))?(?:\+([\w.-]+))?$/,s=i=>{const a=i.match(r);if(!a)return null;const[,l,c,d,h]=a;return{major:Number.parseInt(l,10),minor:Number.parseInt(c,10),patch:Number.parseInt(d,10),preRelease:h||""}};try{const i=s(n),a=s(o);return i&&a?i.major!==a.major?i.major-a.major:i.minor!==a.minor?i.minor-a.minor:i.patch!==a.patch?i.patch-a.patch:i.preRelease===""&&a.preRelease!==""?1:i.preRelease!==""&&a.preRelease===""?-1:i.preRelease.localeCompare(a.preRelease):n.localeCompare(o,void 0,{numeric:!0,sensitivity:"base"})}catch{return n.localeCompare(o,void 0,{numeric:!0,sensitivity:"base"})}}(e,t),Vx=new class{constructor(t){this.ttl=void 0,this.cache=new Map,this.ttl=t.ttl}cleanupExpiredEntries(){const t=Date.now();for(const[e,n]of this.cache.entries())t-n.timestamp>this.ttl&&this.cache.delete(e)}get(t){this.cleanupExpiredEntries();const e=this.cache.get(t);if(e){if(!(Date.now()-e.timestamp>this.ttl))return e.data;this.cache.delete(t)}}set(t,e){this.cache.set(t,{data:e,timestamp:Date.now()})}clear(){this.cache.clear()}}({ttl:3e5}),CM=iS({info:iS({provides_extra:aS().array().nullable()}),releases:hV(aS(),fV())});function $x(t){const e=J.c(5);let n;e[0]!==t?(n=function(i){return i.replaceAll(/\[.*]/g,"").trim()}(t),e[0]=t,e[1]=n):n=e[1];const o=n;let r,s;return e[2]!==o?(r=async()=>{const i=Vx.get(o);if(i)return i;const a=await fetch(`https://pypi.org/pypi/${o}/json`,{method:"GET"});if(!a.ok)throw new Error(`HTTP ${a.status}: ${a.statusText}`);const l=CM.transform(NM).parse(await a.json());return Vx.set(o,l),l},s=[o],e[2]=o,e[3]=r,e[4]=s):(r=e[3],s=e[4]),Gn(r,s)}function NM(t){return{versions:Object.keys(t.releases).toSorted(SM),extras:t.info.provides_extra??[]}}function Hx(t){const e=t.match(/^([^[]+)(?:\[([^\]]+)])?$/);if(!e)return{name:t,extras:[]};const[,n,o]=e;return{name:n,extras:o?o.split(",").map(r=>r.trim()):[]}}const jM=()=>{const t=J.c(70),{packageAlert:e}=SH(),{clearPackageAlert:n}=CH(),[o]=$s();let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={},t[0]=r):r=t[0];const[s,i]=A.useState(r);let a;t[1]===Symbol.for("react.memo_cache_sentinel")?(a={},t[1]=a):a=t[1];const[l,c]=A.useState(a);if(e===null)return null;const d=o.package_management.manager!=="pixi";if(NH(e)){let h,f,m,_,g,p,b,y,x,v;if(t[2]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[u.jsx(dd,{className:"w-5 h-5 inline-block mr-2"}),"Missing packages"]}),t[2]=h):h=t[2],t[3]!==n||t[4]!==e.id?(f=()=>n(e.id),t[3]=n,t[4]=e.id,t[5]=f):f=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(m=u.jsx(oo,{className:"w-5 h-5"}),t[6]=m):m=t[6],t[7]!==f?(_=u.jsxs("div",{className:"flex justify-between",children:[h,u.jsx(Me,{variant:"text","data-testid":"remove-banner-button",size:"icon",onClick:f,children:m})]}),t[7]=f,t[8]=_):_=t[8],t[9]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("p",{children:"The following packages were not found:"}),t[9]=g):g=t[9],t[10]!==s||t[11]!==d||t[12]!==e.packages||t[13]!==l){let S;t[15]!==s||t[16]!==d||t[17]!==l?(S=(k,E)=>{const N=Hx(k),I=l[k]||N.extras;return u.jsxs("li",{className:"flex items-center gap-2 font-mono text-sm",children:[u.jsx(si,{size:"1rem"}),u.jsx(TM,{packageName:N.name,selectedExtras:I,onExtrasChange:T=>c(M=>({...M,[k]:T}))}),d&&u.jsx(MM,{value:s[k]??"latest",onChange:T=>i(M=>({...M,[k]:T})),packageName:N.name})]},E)},t[15]=s,t[16]=d,t[17]=l,t[18]=S):S=t[18],p=e.packages.map(S),t[10]=s,t[11]=d,t[12]=e.packages,t[13]=l,t[14]=p}else p=t[14];return t[19]!==p?(b=u.jsxs("div",{children:[g,u.jsx("ul",{className:"list-disc ml-4 mt-1",children:p})]}),t[19]=p,t[20]=b):b=t[20],t[21]!==n||t[22]!==s||t[23]!==e.id||t[24]!==e.isolated||t[25]!==e.packages||t[26]!==l||t[27]!==o.package_management.manager?(y=u.jsx("div",{className:"ml-auto flex flex-row items-baseline",children:e.isolated?u.jsxs(u.Fragment,{children:[u.jsx(IM,{manager:o.package_management.manager,packages:e.packages.map(S=>{const k=Hx(S),E=l[S]||k.extras;return function(N,I){return I.length===0?N:`${N}[${I.join(",")}]`}(k.name,E)}),versions:s,clearPackageAlert:()=>n(e.id)}),!In()&&u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"px-2 text-sm",children:"with"})," ",u.jsx(AM,{})]})]}):u.jsxs("p",{children:["If you set up a"," ",u.jsx(Sm,{href:"https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments",children:"virtual environment"}),", marimo can install these packages for you."]})}),t[21]=n,t[22]=s,t[23]=e.id,t[24]=e.isolated,t[25]=e.packages,t[26]=l,t[27]=o.package_management.manager,t[28]=y):y=t[28],t[29]!==b||t[30]!==y?(x=u.jsxs("div",{className:"flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",children:[b,y]}),t[29]=b,t[30]=y,t[31]=x):x=t[31],t[32]!==x||t[33]!==_?(v=u.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-12 min-w-[400px] z-[200] opacity-95",children:u.jsxs(Gc,{kind:"danger",className:"flex flex-col rounded py-3 px-5 animate-in slide-in-from-left",children:[_,x]})}),t[32]=x,t[33]=_,t[34]=v):v=t[34],v}if(jH(e)){let h;t[35]!==e.packages?(h=function(D){const F=new Set(Object.values(D)),B=F.has("queued")||F.has("installing")?"installing":F.has("failed")?"failed":"installed";return B==="installing"?{status:"installing",title:"Installing packages",titleIcon:u.jsx(Ia,{className:"w-5 h-5 inline-block mr-2"}),description:"Installing packages:"}:B==="installed"?{status:"installed",title:"All packages installed!",titleIcon:u.jsx($p,{className:"w-5 h-5 inline-block mr-2"}),description:"Installed packages:"}:{status:"failed",title:"Some packages failed to install",titleIcon:u.jsx(dd,{className:"w-5 h-5 inline-block mr-2"}),description:"See terminal for error logs."}}(e.packages),t[35]=e.packages,t[36]=h):h=t[36];const{status:f,title:m,titleIcon:_,description:g}=h;f==="installed"&&setTimeout(()=>n(e.id),1e4);const p=f==="failed"?"danger":"info";let b,y,x,v,S;t[37]!==m||t[38]!==_?(b=u.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[_,m]}),t[37]=m,t[38]=_,t[39]=b):b=t[39],t[40]!==n||t[41]!==e.id?(y=()=>n(e.id),t[40]=n,t[41]=e.id,t[42]=y):y=t[42],t[43]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx(oo,{className:"w-5 h-5"}),t[43]=x):x=t[43],t[44]!==y?(v=u.jsx(Me,{variant:"text","data-testid":"remove-banner-button",size:"icon",onClick:y,children:x}),t[44]=y,t[45]=v):v=t[45],t[46]!==b||t[47]!==v?(S=u.jsxs("div",{className:"flex justify-between",children:[b,v]}),t[46]=b,t[47]=v,t[48]=S):S=t[48];const k=f==="installed"&&"text-accent-foreground";let E,N,I,T,M,R,z;if(t[49]!==k?(E=Ie("flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",k),t[49]=k,t[50]=E):E=t[50],t[51]!==g?(N=u.jsx("p",{children:g}),t[51]=g,t[52]=N):N=t[52],t[53]!==e.packages||t[54]!==f){let D;t[56]!==f?(D=(F,B)=>{const[V,O]=F;return u.jsxs("li",{className:Ie("flex items-center gap-1 font-mono text-sm",O==="installing"&&"font-semibold",O==="failed"&&"text-destructive",O==="installed"&&"text-accent-foreground",O==="installed"&&f==="failed"&&"text-muted-foreground"),children:[u.jsx(EM,{status:O}),V]},B)},t[56]=f,t[57]=D):D=t[57],I=Object.entries(e.packages).map(D),t[53]=e.packages,t[54]=f,t[55]=I}else I=t[55];return t[58]!==I?(T=u.jsx("ul",{className:"list-disc ml-4 mt-1",children:I}),t[58]=I,t[59]=T):T=t[59],t[60]!==N||t[61]!==T?(M=u.jsxs("div",{children:[N,T]}),t[60]=N,t[61]=T,t[62]=M):M=t[62],t[63]!==E||t[64]!==M?(R=u.jsx("div",{className:E,children:M}),t[63]=E,t[64]=M,t[65]=R):R=t[65],t[66]!==R||t[67]!==p||t[68]!==S?(z=u.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-12 min-w-[400px] z-[200] opacity-95",children:u.jsxs(Gc,{kind:p,className:"flex flex-col rounded pt-3 pb-4 px-5",children:[S,R]})}),t[66]=R,t[67]=p,t[68]=S,t[69]=z):z=t[69],z}return vc(e),null},EM=t=>{const e=J.c(4),{status:n}=t;switch(n){case"queued":{let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(si,{size:"1rem"}),e[0]=o):o=e[0],o}case"installing":{let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(Ia,{size:"1rem"}),e[1]=o):o=e[1],o}case"installed":{let o;return e[2]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(Nc,{size:"1rem"}),e[2]=o):o=e[2],o}case"failed":{let o;return e[3]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(oo,{size:"1rem"}),e[3]=o):o=e[3],o}default:return vc(n),null}},IM=t=>{const e=J.c(9),{manager:n,packages:o,versions:r,clearPackageAlert:s}=t;let i,a,l,c;return e[0]!==s||e[1]!==n||e[2]!==o||e[3]!==r?(i=async()=>{s();const d={...r};for(const h of o)d[h]=d[h]??"";await _V({manager:n,versions:d}).catch(OM)},e[0]=s,e[1]=n,e[2]=o,e[3]=r,e[4]=i):i=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx(Ia,{className:"w-4 h-4 mr-2"}),l=u.jsx("span",{className:"font-semibold",children:"Install"}),e[5]=a,e[6]=l):(a=e[5],l=e[6]),e[7]!==i?(c=u.jsxs(Me,{variant:"outline","data-testid":"install-packages-button",size:"sm",onClick:i,children:[a,l]}),e[7]=i,e[8]=c):c=e[8],c},AM=()=>{const t=J.c(16),[e,n]=$s();let o,r;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=f4(mV),t[0]=o):o=t[0],t[1]!==e?(r={resolver:o,defaultValues:e},t[1]=e,t[2]=r):r=t[2];const s=m4(r);let i;t[3]!==n?(i=async f=>{await zr({config:f}).then(()=>{n(f)})},t[3]=n,t[4]=i):i=t[4];const a=i;let l,c,d,h;return t[5]!==s||t[6]!==a?(l=s.handleSubmit(a),t[5]=s,t[6]=a,t[7]=l):l=t[7],t[8]!==s.control?(c=u.jsx("div",{className:"flex flex-col gap-3",children:u.jsx(c4,{control:s.control,name:"package_management.manager",render:RM})}),t[8]=s.control,t[9]=c):c=t[9],t[10]!==l||t[11]!==c?(d=u.jsx("form",{onChange:l,className:"flex flex-col gap-5",children:c}),t[10]=l,t[11]=c,t[12]=d):d=t[12],t[13]!==s||t[14]!==d?(h=u.jsx(pV,{...s,children:d}),t[13]=s,t[14]=d,t[15]=h):h=t[15],h},TM=t=>{const e=J.c(14),{packageName:n,selectedExtras:o,onExtrasChange:r}=t,[s,i]=A.useState(!1),{isPending:a,error:l,data:c}=$x(n);let d;e[0]!==r||e[1]!==o?(d=(g,p)=>{r(p?[...o,g]:o.filter(b=>b!==g))},e[0]=r,e[1]=o,e[2]=d):d=e[2];const h=d,f=!a&&!l;let m,_;if(e[3]!==(c==null?void 0:c.extras)?(m=(c==null?void 0:c.extras)??[],e[3]=c==null?void 0:c.extras,e[4]=m):m=e[4],e[5]!==f||e[6]!==h||e[7]!==s||e[8]!==n||e[9]!==o||e[10]!==m){const g=m.filter(PM);let p;e[12]!==n?(p=u.jsx("span",{className:"shrink-0",children:n}),e[12]=n,e[13]=p):p=e[13],_=u.jsxs("div",{className:"flex items-center max-w-72",children:[p,o.length>0?u.jsxs("span",{className:"flex items-center min-w-0 flex-1",children:[u.jsx("span",{className:"shrink-0",children:"["}),u.jsxs(Hs,{open:s&&f,onOpenChange:b=>{f&&i(b)},children:[u.jsx(Ws,{asChild:!0,children:u.jsx("button",{className:"hover:bg-muted/50 rounded text-sm px-1 transition-colors border border-muted-foreground/30 hover:border-muted-foreground/60 min-w-0 flex-1 truncate text-left",title:`Selected extras: ${o.join(", ")}`,children:o.join(",")})}),u.jsxs(qs,{align:"start",className:"w-64 p-0 max-h-96 flex flex-col",children:[o.length>0&&u.jsx("div",{className:"p-2 bg-popover border-b border-border",children:u.jsx("div",{className:"flex flex-wrap gap-1 p-1 min-h-[24px]",children:o.map(b=>u.jsxs("span",{className:"inline-flex items-center gap-1 px-1 py-0.5 text-sm font-mono border border-muted-foreground/30 hover:border-muted-foreground/60 rounded-sm cursor-pointer group transition-colors",onClick:()=>h(b,!1),children:[b,u.jsx(oo,{className:"w-3 h-3 opacity-60 group-hover:opacity-100"})]},b))})}),u.jsx("div",{className:"overflow-y-auto flex-1",children:g.map(b=>u.jsx(lS,{checked:o.includes(b),onCheckedChange:y=>{h(b,y)},className:"font-mono text-sm",onSelect:LM,children:b},b))})]})]}),u.jsx("span",{className:"shrink-0",children:"]"})]}):g.length>0?u.jsxs(Hs,{open:s&&f,onOpenChange:b=>{f&&i(b)},children:[u.jsx(Ws,{asChild:!0,children:u.jsx("button",{disabled:!f,className:Ie("hover:bg-muted/50 rounded text-sm ml-2 transition-colors border border-muted-foreground/30 hover:border-muted-foreground/60 h-5 w-5 flex items-center justify-center p-0",!f&&"opacity-50 cursor-not-allowed"),title:f?"Add extras":"Loading extras...",children:u.jsx(pr,{className:"w-3 h-3 flex-shrink-0"})})}),u.jsxs(qs,{align:"start",className:"w-64 p-0 max-h-96 flex flex-col",children:[u.jsx("div",{className:"p-2 bg-popover border-b border-border",children:u.jsx("span",{className:"text-muted-foreground italic text-sm",children:"Package extras"})}),u.jsx("div",{className:"overflow-y-auto flex-1",children:g.map(b=>u.jsx(lS,{checked:o.includes(b),onCheckedChange:y=>{h(b,y)},className:"font-mono text-sm",onSelect:FM,children:b},b))})]})]}):null]}),e[5]=f,e[6]=h,e[7]=s,e[8]=n,e[9]=o,e[10]=m,e[11]=_}else _=e[11];return _},MM=t=>{const e=J.c(16),{value:n,onChange:o,packageName:r}=t,{error:s,isPending:i,data:a}=$x(r);if(s){let h,f,m;return e[0]!==o?(h=_=>o(_.target.value),e[0]=o,e[1]=h):h=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsx("option",{value:"latest",children:"latest"}),e[2]=f):f=e[2],e[3]!==h||e[4]!==n?(m=u.jsx(Te,{content:"Failed to fetch package versions",children:u.jsx(Zm,{value:n,onChange:h,disabled:!0,className:"inline-flex ml-2 w-24 text-ellipsis",children:f})}),e[3]=h,e[4]=n,e[5]=m):m=e[5],m}let l,c,d;return e[6]!==o?(l=h=>o(h.target.value),e[6]=o,e[7]=l):l=e[7],e[8]!==i||e[9]!==a?(c=i?u.jsx("option",{value:"latest",children:"latest"}):["latest",...a.versions.slice(0,100)].map(zM),e[8]=i,e[9]=a,e[10]=c):c=e[10],e[11]!==i||e[12]!==l||e[13]!==c||e[14]!==n?(d=u.jsx(Zm,{value:n,onChange:l,disabled:i,className:"inline-flex ml-2 w-24 text-ellipsis",children:c}),e[11]=i,e[12]=l,e[13]=c,e[14]=n,e[15]=d):d=e[15],d};function OM(t){Dt.error(t)}function DM(t){return u.jsx("option",{value:t,children:t},t)}function RM(t){const{field:e}=t;return u.jsxs(d4,{children:[u.jsx(u4,{children:u.jsx(Zm,{"data-testid":"install-package-manager-select",onChange:n=>e.onChange(n.target.value),value:e.value,disabled:e.disabled,className:"inline-flex mr-2",children:gV.map(DM)})}),u.jsx(h4,{})]})}function PM(t){return!/^(dev|test|testing)$/i.test(t)}function LM(t){return t.preventDefault()}function FM(t){return t.preventDefault()}function zM(t){return u.jsx("option",{value:t,children:t},t)}const BM=t=>{let{transform:e}=t;return{...e,x:0}},UM={threshold:{x:0,y:.1}},VM=Y.memo(t=>{const e=J.c(23),{children:n,multiColumn:o}=t,{dropCellOverCell:r,dropCellOverColumn:s,moveColumn:i,compactColumns:a}=Ot(),[l,c]=A.useState(null),[d,h]=A.useState(null),[f]=s4();let m;e:{if(f.width==="columns"){m=Qm.EMPTY;break e}let D;e[0]===Symbol.for("react.memo_cache_sentinel")?(D=[BM],e[0]=D):D=e[0],m=D}const _=m;let g,p;e[1]===Symbol.for("react.memo_cache_sentinel")?(g={activationConstraint:{distance:8}},e[1]=g):g=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(p={coordinateGetter:Qj},e[2]=p):p=e[2];const b=function(){for(var D=arguments.length,F=new Array(D),B=0;B<D;B++)F[B]=arguments[B];return A.useMemo(()=>[...F].filter(V=>V!=null),[...F])}(e1(Vd,g),e1(Bd,p));let y;e[3]===Symbol.for("react.memo_cache_sentinel")?(y=D=>{c(D.active.id);const F=Wn();h(F.cellIds)},e[3]=y):y=e[3];const x=et(y);let v;e[4]!==d?(v=()=>{c(null),h(null)},e[4]=d,e[5]=v):v=e[5];const S=et(v);let k;e[6]!==l?(k=D=>{const F=D.droppableContainers.filter($M);if(l&&ds(l))return Rd({...D,droppableContainers:F});const B=(j=>{let{droppableContainers:W,droppableRects:K,pointerCoordinates:Z}=j;if(!Z)return[];const q=[];for(const ne of W){const{id:re}=ne,ae=K.get(re);if(ae&&_j(Z,ae)){const X=Od(ae).reduce((ce,me)=>ce+Td(Z,me),0),ee=Number((X/4).toFixed(4));q.push({id:re,data:{droppableContainer:ne,value:ee}})}}return q.sort(Md)})({...D,droppableContainers:F}),V=Dd(B.length>0?B:n1({...D,droppableContainers:F}),"id");if(!V)return[];Bo(ds(V),`Expected column id. Got: ${V}`);const O=Wn().cellIds.get(V);if(Bo(O,`Expected column. Got: ${V}`),O&&O.topLevelIds.length===0)return[{id:V}];const C=new Set(O.topLevelIds),$=Rd({...D,droppableContainers:D.droppableContainers.filter(j=>j.id!==V&&C.has(j.id))});if($.length>0){const j=$[0].id;return Bo(th(j),`Expected cell id. Got: ${j}`),[{id:j}]}return[]},e[6]=l,e[7]=k):k=e[7];const E=k;let N;e[8]!==r||e[9]!==s||e[10]!==i?(N=D=>{const{active:F,over:B}=D,V=B==null?void 0:B.id;if(V!=null&&F.id!==V){if(th(F.id)){if(ds(V))return void s({cellId:F.id,columnId:V});if(th(V))return void r({cellId:F.id,overCellId:V})}ds(F.id)&&ds(V)&&i({column:F.id,overColumn:V})}},e[8]=r,e[9]=s,e[10]=i,e[11]=N):N=e[11];const I=et(N);let T;e[12]!==a?(T=D=>{const{active:F,over:B}=D;B!==null&&F.id!==B.id&&a()},e[12]=a,e[13]=T):T=e[13];const M=et(T),R=o?E:Rd;let z;return e[14]!==n||e[15]!==S||e[16]!==M||e[17]!==I||e[18]!==x||e[19]!==_||e[20]!==b||e[21]!==R?(z=u.jsx(Bj,{autoScroll:UM,sensors:b,collisionDetection:R,modifiers:_,onDragEnd:M,onDragStart:x,onDragCancel:S,onDragOver:I,children:n}),e[14]=n,e[15]=S,e[16]=M,e[17]=I,e[18]=x,e[19]=_,e[20]=b,e[21]=R,e[22]=z):z=e[22],z});function th(t){return typeof t=="string"&&!t.startsWith("tree_")}function ds(t){return typeof t=="string"&&t.startsWith("tree_")}function $M(t){return ds(t.id)}const HM=t=>{const e=J.c(13),{className:n,size:o,gap:r,durationMs:s}=t,i=o===void 0?8:o,a=r===void 0?"gap-1":r,l=s===void 0?1200:s,c=`${l}ms`;let d;e[0]!==c?(d={animationDuration:c},e[0]=c,e[1]=d):d=e[1];const h=d;let f,m,_,g;return e[2]!==n||e[3]!==a?(f=Wc("flex",a,n),e[2]=n,e[3]=a,e[4]=f):f=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(m=[0,1,2],e[5]=m):m=e[5],e[6]!==h||e[7]!==l||e[8]!==i?(_=m.map(p=>u.jsx(bV,{width:i,height:i,className:"fill-current text-current animate-ellipsis-dot",style:{...h,animationDelay:l/3*p+"ms"}},p)),e[6]=h,e[7]=l,e[8]=i,e[9]=_):_=e[9],e[10]!==f||e[11]!==_?(g=u.jsx("div",{className:f,"aria-label":"Loading",children:_}),e[10]=f,e[11]=_,e[12]=g):g=e[12],g},WM=()=>{const t=J.c(2),e=$e(yV);let n;return t[0]!==e?(n=e&&u.jsx(Jm,{milliseconds:1e3,children:u.jsx("div",{className:"absolute top-4 m-0 flex items-center min-h-[28px] left-1/2 transform -translate-x-1/2 z-[200] ",children:u.jsx(Te,{content:"Connecting to a marimo runtime",children:u.jsx("div",{className:"flex items-center",children:u.jsx(HM,{size:5,className:"text-yellow-500"})})})})}),t[0]=e,t[1]=n):n=t[1],n},Wx=Y.forwardRef((t,e)=>{const n=J.c(62);let o,r,s,i,a,l;n[0]!==t?({columnId:i,canDelete:o,canMoveLeft:r,canMoveRight:s,...a}=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]),n[6]!==i?(l={id:i},n[6]=i,n[7]=l):l=n[7];const{attributes:c,listeners:d,setNodeRef:h,transform:f,transition:m,isDragging:_,isOver:g}=T1(l);let p;n[8]!==f?(p=f?Rc.Transform.toString({x:f.x,y:0,scaleX:1,scaleY:1}):void 0,n[8]=f,n[9]=p):p=n[9];const b=_?2:void 0;let y;n[10]!==p||n[11]!==b||n[12]!==m?(y={transform:p,transition:m,zIndex:b,position:"relative","--gutter-width":"50px"},n[10]=p,n[11]=b,n[12]=m,n[13]=y):y=n[13];const x=y,{deleteColumn:v,moveColumn:S,addColumn:k}=Ot();let E;n[14]===Symbol.for("react.memo_cache_sentinel")?(E=Ie("h-full hover:bg-muted rounded-none"),n[14]=E):E=n[14];const N=E,I=GM;let T;n[15]!==i||n[16]!==S?(T=()=>S({column:i,overColumn:"_left_"}),n[15]=i,n[16]=S,n[17]=T):T=n[17];const M=!r;let R,z,D;n[18]===Symbol.for("react.memo_cache_sentinel")?(R=u.jsx(r4,{className:"size-4"}),n[18]=R):R=n[18],n[19]!==T||n[20]!==M?(z=u.jsx(Te,{content:"Move column left",side:"top",delayDuration:300,children:u.jsx(Me,{variant:"text",size:"sm",className:N,onClick:T,disabled:M,children:R})}),n[19]=T,n[20]=M,n[21]=z):z=n[21],n[22]!==i||n[23]!==S?(D=()=>S({column:i,overColumn:"_right_"}),n[22]=i,n[23]=S,n[24]=D):D=n[24];const F=!s;let B,V,O,C,$,j,W,K;n[25]===Symbol.for("react.memo_cache_sentinel")?(B=u.jsx(ia,{className:"size-4"}),n[25]=B):B=n[25],n[26]!==D||n[27]!==F?(V=u.jsx(Te,{content:"Move column right",side:"top",delayDuration:300,children:u.jsx(Me,{variant:"text",size:"sm",className:N,onClick:D,disabled:F,children:B})}),n[26]=D,n[27]=F,n[28]=V):V=n[28],n[29]!==c||n[30]!==d?(O=u.jsx("div",{className:"flex gap-2 h-full flex-grow active:bg-accent cursor-grab",...c,...d,"data-testid":"column-drag-button"}),n[29]=c,n[30]=d,n[31]=O):O=n[31],n[32]!==o||n[33]!==i||n[34]!==v?(C=o&&u.jsx(Te,{content:"Delete column",side:"top",delayDuration:300,children:u.jsx(Me,{variant:"text",size:"sm",className:"opacity-0 group-hover:opacity-70 group-hover:hover:opacity-100 text-destructive h-full hover:bg-destructive/20 rounded-none",onClick:()=>v({columnId:i}),children:u.jsx(oo,{className:"size-4"})})}),n[32]=o,n[33]=i,n[34]=v,n[35]=C):C=n[35],n[36]!==k||n[37]!==i?($=()=>{k({columnId:i}),requestAnimationFrame(I)},n[36]=k,n[37]=i,n[38]=$):$=n[38],n[39]===Symbol.for("react.memo_cache_sentinel")?(j=u.jsx(pr,{className:"size-4"}),n[39]=j):j=n[39],n[40]!==$?(W=u.jsx(Te,{content:"Add column",side:"top",delayDuration:300,children:u.jsx(Me,{variant:"text",size:"sm",className:N,onClick:$,children:j})}),n[40]=$,n[41]=W):W=n[41],n[42]!==V||n[43]!==O||n[44]!==C||n[45]!==W||n[46]!==z?(K=u.jsxs("div",{className:"h-6 group flex items-center rounded-t-lg border hover:border-border border-[var(--slate-3)] overflow-hidden bg-[var(--slate-1)]",children:[z,V,O,C,W]}),n[42]=V,n[43]=O,n[44]=C,n[45]=W,n[46]=z,n[47]=K):K=n[47];const Z=K;let q;n[48]!==e||n[49]!==h?(q=ce=>{Nl(e,h)(ce)},n[48]=e,n[49]=h,n[50]=q):q=n[50];const ne=_?"":a.className,re=_?"z-20":"z-1 hover:z-10 focus-within:z-10",ae=g&&"bg-accent/20";let X,ee;return n[51]!==ne||n[52]!==re||n[53]!==ae?(X=Ie(ne,re,ae),n[51]=ne,n[52]=re,n[53]=ae,n[54]=X):X=n[54],n[55]!==Z||n[56]!==_||n[57]!==a||n[58]!==x||n[59]!==q||n[60]!==X?(ee=u.jsxs("div",{tabIndex:-1,ref:q,...a,style:x,"data-is-dragging":_,className:X,children:[Z,a.children]}),n[55]=Z,n[56]=_,n[57]=a,n[58]=x,n[59]=q,n[60]=X,n[61]=ee):ee=n[61],ee});Wx.displayName="SortableColumn";const qM=A.memo(Wx);function GM(){const t=document.getElementById("App");t&&t.scrollTo({left:t.scrollLeft+1e3,behavior:"smooth"})}const{getColumnWidth:YM,saveColumnWidth:JM}=xV,qx=A.memo(t=>{const e=J.c(14),n=A.useRef(null);let o;e[0]!==t.children||e[1]!==t.index||e[2]!==t.width?(o=t.width==="columns"?u.jsx(KM,{startingWidth:YM(t.index),onResize:i=>{JM(t.index,i)},children:t.children}):u.jsx("div",{className:"flex flex-col gap-5",children:t.children}),e[0]=t.children,e[1]=t.index,e[2]=t.width,e[3]=o):o=e[3];const r=o;if(t.width==="columns"){let i;return e[4]!==r||e[5]!==t.canDelete||e[6]!==t.canMoveLeft||e[7]!==t.canMoveRight||e[8]!==t.columnId||e[9]!==t.footer?(i=u.jsxs(qM,{tabIndex:-1,ref:n,canDelete:t.canDelete,columnId:t.columnId,canMoveLeft:t.canMoveLeft,canMoveRight:t.canMoveRight,className:"group/column",children:[r,t.footer]}),e[4]=r,e[5]=t.canDelete,e[6]=t.canMoveLeft,e[7]=t.canMoveRight,e[8]=t.columnId,e[9]=t.footer,e[10]=i):i=e[10],i}let s;return e[11]!==r||e[12]!==t.footer?(s=u.jsxs(u.Fragment,{children:[r,t.footer]}),e[11]=r,e[12]=t.footer,e[13]=s):s=e[13],s});qx.displayName="Column";const KM=t=>{const e=J.c(15),{startingWidth:n,onResize:o,children:r}=t;let s;e[0]!==o||e[1]!==n?(s={startingWidth:n,onResize:o},e[0]=o,e[1]=n,e[2]=s):s=e[2];const{resizableDivRef:i,handleRefs:a,style:l}=wV(s),c=XM;let d,h,f,m;return e[3]!==a.left?(d=c(a.left),e[3]=a.left,e[4]=d):d=e[4],e[5]!==r||e[6]!==i||e[7]!==l?(h=u.jsx("div",{ref:i,className:"flex flex-col gap-5 box-content min-h-[100px] px-11 py-6 min-w-[500px] z-1",style:l,children:r}),e[5]=r,e[6]=i,e[7]=l,e[8]=h):h=e[8],e[9]!==a.right?(f=c(a.right),e[9]=a.right,e[10]=f):f=e[10],e[11]!==d||e[12]!==h||e[13]!==f?(m=u.jsxs("div",{className:"flex flex-row",children:[d,h,f]}),e[11]=d,e[12]=h,e[13]=f,e[14]=m):m=e[14],m};function XM(t){return u.jsx("div",{ref:t,className:`w-[3px] cursor-col-resize transition-colors duration-200 z-[100]
121
121
  relative before:content-[''] before:absolute before:inset-y-0 before:-left-[3px]
122
122
  before:right-[-3px] before:w-[9px] before:z-[-1]
123
123
  hover/column:bg-[var(--slate-3)] dark:hover/column:bg-[var(--slate-5)]
@@ -141,4 +141,4 @@ ${T}
141
141
  `)}),includeOtherCode:Lc("")}),onFinish:T=>{e(M=>Ll(M,M.activeChatId,"assistant",T.content,T.parts))},onToolCall:async({toolCall:T})=>{try{const M=await YV({toolName:T.toolName,arguments:T.args});return M.result||M.error}catch(M){return Dt.error("Tool call failed:",M),`Error: ${M instanceof Error?M.message:String(M)}`}},onError:T=>{Dt.error("An error occurred:",T)},onResponse:T=>{Dt.debug("Received HTTP response from server:",T)}}),k=x==="submitted"||x==="streaming",E=k&&f.length>0&&(T=>{if(T.length===0)return!1;const M=T.at(-1);if(!M||M.role!=="assistant"||!M.parts)return!1;const R=M.parts;return R.length===0?!1:R[R.length-1].type==="reasoning"})(f);A.useEffect(()=>{requestAnimationFrame(()=>{if(l.current){const T=l.current;T.scrollTop=T.scrollHeight}})},[t.activeChatId]);const N=(T,M)=>{g(R=>R.slice(0,T)),t.activeChatId&&e(R=>({...R,chats:R.chats.map(z=>z.id===t.activeChatId?{...z,messages:z.messages.slice(0,T),updatedAt:Date.now()}:z)})),p({role:"user",content:M}),t.activeChatId&&e(R=>Ll(R,t.activeChatId,"user",M))},I=()=>{r.trim()&&(T=>{const M={id:JV(),title:T.length>50?`${T.slice(0,50)}...`:T,messages:[],createdAt:Date.now(),updatedAt:Date.now()};e(R=>({chats:[...R.chats,M],activeChatId:M.id})),_(""),p({role:"user",content:T})})(r.trim())};return u.jsxs("div",{className:"flex flex-col h-[calc(100%-53px)]",children:[u.jsx(Km,{children:u.jsx(tR,{onNewChat:()=>{o(null),_(""),s("")},activeChatId:n==null?void 0:n.id,setActiveChat:o,chats:[...t.chats].sort((T,M)=>M.updatedAt-T.updatedAt)})}),u.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)&&u.jsxs("div",{className:"flex flex-col rounded-md border bg-background",children:[u.jsx("div",{className:"px-1",children:u.jsx(Hc,{value:r,placeholder:"Ask anything, @ to include context about tables or dataframes",theme:d,onClose:()=>{var T,M;return(M=(T=i.current)==null?void 0:T.editor)==null?void 0:M.blur()},onChange:s,onSubmit:I},"new-thread-input")}),u.jsx(Bh,{input:r,onSendClick:I,isLoading:k,onStop:S})]}),f.map((T,M)=>u.jsx(Ev,{message:T,index:M,theme:d,onEdit:N,setChatState:e,chatState:t,isStreamingReasoning:E,totalMessages:f.length},M)),k&&u.jsx("div",{className:"flex justify-center py-4",children:u.jsx(Ym,{className:"h-4 w-4 animate-spin"})}),y&&u.jsxs("div",{className:"flex items-center justify-center space-x-2 mb-4",children:[u.jsx(Vr,{error:y}),u.jsx(Me,{variant:"outline",size:"sm",onClick:()=>{v()},children:"Retry"})]}),u.jsx("div",{ref:c})]}),k&&u.jsx("div",{className:"w-full flex justify-center items-center z-20 border-t",children:u.jsx(Me,{variant:"linkDestructive",size:"sm",onClick:S,children:"Stop"})}),f&&f.length>0&&u.jsx(Iv,{input:m,setInput:_,onSubmit:(T,M)=>{M.trim()&&(b(T),t.activeChatId&&e(R=>Ll(R,t.activeChatId,"user",M)))},theme:d,inputRef:a,isLoading:k,onStop:S})]})};function rR(){}function sR(){}function iR(t){return u.jsx(la,{value:t,className:"text-sm",children:t},t)}function hn(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=hn(t[o]))!==""&&(e+=(e&&" ")+n);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}const{useDebugValue:aR}=Y,{useSyncExternalStoreWithSelector:lR}=ZV,cR=t=>t;function Av(t,e=cR,n){const o=lR(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return aR(o),o}const Tv=(t,e)=>{const n=QV(t),o=(r,s=e)=>Av(n,r,s);return Object.assign(o,n),o};function on(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 mo(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 dR={passive:!1},qi={capture:!0,passive:!1};function Uh(t){t.stopImmediatePropagation()}function _s(t){t.preventDefault(),t.stopImmediatePropagation()}function Mv(t){var e=t.document.documentElement,n=ro(t).on("dragstart.drag",_s,qi);"onselectstart"in e?n.on("selectstart.drag",_s,qi):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Ov(t,e){var n=t.document.documentElement,o=ro(t).on("dragstart.drag",null);e&&(o.on("click.drag",_s,qi),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 ql=t=>()=>t;function Vh(t,{sourceEvent:e,subject:n,target:o,identifier:r,active:s,x:i,y:a,dx:l,dy:c,dispatch:d}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:d}})}function uR(t){return!t.ctrlKey&&!t.button}function hR(){return this.parentNode}function fR(t,e){return e??{x:t.x,y:t.y}}function mR(){return navigator.maxTouchPoints||"ontouchstart"in this}Vh.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};const Gl=t=>()=>t;function pR(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 $h(t){t.stopImmediatePropagation()}function Gi(t){t.preventDefault(),t.stopImmediatePropagation()}function gR(t){return!(t.ctrlKey&&t.type!=="wheel"||t.button)}function _R(){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 Dv(){return this.__zoom||yr}function bR(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function yR(){return navigator.maxTouchPoints||"ontouchstart"in this}function xR(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 Yl=A.createContext(null),wR=Yl.Provider,vR=t=>`Node type "${t}" not found. Using fallback type "default".`,kR=()=>"The React Flow parent container needs a width and a height to render the graph.",SR=()=>"Only child nodes can use a parent extent.",CR=t=>`Marker type "${t}" doesn't exist.`,NR=(t,e)=>`Couldn't create edge for ${t?"target":"source"} handle id: "${t?e.targetHandle:e.sourceHandle}", edge id: ${e.id}.`,jR=()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",ER=t=>`Edge type "${t}" not found. Using fallback type "default".`,IR=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.`,Rv="[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=A.useContext(Yl);if(n===null)throw new Error(Rv);return Av(n,t,e)}const qt=()=>{const t=A.useContext(Yl);if(t===null)throw new Error(Rv);return A.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe,destroy:t.destroy}),[t])},AR=t=>t.userSelectionActive?"none":"all";function Jl({position:t,children:e,className:n,style:o,...r}){const s=mt(AR),i=`${t}`.split("-");return Y.createElement("div",{className:hn(["react-flow__panel",n,...i]),style:{...o,pointerEvents:s},...r},e)}function TR({proOptions:t,position:e="bottom-right"}){return t!=null&&t.hideAttribution?null:Y.createElement(Jl,{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"},Y.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}var MR=A.memo(({x:t,y:e,label:n,labelStyle:o={},labelShowBg:r=!0,labelBgStyle:s={},labelBgPadding:i=[2,4],labelBgBorderRadius:a=2,children:l,className:c,...d})=>{const h=A.useRef(null),[f,m]=A.useState({x:0,y:0,width:0,height:0}),_=hn(["react-flow__edge-textwrapper",c]);return A.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?Y.createElement("g",{transform:`translate(${t-f.width/2} ${e-f.height/2})`,className:_,visibility:f.width?"visible":"hidden",...d},r&&Y.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}),Y.createElement("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:h,style:o},n),l):null});const Hh=t=>({width:t.offsetWidth,height:t.offsetHeight}),bs=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),Wh=(t={x:0,y:0},e)=>({x:bs(t.x,e[0][0],e[1][0]),y:bs(t.y,e[0][1],e[1][1])}),Pv=(t,e,n)=>t<e?bs(Math.abs(t-e),1,50)/50:t>n?-bs(Math.abs(t-n),1,50)/50:0,Lv=(t,e)=>[20*Pv(t.x,35,e.width-35),20*Pv(t.y,35,e.height-35)],Fv=t=>{var e;return((e=t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},qh=({x:t,y:e,width:n,height:o})=>({x:t,y:e,x2:t+n,y2:e+o}),zv=t=>({...t.positionAbsolute||{x:0,y:0},width:t.width||0,height:t.height||0}),Gh=(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)},Vn=t=>!isNaN(t)&&isFinite(t),Nt=Symbol.for("internals"),Bv=["Enter"," ","Escape"];function Yh(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 Uv=t=>"clientX"in t,er=(t,e)=>{var s,i;const n=Uv(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)}},Kl=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0},Yi=({id:t,path:e,labelX:n,labelY:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:h,markerStart:f,interactionWidth:m=20})=>Y.createElement(Y.Fragment,null,Y.createElement("path",{id:t,style:d,d:e,fill:"none",className:"react-flow__edge-path",markerEnd:h,markerStart:f}),m&&Y.createElement("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:m,className:"react-flow__edge-interaction"}),r&&Vn(n)&&Vn(o)?Y.createElement(MR,{x:n,y:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null);function Ji(t,e,n){return n===void 0?n:o=>{const r=e().edges.find(s=>s.id===t);r&&n(o,{...r})}}function Vv({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 $v({sourceX:t,sourceY:e,targetX:n,targetY:o,sourceControlX:r,sourceControlY:s,targetControlX:i,targetControlY:a}){const l=.125*t+.375*r+.375*i+.125*n,c=.125*e+.375*s+.375*a+.125*o;return[l,c,Math.abs(l-t),Math.abs(c-e)]}var Or,Hv,tr,Jh,Ki,Wv,nr,Xi,ys,qv,Ue,Xl;function Gv({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 Yv({sourceX:t,sourceY:e,sourcePosition:n=Ue.Bottom,targetX:o,targetY:r,targetPosition:s=Ue.Top}){const[i,a]=Gv({pos:n,x1:t,y1:e,x2:o,y2:r}),[l,c]=Gv({pos:s,x1:o,y1:r,x2:t,y2:e}),[d,h,f,m]=$v({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:l,targetControlY:c});return[`M${t},${e} C${i},${a} ${l},${c} ${o},${r}`,d,h,f,m]}Yi.displayName="BaseEdge",(Hv=Or||(Or={})).Strict="strict",Hv.Loose="loose",(Jh=tr||(tr={})).Free="free",Jh.Vertical="vertical",Jh.Horizontal="horizontal",(Wv=Ki||(Ki={})).Partial="partial",Wv.Full="full",(Xi=nr||(nr={})).Bezier="default",Xi.Straight="straight",Xi.Step="step",Xi.SmoothStep="smoothstep",Xi.SimpleBezier="simplebezier",(qv=ys||(ys={})).Arrow="arrow",qv.ArrowClosed="arrowclosed",(Xl=Ue||(Ue={})).Left="left",Xl.Top="top",Xl.Right="right",Xl.Bottom="bottom";const Kh=A.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,sourcePosition:r=Ue.Bottom,targetPosition:s=Ue.Top,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:_,interactionWidth:g})=>{const[p,b,y]=Yv({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:o,targetPosition:s});return Y.createElement(Yi,{path:p,labelX:b,labelY:y,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:_,interactionWidth:g})});Kh.displayName="SimpleBezierEdge";const Jv={[Ue.Left]:{x:-1,y:0},[Ue.Right]:{x:1,y:0},[Ue.Top]:{x:0,y:-1},[Ue.Bottom]:{x:0,y:1}},Kv=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function OR({source:t,sourcePosition:e=Ue.Bottom,target:n,targetPosition:o=Ue.Top,center:r,offset:s}){const i=Jv[e],a=Jv[o],l={x:t.x+i.x*s,y:t.y+i.y*s},c={x:n.x+a.x*s,y:n.y+a.y*s},d=(({source:k,sourcePosition:E=Ue.Bottom,target:N})=>E===Ue.Left||E===Ue.Right?k.x<N.x?{x:1,y:0}:{x:-1,y:0}:k.y<N.y?{x:0,y:1}:{x:0,y:-1})({source:l,sourcePosition:e,target:c}),h=d.x!==0?"x":"y",f=d[h];let m,_,g=[];const p={x:0,y:0},b={x:0,y:0},[y,x,v,S]=Vv({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(i[h]*a[h]===-1){m=r.x??y,_=r.y??x;const k=[{x:m,y:l.y},{x:m,y:c.y}],E=[{x:l.x,y:_},{x:c.x,y:_}];g=i[h]===f?h==="x"?k:E:h==="x"?E:k}else{const k=[{x:l.x,y:c.y}],E=[{x:c.x,y:l.y}];if(g=h==="x"?i.x===f?E:k:i.y===f?k:E,e===o){const T=Math.abs(t[h]-n[h]);if(T<=s){const M=Math.min(s-1,s-T);i[h]===f?p[h]=(l[h]>t[h]?-1:1)*M:b[h]=(c[h]>n[h]?-1:1)*M}}if(e!==o){const T=h==="x"?"y":"x",M=i[h]===a[T],R=l[T]>c[T],z=l[T]<c[T];(i[h]===1&&(!M&&R||M&&z)||i[h]!==1&&(!M&&z||M&&R))&&(g=h==="x"?k:E)}const N={x:l.x+p.x,y:l.y+p.y},I={x:c.x+b.x,y:c.y+b.y};Math.max(Math.abs(N.x-g[0].x),Math.abs(I.x-g[0].x))>=Math.max(Math.abs(N.y-g[0].y),Math.abs(I.y-g[0].y))?(m=(N.x+I.x)/2,_=g[0].y):(m=g[0].x,_=(N.y+I.y)/2)}return[[t,{x:l.x+p.x,y:l.y+p.y},...g,{x:c.x+b.x,y:c.y+b.y},n],m,_,v,S]}function Xh({sourceX:t,sourceY:e,sourcePosition:n=Ue.Bottom,targetX:o,targetY:r,targetPosition:s=Ue.Top,borderRadius:i=5,centerX:a,centerY:l,offset:c=20}){const[d,h,f,m,_]=OR({source:{x:t,y:e},sourcePosition:n,target:{x:o,y:r},targetPosition:s,center:{x:a,y:l},offset:c});return[d.reduce((g,p,b)=>{let y="";return y=b>0&&b<d.length-1?function(x,v,S,k){const E=Math.min(Kv(x,v)/2,Kv(v,S)/2,k),{x:N,y:I}=v;if(x.x===N&&N===S.x||x.y===I&&I===S.y)return`L${N} ${I}`;if(x.y===I)return`L ${N+E*(x.x<S.x?-1:1)},${I}Q ${N},${I} ${N},${I+E*(x.y<S.y?1:-1)}`;const T=x.x<S.x?1:-1;return`L ${N},${I+E*(x.y<S.y?-1:1)}Q ${N},${I} ${N+E*T},${I}`}(d[b-1],p,d[b+1],i):`${b===0?"M":"L"}${p.x} ${p.y}`,g+=y},""),h,f,m,_]}const Zl=A.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,sourcePosition:h=Ue.Bottom,targetPosition:f=Ue.Top,markerEnd:m,markerStart:_,pathOptions:g,interactionWidth:p})=>{const[b,y,x]=Xh({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 Y.createElement(Yi,{path:b,labelX:y,labelY:x,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:m,markerStart:_,interactionWidth:p})});Zl.displayName="SmoothStepEdge";const Zh=A.memo(t=>{var e;return Y.createElement(Zl,{...t,pathOptions:A.useMemo(()=>{var n;return{borderRadius:0,offset:(n=t.pathOptions)==null?void 0:n.offset}},[(e=t.pathOptions)==null?void 0:e.offset])})});Zh.displayName="StepEdge";const Qh=A.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:h,markerStart:f,interactionWidth:m})=>{const[_,g,p]=function({sourceX:b,sourceY:y,targetX:x,targetY:v}){const[S,k,E,N]=Vv({sourceX:b,sourceY:y,targetX:x,targetY:v});return[`M ${b},${y}L ${x},${v}`,S,k,E,N]}({sourceX:t,sourceY:e,targetX:n,targetY:o});return Y.createElement(Yi,{path:_,labelX:g,labelY:p,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:h,markerStart:f,interactionWidth:m})});function Ql(t,e){return t>=0?.5*t:25*e*Math.sqrt(-t)}function Xv({pos:t,x1:e,y1:n,x2:o,y2:r,c:s}){switch(t){case Ue.Left:return[e-Ql(e-o,s),n];case Ue.Right:return[e+Ql(o-e,s),n];case Ue.Top:return[e,n-Ql(n-r,s)];case Ue.Bottom:return[e,n+Ql(r-n,s)]}}function Zv({sourceX:t,sourceY:e,sourcePosition:n=Ue.Bottom,targetX:o,targetY:r,targetPosition:s=Ue.Top,curvature:i=.25}){const[a,l]=Xv({pos:n,x1:t,y1:e,x2:o,y2:r,c:i}),[c,d]=Xv({pos:s,x1:o,y1:r,x2:t,y2:e,c:i}),[h,f,m,_]=$v({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:d});return[`M${t},${e} C${a},${l} ${c},${d} ${o},${r}`,h,f,m,_]}Qh.displayName="StraightEdge";const ec=A.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,sourcePosition:r=Ue.Bottom,targetPosition:s=Ue.Top,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:_,pathOptions:g,interactionWidth:p})=>{const[b,y,x]=Zv({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:o,targetPosition:s,curvature:g==null?void 0:g.curvature});return Y.createElement(Yi,{path:b,labelX:y,labelY:x,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:_,interactionWidth:p})});ec.displayName="BezierEdge";const ef=A.createContext(null),DR=ef.Provider;ef.Consumer;const RR=({source:t,sourceHandle:e,target:n,targetHandle:o})=>`reactflow__edge-${t}${e||""}-${n}${o||""}`,tf=(t,e)=>t===void 0?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(n=>`${n}=${t[n]}`).join("&")}`,nf=({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},Qv=({x:t,y:e},[n,o,r])=>({x:t*r+n,y:e*r+o}),xs=(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}},of=(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}=xs(r,e).positionAbsolute;return a=o,l=qh({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)},e2=(t,e,[n,o,r]=[0,0,1],s=!1,i=!1,a=[0,0])=>{const l={x:(e.x-n)/r,y:(e.y-o)/r,width:e.width/r,height:e.height/r},c=[];return t.forEach(d=>{const{width:h,height:f,selectable:m=!0,hidden:_=!1}=d;if(i&&!m||_)return!1;const{positionAbsolute:g}=xs(d,a),p={x:g.x,y:g.y,width:h||0,height:f||0},b=Gh(l,p);(h===void 0||f===void 0||h===null||f===null||s&&b>0||b>=(h||0)*(f||0)||d.dragging)&&c.push(d)}),c},t2=(t,e)=>{const n=t.map(o=>o.id);return e.filter(o=>n.includes(o.source)||n.includes(o.target))},n2=(t,e,n,o,r,s=.1)=>{const i=e/(t.width*(1+s)),a=n/(t.height*(1+s)),l=Math.min(i,a),c=bs(l,o,r);return{x:e/2-(t.x+t.width/2)*c,y:n/2-(t.y+t.height/2)*c,zoom:c}},Dr=(t,e=0)=>t.transition().duration(e);function o2(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 PR={source:null,target:null,sourceHandle:null,targetHandle:null},r2=()=>({handleDomNode:null,isValid:!1,connection:PR,endHandle:null});function s2(t,e,n,o,r,s,i){const a=r==="target",l=i.querySelector(`.react-flow__handle[data-id="${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`),c={...r2(),handleDomNode:l};if(l){const d=rf(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};c.connection=g,m&&_&&(e===Or.Strict?a&&d==="source"||!a&&d==="target":h!==n||f!==o)&&(c.endHandle={nodeId:h,handleId:f,type:d},c.isValid=s(g))}return c}function rf(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function sf(t){t==null||t.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function LR(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function i2({event:t,handleId:e,nodeId:n,onConnect:o,isTarget:r,getState:s,setState:i,isValidConnection:a,edgeUpdaterType:l,onReconnectEnd:c}){const d=Fv(t.target),{connectionMode:h,domNode:f,autoPanOnConnect:m,connectionRadius:_,onConnectStart:g,panBy:p,getNodes:b,cancelConnection:y}=s();let x,v=0;const{x:S,y:k}=er(t),E=d==null?void 0:d.elementFromPoint(S,k),N=rf(l,E),I=f==null?void 0:f.getBoundingClientRect();if(!I||!N)return;let T,M=er(t,I),R=!1,z=null,D=!1,F=null;const B=function({nodes:$,nodeId:j,handleId:W,handleType:K}){return $.reduce((Z,q)=>{if(q[Nt]){const{handleBounds:ne}=q[Nt];let re=[],ae=[];ne&&(re=o2(q,ne,"source",`${j}-${W}-${K}`),ae=o2(q,ne,"target",`${j}-${W}-${K}`)),Z.push(...re,...ae)}return Z},[])}({nodes:b(),nodeId:n,handleId:e,handleType:N}),V=()=>{if(!m)return;const[$,j]=Lv(M,I);p({x:$,y:j}),v=requestAnimationFrame(V)};function O($){const{transform:j}=s();M=er($,I);const{handle:W,validHandleResult:K}=function(Z,q,ne,re,ae,X){const{x:ee,y:ce}=er(Z),me=q.elementsFromPoint(ee,ce).find(je=>je.classList.contains("react-flow__handle"));if(me){const je=me.getAttribute("data-nodeid");if(je){const se=rf(void 0,me),Ae=me.getAttribute("data-handleid"),be=X({nodeId:je,id:Ae,type:se});if(be){const Re=ae.find(ze=>ze.nodeId===je&&ze.type===se&&ze.id===Ae);return{handle:{id:Ae,type:se,nodeId:je,x:(Re==null?void 0:Re.x)||ne.x,y:(Re==null?void 0:Re.y)||ne.y},validHandleResult:be}}}}let ue=[],pe=1/0;if(ae.forEach(je=>{const se=Math.sqrt((je.x-ne.x)**2+(je.y-ne.y)**2);if(se<=re){const Ae=X(je);se<=pe&&(se<pe?ue=[{handle:je,validHandleResult:Ae}]:se===pe&&ue.push({handle:je,validHandleResult:Ae}),pe=se)}}),!ue.length)return{handle:null,validHandleResult:r2()};if(ue.length===1)return ue[0];const de=ue.some(({validHandleResult:je})=>je.isValid),Ne=ue.some(({handle:je})=>je.type==="target");return ue.find(({handle:je,validHandleResult:se})=>Ne?je.type==="target":!de||se.isValid)||ue[0]}($,d,nf(M,j,!1,[1,1]),_,B,Z=>s2(Z,h,n,e,r?"target":"source",a,d));if(x=W,R||(V(),R=!0),F=K.handleDomNode,z=K.connection,D=K.isValid,i({connectionPosition:x&&D?Qv({x:x.x,y:x.y},j):M,connectionStatus:LR(!!x,D),connectionEndHandle:K.endHandle}),!x&&!D&&!F)return sf(T);z.source!==z.target&&F&&(sf(T),T=F,F.classList.add("connecting","react-flow__handle-connecting"),F.classList.toggle("valid",D),F.classList.toggle("react-flow__handle-valid",D))}function C($){var j,W;(x||F)&&z&&D&&(o==null||o(z)),(W=(j=s()).onConnectEnd)==null||W.call(j,$),l&&(c==null||c($)),sf(T),y(),cancelAnimationFrame(v),R=!1,D=!1,z=null,F=null,d.removeEventListener("mousemove",O),d.removeEventListener("mouseup",C),d.removeEventListener("touchmove",O),d.removeEventListener("touchend",C)}i({connectionPosition:M,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}),d.addEventListener("mousemove",O),d.addEventListener("mouseup",C),d.addEventListener("touchmove",O),d.addEventListener("touchend",C)}const a2=()=>!0,FR=t=>({connectionStartHandle:t.connectionStartHandle,connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName}),l2=A.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:c,onMouseDown:d,onTouchStart:h,...f},m)=>{var N,I;const _=i||null,g=t==="target",p=qt(),b=A.useContext(ef),{connectOnClick:y,noPanClassName:x}=mt(FR,on),{connecting:v,clickConnecting:S}=mt(((T,M,R)=>z=>{const{connectionStartHandle:D,connectionEndHandle:F,connectionClickStartHandle:B}=z;return{connecting:(D==null?void 0:D.nodeId)===T&&(D==null?void 0:D.handleId)===M&&(D==null?void 0:D.type)===R||(F==null?void 0:F.nodeId)===T&&(F==null?void 0:F.handleId)===M&&(F==null?void 0:F.type)===R,clickConnecting:(B==null?void 0:B.nodeId)===T&&(B==null?void 0:B.handleId)===M&&(B==null?void 0:B.type)===R}})(b,_,t),on);b||((I=(N=p.getState()).onError)==null||I.call(N,"010",jR()));const k=T=>{const{defaultEdgeOptions:M,onConnect:R,hasDefaultEdges:z}=p.getState(),D={...M,...T};if(z){const{edges:F,setEdges:B}=p.getState();B(((V,O)=>{if(!V.source||!V.target)return O;let C;return C=($=>"id"in $&&"source"in $&&"target"in $)(V)?{...V}:{...V,id:RR(V)},(($,j)=>j.some(W=>!(W.source!==$.source||W.target!==$.target||W.sourceHandle!==$.sourceHandle&&(W.sourceHandle||$.sourceHandle)||W.targetHandle!==$.targetHandle&&(W.targetHandle||$.targetHandle))))(C,O)?O:O.concat(C)})(D,F))}R==null||R(D),a==null||a(D)},E=T=>{if(!b)return;const M=Uv(T);r&&(M&&T.button===0||!M)&&i2({event:T,handleId:_,nodeId:b,onConnect:k,isTarget:g,getState:p.getState,setState:p.setState,isValidConnection:n||p.getState().isValidConnection||a2}),M?d==null||d(T):h==null||h(T)};return Y.createElement("div",{"data-handleid":_,"data-nodeid":b,"data-handlepos":e,"data-id":`${b}-${_}-${t}`,className:hn(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",x,c,{source:!g,target:g,connectable:o,connectablestart:r,connectableend:s,connecting:S,connectionindicator:o&&(r&&!v||s&&v)}]),onMouseDown:E,onTouchStart:E,onClick:y?T=>{const{onClickConnectStart:M,onClickConnectEnd:R,connectionClickStartHandle:z,connectionMode:D,isValidConnection:F}=p.getState();if(!b||!z&&!r)return;if(!z)return M==null||M(T,{nodeId:b,handleId:_,handleType:t}),void p.setState({connectionClickStartHandle:{nodeId:b,type:t,handleId:_}});const B=Fv(T.target),V=n||F||a2,{connection:O,isValid:C}=s2({nodeId:b,id:_,type:t},D,z.nodeId,z.handleId||null,z.type,V,B);C&&k(O),R==null||R(T),p.setState({connectionClickStartHandle:null})}:void 0,ref:m,...f},l)});l2.displayName="Handle";var or=A.memo(l2);const c2=({data:t,isConnectable:e,targetPosition:n=Ue.Top,sourcePosition:o=Ue.Bottom})=>Y.createElement(Y.Fragment,null,Y.createElement(or,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label,Y.createElement(or,{type:"source",position:o,isConnectable:e}));c2.displayName="DefaultNode";var af=A.memo(c2);const d2=({data:t,isConnectable:e,sourcePosition:n=Ue.Bottom})=>Y.createElement(Y.Fragment,null,t==null?void 0:t.label,Y.createElement(or,{type:"source",position:n,isConnectable:e}));d2.displayName="InputNode";var u2=A.memo(d2);const h2=({data:t,isConnectable:e,targetPosition:n=Ue.Top})=>Y.createElement(Y.Fragment,null,Y.createElement(or,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label);h2.displayName="OutputNode";var f2=A.memo(h2);const lf=()=>null;lf.displayName="GroupNode";const zR=t=>({selectedNodes:t.getNodes().filter(e=>e.selected),selectedEdges:t.edges.filter(e=>e.selected).map(e=>({...e}))}),tc=t=>t.id;function BR(t,e){return on(t.selectedNodes.map(tc),e.selectedNodes.map(tc))&&on(t.selectedEdges.map(tc),e.selectedEdges.map(tc))}const m2=A.memo(({onSelectionChange:t})=>{const e=qt(),{selectedNodes:n,selectedEdges:o}=mt(zR,BR);return A.useEffect(()=>{const r={nodes:n,edges:o};t==null||t(r),e.getState().onSelectionChange.forEach(s=>s(r))},[n,o,t]),null});m2.displayName="SelectionListener";const UR=t=>!!t.onSelectionChange;function VR({onSelectionChange:t}){const e=mt(UR);return t||e?Y.createElement(m2,{onSelectionChange:t}):null}const $R=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 ws(t,e){A.useEffect(()=>{t!==void 0&&e(t)},[t])}function at(t,e,n){A.useEffect(()=>{e!==void 0&&n({[t]:e})},[e])}const HR=({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,onConnect:r,onConnectStart:s,onConnectEnd:i,onClickConnectStart:a,onClickConnectEnd:l,nodesDraggable:c,nodesConnectable:d,nodesFocusable:h,edgesFocusable:f,edgesUpdatable:m,elevateNodesOnSelect:_,minZoom:g,maxZoom:p,nodeExtent:b,onNodesChange:y,onEdgesChange:x,elementsSelectable:v,connectionMode:S,snapGrid:k,snapToGrid:E,translateExtent:N,connectOnClick:I,defaultEdgeOptions:T,fitView:M,fitViewOptions:R,onNodesDelete:z,onEdgesDelete:D,onNodeDrag:F,onNodeDragStart:B,onNodeDragStop:V,onSelectionDrag:O,onSelectionDragStart:C,onSelectionDragStop:$,noPanClassName:j,nodeOrigin:W,rfId:K,autoPanOnConnect:Z,autoPanOnNodeDrag:q,onError:ne,connectionRadius:re,isValidConnection:ae,nodeDragThreshold:X})=>{const{setNodes:ee,setEdges:ce,setDefaultNodesAndEdges:me,setMinZoom:ue,setMaxZoom:pe,setTranslateExtent:de,setNodeExtent:Ne,reset:je}=mt($R,on),se=qt();return A.useEffect(()=>{const Ae=o==null?void 0:o.map(be=>({...be,...T}));return me(n,Ae),()=>{je()}},[]),at("defaultEdgeOptions",T,se.setState),at("connectionMode",S,se.setState),at("onConnect",r,se.setState),at("onConnectStart",s,se.setState),at("onConnectEnd",i,se.setState),at("onClickConnectStart",a,se.setState),at("onClickConnectEnd",l,se.setState),at("nodesDraggable",c,se.setState),at("nodesConnectable",d,se.setState),at("nodesFocusable",h,se.setState),at("edgesFocusable",f,se.setState),at("edgesUpdatable",m,se.setState),at("elementsSelectable",v,se.setState),at("elevateNodesOnSelect",_,se.setState),at("snapToGrid",E,se.setState),at("snapGrid",k,se.setState),at("onNodesChange",y,se.setState),at("onEdgesChange",x,se.setState),at("connectOnClick",I,se.setState),at("fitViewOnInit",M,se.setState),at("fitViewOnInitOptions",R,se.setState),at("onNodesDelete",z,se.setState),at("onEdgesDelete",D,se.setState),at("onNodeDrag",F,se.setState),at("onNodeDragStart",B,se.setState),at("onNodeDragStop",V,se.setState),at("onSelectionDrag",O,se.setState),at("onSelectionDragStart",C,se.setState),at("onSelectionDragStop",$,se.setState),at("noPanClassName",j,se.setState),at("nodeOrigin",W,se.setState),at("rfId",K,se.setState),at("autoPanOnConnect",Z,se.setState),at("autoPanOnNodeDrag",q,se.setState),at("onError",ne,se.setState),at("connectionRadius",re,se.setState),at("isValidConnection",ae,se.setState),at("nodeDragThreshold",X,se.setState),ws(t,ee),ws(e,ce),ws(g,ue),ws(p,pe),ws(N,de),ws(b,Ne),null},p2={display:"none"},WR={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},g2="react-flow__node-desc",_2="react-flow__edge-desc",qR=t=>t.ariaLiveMessage;function GR({rfId:t}){const e=mt(qR);return Y.createElement("div",{id:`react-flow__aria-live-${t}`,"aria-live":"assertive","aria-atomic":"true",style:WR},e)}function YR({rfId:t,disableKeyboardA11y:e}){return Y.createElement(Y.Fragment,null,Y.createElement("div",{id:`${g2}-${t}`,style:p2},"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."," "),Y.createElement("div",{id:`${_2}-${t}`,style:p2},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!e&&Y.createElement(GR,{rfId:t}))}var Zi=(t=null,e={actInsideInputWithModifier:!0})=>{const[n,o]=A.useState(!1),r=A.useRef(!1),s=A.useRef(new Set([])),[i,a]=A.useMemo(()=>{if(t!==null){const l=(Array.isArray(t)?t:[t]).filter(d=>typeof d=="string").map(d=>d.split("+")),c=l.reduce((d,h)=>d.concat(...h),[]);return[l,c]}return[[],[]]},[t]);return A.useEffect(()=>{const l=typeof document<"u"?document:null,c=(e==null?void 0:e.target)||l;if(t!==null){const d=m=>{if(r.current=m.ctrlKey||m.metaKey||m.shiftKey,(!r.current||r.current&&!e.actInsideInputWithModifier)&&Yh(m))return!1;const _=y2(m.code,a);s.current.add(m[_]),b2(i,s.current,!1)&&(m.preventDefault(),o(!0))},h=m=>{if((!r.current||r.current&&!e.actInsideInputWithModifier)&&Yh(m))return!1;const _=y2(m.code,a);b2(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 c==null||c.addEventListener("keydown",d),c==null||c.addEventListener("keyup",h),window.addEventListener("blur",f),()=>{c==null||c.removeEventListener("keydown",d),c==null||c.removeEventListener("keyup",h),window.removeEventListener("blur",f)}}},[t,o]),n};function b2(t,e,n){return t.filter(o=>n||o.length===e.size).some(o=>o.every(r=>e.has(r)))}function y2(t,e){return e.includes(t)?"code":"key"}function x2(t,e,n,o){var a,l;const r=t.parentNode||t.parentId;if(!r)return n;const s=e.get(r),i=xs(s,o);return x2(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 w2(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}=x2(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 cf(t,e,n,o){const r=new Map,s={},i=o?1e3:0;return t.forEach(a=>{var m;const l=(Vn(a.zIndex)?a.zIndex:0)+(a.selected?i:0),c=e.get(a.id),d={...a,positionAbsolute:{x:a.position.x,y:a.position.y}},h=a.parentNode||a.parentId;h&&(s[h]=!0);const f=(c==null?void 0:c.type)&&(c==null?void 0:c.type)!==a.type;Object.defineProperty(d,Nt,{enumerable:!1,value:{handleBounds:f||(m=c==null?void 0:c[Nt])==null?void 0:m.handleBounds,z:l}}),r.set(a.id,d)}),w2(r,n,s),r}function v2(t,e={}){const{getNodes:n,width:o,height:r,minZoom:s,maxZoom:i,d3Zoom:a,d3Selection:l,fitViewOnInitDone:c,fitViewOnInit:d,nodeOrigin:h}=t(),f=e.initial&&!c&&d;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(y=>y.id===g.id):p}),_=m.every(g=>g.width&&g.height);if(m.length>0&&_){const g=of(m,h),{x:p,y:b,zoom:y}=n2(g,o,r,e.minZoom??s,e.maxZoom??i,e.padding??.1),x=yr.translate(p,b).scale(y);return typeof e.duration=="number"&&e.duration>0?a.transform(Dr(l,e.duration),x):a.transform(l,x),!0}}return!1}function JR(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 KR(t,e){return e.map(n=>{const o=t.find(r=>r.id===n.id);return o&&(n.selected=o.selected),n})}function nc({changedNodes:t,changedEdges:e,get:n,set:o}){const{nodeInternals:r,edges:s,onNodesChange:i,onEdgesChange:a,hasDefaultNodes:l,hasDefaultEdges:c}=n();t!=null&&t.length&&(l&&o({nodeInternals:JR(t,r)}),i==null||i(t)),e!=null&&e.length&&(c&&o({edges:KR(e,s)}),a==null||a(e))}const vs=()=>{},XR={zoomIn:vs,zoomOut:vs,zoomTo:vs,getZoom:()=>1,setViewport:vs,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:vs,fitBounds:vs,project:t=>t,screenToFlowPosition:t=>t,flowToScreenPosition:t=>t,viewportInitialized:!1},ZR=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection});function Qi(){const t=(()=>{const g=qt(),{d3Zoom:p,d3Selection:b}=mt(ZR,on);return A.useMemo(()=>b&&p?{zoomIn:x=>p.scaleBy(Dr(b,x==null?void 0:x.duration),1.2),zoomOut:x=>p.scaleBy(Dr(b,x==null?void 0:x.duration),1/1.2),zoomTo:(x,v)=>p.scaleTo(Dr(b,v==null?void 0:v.duration),x),getZoom:()=>g.getState().transform[2],setViewport:(x,v)=>{const[S,k,E]=g.getState().transform,N=yr.translate(x.x??S,x.y??k).scale(x.zoom??E);p.transform(Dr(b,v==null?void 0:v.duration),N)},getViewport:()=>{const[x,v,S]=g.getState().transform;return{x,y:v,zoom:S}},fitView:x=>v2(g.getState,x),setCenter:(x,v,S)=>{const{width:k,height:E,maxZoom:N}=g.getState(),I=(S==null?void 0:S.zoom)!==void 0?S.zoom:N,T=k/2-x*I,M=E/2-v*I,R=yr.translate(T,M).scale(I);p.transform(Dr(b,S==null?void 0:S.duration),R)},fitBounds:(x,v)=>{const{width:S,height:k,minZoom:E,maxZoom:N}=g.getState(),{x:I,y:T,zoom:M}=n2(x,S,k,E,N,(v==null?void 0:v.padding)??.1),R=yr.translate(I,T).scale(M);p.transform(Dr(b,v==null?void 0:v.duration),R)},project:x=>{const{transform:v,snapToGrid:S,snapGrid:k}=g.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),nf(x,v,S,k)},screenToFlowPosition:x=>{const{transform:v,snapToGrid:S,snapGrid:k,domNode:E}=g.getState();if(!E)return x;const{x:N,y:I}=E.getBoundingClientRect(),T={x:x.x-N,y:x.y-I};return nf(T,v,S,k)},flowToScreenPosition:x=>{const{transform:v,domNode:S}=g.getState();if(!S)return x;const{x:k,y:E}=S.getBoundingClientRect(),N=Qv(x,v);return{x:N.x+k,y:N.y+E}},viewportInitialized:!0}:XR,[p,b])})(),e=qt(),n=A.useCallback(()=>e.getState().getNodes().map(g=>({...g})),[]),o=A.useCallback(g=>e.getState().nodeInternals.get(g),[]),r=A.useCallback(()=>{const{edges:g=[]}=e.getState();return g.map(p=>({...p}))},[]),s=A.useCallback(g=>{const{edges:p=[]}=e.getState();return p.find(b=>b.id===g)},[]),i=A.useCallback(g=>{const{getNodes:p,setNodes:b,hasDefaultNodes:y,onNodesChange:x}=e.getState(),v=p(),S=typeof g=="function"?g(v):g;if(y)b(S);else if(x){const k=S.length===0?v.map(E=>({type:"remove",id:E.id})):S.map(E=>({item:E,type:"reset"}));x(k)}},[]),a=A.useCallback(g=>{const{edges:p=[],setEdges:b,hasDefaultEdges:y,onEdgesChange:x}=e.getState(),v=typeof g=="function"?g(p):g;y?b(v):x&&x(v.length===0?p.map(S=>({type:"remove",id:S.id})):v.map(S=>({item:S,type:"reset"})))},[]),l=A.useCallback(g=>{const p=Array.isArray(g)?g:[g],{getNodes:b,setNodes:y,hasDefaultNodes:x,onNodesChange:v}=e.getState();if(x)y([...b(),...p]);else if(v){const S=p.map(k=>({item:k,type:"add"}));v(S)}},[]),c=A.useCallback(g=>{const p=Array.isArray(g)?g:[g],{edges:b=[],setEdges:y,hasDefaultEdges:x,onEdgesChange:v}=e.getState();x?y([...b,...p]):v&&v(p.map(S=>({item:S,type:"add"})))},[]),d=A.useCallback(()=>{const{getNodes:g,edges:p=[],transform:b}=e.getState(),[y,x,v]=b;return{nodes:g().map(S=>({...S})),edges:p.map(S=>({...S})),viewport:{x:y,y:x,zoom:v}}},[]),h=A.useCallback(({nodes:g,edges:p})=>{const{nodeInternals:b,getNodes:y,edges:x,hasDefaultNodes:v,hasDefaultEdges:S,onNodesDelete:k,onEdgesDelete:E,onNodesChange:N,onEdgesChange:I}=e.getState(),T=(g||[]).map(F=>F.id),M=(p||[]).map(F=>F.id),R=y().reduce((F,B)=>{const V=B.parentNode||B.parentId,O=!T.includes(B.id)&&V&&F.find(C=>C.id===V);return(typeof B.deletable!="boolean"||B.deletable)&&(T.includes(B.id)||O)&&F.push(B),F},[]),z=x.filter(F=>typeof F.deletable!="boolean"||F.deletable),D=z.filter(F=>M.includes(F.id));if(R||D){const F=t2(R,z),B=[...D,...F],V=B.reduce((O,C)=>(O.includes(C.id)||O.push(C.id),O),[]);(S||v)&&(S&&e.setState({edges:x.filter(O=>!V.includes(O.id))}),v&&(R.forEach(O=>{b.delete(O.id)}),e.setState({nodeInternals:new Map(b)}))),V.length>0&&(E==null||E(B),I&&I(V.map(O=>({id:O,type:"remove"})))),R.length>0&&(k==null||k(R),N)&&N(R.map(O=>({id:O.id,type:"remove"})))}},[]),f=A.useCallback(g=>{const p=Vn((b=g).width)&&Vn(b.height)&&Vn(b.x)&&Vn(b.y);var b;const y=p?null:e.getState().nodeInternals.get(g.id);return!p&&!y?[null,null,p]:[p?g:zv(y),y,p]},[]),m=A.useCallback((g,p=!0,b)=>{const[y,x,v]=f(g);return y?(b||e.getState().getNodes()).filter(S=>{if(!(v||S.id!==x.id&&S.positionAbsolute))return!1;const k=zv(S),E=Gh(k,y);return p&&E>0||E>=y.width*y.height}):[]},[]),_=A.useCallback((g,p,b=!0)=>{const[y]=f(g);if(!y)return!1;const x=Gh(y,p);return b&&x>0||x>=y.width*y.height},[]);return A.useMemo(()=>({...t,getNodes:n,getNode:o,getEdges:r,getEdge:s,setNodes:i,setEdges:a,addNodes:l,addEdges:c,toObject:d,deleteElements:h,getIntersectingNodes:m,isNodeIntersecting:_}),[t,n,o,r,s,i,a,l,c,d,h,m,_])}const QR={actInsideInputWithModifier:!1},df={position:"absolute",width:"100%",height:"100%",top:0,left:0},oc=t=>({x:t.x,y:t.y,zoom:t.k}),ks=(t,e)=>t.target.closest(`.${e}`),k2=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),S2=t=>{const e=t.ctrlKey&&Kl()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e},eP=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection,d3ZoomHandler:t.d3ZoomHandler,userSelectionActive:t.userSelectionActive}),tP=({onMove:t,onMoveStart:e,onMoveEnd:n,onPaneContextMenu:o,zoomOnScroll:r=!0,zoomOnPinch:s=!0,panOnScroll:i=!1,panOnScrollSpeed:a=.5,panOnScrollMode:l=tr.Free,zoomOnDoubleClick:c=!0,elementsSelectable:d,panOnDrag:h=!0,defaultViewport:f,translateExtent:m,minZoom:_,maxZoom:g,zoomActivationKeyCode:p,preventScrolling:b=!0,children:y,noWheelClassName:x,noPanClassName:v})=>{const S=A.useRef(),k=qt(),E=A.useRef(!1),N=A.useRef(!1),I=A.useRef(null),T=A.useRef({x:0,y:0,zoom:0}),{d3Zoom:M,d3Selection:R,d3ZoomHandler:z,userSelectionActive:D}=mt(eP,on),F=Zi(p),B=A.useRef(0),V=A.useRef(!1),O=A.useRef();return function(C){const $=qt();A.useEffect(()=>{let j;const W=()=>{var Z,q;if(!C.current)return;const K=Hh(C.current);K.height!==0&&K.width!==0||((q=(Z=$.getState()).onError)==null||q.call(Z,"004",kR())),$.setState({width:K.width||500,height:K.height||500})};return W(),window.addEventListener("resize",W),C.current&&(j=new ResizeObserver(()=>W()),j.observe(C.current)),()=>{window.removeEventListener("resize",W),j&&C.current&&j.unobserve(C.current)}},[])}(I),A.useEffect(()=>{if(I.current){const C=I.current.getBoundingClientRect(),$=function(){var q,ne,re,ae=gR,X=_R,ee=xR,ce=bR,me=yR,ue=[0,1/0],pe=[[-1/0,-1/0],[1/0,1/0]],de=250,Ne=e$,je=gS("start","zoom","end"),se=0,Ae=10;function be(G){G.property("__zoom",Dv).on("wheel.zoom",Je,{passive:!1}).on("mousedown.zoom",nt).on("dblclick.zoom",te).filter(me).on("touchstart.zoom",we).on("touchmove.zoom",ke).on("touchend.zoom touchcancel.zoom",Le).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function Re(G,ge){return(ge=Math.max(ue[0],Math.min(ue[1],ge)))===G.k?G:new fp(ge,G.x,G.y)}function ze(G,ge,_e){var fe=ge[0]-_e[0]*G.k,le=ge[1]-_e[1]*G.k;return fe===G.x&&le===G.y?G:new fp(G.k,fe,le)}function qe(G){return[(+G[0][0]+ +G[1][0])/2,(+G[0][1]+ +G[1][1])/2]}function Qe(G,ge,_e,fe){G.on("start.zoom",function(){Pe(this,arguments).event(fe).start()}).on("interrupt.zoom end.zoom",function(){Pe(this,arguments).event(fe).end()}).tween("zoom",function(){var le=this,Ve=arguments,Fe=Pe(le,Ve).event(fe),Ke=X.apply(le,Ve),ie=_e==null?qe(Ke):typeof _e=="function"?_e.apply(le,Ve):_e,Se=Math.max(Ke[1][0]-Ke[0][0],Ke[1][1]-Ke[0][1]),Ee=le.__zoom,Be=typeof ge=="function"?ge.apply(le,Ve):ge,Ye=Ne(Ee.invert(ie).concat(Se/Ee.k),Be.invert(ie).concat(Se/Be.k));return function(Oe){if(Oe===1)Oe=Be;else{var He=Ye(Oe),it=Se/He[2];Oe=new fp(it,ie[0]-He[0]*it,ie[1]-He[1]*it)}Fe.zoom(null,Oe)}})}function Pe(G,ge,_e){return!_e&&G.__zooming||new tt(G,ge)}function tt(G,ge){this.that=G,this.args=ge,this.active=0,this.sourceEvent=null,this.extent=X.apply(G,ge),this.taps=0}function Je(G,...ge){if(ae.apply(this,arguments)){var _e=Pe(this,ge).event(G),fe=this.__zoom,le=Math.max(ue[0],Math.min(ue[1],fe.k*Math.pow(2,ce.apply(this,arguments)))),Ve=mo(G);if(_e.wheel)_e.mouse[0][0]===Ve[0]&&_e.mouse[0][1]===Ve[1]||(_e.mouse[1]=fe.invert(_e.mouse[0]=Ve)),clearTimeout(_e.wheel);else{if(fe.k===le)return;_e.mouse=[Ve,fe.invert(Ve)],mp(this),_e.start()}Gi(G),_e.wheel=setTimeout(function(){_e.wheel=null,_e.end()},150),_e.zoom("mouse",ee(ze(Re(fe,le),_e.mouse[0],_e.mouse[1]),_e.extent,pe))}}function nt(G,...ge){if(!re&&ae.apply(this,arguments)){var _e=G.currentTarget,fe=Pe(this,ge,!0).event(G),le=ro(G.view).on("mousemove.zoom",function(ie){if(Gi(ie),!fe.moved){var Se=ie.clientX-Fe,Ee=ie.clientY-Ke;fe.moved=Se*Se+Ee*Ee>se}fe.event(ie).zoom("mouse",ee(ze(fe.that.__zoom,fe.mouse[0]=mo(ie,_e),fe.mouse[1]),fe.extent,pe))},!0).on("mouseup.zoom",function(ie){le.on("mousemove.zoom mouseup.zoom",null),Ov(ie.view,fe.moved),Gi(ie),fe.event(ie).end()},!0),Ve=mo(G,_e),Fe=G.clientX,Ke=G.clientY;Mv(G.view),$h(G),fe.mouse=[Ve,this.__zoom.invert(Ve)],mp(this),fe.start()}}function te(G,...ge){if(ae.apply(this,arguments)){var _e=this.__zoom,fe=mo(G.changedTouches?G.changedTouches[0]:G,this),le=_e.invert(fe),Ve=_e.k*(G.shiftKey?.5:2),Fe=ee(ze(Re(_e,Ve),fe,le),X.apply(this,ge),pe);Gi(G),de>0?ro(this).transition().duration(de).call(Qe,Fe,fe,G):ro(this).call(be.transform,Fe,fe,G)}}function we(G,...ge){if(ae.apply(this,arguments)){var _e,fe,le,Ve,Fe=G.touches,Ke=Fe.length,ie=Pe(this,ge,G.changedTouches.length===Ke).event(G);for($h(G),fe=0;fe<Ke;++fe)Ve=[Ve=mo(le=Fe[fe],this),this.__zoom.invert(Ve),le.identifier],ie.touch0?ie.touch1||ie.touch0[2]===Ve[2]||(ie.touch1=Ve,ie.taps=0):(ie.touch0=Ve,_e=!0,ie.taps=1+!!q);q&&(q=clearTimeout(q)),_e&&(ie.taps<2&&(ne=Ve[0],q=setTimeout(function(){q=null},500)),mp(this),ie.start())}}function ke(G,...ge){if(this.__zooming){var _e,fe,le,Ve,Fe=Pe(this,ge).event(G),Ke=G.changedTouches,ie=Ke.length;for(Gi(G),_e=0;_e<ie;++_e)le=mo(fe=Ke[_e],this),Fe.touch0&&Fe.touch0[2]===fe.identifier?Fe.touch0[0]=le:Fe.touch1&&Fe.touch1[2]===fe.identifier&&(Fe.touch1[0]=le);if(fe=Fe.that.__zoom,Fe.touch1){var Se=Fe.touch0[0],Ee=Fe.touch0[1],Be=Fe.touch1[0],Ye=Fe.touch1[1],Oe=(Oe=Be[0]-Se[0])*Oe+(Oe=Be[1]-Se[1])*Oe,He=(He=Ye[0]-Ee[0])*He+(He=Ye[1]-Ee[1])*He;fe=Re(fe,Math.sqrt(Oe/He)),le=[(Se[0]+Be[0])/2,(Se[1]+Be[1])/2],Ve=[(Ee[0]+Ye[0])/2,(Ee[1]+Ye[1])/2]}else{if(!Fe.touch0)return;le=Fe.touch0[0],Ve=Fe.touch0[1]}Fe.zoom("touch",ee(ze(fe,le,Ve),Fe.extent,pe))}}function Le(G,...ge){if(this.__zooming){var _e,fe,le=Pe(this,ge).event(G),Ve=G.changedTouches,Fe=Ve.length;for($h(G),re&&clearTimeout(re),re=setTimeout(function(){re=null},500),_e=0;_e<Fe;++_e)fe=Ve[_e],le.touch0&&le.touch0[2]===fe.identifier?delete le.touch0:le.touch1&&le.touch1[2]===fe.identifier&&delete le.touch1;if(le.touch1&&!le.touch0&&(le.touch0=le.touch1,delete le.touch1),le.touch0)le.touch0[1]=this.__zoom.invert(le.touch0[0]);else if(le.end(),le.taps===2&&(fe=mo(fe,this),Math.hypot(ne[0]-fe[0],ne[1]-fe[1])<Ae)){var Ke=ro(this).on("dblclick.zoom");Ke&&Ke.apply(this,arguments)}}}return be.transform=function(G,ge,_e,fe){var le=G.selection?G.selection():G;le.property("__zoom",Dv),G!==le?Qe(G,ge,_e,fe):le.interrupt().each(function(){Pe(this,arguments).event(fe).start().zoom(null,typeof ge=="function"?ge.apply(this,arguments):ge).end()})},be.scaleBy=function(G,ge,_e,fe){be.scaleTo(G,function(){return this.__zoom.k*(typeof ge=="function"?ge.apply(this,arguments):ge)},_e,fe)},be.scaleTo=function(G,ge,_e,fe){be.transform(G,function(){var le=X.apply(this,arguments),Ve=this.__zoom,Fe=_e==null?qe(le):typeof _e=="function"?_e.apply(this,arguments):_e,Ke=Ve.invert(Fe),ie=typeof ge=="function"?ge.apply(this,arguments):ge;return ee(ze(Re(Ve,ie),Fe,Ke),le,pe)},_e,fe)},be.translateBy=function(G,ge,_e,fe){be.transform(G,function(){return ee(this.__zoom.translate(typeof ge=="function"?ge.apply(this,arguments):ge,typeof _e=="function"?_e.apply(this,arguments):_e),X.apply(this,arguments),pe)},null,fe)},be.translateTo=function(G,ge,_e,fe,le){be.transform(G,function(){var Ve=X.apply(this,arguments),Fe=this.__zoom,Ke=fe==null?qe(Ve):typeof fe=="function"?fe.apply(this,arguments):fe;return ee(yr.translate(Ke[0],Ke[1]).scale(Fe.k).translate(typeof ge=="function"?-ge.apply(this,arguments):-ge,typeof _e=="function"?-_e.apply(this,arguments):-_e),Ve,pe)},fe,le)},tt.prototype={event:function(G){return G&&(this.sourceEvent=G),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(G,ge){return this.mouse&&G!=="mouse"&&(this.mouse[1]=ge.invert(this.mouse[0])),this.touch0&&G!=="touch"&&(this.touch0[1]=ge.invert(this.touch0[0])),this.touch1&&G!=="touch"&&(this.touch1[1]=ge.invert(this.touch1[0])),this.that.__zoom=ge,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(G){var ge=ro(this.that).datum();je.call(G,this.that,new pR(G,{sourceEvent:this.sourceEvent,target:be,transform:this.that.__zoom,dispatch:je}),ge)}},be.wheelDelta=function(G){return arguments.length?(ce=typeof G=="function"?G:Gl(+G),be):ce},be.filter=function(G){return arguments.length?(ae=typeof G=="function"?G:Gl(!!G),be):ae},be.touchable=function(G){return arguments.length?(me=typeof G=="function"?G:Gl(!!G),be):me},be.extent=function(G){return arguments.length?(X=typeof G=="function"?G:Gl([[+G[0][0],+G[0][1]],[+G[1][0],+G[1][1]]]),be):X},be.scaleExtent=function(G){return arguments.length?(ue[0]=+G[0],ue[1]=+G[1],be):[ue[0],ue[1]]},be.translateExtent=function(G){return arguments.length?(pe[0][0]=+G[0][0],pe[1][0]=+G[1][0],pe[0][1]=+G[0][1],pe[1][1]=+G[1][1],be):[[pe[0][0],pe[0][1]],[pe[1][0],pe[1][1]]]},be.constrain=function(G){return arguments.length?(ee=G,be):ee},be.duration=function(G){return arguments.length?(de=+G,be):de},be.interpolate=function(G){return arguments.length?(Ne=G,be):Ne},be.on=function(){var G=je.on.apply(je,arguments);return G===je?be:G},be.clickDistance=function(G){return arguments.length?(se=(G=+G)*G,be):Math.sqrt(se)},be.tapDistance=function(G){return arguments.length?(Ae=+G,be):Ae},be}().scaleExtent([_,g]).translateExtent(m),j=ro(I.current).call($),W=yr.translate(f.x,f.y).scale(bs(f.zoom,_,g)),K=[[0,0],[C.width,C.height]],Z=$.constrain()(W,K,m);$.transform(j,Z),$.wheelDelta(S2),k.setState({d3Zoom:$,d3Selection:j,d3ZoomHandler:j.on("wheel.zoom"),transform:[Z.x,Z.y,Z.k],domNode:I.current.closest(".react-flow")})}},[]),A.useEffect(()=>{R&&M&&(!i||F||D?z!==void 0&&R.on("wheel.zoom",function(C,$){if(!b&&C.type==="wheel"&&!C.ctrlKey||ks(C,x))return null;C.preventDefault(),z.call(this,C,$)},{passive:!1}):R.on("wheel.zoom",C=>{if(ks(C,x))return!1;C.preventDefault(),C.stopImmediatePropagation();const $=R.property("__zoom").k||1;if(C.ctrlKey&&s){const ae=mo(C),X=S2(C),ee=$*Math.pow(2,X);return void M.scaleTo(R,ee,ae,C)}const j=C.deltaMode===1?20:1;let W=l===tr.Vertical?0:C.deltaX*j,K=l===tr.Horizontal?0:C.deltaY*j;!Kl()&&C.shiftKey&&l!==tr.Vertical&&(W=C.deltaY*j,K=0),M.translateBy(R,-W/$*a,-K/$*a,{internal:!0});const Z=oc(R.property("__zoom")),{onViewportChangeStart:q,onViewportChange:ne,onViewportChangeEnd:re}=k.getState();clearTimeout(O.current),V.current||(V.current=!0,e==null||e(C,Z),q==null||q(Z)),V.current&&(t==null||t(C,Z),ne==null||ne(Z),O.current=setTimeout(()=>{n==null||n(C,Z),re==null||re(Z),V.current=!1},150))},{passive:!1}))},[D,i,l,R,M,z,F,s,b,x,e,t,n]),A.useEffect(()=>{M&&M.on("start",C=>{var W,K;if(!C.sourceEvent||C.sourceEvent.internal)return null;B.current=(W=C.sourceEvent)==null?void 0:W.button;const{onViewportChangeStart:$}=k.getState(),j=oc(C.transform);E.current=!0,T.current=j,((K=C.sourceEvent)==null?void 0:K.type)==="mousedown"&&k.setState({paneDragging:!0}),$==null||$(j),e==null||e(C.sourceEvent,j)})},[M,e]),A.useEffect(()=>{M&&(D&&!E.current?M.on("zoom",null):D||M.on("zoom",C=>{var j;const{onViewportChange:$}=k.getState();if(k.setState({transform:[C.transform.x,C.transform.y,C.transform.k]}),N.current=!(!o||!k2(h,B.current??0)),(t||$)&&!((j=C.sourceEvent)!=null&&j.internal)){const W=oc(C.transform);$==null||$(W),t==null||t(C.sourceEvent,W)}}))},[D,M,t,h,o]),A.useEffect(()=>{M&&M.on("end",C=>{if(!C.sourceEvent||C.sourceEvent.internal)return null;const{onViewportChangeEnd:$}=k.getState();if(E.current=!1,k.setState({paneDragging:!1}),o&&k2(h,B.current??0)&&!N.current&&o(C.sourceEvent),N.current=!1,(n||$)&&(j=T.current,W=C.transform,j.x!==W.x||j.y!==W.y||j.zoom!==W.k)){const K=oc(C.transform);T.current=K,clearTimeout(S.current),S.current=setTimeout(()=>{$==null||$(K),n==null||n(C.sourceEvent,K)},i?150:0)}var j,W})},[M,i,h,n,o]),A.useEffect(()=>{M&&M.filter(C=>{const $=F||r,j=s&&C.ctrlKey;if((h===!0||Array.isArray(h)&&h.includes(1))&&C.button===1&&C.type==="mousedown"&&(ks(C,"react-flow__node")||ks(C,"react-flow__edge")))return!0;if(!(h||$||i||c||s)||D||!c&&C.type==="dblclick"||ks(C,x)&&C.type==="wheel"||ks(C,v)&&(C.type!=="wheel"||i&&C.type==="wheel"&&!F)||!s&&C.ctrlKey&&C.type==="wheel"||!$&&!i&&!j&&C.type==="wheel"||!h&&(C.type==="mousedown"||C.type==="touchstart")||Array.isArray(h)&&!h.includes(C.button)&&C.type==="mousedown")return!1;const W=Array.isArray(h)&&h.includes(C.button)||!C.button||C.button<=1;return(!C.ctrlKey||C.type==="wheel")&&W})},[D,M,r,s,i,c,h,d,F]),Y.createElement("div",{className:"react-flow__renderer",ref:I,style:df},y)},nP=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function oP(){const{userSelectionActive:t,userSelectionRect:e}=mt(nP,on);return t&&e?Y.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 C2(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 N2(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&&C2(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&&C2(o,i);break;case"remove":return o}return o.push(i),o},n)}function j2(t,e){return N2(t,e)}const rr=(t,e)=>({id:t,type:"select",selected:e});function Ss(t,e){return t.reduce((n,o)=>{const r=e.includes(o.id);return!o.selected&&r?(o.selected=!0,n.push(rr(o.id,!0))):o.selected&&!r&&(o.selected=!1,n.push(rr(o.id,!1))),n},[])}const uf=(t,e)=>n=>{n.target===e.current&&(t==null||t(n))},rP=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,dragging:t.paneDragging}),E2=A.memo(({isSelecting:t,selectionMode:e=Ki.Full,panOnDrag:n,onSelectionStart:o,onSelectionEnd:r,onPaneClick:s,onPaneContextMenu:i,onPaneScroll:a,onPaneMouseEnter:l,onPaneMouseMove:c,onPaneMouseLeave:d,children:h})=>{const f=A.useRef(null),m=qt(),_=A.useRef(0),g=A.useRef(0),p=A.useRef(),{userSelectionActive:b,elementsSelectable:y,dragging:x}=mt(rP,on),v=()=>{m.setState({userSelectionActive:!1,userSelectionRect:null}),_.current=0,g.current=0},S=N=>{s==null||s(N),m.getState().resetSelectedElements(),m.setState({nodesSelectionActive:!1})},k=a?N=>a(N):void 0,E=y&&(t||b);return Y.createElement("div",{className:hn(["react-flow__pane",{dragging:x,selection:t}]),onClick:E?void 0:uf(S,f),onContextMenu:uf(N=>{Array.isArray(n)&&(n!=null&&n.includes(2))?N.preventDefault():i==null||i(N)},f),onWheel:uf(k,f),onMouseEnter:E?void 0:l,onMouseDown:E?N=>{const{resetSelectedElements:I,domNode:T}=m.getState();if(p.current=T==null?void 0:T.getBoundingClientRect(),!y||!t||N.button!==0||N.target!==f.current||!p.current)return;const{x:M,y:R}=er(N,p.current);I(),m.setState({userSelectionRect:{width:0,height:0,startX:M,startY:R,x:M,y:R}}),o==null||o(N)}:void 0,onMouseMove:E?N=>{const{userSelectionRect:I,nodeInternals:T,edges:M,transform:R,onNodesChange:z,onEdgesChange:D,nodeOrigin:F,getNodes:B}=m.getState();if(!t||!p.current||!I)return;m.setState({userSelectionActive:!0,nodesSelectionActive:!1});const V=er(N,p.current),O=I.startX??0,C=I.startY??0,$={...I,x:V.x<O?V.x:O,y:V.y<C?V.y:C,width:Math.abs(V.x-O),height:Math.abs(V.y-C)},j=B(),W=e2(T,$,R,e===Ki.Partial,!0,F),K=t2(W,M).map(q=>q.id),Z=W.map(q=>q.id);if(_.current!==Z.length){_.current=Z.length;const q=Ss(j,Z);q.length&&(z==null||z(q))}if(g.current!==K.length){g.current=K.length;const q=Ss(M,K);q.length&&(D==null||D(q))}m.setState({userSelectionRect:$})}:c,onMouseUp:E?N=>{if(N.button!==0)return;const{userSelectionRect:I}=m.getState();!b&&I&&N.target===f.current&&(S==null||S(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()}:d,ref:f,style:df},h,Y.createElement(oP,null))});function I2(t,e){const n=t.parentNode||t.parentId;if(!n)return!1;const o=e.get(n);return!!o&&(!!o.selected||I2(o,e))}function A2(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 sP(t,e,n,o){return Array.from(t.values()).filter(r=>(r.selected||r.id===o)&&(!r.parentNode||r.parentId||!I2(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 T2(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}=xs(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}=xs(h,r).positionAbsolute;a=h&&Vn(f)&&Vn(m)&&Vn(h.width)&&Vn(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",SR()),a=i;let c={x:0,y:0};if(l){const h=n.get(l);c=xs(h,r).positionAbsolute}const d=a&&a!=="parent"?Wh(e,a):e;return{position:{x:d.x-c.x,y:d.y-c.y},positionAbsolute:d}}function hf({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]}E2.displayName="Pane";const M2=(t,e,n,o)=>{const r=e.querySelectorAll(t);if(!r||!r.length)return null;const s=Array.from(r),i=e.getBoundingClientRect(),a=i.width*o[0],l=i.height*o[1];return s.map(c=>{const d=c.getBoundingClientRect();return{id:c.getAttribute("data-handleid"),position:c.getAttribute("data-handlepos"),x:(d.left-i.left-a)/n,y:(d.top-i.top-l)/n,...Hh(c)}})};function ea(t,e,n){return n===void 0?n:o=>{const r=e().nodeInternals.get(t);r&&n(o,{...r})}}function ff({id:t,store:e,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:s,multiSelectionActive:i,nodeInternals:a,onError:l}=e.getState(),c=a.get(t);c?(e.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&i)&&(s({nodes:[c],edges:[]}),requestAnimationFrame(()=>{var d;return(d=o==null?void 0:o.current)==null?void 0:d.blur()})):r([t])):l==null||l("012",IR(t))}function mf(t){return(e,n,o)=>t==null?void 0:t(e,o)}function O2({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:s,selectNodesOnDrag:i}){const a=qt(),[l,c]=A.useState(!1),d=A.useRef([]),h=A.useRef({x:null,y:null}),f=A.useRef(0),m=A.useRef(null),_=A.useRef({x:0,y:0}),g=A.useRef(null),p=A.useRef(!1),b=A.useRef(!1),y=A.useRef(!1),x=function(){const v=qt();return A.useCallback(({sourceEvent:k})=>{const{transform:E,snapGrid:N,snapToGrid:I}=v.getState(),T=k.touches?k.touches[0].clientX:k.clientX,M=k.touches?k.touches[0].clientY:k.clientY,R={x:(T-E[0])/E[2],y:(M-E[1])/E[2]};return{xSnapped:I?N[0]*Math.round(R.x/N[0]):R.x,ySnapped:I?N[1]*Math.round(R.y/N[1]):R.y,...R}},[])}();return A.useEffect(()=>{if(t!=null&&t.current){const v=ro(t.current),S=({x:N,y:I})=>{const{nodeInternals:T,onNodeDrag:M,onSelectionDrag:R,updateNodePositions:z,nodeExtent:D,snapGrid:F,snapToGrid:B,nodeOrigin:V,onError:O}=a.getState();h.current={x:N,y:I};let C=!1,$={x:0,y:0,x2:0,y2:0};if(d.current.length>1&&D){const W=of(d.current,V);$=qh(W)}if(d.current=d.current.map(W=>{const K={x:N-W.distance.x,y:I-W.distance.y};B&&(K.x=F[0]*Math.round(K.x/F[0]),K.y=F[1]*Math.round(K.y/F[1]));const Z=[[D[0][0],D[0][1]],[D[1][0],D[1][1]]];d.current.length>1&&D&&!W.extent&&(Z[0][0]=W.positionAbsolute.x-$.x+D[0][0],Z[1][0]=W.positionAbsolute.x+(W.width??0)-$.x2+D[1][0],Z[0][1]=W.positionAbsolute.y-$.y+D[0][1],Z[1][1]=W.positionAbsolute.y+(W.height??0)-$.y2+D[1][1]);const q=T2(W,K,T,Z,V,O);return C=C||W.position.x!==q.position.x||W.position.y!==q.position.y,W.position=q.position,W.positionAbsolute=q.positionAbsolute,W}),!C)return;z(d.current,!0,!0),c(!0);const j=r?M:mf(R);if(j&&g.current){const[W,K]=hf({nodeId:r,dragItems:d.current,nodeInternals:T});j(g.current,W,K)}},k=()=>{if(!m.current)return;const[N,I]=Lv(_.current,m.current);if(N!==0||I!==0){const{transform:T,panBy:M}=a.getState();h.current.x=(h.current.x??0)-N/T[2],h.current.y=(h.current.y??0)-I/T[2],M({x:N,y:I})&&S(h.current)}f.current=requestAnimationFrame(k)},E=N=>{var V;const{nodeInternals:I,multiSelectionActive:T,nodesDraggable:M,unselectNodesAndEdges:R,onNodeDragStart:z,onSelectionDragStart:D}=a.getState();b.current=!0;const F=r?z:mf(D);i&&s||T||!r||(V=I.get(r))!=null&&V.selected||R(),r&&s&&i&&ff({id:r,store:a,nodeRef:t});const B=x(N);if(h.current=B,d.current=sP(I,M,B,r),F&&d.current){const[O,C]=hf({nodeId:r,dragItems:d.current,nodeInternals:I});F(N.sourceEvent,O,C)}};if(!e){const N=function(){var I,T,M,R,z=uR,D=hR,F=fR,B=mR,V={},O=gS("start","drag","end"),C=0,$=0;function j(X){X.on("mousedown.drag",W).filter(B).on("touchstart.drag",q).on("touchmove.drag",ne,dR).on("touchend.drag touchcancel.drag",re).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function W(X,ee){if(!R&&z.call(this,X,ee)){var ce=ae(this,D.call(this,X,ee),X,ee,"mouse");ce&&(ro(X.view).on("mousemove.drag",K,qi).on("mouseup.drag",Z,qi),Mv(X.view),Uh(X),M=!1,I=X.clientX,T=X.clientY,ce("start",X))}}function K(X){if(_s(X),!M){var ee=X.clientX-I,ce=X.clientY-T;M=ee*ee+ce*ce>$}V.mouse("drag",X)}function Z(X){ro(X.view).on("mousemove.drag mouseup.drag",null),Ov(X.view,M),_s(X),V.mouse("end",X)}function q(X,ee){if(z.call(this,X,ee)){var ce,me,ue=X.changedTouches,pe=D.call(this,X,ee),de=ue.length;for(ce=0;ce<de;++ce)(me=ae(this,pe,X,ee,ue[ce].identifier,ue[ce]))&&(Uh(X),me("start",X,ue[ce]))}}function ne(X){var ee,ce,me=X.changedTouches,ue=me.length;for(ee=0;ee<ue;++ee)(ce=V[me[ee].identifier])&&(_s(X),ce("drag",X,me[ee]))}function re(X){var ee,ce,me=X.changedTouches,ue=me.length;for(R&&clearTimeout(R),R=setTimeout(function(){R=null},500),ee=0;ee<ue;++ee)(ce=V[me[ee].identifier])&&(Uh(X),ce("end",X,me[ee]))}function ae(X,ee,ce,me,ue,pe){var de,Ne,je,se=O.copy(),Ae=mo(pe||ce,ee);if((je=F.call(X,new Vh("beforestart",{sourceEvent:ce,target:j,identifier:ue,active:C,x:Ae[0],y:Ae[1],dx:0,dy:0,dispatch:se}),me))!=null)return de=je.x-Ae[0]||0,Ne=je.y-Ae[1]||0,function be(Re,ze,qe){var Qe,Pe=Ae;switch(Re){case"start":V[ue]=be,Qe=C++;break;case"end":delete V[ue],--C;case"drag":Ae=mo(qe||ze,ee),Qe=C}se.call(Re,X,new Vh(Re,{sourceEvent:ze,subject:je,target:j,identifier:ue,active:Qe,x:Ae[0]+de,y:Ae[1]+Ne,dx:Ae[0]-Pe[0],dy:Ae[1]-Pe[1],dispatch:se}),me)}}return j.filter=function(X){return arguments.length?(z=typeof X=="function"?X:ql(!!X),j):z},j.container=function(X){return arguments.length?(D=typeof X=="function"?X:ql(X),j):D},j.subject=function(X){return arguments.length?(F=typeof X=="function"?X:ql(X),j):F},j.touchable=function(X){return arguments.length?(B=typeof X=="function"?X:ql(!!X),j):B},j.on=function(){var X=O.on.apply(O,arguments);return X===O?j:X},j.clickDistance=function(X){return arguments.length?($=(X=+X)*X,j):Math.sqrt($)},j}().on("start",I=>{const{domNode:T,nodeDragThreshold:M}=a.getState();M===0&&E(I),y.current=!1;const R=x(I);h.current=R,m.current=(T==null?void 0:T.getBoundingClientRect())||null,_.current=er(I.sourceEvent,m.current)}).on("drag",I=>{var z,D;const T=x(I),{autoPanOnNodeDrag:M,nodeDragThreshold:R}=a.getState();if(I.sourceEvent.type==="touchmove"&&I.sourceEvent.touches.length>1&&(y.current=!0),!y.current){if(!p.current&&b.current&&M&&(p.current=!0,k()),!b.current){const F=T.xSnapped-(((z=h==null?void 0:h.current)==null?void 0:z.x)??0),B=T.ySnapped-(((D=h==null?void 0:h.current)==null?void 0:D.y)??0);Math.sqrt(F*F+B*B)>R&&E(I)}(h.current.x!==T.xSnapped||h.current.y!==T.ySnapped)&&d.current&&b.current&&(g.current=I.sourceEvent,_.current=er(I.sourceEvent,m.current),S(T))}}).on("end",I=>{if(b.current&&!y.current&&(c(!1),p.current=!1,b.current=!1,cancelAnimationFrame(f.current),d.current)){const{updateNodePositions:T,nodeInternals:M,onNodeDragStop:R,onSelectionDragStop:z}=a.getState(),D=r?R:mf(z);if(T(d.current,!1,!1),D){const[F,B]=hf({nodeId:r,dragItems:d.current,nodeInternals:M});D(I.sourceEvent,F,B)}}}).filter(I=>{const T=I.target;return!I.button&&(!n||!A2(T,`.${n}`,t))&&(!o||A2(T,o,t))});return v.call(N),()=>{v.on(".drag",null)}}v.on(".drag",null)}},[t,e,n,o,s,a,r,i,x]),l}function D2(){const t=qt();return A.useCallback(n=>{const{nodeInternals:o,nodeExtent:r,updateNodePositions:s,getNodes:i,snapToGrid:a,snapGrid:l,onError:c,nodesDraggable:d}=t.getState(),h=i().filter(y=>y.selected&&(y.draggable||d&&y.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(y=>{if(y.positionAbsolute){const x={x:y.positionAbsolute.x+g,y:y.positionAbsolute.y+p};a&&(x.x=l[0]*Math.round(x.x/l[0]),x.y=l[1]*Math.round(x.y/l[1]));const{positionAbsolute:v,position:S}=T2(y,x,o,r,void 0,c);y.position=S,y.positionAbsolute=v}return y});s(b,!0,!1)},[])}const Cs={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var ta=t=>{const e=({id:n,type:o,data:r,xPos:s,yPos:i,xPosOrigin:a,yPosOrigin:l,selected:c,onClick:d,onMouseEnter:h,onMouseMove:f,onMouseLeave:m,onContextMenu:_,onDoubleClick:g,style:p,className:b,isDraggable:y,isSelectable:x,isConnectable:v,isFocusable:S,selectNodesOnDrag:k,sourcePosition:E,targetPosition:N,hidden:I,resizeObserver:T,dragHandle:M,zIndex:R,isParent:z,noDragClassName:D,noPanClassName:F,initialized:B,disableKeyboardA11y:V,ariaLabel:O,rfId:C,hasHandleBounds:$})=>{const j=qt(),W=A.useRef(null),K=A.useRef(null),Z=A.useRef(E),q=A.useRef(N),ne=A.useRef(o),re=x||y||d||h||f||m,ae=D2(),X=ea(n,j.getState,h),ee=ea(n,j.getState,f),ce=ea(n,j.getState,m),me=ea(n,j.getState,_),ue=ea(n,j.getState,g);A.useEffect(()=>()=>{K.current&&(T==null||T.unobserve(K.current),K.current=null)},[]),A.useEffect(()=>{if(W.current&&!I){const de=W.current;B&&$&&K.current===de||(K.current&&(T==null||T.unobserve(K.current)),T==null||T.observe(de),K.current=de)}},[I,B,$]),A.useEffect(()=>{const de=ne.current!==o,Ne=Z.current!==E,je=q.current!==N;W.current&&(de||Ne||je)&&(de&&(ne.current=o),Ne&&(Z.current=E),je&&(q.current=N),j.getState().updateNodeDimensions([{id:n,nodeElement:W.current,forceUpdate:!0}]))},[n,o,E,N]);const pe=O2({nodeRef:W,disabled:I||!y,noDragClassName:D,handleSelector:M,nodeId:n,isSelectable:x,selectNodesOnDrag:k});return I?null:Y.createElement("div",{className:hn(["react-flow__node",`react-flow__node-${o}`,{[F]:y},b,{selected:c,selectable:x,parent:z,dragging:pe}]),ref:W,style:{zIndex:R,transform:`translate(${a}px,${l}px)`,pointerEvents:re?"all":"none",visibility:B?"visible":"hidden",...p},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:X,onMouseMove:ee,onMouseLeave:ce,onContextMenu:me,onClick:de=>{const{nodeDragThreshold:Ne}=j.getState();if(x&&(!k||!y||Ne>0)&&ff({id:n,store:j,nodeRef:W}),d){const je=j.getState().nodeInternals.get(n);je&&d(de,{...je})}},onDoubleClick:ue,onKeyDown:S?de=>{if(!Yh(de)&&!V)if(Bv.includes(de.key)&&x){const Ne=de.key==="Escape";ff({id:n,store:j,unselect:Ne,nodeRef:W})}else y&&c&&Object.prototype.hasOwnProperty.call(Cs,de.key)&&(j.setState({ariaLiveMessage:`Moved selected node ${de.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~s}, y: ${~~i}`}),ae({x:Cs[de.key].x,y:Cs[de.key].y,isShiftPressed:de.shiftKey}))}:void 0,tabIndex:S?0:void 0,role:S?"button":void 0,"aria-describedby":V?void 0:`${g2}-${C}`,"aria-label":O},Y.createElement(DR,{value:n},Y.createElement(t,{id:n,data:r,type:o,xPos:s,yPos:i,selected:c,isConnectable:v,sourcePosition:E,targetPosition:N,dragging:pe,dragHandle:M,zIndex:R})))};return e.displayName="NodeWrapper",A.memo(e)};const iP=t=>{const e=t.getNodes().filter(n=>n.selected);return{...of(e,t.nodeOrigin),transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`,userSelectionActive:t.userSelectionActive}};var aP=A.memo(function({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const o=qt(),{width:r,height:s,x:i,y:a,transformString:l,userSelectionActive:c}=mt(iP,on),d=D2(),h=A.useRef(null);if(A.useEffect(()=>{var m;n||((m=h.current)==null||m.focus({preventScroll:!0}))},[n]),O2({nodeRef:h}),c||!r||!s)return null;const f=t?m=>{const _=o.getState().getNodes().filter(g=>g.selected);t(m,_)}:void 0;return Y.createElement("div",{className:hn(["react-flow__nodesselection","react-flow__container",e]),style:{transform:l}},Y.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(Cs,m.key)&&d({x:Cs[m.key].x,y:Cs[m.key].y,isShiftPressed:m.shiftKey})},style:{width:r,height:s,top:a,left:i}}))});const lP=t=>t.nodesSelectionActive,R2=({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:i,deleteKeyCode:a,onMove:l,onMoveStart:c,onMoveEnd:d,selectionKeyCode:h,selectionOnDrag:f,selectionMode:m,onSelectionStart:_,onSelectionEnd:g,multiSelectionKeyCode:p,panActivationKeyCode:b,zoomActivationKeyCode:y,elementsSelectable:x,zoomOnScroll:v,zoomOnPinch:S,panOnScroll:k,panOnScrollSpeed:E,panOnScrollMode:N,zoomOnDoubleClick:I,panOnDrag:T,defaultViewport:M,translateExtent:R,minZoom:z,maxZoom:D,preventScrolling:F,onSelectionContextMenu:B,noWheelClassName:V,noPanClassName:O,disableKeyboardA11y:C})=>{const $=mt(lP),j=Zi(h),W=Zi(b),K=W||T,Z=W||k,q=j||f&&K!==!0;return(({deleteKeyCode:ne,multiSelectionKeyCode:re})=>{const ae=qt(),{deleteElements:X}=Qi(),ee=Zi(ne,QR),ce=Zi(re);A.useEffect(()=>{if(ee){const{edges:me,getNodes:ue}=ae.getState(),pe=ue().filter(Ne=>Ne.selected),de=me.filter(Ne=>Ne.selected);X({nodes:pe,edges:de}),ae.setState({nodesSelectionActive:!1})}},[ee]),A.useEffect(()=>{ae.setState({multiSelectionActive:ce})},[ce])})({deleteKeyCode:a,multiSelectionKeyCode:p}),Y.createElement(tP,{onMove:l,onMoveStart:c,onMoveEnd:d,onPaneContextMenu:s,elementsSelectable:x,zoomOnScroll:v,zoomOnPinch:S,panOnScroll:Z,panOnScrollSpeed:E,panOnScrollMode:N,zoomOnDoubleClick:I,panOnDrag:!j&&K,defaultViewport:M,translateExtent:R,minZoom:z,maxZoom:D,zoomActivationKeyCode:y,preventScrolling:F,noWheelClassName:V,noPanClassName:O},Y.createElement(E2,{onSelectionStart:_,onSelectionEnd:g,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:i,panOnDrag:K,isSelecting:!!q,selectionMode:m},t,$&&Y.createElement(aP,{onSelectionContextMenu:B,noPanClassName:O,disableKeyboardA11y:C})))};R2.displayName="FlowRenderer";var cP=A.memo(R2);function dP(t){return{input:ta(t.input||u2),default:ta(t.default||af),output:ta(t.output||f2),group:ta(t.group||lf),...Object.keys(t).filter(e=>!["input","default","output","group"].includes(e)).reduce((e,n)=>(e[n]=ta(t[n]||af),e),{})}}const uP=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,updateNodeDimensions:t.updateNodeDimensions,onError:t.onError}),P2=t=>{const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,updateNodeDimensions:s,onError:i}=mt(uP,on),a=(l=t.onlyRenderVisibleElements,mt(A.useCallback(h=>l?e2(h.nodeInternals,{x:0,y:0,width:h.width,height:h.height},h.transform,!0):h.getNodes(),[l])));var l;const c=A.useRef(),d=A.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 c.current=h,h},[]);return A.useEffect(()=>()=>{var h;(h=c==null?void 0:c.current)==null||h.disconnect()},[]),Y.createElement("div",{className:"react-flow__nodes",style:df},a.map(h=>{var k,E,N;let f=h.type||"default";t.nodeTypes[f]||(i==null||i("003",vR(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),y=t.nodeExtent?Wh(h.positionAbsolute,t.nodeExtent):h.positionAbsolute,x=(y==null?void 0:y.x)??0,v=(y==null?void 0:y.y)??0,S=(({x:I,y:T,width:M,height:R,origin:z})=>M&&R?z[0]<0||z[1]<0||z[0]>1||z[1]>1?{x:I,y:T}:{x:I-M*z[0],y:T-R*z[1]}:{x:I,y:T})({x,y:v,width:h.width??0,height:h.height??0,origin:t.nodeOrigin});return Y.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:x,yPos:v,xPosOrigin:S.x,yPosOrigin:S.y,selectNodesOnDrag:t.selectNodesOnDrag,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,selected:!!h.selected,isDraggable:_,isSelectable:g,isConnectable:p,isFocusable:b,resizeObserver:d,dragHandle:h.dragHandle,zIndex:((k=h[Nt])==null?void 0:k.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)})}))};P2.displayName="NodeRenderer";var hP=A.memo(P2);const fP=(t,e,n)=>n===Ue.Left?t-e:n===Ue.Right?t+e:t,mP=(t,e,n)=>n===Ue.Top?t-e:n===Ue.Bottom?t+e:t,L2="react-flow__edgeupdater",F2=({position:t,centerX:e,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:s,onMouseOut:i,type:a})=>Y.createElement("circle",{onMouseDown:r,onMouseEnter:s,onMouseOut:i,className:hn([L2,`${L2}-${a}`]),cx:fP(e,o,t),cy:mP(n,o,t),r:o,stroke:"transparent",fill:"transparent"}),pP=()=>!0;var Ns=t=>{const e=({id:n,className:o,type:r,data:s,onClick:i,onEdgeDoubleClick:a,selected:l,animated:c,label:d,labelStyle:h,labelShowBg:f,labelBgStyle:m,labelBgPadding:_,labelBgBorderRadius:g,style:p,source:b,target:y,sourceX:x,sourceY:v,targetX:S,targetY:k,sourcePosition:E,targetPosition:N,elementsSelectable:I,hidden:T,sourceHandleId:M,targetHandleId:R,onContextMenu:z,onMouseEnter:D,onMouseMove:F,onMouseLeave:B,reconnectRadius:V,onReconnect:O,onReconnectStart:C,onReconnectEnd:$,markerEnd:j,markerStart:W,rfId:K,ariaLabel:Z,isFocusable:q,isReconnectable:ne,pathOptions:re,interactionWidth:ae,disableKeyboardA11y:X})=>{const ee=A.useRef(null),[ce,me]=A.useState(!1),[ue,pe]=A.useState(!1),de=qt(),Ne=A.useMemo(()=>`url('#${tf(W,K)}')`,[W,K]),je=A.useMemo(()=>`url('#${tf(j,K)}')`,[j,K]);if(T)return null;const se=Ji(n,de.getState,a),Ae=Ji(n,de.getState,z),be=Ji(n,de.getState,D),Re=Ji(n,de.getState,F),ze=Ji(n,de.getState,B),qe=(Je,nt)=>{if(Je.button!==0)return;const{edges:te,isValidConnection:we}=de.getState(),ke=nt?y:b,Le=(nt?R:M)||null,G=nt?"target":"source",ge=we||pP,_e=nt,fe=te.find(le=>le.id===n);pe(!0),C==null||C(Je,fe,G),i2({event:Je,handleId:Le,nodeId:ke,onConnect:le=>O==null?void 0:O(fe,le),isTarget:_e,getState:de.getState,setState:de.setState,isValidConnection:ge,edgeUpdaterType:G,onReconnectEnd:le=>{pe(!1),$==null||$(le,fe,G)}})},Qe=()=>me(!0),Pe=()=>me(!1),tt=!I&&!i;return Y.createElement("g",{className:hn(["react-flow__edge",`react-flow__edge-${r}`,o,{selected:l,animated:c,inactive:tt,updating:ce}]),onClick:Je=>{var G;const{edges:nt,addSelectedEdges:te,unselectNodesAndEdges:we,multiSelectionActive:ke}=de.getState(),Le=nt.find(ge=>ge.id===n);Le&&(I&&(de.setState({nodesSelectionActive:!1}),Le.selected&&ke?(we({nodes:[],edges:[Le]}),(G=ee.current)==null||G.blur()):te([n])),i&&i(Je,Le))},onDoubleClick:se,onContextMenu:Ae,onMouseEnter:be,onMouseMove:Re,onMouseLeave:ze,onKeyDown:q?Je=>{var nt;if(!X&&Bv.includes(Je.key)&&I){const{unselectNodesAndEdges:te,addSelectedEdges:we,edges:ke}=de.getState();Je.key==="Escape"?((nt=ee.current)==null||nt.blur(),te({edges:[ke.find(Le=>Le.id===n)]})):we([n])}}:void 0,tabIndex:q?0:void 0,role:q?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":Z===null?void 0:Z||`Edge from ${b} to ${y}`,"aria-describedby":q?`${_2}-${K}`:void 0,ref:ee},!ue&&Y.createElement(t,{id:n,source:b,target:y,selected:l,animated:c,label:d,labelStyle:h,labelShowBg:f,labelBgStyle:m,labelBgPadding:_,labelBgBorderRadius:g,data:s,style:p,sourceX:x,sourceY:v,targetX:S,targetY:k,sourcePosition:E,targetPosition:N,sourceHandleId:M,targetHandleId:R,markerStart:Ne,markerEnd:je,pathOptions:re,interactionWidth:ae}),ne&&Y.createElement(Y.Fragment,null,(ne==="source"||ne===!0)&&Y.createElement(F2,{position:E,centerX:x,centerY:v,radius:V,onMouseDown:Je=>qe(Je,!0),onMouseEnter:Qe,onMouseOut:Pe,type:"source"}),(ne==="target"||ne===!0)&&Y.createElement(F2,{position:N,centerX:S,centerY:k,radius:V,onMouseDown:Je=>qe(Je,!1),onMouseEnter:Qe,onMouseOut:Pe,type:"target"})))};return e.displayName="EdgeWrapper",A.memo(e)};function gP(t){return{default:Ns(t.default||ec),straight:Ns(t.bezier||Qh),step:Ns(t.step||Zh),smoothstep:Ns(t.step||Zl),simplebezier:Ns(t.simplebezier||Kh),...Object.keys(t).filter(e=>!["default","bezier"].includes(e)).reduce((e,n)=>(e[n]=Ns(t[n]||ec),e),{})}}function z2(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 B2(t,e){return t?t.length!==1&&e?e&&t.find(n=>n.id===e)||null:t[0]:null}function U2(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 _P=[{level:0,isMaxLevel:!0,edges:[]}];function bP(t,e,n){return function(o,r,s=!1){let i=-1;const a=o.reduce((c,d)=>{var m,_;const h=Vn(d.zIndex);let f=h?d.zIndex:0;if(s){const g=r.get(d.target),p=r.get(d.source),b=d.selected||(g==null?void 0:g.selected)||(p==null?void 0:p.selected),y=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?d.zIndex:0)+(b?y:0)}return c[f]?c[f].push(d):c[f]=[d],i=f>i?f:i,c},{}),l=Object.entries(a).map(([c,d])=>{const h=+c;return{edges:d,level:h,isMaxLevel:h===i}});return l.length===0?_P:l}(mt(A.useCallback(o=>t?o.edges.filter(r=>{const s=e.get(r.source),i=e.get(r.target);return(s==null?void 0:s.width)&&(s==null?void 0:s.height)&&(i==null?void 0:i.width)&&(i==null?void 0:i.height)&&function({sourcePos:a,targetPos:l,sourceWidth:c,sourceHeight:d,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+c,l.x+h),y2:Math.max(a.y+d,l.y+f)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const b=qh({x:(0-g[0])/g[2],y:(0-g[1])/g[2],width:m/g[2],height:_/g[2]}),y=Math.max(0,Math.min(b.x2,p.x2)-Math.max(b.x,p.x)),x=Math.max(0,Math.min(b.y2,p.y2)-Math.max(b.y,p.y));return Math.ceil(y*x)>0}({sourcePos:s.positionAbsolute||{x:0,y:0},targetPos:i.positionAbsolute||{x:0,y:0},sourceWidth:s.width,sourceHeight:s.height,targetWidth:i.width,targetHeight:i.height,width:o.width,height:o.height,transform:o.transform})}):o.edges,[t,e])),e,n)}const V2={[ys.Arrow]:({color:t="none",strokeWidth:e=1})=>Y.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})=>Y.createElement("polyline",{style:{stroke:t,fill:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},yP=({id:t,type:e,color:n,width:o=12.5,height:r=12.5,markerUnits:s="strokeWidth",strokeWidth:i,orient:a="auto-start-reverse"})=>{const l=function(c){const d=qt();return A.useMemo(()=>{var h,f;return Object.prototype.hasOwnProperty.call(V2,c)?V2[c]:((f=(h=d.getState()).onError)==null||f.call(h,"009",CR(c)),null)},[c])}(e);return l?Y.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"},Y.createElement(l,{color:n,strokeWidth:i})):null},$2=({defaultColor:t,rfId:e})=>{const n=mt(A.useCallback((({defaultColor:o,rfId:r})=>s=>{const i=[];return s.edges.reduce((a,l)=>([l.markerStart,l.markerEnd].forEach(c=>{if(c&&typeof c=="object"){const d=tf(c,r);i.includes(d)||(a.push({id:d,color:c.color||o,...c}),i.push(d))}}),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 Y.createElement("defs",null,n.map(o=>Y.createElement(yP,{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})))};$2.displayName="MarkerDefinitions";var xP=A.memo($2);const wP=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}),H2=({defaultMarkerColor:t,onlyRenderVisibleElements:e,elevateEdgesOnSelect:n,rfId:o,edgeTypes:r,noPanClassName:s,onEdgeContextMenu:i,onEdgeMouseEnter:a,onEdgeMouseMove:l,onEdgeMouseLeave:c,onEdgeClick:d,onEdgeDoubleClick:h,onReconnect:f,onReconnectStart:m,onReconnectEnd:_,reconnectRadius:g,children:p,disableKeyboardA11y:b})=>{const{edgesFocusable:y,edgesUpdatable:x,elementsSelectable:v,width:S,height:k,connectionMode:E,nodeInternals:N,onError:I}=mt(wP,on),T=bP(e,N,n);return S?Y.createElement(Y.Fragment,null,T.map(({level:M,edges:R,isMaxLevel:z})=>Y.createElement("svg",{key:M,style:{zIndex:M},width:S,height:k,className:"react-flow__edges react-flow__container"},z&&Y.createElement(xP,{defaultColor:t,rfId:o}),Y.createElement("g",null,R.map(D=>{const[F,B,V]=U2(N.get(D.source)),[O,C,$]=U2(N.get(D.target));if(!V||!$)return null;let j=D.type||"default";r[j]||(I==null||I("011",ER(j)),j="default");const W=r[j]||r.default,K=E===Or.Strict?C.target:(C.target??[]).concat(C.source??[]),Z=B2(B.source,D.sourceHandle),q=B2(K,D.targetHandle),ne=(Z==null?void 0:Z.position)||Ue.Bottom,re=(q==null?void 0:q.position)||Ue.Top,ae=!!(D.focusable||y&&D.focusable===void 0),X=D.reconnectable||D.updatable,ee=f!==void 0&&(X||x&&X===void 0);if(!Z||!q)return I==null||I("008",NR(Z,D)),null;const{sourceX:ce,sourceY:me,targetX:ue,targetY:pe}=((de,Ne,je,se,Ae,be)=>{const Re=z2(je,de,Ne),ze=z2(be,se,Ae);return{sourceX:Re.x,sourceY:Re.y,targetX:ze.x,targetY:ze.y}})(F,Z,ne,O,q,re);return Y.createElement(W,{key:D.id,id:D.id,className:hn([D.className,s]),type:j,data:D.data,selected:!!D.selected,animated:!!D.animated,hidden:!!D.hidden,label:D.label,labelStyle:D.labelStyle,labelShowBg:D.labelShowBg,labelBgStyle:D.labelBgStyle,labelBgPadding:D.labelBgPadding,labelBgBorderRadius:D.labelBgBorderRadius,style:D.style,source:D.source,target:D.target,sourceHandleId:D.sourceHandle,targetHandleId:D.targetHandle,markerEnd:D.markerEnd,markerStart:D.markerStart,sourceX:ce,sourceY:me,targetX:ue,targetY:pe,sourcePosition:ne,targetPosition:re,elementsSelectable:v,onContextMenu:i,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,onClick:d,onEdgeDoubleClick:h,onReconnect:f,onReconnectStart:m,onReconnectEnd:_,reconnectRadius:g,rfId:o,ariaLabel:D.ariaLabel,isFocusable:ae,isReconnectable:ee,pathOptions:"pathOptions"in D?D.pathOptions:void 0,interactionWidth:D.interactionWidth,disableKeyboardA11y:b})})))),p):null};H2.displayName="EdgeRenderer";var vP=A.memo(H2);const kP=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function SP({children:t}){const e=mt(kP);return Y.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:e}},t)}const CP={[Ue.Left]:Ue.Right,[Ue.Right]:Ue.Left,[Ue.Top]:Ue.Bottom,[Ue.Bottom]:Ue.Top},W2=({nodeId:t,handleType:e,style:n,type:o=nr.Bezier,CustomComponent:r,connectionStatus:s})=>{var k,E,N;const{fromNode:i,handleId:a,toX:l,toY:c,connectionMode:d}=mt(A.useCallback(I=>({fromNode:I.nodeInternals.get(t),handleId:I.connectionHandleId,toX:(I.connectionPosition.x-I.transform[0])/I.transform[2],toY:(I.connectionPosition.y-I.transform[1])/I.transform[2],connectionMode:I.connectionMode}),[t]),on),h=(k=i==null?void 0:i[Nt])==null?void 0:k.handleBounds;let f=h==null?void 0:h[e];if(d===Or.Loose&&(f=f||(h==null?void 0:h[e==="source"?"target":"source"])),!i||!f)return null;const m=a?f.find(I=>I.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,y=m==null?void 0:m.position,x=y?CP[y]:null;if(!y||!x)return null;if(r)return Y.createElement(r,{connectionLineType:o,connectionLineStyle:n,fromNode:i,fromHandle:m,fromX:p,fromY:b,toX:l,toY:c,fromPosition:y,toPosition:x,connectionStatus:s});let v="";const S={sourceX:p,sourceY:b,sourcePosition:y,targetX:l,targetY:c,targetPosition:x};return o===nr.Bezier?[v]=Zv(S):o===nr.Step?[v]=Xh({...S,borderRadius:0}):o===nr.SmoothStep?[v]=Xh(S):o===nr.SimpleBezier?[v]=Yv(S):v=`M${p},${b} ${l},${c}`,Y.createElement("path",{d:v,fill:"none",className:"react-flow__connection-path",style:n})};W2.displayName="ConnectionLine";const NP=t=>({nodeId:t.connectionNodeId,handleType:t.connectionHandleType,nodesConnectable:t.nodesConnectable,connectionStatus:t.connectionStatus,width:t.width,height:t.height});function jP({containerStyle:t,style:e,type:n,component:o}){const{nodeId:r,handleType:s,nodesConnectable:i,width:a,height:l,connectionStatus:c}=mt(NP,on);return r&&s&&a&&i?Y.createElement("svg",{style:t,width:a,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container"},Y.createElement("g",{className:hn(["react-flow__connection",c])},Y.createElement(W2,{nodeId:r,handleType:s,style:e,type:n,CustomComponent:o,connectionStatus:c}))):null}function q2(t,e){return A.useRef(null),qt(),A.useMemo(()=>e(t),[t])}const G2=({nodeTypes:t,edgeTypes:e,onMove:n,onMoveStart:o,onMoveEnd:r,onInit:s,onNodeClick:i,onEdgeClick:a,onNodeDoubleClick:l,onEdgeDoubleClick:c,onNodeMouseEnter:d,onNodeMouseMove:h,onNodeMouseLeave:f,onNodeContextMenu:m,onSelectionContextMenu:_,onSelectionStart:g,onSelectionEnd:p,connectionLineType:b,connectionLineStyle:y,connectionLineComponent:x,connectionLineContainerStyle:v,selectionKeyCode:S,selectionOnDrag:k,selectionMode:E,multiSelectionKeyCode:N,panActivationKeyCode:I,zoomActivationKeyCode:T,deleteKeyCode:M,onlyRenderVisibleElements:R,elementsSelectable:z,selectNodesOnDrag:D,defaultViewport:F,translateExtent:B,minZoom:V,maxZoom:O,preventScrolling:C,defaultMarkerColor:$,zoomOnScroll:j,zoomOnPinch:W,panOnScroll:K,panOnScrollSpeed:Z,panOnScrollMode:q,zoomOnDoubleClick:ne,panOnDrag:re,onPaneClick:ae,onPaneMouseEnter:X,onPaneMouseMove:ee,onPaneMouseLeave:ce,onPaneScroll:me,onPaneContextMenu:ue,onEdgeContextMenu:pe,onEdgeMouseEnter:de,onEdgeMouseMove:Ne,onEdgeMouseLeave:je,onReconnect:se,onReconnectStart:Ae,onReconnectEnd:be,reconnectRadius:Re,noDragClassName:ze,noWheelClassName:qe,noPanClassName:Qe,elevateEdgesOnSelect:Pe,disableKeyboardA11y:tt,nodeOrigin:Je,nodeExtent:nt,rfId:te})=>{const we=q2(t,dP),ke=q2(e,gP);return function(Le){const G=Qi(),ge=A.useRef(!1);A.useEffect(()=>{!ge.current&&G.viewportInitialized&&Le&&(setTimeout(()=>Le(G),1),ge.current=!0)},[Le,G.viewportInitialized])}(s),Y.createElement(cP,{onPaneClick:ae,onPaneMouseEnter:X,onPaneMouseMove:ee,onPaneMouseLeave:ce,onPaneContextMenu:ue,onPaneScroll:me,deleteKeyCode:M,selectionKeyCode:S,selectionOnDrag:k,selectionMode:E,onSelectionStart:g,onSelectionEnd:p,multiSelectionKeyCode:N,panActivationKeyCode:I,zoomActivationKeyCode:T,elementsSelectable:z,onMove:n,onMoveStart:o,onMoveEnd:r,zoomOnScroll:j,zoomOnPinch:W,zoomOnDoubleClick:ne,panOnScroll:K,panOnScrollSpeed:Z,panOnScrollMode:q,panOnDrag:re,defaultViewport:F,translateExtent:B,minZoom:V,maxZoom:O,onSelectionContextMenu:_,preventScrolling:C,noDragClassName:ze,noWheelClassName:qe,noPanClassName:Qe,disableKeyboardA11y:tt},Y.createElement(SP,null,Y.createElement(vP,{edgeTypes:ke,onEdgeClick:a,onEdgeDoubleClick:c,onlyRenderVisibleElements:R,onEdgeContextMenu:pe,onEdgeMouseEnter:de,onEdgeMouseMove:Ne,onEdgeMouseLeave:je,onReconnect:se,onReconnectStart:Ae,onReconnectEnd:be,reconnectRadius:Re,defaultMarkerColor:$,noPanClassName:Qe,elevateEdgesOnSelect:!!Pe,disableKeyboardA11y:tt,rfId:te},Y.createElement(jP,{style:y,type:b,component:x,containerStyle:v})),Y.createElement("div",{className:"react-flow__edgelabel-renderer"}),Y.createElement(hP,{nodeTypes:we,onNodeClick:i,onNodeDoubleClick:l,onNodeMouseEnter:d,onNodeMouseMove:h,onNodeMouseLeave:f,onNodeContextMenu:m,selectNodesOnDrag:D,onlyRenderVisibleElements:R,noPanClassName:Qe,noDragClassName:ze,disableKeyboardA11y:tt,nodeOrigin:Je,nodeExtent:nt,rfId:te})))};G2.displayName="GraphView";var EP=A.memo(G2);const pf=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],sr={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:pf,nodeExtent:pf,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Or.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},IP=()=>((t,e)=>t?Tv(t,e):Tv)((t,e)=>({...sr,setNodes:n=>{const{nodeInternals:o,nodeOrigin:r,elevateNodesOnSelect:s}=e();t({nodeInternals:cf(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?cf(n,new Map,e().nodeOrigin,e().elevateNodesOnSelect):new Map;t({nodeInternals:i,edges:s?o:[],hasDefaultNodes:r,hasDefaultEdges:s})},updateNodeDimensions:n=>{const{onNodesChange:o,nodeInternals:r,fitViewOnInit:s,fitViewOnInitDone:i,fitViewOnInitOptions:a,domNode:l,nodeOrigin:c}=e(),d=l==null?void 0:l.querySelector(".react-flow__viewport");if(!d)return;const h=window.getComputedStyle(d),{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 y=Hh(p.nodeElement);!(!y.width||!y.height||b.width===y.width&&b.height===y.height&&!p.forceUpdate)&&(r.set(b.id,{...b,[Nt]:{...b[Nt],handleBounds:{source:M2(".source",p.nodeElement,f,c),target:M2(".target",p.nodeElement,f,c)}},...y}),g.push({id:b.id,type:"dimensions",dimensions:y}))}return g},[]);w2(r,c);const _=i||s&&!i&&v2(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 c=cf(j2(n,a()),r,i,l);t({nodeInternals:c})}o==null||o(n)}},addSelectedNodes:n=>{const{multiSelectionActive:o,edges:r,getNodes:s}=e();let i,a=null;o?i=n.map(l=>rr(l,!0)):(i=Ss(s(),n),a=Ss(r,[])),nc({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=>rr(l,!0)):(i=Ss(r,n),a=Ss(s(),[])),nc({changedNodes:a,changedEdges:i,get:e,set:t})},unselectNodesAndEdges:({nodes:n,edges:o}={})=>{const{edges:r,getNodes:s}=e(),i=o||r;nc({changedNodes:(n||s()).map(a=>(a.selected=!1,rr(a.id,!1))),changedEdges:i.map(a=>rr(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();nc({changedNodes:o().filter(r=>r.selected).map(r=>rr(r.id,!1)),changedEdges:n.filter(r=>r.selected).map(r=>rr(r.id,!1)),get:e,set:t})},setNodeExtent:n=>{const{nodeInternals:o}=e();o.forEach(r=>{r.positionAbsolute=Wh(r.position,n)}),t({nodeExtent:n,nodeInternals:new Map(o)})},panBy:n=>{const{transform:o,width:r,height:s,d3Zoom:i,d3Selection:a,translateExtent:l}=e();if(!i||!a||!n.x&&!n.y)return!1;const c=yr.translate(o[0]+n.x,o[1]+n.y).scale(o[2]),d=[[0,0],[r,s]],h=i==null?void 0:i.constrain()(c,d,l);return i.transform(a,h),o[0]!==h.x||o[1]!==h.y||o[2]!==h.k},cancelConnection:()=>t({connectionNodeId:sr.connectionNodeId,connectionHandleId:sr.connectionHandleId,connectionHandleType:sr.connectionHandleType,connectionStatus:sr.connectionStatus,connectionStartHandle:sr.connectionStartHandle,connectionEndHandle:sr.connectionEndHandle}),reset:()=>t({...sr})}),Object.is),gf=({children:t})=>{const e=A.useRef(null);return e.current||(e.current=IP()),Y.createElement(wR,{value:e.current},t)};gf.displayName="ReactFlowProvider";const Y2=({children:t})=>A.useContext(Yl)?Y.createElement(Y.Fragment,null,t):Y.createElement(gf,null,t);Y2.displayName="ReactFlowWrapper";const AP={input:u2,default:af,output:f2,group:lf},TP={default:ec,straight:Qh,step:Zh,smoothstep:Zl,simplebezier:Kh},MP=[0,0],OP=[15,15],DP={x:0,y:0,zoom:1},RP={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},_f=A.forwardRef(({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:s=AP,edgeTypes:i=TP,onNodeClick:a,onEdgeClick:l,onInit:c,onMove:d,onMoveStart:h,onMoveEnd:f,onConnect:m,onConnectStart:_,onConnectEnd:g,onClickConnectStart:p,onClickConnectEnd:b,onNodeMouseEnter:y,onNodeMouseMove:x,onNodeMouseLeave:v,onNodeContextMenu:S,onNodeDoubleClick:k,onNodeDragStart:E,onNodeDrag:N,onNodeDragStop:I,onNodesDelete:T,onEdgesDelete:M,onSelectionChange:R,onSelectionDragStart:z,onSelectionDrag:D,onSelectionDragStop:F,onSelectionContextMenu:B,onSelectionStart:V,onSelectionEnd:O,connectionMode:C=Or.Strict,connectionLineType:$=nr.Bezier,connectionLineStyle:j,connectionLineComponent:W,connectionLineContainerStyle:K,deleteKeyCode:Z="Backspace",selectionKeyCode:q="Shift",selectionOnDrag:ne=!1,selectionMode:re=Ki.Full,panActivationKeyCode:ae="Space",multiSelectionKeyCode:X=Kl()?"Meta":"Control",zoomActivationKeyCode:ee=Kl()?"Meta":"Control",snapToGrid:ce=!1,snapGrid:me=OP,onlyRenderVisibleElements:ue=!1,selectNodesOnDrag:pe=!0,nodesDraggable:de,nodesConnectable:Ne,nodesFocusable:je,nodeOrigin:se=MP,edgesFocusable:Ae,edgesUpdatable:be,elementsSelectable:Re,defaultViewport:ze=DP,minZoom:qe=.5,maxZoom:Qe=2,translateExtent:Pe=pf,preventScrolling:tt=!0,nodeExtent:Je,defaultMarkerColor:nt="#b1b1b7",zoomOnScroll:te=!0,zoomOnPinch:we=!0,panOnScroll:ke=!1,panOnScrollSpeed:Le=.5,panOnScrollMode:G=tr.Free,zoomOnDoubleClick:ge=!0,panOnDrag:_e=!0,onPaneClick:fe,onPaneMouseEnter:le,onPaneMouseMove:Ve,onPaneMouseLeave:Fe,onPaneScroll:Ke,onPaneContextMenu:ie,children:Se,onEdgeContextMenu:Ee,onEdgeDoubleClick:Be,onEdgeMouseEnter:Ye,onEdgeMouseMove:Oe,onEdgeMouseLeave:He,onEdgeUpdate:it,onEdgeUpdateStart:Xe,onEdgeUpdateEnd:ot,onReconnect:yt,onReconnectStart:bt,onReconnectEnd:Mt,reconnectRadius:xt=10,edgeUpdaterRadius:rn=10,onNodesChange:Nn,onEdgesChange:fn,noDragClassName:sn="nodrag",noWheelClassName:Zt="nowheel",noPanClassName:to="nopan",fitView:po=!1,fitViewOptions:Es,connectOnClick:Is=!0,attributionPosition:As,proOptions:Ts,defaultEdgeOptions:Ms,elevateNodesOnSelect:ir=!0,elevateEdgesOnSelect:Os=!1,disableKeyboardA11y:Ds=!1,autoPanOnConnect:Rs=!0,autoPanOnNodeDrag:zt=!0,connectionRadius:wt=20,isValidConnection:jn,onError:En,style:Ps,id:ac,nodeDragThreshold:lm,...cm},lc)=>{const dm=ac||"1";return Y.createElement("div",{...cm,style:{...Ps,...RP},ref:lc,className:hn(["react-flow",r]),"data-testid":"rf__wrapper",id:ac},Y.createElement(Y2,null,Y.createElement(EP,{onInit:c,onMove:d,onMoveStart:h,onMoveEnd:f,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:y,onNodeMouseMove:x,onNodeMouseLeave:v,onNodeContextMenu:S,onNodeDoubleClick:k,nodeTypes:s,edgeTypes:i,connectionLineType:$,connectionLineStyle:j,connectionLineComponent:W,connectionLineContainerStyle:K,selectionKeyCode:q,selectionOnDrag:ne,selectionMode:re,deleteKeyCode:Z,multiSelectionKeyCode:X,panActivationKeyCode:ae,zoomActivationKeyCode:ee,onlyRenderVisibleElements:ue,selectNodesOnDrag:pe,defaultViewport:ze,translateExtent:Pe,minZoom:qe,maxZoom:Qe,preventScrolling:tt,zoomOnScroll:te,zoomOnPinch:we,zoomOnDoubleClick:ge,panOnScroll:ke,panOnScrollSpeed:Le,panOnScrollMode:G,panOnDrag:_e,onPaneClick:fe,onPaneMouseEnter:le,onPaneMouseMove:Ve,onPaneMouseLeave:Fe,onPaneScroll:Ke,onPaneContextMenu:ie,onSelectionContextMenu:B,onSelectionStart:V,onSelectionEnd:O,onEdgeContextMenu:Ee,onEdgeDoubleClick:Be,onEdgeMouseEnter:Ye,onEdgeMouseMove:Oe,onEdgeMouseLeave:He,onReconnect:yt??it,onReconnectStart:bt??Xe,onReconnectEnd:Mt??ot,reconnectRadius:xt??rn,defaultMarkerColor:nt,noDragClassName:sn,noWheelClassName:Zt,noPanClassName:to,elevateEdgesOnSelect:Os,rfId:dm,disableKeyboardA11y:Ds,nodeOrigin:se,nodeExtent:Je}),Y.createElement(HR,{nodes:t,edges:e,defaultNodes:n,defaultEdges:o,onConnect:m,onConnectStart:_,onConnectEnd:g,onClickConnectStart:p,onClickConnectEnd:b,nodesDraggable:de,nodesConnectable:Ne,nodesFocusable:je,edgesFocusable:Ae,edgesUpdatable:be,elementsSelectable:Re,elevateNodesOnSelect:ir,minZoom:qe,maxZoom:Qe,nodeExtent:Je,onNodesChange:Nn,onEdgesChange:fn,snapToGrid:ce,snapGrid:me,connectionMode:C,translateExtent:Pe,connectOnClick:Is,defaultEdgeOptions:Ms,fitView:po,fitViewOptions:Es,onNodesDelete:T,onEdgesDelete:M,onNodeDragStart:E,onNodeDrag:N,onNodeDragStop:I,onSelectionDrag:D,onSelectionDragStart:z,onSelectionDragStop:F,noPanClassName:to,nodeOrigin:se,rfId:dm,autoPanOnConnect:Rs,autoPanOnNodeDrag:zt,onError:En,connectionRadius:wt,isValidConnection:jn,nodeDragThreshold:lm}),Y.createElement(VR,{onSelectionChange:R}),Se,Y.createElement(TR,{proOptions:Ts,position:As}),Y.createElement(YR,{rfId:dm,disableKeyboardA11y:Ds})))});function J2(t){return e=>{const[n,o]=A.useState(e),r=A.useCallback(s=>o(i=>t(s,i)),[]);return[n,o,r]}}_f.displayName="ReactFlow";const K2=J2(j2),X2=J2(function(t,e){return N2(t,e)});function PP(){return Y.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},Y.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function LP(){return Y.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},Y.createElement("path",{d:"M0 0h32v4.2H0z"}))}function FP(){return Y.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},Y.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 zP(){return Y.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},Y.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 BP(){return Y.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},Y.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 js=({children:t,className:e,...n})=>Y.createElement("button",{type:"button",className:hn(["react-flow__controls-button",e]),...n},t);js.displayName="ControlButton";const UP=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom}),Z2=({style:t,showZoom:e=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:s,onZoomOut:i,onFitView:a,onInteractiveChange:l,className:c,children:d,position:h="bottom-left"})=>{const f=qt(),[m,_]=A.useState(!1),{isInteractive:g,minZoomReached:p,maxZoomReached:b}=mt(UP,on),{zoomIn:y,zoomOut:x,fitView:v}=Qi();return A.useEffect(()=>{_(!0)},[]),m?Y.createElement(Jl,{className:hn(["react-flow__controls",c]),position:h,style:t,"data-testid":"rf__controls"},e&&Y.createElement(Y.Fragment,null,Y.createElement(js,{onClick:()=>{y(),s==null||s()},className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:b},Y.createElement(PP,null)),Y.createElement(js,{onClick:()=>{x(),i==null||i()},className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:p},Y.createElement(LP,null))),n&&Y.createElement(js,{className:"react-flow__controls-fitview",onClick:()=>{v(r),a==null||a()},title:"fit view","aria-label":"fit view"},Y.createElement(FP,null)),o&&Y.createElement(js,{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?Y.createElement(BP,null):Y.createElement(zP,null)),d):null};Z2.displayName="Controls";var $n,VP=A.memo(Z2);function $P({color:t,dimensions:e,lineWidth:n}){return Y.createElement("path",{stroke:t,strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})}function HP({color:t,radius:e}){return Y.createElement("circle",{cx:e,cy:e,r:e,fill:t})}(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})($n||($n={}));const WP={[$n.Dots]:"#91919a",[$n.Lines]:"#eee",[$n.Cross]:"#e2e2e2"},qP={[$n.Dots]:1,[$n.Lines]:1,[$n.Cross]:6},GP=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function Q2({id:t,variant:e=$n.Dots,gap:n=20,size:o,lineWidth:r=1,offset:s=2,color:i,style:a,className:l}){const c=A.useRef(null),{transform:d,patternId:h}=mt(GP,on),f=i||WP[e],m=o||qP[e],_=e===$n.Dots,g=e===$n.Cross,p=Array.isArray(n)?n:[n,n],b=[p[0]*d[2]||1,p[1]*d[2]||1],y=m*d[2],x=g?[y,y]:b,v=_?[y/s,y/s]:[x[0]/s,x[1]/s];return Y.createElement("svg",{className:hn(["react-flow__background",l]),style:{...a,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:c,"data-testid":"rf__background"},Y.createElement("pattern",{id:h+t,x:d[0]%b[0],y:d[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${v[0]},-${v[1]})`},_?Y.createElement(HP,{color:f,radius:y/s}):Y.createElement($P,{dimensions:x,color:f,lineWidth:r})),Y.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${h+t})`}))}Q2.displayName="Background";var YP=A.memo(Q2);function bf(t){return Math.min(11*t+35,200)}const ek=Y.createContext("LR"),tk=A.memo(t=>{const e=J.c(51),{data:n,selected:o}=t,r=$e(n.atom),s=Kc().inOrderIds.indexOf(r.id),i=o?"var(--gray-9)":"var(--gray-3)",a=mt(JP),l=A.use(ek);let c,d,h,f,m;if(e[0]!==r.code||e[1]!==i||e[2]!==l||e[3]!==o){const M=r.code.split(`
142
142
  `).length,R=l==="LR"?Ue.Left:Ue.Top;let z;e[8]!==i?(z={background:i},e[8]=i,e[9]=z):z=e[9],e[10]!==R||e[11]!==z?(h=u.jsx(or,{type:"target",id:"inputs",position:R,style:z}),e[10]=R,e[11]=z,e[12]=h):h=e[12];const D=l==="LR"?Ue.Left:Ue.Top;let F;e[13]!==i?(F={background:i},e[13]=i,e[14]=F):F=e[14],e[15]!==D||e[16]!==F?(f=u.jsx(or,{type:"source",id:"inputs",position:D,style:F}),e[15]=D,e[16]=F,e[17]=f):f=e[17];const B=o&&"border-primary";e[18]!==B?(d=Ie("flex flex-col bg-card border border-input/50 rounded-md mx-[2px] overflow-hidden",B),e[18]=B,e[19]=d):d=e[19],c=bf(M),e[0]=r.code,e[1]=i,e[2]=l,e[3]=o,e[4]=c,e[5]=d,e[6]=h,e[7]=f}else c=e[4],d=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]!==c||e[24]!==m?(g={height:c,width:m},e[23]=c,e[24]=m,e[25]=g):g=e[25];const p=t$(r.name,s);let b,y,x;e[26]!==p?(b=u.jsx("div",{className:"text-muted-foreground font-semibold text-xs py-1 px-2 bg-muted border-b",children:p}),e[26]=p,e[27]=b):b=e[27],e[28]!==r.code?(y=u.jsx(PH,{code:r.code}),e[28]=r.code,e[29]=y):y=e[29],e[30]!==d||e[31]!==g||e[32]!==b||e[33]!==y?(x=u.jsxs("div",{className:d,style:g,children:[b,y]}),e[30]=d,e[31]=g,e[32]=b,e[33]=y,e[34]=x):x=e[34];const v=l==="LR"?Ue.Right:Ue.Bottom;let S,k;e[35]!==i?(S={background:i},e[35]=i,e[36]=S):S=e[36],e[37]!==v||e[38]!==S?(k=u.jsx(or,{type:"source",id:"outputs",position:v,style:S}),e[37]=v,e[38]=S,e[39]=k):k=e[39];const E=l==="LR"?Ue.Right:Ue.Bottom;let N,I,T;return e[40]!==i?(N={background:i},e[40]=i,e[41]=N):N=e[41],e[42]!==E||e[43]!==N?(I=u.jsx(or,{type:"target",id:"outputs",position:E,style:N}),e[42]=E,e[43]=N,e[44]=I):I=e[44],e[45]!==x||e[46]!==k||e[47]!==I||e[48]!==h||e[49]!==f?(T=u.jsxs("div",{children:[h,f,x,k,I]}),e[45]=x,e[46]=k,e[47]=I,e[48]=h,e[49]=f,e[50]=T):T=e[50],T},(t,e)=>["data","selected","id"].every(n=>t[n]===e[n]));tk.displayName="CustomNode";const nk={custom:tk};function JP(t){const{width:e}=t;return e}const ok=t=>{const e=J.c(18),{maxCount:n,cellIds:o,onClick:r,skipScroll:s}=t,i=Kc();let a,l,c,d;if(e[0]!==o||e[1]!==i||e[2]!==n||e[3]!==r||e[4]!==s){c=Symbol.for("react.early_return_sentinel");e:{let h;e[8]!==i?(h=(_,g)=>i.inOrderIds.indexOf(_)-i.inOrderIds.indexOf(g),e[8]=i,e[9]=h):h=e[9];const f=[...o].sort(h);if(o.length===0){let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=u.jsx("div",{className:"text-muted-foreground",children:"--"}),e[10]=_):_=e[10],c=_;break e}let m;e[11]!==o.length||e[12]!==r||e[13]!==s?(m=(_,g)=>u.jsxs("span",{className:"truncate",children:[u.jsx(gr,{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&&u.jsxs(Ur,{children:[u.jsx(ti,{asChild:!0,children:u.jsxs("span",{className:"whitespace-nowrap text-muted-foreground text-xs hover:underline cursor-pointer",children:["+",o.length-n," more"]})}),u.jsx(Js,{className:"w-auto",children:u.jsx("div",{className:"flex flex-col gap-1 py-1",children:f.slice(n).map(_=>u.jsx(gr,{variant:"focus",cellId:_,className:"whitespace-nowrap",onClick:r?()=>r(_):void 0},_))})})]})}e[0]=o,e[1]=i,e[2]=n,e[3]=r,e[4]=s,e[5]=a,e[6]=l,e[7]=c}else a=e[5],l=e[6],c=e[7];return c!==Symbol.for("react.early_return_sentinel")?c:(e[15]!==a||e[16]!==l?(d=u.jsxs(u.Fragment,{children:[a,l]}),e[15]=a,e[16]=l,e[17]=d):d=e[17],d)},yf=t=>{const e=J.c(15);let n,o,r,s;e[0]!==t?({name:o,declaredBy:n,onClick:r,...s}=t,e[0]=t,e[1]=n,e[2]=o,e[3]=r,e[4]=s):(n=e[1],o=e[2],r=e[3],s=e[4]);const i=n.length>1?"destructive":"outline";let a,l,c;return e[5]!==o||e[6]!==r?(a=async d=>{r?r(d):(await xn(o),lt({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=u.jsx(_S,{title:o,variant:i,className:"rounded-sm text-ellipsis block overflow-hidden max-w-fit cursor-pointer font-medium",onClick:a,children:o}),e[8]=o,e[9]=i,e[10]=a,e[11]=l):l=e[11],e[12]!==s||e[13]!==l?(c=u.jsx("div",{className:"max-w-[130px]",...s,children:l}),e[12]=s,e[13]=l,e[14]=c):c=e[14],c},xf=A.memo(t=>{const e=J.c(38),{onChange:n,view:o,settings:r,onSettingsChange:s}=t;let i;e[0]!==s||e[1]!==r?(i=(D,F)=>{s({...r,[D]:F})},e[0]=s,e[1]=r,e[2]=i):i=e[2];const a=i;let l,c,d,h,f,m;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx(ti,{asChild:!0,children:u.jsx(Me,{variant:"text",size:"xs",children:u.jsx(Im,{className:"w-4 h-4"})})}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx("div",{className:"font-semibold pb-4",children:"Settings"}),e[4]=c):c=e[4],e[5]!==a?(d=D=>a("hidePureMarkdown",!!D),e[5]=a,e[6]=d):d=e[6],e[7]!==r.hidePureMarkdown||e[8]!==d?(h=u.jsx(X4,{"data-testid":"hide-pure-markdown-checkbox",id:"hide-pure-markdown",checked:r.hidePureMarkdown,onCheckedChange:d}),e[7]=r.hidePureMarkdown,e[8]=d,e[9]=h):h=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsx(Fr,{htmlFor:"hide-pure-markdown",children:"Hide pure markdown"}),e[10]=f):f=e[10],e[11]!==h?(m=u.jsxs(Ur,{children:[l,u.jsxs(Js,{className:"w-auto p-2 text-muted-foreground",children:[c,u.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,y;e[13]!==n?(p=()=>n("_minimap_"),e[13]=n,e[14]=p):p=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(Jp,{className:"w-4 h-4 mr-1"}),e[15]=b):b=e[15],e[16]!==g||e[17]!==p?(y=u.jsxs(Me,{variant:"outline",className:"bg-background","aria-selected":g,size:"xs",onClick:p,children:[b,"Mini Map"]}),e[16]=g,e[17]=p,e[18]=y):y=e[18];const x=o==="TB";let v,S,k;e[19]!==n?(v=()=>n("TB"),e[19]=n,e[20]=v):v=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(S=u.jsx(Ta,{className:"w-4 h-4 mr-1"}),e[21]=S):S=e[21],e[22]!==x||e[23]!==v?(k=u.jsxs(Me,{variant:"outline",className:"bg-background","aria-selected":x,size:"xs",onClick:v,children:[S,"Vertical Tree"]}),e[22]=x,e[23]=v,e[24]=k):k=e[24];const E=o==="LR";let N,I,T,M;e[25]!==n?(N=()=>n("LR"),e[25]=n,e[26]=N):N=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(I=u.jsx(Ta,{className:"w-4 h-4 mr-1 transform -rotate-90"}),e[27]=I):I=e[27],e[28]!==E||e[29]!==N?(T=u.jsxs(Me,{variant:"outline",className:"bg-background","aria-selected":E,size:"xs",onClick:N,children:[I," ","Horizontal Tree"]}),e[28]=E,e[29]=N,e[30]=T):T=e[30],e[31]!==y||e[32]!==k||e[33]!==T?(M=u.jsxs("div",{className:"flex gap-2",children:[y,k,T]}),e[31]=y,e[32]=k,e[33]=T,e[34]=M):M=e[34];const R=o!=="_minimap_"&&_;let z;return e[35]!==M||e[36]!==R?(z=u.jsxs(Jl,{position:"top-right",className:"flex flex-col items-end gap-2",children:[M,R]}),e[35]=M,e[36]=R,e[37]=z):z=e[37],z});xf.displayName="GraphToolbar";const rc=A.memo(t=>{const e=J.c(11),{selection:n,variables:o,onClearSelection:r}=t;if(!n)return null;const s=KP;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 d=Object.values(o).filter(m=>m.usedBy.includes(n.id)),h=Object.values(o).filter(m=>m.declaredBy.includes(n.id)),f=(m,_)=>u.jsxs(u.Fragment,{children:[m.length===0&&u.jsx("div",{className:"text-muted-foreground text-sm text-center",children:"--"}),u.jsx("div",{className:"grid grid-cols-5 gap-3 items-center text-sm py-1 flex-1 empty:hidden",children:m.map(g=>u.jsxs(Y.Fragment,{children:[u.jsx(yf,{declaredBy:g.declaredBy,name:g.name}),u.jsxs("div",{className:"truncate col-span-2",title:g.value??"",children:[g.value,u.jsxs("span",{className:"ml-1 truncate text-foreground/60 font-mono",children:["(",g.dataType,")"]})]}),u.jsx("div",{className:"truncate col-span-2 gap-1 items-center",children:u.jsx(ok,{skipScroll:!0,onClick:()=>s(_==="in"?g.declaredBy[0]:g.usedBy[0],g.name),maxCount:3,cellIds:g.usedBy})})]},g.name))})]});return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[u.jsx(dc,{className:"w-5 h-5"}),u.jsx(gr,{cellId:n.id}),u.jsx("div",{className:"flex-1"}),u.jsx(A0,{cellId:n.id,children:u.jsx(Me,{variant:"ghost",size:"icon",children:u.jsx(sd,{className:"w-4 h-4"})})}),u.jsx(Me,{variant:"text",size:"icon",onClick:()=>{r()},children:u.jsx(oo,{className:"w-4 h-4"})})]}),u.jsxs("div",{className:"text-sm flex flex-col py-3 pl-2 pr-4 flex-1 justify-center",children:[u.jsxs("div",{className:"flex flex-col gap-2",children:[u.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[u.jsx(gn,{className:"w-4 h-4"}),"Outputs"]}),f(h,"out")]}),u.jsx("hr",{className:"border-divider my-3"}),u.jsxs("div",{className:"flex flex-col gap-2",children:[u.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[u.jsx(_p,{className:"w-4 h-4"}),"Inputs"]}),f(d,"in")]})]})]})}if(n.type==="edge"){const d=Object.values(o).filter(h=>h.declaredBy.includes(n.source)&&h.usedBy.includes(n.target));return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[u.jsx(Oa,{className:"w-4 h-4"}),u.jsx(gr,{cellId:n.source}),u.jsx(nd,{className:"w-4 h-4"}),u.jsx(gr,{cellId:n.target})]}),u.jsx("div",{className:"grid grid-cols-4 gap-3 max-w-[350px] items-center text-sm p-3 flex-1",children:d.map(h=>u.jsxs(Y.Fragment,{children:[u.jsx(yf,{declaredBy:h.declaredBy,name:h.name,onClick:()=>{s(h.declaredBy[0],h.name)}}),u.jsx("div",{className:"truncate text-foreground/60 font-mono",children:h.dataType}),u.jsx("div",{className:"truncate col-span-2",title:h.value??"",children:h.value})]},h.name))})]})}},e[0]=r,e[1]=n.id,e[2]=n.source,e[3]=n.target,e[4]=n.type,e[5]=o,e[6]=i):i=e[6];const a=i;let l,c;return e[7]!==a?(l=a(),e[7]=a,e[8]=l):l=e[8],e[9]!==l?(c=u.jsx(Jl,{position:"bottom-left",className:"max-h-[90%] flex flex-col w-[calc(100%-5rem)]",children:u.jsx("div",{className:"min-h-[100px] shadow-md rounded-md border max-w-[550px] border-primary/40 my-4 min-w-[240px] bg-[var(--slate-1)] text-muted-foreground/80 flex flex-col overflow-y-auto",children:l})}),e[9]=l,e[10]=c):c=e[10],c});function KP(t,e){const n=hc(t);n&&tp(n,e)}function rk(){const t=J.c(7),e=Qi(),n=mt(ZP),o=mt(XP);let r;t[0]!==e?(r=()=>{e.fitView({duration:100})},t[0]=e,t[1]=r):r=t[1];const s=n$(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]),A.useEffect(i,a)}function XP(t){const{height:e}=t;return e}function ZP(t){const{width:e}=t;return e}rc.displayName="GraphSelectionPanel";const sk=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:bf(dt.get(e).code.trim().split(`
143
143
  `).length),position:{x:0,y:n+20}}}createElements(t,e,n,o){let r=0;const s=[],i=[];for(const[l,c]of Qm.zip(t,e)){const d=this.createNode(l,c,r);s.push(d),r=d.position.y+(d.height||0)}const a=new Set;for(const l of Object.values(n)){const{declaredBy:c,usedBy:d}=l;for(const h of c)for(const f of d){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}}},QP=t=>{const e=J.c(37),{cellIds:n,variables:o,cellAtoms:r,children:s}=t;let i;e[0]!==r||e[1]!==n||e[2]!==o?(i=sk.createElements(n,r,o,!1),e[0]=r,e[1]=n,e[2]=o,e[3]=i):i=e[3];const{nodes:a,edges:l}=i;let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=[],e[4]=c):c=e[4];const[d,h]=X2(c),[f,m]=K2(a),[_,g]=A.useState(),[p,b]=A.useState(),y=A.useRef(!1);rk();const x=mt(eL);let v;e[5]!==h||e[6]!==m?(v=C=>{m(C.nodes),h([])},e[5]=h,e[6]=m,e[7]=v):v=e[7];const S=et(v);let k,E,N,I;e[8]!==r||e[9]!==n||e[10]!==S||e[11]!==o?(k=()=>{y.current?S(sk.createElements(n,r,o,!1)):y.current=!0},E=[n,o,r,S],e[8]=r,e[9]=n,e[10]=S,e[11]=o,e[12]=k,e[13]=E):(k=e[12],E=e[13]),A.useEffect(k,E),e[14]!==l||e[15]!==_||e[16]!==h?(N=()=>{if(_){const C=l.filter($=>{const{source:j,target:W,data:K}=$;return j===_&&K.direction==="outputs"||W===_&&K.direction==="inputs"});h(C)}},I=[_,h,l],e[14]=l,e[15]=_,e[16]=h,e[17]=N,e[18]=I):(N=e[17],I=e[18]),A.useEffect(N,I);const T=function(C,$){const j=J.c(17);let W,K;if(j[0]!==$||j[1]!==C){let ee;j[3]!==$?(ee=(ce,me)=>{const{position:ue}=me;return Math.min(ce,ue.y-$/2-10)},j[3]=$,j[4]=ee):ee=j[4],K=C.reduce(ee,Number.POSITIVE_INFINITY),j[0]=$,j[1]=C,j[2]=K}else K=j[2];const Z=K;let q;if(j[5]!==$||j[6]!==C){let ee;j[8]!==$?(ee=(ce,me)=>{const{position:ue}=me;return Math.max(ce,ue.y+$/2+10)},j[8]=$,j[9]=ee):ee=j[9],q=C.reduce(ee,Number.NEGATIVE_INFINITY),j[5]=$,j[6]=C,j[7]=q}else q=j[7];const ne=q;let re,ae,X;return j[10]!==Z?(re=[Number.NEGATIVE_INFINITY,Z],j[10]=Z,j[11]=re):re=j[11],j[12]!==ne?(ae=[Number.POSITIVE_INFINITY,ne],j[12]=ne,j[13]=ae):ae=j[13],j[14]!==re||j[15]!==ae?(X=[re,ae],j[14]=re,j[15]=ae,j[16]=X):X=j[16],W=X,W}(f,x);let M;e[19]===Symbol.for("react.memo_cache_sentinel")?(M=()=>{g(void 0),b(void 0)},e[19]=M):M=e[19];const R=M;let z;e[20]!==d||e[21]!==p||e[22]!==_||e[23]!==o?(z=()=>p?u.jsx(rc,{selection:{type:"edge",source:p.source,target:p.target},onClearSelection:R,variables:o,edges:d}):_?u.jsx(rc,{selection:{type:"node",id:_},variables:o,edges:d,onClearSelection:R}):null,e[20]=d,e[21]=p,e[22]=_,e[23]=o,e[24]=z):z=e[24];const D=z;let F,B,V,O;return e[25]!==h?(F=(C,$)=>{const j=$.id;g(j),b(void 0),h([])},e[25]=h,e[26]=F):F=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(B=(C,$)=>{b($)},e[27]=B):B=e[27],e[28]!==D?(V=D(),e[28]=D,e[29]=V):V=e[29],e[30]!==s||e[31]!==d||e[32]!==f||e[33]!==F||e[34]!==V||e[35]!==T?(O=u.jsxs(_f,{nodes:f,edges:d,nodeTypes:nk,translateExtent:T,onNodeClick:F,onNodeDoubleClick:tL,onEdgeClick:B,snapToGrid:!0,fitView:!0,elementsSelectable:!0,minZoom:1,maxZoom:1,draggable:!1,panOnScrollMode:tr.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:[V,s]}),e[30]=s,e[31]=d,e[32]=f,e[33]=F,e[34]=V,e[35]=T,e[36]=O):O=e[36],O};function eL(t){const{height:e}=t;return e}function tL(t,e){bS(e.id,"focus")}var wf,ik,ak,lk,ck,dk,vf,uk,kf,hk,Sf,fk,Cf,mk,Nf,pk,jf,gk,Ef,_k,If,bk,Af,yk,Tf,xk,Mf,wk,Of,vk,Df,kk,Rf,Sk,Ck,Nk,jk,Ek,Ik,Ak,Pf,Tk,Lf,Mk,Ff,Ok,zf,Dk,Bf,Rk,Uf,Pk,Vf,Lk,$f,Fk,Hf,zk,Wf,Bk,qf,Uk,Gf,Vk,Yf,$k,Jf,Hk,Wk,qk,Gk,Yk,Jk,Kk,Kf,Xk,Xf,Zk,Qk,e3,Zf,t3,Qf,n3,em,o3,tm,r3,nm,s3,i3,a3,l3,c3;function om(){if(ik)return wf;ik=1;var t="\0";function e(s,i){s[i]?s[i]++:s[i]=1}function n(s,i){--s[i]||delete s[i]}function o(s,i,a,l){var c=""+i,d=""+a;if(!s&&c>d){var h=c;c=d,d=h}return c+""+d+""+(l===void 0?"\0":l)}function r(s,i){return o(s,i.v,i.w,i.name)}return wf=class{constructor(s){Q(this,"_isDirected",!0);Q(this,"_isMultigraph",!1);Q(this,"_isCompound",!1);Q(this,"_label");Q(this,"_defaultNodeLabelFn",()=>{});Q(this,"_defaultEdgeLabelFn",()=>{});Q(this,"_nodes",{});Q(this,"_in",{});Q(this,"_preds",{});Q(this,"_out",{});Q(this,"_sucs",{});Q(this,"_edgeObjs",{});Q(this,"_edgeLabels",{});Q(this,"_nodeCount",0);Q(this,"_edgeCount",0);Q(this,"_parent");Q(this,"_children");s&&(this._isDirected=!Object.hasOwn(s,"directed")||s.directed,this._isMultigraph=!!Object.hasOwn(s,"multigraph")&&s.multigraph,this._isCompound=!!Object.hasOwn(s,"compound")&&s.compound),this._isCompound&&(this._parent={},this._children={},this._children[t]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(s){return this._label=s,this}graph(){return this._label}setDefaultNodeLabel(s){return this._defaultNodeLabelFn=s,typeof s!="function"&&(this._defaultNodeLabelFn=()=>s),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var s=this;return this.nodes().filter(i=>Object.keys(s._in[i]).length===0)}sinks(){var s=this;return this.nodes().filter(i=>Object.keys(s._out[i]).length===0)}setNodes(s,i){var a=arguments,l=this;return s.forEach(function(c){a.length>1?l.setNode(c,i):l.setNode(c)}),this}setNode(s,i){return Object.hasOwn(this._nodes,s)?(arguments.length>1&&(this._nodes[s]=i),this):(this._nodes[s]=arguments.length>1?i:this._defaultNodeLabelFn(s),this._isCompound&&(this._parent[s]=t,this._children[s]={},this._children[t][s]=!0),this._in[s]={},this._preds[s]={},this._out[s]={},this._sucs[s]={},++this._nodeCount,this)}node(s){return this._nodes[s]}hasNode(s){return Object.hasOwn(this._nodes,s)}removeNode(s){var i=this;if(Object.hasOwn(this._nodes,s)){var a=l=>i.removeEdge(i._edgeObjs[l]);delete this._nodes[s],this._isCompound&&(this._removeFromParentsChildList(s),delete this._parent[s],this.children(s).forEach(function(l){i.setParent(l)}),delete this._children[s]),Object.keys(this._in[s]).forEach(a),delete this._in[s],delete this._preds[s],Object.keys(this._out[s]).forEach(a),delete this._out[s],delete this._sucs[s],--this._nodeCount}return this}setParent(s,i){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(i===void 0)i=t;else{for(var a=i+="";a!==void 0;a=this.parent(a))if(a===s)throw new Error("Setting "+i+" as parent of "+s+" would create a cycle");this.setNode(i)}return this.setNode(s),this._removeFromParentsChildList(s),this._parent[s]=i,this._children[i][s]=!0,this}_removeFromParentsChildList(s){delete this._children[this._parent[s]][s]}parent(s){if(this._isCompound){var i=this._parent[s];if(i!==t)return i}}children(s=t){if(this._isCompound){var i=this._children[s];if(i)return Object.keys(i)}else{if(s===t)return this.nodes();if(this.hasNode(s))return[]}}predecessors(s){var i=this._preds[s];if(i)return Object.keys(i)}successors(s){var i=this._sucs[s];if(i)return Object.keys(i)}neighbors(s){var i=this.predecessors(s);if(i){const l=new Set(i);for(var a of this.successors(s))l.add(a);return Array.from(l.values())}}isLeaf(s){return(this.isDirected()?this.successors(s):this.neighbors(s)).length===0}filterNodes(s){var i=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});i.setGraph(this.graph());var a=this;Object.entries(this._nodes).forEach(function([d,h]){s(d)&&i.setNode(d,h)}),Object.values(this._edgeObjs).forEach(function(d){i.hasNode(d.v)&&i.hasNode(d.w)&&i.setEdge(d,a.edge(d))});var l={};function c(d){var h=a.parent(d);return h===void 0||i.hasNode(h)?(l[d]=h,h):h in l?l[h]:c(h)}return this._isCompound&&i.nodes().forEach(d=>i.setParent(d,c(d))),i}setDefaultEdgeLabel(s){return this._defaultEdgeLabelFn=s,typeof s!="function"&&(this._defaultEdgeLabelFn=()=>s),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(s,i){var a=this,l=arguments;return s.reduce(function(c,d){return l.length>1?a.setEdge(c,d,i):a.setEdge(c,d),d}),this}setEdge(){var s,i,a,l,c=!1,d=arguments[0];typeof d=="object"&&d!==null&&"v"in d?(s=d.v,i=d.w,a=d.name,arguments.length===2&&(l=arguments[1],c=!0)):(s=d,i=arguments[1],a=arguments[3],arguments.length>2&&(l=arguments[2],c=!0)),s=""+s,i=""+i,a!==void 0&&(a=""+a);var h=o(this._isDirected,s,i,a);if(Object.hasOwn(this._edgeLabels,h))return c&&(this._edgeLabels[h]=l),this;if(a!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(s),this.setNode(i),this._edgeLabels[h]=c?l:this._defaultEdgeLabelFn(s,i,a);var f=function(m,_,g,p){var b=""+_,y=""+g;if(!m&&b>y){var x=b;b=y,y=x}var v={v:b,w:y};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),c=this._edgeObjs[l];return c&&(s=c.v,i=c.w,delete this._edgeLabels[l],delete this._edgeObjs[l],n(this._preds[i],s),n(this._sucs[s],i),delete this._in[i][l],delete this._out[s][l],this._edgeCount--),this}inEdges(s,i){var a=this._in[s];if(a){var l=Object.values(a);return i?l.filter(c=>c.v===i):l}}outEdges(s,i){var a=this._out[s];if(a){var l=Object.values(a);return i?l.filter(c=>c.w===i):l}}nodeEdges(s,i){var a=this.inEdges(s,i);if(a)return a.concat(this.outEdges(s,i))}},wf}function nL(){return dk?ck:(dk=1,ck={Graph:om(),version:lk?ak:(lk=1,ak="2.2.4")})}function oL(){if(uk)return vf;uk=1;var t=om();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 vf={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}},vf}function rL(){return hk||(hk=1,kf=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}),kf}function d3(){return fk?Sf:(fk=1,Sf=class{constructor(){Q(this,"_arr",[]);Q(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}},Sf)}function u3(){if(mk)return Cf;mk=1;var t=d3();Cf=function(n,o,r,s){return function(i,a,l,c){var d,h,f={},m=new t,_=function(g){var p=g.v!==d?g.v:g.w,b=f[p],y=l(g),x=h.distance+y;if(y<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+g+" Weight: "+y);x<b.distance&&(b.distance=x,b.predecessor=d,m.decrease(p,x))};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&&(d=m.removeMin(),(h=f[d]).distance!==Number.POSITIVE_INFINITY);)c(d).forEach(_);return f}(n,String(o),r||e,s||function(i){return n.outEdges(i)})};var e=()=>1;return Cf}function sL(){if(pk)return Nf;pk=1;var t=u3();return Nf=function(e,n,o){return e.nodes().reduce(function(r,s){return r[s]=t(e,s,n,o),r},{})},Nf}function h3(){return gk||(gk=1,jf=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(d){Object.hasOwn(o,d)?o[d].onStack&&(a.lowlink=Math.min(a.lowlink,o[d].index)):(s(d),a.lowlink=Math.min(a.lowlink,o[d].lowlink))}),a.lowlink===a.index){var l,c=[];do l=n.pop(),o[l].onStack=!1,c.push(l);while(i!==l);r.push(c)}}return t.nodes().forEach(function(i){Object.hasOwn(o,i)||s(i)}),r}),jf}function iL(){if(_k)return Ef;_k=1;var t=h3();return Ef=function(e){return t(e).filter(function(n){return n.length>1||n.length===1&&e.hasEdge(n[0],n[0])})},Ef}function aL(){if(bk)return If;bk=1,If=function(e,n,o){return function(r,s,i){var a={},l=r.nodes();return l.forEach(function(c){a[c]={},a[c][c]={distance:0},l.forEach(function(d){c!==d&&(a[c][d]={distance:Number.POSITIVE_INFINITY})}),i(c).forEach(function(d){var h=d.v===c?d.w:d.v,f=s(d);a[c][h]={distance:f,predecessor:c}})}),l.forEach(function(c){var d=a[c];l.forEach(function(h){var f=a[h];l.forEach(function(m){var _=f[c],g=d[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 If}function f3(){if(yk)return Af;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}yk=1;class e extends Error{constructor(){super(...arguments)}}return Af=t,t.CycleException=e,Af}function lL(){if(xk)return Tf;xk=1;var t=f3();return Tf=function(e){try{t(e)}catch(n){if(n instanceof t.CycleException)return!1;throw n}return!0},Tf}function m3(){if(wk)return Mf;function t(o,r,s,i){for(var a=[[o,!1]];a.length>0;){var l=a.pop();l[1]?i.push(l[0]):Object.hasOwn(s,l[0])||(s[l[0]]=!0,a.push([l[0],!0]),n(r(l[0]),c=>a.push([c,!1])))}}function e(o,r,s,i){for(var a=[o];a.length>0;){var l=a.pop();Object.hasOwn(s,l)||(s[l]=!0,i.push(l),n(r(l),c=>a.push(c)))}}function n(o,r){for(var s=o.length;s--;)r(o[s],s,o);return o}return wk=1,Mf=function(o,r,s){Array.isArray(r)||(r=[r]);var i=o.isDirected()?d=>o.successors(d):d=>o.neighbors(d),a=s==="post"?t:e,l=[],c={};return r.forEach(d=>{if(!o.hasNode(d))throw new Error("Graph does not have node: "+d);a(d,i,c,l)}),l},Mf}function cL(){if(vk)return Of;vk=1;var t=m3();return Of=function(e,n){return t(e,n,"post")},Of}function dL(){if(kk)return Df;kk=1;var t=m3();return Df=function(e,n){return t(e,n,"pre")},Df}function uL(){if(Sk)return Rf;Sk=1;var t=om(),e=d3();return Rf=function(n,o){var r,s=new t,i={},a=new e;function l(d){var h=d.v===r?d.w:d.v,f=a.priority(h);if(f!==void 0){var m=o(d);m<f&&(i[h]=r,a.decrease(h,m))}}if(n.nodeCount()===0)return s;n.nodes().forEach(function(d){a.add(d,Number.POSITIVE_INFINITY),s.setNode(d)}),a.decrease(n.nodes()[0],0);for(var c=!1;a.size()>0;){if(r=a.removeMin(),Object.hasOwn(i,r))s.setEdge(r,i[r]);else{if(c)throw new Error("Input graph is not connected: "+n);c=!0}n.nodeEdges(r).forEach(l)}return s},Rf}function eo(){if(Ek)return jk;Ek=1;var t=nL();return jk={Graph:t.Graph,json:oL(),alg:Nk?Ck:(Nk=1,Ck={components:rL(),dijkstra:u3(),dijkstraAll:sL(),findCycles:iL(),floydWarshall:aL(),isAcyclic:lL(),postorder:cL(),preorder:dL(),prim:uL(),tarjan:h3(),topsort:f3()}),version:t.version}}function hL(){if(Tk)return Pf;Tk=1;let t=eo().Graph,e=function(){if(Ak)return Ik;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 Ak=1,Ik=class{constructor(){let a={};a._next=a._prev=a,this._sentinel=a}dequeue(){let a=this._sentinel,l=a._prev;if(l!==a)return s(l),l}enqueue(a){let l=this._sentinel;a._prev&&a._next&&s(a),a._next=l._next,l._next._prev=a,l._next=a,a._prev=l}toString(){let a=[],l=this._sentinel,c=l._prev;for(;c!==l;)a.push(JSON.stringify(c,i)),c=c._prev;return"["+a.join(", ")+"]"}}}();Pf=function(s,i){if(s.nodeCount()<=1)return[];let a=function(l,c){let d=new t,h=0,f=0;l.nodes().forEach(g=>{d.setNode(g,{v:g,in:0,out:0})}),l.edges().forEach(g=>{let p=d.edge(g.v,g.w)||0,b=c(g),y=p+b;d.setEdge(g.v,g.w,y),f=Math.max(f,d.node(g.v).out+=b),h=Math.max(h,d.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 d.nodes().forEach(g=>{r(m,_,d.node(g))}),{graph:d,buckets:m,zeroIdx:_}}(s,i||n);return function(l,c,d){let h,f=[],m=c[c.length-1],_=c[0];for(;l.nodeCount();){for(;h=_.dequeue();)o(l,c,d,h);for(;h=m.dequeue();)o(l,c,d,h);if(l.nodeCount()){for(let g=c.length-2;g>0;--g)if(h=c[g].dequeue(),h){f=f.concat(o(l,c,d,h,!0));break}}}return f}(a.graph,a.buckets,a.zeroIdx).flatMap(l=>s.outEdges(l.v,l.w))};let n=()=>1;function o(s,i,a,l,c){let d=c?[]:void 0;return s.inEdges(l.v).forEach(h=>{let f=s.edge(h),m=s.node(h.v);c&&d.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),d}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 Pf}function Ft(){if(Mk)return Lf;Mk=1;let t=eo().Graph;function e(c,d,h,f){let m;do m=i(f);while(c.hasNode(m));return h.dummy=d,c.setNode(m,h),m}Lf={addBorderNode:function(c,d,h,f){let m={width:0,height:0};return arguments.length>=4&&(m.rank=h,m.order=f),e(c,"border",m,d)},addDummyNode:e,applyWithChunking:o,asNonCompoundGraph:function(c){let d=new t({multigraph:c.isMultigraph()}).setGraph(c.graph());return c.nodes().forEach(h=>{c.children(h).length||d.setNode(h,c.node(h))}),c.edges().forEach(h=>{d.setEdge(h,c.edge(h))}),d},buildLayerMatrix:function(c){let d=a(r(c)+1).map(()=>[]);return c.nodes().forEach(h=>{let f=c.node(h),m=f.rank;m!==void 0&&(d[m][f.order]=h)}),d},intersectRect:function(c,d){let h,f,m=c.x,_=c.y,g=d.x-m,p=d.y-_,b=c.width/2,y=c.height/2;if(!g&&!p)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(p)*b>Math.abs(g)*y?(p<0&&(y=-y),h=y*g/p,f=y):(g<0&&(b=-b),h=b,f=b*p/g),{x:m+h,y:_+f}},mapValues:function(c,d){let h=d;return typeof d=="string"&&(h=f=>f[d]),Object.entries(c).reduce((f,[m,_])=>(f[m]=h(_,m),f),{})},maxRank:r,normalizeRanks:function(c){let d=c.nodes().map(f=>{let m=c.node(f).rank;return m===void 0?Number.MAX_VALUE:m}),h=o(Math.min,d);c.nodes().forEach(f=>{let m=c.node(f);Object.hasOwn(m,"rank")&&(m.rank-=h)})},notime:function(c,d){return d()},partition:function(c,d){let h={lhs:[],rhs:[]};return c.forEach(f=>{d(f)?h.lhs.push(f):h.rhs.push(f)}),h},pick:function(c,d){const h={};for(const f of d)c[f]!==void 0&&(h[f]=c[f]);return h},predecessorWeights:function(c){let d=c.nodes().map(h=>{let f={};return c.inEdges(h).forEach(m=>{f[m.v]=(f[m.v]||0)+c.edge(m).weight}),f});return l(c.nodes(),d)},range:a,removeEmptyRanks:function(c){let d=c.nodes().map(g=>c.node(g).rank),h=o(Math.min,d),f=[];c.nodes().forEach(g=>{let p=c.node(g).rank-h;f[p]||(f[p]=[]),f[p].push(g)});let m=0,_=c.graph().nodeRankFactor;Array.from(f).forEach((g,p)=>{g===void 0&&p%_!==0?--m:g!==void 0&&m&&g.forEach(b=>c.node(b).rank+=m)})},simplify:function(c){let d=new t().setGraph(c.graph());return c.nodes().forEach(h=>d.setNode(h,c.node(h))),c.edges().forEach(h=>{let f=d.edge(h.v,h.w)||{weight:0,minlen:1},m=c.edge(h);d.setEdge(h.v,h.w,{weight:f.weight+m.weight,minlen:Math.max(f.minlen,m.minlen)})}),d},successorWeights:function(c){let d=c.nodes().map(h=>{let f={};return c.outEdges(h).forEach(m=>{f[m.w]=(f[m.w]||0)+c.edge(m).weight}),f});return l(c.nodes(),d)},time:function(c,d){let h=Date.now();try{return d()}finally{console.log(c+" time: "+(Date.now()-h)+"ms")}},uniqueId:i,zipObject:l};const n=65535;function o(c,d){if(d.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 _}(d);return c.apply(null,h.map(f=>c.apply(null,f)))}return c.apply(null,d)}function r(c){const d=c.nodes().map(h=>{let f=c.node(h).rank;return f===void 0?Number.MIN_VALUE:f});return o(Math.max,d)}let s=0;function i(c){var d=++s;return toString(c)+d}function a(c,d,h=1){d==null&&(d=c,c=0);let f=_=>_<d;h<0&&(f=_=>d<_);const m=[];for(let _=c;f(_);_+=h)m.push(_);return m}function l(c,d){return c.reduce((h,f,m)=>(h[f]=d[m],h),{})}return Lf}function fL(){if(Ok)return Ff;Ok=1;let t=hL(),e=Ft().uniqueId;return Ff={run:function(n){(n.graph().acyclicer==="greedy"?t(n,function(r){return s=>r.edge(s).weight}(n)):function(r){let s=[],i={},a={};function l(c){Object.hasOwn(a,c)||(a[c]=!0,i[c]=!0,r.outEdges(c).forEach(d=>{Object.hasOwn(i,d.w)?s.push(d):l(d.w)}),delete i[c])}return r.nodes().forEach(l),s}(n)).forEach(r=>{let s=n.edge(r);n.removeEdge(r),s.forwardName=r.name,s.reversed=!0,n.setEdge(r.w,r.v,s,e("rev"))})},undo:function(n){n.edges().forEach(o=>{let r=n.edge(o);if(r.reversed){n.removeEdge(o);let s=r.forwardName;delete r.reversed,delete r.forwardName,n.setEdge(o.w,o.v,r,s)}})}},Ff}function mL(){if(Dk)return zf;Dk=1;let t=Ft();return zf={run:function(e){e.graph().dummyChains=[],e.edges().forEach(n=>function(o,r){let s,i,a,l=r.v,c=o.node(l).rank,d=r.w,h=o.node(d).rank,f=r.name,m=o.edge(r),_=m.labelRank;if(h!==c+1){for(o.removeEdge(r),a=0,++c;c<h;++a,++c)m.points=[],i={width:0,height:0,edgeLabel:m,edgeObj:r,rank:c},s=t.addDummyNode(o,"edge",i,"_d"),c===_&&(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,d,{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)})}},zf}function sc(){if(Rk)return Bf;Rk=1;const{applyWithChunking:t}=Ft();return Bf={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}},Bf}function p3(){if(Pk)return Uf;Pk=1;var t=eo().Graph,e=sc().slack;function n(s,i){return s.nodes().forEach(function a(l){i.nodeEdges(l).forEach(c=>{var d=c.v,h=l===d?c.w:d;s.hasNode(h)||e(i,c)||(s.setNode(h,{}),s.setEdge(l,h,{}),a(h))})}),s.nodeCount()}function o(s,i){return i.edges().reduce((a,l)=>{let c=Number.POSITIVE_INFINITY;return s.hasNode(l.v)!==s.hasNode(l.w)&&(c=e(i,l)),c<a[0]?[c,l]:a},[Number.POSITIVE_INFINITY,null])[1]}function r(s,i,a){s.nodes().forEach(l=>i.node(l).rank+=a)}return Uf=function(s){var i,a,l=new t({directed:!1}),c=s.nodes()[0],d=s.nodeCount();for(l.setNode(c,{});n(l,s)<d;)i=o(l,s),a=l.hasNode(i.v)?e(s,i):-e(s,i),r(l,s,a);return l},Uf}function pL(){if(Lk)return Vf;Lk=1;var t=p3(),e=sc().slack,n=sc().longestPath,o=eo().alg.preorder,r=eo().alg.postorder,s=Ft().simplify;function i(g){g=s(g),n(g);var p,b=t(g);for(c(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(y=>function(x,v,S){var k=x.node(S),E=k.parent;x.edge(S,E).cutvalue=l(x,v,S)}(g,p,y))}function l(g,p,b){var y=g.node(b).parent,x=!0,v=p.edge(b,y),S=0;return v||(x=!1,v=p.edge(y,b)),S=v.weight,p.nodeEdges(b).forEach(k=>{var E,N,I=k.v===b,T=I?k.w:k.v;if(T!==y){var M=I===x,R=p.edge(k).weight;if(S+=M?R:-R,E=b,N=T,g.hasEdge(E,N)){var z=g.edge(b,T).cutvalue;S+=M?-z:z}}}),S}function c(g,p){arguments.length<2&&(p=g.nodes()[0]),d(g,{},1,p)}function d(g,p,b,y,x){var v=b,S=g.node(y);return p[y]=!0,g.neighbors(y).forEach(k=>{Object.hasOwn(p,k)||(b=d(g,p,b,k,y))}),S.low=v,S.lim=b++,x?S.parent=x:delete S.parent,b}function h(g){return g.edges().find(p=>g.edge(p).cutvalue<0)}function f(g,p,b){var y=b.v,x=b.w;p.hasEdge(y,x)||(y=b.w,x=b.v);var v=g.node(y),S=g.node(x),k=v,E=!1;v.lim>S.lim&&(k=S,E=!0);var N=p.edges().filter(I=>E===_(g,g.node(I.v),k)&&E!==_(g,g.node(I.w),k));return N.reduce((I,T)=>e(p,T)<e(p,I)?T:I)}function m(g,p,b,y){var x=b.v,v=b.w;g.removeEdge(x,v),g.setEdge(y.v,y.w,{}),c(g),a(g,p),function(S,k){var E=S.nodes().find(I=>!k.node(I).parent),N=o(S,E);(N=N.slice(1)).forEach(I=>{var T=S.node(I).parent,M=k.edge(I,T),R=!1;M||(M=k.edge(T,I),R=!0),k.node(I).rank=k.node(T).rank+(R?M.minlen:-M.minlen)})}(g,p)}function _(g,p,b){return b.low<=p.lim&&p.lim<=b.lim}return Vf=i,i.initLowLimValues=c,i.initCutValues=a,i.calcCutValue=l,i.leaveEdge=h,i.enterEdge=f,i.exchangeEdges=m,Vf}function gL(){if(Fk)return $f;Fk=1;var t=sc().longestPath,e=p3(),n=pL();$f=function(s){switch(s.graph().ranker){case"network-simplex":default:r(s);break;case"tight-tree":(function(i){t(i),e(i)})(s);break;case"longest-path":o(s)}};var o=t;function r(s){n(s)}return $f}function _L(){return zk||(zk=1,Hf=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=[],y=[],x=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>x||v>f[g].lim));for(p=g,g=_;(g=h.parent(g))!==p;)y.push(g);return{path:b.concat(y.reverse()),lca:p}}(t,e,r.v,r.w),i=s.path,a=s.lca,l=0,c=i[l],d=!0;for(;n!==r.w;){if(o=t.node(n),d){for(;(c=i[l])!==a&&t.node(c).maxRank<o.rank;)l++;c===a&&(d=!1)}if(!d){for(;l<i.length-1&&t.node(c=i[l+1]).minRank<=o.rank;)l++;c=i[l]}t.setParent(n,c),n=t.successors(n)[0]}})}),Hf}function bL(){if(Bk)return Wf;Bk=1;let t=Ft();function e(n,o,r,s,i,a,l){let c=n.children(l);if(!c.length)return void(l!==o&&n.setEdge(o,l,{weight:0,minlen:r}));let d=t.addBorderNode(n,"_bt"),h=t.addBorderNode(n,"_bb"),f=n.node(l);n.setParent(d,l),f.borderTop=d,n.setParent(h,l),f.borderBottom=h,c.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,y=g!==p?1:i-a[l]+1;n.setEdge(d,g,{weight:b,minlen:y,nestingEdge:!0}),n.setEdge(p,h,{weight:b,minlen:y,nestingEdge:!0})}),n.parent(l)||n.setEdge(o,d,{weight:0,minlen:i+a[l]})}return Wf={run:function(n){let o=t.addDummyNode(n,"root",{},"_root"),r=function(c){var d={};function h(f,m){var _=c.children(f);_&&_.length&&_.forEach(g=>h(g,m+1)),d[f]=m}return c.children().forEach(f=>h(f,1)),d}(n),s=Object.values(r),i=t.applyWithChunking(Math.max,s)-1,a=2*i+1;n.graph().nestingRoot=o,n.edges().forEach(c=>n.edge(c).minlen*=a);let l=function(c){return c.edges().reduce((d,h)=>d+c.edge(h).weight,0)}(n)+1;n.children().forEach(c=>e(n,o,a,l,i,r,c)),n.graph().nodeRankFactor=a},cleanup:function(n){var o=n.graph();n.removeNode(o.nestingRoot),delete o.nestingRoot,n.edges().forEach(r=>{n.edge(r).nestingEdge&&n.removeEdge(r)})}},Wf}function yL(){if(Vk)return Gf;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 Vk=1,Gf={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))}},Gf}function xL(){if(Yk)return Gk;Yk=1;let t=Ft();return Gk=function(e,n){let o={};return e.forEach((r,s)=>{let i=o[r.v]={indegree:0,in:[],out:[],vs:[r.v],i:s};r.barycenter!==void 0&&(i.barycenter=r.barycenter,i.weight=r.weight)}),n.edges().forEach(r=>{let s=o[r.v],i=o[r.w];s!==void 0&&i!==void 0&&(i.indegree++,s.out.push(o[r.w]))}),function(r){let s=[];function i(l){return c=>{c.merged||(c.barycenter===void 0||l.barycenter===void 0||c.barycenter>=l.barycenter)&&function(d,h){let f=0,m=0;d.weight&&(f+=d.barycenter*d.weight,m+=d.weight),h.weight&&(f+=h.barycenter*h.weight,m+=h.weight),d.vs=h.vs.concat(d.vs),d.barycenter=f/m,d.weight=m,d.i=Math.min(h.i,d.i),h.merged=!0}(l,c)}}function a(l){return c=>{c.in.push(l),--c.indegree===0&&r.push(c)}}for(;r.length;){let l=r.pop();s.push(l),l.in.reverse().forEach(i(l)),l.out.forEach(a(l))}return s.filter(l=>!l.merged).map(l=>t.pick(l,["vs","i","barycenter","weight"]))}(Object.values(o).filter(r=>!r.indegree))}}function wL(){if(Xk)return Kf;Xk=1;let t=(qk||(qk=1,Wk=function(o,r=[]){return r.map(s=>{let i=o.inEdges(s);if(i.length){let a=i.reduce((l,c)=>{let d=o.edge(c),h=o.node(c.v);return{sum:l.sum+d.weight*h.order,weight:l.weight+d.weight}},{sum:0,weight:0});return{v:s,barycenter:a.sum/a.weight,weight:a.weight}}return{v:s}})}),Wk),e=xL(),n=function(){if(Kk)return Jk;Kk=1;let o=Ft();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 Jk=function(s,i){let a=o.partition(s,p=>Object.hasOwn(p,"barycenter")),l=a.lhs,c=a.rhs.sort((p,b)=>b.i-p.i),d=[],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(d,c,m),l.forEach(p=>{m+=p.vs.length,d.push(p.vs),h+=p.barycenter*p.weight,f+=p.weight,m=r(d,c,m)});let g={vs:d.flat(!0)};return f&&(g.barycenter=h/f,g.weight=f),g}}();return Kf=function o(r,s,i,a){let l=r.children(s),c=r.node(s),d=c?c.borderLeft:void 0,h=c?c.borderRight:void 0,f={};d&&(l=l.filter(p=>p!==d&&p!==h));let m=t(r,l);m.forEach(p=>{if(r.children(p.v).length){let x=o(r,p.v,i,a);f[p.v]=x,Object.hasOwn(x,"barycenter")&&(y=x,(b=p).barycenter!==void 0?(b.barycenter=(b.barycenter*b.weight+y.barycenter*y.weight)/(b.weight+y.weight),b.weight+=y.weight):(b.barycenter=y.barycenter,b.weight=y.weight))}var b,y});let _=e(m,i);(function(p,b){p.forEach(y=>{y.vs=y.vs.flatMap(x=>b[x]?b[x].vs:x)})})(_,f);let g=n(_,a);if(d&&(g.vs=[d,g.vs,h].flat(!0),r.predecessors(d).length)){let p=r.node(r.predecessors(d)[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},Kf}function vL(){if(Zk)return Xf;Zk=1;let t=eo().Graph,e=Ft();return Xf=function(n,o,r){let s=function(a){for(var l;a.hasNode(l=e.uniqueId("_root")););return l}(n),i=new t({compound:!0}).setGraph({root:s}).setDefaultNodeLabel(a=>n.node(a));return n.nodes().forEach(a=>{let l=n.node(a),c=n.parent(a);(l.rank===o||l.minRank<=o&&o<=l.maxRank)&&(i.setNode(a),i.setParent(a,c||s),n[r](a).forEach(d=>{let h=d.v===a?d.w:d.v,f=i.edge(h,a),m=f!==void 0?f.weight:0;i.setEdge(h,a,{weight:n.edge(d).weight+m})}),Object.hasOwn(l,"minRank")&&i.setNode(a,{borderLeft:l.borderLeft[o],borderRight:l.borderRight[o]}))}),i},Xf}function kL(){if(t3)return Zf;t3=1;let t=function(){if($k)return Yf;$k=1;let d=Ft();return Yf=function(h){let f={},m=h.nodes().filter(y=>!h.children(y).length),_=m.map(y=>h.node(y).rank),g=d.applyWithChunking(Math.max,_),p=d.range(g+1).map(()=>[]);function b(y){if(f[y])return;f[y]=!0;let x=h.node(y);p[x.rank].push(y),h.successors(y).forEach(b)}return m.sort((y,x)=>h.node(y).rank-h.node(x).rank).forEach(b),p},Yf}(),e=function(){if(Hk)return Jf;Hk=1;let d=Ft().zipObject;function h(f,m,_){let g=d(_,_.map((S,k)=>k)),p=m.flatMap(S=>f.outEdges(S).map(k=>({pos:g[k.w],weight:f.edge(k).weight})).sort((k,E)=>k.pos-E.pos)),b=1;for(;b<_.length;)b<<=1;let y=2*b-1;b-=1;let x=new Array(y).fill(0),v=0;return p.forEach(S=>{let k=S.pos+b;x[k]+=S.weight;let E=0;for(;k>0;)k%2&&(E+=x[k+1]),k=k-1>>1,x[k]+=S.weight;v+=S.weight*E}),v}return Jf=function(f,m){let _=0;for(let g=1;g<m.length;++g)_+=h(f,m[g-1],m[g]);return _},Jf}(),n=wL(),o=vL(),r=(e3||(e3=1,Qk=function(d,h,f){let m,_={};f.forEach(g=>{let p,b,y=d.parent(g);for(;y;){if(p=d.parent(y),p?(b=_[p],_[p]=y):(b=m,m=y),b&&b!==y)return void h.setEdge(b,y);y=p}})}),Qk),s=eo().Graph,i=Ft();function a(d,h,f){return h.map(function(m){return o(d,m,f)})}function l(d,h){let f=new s;d.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 c(d,h){Object.values(h).forEach(f=>f.forEach((m,_)=>d.node(m).order=_))}return Zf=function d(h,f){if(f&&typeof f.customOrder=="function")return void f.customOrder(h,d);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(c(h,p),f&&f.disableOptimalOrderHeuristic)return;let b,y=Number.POSITIVE_INFINITY;for(let x=0,v=0;v<4;++x,++v){l(x%2?_:g,x%4>=2),p=i.buildLayerMatrix(h);let S=e(h,p);S<y&&(v=0,b=Object.assign({},p),y=S)}c(h,b)},Zf}function SL(){if(n3)return Qf;n3=1;let t=eo().Graph,e=Ft();function n(h,f){let m={};return f.length&&f.reduce(function(_,g){let p=0,b=0,y=_.length,x=g[g.length-1];return g.forEach((v,S)=>{let k=function(N,I){if(N.node(I).dummy)return N.predecessors(I).find(T=>N.node(T).dummy)}(h,v),E=k?h.node(k).order:y;(k||v===x)&&(g.slice(b,S+1).forEach(N=>{h.predecessors(N).forEach(I=>{let T=h.node(I),M=T.order;!(M<p||E<M)||T.dummy&&h.node(N).dummy||r(m,I,N)})}),b=S+1,p=E)}),g}),m}function o(h,f){let m={};function _(g,p,b,y,x){let v;e.range(p,b).forEach(S=>{v=g[S],h.node(v).dummy&&h.predecessors(v).forEach(k=>{let E=h.node(k);E.dummy&&(E.order<y||E.order>x)&&r(m,k,v)})})}return f.length&&f.reduce(function(g,p){let b,y=-1,x=0;return p.forEach((v,S)=>{if(h.node(v).dummy==="border"){let k=h.predecessors(v);k.length&&(b=h.node(k[0]).order,_(p,x,S,y,b),x=S,y=b)}_(p,x,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(y=>{y.forEach((x,v)=>{g[x]=x,p[x]=x,b[x]=v})}),f.forEach(y=>{let x=-1;y.forEach(v=>{let S=_(v);if(S.length){S=S.sort((E,N)=>b[E]-b[N]);let k=(S.length-1)/2;for(let E=Math.floor(k),N=Math.ceil(k);E<=N;++E){let I=S[E];p[v]===v&&x<b[I]&&!s(m,v,I)&&(p[I]=v,p[v]=g[v]=g[I],x=b[I])}}})}),{root:g,align:p}}function a(h,f,m,_,g){let p={},b=function(v,S,k,E){let N=new t,I=v.graph(),T=function(M,R,z){return(D,F,B)=>{let V,O=D.node(F),C=D.node(B),$=0;if($+=O.width/2,Object.hasOwn(O,"labelpos"))switch(O.labelpos.toLowerCase()){case"l":V=-O.width/2;break;case"r":V=O.width/2}if(V&&($+=z?V:-V),V=0,$+=(O.dummy?R:M)/2,$+=(C.dummy?R:M)/2,$+=C.width/2,Object.hasOwn(C,"labelpos"))switch(C.labelpos.toLowerCase()){case"l":V=C.width/2;break;case"r":V=-C.width/2}return V&&($+=z?V:-V),V=0,$}}(I.nodesep,I.edgesep,E);return S.forEach(M=>{let R;M.forEach(z=>{let D=k[z];if(N.setNode(D),R){var F=k[R],B=N.edge(F,D);N.setEdge(F,D,Math.max(T(v,z,R),B||0))}R=z})}),N}(h,f,m,g),y=g?"borderLeft":"borderRight";function x(v,S){let k=b.nodes(),E=k.pop(),N={};for(;E;)N[E]?v(E):(N[E]=!0,k.push(E),k=k.concat(S(E))),E=k.pop()}return x(function(v){p[v]=b.inEdges(v).reduce((S,k)=>Math.max(S,p[k.v]+b.edge(k)),0)},b.predecessors.bind(b)),x(function(v){let S=b.outEdges(v).reduce((E,N)=>Math.min(E,p[N.w]-b.edge(N)),Number.POSITIVE_INFINITY),k=h.node(v);S!==Number.POSITIVE_INFINITY&&k.borderType!==y&&(p[v]=Math.max(p[v],S))},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(([y,x])=>{let v=function(S,k){return S.node(k).width}(h,y)/2;g=Math.max(x+v,g),p=Math.min(x-v,p)});const b=g-p;return b<m[0]&&(m=[b,_]),m},[Number.POSITIVE_INFINITY,null])[1]}function c(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 y=p+b,x=h[y];if(x===f)return;let v=Object.values(x),S=_-e.applyWithChunking(Math.min,v);b!=="l"&&(S=g-e.applyWithChunking(Math.max,v)),S&&(h[y]=e.mapValues(x,k=>k+S))})})}function d(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 Qf={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(y=>{y==="r"&&(f=f.map(k=>Object.values(k).reverse()));let x=(b==="u"?h.predecessors:h.successors).bind(h),v=i(h,f,_,x),S=a(h,f,v.root,v.align,y==="r");y==="r"&&(S=e.mapValues(S,k=>-k)),g[b+y]=S})});let p=l(h,g);return c(g,p),d(g,h.graph().align)},findType1Conflicts:n,findType2Conflicts:o,addConflict:r,hasConflict:s,verticalAlignment:i,horizontalCompaction:a,alignCoordinates:c,findSmallestWidthAlignment:l,balance:d},Qf}function CL(){if(o3)return em;o3=1;let t=Ft(),e=SL().positionX;return em=function(n){n=t.asNonCompoundGraph(n),function(o){let r=t.buildLayerMatrix(o),s=o.graph().ranksep,i=0;r.forEach(a=>{const l=a.reduce((c,d)=>{const h=o.node(d).height;return c>h?c:h},0);a.forEach(c=>o.node(c).y=i+l/2),i+=l+s})}(n),Object.entries(e(n)).forEach(([o,r])=>n.node(o).x=r)},em}function NL(){if(r3)return tm;r3=1;let t=fL(),e=mL(),n=gL(),o=Ft().normalizeRanks,r=_L(),s=Ft().removeEmptyRanks,i=bL(),a=function(){if(Uk)return qf;Uk=1;let E=Ft();function N(I,T,M,R,z,D){let F={width:0,height:0,rank:D,borderType:T},B=z[T][D-1],V=E.addDummyNode(I,"border",F,M);z[T][D]=V,I.setParent(V,R),B&&I.setEdge(B,V,{weight:1})}return qf=function(I){I.children().forEach(function T(M){let R=I.children(M),z=I.node(M);if(R.length&&R.forEach(T),Object.hasOwn(z,"minRank")){z.borderLeft=[],z.borderRight=[];for(let D=z.minRank,F=z.maxRank+1;D<F;++D)N(I,"borderLeft","_bl",M,z,D),N(I,"borderRight","_br",M,z,D)}})},qf}(),l=yL(),c=kL(),d=CL(),h=Ft(),f=eo().Graph;tm=function(E,N){let I=N&&N.debugTiming?h.time:h.notime;I("layout",()=>{let T=I(" buildLayoutGraph",()=>function(M){let R=new f({multigraph:!0,compound:!0}),z=k(M.graph());return R.setGraph(Object.assign({},_,S(z,m),h.pick(z,g))),M.nodes().forEach(D=>{const F=S(k(M.node(D)),p);Object.keys(b).forEach(B=>{F[B]===void 0&&(F[B]=b[B])}),R.setNode(D,F),R.setParent(D,M.parent(D))}),M.edges().forEach(D=>{let F=k(M.edge(D));R.setEdge(D,Object.assign({},x,S(F,y),h.pick(F,v)))}),R}(E));I(" runLayout",()=>function(M,R,z){R(" makeSpaceForEdgeLabels",()=>function(D){let F=D.graph();F.ranksep/=2,D.edges().forEach(B=>{let V=D.edge(B);V.minlen*=2,V.labelpos.toLowerCase()!=="c"&&(F.rankdir==="TB"||F.rankdir==="BT"?V.width+=V.labeloffset:V.height+=V.labeloffset)})}(M)),R(" removeSelfEdges",()=>function(D){D.edges().forEach(F=>{if(F.v===F.w){var B=D.node(F.v);B.selfEdges||(B.selfEdges=[]),B.selfEdges.push({e:F,label:D.edge(F)}),D.removeEdge(F)}})}(M)),R(" acyclic",()=>t.run(M)),R(" nestingGraph.run",()=>i.run(M)),R(" rank",()=>n(h.asNonCompoundGraph(M))),R(" injectEdgeLabelProxies",()=>function(D){D.edges().forEach(F=>{let B=D.edge(F);if(B.width&&B.height){let V=D.node(F.v),O={rank:(D.node(F.w).rank-V.rank)/2+V.rank,e:F};h.addDummyNode(D,"edge-proxy",O,"_ep")}})}(M)),R(" removeEmptyRanks",()=>s(M)),R(" nestingGraph.cleanup",()=>i.cleanup(M)),R(" normalizeRanks",()=>o(M)),R(" assignRankMinMax",()=>function(D){let F=0;D.nodes().forEach(B=>{let V=D.node(B);V.borderTop&&(V.minRank=D.node(V.borderTop).rank,V.maxRank=D.node(V.borderBottom).rank,F=Math.max(F,V.maxRank))}),D.graph().maxRank=F}(M)),R(" removeEdgeLabelProxies",()=>function(D){D.nodes().forEach(F=>{let B=D.node(F);B.dummy==="edge-proxy"&&(D.edge(B.e).labelRank=B.rank,D.removeNode(F))})}(M)),R(" normalize.run",()=>e.run(M)),R(" parentDummyChains",()=>r(M)),R(" addBorderSegments",()=>a(M)),R(" order",()=>c(M,z)),R(" insertSelfEdges",()=>function(D){var F=h.buildLayerMatrix(D);F.forEach(B=>{var V=0;B.forEach((O,C)=>{var $=D.node(O);$.order=C+V,($.selfEdges||[]).forEach(j=>{h.addDummyNode(D,"selfedge",{width:j.label.width,height:j.label.height,rank:$.rank,order:C+ ++V,e:j.e,label:j.label},"_se")}),delete $.selfEdges})})}(M)),R(" adjustCoordinateSystem",()=>l.adjust(M)),R(" position",()=>d(M)),R(" positionSelfEdges",()=>function(D){D.nodes().forEach(F=>{var B=D.node(F);if(B.dummy==="selfedge"){var V=D.node(B.e.v),O=V.x+V.width/2,C=V.y,$=B.x-O,j=V.height/2;D.setEdge(B.e,B.label),D.removeNode(F),B.label.points=[{x:O+2*$/3,y:C-j},{x:O+5*$/6,y:C-j},{x:O+$,y:C},{x:O+5*$/6,y:C+j},{x:O+2*$/3,y:C+j}],B.label.x=B.x,B.label.y=B.y}})}(M)),R(" removeBorderNodes",()=>function(D){D.nodes().forEach(F=>{if(D.children(F).length){let B=D.node(F),V=D.node(B.borderTop),O=D.node(B.borderBottom),C=D.node(B.borderLeft[B.borderLeft.length-1]),$=D.node(B.borderRight[B.borderRight.length-1]);B.width=Math.abs($.x-C.x),B.height=Math.abs(O.y-V.y),B.x=C.x+B.width/2,B.y=V.y+B.height/2}}),D.nodes().forEach(F=>{D.node(F).dummy==="border"&&D.removeNode(F)})}(M)),R(" normalize.undo",()=>e.undo(M)),R(" fixupEdgeLabelCoords",()=>function(D){D.edges().forEach(F=>{let B=D.edge(F);if(Object.hasOwn(B,"x"))switch(B.labelpos!=="l"&&B.labelpos!=="r"||(B.width-=B.labeloffset),B.labelpos){case"l":B.x-=B.width/2+B.labeloffset;break;case"r":B.x+=B.width/2+B.labeloffset}})}(M)),R(" undoCoordinateSystem",()=>l.undo(M)),R(" translateGraph",()=>function(D){let F=Number.POSITIVE_INFINITY,B=0,V=Number.POSITIVE_INFINITY,O=0,C=D.graph(),$=C.marginx||0,j=C.marginy||0;function W(K){let Z=K.x,q=K.y,ne=K.width,re=K.height;F=Math.min(F,Z-ne/2),B=Math.max(B,Z+ne/2),V=Math.min(V,q-re/2),O=Math.max(O,q+re/2)}D.nodes().forEach(K=>W(D.node(K))),D.edges().forEach(K=>{let Z=D.edge(K);Object.hasOwn(Z,"x")&&W(Z)}),F-=$,V-=j,D.nodes().forEach(K=>{let Z=D.node(K);Z.x-=F,Z.y-=V}),D.edges().forEach(K=>{let Z=D.edge(K);Z.points.forEach(q=>{q.x-=F,q.y-=V}),Object.hasOwn(Z,"x")&&(Z.x-=F),Object.hasOwn(Z,"y")&&(Z.y-=V)}),C.width=B-F+$,C.height=O-V+j}(M)),R(" assignNodeIntersects",()=>function(D){D.edges().forEach(F=>{let B,V,O=D.edge(F),C=D.node(F.v),$=D.node(F.w);O.points?(B=O.points[0],V=O.points[O.points.length-1]):(O.points=[],B=$,V=C),O.points.unshift(h.intersectRect(C,B)),O.points.push(h.intersectRect($,V))})}(M)),R(" reversePoints",()=>function(D){D.edges().forEach(F=>{let B=D.edge(F);B.reversed&&B.points.reverse()})}(M)),R(" acyclic.undo",()=>t.undo(M))}(T,I,N)),I(" updateInputGraph",()=>function(M,R){M.nodes().forEach(z=>{let D=M.node(z),F=R.node(z);D&&(D.x=F.x,D.y=F.y,D.rank=F.rank,R.children(z).length&&(D.width=F.width,D.height=F.height))}),M.edges().forEach(z=>{let D=M.edge(z),F=R.edge(z);D.points=F.points,Object.hasOwn(F,"x")&&(D.x=F.x,D.y=F.y)}),M.graph().width=R.graph().width,M.graph().height=R.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"],b={width:0,height:0},y=["minlen","weight","width","height","labeloffset"],x={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},v=["labelpos"];function S(E,N){return h.mapValues(h.pick(E,N),Number)}function k(E){var N={};return E&&Object.entries(E).forEach(([I,T])=>{typeof I=="string"&&(I=I.toLowerCase()),N[I]=T}),N}return tm}function jL(){if(s3)return nm;s3=1;let t=Ft(),e=eo().Graph;return nm={debugOrdering:function(n){let o=t.buildLayerMatrix(n),r=new e({compound:!0,multigraph:!0}).setGraph({});return n.nodes().forEach(s=>{r.setNode(s,{label:s}),r.setParent(s,"layer"+n.node(s).rank)}),n.edges().forEach(s=>r.setEdge(s.v,s.w,{},s.name)),o.forEach((s,i)=>{let a="layer"+i;r.setNode(a,{rank:"same"}),s.reduce((l,c)=>(r.setEdge(l,c,{style:"invis"}),c))}),r}},nm}var g3=c3?l3:(c3=1,l3={graphlib:eo(),layout:NL(),debug:jL(),util:{time:Ft().time,notime:Ft().notime},version:a3?i3:(a3=1,i3="1.1.4")});const na=new g3.graphlib.Graph().setDefaultEdgeLabel(()=>({})),_3=(t,e,n)=>(na.setGraph({rankdir:n.direction,nodesep:150,ranksep:200,ranker:"longest-path"}),e.forEach(o=>na.setEdge(o.source,o.target)),t.forEach(o=>na.setNode(o.id,{...o,width:o.width??0,height:o.height??0})),g3.layout(na),{nodes:t.map(o=>{const{x:r,y:s}=na.node(o.id);return{...o,position:{x:r,y:s}}}),edges:e}),b3=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:bf(dt.get(e).code.trim().split(`
144
- `).length),position:{x:0,y:0}}}createElements(t,e,n,o){const r=[],s=[],i=new Set,a=new Set;for(const l of Object.values(n)){if(l.value==="marimo"&&l.name==="mo")continue;const{declaredBy:c,usedBy:d}=l;for(const h of c)for(const f of d){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,c]of Qm.zip(t,e)){o||r.push(this.createNode(l,c));const d=i.has(l),h=dt.get(c).code.trim().startsWith("mo.md");!d&&h||r.push(this.createNode(l,c))}return{nodes:r,edges:s}}},EL=t=>{const e=J.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 C=b3.createElements(n,r,o,a.hidePureMarkdown);return C=_3(C.nodes,C.edges,{direction:i}),C},e[0]=r,e[1]=n,e[2]=i,e[3]=a.hidePureMarkdown,e[4]=o,e[5]=l):l=e[5];const[c]=A.useState(l),[d,h,f]=K2(c.nodes),[m,_,g]=X2(c.edges),p=Qi();let b;e[6]!==i||e[7]!==_||e[8]!==h?(b=C=>{const $=_3(C.nodes,C.edges,{direction:i});h($.nodes),_($.edges)},e[6]=i,e[7]=_,e[8]=h,e[9]=b):b=e[9];const y=et(b);let x,v;e[10]!==r||e[11]!==n||e[12]!==a.hidePureMarkdown||e[13]!==y||e[14]!==o?(x=()=>{y(b3.createElements(n,r,o,a.hidePureMarkdown))},v=[n,o,r,y,a.hidePureMarkdown],e[10]=r,e[11]=n,e[12]=a.hidePureMarkdown,e[13]=y,e[14]=o,e[15]=x,e[16]=v):(x=e[15],v=e[16]),A.useEffect(x,v);const[S,k]=A.useState();let E;rk(),e[17]===Symbol.for("react.memo_cache_sentinel")?(E=()=>{k(void 0)},e[17]=E):E=e[17];const N=E;let I,T,M,R,z,D,F,B,V,O;return e[18]===Symbol.for("react.memo_cache_sentinel")?(I={minZoom:.5,maxZoom:1.5},T=(C,$)=>{k({type:"node",id:$.id})},M=(C,$)=>{const{source:j,target:W}=$;k({type:"edge",source:j,target:W})},e[18]=I,e[19]=T,e[20]=M):(I=e[18],T=e[19],M=e[20]),e[21]===Symbol.for("react.memo_cache_sentinel")?(R=u.jsx(YP,{color:"#ccc",variant:$n.Dots}),e[21]=R):R=e[21],e[22]!==p||e[23]!==d?(z=()=>{const C=dt.get(o$);if(C){const $=d.find(j=>j.id===C);$&&(p.fitView({padding:1,duration:600,nodes:[$]}),k({type:"node",id:C}))}},e[22]=p,e[23]=d,e[24]=z):z=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(D=u.jsx(Fp,{className:"size-4"}),e[25]=D):D=e[25],e[26]!==z?(F=u.jsx(VP,{position:"bottom-right",showInteractive:!1,children:u.jsx(Te,{content:"Jump to focused cell",delayDuration:200,side:"left",asChild:!1,children:u.jsx(js,{onMouseDown:Hn.preventFocus,onClick:z,children:D})})}),e[26]=z,e[27]=F):F=e[27],e[28]!==m||e[29]!==S||e[30]!==o?(B=u.jsx(rc,{selection:S,variables:o,edges:m,onClearSelection:N}),e[28]=m,e[29]=S,e[30]=o,e[31]=B):B=e[31],e[32]!==s||e[33]!==m||e[34]!==d||e[35]!==g||e[36]!==f||e[37]!==F||e[38]!==B?(V=u.jsxs(_f,{nodes:d,edges:m,nodeTypes:nk,minZoom:.2,fitViewOptions:I,onNodeClick:T,onEdgeClick:M,onNodeDoubleClick:IL,fitView:!0,onNodesChange:f,onEdgesChange:g,zoomOnDoubleClick:!1,nodesConnectable:!1,children:[R,F,B,s]}),e[32]=s,e[33]=m,e[34]=d,e[35]=g,e[36]=f,e[37]=F,e[38]=B,e[39]=V):V=e[39],e[40]!==i||e[41]!==V?(O=u.jsx(ek,{value:i,children:V}),e[40]=i,e[41]=V,e[42]=O):O=e[42],O};function IL(t,e){bS(e.id,"focus")}const AL=en("_minimap_"),TL=en({hidePureMarkdown:!0}),ML=t=>{const e=J.c(11),[n,o]=an(AL),[r,s]=an(TL);let i;e[0]!==n||e[1]!==t||e[2]!==o||e[3]!==s||e[4]!==r?(i=()=>n==="_minimap_"?u.jsx(QP,{...t,children:u.jsx(xf,{settings:r,onSettingsChange:s,view:n,onChange:o})}):u.jsx(EL,{...t,settings:r,layoutDirection:n,children:u.jsx(xf,{settings:r,onSettingsChange:s,view:n,onChange:o})}),e[0]=n,e[1]=t,e[2]=o,e[3]=s,e[4]=r,e[5]=i):i=e[5];const a=i;let l,c;return e[6]!==a?(l=a(),e[6]=a,e[7]=l):l=e[7],e[8]!==n||e[9]!==l?(c=u.jsx(gf,{children:l},n),e[8]=n,e[9]=l,e[10]=c):c=e[10],c},OL=()=>{const t=J.c(5),e=yS(),n=Kc(),[o]=r$();let r,s;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=Ie("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=u.jsx("div",{className:r,children:u.jsx(ML,{cellAtoms:o,variables:e,cellIds:n.inOrderIds})}),t[1]=n.inOrderIds,t[2]=o,t[3]=e,t[4]=s):s=t[4],s},DL=t=>{const e=J.c(4),{isOpen:n,children:o}=t,[r,s]=Y.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]),Y.useEffect(i,a),r?o:null},RL=t=>{const e=J.c(8),{variableName:n,className:o}=t;let r;e[0]!==n?(r=()=>{const l=function(d){const h=dt.get(xS)[d];if(h)return h.declaredBy[0]}(n);if(!l)return;const c=hc(l);c&&tp(c,n)},e[0]=n,e[1]=r):r=e[1];const s=r;let i,a;return e[2]!==o?(i=Ie("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=u.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},PL=en(t=>{const e=t(s$),n=t(xS),o=t(uS);return Na(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})}),LL=en(t=>{const e=new Map(t(i$));for(const n of wS){const o=e.get(n);o&&o.databases.length===0&&e.delete(n)}return Na([...e.values()],n=>wS.has(n.name)?1:0)}),FL=()=>{const t=J.c(32),[e,n]=Y.useState(""),o=Qt(vS),r=$e(PL),s=$e(LL);if(r.length===0&&s.length===0){let b;return t[0]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(vn,{title:"No tables found",description:"Any datasets/dataframes in the global scope will be shown here.",action:u.jsx(Fg,{children:u.jsxs(Me,{variant:"outline",size:"sm",children:["Add database or catalog",u.jsx(pr,{className:"h-4 w-4 ml-2"})]})}),icon:u.jsx(dr,{})}),t[0]=b):b=t[0],b}const i=!!e.trim();let a,l,c,d,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=u.jsx(aa,{placeholder:"Search tables...",className:"h-6 m-1",value:e,onValueChange:a,rootClassName:"flex-1 border-r"}),t[3]=e,t[4]=a,t[5]=l):l=t[5],t[6]!==i?(c=i&&u.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:u.jsx(oo,{className:"h-4 w-4"})}),t[6]=i,t[7]=c):c=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsx(Fg,{children:u.jsx("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:u.jsx(pr,{className:"h-4 w-4"})})}),t[8]=d):d=t[8],t[9]!==l||t[10]!==c?(h=u.jsxs("div",{className:"flex items-center w-full",children:[l,c,d]}),t[9]=l,t[10]=c,t[11]=h):h=t[11],t[12]!==s||t[13]!==i||t[14]!==e){let b;t[16]!==i||t[17]!==e?(b=y=>u.jsx(zL,{connection:y,hasChildren:y.databases.length>0,children:y.databases.map(x=>u.jsx(BL,{engineName:y.name,database:x,hasSearch:i,children:u.jsx(UL,{schemas:x.schemas,defaultSchema:y.default_schema,defaultDatabase:y.default_database,engineName:y.name,databaseName:x.name,hasSearch:i,searchValue:e})},x.name))},y.name),t[16]=i,t[17]=e,t[18]=b):b=t[18],f=s.map(b),t[12]=s,t[13]=i,t[14]=e,t[15]=f}else f=t[15];return t[19]!==s.length||t[20]!==r.length?(m=s.length>0&&r.length>0&&u.jsxs(kS,{children:[u.jsx(pc,{className:"h-4 w-4 text-muted-foreground"}),u.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&&u.jsx(y3,{tables:r,searchValue:e}),t[22]=e,t[23]=r,t[24]=_):_=t[24],t[25]!==f||t[26]!==m||t[27]!==_?(g=u.jsxs(Vm,{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=u.jsxs(Ic,{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},zL=t=>{const e=J.c(25),{connection:n,children:o,hasChildren:r}=t,s=n.name===a$,i=s?"In-Memory":n.name,[a,l]=Y.useState(!1);let c;e[0]!==n.name?(c=async()=>{l(!0),await c$({engine:n.name}),setTimeout(()=>l(!1),500)},e[0]=n.name,e[1]=c):c=e[1];const d=c;let h,f,m;e[2]!==n.dialect?(h=u.jsx(g4,{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=l$(n.dialect),e[4]=n.dialect,e[5]=f):f=e[5],e[6]!==f?(m=u.jsx("span",{className:"text-xs",children:f}),e[6]=f,e[7]=m):m=e[7];const _=i;let g,p,b,y,x;return e[8]!==_?(g=u.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",u.jsx(RL,{variableName:_}),")"]}),e[8]=_,e[9]=g):g=e[9],e[10]!==d||e[11]!==s||e[12]!==a?(p=!s&&u.jsx(Te,{content:"Refresh connection",children:u.jsx(Me,{variant:"ghost",size:"icon",className:"ml-auto hover:bg-transparent hover:shadow-none",onClick:d,children:u.jsx(Bc,{className:Ie("h-4 w-4 text-muted-foreground hover:text-foreground",a&&"animate-[spin_0.5s]")})})}),e[10]=d,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=u.jsxs(kS,{children:[h,m,g,p]}),e[14]=h,e[15]=m,e[16]=g,e[17]=p,e[18]=b):b=e[18],e[19]!==o||e[20]!==r?(y=r?o:u.jsx(Xc,{content:"No databases available",className:"pl-2"}),e[19]=o,e[20]=r,e[21]=y):y=e[21],e[22]!==b||e[23]!==y?(x=u.jsxs(u.Fragment,{children:[b,y]}),e[22]=b,e[23]=y,e[24]=x):x=e[24],x},BL=t=>{const e=J.c(28),{hasSearch:n,engineName:o,database:r,children:s}=t,[i,a]=Y.useState(!1),[l,c]=Y.useState(!1);let d,h,f;e[0]!==n?(d=()=>{a(n)},h=[n],e[0]=n,e[1]=d,e[2]=h):(d=e[1],h=e[2]),Y.useEffect(d,h),e[3]!==i||e[4]!==l?(f=()=>{a(!i),c(!l)},e[3]=i,e[4]=l,e[5]=f):f=e[5];const m=`${o}:${r.name}`;let _;e[6]!==i?(_=u.jsx(ES,{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=Ie("h-4 w-4",g),e[8]=g,e[9]=p):p=e[9],e[10]!==p?(b=u.jsx(dr,{className:p}),e[10]=p,e[11]=b):b=e[11];const y=l&&i&&"font-semibold";let x,v,S,k;e[12]!==y?(x=Ie(y),e[12]=y,e[13]=x):x=e[13],e[14]!==r.name?(v=r.name===""?u.jsx("i",{children:"Not connected"}):r.name,e[14]=r.name,e[15]=v):v=e[15],e[16]!==x||e[17]!==v?(S=u.jsx("span",{className:x,children:v}),e[16]=x,e[17]=v,e[18]=S):S=e[18],e[19]!==S||e[20]!==f||e[21]!==m||e[22]!==_||e[23]!==b?(k=u.jsxs(go,{className:"text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",onSelect:f,value:m,children:[_,b,S]}),e[19]=S,e[20]=f,e[21]=m,e[22]=_,e[23]=b,e[24]=k):k=e[24];const E=i&&s;let N;return e[25]!==k||e[26]!==E?(N=u.jsxs(u.Fragment,{children:[k,E]}),e[25]=k,e[26]=E,e[27]=N):N=e[27],N},UL=t=>{const e=J.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=u.jsx(Xc,{content:"No schemas available",className:"pl-6"}),e[0]=h):h=e[0],h}let c,d;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=_=>u.jsx(VL,{databaseName:i,schema:_,hasSearch:a,children:u.jsx(y3,{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],c=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]=c}else c=e[8];return e[18]!==c?(d=u.jsx(u.Fragment,{children:c}),e[18]=c,e[19]=d):d=e[19],d},VL=t=>{const e=J.c(26),{databaseName:n,schema:o,children:r,hasSearch:s}=t,[i,a]=Y.useState(!1),[l,c]=Y.useState(!1),d=`${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]),Y.useEffect(h,f),jS(o.name))return r;e[3]!==i||e[4]!==l?(m=()=>{a(!i),c(!l)},e[3]=i,e[4]=l,e[5]=m):m=e[5],e[6]!==i?(_=u.jsx(ES,{isExpanded:i}),e[6]=i,e[7]=_):_=e[7];const g=l&&i&&"text-foreground";let p,b;e[8]!==g?(p=Ie("h-4 w-4 text-muted-foreground",g),e[8]=g,e[9]=p):p=e[9],e[10]!==p?(b=u.jsx(g$,{className:p}),e[10]=p,e[11]=b):b=e[11];const y=l&&i&&"font-semibold";let x,v,S;e[12]!==y?(x=Ie(y),e[12]=y,e[13]=x):x=e[13],e[14]!==o.name||e[15]!==x?(v=u.jsx("span",{className:x,children:o.name}),e[14]=o.name,e[15]=x,e[16]=v):v=e[16],e[17]!==v||e[18]!==m||e[19]!==_||e[20]!==b||e[21]!==d?(S=u.jsxs(go,{className:"text-sm flex flex-row gap-1 items-center pl-5 cursor-pointer rounded-none",onSelect:m,value:d,children:[_,b,v]}),e[17]=v,e[18]=m,e[19]=_,e[20]=b,e[21]=d,e[22]=S):S=e[22];const k=i&&r;let E;return e[23]!==S||e[24]!==k?(E=u.jsxs(u.Fragment,{children:[S,k]}),e[23]=S,e[24]=k,e[25]=E):E=e[25],E},y3=t=>{const e=J.c(24),{tables:n,sqlTableContext:o,searchValue:r}=t,{addTableList:s}=SS(),[i,a]=Y.useState(!1),[l,c]=Y.useState(!1);let d,h;e[0]!==s||e[1]!==o||e[2]!==n.length||e[3]!==i?(d=async()=>{if(n.length===0&&o&&!i){a(!0),c(!0);const{engine:p,database:b,schema:y}=o,x=await LH.request({engine:p,database:b,schema:y});if(!(x!=null&&x.tables))throw c(!1),new Error("No tables available");s({tables:x.tables,sqlTableContext:o}),c(!1)}},e[0]=s,e[1]=o,e[2]=n.length,e[3]=i,e[4]=d):d=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}=Gn(d,h);if(f||l){let p;return e[9]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx(CS,{message:"Loading tables...",className:"pl-12"}),e[9]=p):p=e[9],p}if(m){let p;return e[10]!==m?(p=u.jsx(NS,{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=u.jsx(Xc,{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=x=>!r||x.name.toLowerCase().includes(r.toLowerCase()),e[17]=r,e[18]=p):p=e[18];const b=n.filter(p);let y;e[19]!==r||e[20]!==o?(y=x=>u.jsx($L,{table:x,sqlTableContext:o,isSearching:!!r},x.name),e[19]=r,e[20]=o,e[21]=y):y=e[21],_=b.map(y),e[13]=r,e[14]=o,e[15]=n,e[16]=_}else _=e[16];return e[22]!==_?(g=u.jsx(u.Fragment,{children:_}),e[22]=_,e[23]=g):g=e[23],g},$L=t=>{const e=J.c(62),{table:n,sqlTableContext:o,isSearching:r}=t,{addTable:s}=SS(),[i,a]=Y.useState(!1),[l,c]=Y.useState(!1),d=n.columns.length>0;let h,f;e[0]!==s||e[1]!==i||e[2]!==o||e[3]!==n.name||e[4]!==d||e[5]!==l?(h=async()=>{if(i&&!d&&o&&!l){c(!0);const{engine:q,database:ne,schema:re}=o,ae=await FH.request({engine:q,database:ne,schema:re,tableName:n.name});if(!(ae!=null&&ae.table))throw new Error("No table details available");s({table:ae.table,sqlTableContext:o})}},e[0]=s,e[1]=i,e[2]=o,e[3]=n.name,e[4]=d,e[5]=l,e[6]=h):h=e[6],e[7]!==i||e[8]!==d?(f=[i,d],e[7]=i,e[8]=d,e[9]=f):f=e[9];const{isPending:m,error:_}=Gn(h,f),g=$e(Bs),p=Br(),{createNewCell:b}=Ot();let y;e[10]!==g||e[11]!==b||e[12]!==p||e[13]!==o||e[14]!==n?(y=()=>{ur(g,b,p),b({code:(()=>{if(n.source_type==="catalog"){const q=o!=null&&o.database?`${o.database}.${n.name}`:n.name;return`${n.engine}.load_table("${q}")`}if(o)return IS(n,"*",o);switch(n.source_type){case"local":return`mo.ui.table(${n.name})`;case"duckdb":case"connection":return IS(n,"*",o);default:return vc(n.source_type),""}})(),before:!1,cellId:p??"__end__"})},e[10]=g,e[11]=b,e[12]=p,e[13]=o,e[14]=n,e[15]=y):y=e[15];const x=y;let v;e[16]!==n.num_columns||e[17]!==n.num_rows?(v=()=>{const q=[];return n.num_rows!=null&&q.push(`${n.num_rows} rows`),n.num_columns!=null&&q.push(`${n.num_columns} columns`),q.length===0?null:u.jsx("div",{className:"flex flex-row gap-2 items-center pl-6 group-hover:hidden",children:u.jsx("span",{className:"text-xs text-muted-foreground",children:q.join(", ")})})},e[16]=n.num_columns,e[17]=n.num_rows,e[18]=v):v=e[18];const S=v;let k;e[19]!==_||e[20]!==m||e[21]!==o||e[22]!==n?(k=()=>{if(m)return u.jsx(CS,{message:"Loading columns...",className:"pl-12"});if(_)return u.jsx(NS,{error:_,className:"pl-12"});const q=n.columns;return q.length===0?u.jsx(Xc,{content:"No columns found",className:"pl-12"}):q.map(ne=>u.jsx(HL,{table:n,column:ne,sqlTableContext:o},ne.name))},e[19]=_,e[20]=m,e[21]=o,e[22]=n,e[23]=k):k=e[23];const E=k;let N;e[24]!==i||e[25]!==r||e[26]!==n.source_type||e[27]!==n.type?(N=()=>{if(n.source_type==="local")return;const q=n.type==="table"?d$:t4;return u.jsx(q,{className:"h-3 w-3",strokeWidth:i||r?2.5:void 0})},e[24]=i,e[25]=r,e[26]=n.source_type,e[27]=n.type,e[28]=N):N=e[28];const I=N,T=o?`${o.database}.${o.schema}.${n.name}`:n.name,M=o&&(jS(o.schema)?"pl-9":"pl-12"),R=(i||r)&&"font-semibold";let z,D,F,B,V,O,C,$,j,W,K,Z;return e[29]!==M||e[30]!==R?(z=Ie("rounded-none group h-8 cursor-pointer",M,R),e[29]=M,e[30]=R,e[31]=z):z=e[31],e[32]!==i?(D=()=>a(!i),e[32]=i,e[33]=D):D=e[33],e[34]!==I?(F=I(),e[34]=I,e[35]=F):F=e[35],e[36]!==n.name?(B=u.jsx("span",{className:"text-sm",children:n.name}),e[36]=n.name,e[37]=B):B=e[37],e[38]!==F||e[39]!==B?(V=u.jsxs("div",{className:"flex gap-2 items-center flex-1",children:[F,B]}),e[38]=F,e[39]=B,e[40]=V):V=e[40],e[41]!==S?(O=S(),e[41]=S,e[42]=O):O=e[42],e[43]!==x?(C=Hn.stopPropagation(()=>x()),e[43]=x,e[44]=C):C=e[44],e[45]===Symbol.for("react.memo_cache_sentinel")?($=u.jsx(u$,{className:"h-3 w-3"}),e[45]=$):$=e[45],e[46]!==C?(j=u.jsx(Te,{content:"Add table to notebook",delayDuration:400,children:u.jsx(Me,{className:"group-hover:inline-flex hidden",variant:"text",size:"icon",onClick:C,children:$})}),e[46]=C,e[47]=j):j=e[47],e[48]!==i||e[49]!==D||e[50]!==V||e[51]!==O||e[52]!==j||e[53]!==z||e[54]!==T?(W=u.jsxs(go,{className:z,value:T,"aria-selected":i,forceMount:!0,onSelect:D,children:[V,O,j]}),e[48]=i,e[49]=D,e[50]=V,e[51]=O,e[52]=j,e[53]=z,e[54]=T,e[55]=W):W=e[55],e[56]!==i||e[57]!==E?(K=i&&E(),e[56]=i,e[57]=E,e[58]=K):K=e[58],e[59]!==W||e[60]!==K?(Z=u.jsxs(u.Fragment,{children:[W,K]}),e[59]=W,e[60]=K,e[61]=Z):Z=e[61],Z},HL=t=>{var K,Z;const e=J.c(53),{table:n,column:o,sqlTableContext:r}=t,[s,i]=Y.useState(!1),a=$e(vS),l=Qt(h$);let c,d;e[0]!==a?(c=()=>{a&&i(!1)},d=[a],e[0]=a,e[1]=c,e[2]=d):(c=e[1],d=e[2]),Y.useEffect(c,d),l(s?q=>new Set([...q,`${n.name}:${o.name}`]):q=>(q.delete(`${n.name}:${o.name}`),new Set(q)));const h=$e(Bs),f=Br(),{createNewCell:m}=Ot(),{columnsPreviews:_}=f$();let g;e[3]!==o.name||e[4]!==n.primary_keys?(g=((K=n.primary_keys)==null?void 0:K.includes(o.name))||!1,e[3]=o.name,e[4]=n.primary_keys,e[5]=g):g=e[5];const p=g;let b;e[6]!==o.name||e[7]!==n.indexes?(b=((Z=n.indexes)==null?void 0:Z.includes(o.name))||!1,e[6]=o.name,e[7]=n.indexes,e[8]=b):b=e[8];const y=b;let x;e[9]!==h||e[10]!==m||e[11]!==f?(x=q=>{q.includes("alt")&&_$(h,m,f),m({code:q,before:!1,cellId:f??"__end__"})},e[9]=h,e[10]=m,e[11]=f,e[12]=x):x=e[12];const v=x,S=WL,k=s?"font-semibold":"";let E;e[13]!==o.name||e[14]!==k?(E=u.jsx("span",{className:k,children:o.name}),e[13]=o.name,e[14]=k,e[15]=E):E=e[15];const N=E,I=`${n.name}.${o.name}`,T=`${n.name}.${o.name}`;let M;e[16]!==s?(M=()=>i(!s),e[16]=s,e[17]=M):M=e[17];const R=r?"pl-14":"pl-7";let z,D,F,B,V,O,C,$,j,W;return e[18]!==R?(z=Ie("flex flex-row gap-2 items-center flex-1",R),e[18]=R,e[19]=z):z=e[19],e[20]!==o.type||e[21]!==N?(D=u.jsx(m$,{columnName:N,dataType:o.type}),e[20]=o.type,e[21]=N,e[22]=D):D=e[22],e[23]!==p?(F=p&&S({tooltipContent:"Primary key",content:"PK"}),e[23]=p,e[24]=F):F=e[24],e[25]!==y?(B=y&&S({tooltipContent:"Indexed",content:"IDX"}),e[25]=y,e[26]=B):B=e[26],e[27]!==z||e[28]!==D||e[29]!==F||e[30]!==B?(V=u.jsxs("div",{className:z,children:[D,F,B]}),e[27]=z,e[28]=D,e[29]=F,e[30]=B,e[31]=V):V=e[31],e[32]!==o.name?(O=u.jsx(Te,{content:"Copy column name",delayDuration:400,children:u.jsx(Me,{variant:"text",size:"icon",className:"group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground",children:u.jsx(pS,{tooltip:!1,value:o.name,className:"h-3 w-3"})})}),e[32]=o.name,e[33]=O):O=e[33],e[34]!==o.external_type?(C=u.jsx("span",{className:"text-xs text-muted-foreground",children:o.external_type}),e[34]=o.external_type,e[35]=C):C=e[35],e[36]!==M||e[37]!==V||e[38]!==O||e[39]!==C||e[40]!==I||e[41]!==T?($=u.jsxs(go,{className:"rounded-none py-1 group cursor-pointer",value:T,onSelect:M,children:[V,O,C]},I),e[36]=M,e[37]=V,e[38]=O,e[39]=C,e[40]=I,e[41]=T,e[42]=$):$=e[42],e[43]!==o||e[44]!==_||e[45]!==v||e[46]!==s||e[47]!==r||e[48]!==n?(j=s&&u.jsx("div",{className:"pl-10 pr-2 py-2 bg-[var(--slate-1)] shadow-inner border-b",children:u.jsx(Ac,{children:u.jsx(p$,{table:n,column:o,onAddColumnChart:v,preview:_.get(r?`${r.database}.${r.schema}.${n.name}:${o.name}`:`${n.name}:${o.name}`),sqlTableContext:r})})}),e[43]=o,e[44]=_,e[45]=v,e[46]=s,e[47]=r,e[48]=n,e[49]=j):j=e[49],e[50]!==$||e[51]!==j?(W=u.jsxs(u.Fragment,{children:[$,j]}),e[50]=$,e[51]=j,e[52]=W):W=e[52],W};function WL(t){const{tooltipContent:e,content:n}=t;return u.jsx(Te,{content:e,delayDuration:100,children:u.jsx("span",{className:"text-xs text-black bg-gray-100 dark:invert rounded px-1",children:n})})}const qL=()=>{const t=J.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx(FL,{}),t[0]=e):e=t[0],e},GL=()=>{const t=J.c(5),{documentation:e}=$e(b$);if(!e){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(vn,{title:"View docs as you type",description:"Move your text cursor over a symbol to see its documentation.",icon:u.jsx(md,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=ep({html:e}),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=u.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},YL=()=>{const t=J.c(5),e=y$();if(e.length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(vn,{title:"No errors!",icon:u.jsx(Wp,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=e.map(JL),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=u.jsx("div",{className:"flex flex-col overflow-auto",children:n}),t[3]=n,t[4]=o):o=t[4],o};function JL(t){return u.jsxs("div",{children:[u.jsx("div",{className:"text-xs font-mono font-semibold bg-muted border-y px-2 py-1",children:u.jsx(x$,{cellId:t.cellId})}),u.jsx("div",{className:"px-2",children:u.jsx(w$,{errors:t.output.data,cellId:t.cellId},t.cellId)},t.cellId)]},t.cellId)}function x3(t,e,n){return t[e]?t[e][0]?t[e][0][n]:t[e][n]:e==="contentBoxSize"?t.contentRect[n==="inlineSize"?"width":"height"]:void 0}gp=function(t){t===void 0&&(t={});var e=t.onResize,n=A.useRef(void 0);n.current=e;var o=t.round||Math.round,r=A.useRef(),s=A.useState({width:void 0,height:void 0}),i=s[0],a=s[1],l=A.useRef(!1);A.useEffect(function(){return l.current=!1,function(){l.current=!0}},[]);var c=A.useRef({width:void 0,height:void 0}),d=function(h,f){var m=A.useRef(null),_=A.useRef(null);_.current=f;var g=A.useRef(null);A.useEffect(function(){p()});var p=A.useCallback(function(){var b=g.current,y=_.current,x=b||(y?y instanceof Element?y:y.current:null);m.current&&m.current.element===x&&m.current.subscriber===h||(m.current&&m.current.cleanup&&m.current.cleanup(),m.current={element:x,subscriber:h,cleanup:x?h(x):void 0})},[h]);return A.useEffect(function(){return function(){m.current&&m.current.cleanup&&(m.current.cleanup(),m.current=null)}},[]),A.useCallback(function(b){g.current=b,p()},[p])}(A.useCallback(function(h){return r.current&&r.current.box===t.box&&r.current.round===o||(r.current={box:t.box,round:o,instance:new ResizeObserver(function(f){var m=f[0],_=t.box==="border-box"?"borderBoxSize":t.box==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",g=x3(m,_,"inlineSize"),p=x3(m,_,"blockSize"),b=g?o(g):void 0,y=p?o(p):void 0;if(c.current.width!==b||c.current.height!==y){var x={width:b,height:y};c.current.width=b,c.current.height=y,n.current?n.current(x):l.current||a(x)}})}),r.current.instance.observe(h,{box:t.box}),function(){r.current&&r.current.instance.unobserve(h)}},[t.box,o]),t.ref);return A.useMemo(function(){return{ref:d,width:i.width,height:i.height}},[d,i.width,i.height])};const rm=new Map,KL=({file:t,onOpenNotebook:e})=>{const{theme:n}=zo(),o=$e(ym),[r,s]=A.useState(""),{data:i,isPending:a,error:l,setData:c}=Gn(async()=>{const g=await np({path:t.path}),p=g.contents||"";return s(rm.get(t.path)||p),g},[t.path]),d=async()=>{r!==(i==null?void 0:i.contents)&&await I$({path:t.path,contents:r}).then(g=>{g.success&&(c(p=>({...p,contents:r})),s(r))})},h=A.useRef(r);if(h.current=r,A.useEffect(()=>()=>{if(!(i!=null&&i.contents))return;const g=h.current;g===i.contents?rm.delete(t.path):rm.set(t.path,g)},[t.path,i==null?void 0:i.contents]),l)return u.jsx(Vr,{error:l});if(a||!i)return null;const f=i.mimeType||"text/plain",m=f in sm;if(!i.contents&&!m)return u.jsxs("div",{className:"grid grid-cols-2 gap-2 p-6",children:[u.jsx("div",{className:"font-bold text-muted-foreground",children:"Name"}),u.jsx("div",{children:i.file.name}),u.jsx("div",{className:"font-bold text-muted-foreground",children:"Type"}),u.jsx("div",{children:f})]});const _=u.jsxs("div",{className:"text-xs text-muted-foreground p-1 flex justify-end gap-2 border-b",children:[t.isMarimoFile&&!In()&&u.jsx(Te,{content:"Open notebook",children:u.jsx(wn,{size:"small",onClick:g=>e(g),children:u.jsx(jc,{})})}),u.jsx(Te,{content:"Download",children:u.jsx(wn,{size:"small",onClick:()=>{if(w3(f)){const g=j$(i.contents,f);return void E$(g,i.file.name)}ua(new Blob([i.contents||r],{type:f}),i.file.name)},children:u.jsx(Em,{})})}),!w3(f)&&u.jsxs(u.Fragment,{children:[u.jsx(Te,{content:"Copy contents to clipboard",children:u.jsx(wn,{size:"small",onClick:async()=>{await xn(r)},children:u.jsx(ra,{})})}),u.jsx(Te,{content:pn("global.save"),children:u.jsx(wn,{size:"small",color:r===i.contents?void 0:"green",onClick:d,disabled:r===i.contents,children:u.jsx(Ma,{})})})]})]});return f.startsWith("image/")?u.jsxs(u.Fragment,{children:[_,u.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:u.jsx(v$,{base64:i.contents,mime:f})})]}):f==="text/csv"&&i.contents?u.jsxs(u.Fragment,{children:[_,u.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:u.jsx(k$,{contents:i.contents})})]}):f.startsWith("audio/")?u.jsxs(u.Fragment,{children:[_,u.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:u.jsx(S$,{base64:i.contents,mime:f})})]}):f.startsWith("video/")?u.jsxs(u.Fragment,{children:[_,u.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:u.jsx(C$,{base64:i.contents,mime:f})})]}):f.startsWith("application/pdf")?u.jsxs(u.Fragment,{children:[_,u.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:u.jsx(N$,{base64:i.contents,mime:f})})]}):u.jsxs(u.Fragment,{children:[_,u.jsx("div",{className:"flex-1 overflow-auto",children:u.jsx(A.Suspense,{children:u.jsx(ka,{theme:n==="dark"?"dark":"light",language:sm[f]||sm.default,className:"border-b",extensions:[st.lineWrapping,Yn.of([{key:o.getHotkey("global.save").key,stopPropagation:!0,run:()=>r!==i.contents&&(d(),!0)}])],value:r,onChange:s})})})]})},w3=t=>t.startsWith("image/")||t.startsWith("audio/")||t.startsWith("video/")||t.startsWith("application/pdf"),sm={"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"},v3=en(new class{constructor(t){this.callbacks=t,this.delegate=new cp([]),this.rootPath="",this.onChange=An.NOOP,this.path=new Sc("/"),this.initialize=async e=>{if(this.onChange=e,this.delegate.data.length===0)try{const n=await this.callbacks.listFiles({path:this.rootPath});this.delegate=new cp(n.files),this.rootPath=n.root,this.path=Sc.guessDeliminator(n.root)}catch(n){lt({title:"Failed",description:J4(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 cp(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:(lt({title:"Failed",description:e.message}),null)}async expand(t){const e=this.delegate.find(t);if(!e||!e.data.isDirectory)return!1;if(e.children&&e.children.length>0)return!0;const n=await this.callbacks.listFiles({path:e.data.path});return this.delegate.update({id:t,changes:{children:n.files}}),this.onChange(this.delegate.data),!0}async rename(t,e){const n=this.delegate.find(t);if(!n)return;const o=n.data.path,r=this.path.join(this.path.dirname(o),e);await this.callbacks.renameFileOrFolder({path:o,newPath:r}).then(this.handleResponse),this.delegate.update({id:t,changes:{name:e,path:r}}),this.onChange(this.delegate.data),await this.refreshAll([r])}async move(t,e){var o;const n=e?((o=this.delegate.find(e))==null?void 0:o.data.path)??e:this.rootPath;await Promise.all(t.map(r=>{this.delegate.move({id:r,parentId:e,index:0});const s=this.delegate.find(r);if(!s)return Promise.resolve();const i=this.path.join(n,this.path.basename(s.data.path));return this.delegate.update({id:r,changes:{path:i}}),this.callbacks.renameFileOrFolder({path:s.data.path,newPath:i}).then(this.handleResponse)})),this.onChange(this.delegate.data),await this.refreshAll([n])}async createFile(t,e){var r;const n=e?((r=this.delegate.find(e))==null?void 0:r.data.path)??e:this.rootPath,o=await this.callbacks.createFileOrFolder({path:n,type:"file",name:t}).then(this.handleResponse);o!=null&&o.info&&(this.delegate.create({parentId:e,index:0,data:o.info}),this.onChange(this.delegate.data),await this.refreshAll([n]))}async createFolder(t,e){var r;const n=e?((r=this.delegate.find(e))==null?void 0:r.data.path)??e:this.rootPath,o=await this.callbacks.createFileOrFolder({path:n,type:"directory",name:t}).then(this.handleResponse);o!=null&&o.info&&(this.delegate.create({parentId:e,index:0,data:o.info}),this.onChange(this.delegate.data),await this.refreshAll([n]))}async delete(t){const e=this.delegate.find(t);e&&(await this.callbacks.deleteFileOrFolder({path:e.data.path}).then(this.handleResponse),this.delegate.drop({id:t}),this.onChange(this.delegate.data))}}({listFiles:S4,createFileOrFolder:op,deleteFileOrFolder:T$,renameFileOrFolder:A$})),XL=en({});function ZL(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 k3(t){const e=J.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:oF,onDropRejected:eF,onDrop:QL,...o},e[2]=o,e[3]=r):r=e[3],M$(r)}async function QL(t){for(const e of t){const n=sF(rF(e));let o="";n&&(o=Sc.guessDeliminator(n).dirname(n));const r=(await ZL(e)).split(",")[1];await op({path:o,type:"file",name:e.name,contents:r})}await async function(){await dt.get(v3).refreshAll([])}()}function eF(t){lt({title:"File upload failed",description:u.jsx("div",{className:"flex flex-col gap-1",children:t.map(tF)}),variant:"danger"})}function tF(t){return u.jsxs("div",{children:[t.file.name," (",t.errors.map(nF).join(", "),")"]},t.file.name)}function nF(t){return t.message}function oF(t){Dt.error(t),lt({title:"File upload failed",description:t.message,variant:"danger"})}function rF(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 sF(t){if(t)return t.replace(/^\/+/,"")}const S3=Y.createContext(null),iF=t=>{const e=J.c(60),{height:n}=t,o=A.useRef(null),[r]=an(v3);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=[],e[0]=s):s=e[0];const[i,a]=A.useState(s),[l,c]=A.useState(null),{openPrompt:d}=qn(),[h,f]=an(XL);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}=Gn(m,_);let b;e[4]!==h||e[5]!==r?(b=()=>{r.refreshAll(Object.keys(h).filter(C=>h[C]))},e[4]=h,e[5]=r,e[6]=b):b=e[6];const y=et(b);let x;e[7]!==d||e[8]!==r?(x=async()=>{d({title:"Folder name",onConfirm:async C=>{r.createFolder(C,null)}})},e[7]=d,e[8]=r,e[9]=x):x=e[9];const v=et(x);let S;e[10]!==d||e[11]!==r?(S=async()=>{d({title:"File name",onConfirm:async C=>{r.createFile(C,null)}})},e[10]=d,e[11]=r,e[12]=S):S=e[12];const k=et(S);let E;e[13]!==f?(E=()=>{var C;(C=o.current)==null||C.closeAll(),f({})},e[13]=f,e[14]=E):E=e[14];const N=et(E);if(g){let C;return e[15]===Symbol.for("react.memo_cache_sentinel")?(C=u.jsx(Kn,{size:"medium",centered:!0}),e[15]=C):C=e[15],C}if(p){let C;return e[16]!==p?(C=u.jsx(Vr,{error:p}),e[16]=p,e[17]=C):C=e[17],C}if(l){let C,$,j,W,K,Z;return e[18]===Symbol.for("react.memo_cache_sentinel")?(C=()=>c(null),e[18]=C):C=e[18],e[19]===Symbol.for("react.memo_cache_sentinel")?($=u.jsx(Me,{onClick:C,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:u.jsx(Et,{size:16})}),e[19]=$):$=e[19],e[20]!==l.name?(j=u.jsxs("div",{className:"flex items-center pl-1 pr-3 flex-shrink-0 border-b justify-between",children:[$,u.jsx("span",{className:"font-bold",children:l.name})]}),e[20]=l.name,e[21]=j):j=e[21],e[22]!==l.path||e[23]!==r?(W=q=>C3(q,r.relativeFromRoot(l.path)),e[22]=l.path,e[23]=r,e[24]=W):W=e[24],e[25]!==l||e[26]!==W?(K=u.jsx(A.Suspense,{children:u.jsx(KL,{onOpenNotebook:W,file:l})}),e[25]=l,e[26]=W,e[27]=K):K=e[27],e[28]!==j||e[29]!==K?(Z=u.jsxs(u.Fragment,{children:[j,K]}),e[28]=j,e[29]=K,e[30]=Z):Z=e[30],Z}let I;e[31]!==N||e[32]!==k||e[33]!==v||e[34]!==y||e[35]!==r?(I=u.jsx(lF,{onRefresh:y,onCreateFile:k,onCreateFolder:v,onCollapseAll:N,tree:r}),e[31]=N,e[32]=k,e[33]=v,e[34]=y,e[35]=r,e[36]=I):I=e[36];const T=n-33;let M,R,z,D,F,B,V,O;return e[37]!==r?(M=async C=>{const{ids:$}=C;for(const j of $)await r.delete(j)},R=async C=>{const{id:$,name:j}=C;await r.rename($,j)},z=async C=>{const{dragIds:$,parentId:j}=C;await r.move($,j)},e[37]=r,e[38]=M,e[39]=R,e[40]=z):(M=e[38],R=e[39],z=e[40]),e[41]===Symbol.for("react.memo_cache_sentinel")?(D=C=>{const $=C[0];$&&($.data.isDirectory||c($.data))},e[41]=D):D=e[41],e[42]!==h||e[43]!==f||e[44]!==r?(F=async C=>{if(await r.expand(C)){const $=h[C]??!1;f({...h,[C]:!$})}},e[42]=h,e[43]=f,e[44]=r,e[45]=F):F=e[45],e[46]!==i||e[47]!==h||e[48]!==M||e[49]!==R||e[50]!==z||e[51]!==F||e[52]!==T?(B=u.jsx(yH,{width:"100%",ref:o,height:T,className:"h-full",data:i,initialOpenState:h,openByDefault:!1,renderCursor:fF,disableDrop:mF,onDelete:M,onRename:R,onMove:z,onSelect:D,onToggle:F,padding:15,rowHeight:30,indent:aF,overscanCount:1e3,disableMultiSelection:!0,children:uF}),e[46]=i,e[47]=h,e[48]=M,e[49]=R,e[50]=z,e[51]=F,e[52]=T,e[53]=B):B=e[53],e[54]!==B||e[55]!==r?(V=u.jsx(S3,{value:r,children:B}),e[54]=B,e[55]=r,e[56]=V):V=e[56],e[57]!==V||e[58]!==I?(O=u.jsxs(u.Fragment,{children:[I,V]}),e[57]=V,e[58]=I,e[59]=O):O=e[59],O},aF=15,lF=t=>{const e=J.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}=k3(i);let c,d,h,f,m,_,g,p,b,y,x,v,S,k,E;return e[1]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(Aa,{size:16}),e[1]=c):c=e[1],e[2]!==o?(d=u.jsx(Te,{content:"Add file",children:u.jsx(Me,{"data-testid":"file-explorer-add-file-button",onClick:o,variant:"text",size:"xs",children:c})}),e[2]=o,e[3]=d):d=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(id,{size:16}),e[4]=h):h=e[4],e[5]!==r?(f=u.jsx(Te,{content:"Add folder",children:u.jsx(Me,{"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")?(_=O$({variant:"text",size:"xs"}),g=u.jsx(R$,{size:16}),e[9]=_,e[10]=g):(_=e[9],g=e[10]),e[11]!==m?(p=u.jsx(Te,{content:"Upload file",children:u.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?(y=u.jsx("input",{...b,type:"file"}),e[15]=b,e[16]=y):y=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx(eS,{size:16}),e[17]=x):x=e[17],e[18]!==n?(v=u.jsx(Te,{content:"Refresh",children:u.jsx(Me,{"data-testid":"file-explorer-refresh-button",onClick:n,variant:"text",size:"xs",children:x})}),e[18]=n,e[19]=v):v=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(S=u.jsx(Sp,{size:16}),e[20]=S):S=e[20],e[21]!==s?(k=u.jsx(Te,{content:"Collapse all folders",children:u.jsx(Me,{"data-testid":"file-explorer-collapse-button",onClick:s,variant:"text",size:"xs",children:S})}),e[21]=s,e[22]=k):k=e[22],e[23]!==y||e[24]!==v||e[25]!==k||e[26]!==d||e[27]!==f||e[28]!==p?(E=u.jsxs("div",{className:"flex items-center justify-end px-2 flex-shrink-0 border-b",children:[d,f,p,y,v,k]}),e[23]=y,e[24]=v,e[25]=k,e[26]=d,e[27]=f,e[28]=p,e[29]=E):E=e[29],E},cF=t=>{const e=J.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&&!In()&&u.jsxs("span",{className:"flex-shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline",onClick:o,children:["open ",u.jsx(jc,{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=u.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},dF=t=>{const e=J.c(10),{node:n}=t,o=A.useRef(null);let r,s,i,a,l;return e[0]!==n.data.name?(r=()=>{var c,d;(c=o.current)==null||c.focus(),(d=o.current)==null||d.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]),A.useEffect(r,s),e[3]!==n?(i=()=>n.reset(),a=c=>{c.key==="Escape"&&n.reset(),c.key==="Enter"&&n.submit(c.currentTarget.value)},e[3]=n,e[4]=i,e[5]=a):(i=e[4],a=e[5]),e[6]!==n.data.name||e[7]!==i||e[8]!==a?(l=u.jsx("input",{ref:o,className:"flex-1 bg-transparent border border-border text-muted-foreground",defaultValue:n.data.name,onClick:pF,onBlur:i,onKeyDown:a}),e[6]=n.data.name,e[7]=i,e[8]=a,e[9]=l):l=e[9],l},uF=({node:t,style:e,dragHandle:n})=>{const o=t.data.isDirectory?"directory":v4(t.data.name),r=k4[o],{openConfirm:s,openPrompt:i}=qn(),{createNewCell:a}=Ot(),l=Br(),c=A.use(S3),d=async g=>{C3(g,c?c.relativeFromRoot(t.data.path):t.data.path)},h=async g=>{g.stopPropagation(),g.preventDefault(),s({title:"Delete file",description:`Are you sure you want to delete ${t.data.name}?`,confirmAction:u.jsx(_4,{onClick:async()=>{await t.tree.delete(t.id)},"aria-label":"Confirm",children:"Delete"})})},f=et(async()=>{t.open(),i({title:"Folder name",onConfirm:async g=>{c==null||c.createFolder(g,t.id)}})}),m=et(async()=>{t.open(),i({title:"File name",onConfirm:async g=>{c==null||c.createFile(g,t.id)}})}),_=et(async()=>{var y;if(!c||t.data.isDirectory)return;const[g,p]=D$(t.data.name),b=`${g}_copy${p}`;try{const x=await np({path:t.data.path}),v=((y=t.parent)==null?void 0:y.data.path)||"";await op({path:v,type:"file",name:b,contents:x.contents?btoa(x.contents):void 0}),await c.refreshAll([v])}catch{lt({title:"Failed to duplicate file",description:"Unable to create a duplicate of the file",variant:"danger"})}});return u.jsxs("div",{style:e,ref:n,className:Ie("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:[u.jsx(hF,{node:t}),u.jsxs("span",{className:Ie("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?u.jsx("img",{src:"./favicon.ico",className:"w-5 h-5 flex-shrink-0 mr-2 filter grayscale",alt:"Marimo"}):u.jsx(r,{className:"w-5 h-5 flex-shrink-0 mr-2",strokeWidth:1.5}),t.isEditing?u.jsx(dF,{node:t}):u.jsx(cF,{node:t,onOpenMarimoFile:d}),u.jsxs(Hs,{modal:!1,children:[u.jsx(Ws,{asChild:!0,tabIndex:-1,onClick:g=>g.stopPropagation(),children:u.jsx(Me,{"data-testid":"file-explorer-more-button",variant:"text",tabIndex:-1,size:"xs",className:"mb-0","aria-label":"More options",children:u.jsx(sd,{strokeWidth:2,className:"w-5 h-5 hidden group-hover:block"})})}),(()=>{const g={size:14,strokeWidth:1.5,className:"mr-2"};return u.jsxs(qs,{align:"end",className:"no-print w-[220px]",onClick:p=>p.stopPropagation(),onCloseAutoFocus:p=>p.preventDefault(),children:[!t.data.isDirectory&&u.jsxs(Gt,{onSelect:()=>t.select(),children:[u.jsx(ig,{...g}),"Open file"]}),!t.data.isDirectory&&!In()&&u.jsxs(Gt,{onSelect:()=>{P$({path:t.data.path})},children:[u.jsx(jc,{...g}),"Open file in external editor"]}),t.data.isDirectory&&u.jsxs(u.Fragment,{children:[u.jsxs(Gt,{onSelect:()=>m(),children:[u.jsx(Aa,{...g}),"Create file"]}),u.jsxs(Gt,{onSelect:()=>f(),children:[u.jsx(id,{...g}),"Create folder"]}),u.jsx(_o,{})]}),u.jsxs(Gt,{onSelect:()=>t.edit(),children:[u.jsx(qp,{...g}),"Rename"]}),!t.data.isDirectory&&u.jsxs(Gt,{onSelect:_,children:[u.jsx(ra,{...g}),"Duplicate"]}),u.jsxs(Gt,{onSelect:async()=>{await xn(t.data.path),lt({title:"Copied to clipboard"})},children:[u.jsx(cd,{...g}),"Copy path"]}),c&&u.jsxs(Gt,{onSelect:async()=>{await xn(c.relativeFromRoot(t.data.path)),lt({title:"Copied to clipboard"})},children:[u.jsx(cd,{...g}),"Copy relative path"]}),u.jsx(_o,{}),u.jsxs(Gt,{onSelect:()=>{const{path:p}=t.data;(b=>{a({code:b,before:!1,cellId:l??"__end__"})})(AS[o](p))},children:[u.jsx(Wr,{...g}),"Insert snippet for reading file"]}),u.jsxs(Gt,{onSelect:async()=>{lt({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=AS[o](p);await xn(b)},children:[u.jsx(L$,{...g}),"Copy snippet for reading file"]}),t.data.isMarimoFile&&!In()&&u.jsxs(u.Fragment,{children:[u.jsx(_o,{}),u.jsxs(Gt,{onSelect:d,children:[u.jsx(tg,{...g}),"Open notebook"]})]}),u.jsx(_o,{}),!t.data.isDirectory&&u.jsxs(u.Fragment,{children:[u.jsxs(Gt,{onSelect:async()=>{const p=(await np({path:t.data.path})).contents||"";ua(new Blob([p]),t.data.name)},children:[u.jsx(Em,{...g}),"Download"]}),u.jsx(_o,{})]}),u.jsxs(Gt,{onSelect:h,variant:"danger",children:[u.jsx(bm,{...g}),"Delete"]})]})})()]})]})]})},hF=t=>{const e=J.c(3),{node:n}=t;if(!n.data.isDirectory){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=u.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?u.jsx(Vs,{className:"w-5 h-5 flex-shrink-0"}):u.jsx(ia,{className:"w-5 h-5 flex-shrink-0"}),e[1]=n.isOpen,e[2]=o):o=e[2],o};function C3(t,e){t.stopPropagation(),t.preventDefault(),window.open(`/?file=${e}`,"_blank")}function fF(){return null}function mF(t){const{parentNode:e}=t;return!e.data.isDirectory}function pF(t){return t.stopPropagation()}let N3,j3,E3;N3=()=>{const t=J.c(20),{ref:e,height:n}=gp(),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}=k3(r);let l,c,d,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")?(c=Ie("flex flex-col flex-1 overflow-hidden relative"),t[3]=c):c=t[3],t[4]!==i?(d=i(),t[4]=i,t[5]=d):d=t[5],t[6]!==d?(h=u.jsx("input",{...d}),t[6]=d,t[7]=h):h=t[7],t[8]!==a?(f=a&&u.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=u.jsx(iF,{height:o}),t[10]=o,t[11]=m):m=t[11],t[12]!==e||t[13]!==m?(_=u.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=u.jsxs("div",{...l,className:c,children:[h,f,_]}),t[15]=l,t[16]=h,t[17]=f,t[18]=_,t[19]=g):g=t[19],g},pp=t=>{const e=J.c(6),n=t.dataTestId;let o,r;return e[0]!==t.className?(o=Ie("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=u.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},j3=()=>{const t=J.c(9),e=F$(),{clearLogs:n}=Ot();if(e.length===0){let i,a;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx("code",{className:"border rounded px-1",children:"stdout"}),t[0]=i):i=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx(vn,{title:"No logs",description:u.jsxs("span",{children:[i," and"," ",u.jsx("code",{className:"border rounded px-1",children:"stderr"})," logs will appear here."]}),icon:u.jsx(mm,{})}),t[1]=a):a=t[1],a}let o,r,s;return t[2]!==n?(o=u.jsx("div",{className:"flex flex-row justify-end px-2 py-1",children:u.jsx(pp,{dataTestId:"clear-logs-button",onClick:n})}),t[2]=n,t[3]=o):o=t[3],t[4]!==e?(r=u.jsx("div",{className:"overflow-auto flex-1",children:u.jsx(E3,{logs:e,className:"min-w-[300px]"})}),t[4]=e,t[5]=r):r=t[5],t[6]!==o||t[7]!==r?(s=u.jsxs(u.Fragment,{children:[o,r]}),t[6]=o,t[7]=r,t[8]=s):s=t[8],s},E3=t=>{const e=J.c(10),{logs:n,className:o}=t;let r,s,i,a,l;return e[0]!==o?(r=Ie("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(bF),e[3]=n,e[4]=i):i=e[4],e[5]!==i?(a=u.jsx("pre",{className:"grid text-xs font-mono gap-1 whitespace-break-spaces font-semibold align-left",children:u.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=u.jsx("div",{className:r,children:a}),e[7]=r,e[8]=a,e[9]=l):l=e[9],l};function gF(t){const e=z$(t.timestamp),n=_F[t.level],o=t.level.toUpperCase();return u.jsxs(u.Fragment,{children:[u.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)] dark:text-[var(--gray-11)]",children:["[",e,"]"]}),u.jsx("span",{className:Ie("flex-shrink-0",n),children:o}),u.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)]",children:["(",u.jsx(gr,{cellId:t.cellId}),")"]}),t.message]})}const _F={stdout:"text-[var(--grass-9)]",stderr:"text-[var(--red-9)]"};function bF(t,e){return u.jsxs("div",{className:"contents group",children:[u.jsx("span",{className:Ie("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","text-right col-span-1 py-1 pr-1"),children:e+1}),u.jsx("span",{className:Ie("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","px-2 flex gap-x-1.5 py-1 flex-wrap"),children:gF(t)})]},e)}const yF=()=>{const t=J.c(7),{items:e}=$e(B$);let n,o;t[0]!==e?(o=zH(e),t[0]=e,t[1]=o):o=t[1],n=o;const r=n,{activeHeaderId:s,activeOccurrences:i}=BH(r);if(e.length===0){let l;return t[2]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx(vn,{title:"No outline",description:"Add markdown headings to your notebook to create an outline.",icon:u.jsx(fd,{})}),t[2]=l):l=t[2],l}let a;return t[3]!==s||t[4]!==i||t[5]!==e?(a=u.jsx(UH,{items:e,activeHeaderId:s,activeOccurrences:i}),t[3]=s,t[4]=i,t[5]=e,t[6]=a):a=t[6],a},I3=(t,e)=>{lt(e?{title:"Failed to add package",description:e,variant:"danger"}:{title:"Package added",description:u.jsxs("div",{children:[u.jsxs("div",{children:["The package ",u.jsx(ba,{className:"inline",children:t})," and its dependencies has been added to your environment."]}),u.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Some Python packages may require a kernel restart to see changes."})]})})},A3=(t,e)=>{lt(e?{title:"Failed to upgrade package",description:e,variant:"danger"}:{title:"Package upgraded",description:u.jsxs("div",{children:[u.jsxs("div",{children:["The package ",u.jsx(ba,{className:"inline",children:t})," has been upgraded."]}),u.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Some Python packages may require a kernel restart to see changes."})]})})},T3=(t,e)=>{lt(e?{title:"Failed to remove package",description:e,variant:"danger"}:{title:"Package removed",description:u.jsxs("div",{children:[u.jsxs("div",{children:["The package ",u.jsx(ba,{className:"inline",children:t})," has been removed from your environment."]}),u.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Some Python packages may require a kernel restart to see changes."})]})})},M3=t=>{const e=J.c(9),{onClick:n,loading:o,children:r,className:s}=t;if(o){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(Kn,{size:"small",className:"h-4 w-4 shrink-0 opacity-50"}),e[0]=c):c=e[0],c}let i,a,l;return e[1]!==s?(i=Ie("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=Hn.stopPropagation(n),e[3]=n,e[4]=a):a=e[4],e[5]!==r||e[6]!==i||e[7]!==a?(l=u.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},xF=()=>{var v,S;const t=J.c(27),[e]=$s(),n=e.package_management.manager,[o,r]=Y.useState(null);let s;t[0]!==n?(s=[n],t[0]=n,t[1]=s):s=t[1];const{data:i,error:a,refetch:l,isPending:c}=Gn(SF,s);if(c){let k;return t[2]===Symbol.for("react.memo_cache_sentinel")?(k=u.jsx(Kn,{size:"medium",centered:!0}),t[2]=k):k=t[2],k}if(a){let k;return t[3]!==a?(k=u.jsx(Vr,{error:a}),t[3]=a,t[4]=k):k=t[4],k}const d=i.tree!=null;let h;t[5]!==d||t[6]!==o?(h=function(k,E){return k==="list"?"list":E?k||"tree":"list"}(o,d),t[5]=d,t[6]=o,t[7]=h):h=t[7];const f=h,m=(v=i.tree)==null?void 0:v.name,_=(S=i==null?void 0:i.tree)==null?void 0:S.version,g=m==="<root>";let p,b,y,x;return t[8]!==n||t[9]!==l?(p=u.jsx(wF,{packageManager:n,onSuccess:l}),t[8]=n,t[9]=l,t[10]=p):p=t[10],t[11]!==g||t[12]!==d||t[13]!==m||t[14]!==_||t[15]!==f?(b=d&&u.jsxs("div",{className:"flex items-center justify-between px-2 py-1 border-b",children:[u.jsxs("div",{className:"flex gap-1",children:[u.jsx("button",{type:"button",className:Ie("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"}),u.jsx("button",{type:"button",className:Ie("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"})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.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&&u.jsxs("span",{className:"text-xs text-muted-foreground",children:[m,_&&` v${_}`]})]})]}),t[11]=g,t[12]=d,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?(y=f==="list"?u.jsx(vF,{packages:i.list,onSuccess:l}):u.jsx(kF,{tree:i.tree,error:a,onSuccess:l}),t[17]=i.list,t[18]=i.tree,t[19]=a,t[20]=l,t[21]=f,t[22]=y):y=t[22],t[23]!==p||t[24]!==b||t[25]!==y?(x=u.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[p,b,y]}),t[23]=p,t[24]=b,t[25]=y,t[26]=x):x=t[26],x},wF=({onSuccess:t,packageManager:e})=>{const[n,o]=Y.useState(""),[r,s]=Y.useState(!1),{handleClick:i}=Ca(),a=$e(TS),l=Qt(TS);Y.useEffect(()=>{a&&(o(a),l(null))},[a,l]);const c=async()=>{try{s(!0);const d=n.split(",").map(h=>h.trim());for(const[h,f]of d.entries()){const m=await OS({package:f});m.success?I3(f):I3(f,m.error),h<d.length-1&&await new Promise(_=>setTimeout(_,1e3))}t()}finally{o(""),s(!1)}};return u.jsxs("div",{className:"flex items-center w-full border-b",children:[u.jsx(MS,{placeholder:`Install packages with ${e}...`,id:B1,icon:r?u.jsx(Kn,{size:"small",className:"mr-2 h-4 w-4 shrink-0 opacity-50"}):u.jsx(Te,{content:"Change package manager",children:u.jsx(si,{onClick:()=>i("packageManagement"),className:"mr-2 h-4 w-4 shrink-0 opacity-50 hover:opacity-80 cursor-pointer"})}),rootClassName:"flex-1 border-none",value:n,onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),c())},onChange:d=>o(d.target.value)}),u.jsx(Te,{delayDuration:300,side:"left",align:"start",content:u.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:",u.jsxs("div",{className:"flex flex-col gap-2 mt-2",children:[u.jsxs("div",{children:[u.jsx("span",{className:"font-bold tracking-wide",children:"Package name:"})," A package name; this will install the latest version.",u.jsx("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),u.jsxs("div",{children:[u.jsx("span",{className:"font-bold tracking-wide",children:"Package and version:"})," ","A package with a specific version or version range.",u.jsx("div",{className:"text-muted-foreground",children:"Examples: httpx==0.27.0, httpx>=0.27.0"})]}),u.jsxs("div",{children:[u.jsx("span",{className:"font-bold tracking-wide",children:"Git:"})," A Git repository",u.jsx("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),u.jsxs("div",{children:[u.jsx("span",{className:"font-bold tracking-wide",children:"URL:"})," A remote wheel or source distribution.",u.jsx("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),u.jsxs("div",{children:[u.jsx("span",{className:"font-bold tracking-wide",children:"Path:"})," A local wheel, source distribution, or project directory.",u.jsx("div",{className:"text-muted-foreground",children:"Example: /example/foo-0.1.0-py3-none-any.whl"})]})]})]}),children:u.jsx(Xm,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),u.jsx("button",{type:"button",className:Ie("float-right px-2 m-0 h-full text-sm text-secondary-foreground ml-2",n&&"bg-accent text-accent-foreground","disabled:cursor-not-allowed disabled:opacity-50"),onClick:c,disabled:!n,children:"Add"})]})},vF=t=>{const e=J.c(9),{onSuccess:n,packages:o}=t;if(o.length===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx(vn,{title:"No packages",description:"No packages are installed in this environment.",icon:u.jsx(si,{})}),e[0]=a):a=e[0],a}let r,s,i;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(rp,{children:u.jsxs(ri,{children:[u.jsx($r,{children:"Name"}),u.jsx($r,{children:"Version"}),u.jsx($r,{})]})}),e[1]=r):r=e[1],e[2]!==n||e[3]!==o){let a;e[5]!==n?(a=l=>u.jsxs(ri,{className:"group",onClick:async()=>{await xn(`${l.name}==${l.version}`),lt({title:"Copied to clipboard"})},children:[u.jsx(Hr,{children:l.name}),u.jsx(Hr,{children:l.version}),u.jsxs(Hr,{className:"flex justify-end",children:[u.jsx(O3,{packageName:l.name,onSuccess:n}),u.jsx(D3,{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=u.jsxs(sp,{className:"overflow-auto flex-1",children:[r,u.jsx(ip,{children:s})]}),e[7]=s,e[8]=i):i=e[8],i},O3=({packageName:t,onSuccess:e})=>{const[n,o]=Y.useState(!1);return In()?null:u.jsx(M3,{onClick:async()=>{try{o(!0);const r=await OS({package:t,upgrade:!0});r.success?(e(),A3(t)):A3(t,r.error)}finally{o(!1)}},loading:n,children:"Upgrade"})},D3=({packageName:t,onSuccess:e})=>{const[n,o]=Y.useState(!1);return u.jsx(M3,{onClick:async()=>{try{o(!0);const r=await $$({package:t});r.success?(e(),T3(t)):T3(t,r.error)}finally{o(!1)}},loading:n,children:"Remove"})},kF=t=>{const e=J.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]=Y.useState(s);let l,c,d;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{a(new Set)},e[1]=l):l=e[1],e[2]!==n?(c=[n],e[2]=n,e[3]=c):c=e[3],Y.useEffect(l,c),o){let _;return e[4]!==o?(_=u.jsx(Vr,{error:o}),e[4]=o,e[5]=_):_=e[5],_}if(!n){let _;return e[6]===Symbol.for("react.memo_cache_sentinel")?(_=u.jsx(Kn,{size:"medium",centered:!0}),e[6]=_):_=e[6],_}if(n.dependencies.length===0){let _;return e[7]===Symbol.for("react.memo_cache_sentinel")?(_=u.jsx(vn,{title:"No dependencies",description:"No package dependencies found in this environment.",icon:u.jsx(si,{})}),e[7]=_):_=e[7],_}e[8]===Symbol.for("react.memo_cache_sentinel")?(d=_=>{a(g=>{const p=new Set(g);return p.has(_)?p.delete(_):p.add(_),p})},e[8]=d):d=e[8];const h=d;let f,m;if(e[9]!==i||e[10]!==r||e[11]!==n.dependencies){let _;e[13]!==i||e[14]!==r?(_=(g,p)=>u.jsx("div",{className:"border-b",children:u.jsx(R3,{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=u.jsx("div",{className:"flex-1 overflow-auto",children:u.jsx("div",{children:f})}),e[16]=f,e[17]=m):m=e[17],m},R3=t=>{const e=J.c(57),{nodeId:n,node:o,level:r,isTopLevel:s,expandedNodes:i,onToggle:a,onSuccess:l}=t,c=s!==void 0&&s,d=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=c?0:16+16*r;let _;e[3]!==d||e[4]!==n||e[5]!==a?(_=V=>{V.key!=="Enter"&&V.key!==" "||(V.preventDefault(),d&&a(n))},e[3]=d,e[4]=n,e[5]=a,e[6]=_):_=e[6];const g=_;let p;e[7]!==d||e[8]!==n||e[9]!==a?(p=V=>{V.stopPropagation(),d&&a(n)},e[7]=d,e[8]=n,e[9]=a,e[10]=p):p=e[10];const b=p,y=d&&"select-none",x=c?"px-2 py-0.5":"";let v,S;e[11]!==y||e[12]!==x?(v=Ie("flex items-center group cursor-pointer text-sm whitespace-nowrap","hover:bg-[var(--slate-2)] focus:bg-[var(--slate-2)] focus:outline-none",y,x),e[11]=y,e[12]=x,e[13]=v):v=e[13],e[14]!==m||e[15]!==c?(S=c?{}:{paddingLeft:`${m}px`},e[14]=m,e[15]=c,e[16]=S):S=e[16];const k=d?f:void 0;let E,N,I,T,M,R,z,D,F,B;return e[17]!==d||e[18]!==f?(E=d?f?u.jsx(Vs,{className:"w-4 h-4 mr-2 flex-shrink-0"}):u.jsx(ia,{className:"w-4 h-4 mr-2 flex-shrink-0"}):u.jsx("div",{className:"w-4 mr-2 flex-shrink-0"}),e[17]=d,e[18]=f,e[19]=E):E=e[19],e[20]!==o.name?(N=u.jsx("span",{className:"font-medium truncate",children:o.name}),e[20]=o.name,e[21]=N):N=e[21],e[22]!==o.version?(I=o.version&&u.jsxs("span",{className:"text-muted-foreground text-xs",children:["v",o.version]}),e[22]=o.version,e[23]=I):I=e[23],e[24]!==N||e[25]!==I?(T=u.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 py-1.5",children:[N,I]}),e[24]=N,e[25]=I,e[26]=T):T=e[26],e[27]!==o.tags?(M=o.tags.map(CF),e[27]=o.tags,e[28]=M):M=e[28],e[29]!==M?(R=u.jsx("div",{className:"flex items-center gap-1 ml-2",children:M}),e[29]=M,e[30]=R):R=e[30],e[31]!==c||e[32]!==o.name||e[33]!==l?(z=c&&u.jsxs("div",{className:"flex gap-1 invisible group-hover:visible",children:[u.jsx(O3,{packageName:o.name,onSuccess:l}),u.jsx(D3,{packageName:o.name,onSuccess:l})]}),e[31]=c,e[32]=o.name,e[33]=l,e[34]=z):z=e[34],e[35]!==b||e[36]!==g||e[37]!==E||e[38]!==T||e[39]!==R||e[40]!==z||e[41]!==v||e[42]!==S||e[43]!==k?(D=u.jsxs("div",{className:v,style:S,onClick:b,onKeyDown:g,tabIndex:0,role:"treeitem","aria-selected":!1,"aria-expanded":k,children:[E,T,R,z]}),e[35]=b,e[36]=g,e[37]=E,e[38]=T,e[39]=R,e[40]=z,e[41]=v,e[42]=S,e[43]=k,e[44]=D):D=e[44],e[45]!==i||e[46]!==d||e[47]!==f||e[48]!==r||e[49]!==o.dependencies||e[50]!==n||e[51]!==l||e[52]!==a?(F=d&&f&&u.jsx("div",{role:"group",children:o.dependencies.map((V,O)=>u.jsx(R3,{nodeId:`${n}-${O}`,node:V,level:r+1,isTopLevel:!1,expandedNodes:i,onToggle:a,onSuccess:l},`${V.name}-${O}`))}),e[45]=i,e[46]=d,e[47]=f,e[48]=r,e[49]=o.dependencies,e[50]=n,e[51]=l,e[52]=a,e[53]=F):F=e[53],e[54]!==D||e[55]!==F?(B=u.jsxs("div",{children:[D,F]}),e[54]=D,e[55]=F,e[56]=B):B=e[56],B};async function SF(){const[t,e]=await Promise.all([U$(),V$()]);return{list:t.packages,tree:e.tree}}function CF(t,e){return t.kind==="cycle"?u.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"?u.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"?u.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 im=Z3("marimo:scratchpadHistory:v1",[]),NF=en(!1),jF=en(null,(t,e,n)=>{if(!(n=n.trim()))return;const o=t(im),r=[n,...o.filter(s=>s!==n)].slice(0,15);e(im,r)}),EF={hide_code:!1,disabled:!1},IF=()=>{const t=J.c(69),e=Tc(),[n]=$s(),{theme:o}=zo(),r=A.useRef(null),s=Br(),{createNewCell:i,updateCellCode:a}=Ot(),l=e.cellRuntime[_r],c=l==null?void 0:l.output,d=l==null?void 0:l.status,h=l==null?void 0:l.consoleOutputs,f=e.cellData[_r],m=(f==null?void 0:f.code)??"",_=Qt(jF),[g,p]=an(NF),b=$e(im);let y;t[0]!==_||t[1]!==m?(y=()=>{DS({code:m}),_(m)},t[0]=_,t[1]=m,t[2]=y):y=t[2];const x=et(y);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 S=et(v);let k;t[7]!==a?(k=()=>{a({cellId:_r,code:"",formattingChange:!1}),DS({code:""});const se=r.current;se&&se.dispatch({changes:{from:0,to:se.state.doc.length,insert:""}})},t[7]=a,t[8]=k):k=t[8];const E=et(k);let N;t[9]!==p||t[10]!==a?(N=se=>{p(!1),a({cellId:_r,code:se,formattingChange:!1});const Ae=r.current;Ae&&Ae.dispatch({changes:{from:0,to:Ae.state.doc.length,insert:se}})},t[9]=p,t[10]=a,t[11]=N):N=t[11];const I=et(N),[T,M]=A.useState();let R;t[12]!==m||t[13]!==h||t[14]!==x||t[15]!==T||t[16]!==c||t[17]!==o||t[18]!==n?(R=()=>u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[40%]",children:u.jsx(eh,{theme:o,showPlaceholder:!1,id:_r,code:m,config:EF,status:"idle",serializedEditorState:null,runCell:x,userConfig:n,editorViewRef:r,setEditorView:se=>{r.current=se},hidden:!1,temporarilyShowCode:An.NOOP,languageAdapter:T,setLanguageAdapter:M})}),u.jsx("div",{className:"flex-1 overflow-auto flex-shrink-0",children:u.jsx(qc,{allowExpand:!1,output:c,className:"output-area",cellId:_r,stale:!1,loading:!1})}),u.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[35%]",children:u.jsx(hp,{consoleOutputs:h,className:"overflow-auto",stale:!1,cellName:Q3,onSubmitDebugger:An.NOOP,cellId:_r,debuggerActive:!1})})]}),t[12]=m,t[13]=h,t[14]=x,t[15]=T,t[16]=c,t[17]=o,t[18]=n,t[19]=R):R=t[19];const z=R;let D;t[20]!==I||t[21]!==b||t[22]!==g||t[23]!==o?(D=()=>g?u.jsx("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:u.jsx("div",{className:"overflow-auto flex flex-col gap-3",children:b.map((se,Ae)=>u.jsx("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>I(se),children:u.jsx(A.Suspense,{children:u.jsx(ka,{language:"python",theme:o,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:se.trim(),editable:!1,readOnly:!0})})},Ae))})}):null,t[20]=I,t[21]=b,t[22]=g,t[23]=o,t[24]=D):D=t[24];const F=D;let B,V,O,C,$,j,W,K,Z,q,ne;t[25]===Symbol.for("react.memo_cache_sentinel")?(B=zs.create(_r),V=u.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]=V):(B=t[25],V=t[26]),t[27]===Symbol.for("react.memo_cache_sentinel")?(O=pn("cell.run"),t[27]=O):O=t[27],t[28]===Symbol.for("react.memo_cache_sentinel")?(C=u.jsx(ii,{color:"var(--grass-11)",size:16}),t[28]=C):C=t[28],t[29]!==x||t[30]!==g?($=u.jsx(Te,{content:O,children:u.jsx(Me,{"data-testid":"scratchpad-run-button",onClick:x,disabled:g,variant:"text",size:"xs",children:C})}),t[29]=x,t[30]=g,t[31]=$):$=t[31],t[32]===Symbol.for("react.memo_cache_sentinel")?(j=u.jsx(Np,{size:16}),t[32]=j):j=t[32],t[33]!==E||t[34]!==g?(W=u.jsx(Te,{content:"Clear code and outputs",children:u.jsx(Me,{disabled:g,size:"xs",variant:"text",onClick:E,children:j})}),t[33]=E,t[34]=g,t[35]=W):W=t[35],t[36]===Symbol.for("react.memo_cache_sentinel")?(K=u.jsx(Wr,{size:16}),t[36]=K):K=t[36],t[37]!==S||t[38]!==g?(Z=u.jsx(di,{children:u.jsx(Te,{content:"Insert code",children:u.jsx(Me,{disabled:g,size:"xs",variant:"text",onClick:S,children:K})})}),t[37]=S,t[38]=g,t[39]=Z):Z=t[39],t[40]!==d?(q=(d==="running"||d==="queued")&&u.jsx(Kn,{className:"inline",size:"small"}),t[40]=d,t[41]=q):q=t[41],t[42]===Symbol.for("react.memo_cache_sentinel")?(ne=u.jsx("div",{className:"flex-1"}),t[42]=ne):ne=t[42];const re=g&&"bg-[var(--sky-3)] rounded-none";let ae,X;t[43]!==re?(ae=Ie(re),t[43]=re,t[44]=ae):ae=t[44],t[45]!==g||t[46]!==p?(X=()=>p(!g),t[45]=g,t[46]=p,t[47]=X):X=t[47];const ee=b.length===0;let ce,me,ue,pe,de,Ne,je;return t[48]===Symbol.for("react.memo_cache_sentinel")?(ce=u.jsx(Op,{size:16}),t[48]=ce):ce=t[48],t[49]!==ae||t[50]!==X||t[51]!==ee?(me=u.jsx(Te,{content:"Toggle history",children:u.jsx(Me,{size:"xs",variant:"text",className:ae,onClick:X,disabled:ee,children:ce})}),t[49]=ae,t[50]=X,t[51]=ee,t[52]=me):me=t[52],t[53]!==$||t[54]!==W||t[55]!==Z||t[56]!==q||t[57]!==me?(ue=u.jsxs("div",{className:"flex items-center flex-shrink-0",children:[$,W,Z,q,ne,me]}),t[53]=$,t[54]=W,t[55]=Z,t[56]=q,t[57]=me,t[58]=ue):ue=t[58],t[59]!==z?(pe=z(),t[59]=z,t[60]=pe):pe=t[60],t[61]!==F?(de=F(),t[61]=F,t[62]=de):de=t[62],t[63]!==pe||t[64]!==de?(Ne=u.jsxs("div",{className:"flex-1 divide-y relative overflow-hidden flex flex-col",children:[pe,de]}),t[63]=pe,t[64]=de,t[65]=Ne):Ne=t[65],t[66]!==ue||t[67]!==Ne?(je=u.jsxs("div",{className:"flex flex-col h-full overflow-hidden divide-y",id:B,children:[V,ue,Ne]}),t[66]=ue,t[67]=Ne,t[68]=je):je=t[68],je},AF=()=>{const t=J.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx(IF,{}),t[0]=e):e=t[0],e},TF=()=>{const t=J.c(23),{openModal:e,closeModal:n}=qn();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}=Gn(OF,o);if(s){let b;return t[1]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(Kn,{size:"medium",centered:!0}),t[1]=b):b=t[1],b}if(i){let b;return t[2]!==i?(b=u.jsx(Vr,{error:i}),t[2]=i,t[3]=b):b=t[3],b}let l;t[4]!==r?(l=r.filter(DF).map(RF),t[4]=r,t[5]=l):l=t[5];const c=l;if(r.length===0){let b;return t[6]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(vn,{title:"No environment variables",description:"No environment variables are available in this notebook.",icon:u.jsx(ad,{})}),t[6]=b):b=t[6],b}let d,h,f,m,_,g,p;return t[7]!==n||t[8]!==e||t[9]!==c||t[10]!==a?(d=()=>e(u.jsx(Dg,{providerNames:c,onSuccess:()=>{a(),n()},onClose:n})),t[7]=n,t[8]=e,t[9]=c,t[10]=a,t[11]=d):d=t[11],t[12]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(pr,{className:"h-4 w-4"}),t[12]=h):h=t[12],t[13]!==d?(f=u.jsx("div",{className:"flex justify-end h-8 border-b",children:u.jsx("button",{type:"button",className:"float-right border-l px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:d,children:h})}),t[13]=d,t[14]=f):f=t[14],t[15]===Symbol.for("react.memo_cache_sentinel")?(m=u.jsx(rp,{children:u.jsxs(ri,{children:[u.jsx($r,{children:"Environment Variable"}),u.jsx($r,{children:"Source"}),u.jsx($r,{})]})}),t[15]=m):m=t[15],t[16]!==r?(_=r.map(PF),t[16]=r,t[17]=_):_=t[17],t[18]!==_?(g=u.jsxs(sp,{className:"overflow-auto flex-1 mb-16",children:[m,u.jsx(ip,{children:_})]}),t[18]=_,t[19]=g):g=t[19],t[20]!==f||t[21]!==g?(p=u.jsxs("div",{className:"flex flex-col h-full",children:[f,g]}),t[20]=f,t[21]=g,t[22]=p):p=t[22],p},MF=t=>{const e=J.c(9),{className:n,ariaLabel:o,onCopy:r}=t,[s,i]=Y.useState(!1);let a;e[0]!==r?(a=()=>{r(),i(!0),setTimeout(()=>i(!1),1e3)},e[0]=r,e[1]=a):a=e[1];const l=a;let c,d;return e[2]!==s?(c=s?u.jsx(Nc,{className:"w-3 h-3 text-green-700 rounded"}):u.jsx(ra,{className:"w-3 h-3 hover:bg-muted rounded"}),e[2]=s,e[3]=c):c=e[3],e[4]!==o||e[5]!==n||e[6]!==l||e[7]!==c?(d=u.jsx("button",{type:"button",className:n,onClick:l,"aria-label":o,children:c}),e[4]=o,e[5]=n,e[6]=l,e[7]=c,e[8]=d):d=e[8],d};async function OF(){return Og((await qS.request({})).secrets)}function DF(t){return t.provider!=="env"}function RF(t){return t.name}function PF(t){return t.keys.map(e=>u.jsxs(ri,{className:"group",children:[u.jsx(Hr,{children:e}),u.jsx(Hr,{children:t.provider!=="env"&&u.jsx(_S,{variant:"outline",className:"select-none",children:t.name})}),u.jsx(Hr,{children:u.jsx(MF,{ariaLabel:`Copy ${e}`,onCopy:async()=>{await xn(`os.environ["${e}"]`),lt({title:"Copied to clipboard",description:`os.environ["${e}"] has been copied to your clipboard.`})},className:Ie("float-right px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible")})})]},`${t.name}-${e}`))}const LF=t=>{const e=J.c(6),{children:n}=t,{openModal:o,closeModal:r}=qn();let s,i;return e[0]!==r||e[1]!==o?(s=()=>o(u.jsx(zF,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(i=u.jsx(fS,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=i):i=e[5],i},FF=[st.lineWrapping],zF=t=>{const e=J.c(23),{onClose:n}=t,[o,r]=A.useState(""),{theme:s}=zo();let i,a,l,c,d,h;e[0]!==n?(i=async x=>{x.preventDefault();const v=new FormData(x.target),S=v.get("title"),k=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:S,description:k,code:E})}),n(),lt({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=u.jsx(ar,{children:"Contribute a Snippet"}),e[2]=a):a=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsxs(Ls,{children:[a,u.jsxs(Fs,{children:["Have a useful snippet you want to share with the community? Submit it here or make a pull request"," ",u.jsx("a",{href:no.githubPage,target:"_blank",className:"underline",children:"on GitHub"}),"."]})]}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(lr,{id:"title",name:"title",autoFocus:!0,placeholder:"Title",required:!0,autoComplete:"off"}),d=u.jsx(H$,{id:"description",name:"description",autoFocus:!0,placeholder:"Description",rows:5,required:!0,autoComplete:"off"}),e[4]=c,e[5]=d):(c=e[4],d=e[5]),e[6]!==o?(h=u.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,y;return e[8]!==o||e[9]!==f?(m=u.jsx(ka,{theme:f,language:"python",className:"cm border rounded overflow-hidden",extensions:FF,value:o,onChange:r}),e[8]=o,e[9]=f,e[10]=m):m=e[10],e[11]!==h||e[12]!==m?(_=u.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[c,d,h,m]}),e[11]=h,e[12]=m,e[13]=_):_=e[13],e[14]!==n?(g=u.jsx(Me,{"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=u.jsx(Me,{"data-testid":"snippet-send-button","aria-label":"Save",variant:"default",type:"submit",children:"Send"}),e[16]=p):p=e[16],e[17]!==g?(b=u.jsxs(oa,{children:[g,p]}),e[17]=g,e[18]=b):b=e[18],e[19]!==i||e[20]!==b||e[21]!==_?(y=u.jsx(cr,{className:"w-fit",children:u.jsxs("form",{onSubmit:i,children:[l,_,b]})}),e[19]=i,e[20]=b,e[21]=_,e[22]=y):y=e[22],y},BF=[st.lineWrapping],UF=()=>{const t=J.c(20),[e,n]=Y.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}=Gn(HF,o);if(s){let b;return t[1]!==s?(b=u.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=u.jsx(Kn,{size:"medium",centered:!0}),t[3]=b):b=t[3],b}const a=e?"h-1/3":"h-full";let l,c,d,h,f,m,_,g,p;return t[4]!==a?(l=Ie("border-b rounded-none",a),t[4]=a,t[5]=l):l=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(aa,{placeholder:"Search snippets...",className:"h-6 m-1",rootClassName:"flex-1 border-r"}),t[6]=c):c=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsxs("div",{className:"flex items-center w-full",children:[c,u.jsx(LF,{children:u.jsx("button",{className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:u.jsx(pr,{className:"h-4 w-4"})})})]}),h=u.jsx(_c,{children:"No results"}),t[7]=d,t[8]=h):(d=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=u.jsx($F,{onSelect:f,snippets:r.snippets}),t[10]=r.snippets,t[11]=m):m=t[11],t[12]!==l||t[13]!==m?(_=u.jsxs(Ic,{className:l,children:[d,h,m]}),t[12]=l,t[13]=m,t[14]=_):_=t[14],t[15]!==e?(g=u.jsx(A.Suspense,{children:u.jsx("div",{className:"h-2/3 snippet-viewer flex flex-col",children:e?u.jsx(VF,{snippet:e},e.title):u.jsx(vn,{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=u.jsxs("div",{className:"flex-1 overflow-hidden",children:[_,g]}),t[17]=_,t[18]=g,t[19]=p):p=t[19],p},VF=t=>{const e=J.c(27),{snippet:n}=t,{theme:o}=zo(),{createNewCell:r}=Ot(),s=Br();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 c=l;let d,h,f,m,_,g;if(e[7]!==n.title?(d=u.jsx("div",{className:"text-sm font-semibold bg-muted border-y px-2 py-1",children:n.title}),e[7]=n.title,e[8]=d):d=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(Wr,{className:"ml-2 h-4 w-4"}),e[9]=h):h=e[9],e[10]!==a?(f=u.jsx("div",{className:"flex justify-end",children:u.jsx(di,{children:u.jsxs(Me,{className:"float-right",size:"xs",variant:"outline",onClick:a,children:["Insert snippet",h]})})}),e[10]=a,e[11]=f):f=e[11],e[12]!==c||e[13]!==n.sections||e[14]!==n.title||e[15]!==o){let p;e[17]!==c||e[18]!==n.title||e[19]!==o?(p=b=>{const{code:y,html:x,id:v}=b;return x?u.jsx("div",{children:ep({html:x})},`${n.title}-${v}`):y?u.jsxs("div",{className:"relative hover-actions-parent pr-2",children:[u.jsx(di,{children:u.jsx(Te,{content:"Insert snippet",children:u.jsx(Me,{className:"absolute -top-2 -right-1 z-10 hover-action px-2 bg-background",size:"sm",variant:"outline",onClick:()=>{c(y)},children:u.jsx(Wr,{className:"h-5 w-5"})})})}),u.jsx(A.Suspense,{children:u.jsx(ka,{theme:o==="dark"?"dark":"light",language:"python",className:"cm border rounded overflow-hidden",extensions:BF,value:y,readOnly:!0},`${n.title}-${v}`)})]},`${n.title}-${v}`):null},e[17]=c,e[18]=n.title,e[19]=o,e[20]=p):p=e[20],m=n.sections.map(p),e[12]=c,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?(_=u.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]!==d||e[25]!==_?(g=u.jsxs(u.Fragment,{children:[d,_]}),e[24]=d,e[25]=_,e[26]=g):g=e[26],g},$F=t=>{const e=J.c(7),{snippets:n,onSelect:o}=t;let r,s;if(e[0]!==o||e[1]!==n){let i;e[3]!==o?(i=a=>u.jsx(go,{className:"rounded-none",onSelect:()=>o(a),children:u.jsx("div",{className:"flex flex-row gap-2 items-center",children:u.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=u.jsx(Vm,{className:"flex flex-col overflow-auto",children:r}),e[5]=r,e[6]=s):s=e[6],s};function HF(){return W$()}const WF=Y.lazy(()=>$m(()=>import("./tracing-Bk2J7-fB.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]),import.meta.url).then(t=>({default:t.Tracing}))),qF=()=>{const t=J.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx(Y.Suspense,{fallback:u.jsx(GF,{}),children:u.jsx(WF,{})}),t[0]=e):e=t[0],e},GF=()=>{const t=J.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:u.jsx(Kn,{})}),t[0]=e):e=t[0],e},P3="name",L3="type-value",am="defs-refs",YF=[{id:P3,accessorFn:t=>[t.name,t.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>u.jsx(ap,{header:"Name",column:t}),cell:({getValue:t})=>{const[e,n]=t();return u.jsx(yf,{name:e,declaredBy:n})}},{id:L3,accessorFn:t=>[t.dataType,t.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>u.jsx(ap,{header:u.jsxs("div",{className:"flex flex-col gap-1",children:[u.jsx("span",{children:"Type"}),u.jsx("span",{children:"Value"})]}),column:t}),cell:({getValue:t})=>{const[e,n]=t();return u.jsxs("div",{className:"max-w-[150px]",children:[u.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs",children:e}),u.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap",title:n??"",children:n})]})}},{id:am,accessorFn:t=>[t.declaredBy,t.usedBy,t.name,t.declaredByNames,t.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:t})=>u.jsx(ap,{header:u.jsxs("div",{className:"flex flex-col gap-1",children:[u.jsx("span",{children:"Declared By"}),u.jsx("span",{children:"Used By"})]}),column:t}),cell:({getValue:t})=>{const[e,n,o]=t(),r=s=>{const i=hc(s);i&&tp(i,o)};return u.jsxs("div",{className:"flex flex-col gap-1 py-1",children:[u.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-center",children:[u.jsx("span",{title:"Declared by",children:u.jsx(Qp,{className:"w-3.5 h-3.5 text-muted-foreground"})}),e.length===1?u.jsx(gr,{variant:"focus",cellId:e[0],skipScroll:!0,onClick:()=>r(e[0])}):u.jsx("div",{className:"text-destructive flex flex-row gap-2",children:e.slice(0,3).map((s,i)=>u.jsxs("span",{className:"flex",children:[u.jsx(gr,{variant:"focus",cellId:s,skipScroll:!0,className:"whitespace-nowrap text-destructive",onClick:()=>r(s)},s),i<e.length-1&&", "]},s))})]}),u.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-baseline",children:[u.jsx("span",{title:"Used by",children:u.jsx(Oa,{className:"w-3.5 h-3.5 text-muted-foreground"})}),u.jsx(ok,{maxCount:3,cellIds:n,skipScroll:!0,onClick:r})]})]})}}],F3=A.memo(({className:t,cellIds:e,variables:n})=>{const[o,r]=Y.useState([]),[s,i]=Y.useState(""),a=q$(),l=A.useMemo(()=>{const h=f=>{const m=a[f];return X$(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]),c=A.useMemo(()=>{const h=new Map;return e.forEach((f,m)=>h.set(f,m)),function(f,m,_){m||(m={id:am,desc:!1});let g=[];switch(m.id){case P3:g=Na(f,p=>p.name);break;case L3:g=Na(f,p=>p.dataType);break;case am:g=Na(f,p=>_.get(p.declaredBy[0]))}return m.desc?g.reverse():g}(l,o[0],h)},[l,o,e]),d=G$({data:c,columns:YF,getCoreRowModel:K$(),onGlobalFilterChange:i,getFilteredRowModel:J$(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter:h=>h.columnDef.enableGlobalFilter??!0,globalFilterFn:"auto",manualSorting:!0,onSortingChange:r,getSortedRowModel:Y$(),state:{sorting:o,globalFilter:s}});return u.jsxs(u.Fragment,{children:[u.jsx(MS,{className:"w-full",placeholder:"Search",value:s,onChange:h=>i(h.target.value)}),u.jsxs(sp,{className:Ie("w-full text-sm flex-1 border-separate border-spacing-0",t),children:[u.jsx(rp,{children:u.jsx(ri,{className:"whitespace-nowrap text-xs",children:d.getFlatHeaders().map(h=>u.jsx($r,{className:"sticky top-0 bg-background border-b",children:RS(h.column.columnDef.header,h.getContext())},h.id))})}),u.jsx(ip,{children:d.getRowModel().rows.map(h=>u.jsx(ri,{className:"hover:bg-accent",children:h.getVisibleCells().map(f=>u.jsx(Hr,{className:"border-b",children:RS(f.column.columnDef.cell,f.getContext())},f.id))},h.id))})]})]})});F3.displayName="VariableTable";const JF=()=>{const t=J.c(4),e=yS(),n=Kc();if(Object.keys(e).length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(vn,{title:"No variables",description:"Global variables will appear here.",icon:u.jsx(dc,{})}),t[0]=r):r=t[0],r}let o;return t[1]!==n.inOrderIds||t[2]!==e?(o=u.jsx(F3,{className:"flex-1",cellIds:n.inOrderIds,variables:e}),t[1]=n.inOrderIds,t[2]=e,t[3]=o):o=t[3],o},KF=Y.lazy(()=>$m(()=>import("./terminal-87tuZyuY.js"),__vite__mapDeps([113,1,2,114]),import.meta.url)),XF=t=>{const e=J.c(121),{children:n}=t,{isSidebarOpen:o,isTerminalOpen:r,selectedPanel:s}=Cc(),{setIsSidebarOpen:i,setIsTerminalOpen:a}=da(),l=Y.useRef(null),c=Y.useRef(null);let d,h,f,m,_;e[0]!==o?(d=()=>{if(!l.current)return;const le=l.current.isCollapsed();o&&le&&l.current.expand(),o||le||l.current.collapse(),requestAnimationFrame(QF)},h=[o],e[0]=o,e[1]=d,e[2]=h):(d=e[1],h=e[2]),A.useEffect(d,h),e[3]!==r?(f=()=>{if(!c.current)return;const le=c.current.isCollapsed();r&&le&&c.current.expand(),r||le||c.current.collapse(),requestAnimationFrame(tz)},m=[r],e[3]=r,e[4]=f,e[5]=m):(f=e[4],m=e[5]),A.useEffect(f,m),e[6]!==n?(_=u.jsx(Zc,{id:"app",className:"relative h-full",children:u.jsx(A.Suspense,{children:n})},"app"),e[6]=n,e[7]=_):_=e[7];const g=_,p=o?"resize-handle":"resize-handle-collapsed";let b,y;e[8]!==p?(b=Ie("border-border no-print z-10",p,"vertical"),e[8]=p,e[9]=b):b=e[9],e[10]!==b?(y=u.jsx(PS,{onDragging:LS,className:b}),e[10]=b,e[11]=y):y=e[11];const x=y,v=r?"resize-handle":"resize-handle-collapsed";let S,k;e[12]!==v?(S=Ie("border-border no-print z-20",v,"horizontal"),e[12]=v,e[13]=S):S=e[13],e[14]!==S?(k=u.jsx(PS,{onDragging:LS,className:S}),e[14]=S,e[15]=k):k=e[15];const E=k;let N,I,T,M,R,z,D,F,B,V,O,C,$,j,W,K,Z,q,ne,re,ae;e[16]!==s?(N=u.jsx("div",{className:"text-sm text-[var(--slate-11)] uppercase tracking-wide font-semibold flex-1",children:s}),e[16]=s,e[17]=N):N=e[17],e[18]!==i?(I=()=>i(!1),e[18]=i,e[19]=I):I=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(T=u.jsx(oo,{className:"w-4 h-4"}),e[20]=T):T=e[20],e[21]!==I?(M=u.jsx(Me,{"data-testid":"close-helper-pane",className:"m-0",size:"xs",variant:"text",onClick:I,children:T}),e[21]=I,e[22]=M):M=e[22],e[23]!==N||e[24]!==M?(R=u.jsxs("div",{className:"p-3 border-b flex justify-between items-center",children:[N,M]}),e[23]=N,e[24]=M,e[25]=R):R=e[25],e[26]!==s?(z=s==="files"&&u.jsx(N3,{}),e[26]=s,e[27]=z):z=e[27],e[28]!==s?(D=s==="errors"&&u.jsx(YL,{}),e[28]=s,e[29]=D):D=e[29],e[30]!==s?(F=s==="variables"&&u.jsx(JF,{}),e[30]=s,e[31]=F):F=e[31],e[32]!==s?(B=s==="dependencies"&&u.jsx(OL,{}),e[32]=s,e[33]=B):B=e[33],e[34]!==s?(V=s==="packages"&&u.jsx(xF,{}),e[34]=s,e[35]=V):V=e[35],e[36]!==s?(O=s==="outline"&&u.jsx(yF,{}),e[36]=s,e[37]=O):O=e[37],e[38]!==s?(C=s==="datasources"&&u.jsx(qL,{}),e[38]=s,e[39]=C):C=e[39],e[40]!==s?($=s==="documentation"&&u.jsx(GL,{}),e[40]=s,e[41]=$):$=e[41],e[42]!==s?(j=s==="snippets"&&u.jsx(UF,{}),e[42]=s,e[43]=j):j=e[43],e[44]!==s?(W=s==="scratchpad"&&u.jsx(AF,{}),e[44]=s,e[45]=W):W=e[45],e[46]!==s?(K=s==="chat"&&u.jsx(nR,{}),e[46]=s,e[47]=K):K=e[47],e[48]!==s?(Z=s==="logs"&&u.jsx(j3,{}),e[48]=s,e[49]=Z):Z=e[49],e[50]!==s?(q=s==="tracing"&&u.jsx(qF,{}),e[50]=s,e[51]=q):q=e[51],e[52]!==s?(ne=s==="secrets"&&u.jsx(TF,{}),e[52]=s,e[53]=ne):ne=e[53],e[54]!==z||e[55]!==D||e[56]!==F||e[57]!==B||e[58]!==V||e[59]!==O||e[60]!==C||e[61]!==$||e[62]!==j||e[63]!==W||e[64]!==K||e[65]!==Z||e[66]!==q||e[67]!==ne?(re=u.jsx(A.Suspense,{children:u.jsxs(Yc,{children:[z,D,F,B,V,O,C,$,j,W,K,Z,q,ne]})}),e[54]=z,e[55]=D,e[56]=F,e[57]=B,e[58]=V,e[59]=O,e[60]=C,e[61]=$,e[62]=j,e[63]=W,e[64]=K,e[65]=Z,e[66]=q,e[67]=ne,e[68]=re):re=e[68],e[69]!==R||e[70]!==re?(ae=u.jsx(Ac,{children:u.jsxs("div",{className:"flex flex-col h-full flex-1 overflow-hidden mr-[-4px]",children:[R,re]})}),e[69]=R,e[70]=re,e[71]=ae):ae=e[71];const X=ae,ee=o&&"border-r border-l border-[var(--slate-7)]";let ce,me,ue,pe,de,Ne;e[72]!==ee?(ce=Ie("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",ee),e[72]=ee,e[73]=ce):ce=e[73],e[74]===Symbol.for("react.memo_cache_sentinel")?(me=(le,Ve)=>{var Fe;Ve===0&&le===10&&((Fe=l.current)==null||Fe.resize(30))},e[74]=me):me=e[74],e[75]!==i?(ue=()=>i(!1),pe=()=>i(!0),e[75]=i,e[76]=ue,e[77]=pe):(ue=e[76],pe=e[77]),e[78]!==X||e[79]!==x?(de=u.jsxs("span",{className:"flex flex-row h-full",children:[X," ",x]}),e[78]=X,e[79]=x,e[80]=de):de=e[80],e[81]!==ce||e[82]!==ue||e[83]!==pe||e[84]!==de?(Ne=u.jsx(Zc,{ref:l,id:"helper",collapsedSize:0,collapsible:!0,className:ce,minSize:10,defaultSize:0,maxSize:75,onResize:me,onCollapse:ue,onExpand:pe,children:de},"helper"),e[81]=ce,e[82]=ue,e[83]=pe,e[84]=de,e[85]=Ne):Ne=e[85];const je=Ne,se=r&&"border-[var(--slate-7)]";let Ae,be,Re,ze,qe,Qe,Pe,tt,Je;e[86]!==se?(Ae=Ie("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",se),e[86]=se,e[87]=Ae):Ae=e[87],e[88]===Symbol.for("react.memo_cache_sentinel")?(be=(le,Ve)=>{var Fe;Ve===0&&le===10&&((Fe=c.current)==null||Fe.resize(30))},e[88]=be):be=e[88],e[89]!==a?(Re=()=>a(!1),ze=()=>a(!0),e[89]=a,e[90]=Re,e[91]=ze):(Re=e[90],ze=e[91]),e[92]===Symbol.for("react.memo_cache_sentinel")?(qe=u.jsx("div",{}),e[92]=qe):qe=e[92],e[93]!==a?(Qe=()=>a(!1),e[93]=a,e[94]=Qe):Qe=e[94],e[95]!==r||e[96]!==Qe?(Pe=u.jsx(A.Suspense,{fallback:qe,children:u.jsx(KF,{visible:r,onClose:Qe})}),e[95]=r,e[96]=Qe,e[97]=Pe):Pe=e[97],e[98]!==r||e[99]!==Pe?(tt=u.jsx(DL,{isOpen:r,children:Pe}),e[98]=r,e[99]=Pe,e[100]=tt):tt=e[100],e[101]!==Ae||e[102]!==Re||e[103]!==ze||e[104]!==tt||e[105]!==E?(Je=u.jsxs(Zc,{ref:c,id:"terminal",collapsedSize:0,collapsible:!0,className:Ae,minSize:10,defaultSize:0,maxSize:75,onResize:be,onCollapse:Re,onExpand:ze,children:[E,tt]},"terminal"),e[101]=Ae,e[102]=Re,e[103]=ze,e[104]=tt,e[105]=E,e[106]=Je):Je=e[106];const nt=Je;let te,we,ke,Le,G,ge,_e,fe;return e[107]===Symbol.for("react.memo_cache_sentinel")?(te=VH(),e[107]=te):te=e[107],e[108]===Symbol.for("react.memo_cache_sentinel")?(we=u.jsx(Yc,{children:u.jsx(FO,{})}),e[108]=we):we=e[108],e[109]!==nt?(ke=u.jsx(Kx,{capability:"terminal",children:nt}),e[109]=nt,e[110]=ke):ke=e[110],e[111]!==g||e[112]!==ke?(Le=u.jsx(Zc,{children:u.jsxs(FS,{autoSaveId:"marimo:chrome:v1:l1",direction:"vertical",children:[g,ke]})}),e[111]=g,e[112]=ke,e[113]=Le):Le=e[113],e[114]===Symbol.for("react.memo_cache_sentinel")?(G=u.jsx(Z$,{}),e[114]=G):G=e[114],e[115]!==je||e[116]!==Le?(ge=u.jsxs(FS,{autoSaveId:"marimo:chrome:v1:l2",direction:"horizontal",storage:te,children:[we,je,Le,G]}),e[115]=je,e[116]=Le,e[117]=ge):ge=e[117],e[118]===Symbol.for("react.memo_cache_sentinel")?(_e=u.jsx(Ac,{children:u.jsx(Yc,{children:u.jsx(OO,{})})}),e[118]=_e):_e=e[118],e[119]!==ge?(fe=u.jsxs($H,{children:[ge,_e]}),e[119]=ge,e[120]=fe):fe=e[120],fe};function ZF(){window.dispatchEvent(new Event("resize"))}function QF(){requestAnimationFrame(ZF)}function ez(){window.dispatchEvent(new Event("resize"))}function tz(){requestAnimationFrame(ez)}let z3;z3=new URL(window.location.href).searchParams.get(Q$.showChrome)==="false",tC=Object.freeze(Object.defineProperty({__proto__:null,default:t=>{const e=J.c(10);if(z3){let s,i,a;return e[0]!==t?(s=u.jsx(Jx,{hideControls:!0,...t}),e[0]=t,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx(fg,{}),e[2]=i):i=e[2],e[3]!==s?(a=u.jsxs(u.Fragment,{children:[s,i]}),e[3]=s,e[4]=a):a=e[4],a}let n,o,r;return e[5]!==t?(n=u.jsx(Jx,{...t}),e[5]=t,e[6]=n):n=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(fg,{}),e[7]=o):o=e[7],e[8]!==n?(r=u.jsxs(XF,{children:[n,o]}),e[8]=n,e[9]=r):r=e[9],r}},Symbol.toStringTag,{value:"Module"}))});export{pp as C,ed as E,vn as P,qH as __tla,td as a,tC as e,ja as f,gp as u};
144
+ `).length),position:{x:0,y:0}}}createElements(t,e,n,o){const r=[],s=[],i=new Set,a=new Set;for(const l of Object.values(n)){if(l.value==="marimo"&&l.name==="mo")continue;const{declaredBy:c,usedBy:d}=l;for(const h of c)for(const f of d){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,c]of Qm.zip(t,e)){o||r.push(this.createNode(l,c));const d=i.has(l),h=dt.get(c).code.trim().startsWith("mo.md");!d&&h||r.push(this.createNode(l,c))}return{nodes:r,edges:s}}},EL=t=>{const e=J.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 C=b3.createElements(n,r,o,a.hidePureMarkdown);return C=_3(C.nodes,C.edges,{direction:i}),C},e[0]=r,e[1]=n,e[2]=i,e[3]=a.hidePureMarkdown,e[4]=o,e[5]=l):l=e[5];const[c]=A.useState(l),[d,h,f]=K2(c.nodes),[m,_,g]=X2(c.edges),p=Qi();let b;e[6]!==i||e[7]!==_||e[8]!==h?(b=C=>{const $=_3(C.nodes,C.edges,{direction:i});h($.nodes),_($.edges)},e[6]=i,e[7]=_,e[8]=h,e[9]=b):b=e[9];const y=et(b);let x,v;e[10]!==r||e[11]!==n||e[12]!==a.hidePureMarkdown||e[13]!==y||e[14]!==o?(x=()=>{y(b3.createElements(n,r,o,a.hidePureMarkdown))},v=[n,o,r,y,a.hidePureMarkdown],e[10]=r,e[11]=n,e[12]=a.hidePureMarkdown,e[13]=y,e[14]=o,e[15]=x,e[16]=v):(x=e[15],v=e[16]),A.useEffect(x,v);const[S,k]=A.useState();let E;rk(),e[17]===Symbol.for("react.memo_cache_sentinel")?(E=()=>{k(void 0)},e[17]=E):E=e[17];const N=E;let I,T,M,R,z,D,F,B,V,O;return e[18]===Symbol.for("react.memo_cache_sentinel")?(I={minZoom:.5,maxZoom:1.5},T=(C,$)=>{k({type:"node",id:$.id})},M=(C,$)=>{const{source:j,target:W}=$;k({type:"edge",source:j,target:W})},e[18]=I,e[19]=T,e[20]=M):(I=e[18],T=e[19],M=e[20]),e[21]===Symbol.for("react.memo_cache_sentinel")?(R=u.jsx(YP,{color:"#ccc",variant:$n.Dots}),e[21]=R):R=e[21],e[22]!==p||e[23]!==d?(z=()=>{const C=dt.get(o$);if(C){const $=d.find(j=>j.id===C);$&&(p.fitView({padding:1,duration:600,nodes:[$]}),k({type:"node",id:C}))}},e[22]=p,e[23]=d,e[24]=z):z=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(D=u.jsx(Fp,{className:"size-4"}),e[25]=D):D=e[25],e[26]!==z?(F=u.jsx(VP,{position:"bottom-right",showInteractive:!1,children:u.jsx(Te,{content:"Jump to focused cell",delayDuration:200,side:"left",asChild:!1,children:u.jsx(js,{onMouseDown:Hn.preventFocus,onClick:z,children:D})})}),e[26]=z,e[27]=F):F=e[27],e[28]!==m||e[29]!==S||e[30]!==o?(B=u.jsx(rc,{selection:S,variables:o,edges:m,onClearSelection:N}),e[28]=m,e[29]=S,e[30]=o,e[31]=B):B=e[31],e[32]!==s||e[33]!==m||e[34]!==d||e[35]!==g||e[36]!==f||e[37]!==F||e[38]!==B?(V=u.jsxs(_f,{nodes:d,edges:m,nodeTypes:nk,minZoom:.2,fitViewOptions:I,onNodeClick:T,onEdgeClick:M,onNodeDoubleClick:IL,fitView:!0,onNodesChange:f,onEdgesChange:g,zoomOnDoubleClick:!1,nodesConnectable:!1,children:[R,F,B,s]}),e[32]=s,e[33]=m,e[34]=d,e[35]=g,e[36]=f,e[37]=F,e[38]=B,e[39]=V):V=e[39],e[40]!==i||e[41]!==V?(O=u.jsx(ek,{value:i,children:V}),e[40]=i,e[41]=V,e[42]=O):O=e[42],O};function IL(t,e){bS(e.id,"focus")}const AL=en("_minimap_"),TL=en({hidePureMarkdown:!0}),ML=t=>{const e=J.c(11),[n,o]=an(AL),[r,s]=an(TL);let i;e[0]!==n||e[1]!==t||e[2]!==o||e[3]!==s||e[4]!==r?(i=()=>n==="_minimap_"?u.jsx(QP,{...t,children:u.jsx(xf,{settings:r,onSettingsChange:s,view:n,onChange:o})}):u.jsx(EL,{...t,settings:r,layoutDirection:n,children:u.jsx(xf,{settings:r,onSettingsChange:s,view:n,onChange:o})}),e[0]=n,e[1]=t,e[2]=o,e[3]=s,e[4]=r,e[5]=i):i=e[5];const a=i;let l,c;return e[6]!==a?(l=a(),e[6]=a,e[7]=l):l=e[7],e[8]!==n||e[9]!==l?(c=u.jsx(gf,{children:l},n),e[8]=n,e[9]=l,e[10]=c):c=e[10],c},OL=()=>{const t=J.c(5),e=yS(),n=Kc(),[o]=r$();let r,s;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=Ie("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=u.jsx("div",{className:r,children:u.jsx(ML,{cellAtoms:o,variables:e,cellIds:n.inOrderIds})}),t[1]=n.inOrderIds,t[2]=o,t[3]=e,t[4]=s):s=t[4],s},DL=t=>{const e=J.c(4),{isOpen:n,children:o}=t,[r,s]=Y.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]),Y.useEffect(i,a),r?o:null},RL=t=>{const e=J.c(8),{variableName:n,className:o}=t;let r;e[0]!==n?(r=()=>{const l=function(d){const h=dt.get(xS)[d];if(h)return h.declaredBy[0]}(n);if(!l)return;const c=hc(l);c&&tp(c,n)},e[0]=n,e[1]=r):r=e[1];const s=r;let i,a;return e[2]!==o?(i=Ie("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=u.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},PL=en(t=>{const e=t(s$),n=t(xS),o=t(uS);return Na(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})}),LL=en(t=>{const e=new Map(t(i$));for(const n of wS){const o=e.get(n);o&&o.databases.length===0&&e.delete(n)}return Na([...e.values()],n=>wS.has(n.name)?1:0)}),FL=()=>{const t=J.c(32),[e,n]=Y.useState(""),o=Qt(vS),r=$e(PL),s=$e(LL);if(r.length===0&&s.length===0){let b;return t[0]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(vn,{title:"No tables found",description:"Any datasets/dataframes in the global scope will be shown here.",action:u.jsx(Fg,{children:u.jsxs(Me,{variant:"outline",size:"sm",children:["Add database or catalog",u.jsx(pr,{className:"h-4 w-4 ml-2"})]})}),icon:u.jsx(dr,{})}),t[0]=b):b=t[0],b}const i=!!e.trim();let a,l,c,d,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=u.jsx(aa,{placeholder:"Search tables...",className:"h-6 m-1",value:e,onValueChange:a,rootClassName:"flex-1 border-r"}),t[3]=e,t[4]=a,t[5]=l):l=t[5],t[6]!==i?(c=i&&u.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:u.jsx(oo,{className:"h-4 w-4"})}),t[6]=i,t[7]=c):c=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsx(Fg,{children:u.jsx("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:u.jsx(pr,{className:"h-4 w-4"})})}),t[8]=d):d=t[8],t[9]!==l||t[10]!==c?(h=u.jsxs("div",{className:"flex items-center w-full",children:[l,c,d]}),t[9]=l,t[10]=c,t[11]=h):h=t[11],t[12]!==s||t[13]!==i||t[14]!==e){let b;t[16]!==i||t[17]!==e?(b=y=>u.jsx(zL,{connection:y,hasChildren:y.databases.length>0,children:y.databases.map(x=>u.jsx(BL,{engineName:y.name,database:x,hasSearch:i,children:u.jsx(UL,{schemas:x.schemas,defaultSchema:y.default_schema,defaultDatabase:y.default_database,engineName:y.name,databaseName:x.name,hasSearch:i,searchValue:e})},x.name))},y.name),t[16]=i,t[17]=e,t[18]=b):b=t[18],f=s.map(b),t[12]=s,t[13]=i,t[14]=e,t[15]=f}else f=t[15];return t[19]!==s.length||t[20]!==r.length?(m=s.length>0&&r.length>0&&u.jsxs(kS,{children:[u.jsx(pc,{className:"h-4 w-4 text-muted-foreground"}),u.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&&u.jsx(y3,{tables:r,searchValue:e}),t[22]=e,t[23]=r,t[24]=_):_=t[24],t[25]!==f||t[26]!==m||t[27]!==_?(g=u.jsxs(Vm,{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=u.jsxs(Ic,{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},zL=t=>{const e=J.c(25),{connection:n,children:o,hasChildren:r}=t,s=n.name===a$,i=s?"In-Memory":n.name,[a,l]=Y.useState(!1);let c;e[0]!==n.name?(c=async()=>{l(!0),await c$({engine:n.name}),setTimeout(()=>l(!1),500)},e[0]=n.name,e[1]=c):c=e[1];const d=c;let h,f,m;e[2]!==n.dialect?(h=u.jsx(g4,{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=l$(n.dialect),e[4]=n.dialect,e[5]=f):f=e[5],e[6]!==f?(m=u.jsx("span",{className:"text-xs",children:f}),e[6]=f,e[7]=m):m=e[7];const _=i;let g,p,b,y,x;return e[8]!==_?(g=u.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",u.jsx(RL,{variableName:_}),")"]}),e[8]=_,e[9]=g):g=e[9],e[10]!==d||e[11]!==s||e[12]!==a?(p=!s&&u.jsx(Te,{content:"Refresh connection",children:u.jsx(Me,{variant:"ghost",size:"icon",className:"ml-auto hover:bg-transparent hover:shadow-none",onClick:d,children:u.jsx(Bc,{className:Ie("h-4 w-4 text-muted-foreground hover:text-foreground",a&&"animate-[spin_0.5s]")})})}),e[10]=d,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=u.jsxs(kS,{children:[h,m,g,p]}),e[14]=h,e[15]=m,e[16]=g,e[17]=p,e[18]=b):b=e[18],e[19]!==o||e[20]!==r?(y=r?o:u.jsx(Xc,{content:"No databases available",className:"pl-2"}),e[19]=o,e[20]=r,e[21]=y):y=e[21],e[22]!==b||e[23]!==y?(x=u.jsxs(u.Fragment,{children:[b,y]}),e[22]=b,e[23]=y,e[24]=x):x=e[24],x},BL=t=>{const e=J.c(28),{hasSearch:n,engineName:o,database:r,children:s}=t,[i,a]=Y.useState(!1),[l,c]=Y.useState(!1);let d,h,f;e[0]!==n?(d=()=>{a(n)},h=[n],e[0]=n,e[1]=d,e[2]=h):(d=e[1],h=e[2]),Y.useEffect(d,h),e[3]!==i||e[4]!==l?(f=()=>{a(!i),c(!l)},e[3]=i,e[4]=l,e[5]=f):f=e[5];const m=`${o}:${r.name}`;let _;e[6]!==i?(_=u.jsx(ES,{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=Ie("h-4 w-4",g),e[8]=g,e[9]=p):p=e[9],e[10]!==p?(b=u.jsx(dr,{className:p}),e[10]=p,e[11]=b):b=e[11];const y=l&&i&&"font-semibold";let x,v,S,k;e[12]!==y?(x=Ie(y),e[12]=y,e[13]=x):x=e[13],e[14]!==r.name?(v=r.name===""?u.jsx("i",{children:"Not connected"}):r.name,e[14]=r.name,e[15]=v):v=e[15],e[16]!==x||e[17]!==v?(S=u.jsx("span",{className:x,children:v}),e[16]=x,e[17]=v,e[18]=S):S=e[18],e[19]!==S||e[20]!==f||e[21]!==m||e[22]!==_||e[23]!==b?(k=u.jsxs(go,{className:"text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",onSelect:f,value:m,children:[_,b,S]}),e[19]=S,e[20]=f,e[21]=m,e[22]=_,e[23]=b,e[24]=k):k=e[24];const E=i&&s;let N;return e[25]!==k||e[26]!==E?(N=u.jsxs(u.Fragment,{children:[k,E]}),e[25]=k,e[26]=E,e[27]=N):N=e[27],N},UL=t=>{const e=J.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=u.jsx(Xc,{content:"No schemas available",className:"pl-6"}),e[0]=h):h=e[0],h}let c,d;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=_=>u.jsx(VL,{databaseName:i,schema:_,hasSearch:a,children:u.jsx(y3,{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],c=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]=c}else c=e[8];return e[18]!==c?(d=u.jsx(u.Fragment,{children:c}),e[18]=c,e[19]=d):d=e[19],d},VL=t=>{const e=J.c(26),{databaseName:n,schema:o,children:r,hasSearch:s}=t,[i,a]=Y.useState(!1),[l,c]=Y.useState(!1),d=`${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]),Y.useEffect(h,f),jS(o.name))return r;e[3]!==i||e[4]!==l?(m=()=>{a(!i),c(!l)},e[3]=i,e[4]=l,e[5]=m):m=e[5],e[6]!==i?(_=u.jsx(ES,{isExpanded:i}),e[6]=i,e[7]=_):_=e[7];const g=l&&i&&"text-foreground";let p,b;e[8]!==g?(p=Ie("h-4 w-4 text-muted-foreground",g),e[8]=g,e[9]=p):p=e[9],e[10]!==p?(b=u.jsx(g$,{className:p}),e[10]=p,e[11]=b):b=e[11];const y=l&&i&&"font-semibold";let x,v,S;e[12]!==y?(x=Ie(y),e[12]=y,e[13]=x):x=e[13],e[14]!==o.name||e[15]!==x?(v=u.jsx("span",{className:x,children:o.name}),e[14]=o.name,e[15]=x,e[16]=v):v=e[16],e[17]!==v||e[18]!==m||e[19]!==_||e[20]!==b||e[21]!==d?(S=u.jsxs(go,{className:"text-sm flex flex-row gap-1 items-center pl-5 cursor-pointer rounded-none",onSelect:m,value:d,children:[_,b,v]}),e[17]=v,e[18]=m,e[19]=_,e[20]=b,e[21]=d,e[22]=S):S=e[22];const k=i&&r;let E;return e[23]!==S||e[24]!==k?(E=u.jsxs(u.Fragment,{children:[S,k]}),e[23]=S,e[24]=k,e[25]=E):E=e[25],E},y3=t=>{const e=J.c(24),{tables:n,sqlTableContext:o,searchValue:r}=t,{addTableList:s}=SS(),[i,a]=Y.useState(!1),[l,c]=Y.useState(!1);let d,h;e[0]!==s||e[1]!==o||e[2]!==n.length||e[3]!==i?(d=async()=>{if(n.length===0&&o&&!i){a(!0),c(!0);const{engine:p,database:b,schema:y}=o,x=await LH.request({engine:p,database:b,schema:y});if(!(x!=null&&x.tables))throw c(!1),new Error("No tables available");s({tables:x.tables,sqlTableContext:o}),c(!1)}},e[0]=s,e[1]=o,e[2]=n.length,e[3]=i,e[4]=d):d=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}=Gn(d,h);if(f||l){let p;return e[9]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx(CS,{message:"Loading tables...",className:"pl-12"}),e[9]=p):p=e[9],p}if(m){let p;return e[10]!==m?(p=u.jsx(NS,{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=u.jsx(Xc,{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=x=>!r||x.name.toLowerCase().includes(r.toLowerCase()),e[17]=r,e[18]=p):p=e[18];const b=n.filter(p);let y;e[19]!==r||e[20]!==o?(y=x=>u.jsx($L,{table:x,sqlTableContext:o,isSearching:!!r},x.name),e[19]=r,e[20]=o,e[21]=y):y=e[21],_=b.map(y),e[13]=r,e[14]=o,e[15]=n,e[16]=_}else _=e[16];return e[22]!==_?(g=u.jsx(u.Fragment,{children:_}),e[22]=_,e[23]=g):g=e[23],g},$L=t=>{const e=J.c(62),{table:n,sqlTableContext:o,isSearching:r}=t,{addTable:s}=SS(),[i,a]=Y.useState(!1),[l,c]=Y.useState(!1),d=n.columns.length>0;let h,f;e[0]!==s||e[1]!==i||e[2]!==o||e[3]!==n.name||e[4]!==d||e[5]!==l?(h=async()=>{if(i&&!d&&o&&!l){c(!0);const{engine:q,database:ne,schema:re}=o,ae=await FH.request({engine:q,database:ne,schema:re,tableName:n.name});if(!(ae!=null&&ae.table))throw new Error("No table details available");s({table:ae.table,sqlTableContext:o})}},e[0]=s,e[1]=i,e[2]=o,e[3]=n.name,e[4]=d,e[5]=l,e[6]=h):h=e[6],e[7]!==i||e[8]!==d?(f=[i,d],e[7]=i,e[8]=d,e[9]=f):f=e[9];const{isPending:m,error:_}=Gn(h,f),g=$e(Bs),p=Br(),{createNewCell:b}=Ot();let y;e[10]!==g||e[11]!==b||e[12]!==p||e[13]!==o||e[14]!==n?(y=()=>{ur(g,b,p),b({code:(()=>{if(n.source_type==="catalog"){const q=o!=null&&o.database?`${o.database}.${n.name}`:n.name;return`${n.engine}.load_table("${q}")`}if(o)return IS(n,"*",o);switch(n.source_type){case"local":return`mo.ui.table(${n.name})`;case"duckdb":case"connection":return IS(n,"*",o);default:return vc(n.source_type),""}})(),before:!1,cellId:p??"__end__"})},e[10]=g,e[11]=b,e[12]=p,e[13]=o,e[14]=n,e[15]=y):y=e[15];const x=y;let v;e[16]!==n.num_columns||e[17]!==n.num_rows?(v=()=>{const q=[];return n.num_rows!=null&&q.push(`${n.num_rows} rows`),n.num_columns!=null&&q.push(`${n.num_columns} columns`),q.length===0?null:u.jsx("div",{className:"flex flex-row gap-2 items-center pl-6 group-hover:hidden",children:u.jsx("span",{className:"text-xs text-muted-foreground",children:q.join(", ")})})},e[16]=n.num_columns,e[17]=n.num_rows,e[18]=v):v=e[18];const S=v;let k;e[19]!==_||e[20]!==m||e[21]!==o||e[22]!==n?(k=()=>{if(m)return u.jsx(CS,{message:"Loading columns...",className:"pl-12"});if(_)return u.jsx(NS,{error:_,className:"pl-12"});const q=n.columns;return q.length===0?u.jsx(Xc,{content:"No columns found",className:"pl-12"}):q.map(ne=>u.jsx(HL,{table:n,column:ne,sqlTableContext:o},ne.name))},e[19]=_,e[20]=m,e[21]=o,e[22]=n,e[23]=k):k=e[23];const E=k;let N;e[24]!==i||e[25]!==r||e[26]!==n.source_type||e[27]!==n.type?(N=()=>{if(n.source_type==="local")return;const q=n.type==="table"?d$:t4;return u.jsx(q,{className:"h-3 w-3",strokeWidth:i||r?2.5:void 0})},e[24]=i,e[25]=r,e[26]=n.source_type,e[27]=n.type,e[28]=N):N=e[28];const I=N,T=o?`${o.database}.${o.schema}.${n.name}`:n.name,M=o&&(jS(o.schema)?"pl-9":"pl-12"),R=(i||r)&&"font-semibold";let z,D,F,B,V,O,C,$,j,W,K,Z;return e[29]!==M||e[30]!==R?(z=Ie("rounded-none group h-8 cursor-pointer",M,R),e[29]=M,e[30]=R,e[31]=z):z=e[31],e[32]!==i?(D=()=>a(!i),e[32]=i,e[33]=D):D=e[33],e[34]!==I?(F=I(),e[34]=I,e[35]=F):F=e[35],e[36]!==n.name?(B=u.jsx("span",{className:"text-sm",children:n.name}),e[36]=n.name,e[37]=B):B=e[37],e[38]!==F||e[39]!==B?(V=u.jsxs("div",{className:"flex gap-2 items-center flex-1",children:[F,B]}),e[38]=F,e[39]=B,e[40]=V):V=e[40],e[41]!==S?(O=S(),e[41]=S,e[42]=O):O=e[42],e[43]!==x?(C=Hn.stopPropagation(()=>x()),e[43]=x,e[44]=C):C=e[44],e[45]===Symbol.for("react.memo_cache_sentinel")?($=u.jsx(u$,{className:"h-3 w-3"}),e[45]=$):$=e[45],e[46]!==C?(j=u.jsx(Te,{content:"Add table to notebook",delayDuration:400,children:u.jsx(Me,{className:"group-hover:inline-flex hidden",variant:"text",size:"icon",onClick:C,children:$})}),e[46]=C,e[47]=j):j=e[47],e[48]!==i||e[49]!==D||e[50]!==V||e[51]!==O||e[52]!==j||e[53]!==z||e[54]!==T?(W=u.jsxs(go,{className:z,value:T,"aria-selected":i,forceMount:!0,onSelect:D,children:[V,O,j]}),e[48]=i,e[49]=D,e[50]=V,e[51]=O,e[52]=j,e[53]=z,e[54]=T,e[55]=W):W=e[55],e[56]!==i||e[57]!==E?(K=i&&E(),e[56]=i,e[57]=E,e[58]=K):K=e[58],e[59]!==W||e[60]!==K?(Z=u.jsxs(u.Fragment,{children:[W,K]}),e[59]=W,e[60]=K,e[61]=Z):Z=e[61],Z},HL=t=>{var K,Z;const e=J.c(53),{table:n,column:o,sqlTableContext:r}=t,[s,i]=Y.useState(!1),a=$e(vS),l=Qt(h$);let c,d;e[0]!==a?(c=()=>{a&&i(!1)},d=[a],e[0]=a,e[1]=c,e[2]=d):(c=e[1],d=e[2]),Y.useEffect(c,d),l(s?q=>new Set([...q,`${n.name}:${o.name}`]):q=>(q.delete(`${n.name}:${o.name}`),new Set(q)));const h=$e(Bs),f=Br(),{createNewCell:m}=Ot(),{columnsPreviews:_}=f$();let g;e[3]!==o.name||e[4]!==n.primary_keys?(g=((K=n.primary_keys)==null?void 0:K.includes(o.name))||!1,e[3]=o.name,e[4]=n.primary_keys,e[5]=g):g=e[5];const p=g;let b;e[6]!==o.name||e[7]!==n.indexes?(b=((Z=n.indexes)==null?void 0:Z.includes(o.name))||!1,e[6]=o.name,e[7]=n.indexes,e[8]=b):b=e[8];const y=b;let x;e[9]!==h||e[10]!==m||e[11]!==f?(x=q=>{q.includes("alt")&&_$(h,m,f),m({code:q,before:!1,cellId:f??"__end__"})},e[9]=h,e[10]=m,e[11]=f,e[12]=x):x=e[12];const v=x,S=WL,k=s?"font-semibold":"";let E;e[13]!==o.name||e[14]!==k?(E=u.jsx("span",{className:k,children:o.name}),e[13]=o.name,e[14]=k,e[15]=E):E=e[15];const N=E,I=`${n.name}.${o.name}`,T=`${n.name}.${o.name}`;let M;e[16]!==s?(M=()=>i(!s),e[16]=s,e[17]=M):M=e[17];const R=r?"pl-14":"pl-7";let z,D,F,B,V,O,C,$,j,W;return e[18]!==R?(z=Ie("flex flex-row gap-2 items-center flex-1",R),e[18]=R,e[19]=z):z=e[19],e[20]!==o.type||e[21]!==N?(D=u.jsx(m$,{columnName:N,dataType:o.type}),e[20]=o.type,e[21]=N,e[22]=D):D=e[22],e[23]!==p?(F=p&&S({tooltipContent:"Primary key",content:"PK"}),e[23]=p,e[24]=F):F=e[24],e[25]!==y?(B=y&&S({tooltipContent:"Indexed",content:"IDX"}),e[25]=y,e[26]=B):B=e[26],e[27]!==z||e[28]!==D||e[29]!==F||e[30]!==B?(V=u.jsxs("div",{className:z,children:[D,F,B]}),e[27]=z,e[28]=D,e[29]=F,e[30]=B,e[31]=V):V=e[31],e[32]!==o.name?(O=u.jsx(Te,{content:"Copy column name",delayDuration:400,children:u.jsx(Me,{variant:"text",size:"icon",className:"group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground",children:u.jsx(pS,{tooltip:!1,value:o.name,className:"h-3 w-3"})})}),e[32]=o.name,e[33]=O):O=e[33],e[34]!==o.external_type?(C=u.jsx("span",{className:"text-xs text-muted-foreground",children:o.external_type}),e[34]=o.external_type,e[35]=C):C=e[35],e[36]!==M||e[37]!==V||e[38]!==O||e[39]!==C||e[40]!==I||e[41]!==T?($=u.jsxs(go,{className:"rounded-none py-1 group cursor-pointer",value:T,onSelect:M,children:[V,O,C]},I),e[36]=M,e[37]=V,e[38]=O,e[39]=C,e[40]=I,e[41]=T,e[42]=$):$=e[42],e[43]!==o||e[44]!==_||e[45]!==v||e[46]!==s||e[47]!==r||e[48]!==n?(j=s&&u.jsx("div",{className:"pl-10 pr-2 py-2 bg-[var(--slate-1)] shadow-inner border-b",children:u.jsx(Ac,{children:u.jsx(p$,{table:n,column:o,onAddColumnChart:v,preview:_.get(r?`${r.database}.${r.schema}.${n.name}:${o.name}`:`${n.name}:${o.name}`),sqlTableContext:r})})}),e[43]=o,e[44]=_,e[45]=v,e[46]=s,e[47]=r,e[48]=n,e[49]=j):j=e[49],e[50]!==$||e[51]!==j?(W=u.jsxs(u.Fragment,{children:[$,j]}),e[50]=$,e[51]=j,e[52]=W):W=e[52],W};function WL(t){const{tooltipContent:e,content:n}=t;return u.jsx(Te,{content:e,delayDuration:100,children:u.jsx("span",{className:"text-xs text-black bg-gray-100 dark:invert rounded px-1",children:n})})}const qL=()=>{const t=J.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx(FL,{}),t[0]=e):e=t[0],e},GL=()=>{const t=J.c(5),{documentation:e}=$e(b$);if(!e){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(vn,{title:"View docs as you type",description:"Move your text cursor over a symbol to see its documentation.",icon:u.jsx(md,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=ep({html:e}),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=u.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},YL=()=>{const t=J.c(5),e=y$();if(e.length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(vn,{title:"No errors!",icon:u.jsx(Wp,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=e.map(JL),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=u.jsx("div",{className:"flex flex-col overflow-auto",children:n}),t[3]=n,t[4]=o):o=t[4],o};function JL(t){return u.jsxs("div",{children:[u.jsx("div",{className:"text-xs font-mono font-semibold bg-muted border-y px-2 py-1",children:u.jsx(x$,{cellId:t.cellId})}),u.jsx("div",{className:"px-2",children:u.jsx(w$,{errors:t.output.data,cellId:t.cellId},t.cellId)},t.cellId)]},t.cellId)}function x3(t,e,n){return t[e]?t[e][0]?t[e][0][n]:t[e][n]:e==="contentBoxSize"?t.contentRect[n==="inlineSize"?"width":"height"]:void 0}gp=function(t){t===void 0&&(t={});var e=t.onResize,n=A.useRef(void 0);n.current=e;var o=t.round||Math.round,r=A.useRef(),s=A.useState({width:void 0,height:void 0}),i=s[0],a=s[1],l=A.useRef(!1);A.useEffect(function(){return l.current=!1,function(){l.current=!0}},[]);var c=A.useRef({width:void 0,height:void 0}),d=function(h,f){var m=A.useRef(null),_=A.useRef(null);_.current=f;var g=A.useRef(null);A.useEffect(function(){p()});var p=A.useCallback(function(){var b=g.current,y=_.current,x=b||(y?y instanceof Element?y:y.current:null);m.current&&m.current.element===x&&m.current.subscriber===h||(m.current&&m.current.cleanup&&m.current.cleanup(),m.current={element:x,subscriber:h,cleanup:x?h(x):void 0})},[h]);return A.useEffect(function(){return function(){m.current&&m.current.cleanup&&(m.current.cleanup(),m.current=null)}},[]),A.useCallback(function(b){g.current=b,p()},[p])}(A.useCallback(function(h){return r.current&&r.current.box===t.box&&r.current.round===o||(r.current={box:t.box,round:o,instance:new ResizeObserver(function(f){var m=f[0],_=t.box==="border-box"?"borderBoxSize":t.box==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",g=x3(m,_,"inlineSize"),p=x3(m,_,"blockSize"),b=g?o(g):void 0,y=p?o(p):void 0;if(c.current.width!==b||c.current.height!==y){var x={width:b,height:y};c.current.width=b,c.current.height=y,n.current?n.current(x):l.current||a(x)}})}),r.current.instance.observe(h,{box:t.box}),function(){r.current&&r.current.instance.unobserve(h)}},[t.box,o]),t.ref);return A.useMemo(function(){return{ref:d,width:i.width,height:i.height}},[d,i.width,i.height])};const rm=new Map,KL=({file:t,onOpenNotebook:e})=>{const{theme:n}=zo(),o=$e(ym),[r,s]=A.useState(""),{data:i,isPending:a,error:l,setData:c}=Gn(async()=>{const g=await np({path:t.path}),p=g.contents||"";return s(rm.get(t.path)||p),g},[t.path]),d=async()=>{r!==(i==null?void 0:i.contents)&&await I$({path:t.path,contents:r}).then(g=>{g.success&&(c(p=>({...p,contents:r})),s(r))})},h=A.useRef(r);if(h.current=r,A.useEffect(()=>()=>{if(!(i!=null&&i.contents))return;const g=h.current;g===i.contents?rm.delete(t.path):rm.set(t.path,g)},[t.path,i==null?void 0:i.contents]),l)return u.jsx(Vr,{error:l});if(a||!i)return null;const f=i.mimeType||"text/plain",m=f in sm;if(!i.contents&&!m)return u.jsxs("div",{className:"grid grid-cols-2 gap-2 p-6",children:[u.jsx("div",{className:"font-bold text-muted-foreground",children:"Name"}),u.jsx("div",{children:i.file.name}),u.jsx("div",{className:"font-bold text-muted-foreground",children:"Type"}),u.jsx("div",{children:f})]});const _=u.jsxs("div",{className:"text-xs text-muted-foreground p-1 flex justify-end gap-2 border-b",children:[t.isMarimoFile&&!In()&&u.jsx(Te,{content:"Open notebook",children:u.jsx(wn,{size:"small",onClick:g=>e(g),children:u.jsx(jc,{})})}),u.jsx(Te,{content:"Download",children:u.jsx(wn,{size:"small",onClick:()=>{if(w3(f)){const g=j$(i.contents,f);return void E$(g,i.file.name)}ua(new Blob([i.contents||r],{type:f}),i.file.name)},children:u.jsx(Em,{})})}),!w3(f)&&u.jsxs(u.Fragment,{children:[u.jsx(Te,{content:"Copy contents to clipboard",children:u.jsx(wn,{size:"small",onClick:async()=>{await xn(r)},children:u.jsx(ra,{})})}),u.jsx(Te,{content:pn("global.save"),children:u.jsx(wn,{size:"small",color:r===i.contents?void 0:"green",onClick:d,disabled:r===i.contents,children:u.jsx(Ma,{})})})]})]});return f.startsWith("image/")?u.jsxs(u.Fragment,{children:[_,u.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:u.jsx(v$,{base64:i.contents,mime:f})})]}):f==="text/csv"&&i.contents?u.jsxs(u.Fragment,{children:[_,u.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:u.jsx(k$,{contents:i.contents})})]}):f.startsWith("audio/")?u.jsxs(u.Fragment,{children:[_,u.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:u.jsx(S$,{base64:i.contents,mime:f})})]}):f.startsWith("video/")?u.jsxs(u.Fragment,{children:[_,u.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:u.jsx(C$,{base64:i.contents,mime:f})})]}):f.startsWith("application/pdf")?u.jsxs(u.Fragment,{children:[_,u.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:u.jsx(N$,{base64:i.contents,mime:f})})]}):u.jsxs(u.Fragment,{children:[_,u.jsx("div",{className:"flex-1 overflow-auto",children:u.jsx(A.Suspense,{children:u.jsx(ka,{theme:n==="dark"?"dark":"light",language:sm[f]||sm.default,className:"border-b",extensions:[st.lineWrapping,Yn.of([{key:o.getHotkey("global.save").key,stopPropagation:!0,run:()=>r!==i.contents&&(d(),!0)}])],value:r,onChange:s})})})]})},w3=t=>t.startsWith("image/")||t.startsWith("audio/")||t.startsWith("video/")||t.startsWith("application/pdf"),sm={"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"},v3=en(new class{constructor(t){this.callbacks=t,this.delegate=new cp([]),this.rootPath="",this.onChange=An.NOOP,this.path=new Sc("/"),this.initialize=async e=>{if(this.onChange=e,this.delegate.data.length===0)try{const n=await this.callbacks.listFiles({path:this.rootPath});this.delegate=new cp(n.files),this.rootPath=n.root,this.path=Sc.guessDeliminator(n.root)}catch(n){lt({title:"Failed",description:J4(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 cp(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:(lt({title:"Failed",description:e.message}),null)}async expand(t){const e=this.delegate.find(t);if(!e||!e.data.isDirectory)return!1;if(e.children&&e.children.length>0)return!0;const n=await this.callbacks.listFiles({path:e.data.path});return this.delegate.update({id:t,changes:{children:n.files}}),this.onChange(this.delegate.data),!0}async rename(t,e){const n=this.delegate.find(t);if(!n)return;const o=n.data.path,r=this.path.join(this.path.dirname(o),e);await this.callbacks.renameFileOrFolder({path:o,newPath:r}).then(this.handleResponse),this.delegate.update({id:t,changes:{name:e,path:r}}),this.onChange(this.delegate.data),await this.refreshAll([r])}async move(t,e){var o;const n=e?((o=this.delegate.find(e))==null?void 0:o.data.path)??e:this.rootPath;await Promise.all(t.map(r=>{this.delegate.move({id:r,parentId:e,index:0});const s=this.delegate.find(r);if(!s)return Promise.resolve();const i=this.path.join(n,this.path.basename(s.data.path));return this.delegate.update({id:r,changes:{path:i}}),this.callbacks.renameFileOrFolder({path:s.data.path,newPath:i}).then(this.handleResponse)})),this.onChange(this.delegate.data),await this.refreshAll([n])}async createFile(t,e){var r;const n=e?((r=this.delegate.find(e))==null?void 0:r.data.path)??e:this.rootPath,o=await this.callbacks.createFileOrFolder({path:n,type:"file",name:t}).then(this.handleResponse);o!=null&&o.info&&(this.delegate.create({parentId:e,index:0,data:o.info}),this.onChange(this.delegate.data),await this.refreshAll([n]))}async createFolder(t,e){var r;const n=e?((r=this.delegate.find(e))==null?void 0:r.data.path)??e:this.rootPath,o=await this.callbacks.createFileOrFolder({path:n,type:"directory",name:t}).then(this.handleResponse);o!=null&&o.info&&(this.delegate.create({parentId:e,index:0,data:o.info}),this.onChange(this.delegate.data),await this.refreshAll([n]))}async delete(t){const e=this.delegate.find(t);e&&(await this.callbacks.deleteFileOrFolder({path:e.data.path}).then(this.handleResponse),this.delegate.drop({id:t}),this.onChange(this.delegate.data))}}({listFiles:S4,createFileOrFolder:op,deleteFileOrFolder:T$,renameFileOrFolder:A$})),XL=en({});function ZL(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 k3(t){const e=J.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:oF,onDropRejected:eF,onDrop:QL,...o},e[2]=o,e[3]=r):r=e[3],M$(r)}async function QL(t){for(const e of t){const n=sF(rF(e));let o="";n&&(o=Sc.guessDeliminator(n).dirname(n));const r=(await ZL(e)).split(",")[1];await op({path:o,type:"file",name:e.name,contents:r})}await async function(){await dt.get(v3).refreshAll([])}()}function eF(t){lt({title:"File upload failed",description:u.jsx("div",{className:"flex flex-col gap-1",children:t.map(tF)}),variant:"danger"})}function tF(t){return u.jsxs("div",{children:[t.file.name," (",t.errors.map(nF).join(", "),")"]},t.file.name)}function nF(t){return t.message}function oF(t){Dt.error(t),lt({title:"File upload failed",description:t.message,variant:"danger"})}function rF(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 sF(t){if(t)return t.replace(/^\/+/,"")}const S3=Y.createContext(null),iF=t=>{const e=J.c(60),{height:n}=t,o=A.useRef(null),[r]=an(v3);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=[],e[0]=s):s=e[0];const[i,a]=A.useState(s),[l,c]=A.useState(null),{openPrompt:d}=qn(),[h,f]=an(XL);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}=Gn(m,_);let b;e[4]!==h||e[5]!==r?(b=()=>{r.refreshAll(Object.keys(h).filter(C=>h[C]))},e[4]=h,e[5]=r,e[6]=b):b=e[6];const y=et(b);let x;e[7]!==d||e[8]!==r?(x=async()=>{d({title:"Folder name",onConfirm:async C=>{r.createFolder(C,null)}})},e[7]=d,e[8]=r,e[9]=x):x=e[9];const v=et(x);let S;e[10]!==d||e[11]!==r?(S=async()=>{d({title:"File name",onConfirm:async C=>{r.createFile(C,null)}})},e[10]=d,e[11]=r,e[12]=S):S=e[12];const k=et(S);let E;e[13]!==f?(E=()=>{var C;(C=o.current)==null||C.closeAll(),f({})},e[13]=f,e[14]=E):E=e[14];const N=et(E);if(g){let C;return e[15]===Symbol.for("react.memo_cache_sentinel")?(C=u.jsx(Kn,{size:"medium",centered:!0}),e[15]=C):C=e[15],C}if(p){let C;return e[16]!==p?(C=u.jsx(Vr,{error:p}),e[16]=p,e[17]=C):C=e[17],C}if(l){let C,$,j,W,K,Z;return e[18]===Symbol.for("react.memo_cache_sentinel")?(C=()=>c(null),e[18]=C):C=e[18],e[19]===Symbol.for("react.memo_cache_sentinel")?($=u.jsx(Me,{onClick:C,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:u.jsx(Et,{size:16})}),e[19]=$):$=e[19],e[20]!==l.name?(j=u.jsxs("div",{className:"flex items-center pl-1 pr-3 flex-shrink-0 border-b justify-between",children:[$,u.jsx("span",{className:"font-bold",children:l.name})]}),e[20]=l.name,e[21]=j):j=e[21],e[22]!==l.path||e[23]!==r?(W=q=>C3(q,r.relativeFromRoot(l.path)),e[22]=l.path,e[23]=r,e[24]=W):W=e[24],e[25]!==l||e[26]!==W?(K=u.jsx(A.Suspense,{children:u.jsx(KL,{onOpenNotebook:W,file:l})}),e[25]=l,e[26]=W,e[27]=K):K=e[27],e[28]!==j||e[29]!==K?(Z=u.jsxs(u.Fragment,{children:[j,K]}),e[28]=j,e[29]=K,e[30]=Z):Z=e[30],Z}let I;e[31]!==N||e[32]!==k||e[33]!==v||e[34]!==y||e[35]!==r?(I=u.jsx(lF,{onRefresh:y,onCreateFile:k,onCreateFolder:v,onCollapseAll:N,tree:r}),e[31]=N,e[32]=k,e[33]=v,e[34]=y,e[35]=r,e[36]=I):I=e[36];const T=n-33;let M,R,z,D,F,B,V,O;return e[37]!==r?(M=async C=>{const{ids:$}=C;for(const j of $)await r.delete(j)},R=async C=>{const{id:$,name:j}=C;await r.rename($,j)},z=async C=>{const{dragIds:$,parentId:j}=C;await r.move($,j)},e[37]=r,e[38]=M,e[39]=R,e[40]=z):(M=e[38],R=e[39],z=e[40]),e[41]===Symbol.for("react.memo_cache_sentinel")?(D=C=>{const $=C[0];$&&($.data.isDirectory||c($.data))},e[41]=D):D=e[41],e[42]!==h||e[43]!==f||e[44]!==r?(F=async C=>{if(await r.expand(C)){const $=h[C]??!1;f({...h,[C]:!$})}},e[42]=h,e[43]=f,e[44]=r,e[45]=F):F=e[45],e[46]!==i||e[47]!==h||e[48]!==M||e[49]!==R||e[50]!==z||e[51]!==F||e[52]!==T?(B=u.jsx(yH,{width:"100%",ref:o,height:T,className:"h-full",data:i,initialOpenState:h,openByDefault:!1,renderCursor:fF,disableDrop:mF,onDelete:M,onRename:R,onMove:z,onSelect:D,onToggle:F,padding:15,rowHeight:30,indent:aF,overscanCount:1e3,disableMultiSelection:!0,children:uF}),e[46]=i,e[47]=h,e[48]=M,e[49]=R,e[50]=z,e[51]=F,e[52]=T,e[53]=B):B=e[53],e[54]!==B||e[55]!==r?(V=u.jsx(S3,{value:r,children:B}),e[54]=B,e[55]=r,e[56]=V):V=e[56],e[57]!==V||e[58]!==I?(O=u.jsxs(u.Fragment,{children:[I,V]}),e[57]=V,e[58]=I,e[59]=O):O=e[59],O},aF=15,lF=t=>{const e=J.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}=k3(i);let c,d,h,f,m,_,g,p,b,y,x,v,S,k,E;return e[1]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(Aa,{size:16}),e[1]=c):c=e[1],e[2]!==o?(d=u.jsx(Te,{content:"Add file",children:u.jsx(Me,{"data-testid":"file-explorer-add-file-button",onClick:o,variant:"text",size:"xs",children:c})}),e[2]=o,e[3]=d):d=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(id,{size:16}),e[4]=h):h=e[4],e[5]!==r?(f=u.jsx(Te,{content:"Add folder",children:u.jsx(Me,{"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")?(_=O$({variant:"text",size:"xs"}),g=u.jsx(R$,{size:16}),e[9]=_,e[10]=g):(_=e[9],g=e[10]),e[11]!==m?(p=u.jsx(Te,{content:"Upload file",children:u.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?(y=u.jsx("input",{...b,type:"file"}),e[15]=b,e[16]=y):y=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx(eS,{size:16}),e[17]=x):x=e[17],e[18]!==n?(v=u.jsx(Te,{content:"Refresh",children:u.jsx(Me,{"data-testid":"file-explorer-refresh-button",onClick:n,variant:"text",size:"xs",children:x})}),e[18]=n,e[19]=v):v=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(S=u.jsx(Sp,{size:16}),e[20]=S):S=e[20],e[21]!==s?(k=u.jsx(Te,{content:"Collapse all folders",children:u.jsx(Me,{"data-testid":"file-explorer-collapse-button",onClick:s,variant:"text",size:"xs",children:S})}),e[21]=s,e[22]=k):k=e[22],e[23]!==y||e[24]!==v||e[25]!==k||e[26]!==d||e[27]!==f||e[28]!==p?(E=u.jsxs("div",{className:"flex items-center justify-end px-2 flex-shrink-0 border-b",children:[d,f,p,y,v,k]}),e[23]=y,e[24]=v,e[25]=k,e[26]=d,e[27]=f,e[28]=p,e[29]=E):E=e[29],E},cF=t=>{const e=J.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&&!In()&&u.jsxs("span",{className:"flex-shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline",onClick:o,children:["open ",u.jsx(jc,{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=u.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},dF=t=>{const e=J.c(10),{node:n}=t,o=A.useRef(null);let r,s,i,a,l;return e[0]!==n.data.name?(r=()=>{var c,d;(c=o.current)==null||c.focus(),(d=o.current)==null||d.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]),A.useEffect(r,s),e[3]!==n?(i=()=>n.reset(),a=c=>{c.key==="Escape"&&n.reset(),c.key==="Enter"&&n.submit(c.currentTarget.value)},e[3]=n,e[4]=i,e[5]=a):(i=e[4],a=e[5]),e[6]!==n.data.name||e[7]!==i||e[8]!==a?(l=u.jsx("input",{ref:o,className:"flex-1 bg-transparent border border-border text-muted-foreground",defaultValue:n.data.name,onClick:pF,onBlur:i,onKeyDown:a}),e[6]=n.data.name,e[7]=i,e[8]=a,e[9]=l):l=e[9],l},uF=({node:t,style:e,dragHandle:n})=>{const o=t.data.isDirectory?"directory":v4(t.data.name),r=k4[o],{openConfirm:s,openPrompt:i}=qn(),{createNewCell:a}=Ot(),l=Br(),c=A.use(S3),d=async g=>{C3(g,c?c.relativeFromRoot(t.data.path):t.data.path)},h=async g=>{g.stopPropagation(),g.preventDefault(),s({title:"Delete file",description:`Are you sure you want to delete ${t.data.name}?`,confirmAction:u.jsx(_4,{onClick:async()=>{await t.tree.delete(t.id)},"aria-label":"Confirm",children:"Delete"})})},f=et(async()=>{t.open(),i({title:"Folder name",onConfirm:async g=>{c==null||c.createFolder(g,t.id)}})}),m=et(async()=>{t.open(),i({title:"File name",onConfirm:async g=>{c==null||c.createFile(g,t.id)}})}),_=et(async()=>{var y;if(!c||t.data.isDirectory)return;const[g,p]=D$(t.data.name),b=`${g}_copy${p}`;try{const x=await np({path:t.data.path}),v=((y=t.parent)==null?void 0:y.data.path)||"";await op({path:v,type:"file",name:b,contents:x.contents?btoa(x.contents):void 0}),await c.refreshAll([v])}catch{lt({title:"Failed to duplicate file",description:"Unable to create a duplicate of the file",variant:"danger"})}});return u.jsxs("div",{style:e,ref:n,className:Ie("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:[u.jsx(hF,{node:t}),u.jsxs("span",{className:Ie("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?u.jsx("img",{src:"./favicon.ico",className:"w-5 h-5 flex-shrink-0 mr-2 filter grayscale",alt:"Marimo"}):u.jsx(r,{className:"w-5 h-5 flex-shrink-0 mr-2",strokeWidth:1.5}),t.isEditing?u.jsx(dF,{node:t}):u.jsx(cF,{node:t,onOpenMarimoFile:d}),u.jsxs(Hs,{modal:!1,children:[u.jsx(Ws,{asChild:!0,tabIndex:-1,onClick:g=>g.stopPropagation(),children:u.jsx(Me,{"data-testid":"file-explorer-more-button",variant:"text",tabIndex:-1,size:"xs",className:"mb-0","aria-label":"More options",children:u.jsx(sd,{strokeWidth:2,className:"w-5 h-5 hidden group-hover:block"})})}),(()=>{const g={size:14,strokeWidth:1.5,className:"mr-2"};return u.jsxs(qs,{align:"end",className:"no-print w-[220px]",onClick:p=>p.stopPropagation(),onCloseAutoFocus:p=>p.preventDefault(),children:[!t.data.isDirectory&&u.jsxs(Gt,{onSelect:()=>t.select(),children:[u.jsx(ig,{...g}),"Open file"]}),!t.data.isDirectory&&!In()&&u.jsxs(Gt,{onSelect:()=>{P$({path:t.data.path})},children:[u.jsx(jc,{...g}),"Open file in external editor"]}),t.data.isDirectory&&u.jsxs(u.Fragment,{children:[u.jsxs(Gt,{onSelect:()=>m(),children:[u.jsx(Aa,{...g}),"Create file"]}),u.jsxs(Gt,{onSelect:()=>f(),children:[u.jsx(id,{...g}),"Create folder"]}),u.jsx(_o,{})]}),u.jsxs(Gt,{onSelect:()=>t.edit(),children:[u.jsx(qp,{...g}),"Rename"]}),!t.data.isDirectory&&u.jsxs(Gt,{onSelect:_,children:[u.jsx(ra,{...g}),"Duplicate"]}),u.jsxs(Gt,{onSelect:async()=>{await xn(t.data.path),lt({title:"Copied to clipboard"})},children:[u.jsx(cd,{...g}),"Copy path"]}),c&&u.jsxs(Gt,{onSelect:async()=>{await xn(c.relativeFromRoot(t.data.path)),lt({title:"Copied to clipboard"})},children:[u.jsx(cd,{...g}),"Copy relative path"]}),u.jsx(_o,{}),u.jsxs(Gt,{onSelect:()=>{const{path:p}=t.data;(b=>{a({code:b,before:!1,cellId:l??"__end__"})})(AS[o](p))},children:[u.jsx(Wr,{...g}),"Insert snippet for reading file"]}),u.jsxs(Gt,{onSelect:async()=>{lt({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=AS[o](p);await xn(b)},children:[u.jsx(L$,{...g}),"Copy snippet for reading file"]}),t.data.isMarimoFile&&!In()&&u.jsxs(u.Fragment,{children:[u.jsx(_o,{}),u.jsxs(Gt,{onSelect:d,children:[u.jsx(tg,{...g}),"Open notebook"]})]}),u.jsx(_o,{}),!t.data.isDirectory&&u.jsxs(u.Fragment,{children:[u.jsxs(Gt,{onSelect:async()=>{const p=(await np({path:t.data.path})).contents||"";ua(new Blob([p]),t.data.name)},children:[u.jsx(Em,{...g}),"Download"]}),u.jsx(_o,{})]}),u.jsxs(Gt,{onSelect:h,variant:"danger",children:[u.jsx(bm,{...g}),"Delete"]})]})})()]})]})]})},hF=t=>{const e=J.c(3),{node:n}=t;if(!n.data.isDirectory){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=u.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?u.jsx(Vs,{className:"w-5 h-5 flex-shrink-0"}):u.jsx(ia,{className:"w-5 h-5 flex-shrink-0"}),e[1]=n.isOpen,e[2]=o):o=e[2],o};function C3(t,e){t.stopPropagation(),t.preventDefault(),window.open(`/?file=${e}`,"_blank")}function fF(){return null}function mF(t){const{parentNode:e}=t;return!e.data.isDirectory}function pF(t){return t.stopPropagation()}let N3,j3,E3;N3=()=>{const t=J.c(20),{ref:e,height:n}=gp(),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}=k3(r);let l,c,d,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")?(c=Ie("flex flex-col flex-1 overflow-hidden relative"),t[3]=c):c=t[3],t[4]!==i?(d=i(),t[4]=i,t[5]=d):d=t[5],t[6]!==d?(h=u.jsx("input",{...d}),t[6]=d,t[7]=h):h=t[7],t[8]!==a?(f=a&&u.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=u.jsx(iF,{height:o}),t[10]=o,t[11]=m):m=t[11],t[12]!==e||t[13]!==m?(_=u.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=u.jsxs("div",{...l,className:c,children:[h,f,_]}),t[15]=l,t[16]=h,t[17]=f,t[18]=_,t[19]=g):g=t[19],g},pp=t=>{const e=J.c(6),n=t.dataTestId;let o,r;return e[0]!==t.className?(o=Ie("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=u.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},j3=()=>{const t=J.c(9),e=F$(),{clearLogs:n}=Ot();if(e.length===0){let i,a;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx("code",{className:"border rounded px-1",children:"stdout"}),t[0]=i):i=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx(vn,{title:"No logs",description:u.jsxs("span",{children:[i," and"," ",u.jsx("code",{className:"border rounded px-1",children:"stderr"})," logs will appear here."]}),icon:u.jsx(mm,{})}),t[1]=a):a=t[1],a}let o,r,s;return t[2]!==n?(o=u.jsx("div",{className:"flex flex-row justify-end px-2 py-1",children:u.jsx(pp,{dataTestId:"clear-logs-button",onClick:n})}),t[2]=n,t[3]=o):o=t[3],t[4]!==e?(r=u.jsx("div",{className:"overflow-auto flex-1",children:u.jsx(E3,{logs:e,className:"min-w-[300px]"})}),t[4]=e,t[5]=r):r=t[5],t[6]!==o||t[7]!==r?(s=u.jsxs(u.Fragment,{children:[o,r]}),t[6]=o,t[7]=r,t[8]=s):s=t[8],s},E3=t=>{const e=J.c(10),{logs:n,className:o}=t;let r,s,i,a,l;return e[0]!==o?(r=Ie("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(bF),e[3]=n,e[4]=i):i=e[4],e[5]!==i?(a=u.jsx("pre",{className:"grid text-xs font-mono gap-1 whitespace-break-spaces font-semibold align-left",children:u.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=u.jsx("div",{className:r,children:a}),e[7]=r,e[8]=a,e[9]=l):l=e[9],l};function gF(t){const e=z$(t.timestamp),n=_F[t.level],o=t.level.toUpperCase();return u.jsxs(u.Fragment,{children:[u.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)] dark:text-[var(--gray-11)]",children:["[",e,"]"]}),u.jsx("span",{className:Ie("flex-shrink-0",n),children:o}),u.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)]",children:["(",u.jsx(gr,{cellId:t.cellId}),")"]}),t.message]})}const _F={stdout:"text-[var(--grass-9)]",stderr:"text-[var(--red-9)]"};function bF(t,e){return u.jsxs("div",{className:"contents group",children:[u.jsx("span",{className:Ie("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","text-right col-span-1 py-1 pr-1"),children:e+1}),u.jsx("span",{className:Ie("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","px-2 flex gap-x-1.5 py-1 flex-wrap"),children:gF(t)})]},e)}const yF=()=>{const t=J.c(7),{items:e}=$e(B$);let n,o;t[0]!==e?(o=zH(e),t[0]=e,t[1]=o):o=t[1],n=o;const r=n,{activeHeaderId:s,activeOccurrences:i}=BH(r);if(e.length===0){let l;return t[2]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx(vn,{title:"No outline",description:"Add markdown headings to your notebook to create an outline.",icon:u.jsx(fd,{})}),t[2]=l):l=t[2],l}let a;return t[3]!==s||t[4]!==i||t[5]!==e?(a=u.jsx(UH,{items:e,activeHeaderId:s,activeOccurrences:i}),t[3]=s,t[4]=i,t[5]=e,t[6]=a):a=t[6],a},I3=(t,e)=>{lt(e?{title:"Failed to add package",description:e,variant:"danger"}:{title:"Package added",description:u.jsxs("div",{children:[u.jsxs("div",{children:["The package ",u.jsx(ba,{className:"inline",children:t})," and its dependencies has been added to your environment."]}),u.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Some Python packages may require a kernel restart to see changes."})]})})},A3=(t,e)=>{lt(e?{title:"Failed to upgrade package",description:e,variant:"danger"}:{title:"Package upgraded",description:u.jsxs("div",{children:[u.jsxs("div",{children:["The package ",u.jsx(ba,{className:"inline",children:t})," has been upgraded."]}),u.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Some Python packages may require a kernel restart to see changes."})]})})},T3=(t,e)=>{lt(e?{title:"Failed to remove package",description:e,variant:"danger"}:{title:"Package removed",description:u.jsxs("div",{children:[u.jsxs("div",{children:["The package ",u.jsx(ba,{className:"inline",children:t})," has been removed from your environment."]}),u.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Some Python packages may require a kernel restart to see changes."})]})})},M3=t=>{const e=J.c(9),{onClick:n,loading:o,children:r,className:s}=t;if(o){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(Kn,{size:"small",className:"h-4 w-4 shrink-0 opacity-50"}),e[0]=c):c=e[0],c}let i,a,l;return e[1]!==s?(i=Ie("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=Hn.stopPropagation(n),e[3]=n,e[4]=a):a=e[4],e[5]!==r||e[6]!==i||e[7]!==a?(l=u.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},xF=()=>{var v,S;const t=J.c(27),[e]=$s(),n=e.package_management.manager,[o,r]=Y.useState(null);let s;t[0]!==n?(s=[n],t[0]=n,t[1]=s):s=t[1];const{data:i,error:a,refetch:l,isPending:c}=Gn(SF,s);if(c){let k;return t[2]===Symbol.for("react.memo_cache_sentinel")?(k=u.jsx(Kn,{size:"medium",centered:!0}),t[2]=k):k=t[2],k}if(a){let k;return t[3]!==a?(k=u.jsx(Vr,{error:a}),t[3]=a,t[4]=k):k=t[4],k}const d=i.tree!=null;let h;t[5]!==d||t[6]!==o?(h=function(k,E){return k==="list"?"list":E?k||"tree":"list"}(o,d),t[5]=d,t[6]=o,t[7]=h):h=t[7];const f=h,m=(v=i.tree)==null?void 0:v.name,_=(S=i==null?void 0:i.tree)==null?void 0:S.version,g=m==="<root>";let p,b,y,x;return t[8]!==n||t[9]!==l?(p=u.jsx(wF,{packageManager:n,onSuccess:l}),t[8]=n,t[9]=l,t[10]=p):p=t[10],t[11]!==g||t[12]!==d||t[13]!==m||t[14]!==_||t[15]!==f?(b=d&&u.jsxs("div",{className:"flex items-center justify-between px-2 py-1 border-b",children:[u.jsxs("div",{className:"flex gap-1",children:[u.jsx("button",{type:"button",className:Ie("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"}),u.jsx("button",{type:"button",className:Ie("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"})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.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&&u.jsxs("span",{className:"text-xs text-muted-foreground",children:[m,_&&` v${_}`]})]})]}),t[11]=g,t[12]=d,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?(y=f==="list"?u.jsx(vF,{packages:i.list,onSuccess:l}):u.jsx(kF,{tree:i.tree,error:a,onSuccess:l}),t[17]=i.list,t[18]=i.tree,t[19]=a,t[20]=l,t[21]=f,t[22]=y):y=t[22],t[23]!==p||t[24]!==b||t[25]!==y?(x=u.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[p,b,y]}),t[23]=p,t[24]=b,t[25]=y,t[26]=x):x=t[26],x},wF=({onSuccess:t,packageManager:e})=>{const[n,o]=Y.useState(""),[r,s]=Y.useState(!1),{handleClick:i}=Ca(),a=$e(TS),l=Qt(TS);Y.useEffect(()=>{a&&(o(a),l(null))},[a,l]);const c=async()=>{try{s(!0);const d=n.split(",").map(h=>h.trim());for(const[h,f]of d.entries()){const m=await OS({package:f});m.success?I3(f):I3(f,m.error),h<d.length-1&&await new Promise(_=>setTimeout(_,1e3))}t()}finally{o(""),s(!1)}};return u.jsxs("div",{className:"flex items-center w-full border-b",children:[u.jsx(MS,{placeholder:`Install packages with ${e}...`,id:B1,icon:r?u.jsx(Kn,{size:"small",className:"mr-2 h-4 w-4 shrink-0 opacity-50"}):u.jsx(Te,{content:"Change package manager",children:u.jsx(si,{onClick:()=>i("packageManagement"),className:"mr-2 h-4 w-4 shrink-0 opacity-50 hover:opacity-80 cursor-pointer"})}),rootClassName:"flex-1 border-none",value:n,onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),c())},onChange:d=>o(d.target.value)}),u.jsx(Te,{delayDuration:300,side:"left",align:"start",content:u.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:",u.jsxs("div",{className:"flex flex-col gap-2 mt-2",children:[u.jsxs("div",{children:[u.jsx("span",{className:"font-bold tracking-wide",children:"Package name:"})," A package name; this will install the latest version.",u.jsx("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),u.jsxs("div",{children:[u.jsx("span",{className:"font-bold tracking-wide",children:"Package and version:"})," ","A package with a specific version or version range.",u.jsx("div",{className:"text-muted-foreground",children:"Examples: httpx==0.27.0, httpx>=0.27.0"})]}),u.jsxs("div",{children:[u.jsx("span",{className:"font-bold tracking-wide",children:"Git:"})," A Git repository",u.jsx("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),u.jsxs("div",{children:[u.jsx("span",{className:"font-bold tracking-wide",children:"URL:"})," A remote wheel or source distribution.",u.jsx("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),u.jsxs("div",{children:[u.jsx("span",{className:"font-bold tracking-wide",children:"Path:"})," A local wheel, source distribution, or project directory.",u.jsx("div",{className:"text-muted-foreground",children:"Example: /example/foo-0.1.0-py3-none-any.whl"})]})]})]}),children:u.jsx(Xm,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),u.jsx("button",{type:"button",className:Ie("float-right px-2 m-0 h-full text-sm text-secondary-foreground ml-2",n&&"bg-accent text-accent-foreground","disabled:cursor-not-allowed disabled:opacity-50"),onClick:c,disabled:!n,children:"Add"})]})},vF=t=>{const e=J.c(9),{onSuccess:n,packages:o}=t;if(o.length===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx(vn,{title:"No packages",description:"No packages are installed in this environment.",icon:u.jsx(si,{})}),e[0]=a):a=e[0],a}let r,s,i;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(rp,{children:u.jsxs(ri,{children:[u.jsx($r,{children:"Name"}),u.jsx($r,{children:"Version"}),u.jsx($r,{})]})}),e[1]=r):r=e[1],e[2]!==n||e[3]!==o){let a;e[5]!==n?(a=l=>u.jsxs(ri,{className:"group",onClick:async()=>{await xn(`${l.name}==${l.version}`),lt({title:"Copied to clipboard"})},children:[u.jsx(Hr,{children:l.name}),u.jsx(Hr,{children:l.version}),u.jsxs(Hr,{className:"flex justify-end",children:[u.jsx(O3,{packageName:l.name,onSuccess:n}),u.jsx(D3,{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=u.jsxs(sp,{className:"overflow-auto flex-1",children:[r,u.jsx(ip,{children:s})]}),e[7]=s,e[8]=i):i=e[8],i},O3=({packageName:t,onSuccess:e})=>{const[n,o]=Y.useState(!1);return In()?null:u.jsx(M3,{onClick:async()=>{try{o(!0);const r=await OS({package:t,upgrade:!0});r.success?(e(),A3(t)):A3(t,r.error)}finally{o(!1)}},loading:n,children:"Upgrade"})},D3=({packageName:t,onSuccess:e})=>{const[n,o]=Y.useState(!1);return u.jsx(M3,{onClick:async()=>{try{o(!0);const r=await $$({package:t});r.success?(e(),T3(t)):T3(t,r.error)}finally{o(!1)}},loading:n,children:"Remove"})},kF=t=>{const e=J.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]=Y.useState(s);let l,c,d;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{a(new Set)},e[1]=l):l=e[1],e[2]!==n?(c=[n],e[2]=n,e[3]=c):c=e[3],Y.useEffect(l,c),o){let _;return e[4]!==o?(_=u.jsx(Vr,{error:o}),e[4]=o,e[5]=_):_=e[5],_}if(!n){let _;return e[6]===Symbol.for("react.memo_cache_sentinel")?(_=u.jsx(Kn,{size:"medium",centered:!0}),e[6]=_):_=e[6],_}if(n.dependencies.length===0){let _;return e[7]===Symbol.for("react.memo_cache_sentinel")?(_=u.jsx(vn,{title:"No dependencies",description:"No package dependencies found in this environment.",icon:u.jsx(si,{})}),e[7]=_):_=e[7],_}e[8]===Symbol.for("react.memo_cache_sentinel")?(d=_=>{a(g=>{const p=new Set(g);return p.has(_)?p.delete(_):p.add(_),p})},e[8]=d):d=e[8];const h=d;let f,m;if(e[9]!==i||e[10]!==r||e[11]!==n.dependencies){let _;e[13]!==i||e[14]!==r?(_=(g,p)=>u.jsx("div",{className:"border-b",children:u.jsx(R3,{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=u.jsx("div",{className:"flex-1 overflow-auto",children:u.jsx("div",{children:f})}),e[16]=f,e[17]=m):m=e[17],m},R3=t=>{const e=J.c(57),{nodeId:n,node:o,level:r,isTopLevel:s,expandedNodes:i,onToggle:a,onSuccess:l}=t,c=s!==void 0&&s,d=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=c?0:16+16*r;let _;e[3]!==d||e[4]!==n||e[5]!==a?(_=V=>{V.key!=="Enter"&&V.key!==" "||(V.preventDefault(),d&&a(n))},e[3]=d,e[4]=n,e[5]=a,e[6]=_):_=e[6];const g=_;let p;e[7]!==d||e[8]!==n||e[9]!==a?(p=V=>{V.stopPropagation(),d&&a(n)},e[7]=d,e[8]=n,e[9]=a,e[10]=p):p=e[10];const b=p,y=d&&"select-none",x=c?"px-2 py-0.5":"";let v,S;e[11]!==y||e[12]!==x?(v=Ie("flex items-center group cursor-pointer text-sm whitespace-nowrap","hover:bg-[var(--slate-2)] focus:bg-[var(--slate-2)] focus:outline-none",y,x),e[11]=y,e[12]=x,e[13]=v):v=e[13],e[14]!==m||e[15]!==c?(S=c?{}:{paddingLeft:`${m}px`},e[14]=m,e[15]=c,e[16]=S):S=e[16];const k=d?f:void 0;let E,N,I,T,M,R,z,D,F,B;return e[17]!==d||e[18]!==f?(E=d?f?u.jsx(Vs,{className:"w-4 h-4 mr-2 flex-shrink-0"}):u.jsx(ia,{className:"w-4 h-4 mr-2 flex-shrink-0"}):u.jsx("div",{className:"w-4 mr-2 flex-shrink-0"}),e[17]=d,e[18]=f,e[19]=E):E=e[19],e[20]!==o.name?(N=u.jsx("span",{className:"font-medium truncate",children:o.name}),e[20]=o.name,e[21]=N):N=e[21],e[22]!==o.version?(I=o.version&&u.jsxs("span",{className:"text-muted-foreground text-xs",children:["v",o.version]}),e[22]=o.version,e[23]=I):I=e[23],e[24]!==N||e[25]!==I?(T=u.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 py-1.5",children:[N,I]}),e[24]=N,e[25]=I,e[26]=T):T=e[26],e[27]!==o.tags?(M=o.tags.map(CF),e[27]=o.tags,e[28]=M):M=e[28],e[29]!==M?(R=u.jsx("div",{className:"flex items-center gap-1 ml-2",children:M}),e[29]=M,e[30]=R):R=e[30],e[31]!==c||e[32]!==o.name||e[33]!==l?(z=c&&u.jsxs("div",{className:"flex gap-1 invisible group-hover:visible",children:[u.jsx(O3,{packageName:o.name,onSuccess:l}),u.jsx(D3,{packageName:o.name,onSuccess:l})]}),e[31]=c,e[32]=o.name,e[33]=l,e[34]=z):z=e[34],e[35]!==b||e[36]!==g||e[37]!==E||e[38]!==T||e[39]!==R||e[40]!==z||e[41]!==v||e[42]!==S||e[43]!==k?(D=u.jsxs("div",{className:v,style:S,onClick:b,onKeyDown:g,tabIndex:0,role:"treeitem","aria-selected":!1,"aria-expanded":k,children:[E,T,R,z]}),e[35]=b,e[36]=g,e[37]=E,e[38]=T,e[39]=R,e[40]=z,e[41]=v,e[42]=S,e[43]=k,e[44]=D):D=e[44],e[45]!==i||e[46]!==d||e[47]!==f||e[48]!==r||e[49]!==o.dependencies||e[50]!==n||e[51]!==l||e[52]!==a?(F=d&&f&&u.jsx("div",{role:"group",children:o.dependencies.map((V,O)=>u.jsx(R3,{nodeId:`${n}-${O}`,node:V,level:r+1,isTopLevel:!1,expandedNodes:i,onToggle:a,onSuccess:l},`${V.name}-${O}`))}),e[45]=i,e[46]=d,e[47]=f,e[48]=r,e[49]=o.dependencies,e[50]=n,e[51]=l,e[52]=a,e[53]=F):F=e[53],e[54]!==D||e[55]!==F?(B=u.jsxs("div",{children:[D,F]}),e[54]=D,e[55]=F,e[56]=B):B=e[56],B};async function SF(){const[t,e]=await Promise.all([U$(),V$()]);return{list:t.packages,tree:e.tree}}function CF(t,e){return t.kind==="cycle"?u.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"?u.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"?u.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 im=Z3("marimo:scratchpadHistory:v1",[]),NF=en(!1),jF=en(null,(t,e,n)=>{if(!(n=n.trim()))return;const o=t(im),r=[n,...o.filter(s=>s!==n)].slice(0,15);e(im,r)}),EF={hide_code:!1,disabled:!1},IF=()=>{const t=J.c(69),e=Tc(),[n]=$s(),{theme:o}=zo(),r=A.useRef(null),s=Br(),{createNewCell:i,updateCellCode:a}=Ot(),l=e.cellRuntime[_r],c=l==null?void 0:l.output,d=l==null?void 0:l.status,h=l==null?void 0:l.consoleOutputs,f=e.cellData[_r],m=(f==null?void 0:f.code)??"",_=Qt(jF),[g,p]=an(NF),b=$e(im);let y;t[0]!==_||t[1]!==m?(y=()=>{DS({code:m}),_(m)},t[0]=_,t[1]=m,t[2]=y):y=t[2];const x=et(y);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 S=et(v);let k;t[7]!==a?(k=()=>{a({cellId:_r,code:"",formattingChange:!1}),DS({code:""});const se=r.current;se&&se.dispatch({changes:{from:0,to:se.state.doc.length,insert:""}})},t[7]=a,t[8]=k):k=t[8];const E=et(k);let N;t[9]!==p||t[10]!==a?(N=se=>{p(!1),a({cellId:_r,code:se,formattingChange:!1});const Ae=r.current;Ae&&Ae.dispatch({changes:{from:0,to:Ae.state.doc.length,insert:se}})},t[9]=p,t[10]=a,t[11]=N):N=t[11];const I=et(N),[T,M]=A.useState();let R;t[12]!==m||t[13]!==h||t[14]!==x||t[15]!==T||t[16]!==c||t[17]!==o||t[18]!==n?(R=()=>u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[40%]",children:u.jsx(eh,{theme:o,showPlaceholder:!1,id:_r,code:m,config:EF,status:"idle",serializedEditorState:null,runCell:x,userConfig:n,editorViewRef:r,setEditorView:se=>{r.current=se},hidden:!1,temporarilyShowCode:An.NOOP,languageAdapter:T,setLanguageAdapter:M})}),u.jsx("div",{className:"flex-1 overflow-auto flex-shrink-0",children:u.jsx(qc,{allowExpand:!1,output:c,className:"output-area",cellId:_r,stale:!1,loading:!1})}),u.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[35%]",children:u.jsx(hp,{consoleOutputs:h,className:"overflow-auto",stale:!1,cellName:Q3,onSubmitDebugger:An.NOOP,cellId:_r,debuggerActive:!1})})]}),t[12]=m,t[13]=h,t[14]=x,t[15]=T,t[16]=c,t[17]=o,t[18]=n,t[19]=R):R=t[19];const z=R;let D;t[20]!==I||t[21]!==b||t[22]!==g||t[23]!==o?(D=()=>g?u.jsx("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:u.jsx("div",{className:"overflow-auto flex flex-col gap-3",children:b.map((se,Ae)=>u.jsx("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>I(se),children:u.jsx(A.Suspense,{children:u.jsx(ka,{language:"python",theme:o,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:se.trim(),editable:!1,readOnly:!0})})},Ae))})}):null,t[20]=I,t[21]=b,t[22]=g,t[23]=o,t[24]=D):D=t[24];const F=D;let B,V,O,C,$,j,W,K,Z,q,ne;t[25]===Symbol.for("react.memo_cache_sentinel")?(B=zs.create(_r),V=u.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]=V):(B=t[25],V=t[26]),t[27]===Symbol.for("react.memo_cache_sentinel")?(O=pn("cell.run"),t[27]=O):O=t[27],t[28]===Symbol.for("react.memo_cache_sentinel")?(C=u.jsx(ii,{color:"var(--grass-11)",size:16}),t[28]=C):C=t[28],t[29]!==x||t[30]!==g?($=u.jsx(Te,{content:O,children:u.jsx(Me,{"data-testid":"scratchpad-run-button",onClick:x,disabled:g,variant:"text",size:"xs",children:C})}),t[29]=x,t[30]=g,t[31]=$):$=t[31],t[32]===Symbol.for("react.memo_cache_sentinel")?(j=u.jsx(Np,{size:16}),t[32]=j):j=t[32],t[33]!==E||t[34]!==g?(W=u.jsx(Te,{content:"Clear code and outputs",children:u.jsx(Me,{disabled:g,size:"xs",variant:"text",onClick:E,children:j})}),t[33]=E,t[34]=g,t[35]=W):W=t[35],t[36]===Symbol.for("react.memo_cache_sentinel")?(K=u.jsx(Wr,{size:16}),t[36]=K):K=t[36],t[37]!==S||t[38]!==g?(Z=u.jsx(di,{children:u.jsx(Te,{content:"Insert code",children:u.jsx(Me,{disabled:g,size:"xs",variant:"text",onClick:S,children:K})})}),t[37]=S,t[38]=g,t[39]=Z):Z=t[39],t[40]!==d?(q=(d==="running"||d==="queued")&&u.jsx(Kn,{className:"inline",size:"small"}),t[40]=d,t[41]=q):q=t[41],t[42]===Symbol.for("react.memo_cache_sentinel")?(ne=u.jsx("div",{className:"flex-1"}),t[42]=ne):ne=t[42];const re=g&&"bg-[var(--sky-3)] rounded-none";let ae,X;t[43]!==re?(ae=Ie(re),t[43]=re,t[44]=ae):ae=t[44],t[45]!==g||t[46]!==p?(X=()=>p(!g),t[45]=g,t[46]=p,t[47]=X):X=t[47];const ee=b.length===0;let ce,me,ue,pe,de,Ne,je;return t[48]===Symbol.for("react.memo_cache_sentinel")?(ce=u.jsx(Op,{size:16}),t[48]=ce):ce=t[48],t[49]!==ae||t[50]!==X||t[51]!==ee?(me=u.jsx(Te,{content:"Toggle history",children:u.jsx(Me,{size:"xs",variant:"text",className:ae,onClick:X,disabled:ee,children:ce})}),t[49]=ae,t[50]=X,t[51]=ee,t[52]=me):me=t[52],t[53]!==$||t[54]!==W||t[55]!==Z||t[56]!==q||t[57]!==me?(ue=u.jsxs("div",{className:"flex items-center flex-shrink-0",children:[$,W,Z,q,ne,me]}),t[53]=$,t[54]=W,t[55]=Z,t[56]=q,t[57]=me,t[58]=ue):ue=t[58],t[59]!==z?(pe=z(),t[59]=z,t[60]=pe):pe=t[60],t[61]!==F?(de=F(),t[61]=F,t[62]=de):de=t[62],t[63]!==pe||t[64]!==de?(Ne=u.jsxs("div",{className:"flex-1 divide-y relative overflow-hidden flex flex-col",children:[pe,de]}),t[63]=pe,t[64]=de,t[65]=Ne):Ne=t[65],t[66]!==ue||t[67]!==Ne?(je=u.jsxs("div",{className:"flex flex-col h-full overflow-hidden divide-y",id:B,children:[V,ue,Ne]}),t[66]=ue,t[67]=Ne,t[68]=je):je=t[68],je},AF=()=>{const t=J.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx(IF,{}),t[0]=e):e=t[0],e},TF=()=>{const t=J.c(23),{openModal:e,closeModal:n}=qn();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}=Gn(OF,o);if(s){let b;return t[1]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(Kn,{size:"medium",centered:!0}),t[1]=b):b=t[1],b}if(i){let b;return t[2]!==i?(b=u.jsx(Vr,{error:i}),t[2]=i,t[3]=b):b=t[3],b}let l;t[4]!==r?(l=r.filter(DF).map(RF),t[4]=r,t[5]=l):l=t[5];const c=l;if(r.length===0){let b;return t[6]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(vn,{title:"No environment variables",description:"No environment variables are available in this notebook.",icon:u.jsx(ad,{})}),t[6]=b):b=t[6],b}let d,h,f,m,_,g,p;return t[7]!==n||t[8]!==e||t[9]!==c||t[10]!==a?(d=()=>e(u.jsx(Dg,{providerNames:c,onSuccess:()=>{a(),n()},onClose:n})),t[7]=n,t[8]=e,t[9]=c,t[10]=a,t[11]=d):d=t[11],t[12]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(pr,{className:"h-4 w-4"}),t[12]=h):h=t[12],t[13]!==d?(f=u.jsx("div",{className:"flex justify-end h-8 border-b",children:u.jsx("button",{type:"button",className:"float-right border-l px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:d,children:h})}),t[13]=d,t[14]=f):f=t[14],t[15]===Symbol.for("react.memo_cache_sentinel")?(m=u.jsx(rp,{children:u.jsxs(ri,{children:[u.jsx($r,{children:"Environment Variable"}),u.jsx($r,{children:"Source"}),u.jsx($r,{})]})}),t[15]=m):m=t[15],t[16]!==r?(_=r.map(PF),t[16]=r,t[17]=_):_=t[17],t[18]!==_?(g=u.jsxs(sp,{className:"overflow-auto flex-1 mb-16",children:[m,u.jsx(ip,{children:_})]}),t[18]=_,t[19]=g):g=t[19],t[20]!==f||t[21]!==g?(p=u.jsxs("div",{className:"flex flex-col h-full",children:[f,g]}),t[20]=f,t[21]=g,t[22]=p):p=t[22],p},MF=t=>{const e=J.c(9),{className:n,ariaLabel:o,onCopy:r}=t,[s,i]=Y.useState(!1);let a;e[0]!==r?(a=()=>{r(),i(!0),setTimeout(()=>i(!1),1e3)},e[0]=r,e[1]=a):a=e[1];const l=a;let c,d;return e[2]!==s?(c=s?u.jsx(Nc,{className:"w-3 h-3 text-green-700 rounded"}):u.jsx(ra,{className:"w-3 h-3 hover:bg-muted rounded"}),e[2]=s,e[3]=c):c=e[3],e[4]!==o||e[5]!==n||e[6]!==l||e[7]!==c?(d=u.jsx("button",{type:"button",className:n,onClick:l,"aria-label":o,children:c}),e[4]=o,e[5]=n,e[6]=l,e[7]=c,e[8]=d):d=e[8],d};async function OF(){return Og((await qS.request({})).secrets)}function DF(t){return t.provider!=="env"}function RF(t){return t.name}function PF(t){return t.keys.map(e=>u.jsxs(ri,{className:"group",children:[u.jsx(Hr,{children:e}),u.jsx(Hr,{children:t.provider!=="env"&&u.jsx(_S,{variant:"outline",className:"select-none",children:t.name})}),u.jsx(Hr,{children:u.jsx(MF,{ariaLabel:`Copy ${e}`,onCopy:async()=>{await xn(`os.environ["${e}"]`),lt({title:"Copied to clipboard",description:`os.environ["${e}"] has been copied to your clipboard.`})},className:Ie("float-right px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible")})})]},`${t.name}-${e}`))}const LF=t=>{const e=J.c(6),{children:n}=t,{openModal:o,closeModal:r}=qn();let s,i;return e[0]!==r||e[1]!==o?(s=()=>o(u.jsx(zF,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(i=u.jsx(fS,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=i):i=e[5],i},FF=[st.lineWrapping],zF=t=>{const e=J.c(23),{onClose:n}=t,[o,r]=A.useState(""),{theme:s}=zo();let i,a,l,c,d,h;e[0]!==n?(i=async x=>{x.preventDefault();const v=new FormData(x.target),S=v.get("title"),k=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:S,description:k,code:E})}),n(),lt({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=u.jsx(ar,{children:"Contribute a Snippet"}),e[2]=a):a=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsxs(Ls,{children:[a,u.jsxs(Fs,{children:["Have a useful snippet you want to share with the community? Submit it here or make a pull request"," ",u.jsx("a",{href:no.githubPage,target:"_blank",className:"underline",children:"on GitHub"}),"."]})]}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(lr,{id:"title",name:"title",autoFocus:!0,placeholder:"Title",required:!0,autoComplete:"off"}),d=u.jsx(H$,{id:"description",name:"description",autoFocus:!0,placeholder:"Description",rows:5,required:!0,autoComplete:"off"}),e[4]=c,e[5]=d):(c=e[4],d=e[5]),e[6]!==o?(h=u.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,y;return e[8]!==o||e[9]!==f?(m=u.jsx(ka,{theme:f,language:"python",className:"cm border rounded overflow-hidden",extensions:FF,value:o,onChange:r}),e[8]=o,e[9]=f,e[10]=m):m=e[10],e[11]!==h||e[12]!==m?(_=u.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[c,d,h,m]}),e[11]=h,e[12]=m,e[13]=_):_=e[13],e[14]!==n?(g=u.jsx(Me,{"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=u.jsx(Me,{"data-testid":"snippet-send-button","aria-label":"Save",variant:"default",type:"submit",children:"Send"}),e[16]=p):p=e[16],e[17]!==g?(b=u.jsxs(oa,{children:[g,p]}),e[17]=g,e[18]=b):b=e[18],e[19]!==i||e[20]!==b||e[21]!==_?(y=u.jsx(cr,{className:"w-fit",children:u.jsxs("form",{onSubmit:i,children:[l,_,b]})}),e[19]=i,e[20]=b,e[21]=_,e[22]=y):y=e[22],y},BF=[st.lineWrapping],UF=()=>{const t=J.c(20),[e,n]=Y.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}=Gn(HF,o);if(s){let b;return t[1]!==s?(b=u.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=u.jsx(Kn,{size:"medium",centered:!0}),t[3]=b):b=t[3],b}const a=e?"h-1/3":"h-full";let l,c,d,h,f,m,_,g,p;return t[4]!==a?(l=Ie("border-b rounded-none",a),t[4]=a,t[5]=l):l=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(aa,{placeholder:"Search snippets...",className:"h-6 m-1",rootClassName:"flex-1 border-r"}),t[6]=c):c=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsxs("div",{className:"flex items-center w-full",children:[c,u.jsx(LF,{children:u.jsx("button",{className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:u.jsx(pr,{className:"h-4 w-4"})})})]}),h=u.jsx(_c,{children:"No results"}),t[7]=d,t[8]=h):(d=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=u.jsx($F,{onSelect:f,snippets:r.snippets}),t[10]=r.snippets,t[11]=m):m=t[11],t[12]!==l||t[13]!==m?(_=u.jsxs(Ic,{className:l,children:[d,h,m]}),t[12]=l,t[13]=m,t[14]=_):_=t[14],t[15]!==e?(g=u.jsx(A.Suspense,{children:u.jsx("div",{className:"h-2/3 snippet-viewer flex flex-col",children:e?u.jsx(VF,{snippet:e},e.title):u.jsx(vn,{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=u.jsxs("div",{className:"flex-1 overflow-hidden",children:[_,g]}),t[17]=_,t[18]=g,t[19]=p):p=t[19],p},VF=t=>{const e=J.c(27),{snippet:n}=t,{theme:o}=zo(),{createNewCell:r}=Ot(),s=Br();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 c=l;let d,h,f,m,_,g;if(e[7]!==n.title?(d=u.jsx("div",{className:"text-sm font-semibold bg-muted border-y px-2 py-1",children:n.title}),e[7]=n.title,e[8]=d):d=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(Wr,{className:"ml-2 h-4 w-4"}),e[9]=h):h=e[9],e[10]!==a?(f=u.jsx("div",{className:"flex justify-end",children:u.jsx(di,{children:u.jsxs(Me,{className:"float-right",size:"xs",variant:"outline",onClick:a,children:["Insert snippet",h]})})}),e[10]=a,e[11]=f):f=e[11],e[12]!==c||e[13]!==n.sections||e[14]!==n.title||e[15]!==o){let p;e[17]!==c||e[18]!==n.title||e[19]!==o?(p=b=>{const{code:y,html:x,id:v}=b;return x?u.jsx("div",{children:ep({html:x})},`${n.title}-${v}`):y?u.jsxs("div",{className:"relative hover-actions-parent pr-2",children:[u.jsx(di,{children:u.jsx(Te,{content:"Insert snippet",children:u.jsx(Me,{className:"absolute -top-2 -right-1 z-10 hover-action px-2 bg-background",size:"sm",variant:"outline",onClick:()=>{c(y)},children:u.jsx(Wr,{className:"h-5 w-5"})})})}),u.jsx(A.Suspense,{children:u.jsx(ka,{theme:o==="dark"?"dark":"light",language:"python",className:"cm border rounded overflow-hidden",extensions:BF,value:y,readOnly:!0},`${n.title}-${v}`)})]},`${n.title}-${v}`):null},e[17]=c,e[18]=n.title,e[19]=o,e[20]=p):p=e[20],m=n.sections.map(p),e[12]=c,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?(_=u.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]!==d||e[25]!==_?(g=u.jsxs(u.Fragment,{children:[d,_]}),e[24]=d,e[25]=_,e[26]=g):g=e[26],g},$F=t=>{const e=J.c(7),{snippets:n,onSelect:o}=t;let r,s;if(e[0]!==o||e[1]!==n){let i;e[3]!==o?(i=a=>u.jsx(go,{className:"rounded-none",onSelect:()=>o(a),children:u.jsx("div",{className:"flex flex-row gap-2 items-center",children:u.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=u.jsx(Vm,{className:"flex flex-col overflow-auto",children:r}),e[5]=r,e[6]=s):s=e[6],s};function HF(){return W$()}const WF=Y.lazy(()=>$m(()=>import("./tracing-c8X_pryg.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]),import.meta.url).then(t=>({default:t.Tracing}))),qF=()=>{const t=J.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx(Y.Suspense,{fallback:u.jsx(GF,{}),children:u.jsx(WF,{})}),t[0]=e):e=t[0],e},GF=()=>{const t=J.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:u.jsx(Kn,{})}),t[0]=e):e=t[0],e},P3="name",L3="type-value",am="defs-refs",YF=[{id:P3,accessorFn:t=>[t.name,t.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>u.jsx(ap,{header:"Name",column:t}),cell:({getValue:t})=>{const[e,n]=t();return u.jsx(yf,{name:e,declaredBy:n})}},{id:L3,accessorFn:t=>[t.dataType,t.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>u.jsx(ap,{header:u.jsxs("div",{className:"flex flex-col gap-1",children:[u.jsx("span",{children:"Type"}),u.jsx("span",{children:"Value"})]}),column:t}),cell:({getValue:t})=>{const[e,n]=t();return u.jsxs("div",{className:"max-w-[150px]",children:[u.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs",children:e}),u.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap",title:n??"",children:n})]})}},{id:am,accessorFn:t=>[t.declaredBy,t.usedBy,t.name,t.declaredByNames,t.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:t})=>u.jsx(ap,{header:u.jsxs("div",{className:"flex flex-col gap-1",children:[u.jsx("span",{children:"Declared By"}),u.jsx("span",{children:"Used By"})]}),column:t}),cell:({getValue:t})=>{const[e,n,o]=t(),r=s=>{const i=hc(s);i&&tp(i,o)};return u.jsxs("div",{className:"flex flex-col gap-1 py-1",children:[u.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-center",children:[u.jsx("span",{title:"Declared by",children:u.jsx(Qp,{className:"w-3.5 h-3.5 text-muted-foreground"})}),e.length===1?u.jsx(gr,{variant:"focus",cellId:e[0],skipScroll:!0,onClick:()=>r(e[0])}):u.jsx("div",{className:"text-destructive flex flex-row gap-2",children:e.slice(0,3).map((s,i)=>u.jsxs("span",{className:"flex",children:[u.jsx(gr,{variant:"focus",cellId:s,skipScroll:!0,className:"whitespace-nowrap text-destructive",onClick:()=>r(s)},s),i<e.length-1&&", "]},s))})]}),u.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-baseline",children:[u.jsx("span",{title:"Used by",children:u.jsx(Oa,{className:"w-3.5 h-3.5 text-muted-foreground"})}),u.jsx(ok,{maxCount:3,cellIds:n,skipScroll:!0,onClick:r})]})]})}}],F3=A.memo(({className:t,cellIds:e,variables:n})=>{const[o,r]=Y.useState([]),[s,i]=Y.useState(""),a=q$(),l=A.useMemo(()=>{const h=f=>{const m=a[f];return X$(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]),c=A.useMemo(()=>{const h=new Map;return e.forEach((f,m)=>h.set(f,m)),function(f,m,_){m||(m={id:am,desc:!1});let g=[];switch(m.id){case P3:g=Na(f,p=>p.name);break;case L3:g=Na(f,p=>p.dataType);break;case am:g=Na(f,p=>_.get(p.declaredBy[0]))}return m.desc?g.reverse():g}(l,o[0],h)},[l,o,e]),d=G$({data:c,columns:YF,getCoreRowModel:K$(),onGlobalFilterChange:i,getFilteredRowModel:J$(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter:h=>h.columnDef.enableGlobalFilter??!0,globalFilterFn:"auto",manualSorting:!0,onSortingChange:r,getSortedRowModel:Y$(),state:{sorting:o,globalFilter:s}});return u.jsxs(u.Fragment,{children:[u.jsx(MS,{className:"w-full",placeholder:"Search",value:s,onChange:h=>i(h.target.value)}),u.jsxs(sp,{className:Ie("w-full text-sm flex-1 border-separate border-spacing-0",t),children:[u.jsx(rp,{children:u.jsx(ri,{className:"whitespace-nowrap text-xs",children:d.getFlatHeaders().map(h=>u.jsx($r,{className:"sticky top-0 bg-background border-b",children:RS(h.column.columnDef.header,h.getContext())},h.id))})}),u.jsx(ip,{children:d.getRowModel().rows.map(h=>u.jsx(ri,{className:"hover:bg-accent",children:h.getVisibleCells().map(f=>u.jsx(Hr,{className:"border-b",children:RS(f.column.columnDef.cell,f.getContext())},f.id))},h.id))})]})]})});F3.displayName="VariableTable";const JF=()=>{const t=J.c(4),e=yS(),n=Kc();if(Object.keys(e).length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(vn,{title:"No variables",description:"Global variables will appear here.",icon:u.jsx(dc,{})}),t[0]=r):r=t[0],r}let o;return t[1]!==n.inOrderIds||t[2]!==e?(o=u.jsx(F3,{className:"flex-1",cellIds:n.inOrderIds,variables:e}),t[1]=n.inOrderIds,t[2]=e,t[3]=o):o=t[3],o},KF=Y.lazy(()=>$m(()=>import("./terminal-neRs7iG8.js"),__vite__mapDeps([113,1,2,114]),import.meta.url)),XF=t=>{const e=J.c(121),{children:n}=t,{isSidebarOpen:o,isTerminalOpen:r,selectedPanel:s}=Cc(),{setIsSidebarOpen:i,setIsTerminalOpen:a}=da(),l=Y.useRef(null),c=Y.useRef(null);let d,h,f,m,_;e[0]!==o?(d=()=>{if(!l.current)return;const le=l.current.isCollapsed();o&&le&&l.current.expand(),o||le||l.current.collapse(),requestAnimationFrame(QF)},h=[o],e[0]=o,e[1]=d,e[2]=h):(d=e[1],h=e[2]),A.useEffect(d,h),e[3]!==r?(f=()=>{if(!c.current)return;const le=c.current.isCollapsed();r&&le&&c.current.expand(),r||le||c.current.collapse(),requestAnimationFrame(tz)},m=[r],e[3]=r,e[4]=f,e[5]=m):(f=e[4],m=e[5]),A.useEffect(f,m),e[6]!==n?(_=u.jsx(Zc,{id:"app",className:"relative h-full",children:u.jsx(A.Suspense,{children:n})},"app"),e[6]=n,e[7]=_):_=e[7];const g=_,p=o?"resize-handle":"resize-handle-collapsed";let b,y;e[8]!==p?(b=Ie("border-border no-print z-10",p,"vertical"),e[8]=p,e[9]=b):b=e[9],e[10]!==b?(y=u.jsx(PS,{onDragging:LS,className:b}),e[10]=b,e[11]=y):y=e[11];const x=y,v=r?"resize-handle":"resize-handle-collapsed";let S,k;e[12]!==v?(S=Ie("border-border no-print z-20",v,"horizontal"),e[12]=v,e[13]=S):S=e[13],e[14]!==S?(k=u.jsx(PS,{onDragging:LS,className:S}),e[14]=S,e[15]=k):k=e[15];const E=k;let N,I,T,M,R,z,D,F,B,V,O,C,$,j,W,K,Z,q,ne,re,ae;e[16]!==s?(N=u.jsx("div",{className:"text-sm text-[var(--slate-11)] uppercase tracking-wide font-semibold flex-1",children:s}),e[16]=s,e[17]=N):N=e[17],e[18]!==i?(I=()=>i(!1),e[18]=i,e[19]=I):I=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(T=u.jsx(oo,{className:"w-4 h-4"}),e[20]=T):T=e[20],e[21]!==I?(M=u.jsx(Me,{"data-testid":"close-helper-pane",className:"m-0",size:"xs",variant:"text",onClick:I,children:T}),e[21]=I,e[22]=M):M=e[22],e[23]!==N||e[24]!==M?(R=u.jsxs("div",{className:"p-3 border-b flex justify-between items-center",children:[N,M]}),e[23]=N,e[24]=M,e[25]=R):R=e[25],e[26]!==s?(z=s==="files"&&u.jsx(N3,{}),e[26]=s,e[27]=z):z=e[27],e[28]!==s?(D=s==="errors"&&u.jsx(YL,{}),e[28]=s,e[29]=D):D=e[29],e[30]!==s?(F=s==="variables"&&u.jsx(JF,{}),e[30]=s,e[31]=F):F=e[31],e[32]!==s?(B=s==="dependencies"&&u.jsx(OL,{}),e[32]=s,e[33]=B):B=e[33],e[34]!==s?(V=s==="packages"&&u.jsx(xF,{}),e[34]=s,e[35]=V):V=e[35],e[36]!==s?(O=s==="outline"&&u.jsx(yF,{}),e[36]=s,e[37]=O):O=e[37],e[38]!==s?(C=s==="datasources"&&u.jsx(qL,{}),e[38]=s,e[39]=C):C=e[39],e[40]!==s?($=s==="documentation"&&u.jsx(GL,{}),e[40]=s,e[41]=$):$=e[41],e[42]!==s?(j=s==="snippets"&&u.jsx(UF,{}),e[42]=s,e[43]=j):j=e[43],e[44]!==s?(W=s==="scratchpad"&&u.jsx(AF,{}),e[44]=s,e[45]=W):W=e[45],e[46]!==s?(K=s==="chat"&&u.jsx(nR,{}),e[46]=s,e[47]=K):K=e[47],e[48]!==s?(Z=s==="logs"&&u.jsx(j3,{}),e[48]=s,e[49]=Z):Z=e[49],e[50]!==s?(q=s==="tracing"&&u.jsx(qF,{}),e[50]=s,e[51]=q):q=e[51],e[52]!==s?(ne=s==="secrets"&&u.jsx(TF,{}),e[52]=s,e[53]=ne):ne=e[53],e[54]!==z||e[55]!==D||e[56]!==F||e[57]!==B||e[58]!==V||e[59]!==O||e[60]!==C||e[61]!==$||e[62]!==j||e[63]!==W||e[64]!==K||e[65]!==Z||e[66]!==q||e[67]!==ne?(re=u.jsx(A.Suspense,{children:u.jsxs(Yc,{children:[z,D,F,B,V,O,C,$,j,W,K,Z,q,ne]})}),e[54]=z,e[55]=D,e[56]=F,e[57]=B,e[58]=V,e[59]=O,e[60]=C,e[61]=$,e[62]=j,e[63]=W,e[64]=K,e[65]=Z,e[66]=q,e[67]=ne,e[68]=re):re=e[68],e[69]!==R||e[70]!==re?(ae=u.jsx(Ac,{children:u.jsxs("div",{className:"flex flex-col h-full flex-1 overflow-hidden mr-[-4px]",children:[R,re]})}),e[69]=R,e[70]=re,e[71]=ae):ae=e[71];const X=ae,ee=o&&"border-r border-l border-[var(--slate-7)]";let ce,me,ue,pe,de,Ne;e[72]!==ee?(ce=Ie("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",ee),e[72]=ee,e[73]=ce):ce=e[73],e[74]===Symbol.for("react.memo_cache_sentinel")?(me=(le,Ve)=>{var Fe;Ve===0&&le===10&&((Fe=l.current)==null||Fe.resize(30))},e[74]=me):me=e[74],e[75]!==i?(ue=()=>i(!1),pe=()=>i(!0),e[75]=i,e[76]=ue,e[77]=pe):(ue=e[76],pe=e[77]),e[78]!==X||e[79]!==x?(de=u.jsxs("span",{className:"flex flex-row h-full",children:[X," ",x]}),e[78]=X,e[79]=x,e[80]=de):de=e[80],e[81]!==ce||e[82]!==ue||e[83]!==pe||e[84]!==de?(Ne=u.jsx(Zc,{ref:l,id:"helper",collapsedSize:0,collapsible:!0,className:ce,minSize:10,defaultSize:0,maxSize:75,onResize:me,onCollapse:ue,onExpand:pe,children:de},"helper"),e[81]=ce,e[82]=ue,e[83]=pe,e[84]=de,e[85]=Ne):Ne=e[85];const je=Ne,se=r&&"border-[var(--slate-7)]";let Ae,be,Re,ze,qe,Qe,Pe,tt,Je;e[86]!==se?(Ae=Ie("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",se),e[86]=se,e[87]=Ae):Ae=e[87],e[88]===Symbol.for("react.memo_cache_sentinel")?(be=(le,Ve)=>{var Fe;Ve===0&&le===10&&((Fe=c.current)==null||Fe.resize(30))},e[88]=be):be=e[88],e[89]!==a?(Re=()=>a(!1),ze=()=>a(!0),e[89]=a,e[90]=Re,e[91]=ze):(Re=e[90],ze=e[91]),e[92]===Symbol.for("react.memo_cache_sentinel")?(qe=u.jsx("div",{}),e[92]=qe):qe=e[92],e[93]!==a?(Qe=()=>a(!1),e[93]=a,e[94]=Qe):Qe=e[94],e[95]!==r||e[96]!==Qe?(Pe=u.jsx(A.Suspense,{fallback:qe,children:u.jsx(KF,{visible:r,onClose:Qe})}),e[95]=r,e[96]=Qe,e[97]=Pe):Pe=e[97],e[98]!==r||e[99]!==Pe?(tt=u.jsx(DL,{isOpen:r,children:Pe}),e[98]=r,e[99]=Pe,e[100]=tt):tt=e[100],e[101]!==Ae||e[102]!==Re||e[103]!==ze||e[104]!==tt||e[105]!==E?(Je=u.jsxs(Zc,{ref:c,id:"terminal",collapsedSize:0,collapsible:!0,className:Ae,minSize:10,defaultSize:0,maxSize:75,onResize:be,onCollapse:Re,onExpand:ze,children:[E,tt]},"terminal"),e[101]=Ae,e[102]=Re,e[103]=ze,e[104]=tt,e[105]=E,e[106]=Je):Je=e[106];const nt=Je;let te,we,ke,Le,G,ge,_e,fe;return e[107]===Symbol.for("react.memo_cache_sentinel")?(te=VH(),e[107]=te):te=e[107],e[108]===Symbol.for("react.memo_cache_sentinel")?(we=u.jsx(Yc,{children:u.jsx(FO,{})}),e[108]=we):we=e[108],e[109]!==nt?(ke=u.jsx(Kx,{capability:"terminal",children:nt}),e[109]=nt,e[110]=ke):ke=e[110],e[111]!==g||e[112]!==ke?(Le=u.jsx(Zc,{children:u.jsxs(FS,{autoSaveId:"marimo:chrome:v1:l1",direction:"vertical",children:[g,ke]})}),e[111]=g,e[112]=ke,e[113]=Le):Le=e[113],e[114]===Symbol.for("react.memo_cache_sentinel")?(G=u.jsx(Z$,{}),e[114]=G):G=e[114],e[115]!==je||e[116]!==Le?(ge=u.jsxs(FS,{autoSaveId:"marimo:chrome:v1:l2",direction:"horizontal",storage:te,children:[we,je,Le,G]}),e[115]=je,e[116]=Le,e[117]=ge):ge=e[117],e[118]===Symbol.for("react.memo_cache_sentinel")?(_e=u.jsx(Ac,{children:u.jsx(Yc,{children:u.jsx(OO,{})})}),e[118]=_e):_e=e[118],e[119]!==ge?(fe=u.jsxs($H,{children:[ge,_e]}),e[119]=ge,e[120]=fe):fe=e[120],fe};function ZF(){window.dispatchEvent(new Event("resize"))}function QF(){requestAnimationFrame(ZF)}function ez(){window.dispatchEvent(new Event("resize"))}function tz(){requestAnimationFrame(ez)}let z3;z3=new URL(window.location.href).searchParams.get(Q$.showChrome)==="false",tC=Object.freeze(Object.defineProperty({__proto__:null,default:t=>{const e=J.c(10);if(z3){let s,i,a;return e[0]!==t?(s=u.jsx(Jx,{hideControls:!0,...t}),e[0]=t,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx(fg,{}),e[2]=i):i=e[2],e[3]!==s?(a=u.jsxs(u.Fragment,{children:[s,i]}),e[3]=s,e[4]=a):a=e[4],a}let n,o,r;return e[5]!==t?(n=u.jsx(Jx,{...t}),e[5]=t,e[6]=n):n=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(fg,{}),e[7]=o):o=e[7],e[8]!==n?(r=u.jsxs(XF,{children:[n,o]}),e[8]=n,e[9]=r):r=e[9],r}},Symbol.toStringTag,{value:"Module"}))});export{pp as C,ed as E,vn as P,qH as __tla,td as a,tC as e,ja as f,gp as u};