@marimo-team/frontend 0.13.16-dev21 → 0.13.16-dev22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/dist/assets/{ConnectedDataExplorerComponent-DF-BS8Ai.js → ConnectedDataExplorerComponent-CFgQqcNv.js} +1 -1
  2. package/dist/assets/{ImageComparisonComponent-CZYSKG7h.js → ImageComparisonComponent-CH_5G0oz.js} +1 -1
  3. package/dist/assets/{VegaLite-DBBhIN2L.js → VegaLite-BAljsV-w.js} +1 -1
  4. package/dist/assets/{_baseEach-dfmzVuHt.js → _baseEach-DQbdifxU.js} +1 -1
  5. package/dist/assets/_baseMap-BX7qrs4I.js +1 -0
  6. package/dist/assets/{_baseUniq-B-SEnlQj.js → _baseUniq-CIAGDW_d.js} +1 -1
  7. package/dist/assets/{_createAggregator-RZ8gTTcD.js → _createAggregator-DQdAlkKm.js} +1 -1
  8. package/dist/assets/{any-language-editor-DFQo3p8B.js → any-language-editor-k9AWorJD.js} +1 -1
  9. package/dist/assets/{architectureDiagram-IEHRJDOE-Bwm38u4S.js → architectureDiagram-IEHRJDOE-Iw-gylNc.js} +1 -1
  10. package/dist/assets/{blockDiagram-JOT3LUYC-Dd0mTg8H.js → blockDiagram-JOT3LUYC-A0ZhuRr8.js} +1 -1
  11. package/dist/assets/{c4Diagram-VJAJSXHY-JFmbsAgM.js → c4Diagram-VJAJSXHY-D_j9UOSc.js} +1 -1
  12. package/dist/assets/channel-CfWo1q5U.js +1 -0
  13. package/dist/assets/{chunk-4BMEZGHF-UhrQFofR.js → chunk-4BMEZGHF-ClvSMXI1.js} +1 -1
  14. package/dist/assets/{chunk-A2AXSNBT-BciujRFN.js → chunk-A2AXSNBT-CZC3ktbT.js} +1 -1
  15. package/dist/assets/{chunk-AEK57VVT-DFOCjMhw.js → chunk-AEK57VVT-BwJcOmTl.js} +1 -1
  16. package/dist/assets/{chunk-D6G4REZN-B-huYkaE.js → chunk-D6G4REZN-CNjcOLAG.js} +1 -1
  17. package/dist/assets/{chunk-RZ5BOZE2-C-aqkU0G.js → chunk-RZ5BOZE2-BVlXfBZF.js} +1 -1
  18. package/dist/assets/{chunk-XZIHB7SX-BFkouixF.js → chunk-XZIHB7SX-CZsIi6Ub.js} +1 -1
  19. package/dist/assets/{circle-play-BNnnR2ce.js → circle-play-BIeWiATr.js} +1 -1
  20. package/dist/assets/classDiagram-GIVACNV2-5wPYQrrF.js +1 -0
  21. package/dist/assets/classDiagram-v2-COTLJTTW-5wPYQrrF.js +1 -0
  22. package/dist/assets/clone-DjDcYCHN.js +1 -0
  23. package/dist/assets/{compile-BQoR_Ppi.js → compile-CmR4tKA4.js} +1 -1
  24. package/dist/assets/{dagre-OKDRZEBW-ClN4LhU6.js → dagre-OKDRZEBW-CYgV7oD3.js} +1 -1
  25. package/dist/assets/{data-editor-JpMTpW4Q.js → data-editor-Bm5M-HC4.js} +1 -1
  26. package/dist/assets/{diagram-SSKATNLV-BjGAlvNr.js → diagram-SSKATNLV-D1yCd1W3.js} +1 -1
  27. package/dist/assets/{diagram-VNBRO52H-CUQN0XH3.js → diagram-VNBRO52H-B7zgRMW2.js} +1 -1
  28. package/dist/assets/{edit-page-Da-4RfOn.js → edit-page-BsL38zs7.js} +26 -26
  29. package/dist/assets/{erDiagram-Q7BY3M3F-DaOD_OUU.js → erDiagram-Q7BY3M3F-CtEoZnpZ.js} +1 -1
  30. package/dist/assets/{flowDiagram-4HSFHLVR-OjU8Hhxu.js → flowDiagram-4HSFHLVR-DO8IV7Zz.js} +1 -1
  31. package/dist/assets/{ganttDiagram-APWFNJXF-BDfUGjv8.js → ganttDiagram-APWFNJXF-D5qDHJWL.js} +1 -1
  32. package/dist/assets/{gitGraphDiagram-7IBYFJ6S-D-3gFnAt.js → gitGraphDiagram-7IBYFJ6S-BfeV_cIS.js} +1 -1
  33. package/dist/assets/{graph-sxvtIUq6.js → graph-CeMwrJPJ.js} +1 -1
  34. package/dist/assets/{home-page-C3u7zUbX.js → home-page-BTk2mhpM.js} +1 -1
  35. package/dist/assets/{index-IHCyNzZ-.js → index-1ynwAukr.js} +1 -1
  36. package/dist/assets/{index-BLlJejvg.js → index-9uS0Qb7d.js} +1 -1
  37. package/dist/assets/{index-CnnWfUU8.js → index-B9R5WEN0.js} +1 -1
  38. package/dist/assets/{index-D7m-HQG_.js → index-B9lmFcxL.js} +1 -1
  39. package/dist/assets/{index-bPVNdN0e.js → index-BDmER0mE.js} +1 -1
  40. package/dist/assets/{index-DM02Afa8.js → index-BceHQNKS.js} +1 -1
  41. package/dist/assets/{index-sz_kRpT4.js → index-Byy4nuMg.js} +1 -1
  42. package/dist/assets/{index-Bf2Ch6BR.js → index-CDycO9QB.js} +1 -1
  43. package/dist/assets/{index-Br_fbwJL.js → index-CEM6NQJW.js} +1 -1
  44. package/dist/assets/{index-DPBJPO9L.js → index-CINigcsV.js} +1 -1
  45. package/dist/assets/{index-Dh47ND0_.js → index-CMcxLV-2.js} +1 -1
  46. package/dist/assets/{index-DCkT7N2Z.js → index-CbXiKAA6.js} +1 -1
  47. package/dist/assets/{index-D2PFKmPN.js → index-CswK5Ddt.js} +1 -1
  48. package/dist/assets/{index-DJmizitt.js → index-D6VWCQmR.js} +1 -1
  49. package/dist/assets/{index-DsY_QR9M.js → index-DuFWakCm.js} +1 -1
  50. package/dist/assets/{index-BpH7rvvt.js → index-DyxWu69Y.js} +14 -14
  51. package/dist/assets/{index-DzVL8p-O.js → index-LF5SNi1t.js} +1 -1
  52. package/dist/assets/{index-DwAmUquV.js → index-NvGfgqFJ.js} +1 -1
  53. package/dist/assets/{index-DYumUkW5.js → index-XAHTbFSM.js} +1 -1
  54. package/dist/assets/infoDiagram-PH2N3AL5-Ds1kqNNQ.js +2 -0
  55. package/dist/assets/{journeyDiagram-U35MCT3I-DJzsMbWQ.js → journeyDiagram-U35MCT3I-B5lbNd4X.js} +1 -1
  56. package/dist/assets/{kanban-definition-NDS4AKOZ-BjTdhRf-.js → kanban-definition-NDS4AKOZ-C_WMJuKx.js} +1 -1
  57. package/dist/assets/{layout-CGqhDXo7.js → layout-t14Q3sJf.js} +1 -1
  58. package/dist/assets/{linear-CepUMDdP.js → linear-Bqzt0K0c.js} +1 -1
  59. package/dist/assets/{mermaid-C-jFByNl.js → mermaid-L_PNwGa7.js} +4 -4
  60. package/dist/assets/{min-m6cCo9uU.js → min-BdSMxDt1.js} +1 -1
  61. package/dist/assets/{mindmap-definition-ALO5MXBD-EPQGTrFW.js → mindmap-definition-ALO5MXBD-CZS6FbYQ.js} +1 -1
  62. package/dist/assets/{panels-v4hyM9JW.js → panels-2uHROPKn.js} +3 -3
  63. package/dist/assets/{pieDiagram-IB7DONF6-Cew6Mn5T.js → pieDiagram-IB7DONF6-Xeq_CHZ_.js} +1 -1
  64. package/dist/assets/{quadrantDiagram-7GDLP6J5-XASZGrQo.js → quadrantDiagram-7GDLP6J5-BbKSr5MI.js} +1 -1
  65. package/dist/assets/{radar-MK3ICKWK-Cnf1WzuG.js → radar-MK3ICKWK-BlQnVkR2.js} +1 -1
  66. package/dist/assets/{react-plotly-BczwgBIK.js → react-plotly-CJP-Smny.js} +1 -1
  67. package/dist/assets/{requirementDiagram-KVF5MWMF-Cp2t-Op1.js → requirementDiagram-KVF5MWMF-CIIt6uDw.js} +1 -1
  68. package/dist/assets/{run-page-DQeOvicC.js → run-page-DJ6KF4RM.js} +1 -1
  69. package/dist/assets/{sankeyDiagram-QLVOVGJD-DWjzLFyK.js → sankeyDiagram-QLVOVGJD-DtetmuoW.js} +1 -1
  70. package/dist/assets/{sequenceDiagram-X6HHIX6F-B_zFhBZi.js → sequenceDiagram-X6HHIX6F-tBF6Ceri.js} +1 -1
  71. package/dist/assets/{slides-component-CKgQfW_y.js → slides-component-rbUI_Tkm.js} +1 -1
  72. package/dist/assets/{sortBy-Ds8psbyP.js → sortBy-CQp5UCGW.js} +1 -1
  73. package/dist/assets/{stateDiagram-DGXRK772-CXjJIsMj.js → stateDiagram-DGXRK772-DwMGaPg1.js} +1 -1
  74. package/dist/assets/stateDiagram-v2-YXO3MK2T-B9jNpHNq.js +1 -0
  75. package/dist/assets/{terminal-D0zmCMwt.js → terminal-D8UdkD7U.js} +1 -1
  76. package/dist/assets/{time-C9RBSGpT.js → time-DSzUSLtF.js} +1 -1
  77. package/dist/assets/{timeline-definition-BDJGKUSR-B6_ZC_0h.js → timeline-definition-BDJGKUSR-CyZevJ-C.js} +1 -1
  78. package/dist/assets/{tracing-BCPVXqFJ.js → tracing-BGJu6zL2.js} +2 -2
  79. package/dist/assets/{tree-BwV6ivYG.js → tree-D0QAYwi2.js} +1 -1
  80. package/dist/assets/{vega-component-CVxxf2GP.js → vega-component-Bhqjh6gm.js} +1 -1
  81. package/dist/assets/{xychartDiagram-VJFVF3MP-BDOxkUJZ.js → xychartDiagram-VJFVF3MP-B4Fu6bBb.js} +1 -1
  82. package/dist/index.html +1 -1
  83. package/package.json +1 -1
  84. package/dist/assets/_baseMap-BG0_Orrd.js +0 -1
  85. package/dist/assets/channel-BL8GJC6x.js +0 -1
  86. package/dist/assets/classDiagram-GIVACNV2-O3o9EWBs.js +0 -1
  87. package/dist/assets/classDiagram-v2-COTLJTTW-O3o9EWBs.js +0 -1
  88. package/dist/assets/clone-5BLGNckn.js +0 -1
  89. package/dist/assets/infoDiagram-PH2N3AL5-BrAFKDjC.js +0 -2
  90. package/dist/assets/stateDiagram-v2-YXO3MK2T-BdLRj4Kz.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./tracing-BCPVXqFJ.js","./index-BpH7rvvt.js","./index-CKjb_M_y.css","./compile-BQoR_Ppi.js","./time-C9RBSGpT.js","./timer-DFzT7np-.js","./linear-CepUMDdP.js","./init-DLRA0X12.js","./range-CtcPcB_L.js","./zoom-COrs4lFh.js","./ordinal-DDUp3AbE.js","./colors-bszWmPJw.js","./arc-Cuwikxov.js","./step-BwsUM5iJ.js","./panels-v4hyM9JW.js","./index-Br_fbwJL.js","./index-IHCyNzZ-.js","./index-DwAmUquV.js","./index-D7m-HQG_.js","./index-BLlJejvg.js","./index-DYumUkW5.js","./index-Bf2Ch6BR.js","./index-DzVL8p-O.js","./index-sz_kRpT4.js","./index-DPBJPO9L.js","./index-DCkT7N2Z.js","./index-bPVNdN0e.js","./index-CnnWfUU8.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-CHJ5qNM_.js","./ebnf-B-Df8AvO.js","./ecl-DPFc0Uaf.js","./eiffel-DR5c0IrL.js","./elm-D7xaZ7Da.js","./erlang-BuqgqA5h.js","./factor-CFXhaUWb.js","./fcl-CVaBTCzQ.js","./forth-Dri_5nFc.js","./fortran-DL7KluxX.js","./gas-5kEe4nk0.js","./gherkin-B6X1vGSW.js","./groovy-DnIzCrpZ.js","./haskell-CmdsSjFB.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-FFvkTduk.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-OdhglgkO.js","./swift-B_XXVlXX.js","./tcl-B2fODqDH.js","./textile-BuVhTOzU.js","./tiddlywiki-BgR6AEZu.js","./tiki-CI-ztowC.js","./toml-BQXy8elZ.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","./panels-DcAzAz16.css","./tree-BwV6ivYG.js","./index-DsY_QR9M.js","./tree-C1rhMrxo.css","./circle-play-BNnnR2ce.js","./_createAggregator-RZ8gTTcD.js","./_baseEach-dfmzVuHt.js","./transform-Cyp0GDF-.js","./sortBy-Ds8psbyP.js","./_baseMap-BG0_Orrd.js","./terminal-D0zmCMwt.js","./terminal-WqMRJt5Z.css"])))=>i.map(i=>d[i]);
2
- var gF=Object.defineProperty;var _3=Ft=>{throw TypeError(Ft)};var _F=(Ft,Et,mn)=>Et in Ft?gF(Ft,Et,{enumerable:!0,configurable:!0,writable:!0,value:mn}):Ft[Et]=mn;var ee=(Ft,Et,mn)=>_F(Ft,typeof Et!="symbol"?Et+"":Et,mn),bF=(Ft,Et,mn)=>Et.has(Ft)||_3("Cannot "+mn);var b3=(Ft,Et,mn)=>(bF(Ft,Et,"read from private field"),mn?mn.call(Ft):Et.get(Ft)),y3=(Ft,Et,mn)=>Et.has(Ft)?_3("Cannot add the same private member more than once"):Et instanceof WeakSet?Et.add(Ft):Et.set(Ft,mn);import{u as Le,S as A,i7 as yF,i8 as xF,i9 as x3,ia as wF,ib as vF,ic as kF,R as K,id as SF,ie as Mr,ig as CF,ih as Gf,ii as w3,ij as NF,ik as jF,il as v3,im as nc,d as X,ac as Bn,io as Yf,j as h,ds as Jf,dt as k3,du as EF,dw as Kf,dy as Xf,f6 as oc,ip as Zf,dq as Qf,dr as ep,dv as tp,iq as IF,ir as S3,ef as C3,bo as Qe,Q as Lt,is as AF,dU as fo,it as N3,iu as j3,iv as np,iw as E3,ix as TF,L as Xt,am as Zt,aF as I3,cC as op,a2 as Pe,iy as MF,eg as ut,iz as A3,iA as OF,a8 as lt,iB as rc,T as He,a_ as Un,ao as Qt,iC as sc,iD as Ts,e4 as Ms,iE as DF,iF as Xi,iG as RF,ed as PF,iH as T3,iI as M3,dM as LF,av as rp,iJ as ar,iK as Or,aJ as ic,aL as lr,iL as FF,iM as ac,iN as O3,at as Zi,eC as D3,au as lc,iO as zF,a7 as yn,iP as sp,iQ as Dr,a3 as cr,a4 as Os,a5 as dr,bg as Rr,ai as Fo,e5 as Ds,gl as R3,fN as Rs,go as BF,b2 as fn,iR as UF,iS as VF,fL as ip,aI as cc,iT as ap,iU as $F,iV as P3,iW as lp,iX as HF,iY as WF,iZ as po,i_ as L3,fR as cp,i$ as Qi,j0 as dc,d$ as qF,Z as Kn,a6 as Ps,be as ur,j1 as ea,bs as Vn,a9 as Ls,as as Re,f2 as mo,b7 as F3,en,j2 as GF,eP as YF,dz as uc,j3 as dp,aN as up,j4 as JF,em as hp,ea as Fs,j5 as KF,j6 as fp,bj as $n,j7 as XF,dS as Ae,j8 as Ye,j9 as pp,ja as St,jb as z3,jc as ZF,fs as mp,aE as jn,aT as Xn,g8 as B3,g9 as U3,ga as QF,ge as ez,gb as V3,aj as Oe,dL as tz,aG as hc,aR as fc,aH as pc,aO as sn,ee as zo,jd as nz,gc as $3,je as oz,g3 as H3,g5 as W3,jf as zs,jg as q3,jh as rz,ji as sz,a1 as iz,a0 as az,e9 as ta,_ as mc,jj as na,jk as gc,jl as lz,jm as cz,jn as G3,jo as pn,fQ as Y3,dN as _c,ba as dz,jp as uz,ab as gp,aK as hz,jq as fz,gp as J3,b6 as bc,jr as _p,aa as oa,e0 as K3,js as pz,$ as mz,jt as gz,ju as _z,jv as bz,jw as yz,jx as xz,jy as wz,jz as vz,dn as Bo,jA as yc,jB as Bs,o as Uo,n as st,fv as Zn,jC as En,jD as dt,jE as Us,jF as Ut,fM as qt,jG as bp,dR as go,jH as kz,jI as Sz,b4 as X3,b5 as Z3,jJ as Q3,jK as Cz,gs as Vs,jL as xc,b1 as wc,gr as Pr,ek as yp,jM as e4,jN as ra,eh as xp,jO as Nz,jP as jz,jQ as Ez,jR as Iz,jS as t4,jT as Az,jU as n4,jV as o4,jW as Tz,jX as r4,jY as s4,ei as vc,jZ as Mz,bp as Oz,j_ as Dz,fu as Hn,j$ as Rz,k0 as Pz,k1 as $s,k2 as kc,k3 as Hs,fF as Vo,k4 as wp,k5 as sa,k6 as ia,k7 as aa,k8 as Lz,fl as Sc,k9 as vp,ka as i4,kb as Cc,eO as Nc,fm as Fz,r as zz,kc as Bz,kd as Uz,ke as a4,t as D,kf as Vz,kg as $z,kh as kp,fY as la,ki as l4,fy as Hz,aQ as Sp,kj as c4,kk as Wz,kl as qz,km as Gz,kn as Yz,ko as Jz,kp as Kz,kq as Xz,kr as Zz,ks as Qz,kt as eB,ku as tB,kv as nB,kw as oB,kx as rB,ky as sB,kz as iB,kA as aB,kB as lB,kC as cB,kD as dB,kE as ca,kF as uB,kG as hB,kH as fB,kI as pB,kJ as mB,kK as gB,kL as d4,kM as _B,kN as bB,kO as yB,kP as u4,kQ as xB,kR as wB,kS as h4,kT as vB,kU as Ws,kV as Wn,kW as kB,kX as SB,kY as CB,kZ as NB,k_ as jB,k$ as EB,l0 as IB,l1 as AB,l2 as TB,l3 as MB,l4 as hr,l5 as OB,l6 as DB,l7 as RB,l8 as PB,eo as LB,l9 as FB,la as f4,es as zB,lb as jc,lc as BB,ld as UB,le as VB,lf as $B,ak as Lr,lg as Ec,er as HB,lh as Cp,li as Ic,lj as da,lk as ua,ll as Ac,lm as fr,ln as p4,lo as $o,lp as qs,lq as Np,lr as ha,ls as Gs,lt as jp,lu as Ep,lv as m4,lw as Tc,lx as WB,ag as fa,ly as pa,lz as qB,eN as Mc,lA as GB,lB as Ip,lC as YB,lD as JB,lE as Oc,lF as KB,lG as XB,lH as g4,lI as Ap,gq as Ys,lJ as ZB,lK as QB,lL as eU,lM as tU,fD as nU,bd as oU,gt as jt,lN as ma,lO as Js,lP as rU,lQ as sU,lR as Tp,lS as iU,lT as aU,b3 as _4,lU,lV as cU,lW as Dc,lX as b4,eH as Mp,bf as y4,an as Op,lY as x4,lZ as dU,l_ as uU,l$ as Dp,m0 as Rp,m1 as hU,m2 as w4,m3 as v4,m4 as ga,fp as fU,f4 as pU,W as k4,fr as mU,e2 as gU,m5 as S4,m6 as _U,m7 as bU,m8 as C4,m9 as yU,ma as xU,mb as N4,mc as j4,md as wU,bh as E4,me as vU,mf as Pp,e8 as kU,mg as Ho,dJ as I4,mh as A4,ec as T4,ff as Lp,mi as Fp,mj as M4,bu as zp,dK as Rc,mk as O4,ml as SU,mm as CU,mn as NU,bc as Pc,mo as jU,f8 as Bp,g4 as EU,g6 as IU,gd as Up,gg as AU,mp as TU,mq as Vp,mr as MU,ms as OU,mt as DU,mu as RU,mv as PU,mw as LU,mx as FU,my as zU,U as BU,mz as Lc,V as UU,mA as D4,mB as VU,f3 as $U,mC as R4,a$ as Qn,fj as HU,dB as WU,mD as qU,mE as P4,mF as GU,eM as YU,mG as JU,mH as KU,e3 as XU,mI as ZU,mJ as QU,aq as Fc,mK as eV,ar as pr,dE as L4,mL as $p,mM as tV,el as F4,mN as nV,mO as z4,mP as oV,mQ as rV,mR as sV,mS as iV,mT as aV,mU as lV,mV as B4,f$ as Hp,fZ as Wp,fU as Ks,f_ as Fr,mW as U4,g0 as qp,fV as zr,dV as cV,mX as Gp,mY as dV,ap as uV,mZ as hV,fE as V4,E as Xs,m_ as fV,m$ as pV,n0 as mV,n1 as gV,n2 as _a,n3 as _V,n4 as bV,n5 as yV,n6 as xV,n7 as wV,n8 as $4,n9 as vV,ft as kV,na as SV,nb as CV,nc as NV,nd as jV,gf as EV,ne as IV,nf as H4,ng as AV,nh as TV,ni as W4,nj as q4,nk as G4,f1 as Y4,nl as MV,nm as OV,nn as J4,no as K4,np as Yp,nq as X4,nr as DV,ns as Z4,nt as RV,nu as PV,nv as Q4,nw as LV,nx as FV,ny as zV,C as eS,nz as BV,nA as UV,nB as VV,nC as mr,nD as tS,dT as $V,fW as HV,nE as nS,fX as oS,nF as WV,nG as Zs,nH as qV,nI as zc,nJ as GV,nK as YV,y as rS,nL as JV,dh as KV,nM as XV,eU as ZV,b0 as QV,aZ as e$,ad as Bc,nN as sS,nO as iS,af as aS,ae as t$,e7 as n$,__tla as o$}from"./index-BpH7rvvt.js";import{G as r$,L as lS,g as s$,b as ba,A as i$,s as a$,k as l$,B as cS,a as c$,M as d$,Y as u$,c as xn,u as Uc,C as h$,S as f$,K as p$,d as m$,i as g$,e as dS,f as _$,h as b$,j as y$,l as ya,P as Jp,m as uS,n as x$,o as w$,p as Kp,T as v$}from"./tree-BwV6ivYG.js";import{d as hS,e as fS,L as pS,f as Qs,I as Xp,g as k$,h as mS,N as gS,V as _S,S as bS,F as yS,i as xS,M as S$,l as wS,j as C$,E as vS,k as N$,m as Zp,n as j$,o as E$,p as I$,q as A$,s as T$,t as M$,v as O$,w as D$,x as R$,u as P$,C as L$,R as kS,a as F$,A as z$,y as B$,z as U$,O as V$,T as $$,B as H$,D as W$,c as q$,P as G$,__tla as Y$}from"./panels-v4hyM9JW.js";import{c as J$}from"./_createAggregator-RZ8gTTcD.js";import{s as eo,i as gr,T as Qp,a as em}from"./transform-Cyp0GDF-.js";import{g as SS}from"./timer-DFzT7np-.js";import{i as K$}from"./zoom-COrs4lFh.js";import{s as xa}from"./sortBy-Ds8psbyP.js";let tm,Vc,In,nm,CS,wa,om,X$=Promise.all([(()=>{try{return o$}catch{}})(),(()=>{try{return Y$}catch{}})()]).then(async()=>{var Ql,g3;var Ft=J$(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});let Et,mn,rm,$c,ei,ti,sm,im,am,lm,va,Hc,cm,ka,dm,Wc,um,hm,qc,fm,pm,mm,Sa,gm,Gc,_m,bm,ym,xm,wm,vm,Yc,km,Jc,Sm,Cm,Nm,jm,Em,Ca,Im,Am,Kc,Tm,Mm,Om,Xc,Dm,Rm,Pm,Na,Zc,Qc,Lm,Fm,zm,Bm,Um,Vm,$m,Hm,Wm,ed,td,qm,Gm,Ym,ja,_r,br;Et=Le("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),mn=Le("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"}]]),rm=Le("arrow-right-to-line",[["path",{d:"M17 12H3",key:"8awo09"}],["path",{d:"m11 18 6-6-6-6",key:"8c2y43"}],["path",{d:"M21 5v14",key:"nzette"}]]),$c=Le("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),ei=Le("ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]),ti=Le("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"}]]),sm=Le("chevrons-down",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),im=Le("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),nm=Le("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),am=Le("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),lm=Le("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),va=Le("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),Hc=Le("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"}]]),cm=Le("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"}]]),ka=Le("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"}]]),dm=Le("code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]),Wc=Le("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"}]]),um=Le("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"}]]),hm=Le("diamond-plus",[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]),qc=Le("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"}]]),fm=Le("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"}]]),pm=Le("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"}]]),mm=Le("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"}]]),Sa=Le("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"}]]),gm=Le("files",[["path",{d:"M20 7h-3a2 2 0 0 1-2-2V2",key:"x099mo"}],["path",{d:"M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z",key:"18t6ie"}],["path",{d:"M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8",key:"1nja0z"}]]),Gc=Le("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"}]]),_m=Le("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"}]]),bm=Le("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"}]]),ym=Le("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"}]]),xm=Le("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"}]]),wm=Le("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"}]]),vm=Le("key-round",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]),Yc=Le("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"}]]),km=Le("keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]),Jc=Le("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"}]]),Sm=Le("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"}]]),Cm=Le("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"}]]),Nm=Le("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"}]]),jm=Le("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"}]]),Em=Le("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"}]]),Ca=Le("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"}]]),Im=Le("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"}]]),Am=Le("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"}]]),Kc=Le("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"}]]),Tm=Le("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Mm=Le("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"}]]),Om=Le("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"}]]),Xc=Le("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"}]]),Dm=Le("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"}]]),Rm=Le("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"}]]),Pm=Le("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"}]]),Na=Le("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"}]]),Zc=Le("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"}]]),Qc=Le("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"}]]),Lm=Le("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"}]]),Fm=Le("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"}]]),zm=Le("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"}]]),Bm=Le("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"}]]),Um=Le("square-m",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8l4 4 4-4v8",key:"141u4e"}]]),Vm=Le("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"}]]),$m=Le("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"}]]),Hm=Le("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"}]]),Wm=Le("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"}]]),ed=Le("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"}]]),td=Le("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"}]]),qm=Le("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"}]]),Gm=Le("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"}]]),Ym=Le("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"}]]),ja=Le("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"}]]),_r=Le("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"}]]),br=Le("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 NS=A.createContext({}),jS=A.forwardRef(function(t,e){[t,e]=vF(t,e,NS);let{toolbarProps:n}=function(s,i){const{"aria-label":a,"aria-labelledby":l,orientation:c="horizontal"}=s;let[d,u]=A.useState(!1);yF(()=>{var m;u(!(!i.current||!(!((m=i.current.parentElement)===null||m===void 0)&&m.closest('[role="toolbar"]'))))});const{direction:f}=xF(),p=f==="rtl"&&c==="horizontal";let _=wF(i);const g=A.useRef(null);return{toolbarProps:{...x3(s,{labelable:!0}),role:d?"group":"toolbar","aria-orientation":c,"aria-label":a,"aria-labelledby":a==null?l:void 0,onKeyDownCapture:d?void 0:m=>{if(m.currentTarget.contains(m.target)){if(c==="horizontal"&&m.key==="ArrowRight"||c==="vertical"&&m.key==="ArrowDown")p?_.focusPrevious():_.focusNext();else{if(!(c==="horizontal"&&m.key==="ArrowLeft"||c==="vertical"&&m.key==="ArrowUp"))return m.key==="Tab"?(m.stopPropagation(),g.current=document.activeElement,void(m.shiftKey?_.focusFirst():_.focusLast())):void 0;p?_.focusNext():_.focusPrevious()}m.stopPropagation(),m.preventDefault()}},onFocusCapture:d?void 0:m=>{var b,x;g.current&&!m.currentTarget.contains(m.relatedTarget)&&(!((b=i.current)===null||b===void 0)&&b.contains(m.target))&&((x=g.current)===null||x===void 0||x.focus(),g.current=null)},onBlurCapture:d?void 0:m=>{m.currentTarget.contains(m.relatedTarget)||g.current||(g.current=m.target)}}}}(t,e),o=kF({...t,values:{orientation:t.orientation||"horizontal"},defaultClassName:"react-aria-Toolbar"}),r=x3(t);return delete r.id,K.createElement("div",{...SF(n,r),...o,ref:e,slot:t.slot||void 0,"data-orientation":t.orientation||"horizontal"},o.children)});function Ea(t,e){const n=+Mr(t)-+Mr(e);return n<0?-1:n>0?1:n}function ES(t,e){const n=Mr(t,e==null?void 0:e.in);return+function(o,r){const s=Mr(o,r==null?void 0:r.in);return s.setHours(23,59,59,999),s}(n,e)==+function(o,r){const s=Mr(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 IS(t,e,n){const[o,r,s]=Gf(n==null?void 0:n.in,t,t,e),i=Ea(r,s),a=Math.abs(function(d,u,f){const[p,_]=Gf(f==null?void 0:f.in,d,u);return 12*(p.getFullYear()-_.getFullYear())+(p.getMonth()-_.getMonth())}(r,s));if(a<1)return 0;r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-i*a);let l=Ea(r,s)===-i;ES(o)&&a===1&&Ea(o,s)===1&&(l=!1);const c=i*(a-+l);return c===0?0:c}function AS(t,e,n){const o=function(r,s){return+Mr(r)-+Mr(s)}(t,e)/1e3;return(r=>{const s=(0,Math.trunc)(r);return s===0?0:s})(o)}function TS(t,e){return function(n,o,r){const s=NF(),i=(r==null?void 0:r.locale)??s.locale??jF,a=Ea(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]=Gf(r==null?void 0:r.in,...a>0?[o,n]:[n,o]),u=AS(d,c),f=(w3(d)-w3(c))/1e3,p=Math.round((u-f)/60);let _;if(p<2)return p===0?i.formatDistance("lessThanXMinutes",1,l):i.formatDistance("xMinutes",p,l);if(p<45)return i.formatDistance("xMinutes",p,l);if(p<90)return i.formatDistance("aboutXHours",1,l);if(p<v3){const g=Math.round(p/60);return i.formatDistance("aboutXHours",g,l)}if(p<2520)return i.formatDistance("xDays",1,l);if(p<nc){const g=Math.round(p/v3);return i.formatDistance("xDays",g,l)}if(p<2*nc)return _=Math.round(p/nc),i.formatDistance("aboutXMonths",_,l);if(_=IS(d,c),_<12){const g=Math.round(p/nc);return i.formatDistance("xMonths",g,l)}{const g=_%12,m=Math.trunc(_/12);return g<3?i.formatDistance("aboutXYears",m,l):g<9?i.formatDistance("overXYears",m,l):i.formatDistance("almostXYears",m+1,l)}}(t,function(n){return CF(n,Date.now())}(t),e)}const MS=()=>{const t=X.c(7),{selectedLayout:e}=hS(),{setLayoutView:n}=fS();if(Bn()&&!Yf("wasm_layouts"))return null;let o,r,s,i;return t[0]!==n?(o=a=>n(a),t[0]=n,t[1]=o):o=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(Qf,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:h.jsx(ep,{placeholder:"Select a view"})}),t[2]=r):r=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(s=h.jsx(Jf,{children:h.jsxs(k3,{children:[h.jsx(EF,{children:"View as"}),pS.map(DS)]})}),t[3]=s):s=t[3],t[4]!==e||t[5]!==o?(i=h.jsxs(tp,{"data-testid":"layout-select",value:e,onValueChange:o,children:[r,s]}),t[4]=e,t[5]=o,t[6]=i):i=t[6],i};function OS(t){const e=Jm(t);return h.jsx(e,{className:"h-4 w-4"})}function Jm(t){switch(t){case"vertical":return Sm;case"grid":return r$;case"slides":return Xc;default:return oc(t),Zf}}function Km(t){return Xf(t)}function DS(t){return h.jsx(Kf,{value:t,children:h.jsxs("div",{className:"flex items-center gap-1.5 leading-5",children:[OS(t),h.jsx("span",{children:Km(t)})]})},t)}function RS(){const t=X.c(7);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0];const[n,o]=function(i,a){const l=X.c(11);let c;l[0]!==a?(c=new IF(a),l[0]=a,l[1]=c):c=l[1];const d=c;let u;l[2]!==i||l[3]!==d?(u=()=>d.get(i),l[2]=i,l[3]=d,l[4]=u):u=l[4];const[f,p]=A.useState(u);let _;l[5]!==i||l[6]!==d?(_=b=>{p(b),d.set(i,b)},l[5]=i,l[6]=d,l[7]=_):_=l[7];const g=_;let m;return l[8]!==g||l[9]!==f?(m=[f,g],l[8]=g,l[9]=f,l[10]=m):m=l[10],m}("marimo:commands",e);let r,s;return t[1]!==n||t[2]!==o?(r=i=>{const a=(l=[i,...n],[...new Set(l)]);var l;o(a.slice(0,3))},t[1]=n,t[2]=o,t[3]=r):r=t[3],t[4]!==n||t[5]!==r?(s={recentCommands:n,addRecentCommand:r},t[4]=n,t[5]=r,t[6]=s):s=t[6],s}function Xm(t){return t.dropdown!==void 0}function Ia(t,e=""){return t.flatMap(n=>n.label?Xm(n)?Ia(n.dropdown,`${e+n.label} > `):{...n,label:e+n.label}:[])}const ni=t=>{const e=X.c(8),{children:n,layerTop:o}=t,r=o!==void 0&&o;let s;e[0]!==n?(s=K.Children.toArray(n),e[0]=n,e[1]=s):s=e[1];const[i,a]=s,l=`second-icon absolute ${r?"top-[-2px] left-[-2px]":"bottom-[-2px] right-[-2px]"} rounded-full`;let c,d;return e[2]!==a||e[3]!==l?(c=h.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=h.jsxs("div",{className:"multi-icon relative w-fit",children:[i,c]}),e[5]=i,e[6]=c,e[7]=d):d=e[7],d};function nd(t){const e=X.c(3),n=od();let o;return e[0]!==t||e[1]!==n?(o=()=>{t!==void 0&&n([t])},e[0]=t,e[1]=n,e[2]=o):o=e[2],Qe(o)}function Zm(){const t=X.c(2),e=od();let n;return t[0]!==e?(n=()=>e(N3(fo())),t[0]=e,t[1]=n):n=t[1],Qe(n)}function od(){const t=X.c(2),{prepareForRun:e}=Lt();let n;return t[0]!==e?(n=async o=>{var a;if(o.length===0)return;const{cellHandles:r,cellData:s}=fo(),i=[];for(const l of o){const c=r[l],d=(a=c.current)==null?void 0:a.editorView;let u;d?(j3(d)!=="markdown"&&np(d),u=E3(d)):u=s[l].code,i.push(u),e({cellId:l})}await TF({cellIds:o,codes:i}).catch(PS)},t[0]=e,t[1]=n):n=t[1],Qe(n)}function PS(t){Xt.error(t)}const Aa=Zt(null),LS=Zt(!1),rd=I3("marimo:ai:chatState:v1",{chats:[],activeChatId:null}),FS=Zt(t=>{const e=t(rd);return e.chats.find(n=>n.id===e.activeChatId)},(t,e,n)=>{e(rd,o=>({...o,activeChatId:n}))}),sd=t=>{const e=X.c(7);let n,o;e[0]!==t?(n=a=>{var l;(a.ctrlKey||a.metaKey)&&a.key==="z"&&(a.preventDefault(),a.stopPropagation(),(l=t.onClick)==null||l.call(t,a))},e[0]=t,e[1]=n):n=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(o={capture:!0},e[2]=o):o=e[2],op(window,"keydown",n,o);const r=t.children??"Undo";let s,i;return e[3]===Symbol.for("react.memo_cache_sentinel")?(s=h.jsx(MF,{className:"ml-2",shortcut:"cmd-z"}),e[3]=s):s=e[3],e[4]!==r||e[5]!==t?(i=h.jsxs(Pe,{"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 id(){const t=X.c(3),{deleteCell:e,undoDeleteCell:n}=Lt();let o;return t[0]!==e||t[1]!==n?(o=r=>{if(ut.get(A3))return;const{cellId:s}=r;e({cellId:s}),OF({cellId:s}).catch(()=>{n()});const{dismiss:i}=lt({title:"Cell deleted",description:"You can bring it back by clicking undo or through the command palette.",action:h.jsx(sd,{"data-testid":"undo-delete-button",onClick:()=>{n(),a()}})}),a=i},t[0]=e,t[1]=n,t[2]=o):o=t[2],Qe(o)}function Qm(){const t=X.c(3),{splitCell:e,undoSplitCell:n}=Lt();let o;return t[0]!==e||t[1]!==n?(o=r=>{const s=rc(r.cellId);if(!s)return;const i=E3(s);e(r);const{dismiss:a}=lt({title:"Cell split",action:h.jsx(sd,{"data-testid":"undo-split-button",size:"sm",variant:"outline",onClick:()=>{n({...r,snapshot:i}),l()},children:"Undo"})}),l=a},t[0]=e,t[1]=n,t[2]=o):o=t[2],Qe(o)}function ad(t){const e=X.c(49),{cell:n}=t,{createNewCell:o,updateCellConfig:r,updateCellName:s,moveCell:i,sendToTop:a,sendToBottom:l,addColumnBreakpoint:c,clearCellOutput:d}=Lt(),u=Qm(),f=nd(n==null?void 0:n.cellId),p=!He(A3),_=id(),{openModal:g}=Un(),m=Qt(Aa),b=He(sc),x=He(Ts),y=He(Ms),v=He(DF);if(!n||y){let N;return e[0]===Symbol.for("react.memo_cache_sentinel")?(N=[],e[0]=N):N=e[0],N}const{cellId:k,config:S,getEditorView:E,name:j,hasOutput:I,hasConsoleOutput:T,status:M}=n;let L;e[1]!==k||e[2]!==S.disabled||e[3]!==r?(L=async()=>{const N={disabled:!S.disabled};await Dr({configs:{[k]:N}}),r({cellId:k,config:N})},e[1]=k,e[2]=S.disabled,e[3]=r,e[4]=L):L=e[4];const B=L;let O;e[5]!==k||e[6]!==S.hide_code||e[7]!==E||e[8]!==r?(O=async()=>{const N={hide_code:!S.hide_code};await Dr({configs:{[k]:N}}),r({cellId:k,config:N});const H=E();H&&(N.hide_code?H.contentDOM.blur():H.focus())},e[5]=k,e[6]=S.hide_code,e[7]=E,e[8]=r,e[9]=O):O=e[9];const z=O;let F,V,P,C,$;return e[10]===Symbol.for("react.memo_cache_sentinel")?(F=h.jsx(Wm,{size:13,strokeWidth:1.5}),e[10]=F):F=e[10],e[11]!==k||e[12]!==j||e[13]!==g||e[14]!==s?(V=()=>{g(h.jsxs(cr,{children:[h.jsx(Os,{children:h.jsx(dr,{children:"Rename cell"})}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx(Rr,{htmlFor:"cell-name",children:"Cell name"}),h.jsx(gS,{placeholder:"cell name",value:j,onKeyDown:N=>{N.key==="Enter"&&(N.preventDefault(),N.stopPropagation(),g(null))},onChange:N=>s({cellId:k,name:N})})]})]}))},e[11]=k,e[12]=j,e[13]=g,e[14]=s,e[15]=V):V=e[15],e[16]!==k||e[17]!==s?(P=N=>s({cellId:k,name:N}),e[16]=k,e[17]=s,e[18]=P):P=e[18],e[19]!==j||e[20]!==P?(C=h.jsx(gS,{placeholder:"cell name",value:j,onChange:P}),e[19]=j,e[20]=P,e[21]=C):C=e[21],e[22]!==c||e[23]!==b||e[24]!==v||e[25]!==x||e[26]!==p||e[27]!==k||e[28]!==d||e[29]!==S.disabled||e[30]!==S.hide_code||e[31]!==o||e[32]!==_||e[33]!==E||e[34]!==T||e[35]!==I||e[36]!==i||e[37]!==j||e[38]!==f||e[39]!==l||e[40]!==a||e[41]!==m||e[42]!==u||e[43]!==M||e[44]!==V||e[45]!==C||e[46]!==B||e[47]!==z?($=[[{icon:F,label:"Name",disableClick:!0,handle:VS,handleHeadless:V,rightElement:C},{icon:h.jsx(Qs,{size:13,strokeWidth:1.5}),label:"Run cell",hotkey:"cell.run",hidden:M==="running"||M==="queued"||M==="disabled-transitively"||S.disabled,handle:()=>f()},{icon:h.jsx(Xi,{size:13,strokeWidth:1.5}),label:"AI completion",hidden:!b,handle:()=>{m(N=>(N==null?void 0:N.cellId)===k?null:{cellId:k})},hotkey:"cell.aiCompletion"},{icon:h.jsx(Zc,{size:13,strokeWidth:1.5}),label:"Split cell",hotkey:"cell.splitCell",handle:()=>u({cellId:k})},{icon:h.jsx(Xp,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!I,handle:()=>function(N){const H=document.getElementById(S3.create(N));H&&(H.classList.add("printing-output"),C3(H,"result.png").finally(()=>{H.classList.remove("printing-output")}))}(k)},{icon:h.jsx(PF,{size:13,strokeWidth:1.5}),label:"Format cell",hotkey:"cell.format",handle:()=>{const N=E();N&&RF({[k]:N})}},{icon:S.hide_code?h.jsx(T3,{size:13,strokeWidth:1.5}):h.jsx(M3,{size:13,strokeWidth:1.5}),label:S.hide_code?"Show code":"Hide code",handle:z,hotkey:"cell.hideCode"},{icon:S.disabled?h.jsx(_r,{size:13,strokeWidth:1.5}):h.jsx(br,{size:13,strokeWidth:1.5}),label:"Reactive execution",rightElement:h.jsx(LF,{"data-testid":"cell-disable-switch",checked:!S.disabled,size:"sm",onCheckedChange:B}),handle:B},{icon:h.jsx(rp,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(I||T),handle:()=>{d({cellId:k})}}],[{icon:h.jsx(ic,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:()=>{const N=E();N&&(ar(x,o),Or(N,"markdown",{keepCodeAsIs:!1}))}},{icon:h.jsx(lr,{size:13,strokeWidth:1.5}),label:"Convert to SQL",handle:()=>{const N=E();N&&(ar(x,o),Or(N,"sql",{keepCodeAsIs:!1}))}},{icon:h.jsx(ac,{}),label:"Toggle as Python",handle:()=>{const N=E();N&&(ar(x,o),FF(N,"python",{force:!0}))}}],[{icon:h.jsxs(ni,{children:[h.jsx(va,{size:13,strokeWidth:1.5}),h.jsx(O3,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>o({cellId:k,before:!0})},{icon:h.jsxs(ni,{children:[h.jsx(va,{size:13,strokeWidth:1.5}),h.jsx(Zi,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>o({cellId:k,before:!1})},{icon:h.jsx(O3,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>i({cellId:k,before:!0})},{icon:h.jsx(Zi,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>i({cellId:k,before:!1})},{icon:h.jsx(D3,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>i({cellId:k,direction:"left"}),hidden:v!=="columns"},{icon:h.jsx(lc,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>i({cellId:k,direction:"right"}),hidden:v!=="columns"},{icon:h.jsx(im,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>a({cellId:k})},{icon:h.jsx(sm,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>l({cellId:k})},{icon:h.jsx(zF,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",hidden:v!=="columns",handle:()=>c({cellId:k})}],[{icon:h.jsx(lS,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!mS(j),tooltip:mS(j)?void 0:"Only named cells can be linked to",handle:async()=>{await yn(k$(j)),lt({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!p,variant:"danger",icon:h.jsx(sp,{size:13,strokeWidth:1.5}),handle:()=>{_({cellId:k})}}]].map(BS).filter(zS),e[22]=c,e[23]=b,e[24]=v,e[25]=x,e[26]=p,e[27]=k,e[28]=d,e[29]=S.disabled,e[30]=S.hide_code,e[31]=o,e[32]=_,e[33]=E,e[34]=T,e[35]=I,e[36]=i,e[37]=j,e[38]=f,e[39]=l,e[40]=a,e[41]=m,e[42]=u,e[43]=M,e[44]=V,e[45]=C,e[46]=B,e[47]=z,e[48]=$):$=e[48],$}function zS(t){return t.length>0}function BS(t){return t.filter(US)}function US(t){return!t.hidden}function VS(t){t==null||t.stopPropagation(),t==null||t.preventDefault()}function $S(t){return!t.hidden}const ld=Zt(!1),eg=()=>{const t=X.c(37),[e,n]=fn(ld),o=UF(),r=He(VF),s=He(ip);let i;t[0]!==r?(i={cell:r},t[0]=r,t[1]=i):i=t[1];let a=ad(i).flat();a=Ia(a);const l=function(){const P=X.c(45),{theme:C}=Fo(),[$,N]=Ds(),[H,G]=R3();let Z;P[0]!==N?(Z=async ce=>{await Rs({config:ce}).then(()=>{N(ce)})},P[0]=N,P[1]=Z):Z=P[1];const q=Z;let re;P[2]!==G?(re=async ce=>{await BF({config:ce}).then(()=>{G(ce)})},P[2]=G,P[3]=re):re=P[3];const ne=re;let oe;if(P[4]!==H||P[5]!==$||P[6]!==ne||P[7]!==q||P[8]!==C){let ce,he,de;P[10]!==H?(ce=et=>et!==H.width,P[10]=H,P[11]=ce):ce=P[11],P[12]!==H||P[13]!==ne?(he=et=>({label:`App config > Set width=${et}`,handle:()=>{ne({...H,width:et})}}),P[12]=H,P[13]=ne,P[14]=he):he=P[14],P[15]!==$||P[16]!==q||P[17]!==C?(de={label:"Config > Toggle dark mode",handle:()=>{q({...$,display:{...$.display,theme:C==="dark"?"light":"dark"}})}},P[15]=$,P[16]=q,P[17]=C,P[18]=de):de=P[18];const me=$.keymap.preset==="vim";let ie,Ce;P[19]!==$||P[20]!==q?(ie=()=>{q({...$,keymap:{...$.keymap,preset:"vim"}})},P[19]=$,P[20]=q,P[21]=ie):ie=P[21],P[22]!==me||P[23]!==ie?(Ce={label:"Config > Switch keymap to VIM",hidden:me,handle:ie},P[22]=me,P[23]=ie,P[24]=Ce):Ce=P[24];const we=$.keymap.preset==="default";let ae,ve,ge;P[25]!==$||P[26]!==q?(ae=()=>{q({...$,keymap:{...$.keymap,preset:"default"}})},P[25]=$,P[26]=q,P[27]=ae):ae=P[27],P[28]!==ae||P[29]!==we?(ve={label:"Config > Switch keymap to default (current: VIM)",hidden:we,handle:ae},P[28]=ae,P[29]=we,P[30]=ve):ve=P[30],P[31]!==$||P[32]!==q?(ge=()=>{q({...$,completion:{...$.completion,copilot:!1}})},P[31]=$,P[32]=q,P[33]=ge):ge=P[33];const be=$.completion.copilot!=="github";let Te,ze;P[34]!==ge||P[35]!==be?(Te={label:"Config > Disable GitHub Copilot",handle:ge,hidden:be},P[34]=ge,P[35]=be,P[36]=Te):Te=P[36],P[37]!==$||P[38]!==q?(ze=()=>{q({...$,completion:{...$.completion,copilot:"github"}})},P[37]=$,P[38]=q,P[39]=ze):ze=P[39];const Xe=$.completion.copilot==="github";let Fe;P[40]!==ze||P[41]!==Xe?(Fe={label:"Config > Enable GitHub Copilot",handle:ze,hidden:Xe},P[40]=ze,P[41]=Xe,P[42]=Fe):Fe=P[42],oe=[...s$().filter(ce).map(he),de,Ce,ve,Te,Fe],P[4]=H,P[5]=$,P[6]=ne,P[7]=q,P[8]=C,P[9]=oe}else oe=P[9];const Y=oe;let Q;return P[43]!==Y?(Q=Y.filter($S),P[43]=Y,P[44]=Q):Q=P[44],Q}();let c=Ig();c=[...Ia(c),...Ia(l)];const d=c.filter(HS),u=cc.keyBy(d,WS),{recentCommands:f,addRecentCommand:p}=RS();let _;t[2]!==f?(_=new Set(f),t[2]=f,t[3]=_):_=t[3];const g=_;let m,b;t[4]!==s||t[5]!==n?(m=P=>{WF(s.getHotkey("global.commandPalette").key)(P)&&(P.preventDefault(),n(qS))},t[4]=s,t[5]=n,t[6]=m):m=t[6],op(document,"keydown",m),t[7]!==p||t[8]!==s||t[9]!==o||t[10]!==n?(b=(P,C)=>{const $=o[P];if(!$)return null;const N=s.getHotkey(P);return h.jsxs(po,{disabled:C.disabled,onSelect:()=>{p(P),n(!1),requestAnimationFrame(()=>{$()})},value:N.name,children:[h.jsxs("span",{children:[N.name,C.tooltip&&h.jsx("span",{className:"ml-2",children:C.tooltip})]}),h.jsx(L3,{children:h.jsx(cp,{shortcut:N.key})})]},P)},t[7]=p,t[8]=s,t[9]=o,t[10]=n,t[11]=b):b=t[11];const x=b;let y;t[12]!==p||t[13]!==s||t[14]!==n?(y=(P,C,$,N)=>{const H=$===void 0?{}:$;return h.jsxs(po,{disabled:H.disabled,onSelect:()=>{p(P),n(!1),requestAnimationFrame(()=>{C()})},value:P,children:[h.jsxs("span",{children:[P,H.tooltip&&h.jsxs("span",{className:"ml-2",children:["(",H.tooltip,")"]})]}),N&&h.jsx(L3,{children:h.jsx(cp,{shortcut:s.getHotkey(N).key})})]},P)},t[12]=p,t[13]=s,t[14]=n,t[15]=y):y=t[15];const v=y,k=HF;let S;t[16]===Symbol.for("react.memo_cache_sentinel")?(S=h.jsx(Qi,{placeholder:"Type to search..."}),t[16]=S):S=t[16];const E=lp;let j;t[17]===Symbol.for("react.memo_cache_sentinel")?(j=h.jsx(dc,{children:"No results found."}),t[17]=j):j=t[17];const I=f.length>0&&h.jsxs(h.Fragment,{children:[h.jsx(ap,{heading:"Recently Used",children:f.map(P=>{const C=u[P];return $F(P)?x(P,{disabled:C==null?void 0:C.disabled,tooltip:C==null?void 0:C.tooltip}):C&&!Xm(C)?v(C.label,C.handleHeadless||C.handle,{disabled:C.disabled,tooltip:C.tooltip}):null})}),h.jsx(P3,{})]}),T=ap,M=s.iterate().map(P=>{if(g.has(P))return null;const C=u[P];return x(P,{disabled:C==null?void 0:C.disabled,tooltip:C==null?void 0:C.tooltip})}),L=d.map(P=>g.has(P.label)?null:v(P.label,P.handleHeadless||P.handle,{disabled:P.disabled,tooltip:P.tooltip}));let B;t[18]!==g||t[19]!==v?(B=P=>g.has(P.label)?null:v(`Cell > ${P.label}`,P.handleHeadless||P.handle,{disabled:P.disabled,tooltip:P.tooltip}),t[18]=g,t[19]=v,t[20]=B):B=t[20];const O=a.map(B);let z,F,V;return t[21]!==T||t[22]!==L||t[23]!==O||t[24]!==M?(z=h.jsxs(T,{heading:"Commands",children:[M,L,O]}),t[21]=T,t[22]=L,t[23]=O,t[24]=M,t[25]=z):z=t[25],t[26]!==E||t[27]!==z||t[28]!==j||t[29]!==I?(F=h.jsxs(E,{children:[j,I,z]}),t[26]=E,t[27]=z,t[28]=j,t[29]=I,t[30]=F):F=t[30],t[31]!==k||t[32]!==e||t[33]!==n||t[34]!==F||t[35]!==S?(V=h.jsxs(k,{open:e,onOpenChange:n,children:[S,F]}),t[31]=k,t[32]=e,t[33]=n,t[34]=F,t[35]=S,t[36]=V):V=t[36],V};function HS(t){return!t.hotkey}function WS(t){return t.label}function qS(t){return!t}const Ta="https://static.marimo.app",GS=t=>{const e=X.c(24),{onClose:n}=t,[o,r]=A.useState("");let s;s=Math.random().toString(36).slice(2,6);const i=`${o}-${s}`,a=`${Ta}/static/${i}`;let l,c,d,u,f,p,_,g,m,b,x;return e[0]!==n||e[1]!==i?(l=async y=>{y.preventDefault(),n();const v=await qF({download:!1,includeCode:!0,files:_S.INSTANCE.filenames()}),k=lt({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${Ta}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:v,path:i})}).catch(()=>{k.dismiss(),lt({title:"Error uploading static page",description:h.jsxs("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",h.jsx("a",{href:Kn.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),k.dismiss(),lt({title:"Static page uploaded!",description:h.jsxs("div",{children:["The URL has been copied to your clipboard.",h.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=h.jsx(dr,{children:"Share static notebook"}),e[3]=c):c=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsxs(Os,{children:[c,h.jsxs(Ps,{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"," ",h.jsx("a",{href:Ta,target:"_blank",children:Ta}),"."]})]}),e[4]=d):d=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(u=y=>{const v=y.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,"");r(v)},e[5]=u):u=e[5],e[6]!==o?(f=h.jsx(ur,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:u,required:!0,autoComplete:"off"}),e[6]=o,e[7]=f):f=e[7],e[8]!==a?(p=h.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:",h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(YS,{text:a}),h.jsx("span",{className:"text-primary",children:a})]})]}),e[8]=a,e[9]=p):p=e[9],e[10]!==f||e[11]!==p?(_=h.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[f,p]}),e[10]=f,e[11]=p,e[12]=_):_=e[12],e[13]!==n?(g=h.jsx(Pe,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),e[13]=n,e[14]=g):g=e[14],e[15]!==a?(m=h.jsx(Pe,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await yn(a)},children:"Create"}),e[15]=a,e[16]=m):m=e[16],e[17]!==m||e[18]!==g?(b=h.jsxs(ea,{children:[g,m]}),e[17]=m,e[18]=g,e[19]=b):b=e[19],e[20]!==b||e[21]!==l||e[22]!==_?(x=h.jsx(cr,{className:"w-fit",children:h.jsxs("form",{onSubmit:l,children:[d,_,b]})}),e[20]=b,e[21]=l,e[22]=_,e[23]=x):x=e[23],x},YS=t=>{const e=X.c(8),[n,o]=K.useState(!1);let r;e[0]!==t.text?(r=Vn.stopPropagation(async c=>{c.preventDefault(),await yn(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=h.jsx(Ls,{size:14,strokeWidth:1.5}),e[2]=i):i=e[2],e[3]!==s?(a=h.jsx(Pe,{"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=h.jsx(Re,{content:"Copied!",open:n,children:a}),e[5]=n,e[6]=a,e[7]=l):l=e[7],l};function tg(){const t=X.c(3),{openConfirm:e}=Un(),n=Qt(mo);let o;return t[0]!==e||t[1]!==n?(o=()=>{e({title:"Restart Kernel",description:"This will restart the Python kernel. You'll lose all data that's in memory. You will also lose any unsaved changes, so make sure to save your work before restarting.",variant:"destructive",confirmAction:h.jsx(F3,{onClick:async()=>{n({state:en.CLOSING}),await GF(),YF()},"aria-label":"Confirm Restart",children:"Restart"})})},t[0]=e,t[1]=n,t[2]=o):o=t[2],o}const cd=[{type:"files",Icon:_m,tooltip:"View files",position:"sidebar"},{type:"variables",Icon:uc,tooltip:"Explore variables",position:"sidebar"},{type:"datasources",Icon:lr,tooltip:"Explore data sources",position:"sidebar"},{type:"dependencies",Icon:Ca,tooltip:"Explore dependencies",position:"sidebar"},{type:"packages",Icon:ba,tooltip:"Manage packages",position:"sidebar"},{type:"outline",Icon:Qc,tooltip:"View outline",position:"sidebar"},{type:"chat",Icon:dp,tooltip:"Chat with AI",position:"sidebar"},{type:"documentation",Icon:ed,tooltip:"View live docs",position:"sidebar"},{type:"logs",Icon:up,tooltip:"Notebook logs",position:"sidebar"},{type:"tracing",Icon:i$,tooltip:"Tracing",position:"sidebar"},{type:"snippets",Icon:zm,tooltip:"Snippets",position:"sidebar"},{type:"secrets",Icon:vm,tooltip:"Secrets",hidden:Bn(),position:"sidebar"},{type:"scratchpad",Icon:JF,tooltip:"Scratchpad",position:"sidebar"},{type:"errors",Icon:rp,tooltip:"View errors",position:"footer"}];function ng(){const t=X.c(2),e=Qt(hp);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=Fs.parse(i.parentNode.id);break}}e(i=>({mode:KF(i.mode),cellAnchor:s})),requestAnimationFrame(()=>{var i;s!==null&&((i=document.getElementById(Fs.create(s)))==null||i.scrollIntoView())})},t[0]=e,t[1]=n):n=t[1],n}function yr(){return Ae.string().optional().describe(Ye.of({label:"Password",inputType:"password",placeholder:"password",optionRegex:".*password.*"}))}function og(){return Ae.string().optional().describe(Ye.of({label:"Token",inputType:"password",placeholder:"token",optionRegex:".*token.*"}))}function Ma(){return Ae.string().optional().describe(Ye.of({label:"Warehouse Name",placeholder:"warehouse",optionRegex:".*warehouse.*"}))}function rg(){return Ae.string().optional().describe(Ye.of({label:"URI",optionRegex:".*uri.*"}))}function xr(){return Ae.string().nonempty().describe(Ye.of({label:"Host",placeholder:"localhost",optionRegex:".*host.*"}))}function _o(){return Ae.string().describe(Ye.of({label:"Database",placeholder:"db name",optionRegex:".*database.*"}))}function wr(){return Ae.string().nonempty().describe(Ye.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function vr(t){const e=Ae.coerce.string().describe(Ye.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 sg(){return Ae.boolean().default(!1).describe(Ye.of({label:"Read Only"}))}const ig=Ae.object({type:Ae.literal("postgres"),host:xr(),port:vr(5432).optional(),database:_o(),username:wr(),password:yr(),ssl:Ae.boolean().default(!1).describe(Ye.of({label:"Use SSL"}))}).describe(Ye.of({direction:"two-columns"})),ag=Ae.object({type:Ae.literal("mysql"),host:xr(),port:vr(3306),database:_o(),username:wr(),password:yr(),ssl:Ae.boolean().default(!1).describe(Ye.of({label:"Use SSL"}))}).describe(Ye.of({direction:"two-columns"})),lg=Ae.object({type:Ae.literal("sqlite"),database:_o().describe(Ye.of({label:"Database Path"}))}).describe(Ye.of({direction:"two-columns"})),cg=Ae.object({type:Ae.literal("duckdb"),database:_o().describe(Ye.of({label:"Database Path"})),read_only:sg()}).describe(Ye.of({direction:"two-columns"})),dg=Ae.object({type:Ae.literal("motherduck"),database:_o().default("my_db").describe(Ye.of({label:"Database Name"})),token:og()}).describe(Ye.of({direction:"two-columns"})),ug=Ae.object({type:Ae.literal("snowflake"),account:Ae.string().nonempty().describe(Ye.of({label:"Account",optionRegex:".*snowflake.*"})),warehouse:Ae.string().optional().describe(Ye.of({label:"Warehouse",optionRegex:".*snowflake.*"})),database:_o(),schema:Ae.string().optional().describe(Ye.of({label:"Schema",optionRegex:".*snowflake.*"})),username:wr(),password:yr(),role:Ae.string().optional().describe(Ye.of({label:"Role"}))}).describe(Ye.of({direction:"two-columns"})),hg=Ae.object({type:Ae.literal("bigquery"),project:Ae.string().nonempty().describe(Ye.of({label:"Project ID",optionRegex:".*bigquery.*"})),dataset:Ae.string().nonempty().describe(Ye.of({label:"Dataset",optionRegex:".*bigquery.*"})),credentials_json:Ae.string().describe(Ye.of({label:"Credentials JSON",inputType:"textarea"}))}).describe(Ye.of({direction:"two-columns"})),fg=Ae.object({type:Ae.literal("clickhouse_connect"),host:xr(),port:vr(8123).optional(),username:wr(),password:yr(),secure:Ae.boolean().default(!1).describe(Ye.of({label:"Use HTTPs"}))}).describe(Ye.of({direction:"two-columns"})),pg=Ae.object({type:Ae.literal("timeplus"),host:xr().default("localhost"),port:vr(8123).optional(),username:wr().default("default"),password:yr().default("")}).describe(Ye.of({direction:"two-columns"})),mg=Ae.object({type:Ae.literal("chdb"),database:_o().describe(Ye.of({label:"Database Path"})),read_only:sg()}).describe(Ye.of({direction:"two-columns"})),gg=Ae.object({type:Ae.literal("trino"),host:xr(),port:vr(8080),database:_o(),schema:Ae.string().describe(Ye.of({label:"Schema",placeholder:"schema name",optionRegex:".*schema.*"})).optional(),username:wr(),password:yr(),async_support:Ae.boolean().default(!1).describe(Ye.of({label:"Async Support"}))}).describe(Ye.of({direction:"two-columns"})),_g=Ae.object({type:Ae.literal("iceberg"),name:Ae.string().describe(Ye.of({label:"Catalog Name"})),catalog:Ae.discriminatedUnion("type",[Ae.object({type:Ae.literal("REST"),warehouse:Ma(),uri:Ae.string().optional().describe(Ye.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:og()}),Ae.object({type:Ae.literal("SQL"),warehouse:Ma(),uri:Ae.string().optional().describe(Ye.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),Ae.object({type:Ae.literal("Hive"),warehouse:Ma(),uri:rg()}),Ae.object({type:Ae.literal("Glue"),warehouse:Ma(),uri:rg()}),Ae.object({type:Ae.literal("DynamoDB"),"dynamodb.profile-name":Ae.string().optional().describe(Ye.of({label:"Profile Name"})),"dynamodb.region":Ae.string().optional().describe(Ye.of({label:"Region"})),"dynamodb.access-key-id":Ae.string().optional().describe(Ye.of({label:"Access Key ID"})),"dynamodb.secret-access-key":Ae.string().optional().describe(Ye.of({label:"Secret Access Key",inputType:"password"})),"dynamodb.session-token":Ae.string().optional().describe(Ye.of({label:"Session Token",inputType:"password"}))})]).default({type:"REST"}).describe(Ye.of({special:"tabs"}))}),bg=Ae.object({type:Ae.literal("datafusion"),sessionContext:Ae.boolean().optional().describe(Ye.of({label:"Use Session Context"}))}),yg=Ae.object({type:Ae.literal("pyspark"),host:xr().optional(),port:vr().optional()}),xg=Ae.object({type:Ae.literal("redshift"),host:xr(),port:vr(5439),connectionType:Ae.discriminatedUnion("type",[Ae.object({type:Ae.literal("IAM credentials"),region:Ae.string().describe(Ye.of({label:"Region"})),aws_access_key_id:Ae.string().nonempty().describe(Ye.of({label:"AWS Access Key ID",inputType:"password",optionRegex:".*aws_access_key_id.*"})),aws_secret_access_key:Ae.string().nonempty().describe(Ye.of({label:"AWS Secret Access Key",inputType:"password",optionRegex:".*aws_secret_access_key.*"})),aws_session_token:Ae.string().optional().describe(Ye.of({label:"AWS Session Token",inputType:"password",optionRegex:".*aws_session_token.*"}))}),Ae.object({type:Ae.literal("DB credentials"),user:wr(),password:yr()})]).default({type:"IAM credentials",aws_access_key_id:"",aws_secret_access_key:"",region:""}),database:_o()}).describe(Ye.of({direction:"two-columns"})),JS=Ae.discriminatedUnion("type",[ig,ag,lg,cg,dg,ug,hg,fg,pg,mg,gg,_g,bg,yg,xg]),dd="env:";function Oa(t){return typeof t=="string"&&t.startsWith(dd)}function ud(t){return`${dd}${t}`}const wg={sqlmodel:"SQLModel",sqlalchemy:"SQLAlchemy",duckdb:"DuckDB",clickhouse_connect:"ClickHouse Connect",chdb:"chDB",pyiceberg:"PyIceberg",ibis:"Ibis",motherduck:"MotherDuck",redshift:"Redshift"};class an{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 KS{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),Oa(n)){const r=n.replace(dd,""),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"?Br(n):n?`"${n}"`:""}printInFString(e,n,o){if(n===void 0)return"";if(typeof n=="number")return`${n}`;if(typeof n=="boolean")return Br(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 Oa(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-BGJu6zL2.js","./index-DyxWu69Y.js","./index-CKjb_M_y.css","./compile-CmR4tKA4.js","./time-DSzUSLtF.js","./timer-DFzT7np-.js","./linear-Bqzt0K0c.js","./init-DLRA0X12.js","./range-CtcPcB_L.js","./zoom-COrs4lFh.js","./ordinal-DDUp3AbE.js","./colors-bszWmPJw.js","./arc-Cuwikxov.js","./step-BwsUM5iJ.js","./panels-2uHROPKn.js","./index-CEM6NQJW.js","./index-1ynwAukr.js","./index-NvGfgqFJ.js","./index-B9lmFcxL.js","./index-9uS0Qb7d.js","./index-XAHTbFSM.js","./index-CDycO9QB.js","./index-LF5SNi1t.js","./index-Byy4nuMg.js","./index-CINigcsV.js","./index-CbXiKAA6.js","./index-BDmER0mE.js","./index-B9R5WEN0.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-CHJ5qNM_.js","./ebnf-B-Df8AvO.js","./ecl-DPFc0Uaf.js","./eiffel-DR5c0IrL.js","./elm-D7xaZ7Da.js","./erlang-BuqgqA5h.js","./factor-CFXhaUWb.js","./fcl-CVaBTCzQ.js","./forth-Dri_5nFc.js","./fortran-DL7KluxX.js","./gas-5kEe4nk0.js","./gherkin-B6X1vGSW.js","./groovy-DnIzCrpZ.js","./haskell-CmdsSjFB.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-FFvkTduk.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-OdhglgkO.js","./swift-B_XXVlXX.js","./tcl-B2fODqDH.js","./textile-BuVhTOzU.js","./tiddlywiki-BgR6AEZu.js","./tiki-CI-ztowC.js","./toml-BQXy8elZ.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","./panels-DcAzAz16.css","./tree-D0QAYwi2.js","./index-DuFWakCm.js","./tree-C1rhMrxo.css","./circle-play-BIeWiATr.js","./_createAggregator-DQdAlkKm.js","./_baseEach-DQbdifxU.js","./transform-Cyp0GDF-.js","./sortBy-CQp5UCGW.js","./_baseMap-BX7qrs4I.js","./terminal-D8UdkD7U.js","./terminal-WqMRJt5Z.css"])))=>i.map(i=>d[i]);
2
+ var gF=Object.defineProperty;var _3=Ft=>{throw TypeError(Ft)};var _F=(Ft,Et,mn)=>Et in Ft?gF(Ft,Et,{enumerable:!0,configurable:!0,writable:!0,value:mn}):Ft[Et]=mn;var ee=(Ft,Et,mn)=>_F(Ft,typeof Et!="symbol"?Et+"":Et,mn),bF=(Ft,Et,mn)=>Et.has(Ft)||_3("Cannot "+mn);var b3=(Ft,Et,mn)=>(bF(Ft,Et,"read from private field"),mn?mn.call(Ft):Et.get(Ft)),y3=(Ft,Et,mn)=>Et.has(Ft)?_3("Cannot add the same private member more than once"):Et instanceof WeakSet?Et.add(Ft):Et.set(Ft,mn);import{u as Le,S as A,i7 as yF,i8 as xF,i9 as x3,ia as wF,ib as vF,ic as kF,R as K,id as SF,ie as Mr,ig as CF,ih as Yf,ii as w3,ij as NF,ik as jF,il as v3,im as nc,d as X,ac as Bn,io as Jf,j as h,ds as Kf,dt as k3,du as EF,dw as Xf,dy as Zf,f6 as oc,ip as Qf,dq as ep,dr as tp,dv as np,iq as IF,ir as S3,ef as C3,bo as Qe,Q as Lt,is as AF,dU as fo,it as N3,iu as j3,iv as op,iw as E3,ix as TF,L as Xt,am as Zt,aF as I3,cC as rp,a2 as Pe,iy as MF,eg as ut,iz as A3,iA as OF,a8 as lt,iB as rc,T as He,a_ as Un,ao as Qt,iC as sc,iD as Ts,e4 as Ms,iE as DF,iF as Xi,iG as RF,ed as PF,iH as T3,iI as M3,dM as LF,av as sp,iJ as ar,iK as Or,aJ as ic,aL as lr,iL as FF,iM as ac,iN as O3,at as Zi,eC as D3,au as lc,iO as zF,a7 as yn,iP as ip,iQ as Dr,a3 as cr,a4 as Os,a5 as dr,bg as Rr,ai as Fo,e5 as Ds,gl as R3,fN as Rs,go as BF,b2 as fn,iR as UF,iS as VF,fL as ap,aI as cc,iT as lp,iU as $F,iV as P3,iW as cp,iX as HF,iY as WF,iZ as po,i_ as L3,fR as dp,i$ as Qi,j0 as dc,d$ as qF,Z as Kn,a6 as Ps,be as ur,j1 as ea,bs as Vn,a9 as Ls,as as Re,f2 as mo,b7 as F3,en,j2 as GF,eP as YF,dz as uc,j3 as up,aN as hp,j4 as JF,em as fp,ea as Fs,j5 as KF,j6 as pp,bj as $n,j7 as XF,dS as Ae,j8 as Ye,j9 as mp,ja as St,jb as z3,jc as ZF,fs as gp,aE as jn,aT as Xn,g8 as B3,g9 as U3,ga as QF,ge as ez,gb as V3,aj as Oe,dL as tz,aG as hc,aR as fc,aH as pc,aO as sn,ee as zo,jd as nz,gc as $3,je as oz,g3 as H3,g5 as W3,jf as zs,jg as q3,jh as rz,ji as sz,a1 as iz,a0 as az,e9 as ta,_ as mc,jj as na,jk as gc,jl as lz,jm as cz,jn as G3,jo as pn,fQ as Y3,dN as _c,ba as dz,jp as uz,ab as _p,aK as hz,jq as fz,gp as J3,b6 as bc,jr as bp,aa as oa,e0 as K3,js as pz,$ as mz,jt as gz,ju as _z,jv as bz,jw as yz,jx as xz,jy as wz,jz as vz,dn as Bo,jA as yc,jB as Bs,o as Uo,n as st,fv as Zn,jC as En,jD as dt,jE as Us,jF as Ut,fM as qt,jG as yp,dR as go,jH as kz,jI as Sz,b4 as X3,b5 as Z3,jJ as Q3,jK as Cz,gs as Vs,jL as xc,b1 as wc,gr as Pr,ek as xp,jM as e4,jN as ra,eh as wp,jO as Nz,jP as jz,jQ as Ez,jR as Iz,jS as t4,jT as Az,jU as n4,jV as o4,jW as Tz,jX as r4,jY as s4,ei as vc,jZ as Mz,bp as Oz,j_ as Dz,fu as Hn,j$ as Rz,k0 as Pz,k1 as $s,k2 as kc,k3 as Hs,fF as Vo,k4 as vp,k5 as sa,k6 as ia,k7 as aa,k8 as Lz,fl as Sc,k9 as kp,ka as i4,kb as Cc,eO as Nc,fm as Fz,r as zz,kc as Bz,kd as Uz,ke as a4,t as D,kf as Vz,kg as $z,kh as Sp,fY as la,ki as l4,fy as Hz,aQ as Cp,kj as c4,kk as Wz,kl as qz,km as Gz,kn as Yz,ko as Jz,kp as Kz,kq as Xz,kr as Zz,ks as Qz,kt as eB,ku as tB,kv as nB,kw as oB,kx as rB,ky as sB,kz as iB,kA as aB,kB as lB,kC as cB,kD as dB,kE as ca,kF as uB,kG as hB,kH as fB,kI as pB,kJ as mB,kK as gB,kL as d4,kM as _B,kN as bB,kO as yB,kP as u4,kQ as xB,kR as wB,kS as h4,kT as vB,kU as Ws,kV as Wn,kW as kB,kX as SB,kY as CB,kZ as NB,k_ as jB,k$ as EB,l0 as IB,l1 as AB,l2 as TB,l3 as MB,l4 as hr,l5 as OB,l6 as DB,l7 as RB,l8 as PB,eo as LB,l9 as FB,la as f4,es as zB,lb as jc,lc as BB,ld as UB,le as VB,lf as $B,ak as Lr,lg as Ec,er as HB,lh as Np,li as Ic,lj as da,lk as ua,ll as Ac,lm as fr,ln as p4,lo as $o,lp as qs,lq as jp,lr as ha,ls as Gs,lt as Ep,lu as Ip,lv as m4,lw as Tc,lx as WB,ag as fa,ly as pa,lz as qB,eN as Mc,lA as GB,lB as Ap,lC as YB,lD as JB,lE as Oc,lF as KB,lG as XB,lH as g4,lI as Tp,gq as Ys,lJ as ZB,lK as QB,lL as eU,lM as tU,fD as nU,bd as oU,gt as jt,lN as ma,lO as Js,lP as rU,lQ as sU,lR as Mp,lS as iU,lT as aU,b3 as _4,lU,lV as cU,lW as Dc,lX as b4,eH as Op,bf as y4,an as Dp,lY as x4,lZ as dU,l_ as uU,l$ as Rp,m0 as Pp,m1 as hU,m2 as w4,m3 as v4,m4 as ga,fp as fU,f4 as pU,W as k4,fr as mU,e2 as gU,m5 as S4,m6 as _U,m7 as bU,m8 as C4,m9 as yU,ma as xU,mb as N4,mc as j4,md as wU,bh as E4,me as vU,mf as Lp,e8 as kU,mg as Ho,dJ as I4,mh as A4,ec as T4,ff as Fp,mi as zp,mj as M4,bu as Bp,dK as Rc,mk as O4,ml as SU,mm as CU,mn as NU,bc as Pc,mo as jU,f8 as Up,g4 as EU,g6 as IU,gd as Vp,gg as AU,mp as TU,mq as $p,mr as MU,ms as OU,mt as DU,mu as RU,mv as PU,mw as LU,mx as FU,my as zU,U as BU,mz as Lc,V as UU,mA as D4,mB as VU,f3 as $U,mC as R4,a$ as Qn,fj as HU,dB as WU,mD as qU,mE as P4,mF as GU,eM as YU,mG as JU,mH as KU,e3 as XU,mI as ZU,mJ as QU,aq as Fc,mK as eV,ar as pr,dE as L4,mL as Hp,mM as tV,el as F4,mN as nV,mO as z4,mP as oV,mQ as rV,mR as sV,mS as iV,mT as aV,mU as lV,mV as B4,f$ as Wp,fZ as qp,fU as Ks,f_ as Fr,mW as U4,g0 as Gp,fV as zr,dV as cV,mX as Yp,mY as dV,ap as uV,mZ as hV,fE as V4,E as Xs,m_ as fV,m$ as pV,n0 as mV,n1 as gV,n2 as _a,n3 as _V,n4 as bV,n5 as yV,n6 as xV,n7 as wV,n8 as $4,n9 as vV,ft as kV,na as SV,nb as CV,nc as NV,nd as jV,gf as EV,ne as IV,nf as H4,ng as AV,nh as TV,ni as W4,nj as q4,nk as G4,f1 as Y4,nl as MV,nm as OV,nn as J4,no as K4,np as zc,nq as X4,nr as DV,ns as Z4,nt as RV,nu as PV,nv as Q4,nw as LV,nx as FV,ny as zV,C as eS,nz as BV,nA as UV,nB as VV,nC as mr,nD as tS,dT as $V,fW as HV,nE as nS,fX as oS,nF as WV,nG as Zs,nH as qV,nI as Bc,nJ as GV,nK as YV,y as rS,nL as JV,dh as KV,nM as XV,eU as ZV,b0 as QV,aZ as e$,ad as Uc,nN as sS,nO as iS,af as aS,ae as t$,e7 as n$,__tla as o$}from"./index-DyxWu69Y.js";import{G as r$,L as lS,g as s$,b as ba,A as i$,s as a$,k as l$,B as cS,a as c$,M as d$,Y as u$,c as xn,u as Vc,C as h$,S as f$,K as p$,d as m$,i as g$,e as dS,f as _$,h as b$,j as y$,l as ya,P as Jp,m as uS,n as x$,o as w$,p as Kp,T as v$}from"./tree-D0QAYwi2.js";import{d as hS,e as fS,L as pS,f as Qs,I as Xp,g as k$,h as mS,N as gS,V as _S,S as bS,F as yS,i as xS,M as S$,l as wS,j as C$,E as vS,k as N$,m as Zp,n as j$,o as E$,p as I$,q as A$,s as T$,t as M$,v as O$,w as D$,x as R$,u as P$,C as L$,R as kS,a as F$,A as z$,y as B$,z as U$,O as V$,T as $$,B as H$,D as W$,c as q$,P as G$,__tla as Y$}from"./panels-2uHROPKn.js";import{c as J$}from"./_createAggregator-DQdAlkKm.js";import{s as eo,i as gr,T as Qp,a as em}from"./transform-Cyp0GDF-.js";import{g as SS}from"./timer-DFzT7np-.js";import{i as K$}from"./zoom-COrs4lFh.js";import{s as xa}from"./sortBy-CQp5UCGW.js";let tm,$c,In,nm,CS,wa,om,X$=Promise.all([(()=>{try{return o$}catch{}})(),(()=>{try{return Y$}catch{}})()]).then(async()=>{var Ql,g3;var Ft=J$(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});let Et,mn,rm,Hc,ei,ti,sm,im,am,lm,va,Wc,cm,ka,dm,qc,um,hm,Gc,fm,pm,mm,Sa,gm,Yc,_m,bm,ym,xm,wm,vm,Jc,km,Kc,Sm,Cm,Nm,jm,Em,Ca,Im,Am,Xc,Tm,Mm,Om,Zc,Dm,Rm,Pm,Na,Qc,ed,Lm,Fm,zm,Bm,Um,Vm,$m,Hm,Wm,td,nd,qm,Gm,Ym,ja,_r,br;Et=Le("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),mn=Le("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"}]]),rm=Le("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"}]]),Hc=Le("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),ei=Le("ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]),ti=Le("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"}]]),sm=Le("chevrons-down",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),im=Le("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),nm=Le("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),am=Le("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),lm=Le("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),va=Le("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),Wc=Le("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"}]]),cm=Le("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"}]]),ka=Le("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"}]]),dm=Le("code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]),qc=Le("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"}]]),um=Le("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"}]]),hm=Le("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"}]]),Gc=Le("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"}]]),fm=Le("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"}]]),pm=Le("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"}]]),mm=Le("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"}]]),Sa=Le("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"}]]),gm=Le("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"}]]),Yc=Le("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"}]]),_m=Le("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"}]]),bm=Le("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"}]]),ym=Le("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"}]]),xm=Le("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"}]]),wm=Le("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"}]]),vm=Le("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"}]]),Jc=Le("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"}]]),km=Le("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"}]]),Kc=Le("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"}]]),Sm=Le("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"}]]),Cm=Le("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"}]]),Nm=Le("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"}]]),jm=Le("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"}]]),Em=Le("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"}]]),Ca=Le("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"}]]),Im=Le("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"}]]),Am=Le("package-check",[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]),Xc=Le("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"}]]),Tm=Le("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Mm=Le("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"}]]),Om=Le("pen-line",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]),Zc=Le("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"}]]),Dm=Le("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"}]]),Rm=Le("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"}]]),Pm=Le("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"}]]),Na=Le("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]),Qc=Le("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]),ed=Le("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"}]]),Lm=Le("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"}]]),Fm=Le("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"}]]),zm=Le("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"}]]),Bm=Le("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"}]]),Um=Le("square-m",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8l4 4 4-4v8",key:"141u4e"}]]),Vm=Le("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"}]]),$m=Le("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"}]]),Hm=Le("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"}]]),Wm=Le("text-cursor-input",[["path",{d:"M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6",key:"1528k5"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1",key:"1mj8rg"}],["path",{d:"M9 6v12",key:"velyjx"}]]),td=Le("text-search",[["path",{d:"M21 6H3",key:"1jwq7v"}],["path",{d:"M10 12H3",key:"1ulcyk"}],["path",{d:"M10 18H3",key:"13769t"}],["circle",{cx:"17",cy:"15",r:"3",key:"1upz2a"}],["path",{d:"m21 19-1.9-1.9",key:"dwi7p8"}]]),nd=Le("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"}]]),qm=Le("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"}]]),Gm=Le("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"}]]),Ym=Le("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"}]]),ja=Le("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"}]]),_r=Le("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"}]]),br=Le("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 NS=A.createContext({}),jS=A.forwardRef(function(t,e){[t,e]=vF(t,e,NS);let{toolbarProps:n}=function(s,i){const{"aria-label":a,"aria-labelledby":l,orientation:c="horizontal"}=s;let[d,u]=A.useState(!1);yF(()=>{var m;u(!(!i.current||!(!((m=i.current.parentElement)===null||m===void 0)&&m.closest('[role="toolbar"]'))))});const{direction:f}=xF(),p=f==="rtl"&&c==="horizontal";let _=wF(i);const g=A.useRef(null);return{toolbarProps:{...x3(s,{labelable:!0}),role:d?"group":"toolbar","aria-orientation":c,"aria-label":a,"aria-labelledby":a==null?l:void 0,onKeyDownCapture:d?void 0:m=>{if(m.currentTarget.contains(m.target)){if(c==="horizontal"&&m.key==="ArrowRight"||c==="vertical"&&m.key==="ArrowDown")p?_.focusPrevious():_.focusNext();else{if(!(c==="horizontal"&&m.key==="ArrowLeft"||c==="vertical"&&m.key==="ArrowUp"))return m.key==="Tab"?(m.stopPropagation(),g.current=document.activeElement,void(m.shiftKey?_.focusFirst():_.focusLast())):void 0;p?_.focusNext():_.focusPrevious()}m.stopPropagation(),m.preventDefault()}},onFocusCapture:d?void 0:m=>{var b,x;g.current&&!m.currentTarget.contains(m.relatedTarget)&&(!((b=i.current)===null||b===void 0)&&b.contains(m.target))&&((x=g.current)===null||x===void 0||x.focus(),g.current=null)},onBlurCapture:d?void 0:m=>{m.currentTarget.contains(m.relatedTarget)||g.current||(g.current=m.target)}}}}(t,e),o=kF({...t,values:{orientation:t.orientation||"horizontal"},defaultClassName:"react-aria-Toolbar"}),r=x3(t);return delete r.id,K.createElement("div",{...SF(n,r),...o,ref:e,slot:t.slot||void 0,"data-orientation":t.orientation||"horizontal"},o.children)});function Ea(t,e){const n=+Mr(t)-+Mr(e);return n<0?-1:n>0?1:n}function ES(t,e){const n=Mr(t,e==null?void 0:e.in);return+function(o,r){const s=Mr(o,r==null?void 0:r.in);return s.setHours(23,59,59,999),s}(n,e)==+function(o,r){const s=Mr(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 IS(t,e,n){const[o,r,s]=Yf(n==null?void 0:n.in,t,t,e),i=Ea(r,s),a=Math.abs(function(d,u,f){const[p,_]=Yf(f==null?void 0:f.in,d,u);return 12*(p.getFullYear()-_.getFullYear())+(p.getMonth()-_.getMonth())}(r,s));if(a<1)return 0;r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-i*a);let l=Ea(r,s)===-i;ES(o)&&a===1&&Ea(o,s)===1&&(l=!1);const c=i*(a-+l);return c===0?0:c}function AS(t,e,n){const o=function(r,s){return+Mr(r)-+Mr(s)}(t,e)/1e3;return(r=>{const s=(0,Math.trunc)(r);return s===0?0:s})(o)}function TS(t,e){return function(n,o,r){const s=NF(),i=(r==null?void 0:r.locale)??s.locale??jF,a=Ea(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]=Yf(r==null?void 0:r.in,...a>0?[o,n]:[n,o]),u=AS(d,c),f=(w3(d)-w3(c))/1e3,p=Math.round((u-f)/60);let _;if(p<2)return p===0?i.formatDistance("lessThanXMinutes",1,l):i.formatDistance("xMinutes",p,l);if(p<45)return i.formatDistance("xMinutes",p,l);if(p<90)return i.formatDistance("aboutXHours",1,l);if(p<v3){const g=Math.round(p/60);return i.formatDistance("aboutXHours",g,l)}if(p<2520)return i.formatDistance("xDays",1,l);if(p<nc){const g=Math.round(p/v3);return i.formatDistance("xDays",g,l)}if(p<2*nc)return _=Math.round(p/nc),i.formatDistance("aboutXMonths",_,l);if(_=IS(d,c),_<12){const g=Math.round(p/nc);return i.formatDistance("xMonths",g,l)}{const g=_%12,m=Math.trunc(_/12);return g<3?i.formatDistance("aboutXYears",m,l):g<9?i.formatDistance("overXYears",m,l):i.formatDistance("almostXYears",m+1,l)}}(t,function(n){return CF(n,Date.now())}(t),e)}const MS=()=>{const t=X.c(7),{selectedLayout:e}=hS(),{setLayoutView:n}=fS();if(Bn()&&!Jf("wasm_layouts"))return null;let o,r,s,i;return t[0]!==n?(o=a=>n(a),t[0]=n,t[1]=o):o=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(ep,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:h.jsx(tp,{placeholder:"Select a view"})}),t[2]=r):r=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(s=h.jsx(Kf,{children:h.jsxs(k3,{children:[h.jsx(EF,{children:"View as"}),pS.map(DS)]})}),t[3]=s):s=t[3],t[4]!==e||t[5]!==o?(i=h.jsxs(np,{"data-testid":"layout-select",value:e,onValueChange:o,children:[r,s]}),t[4]=e,t[5]=o,t[6]=i):i=t[6],i};function OS(t){const e=Jm(t);return h.jsx(e,{className:"h-4 w-4"})}function Jm(t){switch(t){case"vertical":return Sm;case"grid":return r$;case"slides":return Zc;default:return oc(t),Qf}}function Km(t){return Zf(t)}function DS(t){return h.jsx(Xf,{value:t,children:h.jsxs("div",{className:"flex items-center gap-1.5 leading-5",children:[OS(t),h.jsx("span",{children:Km(t)})]})},t)}function RS(){const t=X.c(7);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0];const[n,o]=function(i,a){const l=X.c(11);let c;l[0]!==a?(c=new IF(a),l[0]=a,l[1]=c):c=l[1];const d=c;let u;l[2]!==i||l[3]!==d?(u=()=>d.get(i),l[2]=i,l[3]=d,l[4]=u):u=l[4];const[f,p]=A.useState(u);let _;l[5]!==i||l[6]!==d?(_=b=>{p(b),d.set(i,b)},l[5]=i,l[6]=d,l[7]=_):_=l[7];const g=_;let m;return l[8]!==g||l[9]!==f?(m=[f,g],l[8]=g,l[9]=f,l[10]=m):m=l[10],m}("marimo:commands",e);let r,s;return t[1]!==n||t[2]!==o?(r=i=>{const a=(l=[i,...n],[...new Set(l)]);var l;o(a.slice(0,3))},t[1]=n,t[2]=o,t[3]=r):r=t[3],t[4]!==n||t[5]!==r?(s={recentCommands:n,addRecentCommand:r},t[4]=n,t[5]=r,t[6]=s):s=t[6],s}function Xm(t){return t.dropdown!==void 0}function Ia(t,e=""){return t.flatMap(n=>n.label?Xm(n)?Ia(n.dropdown,`${e+n.label} > `):{...n,label:e+n.label}:[])}const ni=t=>{const e=X.c(8),{children:n,layerTop:o}=t,r=o!==void 0&&o;let s;e[0]!==n?(s=K.Children.toArray(n),e[0]=n,e[1]=s):s=e[1];const[i,a]=s,l=`second-icon absolute ${r?"top-[-2px] left-[-2px]":"bottom-[-2px] right-[-2px]"} rounded-full`;let c,d;return e[2]!==a||e[3]!==l?(c=h.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=h.jsxs("div",{className:"multi-icon relative w-fit",children:[i,c]}),e[5]=i,e[6]=c,e[7]=d):d=e[7],d};function od(t){const e=X.c(3),n=rd();let o;return e[0]!==t||e[1]!==n?(o=()=>{t!==void 0&&n([t])},e[0]=t,e[1]=n,e[2]=o):o=e[2],Qe(o)}function Zm(){const t=X.c(2),e=rd();let n;return t[0]!==e?(n=()=>e(N3(fo())),t[0]=e,t[1]=n):n=t[1],Qe(n)}function rd(){const t=X.c(2),{prepareForRun:e}=Lt();let n;return t[0]!==e?(n=async o=>{var a;if(o.length===0)return;const{cellHandles:r,cellData:s}=fo(),i=[];for(const l of o){const c=r[l],d=(a=c.current)==null?void 0:a.editorView;let u;d?(j3(d)!=="markdown"&&op(d),u=E3(d)):u=s[l].code,i.push(u),e({cellId:l})}await TF({cellIds:o,codes:i}).catch(PS)},t[0]=e,t[1]=n):n=t[1],Qe(n)}function PS(t){Xt.error(t)}const Aa=Zt(null),LS=Zt(!1),sd=I3("marimo:ai:chatState:v1",{chats:[],activeChatId:null}),FS=Zt(t=>{const e=t(sd);return e.chats.find(n=>n.id===e.activeChatId)},(t,e,n)=>{e(sd,o=>({...o,activeChatId:n}))}),id=t=>{const e=X.c(7);let n,o;e[0]!==t?(n=a=>{var l;(a.ctrlKey||a.metaKey)&&a.key==="z"&&(a.preventDefault(),a.stopPropagation(),(l=t.onClick)==null||l.call(t,a))},e[0]=t,e[1]=n):n=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(o={capture:!0},e[2]=o):o=e[2],rp(window,"keydown",n,o);const r=t.children??"Undo";let s,i;return e[3]===Symbol.for("react.memo_cache_sentinel")?(s=h.jsx(MF,{className:"ml-2",shortcut:"cmd-z"}),e[3]=s):s=e[3],e[4]!==r||e[5]!==t?(i=h.jsxs(Pe,{"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 ad(){const t=X.c(3),{deleteCell:e,undoDeleteCell:n}=Lt();let o;return t[0]!==e||t[1]!==n?(o=r=>{if(ut.get(A3))return;const{cellId:s}=r;e({cellId:s}),OF({cellId:s}).catch(()=>{n()});const{dismiss:i}=lt({title:"Cell deleted",description:"You can bring it back by clicking undo or through the command palette.",action:h.jsx(id,{"data-testid":"undo-delete-button",onClick:()=>{n(),a()}})}),a=i},t[0]=e,t[1]=n,t[2]=o):o=t[2],Qe(o)}function Qm(){const t=X.c(3),{splitCell:e,undoSplitCell:n}=Lt();let o;return t[0]!==e||t[1]!==n?(o=r=>{const s=rc(r.cellId);if(!s)return;const i=E3(s);e(r);const{dismiss:a}=lt({title:"Cell split",action:h.jsx(id,{"data-testid":"undo-split-button",size:"sm",variant:"outline",onClick:()=>{n({...r,snapshot:i}),l()},children:"Undo"})}),l=a},t[0]=e,t[1]=n,t[2]=o):o=t[2],Qe(o)}function ld(t){const e=X.c(49),{cell:n}=t,{createNewCell:o,updateCellConfig:r,updateCellName:s,moveCell:i,sendToTop:a,sendToBottom:l,addColumnBreakpoint:c,clearCellOutput:d}=Lt(),u=Qm(),f=od(n==null?void 0:n.cellId),p=!He(A3),_=ad(),{openModal:g}=Un(),m=Qt(Aa),b=He(sc),x=He(Ts),y=He(Ms),v=He(DF);if(!n||y){let N;return e[0]===Symbol.for("react.memo_cache_sentinel")?(N=[],e[0]=N):N=e[0],N}const{cellId:k,config:S,getEditorView:E,name:j,hasOutput:I,hasConsoleOutput:T,status:M}=n;let L;e[1]!==k||e[2]!==S.disabled||e[3]!==r?(L=async()=>{const N={disabled:!S.disabled};await Dr({configs:{[k]:N}}),r({cellId:k,config:N})},e[1]=k,e[2]=S.disabled,e[3]=r,e[4]=L):L=e[4];const B=L;let O;e[5]!==k||e[6]!==S.hide_code||e[7]!==E||e[8]!==r?(O=async()=>{const N={hide_code:!S.hide_code};await Dr({configs:{[k]:N}}),r({cellId:k,config:N});const H=E();H&&(N.hide_code?H.contentDOM.blur():H.focus())},e[5]=k,e[6]=S.hide_code,e[7]=E,e[8]=r,e[9]=O):O=e[9];const z=O;let F,V,P,C,$;return e[10]===Symbol.for("react.memo_cache_sentinel")?(F=h.jsx(Wm,{size:13,strokeWidth:1.5}),e[10]=F):F=e[10],e[11]!==k||e[12]!==j||e[13]!==g||e[14]!==s?(V=()=>{g(h.jsxs(cr,{children:[h.jsx(Os,{children:h.jsx(dr,{children:"Rename cell"})}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx(Rr,{htmlFor:"cell-name",children:"Cell name"}),h.jsx(gS,{placeholder:"cell name",value:j,onKeyDown:N=>{N.key==="Enter"&&(N.preventDefault(),N.stopPropagation(),g(null))},onChange:N=>s({cellId:k,name:N})})]})]}))},e[11]=k,e[12]=j,e[13]=g,e[14]=s,e[15]=V):V=e[15],e[16]!==k||e[17]!==s?(P=N=>s({cellId:k,name:N}),e[16]=k,e[17]=s,e[18]=P):P=e[18],e[19]!==j||e[20]!==P?(C=h.jsx(gS,{placeholder:"cell name",value:j,onChange:P}),e[19]=j,e[20]=P,e[21]=C):C=e[21],e[22]!==c||e[23]!==b||e[24]!==v||e[25]!==x||e[26]!==p||e[27]!==k||e[28]!==d||e[29]!==S.disabled||e[30]!==S.hide_code||e[31]!==o||e[32]!==_||e[33]!==E||e[34]!==T||e[35]!==I||e[36]!==i||e[37]!==j||e[38]!==f||e[39]!==l||e[40]!==a||e[41]!==m||e[42]!==u||e[43]!==M||e[44]!==V||e[45]!==C||e[46]!==B||e[47]!==z?($=[[{icon:F,label:"Name",disableClick:!0,handle:VS,handleHeadless:V,rightElement:C},{icon:h.jsx(Qs,{size:13,strokeWidth:1.5}),label:"Run cell",hotkey:"cell.run",hidden:M==="running"||M==="queued"||M==="disabled-transitively"||S.disabled,handle:()=>f()},{icon:h.jsx(Xi,{size:13,strokeWidth:1.5}),label:"AI completion",hidden:!b,handle:()=>{m(N=>(N==null?void 0:N.cellId)===k?null:{cellId:k})},hotkey:"cell.aiCompletion"},{icon:h.jsx(Qc,{size:13,strokeWidth:1.5}),label:"Split cell",hotkey:"cell.splitCell",handle:()=>u({cellId:k})},{icon:h.jsx(Xp,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!I,handle:()=>function(N){const H=document.getElementById(S3.create(N));H&&(H.classList.add("printing-output"),C3(H,"result.png").finally(()=>{H.classList.remove("printing-output")}))}(k)},{icon:h.jsx(PF,{size:13,strokeWidth:1.5}),label:"Format cell",hotkey:"cell.format",handle:()=>{const N=E();N&&RF({[k]:N})}},{icon:S.hide_code?h.jsx(T3,{size:13,strokeWidth:1.5}):h.jsx(M3,{size:13,strokeWidth:1.5}),label:S.hide_code?"Show code":"Hide code",handle:z,hotkey:"cell.hideCode"},{icon:S.disabled?h.jsx(_r,{size:13,strokeWidth:1.5}):h.jsx(br,{size:13,strokeWidth:1.5}),label:"Reactive execution",rightElement:h.jsx(LF,{"data-testid":"cell-disable-switch",checked:!S.disabled,size:"sm",onCheckedChange:B}),handle:B},{icon:h.jsx(sp,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(I||T),handle:()=>{d({cellId:k})}}],[{icon:h.jsx(ic,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:()=>{const N=E();N&&(ar(x,o),Or(N,"markdown",{keepCodeAsIs:!1}))}},{icon:h.jsx(lr,{size:13,strokeWidth:1.5}),label:"Convert to SQL",handle:()=>{const N=E();N&&(ar(x,o),Or(N,"sql",{keepCodeAsIs:!1}))}},{icon:h.jsx(ac,{}),label:"Toggle as Python",handle:()=>{const N=E();N&&(ar(x,o),FF(N,"python",{force:!0}))}}],[{icon:h.jsxs(ni,{children:[h.jsx(va,{size:13,strokeWidth:1.5}),h.jsx(O3,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>o({cellId:k,before:!0})},{icon:h.jsxs(ni,{children:[h.jsx(va,{size:13,strokeWidth:1.5}),h.jsx(Zi,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>o({cellId:k,before:!1})},{icon:h.jsx(O3,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>i({cellId:k,before:!0})},{icon:h.jsx(Zi,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>i({cellId:k,before:!1})},{icon:h.jsx(D3,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>i({cellId:k,direction:"left"}),hidden:v!=="columns"},{icon:h.jsx(lc,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>i({cellId:k,direction:"right"}),hidden:v!=="columns"},{icon:h.jsx(im,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>a({cellId:k})},{icon:h.jsx(sm,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>l({cellId:k})},{icon:h.jsx(zF,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",hidden:v!=="columns",handle:()=>c({cellId:k})}],[{icon:h.jsx(lS,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!mS(j),tooltip:mS(j)?void 0:"Only named cells can be linked to",handle:async()=>{await yn(k$(j)),lt({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!p,variant:"danger",icon:h.jsx(ip,{size:13,strokeWidth:1.5}),handle:()=>{_({cellId:k})}}]].map(BS).filter(zS),e[22]=c,e[23]=b,e[24]=v,e[25]=x,e[26]=p,e[27]=k,e[28]=d,e[29]=S.disabled,e[30]=S.hide_code,e[31]=o,e[32]=_,e[33]=E,e[34]=T,e[35]=I,e[36]=i,e[37]=j,e[38]=f,e[39]=l,e[40]=a,e[41]=m,e[42]=u,e[43]=M,e[44]=V,e[45]=C,e[46]=B,e[47]=z,e[48]=$):$=e[48],$}function zS(t){return t.length>0}function BS(t){return t.filter(US)}function US(t){return!t.hidden}function VS(t){t==null||t.stopPropagation(),t==null||t.preventDefault()}function $S(t){return!t.hidden}const cd=Zt(!1),eg=()=>{const t=X.c(37),[e,n]=fn(cd),o=UF(),r=He(VF),s=He(ap);let i;t[0]!==r?(i={cell:r},t[0]=r,t[1]=i):i=t[1];let a=ld(i).flat();a=Ia(a);const l=function(){const P=X.c(45),{theme:C}=Fo(),[$,N]=Ds(),[H,G]=R3();let Z;P[0]!==N?(Z=async ce=>{await Rs({config:ce}).then(()=>{N(ce)})},P[0]=N,P[1]=Z):Z=P[1];const q=Z;let re;P[2]!==G?(re=async ce=>{await BF({config:ce}).then(()=>{G(ce)})},P[2]=G,P[3]=re):re=P[3];const ne=re;let oe;if(P[4]!==H||P[5]!==$||P[6]!==ne||P[7]!==q||P[8]!==C){let ce,he,de;P[10]!==H?(ce=et=>et!==H.width,P[10]=H,P[11]=ce):ce=P[11],P[12]!==H||P[13]!==ne?(he=et=>({label:`App config > Set width=${et}`,handle:()=>{ne({...H,width:et})}}),P[12]=H,P[13]=ne,P[14]=he):he=P[14],P[15]!==$||P[16]!==q||P[17]!==C?(de={label:"Config > Toggle dark mode",handle:()=>{q({...$,display:{...$.display,theme:C==="dark"?"light":"dark"}})}},P[15]=$,P[16]=q,P[17]=C,P[18]=de):de=P[18];const me=$.keymap.preset==="vim";let ie,Ce;P[19]!==$||P[20]!==q?(ie=()=>{q({...$,keymap:{...$.keymap,preset:"vim"}})},P[19]=$,P[20]=q,P[21]=ie):ie=P[21],P[22]!==me||P[23]!==ie?(Ce={label:"Config > Switch keymap to VIM",hidden:me,handle:ie},P[22]=me,P[23]=ie,P[24]=Ce):Ce=P[24];const we=$.keymap.preset==="default";let ae,ve,ge;P[25]!==$||P[26]!==q?(ae=()=>{q({...$,keymap:{...$.keymap,preset:"default"}})},P[25]=$,P[26]=q,P[27]=ae):ae=P[27],P[28]!==ae||P[29]!==we?(ve={label:"Config > Switch keymap to default (current: VIM)",hidden:we,handle:ae},P[28]=ae,P[29]=we,P[30]=ve):ve=P[30],P[31]!==$||P[32]!==q?(ge=()=>{q({...$,completion:{...$.completion,copilot:!1}})},P[31]=$,P[32]=q,P[33]=ge):ge=P[33];const be=$.completion.copilot!=="github";let Te,ze;P[34]!==ge||P[35]!==be?(Te={label:"Config > Disable GitHub Copilot",handle:ge,hidden:be},P[34]=ge,P[35]=be,P[36]=Te):Te=P[36],P[37]!==$||P[38]!==q?(ze=()=>{q({...$,completion:{...$.completion,copilot:"github"}})},P[37]=$,P[38]=q,P[39]=ze):ze=P[39];const Xe=$.completion.copilot==="github";let Fe;P[40]!==ze||P[41]!==Xe?(Fe={label:"Config > Enable GitHub Copilot",handle:ze,hidden:Xe},P[40]=ze,P[41]=Xe,P[42]=Fe):Fe=P[42],oe=[...s$().filter(ce).map(he),de,Ce,ve,Te,Fe],P[4]=H,P[5]=$,P[6]=ne,P[7]=q,P[8]=C,P[9]=oe}else oe=P[9];const Y=oe;let Q;return P[43]!==Y?(Q=Y.filter($S),P[43]=Y,P[44]=Q):Q=P[44],Q}();let c=Ig();c=[...Ia(c),...Ia(l)];const d=c.filter(HS),u=cc.keyBy(d,WS),{recentCommands:f,addRecentCommand:p}=RS();let _;t[2]!==f?(_=new Set(f),t[2]=f,t[3]=_):_=t[3];const g=_;let m,b;t[4]!==s||t[5]!==n?(m=P=>{WF(s.getHotkey("global.commandPalette").key)(P)&&(P.preventDefault(),n(qS))},t[4]=s,t[5]=n,t[6]=m):m=t[6],rp(document,"keydown",m),t[7]!==p||t[8]!==s||t[9]!==o||t[10]!==n?(b=(P,C)=>{const $=o[P];if(!$)return null;const N=s.getHotkey(P);return h.jsxs(po,{disabled:C.disabled,onSelect:()=>{p(P),n(!1),requestAnimationFrame(()=>{$()})},value:N.name,children:[h.jsxs("span",{children:[N.name,C.tooltip&&h.jsx("span",{className:"ml-2",children:C.tooltip})]}),h.jsx(L3,{children:h.jsx(dp,{shortcut:N.key})})]},P)},t[7]=p,t[8]=s,t[9]=o,t[10]=n,t[11]=b):b=t[11];const x=b;let y;t[12]!==p||t[13]!==s||t[14]!==n?(y=(P,C,$,N)=>{const H=$===void 0?{}:$;return h.jsxs(po,{disabled:H.disabled,onSelect:()=>{p(P),n(!1),requestAnimationFrame(()=>{C()})},value:P,children:[h.jsxs("span",{children:[P,H.tooltip&&h.jsxs("span",{className:"ml-2",children:["(",H.tooltip,")"]})]}),N&&h.jsx(L3,{children:h.jsx(dp,{shortcut:s.getHotkey(N).key})})]},P)},t[12]=p,t[13]=s,t[14]=n,t[15]=y):y=t[15];const v=y,k=HF;let S;t[16]===Symbol.for("react.memo_cache_sentinel")?(S=h.jsx(Qi,{placeholder:"Type to search..."}),t[16]=S):S=t[16];const E=cp;let j;t[17]===Symbol.for("react.memo_cache_sentinel")?(j=h.jsx(dc,{children:"No results found."}),t[17]=j):j=t[17];const I=f.length>0&&h.jsxs(h.Fragment,{children:[h.jsx(lp,{heading:"Recently Used",children:f.map(P=>{const C=u[P];return $F(P)?x(P,{disabled:C==null?void 0:C.disabled,tooltip:C==null?void 0:C.tooltip}):C&&!Xm(C)?v(C.label,C.handleHeadless||C.handle,{disabled:C.disabled,tooltip:C.tooltip}):null})}),h.jsx(P3,{})]}),T=lp,M=s.iterate().map(P=>{if(g.has(P))return null;const C=u[P];return x(P,{disabled:C==null?void 0:C.disabled,tooltip:C==null?void 0:C.tooltip})}),L=d.map(P=>g.has(P.label)?null:v(P.label,P.handleHeadless||P.handle,{disabled:P.disabled,tooltip:P.tooltip}));let B;t[18]!==g||t[19]!==v?(B=P=>g.has(P.label)?null:v(`Cell > ${P.label}`,P.handleHeadless||P.handle,{disabled:P.disabled,tooltip:P.tooltip}),t[18]=g,t[19]=v,t[20]=B):B=t[20];const O=a.map(B);let z,F,V;return t[21]!==T||t[22]!==L||t[23]!==O||t[24]!==M?(z=h.jsxs(T,{heading:"Commands",children:[M,L,O]}),t[21]=T,t[22]=L,t[23]=O,t[24]=M,t[25]=z):z=t[25],t[26]!==E||t[27]!==z||t[28]!==j||t[29]!==I?(F=h.jsxs(E,{children:[j,I,z]}),t[26]=E,t[27]=z,t[28]=j,t[29]=I,t[30]=F):F=t[30],t[31]!==k||t[32]!==e||t[33]!==n||t[34]!==F||t[35]!==S?(V=h.jsxs(k,{open:e,onOpenChange:n,children:[S,F]}),t[31]=k,t[32]=e,t[33]=n,t[34]=F,t[35]=S,t[36]=V):V=t[36],V};function HS(t){return!t.hotkey}function WS(t){return t.label}function qS(t){return!t}const Ta="https://static.marimo.app",GS=t=>{const e=X.c(24),{onClose:n}=t,[o,r]=A.useState("");let s;s=Math.random().toString(36).slice(2,6);const i=`${o}-${s}`,a=`${Ta}/static/${i}`;let l,c,d,u,f,p,_,g,m,b,x;return e[0]!==n||e[1]!==i?(l=async y=>{y.preventDefault(),n();const v=await qF({download:!1,includeCode:!0,files:_S.INSTANCE.filenames()}),k=lt({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${Ta}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:v,path:i})}).catch(()=>{k.dismiss(),lt({title:"Error uploading static page",description:h.jsxs("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",h.jsx("a",{href:Kn.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),k.dismiss(),lt({title:"Static page uploaded!",description:h.jsxs("div",{children:["The URL has been copied to your clipboard.",h.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=h.jsx(dr,{children:"Share static notebook"}),e[3]=c):c=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsxs(Os,{children:[c,h.jsxs(Ps,{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"," ",h.jsx("a",{href:Ta,target:"_blank",children:Ta}),"."]})]}),e[4]=d):d=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(u=y=>{const v=y.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,"");r(v)},e[5]=u):u=e[5],e[6]!==o?(f=h.jsx(ur,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:u,required:!0,autoComplete:"off"}),e[6]=o,e[7]=f):f=e[7],e[8]!==a?(p=h.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:",h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(YS,{text:a}),h.jsx("span",{className:"text-primary",children:a})]})]}),e[8]=a,e[9]=p):p=e[9],e[10]!==f||e[11]!==p?(_=h.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[f,p]}),e[10]=f,e[11]=p,e[12]=_):_=e[12],e[13]!==n?(g=h.jsx(Pe,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),e[13]=n,e[14]=g):g=e[14],e[15]!==a?(m=h.jsx(Pe,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await yn(a)},children:"Create"}),e[15]=a,e[16]=m):m=e[16],e[17]!==m||e[18]!==g?(b=h.jsxs(ea,{children:[g,m]}),e[17]=m,e[18]=g,e[19]=b):b=e[19],e[20]!==b||e[21]!==l||e[22]!==_?(x=h.jsx(cr,{className:"w-fit",children:h.jsxs("form",{onSubmit:l,children:[d,_,b]})}),e[20]=b,e[21]=l,e[22]=_,e[23]=x):x=e[23],x},YS=t=>{const e=X.c(8),[n,o]=K.useState(!1);let r;e[0]!==t.text?(r=Vn.stopPropagation(async c=>{c.preventDefault(),await yn(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=h.jsx(Ls,{size:14,strokeWidth:1.5}),e[2]=i):i=e[2],e[3]!==s?(a=h.jsx(Pe,{"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=h.jsx(Re,{content:"Copied!",open:n,children:a}),e[5]=n,e[6]=a,e[7]=l):l=e[7],l};function tg(){const t=X.c(3),{openConfirm:e}=Un(),n=Qt(mo);let o;return t[0]!==e||t[1]!==n?(o=()=>{e({title:"Restart Kernel",description:"This will restart the Python kernel. You'll lose all data that's in memory. You will also lose any unsaved changes, so make sure to save your work before restarting.",variant:"destructive",confirmAction:h.jsx(F3,{onClick:async()=>{n({state:en.CLOSING}),await GF(),YF()},"aria-label":"Confirm Restart",children:"Restart"})})},t[0]=e,t[1]=n,t[2]=o):o=t[2],o}const dd=[{type:"files",Icon:_m,tooltip:"View files",position:"sidebar"},{type:"variables",Icon:uc,tooltip:"Explore variables",position:"sidebar"},{type:"datasources",Icon:lr,tooltip:"Explore data sources",position:"sidebar"},{type:"dependencies",Icon:Ca,tooltip:"Explore dependencies",position:"sidebar"},{type:"packages",Icon:ba,tooltip:"Manage packages",position:"sidebar"},{type:"outline",Icon:ed,tooltip:"View outline",position:"sidebar"},{type:"chat",Icon:up,tooltip:"Chat with AI",position:"sidebar"},{type:"documentation",Icon:td,tooltip:"View live docs",position:"sidebar"},{type:"logs",Icon:hp,tooltip:"Notebook logs",position:"sidebar"},{type:"tracing",Icon:i$,tooltip:"Tracing",position:"sidebar"},{type:"snippets",Icon:zm,tooltip:"Snippets",position:"sidebar"},{type:"secrets",Icon:vm,tooltip:"Secrets",hidden:Bn(),position:"sidebar"},{type:"scratchpad",Icon:JF,tooltip:"Scratchpad",position:"sidebar"},{type:"errors",Icon:sp,tooltip:"View errors",position:"footer"}];function ng(){const t=X.c(2),e=Qt(fp);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=Fs.parse(i.parentNode.id);break}}e(i=>({mode:KF(i.mode),cellAnchor:s})),requestAnimationFrame(()=>{var i;s!==null&&((i=document.getElementById(Fs.create(s)))==null||i.scrollIntoView())})},t[0]=e,t[1]=n):n=t[1],n}function yr(){return Ae.string().optional().describe(Ye.of({label:"Password",inputType:"password",placeholder:"password",optionRegex:".*password.*"}))}function og(){return Ae.string().optional().describe(Ye.of({label:"Token",inputType:"password",placeholder:"token",optionRegex:".*token.*"}))}function Ma(){return Ae.string().optional().describe(Ye.of({label:"Warehouse Name",placeholder:"warehouse",optionRegex:".*warehouse.*"}))}function rg(){return Ae.string().optional().describe(Ye.of({label:"URI",optionRegex:".*uri.*"}))}function xr(){return Ae.string().nonempty().describe(Ye.of({label:"Host",placeholder:"localhost",optionRegex:".*host.*"}))}function _o(){return Ae.string().describe(Ye.of({label:"Database",placeholder:"db name",optionRegex:".*database.*"}))}function wr(){return Ae.string().nonempty().describe(Ye.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function vr(t){const e=Ae.coerce.string().describe(Ye.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 sg(){return Ae.boolean().default(!1).describe(Ye.of({label:"Read Only"}))}const ig=Ae.object({type:Ae.literal("postgres"),host:xr(),port:vr(5432).optional(),database:_o(),username:wr(),password:yr(),ssl:Ae.boolean().default(!1).describe(Ye.of({label:"Use SSL"}))}).describe(Ye.of({direction:"two-columns"})),ag=Ae.object({type:Ae.literal("mysql"),host:xr(),port:vr(3306),database:_o(),username:wr(),password:yr(),ssl:Ae.boolean().default(!1).describe(Ye.of({label:"Use SSL"}))}).describe(Ye.of({direction:"two-columns"})),lg=Ae.object({type:Ae.literal("sqlite"),database:_o().describe(Ye.of({label:"Database Path"}))}).describe(Ye.of({direction:"two-columns"})),cg=Ae.object({type:Ae.literal("duckdb"),database:_o().describe(Ye.of({label:"Database Path"})),read_only:sg()}).describe(Ye.of({direction:"two-columns"})),dg=Ae.object({type:Ae.literal("motherduck"),database:_o().default("my_db").describe(Ye.of({label:"Database Name"})),token:og()}).describe(Ye.of({direction:"two-columns"})),ug=Ae.object({type:Ae.literal("snowflake"),account:Ae.string().nonempty().describe(Ye.of({label:"Account",optionRegex:".*snowflake.*"})),warehouse:Ae.string().optional().describe(Ye.of({label:"Warehouse",optionRegex:".*snowflake.*"})),database:_o(),schema:Ae.string().optional().describe(Ye.of({label:"Schema",optionRegex:".*snowflake.*"})),username:wr(),password:yr(),role:Ae.string().optional().describe(Ye.of({label:"Role"}))}).describe(Ye.of({direction:"two-columns"})),hg=Ae.object({type:Ae.literal("bigquery"),project:Ae.string().nonempty().describe(Ye.of({label:"Project ID",optionRegex:".*bigquery.*"})),dataset:Ae.string().nonempty().describe(Ye.of({label:"Dataset",optionRegex:".*bigquery.*"})),credentials_json:Ae.string().describe(Ye.of({label:"Credentials JSON",inputType:"textarea"}))}).describe(Ye.of({direction:"two-columns"})),fg=Ae.object({type:Ae.literal("clickhouse_connect"),host:xr(),port:vr(8123).optional(),username:wr(),password:yr(),secure:Ae.boolean().default(!1).describe(Ye.of({label:"Use HTTPs"}))}).describe(Ye.of({direction:"two-columns"})),pg=Ae.object({type:Ae.literal("timeplus"),host:xr().default("localhost"),port:vr(8123).optional(),username:wr().default("default"),password:yr().default("")}).describe(Ye.of({direction:"two-columns"})),mg=Ae.object({type:Ae.literal("chdb"),database:_o().describe(Ye.of({label:"Database Path"})),read_only:sg()}).describe(Ye.of({direction:"two-columns"})),gg=Ae.object({type:Ae.literal("trino"),host:xr(),port:vr(8080),database:_o(),schema:Ae.string().describe(Ye.of({label:"Schema",placeholder:"schema name",optionRegex:".*schema.*"})).optional(),username:wr(),password:yr(),async_support:Ae.boolean().default(!1).describe(Ye.of({label:"Async Support"}))}).describe(Ye.of({direction:"two-columns"})),_g=Ae.object({type:Ae.literal("iceberg"),name:Ae.string().describe(Ye.of({label:"Catalog Name"})),catalog:Ae.discriminatedUnion("type",[Ae.object({type:Ae.literal("REST"),warehouse:Ma(),uri:Ae.string().optional().describe(Ye.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:og()}),Ae.object({type:Ae.literal("SQL"),warehouse:Ma(),uri:Ae.string().optional().describe(Ye.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),Ae.object({type:Ae.literal("Hive"),warehouse:Ma(),uri:rg()}),Ae.object({type:Ae.literal("Glue"),warehouse:Ma(),uri:rg()}),Ae.object({type:Ae.literal("DynamoDB"),"dynamodb.profile-name":Ae.string().optional().describe(Ye.of({label:"Profile Name"})),"dynamodb.region":Ae.string().optional().describe(Ye.of({label:"Region"})),"dynamodb.access-key-id":Ae.string().optional().describe(Ye.of({label:"Access Key ID"})),"dynamodb.secret-access-key":Ae.string().optional().describe(Ye.of({label:"Secret Access Key",inputType:"password"})),"dynamodb.session-token":Ae.string().optional().describe(Ye.of({label:"Session Token",inputType:"password"}))})]).default({type:"REST"}).describe(Ye.of({special:"tabs"}))}),bg=Ae.object({type:Ae.literal("datafusion"),sessionContext:Ae.boolean().optional().describe(Ye.of({label:"Use Session Context"}))}),yg=Ae.object({type:Ae.literal("pyspark"),host:xr().optional(),port:vr().optional()}),xg=Ae.object({type:Ae.literal("redshift"),host:xr(),port:vr(5439),connectionType:Ae.discriminatedUnion("type",[Ae.object({type:Ae.literal("IAM credentials"),region:Ae.string().describe(Ye.of({label:"Region"})),aws_access_key_id:Ae.string().nonempty().describe(Ye.of({label:"AWS Access Key ID",inputType:"password",optionRegex:".*aws_access_key_id.*"})),aws_secret_access_key:Ae.string().nonempty().describe(Ye.of({label:"AWS Secret Access Key",inputType:"password",optionRegex:".*aws_secret_access_key.*"})),aws_session_token:Ae.string().optional().describe(Ye.of({label:"AWS Session Token",inputType:"password",optionRegex:".*aws_session_token.*"}))}),Ae.object({type:Ae.literal("DB credentials"),user:wr(),password:yr()})]).default({type:"IAM credentials",aws_access_key_id:"",aws_secret_access_key:"",region:""}),database:_o()}).describe(Ye.of({direction:"two-columns"})),JS=Ae.discriminatedUnion("type",[ig,ag,lg,cg,dg,ug,hg,fg,pg,mg,gg,_g,bg,yg,xg]),ud="env:";function Oa(t){return typeof t=="string"&&t.startsWith(ud)}function hd(t){return`${ud}${t}`}const wg={sqlmodel:"SQLModel",sqlalchemy:"SQLAlchemy",duckdb:"DuckDB",clickhouse_connect:"ClickHouse Connect",chdb:"chDB",pyiceberg:"PyIceberg",ibis:"Ibis",motherduck:"MotherDuck",redshift:"Redshift"};class an{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 KS{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),Oa(n)){const r=n.replace(ud,""),s=o?`os.environ.get("${r}", "${o}")`:`os.environ.get("${r}")`;return this.secrets[e]=s,e}if(o!=null){const r=`os.environ.get("${n}", "${o}")`;return this.secrets[e]=r,e}return typeof n=="number"||typeof n=="number"?`${n}`:typeof n=="boolean"?Br(n):n?`"${n}"`:""}printInFString(e,n,o){if(n===void 0)return"";if(typeof n=="number")return`${n}`;if(typeof n=="boolean")return Br(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 Oa(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 XS extends an{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})
@@ -36,7 +36,7 @@ ${Da(n,o=>` ${o}`)},
36
36
  engine = ${this.orm}.connect(${e}, read_only=${Br(this.connection.read_only)})
37
37
  `)}}class aC extends an{generateImports(){return this.connection.async_support?["import aiotrino"]:["import trino.sqlalchemy"]}generateConnectionCode(){const e=this.connection.async_support?"aiotrino":"trino",n=this.connection.schema?`/${this.connection.schema}`:"",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),a=this.secrets.printPassword(this.connection.password,"TRINO_PASSWORD",!0);return St(`
38
38
  engine = ${this.orm}.create_engine(f"${e}://${o}:${a}@${r}:${s}/${i}${n}")
39
- `)}}class lC extends an{generateImports(){switch(this.connection.catalog.type){case"REST":return["from pyiceberg.catalog.rest import RestCatalog"];case"SQL":return["from pyiceberg.catalog.sql import SqlCatalog"];case"Hive":return["from pyiceberg.catalog.hive import HiveCatalog"];case"Glue":return["from pyiceberg.catalog.glue import GlueCatalog"];case"DynamoDB":return["from pyiceberg.catalog.dynamodb import DynamoDBCatalog"];default:pp(this.connection.catalog)}}generateConnectionCode(){let e={...this.connection.catalog};e=Object.fromEntries(Object.entries(e).filter(([i,a])=>a!=null&&a!==""&&i!=="type"));for(const[i,a]of Object.entries(e))Oa(a)?e[i]=this.secrets.print(i,a):typeof a=="string"&&(e[i]=`"${a}"`);const n=(o=e,r=i=>` ${i}`,Object.entries(o).filter(([,i])=>i!=null&&i!=="").map(([i,a])=>{const l=`"${i}"`;return r(typeof a=="boolean"?`${l}: ${Br(a)}`:`${l}: ${a}`)}).join(`,
39
+ `)}}class lC extends an{generateImports(){switch(this.connection.catalog.type){case"REST":return["from pyiceberg.catalog.rest import RestCatalog"];case"SQL":return["from pyiceberg.catalog.sql import SqlCatalog"];case"Hive":return["from pyiceberg.catalog.hive import HiveCatalog"];case"Glue":return["from pyiceberg.catalog.glue import GlueCatalog"];case"DynamoDB":return["from pyiceberg.catalog.dynamodb import DynamoDBCatalog"];default:mp(this.connection.catalog)}}generateConnectionCode(){let e={...this.connection.catalog};e=Object.fromEntries(Object.entries(e).filter(([i,a])=>a!=null&&a!==""&&i!=="type"));for(const[i,a]of Object.entries(e))Oa(a)?e[i]=this.secrets.print(i,a):typeof a=="string"&&(e[i]=`"${a}"`);const n=(o=e,r=i=>` ${i}`,Object.entries(o).filter(([,i])=>i!=null&&i!=="").map(([i,a])=>{const l=`"${i}"`;return r(typeof a=="boolean"?`${l}: ${Br(a)}`:`${l}: ${a}`)}).join(`,
40
40
  `));var o,r;const s=`"${this.connection.name}"`;switch(this.connection.catalog.type){case"REST":return St(`
41
41
  catalog = RestCatalog(
42
42
  ${s},
@@ -72,7 +72,7 @@ ${n}
72
72
  ${n}
73
73
  },
74
74
  )
75
- `);default:pp(this.connection.catalog)}}}class cC extends an{generateImports(){return["import ibis","from datafusion import SessionContext"]}generateConnectionCode(){return this.connection.sessionContext?St(`
75
+ `);default:mp(this.connection.catalog)}}}class cC extends an{generateImports(){return["import ibis","from datafusion import SessionContext"]}generateConnectionCode(){return this.connection.sessionContext?St(`
76
76
  ctx = SessionContext()
77
77
  # Sample table
78
78
  _ = ctx.from_pydict({"a": [1, 2, 3]}, "my_table")
@@ -93,51 +93,51 @@ ${Da(d,u=>` ${u}`)},
93
93
  con = redshift_connector.connect(
94
94
  ${Da(i,a=>` ${a}`)},
95
95
  )
96
- `)}}class hC{constructor(){this.secrets=new KS}createGenerator(e,n){switch(e.type){case"postgres":return new XS(e,n,this.secrets);case"mysql":return new ZS(e,n,this.secrets);case"sqlite":return new QS(e,n,this.secrets);case"snowflake":return new eC(e,n,this.secrets);case"bigquery":return new tC(e,n,this.secrets);case"duckdb":return new nC(e,n,this.secrets);case"motherduck":return new oC(e,n,this.secrets);case"clickhouse_connect":return new rC(e,n,this.secrets);case"timeplus":return new sC(e,n,this.secrets);case"chdb":return new iC(e,n,this.secrets);case"trino":return new aC(e,n,this.secrets);case"iceberg":return new lC(e,n,this.secrets);case"datafusion":return new cC(e,n,this.secrets);case"pyspark":return new dC(e,n,this.secrets);case"redshift":return new uC(e,n,this.secrets);default:pp(e)}}}function Br(t){return t.toString().charAt(0).toUpperCase()+t.toString().slice(1)}function Da(t,e){return Object.entries(t).filter(([,n])=>n!=null&&n!=="").map(([n,o])=>e(typeof o=="boolean"?`${n}=${Br(o)}`:`${n}=${o}`)).join(`,
97
- `)}function vg(t){return t.sort((e,n)=>e.provider==="env"?1:n.provider==="env"?-1:0)}const kg=t=>{const e=X.c(42),{providerNames:n,onClose:o,onSuccess:r}=t,[s,i]=K.useState(""),[a,l]=K.useState(""),[c,d]=K.useState(n[0]);let u;e[0]!==s||e[1]!==c||e[2]!==r||e[3]!==a?(u=async V=>{if(V.preventDefault(),c)if(s&&a&&c)try{await ZF({key:s,value:a,provider:"dotenv",name:c}),lt({title:"Secret created",description:"The secret has been created successfully."}),r(s)}catch{lt({title:"Error",description:"Failed to create secret. Please try again.",variant:"danger"})}else lt({title:"Error",description:"Please fill in all fields.",variant:"danger"});else lt({title:"Error",description:"No location selected for the secret.",variant:"danger"})},e[0]=s,e[1]=c,e[2]=r,e[3]=a,e[4]=u):u=e[4];const f=u;let p,_,g,m,b,x,y,v,k,S,E,j,I,T,M,L;e[5]===Symbol.for("react.memo_cache_sentinel")?(p=h.jsxs(Os,{children:[h.jsx(dr,{children:"Add Secret"}),h.jsx(Ps,{children:"Add a new secret to your environment variables."})]}),e[5]=p):p=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(_=h.jsx(Rr,{htmlFor:"key",children:"Key"}),e[6]=_):_=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(g=V=>{i(V.target.value.replaceAll(/\W/g,"_"))},e[7]=g):g=e[7],e[8]!==s?(m=h.jsxs("div",{className:"grid gap-2",children:[_,h.jsx(ur,{id:"key",value:s,onChange:g,placeholder:"MY_SECRET_KEY",required:!0})]}),e[8]=s,e[9]=m):m=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(b=h.jsx(Rr,{htmlFor:"value",children:"Value"}),e[10]=b):b=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(x=V=>l(V.target.value),e[11]=x):x=e[11],e[12]!==a?(y=h.jsx(ur,{id:"value",type:"text",value:a,onChange:x,required:!0,autoComplete:"off"}),e[12]=a,e[13]=y):y=e[13],e[14]===Symbol.for("react.memo_cache_sentinel")?(v=window.location.href.startsWith("http://")&&h.jsx(z3,{children:"Note: You are sending this key over http."}),e[14]=v):v=e[14],e[15]!==y?(k=h.jsxs("div",{className:"grid gap-2",children:[b,y,v]}),e[15]=y,e[16]=k):k=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(S=h.jsx(Rr,{htmlFor:"location",children:"Location"}),e[17]=S):S=e[17],e[18]!==n.length?(E=n.length===0&&h.jsx("p",{className:"text-sm text-muted-foreground",children:"No dotenv locations configured."}),e[18]=n.length,e[19]=E):E=e[19],e[20]!==c||e[21]!==n?(j=n.length>0&&h.jsxs(tp,{value:c,onValueChange:V=>d(V),children:[h.jsx(Qf,{children:h.jsx(ep,{placeholder:"Select a provider"})}),h.jsx(Jf,{children:n.map(fC)})]}),e[20]=c,e[21]=n,e[22]=j):j=e[22],e[23]===Symbol.for("react.memo_cache_sentinel")?(I=h.jsxs(z3,{children:["You can configure the location by setting the"," ",h.jsx(mp,{href:"https://links.marimo.app/dotenv",children:"dotenv configuration"}),"."]}),e[23]=I):I=e[23],e[24]!==E||e[25]!==j?(T=h.jsxs("div",{className:"grid gap-2",children:[S,E,j,I]}),e[24]=E,e[25]=j,e[26]=T):T=e[26],e[27]!==k||e[28]!==T||e[29]!==m?(M=h.jsxs("div",{className:"grid gap-4 py-4",children:[m,k,T]}),e[27]=k,e[28]=T,e[29]=m,e[30]=M):M=e[30],e[31]!==o?(L=h.jsx(Pe,{type:"button",variant:"outline",onClick:o,children:"Cancel"}),e[31]=o,e[32]=L):L=e[32];const B=!s||!a||!c;let O,z,F;return e[33]!==B?(O=h.jsx(Pe,{type:"submit",disabled:B,children:"Add Secret"}),e[33]=B,e[34]=O):O=e[34],e[35]!==L||e[36]!==O?(z=h.jsxs(ea,{children:[L,O]}),e[35]=L,e[36]=O,e[37]=z):z=e[37],e[38]!==f||e[39]!==M||e[40]!==z?(F=h.jsx(cr,{children:h.jsxs("form",{onSubmit:f,children:[p,M,z]})}),e[38]=f,e[39]=M,e[40]=z,e[41]=F):F=e[41],F};function fC(t){return h.jsx(Kf,{value:t,children:t},t)}const Sg=A.createContext({providerNames:[],secretKeys:[],loading:!1,error:void 0,refreshSecrets:jn.NOOP}),pC=t=>{const e=X.c(14),{children:n}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],e[0]=o):o=e[0];const{data:r,loading:s,error:i,reload:a}=Xn(bC,o);let l,c,d,u;return e[1]!==(r==null?void 0:r.secretKeys)?(l=(r==null?void 0:r.secretKeys)||[],e[1]=r==null?void 0:r.secretKeys,e[2]=l):l=e[2],e[3]!==(r==null?void 0:r.providerNames)?(c=(r==null?void 0:r.providerNames)||[],e[3]=r==null?void 0:r.providerNames,e[4]=c):c=e[4],e[5]!==i||e[6]!==s||e[7]!==a||e[8]!==l||e[9]!==c?(d={secretKeys:l,providerNames:c,loading:s,error:i,refreshSecrets:a},e[5]=i,e[6]=s,e[7]=a,e[8]=l,e[9]=c,e[10]=d):d=e[10],e[11]!==n||e[12]!==d?(u=h.jsx(Sg.Provider,{value:d,children:n}),e[11]=n,e[12]=d,e[13]=u):u=e[13],u};function mC(t){return t.provider!=="env"}function gC(t){return t.name}function _C(t){return t.keys}async function bC(){const t=await bS.request({}),e=vg(t.secrets).filter(mC).map(gC);return{secretKeys:t.secrets.flatMap(_C).sort(),providerNames:e}}const Cg=[{name:"PostgreSQL",schema:ig,color:"#336791",logo:"postgres",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"MySQL",schema:ag,color:"#00758F",logo:"mysql",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"SQLite",schema:lg,color:"#003B57",logo:"sqlite",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"DuckDB",schema:cg,color:"#FFD700",logo:"duckdb",connectionLibraries:{libraries:["duckdb"],preferred:"duckdb"}},{name:"MotherDuck",schema:dg,color:"#ff9538",logo:"motherduck",connectionLibraries:{libraries:["duckdb"],preferred:"duckdb"}},{name:"Snowflake",schema:ug,color:"#29B5E8",logo:"snowflake",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"ClickHouse",schema:fg,color:"#2C2C1D",logo:"clickhouse",connectionLibraries:{libraries:["clickhouse_connect"],preferred:"clickhouse_connect"}},{name:"Timeplus",schema:pg,color:"#B83280",logo:"timeplus",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"BigQuery",schema:hg,color:"#4285F4",logo:"bigquery",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"ClickHouse Embedded",schema:mg,color:"#f2b611",logo:"clickhouse",connectionLibraries:{libraries:["chdb"],preferred:"chdb"}},{name:"Trino",schema:gg,color:"#d466b6",logo:"trino",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"DataFusion",schema:bg,color:"#202A37",logo:"datafusion",connectionLibraries:{libraries:["ibis"],preferred:"ibis"}},{name:"PySpark",schema:yg,color:"#1C5162",logo:"pyspark",connectionLibraries:{libraries:["ibis"],preferred:"ibis"}},{name:"Redshift",schema:xg,color:"#522BAE",logo:"redshift",connectionLibraries:{libraries:["redshift"],preferred:"redshift"}}],Ng=[{name:"Iceberg",schema:_g,color:"#000000",logo:"iceberg",connectionLibraries:{libraries:["pyiceberg"],preferred:"pyiceberg"}}],yC=t=>{const e=X.c(14),{onSelect:n}=t;let o;e[0]!==n?(o=u=>{const{name:f,schema:p,color:_,logo:g}=u;return h.jsxs("button",{type:"button",className:"py-3 flex flex-col items-center justify-center gap-1 transition-all hover:scale-105 hover:brightness-110 rounded shadow-smSolid hover:shadow-mdSolid",style:{backgroundColor:_},onClick:()=>n(p),children:[h.jsx(q3,{name:g,className:"w-8 h-8 text-white brightness-0 invert dark:invert"}),h.jsx("span",{className:"text-white font-medium text-lg",children:f})]},f)},e[0]=n,e[1]=o):o=e[1];const r=o;let s,i,a,l,c,d;return e[2]!==r?(s=Cg.map(r),e[2]=r,e[3]=s):s=e[3],e[4]!==s?(i=h.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:s}),e[4]=s,e[5]=i):i=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsxs("h4",{className:"font-semibold text-muted-foreground text-lg flex items-center gap-4",children:["Data Catalogs",h.jsx("hr",{className:"flex-1"})]}),e[6]=a):a=e[6],e[7]!==r?(l=Ng.map(r),e[7]=r,e[8]=l):l=e[8],e[9]!==l?(c=h.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:l}),e[9]=l,e[10]=c):c=e[10],e[11]!==i||e[12]!==c?(d=h.jsxs(h.Fragment,{children:[i,a,c]}),e[11]=i,e[12]=c,e[13]=d):d=e[13],d},xC=[{isMatch:t=>{if(t instanceof Ae.ZodString||t instanceof Ae.ZodNumber){const{optionRegex:e}=Ye.parse(t._def.description||"");return!!e}return!1},Component:({schema:t,form:e,path:n})=>{const{secretKeys:o,providerNames:r,refreshSecrets:s}=A.useContext(Sg),{openModal:i,closeModal:a}=Un(),{label:l,description:c,optionRegex:d=""}=Ye.parse(t._def.description||""),[u,f]=Ft(o,p=>new RegExp(d,"i").test(p));return h.jsx(B3,{control:e.control,name:n,render:({field:p})=>h.jsxs(U3,{children:[h.jsx(QF,{children:l}),h.jsx(ez,{children:c}),h.jsx(V3,{children:h.jsxs("div",{className:"flex gap-2",children:[t instanceof Ae.ZodString?h.jsx(ur,{...p,value:p.value,onChange:p.onChange,className:Oe("flex-1")}):h.jsx(tz,{...p,value:p.value,onChange:p.onChange,className:"flex-1"}),h.jsxs(hc,{children:[h.jsx(fc,{asChild:!0,children:h.jsx(Pe,{variant:"outline",size:"icon",className:Oe(Oa(p.value)&&"bg-accent"),children:h.jsx(Yc,{className:"h-3 w-3"})})}),h.jsxs(pc,{align:"end",className:"max-h-60 overflow-y-auto",children:[h.jsxs(sn,{onSelect:()=>{i(h.jsx(kg,{providerNames:r,onSuccess:_=>{s(),p.onChange(ud(_)),a()},onClose:a}))},children:[h.jsx(va,{className:"mr-2 h-3.5 w-3.5"}),"Create a new secret"]}),u.length>0&&h.jsxs(h.Fragment,{children:[h.jsx(zo,{}),h.jsx(nz,{children:"Recommended"})]}),u.map(_=>h.jsx(sn,{onSelect:()=>p.onChange(ud(_)),children:_},_)),f.length>0&&h.jsx(zo,{}),f.map(_=>h.jsx(sn,{onSelect:()=>p.onChange(ud(_)),children:_},_))]})]})]})}),h.jsx($3,{})]})})}}],wC=t=>{var $;const e=X.c(49),{schema:n,onSubmit:o,onBack:r}=t;let s,i,a;e[0]!==n?(s=oz(n),e[0]=n,e[1]=s):s=e[1],e[2]!==n?(i=H3(n),e[2]=n,e[3]=i):i=e[3],e[4]!==s||e[5]!==i?(a={defaultValues:s,resolver:i,reValidateMode:"onChange"},e[4]=s,e[5]=i,e[6]=a):a=e[6];const l=W3(a),c=($=[...Cg,...Ng].find(N=>N.schema===n))==null?void 0:$.connectionLibraries,[d,u]=A.useState((c==null?void 0:c.preferred)??"sqlalchemy"),{createNewCell:f}=Lt(),p=zs();let _;e[7]!==f||e[8]!==p?(_=N=>{f({code:N,before:!1,cellId:p??"__end__",skipIfCodeExists:!0})},e[7]=f,e[8]=p,e[9]=_):_=e[9];const g=_;let m;e[10]!==g||e[11]!==o||e[12]!==d?(m=N=>{g(function(H,G){if(!(G in wg))throw new Error(`Unsupported library: ${G}`);JS.parse(H);const Z=new hC,q=Z.createGenerator(H,G),re=q.generateConnectionCode(),ne=Z.secrets,oe=[...new Set([...ne.imports,...q.imports])].sort();oe.push("");const Y=ne.formatSecrets();return Y&&oe.push(Y),oe.push(re.trim()),oe.join(`
98
- `)}(N,d)),o()},e[10]=g,e[11]=o,e[12]=d,e[13]=m):m=e[13];const b=m;let x;e[14]!==l||e[15]!==b?(x=l.handleSubmit(b),e[14]=l,e[15]=b,e[16]=x):x=e[16];let y,v;e[17]===Symbol.for("react.memo_cache_sentinel")?(y=h.jsx(rz,{}),e[17]=y):y=e[17],e[18]!==l||e[19]!==n?(v=h.jsx(pC,{children:h.jsx(sz,{schema:n,form:l,renderers:xC,children:y})}),e[18]=l,e[19]=n,e[20]=v):v=e[20];let k;e[21]!==r?(k=h.jsx(Pe,{type:"button",variant:"outline",onClick:r,children:"Back"}),e[21]=r,e[22]=k):k=e[22];const S=!l.formState.isValid;let E,j;e[23]!==S?(E=h.jsx(Pe,{type:"submit",disabled:S,children:"Add"}),e[23]=S,e[24]=E):E=e[24],e[25]!==k||e[26]!==E?(j=h.jsxs("div",{className:"flex gap-2",children:[k,E]}),e[25]=k,e[26]=E,e[27]=j):j=e[27];const I=tp;let T,M;e[28]===Symbol.for("react.memo_cache_sentinel")?(T=N=>u(N),e[28]=T):T=e[28],e[29]===Symbol.for("react.memo_cache_sentinel")?(M=h.jsxs("div",{className:"flex flex-col gap-1 items-end",children:[h.jsx(Qf,{children:h.jsx(ep,{placeholder:"Select a library"})}),h.jsx("span",{className:"text-xs text-muted-foreground",children:"Preferred connection library"})]}),e[29]=M):M=e[29];const L=Jf,B=k3,O=c==null?void 0:c.libraries.map(kC);let z,F,V,P,C;return e[30]!==B||e[31]!==O?(z=h.jsx(B,{children:O}),e[30]=B,e[31]=O,e[32]=z):z=e[32],e[33]!==L||e[34]!==z?(F=h.jsx(L,{children:z}),e[33]=L,e[34]=z,e[35]=F):F=e[35],e[36]!==I||e[37]!==d||e[38]!==T||e[39]!==M||e[40]!==F?(V=h.jsx("div",{children:h.jsxs(I,{value:d,onValueChange:T,children:[M,F]})}),e[36]=I,e[37]=d,e[38]=T,e[39]=M,e[40]=F,e[41]=V):V=e[41],e[42]!==j||e[43]!==V?(P=h.jsxs("div",{className:"flex gap-2 justify-between",children:[j,V]}),e[42]=j,e[43]=V,e[44]=P):P=e[44],e[45]!==P||e[46]!==x||e[47]!==v?(C=h.jsxs("form",{onSubmit:x,className:"space-y-4",children:[v,P]}),e[45]=P,e[46]=x,e[47]=v,e[48]=C):C=e[48],C},vC=t=>{const e=X.c(5),{onSubmit:n}=t,[o,r]=A.useState(null);if(!o){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx(yC,{onSelect:r}),e[0]=a):a=e[0],a}let s,i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(s=()=>r(null),e[1]=s):s=e[1],e[2]!==n||e[3]!==o?(i=h.jsx(wC,{schema:o,onSubmit:n,onBack:s}),e[2]=n,e[3]=o,e[4]=i):i=e[4],i},jg=t=>{const e=X.c(6),{children:n}=t,[o,r]=A.useState(!1);let s,i,a;return e[0]!==n?(s=h.jsx(iz,{asChild:!0,children:n}),e[0]=n,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsx(Eg,{onClose:()=>r(!1)}),e[2]=i):i=e[2],e[3]!==o||e[4]!==s?(a=h.jsxs(az,{open:o,onOpenChange:r,children:[s,i]}),e[3]=o,e[4]=s,e[5]=a):a=e[5],a},Eg=t=>{const e=X.c(4),{onClose:n}=t;let o,r,s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx(dr,{children:"Add Connection"}),e[0]=o):o=e[0],e[1]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsxs(Os,{className:"mb-4",children:[o,h.jsxs(Ps,{children:["Connect to your database or data catalog to query data directly from your notebook. Learn more about how to connect to your database in our"," ",h.jsx(mp,{href:"https://docs.marimo.io/guides/working_with_data/sql/#connecting-to-a-custom-database",children:"docs."})]})]}),e[1]=r):r=e[1],e[2]!==n?(s=h.jsxs(cr,{className:"max-h-[75vh] overflow-y-auto",children:[r,h.jsx(vC,{onSubmit:()=>n()})]}),e[2]=n,e[3]=s):s=e[3],s};function kC(t){return h.jsx(Kf,{value:t,children:wg[t]},t)}const SC=()=>{const t=X.c(2),{updateCellConfig:e}=Lt();let n;return t[0]!==e?(n=async()=>{const o=new ta,r=fo(),s=r.cellIds.inOrderIds,i={};for(const l of s){if(r.cellData[l]===void 0)continue;const{code:c,config:d}=r.cellData[l];d.hide_code||o.isSupported(c)&&(i[l]={hide_code:!0})}const a=cc.entries(i);if(a.length!==0){await Dr({configs:i});for(const[l,c]of a)e({cellId:l,config:c})}},t[0]=e,t[1]=n):n=t[1],n},oi=t=>{t==null||t.preventDefault(),t==null||t.stopPropagation()};function Ig(){const t=X.c(150),e=mc(),{openModal:n,closeModal:o}=Un(),{toggleApplication:r}=na(),{selectedPanel:s}=gc(),[i]=fn(hp),a=He(Ms),l=SC(),{updateCellConfig:c,undoDeleteCell:d,clearAllCellOutputs:u,upsertSetupCell:f,collapseAllCells:p,expandAllCells:_}=Lt(),g=tg(),m=Zm(),b=function(Pt){const wt=X.c(4),{openPrompt:Cn,closeModal:Nn}=Un();let As;return wt[0]!==Nn||wt[1]!==Cn||wt[2]!==Pt?(As=()=>{if(!Pt)return null;const ec=fp.guessDeliminator(Pt),Hf=$n.basename(Pt);Cn({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${Hf}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:Wf=>{const tc=ec.join($n.dirname(Pt),Wf);XF({source:Pt,destination:tc}).then(()=>{Nn(),lt({title:"Notebook copied",description:"A copy of the notebook has been created."}),window.open(`/?file=${tc}`,"_blank")})}})},wt[0]=Nn,wt[1]=Cn,wt[2]=Pt,wt[3]=As):As=wt[3],As}(e),x=Qt(ld),y=Qt(a$),v=Qt(l$),k=He(lz),S=He(cz),E=He(G3),{selectedLayout:j}=hS(),{setLayoutView:I}=fS(),T=ng(),M=qC;let L,B,O,z,F,V,P,C,$,N,H,G,Z;t[0]===Symbol.for("react.memo_cache_sentinel")?(L=h.jsx(Lm,{size:14,strokeWidth:1.5}),t[0]=L):L=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(B=h.jsx(uz,{size:14,strokeWidth:1.5}),t[1]=B):B=t[1],t[2]!==o||t[3]!==n?(O={icon:B,label:"Publish HTML to web",handle:async()=>{n(h.jsx(GS,{onClose:o}))}},t[2]=o,t[3]=n,t[4]=O):O=t[4],t[5]===Symbol.for("react.memo_cache_sentinel")?(z={icon:h.jsx(lS,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",handle:WC},t[5]=z):z=t[5],t[6]!==O?(F={icon:L,label:"Share",handle:oi,dropdown:[O,z]},t[6]=O,t[7]=F):F=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(V=h.jsx(gp,{size:14,strokeWidth:1.5}),t[8]=V):V=t[8],t[9]===Symbol.for("react.memo_cache_sentinel")?(P=h.jsx(yS,{size:14,strokeWidth:1.5}),t[9]=P):P=t[9],t[10]!==e?(C={icon:P,label:"Download as HTML",handle:async()=>{e?await xS({filename:e,includeCode:!0}):lt({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."})}},t[10]=e,t[11]=C):C=t[11],t[12]===Symbol.for("react.memo_cache_sentinel")?($=h.jsx(yS,{size:14,strokeWidth:1.5}),t[12]=$):$=t[12],t[13]!==e?(N={icon:$,label:"Download as HTML (exclude code)",handle:async()=>{e?await xS({filename:e,includeCode:!1}):lt({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."})}},t[13]=e,t[14]=N):N=t[14],t[15]===Symbol.for("react.memo_cache_sentinel")?(H={icon:h.jsx(ic,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:HC},G={icon:h.jsx(dm,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:$C},t[15]=H,t[16]=G):(H=t[15],G=t[16]),t[17]===Symbol.for("react.memo_cache_sentinel")?(Z=h.jsx(Xp,{size:14,strokeWidth:1.5}),t[17]=Z):Z=t[17];const q=i.mode!=="present";let re,ne,oe;t[18]!==i.mode?(re=i.mode==="present"?void 0:h.jsxs("span",{children:["Only available in app view. ",h.jsx("br",{}),"Toggle with: ",pn("global.hideCode",!1)]}),t[18]=i.mode,t[19]=re):re=t[19],t[20]!==q||t[21]!==re?(ne={divider:!0,icon:Z,label:"Download as PNG",disabled:q,tooltip:re,handle:VC},t[20]=q,t[21]=re,t[22]=ne):ne=t[22],t[23]===Symbol.for("react.memo_cache_sentinel")?(oe=h.jsx(hz,{size:14,strokeWidth:1.5}),t[23]=oe):oe=t[23];const Y=i.mode!=="present";let Q,ce,he,de,me,ie,Ce,we,ae,ve,ge,be,Te,ze,Xe;if(t[24]!==i.mode?(Q=i.mode==="present"?void 0:h.jsxs("span",{children:["Only available in app view. ",h.jsx("br",{}),"Toggle with: ",pn("global.hideCode",!1)]}),t[24]=i.mode,t[25]=Q):Q=t[25],t[26]!==Y||t[27]!==Q?(ce={icon:oe,label:"Download as PDF",disabled:Y,tooltip:Q,handle:BC},t[26]=Y,t[27]=Q,t[28]=ce):ce=t[28],t[29]!==ne||t[30]!==ce||t[31]!==C||t[32]!==N?(he={icon:V,label:"Download",handle:oi,dropdown:[C,N,H,G,ne,ce]},t[29]=ne,t[30]=ce,t[31]=C,t[32]=N,t[33]=he):he=t[33],t[34]===Symbol.for("react.memo_cache_sentinel")?(de=h.jsx(Tm,{size:14,strokeWidth:1.5}),t[34]=de):de=t[34],t[35]!==s||t[36]!==r?(me=cd.flatMap(Pt=>{const{type:wt,Icon:Cn,hidden:Nn}=Pt;return Nn?[]:{label:Xf(wt),rightElement:M(s===wt),icon:h.jsx(Cn,{size:14,strokeWidth:1.5}),handle:()=>r(wt)}}),t[35]=s,t[36]=r,t[37]=me):me=t[37],t[38]!==me?(ie={divider:!0,icon:de,label:"Helper panel",handle:oi,dropdown:me},t[38]=me,t[39]=ie):ie=t[39],t[40]===Symbol.for("react.memo_cache_sentinel")?(Ce=h.jsx(Xc,{size:14,strokeWidth:1.5}),t[40]=Ce):Ce=t[40],t[41]!==i.mode?(we=i.mode==="present"?h.jsx(Y3,{size:14,strokeWidth:1.5}):h.jsx(Jc,{size:14,strokeWidth:1.5}),t[41]=i.mode,t[42]=we):we=t[42],t[43]!==T?(ae=()=>{T()},t[43]=T,t[44]=ae):ae=t[44],t[45]!==we||t[46]!==ae?(ve={icon:we,label:"Toggle app view",hotkey:"global.hideCode",handle:ae},t[45]=we,t[46]=ae,t[47]=ve):ve=t[47],t[48]!==j||t[49]!==I||t[50]!==ve||t[51]!==T||t[52]!==i.mode){let Pt;t[54]!==j||t[55]!==I||t[56]!==T||t[57]!==i.mode?(Pt=(wt,Cn)=>{const Nn=Jm(wt);return{divider:Cn===0,label:Km(wt),icon:h.jsx(Nn,{size:14,strokeWidth:1.5}),rightElement:h.jsx("div",{className:"w-8 flex justify-end",children:j===wt&&h.jsx(_c,{size:14})}),handle:()=>{I(wt),i.mode==="edit"&&T()}}},t[54]=j,t[55]=I,t[56]=T,t[57]=i.mode,t[58]=Pt):Pt=t[58],ge={icon:Ce,label:"Present as",handle:oi,dropdown:[ve,...pS.map(Pt)]},t[48]=j,t[49]=I,t[50]=ve,t[51]=T,t[52]=i.mode,t[53]=ge}else ge=t[53];t[59]===Symbol.for("react.memo_cache_sentinel")?(be=h.jsx(gm,{size:14,strokeWidth:1.5}),t[59]=be):be=t[59],t[60]!==e?(Te=!e||Bn(),t[60]=e,t[61]=Te):Te=t[61],t[62]!==b||t[63]!==Te?(ze={icon:be,label:"Create notebook copy",hidden:Te,handle:b},t[62]=b,t[63]=Te,t[64]=ze):ze=t[64],t[65]===Symbol.for("react.memo_cache_sentinel")?(Xe=h.jsx(Hc,{size:14,strokeWidth:1.5}),t[65]=Xe):Xe=t[65];const Fe=!e;let et,nt;t[66]!==Fe?(et={icon:Xe,label:"Copy code to clipboard",hidden:Fe,handle:zC},t[66]=Fe,t[67]=et):et=t[67],t[68]===Symbol.for("react.memo_cache_sentinel")?(nt=h.jsx(br,{size:14,strokeWidth:1.5}),t[68]=nt):nt=t[68];const it=!k||a;let te,Ne,Me;t[69]!==c?(te=async()=>{const Pt=fo(),wt=fz(Pt),Cn=cc.fromEntries(wt.map(FC));await Dr({configs:Cn});for(const Nn of wt)c({cellId:Nn,config:{disabled:!1}})},t[69]=c,t[70]=te):te=t[70],t[71]!==it||t[72]!==te?(Ne={icon:nt,label:"Enable all cells",hidden:it,handle:te},t[71]=it,t[72]=te,t[73]=Ne):Ne=t[73],t[74]===Symbol.for("react.memo_cache_sentinel")?(Me=h.jsx(_r,{size:14,strokeWidth:1.5}),t[74]=Me):Me=t[74];const Be=!S||a;let J,pe,_e,ue,je,ke,Ve,Ze,le,Ee,Ie,Ue,We,De,Ge;t[75]!==c?(J=async()=>{const Pt=fo(),wt=N3(Pt),Cn=cc.fromEntries(wt.map(LC));await Dr({configs:Cn});for(const Nn of wt)c({cellId:Nn,config:{disabled:!0}})},t[75]=c,t[76]=J):J=t[76],t[77]!==Be||t[78]!==J?(pe={icon:Me,label:"Disable all cells",hidden:Be,handle:J},t[77]=Be,t[78]=J,t[79]=pe):pe=t[79],t[80]===Symbol.for("react.memo_cache_sentinel")?(_e=h.jsx(M3,{size:14,strokeWidth:1.5}),t[80]=_e):_e=t[80],t[81]!==l?(ue={icon:_e,label:"Hide all markdown code",handle:l},t[81]=l,t[82]=ue):ue=t[82],t[83]===Symbol.for("react.memo_cache_sentinel")?(je=h.jsx(lm,{size:14,strokeWidth:1.5}),t[83]=je):je=t[83],t[84]!==p?(ke={icon:je,label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:p},t[84]=p,t[85]=ke):ke=t[85],t[86]===Symbol.for("react.memo_cache_sentinel")?(Ve=h.jsx(am,{size:14,strokeWidth:1.5}),t[86]=Ve):Ve=t[86],t[87]!==_?(Ze={icon:Ve,label:"Expand all sections",hotkey:"global.expandAllSections",handle:_},t[87]=_,t[88]=Ze):Ze=t[88],t[89]===Symbol.for("react.memo_cache_sentinel")?(le=h.jsx(hm,{size:14,strokeWidth:1.5}),t[89]=le):le=t[89],t[90]!==f?(Ee={icon:le,label:"Add setup cell",handle:()=>{f({code:"# Initialization code that runs before all other cells"})}},t[90]=f,t[91]=Ee):Ee=t[91],t[92]===Symbol.for("react.memo_cache_sentinel")?(Ie=h.jsx(rp,{size:14,strokeWidth:1.5}),t[92]=Ie):Ie=t[92],t[93]!==u?(Ue={icon:Ie,label:"Clear all outputs",handle:()=>{u()}},t[93]=u,t[94]=Ue):Ue=t[94],t[95]===Symbol.for("react.memo_cache_sentinel")?(We=h.jsx(pm,{size:14,strokeWidth:1.5}),t[95]=We):We=t[95],t[96]!==m?(De={icon:We,label:"Re-run all cells",hotkey:"global.runAll",handle:async()=>{m()}},t[96]=m,t[97]=De):De=t[97],t[98]===Symbol.for("react.memo_cache_sentinel")?(Ge=h.jsx(td,{size:14,strokeWidth:1.5}),t[98]=Ge):Ge=t[98];const ot=!E||a;let Je,rt,mt,yt,Mt,xt,Bt,Sn,hn,rn,Kt,Jn,ho,vs,ks,Ss,Cs,Ns,ir,js;t[99]!==d?(Je=()=>{d()},t[99]=d,t[100]=Je):Je=t[100],t[101]!==ot||t[102]!==Je?(rt={icon:Ge,label:"Undo cell deletion",hidden:ot,handle:Je},t[101]=ot,t[102]=Je,t[103]=rt):rt=t[103],t[104]===Symbol.for("react.memo_cache_sentinel")?(mt=h.jsx(lr,{size:14,strokeWidth:1.5}),t[104]=mt):mt=t[104],t[105]!==o||t[106]!==n?(yt={icon:mt,label:"Add database connection",handle:()=>{n(h.jsx(Eg,{onClose:o}))}},t[105]=o,t[106]=n,t[107]=yt):yt=t[107],t[108]===Symbol.for("react.memo_cache_sentinel")?(Mt=h.jsx(Wc,{size:14,strokeWidth:1.5}),t[108]=Mt):Mt=t[108],t[109]!==x?(xt={divider:!0,icon:Mt,label:"Command palette",hotkey:"global.commandPalette",handle:()=>x(PC)},t[109]=x,t[110]=xt):xt=t[110],t[111]===Symbol.for("react.memo_cache_sentinel")?(Bt=h.jsx(J3,{size:14,strokeWidth:1.5}),t[111]=Bt):Bt=t[111],t[112]!==y?(Sn={icon:Bt,label:"User settings",handle:()=>y(RC)},t[112]=y,t[113]=Sn):Sn=t[113],t[114]===Symbol.for("react.memo_cache_sentinel")?(hn=h.jsx(km,{size:14,strokeWidth:1.5}),t[114]=hn):hn=t[114],t[115]!==v?(rn={icon:hn,label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>v(DC)},t[115]=v,t[116]=rn):rn=t[116],t[117]===Symbol.for("react.memo_cache_sentinel")?(Kt={icon:h.jsx(cS,{size:14,strokeWidth:1.5}),label:"Open documentation",handle:OC},Jn=h.jsx(bc,{size:14,strokeWidth:1.5}),t[117]=Kt,t[118]=Jn):(Kt=t[117],Jn=t[118]),t[119]===Symbol.for("react.memo_cache_sentinel")?(ho={icon:Jn,label:"Resources",handle:oi,dropdown:[{icon:h.jsx(cS,{size:14,strokeWidth:1.5}),label:"Documentation",handle:MC},{icon:h.jsx(c$,{size:14,strokeWidth:1.5}),label:"GitHub",handle:TC},{icon:h.jsx(d$,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:AC},{icon:h.jsx(u$,{size:14,strokeWidth:1.5}),label:"YouTube",handle:IC},{icon:h.jsx(up,{size:14,strokeWidth:1.5}),label:"Changelog",handle:EC}]},t[119]=ho):ho=t[119],t[120]===Symbol.for("react.memo_cache_sentinel")?(vs=h.jsx(wm,{size:14,strokeWidth:1.5}),t[120]=vs):vs=t[120],t[121]===Symbol.for("react.memo_cache_sentinel")?(ks={divider:!0,icon:vs,label:"Return home",hidden:!location.search.includes("file"),handle:jC},Ss=h.jsx(Sa,{size:14,strokeWidth:1.5}),t[121]=ks,t[122]=Ss):(ks=t[121],Ss=t[122]),t[123]===Symbol.for("react.memo_cache_sentinel")?(Cs={icon:Ss,label:"New notebook",hidden:!location.search.includes("file"),handle:NC},Ns=h.jsx($m,{size:14,strokeWidth:1.5}),t[123]=Cs,t[124]=Ns):(Cs=t[123],Ns=t[124]),t[125]!==g?(ir={icon:Ns,label:"Restart kernel",variant:"danger",handle:g},t[125]=g,t[126]=ir):ir=t[126],t[127]!==he||t[128]!==ie||t[129]!==ge||t[130]!==ze||t[131]!==et||t[132]!==Ne||t[133]!==F||t[134]!==pe||t[135]!==ue||t[136]!==ke||t[137]!==Ze||t[138]!==Ee||t[139]!==Ue||t[140]!==De||t[141]!==rt||t[142]!==yt||t[143]!==xt||t[144]!==Sn||t[145]!==rn||t[146]!==ir?(js=[F,he,ie,ge,ze,et,Ne,pe,ue,ke,Ze,Ee,Ue,De,rt,yt,xt,Sn,rn,Kt,ho,ks,Cs,ir],t[127]=he,t[128]=ie,t[129]=ge,t[130]=ze,t[131]=et,t[132]=Ne,t[133]=F,t[134]=pe,t[135]=ue,t[136]=ke,t[137]=Ze,t[138]=Ee,t[139]=Ue,t[140]=De,t[141]=rt,t[142]=yt,t[143]=xt,t[144]=Sn,t[145]=rn,t[146]=ir,t[147]=js):js=t[147];const Es=js;let Is;return t[148]!==Es?(Is=Es.filter(CC),t[148]=Es,t[149]=Is):Is=t[149],Is}function CC(t){return!t.hidden}function NC(){const t=dz();window.open(t,"_blank")}function jC(){const t=document.baseURI.split("?")[0];window.open(t,"_self")}function EC(){window.open(Kn.releasesPage,"_blank")}function IC(){window.open(Kn.youtube,"_blank")}function AC(){window.open(Kn.discordLink,"_blank")}function TC(){window.open(Kn.githubPage,"_blank")}function MC(){window.open(Kn.docsPage,"_blank")}function OC(){window.open(Kn.docsPage,"_blank")}function DC(t){return!t}function RC(t){return!t}function PC(t){return!t}function LC(t){return[t,{disabled:!0}]}function FC(t){return[t,{disabled:!1}]}async function zC(){const t=await _p();await yn(t.contents),lt({title:"Copied",description:"Code copied to clipboard."})}async function BC(){const t=new Event("export-beforeprint"),e=new Event("export-afterprint");window.dispatchEvent(t),setTimeout(UC,0),setTimeout(()=>window.dispatchEvent(e),0)}function UC(){return window.print()}async function VC(){const t=document.getElementById("App");t&&await C3(t,document.title)}async function $C(){const t=await _p();oa(new Blob([t.contents],{type:"text/plain"}),K3.toPY(document.title))}async function HC(){const t=await pz({download:!1});oa(new Blob([t],{type:"text/plain"}),K3.toMarkdown(document.title))}async function WC(){const t=await _p(),e=mz({code:t.contents});await yn(e),lt({title:"Copied",description:"Link copied to clipboard."})}function qC(t){return h.jsx("div",{className:"w-8 flex justify-end",children:t&&h.jsx(_c,{size:14})})}const GC=()=>{const t=X.c(10),e=Ig();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=h.jsx(xn,{"aria-label":"Config",shape:"circle",size:"small",className:"h-[27px] w-[27px]","data-testid":"notebook-menu-dropdown",color:"hint-green",children:h.jsx(S$,{strokeWidth:1.8})}),t[0]=n):n=t[0];const o=n,r=YC;let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=f=>{const p=h.jsx(sn,{variant:f.variant,disabled:f.disabled,onSelect:_=>f.handle(_),"data-testid":`notebook-menu-dropdown-${f.label}`,children:r(f)},f.label);return f.tooltip?h.jsx(Re,{content:f.tooltip,side:"left",delayDuration:100,children:h.jsx("span",{children:p})},f.label):p},t[1]=s):s=t[1];const i=s;let a,l,c,d,u;if(t[2]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx(fc,{asChild:!0,children:o}),t[2]=a):a=t[2],t[3]!==e){let f;t[5]===Symbol.for("react.memo_cache_sentinel")?(f=p=>p.hidden?null:p.dropdown?h.jsxs(_z,{children:[h.jsx(bz,{"data-testid":`notebook-menu-dropdown-${p.label}`,children:r(p)}),h.jsx(yz,{children:h.jsx(xz,{children:p.dropdown.map(_=>h.jsxs(K.Fragment,{children:[_.divider&&h.jsx(zo,{}),i(_)]},_.label))})})]},p.label):h.jsxs(K.Fragment,{children:[p.divider&&h.jsx(zo,{}),i(p)]},p.label),t[5]=f):f=t[5],l=e.map(f),t[3]=e,t[4]=l}else l=t[4];return t[6]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(zo,{}),t[6]=c):c=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsx("div",{className:"flex-1 px-2 text-xs text-muted-foreground",children:h.jsxs("span",{children:["Version: ",gz()]})}),t[7]=d):d=t[7],t[8]!==l?(u=h.jsxs(hc,{modal:!1,children:[a,h.jsxs(pc,{align:"end",className:"no-print w-[240px]",children:[l,c,d]})]}),t[8]=l,t[9]=u):u=t[9],u};function YC(t){return h.jsxs(h.Fragment,{children:[t.icon&&h.jsx("span",{className:"flex-0 mr-2",children:t.icon}),h.jsx("span",{className:"flex-1",children:t.labelElement||t.label}),t.hotkey&&h.jsx(wz,{shortcut:t.hotkey,className:"ml-4"}),t.rightElement]})}const tn=vz({findText:"",replaceText:"",caseSensitive:!1,wholeWord:!1,regexp:!1,isOpen:!1,currentView:void 0},(t,e)=>{if(e===void 0)return t;switch(e.type){case"setFind":return{...t,findText:e.find};case"setReplace":return{...t,replaceText:e.replace};case"setCaseSensitive":return{...t,caseSensitive:e.caseSensitive};case"setWholeWord":return{...t,wholeWord:e.wholeWord};case"setRegex":return{...t,regexp:e.regexp};case"setIsOpen":return{...t,isOpen:e.isOpen};case"setCurrentView":return{...t,currentView:{view:e.view,range:e.range}};case"clearCurrentView":return{...t,currentView:void 0}}});function Ag(t){if([...document.querySelectorAll('[role="dialog"][data-state="open"]')].some(e=>e instanceof HTMLElement&&e.childNodes.length>0))return!1;if(t){const e=t.state.selection.main,n=t.state.sliceDoc(e.from,e.to);n?(ut.set(tn,{type:"setFind",find:n}),ut.set(tn,{type:"setCurrentView",view:t,range:{from:e.from,to:e.to}})):ut.set(tn,{type:"setCurrentView",view:t,range:{from:0,to:0}})}return ut.get(tn).isOpen?(ut.set(tn,{type:"setIsOpen",isOpen:!1}),requestAnimationFrame(()=>{ut.set(tn,{type:"setIsOpen",isOpen:!0})}),!0):(ut.set(tn,{type:"setIsOpen",isOpen:!0}),!0)}function JC(){return!!ut.get(tn).isOpen&&(ut.set(tn,{type:"setIsOpen",isOpen:!1}),!0)}function hd(t){return Bo("create"in t,'Expected query to have a "create" method'),t}function Ra(t){return()=>{const e=ut.get(tn),n=new yc({search:e.findText,caseSensitive:e.caseSensitive,regexp:e.regexp,replace:e.replaceText,wholeWord:e.wholeWord});return!!n.valid&&t({query:hd(n).create(),search:n})}}const Tg=t=>Ra(({query:e})=>{const n=Bs(),o=ut.get(tn).currentView||{view:n[0],range:{from:0,to:0}};let r=o.range.to;t==="prev"&&(n.reverse(),r=o.range.from);let s=n.indexOf(o.view);s<0&&(s=0);const i=[...n,...n].slice(s);for(const a of i){const l=t==="next"?e.nextMatch(a.state,0,r??0):e.prevMatch(a.state,r??a.state.doc.length,a.state.doc.length);if(!l){r=null,a.dispatch({selection:Uo.single(0)});continue}const c=Uo.single(l.from,l.to);return a.dispatch({selection:c,effects:[st.scrollIntoView(c.main,{y:"center"})],userEvent:"select.search"}),ut.set(tn,{type:"setCurrentView",view:a,range:{from:l.from,to:l.to}}),l}return!1}),fd=Tg("next"),Mg=Tg("prev"),KC=Ra(({query:t})=>{var o;const e=Bs(),n=[];for(const r of e){if(r.state.readOnly)continue;const s=(o=t.matchAll(r.state,1e9))==null?void 0:o.map(a=>{const{from:l,to:c}=a;return{from:l,to:c,insert:t.getReplacement(a)}});if(!s||s.length===0)continue;const i=r.state.doc.toString();n.push(()=>{r.dispatch({changes:[{from:0,to:r.state.doc.length,insert:i}],userEvent:"input.replace.all"})}),r.dispatch({changes:s,userEvent:"input.replace.all"})}return()=>{for(const r of n)r()}}),XC=Ra(({query:t})=>{const e=Bs(),n=ut.get(tn).currentView||{view:e[0],range:{from:0}};let o=n.range.from,r=e.indexOf(n.view);r<0&&(r=0);const s=[...e,...e].slice(r);for(const i of s){const a=t.nextMatch(i.state,0,o??0);if(!a){o=null,i.dispatch({selection:Uo.single(0)});continue}const l=i.state.toText(t.getReplacement(a));return i.dispatch({changes:[{from:a.from,to:a.to,insert:l}],userEvent:"input.replace"}),fd()}return!1}),ZC=Ra(({query:t})=>{const e=Bs();let n=0;const o=new Map;for(const r of e){const s=t.matchAll(r.state,1e9)||[];for(const i of s){const{from:a,to:l}=i,c=o.get(r)||new Map;c.set(`${a}:${l}`,n++),o.set(r,c)}}return{count:n,position:o}}),pd=Ut.define();function Og(){const t=Bs();for(const e of t)e.state.readOnly||e.dispatch({effects:pd.of(new yc({search:""}))})}const Pa=En.define({create(){const t=ut.get(tn);return hd(new yc({search:t.findText,caseSensitive:t.caseSensitive,regexp:t.regexp,replace:t.replaceText,wholeWord:t.wholeWord})).create()},update(t,e){for(const n of e.effects)n.is(pd)&&(t=hd(n.value).create());return t}}),QC=dt.mark({class:"cm-searchMatch"}),eN=dt.mark({class:"cm-searchMatch cm-searchMatch-selected"}),tN=Zn.fromClass(class{constructor(t){this.view=t,this.decorations=void 0,this.decorations=this.highlight(t.state.field(Pa))}update(t){const e=t.state.field(Pa);(e!==t.startState.field(Pa)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight(t){if(!t.spec.valid)return dt.none;const{view:e}=this,n=new Us,o=e.visibleRanges,r=o.length;for(let s=0;s<r;s++){let{to:i}=o[s];const{from:a}=o[s];for(;s<r-1&&i>o[s+1].from-500;)i=o[++s].to;t.highlight(e.state,a,i,(l,c)=>{const d=e.state.selection.ranges.some(u=>u.from===l&&u.to===c);n.add(l,c,d?eN:QC)})}return n.finish()}},{decorations:t=>t.decorations}),nN=st.baseTheme({"&light .cm-searchMatch":{backgroundColor:"#99ff7780"},"&dark .cm-searchMatch":{backgroundColor:"#22bb0070"},"&light .cm-searchMatch-selected":{backgroundColor:"transparent"},"&dark .cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff88 !important"}}),oN=()=>{var Xe;const t=X.c(102),[e,n]=A.useState(!1),[o,r]=fn(tn),[s,i]=A.useState(),a=A.useRef(null),l=He(ip);let c,d;t[0]!==e||t[1]!==o.isOpen?(c=()=>(!e||!o.isOpen)&&Ag(),t[0]=e,t[1]=o.isOpen,t[2]=c):c=t[2],qt("cell.findAndReplace",c),t[3]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{const Fe=ZC();i(Fe===!1?void 0:Fe)},t[3]=d):d=t[3];const u=d;let f,p,_,g;if(t[4]!==o.isOpen?(f=()=>{o.isOpen&&a.current&&(a.current.focus(),a.current.select())},p=[o.isOpen],t[4]=o.isOpen,t[5]=f,t[6]=p):(f=t[5],p=t[6]),A.useEffect(f,p),t[7]!==o.findText||t[8]!==o.isOpen?(_=()=>{if(o.isOpen){if(o.findText==="")return i(void 0),void Og();u(),function(){const Fe=ut.get(tn),et=Bs();for(const nt of et)nt.state.readOnly||nt.dispatch({effects:pd.of(new yc({search:Fe.findText,caseSensitive:Fe.caseSensitive,regexp:Fe.regexp,replace:Fe.replaceText,wholeWord:Fe.wholeWord}))})}()}else Og()},t[7]=o.findText,t[8]=o.isOpen,t[9]=_):_=t[9],t[10]!==o.caseSensitive||t[11]!==o.findText||t[12]!==o.isOpen||t[13]!==o.regexp||t[14]!==o.wholeWord?(g=[o.findText,o.isOpen,o.caseSensitive,o.regexp,o.wholeWord],t[10]=o.caseSensitive,t[11]=o.findText,t[12]=o.isOpen,t[13]=o.regexp,t[14]=o.wholeWord,t[15]=g):g=t[15],A.useEffect(_,g),!o.isOpen)return null;const m=o.currentView;let b;t[16]!==s||t[17]!==m?(b=m&&s?(Xe=s.position.get(m.view))==null?void 0:Xe.get(`${m.range.from}:${m.range.to}`):void 0,t[16]=s,t[17]=m,t[18]=b):b=t[18];const x=b;let y,v,k,S,E,j,I,T,M,L,B;t[19]===Symbol.for("react.memo_cache_sentinel")?(y=()=>n(!0),t[19]=y):y=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(v=()=>n(!1),t[20]=v):v=t[20],t[21]!==r?(k=Fe=>{Fe.key==="Escape"&&r({type:"setIsOpen",isOpen:!1})},t[21]=r,t[22]=k):k=t[22],t[23]!==r?(S=()=>r({type:"setIsOpen",isOpen:!1}),t[23]=r,t[24]=S):S=t[24],t[25]===Symbol.for("react.memo_cache_sentinel")?(E=h.jsx(go,{className:"w-4 h-4"}),t[25]=E):E=t[25],t[26]!==S?(j=h.jsx("div",{className:"absolute top-0 right-0",children:h.jsx(Pe,{"data-testid":"close-find-replace-button",onClick:S,size:"xs",variant:"text",children:E})}),t[26]=S,t[27]=j):j=t[27],t[28]!==r?(I=Fe=>{r({type:"setFind",find:Fe.target.value})},t[28]=r,t[29]=I):I=t[29],t[30]!==o.findText||t[31]!==I?(T=h.jsx(ur,{ref:a,"data-testid":"find-input",value:o.findText,autoFocus:!0,className:"mr-2 mb-0",placeholder:"Find",onKeyDown:sN,onChange:I}),t[30]=o.findText,t[31]=I,t[32]=T):T=t[32],t[33]!==r?(M=Fe=>{r({type:"setReplace",replace:Fe.target.value})},t[33]=r,t[34]=M):M=t[34],t[35]!==o.replaceText||t[36]!==M?(L=h.jsx(ur,{"data-testid":"replace-input",value:o.replaceText,placeholder:"Replace",onChange:M}),t[35]=o.replaceText,t[36]=M,t[37]=L):L=t[37],t[38]!==T||t[39]!==L?(B=h.jsxs("div",{className:"flex flex-col flex-2 gap-2 w-[55%]",children:[T,L]}),t[38]=T,t[39]=L,t[40]=B):B=t[40];const O=o.caseSensitive?"on":"off";let z,F,V;t[41]!==r?(z=Fe=>r({type:"setCaseSensitive",caseSensitive:Fe}),t[41]=r,t[42]=z):z=t[42],t[43]===Symbol.for("react.memo_cache_sentinel")?(F=h.jsx(kz,{className:"w-4 h-4"}),t[43]=F):F=t[43],t[44]!==o.caseSensitive||t[45]!==O||t[46]!==z?(V=h.jsx(Re,{content:"Case Sensitive",children:h.jsx(bp,{size:"sm",pressed:o.caseSensitive,"data-state":O,onPressedChange:z,children:F})}),t[44]=o.caseSensitive,t[45]=O,t[46]=z,t[47]=V):V=t[47];const P=o.wholeWord?"on":"off";let C,$,N;t[48]!==r?(C=Fe=>r({type:"setWholeWord",wholeWord:Fe}),t[48]=r,t[49]=C):C=t[49],t[50]===Symbol.for("react.memo_cache_sentinel")?($=h.jsx(Ym,{className:"w-4 h-4"}),t[50]=$):$=t[50],t[51]!==o.wholeWord||t[52]!==P||t[53]!==C?(N=h.jsx(Re,{content:"Match Whole Word",children:h.jsx(bp,{size:"sm",pressed:o.wholeWord,"data-state":P,onPressedChange:C,children:$})}),t[51]=o.wholeWord,t[52]=P,t[53]=C,t[54]=N):N=t[54];const H=o.regexp?"on":"off";let G,Z,q,re,ne;t[55]!==r?(G=Fe=>r({type:"setRegex",regexp:Fe}),t[55]=r,t[56]=G):G=t[56],t[57]===Symbol.for("react.memo_cache_sentinel")?(Z=h.jsx(Dm,{className:"w-4 h-4"}),t[57]=Z):Z=t[57],t[58]!==o.regexp||t[59]!==H||t[60]!==G?(q=h.jsx(Re,{content:"Use Regular Expression",children:h.jsx(bp,{size:"sm",pressed:o.regexp,"data-state":H,onPressedChange:G,children:Z})}),t[58]=o.regexp,t[59]=H,t[60]=G,t[61]=q):q=t[61],t[62]!==V||t[63]!==N||t[64]!==q?(re=h.jsxs("div",{className:"flex items-center gap-[2px]",children:[V,N,q]}),t[62]=V,t[63]=N,t[64]=q,t[65]=re):re=t[65],t[66]===Symbol.for("react.memo_cache_sentinel")?(ne=()=>{XC()&&u()},t[66]=ne):ne=t[66];const oe=o.findText==="";let Y,Q;t[67]!==oe?(Y=h.jsx(Pe,{"data-testid":"replace-next-button",size:"xs",variant:"outline",className:"h-6 text-xs",onClick:ne,disabled:oe,children:"Replace Next"}),t[67]=oe,t[68]=Y):Y=t[68],t[69]===Symbol.for("react.memo_cache_sentinel")?(Q=()=>{const Fe=KC();if(!Fe)return;u();const{dismiss:et}=lt({title:"Replaced all occurrences",action:h.jsx(sd,{"data-testid":"undo-replace-all-button",onClick:()=>{Fe(),nt()}})}),nt=et},t[69]=Q):Q=t[69];const ce=o.findText==="";let he,de,me,ie,Ce,we,ae,ve,ge,be,Te,ze;return t[70]!==ce?(he=h.jsx(Pe,{"data-testid":"replace-all-button",size:"xs",variant:"outline",className:"h-6 text-xs",onClick:Q,disabled:ce,children:"Replace All"}),t[70]=ce,t[71]=he):he=t[71],t[72]!==Y||t[73]!==he?(de=h.jsxs("div",{className:"flex items-center gap-[2px]",children:[Y,he]}),t[72]=Y,t[73]=he,t[74]=de):de=t[74],t[75]!==re||t[76]!==de?(me=h.jsxs("div",{className:"flex flex-col gap-2",children:[re,de]}),t[75]=re,t[76]=de,t[77]=me):me=t[77],t[78]!==B||t[79]!==me?(ie=h.jsxs("div",{className:"flex items-center gap-3",children:[B,me]}),t[78]=B,t[79]=me,t[80]=ie):ie=t[80],t[81]===Symbol.for("react.memo_cache_sentinel")?(Ce=h.jsx(Re,{content:"Find Previous",children:h.jsx(Pe,{"data-testid":"find-prev-button",size:"xs",variant:"secondary",onClick:iN,children:h.jsx(Et,{className:"w-4 h-4"})})}),t[81]=Ce):Ce=t[81],t[82]===Symbol.for("react.memo_cache_sentinel")?(we=h.jsx(Re,{content:"Find Next",children:h.jsx(Pe,{"data-testid":"find-next-button",size:"xs",variant:"secondary",onClick:aN,children:h.jsx($c,{className:"w-4 h-4"})})}),t[82]=we):we=t[82],t[83]!==x||t[84]!==s?(ae=s!=null&&x==null&&h.jsxs("span",{className:"text-sm",children:[s.count," matches"]}),t[83]=x,t[84]=s,t[85]=ae):ae=t[85],t[86]!==x||t[87]!==s?(ve=s!=null&&x!=null&&h.jsxs("span",{className:"text-sm",children:[x+1," of ",s.count]}),t[86]=x,t[87]=s,t[88]=ve):ve=t[88],t[89]!==ae||t[90]!==ve?(ge=h.jsxs("div",{className:"flex items-center gap-2",children:[Ce,we,ae,ve]}),t[89]=ae,t[90]=ve,t[91]=ge):ge=t[91],t[92]!==l?(be=l.getHotkey("cell.findAndReplace"),t[92]=l,t[93]=be):be=t[93],t[94]!==be.key?(Te=h.jsxs("div",{className:"text-xs text-muted-foreground flex gap-1 mt-2",children:["Press"," ",h.jsx(cp,{shortcut:be.key})," ","again to open the native browser search."]}),t[94]=be.key,t[95]=Te):Te=t[95],t[96]!==j||t[97]!==ie||t[98]!==ge||t[99]!==Te||t[100]!==k?(ze=h.jsx(Sz,{restoreFocus:!0,autoFocus:!0,children:h.jsxs("div",{onFocus:y,onClick:rN,onBlur:v,className:"fixed top-0 right-0 w-[500px] flex flex-col bg-[var(--sage-1)] p-4 z-50 mt-2 mr-3 rounded-md shadow-lg border gap-2 print:hidden",onKeyDown:k,children:[j,ie,ge,Te]})}),t[96]=j,t[97]=ie,t[98]=ge,t[99]=Te,t[100]=k,t[101]=ze):ze=t[101],ze};function rN(t){t.stopPropagation(),t.preventDefault()}function sN(t){t.key==="Enter"&&(t.shiftKey?Mg():fd())}function iN(){return Mg()}function aN(){return fd()}function Dg(t){const e=X.c(3),[n,o]=A.useState(!1);let r,s;return e[0]!==t?(r=()=>{if(!t)return;o(!1);const i=setTimeout(()=>{o(!0)},200);return()=>clearTimeout(i)},s=[t],e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]),A.useEffect(r,s),t&&n}const lN=()=>{const t=X.c(6),e=Qt(ld);let n;t[0]!==e?(n=()=>e(cN),t[0]=e,t[1]=n):n=t[1];const o=n;let r,s,i;return t[2]===Symbol.for("react.memo_cache_sentinel")?(r=pn("global.commandPalette"),t[2]=r):r=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(s=h.jsx(Wc,{strokeWidth:1.5,size:18}),t[3]=s):s=t[3],t[4]!==o?(i=h.jsx(Re,{content:r,children:h.jsx(xn,{"data-testid":"command-palette-button",onClick:o,shape:"rectangle",color:"hint-green",children:s})}),t[4]=o,t[5]=i):i=t[5],i};function cN(t){return!t}const ri=t=>{const{children:e}=t;return He(Ms)?null:e},dN=t=>{const{children:e}=t;return He(Ms)?e:null},Rg=t=>{const e=X.c(38),{resetOnBlur:n,placeholderText:o,initialValue:r,flexibleWidth:s,onNameChange:i,className:a}=t,l=n!==void 0&&n,c=r===void 0?null:r,d=s!==void 0&&s,[u,f]=A.useState(c);let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=[],e[0]=p):p=e[0];const[_,g]=A.useState(p),[m,b]=A.useState(!1),x=A.useRef(null),y=A.useRef(!1);let v,k,S;e[1]!==c?(v=()=>{f(c)},k=[c],e[1]=c,e[2]=v,e[3]=k):(v=e[2],k=e[3]),A.useEffect(v,k),e[4]===Symbol.for("react.memo_cache_sentinel")?(S=()=>{b(!0)},e[4]=S):S=e[4];const E=S;let j;e[5]!==c||e[6]!==l?(j=Q=>{var ce;(ce=Q.relatedTarget)!=null&&ce.closest(".filename-input")||(b(!1),l&&f(c))},e[5]=c,e[6]=l,e[7]=j):j=e[7];const I=j;let T;e[8]!==u?(T=$n.dirname(u||""),e[8]=u,e[9]=T):T=e[9];const M=T,L=$n.basename(u||""),B=_.filter(Q=>$n.basename(Q.path).startsWith(L));let O,z;e[10]!==M||e[11]!==m?(O=async()=>{if(!m)return void g([]);const Q=await Q3({path:M});g(Q.files)},z=[M,m],e[10]=M,e[11]=m,e[12]=O,e[13]=z):(O=e[12],z=e[13]);const{loading:F}=Xn(O,z),V=function(Q,ce,he){if(Q&&!Q.endsWith("/")&&((Yf("markdown")?new Set(["py","md","markdown","qmd"]):new Set(["py"])).has($n.extension(Q))||(Q=Q.endsWith(".")?`${Q}py`:Q.endsWith(".p")?`${Q}y`:`${Q}.py`),!ce.some(de=>de.path===Q||$n.basename(de.path)===Q)&&!(he&&(he===Q||$n.basename(he)===Q))))return Q}(u,_,c),P=(V||B.length>0)&&h.jsxs(lp,{className:"font-mono",children:[!F&&h.jsx(dc,{children:"No files"}),V&&h.jsxs(po,{variant:"success",className:"py-2 px-3",onSelect:()=>{var Q;V&&(y.current=!0,i(V),(Q=x.current)==null||Q.blur())},children:[h.jsx(mm,{className:"w-4 h-4 mr-2"})," ",h.jsxs("span",{className:"text-sm",children:[c?"Rename to: ":"Save as: ",h.jsx("span",{className:"font-medium text-sm",children:$n.basename(V)})]})]},"_rename_"),B.map(Q=>{const ce=Q.isDirectory?"directory":X3(Q.path),he=Z3[ce];return h.jsxs(po,{variant:Q.isDirectory?"default":"muted",className:"py-2 px-3",onSelect:()=>{Q.isDirectory?f(`${Q.path}/`):f(Q.path)},children:[h.jsx(he,{className:"w-4 h-4 mr-2"})," ",$n.basename(Q.path)]},Q.path)})]}),C=10*Math.max(20,(u==null?void 0:u.length)||(o==null?void 0:o.length)||0),$=m?u||"":c||"";let N,H,G;e[14]!==d||e[15]!==C?(N=d?{maxWidth:C}:void 0,e[14]=d,e[15]=C,e[16]=N):N=e[16],e[17]!==a?(H=Oe(a,"w-full px-4 py-1 my-1 h-9 font-mono text-foreground/60"),e[17]=a,e[18]=H):H=e[18],e[19]!==o||e[20]!==$||e[21]!==N||e[22]!==H?(G=h.jsx(Cz,{children:h.jsx(Qi,{"data-testid":"dir-completion-input",tabIndex:-1,rootClassName:"border-none justify-center px-1",spellCheck:"false",value:$,onKeyDown:uN,icon:null,ref:x,onValueChange:f,placeholder:o,autoComplete:"off",style:N,className:H})}),e[19]=o,e[20]=$,e[21]=N,e[22]=H,e[23]=G):G=e[23];const Z=P&&"group-focus-within:block";let q,re,ne,oe,Y;return e[24]!==Z?(q=Oe("p-0 w-full min-w-80 max-w-80vw hidden",Z),e[24]=Z,e[25]=q):q=e[25],e[26]!==P||e[27]!==q?(re=h.jsx(Vs,{side:"bottom",className:q,portal:!1,children:P}),e[26]=P,e[27]=q,e[28]=re):re=e[28],e[29]!==G||e[30]!==re?(ne=h.jsxs(lp,{children:[G,re]}),e[29]=G,e[30]=re,e[31]=ne):ne=e[31],e[32]!==I||e[33]!==ne?(oe=h.jsx(xc,{onFocus:E,onBlur:I,shouldFilter:!1,id:"filename-input",className:"bg-transparent group filename-input",children:ne}),e[32]=I,e[33]=ne,e[34]=oe):oe=e[34],e[35]!==m||e[36]!==oe?(Y=h.jsx(wc,{children:h.jsx(Pr,{open:m,modal:!1,children:oe})}),e[35]=m,e[36]=oe,e[37]=Y):Y=e[37],Y};function uN(t){t.key==="Escape"&&t.currentTarget.blur()}function hN(t){return JSON.stringify(t)}const md=Zt(void 0),Pg=Zt(t=>{const e=t(md);return function(n,o,r){if(!r)return!1;const{cellIds:s,cellData:i}=n,a=s.inOrderIds.map(u=>i[u]),l=a.map(u=>u.code),c=a.map(u=>u.config),d=a.map(u=>u.name);return!(e4(l,r.codes)&&e4(d,r.names)&&ra(c,r.configs)&&ra(o.selectedLayout,r.layout.selectedLayout)&&ra(o.layoutData,r.layout.layoutData))}(t(yp),t(wS),e)}),fN=t=>{const e=X.c(35),n=mc(),o=()=>{oa(new Blob([s()],{type:"text/plain"}),`${t.proposedName}.json`)};let r;e[0]!==n?(r=()=>{const E=fo(),j=xp(E);return JSON.stringify({filename:n,cells:j.map(mN)},null,2)},e[0]=n,e[1]=r):r=e[1];const s=Qe(r);let i,a,l,c,d,u,f,p,_,g,m,b,x,y,v,k,S;return e[2]!==o||e[3]!==t?(i=E=>{E.preventDefault(),o(),t.closeModal()},e[2]=o,e[3]=t,e[4]=i):i=e[4],e[5]!==t?(a=E=>{E.key==="Escape"&&t.closeModal()},e[5]=t,e[6]=a):a=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx(dr,{className:"text-accent-foreground mb-6",children:"Download unsaved changes?"}),e[7]=l):l=e[7],e[8]===Symbol.for("react.memo_cache_sentinel")?(c={wordBreak:"break-word"},e[8]=c):c=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsx("p",{children:"This app has unsaved changes. To recover:"}),u={paddingBottom:"10px"},e[9]=d,e[10]=u):(d=e[9],u=e[10]),e[11]!==t.proposedName?(f=h.jsxs("li",{style:u,children:['Click the "Download" button. This will download a file called\xA0',h.jsxs("code",{children:[t.proposedName,".json"]}),". This file contains your code."]}),e[11]=t.proposedName,e[12]=f):f=e[12],e[13]===Symbol.for("react.memo_cache_sentinel")?(p={paddingBottom:"10px"},e[13]=p):p=e[13],e[14]===Symbol.for("react.memo_cache_sentinel")?(_={display:"block",padding:"10px"},e[14]=_):_=e[14],e[15]!==t.proposedName?(g=h.jsxs("code",{style:_,children:["marimo recover ",t.proposedName,".json ",">"," ",t.proposedName,".py"]}),e[15]=t.proposedName,e[16]=g):g=e[16],e[17]!==t.proposedName?(m=h.jsxs("code",{children:[t.proposedName,".py"]}),e[17]=t.proposedName,e[18]=m):m=e[18],e[19]!==g||e[20]!==m?(b=h.jsxs("li",{style:p,children:["In your terminal, type",g,"to overwrite ",m," with the recovered changes."]}),e[19]=g,e[20]=m,e[21]=b):b=e[21],e[22]!==b||e[23]!==f?(x=h.jsx(Ps,{className:"markdown break-words",style:c,children:h.jsxs("div",{className:"prose dark:prose-invert",children:[d,h.jsxs("ol",{children:[f,b]})]})}),e[22]=b,e[23]=f,e[24]=x):x=e[24],e[25]!==t.closeModal?(y=h.jsx(Pe,{"aria-label":"Cancel",variant:"secondary","data-testid":"cancel-recovery-button",onClick:t.closeModal,children:"Cancel"}),e[25]=t.closeModal,e[26]=y):y=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(v=h.jsx(Pe,{"data-testid":"download-recovery-button","aria-label":"Download",variant:"default",type:"submit",children:"Download"}),e[27]=v):v=e[27],e[28]!==y?(k=h.jsxs(ea,{children:[y,v]}),e[28]=y,e[29]=k):k=e[29],e[30]!==i||e[31]!==x||e[32]!==k||e[33]!==a?(S=h.jsx(cr,{className:"w-fit",children:h.jsxs("form",{onSubmit:i,onKeyDown:a,children:[l,x,k]})}),e[30]=i,e[31]=x,e[32]=k,e[33]=a,e[34]=S):S=e[34],S},pN=t=>{const e=X.c(12),{filename:n,needsSave:o}=t,{openModal:r,closeModal:s}=Un();let i;e[0]!==n?(i=n===null?"app":n.slice(0,-3),e[0]=n,e[1]=i):i=e[1];const a=i;let l;e[2]!==s||e[3]!==o||e[4]!==r||e[5]!==a?(l=()=>{o&&r(h.jsx(fN,{proposedName:a,closeModal:s}))},e[2]=s,e[3]=o,e[4]=r,e[5]=a,e[6]=l):l=e[6];const c=l;let d;qt("global.save",c),e[7]===Symbol.for("react.memo_cache_sentinel")?(d=pn("global.save"),e[7]=d):d=e[7];const u=o?"yellow":"gray";let f,p;return e[8]===Symbol.for("react.memo_cache_sentinel")?(f=h.jsx(Na,{strokeWidth:1.5,size:18}),e[8]=f):f=e[8],e[9]!==c||e[10]!==u?(p=h.jsx(Re,{content:d,children:h.jsx(xn,{onClick:c,id:"save-button","aria-label":"Save",className:"rectangle",color:u,children:f})}),e[9]=c,e[10]=u,e[11]=p):p=e[11],p};function mN(t){return{name:t.name,code:t.code}}const gd=5e3;async function gN(){await Iz({download:!1})}async function _N(){await Ez({download:!1,includeCode:!0,files:_S.INSTANCE.filenames()})}async function bN(){await jz({download:!1})}const yN=t=>{const e=X.c(15),{kioskMode:n}=t,o=mc(),r=He(Pg),s=He(mo).state===en.CLOSED,{saveOrNameNotebook:i,saveIfNotebookIsPersistent:a}=Lg();let l,c,d;e[0]!==n||e[1]!==a?(l={onSave:a,kioskMode:n},e[0]=n,e[1]=a,e[2]=l):l=e[2],function(m){const b=X.c(14),x=He(o4),y=vc(),[v]=fn(mo),k=He(Pg);let S,E;if(b[0]!==y){const L=xp(y);S=L.map(SN),E=L.map(kN),b[0]=y,b[1]=S,b[2]=E}else S=b[1],E=b[2];const j=E;let I;b[3]!==y?(I=n4(y),b[3]=y,b[4]=I):I=b[4];const T=I;let M;b[5]!==x||b[6]!==j||b[7]!==S||b[8]!==T||b[9]!==v||b[10]!==k||b[11]!==m.kioskMode||b[12]!==m.onSave?(M={onSave:m.onSave,needsSave:k,codes:S,cellConfigs:T,cellNames:j,connStatus:v,config:x,kioskMode:m.kioskMode},b[5]=x,b[6]=j,b[7]=S,b[8]=T,b[9]=v,b[10]=k,b[11]=m.kioskMode,b[12]=m.onSave,b[13]=M):M=b[13],function(L){const B=X.c(21),{codes:O,cellConfigs:z,config:F,connStatus:V,cellNames:P,needsSave:C,kioskMode:$,onSave:N}=L,H=A.useRef(null);let G;B[0]!==O?(G=O.join(":"),B[0]=O,B[1]=G):G=B[1];const Z=G;let q;B[2]!==z?(q=z.map(hN).join(":"),B[2]=z,B[3]=q):q=B[3];const re=q;let ne;B[4]!==P?(ne=P.join(":"),B[4]=P,B[5]=ne):ne=B[5];const oe=ne;let Y,Q;B[6]!==F||B[7]!==V.state||B[8]!==$||B[9]!==C||B[10]!==N?(Y=()=>{if(!$)return F.autosave==="after_delay"&&(H.current!==null&&clearTimeout(H.current),C&&V.state===en.OPEN&&(H.current=setTimeout(N,F.autosave_delay))),()=>{H.current!==null&&clearTimeout(H.current)}},B[6]=F,B[7]=V.state,B[8]=$,B[9]=C,B[10]=N,B[11]=Y):Y=B[11],B[12]!==re||B[13]!==oe||B[14]!==Z||B[15]!==F||B[16]!==V.state||B[17]!==$||B[18]!==C||B[19]!==N?(Q=[Z,re,oe,F,V.state,N,$,C],B[12]=re,B[13]=oe,B[14]=Z,B[15]=F,B[16]=V.state,B[17]=$,B[18]=C,B[19]=N,B[20]=Q):Q=B[20],A.useEffect(Y,Q)}(M)}(l),function(){const m=X.c(6),b=He(Nz),{state:x}=He(mo),y=b.auto_download.includes("markdown"),v=b.auto_download.includes("html"),k=b.auto_download.includes("ipynb"),S=!y||x!==en.OPEN,E=!v||x!==en.OPEN,j=!k||x!==en.OPEN;let I,T,M;m[0]!==S?(I={delayMs:gd,whenVisible:!0,disabled:S},m[0]=S,m[1]=I):I=m[1],Uc(bN,I),m[2]!==E?(T={delayMs:gd,whenVisible:!0,disabled:E},m[2]=E,m[3]=T):T=m[3],Uc(_N,T),m[4]!==j?(M={delayMs:gd,whenVisible:!0,disabled:j},m[4]=j,m[5]=M):M=m[5],Uc(gN,M)}(),e[3]!==r?(c=m=>{if(r)return m.preventDefault(),m.returnValue="You have unsaved changes. Are you sure you want to leave?",m.returnValue},e[3]=r,e[4]=c):c=e[4],op(window,"beforeunload",c),e[5]!==i?(d=m=>{m.preventDefault(),m.stopPropagation(),i()},e[5]=i,e[6]=d):d=e[6];const u=d;if(qt("global.save",i),s){let m;return e[7]!==o||e[8]!==r?(m=h.jsx(pN,{filename:o,needsSave:r}),e[7]=o,e[8]=r,e[9]=m):m=e[9],m}let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=pn("global.save"),e[10]=f):f=e[10];const p=r?"yellow":"hint-green";let _,g;return e[11]===Symbol.for("react.memo_cache_sentinel")?(_=h.jsx(Na,{strokeWidth:1.5,size:18}),e[11]=_):_=e[11],e[12]!==u||e[13]!==p?(g=h.jsx(Re,{content:f,children:h.jsx(xn,{"data-testid":"save-button",id:"save-button",shape:"rectangle",color:p,onClick:u,children:_})}),e[12]=u,e[13]=p,e[14]=g):g=e[14],g};function Lg(){const t=X.c(19),{openModal:e,closeModal:n,openAlert:o}=Un(),r=Qt(md),s=t4(),i=Az();let a;t[0]!==o||t[1]!==r||t[2]!==i?(a=(m,b)=>{const x=fo(),y=xp(x),v=y.map(vN),k=y.map(wN),S=y.map(xN),E=n4(x),j=i.get(mo),I=i.get(o4),T=i.get(wS);i.get(Ms)||k.length!==0&&(j.state===en.OPEN?(Xt.log("saving to ",m),Tz({cellIds:v,codes:k,names:S,filename:m,configs:E,layout:C$(),persist:!0}).then(()=>{b&&I.format_on_save&&r4(),r({names:S,codes:k,configs:E,layout:T})})):o("Failed to save notebook: not connected to a kernel."))},t[0]=o,t[1]=r,t[2]=i,t[3]=a):a=t[3];const l=Qe(a);let c;t[4]!==l||t[5]!==i?(c=m=>{const b=m!==void 0&&m,x=i.get(s4),y=i.get(mo);Fg(x)&&y.state===en.OPEN&&l(x,b)},t[4]=l,t[5]=i,t[6]=c):c=t[6];const d=Qe(c);let u;t[7]!==l||t[8]!==s?(u=m=>{s(m).then(b=>{b!==null&&l(b,!0)})},t[7]=l,t[8]=s,t[9]=u):u=t[9];const f=u;let p;t[10]!==n||t[11]!==f||t[12]!==e||t[13]!==d||t[14]!==i?(p=()=>{const m=i.get(s4),b=i.get(mo);d(!0),Fg(m)||b.state===en.CLOSED||e(h.jsx(CN,{onClose:n,onSave:f}))},t[10]=n,t[11]=f,t[12]=e,t[13]=d,t[14]=i,t[15]=p):p=t[15];const _=Qe(p);let g;return t[16]!==d||t[17]!==_?(g={saveOrNameNotebook:_,saveIfNotebookIsPersistent:d},t[16]=d,t[17]=_,t[18]=g):g=t[18],g}function xN(t){return t.name}function wN(t){return t.code}function vN(t){return t.id}function Fg(t){return t!==null&&!t.startsWith("/tmp")&&!t.startsWith("/var/folders")&&!t.includes("AppData\\Local\\Temp")}function kN(t){return t.name}function SN(t){return t.code}const CN=t=>{const e=X.c(17),{onClose:n,onSave:o}=t,[r,s]=A.useState();let i;e[0]!==n||e[1]!==o?(i=m=>{s(m),m.trim()&&(o(m),n())},e[0]=n,e[1]=o,e[2]=i):i=e[2];const a=i;let l,c,d,u;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx(dr,{children:"Save notebook"}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(Rr,{className:"text-md pt-6 px-1",children:"Save as"}),e[4]=c):c=e[4],e[5]!==a?(d=h.jsxs("div",{className:"flex flex-col",children:[c,h.jsx(Rg,{onNameChange:a,placeholderText:"filename",className:"missing-filename"})]}),e[5]=a,e[6]=d):d=e[6],e[7]!==n?(u=h.jsx(Pe,{"data-testid":"cancel-save-dialog-button","aria-label":"Cancel",variant:"secondary",onClick:n,children:"Cancel"}),e[7]=n,e[8]=u):u=e[8];const f=!r;let p,_,g;return e[9]!==f?(p=h.jsx(Pe,{"data-testid":"submit-save-dialog-button","aria-label":"Save",variant:"default",disabled:f,type:"submit",children:"Save"}),e[9]=f,e[10]=p):p=e[10],e[11]!==u||e[12]!==p?(_=h.jsxs(ea,{children:[u,p]}),e[11]=u,e[12]=p,e[13]=_):_=e[13],e[14]!==d||e[15]!==_?(g=h.jsxs(cr,{children:[l,d,_]}),e[14]=d,e[15]=_,e[16]=g):g=e[16],g},NN=t=>{const e=X.c(40),{presenting:n,onTogglePresenting:o,onInterrupt:r,onRun:s,closed:i,running:a,appConfig:l}=t,c=l.width,d=He(G3),u=He(Mz),{undoDeleteCell:f}=Lt();let p,_,g=null;if(!i&&d){let O,z;e[0]===Symbol.for("react.memo_cache_sentinel")?(O=h.jsx(td,{size:16,strokeWidth:1.5}),e[0]=O):O=e[0],e[1]!==f?(z=h.jsx(Re,{content:"Undo cell deletion",children:h.jsx(xn,{"data-testid":"undo-delete-cell",size:"medium",color:"hint-green",shape:"circle",onClick:f,children:O})}),e[1]=f,e[2]=z):z=e[2],g=z}e[3]!==n?(p=!n&&h.jsx(oN,{}),e[3]=n,e[4]=p):p=e[4],e[5]!==i||e[6]!==n?(_=!i&&h.jsxs("div",{className:IN,children:[n&&h.jsx(MS,{}),h.jsx(GC,{}),h.jsx(h$,{}),h.jsx(f$,{description:"This will terminate the Python kernel. You'll lose all data that's in memory."})]}),e[5]=i,e[6]=n,e[7]=_):_=e[7];const m=c==="compact"&&"xl:flex-row items-end";let b,x,y,v,k,S,E,j,I,T,M,L,B;return e[8]!==m?(b=Oe(AN,m),e[8]=m,e[9]=b):b=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(x=h.jsx(ri,{children:h.jsx(yN,{kioskMode:!1})}),e[10]=x):x=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(y=pn("global.hideCode"),e[11]=y):y=e[11],e[12]!==n?(v=n?h.jsx(Y3,{strokeWidth:1.5,size:18}):h.jsx(Jc,{strokeWidth:1.5,size:18}),e[12]=n,e[13]=v):v=e[13],e[14]!==o||e[15]!==v?(k=h.jsx(Re,{content:y,children:h.jsx(xn,{"data-testid":"hide-code-button",id:"preview-button",shape:"rectangle",color:"hint-green",onClick:o,children:v})}),e[14]=o,e[15]=v,e[16]=k):k=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(j=h.jsx(lN,{}),S=h.jsx(p$,{}),E=h.jsx("div",{}),e[17]=S,e[18]=E,e[19]=j):(S=e[17],E=e[18],j=e[19]),e[20]!==i||e[21]!==r||e[22]!==a?(I=!i&&h.jsx(EN,{running:a,onInterrupt:r}),e[20]=i,e[21]=r,e[22]=a,e[23]=I):I=e[23],e[24]!==i||e[25]!==u||e[26]!==s?(T=!i&&h.jsx(jN,{needsRun:u,onRun:s}),e[24]=i,e[25]=u,e[26]=s,e[27]=T):T=e[27],e[28]!==I||e[29]!==T||e[30]!==g?(M=h.jsx(ri,{children:h.jsxs("div",{className:"flex flex-col gap-2 items-center",children:[g,I,T]})}),e[28]=I,e[29]=T,e[30]=g,e[31]=M):M=e[31],e[32]!==M||e[33]!==b||e[34]!==k?(L=h.jsxs("div",{className:b,children:[x,k,j,S,E,M]}),e[32]=M,e[33]=b,e[34]=k,e[35]=L):L=e[35],e[36]!==p||e[37]!==L||e[38]!==_?(B=h.jsxs(h.Fragment,{children:[p,_,L]}),e[36]=p,e[37]=L,e[38]=_,e[39]=B):B=e[39],B},jN=t=>{const e=X.c(5),{needsRun:n,onRun:o}=t;if(n){let s,i,a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=pn("global.runStale"),e[0]=s):s=e[0],e[1]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsx(Qs,{strokeWidth:1.5,size:16}),e[1]=i):i=e[1],e[2]!==o?(a=h.jsx(Re,{content:s,children:h.jsx(xn,{"data-testid":"run-button",size:"medium",color:"yellow",shape:"circle",onClick:o,children:i})}),e[2]=o,e[3]=a):a=e[3],a}let r;return e[4]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(Re,{content:"Nothing to run",children:h.jsx(xn,{"data-testid":"run-button",className:"inactive-button",color:"disabled",size:"medium",shape:"circle",children:h.jsx(Qs,{strokeWidth:1.5,size:16})})}),e[4]=r):r=e[4],r},EN=t=>{const e=X.c(8),{running:n,onInterrupt:o}=t,r=Dg(n);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=pn("global.interrupt"),e[0]=s):s=e[0];const i=!r&&"inactive-button active:shadow-xsSolid";let a;e[1]!==i?(a=Oe(i),e[1]=i,e[2]=a):a=e[2];const l=r?"yellow":"disabled",c=r?o:jn.NOOP;let d,u;return e[3]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsx(Zf,{strokeWidth:1.5,size:16}),e[3]=d):d=e[3],e[4]!==a||e[5]!==l||e[6]!==c?(u=h.jsx(Re,{content:s,children:h.jsx(xn,{className:a,"data-testid":"interrupt-button",size:"medium",color:l,shape:"circle",onClick:c,children:d})}),e[4]=a,e[5]=l,e[6]=c,e[7]=u):u=e[7],u},IN="absolute top-3 right-5 m-0 flex items-center space-x-3 min-h-[28px] no-print pointer-events-auto z-30 print:hidden",AN="absolute bottom-5 right-5 flex flex-col gap-2 items-center no-print pointer-events-auto z-30 print:hidden",TN=t=>{const e=X.c(7),{filename:n}=t,o=t4();let r;e[0]!==n?(r=n?$n.basename(n):"untitled marimo app",e[0]=n,e[1]=r):r=e[1];const s=n===null?"missing-filename":"filename";let i;return e[2]!==n||e[3]!==o||e[4]!==r||e[5]!==s?(i=h.jsx(Rg,{placeholderText:r,initialValue:n,onNameChange:o,flexibleWidth:!0,resetOnBlur:!0,"data-testid":"filename-input",className:s}),e[2]=n,e[3]=o,e[4]=r,e[5]=s,e[6]=i):i=e[6],i},MN=Oz(Dz,400),ON=(t,e)=>{ut.get(Ms)||t.isEmpty()||e.isEmpty()||ra(t.inOrderIds,e.inOrderIds)||MN({cell_ids:t.inOrderIds})};function DN(t){return[Hn.of([{key:"Escape",preventDefault:!1,run:JC},{key:t.getHotkey("cell.selectNextOccurrence").key,preventDefault:!0,run:Pz},{key:t.getHotkey("cell.findAndReplace").key,preventDefault:!0,run:Ag}]),Rz(),tN,Pa,nN]}const Ur={showInput:"Mod-l",acceptEdit:"Mod-y",rejectEdit:"Mod-u"},si=$s.define({combine:t=>kc(t,{onError:console.error,inputDebounceTime:300,keymaps:Ur},{onError:(e,n)=>e&&n,inputDebounceTime:(e,n)=>e&&n,keymaps:(e,n)=>e&&n})}),kr=Ut.define(),Sr=En.define({create:()=>({show:!1,lineFrom:0,lineTo:0}),update(t,e){for(const n of e.effects)if(n.is(kr))return n.value;return t}}),ii=Ut.define(),ai=Ut.define(),zg=En.define({create:()=>({shouldFocus:!1,inputValue:""}),update(t,e){let n=t;for(const o of e.effects)o.is(ii)&&(n={...n,inputValue:o.value}),o.is(ai)&&(n={...n,shouldFocus:o.value});return n}}),La=Ut.define(),li=En.define({create:()=>null,update(t,e){for(const n of e.effects)if(n.is(La))return n.value;return t}}),Vr=Ut.define(),Bg=En.define({create:()=>!1,update(t,e){for(const n of e.effects)if(n.is(Vr))return n.value;return t}}),Ug=t=>{const{state:e}=t,n=e.selection.main;if(n.empty)return!1;const o=e.doc,r=o.lineAt(n.from),s=o.lineAt(n.to);if(e.sliceDoc(r.from,s.to).trim().length<1)return!1;const i=Math.max(1,Math.min(r.number,o.lines)),a=Math.max(1,Math.min(s.number,o.lines));return t.dispatch({effects:[kr.of({show:!0,lineFrom:i,lineTo:a}),ai.of(!0),ii.of("")],selection:Uo.cursor(r.from)}),!0},Vg=t=>!!t.state.field(li)&&(t.dispatch({effects:[La.of(null),kr.of({show:!1,lineFrom:0,lineTo:0}),ai.of(!1),ii.of(""),Vr.of(!1)]}),!0),$g=t=>{const e=t.state.field(li);return!!e&&(t.dispatch({changes:{from:e.from,to:e.to,insert:e.oldCode},effects:[La.of(null),kr.of({show:!1,lineFrom:0,lineTo:0}),ai.of(!1),ii.of(""),Vr.of(!1)]}),!0)},RN=st.baseTheme({".cm-ai-input-container":{display:"flex",flexDirection:"column",gap:"4px",width:"min(calc(100% + 7px), 500px)",padding:"5px 5px",margin:"0 -6px",backgroundColor:"light-dark(rgb(241, 243, 245), rgb(40, 40, 40))"},".cm-ai-input":{display:"block",width:"100%",padding:"3px 8px",border:"2px solid rgb(51, 154, 240)",borderRadius:"5px",fontSize:"12px"},".cm-ai-help-info-button":{fontSize:"10px",paddingLeft:"10px",height:"18px",color:"light-dark(rgb(109, 117, 125), rgb(170, 170, 170))",display:"block",marginRight:"auto"},".cm-ai-help-info-button:hover":{color:"light-dark(rgb(89, 97, 105), rgb(190, 190, 190))"},".cm-ai-generate-button":{background:"#0E639C",border:"none",padding:"2px 6px",color:"#ffffff",cursor:"pointer",font:"inherit",borderRadius:"4px","&:hover":{backgroundColor:"#1177bb"}},".cm-line.cm-ai-selection, .cm-line.cm-ai-selection.cm-active-line":{backgroundColor:"light-dark(color-mix(in srgb, rgb(223, 227, 232) 50%, transparent), color-mix(in srgb, rgb(50, 50, 50) 50%, transparent)) !important"},".cm-line:has(.cm-new-code-line)":{backgroundColor:"light-dark(color-mix(in srgb, rgb(183, 235, 143) 50%, transparent), color-mix(in srgb, rgb(40, 100, 40) 50%, transparent)) !important"},".cm-old-code-container":{backgroundColor:"light-dark(rgb(255, 205, 205), rgb(100, 40, 40))",position:"relative",display:"flex",paddingTop:"0",width:"100%",alignItems:"center"},".cm-code-button":{position:"absolute",right:"5px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:"pointer",fontSize:"16px"},".cm-floating-buttons":{fontFamily:"sans-serif",position:"absolute",top:"-20px",left:"5px",display:"flex"},".cm-floating-button":{fontFamily:"sans-serif",padding:"2px 5px",fontSize:"10px",cursor:"pointer",fontWeight:"700"},".cm-floating-accept":{backgroundColor:"light-dark(rgb(55, 125, 34), rgb(40, 80, 25))",borderTopLeftRadius:"5px",borderBottomLeftRadius:"5px",color:"white",filter:"brightness(90%)","&:hover":{filter:"brightness(100%)"}},".cm-floating-reject":{backgroundColor:"light-dark(rgb(220, 53, 69), rgb(180, 40, 50))",color:"white",borderTopRightRadius:"5px",borderBottomRightRadius:"5px",filter:"brightness(90%)","&:hover":{filter:"brightness(100%)"}},".hotkey":{display:"inline-block",padding:"0 4px",borderRadius:"3px",backgroundColor:"rgba(255, 255, 255, 0.1)",fontSize:"90%"},".cm-ai-loading-indicator":{fontStyle:"italic",fontSize:"10px",paddingLeft:"12px",color:"light-dark(rgb(109, 117, 125), rgb(170, 170, 170))",opacity:"0",transition:"opacity 0.3s ease-in-out","&::after":{content:'""',display:"inline-block",animation:"ellipsis-pulse 1.5s steps(4, end) infinite"},"&:not(:empty)":{opacity:"1"}},".cm-ai-input:disabled":{opacity:"0.5"},"@keyframes ellipsis-pulse":{"0%":{content:"'.'"},"25%":{content:"'..'"},"50%":{content:"'...'"},"75%":{content:"''"}},".cm-ai-loading-container":{display:"flex",alignItems:"center",padding:"0 8px"},".cm-ai-cancel-button":{padding:"2px 8px",fontSize:"10px",borderRadius:"4px",color:"light-dark(rgb(109, 117, 125), rgb(170, 170, 170))",cursor:"pointer","&:hover":{background:"light-dark(rgb(223, 227, 232), rgb(50, 50, 50))"}},".hidden":{display:"none"}}),PN="\u2318",LN="\u229E Win",FN="Ctrl";function _d(t){return t.replace("Mod",navigator.platform.startsWith("Mac")?PN:navigator.platform.startsWith("Win")?LN:FN).replace("-"," ").toUpperCase()}function ln(t,e){const n=document.createElement(t);return n.className=e,n}function zN(t){var r,s;const e=t.state.facet(si),n={...Ur,...e.keymaps},o=ln("div","cm-ai-tooltip").appendChild(ln("div","cm-ai-tooltip-button"));return o.innerHTML=`<span>Edit <span class="hotkey">${_d(n.showInput)}</span></span>`,(r=o.querySelector("span"))==null||r.addEventListener("mousedown",i=>{i.stopPropagation()}),(s=o.querySelector("span"))==null||s.addEventListener("click",i=>{i.preventDefault(),Ug(t)}),o}const BN=$s.define({combine:t=>kc(t,{render:zN})}),UN=Zn.fromClass((g3=class{constructor(t){ee(this,"view");ee(this,"suppress");ee(this,"dom");ee(this,"mousedown",()=>{this.suppress=!0});ee(this,"mouseup",()=>{this.suppress=!1,this.display(this.view)});y3(this,Ql,t=>{var n;const e=t.state.selection.ranges.find(o=>!o.empty);if(e&&!this.suppress){const o=t.coordsAtPos(e.from);if(!o)return;this.dom.style.display="flex";const r=this.dom.getBoundingClientRect(),s=t.dom.getBoundingClientRect(),i=(n=t.dom.parentElement)==null?void 0:n.getBoundingClientRect(),a=s.width-r.width,l=Math.min(o.left,a);let c=o.top-r.height;c=i?Math.max(i.y,c):c,this.dom.style.left=`${l}px`,this.dom.style.top=`${c}px`,requestAnimationFrame(()=>{this.dom&&(this.dom.ariaHidden="false")})}else this.dom.style.display="none",this.dom.ariaHidden="true"});this.view=t;const e=t.state.facet(BN);this.suppress=!1,document.addEventListener("mousedown",this.mousedown),document.addEventListener("mouseup",this.mouseup);const n=e.render(t);t.dom.appendChild(n),this.dom=n}update(t){this.display(t.view)}docViewUpdate(t){this.display(t)}display(t){t.state.field(Sr).show?this.dom.style.display="none":t.requestMeasure({read:b3(this,Ql)})}destroy(){document.removeEventListener("mousedown",this.mousedown),document.removeEventListener("mouseup",this.mouseup),this.dom.remove()}},Ql=new WeakMap,g3)),VN=st.baseTheme({".cm-ai-tooltip-button":{userSelect:"none",fontFamily:"system-ui, -apple-system, sans-serif",position:"fixed",display:"flex",boxSizing:"border-box",padding:"2px 6px",borderRadius:"4px",fontSize:"12px",backgroundColor:"#0E639C",color:"#ffffff",border:"1px solid transparent",boxShadow:"0 2px 4px rgba(0,0,0,0.1)",zIndex:"999",transition:"opacity 0.5s","&[aria-hidden='true']":{opacity:"0"},"&[aria-hidden='false']":{opacity:"1"},"& > span":{pointerEvents:"auto",cursor:"pointer",display:"inline-block",padding:"2px"},"&:hover":{backgroundColor:"#1177bb"}}});class $N extends Hs{constructor(n){super();ee(this,"oldCode");this.oldCode=n}toDOM(n){const o=ln("div","cm-old-code-container");o.setAttribute("role","region"),o.setAttribute("aria-label","Previous code version");const r=ln("div","cm-old-code cm-line");r.textContent=this.oldCode;const s=ln("div","cm-floating-buttons"),i=n.state.facet(si),a={...Ur,...i.keymaps},l=ln("button","cm-floating-button cm-floating-accept");l.innerHTML=`<span class="hotkey">${_d(a.acceptEdit)}</span> Accept`,l.setAttribute("aria-label","Accept changes"),l.addEventListener("click",d=>{d.preventDefault(),d.stopPropagation(),n.focus(),Vg(n)});const c=ln("button","cm-floating-button cm-floating-reject");return c.innerHTML=`<span class="hotkey">${_d(a.rejectEdit)}</span> Reject`,c.setAttribute("aria-label","Reject changes"),c.addEventListener("click",d=>{d.preventDefault(),d.stopPropagation(),n.focus(),$g(n)}),s.append(l,c),o.append(r,s),o}updateDOM(n,o){return!0}}class HN extends Hs{constructor(n){super();ee(this,"complete");ee(this,"abortController",null);ee(this,"dom",null);ee(this,"input",null);ee(this,"loadingContainer",null);ee(this,"helpInfo",null);ee(this,"inputContainer",null);ee(this,"form",null);ee(this,"view",null);ee(this,"onKeyDown",async n=>{n.key!=="Enter"||n.shiftKey?n.key==="Escape"&&this.onCancel():(n.preventDefault(),await this.handleSubmit())});ee(this,"onCancel",()=>{this.cleanup();const n=this.view;n&&(n.dispatch({effects:[kr.of({show:!1,lineFrom:0,lineTo:0}),Vr.of(!1)]}),n.focus())});ee(this,"handleSubmit",async n=>{var g;const o=this.view;if(!o)return;const r=o.state.facet(si);n==null||n.stopPropagation();const s=o.state.field(Sr),{input:i}=this;if(!i)return;const a=i.value.trim();if(!s.show||!a)return;const l=o.state.doc.line(s.lineFrom),c=o.state.doc.line(s.lineTo),d=l.from,u=c.to,f=o.state.sliceDoc(d,u),p=o.state.sliceDoc(0,d),_=o.state.sliceDoc(u);this.abortController=new AbortController,o.dispatch({effects:Vr.of(!0)}),this.toggleLoading(!0);try{const m=await this.complete({prompt:a,selection:f,codeBefore:p,codeAfter:_,editorView:o,signal:this.abortController.signal});if(!o.state.field(Sr).show)return;if(!m||typeof m!="string")throw new Error("Invalid completion result");o.dispatch({changes:{from:d,to:u,insert:m},effects:[kr.of({show:!1,lineFrom:0,lineTo:0}),La.of({from:d,to:d+m.length,oldCode:f,newCode:m}),Vr.of(!1)]})}catch(m){if(m instanceof DOMException&&m.name==="AbortError")return;(g=r.onError)==null||g.call(r,m)}finally{this.cleanup(),this.toggleLoading(!1),o.focus()}});this.complete=n}toDOM(n){if(this.dom)return this.dom;this.view=n;const o=n.state.field(zg),r=n.state.field(Bg),s=ln("div","cm-ai-input-container");this.inputContainer=s,this.dom=s;const i=ln("form","cm-ai-input-form");this.form=i,i.setAttribute("role","search"),i.setAttribute("aria-label","AI editing instructions"),i.addEventListener("submit",m=>m.preventDefault());const a=ln("input","cm-ai-input");this.input=a,i.append(a),a.placeholder="Editing instructions...",a.setAttribute("aria-label","AI editing instructions"),a.setAttribute("autocomplete","off"),a.setAttribute("spellcheck","true"),a.value=o.inputValue;const l=ln("div","cm-ai-loading-container");this.loadingContainer=l;const c=ln("div","cm-ai-loading-indicator");c.setAttribute("role","status"),c.setAttribute("aria-live","polite"),c.textContent="Generating";const d=ln("button","cm-ai-cancel-button");d.textContent="Cancel",d.setAttribute("aria-label","Cancel code generation"),d.addEventListener("click",this.onCancel),l.append(d,c);const u=ln("div","cm-ai-help-info");this.helpInfo=u;const f=u.appendChild(document.createElement("button"));f.className="cm-ai-help-info-button",f.textContent="Esc to close",f.addEventListener("click",this.onCancel);const p=ln("button","cm-ai-generate-button");function _(m){u.replaceChildren(m?p:f)}p.textContent="\u23CE Generate",p.setAttribute("aria-label","Generate code"),p.addEventListener("click",this.handleSubmit),this.toggleLoading(r),o.shouldFocus&&requestAnimationFrame(()=>{a.value=o.inputValue,a.focus(),n.dispatch({effects:ai.of(!1)})}),_(a.value),a.addEventListener("input",function(){n.dispatch({effects:ii.of(a.value)});const m=a.value.trim();m!==g&&(g=m,_(m))}),a.addEventListener("keydown",this.onKeyDown);let g="";return s}toggleLoading(n){var o;this.inputContainer&&this.form&&this.loadingContainer&&this.helpInfo&&((o=this.inputContainer)==null||o.replaceChildren(this.form,n?this.loadingContainer:this.helpInfo))}updateDOM(n,o){return this.dom=n,this.input=n.querySelector(".cm-ai-input"),!0}cleanup(){var n,o,r;(n=this.abortController)==null||n.abort(),this.abortController=null,(o=this.dom)==null||o.remove(),(r=this.input)==null||r.remove(),this.dom=null,this.input=null}destroy(){this.cleanup()}}function WN(t){if(!t.prompt)throw new Error("prompt function is required");return[si.of(t),Sr,zg,li,Bg,[UN,VN],RN,Hn.of([{key:Ur.showInput,run:Ug}]),Vo.highest([Hn.of([{key:Ur.acceptEdit,run:Vg},{key:Ur.rejectEdit,run:$g}])]),qN,GN,YN,JN]}const qN=st.updateListener.of(t=>{const e=t.state.field(Sr);if(!e.show||!t.docChanged)return;let{lineFrom:n,lineTo:o}=e,r=!1;t.changes.iterChanges((s,i,a,l)=>{const c=t.state.doc.lineAt(s).number;if(c<n){const d=t.state.doc.lineAt(l).number-t.state.doc.lineAt(a).number;n+=d,o+=d,r=!0}else if(c<=o){const d=t.state.doc.lineAt(l).number-t.state.doc.lineAt(a).number;o+=d,r=!0}}),r&&t.view.dispatch({effects:[kr.of({show:!0,lineFrom:n,lineTo:o})]})}),GN=st.decorations.of(t=>{const e=t.state.field(li);return e?dt.set([dt.mark({class:"cm-new-code-line"}).range(e.from,e.to)]):dt.none}),YN=st.decorations.compute([Sr],t=>{const e=t.field(Sr),n=t.facet(si),o=[];if(e.show){const r=e.lineFrom,s=e.lineTo;for(let i=r;i<=s;i++){const a=t.doc.line(i).from;o.push(dt.line({class:"cm-ai-selection"}).range(a)),i===r&&o.push(dt.widget({widget:new HN(n.prompt),side:-1}).range(a))}}return dt.set(o)}),JN=En.define({create:t=>dt.none,update(t,e){const n=e.state.field(li);return n?dt.set([dt.widget({widget:new $N(n.oldCode),block:!0}).range(n.from)]):dt.none},provide:t=>st.decorations.from(t)}),Fa=En.define({create:()=>({suggestion:null}),update(t,e){const n=e.effects.find(o=>o.is(za));return e.docChanged||n||e.selection?n&&e.state.doc===n.value.doc?{suggestion:n.value.text}:{suggestion:null}:t}}),za=Ut.define();class KN extends Hs{constructor(n){super();ee(this,"suggestion");this.suggestion=n}toDOM(){const n=document.createElement("span");return n.style.opacity="0.4",n.className="cm-inline-suggestion",n.textContent=this.suggestion,n.setAttribute("role","suggestion"),n.setAttribute("aria-label",`Suggestion: ${this.suggestion}`),n}get lineBreaks(){return this.suggestion.split(`
99
- `).length-1}}class XN{constructor(e){ee(this,"cache",new Map);ee(this,"timeout");this.timeout=e}get(e){const n=this.cache.get(e);return n?Date.now()-n.timestamp>this.timeout?(this.cache.delete(e),null):n.result:null}set(e,n){this.cache.set(e,{result:n,timestamp:Date.now()})}}const ZN=(t,e)=>Zn.fromClass(class{constructor(){ee(this,"abortController",null);ee(this,"cache");this.cache=new XN(e.cacheTimeout??1e3)}async update(n){var i,a,l,c,d;if(!n.docChanged||((a=(i=e.events)==null?void 0:i.beforeSuggestionFetch)==null?void 0:a.call(i,n.view))===!1)return;(l=this.abortController)==null||l.abort(),this.abortController=new AbortController;const o=n.state.doc,r=o.toString(),s=this.cache.get(r);if(s)n.view.dispatch({effects:za.of({text:s,doc:o})});else try{const u=await t(n.state,this.abortController.signal);if(this.abortController.signal.aborted||((d=(c=e.events)==null?void 0:c.shouldShowSuggestion)==null?void 0:d.call(c,n.view,u))===!1)return;this.cache.set(r,u),n.view.dispatch({effects:za.of({text:u,doc:o})})}catch(u){u instanceof Error&&u.name!=="AbortError"&&console.error("Suggestion fetch error:",u)}}destroy(){var n;(n=this.abortController)==null||n.abort()}}),QN=Zn.fromClass(class{constructor(){ee(this,"decorations");this.decorations=dt.none}update(t){var n;const e=(n=t.state.field(Fa))==null?void 0:n.suggestion;this.decorations=e?function(o,r){const s=o.state.selection.main.head,i=[],a=dt.widget({widget:new KN(r),side:1});return i.push(a.range(s)),dt.set(i)}(t.view,e):dt.none}},{decorations:t=>t.decorations});function ej(t,e,n,o){return{...t.changeByRange(r=>{if(r===t.selection.main)return{changes:{from:n,to:o,insert:e},range:Uo.cursor(n+e.length)};const s=o-n;return!r.empty||s&&t.sliceDoc(r.from-s,r.from)!==t.sliceDoc(n,o)?{range:r}:{changes:{from:r.from-s,to:r.from,insert:e},range:Uo.cursor(r.from-s+e.length)}}),userEvent:"input.complete"}}const Hg=t=>{var o,r,s;const e=(o=t.state.field(Fa))==null?void 0:o.suggestion;if(!e)return!1;const n=t.state.facet(bd);return t.dispatch({effects:za.of({text:null,doc:t.state.doc})}),(s=(r=n.events)==null?void 0:r.onSuggestionRejected)==null||s.call(r,t,e),!0},tj=Hn.of([{key:"Tab",run:t=>{var o,r,s;const e=(o=t.state.field(Fa))==null?void 0:o.suggestion;if(!e)return!1;const n=t.state.facet(bd);return t.dispatch({...ej(t.state,e,t.state.selection.main.head,t.state.selection.main.head)}),(s=(r=n.events)==null?void 0:r.onSuggestionAccepted)==null||s.call(r,t,e),!0}},{key:"Escape",run:Hg}]),bd=$s.define({combine:t=>t.at(-1)});function Wg(t){const{delay:e=500,includeKeymap:n=!0}=t,o=function(r,s,i){let a=()=>{};return(...l)=>(a(),new Promise((c,d)=>{const u=setTimeout(()=>c(r(...l)),s);a=()=>{clearTimeout(u),i!==void 0&&d(i)}}))}(t.fetchFn,e);return[Fa,bd.of(t),ZN(o,t),QN,n?tj:[]]}const yd=Ut.define(),xd=Ut.define(),wd=Ut.define();function Ct(t,e){if(!t)throw new Error(e)}function Ba(t){if(typeof t!="number")throw new Error("invalid int 32: "+typeof t);if(!Number.isInteger(t)||t>2147483647||t<-2147483648)throw new Error("invalid int 32: "+t)}function vd(t){if(typeof t!="number")throw new Error("invalid uint 32: "+typeof t);if(!Number.isInteger(t)||t>4294967295||t<0)throw new Error("invalid uint 32: "+t)}function qg(t){if(typeof t!="number")throw new Error("invalid float 32: "+typeof t);if(Number.isFinite(t)&&(t>3402823466385289e23||t<-3402823466385289e23))throw new Error("invalid float 32: "+t)}const Gg=Symbol("@bufbuild/protobuf/enum-type");function nj(t){const e=t[Gg];return Ct(e,"missing enum type on enum object"),e}function Yg(t,e,n,o){t[Gg]=Jg(e,n.map(r=>({no:r.no,name:r.name,localName:t[r.no]})))}function Jg(t,e,n){const o=Object.create(null),r=Object.create(null),s=[];for(const i of e){const a=Kg(i);s.push(a),o[i.name]=a,r[i.no]=a}return{typeName:t,values:s,findName:i=>o[i],findNumber:i=>r[i]}}function oj(t,e,n){const o={};for(const r of e){const s=Kg(r);o[s.localName]=s.no,o[s.no]=s.localName}return Yg(o,t,e),o}function Kg(t){return"localName"in t?t:Object.assign(Object.assign({},t),{localName:t.name})}class Ot{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,n){const o=this.getType().runtime.bin,r=o.makeReadOptions(n);return o.readMessage(this,r.readerFactory(e),e.byteLength,r),this}fromJson(e,n){const o=this.getType(),r=o.runtime.json,s=r.makeReadOptions(n);return r.readMessage(o,e,s,this),this}fromJsonString(e,n){let o;try{o=JSON.parse(e)}catch(r){throw new Error(`cannot decode ${this.getType().typeName} from JSON: ${r instanceof Error?r.message:String(r)}`)}return this.fromJson(o,n)}toBinary(e){const n=this.getType().runtime.bin,o=n.makeWriteOptions(e),r=o.writerFactory();return n.writeMessage(this,r,o),r.finish()}toJson(e){const n=this.getType().runtime.json,o=n.makeWriteOptions(e);return n.writeMessage(this,o)}toJsonString(e){var n;const o=this.toJson(e);return JSON.stringify(o,null,(n=e==null?void 0:e.prettySpaces)!==null&&n!==void 0?n:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}}function rj(){let t=0,e=0;for(let o=0;o<28;o+=7){let r=this.buf[this.pos++];if(t|=(127&r)<<o,!(128&r))return this.assertBounds(),[t,e]}let n=this.buf[this.pos++];if(t|=(15&n)<<28,e=(112&n)>>4,!(128&n))return this.assertBounds(),[t,e];for(let o=3;o<=31;o+=7){let r=this.buf[this.pos++];if(e|=(127&r)<<o,!(128&r))return this.assertBounds(),[t,e]}throw new Error("invalid varint")}function kd(t,e,n){for(let s=0;s<28;s+=7){const i=t>>>s,a=!(!(i>>>7)&&e==0),l=255&(a?128|i:i);if(n.push(l),!a)return}const o=t>>>28&15|(7&e)<<4,r=!!(e>>3);if(n.push(255&(r?128|o:o)),r){for(let s=3;s<31;s+=7){const i=e>>>s,a=!!(i>>>7),l=255&(a?128|i:i);if(n.push(l),!a)return}n.push(e>>>31&1)}}const Ua=4294967296;function Xg(t){const e=t[0]==="-";e&&(t=t.slice(1));const n=1e6;let o=0,r=0;function s(i,a){const l=Number(t.slice(i,a));r*=n,o=o*n+l,o>=Ua&&(r+=o/Ua|0,o%=Ua)}return s(-24,-18),s(-18,-12),s(-12,-6),s(-6),e?Qg(o,r):Sd(o,r)}function Zg(t,e){if({lo:t,hi:e}=function(l,c){return{lo:l>>>0,hi:c>>>0}}(t,e),e<=2097151)return String(Ua*e+t);const n=16777215&(t>>>24|e<<8),o=e>>16&65535;let r=(16777215&t)+6777216*n+6710656*o,s=n+8147497*o,i=2*o;const a=1e7;return r>=a&&(s+=Math.floor(r/a),r%=a),s>=a&&(i+=Math.floor(s/a),s%=a),i.toString()+e_(s)+e_(r)}function Sd(t,e){return{lo:0|t,hi:0|e}}function Qg(t,e){return e=~e,t?t=1+~t:e+=1,Sd(t,e)}const e_=t=>{const e=String(t);return"0000000".slice(e.length)+e};function t_(t,e){if(t>=0){for(;t>127;)e.push(127&t|128),t>>>=7;e.push(t)}else{for(let n=0;n<9;n++)e.push(127&t|128),t>>=7;e.push(1)}}function sj(){let t=this.buf[this.pos++],e=127&t;if(!(128&t))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(127&t)<<7,!(128&t))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(127&t)<<14,!(128&t))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(127&t)<<21,!(128&t))return this.assertBounds(),e;t=this.buf[this.pos++],e|=(15&t)<<28;for(let n=5;128&t&&n<10;n++)t=this.buf[this.pos++];if(128&t)throw new Error("invalid varint");return this.assertBounds(),e>>>0}var ij={};const vt=function(){const t=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof t.getBigInt64=="function"&&typeof t.getBigUint64=="function"&&typeof t.setBigInt64=="function"&&typeof t.setBigUint64=="function"&&(typeof process!="object"||ij.BUF_BIGINT_DISABLE!=="1")){const o=BigInt("-9223372036854775808"),r=BigInt("9223372036854775807"),s=BigInt("0"),i=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(a){const l=typeof a=="bigint"?a:BigInt(a);if(l>r||l<o)throw new Error(`int64 invalid: ${a}`);return l},uParse(a){const l=typeof a=="bigint"?a:BigInt(a);if(l>i||l<s)throw new Error(`uint64 invalid: ${a}`);return l},enc(a){return t.setBigInt64(0,this.parse(a),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},uEnc(a){return t.setBigInt64(0,this.uParse(a),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},dec:(a,l)=>(t.setInt32(0,a,!0),t.setInt32(4,l,!0),t.getBigInt64(0,!0)),uDec:(a,l)=>(t.setInt32(0,a,!0),t.setInt32(4,l,!0),t.getBigUint64(0,!0))}}const e=o=>Ct(/^-?[0-9]+$/.test(o),`int64 invalid: ${o}`),n=o=>Ct(/^[0-9]+$/.test(o),`uint64 invalid: ${o}`);return{zero:"0",supported:!1,parse:o=>(typeof o!="string"&&(o=o.toString()),e(o),o),uParse:o=>(typeof o!="string"&&(o=o.toString()),n(o),o),enc:o=>(typeof o!="string"&&(o=o.toString()),e(o),Xg(o)),uEnc:o=>(typeof o!="string"&&(o=o.toString()),n(o),Xg(o)),dec:(o,r)=>function(s,i){let a=Sd(s,i);const l=2147483648&a.hi;l&&(a=Qg(a.lo,a.hi));const c=Zg(a.lo,a.hi);return l?"-"+c:c}(o,r),uDec:(o,r)=>Zg(o,r)}}();var fe,Wo,It;function qo(t,e,n){if(e===n)return!0;if(t==fe.BYTES){if(!(e instanceof Uint8Array&&n instanceof Uint8Array)||e.length!==n.length)return!1;for(let o=0;o<e.length;o++)if(e[o]!==n[o])return!1;return!0}switch(t){case fe.UINT64:case fe.FIXED64:case fe.INT64:case fe.SFIXED64:case fe.SINT64:return e==n}return!1}function $r(t,e){switch(t){case fe.BOOL:return!1;case fe.UINT64:case fe.FIXED64:case fe.INT64:case fe.SFIXED64:case fe.SINT64:return e==0?vt.zero:"0";case fe.DOUBLE:case fe.FLOAT:return 0;case fe.BYTES:return new Uint8Array(0);case fe.STRING:return"";default:return 0}}function n_(t,e){switch(t){case fe.BOOL:return e===!1;case fe.STRING:return e==="";case fe.BYTES:return e instanceof Uint8Array&&!e.byteLength;default:return e==0}}(function(t){t[t.DOUBLE=1]="DOUBLE",t[t.FLOAT=2]="FLOAT",t[t.INT64=3]="INT64",t[t.UINT64=4]="UINT64",t[t.INT32=5]="INT32",t[t.FIXED64=6]="FIXED64",t[t.FIXED32=7]="FIXED32",t[t.BOOL=8]="BOOL",t[t.STRING=9]="STRING",t[t.BYTES=12]="BYTES",t[t.UINT32=13]="UINT32",t[t.SFIXED32=15]="SFIXED32",t[t.SFIXED64=16]="SFIXED64",t[t.SINT32=17]="SINT32",t[t.SINT64=18]="SINT64"})(fe||(fe={})),function(t){t[t.BIGINT=0]="BIGINT",t[t.STRING=1]="STRING"}(Wo||(Wo={})),function(t){t[t.Varint=0]="Varint",t[t.Bit64=1]="Bit64",t[t.LengthDelimited=2]="LengthDelimited",t[t.StartGroup=3]="StartGroup",t[t.EndGroup=4]="EndGroup",t[t.Bit32=5]="Bit32"}(It||(It={}));class aj{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let r=0;r<this.chunks.length;r++)e+=this.chunks[r].length;let n=new Uint8Array(e),o=0;for(let r=0;r<this.chunks.length;r++)n.set(this.chunks[r],o),o+=this.chunks[r].length;return this.chunks=[],n}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),n=this.stack.pop();if(!n)throw new Error("invalid state, fork stack empty");return this.chunks=n.chunks,this.buf=n.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,n){return this.uint32((e<<3|n)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(vd(e);e>127;)this.buf.push(127&e|128),e>>>=7;return this.buf.push(e),this}int32(e){return Ba(e),t_(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let n=this.textEncoder.encode(e);return this.uint32(n.byteLength),this.raw(n)}float(e){qg(e);let n=new Uint8Array(4);return new DataView(n.buffer).setFloat32(0,e,!0),this.raw(n)}double(e){let n=new Uint8Array(8);return new DataView(n.buffer).setFloat64(0,e,!0),this.raw(n)}fixed32(e){vd(e);let n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,e,!0),this.raw(n)}sfixed32(e){Ba(e);let n=new Uint8Array(4);return new DataView(n.buffer).setInt32(0,e,!0),this.raw(n)}sint32(e){return Ba(e),t_(e=(e<<1^e>>31)>>>0,this.buf),this}sfixed64(e){let n=new Uint8Array(8),o=new DataView(n.buffer),r=vt.enc(e);return o.setInt32(0,r.lo,!0),o.setInt32(4,r.hi,!0),this.raw(n)}fixed64(e){let n=new Uint8Array(8),o=new DataView(n.buffer),r=vt.uEnc(e);return o.setInt32(0,r.lo,!0),o.setInt32(4,r.hi,!0),this.raw(n)}int64(e){let n=vt.enc(e);return kd(n.lo,n.hi,this.buf),this}sint64(e){let n=vt.enc(e),o=n.hi>>31;return kd(n.lo<<1^o,(n.hi<<1|n.lo>>>31)^o,this.buf),this}uint64(e){let n=vt.uEnc(e);return kd(n.lo,n.hi,this.buf),this}}class lj{constructor(e,n){this.varint64=rj,this.uint32=sj,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=n??new TextDecoder}tag(){let e=this.uint32(),n=e>>>3,o=7&e;if(n<=0||o<0||o>5)throw new Error("illegal tag: field no "+n+" wire type "+o);return[n,o]}skip(e,n){let o=this.pos;switch(e){case It.Varint:for(;128&this.buf[this.pos++];);break;case It.Bit64:this.pos+=4;case It.Bit32:this.pos+=4;break;case It.LengthDelimited:let r=this.uint32();this.pos+=r;break;case It.StartGroup:for(;;){const[s,i]=this.tag();if(i===It.EndGroup){if(n!==void 0&&s!==n)throw new Error("invalid end group tag");break}this.skip(i,s)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(o,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return 0|this.uint32()}sint32(){let e=this.uint32();return e>>>1^-(1&e)}int64(){return vt.dec(...this.varint64())}uint64(){return vt.uDec(...this.varint64())}sint64(){let[e,n]=this.varint64(),o=-(1&e);return e=(e>>>1|(1&n)<<31)^o,n=n>>>1^o,vt.dec(e,n)}bool(){let[e,n]=this.varint64();return e!==0||n!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return vt.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return vt.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),n=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(n,n+e)}string(){return this.textDecoder.decode(this.bytes())}}function o_(t){const e=t.field.localName,n=Object.create(null);return n[e]=function(o){const r=o.field;if(r.repeated)return[];if(r.default!==void 0)return r.default;switch(r.kind){case"enum":return r.T.values[0].no;case"scalar":return $r(r.T,r.L);case"message":const s=r.T,i=new s;return s.fieldWrapper?s.fieldWrapper.unwrapField(i):i;case"map":throw"map fields are not allowed to be extensions"}}(t),[n,()=>n[e]]}let bo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),Va=[];for(let t=0;t<bo.length;t++)Va[bo[t].charCodeAt(0)]=t;Va[45]=bo.indexOf("+"),Va[95]=bo.indexOf("/");const $a={dec(t){let e=3*t.length/4;t[t.length-2]=="="?e-=2:t[t.length-1]=="="&&(e-=1);let n,o=new Uint8Array(e),r=0,s=0,i=0;for(let a=0;a<t.length;a++){if(n=Va[t.charCodeAt(a)],n===void 0)switch(t[a]){case"=":s=0;case`
100
- `:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string.")}switch(s){case 0:i=n,s=1;break;case 1:o[r++]=i<<2|(48&n)>>4,i=n,s=2;break;case 2:o[r++]=(15&i)<<4|(60&n)>>2,i=n,s=3;break;case 3:o[r++]=(3&i)<<6|n,s=0}}if(s==1)throw Error("invalid base64 string.");return o.subarray(0,r)},enc(t){let e,n="",o=0,r=0;for(let s=0;s<t.length;s++)switch(e=t[s],o){case 0:n+=bo[e>>2],r=(3&e)<<4,o=1;break;case 1:n+=bo[r|e>>4],r=(15&e)<<2,o=2;break;case 2:n+=bo[r|e>>6],n+=bo[63&e],o=0}return o&&(n+=bo[r],n+="=",o==1&&(n+="=")),n}};function cj(t,e,n){s_(e,t);const o=e.runtime.bin.makeReadOptions(n),r=function(a,l){if(!l.repeated&&(l.kind=="enum"||l.kind=="scalar")){for(let c=a.length-1;c>=0;--c)if(a[c].no==l.no)return[a[c]];return[]}return a.filter(c=>c.no===l.no)}(t.getType().runtime.bin.listUnknownFields(t),e.field),[s,i]=o_(e);for(const a of r)e.runtime.bin.readField(s,o.readerFactory(a.data),e.field,a.wireType,o);return i()}function dj(t,e,n,o){s_(e,t);const r=e.runtime.bin.makeReadOptions(o),s=e.runtime.bin.makeWriteOptions(o);if(r_(t,e)){const c=t.getType().runtime.bin.listUnknownFields(t).filter(d=>d.no!=e.field.no);t.getType().runtime.bin.discardUnknownFields(t);for(const d of c)t.getType().runtime.bin.onUnknownField(t,d.no,d.wireType,d.data)}const i=s.writerFactory();let a=e.field;a.opt||a.repeated||a.kind!="enum"&&a.kind!="scalar"||(a=Object.assign(Object.assign({},e.field),{opt:!0})),e.runtime.bin.writeField(a,n,i,s);const l=r.readerFactory(i.finish());for(;l.pos<l.len;){const[c,d]=l.tag(),u=l.skip(d,c);t.getType().runtime.bin.onUnknownField(t,c,d,u)}}function r_(t,e){const n=t.getType();return e.extendee.typeName===n.typeName&&!!n.runtime.bin.listUnknownFields(t).find(o=>o.no==e.field.no)}function s_(t,e){Ct(t.extendee.typeName==e.getType().typeName,`extension ${t.typeName} can only be applied to message ${t.extendee.typeName}`)}function i_(t,e){const n=t.localName;if(t.repeated)return e[n].length>0;if(t.oneof)return e[t.oneof.localName].case===n;switch(t.kind){case"enum":case"scalar":return t.opt||t.req?e[n]!==void 0:t.kind=="enum"?e[n]!==t.T.values[0].no:!n_(t.T,e[n]);case"message":return e[n]!==void 0;case"map":return Object.keys(e[n]).length>0}}function a_(t,e){const n=t.localName,o=!t.opt&&!t.req;if(t.repeated)e[n]=[];else if(t.oneof)e[t.oneof.localName]={case:void 0};else switch(t.kind){case"map":e[n]={};break;case"enum":e[n]=o?t.T.values[0].no:void 0;break;case"scalar":e[n]=o?$r(t.T,t.L):void 0;break;case"message":e[n]=void 0}}function Cr(t,e){if(t===null||typeof t!="object"||!Object.getOwnPropertyNames(Ot.prototype).every(o=>o in t&&typeof t[o]=="function"))return!1;const n=t.getType();return n!==null&&typeof n=="function"&&"typeName"in n&&typeof n.typeName=="string"&&(e===void 0||n.typeName==e.typeName)}function l_(t,e){return Cr(e)||!t.fieldWrapper?e:t.fieldWrapper.wrapField(e)}fe.DOUBLE,fe.FLOAT,fe.INT64,fe.UINT64,fe.INT32,fe.UINT32,fe.BOOL,fe.STRING,fe.BYTES;const c_={ignoreUnknownFields:!1},d_={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function uj(t){return t?Object.assign(Object.assign({},c_),t):c_}function hj(t){return t?Object.assign(Object.assign({},d_),t):d_}const Ha=Symbol(),Wa=Symbol();function to(t){if(t===null)return"null";switch(typeof t){case"object":return Array.isArray(t)?"array":"object";case"string":return t.length>100?"string":`"${t.split('"').join('\\"')}"`;default:return String(t)}}function u_(t,e,n,o,r){let s=n.localName;if(n.repeated){if(Ct(n.kind!="map"),e===null)return;if(!Array.isArray(e))throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${to(e)}`);const i=t[s];for(const a of e){if(a===null)throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${to(a)}`);switch(n.kind){case"message":i.push(n.T.fromJson(a,o));break;case"enum":const l=Cd(n.T,a,o.ignoreUnknownFields,!0);l!==Wa&&i.push(l);break;case"scalar":try{i.push(ci(n.T,a,n.L,!0))}catch(c){let d=`cannot decode field ${r.typeName}.${n.name} from JSON: ${to(a)}`;throw c instanceof Error&&c.message.length>0&&(d+=`: ${c.message}`),new Error(d)}}}}else if(n.kind=="map"){if(e===null)return;if(typeof e!="object"||Array.isArray(e))throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${to(e)}`);const i=t[s];for(const[a,l]of Object.entries(e)){if(l===null)throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: map value null`);let c;try{c=fj(n.K,a)}catch(d){let u=`cannot decode map key for field ${r.typeName}.${n.name} from JSON: ${to(e)}`;throw d instanceof Error&&d.message.length>0&&(u+=`: ${d.message}`),new Error(u)}switch(n.V.kind){case"message":i[c]=n.V.T.fromJson(l,o);break;case"enum":const d=Cd(n.V.T,l,o.ignoreUnknownFields,!0);d!==Wa&&(i[c]=d);break;case"scalar":try{i[c]=ci(n.V.T,l,Wo.BIGINT,!0)}catch(u){let f=`cannot decode map value for field ${r.typeName}.${n.name} from JSON: ${to(e)}`;throw u instanceof Error&&u.message.length>0&&(f+=`: ${u.message}`),new Error(f)}}}}else switch(n.oneof&&(t=t[n.oneof.localName]={case:s},s="value"),n.kind){case"message":const i=n.T;if(e===null&&i.typeName!="google.protobuf.Value")return;let a=t[s];Cr(a)?a.fromJson(e,o):(t[s]=a=i.fromJson(e,o),i.fieldWrapper&&!n.oneof&&(t[s]=i.fieldWrapper.unwrapField(a)));break;case"enum":const l=Cd(n.T,e,o.ignoreUnknownFields,!1);switch(l){case Ha:a_(n,t);break;case Wa:break;default:t[s]=l}break;case"scalar":try{const c=ci(n.T,e,n.L,!1);c===Ha?a_(n,t):t[s]=c}catch(c){let d=`cannot decode field ${r.typeName}.${n.name} from JSON: ${to(e)}`;throw c instanceof Error&&c.message.length>0&&(d+=`: ${c.message}`),new Error(d)}}}function fj(t,e){if(t===fe.BOOL)switch(e){case"true":e=!0;break;case"false":e=!1}return ci(t,e,Wo.BIGINT,!0).toString()}function ci(t,e,n,o){if(e===null)return o?$r(t,n):Ha;switch(t){case fe.DOUBLE:case fe.FLOAT:if(e==="NaN")return Number.NaN;if(e==="Infinity")return Number.POSITIVE_INFINITY;if(e==="-Infinity")return Number.NEGATIVE_INFINITY;if(e===""||typeof e=="string"&&e.trim().length!==e.length||typeof e!="string"&&typeof e!="number")break;const r=Number(e);if(Number.isNaN(r)||!Number.isFinite(r))break;return t==fe.FLOAT&&qg(r),r;case fe.INT32:case fe.FIXED32:case fe.SFIXED32:case fe.SINT32:case fe.UINT32:let s;if(typeof e=="number"?s=e:typeof e=="string"&&e.length>0&&e.trim().length===e.length&&(s=Number(e)),s===void 0)break;return t==fe.UINT32||t==fe.FIXED32?vd(s):Ba(s),s;case fe.INT64:case fe.SFIXED64:case fe.SINT64:if(typeof e!="number"&&typeof e!="string")break;const i=vt.parse(e);return n?i.toString():i;case fe.FIXED64:case fe.UINT64:if(typeof e!="number"&&typeof e!="string")break;const a=vt.uParse(e);return n?a.toString():a;case fe.BOOL:if(typeof e!="boolean")break;return e;case fe.STRING:if(typeof e!="string")break;try{encodeURIComponent(e)}catch{throw new Error("invalid UTF8")}return e;case fe.BYTES:if(e==="")return new Uint8Array(0);if(typeof e!="string")break;return $a.dec(e)}throw new Error}function Cd(t,e,n,o){if(e===null)return t.typeName=="google.protobuf.NullValue"?0:o?t.values[0].no:Ha;switch(typeof e){case"number":if(Number.isInteger(e))return e;break;case"string":const r=t.findName(e);if(r!==void 0)return r.no;if(n)return Wa}throw new Error(`cannot decode enum ${t.typeName} from JSON: ${to(e)}`)}function pj(t){return!(!t.repeated&&t.kind!="map")||!t.oneof&&t.kind!="message"&&!t.opt&&!t.req}function h_(t,e,n){if(t.kind=="map"){Ct(typeof e=="object"&&e!=null);const o={},r=Object.entries(e);switch(t.V.kind){case"scalar":for(const[i,a]of r)o[i.toString()]=qa(t.V.T,a);break;case"message":for(const[i,a]of r)o[i.toString()]=a.toJson(n);break;case"enum":const s=t.V.T;for(const[i,a]of r)o[i.toString()]=Nd(s,a,n.enumAsInteger)}return n.emitDefaultValues||r.length>0?o:void 0}if(t.repeated){Ct(Array.isArray(e));const o=[];switch(t.kind){case"scalar":for(let r=0;r<e.length;r++)o.push(qa(t.T,e[r]));break;case"enum":for(let r=0;r<e.length;r++)o.push(Nd(t.T,e[r],n.enumAsInteger));break;case"message":for(let r=0;r<e.length;r++)o.push(e[r].toJson(n))}return n.emitDefaultValues||o.length>0?o:void 0}switch(t.kind){case"scalar":return qa(t.T,e);case"enum":return Nd(t.T,e,n.enumAsInteger);case"message":return l_(t.T,e).toJson(n)}}function Nd(t,e,n){var o;if(Ct(typeof e=="number"),t.typeName=="google.protobuf.NullValue")return null;if(n)return e;const r=t.findNumber(e);return(o=r==null?void 0:r.name)!==null&&o!==void 0?o:e}function qa(t,e){switch(t){case fe.INT32:case fe.SFIXED32:case fe.SINT32:case fe.FIXED32:case fe.UINT32:return Ct(typeof e=="number"),e;case fe.FLOAT:case fe.DOUBLE:return Ct(typeof e=="number"),Number.isNaN(e)?"NaN":e===Number.POSITIVE_INFINITY?"Infinity":e===Number.NEGATIVE_INFINITY?"-Infinity":e;case fe.STRING:return Ct(typeof e=="string"),e;case fe.BOOL:return Ct(typeof e=="boolean"),e;case fe.UINT64:case fe.FIXED64:case fe.INT64:case fe.SFIXED64:case fe.SINT64:return Ct(typeof e=="bigint"||typeof e=="string"||typeof e=="number"),e.toString();case fe.BYTES:return Ct(e instanceof Uint8Array),$a.enc(e)}}const Hr=Symbol("@bufbuild/protobuf/unknown-fields"),f_={readUnknownFields:!0,readerFactory:t=>new lj(t)},p_={writeUnknownFields:!0,writerFactory:()=>new aj};function mj(t){return t?Object.assign(Object.assign({},f_),t):f_}function gj(t){return t?Object.assign(Object.assign({},p_),t):p_}function m_(t,e,n,o,r){let{repeated:s,localName:i}=n;switch(n.oneof&&((t=t[n.oneof.localName]).case!=i&&delete t.value,t.case=i,i="value"),n.kind){case"scalar":case"enum":const a=n.kind=="enum"?fe.INT32:n.T;let l=Ya;if(n.kind=="scalar"&&n.L>0&&(l=_j),s){let f=t[i];if(o==It.LengthDelimited&&a!=fe.STRING&&a!=fe.BYTES){let p=e.uint32()+e.pos;for(;e.pos<p;)f.push(l(e,a))}else f.push(l(e,a))}else t[i]=l(e,a);break;case"message":const c=n.T;s?t[i].push(Ga(e,new c,r,n)):Cr(t[i])?Ga(e,t[i],r,n):(t[i]=Ga(e,new c,r,n),!c.fieldWrapper||n.oneof||n.repeated||(t[i]=c.fieldWrapper.unwrapField(t[i])));break;case"map":let[d,u]=function(f,p,_){const g=p.uint32(),m=p.pos+g;let b,x;for(;p.pos<m;){const[y]=p.tag();switch(y){case 1:b=Ya(p,f.K);break;case 2:switch(f.V.kind){case"scalar":x=Ya(p,f.V.T);break;case"enum":x=p.int32();break;case"message":x=Ga(p,new f.V.T,_,void 0)}}}if(b===void 0&&(b=$r(f.K,Wo.BIGINT)),typeof b!="string"&&typeof b!="number"&&(b=b.toString()),x===void 0)switch(f.V.kind){case"scalar":x=$r(f.V.T,Wo.BIGINT);break;case"enum":x=f.V.T.values[0].no;break;case"message":x=new f.V.T}return[b,x]}(n,e,r);t[i][d]=u}}function Ga(t,e,n,o){const r=e.getType().runtime.bin,s=o==null?void 0:o.delimited;return r.readMessage(e,t,s?o.no:t.uint32(),n,s),e}function _j(t,e){const n=Ya(t,e);return typeof n=="bigint"?n.toString():n}function Ya(t,e){switch(e){case fe.STRING:return t.string();case fe.BOOL:return t.bool();case fe.DOUBLE:return t.double();case fe.FLOAT:return t.float();case fe.INT32:return t.int32();case fe.INT64:return t.int64();case fe.UINT64:return t.uint64();case fe.FIXED64:return t.fixed64();case fe.BYTES:return t.bytes();case fe.FIXED32:return t.fixed32();case fe.SFIXED32:return t.sfixed32();case fe.SFIXED64:return t.sfixed64();case fe.SINT64:return t.sint64();case fe.UINT32:return t.uint32();case fe.SINT32:return t.sint32()}}function g_(t,e,n,o){Ct(e!==void 0);const r=t.repeated;switch(t.kind){case"scalar":case"enum":let s=t.kind=="enum"?fe.INT32:t.T;if(r)if(Ct(Array.isArray(e)),t.packed)(function(i,a,l,c){if(!c.length)return;i.tag(l,It.LengthDelimited).fork();let[,d]=b_(a);for(let u=0;u<c.length;u++)i[d](c[u]);i.join()})(n,s,t.no,e);else for(const i of e)di(n,s,t.no,i);else di(n,s,t.no,e);break;case"message":if(r){Ct(Array.isArray(e));for(const i of e)__(n,o,t,i)}else __(n,o,t,e);break;case"map":Ct(typeof e=="object"&&e!=null);for(const[i,a]of Object.entries(e))bj(n,o,t,i,a)}}function bj(t,e,n,o,r){t.tag(n.no,It.LengthDelimited),t.fork();let s=o;switch(n.K){case fe.INT32:case fe.FIXED32:case fe.UINT32:case fe.SFIXED32:case fe.SINT32:s=Number.parseInt(o);break;case fe.BOOL:Ct(o=="true"||o=="false"),s=o=="true"}switch(di(t,n.K,1,s),n.V.kind){case"scalar":di(t,n.V.T,2,r);break;case"enum":di(t,fe.INT32,2,r);break;case"message":Ct(r!==void 0),t.tag(2,It.LengthDelimited).bytes(r.toBinary(e))}t.join()}function __(t,e,n,o){const r=l_(n.T,o);n.delimited?t.tag(n.no,It.StartGroup).raw(r.toBinary(e)).tag(n.no,It.EndGroup):t.tag(n.no,It.LengthDelimited).bytes(r.toBinary(e))}function di(t,e,n,o){Ct(o!==void 0);let[r,s]=b_(e);t.tag(n,r)[s](o)}function b_(t){let e=It.Varint;switch(t){case fe.BYTES:case fe.STRING:e=It.LengthDelimited;break;case fe.DOUBLE:case fe.FIXED64:case fe.SFIXED64:e=It.Bit64;break;case fe.FIXED32:case fe.SFIXED32:case fe.FLOAT:e=It.Bit32}return[e,fe[t].toLowerCase()]}function Ja(t){if(t===void 0)return t;if(Cr(t))return t.clone();if(t instanceof Uint8Array){const e=new Uint8Array(t.byteLength);return e.set(t),e}return t}function ui(t){return t instanceof Uint8Array?t:new Uint8Array(t)}class yj{constructor(e,n){this._fields=e,this._normalizer=n}findJsonName(e){if(!this.jsonNames){const n={};for(const o of this.list())n[o.jsonName]=n[o.name]=o;this.jsonNames=n}return this.jsonNames[e]}find(e){if(!this.numbers){const n={};for(const o of this.list())n[o.no]=o;this.numbers=n}return this.numbers[e]}list(){return this.all||(this.all=this._normalizer(this._fields)),this.all}byNumber(){return this.numbersAsc||(this.numbersAsc=this.list().concat().sort((e,n)=>e.no-n.no)),this.numbersAsc}byMember(){if(!this.members){this.members=[];const e=this.members;let n;for(const o of this.list())o.oneof?o.oneof!==n&&(n=o.oneof,e.push(n)):e.push(o)}return this.members}}function y_(t,e){const n=x_(t);return e?n:Sj(kj(n))}const xj=x_;function x_(t){let e=!1;const n=[];for(let o=0;o<t.length;o++){let r=t.charAt(o);switch(r){case"_":e=!0;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n.push(r),e=!1;break;default:e&&(e=!1,r=r.toUpperCase()),n.push(r)}}return n.join("")}const wj=new Set(["constructor","toString","toJSON","valueOf"]),vj=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),w_=t=>`${t}$`,kj=t=>vj.has(t)?w_(t):t,Sj=t=>wj.has(t)?w_(t):t;class Cj{constructor(e){this.kind="oneof",this.repeated=!1,this.packed=!1,this.opt=!1,this.req=!1,this.default=void 0,this.fields=[],this.name=e,this.localName=y_(e,!1)}addField(e){Ct(e.oneof===this,`field ${e.name} not one of ${this.name}`),this.fields.push(e)}findField(e){if(!this._lookup){this._lookup=Object.create(null);for(let n=0;n<this.fields.length;n++)this._lookup[this.fields[n].localName]=this.fields[n]}return this._lookup[e]}}const Se=(v_=t=>new yj(t,e=>function(n){var o,r,s,i,a,l;const c=[];let d;for(const u of typeof n=="function"?n():n){const f=u;if(f.localName=y_(u.name,u.oneof!==void 0),f.jsonName=(o=u.jsonName)!==null&&o!==void 0?o:xj(u.name),f.repeated=(r=u.repeated)!==null&&r!==void 0&&r,u.kind=="scalar"&&(f.L=(s=u.L)!==null&&s!==void 0?s:Wo.BIGINT),f.delimited=(i=u.delimited)!==null&&i!==void 0&&i,f.req=(a=u.req)!==null&&a!==void 0&&a,f.opt=(l=u.opt)!==null&&l!==void 0&&l,u.packed===void 0&&(f.packed=u.kind=="enum"||u.kind=="scalar"&&u.T!=fe.BYTES&&u.T!=fe.STRING),u.oneof!==void 0){const p=typeof u.oneof=="string"?u.oneof:u.oneof.name;d&&d.name==p||(d=new Cj(p)),f.oneof=d,d.addField(f)}c.push(f)}return c}(e)),k_=t=>{for(const e of t.getType().fields.byMember()){if(e.opt)continue;const n=e.localName,o=t;if(e.repeated)o[n]=[];else switch(e.kind){case"oneof":o[n]={case:void 0};break;case"enum":o[n]=0;break;case"map":o[n]={};break;case"scalar":o[n]=$r(e.T,e.L)}}},{syntax:"proto3",json:{makeReadOptions:uj,makeWriteOptions:hj,readMessage(t,e,n,o){if(e==null||Array.isArray(e)||typeof e!="object")throw new Error(`cannot decode message ${t.typeName} from JSON: ${to(e)}`);o=o??new t;const r=new Map,s=n.typeRegistry;for(const[i,a]of Object.entries(e)){const l=t.fields.findJsonName(i);if(l){if(l.oneof){if(a===null&&l.kind=="scalar")continue;const c=r.get(l.oneof);if(c!==void 0)throw new Error(`cannot decode message ${t.typeName} from JSON: multiple keys for oneof "${l.oneof.name}" present: "${c}", "${i}"`);r.set(l.oneof,i)}u_(o,a,l,n,t)}else{let c=!1;if(s!=null&&s.findExtension&&i.startsWith("[")&&i.endsWith("]")){const d=s.findExtension(i.substring(1,i.length-1));if(d&&d.extendee.typeName==t.typeName){c=!0;const[u,f]=o_(d);u_(u,a,d.field,n,d),dj(o,d,f(),n)}}if(!c&&!n.ignoreUnknownFields)throw new Error(`cannot decode message ${t.typeName} from JSON: key "${i}" is unknown`)}}return o},writeMessage(t,e){const n=t.getType(),o={};let r;try{for(r of n.fields.byNumber()){if(!i_(r,t)){if(r.req)throw"required field not set";if(!e.emitDefaultValues||!pj(r))continue}const i=h_(r,r.oneof?t[r.oneof.localName].value:t[r.localName],e);i!==void 0&&(o[e.useProtoFieldName?r.name:r.jsonName]=i)}const s=e.typeRegistry;if(s!=null&&s.findExtensionFor)for(const i of n.runtime.bin.listUnknownFields(t)){const a=s.findExtensionFor(n.typeName,i.no);if(a&&r_(t,a)){const l=cj(t,a,e),c=h_(a.field,l,e);c!==void 0&&(o[a.field.jsonName]=c)}}}catch(s){const i=r?`cannot encode field ${n.typeName}.${r.name} to JSON`:`cannot encode message ${n.typeName} to JSON`,a=s instanceof Error?s.message:String(s);throw new Error(i+(a.length>0?`: ${a}`:""))}return o},readScalar:(t,e,n)=>ci(t,e,n??Wo.BIGINT,!0),writeScalar(t,e,n){if(e!==void 0)return n||n_(t,e)?qa(t,e):void 0},debug:to},bin:{makeReadOptions:mj,makeWriteOptions:gj,listUnknownFields(t){var e;return(e=t[Hr])!==null&&e!==void 0?e:[]},discardUnknownFields(t){delete t[Hr]},writeUnknownFields(t,e){const n=t[Hr];if(n)for(const o of n)e.tag(o.no,o.wireType).raw(o.data)},onUnknownField(t,e,n,o){const r=t;Array.isArray(r[Hr])||(r[Hr]=[]),r[Hr].push({no:e,wireType:n,data:o})},readMessage(t,e,n,o,r){const s=t.getType(),i=r?e.len:e.pos+n;let a,l;for(;e.pos<i&&([a,l]=e.tag(),r!==!0||l!=It.EndGroup);){const c=s.fields.find(a);if(c)m_(t,e,c,l,o);else{const d=e.skip(l,a);o.readUnknownFields&&this.onUnknownField(t,a,l,d)}}if(r&&(l!=It.EndGroup||a!==n))throw new Error("invalid end group tag")},readField:m_,writeMessage(t,e,n){const o=t.getType();for(const r of o.fields.byNumber())if(i_(r,t))g_(r,r.oneof?t[r.oneof.localName].value:t[r.localName],e,n);else if(r.req)throw new Error(`cannot encode field ${o.typeName}.${r.name} to binary: required field not set`);return n.writeUnknownFields&&this.writeUnknownFields(t,e),e},writeField(t,e,n,o){e!==void 0&&g_(t,e,n,o)}},util:Object.assign(Object.assign({},{setEnumType:Yg,initPartial(t,e){if(t===void 0)return;const n=e.getType();for(const o of n.fields.byMember()){const r=o.localName,s=e,i=t;if(i[r]!=null)switch(o.kind){case"oneof":const a=i[r].case;if(a===void 0)continue;const l=o.findField(a);let c=i[r].value;l&&l.kind=="message"&&!Cr(c,l.T)?c=new l.T(c):l&&l.kind==="scalar"&&l.T===fe.BYTES&&(c=ui(c)),s[r]={case:a,value:c};break;case"scalar":case"enum":let d=i[r];o.T===fe.BYTES&&(d=o.repeated?d.map(ui):ui(d)),s[r]=d;break;case"map":switch(o.V.kind){case"scalar":case"enum":if(o.V.T===fe.BYTES)for(const[p,_]of Object.entries(i[r]))s[r][p]=ui(_);else Object.assign(s[r],i[r]);break;case"message":const f=o.V.T;for(const p of Object.keys(i[r])){let _=i[r][p];f.fieldWrapper||(_=new f(_)),s[r][p]=_}}break;case"message":const u=o.T;if(o.repeated)s[r]=i[r].map(f=>Cr(f,u)?f:new u(f));else{const f=i[r];u.fieldWrapper?u.typeName==="google.protobuf.BytesValue"?s[r]=ui(f):s[r]=f:s[r]=Cr(f,u)?f:new u(f)}}}},equals:(t,e,n)=>e===n||!(!e||!n)&&t.fields.byMember().every(o=>{const r=e[o.localName],s=n[o.localName];if(o.repeated){if(r.length!==s.length)return!1;switch(o.kind){case"message":return r.every((i,a)=>o.T.equals(i,s[a]));case"scalar":return r.every((i,a)=>qo(o.T,i,s[a]));case"enum":return r.every((i,a)=>qo(fe.INT32,i,s[a]))}throw new Error(`repeated cannot contain ${o.kind}`)}switch(o.kind){case"message":return o.T.equals(r,s);case"enum":return qo(fe.INT32,r,s);case"scalar":return qo(o.T,r,s);case"oneof":if(r.case!==s.case)return!1;const i=o.findField(r.case);if(i===void 0)return!0;switch(i.kind){case"message":return i.T.equals(r.value,s.value);case"enum":return qo(fe.INT32,r.value,s.value);case"scalar":return qo(i.T,r.value,s.value)}throw new Error(`oneof cannot contain ${i.kind}`);case"map":const a=Object.keys(r).concat(Object.keys(s));switch(o.V.kind){case"message":const l=o.V.T;return a.every(d=>l.equals(r[d],s[d]));case"enum":return a.every(d=>qo(fe.INT32,r[d],s[d]));case"scalar":const c=o.V.T;return a.every(d=>qo(c,r[d],s[d]))}}}),clone(t){const e=t.getType(),n=new e,o=n;for(const r of e.fields.byMember()){const s=t[r.localName];let i;if(r.repeated)i=s.map(Ja);else if(r.kind=="map"){i=o[r.localName];for(const[a,l]of Object.entries(s))i[a]=Ja(l)}else i=r.kind=="oneof"?r.findField(s.case)?{case:s.case,value:Ja(s.value)}:{case:void 0}:Ja(s);o[r.localName]=i}for(const r of e.runtime.bin.listUnknownFields(t))e.runtime.bin.onUnknownField(o,r.no,r.wireType,r.data);return n}}),{newFieldList:v_,initFields:k_}),makeMessageType(t,e,n){return function(o,r,s,i){var a;const l=(a=i==null?void 0:i.localName)!==null&&a!==void 0?a:r.substring(r.lastIndexOf(".")+1),c={[l]:function(d){o.util.initFields(this),o.util.initPartial(d,this)}}[l];return Object.setPrototypeOf(c.prototype,new Ot),Object.assign(c,{runtime:o,typeName:r,fields:o.util.newFieldList(s),fromBinary:(d,u)=>new c().fromBinary(d,u),fromJson:(d,u)=>new c().fromJson(d,u),fromJsonString:(d,u)=>new c().fromJsonString(d,u),equals:(d,u)=>o.util.equals(c,d,u)}),c}(this,t,e,n)},makeEnum:oj,makeEnumType:Jg,getEnumType:nj,makeExtension(t,e,n){return function(o,r,s,i){let a;return{typeName:r,extendee:s,get field(){if(!a){const l=typeof i=="function"?i():i;l.name=r.split(".").pop(),l.jsonName=`[${r}]`,a=o.util.newFieldList([l]).list()[0]}return a},runtime:o}}(this,t,e,n)}});var v_,k_,An,jd,Ka,hi,Xa,fi,Go;(function(t){t[t.Unary=0]="Unary",t[t.ServerStreaming=1]="ServerStreaming",t[t.ClientStreaming=2]="ClientStreaming",t[t.BiDiStreaming=3]="BiDiStreaming"})(An||(An={})),function(t){t[t.NoSideEffects=1]="NoSideEffects",t[t.Idempotent=2]="Idempotent"}(jd||(jd={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.JUPYTER_FORMAT=77]="JUPYTER_FORMAT"}(Ka||(Ka={})),Se.util.setEnumType(Ka,"exa.codeium_common_pb.ExperimentKey",[{no:0,name:"UNSPECIFIED"},{no:77,name:"JUPYTER_FORMAT"}]),function(t){t[t.CODEIUM=0]="CODEIUM"}(hi||(hi={})),Se.util.setEnumType(hi,"exa.codeium_common_pb.AuthSource",[{no:0,name:"AUTH_SOURCE_CODEIUM"}]),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.ENABLE_CODEIUM=1]="ENABLE_CODEIUM",t[t.DISABLE_CODEIUM=2]="DISABLE_CODEIUM",t[t.SHOW_PREVIOUS_COMPLETION=3]="SHOW_PREVIOUS_COMPLETION",t[t.SHOW_NEXT_COMPLETION=4]="SHOW_NEXT_COMPLETION"}(Xa||(Xa={})),Se.util.setEnumType(Xa,"exa.codeium_common_pb.EventType",[{no:0,name:"EVENT_TYPE_UNSPECIFIED"},{no:1,name:"EVENT_TYPE_ENABLE_CODEIUM"},{no:2,name:"EVENT_TYPE_DISABLE_CODEIUM"},{no:3,name:"EVENT_TYPE_SHOW_PREVIOUS_COMPLETION"},{no:4,name:"EVENT_TYPE_SHOW_NEXT_COMPLETION"}]),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TYPING_AS_SUGGESTED=1]="TYPING_AS_SUGGESTED",t[t.CACHE=2]="CACHE",t[t.NETWORK=3]="NETWORK"}(fi||(fi={})),Se.util.setEnumType(fi,"exa.codeium_common_pb.CompletionSource",[{no:0,name:"COMPLETION_SOURCE_UNSPECIFIED"},{no:1,name:"COMPLETION_SOURCE_TYPING_AS_SUGGESTED"},{no:2,name:"COMPLETION_SOURCE_CACHE"},{no:3,name:"COMPLETION_SOURCE_NETWORK"}]),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.C=1]="C",t[t.CLOJURE=2]="CLOJURE",t[t.COFFEESCRIPT=3]="COFFEESCRIPT",t[t.CPP=4]="CPP",t[t.CSHARP=5]="CSHARP",t[t.CSS=6]="CSS",t[t.CUDACPP=7]="CUDACPP",t[t.DOCKERFILE=8]="DOCKERFILE",t[t.GO=9]="GO",t[t.GROOVY=10]="GROOVY",t[t.HANDLEBARS=11]="HANDLEBARS",t[t.HASKELL=12]="HASKELL",t[t.HCL=13]="HCL",t[t.HTML=14]="HTML",t[t.INI=15]="INI",t[t.JAVA=16]="JAVA",t[t.JAVASCRIPT=17]="JAVASCRIPT",t[t.JSON=18]="JSON",t[t.JULIA=19]="JULIA",t[t.KOTLIN=20]="KOTLIN",t[t.LATEX=21]="LATEX",t[t.LESS=22]="LESS",t[t.LUA=23]="LUA",t[t.MAKEFILE=24]="MAKEFILE",t[t.MARKDOWN=25]="MARKDOWN",t[t.OBJECTIVEC=26]="OBJECTIVEC",t[t.OBJECTIVECPP=27]="OBJECTIVECPP",t[t.PERL=28]="PERL",t[t.PHP=29]="PHP",t[t.PLAINTEXT=30]="PLAINTEXT",t[t.PROTOBUF=31]="PROTOBUF",t[t.PBTXT=32]="PBTXT",t[t.PYTHON=33]="PYTHON",t[t.R=34]="R",t[t.RUBY=35]="RUBY",t[t.RUST=36]="RUST",t[t.SASS=37]="SASS",t[t.SCALA=38]="SCALA",t[t.SCSS=39]="SCSS",t[t.SHELL=40]="SHELL",t[t.SQL=41]="SQL",t[t.STARLARK=42]="STARLARK",t[t.SWIFT=43]="SWIFT",t[t.TSX=44]="TSX",t[t.TYPESCRIPT=45]="TYPESCRIPT",t[t.VISUALBASIC=46]="VISUALBASIC",t[t.VUE=47]="VUE",t[t.XML=48]="XML",t[t.XSL=49]="XSL",t[t.YAML=50]="YAML",t[t.SVELTE=51]="SVELTE",t[t.TOML=52]="TOML",t[t.DART=53]="DART",t[t.RST=54]="RST",t[t.OCAML=55]="OCAML",t[t.CMAKE=56]="CMAKE",t[t.PASCAL=57]="PASCAL",t[t.ELIXIR=58]="ELIXIR",t[t.FSHARP=59]="FSHARP",t[t.LISP=60]="LISP",t[t.MATLAB=61]="MATLAB",t[t.POWERSHELL=62]="POWERSHELL",t[t.SOLIDITY=63]="SOLIDITY",t[t.ADA=64]="ADA",t[t.OCAML_INTERFACE=65]="OCAML_INTERFACE"}(Go||(Go={})),Se.util.setEnumType(Go,"exa.codeium_common_pb.Language",[{no:0,name:"LANGUAGE_UNSPECIFIED"},{no:1,name:"LANGUAGE_C"},{no:2,name:"LANGUAGE_CLOJURE"},{no:3,name:"LANGUAGE_COFFEESCRIPT"},{no:4,name:"LANGUAGE_CPP"},{no:5,name:"LANGUAGE_CSHARP"},{no:6,name:"LANGUAGE_CSS"},{no:7,name:"LANGUAGE_CUDACPP"},{no:8,name:"LANGUAGE_DOCKERFILE"},{no:9,name:"LANGUAGE_GO"},{no:10,name:"LANGUAGE_GROOVY"},{no:11,name:"LANGUAGE_HANDLEBARS"},{no:12,name:"LANGUAGE_HASKELL"},{no:13,name:"LANGUAGE_HCL"},{no:14,name:"LANGUAGE_HTML"},{no:15,name:"LANGUAGE_INI"},{no:16,name:"LANGUAGE_JAVA"},{no:17,name:"LANGUAGE_JAVASCRIPT"},{no:18,name:"LANGUAGE_JSON"},{no:19,name:"LANGUAGE_JULIA"},{no:20,name:"LANGUAGE_KOTLIN"},{no:21,name:"LANGUAGE_LATEX"},{no:22,name:"LANGUAGE_LESS"},{no:23,name:"LANGUAGE_LUA"},{no:24,name:"LANGUAGE_MAKEFILE"},{no:25,name:"LANGUAGE_MARKDOWN"},{no:26,name:"LANGUAGE_OBJECTIVEC"},{no:27,name:"LANGUAGE_OBJECTIVECPP"},{no:28,name:"LANGUAGE_PERL"},{no:29,name:"LANGUAGE_PHP"},{no:30,name:"LANGUAGE_PLAINTEXT"},{no:31,name:"LANGUAGE_PROTOBUF"},{no:32,name:"LANGUAGE_PBTXT"},{no:33,name:"LANGUAGE_PYTHON"},{no:34,name:"LANGUAGE_R"},{no:35,name:"LANGUAGE_RUBY"},{no:36,name:"LANGUAGE_RUST"},{no:37,name:"LANGUAGE_SASS"},{no:38,name:"LANGUAGE_SCALA"},{no:39,name:"LANGUAGE_SCSS"},{no:40,name:"LANGUAGE_SHELL"},{no:41,name:"LANGUAGE_SQL"},{no:42,name:"LANGUAGE_STARLARK"},{no:43,name:"LANGUAGE_SWIFT"},{no:44,name:"LANGUAGE_TSX"},{no:45,name:"LANGUAGE_TYPESCRIPT"},{no:46,name:"LANGUAGE_VISUALBASIC"},{no:47,name:"LANGUAGE_VUE"},{no:48,name:"LANGUAGE_XML"},{no:49,name:"LANGUAGE_XSL"},{no:50,name:"LANGUAGE_YAML"},{no:51,name:"LANGUAGE_SVELTE"},{no:52,name:"LANGUAGE_TOML"},{no:53,name:"LANGUAGE_DART"},{no:54,name:"LANGUAGE_RST"},{no:55,name:"LANGUAGE_OCAML"},{no:56,name:"LANGUAGE_CMAKE"},{no:57,name:"LANGUAGE_PASCAL"},{no:58,name:"LANGUAGE_ELIXIR"},{no:59,name:"LANGUAGE_FSHARP"},{no:60,name:"LANGUAGE_LISP"},{no:61,name:"LANGUAGE_MATLAB"},{no:62,name:"LANGUAGE_POWERSHELL"},{no:63,name:"LANGUAGE_SOLIDITY"},{no:64,name:"LANGUAGE_ADA"},{no:65,name:"LANGUAGE_OCAML_INTERFACE"}]);const xo=class xo extends Ot{constructor(n){super();ee(this,"completionId","");ee(this,"text","");ee(this,"prefix","");ee(this,"stop","");ee(this,"score",0);ee(this,"tokens",[]);ee(this,"decodedTokens",[]);ee(this,"probabilities",[]);ee(this,"adjustedProbabilities",[]);ee(this,"generatedLength",vt.zero);Se.util.initPartial(n,this)}static fromBinary(n,o){return new xo().fromBinary(n,o)}static fromJson(n,o){return new xo().fromJson(n,o)}static fromJsonString(n,o){return new xo().fromJsonString(n,o)}static equals(n,o){return Se.util.equals(xo,n,o)}};ee(xo,"runtime",Se),ee(xo,"typeName","exa.codeium_common_pb.Completion"),ee(xo,"fields",Se.util.newFieldList(()=>[{no:1,name:"completion_id",kind:"scalar",T:9},{no:2,name:"text",kind:"scalar",T:9},{no:3,name:"prefix",kind:"scalar",T:9},{no:4,name:"stop",kind:"scalar",T:9},{no:5,name:"score",kind:"scalar",T:1},{no:6,name:"tokens",kind:"scalar",T:4,repeated:!0},{no:7,name:"decoded_tokens",kind:"scalar",T:9,repeated:!0},{no:8,name:"probabilities",kind:"scalar",T:1,repeated:!0},{no:9,name:"adjusted_probabilities",kind:"scalar",T:1,repeated:!0},{no:10,name:"generated_length",kind:"scalar",T:4}]));let Ed=xo;const wo=class wo extends Ot{constructor(n){super();ee(this,"ideName","");ee(this,"ideVersion","");ee(this,"extensionName","");ee(this,"extensionVersion","");ee(this,"apiKey","");ee(this,"locale","");ee(this,"sessionId","");ee(this,"requestId",vt.zero);ee(this,"userAgent","");ee(this,"url","");ee(this,"authSource",hi.CODEIUM);Se.util.initPartial(n,this)}static fromBinary(n,o){return new wo().fromBinary(n,o)}static fromJson(n,o){return new wo().fromJson(n,o)}static fromJsonString(n,o){return new wo().fromJsonString(n,o)}static equals(n,o){return Se.util.equals(wo,n,o)}};ee(wo,"runtime",Se),ee(wo,"typeName","exa.codeium_common_pb.Metadata"),ee(wo,"fields",Se.util.newFieldList(()=>[{no:1,name:"ide_name",kind:"scalar",T:9},{no:7,name:"ide_version",kind:"scalar",T:9},{no:12,name:"extension_name",kind:"scalar",T:9},{no:2,name:"extension_version",kind:"scalar",T:9},{no:3,name:"api_key",kind:"scalar",T:9},{no:4,name:"locale",kind:"scalar",T:9},{no:10,name:"session_id",kind:"scalar",T:9},{no:9,name:"request_id",kind:"scalar",T:4},{no:13,name:"user_agent",kind:"scalar",T:9},{no:14,name:"url",kind:"scalar",T:9},{no:15,name:"auth_source",kind:"enum",T:Se.getEnumType(hi)}]));let Za=wo;const vo=class vo extends Ot{constructor(n){super();ee(this,"tabSize",vt.zero);ee(this,"insertSpaces",!1);Se.util.initPartial(n,this)}static fromBinary(n,o){return new vo().fromBinary(n,o)}static fromJson(n,o){return new vo().fromJson(n,o)}static fromJsonString(n,o){return new vo().fromJsonString(n,o)}static equals(n,o){return Se.util.equals(vo,n,o)}};ee(vo,"runtime",Se),ee(vo,"typeName","exa.codeium_common_pb.EditorOptions"),ee(vo,"fields",Se.util.newFieldList(()=>[{no:1,name:"tab_size",kind:"scalar",T:4},{no:2,name:"insert_spaces",kind:"scalar",T:8}]));let Id=vo;Se.util.newFieldList(()=>[{no:1,name:"event_type",kind:"enum",T:Se.getEnumType(Xa)},{no:2,name:"event_json",kind:"scalar",T:9},{no:3,name:"timestamp_unix_ms",kind:"scalar",T:3}]);class Nj extends Hs{constructor(n,o){super();ee(this,"index");ee(this,"total");this.index=n,this.total=o}toDOM(){const n=document.createElement("span");n.setAttribute("aria-hidden","true"),n.className="cm-codeium-cycle";const o=n.appendChild(document.createElement("span"));o.className="cm-codeium-cycle-explanation",o.innerText=`${this.index+1}/${this.total}`;const r=n.appendChild(document.createElement("button"));return r.className="cm-codeium-cycle-key",r.innerText="\u2192 (Ctrl ])",r.dataset.action="codeium-cycle",n}ignoreEvent(){return!1}}const Qa=$s.define({combine:t=>kc(t,{language:Go.TYPESCRIPT,timeout:150,widgetClass:Nj,alwaysOn:!0},{})}),S_=$s.define({combine:t=>kc(t,{override:()=>[]},{})}),jj=dt.mark({class:"cm-ghostText"}),Nr=En.define({create:t=>null,update(t,e){var o;const n=e.state.facet(Qa);for(const r of e.effects){if(r.is(yd)){const{changeSpecs:s,index:i}=r.value,a=s[i].map(c=>jj.range(c.absoluteStartPos,c.absoluteEndPos)),l=(o=a.at(-1))==null?void 0:o.to;return{index:i,decorations:dt.set([...a,...l!==void 0&&s.length>1&&n.widgetClass?[dt.widget({widget:new n.widgetClass(i,s.length),side:1}).range(l)]:[]]),changeSpecs:s,reverseChangeSet:r.value.reverseChangeSet}}if(r.is(xd)||r.is(wd))return null}return t&&{...t,decorations:t.decorations.map(e.changes),reverseChangeSet:t.reverseChangeSet.map(e.changes)}},provide:t=>st.decorations.from(t,e=>(e==null?void 0:e.decorations)||dt.none)}),Wr=wp.define(),el=wp.define();var gt;function Ad(t){const e=gt[t];return typeof e!="string"?t.toString():e[0].toLowerCase()+e.substring(1).replace(/[A-Z]/g,n=>"_"+n.toLowerCase())}let tl;(function(t){t[t.Canceled=1]="Canceled",t[t.Unknown=2]="Unknown",t[t.InvalidArgument=3]="InvalidArgument",t[t.DeadlineExceeded=4]="DeadlineExceeded",t[t.NotFound=5]="NotFound",t[t.AlreadyExists=6]="AlreadyExists",t[t.PermissionDenied=7]="PermissionDenied",t[t.ResourceExhausted=8]="ResourceExhausted",t[t.FailedPrecondition=9]="FailedPrecondition",t[t.Aborted=10]="Aborted",t[t.OutOfRange=11]="OutOfRange",t[t.Unimplemented=12]="Unimplemented",t[t.Internal=13]="Internal",t[t.Unavailable=14]="Unavailable",t[t.DataLoss=15]="DataLoss",t[t.Unauthenticated=16]="Unauthenticated"})(gt||(gt={}));class Gt extends Error{constructor(e,n=gt.Unknown,o,r,s){super(function(i,a){return i.length?`[${Ad(a)}] ${i}`:`[${Ad(a)}]`}(e,n)),this.name="ConnectError",Object.setPrototypeOf(this,new.target.prototype),this.rawMessage=e,this.code=n,this.metadata=new Headers(o??{}),this.details=r??[],this.cause=s}static from(e,n=gt.Unknown){return e instanceof Gt?e:e instanceof Error?e.name=="AbortError"?new Gt(e.message,gt.Canceled):new Gt(e.message,n,void 0,void 0,e):new Gt(String(e),n,void 0,void 0,e)}static[Symbol.hasInstance](e){return e instanceof Error&&(Object.getPrototypeOf(e)===Gt.prototype||e.name==="ConnectError"&&"code"in e&&typeof e.code=="number"&&"metadata"in e&&"details"in e&&Array.isArray(e.details)&&"rawMessage"in e&&typeof e.rawMessage=="string"&&"cause"in e)}findDetails(e){const n="typeName"in e?{findMessage:r=>r===e.typeName?e:void 0}:e,o=[];for(const r of this.details){if("getType"in r){n.findMessage(r.getType().typeName)&&o.push(r);continue}const s=n.findMessage(r.type);if(s)try{o.push(s.fromBinary(r.value))}catch{}}return o}}var Ej=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),e={},o("next"),o("throw"),o("return"),e[Symbol.asyncIterator]=function(){return this},e);function o(r){e[r]=t[r]&&function(s){return new Promise(function(i,a){(function(l,c,d,u){Promise.resolve(u).then(function(f){l({value:f,done:d})},c)})(i,a,(s=t[r](s)).done,s.value)})}}},pi=function(t){return this instanceof pi?(this.v=t,this):new pi(t)},Ij=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(t,e||[]),s=[];return o={},i("next"),i("throw"),i("return",function(u){return function(f){return Promise.resolve(f).then(u,c)}}),o[Symbol.asyncIterator]=function(){return this},o;function i(u,f){r[u]&&(o[u]=function(p){return new Promise(function(_,g){s.push([u,p,_,g])>1||a(u,p)})},f&&(o[u]=f(o[u])))}function a(u,f){try{(p=r[u](f)).value instanceof pi?Promise.resolve(p.value.v).then(l,c):d(s[0][2],p)}catch(_){d(s[0][3],_)}var p}function l(u){a("next",u)}function c(u){a("throw",u)}function d(u,f){u(f),s.shift(),s.length&&a(s[0][0],s[0][1])}},Aj=function(t){var e,n;return e={},o("next"),o("throw",function(r){throw r}),o("return"),e[Symbol.iterator]=function(){return this},e;function o(r,s){e[r]=t[r]?function(i){return(n=!n)?{value:pi(t[r](i)),done:!1}:s?s(i):i}:s}},C_=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),e={},o("next"),o("throw"),o("return"),e[Symbol.asyncIterator]=function(){return this},e);function o(r){e[r]=t[r]&&function(s){return new Promise(function(i,a){(function(l,c,d,u){Promise.resolve(u).then(function(f){l({value:f,done:d})},c)})(i,a,(s=t[r](s)).done,s.value)})}}},qr=function(t){return this instanceof qr?(this.v=t,this):new qr(t)},Tj=function(t){var e,n;return e={},o("next"),o("throw",function(r){throw r}),o("return"),e[Symbol.iterator]=function(){return this},e;function o(r,s){e[r]=t[r]?function(i){return(n=!n)?{value:qr(t[r](i)),done:!1}:s?s(i):i}:s}},Mj=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(t,e||[]),s=[];return o={},i("next"),i("throw"),i("return",function(u){return function(f){return Promise.resolve(f).then(u,c)}}),o[Symbol.asyncIterator]=function(){return this},o;function i(u,f){r[u]&&(o[u]=function(p){return new Promise(function(_,g){s.push([u,p,_,g])>1||a(u,p)})},f&&(o[u]=f(o[u])))}function a(u,f){try{(p=r[u](f)).value instanceof qr?Promise.resolve(p.value.v).then(l,c):d(s[0][2],p)}catch(_){d(s[0][3],_)}var p}function l(u){a("next",u)}function c(u){a("throw",u)}function d(u,f){u(f),s.shift(),s.length&&a(s[0][0],s[0][1])}};function N_(t,e){const n=function(){var o,r;return Mj(this,arguments,function*(){const s=yield qr(t);(o=e==null?void 0:e.onHeader)===null||o===void 0||o.call(e,s.header),yield qr(yield*Tj(C_(s.message))),(r=e==null?void 0:e.onTrailer)===null||r===void 0||r.call(e,s.trailer)})}()[Symbol.asyncIterator]();return{[Symbol.asyncIterator]:()=>({next:()=>n.next()})}}function j_(t){if(!t.aborted)return;if(t.reason!==void 0)return t.reason;const e=new Error("This operation was aborted");return e.name="AbortError",e}function E_(){return{get(t){return t.id in this?this[t.id]:t.defaultValue},set(t,e){return this[t.id]=e,this},delete(t){return delete this[t.id],this}}}function I_(t,e,n){const o=typeof e=="string"?e:e.typeName,r=typeof n=="string"?n:n.name;return t.toString().replace(/\/?$/,`/${o}/${r}`)}function A_(t,e){return e instanceof t?e:new t(e)}function Oj(t,e){function n(o){return o.done===!0?o:{done:o.done,value:A_(t,o.value)}}return{[Symbol.asyncIterator](){const o=e[Symbol.asyncIterator](),r={next:()=>o.next().then(n)};return o.throw!==void 0&&(r.throw=s=>o.throw(s).then(n)),o.return!==void 0&&(r.return=s=>o.return(s).then(n)),r}}}function T_(t,e){var n;return(n=e==null?void 0:e.concat().reverse().reduce((o,r)=>r(o),t))!==null&&n!==void 0?n:t}function M_(t){var e;const n=Object.assign({},t);return(e=n.ignoreUnknownFields)!==null&&e!==void 0||(n.ignoreUnknownFields=!0),n}function O_(t,e,n,o){const r=e?D_(t.I,o):R_(t.I,n);return{parse:(e?D_(t.O,o):R_(t.O,n)).parse,serialize:r.serialize}}function D_(t,e){return{parse(n){try{return t.fromBinary(n,e)}catch(o){const r=o instanceof Error?o.message:String(o);throw new Gt(`parse binary: ${r}`,gt.InvalidArgument)}},serialize(n){try{return n.toBinary(e)}catch(o){const r=o instanceof Error?o.message:String(o);throw new Gt(`serialize binary: ${r}`,gt.Internal)}}}}function R_(t,e){var n,o;const r=(n=e==null?void 0:e.textEncoder)!==null&&n!==void 0?n:new TextEncoder,s=(o=e==null?void 0:e.textDecoder)!==null&&o!==void 0?o:new TextDecoder,i=M_(e);return{parse(a){try{const l=s.decode(a);return t.fromJsonString(l,i)}catch(l){throw Gt.from(l,gt.InvalidArgument)}},serialize(a){try{const l=a.toJsonString(i);return r.encode(l)}catch(l){throw Gt.from(l,gt.Internal)}}}}const Dj=/^application\/(connect\+)?(?:(json)(?:; ?charset=utf-?8)?|(proto))$/i;function P_(t,e,n){if(e&&new Headers(e).forEach((i,a)=>n.metadata.append(a,i)),typeof t!="object"||t==null||Array.isArray(t)||!("code"in t)||typeof t.code!="string")throw n;const o=function(i){if(!tl){tl={};for(const a of Object.values(gt))typeof a!="string"&&(tl[Ad(a)]=a)}return tl[i]}(t.code);if(o===void 0)throw n;const r=t.message;if(r!=null&&typeof r!="string")throw n;const s=new Gt(r??"",o,e);if("details"in t&&Array.isArray(t.details))for(const i of t.details){if(i===null||typeof i!="object"||Array.isArray(i)||typeof i.type!="string"||typeof i.value!="string"||"debug"in i&&typeof i.debug!="object")throw n;try{s.details.push({type:i.type,value:$a.dec(i.value),debug:i.debug})}catch{throw n}}return s}function Rj(t){const e=new Gt("invalid end stream",gt.InvalidArgument);let n;try{n=JSON.parse(typeof t=="string"?t:new TextDecoder().decode(t))}catch{throw e}if(typeof n!="object"||n==null||Array.isArray(n))throw e;const o=new Headers;if("metadata"in n){if(typeof n.metadata!="object"||n.metadata==null||Array.isArray(n.metadata))throw e;for(const[r,s]of Object.entries(n.metadata)){if(!Array.isArray(s)||s.some(i=>typeof i!="string"))throw e;for(const i of s)o.append(r,i)}}return{metadata:o,error:"error"in n?P_(n.error,o,e):void 0}}const Td="Content-Type",Pj="Content-Length",L_="Content-Encoding",Lj="Accept-Encoding",F_="Connect-Protocol-Version";function z_(t){const e=new Headers,n=new Headers;return t.forEach((o,r)=>{r.toLowerCase().startsWith("trailer-")?n.set(r.substring(8),o):e.set(r,o)}),[e,n]}function B_(t,e,n,o,r){const s=new Headers(o??{});return n!==void 0&&s.set("Connect-Timeout-Ms",`${n}`),s.set(Td,t==An.Unary?e?"application/proto":"application/json":e?"application/connect+proto":"application/connect+json"),s.set(F_,"1"),s}function U_(t,e,n){const o=function(r){const s=r==null?void 0:r.match(Dj);if(s)return{stream:!!s[1],binary:!!s[3]}}(n.get("Content-Type"));if(e!==200){const r=new Gt(`HTTP ${e}`,function(s){switch(s){case 400:return gt.InvalidArgument;case 401:return gt.Unauthenticated;case 403:return gt.PermissionDenied;case 404:return gt.Unimplemented;case 408:return gt.DeadlineExceeded;case 409:return gt.Aborted;case 412:return gt.FailedPrecondition;case 413:case 431:return gt.ResourceExhausted;case 415:return gt.Internal;case 429:case 502:case 503:case 504:return gt.Unavailable;default:return gt.Unknown}}(e),n);if(t==An.Unary&&o&&!o.binary)return{isUnaryError:!0,unaryError:r};throw r}return{isUnaryError:!1}}const Fj="application/";function zj(t,e,n){let o="?connect=v1";const r=t.header.get(Td);(r==null?void 0:r.indexOf(Fj))===0&&(o+="&encoding="+encodeURIComponent(r.slice(12)));const s=t.header.get(L_);s!==null&&s!=="identity"&&(o+="&compression="+encodeURIComponent(s),n=!0),n&&(o+="&base64=1"),o+="&message="+function(l,c){return c?$a.enc(l).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""):encodeURIComponent(new TextDecoder().decode(l))}(e,n);const i=t.url+o,a=new Headers(t.header);return[F_,Td,Pj,L_,Lj].forEach(l=>a.delete(l)),Object.assign(Object.assign({},t),{init:Object.assign(Object.assign({},t.init),{method:"GET"}),url:i,header:a})}function V_(t){const{signal:e,cleanup:n}=function(r){const s=new AbortController,i=()=>{s.abort(new Gt("the operation timed out",gt.DeadlineExceeded))};let a;return r!==void 0&&(r<=0?i():a=setTimeout(i,r)),{signal:s.signal,cleanup:()=>clearTimeout(a)}}(t.timeoutMs),o=function(...r){const s=new AbortController,i=r.filter(l=>l!==void 0).concat(s.signal);for(const l of i){if(l.aborted){a.apply(l);break}l.addEventListener("abort",a)}function a(){s.signal.aborted||s.abort(j_(this));for(const l of i)l.removeEventListener("abort",a)}return s}(t.signal,e);return[o.signal,function(r){const s=Gt.from(e.aborted?j_(e):r);return o.abort(s),n(),Promise.reject(s)},function(){n(),o.abort()}]}var mi,Md,gi;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.INACTIVE=1]="INACTIVE",t[t.PROCESSING=2]="PROCESSING",t[t.SUCCESS=3]="SUCCESS",t[t.WARNING=4]="WARNING",t[t.ERROR=5]="ERROR"})(mi||(mi={})),Se.util.setEnumType(mi,"exa.language_server_pb.CodeiumState",[{no:0,name:"CODEIUM_STATE_UNSPECIFIED"},{no:1,name:"CODEIUM_STATE_INACTIVE"},{no:2,name:"CODEIUM_STATE_PROCESSING"},{no:3,name:"CODEIUM_STATE_SUCCESS"},{no:4,name:"CODEIUM_STATE_WARNING"},{no:5,name:"CODEIUM_STATE_ERROR"}]),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.SINGLE=1]="SINGLE",t[t.MULTI=2]="MULTI"}(Md||(Md={})),Se.util.setEnumType(Md,"exa.language_server_pb.LineType",[{no:0,name:"LINE_TYPE_UNSPECIFIED"},{no:1,name:"LINE_TYPE_SINGLE"},{no:2,name:"LINE_TYPE_MULTI"}]),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.INLINE=1]="INLINE",t[t.BLOCK=2]="BLOCK",t[t.INLINE_MASK=3]="INLINE_MASK"}(gi||(gi={})),Se.util.setEnumType(gi,"exa.language_server_pb.CompletionPartType",[{no:0,name:"COMPLETION_PART_TYPE_UNSPECIFIED"},{no:1,name:"COMPLETION_PART_TYPE_INLINE"},{no:2,name:"COMPLETION_PART_TYPE_BLOCK"},{no:3,name:"COMPLETION_PART_TYPE_INLINE_MASK"}]);const ko=class ko extends Ot{constructor(n){super();ee(this,"threshold",0);Se.util.initPartial(n,this)}static fromBinary(n,o){return new ko().fromBinary(n,o)}static fromJson(n,o){return new ko().fromJson(n,o)}static fromJsonString(n,o){return new ko().fromJsonString(n,o)}static equals(n,o){return Se.util.equals(ko,n,o)}};ee(ko,"runtime",Se),ee(ko,"typeName","exa.language_server_pb.MultilineConfig"),ee(ko,"fields",Se.util.newFieldList(()=>[{no:1,name:"threshold",kind:"scalar",T:2}]));let Od=ko;const So=class So extends Ot{constructor(n){super();ee(this,"metadata");ee(this,"document");ee(this,"editorOptions");ee(this,"otherDocuments",[]);ee(this,"experimentConfig");ee(this,"modelName","");ee(this,"multilineConfig");Se.util.initPartial(n,this)}static fromBinary(n,o){return new So().fromBinary(n,o)}static fromJson(n,o){return new So().fromJson(n,o)}static fromJsonString(n,o){return new So().fromJsonString(n,o)}static equals(n,o){return Se.util.equals(So,n,o)}};ee(So,"runtime",Se),ee(So,"typeName","exa.language_server_pb.GetCompletionsRequest"),ee(So,"fields",Se.util.newFieldList(()=>[{no:1,name:"metadata",kind:"message",T:Za},{no:2,name:"document",kind:"message",T:nl},{no:3,name:"editor_options",kind:"message",T:Id},{no:5,name:"other_documents",kind:"message",T:nl,repeated:!0},{no:7,name:"experiment_config",kind:"message",T:Bd},{no:10,name:"model_name",kind:"scalar",T:9},{no:13,name:"multiline_config",kind:"message",T:Od}]));let Dd=So;const Co=class Co extends Ot{constructor(n){super();ee(this,"state");ee(this,"completionItems",[]);Se.util.initPartial(n,this)}static fromBinary(n,o){return new Co().fromBinary(n,o)}static fromJson(n,o){return new Co().fromJson(n,o)}static fromJsonString(n,o){return new Co().fromJsonString(n,o)}static equals(n,o){return Se.util.equals(Co,n,o)}};ee(Co,"runtime",Se),ee(Co,"typeName","exa.language_server_pb.GetCompletionsResponse"),ee(Co,"fields",Se.util.newFieldList(()=>[{no:1,name:"state",kind:"message",T:Ud},{no:2,name:"completion_items",kind:"message",T:Wd,repeated:!0}]));let Rd=Co;const No=class No extends Ot{constructor(n){super();ee(this,"metadata");ee(this,"completionId","");Se.util.initPartial(n,this)}static fromBinary(n,o){return new No().fromBinary(n,o)}static fromJson(n,o){return new No().fromJson(n,o)}static fromJsonString(n,o){return new No().fromJsonString(n,o)}static equals(n,o){return Se.util.equals(No,n,o)}};ee(No,"runtime",Se),ee(No,"typeName","exa.language_server_pb.AcceptCompletionRequest"),ee(No,"fields",Se.util.newFieldList(()=>[{no:1,name:"metadata",kind:"message",T:Za},{no:2,name:"completion_id",kind:"scalar",T:9}]));let Pd=No;const jo=class jo extends Ot{constructor(e){super(),Se.util.initPartial(e,this)}static fromBinary(e,n){return new jo().fromBinary(e,n)}static fromJson(e,n){return new jo().fromJson(e,n)}static fromJsonString(e,n){return new jo().fromJsonString(e,n)}static equals(e,n){return Se.util.equals(jo,e,n)}};ee(jo,"runtime",Se),ee(jo,"typeName","exa.language_server_pb.AcceptCompletionResponse"),ee(jo,"fields",Se.util.newFieldList(()=>[]));let Ld=jo;const Eo=class Eo extends Ot{constructor(e){super(),Se.util.initPartial(e,this)}static fromBinary(e,n){return new Eo().fromBinary(e,n)}static fromJson(e,n){return new Eo().fromJson(e,n)}static fromJsonString(e,n){return new Eo().fromJsonString(e,n)}static equals(e,n){return Se.util.equals(Eo,e,n)}};ee(Eo,"runtime",Se),ee(Eo,"typeName","exa.language_server_pb.GetAuthTokenRequest"),ee(Eo,"fields",Se.util.newFieldList(()=>[]));let Fd=Eo;const Io=class Io extends Ot{constructor(n){super();ee(this,"authToken","");ee(this,"uuid","");Se.util.initPartial(n,this)}static fromBinary(n,o){return new Io().fromBinary(n,o)}static fromJson(n,o){return new Io().fromJson(n,o)}static fromJsonString(n,o){return new Io().fromJsonString(n,o)}static equals(n,o){return Se.util.equals(Io,n,o)}};ee(Io,"runtime",Se),ee(Io,"typeName","exa.language_server_pb.GetAuthTokenResponse"),ee(Io,"fields",Se.util.newFieldList(()=>[{no:1,name:"auth_token",kind:"scalar",T:9},{no:2,name:"uuid",kind:"scalar",T:9}]));let zd=Io;const Ao=class Ao extends Ot{constructor(n){super();ee(this,"row",vt.zero);ee(this,"col",vt.zero);Se.util.initPartial(n,this)}static fromBinary(n,o){return new Ao().fromBinary(n,o)}static fromJson(n,o){return new Ao().fromJson(n,o)}static fromJsonString(n,o){return new Ao().fromJsonString(n,o)}static equals(n,o){return Se.util.equals(Ao,n,o)}};ee(Ao,"runtime",Se),ee(Ao,"typeName","exa.language_server_pb.DocumentPosition"),ee(Ao,"fields",Se.util.newFieldList(()=>[{no:1,name:"row",kind:"scalar",T:4},{no:2,name:"col",kind:"scalar",T:4}]));let _i=Ao;const To=class To extends Ot{constructor(n){super();ee(this,"absolutePath","");ee(this,"relativePath","");ee(this,"text","");ee(this,"editorLanguage","");ee(this,"language",Go.UNSPECIFIED);ee(this,"cursorOffset",vt.zero);ee(this,"cursorPosition");ee(this,"lineEnding","");Se.util.initPartial(n,this)}static fromBinary(n,o){return new To().fromBinary(n,o)}static fromJson(n,o){return new To().fromJson(n,o)}static fromJsonString(n,o){return new To().fromJsonString(n,o)}static equals(n,o){return Se.util.equals(To,n,o)}};ee(To,"runtime",Se),ee(To,"typeName","exa.language_server_pb.Document"),ee(To,"fields",Se.util.newFieldList(()=>[{no:1,name:"absolute_path",kind:"scalar",T:9},{no:2,name:"relative_path",kind:"scalar",T:9},{no:3,name:"text",kind:"scalar",T:9},{no:4,name:"editor_language",kind:"scalar",T:9},{no:5,name:"language",kind:"enum",T:Se.getEnumType(Go)},{no:6,name:"cursor_offset",kind:"scalar",T:4},{no:8,name:"cursor_position",kind:"message",T:_i},{no:7,name:"line_ending",kind:"scalar",T:9}]));let nl=To;const Mo=class Mo extends Ot{constructor(n){super();ee(this,"forceEnableExperiments",[]);Se.util.initPartial(n,this)}static fromBinary(n,o){return new Mo().fromBinary(n,o)}static fromJson(n,o){return new Mo().fromJson(n,o)}static fromJsonString(n,o){return new Mo().fromJsonString(n,o)}static equals(n,o){return Se.util.equals(Mo,n,o)}};ee(Mo,"runtime",Se),ee(Mo,"typeName","exa.language_server_pb.ExperimentConfig"),ee(Mo,"fields",Se.util.newFieldList(()=>[{no:1,name:"force_enable_experiments",kind:"enum",T:Se.getEnumType(Ka),repeated:!0}]));let Bd=Mo;const Oo=class Oo extends Ot{constructor(n){super();ee(this,"state",mi.UNSPECIFIED);ee(this,"message","");Se.util.initPartial(n,this)}static fromBinary(n,o){return new Oo().fromBinary(n,o)}static fromJson(n,o){return new Oo().fromJson(n,o)}static fromJsonString(n,o){return new Oo().fromJsonString(n,o)}static equals(n,o){return Se.util.equals(Oo,n,o)}};ee(Oo,"runtime",Se),ee(Oo,"typeName","exa.language_server_pb.State"),ee(Oo,"fields",Se.util.newFieldList(()=>[{no:1,name:"state",kind:"enum",T:Se.getEnumType(mi)},{no:2,name:"message",kind:"scalar",T:9}]));let Ud=Oo;const Do=class Do extends Ot{constructor(n){super();ee(this,"startOffset",vt.zero);ee(this,"endOffset",vt.zero);ee(this,"startPosition");ee(this,"endPosition");Se.util.initPartial(n,this)}static fromBinary(n,o){return new Do().fromBinary(n,o)}static fromJson(n,o){return new Do().fromJson(n,o)}static fromJsonString(n,o){return new Do().fromJsonString(n,o)}static equals(n,o){return Se.util.equals(Do,n,o)}};ee(Do,"runtime",Se),ee(Do,"typeName","exa.language_server_pb.Range"),ee(Do,"fields",Se.util.newFieldList(()=>[{no:1,name:"start_offset",kind:"scalar",T:4},{no:2,name:"end_offset",kind:"scalar",T:4},{no:3,name:"start_position",kind:"message",T:_i},{no:4,name:"end_position",kind:"message",T:_i}]));let Vd=Do;const Ro=class Ro extends Ot{constructor(n){super();ee(this,"text","");ee(this,"deltaCursorOffset",vt.zero);Se.util.initPartial(n,this)}static fromBinary(n,o){return new Ro().fromBinary(n,o)}static fromJson(n,o){return new Ro().fromJson(n,o)}static fromJsonString(n,o){return new Ro().fromJsonString(n,o)}static equals(n,o){return Se.util.equals(Ro,n,o)}};ee(Ro,"runtime",Se),ee(Ro,"typeName","exa.language_server_pb.Suffix"),ee(Ro,"fields",Se.util.newFieldList(()=>[{no:1,name:"text",kind:"scalar",T:9},{no:2,name:"delta_cursor_offset",kind:"scalar",T:3}]));let $d=Ro;const Po=class Po extends Ot{constructor(n){super();ee(this,"text","");ee(this,"offset",vt.zero);ee(this,"type",gi.UNSPECIFIED);ee(this,"prefix","");ee(this,"line",vt.zero);Se.util.initPartial(n,this)}static fromBinary(n,o){return new Po().fromBinary(n,o)}static fromJson(n,o){return new Po().fromJson(n,o)}static fromJsonString(n,o){return new Po().fromJsonString(n,o)}static equals(n,o){return Se.util.equals(Po,n,o)}};ee(Po,"runtime",Se),ee(Po,"typeName","exa.language_server_pb.CompletionPart"),ee(Po,"fields",Se.util.newFieldList(()=>[{no:1,name:"text",kind:"scalar",T:9},{no:2,name:"offset",kind:"scalar",T:4},{no:3,name:"type",kind:"enum",T:Se.getEnumType(gi)},{no:4,name:"prefix",kind:"scalar",T:9},{no:5,name:"line",kind:"scalar",T:4}]));let Hd=Po;const Lo=class Lo extends Ot{constructor(n){super();ee(this,"completion");ee(this,"suffix");ee(this,"range");ee(this,"source",fi.UNSPECIFIED);ee(this,"completionParts",[]);Se.util.initPartial(n,this)}static fromBinary(n,o){return new Lo().fromBinary(n,o)}static fromJson(n,o){return new Lo().fromJson(n,o)}static fromJsonString(n,o){return new Lo().fromJsonString(n,o)}static equals(n,o){return Se.util.equals(Lo,n,o)}};ee(Lo,"runtime",Se),ee(Lo,"typeName","exa.language_server_pb.CompletionItem"),ee(Lo,"fields",Se.util.newFieldList(()=>[{no:1,name:"completion",kind:"message",T:Ed},{no:5,name:"suffix",kind:"message",T:$d},{no:2,name:"range",kind:"message",T:Vd},{no:3,name:"source",kind:"enum",T:Se.getEnumType(fi)},{no:8,name:"completion_parts",kind:"message",T:Hd,repeated:!0}]));let Wd=Lo;const Bj={typeName:"exa.language_server_pb.LanguageServerService",methods:{getCompletions:{name:"GetCompletions",I:Dd,O:Rd,kind:An.Unary},acceptCompletion:{name:"AcceptCompletion",I:Pd,O:Ld,kind:An.Unary},getAuthToken:{name:"GetAuthToken",I:Fd,O:zd,kind:An.Unary}}};var bi=function(t){return this instanceof bi?(this.v=t,this):new bi(t)},Uj=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(t,e||[]),s=[];return o={},i("next"),i("throw"),i("return",function(u){return function(f){return Promise.resolve(f).then(u,c)}}),o[Symbol.asyncIterator]=function(){return this},o;function i(u,f){r[u]&&(o[u]=function(p){return new Promise(function(_,g){s.push([u,p,_,g])>1||a(u,p)})},f&&(o[u]=f(o[u])))}function a(u,f){try{(p=r[u](f)).value instanceof bi?Promise.resolve(p.value.v).then(l,c):d(s[0][2],p)}catch(_){d(s[0][3],_)}var p}function l(u){a("next",u)}function c(u){a("throw",u)}function d(u,f){u(f),s.shift(),s.length&&a(s[0][0],s[0][1])}};const Vj=function(t){var e;(function(){try{new Headers}catch{throw new Error("connect-web requires the fetch API. Are you running on an old version of Node.js? Node.js is not supported in Connect for Web - please stay tuned for Connect for Node.")}})();const n=(e=t.useBinaryFormat)!==null&&e!==void 0&&e;return{async unary(o,r,s,i,a,l,c){var d;const{serialize:u,parse:f}=O_(r,n,t.jsonOptions,t.binaryOptions);return i=i===void 0?t.defaultTimeoutMs:i<=0?void 0:i,await function(p){const _=T_(p.next,p.interceptors),[g,m,b]=V_(p);return _(Object.assign(Object.assign({},p.req),{message:A_(p.req.method.I,p.req.message),signal:g})).then(x=>(b(),x),m)}({interceptors:t.interceptors,signal:s,timeoutMs:i,req:{stream:!1,service:o,method:r,url:I_(t.baseUrl,o,r),init:{method:"POST",credentials:(d=t.credentials)!==null&&d!==void 0?d:"same-origin",redirect:"error",mode:"cors"},header:B_(r.kind,n,i,a),contextValues:c??E_(),message:l},next:async p=>{var _;let g=null;t.useHttpGet===!0&&r.idempotency===jd.NoSideEffects?p=zj(p,u(p.message),n):g=u(p.message);const m=(_=t.fetch)!==null&&_!==void 0?_:globalThis.fetch,b=await m(p.url,Object.assign(Object.assign({},p.init),{headers:p.header,signal:p.signal,body:g})),{isUnaryError:x,unaryError:y}=U_(r.kind,b.status,b.headers);if(x)throw P_(await b.json(),function(...S){const E=new Headers;for(const j of S)j.forEach((I,T)=>{E.append(T,I)});return E}(...z_(b.headers)),y);const[v,k]=z_(b.headers);return{stream:!1,service:o,method:r,header:v,message:n?f(new Uint8Array(await b.arrayBuffer())):r.O.fromJson(await b.json(),M_(t.jsonOptions)),trailer:k}}})},async stream(o,r,s,i,a,l,c){var d;const{serialize:u,parse:f}=O_(r,n,t.jsonOptions,t.binaryOptions);function p(g,m,b){return Uj(this,arguments,function*(){const x=function(v){let k,S=new Uint8Array(0);function E(j){const I=new Uint8Array(S.length+j.length);I.set(S),I.set(j,S.length),S=I}return new ReadableStream({start(){k=v.getReader()},async pull(j){let I;for(;;){if(I===void 0&&S.byteLength>=5){let L=0;for(let B=1;B<5;B++)L=(L<<8)+S[B];I={flags:S[0],length:L}}if(I!==void 0&&S.byteLength>=I.length+5)break;const M=await k.read();if(M.done)break;E(M.value)}if(I===void 0)return S.byteLength==0?void j.close():void j.error(new Gt("premature end of stream",gt.DataLoss));const T=S.subarray(5,5+I.length);S=S.subarray(5+I.length),j.enqueue({flags:I.flags,data:T})}})}(g).getReader();let y=!1;for(;;){const v=yield bi(x.read());if(v.done)break;const{flags:k,data:S}=v.value;if(2&~k)yield yield bi(f(S));else{y=!0;const E=Rj(S);if(E.error){const j=E.error;throw b.forEach((I,T)=>{j.metadata.append(T,I)}),j}E.metadata.forEach((j,I)=>m.set(I,j))}}if(!y)throw"missing EndStreamResponse"})}async function _(g){if(r.kind!=An.ServerStreaming)throw"The fetch API does not support streaming request bodies";const m=await g[Symbol.asyncIterator]().next();if(m.done==1)throw"missing request message";return function(b,x){const y=new Uint8Array(x.length+5);y.set(x,5);const v=new DataView(y.buffer,y.byteOffset,y.byteLength);return v.setUint8(0,b),v.setUint32(1,x.length),y}(0,u(m.value))}return i=i===void 0?t.defaultTimeoutMs:i<=0?void 0:i,await function(g){const m=T_(g.next,g.interceptors),[b,x,y]=V_(g),v=Object.assign(Object.assign({},g.req),{message:Oj(g.req.method.I,g.req.message),signal:b});let k=!1;return b.addEventListener("abort",function(){var S,E;const j=g.req.message[Symbol.asyncIterator]();k||(S=j.throw)===null||S===void 0||S.call(j,this.reason).catch(()=>{}),(E=j.return)===null||E===void 0||E.call(j).catch(()=>{})}),m(v).then(S=>Object.assign(Object.assign({},S),{message:{[Symbol.asyncIterator](){const E=S.message[Symbol.asyncIterator]();return{next:()=>E.next().then(j=>(j.done==1&&(k=!0,y()),j),x)}}}}),x)}({interceptors:t.interceptors,timeoutMs:i,signal:s,req:{stream:!0,service:o,method:r,url:I_(t.baseUrl,o,r),init:{method:"POST",credentials:(d=t.credentials)!==null&&d!==void 0?d:"same-origin",redirect:"error",mode:"cors"},header:B_(r.kind,n,i,a),contextValues:c??E_(),message:l},next:async g=>{var m;const b=(m=t.fetch)!==null&&m!==void 0?m:globalThis.fetch,x=await b(g.url,Object.assign(Object.assign({},g.init),{headers:g.header,signal:g.signal,body:await _(g.message)}));if(U_(r.kind,x.status,x.headers),x.body===null)throw"missing response body";const y=new Headers;return Object.assign(Object.assign({},g),{header:x.headers,trailer:y,message:p(x.body,y,x.headers)})}})}}}({baseUrl:"https://web-backend.codeium.com",useBinaryFormat:!0}),$j=function(t,e){return function(n,o){const r={};for(const[s,i]of Object.entries(n.methods)){const a=o(Object.assign(Object.assign({},i),{localName:s,service:n}));a!=null&&(r[s]=a)}return r}(t,n=>{switch(n.kind){case An.Unary:return function(o,r,s){return async function(i,a){var l,c;const d=await o.unary(r,s,a==null?void 0:a.signal,a==null?void 0:a.timeoutMs,a==null?void 0:a.headers,i,a==null?void 0:a.contextValues);return(l=a==null?void 0:a.onHeader)===null||l===void 0||l.call(a,d.header),(c=a==null?void 0:a.onTrailer)===null||c===void 0||c.call(a,d.trailer),d.message}}(e,t,n);case An.ServerStreaming:return function(o,r,s){return function(i,a){return N_(o.stream(r,s,a==null?void 0:a.signal,a==null?void 0:a.timeoutMs,a==null?void 0:a.headers,function(l){return Ij(this,arguments,function*(){yield pi(yield*Aj(Ej(l)))})}([i]),a==null?void 0:a.contextValues),a)}}(e,t,n);case An.ClientStreaming:return function(o,r,s){return async function(i,a){var l,c,d,u,f,p;const _=await o.stream(r,s,a==null?void 0:a.signal,a==null?void 0:a.timeoutMs,a==null?void 0:a.headers,i,a==null?void 0:a.contextValues);let g;(f=a==null?void 0:a.onHeader)===null||f===void 0||f.call(a,_.header);try{for(var m,b=!0,x=C_(_.message);!(l=(m=await x.next()).done);b=!0)u=m.value,b=!1,g=u}catch(y){c={error:y}}finally{try{b||l||!(d=x.return)||await d.call(x)}finally{if(c)throw c.error}}if(!g)throw new Gt("protocol error: missing response message",gt.Internal);return(p=a==null?void 0:a.onTrailer)===null||p===void 0||p.call(a,_.trailer),g}}(e,t,n);case An.BiDiStreaming:return function(o,r,s){return function(i,a){return N_(o.stream(r,s,a==null?void 0:a.signal,a==null?void 0:a.timeoutMs,a==null?void 0:a.headers,i,a==null?void 0:a.contextValues),a)}}(e,t,n);default:return null}})}(Bj,Vj);let ol;try{ol=crypto.randomUUID()}catch{ol="10000000-1000-4000-8000-100000000000".replace(/[018]/g,t=>(+t^(crypto.getRandomValues(new Uint8Array(1))[0]??0)&15>>+t/4).toString(16))}async function Hj(t,e){const n=t.state.facet(Qa),{override:o}=t.state.facet(S_),r=await o(),s=t.state,i=s.selection.main.head,a=s.doc.toString();try{const l=await async function({text:_,cursorOffset:g,config:m,otherDocuments:b}){return await $j.getCompletions({metadata:{ideName:"web",ideVersion:"0.0.5",extensionName:"@valtown/codemirror-codeium",extensionVersion:"1.0.0",apiKey:m.apiKey,sessionId:ol,authSource:m.authSource},document:{text:_,cursorOffset:BigInt(g),language:m.language,editorLanguage:"typescript",lineEnding:`
96
+ `)}}class hC{constructor(){this.secrets=new KS}createGenerator(e,n){switch(e.type){case"postgres":return new XS(e,n,this.secrets);case"mysql":return new ZS(e,n,this.secrets);case"sqlite":return new QS(e,n,this.secrets);case"snowflake":return new eC(e,n,this.secrets);case"bigquery":return new tC(e,n,this.secrets);case"duckdb":return new nC(e,n,this.secrets);case"motherduck":return new oC(e,n,this.secrets);case"clickhouse_connect":return new rC(e,n,this.secrets);case"timeplus":return new sC(e,n,this.secrets);case"chdb":return new iC(e,n,this.secrets);case"trino":return new aC(e,n,this.secrets);case"iceberg":return new lC(e,n,this.secrets);case"datafusion":return new cC(e,n,this.secrets);case"pyspark":return new dC(e,n,this.secrets);case"redshift":return new uC(e,n,this.secrets);default:mp(e)}}}function Br(t){return t.toString().charAt(0).toUpperCase()+t.toString().slice(1)}function Da(t,e){return Object.entries(t).filter(([,n])=>n!=null&&n!=="").map(([n,o])=>e(typeof o=="boolean"?`${n}=${Br(o)}`:`${n}=${o}`)).join(`,
97
+ `)}function vg(t){return t.sort((e,n)=>e.provider==="env"?1:n.provider==="env"?-1:0)}const kg=t=>{const e=X.c(42),{providerNames:n,onClose:o,onSuccess:r}=t,[s,i]=K.useState(""),[a,l]=K.useState(""),[c,d]=K.useState(n[0]);let u;e[0]!==s||e[1]!==c||e[2]!==r||e[3]!==a?(u=async V=>{if(V.preventDefault(),c)if(s&&a&&c)try{await ZF({key:s,value:a,provider:"dotenv",name:c}),lt({title:"Secret created",description:"The secret has been created successfully."}),r(s)}catch{lt({title:"Error",description:"Failed to create secret. Please try again.",variant:"danger"})}else lt({title:"Error",description:"Please fill in all fields.",variant:"danger"});else lt({title:"Error",description:"No location selected for the secret.",variant:"danger"})},e[0]=s,e[1]=c,e[2]=r,e[3]=a,e[4]=u):u=e[4];const f=u;let p,_,g,m,b,x,y,v,k,S,E,j,I,T,M,L;e[5]===Symbol.for("react.memo_cache_sentinel")?(p=h.jsxs(Os,{children:[h.jsx(dr,{children:"Add Secret"}),h.jsx(Ps,{children:"Add a new secret to your environment variables."})]}),e[5]=p):p=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(_=h.jsx(Rr,{htmlFor:"key",children:"Key"}),e[6]=_):_=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(g=V=>{i(V.target.value.replaceAll(/\W/g,"_"))},e[7]=g):g=e[7],e[8]!==s?(m=h.jsxs("div",{className:"grid gap-2",children:[_,h.jsx(ur,{id:"key",value:s,onChange:g,placeholder:"MY_SECRET_KEY",required:!0})]}),e[8]=s,e[9]=m):m=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(b=h.jsx(Rr,{htmlFor:"value",children:"Value"}),e[10]=b):b=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(x=V=>l(V.target.value),e[11]=x):x=e[11],e[12]!==a?(y=h.jsx(ur,{id:"value",type:"text",value:a,onChange:x,required:!0,autoComplete:"off"}),e[12]=a,e[13]=y):y=e[13],e[14]===Symbol.for("react.memo_cache_sentinel")?(v=window.location.href.startsWith("http://")&&h.jsx(z3,{children:"Note: You are sending this key over http."}),e[14]=v):v=e[14],e[15]!==y?(k=h.jsxs("div",{className:"grid gap-2",children:[b,y,v]}),e[15]=y,e[16]=k):k=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(S=h.jsx(Rr,{htmlFor:"location",children:"Location"}),e[17]=S):S=e[17],e[18]!==n.length?(E=n.length===0&&h.jsx("p",{className:"text-sm text-muted-foreground",children:"No dotenv locations configured."}),e[18]=n.length,e[19]=E):E=e[19],e[20]!==c||e[21]!==n?(j=n.length>0&&h.jsxs(np,{value:c,onValueChange:V=>d(V),children:[h.jsx(ep,{children:h.jsx(tp,{placeholder:"Select a provider"})}),h.jsx(Kf,{children:n.map(fC)})]}),e[20]=c,e[21]=n,e[22]=j):j=e[22],e[23]===Symbol.for("react.memo_cache_sentinel")?(I=h.jsxs(z3,{children:["You can configure the location by setting the"," ",h.jsx(gp,{href:"https://links.marimo.app/dotenv",children:"dotenv configuration"}),"."]}),e[23]=I):I=e[23],e[24]!==E||e[25]!==j?(T=h.jsxs("div",{className:"grid gap-2",children:[S,E,j,I]}),e[24]=E,e[25]=j,e[26]=T):T=e[26],e[27]!==k||e[28]!==T||e[29]!==m?(M=h.jsxs("div",{className:"grid gap-4 py-4",children:[m,k,T]}),e[27]=k,e[28]=T,e[29]=m,e[30]=M):M=e[30],e[31]!==o?(L=h.jsx(Pe,{type:"button",variant:"outline",onClick:o,children:"Cancel"}),e[31]=o,e[32]=L):L=e[32];const B=!s||!a||!c;let O,z,F;return e[33]!==B?(O=h.jsx(Pe,{type:"submit",disabled:B,children:"Add Secret"}),e[33]=B,e[34]=O):O=e[34],e[35]!==L||e[36]!==O?(z=h.jsxs(ea,{children:[L,O]}),e[35]=L,e[36]=O,e[37]=z):z=e[37],e[38]!==f||e[39]!==M||e[40]!==z?(F=h.jsx(cr,{children:h.jsxs("form",{onSubmit:f,children:[p,M,z]})}),e[38]=f,e[39]=M,e[40]=z,e[41]=F):F=e[41],F};function fC(t){return h.jsx(Xf,{value:t,children:t},t)}const Sg=A.createContext({providerNames:[],secretKeys:[],loading:!1,error:void 0,refreshSecrets:jn.NOOP}),pC=t=>{const e=X.c(14),{children:n}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],e[0]=o):o=e[0];const{data:r,loading:s,error:i,reload:a}=Xn(bC,o);let l,c,d,u;return e[1]!==(r==null?void 0:r.secretKeys)?(l=(r==null?void 0:r.secretKeys)||[],e[1]=r==null?void 0:r.secretKeys,e[2]=l):l=e[2],e[3]!==(r==null?void 0:r.providerNames)?(c=(r==null?void 0:r.providerNames)||[],e[3]=r==null?void 0:r.providerNames,e[4]=c):c=e[4],e[5]!==i||e[6]!==s||e[7]!==a||e[8]!==l||e[9]!==c?(d={secretKeys:l,providerNames:c,loading:s,error:i,refreshSecrets:a},e[5]=i,e[6]=s,e[7]=a,e[8]=l,e[9]=c,e[10]=d):d=e[10],e[11]!==n||e[12]!==d?(u=h.jsx(Sg.Provider,{value:d,children:n}),e[11]=n,e[12]=d,e[13]=u):u=e[13],u};function mC(t){return t.provider!=="env"}function gC(t){return t.name}function _C(t){return t.keys}async function bC(){const t=await bS.request({}),e=vg(t.secrets).filter(mC).map(gC);return{secretKeys:t.secrets.flatMap(_C).sort(),providerNames:e}}const Cg=[{name:"PostgreSQL",schema:ig,color:"#336791",logo:"postgres",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"MySQL",schema:ag,color:"#00758F",logo:"mysql",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"SQLite",schema:lg,color:"#003B57",logo:"sqlite",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"DuckDB",schema:cg,color:"#FFD700",logo:"duckdb",connectionLibraries:{libraries:["duckdb"],preferred:"duckdb"}},{name:"MotherDuck",schema:dg,color:"#ff9538",logo:"motherduck",connectionLibraries:{libraries:["duckdb"],preferred:"duckdb"}},{name:"Snowflake",schema:ug,color:"#29B5E8",logo:"snowflake",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"ClickHouse",schema:fg,color:"#2C2C1D",logo:"clickhouse",connectionLibraries:{libraries:["clickhouse_connect"],preferred:"clickhouse_connect"}},{name:"Timeplus",schema:pg,color:"#B83280",logo:"timeplus",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"BigQuery",schema:hg,color:"#4285F4",logo:"bigquery",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"ClickHouse Embedded",schema:mg,color:"#f2b611",logo:"clickhouse",connectionLibraries:{libraries:["chdb"],preferred:"chdb"}},{name:"Trino",schema:gg,color:"#d466b6",logo:"trino",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"DataFusion",schema:bg,color:"#202A37",logo:"datafusion",connectionLibraries:{libraries:["ibis"],preferred:"ibis"}},{name:"PySpark",schema:yg,color:"#1C5162",logo:"pyspark",connectionLibraries:{libraries:["ibis"],preferred:"ibis"}},{name:"Redshift",schema:xg,color:"#522BAE",logo:"redshift",connectionLibraries:{libraries:["redshift"],preferred:"redshift"}}],Ng=[{name:"Iceberg",schema:_g,color:"#000000",logo:"iceberg",connectionLibraries:{libraries:["pyiceberg"],preferred:"pyiceberg"}}],yC=t=>{const e=X.c(14),{onSelect:n}=t;let o;e[0]!==n?(o=u=>{const{name:f,schema:p,color:_,logo:g}=u;return h.jsxs("button",{type:"button",className:"py-3 flex flex-col items-center justify-center gap-1 transition-all hover:scale-105 hover:brightness-110 rounded shadow-smSolid hover:shadow-mdSolid",style:{backgroundColor:_},onClick:()=>n(p),children:[h.jsx(q3,{name:g,className:"w-8 h-8 text-white brightness-0 invert dark:invert"}),h.jsx("span",{className:"text-white font-medium text-lg",children:f})]},f)},e[0]=n,e[1]=o):o=e[1];const r=o;let s,i,a,l,c,d;return e[2]!==r?(s=Cg.map(r),e[2]=r,e[3]=s):s=e[3],e[4]!==s?(i=h.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:s}),e[4]=s,e[5]=i):i=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsxs("h4",{className:"font-semibold text-muted-foreground text-lg flex items-center gap-4",children:["Data Catalogs",h.jsx("hr",{className:"flex-1"})]}),e[6]=a):a=e[6],e[7]!==r?(l=Ng.map(r),e[7]=r,e[8]=l):l=e[8],e[9]!==l?(c=h.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:l}),e[9]=l,e[10]=c):c=e[10],e[11]!==i||e[12]!==c?(d=h.jsxs(h.Fragment,{children:[i,a,c]}),e[11]=i,e[12]=c,e[13]=d):d=e[13],d},xC=[{isMatch:t=>{if(t instanceof Ae.ZodString||t instanceof Ae.ZodNumber){const{optionRegex:e}=Ye.parse(t._def.description||"");return!!e}return!1},Component:({schema:t,form:e,path:n})=>{const{secretKeys:o,providerNames:r,refreshSecrets:s}=A.useContext(Sg),{openModal:i,closeModal:a}=Un(),{label:l,description:c,optionRegex:d=""}=Ye.parse(t._def.description||""),[u,f]=Ft(o,p=>new RegExp(d,"i").test(p));return h.jsx(B3,{control:e.control,name:n,render:({field:p})=>h.jsxs(U3,{children:[h.jsx(QF,{children:l}),h.jsx(ez,{children:c}),h.jsx(V3,{children:h.jsxs("div",{className:"flex gap-2",children:[t instanceof Ae.ZodString?h.jsx(ur,{...p,value:p.value,onChange:p.onChange,className:Oe("flex-1")}):h.jsx(tz,{...p,value:p.value,onChange:p.onChange,className:"flex-1"}),h.jsxs(hc,{children:[h.jsx(fc,{asChild:!0,children:h.jsx(Pe,{variant:"outline",size:"icon",className:Oe(Oa(p.value)&&"bg-accent"),children:h.jsx(Jc,{className:"h-3 w-3"})})}),h.jsxs(pc,{align:"end",className:"max-h-60 overflow-y-auto",children:[h.jsxs(sn,{onSelect:()=>{i(h.jsx(kg,{providerNames:r,onSuccess:_=>{s(),p.onChange(hd(_)),a()},onClose:a}))},children:[h.jsx(va,{className:"mr-2 h-3.5 w-3.5"}),"Create a new secret"]}),u.length>0&&h.jsxs(h.Fragment,{children:[h.jsx(zo,{}),h.jsx(nz,{children:"Recommended"})]}),u.map(_=>h.jsx(sn,{onSelect:()=>p.onChange(hd(_)),children:_},_)),f.length>0&&h.jsx(zo,{}),f.map(_=>h.jsx(sn,{onSelect:()=>p.onChange(hd(_)),children:_},_))]})]})]})}),h.jsx($3,{})]})})}}],wC=t=>{var $;const e=X.c(49),{schema:n,onSubmit:o,onBack:r}=t;let s,i,a;e[0]!==n?(s=oz(n),e[0]=n,e[1]=s):s=e[1],e[2]!==n?(i=H3(n),e[2]=n,e[3]=i):i=e[3],e[4]!==s||e[5]!==i?(a={defaultValues:s,resolver:i,reValidateMode:"onChange"},e[4]=s,e[5]=i,e[6]=a):a=e[6];const l=W3(a),c=($=[...Cg,...Ng].find(N=>N.schema===n))==null?void 0:$.connectionLibraries,[d,u]=A.useState((c==null?void 0:c.preferred)??"sqlalchemy"),{createNewCell:f}=Lt(),p=zs();let _;e[7]!==f||e[8]!==p?(_=N=>{f({code:N,before:!1,cellId:p??"__end__",skipIfCodeExists:!0})},e[7]=f,e[8]=p,e[9]=_):_=e[9];const g=_;let m;e[10]!==g||e[11]!==o||e[12]!==d?(m=N=>{g(function(H,G){if(!(G in wg))throw new Error(`Unsupported library: ${G}`);JS.parse(H);const Z=new hC,q=Z.createGenerator(H,G),re=q.generateConnectionCode(),ne=Z.secrets,oe=[...new Set([...ne.imports,...q.imports])].sort();oe.push("");const Y=ne.formatSecrets();return Y&&oe.push(Y),oe.push(re.trim()),oe.join(`
98
+ `)}(N,d)),o()},e[10]=g,e[11]=o,e[12]=d,e[13]=m):m=e[13];const b=m;let x;e[14]!==l||e[15]!==b?(x=l.handleSubmit(b),e[14]=l,e[15]=b,e[16]=x):x=e[16];let y,v;e[17]===Symbol.for("react.memo_cache_sentinel")?(y=h.jsx(rz,{}),e[17]=y):y=e[17],e[18]!==l||e[19]!==n?(v=h.jsx(pC,{children:h.jsx(sz,{schema:n,form:l,renderers:xC,children:y})}),e[18]=l,e[19]=n,e[20]=v):v=e[20];let k;e[21]!==r?(k=h.jsx(Pe,{type:"button",variant:"outline",onClick:r,children:"Back"}),e[21]=r,e[22]=k):k=e[22];const S=!l.formState.isValid;let E,j;e[23]!==S?(E=h.jsx(Pe,{type:"submit",disabled:S,children:"Add"}),e[23]=S,e[24]=E):E=e[24],e[25]!==k||e[26]!==E?(j=h.jsxs("div",{className:"flex gap-2",children:[k,E]}),e[25]=k,e[26]=E,e[27]=j):j=e[27];const I=np;let T,M;e[28]===Symbol.for("react.memo_cache_sentinel")?(T=N=>u(N),e[28]=T):T=e[28],e[29]===Symbol.for("react.memo_cache_sentinel")?(M=h.jsxs("div",{className:"flex flex-col gap-1 items-end",children:[h.jsx(ep,{children:h.jsx(tp,{placeholder:"Select a library"})}),h.jsx("span",{className:"text-xs text-muted-foreground",children:"Preferred connection library"})]}),e[29]=M):M=e[29];const L=Kf,B=k3,O=c==null?void 0:c.libraries.map(kC);let z,F,V,P,C;return e[30]!==B||e[31]!==O?(z=h.jsx(B,{children:O}),e[30]=B,e[31]=O,e[32]=z):z=e[32],e[33]!==L||e[34]!==z?(F=h.jsx(L,{children:z}),e[33]=L,e[34]=z,e[35]=F):F=e[35],e[36]!==I||e[37]!==d||e[38]!==T||e[39]!==M||e[40]!==F?(V=h.jsx("div",{children:h.jsxs(I,{value:d,onValueChange:T,children:[M,F]})}),e[36]=I,e[37]=d,e[38]=T,e[39]=M,e[40]=F,e[41]=V):V=e[41],e[42]!==j||e[43]!==V?(P=h.jsxs("div",{className:"flex gap-2 justify-between",children:[j,V]}),e[42]=j,e[43]=V,e[44]=P):P=e[44],e[45]!==P||e[46]!==x||e[47]!==v?(C=h.jsxs("form",{onSubmit:x,className:"space-y-4",children:[v,P]}),e[45]=P,e[46]=x,e[47]=v,e[48]=C):C=e[48],C},vC=t=>{const e=X.c(5),{onSubmit:n}=t,[o,r]=A.useState(null);if(!o){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx(yC,{onSelect:r}),e[0]=a):a=e[0],a}let s,i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(s=()=>r(null),e[1]=s):s=e[1],e[2]!==n||e[3]!==o?(i=h.jsx(wC,{schema:o,onSubmit:n,onBack:s}),e[2]=n,e[3]=o,e[4]=i):i=e[4],i},jg=t=>{const e=X.c(6),{children:n}=t,[o,r]=A.useState(!1);let s,i,a;return e[0]!==n?(s=h.jsx(iz,{asChild:!0,children:n}),e[0]=n,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsx(Eg,{onClose:()=>r(!1)}),e[2]=i):i=e[2],e[3]!==o||e[4]!==s?(a=h.jsxs(az,{open:o,onOpenChange:r,children:[s,i]}),e[3]=o,e[4]=s,e[5]=a):a=e[5],a},Eg=t=>{const e=X.c(4),{onClose:n}=t;let o,r,s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx(dr,{children:"Add Connection"}),e[0]=o):o=e[0],e[1]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsxs(Os,{className:"mb-4",children:[o,h.jsxs(Ps,{children:["Connect to your database or data catalog to query data directly from your notebook. Learn more about how to connect to your database in our"," ",h.jsx(gp,{href:"https://docs.marimo.io/guides/working_with_data/sql/#connecting-to-a-custom-database",children:"docs."})]})]}),e[1]=r):r=e[1],e[2]!==n?(s=h.jsxs(cr,{className:"max-h-[75vh] overflow-y-auto",children:[r,h.jsx(vC,{onSubmit:()=>n()})]}),e[2]=n,e[3]=s):s=e[3],s};function kC(t){return h.jsx(Xf,{value:t,children:wg[t]},t)}const SC=()=>{const t=X.c(2),{updateCellConfig:e}=Lt();let n;return t[0]!==e?(n=async()=>{const o=new ta,r=fo(),s=r.cellIds.inOrderIds,i={};for(const l of s){if(r.cellData[l]===void 0)continue;const{code:c,config:d}=r.cellData[l];d.hide_code||o.isSupported(c)&&(i[l]={hide_code:!0})}const a=cc.entries(i);if(a.length!==0){await Dr({configs:i});for(const[l,c]of a)e({cellId:l,config:c})}},t[0]=e,t[1]=n):n=t[1],n},oi=t=>{t==null||t.preventDefault(),t==null||t.stopPropagation()};function Ig(){const t=X.c(150),e=mc(),{openModal:n,closeModal:o}=Un(),{toggleApplication:r}=na(),{selectedPanel:s}=gc(),[i]=fn(fp),a=He(Ms),l=SC(),{updateCellConfig:c,undoDeleteCell:d,clearAllCellOutputs:u,upsertSetupCell:f,collapseAllCells:p,expandAllCells:_}=Lt(),g=tg(),m=Zm(),b=function(Pt){const wt=X.c(4),{openPrompt:Cn,closeModal:Nn}=Un();let As;return wt[0]!==Nn||wt[1]!==Cn||wt[2]!==Pt?(As=()=>{if(!Pt)return null;const ec=pp.guessDeliminator(Pt),Wf=$n.basename(Pt);Cn({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${Wf}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:qf=>{const tc=ec.join($n.dirname(Pt),qf);XF({source:Pt,destination:tc}).then(()=>{Nn(),lt({title:"Notebook copied",description:"A copy of the notebook has been created."}),window.open(`/?file=${tc}`,"_blank")})}})},wt[0]=Nn,wt[1]=Cn,wt[2]=Pt,wt[3]=As):As=wt[3],As}(e),x=Qt(cd),y=Qt(a$),v=Qt(l$),k=He(lz),S=He(cz),E=He(G3),{selectedLayout:j}=hS(),{setLayoutView:I}=fS(),T=ng(),M=qC;let L,B,O,z,F,V,P,C,$,N,H,G,Z;t[0]===Symbol.for("react.memo_cache_sentinel")?(L=h.jsx(Lm,{size:14,strokeWidth:1.5}),t[0]=L):L=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(B=h.jsx(uz,{size:14,strokeWidth:1.5}),t[1]=B):B=t[1],t[2]!==o||t[3]!==n?(O={icon:B,label:"Publish HTML to web",handle:async()=>{n(h.jsx(GS,{onClose:o}))}},t[2]=o,t[3]=n,t[4]=O):O=t[4],t[5]===Symbol.for("react.memo_cache_sentinel")?(z={icon:h.jsx(lS,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",handle:WC},t[5]=z):z=t[5],t[6]!==O?(F={icon:L,label:"Share",handle:oi,dropdown:[O,z]},t[6]=O,t[7]=F):F=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(V=h.jsx(_p,{size:14,strokeWidth:1.5}),t[8]=V):V=t[8],t[9]===Symbol.for("react.memo_cache_sentinel")?(P=h.jsx(yS,{size:14,strokeWidth:1.5}),t[9]=P):P=t[9],t[10]!==e?(C={icon:P,label:"Download as HTML",handle:async()=>{e?await xS({filename:e,includeCode:!0}):lt({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."})}},t[10]=e,t[11]=C):C=t[11],t[12]===Symbol.for("react.memo_cache_sentinel")?($=h.jsx(yS,{size:14,strokeWidth:1.5}),t[12]=$):$=t[12],t[13]!==e?(N={icon:$,label:"Download as HTML (exclude code)",handle:async()=>{e?await xS({filename:e,includeCode:!1}):lt({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."})}},t[13]=e,t[14]=N):N=t[14],t[15]===Symbol.for("react.memo_cache_sentinel")?(H={icon:h.jsx(ic,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:HC},G={icon:h.jsx(dm,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:$C},t[15]=H,t[16]=G):(H=t[15],G=t[16]),t[17]===Symbol.for("react.memo_cache_sentinel")?(Z=h.jsx(Xp,{size:14,strokeWidth:1.5}),t[17]=Z):Z=t[17];const q=i.mode!=="present";let re,ne,oe;t[18]!==i.mode?(re=i.mode==="present"?void 0:h.jsxs("span",{children:["Only available in app view. ",h.jsx("br",{}),"Toggle with: ",pn("global.hideCode",!1)]}),t[18]=i.mode,t[19]=re):re=t[19],t[20]!==q||t[21]!==re?(ne={divider:!0,icon:Z,label:"Download as PNG",disabled:q,tooltip:re,handle:VC},t[20]=q,t[21]=re,t[22]=ne):ne=t[22],t[23]===Symbol.for("react.memo_cache_sentinel")?(oe=h.jsx(hz,{size:14,strokeWidth:1.5}),t[23]=oe):oe=t[23];const Y=i.mode!=="present";let Q,ce,he,de,me,ie,Ce,we,ae,ve,ge,be,Te,ze,Xe;if(t[24]!==i.mode?(Q=i.mode==="present"?void 0:h.jsxs("span",{children:["Only available in app view. ",h.jsx("br",{}),"Toggle with: ",pn("global.hideCode",!1)]}),t[24]=i.mode,t[25]=Q):Q=t[25],t[26]!==Y||t[27]!==Q?(ce={icon:oe,label:"Download as PDF",disabled:Y,tooltip:Q,handle:BC},t[26]=Y,t[27]=Q,t[28]=ce):ce=t[28],t[29]!==ne||t[30]!==ce||t[31]!==C||t[32]!==N?(he={icon:V,label:"Download",handle:oi,dropdown:[C,N,H,G,ne,ce]},t[29]=ne,t[30]=ce,t[31]=C,t[32]=N,t[33]=he):he=t[33],t[34]===Symbol.for("react.memo_cache_sentinel")?(de=h.jsx(Tm,{size:14,strokeWidth:1.5}),t[34]=de):de=t[34],t[35]!==s||t[36]!==r?(me=dd.flatMap(Pt=>{const{type:wt,Icon:Cn,hidden:Nn}=Pt;return Nn?[]:{label:Zf(wt),rightElement:M(s===wt),icon:h.jsx(Cn,{size:14,strokeWidth:1.5}),handle:()=>r(wt)}}),t[35]=s,t[36]=r,t[37]=me):me=t[37],t[38]!==me?(ie={divider:!0,icon:de,label:"Helper panel",handle:oi,dropdown:me},t[38]=me,t[39]=ie):ie=t[39],t[40]===Symbol.for("react.memo_cache_sentinel")?(Ce=h.jsx(Zc,{size:14,strokeWidth:1.5}),t[40]=Ce):Ce=t[40],t[41]!==i.mode?(we=i.mode==="present"?h.jsx(Y3,{size:14,strokeWidth:1.5}):h.jsx(Kc,{size:14,strokeWidth:1.5}),t[41]=i.mode,t[42]=we):we=t[42],t[43]!==T?(ae=()=>{T()},t[43]=T,t[44]=ae):ae=t[44],t[45]!==we||t[46]!==ae?(ve={icon:we,label:"Toggle app view",hotkey:"global.hideCode",handle:ae},t[45]=we,t[46]=ae,t[47]=ve):ve=t[47],t[48]!==j||t[49]!==I||t[50]!==ve||t[51]!==T||t[52]!==i.mode){let Pt;t[54]!==j||t[55]!==I||t[56]!==T||t[57]!==i.mode?(Pt=(wt,Cn)=>{const Nn=Jm(wt);return{divider:Cn===0,label:Km(wt),icon:h.jsx(Nn,{size:14,strokeWidth:1.5}),rightElement:h.jsx("div",{className:"w-8 flex justify-end",children:j===wt&&h.jsx(_c,{size:14})}),handle:()=>{I(wt),i.mode==="edit"&&T()}}},t[54]=j,t[55]=I,t[56]=T,t[57]=i.mode,t[58]=Pt):Pt=t[58],ge={icon:Ce,label:"Present as",handle:oi,dropdown:[ve,...pS.map(Pt)]},t[48]=j,t[49]=I,t[50]=ve,t[51]=T,t[52]=i.mode,t[53]=ge}else ge=t[53];t[59]===Symbol.for("react.memo_cache_sentinel")?(be=h.jsx(gm,{size:14,strokeWidth:1.5}),t[59]=be):be=t[59],t[60]!==e?(Te=!e||Bn(),t[60]=e,t[61]=Te):Te=t[61],t[62]!==b||t[63]!==Te?(ze={icon:be,label:"Create notebook copy",hidden:Te,handle:b},t[62]=b,t[63]=Te,t[64]=ze):ze=t[64],t[65]===Symbol.for("react.memo_cache_sentinel")?(Xe=h.jsx(Wc,{size:14,strokeWidth:1.5}),t[65]=Xe):Xe=t[65];const Fe=!e;let et,nt;t[66]!==Fe?(et={icon:Xe,label:"Copy code to clipboard",hidden:Fe,handle:zC},t[66]=Fe,t[67]=et):et=t[67],t[68]===Symbol.for("react.memo_cache_sentinel")?(nt=h.jsx(br,{size:14,strokeWidth:1.5}),t[68]=nt):nt=t[68];const it=!k||a;let te,Ne,Me;t[69]!==c?(te=async()=>{const Pt=fo(),wt=fz(Pt),Cn=cc.fromEntries(wt.map(FC));await Dr({configs:Cn});for(const Nn of wt)c({cellId:Nn,config:{disabled:!1}})},t[69]=c,t[70]=te):te=t[70],t[71]!==it||t[72]!==te?(Ne={icon:nt,label:"Enable all cells",hidden:it,handle:te},t[71]=it,t[72]=te,t[73]=Ne):Ne=t[73],t[74]===Symbol.for("react.memo_cache_sentinel")?(Me=h.jsx(_r,{size:14,strokeWidth:1.5}),t[74]=Me):Me=t[74];const Be=!S||a;let J,pe,_e,ue,je,ke,Ve,Ze,le,Ee,Ie,Ue,We,De,Ge;t[75]!==c?(J=async()=>{const Pt=fo(),wt=N3(Pt),Cn=cc.fromEntries(wt.map(LC));await Dr({configs:Cn});for(const Nn of wt)c({cellId:Nn,config:{disabled:!0}})},t[75]=c,t[76]=J):J=t[76],t[77]!==Be||t[78]!==J?(pe={icon:Me,label:"Disable all cells",hidden:Be,handle:J},t[77]=Be,t[78]=J,t[79]=pe):pe=t[79],t[80]===Symbol.for("react.memo_cache_sentinel")?(_e=h.jsx(M3,{size:14,strokeWidth:1.5}),t[80]=_e):_e=t[80],t[81]!==l?(ue={icon:_e,label:"Hide all markdown code",handle:l},t[81]=l,t[82]=ue):ue=t[82],t[83]===Symbol.for("react.memo_cache_sentinel")?(je=h.jsx(lm,{size:14,strokeWidth:1.5}),t[83]=je):je=t[83],t[84]!==p?(ke={icon:je,label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:p},t[84]=p,t[85]=ke):ke=t[85],t[86]===Symbol.for("react.memo_cache_sentinel")?(Ve=h.jsx(am,{size:14,strokeWidth:1.5}),t[86]=Ve):Ve=t[86],t[87]!==_?(Ze={icon:Ve,label:"Expand all sections",hotkey:"global.expandAllSections",handle:_},t[87]=_,t[88]=Ze):Ze=t[88],t[89]===Symbol.for("react.memo_cache_sentinel")?(le=h.jsx(hm,{size:14,strokeWidth:1.5}),t[89]=le):le=t[89],t[90]!==f?(Ee={icon:le,label:"Add setup cell",handle:()=>{f({code:"# Initialization code that runs before all other cells"})}},t[90]=f,t[91]=Ee):Ee=t[91],t[92]===Symbol.for("react.memo_cache_sentinel")?(Ie=h.jsx(sp,{size:14,strokeWidth:1.5}),t[92]=Ie):Ie=t[92],t[93]!==u?(Ue={icon:Ie,label:"Clear all outputs",handle:()=>{u()}},t[93]=u,t[94]=Ue):Ue=t[94],t[95]===Symbol.for("react.memo_cache_sentinel")?(We=h.jsx(pm,{size:14,strokeWidth:1.5}),t[95]=We):We=t[95],t[96]!==m?(De={icon:We,label:"Re-run all cells",hotkey:"global.runAll",handle:async()=>{m()}},t[96]=m,t[97]=De):De=t[97],t[98]===Symbol.for("react.memo_cache_sentinel")?(Ge=h.jsx(nd,{size:14,strokeWidth:1.5}),t[98]=Ge):Ge=t[98];const ot=!E||a;let Je,rt,mt,yt,Mt,xt,Bt,Sn,hn,rn,Kt,Jn,ho,vs,ks,Ss,Cs,Ns,ir,js;t[99]!==d?(Je=()=>{d()},t[99]=d,t[100]=Je):Je=t[100],t[101]!==ot||t[102]!==Je?(rt={icon:Ge,label:"Undo cell deletion",hidden:ot,handle:Je},t[101]=ot,t[102]=Je,t[103]=rt):rt=t[103],t[104]===Symbol.for("react.memo_cache_sentinel")?(mt=h.jsx(lr,{size:14,strokeWidth:1.5}),t[104]=mt):mt=t[104],t[105]!==o||t[106]!==n?(yt={icon:mt,label:"Add database connection",handle:()=>{n(h.jsx(Eg,{onClose:o}))}},t[105]=o,t[106]=n,t[107]=yt):yt=t[107],t[108]===Symbol.for("react.memo_cache_sentinel")?(Mt=h.jsx(qc,{size:14,strokeWidth:1.5}),t[108]=Mt):Mt=t[108],t[109]!==x?(xt={divider:!0,icon:Mt,label:"Command palette",hotkey:"global.commandPalette",handle:()=>x(PC)},t[109]=x,t[110]=xt):xt=t[110],t[111]===Symbol.for("react.memo_cache_sentinel")?(Bt=h.jsx(J3,{size:14,strokeWidth:1.5}),t[111]=Bt):Bt=t[111],t[112]!==y?(Sn={icon:Bt,label:"User settings",handle:()=>y(RC)},t[112]=y,t[113]=Sn):Sn=t[113],t[114]===Symbol.for("react.memo_cache_sentinel")?(hn=h.jsx(km,{size:14,strokeWidth:1.5}),t[114]=hn):hn=t[114],t[115]!==v?(rn={icon:hn,label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>v(DC)},t[115]=v,t[116]=rn):rn=t[116],t[117]===Symbol.for("react.memo_cache_sentinel")?(Kt={icon:h.jsx(cS,{size:14,strokeWidth:1.5}),label:"Open documentation",handle:OC},Jn=h.jsx(bc,{size:14,strokeWidth:1.5}),t[117]=Kt,t[118]=Jn):(Kt=t[117],Jn=t[118]),t[119]===Symbol.for("react.memo_cache_sentinel")?(ho={icon:Jn,label:"Resources",handle:oi,dropdown:[{icon:h.jsx(cS,{size:14,strokeWidth:1.5}),label:"Documentation",handle:MC},{icon:h.jsx(c$,{size:14,strokeWidth:1.5}),label:"GitHub",handle:TC},{icon:h.jsx(d$,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:AC},{icon:h.jsx(u$,{size:14,strokeWidth:1.5}),label:"YouTube",handle:IC},{icon:h.jsx(hp,{size:14,strokeWidth:1.5}),label:"Changelog",handle:EC}]},t[119]=ho):ho=t[119],t[120]===Symbol.for("react.memo_cache_sentinel")?(vs=h.jsx(wm,{size:14,strokeWidth:1.5}),t[120]=vs):vs=t[120],t[121]===Symbol.for("react.memo_cache_sentinel")?(ks={divider:!0,icon:vs,label:"Return home",hidden:!location.search.includes("file"),handle:jC},Ss=h.jsx(Sa,{size:14,strokeWidth:1.5}),t[121]=ks,t[122]=Ss):(ks=t[121],Ss=t[122]),t[123]===Symbol.for("react.memo_cache_sentinel")?(Cs={icon:Ss,label:"New notebook",hidden:!location.search.includes("file"),handle:NC},Ns=h.jsx($m,{size:14,strokeWidth:1.5}),t[123]=Cs,t[124]=Ns):(Cs=t[123],Ns=t[124]),t[125]!==g?(ir={icon:Ns,label:"Restart kernel",variant:"danger",handle:g},t[125]=g,t[126]=ir):ir=t[126],t[127]!==he||t[128]!==ie||t[129]!==ge||t[130]!==ze||t[131]!==et||t[132]!==Ne||t[133]!==F||t[134]!==pe||t[135]!==ue||t[136]!==ke||t[137]!==Ze||t[138]!==Ee||t[139]!==Ue||t[140]!==De||t[141]!==rt||t[142]!==yt||t[143]!==xt||t[144]!==Sn||t[145]!==rn||t[146]!==ir?(js=[F,he,ie,ge,ze,et,Ne,pe,ue,ke,Ze,Ee,Ue,De,rt,yt,xt,Sn,rn,Kt,ho,ks,Cs,ir],t[127]=he,t[128]=ie,t[129]=ge,t[130]=ze,t[131]=et,t[132]=Ne,t[133]=F,t[134]=pe,t[135]=ue,t[136]=ke,t[137]=Ze,t[138]=Ee,t[139]=Ue,t[140]=De,t[141]=rt,t[142]=yt,t[143]=xt,t[144]=Sn,t[145]=rn,t[146]=ir,t[147]=js):js=t[147];const Es=js;let Is;return t[148]!==Es?(Is=Es.filter(CC),t[148]=Es,t[149]=Is):Is=t[149],Is}function CC(t){return!t.hidden}function NC(){const t=dz();window.open(t,"_blank")}function jC(){const t=document.baseURI.split("?")[0];window.open(t,"_self")}function EC(){window.open(Kn.releasesPage,"_blank")}function IC(){window.open(Kn.youtube,"_blank")}function AC(){window.open(Kn.discordLink,"_blank")}function TC(){window.open(Kn.githubPage,"_blank")}function MC(){window.open(Kn.docsPage,"_blank")}function OC(){window.open(Kn.docsPage,"_blank")}function DC(t){return!t}function RC(t){return!t}function PC(t){return!t}function LC(t){return[t,{disabled:!0}]}function FC(t){return[t,{disabled:!1}]}async function zC(){const t=await bp();await yn(t.contents),lt({title:"Copied",description:"Code copied to clipboard."})}async function BC(){const t=new Event("export-beforeprint"),e=new Event("export-afterprint");window.dispatchEvent(t),setTimeout(UC,0),setTimeout(()=>window.dispatchEvent(e),0)}function UC(){return window.print()}async function VC(){const t=document.getElementById("App");t&&await C3(t,document.title)}async function $C(){const t=await bp();oa(new Blob([t.contents],{type:"text/plain"}),K3.toPY(document.title))}async function HC(){const t=await pz({download:!1});oa(new Blob([t],{type:"text/plain"}),K3.toMarkdown(document.title))}async function WC(){const t=await bp(),e=mz({code:t.contents});await yn(e),lt({title:"Copied",description:"Link copied to clipboard."})}function qC(t){return h.jsx("div",{className:"w-8 flex justify-end",children:t&&h.jsx(_c,{size:14})})}const GC=()=>{const t=X.c(10),e=Ig();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=h.jsx(xn,{"aria-label":"Config",shape:"circle",size:"small",className:"h-[27px] w-[27px]","data-testid":"notebook-menu-dropdown",color:"hint-green",children:h.jsx(S$,{strokeWidth:1.8})}),t[0]=n):n=t[0];const o=n,r=YC;let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=f=>{const p=h.jsx(sn,{variant:f.variant,disabled:f.disabled,onSelect:_=>f.handle(_),"data-testid":`notebook-menu-dropdown-${f.label}`,children:r(f)},f.label);return f.tooltip?h.jsx(Re,{content:f.tooltip,side:"left",delayDuration:100,children:h.jsx("span",{children:p})},f.label):p},t[1]=s):s=t[1];const i=s;let a,l,c,d,u;if(t[2]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx(fc,{asChild:!0,children:o}),t[2]=a):a=t[2],t[3]!==e){let f;t[5]===Symbol.for("react.memo_cache_sentinel")?(f=p=>p.hidden?null:p.dropdown?h.jsxs(_z,{children:[h.jsx(bz,{"data-testid":`notebook-menu-dropdown-${p.label}`,children:r(p)}),h.jsx(yz,{children:h.jsx(xz,{children:p.dropdown.map(_=>h.jsxs(K.Fragment,{children:[_.divider&&h.jsx(zo,{}),i(_)]},_.label))})})]},p.label):h.jsxs(K.Fragment,{children:[p.divider&&h.jsx(zo,{}),i(p)]},p.label),t[5]=f):f=t[5],l=e.map(f),t[3]=e,t[4]=l}else l=t[4];return t[6]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(zo,{}),t[6]=c):c=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsx("div",{className:"flex-1 px-2 text-xs text-muted-foreground",children:h.jsxs("span",{children:["Version: ",gz()]})}),t[7]=d):d=t[7],t[8]!==l?(u=h.jsxs(hc,{modal:!1,children:[a,h.jsxs(pc,{align:"end",className:"no-print w-[240px]",children:[l,c,d]})]}),t[8]=l,t[9]=u):u=t[9],u};function YC(t){return h.jsxs(h.Fragment,{children:[t.icon&&h.jsx("span",{className:"flex-0 mr-2",children:t.icon}),h.jsx("span",{className:"flex-1",children:t.labelElement||t.label}),t.hotkey&&h.jsx(wz,{shortcut:t.hotkey,className:"ml-4"}),t.rightElement]})}const tn=vz({findText:"",replaceText:"",caseSensitive:!1,wholeWord:!1,regexp:!1,isOpen:!1,currentView:void 0},(t,e)=>{if(e===void 0)return t;switch(e.type){case"setFind":return{...t,findText:e.find};case"setReplace":return{...t,replaceText:e.replace};case"setCaseSensitive":return{...t,caseSensitive:e.caseSensitive};case"setWholeWord":return{...t,wholeWord:e.wholeWord};case"setRegex":return{...t,regexp:e.regexp};case"setIsOpen":return{...t,isOpen:e.isOpen};case"setCurrentView":return{...t,currentView:{view:e.view,range:e.range}};case"clearCurrentView":return{...t,currentView:void 0}}});function Ag(t){if([...document.querySelectorAll('[role="dialog"][data-state="open"]')].some(e=>e instanceof HTMLElement&&e.childNodes.length>0))return!1;if(t){const e=t.state.selection.main,n=t.state.sliceDoc(e.from,e.to);n?(ut.set(tn,{type:"setFind",find:n}),ut.set(tn,{type:"setCurrentView",view:t,range:{from:e.from,to:e.to}})):ut.set(tn,{type:"setCurrentView",view:t,range:{from:0,to:0}})}return ut.get(tn).isOpen?(ut.set(tn,{type:"setIsOpen",isOpen:!1}),requestAnimationFrame(()=>{ut.set(tn,{type:"setIsOpen",isOpen:!0})}),!0):(ut.set(tn,{type:"setIsOpen",isOpen:!0}),!0)}function JC(){return!!ut.get(tn).isOpen&&(ut.set(tn,{type:"setIsOpen",isOpen:!1}),!0)}function fd(t){return Bo("create"in t,'Expected query to have a "create" method'),t}function Ra(t){return()=>{const e=ut.get(tn),n=new yc({search:e.findText,caseSensitive:e.caseSensitive,regexp:e.regexp,replace:e.replaceText,wholeWord:e.wholeWord});return!!n.valid&&t({query:fd(n).create(),search:n})}}const Tg=t=>Ra(({query:e})=>{const n=Bs(),o=ut.get(tn).currentView||{view:n[0],range:{from:0,to:0}};let r=o.range.to;t==="prev"&&(n.reverse(),r=o.range.from);let s=n.indexOf(o.view);s<0&&(s=0);const i=[...n,...n].slice(s);for(const a of i){const l=t==="next"?e.nextMatch(a.state,0,r??0):e.prevMatch(a.state,r??a.state.doc.length,a.state.doc.length);if(!l){r=null,a.dispatch({selection:Uo.single(0)});continue}const c=Uo.single(l.from,l.to);return a.dispatch({selection:c,effects:[st.scrollIntoView(c.main,{y:"center"})],userEvent:"select.search"}),ut.set(tn,{type:"setCurrentView",view:a,range:{from:l.from,to:l.to}}),l}return!1}),pd=Tg("next"),Mg=Tg("prev"),KC=Ra(({query:t})=>{var o;const e=Bs(),n=[];for(const r of e){if(r.state.readOnly)continue;const s=(o=t.matchAll(r.state,1e9))==null?void 0:o.map(a=>{const{from:l,to:c}=a;return{from:l,to:c,insert:t.getReplacement(a)}});if(!s||s.length===0)continue;const i=r.state.doc.toString();n.push(()=>{r.dispatch({changes:[{from:0,to:r.state.doc.length,insert:i}],userEvent:"input.replace.all"})}),r.dispatch({changes:s,userEvent:"input.replace.all"})}return()=>{for(const r of n)r()}}),XC=Ra(({query:t})=>{const e=Bs(),n=ut.get(tn).currentView||{view:e[0],range:{from:0}};let o=n.range.from,r=e.indexOf(n.view);r<0&&(r=0);const s=[...e,...e].slice(r);for(const i of s){const a=t.nextMatch(i.state,0,o??0);if(!a){o=null,i.dispatch({selection:Uo.single(0)});continue}const l=i.state.toText(t.getReplacement(a));return i.dispatch({changes:[{from:a.from,to:a.to,insert:l}],userEvent:"input.replace"}),pd()}return!1}),ZC=Ra(({query:t})=>{const e=Bs();let n=0;const o=new Map;for(const r of e){const s=t.matchAll(r.state,1e9)||[];for(const i of s){const{from:a,to:l}=i,c=o.get(r)||new Map;c.set(`${a}:${l}`,n++),o.set(r,c)}}return{count:n,position:o}}),md=Ut.define();function Og(){const t=Bs();for(const e of t)e.state.readOnly||e.dispatch({effects:md.of(new yc({search:""}))})}const Pa=En.define({create(){const t=ut.get(tn);return fd(new yc({search:t.findText,caseSensitive:t.caseSensitive,regexp:t.regexp,replace:t.replaceText,wholeWord:t.wholeWord})).create()},update(t,e){for(const n of e.effects)n.is(md)&&(t=fd(n.value).create());return t}}),QC=dt.mark({class:"cm-searchMatch"}),eN=dt.mark({class:"cm-searchMatch cm-searchMatch-selected"}),tN=Zn.fromClass(class{constructor(t){this.view=t,this.decorations=void 0,this.decorations=this.highlight(t.state.field(Pa))}update(t){const e=t.state.field(Pa);(e!==t.startState.field(Pa)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight(t){if(!t.spec.valid)return dt.none;const{view:e}=this,n=new Us,o=e.visibleRanges,r=o.length;for(let s=0;s<r;s++){let{to:i}=o[s];const{from:a}=o[s];for(;s<r-1&&i>o[s+1].from-500;)i=o[++s].to;t.highlight(e.state,a,i,(l,c)=>{const d=e.state.selection.ranges.some(u=>u.from===l&&u.to===c);n.add(l,c,d?eN:QC)})}return n.finish()}},{decorations:t=>t.decorations}),nN=st.baseTheme({"&light .cm-searchMatch":{backgroundColor:"#99ff7780"},"&dark .cm-searchMatch":{backgroundColor:"#22bb0070"},"&light .cm-searchMatch-selected":{backgroundColor:"transparent"},"&dark .cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff88 !important"}}),oN=()=>{var Xe;const t=X.c(102),[e,n]=A.useState(!1),[o,r]=fn(tn),[s,i]=A.useState(),a=A.useRef(null),l=He(ap);let c,d;t[0]!==e||t[1]!==o.isOpen?(c=()=>(!e||!o.isOpen)&&Ag(),t[0]=e,t[1]=o.isOpen,t[2]=c):c=t[2],qt("cell.findAndReplace",c),t[3]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{const Fe=ZC();i(Fe===!1?void 0:Fe)},t[3]=d):d=t[3];const u=d;let f,p,_,g;if(t[4]!==o.isOpen?(f=()=>{o.isOpen&&a.current&&(a.current.focus(),a.current.select())},p=[o.isOpen],t[4]=o.isOpen,t[5]=f,t[6]=p):(f=t[5],p=t[6]),A.useEffect(f,p),t[7]!==o.findText||t[8]!==o.isOpen?(_=()=>{if(o.isOpen){if(o.findText==="")return i(void 0),void Og();u(),function(){const Fe=ut.get(tn),et=Bs();for(const nt of et)nt.state.readOnly||nt.dispatch({effects:md.of(new yc({search:Fe.findText,caseSensitive:Fe.caseSensitive,regexp:Fe.regexp,replace:Fe.replaceText,wholeWord:Fe.wholeWord}))})}()}else Og()},t[7]=o.findText,t[8]=o.isOpen,t[9]=_):_=t[9],t[10]!==o.caseSensitive||t[11]!==o.findText||t[12]!==o.isOpen||t[13]!==o.regexp||t[14]!==o.wholeWord?(g=[o.findText,o.isOpen,o.caseSensitive,o.regexp,o.wholeWord],t[10]=o.caseSensitive,t[11]=o.findText,t[12]=o.isOpen,t[13]=o.regexp,t[14]=o.wholeWord,t[15]=g):g=t[15],A.useEffect(_,g),!o.isOpen)return null;const m=o.currentView;let b;t[16]!==s||t[17]!==m?(b=m&&s?(Xe=s.position.get(m.view))==null?void 0:Xe.get(`${m.range.from}:${m.range.to}`):void 0,t[16]=s,t[17]=m,t[18]=b):b=t[18];const x=b;let y,v,k,S,E,j,I,T,M,L,B;t[19]===Symbol.for("react.memo_cache_sentinel")?(y=()=>n(!0),t[19]=y):y=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(v=()=>n(!1),t[20]=v):v=t[20],t[21]!==r?(k=Fe=>{Fe.key==="Escape"&&r({type:"setIsOpen",isOpen:!1})},t[21]=r,t[22]=k):k=t[22],t[23]!==r?(S=()=>r({type:"setIsOpen",isOpen:!1}),t[23]=r,t[24]=S):S=t[24],t[25]===Symbol.for("react.memo_cache_sentinel")?(E=h.jsx(go,{className:"w-4 h-4"}),t[25]=E):E=t[25],t[26]!==S?(j=h.jsx("div",{className:"absolute top-0 right-0",children:h.jsx(Pe,{"data-testid":"close-find-replace-button",onClick:S,size:"xs",variant:"text",children:E})}),t[26]=S,t[27]=j):j=t[27],t[28]!==r?(I=Fe=>{r({type:"setFind",find:Fe.target.value})},t[28]=r,t[29]=I):I=t[29],t[30]!==o.findText||t[31]!==I?(T=h.jsx(ur,{ref:a,"data-testid":"find-input",value:o.findText,autoFocus:!0,className:"mr-2 mb-0",placeholder:"Find",onKeyDown:sN,onChange:I}),t[30]=o.findText,t[31]=I,t[32]=T):T=t[32],t[33]!==r?(M=Fe=>{r({type:"setReplace",replace:Fe.target.value})},t[33]=r,t[34]=M):M=t[34],t[35]!==o.replaceText||t[36]!==M?(L=h.jsx(ur,{"data-testid":"replace-input",value:o.replaceText,placeholder:"Replace",onChange:M}),t[35]=o.replaceText,t[36]=M,t[37]=L):L=t[37],t[38]!==T||t[39]!==L?(B=h.jsxs("div",{className:"flex flex-col flex-2 gap-2 w-[55%]",children:[T,L]}),t[38]=T,t[39]=L,t[40]=B):B=t[40];const O=o.caseSensitive?"on":"off";let z,F,V;t[41]!==r?(z=Fe=>r({type:"setCaseSensitive",caseSensitive:Fe}),t[41]=r,t[42]=z):z=t[42],t[43]===Symbol.for("react.memo_cache_sentinel")?(F=h.jsx(kz,{className:"w-4 h-4"}),t[43]=F):F=t[43],t[44]!==o.caseSensitive||t[45]!==O||t[46]!==z?(V=h.jsx(Re,{content:"Case Sensitive",children:h.jsx(yp,{size:"sm",pressed:o.caseSensitive,"data-state":O,onPressedChange:z,children:F})}),t[44]=o.caseSensitive,t[45]=O,t[46]=z,t[47]=V):V=t[47];const P=o.wholeWord?"on":"off";let C,$,N;t[48]!==r?(C=Fe=>r({type:"setWholeWord",wholeWord:Fe}),t[48]=r,t[49]=C):C=t[49],t[50]===Symbol.for("react.memo_cache_sentinel")?($=h.jsx(Ym,{className:"w-4 h-4"}),t[50]=$):$=t[50],t[51]!==o.wholeWord||t[52]!==P||t[53]!==C?(N=h.jsx(Re,{content:"Match Whole Word",children:h.jsx(yp,{size:"sm",pressed:o.wholeWord,"data-state":P,onPressedChange:C,children:$})}),t[51]=o.wholeWord,t[52]=P,t[53]=C,t[54]=N):N=t[54];const H=o.regexp?"on":"off";let G,Z,q,re,ne;t[55]!==r?(G=Fe=>r({type:"setRegex",regexp:Fe}),t[55]=r,t[56]=G):G=t[56],t[57]===Symbol.for("react.memo_cache_sentinel")?(Z=h.jsx(Dm,{className:"w-4 h-4"}),t[57]=Z):Z=t[57],t[58]!==o.regexp||t[59]!==H||t[60]!==G?(q=h.jsx(Re,{content:"Use Regular Expression",children:h.jsx(yp,{size:"sm",pressed:o.regexp,"data-state":H,onPressedChange:G,children:Z})}),t[58]=o.regexp,t[59]=H,t[60]=G,t[61]=q):q=t[61],t[62]!==V||t[63]!==N||t[64]!==q?(re=h.jsxs("div",{className:"flex items-center gap-[2px]",children:[V,N,q]}),t[62]=V,t[63]=N,t[64]=q,t[65]=re):re=t[65],t[66]===Symbol.for("react.memo_cache_sentinel")?(ne=()=>{XC()&&u()},t[66]=ne):ne=t[66];const oe=o.findText==="";let Y,Q;t[67]!==oe?(Y=h.jsx(Pe,{"data-testid":"replace-next-button",size:"xs",variant:"outline",className:"h-6 text-xs",onClick:ne,disabled:oe,children:"Replace Next"}),t[67]=oe,t[68]=Y):Y=t[68],t[69]===Symbol.for("react.memo_cache_sentinel")?(Q=()=>{const Fe=KC();if(!Fe)return;u();const{dismiss:et}=lt({title:"Replaced all occurrences",action:h.jsx(id,{"data-testid":"undo-replace-all-button",onClick:()=>{Fe(),nt()}})}),nt=et},t[69]=Q):Q=t[69];const ce=o.findText==="";let he,de,me,ie,Ce,we,ae,ve,ge,be,Te,ze;return t[70]!==ce?(he=h.jsx(Pe,{"data-testid":"replace-all-button",size:"xs",variant:"outline",className:"h-6 text-xs",onClick:Q,disabled:ce,children:"Replace All"}),t[70]=ce,t[71]=he):he=t[71],t[72]!==Y||t[73]!==he?(de=h.jsxs("div",{className:"flex items-center gap-[2px]",children:[Y,he]}),t[72]=Y,t[73]=he,t[74]=de):de=t[74],t[75]!==re||t[76]!==de?(me=h.jsxs("div",{className:"flex flex-col gap-2",children:[re,de]}),t[75]=re,t[76]=de,t[77]=me):me=t[77],t[78]!==B||t[79]!==me?(ie=h.jsxs("div",{className:"flex items-center gap-3",children:[B,me]}),t[78]=B,t[79]=me,t[80]=ie):ie=t[80],t[81]===Symbol.for("react.memo_cache_sentinel")?(Ce=h.jsx(Re,{content:"Find Previous",children:h.jsx(Pe,{"data-testid":"find-prev-button",size:"xs",variant:"secondary",onClick:iN,children:h.jsx(Et,{className:"w-4 h-4"})})}),t[81]=Ce):Ce=t[81],t[82]===Symbol.for("react.memo_cache_sentinel")?(we=h.jsx(Re,{content:"Find Next",children:h.jsx(Pe,{"data-testid":"find-next-button",size:"xs",variant:"secondary",onClick:aN,children:h.jsx(Hc,{className:"w-4 h-4"})})}),t[82]=we):we=t[82],t[83]!==x||t[84]!==s?(ae=s!=null&&x==null&&h.jsxs("span",{className:"text-sm",children:[s.count," matches"]}),t[83]=x,t[84]=s,t[85]=ae):ae=t[85],t[86]!==x||t[87]!==s?(ve=s!=null&&x!=null&&h.jsxs("span",{className:"text-sm",children:[x+1," of ",s.count]}),t[86]=x,t[87]=s,t[88]=ve):ve=t[88],t[89]!==ae||t[90]!==ve?(ge=h.jsxs("div",{className:"flex items-center gap-2",children:[Ce,we,ae,ve]}),t[89]=ae,t[90]=ve,t[91]=ge):ge=t[91],t[92]!==l?(be=l.getHotkey("cell.findAndReplace"),t[92]=l,t[93]=be):be=t[93],t[94]!==be.key?(Te=h.jsxs("div",{className:"text-xs text-muted-foreground flex gap-1 mt-2",children:["Press"," ",h.jsx(dp,{shortcut:be.key})," ","again to open the native browser search."]}),t[94]=be.key,t[95]=Te):Te=t[95],t[96]!==j||t[97]!==ie||t[98]!==ge||t[99]!==Te||t[100]!==k?(ze=h.jsx(Sz,{restoreFocus:!0,autoFocus:!0,children:h.jsxs("div",{onFocus:y,onClick:rN,onBlur:v,className:"fixed top-0 right-0 w-[500px] flex flex-col bg-[var(--sage-1)] p-4 z-50 mt-2 mr-3 rounded-md shadow-lg border gap-2 print:hidden",onKeyDown:k,children:[j,ie,ge,Te]})}),t[96]=j,t[97]=ie,t[98]=ge,t[99]=Te,t[100]=k,t[101]=ze):ze=t[101],ze};function rN(t){t.stopPropagation(),t.preventDefault()}function sN(t){t.key==="Enter"&&(t.shiftKey?Mg():pd())}function iN(){return Mg()}function aN(){return pd()}function Dg(t){const e=X.c(3),[n,o]=A.useState(!1);let r,s;return e[0]!==t?(r=()=>{if(!t)return;o(!1);const i=setTimeout(()=>{o(!0)},200);return()=>clearTimeout(i)},s=[t],e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]),A.useEffect(r,s),t&&n}const lN=()=>{const t=X.c(6),e=Qt(cd);let n;t[0]!==e?(n=()=>e(cN),t[0]=e,t[1]=n):n=t[1];const o=n;let r,s,i;return t[2]===Symbol.for("react.memo_cache_sentinel")?(r=pn("global.commandPalette"),t[2]=r):r=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(s=h.jsx(qc,{strokeWidth:1.5,size:18}),t[3]=s):s=t[3],t[4]!==o?(i=h.jsx(Re,{content:r,children:h.jsx(xn,{"data-testid":"command-palette-button",onClick:o,shape:"rectangle",color:"hint-green",children:s})}),t[4]=o,t[5]=i):i=t[5],i};function cN(t){return!t}const ri=t=>{const{children:e}=t;return He(Ms)?null:e},dN=t=>{const{children:e}=t;return He(Ms)?e:null},Rg=t=>{const e=X.c(38),{resetOnBlur:n,placeholderText:o,initialValue:r,flexibleWidth:s,onNameChange:i,className:a}=t,l=n!==void 0&&n,c=r===void 0?null:r,d=s!==void 0&&s,[u,f]=A.useState(c);let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=[],e[0]=p):p=e[0];const[_,g]=A.useState(p),[m,b]=A.useState(!1),x=A.useRef(null),y=A.useRef(!1);let v,k,S;e[1]!==c?(v=()=>{f(c)},k=[c],e[1]=c,e[2]=v,e[3]=k):(v=e[2],k=e[3]),A.useEffect(v,k),e[4]===Symbol.for("react.memo_cache_sentinel")?(S=()=>{b(!0)},e[4]=S):S=e[4];const E=S;let j;e[5]!==c||e[6]!==l?(j=Q=>{var ce;(ce=Q.relatedTarget)!=null&&ce.closest(".filename-input")||(b(!1),l&&f(c))},e[5]=c,e[6]=l,e[7]=j):j=e[7];const I=j;let T;e[8]!==u?(T=$n.dirname(u||""),e[8]=u,e[9]=T):T=e[9];const M=T,L=$n.basename(u||""),B=_.filter(Q=>$n.basename(Q.path).startsWith(L));let O,z;e[10]!==M||e[11]!==m?(O=async()=>{if(!m)return void g([]);const Q=await Q3({path:M});g(Q.files)},z=[M,m],e[10]=M,e[11]=m,e[12]=O,e[13]=z):(O=e[12],z=e[13]);const{loading:F}=Xn(O,z),V=function(Q,ce,he){if(Q&&!Q.endsWith("/")&&((Jf("markdown")?new Set(["py","md","markdown","qmd"]):new Set(["py"])).has($n.extension(Q))||(Q=Q.endsWith(".")?`${Q}py`:Q.endsWith(".p")?`${Q}y`:`${Q}.py`),!ce.some(de=>de.path===Q||$n.basename(de.path)===Q)&&!(he&&(he===Q||$n.basename(he)===Q))))return Q}(u,_,c),P=(V||B.length>0)&&h.jsxs(cp,{className:"font-mono",children:[!F&&h.jsx(dc,{children:"No files"}),V&&h.jsxs(po,{variant:"success",className:"py-2 px-3",onSelect:()=>{var Q;V&&(y.current=!0,i(V),(Q=x.current)==null||Q.blur())},children:[h.jsx(mm,{className:"w-4 h-4 mr-2"})," ",h.jsxs("span",{className:"text-sm",children:[c?"Rename to: ":"Save as: ",h.jsx("span",{className:"font-medium text-sm",children:$n.basename(V)})]})]},"_rename_"),B.map(Q=>{const ce=Q.isDirectory?"directory":X3(Q.path),he=Z3[ce];return h.jsxs(po,{variant:Q.isDirectory?"default":"muted",className:"py-2 px-3",onSelect:()=>{Q.isDirectory?f(`${Q.path}/`):f(Q.path)},children:[h.jsx(he,{className:"w-4 h-4 mr-2"})," ",$n.basename(Q.path)]},Q.path)})]}),C=10*Math.max(20,(u==null?void 0:u.length)||(o==null?void 0:o.length)||0),$=m?u||"":c||"";let N,H,G;e[14]!==d||e[15]!==C?(N=d?{maxWidth:C}:void 0,e[14]=d,e[15]=C,e[16]=N):N=e[16],e[17]!==a?(H=Oe(a,"w-full px-4 py-1 my-1 h-9 font-mono text-foreground/60"),e[17]=a,e[18]=H):H=e[18],e[19]!==o||e[20]!==$||e[21]!==N||e[22]!==H?(G=h.jsx(Cz,{children:h.jsx(Qi,{"data-testid":"dir-completion-input",tabIndex:-1,rootClassName:"border-none justify-center px-1",spellCheck:"false",value:$,onKeyDown:uN,icon:null,ref:x,onValueChange:f,placeholder:o,autoComplete:"off",style:N,className:H})}),e[19]=o,e[20]=$,e[21]=N,e[22]=H,e[23]=G):G=e[23];const Z=P&&"group-focus-within:block";let q,re,ne,oe,Y;return e[24]!==Z?(q=Oe("p-0 w-full min-w-80 max-w-80vw hidden",Z),e[24]=Z,e[25]=q):q=e[25],e[26]!==P||e[27]!==q?(re=h.jsx(Vs,{side:"bottom",className:q,portal:!1,children:P}),e[26]=P,e[27]=q,e[28]=re):re=e[28],e[29]!==G||e[30]!==re?(ne=h.jsxs(cp,{children:[G,re]}),e[29]=G,e[30]=re,e[31]=ne):ne=e[31],e[32]!==I||e[33]!==ne?(oe=h.jsx(xc,{onFocus:E,onBlur:I,shouldFilter:!1,id:"filename-input",className:"bg-transparent group filename-input",children:ne}),e[32]=I,e[33]=ne,e[34]=oe):oe=e[34],e[35]!==m||e[36]!==oe?(Y=h.jsx(wc,{children:h.jsx(Pr,{open:m,modal:!1,children:oe})}),e[35]=m,e[36]=oe,e[37]=Y):Y=e[37],Y};function uN(t){t.key==="Escape"&&t.currentTarget.blur()}function hN(t){return JSON.stringify(t)}const gd=Zt(void 0),Pg=Zt(t=>{const e=t(gd);return function(n,o,r){if(!r)return!1;const{cellIds:s,cellData:i}=n,a=s.inOrderIds.map(u=>i[u]),l=a.map(u=>u.code),c=a.map(u=>u.config),d=a.map(u=>u.name);return!(e4(l,r.codes)&&e4(d,r.names)&&ra(c,r.configs)&&ra(o.selectedLayout,r.layout.selectedLayout)&&ra(o.layoutData,r.layout.layoutData))}(t(xp),t(wS),e)}),fN=t=>{const e=X.c(35),n=mc(),o=()=>{oa(new Blob([s()],{type:"text/plain"}),`${t.proposedName}.json`)};let r;e[0]!==n?(r=()=>{const E=fo(),j=wp(E);return JSON.stringify({filename:n,cells:j.map(mN)},null,2)},e[0]=n,e[1]=r):r=e[1];const s=Qe(r);let i,a,l,c,d,u,f,p,_,g,m,b,x,y,v,k,S;return e[2]!==o||e[3]!==t?(i=E=>{E.preventDefault(),o(),t.closeModal()},e[2]=o,e[3]=t,e[4]=i):i=e[4],e[5]!==t?(a=E=>{E.key==="Escape"&&t.closeModal()},e[5]=t,e[6]=a):a=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx(dr,{className:"text-accent-foreground mb-6",children:"Download unsaved changes?"}),e[7]=l):l=e[7],e[8]===Symbol.for("react.memo_cache_sentinel")?(c={wordBreak:"break-word"},e[8]=c):c=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsx("p",{children:"This app has unsaved changes. To recover:"}),u={paddingBottom:"10px"},e[9]=d,e[10]=u):(d=e[9],u=e[10]),e[11]!==t.proposedName?(f=h.jsxs("li",{style:u,children:['Click the "Download" button. This will download a file called\xA0',h.jsxs("code",{children:[t.proposedName,".json"]}),". This file contains your code."]}),e[11]=t.proposedName,e[12]=f):f=e[12],e[13]===Symbol.for("react.memo_cache_sentinel")?(p={paddingBottom:"10px"},e[13]=p):p=e[13],e[14]===Symbol.for("react.memo_cache_sentinel")?(_={display:"block",padding:"10px"},e[14]=_):_=e[14],e[15]!==t.proposedName?(g=h.jsxs("code",{style:_,children:["marimo recover ",t.proposedName,".json ",">"," ",t.proposedName,".py"]}),e[15]=t.proposedName,e[16]=g):g=e[16],e[17]!==t.proposedName?(m=h.jsxs("code",{children:[t.proposedName,".py"]}),e[17]=t.proposedName,e[18]=m):m=e[18],e[19]!==g||e[20]!==m?(b=h.jsxs("li",{style:p,children:["In your terminal, type",g,"to overwrite ",m," with the recovered changes."]}),e[19]=g,e[20]=m,e[21]=b):b=e[21],e[22]!==b||e[23]!==f?(x=h.jsx(Ps,{className:"markdown break-words",style:c,children:h.jsxs("div",{className:"prose dark:prose-invert",children:[d,h.jsxs("ol",{children:[f,b]})]})}),e[22]=b,e[23]=f,e[24]=x):x=e[24],e[25]!==t.closeModal?(y=h.jsx(Pe,{"aria-label":"Cancel",variant:"secondary","data-testid":"cancel-recovery-button",onClick:t.closeModal,children:"Cancel"}),e[25]=t.closeModal,e[26]=y):y=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(v=h.jsx(Pe,{"data-testid":"download-recovery-button","aria-label":"Download",variant:"default",type:"submit",children:"Download"}),e[27]=v):v=e[27],e[28]!==y?(k=h.jsxs(ea,{children:[y,v]}),e[28]=y,e[29]=k):k=e[29],e[30]!==i||e[31]!==x||e[32]!==k||e[33]!==a?(S=h.jsx(cr,{className:"w-fit",children:h.jsxs("form",{onSubmit:i,onKeyDown:a,children:[l,x,k]})}),e[30]=i,e[31]=x,e[32]=k,e[33]=a,e[34]=S):S=e[34],S},pN=t=>{const e=X.c(12),{filename:n,needsSave:o}=t,{openModal:r,closeModal:s}=Un();let i;e[0]!==n?(i=n===null?"app":n.slice(0,-3),e[0]=n,e[1]=i):i=e[1];const a=i;let l;e[2]!==s||e[3]!==o||e[4]!==r||e[5]!==a?(l=()=>{o&&r(h.jsx(fN,{proposedName:a,closeModal:s}))},e[2]=s,e[3]=o,e[4]=r,e[5]=a,e[6]=l):l=e[6];const c=l;let d;qt("global.save",c),e[7]===Symbol.for("react.memo_cache_sentinel")?(d=pn("global.save"),e[7]=d):d=e[7];const u=o?"yellow":"gray";let f,p;return e[8]===Symbol.for("react.memo_cache_sentinel")?(f=h.jsx(Na,{strokeWidth:1.5,size:18}),e[8]=f):f=e[8],e[9]!==c||e[10]!==u?(p=h.jsx(Re,{content:d,children:h.jsx(xn,{onClick:c,id:"save-button","aria-label":"Save",className:"rectangle",color:u,children:f})}),e[9]=c,e[10]=u,e[11]=p):p=e[11],p};function mN(t){return{name:t.name,code:t.code}}const _d=5e3;async function gN(){await Iz({download:!1})}async function _N(){await Ez({download:!1,includeCode:!0,files:_S.INSTANCE.filenames()})}async function bN(){await jz({download:!1})}const yN=t=>{const e=X.c(15),{kioskMode:n}=t,o=mc(),r=He(Pg),s=He(mo).state===en.CLOSED,{saveOrNameNotebook:i,saveIfNotebookIsPersistent:a}=Lg();let l,c,d;e[0]!==n||e[1]!==a?(l={onSave:a,kioskMode:n},e[0]=n,e[1]=a,e[2]=l):l=e[2],function(m){const b=X.c(14),x=He(o4),y=vc(),[v]=fn(mo),k=He(Pg);let S,E;if(b[0]!==y){const L=wp(y);S=L.map(SN),E=L.map(kN),b[0]=y,b[1]=S,b[2]=E}else S=b[1],E=b[2];const j=E;let I;b[3]!==y?(I=n4(y),b[3]=y,b[4]=I):I=b[4];const T=I;let M;b[5]!==x||b[6]!==j||b[7]!==S||b[8]!==T||b[9]!==v||b[10]!==k||b[11]!==m.kioskMode||b[12]!==m.onSave?(M={onSave:m.onSave,needsSave:k,codes:S,cellConfigs:T,cellNames:j,connStatus:v,config:x,kioskMode:m.kioskMode},b[5]=x,b[6]=j,b[7]=S,b[8]=T,b[9]=v,b[10]=k,b[11]=m.kioskMode,b[12]=m.onSave,b[13]=M):M=b[13],function(L){const B=X.c(21),{codes:O,cellConfigs:z,config:F,connStatus:V,cellNames:P,needsSave:C,kioskMode:$,onSave:N}=L,H=A.useRef(null);let G;B[0]!==O?(G=O.join(":"),B[0]=O,B[1]=G):G=B[1];const Z=G;let q;B[2]!==z?(q=z.map(hN).join(":"),B[2]=z,B[3]=q):q=B[3];const re=q;let ne;B[4]!==P?(ne=P.join(":"),B[4]=P,B[5]=ne):ne=B[5];const oe=ne;let Y,Q;B[6]!==F||B[7]!==V.state||B[8]!==$||B[9]!==C||B[10]!==N?(Y=()=>{if(!$)return F.autosave==="after_delay"&&(H.current!==null&&clearTimeout(H.current),C&&V.state===en.OPEN&&(H.current=setTimeout(N,F.autosave_delay))),()=>{H.current!==null&&clearTimeout(H.current)}},B[6]=F,B[7]=V.state,B[8]=$,B[9]=C,B[10]=N,B[11]=Y):Y=B[11],B[12]!==re||B[13]!==oe||B[14]!==Z||B[15]!==F||B[16]!==V.state||B[17]!==$||B[18]!==C||B[19]!==N?(Q=[Z,re,oe,F,V.state,N,$,C],B[12]=re,B[13]=oe,B[14]=Z,B[15]=F,B[16]=V.state,B[17]=$,B[18]=C,B[19]=N,B[20]=Q):Q=B[20],A.useEffect(Y,Q)}(M)}(l),function(){const m=X.c(6),b=He(Nz),{state:x}=He(mo),y=b.auto_download.includes("markdown"),v=b.auto_download.includes("html"),k=b.auto_download.includes("ipynb"),S=!y||x!==en.OPEN,E=!v||x!==en.OPEN,j=!k||x!==en.OPEN;let I,T,M;m[0]!==S?(I={delayMs:_d,whenVisible:!0,disabled:S},m[0]=S,m[1]=I):I=m[1],Vc(bN,I),m[2]!==E?(T={delayMs:_d,whenVisible:!0,disabled:E},m[2]=E,m[3]=T):T=m[3],Vc(_N,T),m[4]!==j?(M={delayMs:_d,whenVisible:!0,disabled:j},m[4]=j,m[5]=M):M=m[5],Vc(gN,M)}(),e[3]!==r?(c=m=>{if(r)return m.preventDefault(),m.returnValue="You have unsaved changes. Are you sure you want to leave?",m.returnValue},e[3]=r,e[4]=c):c=e[4],rp(window,"beforeunload",c),e[5]!==i?(d=m=>{m.preventDefault(),m.stopPropagation(),i()},e[5]=i,e[6]=d):d=e[6];const u=d;if(qt("global.save",i),s){let m;return e[7]!==o||e[8]!==r?(m=h.jsx(pN,{filename:o,needsSave:r}),e[7]=o,e[8]=r,e[9]=m):m=e[9],m}let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=pn("global.save"),e[10]=f):f=e[10];const p=r?"yellow":"hint-green";let _,g;return e[11]===Symbol.for("react.memo_cache_sentinel")?(_=h.jsx(Na,{strokeWidth:1.5,size:18}),e[11]=_):_=e[11],e[12]!==u||e[13]!==p?(g=h.jsx(Re,{content:f,children:h.jsx(xn,{"data-testid":"save-button",id:"save-button",shape:"rectangle",color:p,onClick:u,children:_})}),e[12]=u,e[13]=p,e[14]=g):g=e[14],g};function Lg(){const t=X.c(19),{openModal:e,closeModal:n,openAlert:o}=Un(),r=Qt(gd),s=t4(),i=Az();let a;t[0]!==o||t[1]!==r||t[2]!==i?(a=(m,b)=>{const x=fo(),y=wp(x),v=y.map(vN),k=y.map(wN),S=y.map(xN),E=n4(x),j=i.get(mo),I=i.get(o4),T=i.get(wS);i.get(Ms)||k.length!==0&&(j.state===en.OPEN?(Xt.log("saving to ",m),Tz({cellIds:v,codes:k,names:S,filename:m,configs:E,layout:C$(),persist:!0}).then(()=>{b&&I.format_on_save&&r4(),r({names:S,codes:k,configs:E,layout:T})})):o("Failed to save notebook: not connected to a kernel."))},t[0]=o,t[1]=r,t[2]=i,t[3]=a):a=t[3];const l=Qe(a);let c;t[4]!==l||t[5]!==i?(c=m=>{const b=m!==void 0&&m,x=i.get(s4),y=i.get(mo);Fg(x)&&y.state===en.OPEN&&l(x,b)},t[4]=l,t[5]=i,t[6]=c):c=t[6];const d=Qe(c);let u;t[7]!==l||t[8]!==s?(u=m=>{s(m).then(b=>{b!==null&&l(b,!0)})},t[7]=l,t[8]=s,t[9]=u):u=t[9];const f=u;let p;t[10]!==n||t[11]!==f||t[12]!==e||t[13]!==d||t[14]!==i?(p=()=>{const m=i.get(s4),b=i.get(mo);d(!0),Fg(m)||b.state===en.CLOSED||e(h.jsx(CN,{onClose:n,onSave:f}))},t[10]=n,t[11]=f,t[12]=e,t[13]=d,t[14]=i,t[15]=p):p=t[15];const _=Qe(p);let g;return t[16]!==d||t[17]!==_?(g={saveOrNameNotebook:_,saveIfNotebookIsPersistent:d},t[16]=d,t[17]=_,t[18]=g):g=t[18],g}function xN(t){return t.name}function wN(t){return t.code}function vN(t){return t.id}function Fg(t){return t!==null&&!t.startsWith("/tmp")&&!t.startsWith("/var/folders")&&!t.includes("AppData\\Local\\Temp")}function kN(t){return t.name}function SN(t){return t.code}const CN=t=>{const e=X.c(17),{onClose:n,onSave:o}=t,[r,s]=A.useState();let i;e[0]!==n||e[1]!==o?(i=m=>{s(m),m.trim()&&(o(m),n())},e[0]=n,e[1]=o,e[2]=i):i=e[2];const a=i;let l,c,d,u;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx(dr,{children:"Save notebook"}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(Rr,{className:"text-md pt-6 px-1",children:"Save as"}),e[4]=c):c=e[4],e[5]!==a?(d=h.jsxs("div",{className:"flex flex-col",children:[c,h.jsx(Rg,{onNameChange:a,placeholderText:"filename",className:"missing-filename"})]}),e[5]=a,e[6]=d):d=e[6],e[7]!==n?(u=h.jsx(Pe,{"data-testid":"cancel-save-dialog-button","aria-label":"Cancel",variant:"secondary",onClick:n,children:"Cancel"}),e[7]=n,e[8]=u):u=e[8];const f=!r;let p,_,g;return e[9]!==f?(p=h.jsx(Pe,{"data-testid":"submit-save-dialog-button","aria-label":"Save",variant:"default",disabled:f,type:"submit",children:"Save"}),e[9]=f,e[10]=p):p=e[10],e[11]!==u||e[12]!==p?(_=h.jsxs(ea,{children:[u,p]}),e[11]=u,e[12]=p,e[13]=_):_=e[13],e[14]!==d||e[15]!==_?(g=h.jsxs(cr,{children:[l,d,_]}),e[14]=d,e[15]=_,e[16]=g):g=e[16],g},NN=t=>{const e=X.c(40),{presenting:n,onTogglePresenting:o,onInterrupt:r,onRun:s,closed:i,running:a,appConfig:l}=t,c=l.width,d=He(G3),u=He(Mz),{undoDeleteCell:f}=Lt();let p,_,g=null;if(!i&&d){let O,z;e[0]===Symbol.for("react.memo_cache_sentinel")?(O=h.jsx(nd,{size:16,strokeWidth:1.5}),e[0]=O):O=e[0],e[1]!==f?(z=h.jsx(Re,{content:"Undo cell deletion",children:h.jsx(xn,{"data-testid":"undo-delete-cell",size:"medium",color:"hint-green",shape:"circle",onClick:f,children:O})}),e[1]=f,e[2]=z):z=e[2],g=z}e[3]!==n?(p=!n&&h.jsx(oN,{}),e[3]=n,e[4]=p):p=e[4],e[5]!==i||e[6]!==n?(_=!i&&h.jsxs("div",{className:IN,children:[n&&h.jsx(MS,{}),h.jsx(GC,{}),h.jsx(h$,{}),h.jsx(f$,{description:"This will terminate the Python kernel. You'll lose all data that's in memory."})]}),e[5]=i,e[6]=n,e[7]=_):_=e[7];const m=c==="compact"&&"xl:flex-row items-end";let b,x,y,v,k,S,E,j,I,T,M,L,B;return e[8]!==m?(b=Oe(AN,m),e[8]=m,e[9]=b):b=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(x=h.jsx(ri,{children:h.jsx(yN,{kioskMode:!1})}),e[10]=x):x=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(y=pn("global.hideCode"),e[11]=y):y=e[11],e[12]!==n?(v=n?h.jsx(Y3,{strokeWidth:1.5,size:18}):h.jsx(Kc,{strokeWidth:1.5,size:18}),e[12]=n,e[13]=v):v=e[13],e[14]!==o||e[15]!==v?(k=h.jsx(Re,{content:y,children:h.jsx(xn,{"data-testid":"hide-code-button",id:"preview-button",shape:"rectangle",color:"hint-green",onClick:o,children:v})}),e[14]=o,e[15]=v,e[16]=k):k=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(j=h.jsx(lN,{}),S=h.jsx(p$,{}),E=h.jsx("div",{}),e[17]=S,e[18]=E,e[19]=j):(S=e[17],E=e[18],j=e[19]),e[20]!==i||e[21]!==r||e[22]!==a?(I=!i&&h.jsx(EN,{running:a,onInterrupt:r}),e[20]=i,e[21]=r,e[22]=a,e[23]=I):I=e[23],e[24]!==i||e[25]!==u||e[26]!==s?(T=!i&&h.jsx(jN,{needsRun:u,onRun:s}),e[24]=i,e[25]=u,e[26]=s,e[27]=T):T=e[27],e[28]!==I||e[29]!==T||e[30]!==g?(M=h.jsx(ri,{children:h.jsxs("div",{className:"flex flex-col gap-2 items-center",children:[g,I,T]})}),e[28]=I,e[29]=T,e[30]=g,e[31]=M):M=e[31],e[32]!==M||e[33]!==b||e[34]!==k?(L=h.jsxs("div",{className:b,children:[x,k,j,S,E,M]}),e[32]=M,e[33]=b,e[34]=k,e[35]=L):L=e[35],e[36]!==p||e[37]!==L||e[38]!==_?(B=h.jsxs(h.Fragment,{children:[p,_,L]}),e[36]=p,e[37]=L,e[38]=_,e[39]=B):B=e[39],B},jN=t=>{const e=X.c(5),{needsRun:n,onRun:o}=t;if(n){let s,i,a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=pn("global.runStale"),e[0]=s):s=e[0],e[1]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsx(Qs,{strokeWidth:1.5,size:16}),e[1]=i):i=e[1],e[2]!==o?(a=h.jsx(Re,{content:s,children:h.jsx(xn,{"data-testid":"run-button",size:"medium",color:"yellow",shape:"circle",onClick:o,children:i})}),e[2]=o,e[3]=a):a=e[3],a}let r;return e[4]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(Re,{content:"Nothing to run",children:h.jsx(xn,{"data-testid":"run-button",className:"inactive-button",color:"disabled",size:"medium",shape:"circle",children:h.jsx(Qs,{strokeWidth:1.5,size:16})})}),e[4]=r):r=e[4],r},EN=t=>{const e=X.c(8),{running:n,onInterrupt:o}=t,r=Dg(n);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=pn("global.interrupt"),e[0]=s):s=e[0];const i=!r&&"inactive-button active:shadow-xsSolid";let a;e[1]!==i?(a=Oe(i),e[1]=i,e[2]=a):a=e[2];const l=r?"yellow":"disabled",c=r?o:jn.NOOP;let d,u;return e[3]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsx(Qf,{strokeWidth:1.5,size:16}),e[3]=d):d=e[3],e[4]!==a||e[5]!==l||e[6]!==c?(u=h.jsx(Re,{content:s,children:h.jsx(xn,{className:a,"data-testid":"interrupt-button",size:"medium",color:l,shape:"circle",onClick:c,children:d})}),e[4]=a,e[5]=l,e[6]=c,e[7]=u):u=e[7],u},IN="absolute top-3 right-5 m-0 flex items-center space-x-3 min-h-[28px] no-print pointer-events-auto z-30 print:hidden",AN="absolute bottom-5 right-5 flex flex-col gap-2 items-center no-print pointer-events-auto z-30 print:hidden",TN=t=>{const e=X.c(7),{filename:n}=t,o=t4();let r;e[0]!==n?(r=n?$n.basename(n):"untitled marimo app",e[0]=n,e[1]=r):r=e[1];const s=n===null?"missing-filename":"filename";let i;return e[2]!==n||e[3]!==o||e[4]!==r||e[5]!==s?(i=h.jsx(Rg,{placeholderText:r,initialValue:n,onNameChange:o,flexibleWidth:!0,resetOnBlur:!0,"data-testid":"filename-input",className:s}),e[2]=n,e[3]=o,e[4]=r,e[5]=s,e[6]=i):i=e[6],i},MN=Oz(Dz,400),ON=(t,e)=>{ut.get(Ms)||t.isEmpty()||e.isEmpty()||ra(t.inOrderIds,e.inOrderIds)||MN({cell_ids:t.inOrderIds})};function DN(t){return[Hn.of([{key:"Escape",preventDefault:!1,run:JC},{key:t.getHotkey("cell.selectNextOccurrence").key,preventDefault:!0,run:Pz},{key:t.getHotkey("cell.findAndReplace").key,preventDefault:!0,run:Ag}]),Rz(),tN,Pa,nN]}const Ur={showInput:"Mod-l",acceptEdit:"Mod-y",rejectEdit:"Mod-u"},si=$s.define({combine:t=>kc(t,{onError:console.error,inputDebounceTime:300,keymaps:Ur},{onError:(e,n)=>e&&n,inputDebounceTime:(e,n)=>e&&n,keymaps:(e,n)=>e&&n})}),kr=Ut.define(),Sr=En.define({create:()=>({show:!1,lineFrom:0,lineTo:0}),update(t,e){for(const n of e.effects)if(n.is(kr))return n.value;return t}}),ii=Ut.define(),ai=Ut.define(),zg=En.define({create:()=>({shouldFocus:!1,inputValue:""}),update(t,e){let n=t;for(const o of e.effects)o.is(ii)&&(n={...n,inputValue:o.value}),o.is(ai)&&(n={...n,shouldFocus:o.value});return n}}),La=Ut.define(),li=En.define({create:()=>null,update(t,e){for(const n of e.effects)if(n.is(La))return n.value;return t}}),Vr=Ut.define(),Bg=En.define({create:()=>!1,update(t,e){for(const n of e.effects)if(n.is(Vr))return n.value;return t}}),Ug=t=>{const{state:e}=t,n=e.selection.main;if(n.empty)return!1;const o=e.doc,r=o.lineAt(n.from),s=o.lineAt(n.to);if(e.sliceDoc(r.from,s.to).trim().length<1)return!1;const i=Math.max(1,Math.min(r.number,o.lines)),a=Math.max(1,Math.min(s.number,o.lines));return t.dispatch({effects:[kr.of({show:!0,lineFrom:i,lineTo:a}),ai.of(!0),ii.of("")],selection:Uo.cursor(r.from)}),!0},Vg=t=>!!t.state.field(li)&&(t.dispatch({effects:[La.of(null),kr.of({show:!1,lineFrom:0,lineTo:0}),ai.of(!1),ii.of(""),Vr.of(!1)]}),!0),$g=t=>{const e=t.state.field(li);return!!e&&(t.dispatch({changes:{from:e.from,to:e.to,insert:e.oldCode},effects:[La.of(null),kr.of({show:!1,lineFrom:0,lineTo:0}),ai.of(!1),ii.of(""),Vr.of(!1)]}),!0)},RN=st.baseTheme({".cm-ai-input-container":{display:"flex",flexDirection:"column",gap:"4px",width:"min(calc(100% + 7px), 500px)",padding:"5px 5px",margin:"0 -6px",backgroundColor:"light-dark(rgb(241, 243, 245), rgb(40, 40, 40))"},".cm-ai-input":{display:"block",width:"100%",padding:"3px 8px",border:"2px solid rgb(51, 154, 240)",borderRadius:"5px",fontSize:"12px"},".cm-ai-help-info-button":{fontSize:"10px",paddingLeft:"10px",height:"18px",color:"light-dark(rgb(109, 117, 125), rgb(170, 170, 170))",display:"block",marginRight:"auto"},".cm-ai-help-info-button:hover":{color:"light-dark(rgb(89, 97, 105), rgb(190, 190, 190))"},".cm-ai-generate-button":{background:"#0E639C",border:"none",padding:"2px 6px",color:"#ffffff",cursor:"pointer",font:"inherit",borderRadius:"4px","&:hover":{backgroundColor:"#1177bb"}},".cm-line.cm-ai-selection, .cm-line.cm-ai-selection.cm-active-line":{backgroundColor:"light-dark(color-mix(in srgb, rgb(223, 227, 232) 50%, transparent), color-mix(in srgb, rgb(50, 50, 50) 50%, transparent)) !important"},".cm-line:has(.cm-new-code-line)":{backgroundColor:"light-dark(color-mix(in srgb, rgb(183, 235, 143) 50%, transparent), color-mix(in srgb, rgb(40, 100, 40) 50%, transparent)) !important"},".cm-old-code-container":{backgroundColor:"light-dark(rgb(255, 205, 205), rgb(100, 40, 40))",position:"relative",display:"flex",paddingTop:"0",width:"100%",alignItems:"center"},".cm-code-button":{position:"absolute",right:"5px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:"pointer",fontSize:"16px"},".cm-floating-buttons":{fontFamily:"sans-serif",position:"absolute",top:"-20px",left:"5px",display:"flex"},".cm-floating-button":{fontFamily:"sans-serif",padding:"2px 5px",fontSize:"10px",cursor:"pointer",fontWeight:"700"},".cm-floating-accept":{backgroundColor:"light-dark(rgb(55, 125, 34), rgb(40, 80, 25))",borderTopLeftRadius:"5px",borderBottomLeftRadius:"5px",color:"white",filter:"brightness(90%)","&:hover":{filter:"brightness(100%)"}},".cm-floating-reject":{backgroundColor:"light-dark(rgb(220, 53, 69), rgb(180, 40, 50))",color:"white",borderTopRightRadius:"5px",borderBottomRightRadius:"5px",filter:"brightness(90%)","&:hover":{filter:"brightness(100%)"}},".hotkey":{display:"inline-block",padding:"0 4px",borderRadius:"3px",backgroundColor:"rgba(255, 255, 255, 0.1)",fontSize:"90%"},".cm-ai-loading-indicator":{fontStyle:"italic",fontSize:"10px",paddingLeft:"12px",color:"light-dark(rgb(109, 117, 125), rgb(170, 170, 170))",opacity:"0",transition:"opacity 0.3s ease-in-out","&::after":{content:'""',display:"inline-block",animation:"ellipsis-pulse 1.5s steps(4, end) infinite"},"&:not(:empty)":{opacity:"1"}},".cm-ai-input:disabled":{opacity:"0.5"},"@keyframes ellipsis-pulse":{"0%":{content:"'.'"},"25%":{content:"'..'"},"50%":{content:"'...'"},"75%":{content:"''"}},".cm-ai-loading-container":{display:"flex",alignItems:"center",padding:"0 8px"},".cm-ai-cancel-button":{padding:"2px 8px",fontSize:"10px",borderRadius:"4px",color:"light-dark(rgb(109, 117, 125), rgb(170, 170, 170))",cursor:"pointer","&:hover":{background:"light-dark(rgb(223, 227, 232), rgb(50, 50, 50))"}},".hidden":{display:"none"}}),PN="\u2318",LN="\u229E Win",FN="Ctrl";function bd(t){return t.replace("Mod",navigator.platform.startsWith("Mac")?PN:navigator.platform.startsWith("Win")?LN:FN).replace("-"," ").toUpperCase()}function ln(t,e){const n=document.createElement(t);return n.className=e,n}function zN(t){var r,s;const e=t.state.facet(si),n={...Ur,...e.keymaps},o=ln("div","cm-ai-tooltip").appendChild(ln("div","cm-ai-tooltip-button"));return o.innerHTML=`<span>Edit <span class="hotkey">${bd(n.showInput)}</span></span>`,(r=o.querySelector("span"))==null||r.addEventListener("mousedown",i=>{i.stopPropagation()}),(s=o.querySelector("span"))==null||s.addEventListener("click",i=>{i.preventDefault(),Ug(t)}),o}const BN=$s.define({combine:t=>kc(t,{render:zN})}),UN=Zn.fromClass((g3=class{constructor(t){ee(this,"view");ee(this,"suppress");ee(this,"dom");ee(this,"mousedown",()=>{this.suppress=!0});ee(this,"mouseup",()=>{this.suppress=!1,this.display(this.view)});y3(this,Ql,t=>{var n;const e=t.state.selection.ranges.find(o=>!o.empty);if(e&&!this.suppress){const o=t.coordsAtPos(e.from);if(!o)return;this.dom.style.display="flex";const r=this.dom.getBoundingClientRect(),s=t.dom.getBoundingClientRect(),i=(n=t.dom.parentElement)==null?void 0:n.getBoundingClientRect(),a=s.width-r.width,l=Math.min(o.left,a);let c=o.top-r.height;c=i?Math.max(i.y,c):c,this.dom.style.left=`${l}px`,this.dom.style.top=`${c}px`,requestAnimationFrame(()=>{this.dom&&(this.dom.ariaHidden="false")})}else this.dom.style.display="none",this.dom.ariaHidden="true"});this.view=t;const e=t.state.facet(BN);this.suppress=!1,document.addEventListener("mousedown",this.mousedown),document.addEventListener("mouseup",this.mouseup);const n=e.render(t);t.dom.appendChild(n),this.dom=n}update(t){this.display(t.view)}docViewUpdate(t){this.display(t)}display(t){t.state.field(Sr).show?this.dom.style.display="none":t.requestMeasure({read:b3(this,Ql)})}destroy(){document.removeEventListener("mousedown",this.mousedown),document.removeEventListener("mouseup",this.mouseup),this.dom.remove()}},Ql=new WeakMap,g3)),VN=st.baseTheme({".cm-ai-tooltip-button":{userSelect:"none",fontFamily:"system-ui, -apple-system, sans-serif",position:"fixed",display:"flex",boxSizing:"border-box",padding:"2px 6px",borderRadius:"4px",fontSize:"12px",backgroundColor:"#0E639C",color:"#ffffff",border:"1px solid transparent",boxShadow:"0 2px 4px rgba(0,0,0,0.1)",zIndex:"999",transition:"opacity 0.5s","&[aria-hidden='true']":{opacity:"0"},"&[aria-hidden='false']":{opacity:"1"},"& > span":{pointerEvents:"auto",cursor:"pointer",display:"inline-block",padding:"2px"},"&:hover":{backgroundColor:"#1177bb"}}});class $N extends Hs{constructor(n){super();ee(this,"oldCode");this.oldCode=n}toDOM(n){const o=ln("div","cm-old-code-container");o.setAttribute("role","region"),o.setAttribute("aria-label","Previous code version");const r=ln("div","cm-old-code cm-line");r.textContent=this.oldCode;const s=ln("div","cm-floating-buttons"),i=n.state.facet(si),a={...Ur,...i.keymaps},l=ln("button","cm-floating-button cm-floating-accept");l.innerHTML=`<span class="hotkey">${bd(a.acceptEdit)}</span> Accept`,l.setAttribute("aria-label","Accept changes"),l.addEventListener("click",d=>{d.preventDefault(),d.stopPropagation(),n.focus(),Vg(n)});const c=ln("button","cm-floating-button cm-floating-reject");return c.innerHTML=`<span class="hotkey">${bd(a.rejectEdit)}</span> Reject`,c.setAttribute("aria-label","Reject changes"),c.addEventListener("click",d=>{d.preventDefault(),d.stopPropagation(),n.focus(),$g(n)}),s.append(l,c),o.append(r,s),o}updateDOM(n,o){return!0}}class HN extends Hs{constructor(n){super();ee(this,"complete");ee(this,"abortController",null);ee(this,"dom",null);ee(this,"input",null);ee(this,"loadingContainer",null);ee(this,"helpInfo",null);ee(this,"inputContainer",null);ee(this,"form",null);ee(this,"view",null);ee(this,"onKeyDown",async n=>{n.key!=="Enter"||n.shiftKey?n.key==="Escape"&&this.onCancel():(n.preventDefault(),await this.handleSubmit())});ee(this,"onCancel",()=>{this.cleanup();const n=this.view;n&&(n.dispatch({effects:[kr.of({show:!1,lineFrom:0,lineTo:0}),Vr.of(!1)]}),n.focus())});ee(this,"handleSubmit",async n=>{var g;const o=this.view;if(!o)return;const r=o.state.facet(si);n==null||n.stopPropagation();const s=o.state.field(Sr),{input:i}=this;if(!i)return;const a=i.value.trim();if(!s.show||!a)return;const l=o.state.doc.line(s.lineFrom),c=o.state.doc.line(s.lineTo),d=l.from,u=c.to,f=o.state.sliceDoc(d,u),p=o.state.sliceDoc(0,d),_=o.state.sliceDoc(u);this.abortController=new AbortController,o.dispatch({effects:Vr.of(!0)}),this.toggleLoading(!0);try{const m=await this.complete({prompt:a,selection:f,codeBefore:p,codeAfter:_,editorView:o,signal:this.abortController.signal});if(!o.state.field(Sr).show)return;if(!m||typeof m!="string")throw new Error("Invalid completion result");o.dispatch({changes:{from:d,to:u,insert:m},effects:[kr.of({show:!1,lineFrom:0,lineTo:0}),La.of({from:d,to:d+m.length,oldCode:f,newCode:m}),Vr.of(!1)]})}catch(m){if(m instanceof DOMException&&m.name==="AbortError")return;(g=r.onError)==null||g.call(r,m)}finally{this.cleanup(),this.toggleLoading(!1),o.focus()}});this.complete=n}toDOM(n){if(this.dom)return this.dom;this.view=n;const o=n.state.field(zg),r=n.state.field(Bg),s=ln("div","cm-ai-input-container");this.inputContainer=s,this.dom=s;const i=ln("form","cm-ai-input-form");this.form=i,i.setAttribute("role","search"),i.setAttribute("aria-label","AI editing instructions"),i.addEventListener("submit",m=>m.preventDefault());const a=ln("input","cm-ai-input");this.input=a,i.append(a),a.placeholder="Editing instructions...",a.setAttribute("aria-label","AI editing instructions"),a.setAttribute("autocomplete","off"),a.setAttribute("spellcheck","true"),a.value=o.inputValue;const l=ln("div","cm-ai-loading-container");this.loadingContainer=l;const c=ln("div","cm-ai-loading-indicator");c.setAttribute("role","status"),c.setAttribute("aria-live","polite"),c.textContent="Generating";const d=ln("button","cm-ai-cancel-button");d.textContent="Cancel",d.setAttribute("aria-label","Cancel code generation"),d.addEventListener("click",this.onCancel),l.append(d,c);const u=ln("div","cm-ai-help-info");this.helpInfo=u;const f=u.appendChild(document.createElement("button"));f.className="cm-ai-help-info-button",f.textContent="Esc to close",f.addEventListener("click",this.onCancel);const p=ln("button","cm-ai-generate-button");function _(m){u.replaceChildren(m?p:f)}p.textContent="\u23CE Generate",p.setAttribute("aria-label","Generate code"),p.addEventListener("click",this.handleSubmit),this.toggleLoading(r),o.shouldFocus&&requestAnimationFrame(()=>{a.value=o.inputValue,a.focus(),n.dispatch({effects:ai.of(!1)})}),_(a.value),a.addEventListener("input",function(){n.dispatch({effects:ii.of(a.value)});const m=a.value.trim();m!==g&&(g=m,_(m))}),a.addEventListener("keydown",this.onKeyDown);let g="";return s}toggleLoading(n){var o;this.inputContainer&&this.form&&this.loadingContainer&&this.helpInfo&&((o=this.inputContainer)==null||o.replaceChildren(this.form,n?this.loadingContainer:this.helpInfo))}updateDOM(n,o){return this.dom=n,this.input=n.querySelector(".cm-ai-input"),!0}cleanup(){var n,o,r;(n=this.abortController)==null||n.abort(),this.abortController=null,(o=this.dom)==null||o.remove(),(r=this.input)==null||r.remove(),this.dom=null,this.input=null}destroy(){this.cleanup()}}function WN(t){if(!t.prompt)throw new Error("prompt function is required");return[si.of(t),Sr,zg,li,Bg,[UN,VN],RN,Hn.of([{key:Ur.showInput,run:Ug}]),Vo.highest([Hn.of([{key:Ur.acceptEdit,run:Vg},{key:Ur.rejectEdit,run:$g}])]),qN,GN,YN,JN]}const qN=st.updateListener.of(t=>{const e=t.state.field(Sr);if(!e.show||!t.docChanged)return;let{lineFrom:n,lineTo:o}=e,r=!1;t.changes.iterChanges((s,i,a,l)=>{const c=t.state.doc.lineAt(s).number;if(c<n){const d=t.state.doc.lineAt(l).number-t.state.doc.lineAt(a).number;n+=d,o+=d,r=!0}else if(c<=o){const d=t.state.doc.lineAt(l).number-t.state.doc.lineAt(a).number;o+=d,r=!0}}),r&&t.view.dispatch({effects:[kr.of({show:!0,lineFrom:n,lineTo:o})]})}),GN=st.decorations.of(t=>{const e=t.state.field(li);return e?dt.set([dt.mark({class:"cm-new-code-line"}).range(e.from,e.to)]):dt.none}),YN=st.decorations.compute([Sr],t=>{const e=t.field(Sr),n=t.facet(si),o=[];if(e.show){const r=e.lineFrom,s=e.lineTo;for(let i=r;i<=s;i++){const a=t.doc.line(i).from;o.push(dt.line({class:"cm-ai-selection"}).range(a)),i===r&&o.push(dt.widget({widget:new HN(n.prompt),side:-1}).range(a))}}return dt.set(o)}),JN=En.define({create:t=>dt.none,update(t,e){const n=e.state.field(li);return n?dt.set([dt.widget({widget:new $N(n.oldCode),block:!0}).range(n.from)]):dt.none},provide:t=>st.decorations.from(t)}),Fa=En.define({create:()=>({suggestion:null}),update(t,e){const n=e.effects.find(o=>o.is(za));return e.docChanged||n||e.selection?n&&e.state.doc===n.value.doc?{suggestion:n.value.text}:{suggestion:null}:t}}),za=Ut.define();class KN extends Hs{constructor(n){super();ee(this,"suggestion");this.suggestion=n}toDOM(){const n=document.createElement("span");return n.style.opacity="0.4",n.className="cm-inline-suggestion",n.textContent=this.suggestion,n.setAttribute("role","suggestion"),n.setAttribute("aria-label",`Suggestion: ${this.suggestion}`),n}get lineBreaks(){return this.suggestion.split(`
99
+ `).length-1}}class XN{constructor(e){ee(this,"cache",new Map);ee(this,"timeout");this.timeout=e}get(e){const n=this.cache.get(e);return n?Date.now()-n.timestamp>this.timeout?(this.cache.delete(e),null):n.result:null}set(e,n){this.cache.set(e,{result:n,timestamp:Date.now()})}}const ZN=(t,e)=>Zn.fromClass(class{constructor(){ee(this,"abortController",null);ee(this,"cache");this.cache=new XN(e.cacheTimeout??1e3)}async update(n){var i,a,l,c,d;if(!n.docChanged||((a=(i=e.events)==null?void 0:i.beforeSuggestionFetch)==null?void 0:a.call(i,n.view))===!1)return;(l=this.abortController)==null||l.abort(),this.abortController=new AbortController;const o=n.state.doc,r=o.toString(),s=this.cache.get(r);if(s)n.view.dispatch({effects:za.of({text:s,doc:o})});else try{const u=await t(n.state,this.abortController.signal);if(this.abortController.signal.aborted||((d=(c=e.events)==null?void 0:c.shouldShowSuggestion)==null?void 0:d.call(c,n.view,u))===!1)return;this.cache.set(r,u),n.view.dispatch({effects:za.of({text:u,doc:o})})}catch(u){u instanceof Error&&u.name!=="AbortError"&&console.error("Suggestion fetch error:",u)}}destroy(){var n;(n=this.abortController)==null||n.abort()}}),QN=Zn.fromClass(class{constructor(){ee(this,"decorations");this.decorations=dt.none}update(t){var n;const e=(n=t.state.field(Fa))==null?void 0:n.suggestion;this.decorations=e?function(o,r){const s=o.state.selection.main.head,i=[],a=dt.widget({widget:new KN(r),side:1});return i.push(a.range(s)),dt.set(i)}(t.view,e):dt.none}},{decorations:t=>t.decorations});function ej(t,e,n,o){return{...t.changeByRange(r=>{if(r===t.selection.main)return{changes:{from:n,to:o,insert:e},range:Uo.cursor(n+e.length)};const s=o-n;return!r.empty||s&&t.sliceDoc(r.from-s,r.from)!==t.sliceDoc(n,o)?{range:r}:{changes:{from:r.from-s,to:r.from,insert:e},range:Uo.cursor(r.from-s+e.length)}}),userEvent:"input.complete"}}const Hg=t=>{var o,r,s;const e=(o=t.state.field(Fa))==null?void 0:o.suggestion;if(!e)return!1;const n=t.state.facet(yd);return t.dispatch({effects:za.of({text:null,doc:t.state.doc})}),(s=(r=n.events)==null?void 0:r.onSuggestionRejected)==null||s.call(r,t,e),!0},tj=Hn.of([{key:"Tab",run:t=>{var o,r,s;const e=(o=t.state.field(Fa))==null?void 0:o.suggestion;if(!e)return!1;const n=t.state.facet(yd);return t.dispatch({...ej(t.state,e,t.state.selection.main.head,t.state.selection.main.head)}),(s=(r=n.events)==null?void 0:r.onSuggestionAccepted)==null||s.call(r,t,e),!0}},{key:"Escape",run:Hg}]),yd=$s.define({combine:t=>t.at(-1)});function Wg(t){const{delay:e=500,includeKeymap:n=!0}=t,o=function(r,s,i){let a=()=>{};return(...l)=>(a(),new Promise((c,d)=>{const u=setTimeout(()=>c(r(...l)),s);a=()=>{clearTimeout(u),i!==void 0&&d(i)}}))}(t.fetchFn,e);return[Fa,yd.of(t),ZN(o,t),QN,n?tj:[]]}const xd=Ut.define(),wd=Ut.define(),vd=Ut.define();function Ct(t,e){if(!t)throw new Error(e)}function Ba(t){if(typeof t!="number")throw new Error("invalid int 32: "+typeof t);if(!Number.isInteger(t)||t>2147483647||t<-2147483648)throw new Error("invalid int 32: "+t)}function kd(t){if(typeof t!="number")throw new Error("invalid uint 32: "+typeof t);if(!Number.isInteger(t)||t>4294967295||t<0)throw new Error("invalid uint 32: "+t)}function qg(t){if(typeof t!="number")throw new Error("invalid float 32: "+typeof t);if(Number.isFinite(t)&&(t>3402823466385289e23||t<-3402823466385289e23))throw new Error("invalid float 32: "+t)}const Gg=Symbol("@bufbuild/protobuf/enum-type");function nj(t){const e=t[Gg];return Ct(e,"missing enum type on enum object"),e}function Yg(t,e,n,o){t[Gg]=Jg(e,n.map(r=>({no:r.no,name:r.name,localName:t[r.no]})))}function Jg(t,e,n){const o=Object.create(null),r=Object.create(null),s=[];for(const i of e){const a=Kg(i);s.push(a),o[i.name]=a,r[i.no]=a}return{typeName:t,values:s,findName:i=>o[i],findNumber:i=>r[i]}}function oj(t,e,n){const o={};for(const r of e){const s=Kg(r);o[s.localName]=s.no,o[s.no]=s.localName}return Yg(o,t,e),o}function Kg(t){return"localName"in t?t:Object.assign(Object.assign({},t),{localName:t.name})}class Ot{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,n){const o=this.getType().runtime.bin,r=o.makeReadOptions(n);return o.readMessage(this,r.readerFactory(e),e.byteLength,r),this}fromJson(e,n){const o=this.getType(),r=o.runtime.json,s=r.makeReadOptions(n);return r.readMessage(o,e,s,this),this}fromJsonString(e,n){let o;try{o=JSON.parse(e)}catch(r){throw new Error(`cannot decode ${this.getType().typeName} from JSON: ${r instanceof Error?r.message:String(r)}`)}return this.fromJson(o,n)}toBinary(e){const n=this.getType().runtime.bin,o=n.makeWriteOptions(e),r=o.writerFactory();return n.writeMessage(this,r,o),r.finish()}toJson(e){const n=this.getType().runtime.json,o=n.makeWriteOptions(e);return n.writeMessage(this,o)}toJsonString(e){var n;const o=this.toJson(e);return JSON.stringify(o,null,(n=e==null?void 0:e.prettySpaces)!==null&&n!==void 0?n:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}}function rj(){let t=0,e=0;for(let o=0;o<28;o+=7){let r=this.buf[this.pos++];if(t|=(127&r)<<o,!(128&r))return this.assertBounds(),[t,e]}let n=this.buf[this.pos++];if(t|=(15&n)<<28,e=(112&n)>>4,!(128&n))return this.assertBounds(),[t,e];for(let o=3;o<=31;o+=7){let r=this.buf[this.pos++];if(e|=(127&r)<<o,!(128&r))return this.assertBounds(),[t,e]}throw new Error("invalid varint")}function Sd(t,e,n){for(let s=0;s<28;s+=7){const i=t>>>s,a=!(!(i>>>7)&&e==0),l=255&(a?128|i:i);if(n.push(l),!a)return}const o=t>>>28&15|(7&e)<<4,r=!!(e>>3);if(n.push(255&(r?128|o:o)),r){for(let s=3;s<31;s+=7){const i=e>>>s,a=!!(i>>>7),l=255&(a?128|i:i);if(n.push(l),!a)return}n.push(e>>>31&1)}}const Ua=4294967296;function Xg(t){const e=t[0]==="-";e&&(t=t.slice(1));const n=1e6;let o=0,r=0;function s(i,a){const l=Number(t.slice(i,a));r*=n,o=o*n+l,o>=Ua&&(r+=o/Ua|0,o%=Ua)}return s(-24,-18),s(-18,-12),s(-12,-6),s(-6),e?Qg(o,r):Cd(o,r)}function Zg(t,e){if({lo:t,hi:e}=function(l,c){return{lo:l>>>0,hi:c>>>0}}(t,e),e<=2097151)return String(Ua*e+t);const n=16777215&(t>>>24|e<<8),o=e>>16&65535;let r=(16777215&t)+6777216*n+6710656*o,s=n+8147497*o,i=2*o;const a=1e7;return r>=a&&(s+=Math.floor(r/a),r%=a),s>=a&&(i+=Math.floor(s/a),s%=a),i.toString()+e_(s)+e_(r)}function Cd(t,e){return{lo:0|t,hi:0|e}}function Qg(t,e){return e=~e,t?t=1+~t:e+=1,Cd(t,e)}const e_=t=>{const e=String(t);return"0000000".slice(e.length)+e};function t_(t,e){if(t>=0){for(;t>127;)e.push(127&t|128),t>>>=7;e.push(t)}else{for(let n=0;n<9;n++)e.push(127&t|128),t>>=7;e.push(1)}}function sj(){let t=this.buf[this.pos++],e=127&t;if(!(128&t))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(127&t)<<7,!(128&t))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(127&t)<<14,!(128&t))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(127&t)<<21,!(128&t))return this.assertBounds(),e;t=this.buf[this.pos++],e|=(15&t)<<28;for(let n=5;128&t&&n<10;n++)t=this.buf[this.pos++];if(128&t)throw new Error("invalid varint");return this.assertBounds(),e>>>0}var ij={};const vt=function(){const t=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof t.getBigInt64=="function"&&typeof t.getBigUint64=="function"&&typeof t.setBigInt64=="function"&&typeof t.setBigUint64=="function"&&(typeof process!="object"||ij.BUF_BIGINT_DISABLE!=="1")){const o=BigInt("-9223372036854775808"),r=BigInt("9223372036854775807"),s=BigInt("0"),i=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(a){const l=typeof a=="bigint"?a:BigInt(a);if(l>r||l<o)throw new Error(`int64 invalid: ${a}`);return l},uParse(a){const l=typeof a=="bigint"?a:BigInt(a);if(l>i||l<s)throw new Error(`uint64 invalid: ${a}`);return l},enc(a){return t.setBigInt64(0,this.parse(a),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},uEnc(a){return t.setBigInt64(0,this.uParse(a),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},dec:(a,l)=>(t.setInt32(0,a,!0),t.setInt32(4,l,!0),t.getBigInt64(0,!0)),uDec:(a,l)=>(t.setInt32(0,a,!0),t.setInt32(4,l,!0),t.getBigUint64(0,!0))}}const e=o=>Ct(/^-?[0-9]+$/.test(o),`int64 invalid: ${o}`),n=o=>Ct(/^[0-9]+$/.test(o),`uint64 invalid: ${o}`);return{zero:"0",supported:!1,parse:o=>(typeof o!="string"&&(o=o.toString()),e(o),o),uParse:o=>(typeof o!="string"&&(o=o.toString()),n(o),o),enc:o=>(typeof o!="string"&&(o=o.toString()),e(o),Xg(o)),uEnc:o=>(typeof o!="string"&&(o=o.toString()),n(o),Xg(o)),dec:(o,r)=>function(s,i){let a=Cd(s,i);const l=2147483648&a.hi;l&&(a=Qg(a.lo,a.hi));const c=Zg(a.lo,a.hi);return l?"-"+c:c}(o,r),uDec:(o,r)=>Zg(o,r)}}();var fe,Wo,It;function qo(t,e,n){if(e===n)return!0;if(t==fe.BYTES){if(!(e instanceof Uint8Array&&n instanceof Uint8Array)||e.length!==n.length)return!1;for(let o=0;o<e.length;o++)if(e[o]!==n[o])return!1;return!0}switch(t){case fe.UINT64:case fe.FIXED64:case fe.INT64:case fe.SFIXED64:case fe.SINT64:return e==n}return!1}function $r(t,e){switch(t){case fe.BOOL:return!1;case fe.UINT64:case fe.FIXED64:case fe.INT64:case fe.SFIXED64:case fe.SINT64:return e==0?vt.zero:"0";case fe.DOUBLE:case fe.FLOAT:return 0;case fe.BYTES:return new Uint8Array(0);case fe.STRING:return"";default:return 0}}function n_(t,e){switch(t){case fe.BOOL:return e===!1;case fe.STRING:return e==="";case fe.BYTES:return e instanceof Uint8Array&&!e.byteLength;default:return e==0}}(function(t){t[t.DOUBLE=1]="DOUBLE",t[t.FLOAT=2]="FLOAT",t[t.INT64=3]="INT64",t[t.UINT64=4]="UINT64",t[t.INT32=5]="INT32",t[t.FIXED64=6]="FIXED64",t[t.FIXED32=7]="FIXED32",t[t.BOOL=8]="BOOL",t[t.STRING=9]="STRING",t[t.BYTES=12]="BYTES",t[t.UINT32=13]="UINT32",t[t.SFIXED32=15]="SFIXED32",t[t.SFIXED64=16]="SFIXED64",t[t.SINT32=17]="SINT32",t[t.SINT64=18]="SINT64"})(fe||(fe={})),function(t){t[t.BIGINT=0]="BIGINT",t[t.STRING=1]="STRING"}(Wo||(Wo={})),function(t){t[t.Varint=0]="Varint",t[t.Bit64=1]="Bit64",t[t.LengthDelimited=2]="LengthDelimited",t[t.StartGroup=3]="StartGroup",t[t.EndGroup=4]="EndGroup",t[t.Bit32=5]="Bit32"}(It||(It={}));class aj{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let r=0;r<this.chunks.length;r++)e+=this.chunks[r].length;let n=new Uint8Array(e),o=0;for(let r=0;r<this.chunks.length;r++)n.set(this.chunks[r],o),o+=this.chunks[r].length;return this.chunks=[],n}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),n=this.stack.pop();if(!n)throw new Error("invalid state, fork stack empty");return this.chunks=n.chunks,this.buf=n.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,n){return this.uint32((e<<3|n)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(kd(e);e>127;)this.buf.push(127&e|128),e>>>=7;return this.buf.push(e),this}int32(e){return Ba(e),t_(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let n=this.textEncoder.encode(e);return this.uint32(n.byteLength),this.raw(n)}float(e){qg(e);let n=new Uint8Array(4);return new DataView(n.buffer).setFloat32(0,e,!0),this.raw(n)}double(e){let n=new Uint8Array(8);return new DataView(n.buffer).setFloat64(0,e,!0),this.raw(n)}fixed32(e){kd(e);let n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,e,!0),this.raw(n)}sfixed32(e){Ba(e);let n=new Uint8Array(4);return new DataView(n.buffer).setInt32(0,e,!0),this.raw(n)}sint32(e){return Ba(e),t_(e=(e<<1^e>>31)>>>0,this.buf),this}sfixed64(e){let n=new Uint8Array(8),o=new DataView(n.buffer),r=vt.enc(e);return o.setInt32(0,r.lo,!0),o.setInt32(4,r.hi,!0),this.raw(n)}fixed64(e){let n=new Uint8Array(8),o=new DataView(n.buffer),r=vt.uEnc(e);return o.setInt32(0,r.lo,!0),o.setInt32(4,r.hi,!0),this.raw(n)}int64(e){let n=vt.enc(e);return Sd(n.lo,n.hi,this.buf),this}sint64(e){let n=vt.enc(e),o=n.hi>>31;return Sd(n.lo<<1^o,(n.hi<<1|n.lo>>>31)^o,this.buf),this}uint64(e){let n=vt.uEnc(e);return Sd(n.lo,n.hi,this.buf),this}}class lj{constructor(e,n){this.varint64=rj,this.uint32=sj,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=n??new TextDecoder}tag(){let e=this.uint32(),n=e>>>3,o=7&e;if(n<=0||o<0||o>5)throw new Error("illegal tag: field no "+n+" wire type "+o);return[n,o]}skip(e,n){let o=this.pos;switch(e){case It.Varint:for(;128&this.buf[this.pos++];);break;case It.Bit64:this.pos+=4;case It.Bit32:this.pos+=4;break;case It.LengthDelimited:let r=this.uint32();this.pos+=r;break;case It.StartGroup:for(;;){const[s,i]=this.tag();if(i===It.EndGroup){if(n!==void 0&&s!==n)throw new Error("invalid end group tag");break}this.skip(i,s)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(o,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return 0|this.uint32()}sint32(){let e=this.uint32();return e>>>1^-(1&e)}int64(){return vt.dec(...this.varint64())}uint64(){return vt.uDec(...this.varint64())}sint64(){let[e,n]=this.varint64(),o=-(1&e);return e=(e>>>1|(1&n)<<31)^o,n=n>>>1^o,vt.dec(e,n)}bool(){let[e,n]=this.varint64();return e!==0||n!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return vt.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return vt.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),n=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(n,n+e)}string(){return this.textDecoder.decode(this.bytes())}}function o_(t){const e=t.field.localName,n=Object.create(null);return n[e]=function(o){const r=o.field;if(r.repeated)return[];if(r.default!==void 0)return r.default;switch(r.kind){case"enum":return r.T.values[0].no;case"scalar":return $r(r.T,r.L);case"message":const s=r.T,i=new s;return s.fieldWrapper?s.fieldWrapper.unwrapField(i):i;case"map":throw"map fields are not allowed to be extensions"}}(t),[n,()=>n[e]]}let bo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),Va=[];for(let t=0;t<bo.length;t++)Va[bo[t].charCodeAt(0)]=t;Va[45]=bo.indexOf("+"),Va[95]=bo.indexOf("/");const $a={dec(t){let e=3*t.length/4;t[t.length-2]=="="?e-=2:t[t.length-1]=="="&&(e-=1);let n,o=new Uint8Array(e),r=0,s=0,i=0;for(let a=0;a<t.length;a++){if(n=Va[t.charCodeAt(a)],n===void 0)switch(t[a]){case"=":s=0;case`
100
+ `:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string.")}switch(s){case 0:i=n,s=1;break;case 1:o[r++]=i<<2|(48&n)>>4,i=n,s=2;break;case 2:o[r++]=(15&i)<<4|(60&n)>>2,i=n,s=3;break;case 3:o[r++]=(3&i)<<6|n,s=0}}if(s==1)throw Error("invalid base64 string.");return o.subarray(0,r)},enc(t){let e,n="",o=0,r=0;for(let s=0;s<t.length;s++)switch(e=t[s],o){case 0:n+=bo[e>>2],r=(3&e)<<4,o=1;break;case 1:n+=bo[r|e>>4],r=(15&e)<<2,o=2;break;case 2:n+=bo[r|e>>6],n+=bo[63&e],o=0}return o&&(n+=bo[r],n+="=",o==1&&(n+="=")),n}};function cj(t,e,n){s_(e,t);const o=e.runtime.bin.makeReadOptions(n),r=function(a,l){if(!l.repeated&&(l.kind=="enum"||l.kind=="scalar")){for(let c=a.length-1;c>=0;--c)if(a[c].no==l.no)return[a[c]];return[]}return a.filter(c=>c.no===l.no)}(t.getType().runtime.bin.listUnknownFields(t),e.field),[s,i]=o_(e);for(const a of r)e.runtime.bin.readField(s,o.readerFactory(a.data),e.field,a.wireType,o);return i()}function dj(t,e,n,o){s_(e,t);const r=e.runtime.bin.makeReadOptions(o),s=e.runtime.bin.makeWriteOptions(o);if(r_(t,e)){const c=t.getType().runtime.bin.listUnknownFields(t).filter(d=>d.no!=e.field.no);t.getType().runtime.bin.discardUnknownFields(t);for(const d of c)t.getType().runtime.bin.onUnknownField(t,d.no,d.wireType,d.data)}const i=s.writerFactory();let a=e.field;a.opt||a.repeated||a.kind!="enum"&&a.kind!="scalar"||(a=Object.assign(Object.assign({},e.field),{opt:!0})),e.runtime.bin.writeField(a,n,i,s);const l=r.readerFactory(i.finish());for(;l.pos<l.len;){const[c,d]=l.tag(),u=l.skip(d,c);t.getType().runtime.bin.onUnknownField(t,c,d,u)}}function r_(t,e){const n=t.getType();return e.extendee.typeName===n.typeName&&!!n.runtime.bin.listUnknownFields(t).find(o=>o.no==e.field.no)}function s_(t,e){Ct(t.extendee.typeName==e.getType().typeName,`extension ${t.typeName} can only be applied to message ${t.extendee.typeName}`)}function i_(t,e){const n=t.localName;if(t.repeated)return e[n].length>0;if(t.oneof)return e[t.oneof.localName].case===n;switch(t.kind){case"enum":case"scalar":return t.opt||t.req?e[n]!==void 0:t.kind=="enum"?e[n]!==t.T.values[0].no:!n_(t.T,e[n]);case"message":return e[n]!==void 0;case"map":return Object.keys(e[n]).length>0}}function a_(t,e){const n=t.localName,o=!t.opt&&!t.req;if(t.repeated)e[n]=[];else if(t.oneof)e[t.oneof.localName]={case:void 0};else switch(t.kind){case"map":e[n]={};break;case"enum":e[n]=o?t.T.values[0].no:void 0;break;case"scalar":e[n]=o?$r(t.T,t.L):void 0;break;case"message":e[n]=void 0}}function Cr(t,e){if(t===null||typeof t!="object"||!Object.getOwnPropertyNames(Ot.prototype).every(o=>o in t&&typeof t[o]=="function"))return!1;const n=t.getType();return n!==null&&typeof n=="function"&&"typeName"in n&&typeof n.typeName=="string"&&(e===void 0||n.typeName==e.typeName)}function l_(t,e){return Cr(e)||!t.fieldWrapper?e:t.fieldWrapper.wrapField(e)}fe.DOUBLE,fe.FLOAT,fe.INT64,fe.UINT64,fe.INT32,fe.UINT32,fe.BOOL,fe.STRING,fe.BYTES;const c_={ignoreUnknownFields:!1},d_={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function uj(t){return t?Object.assign(Object.assign({},c_),t):c_}function hj(t){return t?Object.assign(Object.assign({},d_),t):d_}const Ha=Symbol(),Wa=Symbol();function to(t){if(t===null)return"null";switch(typeof t){case"object":return Array.isArray(t)?"array":"object";case"string":return t.length>100?"string":`"${t.split('"').join('\\"')}"`;default:return String(t)}}function u_(t,e,n,o,r){let s=n.localName;if(n.repeated){if(Ct(n.kind!="map"),e===null)return;if(!Array.isArray(e))throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${to(e)}`);const i=t[s];for(const a of e){if(a===null)throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${to(a)}`);switch(n.kind){case"message":i.push(n.T.fromJson(a,o));break;case"enum":const l=Nd(n.T,a,o.ignoreUnknownFields,!0);l!==Wa&&i.push(l);break;case"scalar":try{i.push(ci(n.T,a,n.L,!0))}catch(c){let d=`cannot decode field ${r.typeName}.${n.name} from JSON: ${to(a)}`;throw c instanceof Error&&c.message.length>0&&(d+=`: ${c.message}`),new Error(d)}}}}else if(n.kind=="map"){if(e===null)return;if(typeof e!="object"||Array.isArray(e))throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${to(e)}`);const i=t[s];for(const[a,l]of Object.entries(e)){if(l===null)throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: map value null`);let c;try{c=fj(n.K,a)}catch(d){let u=`cannot decode map key for field ${r.typeName}.${n.name} from JSON: ${to(e)}`;throw d instanceof Error&&d.message.length>0&&(u+=`: ${d.message}`),new Error(u)}switch(n.V.kind){case"message":i[c]=n.V.T.fromJson(l,o);break;case"enum":const d=Nd(n.V.T,l,o.ignoreUnknownFields,!0);d!==Wa&&(i[c]=d);break;case"scalar":try{i[c]=ci(n.V.T,l,Wo.BIGINT,!0)}catch(u){let f=`cannot decode map value for field ${r.typeName}.${n.name} from JSON: ${to(e)}`;throw u instanceof Error&&u.message.length>0&&(f+=`: ${u.message}`),new Error(f)}}}}else switch(n.oneof&&(t=t[n.oneof.localName]={case:s},s="value"),n.kind){case"message":const i=n.T;if(e===null&&i.typeName!="google.protobuf.Value")return;let a=t[s];Cr(a)?a.fromJson(e,o):(t[s]=a=i.fromJson(e,o),i.fieldWrapper&&!n.oneof&&(t[s]=i.fieldWrapper.unwrapField(a)));break;case"enum":const l=Nd(n.T,e,o.ignoreUnknownFields,!1);switch(l){case Ha:a_(n,t);break;case Wa:break;default:t[s]=l}break;case"scalar":try{const c=ci(n.T,e,n.L,!1);c===Ha?a_(n,t):t[s]=c}catch(c){let d=`cannot decode field ${r.typeName}.${n.name} from JSON: ${to(e)}`;throw c instanceof Error&&c.message.length>0&&(d+=`: ${c.message}`),new Error(d)}}}function fj(t,e){if(t===fe.BOOL)switch(e){case"true":e=!0;break;case"false":e=!1}return ci(t,e,Wo.BIGINT,!0).toString()}function ci(t,e,n,o){if(e===null)return o?$r(t,n):Ha;switch(t){case fe.DOUBLE:case fe.FLOAT:if(e==="NaN")return Number.NaN;if(e==="Infinity")return Number.POSITIVE_INFINITY;if(e==="-Infinity")return Number.NEGATIVE_INFINITY;if(e===""||typeof e=="string"&&e.trim().length!==e.length||typeof e!="string"&&typeof e!="number")break;const r=Number(e);if(Number.isNaN(r)||!Number.isFinite(r))break;return t==fe.FLOAT&&qg(r),r;case fe.INT32:case fe.FIXED32:case fe.SFIXED32:case fe.SINT32:case fe.UINT32:let s;if(typeof e=="number"?s=e:typeof e=="string"&&e.length>0&&e.trim().length===e.length&&(s=Number(e)),s===void 0)break;return t==fe.UINT32||t==fe.FIXED32?kd(s):Ba(s),s;case fe.INT64:case fe.SFIXED64:case fe.SINT64:if(typeof e!="number"&&typeof e!="string")break;const i=vt.parse(e);return n?i.toString():i;case fe.FIXED64:case fe.UINT64:if(typeof e!="number"&&typeof e!="string")break;const a=vt.uParse(e);return n?a.toString():a;case fe.BOOL:if(typeof e!="boolean")break;return e;case fe.STRING:if(typeof e!="string")break;try{encodeURIComponent(e)}catch{throw new Error("invalid UTF8")}return e;case fe.BYTES:if(e==="")return new Uint8Array(0);if(typeof e!="string")break;return $a.dec(e)}throw new Error}function Nd(t,e,n,o){if(e===null)return t.typeName=="google.protobuf.NullValue"?0:o?t.values[0].no:Ha;switch(typeof e){case"number":if(Number.isInteger(e))return e;break;case"string":const r=t.findName(e);if(r!==void 0)return r.no;if(n)return Wa}throw new Error(`cannot decode enum ${t.typeName} from JSON: ${to(e)}`)}function pj(t){return!(!t.repeated&&t.kind!="map")||!t.oneof&&t.kind!="message"&&!t.opt&&!t.req}function h_(t,e,n){if(t.kind=="map"){Ct(typeof e=="object"&&e!=null);const o={},r=Object.entries(e);switch(t.V.kind){case"scalar":for(const[i,a]of r)o[i.toString()]=qa(t.V.T,a);break;case"message":for(const[i,a]of r)o[i.toString()]=a.toJson(n);break;case"enum":const s=t.V.T;for(const[i,a]of r)o[i.toString()]=jd(s,a,n.enumAsInteger)}return n.emitDefaultValues||r.length>0?o:void 0}if(t.repeated){Ct(Array.isArray(e));const o=[];switch(t.kind){case"scalar":for(let r=0;r<e.length;r++)o.push(qa(t.T,e[r]));break;case"enum":for(let r=0;r<e.length;r++)o.push(jd(t.T,e[r],n.enumAsInteger));break;case"message":for(let r=0;r<e.length;r++)o.push(e[r].toJson(n))}return n.emitDefaultValues||o.length>0?o:void 0}switch(t.kind){case"scalar":return qa(t.T,e);case"enum":return jd(t.T,e,n.enumAsInteger);case"message":return l_(t.T,e).toJson(n)}}function jd(t,e,n){var o;if(Ct(typeof e=="number"),t.typeName=="google.protobuf.NullValue")return null;if(n)return e;const r=t.findNumber(e);return(o=r==null?void 0:r.name)!==null&&o!==void 0?o:e}function qa(t,e){switch(t){case fe.INT32:case fe.SFIXED32:case fe.SINT32:case fe.FIXED32:case fe.UINT32:return Ct(typeof e=="number"),e;case fe.FLOAT:case fe.DOUBLE:return Ct(typeof e=="number"),Number.isNaN(e)?"NaN":e===Number.POSITIVE_INFINITY?"Infinity":e===Number.NEGATIVE_INFINITY?"-Infinity":e;case fe.STRING:return Ct(typeof e=="string"),e;case fe.BOOL:return Ct(typeof e=="boolean"),e;case fe.UINT64:case fe.FIXED64:case fe.INT64:case fe.SFIXED64:case fe.SINT64:return Ct(typeof e=="bigint"||typeof e=="string"||typeof e=="number"),e.toString();case fe.BYTES:return Ct(e instanceof Uint8Array),$a.enc(e)}}const Hr=Symbol("@bufbuild/protobuf/unknown-fields"),f_={readUnknownFields:!0,readerFactory:t=>new lj(t)},p_={writeUnknownFields:!0,writerFactory:()=>new aj};function mj(t){return t?Object.assign(Object.assign({},f_),t):f_}function gj(t){return t?Object.assign(Object.assign({},p_),t):p_}function m_(t,e,n,o,r){let{repeated:s,localName:i}=n;switch(n.oneof&&((t=t[n.oneof.localName]).case!=i&&delete t.value,t.case=i,i="value"),n.kind){case"scalar":case"enum":const a=n.kind=="enum"?fe.INT32:n.T;let l=Ya;if(n.kind=="scalar"&&n.L>0&&(l=_j),s){let f=t[i];if(o==It.LengthDelimited&&a!=fe.STRING&&a!=fe.BYTES){let p=e.uint32()+e.pos;for(;e.pos<p;)f.push(l(e,a))}else f.push(l(e,a))}else t[i]=l(e,a);break;case"message":const c=n.T;s?t[i].push(Ga(e,new c,r,n)):Cr(t[i])?Ga(e,t[i],r,n):(t[i]=Ga(e,new c,r,n),!c.fieldWrapper||n.oneof||n.repeated||(t[i]=c.fieldWrapper.unwrapField(t[i])));break;case"map":let[d,u]=function(f,p,_){const g=p.uint32(),m=p.pos+g;let b,x;for(;p.pos<m;){const[y]=p.tag();switch(y){case 1:b=Ya(p,f.K);break;case 2:switch(f.V.kind){case"scalar":x=Ya(p,f.V.T);break;case"enum":x=p.int32();break;case"message":x=Ga(p,new f.V.T,_,void 0)}}}if(b===void 0&&(b=$r(f.K,Wo.BIGINT)),typeof b!="string"&&typeof b!="number"&&(b=b.toString()),x===void 0)switch(f.V.kind){case"scalar":x=$r(f.V.T,Wo.BIGINT);break;case"enum":x=f.V.T.values[0].no;break;case"message":x=new f.V.T}return[b,x]}(n,e,r);t[i][d]=u}}function Ga(t,e,n,o){const r=e.getType().runtime.bin,s=o==null?void 0:o.delimited;return r.readMessage(e,t,s?o.no:t.uint32(),n,s),e}function _j(t,e){const n=Ya(t,e);return typeof n=="bigint"?n.toString():n}function Ya(t,e){switch(e){case fe.STRING:return t.string();case fe.BOOL:return t.bool();case fe.DOUBLE:return t.double();case fe.FLOAT:return t.float();case fe.INT32:return t.int32();case fe.INT64:return t.int64();case fe.UINT64:return t.uint64();case fe.FIXED64:return t.fixed64();case fe.BYTES:return t.bytes();case fe.FIXED32:return t.fixed32();case fe.SFIXED32:return t.sfixed32();case fe.SFIXED64:return t.sfixed64();case fe.SINT64:return t.sint64();case fe.UINT32:return t.uint32();case fe.SINT32:return t.sint32()}}function g_(t,e,n,o){Ct(e!==void 0);const r=t.repeated;switch(t.kind){case"scalar":case"enum":let s=t.kind=="enum"?fe.INT32:t.T;if(r)if(Ct(Array.isArray(e)),t.packed)(function(i,a,l,c){if(!c.length)return;i.tag(l,It.LengthDelimited).fork();let[,d]=b_(a);for(let u=0;u<c.length;u++)i[d](c[u]);i.join()})(n,s,t.no,e);else for(const i of e)di(n,s,t.no,i);else di(n,s,t.no,e);break;case"message":if(r){Ct(Array.isArray(e));for(const i of e)__(n,o,t,i)}else __(n,o,t,e);break;case"map":Ct(typeof e=="object"&&e!=null);for(const[i,a]of Object.entries(e))bj(n,o,t,i,a)}}function bj(t,e,n,o,r){t.tag(n.no,It.LengthDelimited),t.fork();let s=o;switch(n.K){case fe.INT32:case fe.FIXED32:case fe.UINT32:case fe.SFIXED32:case fe.SINT32:s=Number.parseInt(o);break;case fe.BOOL:Ct(o=="true"||o=="false"),s=o=="true"}switch(di(t,n.K,1,s),n.V.kind){case"scalar":di(t,n.V.T,2,r);break;case"enum":di(t,fe.INT32,2,r);break;case"message":Ct(r!==void 0),t.tag(2,It.LengthDelimited).bytes(r.toBinary(e))}t.join()}function __(t,e,n,o){const r=l_(n.T,o);n.delimited?t.tag(n.no,It.StartGroup).raw(r.toBinary(e)).tag(n.no,It.EndGroup):t.tag(n.no,It.LengthDelimited).bytes(r.toBinary(e))}function di(t,e,n,o){Ct(o!==void 0);let[r,s]=b_(e);t.tag(n,r)[s](o)}function b_(t){let e=It.Varint;switch(t){case fe.BYTES:case fe.STRING:e=It.LengthDelimited;break;case fe.DOUBLE:case fe.FIXED64:case fe.SFIXED64:e=It.Bit64;break;case fe.FIXED32:case fe.SFIXED32:case fe.FLOAT:e=It.Bit32}return[e,fe[t].toLowerCase()]}function Ja(t){if(t===void 0)return t;if(Cr(t))return t.clone();if(t instanceof Uint8Array){const e=new Uint8Array(t.byteLength);return e.set(t),e}return t}function ui(t){return t instanceof Uint8Array?t:new Uint8Array(t)}class yj{constructor(e,n){this._fields=e,this._normalizer=n}findJsonName(e){if(!this.jsonNames){const n={};for(const o of this.list())n[o.jsonName]=n[o.name]=o;this.jsonNames=n}return this.jsonNames[e]}find(e){if(!this.numbers){const n={};for(const o of this.list())n[o.no]=o;this.numbers=n}return this.numbers[e]}list(){return this.all||(this.all=this._normalizer(this._fields)),this.all}byNumber(){return this.numbersAsc||(this.numbersAsc=this.list().concat().sort((e,n)=>e.no-n.no)),this.numbersAsc}byMember(){if(!this.members){this.members=[];const e=this.members;let n;for(const o of this.list())o.oneof?o.oneof!==n&&(n=o.oneof,e.push(n)):e.push(o)}return this.members}}function y_(t,e){const n=x_(t);return e?n:Sj(kj(n))}const xj=x_;function x_(t){let e=!1;const n=[];for(let o=0;o<t.length;o++){let r=t.charAt(o);switch(r){case"_":e=!0;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n.push(r),e=!1;break;default:e&&(e=!1,r=r.toUpperCase()),n.push(r)}}return n.join("")}const wj=new Set(["constructor","toString","toJSON","valueOf"]),vj=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),w_=t=>`${t}$`,kj=t=>vj.has(t)?w_(t):t,Sj=t=>wj.has(t)?w_(t):t;class Cj{constructor(e){this.kind="oneof",this.repeated=!1,this.packed=!1,this.opt=!1,this.req=!1,this.default=void 0,this.fields=[],this.name=e,this.localName=y_(e,!1)}addField(e){Ct(e.oneof===this,`field ${e.name} not one of ${this.name}`),this.fields.push(e)}findField(e){if(!this._lookup){this._lookup=Object.create(null);for(let n=0;n<this.fields.length;n++)this._lookup[this.fields[n].localName]=this.fields[n]}return this._lookup[e]}}const Se=(v_=t=>new yj(t,e=>function(n){var o,r,s,i,a,l;const c=[];let d;for(const u of typeof n=="function"?n():n){const f=u;if(f.localName=y_(u.name,u.oneof!==void 0),f.jsonName=(o=u.jsonName)!==null&&o!==void 0?o:xj(u.name),f.repeated=(r=u.repeated)!==null&&r!==void 0&&r,u.kind=="scalar"&&(f.L=(s=u.L)!==null&&s!==void 0?s:Wo.BIGINT),f.delimited=(i=u.delimited)!==null&&i!==void 0&&i,f.req=(a=u.req)!==null&&a!==void 0&&a,f.opt=(l=u.opt)!==null&&l!==void 0&&l,u.packed===void 0&&(f.packed=u.kind=="enum"||u.kind=="scalar"&&u.T!=fe.BYTES&&u.T!=fe.STRING),u.oneof!==void 0){const p=typeof u.oneof=="string"?u.oneof:u.oneof.name;d&&d.name==p||(d=new Cj(p)),f.oneof=d,d.addField(f)}c.push(f)}return c}(e)),k_=t=>{for(const e of t.getType().fields.byMember()){if(e.opt)continue;const n=e.localName,o=t;if(e.repeated)o[n]=[];else switch(e.kind){case"oneof":o[n]={case:void 0};break;case"enum":o[n]=0;break;case"map":o[n]={};break;case"scalar":o[n]=$r(e.T,e.L)}}},{syntax:"proto3",json:{makeReadOptions:uj,makeWriteOptions:hj,readMessage(t,e,n,o){if(e==null||Array.isArray(e)||typeof e!="object")throw new Error(`cannot decode message ${t.typeName} from JSON: ${to(e)}`);o=o??new t;const r=new Map,s=n.typeRegistry;for(const[i,a]of Object.entries(e)){const l=t.fields.findJsonName(i);if(l){if(l.oneof){if(a===null&&l.kind=="scalar")continue;const c=r.get(l.oneof);if(c!==void 0)throw new Error(`cannot decode message ${t.typeName} from JSON: multiple keys for oneof "${l.oneof.name}" present: "${c}", "${i}"`);r.set(l.oneof,i)}u_(o,a,l,n,t)}else{let c=!1;if(s!=null&&s.findExtension&&i.startsWith("[")&&i.endsWith("]")){const d=s.findExtension(i.substring(1,i.length-1));if(d&&d.extendee.typeName==t.typeName){c=!0;const[u,f]=o_(d);u_(u,a,d.field,n,d),dj(o,d,f(),n)}}if(!c&&!n.ignoreUnknownFields)throw new Error(`cannot decode message ${t.typeName} from JSON: key "${i}" is unknown`)}}return o},writeMessage(t,e){const n=t.getType(),o={};let r;try{for(r of n.fields.byNumber()){if(!i_(r,t)){if(r.req)throw"required field not set";if(!e.emitDefaultValues||!pj(r))continue}const i=h_(r,r.oneof?t[r.oneof.localName].value:t[r.localName],e);i!==void 0&&(o[e.useProtoFieldName?r.name:r.jsonName]=i)}const s=e.typeRegistry;if(s!=null&&s.findExtensionFor)for(const i of n.runtime.bin.listUnknownFields(t)){const a=s.findExtensionFor(n.typeName,i.no);if(a&&r_(t,a)){const l=cj(t,a,e),c=h_(a.field,l,e);c!==void 0&&(o[a.field.jsonName]=c)}}}catch(s){const i=r?`cannot encode field ${n.typeName}.${r.name} to JSON`:`cannot encode message ${n.typeName} to JSON`,a=s instanceof Error?s.message:String(s);throw new Error(i+(a.length>0?`: ${a}`:""))}return o},readScalar:(t,e,n)=>ci(t,e,n??Wo.BIGINT,!0),writeScalar(t,e,n){if(e!==void 0)return n||n_(t,e)?qa(t,e):void 0},debug:to},bin:{makeReadOptions:mj,makeWriteOptions:gj,listUnknownFields(t){var e;return(e=t[Hr])!==null&&e!==void 0?e:[]},discardUnknownFields(t){delete t[Hr]},writeUnknownFields(t,e){const n=t[Hr];if(n)for(const o of n)e.tag(o.no,o.wireType).raw(o.data)},onUnknownField(t,e,n,o){const r=t;Array.isArray(r[Hr])||(r[Hr]=[]),r[Hr].push({no:e,wireType:n,data:o})},readMessage(t,e,n,o,r){const s=t.getType(),i=r?e.len:e.pos+n;let a,l;for(;e.pos<i&&([a,l]=e.tag(),r!==!0||l!=It.EndGroup);){const c=s.fields.find(a);if(c)m_(t,e,c,l,o);else{const d=e.skip(l,a);o.readUnknownFields&&this.onUnknownField(t,a,l,d)}}if(r&&(l!=It.EndGroup||a!==n))throw new Error("invalid end group tag")},readField:m_,writeMessage(t,e,n){const o=t.getType();for(const r of o.fields.byNumber())if(i_(r,t))g_(r,r.oneof?t[r.oneof.localName].value:t[r.localName],e,n);else if(r.req)throw new Error(`cannot encode field ${o.typeName}.${r.name} to binary: required field not set`);return n.writeUnknownFields&&this.writeUnknownFields(t,e),e},writeField(t,e,n,o){e!==void 0&&g_(t,e,n,o)}},util:Object.assign(Object.assign({},{setEnumType:Yg,initPartial(t,e){if(t===void 0)return;const n=e.getType();for(const o of n.fields.byMember()){const r=o.localName,s=e,i=t;if(i[r]!=null)switch(o.kind){case"oneof":const a=i[r].case;if(a===void 0)continue;const l=o.findField(a);let c=i[r].value;l&&l.kind=="message"&&!Cr(c,l.T)?c=new l.T(c):l&&l.kind==="scalar"&&l.T===fe.BYTES&&(c=ui(c)),s[r]={case:a,value:c};break;case"scalar":case"enum":let d=i[r];o.T===fe.BYTES&&(d=o.repeated?d.map(ui):ui(d)),s[r]=d;break;case"map":switch(o.V.kind){case"scalar":case"enum":if(o.V.T===fe.BYTES)for(const[p,_]of Object.entries(i[r]))s[r][p]=ui(_);else Object.assign(s[r],i[r]);break;case"message":const f=o.V.T;for(const p of Object.keys(i[r])){let _=i[r][p];f.fieldWrapper||(_=new f(_)),s[r][p]=_}}break;case"message":const u=o.T;if(o.repeated)s[r]=i[r].map(f=>Cr(f,u)?f:new u(f));else{const f=i[r];u.fieldWrapper?u.typeName==="google.protobuf.BytesValue"?s[r]=ui(f):s[r]=f:s[r]=Cr(f,u)?f:new u(f)}}}},equals:(t,e,n)=>e===n||!(!e||!n)&&t.fields.byMember().every(o=>{const r=e[o.localName],s=n[o.localName];if(o.repeated){if(r.length!==s.length)return!1;switch(o.kind){case"message":return r.every((i,a)=>o.T.equals(i,s[a]));case"scalar":return r.every((i,a)=>qo(o.T,i,s[a]));case"enum":return r.every((i,a)=>qo(fe.INT32,i,s[a]))}throw new Error(`repeated cannot contain ${o.kind}`)}switch(o.kind){case"message":return o.T.equals(r,s);case"enum":return qo(fe.INT32,r,s);case"scalar":return qo(o.T,r,s);case"oneof":if(r.case!==s.case)return!1;const i=o.findField(r.case);if(i===void 0)return!0;switch(i.kind){case"message":return i.T.equals(r.value,s.value);case"enum":return qo(fe.INT32,r.value,s.value);case"scalar":return qo(i.T,r.value,s.value)}throw new Error(`oneof cannot contain ${i.kind}`);case"map":const a=Object.keys(r).concat(Object.keys(s));switch(o.V.kind){case"message":const l=o.V.T;return a.every(d=>l.equals(r[d],s[d]));case"enum":return a.every(d=>qo(fe.INT32,r[d],s[d]));case"scalar":const c=o.V.T;return a.every(d=>qo(c,r[d],s[d]))}}}),clone(t){const e=t.getType(),n=new e,o=n;for(const r of e.fields.byMember()){const s=t[r.localName];let i;if(r.repeated)i=s.map(Ja);else if(r.kind=="map"){i=o[r.localName];for(const[a,l]of Object.entries(s))i[a]=Ja(l)}else i=r.kind=="oneof"?r.findField(s.case)?{case:s.case,value:Ja(s.value)}:{case:void 0}:Ja(s);o[r.localName]=i}for(const r of e.runtime.bin.listUnknownFields(t))e.runtime.bin.onUnknownField(o,r.no,r.wireType,r.data);return n}}),{newFieldList:v_,initFields:k_}),makeMessageType(t,e,n){return function(o,r,s,i){var a;const l=(a=i==null?void 0:i.localName)!==null&&a!==void 0?a:r.substring(r.lastIndexOf(".")+1),c={[l]:function(d){o.util.initFields(this),o.util.initPartial(d,this)}}[l];return Object.setPrototypeOf(c.prototype,new Ot),Object.assign(c,{runtime:o,typeName:r,fields:o.util.newFieldList(s),fromBinary:(d,u)=>new c().fromBinary(d,u),fromJson:(d,u)=>new c().fromJson(d,u),fromJsonString:(d,u)=>new c().fromJsonString(d,u),equals:(d,u)=>o.util.equals(c,d,u)}),c}(this,t,e,n)},makeEnum:oj,makeEnumType:Jg,getEnumType:nj,makeExtension(t,e,n){return function(o,r,s,i){let a;return{typeName:r,extendee:s,get field(){if(!a){const l=typeof i=="function"?i():i;l.name=r.split(".").pop(),l.jsonName=`[${r}]`,a=o.util.newFieldList([l]).list()[0]}return a},runtime:o}}(this,t,e,n)}});var v_,k_,An,Ed,Ka,hi,Xa,fi,Go;(function(t){t[t.Unary=0]="Unary",t[t.ServerStreaming=1]="ServerStreaming",t[t.ClientStreaming=2]="ClientStreaming",t[t.BiDiStreaming=3]="BiDiStreaming"})(An||(An={})),function(t){t[t.NoSideEffects=1]="NoSideEffects",t[t.Idempotent=2]="Idempotent"}(Ed||(Ed={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.JUPYTER_FORMAT=77]="JUPYTER_FORMAT"}(Ka||(Ka={})),Se.util.setEnumType(Ka,"exa.codeium_common_pb.ExperimentKey",[{no:0,name:"UNSPECIFIED"},{no:77,name:"JUPYTER_FORMAT"}]),function(t){t[t.CODEIUM=0]="CODEIUM"}(hi||(hi={})),Se.util.setEnumType(hi,"exa.codeium_common_pb.AuthSource",[{no:0,name:"AUTH_SOURCE_CODEIUM"}]),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.ENABLE_CODEIUM=1]="ENABLE_CODEIUM",t[t.DISABLE_CODEIUM=2]="DISABLE_CODEIUM",t[t.SHOW_PREVIOUS_COMPLETION=3]="SHOW_PREVIOUS_COMPLETION",t[t.SHOW_NEXT_COMPLETION=4]="SHOW_NEXT_COMPLETION"}(Xa||(Xa={})),Se.util.setEnumType(Xa,"exa.codeium_common_pb.EventType",[{no:0,name:"EVENT_TYPE_UNSPECIFIED"},{no:1,name:"EVENT_TYPE_ENABLE_CODEIUM"},{no:2,name:"EVENT_TYPE_DISABLE_CODEIUM"},{no:3,name:"EVENT_TYPE_SHOW_PREVIOUS_COMPLETION"},{no:4,name:"EVENT_TYPE_SHOW_NEXT_COMPLETION"}]),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TYPING_AS_SUGGESTED=1]="TYPING_AS_SUGGESTED",t[t.CACHE=2]="CACHE",t[t.NETWORK=3]="NETWORK"}(fi||(fi={})),Se.util.setEnumType(fi,"exa.codeium_common_pb.CompletionSource",[{no:0,name:"COMPLETION_SOURCE_UNSPECIFIED"},{no:1,name:"COMPLETION_SOURCE_TYPING_AS_SUGGESTED"},{no:2,name:"COMPLETION_SOURCE_CACHE"},{no:3,name:"COMPLETION_SOURCE_NETWORK"}]),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.C=1]="C",t[t.CLOJURE=2]="CLOJURE",t[t.COFFEESCRIPT=3]="COFFEESCRIPT",t[t.CPP=4]="CPP",t[t.CSHARP=5]="CSHARP",t[t.CSS=6]="CSS",t[t.CUDACPP=7]="CUDACPP",t[t.DOCKERFILE=8]="DOCKERFILE",t[t.GO=9]="GO",t[t.GROOVY=10]="GROOVY",t[t.HANDLEBARS=11]="HANDLEBARS",t[t.HASKELL=12]="HASKELL",t[t.HCL=13]="HCL",t[t.HTML=14]="HTML",t[t.INI=15]="INI",t[t.JAVA=16]="JAVA",t[t.JAVASCRIPT=17]="JAVASCRIPT",t[t.JSON=18]="JSON",t[t.JULIA=19]="JULIA",t[t.KOTLIN=20]="KOTLIN",t[t.LATEX=21]="LATEX",t[t.LESS=22]="LESS",t[t.LUA=23]="LUA",t[t.MAKEFILE=24]="MAKEFILE",t[t.MARKDOWN=25]="MARKDOWN",t[t.OBJECTIVEC=26]="OBJECTIVEC",t[t.OBJECTIVECPP=27]="OBJECTIVECPP",t[t.PERL=28]="PERL",t[t.PHP=29]="PHP",t[t.PLAINTEXT=30]="PLAINTEXT",t[t.PROTOBUF=31]="PROTOBUF",t[t.PBTXT=32]="PBTXT",t[t.PYTHON=33]="PYTHON",t[t.R=34]="R",t[t.RUBY=35]="RUBY",t[t.RUST=36]="RUST",t[t.SASS=37]="SASS",t[t.SCALA=38]="SCALA",t[t.SCSS=39]="SCSS",t[t.SHELL=40]="SHELL",t[t.SQL=41]="SQL",t[t.STARLARK=42]="STARLARK",t[t.SWIFT=43]="SWIFT",t[t.TSX=44]="TSX",t[t.TYPESCRIPT=45]="TYPESCRIPT",t[t.VISUALBASIC=46]="VISUALBASIC",t[t.VUE=47]="VUE",t[t.XML=48]="XML",t[t.XSL=49]="XSL",t[t.YAML=50]="YAML",t[t.SVELTE=51]="SVELTE",t[t.TOML=52]="TOML",t[t.DART=53]="DART",t[t.RST=54]="RST",t[t.OCAML=55]="OCAML",t[t.CMAKE=56]="CMAKE",t[t.PASCAL=57]="PASCAL",t[t.ELIXIR=58]="ELIXIR",t[t.FSHARP=59]="FSHARP",t[t.LISP=60]="LISP",t[t.MATLAB=61]="MATLAB",t[t.POWERSHELL=62]="POWERSHELL",t[t.SOLIDITY=63]="SOLIDITY",t[t.ADA=64]="ADA",t[t.OCAML_INTERFACE=65]="OCAML_INTERFACE"}(Go||(Go={})),Se.util.setEnumType(Go,"exa.codeium_common_pb.Language",[{no:0,name:"LANGUAGE_UNSPECIFIED"},{no:1,name:"LANGUAGE_C"},{no:2,name:"LANGUAGE_CLOJURE"},{no:3,name:"LANGUAGE_COFFEESCRIPT"},{no:4,name:"LANGUAGE_CPP"},{no:5,name:"LANGUAGE_CSHARP"},{no:6,name:"LANGUAGE_CSS"},{no:7,name:"LANGUAGE_CUDACPP"},{no:8,name:"LANGUAGE_DOCKERFILE"},{no:9,name:"LANGUAGE_GO"},{no:10,name:"LANGUAGE_GROOVY"},{no:11,name:"LANGUAGE_HANDLEBARS"},{no:12,name:"LANGUAGE_HASKELL"},{no:13,name:"LANGUAGE_HCL"},{no:14,name:"LANGUAGE_HTML"},{no:15,name:"LANGUAGE_INI"},{no:16,name:"LANGUAGE_JAVA"},{no:17,name:"LANGUAGE_JAVASCRIPT"},{no:18,name:"LANGUAGE_JSON"},{no:19,name:"LANGUAGE_JULIA"},{no:20,name:"LANGUAGE_KOTLIN"},{no:21,name:"LANGUAGE_LATEX"},{no:22,name:"LANGUAGE_LESS"},{no:23,name:"LANGUAGE_LUA"},{no:24,name:"LANGUAGE_MAKEFILE"},{no:25,name:"LANGUAGE_MARKDOWN"},{no:26,name:"LANGUAGE_OBJECTIVEC"},{no:27,name:"LANGUAGE_OBJECTIVECPP"},{no:28,name:"LANGUAGE_PERL"},{no:29,name:"LANGUAGE_PHP"},{no:30,name:"LANGUAGE_PLAINTEXT"},{no:31,name:"LANGUAGE_PROTOBUF"},{no:32,name:"LANGUAGE_PBTXT"},{no:33,name:"LANGUAGE_PYTHON"},{no:34,name:"LANGUAGE_R"},{no:35,name:"LANGUAGE_RUBY"},{no:36,name:"LANGUAGE_RUST"},{no:37,name:"LANGUAGE_SASS"},{no:38,name:"LANGUAGE_SCALA"},{no:39,name:"LANGUAGE_SCSS"},{no:40,name:"LANGUAGE_SHELL"},{no:41,name:"LANGUAGE_SQL"},{no:42,name:"LANGUAGE_STARLARK"},{no:43,name:"LANGUAGE_SWIFT"},{no:44,name:"LANGUAGE_TSX"},{no:45,name:"LANGUAGE_TYPESCRIPT"},{no:46,name:"LANGUAGE_VISUALBASIC"},{no:47,name:"LANGUAGE_VUE"},{no:48,name:"LANGUAGE_XML"},{no:49,name:"LANGUAGE_XSL"},{no:50,name:"LANGUAGE_YAML"},{no:51,name:"LANGUAGE_SVELTE"},{no:52,name:"LANGUAGE_TOML"},{no:53,name:"LANGUAGE_DART"},{no:54,name:"LANGUAGE_RST"},{no:55,name:"LANGUAGE_OCAML"},{no:56,name:"LANGUAGE_CMAKE"},{no:57,name:"LANGUAGE_PASCAL"},{no:58,name:"LANGUAGE_ELIXIR"},{no:59,name:"LANGUAGE_FSHARP"},{no:60,name:"LANGUAGE_LISP"},{no:61,name:"LANGUAGE_MATLAB"},{no:62,name:"LANGUAGE_POWERSHELL"},{no:63,name:"LANGUAGE_SOLIDITY"},{no:64,name:"LANGUAGE_ADA"},{no:65,name:"LANGUAGE_OCAML_INTERFACE"}]);const xo=class xo extends Ot{constructor(n){super();ee(this,"completionId","");ee(this,"text","");ee(this,"prefix","");ee(this,"stop","");ee(this,"score",0);ee(this,"tokens",[]);ee(this,"decodedTokens",[]);ee(this,"probabilities",[]);ee(this,"adjustedProbabilities",[]);ee(this,"generatedLength",vt.zero);Se.util.initPartial(n,this)}static fromBinary(n,o){return new xo().fromBinary(n,o)}static fromJson(n,o){return new xo().fromJson(n,o)}static fromJsonString(n,o){return new xo().fromJsonString(n,o)}static equals(n,o){return Se.util.equals(xo,n,o)}};ee(xo,"runtime",Se),ee(xo,"typeName","exa.codeium_common_pb.Completion"),ee(xo,"fields",Se.util.newFieldList(()=>[{no:1,name:"completion_id",kind:"scalar",T:9},{no:2,name:"text",kind:"scalar",T:9},{no:3,name:"prefix",kind:"scalar",T:9},{no:4,name:"stop",kind:"scalar",T:9},{no:5,name:"score",kind:"scalar",T:1},{no:6,name:"tokens",kind:"scalar",T:4,repeated:!0},{no:7,name:"decoded_tokens",kind:"scalar",T:9,repeated:!0},{no:8,name:"probabilities",kind:"scalar",T:1,repeated:!0},{no:9,name:"adjusted_probabilities",kind:"scalar",T:1,repeated:!0},{no:10,name:"generated_length",kind:"scalar",T:4}]));let Id=xo;const wo=class wo extends Ot{constructor(n){super();ee(this,"ideName","");ee(this,"ideVersion","");ee(this,"extensionName","");ee(this,"extensionVersion","");ee(this,"apiKey","");ee(this,"locale","");ee(this,"sessionId","");ee(this,"requestId",vt.zero);ee(this,"userAgent","");ee(this,"url","");ee(this,"authSource",hi.CODEIUM);Se.util.initPartial(n,this)}static fromBinary(n,o){return new wo().fromBinary(n,o)}static fromJson(n,o){return new wo().fromJson(n,o)}static fromJsonString(n,o){return new wo().fromJsonString(n,o)}static equals(n,o){return Se.util.equals(wo,n,o)}};ee(wo,"runtime",Se),ee(wo,"typeName","exa.codeium_common_pb.Metadata"),ee(wo,"fields",Se.util.newFieldList(()=>[{no:1,name:"ide_name",kind:"scalar",T:9},{no:7,name:"ide_version",kind:"scalar",T:9},{no:12,name:"extension_name",kind:"scalar",T:9},{no:2,name:"extension_version",kind:"scalar",T:9},{no:3,name:"api_key",kind:"scalar",T:9},{no:4,name:"locale",kind:"scalar",T:9},{no:10,name:"session_id",kind:"scalar",T:9},{no:9,name:"request_id",kind:"scalar",T:4},{no:13,name:"user_agent",kind:"scalar",T:9},{no:14,name:"url",kind:"scalar",T:9},{no:15,name:"auth_source",kind:"enum",T:Se.getEnumType(hi)}]));let Za=wo;const vo=class vo extends Ot{constructor(n){super();ee(this,"tabSize",vt.zero);ee(this,"insertSpaces",!1);Se.util.initPartial(n,this)}static fromBinary(n,o){return new vo().fromBinary(n,o)}static fromJson(n,o){return new vo().fromJson(n,o)}static fromJsonString(n,o){return new vo().fromJsonString(n,o)}static equals(n,o){return Se.util.equals(vo,n,o)}};ee(vo,"runtime",Se),ee(vo,"typeName","exa.codeium_common_pb.EditorOptions"),ee(vo,"fields",Se.util.newFieldList(()=>[{no:1,name:"tab_size",kind:"scalar",T:4},{no:2,name:"insert_spaces",kind:"scalar",T:8}]));let Ad=vo;Se.util.newFieldList(()=>[{no:1,name:"event_type",kind:"enum",T:Se.getEnumType(Xa)},{no:2,name:"event_json",kind:"scalar",T:9},{no:3,name:"timestamp_unix_ms",kind:"scalar",T:3}]);class Nj extends Hs{constructor(n,o){super();ee(this,"index");ee(this,"total");this.index=n,this.total=o}toDOM(){const n=document.createElement("span");n.setAttribute("aria-hidden","true"),n.className="cm-codeium-cycle";const o=n.appendChild(document.createElement("span"));o.className="cm-codeium-cycle-explanation",o.innerText=`${this.index+1}/${this.total}`;const r=n.appendChild(document.createElement("button"));return r.className="cm-codeium-cycle-key",r.innerText="\u2192 (Ctrl ])",r.dataset.action="codeium-cycle",n}ignoreEvent(){return!1}}const Qa=$s.define({combine:t=>kc(t,{language:Go.TYPESCRIPT,timeout:150,widgetClass:Nj,alwaysOn:!0},{})}),S_=$s.define({combine:t=>kc(t,{override:()=>[]},{})}),jj=dt.mark({class:"cm-ghostText"}),Nr=En.define({create:t=>null,update(t,e){var o;const n=e.state.facet(Qa);for(const r of e.effects){if(r.is(xd)){const{changeSpecs:s,index:i}=r.value,a=s[i].map(c=>jj.range(c.absoluteStartPos,c.absoluteEndPos)),l=(o=a.at(-1))==null?void 0:o.to;return{index:i,decorations:dt.set([...a,...l!==void 0&&s.length>1&&n.widgetClass?[dt.widget({widget:new n.widgetClass(i,s.length),side:1}).range(l)]:[]]),changeSpecs:s,reverseChangeSet:r.value.reverseChangeSet}}if(r.is(wd)||r.is(vd))return null}return t&&{...t,decorations:t.decorations.map(e.changes),reverseChangeSet:t.reverseChangeSet.map(e.changes)}},provide:t=>st.decorations.from(t,e=>(e==null?void 0:e.decorations)||dt.none)}),Wr=vp.define(),el=vp.define();var gt;function Td(t){const e=gt[t];return typeof e!="string"?t.toString():e[0].toLowerCase()+e.substring(1).replace(/[A-Z]/g,n=>"_"+n.toLowerCase())}let tl;(function(t){t[t.Canceled=1]="Canceled",t[t.Unknown=2]="Unknown",t[t.InvalidArgument=3]="InvalidArgument",t[t.DeadlineExceeded=4]="DeadlineExceeded",t[t.NotFound=5]="NotFound",t[t.AlreadyExists=6]="AlreadyExists",t[t.PermissionDenied=7]="PermissionDenied",t[t.ResourceExhausted=8]="ResourceExhausted",t[t.FailedPrecondition=9]="FailedPrecondition",t[t.Aborted=10]="Aborted",t[t.OutOfRange=11]="OutOfRange",t[t.Unimplemented=12]="Unimplemented",t[t.Internal=13]="Internal",t[t.Unavailable=14]="Unavailable",t[t.DataLoss=15]="DataLoss",t[t.Unauthenticated=16]="Unauthenticated"})(gt||(gt={}));class Gt extends Error{constructor(e,n=gt.Unknown,o,r,s){super(function(i,a){return i.length?`[${Td(a)}] ${i}`:`[${Td(a)}]`}(e,n)),this.name="ConnectError",Object.setPrototypeOf(this,new.target.prototype),this.rawMessage=e,this.code=n,this.metadata=new Headers(o??{}),this.details=r??[],this.cause=s}static from(e,n=gt.Unknown){return e instanceof Gt?e:e instanceof Error?e.name=="AbortError"?new Gt(e.message,gt.Canceled):new Gt(e.message,n,void 0,void 0,e):new Gt(String(e),n,void 0,void 0,e)}static[Symbol.hasInstance](e){return e instanceof Error&&(Object.getPrototypeOf(e)===Gt.prototype||e.name==="ConnectError"&&"code"in e&&typeof e.code=="number"&&"metadata"in e&&"details"in e&&Array.isArray(e.details)&&"rawMessage"in e&&typeof e.rawMessage=="string"&&"cause"in e)}findDetails(e){const n="typeName"in e?{findMessage:r=>r===e.typeName?e:void 0}:e,o=[];for(const r of this.details){if("getType"in r){n.findMessage(r.getType().typeName)&&o.push(r);continue}const s=n.findMessage(r.type);if(s)try{o.push(s.fromBinary(r.value))}catch{}}return o}}var Ej=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),e={},o("next"),o("throw"),o("return"),e[Symbol.asyncIterator]=function(){return this},e);function o(r){e[r]=t[r]&&function(s){return new Promise(function(i,a){(function(l,c,d,u){Promise.resolve(u).then(function(f){l({value:f,done:d})},c)})(i,a,(s=t[r](s)).done,s.value)})}}},pi=function(t){return this instanceof pi?(this.v=t,this):new pi(t)},Ij=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(t,e||[]),s=[];return o={},i("next"),i("throw"),i("return",function(u){return function(f){return Promise.resolve(f).then(u,c)}}),o[Symbol.asyncIterator]=function(){return this},o;function i(u,f){r[u]&&(o[u]=function(p){return new Promise(function(_,g){s.push([u,p,_,g])>1||a(u,p)})},f&&(o[u]=f(o[u])))}function a(u,f){try{(p=r[u](f)).value instanceof pi?Promise.resolve(p.value.v).then(l,c):d(s[0][2],p)}catch(_){d(s[0][3],_)}var p}function l(u){a("next",u)}function c(u){a("throw",u)}function d(u,f){u(f),s.shift(),s.length&&a(s[0][0],s[0][1])}},Aj=function(t){var e,n;return e={},o("next"),o("throw",function(r){throw r}),o("return"),e[Symbol.iterator]=function(){return this},e;function o(r,s){e[r]=t[r]?function(i){return(n=!n)?{value:pi(t[r](i)),done:!1}:s?s(i):i}:s}},C_=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),e={},o("next"),o("throw"),o("return"),e[Symbol.asyncIterator]=function(){return this},e);function o(r){e[r]=t[r]&&function(s){return new Promise(function(i,a){(function(l,c,d,u){Promise.resolve(u).then(function(f){l({value:f,done:d})},c)})(i,a,(s=t[r](s)).done,s.value)})}}},qr=function(t){return this instanceof qr?(this.v=t,this):new qr(t)},Tj=function(t){var e,n;return e={},o("next"),o("throw",function(r){throw r}),o("return"),e[Symbol.iterator]=function(){return this},e;function o(r,s){e[r]=t[r]?function(i){return(n=!n)?{value:qr(t[r](i)),done:!1}:s?s(i):i}:s}},Mj=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(t,e||[]),s=[];return o={},i("next"),i("throw"),i("return",function(u){return function(f){return Promise.resolve(f).then(u,c)}}),o[Symbol.asyncIterator]=function(){return this},o;function i(u,f){r[u]&&(o[u]=function(p){return new Promise(function(_,g){s.push([u,p,_,g])>1||a(u,p)})},f&&(o[u]=f(o[u])))}function a(u,f){try{(p=r[u](f)).value instanceof qr?Promise.resolve(p.value.v).then(l,c):d(s[0][2],p)}catch(_){d(s[0][3],_)}var p}function l(u){a("next",u)}function c(u){a("throw",u)}function d(u,f){u(f),s.shift(),s.length&&a(s[0][0],s[0][1])}};function N_(t,e){const n=function(){var o,r;return Mj(this,arguments,function*(){const s=yield qr(t);(o=e==null?void 0:e.onHeader)===null||o===void 0||o.call(e,s.header),yield qr(yield*Tj(C_(s.message))),(r=e==null?void 0:e.onTrailer)===null||r===void 0||r.call(e,s.trailer)})}()[Symbol.asyncIterator]();return{[Symbol.asyncIterator]:()=>({next:()=>n.next()})}}function j_(t){if(!t.aborted)return;if(t.reason!==void 0)return t.reason;const e=new Error("This operation was aborted");return e.name="AbortError",e}function E_(){return{get(t){return t.id in this?this[t.id]:t.defaultValue},set(t,e){return this[t.id]=e,this},delete(t){return delete this[t.id],this}}}function I_(t,e,n){const o=typeof e=="string"?e:e.typeName,r=typeof n=="string"?n:n.name;return t.toString().replace(/\/?$/,`/${o}/${r}`)}function A_(t,e){return e instanceof t?e:new t(e)}function Oj(t,e){function n(o){return o.done===!0?o:{done:o.done,value:A_(t,o.value)}}return{[Symbol.asyncIterator](){const o=e[Symbol.asyncIterator](),r={next:()=>o.next().then(n)};return o.throw!==void 0&&(r.throw=s=>o.throw(s).then(n)),o.return!==void 0&&(r.return=s=>o.return(s).then(n)),r}}}function T_(t,e){var n;return(n=e==null?void 0:e.concat().reverse().reduce((o,r)=>r(o),t))!==null&&n!==void 0?n:t}function M_(t){var e;const n=Object.assign({},t);return(e=n.ignoreUnknownFields)!==null&&e!==void 0||(n.ignoreUnknownFields=!0),n}function O_(t,e,n,o){const r=e?D_(t.I,o):R_(t.I,n);return{parse:(e?D_(t.O,o):R_(t.O,n)).parse,serialize:r.serialize}}function D_(t,e){return{parse(n){try{return t.fromBinary(n,e)}catch(o){const r=o instanceof Error?o.message:String(o);throw new Gt(`parse binary: ${r}`,gt.InvalidArgument)}},serialize(n){try{return n.toBinary(e)}catch(o){const r=o instanceof Error?o.message:String(o);throw new Gt(`serialize binary: ${r}`,gt.Internal)}}}}function R_(t,e){var n,o;const r=(n=e==null?void 0:e.textEncoder)!==null&&n!==void 0?n:new TextEncoder,s=(o=e==null?void 0:e.textDecoder)!==null&&o!==void 0?o:new TextDecoder,i=M_(e);return{parse(a){try{const l=s.decode(a);return t.fromJsonString(l,i)}catch(l){throw Gt.from(l,gt.InvalidArgument)}},serialize(a){try{const l=a.toJsonString(i);return r.encode(l)}catch(l){throw Gt.from(l,gt.Internal)}}}}const Dj=/^application\/(connect\+)?(?:(json)(?:; ?charset=utf-?8)?|(proto))$/i;function P_(t,e,n){if(e&&new Headers(e).forEach((i,a)=>n.metadata.append(a,i)),typeof t!="object"||t==null||Array.isArray(t)||!("code"in t)||typeof t.code!="string")throw n;const o=function(i){if(!tl){tl={};for(const a of Object.values(gt))typeof a!="string"&&(tl[Td(a)]=a)}return tl[i]}(t.code);if(o===void 0)throw n;const r=t.message;if(r!=null&&typeof r!="string")throw n;const s=new Gt(r??"",o,e);if("details"in t&&Array.isArray(t.details))for(const i of t.details){if(i===null||typeof i!="object"||Array.isArray(i)||typeof i.type!="string"||typeof i.value!="string"||"debug"in i&&typeof i.debug!="object")throw n;try{s.details.push({type:i.type,value:$a.dec(i.value),debug:i.debug})}catch{throw n}}return s}function Rj(t){const e=new Gt("invalid end stream",gt.InvalidArgument);let n;try{n=JSON.parse(typeof t=="string"?t:new TextDecoder().decode(t))}catch{throw e}if(typeof n!="object"||n==null||Array.isArray(n))throw e;const o=new Headers;if("metadata"in n){if(typeof n.metadata!="object"||n.metadata==null||Array.isArray(n.metadata))throw e;for(const[r,s]of Object.entries(n.metadata)){if(!Array.isArray(s)||s.some(i=>typeof i!="string"))throw e;for(const i of s)o.append(r,i)}}return{metadata:o,error:"error"in n?P_(n.error,o,e):void 0}}const Md="Content-Type",Pj="Content-Length",L_="Content-Encoding",Lj="Accept-Encoding",F_="Connect-Protocol-Version";function z_(t){const e=new Headers,n=new Headers;return t.forEach((o,r)=>{r.toLowerCase().startsWith("trailer-")?n.set(r.substring(8),o):e.set(r,o)}),[e,n]}function B_(t,e,n,o,r){const s=new Headers(o??{});return n!==void 0&&s.set("Connect-Timeout-Ms",`${n}`),s.set(Md,t==An.Unary?e?"application/proto":"application/json":e?"application/connect+proto":"application/connect+json"),s.set(F_,"1"),s}function U_(t,e,n){const o=function(r){const s=r==null?void 0:r.match(Dj);if(s)return{stream:!!s[1],binary:!!s[3]}}(n.get("Content-Type"));if(e!==200){const r=new Gt(`HTTP ${e}`,function(s){switch(s){case 400:return gt.InvalidArgument;case 401:return gt.Unauthenticated;case 403:return gt.PermissionDenied;case 404:return gt.Unimplemented;case 408:return gt.DeadlineExceeded;case 409:return gt.Aborted;case 412:return gt.FailedPrecondition;case 413:case 431:return gt.ResourceExhausted;case 415:return gt.Internal;case 429:case 502:case 503:case 504:return gt.Unavailable;default:return gt.Unknown}}(e),n);if(t==An.Unary&&o&&!o.binary)return{isUnaryError:!0,unaryError:r};throw r}return{isUnaryError:!1}}const Fj="application/";function zj(t,e,n){let o="?connect=v1";const r=t.header.get(Md);(r==null?void 0:r.indexOf(Fj))===0&&(o+="&encoding="+encodeURIComponent(r.slice(12)));const s=t.header.get(L_);s!==null&&s!=="identity"&&(o+="&compression="+encodeURIComponent(s),n=!0),n&&(o+="&base64=1"),o+="&message="+function(l,c){return c?$a.enc(l).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""):encodeURIComponent(new TextDecoder().decode(l))}(e,n);const i=t.url+o,a=new Headers(t.header);return[F_,Md,Pj,L_,Lj].forEach(l=>a.delete(l)),Object.assign(Object.assign({},t),{init:Object.assign(Object.assign({},t.init),{method:"GET"}),url:i,header:a})}function V_(t){const{signal:e,cleanup:n}=function(r){const s=new AbortController,i=()=>{s.abort(new Gt("the operation timed out",gt.DeadlineExceeded))};let a;return r!==void 0&&(r<=0?i():a=setTimeout(i,r)),{signal:s.signal,cleanup:()=>clearTimeout(a)}}(t.timeoutMs),o=function(...r){const s=new AbortController,i=r.filter(l=>l!==void 0).concat(s.signal);for(const l of i){if(l.aborted){a.apply(l);break}l.addEventListener("abort",a)}function a(){s.signal.aborted||s.abort(j_(this));for(const l of i)l.removeEventListener("abort",a)}return s}(t.signal,e);return[o.signal,function(r){const s=Gt.from(e.aborted?j_(e):r);return o.abort(s),n(),Promise.reject(s)},function(){n(),o.abort()}]}var mi,Od,gi;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.INACTIVE=1]="INACTIVE",t[t.PROCESSING=2]="PROCESSING",t[t.SUCCESS=3]="SUCCESS",t[t.WARNING=4]="WARNING",t[t.ERROR=5]="ERROR"})(mi||(mi={})),Se.util.setEnumType(mi,"exa.language_server_pb.CodeiumState",[{no:0,name:"CODEIUM_STATE_UNSPECIFIED"},{no:1,name:"CODEIUM_STATE_INACTIVE"},{no:2,name:"CODEIUM_STATE_PROCESSING"},{no:3,name:"CODEIUM_STATE_SUCCESS"},{no:4,name:"CODEIUM_STATE_WARNING"},{no:5,name:"CODEIUM_STATE_ERROR"}]),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.SINGLE=1]="SINGLE",t[t.MULTI=2]="MULTI"}(Od||(Od={})),Se.util.setEnumType(Od,"exa.language_server_pb.LineType",[{no:0,name:"LINE_TYPE_UNSPECIFIED"},{no:1,name:"LINE_TYPE_SINGLE"},{no:2,name:"LINE_TYPE_MULTI"}]),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.INLINE=1]="INLINE",t[t.BLOCK=2]="BLOCK",t[t.INLINE_MASK=3]="INLINE_MASK"}(gi||(gi={})),Se.util.setEnumType(gi,"exa.language_server_pb.CompletionPartType",[{no:0,name:"COMPLETION_PART_TYPE_UNSPECIFIED"},{no:1,name:"COMPLETION_PART_TYPE_INLINE"},{no:2,name:"COMPLETION_PART_TYPE_BLOCK"},{no:3,name:"COMPLETION_PART_TYPE_INLINE_MASK"}]);const ko=class ko extends Ot{constructor(n){super();ee(this,"threshold",0);Se.util.initPartial(n,this)}static fromBinary(n,o){return new ko().fromBinary(n,o)}static fromJson(n,o){return new ko().fromJson(n,o)}static fromJsonString(n,o){return new ko().fromJsonString(n,o)}static equals(n,o){return Se.util.equals(ko,n,o)}};ee(ko,"runtime",Se),ee(ko,"typeName","exa.language_server_pb.MultilineConfig"),ee(ko,"fields",Se.util.newFieldList(()=>[{no:1,name:"threshold",kind:"scalar",T:2}]));let Dd=ko;const So=class So extends Ot{constructor(n){super();ee(this,"metadata");ee(this,"document");ee(this,"editorOptions");ee(this,"otherDocuments",[]);ee(this,"experimentConfig");ee(this,"modelName","");ee(this,"multilineConfig");Se.util.initPartial(n,this)}static fromBinary(n,o){return new So().fromBinary(n,o)}static fromJson(n,o){return new So().fromJson(n,o)}static fromJsonString(n,o){return new So().fromJsonString(n,o)}static equals(n,o){return Se.util.equals(So,n,o)}};ee(So,"runtime",Se),ee(So,"typeName","exa.language_server_pb.GetCompletionsRequest"),ee(So,"fields",Se.util.newFieldList(()=>[{no:1,name:"metadata",kind:"message",T:Za},{no:2,name:"document",kind:"message",T:nl},{no:3,name:"editor_options",kind:"message",T:Ad},{no:5,name:"other_documents",kind:"message",T:nl,repeated:!0},{no:7,name:"experiment_config",kind:"message",T:Ud},{no:10,name:"model_name",kind:"scalar",T:9},{no:13,name:"multiline_config",kind:"message",T:Dd}]));let Rd=So;const Co=class Co extends Ot{constructor(n){super();ee(this,"state");ee(this,"completionItems",[]);Se.util.initPartial(n,this)}static fromBinary(n,o){return new Co().fromBinary(n,o)}static fromJson(n,o){return new Co().fromJson(n,o)}static fromJsonString(n,o){return new Co().fromJsonString(n,o)}static equals(n,o){return Se.util.equals(Co,n,o)}};ee(Co,"runtime",Se),ee(Co,"typeName","exa.language_server_pb.GetCompletionsResponse"),ee(Co,"fields",Se.util.newFieldList(()=>[{no:1,name:"state",kind:"message",T:Vd},{no:2,name:"completion_items",kind:"message",T:qd,repeated:!0}]));let Pd=Co;const No=class No extends Ot{constructor(n){super();ee(this,"metadata");ee(this,"completionId","");Se.util.initPartial(n,this)}static fromBinary(n,o){return new No().fromBinary(n,o)}static fromJson(n,o){return new No().fromJson(n,o)}static fromJsonString(n,o){return new No().fromJsonString(n,o)}static equals(n,o){return Se.util.equals(No,n,o)}};ee(No,"runtime",Se),ee(No,"typeName","exa.language_server_pb.AcceptCompletionRequest"),ee(No,"fields",Se.util.newFieldList(()=>[{no:1,name:"metadata",kind:"message",T:Za},{no:2,name:"completion_id",kind:"scalar",T:9}]));let Ld=No;const jo=class jo extends Ot{constructor(e){super(),Se.util.initPartial(e,this)}static fromBinary(e,n){return new jo().fromBinary(e,n)}static fromJson(e,n){return new jo().fromJson(e,n)}static fromJsonString(e,n){return new jo().fromJsonString(e,n)}static equals(e,n){return Se.util.equals(jo,e,n)}};ee(jo,"runtime",Se),ee(jo,"typeName","exa.language_server_pb.AcceptCompletionResponse"),ee(jo,"fields",Se.util.newFieldList(()=>[]));let Fd=jo;const Eo=class Eo extends Ot{constructor(e){super(),Se.util.initPartial(e,this)}static fromBinary(e,n){return new Eo().fromBinary(e,n)}static fromJson(e,n){return new Eo().fromJson(e,n)}static fromJsonString(e,n){return new Eo().fromJsonString(e,n)}static equals(e,n){return Se.util.equals(Eo,e,n)}};ee(Eo,"runtime",Se),ee(Eo,"typeName","exa.language_server_pb.GetAuthTokenRequest"),ee(Eo,"fields",Se.util.newFieldList(()=>[]));let zd=Eo;const Io=class Io extends Ot{constructor(n){super();ee(this,"authToken","");ee(this,"uuid","");Se.util.initPartial(n,this)}static fromBinary(n,o){return new Io().fromBinary(n,o)}static fromJson(n,o){return new Io().fromJson(n,o)}static fromJsonString(n,o){return new Io().fromJsonString(n,o)}static equals(n,o){return Se.util.equals(Io,n,o)}};ee(Io,"runtime",Se),ee(Io,"typeName","exa.language_server_pb.GetAuthTokenResponse"),ee(Io,"fields",Se.util.newFieldList(()=>[{no:1,name:"auth_token",kind:"scalar",T:9},{no:2,name:"uuid",kind:"scalar",T:9}]));let Bd=Io;const Ao=class Ao extends Ot{constructor(n){super();ee(this,"row",vt.zero);ee(this,"col",vt.zero);Se.util.initPartial(n,this)}static fromBinary(n,o){return new Ao().fromBinary(n,o)}static fromJson(n,o){return new Ao().fromJson(n,o)}static fromJsonString(n,o){return new Ao().fromJsonString(n,o)}static equals(n,o){return Se.util.equals(Ao,n,o)}};ee(Ao,"runtime",Se),ee(Ao,"typeName","exa.language_server_pb.DocumentPosition"),ee(Ao,"fields",Se.util.newFieldList(()=>[{no:1,name:"row",kind:"scalar",T:4},{no:2,name:"col",kind:"scalar",T:4}]));let _i=Ao;const To=class To extends Ot{constructor(n){super();ee(this,"absolutePath","");ee(this,"relativePath","");ee(this,"text","");ee(this,"editorLanguage","");ee(this,"language",Go.UNSPECIFIED);ee(this,"cursorOffset",vt.zero);ee(this,"cursorPosition");ee(this,"lineEnding","");Se.util.initPartial(n,this)}static fromBinary(n,o){return new To().fromBinary(n,o)}static fromJson(n,o){return new To().fromJson(n,o)}static fromJsonString(n,o){return new To().fromJsonString(n,o)}static equals(n,o){return Se.util.equals(To,n,o)}};ee(To,"runtime",Se),ee(To,"typeName","exa.language_server_pb.Document"),ee(To,"fields",Se.util.newFieldList(()=>[{no:1,name:"absolute_path",kind:"scalar",T:9},{no:2,name:"relative_path",kind:"scalar",T:9},{no:3,name:"text",kind:"scalar",T:9},{no:4,name:"editor_language",kind:"scalar",T:9},{no:5,name:"language",kind:"enum",T:Se.getEnumType(Go)},{no:6,name:"cursor_offset",kind:"scalar",T:4},{no:8,name:"cursor_position",kind:"message",T:_i},{no:7,name:"line_ending",kind:"scalar",T:9}]));let nl=To;const Mo=class Mo extends Ot{constructor(n){super();ee(this,"forceEnableExperiments",[]);Se.util.initPartial(n,this)}static fromBinary(n,o){return new Mo().fromBinary(n,o)}static fromJson(n,o){return new Mo().fromJson(n,o)}static fromJsonString(n,o){return new Mo().fromJsonString(n,o)}static equals(n,o){return Se.util.equals(Mo,n,o)}};ee(Mo,"runtime",Se),ee(Mo,"typeName","exa.language_server_pb.ExperimentConfig"),ee(Mo,"fields",Se.util.newFieldList(()=>[{no:1,name:"force_enable_experiments",kind:"enum",T:Se.getEnumType(Ka),repeated:!0}]));let Ud=Mo;const Oo=class Oo extends Ot{constructor(n){super();ee(this,"state",mi.UNSPECIFIED);ee(this,"message","");Se.util.initPartial(n,this)}static fromBinary(n,o){return new Oo().fromBinary(n,o)}static fromJson(n,o){return new Oo().fromJson(n,o)}static fromJsonString(n,o){return new Oo().fromJsonString(n,o)}static equals(n,o){return Se.util.equals(Oo,n,o)}};ee(Oo,"runtime",Se),ee(Oo,"typeName","exa.language_server_pb.State"),ee(Oo,"fields",Se.util.newFieldList(()=>[{no:1,name:"state",kind:"enum",T:Se.getEnumType(mi)},{no:2,name:"message",kind:"scalar",T:9}]));let Vd=Oo;const Do=class Do extends Ot{constructor(n){super();ee(this,"startOffset",vt.zero);ee(this,"endOffset",vt.zero);ee(this,"startPosition");ee(this,"endPosition");Se.util.initPartial(n,this)}static fromBinary(n,o){return new Do().fromBinary(n,o)}static fromJson(n,o){return new Do().fromJson(n,o)}static fromJsonString(n,o){return new Do().fromJsonString(n,o)}static equals(n,o){return Se.util.equals(Do,n,o)}};ee(Do,"runtime",Se),ee(Do,"typeName","exa.language_server_pb.Range"),ee(Do,"fields",Se.util.newFieldList(()=>[{no:1,name:"start_offset",kind:"scalar",T:4},{no:2,name:"end_offset",kind:"scalar",T:4},{no:3,name:"start_position",kind:"message",T:_i},{no:4,name:"end_position",kind:"message",T:_i}]));let $d=Do;const Ro=class Ro extends Ot{constructor(n){super();ee(this,"text","");ee(this,"deltaCursorOffset",vt.zero);Se.util.initPartial(n,this)}static fromBinary(n,o){return new Ro().fromBinary(n,o)}static fromJson(n,o){return new Ro().fromJson(n,o)}static fromJsonString(n,o){return new Ro().fromJsonString(n,o)}static equals(n,o){return Se.util.equals(Ro,n,o)}};ee(Ro,"runtime",Se),ee(Ro,"typeName","exa.language_server_pb.Suffix"),ee(Ro,"fields",Se.util.newFieldList(()=>[{no:1,name:"text",kind:"scalar",T:9},{no:2,name:"delta_cursor_offset",kind:"scalar",T:3}]));let Hd=Ro;const Po=class Po extends Ot{constructor(n){super();ee(this,"text","");ee(this,"offset",vt.zero);ee(this,"type",gi.UNSPECIFIED);ee(this,"prefix","");ee(this,"line",vt.zero);Se.util.initPartial(n,this)}static fromBinary(n,o){return new Po().fromBinary(n,o)}static fromJson(n,o){return new Po().fromJson(n,o)}static fromJsonString(n,o){return new Po().fromJsonString(n,o)}static equals(n,o){return Se.util.equals(Po,n,o)}};ee(Po,"runtime",Se),ee(Po,"typeName","exa.language_server_pb.CompletionPart"),ee(Po,"fields",Se.util.newFieldList(()=>[{no:1,name:"text",kind:"scalar",T:9},{no:2,name:"offset",kind:"scalar",T:4},{no:3,name:"type",kind:"enum",T:Se.getEnumType(gi)},{no:4,name:"prefix",kind:"scalar",T:9},{no:5,name:"line",kind:"scalar",T:4}]));let Wd=Po;const Lo=class Lo extends Ot{constructor(n){super();ee(this,"completion");ee(this,"suffix");ee(this,"range");ee(this,"source",fi.UNSPECIFIED);ee(this,"completionParts",[]);Se.util.initPartial(n,this)}static fromBinary(n,o){return new Lo().fromBinary(n,o)}static fromJson(n,o){return new Lo().fromJson(n,o)}static fromJsonString(n,o){return new Lo().fromJsonString(n,o)}static equals(n,o){return Se.util.equals(Lo,n,o)}};ee(Lo,"runtime",Se),ee(Lo,"typeName","exa.language_server_pb.CompletionItem"),ee(Lo,"fields",Se.util.newFieldList(()=>[{no:1,name:"completion",kind:"message",T:Id},{no:5,name:"suffix",kind:"message",T:Hd},{no:2,name:"range",kind:"message",T:$d},{no:3,name:"source",kind:"enum",T:Se.getEnumType(fi)},{no:8,name:"completion_parts",kind:"message",T:Wd,repeated:!0}]));let qd=Lo;const Bj={typeName:"exa.language_server_pb.LanguageServerService",methods:{getCompletions:{name:"GetCompletions",I:Rd,O:Pd,kind:An.Unary},acceptCompletion:{name:"AcceptCompletion",I:Ld,O:Fd,kind:An.Unary},getAuthToken:{name:"GetAuthToken",I:zd,O:Bd,kind:An.Unary}}};var bi=function(t){return this instanceof bi?(this.v=t,this):new bi(t)},Uj=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(t,e||[]),s=[];return o={},i("next"),i("throw"),i("return",function(u){return function(f){return Promise.resolve(f).then(u,c)}}),o[Symbol.asyncIterator]=function(){return this},o;function i(u,f){r[u]&&(o[u]=function(p){return new Promise(function(_,g){s.push([u,p,_,g])>1||a(u,p)})},f&&(o[u]=f(o[u])))}function a(u,f){try{(p=r[u](f)).value instanceof bi?Promise.resolve(p.value.v).then(l,c):d(s[0][2],p)}catch(_){d(s[0][3],_)}var p}function l(u){a("next",u)}function c(u){a("throw",u)}function d(u,f){u(f),s.shift(),s.length&&a(s[0][0],s[0][1])}};const Vj=function(t){var e;(function(){try{new Headers}catch{throw new Error("connect-web requires the fetch API. Are you running on an old version of Node.js? Node.js is not supported in Connect for Web - please stay tuned for Connect for Node.")}})();const n=(e=t.useBinaryFormat)!==null&&e!==void 0&&e;return{async unary(o,r,s,i,a,l,c){var d;const{serialize:u,parse:f}=O_(r,n,t.jsonOptions,t.binaryOptions);return i=i===void 0?t.defaultTimeoutMs:i<=0?void 0:i,await function(p){const _=T_(p.next,p.interceptors),[g,m,b]=V_(p);return _(Object.assign(Object.assign({},p.req),{message:A_(p.req.method.I,p.req.message),signal:g})).then(x=>(b(),x),m)}({interceptors:t.interceptors,signal:s,timeoutMs:i,req:{stream:!1,service:o,method:r,url:I_(t.baseUrl,o,r),init:{method:"POST",credentials:(d=t.credentials)!==null&&d!==void 0?d:"same-origin",redirect:"error",mode:"cors"},header:B_(r.kind,n,i,a),contextValues:c??E_(),message:l},next:async p=>{var _;let g=null;t.useHttpGet===!0&&r.idempotency===Ed.NoSideEffects?p=zj(p,u(p.message),n):g=u(p.message);const m=(_=t.fetch)!==null&&_!==void 0?_:globalThis.fetch,b=await m(p.url,Object.assign(Object.assign({},p.init),{headers:p.header,signal:p.signal,body:g})),{isUnaryError:x,unaryError:y}=U_(r.kind,b.status,b.headers);if(x)throw P_(await b.json(),function(...S){const E=new Headers;for(const j of S)j.forEach((I,T)=>{E.append(T,I)});return E}(...z_(b.headers)),y);const[v,k]=z_(b.headers);return{stream:!1,service:o,method:r,header:v,message:n?f(new Uint8Array(await b.arrayBuffer())):r.O.fromJson(await b.json(),M_(t.jsonOptions)),trailer:k}}})},async stream(o,r,s,i,a,l,c){var d;const{serialize:u,parse:f}=O_(r,n,t.jsonOptions,t.binaryOptions);function p(g,m,b){return Uj(this,arguments,function*(){const x=function(v){let k,S=new Uint8Array(0);function E(j){const I=new Uint8Array(S.length+j.length);I.set(S),I.set(j,S.length),S=I}return new ReadableStream({start(){k=v.getReader()},async pull(j){let I;for(;;){if(I===void 0&&S.byteLength>=5){let L=0;for(let B=1;B<5;B++)L=(L<<8)+S[B];I={flags:S[0],length:L}}if(I!==void 0&&S.byteLength>=I.length+5)break;const M=await k.read();if(M.done)break;E(M.value)}if(I===void 0)return S.byteLength==0?void j.close():void j.error(new Gt("premature end of stream",gt.DataLoss));const T=S.subarray(5,5+I.length);S=S.subarray(5+I.length),j.enqueue({flags:I.flags,data:T})}})}(g).getReader();let y=!1;for(;;){const v=yield bi(x.read());if(v.done)break;const{flags:k,data:S}=v.value;if(2&~k)yield yield bi(f(S));else{y=!0;const E=Rj(S);if(E.error){const j=E.error;throw b.forEach((I,T)=>{j.metadata.append(T,I)}),j}E.metadata.forEach((j,I)=>m.set(I,j))}}if(!y)throw"missing EndStreamResponse"})}async function _(g){if(r.kind!=An.ServerStreaming)throw"The fetch API does not support streaming request bodies";const m=await g[Symbol.asyncIterator]().next();if(m.done==1)throw"missing request message";return function(b,x){const y=new Uint8Array(x.length+5);y.set(x,5);const v=new DataView(y.buffer,y.byteOffset,y.byteLength);return v.setUint8(0,b),v.setUint32(1,x.length),y}(0,u(m.value))}return i=i===void 0?t.defaultTimeoutMs:i<=0?void 0:i,await function(g){const m=T_(g.next,g.interceptors),[b,x,y]=V_(g),v=Object.assign(Object.assign({},g.req),{message:Oj(g.req.method.I,g.req.message),signal:b});let k=!1;return b.addEventListener("abort",function(){var S,E;const j=g.req.message[Symbol.asyncIterator]();k||(S=j.throw)===null||S===void 0||S.call(j,this.reason).catch(()=>{}),(E=j.return)===null||E===void 0||E.call(j).catch(()=>{})}),m(v).then(S=>Object.assign(Object.assign({},S),{message:{[Symbol.asyncIterator](){const E=S.message[Symbol.asyncIterator]();return{next:()=>E.next().then(j=>(j.done==1&&(k=!0,y()),j),x)}}}}),x)}({interceptors:t.interceptors,timeoutMs:i,signal:s,req:{stream:!0,service:o,method:r,url:I_(t.baseUrl,o,r),init:{method:"POST",credentials:(d=t.credentials)!==null&&d!==void 0?d:"same-origin",redirect:"error",mode:"cors"},header:B_(r.kind,n,i,a),contextValues:c??E_(),message:l},next:async g=>{var m;const b=(m=t.fetch)!==null&&m!==void 0?m:globalThis.fetch,x=await b(g.url,Object.assign(Object.assign({},g.init),{headers:g.header,signal:g.signal,body:await _(g.message)}));if(U_(r.kind,x.status,x.headers),x.body===null)throw"missing response body";const y=new Headers;return Object.assign(Object.assign({},g),{header:x.headers,trailer:y,message:p(x.body,y,x.headers)})}})}}}({baseUrl:"https://web-backend.codeium.com",useBinaryFormat:!0}),$j=function(t,e){return function(n,o){const r={};for(const[s,i]of Object.entries(n.methods)){const a=o(Object.assign(Object.assign({},i),{localName:s,service:n}));a!=null&&(r[s]=a)}return r}(t,n=>{switch(n.kind){case An.Unary:return function(o,r,s){return async function(i,a){var l,c;const d=await o.unary(r,s,a==null?void 0:a.signal,a==null?void 0:a.timeoutMs,a==null?void 0:a.headers,i,a==null?void 0:a.contextValues);return(l=a==null?void 0:a.onHeader)===null||l===void 0||l.call(a,d.header),(c=a==null?void 0:a.onTrailer)===null||c===void 0||c.call(a,d.trailer),d.message}}(e,t,n);case An.ServerStreaming:return function(o,r,s){return function(i,a){return N_(o.stream(r,s,a==null?void 0:a.signal,a==null?void 0:a.timeoutMs,a==null?void 0:a.headers,function(l){return Ij(this,arguments,function*(){yield pi(yield*Aj(Ej(l)))})}([i]),a==null?void 0:a.contextValues),a)}}(e,t,n);case An.ClientStreaming:return function(o,r,s){return async function(i,a){var l,c,d,u,f,p;const _=await o.stream(r,s,a==null?void 0:a.signal,a==null?void 0:a.timeoutMs,a==null?void 0:a.headers,i,a==null?void 0:a.contextValues);let g;(f=a==null?void 0:a.onHeader)===null||f===void 0||f.call(a,_.header);try{for(var m,b=!0,x=C_(_.message);!(l=(m=await x.next()).done);b=!0)u=m.value,b=!1,g=u}catch(y){c={error:y}}finally{try{b||l||!(d=x.return)||await d.call(x)}finally{if(c)throw c.error}}if(!g)throw new Gt("protocol error: missing response message",gt.Internal);return(p=a==null?void 0:a.onTrailer)===null||p===void 0||p.call(a,_.trailer),g}}(e,t,n);case An.BiDiStreaming:return function(o,r,s){return function(i,a){return N_(o.stream(r,s,a==null?void 0:a.signal,a==null?void 0:a.timeoutMs,a==null?void 0:a.headers,i,a==null?void 0:a.contextValues),a)}}(e,t,n);default:return null}})}(Bj,Vj);let ol;try{ol=crypto.randomUUID()}catch{ol="10000000-1000-4000-8000-100000000000".replace(/[018]/g,t=>(+t^(crypto.getRandomValues(new Uint8Array(1))[0]??0)&15>>+t/4).toString(16))}async function Hj(t,e){const n=t.state.facet(Qa),{override:o}=t.state.facet(S_),r=await o(),s=t.state,i=s.selection.main.head,a=s.doc.toString();try{const l=await async function({text:_,cursorOffset:g,config:m,otherDocuments:b}){return await $j.getCompletions({metadata:{ideName:"web",ideVersion:"0.0.5",extensionName:"@valtown/codemirror-codeium",extensionVersion:"1.0.0",apiKey:m.apiKey,sessionId:ol,authSource:m.authSource},document:{text:_,cursorOffset:BigInt(g),language:m.language,editorLanguage:"typescript",lineEnding:`
101
101
  `},editorOptions:{tabSize:2n,insertSpaces:!0},otherDocuments:b,multilineConfig:void 0},{headers:{Authorization:`Basic ${m.apiKey}-${ol}`}})}({text:a,cursorOffset:i,config:n,otherDocuments:r});if(!l||l.completionItems.length===0||e!==void 0&&i!==e||sa(t.state)==="active"||!t.hasFocus)return;const c=l.completionItems.map(_=>{let g=0;return _.completionParts.filter(m=>m.type!==3).map(m=>{const b=Number(m.offset),x=m.type===2?`
102
- ${m.text}`:m.text,y={absoluteStartPos:g+b,absoluteEndPos:g+b+x.length,from:b,to:b,insert:x};return g+=x.length,y})}),d=0,u=c.at(d);if(!u)return;const f=ia.of(u,s.doc.length),p=f.invert(s.doc);t.dispatch({changes:f,effects:yd.of({index:d,reverseChangeSet:p,changeSpecs:c}),annotations:[el.of(null),Wr.of(null),aa.addToHistory.of(!1)]})}catch(l){console.warn("copilot completion failed",l),await new Promise(c=>setTimeout(c,300))}}function Wj(){let t=null,e=0;return st.updateListener.of(n=>{const o=n.view.state.facet(Qa);if(!o.alwaysOn||!function(s){return s.docChanged&&!s.transactions.some(i=>i.effects.some(a=>a.is(xd)||a.is(wd)))}(n)||(t&&clearTimeout(t),function(s){if(!s.view.hasFocus||s.state.field(Nr)||sa(s.state)==="active")return!0;for(const i of s.transactions)if(i.annotation(Wr)!==void 0)return!0}(n)))return;const r=n.state.selection.main.head;o.shouldComplete&&!o.shouldComplete(new Lz(n.view.state,r,!1))||(t=setTimeout(async()=>{r===e&&await Hj(n.view,e)},o.timeout),e=r)})}function $_(t){var r;const e=t.state.field(Nr);if(!e)return!1;const n=(r=e.reverseChangeSet)==null?void 0:r.invert(t.state.doc);t.dispatch({changes:e.reverseChangeSet,effects:xd.of(null),annotations:[el.of(null),Wr.of(null),aa.addToHistory.of(!1)]});let o=0;return n==null||n.iterChangedRanges((s,i,a,l)=>{o=l}),t.dispatch({changes:n,selection:Uo.cursor(o),annotations:[Wr.of(null),aa.addToHistory.of(!0)]}),!0}const H_=t=>{const{state:e}=t,n=e.field(Nr);if(!n)return!1;const{changeSpecs:o}=n;if(o.length<2)return!1;const r=(n.index+1)%o.length,s=o.at(r);if(!s)return!1;const i=n.reverseChangeSet.apply(e.doc),a=ia.of(n.reverseChangeSet,e.doc.length).compose(ia.of(s,i.length)),l=ia.of(s,i.length).invert(i);return t.dispatch({changes:a,effects:yd.of({index:r,reverseChangeSet:l,changeSpecs:o}),annotations:[el.of(null),Wr.of(null),aa.addToHistory.of(!1)]}),!0};function qd(t){const e=t.state.field(Nr);return!!e&&(t.dispatch({changes:e.reverseChangeSet,effects:wd.of(null),annotations:[el.of(null),Wr.of(null),aa.addToHistory.of(!1)]}),!1)}function qj(){return st.domEventHandlers({keydown:(t,e)=>(t.key!=="]"||!t.ctrlKey)&&t.key!=="Shift"&&t.key!=="Control"&&t.key!=="Alt"&&t.key!=="Meta"&&function(n,o){return!!n.state.field(Nr)&&(o==="Tab"?$_(n):qd(n))}(e,t.key),mouseup(t,e){const n=t.target;return n.nodeName==="BUTTON"&&n.dataset.action==="codeium-cycle"?(H_(e),t.stopPropagation(),t.preventDefault(),!0):function(o){var a,l;let r=!1;const s=(a=o.state.selection.asSingle().ranges.at(0))==null?void 0:a.head,i=o.state.field(Nr);return!(s===void 0||!i)&&((l=i.decorations)==null||l.between(s,s,()=>{r=!0}),r)}(e)?$_(e):qd(e)}})}const Gj=new vp,Gd=Xt.get("@github/copilot-language-server"),W_={delay:500,includeKeymap:!0,events:{shouldShowSuggestion:t=>t.hasFocus,beforeSuggestionFetch:t=>t.hasFocus}},Yj=t=>{const e=[];return t.copilot==="codeium"&&t.codeium_api_key&&e.push(function(n){return[Qa.of(n),Nr,Vo.highest(Hn.of([{key:"Ctrl-]",run:H_}])),Vo.highest(st.updateListener.of(o=>{o.focusChanged&&qd(o.view)})),Vo.high(qj()),Wj()]}({apiKey:t.codeium_api_key,language:Go.PYTHON}),S_.of({override:async()=>[{text:Sc(""),language:Go.PYTHON,editorLanguage:"python"}]})),t.copilot==="github"&&e.push(Wg({...W_,fetchFn:async n=>{if(!g$()||n.doc.length===0)return"";await new Promise(i=>setTimeout(i,20));const o=n.doc.toString(),r=function(i,a){const l=i.doc.toString(),c=a.split(`
102
+ ${m.text}`:m.text,y={absoluteStartPos:g+b,absoluteEndPos:g+b+x.length,from:b,to:b,insert:x};return g+=x.length,y})}),d=0,u=c.at(d);if(!u)return;const f=ia.of(u,s.doc.length),p=f.invert(s.doc);t.dispatch({changes:f,effects:xd.of({index:d,reverseChangeSet:p,changeSpecs:c}),annotations:[el.of(null),Wr.of(null),aa.addToHistory.of(!1)]})}catch(l){console.warn("copilot completion failed",l),await new Promise(c=>setTimeout(c,300))}}function Wj(){let t=null,e=0;return st.updateListener.of(n=>{const o=n.view.state.facet(Qa);if(!o.alwaysOn||!function(s){return s.docChanged&&!s.transactions.some(i=>i.effects.some(a=>a.is(wd)||a.is(vd)))}(n)||(t&&clearTimeout(t),function(s){if(!s.view.hasFocus||s.state.field(Nr)||sa(s.state)==="active")return!0;for(const i of s.transactions)if(i.annotation(Wr)!==void 0)return!0}(n)))return;const r=n.state.selection.main.head;o.shouldComplete&&!o.shouldComplete(new Lz(n.view.state,r,!1))||(t=setTimeout(async()=>{r===e&&await Hj(n.view,e)},o.timeout),e=r)})}function $_(t){var r;const e=t.state.field(Nr);if(!e)return!1;const n=(r=e.reverseChangeSet)==null?void 0:r.invert(t.state.doc);t.dispatch({changes:e.reverseChangeSet,effects:wd.of(null),annotations:[el.of(null),Wr.of(null),aa.addToHistory.of(!1)]});let o=0;return n==null||n.iterChangedRanges((s,i,a,l)=>{o=l}),t.dispatch({changes:n,selection:Uo.cursor(o),annotations:[Wr.of(null),aa.addToHistory.of(!0)]}),!0}const H_=t=>{const{state:e}=t,n=e.field(Nr);if(!n)return!1;const{changeSpecs:o}=n;if(o.length<2)return!1;const r=(n.index+1)%o.length,s=o.at(r);if(!s)return!1;const i=n.reverseChangeSet.apply(e.doc),a=ia.of(n.reverseChangeSet,e.doc.length).compose(ia.of(s,i.length)),l=ia.of(s,i.length).invert(i);return t.dispatch({changes:a,effects:xd.of({index:r,reverseChangeSet:l,changeSpecs:o}),annotations:[el.of(null),Wr.of(null),aa.addToHistory.of(!1)]}),!0};function Gd(t){const e=t.state.field(Nr);return!!e&&(t.dispatch({changes:e.reverseChangeSet,effects:vd.of(null),annotations:[el.of(null),Wr.of(null),aa.addToHistory.of(!1)]}),!1)}function qj(){return st.domEventHandlers({keydown:(t,e)=>(t.key!=="]"||!t.ctrlKey)&&t.key!=="Shift"&&t.key!=="Control"&&t.key!=="Alt"&&t.key!=="Meta"&&function(n,o){return!!n.state.field(Nr)&&(o==="Tab"?$_(n):Gd(n))}(e,t.key),mouseup(t,e){const n=t.target;return n.nodeName==="BUTTON"&&n.dataset.action==="codeium-cycle"?(H_(e),t.stopPropagation(),t.preventDefault(),!0):function(o){var a,l;let r=!1;const s=(a=o.state.selection.asSingle().ranges.at(0))==null?void 0:a.head,i=o.state.field(Nr);return!(s===void 0||!i)&&((l=i.decorations)==null||l.between(s,s,()=>{r=!0}),r)}(e)?$_(e):Gd(e)}})}const Gj=new kp,Yd=Xt.get("@github/copilot-language-server"),W_={delay:500,includeKeymap:!0,events:{shouldShowSuggestion:t=>t.hasFocus,beforeSuggestionFetch:t=>t.hasFocus}},Yj=t=>{const e=[];return t.copilot==="codeium"&&t.codeium_api_key&&e.push(function(n){return[Qa.of(n),Nr,Vo.highest(Hn.of([{key:"Ctrl-]",run:H_}])),Vo.highest(st.updateListener.of(o=>{o.focusChanged&&Gd(o.view)})),Vo.high(qj()),Wj()]}({apiKey:t.codeium_api_key,language:Go.PYTHON}),S_.of({override:async()=>[{text:Sc(""),language:Go.PYTHON,editorLanguage:"python"}]})),t.copilot==="github"&&e.push(Wg({...W_,fetchFn:async n=>{if(!g$()||n.doc.length===0)return"";await new Promise(i=>setTimeout(i,20));const o=n.doc.toString(),r=function(i,a){const l=i.doc.toString(),c=a.split(`
103
103
  `).length-l.split(`
104
- `).length,d=function(u,f){const p=u.lineAt(f);return{line:p.number-1,character:f-p.from}}(i.doc,i.selection.main.head);return d.line+=c,{textDocument:{uri:`file://${_$}`,version:"replace_me"},position:d,context:{triggerKind:Fz.InlineCompletionTriggerKind.Automatic},formattingOptions:{tabSize:i.tabSize,insertSpaces:!0}}}(n,Sc(o));return function(i,a,l){if(!i)return Gd.debug("No response from copilot"),"";const c=Array.isArray(i)?i[0]:i.items[0];if(!c)return Gd.debug("No response from copilot"),"";const{insertText:d,range:u}=c,f=String(d);if(!u)return Gd.error("No range from copilot"),f;const p=u.start.character-a.character,_=p<0?f.slice(-p):f,g=l.doc.sliceString(l.selection.main.head,l.doc.length);for(let m=0;m<_.length;m++){const b=_.slice(m);if(g.startsWith(b))return _.slice(0,m)}return _}(await dS().getCompletion(r),r.position,n)}})),t.copilot==="custom"&&e.push(Wg({...W_,fetchFn:async n=>{if(n.doc.length===0)return"";const o=n.doc.sliceString(0,n.selection.main.head),r=n.doc.sliceString(n.selection.main.head,n.doc.length);if(o.length===0)return"";const s=n.field(Cc).type;let i=await Nc.post("/ai/inline_completion",{prefix:o,suffix:r,language:s});return o&&i.startsWith(o)&&(i=i.slice(o.length)),r&&i.endsWith(r)&&(i=i.slice(0,-r.length)),i}})),[...e,Vo.highest(Hn.of([{key:"Escape",run:n=>{const o=Hg(n);return!i4(n)&&o}}])),Gj.of(m$())]},Jj=dt.mark({class:"underline"}),q_=Ut.define(),G_=Ut.define(),Kj=En.define({create:()=>dt.none,update(t,e){let n=t.map(e.changes);for(const o of e.effects)o.is(q_)?n=t.update({add:[Jj.range(o.value.from,o.value.to)]}):o.is(G_)&&(n=dt.none);return n},provide:t=>st.decorations.from(t)});class Xj{constructor(e,n){this.view=void 0,this.commandClickMode=void 0,this.hoveredRange=void 0,this.onClick=void 0,this.keydown=o=>{o.key!=="Meta"&&o.key!=="Control"||(this.commandClickMode=!0,this.view.dom.addEventListener("mousemove",this.mousemove),this.view.dom.addEventListener("click",this.click))},this.keyup=o=>{o.key!=="Meta"&&o.key!=="Control"||this.exitCommandClickMode()},this.windowBlur=()=>{this.commandClickMode&&this.exitCommandClickMode()},this.mousemove=o=>{if(!o.metaKey&&!o.ctrlKey)return void this.exitCommandClickMode();if(!this.commandClickMode)return void this.clearUnderline();const r=this.view.posAtCoords({x:o.clientX,y:o.clientY});if(r==null)return void this.clearUnderline();const s=zz(this.view.state).cursorAt(r);if(s.name==="VariableName"){const{from:i,to:a}=s;if(this.hoveredRange&&this.hoveredRange.from===i&&this.hoveredRange.to===a)return;this.clearUnderline(),this.hoveredRange={from:i,to:a,position:r},this.view.dispatch({effects:q_.of(this.hoveredRange)})}else this.clearUnderline()},this.click=o=>{if(this.hoveredRange){const r=this.view.state.doc.sliceString(this.hoveredRange.from,this.hoveredRange.to);o.preventDefault(),o.stopPropagation(),this.onClick(this.view,r),this.view.dispatch({selection:{head:this.hoveredRange.position,anchor:this.hoveredRange.position}})}},this.view=e,this.commandClickMode=!1,this.hoveredRange=null,this.onClick=n,window.addEventListener("keydown",this.keydown),window.addEventListener("keyup",this.keyup),window.addEventListener("blur",this.windowBlur),window.addEventListener("mouseleave",this.windowBlur)}update(e){}destroy(){window.removeEventListener("keydown",this.keydown),window.removeEventListener("keyup",this.keyup),window.removeEventListener("blur",this.windowBlur),window.removeEventListener("mouseleave",this.windowBlur),this.view.dom.removeEventListener("mousemove",this.mousemove),this.view.dom.removeEventListener("click",this.click)}exitCommandClickMode(){this.commandClickMode=!1,this.view.dom.removeEventListener("mousemove",this.mousemove),this.view.dom.removeEventListener("click",this.click),this.clearUnderline()}clearUnderline(){this.hoveredRange&&(this.view.dispatch({effects:G_.of(null)}),this.hoveredRange=null)}}const Vt=({variant:t,settings:e,styles:n})=>{const o=st.theme({"&":{backgroundColor:e.background,color:e.foreground},".cm-content":{caretColor:e.caret},".cm-cursor, .cm-dropCursor":{borderLeftColor:e.caret},"&.cm-focused .cm-selectionBackgroundm .cm-selectionBackground, .cm-content ::selection":{backgroundColor:e.selection},".cm-activeLine":{backgroundColor:e.lineHighlight},".cm-gutters":{backgroundColor:e.gutterBackground,color:e.gutterForeground},".cm-activeLineGutter":{backgroundColor:e.lineHighlight}},{dark:t==="dark"}),r=Uz.define(n);return[o,a4(r)]};Vt({variant:"dark",settings:{background:"#200020",foreground:"#D0D0FF",caret:"#7070FF",selection:"#80000080",gutterBackground:"#200020",gutterForeground:"#C080C0",lineHighlight:"#80000040"},styles:[{tag:D.comment,color:"#404080"},{tag:[D.string,D.regexp],color:"#999999"},{tag:D.number,color:"#7090B0"},{tag:[D.bool,D.null],color:"#8080A0"},{tag:[D.punctuation,D.derefOperator],color:"#805080"},{tag:D.keyword,color:"#60B0FF"},{tag:D.definitionKeyword,color:"#B0FFF0"},{tag:D.moduleKeyword,color:"#60B0FF"},{tag:D.operator,color:"#A0A0FF"},{tag:[D.variableName,D.self],color:"#008080"},{tag:D.operatorKeyword,color:"#A0A0FF"},{tag:D.controlKeyword,color:"#80A0FF"},{tag:D.className,color:"#70E080"},{tag:[D.function(D.propertyName),D.propertyName],color:"#50A0A0"},{tag:D.tagName,color:"#009090"},{tag:D.modifier,color:"#B0FFF0"},{tag:[D.squareBracket,D.attributeName],color:"#D0D0FF"}]}),Vt({variant:"light",settings:{background:"#fcfcfc",foreground:"#5c6166",caret:"#ffaa33",selection:"#036dd626",gutterBackground:"#fcfcfc",gutterForeground:"#8a919966",lineHighlight:"#8a91991a"},styles:[{tag:D.comment,color:"#787b8099"},{tag:D.string,color:"#86b300"},{tag:D.regexp,color:"#4cbf99"},{tag:[D.number,D.bool,D.null],color:"#ffaa33"},{tag:D.variableName,color:"#5c6166"},{tag:[D.definitionKeyword,D.modifier],color:"#fa8d3e"},{tag:[D.keyword,D.special(D.brace)],color:"#fa8d3e"},{tag:D.operator,color:"#ed9366"},{tag:D.separator,color:"#5c6166b3"},{tag:D.punctuation,color:"#5c6166"},{tag:[D.definition(D.propertyName),D.function(D.variableName)],color:"#f2ae49"},{tag:[D.className,D.definition(D.typeName)],color:"#22a4e6"},{tag:[D.tagName,D.typeName,D.self,D.labelName],color:"#55b4d4"},{tag:D.angleBracket,color:"#55b4d480"},{tag:D.attributeName,color:"#f2ae49"}]}),Vt({variant:"dark",settings:{background:"#15191EFA",foreground:"#EEF2F7",caret:"#C4C4C4",selection:"#90B2D557",gutterBackground:"#15191EFA",gutterForeground:"#aaaaaa95",lineHighlight:"#57575712"},styles:[{tag:D.comment,color:"#6E6E6E"},{tag:[D.string,D.regexp,D.special(D.brace)],color:"#5C81B3"},{tag:D.number,color:"#C1E1B8"},{tag:D.bool,color:"#53667D"},{tag:[D.definitionKeyword,D.modifier,D.function(D.propertyName)],color:"#A3D295",fontWeight:"bold"},{tag:[D.keyword,D.moduleKeyword,D.operatorKeyword,D.operator],color:"#697A8E",fontWeight:"bold"},{tag:[D.variableName,D.attributeName],color:"#708E67"},{tag:[D.function(D.variableName),D.definition(D.propertyName),D.derefOperator],color:"#fff"},{tag:D.tagName,color:"#A3D295"}]}),Vt({variant:"dark",settings:{background:"#2e241d",foreground:"#BAAE9E",caret:"#A7A7A7",selection:"#DDF0FF33",gutterBackground:"#28211C",gutterForeground:"#BAAE9E90",lineHighlight:"#FFFFFF08"},styles:[{tag:D.comment,color:"#666666"},{tag:[D.string,D.special(D.brace)],color:"#54BE0D"},{tag:D.regexp,color:"#E9C062"},{tag:D.number,color:"#CF6A4C"},{tag:[D.keyword,D.operator],color:"#5EA6EA"},{tag:D.variableName,color:"#7587A6"},{tag:[D.definitionKeyword,D.modifier],color:"#F9EE98"},{tag:[D.propertyName,D.function(D.variableName)],color:"#937121"},{tag:[D.typeName,D.angleBracket,D.tagName],color:"#9B859D"}]}),Vt({variant:"dark",settings:{background:"#3b2627",foreground:"#E6E1C4",caret:"#E6E1C4",selection:"#16120E",gutterBackground:"#3b2627",gutterForeground:"#E6E1C490",lineHighlight:"#1F1611"},styles:[{tag:D.comment,color:"#6B4E32"},{tag:[D.keyword,D.operator,D.derefOperator],color:"#EF5D32"},{tag:D.className,color:"#EFAC32",fontWeight:"bold"},{tag:[D.typeName,D.propertyName,D.function(D.variableName),D.definition(D.variableName)],color:"#EFAC32"},{tag:D.definition(D.typeName),color:"#EFAC32",fontWeight:"bold"},{tag:D.labelName,color:"#EFAC32",fontWeight:"bold"},{tag:[D.number,D.bool],color:"#6C99BB"},{tag:[D.variableName,D.self],color:"#7DAF9C"},{tag:[D.string,D.special(D.brace),D.regexp],color:"#D9D762"},{tag:[D.angleBracket,D.tagName,D.attributeName],color:"#EFCB43"}]}),Vt({variant:"dark",settings:{background:"#000205",foreground:"#FFFFFF",caret:"#E60065",selection:"#E60C6559",gutterBackground:"#000205",gutterForeground:"#ffffff90",lineHighlight:"#4DD7FC1A"},styles:[{tag:D.comment,color:"#404040"},{tag:[D.string,D.special(D.brace),D.regexp],color:"#00D8FF"},{tag:D.number,color:"#E62286"},{tag:[D.variableName,D.attributeName,D.self],color:"#E62286",fontWeight:"bold"},{tag:D.function(D.variableName),color:"#fff",fontWeight:"bold"}]}),Vt({variant:"light",settings:{background:"#fff",foreground:"#000",caret:"#000",selection:"#BDD5FC",gutterBackground:"#fff",gutterForeground:"#00000070",lineHighlight:"#FFFBD1"},styles:[{tag:D.comment,color:"#BCC8BA"},{tag:[D.string,D.special(D.brace),D.regexp],color:"#5D90CD"},{tag:[D.number,D.bool,D.null],color:"#46A609"},{tag:D.keyword,color:"#AF956F"},{tag:[D.definitionKeyword,D.modifier],color:"#C52727"},{tag:[D.angleBracket,D.tagName,D.attributeName],color:"#606060"},{tag:D.self,color:"#000"}]}),Vt({variant:"dark",settings:{background:"#00254b",foreground:"#FFFFFF",caret:"#FFFFFF",selection:"#B36539BF",gutterBackground:"#00254b",gutterForeground:"#FFFFFF70",lineHighlight:"#00000059"},styles:[{tag:D.comment,color:"#0088FF"},{tag:D.string,color:"#3AD900"},{tag:D.regexp,color:"#80FFC2"},{tag:[D.number,D.bool,D.null],color:"#FF628C"},{tag:[D.definitionKeyword,D.modifier],color:"#FFEE80"},{tag:D.variableName,color:"#CCCCCC"},{tag:D.self,color:"#FF80E1"},{tag:[D.className,D.definition(D.propertyName),D.function(D.variableName),D.definition(D.typeName),D.labelName],color:"#FFDD00"},{tag:[D.keyword,D.operator],color:"#FF9D00"},{tag:[D.propertyName,D.typeName],color:"#80FFBB"},{tag:D.special(D.brace),color:"#EDEF7D"},{tag:D.attributeName,color:"#9EFFFF"},{tag:D.derefOperator,color:"#fff"}]}),Vt({variant:"dark",settings:{background:"#060521",foreground:"#E0E0E0",caret:"#FFFFFFA6",selection:"#122BBB",gutterBackground:"#060521",gutterForeground:"#E0E0E090",lineHighlight:"#FFFFFF0F"},styles:[{tag:D.comment,color:"#AEAEAE"},{tag:[D.string,D.special(D.brace),D.regexp],color:"#8DFF8E"},{tag:[D.className,D.definition(D.propertyName),D.function(D.variableName),D.function(D.definition(D.variableName)),D.definition(D.typeName)],color:"#A3EBFF"},{tag:[D.number,D.bool,D.null],color:"#62E9BD"},{tag:[D.keyword,D.operator],color:"#2BF1DC"},{tag:[D.definitionKeyword,D.modifier],color:"#F8FBB1"},{tag:[D.variableName,D.self],color:"#B683CA"},{tag:[D.angleBracket,D.tagName,D.typeName,D.propertyName],color:"#60A4F1"},{tag:D.derefOperator,color:"#E0E0E0"},{tag:D.attributeName,color:"#7BACCA"}]}),Vt({variant:"dark",settings:{background:"#2d2f3f",foreground:"#f8f8f2",caret:"#f8f8f0",selection:"#44475a",gutterBackground:"#282a36",gutterForeground:"rgb(144, 145, 148)",lineHighlight:"#44475a"},styles:[{tag:D.comment,color:"#6272a4"},{tag:[D.string,D.special(D.brace)],color:"#f1fa8c"},{tag:[D.number,D.self,D.bool,D.null],color:"#bd93f9"},{tag:[D.keyword,D.operator],color:"#ff79c6"},{tag:[D.definitionKeyword,D.typeName],color:"#8be9fd"},{tag:D.definition(D.typeName),color:"#f8f8f2"},{tag:[D.className,D.definition(D.propertyName),D.function(D.variableName),D.attributeName],color:"#50fa7b"}]}),Vt({variant:"light",settings:{background:"#FFFFFF",foreground:"#000000",caret:"#000000",selection:"#80C7FF",gutterBackground:"#FFFFFF",gutterForeground:"#00000070",lineHighlight:"#C1E2F8"},styles:[{tag:D.comment,color:"#AAAAAA"},{tag:[D.keyword,D.operator,D.typeName,D.tagName,D.propertyName],color:"#2F6F9F",fontWeight:"bold"},{tag:[D.attributeName,D.definition(D.propertyName)],color:"#4F9FD0"},{tag:[D.className,D.string,D.special(D.brace)],color:"#CF4F5F"},{tag:D.number,color:"#CF4F5F",fontWeight:"bold"},{tag:D.variableName,fontWeight:"bold"}]}),Vt({variant:"light",settings:{background:"#f2f1f8",foreground:"#0c006b",caret:"#5c49e9",selection:"#d5d1f2",gutterBackground:"#f2f1f8",gutterForeground:"#0c006b70",lineHighlight:"#e1def3"},styles:[{tag:D.comment,color:"#9995b7"},{tag:D.keyword,color:"#ff5792",fontWeight:"bold"},{tag:[D.definitionKeyword,D.modifier],color:"#ff5792"},{tag:[D.className,D.tagName,D.definition(D.typeName)],color:"#0094f0"},{tag:[D.number,D.bool,D.null,D.special(D.brace)],color:"#5842ff"},{tag:[D.definition(D.propertyName),D.function(D.variableName)],color:"#0095a8"},{tag:D.typeName,color:"#b3694d"},{tag:[D.propertyName,D.variableName],color:"#fa8900"},{tag:D.operator,color:"#ff5792"},{tag:D.self,color:"#e64100"},{tag:[D.string,D.regexp],color:"#00b368"},{tag:[D.paren,D.bracket],color:"#0431fa"},{tag:D.labelName,color:"#00bdd6"},{tag:D.attributeName,color:"#e64100"},{tag:D.angleBracket,color:"#9995b7"}]}),Vt({variant:"light",settings:{background:"#faf4ed",foreground:"#575279",caret:"#575279",selection:"#6e6a8614",gutterBackground:"#faf4ed",gutterForeground:"#57527970",lineHighlight:"#6e6a860d"},styles:[{tag:D.comment,color:"#9893a5"},{tag:[D.bool,D.null],color:"#286983"},{tag:D.number,color:"#d7827e"},{tag:D.className,color:"#d7827e"},{tag:[D.angleBracket,D.tagName,D.typeName],color:"#56949f"},{tag:D.attributeName,color:"#907aa9"},{tag:D.punctuation,color:"#797593"},{tag:[D.keyword,D.modifier],color:"#286983"},{tag:[D.string,D.regexp],color:"#ea9d34"},{tag:D.variableName,color:"#d7827e"}]}),Vt({variant:"light",settings:{background:"#FFFFFF",foreground:"#000000",caret:"#000000",selection:"#FFFD0054",gutterBackground:"#FFFFFF",gutterForeground:"#00000070",lineHighlight:"#00000008"},styles:[{tag:D.comment,color:"#CFCFCF"},{tag:[D.number,D.bool,D.null],color:"#E66C29"},{tag:[D.className,D.definition(D.propertyName),D.function(D.variableName),D.labelName,D.definition(D.typeName)],color:"#2EB43B"},{tag:D.keyword,color:"#D8B229"},{tag:D.operator,color:"#4EA44E",fontWeight:"bold"},{tag:[D.definitionKeyword,D.modifier],color:"#925A47"},{tag:D.string,color:"#704D3D"},{tag:D.typeName,color:"#2F8996"},{tag:[D.variableName,D.propertyName],color:"#77ACB0"},{tag:D.self,color:"#77ACB0",fontWeight:"bold"},{tag:D.regexp,color:"#E3965E"},{tag:[D.tagName,D.angleBracket],color:"#BAA827"},{tag:D.attributeName,color:"#B06520"},{tag:D.derefOperator,color:"#000"}]}),Vt({variant:"light",settings:{background:"#fef7e5",foreground:"#586E75",caret:"#000000",selection:"#073642",gutterBackground:"#fef7e5",gutterForeground:"#586E7580",lineHighlight:"#EEE8D5"},styles:[{tag:D.comment,color:"#93A1A1"},{tag:D.string,color:"#2AA198"},{tag:D.regexp,color:"#D30102"},{tag:D.number,color:"#D33682"},{tag:D.variableName,color:"#268BD2"},{tag:[D.keyword,D.operator,D.punctuation],color:"#859900"},{tag:[D.definitionKeyword,D.modifier],color:"#073642",fontWeight:"bold"},{tag:[D.className,D.self,D.definition(D.propertyName)],color:"#268BD2"},{tag:D.function(D.variableName),color:"#268BD2"},{tag:[D.bool,D.null],color:"#B58900"},{tag:D.tagName,color:"#268BD2",fontWeight:"bold"},{tag:D.angleBracket,color:"#93A1A1"},{tag:D.attributeName,color:"#93A1A1"},{tag:D.typeName,color:"#859900"}]}),Vt({variant:"light",settings:{background:"#FFFFFF",foreground:"#4D4D4C",caret:"#AEAFAD",selection:"#D6D6D6",gutterBackground:"#FFFFFF",gutterForeground:"#4D4D4C80",lineHighlight:"#EFEFEF"},styles:[{tag:D.comment,color:"#8E908C"},{tag:[D.variableName,D.self,D.propertyName,D.attributeName,D.regexp],color:"#C82829"},{tag:[D.number,D.bool,D.null],color:"#F5871F"},{tag:[D.className,D.typeName,D.definition(D.typeName)],color:"#C99E00"},{tag:[D.string,D.special(D.brace)],color:"#718C00"},{tag:D.operator,color:"#3E999F"},{tag:[D.definition(D.propertyName),D.function(D.variableName)],color:"#4271AE"},{tag:D.keyword,color:"#8959A8"},{tag:D.derefOperator,color:"#4D4D4C"}]});const Zj=Vt({variant:"light",settings:{background:"#ffffff",foreground:"#000000",caret:"#000000",selection:"#d7d4f0",lineHighlight:"#cceeff44",gutterBackground:"var(--color-background)",gutterForeground:"var(--gray-10)"},styles:[{tag:D.comment,color:"#708090"},{tag:D.variableName,color:"#000000"},{tag:[D.string,D.special(D.brace)],color:"#a11"},{tag:D.number,color:"#164"},{tag:D.bool,color:"#219"},{tag:D.null,color:"#219"},{tag:D.keyword,color:"#708",fontWeight:500},{tag:D.className,color:"#00f"},{tag:D.definition(D.typeName),color:"#00f"},{tag:D.typeName,color:"#085"},{tag:D.angleBracket,color:"#000000"},{tag:D.tagName,color:"#170"},{tag:D.attributeName,color:"#00c"},{tag:D.operator,color:"#a2f",fontWeight:500},{tag:[D.function(D.variableName)],color:"#00c"},{tag:[D.propertyName],color:"#05a"}]}),Qj=Vt({variant:"dark",settings:{background:"#282c34",foreground:"#abb2bf",caret:"#528bff",selection:"#3E4451",lineHighlight:"#2c313c",gutterBackground:"var(--color-background)",gutterForeground:"var(--gray-10)"},styles:[{tag:D.comment,color:"#5c6370"},{tag:D.variableName,color:"#abb2bf"},{tag:[D.string,D.special(D.brace)],color:"#98c379"},{tag:D.number,color:"#d19a66"},{tag:D.bool,color:"#d19a66"},{tag:D.null,color:"#d19a66"},{tag:D.keyword,color:"#c678dd",fontWeight:500},{tag:D.className,color:"#61afef"},{tag:D.definition(D.typeName),color:"#61afef"},{tag:D.typeName,color:"#56b6c2"},{tag:D.angleBracket,color:"#abb2bf"},{tag:D.tagName,color:"#e06c75"},{tag:D.attributeName,color:"#d19a66"},{tag:D.operator,color:"#56b6c2",fontWeight:500},{tag:[D.function(D.variableName)],color:"#61afef"},{tag:[D.propertyName],color:"#e5c07b"}]}),Y_="packages-install-input",eE=["%alias","%cd","%clear","%debug","%env","%load","%load_ext","%lsmagic","%matplotlib","%pwd","%who_ls","%system","%%time","%%timeit","%%writefile","%%capture","%%html","%%latex"];let Yd;function tE(){const t=async r=>{const s=ut.get(l4),i={...s,runtime:{...s.runtime,auto_reload:r}};await Rs({config:i}).then(()=>ut.set(l4,i))},e=()=>{requestAnimationFrame(()=>{const r=document.getElementById(Y_);r&&r.focus()})},n=[{match:"!pip install",onMatch:()=>{ut.set(kp,r=>({...r,isSidebarOpen:!0,selectedPanel:"packages"})),e()},title:"Package Installation",description:h.jsxs(h.Fragment,{children:["The package manager sidebar has been opened.",h.jsx("br",{}),"Install packages directly from there instead."]})},{match:"!uv pip install",onMatch:()=>{ut.set(kp,r=>({...r,isSidebarOpen:!0,selectedPanel:"packages"})),e()},title:"Package Installation",description:h.jsxs(h.Fragment,{children:["The package manager sidebar has been opened.",h.jsx("br",{}),"Install packages directly from there instead."]})},{match:"!uv add",onMatch:()=>{ut.set(kp,r=>({...r,isSidebarOpen:!0,selectedPanel:"packages"})),e()},title:"Package Installation",description:h.jsxs(h.Fragment,{children:["The package manager sidebar has been opened.",h.jsx("br",{}),"Install packages directly from there instead."]})},{match:"%autoreload 2",onMatch:async()=>{await t("autorun")},title:"Module reload",description:h.jsxs(h.Fragment,{children:["Module reload mode set to ",h.jsx("b",{children:"autorun"})," - module changes will re-run the cells that import them."]})},{match:"%autoreload 1",onMatch:async()=>{await t("lazy")},title:"Module reload",description:h.jsxs(h.Fragment,{children:["Module reload mode set to ",h.jsx("b",{children:"lazy"})," - module changes will mark the cells that import them as stale."]})},{match:"%autoreload 0",onMatch:async()=>{await t("off")},title:"Module reload",description:h.jsx(h.Fragment,{children:"Module reload disabled - module changes will not be detected."})},{match:"!ls",onMatch:()=>{},title:"Listing files",description:h.jsxs(h.Fragment,{children:["Shell commands are not directly supported.",h.jsx("br",{}),"Use ",h.jsx("code",{children:"import subprocess; subprocess.run(['ls'])"})," instead."]})},...eE.map(r=>({match:r,onMatch:()=>{},title:h.jsx(la,{className:"inline",children:r}),description:h.jsxs(h.Fragment,{children:["Magic commands are not supported in marimo. Read more about replacements in the"," ",h.jsx("a",{href:"https://docs.marimo.io/guides/coming_from/jupyter/#adapting-to-the-absence-of-magic-commands",target:"_blank",className:"text-link underline cursor-pointer",rel:"noopener noreferrer",children:"documentation"}),"."]})}))],o=new Map(n.map(r=>[r.match,r]));return st.updateListener.of(r=>{if(r.docChanged){const s=r.state.selection.main,i=r.state.doc,a=i.lineAt(s.head),l=i.sliceString(a.from,s.anchor).trim(),c=o.get(l);c&&(c.onMatch(),Yd?Yd.upsert({title:c.title,description:c.description}):Yd=lt({title:c.title,description:c.description}))}})}function nE(){return[st.domEventHandlers({paste:(t,e)=>{var r;const n=(r=t.clipboardData)==null?void 0:r.getData("text/plain");if(!(n!=null&&n.includes("@app.cell")))return!1;const o=function(s){if(!s.includes("@app.cell"))return[];const i=[],a=s.split(`
104
+ `).length,d=function(u,f){const p=u.lineAt(f);return{line:p.number-1,character:f-p.from}}(i.doc,i.selection.main.head);return d.line+=c,{textDocument:{uri:`file://${_$}`,version:"replace_me"},position:d,context:{triggerKind:Fz.InlineCompletionTriggerKind.Automatic},formattingOptions:{tabSize:i.tabSize,insertSpaces:!0}}}(n,Sc(o));return function(i,a,l){if(!i)return Yd.debug("No response from copilot"),"";const c=Array.isArray(i)?i[0]:i.items[0];if(!c)return Yd.debug("No response from copilot"),"";const{insertText:d,range:u}=c,f=String(d);if(!u)return Yd.error("No range from copilot"),f;const p=u.start.character-a.character,_=p<0?f.slice(-p):f,g=l.doc.sliceString(l.selection.main.head,l.doc.length);for(let m=0;m<_.length;m++){const b=_.slice(m);if(g.startsWith(b))return _.slice(0,m)}return _}(await dS().getCompletion(r),r.position,n)}})),t.copilot==="custom"&&e.push(Wg({...W_,fetchFn:async n=>{if(n.doc.length===0)return"";const o=n.doc.sliceString(0,n.selection.main.head),r=n.doc.sliceString(n.selection.main.head,n.doc.length);if(o.length===0)return"";const s=n.field(Cc).type;let i=await Nc.post("/ai/inline_completion",{prefix:o,suffix:r,language:s});return o&&i.startsWith(o)&&(i=i.slice(o.length)),r&&i.endsWith(r)&&(i=i.slice(0,-r.length)),i}})),[...e,Vo.highest(Hn.of([{key:"Escape",run:n=>{const o=Hg(n);return!i4(n)&&o}}])),Gj.of(m$())]},Jj=dt.mark({class:"underline"}),q_=Ut.define(),G_=Ut.define(),Kj=En.define({create:()=>dt.none,update(t,e){let n=t.map(e.changes);for(const o of e.effects)o.is(q_)?n=t.update({add:[Jj.range(o.value.from,o.value.to)]}):o.is(G_)&&(n=dt.none);return n},provide:t=>st.decorations.from(t)});class Xj{constructor(e,n){this.view=void 0,this.commandClickMode=void 0,this.hoveredRange=void 0,this.onClick=void 0,this.keydown=o=>{o.key!=="Meta"&&o.key!=="Control"||(this.commandClickMode=!0,this.view.dom.addEventListener("mousemove",this.mousemove),this.view.dom.addEventListener("click",this.click))},this.keyup=o=>{o.key!=="Meta"&&o.key!=="Control"||this.exitCommandClickMode()},this.windowBlur=()=>{this.commandClickMode&&this.exitCommandClickMode()},this.mousemove=o=>{if(!o.metaKey&&!o.ctrlKey)return void this.exitCommandClickMode();if(!this.commandClickMode)return void this.clearUnderline();const r=this.view.posAtCoords({x:o.clientX,y:o.clientY});if(r==null)return void this.clearUnderline();const s=zz(this.view.state).cursorAt(r);if(s.name==="VariableName"){const{from:i,to:a}=s;if(this.hoveredRange&&this.hoveredRange.from===i&&this.hoveredRange.to===a)return;this.clearUnderline(),this.hoveredRange={from:i,to:a,position:r},this.view.dispatch({effects:q_.of(this.hoveredRange)})}else this.clearUnderline()},this.click=o=>{if(this.hoveredRange){const r=this.view.state.doc.sliceString(this.hoveredRange.from,this.hoveredRange.to);o.preventDefault(),o.stopPropagation(),this.onClick(this.view,r),this.view.dispatch({selection:{head:this.hoveredRange.position,anchor:this.hoveredRange.position}})}},this.view=e,this.commandClickMode=!1,this.hoveredRange=null,this.onClick=n,window.addEventListener("keydown",this.keydown),window.addEventListener("keyup",this.keyup),window.addEventListener("blur",this.windowBlur),window.addEventListener("mouseleave",this.windowBlur)}update(e){}destroy(){window.removeEventListener("keydown",this.keydown),window.removeEventListener("keyup",this.keyup),window.removeEventListener("blur",this.windowBlur),window.removeEventListener("mouseleave",this.windowBlur),this.view.dom.removeEventListener("mousemove",this.mousemove),this.view.dom.removeEventListener("click",this.click)}exitCommandClickMode(){this.commandClickMode=!1,this.view.dom.removeEventListener("mousemove",this.mousemove),this.view.dom.removeEventListener("click",this.click),this.clearUnderline()}clearUnderline(){this.hoveredRange&&(this.view.dispatch({effects:G_.of(null)}),this.hoveredRange=null)}}const Vt=({variant:t,settings:e,styles:n})=>{const o=st.theme({"&":{backgroundColor:e.background,color:e.foreground},".cm-content":{caretColor:e.caret},".cm-cursor, .cm-dropCursor":{borderLeftColor:e.caret},"&.cm-focused .cm-selectionBackgroundm .cm-selectionBackground, .cm-content ::selection":{backgroundColor:e.selection},".cm-activeLine":{backgroundColor:e.lineHighlight},".cm-gutters":{backgroundColor:e.gutterBackground,color:e.gutterForeground},".cm-activeLineGutter":{backgroundColor:e.lineHighlight}},{dark:t==="dark"}),r=Uz.define(n);return[o,a4(r)]};Vt({variant:"dark",settings:{background:"#200020",foreground:"#D0D0FF",caret:"#7070FF",selection:"#80000080",gutterBackground:"#200020",gutterForeground:"#C080C0",lineHighlight:"#80000040"},styles:[{tag:D.comment,color:"#404080"},{tag:[D.string,D.regexp],color:"#999999"},{tag:D.number,color:"#7090B0"},{tag:[D.bool,D.null],color:"#8080A0"},{tag:[D.punctuation,D.derefOperator],color:"#805080"},{tag:D.keyword,color:"#60B0FF"},{tag:D.definitionKeyword,color:"#B0FFF0"},{tag:D.moduleKeyword,color:"#60B0FF"},{tag:D.operator,color:"#A0A0FF"},{tag:[D.variableName,D.self],color:"#008080"},{tag:D.operatorKeyword,color:"#A0A0FF"},{tag:D.controlKeyword,color:"#80A0FF"},{tag:D.className,color:"#70E080"},{tag:[D.function(D.propertyName),D.propertyName],color:"#50A0A0"},{tag:D.tagName,color:"#009090"},{tag:D.modifier,color:"#B0FFF0"},{tag:[D.squareBracket,D.attributeName],color:"#D0D0FF"}]}),Vt({variant:"light",settings:{background:"#fcfcfc",foreground:"#5c6166",caret:"#ffaa33",selection:"#036dd626",gutterBackground:"#fcfcfc",gutterForeground:"#8a919966",lineHighlight:"#8a91991a"},styles:[{tag:D.comment,color:"#787b8099"},{tag:D.string,color:"#86b300"},{tag:D.regexp,color:"#4cbf99"},{tag:[D.number,D.bool,D.null],color:"#ffaa33"},{tag:D.variableName,color:"#5c6166"},{tag:[D.definitionKeyword,D.modifier],color:"#fa8d3e"},{tag:[D.keyword,D.special(D.brace)],color:"#fa8d3e"},{tag:D.operator,color:"#ed9366"},{tag:D.separator,color:"#5c6166b3"},{tag:D.punctuation,color:"#5c6166"},{tag:[D.definition(D.propertyName),D.function(D.variableName)],color:"#f2ae49"},{tag:[D.className,D.definition(D.typeName)],color:"#22a4e6"},{tag:[D.tagName,D.typeName,D.self,D.labelName],color:"#55b4d4"},{tag:D.angleBracket,color:"#55b4d480"},{tag:D.attributeName,color:"#f2ae49"}]}),Vt({variant:"dark",settings:{background:"#15191EFA",foreground:"#EEF2F7",caret:"#C4C4C4",selection:"#90B2D557",gutterBackground:"#15191EFA",gutterForeground:"#aaaaaa95",lineHighlight:"#57575712"},styles:[{tag:D.comment,color:"#6E6E6E"},{tag:[D.string,D.regexp,D.special(D.brace)],color:"#5C81B3"},{tag:D.number,color:"#C1E1B8"},{tag:D.bool,color:"#53667D"},{tag:[D.definitionKeyword,D.modifier,D.function(D.propertyName)],color:"#A3D295",fontWeight:"bold"},{tag:[D.keyword,D.moduleKeyword,D.operatorKeyword,D.operator],color:"#697A8E",fontWeight:"bold"},{tag:[D.variableName,D.attributeName],color:"#708E67"},{tag:[D.function(D.variableName),D.definition(D.propertyName),D.derefOperator],color:"#fff"},{tag:D.tagName,color:"#A3D295"}]}),Vt({variant:"dark",settings:{background:"#2e241d",foreground:"#BAAE9E",caret:"#A7A7A7",selection:"#DDF0FF33",gutterBackground:"#28211C",gutterForeground:"#BAAE9E90",lineHighlight:"#FFFFFF08"},styles:[{tag:D.comment,color:"#666666"},{tag:[D.string,D.special(D.brace)],color:"#54BE0D"},{tag:D.regexp,color:"#E9C062"},{tag:D.number,color:"#CF6A4C"},{tag:[D.keyword,D.operator],color:"#5EA6EA"},{tag:D.variableName,color:"#7587A6"},{tag:[D.definitionKeyword,D.modifier],color:"#F9EE98"},{tag:[D.propertyName,D.function(D.variableName)],color:"#937121"},{tag:[D.typeName,D.angleBracket,D.tagName],color:"#9B859D"}]}),Vt({variant:"dark",settings:{background:"#3b2627",foreground:"#E6E1C4",caret:"#E6E1C4",selection:"#16120E",gutterBackground:"#3b2627",gutterForeground:"#E6E1C490",lineHighlight:"#1F1611"},styles:[{tag:D.comment,color:"#6B4E32"},{tag:[D.keyword,D.operator,D.derefOperator],color:"#EF5D32"},{tag:D.className,color:"#EFAC32",fontWeight:"bold"},{tag:[D.typeName,D.propertyName,D.function(D.variableName),D.definition(D.variableName)],color:"#EFAC32"},{tag:D.definition(D.typeName),color:"#EFAC32",fontWeight:"bold"},{tag:D.labelName,color:"#EFAC32",fontWeight:"bold"},{tag:[D.number,D.bool],color:"#6C99BB"},{tag:[D.variableName,D.self],color:"#7DAF9C"},{tag:[D.string,D.special(D.brace),D.regexp],color:"#D9D762"},{tag:[D.angleBracket,D.tagName,D.attributeName],color:"#EFCB43"}]}),Vt({variant:"dark",settings:{background:"#000205",foreground:"#FFFFFF",caret:"#E60065",selection:"#E60C6559",gutterBackground:"#000205",gutterForeground:"#ffffff90",lineHighlight:"#4DD7FC1A"},styles:[{tag:D.comment,color:"#404040"},{tag:[D.string,D.special(D.brace),D.regexp],color:"#00D8FF"},{tag:D.number,color:"#E62286"},{tag:[D.variableName,D.attributeName,D.self],color:"#E62286",fontWeight:"bold"},{tag:D.function(D.variableName),color:"#fff",fontWeight:"bold"}]}),Vt({variant:"light",settings:{background:"#fff",foreground:"#000",caret:"#000",selection:"#BDD5FC",gutterBackground:"#fff",gutterForeground:"#00000070",lineHighlight:"#FFFBD1"},styles:[{tag:D.comment,color:"#BCC8BA"},{tag:[D.string,D.special(D.brace),D.regexp],color:"#5D90CD"},{tag:[D.number,D.bool,D.null],color:"#46A609"},{tag:D.keyword,color:"#AF956F"},{tag:[D.definitionKeyword,D.modifier],color:"#C52727"},{tag:[D.angleBracket,D.tagName,D.attributeName],color:"#606060"},{tag:D.self,color:"#000"}]}),Vt({variant:"dark",settings:{background:"#00254b",foreground:"#FFFFFF",caret:"#FFFFFF",selection:"#B36539BF",gutterBackground:"#00254b",gutterForeground:"#FFFFFF70",lineHighlight:"#00000059"},styles:[{tag:D.comment,color:"#0088FF"},{tag:D.string,color:"#3AD900"},{tag:D.regexp,color:"#80FFC2"},{tag:[D.number,D.bool,D.null],color:"#FF628C"},{tag:[D.definitionKeyword,D.modifier],color:"#FFEE80"},{tag:D.variableName,color:"#CCCCCC"},{tag:D.self,color:"#FF80E1"},{tag:[D.className,D.definition(D.propertyName),D.function(D.variableName),D.definition(D.typeName),D.labelName],color:"#FFDD00"},{tag:[D.keyword,D.operator],color:"#FF9D00"},{tag:[D.propertyName,D.typeName],color:"#80FFBB"},{tag:D.special(D.brace),color:"#EDEF7D"},{tag:D.attributeName,color:"#9EFFFF"},{tag:D.derefOperator,color:"#fff"}]}),Vt({variant:"dark",settings:{background:"#060521",foreground:"#E0E0E0",caret:"#FFFFFFA6",selection:"#122BBB",gutterBackground:"#060521",gutterForeground:"#E0E0E090",lineHighlight:"#FFFFFF0F"},styles:[{tag:D.comment,color:"#AEAEAE"},{tag:[D.string,D.special(D.brace),D.regexp],color:"#8DFF8E"},{tag:[D.className,D.definition(D.propertyName),D.function(D.variableName),D.function(D.definition(D.variableName)),D.definition(D.typeName)],color:"#A3EBFF"},{tag:[D.number,D.bool,D.null],color:"#62E9BD"},{tag:[D.keyword,D.operator],color:"#2BF1DC"},{tag:[D.definitionKeyword,D.modifier],color:"#F8FBB1"},{tag:[D.variableName,D.self],color:"#B683CA"},{tag:[D.angleBracket,D.tagName,D.typeName,D.propertyName],color:"#60A4F1"},{tag:D.derefOperator,color:"#E0E0E0"},{tag:D.attributeName,color:"#7BACCA"}]}),Vt({variant:"dark",settings:{background:"#2d2f3f",foreground:"#f8f8f2",caret:"#f8f8f0",selection:"#44475a",gutterBackground:"#282a36",gutterForeground:"rgb(144, 145, 148)",lineHighlight:"#44475a"},styles:[{tag:D.comment,color:"#6272a4"},{tag:[D.string,D.special(D.brace)],color:"#f1fa8c"},{tag:[D.number,D.self,D.bool,D.null],color:"#bd93f9"},{tag:[D.keyword,D.operator],color:"#ff79c6"},{tag:[D.definitionKeyword,D.typeName],color:"#8be9fd"},{tag:D.definition(D.typeName),color:"#f8f8f2"},{tag:[D.className,D.definition(D.propertyName),D.function(D.variableName),D.attributeName],color:"#50fa7b"}]}),Vt({variant:"light",settings:{background:"#FFFFFF",foreground:"#000000",caret:"#000000",selection:"#80C7FF",gutterBackground:"#FFFFFF",gutterForeground:"#00000070",lineHighlight:"#C1E2F8"},styles:[{tag:D.comment,color:"#AAAAAA"},{tag:[D.keyword,D.operator,D.typeName,D.tagName,D.propertyName],color:"#2F6F9F",fontWeight:"bold"},{tag:[D.attributeName,D.definition(D.propertyName)],color:"#4F9FD0"},{tag:[D.className,D.string,D.special(D.brace)],color:"#CF4F5F"},{tag:D.number,color:"#CF4F5F",fontWeight:"bold"},{tag:D.variableName,fontWeight:"bold"}]}),Vt({variant:"light",settings:{background:"#f2f1f8",foreground:"#0c006b",caret:"#5c49e9",selection:"#d5d1f2",gutterBackground:"#f2f1f8",gutterForeground:"#0c006b70",lineHighlight:"#e1def3"},styles:[{tag:D.comment,color:"#9995b7"},{tag:D.keyword,color:"#ff5792",fontWeight:"bold"},{tag:[D.definitionKeyword,D.modifier],color:"#ff5792"},{tag:[D.className,D.tagName,D.definition(D.typeName)],color:"#0094f0"},{tag:[D.number,D.bool,D.null,D.special(D.brace)],color:"#5842ff"},{tag:[D.definition(D.propertyName),D.function(D.variableName)],color:"#0095a8"},{tag:D.typeName,color:"#b3694d"},{tag:[D.propertyName,D.variableName],color:"#fa8900"},{tag:D.operator,color:"#ff5792"},{tag:D.self,color:"#e64100"},{tag:[D.string,D.regexp],color:"#00b368"},{tag:[D.paren,D.bracket],color:"#0431fa"},{tag:D.labelName,color:"#00bdd6"},{tag:D.attributeName,color:"#e64100"},{tag:D.angleBracket,color:"#9995b7"}]}),Vt({variant:"light",settings:{background:"#faf4ed",foreground:"#575279",caret:"#575279",selection:"#6e6a8614",gutterBackground:"#faf4ed",gutterForeground:"#57527970",lineHighlight:"#6e6a860d"},styles:[{tag:D.comment,color:"#9893a5"},{tag:[D.bool,D.null],color:"#286983"},{tag:D.number,color:"#d7827e"},{tag:D.className,color:"#d7827e"},{tag:[D.angleBracket,D.tagName,D.typeName],color:"#56949f"},{tag:D.attributeName,color:"#907aa9"},{tag:D.punctuation,color:"#797593"},{tag:[D.keyword,D.modifier],color:"#286983"},{tag:[D.string,D.regexp],color:"#ea9d34"},{tag:D.variableName,color:"#d7827e"}]}),Vt({variant:"light",settings:{background:"#FFFFFF",foreground:"#000000",caret:"#000000",selection:"#FFFD0054",gutterBackground:"#FFFFFF",gutterForeground:"#00000070",lineHighlight:"#00000008"},styles:[{tag:D.comment,color:"#CFCFCF"},{tag:[D.number,D.bool,D.null],color:"#E66C29"},{tag:[D.className,D.definition(D.propertyName),D.function(D.variableName),D.labelName,D.definition(D.typeName)],color:"#2EB43B"},{tag:D.keyword,color:"#D8B229"},{tag:D.operator,color:"#4EA44E",fontWeight:"bold"},{tag:[D.definitionKeyword,D.modifier],color:"#925A47"},{tag:D.string,color:"#704D3D"},{tag:D.typeName,color:"#2F8996"},{tag:[D.variableName,D.propertyName],color:"#77ACB0"},{tag:D.self,color:"#77ACB0",fontWeight:"bold"},{tag:D.regexp,color:"#E3965E"},{tag:[D.tagName,D.angleBracket],color:"#BAA827"},{tag:D.attributeName,color:"#B06520"},{tag:D.derefOperator,color:"#000"}]}),Vt({variant:"light",settings:{background:"#fef7e5",foreground:"#586E75",caret:"#000000",selection:"#073642",gutterBackground:"#fef7e5",gutterForeground:"#586E7580",lineHighlight:"#EEE8D5"},styles:[{tag:D.comment,color:"#93A1A1"},{tag:D.string,color:"#2AA198"},{tag:D.regexp,color:"#D30102"},{tag:D.number,color:"#D33682"},{tag:D.variableName,color:"#268BD2"},{tag:[D.keyword,D.operator,D.punctuation],color:"#859900"},{tag:[D.definitionKeyword,D.modifier],color:"#073642",fontWeight:"bold"},{tag:[D.className,D.self,D.definition(D.propertyName)],color:"#268BD2"},{tag:D.function(D.variableName),color:"#268BD2"},{tag:[D.bool,D.null],color:"#B58900"},{tag:D.tagName,color:"#268BD2",fontWeight:"bold"},{tag:D.angleBracket,color:"#93A1A1"},{tag:D.attributeName,color:"#93A1A1"},{tag:D.typeName,color:"#859900"}]}),Vt({variant:"light",settings:{background:"#FFFFFF",foreground:"#4D4D4C",caret:"#AEAFAD",selection:"#D6D6D6",gutterBackground:"#FFFFFF",gutterForeground:"#4D4D4C80",lineHighlight:"#EFEFEF"},styles:[{tag:D.comment,color:"#8E908C"},{tag:[D.variableName,D.self,D.propertyName,D.attributeName,D.regexp],color:"#C82829"},{tag:[D.number,D.bool,D.null],color:"#F5871F"},{tag:[D.className,D.typeName,D.definition(D.typeName)],color:"#C99E00"},{tag:[D.string,D.special(D.brace)],color:"#718C00"},{tag:D.operator,color:"#3E999F"},{tag:[D.definition(D.propertyName),D.function(D.variableName)],color:"#4271AE"},{tag:D.keyword,color:"#8959A8"},{tag:D.derefOperator,color:"#4D4D4C"}]});const Zj=Vt({variant:"light",settings:{background:"#ffffff",foreground:"#000000",caret:"#000000",selection:"#d7d4f0",lineHighlight:"#cceeff44",gutterBackground:"var(--color-background)",gutterForeground:"var(--gray-10)"},styles:[{tag:D.comment,color:"#708090"},{tag:D.variableName,color:"#000000"},{tag:[D.string,D.special(D.brace)],color:"#a11"},{tag:D.number,color:"#164"},{tag:D.bool,color:"#219"},{tag:D.null,color:"#219"},{tag:D.keyword,color:"#708",fontWeight:500},{tag:D.className,color:"#00f"},{tag:D.definition(D.typeName),color:"#00f"},{tag:D.typeName,color:"#085"},{tag:D.angleBracket,color:"#000000"},{tag:D.tagName,color:"#170"},{tag:D.attributeName,color:"#00c"},{tag:D.operator,color:"#a2f",fontWeight:500},{tag:[D.function(D.variableName)],color:"#00c"},{tag:[D.propertyName],color:"#05a"}]}),Qj=Vt({variant:"dark",settings:{background:"#282c34",foreground:"#abb2bf",caret:"#528bff",selection:"#3E4451",lineHighlight:"#2c313c",gutterBackground:"var(--color-background)",gutterForeground:"var(--gray-10)"},styles:[{tag:D.comment,color:"#5c6370"},{tag:D.variableName,color:"#abb2bf"},{tag:[D.string,D.special(D.brace)],color:"#98c379"},{tag:D.number,color:"#d19a66"},{tag:D.bool,color:"#d19a66"},{tag:D.null,color:"#d19a66"},{tag:D.keyword,color:"#c678dd",fontWeight:500},{tag:D.className,color:"#61afef"},{tag:D.definition(D.typeName),color:"#61afef"},{tag:D.typeName,color:"#56b6c2"},{tag:D.angleBracket,color:"#abb2bf"},{tag:D.tagName,color:"#e06c75"},{tag:D.attributeName,color:"#d19a66"},{tag:D.operator,color:"#56b6c2",fontWeight:500},{tag:[D.function(D.variableName)],color:"#61afef"},{tag:[D.propertyName],color:"#e5c07b"}]}),Y_="packages-install-input",eE=["%alias","%cd","%clear","%debug","%env","%load","%load_ext","%lsmagic","%matplotlib","%pwd","%who_ls","%system","%%time","%%timeit","%%writefile","%%capture","%%html","%%latex"];let Jd;function tE(){const t=async r=>{const s=ut.get(l4),i={...s,runtime:{...s.runtime,auto_reload:r}};await Rs({config:i}).then(()=>ut.set(l4,i))},e=()=>{requestAnimationFrame(()=>{const r=document.getElementById(Y_);r&&r.focus()})},n=[{match:"!pip install",onMatch:()=>{ut.set(Sp,r=>({...r,isSidebarOpen:!0,selectedPanel:"packages"})),e()},title:"Package Installation",description:h.jsxs(h.Fragment,{children:["The package manager sidebar has been opened.",h.jsx("br",{}),"Install packages directly from there instead."]})},{match:"!uv pip install",onMatch:()=>{ut.set(Sp,r=>({...r,isSidebarOpen:!0,selectedPanel:"packages"})),e()},title:"Package Installation",description:h.jsxs(h.Fragment,{children:["The package manager sidebar has been opened.",h.jsx("br",{}),"Install packages directly from there instead."]})},{match:"!uv add",onMatch:()=>{ut.set(Sp,r=>({...r,isSidebarOpen:!0,selectedPanel:"packages"})),e()},title:"Package Installation",description:h.jsxs(h.Fragment,{children:["The package manager sidebar has been opened.",h.jsx("br",{}),"Install packages directly from there instead."]})},{match:"%autoreload 2",onMatch:async()=>{await t("autorun")},title:"Module reload",description:h.jsxs(h.Fragment,{children:["Module reload mode set to ",h.jsx("b",{children:"autorun"})," - module changes will re-run the cells that import them."]})},{match:"%autoreload 1",onMatch:async()=>{await t("lazy")},title:"Module reload",description:h.jsxs(h.Fragment,{children:["Module reload mode set to ",h.jsx("b",{children:"lazy"})," - module changes will mark the cells that import them as stale."]})},{match:"%autoreload 0",onMatch:async()=>{await t("off")},title:"Module reload",description:h.jsx(h.Fragment,{children:"Module reload disabled - module changes will not be detected."})},{match:"!ls",onMatch:()=>{},title:"Listing files",description:h.jsxs(h.Fragment,{children:["Shell commands are not directly supported.",h.jsx("br",{}),"Use ",h.jsx("code",{children:"import subprocess; subprocess.run(['ls'])"})," instead."]})},...eE.map(r=>({match:r,onMatch:()=>{},title:h.jsx(la,{className:"inline",children:r}),description:h.jsxs(h.Fragment,{children:["Magic commands are not supported in marimo. Read more about replacements in the"," ",h.jsx("a",{href:"https://docs.marimo.io/guides/coming_from/jupyter/#adapting-to-the-absence-of-magic-commands",target:"_blank",className:"text-link underline cursor-pointer",rel:"noopener noreferrer",children:"documentation"}),"."]})}))],o=new Map(n.map(r=>[r.match,r]));return st.updateListener.of(r=>{if(r.docChanged){const s=r.state.selection.main,i=r.state.doc,a=i.lineAt(s.head),l=i.sliceString(a.from,s.anchor).trim(),c=o.get(l);c&&(c.onMatch(),Jd?Jd.upsert({title:c.title,description:c.description}):Jd=lt({title:c.title,description:c.description}))}})}function nE(){return[st.domEventHandlers({paste:(t,e)=>{var r;const n=(r=t.clipboardData)==null?void 0:r.getData("text/plain");if(!(n!=null&&n.includes("@app.cell")))return!1;const o=function(s){if(!s.includes("@app.cell"))return[];const i=[],a=s.split(`
105
105
  `);let l=[],c=!1,d=0,u=!1,f=!1,p=0;const _=/\(/g,g=/\)/g,m=new Set(["@"]);function b(y){return(y.match(_)||[]).length-(y.match(g)||[]).length}function x(){if(l.length!==0){for(;l.length>0&&l[l.length-1].trim().startsWith("return");)l.pop();l.some(y=>y.trim()!=="")&&i.push(function(y){const v=y.split(`
106
106
  `);if(v.length===0)return"";const k=v.filter(j=>j.trim().length>0);if(k.length===0)return"";const S=/^\s*/,E=Math.min(...k.map(j=>{var I;return((I=j.match(S))==null?void 0:I[0].length)??Number.POSITIVE_INFINITY}));return E===0?y.trim():v.map(j=>j.slice(E)).join(`
107
107
  `).trim()}(l.join(`
108
- `))),l=[]}}for(const y of a){const v=y.trim();(v||c)&&(v.startsWith("@app.cell")?(x(),c=!0,d=1):d>0?(v.startsWith("def")&&v.includes("(")&&!v.includes("):")&&(u=!0,p=b(v)),d--):u?(p+=b(v),p===0&&(u=!1)):c&&(m.has(v[0])||v.startsWith("if __name__")?(x(),c=v.startsWith("@")):v.startsWith("return")?v.includes("(")&&!v.endsWith(")")&&(f=!0,p=b(v)):f?(p+=b(v),p===0&&(f=!1)):l.push(y)))}return x(),i}(n);return o.length===0?!1:(e.state.facet(Hz).createManyBelow(o),!0)}})]}function oE(){const t=c4.filter(e=>e.key!=="Escape");return Vo.highest(Hn.of([...t,{key:"Escape",run:e=>{const n=np(e);return!i4(e)&&n}}]))}function J_(t){const{showPlaceholder:e,enableAI:n}=t;return e?"marimo-import":n?"ai":"none"}const rE=t=>{const{cellId:e,keymapConfig:n,hotkeys:o,enableAI:r,cellActions:s,completionConfig:i,lspConfig:a,diagnosticsConfig:l}=t,c=J_(t);return[b$(n,o),[st.domEventHandlers({drop:(u,f)=>{var g,m;const p=(g=u.dataTransfer)==null?void 0:g.files[0];if(p!=null&&p.type.startsWith("text/"))return u.preventDefault(),Vz(f,p),!0;if(p!=null&&p.type.startsWith("image/"))return u.preventDefault(),$z(f,p),!0;const _=(m=u.dataTransfer)==null?void 0:m.getData("text/plain");if(_){u.preventDefault();const b=f.posAtCoords({x:u.clientX,y:u.clientY});return b!==null&&f.dispatch({changes:{from:b,to:b,insert:_},scrollIntoView:!0}),!0}return!1},dragover:u=>{u.preventDefault()}})],nE(),tE(),Wz(i,o,c,a,l),qz(e,o,s),sE(t),[Kj,(d=(u,f)=>{Bz(u,f)},Zn.define(u=>new Xj(u,d))),st.baseTheme({".underline":{textDecoration:"underline",cursor:"pointer",color:"var(--link)"}})],l!=null&&l.enabled?Gz():[],r&&Yf("inline_ai_tooltip")?WN({prompt:u=>async function(f){var x,y;const p=`
108
+ `))),l=[]}}for(const y of a){const v=y.trim();(v||c)&&(v.startsWith("@app.cell")?(x(),c=!0,d=1):d>0?(v.startsWith("def")&&v.includes("(")&&!v.includes("):")&&(u=!0,p=b(v)),d--):u?(p+=b(v),p===0&&(u=!1)):c&&(m.has(v[0])||v.startsWith("if __name__")?(x(),c=v.startsWith("@")):v.startsWith("return")?v.includes("(")&&!v.endsWith(")")&&(f=!0,p=b(v)):f?(p+=b(v),p===0&&(f=!1)):l.push(y)))}return x(),i}(n);return o.length===0?!1:(e.state.facet(Hz).createManyBelow(o),!0)}})]}function oE(){const t=c4.filter(e=>e.key!=="Escape");return Vo.highest(Hn.of([...t,{key:"Escape",run:e=>{const n=op(e);return!i4(e)&&n}}]))}function J_(t){const{showPlaceholder:e,enableAI:n}=t;return e?"marimo-import":n?"ai":"none"}const rE=t=>{const{cellId:e,keymapConfig:n,hotkeys:o,enableAI:r,cellActions:s,completionConfig:i,lspConfig:a,diagnosticsConfig:l}=t,c=J_(t);return[b$(n,o),[st.domEventHandlers({drop:(u,f)=>{var g,m;const p=(g=u.dataTransfer)==null?void 0:g.files[0];if(p!=null&&p.type.startsWith("text/"))return u.preventDefault(),Vz(f,p),!0;if(p!=null&&p.type.startsWith("image/"))return u.preventDefault(),$z(f,p),!0;const _=(m=u.dataTransfer)==null?void 0:m.getData("text/plain");if(_){u.preventDefault();const b=f.posAtCoords({x:u.clientX,y:u.clientY});return b!==null&&f.dispatch({changes:{from:b,to:b,insert:_},scrollIntoView:!0}),!0}return!1},dragover:u=>{u.preventDefault()}})],nE(),tE(),Wz(i,o,c,a,l),qz(e,o,s),sE(t),[Kj,(d=(u,f)=>{Bz(u,f)},Zn.define(u=>new Xj(u,d))),st.baseTheme({".underline":{textDecoration:"underline",cursor:"pointer",color:"var(--link)"}})],l!=null&&l.enabled?Gz():[],r&&Jf("inline_ai_tooltip")?WN({prompt:u=>async function(f){var x,y;const p=`
109
109
  ${f.codeBefore}
110
110
  <rewrite_this>
111
111
  ${f.selection}
112
112
  </rewrite_this>
113
113
  ${f.codeAfter}
114
- `.trim(),_=await fetch(Sp("api/ai/completion").toString(),{method:"POST",headers:Nc.headers(),body:JSON.stringify({prompt:f.prompt,code:p,selectedText:f.selection,includeOtherCode:"",language:f.language})}),g=((x=f.selection.match(/^\s*/))==null?void 0:x[0])||"",m=(y=_.body)==null?void 0:y.getReader();if(!m)throw new Error("Failed to get response reader");let b="";for(;;){const{done:v,value:k}=await m.read();if(v)break;b+=new TextDecoder().decode(k)}return b.startsWith(g)||(b=g+b),b}({prompt:u.prompt,selection:u.selection,codeBefore:u.codeBefore,codeAfter:u.codeAfter,language:j3(u.editorView)})}):[]];var d},sE=t=>{const{theme:e,hotkeys:n,completionConfig:o,cellId:r,lspConfig:s,diagnosticsConfig:i}=t,a=J_(t);return[st.lineWrapping,Yz(),Jz(),Kz(),Xz(),Zz(),Qz(),eB(),tB({position:"fixed",parent:document.querySelector("#App")??void 0}),nB(),e==="dark"?Qj:Zj,oB(s),Yj(o),rB(),sB(),oE(),Vo.high(Hn.of(uB)),iB(),aB(),lB.of(" "),a4(hB,{fallback:!0}),Hn.of(fB),cB({placeholderType:a,completionConfig:o,hotkeys:n,cellId:r,lspConfig:{...s,diagnostics:i}}),dB.of(pB()),ca.allowMultipleSelections.of(!0),DN(n),Hn.of([{key:"Tab",run:l=>mB(l)||(c=>{const{from:d,to:u}=c.state.selection.main;if(d!==u)return!1;const f=c.state.doc.lineAt(u);return f.text.slice(0,u-f.from).trim()!==""&&yB(c)})(l)||gB(l),preventDefault:!0},{key:n.getHotkey("completion.moveDown").key,run:l=>sa(l.state)!==null&&(d4(!0)(l),!0),preventDefault:!0},{key:n.getHotkey("completion.moveUp").key,run:l=>sa(l.state)!==null&&(d4(!1)(l),!0),preventDefault:!0}]),Hn.of([..._B,bB])]};function K_(t){const e=t.current;if(e===null)throw new ReferenceError("Attempting to dereference null object.");return e}var Jd="ContextMenu",[iE,Z$]=h4(Jd,[u4]),cn=u4(),[aE,X_]=iE(Jd),Z_=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:o,dir:r,modal:s=!0}=t,[i,a]=A.useState(!1),l=cn(e),c=hr(o),d=A.useCallback(u=>{a(u),c(u)},[c]);return h.jsx(aE,{scope:e,open:i,onOpenChange:d,modal:s,children:h.jsx(OB,{...l,dir:r,open:i,onOpenChange:d,modal:s,children:n})})};Z_.displayName=Jd;var Q_="ContextMenuTrigger",e1=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:o=!1,...r}=t,s=X_(Q_,n),i=cn(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),[]),u=f=>{a.current={x:f.clientX,y:f.clientY},s.onOpenChange(!0)};return A.useEffect(()=>d,[d]),A.useEffect(()=>{o&&d()},[o,d]),h.jsxs(h.Fragment,{children:[h.jsx(vB,{...i,virtualRef:l}),h.jsx(Ws.span,{"data-state":s.open?"open":"closed","data-disabled":o?"":void 0,...r,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:o?t.onContextMenu:Wn(t.onContextMenu,f=>{d(),u(f),f.preventDefault()}),onPointerDown:o?t.onPointerDown:Wn(t.onPointerDown,rl(f=>{d(),c.current=window.setTimeout(()=>u(f),700)})),onPointerMove:o?t.onPointerMove:Wn(t.onPointerMove,rl(d)),onPointerCancel:o?t.onPointerCancel:Wn(t.onPointerCancel,rl(d)),onPointerUp:o?t.onPointerUp:Wn(t.onPointerUp,rl(d))})]})});e1.displayName=Q_;var t1=t=>{const{__scopeContextMenu:e,...n}=t,o=cn(e);return h.jsx(DB,{...o,...n})};t1.displayName="ContextMenuPortal";var n1="ContextMenuContent",o1=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=X_(n1,n),s=cn(n),i=A.useRef(!1);return h.jsx(kB,{...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)"}})});o1.displayName=n1,A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=cn(n);return h.jsx(SB,{...r,...o,ref:e})}).displayName="ContextMenuGroup";var r1=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=cn(n);return h.jsx(CB,{...r,...o,ref:e})});r1.displayName="ContextMenuLabel";var s1=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=cn(n);return h.jsx(wB,{...r,...o,ref:e})});s1.displayName="ContextMenuItem";var i1=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=cn(n);return h.jsx(NB,{...r,...o,ref:e})});i1.displayName="ContextMenuCheckboxItem",A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=cn(n);return h.jsx(jB,{...r,...o,ref:e})}).displayName="ContextMenuRadioGroup";var a1=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=cn(n);return h.jsx(EB,{...r,...o,ref:e})});a1.displayName="ContextMenuRadioItem";var l1=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=cn(n);return h.jsx(IB,{...r,...o,ref:e})});l1.displayName="ContextMenuItemIndicator";var c1=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=cn(n);return h.jsx(xB,{...r,...o,ref:e})});c1.displayName="ContextMenuSeparator",A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=cn(n);return h.jsx(AB,{...r,...o,ref:e})}).displayName="ContextMenuArrow";var d1=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=cn(n);return h.jsx(TB,{...r,...o,ref:e})});d1.displayName="ContextMenuSubTrigger";var u1=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=cn(n);return h.jsx(MB,{...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 rl(t){return e=>e.pointerType!=="mouse"?t(e):void 0}u1.displayName="ContextMenuSubContent";var h1=o1,f1=r1,p1=s1,m1=i1,g1=a1,_1=l1,b1=c1,y1=d1,x1=u1;const w1=Z_,v1=e1,lE=LB(t1);A.forwardRef((t,e)=>{const n=X.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=FB({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=h.jsx(UB,{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=h.jsxs(y1,{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=y1.displayName;const k1="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=X.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=Oe(f4({subcontent:!0}),k1,o),n[3]=o,n[4]=s):s=n[4],n[5]!==r||n[6]!==e||n[7]!==s?(i=h.jsx(x1,{ref:e,className:s,...r}),n[5]=r,n[6]=e,n[7]=s,n[8]=i):i=n[8],i}).displayName=x1.displayName;const Kd=A.forwardRef((t,e)=>{const n=X.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=Oe(f4(),k1,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=h.jsx(lE,{children:h.jsx(zB,{children:h.jsx(h1,{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});Kd.displayName=h1.displayName;const yi=A.forwardRef((t,e)=>{const n=X.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=PB({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=h.jsx(p1,{ref:e,className:a,...s}),n[9]=s,n[10]=e,n[11]=a,n[12]=l):l=n[12],l});yi.displayName=p1.displayName,A.forwardRef((t,e)=>{const n=X.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=jc({className:s}),n[5]=s,n[6]=a):a=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(l=jc(),n[7]=l):l=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx("span",{className:l,children:h.jsx(_1,{children:h.jsx(VB,{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=h.jsxs(m1,{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=m1.displayName,A.forwardRef((t,e)=>{const n=X.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=jc({className:r}),n[4]=r,n[5]=i):i=n[5],n[6]===Symbol.for("react.memo_cache_sentinel")?(a=jc(),n[6]=a):a=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx("span",{className:a,children:h.jsx(_1,{children:h.jsx($B,{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=h.jsxs(g1,{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=g1.displayName,A.forwardRef((t,e)=>{const n=X.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=BB({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=h.jsx(f1,{ref:e,className:i,...s}),n[7]=s,n[8]=e,n[9]=i,n[10]=a):a=n[10],a}).displayName=f1.displayName;const S1=A.forwardRef((t,e)=>{const n=X.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=Oe(RB({className:o})),n[3]=o,n[4]=s):s=n[4],n[5]!==r||n[6]!==e||n[7]!==s?(i=h.jsx(b1,{ref:e,className:s,...r}),n[5]=r,n[6]=e,n[7]=s,n[8]=i):i=n[8],i});S1.displayName=b1.displayName;const C1=t=>{const e=X.c(14),{appClosed:n,onClick:o,tooltipContent:r}=t;let s;e[0]!==o?(s=()=>o==null?void 0:o({code:""}),e[0]=o,e[1]=s):s=e[1];const i=n&&" inactive-button";let a,l,c,d,u;return e[2]!==i?(a=Oe("shoulder-button hover-action",i),e[2]=i,e[3]=a):a=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx(Lr,{strokeWidth:1.8}),e[4]=l):l=e[4],e[5]!==s||e[6]!==a?(c=h.jsx(xn,{onClick:s,className:a,onMouseDown:Vn.preventFocus,shape:"circle",size:"small",color:"hint-green","data-testid":"create-cell-button",children:l}),e[5]=s,e[6]=a,e[7]=c):c=e[7],e[8]!==c||e[9]!==r?(d=h.jsx(Re,{content:r,usePortal:!1,children:c}),e[8]=c,e[9]=r,e[10]=d):d=e[10],e[11]!==o||e[12]!==d?(u=h.jsx(cE,{onClick:o,children:d}),e[11]=o,e[12]=d,e[13]=u):u=e[13],u},cE=t=>{const e=X.c(24),{children:n,onClick:o}=t;if(!o)return n;let r,s,i,a,l,c,d,u,f,p,_,g;return e[0]!==n?(r=h.jsx(v1,{children:n}),e[0]=n,e[1]=r):r=e[1],e[2]!==o?(s=m=>{m.stopPropagation(),o({code:""})},e[2]=o,e[3]=s):s=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsx("div",{className:"mr-3 text-muted-foreground",children:h.jsx(ac,{})}),e[4]=i):i=e[4],e[5]!==s?(a=h.jsxs(yi,{onSelect:s,children:[i,"Python cell"]},"python"),e[5]=s,e[6]=a):a=e[6],e[7]!==o?(l=m=>{m.stopPropagation(),o({code:new ta().defaultCode})},e[7]=o,e[8]=l):l=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx("div",{className:"mr-3 text-muted-foreground",children:h.jsx(ic,{})}),e[9]=c):c=e[9],e[10]!==l?(d=h.jsxs(yi,{onSelect:l,children:[c,"Markdown cell"]},"markdown"),e[10]=l,e[11]=d):d=e[11],e[12]!==o?(u=m=>{m.stopPropagation(),o({code:new Ec().defaultCode})},e[12]=o,e[13]=u):u=e[13],e[14]===Symbol.for("react.memo_cache_sentinel")?(f=h.jsx("div",{className:"mr-3 text-muted-foreground",children:h.jsx(lr,{size:13,strokeWidth:1.5})}),e[14]=f):f=e[14],e[15]!==u?(p=h.jsxs(yi,{onSelect:u,children:[f,"SQL cell"]},"sql"),e[15]=u,e[16]=p):p=e[16],e[17]!==a||e[18]!==d||e[19]!==p?(_=h.jsxs(Kd,{children:[a,d,p]}),e[17]=a,e[18]=d,e[19]=p,e[20]=_):_=e[20],e[21]!==r||e[22]!==_?(g=h.jsxs(w1,{children:[r,_]}),e[21]=r,e[22]=_,e[23]=g):g=e[23],g},dE=HB("rounded-full shadow-xsSolid border p-[5px] transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 [&>svg]:size-3 active:shadow-none bg-background",{variants:{variant:{default:"hover:bg-accent hover:text-accent-foreground",stale:"bg-[var(--yellow-3)] hover:bg-[var(--yellow-4)] text-[var(--yellow-11)]",green:"hover:bg-[var(--grass-2)] hover:text-[var(--grass-11)] hover:border-[var(--grass-7)],",disabled:"opacity-50 cursor-not-allowed",danger:"hover:bg-[var(--red-3)] hover:text-[var(--red-11)]"}},defaultVariants:{variant:"default"}}),xi=t=>{const e=X.c(21);let n,o,r,s,i;e[0]!==t?({children:n,tooltip:s,disabled:r,variant:i,...o}=t,e[0]=t,e[1]=n,e[2]=o,e[3]=r,e[4]=s,e[5]=i):(n=e[1],o=e[2],r=e[3],s=e[4],i=e[5]);const a=r!==void 0&&r;let l,c,d;e[6]!==a||e[7]!==o?(l=f=>{var p;a||((p=o.onClick)==null||p.call(o,f))},e[6]=a,e[7]=o,e[8]=l):l=e[8],e[9]!==o.className||e[10]!==i?(c=Oe(dE({variant:i}),o.className),e[9]=o.className,e[10]=i,e[11]=c):c=e[11],e[12]!==n||e[13]!==a||e[14]!==o||e[15]!==l||e[16]!==c?(d=h.jsx("button",{disabled:a,...o,onClick:l,onMouseDown:Vn.preventFocus,className:c,children:n}),e[12]=n,e[13]=a,e[14]=o,e[15]=l,e[16]=c,e[17]=d):d=e[17];const u=d;if(s){let f;return e[18]!==u||e[19]!==s?(f=h.jsx(Re,{content:s,side:"top",delayDuration:200,usePortal:!1,children:u}),e[18]=u,e[19]=s,e[20]=f):f=e[20],f}return u},uE=t=>{const e=X.c(5),{children:n,className:o}=t;let r,s;return e[0]!==o?(r=Oe("flex items-center gap-1 bg-background m-[2px] rounded-full",o),e[0]=o,e[1]=r):r=e[1],e[2]!==n||e[3]!==r?(s=h.jsx(jS,{className:r,children:n}),e[2]=n,e[3]=r,e[4]=s):s=e[4],s},hE=t=>{const e=X.c(22),{onClick:n,appClosed:o,needsRun:r,status:s,config:i,edited:a}=t,l=s==="disabled-transitively",c=s==="running"||s==="queued",d=o||c||!i.disabled&&l&&!a;let u;e[0]!==o||e[1]!==d||e[2]!==c||e[3]!==r?(u=function(m,b,x,y){return m?"disabled":b&&!x?"stale":x||y?"disabled":"green"}(o,r,c,d),e[0]=o,e[1]=d,e[2]=c,e[3]=r,e[4]=u):u=e[4];const f=u;if(i.disabled){let m,b;return e[5]===Symbol.for("react.memo_cache_sentinel")?(m=h.jsx(ym,{}),e[5]=m):m=e[5],e[6]!==d||e[7]!==n||e[8]!==f?(b=h.jsx(xi,{tooltip:"Add code to notebook",disabled:d,onClick:n,variant:f,"data-testid":"run-button",children:m}),e[6]=d,e[7]=n,e[8]=f,e[9]=b):b=e[9],b}if(!i.disabled&&l&&!a){let m,b;return e[10]===Symbol.for("react.memo_cache_sentinel")?(m=h.jsx(Qs,{strokeWidth:1.2}),e[10]=m):m=e[10],e[11]!==d||e[12]!==n||e[13]!==f?(b=h.jsx(xi,{disabled:d,tooltip:"This cell can't be run because it has a disabled ancestor",onClick:n,variant:f,"data-testid":"run-button",children:m}),e[11]=d,e[12]=n,e[13]=f,e[14]=b):b=e[14],b}let p,_,g;if(o)p="App disconnected";else if(s==="queued")p="This cell is already queued to run";else if(s==="running")p="This cell is already running.";else{let m;e[15]===Symbol.for("react.memo_cache_sentinel")?(m=pn("cell.run"),e[15]=m):m=e[15],p=m}return e[16]===Symbol.for("react.memo_cache_sentinel")?(_=h.jsx(Qs,{strokeWidth:1.2}),e[16]=_):_=e[16],e[17]!==d||e[18]!==n||e[19]!==p||e[20]!==f?(g=h.jsx(xi,{tooltip:p,disabled:d,onClick:n,variant:f,"data-testid":"run-button",children:_}),e[17]=d,e[18]=n,e[19]=p,e[20]=f,e[21]=g):g=e[21],g},N1=t=>{const e=X.c(10),{status:n,appClosed:o,onClick:r}=t;let s;s=o?"App disconnected":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";const i=s,a=(o||n==="running"||n==="queued")&&"inactive-button";let l,c,d,u,f;return e[0]!==a?(l=Oe("hover:bg-transparent text-destructive/60 hover:text-destructive",a),e[0]=a,e[1]=l):l=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(c={boxShadow:"none"},d=h.jsx(sp,{size:14}),e[2]=c,e[3]=d):(c=e[2],d=e[3]),e[4]!==r||e[5]!==l?(u=h.jsx(Pe,{variant:"ghost",size:"icon",onClick:r,"data-testid":"delete-button",onMouseDown:Vn.preventFocus,className:l,style:c,children:d}),e[4]=r,e[5]=l,e[6]=u):u=e[6],e[7]!==u||e[8]!==s?(f=h.jsx(Re,{content:i,usePortal:!1,children:u}),e[7]=u,e[8]=s,e[9]=f):f=e[9],f};let j1,E1,I1,A1;j1=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!0}),E1=new Intl.DateTimeFormat("en-US",{month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!0}),I1=t=>{const e=X.c(79),{editing:n,status:o,disabled:r,staleInputs:s,edited:i,interrupted:a,elapsedTime:l,runStartTimestamp:c,lastRunStartTimestamp:d,uninstantiated:u}=t;if(!n)return null;const f=c??d;let p;e[0]!==f?(p=f?h.jsx(A1,{lastRanTime:f}):null,e[0]=f,e[1]=p):p=e[1];const _=p;if(r&&o==="running")return Xt.error("CellStatusComponent: disabled and running"),null;if(r&&s){let g,m,b,x;return e[2]===Symbol.for("react.memo_cache_sentinel")?(g=h.jsx("span",{children:"This cell is stale, but it's disabled and can't be run"}),e[2]=g):g=e[2],e[3]!==_?(m=h.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[3]=_,e[4]=m):m=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(b=h.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"stale",children:h.jsxs(ni,{children:[h.jsx(ei,{className:"h-5 w-5",strokeWidth:1.5}),h.jsx(Ic,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[5]=b):b=e[5],e[6]!==m?(x=h.jsx(Re,{content:m,usePortal:!0,children:b}),e[6]=m,e[7]=x):x=e[7],x}if(r){let g,m,b,x;return e[8]===Symbol.for("react.memo_cache_sentinel")?(g=h.jsx("span",{children:"This cell is disabled"}),e[8]=g):g=e[8],e[9]!==_?(m=h.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[9]=_,e[10]=m):m=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(b=h.jsx("div",{className:"cell-status-icon cell-status-disabled","data-testid":"cell-status","data-status":"disabled",children:h.jsx(ei,{className:"h-5 w-5",strokeWidth:1.5})}),e[11]=b):b=e[11],e[12]!==m?(x=h.jsx(Re,{content:m,usePortal:!0,children:b}),e[12]=m,e[13]=x):x=e[13],x}if(!s&&o==="disabled-transitively"){let g,m,b,x;return e[14]===Symbol.for("react.memo_cache_sentinel")?(g=h.jsx("span",{children:"An ancestor of this cell is disabled, so it can't be run"}),e[14]=g):g=e[14],e[15]!==_?(m=h.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[15]=_,e[16]=m):m=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(b=h.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"disabled-transitively",children:h.jsxs(ni,{layerTop:!0,children:[h.jsx(ja,{className:"h-5 w-5",strokeWidth:1.5}),h.jsx(ei,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[17]=b):b=e[17],e[18]!==m?(x=h.jsx(Re,{content:m,usePortal:!0,children:b}),e[18]=m,e[19]=x):x=e[19],x}if(s&&o==="disabled-transitively"){let g,m,b,x;return e[20]===Symbol.for("react.memo_cache_sentinel")?(g=h.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]!==_?(m=h.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[21]=_,e[22]=m):m=e[22],e[23]===Symbol.for("react.memo_cache_sentinel")?(b=h.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"stale",children:h.jsxs(ni,{children:[h.jsx(Ic,{className:"h-5 w-5",strokeWidth:1}),h.jsx(ei,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[23]=b):b=e[23],e[24]!==m?(x=h.jsx(Re,{content:m,usePortal:!0,children:b}),e[24]=m,e[25]=x):x=e[25],x}if(o==="running"){let g,m,b,x,y;return e[26]===Symbol.for("react.memo_cache_sentinel")?(g=h.jsx("span",{children:"This cell is running"}),e[26]=g):g=e[26],e[27]!==_?(m=h.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[27]=_,e[28]=m):m=e[28],e[29]!==c?(b=Cp.fromSeconds(c)||Cp.now(),e[29]=c,e[30]=b):b=e[30],e[31]!==b?(x=h.jsx("div",{className:"cell-status-icon elapsed-time running","data-testid":"cell-status","data-status":"running",children:h.jsx(fE,{startTime:b})}),e[31]=b,e[32]=x):x=e[32],e[33]!==m||e[34]!==x?(y=h.jsx(Re,{content:m,usePortal:!0,children:x}),e[33]=m,e[34]=x,e[35]=y):y=e[35],y}if(o==="queued"){let g,m,b,x;return e[36]===Symbol.for("react.memo_cache_sentinel")?(g=h.jsx("span",{children:"This cell is queued to run"}),e[36]=g):g=e[36],e[37]!==_?(m=h.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[37]=_,e[38]=m):m=e[38],e[39]===Symbol.for("react.memo_cache_sentinel")?(b=h.jsx("div",{className:"cell-status-icon cell-status-queued","data-testid":"cell-status","data-status":"queued",children:h.jsx(vS,{className:"h-5 w-5",strokeWidth:1.5})}),e[39]=b):b=e[39],e[40]!==m?(x=h.jsx(Re,{content:m,usePortal:!0,children:b}),e[40]=m,e[41]=x):x=e[41],x}if(i||a||s||u){let g;e[42]!==l?(g=wa(l),e[42]=l,e[43]=g):g=e[43];const m=g;let b;e[44]!==l||e[45]!==m?(b=l?h.jsx(Vc,{elapsedTime:m}):null,e[44]=l,e[45]=m,e[46]=b):b=e[46];const x=b;let y,v,k,S,E,j="";if(u)y="This cell has not yet been run";else if(a){let I;y="This cell was interrupted when it was last run",e[47]!==x?(I=h.jsxs("span",{children:["This cell ran for ",x," before being interrupted"]}),e[47]=x,e[48]=I):I=e[48],j=I}else if(i){let I;y="This cell has been modified since it was last run",e[49]!==x?(I=h.jsxs("span",{children:["This cell took ",x," to run"]}),e[49]=x,e[50]=I):I=e[50],j=I}else{let I;y="This cell has not been run with the latest inputs",e[51]!==x?(I=h.jsxs("span",{children:["This cell took ",x," to run"]}),e[51]=x,e[52]=I):I=e[52],j=I}return e[53]===Symbol.for("react.memo_cache_sentinel")?(v=h.jsx("div",{className:"cell-status-stale","data-testid":"cell-status","data-status":"outdated",children:h.jsx(Ic,{className:"h-5 w-5",strokeWidth:1.5})}),e[53]=v):v=e[53],e[54]!==y?(k=h.jsx(Re,{content:y,usePortal:!0,children:v}),e[54]=y,e[55]=k):k=e[55],e[56]!==l||e[57]!==m||e[58]!==_||e[59]!==j?(S=l&&h.jsx(Re,{content:h.jsxs("div",{className:"flex flex-col gap-1",children:[j,_]}),usePortal:!0,children:h.jsx("div",{className:"elapsed-time hover-action","data-testid":"cell-status","data-status":"outdated",children:h.jsx("span",{children:m})})}),e[56]=l,e[57]=m,e[58]=_,e[59]=j,e[60]=S):S=e[60],e[61]!==k||e[62]!==S?(E=h.jsxs("div",{className:"cell-status-icon flex items-center gap-2",children:[k,S]}),e[61]=k,e[62]=S,e[63]=E):E=e[63],E}if(l!==null){let g;e[64]!==l?(g=wa(l),e[64]=l,e[65]=g):g=e[65];const m=g;let b;e[66]!==l||e[67]!==m?(b=l?h.jsx(Vc,{elapsedTime:m}):null,e[66]=l,e[67]=m,e[68]=b):b=e[68];const x=b;let y,v,k,S;return e[69]!==x?(y=h.jsxs("span",{children:["This cell took ",x," to run"]}),e[69]=x,e[70]=y):y=e[70],e[71]!==_||e[72]!==y?(v=h.jsxs("div",{className:"flex flex-col gap-1",children:[y,_]}),e[71]=_,e[72]=y,e[73]=v):v=e[73],e[74]!==m?(k=h.jsx("div",{className:"cell-status-icon elapsed-time hover-action","data-testid":"cell-status","data-status":"idle",children:h.jsx("span",{children:m})}),e[74]=m,e[75]=k):k=e[75],e[76]!==v||e[77]!==k?(S=h.jsx(Re,{content:v,usePortal:!0,children:k}),e[76]=v,e[77]=k,e[78]=S):S=e[78],S}return null},Vc=t=>{const e=X.c(2);let n;return e[0]!==t.elapsedTime?(n=h.jsx("span",{className:"tracking-wide font-semibold",children:t.elapsedTime}),e[0]=t.elapsedTime,e[1]=n):n=e[1],n},A1=t=>{const e=X.c(18),n=1e3*t.lastRanTime;let o,r,s,i,a,l,c,d,u;if(e[0]!==n){const f=new Date(n),p=new Date,_=f.toDateString()===p.toDateString()?j1:E1;i="Ran at",a=" ",l=h.jsx("strong",{className:"tracking-wide font-semibold",children:_.format(f)}),c=" ",o="text-muted-foreground",r="(",s=TS(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=h.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?(u=h.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]=u):u=e[17],u},wa=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 fE=t=>{const e=X.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(Cp.now().toMilliseconds())},17);return()=>clearInterval(d)},[]),l-a.current}(n);let r,s;return e[2]!==o?(r=wa(o),e[2]=o,e[3]=r):r=e[3],e[4]!==r?(s=h.jsx("span",{children:r}),e[4]=r,e[5]=s):s=e[5],s},pE={display:"none"};function mE(t){let{id:e,value:n}=t;return K.createElement("div",{id:e,style:pE},n)}function gE(t){let{id:e,announcement:n,ariaLiveType:o="assertive"}=t;return K.createElement("div",{id:e,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":o,"aria-atomic":!0},n)}const T1=A.createContext(null),_E={draggable:`
114
+ `.trim(),_=await fetch(Cp("api/ai/completion").toString(),{method:"POST",headers:Nc.headers(),body:JSON.stringify({prompt:f.prompt,code:p,selectedText:f.selection,includeOtherCode:"",language:f.language})}),g=((x=f.selection.match(/^\s*/))==null?void 0:x[0])||"",m=(y=_.body)==null?void 0:y.getReader();if(!m)throw new Error("Failed to get response reader");let b="";for(;;){const{done:v,value:k}=await m.read();if(v)break;b+=new TextDecoder().decode(k)}return b.startsWith(g)||(b=g+b),b}({prompt:u.prompt,selection:u.selection,codeBefore:u.codeBefore,codeAfter:u.codeAfter,language:j3(u.editorView)})}):[]];var d},sE=t=>{const{theme:e,hotkeys:n,completionConfig:o,cellId:r,lspConfig:s,diagnosticsConfig:i}=t,a=J_(t);return[st.lineWrapping,Yz(),Jz(),Kz(),Xz(),Zz(),Qz(),eB(),tB({position:"fixed",parent:document.querySelector("#App")??void 0}),nB(),e==="dark"?Qj:Zj,oB(s),Yj(o),rB(),sB(),oE(),Vo.high(Hn.of(uB)),iB(),aB(),lB.of(" "),a4(hB,{fallback:!0}),Hn.of(fB),cB({placeholderType:a,completionConfig:o,hotkeys:n,cellId:r,lspConfig:{...s,diagnostics:i}}),dB.of(pB()),ca.allowMultipleSelections.of(!0),DN(n),Hn.of([{key:"Tab",run:l=>mB(l)||(c=>{const{from:d,to:u}=c.state.selection.main;if(d!==u)return!1;const f=c.state.doc.lineAt(u);return f.text.slice(0,u-f.from).trim()!==""&&yB(c)})(l)||gB(l),preventDefault:!0},{key:n.getHotkey("completion.moveDown").key,run:l=>sa(l.state)!==null&&(d4(!0)(l),!0),preventDefault:!0},{key:n.getHotkey("completion.moveUp").key,run:l=>sa(l.state)!==null&&(d4(!1)(l),!0),preventDefault:!0}]),Hn.of([..._B,bB])]};function K_(t){const e=t.current;if(e===null)throw new ReferenceError("Attempting to dereference null object.");return e}var Kd="ContextMenu",[iE,Z$]=h4(Kd,[u4]),cn=u4(),[aE,X_]=iE(Kd),Z_=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:o,dir:r,modal:s=!0}=t,[i,a]=A.useState(!1),l=cn(e),c=hr(o),d=A.useCallback(u=>{a(u),c(u)},[c]);return h.jsx(aE,{scope:e,open:i,onOpenChange:d,modal:s,children:h.jsx(OB,{...l,dir:r,open:i,onOpenChange:d,modal:s,children:n})})};Z_.displayName=Kd;var Q_="ContextMenuTrigger",e1=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:o=!1,...r}=t,s=X_(Q_,n),i=cn(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),[]),u=f=>{a.current={x:f.clientX,y:f.clientY},s.onOpenChange(!0)};return A.useEffect(()=>d,[d]),A.useEffect(()=>{o&&d()},[o,d]),h.jsxs(h.Fragment,{children:[h.jsx(vB,{...i,virtualRef:l}),h.jsx(Ws.span,{"data-state":s.open?"open":"closed","data-disabled":o?"":void 0,...r,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:o?t.onContextMenu:Wn(t.onContextMenu,f=>{d(),u(f),f.preventDefault()}),onPointerDown:o?t.onPointerDown:Wn(t.onPointerDown,rl(f=>{d(),c.current=window.setTimeout(()=>u(f),700)})),onPointerMove:o?t.onPointerMove:Wn(t.onPointerMove,rl(d)),onPointerCancel:o?t.onPointerCancel:Wn(t.onPointerCancel,rl(d)),onPointerUp:o?t.onPointerUp:Wn(t.onPointerUp,rl(d))})]})});e1.displayName=Q_;var t1=t=>{const{__scopeContextMenu:e,...n}=t,o=cn(e);return h.jsx(DB,{...o,...n})};t1.displayName="ContextMenuPortal";var n1="ContextMenuContent",o1=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=X_(n1,n),s=cn(n),i=A.useRef(!1);return h.jsx(kB,{...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)"}})});o1.displayName=n1,A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=cn(n);return h.jsx(SB,{...r,...o,ref:e})}).displayName="ContextMenuGroup";var r1=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=cn(n);return h.jsx(CB,{...r,...o,ref:e})});r1.displayName="ContextMenuLabel";var s1=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=cn(n);return h.jsx(wB,{...r,...o,ref:e})});s1.displayName="ContextMenuItem";var i1=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=cn(n);return h.jsx(NB,{...r,...o,ref:e})});i1.displayName="ContextMenuCheckboxItem",A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=cn(n);return h.jsx(jB,{...r,...o,ref:e})}).displayName="ContextMenuRadioGroup";var a1=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=cn(n);return h.jsx(EB,{...r,...o,ref:e})});a1.displayName="ContextMenuRadioItem";var l1=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=cn(n);return h.jsx(IB,{...r,...o,ref:e})});l1.displayName="ContextMenuItemIndicator";var c1=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=cn(n);return h.jsx(xB,{...r,...o,ref:e})});c1.displayName="ContextMenuSeparator",A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=cn(n);return h.jsx(AB,{...r,...o,ref:e})}).displayName="ContextMenuArrow";var d1=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=cn(n);return h.jsx(TB,{...r,...o,ref:e})});d1.displayName="ContextMenuSubTrigger";var u1=A.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=cn(n);return h.jsx(MB,{...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 rl(t){return e=>e.pointerType!=="mouse"?t(e):void 0}u1.displayName="ContextMenuSubContent";var h1=o1,f1=r1,p1=s1,m1=i1,g1=a1,_1=l1,b1=c1,y1=d1,x1=u1;const w1=Z_,v1=e1,lE=LB(t1);A.forwardRef((t,e)=>{const n=X.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=FB({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=h.jsx(UB,{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=h.jsxs(y1,{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=y1.displayName;const k1="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=X.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=Oe(f4({subcontent:!0}),k1,o),n[3]=o,n[4]=s):s=n[4],n[5]!==r||n[6]!==e||n[7]!==s?(i=h.jsx(x1,{ref:e,className:s,...r}),n[5]=r,n[6]=e,n[7]=s,n[8]=i):i=n[8],i}).displayName=x1.displayName;const Xd=A.forwardRef((t,e)=>{const n=X.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=Oe(f4(),k1,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=h.jsx(lE,{children:h.jsx(zB,{children:h.jsx(h1,{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});Xd.displayName=h1.displayName;const yi=A.forwardRef((t,e)=>{const n=X.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=PB({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=h.jsx(p1,{ref:e,className:a,...s}),n[9]=s,n[10]=e,n[11]=a,n[12]=l):l=n[12],l});yi.displayName=p1.displayName,A.forwardRef((t,e)=>{const n=X.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=jc({className:s}),n[5]=s,n[6]=a):a=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(l=jc(),n[7]=l):l=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx("span",{className:l,children:h.jsx(_1,{children:h.jsx(VB,{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=h.jsxs(m1,{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=m1.displayName,A.forwardRef((t,e)=>{const n=X.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=jc({className:r}),n[4]=r,n[5]=i):i=n[5],n[6]===Symbol.for("react.memo_cache_sentinel")?(a=jc(),n[6]=a):a=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx("span",{className:a,children:h.jsx(_1,{children:h.jsx($B,{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=h.jsxs(g1,{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=g1.displayName,A.forwardRef((t,e)=>{const n=X.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=BB({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=h.jsx(f1,{ref:e,className:i,...s}),n[7]=s,n[8]=e,n[9]=i,n[10]=a):a=n[10],a}).displayName=f1.displayName;const S1=A.forwardRef((t,e)=>{const n=X.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=Oe(RB({className:o})),n[3]=o,n[4]=s):s=n[4],n[5]!==r||n[6]!==e||n[7]!==s?(i=h.jsx(b1,{ref:e,className:s,...r}),n[5]=r,n[6]=e,n[7]=s,n[8]=i):i=n[8],i});S1.displayName=b1.displayName;const C1=t=>{const e=X.c(14),{appClosed:n,onClick:o,tooltipContent:r}=t;let s;e[0]!==o?(s=()=>o==null?void 0:o({code:""}),e[0]=o,e[1]=s):s=e[1];const i=n&&" inactive-button";let a,l,c,d,u;return e[2]!==i?(a=Oe("shoulder-button hover-action",i),e[2]=i,e[3]=a):a=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx(Lr,{strokeWidth:1.8}),e[4]=l):l=e[4],e[5]!==s||e[6]!==a?(c=h.jsx(xn,{onClick:s,className:a,onMouseDown:Vn.preventFocus,shape:"circle",size:"small",color:"hint-green","data-testid":"create-cell-button",children:l}),e[5]=s,e[6]=a,e[7]=c):c=e[7],e[8]!==c||e[9]!==r?(d=h.jsx(Re,{content:r,usePortal:!1,children:c}),e[8]=c,e[9]=r,e[10]=d):d=e[10],e[11]!==o||e[12]!==d?(u=h.jsx(cE,{onClick:o,children:d}),e[11]=o,e[12]=d,e[13]=u):u=e[13],u},cE=t=>{const e=X.c(24),{children:n,onClick:o}=t;if(!o)return n;let r,s,i,a,l,c,d,u,f,p,_,g;return e[0]!==n?(r=h.jsx(v1,{children:n}),e[0]=n,e[1]=r):r=e[1],e[2]!==o?(s=m=>{m.stopPropagation(),o({code:""})},e[2]=o,e[3]=s):s=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsx("div",{className:"mr-3 text-muted-foreground",children:h.jsx(ac,{})}),e[4]=i):i=e[4],e[5]!==s?(a=h.jsxs(yi,{onSelect:s,children:[i,"Python cell"]},"python"),e[5]=s,e[6]=a):a=e[6],e[7]!==o?(l=m=>{m.stopPropagation(),o({code:new ta().defaultCode})},e[7]=o,e[8]=l):l=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx("div",{className:"mr-3 text-muted-foreground",children:h.jsx(ic,{})}),e[9]=c):c=e[9],e[10]!==l?(d=h.jsxs(yi,{onSelect:l,children:[c,"Markdown cell"]},"markdown"),e[10]=l,e[11]=d):d=e[11],e[12]!==o?(u=m=>{m.stopPropagation(),o({code:new Ec().defaultCode})},e[12]=o,e[13]=u):u=e[13],e[14]===Symbol.for("react.memo_cache_sentinel")?(f=h.jsx("div",{className:"mr-3 text-muted-foreground",children:h.jsx(lr,{size:13,strokeWidth:1.5})}),e[14]=f):f=e[14],e[15]!==u?(p=h.jsxs(yi,{onSelect:u,children:[f,"SQL cell"]},"sql"),e[15]=u,e[16]=p):p=e[16],e[17]!==a||e[18]!==d||e[19]!==p?(_=h.jsxs(Xd,{children:[a,d,p]}),e[17]=a,e[18]=d,e[19]=p,e[20]=_):_=e[20],e[21]!==r||e[22]!==_?(g=h.jsxs(w1,{children:[r,_]}),e[21]=r,e[22]=_,e[23]=g):g=e[23],g},dE=HB("rounded-full shadow-xsSolid border p-[5px] transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 [&>svg]:size-3 active:shadow-none bg-background",{variants:{variant:{default:"hover:bg-accent hover:text-accent-foreground",stale:"bg-[var(--yellow-3)] hover:bg-[var(--yellow-4)] text-[var(--yellow-11)]",green:"hover:bg-[var(--grass-2)] hover:text-[var(--grass-11)] hover:border-[var(--grass-7)],",disabled:"opacity-50 cursor-not-allowed",danger:"hover:bg-[var(--red-3)] hover:text-[var(--red-11)]"}},defaultVariants:{variant:"default"}}),xi=t=>{const e=X.c(21);let n,o,r,s,i;e[0]!==t?({children:n,tooltip:s,disabled:r,variant:i,...o}=t,e[0]=t,e[1]=n,e[2]=o,e[3]=r,e[4]=s,e[5]=i):(n=e[1],o=e[2],r=e[3],s=e[4],i=e[5]);const a=r!==void 0&&r;let l,c,d;e[6]!==a||e[7]!==o?(l=f=>{var p;a||((p=o.onClick)==null||p.call(o,f))},e[6]=a,e[7]=o,e[8]=l):l=e[8],e[9]!==o.className||e[10]!==i?(c=Oe(dE({variant:i}),o.className),e[9]=o.className,e[10]=i,e[11]=c):c=e[11],e[12]!==n||e[13]!==a||e[14]!==o||e[15]!==l||e[16]!==c?(d=h.jsx("button",{disabled:a,...o,onClick:l,onMouseDown:Vn.preventFocus,className:c,children:n}),e[12]=n,e[13]=a,e[14]=o,e[15]=l,e[16]=c,e[17]=d):d=e[17];const u=d;if(s){let f;return e[18]!==u||e[19]!==s?(f=h.jsx(Re,{content:s,side:"top",delayDuration:200,usePortal:!1,children:u}),e[18]=u,e[19]=s,e[20]=f):f=e[20],f}return u},uE=t=>{const e=X.c(5),{children:n,className:o}=t;let r,s;return e[0]!==o?(r=Oe("flex items-center gap-1 bg-background m-[2px] rounded-full",o),e[0]=o,e[1]=r):r=e[1],e[2]!==n||e[3]!==r?(s=h.jsx(jS,{className:r,children:n}),e[2]=n,e[3]=r,e[4]=s):s=e[4],s},hE=t=>{const e=X.c(22),{onClick:n,appClosed:o,needsRun:r,status:s,config:i,edited:a}=t,l=s==="disabled-transitively",c=s==="running"||s==="queued",d=o||c||!i.disabled&&l&&!a;let u;e[0]!==o||e[1]!==d||e[2]!==c||e[3]!==r?(u=function(m,b,x,y){return m?"disabled":b&&!x?"stale":x||y?"disabled":"green"}(o,r,c,d),e[0]=o,e[1]=d,e[2]=c,e[3]=r,e[4]=u):u=e[4];const f=u;if(i.disabled){let m,b;return e[5]===Symbol.for("react.memo_cache_sentinel")?(m=h.jsx(ym,{}),e[5]=m):m=e[5],e[6]!==d||e[7]!==n||e[8]!==f?(b=h.jsx(xi,{tooltip:"Add code to notebook",disabled:d,onClick:n,variant:f,"data-testid":"run-button",children:m}),e[6]=d,e[7]=n,e[8]=f,e[9]=b):b=e[9],b}if(!i.disabled&&l&&!a){let m,b;return e[10]===Symbol.for("react.memo_cache_sentinel")?(m=h.jsx(Qs,{strokeWidth:1.2}),e[10]=m):m=e[10],e[11]!==d||e[12]!==n||e[13]!==f?(b=h.jsx(xi,{disabled:d,tooltip:"This cell can't be run because it has a disabled ancestor",onClick:n,variant:f,"data-testid":"run-button",children:m}),e[11]=d,e[12]=n,e[13]=f,e[14]=b):b=e[14],b}let p,_,g;if(o)p="App disconnected";else if(s==="queued")p="This cell is already queued to run";else if(s==="running")p="This cell is already running.";else{let m;e[15]===Symbol.for("react.memo_cache_sentinel")?(m=pn("cell.run"),e[15]=m):m=e[15],p=m}return e[16]===Symbol.for("react.memo_cache_sentinel")?(_=h.jsx(Qs,{strokeWidth:1.2}),e[16]=_):_=e[16],e[17]!==d||e[18]!==n||e[19]!==p||e[20]!==f?(g=h.jsx(xi,{tooltip:p,disabled:d,onClick:n,variant:f,"data-testid":"run-button",children:_}),e[17]=d,e[18]=n,e[19]=p,e[20]=f,e[21]=g):g=e[21],g},N1=t=>{const e=X.c(10),{status:n,appClosed:o,onClick:r}=t;let s;s=o?"App disconnected":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";const i=s,a=(o||n==="running"||n==="queued")&&"inactive-button";let l,c,d,u,f;return e[0]!==a?(l=Oe("hover:bg-transparent text-destructive/60 hover:text-destructive",a),e[0]=a,e[1]=l):l=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(c={boxShadow:"none"},d=h.jsx(ip,{size:14}),e[2]=c,e[3]=d):(c=e[2],d=e[3]),e[4]!==r||e[5]!==l?(u=h.jsx(Pe,{variant:"ghost",size:"icon",onClick:r,"data-testid":"delete-button",onMouseDown:Vn.preventFocus,className:l,style:c,children:d}),e[4]=r,e[5]=l,e[6]=u):u=e[6],e[7]!==u||e[8]!==s?(f=h.jsx(Re,{content:i,usePortal:!1,children:u}),e[7]=u,e[8]=s,e[9]=f):f=e[9],f};let j1,E1,I1,A1;j1=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!0}),E1=new Intl.DateTimeFormat("en-US",{month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!0}),I1=t=>{const e=X.c(79),{editing:n,status:o,disabled:r,staleInputs:s,edited:i,interrupted:a,elapsedTime:l,runStartTimestamp:c,lastRunStartTimestamp:d,uninstantiated:u}=t;if(!n)return null;const f=c??d;let p;e[0]!==f?(p=f?h.jsx(A1,{lastRanTime:f}):null,e[0]=f,e[1]=p):p=e[1];const _=p;if(r&&o==="running")return Xt.error("CellStatusComponent: disabled and running"),null;if(r&&s){let g,m,b,x;return e[2]===Symbol.for("react.memo_cache_sentinel")?(g=h.jsx("span",{children:"This cell is stale, but it's disabled and can't be run"}),e[2]=g):g=e[2],e[3]!==_?(m=h.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[3]=_,e[4]=m):m=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(b=h.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"stale",children:h.jsxs(ni,{children:[h.jsx(ei,{className:"h-5 w-5",strokeWidth:1.5}),h.jsx(Ic,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[5]=b):b=e[5],e[6]!==m?(x=h.jsx(Re,{content:m,usePortal:!0,children:b}),e[6]=m,e[7]=x):x=e[7],x}if(r){let g,m,b,x;return e[8]===Symbol.for("react.memo_cache_sentinel")?(g=h.jsx("span",{children:"This cell is disabled"}),e[8]=g):g=e[8],e[9]!==_?(m=h.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[9]=_,e[10]=m):m=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(b=h.jsx("div",{className:"cell-status-icon cell-status-disabled","data-testid":"cell-status","data-status":"disabled",children:h.jsx(ei,{className:"h-5 w-5",strokeWidth:1.5})}),e[11]=b):b=e[11],e[12]!==m?(x=h.jsx(Re,{content:m,usePortal:!0,children:b}),e[12]=m,e[13]=x):x=e[13],x}if(!s&&o==="disabled-transitively"){let g,m,b,x;return e[14]===Symbol.for("react.memo_cache_sentinel")?(g=h.jsx("span",{children:"An ancestor of this cell is disabled, so it can't be run"}),e[14]=g):g=e[14],e[15]!==_?(m=h.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[15]=_,e[16]=m):m=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(b=h.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"disabled-transitively",children:h.jsxs(ni,{layerTop:!0,children:[h.jsx(ja,{className:"h-5 w-5",strokeWidth:1.5}),h.jsx(ei,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[17]=b):b=e[17],e[18]!==m?(x=h.jsx(Re,{content:m,usePortal:!0,children:b}),e[18]=m,e[19]=x):x=e[19],x}if(s&&o==="disabled-transitively"){let g,m,b,x;return e[20]===Symbol.for("react.memo_cache_sentinel")?(g=h.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]!==_?(m=h.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[21]=_,e[22]=m):m=e[22],e[23]===Symbol.for("react.memo_cache_sentinel")?(b=h.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"stale",children:h.jsxs(ni,{children:[h.jsx(Ic,{className:"h-5 w-5",strokeWidth:1}),h.jsx(ei,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[23]=b):b=e[23],e[24]!==m?(x=h.jsx(Re,{content:m,usePortal:!0,children:b}),e[24]=m,e[25]=x):x=e[25],x}if(o==="running"){let g,m,b,x,y;return e[26]===Symbol.for("react.memo_cache_sentinel")?(g=h.jsx("span",{children:"This cell is running"}),e[26]=g):g=e[26],e[27]!==_?(m=h.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[27]=_,e[28]=m):m=e[28],e[29]!==c?(b=Np.fromSeconds(c)||Np.now(),e[29]=c,e[30]=b):b=e[30],e[31]!==b?(x=h.jsx("div",{className:"cell-status-icon elapsed-time running","data-testid":"cell-status","data-status":"running",children:h.jsx(fE,{startTime:b})}),e[31]=b,e[32]=x):x=e[32],e[33]!==m||e[34]!==x?(y=h.jsx(Re,{content:m,usePortal:!0,children:x}),e[33]=m,e[34]=x,e[35]=y):y=e[35],y}if(o==="queued"){let g,m,b,x;return e[36]===Symbol.for("react.memo_cache_sentinel")?(g=h.jsx("span",{children:"This cell is queued to run"}),e[36]=g):g=e[36],e[37]!==_?(m=h.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[37]=_,e[38]=m):m=e[38],e[39]===Symbol.for("react.memo_cache_sentinel")?(b=h.jsx("div",{className:"cell-status-icon cell-status-queued","data-testid":"cell-status","data-status":"queued",children:h.jsx(vS,{className:"h-5 w-5",strokeWidth:1.5})}),e[39]=b):b=e[39],e[40]!==m?(x=h.jsx(Re,{content:m,usePortal:!0,children:b}),e[40]=m,e[41]=x):x=e[41],x}if(i||a||s||u){let g;e[42]!==l?(g=wa(l),e[42]=l,e[43]=g):g=e[43];const m=g;let b;e[44]!==l||e[45]!==m?(b=l?h.jsx($c,{elapsedTime:m}):null,e[44]=l,e[45]=m,e[46]=b):b=e[46];const x=b;let y,v,k,S,E,j="";if(u)y="This cell has not yet been run";else if(a){let I;y="This cell was interrupted when it was last run",e[47]!==x?(I=h.jsxs("span",{children:["This cell ran for ",x," before being interrupted"]}),e[47]=x,e[48]=I):I=e[48],j=I}else if(i){let I;y="This cell has been modified since it was last run",e[49]!==x?(I=h.jsxs("span",{children:["This cell took ",x," to run"]}),e[49]=x,e[50]=I):I=e[50],j=I}else{let I;y="This cell has not been run with the latest inputs",e[51]!==x?(I=h.jsxs("span",{children:["This cell took ",x," to run"]}),e[51]=x,e[52]=I):I=e[52],j=I}return e[53]===Symbol.for("react.memo_cache_sentinel")?(v=h.jsx("div",{className:"cell-status-stale","data-testid":"cell-status","data-status":"outdated",children:h.jsx(Ic,{className:"h-5 w-5",strokeWidth:1.5})}),e[53]=v):v=e[53],e[54]!==y?(k=h.jsx(Re,{content:y,usePortal:!0,children:v}),e[54]=y,e[55]=k):k=e[55],e[56]!==l||e[57]!==m||e[58]!==_||e[59]!==j?(S=l&&h.jsx(Re,{content:h.jsxs("div",{className:"flex flex-col gap-1",children:[j,_]}),usePortal:!0,children:h.jsx("div",{className:"elapsed-time hover-action","data-testid":"cell-status","data-status":"outdated",children:h.jsx("span",{children:m})})}),e[56]=l,e[57]=m,e[58]=_,e[59]=j,e[60]=S):S=e[60],e[61]!==k||e[62]!==S?(E=h.jsxs("div",{className:"cell-status-icon flex items-center gap-2",children:[k,S]}),e[61]=k,e[62]=S,e[63]=E):E=e[63],E}if(l!==null){let g;e[64]!==l?(g=wa(l),e[64]=l,e[65]=g):g=e[65];const m=g;let b;e[66]!==l||e[67]!==m?(b=l?h.jsx($c,{elapsedTime:m}):null,e[66]=l,e[67]=m,e[68]=b):b=e[68];const x=b;let y,v,k,S;return e[69]!==x?(y=h.jsxs("span",{children:["This cell took ",x," to run"]}),e[69]=x,e[70]=y):y=e[70],e[71]!==_||e[72]!==y?(v=h.jsxs("div",{className:"flex flex-col gap-1",children:[y,_]}),e[71]=_,e[72]=y,e[73]=v):v=e[73],e[74]!==m?(k=h.jsx("div",{className:"cell-status-icon elapsed-time hover-action","data-testid":"cell-status","data-status":"idle",children:h.jsx("span",{children:m})}),e[74]=m,e[75]=k):k=e[75],e[76]!==v||e[77]!==k?(S=h.jsx(Re,{content:v,usePortal:!0,children:k}),e[76]=v,e[77]=k,e[78]=S):S=e[78],S}return null},$c=t=>{const e=X.c(2);let n;return e[0]!==t.elapsedTime?(n=h.jsx("span",{className:"tracking-wide font-semibold",children:t.elapsedTime}),e[0]=t.elapsedTime,e[1]=n):n=e[1],n},A1=t=>{const e=X.c(18),n=1e3*t.lastRanTime;let o,r,s,i,a,l,c,d,u;if(e[0]!==n){const f=new Date(n),p=new Date,_=f.toDateString()===p.toDateString()?j1:E1;i="Ran at",a=" ",l=h.jsx("strong",{className:"tracking-wide font-semibold",children:_.format(f)}),c=" ",o="text-muted-foreground",r="(",s=TS(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=h.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?(u=h.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]=u):u=e[17],u},wa=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 fE=t=>{const e=X.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(Np.now().toMilliseconds())},17);return()=>clearInterval(d)},[]),l-a.current}(n);let r,s;return e[2]!==o?(r=wa(o),e[2]=o,e[3]=r):r=e[3],e[4]!==r?(s=h.jsx("span",{children:r}),e[4]=r,e[5]=s):s=e[5],s},pE={display:"none"};function mE(t){let{id:e,value:n}=t;return K.createElement("div",{id:e,style:pE},n)}function gE(t){let{id:e,announcement:n,ariaLiveType:o="assertive"}=t;return K.createElement("div",{id:e,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":o,"aria-atomic":!0},n)}const T1=A.createContext(null),_E={draggable:`
115
115
  To pick up a draggable item, press the space bar.
116
116
  While dragging, use the arrow keys to move the item.
117
117
  Press space again to drop the item in its new position, or press escape to cancel.
118
- `},bE={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function yE(t){let{announcements:e=bE,container:n,hiddenTextDescribedById:o,screenReaderInstructions:r=_E}=t;const{announce:s,announcement:i}=function(){const[u,f]=A.useState("");return{announce:A.useCallback(p=>{p!=null&&f(p)},[]),announcement:u}}(),a=da("DndLiveRegion"),[l,c]=A.useState(!1);if(A.useEffect(()=>{c(!0)},[]),function(u){const f=A.useContext(T1);A.useEffect(()=>{if(!f)throw new Error("useDndMonitor must be used within a children of <DndContext>");return f(u)},[u,f])}(A.useMemo(()=>({onDragStart(u){let{active:f}=u;s(e.onDragStart({active:f}))},onDragMove(u){let{active:f,over:p}=u;e.onDragMove&&s(e.onDragMove({active:f,over:p}))},onDragOver(u){let{active:f,over:p}=u;s(e.onDragOver({active:f,over:p}))},onDragEnd(u){let{active:f,over:p}=u;s(e.onDragEnd({active:f,over:p}))},onDragCancel(u){let{active:f,over:p}=u;s(e.onDragCancel({active:f,over:p}))}}),[s,e])),!l)return null;const d=K.createElement(K.Fragment,null,K.createElement(mE,{id:o,value:r.draggable}),K.createElement(gE,{id:a,announcement:i}));return n?fa.createPortal(d,n):d}var zt;function sl(){}function M1(t,e){return A.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(zt||(zt={}));const qn=Object.freeze({x:0,y:0});function Xd(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function Zd(t,e){let{data:{value:n}}=t,{data:{value:o}}=e;return n-o}function xE(t,e){let{data:{value:n}}=t,{data:{value:o}}=e;return o-n}function Qd(t){let{left:e,top:n,height:o,width:r}=t;return[{x:e,y:n},{x:e+r,y:n},{x:e,y:n+o},{x:e+r,y:n+o}]}function eu(t,e){if(!t||t.length===0)return null;const[n]=t;return e?n[e]:n}function O1(t,e,n){return e===void 0&&(e=t.left),n===void 0&&(n=t.top),{x:e+.5*t.width,y:n+.5*t.height}}const tu=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:o}=t;const r=O1(e,e.left,e.top),s=[];for(const i of o){const{id:a}=i,l=n.get(a);if(l){const c=Xd(O1(l),r);s.push({id:a,data:{droppableContainer:i,value:c}})}}return s.sort(Zd)};function wE(t,e){const n=Math.max(e.top,t.top),o=Math.max(e.left,t.left),r=Math.min(e.left+e.width,t.left+t.width),s=Math.min(e.top+e.height,t.top+t.height),i=r-o,a=s-n;if(o<r&&n<s){const l=e.width*e.height,c=t.width*t.height,d=i*a;return Number((d/(l+c-d)).toFixed(4))}return 0}const D1=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:o}=t;const r=[];for(const s of o){const{id:i}=s,a=n.get(i);if(a){const l=wE(a,e);l>0&&r.push({id:i,data:{droppableContainer:s,value:l}})}}return r.sort(xE)};function vE(t,e){const{top:n,left:o,bottom:r,right:s}=e;return n<=t.y&&t.y<=r&&o<=t.x&&t.x<=s}function R1(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:qn}function kE(t){return function(e){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return o.reduce((s,i)=>({...s,top:s.top+t*i.y,bottom:s.bottom+t*i.y,left:s.left+t*i.x,right:s.right+t*i.x}),{...e})}}const SE=kE(1),CE={ignoreTransform:!1};function Gr(t,e){e===void 0&&(e=CE);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:c,transformOrigin:d}=$o(t).getComputedStyle(t);c&&(n=function(u,f,p){const _=function(E){if(E.startsWith("matrix3d(")){const j=E.slice(9,-1).split(/, /);return{x:+j[12],y:+j[13],scaleX:+j[0],scaleY:+j[5]}}if(E.startsWith("matrix(")){const j=E.slice(7,-1).split(/, /);return{x:+j[4],y:+j[5],scaleX:+j[0],scaleY:+j[3]}}return null}(f);if(!_)return u;const{scaleX:g,scaleY:m,x:b,y:x}=_,y=u.left-b-(1-g)*parseFloat(p),v=u.top-x-(1-m)*parseFloat(p.slice(p.indexOf(" ")+1)),k=g?u.width/g:u.width,S=m?u.height/m:u.height;return{width:k,height:S,top:v,right:y+k,bottom:v+S,left:y}}(n,c,d))}const{top:o,left:r,width:s,height:i,bottom:a,right:l}=n;return{top:o,left:r,width:s,height:i,bottom:a,right:l}}function P1(t){return Gr(t,{ignoreTransform:!0})}function il(t,e){const n=[];return t?function o(r){if(e!=null&&n.length>=e||!r)return n;if(m4(r)&&r.scrollingElement!=null&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!Tc(r)||WB(r)||n.includes(r))return n;const s=$o(t).getComputedStyle(r);return r!==t&&function(i,a){a===void 0&&(a=$o(i).getComputedStyle(i));const l=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(c=>{const d=a[c];return typeof d=="string"&&l.test(d)})}(r,s)&&n.push(r),function(i,a){return a===void 0&&(a=$o(i).getComputedStyle(i)),a.position==="fixed"}(r,s)?n:o(r.parentNode)}(t):n}function L1(t){const[e]=il(t,1);return e??null}function nu(t){return Ep&&t?Ip(t)?t:YB(t)?m4(t)||t===qs(t).scrollingElement?window:Tc(t)?t:null:null:null}function F1(t){return Ip(t)?t.scrollX:t.scrollLeft}function z1(t){return Ip(t)?t.scrollY:t.scrollTop}function ou(t){return{x:F1(t),y:z1(t)}}var $t;function B1(t){return!(!Ep||!t)&&t===document.scrollingElement}function U1(t){const e={x:0,y:0},n=B1(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},o={x:t.scrollWidth-n.width,y:t.scrollHeight-n.height};return{isTop:t.scrollTop<=e.y,isLeft:t.scrollLeft<=e.x,isBottom:t.scrollTop>=o.y,isRight:t.scrollLeft>=o.x,maxScroll:o,minScroll:e}}(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})($t||($t={}));const NE={x:.2,y:.2};function jE(t,e,n,o,r){let{top:s,left:i,right:a,bottom:l}=n;o===void 0&&(o=10),r===void 0&&(r=NE);const{isTop:c,isBottom:d,isLeft:u,isRight:f}=U1(t),p={x:0,y:0},_={x:0,y:0},g=e.height*r.y,m=e.width*r.x;return!c&&s<=e.top+g?(p.y=$t.Backward,_.y=o*Math.abs((e.top+g-s)/g)):!d&&l>=e.bottom-g&&(p.y=$t.Forward,_.y=o*Math.abs((e.bottom-g-l)/g)),!f&&a>=e.right-m?(p.x=$t.Forward,_.x=o*Math.abs((e.right-m-a)/m)):!u&&i<=e.left+m&&(p.x=$t.Backward,_.x=o*Math.abs((e.left+m-i)/m)),{direction:p,speed:_}}function EE(t){if(t===document.scrollingElement){const{innerWidth:s,innerHeight:i}=window;return{top:0,left:0,right:s,bottom:i,width:s,height:i}}const{top:e,left:n,right:o,bottom:r}=t.getBoundingClientRect();return{top:e,left:n,right:o,bottom:r,width:t.clientWidth,height:t.clientHeight}}function V1(t){return t.reduce((e,n)=>Gs(e,ou(n)),qn)}const IE=[["x",["left","right"],function(t){return t.reduce((e,n)=>e+F1(n),0)}],["y",["top","bottom"],function(t){return t.reduce((e,n)=>e+z1(n),0)}]];class ru{constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const o=il(n),r=V1(o);this.rect={...e},this.width=e.width,this.height=e.height;for(const[s,i,a]of IE)for(const l of i)Object.defineProperty(this,l,{get:()=>{const c=a(o),d=r[s]-c;return this.rect[l]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class wi{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var o;return(o=this.target)==null?void 0:o.removeEventListener(...n)})},this.target=e}add(e,n,o){var r;(r=this.target)==null||r.addEventListener(e,n,o),this.listeners.push([e,n,o])}}function su(t,e){const n=Math.abs(t.x),o=Math.abs(t.y);return typeof e=="number"?Math.sqrt(n**2+o**2)>e:"x"in e&&"y"in e?n>e.x&&o>e.y:"x"in e?n>e.x:"y"in e&&o>e.y}var Tn,ct;function $1(t){t.preventDefault()}function AE(t){t.stopPropagation()}(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(Tn||(Tn={})),function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"}(ct||(ct={}));const H1={start:[ct.Space,ct.Enter],cancel:[ct.Esc],end:[ct.Space,ct.Enter,ct.Tab]},TE=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case ct.Right:return{...n,x:n.x+25};case ct.Left:return{...n,x:n.x-25};case ct.Down:return{...n,y:n.y+25};case ct.Up:return{...n,y:n.y-25}}};class iu{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new wi(qs(n)),this.windowListeners=new wi($o(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Tn.Resize,this.handleCancel),this.windowListeners.add(Tn.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Tn.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,o=e.node.current;o&&function(r,s){if(s===void 0&&(s=Gr),!r)return;const{top:i,left:a,bottom:l,right:c}=s(r);L1(r)&&(l<=0||c<=0||i>=window.innerHeight||a>=window.innerWidth)&&r.scrollIntoView({block:"center",inline:"center"})}(o),n(qn)}handleKeyDown(e){if(Np(e)){const{active:n,context:o,options:r}=this.props,{keyboardCodes:s=H1,coordinateGetter:i=TE,scrollBehavior:a="smooth"}=r,{code:l}=e;if(s.end.includes(l))return void this.handleEnd(e);if(s.cancel.includes(l))return void this.handleCancel(e);const{collisionRect:c}=o.current,d=c?{x:c.left,y:c.top}:qn;this.referenceCoordinates||(this.referenceCoordinates=d);const u=i(e,{active:n,context:o.current,currentCoordinates:d});if(u){const f=ha(u,d),p={x:0,y:0},{scrollableAncestors:_}=o.current;for(const g of _){const m=e.code,{isTop:b,isRight:x,isLeft:y,isBottom:v,maxScroll:k,minScroll:S}=U1(g),E=EE(g),j={x:Math.min(m===ct.Right?E.right-E.width/2:E.right,Math.max(m===ct.Right?E.left:E.left+E.width/2,u.x)),y:Math.min(m===ct.Down?E.bottom-E.height/2:E.bottom,Math.max(m===ct.Down?E.top:E.top+E.height/2,u.y))},I=m===ct.Right&&!x||m===ct.Left&&!y,T=m===ct.Down&&!v||m===ct.Up&&!b;if(I&&j.x!==u.x){const M=g.scrollLeft+f.x,L=m===ct.Right&&M<=k.x||m===ct.Left&&M>=S.x;if(L&&!f.y)return void g.scrollTo({left:M,behavior:a});p.x=L?g.scrollLeft-M:m===ct.Right?g.scrollLeft-k.x:g.scrollLeft-S.x,p.x&&g.scrollBy({left:-p.x,behavior:a});break}if(T&&j.y!==u.y){const M=g.scrollTop+f.y,L=m===ct.Down&&M<=k.y||m===ct.Up&&M>=S.y;if(L&&!f.x)return void g.scrollTo({top:M,behavior:a});p.y=L?g.scrollTop-M:m===ct.Down?g.scrollTop-k.y:g.scrollTop-S.y,p.y&&g.scrollBy({top:-p.y,behavior:a});break}}this.handleMove(e,Gs(ha(u,this.referenceCoordinates),p))}}}handleMove(e,n){const{onMove:o}=this.props;e.preventDefault(),o(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function W1(t){return!!(t&&"distance"in t)}function q1(t){return!!(t&&"delay"in t)}iu.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:o=H1,onActivation:r}=e,{active:s}=n;const{code:i}=t.nativeEvent;if(o.start.includes(i)){const a=s.activatorNode.current;return(!a||t.target===a)&&(t.preventDefault(),r==null||r({event:t.nativeEvent}),!0)}return!1}}];class au{constructor(e,n,o){var r;o===void 0&&(o=function(a){const{EventTarget:l}=$o(a);return a instanceof l?a:qs(a)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:s}=e,{target:i}=s;this.props=e,this.events=n,this.document=qs(i),this.documentListeners=new wi(this.document),this.listeners=new wi(o),this.windowListeners=new wi($o(i)),this.initialCoordinates=(r=jp(s))!=null?r:qn,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:o}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Tn.Resize,this.handleCancel),this.windowListeners.add(Tn.DragStart,$1),this.windowListeners.add(Tn.VisibilityChange,this.handleCancel),this.windowListeners.add(Tn.ContextMenu,$1),this.documentListeners.add(Tn.Keydown,this.handleKeydown),n){if(o!=null&&o({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(q1(n))return this.timeoutId=setTimeout(this.handleStart,n.delay),void this.handlePending(n);if(W1(n))return void this.handlePending(n)}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){const{active:o,onPending:r}=this.props;r(o,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(Tn.Click,AE,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Tn.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:o,initialCoordinates:r,props:s}=this,{onMove:i,options:{activationConstraint:a}}=s;if(!r)return;const l=(n=jp(e))!=null?n:qn,c=ha(r,l);if(!o&&a){if(W1(a)){if(a.tolerance!=null&&su(c,a.tolerance))return this.handleCancel();if(su(c,a.distance))return this.handleStart()}return q1(a)&&su(c,a.tolerance)?this.handleCancel():void this.handlePending(a,c)}e.cancelable&&e.preventDefault(),i(l)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===ct.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const ME={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class lu extends au{constructor(e){const{event:n}=e,o=qs(n.target);super(e,ME,o)}}lu.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:o}=e;return!(!n.isPrimary||n.button!==0)&&(o==null||o({event:n}),!0)}}];const OE={move:{name:"mousemove"},end:{name:"mouseup"}};var cu;(function(t){t[t.RightClick=2]="RightClick"})(cu||(cu={})),(class extends au{constructor(t){super(t,OE,qs(t.event.target))}}).activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:o}=e;return n.button!==cu.RightClick&&(o==null||o({event:n}),!0)}}];const du={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};var vi,al;function DE(t){let{acceleration:e,activator:n=vi.Pointer,canScroll:o,draggingRect:r,enabled:s,interval:i=5,order:a=al.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:d,delta:u,threshold:f}=t;const p=function(S){let{delta:E,disabled:j}=S;const I=Mc(E);return pa(T=>{if(j||!I||!T)return RE;const M={x:Math.sign(E.x-I.x),y:Math.sign(E.y-I.y)};return{x:{[$t.Backward]:T.x[$t.Backward]||M.x===-1,[$t.Forward]:T.x[$t.Forward]||M.x===1},y:{[$t.Backward]:T.y[$t.Backward]||M.y===-1,[$t.Forward]:T.y[$t.Forward]||M.y===1}}},[j,E,I])}({delta:u,disabled:!s}),[_,g]=qB(),m=A.useRef({x:0,y:0}),b=A.useRef({x:0,y:0}),x=A.useMemo(()=>{switch(n){case vi.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case vi.DraggableRect:return r}},[n,r,l]),y=A.useRef(null),v=A.useCallback(()=>{const S=y.current;if(!S)return;const E=m.current.x*b.current.x,j=m.current.y*b.current.y;S.scrollBy(E,j)},[]),k=A.useMemo(()=>a===al.TreeOrder?[...c].reverse():c,[a,c]);A.useEffect(()=>{if(s&&c.length&&x){for(const S of k){if((o==null?void 0:o(S))===!1)continue;const E=c.indexOf(S),j=d[E];if(!j)continue;const{direction:I,speed:T}=jE(S,j,x,e,f);for(const M of["x","y"])p[M][I[M]]||(T[M]=0,I[M]=0);if(T.x>0||T.y>0)return g(),y.current=S,_(v,i),m.current=T,void(b.current=I)}m.current={x:0,y:0},b.current={x:0,y:0},g()}else g()},[e,v,o,g,s,i,JSON.stringify(x),JSON.stringify(p),_,c,k,d,JSON.stringify(f)])}(class extends au{constructor(t){super(t,du)}static setup(){return window.addEventListener(du.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(du.move.name,t)};function t(){}}}).activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:o}=e;const{touches:r}=n;return!(r.length>1)&&(o==null||o({event:n}),!0)}}],function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"}(vi||(vi={})),function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"}(al||(al={}));const RE={x:{[$t.Backward]:!1,[$t.Forward]:!1},y:{[$t.Backward]:!1,[$t.Forward]:!1}};var ki,uu;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(ki||(ki={})),function(t){t.Optimized="optimized"}(uu||(uu={}));const G1=new Map;function Y1(t,e){return pa(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function ll(t){let{callback:e,disabled:n}=t;const o=p4(e),r=A.useMemo(()=>{if(n||typeof window>"u"||window.ResizeObserver===void 0)return;const{ResizeObserver:s}=window;return new s(o)},[n]);return A.useEffect(()=>()=>r==null?void 0:r.disconnect(),[r]),r}function PE(t){return new ru(Gr(t),t)}function J1(t,e,n){e===void 0&&(e=PE);const[o,r]=A.useState(null);function s(){r(l=>{if(!t)return null;var c;if(t.isConnected===!1)return(c=l??n)!=null?c:null;const d=e(t);return JSON.stringify(l)===JSON.stringify(d)?l:d})}const i=function(l){let{callback:c,disabled:d}=l;const u=p4(c),f=A.useMemo(()=>{if(d||typeof window>"u"||window.MutationObserver===void 0)return;const{MutationObserver:p}=window;return new p(u)},[u,d]);return A.useEffect(()=>()=>f==null?void 0:f.disconnect(),[f]),f}({callback(l){if(t)for(const c of l){const{type:d,target:u}=c;if(d==="childList"&&u instanceof HTMLElement&&u.contains(t)){s();break}}}}),a=ll({callback:s});return fr(()=>{s(),t?(a==null||a.observe(t),i==null||i.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),i==null||i.disconnect())},[t]),o}const K1=[];function X1(t,e){e===void 0&&(e=[]);const n=A.useRef(null);return A.useEffect(()=>{n.current=null},e),A.useEffect(()=>{const o=t!==qn;o&&!n.current&&(n.current=t),!o&&n.current&&(n.current=null)},[t]),n.current?ha(t,n.current):qn}function Z1(t){return A.useMemo(()=>t?function(e){const n=e.innerWidth,o=e.innerHeight;return{top:0,left:0,right:n,bottom:o,width:n,height:o}}(t):null,[t])}const Q1=[];function LE(t){let{measure:e}=t;const[n,o]=A.useState(null),r=A.useCallback(c=>{for(const{target:d}of c)if(Tc(d)){o(u=>{const f=e(d);return u?{...u,width:f.width,height:f.height}:f});break}},[e]),s=ll({callback:r}),i=A.useCallback(c=>{const d=function(u){if(!u)return null;if(u.children.length>1)return u;const f=u.children[0];return Tc(f)?f:u}(c);s==null||s.disconnect(),d&&(s==null||s.observe(d)),o(d?e(d):null)},[e,s]),[a,l]=Ac(i);return A.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const FE=[{sensor:lu,options:{}},{sensor:iu,options:{}}],zE={current:{}},cl={draggable:{measure:P1},droppable:{measure:P1,strategy:ki.WhileDragging,frequency:uu.Optimized},dragOverlay:{measure:Gr}};class Si extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,o;return(n=(o=this.get(e))==null?void 0:o.node.current)!=null?n:void 0}}const BE={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Si,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:sl},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:cl,measureDroppableContainers:sl,windowRect:null,measuringScheduled:!1},UE={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:sl,draggableNodes:new Map,over:null,measureDroppableContainers:sl},dl=A.createContext(UE),e0=A.createContext(BE);function VE(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Si}}}function $E(t,e){switch(e.type){case zt.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case zt.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case zt.DragEnd:case zt.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case zt.RegisterDroppable:{const{element:n}=e,{id:o}=n,r=new Si(t.droppable.containers);return r.set(o,n),{...t,droppable:{...t.droppable,containers:r}}}case zt.SetDroppableDisabled:{const{id:n,key:o,disabled:r}=e,s=t.droppable.containers.get(n);if(!s||o!==s.key)return t;const i=new Si(t.droppable.containers);return i.set(n,{...s,disabled:r}),{...t,droppable:{...t.droppable,containers:i}}}case zt.UnregisterDroppable:{const{id:n,key:o}=e,r=t.droppable.containers.get(n);if(!r||o!==r.key)return t;const s=new Si(t.droppable.containers);return s.delete(n),{...t,droppable:{...t.droppable,containers:s}}}default:return t}}function HE(t){let{disabled:e}=t;const{active:n,activatorEvent:o,draggableNodes:r}=A.useContext(dl),s=Mc(o),i=Mc(n==null?void 0:n.id);return A.useEffect(()=>{if(!e&&!o&&s&&i!=null){if(!Np(s)||document.activeElement===s.target)return;const a=r.get(i);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const d of[l.current,c.current]){if(!d)continue;const u=GB(d);if(u){u.focus();break}}})}},[o,e,r,i,s]),null}const t0=A.createContext({...qn,scaleX:1,scaleY:1});var Yo;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(Yo||(Yo={}));const WE=A.memo(function(t){var e,n,o,r;let{id:s,accessibility:i,autoScroll:a=!0,children:l,sensors:c=FE,collisionDetection:d=D1,measuring:u,modifiers:f,...p}=t;const _=A.useReducer($E,void 0,VE),[g,m]=_,[b,x]=function(){const[le]=A.useState(()=>new Set),Ee=A.useCallback(Ie=>(le.add(Ie),()=>le.delete(Ie)),[le]);return[A.useCallback(Ie=>{let{type:Ue,event:We}=Ie;le.forEach(De=>{var Ge;return(Ge=De[Ue])==null?void 0:Ge.call(De,We)})},[le]),Ee]}(),[y,v]=A.useState(Yo.Uninitialized),k=y===Yo.Initialized,{draggable:{active:S,nodes:E,translate:j},droppable:{containers:I}}=g,T=S!=null?E.get(S):null,M=A.useRef({initial:null,translated:null}),L=A.useMemo(()=>{var le;return S!=null?{id:S,data:(le=T==null?void 0:T.data)!=null?le:zE,rect:M}:null},[S,T]),B=A.useRef(null),[O,z]=A.useState(null),[F,V]=A.useState(null),P=ua(p,Object.values(p)),C=da("DndDescribedBy",s),$=A.useMemo(()=>I.getEnabled(),[I]),N=(H=u,A.useMemo(()=>({draggable:{...cl.draggable,...H==null?void 0:H.draggable},droppable:{...cl.droppable,...H==null?void 0:H.droppable},dragOverlay:{...cl.dragOverlay,...H==null?void 0:H.dragOverlay}}),[H==null?void 0:H.draggable,H==null?void 0:H.droppable,H==null?void 0:H.dragOverlay]));var H;const{droppableRects:G,measureDroppableContainers:Z,measuringScheduled:q}=function(le,Ee){let{dragging:Ie,dependencies:Ue,config:We}=Ee;const[De,Ge]=A.useState(null),{frequency:ot,measure:Je,strategy:rt}=We,mt=A.useRef(le),yt=function(){switch(rt){case ki.Always:return!1;case ki.BeforeDragging:return Ie;default:return!Ie}}(),Mt=ua(yt),xt=A.useCallback(function(hn){hn===void 0&&(hn=[]),Mt.current||Ge(rn=>rn===null?hn:rn.concat(hn.filter(Kt=>!rn.includes(Kt))))},[Mt]),Bt=A.useRef(null),Sn=pa(hn=>{if(yt&&!Ie)return G1;if(!hn||hn===G1||mt.current!==le||De!=null){const rn=new Map;for(let Kt of le){if(!Kt)continue;if(De&&De.length>0&&!De.includes(Kt.id)&&Kt.rect.current){rn.set(Kt.id,Kt.rect.current);continue}const Jn=Kt.node.current,ho=Jn?new ru(Je(Jn),Jn):null;Kt.rect.current=ho,ho&&rn.set(Kt.id,ho)}return rn}return hn},[le,De,Ie,yt,Je]);return A.useEffect(()=>{mt.current=le},[le]),A.useEffect(()=>{yt||xt()},[Ie,yt]),A.useEffect(()=>{De&&De.length>0&&Ge(null)},[JSON.stringify(De)]),A.useEffect(()=>{yt||typeof ot!="number"||Bt.current!==null||(Bt.current=setTimeout(()=>{xt(),Bt.current=null},ot))},[ot,yt,xt,...Ue]),{droppableRects:Sn,measureDroppableContainers:xt,measuringScheduled:De!=null}}($,{dragging:k,dependencies:[j.x,j.y],config:N.droppable}),re=function(le,Ee){const Ie=Ee!=null?le.get(Ee):void 0,Ue=Ie?Ie.node.current:null;return pa(We=>{var De;return Ee==null?null:(De=Ue??We)!=null?De:null},[Ue,Ee])}(E,S),ne=A.useMemo(()=>F?jp(F):null,[F]),oe=function(){const le=(O==null?void 0:O.autoScrollEnabled)===!1,Ee=typeof a=="object"?a.enabled===!1:a===!1,Ie=k&&!le&&!Ee;return typeof a=="object"?{...a,enabled:Ie}:{enabled:Ie}}(),Y=function(le,Ee){return Y1(le,Ee)}(re,N.draggable.measure);(function(le){let{activeNode:Ee,measure:Ie,initialRect:Ue,config:We=!0}=le;const De=A.useRef(!1),{x:Ge,y:ot}=typeof We=="boolean"?{x:We,y:We}:We;fr(()=>{if(!Ge&&!ot||!Ee)return void(De.current=!1);if(De.current||!Ue)return;const Je=Ee==null?void 0:Ee.node.current;if(!Je||Je.isConnected===!1)return;const rt=R1(Ie(Je),Ue);if(Ge||(rt.x=0),ot||(rt.y=0),De.current=!0,Math.abs(rt.x)>0||Math.abs(rt.y)>0){const mt=L1(Je);mt&&mt.scrollBy({top:rt.y,left:rt.x})}},[Ee,Ge,ot,Ue,Ie])})({activeNode:S!=null?E.get(S):null,config:oe.layoutShiftCompensation,initialRect:Y,measure:N.draggable.measure});const Q=J1(re,N.draggable.measure,Y),ce=J1(re?re.parentElement:null),he=A.useRef({activatorEvent:null,active:null,activeNode:re,collisionRect:null,collisions:null,droppableRects:G,draggableNodes:E,draggingNode:null,draggingNodeRect:null,droppableContainers:I,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),de=I.getNodeFor((e=he.current.over)==null?void 0:e.id),me=LE({measure:N.dragOverlay.measure}),ie=(n=me.nodeRef.current)!=null?n:re,Ce=k?(o=me.rect)!=null?o:Q:null,we=!!(me.nodeRef.current&&me.rect),ae=R1(ve=we?null:Q,Y1(ve));var ve;const ge=Z1(ie?$o(ie):null),be=function(le){const Ee=A.useRef(le),Ie=pa(Ue=>le?Ue&&Ue!==K1&&le&&Ee.current&&le.parentNode===Ee.current.parentNode?Ue:il(le):K1,[le]);return A.useEffect(()=>{Ee.current=le},[le]),Ie}(k?de??re:null),Te=function(le,Ee){Ee===void 0&&(Ee=Gr);const[Ie]=le,Ue=Z1(Ie?$o(Ie):null),[We,De]=A.useState(Q1);function Ge(){De(()=>le.length?le.map(Je=>B1(Je)?Ue:new ru(Ee(Je),Je)):Q1)}const ot=ll({callback:Ge});return fr(()=>{ot==null||ot.disconnect(),Ge(),le.forEach(Je=>ot==null?void 0:ot.observe(Je))},[le]),We}(be),ze=function(le,Ee){let{transform:Ie,...Ue}=Ee;return le!=null&&le.length?le.reduce((We,De)=>De({transform:We,...Ue}),Ie):Ie}(f,{transform:{x:j.x-ae.x,y:j.y-ae.y,scaleX:1,scaleY:1},activatorEvent:F,active:L,activeNodeRect:Q,containerNodeRect:ce,draggingNodeRect:Ce,over:he.current.over,overlayNodeRect:me.rect,scrollableAncestors:be,scrollableAncestorRects:Te,windowRect:ge}),Xe=ne?Gs(ne,j):null,Fe=function(le){const[Ee,Ie]=A.useState(null),Ue=A.useRef(le),We=A.useCallback(De=>{const Ge=nu(De.target);Ge&&Ie(ot=>ot?(ot.set(Ge,ou(Ge)),new Map(ot)):null)},[]);return A.useEffect(()=>{const De=Ue.current;if(le!==De){Ge(De);const ot=le.map(Je=>{const rt=nu(Je);return rt?(rt.addEventListener("scroll",We,{passive:!0}),[rt,ou(rt)]):null}).filter(Je=>Je!=null);Ie(ot.length?new Map(ot):null),Ue.current=le}return()=>{Ge(le),Ge(De)};function Ge(ot){ot.forEach(Je=>{const rt=nu(Je);rt==null||rt.removeEventListener("scroll",We)})}},[We,le]),A.useMemo(()=>le.length?Ee?Array.from(Ee.values()).reduce((De,Ge)=>Gs(De,Ge),qn):V1(le):qn,[le,Ee])}(be),et=X1(Fe),nt=X1(Fe,[Q]),it=Gs(ze,et),te=Ce?SE(Ce,ze):null,Ne=L&&te?d({active:L,collisionRect:te,droppableRects:G,droppableContainers:$,pointerCoordinates:Xe}):null,Me=eu(Ne,"id"),[Be,J]=A.useState(null),pe=function(le,Ee,Ie){return{...le,scaleX:Ee&&Ie?Ee.width/Ie.width:1,scaleY:Ee&&Ie?Ee.height/Ie.height:1}}(we?ze:Gs(ze,nt),(r=Be==null?void 0:Be.rect)!=null?r:null,Q),_e=A.useRef(null),ue=A.useCallback((le,Ee)=>{let{sensor:Ie,options:Ue}=Ee;if(B.current==null)return;const We=E.get(B.current);if(!We)return;const De=le.nativeEvent,Ge=new Ie({active:B.current,activeNode:We,event:De,options:Ue,context:he,onAbort(Je){if(!E.get(Je))return;const{onDragAbort:rt}=P.current,mt={id:Je};rt==null||rt(mt),b({type:"onDragAbort",event:mt})},onPending(Je,rt,mt,yt){if(!E.get(Je))return;const{onDragPending:Mt}=P.current,xt={id:Je,constraint:rt,initialCoordinates:mt,offset:yt};Mt==null||Mt(xt),b({type:"onDragPending",event:xt})},onStart(Je){const rt=B.current;if(rt==null)return;const mt=E.get(rt);if(!mt)return;const{onDragStart:yt}=P.current,Mt={activatorEvent:De,active:{id:rt,data:mt.data,rect:M}};fa.unstable_batchedUpdates(()=>{yt==null||yt(Mt),v(Yo.Initializing),m({type:zt.DragStart,initialCoordinates:Je,active:rt}),b({type:"onDragStart",event:Mt}),z(_e.current),V(De)})},onMove(Je){m({type:zt.DragMove,coordinates:Je})},onEnd:ot(zt.DragEnd),onCancel:ot(zt.DragCancel)});function ot(Je){return async function(){const{active:rt,collisions:mt,over:yt,scrollAdjustedTranslate:Mt}=he.current;let xt=null;if(rt&&Mt){const{cancelDrop:Bt}=P.current;xt={activatorEvent:De,active:rt,collisions:mt,delta:Mt,over:yt},Je===zt.DragEnd&&typeof Bt=="function"&&await Promise.resolve(Bt(xt))&&(Je=zt.DragCancel)}B.current=null,fa.unstable_batchedUpdates(()=>{m({type:Je}),v(Yo.Uninitialized),J(null),z(null),V(null),_e.current=null;const Bt=Je===zt.DragEnd?"onDragEnd":"onDragCancel";if(xt){const Sn=P.current[Bt];Sn==null||Sn(xt),b({type:Bt,event:xt})}})}}_e.current=Ge},[E]),je=A.useCallback((le,Ee)=>(Ie,Ue)=>{const We=Ie.nativeEvent,De=E.get(Ue);if(B.current!==null||!De||We.dndKit||We.defaultPrevented)return;const Ge={active:De};le(Ie,Ee.options,Ge)===!0&&(We.dndKit={capturedBy:Ee.sensor},B.current=Ue,ue(Ie,Ee))},[E,ue]),ke=function(le,Ee){return A.useMemo(()=>le.reduce((Ie,Ue)=>{const{sensor:We}=Ue;return[...Ie,...We.activators.map(De=>({eventName:De.eventName,handler:Ee(De.handler,Ue)}))]},[]),[le,Ee])}(c,je);(function(le){A.useEffect(()=>{if(!Ep)return;const Ee=le.map(Ie=>{let{sensor:Ue}=Ie;return Ue.setup==null?void 0:Ue.setup()});return()=>{for(const Ie of Ee)Ie==null||Ie()}},le.map(Ee=>{let{sensor:Ie}=Ee;return Ie}))})(c),fr(()=>{Q&&y===Yo.Initializing&&v(Yo.Initialized)},[Q,y]),A.useEffect(()=>{const{onDragMove:le}=P.current,{active:Ee,activatorEvent:Ie,collisions:Ue,over:We}=he.current;if(!Ee||!Ie)return;const De={active:Ee,activatorEvent:Ie,collisions:Ue,delta:{x:it.x,y:it.y},over:We};fa.unstable_batchedUpdates(()=>{le==null||le(De),b({type:"onDragMove",event:De})})},[it.x,it.y]),A.useEffect(()=>{const{active:le,activatorEvent:Ee,collisions:Ie,droppableContainers:Ue,scrollAdjustedTranslate:We}=he.current;if(!le||B.current==null||!Ee||!We)return;const{onDragOver:De}=P.current,Ge=Ue.get(Me),ot=Ge&&Ge.rect.current?{id:Ge.id,rect:Ge.rect.current,data:Ge.data,disabled:Ge.disabled}:null,Je={active:le,activatorEvent:Ee,collisions:Ie,delta:{x:We.x,y:We.y},over:ot};fa.unstable_batchedUpdates(()=>{J(ot),De==null||De(Je),b({type:"onDragOver",event:Je})})},[Me]),fr(()=>{he.current={activatorEvent:F,active:L,activeNode:re,collisionRect:te,collisions:Ne,droppableRects:G,draggableNodes:E,draggingNode:ie,draggingNodeRect:Ce,droppableContainers:I,over:Be,scrollableAncestors:be,scrollAdjustedTranslate:it},M.current={initial:Ce,translated:te}},[L,re,Ne,te,E,ie,Ce,G,I,Be,be,it]),DE({...oe,delta:j,draggingRect:te,pointerCoordinates:Xe,scrollableAncestors:be,scrollableAncestorRects:Te});const Ve=A.useMemo(()=>({active:L,activeNode:re,activeNodeRect:Q,activatorEvent:F,collisions:Ne,containerNodeRect:ce,dragOverlay:me,draggableNodes:E,droppableContainers:I,droppableRects:G,over:Be,measureDroppableContainers:Z,scrollableAncestors:be,scrollableAncestorRects:Te,measuringConfiguration:N,measuringScheduled:q,windowRect:ge}),[L,re,Q,F,Ne,ce,me,E,I,G,Be,Z,be,Te,N,q,ge]),Ze=A.useMemo(()=>({activatorEvent:F,activators:ke,active:L,activeNodeRect:Q,ariaDescribedById:{draggable:C},dispatch:m,draggableNodes:E,over:Be,measureDroppableContainers:Z}),[F,ke,L,Q,m,C,E,Be,Z]);return K.createElement(T1.Provider,{value:x},K.createElement(dl.Provider,{value:Ze},K.createElement(e0.Provider,{value:Ve},K.createElement(t0.Provider,{value:pe},l)),K.createElement(HE,{disabled:(i==null?void 0:i.restoreFocus)===!1})),K.createElement(yE,{...i,hiddenTextDescribedById:C}))}),qE=A.createContext(null),n0="button";function GE(t){let{id:e,data:n,disabled:o=!1,attributes:r}=t;const s=da("Draggable"),{activators:i,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:d,draggableNodes:u,over:f}=A.useContext(dl),{role:p=n0,roleDescription:_="draggable",tabIndex:g=0}=r??{},m=(l==null?void 0:l.id)===e,b=A.useContext(m?t0:qE),[x,y]=Ac(),[v,k]=Ac(),S=function(j,I){return A.useMemo(()=>j.reduce((T,M)=>{let{eventName:L,handler:B}=M;return T[L]=O=>{B(O,I)},T},{}),[j,I])}(i,e),E=ua(n);return fr(()=>(u.set(e,{id:e,key:s,node:x,activatorNode:v,data:E}),()=>{const j=u.get(e);j&&j.key===s&&u.delete(e)}),[u,e]),{active:l,activatorEvent:a,activeNodeRect:c,attributes:A.useMemo(()=>({role:p,tabIndex:g,"aria-disabled":o,"aria-pressed":!(!m||p!==n0)||void 0,"aria-roledescription":_,"aria-describedby":d.draggable}),[o,p,g,m,_,d.draggable]),isDragging:m,listeners:o?void 0:S,node:x,over:f,setNodeRef:y,setActivatorNodeRef:k,transform:b}}const YE={timeout:25};function o0(t,e,n){const o=t.slice();return o.splice(n<0?o.length+n:n,0,o.splice(e,1)[0]),o}function JE(t,e){return t.reduce((n,o,r)=>{const s=e.get(o);return s&&(n[r]=s),n},Array(t.length))}function ul(t){return t!==null&&t>=0}const hl={scaleX:1,scaleY:1},KE=t=>{var e;let{rects:n,activeNodeRect:o,activeIndex:r,overIndex:s,index:i}=t;const a=(e=n[r])!=null?e:o;if(!a)return null;const l=function(c,d,u){const f=c[d],p=c[d-1],_=c[d+1];return!f||!p&&!_?0:u<d?p?f.left-(p.left+p.width):_.left-(f.left+f.width):_?_.left-(f.left+f.width):f.left-(p.left+p.width)}(n,i,r);if(i===r){const c=n[s];return c?{x:r<s?c.left+c.width-(a.left+a.width):c.left-a.left,y:0,...hl}:null}return i>r&&i<=s?{x:-a.width-l,y:0,...hl}:i<r&&i>=s?{x:a.width+l,y:0,...hl}:{x:0,y:0,...hl}},r0=t=>{let{rects:e,activeIndex:n,overIndex:o,index:r}=t;const s=o0(e,o,n),i=e[r],a=s[r];return a&&i?{x:a.left-i.left,y:a.top-i.top,scaleX:a.width/i.width,scaleY:a.height/i.height}:null},fl={scaleX:1,scaleY:1},XE=t=>{var e;let{activeIndex:n,activeNodeRect:o,index:r,rects:s,overIndex:i}=t;const a=(e=s[n])!=null?e:o;if(!a)return null;if(r===n){const c=s[i];return c?{x:0,y:n<i?c.top+c.height-(a.top+a.height):c.top-a.top,...fl}:null}const l=function(c,d,u){const f=c[d],p=c[d-1],_=c[d+1];return f?u<d?p?f.top-(p.top+p.height):_?_.top-(f.top+f.height):0:_?_.top-(f.top+f.height):p?f.top-(p.top+p.height):0:0}(s,r,n);return r>n&&r<=i?{x:0,y:-a.height-l,...fl}:r<n&&r>=i?{x:0,y:a.height+l,...fl}:{x:0,y:0,...fl}},s0="Sortable",i0=K.createContext({activeIndex:-1,containerId:s0,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:r0,disabled:{draggable:!1,droppable:!1}});function a0(t){let{children:e,id:n,items:o,strategy:r=r0,disabled:s=!1}=t;const{active:i,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:d}=A.useContext(e0),u=da(s0,n),f=a.rect!==null,p=A.useMemo(()=>o.map(S=>typeof S=="object"&&"id"in S?S.id:S),[o]),_=i!=null,g=i?p.indexOf(i.id):-1,m=c?p.indexOf(c.id):-1,b=A.useRef(p),x=!function(S,E){if(S===E)return!0;if(S.length!==E.length)return!1;for(let j=0;j<S.length;j++)if(S[j]!==E[j])return!1;return!0}(p,b.current),y=m!==-1&&g===-1||x,v=function(S){return typeof S=="boolean"?{draggable:S,droppable:S}:S}(s);fr(()=>{x&&_&&d(p)},[x,p,_,d]),A.useEffect(()=>{b.current=p},[p]);const k=A.useMemo(()=>({activeIndex:g,containerId:u,disabled:v,disableTransforms:y,items:p,overIndex:m,useDragOverlay:f,sortedRects:JE(p,l),strategy:r}),[g,u,v.draggable,v.droppable,y,p,m,l,f,r]);return K.createElement(i0.Provider,{value:k},e)}const ZE=t=>{let{id:e,items:n,activeIndex:o,overIndex:r}=t;return o0(n,o,r).indexOf(e)},QE=t=>{let{containerId:e,isSorting:n,wasDragging:o,index:r,items:s,newIndex:i,previousItems:a,previousContainerId:l,transition:c}=t;return!(!c||!o)&&(a===s||r!==i)&&(!!n||i!==r&&e===l)},e5={duration:200,easing:"ease"},l0="transform",t5=Oc.Transition.toString({property:l0,duration:0,easing:"linear"}),n5={roleDescription:"sortable"};function c0(t){let{animateLayoutChanges:e=QE,attributes:n,disabled:o,data:r,getNewIndex:s=ZE,id:i,strategy:a,resizeObserverConfig:l,transition:c=e5}=t;const{items:d,containerId:u,activeIndex:f,disabled:p,disableTransforms:_,sortedRects:g,overIndex:m,useDragOverlay:b,strategy:x}=A.useContext(i0),y=function(de,me){var ie,Ce;return typeof de=="boolean"?{draggable:de,droppable:!1}:{draggable:(ie=de==null?void 0:de.draggable)!=null?ie:me.draggable,droppable:(Ce=de==null?void 0:de.droppable)!=null?Ce:me.droppable}}(o,p),v=d.indexOf(i),k=A.useMemo(()=>({sortable:{containerId:u,index:v,items:d},...r}),[u,r,v,d]),S=A.useMemo(()=>d.slice(d.indexOf(i)),[d,i]),{rect:E,node:j,isOver:I,setNodeRef:T}=function(de){let{data:me,disabled:ie=!1,id:Ce,resizeObserverConfig:we}=de;const ae=da("Droppable"),{active:ve,dispatch:ge,over:be,measureDroppableContainers:Te}=A.useContext(dl),ze=A.useRef({disabled:ie}),Xe=A.useRef(!1),Fe=A.useRef(null),et=A.useRef(null),{disabled:nt,updateMeasurementsFor:it,timeout:te}={...YE,...we},Ne=ua(it??Ce),Me=ll({callback:A.useCallback(()=>{Xe.current?(et.current!=null&&clearTimeout(et.current),et.current=setTimeout(()=>{Te(Array.isArray(Ne.current)?Ne.current:[Ne.current]),et.current=null},te)):Xe.current=!0},[te]),disabled:nt||!ve}),Be=A.useCallback((ue,je)=>{Me&&(je&&(Me.unobserve(je),Xe.current=!1),ue&&Me.observe(ue))},[Me]),[J,pe]=Ac(Be),_e=ua(me);return A.useEffect(()=>{Me&&J.current&&(Me.disconnect(),Xe.current=!1,Me.observe(J.current))},[J,Me]),A.useEffect(()=>(ge({type:zt.RegisterDroppable,element:{id:Ce,key:ae,disabled:ie,node:J,rect:Fe,data:_e}}),()=>ge({type:zt.UnregisterDroppable,key:ae,id:Ce})),[Ce]),A.useEffect(()=>{ie!==ze.current.disabled&&(ge({type:zt.SetDroppableDisabled,id:Ce,key:ae,disabled:ie}),ze.current.disabled=ie)},[Ce,ae,ie,ge]),{active:ve,rect:Fe,isOver:(be==null?void 0:be.id)===Ce,node:J,over:be,setNodeRef:pe}}({id:i,data:k,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...l}}),{active:M,activatorEvent:L,activeNodeRect:B,attributes:O,setNodeRef:z,listeners:F,isDragging:V,over:P,setActivatorNodeRef:C,transform:$}=GE({id:i,data:k,attributes:{...n5,...n},disabled:y.draggable}),N=JB(T,z),H=!!M,G=H&&!_&&ul(f)&&ul(m),Z=!b&&V,q=Z&&G?$:null,re=G?q??(a??x)({rects:g,activeNodeRect:B,activeIndex:f,overIndex:m,index:v}):null,ne=ul(f)&&ul(m)?s({id:i,items:d,activeIndex:f,overIndex:m}):v,oe=M==null?void 0:M.id,Y=A.useRef({activeId:oe,items:d,newIndex:ne,containerId:u}),Q=d!==Y.current.items,ce=e({active:M,containerId:u,isDragging:V,isSorting:H,id:i,index:v,items:d,newIndex:Y.current.newIndex,previousItems:Y.current.items,previousContainerId:Y.current.containerId,transition:c,wasDragging:Y.current.activeId!=null}),he=function(de){let{disabled:me,index:ie,node:Ce,rect:we}=de;const[ae,ve]=A.useState(null),ge=A.useRef(ie);return fr(()=>{if(!me&&ie!==ge.current&&Ce.current){const be=we.current;if(be){const Te=Gr(Ce.current,{ignoreTransform:!0}),ze={x:be.left-Te.left,y:be.top-Te.top,scaleX:be.width/Te.width,scaleY:be.height/Te.height};(ze.x||ze.y)&&ve(ze)}}ie!==ge.current&&(ge.current=ie)},[me,ie,Ce,we]),A.useEffect(()=>{ae&&ve(null)},[ae]),ae}({disabled:!ce,index:v,node:j,rect:E});return A.useEffect(()=>{H&&Y.current.newIndex!==ne&&(Y.current.newIndex=ne),u!==Y.current.containerId&&(Y.current.containerId=u),d!==Y.current.items&&(Y.current.items=d)},[H,ne,u,d]),A.useEffect(()=>{if(oe===Y.current.activeId)return;if(oe!=null&&Y.current.activeId==null)return void(Y.current.activeId=oe);const de=setTimeout(()=>{Y.current.activeId=oe},50);return()=>clearTimeout(de)},[oe]),{active:M,activeIndex:f,attributes:O,data:k,rect:E,index:v,newIndex:ne,items:d,isOver:I,isSorting:H,isDragging:V,listeners:F,node:j,overIndex:m,over:P,setNodeRef:N,setActivatorNodeRef:C,setDroppableNodeRef:T,setDraggableNodeRef:z,transform:he??re,transition:function(){if(he||Q&&Y.current.newIndex===v)return t5;if(!(Z&&!Np(L)||!c)&&(H||ce))return Oc.Transition.toString({...c,property:l0})}()}}function pl(t){if(!t)return!1;const e=t.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}const o5=[ct.Down,ct.Right,ct.Up,ct.Left],r5=(t,e)=>{let{context:{active:n,collisionRect:o,droppableRects:r,droppableContainers:s,over:i,scrollableAncestors:a}}=e;if(o5.includes(t.code)){if(t.preventDefault(),!n||!o)return;const l=[];s.getEnabled().forEach(u=>{if(!u||u!=null&&u.disabled)return;const f=r.get(u.id);if(f)switch(t.code){case ct.Down:o.top<f.top&&l.push(u);break;case ct.Up:o.top>f.top&&l.push(u);break;case ct.Left:o.left>f.left&&l.push(u);break;case ct.Right:o.left<f.left&&l.push(u)}});const c=(u=>{let{collisionRect:f,droppableRects:p,droppableContainers:_}=u;const g=Qd(f),m=[];for(const b of _){const{id:x}=b,y=p.get(x);if(y){const v=Qd(y),k=g.reduce((E,j,I)=>E+Xd(v[I],j),0),S=Number((k/4).toFixed(4));m.push({id:x,data:{droppableContainer:b,value:S}})}}return m.sort(Zd)})({collisionRect:o,droppableRects:r,droppableContainers:l});let d=eu(c,"id");if(d===(i==null?void 0:i.id)&&c.length>1&&(d=c[1].id),d!=null){const u=s.get(n.id),f=s.get(d),p=f?r.get(f.id):null,_=f==null?void 0:f.node.current;if(_&&p&&u&&f){const g=il(_).some((v,k)=>a[k]!==v),m=d0(u,f),b=function(v,k){return!pl(v)||!pl(k)||!d0(v,k)?!1:v.data.current.sortable.index<k.data.current.sortable.index}(u,f),x=g||!m?{x:0,y:0}:{x:b?o.width-p.width:0,y:b?o.height-p.height:0},y={x:p.left,y:p.top};return x.x&&x.y?y:ha(y,x)}}}};function d0(t,e){return!(!pl(t)||!pl(e))&&t.data.current.sortable.containerId===e.data.current.sortable.containerId}function ml(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}const u0=K.createContext(null),h0=A.memo(()=>A.useContext(u0));h0.displayName="DragHandle";const f0=K.forwardRef((t,e)=>{const n=X.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:u,transition:f,isDragging:p}=c0(a);let _;n[8]!==u?(_=function(x){return!x||x.x===0&&x.y===0&&x.scaleX===1&&x.scaleY===1}(u)?null:u,n[8]=u,n[9]=_):_=n[9];const g=_,m=g==null?void 0:f;let b;return n[10]!==l||n[11]!==o||n[12]!==r||n[13]!==p||n[14]!==c||n[15]!==s||n[16]!==e||n[17]!==d||n[18]!==g||n[19]!==m?(b=h.jsx(p0,{ref:e,cellId:r,canMoveX:o,...s,attributes:l,listeners:c,setNodeRef:d,transform:g,transition:m,isDragging:p}),n[10]=l,n[11]=o,n[12]=r,n[13]=p,n[14]=c,n[15]=s,n[16]=e,n[17]=d,n[18]=g,n[19]=m,n[20]=b):b=n[20],b});f0.displayName="SortableCell";const p0=K.forwardRef((t,e)=>{const n=X.c(37);let o,r,s,i,a,l,c,d,u,f;if(n[0]!==t){const{cellId:I,canMoveX:T,children:M,attributes:L,listeners:B,setNodeRef:O,transform:z,transition:F,isDragging:V,...P}=t;r=T,s=M,o=L,a=B,c=O,d=z,u=F,i=V,l=P,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]=u}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],u=n[9];n[10]!==r||n[11]!==d?(f=d?Oc.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 p=i?2:void 0;let _;n[13]!==f||n[14]!==p||n[15]!==u?(_={transform:f,transition:u,zIndex:p,position:"relative"},n[13]=f,n[14]=p,n[15]=u,n[16]=_):_=n[16];const g=_;let m,b;n[17]===Symbol.for("react.memo_cache_sentinel")?(m=h.jsx(bm,{strokeWidth:1,size:20}),n[17]=m):m=n[17],n[18]!==o||n[19]!==a?(b=h.jsx("div",{...o,...a,onMouseDown:Vn.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:m}),n[18]=o,n[19]=a,n[20]=b):b=n[20];const x=b,y=!!d;let v;n[21]!==e||n[22]!==c?(v=I=>{ml(e,c)(I)},n[21]=e,n[22]=c,n[23]=v):v=n[23];const k=y&&"is-moving";let S,E,j;return n[24]!==l.className||n[25]!==k?(S=Oe(l.className,k,"outline-offset-4 outline-primary/40 rounded-lg"),n[24]=l.className,n[25]=k,n[26]=S):S=n[26],n[27]!==s||n[28]!==x?(E=h.jsx(u0.Provider,{value:x,children:s}),n[27]=s,n[28]=x,n[29]=E):E=n[29],n[30]!==i||n[31]!==l||n[32]!==g||n[33]!==v||n[34]!==S||n[35]!==E?(j=h.jsx("div",{tabIndex:-1,ref:v,...l,"data-is-dragging":i,className:S,style:g,children:E}),n[30]=i,n[31]=l,n[32]=g,n[33]=v,n[34]=S,n[35]=E,n[36]=j):j=n[36],j});p0.displayName="SortableCellInternal";const m0=K.memo(K.forwardRef((t,e)=>{const n=X.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=ad(c),u=XB();let f,p,_,g,m,b;if(n[6]===Symbol.for("react.memo_cache_sentinel")?(f=()=>({toggle:()=>l(s5)}),n[6]=f):f=n[6],A.useImperativeHandle(e,f),n[7]===Symbol.for("react.memo_cache_sentinel")?(p=h.jsx(Qi,{placeholder:"Search actions...",className:"h-6 m-1"}),n[7]=p):p=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(_=h.jsx(dc,{children:"No results"}),n[8]=_):_=n[8],n[9]!==d){let j;n[11]!==d.length?(j=(I,T)=>h.jsxs(A.Fragment,{children:[h.jsx(ap,{children:I.map(M=>{let L=h.jsxs("div",{className:"flex items-center flex-1",children:[M.icon&&h.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:M.icon}),h.jsx("div",{className:"flex-1",children:M.label}),h.jsxs("div",{className:"flex-shrink-0 text-sm",children:[M.hotkey&&g4(M.hotkey),M.rightElement]})]});return M.tooltip&&(L=h.jsx(Re,{content:M.tooltip,delayDuration:100,children:L})),h.jsx(po,{className:Oe(M.disabled&&"!opacity-50"),onSelect:()=>{M.disableClick||M.disabled||(M.handle(),l(!1))},variant:M.variant,children:L},M.label)})},T),T<d.length-1&&h.jsx(P3,{})]},T),n[11]=d.length,n[12]=j):j=n[12],g=d.map(j),n[9]=d,n[10]=g}else g=n[10];n[13]!==g?(m=h.jsxs(xc,{children:[p,h.jsxs(Ap,{children:[_,g]})]}),n[13]=g,n[14]=m):m=n[14],n[15]!==u||n[16]!==m?(b=h.jsx(Vs,{className:"w-[300px] p-0 pt-1 overflow-auto",scrollable:!0,...u,children:m}),n[15]=u,n[16]=m,n[17]=b):b=n[17];const x=b;if(!i){let j,I;return n[18]!==o?(j=h.jsx(Ys,{asChild:!0,children:o}),n[18]=o,n[19]=j):j=n[19],n[20]!==x||n[21]!==a||n[22]!==j?(I=h.jsxs(Pr,{open:a,onOpenChange:l,children:[j,x]}),n[20]=x,n[21]=a,n[22]=j,n[23]=I):I=n[23],I}let y;n[24]===Symbol.for("react.memo_cache_sentinel")?(y=h.jsx(ZB,{tabIndex:-1,children:pn("cell.cellActions")}),n[24]=y):y=n[24];const v=!a&&y;let k,S,E;return n[25]!==o?(k=h.jsx(QB,{children:h.jsx(Ys,{className:"flex",children:o})}),n[25]=o,n[26]=k):k=n[26],n[27]!==v||n[28]!==k?(S=h.jsxs(eU,{delayDuration:200,disableHoverableContent:!0,children:[v,k]}),n[27]=v,n[28]=k,n[29]=S):S=n[29],n[30]!==x||n[31]!==a||n[32]!==S?(E=h.jsxs(Pr,{open:a,onOpenChange:l,children:[S,x]}),n[30]=x,n[31]=a,n[32]=S,n[33]=E):E=n[33],E})),g0=K.memo(t=>{const e=X.c(5),{children:n,cellId:o}=t;let r,s;e[0]!==o?(s=KB(o),e[0]=o,e[1]=s):s=e[1],r=s;const i=He(r);if(!i)return null;let a;return e[2]!==n||e[3]!==i?(a=h.jsx(m0,{showTooltip:!1,...i,children:n}),e[2]=n,e[3]=i,e[4]=a):a=e[4],a});function s5(t){return!t}g0.displayName="ConnectionCellActionsDropdown";const _0=t=>{const e=X.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=ad(r),[i,a]=K.useState(),l=!!i;let c,d,u,f,p,_,g,m,b,x;if(e[5]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(Ls,{size:13,strokeWidth:1.5}),e[5]=c):c=e[5],e[6]!==o?(d=async()=>{var k;if((k=window.getSelection())==null?void 0:k.toString())return void document.execCommand("copy");const v=document.getElementById(S3.create(o.cellId));v?await yn(v.textContent??""):Xt.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 y=[{label:"Copy",hidden:l,icon:c,handle:d},{label:"Cut",hidden:!!i,icon:h.jsx(Zc,{size:13,strokeWidth:1.5}),handle:i5},{label:"Paste",hidden:!!i,icon:h.jsx(cm,{size:13,strokeWidth:1.5}),handle:async()=>{const{getEditorView:S}=o,E=S();if(E)try{const j=await navigator.clipboard.readText();if(j){const{from:I,to:T}=E.state.selection.main,M=E.state.update({changes:{from:I,to:T,insert:j}});E.dispatch(M)}}catch(j){const I=j;Xt.error("Failed to paste from clipboard",I),tU({command:"paste"})}}},{label:"Copy image",hidden:!i,icon:h.jsx(Hc,{size:13,strokeWidth:1.5}),handle:async()=>{if(i){const S=await fetch(i.src),E=await S.blob(),j=new ClipboardItem({[E.type]:E});await navigator.clipboard.write([j]).then(a5).catch(l5)}}},{icon:h.jsx(Xp,{size:13,strokeWidth:1.5}),label:"Download image",hidden:!i,handle:()=>{if(i){const S=document.createElement("a");S.download="image.png",S.href=i.src,S.click()}}},{label:"Go to Definition",icon:h.jsx(oU,{size:13,strokeWidth:1.5}),handle:()=>{const{getEditorView:S}=o,E=S();E&&nU(E)}}],v=[y,...s];let k;f=w1,e[20]===Symbol.for("react.memo_cache_sentinel")?(k=S=>{S.target instanceof HTMLImageElement?a(S.target):a(void 0)},e[20]=k):k=e[20],e[21]!==n?(m=h.jsx(v1,{onContextMenu:k,asChild:!0,children:n}),e[21]=n,e[22]=m):m=e[22],u=Kd,p="w-[300px]",_=!0,g=v.map((S,E)=>h.jsxs(A.Fragment,{children:[S.map(c5),E<v.length-1&&h.jsx(S1,{})]},E)),e[8]=s,e[9]=n,e[10]=i,e[11]=o,e[12]=l,e[13]=d,e[14]=u,e[15]=f,e[16]=p,e[17]=_,e[18]=g,e[19]=m}else u=e[14],f=e[15],p=e[16],_=e[17],g=e[18],m=e[19];return e[23]!==u||e[24]!==p||e[25]!==_||e[26]!==g?(b=h.jsx(u,{className:p,scrollable:_,children:g}),e[23]=u,e[24]=p,e[25]=_,e[26]=g,e[27]=b):b=e[27],e[28]!==f||e[29]!==m||e[30]!==b?(x=h.jsxs(f,{children:[m,b]}),e[28]=f,e[29]=m,e[30]=b,e[31]=x):x=e[31],x};function i5(){document.execCommand("cut")}function a5(){lt({title:"Copied image to clipboard"})}function l5(t){lt({title:"Failed to copy image to clipboard. Try downloading instead.",description:t.message}),Xt.error("Failed to copy image to clipboard",t)}function c5(t){if(t.hidden)return null;let e=h.jsxs("div",{className:"flex items-center flex-1",children:[t.icon&&h.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:t.icon}),h.jsx("div",{className:"flex-1",children:t.label}),h.jsxs("div",{className:"flex-shrink-0 text-sm",children:[t.hotkey&&g4(t.hotkey),t.rightElement]})]});return t.tooltip&&(e=h.jsx(Re,{delayDuration:100,content:t.tooltip,children:e})),h.jsx(yi,{className:t.disabled?"!opacity-50":"",onSelect:n=>{t.disableClick||t.disabled||t.handle(n)},variant:t.variant,children:e},t.label)}const d5=t=>{const e=X.c(24),{editorView:n,code:o,currentLanguageAdapter:r,onAfterToggle:s}=t;let i,a;e[0]!==o?(a=new ta().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 Ec().isSupported(o)||o.trim()==="",e[2]=o,e[3]=d):d=e[3],c=d;const u=c&&r==="python";let f,p;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=h.jsx(lr,{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]!==u?(p=h.jsx(hu,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:u,icon:f,toType:"sql",displayName:"SQL",onAfterToggle:s}),e[5]=r,e[6]=n,e[7]=s,e[8]=u,e[9]=p):p=e[9];const _=l&&r==="python";let g,m,b,x,y;return e[10]===Symbol.for("react.memo_cache_sentinel")?(g=h.jsx(ic,{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]!==_?(m=h.jsx(hu,{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]=m):m=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(b=h.jsx(ac,{fill:"var(--sky-11)",color:"black",className:"w-4 h-4"}),e[16]=b):b=e[16],e[17]!==r||e[18]!==n?(x=h.jsx(hu,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:!0,icon:b,toType:"python",displayName:"Python",onAfterToggle:jn.NOOP}),e[17]=r,e[18]=n,e[19]=x):x=e[19],e[20]!==m||e[21]!==x||e[22]!==p?(y=h.jsxs("div",{className:"absolute right-3 top-2 z-20 flex hover-action gap-1",children:[p,m,x]}),e[20]=m,e[21]=x,e[22]=p,e[23]=y):y=e[23],y},hu=t=>{const e=X.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&&(Or(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 u=`View as ${a}`;let f,p;return e[4]!==d||e[5]!==s?(f=h.jsx(Pe,{"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]!==u||e[8]!==f?(p=h.jsx(Re,{content:u,children:f}),e[7]=u,e[8]=f,e[9]=p):p=e[9],p};var b0={modified:{doc:""},original:{doc:""}},y0=A.createContext(b0);function u5(t,e){return jt({},t,e,{modified:jt({},t.modified,e.modified),original:jt({},t.original,e.original)})}var fu=()=>A.useContext(y0),h5=t=>{var{children:e,theme:n}=t,[o,r]=A.useReducer(u5,jt({},b0,{theme:n}));return A.useEffect(()=>r({theme:n}),[n]),h.jsx(y0.Provider,{value:jt({},o,{dispatch:r}),children:e})},f5=["extensions","value","selection","onChange"],x0=t=>{var{extensions:e=[],value:n,selection:o,onChange:r}=t,s=ma(t,f5),{theme:i,dispatch:a}=fu(),l=Js(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};x0.displayName="CodeMirrorMerge.Original";var p5=["extensions","value","selection","onChange"],w0=t=>{var{extensions:e=[],value:n,selection:o,onChange:r}=t,s=ma(t,p5),{theme:i,dispatch:a}=fu(),l=Js(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};w0.displayName="CodeMirrorMerge.Modified";class At{constructor(e,n,o,r){this.fromA=e,this.toA=n,this.fromB=o,this.toB=r}offset(e,n){return new At(this.fromA+e,this.toA+e,this.fromB+n,this.toB+n)}}function jr(t,e,n,o,r,s){if(t==o)return[];let i=gu(t,e,n,o,r,s),a=_u(t,e+i,n,o,r+i,s),l=(n-=a)-(e+=i),c=(s-=a)-(r+=i);if(!l||!c)return[new At(e,n,r,s)];if(l>c){let u=t.slice(e,n).indexOf(o.slice(r,s));if(u>-1)return[new At(e,e+u,r,r),new At(e+u+c,n,s,s)]}else if(c>l){let u=o.slice(r,s).indexOf(t.slice(e,n));if(u>-1)return[new At(e,e,r,r+u),new At(n,n,r+u+l,s)]}if(l==1||c==1)return[new At(e,n,r,s)];let d=S0(t,e,n,o,r,s);if(d){let[u,f,p]=d;return jr(t,e,u,o,r,f).concat(jr(t,u+p,n,o,f+p,s))}return function(u,f,p,_,g,m){let b=p-f,x=m-g;if(Ci<1e9&&Math.min(b,x)>16*Ci)return Math.min(b,x)>64*Ci?[new At(f,p,g,m)]:C0(u,f,p,_,g,m);let y=Math.ceil((b+x)/2);pu.reset(y),mu.reset(y);let v=(j,I)=>u.charCodeAt(f+j)==_.charCodeAt(g+I),k=(j,I)=>u.charCodeAt(p-j-1)==_.charCodeAt(m-I-1),S=(b-x)%2!=0?mu:null,E=S?null:pu;for(let j=0;j<y;j++){if(j>Ci)return C0(u,f,p,_,g,m);let I=pu.advance(j,b,x,y,S,!1,v)||mu.advance(j,b,x,y,E,!0,k);if(I)return m5(u,f,p,f+I[0],_,g,m,g+I[1])}return[new At(f,p,g,m)]}(t,e,n,o,r,s)}let Ci=1e9;class v0{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,u=d-l;for(;d<n&&u<o&&a(d,u);)d++,u++;if(this.vec[c]=d,d>n)this.end+=2;else if(u>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 p=s.vec[f];if(p>=n-d)return[p,r+p-f]}else if(d>=n-s.vec[f])return[d,u]}}}return null}}const pu=new v0,mu=new v0;function m5(t,e,n,o,r,s,i,a){let l=!1;return Yr(t,o)||++o!=n||(l=!0),Yr(r,a)||++a!=i||(l=!0),l?[new At(e,n,s,i)]:jr(t,e,o,r,s,a).concat(jr(t,o,n,r,a,i))}function k0(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=k0(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-(Yr(t,a)?0:1);i>>=1}else{if(c==n||d==s)return c-e;a=c,l=d}}}function _u(t,e,n,o,r,s){if(e==n||r==s||t.charCodeAt(n-1)!=o.charCodeAt(s-1))return 0;let i=k0(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-(Yr(t,a)?0:1);i>>=1}else{if(c==e||d==r)return n-c;a=c,l=d}}}function bu(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;;){Yr(t,d)||d++;let u=d+i;if(Yr(t,u)||(u+=u==d+1?1:-1),u>=n)break;let f=t.slice(d,u),p=-1;for(;(p=l.indexOf(f,p+1))!=-1;){let _=gu(t,u,n,o,r+p+f.length,s),g=_u(t,e,d,o,r,r+p),m=f.length+_+g;(!c||c[2]<m)&&(c=[d-g,r+p-g,m])}d=u}if(a<0)return c;i>>=1}}function S0(t,e,n,o,r,s){let i=n-e,a=s-r;if(i<a){let l=S0(o,r,s,t,e,n);return l&&[l[1],l[0],l[2]]}return i<4||2*a<i?null:bu(t,e,n,o,r,s,Math.floor(i/4),-1)}function C0(t,e,n,o,r,s){let i,a=n-e,l=s-r;if(a<l){let f=bu(o,r,s,t,e,n,Math.floor(a/6),50);i=f&&[f[1],f[0],f[2]]}else i=bu(t,e,n,o,r,s,Math.floor(l/6),50);if(!i)return[new At(e,n,r,s)];let[c,d,u]=i;return jr(t,e,c,o,r,d).concat(jr(t,c+u,n,o,d+u,s))}function N0(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 At(o.fromA,r.toA,o.fromB,r.toB),t.splice(n--,1))}}let Er;try{Er=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function j0(t){return t>48&&t<58||t>64&&t<91||t>96&&t<123}function E0(t,e){if(e==t.length)return 0;let n=t.charCodeAt(e);return n<192?j0(n)?1:0:Er?M0(n)&&e!=t.length-1?Er.test(t.slice(e,e+2))?2:0:Er.test(String.fromCharCode(n))?1:0:0}function I0(t,e){if(!e)return 0;let n=t.charCodeAt(e-1);return n<192?j0(n)?1:0:Er?O0(n)&&e!=1?Er.test(t.slice(e-2,e))?2:0:Er.test(String.fromCharCode(n))?1:0:0}function A0(t,e,n){if(e==t.length||!I0(t,e))return e;for(let o=e,r=e+n;;){let s=E0(t,o);if(!s)return o;if(o+=s,o>r)return e}}function T0(t,e,n){if(!e||!E0(t,e))return e;for(let o=e,r=e-n;;){let s=I0(t,o);if(!s)return o;if(o-=s,o<r)return e}}function g5(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 M0=t=>t>=55296&&t<=56319,O0=t=>t>=56320&&t<=57343;function Yr(t,e){return!e||e==t.length||!M0(t.charCodeAt(e-1))||!O0(t.charCodeAt(e))}function _5(t,e,n){var o;return Ci=((o=n==null?void 0:n.scanLimit)!==null&&o!==void 0?o:1e9)>>1,function(r,s,i){for(;;){N0(i,1);let a=!1;for(let l=0;l<i.length;l++){let c,d,u=i[l];(c=gu(r,u.fromA,u.toA,s,u.fromB,u.toB))&&(u=i[l]=new At(u.fromA+c,u.toA,u.fromB+c,u.toB)),(d=_u(r,u.fromA,u.toA,s,u.fromB,u.toB))&&(u=i[l]=new At(u.fromA,u.toA-d,u.fromB,u.toB-d));let f=u.toA-u.fromA,p=u.toB-u.fromB;if(f&&p)continue;let _=u.fromA-(l?i[l-1].toA:0),g=(l<i.length-1?i[l+1].fromA:r.length)-u.toA;if(!_||!g)continue;let m=f?r.slice(u.fromA,u.toA):s.slice(u.fromB,u.toB);_<=m.length&&r.slice(u.fromA-_,u.fromA)==m.slice(m.length-_)?(i[l]=new At(u.fromA-_,u.toA-_,u.fromB-_,u.toB-_),a=!0):g<=m.length&&r.slice(u.toA,u.toA+g)==m.slice(0,g)&&(i[l]=new At(u.fromA+g,u.toA+g,u.fromB+g,u.toB+g),a=!0)}if(!a)break}return i}(t,e,jr(t,0,t.length,e,0,e.length))}function D0(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 u=a==o.length-1?r.length:o[a+1].fromA,f=l.fromA-i,p=u-l.toA,_=T0(r,l.fromA,Math.min(f,5)),g=A0(r,l.toA,Math.min(p,5)),m=l.fromA-_,b=g-l.toA;if(!c||!d){let x,y,v=Math.max(c,d),[k,S,E]=c?[r,l.fromA,l.toA]:[s,l.fromB,l.toB];m&&b?(v>m&&r.slice(_,l.fromA)==k.slice(E-m,E)?(l=o[a]=new At(_,_+c,l.fromB-m,l.toB-m),_=l.fromA,g=A0(r,l.toA,Math.min(u-l.toA,5))):v>b&&r.slice(l.toA,g)==k.slice(S,S+b)&&(l=o[a]=new At(g-c,g,l.fromB+b,l.toB+b),g=l.toA,_=T0(r,l.fromA,Math.min(l.fromA-i,5))),m=l.fromA-_,b=g-l.toA):m||b||!(y=l.fromA-(x=g5(r,l.fromA,f)))||r.slice(x,l.fromA)!=k.slice(E-y,E)||(l=o[a]=new At(x,x+c,l.fromB-y,l.toB-y))}(m||b)&&(l=o[a]=new At(l.fromA-m,l.toA+b,l.fromB-m,l.toB+b)),i=l.toA}}return N0(o,3),o}(_5(t,e,n),t,e)}const no=$s.define({combine:t=>t[0]}),yu=Ut.define(),Jr=En.define({create:t=>null,update(t,e){for(let n of e.effects)n.is(yu)&&(t=n.value);return t}});class Kr{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 Kr(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 L0(D0(e.toString(),n.toString(),o),e,n,0,0)}static updateA(e,n,o,r,s){return B0(z0(e,r,!0,o.length),e,n,o,s)}static updateB(e,n,o,r,s){return B0(z0(e,r,!1,n.length),e,n,o,s)}}function R0(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 P0(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 L0(t,e,n,o,r){let s=[];for(let i=0;i<t.length;i++){let a=t[i],[l,c]=R0(a.fromA+o,a.fromB+r,e,n),[d,u]=P0(a.toA+o,a.toB+r,e,n),f=[a.offset(-l+o,-c+r)];for(;i<t.length-1;){let p=t[i+1],[_,g]=R0(p.fromA+o,p.fromB+r,e,n);if(_>d+1&&g>u+1)break;f.push(p.offset(-l+o,-c+r)),[d,u]=P0(p.toA+o,p.toB+r,e,n),i++}s.push(new Kr(f,l,Math.max(l,d),c,Math.max(c,u)))}return s}const gl=1e3;function F0(t,e,n,o){let r=0,s=t.length;for(;;){if(r==s){let d=0,u=0;r&&({toA:d,toB:u}=t[r-1]);let f=e-(n?d:u);return[d+f,u+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 z0(t,e,n,o){let r=[];return e.iterChangedRanges((s,i,a,l)=>{let c=0,d=n?e.length:o,u=0,f=n?o:e.length;s>gl&&([c,u]=F0(t,s-gl,n,!0)),i<e.length-gl&&([d,f]=F0(t,i+gl,n,!1));let p,_=l-a-(i-s),[g,m]=n?[_,0]:[0,_];r.length&&(p=r[r.length-1]).toA>=c?r[r.length-1]={fromA:p.fromA,fromB:p.fromB,toA:d,toB:f,diffA:p.diffA+g,diffB:p.diffB+m}:r.push({fromA:c,toA:d,fromB:u,toB:f,diffA:g,diffB:m})}),r}function B0(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,u=c.toA+i+c.diffA,f=c.fromB+a,p=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>u)break;s++}for(let _ of L0(D0(n.sliceString(d,u),o.sliceString(f,p),r),n,o,d,f))l.push(_);for(i+=c.diffA,a+=c.diffB;s<e.length;){let _=e[s];if(_.fromA>u+i&&_.fromB>p+a)break;s++}}for(;s<e.length;)l.push(e[s++].offset(i,a));return l}const U0=Zn.fromClass(class{constructor(t){({deco:this.deco,gutter:this.gutter}=H0(t))}update(t){var e,n;(t.docChanged||t.viewportChanged||(e=t.startState,n=t.state,e.field(Jr,!1)!=n.field(Jr,!1))||function(o,r){return o.facet(no)!=r.facet(no)}(t.startState,t.state))&&({deco:this.deco,gutter:this.gutter}=H0(t.view))}},{decorations:t=>t.deco}),_l=Vo.low(sU({class:"cm-changeGutter",markers:t=>{var e;return((e=t.plugin(U0))===null||e===void 0?void 0:e.gutter)||Tp.empty}})),V0=dt.line({class:"cm-changedLine"}),b5=dt.mark({class:"cm-changedText"}),y5=dt.mark({tagName:"ins",class:"cm-insertedLine"}),x5=dt.mark({tagName:"del",class:"cm-deletedLine"}),$0=new class extends iU{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function w5(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,V0),r.add(i,a,n?x5:y5),s&&s.add(i,i,$0);for(let c=e.iterRange(i,a-1),d=i;!c.next().done;){if(c.lineBreak){d++,r.add(d,d,V0),s&&s.add(d,d,$0);continue}let u=d+c.value.length;if(o)for(;l<t.changes.length;){let f=t.changes[l],p=i+(n?f.fromA:f.fromB),_=i+(n?f.toA:f.toB),g=Math.max(d,p),m=Math.min(u,_);if(g<m&&r.add(g,m,b5),!(_<u))break;l++}d=u}}}function H0(t){let e=t.state.field(Jr),{side:n,highlightChanges:o,markGutter:r}=t.state.facet(no),s=n=="a",i=new Us,a=r?new Us: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&&w5(d,t.state.doc,s,o,i,a)}return{deco:i.finish(),gutter:a&&a.finish()}}class bl extends Hs{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 yl=Ut.define({map:(t,e)=>t.map(e)}),Ni=En.define({create:()=>dt.none,update:(t,e)=>{for(let n of e.effects)if(n.is(yl))return n.value;return t.map(e.changes)},provide:t=>st.decorations.from(t)}),xu=.01,wu=Ut.define({map:(t,e)=>e.mapPos(t)});class v5 extends Hs{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:wu.of(r)});let{side:s,sibling:i}=e.state.facet(no);i&&i().dispatch({effects:wu.of(k5(r,e.state.field(Jr),s=="a"))})}),n}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}}function k5(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 S5=En.define({create:t=>dt.none,update(t,e){t=t.map(e.changes);for(let n of e.effects)n.is(wu)&&(t=t.update({filter:o=>o!=n.value}));return t},provide:t=>st.decorations.from(t)});function W0({margin:t=3,minSize:e=4}){return S5.init(n=>function(o,r,s){let i=new Us,a=o.facet(no).side=="a",l=o.field(Jr),c=1;for(let d=0;;d++){let u=d<l.length?l[d]:null,f=d?c+r:1,p=u?o.doc.lineAt(a?u.fromA:u.fromB).number-1-r:o.doc.lines,_=p-f+1;if(_>=s&&i.add(o.doc.line(f).from,o.doc.line(p).to,dt.replace({widget:new v5(_),block:!0})),!u)break;c=o.doc.lineAt(Math.min(o.doc.length,a?u.toA:u.toB)).number}return i.finish()}(n,t,e))}const C5=st.styleModule.of(new rU({".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"}})),N5=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"}}),q0=new vp,xl=new vp;class G0{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig;let n=[Vo.low(U0),N5,C5,Ni,st.updateListener.of(u=>{this.measuring<0&&(u.heightChanged||u.viewportChanged)&&!u.transactions.some(f=>f.effects.some(p=>p.is(yl)))&&this.measure()})],o=[no.of({side:"a",sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&o.push(_l);let r=ca.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],st.editorAttributes.of({class:"cm-merge-a"}),xl.of(o),n]}),s=[no.of({side:"b",sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&s.push(_l);let i=ca.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],st.editorAttributes.of({class:"cm-merge-b"}),xl.of(s),n]});this.chunks=Kr.build(r.doc,i.doc,this.diffConf);let a=[Jr.init(()=>this.chunks),q0.of(e.collapseUnchanged?W0(e.collapseUnchanged):[])];r=r.update({effects:Ut.appendConfig.of(a)}).state,i=i.update({effects:Ut.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:u=>this.dispatch(u,this.a)}),this.b=new st({state:i,parent:d,root:e.root,dispatchTransactions:u=>this.dispatch(u,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),ia.empty(e[0].startState.doc.length));this.chunks=n==this.a?Kr.updateA(this.chunks,o.newDoc,this.b.state.doc,r,this.diffConf):Kr.updateB(this.chunks,this.a.state.doc,o.newDoc,r,this.diffConf),n.update([...e,o.state.update({effects:yu.of(this.chunks)})]);let s=n==this.a?this.b:this.a;s.update([s.state.update({effects:yu.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(no),l=o?e.gutter!==!1:a.markGutter,c=n?e.highlightChanges!==!1:a.highlightChanges;s.push(xl.reconfigure([no.of({side:"a",sibling:()=>this.b,highlightChanges:c,markGutter:l}),l?_l:[]])),i.push(xl.reconfigure([no.of({side:"b",sibling:()=>this.a,highlightChanges:c,markGutter:l}),l?_l:[]]))}if(r){let a=q0.reconfigure(e.collapseUnchanged?W0(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 Us,s=new Us,i=e.state.field(Ni).iter(),a=n.state.field(Ni).iter(),l=0,c=0,d=0,u=0;for(let g=0;;g++){let m=g<o.length?o[g]:null;if(l<(m?m.fromA:e.state.doc.length)){let b=e.lineBlockAt(l).top+d-(n.lineBlockAt(c).top+u);b<-.01?(d-=b,r.add(l,l,dt.widget({widget:new bl(-b),block:!0,side:-1}))):b>xu&&(u+=b,s.add(c,c,dt.widget({widget:new bl(b),block:!0,side:-1})))}if(!m)break;for(l=m.toA,c=m.toB;i.value&&i.from<l;)d-=i.value.spec.widget.height,i.next();for(;a.value&&a.from<c;)u-=a.value.spec.widget.height,a.next()}for(;i.value;)d-=i.value.spec.widget.height,i.next();for(;a.value;)u-=a.value.spec.widget.height,a.next();let f=e.contentHeight+d-(n.contentHeight+u);f<xu?r.add(e.state.doc.length,e.state.doc.length,dt.widget({widget:new bl(-f),block:!0,side:1})):f>xu&&s.add(n.state.doc.length,n.state.doc.length,dt.widget({widget:new bl(f),block:!0,side:1}));let p=r.finish(),_=s.finish();Tp.eq([p],[e.state.field(Ni)])||e.dispatch({effects:yl.of(p)}),Tp.eq([_],[n.state.field(Ni)])||n.dispatch({effects:yl.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=Y0(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=Y0(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 Y0(t){let e=t.nextSibling;return t.remove(),e}var j5=["className","children","orientation","revertControls","highlightChanges","gutter","collapseUnchanged","destroyRerender","renderRevertControl","diffConfig"],E5=["modified","modifiedExtension","original","originalExtension","theme","dispatch"],J0=K.forwardRef((t,e)=>{var{className:n,children:o,orientation:r,revertControls:s,highlightChanges:i,gutter:a,collapseUnchanged:l,destroyRerender:c=!0,renderRevertControl:d,diffConfig:u}=t,f=ma(t,j5),p=fu(),{modified:_,modifiedExtension:g,original:m,originalExtension:b,theme:x,dispatch:y}=p,v=ma(p,E5),k=A.useRef(null),S=A.useRef(),E={orientation:r,revertControls:s,highlightChanges:i,gutter:a,collapseUnchanged:l,renderRevertControl:d,diffConfig:u};A.useImperativeHandle(e,()=>({container:k.current,view:S.current,modified:_,original:m,config:jt({a:m,b:_,parent:k.current},E)}),[k,S,_,m,E]);var j=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(()=>{!S.current&&k.current&&b&&g&&(S.current=new G0(jt({a:jt({},m,{extensions:[...(b==null?void 0:b.extension)||[],...Js(jt({},b==null?void 0:b.option,{theme:x})),j]}),b:jt({},_,{extensions:[...(g==null?void 0:g.extension)||[],...Js(jt({},g==null?void 0:g.option,{theme:x})),I]}),parent:k.current},E)),y({view:S.current}))},[S,k,b,g]),A.useEffect(()=>{if(m&&m.doc&&S.current){var T,M,L=(T=S.current)==null?void 0:T.a.state.doc.toString();L!==m.doc&&((M=S.current)==null||M.a.dispatch({changes:{from:0,to:L.length,insert:m.doc||""}}))}if(_&&_.doc&&S.current){var B,O,z=(B=S.current)==null?void 0:B.b.state.doc.toString();z!==_.doc&&((O=S.current)==null||O.b.dispatch({changes:{from:0,to:z.length,insert:_.doc||""}}))}if(c&&S.current){var F=S.current.a.state.selection.ranges[0].from,V=S.current.b.state.selection.ranges[0].from;S.current.destroy(),S.current=new G0(jt({a:jt({},m,{extensions:[...(b==null?void 0:b.extension)||[],...Js(jt({},b==null?void 0:b.option,{theme:x}))]}),b:jt({},_,{extensions:[...(g==null?void 0:g.extension)||[],...Js(jt({},g==null?void 0:g.option,{theme:x}))]}),parent:k.current},E)),F&&(S.current.a.focus(),S.current.a.dispatch({selection:{anchor:F,head:F}})),V&&(S.current.b.focus(),S.current.b.dispatch({selection:{anchor:V,head:V}}))}},[S,x,k.current,m,_,b,g,c]),A.useEffect(()=>()=>S.current&&S.current.destroy(),[]),A.useEffect(()=>{if(S.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&&y&&S.current&&(S.current.reconfigure(jt({},T)),y(jt({},T)))}},[y,S,r,s,i,a,l,d]),h.jsx("div",jt({ref:k,className:"cm-merge-theme"+(n?" "+n:"")},f,{children:o}))});J0.displayName="CodeMirrorMerge.Internal";var I5=["theme"],Xr=K.forwardRef((t,e)=>{var{theme:n}=t,o=ma(t,I5);return h.jsx(h5,{theme:n,children:h.jsx(J0,jt({},o,{ref:e}))})});Xr.Original=x0,Xr.Modified=w0,Xr.displayName="CodeMirrorMerge";const A5=Xr.Original,T5=Xr.Modified,K0=[lU(),st.lineWrapping],M5=t=>{const e=X.c(42),{className:n,onChange:o,initialPrompt:r,currentLanguageAdapter:s,currentCode:i,declineChange:a,acceptChange:l,enabled:c,children:d}=t;let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u={},e[0]=u):u=e[0];const[f,p]=A.useState(u),[_,g]=fn(LS),{completion:m,input:b,stop:x,isLoading:y,setCompletion:v,setInput:k,handleSubmit:S}=aU({api:Sp("api/ai/completion").toString(),headers:Nc.headers(),initialInput:r,streamProtocol:"text",experimental_throttle:100,body:{...f,includeOtherCode:_?Sc(i):"",code:i,language:s},onError:O5,onFinish:(G,Z)=>{E(Z.trimEnd())}}),E=v,j=K.useRef(null);let I,T,M,L;e[1]!==c?(I=()=>{const G=j.current;c&&G&&(requestAnimationFrame(()=>{var Z;(Z=G.view)==null||Z.focus()}),cU(j.current.view))},T=[c],e[1]=c,e[2]=I,e[3]=T):(I=e[2],T=e[3]),A.useEffect(I,T),e[4]!==c||e[5]!==r||e[6]!==k?(M=()=>{c&&k(r||"")},L=[c,r,k],e[4]=c,e[5]=r,e[6]=k,e[7]=M,e[8]=L):(M=e[7],L=e[8]),A.useEffect(M,L);const{theme:B}=Fo();let O;e[9]!==n?(O=Oe("flex flex-col w-full rounded-[inherit]",n),e[9]=n,e[10]=O):O=e[10];const z=c&&"max-h-[400px] min-h-11 visible",F=!c&&"max-h-0 min-h-0 invisible";let V,P,C,$;e[11]!==z||e[12]!==F?(V=Oe("flex items-center gap-2 border-b px-3 transition-all rounded-[inherit] rounded-b-none duration-300",z,F),e[11]=z,e[12]=F,e[13]=V):V=e[13],e[14]!==l||e[15]!==m||e[16]!==a||e[17]!==c||e[18]!==S||e[19]!==_||e[20]!==b||e[21]!==y||e[22]!==E||e[23]!==g||e[24]!==k||e[25]!==x||e[26]!==B?(P=c&&h.jsxs(h.Fragment,{children:[h.jsx(Xi,{className:"text-[var(--blue-10)] flex-shrink-0",size:16}),h.jsx(Dc,{inputRef:j,theme:B,onClose:()=>{a(),E("")},value:b,onChange:G=>{k(G),p(b4({input:G}))},onSubmit:()=>{y||S()}}),y&&h.jsxs(Pe,{"data-testid":"stop-completion-button",variant:"text",size:"xs",className:"mb-0",onClick:x,children:[h.jsx(Mp,{className:"animate-spin mr-1",size:14}),"Stop"]}),!y&&m&&h.jsx(Pe,{"data-testid":"accept-completion-button",variant:"text",size:"xs",className:"mb-0",disabled:y,onClick:()=>{l(m),E("")},children:h.jsx("span",{className:"text-[var(--grass-11)] opacity-100",children:"Accept"})}),h.jsx("div",{className:"h-full w-px bg-border mx-2"}),h.jsx(Re,{content:"Include code from other cells",children:h.jsxs("div",{className:"flex flex-row items-start gap-1 overflow-hidden",children:[h.jsx(y4,{"data-testid":"include-other-cells-checkbox",id:"include-other-cells",checked:_,onCheckedChange:G=>g(!!G)}),h.jsx(Rr,{htmlFor:"include-other-cells",className:"text-muted-foreground text-xs whitespace-nowrap ellipsis",children:"Include all code"})]})}),h.jsx(Pe,{"data-testid":"decline-completion-button",variant:"text",size:"icon",disabled:y,onClick:()=>{x(),a(),E("")},children:h.jsx(go,{className:"text-[var(--red-10)]",size:16})})]}),e[14]=l,e[15]=m,e[16]=a,e[17]=c,e[18]=S,e[19]=_,e[20]=b,e[21]=y,e[22]=E,e[23]=g,e[24]=k,e[25]=x,e[26]=B,e[27]=P):P=e[27],e[28]!==V||e[29]!==P?(C=h.jsx("div",{className:V,children:P}),e[28]=V,e[29]=P,e[30]=C):C=e[30],e[31]!==m||e[32]!==i||e[33]!==c||e[34]!==o||e[35]!==B?($=m&&c&&h.jsxs(Xr,{className:"cm",theme:B,children:[h.jsx(A5,{onChange:o,value:i,extensions:K0}),h.jsx(T5,{value:m,editable:!1,readOnly:!0,extensions:K0})]}),e[31]=m,e[32]=i,e[33]=c,e[34]=o,e[35]=B,e[36]=$):$=e[36];const N=(!m||!c)&&d;let H;return e[37]!==C||e[38]!==$||e[39]!==N||e[40]!==O?(H=h.jsxs("div",{className:O,children:[C,$,N]}),e[37]=C,e[38]=$,e[39]=N,e[40]=O,e[41]=H):H=e[41],H};function O5(t){lt({title:"Completion failed",description:_4(t)})}const D5=""+new URL("loro_wasm_bg-DHBNbovs.wasm",import.meta.url).href;let w;function vu(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 qe=0,wl=null;function Zr(){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 R5=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 Zr().subarray(l,l+a.length).set(a),qe=a.length,l}let o=t.length,r=e(o,1)>>>0;const s=Zr();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=Zr().subarray(r+i,r+o);i+=R5(t,a).written,r=n(r,o,i,1)>>>0}return qe=i,r}let Qr=null;function R(){return(Qr===null||Qr.buffer.detached===!0||Qr.buffer.detached===void 0&&Qr.buffer!==w.memory.buffer)&&(Qr=new DataView(w.memory.buffer)),Qr}let ji=kt.length;function se(t){ji===kt.length&&kt.push(kt.length+1);const e=ji;return ji=kt[e],kt[e]=t,e}function Yt(t,e){try{return t.apply(this,e)}catch(n){w.__wbindgen_export_2(se(n))}}let X0=new(typeof TextDecoder>"u"?(0,module.require)("util").TextDecoder:TextDecoder)("utf-8",{ignoreBOM:!0,fatal:!0});function Tt(t,e){return t>>>=0,X0.decode(Zr().subarray(t,t+e))}function W(t){const e=ye(t);return function(n){n<132||(kt[n]=ji,ji=n)}(t),e}function Mn(t){return t==null}X0.decode();const Z0=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>{w.__wbindgen_export_4.get(t.dtor)(t.a,t.b)});function Q0(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),Z0.unregister(r)):r.a=a}};return s.original=r,Z0.register(s,r,r),s}function ku(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+=ku(t[0]));for(let i=1;i<r;i++)s+=", "+ku(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
- ${t.stack}`:o}function oo(t,e){return t>>>=0,Zr().subarray(t/1,t/1+e)}function Jo(t,e){const n=e(1*t.length,1)>>>0;return Zr().set(t,n/1),qe=t.length,n}function On(t,e){t>>>=0;const n=R(),o=[];for(let r=t;r<t+4*e;r+=4)o.push(W(n.getUint32(r,!0)));return o}function wn(t,e){const n=e(4*t.length,4)>>>0,o=R();for(let r=0;r<t.length;r++)o.setUint32(n+4*r,se(t[r]),!0);return qe=t.length,n}let Jt=128;function gn(t){if(Jt==1)throw new Error("out of js stack");return kt[--Jt]=t,Jt}function es(t,e){if(!(t instanceof e))throw new Error(`expected instance of ${e.name}`)}function P5(t,e,n){w.__wbindgen_export_5(t,e,se(n))}function L5(t,e){w.__wbindgen_export_6(t,e)}const eb=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_awarenesswasm_free(t>>>0,1));class tb{__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,eb.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_awarenesswasm_free(e,0)}constructor(e,n){const o=w.awarenesswasm_new(se(e),n);return this.__wbg_ptr=o>>>0,eb.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,se(e));var n=R().getInt32(s+0,!0),o=R().getInt32(s+4,!0),r=oo(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=R().getInt32(r+0,!0),n=R().getInt32(r+4,!0),o=oo(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=qe;w.awarenesswasm_apply(r,this.__wbg_ptr,s,i);var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}setLocalState(e){w.awarenesswasm_setLocalState(this.__wbg_ptr,se(e))}peer(){return W(w.awarenesswasm_peer(this.__wbg_ptr))}getAllStates(){return W(w.awarenesswasm_getAllStates(this.__wbg_ptr))}getState(e){return W(w.awarenesswasm_getState(this.__wbg_ptr,se(e)))}getTimestamp(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.awarenesswasm_getTimestamp(r,this.__wbg_ptr,se(e));var n=R().getInt32(r+0,!0),o=R().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=R().getInt32(r+0,!0),n=R().getInt32(r+4,!0),o=On(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=R().getInt32(r+0,!0),n=R().getInt32(r+4,!0),o=On(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}}const nb=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_changemodifier_free(t>>>0,1));class ts{static __wrap(e){e>>>=0;const n=Object.create(ts.prototype);return n.__wbg_ptr=e,nb.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,nb.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=qe,r=w.changemodifier_setMessage(this.__wbg_ptr,n,o);return ts.__wrap(r)}setTimestamp(e){const n=w.changemodifier_setTimestamp(this.__wbg_ptr,e);return ts.__wrap(n)}}const ob=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_cursor_free(t>>>0,1));class Gn{static __wrap(e){e>>>=0;const n=Object.create(Gn.prototype);return n.__wbg_ptr=e,ob.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,ob.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_cursor_free(e,0)}containerId(){return W(w.cursor_containerId(this.__wbg_ptr))}pos(){return W(w.cursor_pos(this.__wbg_ptr))}side(){return W(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=R().getInt32(r+0,!0),n=R().getInt32(r+4,!0),o=oo(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=qe;w.cursor_decode(r,s,i);var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return Gn.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}kind(){return W(w.cursor_kind(this.__wbg_ptr))}}const rb=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_ephemeralstorewasm_free(t>>>0,1)),Su=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorocounter_free(t>>>0,1));class Ei{static __wrap(e){e>>>=0;const n=Object.create(Ei.prototype);return n.__wbg_ptr=e,Su.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Su.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,Su.register(this,this.__wbg_ptr,this),this}kind(){return W(w.lorocounter_kind(this.__wbg_ptr))}get id(){return W(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=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(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=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(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,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}parent(){return W(w.lorocounter_parent(this.__wbg_ptr))}isAttached(){return w.lorocounter_isAttached(this.__wbg_ptr)!==0}getAttached(){return W(w.lorocounter_getAttached(this.__wbg_ptr))}getShallowValue(){return w.lorocounter_getShallowValue(this.__wbg_ptr)}}const Cu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorodoc_free(t>>>0,1));class yo{static __wrap(e){e>>>=0;const n=Object.create(yo.prototype);return n.__wbg_ptr=e,Cu.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Cu.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,Cu.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,se(e));var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(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,se(e));var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(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=qe;w.lorodoc_fromSnapshot(r,s,i);var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return yo.__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 yo.__wrap(e)}forkAt(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=wn(e,w.__wbindgen_export_0),i=qe;w.lorodoc_forkAt(r,this.__wbg_ptr,s,i);var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return yo.__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=R().getInt32(n+0,!0);if(R().getInt32(n+4,!0))throw W(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}travelChangeAncestors(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=wn(e,w.__wbindgen_export_0),i=qe;w.lorodoc_travelChangeAncestors(r,this.__wbg_ptr,s,i,se(n));var o=R().getInt32(r+0,!0);if(R().getInt32(r+4,!0))throw W(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}findIdSpansBetween(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16),i=wn(e,w.__wbindgen_export_0),a=qe,l=wn(n,w.__wbindgen_export_0),c=qe;w.lorodoc_findIdSpansBetween(s,this.__wbg_ptr,i,a,l,c);var o=R().getInt32(s+0,!0),r=R().getInt32(s+4,!0);if(R().getInt32(s+8,!0))throw W(r);return W(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}checkout(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16),r=wn(e,w.__wbindgen_export_0),s=qe;w.lorodoc_checkout(o,this.__wbg_ptr,r,s);var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(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 W(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,se(e));var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(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,Mn(e)?0:se(e));var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(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,gn(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return Xo.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Jt++]=void 0}}getMap(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getMap(r,this.__wbg_ptr,gn(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return Ko.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Jt++]=void 0}}getList(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getList(r,this.__wbg_ptr,gn(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return Ii.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Jt++]=void 0}}getMovableList(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getMovableList(r,this.__wbg_ptr,gn(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return Ai.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Jt++]=void 0}}getCounter(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getCounter(r,this.__wbg_ptr,gn(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return Ei.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Jt++]=void 0}}getTree(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getTree(r,this.__wbg_ptr,gn(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return Ti.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Jt++]=void 0}}hasContainer(e){return w.lorodoc_hasContainer(this.__wbg_ptr,se(e))!==0}getContainerById(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getContainerById(r,this.__wbg_ptr,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}setNextCommitMessage(e){const n=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=qe;w.lorodoc_setNextCommitMessage(this.__wbg_ptr,n,o)}setNextCommitOrigin(e){const n=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=qe;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,se(e));var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}clearNextCommitOptions(){w.lorodoc_clearNextCommitOptions(this.__wbg_ptr)}getDeepValueWithID(){return W(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,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(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=qe;w.lorodoc_JSONPath(r,this.__wbg_ptr,s,i);var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}version(){const e=w.lorodoc_version(this.__wbg_ptr);return Dn.__wrap(e)}shallowSinceVV(){const e=w.lorodoc_shallowSinceVV(this.__wbg_ptr);return Dn.__wrap(e)}isShallow(){return w.lorodoc_isShallow(this.__wbg_ptr)!==0}shallowSinceFrontiers(){return W(w.lorodoc_shallowSinceFrontiers(this.__wbg_ptr))}oplogVersion(){const e=w.lorodoc_oplogVersion(this.__wbg_ptr);return Dn.__wrap(e)}frontiers(){return W(w.lorodoc_frontiers(this.__wbg_ptr))}oplogFrontiers(){return W(w.lorodoc_oplogFrontiers(this.__wbg_ptr))}cmpWithFrontiers(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=wn(e,w.__wbindgen_export_0),i=qe;w.lorodoc_cmpWithFrontiers(r,this.__wbg_ptr,s,i);var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(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=wn(e,w.__wbindgen_export_0),a=qe,l=wn(n,w.__wbindgen_export_0),c=qe;w.lorodoc_cmpFrontiers(s,this.__wbg_ptr,i,a,l,c);var o=R().getInt32(s+0,!0),r=R().getInt32(s+4,!0);if(R().getInt32(s+8,!0))throw W(r);return W(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=R().getInt32(s+0,!0),n=R().getInt32(s+4,!0),o=R().getInt32(s+8,!0);if(R().getInt32(s+12,!0))throw W(o);var r=oo(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,se(e));var n=R().getInt32(i+0,!0),o=R().getInt32(i+4,!0),r=R().getInt32(i+8,!0);if(R().getInt32(i+12,!0))throw W(r);var s=oo(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,se(e));var n=R().getInt32(i+0,!0),o=R().getInt32(i+4,!0),r=R().getInt32(i+8,!0);if(R().getInt32(i+12,!0))throw W(r);var s=oo(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,se(e),se(n),Mn(o)?16777215:o?1:0);var r=R().getInt32(i+0,!0),s=R().getInt32(i+4,!0);if(R().getInt32(i+8,!0))throw W(s);return W(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,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(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,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(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=qe;w.lorodoc_import(r,this.__wbg_ptr,s,i);var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(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,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(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,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(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=R().getInt32(o+0,!0),n=R().getInt32(o+4,!0);if(R().getInt32(o+8,!0))throw W(n);return W(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=R().getInt32(o+0,!0),n=R().getInt32(o+4,!0);if(R().getInt32(o+8,!0))throw W(n);return W(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}subscribe(e){return W(w.lorodoc_subscribe(this.__wbg_ptr,se(e)))}subscribeLocalUpdates(e){return W(w.lorodoc_subscribeLocalUpdates(this.__wbg_ptr,se(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 W(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,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(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=qe;w.lorodoc_getChangeAtLamport(s,this.__wbg_ptr,i,a,n);var o=R().getInt32(s+0,!0),r=R().getInt32(s+4,!0);if(R().getInt32(s+8,!0))throw W(r);return W(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,se(e));var n=R().getInt32(i+0,!0),o=R().getInt32(i+4,!0),r=R().getInt32(i+8,!0);if(R().getInt32(i+12,!0))throw W(r);var s=On(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=wn(e,w.__wbindgen_export_0),i=qe;w.lorodoc_frontiersToVV(r,this.__wbg_ptr,s,i);var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return Dn.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}vvToFrontiers(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);es(e,Dn),w.lorodoc_vvToFrontiers(r,this.__wbg_ptr,e.__wbg_ptr);var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getByPath(e){const n=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=qe;return W(w.lorodoc_getByPath(this.__wbg_ptr,n,o))}getCursorPos(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);es(e,Gn),w.lorodoc_getCursorPos(r,this.__wbg_ptr,e.__wbg_ptr);var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(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,se(e),n);var o=R().getInt32(a+0,!0),r=R().getInt32(a+4,!0),s=R().getInt32(a+8,!0);if(R().getInt32(a+12,!0))throw W(s);var i=On(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=wn(e,w.__wbindgen_export_0),s=qe;w.lorodoc_revertTo(o,this.__wbg_ptr,r,s);var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(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,se(e));var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}diff(e,n,o){try{const i=w.__wbindgen_add_to_stack_pointer(-16),a=wn(e,w.__wbindgen_export_0),l=qe,c=wn(n,w.__wbindgen_export_0),d=qe;w.lorodoc_diff(i,this.__wbg_ptr,a,l,c,d,Mn(o)?16777215:o?1:0);var r=R().getInt32(i+0,!0),s=R().getInt32(i+4,!0);if(R().getInt32(i+8,!0))throw W(s);return W(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=R().getInt32(o+0,!0),n=R().getInt32(o+4,!0);if(R().getInt32(o+8,!0))throw W(n);return W(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}subscribeFirstCommitFromPeer(e){return W(w.lorodoc_subscribeFirstCommitFromPeer(this.__wbg_ptr,se(e)))}subscribePreCommit(e){return W(w.lorodoc_subscribePreCommit(this.__wbg_ptr,se(e)))}deleteRootContainer(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_deleteRootContainer(o,this.__wbg_ptr,se(e));var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(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=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}}const Nu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorolist_free(t>>>0,1));class Ii{static __wrap(e){e>>>=0;const n=Object.create(Ii.prototype);return n.__wbg_ptr=e,Nu.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Nu.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,Nu.register(this,this.__wbg_ptr,this),this}kind(){return W(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,se(n));var o=R().getInt32(r+0,!0);if(R().getInt32(r+4,!0))throw W(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=R().getInt32(r+0,!0);if(R().getInt32(r+4,!0))throw W(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get(e){return W(w.lorolist_get(this.__wbg_ptr,e))}get id(){return W(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=R().getInt32(r+0,!0),n=R().getInt32(r+4,!0),o=On(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return W(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,se(n));var o=R().getInt32(s+0,!0),r=R().getInt32(s+4,!0);if(R().getInt32(s+8,!0))throw W(r);return W(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,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(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,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get length(){return w.lorolist_length(this.__wbg_ptr)>>>0}parent(){return W(w.lorolist_parent(this.__wbg_ptr))}isAttached(){return w.lorolist_isAttached(this.__wbg_ptr)!==0}getAttached(){return W(w.lorolist_getAttached(this.__wbg_ptr))}getCursor(e,n){const o=w.lorolist_getCursor(this.__wbg_ptr,e,se(n));return o===0?void 0:Gn.__wrap(o)}push(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_push(o,this.__wbg_ptr,se(e));var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(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=R().getInt32(o+0,!0),n=R().getInt32(o+4,!0);if(R().getInt32(o+8,!0))throw W(n);return W(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=R().getInt32(n+0,!0);if(R().getInt32(n+4,!0))throw W(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getIdAt(e){return W(w.lorolist_getIdAt(this.__wbg_ptr,e))}isDeleted(){return w.lorolist_isDeleted(this.__wbg_ptr)!==0}getShallowValue(){return W(w.lorolist_getShallowValue(this.__wbg_ptr))}}const ju=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,ju.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,ju.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,ju.register(this,this.__wbg_ptr,this),this}kind(){return W(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=qe;w.loromap_set(r,this.__wbg_ptr,s,i,se(n));var o=R().getInt32(r+0,!0);if(R().getInt32(r+4,!0))throw W(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=qe;w.loromap_delete(o,this.__wbg_ptr,r,s);var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get(e){const n=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=qe;return W(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=qe;w.loromap_getOrCreateContainer(s,this.__wbg_ptr,i,a,se(n));var o=R().getInt32(s+0,!0),r=R().getInt32(s+4,!0);if(R().getInt32(s+8,!0))throw W(r);return W(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=R().getInt32(r+0,!0),n=R().getInt32(r+4,!0),o=On(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=R().getInt32(r+0,!0),n=R().getInt32(r+4,!0),o=On(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=R().getInt32(r+0,!0),n=R().getInt32(r+4,!0),o=On(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}get id(){return W(w.loromap_id(this.__wbg_ptr))}toJSON(){return W(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=qe;w.loromap_setContainer(s,this.__wbg_ptr,i,a,se(n));var o=R().getInt32(s+0,!0),r=R().getInt32(s+4,!0);if(R().getInt32(s+8,!0))throw W(r);return W(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,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get size(){return w.loromap_size(this.__wbg_ptr)>>>0}parent(){return W(w.loromap_parent(this.__wbg_ptr))}isAttached(){return w.loromap_isAttached(this.__wbg_ptr)!==0}getAttached(){return W(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=R().getInt32(n+0,!0);if(R().getInt32(n+4,!0))throw W(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getLastEditor(e){const n=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=qe;return W(w.loromap_getLastEditor(this.__wbg_ptr,n,o))}isDeleted(){return w.loromap_isDeleted(this.__wbg_ptr)!==0}getShallowValue(){return W(w.loromap_getShallowValue(this.__wbg_ptr))}}const Eu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_loromovablelist_free(t>>>0,1));class Ai{static __wrap(e){e>>>=0;const n=Object.create(Ai.prototype);return n.__wbg_ptr=e,Eu.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Eu.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,Eu.register(this,this.__wbg_ptr,this),this}kind(){return W(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,se(n));var o=R().getInt32(r+0,!0);if(R().getInt32(r+4,!0))throw W(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=R().getInt32(r+0,!0);if(R().getInt32(r+4,!0))throw W(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get(e){return W(w.loromovablelist_get(this.__wbg_ptr,e))}get id(){return W(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=R().getInt32(r+0,!0),n=R().getInt32(r+4,!0),o=On(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return W(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,se(n));var o=R().getInt32(s+0,!0),r=R().getInt32(s+4,!0);if(R().getInt32(s+8,!0))throw W(r);return W(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,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(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,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get length(){return w.loromovablelist_length(this.__wbg_ptr)>>>0}parent(){return W(w.loromovablelist_parent(this.__wbg_ptr))}isAttached(){return w.loromovablelist_isAttached(this.__wbg_ptr)!==0}getAttached(){return W(w.loromovablelist_getAttached(this.__wbg_ptr))}getCursor(e,n){const o=w.loromovablelist_getCursor(this.__wbg_ptr,e,se(n));return o===0?void 0:Gn.__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=R().getInt32(r+0,!0);if(R().getInt32(r+4,!0))throw W(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,se(n));var o=R().getInt32(r+0,!0);if(R().getInt32(r+4,!0))throw W(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,se(n));var o=R().getInt32(s+0,!0),r=R().getInt32(s+4,!0);if(R().getInt32(s+8,!0))throw W(r);return W(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,se(e));var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(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=R().getInt32(o+0,!0),n=R().getInt32(o+4,!0);if(R().getInt32(o+8,!0))throw W(n);return W(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=R().getInt32(n+0,!0);if(R().getInt32(n+4,!0))throw W(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getCreatorAt(e){return W(w.loromovablelist_getCreatorAt(this.__wbg_ptr,e))}getLastMoverAt(e){return W(w.loromovablelist_getLastMoverAt(this.__wbg_ptr,e))}getLastEditorAt(e){return W(w.loromovablelist_getLastEditorAt(this.__wbg_ptr,e))}isDeleted(){return w.loromovablelist_isDeleted(this.__wbg_ptr)!==0}getShallowValue(){return W(w.loromovablelist_getShallowValue(this.__wbg_ptr))}}const Iu=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,Iu.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Iu.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,Iu.register(this,this.__wbg_ptr,this),this}kind(){return W(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,se(e));var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(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=qe;w.lorotext_update(r,this.__wbg_ptr,s,i,se(n));var o=R().getInt32(r+0,!0);if(R().getInt32(r+4,!0))throw W(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=qe;w.lorotext_updateByLine(r,this.__wbg_ptr,s,i,se(n));var o=R().getInt32(r+0,!0);if(R().getInt32(r+4,!0))throw W(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=qe;w.lorotext_insert(r,this.__wbg_ptr,e,s,i);var o=R().getInt32(r+0,!0);if(R().getInt32(r+4,!0))throw W(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}slice(e,n){let o,r;try{const u=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_slice(u,this.__wbg_ptr,e,n);var s=R().getInt32(u+0,!0),i=R().getInt32(u+4,!0),a=R().getInt32(u+8,!0),l=R().getInt32(u+12,!0),c=s,d=i;if(l)throw c=0,d=0,W(a);return o=c,r=d,Tt(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=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(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),p=ft(o,w.__wbindgen_export_0,w.__wbindgen_export_1),_=qe;w.lorotext_splice(f,this.__wbg_ptr,e,n,p,_);var i=R().getInt32(f+0,!0),a=R().getInt32(f+4,!0),l=R().getInt32(f+8,!0),c=R().getInt32(f+12,!0),d=i,u=a;if(c)throw d=0,u=0,W(l);return r=d,s=u,Tt(d,u)}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=qe;w.lorotext_insertUtf8(r,this.__wbg_ptr,e,s,i);var o=R().getInt32(r+0,!0);if(R().getInt32(r+4,!0))throw W(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=R().getInt32(r+0,!0);if(R().getInt32(r+4,!0))throw W(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=R().getInt32(r+0,!0);if(R().getInt32(r+4,!0))throw W(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=qe;w.lorotext_mark(s,this.__wbg_ptr,se(e),i,a,se(o));var r=R().getInt32(s+0,!0);if(R().getInt32(s+4,!0))throw W(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=qe;w.lorotext_unmark(r,this.__wbg_ptr,se(e),s,i);var o=R().getInt32(r+0,!0);if(R().getInt32(r+4,!0))throw W(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=R().getInt32(s+0,!0),r=R().getInt32(s+4,!0);return e=o,n=r,Tt(o,r)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(e,n,1)}}toDelta(){return W(w.lorotext_toDelta(this.__wbg_ptr))}get id(){return W(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,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(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,se(e));var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}parent(){return W(w.lorotext_parent(this.__wbg_ptr))}isAttached(){return w.lorotext_isAttached(this.__wbg_ptr)!==0}getAttached(){return W(w.lorotext_getAttached(this.__wbg_ptr))}getCursor(e,n){const o=w.lorotext_getCursor(this.__wbg_ptr,e,se(n));return o===0?void 0:Gn.__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=qe;w.lorotext_push(o,this.__wbg_ptr,r,s);var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getEditorOf(e){return W(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=R().getInt32(s+0,!0),r=R().getInt32(s+4,!0);return e=o,n=r,Tt(o,r)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(e,n,1)}}toJSON(){return W(w.lorotext_toJSON(this.__wbg_ptr))}}const Au=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorotree_free(t>>>0,1));class Ti{static __wrap(e){e>>>=0;const n=Object.create(Ti.prototype);return n.__wbg_ptr=e,Au.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Au.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,Au.register(this,this.__wbg_ptr,this),this}kind(){return W(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,gn(e),Mn(n)?4294967297:n>>>0);var o=R().getInt32(s+0,!0),r=R().getInt32(s+4,!0);if(R().getInt32(s+8,!0))throw W(r);return ro.__wrap(o)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Jt++]=void 0}}move(e,n,o){try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_move(s,this.__wbg_ptr,gn(e),gn(n),Mn(o)?4294967297:o>>>0);var r=R().getInt32(s+0,!0);if(R().getInt32(s+4,!0))throw W(r)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Jt++]=void 0,kt[Jt++]=void 0}}delete(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_delete(o,this.__wbg_ptr,gn(e));var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Jt++]=void 0}}getNodeByID(e){try{const n=w.lorotree_getNodeByID(this.__wbg_ptr,gn(e));return n===0?void 0:ro.__wrap(n)}finally{kt[Jt++]=void 0}}get id(){return W(w.lorotree_id(this.__wbg_ptr))}has(e){try{return w.lorotree_has(this.__wbg_ptr,gn(e))!==0}finally{kt[Jt++]=void 0}}isNodeDeleted(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_isNodeDeleted(r,this.__wbg_ptr,gn(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return n!==0}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Jt++]=void 0}}toArray(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_toArray(o,this.__wbg_ptr);var e=R().getInt32(o+0,!0),n=R().getInt32(o+4,!0);if(R().getInt32(o+8,!0))throw W(n);return W(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,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return W(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=R().getInt32(r+0,!0),n=R().getInt32(r+4,!0),o=On(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=R().getInt32(r+0,!0),n=R().getInt32(r+4,!0),o=On(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,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}parent(){return W(w.lorotree_parent(this.__wbg_ptr))}isAttached(){return w.lorotree_isAttached(this.__wbg_ptr)!==0}getAttached(){return W(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 W(w.lorotree_getShallowValue(this.__wbg_ptr))}}const sb=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorotreenode_free(t>>>0,1));class ro{static __wrap(e){e>>>=0;const n=Object.create(ro.prototype);return n.__wbg_ptr=e,sb.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,sb.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=R().getInt32(s+0,!0),r=R().getInt32(s+4,!0);return e=o,n=r,Tt(o,r)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(e,n,1)}}get id(){return W(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,Mn(e)?4294967297:e>>>0);var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return ro.__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,gn(e),Mn(n)?4294967297:n>>>0);var o=R().getInt32(r+0,!0);if(R().getInt32(r+4,!0))throw W(o)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Jt++]=void 0}}moveAfter(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);es(e,ro),w.lorotreenode_moveAfter(o,this.__wbg_ptr,e.__wbg_ptr);var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}moveBefore(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);es(e,ro),w.lorotreenode_moveBefore(o,this.__wbg_ptr,e.__wbg_ptr);var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(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=R().getFloat64(o+0,!0),n=R().getInt32(o+8,!0);if(R().getInt32(o+12,!0))throw W(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=R().getInt32(o+0,!0),n=R().getInt32(o+4,!0);if(R().getInt32(o+8,!0))throw W(n);return W(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=R().getInt32(o+0,!0),n=R().getInt32(o+4,!0);if(R().getInt32(o+8,!0))throw W(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=R().getInt32(o+0,!0),n=R().getInt32(o+4,!0);if(R().getInt32(o+8,!0))throw W(n);return W(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=R().getInt32(o+0,!0),n=R().getInt32(o+4,!0);if(R().getInt32(o+8,!0))throw W(n);return e===0?void 0:ro.__wrap(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}children(){return W(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=R().getInt32(o+0,!0),n=R().getInt32(o+4,!0);if(R().getInt32(o+8,!0))throw W(n);return e!==0}finally{w.__wbindgen_add_to_stack_pointer(16)}}getLastMoveId(){return W(w.lorotreenode_getLastMoveId(this.__wbg_ptr))}creationId(){return W(w.lorotreenode_creationId(this.__wbg_ptr))}creator(){return W(w.lorotreenode_creator(this.__wbg_ptr))}}const ib=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_undomanager_free(t>>>0,1)),Tu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_versionvector_free(t>>>0,1));class Dn{static __wrap(e){e>>>=0;const n=Object.create(Dn.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_versionvector_free(e,0)}constructor(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_new(r,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return this.__wbg_ptr=n>>>0,Tu.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,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return Dn.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return W(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=R().getInt32(r+0,!0),n=R().getInt32(r+4,!0),o=oo(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=qe;w.versionvector_decode(r,s,i);var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return Dn.__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,se(e));var n=R().getFloat64(r+0,!0),o=R().getInt32(r+8,!0);if(R().getInt32(r+12,!0))throw W(o);return n===4294967297?void 0:n}finally{w.__wbindgen_add_to_stack_pointer(16)}}compare(e){es(e,Dn);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,se(e));var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(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,se(e));var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(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,se(e));var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}length(){return w.versionvector_length(this.__wbg_ptr)>>>0}}function ab(t,e){const n=ft(String(ye(e)),w.__wbindgen_export_0,w.__wbindgen_export_1),o=qe;R().setInt32(t+4,o,!0),R().setInt32(t+0,n,!0)}function lb(){return Yt(function(t,e,n){return se(Reflect.apply(ye(t),ye(e),ye(n)))},arguments)}function cb(t){return se(ye(t).buffer)}function db(){return Yt(function(t,e){return se(ye(t).call(ye(e)))},arguments)}function ub(){return Yt(function(t,e,n){return se(ye(t).call(ye(e),ye(n)))},arguments)}function hb(){return Yt(function(t,e,n,o,r){return se(ye(t).call(ye(e),ye(n),ye(o),ye(r)))},arguments)}function fb(){return Yt(function(t,e,n,o){return se(ye(t).call(ye(e),ye(n),ye(o)))},arguments)}function pb(t){return se(ts.__wrap(t))}function mb(t){return se(ye(t).crypto)}function gb(t){return se(Gn.__wrap(t))}function _b(t){return ye(t).done}function bb(t){return se(ye(t).entries())}function yb(t){return se(Object.entries(ye(t)))}function xb(t,e){let n,o;try{n=t,o=e,console.error(Tt(t,e))}finally{w.__wbindgen_export_3(n,o,1)}}function wb(t,e){console.error(Tt(t,e))}function vb(t){return se(Array.from(ye(t)))}function kb(){return Yt(function(t,e){ye(t).getRandomValues(ye(e))},arguments)}function Sb(t,e){return se(ye(t)[e>>>0])}function Cb(){return Yt(function(t,e){return se(Reflect.get(ye(t),ye(e)))},arguments)}function Nb(t,e){return ye(t)[e>>>0]}function jb(t,e){return se(ye(t)[ye(e)])}function Eb(){return Yt(function(){return se(globalThis.globalThis)},arguments)}function Ib(){return Yt(function(){return se(global.global)},arguments)}function Ab(t){let e;try{e=ye(t)instanceof ArrayBuffer}catch{e=!1}return e}function Tb(t){let e;try{e=ye(t)instanceof Map}catch{e=!1}return e}function Mb(t){let e;try{e=ye(t)instanceof Object}catch{e=!1}return e}function Ob(t){let e;try{e=ye(t)instanceof Uint8Array}catch{e=!1}return e}function Db(t){return Array.isArray(ye(t))}function Rb(t){return Number.isSafeInteger(ye(t))}function Pb(){return se(Symbol.iterator)}function Lb(t){return ye(t).length}function Fb(t){return ye(t).length}function zb(t,e,n,o,r,s,i,a){let l,c;try{l=t,c=e,console.log(Tt(t,e),Tt(n,o),Tt(r,s),Tt(i,a))}finally{w.__wbindgen_export_3(l,c,1)}}function Bb(t,e){console.log(Tt(t,e))}function Ub(t,e){let n,o;try{n=t,o=e,console.log(Tt(t,e))}finally{w.__wbindgen_export_3(n,o,1)}}function Vb(t){return se(Ei.__wrap(t))}function $b(t){return se(Ii.__wrap(t))}function Hb(t){return se(Ko.__wrap(t))}function Wb(t){return se(Ai.__wrap(t))}function qb(t){return se(Xo.__wrap(t))}function Gb(t){return se(Ti.__wrap(t))}function Yb(t){return se(ro.__wrap(t))}function Jb(t,e){performance.mark(Tt(t,e))}function Kb(){return Yt(function(t,e,n,o){let r,s,i,a;try{r=t,s=e,i=n,a=o,performance.measure(Tt(t,e),Tt(n,o))}finally{w.__wbindgen_export_3(r,s,1),w.__wbindgen_export_3(i,a,1)}},arguments)}function Xb(t){return se(ye(t).msCrypto)}function Zb(){return se(new Map)}function Qb(t){return se(new Uint8Array(ye(t)))}function ey(){return se(new Object)}function ty(){return se(new Error)}function ny(){return se(new Array)}function oy(t,e){return se(new Function(Tt(t,e)))}function ry(t,e,n){return se(new Uint8Array(ye(t),e>>>0,n>>>0))}function sy(t){return se(new Uint8Array(t>>>0))}function iy(t){return se(new Array(t>>>0))}function ay(t){return se(ye(t).next)}function ly(){return Yt(function(t){return se(ye(t).next())},arguments)}function cy(t){return se(ye(t).node)}function dy(){return Date.now()}function uy(){return Yt(function(t){return se(Reflect.ownKeys(ye(t)))},arguments)}function hy(t){return se(ye(t).process)}function fy(t,e){return ye(t).push(ye(e))}function py(){return Yt(function(t,e){ye(t).randomFillSync(W(e))},arguments)}function my(){return Yt(function(){return se(module.require)},arguments)}function gy(t){return se(Promise.resolve(ye(t)))}function _y(){return Yt(function(){return se(self.self)},arguments)}function by(){return Yt(function(t,e,n){return Reflect.set(ye(t),ye(e),ye(n))},arguments)}function yy(t,e,n){return se(ye(t).set(ye(e),ye(n)))}function xy(t,e,n){ye(t)[W(e)]=W(n)}function wy(t,e,n){ye(t).set(ye(e),n>>>0)}function vy(t,e,n){ye(t)[e>>>0]=W(n)}function ky(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=qe;R().setInt32(t+4,o,!0),R().setInt32(t+0,n,!0)}function Cy(t,e,n){return se(ye(t).subarray(e>>>0,n>>>0))}function Ny(t,e){return se(ye(t).then(ye(e)))}function jy(t){return se(ye(t).value)}function Ey(t){return se(ye(t).versions)}function Iy(t){return se(Dn.__wrap(t))}function Ay(){return Yt(function(){return se(window.window)},arguments)}function Ty(t){return+ye(t)}function My(t){return se(t)}function Oy(t){return se(BigInt.asUintN(64,t))}function Dy(t,e){const n=ye(e),o=typeof n=="bigint"?n:void 0;R().setBigInt64(t+8,Mn(o)?BigInt(0):o,!0),R().setInt32(t+0,!Mn(o),!0)}function Ry(t){const e=ye(t);return typeof e=="boolean"?e?1:0:2}function Py(t){const e=W(t).original;return e.cnt--==1?(e.a=0,!0):!1}function Ly(t,e,n){return se(Q0(t,e,10,P5))}function Fy(t,e,n){return se(Q0(t,e,8,L5))}function zy(t,e){const n=ft(ku(ye(e)),w.__wbindgen_export_0,w.__wbindgen_export_1),o=qe;R().setInt32(t+4,o,!0),R().setInt32(t+0,n,!0)}function By(t,e){return se(new Error(Tt(t,e)))}function Uy(t,e){return ye(t)in ye(e)}function Vy(t){return Array.isArray(ye(t))}function $y(t){return typeof ye(t)=="bigint"}function Hy(t){return!ye(t)}function Wy(t){return typeof ye(t)=="function"}function qy(t){return ye(t)===null}function Gy(t){const e=ye(t);return typeof e=="object"&&e!==null}function Yy(t){return typeof ye(t)=="string"}function Jy(t){return ye(t)===void 0}function Ky(t,e){return ye(t)===ye(e)}function Xy(t,e){return ye(t)==ye(e)}function Zy(){return se(w.memory)}function Qy(t,e){const n=ye(e),o=typeof n=="number"?n:void 0;R().setFloat64(t+8,Mn(o)?0:o,!0),R().setInt32(t+0,!Mn(o),!0)}function ex(t){return se(t)}function tx(t){return se(ye(t))}function nx(t){W(t)}function ox(t){throw W(t)}function rx(t,e){const n=ye(e),o=typeof n=="string"?n:void 0;var r=Mn(o)?0:ft(o,w.__wbindgen_export_0,w.__wbindgen_export_1),s=qe;R().setInt32(t+4,s,!0),R().setInt32(t+0,r,!0)}function sx(t,e){return se(Tt(t,e))}function ix(t,e){throw new Error(Tt(t,e))}function ax(t){return se(typeof ye(t))}const F5=Object.freeze(Object.defineProperty({__proto__:null,AwarenessWasm:tb,ChangeModifier:ts,Cursor:Gn,EphemeralStoreWasm:class{__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,rb.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,rb.register(this,this.__wbg_ptr,this),this}set(t,e){const n=ft(t,w.__wbindgen_export_0,w.__wbindgen_export_1),o=qe;w.ephemeralstorewasm_set(this.__wbg_ptr,n,o,se(e))}delete(t){const e=ft(t,w.__wbindgen_export_0,w.__wbindgen_export_1),n=qe;w.ephemeralstorewasm_delete(this.__wbg_ptr,e,n)}get(t){const e=ft(t,w.__wbindgen_export_0,w.__wbindgen_export_1),n=qe;return W(w.ephemeralstorewasm_get(this.__wbg_ptr,e,n))}getAllStates(){return W(w.ephemeralstorewasm_getAllStates(this.__wbg_ptr))}subscribeLocalUpdates(t){return W(w.ephemeralstorewasm_subscribeLocalUpdates(this.__wbg_ptr,se(t)))}subscribe(t){return W(w.ephemeralstorewasm_subscribe(this.__wbg_ptr,se(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=qe;w.ephemeralstorewasm_encode(r,this.__wbg_ptr,s,i);var e=R().getInt32(r+0,!0),n=R().getInt32(r+4,!0),o=oo(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=R().getInt32(o+0,!0),e=R().getInt32(o+4,!0),n=oo(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=qe;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=R().getInt32(o+0,!0),e=R().getInt32(o+4,!0),n=On(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=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);return t=n,e=o,Tt(n,o)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(t,e,1)}},LoroCounter:Ei,LoroDoc:yo,LoroList:Ii,LoroMap:Ko,LoroMovableList:Ai,LoroText:Xo,LoroTree:Ti,LoroTreeNode:ro,UndoManager:class{__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,ib.unregister(this),t}free(){const t=this.__destroy_into_raw();w.__wbg_undomanager_free(t,0)}constructor(t,e){es(t,yo);const n=w.undomanager_new(t.__wbg_ptr,se(e));return this.__wbg_ptr=n>>>0,ib.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=R().getInt32(n+0,!0),e=R().getInt32(n+4,!0);if(R().getInt32(n+8,!0))throw W(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=R().getInt32(n+0,!0),e=R().getInt32(n+4,!0);if(R().getInt32(n+8,!0))throw W(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=qe;w.undomanager_addExcludeOriginPrefix(this.__wbg_ptr,e,n)}setOnPush(t){w.undomanager_setOnPush(this.__wbg_ptr,se(t))}setOnPop(t){w.undomanager_setOnPop(this.__wbg_ptr,se(t))}clear(){w.undomanager_clear(this.__wbg_ptr)}},VersionVector:Dn,__wbg_String_8f0eb39a4a4c2f66:ab,__wbg_apply_9bb7fe8fff013a3f:lb,__wbg_buffer_ef9774282e5dab94:cb,__wbg_call_0ad083564791763a:db,__wbg_call_a34b6b4765f27be0:ub,__wbg_call_d00953b926be4879:hb,__wbg_call_efe5a4db7065d1a2:fb,__wbg_changemodifier_new:pb,__wbg_crypto_ed58b8e10a292839:mb,__wbg_cursor_new:gb,__wbg_done_f4c254830a095eaf:_b,__wbg_entries_4dce6361e3ba6fbc:bb,__wbg_entries_83beb641792ccb9c:yb,__wbg_error_7534b8e9a36f1ab4:xb,__wbg_error_9912f7d6d7835a4b:wb,__wbg_from_3aa0fcaa8eef0104:vb,__wbg_getRandomValues_bcb4912f16000dc4:kb,__wbg_get_0c3cc364764a0b98:Sb,__wbg_get_b996a12be035ef4f:Cb,__wbg_getindex_a471648b3037c750:Nb,__wbg_getwithrefkey_1dc361bd10053bfe:jb,__wbg_globalThis_6b4d52a0b6aaeaea:Eb,__wbg_global_49324ce12193de77:Ib,__wbg_instanceof_ArrayBuffer_ff40e55b5978e215:Ab,__wbg_instanceof_Map_0f3f3653f757ced1:Tb,__wbg_instanceof_Object_9108547bac1f91b1:Mb,__wbg_instanceof_Uint8Array_db97368f94b1373f:Ob,__wbg_isArray_8738f1062fa88586:Db,__wbg_isSafeInteger_a1b3e0811faecf2f:Rb,__wbg_iterator_c0c688f37fa815e6:Pb,__wbg_length_12246a78d2f65d3a:Lb,__wbg_length_c24da17096edfe57:Fb,__wbg_log_0cc1b7768397bcfe:zb,__wbg_log_0fd6c49475c7bece:Bb,__wbg_log_cb9e190acc5753fb:Ub,__wbg_lorocounter_new:Vb,__wbg_lorolist_new:$b,__wbg_loromap_new:Hb,__wbg_loromovablelist_new:Wb,__wbg_lorotext_new:qb,__wbg_lorotree_new:Gb,__wbg_lorotreenode_new:Yb,__wbg_mark_7438147ce31e9d4b:Jb,__wbg_measure_fb7825c11612c823:Kb,__wbg_msCrypto_0a36e2ec3a343d26:Xb,__wbg_new_518e2184725aa711:Zb,__wbg_new_59845962d1127937:Qb,__wbg_new_67abf4a77618ee3e:ey,__wbg_new_8a6f238a6ece86ea:ty,__wbg_new_e2d07398d7689006:ny,__wbg_newnoargs_a136448eeb7d48ac:oy,__wbg_newwithbyteoffsetandlength_84908302a4c137cf:ry,__wbg_newwithlength_4c216eaaf23f2f9a:sy,__wbg_newwithlength_88b49de1eb24d63e:iy,__wbg_next_928df8c15fc0c9b0:ay,__wbg_next_9dc0926f351c7090:ly,__wbg_node_02999533c4ea02e3:cy,__wbg_now_3e8577e703add0ba:dy,__wbg_ownKeys_b16312a839a4152c:uy,__wbg_process_5c1d670bc53614b8:hy,__wbg_push_e7d7247e69dad3ee:fy,__wbg_randomFillSync_ab2cfe79ebbf2740:py,__wbg_require_79b1e9274cde3c87:my,__wbg_resolve_267ff08e7e1d2ce4:gy,__wbg_self_cca3ca60d61220f4:_y,__wbg_set_1b50d2de855a9d50:by,__wbg_set_393f510a6b7e9da5:yy,__wbg_set_3f1d0b984ed272ed:xy,__wbg_set_5deee49b10b2b780:wy,__wbg_set_93ba9407b5476ec6:vy,__wbg_set_wasm:vu,__wbg_setindex_e0b7b31bfc87ba3f:ky,__wbg_stack_0ed75d68575b0f3c:Sy,__wbg_subarray_2dc34705c0dc7cdb:Cy,__wbg_then_84907e7a6730461e:Ny,__wbg_value_51f8a88d4a1805fb:jy,__wbg_versions_c71aa1626a93e0a1:Ey,__wbg_versionvector_new:Iy,__wbg_window_2aba046d3fc4ad7c:Ay,__wbindgen_as_number:Ty,__wbindgen_bigint_from_i64:My,__wbindgen_bigint_from_u64:Oy,__wbindgen_bigint_get_as_i64:Dy,__wbindgen_boolean_get:Ry,__wbindgen_cb_drop:Py,__wbindgen_closure_wrapper483:Ly,__wbindgen_closure_wrapper486:Fy,__wbindgen_debug_string:zy,__wbindgen_error_new:By,__wbindgen_in:Uy,__wbindgen_is_array:Vy,__wbindgen_is_bigint:$y,__wbindgen_is_falsy:Hy,__wbindgen_is_function:Wy,__wbindgen_is_null:qy,__wbindgen_is_object:Gy,__wbindgen_is_string:Yy,__wbindgen_is_undefined:Jy,__wbindgen_jsval_eq:Ky,__wbindgen_jsval_loose_eq:Xy,__wbindgen_memory:Zy,__wbindgen_number_get:Qy,__wbindgen_number_new:ex,__wbindgen_object_clone_ref:tx,__wbindgen_object_drop_ref:nx,__wbindgen_rethrow:ox,__wbindgen_string_get:rx,__wbindgen_string_new:sx,__wbindgen_throw:ix,__wbindgen_typeof:ax,decodeFrontiers:function(t){try{const o=w.__wbindgen_add_to_stack_pointer(-16),r=Jo(t,w.__wbindgen_export_0),s=qe;w.decodeFrontiers(o,r,s);var e=R().getInt32(o+0,!0),n=R().getInt32(o+4,!0);if(R().getInt32(o+8,!0))throw W(n);return W(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=qe;w.decodeImportBlobMeta(r,s,i,e);var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}},encodeFrontiers:function(t){try{const s=w.__wbindgen_add_to_stack_pointer(-16),i=wn(t,w.__wbindgen_export_0),a=qe;w.encodeFrontiers(s,i,a);var e=R().getInt32(s+0,!0),n=R().getInt32(s+4,!0),o=R().getInt32(s+8,!0);if(R().getInt32(s+12,!0))throw W(o);var r=oo(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:nx,__wbg_lorotree_new:Gb,__wbg_lorocounter_new:Vb,__wbg_loromovablelist_new:Wb,__wbg_lorotreenode_new:Yb,__wbg_cursor_new:gb,__wbg_lorolist_new:$b,__wbg_lorotext_new:qb,__wbg_loromap_new:Hb,__wbg_versionvector_new:Iy,__wbg_changemodifier_new:pb,__wbindgen_is_function:Wy,__wbindgen_string_new:sx,__wbindgen_boolean_get:Ry,__wbindgen_error_new:By,__wbindgen_object_clone_ref:tx,__wbindgen_string_get:rx,__wbindgen_is_undefined:Jy,__wbindgen_in:Uy,__wbindgen_is_bigint:$y,__wbindgen_number_get:Qy,__wbindgen_bigint_from_i64:My,__wbindgen_jsval_eq:Ky,__wbindgen_is_object:Gy,__wbindgen_bigint_from_u64:Oy,__wbindgen_cb_drop:Py,__wbindgen_as_number:Ty,__wbindgen_is_string:Yy,__wbindgen_is_null:qy,__wbindgen_number_new:ex,__wbindgen_is_array:Vy,__wbindgen_typeof:ax,__wbg_error_9912f7d6d7835a4b:wb,__wbg_log_0fd6c49475c7bece:Bb,__wbindgen_is_falsy:Hy,__wbindgen_jsval_loose_eq:Xy,__wbg_String_8f0eb39a4a4c2f66:ab,__wbg_getwithrefkey_1dc361bd10053bfe:jb,__wbg_set_3f1d0b984ed272ed:xy,__wbg_log_cb9e190acc5753fb:Ub,__wbg_log_0cc1b7768397bcfe:zb,__wbg_mark_7438147ce31e9d4b:Jb,__wbg_measure_fb7825c11612c823:Kb,__wbg_new_8a6f238a6ece86ea:ty,__wbg_stack_0ed75d68575b0f3c:Sy,__wbg_error_7534b8e9a36f1ab4:xb,__wbg_now_3e8577e703add0ba:dy,__wbg_crypto_ed58b8e10a292839:mb,__wbg_process_5c1d670bc53614b8:hy,__wbg_versions_c71aa1626a93e0a1:Ey,__wbg_node_02999533c4ea02e3:cy,__wbg_require_79b1e9274cde3c87:my,__wbg_msCrypto_0a36e2ec3a343d26:Xb,__wbg_randomFillSync_ab2cfe79ebbf2740:py,__wbg_getRandomValues_bcb4912f16000dc4:kb,__wbg_self_cca3ca60d61220f4:_y,__wbg_window_2aba046d3fc4ad7c:Ay,__wbg_globalThis_6b4d52a0b6aaeaea:Eb,__wbg_global_49324ce12193de77:Ib,__wbg_newnoargs_a136448eeb7d48ac:oy,__wbg_call_0ad083564791763a:db,__wbg_get_0c3cc364764a0b98:Sb,__wbg_length_12246a78d2f65d3a:Lb,__wbg_new_e2d07398d7689006:ny,__wbg_new_518e2184725aa711:Zb,__wbg_next_928df8c15fc0c9b0:ay,__wbg_next_9dc0926f351c7090:ly,__wbg_done_f4c254830a095eaf:_b,__wbg_value_51f8a88d4a1805fb:jy,__wbg_iterator_c0c688f37fa815e6:Pb,__wbg_get_b996a12be035ef4f:Cb,__wbg_new_67abf4a77618ee3e:ey,__wbg_newwithlength_88b49de1eb24d63e:iy,__wbg_set_93ba9407b5476ec6:vy,__wbg_from_3aa0fcaa8eef0104:vb,__wbg_isArray_8738f1062fa88586:Db,__wbg_push_e7d7247e69dad3ee:fy,__wbg_instanceof_ArrayBuffer_ff40e55b5978e215:Ab,__wbg_call_a34b6b4765f27be0:ub,__wbg_call_efe5a4db7065d1a2:fb,__wbg_call_d00953b926be4879:hb,__wbg_instanceof_Map_0f3f3653f757ced1:Tb,__wbg_set_393f510a6b7e9da5:yy,__wbg_entries_4dce6361e3ba6fbc:bb,__wbg_isSafeInteger_a1b3e0811faecf2f:Rb,__wbg_instanceof_Object_9108547bac1f91b1:Mb,__wbg_entries_83beb641792ccb9c:yb,__wbg_apply_9bb7fe8fff013a3f:lb,__wbg_ownKeys_b16312a839a4152c:uy,__wbg_set_1b50d2de855a9d50:by,__wbg_buffer_ef9774282e5dab94:cb,__wbg_resolve_267ff08e7e1d2ce4:gy,__wbg_then_84907e7a6730461e:Ny,__wbg_newwithbyteoffsetandlength_84908302a4c137cf:ry,__wbg_new_59845962d1127937:Qb,__wbg_set_5deee49b10b2b780:wy,__wbg_length_c24da17096edfe57:Fb,__wbg_instanceof_Uint8Array_db97368f94b1373f:Ob,__wbg_newwithlength_4c216eaaf23f2f9a:sy,__wbg_subarray_2dc34705c0dc7cdb:Cy,__wbg_getindex_a471648b3037c750:Nb,__wbg_setindex_e0b7b31bfc87ba3f:ky,__wbindgen_bigint_get_as_i64:Dy,__wbindgen_debug_string:zy,__wbindgen_throw:ix,__wbindgen_rethrow:ox,__wbindgen_memory:Zy,__wbindgen_closure_wrapper483:Ly,__wbindgen_closure_wrapper486:Fy}},D5),z5=U.memory,B5=U.__wbg_lorocounter_free,U5=U.lorocounter_new,V5=U.lorocounter_kind,$5=U.lorocounter_id,H5=U.lorocounter_increment,W5=U.lorocounter_decrement,q5=U.lorocounter_value,G5=U.lorocounter_subscribe,Y5=U.lorocounter_parent,J5=U.lorocounter_isAttached,K5=U.lorocounter_getAttached,X5=U.lorocounter_getShallowValue,Z5=U.__wbg_awarenesswasm_free,Q5=U.awarenesswasm_new,e6=U.awarenesswasm_encode,t6=U.awarenesswasm_encodeAll,n6=U.awarenesswasm_apply,o6=U.awarenesswasm_setLocalState,r6=U.awarenesswasm_peer,s6=U.awarenesswasm_getAllStates,i6=U.awarenesswasm_getState,a6=U.awarenesswasm_getTimestamp,l6=U.awarenesswasm_removeOutdated,c6=U.awarenesswasm_length,d6=U.awarenesswasm_isEmpty,u6=U.awarenesswasm_peers,h6=U.__wbg_ephemeralstorewasm_free,f6=U.ephemeralstorewasm_new,p6=U.ephemeralstorewasm_set,m6=U.ephemeralstorewasm_delete,g6=U.ephemeralstorewasm_get,_6=U.ephemeralstorewasm_getAllStates,b6=U.ephemeralstorewasm_subscribeLocalUpdates,y6=U.ephemeralstorewasm_subscribe,x6=U.ephemeralstorewasm_encode,w6=U.ephemeralstorewasm_encodeAll,v6=U.ephemeralstorewasm_apply,k6=U.ephemeralstorewasm_removeOutdated,S6=U.ephemeralstorewasm_isEmpty,C6=U.ephemeralstorewasm_keys,N6=U.LORO_VERSION,j6=U.run,E6=U.encodeFrontiers,I6=U.decodeFrontiers,A6=U.setDebug,T6=U.__wbg_lorodoc_free,M6=U.lorodoc_new,O6=U.lorodoc_setDetachedEditing,D6=U.lorodoc_isDetachedEditingEnabled,R6=U.lorodoc_setRecordTimestamp,P6=U.lorodoc_setChangeMergeInterval,L6=U.lorodoc_configTextStyle,F6=U.lorodoc_configDefaultTextStyle,z6=U.lorodoc_fromSnapshot,B6=U.lorodoc_attach,U6=U.lorodoc_isDetached,V6=U.lorodoc_detach,$6=U.lorodoc_fork,H6=U.lorodoc_forkAt,W6=U.lorodoc_checkoutToLatest,q6=U.lorodoc_travelChangeAncestors,G6=U.lorodoc_findIdSpansBetween,Y6=U.lorodoc_checkout,J6=U.lorodoc_peerId,K6=U.lorodoc_peerIdStr,X6=U.lorodoc_setPeerId,Z6=U.lorodoc_commit,Q6=U.lorodoc_getPendingTxnLength,eI=U.lorodoc_getText,tI=U.lorodoc_getMap,nI=U.lorodoc_getList,oI=U.lorodoc_getMovableList,rI=U.lorodoc_getCounter,sI=U.lorodoc_getTree,iI=U.lorodoc_hasContainer,aI=U.lorodoc_getContainerById,lI=U.lorodoc_setNextCommitMessage,cI=U.lorodoc_setNextCommitOrigin,dI=U.lorodoc_setNextCommitTimestamp,uI=U.lorodoc_setNextCommitOptions,hI=U.lorodoc_clearNextCommitOptions,fI=U.lorodoc_getDeepValueWithID,pI=U.lorodoc_getPathToContainer,mI=U.lorodoc_JSONPath,gI=U.lorodoc_version,_I=U.lorodoc_shallowSinceVV,bI=U.lorodoc_isShallow,yI=U.lorodoc_shallowSinceFrontiers,xI=U.lorodoc_oplogVersion,wI=U.lorodoc_frontiers,vI=U.lorodoc_oplogFrontiers,kI=U.lorodoc_cmpWithFrontiers,SI=U.lorodoc_cmpFrontiers,CI=U.lorodoc_exportSnapshot,NI=U.lorodoc_exportFrom,jI=U.lorodoc_export,EI=U.lorodoc_exportJsonUpdates,II=U.lorodoc_exportJsonInIdSpan,AI=U.lorodoc_importJsonUpdates,TI=U.lorodoc_import,MI=U.lorodoc_importBatch,OI=U.lorodoc_getShallowValue,DI=U.lorodoc_toJSON,RI=U.lorodoc_subscribe,PI=U.lorodoc_subscribeLocalUpdates,LI=U.lorodoc_debugHistory,FI=U.lorodoc_changeCount,zI=U.lorodoc_opCount,BI=U.lorodoc_getAllChanges,UI=U.lorodoc_getChangeAt,VI=U.lorodoc_getChangeAtLamport,$I=U.lorodoc_getOpsInChange,HI=U.lorodoc_frontiersToVV,WI=U.lorodoc_vvToFrontiers,qI=U.lorodoc_getByPath,GI=U.lorodoc_getCursorPos,YI=U.lorodoc_getChangedContainersIn,JI=U.lorodoc_revertTo,KI=U.lorodoc_applyDiff,XI=U.lorodoc_diff,ZI=U.lorodoc_getUncommittedOpsAsJson,QI=U.lorodoc_subscribeFirstCommitFromPeer,e8=U.lorodoc_subscribePreCommit,t8=U.lorodoc_deleteRootContainer,n8=U.lorodoc_setHideEmptyRootContainers,o8=U.__wbg_lorotext_free,r8=U.lorotext_new,s8=U.lorotext_kind,i8=U.lorotext_iter,a8=U.lorotext_update,l8=U.lorotext_updateByLine,c8=U.lorotext_insert,d8=U.lorotext_slice,u8=U.lorotext_charAt,h8=U.lorotext_splice,f8=U.lorotext_insertUtf8,p8=U.lorotext_delete,m8=U.lorotext_deleteUtf8,g8=U.lorotext_mark,_8=U.lorotext_unmark,b8=U.lorotext_toString,y8=U.lorotext_toDelta,x8=U.lorotext_id,w8=U.lorotext_length,v8=U.lorotext_subscribe,k8=U.lorotext_applyDelta,S8=U.lorotext_parent,C8=U.lorotext_isAttached,N8=U.lorotext_getAttached,j8=U.lorotext_getCursor,E8=U.lorotext_push,I8=U.lorotext_getEditorOf,A8=U.lorotext_isDeleted,T8=U.lorotext_getShallowValue,M8=U.lorotext_toJSON,O8=U.__wbg_loromap_free,D8=U.loromap_new,R8=U.loromap_kind,P8=U.loromap_set,L8=U.loromap_delete,F8=U.loromap_get,z8=U.loromap_getOrCreateContainer,B8=U.loromap_keys,U8=U.loromap_values,V8=U.loromap_entries,$8=U.loromap_id,H8=U.loromap_toJSON,W8=U.loromap_setContainer,q8=U.loromap_subscribe,G8=U.loromap_size,Y8=U.loromap_parent,J8=U.loromap_isAttached,K8=U.loromap_getAttached,X8=U.loromap_clear,Z8=U.loromap_getLastEditor,Q8=U.loromap_isDeleted,eA=U.loromap_getShallowValue,tA=U.__wbg_lorolist_free,nA=U.lorolist_new,oA=U.lorolist_kind,rA=U.lorolist_insert,sA=U.lorolist_delete,iA=U.lorolist_get,aA=U.lorolist_id,lA=U.lorolist_toArray,cA=U.lorolist_toJSON,dA=U.lorolist_insertContainer,uA=U.lorolist_pushContainer,hA=U.lorolist_subscribe,fA=U.lorolist_length,pA=U.lorolist_parent,mA=U.lorolist_isAttached,gA=U.lorolist_getAttached,_A=U.lorolist_getCursor,bA=U.lorolist_push,yA=U.lorolist_pop,xA=U.lorolist_clear,wA=U.lorolist_getIdAt,vA=U.lorolist_isDeleted,kA=U.lorolist_getShallowValue,SA=U.loromovablelist_new,CA=U.loromovablelist_kind,NA=U.loromovablelist_insert,jA=U.loromovablelist_delete,EA=U.loromovablelist_get,IA=U.loromovablelist_id,AA=U.loromovablelist_toArray,TA=U.loromovablelist_toJSON,MA=U.loromovablelist_insertContainer,OA=U.loromovablelist_pushContainer,DA=U.loromovablelist_subscribe,RA=U.loromovablelist_length,PA=U.loromovablelist_parent,LA=U.loromovablelist_isAttached,FA=U.loromovablelist_getAttached,zA=U.loromovablelist_getCursor,BA=U.loromovablelist_move,UA=U.loromovablelist_set,VA=U.loromovablelist_setContainer,$A=U.loromovablelist_push,HA=U.loromovablelist_pop,WA=U.loromovablelist_clear,qA=U.loromovablelist_getCreatorAt,GA=U.loromovablelist_getLastMoverAt,YA=U.loromovablelist_getLastEditorAt,JA=U.loromovablelist_isDeleted,KA=U.loromovablelist_getShallowValue,XA=U.__wbg_lorotree_free,ZA=U.lorotreenode___getClassname,QA=U.__wbg_lorotreenode_free,eT=U.lorotreenode_id,tT=U.lorotreenode_createNode,nT=U.lorotreenode_move,oT=U.lorotreenode_moveAfter,rT=U.lorotreenode_moveBefore,sT=U.lorotreenode_index,iT=U.lorotreenode_fractionalIndex,aT=U.lorotreenode_data,lT=U.lorotreenode_toJSON,cT=U.lorotreenode_parent,dT=U.lorotreenode_children,uT=U.lorotreenode_isDeleted,hT=U.lorotreenode_getLastMoveId,fT=U.lorotreenode_creationId,pT=U.lorotreenode_creator,mT=U.lorotree_new,gT=U.lorotree_kind,_T=U.lorotree_createNode,bT=U.lorotree_move,yT=U.lorotree_delete,xT=U.lorotree_getNodeByID,wT=U.lorotree_id,vT=U.lorotree_has,kT=U.lorotree_isNodeDeleted,ST=U.lorotree_toArray,CT=U.lorotree_getNodes,NT=U.lorotree_toJSON,jT=U.lorotree_nodes,ET=U.lorotree_roots,IT=U.lorotree_subscribe,AT=U.lorotree_parent,TT=U.lorotree_isAttached,MT=U.lorotree_getAttached,OT=U.lorotree_enableFractionalIndex,DT=U.lorotree_disableFractionalIndex,RT=U.lorotree_isFractionalIndexEnabled,PT=U.lorotree_isDeleted,LT=U.lorotree_getShallowValue,FT=U.__wbg_cursor_free,zT=U.cursor_containerId,BT=U.cursor_pos,UT=U.cursor_side,VT=U.cursor_encode,$T=U.cursor_decode,HT=U.cursor_kind,WT=U.__wbg_undomanager_free,qT=U.undomanager_new,GT=U.undomanager_undo,YT=U.undomanager_redo,JT=U.undomanager_canUndo,KT=U.undomanager_canRedo,XT=U.undomanager_setMaxUndoSteps,ZT=U.undomanager_setMergeInterval,QT=U.undomanager_addExcludeOriginPrefix,e7=U.undomanager_setOnPush,t7=U.undomanager_setOnPop,n7=U.undomanager_clear,o7=U.__wbg_versionvector_free,r7=U.versionvector_new,s7=U.versionvector_parseJSON,i7=U.versionvector_toJSON,a7=U.versionvector_encode,l7=U.versionvector_decode,c7=U.versionvector_get,d7=U.versionvector_compare,u7=U.versionvector_setEnd,h7=U.versionvector_setLast,f7=U.versionvector_remove,p7=U.versionvector_length,m7=U.decodeImportBlobMeta,g7=U.__wbg_changemodifier_free,_7=U.changemodifier_setMessage,b7=U.changemodifier_setTimestamp,y7=U.lorodoc_importUpdateBatch,x7=U.__wbg_loromovablelist_free,w7=U.__wbindgen_export_0,v7=U.__wbindgen_export_1,k7=U.__wbindgen_export_2,S7=U.__wbindgen_export_3,C7=U.__wbindgen_export_4,N7=U.__wbindgen_add_to_stack_pointer,j7=U.__wbindgen_export_5,E7=U.__wbindgen_export_6,Mu=U.__wbindgen_start,lx=Object.freeze(Object.defineProperty({__proto__:null,LORO_VERSION:N6,__wbg_awarenesswasm_free:Z5,__wbg_changemodifier_free:g7,__wbg_cursor_free:FT,__wbg_ephemeralstorewasm_free:h6,__wbg_lorocounter_free:B5,__wbg_lorodoc_free:T6,__wbg_lorolist_free:tA,__wbg_loromap_free:O8,__wbg_loromovablelist_free:x7,__wbg_lorotext_free:o8,__wbg_lorotree_free:XA,__wbg_lorotreenode_free:QA,__wbg_undomanager_free:WT,__wbg_versionvector_free:o7,__wbindgen_add_to_stack_pointer:N7,__wbindgen_export_0:w7,__wbindgen_export_1:v7,__wbindgen_export_2:k7,__wbindgen_export_3:S7,__wbindgen_export_4:C7,__wbindgen_export_5:j7,__wbindgen_export_6:E7,__wbindgen_start:Mu,awarenesswasm_apply:n6,awarenesswasm_encode:e6,awarenesswasm_encodeAll:t6,awarenesswasm_getAllStates:s6,awarenesswasm_getState:i6,awarenesswasm_getTimestamp:a6,awarenesswasm_isEmpty:d6,awarenesswasm_length:c6,awarenesswasm_new:Q5,awarenesswasm_peer:r6,awarenesswasm_peers:u6,awarenesswasm_removeOutdated:l6,awarenesswasm_setLocalState:o6,changemodifier_setMessage:_7,changemodifier_setTimestamp:b7,cursor_containerId:zT,cursor_decode:$T,cursor_encode:VT,cursor_kind:HT,cursor_pos:BT,cursor_side:UT,decodeFrontiers:I6,decodeImportBlobMeta:m7,encodeFrontiers:E6,ephemeralstorewasm_apply:v6,ephemeralstorewasm_delete:m6,ephemeralstorewasm_encode:x6,ephemeralstorewasm_encodeAll:w6,ephemeralstorewasm_get:g6,ephemeralstorewasm_getAllStates:_6,ephemeralstorewasm_isEmpty:S6,ephemeralstorewasm_keys:C6,ephemeralstorewasm_new:f6,ephemeralstorewasm_removeOutdated:k6,ephemeralstorewasm_set:p6,ephemeralstorewasm_subscribe:y6,ephemeralstorewasm_subscribeLocalUpdates:b6,lorocounter_decrement:W5,lorocounter_getAttached:K5,lorocounter_getShallowValue:X5,lorocounter_id:$5,lorocounter_increment:H5,lorocounter_isAttached:J5,lorocounter_kind:V5,lorocounter_new:U5,lorocounter_parent:Y5,lorocounter_subscribe:G5,lorocounter_value:q5,lorodoc_JSONPath:mI,lorodoc_applyDiff:KI,lorodoc_attach:B6,lorodoc_changeCount:FI,lorodoc_checkout:Y6,lorodoc_checkoutToLatest:W6,lorodoc_clearNextCommitOptions:hI,lorodoc_cmpFrontiers:SI,lorodoc_cmpWithFrontiers:kI,lorodoc_commit:Z6,lorodoc_configDefaultTextStyle:F6,lorodoc_configTextStyle:L6,lorodoc_debugHistory:LI,lorodoc_deleteRootContainer:t8,lorodoc_detach:V6,lorodoc_diff:XI,lorodoc_export:jI,lorodoc_exportFrom:NI,lorodoc_exportJsonInIdSpan:II,lorodoc_exportJsonUpdates:EI,lorodoc_exportSnapshot:CI,lorodoc_findIdSpansBetween:G6,lorodoc_fork:$6,lorodoc_forkAt:H6,lorodoc_fromSnapshot:z6,lorodoc_frontiers:wI,lorodoc_frontiersToVV:HI,lorodoc_getAllChanges:BI,lorodoc_getByPath:qI,lorodoc_getChangeAt:UI,lorodoc_getChangeAtLamport:VI,lorodoc_getChangedContainersIn:YI,lorodoc_getContainerById:aI,lorodoc_getCounter:rI,lorodoc_getCursorPos:GI,lorodoc_getDeepValueWithID:fI,lorodoc_getList:nI,lorodoc_getMap:tI,lorodoc_getMovableList:oI,lorodoc_getOpsInChange:$I,lorodoc_getPathToContainer:pI,lorodoc_getPendingTxnLength:Q6,lorodoc_getShallowValue:OI,lorodoc_getText:eI,lorodoc_getTree:sI,lorodoc_getUncommittedOpsAsJson:ZI,lorodoc_hasContainer:iI,lorodoc_import:TI,lorodoc_importBatch:MI,lorodoc_importJsonUpdates:AI,lorodoc_importUpdateBatch:y7,lorodoc_isDetached:U6,lorodoc_isDetachedEditingEnabled:D6,lorodoc_isShallow:bI,lorodoc_new:M6,lorodoc_opCount:zI,lorodoc_oplogFrontiers:vI,lorodoc_oplogVersion:xI,lorodoc_peerId:J6,lorodoc_peerIdStr:K6,lorodoc_revertTo:JI,lorodoc_setChangeMergeInterval:P6,lorodoc_setDetachedEditing:O6,lorodoc_setHideEmptyRootContainers:n8,lorodoc_setNextCommitMessage:lI,lorodoc_setNextCommitOptions:uI,lorodoc_setNextCommitOrigin:cI,lorodoc_setNextCommitTimestamp:dI,lorodoc_setPeerId:X6,lorodoc_setRecordTimestamp:R6,lorodoc_shallowSinceFrontiers:yI,lorodoc_shallowSinceVV:_I,lorodoc_subscribe:RI,lorodoc_subscribeFirstCommitFromPeer:QI,lorodoc_subscribeLocalUpdates:PI,lorodoc_subscribePreCommit:e8,lorodoc_toJSON:DI,lorodoc_travelChangeAncestors:q6,lorodoc_version:gI,lorodoc_vvToFrontiers:WI,lorolist_clear:xA,lorolist_delete:sA,lorolist_get:iA,lorolist_getAttached:gA,lorolist_getCursor:_A,lorolist_getIdAt:wA,lorolist_getShallowValue:kA,lorolist_id:aA,lorolist_insert:rA,lorolist_insertContainer:dA,lorolist_isAttached:mA,lorolist_isDeleted:vA,lorolist_kind:oA,lorolist_length:fA,lorolist_new:nA,lorolist_parent:pA,lorolist_pop:yA,lorolist_push:bA,lorolist_pushContainer:uA,lorolist_subscribe:hA,lorolist_toArray:lA,lorolist_toJSON:cA,loromap_clear:X8,loromap_delete:L8,loromap_entries:V8,loromap_get:F8,loromap_getAttached:K8,loromap_getLastEditor:Z8,loromap_getOrCreateContainer:z8,loromap_getShallowValue:eA,loromap_id:$8,loromap_isAttached:J8,loromap_isDeleted:Q8,loromap_keys:B8,loromap_kind:R8,loromap_new:D8,loromap_parent:Y8,loromap_set:P8,loromap_setContainer:W8,loromap_size:G8,loromap_subscribe:q8,loromap_toJSON:H8,loromap_values:U8,loromovablelist_clear:WA,loromovablelist_delete:jA,loromovablelist_get:EA,loromovablelist_getAttached:FA,loromovablelist_getCreatorAt:qA,loromovablelist_getCursor:zA,loromovablelist_getLastEditorAt:YA,loromovablelist_getLastMoverAt:GA,loromovablelist_getShallowValue:KA,loromovablelist_id:IA,loromovablelist_insert:NA,loromovablelist_insertContainer:MA,loromovablelist_isAttached:LA,loromovablelist_isDeleted:JA,loromovablelist_kind:CA,loromovablelist_length:RA,loromovablelist_move:BA,loromovablelist_new:SA,loromovablelist_parent:PA,loromovablelist_pop:HA,loromovablelist_push:$A,loromovablelist_pushContainer:OA,loromovablelist_set:UA,loromovablelist_setContainer:VA,loromovablelist_subscribe:DA,loromovablelist_toArray:AA,loromovablelist_toJSON:TA,lorotext_applyDelta:k8,lorotext_charAt:u8,lorotext_delete:p8,lorotext_deleteUtf8:m8,lorotext_getAttached:N8,lorotext_getCursor:j8,lorotext_getEditorOf:I8,lorotext_getShallowValue:T8,lorotext_id:x8,lorotext_insert:c8,lorotext_insertUtf8:f8,lorotext_isAttached:C8,lorotext_isDeleted:A8,lorotext_iter:i8,lorotext_kind:s8,lorotext_length:w8,lorotext_mark:g8,lorotext_new:r8,lorotext_parent:S8,lorotext_push:E8,lorotext_slice:d8,lorotext_splice:h8,lorotext_subscribe:v8,lorotext_toDelta:y8,lorotext_toJSON:M8,lorotext_toString:b8,lorotext_unmark:_8,lorotext_update:a8,lorotext_updateByLine:l8,lorotree_createNode:_T,lorotree_delete:yT,lorotree_disableFractionalIndex:DT,lorotree_enableFractionalIndex:OT,lorotree_getAttached:MT,lorotree_getNodeByID:xT,lorotree_getNodes:CT,lorotree_getShallowValue:LT,lorotree_has:vT,lorotree_id:wT,lorotree_isAttached:TT,lorotree_isDeleted:PT,lorotree_isFractionalIndexEnabled:RT,lorotree_isNodeDeleted:kT,lorotree_kind:gT,lorotree_move:bT,lorotree_new:mT,lorotree_nodes:jT,lorotree_parent:AT,lorotree_roots:ET,lorotree_subscribe:IT,lorotree_toArray:ST,lorotree_toJSON:NT,lorotreenode___getClassname:ZA,lorotreenode_children:dT,lorotreenode_createNode:tT,lorotreenode_creationId:fT,lorotreenode_creator:pT,lorotreenode_data:aT,lorotreenode_fractionalIndex:iT,lorotreenode_getLastMoveId:hT,lorotreenode_id:eT,lorotreenode_index:sT,lorotreenode_isDeleted:uT,lorotreenode_move:nT,lorotreenode_moveAfter:oT,lorotreenode_moveBefore:rT,lorotreenode_parent:cT,lorotreenode_toJSON:lT,memory:z5,run:j6,setDebug:A6,undomanager_addExcludeOriginPrefix:QT,undomanager_canRedo:KT,undomanager_canUndo:JT,undomanager_clear:n7,undomanager_new:qT,undomanager_redo:YT,undomanager_setMaxUndoSteps:XT,undomanager_setMergeInterval:ZT,undomanager_setOnPop:t7,undomanager_setOnPush:e7,undomanager_undo:GT,versionvector_compare:d7,versionvector_decode:l7,versionvector_encode:a7,versionvector_get:c7,versionvector_length:p7,versionvector_new:r7,versionvector_parseJSON:s7,versionvector_remove:f7,versionvector_setEnd:u7,versionvector_setLast:h7,versionvector_toJSON:i7},Symbol.toStringTag,{value:"Module"}));if(Mu)vu(lx),Mu();else{const t=await Op(()=>Promise.resolve().then(()=>lx),void 0,import.meta.url);vu(new WebAssembly.Instance(t.default,{"./loro_wasm_bg.js":F5}).exports)}const I7=["Map","Text","List","Tree","MovableList","Counter"];function cx(t){if(typeof t!="object"||t==null)return!1;const e=Object.getPrototypeOf(t);return e!=null&&typeof e=="object"&&typeof e.kind=="function"&&I7.includes(t.kind())}yo.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 u=c.getShallowValue();return typeof u=="object"?r(u):u}if(cx(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(cx(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 A7=(t,e,n)=>Zn.define(o=>new T7(o,t,e,n)),ns=wp.define();class T7{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 u of d)u.insert?i.push({from:a,to:a,insert:u.insert}):u.delete?(i.push({from:a,to:a+u.delete}),a+=u.delete):u.retain!=null&&(a+=u.retain);i.length>0&&this.view.dispatch({changes:i,annotations:[ns.of(this)]})}}}else this.view.dispatch({changes:[{from:0,to:this.view.state.doc.length,insert:this.getTextFromDoc(this.doc).toString()}],annotations:[ns.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(ns)===this||e.transactions[0].annotation(ns)==="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 M7=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"}}),Mi=Ut.define(),Ou=En.define({create:()=>({remoteCursors:new Map,isCheckout:!1}),update(t,e){for(const n of e.effects)if(n.is(Mi))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}}),dx=t=>{const e=t.transactions.flatMap(n=>n.effects).filter(n=>n.is(Mi));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===uU.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 O7=(t,e,n,o)=>{const r=[],{updated:s,added:i}=n;for(const a of[...s,...i]){const l=ux(t,e,a,o);l&&r.push(l)}return r},ux=(t,e,n,o)=>{const r=e.getAllStates()[n];if(!r||n===t.peerIdStr||r.scopeId!==o)return;if(r.type==="delete")return Mi.of({type:"delete",peer:r.uid,scopeId:r.scopeId});const s=Gn.decode(r.cursor.anchor),i=t.getCursorPos(s).offset;let a=i;if(r.cursor.head){const l=Gn.decode(r.cursor.head);a=t.getCursorPos(l).offset}return Mi.of({type:"update",peer:r.uid,scopeId:r.scopeId,cursor:{anchor:i,head:a},user:r.user})};class D7{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 u=ux(this.doc,this.awareness,d,this.scopeId);u&&c.push(u)}this.view.dispatch({effects:c})}else l.by==="checkout"&&this.view.dispatch({effects:[Mi.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=P7(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 R7{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:O7(this.doc,this.awareness,i,this.scopeId)})};this._awarenessListener=s,this.awareness.addListener(s)}destroy(){this._awarenessListener&&this.awareness.removeListener(this._awarenessListener)}}const P7=(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)]"],dn=Xt.get("rtc"),hx=dn.get("awareness").disabled(),Du="awareness:",os=Zt(void 0),Ht=new yo,Cl=new class{constructor(t,e=3e4){this.listeners=new Set,this.inner=new tb(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))}}(Ht.peerIdStr),Ru=fU(()=>{dn.debug("creating websocket");const t=pU(k4()).replace("/ws","/ws_sync"),e=new N$(t,void 0,{maxRetries:10,debug:!1,startClosed:!0,connectionTimeout:1e4});return Promise.resolve().then(async()=>{await mU(),gU()==="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,Du)){const i=function(a,l){return a.slice(l.length)}(s,Du);return Cl.apply(i),void hx.debug("applied awareness update")}Ht.import(s),dn.debug("imported doc change. new doc:",Ht.toJSON()),ut.get(os)!==Ht&&ut.set(os,Ht)}),e.addEventListener("open",()=>{dn.debug("websocket open")}),e.addEventListener("close",n=>{dn.warn("websocket close",n),ut.get(os)===Ht&&ut.set(os,void 0)}),e});function Pu(t,e,n=""){if(Bn())return{extension:[],code:n};const o=Ht.getByPath(`codes/${t}`)!==void 0,r=Ht.getMap("codes").getOrCreateContainer(t,new Xo);o||(dn.log("initializing code for new cell",n),r.insert(0,n));const s={get name(){return ut.get(S4)||"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:[L7(t),F7(t),z7(Ht,Cl,s,()=>r,t),A7(Ht,["codes",t],()=>r)]}}function L7(t){const e=(o,r)=>{const s=o.state.field(Cc).type,i=r.toString();i&&i!==s&&(dn.debug(`[incoming] setting language type: ${s} -> ${i}`),Or(o,i,{keepCodeAsIs:!0}))},n=(o,r)=>{const s=o.state.field(Rp),i=r.toJSON();ra(s,i)||o.dispatch({effects:[w4.of(i)],annotations:[ns.of(!0)]})};return Zn.define(o=>{let r;return Promise.resolve().then(()=>{const s=Ht.getByPath(`languages/${t}`);if(!s)return void dn.error("no language container found for cell",t);Bo(s instanceof Xo,"language type is not a LoroText");const i=Ht.getByPath(`language_metadata/${t}`);i?(Bo(i instanceof Ko,"language metadata is not a LoroMap"),e(o,s),n(o,i),r=Ht.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)})):dn.error("no language metadata container found for cell",t)}),{destroy(){r()}}})}function F7(t){const e=Ht.getMap("languages").getOrCreateContainer(t,new Xo),n=Ht.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=Dp(o.state).type;Or(o.view,i),dn.debug("no initial language, setting default to",i),e.delete(0,e.length),e.insert(0,i),dn.debug("no initial language metadata, setting default to",o.state.field(Rp));const a=o.state.field(Rp);for(const l of Object.keys(a))n.set(l,a[l]);return void Ht.commit()}let s=!1;for(const i of o.transactions)if(!i.annotation(ns)){for(const a of i.effects)if(a.is(hU)&&e.toString()!==a.value.type&&(dn.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(v4)){const l=a.value;a.is(v4)?(dn.debug("[outgoing] setting language metadata: ",l),n.clear()):dn.debug("[outgoing] updating language metadata: ",l);for(const c of Object.keys(l))n.set(c,l[c]);s=!0}}s&&Ht.commit()})}function z7(t,e,n,o,r,s){const i=`loro:cell:${r}`;return[Ou,x4({above:!0,class:"loro-cursor-layer",update:dx,markers:a=>{const{remoteCursors:l,isCheckout:c}=a.state.field(Ou);return c?[]:[...l.values()].flatMap(d=>{var f,p;const u=Uo.cursor(d.cursor.anchor);return kl.createCursor(a,u,((f=d.user)==null?void 0:f.name)||"unknown",((p=d.user)==null?void 0:p.colorClassName)||"")})}}),x4({above:!1,class:"loro-selection-layer",update:dx,markers:a=>{const{remoteCursors:l,isCheckout:c}=a.state.field(Ou);return c?[]:[...l.entries()].filter(([,d])=>d.cursor.head!==void 0&&d.cursor.anchor!==d.cursor.head).flatMap(([,d])=>{var f;const u=Uo.range(d.cursor.anchor,d.cursor.head);return dU.forRange(a,`loro-selection ${((f=d.user)==null?void 0:f.colorClassName)||""}`,u)})}}),Zn.define(a=>new D7(a,t,n,e,o,i,s)),Zn.define(a=>new R7(a,t,e,i)),M7]}ga()&&Ru(),Ht.subscribeLocalUpdates(t=>{dn.debug("local update, sending to server"),Ru().send(t)}),Cl.addListener((t,e)=>{const n=[...t.added,...t.removed,...t.updated];e==="local"&&(hx.debug("awareness changes",n),Ru().send(function(o,r){const s=new TextEncoder().encode(o);return new Uint8Array([...s,...r])}(Du,Cl.encode(n))))});const fx=({theme:t,showPlaceholder:e,allowFocus:n,id:o,config:r,code:s,status:i,serializedEditorState:a,setEditorView:l,runCell:c,userConfig:d,editorViewRef:u,editorViewParentRef:f,hidden:p,hasOutput:_,temporarilyShowCode:g,languageAdapter:m,setLanguageAdapter:b,showLanguageToggles:x=!0})=>{var re;const[y,v]=fn(Aa),k=_U(),S=id(),{saveOrNameNotebook:E}=Lg(),j=i==="running"||i==="queued",I=Lt(),T=Qm(),M=m==="markdown",L=Qe(()=>!j&&(S({cellId:o}),!0)),B=Qe(()=>!j&&(c(),!0)),O=Qe(()=>{const ne=!r.hide_code;return Dr({configs:{[o]:{hide_code:ne}}}),I.updateCellConfig({cellId:o,config:{hide_code:ne}}),ne}),z=He(Ts),F=Qe(()=>{ar(z,I.createNewCell)}),V=bU(d),P=A.useMemo(()=>{const ne=rE({cellId:o,showPlaceholder:e,enableAI:V,cellActions:{...I,afterToggleMarkdown:F,onRun:B,deleteCell:L,saveNotebook:E,createManyBelow:oe=>{for(const Y of[...oe].reverse())I.createNewCell({code:Y,before:!1,cellId:o,skipIfCodeExists:!0})},splitCell:T,toggleHideCode:O,aiCellCompletion:()=>{let oe=!1;return v(Y=>(Y==null?void 0:Y.cellId)===o?(oe=!0,null):{cellId:o}),oe}},completionConfig:d.completion,keymapConfig:d.keymap,lspConfig:d.language_servers,theme:t,hotkeys:new C4(d.keymap.overrides??{}),diagnosticsConfig:d.diagnostics});return ne.push(Zn.define(oe=>{const Y=oe.state.field(Cc);return b(Y.type),{update(Q){const ce=Q.state.field(Cc);b(ce.type)}}}),st.updateListener.of(oe=>{oe.selectionSet&&oe.state.selection.ranges.some(Y=>Y.from!==Y.to)&&g({focus:!1})})),ne},[o,d.keymap,d.completion,d.language_servers,d.diagnostics,V,t,e,I,T,O,L,B,v,F,b,g,E]),C=ga(),$=Qe(()=>{if(C){const oe=Pu(o,0,s);P.push(oe.extension),s=oe.code}const ne=new st({state:ca.create({doc:s,extensions:P})});l(ne),C||Or(ne,Dp(ne.state).type)}),N=Qe(()=>{if(Bo(u.current!==null,"Editor view is not initialized"),C){const ne=Pu(o);P.push(ne.extension)}u.current.dispatch({effects:[Ut.reconfigure.of([P]),yU(u.current,d.completion,new C4(d.keymap.overrides??{}),{...d.language_servers,diagnostics:d.diagnostics})]})}),H=Qe(()=>{if(Bo(a,"Editor view is not initialized"),C){const oe=Pu(o,0,s);P.push(oe.extension),s=oe.code}const ne=new st({state:ca.fromJSON(a,{doc:s,extensions:P},{history:xU})});C||Or(ne,Dp(ne.state).type),l(ne),I.clearSerializedEditorState({cellId:o})});A.useEffect(()=>{a===null?u.current===null?$():N():H(),u.current!==null&&f&&f.current!==null&&f.current.replaceChildren(u.current.dom)},[$,N,H,u,f,a,P]);const G=(u.current===null||a!==null)&&!ga();A.useEffect(()=>{const ne=ut.get(yp).scrollKey!==null;G&&n&&!ne&&requestAnimationFrame(()=>{var oe,Y;(oe=u.current)==null||oe.focus(),(Y=u.current)==null||Y.dom.scrollIntoView({behavior:"smooth",block:"nearest"})})},[G,n,u]),A.useEffect(()=>{const ne=u.current;return()=>{ne==null||ne.destroy()}},[u]);const Z=p&&!M||p&&M&&!_;let q="";return M&&p&&_?q="h-0 overflow-hidden":p&&(q="opacity-20 h-8 overflow-hidden"),h.jsx(M5,{enabled:(y==null?void 0:y.cellId)===o,initialPrompt:y==null?void 0:y.initialPrompt,currentCode:((re=u.current)==null?void 0:re.state.doc.toString())??s,currentLanguageAdapter:m,declineChange:Qe(()=>{var ne;v(null),(ne=u.current)==null||ne.focus()}),onChange:Qe(ne=>{var oe;(oe=u.current)==null||oe.dispatch({changes:{from:0,to:u.current.state.doc.length,insert:ne}})}),acceptChange:Qe(ne=>{var oe,Y;(oe=u.current)==null||oe.dispatch({changes:{from:0,to:u.current.state.doc.length,insert:ne}}),(Y=u.current)==null||Y.focus(),v(null)}),children:h.jsxs("div",{className:"relative w-full",onFocus:()=>k(o),children:[Z&&h.jsx(N4,{tooltip:"Edit code",className:"absolute inset-0 z-10",onClick:g}),h.jsx(px,{className:q,editorView:u.current,ref:f}),!p&&x&&h.jsx("div",{className:"absolute top-1 right-5",children:h.jsx(d5,{code:s,editorView:u.current,currentLanguageAdapter:m,onAfterToggle:F})})]})})},px=K.forwardRef((t,e)=>{const n=X.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=Oe("cm mathjax_ignore",o),n[3]=o,n[4]=l):l=n[4],n[5]!==e?(c=u=>{e?ml(e,s)(u):ml(s)(u)},n[5]=e,n[6]=c):c=n[6],n[7]!==l||n[8]!==c?(d=h.jsx("div",{className:l,ref:c,"data-testid":"cell-editor"}),n[7]=l,n[8]=c,n[9]=d):d=n[9],d});px.displayName="CellCodeMirrorEditor";const Lu=ga()?function(t){const e=n=>{const o=X.c(5),r=He(mo),[s,i]=fn(os);if(r.state===en.CONNECTING||s===void 0){let l,c;return o[0]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx("span",{children:"Waiting for real-time collaboration connection..."}),o[0]=l):l=o[0],o[1]!==i?(c=h.jsx("div",{className:"flex h-full w-full items-baseline p-4",children:h.jsxs(j4,{milliseconds:1e3,fallback:null,children:[l,h.jsx(Pe,{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=h.jsx(t,{...n}),o[3]=n,o[4]=a):a=o[4],a};return e.displayName=`WithWaitUntilConnected(${t.displayName})`,e}(A.memo(fx)):A.memo(fx),B7=t=>{const e=X.c(10);let n,o,r,s;return e[0]!==t.left?(n=h.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=h.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=h.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=h.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},U7=t=>{const e=X.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=h.jsx("span",{children:h.jsx(V7,{isCollapsed:t.isCollapsed})}),e[0]=t.isCollapsed,e[1]=o):o=e[1],e[2]!==n||e[3]!==o?(r=h.jsx(Re,{content:n,children:o}),e[2]=n,e[3]=o,e[4]=r):r=e[4],e[5]!==t.onClick||e[6]!==r?(s=h.jsx(Pe,{variant:"text",size:"icon",onClick:t.onClick,children:r}),e[5]=t.onClick,e[6]=r,e[7]=s):s=e[7],s},V7=t=>{const e=X.c(2),{isCollapsed:n}=t;let o;return e[0]!==n?(o=n?h.jsx(lc,{className:"w-5 h-5 flex-shrink-0"}):h.jsx(Zi,{className:"w-5 h-5 flex-shrink-0"}),e[0]=n,e[1]=o):o=e[1],o},mx=A.memo(t=>{const e=X.c(24),{onClick:n,count:o,cellId:r}=t,s=vc();let i;e[0]!==r||e[1]!==s?(i=wU(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=Oe("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=h.jsx(vU,{className:"w-4 h-4 flex-shrink-0"}),e[4]=c):c=e[4];const d=o===1?"cell":"cells";let u,f,p,_,g,m,b;return e[5]!==o||e[6]!==d?(u=h.jsxs(h.Fragment,{children:[c,h.jsxs("span",{className:"text-sm text-gray-500",children:[o," ",d," collapsed"]})]}),e[5]=o,e[6]=d,e[7]=u):u=e[7],e[8]!==a.errored?(f=a.errored&&h.jsx(Re,{content:"Has errors",delayDuration:100,children:h.jsx(Im,{className:"w-4 h-4 flex-shrink-0 text-destructive"})}),e[8]=a.errored,e[9]=f):f=e[9],e[10]!==a.stale?(p=a.stale&&h.jsx(Re,{content:"Has stale cells",delayDuration:100,children:h.jsx(E4,{className:"w-4 h-4 flex-shrink-0 text-[var(--yellow-11)]"})}),e[10]=a.stale,e[11]=p):p=e[11],e[12]!==a.runningOrQueued?(_=a.runningOrQueued&&h.jsx(Re,{content:"Running",delayDuration:100,children:h.jsx(Mp,{className:"w-4 h-4 flex-shrink-0 animate-spin"})}),e[12]=a.runningOrQueued,e[13]=_):_=e[13],e[14]!==f||e[15]!==p||e[16]!==_?(g=h.jsxs(h.Fragment,{children:[f,p,_]}),e[14]=f,e[15]=p,e[16]=_,e[17]=g):g=e[17],e[18]!==u||e[19]!==g?(m=h.jsx(B7,{center:u,right:g}),e[18]=u,e[19]=g,e[20]=m):m=e[20],e[21]!==n||e[22]!==m?(b=h.jsx("div",{onClick:n,className:l,children:m}),e[21]=n,e[22]=m,e[23]=b):b=e[23],b});mx.displayName="CollapsedCellBanner";const $7=t=>{const e=X.c(6),{appClosed:n,status:o}=t,r=Dg(o==="running");let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=pn("global.interrupt"),e[0]=s):s=e[0];const i=n||!r,a=r?Pp:jn.NOOP,l=r?"stale":"disabled";let c,d;return e[1]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(Zf,{strokeWidth:1.5}),e[1]=c):c=e[1],e[2]!==i||e[3]!==a||e[4]!==l?(d=h.jsx(xi,{tooltip:s,disabled:i,onClick:a,variant:l,"data-testid":"run-button",children:c}),e[2]=i,e[3]=a,e[4]=l,e[5]=d):d=e[5],d},H7={width:void 0,height:void 0};function gx(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 _x(t,e){const n=X.c(9);let o;n[0]!==t.current||n[1]!==e?(o=l=>{t.current===null||t.current.contains(l.relatedTarget)||e.current===null||np(e.current)},n[0]=t.current,n[1]=e,n[2]=o):o=n[2];const r=Qe(o);let s;n[3]!==t.current||n[4]!==e?(s=l=>{if(t.current===document.activeElement&&e.current!==null&&sa(e.current.state)==="active"){for(const c of c4)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=Qe(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 bx(t,e,n,o,r,s,i,a,l){const c=X.c(51);let d,u,f,p,_,g,m,b,x,y,v,k,S,E,j,I;c[0]!==o||c[1]!==e||c[2]!==n?(d=()=>{n(),o.moveToNextCell({cellId:e,before:!1})},u=()=>{n(),o.moveToNextCell({cellId:e,before:!0})},c[0]=o,c[1]=e,c[2]=n,c[3]=d,c[4]=u):(d=c[3],u=c[4]),c[5]!==o||c[6]!==e?(f=()=>o.createNewCell({cellId:e,before:!0}),p=()=>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]=p,c[9]=_,c[10]=g):(f=c[7],p=c[8],_=c[9],g=c[10]),c[11]!==o||c[12]!==r||c[13]!==e?(m=()=>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]=m,c[15]=b):(m=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?(x=()=>{var M,L,B;const T=!s.hide_code;Dr({configs:{[e]:{hide_code:T}}}),o.updateCellConfig({cellId:e,config:{hide_code:T}}),T?((M=i.current)==null||M.contentDOM.blur(),(L=t==null?void 0:t.current)==null||L.focus()):(B=i.current)==null||B.focus()},c[16]=o,c[17]=s,c[18]=e,c[19]=t==null?void 0:t.current,c[20]=i,c[21]=x):x=c[21],c[22]!==o||c[23]!==e?(S=()=>o.moveToNextCell({cellId:e,before:!1,noCreate:!0}),y=()=>o.moveToNextCell({cellId:e,before:!0,noCreate:!0}),v=()=>o.sendToBottom({cellId:e}),k=()=>o.sendToTop({cellId:e}),c[22]=o,c[23]=e,c[24]=y,c[25]=v,c[26]=k,c[27]=S):(y=c[24],v=c[25],k=c[26],S=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&&K_(i).focus()},c[28]=e,c[29]=i,c[30]=a,c[31]=E):E=c[31],c[32]!==l?(j=()=>{var T;(T=l.current)==null||T.toggle()},c[32]=l,c[33]=j):j=c[33],c[34]!==n||c[35]!==d||c[36]!==u||c[37]!==y||c[38]!==v||c[39]!==k||c[40]!==E||c[41]!==j||c[42]!==f||c[43]!==p||c[44]!==_||c[45]!==g||c[46]!==m||c[47]!==b||c[48]!==x||c[49]!==S?(I={"cell.run":n,"cell.runAndNewBelow":d,"cell.runAndNewAbove":u,"cell.createAbove":f,"cell.createBelow":p,"cell.moveUp":_,"cell.moveDown":g,"cell.moveLeft":m,"cell.moveRight":b,"cell.hideCode":x,"cell.focusDown":S,"cell.focusUp":y,"cell.sendToBottom":v,"cell.sendToTop":k,"cell.aiCompletion":E,"cell.cellActions":j},c[34]=n,c[35]=d,c[36]=u,c[37]=y,c[38]=v,c[39]=k,c[40]=E,c[41]=j,c[42]=f,c[43]=p,c[44]=_,c[45]=g,c[46]=m,c[47]=b,c[48]=x,c[49]=S,c[50]=I):I=c[50],CU(t,I)}function yx(t,e,n,o,r,s){const i=X.c(16);let a,l,c,d,u;i[0]!==n||i[1]!==e?(a=f=>(!f||!Vn.fromInput(f))&&(n.moveToNextCell({cellId:e,before:!1,noCreate:!0}),!0),l=f=>(!f||!Vn.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||!Vn.fromInput(f))&&(n.moveToNextCell({cellId:e,before:!1,noCreate:!0}),!0),k:f=>(!f||!Vn.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?(u={ArrowDown:a,ArrowUp:l,Enter:c,...d},i[11]=a,i[12]=l,i[13]=c,i[14]=d,i[15]=u):u=i[15],NU(t,u)}const xx=A.forwardRef((t,e)=>{const n=X.c(14),{id:o,output:r,interrupted:s,errored:i,stopped:a,name:l,outputStale:c,outputLoading:d}=t;let u;n[0]===Symbol.for("react.memo_cache_sentinel")?(u=Lp("marimo-cell","hover-actions-parent z-10",{published:!0}),n[0]=u):u=n[0];const f=u;let p;n[1]!==o?(p=Fs.create(o),n[1]=o,n[2]=p):p=n[2];const _=p,g=T4(r==null?void 0:r.mimetype);if(i||s||a||g)return null;let m,b;return n[3]!==o||n[4]!==r||n[5]!==d||n[6]!==c?(m=h.jsx(Rc,{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]=m):m=n[7],n[8]!==_||n[9]!==o||n[10]!==l||n[11]!==e||n[12]!==m?(b=h.jsx("div",{tabIndex:-1,id:_,ref:e,className:f,"data-cell-id":o,"data-cell-name":l,children:m}),n[8]=_,n[9]=o,n[10]=l,n[11]=e,n[12]=m,n[13]=b):b=n[13],b});xx.displayName="ReadonlyCellComponent";const W7=({theme:t,showPlaceholder:e,allowFocus:n,id:o,code:r,output:s,consoleOutputs:i,status:a,runStartTimestamp:l,lastRunStartTimestamp:c,runElapsedTimeMs:d,edited:u,interrupted:f,errored:p,stopped:_,staleInputs:g,serializedEditorState:m,serialization:b,debuggerActive:x,appClosed:y,canDelete:v,actions:k,deleteCell:S,userConfig:E,outline:j,isCollapsed:I,collapseCount:T,config:M,canMoveX:L,name:B,editorView:O,setEditorView:z,outputStale:F})=>{const V=A.useRef(null),P=A.useRef(null),C=A.useRef(null),$=A.useRef(null),N=Qt(Aa),H=nd(o),[G,Z]=A.useState(),q=M.disabled||a==="disabled-transitively",re=M4({executionTime:d,status:a,errored:p,interrupted:f,stopped:_}),ne=u||f||g&&!q,oe=I4(a),Y=(a==="queued"||u||g)&&!f,Q=A.useCallback(()=>O.current,[O]),{closeCompletionHandler:ce,resumeCompletionHandler:he}=_x(V,O),{isCellCodeShown:de,isMarkdown:me,isMarkdownCodeHidden:ie,temporarilyShowCode:Ce,showHiddenMarkdownCode:we}=function(pe,_e,ue,je){const ke=X.c(13),[Ve,Ze]=A.useState(!1),le=!pe.hide_code||Ve,Ee=_e==="markdown",Ie=Ee&&!le;let Ue;ke[0]!==ue||ke[1]!==je||ke[2]!==le?(Ue=Je=>{var Mt,xt;if(le)return;const rt=(Je==null?void 0:Je.focus)??!0;Ze(!0),rt&&((Mt=ue.current)==null||Mt.focus());const mt=(xt=je.current)==null?void 0:xt.parentElement;if(!mt)return void Xt.error("Cell: No parent element found for editor view");const yt=()=>{requestAnimationFrame(()=>{var Bt;mt.contains(document.activeElement)||(Ze(!1),(Bt=ue.current)==null||Bt.dom.blur(),mt.removeEventListener("focusout",yt))})};mt.addEventListener("focusout",yt)},ke[0]=ue,ke[1]=je,ke[2]=le,ke[3]=Ue):Ue=ke[3];const We=Qe(Ue);let De;ke[4]!==Ie||ke[5]!==We?(De=()=>{Ie&&We({focus:!0})},ke[4]=Ie,ke[5]=We,ke[6]=De):De=ke[6];const Ge=Qe(De);let ot;return ke[7]!==le||ke[8]!==Ee||ke[9]!==Ie||ke[10]!==Ge||ke[11]!==We?(ot={isCellCodeShown:le,isMarkdown:Ee,isMarkdownCodeHidden:Ie,temporarilyShowCode:We,showHiddenMarkdownCode:Ge},ke[7]=le,ke[8]=Ee,ke[9]=Ie,ke[10]=Ge,ke[11]=We,ke[12]=ot):ot=ke[12],ot}(M,G,O,C);bx(V,o,H,k,L,M,O,N,P),yx(V,o,k,we,E,de);const ae=SU(j),ve=!A4(s),ge=i.length>0,be=E.display.cell_output,Te=ve&&be==="above",ze=ve&&be==="below",[Xe,Fe]=A.useState(!1),[et,nt]=A.useState(!1);(function(pe){const{ref:_e,box:ue="content-box",skip:je}=pe,ke=A.useRef({...H7}),Ve=A.useRef(void 0);Ve.current=pe.onResize,A.useEffect(()=>{if(!_e.current||je||typeof window>"u"||!("ResizeObserver"in window))return;const Ze=new ResizeObserver(([le])=>{const Ee=ue==="border-box"?"borderBoxSize":ue==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",Ie=gx(le,Ee,"inlineSize"),Ue=gx(le,Ee,"blockSize");if(ke.current.width!==Ie||ke.current.height!==Ue){const We={width:Ie,height:Ue};ke.current.width=Ie,ke.current.height=Ue,Ve.current&&Ve.current(We)}});return Ze.observe(_e.current,{box:ue}),()=>{Ze.disconnect()}},[ue,_e,je])})({ref:$,skip:!me,onResize:pe=>{const _e=pe.height&&pe.height<68,ue=ie&&(_e||be==="below");Fe(ue),ae&&ue?nt(!0):et&&nt(!1)}});const it=pe=>h.jsx(N4,{tooltip:"Edit markdown",className:Oe("z-20 relative",pe),onClick:Ce}),te=ve&&h.jsxs("div",{className:"relative",onDoubleClick:we,children:[h.jsx("div",{className:"absolute top-5 -left-8 z-10 print:hidden",children:h.jsx(U7,{isCollapsed:I,onClick:()=>{I?k.expandCell({cellId:o}):k.collapseCell({cellId:o})},canCollapse:ae})}),ie&&ze&&it("top-3"),h.jsx(Rc,{allowExpand:!0,forceExpand:ie,output:s,className:"output-area",cellId:o,stale:F,loading:oe}),ie&&Te&&it("bottom-3")]}),Ne=Lp("marimo-cell","hover-actions-parent z-10",{interactive:!0,"needs-run":ne,"has-error":p,stopped:_,disabled:M.disabled,stale:a==="disabled-transitively",borderless:ie&&ve}),Me=Fs.create(o),Be=Qe(pe=>{N({cellId:o,initialPrompt:pe.prompt})}),J=!(!b||b.toLowerCase()!=="valid");return h.jsx(Fp,{children:h.jsx(_0,{cellId:o,config:M,status:a,getEditorView:Q,hasOutput:ve,hasConsoleOutput:ge,name:B,children:h.jsxs(f0,{tabIndex:-1,ref:V,"data-status":a,onBlur:ce,onKeyDown:he,cellId:o,canMoveX:L,title:M.disabled?"This cell is disabled":a==="disabled-transitively"?"This cell has a disabled ancestor":void 0,children:[h.jsxs("div",{className:Ne,id:Me,ref:$,"data-cell-id":o,"data-cell-name":B,children:[be==="above"&&te,h.jsxs("div",{className:Oe("tray"),"data-hidden":ie,children:[h.jsx("div",{className:"absolute right-2 -top-4 z-10",children:h.jsx(vx,{edited:u,appClosed:y,status:a,cellConfig:M,needsRun:ne,hasOutput:ve,hasConsoleOutput:ge,cellActionDropdownRef:P,cellId:o,name:B,getEditorView:Q,onRun:H})}),h.jsx(q7,{cellId:o,className:Oe(ie&&Te&&"-top-7",ie&&ze&&"-bottom-8",ie&&et&&"-left-[3.8rem]"),appClosed:y,actions:k}),h.jsx(Lu,{theme:t,showPlaceholder:e,allowFocus:n,id:o,code:r,config:M,status:a,serializedEditorState:m,runCell:H,setEditorView:z,userConfig:E,editorViewRef:O,editorViewParentRef:C,hidden:!de,hasOutput:ve,temporarilyShowCode:Ce,languageAdapter:G,setLanguageAdapter:Z}),h.jsx(wx,{className:Oe(ie&&be==="below"&&"top-14"),edited:u,status:a,isCellStatusInline:Xe,uninstantiated:re,disabled:M.disabled,runElapsedTimeMs:d,runStartTimestamp:l,lastRunStartTimestamp:c,staleInputs:g,interrupted:f}),h.jsx("div",{className:"shoulder-bottom hover-action",children:v&&de&&h.jsx(N1,{appClosed:y,status:a,onClick:()=>{oe||y||S({cellId:o})}})})]}),be==="below"&&te,b&&h.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",children:[J&&h.jsx("span",{className:"text-muted-foreground text-xs font-bold",children:"reusable"}),h.jsx(Re,{content:h.jsx("span",{className:"max-w-16 text-xs",children:J?"This function or class can be imported into other Python notebooks or modules.":h.jsxs(h.Fragment,{children:["This definition can't be reused in other Python modules:",h.jsx("br",{}),h.jsx("br",{}),h.jsx("pre",{children:b}),h.jsx("br",{}),"Click this icon to learn more."]})}),children:J&&h.jsx(uc,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})||h.jsx(zp,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})})]}),h.jsx(Zp,{consoleOutputs:i,stale:Y,cellName:b?"_":B,onRefactorWithAI:Be,onClear:()=>{k.clearCellConsoleOutput({cellId:o})},onSubmitDebugger:(pe,_e)=>{k.setStdinResponse({cellId:o,response:pe,outputIndex:_e}),O4({text:pe})},cellId:o,debuggerActive:x})]}),I&&h.jsx(mx,{onClick:()=>k.expandCell({cellId:o}),count:T,cellId:o})]})})})},wx=t=>{const e=X.c(19),{className:n,disabled:o,edited:r,interrupted:s,isCellStatusInline:i,lastRunStartTimestamp:a,runElapsedTimeMs:l,runStartTimestamp:c,staleInputs:d,status:u,uninstantiated:f}=t,p=o!==void 0&&o;let _;e[0]!==p||e[1]!==r||e[2]!==s||e[3]!==a||e[4]!==l||e[5]!==c||e[6]!==d||e[7]!==u||e[8]!==f?(_=h.jsx(I1,{status:u,staleInputs:d,interrupted:s,editing:!0,edited:r,disabled:p,elapsedTime:l,runStartTimestamp:c,uninstantiated:f,lastRunStartTimestamp:a}),e[0]=p,e[1]=r,e[2]=s,e[3]=a,e[4]=l,e[5]=c,e[6]=d,e[7]=u,e[8]=f,e[9]=_):_=e[9];const g=_;let m;e[10]!==n?(m=Oe("shoulder-right z-20",n),e[10]=n,e[11]=m):m=e[11];const b=!i&&g;let x;e[12]===Symbol.for("react.memo_cache_sentinel")?(x=h.jsx(h0,{}),e[12]=x):x=e[12];const y=i&&g;let v,k;return e[13]!==y?(v=h.jsxs("div",{className:"flex gap-2 items-end",children:[x,y]}),e[13]=y,e[14]=v):v=e[14],e[15]!==m||e[16]!==b||e[17]!==v?(k=h.jsxs("div",{className:m,children:[b,v]}),e[15]=m,e[16]=b,e[17]=v,e[18]=k):k=e[18],k},q7=t=>{const e=X.c(21),{className:n,appClosed:o,actions:r,cellId:s}=t;let i;e[0]!==r||e[1]!==s?(i=y=>{const v=y===void 0?{}:y;return r.createNewCell({cellId:s,before:!1,...v})},e[0]=r,e[1]=s,e[2]=i):i=e[2];const a=Qe(i);let l;e[3]!==r||e[4]!==s?(l=y=>{const v=y===void 0?{}:y;return r.createNewCell({cellId:s,before:!0,...v})},e[3]=r,e[4]=s,e[5]=l):l=e[5];const c=Qe(l);let d,u;e[6]!==n?(d=Oe("absolute flex flex-col gap-[2px] justify-center h-full left-[-34px] z-20",n),e[6]=n,e[7]=d):d=e[7],e[8]===Symbol.for("react.memo_cache_sentinel")?(u=pn("cell.createAbove"),e[8]=u):u=e[8];const f=o?void 0:c;let p,_,g;e[9]!==o||e[10]!==f?(p=h.jsx(C1,{tooltipContent:u,appClosed:o,onClick:f}),e[9]=o,e[10]=f,e[11]=p):p=e[11],e[12]===Symbol.for("react.memo_cache_sentinel")?(_=h.jsx("div",{className:"flex-1"}),e[12]=_):_=e[12],e[13]===Symbol.for("react.memo_cache_sentinel")?(g=pn("cell.createBelow"),e[13]=g):g=e[13];const m=o?void 0:a;let b,x;return e[14]!==o||e[15]!==m?(b=h.jsx(C1,{tooltipContent:g,appClosed:o,onClick:m}),e[14]=o,e[15]=m,e[16]=b):b=e[16],e[17]!==d||e[18]!==p||e[19]!==b?(x=h.jsxs("div",{className:d,children:[p,_,b]}),e[17]=d,e[18]=p,e[19]=b,e[20]=x):x=e[20],x},vx=t=>{const e=X.c(27),{edited:n,appClosed:o,status:r,cellConfig:s,needsRun:i,hasOutput:a,hasConsoleOutput:l,onRun:c,cellActionDropdownRef:d,cellId:u,getEditorView:f,name:p,includeCellActions:_}=t,g=_===void 0||_,m=!i&&"hover-action";let b;e[0]!==m?(b=Oe(m),e[0]=m,e[1]=b):b=e[1];const x=o?jn.NOOP:c;let y,v,k,S;return e[2]!==o||e[3]!==s||e[4]!==n||e[5]!==i||e[6]!==r||e[7]!==x?(y=h.jsx(hE,{edited:n,onClick:x,appClosed:o,status:r,config:s,needsRun:i}),e[2]=o,e[3]=s,e[4]=n,e[5]=i,e[6]=r,e[7]=x,e[8]=y):y=e[8],e[9]!==o||e[10]!==r?(v=h.jsx($7,{status:r,appClosed:o}),e[9]=o,e[10]=r,e[11]=v):v=e[11],e[12]!==d||e[13]!==s||e[14]!==u||e[15]!==f||e[16]!==l||e[17]!==a||e[18]!==g||e[19]!==p||e[20]!==r?(k=g&&h.jsx(m0,{ref:d,cellId:u,status:r,getEditorView:f,name:p,config:s,hasOutput:a,hasConsoleOutput:l,children:h.jsx(xi,{variant:"green",tooltip:null,"data-testid":"cell-actions-button",children:h.jsx(vS,{strokeWidth:1.5})})}),e[12]=d,e[13]=s,e[14]=u,e[15]=f,e[16]=l,e[17]=a,e[18]=g,e[19]=p,e[20]=r,e[21]=k):k=e[21],e[22]!==b||e[23]!==y||e[24]!==v||e[25]!==k?(S=h.jsxs(uE,{className:b,children:[y,v,k]}),e[22]=b,e[23]=y,e[24]=v,e[25]=k,e[26]=S):S=e[26],S},G7=({theme:t,showPlaceholder:e,allowFocus:n,id:o,code:r,output:s,consoleOutputs:i,status:a,runStartTimestamp:l,lastRunStartTimestamp:c,runElapsedTimeMs:d,edited:u,interrupted:f,errored:p,stopped:_,staleInputs:g,serializedEditorState:m,debuggerActive:b,appClosed:x,canDelete:y,actions:v,deleteCell:k,userConfig:S,config:E,canMoveX:j,name:I,editorView:T,setEditorView:M})=>{const L=A.useRef(null),B=A.useRef(null),O=A.useRef(null),z=Qt(Aa),F=nd(o),V=E.disabled||a==="disabled-transitively",P=M4({executionTime:d,status:a,errored:p,interrupted:f,stopped:_}),C=u||f||g&&!V,$=a==="running"||a==="queued",N=(a==="queued"||u||g)&&!f,H=A.useCallback(()=>T.current,[T]),{closeCompletionHandler:G,resumeCompletionHandler:Z}=_x(L,T);bx(L,o,F,v,j,E,T,z,B),yx(L,o,v,jn.NOOP,S,!0);const q=!A4(s),re=i.length>0,ne=T4(s==null?void 0:s.mimetype),oe=Lp("marimo-cell","hover-actions-parent z-10 border shadow-sm","!border-[var(--blue-5)] !rounded-sm",{"needs-run":C,"has-error":p,stopped:_}),Y=Fs.create(o),Q=Qe(ce=>{z({cellId:o,initialPrompt:ce.prompt})});return h.jsx(Fp,{children:h.jsx(_0,{cellId:o,config:E,status:a,getEditorView:H,hasOutput:q,hasConsoleOutput:re,name:I,children:h.jsxs("div",{className:oe,"data-status":a,id:Y,ref:L,onBlur:G,onKeyDown:Z,title:E.disabled?"This cell is disabled":a==="disabled-transitively"?"This cell has a disabled ancestor":void 0,"data-cell-id":o,"data-cell-name":I,"data-setup-cell":!0,children:[h.jsxs("div",{className:Oe("tray"),"data-hidden":!1,children:[h.jsx("div",{className:"absolute right-2 -top-4 z-10",children:h.jsx(vx,{edited:u,appClosed:x,status:a,cellConfig:E,needsRun:C,hasOutput:q,hasConsoleOutput:re,cellActionDropdownRef:B,cellId:o,name:I,getEditorView:H,onRun:F,includeCellActions:!1})}),h.jsx(Lu,{theme:t,showPlaceholder:e,allowFocus:n,id:o,code:r,config:E,status:a,serializedEditorState:m,runCell:F,setEditorView:M,userConfig:S,editorViewRef:T,editorViewParentRef:O,hidden:!1,hasOutput:q,temporarilyShowCode:jn.NOOP,languageAdapter:"python",setLanguageAdapter:jn.NOOP,showLanguageToggles:!1}),h.jsx(wx,{edited:u,status:a,isCellStatusInline:!1,uninstantiated:P,disabled:E.disabled,runElapsedTimeMs:d,runStartTimestamp:l,lastRunStartTimestamp:c,staleInputs:g,interrupted:f}),h.jsx("div",{className:"shoulder-bottom hover-action",children:y&&h.jsx(N1,{appClosed:x,status:a,onClick:()=>{$||x||k({cellId:o})}})})]}),h.jsxs("div",{className:"py-1 px-2 flex justify-end gap-2 last:rounded-b",children:[h.jsx("span",{className:"text-muted-foreground text-xs font-bold",children:"setup cell"}),h.jsx(Re,{content:h.jsxs("span",{className:"max-w-16",children:["This ",h.jsx("b",{children:"setup cell"})," is guaranteed to run before all other cells. Include ",h.jsx("br",{}),"initialization or imports and constants required by top-level functions."]}),children:h.jsx(zp,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})})]}),ne&&h.jsx(Rc,{allowExpand:!0,forceExpand:!0,output:s,className:"output-area",cellId:o,stale:!1,loading:$}),h.jsx(Zp,{consoleOutputs:i,stale:N,cellName:"_",onRefactorWithAI:Q,onClear:()=>{v.clearCellConsoleOutput({cellId:o})},onSubmitDebugger:(ce,he)=>{v.setStdinResponse({cellId:o,response:ce,outputIndex:he}),O4({text:ce})},cellId:o,debuggerActive:b})]})})})},kx=A.memo(A.forwardRef((t,e)=>{const{status:n,output:o,runStartTimestamp:r,interrupted:s,staleInputs:i,edited:a,id:l,mode:c}=t;Xt.debug("Rendering Cell",l);const d=A.useRef(null);A.useImperativeHandle(e,()=>({get editorView(){return K_(d)},get editorViewOrNull(){return d.current}}),[d]);const u=kU({status:n,output:o,runStartTimestamp:r,interrupted:s,staleInputs:i},a),f=I4(n);return l===Ho?h.jsx(G7,{...t,editorView:d,setEditorView:p=>{d.current=p},outputStale:u}):c==="edit"?h.jsx(W7,{...t,editorView:d,setEditorView:p=>{d.current=p},outputStale:u}):h.jsx(xx,{...t,outputStale:u,outputLoading:f})})),Y7=t=>{const e=X.c(10),{width:n}=t,{banners:o}=j$(),{removeBanner:r}=E$();if(o.length===0)return null;const s=n==="columns"&&"sticky left-12 w-full max-w-[80vw]";let i,a,l;if(e[0]!==s?(i=Oe("flex flex-col gap-4 mb-5 print:hidden",s),e[0]=s,e[1]=i):i=e[1],e[2]!==o||e[3]!==r){let c;e[5]!==r?(c=d=>h.jsxs(Pc,{kind:d.variant||"info",className:"flex flex-col rounded p-3",children:[h.jsxs("div",{className:"flex justify-between",children:[h.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[h.jsx(jU,{className:"w-5 h-5 inline-block mr-2"}),d.title]}),h.jsx(Pe,{"data-testid":"remove-banner-button",variant:"text",size:"icon",onClick:()=>r(d.id),children:h.jsx(go,{className:"w-5 h-5"})})]}),h.jsxs("div",{className:"flex justify-between items-end",children:[h.jsx("span",{children:Bp({html:d.description})}),d.action==="restart"&&h.jsx(J7,{})]})]},d.id),e[5]=r,e[6]=c):c=e[6],a=o.map(c),e[2]=o,e[3]=r,e[4]=a}else a=e[4];return e[7]!==i||e[8]!==a?(l=h.jsx("div",{className:i,children:a}),e[7]=i,e[8]=a,e[9]=l):l=e[9],l},J7=()=>{const t=X.c(3),e=tg();let n,o;return t[0]===Symbol.for("react.memo_cache_sentinel")?(n=h.jsx(Rm,{className:"w-3 h-3 mr-2"}),t[0]=n):n=t[0],t[1]!==e?(o=h.jsxs(Pe,{"data-testid":"restart-session-button",variant:"link",size:"xs",onClick:e,children:[n,"Restart"]}),t[1]=e,t[2]=o):o=t[2],o},K7=(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,u]=a;return{major:Number.parseInt(l,10),minor:Number.parseInt(c,10),patch:Number.parseInt(d,10),preRelease:u||""}};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),X7=()=>{const t=X.c(66),{packageAlert:e}=I$(),{clearPackageAlert:n}=A$(),[o]=Ds();let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={},t[0]=r):r=t[0];const[s,i]=A.useState(r);if(e===null)return null;const a=o.package_management.manager!=="pixi";if(T$(e)){let l,c,d,u,f,p,_,g,m,b;if(t[1]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[h.jsx(Kc,{className:"w-5 h-5 inline-block mr-2"}),"Missing packages"]}),t[1]=l):l=t[1],t[2]!==n||t[3]!==e.id?(c=()=>n(e.id),t[2]=n,t[3]=e.id,t[4]=c):c=t[4],t[5]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsx(go,{className:"w-5 h-5"}),t[5]=d):d=t[5],t[6]!==c?(u=h.jsxs("div",{className:"flex justify-between",children:[l,h.jsx(Pe,{variant:"text","data-testid":"remove-banner-button",size:"icon",onClick:c,children:d})]}),t[6]=c,t[7]=u):u=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(f=h.jsx("p",{children:"The following packages were not found:"}),t[8]=f):f=t[8],t[9]!==s||t[10]!==a||t[11]!==e.packages){let x;t[13]!==s||t[14]!==a?(x=(y,v)=>h.jsxs("li",{className:"flex items-center gap-1 font-mono text-sm",children:[h.jsx(ba,{size:"1rem"}),y,a&&h.jsx(tM,{value:s[y]??"latest",onChange:k=>i(S=>({...S,[y]:k})),packageName:y})]},v),t[13]=s,t[14]=a,t[15]=x):x=t[15],p=e.packages.map(x),t[9]=s,t[10]=a,t[11]=e.packages,t[12]=p}else p=t[12];return t[16]!==p?(_=h.jsxs("div",{children:[f,h.jsx("ul",{className:"list-disc ml-4 mt-1",children:p})]}),t[16]=p,t[17]=_):_=t[17],t[18]!==n||t[19]!==s||t[20]!==e.id||t[21]!==e.isolated||t[22]!==e.packages||t[23]!==o.package_management.manager?(g=h.jsx("div",{className:"ml-auto flex flex-row items-baseline",children:e.isolated?h.jsxs(h.Fragment,{children:[h.jsx(Q7,{manager:o.package_management.manager,packages:e.packages,versions:s,clearPackageAlert:()=>n(e.id)}),!Bn()&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"px-2 text-sm",children:"with"})," ",h.jsx(eM,{})]})]}):h.jsxs("p",{children:["If you set up a"," ",h.jsx(mp,{href:"https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments",children:"virtual environment"}),", marimo can install these packages for you."]})}),t[18]=n,t[19]=s,t[20]=e.id,t[21]=e.isolated,t[22]=e.packages,t[23]=o.package_management.manager,t[24]=g):g=t[24],t[25]!==_||t[26]!==g?(m=h.jsxs("div",{className:"flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",children:[_,g]}),t[25]=_,t[26]=g,t[27]=m):m=t[27],t[28]!==u||t[29]!==m?(b=h.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-12 min-w-[400px] z-[200] opacity-95",children:h.jsxs(Pc,{kind:"danger",className:"flex flex-col rounded py-3 px-5 animate-in slide-in-from-left",children:[u,m]})}),t[28]=u,t[29]=m,t[30]=b):b=t[30],b}if(M$(e)){let l;t[31]!==e.packages?(l=function(M){const L=new Set(Object.values(M)),B=L.has("queued")||L.has("installing")?"installing":L.has("failed")?"failed":"installed";return B==="installing"?{status:"installing",title:"Installing packages",titleIcon:h.jsx(ka,{className:"w-5 h-5 inline-block mr-2"}),description:"Installing packages:"}:B==="installed"?{status:"installed",title:"All packages installed!",titleIcon:h.jsx(Am,{className:"w-5 h-5 inline-block mr-2"}),description:"Installed packages:"}:{status:"failed",title:"Some packages failed to install",titleIcon:h.jsx(Kc,{className:"w-5 h-5 inline-block mr-2"}),description:"See terminal for error logs."}}(e.packages),t[31]=e.packages,t[32]=l):l=t[32];const{status:c,title:d,titleIcon:u,description:f}=l;c==="installed"&&setTimeout(()=>n(e.id),1e4);const p=c==="failed"?"danger":"info";let _,g,m,b,x;t[33]!==d||t[34]!==u?(_=h.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[u,d]}),t[33]=d,t[34]=u,t[35]=_):_=t[35],t[36]!==n||t[37]!==e.id?(g=()=>n(e.id),t[36]=n,t[37]=e.id,t[38]=g):g=t[38],t[39]===Symbol.for("react.memo_cache_sentinel")?(m=h.jsx(go,{className:"w-5 h-5"}),t[39]=m):m=t[39],t[40]!==g?(b=h.jsx(Pe,{variant:"text","data-testid":"remove-banner-button",size:"icon",onClick:g,children:m}),t[40]=g,t[41]=b):b=t[41],t[42]!==_||t[43]!==b?(x=h.jsxs("div",{className:"flex justify-between",children:[_,b]}),t[42]=_,t[43]=b,t[44]=x):x=t[44];const y=c==="installed"&&"text-accent-foreground";let v,k,S,E,j,I,T;if(t[45]!==y?(v=Oe("flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",y),t[45]=y,t[46]=v):v=t[46],t[47]!==f?(k=h.jsx("p",{children:f}),t[47]=f,t[48]=k):k=t[48],t[49]!==e.packages||t[50]!==c){let M;t[52]!==c?(M=(L,B)=>{const[O,z]=L;return h.jsxs("li",{className:Oe("flex items-center gap-1 font-mono text-sm",z==="installing"&&"font-semibold",z==="failed"&&"text-destructive",z==="installed"&&"text-accent-foreground",z==="installed"&&c==="failed"&&"text-muted-foreground"),children:[h.jsx(Z7,{status:z}),O]},B)},t[52]=c,t[53]=M):M=t[53],S=Object.entries(e.packages).map(M),t[49]=e.packages,t[50]=c,t[51]=S}else S=t[51];return t[54]!==S?(E=h.jsx("ul",{className:"list-disc ml-4 mt-1",children:S}),t[54]=S,t[55]=E):E=t[55],t[56]!==k||t[57]!==E?(j=h.jsxs("div",{children:[k,E]}),t[56]=k,t[57]=E,t[58]=j):j=t[58],t[59]!==j||t[60]!==v?(I=h.jsx("div",{className:v,children:j}),t[59]=j,t[60]=v,t[61]=I):I=t[61],t[62]!==I||t[63]!==p||t[64]!==x?(T=h.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-12 min-w-[400px] z-[200] opacity-95",children:h.jsxs(Pc,{kind:p,className:"flex flex-col rounded pt-3 pb-4 px-5",children:[x,I]})}),t[62]=I,t[63]=p,t[64]=x,t[65]=T):T=t[65],T}return oc(e),null},Z7=t=>{const e=X.c(4),{status:n}=t;switch(n){case"queued":{let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx(ba,{size:"1rem"}),e[0]=o):o=e[0],o}case"installing":{let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx(ka,{size:"1rem"}),e[1]=o):o=e[1],o}case"installed":{let o;return e[2]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx(_c,{size:"1rem"}),e[2]=o):o=e[2],o}case"failed":{let o;return e[3]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx(go,{size:"1rem"}),e[3]=o):o=e[3],o}default:return oc(n),null}},Q7=t=>{const e=X.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 u of o)d[u]=d[u]??"";await TU({manager:n,versions:d}).catch(nM)},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=h.jsx(ka,{className:"w-4 h-4 mr-2"}),l=h.jsx("span",{className:"font-semibold",children:"Install"}),e[5]=a,e[6]=l):(a=e[5],l=e[6]),e[7]!==i?(c=h.jsxs(Pe,{variant:"outline","data-testid":"install-packages-button",size:"sm",onClick:i,children:[a,l]}),e[7]=i,e[8]=c):c=e[8],c},eM=()=>{const t=X.c(16),[e,n]=Ds();let o,r;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=H3(EU),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=W3(r);let i;t[3]!==n?(i=async f=>{await Rs({config:f}).then(()=>{n(f)})},t[3]=n,t[4]=i):i=t[4];const a=i;let l,c,d,u;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=h.jsx("div",{className:"flex flex-col gap-3",children:h.jsx(B3,{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=h.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?(u=h.jsx(IU,{...s,children:d}),t[13]=s,t[14]=d,t[15]=u):u=t[15],u},tM=t=>{const e=X.c(21),{value:n,onChange:o,packageName:r}=t;let s,i;e[0]!==r?(s=async()=>{const g=await fetch(`https://pypi.org/pypi/${function(b){return b.replaceAll(/\[.*]/g,"").trim()}(r)}/json`,{method:"GET",signal:AbortSignal.timeout(5e3)}),m=await g.json();return["latest",...Object.keys(m.releases).sort(K7).slice(0,100)]},i=[r],e[0]=r,e[1]=s,e[2]=i):(s=e[1],i=e[2]);const{data:a,loading:l,error:c}=Xn(s,i);let d;e[3]!==a?(d=a===void 0?[]:a,e[3]=a,e[4]=d):d=e[4];const u=d;if(c){let g,m,b;return e[5]!==o?(g=x=>o(x.target.value),e[5]=o,e[6]=g):g=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(m=h.jsx("option",{value:"latest",children:"latest"}),e[7]=m):m=e[7],e[8]!==g||e[9]!==n?(b=h.jsx(Re,{content:"Failed to fetch package versions",children:h.jsx(Up,{value:n,onChange:g,disabled:!0,className:"inline-flex ml-2",children:m})}),e[8]=g,e[9]=n,e[10]=b):b=e[10],b}let f,p,_;return e[11]!==o?(f=g=>o(g.target.value),e[11]=o,e[12]=f):f=e[12],e[13]!==u||e[14]!==l?(p=l?h.jsx("option",{value:"latest",children:"latest"}):u.map(sM),e[13]=u,e[14]=l,e[15]=p):p=e[15],e[16]!==l||e[17]!==f||e[18]!==p||e[19]!==n?(_=h.jsx(Up,{value:n,onChange:f,disabled:l,className:"inline-flex ml-2",children:p}),e[16]=l,e[17]=f,e[18]=p,e[19]=n,e[20]=_):_=e[20],_};function nM(t){Xt.error(t)}function oM(t){return h.jsx("option",{value:t,children:t},t)}function rM(t){const{field:e}=t;return h.jsxs(U3,{children:[h.jsx(V3,{children:h.jsx(Up,{"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:AU.map(oM)})}),h.jsx($3,{})]})}function sM(t){return h.jsx("option",{value:t,children:t},t)}const iM=t=>{let{transform:e}=t;return{...e,x:0}},aM={threshold:{x:0,y:.1}},lM=K.memo(t=>{const e=X.c(23),{children:n,multiColumn:o}=t,{dropCellOverCell:r,dropCellOverColumn:s,moveColumn:i,compactColumns:a}=Lt(),[l,c]=A.useState(null),[d,u]=A.useState(null),[f]=R3();let p;e:{if(f.width==="columns"){p=Vp.EMPTY;break e}let O;e[0]===Symbol.for("react.memo_cache_sentinel")?(O=[iM],e[0]=O):O=e[0],p=O}const _=p;let g,m;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")?(m={coordinateGetter:r5},e[2]=m):m=e[2];const b=function(){for(var O=arguments.length,z=new Array(O),F=0;F<O;F++)z[F]=arguments[F];return A.useMemo(()=>[...z].filter(V=>V!=null),[...z])}(M1(lu,g),M1(iu,m));let x;e[3]===Symbol.for("react.memo_cache_sentinel")?(x=O=>{c(O.active.id);const z=fo();u(z.cellIds)},e[3]=x):x=e[3];const y=Qe(x);let v;e[4]!==d?(v=()=>{c(null),u(null)},e[4]=d,e[5]=v):v=e[5];const k=Qe(v);let S;e[6]!==l?(S=O=>{const z=O.droppableContainers.filter(cM);if(l&&rs(l))return tu({...O,droppableContainers:z});const F=(N=>{let{droppableContainers:H,droppableRects:G,pointerCoordinates:Z}=N;if(!Z)return[];const q=[];for(const re of H){const{id:ne}=re,oe=G.get(ne);if(oe&&vE(Z,oe)){const Y=Qd(oe).reduce((ce,he)=>ce+Xd(Z,he),0),Q=Number((Y/4).toFixed(4));q.push({id:ne,data:{droppableContainer:re,value:Q}})}}return q.sort(Zd)})({...O,droppableContainers:z}),V=eu(F.length>0?F:D1({...O,droppableContainers:z}),"id");if(!V)return[];Bo(rs(V),`Expected column id. Got: ${V}`);const P=fo().cellIds.get(V);if(Bo(P,`Expected column. Got: ${V}`),P&&P.topLevelIds.length===0)return[{id:V}];const C=new Set(P.topLevelIds),$=tu({...O,droppableContainers:O.droppableContainers.filter(N=>N.id!==V&&C.has(N.id))});if($.length>0){const N=$[0].id;return Bo(Fu(N),`Expected cell id. Got: ${N}`),[{id:N}]}return[]},e[6]=l,e[7]=S):S=e[7];const E=S;let j;e[8]!==r||e[9]!==s||e[10]!==i?(j=O=>{const{active:z,over:F}=O,V=F==null?void 0:F.id;if(V!=null&&z.id!==V){if(Fu(z.id)){if(rs(V))return void s({cellId:z.id,columnId:V});if(Fu(V))return void r({cellId:z.id,overCellId:V})}rs(z.id)&&rs(V)&&i({column:z.id,overColumn:V})}},e[8]=r,e[9]=s,e[10]=i,e[11]=j):j=e[11];const I=Qe(j);let T;e[12]!==a?(T=O=>{const{active:z,over:F}=O;F!==null&&z.id!==F.id&&a()},e[12]=a,e[13]=T):T=e[13];const M=Qe(T),L=o?E:tu;let B;return e[14]!==n||e[15]!==k||e[16]!==M||e[17]!==I||e[18]!==y||e[19]!==_||e[20]!==b||e[21]!==L?(B=h.jsx(WE,{autoScroll:aM,sensors:b,collisionDetection:L,modifiers:_,onDragEnd:M,onDragStart:y,onDragCancel:k,onDragOver:I,children:n}),e[14]=n,e[15]=k,e[16]=M,e[17]=I,e[18]=y,e[19]=_,e[20]=b,e[21]=L,e[22]=B):B=e[22],B});function Fu(t){return typeof t=="string"&&!t.startsWith("tree_")}function rs(t){return typeof t=="string"&&t.startsWith("tree_")}function cM(t){return rs(t.id)}const Sx=K.forwardRef((t,e)=>{const n=X.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:u,transform:f,transition:p,isDragging:_,isOver:g}=c0(l);let m;n[8]!==f?(m=f?Oc.Transform.toString({x:f.x,y:0,scaleX:1,scaleY:1}):void 0,n[8]=f,n[9]=m):m=n[9];const b=_?2:void 0;let x;n[10]!==m||n[11]!==b||n[12]!==p?(x={transform:m,transition:p,zIndex:b,position:"relative","--gutter-width":"50px"},n[10]=m,n[11]=b,n[12]=p,n[13]=x):x=n[13];const y=x,{deleteColumn:v,moveColumn:k,addColumn:S}=Lt();let E;n[14]===Symbol.for("react.memo_cache_sentinel")?(E=Oe("h-full hover:bg-muted rounded-none"),n[14]=E):E=n[14];const j=E,I=uM;let T;n[15]!==i||n[16]!==k?(T=()=>k({column:i,overColumn:"_left_"}),n[15]=i,n[16]=k,n[17]=T):T=n[17];const M=!r;let L,B,O;n[18]===Symbol.for("react.memo_cache_sentinel")?(L=h.jsx(D3,{className:"size-4"}),n[18]=L):L=n[18],n[19]!==T||n[20]!==M?(B=h.jsx(Re,{content:"Move column left",side:"top",delayDuration:300,children:h.jsx(Pe,{variant:"text",size:"sm",className:j,onClick:T,disabled:M,children:L})}),n[19]=T,n[20]=M,n[21]=B):B=n[21],n[22]!==i||n[23]!==k?(O=()=>k({column:i,overColumn:"_right_"}),n[22]=i,n[23]=k,n[24]=O):O=n[24];const z=!s;let F,V,P,C,$,N,H,G;n[25]===Symbol.for("react.memo_cache_sentinel")?(F=h.jsx(lc,{className:"size-4"}),n[25]=F):F=n[25],n[26]!==O||n[27]!==z?(V=h.jsx(Re,{content:"Move column right",side:"top",delayDuration:300,children:h.jsx(Pe,{variant:"text",size:"sm",className:j,onClick:O,disabled:z,children:F})}),n[26]=O,n[27]=z,n[28]=V):V=n[28],n[29]!==c||n[30]!==d?(P=h.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]=P):P=n[31],n[32]!==o||n[33]!==i||n[34]!==v?(C=o&&h.jsx(Re,{content:"Delete column",side:"top",delayDuration:300,children:h.jsx(Pe,{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:h.jsx(go,{className:"size-4"})})}),n[32]=o,n[33]=i,n[34]=v,n[35]=C):C=n[35],n[36]!==S||n[37]!==i?($=()=>{S({columnId:i}),requestAnimationFrame(I)},n[36]=S,n[37]=i,n[38]=$):$=n[38],n[39]===Symbol.for("react.memo_cache_sentinel")?(N=h.jsx(Lr,{className:"size-4"}),n[39]=N):N=n[39],n[40]!==$?(H=h.jsx(Re,{content:"Add column",side:"top",delayDuration:300,children:h.jsx(Pe,{variant:"text",size:"sm",className:j,onClick:$,children:N})}),n[40]=$,n[41]=H):H=n[41],n[42]!==V||n[43]!==P||n[44]!==C||n[45]!==H||n[46]!==B?(G=h.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:[B,V,P,C,H]}),n[42]=V,n[43]=P,n[44]=C,n[45]=H,n[46]=B,n[47]=G):G=n[47];const Z=G;let q;n[48]!==e||n[49]!==u?(q=ce=>{ml(e,u)(ce)},n[48]=e,n[49]=u,n[50]=q):q=n[50];const re=_?"":a.className,ne=_?"z-20":"z-1 hover:z-10 focus-within:z-10",oe=g&&"bg-accent/20";let Y,Q;return n[51]!==re||n[52]!==ne||n[53]!==oe?(Y=Oe(re,ne,oe),n[51]=re,n[52]=ne,n[53]=oe,n[54]=Y):Y=n[54],n[55]!==Z||n[56]!==_||n[57]!==a||n[58]!==y||n[59]!==q||n[60]!==Y?(Q=h.jsxs("div",{tabIndex:-1,ref:q,...a,style:y,"data-is-dragging":_,className:Y,children:[Z,a.children]}),n[55]=Z,n[56]=_,n[57]=a,n[58]=y,n[59]=q,n[60]=Y,n[61]=Q):Q=n[61],Q});Sx.displayName="SortableColumn";const dM=A.memo(Sx);function uM(){const t=document.getElementById("App");t&&t.scrollTo({left:t.scrollLeft+1e3,behavior:"smooth"})}const{getColumnWidth:hM,saveColumnWidth:fM}=MU,Cx=A.memo(t=>{const e=X.c(14),n=A.useRef(null);let o;e[0]!==t.children||e[1]!==t.index||e[2]!==t.width?(o=t.width==="columns"?h.jsx(pM,{startingWidth:hM(t.index),onResize:i=>{fM(t.index,i)},children:t.children}):h.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=h.jsxs(dM,{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=h.jsxs(h.Fragment,{children:[r,t.footer]}),e[11]=r,e[12]=t.footer,e[13]=s):s=e[13],s});Cx.displayName="Column";const pM=t=>{const e=X.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}=OU(s),c=mM;let d,u,f,p;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?(u=h.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]=u):u=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]!==u||e[13]!==f?(p=h.jsxs("div",{className:"flex flex-row",children:[d,u,f]}),e[11]=d,e[12]=u,e[13]=f,e[14]=p):p=e[14],p};function mM(t){return h.jsx("div",{ref:t,className:`w-[3px] cursor-col-resize transition-colors duration-200 z-[100]
118
+ `},bE={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function yE(t){let{announcements:e=bE,container:n,hiddenTextDescribedById:o,screenReaderInstructions:r=_E}=t;const{announce:s,announcement:i}=function(){const[u,f]=A.useState("");return{announce:A.useCallback(p=>{p!=null&&f(p)},[]),announcement:u}}(),a=da("DndLiveRegion"),[l,c]=A.useState(!1);if(A.useEffect(()=>{c(!0)},[]),function(u){const f=A.useContext(T1);A.useEffect(()=>{if(!f)throw new Error("useDndMonitor must be used within a children of <DndContext>");return f(u)},[u,f])}(A.useMemo(()=>({onDragStart(u){let{active:f}=u;s(e.onDragStart({active:f}))},onDragMove(u){let{active:f,over:p}=u;e.onDragMove&&s(e.onDragMove({active:f,over:p}))},onDragOver(u){let{active:f,over:p}=u;s(e.onDragOver({active:f,over:p}))},onDragEnd(u){let{active:f,over:p}=u;s(e.onDragEnd({active:f,over:p}))},onDragCancel(u){let{active:f,over:p}=u;s(e.onDragCancel({active:f,over:p}))}}),[s,e])),!l)return null;const d=K.createElement(K.Fragment,null,K.createElement(mE,{id:o,value:r.draggable}),K.createElement(gE,{id:a,announcement:i}));return n?fa.createPortal(d,n):d}var zt;function sl(){}function M1(t,e){return A.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(zt||(zt={}));const qn=Object.freeze({x:0,y:0});function Zd(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function Qd(t,e){let{data:{value:n}}=t,{data:{value:o}}=e;return n-o}function xE(t,e){let{data:{value:n}}=t,{data:{value:o}}=e;return o-n}function eu(t){let{left:e,top:n,height:o,width:r}=t;return[{x:e,y:n},{x:e+r,y:n},{x:e,y:n+o},{x:e+r,y:n+o}]}function tu(t,e){if(!t||t.length===0)return null;const[n]=t;return e?n[e]:n}function O1(t,e,n){return e===void 0&&(e=t.left),n===void 0&&(n=t.top),{x:e+.5*t.width,y:n+.5*t.height}}const nu=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:o}=t;const r=O1(e,e.left,e.top),s=[];for(const i of o){const{id:a}=i,l=n.get(a);if(l){const c=Zd(O1(l),r);s.push({id:a,data:{droppableContainer:i,value:c}})}}return s.sort(Qd)};function wE(t,e){const n=Math.max(e.top,t.top),o=Math.max(e.left,t.left),r=Math.min(e.left+e.width,t.left+t.width),s=Math.min(e.top+e.height,t.top+t.height),i=r-o,a=s-n;if(o<r&&n<s){const l=e.width*e.height,c=t.width*t.height,d=i*a;return Number((d/(l+c-d)).toFixed(4))}return 0}const D1=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:o}=t;const r=[];for(const s of o){const{id:i}=s,a=n.get(i);if(a){const l=wE(a,e);l>0&&r.push({id:i,data:{droppableContainer:s,value:l}})}}return r.sort(xE)};function vE(t,e){const{top:n,left:o,bottom:r,right:s}=e;return n<=t.y&&t.y<=r&&o<=t.x&&t.x<=s}function R1(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:qn}function kE(t){return function(e){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return o.reduce((s,i)=>({...s,top:s.top+t*i.y,bottom:s.bottom+t*i.y,left:s.left+t*i.x,right:s.right+t*i.x}),{...e})}}const SE=kE(1),CE={ignoreTransform:!1};function Gr(t,e){e===void 0&&(e=CE);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:c,transformOrigin:d}=$o(t).getComputedStyle(t);c&&(n=function(u,f,p){const _=function(E){if(E.startsWith("matrix3d(")){const j=E.slice(9,-1).split(/, /);return{x:+j[12],y:+j[13],scaleX:+j[0],scaleY:+j[5]}}if(E.startsWith("matrix(")){const j=E.slice(7,-1).split(/, /);return{x:+j[4],y:+j[5],scaleX:+j[0],scaleY:+j[3]}}return null}(f);if(!_)return u;const{scaleX:g,scaleY:m,x:b,y:x}=_,y=u.left-b-(1-g)*parseFloat(p),v=u.top-x-(1-m)*parseFloat(p.slice(p.indexOf(" ")+1)),k=g?u.width/g:u.width,S=m?u.height/m:u.height;return{width:k,height:S,top:v,right:y+k,bottom:v+S,left:y}}(n,c,d))}const{top:o,left:r,width:s,height:i,bottom:a,right:l}=n;return{top:o,left:r,width:s,height:i,bottom:a,right:l}}function P1(t){return Gr(t,{ignoreTransform:!0})}function il(t,e){const n=[];return t?function o(r){if(e!=null&&n.length>=e||!r)return n;if(m4(r)&&r.scrollingElement!=null&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!Tc(r)||WB(r)||n.includes(r))return n;const s=$o(t).getComputedStyle(r);return r!==t&&function(i,a){a===void 0&&(a=$o(i).getComputedStyle(i));const l=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(c=>{const d=a[c];return typeof d=="string"&&l.test(d)})}(r,s)&&n.push(r),function(i,a){return a===void 0&&(a=$o(i).getComputedStyle(i)),a.position==="fixed"}(r,s)?n:o(r.parentNode)}(t):n}function L1(t){const[e]=il(t,1);return e??null}function ou(t){return Ip&&t?Ap(t)?t:YB(t)?m4(t)||t===qs(t).scrollingElement?window:Tc(t)?t:null:null:null}function F1(t){return Ap(t)?t.scrollX:t.scrollLeft}function z1(t){return Ap(t)?t.scrollY:t.scrollTop}function ru(t){return{x:F1(t),y:z1(t)}}var $t;function B1(t){return!(!Ip||!t)&&t===document.scrollingElement}function U1(t){const e={x:0,y:0},n=B1(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},o={x:t.scrollWidth-n.width,y:t.scrollHeight-n.height};return{isTop:t.scrollTop<=e.y,isLeft:t.scrollLeft<=e.x,isBottom:t.scrollTop>=o.y,isRight:t.scrollLeft>=o.x,maxScroll:o,minScroll:e}}(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})($t||($t={}));const NE={x:.2,y:.2};function jE(t,e,n,o,r){let{top:s,left:i,right:a,bottom:l}=n;o===void 0&&(o=10),r===void 0&&(r=NE);const{isTop:c,isBottom:d,isLeft:u,isRight:f}=U1(t),p={x:0,y:0},_={x:0,y:0},g=e.height*r.y,m=e.width*r.x;return!c&&s<=e.top+g?(p.y=$t.Backward,_.y=o*Math.abs((e.top+g-s)/g)):!d&&l>=e.bottom-g&&(p.y=$t.Forward,_.y=o*Math.abs((e.bottom-g-l)/g)),!f&&a>=e.right-m?(p.x=$t.Forward,_.x=o*Math.abs((e.right-m-a)/m)):!u&&i<=e.left+m&&(p.x=$t.Backward,_.x=o*Math.abs((e.left+m-i)/m)),{direction:p,speed:_}}function EE(t){if(t===document.scrollingElement){const{innerWidth:s,innerHeight:i}=window;return{top:0,left:0,right:s,bottom:i,width:s,height:i}}const{top:e,left:n,right:o,bottom:r}=t.getBoundingClientRect();return{top:e,left:n,right:o,bottom:r,width:t.clientWidth,height:t.clientHeight}}function V1(t){return t.reduce((e,n)=>Gs(e,ru(n)),qn)}const IE=[["x",["left","right"],function(t){return t.reduce((e,n)=>e+F1(n),0)}],["y",["top","bottom"],function(t){return t.reduce((e,n)=>e+z1(n),0)}]];class su{constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const o=il(n),r=V1(o);this.rect={...e},this.width=e.width,this.height=e.height;for(const[s,i,a]of IE)for(const l of i)Object.defineProperty(this,l,{get:()=>{const c=a(o),d=r[s]-c;return this.rect[l]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class wi{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var o;return(o=this.target)==null?void 0:o.removeEventListener(...n)})},this.target=e}add(e,n,o){var r;(r=this.target)==null||r.addEventListener(e,n,o),this.listeners.push([e,n,o])}}function iu(t,e){const n=Math.abs(t.x),o=Math.abs(t.y);return typeof e=="number"?Math.sqrt(n**2+o**2)>e:"x"in e&&"y"in e?n>e.x&&o>e.y:"x"in e?n>e.x:"y"in e&&o>e.y}var Tn,ct;function $1(t){t.preventDefault()}function AE(t){t.stopPropagation()}(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(Tn||(Tn={})),function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"}(ct||(ct={}));const H1={start:[ct.Space,ct.Enter],cancel:[ct.Esc],end:[ct.Space,ct.Enter,ct.Tab]},TE=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case ct.Right:return{...n,x:n.x+25};case ct.Left:return{...n,x:n.x-25};case ct.Down:return{...n,y:n.y+25};case ct.Up:return{...n,y:n.y-25}}};class au{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new wi(qs(n)),this.windowListeners=new wi($o(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Tn.Resize,this.handleCancel),this.windowListeners.add(Tn.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Tn.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,o=e.node.current;o&&function(r,s){if(s===void 0&&(s=Gr),!r)return;const{top:i,left:a,bottom:l,right:c}=s(r);L1(r)&&(l<=0||c<=0||i>=window.innerHeight||a>=window.innerWidth)&&r.scrollIntoView({block:"center",inline:"center"})}(o),n(qn)}handleKeyDown(e){if(jp(e)){const{active:n,context:o,options:r}=this.props,{keyboardCodes:s=H1,coordinateGetter:i=TE,scrollBehavior:a="smooth"}=r,{code:l}=e;if(s.end.includes(l))return void this.handleEnd(e);if(s.cancel.includes(l))return void this.handleCancel(e);const{collisionRect:c}=o.current,d=c?{x:c.left,y:c.top}:qn;this.referenceCoordinates||(this.referenceCoordinates=d);const u=i(e,{active:n,context:o.current,currentCoordinates:d});if(u){const f=ha(u,d),p={x:0,y:0},{scrollableAncestors:_}=o.current;for(const g of _){const m=e.code,{isTop:b,isRight:x,isLeft:y,isBottom:v,maxScroll:k,minScroll:S}=U1(g),E=EE(g),j={x:Math.min(m===ct.Right?E.right-E.width/2:E.right,Math.max(m===ct.Right?E.left:E.left+E.width/2,u.x)),y:Math.min(m===ct.Down?E.bottom-E.height/2:E.bottom,Math.max(m===ct.Down?E.top:E.top+E.height/2,u.y))},I=m===ct.Right&&!x||m===ct.Left&&!y,T=m===ct.Down&&!v||m===ct.Up&&!b;if(I&&j.x!==u.x){const M=g.scrollLeft+f.x,L=m===ct.Right&&M<=k.x||m===ct.Left&&M>=S.x;if(L&&!f.y)return void g.scrollTo({left:M,behavior:a});p.x=L?g.scrollLeft-M:m===ct.Right?g.scrollLeft-k.x:g.scrollLeft-S.x,p.x&&g.scrollBy({left:-p.x,behavior:a});break}if(T&&j.y!==u.y){const M=g.scrollTop+f.y,L=m===ct.Down&&M<=k.y||m===ct.Up&&M>=S.y;if(L&&!f.x)return void g.scrollTo({top:M,behavior:a});p.y=L?g.scrollTop-M:m===ct.Down?g.scrollTop-k.y:g.scrollTop-S.y,p.y&&g.scrollBy({top:-p.y,behavior:a});break}}this.handleMove(e,Gs(ha(u,this.referenceCoordinates),p))}}}handleMove(e,n){const{onMove:o}=this.props;e.preventDefault(),o(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function W1(t){return!!(t&&"distance"in t)}function q1(t){return!!(t&&"delay"in t)}au.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:o=H1,onActivation:r}=e,{active:s}=n;const{code:i}=t.nativeEvent;if(o.start.includes(i)){const a=s.activatorNode.current;return(!a||t.target===a)&&(t.preventDefault(),r==null||r({event:t.nativeEvent}),!0)}return!1}}];class lu{constructor(e,n,o){var r;o===void 0&&(o=function(a){const{EventTarget:l}=$o(a);return a instanceof l?a:qs(a)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:s}=e,{target:i}=s;this.props=e,this.events=n,this.document=qs(i),this.documentListeners=new wi(this.document),this.listeners=new wi(o),this.windowListeners=new wi($o(i)),this.initialCoordinates=(r=Ep(s))!=null?r:qn,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:o}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Tn.Resize,this.handleCancel),this.windowListeners.add(Tn.DragStart,$1),this.windowListeners.add(Tn.VisibilityChange,this.handleCancel),this.windowListeners.add(Tn.ContextMenu,$1),this.documentListeners.add(Tn.Keydown,this.handleKeydown),n){if(o!=null&&o({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(q1(n))return this.timeoutId=setTimeout(this.handleStart,n.delay),void this.handlePending(n);if(W1(n))return void this.handlePending(n)}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){const{active:o,onPending:r}=this.props;r(o,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(Tn.Click,AE,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Tn.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:o,initialCoordinates:r,props:s}=this,{onMove:i,options:{activationConstraint:a}}=s;if(!r)return;const l=(n=Ep(e))!=null?n:qn,c=ha(r,l);if(!o&&a){if(W1(a)){if(a.tolerance!=null&&iu(c,a.tolerance))return this.handleCancel();if(iu(c,a.distance))return this.handleStart()}return q1(a)&&iu(c,a.tolerance)?this.handleCancel():void this.handlePending(a,c)}e.cancelable&&e.preventDefault(),i(l)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===ct.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const ME={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class cu extends lu{constructor(e){const{event:n}=e,o=qs(n.target);super(e,ME,o)}}cu.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:o}=e;return!(!n.isPrimary||n.button!==0)&&(o==null||o({event:n}),!0)}}];const OE={move:{name:"mousemove"},end:{name:"mouseup"}};var du;(function(t){t[t.RightClick=2]="RightClick"})(du||(du={})),(class extends lu{constructor(t){super(t,OE,qs(t.event.target))}}).activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:o}=e;return n.button!==du.RightClick&&(o==null||o({event:n}),!0)}}];const uu={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};var vi,al;function DE(t){let{acceleration:e,activator:n=vi.Pointer,canScroll:o,draggingRect:r,enabled:s,interval:i=5,order:a=al.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:d,delta:u,threshold:f}=t;const p=function(S){let{delta:E,disabled:j}=S;const I=Mc(E);return pa(T=>{if(j||!I||!T)return RE;const M={x:Math.sign(E.x-I.x),y:Math.sign(E.y-I.y)};return{x:{[$t.Backward]:T.x[$t.Backward]||M.x===-1,[$t.Forward]:T.x[$t.Forward]||M.x===1},y:{[$t.Backward]:T.y[$t.Backward]||M.y===-1,[$t.Forward]:T.y[$t.Forward]||M.y===1}}},[j,E,I])}({delta:u,disabled:!s}),[_,g]=qB(),m=A.useRef({x:0,y:0}),b=A.useRef({x:0,y:0}),x=A.useMemo(()=>{switch(n){case vi.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case vi.DraggableRect:return r}},[n,r,l]),y=A.useRef(null),v=A.useCallback(()=>{const S=y.current;if(!S)return;const E=m.current.x*b.current.x,j=m.current.y*b.current.y;S.scrollBy(E,j)},[]),k=A.useMemo(()=>a===al.TreeOrder?[...c].reverse():c,[a,c]);A.useEffect(()=>{if(s&&c.length&&x){for(const S of k){if((o==null?void 0:o(S))===!1)continue;const E=c.indexOf(S),j=d[E];if(!j)continue;const{direction:I,speed:T}=jE(S,j,x,e,f);for(const M of["x","y"])p[M][I[M]]||(T[M]=0,I[M]=0);if(T.x>0||T.y>0)return g(),y.current=S,_(v,i),m.current=T,void(b.current=I)}m.current={x:0,y:0},b.current={x:0,y:0},g()}else g()},[e,v,o,g,s,i,JSON.stringify(x),JSON.stringify(p),_,c,k,d,JSON.stringify(f)])}(class extends lu{constructor(t){super(t,uu)}static setup(){return window.addEventListener(uu.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(uu.move.name,t)};function t(){}}}).activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:o}=e;const{touches:r}=n;return!(r.length>1)&&(o==null||o({event:n}),!0)}}],function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"}(vi||(vi={})),function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"}(al||(al={}));const RE={x:{[$t.Backward]:!1,[$t.Forward]:!1},y:{[$t.Backward]:!1,[$t.Forward]:!1}};var ki,hu;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(ki||(ki={})),function(t){t.Optimized="optimized"}(hu||(hu={}));const G1=new Map;function Y1(t,e){return pa(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function ll(t){let{callback:e,disabled:n}=t;const o=p4(e),r=A.useMemo(()=>{if(n||typeof window>"u"||window.ResizeObserver===void 0)return;const{ResizeObserver:s}=window;return new s(o)},[n]);return A.useEffect(()=>()=>r==null?void 0:r.disconnect(),[r]),r}function PE(t){return new su(Gr(t),t)}function J1(t,e,n){e===void 0&&(e=PE);const[o,r]=A.useState(null);function s(){r(l=>{if(!t)return null;var c;if(t.isConnected===!1)return(c=l??n)!=null?c:null;const d=e(t);return JSON.stringify(l)===JSON.stringify(d)?l:d})}const i=function(l){let{callback:c,disabled:d}=l;const u=p4(c),f=A.useMemo(()=>{if(d||typeof window>"u"||window.MutationObserver===void 0)return;const{MutationObserver:p}=window;return new p(u)},[u,d]);return A.useEffect(()=>()=>f==null?void 0:f.disconnect(),[f]),f}({callback(l){if(t)for(const c of l){const{type:d,target:u}=c;if(d==="childList"&&u instanceof HTMLElement&&u.contains(t)){s();break}}}}),a=ll({callback:s});return fr(()=>{s(),t?(a==null||a.observe(t),i==null||i.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),i==null||i.disconnect())},[t]),o}const K1=[];function X1(t,e){e===void 0&&(e=[]);const n=A.useRef(null);return A.useEffect(()=>{n.current=null},e),A.useEffect(()=>{const o=t!==qn;o&&!n.current&&(n.current=t),!o&&n.current&&(n.current=null)},[t]),n.current?ha(t,n.current):qn}function Z1(t){return A.useMemo(()=>t?function(e){const n=e.innerWidth,o=e.innerHeight;return{top:0,left:0,right:n,bottom:o,width:n,height:o}}(t):null,[t])}const Q1=[];function LE(t){let{measure:e}=t;const[n,o]=A.useState(null),r=A.useCallback(c=>{for(const{target:d}of c)if(Tc(d)){o(u=>{const f=e(d);return u?{...u,width:f.width,height:f.height}:f});break}},[e]),s=ll({callback:r}),i=A.useCallback(c=>{const d=function(u){if(!u)return null;if(u.children.length>1)return u;const f=u.children[0];return Tc(f)?f:u}(c);s==null||s.disconnect(),d&&(s==null||s.observe(d)),o(d?e(d):null)},[e,s]),[a,l]=Ac(i);return A.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const FE=[{sensor:cu,options:{}},{sensor:au,options:{}}],zE={current:{}},cl={draggable:{measure:P1},droppable:{measure:P1,strategy:ki.WhileDragging,frequency:hu.Optimized},dragOverlay:{measure:Gr}};class Si extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,o;return(n=(o=this.get(e))==null?void 0:o.node.current)!=null?n:void 0}}const BE={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Si,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:sl},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:cl,measureDroppableContainers:sl,windowRect:null,measuringScheduled:!1},UE={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:sl,draggableNodes:new Map,over:null,measureDroppableContainers:sl},dl=A.createContext(UE),e0=A.createContext(BE);function VE(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Si}}}function $E(t,e){switch(e.type){case zt.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case zt.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case zt.DragEnd:case zt.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case zt.RegisterDroppable:{const{element:n}=e,{id:o}=n,r=new Si(t.droppable.containers);return r.set(o,n),{...t,droppable:{...t.droppable,containers:r}}}case zt.SetDroppableDisabled:{const{id:n,key:o,disabled:r}=e,s=t.droppable.containers.get(n);if(!s||o!==s.key)return t;const i=new Si(t.droppable.containers);return i.set(n,{...s,disabled:r}),{...t,droppable:{...t.droppable,containers:i}}}case zt.UnregisterDroppable:{const{id:n,key:o}=e,r=t.droppable.containers.get(n);if(!r||o!==r.key)return t;const s=new Si(t.droppable.containers);return s.delete(n),{...t,droppable:{...t.droppable,containers:s}}}default:return t}}function HE(t){let{disabled:e}=t;const{active:n,activatorEvent:o,draggableNodes:r}=A.useContext(dl),s=Mc(o),i=Mc(n==null?void 0:n.id);return A.useEffect(()=>{if(!e&&!o&&s&&i!=null){if(!jp(s)||document.activeElement===s.target)return;const a=r.get(i);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const d of[l.current,c.current]){if(!d)continue;const u=GB(d);if(u){u.focus();break}}})}},[o,e,r,i,s]),null}const t0=A.createContext({...qn,scaleX:1,scaleY:1});var Yo;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(Yo||(Yo={}));const WE=A.memo(function(t){var e,n,o,r;let{id:s,accessibility:i,autoScroll:a=!0,children:l,sensors:c=FE,collisionDetection:d=D1,measuring:u,modifiers:f,...p}=t;const _=A.useReducer($E,void 0,VE),[g,m]=_,[b,x]=function(){const[le]=A.useState(()=>new Set),Ee=A.useCallback(Ie=>(le.add(Ie),()=>le.delete(Ie)),[le]);return[A.useCallback(Ie=>{let{type:Ue,event:We}=Ie;le.forEach(De=>{var Ge;return(Ge=De[Ue])==null?void 0:Ge.call(De,We)})},[le]),Ee]}(),[y,v]=A.useState(Yo.Uninitialized),k=y===Yo.Initialized,{draggable:{active:S,nodes:E,translate:j},droppable:{containers:I}}=g,T=S!=null?E.get(S):null,M=A.useRef({initial:null,translated:null}),L=A.useMemo(()=>{var le;return S!=null?{id:S,data:(le=T==null?void 0:T.data)!=null?le:zE,rect:M}:null},[S,T]),B=A.useRef(null),[O,z]=A.useState(null),[F,V]=A.useState(null),P=ua(p,Object.values(p)),C=da("DndDescribedBy",s),$=A.useMemo(()=>I.getEnabled(),[I]),N=(H=u,A.useMemo(()=>({draggable:{...cl.draggable,...H==null?void 0:H.draggable},droppable:{...cl.droppable,...H==null?void 0:H.droppable},dragOverlay:{...cl.dragOverlay,...H==null?void 0:H.dragOverlay}}),[H==null?void 0:H.draggable,H==null?void 0:H.droppable,H==null?void 0:H.dragOverlay]));var H;const{droppableRects:G,measureDroppableContainers:Z,measuringScheduled:q}=function(le,Ee){let{dragging:Ie,dependencies:Ue,config:We}=Ee;const[De,Ge]=A.useState(null),{frequency:ot,measure:Je,strategy:rt}=We,mt=A.useRef(le),yt=function(){switch(rt){case ki.Always:return!1;case ki.BeforeDragging:return Ie;default:return!Ie}}(),Mt=ua(yt),xt=A.useCallback(function(hn){hn===void 0&&(hn=[]),Mt.current||Ge(rn=>rn===null?hn:rn.concat(hn.filter(Kt=>!rn.includes(Kt))))},[Mt]),Bt=A.useRef(null),Sn=pa(hn=>{if(yt&&!Ie)return G1;if(!hn||hn===G1||mt.current!==le||De!=null){const rn=new Map;for(let Kt of le){if(!Kt)continue;if(De&&De.length>0&&!De.includes(Kt.id)&&Kt.rect.current){rn.set(Kt.id,Kt.rect.current);continue}const Jn=Kt.node.current,ho=Jn?new su(Je(Jn),Jn):null;Kt.rect.current=ho,ho&&rn.set(Kt.id,ho)}return rn}return hn},[le,De,Ie,yt,Je]);return A.useEffect(()=>{mt.current=le},[le]),A.useEffect(()=>{yt||xt()},[Ie,yt]),A.useEffect(()=>{De&&De.length>0&&Ge(null)},[JSON.stringify(De)]),A.useEffect(()=>{yt||typeof ot!="number"||Bt.current!==null||(Bt.current=setTimeout(()=>{xt(),Bt.current=null},ot))},[ot,yt,xt,...Ue]),{droppableRects:Sn,measureDroppableContainers:xt,measuringScheduled:De!=null}}($,{dragging:k,dependencies:[j.x,j.y],config:N.droppable}),re=function(le,Ee){const Ie=Ee!=null?le.get(Ee):void 0,Ue=Ie?Ie.node.current:null;return pa(We=>{var De;return Ee==null?null:(De=Ue??We)!=null?De:null},[Ue,Ee])}(E,S),ne=A.useMemo(()=>F?Ep(F):null,[F]),oe=function(){const le=(O==null?void 0:O.autoScrollEnabled)===!1,Ee=typeof a=="object"?a.enabled===!1:a===!1,Ie=k&&!le&&!Ee;return typeof a=="object"?{...a,enabled:Ie}:{enabled:Ie}}(),Y=function(le,Ee){return Y1(le,Ee)}(re,N.draggable.measure);(function(le){let{activeNode:Ee,measure:Ie,initialRect:Ue,config:We=!0}=le;const De=A.useRef(!1),{x:Ge,y:ot}=typeof We=="boolean"?{x:We,y:We}:We;fr(()=>{if(!Ge&&!ot||!Ee)return void(De.current=!1);if(De.current||!Ue)return;const Je=Ee==null?void 0:Ee.node.current;if(!Je||Je.isConnected===!1)return;const rt=R1(Ie(Je),Ue);if(Ge||(rt.x=0),ot||(rt.y=0),De.current=!0,Math.abs(rt.x)>0||Math.abs(rt.y)>0){const mt=L1(Je);mt&&mt.scrollBy({top:rt.y,left:rt.x})}},[Ee,Ge,ot,Ue,Ie])})({activeNode:S!=null?E.get(S):null,config:oe.layoutShiftCompensation,initialRect:Y,measure:N.draggable.measure});const Q=J1(re,N.draggable.measure,Y),ce=J1(re?re.parentElement:null),he=A.useRef({activatorEvent:null,active:null,activeNode:re,collisionRect:null,collisions:null,droppableRects:G,draggableNodes:E,draggingNode:null,draggingNodeRect:null,droppableContainers:I,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),de=I.getNodeFor((e=he.current.over)==null?void 0:e.id),me=LE({measure:N.dragOverlay.measure}),ie=(n=me.nodeRef.current)!=null?n:re,Ce=k?(o=me.rect)!=null?o:Q:null,we=!!(me.nodeRef.current&&me.rect),ae=R1(ve=we?null:Q,Y1(ve));var ve;const ge=Z1(ie?$o(ie):null),be=function(le){const Ee=A.useRef(le),Ie=pa(Ue=>le?Ue&&Ue!==K1&&le&&Ee.current&&le.parentNode===Ee.current.parentNode?Ue:il(le):K1,[le]);return A.useEffect(()=>{Ee.current=le},[le]),Ie}(k?de??re:null),Te=function(le,Ee){Ee===void 0&&(Ee=Gr);const[Ie]=le,Ue=Z1(Ie?$o(Ie):null),[We,De]=A.useState(Q1);function Ge(){De(()=>le.length?le.map(Je=>B1(Je)?Ue:new su(Ee(Je),Je)):Q1)}const ot=ll({callback:Ge});return fr(()=>{ot==null||ot.disconnect(),Ge(),le.forEach(Je=>ot==null?void 0:ot.observe(Je))},[le]),We}(be),ze=function(le,Ee){let{transform:Ie,...Ue}=Ee;return le!=null&&le.length?le.reduce((We,De)=>De({transform:We,...Ue}),Ie):Ie}(f,{transform:{x:j.x-ae.x,y:j.y-ae.y,scaleX:1,scaleY:1},activatorEvent:F,active:L,activeNodeRect:Q,containerNodeRect:ce,draggingNodeRect:Ce,over:he.current.over,overlayNodeRect:me.rect,scrollableAncestors:be,scrollableAncestorRects:Te,windowRect:ge}),Xe=ne?Gs(ne,j):null,Fe=function(le){const[Ee,Ie]=A.useState(null),Ue=A.useRef(le),We=A.useCallback(De=>{const Ge=ou(De.target);Ge&&Ie(ot=>ot?(ot.set(Ge,ru(Ge)),new Map(ot)):null)},[]);return A.useEffect(()=>{const De=Ue.current;if(le!==De){Ge(De);const ot=le.map(Je=>{const rt=ou(Je);return rt?(rt.addEventListener("scroll",We,{passive:!0}),[rt,ru(rt)]):null}).filter(Je=>Je!=null);Ie(ot.length?new Map(ot):null),Ue.current=le}return()=>{Ge(le),Ge(De)};function Ge(ot){ot.forEach(Je=>{const rt=ou(Je);rt==null||rt.removeEventListener("scroll",We)})}},[We,le]),A.useMemo(()=>le.length?Ee?Array.from(Ee.values()).reduce((De,Ge)=>Gs(De,Ge),qn):V1(le):qn,[le,Ee])}(be),et=X1(Fe),nt=X1(Fe,[Q]),it=Gs(ze,et),te=Ce?SE(Ce,ze):null,Ne=L&&te?d({active:L,collisionRect:te,droppableRects:G,droppableContainers:$,pointerCoordinates:Xe}):null,Me=tu(Ne,"id"),[Be,J]=A.useState(null),pe=function(le,Ee,Ie){return{...le,scaleX:Ee&&Ie?Ee.width/Ie.width:1,scaleY:Ee&&Ie?Ee.height/Ie.height:1}}(we?ze:Gs(ze,nt),(r=Be==null?void 0:Be.rect)!=null?r:null,Q),_e=A.useRef(null),ue=A.useCallback((le,Ee)=>{let{sensor:Ie,options:Ue}=Ee;if(B.current==null)return;const We=E.get(B.current);if(!We)return;const De=le.nativeEvent,Ge=new Ie({active:B.current,activeNode:We,event:De,options:Ue,context:he,onAbort(Je){if(!E.get(Je))return;const{onDragAbort:rt}=P.current,mt={id:Je};rt==null||rt(mt),b({type:"onDragAbort",event:mt})},onPending(Je,rt,mt,yt){if(!E.get(Je))return;const{onDragPending:Mt}=P.current,xt={id:Je,constraint:rt,initialCoordinates:mt,offset:yt};Mt==null||Mt(xt),b({type:"onDragPending",event:xt})},onStart(Je){const rt=B.current;if(rt==null)return;const mt=E.get(rt);if(!mt)return;const{onDragStart:yt}=P.current,Mt={activatorEvent:De,active:{id:rt,data:mt.data,rect:M}};fa.unstable_batchedUpdates(()=>{yt==null||yt(Mt),v(Yo.Initializing),m({type:zt.DragStart,initialCoordinates:Je,active:rt}),b({type:"onDragStart",event:Mt}),z(_e.current),V(De)})},onMove(Je){m({type:zt.DragMove,coordinates:Je})},onEnd:ot(zt.DragEnd),onCancel:ot(zt.DragCancel)});function ot(Je){return async function(){const{active:rt,collisions:mt,over:yt,scrollAdjustedTranslate:Mt}=he.current;let xt=null;if(rt&&Mt){const{cancelDrop:Bt}=P.current;xt={activatorEvent:De,active:rt,collisions:mt,delta:Mt,over:yt},Je===zt.DragEnd&&typeof Bt=="function"&&await Promise.resolve(Bt(xt))&&(Je=zt.DragCancel)}B.current=null,fa.unstable_batchedUpdates(()=>{m({type:Je}),v(Yo.Uninitialized),J(null),z(null),V(null),_e.current=null;const Bt=Je===zt.DragEnd?"onDragEnd":"onDragCancel";if(xt){const Sn=P.current[Bt];Sn==null||Sn(xt),b({type:Bt,event:xt})}})}}_e.current=Ge},[E]),je=A.useCallback((le,Ee)=>(Ie,Ue)=>{const We=Ie.nativeEvent,De=E.get(Ue);if(B.current!==null||!De||We.dndKit||We.defaultPrevented)return;const Ge={active:De};le(Ie,Ee.options,Ge)===!0&&(We.dndKit={capturedBy:Ee.sensor},B.current=Ue,ue(Ie,Ee))},[E,ue]),ke=function(le,Ee){return A.useMemo(()=>le.reduce((Ie,Ue)=>{const{sensor:We}=Ue;return[...Ie,...We.activators.map(De=>({eventName:De.eventName,handler:Ee(De.handler,Ue)}))]},[]),[le,Ee])}(c,je);(function(le){A.useEffect(()=>{if(!Ip)return;const Ee=le.map(Ie=>{let{sensor:Ue}=Ie;return Ue.setup==null?void 0:Ue.setup()});return()=>{for(const Ie of Ee)Ie==null||Ie()}},le.map(Ee=>{let{sensor:Ie}=Ee;return Ie}))})(c),fr(()=>{Q&&y===Yo.Initializing&&v(Yo.Initialized)},[Q,y]),A.useEffect(()=>{const{onDragMove:le}=P.current,{active:Ee,activatorEvent:Ie,collisions:Ue,over:We}=he.current;if(!Ee||!Ie)return;const De={active:Ee,activatorEvent:Ie,collisions:Ue,delta:{x:it.x,y:it.y},over:We};fa.unstable_batchedUpdates(()=>{le==null||le(De),b({type:"onDragMove",event:De})})},[it.x,it.y]),A.useEffect(()=>{const{active:le,activatorEvent:Ee,collisions:Ie,droppableContainers:Ue,scrollAdjustedTranslate:We}=he.current;if(!le||B.current==null||!Ee||!We)return;const{onDragOver:De}=P.current,Ge=Ue.get(Me),ot=Ge&&Ge.rect.current?{id:Ge.id,rect:Ge.rect.current,data:Ge.data,disabled:Ge.disabled}:null,Je={active:le,activatorEvent:Ee,collisions:Ie,delta:{x:We.x,y:We.y},over:ot};fa.unstable_batchedUpdates(()=>{J(ot),De==null||De(Je),b({type:"onDragOver",event:Je})})},[Me]),fr(()=>{he.current={activatorEvent:F,active:L,activeNode:re,collisionRect:te,collisions:Ne,droppableRects:G,draggableNodes:E,draggingNode:ie,draggingNodeRect:Ce,droppableContainers:I,over:Be,scrollableAncestors:be,scrollAdjustedTranslate:it},M.current={initial:Ce,translated:te}},[L,re,Ne,te,E,ie,Ce,G,I,Be,be,it]),DE({...oe,delta:j,draggingRect:te,pointerCoordinates:Xe,scrollableAncestors:be,scrollableAncestorRects:Te});const Ve=A.useMemo(()=>({active:L,activeNode:re,activeNodeRect:Q,activatorEvent:F,collisions:Ne,containerNodeRect:ce,dragOverlay:me,draggableNodes:E,droppableContainers:I,droppableRects:G,over:Be,measureDroppableContainers:Z,scrollableAncestors:be,scrollableAncestorRects:Te,measuringConfiguration:N,measuringScheduled:q,windowRect:ge}),[L,re,Q,F,Ne,ce,me,E,I,G,Be,Z,be,Te,N,q,ge]),Ze=A.useMemo(()=>({activatorEvent:F,activators:ke,active:L,activeNodeRect:Q,ariaDescribedById:{draggable:C},dispatch:m,draggableNodes:E,over:Be,measureDroppableContainers:Z}),[F,ke,L,Q,m,C,E,Be,Z]);return K.createElement(T1.Provider,{value:x},K.createElement(dl.Provider,{value:Ze},K.createElement(e0.Provider,{value:Ve},K.createElement(t0.Provider,{value:pe},l)),K.createElement(HE,{disabled:(i==null?void 0:i.restoreFocus)===!1})),K.createElement(yE,{...i,hiddenTextDescribedById:C}))}),qE=A.createContext(null),n0="button";function GE(t){let{id:e,data:n,disabled:o=!1,attributes:r}=t;const s=da("Draggable"),{activators:i,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:d,draggableNodes:u,over:f}=A.useContext(dl),{role:p=n0,roleDescription:_="draggable",tabIndex:g=0}=r??{},m=(l==null?void 0:l.id)===e,b=A.useContext(m?t0:qE),[x,y]=Ac(),[v,k]=Ac(),S=function(j,I){return A.useMemo(()=>j.reduce((T,M)=>{let{eventName:L,handler:B}=M;return T[L]=O=>{B(O,I)},T},{}),[j,I])}(i,e),E=ua(n);return fr(()=>(u.set(e,{id:e,key:s,node:x,activatorNode:v,data:E}),()=>{const j=u.get(e);j&&j.key===s&&u.delete(e)}),[u,e]),{active:l,activatorEvent:a,activeNodeRect:c,attributes:A.useMemo(()=>({role:p,tabIndex:g,"aria-disabled":o,"aria-pressed":!(!m||p!==n0)||void 0,"aria-roledescription":_,"aria-describedby":d.draggable}),[o,p,g,m,_,d.draggable]),isDragging:m,listeners:o?void 0:S,node:x,over:f,setNodeRef:y,setActivatorNodeRef:k,transform:b}}const YE={timeout:25};function o0(t,e,n){const o=t.slice();return o.splice(n<0?o.length+n:n,0,o.splice(e,1)[0]),o}function JE(t,e){return t.reduce((n,o,r)=>{const s=e.get(o);return s&&(n[r]=s),n},Array(t.length))}function ul(t){return t!==null&&t>=0}const hl={scaleX:1,scaleY:1},KE=t=>{var e;let{rects:n,activeNodeRect:o,activeIndex:r,overIndex:s,index:i}=t;const a=(e=n[r])!=null?e:o;if(!a)return null;const l=function(c,d,u){const f=c[d],p=c[d-1],_=c[d+1];return!f||!p&&!_?0:u<d?p?f.left-(p.left+p.width):_.left-(f.left+f.width):_?_.left-(f.left+f.width):f.left-(p.left+p.width)}(n,i,r);if(i===r){const c=n[s];return c?{x:r<s?c.left+c.width-(a.left+a.width):c.left-a.left,y:0,...hl}:null}return i>r&&i<=s?{x:-a.width-l,y:0,...hl}:i<r&&i>=s?{x:a.width+l,y:0,...hl}:{x:0,y:0,...hl}},r0=t=>{let{rects:e,activeIndex:n,overIndex:o,index:r}=t;const s=o0(e,o,n),i=e[r],a=s[r];return a&&i?{x:a.left-i.left,y:a.top-i.top,scaleX:a.width/i.width,scaleY:a.height/i.height}:null},fl={scaleX:1,scaleY:1},XE=t=>{var e;let{activeIndex:n,activeNodeRect:o,index:r,rects:s,overIndex:i}=t;const a=(e=s[n])!=null?e:o;if(!a)return null;if(r===n){const c=s[i];return c?{x:0,y:n<i?c.top+c.height-(a.top+a.height):c.top-a.top,...fl}:null}const l=function(c,d,u){const f=c[d],p=c[d-1],_=c[d+1];return f?u<d?p?f.top-(p.top+p.height):_?_.top-(f.top+f.height):0:_?_.top-(f.top+f.height):p?f.top-(p.top+p.height):0:0}(s,r,n);return r>n&&r<=i?{x:0,y:-a.height-l,...fl}:r<n&&r>=i?{x:0,y:a.height+l,...fl}:{x:0,y:0,...fl}},s0="Sortable",i0=K.createContext({activeIndex:-1,containerId:s0,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:r0,disabled:{draggable:!1,droppable:!1}});function a0(t){let{children:e,id:n,items:o,strategy:r=r0,disabled:s=!1}=t;const{active:i,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:d}=A.useContext(e0),u=da(s0,n),f=a.rect!==null,p=A.useMemo(()=>o.map(S=>typeof S=="object"&&"id"in S?S.id:S),[o]),_=i!=null,g=i?p.indexOf(i.id):-1,m=c?p.indexOf(c.id):-1,b=A.useRef(p),x=!function(S,E){if(S===E)return!0;if(S.length!==E.length)return!1;for(let j=0;j<S.length;j++)if(S[j]!==E[j])return!1;return!0}(p,b.current),y=m!==-1&&g===-1||x,v=function(S){return typeof S=="boolean"?{draggable:S,droppable:S}:S}(s);fr(()=>{x&&_&&d(p)},[x,p,_,d]),A.useEffect(()=>{b.current=p},[p]);const k=A.useMemo(()=>({activeIndex:g,containerId:u,disabled:v,disableTransforms:y,items:p,overIndex:m,useDragOverlay:f,sortedRects:JE(p,l),strategy:r}),[g,u,v.draggable,v.droppable,y,p,m,l,f,r]);return K.createElement(i0.Provider,{value:k},e)}const ZE=t=>{let{id:e,items:n,activeIndex:o,overIndex:r}=t;return o0(n,o,r).indexOf(e)},QE=t=>{let{containerId:e,isSorting:n,wasDragging:o,index:r,items:s,newIndex:i,previousItems:a,previousContainerId:l,transition:c}=t;return!(!c||!o)&&(a===s||r!==i)&&(!!n||i!==r&&e===l)},e5={duration:200,easing:"ease"},l0="transform",t5=Oc.Transition.toString({property:l0,duration:0,easing:"linear"}),n5={roleDescription:"sortable"};function c0(t){let{animateLayoutChanges:e=QE,attributes:n,disabled:o,data:r,getNewIndex:s=ZE,id:i,strategy:a,resizeObserverConfig:l,transition:c=e5}=t;const{items:d,containerId:u,activeIndex:f,disabled:p,disableTransforms:_,sortedRects:g,overIndex:m,useDragOverlay:b,strategy:x}=A.useContext(i0),y=function(de,me){var ie,Ce;return typeof de=="boolean"?{draggable:de,droppable:!1}:{draggable:(ie=de==null?void 0:de.draggable)!=null?ie:me.draggable,droppable:(Ce=de==null?void 0:de.droppable)!=null?Ce:me.droppable}}(o,p),v=d.indexOf(i),k=A.useMemo(()=>({sortable:{containerId:u,index:v,items:d},...r}),[u,r,v,d]),S=A.useMemo(()=>d.slice(d.indexOf(i)),[d,i]),{rect:E,node:j,isOver:I,setNodeRef:T}=function(de){let{data:me,disabled:ie=!1,id:Ce,resizeObserverConfig:we}=de;const ae=da("Droppable"),{active:ve,dispatch:ge,over:be,measureDroppableContainers:Te}=A.useContext(dl),ze=A.useRef({disabled:ie}),Xe=A.useRef(!1),Fe=A.useRef(null),et=A.useRef(null),{disabled:nt,updateMeasurementsFor:it,timeout:te}={...YE,...we},Ne=ua(it??Ce),Me=ll({callback:A.useCallback(()=>{Xe.current?(et.current!=null&&clearTimeout(et.current),et.current=setTimeout(()=>{Te(Array.isArray(Ne.current)?Ne.current:[Ne.current]),et.current=null},te)):Xe.current=!0},[te]),disabled:nt||!ve}),Be=A.useCallback((ue,je)=>{Me&&(je&&(Me.unobserve(je),Xe.current=!1),ue&&Me.observe(ue))},[Me]),[J,pe]=Ac(Be),_e=ua(me);return A.useEffect(()=>{Me&&J.current&&(Me.disconnect(),Xe.current=!1,Me.observe(J.current))},[J,Me]),A.useEffect(()=>(ge({type:zt.RegisterDroppable,element:{id:Ce,key:ae,disabled:ie,node:J,rect:Fe,data:_e}}),()=>ge({type:zt.UnregisterDroppable,key:ae,id:Ce})),[Ce]),A.useEffect(()=>{ie!==ze.current.disabled&&(ge({type:zt.SetDroppableDisabled,id:Ce,key:ae,disabled:ie}),ze.current.disabled=ie)},[Ce,ae,ie,ge]),{active:ve,rect:Fe,isOver:(be==null?void 0:be.id)===Ce,node:J,over:be,setNodeRef:pe}}({id:i,data:k,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...l}}),{active:M,activatorEvent:L,activeNodeRect:B,attributes:O,setNodeRef:z,listeners:F,isDragging:V,over:P,setActivatorNodeRef:C,transform:$}=GE({id:i,data:k,attributes:{...n5,...n},disabled:y.draggable}),N=JB(T,z),H=!!M,G=H&&!_&&ul(f)&&ul(m),Z=!b&&V,q=Z&&G?$:null,re=G?q??(a??x)({rects:g,activeNodeRect:B,activeIndex:f,overIndex:m,index:v}):null,ne=ul(f)&&ul(m)?s({id:i,items:d,activeIndex:f,overIndex:m}):v,oe=M==null?void 0:M.id,Y=A.useRef({activeId:oe,items:d,newIndex:ne,containerId:u}),Q=d!==Y.current.items,ce=e({active:M,containerId:u,isDragging:V,isSorting:H,id:i,index:v,items:d,newIndex:Y.current.newIndex,previousItems:Y.current.items,previousContainerId:Y.current.containerId,transition:c,wasDragging:Y.current.activeId!=null}),he=function(de){let{disabled:me,index:ie,node:Ce,rect:we}=de;const[ae,ve]=A.useState(null),ge=A.useRef(ie);return fr(()=>{if(!me&&ie!==ge.current&&Ce.current){const be=we.current;if(be){const Te=Gr(Ce.current,{ignoreTransform:!0}),ze={x:be.left-Te.left,y:be.top-Te.top,scaleX:be.width/Te.width,scaleY:be.height/Te.height};(ze.x||ze.y)&&ve(ze)}}ie!==ge.current&&(ge.current=ie)},[me,ie,Ce,we]),A.useEffect(()=>{ae&&ve(null)},[ae]),ae}({disabled:!ce,index:v,node:j,rect:E});return A.useEffect(()=>{H&&Y.current.newIndex!==ne&&(Y.current.newIndex=ne),u!==Y.current.containerId&&(Y.current.containerId=u),d!==Y.current.items&&(Y.current.items=d)},[H,ne,u,d]),A.useEffect(()=>{if(oe===Y.current.activeId)return;if(oe!=null&&Y.current.activeId==null)return void(Y.current.activeId=oe);const de=setTimeout(()=>{Y.current.activeId=oe},50);return()=>clearTimeout(de)},[oe]),{active:M,activeIndex:f,attributes:O,data:k,rect:E,index:v,newIndex:ne,items:d,isOver:I,isSorting:H,isDragging:V,listeners:F,node:j,overIndex:m,over:P,setNodeRef:N,setActivatorNodeRef:C,setDroppableNodeRef:T,setDraggableNodeRef:z,transform:he??re,transition:function(){if(he||Q&&Y.current.newIndex===v)return t5;if(!(Z&&!jp(L)||!c)&&(H||ce))return Oc.Transition.toString({...c,property:l0})}()}}function pl(t){if(!t)return!1;const e=t.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}const o5=[ct.Down,ct.Right,ct.Up,ct.Left],r5=(t,e)=>{let{context:{active:n,collisionRect:o,droppableRects:r,droppableContainers:s,over:i,scrollableAncestors:a}}=e;if(o5.includes(t.code)){if(t.preventDefault(),!n||!o)return;const l=[];s.getEnabled().forEach(u=>{if(!u||u!=null&&u.disabled)return;const f=r.get(u.id);if(f)switch(t.code){case ct.Down:o.top<f.top&&l.push(u);break;case ct.Up:o.top>f.top&&l.push(u);break;case ct.Left:o.left>f.left&&l.push(u);break;case ct.Right:o.left<f.left&&l.push(u)}});const c=(u=>{let{collisionRect:f,droppableRects:p,droppableContainers:_}=u;const g=eu(f),m=[];for(const b of _){const{id:x}=b,y=p.get(x);if(y){const v=eu(y),k=g.reduce((E,j,I)=>E+Zd(v[I],j),0),S=Number((k/4).toFixed(4));m.push({id:x,data:{droppableContainer:b,value:S}})}}return m.sort(Qd)})({collisionRect:o,droppableRects:r,droppableContainers:l});let d=tu(c,"id");if(d===(i==null?void 0:i.id)&&c.length>1&&(d=c[1].id),d!=null){const u=s.get(n.id),f=s.get(d),p=f?r.get(f.id):null,_=f==null?void 0:f.node.current;if(_&&p&&u&&f){const g=il(_).some((v,k)=>a[k]!==v),m=d0(u,f),b=function(v,k){return!pl(v)||!pl(k)||!d0(v,k)?!1:v.data.current.sortable.index<k.data.current.sortable.index}(u,f),x=g||!m?{x:0,y:0}:{x:b?o.width-p.width:0,y:b?o.height-p.height:0},y={x:p.left,y:p.top};return x.x&&x.y?y:ha(y,x)}}}};function d0(t,e){return!(!pl(t)||!pl(e))&&t.data.current.sortable.containerId===e.data.current.sortable.containerId}function ml(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}const u0=K.createContext(null),h0=A.memo(()=>A.useContext(u0));h0.displayName="DragHandle";const f0=K.forwardRef((t,e)=>{const n=X.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:u,transition:f,isDragging:p}=c0(a);let _;n[8]!==u?(_=function(x){return!x||x.x===0&&x.y===0&&x.scaleX===1&&x.scaleY===1}(u)?null:u,n[8]=u,n[9]=_):_=n[9];const g=_,m=g==null?void 0:f;let b;return n[10]!==l||n[11]!==o||n[12]!==r||n[13]!==p||n[14]!==c||n[15]!==s||n[16]!==e||n[17]!==d||n[18]!==g||n[19]!==m?(b=h.jsx(p0,{ref:e,cellId:r,canMoveX:o,...s,attributes:l,listeners:c,setNodeRef:d,transform:g,transition:m,isDragging:p}),n[10]=l,n[11]=o,n[12]=r,n[13]=p,n[14]=c,n[15]=s,n[16]=e,n[17]=d,n[18]=g,n[19]=m,n[20]=b):b=n[20],b});f0.displayName="SortableCell";const p0=K.forwardRef((t,e)=>{const n=X.c(37);let o,r,s,i,a,l,c,d,u,f;if(n[0]!==t){const{cellId:I,canMoveX:T,children:M,attributes:L,listeners:B,setNodeRef:O,transform:z,transition:F,isDragging:V,...P}=t;r=T,s=M,o=L,a=B,c=O,d=z,u=F,i=V,l=P,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]=u}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],u=n[9];n[10]!==r||n[11]!==d?(f=d?Oc.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 p=i?2:void 0;let _;n[13]!==f||n[14]!==p||n[15]!==u?(_={transform:f,transition:u,zIndex:p,position:"relative"},n[13]=f,n[14]=p,n[15]=u,n[16]=_):_=n[16];const g=_;let m,b;n[17]===Symbol.for("react.memo_cache_sentinel")?(m=h.jsx(bm,{strokeWidth:1,size:20}),n[17]=m):m=n[17],n[18]!==o||n[19]!==a?(b=h.jsx("div",{...o,...a,onMouseDown:Vn.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:m}),n[18]=o,n[19]=a,n[20]=b):b=n[20];const x=b,y=!!d;let v;n[21]!==e||n[22]!==c?(v=I=>{ml(e,c)(I)},n[21]=e,n[22]=c,n[23]=v):v=n[23];const k=y&&"is-moving";let S,E,j;return n[24]!==l.className||n[25]!==k?(S=Oe(l.className,k,"outline-offset-4 outline-primary/40 rounded-lg"),n[24]=l.className,n[25]=k,n[26]=S):S=n[26],n[27]!==s||n[28]!==x?(E=h.jsx(u0.Provider,{value:x,children:s}),n[27]=s,n[28]=x,n[29]=E):E=n[29],n[30]!==i||n[31]!==l||n[32]!==g||n[33]!==v||n[34]!==S||n[35]!==E?(j=h.jsx("div",{tabIndex:-1,ref:v,...l,"data-is-dragging":i,className:S,style:g,children:E}),n[30]=i,n[31]=l,n[32]=g,n[33]=v,n[34]=S,n[35]=E,n[36]=j):j=n[36],j});p0.displayName="SortableCellInternal";const m0=K.memo(K.forwardRef((t,e)=>{const n=X.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=ld(c),u=XB();let f,p,_,g,m,b;if(n[6]===Symbol.for("react.memo_cache_sentinel")?(f=()=>({toggle:()=>l(s5)}),n[6]=f):f=n[6],A.useImperativeHandle(e,f),n[7]===Symbol.for("react.memo_cache_sentinel")?(p=h.jsx(Qi,{placeholder:"Search actions...",className:"h-6 m-1"}),n[7]=p):p=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(_=h.jsx(dc,{children:"No results"}),n[8]=_):_=n[8],n[9]!==d){let j;n[11]!==d.length?(j=(I,T)=>h.jsxs(A.Fragment,{children:[h.jsx(lp,{children:I.map(M=>{let L=h.jsxs("div",{className:"flex items-center flex-1",children:[M.icon&&h.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:M.icon}),h.jsx("div",{className:"flex-1",children:M.label}),h.jsxs("div",{className:"flex-shrink-0 text-sm",children:[M.hotkey&&g4(M.hotkey),M.rightElement]})]});return M.tooltip&&(L=h.jsx(Re,{content:M.tooltip,delayDuration:100,children:L})),h.jsx(po,{className:Oe(M.disabled&&"!opacity-50"),onSelect:()=>{M.disableClick||M.disabled||(M.handle(),l(!1))},variant:M.variant,children:L},M.label)})},T),T<d.length-1&&h.jsx(P3,{})]},T),n[11]=d.length,n[12]=j):j=n[12],g=d.map(j),n[9]=d,n[10]=g}else g=n[10];n[13]!==g?(m=h.jsxs(xc,{children:[p,h.jsxs(Tp,{children:[_,g]})]}),n[13]=g,n[14]=m):m=n[14],n[15]!==u||n[16]!==m?(b=h.jsx(Vs,{className:"w-[300px] p-0 pt-1 overflow-auto",scrollable:!0,...u,children:m}),n[15]=u,n[16]=m,n[17]=b):b=n[17];const x=b;if(!i){let j,I;return n[18]!==o?(j=h.jsx(Ys,{asChild:!0,children:o}),n[18]=o,n[19]=j):j=n[19],n[20]!==x||n[21]!==a||n[22]!==j?(I=h.jsxs(Pr,{open:a,onOpenChange:l,children:[j,x]}),n[20]=x,n[21]=a,n[22]=j,n[23]=I):I=n[23],I}let y;n[24]===Symbol.for("react.memo_cache_sentinel")?(y=h.jsx(ZB,{tabIndex:-1,children:pn("cell.cellActions")}),n[24]=y):y=n[24];const v=!a&&y;let k,S,E;return n[25]!==o?(k=h.jsx(QB,{children:h.jsx(Ys,{className:"flex",children:o})}),n[25]=o,n[26]=k):k=n[26],n[27]!==v||n[28]!==k?(S=h.jsxs(eU,{delayDuration:200,disableHoverableContent:!0,children:[v,k]}),n[27]=v,n[28]=k,n[29]=S):S=n[29],n[30]!==x||n[31]!==a||n[32]!==S?(E=h.jsxs(Pr,{open:a,onOpenChange:l,children:[S,x]}),n[30]=x,n[31]=a,n[32]=S,n[33]=E):E=n[33],E})),g0=K.memo(t=>{const e=X.c(5),{children:n,cellId:o}=t;let r,s;e[0]!==o?(s=KB(o),e[0]=o,e[1]=s):s=e[1],r=s;const i=He(r);if(!i)return null;let a;return e[2]!==n||e[3]!==i?(a=h.jsx(m0,{showTooltip:!1,...i,children:n}),e[2]=n,e[3]=i,e[4]=a):a=e[4],a});function s5(t){return!t}g0.displayName="ConnectionCellActionsDropdown";const _0=t=>{const e=X.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=ld(r),[i,a]=K.useState(),l=!!i;let c,d,u,f,p,_,g,m,b,x;if(e[5]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(Ls,{size:13,strokeWidth:1.5}),e[5]=c):c=e[5],e[6]!==o?(d=async()=>{var k;if((k=window.getSelection())==null?void 0:k.toString())return void document.execCommand("copy");const v=document.getElementById(S3.create(o.cellId));v?await yn(v.textContent??""):Xt.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 y=[{label:"Copy",hidden:l,icon:c,handle:d},{label:"Cut",hidden:!!i,icon:h.jsx(Qc,{size:13,strokeWidth:1.5}),handle:i5},{label:"Paste",hidden:!!i,icon:h.jsx(cm,{size:13,strokeWidth:1.5}),handle:async()=>{const{getEditorView:S}=o,E=S();if(E)try{const j=await navigator.clipboard.readText();if(j){const{from:I,to:T}=E.state.selection.main,M=E.state.update({changes:{from:I,to:T,insert:j}});E.dispatch(M)}}catch(j){const I=j;Xt.error("Failed to paste from clipboard",I),tU({command:"paste"})}}},{label:"Copy image",hidden:!i,icon:h.jsx(Wc,{size:13,strokeWidth:1.5}),handle:async()=>{if(i){const S=await fetch(i.src),E=await S.blob(),j=new ClipboardItem({[E.type]:E});await navigator.clipboard.write([j]).then(a5).catch(l5)}}},{icon:h.jsx(Xp,{size:13,strokeWidth:1.5}),label:"Download image",hidden:!i,handle:()=>{if(i){const S=document.createElement("a");S.download="image.png",S.href=i.src,S.click()}}},{label:"Go to Definition",icon:h.jsx(oU,{size:13,strokeWidth:1.5}),handle:()=>{const{getEditorView:S}=o,E=S();E&&nU(E)}}],v=[y,...s];let k;f=w1,e[20]===Symbol.for("react.memo_cache_sentinel")?(k=S=>{S.target instanceof HTMLImageElement?a(S.target):a(void 0)},e[20]=k):k=e[20],e[21]!==n?(m=h.jsx(v1,{onContextMenu:k,asChild:!0,children:n}),e[21]=n,e[22]=m):m=e[22],u=Xd,p="w-[300px]",_=!0,g=v.map((S,E)=>h.jsxs(A.Fragment,{children:[S.map(c5),E<v.length-1&&h.jsx(S1,{})]},E)),e[8]=s,e[9]=n,e[10]=i,e[11]=o,e[12]=l,e[13]=d,e[14]=u,e[15]=f,e[16]=p,e[17]=_,e[18]=g,e[19]=m}else u=e[14],f=e[15],p=e[16],_=e[17],g=e[18],m=e[19];return e[23]!==u||e[24]!==p||e[25]!==_||e[26]!==g?(b=h.jsx(u,{className:p,scrollable:_,children:g}),e[23]=u,e[24]=p,e[25]=_,e[26]=g,e[27]=b):b=e[27],e[28]!==f||e[29]!==m||e[30]!==b?(x=h.jsxs(f,{children:[m,b]}),e[28]=f,e[29]=m,e[30]=b,e[31]=x):x=e[31],x};function i5(){document.execCommand("cut")}function a5(){lt({title:"Copied image to clipboard"})}function l5(t){lt({title:"Failed to copy image to clipboard. Try downloading instead.",description:t.message}),Xt.error("Failed to copy image to clipboard",t)}function c5(t){if(t.hidden)return null;let e=h.jsxs("div",{className:"flex items-center flex-1",children:[t.icon&&h.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:t.icon}),h.jsx("div",{className:"flex-1",children:t.label}),h.jsxs("div",{className:"flex-shrink-0 text-sm",children:[t.hotkey&&g4(t.hotkey),t.rightElement]})]});return t.tooltip&&(e=h.jsx(Re,{delayDuration:100,content:t.tooltip,children:e})),h.jsx(yi,{className:t.disabled?"!opacity-50":"",onSelect:n=>{t.disableClick||t.disabled||t.handle(n)},variant:t.variant,children:e},t.label)}const d5=t=>{const e=X.c(24),{editorView:n,code:o,currentLanguageAdapter:r,onAfterToggle:s}=t;let i,a;e[0]!==o?(a=new ta().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 Ec().isSupported(o)||o.trim()==="",e[2]=o,e[3]=d):d=e[3],c=d;const u=c&&r==="python";let f,p;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=h.jsx(lr,{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]!==u?(p=h.jsx(fu,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:u,icon:f,toType:"sql",displayName:"SQL",onAfterToggle:s}),e[5]=r,e[6]=n,e[7]=s,e[8]=u,e[9]=p):p=e[9];const _=l&&r==="python";let g,m,b,x,y;return e[10]===Symbol.for("react.memo_cache_sentinel")?(g=h.jsx(ic,{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]!==_?(m=h.jsx(fu,{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]=m):m=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(b=h.jsx(ac,{fill:"var(--sky-11)",color:"black",className:"w-4 h-4"}),e[16]=b):b=e[16],e[17]!==r||e[18]!==n?(x=h.jsx(fu,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:!0,icon:b,toType:"python",displayName:"Python",onAfterToggle:jn.NOOP}),e[17]=r,e[18]=n,e[19]=x):x=e[19],e[20]!==m||e[21]!==x||e[22]!==p?(y=h.jsxs("div",{className:"absolute right-3 top-2 z-20 flex hover-action gap-1",children:[p,m,x]}),e[20]=m,e[21]=x,e[22]=p,e[23]=y):y=e[23],y},fu=t=>{const e=X.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&&(Or(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 u=`View as ${a}`;let f,p;return e[4]!==d||e[5]!==s?(f=h.jsx(Pe,{"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]!==u||e[8]!==f?(p=h.jsx(Re,{content:u,children:f}),e[7]=u,e[8]=f,e[9]=p):p=e[9],p};var b0={modified:{doc:""},original:{doc:""}},y0=A.createContext(b0);function u5(t,e){return jt({},t,e,{modified:jt({},t.modified,e.modified),original:jt({},t.original,e.original)})}var pu=()=>A.useContext(y0),h5=t=>{var{children:e,theme:n}=t,[o,r]=A.useReducer(u5,jt({},b0,{theme:n}));return A.useEffect(()=>r({theme:n}),[n]),h.jsx(y0.Provider,{value:jt({},o,{dispatch:r}),children:e})},f5=["extensions","value","selection","onChange"],x0=t=>{var{extensions:e=[],value:n,selection:o,onChange:r}=t,s=ma(t,f5),{theme:i,dispatch:a}=pu(),l=Js(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};x0.displayName="CodeMirrorMerge.Original";var p5=["extensions","value","selection","onChange"],w0=t=>{var{extensions:e=[],value:n,selection:o,onChange:r}=t,s=ma(t,p5),{theme:i,dispatch:a}=pu(),l=Js(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};w0.displayName="CodeMirrorMerge.Modified";class At{constructor(e,n,o,r){this.fromA=e,this.toA=n,this.fromB=o,this.toB=r}offset(e,n){return new At(this.fromA+e,this.toA+e,this.fromB+n,this.toB+n)}}function jr(t,e,n,o,r,s){if(t==o)return[];let i=_u(t,e,n,o,r,s),a=bu(t,e+i,n,o,r+i,s),l=(n-=a)-(e+=i),c=(s-=a)-(r+=i);if(!l||!c)return[new At(e,n,r,s)];if(l>c){let u=t.slice(e,n).indexOf(o.slice(r,s));if(u>-1)return[new At(e,e+u,r,r),new At(e+u+c,n,s,s)]}else if(c>l){let u=o.slice(r,s).indexOf(t.slice(e,n));if(u>-1)return[new At(e,e,r,r+u),new At(n,n,r+u+l,s)]}if(l==1||c==1)return[new At(e,n,r,s)];let d=S0(t,e,n,o,r,s);if(d){let[u,f,p]=d;return jr(t,e,u,o,r,f).concat(jr(t,u+p,n,o,f+p,s))}return function(u,f,p,_,g,m){let b=p-f,x=m-g;if(Ci<1e9&&Math.min(b,x)>16*Ci)return Math.min(b,x)>64*Ci?[new At(f,p,g,m)]:C0(u,f,p,_,g,m);let y=Math.ceil((b+x)/2);mu.reset(y),gu.reset(y);let v=(j,I)=>u.charCodeAt(f+j)==_.charCodeAt(g+I),k=(j,I)=>u.charCodeAt(p-j-1)==_.charCodeAt(m-I-1),S=(b-x)%2!=0?gu:null,E=S?null:mu;for(let j=0;j<y;j++){if(j>Ci)return C0(u,f,p,_,g,m);let I=mu.advance(j,b,x,y,S,!1,v)||gu.advance(j,b,x,y,E,!0,k);if(I)return m5(u,f,p,f+I[0],_,g,m,g+I[1])}return[new At(f,p,g,m)]}(t,e,n,o,r,s)}let Ci=1e9;class v0{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,u=d-l;for(;d<n&&u<o&&a(d,u);)d++,u++;if(this.vec[c]=d,d>n)this.end+=2;else if(u>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 p=s.vec[f];if(p>=n-d)return[p,r+p-f]}else if(d>=n-s.vec[f])return[d,u]}}}return null}}const mu=new v0,gu=new v0;function m5(t,e,n,o,r,s,i,a){let l=!1;return Yr(t,o)||++o!=n||(l=!0),Yr(r,a)||++a!=i||(l=!0),l?[new At(e,n,s,i)]:jr(t,e,o,r,s,a).concat(jr(t,o,n,r,a,i))}function k0(t,e){let n=1,o=Math.min(t,e);for(;n<o;)n<<=1;return n}function _u(t,e,n,o,r,s){if(e==n||e==s||t.charCodeAt(e)!=o.charCodeAt(r))return 0;let i=k0(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-(Yr(t,a)?0:1);i>>=1}else{if(c==n||d==s)return c-e;a=c,l=d}}}function bu(t,e,n,o,r,s){if(e==n||r==s||t.charCodeAt(n-1)!=o.charCodeAt(s-1))return 0;let i=k0(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-(Yr(t,a)?0:1);i>>=1}else{if(c==e||d==r)return n-c;a=c,l=d}}}function yu(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;;){Yr(t,d)||d++;let u=d+i;if(Yr(t,u)||(u+=u==d+1?1:-1),u>=n)break;let f=t.slice(d,u),p=-1;for(;(p=l.indexOf(f,p+1))!=-1;){let _=_u(t,u,n,o,r+p+f.length,s),g=bu(t,e,d,o,r,r+p),m=f.length+_+g;(!c||c[2]<m)&&(c=[d-g,r+p-g,m])}d=u}if(a<0)return c;i>>=1}}function S0(t,e,n,o,r,s){let i=n-e,a=s-r;if(i<a){let l=S0(o,r,s,t,e,n);return l&&[l[1],l[0],l[2]]}return i<4||2*a<i?null:yu(t,e,n,o,r,s,Math.floor(i/4),-1)}function C0(t,e,n,o,r,s){let i,a=n-e,l=s-r;if(a<l){let f=yu(o,r,s,t,e,n,Math.floor(a/6),50);i=f&&[f[1],f[0],f[2]]}else i=yu(t,e,n,o,r,s,Math.floor(l/6),50);if(!i)return[new At(e,n,r,s)];let[c,d,u]=i;return jr(t,e,c,o,r,d).concat(jr(t,c+u,n,o,d+u,s))}function N0(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 At(o.fromA,r.toA,o.fromB,r.toB),t.splice(n--,1))}}let Er;try{Er=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function j0(t){return t>48&&t<58||t>64&&t<91||t>96&&t<123}function E0(t,e){if(e==t.length)return 0;let n=t.charCodeAt(e);return n<192?j0(n)?1:0:Er?M0(n)&&e!=t.length-1?Er.test(t.slice(e,e+2))?2:0:Er.test(String.fromCharCode(n))?1:0:0}function I0(t,e){if(!e)return 0;let n=t.charCodeAt(e-1);return n<192?j0(n)?1:0:Er?O0(n)&&e!=1?Er.test(t.slice(e-2,e))?2:0:Er.test(String.fromCharCode(n))?1:0:0}function A0(t,e,n){if(e==t.length||!I0(t,e))return e;for(let o=e,r=e+n;;){let s=E0(t,o);if(!s)return o;if(o+=s,o>r)return e}}function T0(t,e,n){if(!e||!E0(t,e))return e;for(let o=e,r=e-n;;){let s=I0(t,o);if(!s)return o;if(o-=s,o<r)return e}}function g5(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 M0=t=>t>=55296&&t<=56319,O0=t=>t>=56320&&t<=57343;function Yr(t,e){return!e||e==t.length||!M0(t.charCodeAt(e-1))||!O0(t.charCodeAt(e))}function _5(t,e,n){var o;return Ci=((o=n==null?void 0:n.scanLimit)!==null&&o!==void 0?o:1e9)>>1,function(r,s,i){for(;;){N0(i,1);let a=!1;for(let l=0;l<i.length;l++){let c,d,u=i[l];(c=_u(r,u.fromA,u.toA,s,u.fromB,u.toB))&&(u=i[l]=new At(u.fromA+c,u.toA,u.fromB+c,u.toB)),(d=bu(r,u.fromA,u.toA,s,u.fromB,u.toB))&&(u=i[l]=new At(u.fromA,u.toA-d,u.fromB,u.toB-d));let f=u.toA-u.fromA,p=u.toB-u.fromB;if(f&&p)continue;let _=u.fromA-(l?i[l-1].toA:0),g=(l<i.length-1?i[l+1].fromA:r.length)-u.toA;if(!_||!g)continue;let m=f?r.slice(u.fromA,u.toA):s.slice(u.fromB,u.toB);_<=m.length&&r.slice(u.fromA-_,u.fromA)==m.slice(m.length-_)?(i[l]=new At(u.fromA-_,u.toA-_,u.fromB-_,u.toB-_),a=!0):g<=m.length&&r.slice(u.toA,u.toA+g)==m.slice(0,g)&&(i[l]=new At(u.fromA+g,u.toA+g,u.fromB+g,u.toB+g),a=!0)}if(!a)break}return i}(t,e,jr(t,0,t.length,e,0,e.length))}function D0(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 u=a==o.length-1?r.length:o[a+1].fromA,f=l.fromA-i,p=u-l.toA,_=T0(r,l.fromA,Math.min(f,5)),g=A0(r,l.toA,Math.min(p,5)),m=l.fromA-_,b=g-l.toA;if(!c||!d){let x,y,v=Math.max(c,d),[k,S,E]=c?[r,l.fromA,l.toA]:[s,l.fromB,l.toB];m&&b?(v>m&&r.slice(_,l.fromA)==k.slice(E-m,E)?(l=o[a]=new At(_,_+c,l.fromB-m,l.toB-m),_=l.fromA,g=A0(r,l.toA,Math.min(u-l.toA,5))):v>b&&r.slice(l.toA,g)==k.slice(S,S+b)&&(l=o[a]=new At(g-c,g,l.fromB+b,l.toB+b),g=l.toA,_=T0(r,l.fromA,Math.min(l.fromA-i,5))),m=l.fromA-_,b=g-l.toA):m||b||!(y=l.fromA-(x=g5(r,l.fromA,f)))||r.slice(x,l.fromA)!=k.slice(E-y,E)||(l=o[a]=new At(x,x+c,l.fromB-y,l.toB-y))}(m||b)&&(l=o[a]=new At(l.fromA-m,l.toA+b,l.fromB-m,l.toB+b)),i=l.toA}}return N0(o,3),o}(_5(t,e,n),t,e)}const no=$s.define({combine:t=>t[0]}),xu=Ut.define(),Jr=En.define({create:t=>null,update(t,e){for(let n of e.effects)n.is(xu)&&(t=n.value);return t}});class Kr{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 Kr(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 L0(D0(e.toString(),n.toString(),o),e,n,0,0)}static updateA(e,n,o,r,s){return B0(z0(e,r,!0,o.length),e,n,o,s)}static updateB(e,n,o,r,s){return B0(z0(e,r,!1,n.length),e,n,o,s)}}function R0(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 P0(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 L0(t,e,n,o,r){let s=[];for(let i=0;i<t.length;i++){let a=t[i],[l,c]=R0(a.fromA+o,a.fromB+r,e,n),[d,u]=P0(a.toA+o,a.toB+r,e,n),f=[a.offset(-l+o,-c+r)];for(;i<t.length-1;){let p=t[i+1],[_,g]=R0(p.fromA+o,p.fromB+r,e,n);if(_>d+1&&g>u+1)break;f.push(p.offset(-l+o,-c+r)),[d,u]=P0(p.toA+o,p.toB+r,e,n),i++}s.push(new Kr(f,l,Math.max(l,d),c,Math.max(c,u)))}return s}const gl=1e3;function F0(t,e,n,o){let r=0,s=t.length;for(;;){if(r==s){let d=0,u=0;r&&({toA:d,toB:u}=t[r-1]);let f=e-(n?d:u);return[d+f,u+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 z0(t,e,n,o){let r=[];return e.iterChangedRanges((s,i,a,l)=>{let c=0,d=n?e.length:o,u=0,f=n?o:e.length;s>gl&&([c,u]=F0(t,s-gl,n,!0)),i<e.length-gl&&([d,f]=F0(t,i+gl,n,!1));let p,_=l-a-(i-s),[g,m]=n?[_,0]:[0,_];r.length&&(p=r[r.length-1]).toA>=c?r[r.length-1]={fromA:p.fromA,fromB:p.fromB,toA:d,toB:f,diffA:p.diffA+g,diffB:p.diffB+m}:r.push({fromA:c,toA:d,fromB:u,toB:f,diffA:g,diffB:m})}),r}function B0(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,u=c.toA+i+c.diffA,f=c.fromB+a,p=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>u)break;s++}for(let _ of L0(D0(n.sliceString(d,u),o.sliceString(f,p),r),n,o,d,f))l.push(_);for(i+=c.diffA,a+=c.diffB;s<e.length;){let _=e[s];if(_.fromA>u+i&&_.fromB>p+a)break;s++}}for(;s<e.length;)l.push(e[s++].offset(i,a));return l}const U0=Zn.fromClass(class{constructor(t){({deco:this.deco,gutter:this.gutter}=H0(t))}update(t){var e,n;(t.docChanged||t.viewportChanged||(e=t.startState,n=t.state,e.field(Jr,!1)!=n.field(Jr,!1))||function(o,r){return o.facet(no)!=r.facet(no)}(t.startState,t.state))&&({deco:this.deco,gutter:this.gutter}=H0(t.view))}},{decorations:t=>t.deco}),_l=Vo.low(sU({class:"cm-changeGutter",markers:t=>{var e;return((e=t.plugin(U0))===null||e===void 0?void 0:e.gutter)||Mp.empty}})),V0=dt.line({class:"cm-changedLine"}),b5=dt.mark({class:"cm-changedText"}),y5=dt.mark({tagName:"ins",class:"cm-insertedLine"}),x5=dt.mark({tagName:"del",class:"cm-deletedLine"}),$0=new class extends iU{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function w5(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,V0),r.add(i,a,n?x5:y5),s&&s.add(i,i,$0);for(let c=e.iterRange(i,a-1),d=i;!c.next().done;){if(c.lineBreak){d++,r.add(d,d,V0),s&&s.add(d,d,$0);continue}let u=d+c.value.length;if(o)for(;l<t.changes.length;){let f=t.changes[l],p=i+(n?f.fromA:f.fromB),_=i+(n?f.toA:f.toB),g=Math.max(d,p),m=Math.min(u,_);if(g<m&&r.add(g,m,b5),!(_<u))break;l++}d=u}}}function H0(t){let e=t.state.field(Jr),{side:n,highlightChanges:o,markGutter:r}=t.state.facet(no),s=n=="a",i=new Us,a=r?new Us: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&&w5(d,t.state.doc,s,o,i,a)}return{deco:i.finish(),gutter:a&&a.finish()}}class bl extends Hs{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 yl=Ut.define({map:(t,e)=>t.map(e)}),Ni=En.define({create:()=>dt.none,update:(t,e)=>{for(let n of e.effects)if(n.is(yl))return n.value;return t.map(e.changes)},provide:t=>st.decorations.from(t)}),wu=.01,vu=Ut.define({map:(t,e)=>e.mapPos(t)});class v5 extends Hs{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:vu.of(r)});let{side:s,sibling:i}=e.state.facet(no);i&&i().dispatch({effects:vu.of(k5(r,e.state.field(Jr),s=="a"))})}),n}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}}function k5(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 S5=En.define({create:t=>dt.none,update(t,e){t=t.map(e.changes);for(let n of e.effects)n.is(vu)&&(t=t.update({filter:o=>o!=n.value}));return t},provide:t=>st.decorations.from(t)});function W0({margin:t=3,minSize:e=4}){return S5.init(n=>function(o,r,s){let i=new Us,a=o.facet(no).side=="a",l=o.field(Jr),c=1;for(let d=0;;d++){let u=d<l.length?l[d]:null,f=d?c+r:1,p=u?o.doc.lineAt(a?u.fromA:u.fromB).number-1-r:o.doc.lines,_=p-f+1;if(_>=s&&i.add(o.doc.line(f).from,o.doc.line(p).to,dt.replace({widget:new v5(_),block:!0})),!u)break;c=o.doc.lineAt(Math.min(o.doc.length,a?u.toA:u.toB)).number}return i.finish()}(n,t,e))}const C5=st.styleModule.of(new rU({".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"}})),N5=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"}}),q0=new kp,xl=new kp;class G0{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig;let n=[Vo.low(U0),N5,C5,Ni,st.updateListener.of(u=>{this.measuring<0&&(u.heightChanged||u.viewportChanged)&&!u.transactions.some(f=>f.effects.some(p=>p.is(yl)))&&this.measure()})],o=[no.of({side:"a",sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&o.push(_l);let r=ca.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],st.editorAttributes.of({class:"cm-merge-a"}),xl.of(o),n]}),s=[no.of({side:"b",sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&s.push(_l);let i=ca.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],st.editorAttributes.of({class:"cm-merge-b"}),xl.of(s),n]});this.chunks=Kr.build(r.doc,i.doc,this.diffConf);let a=[Jr.init(()=>this.chunks),q0.of(e.collapseUnchanged?W0(e.collapseUnchanged):[])];r=r.update({effects:Ut.appendConfig.of(a)}).state,i=i.update({effects:Ut.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:u=>this.dispatch(u,this.a)}),this.b=new st({state:i,parent:d,root:e.root,dispatchTransactions:u=>this.dispatch(u,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),ia.empty(e[0].startState.doc.length));this.chunks=n==this.a?Kr.updateA(this.chunks,o.newDoc,this.b.state.doc,r,this.diffConf):Kr.updateB(this.chunks,this.a.state.doc,o.newDoc,r,this.diffConf),n.update([...e,o.state.update({effects:xu.of(this.chunks)})]);let s=n==this.a?this.b:this.a;s.update([s.state.update({effects:xu.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(no),l=o?e.gutter!==!1:a.markGutter,c=n?e.highlightChanges!==!1:a.highlightChanges;s.push(xl.reconfigure([no.of({side:"a",sibling:()=>this.b,highlightChanges:c,markGutter:l}),l?_l:[]])),i.push(xl.reconfigure([no.of({side:"b",sibling:()=>this.a,highlightChanges:c,markGutter:l}),l?_l:[]]))}if(r){let a=q0.reconfigure(e.collapseUnchanged?W0(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 Us,s=new Us,i=e.state.field(Ni).iter(),a=n.state.field(Ni).iter(),l=0,c=0,d=0,u=0;for(let g=0;;g++){let m=g<o.length?o[g]:null;if(l<(m?m.fromA:e.state.doc.length)){let b=e.lineBlockAt(l).top+d-(n.lineBlockAt(c).top+u);b<-.01?(d-=b,r.add(l,l,dt.widget({widget:new bl(-b),block:!0,side:-1}))):b>wu&&(u+=b,s.add(c,c,dt.widget({widget:new bl(b),block:!0,side:-1})))}if(!m)break;for(l=m.toA,c=m.toB;i.value&&i.from<l;)d-=i.value.spec.widget.height,i.next();for(;a.value&&a.from<c;)u-=a.value.spec.widget.height,a.next()}for(;i.value;)d-=i.value.spec.widget.height,i.next();for(;a.value;)u-=a.value.spec.widget.height,a.next();let f=e.contentHeight+d-(n.contentHeight+u);f<wu?r.add(e.state.doc.length,e.state.doc.length,dt.widget({widget:new bl(-f),block:!0,side:1})):f>wu&&s.add(n.state.doc.length,n.state.doc.length,dt.widget({widget:new bl(f),block:!0,side:1}));let p=r.finish(),_=s.finish();Mp.eq([p],[e.state.field(Ni)])||e.dispatch({effects:yl.of(p)}),Mp.eq([_],[n.state.field(Ni)])||n.dispatch({effects:yl.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=Y0(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=Y0(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 Y0(t){let e=t.nextSibling;return t.remove(),e}var j5=["className","children","orientation","revertControls","highlightChanges","gutter","collapseUnchanged","destroyRerender","renderRevertControl","diffConfig"],E5=["modified","modifiedExtension","original","originalExtension","theme","dispatch"],J0=K.forwardRef((t,e)=>{var{className:n,children:o,orientation:r,revertControls:s,highlightChanges:i,gutter:a,collapseUnchanged:l,destroyRerender:c=!0,renderRevertControl:d,diffConfig:u}=t,f=ma(t,j5),p=pu(),{modified:_,modifiedExtension:g,original:m,originalExtension:b,theme:x,dispatch:y}=p,v=ma(p,E5),k=A.useRef(null),S=A.useRef(),E={orientation:r,revertControls:s,highlightChanges:i,gutter:a,collapseUnchanged:l,renderRevertControl:d,diffConfig:u};A.useImperativeHandle(e,()=>({container:k.current,view:S.current,modified:_,original:m,config:jt({a:m,b:_,parent:k.current},E)}),[k,S,_,m,E]);var j=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(()=>{!S.current&&k.current&&b&&g&&(S.current=new G0(jt({a:jt({},m,{extensions:[...(b==null?void 0:b.extension)||[],...Js(jt({},b==null?void 0:b.option,{theme:x})),j]}),b:jt({},_,{extensions:[...(g==null?void 0:g.extension)||[],...Js(jt({},g==null?void 0:g.option,{theme:x})),I]}),parent:k.current},E)),y({view:S.current}))},[S,k,b,g]),A.useEffect(()=>{if(m&&m.doc&&S.current){var T,M,L=(T=S.current)==null?void 0:T.a.state.doc.toString();L!==m.doc&&((M=S.current)==null||M.a.dispatch({changes:{from:0,to:L.length,insert:m.doc||""}}))}if(_&&_.doc&&S.current){var B,O,z=(B=S.current)==null?void 0:B.b.state.doc.toString();z!==_.doc&&((O=S.current)==null||O.b.dispatch({changes:{from:0,to:z.length,insert:_.doc||""}}))}if(c&&S.current){var F=S.current.a.state.selection.ranges[0].from,V=S.current.b.state.selection.ranges[0].from;S.current.destroy(),S.current=new G0(jt({a:jt({},m,{extensions:[...(b==null?void 0:b.extension)||[],...Js(jt({},b==null?void 0:b.option,{theme:x}))]}),b:jt({},_,{extensions:[...(g==null?void 0:g.extension)||[],...Js(jt({},g==null?void 0:g.option,{theme:x}))]}),parent:k.current},E)),F&&(S.current.a.focus(),S.current.a.dispatch({selection:{anchor:F,head:F}})),V&&(S.current.b.focus(),S.current.b.dispatch({selection:{anchor:V,head:V}}))}},[S,x,k.current,m,_,b,g,c]),A.useEffect(()=>()=>S.current&&S.current.destroy(),[]),A.useEffect(()=>{if(S.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&&y&&S.current&&(S.current.reconfigure(jt({},T)),y(jt({},T)))}},[y,S,r,s,i,a,l,d]),h.jsx("div",jt({ref:k,className:"cm-merge-theme"+(n?" "+n:"")},f,{children:o}))});J0.displayName="CodeMirrorMerge.Internal";var I5=["theme"],Xr=K.forwardRef((t,e)=>{var{theme:n}=t,o=ma(t,I5);return h.jsx(h5,{theme:n,children:h.jsx(J0,jt({},o,{ref:e}))})});Xr.Original=x0,Xr.Modified=w0,Xr.displayName="CodeMirrorMerge";const A5=Xr.Original,T5=Xr.Modified,K0=[lU(),st.lineWrapping],M5=t=>{const e=X.c(42),{className:n,onChange:o,initialPrompt:r,currentLanguageAdapter:s,currentCode:i,declineChange:a,acceptChange:l,enabled:c,children:d}=t;let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u={},e[0]=u):u=e[0];const[f,p]=A.useState(u),[_,g]=fn(LS),{completion:m,input:b,stop:x,isLoading:y,setCompletion:v,setInput:k,handleSubmit:S}=aU({api:Cp("api/ai/completion").toString(),headers:Nc.headers(),initialInput:r,streamProtocol:"text",experimental_throttle:100,body:{...f,includeOtherCode:_?Sc(i):"",code:i,language:s},onError:O5,onFinish:(G,Z)=>{E(Z.trimEnd())}}),E=v,j=K.useRef(null);let I,T,M,L;e[1]!==c?(I=()=>{const G=j.current;c&&G&&(requestAnimationFrame(()=>{var Z;(Z=G.view)==null||Z.focus()}),cU(j.current.view))},T=[c],e[1]=c,e[2]=I,e[3]=T):(I=e[2],T=e[3]),A.useEffect(I,T),e[4]!==c||e[5]!==r||e[6]!==k?(M=()=>{c&&k(r||"")},L=[c,r,k],e[4]=c,e[5]=r,e[6]=k,e[7]=M,e[8]=L):(M=e[7],L=e[8]),A.useEffect(M,L);const{theme:B}=Fo();let O;e[9]!==n?(O=Oe("flex flex-col w-full rounded-[inherit]",n),e[9]=n,e[10]=O):O=e[10];const z=c&&"max-h-[400px] min-h-11 visible",F=!c&&"max-h-0 min-h-0 invisible";let V,P,C,$;e[11]!==z||e[12]!==F?(V=Oe("flex items-center gap-2 border-b px-3 transition-all rounded-[inherit] rounded-b-none duration-300",z,F),e[11]=z,e[12]=F,e[13]=V):V=e[13],e[14]!==l||e[15]!==m||e[16]!==a||e[17]!==c||e[18]!==S||e[19]!==_||e[20]!==b||e[21]!==y||e[22]!==E||e[23]!==g||e[24]!==k||e[25]!==x||e[26]!==B?(P=c&&h.jsxs(h.Fragment,{children:[h.jsx(Xi,{className:"text-[var(--blue-10)] flex-shrink-0",size:16}),h.jsx(Dc,{inputRef:j,theme:B,onClose:()=>{a(),E("")},value:b,onChange:G=>{k(G),p(b4({input:G}))},onSubmit:()=>{y||S()}}),y&&h.jsxs(Pe,{"data-testid":"stop-completion-button",variant:"text",size:"xs",className:"mb-0",onClick:x,children:[h.jsx(Op,{className:"animate-spin mr-1",size:14}),"Stop"]}),!y&&m&&h.jsx(Pe,{"data-testid":"accept-completion-button",variant:"text",size:"xs",className:"mb-0",disabled:y,onClick:()=>{l(m),E("")},children:h.jsx("span",{className:"text-[var(--grass-11)] opacity-100",children:"Accept"})}),h.jsx("div",{className:"h-full w-px bg-border mx-2"}),h.jsx(Re,{content:"Include code from other cells",children:h.jsxs("div",{className:"flex flex-row items-start gap-1 overflow-hidden",children:[h.jsx(y4,{"data-testid":"include-other-cells-checkbox",id:"include-other-cells",checked:_,onCheckedChange:G=>g(!!G)}),h.jsx(Rr,{htmlFor:"include-other-cells",className:"text-muted-foreground text-xs whitespace-nowrap ellipsis",children:"Include all code"})]})}),h.jsx(Pe,{"data-testid":"decline-completion-button",variant:"text",size:"icon",disabled:y,onClick:()=>{x(),a(),E("")},children:h.jsx(go,{className:"text-[var(--red-10)]",size:16})})]}),e[14]=l,e[15]=m,e[16]=a,e[17]=c,e[18]=S,e[19]=_,e[20]=b,e[21]=y,e[22]=E,e[23]=g,e[24]=k,e[25]=x,e[26]=B,e[27]=P):P=e[27],e[28]!==V||e[29]!==P?(C=h.jsx("div",{className:V,children:P}),e[28]=V,e[29]=P,e[30]=C):C=e[30],e[31]!==m||e[32]!==i||e[33]!==c||e[34]!==o||e[35]!==B?($=m&&c&&h.jsxs(Xr,{className:"cm",theme:B,children:[h.jsx(A5,{onChange:o,value:i,extensions:K0}),h.jsx(T5,{value:m,editable:!1,readOnly:!0,extensions:K0})]}),e[31]=m,e[32]=i,e[33]=c,e[34]=o,e[35]=B,e[36]=$):$=e[36];const N=(!m||!c)&&d;let H;return e[37]!==C||e[38]!==$||e[39]!==N||e[40]!==O?(H=h.jsxs("div",{className:O,children:[C,$,N]}),e[37]=C,e[38]=$,e[39]=N,e[40]=O,e[41]=H):H=e[41],H};function O5(t){lt({title:"Completion failed",description:_4(t)})}const D5=""+new URL("loro_wasm_bg-DHBNbovs.wasm",import.meta.url).href;let w;function ku(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 qe=0,wl=null;function Zr(){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 R5=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 Zr().subarray(l,l+a.length).set(a),qe=a.length,l}let o=t.length,r=e(o,1)>>>0;const s=Zr();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=Zr().subarray(r+i,r+o);i+=R5(t,a).written,r=n(r,o,i,1)>>>0}return qe=i,r}let Qr=null;function R(){return(Qr===null||Qr.buffer.detached===!0||Qr.buffer.detached===void 0&&Qr.buffer!==w.memory.buffer)&&(Qr=new DataView(w.memory.buffer)),Qr}let ji=kt.length;function se(t){ji===kt.length&&kt.push(kt.length+1);const e=ji;return ji=kt[e],kt[e]=t,e}function Yt(t,e){try{return t.apply(this,e)}catch(n){w.__wbindgen_export_2(se(n))}}let X0=new(typeof TextDecoder>"u"?(0,module.require)("util").TextDecoder:TextDecoder)("utf-8",{ignoreBOM:!0,fatal:!0});function Tt(t,e){return t>>>=0,X0.decode(Zr().subarray(t,t+e))}function W(t){const e=ye(t);return function(n){n<132||(kt[n]=ji,ji=n)}(t),e}function Mn(t){return t==null}X0.decode();const Z0=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>{w.__wbindgen_export_4.get(t.dtor)(t.a,t.b)});function Q0(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),Z0.unregister(r)):r.a=a}};return s.original=r,Z0.register(s,r,r),s}function Su(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+=Su(t[0]));for(let i=1;i<r;i++)s+=", "+Su(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
+ ${t.stack}`:o}function oo(t,e){return t>>>=0,Zr().subarray(t/1,t/1+e)}function Jo(t,e){const n=e(1*t.length,1)>>>0;return Zr().set(t,n/1),qe=t.length,n}function On(t,e){t>>>=0;const n=R(),o=[];for(let r=t;r<t+4*e;r+=4)o.push(W(n.getUint32(r,!0)));return o}function wn(t,e){const n=e(4*t.length,4)>>>0,o=R();for(let r=0;r<t.length;r++)o.setUint32(n+4*r,se(t[r]),!0);return qe=t.length,n}let Jt=128;function gn(t){if(Jt==1)throw new Error("out of js stack");return kt[--Jt]=t,Jt}function es(t,e){if(!(t instanceof e))throw new Error(`expected instance of ${e.name}`)}function P5(t,e,n){w.__wbindgen_export_5(t,e,se(n))}function L5(t,e){w.__wbindgen_export_6(t,e)}const eb=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_awarenesswasm_free(t>>>0,1));class tb{__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,eb.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_awarenesswasm_free(e,0)}constructor(e,n){const o=w.awarenesswasm_new(se(e),n);return this.__wbg_ptr=o>>>0,eb.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,se(e));var n=R().getInt32(s+0,!0),o=R().getInt32(s+4,!0),r=oo(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=R().getInt32(r+0,!0),n=R().getInt32(r+4,!0),o=oo(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=qe;w.awarenesswasm_apply(r,this.__wbg_ptr,s,i);var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}setLocalState(e){w.awarenesswasm_setLocalState(this.__wbg_ptr,se(e))}peer(){return W(w.awarenesswasm_peer(this.__wbg_ptr))}getAllStates(){return W(w.awarenesswasm_getAllStates(this.__wbg_ptr))}getState(e){return W(w.awarenesswasm_getState(this.__wbg_ptr,se(e)))}getTimestamp(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.awarenesswasm_getTimestamp(r,this.__wbg_ptr,se(e));var n=R().getInt32(r+0,!0),o=R().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=R().getInt32(r+0,!0),n=R().getInt32(r+4,!0),o=On(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=R().getInt32(r+0,!0),n=R().getInt32(r+4,!0),o=On(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}}const nb=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_changemodifier_free(t>>>0,1));class ts{static __wrap(e){e>>>=0;const n=Object.create(ts.prototype);return n.__wbg_ptr=e,nb.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,nb.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=qe,r=w.changemodifier_setMessage(this.__wbg_ptr,n,o);return ts.__wrap(r)}setTimestamp(e){const n=w.changemodifier_setTimestamp(this.__wbg_ptr,e);return ts.__wrap(n)}}const ob=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_cursor_free(t>>>0,1));class Gn{static __wrap(e){e>>>=0;const n=Object.create(Gn.prototype);return n.__wbg_ptr=e,ob.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,ob.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_cursor_free(e,0)}containerId(){return W(w.cursor_containerId(this.__wbg_ptr))}pos(){return W(w.cursor_pos(this.__wbg_ptr))}side(){return W(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=R().getInt32(r+0,!0),n=R().getInt32(r+4,!0),o=oo(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=qe;w.cursor_decode(r,s,i);var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return Gn.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}kind(){return W(w.cursor_kind(this.__wbg_ptr))}}const rb=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_ephemeralstorewasm_free(t>>>0,1)),Cu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorocounter_free(t>>>0,1));class Ei{static __wrap(e){e>>>=0;const n=Object.create(Ei.prototype);return n.__wbg_ptr=e,Cu.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Cu.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,Cu.register(this,this.__wbg_ptr,this),this}kind(){return W(w.lorocounter_kind(this.__wbg_ptr))}get id(){return W(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=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(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=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(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,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}parent(){return W(w.lorocounter_parent(this.__wbg_ptr))}isAttached(){return w.lorocounter_isAttached(this.__wbg_ptr)!==0}getAttached(){return W(w.lorocounter_getAttached(this.__wbg_ptr))}getShallowValue(){return w.lorocounter_getShallowValue(this.__wbg_ptr)}}const Nu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorodoc_free(t>>>0,1));class yo{static __wrap(e){e>>>=0;const n=Object.create(yo.prototype);return n.__wbg_ptr=e,Nu.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Nu.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,Nu.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,se(e));var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(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,se(e));var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(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=qe;w.lorodoc_fromSnapshot(r,s,i);var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return yo.__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 yo.__wrap(e)}forkAt(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=wn(e,w.__wbindgen_export_0),i=qe;w.lorodoc_forkAt(r,this.__wbg_ptr,s,i);var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return yo.__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=R().getInt32(n+0,!0);if(R().getInt32(n+4,!0))throw W(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}travelChangeAncestors(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=wn(e,w.__wbindgen_export_0),i=qe;w.lorodoc_travelChangeAncestors(r,this.__wbg_ptr,s,i,se(n));var o=R().getInt32(r+0,!0);if(R().getInt32(r+4,!0))throw W(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}findIdSpansBetween(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16),i=wn(e,w.__wbindgen_export_0),a=qe,l=wn(n,w.__wbindgen_export_0),c=qe;w.lorodoc_findIdSpansBetween(s,this.__wbg_ptr,i,a,l,c);var o=R().getInt32(s+0,!0),r=R().getInt32(s+4,!0);if(R().getInt32(s+8,!0))throw W(r);return W(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}checkout(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16),r=wn(e,w.__wbindgen_export_0),s=qe;w.lorodoc_checkout(o,this.__wbg_ptr,r,s);var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(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 W(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,se(e));var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(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,Mn(e)?0:se(e));var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(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,gn(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return Xo.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Jt++]=void 0}}getMap(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getMap(r,this.__wbg_ptr,gn(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return Ko.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Jt++]=void 0}}getList(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getList(r,this.__wbg_ptr,gn(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return Ii.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Jt++]=void 0}}getMovableList(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getMovableList(r,this.__wbg_ptr,gn(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return Ai.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Jt++]=void 0}}getCounter(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getCounter(r,this.__wbg_ptr,gn(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return Ei.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Jt++]=void 0}}getTree(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getTree(r,this.__wbg_ptr,gn(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return Ti.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Jt++]=void 0}}hasContainer(e){return w.lorodoc_hasContainer(this.__wbg_ptr,se(e))!==0}getContainerById(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getContainerById(r,this.__wbg_ptr,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}setNextCommitMessage(e){const n=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=qe;w.lorodoc_setNextCommitMessage(this.__wbg_ptr,n,o)}setNextCommitOrigin(e){const n=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=qe;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,se(e));var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}clearNextCommitOptions(){w.lorodoc_clearNextCommitOptions(this.__wbg_ptr)}getDeepValueWithID(){return W(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,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(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=qe;w.lorodoc_JSONPath(r,this.__wbg_ptr,s,i);var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}version(){const e=w.lorodoc_version(this.__wbg_ptr);return Dn.__wrap(e)}shallowSinceVV(){const e=w.lorodoc_shallowSinceVV(this.__wbg_ptr);return Dn.__wrap(e)}isShallow(){return w.lorodoc_isShallow(this.__wbg_ptr)!==0}shallowSinceFrontiers(){return W(w.lorodoc_shallowSinceFrontiers(this.__wbg_ptr))}oplogVersion(){const e=w.lorodoc_oplogVersion(this.__wbg_ptr);return Dn.__wrap(e)}frontiers(){return W(w.lorodoc_frontiers(this.__wbg_ptr))}oplogFrontiers(){return W(w.lorodoc_oplogFrontiers(this.__wbg_ptr))}cmpWithFrontiers(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=wn(e,w.__wbindgen_export_0),i=qe;w.lorodoc_cmpWithFrontiers(r,this.__wbg_ptr,s,i);var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(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=wn(e,w.__wbindgen_export_0),a=qe,l=wn(n,w.__wbindgen_export_0),c=qe;w.lorodoc_cmpFrontiers(s,this.__wbg_ptr,i,a,l,c);var o=R().getInt32(s+0,!0),r=R().getInt32(s+4,!0);if(R().getInt32(s+8,!0))throw W(r);return W(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=R().getInt32(s+0,!0),n=R().getInt32(s+4,!0),o=R().getInt32(s+8,!0);if(R().getInt32(s+12,!0))throw W(o);var r=oo(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,se(e));var n=R().getInt32(i+0,!0),o=R().getInt32(i+4,!0),r=R().getInt32(i+8,!0);if(R().getInt32(i+12,!0))throw W(r);var s=oo(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,se(e));var n=R().getInt32(i+0,!0),o=R().getInt32(i+4,!0),r=R().getInt32(i+8,!0);if(R().getInt32(i+12,!0))throw W(r);var s=oo(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,se(e),se(n),Mn(o)?16777215:o?1:0);var r=R().getInt32(i+0,!0),s=R().getInt32(i+4,!0);if(R().getInt32(i+8,!0))throw W(s);return W(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,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(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,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(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=qe;w.lorodoc_import(r,this.__wbg_ptr,s,i);var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(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,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(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,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(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=R().getInt32(o+0,!0),n=R().getInt32(o+4,!0);if(R().getInt32(o+8,!0))throw W(n);return W(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=R().getInt32(o+0,!0),n=R().getInt32(o+4,!0);if(R().getInt32(o+8,!0))throw W(n);return W(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}subscribe(e){return W(w.lorodoc_subscribe(this.__wbg_ptr,se(e)))}subscribeLocalUpdates(e){return W(w.lorodoc_subscribeLocalUpdates(this.__wbg_ptr,se(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 W(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,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(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=qe;w.lorodoc_getChangeAtLamport(s,this.__wbg_ptr,i,a,n);var o=R().getInt32(s+0,!0),r=R().getInt32(s+4,!0);if(R().getInt32(s+8,!0))throw W(r);return W(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,se(e));var n=R().getInt32(i+0,!0),o=R().getInt32(i+4,!0),r=R().getInt32(i+8,!0);if(R().getInt32(i+12,!0))throw W(r);var s=On(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=wn(e,w.__wbindgen_export_0),i=qe;w.lorodoc_frontiersToVV(r,this.__wbg_ptr,s,i);var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return Dn.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}vvToFrontiers(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);es(e,Dn),w.lorodoc_vvToFrontiers(r,this.__wbg_ptr,e.__wbg_ptr);var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getByPath(e){const n=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=qe;return W(w.lorodoc_getByPath(this.__wbg_ptr,n,o))}getCursorPos(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);es(e,Gn),w.lorodoc_getCursorPos(r,this.__wbg_ptr,e.__wbg_ptr);var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(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,se(e),n);var o=R().getInt32(a+0,!0),r=R().getInt32(a+4,!0),s=R().getInt32(a+8,!0);if(R().getInt32(a+12,!0))throw W(s);var i=On(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=wn(e,w.__wbindgen_export_0),s=qe;w.lorodoc_revertTo(o,this.__wbg_ptr,r,s);var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(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,se(e));var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}diff(e,n,o){try{const i=w.__wbindgen_add_to_stack_pointer(-16),a=wn(e,w.__wbindgen_export_0),l=qe,c=wn(n,w.__wbindgen_export_0),d=qe;w.lorodoc_diff(i,this.__wbg_ptr,a,l,c,d,Mn(o)?16777215:o?1:0);var r=R().getInt32(i+0,!0),s=R().getInt32(i+4,!0);if(R().getInt32(i+8,!0))throw W(s);return W(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=R().getInt32(o+0,!0),n=R().getInt32(o+4,!0);if(R().getInt32(o+8,!0))throw W(n);return W(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}subscribeFirstCommitFromPeer(e){return W(w.lorodoc_subscribeFirstCommitFromPeer(this.__wbg_ptr,se(e)))}subscribePreCommit(e){return W(w.lorodoc_subscribePreCommit(this.__wbg_ptr,se(e)))}deleteRootContainer(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_deleteRootContainer(o,this.__wbg_ptr,se(e));var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(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=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}}const ju=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorolist_free(t>>>0,1));class Ii{static __wrap(e){e>>>=0;const n=Object.create(Ii.prototype);return n.__wbg_ptr=e,ju.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,ju.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,ju.register(this,this.__wbg_ptr,this),this}kind(){return W(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,se(n));var o=R().getInt32(r+0,!0);if(R().getInt32(r+4,!0))throw W(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=R().getInt32(r+0,!0);if(R().getInt32(r+4,!0))throw W(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get(e){return W(w.lorolist_get(this.__wbg_ptr,e))}get id(){return W(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=R().getInt32(r+0,!0),n=R().getInt32(r+4,!0),o=On(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return W(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,se(n));var o=R().getInt32(s+0,!0),r=R().getInt32(s+4,!0);if(R().getInt32(s+8,!0))throw W(r);return W(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,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(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,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get length(){return w.lorolist_length(this.__wbg_ptr)>>>0}parent(){return W(w.lorolist_parent(this.__wbg_ptr))}isAttached(){return w.lorolist_isAttached(this.__wbg_ptr)!==0}getAttached(){return W(w.lorolist_getAttached(this.__wbg_ptr))}getCursor(e,n){const o=w.lorolist_getCursor(this.__wbg_ptr,e,se(n));return o===0?void 0:Gn.__wrap(o)}push(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_push(o,this.__wbg_ptr,se(e));var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(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=R().getInt32(o+0,!0),n=R().getInt32(o+4,!0);if(R().getInt32(o+8,!0))throw W(n);return W(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=R().getInt32(n+0,!0);if(R().getInt32(n+4,!0))throw W(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getIdAt(e){return W(w.lorolist_getIdAt(this.__wbg_ptr,e))}isDeleted(){return w.lorolist_isDeleted(this.__wbg_ptr)!==0}getShallowValue(){return W(w.lorolist_getShallowValue(this.__wbg_ptr))}}const Eu=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,Eu.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Eu.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,Eu.register(this,this.__wbg_ptr,this),this}kind(){return W(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=qe;w.loromap_set(r,this.__wbg_ptr,s,i,se(n));var o=R().getInt32(r+0,!0);if(R().getInt32(r+4,!0))throw W(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=qe;w.loromap_delete(o,this.__wbg_ptr,r,s);var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get(e){const n=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=qe;return W(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=qe;w.loromap_getOrCreateContainer(s,this.__wbg_ptr,i,a,se(n));var o=R().getInt32(s+0,!0),r=R().getInt32(s+4,!0);if(R().getInt32(s+8,!0))throw W(r);return W(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=R().getInt32(r+0,!0),n=R().getInt32(r+4,!0),o=On(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=R().getInt32(r+0,!0),n=R().getInt32(r+4,!0),o=On(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=R().getInt32(r+0,!0),n=R().getInt32(r+4,!0),o=On(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}get id(){return W(w.loromap_id(this.__wbg_ptr))}toJSON(){return W(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=qe;w.loromap_setContainer(s,this.__wbg_ptr,i,a,se(n));var o=R().getInt32(s+0,!0),r=R().getInt32(s+4,!0);if(R().getInt32(s+8,!0))throw W(r);return W(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,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get size(){return w.loromap_size(this.__wbg_ptr)>>>0}parent(){return W(w.loromap_parent(this.__wbg_ptr))}isAttached(){return w.loromap_isAttached(this.__wbg_ptr)!==0}getAttached(){return W(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=R().getInt32(n+0,!0);if(R().getInt32(n+4,!0))throw W(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getLastEditor(e){const n=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=qe;return W(w.loromap_getLastEditor(this.__wbg_ptr,n,o))}isDeleted(){return w.loromap_isDeleted(this.__wbg_ptr)!==0}getShallowValue(){return W(w.loromap_getShallowValue(this.__wbg_ptr))}}const Iu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_loromovablelist_free(t>>>0,1));class Ai{static __wrap(e){e>>>=0;const n=Object.create(Ai.prototype);return n.__wbg_ptr=e,Iu.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Iu.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,Iu.register(this,this.__wbg_ptr,this),this}kind(){return W(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,se(n));var o=R().getInt32(r+0,!0);if(R().getInt32(r+4,!0))throw W(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=R().getInt32(r+0,!0);if(R().getInt32(r+4,!0))throw W(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get(e){return W(w.loromovablelist_get(this.__wbg_ptr,e))}get id(){return W(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=R().getInt32(r+0,!0),n=R().getInt32(r+4,!0),o=On(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return W(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,se(n));var o=R().getInt32(s+0,!0),r=R().getInt32(s+4,!0);if(R().getInt32(s+8,!0))throw W(r);return W(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,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(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,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get length(){return w.loromovablelist_length(this.__wbg_ptr)>>>0}parent(){return W(w.loromovablelist_parent(this.__wbg_ptr))}isAttached(){return w.loromovablelist_isAttached(this.__wbg_ptr)!==0}getAttached(){return W(w.loromovablelist_getAttached(this.__wbg_ptr))}getCursor(e,n){const o=w.loromovablelist_getCursor(this.__wbg_ptr,e,se(n));return o===0?void 0:Gn.__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=R().getInt32(r+0,!0);if(R().getInt32(r+4,!0))throw W(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,se(n));var o=R().getInt32(r+0,!0);if(R().getInt32(r+4,!0))throw W(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,se(n));var o=R().getInt32(s+0,!0),r=R().getInt32(s+4,!0);if(R().getInt32(s+8,!0))throw W(r);return W(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,se(e));var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(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=R().getInt32(o+0,!0),n=R().getInt32(o+4,!0);if(R().getInt32(o+8,!0))throw W(n);return W(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=R().getInt32(n+0,!0);if(R().getInt32(n+4,!0))throw W(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getCreatorAt(e){return W(w.loromovablelist_getCreatorAt(this.__wbg_ptr,e))}getLastMoverAt(e){return W(w.loromovablelist_getLastMoverAt(this.__wbg_ptr,e))}getLastEditorAt(e){return W(w.loromovablelist_getLastEditorAt(this.__wbg_ptr,e))}isDeleted(){return w.loromovablelist_isDeleted(this.__wbg_ptr)!==0}getShallowValue(){return W(w.loromovablelist_getShallowValue(this.__wbg_ptr))}}const Au=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,Au.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Au.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,Au.register(this,this.__wbg_ptr,this),this}kind(){return W(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,se(e));var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(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=qe;w.lorotext_update(r,this.__wbg_ptr,s,i,se(n));var o=R().getInt32(r+0,!0);if(R().getInt32(r+4,!0))throw W(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=qe;w.lorotext_updateByLine(r,this.__wbg_ptr,s,i,se(n));var o=R().getInt32(r+0,!0);if(R().getInt32(r+4,!0))throw W(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=qe;w.lorotext_insert(r,this.__wbg_ptr,e,s,i);var o=R().getInt32(r+0,!0);if(R().getInt32(r+4,!0))throw W(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}slice(e,n){let o,r;try{const u=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_slice(u,this.__wbg_ptr,e,n);var s=R().getInt32(u+0,!0),i=R().getInt32(u+4,!0),a=R().getInt32(u+8,!0),l=R().getInt32(u+12,!0),c=s,d=i;if(l)throw c=0,d=0,W(a);return o=c,r=d,Tt(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=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(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),p=ft(o,w.__wbindgen_export_0,w.__wbindgen_export_1),_=qe;w.lorotext_splice(f,this.__wbg_ptr,e,n,p,_);var i=R().getInt32(f+0,!0),a=R().getInt32(f+4,!0),l=R().getInt32(f+8,!0),c=R().getInt32(f+12,!0),d=i,u=a;if(c)throw d=0,u=0,W(l);return r=d,s=u,Tt(d,u)}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=qe;w.lorotext_insertUtf8(r,this.__wbg_ptr,e,s,i);var o=R().getInt32(r+0,!0);if(R().getInt32(r+4,!0))throw W(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=R().getInt32(r+0,!0);if(R().getInt32(r+4,!0))throw W(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=R().getInt32(r+0,!0);if(R().getInt32(r+4,!0))throw W(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=qe;w.lorotext_mark(s,this.__wbg_ptr,se(e),i,a,se(o));var r=R().getInt32(s+0,!0);if(R().getInt32(s+4,!0))throw W(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=qe;w.lorotext_unmark(r,this.__wbg_ptr,se(e),s,i);var o=R().getInt32(r+0,!0);if(R().getInt32(r+4,!0))throw W(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=R().getInt32(s+0,!0),r=R().getInt32(s+4,!0);return e=o,n=r,Tt(o,r)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(e,n,1)}}toDelta(){return W(w.lorotext_toDelta(this.__wbg_ptr))}get id(){return W(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,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(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,se(e));var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}parent(){return W(w.lorotext_parent(this.__wbg_ptr))}isAttached(){return w.lorotext_isAttached(this.__wbg_ptr)!==0}getAttached(){return W(w.lorotext_getAttached(this.__wbg_ptr))}getCursor(e,n){const o=w.lorotext_getCursor(this.__wbg_ptr,e,se(n));return o===0?void 0:Gn.__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=qe;w.lorotext_push(o,this.__wbg_ptr,r,s);var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getEditorOf(e){return W(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=R().getInt32(s+0,!0),r=R().getInt32(s+4,!0);return e=o,n=r,Tt(o,r)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(e,n,1)}}toJSON(){return W(w.lorotext_toJSON(this.__wbg_ptr))}}const Tu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorotree_free(t>>>0,1));class Ti{static __wrap(e){e>>>=0;const n=Object.create(Ti.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_lorotree_free(e,0)}constructor(){const e=w.lorotree_new();return this.__wbg_ptr=e>>>0,Tu.register(this,this.__wbg_ptr,this),this}kind(){return W(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,gn(e),Mn(n)?4294967297:n>>>0);var o=R().getInt32(s+0,!0),r=R().getInt32(s+4,!0);if(R().getInt32(s+8,!0))throw W(r);return ro.__wrap(o)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Jt++]=void 0}}move(e,n,o){try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_move(s,this.__wbg_ptr,gn(e),gn(n),Mn(o)?4294967297:o>>>0);var r=R().getInt32(s+0,!0);if(R().getInt32(s+4,!0))throw W(r)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Jt++]=void 0,kt[Jt++]=void 0}}delete(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_delete(o,this.__wbg_ptr,gn(e));var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Jt++]=void 0}}getNodeByID(e){try{const n=w.lorotree_getNodeByID(this.__wbg_ptr,gn(e));return n===0?void 0:ro.__wrap(n)}finally{kt[Jt++]=void 0}}get id(){return W(w.lorotree_id(this.__wbg_ptr))}has(e){try{return w.lorotree_has(this.__wbg_ptr,gn(e))!==0}finally{kt[Jt++]=void 0}}isNodeDeleted(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_isNodeDeleted(r,this.__wbg_ptr,gn(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return n!==0}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Jt++]=void 0}}toArray(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_toArray(o,this.__wbg_ptr);var e=R().getInt32(o+0,!0),n=R().getInt32(o+4,!0);if(R().getInt32(o+8,!0))throw W(n);return W(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,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return W(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=R().getInt32(r+0,!0),n=R().getInt32(r+4,!0),o=On(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=R().getInt32(r+0,!0),n=R().getInt32(r+4,!0),o=On(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,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}parent(){return W(w.lorotree_parent(this.__wbg_ptr))}isAttached(){return w.lorotree_isAttached(this.__wbg_ptr)!==0}getAttached(){return W(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 W(w.lorotree_getShallowValue(this.__wbg_ptr))}}const sb=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorotreenode_free(t>>>0,1));class ro{static __wrap(e){e>>>=0;const n=Object.create(ro.prototype);return n.__wbg_ptr=e,sb.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,sb.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=R().getInt32(s+0,!0),r=R().getInt32(s+4,!0);return e=o,n=r,Tt(o,r)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(e,n,1)}}get id(){return W(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,Mn(e)?4294967297:e>>>0);var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return ro.__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,gn(e),Mn(n)?4294967297:n>>>0);var o=R().getInt32(r+0,!0);if(R().getInt32(r+4,!0))throw W(o)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Jt++]=void 0}}moveAfter(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);es(e,ro),w.lorotreenode_moveAfter(o,this.__wbg_ptr,e.__wbg_ptr);var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}moveBefore(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);es(e,ro),w.lorotreenode_moveBefore(o,this.__wbg_ptr,e.__wbg_ptr);var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(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=R().getFloat64(o+0,!0),n=R().getInt32(o+8,!0);if(R().getInt32(o+12,!0))throw W(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=R().getInt32(o+0,!0),n=R().getInt32(o+4,!0);if(R().getInt32(o+8,!0))throw W(n);return W(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=R().getInt32(o+0,!0),n=R().getInt32(o+4,!0);if(R().getInt32(o+8,!0))throw W(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=R().getInt32(o+0,!0),n=R().getInt32(o+4,!0);if(R().getInt32(o+8,!0))throw W(n);return W(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=R().getInt32(o+0,!0),n=R().getInt32(o+4,!0);if(R().getInt32(o+8,!0))throw W(n);return e===0?void 0:ro.__wrap(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}children(){return W(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=R().getInt32(o+0,!0),n=R().getInt32(o+4,!0);if(R().getInt32(o+8,!0))throw W(n);return e!==0}finally{w.__wbindgen_add_to_stack_pointer(16)}}getLastMoveId(){return W(w.lorotreenode_getLastMoveId(this.__wbg_ptr))}creationId(){return W(w.lorotreenode_creationId(this.__wbg_ptr))}creator(){return W(w.lorotreenode_creator(this.__wbg_ptr))}}const ib=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_undomanager_free(t>>>0,1)),Mu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_versionvector_free(t>>>0,1));class Dn{static __wrap(e){e>>>=0;const n=Object.create(Dn.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_versionvector_free(e,0)}constructor(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_new(r,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return this.__wbg_ptr=n>>>0,Mu.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,se(e));var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return Dn.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return W(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=R().getInt32(r+0,!0),n=R().getInt32(r+4,!0),o=oo(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=qe;w.versionvector_decode(r,s,i);var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return Dn.__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,se(e));var n=R().getFloat64(r+0,!0),o=R().getInt32(r+8,!0);if(R().getInt32(r+12,!0))throw W(o);return n===4294967297?void 0:n}finally{w.__wbindgen_add_to_stack_pointer(16)}}compare(e){es(e,Dn);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,se(e));var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(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,se(e));var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(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,se(e));var n=R().getInt32(o+0,!0);if(R().getInt32(o+4,!0))throw W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}length(){return w.versionvector_length(this.__wbg_ptr)>>>0}}function ab(t,e){const n=ft(String(ye(e)),w.__wbindgen_export_0,w.__wbindgen_export_1),o=qe;R().setInt32(t+4,o,!0),R().setInt32(t+0,n,!0)}function lb(){return Yt(function(t,e,n){return se(Reflect.apply(ye(t),ye(e),ye(n)))},arguments)}function cb(t){return se(ye(t).buffer)}function db(){return Yt(function(t,e){return se(ye(t).call(ye(e)))},arguments)}function ub(){return Yt(function(t,e,n){return se(ye(t).call(ye(e),ye(n)))},arguments)}function hb(){return Yt(function(t,e,n,o,r){return se(ye(t).call(ye(e),ye(n),ye(o),ye(r)))},arguments)}function fb(){return Yt(function(t,e,n,o){return se(ye(t).call(ye(e),ye(n),ye(o)))},arguments)}function pb(t){return se(ts.__wrap(t))}function mb(t){return se(ye(t).crypto)}function gb(t){return se(Gn.__wrap(t))}function _b(t){return ye(t).done}function bb(t){return se(ye(t).entries())}function yb(t){return se(Object.entries(ye(t)))}function xb(t,e){let n,o;try{n=t,o=e,console.error(Tt(t,e))}finally{w.__wbindgen_export_3(n,o,1)}}function wb(t,e){console.error(Tt(t,e))}function vb(t){return se(Array.from(ye(t)))}function kb(){return Yt(function(t,e){ye(t).getRandomValues(ye(e))},arguments)}function Sb(t,e){return se(ye(t)[e>>>0])}function Cb(){return Yt(function(t,e){return se(Reflect.get(ye(t),ye(e)))},arguments)}function Nb(t,e){return ye(t)[e>>>0]}function jb(t,e){return se(ye(t)[ye(e)])}function Eb(){return Yt(function(){return se(globalThis.globalThis)},arguments)}function Ib(){return Yt(function(){return se(global.global)},arguments)}function Ab(t){let e;try{e=ye(t)instanceof ArrayBuffer}catch{e=!1}return e}function Tb(t){let e;try{e=ye(t)instanceof Map}catch{e=!1}return e}function Mb(t){let e;try{e=ye(t)instanceof Object}catch{e=!1}return e}function Ob(t){let e;try{e=ye(t)instanceof Uint8Array}catch{e=!1}return e}function Db(t){return Array.isArray(ye(t))}function Rb(t){return Number.isSafeInteger(ye(t))}function Pb(){return se(Symbol.iterator)}function Lb(t){return ye(t).length}function Fb(t){return ye(t).length}function zb(t,e,n,o,r,s,i,a){let l,c;try{l=t,c=e,console.log(Tt(t,e),Tt(n,o),Tt(r,s),Tt(i,a))}finally{w.__wbindgen_export_3(l,c,1)}}function Bb(t,e){console.log(Tt(t,e))}function Ub(t,e){let n,o;try{n=t,o=e,console.log(Tt(t,e))}finally{w.__wbindgen_export_3(n,o,1)}}function Vb(t){return se(Ei.__wrap(t))}function $b(t){return se(Ii.__wrap(t))}function Hb(t){return se(Ko.__wrap(t))}function Wb(t){return se(Ai.__wrap(t))}function qb(t){return se(Xo.__wrap(t))}function Gb(t){return se(Ti.__wrap(t))}function Yb(t){return se(ro.__wrap(t))}function Jb(t,e){performance.mark(Tt(t,e))}function Kb(){return Yt(function(t,e,n,o){let r,s,i,a;try{r=t,s=e,i=n,a=o,performance.measure(Tt(t,e),Tt(n,o))}finally{w.__wbindgen_export_3(r,s,1),w.__wbindgen_export_3(i,a,1)}},arguments)}function Xb(t){return se(ye(t).msCrypto)}function Zb(){return se(new Map)}function Qb(t){return se(new Uint8Array(ye(t)))}function ey(){return se(new Object)}function ty(){return se(new Error)}function ny(){return se(new Array)}function oy(t,e){return se(new Function(Tt(t,e)))}function ry(t,e,n){return se(new Uint8Array(ye(t),e>>>0,n>>>0))}function sy(t){return se(new Uint8Array(t>>>0))}function iy(t){return se(new Array(t>>>0))}function ay(t){return se(ye(t).next)}function ly(){return Yt(function(t){return se(ye(t).next())},arguments)}function cy(t){return se(ye(t).node)}function dy(){return Date.now()}function uy(){return Yt(function(t){return se(Reflect.ownKeys(ye(t)))},arguments)}function hy(t){return se(ye(t).process)}function fy(t,e){return ye(t).push(ye(e))}function py(){return Yt(function(t,e){ye(t).randomFillSync(W(e))},arguments)}function my(){return Yt(function(){return se(module.require)},arguments)}function gy(t){return se(Promise.resolve(ye(t)))}function _y(){return Yt(function(){return se(self.self)},arguments)}function by(){return Yt(function(t,e,n){return Reflect.set(ye(t),ye(e),ye(n))},arguments)}function yy(t,e,n){return se(ye(t).set(ye(e),ye(n)))}function xy(t,e,n){ye(t)[W(e)]=W(n)}function wy(t,e,n){ye(t).set(ye(e),n>>>0)}function vy(t,e,n){ye(t)[e>>>0]=W(n)}function ky(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=qe;R().setInt32(t+4,o,!0),R().setInt32(t+0,n,!0)}function Cy(t,e,n){return se(ye(t).subarray(e>>>0,n>>>0))}function Ny(t,e){return se(ye(t).then(ye(e)))}function jy(t){return se(ye(t).value)}function Ey(t){return se(ye(t).versions)}function Iy(t){return se(Dn.__wrap(t))}function Ay(){return Yt(function(){return se(window.window)},arguments)}function Ty(t){return+ye(t)}function My(t){return se(t)}function Oy(t){return se(BigInt.asUintN(64,t))}function Dy(t,e){const n=ye(e),o=typeof n=="bigint"?n:void 0;R().setBigInt64(t+8,Mn(o)?BigInt(0):o,!0),R().setInt32(t+0,!Mn(o),!0)}function Ry(t){const e=ye(t);return typeof e=="boolean"?e?1:0:2}function Py(t){const e=W(t).original;return e.cnt--==1?(e.a=0,!0):!1}function Ly(t,e,n){return se(Q0(t,e,10,P5))}function Fy(t,e,n){return se(Q0(t,e,8,L5))}function zy(t,e){const n=ft(Su(ye(e)),w.__wbindgen_export_0,w.__wbindgen_export_1),o=qe;R().setInt32(t+4,o,!0),R().setInt32(t+0,n,!0)}function By(t,e){return se(new Error(Tt(t,e)))}function Uy(t,e){return ye(t)in ye(e)}function Vy(t){return Array.isArray(ye(t))}function $y(t){return typeof ye(t)=="bigint"}function Hy(t){return!ye(t)}function Wy(t){return typeof ye(t)=="function"}function qy(t){return ye(t)===null}function Gy(t){const e=ye(t);return typeof e=="object"&&e!==null}function Yy(t){return typeof ye(t)=="string"}function Jy(t){return ye(t)===void 0}function Ky(t,e){return ye(t)===ye(e)}function Xy(t,e){return ye(t)==ye(e)}function Zy(){return se(w.memory)}function Qy(t,e){const n=ye(e),o=typeof n=="number"?n:void 0;R().setFloat64(t+8,Mn(o)?0:o,!0),R().setInt32(t+0,!Mn(o),!0)}function ex(t){return se(t)}function tx(t){return se(ye(t))}function nx(t){W(t)}function ox(t){throw W(t)}function rx(t,e){const n=ye(e),o=typeof n=="string"?n:void 0;var r=Mn(o)?0:ft(o,w.__wbindgen_export_0,w.__wbindgen_export_1),s=qe;R().setInt32(t+4,s,!0),R().setInt32(t+0,r,!0)}function sx(t,e){return se(Tt(t,e))}function ix(t,e){throw new Error(Tt(t,e))}function ax(t){return se(typeof ye(t))}const F5=Object.freeze(Object.defineProperty({__proto__:null,AwarenessWasm:tb,ChangeModifier:ts,Cursor:Gn,EphemeralStoreWasm:class{__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,rb.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,rb.register(this,this.__wbg_ptr,this),this}set(t,e){const n=ft(t,w.__wbindgen_export_0,w.__wbindgen_export_1),o=qe;w.ephemeralstorewasm_set(this.__wbg_ptr,n,o,se(e))}delete(t){const e=ft(t,w.__wbindgen_export_0,w.__wbindgen_export_1),n=qe;w.ephemeralstorewasm_delete(this.__wbg_ptr,e,n)}get(t){const e=ft(t,w.__wbindgen_export_0,w.__wbindgen_export_1),n=qe;return W(w.ephemeralstorewasm_get(this.__wbg_ptr,e,n))}getAllStates(){return W(w.ephemeralstorewasm_getAllStates(this.__wbg_ptr))}subscribeLocalUpdates(t){return W(w.ephemeralstorewasm_subscribeLocalUpdates(this.__wbg_ptr,se(t)))}subscribe(t){return W(w.ephemeralstorewasm_subscribe(this.__wbg_ptr,se(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=qe;w.ephemeralstorewasm_encode(r,this.__wbg_ptr,s,i);var e=R().getInt32(r+0,!0),n=R().getInt32(r+4,!0),o=oo(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=R().getInt32(o+0,!0),e=R().getInt32(o+4,!0),n=oo(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=qe;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=R().getInt32(o+0,!0),e=R().getInt32(o+4,!0),n=On(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=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);return t=n,e=o,Tt(n,o)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(t,e,1)}},LoroCounter:Ei,LoroDoc:yo,LoroList:Ii,LoroMap:Ko,LoroMovableList:Ai,LoroText:Xo,LoroTree:Ti,LoroTreeNode:ro,UndoManager:class{__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,ib.unregister(this),t}free(){const t=this.__destroy_into_raw();w.__wbg_undomanager_free(t,0)}constructor(t,e){es(t,yo);const n=w.undomanager_new(t.__wbg_ptr,se(e));return this.__wbg_ptr=n>>>0,ib.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=R().getInt32(n+0,!0),e=R().getInt32(n+4,!0);if(R().getInt32(n+8,!0))throw W(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=R().getInt32(n+0,!0),e=R().getInt32(n+4,!0);if(R().getInt32(n+8,!0))throw W(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=qe;w.undomanager_addExcludeOriginPrefix(this.__wbg_ptr,e,n)}setOnPush(t){w.undomanager_setOnPush(this.__wbg_ptr,se(t))}setOnPop(t){w.undomanager_setOnPop(this.__wbg_ptr,se(t))}clear(){w.undomanager_clear(this.__wbg_ptr)}},VersionVector:Dn,__wbg_String_8f0eb39a4a4c2f66:ab,__wbg_apply_9bb7fe8fff013a3f:lb,__wbg_buffer_ef9774282e5dab94:cb,__wbg_call_0ad083564791763a:db,__wbg_call_a34b6b4765f27be0:ub,__wbg_call_d00953b926be4879:hb,__wbg_call_efe5a4db7065d1a2:fb,__wbg_changemodifier_new:pb,__wbg_crypto_ed58b8e10a292839:mb,__wbg_cursor_new:gb,__wbg_done_f4c254830a095eaf:_b,__wbg_entries_4dce6361e3ba6fbc:bb,__wbg_entries_83beb641792ccb9c:yb,__wbg_error_7534b8e9a36f1ab4:xb,__wbg_error_9912f7d6d7835a4b:wb,__wbg_from_3aa0fcaa8eef0104:vb,__wbg_getRandomValues_bcb4912f16000dc4:kb,__wbg_get_0c3cc364764a0b98:Sb,__wbg_get_b996a12be035ef4f:Cb,__wbg_getindex_a471648b3037c750:Nb,__wbg_getwithrefkey_1dc361bd10053bfe:jb,__wbg_globalThis_6b4d52a0b6aaeaea:Eb,__wbg_global_49324ce12193de77:Ib,__wbg_instanceof_ArrayBuffer_ff40e55b5978e215:Ab,__wbg_instanceof_Map_0f3f3653f757ced1:Tb,__wbg_instanceof_Object_9108547bac1f91b1:Mb,__wbg_instanceof_Uint8Array_db97368f94b1373f:Ob,__wbg_isArray_8738f1062fa88586:Db,__wbg_isSafeInteger_a1b3e0811faecf2f:Rb,__wbg_iterator_c0c688f37fa815e6:Pb,__wbg_length_12246a78d2f65d3a:Lb,__wbg_length_c24da17096edfe57:Fb,__wbg_log_0cc1b7768397bcfe:zb,__wbg_log_0fd6c49475c7bece:Bb,__wbg_log_cb9e190acc5753fb:Ub,__wbg_lorocounter_new:Vb,__wbg_lorolist_new:$b,__wbg_loromap_new:Hb,__wbg_loromovablelist_new:Wb,__wbg_lorotext_new:qb,__wbg_lorotree_new:Gb,__wbg_lorotreenode_new:Yb,__wbg_mark_7438147ce31e9d4b:Jb,__wbg_measure_fb7825c11612c823:Kb,__wbg_msCrypto_0a36e2ec3a343d26:Xb,__wbg_new_518e2184725aa711:Zb,__wbg_new_59845962d1127937:Qb,__wbg_new_67abf4a77618ee3e:ey,__wbg_new_8a6f238a6ece86ea:ty,__wbg_new_e2d07398d7689006:ny,__wbg_newnoargs_a136448eeb7d48ac:oy,__wbg_newwithbyteoffsetandlength_84908302a4c137cf:ry,__wbg_newwithlength_4c216eaaf23f2f9a:sy,__wbg_newwithlength_88b49de1eb24d63e:iy,__wbg_next_928df8c15fc0c9b0:ay,__wbg_next_9dc0926f351c7090:ly,__wbg_node_02999533c4ea02e3:cy,__wbg_now_3e8577e703add0ba:dy,__wbg_ownKeys_b16312a839a4152c:uy,__wbg_process_5c1d670bc53614b8:hy,__wbg_push_e7d7247e69dad3ee:fy,__wbg_randomFillSync_ab2cfe79ebbf2740:py,__wbg_require_79b1e9274cde3c87:my,__wbg_resolve_267ff08e7e1d2ce4:gy,__wbg_self_cca3ca60d61220f4:_y,__wbg_set_1b50d2de855a9d50:by,__wbg_set_393f510a6b7e9da5:yy,__wbg_set_3f1d0b984ed272ed:xy,__wbg_set_5deee49b10b2b780:wy,__wbg_set_93ba9407b5476ec6:vy,__wbg_set_wasm:ku,__wbg_setindex_e0b7b31bfc87ba3f:ky,__wbg_stack_0ed75d68575b0f3c:Sy,__wbg_subarray_2dc34705c0dc7cdb:Cy,__wbg_then_84907e7a6730461e:Ny,__wbg_value_51f8a88d4a1805fb:jy,__wbg_versions_c71aa1626a93e0a1:Ey,__wbg_versionvector_new:Iy,__wbg_window_2aba046d3fc4ad7c:Ay,__wbindgen_as_number:Ty,__wbindgen_bigint_from_i64:My,__wbindgen_bigint_from_u64:Oy,__wbindgen_bigint_get_as_i64:Dy,__wbindgen_boolean_get:Ry,__wbindgen_cb_drop:Py,__wbindgen_closure_wrapper483:Ly,__wbindgen_closure_wrapper486:Fy,__wbindgen_debug_string:zy,__wbindgen_error_new:By,__wbindgen_in:Uy,__wbindgen_is_array:Vy,__wbindgen_is_bigint:$y,__wbindgen_is_falsy:Hy,__wbindgen_is_function:Wy,__wbindgen_is_null:qy,__wbindgen_is_object:Gy,__wbindgen_is_string:Yy,__wbindgen_is_undefined:Jy,__wbindgen_jsval_eq:Ky,__wbindgen_jsval_loose_eq:Xy,__wbindgen_memory:Zy,__wbindgen_number_get:Qy,__wbindgen_number_new:ex,__wbindgen_object_clone_ref:tx,__wbindgen_object_drop_ref:nx,__wbindgen_rethrow:ox,__wbindgen_string_get:rx,__wbindgen_string_new:sx,__wbindgen_throw:ix,__wbindgen_typeof:ax,decodeFrontiers:function(t){try{const o=w.__wbindgen_add_to_stack_pointer(-16),r=Jo(t,w.__wbindgen_export_0),s=qe;w.decodeFrontiers(o,r,s);var e=R().getInt32(o+0,!0),n=R().getInt32(o+4,!0);if(R().getInt32(o+8,!0))throw W(n);return W(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=qe;w.decodeImportBlobMeta(r,s,i,e);var n=R().getInt32(r+0,!0),o=R().getInt32(r+4,!0);if(R().getInt32(r+8,!0))throw W(o);return W(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}},encodeFrontiers:function(t){try{const s=w.__wbindgen_add_to_stack_pointer(-16),i=wn(t,w.__wbindgen_export_0),a=qe;w.encodeFrontiers(s,i,a);var e=R().getInt32(s+0,!0),n=R().getInt32(s+4,!0),o=R().getInt32(s+8,!0);if(R().getInt32(s+12,!0))throw W(o);var r=oo(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:nx,__wbg_lorotree_new:Gb,__wbg_lorocounter_new:Vb,__wbg_loromovablelist_new:Wb,__wbg_lorotreenode_new:Yb,__wbg_cursor_new:gb,__wbg_lorolist_new:$b,__wbg_lorotext_new:qb,__wbg_loromap_new:Hb,__wbg_versionvector_new:Iy,__wbg_changemodifier_new:pb,__wbindgen_is_function:Wy,__wbindgen_string_new:sx,__wbindgen_boolean_get:Ry,__wbindgen_error_new:By,__wbindgen_object_clone_ref:tx,__wbindgen_string_get:rx,__wbindgen_is_undefined:Jy,__wbindgen_in:Uy,__wbindgen_is_bigint:$y,__wbindgen_number_get:Qy,__wbindgen_bigint_from_i64:My,__wbindgen_jsval_eq:Ky,__wbindgen_is_object:Gy,__wbindgen_bigint_from_u64:Oy,__wbindgen_cb_drop:Py,__wbindgen_as_number:Ty,__wbindgen_is_string:Yy,__wbindgen_is_null:qy,__wbindgen_number_new:ex,__wbindgen_is_array:Vy,__wbindgen_typeof:ax,__wbg_error_9912f7d6d7835a4b:wb,__wbg_log_0fd6c49475c7bece:Bb,__wbindgen_is_falsy:Hy,__wbindgen_jsval_loose_eq:Xy,__wbg_String_8f0eb39a4a4c2f66:ab,__wbg_getwithrefkey_1dc361bd10053bfe:jb,__wbg_set_3f1d0b984ed272ed:xy,__wbg_log_cb9e190acc5753fb:Ub,__wbg_log_0cc1b7768397bcfe:zb,__wbg_mark_7438147ce31e9d4b:Jb,__wbg_measure_fb7825c11612c823:Kb,__wbg_new_8a6f238a6ece86ea:ty,__wbg_stack_0ed75d68575b0f3c:Sy,__wbg_error_7534b8e9a36f1ab4:xb,__wbg_now_3e8577e703add0ba:dy,__wbg_crypto_ed58b8e10a292839:mb,__wbg_process_5c1d670bc53614b8:hy,__wbg_versions_c71aa1626a93e0a1:Ey,__wbg_node_02999533c4ea02e3:cy,__wbg_require_79b1e9274cde3c87:my,__wbg_msCrypto_0a36e2ec3a343d26:Xb,__wbg_randomFillSync_ab2cfe79ebbf2740:py,__wbg_getRandomValues_bcb4912f16000dc4:kb,__wbg_self_cca3ca60d61220f4:_y,__wbg_window_2aba046d3fc4ad7c:Ay,__wbg_globalThis_6b4d52a0b6aaeaea:Eb,__wbg_global_49324ce12193de77:Ib,__wbg_newnoargs_a136448eeb7d48ac:oy,__wbg_call_0ad083564791763a:db,__wbg_get_0c3cc364764a0b98:Sb,__wbg_length_12246a78d2f65d3a:Lb,__wbg_new_e2d07398d7689006:ny,__wbg_new_518e2184725aa711:Zb,__wbg_next_928df8c15fc0c9b0:ay,__wbg_next_9dc0926f351c7090:ly,__wbg_done_f4c254830a095eaf:_b,__wbg_value_51f8a88d4a1805fb:jy,__wbg_iterator_c0c688f37fa815e6:Pb,__wbg_get_b996a12be035ef4f:Cb,__wbg_new_67abf4a77618ee3e:ey,__wbg_newwithlength_88b49de1eb24d63e:iy,__wbg_set_93ba9407b5476ec6:vy,__wbg_from_3aa0fcaa8eef0104:vb,__wbg_isArray_8738f1062fa88586:Db,__wbg_push_e7d7247e69dad3ee:fy,__wbg_instanceof_ArrayBuffer_ff40e55b5978e215:Ab,__wbg_call_a34b6b4765f27be0:ub,__wbg_call_efe5a4db7065d1a2:fb,__wbg_call_d00953b926be4879:hb,__wbg_instanceof_Map_0f3f3653f757ced1:Tb,__wbg_set_393f510a6b7e9da5:yy,__wbg_entries_4dce6361e3ba6fbc:bb,__wbg_isSafeInteger_a1b3e0811faecf2f:Rb,__wbg_instanceof_Object_9108547bac1f91b1:Mb,__wbg_entries_83beb641792ccb9c:yb,__wbg_apply_9bb7fe8fff013a3f:lb,__wbg_ownKeys_b16312a839a4152c:uy,__wbg_set_1b50d2de855a9d50:by,__wbg_buffer_ef9774282e5dab94:cb,__wbg_resolve_267ff08e7e1d2ce4:gy,__wbg_then_84907e7a6730461e:Ny,__wbg_newwithbyteoffsetandlength_84908302a4c137cf:ry,__wbg_new_59845962d1127937:Qb,__wbg_set_5deee49b10b2b780:wy,__wbg_length_c24da17096edfe57:Fb,__wbg_instanceof_Uint8Array_db97368f94b1373f:Ob,__wbg_newwithlength_4c216eaaf23f2f9a:sy,__wbg_subarray_2dc34705c0dc7cdb:Cy,__wbg_getindex_a471648b3037c750:Nb,__wbg_setindex_e0b7b31bfc87ba3f:ky,__wbindgen_bigint_get_as_i64:Dy,__wbindgen_debug_string:zy,__wbindgen_throw:ix,__wbindgen_rethrow:ox,__wbindgen_memory:Zy,__wbindgen_closure_wrapper483:Ly,__wbindgen_closure_wrapper486:Fy}},D5),z5=U.memory,B5=U.__wbg_lorocounter_free,U5=U.lorocounter_new,V5=U.lorocounter_kind,$5=U.lorocounter_id,H5=U.lorocounter_increment,W5=U.lorocounter_decrement,q5=U.lorocounter_value,G5=U.lorocounter_subscribe,Y5=U.lorocounter_parent,J5=U.lorocounter_isAttached,K5=U.lorocounter_getAttached,X5=U.lorocounter_getShallowValue,Z5=U.__wbg_awarenesswasm_free,Q5=U.awarenesswasm_new,e6=U.awarenesswasm_encode,t6=U.awarenesswasm_encodeAll,n6=U.awarenesswasm_apply,o6=U.awarenesswasm_setLocalState,r6=U.awarenesswasm_peer,s6=U.awarenesswasm_getAllStates,i6=U.awarenesswasm_getState,a6=U.awarenesswasm_getTimestamp,l6=U.awarenesswasm_removeOutdated,c6=U.awarenesswasm_length,d6=U.awarenesswasm_isEmpty,u6=U.awarenesswasm_peers,h6=U.__wbg_ephemeralstorewasm_free,f6=U.ephemeralstorewasm_new,p6=U.ephemeralstorewasm_set,m6=U.ephemeralstorewasm_delete,g6=U.ephemeralstorewasm_get,_6=U.ephemeralstorewasm_getAllStates,b6=U.ephemeralstorewasm_subscribeLocalUpdates,y6=U.ephemeralstorewasm_subscribe,x6=U.ephemeralstorewasm_encode,w6=U.ephemeralstorewasm_encodeAll,v6=U.ephemeralstorewasm_apply,k6=U.ephemeralstorewasm_removeOutdated,S6=U.ephemeralstorewasm_isEmpty,C6=U.ephemeralstorewasm_keys,N6=U.LORO_VERSION,j6=U.run,E6=U.encodeFrontiers,I6=U.decodeFrontiers,A6=U.setDebug,T6=U.__wbg_lorodoc_free,M6=U.lorodoc_new,O6=U.lorodoc_setDetachedEditing,D6=U.lorodoc_isDetachedEditingEnabled,R6=U.lorodoc_setRecordTimestamp,P6=U.lorodoc_setChangeMergeInterval,L6=U.lorodoc_configTextStyle,F6=U.lorodoc_configDefaultTextStyle,z6=U.lorodoc_fromSnapshot,B6=U.lorodoc_attach,U6=U.lorodoc_isDetached,V6=U.lorodoc_detach,$6=U.lorodoc_fork,H6=U.lorodoc_forkAt,W6=U.lorodoc_checkoutToLatest,q6=U.lorodoc_travelChangeAncestors,G6=U.lorodoc_findIdSpansBetween,Y6=U.lorodoc_checkout,J6=U.lorodoc_peerId,K6=U.lorodoc_peerIdStr,X6=U.lorodoc_setPeerId,Z6=U.lorodoc_commit,Q6=U.lorodoc_getPendingTxnLength,eI=U.lorodoc_getText,tI=U.lorodoc_getMap,nI=U.lorodoc_getList,oI=U.lorodoc_getMovableList,rI=U.lorodoc_getCounter,sI=U.lorodoc_getTree,iI=U.lorodoc_hasContainer,aI=U.lorodoc_getContainerById,lI=U.lorodoc_setNextCommitMessage,cI=U.lorodoc_setNextCommitOrigin,dI=U.lorodoc_setNextCommitTimestamp,uI=U.lorodoc_setNextCommitOptions,hI=U.lorodoc_clearNextCommitOptions,fI=U.lorodoc_getDeepValueWithID,pI=U.lorodoc_getPathToContainer,mI=U.lorodoc_JSONPath,gI=U.lorodoc_version,_I=U.lorodoc_shallowSinceVV,bI=U.lorodoc_isShallow,yI=U.lorodoc_shallowSinceFrontiers,xI=U.lorodoc_oplogVersion,wI=U.lorodoc_frontiers,vI=U.lorodoc_oplogFrontiers,kI=U.lorodoc_cmpWithFrontiers,SI=U.lorodoc_cmpFrontiers,CI=U.lorodoc_exportSnapshot,NI=U.lorodoc_exportFrom,jI=U.lorodoc_export,EI=U.lorodoc_exportJsonUpdates,II=U.lorodoc_exportJsonInIdSpan,AI=U.lorodoc_importJsonUpdates,TI=U.lorodoc_import,MI=U.lorodoc_importBatch,OI=U.lorodoc_getShallowValue,DI=U.lorodoc_toJSON,RI=U.lorodoc_subscribe,PI=U.lorodoc_subscribeLocalUpdates,LI=U.lorodoc_debugHistory,FI=U.lorodoc_changeCount,zI=U.lorodoc_opCount,BI=U.lorodoc_getAllChanges,UI=U.lorodoc_getChangeAt,VI=U.lorodoc_getChangeAtLamport,$I=U.lorodoc_getOpsInChange,HI=U.lorodoc_frontiersToVV,WI=U.lorodoc_vvToFrontiers,qI=U.lorodoc_getByPath,GI=U.lorodoc_getCursorPos,YI=U.lorodoc_getChangedContainersIn,JI=U.lorodoc_revertTo,KI=U.lorodoc_applyDiff,XI=U.lorodoc_diff,ZI=U.lorodoc_getUncommittedOpsAsJson,QI=U.lorodoc_subscribeFirstCommitFromPeer,e8=U.lorodoc_subscribePreCommit,t8=U.lorodoc_deleteRootContainer,n8=U.lorodoc_setHideEmptyRootContainers,o8=U.__wbg_lorotext_free,r8=U.lorotext_new,s8=U.lorotext_kind,i8=U.lorotext_iter,a8=U.lorotext_update,l8=U.lorotext_updateByLine,c8=U.lorotext_insert,d8=U.lorotext_slice,u8=U.lorotext_charAt,h8=U.lorotext_splice,f8=U.lorotext_insertUtf8,p8=U.lorotext_delete,m8=U.lorotext_deleteUtf8,g8=U.lorotext_mark,_8=U.lorotext_unmark,b8=U.lorotext_toString,y8=U.lorotext_toDelta,x8=U.lorotext_id,w8=U.lorotext_length,v8=U.lorotext_subscribe,k8=U.lorotext_applyDelta,S8=U.lorotext_parent,C8=U.lorotext_isAttached,N8=U.lorotext_getAttached,j8=U.lorotext_getCursor,E8=U.lorotext_push,I8=U.lorotext_getEditorOf,A8=U.lorotext_isDeleted,T8=U.lorotext_getShallowValue,M8=U.lorotext_toJSON,O8=U.__wbg_loromap_free,D8=U.loromap_new,R8=U.loromap_kind,P8=U.loromap_set,L8=U.loromap_delete,F8=U.loromap_get,z8=U.loromap_getOrCreateContainer,B8=U.loromap_keys,U8=U.loromap_values,V8=U.loromap_entries,$8=U.loromap_id,H8=U.loromap_toJSON,W8=U.loromap_setContainer,q8=U.loromap_subscribe,G8=U.loromap_size,Y8=U.loromap_parent,J8=U.loromap_isAttached,K8=U.loromap_getAttached,X8=U.loromap_clear,Z8=U.loromap_getLastEditor,Q8=U.loromap_isDeleted,eA=U.loromap_getShallowValue,tA=U.__wbg_lorolist_free,nA=U.lorolist_new,oA=U.lorolist_kind,rA=U.lorolist_insert,sA=U.lorolist_delete,iA=U.lorolist_get,aA=U.lorolist_id,lA=U.lorolist_toArray,cA=U.lorolist_toJSON,dA=U.lorolist_insertContainer,uA=U.lorolist_pushContainer,hA=U.lorolist_subscribe,fA=U.lorolist_length,pA=U.lorolist_parent,mA=U.lorolist_isAttached,gA=U.lorolist_getAttached,_A=U.lorolist_getCursor,bA=U.lorolist_push,yA=U.lorolist_pop,xA=U.lorolist_clear,wA=U.lorolist_getIdAt,vA=U.lorolist_isDeleted,kA=U.lorolist_getShallowValue,SA=U.loromovablelist_new,CA=U.loromovablelist_kind,NA=U.loromovablelist_insert,jA=U.loromovablelist_delete,EA=U.loromovablelist_get,IA=U.loromovablelist_id,AA=U.loromovablelist_toArray,TA=U.loromovablelist_toJSON,MA=U.loromovablelist_insertContainer,OA=U.loromovablelist_pushContainer,DA=U.loromovablelist_subscribe,RA=U.loromovablelist_length,PA=U.loromovablelist_parent,LA=U.loromovablelist_isAttached,FA=U.loromovablelist_getAttached,zA=U.loromovablelist_getCursor,BA=U.loromovablelist_move,UA=U.loromovablelist_set,VA=U.loromovablelist_setContainer,$A=U.loromovablelist_push,HA=U.loromovablelist_pop,WA=U.loromovablelist_clear,qA=U.loromovablelist_getCreatorAt,GA=U.loromovablelist_getLastMoverAt,YA=U.loromovablelist_getLastEditorAt,JA=U.loromovablelist_isDeleted,KA=U.loromovablelist_getShallowValue,XA=U.__wbg_lorotree_free,ZA=U.lorotreenode___getClassname,QA=U.__wbg_lorotreenode_free,eT=U.lorotreenode_id,tT=U.lorotreenode_createNode,nT=U.lorotreenode_move,oT=U.lorotreenode_moveAfter,rT=U.lorotreenode_moveBefore,sT=U.lorotreenode_index,iT=U.lorotreenode_fractionalIndex,aT=U.lorotreenode_data,lT=U.lorotreenode_toJSON,cT=U.lorotreenode_parent,dT=U.lorotreenode_children,uT=U.lorotreenode_isDeleted,hT=U.lorotreenode_getLastMoveId,fT=U.lorotreenode_creationId,pT=U.lorotreenode_creator,mT=U.lorotree_new,gT=U.lorotree_kind,_T=U.lorotree_createNode,bT=U.lorotree_move,yT=U.lorotree_delete,xT=U.lorotree_getNodeByID,wT=U.lorotree_id,vT=U.lorotree_has,kT=U.lorotree_isNodeDeleted,ST=U.lorotree_toArray,CT=U.lorotree_getNodes,NT=U.lorotree_toJSON,jT=U.lorotree_nodes,ET=U.lorotree_roots,IT=U.lorotree_subscribe,AT=U.lorotree_parent,TT=U.lorotree_isAttached,MT=U.lorotree_getAttached,OT=U.lorotree_enableFractionalIndex,DT=U.lorotree_disableFractionalIndex,RT=U.lorotree_isFractionalIndexEnabled,PT=U.lorotree_isDeleted,LT=U.lorotree_getShallowValue,FT=U.__wbg_cursor_free,zT=U.cursor_containerId,BT=U.cursor_pos,UT=U.cursor_side,VT=U.cursor_encode,$T=U.cursor_decode,HT=U.cursor_kind,WT=U.__wbg_undomanager_free,qT=U.undomanager_new,GT=U.undomanager_undo,YT=U.undomanager_redo,JT=U.undomanager_canUndo,KT=U.undomanager_canRedo,XT=U.undomanager_setMaxUndoSteps,ZT=U.undomanager_setMergeInterval,QT=U.undomanager_addExcludeOriginPrefix,e7=U.undomanager_setOnPush,t7=U.undomanager_setOnPop,n7=U.undomanager_clear,o7=U.__wbg_versionvector_free,r7=U.versionvector_new,s7=U.versionvector_parseJSON,i7=U.versionvector_toJSON,a7=U.versionvector_encode,l7=U.versionvector_decode,c7=U.versionvector_get,d7=U.versionvector_compare,u7=U.versionvector_setEnd,h7=U.versionvector_setLast,f7=U.versionvector_remove,p7=U.versionvector_length,m7=U.decodeImportBlobMeta,g7=U.__wbg_changemodifier_free,_7=U.changemodifier_setMessage,b7=U.changemodifier_setTimestamp,y7=U.lorodoc_importUpdateBatch,x7=U.__wbg_loromovablelist_free,w7=U.__wbindgen_export_0,v7=U.__wbindgen_export_1,k7=U.__wbindgen_export_2,S7=U.__wbindgen_export_3,C7=U.__wbindgen_export_4,N7=U.__wbindgen_add_to_stack_pointer,j7=U.__wbindgen_export_5,E7=U.__wbindgen_export_6,Ou=U.__wbindgen_start,lx=Object.freeze(Object.defineProperty({__proto__:null,LORO_VERSION:N6,__wbg_awarenesswasm_free:Z5,__wbg_changemodifier_free:g7,__wbg_cursor_free:FT,__wbg_ephemeralstorewasm_free:h6,__wbg_lorocounter_free:B5,__wbg_lorodoc_free:T6,__wbg_lorolist_free:tA,__wbg_loromap_free:O8,__wbg_loromovablelist_free:x7,__wbg_lorotext_free:o8,__wbg_lorotree_free:XA,__wbg_lorotreenode_free:QA,__wbg_undomanager_free:WT,__wbg_versionvector_free:o7,__wbindgen_add_to_stack_pointer:N7,__wbindgen_export_0:w7,__wbindgen_export_1:v7,__wbindgen_export_2:k7,__wbindgen_export_3:S7,__wbindgen_export_4:C7,__wbindgen_export_5:j7,__wbindgen_export_6:E7,__wbindgen_start:Ou,awarenesswasm_apply:n6,awarenesswasm_encode:e6,awarenesswasm_encodeAll:t6,awarenesswasm_getAllStates:s6,awarenesswasm_getState:i6,awarenesswasm_getTimestamp:a6,awarenesswasm_isEmpty:d6,awarenesswasm_length:c6,awarenesswasm_new:Q5,awarenesswasm_peer:r6,awarenesswasm_peers:u6,awarenesswasm_removeOutdated:l6,awarenesswasm_setLocalState:o6,changemodifier_setMessage:_7,changemodifier_setTimestamp:b7,cursor_containerId:zT,cursor_decode:$T,cursor_encode:VT,cursor_kind:HT,cursor_pos:BT,cursor_side:UT,decodeFrontiers:I6,decodeImportBlobMeta:m7,encodeFrontiers:E6,ephemeralstorewasm_apply:v6,ephemeralstorewasm_delete:m6,ephemeralstorewasm_encode:x6,ephemeralstorewasm_encodeAll:w6,ephemeralstorewasm_get:g6,ephemeralstorewasm_getAllStates:_6,ephemeralstorewasm_isEmpty:S6,ephemeralstorewasm_keys:C6,ephemeralstorewasm_new:f6,ephemeralstorewasm_removeOutdated:k6,ephemeralstorewasm_set:p6,ephemeralstorewasm_subscribe:y6,ephemeralstorewasm_subscribeLocalUpdates:b6,lorocounter_decrement:W5,lorocounter_getAttached:K5,lorocounter_getShallowValue:X5,lorocounter_id:$5,lorocounter_increment:H5,lorocounter_isAttached:J5,lorocounter_kind:V5,lorocounter_new:U5,lorocounter_parent:Y5,lorocounter_subscribe:G5,lorocounter_value:q5,lorodoc_JSONPath:mI,lorodoc_applyDiff:KI,lorodoc_attach:B6,lorodoc_changeCount:FI,lorodoc_checkout:Y6,lorodoc_checkoutToLatest:W6,lorodoc_clearNextCommitOptions:hI,lorodoc_cmpFrontiers:SI,lorodoc_cmpWithFrontiers:kI,lorodoc_commit:Z6,lorodoc_configDefaultTextStyle:F6,lorodoc_configTextStyle:L6,lorodoc_debugHistory:LI,lorodoc_deleteRootContainer:t8,lorodoc_detach:V6,lorodoc_diff:XI,lorodoc_export:jI,lorodoc_exportFrom:NI,lorodoc_exportJsonInIdSpan:II,lorodoc_exportJsonUpdates:EI,lorodoc_exportSnapshot:CI,lorodoc_findIdSpansBetween:G6,lorodoc_fork:$6,lorodoc_forkAt:H6,lorodoc_fromSnapshot:z6,lorodoc_frontiers:wI,lorodoc_frontiersToVV:HI,lorodoc_getAllChanges:BI,lorodoc_getByPath:qI,lorodoc_getChangeAt:UI,lorodoc_getChangeAtLamport:VI,lorodoc_getChangedContainersIn:YI,lorodoc_getContainerById:aI,lorodoc_getCounter:rI,lorodoc_getCursorPos:GI,lorodoc_getDeepValueWithID:fI,lorodoc_getList:nI,lorodoc_getMap:tI,lorodoc_getMovableList:oI,lorodoc_getOpsInChange:$I,lorodoc_getPathToContainer:pI,lorodoc_getPendingTxnLength:Q6,lorodoc_getShallowValue:OI,lorodoc_getText:eI,lorodoc_getTree:sI,lorodoc_getUncommittedOpsAsJson:ZI,lorodoc_hasContainer:iI,lorodoc_import:TI,lorodoc_importBatch:MI,lorodoc_importJsonUpdates:AI,lorodoc_importUpdateBatch:y7,lorodoc_isDetached:U6,lorodoc_isDetachedEditingEnabled:D6,lorodoc_isShallow:bI,lorodoc_new:M6,lorodoc_opCount:zI,lorodoc_oplogFrontiers:vI,lorodoc_oplogVersion:xI,lorodoc_peerId:J6,lorodoc_peerIdStr:K6,lorodoc_revertTo:JI,lorodoc_setChangeMergeInterval:P6,lorodoc_setDetachedEditing:O6,lorodoc_setHideEmptyRootContainers:n8,lorodoc_setNextCommitMessage:lI,lorodoc_setNextCommitOptions:uI,lorodoc_setNextCommitOrigin:cI,lorodoc_setNextCommitTimestamp:dI,lorodoc_setPeerId:X6,lorodoc_setRecordTimestamp:R6,lorodoc_shallowSinceFrontiers:yI,lorodoc_shallowSinceVV:_I,lorodoc_subscribe:RI,lorodoc_subscribeFirstCommitFromPeer:QI,lorodoc_subscribeLocalUpdates:PI,lorodoc_subscribePreCommit:e8,lorodoc_toJSON:DI,lorodoc_travelChangeAncestors:q6,lorodoc_version:gI,lorodoc_vvToFrontiers:WI,lorolist_clear:xA,lorolist_delete:sA,lorolist_get:iA,lorolist_getAttached:gA,lorolist_getCursor:_A,lorolist_getIdAt:wA,lorolist_getShallowValue:kA,lorolist_id:aA,lorolist_insert:rA,lorolist_insertContainer:dA,lorolist_isAttached:mA,lorolist_isDeleted:vA,lorolist_kind:oA,lorolist_length:fA,lorolist_new:nA,lorolist_parent:pA,lorolist_pop:yA,lorolist_push:bA,lorolist_pushContainer:uA,lorolist_subscribe:hA,lorolist_toArray:lA,lorolist_toJSON:cA,loromap_clear:X8,loromap_delete:L8,loromap_entries:V8,loromap_get:F8,loromap_getAttached:K8,loromap_getLastEditor:Z8,loromap_getOrCreateContainer:z8,loromap_getShallowValue:eA,loromap_id:$8,loromap_isAttached:J8,loromap_isDeleted:Q8,loromap_keys:B8,loromap_kind:R8,loromap_new:D8,loromap_parent:Y8,loromap_set:P8,loromap_setContainer:W8,loromap_size:G8,loromap_subscribe:q8,loromap_toJSON:H8,loromap_values:U8,loromovablelist_clear:WA,loromovablelist_delete:jA,loromovablelist_get:EA,loromovablelist_getAttached:FA,loromovablelist_getCreatorAt:qA,loromovablelist_getCursor:zA,loromovablelist_getLastEditorAt:YA,loromovablelist_getLastMoverAt:GA,loromovablelist_getShallowValue:KA,loromovablelist_id:IA,loromovablelist_insert:NA,loromovablelist_insertContainer:MA,loromovablelist_isAttached:LA,loromovablelist_isDeleted:JA,loromovablelist_kind:CA,loromovablelist_length:RA,loromovablelist_move:BA,loromovablelist_new:SA,loromovablelist_parent:PA,loromovablelist_pop:HA,loromovablelist_push:$A,loromovablelist_pushContainer:OA,loromovablelist_set:UA,loromovablelist_setContainer:VA,loromovablelist_subscribe:DA,loromovablelist_toArray:AA,loromovablelist_toJSON:TA,lorotext_applyDelta:k8,lorotext_charAt:u8,lorotext_delete:p8,lorotext_deleteUtf8:m8,lorotext_getAttached:N8,lorotext_getCursor:j8,lorotext_getEditorOf:I8,lorotext_getShallowValue:T8,lorotext_id:x8,lorotext_insert:c8,lorotext_insertUtf8:f8,lorotext_isAttached:C8,lorotext_isDeleted:A8,lorotext_iter:i8,lorotext_kind:s8,lorotext_length:w8,lorotext_mark:g8,lorotext_new:r8,lorotext_parent:S8,lorotext_push:E8,lorotext_slice:d8,lorotext_splice:h8,lorotext_subscribe:v8,lorotext_toDelta:y8,lorotext_toJSON:M8,lorotext_toString:b8,lorotext_unmark:_8,lorotext_update:a8,lorotext_updateByLine:l8,lorotree_createNode:_T,lorotree_delete:yT,lorotree_disableFractionalIndex:DT,lorotree_enableFractionalIndex:OT,lorotree_getAttached:MT,lorotree_getNodeByID:xT,lorotree_getNodes:CT,lorotree_getShallowValue:LT,lorotree_has:vT,lorotree_id:wT,lorotree_isAttached:TT,lorotree_isDeleted:PT,lorotree_isFractionalIndexEnabled:RT,lorotree_isNodeDeleted:kT,lorotree_kind:gT,lorotree_move:bT,lorotree_new:mT,lorotree_nodes:jT,lorotree_parent:AT,lorotree_roots:ET,lorotree_subscribe:IT,lorotree_toArray:ST,lorotree_toJSON:NT,lorotreenode___getClassname:ZA,lorotreenode_children:dT,lorotreenode_createNode:tT,lorotreenode_creationId:fT,lorotreenode_creator:pT,lorotreenode_data:aT,lorotreenode_fractionalIndex:iT,lorotreenode_getLastMoveId:hT,lorotreenode_id:eT,lorotreenode_index:sT,lorotreenode_isDeleted:uT,lorotreenode_move:nT,lorotreenode_moveAfter:oT,lorotreenode_moveBefore:rT,lorotreenode_parent:cT,lorotreenode_toJSON:lT,memory:z5,run:j6,setDebug:A6,undomanager_addExcludeOriginPrefix:QT,undomanager_canRedo:KT,undomanager_canUndo:JT,undomanager_clear:n7,undomanager_new:qT,undomanager_redo:YT,undomanager_setMaxUndoSteps:XT,undomanager_setMergeInterval:ZT,undomanager_setOnPop:t7,undomanager_setOnPush:e7,undomanager_undo:GT,versionvector_compare:d7,versionvector_decode:l7,versionvector_encode:a7,versionvector_get:c7,versionvector_length:p7,versionvector_new:r7,versionvector_parseJSON:s7,versionvector_remove:f7,versionvector_setEnd:u7,versionvector_setLast:h7,versionvector_toJSON:i7},Symbol.toStringTag,{value:"Module"}));if(Ou)ku(lx),Ou();else{const t=await Dp(()=>Promise.resolve().then(()=>lx),void 0,import.meta.url);ku(new WebAssembly.Instance(t.default,{"./loro_wasm_bg.js":F5}).exports)}const I7=["Map","Text","List","Tree","MovableList","Counter"];function cx(t){if(typeof t!="object"||t==null)return!1;const e=Object.getPrototypeOf(t);return e!=null&&typeof e=="object"&&typeof e.kind=="function"&&I7.includes(t.kind())}yo.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 u=c.getShallowValue();return typeof u=="object"?r(u):u}if(cx(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(cx(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 A7=(t,e,n)=>Zn.define(o=>new T7(o,t,e,n)),ns=vp.define();class T7{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 u of d)u.insert?i.push({from:a,to:a,insert:u.insert}):u.delete?(i.push({from:a,to:a+u.delete}),a+=u.delete):u.retain!=null&&(a+=u.retain);i.length>0&&this.view.dispatch({changes:i,annotations:[ns.of(this)]})}}}else this.view.dispatch({changes:[{from:0,to:this.view.state.doc.length,insert:this.getTextFromDoc(this.doc).toString()}],annotations:[ns.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(ns)===this||e.transactions[0].annotation(ns)==="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 M7=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"}}),Mi=Ut.define(),Du=En.define({create:()=>({remoteCursors:new Map,isCheckout:!1}),update(t,e){for(const n of e.effects)if(n.is(Mi))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}}),dx=t=>{const e=t.transactions.flatMap(n=>n.effects).filter(n=>n.is(Mi));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===uU.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 O7=(t,e,n,o)=>{const r=[],{updated:s,added:i}=n;for(const a of[...s,...i]){const l=ux(t,e,a,o);l&&r.push(l)}return r},ux=(t,e,n,o)=>{const r=e.getAllStates()[n];if(!r||n===t.peerIdStr||r.scopeId!==o)return;if(r.type==="delete")return Mi.of({type:"delete",peer:r.uid,scopeId:r.scopeId});const s=Gn.decode(r.cursor.anchor),i=t.getCursorPos(s).offset;let a=i;if(r.cursor.head){const l=Gn.decode(r.cursor.head);a=t.getCursorPos(l).offset}return Mi.of({type:"update",peer:r.uid,scopeId:r.scopeId,cursor:{anchor:i,head:a},user:r.user})};class D7{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 u=ux(this.doc,this.awareness,d,this.scopeId);u&&c.push(u)}this.view.dispatch({effects:c})}else l.by==="checkout"&&this.view.dispatch({effects:[Mi.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=P7(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 R7{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:O7(this.doc,this.awareness,i,this.scopeId)})};this._awarenessListener=s,this.awareness.addListener(s)}destroy(){this._awarenessListener&&this.awareness.removeListener(this._awarenessListener)}}const P7=(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)]"],dn=Xt.get("rtc"),hx=dn.get("awareness").disabled(),Ru="awareness:",os=Zt(void 0),Ht=new yo,Cl=new class{constructor(t,e=3e4){this.listeners=new Set,this.inner=new tb(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))}}(Ht.peerIdStr),Pu=fU(()=>{dn.debug("creating websocket");const t=pU(k4()).replace("/ws","/ws_sync"),e=new N$(t,void 0,{maxRetries:10,debug:!1,startClosed:!0,connectionTimeout:1e4});return Promise.resolve().then(async()=>{await mU(),gU()==="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,Ru)){const i=function(a,l){return a.slice(l.length)}(s,Ru);return Cl.apply(i),void hx.debug("applied awareness update")}Ht.import(s),dn.debug("imported doc change. new doc:",Ht.toJSON()),ut.get(os)!==Ht&&ut.set(os,Ht)}),e.addEventListener("open",()=>{dn.debug("websocket open")}),e.addEventListener("close",n=>{dn.warn("websocket close",n),ut.get(os)===Ht&&ut.set(os,void 0)}),e});function Lu(t,e,n=""){if(Bn())return{extension:[],code:n};const o=Ht.getByPath(`codes/${t}`)!==void 0,r=Ht.getMap("codes").getOrCreateContainer(t,new Xo);o||(dn.log("initializing code for new cell",n),r.insert(0,n));const s={get name(){return ut.get(S4)||"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:[L7(t),F7(t),z7(Ht,Cl,s,()=>r,t),A7(Ht,["codes",t],()=>r)]}}function L7(t){const e=(o,r)=>{const s=o.state.field(Cc).type,i=r.toString();i&&i!==s&&(dn.debug(`[incoming] setting language type: ${s} -> ${i}`),Or(o,i,{keepCodeAsIs:!0}))},n=(o,r)=>{const s=o.state.field(Pp),i=r.toJSON();ra(s,i)||o.dispatch({effects:[w4.of(i)],annotations:[ns.of(!0)]})};return Zn.define(o=>{let r;return Promise.resolve().then(()=>{const s=Ht.getByPath(`languages/${t}`);if(!s)return void dn.error("no language container found for cell",t);Bo(s instanceof Xo,"language type is not a LoroText");const i=Ht.getByPath(`language_metadata/${t}`);i?(Bo(i instanceof Ko,"language metadata is not a LoroMap"),e(o,s),n(o,i),r=Ht.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)})):dn.error("no language metadata container found for cell",t)}),{destroy(){r()}}})}function F7(t){const e=Ht.getMap("languages").getOrCreateContainer(t,new Xo),n=Ht.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=Rp(o.state).type;Or(o.view,i),dn.debug("no initial language, setting default to",i),e.delete(0,e.length),e.insert(0,i),dn.debug("no initial language metadata, setting default to",o.state.field(Pp));const a=o.state.field(Pp);for(const l of Object.keys(a))n.set(l,a[l]);return void Ht.commit()}let s=!1;for(const i of o.transactions)if(!i.annotation(ns)){for(const a of i.effects)if(a.is(hU)&&e.toString()!==a.value.type&&(dn.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(v4)){const l=a.value;a.is(v4)?(dn.debug("[outgoing] setting language metadata: ",l),n.clear()):dn.debug("[outgoing] updating language metadata: ",l);for(const c of Object.keys(l))n.set(c,l[c]);s=!0}}s&&Ht.commit()})}function z7(t,e,n,o,r,s){const i=`loro:cell:${r}`;return[Du,x4({above:!0,class:"loro-cursor-layer",update:dx,markers:a=>{const{remoteCursors:l,isCheckout:c}=a.state.field(Du);return c?[]:[...l.values()].flatMap(d=>{var f,p;const u=Uo.cursor(d.cursor.anchor);return kl.createCursor(a,u,((f=d.user)==null?void 0:f.name)||"unknown",((p=d.user)==null?void 0:p.colorClassName)||"")})}}),x4({above:!1,class:"loro-selection-layer",update:dx,markers:a=>{const{remoteCursors:l,isCheckout:c}=a.state.field(Du);return c?[]:[...l.entries()].filter(([,d])=>d.cursor.head!==void 0&&d.cursor.anchor!==d.cursor.head).flatMap(([,d])=>{var f;const u=Uo.range(d.cursor.anchor,d.cursor.head);return dU.forRange(a,`loro-selection ${((f=d.user)==null?void 0:f.colorClassName)||""}`,u)})}}),Zn.define(a=>new D7(a,t,n,e,o,i,s)),Zn.define(a=>new R7(a,t,e,i)),M7]}ga()&&Pu(),Ht.subscribeLocalUpdates(t=>{dn.debug("local update, sending to server"),Pu().send(t)}),Cl.addListener((t,e)=>{const n=[...t.added,...t.removed,...t.updated];e==="local"&&(hx.debug("awareness changes",n),Pu().send(function(o,r){const s=new TextEncoder().encode(o);return new Uint8Array([...s,...r])}(Ru,Cl.encode(n))))});const fx=({theme:t,showPlaceholder:e,allowFocus:n,id:o,config:r,code:s,status:i,serializedEditorState:a,setEditorView:l,runCell:c,userConfig:d,editorViewRef:u,editorViewParentRef:f,hidden:p,hasOutput:_,temporarilyShowCode:g,languageAdapter:m,setLanguageAdapter:b,showLanguageToggles:x=!0})=>{var re;const[y,v]=fn(Aa),k=_U(),S=ad(),{saveOrNameNotebook:E}=Lg(),j=i==="running"||i==="queued",I=Lt(),T=Qm(),M=m==="markdown",L=Qe(()=>!j&&(S({cellId:o}),!0)),B=Qe(()=>!j&&(c(),!0)),O=Qe(()=>{const ne=!r.hide_code;return Dr({configs:{[o]:{hide_code:ne}}}),I.updateCellConfig({cellId:o,config:{hide_code:ne}}),ne}),z=He(Ts),F=Qe(()=>{ar(z,I.createNewCell)}),V=bU(d),P=A.useMemo(()=>{const ne=rE({cellId:o,showPlaceholder:e,enableAI:V,cellActions:{...I,afterToggleMarkdown:F,onRun:B,deleteCell:L,saveNotebook:E,createManyBelow:oe=>{for(const Y of[...oe].reverse())I.createNewCell({code:Y,before:!1,cellId:o,skipIfCodeExists:!0})},splitCell:T,toggleHideCode:O,aiCellCompletion:()=>{let oe=!1;return v(Y=>(Y==null?void 0:Y.cellId)===o?(oe=!0,null):{cellId:o}),oe}},completionConfig:d.completion,keymapConfig:d.keymap,lspConfig:d.language_servers,theme:t,hotkeys:new C4(d.keymap.overrides??{}),diagnosticsConfig:d.diagnostics});return ne.push(Zn.define(oe=>{const Y=oe.state.field(Cc);return b(Y.type),{update(Q){const ce=Q.state.field(Cc);b(ce.type)}}}),st.updateListener.of(oe=>{oe.selectionSet&&oe.state.selection.ranges.some(Y=>Y.from!==Y.to)&&g({focus:!1})})),ne},[o,d.keymap,d.completion,d.language_servers,d.diagnostics,V,t,e,I,T,O,L,B,v,F,b,g,E]),C=ga(),$=Qe(()=>{if(C){const oe=Lu(o,0,s);P.push(oe.extension),s=oe.code}const ne=new st({state:ca.create({doc:s,extensions:P})});l(ne),C||Or(ne,Rp(ne.state).type)}),N=Qe(()=>{if(Bo(u.current!==null,"Editor view is not initialized"),C){const ne=Lu(o);P.push(ne.extension)}u.current.dispatch({effects:[Ut.reconfigure.of([P]),yU(u.current,d.completion,new C4(d.keymap.overrides??{}),{...d.language_servers,diagnostics:d.diagnostics})]})}),H=Qe(()=>{if(Bo(a,"Editor view is not initialized"),C){const oe=Lu(o,0,s);P.push(oe.extension),s=oe.code}const ne=new st({state:ca.fromJSON(a,{doc:s,extensions:P},{history:xU})});C||Or(ne,Rp(ne.state).type),l(ne),I.clearSerializedEditorState({cellId:o})});A.useEffect(()=>{a===null?u.current===null?$():N():H(),u.current!==null&&f&&f.current!==null&&f.current.replaceChildren(u.current.dom)},[$,N,H,u,f,a,P]);const G=(u.current===null||a!==null)&&!ga();A.useEffect(()=>{const ne=ut.get(xp).scrollKey!==null;G&&n&&!ne&&requestAnimationFrame(()=>{var oe,Y;(oe=u.current)==null||oe.focus(),(Y=u.current)==null||Y.dom.scrollIntoView({behavior:"smooth",block:"nearest"})})},[G,n,u]),A.useEffect(()=>{const ne=u.current;return()=>{ne==null||ne.destroy()}},[u]);const Z=p&&!M||p&&M&&!_;let q="";return M&&p&&_?q="h-0 overflow-hidden":p&&(q="opacity-20 h-8 overflow-hidden"),h.jsx(M5,{enabled:(y==null?void 0:y.cellId)===o,initialPrompt:y==null?void 0:y.initialPrompt,currentCode:((re=u.current)==null?void 0:re.state.doc.toString())??s,currentLanguageAdapter:m,declineChange:Qe(()=>{var ne;v(null),(ne=u.current)==null||ne.focus()}),onChange:Qe(ne=>{var oe;(oe=u.current)==null||oe.dispatch({changes:{from:0,to:u.current.state.doc.length,insert:ne}})}),acceptChange:Qe(ne=>{var oe,Y;(oe=u.current)==null||oe.dispatch({changes:{from:0,to:u.current.state.doc.length,insert:ne}}),(Y=u.current)==null||Y.focus(),v(null)}),children:h.jsxs("div",{className:"relative w-full",onFocus:()=>k(o),children:[Z&&h.jsx(N4,{tooltip:"Edit code",className:"absolute inset-0 z-10",onClick:g}),h.jsx(px,{className:q,editorView:u.current,ref:f}),!p&&x&&h.jsx("div",{className:"absolute top-1 right-5",children:h.jsx(d5,{code:s,editorView:u.current,currentLanguageAdapter:m,onAfterToggle:F})})]})})},px=K.forwardRef((t,e)=>{const n=X.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=Oe("cm mathjax_ignore",o),n[3]=o,n[4]=l):l=n[4],n[5]!==e?(c=u=>{e?ml(e,s)(u):ml(s)(u)},n[5]=e,n[6]=c):c=n[6],n[7]!==l||n[8]!==c?(d=h.jsx("div",{className:l,ref:c,"data-testid":"cell-editor"}),n[7]=l,n[8]=c,n[9]=d):d=n[9],d});px.displayName="CellCodeMirrorEditor";const Fu=ga()?function(t){const e=n=>{const o=X.c(5),r=He(mo),[s,i]=fn(os);if(r.state===en.CONNECTING||s===void 0){let l,c;return o[0]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx("span",{children:"Waiting for real-time collaboration connection..."}),o[0]=l):l=o[0],o[1]!==i?(c=h.jsx("div",{className:"flex h-full w-full items-baseline p-4",children:h.jsxs(j4,{milliseconds:1e3,fallback:null,children:[l,h.jsx(Pe,{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=h.jsx(t,{...n}),o[3]=n,o[4]=a):a=o[4],a};return e.displayName=`WithWaitUntilConnected(${t.displayName})`,e}(A.memo(fx)):A.memo(fx),B7=t=>{const e=X.c(10);let n,o,r,s;return e[0]!==t.left?(n=h.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=h.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=h.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=h.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},U7=t=>{const e=X.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=h.jsx("span",{children:h.jsx(V7,{isCollapsed:t.isCollapsed})}),e[0]=t.isCollapsed,e[1]=o):o=e[1],e[2]!==n||e[3]!==o?(r=h.jsx(Re,{content:n,children:o}),e[2]=n,e[3]=o,e[4]=r):r=e[4],e[5]!==t.onClick||e[6]!==r?(s=h.jsx(Pe,{variant:"text",size:"icon",onClick:t.onClick,children:r}),e[5]=t.onClick,e[6]=r,e[7]=s):s=e[7],s},V7=t=>{const e=X.c(2),{isCollapsed:n}=t;let o;return e[0]!==n?(o=n?h.jsx(lc,{className:"w-5 h-5 flex-shrink-0"}):h.jsx(Zi,{className:"w-5 h-5 flex-shrink-0"}),e[0]=n,e[1]=o):o=e[1],o},mx=A.memo(t=>{const e=X.c(24),{onClick:n,count:o,cellId:r}=t,s=vc();let i;e[0]!==r||e[1]!==s?(i=wU(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=Oe("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=h.jsx(vU,{className:"w-4 h-4 flex-shrink-0"}),e[4]=c):c=e[4];const d=o===1?"cell":"cells";let u,f,p,_,g,m,b;return e[5]!==o||e[6]!==d?(u=h.jsxs(h.Fragment,{children:[c,h.jsxs("span",{className:"text-sm text-gray-500",children:[o," ",d," collapsed"]})]}),e[5]=o,e[6]=d,e[7]=u):u=e[7],e[8]!==a.errored?(f=a.errored&&h.jsx(Re,{content:"Has errors",delayDuration:100,children:h.jsx(Im,{className:"w-4 h-4 flex-shrink-0 text-destructive"})}),e[8]=a.errored,e[9]=f):f=e[9],e[10]!==a.stale?(p=a.stale&&h.jsx(Re,{content:"Has stale cells",delayDuration:100,children:h.jsx(E4,{className:"w-4 h-4 flex-shrink-0 text-[var(--yellow-11)]"})}),e[10]=a.stale,e[11]=p):p=e[11],e[12]!==a.runningOrQueued?(_=a.runningOrQueued&&h.jsx(Re,{content:"Running",delayDuration:100,children:h.jsx(Op,{className:"w-4 h-4 flex-shrink-0 animate-spin"})}),e[12]=a.runningOrQueued,e[13]=_):_=e[13],e[14]!==f||e[15]!==p||e[16]!==_?(g=h.jsxs(h.Fragment,{children:[f,p,_]}),e[14]=f,e[15]=p,e[16]=_,e[17]=g):g=e[17],e[18]!==u||e[19]!==g?(m=h.jsx(B7,{center:u,right:g}),e[18]=u,e[19]=g,e[20]=m):m=e[20],e[21]!==n||e[22]!==m?(b=h.jsx("div",{onClick:n,className:l,children:m}),e[21]=n,e[22]=m,e[23]=b):b=e[23],b});mx.displayName="CollapsedCellBanner";const $7=t=>{const e=X.c(6),{appClosed:n,status:o}=t,r=Dg(o==="running");let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=pn("global.interrupt"),e[0]=s):s=e[0];const i=n||!r,a=r?Lp:jn.NOOP,l=r?"stale":"disabled";let c,d;return e[1]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(Qf,{strokeWidth:1.5}),e[1]=c):c=e[1],e[2]!==i||e[3]!==a||e[4]!==l?(d=h.jsx(xi,{tooltip:s,disabled:i,onClick:a,variant:l,"data-testid":"run-button",children:c}),e[2]=i,e[3]=a,e[4]=l,e[5]=d):d=e[5],d},H7={width:void 0,height:void 0};function gx(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 _x(t,e){const n=X.c(9);let o;n[0]!==t.current||n[1]!==e?(o=l=>{t.current===null||t.current.contains(l.relatedTarget)||e.current===null||op(e.current)},n[0]=t.current,n[1]=e,n[2]=o):o=n[2];const r=Qe(o);let s;n[3]!==t.current||n[4]!==e?(s=l=>{if(t.current===document.activeElement&&e.current!==null&&sa(e.current.state)==="active"){for(const c of c4)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=Qe(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 bx(t,e,n,o,r,s,i,a,l){const c=X.c(51);let d,u,f,p,_,g,m,b,x,y,v,k,S,E,j,I;c[0]!==o||c[1]!==e||c[2]!==n?(d=()=>{n(),o.moveToNextCell({cellId:e,before:!1})},u=()=>{n(),o.moveToNextCell({cellId:e,before:!0})},c[0]=o,c[1]=e,c[2]=n,c[3]=d,c[4]=u):(d=c[3],u=c[4]),c[5]!==o||c[6]!==e?(f=()=>o.createNewCell({cellId:e,before:!0}),p=()=>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]=p,c[9]=_,c[10]=g):(f=c[7],p=c[8],_=c[9],g=c[10]),c[11]!==o||c[12]!==r||c[13]!==e?(m=()=>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]=m,c[15]=b):(m=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?(x=()=>{var M,L,B;const T=!s.hide_code;Dr({configs:{[e]:{hide_code:T}}}),o.updateCellConfig({cellId:e,config:{hide_code:T}}),T?((M=i.current)==null||M.contentDOM.blur(),(L=t==null?void 0:t.current)==null||L.focus()):(B=i.current)==null||B.focus()},c[16]=o,c[17]=s,c[18]=e,c[19]=t==null?void 0:t.current,c[20]=i,c[21]=x):x=c[21],c[22]!==o||c[23]!==e?(S=()=>o.moveToNextCell({cellId:e,before:!1,noCreate:!0}),y=()=>o.moveToNextCell({cellId:e,before:!0,noCreate:!0}),v=()=>o.sendToBottom({cellId:e}),k=()=>o.sendToTop({cellId:e}),c[22]=o,c[23]=e,c[24]=y,c[25]=v,c[26]=k,c[27]=S):(y=c[24],v=c[25],k=c[26],S=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&&K_(i).focus()},c[28]=e,c[29]=i,c[30]=a,c[31]=E):E=c[31],c[32]!==l?(j=()=>{var T;(T=l.current)==null||T.toggle()},c[32]=l,c[33]=j):j=c[33],c[34]!==n||c[35]!==d||c[36]!==u||c[37]!==y||c[38]!==v||c[39]!==k||c[40]!==E||c[41]!==j||c[42]!==f||c[43]!==p||c[44]!==_||c[45]!==g||c[46]!==m||c[47]!==b||c[48]!==x||c[49]!==S?(I={"cell.run":n,"cell.runAndNewBelow":d,"cell.runAndNewAbove":u,"cell.createAbove":f,"cell.createBelow":p,"cell.moveUp":_,"cell.moveDown":g,"cell.moveLeft":m,"cell.moveRight":b,"cell.hideCode":x,"cell.focusDown":S,"cell.focusUp":y,"cell.sendToBottom":v,"cell.sendToTop":k,"cell.aiCompletion":E,"cell.cellActions":j},c[34]=n,c[35]=d,c[36]=u,c[37]=y,c[38]=v,c[39]=k,c[40]=E,c[41]=j,c[42]=f,c[43]=p,c[44]=_,c[45]=g,c[46]=m,c[47]=b,c[48]=x,c[49]=S,c[50]=I):I=c[50],CU(t,I)}function yx(t,e,n,o,r,s){const i=X.c(16);let a,l,c,d,u;i[0]!==n||i[1]!==e?(a=f=>(!f||!Vn.fromInput(f))&&(n.moveToNextCell({cellId:e,before:!1,noCreate:!0}),!0),l=f=>(!f||!Vn.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||!Vn.fromInput(f))&&(n.moveToNextCell({cellId:e,before:!1,noCreate:!0}),!0),k:f=>(!f||!Vn.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?(u={ArrowDown:a,ArrowUp:l,Enter:c,...d},i[11]=a,i[12]=l,i[13]=c,i[14]=d,i[15]=u):u=i[15],NU(t,u)}const xx=A.forwardRef((t,e)=>{const n=X.c(14),{id:o,output:r,interrupted:s,errored:i,stopped:a,name:l,outputStale:c,outputLoading:d}=t;let u;n[0]===Symbol.for("react.memo_cache_sentinel")?(u=Fp("marimo-cell","hover-actions-parent z-10",{published:!0}),n[0]=u):u=n[0];const f=u;let p;n[1]!==o?(p=Fs.create(o),n[1]=o,n[2]=p):p=n[2];const _=p,g=T4(r==null?void 0:r.mimetype);if(i||s||a||g)return null;let m,b;return n[3]!==o||n[4]!==r||n[5]!==d||n[6]!==c?(m=h.jsx(Rc,{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]=m):m=n[7],n[8]!==_||n[9]!==o||n[10]!==l||n[11]!==e||n[12]!==m?(b=h.jsx("div",{tabIndex:-1,id:_,ref:e,className:f,"data-cell-id":o,"data-cell-name":l,children:m}),n[8]=_,n[9]=o,n[10]=l,n[11]=e,n[12]=m,n[13]=b):b=n[13],b});xx.displayName="ReadonlyCellComponent";const W7=({theme:t,showPlaceholder:e,allowFocus:n,id:o,code:r,output:s,consoleOutputs:i,status:a,runStartTimestamp:l,lastRunStartTimestamp:c,runElapsedTimeMs:d,edited:u,interrupted:f,errored:p,stopped:_,staleInputs:g,serializedEditorState:m,serialization:b,debuggerActive:x,appClosed:y,canDelete:v,actions:k,deleteCell:S,userConfig:E,outline:j,isCollapsed:I,collapseCount:T,config:M,canMoveX:L,name:B,editorView:O,setEditorView:z,outputStale:F})=>{const V=A.useRef(null),P=A.useRef(null),C=A.useRef(null),$=A.useRef(null),N=Qt(Aa),H=od(o),[G,Z]=A.useState(),q=M.disabled||a==="disabled-transitively",re=M4({executionTime:d,status:a,errored:p,interrupted:f,stopped:_}),ne=u||f||g&&!q,oe=I4(a),Y=(a==="queued"||u||g)&&!f,Q=A.useCallback(()=>O.current,[O]),{closeCompletionHandler:ce,resumeCompletionHandler:he}=_x(V,O),{isCellCodeShown:de,isMarkdown:me,isMarkdownCodeHidden:ie,temporarilyShowCode:Ce,showHiddenMarkdownCode:we}=function(pe,_e,ue,je){const ke=X.c(13),[Ve,Ze]=A.useState(!1),le=!pe.hide_code||Ve,Ee=_e==="markdown",Ie=Ee&&!le;let Ue;ke[0]!==ue||ke[1]!==je||ke[2]!==le?(Ue=Je=>{var Mt,xt;if(le)return;const rt=(Je==null?void 0:Je.focus)??!0;Ze(!0),rt&&((Mt=ue.current)==null||Mt.focus());const mt=(xt=je.current)==null?void 0:xt.parentElement;if(!mt)return void Xt.error("Cell: No parent element found for editor view");const yt=()=>{requestAnimationFrame(()=>{var Bt;mt.contains(document.activeElement)||(Ze(!1),(Bt=ue.current)==null||Bt.dom.blur(),mt.removeEventListener("focusout",yt))})};mt.addEventListener("focusout",yt)},ke[0]=ue,ke[1]=je,ke[2]=le,ke[3]=Ue):Ue=ke[3];const We=Qe(Ue);let De;ke[4]!==Ie||ke[5]!==We?(De=()=>{Ie&&We({focus:!0})},ke[4]=Ie,ke[5]=We,ke[6]=De):De=ke[6];const Ge=Qe(De);let ot;return ke[7]!==le||ke[8]!==Ee||ke[9]!==Ie||ke[10]!==Ge||ke[11]!==We?(ot={isCellCodeShown:le,isMarkdown:Ee,isMarkdownCodeHidden:Ie,temporarilyShowCode:We,showHiddenMarkdownCode:Ge},ke[7]=le,ke[8]=Ee,ke[9]=Ie,ke[10]=Ge,ke[11]=We,ke[12]=ot):ot=ke[12],ot}(M,G,O,C);bx(V,o,H,k,L,M,O,N,P),yx(V,o,k,we,E,de);const ae=SU(j),ve=!A4(s),ge=i.length>0,be=E.display.cell_output,Te=ve&&be==="above",ze=ve&&be==="below",[Xe,Fe]=A.useState(!1),[et,nt]=A.useState(!1);(function(pe){const{ref:_e,box:ue="content-box",skip:je}=pe,ke=A.useRef({...H7}),Ve=A.useRef(void 0);Ve.current=pe.onResize,A.useEffect(()=>{if(!_e.current||je||typeof window>"u"||!("ResizeObserver"in window))return;const Ze=new ResizeObserver(([le])=>{const Ee=ue==="border-box"?"borderBoxSize":ue==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",Ie=gx(le,Ee,"inlineSize"),Ue=gx(le,Ee,"blockSize");if(ke.current.width!==Ie||ke.current.height!==Ue){const We={width:Ie,height:Ue};ke.current.width=Ie,ke.current.height=Ue,Ve.current&&Ve.current(We)}});return Ze.observe(_e.current,{box:ue}),()=>{Ze.disconnect()}},[ue,_e,je])})({ref:$,skip:!me,onResize:pe=>{const _e=pe.height&&pe.height<68,ue=ie&&(_e||be==="below");Fe(ue),ae&&ue?nt(!0):et&&nt(!1)}});const it=pe=>h.jsx(N4,{tooltip:"Edit markdown",className:Oe("z-20 relative",pe),onClick:Ce}),te=ve&&h.jsxs("div",{className:"relative",onDoubleClick:we,children:[h.jsx("div",{className:"absolute top-5 -left-8 z-10 print:hidden",children:h.jsx(U7,{isCollapsed:I,onClick:()=>{I?k.expandCell({cellId:o}):k.collapseCell({cellId:o})},canCollapse:ae})}),ie&&ze&&it("top-3"),h.jsx(Rc,{allowExpand:!0,forceExpand:ie,output:s,className:"output-area",cellId:o,stale:F,loading:oe}),ie&&Te&&it("bottom-3")]}),Ne=Fp("marimo-cell","hover-actions-parent z-10",{interactive:!0,"needs-run":ne,"has-error":p,stopped:_,disabled:M.disabled,stale:a==="disabled-transitively",borderless:ie&&ve}),Me=Fs.create(o),Be=Qe(pe=>{N({cellId:o,initialPrompt:pe.prompt})}),J=!(!b||b.toLowerCase()!=="valid");return h.jsx(zp,{children:h.jsx(_0,{cellId:o,config:M,status:a,getEditorView:Q,hasOutput:ve,hasConsoleOutput:ge,name:B,children:h.jsxs(f0,{tabIndex:-1,ref:V,"data-status":a,onBlur:ce,onKeyDown:he,cellId:o,canMoveX:L,title:M.disabled?"This cell is disabled":a==="disabled-transitively"?"This cell has a disabled ancestor":void 0,children:[h.jsxs("div",{className:Ne,id:Me,ref:$,"data-cell-id":o,"data-cell-name":B,children:[be==="above"&&te,h.jsxs("div",{className:Oe("tray"),"data-hidden":ie,children:[h.jsx("div",{className:"absolute right-2 -top-4 z-10",children:h.jsx(vx,{edited:u,appClosed:y,status:a,cellConfig:M,needsRun:ne,hasOutput:ve,hasConsoleOutput:ge,cellActionDropdownRef:P,cellId:o,name:B,getEditorView:Q,onRun:H})}),h.jsx(q7,{cellId:o,className:Oe(ie&&Te&&"-top-7",ie&&ze&&"-bottom-8",ie&&et&&"-left-[3.8rem]"),appClosed:y,actions:k}),h.jsx(Fu,{theme:t,showPlaceholder:e,allowFocus:n,id:o,code:r,config:M,status:a,serializedEditorState:m,runCell:H,setEditorView:z,userConfig:E,editorViewRef:O,editorViewParentRef:C,hidden:!de,hasOutput:ve,temporarilyShowCode:Ce,languageAdapter:G,setLanguageAdapter:Z}),h.jsx(wx,{className:Oe(ie&&be==="below"&&"top-14"),edited:u,status:a,isCellStatusInline:Xe,uninstantiated:re,disabled:M.disabled,runElapsedTimeMs:d,runStartTimestamp:l,lastRunStartTimestamp:c,staleInputs:g,interrupted:f}),h.jsx("div",{className:"shoulder-bottom hover-action",children:v&&de&&h.jsx(N1,{appClosed:y,status:a,onClick:()=>{oe||y||S({cellId:o})}})})]}),be==="below"&&te,b&&h.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",children:[J&&h.jsx("span",{className:"text-muted-foreground text-xs font-bold",children:"reusable"}),h.jsx(Re,{content:h.jsx("span",{className:"max-w-16 text-xs",children:J?"This function or class can be imported into other Python notebooks or modules.":h.jsxs(h.Fragment,{children:["This definition can't be reused in other Python modules:",h.jsx("br",{}),h.jsx("br",{}),h.jsx("pre",{children:b}),h.jsx("br",{}),"Click this icon to learn more."]})}),children:J&&h.jsx(uc,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})||h.jsx(Bp,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})})]}),h.jsx(Zp,{consoleOutputs:i,stale:Y,cellName:b?"_":B,onRefactorWithAI:Be,onClear:()=>{k.clearCellConsoleOutput({cellId:o})},onSubmitDebugger:(pe,_e)=>{k.setStdinResponse({cellId:o,response:pe,outputIndex:_e}),O4({text:pe})},cellId:o,debuggerActive:x})]}),I&&h.jsx(mx,{onClick:()=>k.expandCell({cellId:o}),count:T,cellId:o})]})})})},wx=t=>{const e=X.c(19),{className:n,disabled:o,edited:r,interrupted:s,isCellStatusInline:i,lastRunStartTimestamp:a,runElapsedTimeMs:l,runStartTimestamp:c,staleInputs:d,status:u,uninstantiated:f}=t,p=o!==void 0&&o;let _;e[0]!==p||e[1]!==r||e[2]!==s||e[3]!==a||e[4]!==l||e[5]!==c||e[6]!==d||e[7]!==u||e[8]!==f?(_=h.jsx(I1,{status:u,staleInputs:d,interrupted:s,editing:!0,edited:r,disabled:p,elapsedTime:l,runStartTimestamp:c,uninstantiated:f,lastRunStartTimestamp:a}),e[0]=p,e[1]=r,e[2]=s,e[3]=a,e[4]=l,e[5]=c,e[6]=d,e[7]=u,e[8]=f,e[9]=_):_=e[9];const g=_;let m;e[10]!==n?(m=Oe("shoulder-right z-20",n),e[10]=n,e[11]=m):m=e[11];const b=!i&&g;let x;e[12]===Symbol.for("react.memo_cache_sentinel")?(x=h.jsx(h0,{}),e[12]=x):x=e[12];const y=i&&g;let v,k;return e[13]!==y?(v=h.jsxs("div",{className:"flex gap-2 items-end",children:[x,y]}),e[13]=y,e[14]=v):v=e[14],e[15]!==m||e[16]!==b||e[17]!==v?(k=h.jsxs("div",{className:m,children:[b,v]}),e[15]=m,e[16]=b,e[17]=v,e[18]=k):k=e[18],k},q7=t=>{const e=X.c(21),{className:n,appClosed:o,actions:r,cellId:s}=t;let i;e[0]!==r||e[1]!==s?(i=y=>{const v=y===void 0?{}:y;return r.createNewCell({cellId:s,before:!1,...v})},e[0]=r,e[1]=s,e[2]=i):i=e[2];const a=Qe(i);let l;e[3]!==r||e[4]!==s?(l=y=>{const v=y===void 0?{}:y;return r.createNewCell({cellId:s,before:!0,...v})},e[3]=r,e[4]=s,e[5]=l):l=e[5];const c=Qe(l);let d,u;e[6]!==n?(d=Oe("absolute flex flex-col gap-[2px] justify-center h-full left-[-34px] z-20",n),e[6]=n,e[7]=d):d=e[7],e[8]===Symbol.for("react.memo_cache_sentinel")?(u=pn("cell.createAbove"),e[8]=u):u=e[8];const f=o?void 0:c;let p,_,g;e[9]!==o||e[10]!==f?(p=h.jsx(C1,{tooltipContent:u,appClosed:o,onClick:f}),e[9]=o,e[10]=f,e[11]=p):p=e[11],e[12]===Symbol.for("react.memo_cache_sentinel")?(_=h.jsx("div",{className:"flex-1"}),e[12]=_):_=e[12],e[13]===Symbol.for("react.memo_cache_sentinel")?(g=pn("cell.createBelow"),e[13]=g):g=e[13];const m=o?void 0:a;let b,x;return e[14]!==o||e[15]!==m?(b=h.jsx(C1,{tooltipContent:g,appClosed:o,onClick:m}),e[14]=o,e[15]=m,e[16]=b):b=e[16],e[17]!==d||e[18]!==p||e[19]!==b?(x=h.jsxs("div",{className:d,children:[p,_,b]}),e[17]=d,e[18]=p,e[19]=b,e[20]=x):x=e[20],x},vx=t=>{const e=X.c(27),{edited:n,appClosed:o,status:r,cellConfig:s,needsRun:i,hasOutput:a,hasConsoleOutput:l,onRun:c,cellActionDropdownRef:d,cellId:u,getEditorView:f,name:p,includeCellActions:_}=t,g=_===void 0||_,m=!i&&"hover-action";let b;e[0]!==m?(b=Oe(m),e[0]=m,e[1]=b):b=e[1];const x=o?jn.NOOP:c;let y,v,k,S;return e[2]!==o||e[3]!==s||e[4]!==n||e[5]!==i||e[6]!==r||e[7]!==x?(y=h.jsx(hE,{edited:n,onClick:x,appClosed:o,status:r,config:s,needsRun:i}),e[2]=o,e[3]=s,e[4]=n,e[5]=i,e[6]=r,e[7]=x,e[8]=y):y=e[8],e[9]!==o||e[10]!==r?(v=h.jsx($7,{status:r,appClosed:o}),e[9]=o,e[10]=r,e[11]=v):v=e[11],e[12]!==d||e[13]!==s||e[14]!==u||e[15]!==f||e[16]!==l||e[17]!==a||e[18]!==g||e[19]!==p||e[20]!==r?(k=g&&h.jsx(m0,{ref:d,cellId:u,status:r,getEditorView:f,name:p,config:s,hasOutput:a,hasConsoleOutput:l,children:h.jsx(xi,{variant:"green",tooltip:null,"data-testid":"cell-actions-button",children:h.jsx(vS,{strokeWidth:1.5})})}),e[12]=d,e[13]=s,e[14]=u,e[15]=f,e[16]=l,e[17]=a,e[18]=g,e[19]=p,e[20]=r,e[21]=k):k=e[21],e[22]!==b||e[23]!==y||e[24]!==v||e[25]!==k?(S=h.jsxs(uE,{className:b,children:[y,v,k]}),e[22]=b,e[23]=y,e[24]=v,e[25]=k,e[26]=S):S=e[26],S},G7=({theme:t,showPlaceholder:e,allowFocus:n,id:o,code:r,output:s,consoleOutputs:i,status:a,runStartTimestamp:l,lastRunStartTimestamp:c,runElapsedTimeMs:d,edited:u,interrupted:f,errored:p,stopped:_,staleInputs:g,serializedEditorState:m,debuggerActive:b,appClosed:x,canDelete:y,actions:v,deleteCell:k,userConfig:S,config:E,canMoveX:j,name:I,editorView:T,setEditorView:M})=>{const L=A.useRef(null),B=A.useRef(null),O=A.useRef(null),z=Qt(Aa),F=od(o),V=E.disabled||a==="disabled-transitively",P=M4({executionTime:d,status:a,errored:p,interrupted:f,stopped:_}),C=u||f||g&&!V,$=a==="running"||a==="queued",N=(a==="queued"||u||g)&&!f,H=A.useCallback(()=>T.current,[T]),{closeCompletionHandler:G,resumeCompletionHandler:Z}=_x(L,T);bx(L,o,F,v,j,E,T,z,B),yx(L,o,v,jn.NOOP,S,!0);const q=!A4(s),re=i.length>0,ne=T4(s==null?void 0:s.mimetype),oe=Fp("marimo-cell","hover-actions-parent z-10 border shadow-sm","!border-[var(--blue-5)] !rounded-sm",{"needs-run":C,"has-error":p,stopped:_}),Y=Fs.create(o),Q=Qe(ce=>{z({cellId:o,initialPrompt:ce.prompt})});return h.jsx(zp,{children:h.jsx(_0,{cellId:o,config:E,status:a,getEditorView:H,hasOutput:q,hasConsoleOutput:re,name:I,children:h.jsxs("div",{className:oe,"data-status":a,id:Y,ref:L,onBlur:G,onKeyDown:Z,title:E.disabled?"This cell is disabled":a==="disabled-transitively"?"This cell has a disabled ancestor":void 0,"data-cell-id":o,"data-cell-name":I,"data-setup-cell":!0,children:[h.jsxs("div",{className:Oe("tray"),"data-hidden":!1,children:[h.jsx("div",{className:"absolute right-2 -top-4 z-10",children:h.jsx(vx,{edited:u,appClosed:x,status:a,cellConfig:E,needsRun:C,hasOutput:q,hasConsoleOutput:re,cellActionDropdownRef:B,cellId:o,name:I,getEditorView:H,onRun:F,includeCellActions:!1})}),h.jsx(Fu,{theme:t,showPlaceholder:e,allowFocus:n,id:o,code:r,config:E,status:a,serializedEditorState:m,runCell:F,setEditorView:M,userConfig:S,editorViewRef:T,editorViewParentRef:O,hidden:!1,hasOutput:q,temporarilyShowCode:jn.NOOP,languageAdapter:"python",setLanguageAdapter:jn.NOOP,showLanguageToggles:!1}),h.jsx(wx,{edited:u,status:a,isCellStatusInline:!1,uninstantiated:P,disabled:E.disabled,runElapsedTimeMs:d,runStartTimestamp:l,lastRunStartTimestamp:c,staleInputs:g,interrupted:f}),h.jsx("div",{className:"shoulder-bottom hover-action",children:y&&h.jsx(N1,{appClosed:x,status:a,onClick:()=>{$||x||k({cellId:o})}})})]}),h.jsxs("div",{className:"py-1 px-2 flex justify-end gap-2 last:rounded-b",children:[h.jsx("span",{className:"text-muted-foreground text-xs font-bold",children:"setup cell"}),h.jsx(Re,{content:h.jsxs("span",{className:"max-w-16",children:["This ",h.jsx("b",{children:"setup cell"})," is guaranteed to run before all other cells. Include ",h.jsx("br",{}),"initialization or imports and constants required by top-level functions."]}),children:h.jsx(Bp,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})})]}),ne&&h.jsx(Rc,{allowExpand:!0,forceExpand:!0,output:s,className:"output-area",cellId:o,stale:!1,loading:$}),h.jsx(Zp,{consoleOutputs:i,stale:N,cellName:"_",onRefactorWithAI:Q,onClear:()=>{v.clearCellConsoleOutput({cellId:o})},onSubmitDebugger:(ce,he)=>{v.setStdinResponse({cellId:o,response:ce,outputIndex:he}),O4({text:ce})},cellId:o,debuggerActive:b})]})})})},kx=A.memo(A.forwardRef((t,e)=>{const{status:n,output:o,runStartTimestamp:r,interrupted:s,staleInputs:i,edited:a,id:l,mode:c}=t;Xt.debug("Rendering Cell",l);const d=A.useRef(null);A.useImperativeHandle(e,()=>({get editorView(){return K_(d)},get editorViewOrNull(){return d.current}}),[d]);const u=kU({status:n,output:o,runStartTimestamp:r,interrupted:s,staleInputs:i},a),f=I4(n);return l===Ho?h.jsx(G7,{...t,editorView:d,setEditorView:p=>{d.current=p},outputStale:u}):c==="edit"?h.jsx(W7,{...t,editorView:d,setEditorView:p=>{d.current=p},outputStale:u}):h.jsx(xx,{...t,outputStale:u,outputLoading:f})})),Y7=t=>{const e=X.c(10),{width:n}=t,{banners:o}=j$(),{removeBanner:r}=E$();if(o.length===0)return null;const s=n==="columns"&&"sticky left-12 w-full max-w-[80vw]";let i,a,l;if(e[0]!==s?(i=Oe("flex flex-col gap-4 mb-5 print:hidden",s),e[0]=s,e[1]=i):i=e[1],e[2]!==o||e[3]!==r){let c;e[5]!==r?(c=d=>h.jsxs(Pc,{kind:d.variant||"info",className:"flex flex-col rounded p-3",children:[h.jsxs("div",{className:"flex justify-between",children:[h.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[h.jsx(jU,{className:"w-5 h-5 inline-block mr-2"}),d.title]}),h.jsx(Pe,{"data-testid":"remove-banner-button",variant:"text",size:"icon",onClick:()=>r(d.id),children:h.jsx(go,{className:"w-5 h-5"})})]}),h.jsxs("div",{className:"flex justify-between items-end",children:[h.jsx("span",{children:Up({html:d.description})}),d.action==="restart"&&h.jsx(J7,{})]})]},d.id),e[5]=r,e[6]=c):c=e[6],a=o.map(c),e[2]=o,e[3]=r,e[4]=a}else a=e[4];return e[7]!==i||e[8]!==a?(l=h.jsx("div",{className:i,children:a}),e[7]=i,e[8]=a,e[9]=l):l=e[9],l},J7=()=>{const t=X.c(3),e=tg();let n,o;return t[0]===Symbol.for("react.memo_cache_sentinel")?(n=h.jsx(Rm,{className:"w-3 h-3 mr-2"}),t[0]=n):n=t[0],t[1]!==e?(o=h.jsxs(Pe,{"data-testid":"restart-session-button",variant:"link",size:"xs",onClick:e,children:[n,"Restart"]}),t[1]=e,t[2]=o):o=t[2],o},K7=(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,u]=a;return{major:Number.parseInt(l,10),minor:Number.parseInt(c,10),patch:Number.parseInt(d,10),preRelease:u||""}};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),X7=()=>{const t=X.c(66),{packageAlert:e}=I$(),{clearPackageAlert:n}=A$(),[o]=Ds();let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={},t[0]=r):r=t[0];const[s,i]=A.useState(r);if(e===null)return null;const a=o.package_management.manager!=="pixi";if(T$(e)){let l,c,d,u,f,p,_,g,m,b;if(t[1]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[h.jsx(Xc,{className:"w-5 h-5 inline-block mr-2"}),"Missing packages"]}),t[1]=l):l=t[1],t[2]!==n||t[3]!==e.id?(c=()=>n(e.id),t[2]=n,t[3]=e.id,t[4]=c):c=t[4],t[5]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsx(go,{className:"w-5 h-5"}),t[5]=d):d=t[5],t[6]!==c?(u=h.jsxs("div",{className:"flex justify-between",children:[l,h.jsx(Pe,{variant:"text","data-testid":"remove-banner-button",size:"icon",onClick:c,children:d})]}),t[6]=c,t[7]=u):u=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(f=h.jsx("p",{children:"The following packages were not found:"}),t[8]=f):f=t[8],t[9]!==s||t[10]!==a||t[11]!==e.packages){let x;t[13]!==s||t[14]!==a?(x=(y,v)=>h.jsxs("li",{className:"flex items-center gap-1 font-mono text-sm",children:[h.jsx(ba,{size:"1rem"}),y,a&&h.jsx(tM,{value:s[y]??"latest",onChange:k=>i(S=>({...S,[y]:k})),packageName:y})]},v),t[13]=s,t[14]=a,t[15]=x):x=t[15],p=e.packages.map(x),t[9]=s,t[10]=a,t[11]=e.packages,t[12]=p}else p=t[12];return t[16]!==p?(_=h.jsxs("div",{children:[f,h.jsx("ul",{className:"list-disc ml-4 mt-1",children:p})]}),t[16]=p,t[17]=_):_=t[17],t[18]!==n||t[19]!==s||t[20]!==e.id||t[21]!==e.isolated||t[22]!==e.packages||t[23]!==o.package_management.manager?(g=h.jsx("div",{className:"ml-auto flex flex-row items-baseline",children:e.isolated?h.jsxs(h.Fragment,{children:[h.jsx(Q7,{manager:o.package_management.manager,packages:e.packages,versions:s,clearPackageAlert:()=>n(e.id)}),!Bn()&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"px-2 text-sm",children:"with"})," ",h.jsx(eM,{})]})]}):h.jsxs("p",{children:["If you set up a"," ",h.jsx(gp,{href:"https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments",children:"virtual environment"}),", marimo can install these packages for you."]})}),t[18]=n,t[19]=s,t[20]=e.id,t[21]=e.isolated,t[22]=e.packages,t[23]=o.package_management.manager,t[24]=g):g=t[24],t[25]!==_||t[26]!==g?(m=h.jsxs("div",{className:"flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",children:[_,g]}),t[25]=_,t[26]=g,t[27]=m):m=t[27],t[28]!==u||t[29]!==m?(b=h.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-12 min-w-[400px] z-[200] opacity-95",children:h.jsxs(Pc,{kind:"danger",className:"flex flex-col rounded py-3 px-5 animate-in slide-in-from-left",children:[u,m]})}),t[28]=u,t[29]=m,t[30]=b):b=t[30],b}if(M$(e)){let l;t[31]!==e.packages?(l=function(M){const L=new Set(Object.values(M)),B=L.has("queued")||L.has("installing")?"installing":L.has("failed")?"failed":"installed";return B==="installing"?{status:"installing",title:"Installing packages",titleIcon:h.jsx(ka,{className:"w-5 h-5 inline-block mr-2"}),description:"Installing packages:"}:B==="installed"?{status:"installed",title:"All packages installed!",titleIcon:h.jsx(Am,{className:"w-5 h-5 inline-block mr-2"}),description:"Installed packages:"}:{status:"failed",title:"Some packages failed to install",titleIcon:h.jsx(Xc,{className:"w-5 h-5 inline-block mr-2"}),description:"See terminal for error logs."}}(e.packages),t[31]=e.packages,t[32]=l):l=t[32];const{status:c,title:d,titleIcon:u,description:f}=l;c==="installed"&&setTimeout(()=>n(e.id),1e4);const p=c==="failed"?"danger":"info";let _,g,m,b,x;t[33]!==d||t[34]!==u?(_=h.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[u,d]}),t[33]=d,t[34]=u,t[35]=_):_=t[35],t[36]!==n||t[37]!==e.id?(g=()=>n(e.id),t[36]=n,t[37]=e.id,t[38]=g):g=t[38],t[39]===Symbol.for("react.memo_cache_sentinel")?(m=h.jsx(go,{className:"w-5 h-5"}),t[39]=m):m=t[39],t[40]!==g?(b=h.jsx(Pe,{variant:"text","data-testid":"remove-banner-button",size:"icon",onClick:g,children:m}),t[40]=g,t[41]=b):b=t[41],t[42]!==_||t[43]!==b?(x=h.jsxs("div",{className:"flex justify-between",children:[_,b]}),t[42]=_,t[43]=b,t[44]=x):x=t[44];const y=c==="installed"&&"text-accent-foreground";let v,k,S,E,j,I,T;if(t[45]!==y?(v=Oe("flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",y),t[45]=y,t[46]=v):v=t[46],t[47]!==f?(k=h.jsx("p",{children:f}),t[47]=f,t[48]=k):k=t[48],t[49]!==e.packages||t[50]!==c){let M;t[52]!==c?(M=(L,B)=>{const[O,z]=L;return h.jsxs("li",{className:Oe("flex items-center gap-1 font-mono text-sm",z==="installing"&&"font-semibold",z==="failed"&&"text-destructive",z==="installed"&&"text-accent-foreground",z==="installed"&&c==="failed"&&"text-muted-foreground"),children:[h.jsx(Z7,{status:z}),O]},B)},t[52]=c,t[53]=M):M=t[53],S=Object.entries(e.packages).map(M),t[49]=e.packages,t[50]=c,t[51]=S}else S=t[51];return t[54]!==S?(E=h.jsx("ul",{className:"list-disc ml-4 mt-1",children:S}),t[54]=S,t[55]=E):E=t[55],t[56]!==k||t[57]!==E?(j=h.jsxs("div",{children:[k,E]}),t[56]=k,t[57]=E,t[58]=j):j=t[58],t[59]!==j||t[60]!==v?(I=h.jsx("div",{className:v,children:j}),t[59]=j,t[60]=v,t[61]=I):I=t[61],t[62]!==I||t[63]!==p||t[64]!==x?(T=h.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-12 min-w-[400px] z-[200] opacity-95",children:h.jsxs(Pc,{kind:p,className:"flex flex-col rounded pt-3 pb-4 px-5",children:[x,I]})}),t[62]=I,t[63]=p,t[64]=x,t[65]=T):T=t[65],T}return oc(e),null},Z7=t=>{const e=X.c(4),{status:n}=t;switch(n){case"queued":{let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx(ba,{size:"1rem"}),e[0]=o):o=e[0],o}case"installing":{let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx(ka,{size:"1rem"}),e[1]=o):o=e[1],o}case"installed":{let o;return e[2]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx(_c,{size:"1rem"}),e[2]=o):o=e[2],o}case"failed":{let o;return e[3]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx(go,{size:"1rem"}),e[3]=o):o=e[3],o}default:return oc(n),null}},Q7=t=>{const e=X.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 u of o)d[u]=d[u]??"";await TU({manager:n,versions:d}).catch(nM)},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=h.jsx(ka,{className:"w-4 h-4 mr-2"}),l=h.jsx("span",{className:"font-semibold",children:"Install"}),e[5]=a,e[6]=l):(a=e[5],l=e[6]),e[7]!==i?(c=h.jsxs(Pe,{variant:"outline","data-testid":"install-packages-button",size:"sm",onClick:i,children:[a,l]}),e[7]=i,e[8]=c):c=e[8],c},eM=()=>{const t=X.c(16),[e,n]=Ds();let o,r;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=H3(EU),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=W3(r);let i;t[3]!==n?(i=async f=>{await Rs({config:f}).then(()=>{n(f)})},t[3]=n,t[4]=i):i=t[4];const a=i;let l,c,d,u;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=h.jsx("div",{className:"flex flex-col gap-3",children:h.jsx(B3,{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=h.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?(u=h.jsx(IU,{...s,children:d}),t[13]=s,t[14]=d,t[15]=u):u=t[15],u},tM=t=>{const e=X.c(21),{value:n,onChange:o,packageName:r}=t;let s,i;e[0]!==r?(s=async()=>{const g=await fetch(`https://pypi.org/pypi/${function(b){return b.replaceAll(/\[.*]/g,"").trim()}(r)}/json`,{method:"GET",signal:AbortSignal.timeout(5e3)}),m=await g.json();return["latest",...Object.keys(m.releases).sort(K7).slice(0,100)]},i=[r],e[0]=r,e[1]=s,e[2]=i):(s=e[1],i=e[2]);const{data:a,loading:l,error:c}=Xn(s,i);let d;e[3]!==a?(d=a===void 0?[]:a,e[3]=a,e[4]=d):d=e[4];const u=d;if(c){let g,m,b;return e[5]!==o?(g=x=>o(x.target.value),e[5]=o,e[6]=g):g=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(m=h.jsx("option",{value:"latest",children:"latest"}),e[7]=m):m=e[7],e[8]!==g||e[9]!==n?(b=h.jsx(Re,{content:"Failed to fetch package versions",children:h.jsx(Vp,{value:n,onChange:g,disabled:!0,className:"inline-flex ml-2",children:m})}),e[8]=g,e[9]=n,e[10]=b):b=e[10],b}let f,p,_;return e[11]!==o?(f=g=>o(g.target.value),e[11]=o,e[12]=f):f=e[12],e[13]!==u||e[14]!==l?(p=l?h.jsx("option",{value:"latest",children:"latest"}):u.map(sM),e[13]=u,e[14]=l,e[15]=p):p=e[15],e[16]!==l||e[17]!==f||e[18]!==p||e[19]!==n?(_=h.jsx(Vp,{value:n,onChange:f,disabled:l,className:"inline-flex ml-2",children:p}),e[16]=l,e[17]=f,e[18]=p,e[19]=n,e[20]=_):_=e[20],_};function nM(t){Xt.error(t)}function oM(t){return h.jsx("option",{value:t,children:t},t)}function rM(t){const{field:e}=t;return h.jsxs(U3,{children:[h.jsx(V3,{children:h.jsx(Vp,{"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:AU.map(oM)})}),h.jsx($3,{})]})}function sM(t){return h.jsx("option",{value:t,children:t},t)}const iM=t=>{let{transform:e}=t;return{...e,x:0}},aM={threshold:{x:0,y:.1}},lM=K.memo(t=>{const e=X.c(23),{children:n,multiColumn:o}=t,{dropCellOverCell:r,dropCellOverColumn:s,moveColumn:i,compactColumns:a}=Lt(),[l,c]=A.useState(null),[d,u]=A.useState(null),[f]=R3();let p;e:{if(f.width==="columns"){p=$p.EMPTY;break e}let O;e[0]===Symbol.for("react.memo_cache_sentinel")?(O=[iM],e[0]=O):O=e[0],p=O}const _=p;let g,m;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")?(m={coordinateGetter:r5},e[2]=m):m=e[2];const b=function(){for(var O=arguments.length,z=new Array(O),F=0;F<O;F++)z[F]=arguments[F];return A.useMemo(()=>[...z].filter(V=>V!=null),[...z])}(M1(cu,g),M1(au,m));let x;e[3]===Symbol.for("react.memo_cache_sentinel")?(x=O=>{c(O.active.id);const z=fo();u(z.cellIds)},e[3]=x):x=e[3];const y=Qe(x);let v;e[4]!==d?(v=()=>{c(null),u(null)},e[4]=d,e[5]=v):v=e[5];const k=Qe(v);let S;e[6]!==l?(S=O=>{const z=O.droppableContainers.filter(cM);if(l&&rs(l))return nu({...O,droppableContainers:z});const F=(N=>{let{droppableContainers:H,droppableRects:G,pointerCoordinates:Z}=N;if(!Z)return[];const q=[];for(const re of H){const{id:ne}=re,oe=G.get(ne);if(oe&&vE(Z,oe)){const Y=eu(oe).reduce((ce,he)=>ce+Zd(Z,he),0),Q=Number((Y/4).toFixed(4));q.push({id:ne,data:{droppableContainer:re,value:Q}})}}return q.sort(Qd)})({...O,droppableContainers:z}),V=tu(F.length>0?F:D1({...O,droppableContainers:z}),"id");if(!V)return[];Bo(rs(V),`Expected column id. Got: ${V}`);const P=fo().cellIds.get(V);if(Bo(P,`Expected column. Got: ${V}`),P&&P.topLevelIds.length===0)return[{id:V}];const C=new Set(P.topLevelIds),$=nu({...O,droppableContainers:O.droppableContainers.filter(N=>N.id!==V&&C.has(N.id))});if($.length>0){const N=$[0].id;return Bo(zu(N),`Expected cell id. Got: ${N}`),[{id:N}]}return[]},e[6]=l,e[7]=S):S=e[7];const E=S;let j;e[8]!==r||e[9]!==s||e[10]!==i?(j=O=>{const{active:z,over:F}=O,V=F==null?void 0:F.id;if(V!=null&&z.id!==V){if(zu(z.id)){if(rs(V))return void s({cellId:z.id,columnId:V});if(zu(V))return void r({cellId:z.id,overCellId:V})}rs(z.id)&&rs(V)&&i({column:z.id,overColumn:V})}},e[8]=r,e[9]=s,e[10]=i,e[11]=j):j=e[11];const I=Qe(j);let T;e[12]!==a?(T=O=>{const{active:z,over:F}=O;F!==null&&z.id!==F.id&&a()},e[12]=a,e[13]=T):T=e[13];const M=Qe(T),L=o?E:nu;let B;return e[14]!==n||e[15]!==k||e[16]!==M||e[17]!==I||e[18]!==y||e[19]!==_||e[20]!==b||e[21]!==L?(B=h.jsx(WE,{autoScroll:aM,sensors:b,collisionDetection:L,modifiers:_,onDragEnd:M,onDragStart:y,onDragCancel:k,onDragOver:I,children:n}),e[14]=n,e[15]=k,e[16]=M,e[17]=I,e[18]=y,e[19]=_,e[20]=b,e[21]=L,e[22]=B):B=e[22],B});function zu(t){return typeof t=="string"&&!t.startsWith("tree_")}function rs(t){return typeof t=="string"&&t.startsWith("tree_")}function cM(t){return rs(t.id)}const Sx=K.forwardRef((t,e)=>{const n=X.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:u,transform:f,transition:p,isDragging:_,isOver:g}=c0(l);let m;n[8]!==f?(m=f?Oc.Transform.toString({x:f.x,y:0,scaleX:1,scaleY:1}):void 0,n[8]=f,n[9]=m):m=n[9];const b=_?2:void 0;let x;n[10]!==m||n[11]!==b||n[12]!==p?(x={transform:m,transition:p,zIndex:b,position:"relative","--gutter-width":"50px"},n[10]=m,n[11]=b,n[12]=p,n[13]=x):x=n[13];const y=x,{deleteColumn:v,moveColumn:k,addColumn:S}=Lt();let E;n[14]===Symbol.for("react.memo_cache_sentinel")?(E=Oe("h-full hover:bg-muted rounded-none"),n[14]=E):E=n[14];const j=E,I=uM;let T;n[15]!==i||n[16]!==k?(T=()=>k({column:i,overColumn:"_left_"}),n[15]=i,n[16]=k,n[17]=T):T=n[17];const M=!r;let L,B,O;n[18]===Symbol.for("react.memo_cache_sentinel")?(L=h.jsx(D3,{className:"size-4"}),n[18]=L):L=n[18],n[19]!==T||n[20]!==M?(B=h.jsx(Re,{content:"Move column left",side:"top",delayDuration:300,children:h.jsx(Pe,{variant:"text",size:"sm",className:j,onClick:T,disabled:M,children:L})}),n[19]=T,n[20]=M,n[21]=B):B=n[21],n[22]!==i||n[23]!==k?(O=()=>k({column:i,overColumn:"_right_"}),n[22]=i,n[23]=k,n[24]=O):O=n[24];const z=!s;let F,V,P,C,$,N,H,G;n[25]===Symbol.for("react.memo_cache_sentinel")?(F=h.jsx(lc,{className:"size-4"}),n[25]=F):F=n[25],n[26]!==O||n[27]!==z?(V=h.jsx(Re,{content:"Move column right",side:"top",delayDuration:300,children:h.jsx(Pe,{variant:"text",size:"sm",className:j,onClick:O,disabled:z,children:F})}),n[26]=O,n[27]=z,n[28]=V):V=n[28],n[29]!==c||n[30]!==d?(P=h.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]=P):P=n[31],n[32]!==o||n[33]!==i||n[34]!==v?(C=o&&h.jsx(Re,{content:"Delete column",side:"top",delayDuration:300,children:h.jsx(Pe,{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:h.jsx(go,{className:"size-4"})})}),n[32]=o,n[33]=i,n[34]=v,n[35]=C):C=n[35],n[36]!==S||n[37]!==i?($=()=>{S({columnId:i}),requestAnimationFrame(I)},n[36]=S,n[37]=i,n[38]=$):$=n[38],n[39]===Symbol.for("react.memo_cache_sentinel")?(N=h.jsx(Lr,{className:"size-4"}),n[39]=N):N=n[39],n[40]!==$?(H=h.jsx(Re,{content:"Add column",side:"top",delayDuration:300,children:h.jsx(Pe,{variant:"text",size:"sm",className:j,onClick:$,children:N})}),n[40]=$,n[41]=H):H=n[41],n[42]!==V||n[43]!==P||n[44]!==C||n[45]!==H||n[46]!==B?(G=h.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:[B,V,P,C,H]}),n[42]=V,n[43]=P,n[44]=C,n[45]=H,n[46]=B,n[47]=G):G=n[47];const Z=G;let q;n[48]!==e||n[49]!==u?(q=ce=>{ml(e,u)(ce)},n[48]=e,n[49]=u,n[50]=q):q=n[50];const re=_?"":a.className,ne=_?"z-20":"z-1 hover:z-10 focus-within:z-10",oe=g&&"bg-accent/20";let Y,Q;return n[51]!==re||n[52]!==ne||n[53]!==oe?(Y=Oe(re,ne,oe),n[51]=re,n[52]=ne,n[53]=oe,n[54]=Y):Y=n[54],n[55]!==Z||n[56]!==_||n[57]!==a||n[58]!==y||n[59]!==q||n[60]!==Y?(Q=h.jsxs("div",{tabIndex:-1,ref:q,...a,style:y,"data-is-dragging":_,className:Y,children:[Z,a.children]}),n[55]=Z,n[56]=_,n[57]=a,n[58]=y,n[59]=q,n[60]=Y,n[61]=Q):Q=n[61],Q});Sx.displayName="SortableColumn";const dM=A.memo(Sx);function uM(){const t=document.getElementById("App");t&&t.scrollTo({left:t.scrollLeft+1e3,behavior:"smooth"})}const{getColumnWidth:hM,saveColumnWidth:fM}=MU,Cx=A.memo(t=>{const e=X.c(14),n=A.useRef(null);let o;e[0]!==t.children||e[1]!==t.index||e[2]!==t.width?(o=t.width==="columns"?h.jsx(pM,{startingWidth:hM(t.index),onResize:i=>{fM(t.index,i)},children:t.children}):h.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=h.jsxs(dM,{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=h.jsxs(h.Fragment,{children:[r,t.footer]}),e[11]=r,e[12]=t.footer,e[13]=s):s=e[13],s});Cx.displayName="Column";const pM=t=>{const e=X.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}=OU(s),c=mM;let d,u,f,p;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?(u=h.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]=u):u=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]!==u||e[13]!==f?(p=h.jsxs("div",{className:"flex flex-row",children:[d,u,f]}),e[11]=d,e[12]=u,e[13]=f,e[14]=p):p=e[14],p};function mM(t){return h.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)]
124
- hover/column:hover:bg-primary/60 dark:hover/column:hover:bg-primary/60`})}const gM=Zt(t=>{const e=t(yp);for(const n of e.cellIds.inOrderIds){const o=e.cellRuntime[n];if(o.status==="idle"&&o.consoleOutputs.some(r=>r.channel==="stdin"&&r.response===void 0))return!0}return!1}),_M=()=>{const t=X.c(3),e=bM;if(!He(gM))return null;let n,o,r;if(t[0]===Symbol.for("react.memo_cache_sentinel")?(n=h.jsx("div",{className:"flex justify-between",children:h.jsx("span",{className:"font-bold text-lg flex items-center mb-1",children:"Program waiting for input"})}),t[0]=n):n=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx(la,{className:"inline",children:"stdin"}),t[1]=o):o=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")){const s=h.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-1/2 transform -translate-x-1/2 z-[200] opacity-95",children:h.jsxs(Pc,{kind:"info",className:"flex flex-col rounded py-2 px-4 animate-in slide-in-from-top w-fit",children:[n,h.jsx("div",{className:"flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",children:h.jsx("div",{children:h.jsxs("p",{children:["The program is still running, but blocked on"," ",o,".",h.jsx(Pe,{variant:"link",className:"h-auto font-normal",onClick:e,children:"Jump to the cell"})]})})})]})});r=h.jsx(j4,{milliseconds:2e3,children:s}),t[2]=r}else r=t[2];return r};function bM(){const t=document.querySelector("[data-stdin-blocking]");t?(t.scrollIntoView({behavior:"smooth",block:"center"}),requestAnimationFrame(()=>{t.focus()})):Xt.error("No element with data-stdin-blocking found")}const yM=t=>{const e=X.c(8),n=He(DU),o=t.appConfig.width==="columns";let r,s,i;return e[0]!==t?(r=h.jsx(xM,{...t}),e[0]=t,e[1]=r):r=e[1],e[2]!==n||e[3]!==r?(s=h.jsx(a0,{id:"column-container",items:n,strategy:KE,children:r}),e[2]=n,e[3]=r,e[4]=s):s=e[4],e[5]!==o||e[6]!==s?(i=h.jsx(lM,{multiColumn:o,children:s}),e[5]=o,e[6]=s,e[7]=i):i=e[7],i},xM=t=>{const e=X.c(50),{mode:n,userConfig:o,appConfig:r,connStatus:s}=t,i=vc(),a=Lt(),{theme:l}=Fo(),{toggleSidebarPanel:c}=na(),{invisible:d}=O$(i.cellIds.idLength,n);qt("global.focusTop",a.focusTopCell),qt("global.focusBottom",a.focusBottomCell),qt("global.toggleSidebar",c),qt("global.foldCode",a.foldAll),qt("global.unfoldCode",a.unfoldAll),qt("global.formatAll",kM),qt("cell.hideCode",jn.NOOP),qt("cell.format",jn.NOOP);const u=id(),f=a.scrollToTarget;let p,_,g,m,b,x,y,v,k,S,E,j,I,T,M;if(e[0]!==i.scrollKey||e[1]!==f?(p=()=>{i.scrollKey!==null&&f()},e[0]=i.scrollKey,e[1]=f,e[2]=p):p=e[2],e[3]!==i.cellIds||e[4]!==i.scrollKey||e[5]!==f?(_=[i.cellIds,i.scrollKey,f],e[3]=i.cellIds,e[4]=i.scrollKey,e[5]=f,e[6]=_):_=e[6],A.useEffect(p,_),e[7]!==a||e[8]!==r||e[9]!==s||e[10]!==d||e[11]!==n||e[12]!==i||e[13]!==u||e[14]!==l||e[15]!==o){const L=i.cellIds.getColumns();let B;e[26]!==i.cellIds?(B=i.cellIds.hasOnlyOneId(),e[26]=i.cellIds,e[27]=B):B=e[27];const O=B;let z;e[28]!==i.cellIds.inOrderIds?(z=i.cellIds.inOrderIds.includes(Ho),e[28]=i.cellIds.inOrderIds,e[29]=z):z=e[29];const F=z;g=D$,v="pb-[40vh]",k=d,S=r,E="pr-4",e[30]===Symbol.for("react.memo_cache_sentinel")?(j=h.jsx(X7,{}),m=h.jsx(_M,{}),e[30]=m,e[31]=j):(m=e[30],j=e[31]),e[32]!==r.width?(b=h.jsx(Y7,{width:r.width}),e[32]=r.width,e[33]=b):b=e[33];const V=r.width==="columns"&&"grid grid-flow-col auto-cols-min gap-6";e[34]!==V?(x=Oe(V),e[34]=V,e[35]=x):x=e[35],y=L.map((P,C)=>h.jsx(wM,{column:P,index:C,columnsLength:L.length,appConfig:r,notebook:i,mode:n,userConfig:o,connStatus:s,actions:a,theme:l,hasOnlyOneCell:O,invisible:d,hasSetupCell:F,onDeleteCell:u},P.id)),e[7]=a,e[8]=r,e[9]=s,e[10]=d,e[11]=n,e[12]=i,e[13]=u,e[14]=l,e[15]=o,e[16]=g,e[17]=m,e[18]=b,e[19]=x,e[20]=y,e[21]=v,e[22]=k,e[23]=S,e[24]=E,e[25]=j}else g=e[16],m=e[17],b=e[18],x=e[19],y=e[20],v=e[21],k=e[22],S=e[23],E=e[24],j=e[25];return e[36]!==x||e[37]!==y?(I=h.jsx("div",{className:x,children:y}),e[36]=x,e[37]=y,e[38]=I):I=e[38],e[39]===Symbol.for("react.memo_cache_sentinel")?(T=h.jsx(R$,{}),e[39]=T):T=e[39],e[40]!==g||e[41]!==m||e[42]!==b||e[43]!==I||e[44]!==v||e[45]!==k||e[46]!==S||e[47]!==E||e[48]!==j?(M=h.jsxs(g,{className:v,invisible:k,appConfig:S,innerClassName:E,children:[j,m,b,I,T]}),e[40]=g,e[41]=m,e[42]=b,e[43]=I,e[44]=v,e[45]=k,e[46]=S,e[47]=E,e[48]=j,e[49]=M):M=e[49],M},wM=t=>{const e=X.c(42),{column:n,index:o,columnsLength:r,appConfig:s,notebook:i,mode:a,userConfig:l,connStatus:c,actions:d,theme:u,hasOnlyOneCell:f,invisible:p,hasSetupCell:_,onDeleteCell:g}=t,m=c.state!==en.OPEN,b=n.id,x=o>0,y=o<r-1,v=s.width,k=r>1,S=n.id,E=s.width==="columns"&&"opacity-0 group-hover/column:opacity-100";let j,I;e[0]!==E?(j=Oe(E),e[0]=E,e[1]=j):j=e[1],e[2]!==n.id||e[3]!==j?(I=h.jsx(vM,{columnId:S,className:j}),e[2]=n.id,e[3]=j,e[4]=I):I=e[4];const T=`column-${o+1}`,M=n.topLevelIds;let L,B,O,z;return e[5]!==d||e[6]!==m||e[7]!==_||e[8]!==o||e[9]!==p||e[10]!==a||e[11]!==i||e[12]!==g||e[13]!==u||e[14]!==l?(L=o===0&&_&&h.jsx(kx,{theme:u,showPlaceholder:!1,allowFocus:!p,...i.cellData[Ho],...i.cellRuntime[Ho],...d,runElapsedTimeMs:i.cellRuntime[Ho].runElapsedTimeMs??i.cellData[Ho].lastExecutionTime,canDelete:!0,mode:a,appClosed:m,ref:i.cellHandles[Ho],userConfig:l,isCollapsed:!1,collapseCount:0,canMoveX:!1,actions:d,deleteCell:g},Ho),e[5]=d,e[6]=m,e[7]=_,e[8]=o,e[9]=p,e[10]=a,e[11]=i,e[12]=g,e[13]=u,e[14]=l,e[15]=L):L=e[15],e[16]!==d||e[17]!==m||e[18]!==s.width||e[19]!==n||e[20]!==f||e[21]!==p||e[22]!==a||e[23]!==i||e[24]!==g||e[25]!==u||e[26]!==l?(B=n.topLevelIds.map(F=>{if(F===Ho)return null;const V=i.cellData[F],P=i.cellRuntime[F];return h.jsx(kx,{theme:u,showPlaceholder:f,allowFocus:!p,...V,...P,runElapsedTimeMs:P.runElapsedTimeMs??V.lastExecutionTime,canDelete:!f,mode:a,appClosed:m,ref:i.cellHandles[F],userConfig:l,config:V.config,name:V.name,isCollapsed:n.isCollapsed(F),collapseCount:n.getCount(F),canMoveX:s.width==="columns",actions:d,deleteCell:g},V.id.toString())}),e[16]=d,e[17]=m,e[18]=s.width,e[19]=n,e[20]=f,e[21]=p,e[22]=a,e[23]=i,e[24]=g,e[25]=u,e[26]=l,e[27]=B):B=e[27],e[28]!==n.topLevelIds||e[29]!==T||e[30]!==L||e[31]!==B?(O=h.jsxs(a0,{id:T,items:M,strategy:XE,children:[L,B]}),e[28]=n.topLevelIds,e[29]=T,e[30]=L,e[31]=B,e[32]=O):O=e[32],e[33]!==s.width||e[34]!==n.id||e[35]!==o||e[36]!==O||e[37]!==x||e[38]!==y||e[39]!==k||e[40]!==I?(z=h.jsx(Cx,{columnId:b,index:o,canMoveLeft:x,canMoveRight:y,width:v,canDelete:k,footer:I,children:O}),e[33]=s.width,e[34]=n.id,e[35]=o,e[36]=O,e[37]=x,e[38]=y,e[39]=k,e[40]=I,e[41]=z):z=e[41],z},vM=t=>{const e=X.c(17),{columnId:n,className:o}=t,{createNewCell:r}=Lt(),s=He(Ts),[i,a]=RU(!1),l=He(sc);let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=Oe("mb-0 rounded-none sm:px-4 md:px-5 lg:px-8 tracking-wide no-wrap whitespace-nowrap","hover:bg-accent hover:text-accent-foreground font-semibold uppercase text-xs"),e[0]=c):c=e[0];const d=c;let u;e[1]!==l||e[2]!==s||e[3]!==n||e[4]!==r||e[5]!==i||e[6]!==a.toggle?(u=()=>i?h.jsx(PU,{onClose:a.toggle}):h.jsxs(h.Fragment,{children:[h.jsxs(Pe,{className:d,variant:"text",size:"sm",onClick:()=>r({cellId:{type:"__end__",columnId:n},before:!1}),children:[h.jsx(Fm,{className:"mr-2 size-4 flex-shrink-0"}),"Python"]}),h.jsxs(Pe,{className:d,variant:"text",size:"sm",onClick:()=>{ar(s,r),r({cellId:{type:"__end__",columnId:n},before:!1,code:new ta().defaultCode})},children:[h.jsx(Um,{className:"mr-2 size-4 flex-shrink-0"}),"Markdown"]}),h.jsxs(Pe,{className:d,variant:"text",size:"sm",onClick:()=>{ar(s,r),r({cellId:{type:"__end__",columnId:n},before:!1,code:new Ec().defaultCode})},children:[h.jsx(lr,{className:"mr-2 size-4 flex-shrink-0"}),"SQL"]}),h.jsx(Re,{content:l?null:h.jsx("span",{children:"Enable via settings under AI Assist"}),delayDuration:100,asChild:!1,children:h.jsxs(Pe,{className:d,variant:"text",size:"sm",disabled:!l,onClick:a.toggle,children:[h.jsx(Xi,{className:"mr-2 size-4 flex-shrink-0"}),"Generate with AI"]})})]}),e[1]=l,e[2]=s,e[3]=n,e[4]=r,e[5]=i,e[6]=a.toggle,e[7]=u):u=e[7];const f=u,p=!i&&"w-fit",_=i&&"opacity-100 w-full max-w-4xl shadow-lg shadow-[var(--blue-3)]";let g,m,b;return e[8]!==o||e[9]!==p||e[10]!==_?(g=Oe("shadow-sm border border-border rounded transition-all duration-200 overflow-hidden divide-x divide-border flex",p,_,o),e[8]=o,e[9]=p,e[10]=_,e[11]=g):g=e[11],e[12]!==f?(m=f(),e[12]=f,e[13]=m):m=e[13],e[14]!==g||e[15]!==m?(b=h.jsx("div",{className:"flex justify-center mt-4 pt-6 pb-32 group gap-4 w-full print:hidden",children:h.jsx("div",{className:g,children:m})}),e[14]=g,e[15]=m,e[16]=b):b=e[16],b};function kM(){r4()}const Nx=t=>{const e=X.c(65),{userConfig:n,appConfig:o,hideControls:r}=t,s=r!==void 0&&r;LU(D4,ON);const{setCells:i,mergeAllColumns:a,collapseAllCells:l,expandAllCells:c}=Lt(),d=He(hp),u=He(FU),f=He(zU),p=mc(),_=Qt(md),g=d.mode==="edit",m=d.mode==="present",b=He(BU);let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=[],e[0]=x):x=e[0],A.useEffect(CM,x);const y=n.runtime.auto_instantiate;let v,k,S;e[1]!==i||e[2]!==_?(v=(ce,he)=>{i(ce);const de=ce.map(NM),me=ce.map(jM),ie=ce.map(EM);_({names:de,codes:me,configs:ie,layout:he})},e[1]=i,e[2]=_,e[3]=v):v=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(k=k4(),e[4]=k):k=e[4],e[5]!==v||e[6]!==n.runtime.auto_instantiate?(S={autoInstantiate:y,setCells:v,sessionId:k},e[5]=v,e[6]=n.runtime.auto_instantiate,e[7]=S):S=e[7];const{connection:E}=P$(S);let j,I;e[8]!==o.app_title||e[9]!==p?(j=()=>{document.title=o.app_title||$n.basename(p??"")||"Untitled Notebook"},I=[o.app_title,p],e[8]=o.app_title,e[9]=p,e[10]=j,e[11]=I):(j=e[10],I=e[11]),A.useEffect(j,I);const T=Mc(o.width);let M,L;e[12]!==o.width||e[13]!==a||e[14]!==T?(M=()=>{T==="columns"&&o.width!=="columns"&&a()},e[12]=o.width,e[13]=a,e[14]=T,e[15]=M):M=e[15],e[16]!==o.width||e[17]!==a||e[18]!==u||e[19]!==T?(L=[o.width,T,a,u],e[16]=o.width,e[17]=a,e[18]=u,e[19]=T,e[20]=L):L=e[20],A.useEffect(M,L);const B=function(){const ce=X.c(2),he=od();let de;return ce[0]!==he?(de=()=>he(AF(fo())),ce[0]=he,ce[1]=de):de=ce[1],Qe(de)}(),O=Zm(),z=ng();let F,V,P,C,$,N;e[21]!==B?(F=()=>{B()},e[21]=B,e[22]=F):F=e[22],qt("global.runStale",F),qt("global.interrupt",IM),e[23]!==z?(V=()=>{z()},e[23]=z,e[24]=V):V=e[24],qt("global.hideCode",V),e[25]!==O?(P=()=>{O()},e[25]=O,e[26]=P):P=e[26],qt("global.runAll",P),e[27]!==l?(C=()=>{l()},e[27]=l,e[28]=C):C=e[28],qt("global.collapseAllSections",C),e[29]!==c?($=()=>{c()},e[29]=c,e[30]=$):$=e[30],qt("global.expandAllSections",$),e[31]!==o||e[32]!==E||e[33]!==n||e[34]!==d.mode?(N=h.jsx(yM,{connStatus:E,mode:d.mode,userConfig:n,appConfig:o}),e[31]=o,e[32]=E,e[33]=n,e[34]=d.mode,e[35]=N):N=e[35];const H=N,G=o.width;let Z,q,re,ne,oe,Y,Q;return e[36]===Symbol.for("react.memo_cache_sentinel")?(Z=Oe("pt-4 sm:pt-12 pb-2 mb-4 print:hidden z-50","sticky left-0"),e[36]=Z):Z=e[36],e[37]!==p||e[38]!==g?(q=g&&h.jsx("div",{className:"flex items-center justify-center container",children:h.jsx(TN,{filename:p})}),e[37]=p,e[38]=g,e[39]=q):q=e[39],e[40]!==E||e[41]!==q?(re=h.jsx(F$,{connection:E,className:Z,children:q}),e[40]=E,e[41]=q,e[42]=re):re=e[42],e[43]!==o||e[44]!==H||e[45]!==f||e[46]!==d.mode?(ne=f&&h.jsx(L$,{appConfig:o,mode:d.mode,children:H}),e[43]=o,e[44]=H,e[45]=f,e[46]=d.mode,e[47]=ne):ne=e[47],e[48]!==o.width||e[49]!==E||e[50]!==b||e[51]!==re||e[52]!==ne?(oe=h.jsxs(z$,{connection:E,isRunning:b,width:G,children:[re,ne]}),e[48]=o.width,e[49]=E,e[50]=b,e[51]=re,e[52]=ne,e[53]=oe):oe=e[53],e[54]!==o||e[55]!==E||e[56]!==s||e[57]!==m||e[58]!==b||e[59]!==B||e[60]!==z?(Y=!s&&h.jsx(Lc,{children:h.jsx(NN,{presenting:m,onTogglePresenting:z,onInterrupt:Pp,onRun:B,closed:E.state===en.CLOSED,running:b,appConfig:o})}),e[54]=o,e[55]=E,e[56]=s,e[57]=m,e[58]=b,e[59]=B,e[60]=z,e[61]=Y):Y=e[61],e[62]!==oe||e[63]!==Y?(Q=h.jsxs(h.Fragment,{children:[oe,Y]}),e[62]=oe,e[63]=Y,e[64]=Q):Q=e[64],Q};function SM(){kS.INSTANCE.stop()}function CM(){return kS.INSTANCE.start(UU),SM}function NM(t){return t.name}function jM(t){return t.code}function EM(t){return t.config}function IM(){Pp()}const AM=t=>{const e=X.c(17),[n,o]=A.useState(0),r=He(mo);let s,i,a,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=()=>o(DM),i={delayMs:1e4,whenVisible:!0},e[0]=s,e[1]=i):(s=e[0],i=e[1]),Uc(s,i),e[2]!==r.state?(a=async()=>Bn()||r.state!==en.OPEN?null:VU(),e[2]=r.state,e[3]=a):a=e[3],e[4]!==r.state||e[5]!==n?(l=[n,r.state],e[4]=r.state,e[5]=n,e[6]=l):l=e[6];const{data:c}=Xn(a,l);let d,u,f,p;return e[7]!==c?(d=(c==null?void 0:c.gpu)&&c.gpu.length>0&&h.jsx(OM,{gpus:c.gpu}),e[7]=c,e[8]=d):d=e[8],e[9]!==c?(u=c&&h.jsx(TM,{memory:c.memory,kernel:c.kernel,server:c.server}),e[9]=c,e[10]=u):u=e[10],e[11]!==c?(f=c&&h.jsx(MM,{cpu:c.cpu}),e[11]=c,e[12]=f):f=e[12],e[13]!==d||e[14]!==u||e[15]!==f?(p=h.jsxs("div",{className:"flex gap-2 items-center px-1",children:[d,u,f]}),e[13]=d,e[14]=u,e[15]=f,e[16]=p):p=e[16],p},TM=t=>{const e=X.c(25),{memory:n,kernel:o,server:r}=t,{percent:s,total:i,available:a}=n;let l;e[0]!==s?(l=Math.round(s),e[0]=s,e[1]=l):l=e[1];const c=l;let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsx("b",{children:"computer memory:"}),e[2]=d):d=e[2];const u=i-a;let f,p,_,g,m,b,x,y,v;return e[3]!==u?(f=Bu(u),e[3]=u,e[4]=f):f=e[4],e[5]!==i?(p=Bu(i),e[5]=i,e[6]=p):p=e[6],e[7]!==c||e[8]!==f||e[9]!==p?(_=h.jsxs("span",{children:[d," ",f," / ",p," GB (",c,"%)"]}),e[7]=c,e[8]=f,e[9]=p,e[10]=_):_=e[10],e[11]!==r?(g=(r==null?void 0:r.memory)&&h.jsxs("span",{children:[h.jsx("b",{children:"marimo server:"})," ",Nl(r.memory)]}),e[11]=r,e[12]=g):g=e[12],e[13]!==o?(m=(o==null?void 0:o.memory)&&h.jsxs("span",{children:[h.jsx("b",{children:"kernel:"})," ",Nl(o.memory)]}),e[13]=o,e[14]=m):m=e[14],e[15]!==_||e[16]!==g||e[17]!==m?(b=h.jsxs("div",{className:"flex flex-col gap-1",children:[_,g,m]}),e[15]=_,e[16]=g,e[17]=m,e[18]=b):b=e[18],e[19]===Symbol.for("react.memo_cache_sentinel")?(x=h.jsx(Nm,{className:"w-4 h-4"}),e[19]=x):x=e[19],e[20]!==c?(y=h.jsxs("div",{className:"flex items-center gap-1",children:[x,h.jsx(zu,{percent:c,colorClassName:"bg-primary"})]}),e[20]=c,e[21]=y):y=e[21],e[22]!==y||e[23]!==b?(v=h.jsx(Re,{delayDuration:200,content:b,children:y}),e[22]=y,e[23]=b,e[24]=v):v=e[24],v},MM=t=>{const e=X.c(11),{cpu:n}=t,{percent:o}=n;let r;e[0]!==o?(r=Math.round(o),e[0]=o,e[1]=r):r=e[1];const s=r;let i,a,l,c,d;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsx("b",{children:"CPU:"}),e[2]=i):i=e[2],e[3]!==s?(a=h.jsxs("span",{children:[i," ",s,"%"]}),e[3]=s,e[4]=a):a=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx(y$,{className:"w-4 h-4"}),e[5]=l):l=e[5],e[6]!==s?(c=h.jsxs("div",{className:"flex items-center gap-1",children:[l,h.jsx(zu,{percent:s,colorClassName:"bg-primary"})]}),e[6]=s,e[7]=c):c=e[7],e[8]!==a||e[9]!==c?(d=h.jsx(Re,{delayDuration:200,content:a,children:c}),e[8]=a,e[9]=c,e[10]=d):d=e[10],d},OM=t=>{const e=X.c(12),{gpus:n}=t;let o;e[0]!==n?(o=Math.round(n.reduce(RM,0)/n.length),e[0]=n,e[1]=o):o=e[1];const r=o;let s,i,a,l,c;return e[2]!==n?(s=n.map(PM),e[2]=n,e[3]=s):s=e[3],e[4]!==s?(i=h.jsx("div",{className:"flex flex-col gap-1",children:s}),e[4]=s,e[5]=i):i=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx(Em,{className:"w-4 h-4"}),e[6]=a):a=e[6],e[7]!==r?(l=h.jsxs("div",{className:"flex items-center gap-1",children:[a,h.jsx(zu,{percent:r,colorClassName:"bg-[var(--grass-9)]"})]}),e[7]=r,e[8]=l):l=e[8],e[9]!==i||e[10]!==l?(c=h.jsx(Re,{delayDuration:200,content:i,children:l}),e[9]=i,e[10]=l,e[11]=c):c=e[11],c},zu=t=>{const e=X.c(7),{percent:n,colorClassName:o}=t;let r;e[0]!==o?(r=Oe("h-full bg-primary",o),e[0]=o,e[1]=r):r=e[1];const s=`${n}%`;let i,a;return e[2]!==s?(i={width:s},e[2]=s,e[3]=i):i=e[3],e[4]!==r||e[5]!==i?(a=h.jsx("div",{className:"h-3 w-20 bg-[var(--slate-4)] rounded-lg overflow-hidden border",children:h.jsx("div",{className:r,style:i})}),e[4]=r,e[5]=i,e[6]=a):a=e[6],a};function Nl(t){return t>1073741824?`${Bu(t)} GB`:`${function(e){return new Intl.NumberFormat("en-US",{maximumFractionDigits:0}).format(e/1048576)}(t)} MB`}function Bu(t){return new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(t/1073741824)}function DM(t){return t+1}function RM(t,e){return t+e.memory.percent}function PM(t){return h.jsxs("span",{children:[h.jsxs("b",{children:["GPU ",t.index," (",t.name,"):"]})," ",Nl(t.memory.used)," / ",Nl(t.memory.total)," GB (",Math.round(t.memory.percent),"%)"]},t.index)}const jx=t=>He($U)[t.capability]?t.children:null,so=A.forwardRef((t,e)=>{const n=X.c(18);let o,r,s,i,a;n[0]!==t?({children:o,tooltip:a,selected:i,className:r,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i,n[5]=a):(o=n[1],r=n[2],s=n[3],i=n[4],a=n[5]);const l=!i&&"hover:bg-[var(--sage-3)]",c=i&&"bg-[var(--sage-4)]";let d,u;n[6]!==r||n[7]!==l||n[8]!==c?(d=Oe("h-full flex items-center p-2 text-sm shadow-inset font-mono cursor-pointer rounded",l,c,r),n[6]=r,n[7]=l,n[8]=c,n[9]=d):d=n[9],n[10]!==o||n[11]!==e||n[12]!==s||n[13]!==d?(u=h.jsx("div",{ref:e,className:d,...s,children:o}),n[10]=o,n[11]=e,n[12]=s,n[13]=d,n[14]=u):u=n[14];const f=u;if(a){let p;return n[15]!==f||n[16]!==a?(p=h.jsx(Re,{content:a,side:"top",delayDuration:200,children:f}),n[15]=f,n[16]=a,n[17]=p):p=n[17],p}return f});so.displayName="FooterItem";const LM=()=>{var d;const t=X.c(14),e=He(R4),n=He(sc),o=((d=e==null?void 0:e.open_ai)==null?void 0:d.model)||"gpt-4-turbo",{handleClick:r}=ya();if(!n){let u,f,p;return t[0]!==r?(u=()=>r("ai"),t[0]=r,t[1]=u):u=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(f=h.jsx(Xi,{className:"h-4 w-4 opacity-60"}),t[2]=f):f=t[2],t[3]!==u?(p=h.jsx(so,{tooltip:"Assist is disabled",selected:!1,onClick:u,children:f}),t[3]=u,t[4]=p):p=t[4],p}let s,i,a,l,c;return t[5]===Symbol.for("react.memo_cache_sentinel")?(s=h.jsx("b",{children:"Assist model:"}),t[5]=s):s=t[5],t[6]!==o?(i=h.jsxs(h.Fragment,{children:[s," ",o]}),t[6]=o,t[7]=i):i=t[7],t[8]!==r?(a=()=>r("ai"),t[8]=r,t[9]=a):a=t[9],t[10]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx(Xi,{className:"h-4 w-4"}),t[10]=l):l=t[10],t[11]!==i||t[12]!==a?(c=h.jsx(so,{tooltip:i,onClick:a,selected:!1,children:l}),t[11]=i,t[12]=a,t[13]=c):c=t[13],c},FM=()=>{const t=X.c(18),e=He(mo).state;let n,o,r,s,i,a,l;return t[0]!==e?(n=Xf(e.toLowerCase()),t[0]=e,t[1]=n):n=t[1],t[2]!==e?(o=e===en.OPEN&&h.jsx(nm,{className:"w-4 h-4"}),t[2]=e,t[3]=o):o=t[3],t[4]!==e?(r=e===en.CLOSED&&h.jsx(Jp,{className:"w-4 h-4"}),t[4]=e,t[5]=r):r=t[5],t[6]!==e?(s=e===en.CONNECTING&&h.jsx(Qn,{size:"small"}),t[6]=e,t[7]=s):s=t[7],t[8]!==e?(i=e===en.CLOSING&&h.jsx(Qn,{className:"text-destructive",size:"small"}),t[8]=e,t[9]=i):i=t[9],t[10]!==o||t[11]!==r||t[12]!==s||t[13]!==i?(a=h.jsxs("div",{className:"px-2",children:[o,r,s,i]}),t[10]=o,t[11]=r,t[12]=s,t[13]=i,t[14]=a):a=t[14],t[15]!==n||t[16]!==a?(l=h.jsx(Re,{delayDuration:200,content:n,children:a}),t[15]=n,t[16]=a,t[17]=l):l=t[17],l},zM=t=>{const e=X.c(3);let n,o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=h.jsx("path",{d:"M205.28 31.36c14.096 14.88 20.016 35.2 22.512 63.68c6.626 0 12.805 1.47 16.976 7.152l7.792 10.56A17.55 17.55 0 0 1 256 123.2v28.688c-.008 3.704-1.843 7.315-4.832 9.504C215.885 187.222 172.35 208 128 208c-49.066 0-98.19-28.273-123.168-46.608c-2.989-2.189-4.825-5.8-4.832-9.504V123.2c0-3.776 1.2-7.424 3.424-10.464l7.792-10.544c4.173-5.657 10.38-7.152 16.992-7.152c2.496-28.48 8.4-48.8 22.512-63.68C77.331 3.165 112.567.06 127.552 0H128c14.72 0 50.4 2.88 77.28 31.36m-77.264 47.376c-3.04 0-6.544.176-10.272.544c-1.312 4.896-3.248 9.312-6.08 12.128c-11.2 11.2-24.704 12.928-31.936 12.928c-6.802 0-13.927-1.42-19.744-5.088c-5.502 1.808-10.786 4.415-11.136 10.912c-.586 12.28-.637 24.55-.688 36.824c-.026 6.16-.05 12.322-.144 18.488c.024 3.579 2.182 6.903 5.44 8.384C79.936 185.92 104.976 192 128.016 192c23.008 0 48.048-6.08 74.512-18.144c3.258-1.48 5.415-4.805 5.44-8.384c.317-18.418.062-36.912-.816-55.312h.016c-.342-6.534-5.648-9.098-11.168-10.912c-5.82 3.652-12.927 5.088-19.728 5.088c-7.232 0-20.72-1.728-31.936-12.928c-2.832-2.816-4.768-7.232-6.08-12.128a106 106 0 0 0-10.24-.544m-26.941 43.93c5.748 0 10.408 4.66 10.408 10.409v19.183c0 5.749-4.66 10.409-10.408 10.409s-10.408-4.66-10.408-10.409v-19.183c0-5.748 4.66-10.408 10.408-10.408m53.333 0c5.749 0 10.409 4.66 10.409 10.409v19.183c0 5.749-4.66 10.409-10.409 10.409c-5.748 0-10.408-4.66-10.408-10.409v-19.183c0-5.748 4.66-10.408 10.408-10.408M81.44 28.32c-11.2 1.12-20.64 4.8-25.44 9.92c-10.4 11.36-8.16 40.16-2.24 46.24c4.32 4.32 12.48 7.2 21.28 7.2c6.72 0 19.52-1.44 30.08-12.16c4.64-4.48 7.52-15.68 7.2-27.04c-.32-9.12-2.88-16.64-6.72-19.84c-4.16-3.68-13.6-5.28-24.16-4.32m68.96 4.32c-3.84 3.2-6.4 10.72-6.72 19.84c-.32 11.36 2.56 22.56 7.2 27.04c10.56 10.72 23.36 12.16 30.08 12.16c8.8 0 16.96-2.88 21.28-7.2c5.92-6.08 8.16-34.88-2.24-46.24c-4.8-5.12-14.24-8.8-25.44-9.92c-10.56-.96-20 .64-24.16 4.32M128 56c-2.56 0-5.6.16-8.96.48c.32 1.76.48 3.68.64 5.76c0 1.44 0 2.88-.16 4.48c3.2-.32 5.92-.32 8.48-.32s5.28 0 8.48.32c-.16-1.6-.16-3.04-.16-4.48c.16-2.08.32-4 .64-5.76c-3.36-.32-6.4-.48-8.96-.48"}),e[0]=n):n=e[0],e[1]!==t?(o=h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.24em",height:"1em",viewBox:"0 0 256 208",fill:"currentColor",...t,children:n}),e[1]=t,e[2]=o):o=e[2],o},BM=Zt(t=>t(HU).completion.copilot),UM=()=>{const t=X.c(1);if(He(BM)==="github"){let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=h.jsx(VM,{}),t[0]=e):e=t[0],e}return null},Ex=Xt.get("[copilot-status-bar]"),VM=()=>{const t=He(uS),e=He(x$)!==null,{handleClick:n}=ya(),o=()=>n("ai"),r=t?"Ready":"Not connected",s=Qt(uS),i=Qt(w$);return WU(()=>{const a=dS();let l=!0;return(async()=>{try{if(await a.initializePromise.catch(d=>{throw Ex.error("Failed to initialize",d),a.close(),d}),!l)return;const c=await a.signedIn();if(!l)return;s(c),i(c?"signedIn":"signedOut")}catch(c){if(!l)return;Ex.warn("Connection failed",c),s(!1),i("connectionError"),lt({title:"GitHub Copilot Connection Error",description:"Failed to connect to GitHub Copilot. Check settings and try again.",variant:"danger",action:h.jsx(Pe,{variant:"link",onClick:o,children:"Settings"})})}})(),()=>{l=!1}}),h.jsx(so,{tooltip:h.jsxs(h.Fragment,{children:[h.jsx("b",{children:"GitHub Copilot:"})," ",r]}),selected:!1,onClick:o,children:h.jsx("span",{children:e?h.jsx(Qn,{className:"h-4 w-4"}):h.jsx(zM,{className:Oe("h-4 w-4",!t&&"opacity-60")})})})},$M=()=>{const t=X.c(13),e=He(os),[n,o]=fn(S4),[r,s]=A.useState(!1);if(!ga()||e==="disabled")return null;const i=e?"Real-time collaboration active":"Connecting to real-time collaboration";let a,l,c,d,u,f;return t[0]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx(qm,{className:"w-4 h-4"}),t[0]=a):a=t[0],t[1]!==i?(l=h.jsx(Ys,{asChild:!0,children:h.jsx(so,{tooltip:i,selected:!1,children:a})}),t[1]=i,t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsxs("div",{className:"space-y-2",children:[h.jsx("h4",{className:"font-medium leading-none",children:"Username"}),h.jsx("p",{className:"text-sm text-muted-foreground",children:"Set your username for real-time collaboration"})]}),t[3]=c):c=t[3],t[4]!==o?(d=p=>o(p.target.value),t[4]=o,t[5]=d):d=t[5],t[6]!==d||t[7]!==n?(u=h.jsx(Vs,{className:"w-80",children:h.jsxs("div",{className:"space-y-4",children:[c,h.jsx(ur,{value:n,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",onChange:d,placeholder:"Enter your username"})]})}),t[6]=d,t[7]=n,t[8]=u):u=t[8],t[9]!==r||t[10]!==l||t[11]!==u?(f=h.jsxs(Pr,{open:r,onOpenChange:s,children:[l,u]}),t[9]=r,t[10]=l,t[11]=u,t[12]=f):f=t[12],f},HM=()=>{const t=X.c(56),{selectedPanel:e,isTerminalOpen:n}=gc(),{toggleApplication:o,toggleTerminal:r}=na(),[s,i]=Ds(),a=He(qU),l=WM,c=cd.find(qM);let d;Bo(c,"Error panel not found"),t[0]!==r?(d=()=>{r()},t[0]=r,t[1]=d):d=t[1],qt("global.toggleTerminal",d);const u=so,f=c.tooltip,p=e===c.type,_=()=>o(c.type),g=l(c,a>0?"text-destructive":"");let m,b,x,y,v;t[2]!==a?(m=h.jsx("span",{className:"ml-1 font-mono mt-[0.125rem]",children:a}),t[2]=a,t[3]=m):m=t[3],t[4]!==u||t[5]!==c||t[6]!==p||t[7]!==_||t[8]!==g||t[9]!==m?(b=h.jsxs(u,{tooltip:f,selected:p,onClick:_,children:[g,m]}),t[4]=u,t[5]=c,t[6]=p,t[7]=_,t[8]=g,t[9]=m,t[10]=b):b=t[10],t[11]!==r?(x=()=>r(),t[11]=r,t[12]=x):x=t[12],t[13]===Symbol.for("react.memo_cache_sentinel")?(y=h.jsx(Hm,{className:"h-5 w-5"}),t[13]=y):y=t[13],t[14]!==n||t[15]!==x?(v=h.jsx(jx,{capability:"terminal",children:h.jsx(so,{tooltip:"Open terminal",selected:n,onClick:x,children:y})}),t[14]=n,t[15]=x,t[16]=v):v=t[16];const k=s.runtime.auto_instantiate?"Disable autorun on startup":"Enable autorun on startup";let S,E,j;t[17]!==s||t[18]!==i?(S=async()=>{const q={...s,runtime:{...s.runtime,auto_instantiate:!s.runtime.auto_instantiate}};await Rs({config:q}).then(()=>i(q))},t[17]=s,t[18]=i,t[19]=S):S=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(E=h.jsx("span",{children:"on startup: "}),t[20]=E):E=t[20],t[21]!==s.runtime.auto_instantiate?(j=s.runtime.auto_instantiate?h.jsx(br,{size:14}):h.jsx(_r,{size:14}),t[21]=s.runtime.auto_instantiate,t[22]=j):j=t[22];const I=s.runtime.auto_instantiate?"autorun":"lazy";let T,M,L,B;t[23]!==I?(T=h.jsx("span",{children:I}),t[23]=I,t[24]=T):T=t[24],t[25]!==j||t[26]!==T?(M=h.jsxs("div",{className:"font-prose text-sm flex items-center gap-1",children:[E,j,T]}),t[25]=j,t[26]=T,t[27]=M):M=t[27],t[28]!==k||t[29]!==S||t[30]!==M?(L=h.jsx(so,{tooltip:k,selected:!1,onClick:S,children:M}),t[28]=k,t[29]=S,t[30]=M,t[31]=L):L=t[31],t[32]===Symbol.for("react.memo_cache_sentinel")?(B=h.jsx("div",{className:"border-r border-border h-6 mx-1"}),t[32]=B):B=t[32];const O=s.runtime.on_cell_change==="autorun"?"Disable autorun":"Enable autorun";let z,F,V,P,C,$,N,H,G,Z;return t[33]!==s||t[34]!==i?(z=async()=>{const q={...s,runtime:{...s.runtime,on_cell_change:s.runtime.on_cell_change==="autorun"?"lazy":"autorun"}};await Rs({config:q}).then(()=>i(q))},t[33]=s,t[34]=i,t[35]=z):z=t[35],t[36]===Symbol.for("react.memo_cache_sentinel")?(F=h.jsx("span",{children:"on cell change: "}),t[36]=F):F=t[36],t[37]!==s.runtime.on_cell_change?(V=h.jsxs("div",{className:"font-prose text-sm flex items-center gap-1",children:[F,s.runtime.on_cell_change==="autorun"?h.jsx(br,{size:14}):h.jsx(_r,{size:14}),h.jsx("span",{children:s.runtime.on_cell_change})]}),t[37]=s.runtime.on_cell_change,t[38]=V):V=t[38],t[39]!==O||t[40]!==z||t[41]!==V?(P=h.jsx(so,{tooltip:O,selected:!1,onClick:z,children:V}),t[39]=O,t[40]=z,t[41]=V,t[42]=P):P=t[42],t[43]===Symbol.for("react.memo_cache_sentinel")?(C=h.jsx("div",{className:"border-r border-border h-6 mx-1"}),t[43]=C):C=t[43],t[44]!==s||t[45]!==i?($=!Bn()&&h.jsx(so,{tooltip:null,selected:!1,children:h.jsxs(hc,{children:[h.jsxs(fc,{className:"font-prose text-sm flex items-center gap-1",children:[h.jsx("span",{children:"on module change: "}),s.runtime.auto_reload==="off"&&h.jsx(Jp,{size:14}),s.runtime.auto_reload==="lazy"&&h.jsx(_r,{size:14}),s.runtime.auto_reload==="autorun"&&h.jsx(br,{size:14}),h.jsx("span",{children:s.runtime.auto_reload}),h.jsx(Zi,{size:14})]}),h.jsx(pc,{children:["off","lazy","autorun"].map(q=>h.jsxs(sn,{onClick:async()=>{const re={...s,runtime:{...s.runtime,auto_reload:q}};await Rs({config:re}).then(()=>i(re))},children:[q==="off"&&h.jsx(Jp,{size:14,className:"mr-2 text-muted-foreground"}),q==="lazy"&&h.jsx(_r,{size:14,className:"mr-2 text-muted-foreground"}),q==="autorun"&&h.jsx(br,{size:14,className:"mr-2 text-muted-foreground"}),q]},q))})]})}),t[44]=s,t[45]=i,t[46]=$):$=t[46],t[47]===Symbol.for("react.memo_cache_sentinel")?(N=h.jsx("div",{className:"mx-auto"}),t[47]=N):N=t[47],t[48]===Symbol.for("react.memo_cache_sentinel")?(H=h.jsx(dN,{children:h.jsx(Re,{content:h.jsx("div",{className:"w-[200px]",children:"Kiosk mode is enabled. This allows you to view the outputs of the cells without the ability to edit them."}),children:h.jsx("span",{className:"text-muted-foreground text-sm mr-4",children:"kiosk mode"})})}),t[48]=H):H=t[48],t[49]===Symbol.for("react.memo_cache_sentinel")?(G=h.jsxs("div",{className:"flex items-center",children:[h.jsx(AM,{}),h.jsx(LM,{}),h.jsx(UM,{}),h.jsx($M,{}),h.jsx(FM,{})]}),t[49]=G):G=t[49],t[50]!==v||t[51]!==L||t[52]!==P||t[53]!==$||t[54]!==b?(Z=h.jsxs("footer",{className:"h-10 py-2 bg-background flex items-center text-muted-foreground text-md px-1 border-t border-border select-none no-print text-sm shadow-[0_0_4px_1px_rgba(0,0,0,0.1)] z-50 print:hidden hide-on-fullscreen",children:[b,v,L,B,P,C,$,N,H,G]}),t[50]=v,t[51]=L,t[52]=P,t[53]=$,t[54]=b,t[55]=Z):Z=t[55],Z};function WM(t,e){const{Icon:n}=t;return h.jsx(n,{className:Oe("h-5 w-5",e)})}function qM(t){return t.type==="errors"}const GM=t=>{const e=X.c(6),{children:n}=t,{openModal:o,closeModal:r}=Un();let s,i;return e[0]!==r||e[1]!==o?(s=()=>o(h.jsx(YM,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(i=h.jsx(P4,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=i):i=e[5],i},YM=t=>{const e=X.c(9),{onClose:n}=t;let o,r,s,i,a,l,c;return e[0]!==n?(o=async d=>{d.preventDefault();const u=new FormData(d.target),f=u.get("rating"),p=u.get("message");fetch("https://marimo.io/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({rating:f,message:p})}),n(),lt({title:"Feedback sent!",description:"Thank you for your feedback!"})},e[0]=n,e[1]=o):o=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(dr,{children:"Send Feedback"}),e[2]=r):r=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(s=h.jsx("p",{className:"my-2 prose dark:prose-invert",children:"We want to hear from you \u2014 from minor bug reports to wishlist features and everything in between. Here are some ways you can get in touch:"}),e[3]=s):s=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsxs("li",{className:"my-0",children:["Take our"," ",h.jsx("a",{href:Kn.feedbackForm,target:"_blank",className:"underline",children:"two-minute survey."})]}),e[4]=i):i=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsxs("li",{className:"my-0",children:["File a"," ",h.jsx("a",{href:Kn.issuesPage,target:"_blank",className:"underline",children:"GitHub issue."})]}),e[5]=a):a=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsxs(Os,{children:[r,h.jsxs(Ps,{children:[s,h.jsxs("ul",{className:"list-disc ml-8 my-2 prose dark:prose-invert",children:[i,a,h.jsxs("li",{className:"my-0",children:["Chat with us on"," ",h.jsx("a",{href:Kn.discordLink,target:"_blank",className:"underline",children:"Discord."})]})]}),h.jsx("p",{className:"my-2 prose dark:prose-invert",children:"We're excited you're here as we build the future of Python data tooling. Thanks for being part of our community!"})]})]}),e[6]=l):l=e[6],e[7]!==o?(c=h.jsx(cr,{className:"w-fit",children:h.jsx("form",{onSubmit:o,children:l})}),e[7]=o,e[8]=c):c=e[8],c},JM=()=>{const t=X.c(10),{selectedPanel:e}=gc(),{toggleApplication:n}=na(),o=XM;let r,s,i,a,l,c;return t[0]!==e||t[1]!==n?(r="h-full pt-4 pb-1 px-1 flex flex-col items-start text-muted-foreground text-md select-none no-print text-sm z-50 dark:bg-background print:hidden hide-on-fullscreen",s=cd.filter(ZM).map(d=>h.jsx(Ix,{tooltip:d.tooltip,selected:e===d.type,onClick:()=>n(d.type),children:o(d)},d.type)),t[0]=e,t[1]=n,t[2]=r,t[3]=s):(r=t[2],s=t[3]),t[4]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsx(GM,{children:h.jsx(Ix,{tooltip:"Send feedback!",selected:!1,children:h.jsx(jm,{className:"h-5 w-5"})})}),a=h.jsx("div",{className:"flex-1"}),l=h.jsx(KM,{}),t[4]=i,t[5]=a,t[6]=l):(i=t[4],a=t[5],l=t[6]),t[7]!==r||t[8]!==s?(c=h.jsxs("div",{className:r,children:[s,i,a,l]}),t[7]=r,t[8]=s,t[9]=c):c=t[9],c},KM=()=>{const t=X.c(7),e=He(GU);let n,o,r;return t[0]!==e?(n=e>0?h.jsxs("span",{children:[e," cell",e>1?"s":""," queued or running"]}):"No cells queued or running",t[0]=e,t[1]=n):n=t[1],t[2]!==e?(o=h.jsx("div",{className:"flex flex-col-reverse gap-[1px] overflow-hidden",children:Array.from({length:e}).map(QM)}),t[2]=e,t[3]=o):o=t[3],t[4]!==n||t[5]!==o?(r=h.jsx(Re,{content:n,side:"right",delayDuration:200,children:o}),t[4]=n,t[5]=o,t[6]=r):r=t[6],r},Ix=t=>{const e=X.c(17);let n,o,r,s,i;e[0]!==t?({children:n,tooltip:i,selected:s,className:o,...r}=t,e[0]=t,e[1]=n,e[2]=o,e[3]=r,e[4]=s,e[5]=i):(n=e[1],o=e[2],r=e[3],s=e[4],i=e[5]);const a=!s&&"hover:bg-[var(--sage-3)]",l=s&&"bg-[var(--sage-4)]";let c,d,u;return e[6]!==o||e[7]!==a||e[8]!==l?(c=Oe("flex items-center p-2 text-sm mx-[1px] shadow-inset font-mono cursor-pointer rounded",a,l,o),e[6]=o,e[7]=a,e[8]=l,e[9]=c):c=e[9],e[10]!==n||e[11]!==r||e[12]!==c?(d=h.jsx("div",{className:c,...r,children:n}),e[10]=n,e[11]=r,e[12]=c,e[13]=d):d=e[13],e[14]!==d||e[15]!==i?(u=h.jsx(Re,{content:i,side:"right",delayDuration:200,children:d}),e[14]=d,e[15]=i,e[16]=u):u=e[16],u};function XM(t,e){const{Icon:n}=t;return h.jsx(n,{className:Oe("h-5 w-5",e)})}function ZM(t){return!t.hidden&&t.position==="sidebar"}function QM(t,e){return h.jsx("div",{className:"flex-shrink-0 h-1 w-2 bg-[var(--grass-6)] border border-[var(--grass-7)]"},e.toString())}let Ax;In=t=>{const e=X.c(15),{title:n,description:o,icon:r,action:s}=t;let i,a,l,c,d,u;return e[0]!==r?(i=r&&K.cloneElement(r,{className:"text-accent-foreground"}),e[0]=r,e[1]=i):i=e[1],e[2]!==n?(a=h.jsx("span",{className:"mt-1 text-accent-foreground",children:n}),e[2]=n,e[3]=a):a=e[3],e[4]!==i||e[5]!==a?(l=h.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[i,a]}),e[4]=i,e[5]=a,e[6]=l):l=e[6],e[7]!==o?(c=h.jsx("span",{className:"text-muted-foreground text-sm",children:o}),e[7]=o,e[8]=c):c=e[8],e[9]!==s?(d=s&&h.jsx("div",{className:"mt-2",children:s}),e[9]=s,e[10]=d):d=e[10],e[11]!==l||e[12]!==c||e[13]!==d?(u=h.jsxs("div",{className:"mx-6 my-6 flex flex-col gap-2",children:[l,c,d]}),e[11]=l,e[12]=c,e[13]=d,e[14]=u):u=e[14],u},Ax=()=>{const t=X.c(5),e=YU();if(e.length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(In,{title:"No errors!",icon:h.jsx(Mm,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=e.map(eO),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=h.jsx("div",{className:"flex flex-col overflow-auto",children:n}),t[3]=n,t[4]=o):o=t[4],o};function eO(t){return h.jsxs("div",{children:[h.jsx("div",{className:"text-xs font-mono font-semibold bg-muted border-y px-2 py-1",children:h.jsx(JU,{cellId:t.cellId})}),h.jsx("div",{className:"px-2",children:h.jsx(KU,{errors:t.output.data,cellId:t.cellId},t.cellId)},t.cellId)]},t.cellId)}const tO=()=>{const t=X.c(6),{items:e}=He(XU);let n,o;t[0]!==e?(o=B$(e),t[0]=e,t[1]=o):o=t[1],n=o;const r=n,{activeHeaderId:s}=U$(r);if(e.length===0){let a;return t[2]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx(In,{title:"No outline",description:"Add markdown headings to your notebook to create an outline.",icon:h.jsx(Qc,{})}),t[2]=a):a=t[2],a}let i;return t[3]!==s||t[4]!==e?(i=h.jsx(V$,{items:e,activeHeaderId:s}),t[3]=s,t[4]=e,t[5]=i):i=t[5],i};function un(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=un(t[o]))!==""&&(e+=(e&&" ")+n);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}const{useDebugValue:nO}=K,{useSyncExternalStoreWithSelector:oO}=ZU,rO=t=>t;function Tx(t,e=rO,n){const o=oO(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return nO(o),o}const Mx=(t,e)=>{const n=QU(t),o=(r,s=e)=>Tx(n,r,s);return Object.assign(o,n),o};function nn(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[o,r]of t)if(!Object.is(r,e.get(o)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const o of t)if(!e.has(o))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(e,o)||!Object.is(t[o],e[o]))return!1;return!0}function io(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 sO={passive:!1},Oi={capture:!0,passive:!1};function Uu(t){t.stopImmediatePropagation()}function ss(t){t.preventDefault(),t.stopImmediatePropagation()}function Ox(t){var e=t.document.documentElement,n=eo(t).on("dragstart.drag",ss,Oi);"onselectstart"in e?n.on("selectstart.drag",ss,Oi):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Dx(t,e){var n=t.document.documentElement,o=eo(t).on("dragstart.drag",null);e&&(o.on("click.drag",ss,Oi),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 jl=t=>()=>t;function Vu(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 iO(t){return!t.ctrlKey&&!t.button}function aO(){return this.parentNode}function lO(t,e){return e??{x:t.x,y:t.y}}function cO(){return navigator.maxTouchPoints||"ontouchstart"in this}Vu.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};const El=t=>()=>t;function dO(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 $u(t){t.stopImmediatePropagation()}function Di(t){t.preventDefault(),t.stopImmediatePropagation()}function uO(t){return!(t.ctrlKey&&t.type!=="wheel"||t.button)}function hO(){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 Rx(){return this.__zoom||gr}function fO(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function pO(){return navigator.maxTouchPoints||"ontouchstart"in this}function mO(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 Il=A.createContext(null),gO=Il.Provider,_O=t=>`Node type "${t}" not found. Using fallback type "default".`,bO=()=>"The React Flow parent container needs a width and a height to render the graph.",yO=()=>"Only child nodes can use a parent extent.",xO=t=>`Marker type "${t}" doesn't exist.`,wO=(t,e)=>`Couldn't create edge for ${t?"target":"source"} handle id: "${t?e.targetHandle:e.sourceHandle}", edge id: ${e.id}.`,vO=()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",kO=t=>`Edge type "${t}" not found. Using fallback type "default".`,SO=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.`,Px="[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001";function pt(t,e){const n=A.useContext(Il);if(n===null)throw new Error(Px);return Tx(n,t,e)}const Wt=()=>{const t=A.useContext(Il);if(t===null)throw new Error(Px);return A.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe,destroy:t.destroy}),[t])},CO=t=>t.userSelectionActive?"none":"all";function Al({position:t,children:e,className:n,style:o,...r}){const s=pt(CO),i=`${t}`.split("-");return K.createElement("div",{className:un(["react-flow__panel",n,...i]),style:{...o,pointerEvents:s},...r},e)}function NO({proOptions:t,position:e="bottom-right"}){return t!=null&&t.hideAttribution?null:K.createElement(Al,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},K.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}var jO=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 u=A.useRef(null),[f,p]=A.useState({x:0,y:0,width:0,height:0}),_=un(["react-flow__edge-textwrapper",c]);return A.useEffect(()=>{if(u.current){const g=u.current.getBBox();p({x:g.x,y:g.y,width:g.width,height:g.height})}},[n]),n!==void 0&&n?K.createElement("g",{transform:`translate(${t-f.width/2} ${e-f.height/2})`,className:_,visibility:f.width?"visible":"hidden",...d},r&&K.createElement("rect",{width:f.width+2*i[0],x:-i[0],y:-i[1],height:f.height+2*i[1],className:"react-flow__edge-textbg",style:s,rx:a,ry:a}),K.createElement("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:u,style:o},n),l):null});const Hu=t=>({width:t.offsetWidth,height:t.offsetHeight}),is=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),Wu=(t={x:0,y:0},e)=>({x:is(t.x,e[0][0],e[1][0]),y:is(t.y,e[0][1],e[1][1])}),Lx=(t,e,n)=>t<e?is(Math.abs(t-e),1,50)/50:t>n?-is(Math.abs(t-n),1,50)/50:0,Fx=(t,e)=>[20*Lx(t.x,35,e.width-35),20*Lx(t.y,35,e.height-35)],zx=t=>{var e;return((e=t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},qu=({x:t,y:e,width:n,height:o})=>({x:t,y:e,x2:t+n,y2:e+o}),Bx=t=>({...t.positionAbsolute||{x:0,y:0},width:t.width||0,height:t.height||0}),Gu=(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)},Rn=t=>!isNaN(t)&&isFinite(t),Nt=Symbol.for("internals"),Ux=["Enter"," ","Escape"];function Yu(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 Vx=t=>"clientX"in t,Zo=(t,e)=>{var s,i;const n=Vx(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)}},Tl=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0},Ri=({id:t,path:e,labelX:n,labelY:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:u,markerStart:f,interactionWidth:p=20})=>K.createElement(K.Fragment,null,K.createElement("path",{id:t,style:d,d:e,fill:"none",className:"react-flow__edge-path",markerEnd:u,markerStart:f}),p&&K.createElement("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:p,className:"react-flow__edge-interaction"}),r&&Rn(n)&&Rn(o)?K.createElement(jO,{x:n,y:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null);function Pi(t,e,n){return n===void 0?n:o=>{const r=e().edges.find(s=>s.id===t);r&&n(o,{...r})}}function $x({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 Hx({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 Ir,Wx,Qo,Ju,Li,qx,er,Fi,as,Gx,$e,Ml;function Yx({pos:t,x1:e,y1:n,x2:o,y2:r}){return t===$e.Left||t===$e.Right?[.5*(e+o),n]:[e,.5*(n+r)]}function Jx({sourceX:t,sourceY:e,sourcePosition:n=$e.Bottom,targetX:o,targetY:r,targetPosition:s=$e.Top}){const[i,a]=Yx({pos:n,x1:t,y1:e,x2:o,y2:r}),[l,c]=Yx({pos:s,x1:o,y1:r,x2:t,y2:e}),[d,u,f,p]=Hx({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,u,f,p]}Ri.displayName="BaseEdge",(Wx=Ir||(Ir={})).Strict="strict",Wx.Loose="loose",(Ju=Qo||(Qo={})).Free="free",Ju.Vertical="vertical",Ju.Horizontal="horizontal",(qx=Li||(Li={})).Partial="partial",qx.Full="full",(Fi=er||(er={})).Bezier="default",Fi.Straight="straight",Fi.Step="step",Fi.SmoothStep="smoothstep",Fi.SimpleBezier="simplebezier",(Gx=as||(as={})).Arrow="arrow",Gx.ArrowClosed="arrowclosed",(Ml=$e||($e={})).Left="left",Ml.Top="top",Ml.Right="right",Ml.Bottom="bottom";const Ku=A.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,sourcePosition:r=$e.Bottom,targetPosition:s=$e.Top,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:p,markerStart:_,interactionWidth:g})=>{const[m,b,x]=Jx({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:o,targetPosition:s});return K.createElement(Ri,{path:m,labelX:b,labelY:x,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:p,markerStart:_,interactionWidth:g})});Ku.displayName="SimpleBezierEdge";const Kx={[$e.Left]:{x:-1,y:0},[$e.Right]:{x:1,y:0},[$e.Top]:{x:0,y:-1},[$e.Bottom]:{x:0,y:1}},Xx=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function EO({source:t,sourcePosition:e=$e.Bottom,target:n,targetPosition:o=$e.Top,center:r,offset:s}){const i=Kx[e],a=Kx[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:S,sourcePosition:E=$e.Bottom,target:j})=>E===$e.Left||E===$e.Right?S.x<j.x?{x:1,y:0}:{x:-1,y:0}:S.y<j.y?{x:0,y:1}:{x:0,y:-1})({source:l,sourcePosition:e,target:c}),u=d.x!==0?"x":"y",f=d[u];let p,_,g=[];const m={x:0,y:0},b={x:0,y:0},[x,y,v,k]=$x({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(i[u]*a[u]==-1){p=r.x??x,_=r.y??y;const S=[{x:p,y:l.y},{x:p,y:c.y}],E=[{x:l.x,y:_},{x:c.x,y:_}];g=i[u]===f?u==="x"?S:E:u==="x"?E:S}else{const S=[{x:l.x,y:c.y}],E=[{x:c.x,y:l.y}];if(g=u==="x"?i.x===f?E:S:i.y===f?S:E,e===o){const T=Math.abs(t[u]-n[u]);if(T<=s){const M=Math.min(s-1,s-T);i[u]===f?m[u]=(l[u]>t[u]?-1:1)*M:b[u]=(c[u]>n[u]?-1:1)*M}}if(e!==o){const T=u==="x"?"y":"x",M=i[u]===a[T],L=l[T]>c[T],B=l[T]<c[T];(i[u]===1&&(!M&&L||M&&B)||i[u]!==1&&(!M&&B||M&&L))&&(g=u==="x"?S:E)}const j={x:l.x+m.x,y:l.y+m.y},I={x:c.x+b.x,y:c.y+b.y};Math.max(Math.abs(j.x-g[0].x),Math.abs(I.x-g[0].x))>=Math.max(Math.abs(j.y-g[0].y),Math.abs(I.y-g[0].y))?(p=(j.x+I.x)/2,_=g[0].y):(p=g[0].x,_=(j.y+I.y)/2)}return[[t,{x:l.x+m.x,y:l.y+m.y},...g,{x:c.x+b.x,y:c.y+b.y},n],p,_,v,k]}function Xu({sourceX:t,sourceY:e,sourcePosition:n=$e.Bottom,targetX:o,targetY:r,targetPosition:s=$e.Top,borderRadius:i=5,centerX:a,centerY:l,offset:c=20}){const[d,u,f,p,_]=EO({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,m,b)=>{let x="";return x=b>0&&b<d.length-1?function(y,v,k,S){const E=Math.min(Xx(y,v)/2,Xx(v,k)/2,S),{x:j,y:I}=v;if(y.x===j&&j===k.x||y.y===I&&I===k.y)return`L${j} ${I}`;if(y.y===I)return`L ${j+E*(y.x<k.x?-1:1)},${I}Q ${j},${I} ${j},${I+E*(y.y<k.y?1:-1)}`;const T=y.x<k.x?1:-1;return`L ${j},${I+E*(y.y<k.y?-1:1)}Q ${j},${I} ${j+E*T},${I}`}(d[b-1],m,d[b+1],i):`${b===0?"M":"L"}${m.x} ${m.y}`,g+=x},""),u,f,p,_]}const Ol=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:u=$e.Bottom,targetPosition:f=$e.Top,markerEnd:p,markerStart:_,pathOptions:g,interactionWidth:m})=>{const[b,x,y]=Xu({sourceX:t,sourceY:e,sourcePosition:u,targetX:n,targetY:o,targetPosition:f,borderRadius:g==null?void 0:g.borderRadius,offset:g==null?void 0:g.offset});return K.createElement(Ri,{path:b,labelX:x,labelY:y,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:p,markerStart:_,interactionWidth:m})});Ol.displayName="SmoothStepEdge";const Zu=A.memo(t=>{var e;return K.createElement(Ol,{...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])})});Zu.displayName="StepEdge";const Qu=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:u,markerStart:f,interactionWidth:p})=>{const[_,g,m]=function({sourceX:b,sourceY:x,targetX:y,targetY:v}){const[k,S,E,j]=$x({sourceX:b,sourceY:x,targetX:y,targetY:v});return[`M ${b},${x}L ${y},${v}`,k,S,E,j]}({sourceX:t,sourceY:e,targetX:n,targetY:o});return K.createElement(Ri,{path:_,labelX:g,labelY:m,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:u,markerStart:f,interactionWidth:p})});function Dl(t,e){return t>=0?.5*t:25*e*Math.sqrt(-t)}function Zx({pos:t,x1:e,y1:n,x2:o,y2:r,c:s}){switch(t){case $e.Left:return[e-Dl(e-o,s),n];case $e.Right:return[e+Dl(o-e,s),n];case $e.Top:return[e,n-Dl(n-r,s)];case $e.Bottom:return[e,n+Dl(r-n,s)]}}function Qx({sourceX:t,sourceY:e,sourcePosition:n=$e.Bottom,targetX:o,targetY:r,targetPosition:s=$e.Top,curvature:i=.25}){const[a,l]=Zx({pos:n,x1:t,y1:e,x2:o,y2:r,c:i}),[c,d]=Zx({pos:s,x1:o,y1:r,x2:t,y2:e,c:i}),[u,f,p,_]=Hx({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}`,u,f,p,_]}Qu.displayName="StraightEdge";const Rl=A.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,sourcePosition:r=$e.Bottom,targetPosition:s=$e.Top,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:p,markerStart:_,pathOptions:g,interactionWidth:m})=>{const[b,x,y]=Qx({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:o,targetPosition:s,curvature:g==null?void 0:g.curvature});return K.createElement(Ri,{path:b,labelX:x,labelY:y,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:p,markerStart:_,interactionWidth:m})});Rl.displayName="BezierEdge";const eh=A.createContext(null),IO=eh.Provider;eh.Consumer;const AO=({source:t,sourceHandle:e,target:n,targetHandle:o})=>`reactflow__edge-${t}${e||""}-${n}${o||""}`,th=(t,e)=>t===void 0?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(n=>`${n}=${t[n]}`).join("&")}`,nh=({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},ew=({x:t,y:e},[n,o,r])=>({x:t*r+n,y:e*r+o}),ls=(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}},oh=(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}=ls(r,e).positionAbsolute;return a=o,l=qu({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)},tw=(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:u,height:f,selectable:p=!0,hidden:_=!1}=d;if(i&&!p||_)return!1;const{positionAbsolute:g}=ls(d,a),m={x:g.x,y:g.y,width:u||0,height:f||0},b=Gu(l,m);(u===void 0||f===void 0||u===null||f===null||s&&b>0||b>=(u||0)*(f||0)||d.dragging)&&c.push(d)}),c},nw=(t,e)=>{const n=t.map(o=>o.id);return e.filter(o=>n.includes(o.source)||n.includes(o.target))},ow=(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=is(l,o,r);return{x:e/2-(t.x+t.width/2)*c,y:n/2-(t.y+t.height/2)*c,zoom:c}},Ar=(t,e=0)=>t.transition().duration(e);function rw(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 TO={source:null,target:null,sourceHandle:null,targetHandle:null},sw=()=>({handleDomNode:null,isValid:!1,connection:TO,endHandle:null});function iw(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={...sw(),handleDomNode:l};if(l){const d=rh(void 0,l),u=l.getAttribute("data-nodeid"),f=l.getAttribute("data-handleid"),p=l.classList.contains("connectable"),_=l.classList.contains("connectableend"),g={source:a?u:n,sourceHandle:a?f:o,target:a?n:u,targetHandle:a?o:f};c.connection=g,p&&_&&(e===Ir.Strict?a&&d==="source"||!a&&d==="target":u!==n||f!==o)&&(c.endHandle={nodeId:u,handleId:f,type:d},c.isValid=s(g))}return c}function rh(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function sh(t){t==null||t.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function MO(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function aw({event:t,handleId:e,nodeId:n,onConnect:o,isTarget:r,getState:s,setState:i,isValidConnection:a,edgeUpdaterType:l,onReconnectEnd:c}){const d=zx(t.target),{connectionMode:u,domNode:f,autoPanOnConnect:p,connectionRadius:_,onConnectStart:g,panBy:m,getNodes:b,cancelConnection:x}=s();let y,v=0;const{x:k,y:S}=Zo(t),E=d==null?void 0:d.elementFromPoint(k,S),j=rh(l,E),I=f==null?void 0:f.getBoundingClientRect();if(!I||!j)return;let T,M=Zo(t,I),L=!1,B=null,O=!1,z=null;const F=function({nodes:$,nodeId:N,handleId:H,handleType:G}){return $.reduce((Z,q)=>{if(q[Nt]){const{handleBounds:re}=q[Nt];let ne=[],oe=[];re&&(ne=rw(q,re,"source",`${N}-${H}-${G}`),oe=rw(q,re,"target",`${N}-${H}-${G}`)),Z.push(...ne,...oe)}return Z},[])}({nodes:b(),nodeId:n,handleId:e,handleType:j}),V=()=>{if(!p)return;const[$,N]=Fx(M,I);m({x:$,y:N}),v=requestAnimationFrame(V)};function P($){const{transform:N}=s();M=Zo($,I);const{handle:H,validHandleResult:G}=function(Z,q,re,ne,oe,Y){const{x:Q,y:ce}=Zo(Z),he=q.elementsFromPoint(Q,ce).find(we=>we.classList.contains("react-flow__handle"));if(he){const we=he.getAttribute("data-nodeid");if(we){const ae=rh(void 0,he),ve=he.getAttribute("data-handleid"),ge=Y({nodeId:we,id:ve,type:ae});if(ge){const be=oe.find(Te=>Te.nodeId===we&&Te.type===ae&&Te.id===ve);return{handle:{id:ve,type:ae,nodeId:we,x:(be==null?void 0:be.x)||re.x,y:(be==null?void 0:be.y)||re.y},validHandleResult:ge}}}}let de=[],me=1/0;if(oe.forEach(we=>{const ae=Math.sqrt((we.x-re.x)**2+(we.y-re.y)**2);if(ae<=ne){const ve=Y(we);ae<=me&&(ae<me?de=[{handle:we,validHandleResult:ve}]:ae===me&&de.push({handle:we,validHandleResult:ve}),me=ae)}}),!de.length)return{handle:null,validHandleResult:sw()};if(de.length===1)return de[0];const ie=de.some(({validHandleResult:we})=>we.isValid),Ce=de.some(({handle:we})=>we.type==="target");return de.find(({handle:we,validHandleResult:ae})=>Ce?we.type==="target":!ie||ae.isValid)||de[0]}($,d,nh(M,N,!1,[1,1]),_,F,Z=>iw(Z,u,n,e,r?"target":"source",a,d));if(y=H,L||(V(),L=!0),z=G.handleDomNode,B=G.connection,O=G.isValid,i({connectionPosition:y&&O?ew({x:y.x,y:y.y},N):M,connectionStatus:MO(!!y,O),connectionEndHandle:G.endHandle}),!y&&!O&&!z)return sh(T);B.source!==B.target&&z&&(sh(T),T=z,z.classList.add("connecting","react-flow__handle-connecting"),z.classList.toggle("valid",O),z.classList.toggle("react-flow__handle-valid",O))}function C($){var N,H;(y||z)&&B&&O&&(o==null||o(B)),(H=(N=s()).onConnectEnd)==null||H.call(N,$),l&&(c==null||c($)),sh(T),x(),cancelAnimationFrame(v),L=!1,O=!1,B=null,z=null,d.removeEventListener("mousemove",P),d.removeEventListener("mouseup",C),d.removeEventListener("touchmove",P),d.removeEventListener("touchend",C)}i({connectionPosition:M,connectionStatus:null,connectionNodeId:n,connectionHandleId:e,connectionHandleType:j,connectionStartHandle:{nodeId:n,handleId:e,type:j},connectionEndHandle:null}),g==null||g(t,{nodeId:n,handleId:e,handleType:j}),d.addEventListener("mousemove",P),d.addEventListener("mouseup",C),d.addEventListener("touchmove",P),d.addEventListener("touchend",C)}const lw=()=>!0,OO=t=>({connectionStartHandle:t.connectionStartHandle,connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName}),cw=A.forwardRef(({type:t="source",position:e=$e.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:s=!0,id:i,onConnect:a,children:l,className:c,onMouseDown:d,onTouchStart:u,...f},p)=>{var j,I;const _=i||null,g=t==="target",m=Wt(),b=A.useContext(eh),{connectOnClick:x,noPanClassName:y}=pt(OO,nn),{connecting:v,clickConnecting:k}=pt(((T,M,L)=>B=>{const{connectionStartHandle:O,connectionEndHandle:z,connectionClickStartHandle:F}=B;return{connecting:(O==null?void 0:O.nodeId)===T&&(O==null?void 0:O.handleId)===M&&(O==null?void 0:O.type)===L||(z==null?void 0:z.nodeId)===T&&(z==null?void 0:z.handleId)===M&&(z==null?void 0:z.type)===L,clickConnecting:(F==null?void 0:F.nodeId)===T&&(F==null?void 0:F.handleId)===M&&(F==null?void 0:F.type)===L}})(b,_,t),nn);b||((I=(j=m.getState()).onError)==null||I.call(j,"010",vO()));const S=T=>{const{defaultEdgeOptions:M,onConnect:L,hasDefaultEdges:B}=m.getState(),O={...M,...T};if(B){const{edges:z,setEdges:F}=m.getState();F(((V,P)=>{if(!V.source||!V.target)return P;let C;return C=($=>"id"in $&&"source"in $&&"target"in $)(V)?{...V}:{...V,id:AO(V)},(($,N)=>N.some(H=>!(H.source!==$.source||H.target!==$.target||H.sourceHandle!==$.sourceHandle&&(H.sourceHandle||$.sourceHandle)||H.targetHandle!==$.targetHandle&&(H.targetHandle||$.targetHandle))))(C,P)?P:P.concat(C)})(O,z))}L==null||L(O),a==null||a(O)},E=T=>{if(!b)return;const M=Vx(T);r&&(M&&T.button===0||!M)&&aw({event:T,handleId:_,nodeId:b,onConnect:S,isTarget:g,getState:m.getState,setState:m.setState,isValidConnection:n||m.getState().isValidConnection||lw}),M?d==null||d(T):u==null||u(T)};return K.createElement("div",{"data-handleid":_,"data-nodeid":b,"data-handlepos":e,"data-id":`${b}-${_}-${t}`,className:un(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",y,c,{source:!g,target:g,connectable:o,connectablestart:r,connectableend:s,connecting:k,connectionindicator:o&&(r&&!v||s&&v)}]),onMouseDown:E,onTouchStart:E,onClick:x?T=>{const{onClickConnectStart:M,onClickConnectEnd:L,connectionClickStartHandle:B,connectionMode:O,isValidConnection:z}=m.getState();if(!b||!B&&!r)return;if(!B)return M==null||M(T,{nodeId:b,handleId:_,handleType:t}),void m.setState({connectionClickStartHandle:{nodeId:b,type:t,handleId:_}});const F=zx(T.target),V=n||z||lw,{connection:P,isValid:C}=iw({nodeId:b,id:_,type:t},O,B.nodeId,B.handleId||null,B.type,V,F);C&&S(P),L==null||L(T),m.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f},l)});cw.displayName="Handle";var tr=A.memo(cw);const dw=({data:t,isConnectable:e,targetPosition:n=$e.Top,sourcePosition:o=$e.Bottom})=>K.createElement(K.Fragment,null,K.createElement(tr,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label,K.createElement(tr,{type:"source",position:o,isConnectable:e}));dw.displayName="DefaultNode";var ih=A.memo(dw);const uw=({data:t,isConnectable:e,sourcePosition:n=$e.Bottom})=>K.createElement(K.Fragment,null,t==null?void 0:t.label,K.createElement(tr,{type:"source",position:n,isConnectable:e}));uw.displayName="InputNode";var hw=A.memo(uw);const fw=({data:t,isConnectable:e,targetPosition:n=$e.Top})=>K.createElement(K.Fragment,null,K.createElement(tr,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label);fw.displayName="OutputNode";var pw=A.memo(fw);const ah=()=>null;ah.displayName="GroupNode";const DO=t=>({selectedNodes:t.getNodes().filter(e=>e.selected),selectedEdges:t.edges.filter(e=>e.selected).map(e=>({...e}))}),Pl=t=>t.id;function RO(t,e){return nn(t.selectedNodes.map(Pl),e.selectedNodes.map(Pl))&&nn(t.selectedEdges.map(Pl),e.selectedEdges.map(Pl))}const mw=A.memo(({onSelectionChange:t})=>{const e=Wt(),{selectedNodes:n,selectedEdges:o}=pt(DO,RO);return A.useEffect(()=>{const r={nodes:n,edges:o};t==null||t(r),e.getState().onSelectionChange.forEach(s=>s(r))},[n,o,t]),null});mw.displayName="SelectionListener";const PO=t=>!!t.onSelectionChange;function LO({onSelectionChange:t}){const e=pt(PO);return t||e?K.createElement(mw,{onSelectionChange:t}):null}const FO=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 cs(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 zO=({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,onConnect:r,onConnectStart:s,onConnectEnd:i,onClickConnectStart:a,onClickConnectEnd:l,nodesDraggable:c,nodesConnectable:d,nodesFocusable:u,edgesFocusable:f,edgesUpdatable:p,elevateNodesOnSelect:_,minZoom:g,maxZoom:m,nodeExtent:b,onNodesChange:x,onEdgesChange:y,elementsSelectable:v,connectionMode:k,snapGrid:S,snapToGrid:E,translateExtent:j,connectOnClick:I,defaultEdgeOptions:T,fitView:M,fitViewOptions:L,onNodesDelete:B,onEdgesDelete:O,onNodeDrag:z,onNodeDragStart:F,onNodeDragStop:V,onSelectionDrag:P,onSelectionDragStart:C,onSelectionDragStop:$,noPanClassName:N,nodeOrigin:H,rfId:G,autoPanOnConnect:Z,autoPanOnNodeDrag:q,onError:re,connectionRadius:ne,isValidConnection:oe,nodeDragThreshold:Y})=>{const{setNodes:Q,setEdges:ce,setDefaultNodesAndEdges:he,setMinZoom:de,setMaxZoom:me,setTranslateExtent:ie,setNodeExtent:Ce,reset:we}=pt(FO,nn),ae=Wt();return A.useEffect(()=>{const ve=o==null?void 0:o.map(ge=>({...ge,...T}));return he(n,ve),()=>{we()}},[]),at("defaultEdgeOptions",T,ae.setState),at("connectionMode",k,ae.setState),at("onConnect",r,ae.setState),at("onConnectStart",s,ae.setState),at("onConnectEnd",i,ae.setState),at("onClickConnectStart",a,ae.setState),at("onClickConnectEnd",l,ae.setState),at("nodesDraggable",c,ae.setState),at("nodesConnectable",d,ae.setState),at("nodesFocusable",u,ae.setState),at("edgesFocusable",f,ae.setState),at("edgesUpdatable",p,ae.setState),at("elementsSelectable",v,ae.setState),at("elevateNodesOnSelect",_,ae.setState),at("snapToGrid",E,ae.setState),at("snapGrid",S,ae.setState),at("onNodesChange",x,ae.setState),at("onEdgesChange",y,ae.setState),at("connectOnClick",I,ae.setState),at("fitViewOnInit",M,ae.setState),at("fitViewOnInitOptions",L,ae.setState),at("onNodesDelete",B,ae.setState),at("onEdgesDelete",O,ae.setState),at("onNodeDrag",z,ae.setState),at("onNodeDragStart",F,ae.setState),at("onNodeDragStop",V,ae.setState),at("onSelectionDrag",P,ae.setState),at("onSelectionDragStart",C,ae.setState),at("onSelectionDragStop",$,ae.setState),at("noPanClassName",N,ae.setState),at("nodeOrigin",H,ae.setState),at("rfId",G,ae.setState),at("autoPanOnConnect",Z,ae.setState),at("autoPanOnNodeDrag",q,ae.setState),at("onError",re,ae.setState),at("connectionRadius",ne,ae.setState),at("isValidConnection",oe,ae.setState),at("nodeDragThreshold",Y,ae.setState),cs(t,Q),cs(e,ce),cs(g,de),cs(m,me),cs(j,ie),cs(b,Ce),null},gw={display:"none"},BO={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},_w="react-flow__node-desc",bw="react-flow__edge-desc",UO=t=>t.ariaLiveMessage;function VO({rfId:t}){const e=pt(UO);return K.createElement("div",{id:`react-flow__aria-live-${t}`,"aria-live":"assertive","aria-atomic":"true",style:BO},e)}function $O({rfId:t,disableKeyboardA11y:e}){return K.createElement(K.Fragment,null,K.createElement("div",{id:`${_w}-${t}`,style:gw},"Press enter or space to select a node.",!e&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),K.createElement("div",{id:`${bw}-${t}`,style:gw},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!e&&K.createElement(VO,{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,u)=>d.concat(...u),[]);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=p=>{if(r.current=p.ctrlKey||p.metaKey||p.shiftKey,(!r.current||r.current&&!e.actInsideInputWithModifier)&&Yu(p))return!1;const _=xw(p.code,a);s.current.add(p[_]),yw(i,s.current,!1)&&(p.preventDefault(),o(!0))},u=p=>{if((!r.current||r.current&&!e.actInsideInputWithModifier)&&Yu(p))return!1;const _=xw(p.code,a);yw(i,s.current,!0)?(o(!1),s.current.clear()):s.current.delete(p[_]),p.key==="Meta"&&s.current.clear(),r.current=!1},f=()=>{s.current.clear(),o(!1)};return c==null||c.addEventListener("keydown",d),c==null||c.addEventListener("keyup",u),window.addEventListener("blur",f),()=>{c==null||c.removeEventListener("keydown",d),c==null||c.removeEventListener("keyup",u),window.removeEventListener("blur",f)}}},[t,o]),n};function yw(t,e,n){return t.filter(o=>n||o.length===e.size).some(o=>o.every(r=>e.has(r)))}function xw(t,e){return e.includes(t)?"code":"key"}function ww(t,e,n,o){var a,l;const r=t.parentNode||t.parentId;if(!r)return n;const s=e.get(r),i=ls(s,o);return ww(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 vw(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}=ww(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 lh(t,e,n,o){const r=new Map,s={},i=o?1e3:0;return t.forEach(a=>{var p;const l=(Rn(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}},u=a.parentNode||a.parentId;u&&(s[u]=!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||(p=c==null?void 0:c[Nt])==null?void 0:p.handleBounds,z:l}}),r.set(a.id,d)}),vw(r,n,s),r}function kw(t,e={}){const{getNodes:n,width:o,height:r,minZoom:s,maxZoom:i,d3Zoom:a,d3Selection:l,fitViewOnInitDone:c,fitViewOnInit:d,nodeOrigin:u}=t(),f=e.initial&&!c&&d;if(a&&l&&(f||!e.initial)){const p=n().filter(g=>{var b;const m=e.includeHiddenNodes?g.width&&g.height:!g.hidden;return(b=e.nodes)!=null&&b.length?m&&e.nodes.some(x=>x.id===g.id):m}),_=p.every(g=>g.width&&g.height);if(p.length>0&&_){const g=oh(p,u),{x:m,y:b,zoom:x}=ow(g,o,r,e.minZoom??s,e.maxZoom??i,e.padding??.1),y=gr.translate(m,b).scale(x);return typeof e.duration=="number"&&e.duration>0?a.transform(Ar(l,e.duration),y):a.transform(l,y),!0}}return!1}function HO(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 WO(t,e){return e.map(n=>{const o=t.find(r=>r.id===n.id);return o&&(n.selected=o.selected),n})}function Ll({changedNodes:t,changedEdges:e,get:n,set:o}){const{nodeInternals:r,edges:s,onNodesChange:i,onEdgesChange:a,hasDefaultNodes:l,hasDefaultEdges:c}=n();t!=null&&t.length&&(l&&o({nodeInternals:HO(t,r)}),i==null||i(t)),e!=null&&e.length&&(c&&o({edges:WO(e,s)}),a==null||a(e))}const ds=()=>{},qO={zoomIn:ds,zoomOut:ds,zoomTo:ds,getZoom:()=>1,setViewport:ds,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:ds,fitBounds:ds,project:t=>t,screenToFlowPosition:t=>t,flowToScreenPosition:t=>t,viewportInitialized:!1},GO=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection});function Bi(){const t=(()=>{const g=Wt(),{d3Zoom:m,d3Selection:b}=pt(GO,nn);return A.useMemo(()=>b&&m?{zoomIn:y=>m.scaleBy(Ar(b,y==null?void 0:y.duration),1.2),zoomOut:y=>m.scaleBy(Ar(b,y==null?void 0:y.duration),1/1.2),zoomTo:(y,v)=>m.scaleTo(Ar(b,v==null?void 0:v.duration),y),getZoom:()=>g.getState().transform[2],setViewport:(y,v)=>{const[k,S,E]=g.getState().transform,j=gr.translate(y.x??k,y.y??S).scale(y.zoom??E);m.transform(Ar(b,v==null?void 0:v.duration),j)},getViewport:()=>{const[y,v,k]=g.getState().transform;return{x:y,y:v,zoom:k}},fitView:y=>kw(g.getState,y),setCenter:(y,v,k)=>{const{width:S,height:E,maxZoom:j}=g.getState(),I=(k==null?void 0:k.zoom)!==void 0?k.zoom:j,T=S/2-y*I,M=E/2-v*I,L=gr.translate(T,M).scale(I);m.transform(Ar(b,k==null?void 0:k.duration),L)},fitBounds:(y,v)=>{const{width:k,height:S,minZoom:E,maxZoom:j}=g.getState(),{x:I,y:T,zoom:M}=ow(y,k,S,E,j,(v==null?void 0:v.padding)??.1),L=gr.translate(I,T).scale(M);m.transform(Ar(b,v==null?void 0:v.duration),L)},project:y=>{const{transform:v,snapToGrid:k,snapGrid:S}=g.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),nh(y,v,k,S)},screenToFlowPosition:y=>{const{transform:v,snapToGrid:k,snapGrid:S,domNode:E}=g.getState();if(!E)return y;const{x:j,y:I}=E.getBoundingClientRect(),T={x:y.x-j,y:y.y-I};return nh(T,v,k,S)},flowToScreenPosition:y=>{const{transform:v,domNode:k}=g.getState();if(!k)return y;const{x:S,y:E}=k.getBoundingClientRect(),j=ew(y,v);return{x:j.x+S,y:j.y+E}},viewportInitialized:!0}:qO,[m,b])})(),e=Wt(),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(m=>({...m}))},[]),s=A.useCallback(g=>{const{edges:m=[]}=e.getState();return m.find(b=>b.id===g)},[]),i=A.useCallback(g=>{const{getNodes:m,setNodes:b,hasDefaultNodes:x,onNodesChange:y}=e.getState(),v=m(),k=typeof g=="function"?g(v):g;if(x)b(k);else if(y){const S=k.length===0?v.map(E=>({type:"remove",id:E.id})):k.map(E=>({item:E,type:"reset"}));y(S)}},[]),a=A.useCallback(g=>{const{edges:m=[],setEdges:b,hasDefaultEdges:x,onEdgesChange:y}=e.getState(),v=typeof g=="function"?g(m):g;x?b(v):y&&y(v.length===0?m.map(k=>({type:"remove",id:k.id})):v.map(k=>({item:k,type:"reset"})))},[]),l=A.useCallback(g=>{const m=Array.isArray(g)?g:[g],{getNodes:b,setNodes:x,hasDefaultNodes:y,onNodesChange:v}=e.getState();if(y)x([...b(),...m]);else if(v){const k=m.map(S=>({item:S,type:"add"}));v(k)}},[]),c=A.useCallback(g=>{const m=Array.isArray(g)?g:[g],{edges:b=[],setEdges:x,hasDefaultEdges:y,onEdgesChange:v}=e.getState();y?x([...b,...m]):v&&v(m.map(k=>({item:k,type:"add"})))},[]),d=A.useCallback(()=>{const{getNodes:g,edges:m=[],transform:b}=e.getState(),[x,y,v]=b;return{nodes:g().map(k=>({...k})),edges:m.map(k=>({...k})),viewport:{x,y,zoom:v}}},[]),u=A.useCallback(({nodes:g,edges:m})=>{const{nodeInternals:b,getNodes:x,edges:y,hasDefaultNodes:v,hasDefaultEdges:k,onNodesDelete:S,onEdgesDelete:E,onNodesChange:j,onEdgesChange:I}=e.getState(),T=(g||[]).map(z=>z.id),M=(m||[]).map(z=>z.id),L=x().reduce((z,F)=>{const V=F.parentNode||F.parentId,P=!T.includes(F.id)&&V&&z.find(C=>C.id===V);return(typeof F.deletable!="boolean"||F.deletable)&&(T.includes(F.id)||P)&&z.push(F),z},[]),B=y.filter(z=>typeof z.deletable!="boolean"||z.deletable),O=B.filter(z=>M.includes(z.id));if(L||O){const z=nw(L,B),F=[...O,...z],V=F.reduce((P,C)=>(P.includes(C.id)||P.push(C.id),P),[]);(k||v)&&(k&&e.setState({edges:y.filter(P=>!V.includes(P.id))}),v&&(L.forEach(P=>{b.delete(P.id)}),e.setState({nodeInternals:new Map(b)}))),V.length>0&&(E==null||E(F),I&&I(V.map(P=>({id:P,type:"remove"})))),L.length>0&&(S==null||S(L),j)&&j(L.map(P=>({id:P.id,type:"remove"})))}},[]),f=A.useCallback(g=>{const m=Rn((b=g).width)&&Rn(b.height)&&Rn(b.x)&&Rn(b.y);var b;const x=m?null:e.getState().nodeInternals.get(g.id);return!m&&!x?[null,null,m]:[m?g:Bx(x),x,m]},[]),p=A.useCallback((g,m=!0,b)=>{const[x,y,v]=f(g);return x?(b||e.getState().getNodes()).filter(k=>{if(!(v||k.id!==y.id&&k.positionAbsolute))return!1;const S=Bx(k),E=Gu(S,x);return m&&E>0||E>=x.width*x.height}):[]},[]),_=A.useCallback((g,m,b=!0)=>{const[x]=f(g);if(!x)return!1;const y=Gu(x,m);return b&&y>0||y>=x.width*x.height},[]);return A.useMemo(()=>({...t,getNodes:n,getNode:o,getEdges:r,getEdge:s,setNodes:i,setEdges:a,addNodes:l,addEdges:c,toObject:d,deleteElements:u,getIntersectingNodes:p,isNodeIntersecting:_}),[t,n,o,r,s,i,a,l,c,d,u,p,_])}const YO={actInsideInputWithModifier:!1},ch={position:"absolute",width:"100%",height:"100%",top:0,left:0},Fl=t=>({x:t.x,y:t.y,zoom:t.k}),us=(t,e)=>t.target.closest(`.${e}`),Sw=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),Cw=t=>{const e=t.ctrlKey&&Tl()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e},JO=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection,d3ZoomHandler:t.d3ZoomHandler,userSelectionActive:t.userSelectionActive}),KO=({onMove:t,onMoveStart:e,onMoveEnd:n,onPaneContextMenu:o,zoomOnScroll:r=!0,zoomOnPinch:s=!0,panOnScroll:i=!1,panOnScrollSpeed:a=.5,panOnScrollMode:l=Qo.Free,zoomOnDoubleClick:c=!0,elementsSelectable:d,panOnDrag:u=!0,defaultViewport:f,translateExtent:p,minZoom:_,maxZoom:g,zoomActivationKeyCode:m,preventScrolling:b=!0,children:x,noWheelClassName:y,noPanClassName:v})=>{const k=A.useRef(),S=Wt(),E=A.useRef(!1),j=A.useRef(!1),I=A.useRef(null),T=A.useRef({x:0,y:0,zoom:0}),{d3Zoom:M,d3Selection:L,d3ZoomHandler:B,userSelectionActive:O}=pt(JO,nn),z=zi(m),F=A.useRef(0),V=A.useRef(!1),P=A.useRef();return function(C){const $=Wt();A.useEffect(()=>{let N;const H=()=>{var Z,q;if(!C.current)return;const G=Hu(C.current);G.height!==0&&G.width!==0||((q=(Z=$.getState()).onError)==null||q.call(Z,"004",bO())),$.setState({width:G.width||500,height:G.height||500})};return H(),window.addEventListener("resize",H),C.current&&(N=new ResizeObserver(()=>H()),N.observe(C.current)),()=>{window.removeEventListener("resize",H),N&&C.current&&N.unobserve(C.current)}},[])}(I),A.useEffect(()=>{if(I.current){const C=I.current.getBoundingClientRect(),$=function(){var q,re,ne,oe=uO,Y=hO,Q=mO,ce=fO,he=pO,de=[0,1/0],me=[[-1/0,-1/0],[1/0,1/0]],ie=250,Ce=K$,we=SS("start","zoom","end"),ae=0,ve=10;function ge(J){J.property("__zoom",Rx).on("wheel.zoom",nt,{passive:!1}).on("mousedown.zoom",it).on("dblclick.zoom",te).filter(he).on("touchstart.zoom",Ne).on("touchmove.zoom",Me).on("touchend.zoom touchcancel.zoom",Be).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function be(J,pe){return(pe=Math.max(de[0],Math.min(de[1],pe)))===J.k?J:new Qp(pe,J.x,J.y)}function Te(J,pe,_e){var ue=pe[0]-_e[0]*J.k,je=pe[1]-_e[1]*J.k;return ue===J.x&&je===J.y?J:new Qp(J.k,ue,je)}function ze(J){return[(+J[0][0]+ +J[1][0])/2,(+J[0][1]+ +J[1][1])/2]}function Xe(J,pe,_e,ue){J.on("start.zoom",function(){Fe(this,arguments).event(ue).start()}).on("interrupt.zoom end.zoom",function(){Fe(this,arguments).event(ue).end()}).tween("zoom",function(){var je=this,ke=arguments,Ve=Fe(je,ke).event(ue),Ze=Y.apply(je,ke),le=_e==null?ze(Ze):typeof _e=="function"?_e.apply(je,ke):_e,Ee=Math.max(Ze[1][0]-Ze[0][0],Ze[1][1]-Ze[0][1]),Ie=je.__zoom,Ue=typeof pe=="function"?pe.apply(je,ke):pe,We=Ce(Ie.invert(le).concat(Ee/Ie.k),Ue.invert(le).concat(Ee/Ue.k));return function(De){if(De===1)De=Ue;else{var Ge=We(De),ot=Ee/Ge[2];De=new Qp(ot,le[0]-Ge[0]*ot,le[1]-Ge[1]*ot)}Ve.zoom(null,De)}})}function Fe(J,pe,_e){return!_e&&J.__zooming||new et(J,pe)}function et(J,pe){this.that=J,this.args=pe,this.active=0,this.sourceEvent=null,this.extent=Y.apply(J,pe),this.taps=0}function nt(J,...pe){if(oe.apply(this,arguments)){var _e=Fe(this,pe).event(J),ue=this.__zoom,je=Math.max(de[0],Math.min(de[1],ue.k*Math.pow(2,ce.apply(this,arguments)))),ke=io(J);if(_e.wheel)_e.mouse[0][0]===ke[0]&&_e.mouse[0][1]===ke[1]||(_e.mouse[1]=ue.invert(_e.mouse[0]=ke)),clearTimeout(_e.wheel);else{if(ue.k===je)return;_e.mouse=[ke,ue.invert(ke)],em(this),_e.start()}Di(J),_e.wheel=setTimeout(function(){_e.wheel=null,_e.end()},150),_e.zoom("mouse",Q(Te(be(ue,je),_e.mouse[0],_e.mouse[1]),_e.extent,me))}}function it(J,...pe){if(!ne&&oe.apply(this,arguments)){var _e=J.currentTarget,ue=Fe(this,pe,!0).event(J),je=eo(J.view).on("mousemove.zoom",function(le){if(Di(le),!ue.moved){var Ee=le.clientX-Ve,Ie=le.clientY-Ze;ue.moved=Ee*Ee+Ie*Ie>ae}ue.event(le).zoom("mouse",Q(Te(ue.that.__zoom,ue.mouse[0]=io(le,_e),ue.mouse[1]),ue.extent,me))},!0).on("mouseup.zoom",function(le){je.on("mousemove.zoom mouseup.zoom",null),Dx(le.view,ue.moved),Di(le),ue.event(le).end()},!0),ke=io(J,_e),Ve=J.clientX,Ze=J.clientY;Ox(J.view),$u(J),ue.mouse=[ke,this.__zoom.invert(ke)],em(this),ue.start()}}function te(J,...pe){if(oe.apply(this,arguments)){var _e=this.__zoom,ue=io(J.changedTouches?J.changedTouches[0]:J,this),je=_e.invert(ue),ke=_e.k*(J.shiftKey?.5:2),Ve=Q(Te(be(_e,ke),ue,je),Y.apply(this,pe),me);Di(J),ie>0?eo(this).transition().duration(ie).call(Xe,Ve,ue,J):eo(this).call(ge.transform,Ve,ue,J)}}function Ne(J,...pe){if(oe.apply(this,arguments)){var _e,ue,je,ke,Ve=J.touches,Ze=Ve.length,le=Fe(this,pe,J.changedTouches.length===Ze).event(J);for($u(J),ue=0;ue<Ze;++ue)ke=[ke=io(je=Ve[ue],this),this.__zoom.invert(ke),je.identifier],le.touch0?le.touch1||le.touch0[2]===ke[2]||(le.touch1=ke,le.taps=0):(le.touch0=ke,_e=!0,le.taps=1+!!q);q&&(q=clearTimeout(q)),_e&&(le.taps<2&&(re=ke[0],q=setTimeout(function(){q=null},500)),em(this),le.start())}}function Me(J,...pe){if(this.__zooming){var _e,ue,je,ke,Ve=Fe(this,pe).event(J),Ze=J.changedTouches,le=Ze.length;for(Di(J),_e=0;_e<le;++_e)je=io(ue=Ze[_e],this),Ve.touch0&&Ve.touch0[2]===ue.identifier?Ve.touch0[0]=je:Ve.touch1&&Ve.touch1[2]===ue.identifier&&(Ve.touch1[0]=je);if(ue=Ve.that.__zoom,Ve.touch1){var Ee=Ve.touch0[0],Ie=Ve.touch0[1],Ue=Ve.touch1[0],We=Ve.touch1[1],De=(De=Ue[0]-Ee[0])*De+(De=Ue[1]-Ee[1])*De,Ge=(Ge=We[0]-Ie[0])*Ge+(Ge=We[1]-Ie[1])*Ge;ue=be(ue,Math.sqrt(De/Ge)),je=[(Ee[0]+Ue[0])/2,(Ee[1]+Ue[1])/2],ke=[(Ie[0]+We[0])/2,(Ie[1]+We[1])/2]}else{if(!Ve.touch0)return;je=Ve.touch0[0],ke=Ve.touch0[1]}Ve.zoom("touch",Q(Te(ue,je,ke),Ve.extent,me))}}function Be(J,...pe){if(this.__zooming){var _e,ue,je=Fe(this,pe).event(J),ke=J.changedTouches,Ve=ke.length;for($u(J),ne&&clearTimeout(ne),ne=setTimeout(function(){ne=null},500),_e=0;_e<Ve;++_e)ue=ke[_e],je.touch0&&je.touch0[2]===ue.identifier?delete je.touch0:je.touch1&&je.touch1[2]===ue.identifier&&delete je.touch1;if(je.touch1&&!je.touch0&&(je.touch0=je.touch1,delete je.touch1),je.touch0)je.touch0[1]=this.__zoom.invert(je.touch0[0]);else if(je.end(),je.taps===2&&(ue=io(ue,this),Math.hypot(re[0]-ue[0],re[1]-ue[1])<ve)){var Ze=eo(this).on("dblclick.zoom");Ze&&Ze.apply(this,arguments)}}}return ge.transform=function(J,pe,_e,ue){var je=J.selection?J.selection():J;je.property("__zoom",Rx),J!==je?Xe(J,pe,_e,ue):je.interrupt().each(function(){Fe(this,arguments).event(ue).start().zoom(null,typeof pe=="function"?pe.apply(this,arguments):pe).end()})},ge.scaleBy=function(J,pe,_e,ue){ge.scaleTo(J,function(){return this.__zoom.k*(typeof pe=="function"?pe.apply(this,arguments):pe)},_e,ue)},ge.scaleTo=function(J,pe,_e,ue){ge.transform(J,function(){var je=Y.apply(this,arguments),ke=this.__zoom,Ve=_e==null?ze(je):typeof _e=="function"?_e.apply(this,arguments):_e,Ze=ke.invert(Ve),le=typeof pe=="function"?pe.apply(this,arguments):pe;return Q(Te(be(ke,le),Ve,Ze),je,me)},_e,ue)},ge.translateBy=function(J,pe,_e,ue){ge.transform(J,function(){return Q(this.__zoom.translate(typeof pe=="function"?pe.apply(this,arguments):pe,typeof _e=="function"?_e.apply(this,arguments):_e),Y.apply(this,arguments),me)},null,ue)},ge.translateTo=function(J,pe,_e,ue,je){ge.transform(J,function(){var ke=Y.apply(this,arguments),Ve=this.__zoom,Ze=ue==null?ze(ke):typeof ue=="function"?ue.apply(this,arguments):ue;return Q(gr.translate(Ze[0],Ze[1]).scale(Ve.k).translate(typeof pe=="function"?-pe.apply(this,arguments):-pe,typeof _e=="function"?-_e.apply(this,arguments):-_e),ke,me)},ue,je)},et.prototype={event:function(J){return J&&(this.sourceEvent=J),this},start:function(){return++this.active==1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(J,pe){return this.mouse&&J!=="mouse"&&(this.mouse[1]=pe.invert(this.mouse[0])),this.touch0&&J!=="touch"&&(this.touch0[1]=pe.invert(this.touch0[0])),this.touch1&&J!=="touch"&&(this.touch1[1]=pe.invert(this.touch1[0])),this.that.__zoom=pe,this.emit("zoom"),this},end:function(){return--this.active==0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(J){var pe=eo(this.that).datum();we.call(J,this.that,new dO(J,{sourceEvent:this.sourceEvent,target:ge,transform:this.that.__zoom,dispatch:we}),pe)}},ge.wheelDelta=function(J){return arguments.length?(ce=typeof J=="function"?J:El(+J),ge):ce},ge.filter=function(J){return arguments.length?(oe=typeof J=="function"?J:El(!!J),ge):oe},ge.touchable=function(J){return arguments.length?(he=typeof J=="function"?J:El(!!J),ge):he},ge.extent=function(J){return arguments.length?(Y=typeof J=="function"?J:El([[+J[0][0],+J[0][1]],[+J[1][0],+J[1][1]]]),ge):Y},ge.scaleExtent=function(J){return arguments.length?(de[0]=+J[0],de[1]=+J[1],ge):[de[0],de[1]]},ge.translateExtent=function(J){return arguments.length?(me[0][0]=+J[0][0],me[1][0]=+J[1][0],me[0][1]=+J[0][1],me[1][1]=+J[1][1],ge):[[me[0][0],me[0][1]],[me[1][0],me[1][1]]]},ge.constrain=function(J){return arguments.length?(Q=J,ge):Q},ge.duration=function(J){return arguments.length?(ie=+J,ge):ie},ge.interpolate=function(J){return arguments.length?(Ce=J,ge):Ce},ge.on=function(){var J=we.on.apply(we,arguments);return J===we?ge:J},ge.clickDistance=function(J){return arguments.length?(ae=(J=+J)*J,ge):Math.sqrt(ae)},ge.tapDistance=function(J){return arguments.length?(ve=+J,ge):ve},ge}().scaleExtent([_,g]).translateExtent(p),N=eo(I.current).call($),H=gr.translate(f.x,f.y).scale(is(f.zoom,_,g)),G=[[0,0],[C.width,C.height]],Z=$.constrain()(H,G,p);$.transform(N,Z),$.wheelDelta(Cw),S.setState({d3Zoom:$,d3Selection:N,d3ZoomHandler:N.on("wheel.zoom"),transform:[Z.x,Z.y,Z.k],domNode:I.current.closest(".react-flow")})}},[]),A.useEffect(()=>{L&&M&&(!i||z||O?B!==void 0&&L.on("wheel.zoom",function(C,$){if(!b&&C.type==="wheel"&&!C.ctrlKey||us(C,y))return null;C.preventDefault(),B.call(this,C,$)},{passive:!1}):L.on("wheel.zoom",C=>{if(us(C,y))return!1;C.preventDefault(),C.stopImmediatePropagation();const $=L.property("__zoom").k||1;if(C.ctrlKey&&s){const oe=io(C),Y=Cw(C),Q=$*Math.pow(2,Y);return void M.scaleTo(L,Q,oe,C)}const N=C.deltaMode===1?20:1;let H=l===Qo.Vertical?0:C.deltaX*N,G=l===Qo.Horizontal?0:C.deltaY*N;!Tl()&&C.shiftKey&&l!==Qo.Vertical&&(H=C.deltaY*N,G=0),M.translateBy(L,-H/$*a,-G/$*a,{internal:!0});const Z=Fl(L.property("__zoom")),{onViewportChangeStart:q,onViewportChange:re,onViewportChangeEnd:ne}=S.getState();clearTimeout(P.current),V.current||(V.current=!0,e==null||e(C,Z),q==null||q(Z)),V.current&&(t==null||t(C,Z),re==null||re(Z),P.current=setTimeout(()=>{n==null||n(C,Z),ne==null||ne(Z),V.current=!1},150))},{passive:!1}))},[O,i,l,L,M,B,z,s,b,y,e,t,n]),A.useEffect(()=>{M&&M.on("start",C=>{var H,G;if(!C.sourceEvent||C.sourceEvent.internal)return null;F.current=(H=C.sourceEvent)==null?void 0:H.button;const{onViewportChangeStart:$}=S.getState(),N=Fl(C.transform);E.current=!0,T.current=N,((G=C.sourceEvent)==null?void 0:G.type)==="mousedown"&&S.setState({paneDragging:!0}),$==null||$(N),e==null||e(C.sourceEvent,N)})},[M,e]),A.useEffect(()=>{M&&(O&&!E.current?M.on("zoom",null):O||M.on("zoom",C=>{var N;const{onViewportChange:$}=S.getState();if(S.setState({transform:[C.transform.x,C.transform.y,C.transform.k]}),j.current=!(!o||!Sw(u,F.current??0)),(t||$)&&!((N=C.sourceEvent)!=null&&N.internal)){const H=Fl(C.transform);$==null||$(H),t==null||t(C.sourceEvent,H)}}))},[O,M,t,u,o]),A.useEffect(()=>{M&&M.on("end",C=>{if(!C.sourceEvent||C.sourceEvent.internal)return null;const{onViewportChangeEnd:$}=S.getState();if(E.current=!1,S.setState({paneDragging:!1}),o&&Sw(u,F.current??0)&&!j.current&&o(C.sourceEvent),j.current=!1,(n||$)&&(N=T.current,H=C.transform,N.x!==H.x||N.y!==H.y||N.zoom!==H.k)){const G=Fl(C.transform);T.current=G,clearTimeout(k.current),k.current=setTimeout(()=>{$==null||$(G),n==null||n(C.sourceEvent,G)},i?150:0)}var N,H})},[M,i,u,n,o]),A.useEffect(()=>{M&&M.filter(C=>{const $=z||r,N=s&&C.ctrlKey;if((u===!0||Array.isArray(u)&&u.includes(1))&&C.button===1&&C.type==="mousedown"&&(us(C,"react-flow__node")||us(C,"react-flow__edge")))return!0;if(!(u||$||i||c||s)||O||!c&&C.type==="dblclick"||us(C,y)&&C.type==="wheel"||us(C,v)&&(C.type!=="wheel"||i&&C.type==="wheel"&&!z)||!s&&C.ctrlKey&&C.type==="wheel"||!$&&!i&&!N&&C.type==="wheel"||!u&&(C.type==="mousedown"||C.type==="touchstart")||Array.isArray(u)&&!u.includes(C.button)&&C.type==="mousedown")return!1;const H=Array.isArray(u)&&u.includes(C.button)||!C.button||C.button<=1;return(!C.ctrlKey||C.type==="wheel")&&H})},[O,M,r,s,i,c,u,d,z]),K.createElement("div",{className:"react-flow__renderer",ref:I,style:ch},x)},XO=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function ZO(){const{userSelectionActive:t,userSelectionRect:e}=pt(XO,nn);return t&&e?K.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}function Nw(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 jw(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&&Nw(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&&Nw(o,i);break;case"remove":return o}return o.push(i),o},n)}function Ew(t,e){return jw(t,e)}const nr=(t,e)=>({id:t,type:"select",selected:e});function hs(t,e){return t.reduce((n,o)=>{const r=e.includes(o.id);return!o.selected&&r?(o.selected=!0,n.push(nr(o.id,!0))):o.selected&&!r&&(o.selected=!1,n.push(nr(o.id,!1))),n},[])}const dh=(t,e)=>n=>{n.target===e.current&&(t==null||t(n))},QO=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,dragging:t.paneDragging}),Iw=A.memo(({isSelecting:t,selectionMode:e=Li.Full,panOnDrag:n,onSelectionStart:o,onSelectionEnd:r,onPaneClick:s,onPaneContextMenu:i,onPaneScroll:a,onPaneMouseEnter:l,onPaneMouseMove:c,onPaneMouseLeave:d,children:u})=>{const f=A.useRef(null),p=Wt(),_=A.useRef(0),g=A.useRef(0),m=A.useRef(),{userSelectionActive:b,elementsSelectable:x,dragging:y}=pt(QO,nn),v=()=>{p.setState({userSelectionActive:!1,userSelectionRect:null}),_.current=0,g.current=0},k=j=>{s==null||s(j),p.getState().resetSelectedElements(),p.setState({nodesSelectionActive:!1})},S=a?j=>a(j):void 0,E=x&&(t||b);return K.createElement("div",{className:un(["react-flow__pane",{dragging:y,selection:t}]),onClick:E?void 0:dh(k,f),onContextMenu:dh(j=>{Array.isArray(n)&&(n!=null&&n.includes(2))?j.preventDefault():i==null||i(j)},f),onWheel:dh(S,f),onMouseEnter:E?void 0:l,onMouseDown:E?j=>{const{resetSelectedElements:I,domNode:T}=p.getState();if(m.current=T==null?void 0:T.getBoundingClientRect(),!x||!t||j.button!==0||j.target!==f.current||!m.current)return;const{x:M,y:L}=Zo(j,m.current);I(),p.setState({userSelectionRect:{width:0,height:0,startX:M,startY:L,x:M,y:L}}),o==null||o(j)}:void 0,onMouseMove:E?j=>{const{userSelectionRect:I,nodeInternals:T,edges:M,transform:L,onNodesChange:B,onEdgesChange:O,nodeOrigin:z,getNodes:F}=p.getState();if(!t||!m.current||!I)return;p.setState({userSelectionActive:!0,nodesSelectionActive:!1});const V=Zo(j,m.current),P=I.startX??0,C=I.startY??0,$={...I,x:V.x<P?V.x:P,y:V.y<C?V.y:C,width:Math.abs(V.x-P),height:Math.abs(V.y-C)},N=F(),H=tw(T,$,L,e===Li.Partial,!0,z),G=nw(H,M).map(q=>q.id),Z=H.map(q=>q.id);if(_.current!==Z.length){_.current=Z.length;const q=hs(N,Z);q.length&&(B==null||B(q))}if(g.current!==G.length){g.current=G.length;const q=hs(M,G);q.length&&(O==null||O(q))}p.setState({userSelectionRect:$})}:c,onMouseUp:E?j=>{if(j.button!==0)return;const{userSelectionRect:I}=p.getState();!b&&I&&j.target===f.current&&(k==null||k(j)),p.setState({nodesSelectionActive:_.current>0}),v(),r==null||r(j)}:void 0,onMouseLeave:E?j=>{b&&(p.setState({nodesSelectionActive:_.current>0}),r==null||r(j)),v()}:d,ref:f,style:ch},u,K.createElement(ZO,null))});function Aw(t,e){const n=t.parentNode||t.parentId;if(!n)return!1;const o=e.get(n);return!!o&&(!!o.selected||Aw(o,e))}function Tw(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 e9(t,e,n,o){return Array.from(t.values()).filter(r=>(r.selected||r.id===o)&&(!r.parentNode||r.parentId||!Aw(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 Mw(t,e,n,o,r=[0,0],s){const i=function(u,f){return f&&f!=="parent"?[f[0],[f[1][0]-(u.width||0),f[1][1]-(u.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 u=n.get(l),{x:f,y:p}=ls(u,r).positionAbsolute;a=[[t.extent[0][0]+f,t.extent[0][1]+p],[t.extent[1][0]+f,t.extent[1][1]+p]]}}else if(l&&t.width&&t.height){const u=n.get(l),{x:f,y:p}=ls(u,r).positionAbsolute;a=u&&Rn(f)&&Rn(p)&&Rn(u.width)&&Rn(u.height)?[[f+t.width*r[0],p+t.height*r[1]],[f+u.width-t.width+t.width*r[0],p+u.height-t.height+t.height*r[1]]]:a}else s==null||s("005",yO()),a=i;let c={x:0,y:0};if(l){const u=n.get(l);c=ls(u,r).positionAbsolute}const d=a&&a!=="parent"?Wu(e,a):e;return{position:{x:d.x-c.x,y:d.y-c.y},positionAbsolute:d}}function uh({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]}Iw.displayName="Pane";const Ow=(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,...Hu(c)}})};function Ui(t,e,n){return n===void 0?n:o=>{const r=e().nodeInternals.get(t);r&&n(o,{...r})}}function hh({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",SO(t))}function fh(t){return(e,n,o)=>t==null?void 0:t(e,o)}function Dw({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:s,selectNodesOnDrag:i}){const a=Wt(),[l,c]=A.useState(!1),d=A.useRef([]),u=A.useRef({x:null,y:null}),f=A.useRef(0),p=A.useRef(null),_=A.useRef({x:0,y:0}),g=A.useRef(null),m=A.useRef(!1),b=A.useRef(!1),x=A.useRef(!1),y=function(){const v=Wt();return A.useCallback(({sourceEvent:S})=>{const{transform:E,snapGrid:j,snapToGrid:I}=v.getState(),T=S.touches?S.touches[0].clientX:S.clientX,M=S.touches?S.touches[0].clientY:S.clientY,L={x:(T-E[0])/E[2],y:(M-E[1])/E[2]};return{xSnapped:I?j[0]*Math.round(L.x/j[0]):L.x,ySnapped:I?j[1]*Math.round(L.y/j[1]):L.y,...L}},[])}();return A.useEffect(()=>{if(t!=null&&t.current){const v=eo(t.current),k=({x:j,y:I})=>{const{nodeInternals:T,onNodeDrag:M,onSelectionDrag:L,updateNodePositions:B,nodeExtent:O,snapGrid:z,snapToGrid:F,nodeOrigin:V,onError:P}=a.getState();u.current={x:j,y:I};let C=!1,$={x:0,y:0,x2:0,y2:0};if(d.current.length>1&&O){const H=oh(d.current,V);$=qu(H)}if(d.current=d.current.map(H=>{const G={x:j-H.distance.x,y:I-H.distance.y};F&&(G.x=z[0]*Math.round(G.x/z[0]),G.y=z[1]*Math.round(G.y/z[1]));const Z=[[O[0][0],O[0][1]],[O[1][0],O[1][1]]];d.current.length>1&&O&&!H.extent&&(Z[0][0]=H.positionAbsolute.x-$.x+O[0][0],Z[1][0]=H.positionAbsolute.x+(H.width??0)-$.x2+O[1][0],Z[0][1]=H.positionAbsolute.y-$.y+O[0][1],Z[1][1]=H.positionAbsolute.y+(H.height??0)-$.y2+O[1][1]);const q=Mw(H,G,T,Z,V,P);return C=C||H.position.x!==q.position.x||H.position.y!==q.position.y,H.position=q.position,H.positionAbsolute=q.positionAbsolute,H}),!C)return;B(d.current,!0,!0),c(!0);const N=r?M:fh(L);if(N&&g.current){const[H,G]=uh({nodeId:r,dragItems:d.current,nodeInternals:T});N(g.current,H,G)}},S=()=>{if(!p.current)return;const[j,I]=Fx(_.current,p.current);if(j!==0||I!==0){const{transform:T,panBy:M}=a.getState();u.current.x=(u.current.x??0)-j/T[2],u.current.y=(u.current.y??0)-I/T[2],M({x:j,y:I})&&k(u.current)}f.current=requestAnimationFrame(S)},E=j=>{var V;const{nodeInternals:I,multiSelectionActive:T,nodesDraggable:M,unselectNodesAndEdges:L,onNodeDragStart:B,onSelectionDragStart:O}=a.getState();b.current=!0;const z=r?B:fh(O);i&&s||T||!r||(V=I.get(r))!=null&&V.selected||L(),r&&s&&i&&hh({id:r,store:a,nodeRef:t});const F=y(j);if(u.current=F,d.current=e9(I,M,F,r),z&&d.current){const[P,C]=uh({nodeId:r,dragItems:d.current,nodeInternals:I});z(j.sourceEvent,P,C)}};if(!e){const j=function(){var I,T,M,L,B=iO,O=aO,z=lO,F=cO,V={},P=SS("start","drag","end"),C=0,$=0;function N(Y){Y.on("mousedown.drag",H).filter(F).on("touchstart.drag",q).on("touchmove.drag",re,sO).on("touchend.drag touchcancel.drag",ne).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function H(Y,Q){if(!L&&B.call(this,Y,Q)){var ce=oe(this,O.call(this,Y,Q),Y,Q,"mouse");ce&&(eo(Y.view).on("mousemove.drag",G,Oi).on("mouseup.drag",Z,Oi),Ox(Y.view),Uu(Y),M=!1,I=Y.clientX,T=Y.clientY,ce("start",Y))}}function G(Y){if(ss(Y),!M){var Q=Y.clientX-I,ce=Y.clientY-T;M=Q*Q+ce*ce>$}V.mouse("drag",Y)}function Z(Y){eo(Y.view).on("mousemove.drag mouseup.drag",null),Dx(Y.view,M),ss(Y),V.mouse("end",Y)}function q(Y,Q){if(B.call(this,Y,Q)){var ce,he,de=Y.changedTouches,me=O.call(this,Y,Q),ie=de.length;for(ce=0;ce<ie;++ce)(he=oe(this,me,Y,Q,de[ce].identifier,de[ce]))&&(Uu(Y),he("start",Y,de[ce]))}}function re(Y){var Q,ce,he=Y.changedTouches,de=he.length;for(Q=0;Q<de;++Q)(ce=V[he[Q].identifier])&&(ss(Y),ce("drag",Y,he[Q]))}function ne(Y){var Q,ce,he=Y.changedTouches,de=he.length;for(L&&clearTimeout(L),L=setTimeout(function(){L=null},500),Q=0;Q<de;++Q)(ce=V[he[Q].identifier])&&(Uu(Y),ce("end",Y,he[Q]))}function oe(Y,Q,ce,he,de,me){var ie,Ce,we,ae=P.copy(),ve=io(me||ce,Q);if((we=z.call(Y,new Vu("beforestart",{sourceEvent:ce,target:N,identifier:de,active:C,x:ve[0],y:ve[1],dx:0,dy:0,dispatch:ae}),he))!=null)return ie=we.x-ve[0]||0,Ce=we.y-ve[1]||0,function ge(be,Te,ze){var Xe,Fe=ve;switch(be){case"start":V[de]=ge,Xe=C++;break;case"end":delete V[de],--C;case"drag":ve=io(ze||Te,Q),Xe=C}ae.call(be,Y,new Vu(be,{sourceEvent:Te,subject:we,target:N,identifier:de,active:Xe,x:ve[0]+ie,y:ve[1]+Ce,dx:ve[0]-Fe[0],dy:ve[1]-Fe[1],dispatch:ae}),he)}}return N.filter=function(Y){return arguments.length?(B=typeof Y=="function"?Y:jl(!!Y),N):B},N.container=function(Y){return arguments.length?(O=typeof Y=="function"?Y:jl(Y),N):O},N.subject=function(Y){return arguments.length?(z=typeof Y=="function"?Y:jl(Y),N):z},N.touchable=function(Y){return arguments.length?(F=typeof Y=="function"?Y:jl(!!Y),N):F},N.on=function(){var Y=P.on.apply(P,arguments);return Y===P?N:Y},N.clickDistance=function(Y){return arguments.length?($=(Y=+Y)*Y,N):Math.sqrt($)},N}().on("start",I=>{const{domNode:T,nodeDragThreshold:M}=a.getState();M===0&&E(I),x.current=!1;const L=y(I);u.current=L,p.current=(T==null?void 0:T.getBoundingClientRect())||null,_.current=Zo(I.sourceEvent,p.current)}).on("drag",I=>{var B,O;const T=y(I),{autoPanOnNodeDrag:M,nodeDragThreshold:L}=a.getState();if(I.sourceEvent.type==="touchmove"&&I.sourceEvent.touches.length>1&&(x.current=!0),!x.current){if(!m.current&&b.current&&M&&(m.current=!0,S()),!b.current){const z=T.xSnapped-(((B=u==null?void 0:u.current)==null?void 0:B.x)??0),F=T.ySnapped-(((O=u==null?void 0:u.current)==null?void 0:O.y)??0);Math.sqrt(z*z+F*F)>L&&E(I)}(u.current.x!==T.xSnapped||u.current.y!==T.ySnapped)&&d.current&&b.current&&(g.current=I.sourceEvent,_.current=Zo(I.sourceEvent,p.current),k(T))}}).on("end",I=>{if(b.current&&!x.current&&(c(!1),m.current=!1,b.current=!1,cancelAnimationFrame(f.current),d.current)){const{updateNodePositions:T,nodeInternals:M,onNodeDragStop:L,onSelectionDragStop:B}=a.getState(),O=r?L:fh(B);if(T(d.current,!1,!1),O){const[z,F]=uh({nodeId:r,dragItems:d.current,nodeInternals:M});O(I.sourceEvent,z,F)}}}).filter(I=>{const T=I.target;return!I.button&&(!n||!Tw(T,`.${n}`,t))&&(!o||Tw(T,o,t))});return v.call(j),()=>{v.on(".drag",null)}}v.on(".drag",null)}},[t,e,n,o,s,a,r,i,y]),l}function Rw(){const t=Wt();return A.useCallback(n=>{const{nodeInternals:o,nodeExtent:r,updateNodePositions:s,getNodes:i,snapToGrid:a,snapGrid:l,onError:c,nodesDraggable:d}=t.getState(),u=i().filter(x=>x.selected&&(x.draggable||d&&x.draggable===void 0)),f=a?l[0]:5,p=a?l[1]:5,_=n.isShiftPressed?4:1,g=n.x*f*_,m=n.y*p*_,b=u.map(x=>{if(x.positionAbsolute){const y={x:x.positionAbsolute.x+g,y:x.positionAbsolute.y+m};a&&(y.x=l[0]*Math.round(y.x/l[0]),y.y=l[1]*Math.round(y.y/l[1]));const{positionAbsolute:v,position:k}=Mw(x,y,o,r,void 0,c);x.position=k,x.positionAbsolute=v}return x});s(b,!0,!1)},[])}const fs={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Vi=t=>{const e=({id:n,type:o,data:r,xPos:s,yPos:i,xPosOrigin:a,yPosOrigin:l,selected:c,onClick:d,onMouseEnter:u,onMouseMove:f,onMouseLeave:p,onContextMenu:_,onDoubleClick:g,style:m,className:b,isDraggable:x,isSelectable:y,isConnectable:v,isFocusable:k,selectNodesOnDrag:S,sourcePosition:E,targetPosition:j,hidden:I,resizeObserver:T,dragHandle:M,zIndex:L,isParent:B,noDragClassName:O,noPanClassName:z,initialized:F,disableKeyboardA11y:V,ariaLabel:P,rfId:C,hasHandleBounds:$})=>{const N=Wt(),H=A.useRef(null),G=A.useRef(null),Z=A.useRef(E),q=A.useRef(j),re=A.useRef(o),ne=y||x||d||u||f||p,oe=Rw(),Y=Ui(n,N.getState,u),Q=Ui(n,N.getState,f),ce=Ui(n,N.getState,p),he=Ui(n,N.getState,_),de=Ui(n,N.getState,g);A.useEffect(()=>()=>{G.current&&(T==null||T.unobserve(G.current),G.current=null)},[]),A.useEffect(()=>{if(H.current&&!I){const ie=H.current;F&&$&&G.current===ie||(G.current&&(T==null||T.unobserve(G.current)),T==null||T.observe(ie),G.current=ie)}},[I,F,$]),A.useEffect(()=>{const ie=re.current!==o,Ce=Z.current!==E,we=q.current!==j;H.current&&(ie||Ce||we)&&(ie&&(re.current=o),Ce&&(Z.current=E),we&&(q.current=j),N.getState().updateNodeDimensions([{id:n,nodeElement:H.current,forceUpdate:!0}]))},[n,o,E,j]);const me=Dw({nodeRef:H,disabled:I||!x,noDragClassName:O,handleSelector:M,nodeId:n,isSelectable:y,selectNodesOnDrag:S});return I?null:K.createElement("div",{className:un(["react-flow__node",`react-flow__node-${o}`,{[z]:x},b,{selected:c,selectable:y,parent:B,dragging:me}]),ref:H,style:{zIndex:L,transform:`translate(${a}px,${l}px)`,pointerEvents:ne?"all":"none",visibility:F?"visible":"hidden",...m},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:Y,onMouseMove:Q,onMouseLeave:ce,onContextMenu:he,onClick:ie=>{const{nodeDragThreshold:Ce}=N.getState();if(y&&(!S||!x||Ce>0)&&hh({id:n,store:N,nodeRef:H}),d){const we=N.getState().nodeInternals.get(n);we&&d(ie,{...we})}},onDoubleClick:de,onKeyDown:k?ie=>{if(!Yu(ie)&&!V)if(Ux.includes(ie.key)&&y){const Ce=ie.key==="Escape";hh({id:n,store:N,unselect:Ce,nodeRef:H})}else x&&c&&Object.prototype.hasOwnProperty.call(fs,ie.key)&&(N.setState({ariaLiveMessage:`Moved selected node ${ie.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~s}, y: ${~~i}`}),oe({x:fs[ie.key].x,y:fs[ie.key].y,isShiftPressed:ie.shiftKey}))}:void 0,tabIndex:k?0:void 0,role:k?"button":void 0,"aria-describedby":V?void 0:`${_w}-${C}`,"aria-label":P},K.createElement(IO,{value:n},K.createElement(t,{id:n,data:r,type:o,xPos:s,yPos:i,selected:c,isConnectable:v,sourcePosition:E,targetPosition:j,dragging:me,dragHandle:M,zIndex:L})))};return e.displayName="NodeWrapper",A.memo(e)};const t9=t=>{const e=t.getNodes().filter(n=>n.selected);return{...oh(e,t.nodeOrigin),transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`,userSelectionActive:t.userSelectionActive}};var n9=A.memo(function({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const o=Wt(),{width:r,height:s,x:i,y:a,transformString:l,userSelectionActive:c}=pt(t9,nn),d=Rw(),u=A.useRef(null);if(A.useEffect(()=>{var p;n||((p=u.current)==null||p.focus({preventScroll:!0}))},[n]),Dw({nodeRef:u}),c||!r||!s)return null;const f=t?p=>{const _=o.getState().getNodes().filter(g=>g.selected);t(p,_)}:void 0;return K.createElement("div",{className:un(["react-flow__nodesselection","react-flow__container",e]),style:{transform:l}},K.createElement("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:p=>{Object.prototype.hasOwnProperty.call(fs,p.key)&&d({x:fs[p.key].x,y:fs[p.key].y,isShiftPressed:p.shiftKey})},style:{width:r,height:s,top:a,left:i}}))});const o9=t=>t.nodesSelectionActive,Pw=({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:i,deleteKeyCode:a,onMove:l,onMoveStart:c,onMoveEnd:d,selectionKeyCode:u,selectionOnDrag:f,selectionMode:p,onSelectionStart:_,onSelectionEnd:g,multiSelectionKeyCode:m,panActivationKeyCode:b,zoomActivationKeyCode:x,elementsSelectable:y,zoomOnScroll:v,zoomOnPinch:k,panOnScroll:S,panOnScrollSpeed:E,panOnScrollMode:j,zoomOnDoubleClick:I,panOnDrag:T,defaultViewport:M,translateExtent:L,minZoom:B,maxZoom:O,preventScrolling:z,onSelectionContextMenu:F,noWheelClassName:V,noPanClassName:P,disableKeyboardA11y:C})=>{const $=pt(o9),N=zi(u),H=zi(b),G=H||T,Z=H||S,q=N||f&&G!==!0;return(({deleteKeyCode:re,multiSelectionKeyCode:ne})=>{const oe=Wt(),{deleteElements:Y}=Bi(),Q=zi(re,YO),ce=zi(ne);A.useEffect(()=>{if(Q){const{edges:he,getNodes:de}=oe.getState(),me=de().filter(Ce=>Ce.selected),ie=he.filter(Ce=>Ce.selected);Y({nodes:me,edges:ie}),oe.setState({nodesSelectionActive:!1})}},[Q]),A.useEffect(()=>{oe.setState({multiSelectionActive:ce})},[ce])})({deleteKeyCode:a,multiSelectionKeyCode:m}),K.createElement(KO,{onMove:l,onMoveStart:c,onMoveEnd:d,onPaneContextMenu:s,elementsSelectable:y,zoomOnScroll:v,zoomOnPinch:k,panOnScroll:Z,panOnScrollSpeed:E,panOnScrollMode:j,zoomOnDoubleClick:I,panOnDrag:!N&&G,defaultViewport:M,translateExtent:L,minZoom:B,maxZoom:O,zoomActivationKeyCode:x,preventScrolling:z,noWheelClassName:V,noPanClassName:P},K.createElement(Iw,{onSelectionStart:_,onSelectionEnd:g,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:i,panOnDrag:G,isSelecting:!!q,selectionMode:p},t,$&&K.createElement(n9,{onSelectionContextMenu:F,noPanClassName:P,disableKeyboardA11y:C})))};Pw.displayName="FlowRenderer";var r9=A.memo(Pw);function s9(t){return{input:Vi(t.input||hw),default:Vi(t.default||ih),output:Vi(t.output||pw),group:Vi(t.group||ah),...Object.keys(t).filter(e=>!["input","default","output","group"].includes(e)).reduce((e,n)=>(e[n]=Vi(t[n]||ih),e),{})}}const i9=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,updateNodeDimensions:t.updateNodeDimensions,onError:t.onError}),Lw=t=>{const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,updateNodeDimensions:s,onError:i}=pt(i9,nn),a=(l=t.onlyRenderVisibleElements,pt(A.useCallback(u=>l?tw(u.nodeInternals,{x:0,y:0,width:u.width,height:u.height},u.transform,!0):u.getNodes(),[l])));var l;const c=A.useRef(),d=A.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const u=new ResizeObserver(f=>{const p=f.map(_=>({id:_.target.getAttribute("data-id"),nodeElement:_.target,forceUpdate:!0}));s(p)});return c.current=u,u},[]);return A.useEffect(()=>()=>{var u;(u=c==null?void 0:c.current)==null||u.disconnect()},[]),K.createElement("div",{className:"react-flow__nodes",style:ch},a.map(u=>{var S,E,j;let f=u.type||"default";t.nodeTypes[f]||(i==null||i("003",_O(f)),f="default");const p=t.nodeTypes[f]||t.nodeTypes.default,_=!!(u.draggable||e&&u.draggable===void 0),g=!!(u.selectable||r&&u.selectable===void 0),m=!!(u.connectable||n&&u.connectable===void 0),b=!!(u.focusable||o&&u.focusable===void 0),x=t.nodeExtent?Wu(u.positionAbsolute,t.nodeExtent):u.positionAbsolute,y=(x==null?void 0:x.x)??0,v=(x==null?void 0:x.y)??0,k=(({x:I,y:T,width:M,height:L,origin:B})=>M&&L?B[0]<0||B[1]<0||B[0]>1||B[1]>1?{x:I,y:T}:{x:I-M*B[0],y:T-L*B[1]}:{x:I,y:T})({x:y,y:v,width:u.width??0,height:u.height??0,origin:t.nodeOrigin});return K.createElement(p,{key:u.id,id:u.id,className:u.className,style:u.style,type:f,data:u.data,sourcePosition:u.sourcePosition||$e.Bottom,targetPosition:u.targetPosition||$e.Top,hidden:u.hidden,xPos:y,yPos:v,xPosOrigin:k.x,yPosOrigin:k.y,selectNodesOnDrag:t.selectNodesOnDrag,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,selected:!!u.selected,isDraggable:_,isSelectable:g,isConnectable:m,isFocusable:b,resizeObserver:d,dragHandle:u.dragHandle,zIndex:((S=u[Nt])==null?void 0:S.z)??0,isParent:!!((E=u[Nt])!=null&&E.isParent),noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,initialized:!!u.width&&!!u.height,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,ariaLabel:u.ariaLabel,hasHandleBounds:!!((j=u[Nt])!=null&&j.handleBounds)})}))};Lw.displayName="NodeRenderer";var a9=A.memo(Lw);const l9=(t,e,n)=>n===$e.Left?t-e:n===$e.Right?t+e:t,c9=(t,e,n)=>n===$e.Top?t-e:n===$e.Bottom?t+e:t,Fw="react-flow__edgeupdater",zw=({position:t,centerX:e,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:s,onMouseOut:i,type:a})=>K.createElement("circle",{onMouseDown:r,onMouseEnter:s,onMouseOut:i,className:un([Fw,`${Fw}-${a}`]),cx:l9(e,o,t),cy:c9(n,o,t),r:o,stroke:"transparent",fill:"transparent"}),d9=()=>!0;var ps=t=>{const e=({id:n,className:o,type:r,data:s,onClick:i,onEdgeDoubleClick:a,selected:l,animated:c,label:d,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:_,labelBgBorderRadius:g,style:m,source:b,target:x,sourceX:y,sourceY:v,targetX:k,targetY:S,sourcePosition:E,targetPosition:j,elementsSelectable:I,hidden:T,sourceHandleId:M,targetHandleId:L,onContextMenu:B,onMouseEnter:O,onMouseMove:z,onMouseLeave:F,reconnectRadius:V,onReconnect:P,onReconnectStart:C,onReconnectEnd:$,markerEnd:N,markerStart:H,rfId:G,ariaLabel:Z,isFocusable:q,isReconnectable:re,pathOptions:ne,interactionWidth:oe,disableKeyboardA11y:Y})=>{const Q=A.useRef(null),[ce,he]=A.useState(!1),[de,me]=A.useState(!1),ie=Wt(),Ce=A.useMemo(()=>`url('#${th(H,G)}')`,[H,G]),we=A.useMemo(()=>`url('#${th(N,G)}')`,[N,G]);if(T)return null;const ae=Pi(n,ie.getState,a),ve=Pi(n,ie.getState,B),ge=Pi(n,ie.getState,O),be=Pi(n,ie.getState,z),Te=Pi(n,ie.getState,F),ze=(nt,it)=>{if(nt.button!==0)return;const{edges:te,isValidConnection:Ne}=ie.getState(),Me=it?x:b,Be=(it?L:M)||null,J=it?"target":"source",pe=Ne||d9,_e=it,ue=te.find(je=>je.id===n);me(!0),C==null||C(nt,ue,J),aw({event:nt,handleId:Be,nodeId:Me,onConnect:je=>P==null?void 0:P(ue,je),isTarget:_e,getState:ie.getState,setState:ie.setState,isValidConnection:pe,edgeUpdaterType:J,onReconnectEnd:je=>{me(!1),$==null||$(je,ue,J)}})},Xe=()=>he(!0),Fe=()=>he(!1),et=!I&&!i;return K.createElement("g",{className:un(["react-flow__edge",`react-flow__edge-${r}`,o,{selected:l,animated:c,inactive:et,updating:ce}]),onClick:nt=>{var J;const{edges:it,addSelectedEdges:te,unselectNodesAndEdges:Ne,multiSelectionActive:Me}=ie.getState(),Be=it.find(pe=>pe.id===n);Be&&(I&&(ie.setState({nodesSelectionActive:!1}),Be.selected&&Me?(Ne({nodes:[],edges:[Be]}),(J=Q.current)==null||J.blur()):te([n])),i&&i(nt,Be))},onDoubleClick:ae,onContextMenu:ve,onMouseEnter:ge,onMouseMove:be,onMouseLeave:Te,onKeyDown:q?nt=>{var it;if(!Y&&Ux.includes(nt.key)&&I){const{unselectNodesAndEdges:te,addSelectedEdges:Ne,edges:Me}=ie.getState();nt.key==="Escape"?((it=Q.current)==null||it.blur(),te({edges:[Me.find(Be=>Be.id===n)]})):Ne([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 ${x}`,"aria-describedby":q?`${bw}-${G}`:void 0,ref:Q},!de&&K.createElement(t,{id:n,source:b,target:x,selected:l,animated:c,label:d,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:_,labelBgBorderRadius:g,data:s,style:m,sourceX:y,sourceY:v,targetX:k,targetY:S,sourcePosition:E,targetPosition:j,sourceHandleId:M,targetHandleId:L,markerStart:Ce,markerEnd:we,pathOptions:ne,interactionWidth:oe}),re&&K.createElement(K.Fragment,null,(re==="source"||re===!0)&&K.createElement(zw,{position:E,centerX:y,centerY:v,radius:V,onMouseDown:nt=>ze(nt,!0),onMouseEnter:Xe,onMouseOut:Fe,type:"source"}),(re==="target"||re===!0)&&K.createElement(zw,{position:j,centerX:k,centerY:S,radius:V,onMouseDown:nt=>ze(nt,!1),onMouseEnter:Xe,onMouseOut:Fe,type:"target"})))};return e.displayName="EdgeWrapper",A.memo(e)};function u9(t){return{default:ps(t.default||Rl),straight:ps(t.bezier||Qu),step:ps(t.step||Zu),smoothstep:ps(t.step||Ol),simplebezier:ps(t.simplebezier||Ku),...Object.keys(t).filter(e=>!["default","bezier"].includes(e)).reduce((e,n)=>(e[n]=ps(t[n]||Rl),e),{})}}function Bw(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 $e.Top:return{x:o+s/2,y:r};case $e.Right:return{x:o+s,y:r+i/2};case $e.Bottom:return{x:o+s/2,y:r+i};case $e.Left:return{x:o,y:r+i/2}}}function Uw(t,e){return t?t.length!==1&&e?e&&t.find(n=>n.id===e)||null:t[0]:null}function Vw(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 h9=[{level:0,isMaxLevel:!0,edges:[]}];function f9(t,e,n){return function(o,r,s=!1){let i=-1;const a=o.reduce((c,d)=>{var p,_;const u=Rn(d.zIndex);let f=u?d.zIndex:0;if(s){const g=r.get(d.target),m=r.get(d.source),b=d.selected||(g==null?void 0:g.selected)||(m==null?void 0:m.selected),x=Math.max(((p=m==null?void 0:m[Nt])==null?void 0:p.z)||0,((_=g==null?void 0:g[Nt])==null?void 0:_.z)||0,1e3);f=(u?d.zIndex:0)+(b?x: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 u=+c;return{edges:d,level:u,isMaxLevel:u===i}});return l.length===0?h9:l}(pt(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:u,targetHeight:f,width:p,height:_,transform:g}){const m={x:Math.min(a.x,l.x),y:Math.min(a.y,l.y),x2:Math.max(a.x+c,l.x+u),y2:Math.max(a.y+d,l.y+f)};m.x===m.x2&&(m.x2+=1),m.y===m.y2&&(m.y2+=1);const b=qu({x:(0-g[0])/g[2],y:(0-g[1])/g[2],width:p/g[2],height:_/g[2]}),x=Math.max(0,Math.min(b.x2,m.x2)-Math.max(b.x,m.x)),y=Math.max(0,Math.min(b.y2,m.y2)-Math.max(b.y,m.y));return Math.ceil(x*y)>0}({sourcePos:s.positionAbsolute||{x:0,y:0},targetPos:i.positionAbsolute||{x:0,y:0},sourceWidth:s.width,sourceHeight:s.height,targetWidth:i.width,targetHeight:i.height,width:o.width,height:o.height,transform:o.transform})}):o.edges,[t,e])),e,n)}const $w={[as.Arrow]:({color:t="none",strokeWidth:e=1})=>K.createElement("polyline",{style:{stroke:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),[as.ArrowClosed]:({color:t="none",strokeWidth:e=1})=>K.createElement("polyline",{style:{stroke:t,fill:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},p9=({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=Wt();return A.useMemo(()=>{var u,f;return Object.prototype.hasOwnProperty.call($w,c)?$w[c]:((f=(u=d.getState()).onError)==null||f.call(u,"009",xO(c)),null)},[c])}(e);return l?K.createElement("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${o}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:a,refX:"0",refY:"0"},K.createElement(l,{color:n,strokeWidth:i})):null},Hw=({defaultColor:t,rfId:e})=>{const n=pt(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=th(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 K.createElement("defs",null,n.map(o=>K.createElement(p9,{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})))};Hw.displayName="MarkerDefinitions";var m9=A.memo(Hw);const g9=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}),Ww=({defaultMarkerColor:t,onlyRenderVisibleElements:e,elevateEdgesOnSelect:n,rfId:o,edgeTypes:r,noPanClassName:s,onEdgeContextMenu:i,onEdgeMouseEnter:a,onEdgeMouseMove:l,onEdgeMouseLeave:c,onEdgeClick:d,onEdgeDoubleClick:u,onReconnect:f,onReconnectStart:p,onReconnectEnd:_,reconnectRadius:g,children:m,disableKeyboardA11y:b})=>{const{edgesFocusable:x,edgesUpdatable:y,elementsSelectable:v,width:k,height:S,connectionMode:E,nodeInternals:j,onError:I}=pt(g9,nn),T=f9(e,j,n);return k?K.createElement(K.Fragment,null,T.map(({level:M,edges:L,isMaxLevel:B})=>K.createElement("svg",{key:M,style:{zIndex:M},width:k,height:S,className:"react-flow__edges react-flow__container"},B&&K.createElement(m9,{defaultColor:t,rfId:o}),K.createElement("g",null,L.map(O=>{const[z,F,V]=Vw(j.get(O.source)),[P,C,$]=Vw(j.get(O.target));if(!V||!$)return null;let N=O.type||"default";r[N]||(I==null||I("011",kO(N)),N="default");const H=r[N]||r.default,G=E===Ir.Strict?C.target:(C.target??[]).concat(C.source??[]),Z=Uw(F.source,O.sourceHandle),q=Uw(G,O.targetHandle),re=(Z==null?void 0:Z.position)||$e.Bottom,ne=(q==null?void 0:q.position)||$e.Top,oe=!!(O.focusable||x&&O.focusable===void 0),Y=O.reconnectable||O.updatable,Q=f!==void 0&&(Y||y&&Y===void 0);if(!Z||!q)return I==null||I("008",wO(Z,O)),null;const{sourceX:ce,sourceY:he,targetX:de,targetY:me}=((ie,Ce,we,ae,ve,ge)=>{const be=Bw(we,ie,Ce),Te=Bw(ge,ae,ve);return{sourceX:be.x,sourceY:be.y,targetX:Te.x,targetY:Te.y}})(z,Z,re,P,q,ne);return K.createElement(H,{key:O.id,id:O.id,className:un([O.className,s]),type:N,data:O.data,selected:!!O.selected,animated:!!O.animated,hidden:!!O.hidden,label:O.label,labelStyle:O.labelStyle,labelShowBg:O.labelShowBg,labelBgStyle:O.labelBgStyle,labelBgPadding:O.labelBgPadding,labelBgBorderRadius:O.labelBgBorderRadius,style:O.style,source:O.source,target:O.target,sourceHandleId:O.sourceHandle,targetHandleId:O.targetHandle,markerEnd:O.markerEnd,markerStart:O.markerStart,sourceX:ce,sourceY:he,targetX:de,targetY:me,sourcePosition:re,targetPosition:ne,elementsSelectable:v,onContextMenu:i,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,onClick:d,onEdgeDoubleClick:u,onReconnect:f,onReconnectStart:p,onReconnectEnd:_,reconnectRadius:g,rfId:o,ariaLabel:O.ariaLabel,isFocusable:oe,isReconnectable:Q,pathOptions:"pathOptions"in O?O.pathOptions:void 0,interactionWidth:O.interactionWidth,disableKeyboardA11y:b})})))),m):null};Ww.displayName="EdgeRenderer";var _9=A.memo(Ww);const b9=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function y9({children:t}){const e=pt(b9);return K.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:e}},t)}const x9={[$e.Left]:$e.Right,[$e.Right]:$e.Left,[$e.Top]:$e.Bottom,[$e.Bottom]:$e.Top},qw=({nodeId:t,handleType:e,style:n,type:o=er.Bezier,CustomComponent:r,connectionStatus:s})=>{var S,E,j;const{fromNode:i,handleId:a,toX:l,toY:c,connectionMode:d}=pt(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]),nn),u=(S=i==null?void 0:i[Nt])==null?void 0:S.handleBounds;let f=u==null?void 0:u[e];if(d===Ir.Loose&&(f=f||(u==null?void 0:u[e==="source"?"target":"source"])),!i||!f)return null;const p=a?f.find(I=>I.id===a):f[0],_=p?p.x+p.width/2:(i.width??0)/2,g=p?p.y+p.height/2:i.height??0,m=(((E=i.positionAbsolute)==null?void 0:E.x)??0)+_,b=(((j=i.positionAbsolute)==null?void 0:j.y)??0)+g,x=p==null?void 0:p.position,y=x?x9[x]:null;if(!x||!y)return null;if(r)return K.createElement(r,{connectionLineType:o,connectionLineStyle:n,fromNode:i,fromHandle:p,fromX:m,fromY:b,toX:l,toY:c,fromPosition:x,toPosition:y,connectionStatus:s});let v="";const k={sourceX:m,sourceY:b,sourcePosition:x,targetX:l,targetY:c,targetPosition:y};return o===er.Bezier?[v]=Qx(k):o===er.Step?[v]=Xu({...k,borderRadius:0}):o===er.SmoothStep?[v]=Xu(k):o===er.SimpleBezier?[v]=Jx(k):v=`M${m},${b} ${l},${c}`,K.createElement("path",{d:v,fill:"none",className:"react-flow__connection-path",style:n})};qw.displayName="ConnectionLine";const w9=t=>({nodeId:t.connectionNodeId,handleType:t.connectionHandleType,nodesConnectable:t.nodesConnectable,connectionStatus:t.connectionStatus,width:t.width,height:t.height});function v9({containerStyle:t,style:e,type:n,component:o}){const{nodeId:r,handleType:s,nodesConnectable:i,width:a,height:l,connectionStatus:c}=pt(w9,nn);return r&&s&&a&&i?K.createElement("svg",{style:t,width:a,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container"},K.createElement("g",{className:un(["react-flow__connection",c])},K.createElement(qw,{nodeId:r,handleType:s,style:e,type:n,CustomComponent:o,connectionStatus:c}))):null}function Gw(t,e){return A.useRef(null),Wt(),A.useMemo(()=>e(t),[t])}const Yw=({nodeTypes:t,edgeTypes:e,onMove:n,onMoveStart:o,onMoveEnd:r,onInit:s,onNodeClick:i,onEdgeClick:a,onNodeDoubleClick:l,onEdgeDoubleClick:c,onNodeMouseEnter:d,onNodeMouseMove:u,onNodeMouseLeave:f,onNodeContextMenu:p,onSelectionContextMenu:_,onSelectionStart:g,onSelectionEnd:m,connectionLineType:b,connectionLineStyle:x,connectionLineComponent:y,connectionLineContainerStyle:v,selectionKeyCode:k,selectionOnDrag:S,selectionMode:E,multiSelectionKeyCode:j,panActivationKeyCode:I,zoomActivationKeyCode:T,deleteKeyCode:M,onlyRenderVisibleElements:L,elementsSelectable:B,selectNodesOnDrag:O,defaultViewport:z,translateExtent:F,minZoom:V,maxZoom:P,preventScrolling:C,defaultMarkerColor:$,zoomOnScroll:N,zoomOnPinch:H,panOnScroll:G,panOnScrollSpeed:Z,panOnScrollMode:q,zoomOnDoubleClick:re,panOnDrag:ne,onPaneClick:oe,onPaneMouseEnter:Y,onPaneMouseMove:Q,onPaneMouseLeave:ce,onPaneScroll:he,onPaneContextMenu:de,onEdgeContextMenu:me,onEdgeMouseEnter:ie,onEdgeMouseMove:Ce,onEdgeMouseLeave:we,onReconnect:ae,onReconnectStart:ve,onReconnectEnd:ge,reconnectRadius:be,noDragClassName:Te,noWheelClassName:ze,noPanClassName:Xe,elevateEdgesOnSelect:Fe,disableKeyboardA11y:et,nodeOrigin:nt,nodeExtent:it,rfId:te})=>{const Ne=Gw(t,s9),Me=Gw(e,u9);return function(Be){const J=Bi(),pe=A.useRef(!1);A.useEffect(()=>{!pe.current&&J.viewportInitialized&&Be&&(setTimeout(()=>Be(J),1),pe.current=!0)},[Be,J.viewportInitialized])}(s),K.createElement(r9,{onPaneClick:oe,onPaneMouseEnter:Y,onPaneMouseMove:Q,onPaneMouseLeave:ce,onPaneContextMenu:de,onPaneScroll:he,deleteKeyCode:M,selectionKeyCode:k,selectionOnDrag:S,selectionMode:E,onSelectionStart:g,onSelectionEnd:m,multiSelectionKeyCode:j,panActivationKeyCode:I,zoomActivationKeyCode:T,elementsSelectable:B,onMove:n,onMoveStart:o,onMoveEnd:r,zoomOnScroll:N,zoomOnPinch:H,zoomOnDoubleClick:re,panOnScroll:G,panOnScrollSpeed:Z,panOnScrollMode:q,panOnDrag:ne,defaultViewport:z,translateExtent:F,minZoom:V,maxZoom:P,onSelectionContextMenu:_,preventScrolling:C,noDragClassName:Te,noWheelClassName:ze,noPanClassName:Xe,disableKeyboardA11y:et},K.createElement(y9,null,K.createElement(_9,{edgeTypes:Me,onEdgeClick:a,onEdgeDoubleClick:c,onlyRenderVisibleElements:L,onEdgeContextMenu:me,onEdgeMouseEnter:ie,onEdgeMouseMove:Ce,onEdgeMouseLeave:we,onReconnect:ae,onReconnectStart:ve,onReconnectEnd:ge,reconnectRadius:be,defaultMarkerColor:$,noPanClassName:Xe,elevateEdgesOnSelect:!!Fe,disableKeyboardA11y:et,rfId:te},K.createElement(v9,{style:x,type:b,component:y,containerStyle:v})),K.createElement("div",{className:"react-flow__edgelabel-renderer"}),K.createElement(a9,{nodeTypes:Ne,onNodeClick:i,onNodeDoubleClick:l,onNodeMouseEnter:d,onNodeMouseMove:u,onNodeMouseLeave:f,onNodeContextMenu:p,selectNodesOnDrag:O,onlyRenderVisibleElements:L,noPanClassName:Xe,noDragClassName:Te,disableKeyboardA11y:et,nodeOrigin:nt,nodeExtent:it,rfId:te})))};Yw.displayName="GraphView";var k9=A.memo(Yw);const ph=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],or={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:ph,nodeExtent:ph,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Ir.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},S9=()=>((t,e)=>t?Mx(t,e):Mx)((t,e)=>({...or,setNodes:n=>{const{nodeInternals:o,nodeOrigin:r,elevateNodesOnSelect:s}=e();t({nodeInternals:lh(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?lh(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 u=window.getComputedStyle(d),{m22:f}=new window.DOMMatrixReadOnly(u.transform),p=n.reduce((g,m)=>{const b=r.get(m.id);if(b!=null&&b.hidden)r.set(b.id,{...b,[Nt]:{...b[Nt],handleBounds:void 0}});else if(b){const x=Hu(m.nodeElement);!(!x.width||!x.height||b.width===x.width&&b.height===x.height&&!m.forceUpdate)&&(r.set(b.id,{...b,[Nt]:{...b[Nt],handleBounds:{source:Ow(".source",m.nodeElement,f,c),target:Ow(".target",m.nodeElement,f,c)}},...x}),g.push({id:b.id,type:"dimensions",dimensions:x}))}return g},[]);vw(r,c);const _=i||s&&!i&&kw(e,{initial:!0,...a});t({nodeInternals:new Map(r),fitViewOnInitDone:_}),(p==null?void 0:p.length)>0&&(o==null||o(p))},updateNodePositions:(n,o=!0,r=!1)=>{const{triggerNodeChanges:s}=e(),i=n.map(a=>{const l={id:a.id,type:"position",dragging:r};return o&&(l.positionAbsolute=a.positionAbsolute,l.position=a.position),l});s(i)},triggerNodeChanges:n=>{const{onNodesChange:o,nodeInternals:r,hasDefaultNodes:s,nodeOrigin:i,getNodes:a,elevateNodesOnSelect:l}=e();if(n!=null&&n.length){if(s){const c=lh(Ew(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=>nr(l,!0)):(i=hs(s(),n),a=hs(r,[])),Ll({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=>nr(l,!0)):(i=hs(r,n),a=hs(s(),[])),Ll({changedNodes:a,changedEdges:i,get:e,set:t})},unselectNodesAndEdges:({nodes:n,edges:o}={})=>{const{edges:r,getNodes:s}=e(),i=o||r;Ll({changedNodes:(n||s()).map(a=>(a.selected=!1,nr(a.id,!1))),changedEdges:i.map(a=>nr(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();Ll({changedNodes:o().filter(r=>r.selected).map(r=>nr(r.id,!1)),changedEdges:n.filter(r=>r.selected).map(r=>nr(r.id,!1)),get:e,set:t})},setNodeExtent:n=>{const{nodeInternals:o}=e();o.forEach(r=>{r.positionAbsolute=Wu(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=gr.translate(o[0]+n.x,o[1]+n.y).scale(o[2]),d=[[0,0],[r,s]],u=i==null?void 0:i.constrain()(c,d,l);return i.transform(a,u),o[0]!==u.x||o[1]!==u.y||o[2]!==u.k},cancelConnection:()=>t({connectionNodeId:or.connectionNodeId,connectionHandleId:or.connectionHandleId,connectionHandleType:or.connectionHandleType,connectionStatus:or.connectionStatus,connectionStartHandle:or.connectionStartHandle,connectionEndHandle:or.connectionEndHandle}),reset:()=>t({...or})}),Object.is),mh=({children:t})=>{const e=A.useRef(null);return e.current||(e.current=S9()),K.createElement(gO,{value:e.current},t)};mh.displayName="ReactFlowProvider";const Jw=({children:t})=>A.useContext(Il)?K.createElement(K.Fragment,null,t):K.createElement(mh,null,t);Jw.displayName="ReactFlowWrapper";const C9={input:hw,default:ih,output:pw,group:ah},N9={default:Rl,straight:Qu,step:Zu,smoothstep:Ol,simplebezier:Ku},j9=[0,0],E9=[15,15],I9={x:0,y:0,zoom:1},A9={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},gh=A.forwardRef(({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:s=C9,edgeTypes:i=N9,onNodeClick:a,onEdgeClick:l,onInit:c,onMove:d,onMoveStart:u,onMoveEnd:f,onConnect:p,onConnectStart:_,onConnectEnd:g,onClickConnectStart:m,onClickConnectEnd:b,onNodeMouseEnter:x,onNodeMouseMove:y,onNodeMouseLeave:v,onNodeContextMenu:k,onNodeDoubleClick:S,onNodeDragStart:E,onNodeDrag:j,onNodeDragStop:I,onNodesDelete:T,onEdgesDelete:M,onSelectionChange:L,onSelectionDragStart:B,onSelectionDrag:O,onSelectionDragStop:z,onSelectionContextMenu:F,onSelectionStart:V,onSelectionEnd:P,connectionMode:C=Ir.Strict,connectionLineType:$=er.Bezier,connectionLineStyle:N,connectionLineComponent:H,connectionLineContainerStyle:G,deleteKeyCode:Z="Backspace",selectionKeyCode:q="Shift",selectionOnDrag:re=!1,selectionMode:ne=Li.Full,panActivationKeyCode:oe="Space",multiSelectionKeyCode:Y=Tl()?"Meta":"Control",zoomActivationKeyCode:Q=Tl()?"Meta":"Control",snapToGrid:ce=!1,snapGrid:he=E9,onlyRenderVisibleElements:de=!1,selectNodesOnDrag:me=!0,nodesDraggable:ie,nodesConnectable:Ce,nodesFocusable:we,nodeOrigin:ae=j9,edgesFocusable:ve,edgesUpdatable:ge,elementsSelectable:be,defaultViewport:Te=I9,minZoom:ze=.5,maxZoom:Xe=2,translateExtent:Fe=ph,preventScrolling:et=!0,nodeExtent:nt,defaultMarkerColor:it="#b1b1b7",zoomOnScroll:te=!0,zoomOnPinch:Ne=!0,panOnScroll:Me=!1,panOnScrollSpeed:Be=.5,panOnScrollMode:J=Qo.Free,zoomOnDoubleClick:pe=!0,panOnDrag:_e=!0,onPaneClick:ue,onPaneMouseEnter:je,onPaneMouseMove:ke,onPaneMouseLeave:Ve,onPaneScroll:Ze,onPaneContextMenu:le,children:Ee,onEdgeContextMenu:Ie,onEdgeDoubleClick:Ue,onEdgeMouseEnter:We,onEdgeMouseMove:De,onEdgeMouseLeave:Ge,onEdgeUpdate:ot,onEdgeUpdateStart:Je,onEdgeUpdateEnd:rt,onReconnect:mt,onReconnectStart:yt,onReconnectEnd:Mt,reconnectRadius:xt=10,edgeUpdaterRadius:Bt=10,onNodesChange:Sn,onEdgesChange:hn,noDragClassName:rn="nodrag",noWheelClassName:Kt="nowheel",noPanClassName:Jn="nopan",fitView:ho=!1,fitViewOptions:vs,connectOnClick:ks=!0,attributionPosition:Ss,proOptions:Cs,defaultEdgeOptions:Ns,elevateNodesOnSelect:ir=!0,elevateEdgesOnSelect:js=!1,disableKeyboardA11y:Es=!1,autoPanOnConnect:Is=!0,autoPanOnNodeDrag:Pt=!0,connectionRadius:wt=20,isValidConnection:Cn,onError:Nn,style:As,id:ec,nodeDragThreshold:Hf,...Wf},tc)=>{const qf=ec||"1";return K.createElement("div",{...Wf,style:{...As,...A9},ref:tc,className:un(["react-flow",r]),"data-testid":"rf__wrapper",id:ec},K.createElement(Jw,null,K.createElement(k9,{onInit:c,onMove:d,onMoveStart:u,onMoveEnd:f,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:x,onNodeMouseMove:y,onNodeMouseLeave:v,onNodeContextMenu:k,onNodeDoubleClick:S,nodeTypes:s,edgeTypes:i,connectionLineType:$,connectionLineStyle:N,connectionLineComponent:H,connectionLineContainerStyle:G,selectionKeyCode:q,selectionOnDrag:re,selectionMode:ne,deleteKeyCode:Z,multiSelectionKeyCode:Y,panActivationKeyCode:oe,zoomActivationKeyCode:Q,onlyRenderVisibleElements:de,selectNodesOnDrag:me,defaultViewport:Te,translateExtent:Fe,minZoom:ze,maxZoom:Xe,preventScrolling:et,zoomOnScroll:te,zoomOnPinch:Ne,zoomOnDoubleClick:pe,panOnScroll:Me,panOnScrollSpeed:Be,panOnScrollMode:J,panOnDrag:_e,onPaneClick:ue,onPaneMouseEnter:je,onPaneMouseMove:ke,onPaneMouseLeave:Ve,onPaneScroll:Ze,onPaneContextMenu:le,onSelectionContextMenu:F,onSelectionStart:V,onSelectionEnd:P,onEdgeContextMenu:Ie,onEdgeDoubleClick:Ue,onEdgeMouseEnter:We,onEdgeMouseMove:De,onEdgeMouseLeave:Ge,onReconnect:mt??ot,onReconnectStart:yt??Je,onReconnectEnd:Mt??rt,reconnectRadius:xt??Bt,defaultMarkerColor:it,noDragClassName:rn,noWheelClassName:Kt,noPanClassName:Jn,elevateEdgesOnSelect:js,rfId:qf,disableKeyboardA11y:Es,nodeOrigin:ae,nodeExtent:nt}),K.createElement(zO,{nodes:t,edges:e,defaultNodes:n,defaultEdges:o,onConnect:p,onConnectStart:_,onConnectEnd:g,onClickConnectStart:m,onClickConnectEnd:b,nodesDraggable:ie,nodesConnectable:Ce,nodesFocusable:we,edgesFocusable:ve,edgesUpdatable:ge,elementsSelectable:be,elevateNodesOnSelect:ir,minZoom:ze,maxZoom:Xe,nodeExtent:nt,onNodesChange:Sn,onEdgesChange:hn,snapToGrid:ce,snapGrid:he,connectionMode:C,translateExtent:Fe,connectOnClick:ks,defaultEdgeOptions:Ns,fitView:ho,fitViewOptions:vs,onNodesDelete:T,onEdgesDelete:M,onNodeDragStart:E,onNodeDrag:j,onNodeDragStop:I,onSelectionDrag:O,onSelectionDragStart:B,onSelectionDragStop:z,noPanClassName:Jn,nodeOrigin:ae,rfId:qf,autoPanOnConnect:Is,autoPanOnNodeDrag:Pt,onError:Nn,connectionRadius:wt,isValidConnection:Cn,nodeDragThreshold:Hf}),K.createElement(LO,{onSelectionChange:L}),Ee,K.createElement(NO,{proOptions:Cs,position:Ss}),K.createElement($O,{rfId:qf,disableKeyboardA11y:Es})))});function Kw(t){return e=>{const[n,o]=A.useState(e),r=A.useCallback(s=>o(i=>t(s,i)),[]);return[n,o,r]}}gh.displayName="ReactFlow";const Xw=Kw(Ew),Zw=Kw(function(t,e){return jw(t,e)});function T9(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},K.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function M9(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},K.createElement("path",{d:"M0 0h32v4.2H0z"}))}function O9(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},K.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function D9(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},K.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function R9(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},K.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const ms=({children:t,className:e,...n})=>K.createElement("button",{type:"button",className:un(["react-flow__controls-button",e]),...n},t);ms.displayName="ControlButton";const P9=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom}),Qw=({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:u="bottom-left"})=>{const f=Wt(),[p,_]=A.useState(!1),{isInteractive:g,minZoomReached:m,maxZoomReached:b}=pt(P9,nn),{zoomIn:x,zoomOut:y,fitView:v}=Bi();return A.useEffect(()=>{_(!0)},[]),p?K.createElement(Al,{className:un(["react-flow__controls",c]),position:u,style:t,"data-testid":"rf__controls"},e&&K.createElement(K.Fragment,null,K.createElement(ms,{onClick:()=>{x(),s==null||s()},className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:b},K.createElement(T9,null)),K.createElement(ms,{onClick:()=>{y(),i==null||i()},className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:m},K.createElement(M9,null))),n&&K.createElement(ms,{className:"react-flow__controls-fitview",onClick:()=>{v(r),a==null||a()},title:"fit view","aria-label":"fit view"},K.createElement(O9,null)),o&&K.createElement(ms,{className:"react-flow__controls-interactive",onClick:()=>{f.setState({nodesDraggable:!g,nodesConnectable:!g,elementsSelectable:!g}),l==null||l(!g)},title:"toggle interactivity","aria-label":"toggle interactivity"},g?K.createElement(R9,null):K.createElement(D9,null)),d):null};Qw.displayName="Controls";var Pn,L9=A.memo(Qw);function F9({color:t,dimensions:e,lineWidth:n}){return K.createElement("path",{stroke:t,strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})}function z9({color:t,radius:e}){return K.createElement("circle",{cx:e,cy:e,r:e,fill:t})}(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(Pn||(Pn={}));const B9={[Pn.Dots]:"#91919a",[Pn.Lines]:"#eee",[Pn.Cross]:"#e2e2e2"},U9={[Pn.Dots]:1,[Pn.Lines]:1,[Pn.Cross]:6},V9=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function ev({id:t,variant:e=Pn.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:u}=pt(V9,nn),f=i||B9[e],p=o||U9[e],_=e===Pn.Dots,g=e===Pn.Cross,m=Array.isArray(n)?n:[n,n],b=[m[0]*d[2]||1,m[1]*d[2]||1],x=p*d[2],y=g?[x,x]:b,v=_?[x/s,x/s]:[y[0]/s,y[1]/s];return K.createElement("svg",{className:un(["react-flow__background",l]),style:{...a,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:c,"data-testid":"rf__background"},K.createElement("pattern",{id:u+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]})`},_?K.createElement(z9,{color:f,radius:x/s}):K.createElement(F9,{dimensions:y,color:f,lineWidth:r})),K.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${u+t})`}))}ev.displayName="Background";var $9=A.memo(ev);function _h(t){return Math.min(11*t+35,200)}const tv=K.createContext("LR"),nv=A.memo(t=>{const e=X.c(51),{data:n,selected:o}=t,r=He(n.atom),s=Fc().inOrderIds.indexOf(r.id),i=o?"var(--gray-9)":"var(--gray-3)",a=pt(H9),l=A.useContext(tv);let c,d,u,f,p;if(e[0]!==r.code||e[1]!==i||e[2]!==l||e[3]!==o){const M=r.code.split(`
125
- `).length,L=l==="LR"?$e.Left:$e.Top;let B;e[8]!==i?(B={background:i},e[8]=i,e[9]=B):B=e[9],e[10]!==L||e[11]!==B?(u=h.jsx(tr,{type:"target",id:"inputs",position:L,style:B}),e[10]=L,e[11]=B,e[12]=u):u=e[12];const O=l==="LR"?$e.Left:$e.Top;let z;e[13]!==i?(z={background:i},e[13]=i,e[14]=z):z=e[14],e[15]!==O||e[16]!==z?(f=h.jsx(tr,{type:"source",id:"inputs",position:O,style:z}),e[15]=O,e[16]=z,e[17]=f):f=e[17];const F=o&&"border-primary";e[18]!==F?(d=Oe("flex flex-col bg-card border border-input/50 rounded-md mx-[2px] overflow-hidden",F),e[18]=F,e[19]=d):d=e[19],c=_h(M),e[0]=r.code,e[1]=i,e[2]=l,e[3]=o,e[4]=c,e[5]=d,e[6]=u,e[7]=f}else c=e[4],d=e[5],u=e[6],f=e[7];var _;let g;e[20]!==n.forceWidth||e[21]!==a?(p=n.forceWidth||(_=a,Math.min(Math.max(_-100,100),400)),e[20]=n.forceWidth,e[21]=a,e[22]=p):p=e[22],e[23]!==c||e[24]!==p?(g={height:c,width:p},e[23]=c,e[24]=p,e[25]=g):g=e[25];const m=eV(r.name,s);let b,x,y;e[26]!==m?(b=h.jsx("div",{className:"text-muted-foreground font-semibold text-xs py-1 px-2 bg-muted border-b",children:m}),e[26]=m,e[27]=b):b=e[27],e[28]!==r.code?(x=h.jsx($$,{code:r.code}),e[28]=r.code,e[29]=x):x=e[29],e[30]!==d||e[31]!==g||e[32]!==b||e[33]!==x?(y=h.jsxs("div",{className:d,style:g,children:[b,x]}),e[30]=d,e[31]=g,e[32]=b,e[33]=x,e[34]=y):y=e[34];const v=l==="LR"?$e.Right:$e.Bottom;let k,S;e[35]!==i?(k={background:i},e[35]=i,e[36]=k):k=e[36],e[37]!==v||e[38]!==k?(S=h.jsx(tr,{type:"source",id:"outputs",position:v,style:k}),e[37]=v,e[38]=k,e[39]=S):S=e[39];const E=l==="LR"?$e.Right:$e.Bottom;let j,I,T;return e[40]!==i?(j={background:i},e[40]=i,e[41]=j):j=e[41],e[42]!==E||e[43]!==j?(I=h.jsx(tr,{type:"target",id:"outputs",position:E,style:j}),e[42]=E,e[43]=j,e[44]=I):I=e[44],e[45]!==y||e[46]!==S||e[47]!==I||e[48]!==u||e[49]!==f?(T=h.jsxs("div",{children:[u,f,y,S,I]}),e[45]=y,e[46]=S,e[47]=I,e[48]=u,e[49]=f,e[50]=T):T=e[50],T},(t,e)=>["data","selected","id"].every(n=>t[n]===e[n]));nv.displayName="CustomNode";const ov={custom:nv};function H9(t){const{width:e}=t;return e}const rv=t=>{const e=X.c(18),{maxCount:n,cellIds:o,onClick:r,skipScroll:s}=t,i=Fc();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 u;e[8]!==i?(u=(_,g)=>i.inOrderIds.indexOf(_)-i.inOrderIds.indexOf(g),e[8]=i,e[9]=u):u=e[9];const f=[...o].sort(u);if(o.length===0){let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=h.jsx("div",{className:"text-muted-foreground",children:"--"}),e[10]=_):_=e[10],c=_;break e}let p;e[11]!==o.length||e[12]!==r||e[13]!==s?(p=(_,g)=>h.jsxs("span",{className:"truncate",children:[h.jsx(pr,{variant:"focus",cellId:_,skipScroll:s,className:"whitespace-nowrap",onClick:r?()=>r(_):void 0},_),g<o.length-1&&", "]},_),e[11]=o.length,e[12]=r,e[13]=s,e[14]=p):p=e[14],a=f.slice(0,n).map(p),l=o.length>n&&h.jsxs(Pr,{children:[h.jsx(Ys,{asChild:!0,children:h.jsxs("span",{className:"whitespace-nowrap text-muted-foreground text-xs hover:underline cursor-pointer",children:["+",o.length-n," more"]})}),h.jsx(Vs,{className:"w-auto",children:h.jsx("div",{className:"flex flex-col gap-1 py-1",children:f.slice(n).map(_=>h.jsx(pr,{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=h.jsxs(h.Fragment,{children:[a,l]}),e[15]=a,e[16]=l,e[17]=d):d=e[17],d)},bh=t=>{const e=X.c(15);let n,o,r,s;e[0]!==t?({name:o,declaredBy:n,onClick:r,...s}=t,e[0]=t,e[1]=n,e[2]=o,e[3]=r,e[4]=s):(n=e[1],o=e[2],r=e[3],s=e[4]);const i=n.length>1?"destructive":"outline";let a,l,c;return e[5]!==o||e[6]!==r?(a=async d=>{r?r(d):(await yn(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=h.jsx(L4,{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=h.jsx("div",{className:"max-w-[130px]",...s,children:l}),e[12]=s,e[13]=l,e[14]=c):c=e[14],c},yh=A.memo(t=>{const e=X.c(38),{onChange:n,view:o,settings:r,onSettingsChange:s}=t;let i;e[0]!==s||e[1]!==r?(i=(O,z)=>{s({...r,[O]:z})},e[0]=s,e[1]=r,e[2]=i):i=e[2];const a=i;let l,c,d,u,f,p;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx(Ys,{asChild:!0,children:h.jsx(Pe,{variant:"text",size:"xs",children:h.jsx(J3,{className:"w-4 h-4"})})}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx("div",{className:"font-semibold pb-4",children:"Settings"}),e[4]=c):c=e[4],e[5]!==a?(d=O=>a("hidePureMarkdown",!!O),e[5]=a,e[6]=d):d=e[6],e[7]!==r.hidePureMarkdown||e[8]!==d?(u=h.jsx(y4,{"data-testid":"hide-pure-markdown-checkbox",id:"hide-pure-markdown",checked:r.hidePureMarkdown,onCheckedChange:d}),e[7]=r.hidePureMarkdown,e[8]=d,e[9]=u):u=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(f=h.jsx(Rr,{htmlFor:"hide-pure-markdown",children:"Hide pure markdown"}),e[10]=f):f=e[10],e[11]!==u?(p=h.jsxs(Pr,{children:[l,h.jsxs(Vs,{className:"w-auto p-2 text-muted-foreground",children:[c,h.jsxs("div",{className:"flex items-center gap-2",children:[u,f]})]})]}),e[11]=u,e[12]=p):p=e[12];const _=p,g=o==="_minimap_";let m,b,x;e[13]!==n?(m=()=>n("_minimap_"),e[13]=n,e[14]=m):m=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(b=h.jsx(Pm,{className:"w-4 h-4 mr-1"}),e[15]=b):b=e[15],e[16]!==g||e[17]!==m?(x=h.jsxs(Pe,{variant:"outline",className:"bg-background","aria-selected":g,size:"xs",onClick:m,children:[b,"Mini Map"]}),e[16]=g,e[17]=m,e[18]=x):x=e[18];const y=o==="TB";let v,k,S;e[19]!==n?(v=()=>n("TB"),e[19]=n,e[20]=v):v=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(k=h.jsx(Ca,{className:"w-4 h-4 mr-1"}),e[21]=k):k=e[21],e[22]!==y||e[23]!==v?(S=h.jsxs(Pe,{variant:"outline",className:"bg-background","aria-selected":y,size:"xs",onClick:v,children:[k,"Vertical Tree"]}),e[22]=y,e[23]=v,e[24]=S):S=e[24];const E=o==="LR";let j,I,T,M;e[25]!==n?(j=()=>n("LR"),e[25]=n,e[26]=j):j=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(I=h.jsx(Ca,{className:"w-4 h-4 mr-1 transform -rotate-90"}),e[27]=I):I=e[27],e[28]!==E||e[29]!==j?(T=h.jsxs(Pe,{variant:"outline",className:"bg-background","aria-selected":E,size:"xs",onClick:j,children:[I," ","Horizontal Tree"]}),e[28]=E,e[29]=j,e[30]=T):T=e[30],e[31]!==x||e[32]!==S||e[33]!==T?(M=h.jsxs("div",{className:"flex gap-2",children:[x,S,T]}),e[31]=x,e[32]=S,e[33]=T,e[34]=M):M=e[34];const L=o!=="_minimap_"&&_;let B;return e[35]!==M||e[36]!==L?(B=h.jsxs(Al,{position:"top-right",className:"flex flex-col items-end gap-2",children:[M,L]}),e[35]=M,e[36]=L,e[37]=B):B=e[37],B});yh.displayName="GraphToolbar";const zl=A.memo(t=>{const e=X.c(11),{selection:n,variables:o,onClearSelection:r}=t;if(!n)return null;const s=W9;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(p=>p.usedBy.includes(n.id)),u=Object.values(o).filter(p=>p.declaredBy.includes(n.id)),f=(p,_)=>h.jsxs(h.Fragment,{children:[p.length===0&&h.jsx("div",{className:"text-muted-foreground text-sm text-center",children:"--"}),h.jsx("div",{className:"grid grid-cols-5 gap-3 items-center text-sm py-1 flex-1 empty:hidden",children:p.map(g=>h.jsxs(K.Fragment,{children:[h.jsx(bh,{declaredBy:g.declaredBy,name:g.name}),h.jsxs("div",{className:"truncate col-span-2",title:g.value??"",children:[g.value,h.jsxs("span",{className:"ml-1 truncate text-foreground/60 font-mono",children:["(",g.dataType,")"]})]}),h.jsx("div",{className:"truncate col-span-2 gap-1 items-center",children:h.jsx(rv,{skipScroll:!0,onClick:()=>s(_==="in"?g.declaredBy[0]:g.usedBy[0],g.name),maxCount:3,cellIds:g.usedBy})})]},g.name))})]});return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[h.jsx(uc,{className:"w-5 h-5"}),h.jsx(pr,{cellId:n.id}),h.jsx("div",{className:"flex-1"}),h.jsx(g0,{cellId:n.id,children:h.jsx(Pe,{variant:"ghost",size:"icon",children:h.jsx(qc,{className:"w-4 h-4"})})}),h.jsx(Pe,{variant:"text",size:"icon",onClick:()=>{r()},children:h.jsx(go,{className:"w-4 h-4"})})]}),h.jsxs("div",{className:"text-sm flex flex-col py-3 pl-2 pr-4 flex-1 justify-center",children:[h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[h.jsx(mn,{className:"w-4 h-4"}),"Outputs"]}),f(u,"out")]}),h.jsx("hr",{className:"border-divider my-3"}),h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[h.jsx(rm,{className:"w-4 h-4"}),"Inputs"]}),f(d,"in")]})]})]})}if(n.type==="edge"){const d=Object.values(o).filter(u=>u.declaredBy.includes(n.source)&&u.usedBy.includes(n.target));return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[h.jsx(ja,{className:"w-4 h-4"}),h.jsx(pr,{cellId:n.source}),h.jsx($c,{className:"w-4 h-4"}),h.jsx(pr,{cellId:n.target})]}),h.jsx("div",{className:"grid grid-cols-4 gap-3 max-w-[350px] items-center text-sm p-3 flex-1",children:d.map(u=>h.jsxs(K.Fragment,{children:[h.jsx(bh,{declaredBy:u.declaredBy,name:u.name,onClick:()=>{s(u.declaredBy[0],u.name)}}),h.jsx("div",{className:"truncate text-foreground/60 font-mono",children:u.dataType}),h.jsx("div",{className:"truncate col-span-2",title:u.value??"",children:u.value})]},u.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=h.jsx(Al,{position:"bottom-left",className:"max-h-[90%] flex flex-col w-[calc(100%-5rem)]",children:h.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 W9(t,e){const n=rc(t);n&&$p(n,e)}function sv(){const t=X.c(7),e=Bi(),n=pt(G9),o=pt(q9);let r;t[0]!==e?(r=()=>{e.fitView({duration:100})},t[0]=e,t[1]=r):r=t[1];const s=tV(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 q9(t){const{height:e}=t;return e}function G9(t){const{width:e}=t;return e}zl.displayName="GraphSelectionPanel";const iv=new class{createEdge(t,e,n){return{type:"smoothstep",pathOptions:{offset:20,borderRadius:100},data:{direction:n},markerEnd:{type:as.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:_h(ut.get(e).code.trim().split(`
126
- `).length),position:{x:0,y:n+20}}}createElements(t,e,n,o){let r=0;const s=[],i=[];for(const[l,c]of Vp.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 u of c)for(const f of d){const p=`${u}-${f}`;a.has(p)||(a.add(p),i.push(this.createEdge(u,f,"inputs"),this.createEdge(u,f,"outputs")))}}return{nodes:s,edges:i}}},Y9=t=>{const e=X.c(37),{cellIds:n,variables:o,cellAtoms:r,children:s}=t;let i;e[0]!==r||e[1]!==n||e[2]!==o?(i=iv.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,u]=Zw(c),[f,p]=Xw(a),[_,g]=A.useState(),[m,b]=A.useState(),x=A.useRef(!1);sv();const y=pt(J9);let v;e[5]!==u||e[6]!==p?(v=C=>{p(C.nodes),u([])},e[5]=u,e[6]=p,e[7]=v):v=e[7];const k=Qe(v);let S,E,j,I;e[8]!==r||e[9]!==n||e[10]!==k||e[11]!==o?(S=()=>{x.current?k(iv.createElements(n,r,o,!1)):x.current=!0},E=[n,o,r,k],e[8]=r,e[9]=n,e[10]=k,e[11]=o,e[12]=S,e[13]=E):(S=e[12],E=e[13]),A.useEffect(S,E),e[14]!==l||e[15]!==_||e[16]!==u?(j=()=>{if(_){const C=l.filter($=>{const{source:N,target:H,data:G}=$;return N===_&&G.direction==="outputs"||H===_&&G.direction==="inputs"});u(C)}},I=[_,u,l],e[14]=l,e[15]=_,e[16]=u,e[17]=j,e[18]=I):(j=e[17],I=e[18]),A.useEffect(j,I);const T=function(C,$){const N=X.c(17);let H,G;if(N[0]!==$||N[1]!==C){let Q;N[3]!==$?(Q=(ce,he)=>{const{position:de}=he;return Math.min(ce,de.y-$/2-10)},N[3]=$,N[4]=Q):Q=N[4],G=C.reduce(Q,Number.POSITIVE_INFINITY),N[0]=$,N[1]=C,N[2]=G}else G=N[2];const Z=G;let q;if(N[5]!==$||N[6]!==C){let Q;N[8]!==$?(Q=(ce,he)=>{const{position:de}=he;return Math.max(ce,de.y+$/2+10)},N[8]=$,N[9]=Q):Q=N[9],q=C.reduce(Q,Number.NEGATIVE_INFINITY),N[5]=$,N[6]=C,N[7]=q}else q=N[7];const re=q;let ne,oe,Y;return N[10]!==Z?(ne=[Number.NEGATIVE_INFINITY,Z],N[10]=Z,N[11]=ne):ne=N[11],N[12]!==re?(oe=[Number.POSITIVE_INFINITY,re],N[12]=re,N[13]=oe):oe=N[13],N[14]!==ne||N[15]!==oe?(Y=[ne,oe],N[14]=ne,N[15]=oe,N[16]=Y):Y=N[16],H=Y,H}(f,y);let M;e[19]===Symbol.for("react.memo_cache_sentinel")?(M=()=>{g(void 0),b(void 0)},e[19]=M):M=e[19];const L=M;let B;e[20]!==d||e[21]!==m||e[22]!==_||e[23]!==o?(B=()=>m?h.jsx(zl,{selection:{type:"edge",source:m.source,target:m.target},onClearSelection:L,variables:o,edges:d}):_?h.jsx(zl,{selection:{type:"node",id:_},variables:o,edges:d,onClearSelection:L}):null,e[20]=d,e[21]=m,e[22]=_,e[23]=o,e[24]=B):B=e[24];const O=B;let z,F,V,P;return e[25]!==u?(z=(C,$)=>{const N=$.id;g(N),b(void 0),u([])},e[25]=u,e[26]=z):z=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(F=(C,$)=>{b($)},e[27]=F):F=e[27],e[28]!==O?(V=O(),e[28]=O,e[29]=V):V=e[29],e[30]!==s||e[31]!==d||e[32]!==f||e[33]!==z||e[34]!==V||e[35]!==T?(P=h.jsxs(gh,{nodes:f,edges:d,nodeTypes:ov,translateExtent:T,onNodeClick:z,onNodeDoubleClick:K9,onEdgeClick:F,snapToGrid:!0,fitView:!0,elementsSelectable:!0,minZoom:1,maxZoom:1,draggable:!1,panOnScrollMode:Qo.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]=z,e[34]=V,e[35]=T,e[36]=P):P=e[36],P};function J9(t){const{height:e}=t;return e}function K9(t,e){F4(e.id,"focus")}var xh,av,lv,cv,dv,uv,wh,hv,vh,fv,kh,pv,Sh,mv,Ch,gv,Nh,_v,jh,bv,Eh,yv,Ih,xv,Ah,wv,Th,vv,Mh,kv,Oh,Sv,Dh,Cv,Nv,jv,Ev,Iv,Av,Tv,Rh,Mv,Ph,Ov,Lh,Dv,Fh,Rv,zh,Pv,Bh,Lv,Uh,Fv,Vh,zv,$h,Bv,Hh,Uv,Wh,Vv,qh,$v,Gh,Hv,Yh,Wv,qv,Gv,Yv,Jv,Kv,Xv,Jh,Zv,Kh,Qv,e2,t2,Xh,n2,Zh,o2,Qh,r2,ef,s2,tf,i2,a2,l2,c2,d2;function nf(){if(av)return xh;av=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 u=c;c=d,d=u}return c+""+d+""+(l===void 0?"\0":l)}function r(s,i){return o(s,i.v,i.w,i.name)}return xh=class{constructor(s){ee(this,"_isDirected",!0);ee(this,"_isMultigraph",!1);ee(this,"_isCompound",!1);ee(this,"_label");ee(this,"_defaultNodeLabelFn",()=>{});ee(this,"_defaultEdgeLabelFn",()=>{});ee(this,"_nodes",{});ee(this,"_in",{});ee(this,"_preds",{});ee(this,"_out",{});ee(this,"_sucs",{});ee(this,"_edgeObjs",{});ee(this,"_edgeLabels",{});ee(this,"_nodeCount",0);ee(this,"_edgeCount",0);ee(this,"_parent");ee(this,"_children");s&&(this._isDirected=!Object.hasOwn(s,"directed")||s.directed,this._isMultigraph=!!Object.hasOwn(s,"multigraph")&&s.multigraph,this._isCompound=!!Object.hasOwn(s,"compound")&&s.compound),this._isCompound&&(this._parent={},this._children={},this._children[t]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(s){return this._label=s,this}graph(){return this._label}setDefaultNodeLabel(s){return this._defaultNodeLabelFn=s,typeof s!="function"&&(this._defaultNodeLabelFn=()=>s),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var s=this;return this.nodes().filter(i=>Object.keys(s._in[i]).length===0)}sinks(){var s=this;return this.nodes().filter(i=>Object.keys(s._out[i]).length===0)}setNodes(s,i){var a=arguments,l=this;return s.forEach(function(c){a.length>1?l.setNode(c,i):l.setNode(c)}),this}setNode(s,i){return Object.hasOwn(this._nodes,s)?(arguments.length>1&&(this._nodes[s]=i),this):(this._nodes[s]=arguments.length>1?i:this._defaultNodeLabelFn(s),this._isCompound&&(this._parent[s]=t,this._children[s]={},this._children[t][s]=!0),this._in[s]={},this._preds[s]={},this._out[s]={},this._sucs[s]={},++this._nodeCount,this)}node(s){return this._nodes[s]}hasNode(s){return Object.hasOwn(this._nodes,s)}removeNode(s){var i=this;if(Object.hasOwn(this._nodes,s)){var a=l=>i.removeEdge(i._edgeObjs[l]);delete this._nodes[s],this._isCompound&&(this._removeFromParentsChildList(s),delete this._parent[s],this.children(s).forEach(function(l){i.setParent(l)}),delete this._children[s]),Object.keys(this._in[s]).forEach(a),delete this._in[s],delete this._preds[s],Object.keys(this._out[s]).forEach(a),delete this._out[s],delete this._sucs[s],--this._nodeCount}return this}setParent(s,i){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(i===void 0)i=t;else{for(var a=i+="";a!==void 0;a=this.parent(a))if(a===s)throw new Error("Setting "+i+" as parent of "+s+" would create a cycle");this.setNode(i)}return this.setNode(s),this._removeFromParentsChildList(s),this._parent[s]=i,this._children[i][s]=!0,this}_removeFromParentsChildList(s){delete this._children[this._parent[s]][s]}parent(s){if(this._isCompound){var i=this._parent[s];if(i!==t)return i}}children(s=t){if(this._isCompound){var i=this._children[s];if(i)return Object.keys(i)}else{if(s===t)return this.nodes();if(this.hasNode(s))return[]}}predecessors(s){var i=this._preds[s];if(i)return Object.keys(i)}successors(s){var i=this._sucs[s];if(i)return Object.keys(i)}neighbors(s){var i=this.predecessors(s);if(i){const l=new Set(i);for(var a of this.successors(s))l.add(a);return Array.from(l.values())}}isLeaf(s){return(this.isDirected()?this.successors(s):this.neighbors(s)).length===0}filterNodes(s){var i=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});i.setGraph(this.graph());var a=this;Object.entries(this._nodes).forEach(function([d,u]){s(d)&&i.setNode(d,u)}),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 u=a.parent(d);return u===void 0||i.hasNode(u)?(l[d]=u,u):u in l?l[u]:c(u)}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 u=o(this._isDirected,s,i,a);if(Object.hasOwn(this._edgeLabels,u))return c&&(this._edgeLabels[u]=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[u]=c?l:this._defaultEdgeLabelFn(s,i,a);var f=function(p,_,g,m){var b=""+_,x=""+g;if(!p&&b>x){var y=b;b=x,x=y}var v={v:b,w:x};return m&&(v.name=m),v}(this._isDirected,s,i,a);return s=f.v,i=f.w,Object.freeze(f),this._edgeObjs[u]=f,e(this._preds[i],s),e(this._sucs[s],i),this._in[i][u]=f,this._out[s][u]=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))}},xh}function X9(){return uv?dv:(uv=1,dv={Graph:nf(),version:cv?lv:(cv=1,lv="2.2.4")})}function Z9(){if(hv)return wh;hv=1;var t=nf();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 wh={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}},wh}function Q9(){return fv||(fv=1,vh=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}),vh}function u2(){return pv?kh:(pv=1,kh=class{constructor(){ee(this,"_arr",[]);ee(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(t){return t.key})}has(t){return Object.hasOwn(this._keyIndices,t)}priority(t){var e=this._keyIndices[t];if(e!==void 0)return this._arr[e].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(t,e){var n=this._keyIndices;if(t=String(t),!Object.hasOwn(n,t)){var o=this._arr,r=o.length;return n[t]=r,o.push({key:t,priority:e}),this._decrease(r),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key}decrease(t,e){var n=this._keyIndices[t];if(e>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[n].priority+" New: "+e);this._arr[n].priority=e,this._decrease(n)}_heapify(t){var e=this._arr,n=2*t,o=n+1,r=t;n<e.length&&(r=e[n].priority<e[r].priority?n:r,o<e.length&&(r=e[o].priority<e[r].priority?o:r),r!==t&&(this._swap(t,r),this._heapify(r)))}_decrease(t){for(var e,n=this._arr,o=n[t].priority;t!==0&&!(n[e=t>>1].priority<o);)this._swap(t,e),t=e}_swap(t,e){var n=this._arr,o=this._keyIndices,r=n[t],s=n[e];n[t]=s,n[e]=r,o[s.key]=t,o[r.key]=e}},kh)}function h2(){if(mv)return Sh;mv=1;var t=u2();Sh=function(n,o,r,s){return function(i,a,l,c){var d,u,f={},p=new t,_=function(g){var m=g.v!==d?g.v:g.w,b=f[m],x=l(g),y=u.distance+x;if(x<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+g+" Weight: "+x);y<b.distance&&(b.distance=y,b.predecessor=d,p.decrease(m,y))};for(i.nodes().forEach(function(g){var m=g===a?0:Number.POSITIVE_INFINITY;f[g]={distance:m},p.add(g,m)});p.size()>0&&(d=p.removeMin(),(u=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 Sh}function eD(){if(gv)return Ch;gv=1;var t=h2();return Ch=function(e,n,o){return e.nodes().reduce(function(r,s){return r[s]=t(e,s,n,o),r},{})},Ch}function f2(){return _v||(_v=1,Nh=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}),Nh}function tD(){if(bv)return jh;bv=1;var t=f2();return jh=function(e){return t(e).filter(function(n){return n.length>1||n.length===1&&e.hasEdge(n[0],n[0])})},jh}function nD(){if(yv)return Eh;yv=1,Eh=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 u=d.v===c?d.w:d.v,f=s(d);a[c][u]={distance:f,predecessor:c}})}),l.forEach(function(c){var d=a[c];l.forEach(function(u){var f=a[u];l.forEach(function(p){var _=f[c],g=d[p],m=f[p],b=_.distance+g.distance;b<m.distance&&(m.distance=b,m.predecessor=g.predecessor)})})}),a}(e,n||t,o||function(r){return e.outEdges(r)})};var t=()=>1;return Eh}function p2(){if(xv)return Ih;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}xv=1;class e extends Error{constructor(){super(...arguments)}}return Ih=t,t.CycleException=e,Ih}function oD(){if(wv)return Ah;wv=1;var t=p2();return Ah=function(e){try{t(e)}catch(n){if(n instanceof t.CycleException)return!1;throw n}return!0},Ah}function m2(){if(vv)return Th;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 vv=1,Th=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},Th}function rD(){if(kv)return Mh;kv=1;var t=m2();return Mh=function(e,n){return t(e,n,"post")},Mh}function sD(){if(Sv)return Oh;Sv=1;var t=m2();return Oh=function(e,n){return t(e,n,"pre")},Oh}function iD(){if(Cv)return Dh;Cv=1;var t=nf(),e=u2();return Dh=function(n,o){var r,s=new t,i={},a=new e;function l(d){var u=d.v===r?d.w:d.v,f=a.priority(u);if(f!==void 0){var p=o(d);p<f&&(i[u]=r,a.decrease(u,p))}}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},Dh}function Yn(){if(Iv)return Ev;Iv=1;var t=X9();return Ev={Graph:t.Graph,json:Z9(),alg:jv?Nv:(jv=1,Nv={components:Q9(),dijkstra:h2(),dijkstraAll:eD(),findCycles:tD(),floydWarshall:nD(),isAcyclic:oD(),postorder:rD(),preorder:sD(),prim:iD(),tarjan:f2(),topsort:p2()}),version:t.version}}function aD(){if(Mv)return Rh;Mv=1;let t=Yn().Graph,e=function(){if(Tv)return Av;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 Tv=1,Av=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(", ")+"]"}}}();Rh=function(s,i){if(s.nodeCount()<=1)return[];let a=function(l,c){let d=new t,u=0,f=0;l.nodes().forEach(g=>{d.setNode(g,{v:g,in:0,out:0})}),l.edges().forEach(g=>{let m=d.edge(g.v,g.w)||0,b=c(g),x=m+b;d.setEdge(g.v,g.w,x),f=Math.max(f,d.node(g.v).out+=b),u=Math.max(u,d.node(g.w).in+=b)});let p=function(g){const m=[];for(let b=0;b<g;b++)m.push(b);return m}(f+u+3).map(()=>new e),_=u+1;return d.nodes().forEach(g=>{r(p,_,d.node(g))}),{graph:d,buckets:p,zeroIdx:_}}(s,i||n);return function(l,c,d){let u,f=[],p=c[c.length-1],_=c[0];for(;l.nodeCount();){for(;u=_.dequeue();)o(l,c,d,u);for(;u=p.dequeue();)o(l,c,d,u);if(l.nodeCount()){for(let g=c.length-2;g>0;--g)if(u=c[g].dequeue(),u){f=f.concat(o(l,c,d,u,!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(u=>{let f=s.edge(u),p=s.node(u.v);c&&d.push({v:u.v,w:u.w}),p.out-=f,r(i,a,p)}),s.outEdges(l.v).forEach(u=>{let f=s.edge(u),p=u.w,_=s.node(p);_.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 Rh}function Dt(){if(Ov)return Ph;Ov=1;let t=Yn().Graph;function e(c,d,u,f){let p;do p=i(f);while(c.hasNode(p));return u.dummy=d,c.setNode(p,u),p}Ph={addBorderNode:function(c,d,u,f){let p={width:0,height:0};return arguments.length>=4&&(p.rank=u,p.order=f),e(c,"border",p,d)},addDummyNode:e,applyWithChunking:o,asNonCompoundGraph:function(c){let d=new t({multigraph:c.isMultigraph()}).setGraph(c.graph());return c.nodes().forEach(u=>{c.children(u).length||d.setNode(u,c.node(u))}),c.edges().forEach(u=>{d.setEdge(u,c.edge(u))}),d},buildLayerMatrix:function(c){let d=a(r(c)+1).map(()=>[]);return c.nodes().forEach(u=>{let f=c.node(u),p=f.rank;p!==void 0&&(d[p][f.order]=u)}),d},intersectRect:function(c,d){let u,f,p=c.x,_=c.y,g=d.x-p,m=d.y-_,b=c.width/2,x=c.height/2;if(!g&&!m)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(m)*b>Math.abs(g)*x?(m<0&&(x=-x),u=x*g/m,f=x):(g<0&&(b=-b),u=b,f=b*m/g),{x:p+u,y:_+f}},mapValues:function(c,d){let u=d;return typeof d=="string"&&(u=f=>f[d]),Object.entries(c).reduce((f,[p,_])=>(f[p]=u(_,p),f),{})},maxRank:r,normalizeRanks:function(c){let d=c.nodes().map(f=>{let p=c.node(f).rank;return p===void 0?Number.MAX_VALUE:p}),u=o(Math.min,d);c.nodes().forEach(f=>{let p=c.node(f);Object.hasOwn(p,"rank")&&(p.rank-=u)})},notime:function(c,d){return d()},partition:function(c,d){let u={lhs:[],rhs:[]};return c.forEach(f=>{d(f)?u.lhs.push(f):u.rhs.push(f)}),u},pick:function(c,d){const u={};for(const f of d)c[f]!==void 0&&(u[f]=c[f]);return u},predecessorWeights:function(c){let d=c.nodes().map(u=>{let f={};return c.inEdges(u).forEach(p=>{f[p.v]=(f[p.v]||0)+c.edge(p).weight}),f});return l(c.nodes(),d)},range:a,removeEmptyRanks:function(c){let d=c.nodes().map(g=>c.node(g).rank),u=o(Math.min,d),f=[];c.nodes().forEach(g=>{let m=c.node(g).rank-u;f[m]||(f[m]=[]),f[m].push(g)});let p=0,_=c.graph().nodeRankFactor;Array.from(f).forEach((g,m)=>{g===void 0&&m%_!=0?--p:g!==void 0&&p&&g.forEach(b=>c.node(b).rank+=p)})},simplify:function(c){let d=new t().setGraph(c.graph());return c.nodes().forEach(u=>d.setNode(u,c.node(u))),c.edges().forEach(u=>{let f=d.edge(u.v,u.w)||{weight:0,minlen:1},p=c.edge(u);d.setEdge(u.v,u.w,{weight:f.weight+p.weight,minlen:Math.max(f.minlen,p.minlen)})}),d},successorWeights:function(c){let d=c.nodes().map(u=>{let f={};return c.outEdges(u).forEach(p=>{f[p.w]=(f[p.w]||0)+c.edge(p).weight}),f});return l(c.nodes(),d)},time:function(c,d){let u=Date.now();try{return d()}finally{console.log(c+" time: "+(Date.now()-u)+"ms")}},uniqueId:i,zipObject:l};const n=65535;function o(c,d){if(d.length>n){const u=function(f,p=n){const _=[];for(let g=0;g<f.length;g+=p){const m=f.slice(g,g+p);_.push(m)}return _}(d);return c.apply(null,u.map(f=>c.apply(null,f)))}return c.apply(null,d)}function r(c){const d=c.nodes().map(u=>{let f=c.node(u).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,u=1){d==null&&(d=c,c=0);let f=_=>_<d;u<0&&(f=_=>d<_);const p=[];for(let _=c;f(_);_+=u)p.push(_);return p}function l(c,d){return c.reduce((u,f,p)=>(u[f]=d[p],u),{})}return Ph}function lD(){if(Dv)return Lh;Dv=1;let t=aD(),e=Dt().uniqueId;return Lh={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)}})}},Lh}function cD(){if(Rv)return Fh;Rv=1;let t=Dt();return Fh={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,u=o.node(d).rank,f=r.name,p=o.edge(r),_=p.labelRank;if(u!==c+1){for(o.removeEdge(r),a=0,++c;c<u;++a,++c)p.points=[],i={width:0,height:0,edgeLabel:p,edgeObj:r,rank:c},s=t.addDummyNode(o,"edge",i,"_d"),c===_&&(i.width=p.width,i.height=p.height,i.dummy="edge-label",i.labelpos=p.labelpos),o.setEdge(l,s,{weight:p.weight},f),a===0&&o.graph().dummyChains.push(s),l=s;o.setEdge(l,d,{weight:p.weight},f)}}(e,n))},undo:function(e){e.graph().dummyChains.forEach(n=>{let o,r=e.node(n),s=r.edgeLabel;for(e.setEdge(r.edgeObj,s);r.dummy;)o=e.successors(n)[0],e.removeNode(n),s.points.push({x:r.x,y:r.y}),r.dummy==="edge-label"&&(s.x=r.x,s.y=r.y,s.width=r.width,s.height=r.height),n=o,r=e.node(n)})}},Fh}function Bl(){if(Pv)return zh;Pv=1;const{applyWithChunking:t}=Dt();return zh={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}},zh}function g2(){if(Lv)return Bh;Lv=1;var t=Yn().Graph,e=Bl().slack;function n(s,i){return s.nodes().forEach(function a(l){i.nodeEdges(l).forEach(c=>{var d=c.v,u=l===d?c.w:d;s.hasNode(u)||e(i,c)||(s.setNode(u,{}),s.setEdge(l,u,{}),a(u))})}),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 Bh=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},Bh}function dD(){if(Fv)return Uh;Fv=1;var t=g2(),e=Bl().slack,n=Bl().longestPath,o=Yn().alg.preorder,r=Yn().alg.postorder,s=Dt().simplify;function i(g){g=s(g),n(g);var m,b=t(g);for(c(b),a(b,g);m=u(b);)p(b,g,m,f(b,g,m))}function a(g,m){var b=r(g,g.nodes());(b=b.slice(0,b.length-1)).forEach(x=>function(y,v,k){var S=y.node(k),E=S.parent;y.edge(k,E).cutvalue=l(y,v,k)}(g,m,x))}function l(g,m,b){var x=g.node(b).parent,y=!0,v=m.edge(b,x),k=0;return v||(y=!1,v=m.edge(x,b)),k=v.weight,m.nodeEdges(b).forEach(S=>{var E,j,I=S.v===b,T=I?S.w:S.v;if(T!==x){var M=I===y,L=m.edge(S).weight;if(k+=M?L:-L,E=b,j=T,g.hasEdge(E,j)){var B=g.edge(b,T).cutvalue;k+=M?-B:B}}}),k}function c(g,m){arguments.length<2&&(m=g.nodes()[0]),d(g,{},1,m)}function d(g,m,b,x,y){var v=b,k=g.node(x);return m[x]=!0,g.neighbors(x).forEach(S=>{Object.hasOwn(m,S)||(b=d(g,m,b,S,x))}),k.low=v,k.lim=b++,y?k.parent=y:delete k.parent,b}function u(g){return g.edges().find(m=>g.edge(m).cutvalue<0)}function f(g,m,b){var x=b.v,y=b.w;m.hasEdge(x,y)||(x=b.w,y=b.v);var v=g.node(x),k=g.node(y),S=v,E=!1;v.lim>k.lim&&(S=k,E=!0);var j=m.edges().filter(I=>E===_(g,g.node(I.v),S)&&E!==_(g,g.node(I.w),S));return j.reduce((I,T)=>e(m,T)<e(m,I)?T:I)}function p(g,m,b,x){var y=b.v,v=b.w;g.removeEdge(y,v),g.setEdge(x.v,x.w,{}),c(g),a(g,m),function(k,S){var E=k.nodes().find(I=>!S.node(I).parent),j=o(k,E);(j=j.slice(1)).forEach(I=>{var T=k.node(I).parent,M=S.edge(I,T),L=!1;M||(M=S.edge(T,I),L=!0),S.node(I).rank=S.node(T).rank+(L?M.minlen:-M.minlen)})}(g,m)}function _(g,m,b){return b.low<=m.lim&&m.lim<=b.lim}return Uh=i,i.initLowLimValues=c,i.initCutValues=a,i.calcCutValue=l,i.leaveEdge=u,i.enterEdge=f,i.exchangeEdges=p,Uh}function uD(){if(zv)return Vh;zv=1;var t=Bl().longestPath,e=g2(),n=dD();Vh=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 Vh}function hD(){return Bv||(Bv=1,$h=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(u,f,p,_){let g,m,b=[],x=[],y=Math.min(f[p].low,f[_].low),v=Math.max(f[p].lim,f[_].lim);g=p;do g=u.parent(g),b.push(g);while(g&&(f[g].low>y||v>f[g].lim));for(m=g,g=_;(g=u.parent(g))!==m;)x.push(g);return{path:b.concat(x.reverse()),lca:m}}(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]}})}),$h}function fD(){if(Uv)return Hh;Uv=1;let t=Dt();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"),u=t.addBorderNode(n,"_bb"),f=n.node(l);n.setParent(d,l),f.borderTop=d,n.setParent(u,l),f.borderBottom=u,c.forEach(p=>{e(n,o,r,s,i,a,p);let _=n.node(p),g=_.borderTop?_.borderTop:p,m=_.borderBottom?_.borderBottom:p,b=_.borderTop?s:2*s,x=g!==m?1:i-a[l]+1;n.setEdge(d,g,{weight:b,minlen:x,nestingEdge:!0}),n.setEdge(m,u,{weight:b,minlen:x,nestingEdge:!0})}),n.parent(l)||n.setEdge(o,d,{weight:0,minlen:i+a[l]})}return Hh={run:function(n){let o=t.addDummyNode(n,"root",{},"_root"),r=function(c){var d={};function u(f,p){var _=c.children(f);_&&_.length&&_.forEach(g=>u(g,p+1)),d[f]=p}return c.children().forEach(f=>u(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,u)=>d+c.edge(u).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)})}},Hh}function pD(){if($v)return qh;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 $v=1,qh={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))}},qh}function mD(){if(Jv)return Yv;Jv=1;let t=Dt();return Yv=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,u){let f=0,p=0;d.weight&&(f+=d.barycenter*d.weight,p+=d.weight),u.weight&&(f+=u.barycenter*u.weight,p+=u.weight),d.vs=u.vs.concat(d.vs),d.barycenter=f/p,d.weight=p,d.i=Math.min(u.i,d.i),u.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 gD(){if(Zv)return Jh;Zv=1;let t=(Gv||(Gv=1,qv=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),u=o.node(c.v);return{sum:l.sum+d.weight*u.order,weight:l.weight+d.weight}},{sum:0,weight:0});return{v:s,barycenter:a.sum/a.weight,weight:a.weight}}return{v:s}})}),qv),e=mD(),n=function(){if(Xv)return Kv;Xv=1;let o=Dt();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 Kv=function(s,i){let a=o.partition(s,m=>Object.hasOwn(m,"barycenter")),l=a.lhs,c=a.rhs.sort((m,b)=>b.i-m.i),d=[],u=0,f=0,p=0;var _;l.sort((_=!!i,(m,b)=>m.barycenter<b.barycenter?-1:m.barycenter>b.barycenter?1:_?b.i-m.i:m.i-b.i)),p=r(d,c,p),l.forEach(m=>{p+=m.vs.length,d.push(m.vs),u+=m.barycenter*m.weight,f+=m.weight,p=r(d,c,p)});let g={vs:d.flat(!0)};return f&&(g.barycenter=u/f,g.weight=f),g}}();return Jh=function o(r,s,i,a){let l=r.children(s),c=r.node(s),d=c?c.borderLeft:void 0,u=c?c.borderRight:void 0,f={};d&&(l=l.filter(m=>m!==d&&m!==u));let p=t(r,l);p.forEach(m=>{if(r.children(m.v).length){let y=o(r,m.v,i,a);f[m.v]=y,Object.hasOwn(y,"barycenter")&&(x=y,(b=m).barycenter!==void 0?(b.barycenter=(b.barycenter*b.weight+x.barycenter*x.weight)/(b.weight+x.weight),b.weight+=x.weight):(b.barycenter=x.barycenter,b.weight=x.weight))}var b,x});let _=e(p,i);(function(m,b){m.forEach(x=>{x.vs=x.vs.flatMap(y=>b[y]?b[y].vs:y)})})(_,f);let g=n(_,a);if(d&&(g.vs=[d,g.vs,u].flat(!0),r.predecessors(d).length)){let m=r.node(r.predecessors(d)[0]),b=r.node(r.predecessors(u)[0]);Object.hasOwn(g,"barycenter")||(g.barycenter=0,g.weight=0),g.barycenter=(g.barycenter*g.weight+m.order+b.order)/(g.weight+2),g.weight+=2}return g},Jh}function _D(){if(Qv)return Kh;Qv=1;let t=Yn().Graph,e=Dt();return Kh=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 u=d.v===a?d.w:d.v,f=i.edge(u,a),p=f!==void 0?f.weight:0;i.setEdge(u,a,{weight:n.edge(d).weight+p})}),Object.hasOwn(l,"minRank")&&i.setNode(a,{borderLeft:l.borderLeft[o],borderRight:l.borderRight[o]}))}),i},Kh}function bD(){if(n2)return Xh;n2=1;let t=function(){if(Hv)return Gh;Hv=1;let d=Dt();return Gh=function(u){let f={},p=u.nodes().filter(x=>!u.children(x).length),_=p.map(x=>u.node(x).rank),g=d.applyWithChunking(Math.max,_),m=d.range(g+1).map(()=>[]);function b(x){if(f[x])return;f[x]=!0;let y=u.node(x);m[y.rank].push(x),u.successors(x).forEach(b)}return p.sort((x,y)=>u.node(x).rank-u.node(y).rank).forEach(b),m},Gh}(),e=function(){if(Wv)return Yh;Wv=1;let d=Dt().zipObject;function u(f,p,_){let g=d(_,_.map((k,S)=>S)),m=p.flatMap(k=>f.outEdges(k).map(S=>({pos:g[S.w],weight:f.edge(S).weight})).sort((S,E)=>S.pos-E.pos)),b=1;for(;b<_.length;)b<<=1;let x=2*b-1;b-=1;let y=new Array(x).fill(0),v=0;return m.forEach(k=>{let S=k.pos+b;y[S]+=k.weight;let E=0;for(;S>0;)S%2&&(E+=y[S+1]),S=S-1>>1,y[S]+=k.weight;v+=k.weight*E}),v}return Yh=function(f,p){let _=0;for(let g=1;g<p.length;++g)_+=u(f,p[g-1],p[g]);return _},Yh}(),n=gD(),o=_D(),r=(t2||(t2=1,e2=function(d,u,f){let p,_={};f.forEach(g=>{let m,b,x=d.parent(g);for(;x;){if(m=d.parent(x),m?(b=_[m],_[m]=x):(b=p,p=x),b&&b!==x)return void u.setEdge(b,x);x=m}})}),e2),s=Yn().Graph,i=Dt();function a(d,u,f){return u.map(function(p){return o(d,p,f)})}function l(d,u){let f=new s;d.forEach(function(p){let _=p.graph().root,g=n(p,_,f,u);g.vs.forEach((m,b)=>p.node(m).order=b),r(p,f,g.vs)})}function c(d,u){Object.values(u).forEach(f=>f.forEach((p,_)=>d.node(p).order=_))}return Xh=function d(u,f){if(f&&typeof f.customOrder=="function")return void f.customOrder(u,d);let p=i.maxRank(u),_=a(u,i.range(1,p+1),"inEdges"),g=a(u,i.range(p-1,-1,-1),"outEdges"),m=t(u);if(c(u,m),f&&f.disableOptimalOrderHeuristic)return;let b,x=Number.POSITIVE_INFINITY;for(let y=0,v=0;v<4;++y,++v){l(y%2?_:g,y%4>=2),m=i.buildLayerMatrix(u);let k=e(u,m);k<x&&(v=0,b=Object.assign({},m),x=k)}c(u,b)},Xh}function yD(){if(o2)return Zh;o2=1;let t=Yn().Graph,e=Dt();function n(u,f){let p={};return f.length&&f.reduce(function(_,g){let m=0,b=0,x=_.length,y=g[g.length-1];return g.forEach((v,k)=>{let S=function(j,I){if(j.node(I).dummy)return j.predecessors(I).find(T=>j.node(T).dummy)}(u,v),E=S?u.node(S).order:x;(S||v===y)&&(g.slice(b,k+1).forEach(j=>{u.predecessors(j).forEach(I=>{let T=u.node(I),M=T.order;!(M<m||E<M)||T.dummy&&u.node(j).dummy||r(p,I,j)})}),b=k+1,m=E)}),g}),p}function o(u,f){let p={};function _(g,m,b,x,y){let v;e.range(m,b).forEach(k=>{v=g[k],u.node(v).dummy&&u.predecessors(v).forEach(S=>{let E=u.node(S);E.dummy&&(E.order<x||E.order>y)&&r(p,S,v)})})}return f.length&&f.reduce(function(g,m){let b,x=-1,y=0;return m.forEach((v,k)=>{if(u.node(v).dummy==="border"){let S=u.predecessors(v);S.length&&(b=u.node(S[0]).order,_(m,y,k,x,b),y=k,x=b)}_(m,y,m.length,b,g.length)}),m}),p}function r(u,f,p){if(f>p){let g=f;f=p,p=g}let _=u[f];_||(u[f]=_={}),_[p]=!0}function s(u,f,p){if(f>p){let _=f;f=p,p=_}return!!u[f]&&Object.hasOwn(u[f],p)}function i(u,f,p,_){let g={},m={},b={};return f.forEach(x=>{x.forEach((y,v)=>{g[y]=y,m[y]=y,b[y]=v})}),f.forEach(x=>{let y=-1;x.forEach(v=>{let k=_(v);if(k.length){k=k.sort((E,j)=>b[E]-b[j]);let S=(k.length-1)/2;for(let E=Math.floor(S),j=Math.ceil(S);E<=j;++E){let I=k[E];m[v]===v&&y<b[I]&&!s(p,v,I)&&(m[I]=v,m[v]=g[v]=g[I],y=b[I])}}})}),{root:g,align:m}}function a(u,f,p,_,g){let m={},b=function(v,k,S,E){let j=new t,I=v.graph(),T=function(M,L,B){return(O,z,F)=>{let V,P=O.node(z),C=O.node(F),$=0;if($+=P.width/2,Object.hasOwn(P,"labelpos"))switch(P.labelpos.toLowerCase()){case"l":V=-P.width/2;break;case"r":V=P.width/2}if(V&&($+=B?V:-V),V=0,$+=(P.dummy?L:M)/2,$+=(C.dummy?L: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&&($+=B?V:-V),V=0,$}}(I.nodesep,I.edgesep,E);return k.forEach(M=>{let L;M.forEach(B=>{let O=S[B];if(j.setNode(O),L){var z=S[L],F=j.edge(z,O);j.setEdge(z,O,Math.max(T(v,B,L),F||0))}L=B})}),j}(u,f,p,g),x=g?"borderLeft":"borderRight";function y(v,k){let S=b.nodes(),E=S.pop(),j={};for(;E;)j[E]?v(E):(j[E]=!0,S.push(E),S=S.concat(k(E))),E=S.pop()}return y(function(v){m[v]=b.inEdges(v).reduce((k,S)=>Math.max(k,m[S.v]+b.edge(S)),0)},b.predecessors.bind(b)),y(function(v){let k=b.outEdges(v).reduce((E,j)=>Math.min(E,m[j.w]-b.edge(j)),Number.POSITIVE_INFINITY),S=u.node(v);k!==Number.POSITIVE_INFINITY&&S.borderType!==x&&(m[v]=Math.max(m[v],k))},b.successors.bind(b)),Object.keys(_).forEach(v=>m[v]=m[p[v]]),m}function l(u,f){return Object.values(f).reduce((p,_)=>{let g=Number.NEGATIVE_INFINITY,m=Number.POSITIVE_INFINITY;Object.entries(_).forEach(([x,y])=>{let v=function(k,S){return k.node(S).width}(u,x)/2;g=Math.max(y+v,g),m=Math.min(y-v,m)});const b=g-m;return b<p[0]&&(p=[b,_]),p},[Number.POSITIVE_INFINITY,null])[1]}function c(u,f){let p=Object.values(f),_=e.applyWithChunking(Math.min,p),g=e.applyWithChunking(Math.max,p);["u","d"].forEach(m=>{["l","r"].forEach(b=>{let x=m+b,y=u[x];if(y===f)return;let v=Object.values(y),k=_-e.applyWithChunking(Math.min,v);b!=="l"&&(k=g-e.applyWithChunking(Math.max,v)),k&&(u[x]=e.mapValues(y,S=>S+k))})})}function d(u,f){return e.mapValues(u.ul,(p,_)=>{if(f)return u[f.toLowerCase()][_];{let g=Object.values(u).map(m=>m[_]).sort((m,b)=>m-b);return(g[1]+g[2])/2}})}return Zh={positionX:function(u){let f,p=e.buildLayerMatrix(u),_=Object.assign(n(u,p),o(u,p)),g={};["u","d"].forEach(b=>{f=b==="u"?p:Object.values(p).reverse(),["l","r"].forEach(x=>{x==="r"&&(f=f.map(S=>Object.values(S).reverse()));let y=(b==="u"?u.predecessors:u.successors).bind(u),v=i(u,f,_,y),k=a(u,f,v.root,v.align,x==="r");x==="r"&&(k=e.mapValues(k,S=>-S)),g[b+x]=k})});let m=l(u,g);return c(g,m),d(g,u.graph().align)},findType1Conflicts:n,findType2Conflicts:o,addConflict:r,hasConflict:s,verticalAlignment:i,horizontalCompaction:a,alignCoordinates:c,findSmallestWidthAlignment:l,balance:d},Zh}function xD(){if(r2)return Qh;r2=1;let t=Dt(),e=yD().positionX;return Qh=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 u=o.node(d).height;return c>u?c:u},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)},Qh}function wD(){if(s2)return ef;s2=1;let t=lD(),e=cD(),n=uD(),o=Dt().normalizeRanks,r=hD(),s=Dt().removeEmptyRanks,i=fD(),a=function(){if(Vv)return Wh;Vv=1;let E=Dt();function j(I,T,M,L,B,O){let z={width:0,height:0,rank:O,borderType:T},F=B[T][O-1],V=E.addDummyNode(I,"border",z,M);B[T][O]=V,I.setParent(V,L),F&&I.setEdge(F,V,{weight:1})}return Wh=function(I){I.children().forEach(function T(M){let L=I.children(M),B=I.node(M);if(L.length&&L.forEach(T),Object.hasOwn(B,"minRank")){B.borderLeft=[],B.borderRight=[];for(let O=B.minRank,z=B.maxRank+1;O<z;++O)j(I,"borderLeft","_bl",M,B,O),j(I,"borderRight","_br",M,B,O)}})},Wh}(),l=pD(),c=bD(),d=xD(),u=Dt(),f=Yn().Graph;ef=function(E,j){let I=j&&j.debugTiming?u.time:u.notime;I("layout",()=>{let T=I(" buildLayoutGraph",()=>function(M){let L=new f({multigraph:!0,compound:!0}),B=S(M.graph());return L.setGraph(Object.assign({},_,k(B,p),u.pick(B,g))),M.nodes().forEach(O=>{const z=k(S(M.node(O)),m);Object.keys(b).forEach(F=>{z[F]===void 0&&(z[F]=b[F])}),L.setNode(O,z),L.setParent(O,M.parent(O))}),M.edges().forEach(O=>{let z=S(M.edge(O));L.setEdge(O,Object.assign({},y,k(z,x),u.pick(z,v)))}),L}(E));I(" runLayout",()=>function(M,L,B){L(" makeSpaceForEdgeLabels",()=>function(O){let z=O.graph();z.ranksep/=2,O.edges().forEach(F=>{let V=O.edge(F);V.minlen*=2,V.labelpos.toLowerCase()!=="c"&&(z.rankdir==="TB"||z.rankdir==="BT"?V.width+=V.labeloffset:V.height+=V.labeloffset)})}(M)),L(" removeSelfEdges",()=>function(O){O.edges().forEach(z=>{if(z.v===z.w){var F=O.node(z.v);F.selfEdges||(F.selfEdges=[]),F.selfEdges.push({e:z,label:O.edge(z)}),O.removeEdge(z)}})}(M)),L(" acyclic",()=>t.run(M)),L(" nestingGraph.run",()=>i.run(M)),L(" rank",()=>n(u.asNonCompoundGraph(M))),L(" injectEdgeLabelProxies",()=>function(O){O.edges().forEach(z=>{let F=O.edge(z);if(F.width&&F.height){let V=O.node(z.v),P={rank:(O.node(z.w).rank-V.rank)/2+V.rank,e:z};u.addDummyNode(O,"edge-proxy",P,"_ep")}})}(M)),L(" removeEmptyRanks",()=>s(M)),L(" nestingGraph.cleanup",()=>i.cleanup(M)),L(" normalizeRanks",()=>o(M)),L(" assignRankMinMax",()=>function(O){let z=0;O.nodes().forEach(F=>{let V=O.node(F);V.borderTop&&(V.minRank=O.node(V.borderTop).rank,V.maxRank=O.node(V.borderBottom).rank,z=Math.max(z,V.maxRank))}),O.graph().maxRank=z}(M)),L(" removeEdgeLabelProxies",()=>function(O){O.nodes().forEach(z=>{let F=O.node(z);F.dummy==="edge-proxy"&&(O.edge(F.e).labelRank=F.rank,O.removeNode(z))})}(M)),L(" normalize.run",()=>e.run(M)),L(" parentDummyChains",()=>r(M)),L(" addBorderSegments",()=>a(M)),L(" order",()=>c(M,B)),L(" insertSelfEdges",()=>function(O){var z=u.buildLayerMatrix(O);z.forEach(F=>{var V=0;F.forEach((P,C)=>{var $=O.node(P);$.order=C+V,($.selfEdges||[]).forEach(N=>{u.addDummyNode(O,"selfedge",{width:N.label.width,height:N.label.height,rank:$.rank,order:C+ ++V,e:N.e,label:N.label},"_se")}),delete $.selfEdges})})}(M)),L(" adjustCoordinateSystem",()=>l.adjust(M)),L(" position",()=>d(M)),L(" positionSelfEdges",()=>function(O){O.nodes().forEach(z=>{var F=O.node(z);if(F.dummy==="selfedge"){var V=O.node(F.e.v),P=V.x+V.width/2,C=V.y,$=F.x-P,N=V.height/2;O.setEdge(F.e,F.label),O.removeNode(z),F.label.points=[{x:P+2*$/3,y:C-N},{x:P+5*$/6,y:C-N},{x:P+$,y:C},{x:P+5*$/6,y:C+N},{x:P+2*$/3,y:C+N}],F.label.x=F.x,F.label.y=F.y}})}(M)),L(" removeBorderNodes",()=>function(O){O.nodes().forEach(z=>{if(O.children(z).length){let F=O.node(z),V=O.node(F.borderTop),P=O.node(F.borderBottom),C=O.node(F.borderLeft[F.borderLeft.length-1]),$=O.node(F.borderRight[F.borderRight.length-1]);F.width=Math.abs($.x-C.x),F.height=Math.abs(P.y-V.y),F.x=C.x+F.width/2,F.y=V.y+F.height/2}}),O.nodes().forEach(z=>{O.node(z).dummy==="border"&&O.removeNode(z)})}(M)),L(" normalize.undo",()=>e.undo(M)),L(" fixupEdgeLabelCoords",()=>function(O){O.edges().forEach(z=>{let F=O.edge(z);if(Object.hasOwn(F,"x"))switch(F.labelpos!=="l"&&F.labelpos!=="r"||(F.width-=F.labeloffset),F.labelpos){case"l":F.x-=F.width/2+F.labeloffset;break;case"r":F.x+=F.width/2+F.labeloffset}})}(M)),L(" undoCoordinateSystem",()=>l.undo(M)),L(" translateGraph",()=>function(O){let z=Number.POSITIVE_INFINITY,F=0,V=Number.POSITIVE_INFINITY,P=0,C=O.graph(),$=C.marginx||0,N=C.marginy||0;function H(G){let Z=G.x,q=G.y,re=G.width,ne=G.height;z=Math.min(z,Z-re/2),F=Math.max(F,Z+re/2),V=Math.min(V,q-ne/2),P=Math.max(P,q+ne/2)}O.nodes().forEach(G=>H(O.node(G))),O.edges().forEach(G=>{let Z=O.edge(G);Object.hasOwn(Z,"x")&&H(Z)}),z-=$,V-=N,O.nodes().forEach(G=>{let Z=O.node(G);Z.x-=z,Z.y-=V}),O.edges().forEach(G=>{let Z=O.edge(G);Z.points.forEach(q=>{q.x-=z,q.y-=V}),Object.hasOwn(Z,"x")&&(Z.x-=z),Object.hasOwn(Z,"y")&&(Z.y-=V)}),C.width=F-z+$,C.height=P-V+N}(M)),L(" assignNodeIntersects",()=>function(O){O.edges().forEach(z=>{let F,V,P=O.edge(z),C=O.node(z.v),$=O.node(z.w);P.points?(F=P.points[0],V=P.points[P.points.length-1]):(P.points=[],F=$,V=C),P.points.unshift(u.intersectRect(C,F)),P.points.push(u.intersectRect($,V))})}(M)),L(" reversePoints",()=>function(O){O.edges().forEach(z=>{let F=O.edge(z);F.reversed&&F.points.reverse()})}(M)),L(" acyclic.undo",()=>t.undo(M))}(T,I,j)),I(" updateInputGraph",()=>function(M,L){M.nodes().forEach(B=>{let O=M.node(B),z=L.node(B);O&&(O.x=z.x,O.y=z.y,O.rank=z.rank,L.children(B).length&&(O.width=z.width,O.height=z.height))}),M.edges().forEach(B=>{let O=M.edge(B),z=L.edge(B);O.points=z.points,Object.hasOwn(z,"x")&&(O.x=z.x,O.y=z.y)}),M.graph().width=L.graph().width,M.graph().height=L.graph().height}(E,T))})};let p=["nodesep","edgesep","ranksep","marginx","marginy"],_={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},g=["acyclicer","ranker","rankdir","align"],m=["width","height"],b={width:0,height:0},x=["minlen","weight","width","height","labeloffset"],y={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},v=["labelpos"];function k(E,j){return u.mapValues(u.pick(E,j),Number)}function S(E){var j={};return E&&Object.entries(E).forEach(([I,T])=>{typeof I=="string"&&(I=I.toLowerCase()),j[I]=T}),j}return ef}function vD(){if(i2)return tf;i2=1;let t=Dt(),e=Yn().Graph;return tf={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}},tf}var _2=d2?c2:(d2=1,c2={graphlib:Yn(),layout:wD(),debug:vD(),util:{time:Dt().time,notime:Dt().notime},version:l2?a2:(l2=1,a2="1.1.4")});const $i=new _2.graphlib.Graph().setDefaultEdgeLabel(()=>({})),b2=(t,e,n)=>($i.setGraph({rankdir:n.direction,nodesep:150,ranksep:200,ranker:"longest-path"}),e.forEach(o=>$i.setEdge(o.source,o.target)),t.forEach(o=>$i.setNode(o.id,{...o,width:o.width??0,height:o.height??0})),_2.layout($i),{nodes:t.map(o=>{const{x:r,y:s}=$i.node(o.id);return{...o,position:{x:r,y:s}}}),edges:e}),y2=new class{createEdge(t,e){return{animated:!0,markerEnd:{type:as.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:_h(ut.get(e).code.trim().split(`
127
- `).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 u of c)for(const f of d){const p=`${u}-${f}`;a.has(p)||(a.add(p),i.add(u),i.add(f),s.push(this.createEdge(u,f)))}}for(const[l,c]of Vp.zip(t,e)){o||r.push(this.createNode(l,c));const d=i.has(l),u=ut.get(c).code.trim().startsWith("mo.md");!d&&u||r.push(this.createNode(l,c))}return{nodes:r,edges:s}}},kD=t=>{const e=X.c(43),{cellIds:n,variables:o,cellAtoms:r,children:s,layoutDirection:i,settings:a}=t;let l;e[0]!==r||e[1]!==n||e[2]!==i||e[3]!==a.hidePureMarkdown||e[4]!==o?(l=()=>{let C=y2.createElements(n,r,o,a.hidePureMarkdown);return C=b2(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,u,f]=Xw(c.nodes),[p,_,g]=Zw(c.edges),m=Bi();let b;e[6]!==i||e[7]!==_||e[8]!==u?(b=C=>{const $=b2(C.nodes,C.edges,{direction:i});u($.nodes),_($.edges)},e[6]=i,e[7]=_,e[8]=u,e[9]=b):b=e[9];const x=Qe(b);let y,v;e[10]!==r||e[11]!==n||e[12]!==a.hidePureMarkdown||e[13]!==x||e[14]!==o?(y=()=>{x(y2.createElements(n,r,o,a.hidePureMarkdown))},v=[n,o,r,x,a.hidePureMarkdown],e[10]=r,e[11]=n,e[12]=a.hidePureMarkdown,e[13]=x,e[14]=o,e[15]=y,e[16]=v):(y=e[15],v=e[16]),A.useEffect(y,v);const[k,S]=A.useState();let E;sv(),e[17]===Symbol.for("react.memo_cache_sentinel")?(E=()=>{S(void 0)},e[17]=E):E=e[17];const j=E;let I,T,M,L,B,O,z,F,V,P;return e[18]===Symbol.for("react.memo_cache_sentinel")?(I={minZoom:.5,maxZoom:1.5},T=(C,$)=>{S({type:"node",id:$.id})},M=(C,$)=>{const{source:N,target:H}=$;S({type:"edge",source:N,target:H})},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")?(L=h.jsx($9,{color:"#ccc",variant:Pn.Dots}),e[21]=L):L=e[21],e[22]!==m||e[23]!==d?(B=()=>{const C=ut.get(nV);if(C){const $=d.find(N=>N.id===C);$&&(m.fitView({padding:1,duration:600,nodes:[$]}),S({type:"node",id:C}))}},e[22]=m,e[23]=d,e[24]=B):B=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(O=h.jsx(Cm,{className:"size-4"}),e[25]=O):O=e[25],e[26]!==B?(z=h.jsx(L9,{position:"bottom-right",showInteractive:!1,children:h.jsx(Re,{content:"Jump to focused cell",delayDuration:200,side:"left",asChild:!1,children:h.jsx(ms,{onMouseDown:Vn.preventFocus,onClick:B,children:O})})}),e[26]=B,e[27]=z):z=e[27],e[28]!==p||e[29]!==k||e[30]!==o?(F=h.jsx(zl,{selection:k,variables:o,edges:p,onClearSelection:j}),e[28]=p,e[29]=k,e[30]=o,e[31]=F):F=e[31],e[32]!==s||e[33]!==p||e[34]!==d||e[35]!==g||e[36]!==f||e[37]!==z||e[38]!==F?(V=h.jsxs(gh,{nodes:d,edges:p,nodeTypes:ov,minZoom:.2,fitViewOptions:I,onNodeClick:T,onEdgeClick:M,onNodeDoubleClick:SD,fitView:!0,onNodesChange:f,onEdgesChange:g,zoomOnDoubleClick:!1,nodesConnectable:!1,children:[L,z,F,s]}),e[32]=s,e[33]=p,e[34]=d,e[35]=g,e[36]=f,e[37]=z,e[38]=F,e[39]=V):V=e[39],e[40]!==i||e[41]!==V?(P=h.jsx(tv.Provider,{value:i,children:V}),e[40]=i,e[41]=V,e[42]=P):P=e[42],P};function SD(t,e){F4(e.id,"focus")}const CD=Zt("_minimap_"),ND=Zt({hidePureMarkdown:!0}),jD=t=>{const e=X.c(11),[n,o]=fn(CD),[r,s]=fn(ND);let i;e[0]!==n||e[1]!==t||e[2]!==o||e[3]!==s||e[4]!==r?(i=()=>n==="_minimap_"?h.jsx(Y9,{...t,children:h.jsx(yh,{settings:r,onSettingsChange:s,view:n,onChange:o})}):h.jsx(kD,{...t,settings:r,layoutDirection:n,children:h.jsx(yh,{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=h.jsx(mh,{children:l},n),e[8]=n,e[9]=l,e[10]=c):c=e[10],c},ED=()=>{const t=X.c(5),e=z4(),n=Fc(),[o]=oV();let r,s;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=Oe("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=h.jsx("div",{className:r,children:h.jsx(jD,{cellAtoms:o,variables:e,cellIds:n.inOrderIds})}),t[1]=n.inOrderIds,t[2]=o,t[3]=e,t[4]=s):s=t[4],s},x2="name",w2="type-value",of="defs-refs",ID=[{id:x2,accessorFn:t=>[t.name,t.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>h.jsx(Gp,{header:"Name",column:t}),cell:({getValue:t})=>{const[e,n]=t();return h.jsx(bh,{name:e,declaredBy:n})}},{id:w2,accessorFn:t=>[t.dataType,t.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>h.jsx(Gp,{header:h.jsxs("div",{className:"flex flex-col gap-1",children:[h.jsx("span",{children:"Type"}),h.jsx("span",{children:"Value"})]}),column:t}),cell:({getValue:t})=>{const[e,n]=t();return h.jsxs("div",{className:"max-w-[150px]",children:[h.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs",children:e}),h.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap",title:n??"",children:n})]})}},{id:of,accessorFn:t=>[t.declaredBy,t.usedBy,t.name,t.declaredByNames,t.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:t})=>h.jsx(Gp,{header:h.jsxs("div",{className:"flex flex-col gap-1",children:[h.jsx("span",{children:"Declared By"}),h.jsx("span",{children:"Used By"})]}),column:t}),cell:({getValue:t})=>{const[e,n,o]=t(),r=s=>{const i=rc(s);i&&$p(i,o)};return h.jsxs("div",{className:"flex flex-col gap-1 py-1",children:[h.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-center",children:[h.jsx("span",{title:"Declared by",children:h.jsx(Bm,{className:"w-3.5 h-3.5 text-muted-foreground"})}),e.length===1?h.jsx(pr,{variant:"focus",cellId:e[0],skipScroll:!0,onClick:()=>r(e[0])}):h.jsx("div",{className:"text-destructive flex flex-row gap-2",children:e.slice(0,3).map((s,i)=>h.jsxs("span",{className:"flex",children:[h.jsx(pr,{variant:"focus",cellId:s,skipScroll:!0,className:"whitespace-nowrap text-destructive",onClick:()=>r(s)},s),i<e.length-1&&", "]},s))})]}),h.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-baseline",children:[h.jsx("span",{title:"Used by",children:h.jsx(ja,{className:"w-3.5 h-3.5 text-muted-foreground"})}),h.jsx(rv,{maxCount:3,cellIds:n,skipScroll:!0,onClick:r})]})]})}}],v2=A.memo(({className:t,cellIds:e,variables:n})=>{const[o,r]=K.useState([]),[s,i]=K.useState(""),a=rV(),l=A.useMemo(()=>{const u=f=>{const p=a[f];return cV(p)?`cell-${e.indexOf(f)}`:p??`cell-${e.indexOf(f)}`};return Object.values(n).map(f=>({...f,declaredByNames:f.declaredBy.map(u),usedByNames:f.usedBy.map(u)}))},[n,a,e]),c=A.useMemo(()=>{const u=new Map;return e.forEach((f,p)=>u.set(f,p)),function(f,p,_){p||(p={id:of,desc:!1});let g=[];switch(p.id){case x2:g=xa(f,m=>m.name);break;case w2:g=xa(f,m=>m.dataType);break;case of:g=xa(f,m=>_.get(m.declaredBy[0]))}return p.desc?g.reverse():g}(l,o[0],u)},[l,o,e]),d=sV({data:c,columns:ID,getCoreRowModel:lV(),onGlobalFilterChange:i,getFilteredRowModel:aV(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter:u=>u.columnDef.enableGlobalFilter??!0,globalFilterFn:"auto",manualSorting:!0,onSortingChange:r,getSortedRowModel:iV(),state:{sorting:o,globalFilter:s}});return h.jsxs(h.Fragment,{children:[h.jsx(B4,{className:"w-full",placeholder:"Search",value:s,onChange:u=>i(u.target.value)}),h.jsxs(Hp,{className:Oe("w-full text-sm flex-1 border-separate border-spacing-0",t),children:[h.jsx(Wp,{children:h.jsx(Ks,{className:"whitespace-nowrap text-xs",children:d.getFlatHeaders().map(u=>h.jsx(Fr,{className:"sticky top-0 bg-background border-b",children:U4(u.column.columnDef.header,u.getContext())},u.id))})}),h.jsx(qp,{children:d.getRowModel().rows.map(u=>h.jsx(Ks,{className:"hover:bg-accent",children:u.getVisibleCells().map(f=>h.jsx(zr,{className:"border-b",children:U4(f.column.columnDef.cell,f.getContext())},f.id))},u.id))})]})]})});v2.displayName="VariableTable";let k2,S2,C2;k2=()=>{const t=X.c(4),e=z4(),n=Fc();if(Object.keys(e).length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(In,{title:"No variables",description:"Global variables will appear here.",icon:h.jsx(uc,{})}),t[0]=r):r=t[0],r}let o;return t[1]!==n.inOrderIds||t[2]!==e?(o=h.jsx(v2,{className:"flex-1",cellIds:n.inOrderIds,variables:e}),t[1]=n.inOrderIds,t[2]=e,t[3]=o):o=t[3],o},tm=t=>{const e=X.c(6),n=t.dataTestId;let o,r;return e[0]!==t.className?(o=Oe("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=h.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},S2=()=>{const t=X.c(9),e=dV(),{clearLogs:n}=Lt();if(e.length===0){let i,a;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsx("code",{className:"border rounded px-1",children:"stdout"}),t[0]=i):i=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx(In,{title:"No logs",description:h.jsxs("span",{children:[i," and"," ",h.jsx("code",{className:"border rounded px-1",children:"stderr"})," logs will appear here."]}),icon:h.jsx(up,{})}),t[1]=a):a=t[1],a}let o,r,s;return t[2]!==n?(o=h.jsx("div",{className:"flex flex-row justify-end px-2 py-1",children:h.jsx(tm,{dataTestId:"clear-logs-button",onClick:n})}),t[2]=n,t[3]=o):o=t[3],t[4]!==e?(r=h.jsx("div",{className:"overflow-auto flex-1",children:h.jsx(C2,{logs:e,className:"min-w-[300px]"})}),t[4]=e,t[5]=r):r=t[5],t[6]!==o||t[7]!==r?(s=h.jsxs(h.Fragment,{children:[o,r]}),t[6]=o,t[7]=r,t[8]=s):s=t[8],s},C2=t=>{const e=X.c(10),{logs:n,className:o}=t;let r,s,i,a,l;return e[0]!==o?(r=Oe("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(MD),e[3]=n,e[4]=i):i=e[4],e[5]!==i?(a=h.jsx("pre",{className:"grid text-xs font-mono gap-1 whitespace-break-spaces font-semibold align-left",children:h.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=h.jsx("div",{className:r,children:a}),e[7]=r,e[8]=a,e[9]=l):l=e[9],l};function AD(t){const e=uV(t.timestamp),n=TD[t.level],o=t.level.toUpperCase();return h.jsxs(h.Fragment,{children:[h.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)] dark:text-[var(--gray-11)]",children:["[",e,"]"]}),h.jsx("span",{className:Oe("flex-shrink-0",n),children:o}),h.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)]",children:["(",h.jsx(pr,{cellId:t.cellId}),")"]}),t.message]})}const TD={stdout:"text-[var(--grass-9)]",stderr:"text-[var(--red-9)]"};function MD(t,e){return h.jsxs("div",{className:"contents group",children:[h.jsx("span",{className:Oe("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","text-right col-span-1 py-1 pr-1"),children:e+1}),h.jsx("span",{className:Oe("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","px-2 flex gap-x-1.5 py-1 flex-wrap"),children:AD(t)})]},e)}const OD=()=>{const t=X.c(5),{documentation:e}=He(hV);if(!e){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(In,{title:"View docs as you type",description:"Move your text cursor over a symbol to see its documentation.",icon:h.jsx(ed,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=Bp({html:e}),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=h.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};function N2(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}om=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(u,f){var p=A.useRef(null),_=A.useRef(null);_.current=f;var g=A.useRef(null);A.useEffect(function(){m()});var m=A.useCallback(function(){var b=g.current,x=_.current,y=b||(x?x instanceof Element?x:x.current:null);p.current&&p.current.element===y&&p.current.subscriber===u||(p.current&&p.current.cleanup&&p.current.cleanup(),p.current={element:y,subscriber:u,cleanup:y?u(y):void 0})},[u]);return A.useEffect(function(){return function(){p.current&&p.current.cleanup&&(p.current.cleanup(),p.current=null)}},[]),A.useCallback(function(b){g.current=b,m()},[m])}(A.useCallback(function(u){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 p=f[0],_=t.box==="border-box"?"borderBoxSize":t.box==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",g=N2(p,_,"inlineSize"),m=N2(p,_,"blockSize"),b=g?o(g):void 0,x=m?o(m):void 0;if(c.current.width!==b||c.current.height!==x){var y={width:b,height:x};c.current.width=b,c.current.height=x,n.current?n.current(y):l.current||a(y)}})}),r.current.instance.observe(u,{box:t.box}),function(){r.current&&r.current.instance.unobserve(u)}},[t.box,o]),t.ref);return A.useMemo(function(){return{ref:d,width:i.width,height:i.height}},[d,i.width,i.height])};const rf=new Map,DD=({file:t,onOpenNotebook:e})=>{const{theme:n}=Fo(),o=He(ip),[r,s]=A.useState(""),{data:i,loading:a,error:l,setData:c}=Xn(async()=>{const g=await V4({path:t.path}),m=g.contents||"";return s(rf.get(t.path)||m),g},[t.path]),d=async()=>{r!==(i==null?void 0:i.contents)&&await yV({path:t.path,contents:r}).then(g=>{g.success&&(c(m=>m?{...m,contents:r}:void 0),s(r))})},u=A.useRef(r);if(u.current=r,A.useEffect(()=>()=>{if(!(i!=null&&i.contents))return;const g=u.current;g===i.contents?rf.delete(t.path):rf.set(t.path,g)},[t.path,i==null?void 0:i.contents]),l)return h.jsx(Xs,{error:l});if(a||!i)return null;const f=i.mimeType||"text/plain",p=f in sf;if(!i.contents&&!p)return h.jsxs("div",{className:"grid grid-cols-2 gap-2 p-6",children:[h.jsx("div",{className:"font-bold text-muted-foreground",children:"Name"}),h.jsx("div",{children:i.file.name}),h.jsx("div",{className:"font-bold text-muted-foreground",children:"Type"}),h.jsx("div",{children:f})]});const _=h.jsxs("div",{className:"text-xs text-muted-foreground p-1 flex justify-end gap-2 border-b",children:[t.isMarimoFile&&!Bn()&&h.jsx(Re,{content:"Open notebook",children:h.jsx(xn,{size:"small",onClick:g=>e(g),children:h.jsx(bc,{})})}),h.jsx(Re,{content:"Download",children:h.jsx(xn,{size:"small",onClick:()=>{if(j2(f)){const g=_V(i.contents,f);bV(g,i.file.name)}else oa(new Blob([i.contents||r],{type:f}),i.file.name)},children:h.jsx(gp,{})})}),!j2(f)&&h.jsxs(h.Fragment,{children:[h.jsx(Re,{content:"Copy contents to clipboard",children:h.jsx(xn,{size:"small",onClick:async()=>{await yn(r)},children:h.jsx(Ls,{})})}),h.jsx(Re,{content:pn("global.save"),children:h.jsx(xn,{size:"small",color:r===i.contents?void 0:"green",onClick:d,disabled:r===i.contents,children:h.jsx(Na,{})})})]})]});return f.startsWith("image/")?h.jsxs(h.Fragment,{children:[_,h.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:h.jsx(fV,{base64:i.contents,mime:f})})]}):f==="text/csv"&&i.contents?h.jsxs(h.Fragment,{children:[_,h.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:h.jsx(pV,{contents:i.contents})})]}):f.startsWith("audio/")?h.jsxs(h.Fragment,{children:[_,h.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:h.jsx(mV,{base64:i.contents,mime:f})})]}):f.startsWith("video/")?h.jsxs(h.Fragment,{children:[_,h.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:h.jsx(gV,{base64:i.contents,mime:f})})]}):h.jsxs(h.Fragment,{children:[_,h.jsx("div",{className:"flex-1 overflow-auto",children:h.jsx(_a,{theme:n==="dark"?"dark":"light",language:sf[f]||sf.default,className:"border-b",extensions:[st.lineWrapping,Hn.of([{key:o.getHotkey("global.save").key,stopPropagation:!0,run:()=>r!==i.contents&&(d(),!0)}])],value:r,onChange:s})})]})},j2=t=>t.startsWith("image/")||t.startsWith("audio/")||t.startsWith("video/"),sf={"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"},E2=Zt(new class{constructor(t){this.callbacks=t,this.delegate=new Kp([]),this.rootPath="",this.onChange=jn.NOOP,this.path=new fp("/"),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 Kp(n.files),this.rootPath=n.root,this.path=fp.guessDeliminator(n.root)}catch(n){lt({title:"Failed",description:_4(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 Kp(i.files):this.delegate.update({id:s,changes:{children:i.files}})}this.onChange(this.delegate.data)},this.relativeFromRoot=e=>{const n=function(o){return o.endsWith("/")?o:`${o}/`}(this.rootPath);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:Q3,createFileOrFolder:$4,deleteFileOrFolder:wV,renameFileOrFolder:xV})),RD=Zt({});function PD(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 I2(t){const e=X.c(4);let n;e[0]!==t?(n=t===void 0?{}:t,e[0]=t,e[1]=n):n=e[1];const o=n;let r;return e[2]!==o?(r={multiple:!0,maxSize:104857600,onError:UD,onDropRejected:FD,onDrop:LD,...o},e[2]=o,e[3]=r):r=e[3],vV(r)}async function LD(t){for(const e of t){const n=(await PD(e)).split(",")[1];await $4({path:"",type:"file",name:e.name,contents:n})}await async function(){await ut.get(E2).refreshAll([])}()}function FD(t){lt({title:"File upload failed",description:h.jsx("div",{className:"flex flex-col gap-1",children:t.map(zD)}),variant:"danger"})}function zD(t){return h.jsxs("div",{children:[t.file.name," (",t.errors.map(BD).join(", "),")"]},t.file.name)}function BD(t){return t.message}function UD(t){Xt.error(t),lt({title:"File upload failed",description:t.message,variant:"danger"})}const A2=K.createContext(null),VD=t=>{const e=X.c(60),{height:n}=t,o=A.useRef(null),[r]=fn(E2);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}=Un(),[u,f]=fn(RD);let p,_;e[1]!==r?(p=()=>r.initialize(a),e[1]=r,e[2]=p):p=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(_=[],e[3]=_):_=e[3];const{loading:g,error:m}=Xn(p,_);let b;e[4]!==u||e[5]!==r?(b=()=>{r.refreshAll(Object.keys(u).filter(C=>u[C]))},e[4]=u,e[5]=r,e[6]=b):b=e[6];const x=Qe(b);let y;e[7]!==d||e[8]!==r?(y=async()=>{d({title:"Folder name",onConfirm:async C=>{r.createFolder(C,null)}})},e[7]=d,e[8]=r,e[9]=y):y=e[9];const v=Qe(y);let k;e[10]!==d||e[11]!==r?(k=async()=>{d({title:"File name",onConfirm:async C=>{r.createFile(C,null)}})},e[10]=d,e[11]=r,e[12]=k):k=e[12];const S=Qe(k);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 j=Qe(E);if(g){let C;return e[15]===Symbol.for("react.memo_cache_sentinel")?(C=h.jsx(Qn,{size:"medium",centered:!0}),e[15]=C):C=e[15],C}if(m){let C;return e[16]!==m?(C=h.jsx(Xs,{error:m}),e[16]=m,e[17]=C):C=e[17],C}if(l){let C,$,N,H,G,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")?($=h.jsx(Pe,{onClick:C,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:h.jsx(Et,{size:16})}),e[19]=$):$=e[19],e[20]!==l.name?(N=h.jsxs("div",{className:"flex items-center pl-1 pr-3 flex-shrink-0 border-b justify-between",children:[$,h.jsx("span",{className:"font-bold",children:l.name})]}),e[20]=l.name,e[21]=N):N=e[21],e[22]!==l.path||e[23]!==r?(H=q=>T2(q,r.relativeFromRoot(l.path)),e[22]=l.path,e[23]=r,e[24]=H):H=e[24],e[25]!==l||e[26]!==H?(G=h.jsx(A.Suspense,{children:h.jsx(DD,{onOpenNotebook:H,file:l})}),e[25]=l,e[26]=H,e[27]=G):G=e[27],e[28]!==N||e[29]!==G?(Z=h.jsxs(h.Fragment,{children:[N,G]}),e[28]=N,e[29]=G,e[30]=Z):Z=e[30],Z}let I;e[31]!==j||e[32]!==S||e[33]!==v||e[34]!==x||e[35]!==r?(I=h.jsx(HD,{onRefresh:x,onCreateFile:S,onCreateFolder:v,onCollapseAll:j,tree:r}),e[31]=j,e[32]=S,e[33]=v,e[34]=x,e[35]=r,e[36]=I):I=e[36];const T=n-33;let M,L,B,O,z,F,V,P;return e[37]!==r?(M=async C=>{const{ids:$}=C;for(const N of $)await r.delete(N)},L=async C=>{const{id:$,name:N}=C;await r.rename($,N)},B=async C=>{const{dragIds:$,parentId:N}=C;await r.move($,N)},e[37]=r,e[38]=M,e[39]=L,e[40]=B):(M=e[38],L=e[39],B=e[40]),e[41]===Symbol.for("react.memo_cache_sentinel")?(O=C=>{const $=C[0];$&&($.data.isDirectory||c($.data))},e[41]=O):O=e[41],e[42]!==u||e[43]!==f||e[44]!==r?(z=async C=>{if(await r.expand(C)){const $=u[C]??!1;f({...u,[C]:!$})}},e[42]=u,e[43]=f,e[44]=r,e[45]=z):z=e[45],e[46]!==i||e[47]!==u||e[48]!==M||e[49]!==L||e[50]!==B||e[51]!==z||e[52]!==T?(F=h.jsx(v$,{width:"100%",ref:o,height:T,className:"h-full",data:i,initialOpenState:u,openByDefault:!1,renderCursor:JD,disableDrop:KD,onDelete:M,onRename:L,onMove:B,onSelect:O,onToggle:z,padding:15,rowHeight:30,indent:$D,overscanCount:1e3,disableMultiSelection:!0,children:GD}),e[46]=i,e[47]=u,e[48]=M,e[49]=L,e[50]=B,e[51]=z,e[52]=T,e[53]=F):F=e[53],e[54]!==F||e[55]!==r?(V=h.jsx(A2.Provider,{value:r,children:F}),e[54]=F,e[55]=r,e[56]=V):V=e[56],e[57]!==V||e[58]!==I?(P=h.jsxs(h.Fragment,{children:[I,V]}),e[57]=V,e[58]=I,e[59]=P):P=e[59],P},$D=15,HD=t=>{const e=X.c(30),{onRefresh:n,onCreateFile:o,onCreateFolder:r,onCollapseAll:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={noDrag:!0,noDragEventsBubbling:!0},e[0]=i):i=e[0];const{getRootProps:a,getInputProps:l}=I2(i);let c,d,u,f,p,_,g,m,b,x,y,v,k,S,E;return e[1]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(Sa,{size:16}),e[1]=c):c=e[1],e[2]!==o?(d=h.jsx(Re,{content:"Add file",children:h.jsx(Pe,{"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")?(u=h.jsx(Gc,{size:16}),e[4]=u):u=e[4],e[5]!==r?(f=h.jsx(Re,{content:"Add folder",children:h.jsx(Pe,{"data-testid":"file-explorer-add-folder-button",onClick:r,variant:"text",size:"xs",children:u})}),e[5]=r,e[6]=f):f=e[6],e[7]!==a?(p=a({}),e[7]=a,e[8]=p):p=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(_=kV({variant:"text",size:"xs"}),g=h.jsx(SV,{size:16}),e[9]=_,e[10]=g):(_=e[9],g=e[10]),e[11]!==p?(m=h.jsx(Re,{content:"Upload file",children:h.jsx("button",{"data-testid":"file-explorer-upload-button",...p,className:_,children:g})}),e[11]=p,e[12]=m):m=e[12],e[13]!==l?(b=l({}),e[13]=l,e[14]=b):b=e[14],e[15]!==b?(x=h.jsx("input",{...b,type:"file"}),e[15]=b,e[16]=x):x=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(y=h.jsx(E4,{size:16}),e[17]=y):y=e[17],e[18]!==n?(v=h.jsx(Re,{content:"Refresh",children:h.jsx(Pe,{"data-testid":"file-explorer-refresh-button",onClick:n,variant:"text",size:"xs",children:y})}),e[18]=n,e[19]=v):v=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(k=h.jsx(um,{size:16}),e[20]=k):k=e[20],e[21]!==s?(S=h.jsx(Re,{content:"Collapse all folders",children:h.jsx(Pe,{"data-testid":"file-explorer-collapse-button",onClick:s,variant:"text",size:"xs",children:k})}),e[21]=s,e[22]=S):S=e[22],e[23]!==x||e[24]!==v||e[25]!==S||e[26]!==d||e[27]!==f||e[28]!==m?(E=h.jsxs("div",{className:"flex items-center justify-end px-2 flex-shrink-0 border-b",children:[d,f,m,x,v,S]}),e[23]=x,e[24]=v,e[25]=S,e[26]=d,e[27]=f,e[28]=m,e[29]=E):E=e[29],E},WD=t=>{const e=X.c(9),{node:n,onOpenMarimoFile:o}=t;let r,s,i;return e[0]!==n?(r=a=>{n.data.isDirectory||(a.stopPropagation(),n.select())},e[0]=n,e[1]=r):r=e[1],e[2]!==n.data.isMarimoFile||e[3]!==o?(s=n.data.isMarimoFile&&!Bn()&&h.jsxs("span",{className:"flex-shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline",onClick:o,children:["open ",h.jsx(bc,{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=h.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},qD=t=>{const e=X.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=h.jsx("input",{ref:o,className:"flex-1 bg-transparent border border-border text-muted-foreground",defaultValue:n.data.name,onClick:XD,onBlur:i,onKeyDown:a}),e[6]=n.data.name,e[7]=i,e[8]=a,e[9]=l):l=e[9],l},GD=t=>{const e=X.c(53),{node:n,style:o,dragHandle:r}=t;let s;e[0]!==n.data.isDirectory||e[1]!==n.data.name?(s=n.data.isDirectory?"directory":X3(n.data.name),e[0]=n.data.isDirectory,e[1]=n.data.name,e[2]=s):s=e[2];const i=s,a=Z3[i],{openConfirm:l,openPrompt:c}=Un(),d=A.useContext(A2);let u;e[3]!==n.data.path||e[4]!==d?(u=async F=>{T2(F,d?d.relativeFromRoot(n.data.path):n.data.path)},e[3]=n.data.path,e[4]=d,e[5]=u):u=e[5];const f=u;let p;e[6]!==n.data.name||e[7]!==n.id||e[8]!==n.tree||e[9]!==l?(p=async F=>{F.stopPropagation(),F.preventDefault(),l({title:"Delete file",description:`Are you sure you want to delete ${n.data.name}?`,confirmAction:h.jsx(F3,{onClick:async()=>{await n.tree.delete(n.id)},"aria-label":"Confirm",children:"Delete"})})},e[6]=n.data.name,e[7]=n.id,e[8]=n.tree,e[9]=l,e[10]=p):p=e[10];const _=p;let g;e[11]!==n||e[12]!==c||e[13]!==d?(g=async()=>{n.open(),c({title:"Folder name",onConfirm:async F=>{d==null||d.createFolder(F,n.id)}})},e[11]=n,e[12]=c,e[13]=d,e[14]=g):g=e[14];const m=Qe(g);let b;e[15]!==n||e[16]!==c||e[17]!==d?(b=async()=>{n.open(),c({title:"File name",onConfirm:async F=>{d==null||d.createFile(F,n.id)}})},e[15]=n,e[16]=c,e[17]=d,e[18]=b):b=e[18];const x=Qe(b);let y;e[19]!==i||e[20]!==x||e[21]!==m||e[22]!==_||e[23]!==f||e[24]!==n||e[25]!==d?(y=()=>{const F={size:14,strokeWidth:1.5,className:"mr-2"};return h.jsxs(pc,{align:"end",className:"no-print w-[220px]",onClick:ZD,onCloseAutoFocus:QD,children:[!n.data.isDirectory&&h.jsxs(sn,{onSelect:()=>n.select(),children:[h.jsx(Gm,{...F}),"Open file"]}),!n.data.isDirectory&&!Bn()&&h.jsxs(sn,{onSelect:()=>{CV({path:n.data.path})},children:[h.jsx(bc,{...F}),"Open file in external editor"]}),n.data.isDirectory&&h.jsxs(h.Fragment,{children:[h.jsxs(sn,{onSelect:()=>x(),children:[h.jsx(Sa,{...F}),"Create file"]}),h.jsxs(sn,{onSelect:()=>m(),children:[h.jsx(Gc,{...F}),"Create folder"]}),h.jsx(zo,{})]}),h.jsxs(sn,{onSelect:()=>n.edit(),children:[h.jsx(Om,{...F}),"Rename"]}),h.jsxs(sn,{onSelect:async()=>{await yn(n.data.path),lt({title:"Copied to clipboard"})},children:[h.jsx(Ls,{...F}),"Copy path"]}),d&&h.jsxs(sn,{onSelect:async()=>{await yn(d.relativeFromRoot(n.data.path)),lt({title:"Copied to clipboard"})},children:[h.jsx(Ls,{...F}),"Copy relative path"]}),h.jsxs(sn,{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:V}=n.data,P=jV[i](V);await yn(P)},children:[h.jsx(NV,{...F}),"Copy snippet for reading file"]}),n.data.isMarimoFile&&!Bn()&&h.jsxs(h.Fragment,{children:[h.jsx(zo,{}),h.jsxs(sn,{onSelect:f,children:[h.jsx(Vm,{...F}),"Open notebook"]})]}),h.jsx(zo,{}),!n.data.isDirectory&&h.jsxs(h.Fragment,{children:[h.jsxs(sn,{onSelect:async()=>{const V=(await V4({path:n.data.path})).contents||"";oa(new Blob([V]),n.data.name)},children:[h.jsx(gp,{...F}),"Download"]}),h.jsx(zo,{})]}),h.jsxs(sn,{onSelect:_,variant:"danger",children:[h.jsx(sp,{...F}),"Delete"]})]})},e[19]=i,e[20]=x,e[21]=m,e[22]=_,e[23]=f,e[24]=n,e[25]=d,e[26]=y):y=e[26];const v=y;let k,S,E;e[27]===Symbol.for("react.memo_cache_sentinel")?(k=Oe("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group"),e[27]=k):k=e[27],e[28]!==n?(S=F=>{F.stopPropagation(),n.data.isDirectory&&n.toggle()},E=h.jsx(YD,{node:n}),e[28]=n,e[29]=S,e[30]=E):(S=e[29],E=e[30]);const j=n.willReceiveDrop&&n.data.isDirectory&&"bg-accent/80 hover:bg-accent/80 text-accent-foreground";let I,T,M,L,B,O,z;return e[31]!==j?(I=Oe("flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group",j),e[31]=j,e[32]=I):I=e[32],e[33]!==a||e[34]!==n.data.isMarimoFile?(T=n.data.isMarimoFile?h.jsx("img",{src:"./favicon.ico",className:"w-5 h-5 flex-shrink-0 mr-2 filter grayscale",alt:"Marimo"}):h.jsx(a,{className:"w-5 h-5 flex-shrink-0 mr-2",strokeWidth:1.5}),e[33]=a,e[34]=n.data.isMarimoFile,e[35]=T):T=e[35],e[36]!==f||e[37]!==n?(M=n.isEditing?h.jsx(qD,{node:n}):h.jsx(WD,{node:n,onOpenMarimoFile:f}),e[36]=f,e[37]=n,e[38]=M):M=e[38],e[39]===Symbol.for("react.memo_cache_sentinel")?(L=h.jsx(fc,{asChild:!0,tabIndex:-1,onClick:eR,children:h.jsx(Pe,{"data-testid":"file-explorer-more-button",variant:"text",tabIndex:-1,size:"xs",className:"mb-0","aria-label":"More options",children:h.jsx(qc,{strokeWidth:2,className:"w-5 h-5 hidden group-hover:block"})})}),e[39]=L):L=e[39],e[40]!==v?(B=h.jsxs(hc,{modal:!1,children:[L,v()]}),e[40]=v,e[41]=B):B=e[41],e[42]!==I||e[43]!==T||e[44]!==M||e[45]!==B?(O=h.jsxs("span",{className:I,children:[T,M,B]}),e[42]=I,e[43]=T,e[44]=M,e[45]=B,e[46]=O):O=e[46],e[47]!==r||e[48]!==o||e[49]!==O||e[50]!==S||e[51]!==E?(z=h.jsxs("div",{style:o,ref:r,className:k,draggable:!0,onClick:S,children:[E,O]}),e[47]=r,e[48]=o,e[49]=O,e[50]=S,e[51]=E,e[52]=z):z=e[52],z},YD=t=>{const e=X.c(3),{node:n}=t;if(!n.data.isDirectory){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=h.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?h.jsx(Zi,{className:"w-5 h-5 flex-shrink-0"}):h.jsx(lc,{className:"w-5 h-5 flex-shrink-0"}),e[1]=n.isOpen,e[2]=o):o=e[2],o};function T2(t,e){t.stopPropagation(),t.preventDefault(),window.open(`/?file=${e}`,"_blank")}function JD(){return null}function KD(t){const{parentNode:e}=t;return!e.data.isDirectory}function XD(t){return t.stopPropagation()}function ZD(t){return t.stopPropagation()}function QD(t){return t.preventDefault()}function eR(t){return t.stopPropagation()}const tR=()=>{const t=X.c(20),{ref:e,height:n}=om(),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}=I2(r);let l,c,d,u,f,p,_,g;return t[1]!==s?(l=s(),t[1]=s,t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(c=Oe("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?(u=h.jsx("input",{...d}),t[6]=d,t[7]=u):u=t[7],t[8]!==a?(f=a&&h.jsx("div",{className:"absolute inset-0 flex items-center uppercase justify-center text-xl font-bold text-primary/90 bg-accent/85 z-10 border-2 border-dashed border-primary/90 rounded-lg pointer-events-none",children:"Drop files here"}),t[8]=a,t[9]=f):f=t[9],t[10]!==o?(p=h.jsx(VD,{height:o}),t[10]=o,t[11]=p):p=t[11],t[12]!==e||t[13]!==p?(_=h.jsx("div",{ref:e,className:"flex flex-col flex-1 overflow-hidden",children:p}),t[12]=e,t[13]=p,t[14]=_):_=t[14],t[15]!==l||t[16]!==u||t[17]!==f||t[18]!==_?(g=h.jsxs("div",{...l,className:c,children:[u,f,_]}),t[15]=l,t[16]=u,t[17]=f,t[18]=_,t[19]=g):g=t[19],g},nR=t=>{const e=X.c(6),{children:n}=t,{openModal:o,closeModal:r}=Un();let s,i;return e[0]!==r||e[1]!==o?(s=()=>o(h.jsx(rR,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(i=h.jsx(P4,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=i):i=e[5],i},oR=[st.lineWrapping],rR=t=>{const e=X.c(23),{onClose:n}=t,[o,r]=A.useState(""),{theme:s}=Fo();let i,a,l,c,d,u;e[0]!==n?(i=async y=>{y.preventDefault();const v=new FormData(y.target),k=v.get("title"),S=v.get("description"),E=v.get("code");fetch("https://marimo.io/api/suggest-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:k,description:S,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=h.jsx(dr,{children:"Contribute a Snippet"}),e[2]=a):a=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsxs(Os,{children:[a,h.jsxs(Ps,{children:["Have a useful snippet you want to share with the community? Submit it here or make a pull request"," ",h.jsx("a",{href:Kn.githubPage,target:"_blank",className:"underline",children:"on GitHub"}),"."]})]}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(ur,{id:"title",name:"title",autoFocus:!0,placeholder:"Title",required:!0,autoComplete:"off"}),d=h.jsx(EV,{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?(u=h.jsx("input",{type:"hidden",name:"code",value:o}),e[6]=o,e[7]=u):u=e[7];const f=s==="dark"?"dark":"light";let p,_,g,m,b,x;return e[8]!==o||e[9]!==f?(p=h.jsx(_a,{theme:f,language:"python",className:"cm border rounded overflow-hidden",extensions:oR,value:o,onChange:r}),e[8]=o,e[9]=f,e[10]=p):p=e[10],e[11]!==u||e[12]!==p?(_=h.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[c,d,u,p]}),e[11]=u,e[12]=p,e[13]=_):_=e[13],e[14]!==n?(g=h.jsx(Pe,{"data-testid":"snippet-cancel-button",variant:"secondary",onClick:n,children:"Cancel"}),e[14]=n,e[15]=g):g=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(m=h.jsx(Pe,{"data-testid":"snippet-send-button","aria-label":"Save",variant:"default",type:"submit",children:"Send"}),e[16]=m):m=e[16],e[17]!==g?(b=h.jsxs(ea,{children:[g,m]}),e[17]=g,e[18]=b):b=e[18],e[19]!==i||e[20]!==b||e[21]!==_?(x=h.jsx(cr,{className:"w-fit",children:h.jsxs("form",{onSubmit:i,children:[l,_,b]})}),e[19]=i,e[20]=b,e[21]=_,e[22]=x):x=e[22],x},sR=[st.lineWrapping],iR=()=>{const t=X.c(20),[e,n]=K.useState();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const{data:r,error:s,loading:i}=Xn(cR,o);if(s){let b;return t[1]!==s?(b=h.jsx(Xs,{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=h.jsx(Qn,{size:"medium",centered:!0}),t[3]=b):b=t[3],b}const a=e?"h-1/3":"h-full";let l,c,d,u,f,p,_,g,m;return t[4]!==a?(l=Oe("border-b rounded-none",a),t[4]=a,t[5]=l):l=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(Qi,{placeholder:"Search snippets...",className:"h-6 m-1",rootClassName:"flex-1 border-r"}),t[6]=c):c=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsxs("div",{className:"flex items-center w-full",children:[c,h.jsx(nR,{children:h.jsx("button",{className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:h.jsx(Lr,{className:"h-4 w-4"})})})]}),u=h.jsx(dc,{children:"No results"}),t[7]=d,t[8]=u):(d=t[7],u=t[8]),t[9]===Symbol.for("react.memo_cache_sentinel")?(f=b=>n(b),t[9]=f):f=t[9],t[10]!==r.snippets?(p=h.jsx(lR,{onSelect:f,snippets:r.snippets}),t[10]=r.snippets,t[11]=p):p=t[11],t[12]!==l||t[13]!==p?(_=h.jsxs(xc,{className:l,children:[d,u,p]}),t[12]=l,t[13]=p,t[14]=_):_=t[14],t[15]!==e?(g=h.jsx(A.Suspense,{children:h.jsx("div",{className:"h-2/3 snippet-viewer flex flex-col",children:e?h.jsx(aR,{snippet:e},e.title):h.jsx(In,{title:"",description:"Click on a snippet to view its content."})})}),t[15]=e,t[16]=g):g=t[16],t[17]!==_||t[18]!==g?(m=h.jsxs("div",{className:"flex-1 overflow-hidden",children:[_,g]}),t[17]=_,t[18]=g,t[19]=m):m=t[19],m},aR=t=>{const e=X.c(27),{snippet:n}=t,{theme:o}=Fo(),{createNewCell:r}=Lt(),s=zs();let i;e[0]!==r||e[1]!==s||e[2]!==n.sections?(i=()=>{for(const m of[...n.sections].reverse())m.code&&r({code:m.code,before:!1,cellId:s??"__end__",skipIfCodeExists:!0})},e[0]=r,e[1]=s,e[2]=n.sections,e[3]=i):i=e[3];const a=i;let l;e[4]!==r||e[5]!==s?(l=m=>{r({code:m,before:!1,cellId:s??"__end__"})},e[4]=r,e[5]=s,e[6]=l):l=e[6];const c=l;let d,u,f,p,_,g;if(e[7]!==n.title?(d=h.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")?(u=h.jsx(ti,{className:"ml-2 h-4 w-4"}),e[9]=u):u=e[9],e[10]!==a?(f=h.jsx("div",{className:"flex justify-end",children:h.jsx(ri,{children:h.jsxs(Pe,{className:"float-right",size:"xs",variant:"outline",onClick:a,children:["Insert snippet",u]})})}),e[10]=a,e[11]=f):f=e[11],e[12]!==c||e[13]!==n.sections||e[14]!==n.title||e[15]!==o){let m;e[17]!==c||e[18]!==n.title||e[19]!==o?(m=b=>{const{code:x,html:y,id:v}=b;return y?h.jsx("div",{children:Bp({html:y})},`${n.title}-${v}`):x?h.jsxs("div",{className:"relative hover-actions-parent pr-2",children:[h.jsx(ri,{children:h.jsx(Re,{content:"Insert snippet",children:h.jsx(Pe,{className:"absolute -top-2 -right-1 z-10 hover-action px-2 bg-background",size:"sm",variant:"outline",onClick:()=>{c(x)},children:h.jsx(ti,{className:"h-5 w-5"})})})}),h.jsx(_a,{theme:o==="dark"?"dark":"light",language:"python",className:"cm border rounded overflow-hidden",extensions:sR,value:x,readOnly:!0},`${n.title}-${v}`)]},`${n.title}-${v}`):null},e[17]=c,e[18]=n.title,e[19]=o,e[20]=m):m=e[20],p=n.sections.map(m),e[12]=c,e[13]=n.sections,e[14]=n.title,e[15]=o,e[16]=p}else p=e[16];return e[21]!==f||e[22]!==p?(_=h.jsxs("div",{className:"px-2 py-2 space-y-4 overflow-auto flex-1",children:[f,p]}),e[21]=f,e[22]=p,e[23]=_):_=e[23],e[24]!==d||e[25]!==_?(g=h.jsxs(h.Fragment,{children:[d,_]}),e[24]=d,e[25]=_,e[26]=g):g=e[26],g},lR=t=>{const e=X.c(7),{snippets:n,onSelect:o}=t;let r,s;if(e[0]!==o||e[1]!==n){let i;e[3]!==o?(i=a=>h.jsx(po,{className:"rounded-none",onSelect:()=>o(a),children:h.jsx("div",{className:"flex flex-row gap-2 items-center",children:h.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=h.jsx(Ap,{className:"flex flex-col overflow-auto",children:r}),e[5]=r,e[6]=s):s=e[6],s};function cR(){return IV()}const dR=t=>{const e=X.c(8),{variableName:n,className:o}=t;let r;e[0]!==n?(r=()=>{const l=function(d){const u=ut.get(H4)[d];if(u)return u.declaredBy[0]}(n);if(!l)return;const c=rc(l);c&&$p(c,n)},e[0]=n,e[1]=r):r=e[1];const s=r;let i,a;return e[2]!==o?(i=Oe("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=h.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},uR=Zt(t=>{const e=t(AV),n=t(H4),o=t(D4);return xa(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})}),hR=Zt(t=>{const e=new Map(t(TV));for(const n of W4){const o=e.get(n);o&&o.databases.length===0&&e.delete(n)}return xa([...e.values()],n=>W4.has(n.name)?1:0)}),fR=()=>{const t=X.c(32),[e,n]=K.useState(""),o=Qt(q4),r=He(uR),s=He(hR);if(r.length===0&&s.length===0){let b;return t[0]===Symbol.for("react.memo_cache_sentinel")?(b=h.jsx(In,{title:"No tables found",description:"Any datasets/dataframes in the global scope will be shown here.",action:h.jsx(jg,{children:h.jsxs(Pe,{variant:"outline",size:"sm",children:["Add database or catalog",h.jsx(Lr,{className:"h-4 w-4 ml-2"})]})}),icon:h.jsx(lr,{})}),t[0]=b):b=t[0],b}const i=!!e.trim();let a,l,c,d,u,f,p,_,g,m;if(t[1]!==o?(a=b=>{o(b.length>0),n(b)},t[1]=o,t[2]=a):a=t[2],t[3]!==e||t[4]!==a?(l=h.jsx(Qi,{placeholder:"Search tables...",className:"h-6 m-1",value:e,onValueChange:a,rootClassName:"flex-1 border-r"}),t[3]=e,t[4]=a,t[5]=l):l=t[5],t[6]!==i?(c=i&&h.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:h.jsx(go,{className:"h-4 w-4"})}),t[6]=i,t[7]=c):c=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsx(jg,{children:h.jsx("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:h.jsx(Lr,{className:"h-4 w-4"})})}),t[8]=d):d=t[8],t[9]!==l||t[10]!==c?(u=h.jsxs("div",{className:"flex items-center w-full",children:[l,c,d]}),t[9]=l,t[10]=c,t[11]=u):u=t[11],t[12]!==s||t[13]!==i||t[14]!==e){let b;t[16]!==i||t[17]!==e?(b=x=>h.jsx(pR,{connection:x,hasChildren:x.databases.length>0,children:x.databases.map(y=>h.jsx(mR,{engineName:x.name,database:y,hasSearch:i,children:h.jsx(gR,{schemas:y.schemas,defaultSchema:x.default_schema,defaultDatabase:x.default_database,engineName:x.name,databaseName:y.name,hasSearch:i,searchValue:e})},y.name))},x.name),t[16]=i,t[17]=e,t[18]=b):b=t[18],f=s.map(b),t[12]=s,t[13]=i,t[14]=e,t[15]=f}else f=t[15];return t[19]!==s.length||t[20]!==r.length?(p=s.length>0&&r.length>0&&h.jsxs(G4,{children:[h.jsx(ac,{className:"h-4 w-4 text-muted-foreground"}),h.jsx("span",{className:"text-xs",children:"Python"})]}),t[19]=s.length,t[20]=r.length,t[21]=p):p=t[21],t[22]!==e||t[23]!==r?(_=r.length>0&&h.jsx(M2,{tables:r,searchValue:e}),t[22]=e,t[23]=r,t[24]=_):_=t[24],t[25]!==f||t[26]!==p||t[27]!==_?(g=h.jsxs(Ap,{className:"flex flex-col",children:[f,p,_]}),t[25]=f,t[26]=p,t[27]=_,t[28]=g):g=t[28],t[29]!==u||t[30]!==g?(m=h.jsxs(xc,{className:"border-b bg-background rounded-none h-full pb-10 overflow-auto outline-none",shouldFilter:!1,children:[u,g]}),t[29]=u,t[30]=g,t[31]=m):m=t[31],m},pR=t=>{const e=X.c(25),{connection:n,children:o,hasChildren:r}=t,s=n.name===MV,i=s?"In-Memory":n.name,[a,l]=K.useState(!1);let c;e[0]!==n.name?(c=async()=>{l(!0),await DV({engine:n.name}),setTimeout(()=>l(!1),500)},e[0]=n.name,e[1]=c):c=e[1];const d=c;let u,f,p;e[2]!==n.dialect?(u=h.jsx(q3,{className:"h-4 w-4 text-muted-foreground",name:n.dialect}),e[2]=n.dialect,e[3]=u):u=e[3],e[4]!==n.dialect?(f=OV(n.dialect),e[4]=n.dialect,e[5]=f):f=e[5],e[6]!==f?(p=h.jsx("span",{className:"text-xs",children:f}),e[6]=f,e[7]=p):p=e[7];const _=i;let g,m,b,x,y;return e[8]!==_?(g=h.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",h.jsx(dR,{variableName:_}),")"]}),e[8]=_,e[9]=g):g=e[9],e[10]!==d||e[11]!==s||e[12]!==a?(m=!s&&h.jsx(Re,{content:"Refresh connection",children:h.jsx(Pe,{variant:"ghost",size:"icon",className:"ml-auto hover:bg-transparent hover:shadow-none",onClick:d,children:h.jsx(Ic,{className:Oe("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]=m):m=e[13],e[14]!==u||e[15]!==p||e[16]!==g||e[17]!==m?(b=h.jsxs(G4,{children:[u,p,g,m]}),e[14]=u,e[15]=p,e[16]=g,e[17]=m,e[18]=b):b=e[18],e[19]!==o||e[20]!==r?(x=r?o:h.jsx(Yp,{content:"No databases available",className:"pl-2"}),e[19]=o,e[20]=r,e[21]=x):x=e[21],e[22]!==b||e[23]!==x?(y=h.jsxs(h.Fragment,{children:[b,x]}),e[22]=b,e[23]=x,e[24]=y):y=e[24],y},mR=t=>{const e=X.c(28),{hasSearch:n,engineName:o,database:r,children:s}=t,[i,a]=K.useState(!1),[l,c]=K.useState(!1);let d,u,f;e[0]!==n?(d=()=>{a(n)},u=[n],e[0]=n,e[1]=d,e[2]=u):(d=e[1],u=e[2]),K.useEffect(d,u),e[3]!==i||e[4]!==l?(f=()=>{a(!i),c(!l)},e[3]=i,e[4]=l,e[5]=f):f=e[5];const p=`${o}:${r.name}`;let _;e[6]!==i?(_=h.jsx(Z4,{isExpanded:i}),e[6]=i,e[7]=_):_=e[7];const g=l&&i?"text-foreground":"text-muted-foreground";let m,b;e[8]!==g?(m=Oe("h-4 w-4",g),e[8]=g,e[9]=m):m=e[9],e[10]!==m?(b=h.jsx(lr,{className:m}),e[10]=m,e[11]=b):b=e[11];const x=l&&i&&"font-semibold";let y,v,k,S;e[12]!==x?(y=Oe(x),e[12]=x,e[13]=y):y=e[13],e[14]!==r.name?(v=r.name===""?h.jsx("i",{children:"Not connected"}):r.name,e[14]=r.name,e[15]=v):v=e[15],e[16]!==y||e[17]!==v?(k=h.jsx("span",{className:y,children:v}),e[16]=y,e[17]=v,e[18]=k):k=e[18],e[19]!==k||e[20]!==f||e[21]!==p||e[22]!==_||e[23]!==b?(S=h.jsxs(po,{className:"text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",onSelect:f,value:p,children:[_,b,k]}),e[19]=k,e[20]=f,e[21]=p,e[22]=_,e[23]=b,e[24]=S):S=e[24];const E=i&&s;let j;return e[25]!==S||e[26]!==E?(j=h.jsxs(h.Fragment,{children:[S,E]}),e[25]=S,e[26]=E,e[27]=j):j=e[27],j},gR=t=>{const e=X.c(20),{schemas:n,defaultSchema:o,defaultDatabase:r,engineName:s,databaseName:i,hasSearch:a,searchValue:l}=t;if(n.length===0){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=h.jsx(Yp,{content:"No schemas available",className:"pl-6"}),e[0]=u):u=e[0],u}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 u;e[9]!==l?(u=_=>!l||_.tables.some(g=>g.name.toLowerCase().includes(l.toLowerCase())),e[9]=l,e[10]=u):u=e[10];const f=n.filter(u);let p;e[11]!==i||e[12]!==r||e[13]!==o||e[14]!==s||e[15]!==a||e[16]!==l?(p=_=>h.jsx(_R,{databaseName:i,schema:_,hasSearch:a,children:h.jsx(M2,{tables:_.tables,searchValue:l,sqlTableContext:{engine:s,database:i,schema:_.name,defaultSchema:o,defaultDatabase:r}})},_.name),e[11]=i,e[12]=r,e[13]=o,e[14]=s,e[15]=a,e[16]=l,e[17]=p):p=e[17],c=f.map(p),e[1]=i,e[2]=r,e[3]=o,e[4]=s,e[5]=a,e[6]=n,e[7]=l,e[8]=c}else c=e[8];return e[18]!==c?(d=h.jsx(h.Fragment,{children:c}),e[18]=c,e[19]=d):d=e[19],d},_R=t=>{const e=X.c(26),{databaseName:n,schema:o,children:r,hasSearch:s}=t,[i,a]=K.useState(!1),[l,c]=K.useState(!1),d=`${n}:${o.name}`;let u,f,p,_;if(e[0]!==s?(u=()=>{a(s)},f=[s],e[0]=s,e[1]=u,e[2]=f):(u=e[1],f=e[2]),K.useEffect(u,f),X4(o.name))return r;e[3]!==i||e[4]!==l?(p=()=>{a(!i),c(!l)},e[3]=i,e[4]=l,e[5]=p):p=e[5],e[6]!==i?(_=h.jsx(Z4,{isExpanded:i}),e[6]=i,e[7]=_):_=e[7];const g=l&&i&&"text-foreground";let m,b;e[8]!==g?(m=Oe("h-4 w-4 text-muted-foreground",g),e[8]=g,e[9]=m):m=e[9],e[10]!==m?(b=h.jsx(UV,{className:m}),e[10]=m,e[11]=b):b=e[11];const x=l&&i&&"font-semibold";let y,v,k;e[12]!==x?(y=Oe(x),e[12]=x,e[13]=y):y=e[13],e[14]!==o.name||e[15]!==y?(v=h.jsx("span",{className:y,children:o.name}),e[14]=o.name,e[15]=y,e[16]=v):v=e[16],e[17]!==v||e[18]!==p||e[19]!==_||e[20]!==b||e[21]!==d?(k=h.jsxs(po,{className:"text-sm flex flex-row gap-1 items-center pl-5 cursor-pointer rounded-none",onSelect:p,value:d,children:[_,b,v]}),e[17]=v,e[18]=p,e[19]=_,e[20]=b,e[21]=d,e[22]=k):k=e[22];const S=i&&r;let E;return e[23]!==k||e[24]!==S?(E=h.jsxs(h.Fragment,{children:[k,S]}),e[23]=k,e[24]=S,e[25]=E):E=e[25],E},M2=t=>{const e=X.c(24),{tables:n,sqlTableContext:o,searchValue:r}=t,{addTableList:s}=Y4(),[i,a]=K.useState(!1),[l,c]=K.useState(!1);let d,u;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:m,database:b,schema:x}=o,y=await H$.request({engine:m,database:b,schema:x});if(!(y!=null&&y.tables))throw c(!1),new Error("No tables available");s({tables:y.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?(u=[n.length,o,i],e[5]=o,e[6]=n.length,e[7]=i,e[8]=u):u=e[8];const{loading:f,error:p}=Xn(d,u);if(f||l){let m;return e[9]===Symbol.for("react.memo_cache_sentinel")?(m=h.jsx(J4,{message:"Loading tables...",className:"pl-12"}),e[9]=m):m=e[9],m}if(p){let m;return e[10]!==p?(m=h.jsx(K4,{error:p,className:"pl-12"}),e[10]=p,e[11]=m):m=e[11],m}if(n.length===0){let m;return e[12]===Symbol.for("react.memo_cache_sentinel")?(m=h.jsx(Yp,{content:"No tables found",className:"pl-9"}),e[12]=m):m=e[12],m}let _,g;if(e[13]!==r||e[14]!==o||e[15]!==n){let m;e[17]!==r?(m=y=>!r||y.name.toLowerCase().includes(r.toLowerCase()),e[17]=r,e[18]=m):m=e[18];const b=n.filter(m);let x;e[19]!==r||e[20]!==o?(x=y=>h.jsx(bR,{table:y,sqlTableContext:o,isSearching:!!r},y.name),e[19]=r,e[20]=o,e[21]=x):x=e[21],_=b.map(x),e[13]=r,e[14]=o,e[15]=n,e[16]=_}else _=e[16];return e[22]!==_?(g=h.jsx(h.Fragment,{children:_}),e[22]=_,e[23]=g):g=e[23],g},bR=t=>{const e=X.c(62),{table:n,sqlTableContext:o,isSearching:r}=t,{addTable:s}=Y4(),[i,a]=K.useState(!1),[l,c]=K.useState(!1),d=n.columns.length>0;let u,f;e[0]!==s||e[1]!==i||e[2]!==o||e[3]!==n.name||e[4]!==d||e[5]!==l?(u=async()=>{if(i&&!d&&o&&!l){c(!0);const{engine:q,database:re,schema:ne}=o,oe=await W$.request({engine:q,database:re,schema:ne,tableName:n.name});if(!(oe!=null&&oe.table))throw new Error("No table details available");s({table:oe.table,sqlTableContext:o})}},e[0]=s,e[1]=i,e[2]=o,e[3]=n.name,e[4]=d,e[5]=l,e[6]=u):u=e[6],e[7]!==i||e[8]!==d?(f=[i,d],e[7]=i,e[8]=d,e[9]=f):f=e[9];const{loading:p,error:_}=Xn(u,f),g=He(Ts),m=zs(),{createNewCell:b}=Lt();let x;e[10]!==g||e[11]!==b||e[12]!==m||e[13]!==o||e[14]!==n?(x=()=>{ar(g,b,m),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 Q4(n,"*",o);switch(n.source_type){case"local":return`mo.ui.table(${n.name})`;case"duckdb":case"connection":return Q4(n,"*",o);default:return oc(n.source_type),""}})(),before:!1,cellId:m??"__end__"})},e[10]=g,e[11]=b,e[12]=m,e[13]=o,e[14]=n,e[15]=x):x=e[15];const y=x;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:h.jsx("div",{className:"flex flex-row gap-2 items-center pl-6 group-hover:hidden",children:h.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 k=v;let S;e[19]!==_||e[20]!==p||e[21]!==o||e[22]!==n?(S=()=>p?h.jsx(J4,{message:"Loading columns...",className:"pl-12"}):_?h.jsx(K4,{error:_,className:"pl-12"}):n.columns.map(q=>h.jsx(yR,{table:n,column:q,sqlTableContext:o},q.name)),e[19]=_,e[20]=p,e[21]=o,e[22]=n,e[23]=S):S=e[23];const E=S;let j;e[24]!==i||e[25]!==r||e[26]!==n.source_type||e[27]!==n.type?(j=()=>{if(n.source_type==="local")return;const q=n.type==="table"?RV:T3;return h.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]=j):j=e[28];const I=j,T=o?`${o.database}.${o.schema}.${n.name}`:n.name,M=o&&(X4(o.schema)?"pl-9":"pl-12"),L=(i||r)&&"font-semibold";let B,O,z,F,V,P,C,$,N,H,G,Z;return e[29]!==M||e[30]!==L?(B=Oe("rounded-none group h-8 cursor-pointer",M,L),e[29]=M,e[30]=L,e[31]=B):B=e[31],e[32]!==i?(O=()=>a(!i),e[32]=i,e[33]=O):O=e[33],e[34]!==I?(z=I(),e[34]=I,e[35]=z):z=e[35],e[36]!==n.name?(F=h.jsx("span",{className:"text-sm",children:n.name}),e[36]=n.name,e[37]=F):F=e[37],e[38]!==z||e[39]!==F?(V=h.jsxs("div",{className:"flex gap-2 items-center flex-1",children:[z,F]}),e[38]=z,e[39]=F,e[40]=V):V=e[40],e[41]!==k?(P=k(),e[41]=k,e[42]=P):P=e[42],e[43]!==y?(C=Vn.stopPropagation(()=>y()),e[43]=y,e[44]=C):C=e[44],e[45]===Symbol.for("react.memo_cache_sentinel")?($=h.jsx(PV,{className:"h-3 w-3"}),e[45]=$):$=e[45],e[46]!==C?(N=h.jsx(Re,{content:"Add table to notebook",delayDuration:400,children:h.jsx(Pe,{className:"group-hover:inline-flex hidden",variant:"text",size:"icon",onClick:C,children:$})}),e[46]=C,e[47]=N):N=e[47],e[48]!==i||e[49]!==O||e[50]!==V||e[51]!==P||e[52]!==N||e[53]!==B||e[54]!==T?(H=h.jsxs(po,{className:B,value:T,"aria-selected":i,forceMount:!0,onSelect:O,children:[V,P,N]}),e[48]=i,e[49]=O,e[50]=V,e[51]=P,e[52]=N,e[53]=B,e[54]=T,e[55]=H):H=e[55],e[56]!==i||e[57]!==E?(G=i&&E(),e[56]=i,e[57]=E,e[58]=G):G=e[58],e[59]!==H||e[60]!==G?(Z=h.jsxs(h.Fragment,{children:[H,G]}),e[59]=H,e[60]=G,e[61]=Z):Z=e[61],Z},yR=t=>{var G,Z;const e=X.c(53),{table:n,column:o,sqlTableContext:r}=t,[s,i]=K.useState(!1),a=He(q4),l=Qt(LV);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]),K.useEffect(c,d),l(s?q=>new Set([...q,`${n.name}:${o.name}`]):q=>(q.delete(`${n.name}:${o.name}`),new Set(q)));const u=He(Ts),f=zs(),{createNewCell:p}=Lt(),{columnsPreviews:_}=FV();let g;e[3]!==o.name||e[4]!==n.primary_keys?(g=((G=n.primary_keys)==null?void 0:G.includes(o.name))||!1,e[3]=o.name,e[4]=n.primary_keys,e[5]=g):g=e[5];const m=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 x=b;let y;e[9]!==u||e[10]!==p||e[11]!==f?(y=q=>{q.includes("alt")&&VV(u,p,f),p({code:q,before:!1,cellId:f??"__end__"})},e[9]=u,e[10]=p,e[11]=f,e[12]=y):y=e[12];const v=y,k=xR,S=s?"font-semibold":"";let E;e[13]!==o.name||e[14]!==S?(E=h.jsx("span",{className:S,children:o.name}),e[13]=o.name,e[14]=S,e[15]=E):E=e[15];const j=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 L=r?"pl-14":"pl-7";let B,O,z,F,V,P,C,$,N,H;return e[18]!==L?(B=Oe("flex flex-row gap-2 items-center flex-1",L),e[18]=L,e[19]=B):B=e[19],e[20]!==o.type||e[21]!==j?(O=h.jsx(zV,{columnName:j,dataType:o.type}),e[20]=o.type,e[21]=j,e[22]=O):O=e[22],e[23]!==m?(z=m&&k({tooltipContent:"Primary key",content:"PK"}),e[23]=m,e[24]=z):z=e[24],e[25]!==x?(F=x&&k({tooltipContent:"Indexed",content:"IDX"}),e[25]=x,e[26]=F):F=e[26],e[27]!==B||e[28]!==O||e[29]!==z||e[30]!==F?(V=h.jsxs("div",{className:B,children:[O,z,F]}),e[27]=B,e[28]=O,e[29]=z,e[30]=F,e[31]=V):V=e[31],e[32]!==o.name?(P=h.jsx(Re,{content:"Copy column name",delayDuration:400,children:h.jsx(Pe,{variant:"text",size:"icon",className:"group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground",children:h.jsx(eS,{tooltip:!1,value:o.name,className:"h-3 w-3"})})}),e[32]=o.name,e[33]=P):P=e[33],e[34]!==o.external_type?(C=h.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]!==P||e[39]!==C||e[40]!==I||e[41]!==T?($=h.jsxs(po,{className:"rounded-none py-1 group cursor-pointer",value:T,onSelect:M,children:[V,P,C]},I),e[36]=M,e[37]=V,e[38]=P,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?(N=s&&h.jsx("div",{className:"pl-10 pr-2 py-2 bg-[var(--slate-1)] shadow-inner border-b",children:h.jsx(wc,{children:h.jsx(BV,{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]=N):N=e[49],e[50]!==$||e[51]!==N?(H=h.jsxs(h.Fragment,{children:[$,N]}),e[50]=$,e[51]=N,e[52]=H):H=e[52],H};function xR(t){const{tooltipContent:e,content:n}=t;return h.jsx(Re,{content:e,delayDuration:100,children:h.jsx("span",{className:"text-xs text-black bg-gray-100 dark:invert rounded px-1",children:n})})}const wR=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=h.jsx(fR,{}),t[0]=e):e=t[0],e},vR=t=>{const e=X.c(4),{isOpen:n,children:o}=t,[r,s]=K.useState(!1);let i,a;return e[0]!==r||e[1]!==n?(i=()=>{n&&!r&&s(!0)},a=[n,r],e[0]=r,e[1]=n,e[2]=i,e[3]=a):(i=e[2],a=e[3]),K.useEffect(i,a),r?o:null},af=I3("marimo:scratchpadHistory:v1",[]),kR=Zt(!1),SR=Zt(null,(t,e,n)=>{if(!(n=n.trim()))return;const o=t(af),r=[n,...o.filter(s=>s!==n)].slice(0,15);e(af,r)}),CR={hide_code:!1,disabled:!1},NR=()=>{const t=X.c(69),e=vc(),[n]=Ds(),{theme:o}=Fo(),r=A.useRef(null),s=zs(),{createNewCell:i,updateCellCode:a}=Lt(),l=e.cellRuntime[mr],c=l==null?void 0:l.output,d=l==null?void 0:l.status,u=l==null?void 0:l.consoleOutputs,f=e.cellData[mr],p=(f==null?void 0:f.code)??"",_=Qt(SR),[g,m]=fn(kR),b=He(af);let x;t[0]!==_||t[1]!==p?(x=()=>{tS({code:p}),_(p)},t[0]=_,t[1]=p,t[2]=x):x=t[2];const y=Qe(x);let v;t[3]!==p||t[4]!==i||t[5]!==s?(v=()=>{p.trim()&&i({code:p,before:!1,cellId:s??"__end__"})},t[3]=p,t[4]=i,t[5]=s,t[6]=v):v=t[6];const k=Qe(v);let S;t[7]!==a?(S=()=>{a({cellId:mr,code:"",formattingChange:!1}),tS({code:""});const ae=r.current;ae&&ae.dispatch({changes:{from:0,to:ae.state.doc.length,insert:""}})},t[7]=a,t[8]=S):S=t[8];const E=Qe(S);let j;t[9]!==m||t[10]!==a?(j=ae=>{m(!1),a({cellId:mr,code:ae,formattingChange:!1});const ve=r.current;ve&&ve.dispatch({changes:{from:0,to:ve.state.doc.length,insert:ae}})},t[9]=m,t[10]=a,t[11]=j):j=t[11];const I=Qe(j),[T,M]=A.useState();let L;t[12]!==p||t[13]!==u||t[14]!==y||t[15]!==T||t[16]!==c||t[17]!==o||t[18]!==n?(L=()=>h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[40%]",children:h.jsx(Lu,{theme:o,allowFocus:!1,showPlaceholder:!1,id:mr,code:p,config:CR,status:"idle",serializedEditorState:null,runCell:y,userConfig:n,editorViewRef:r,setEditorView:ae=>{r.current=ae},hidden:!1,temporarilyShowCode:jn.NOOP,languageAdapter:T,setLanguageAdapter:M})}),h.jsx("div",{className:"flex-1 overflow-auto flex-shrink-0",children:h.jsx(Rc,{allowExpand:!1,output:c,className:"output-area",cellId:mr,stale:!1,loading:!1})}),h.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[35%]",children:h.jsx(Zp,{consoleOutputs:u,className:"overflow-auto",stale:!1,cellName:$V,onSubmitDebugger:jn.NOOP,cellId:mr,debuggerActive:!1})})]}),t[12]=p,t[13]=u,t[14]=y,t[15]=T,t[16]=c,t[17]=o,t[18]=n,t[19]=L):L=t[19];const B=L;let O;t[20]!==I||t[21]!==b||t[22]!==g||t[23]!==o?(O=()=>g?h.jsx("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:h.jsx("div",{className:"overflow-auto flex flex-col gap-3",children:b.map((ae,ve)=>h.jsx("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>I(ae),children:h.jsx(_a,{language:"python",theme:o,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:ae.trim(),editable:!1,readOnly:!0})},ve))})}):null,t[20]=I,t[21]=b,t[22]=g,t[23]=o,t[24]=O):O=t[24];const z=O;let F,V,P,C,$,N,H,G,Z,q,re;t[25]===Symbol.for("react.memo_cache_sentinel")?(F=Fs.create(mr),V=h.jsx("p",{className:"mx-2 my-2 text-muted-foreground text-sm",children:"Use this scratchpad cell to experiment with code without restrictions on variable names. Scratchpad code is ephemeral: variables defined in the scratchpad aren't saved to notebook memory, and the code is not saved in the notebook file."}),t[25]=F,t[26]=V):(F=t[25],V=t[26]),t[27]===Symbol.for("react.memo_cache_sentinel")?(P=pn("cell.run"),t[27]=P):P=t[27],t[28]===Symbol.for("react.memo_cache_sentinel")?(C=h.jsx(Qs,{color:"var(--grass-11)",size:16}),t[28]=C):C=t[28],t[29]!==y||t[30]!==g?($=h.jsx(Re,{content:P,children:h.jsx(Pe,{"data-testid":"scratchpad-run-button",onClick:y,disabled:g,variant:"text",size:"xs",children:C})}),t[29]=y,t[30]=g,t[31]=$):$=t[31],t[32]===Symbol.for("react.memo_cache_sentinel")?(N=h.jsx(fm,{size:16}),t[32]=N):N=t[32],t[33]!==E||t[34]!==g?(H=h.jsx(Re,{content:"Clear code and outputs",children:h.jsx(Pe,{disabled:g,size:"xs",variant:"text",onClick:E,children:N})}),t[33]=E,t[34]=g,t[35]=H):H=t[35],t[36]===Symbol.for("react.memo_cache_sentinel")?(G=h.jsx(ti,{size:16}),t[36]=G):G=t[36],t[37]!==k||t[38]!==g?(Z=h.jsx(ri,{children:h.jsx(Re,{content:"Insert code",children:h.jsx(Pe,{disabled:g,size:"xs",variant:"text",onClick:k,children:G})})}),t[37]=k,t[38]=g,t[39]=Z):Z=t[39],t[40]!==d?(q=(d==="running"||d==="queued")&&h.jsx(Qn,{className:"inline",size:"small"}),t[40]=d,t[41]=q):q=t[41],t[42]===Symbol.for("react.memo_cache_sentinel")?(re=h.jsx("div",{className:"flex-1"}),t[42]=re):re=t[42];const ne=g&&"bg-[var(--sky-3)] rounded-none";let oe,Y;t[43]!==ne?(oe=Oe(ne),t[43]=ne,t[44]=oe):oe=t[44],t[45]!==g||t[46]!==m?(Y=()=>m(!g),t[45]=g,t[46]=m,t[47]=Y):Y=t[47];const Q=b.length===0;let ce,he,de,me,ie,Ce,we;return t[48]===Symbol.for("react.memo_cache_sentinel")?(ce=h.jsx(xm,{size:16}),t[48]=ce):ce=t[48],t[49]!==oe||t[50]!==Y||t[51]!==Q?(he=h.jsx(Re,{content:"Toggle history",children:h.jsx(Pe,{size:"xs",variant:"text",className:oe,onClick:Y,disabled:Q,children:ce})}),t[49]=oe,t[50]=Y,t[51]=Q,t[52]=he):he=t[52],t[53]!==$||t[54]!==H||t[55]!==Z||t[56]!==q||t[57]!==he?(de=h.jsxs("div",{className:"flex items-center flex-shrink-0",children:[$,H,Z,q,re,he]}),t[53]=$,t[54]=H,t[55]=Z,t[56]=q,t[57]=he,t[58]=de):de=t[58],t[59]!==B?(me=B(),t[59]=B,t[60]=me):me=t[60],t[61]!==z?(ie=z(),t[61]=z,t[62]=ie):ie=t[62],t[63]!==me||t[64]!==ie?(Ce=h.jsxs("div",{className:"flex-1 divide-y relative overflow-hidden flex flex-col",children:[me,ie]}),t[63]=me,t[64]=ie,t[65]=Ce):Ce=t[65],t[66]!==de||t[67]!==Ce?(we=h.jsxs("div",{className:"flex flex-col h-full overflow-hidden divide-y",id:F,children:[V,de,Ce]}),t[66]=de,t[67]=Ce,t[68]=we):we=t[68],we},jR=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=h.jsx(NR,{}),t[0]=e):e=t[0],e},O2=(t,e)=>{lt(e?{title:"Failed to add package",description:e,variant:"danger"}:{title:"Package added",description:h.jsxs("div",{children:[h.jsxs("div",{children:["The package ",h.jsx(la,{className:"inline",children:t})," and its dependencies has been added to your environment."]}),h.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Some Python packages may require a kernel restart to see changes."})]})})},D2=(t,e)=>{lt(e?{title:"Failed to upgrade package",description:e,variant:"danger"}:{title:"Package upgraded",description:h.jsxs("div",{children:[h.jsxs("div",{children:["The package ",h.jsx(la,{className:"inline",children:t})," has been upgraded."]}),h.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Some Python packages may require a kernel restart to see changes."})]})})},R2=(t,e)=>{lt(e?{title:"Failed to remove package",description:e,variant:"danger"}:{title:"Package removed",description:h.jsxs("div",{children:[h.jsxs("div",{children:["The package ",h.jsx(la,{className:"inline",children:t})," has been removed from your environment."]}),h.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Some Python packages may require a kernel restart to see changes."})]})})},P2=t=>{const e=X.c(9),{onClick:n,loading:o,children:r,className:s}=t;if(o){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(Qn,{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=Oe("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=Vn.stopPropagation(n),e[3]=n,e[4]=a):a=e[4],e[5]!==r||e[6]!==i||e[7]!==a?(l=h.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},ER=()=>{const t=X.c(16),[e]=Ds(),n=e.package_management.manager;let o;t[0]!==n?(o=[n],t[0]=n,t[1]=o):o=t[1];const{data:r,loading:s,error:i,reload:a}=Xn(OR,o);if(s&&!r){let p;return t[2]===Symbol.for("react.memo_cache_sentinel")?(p=h.jsx(Qn,{size:"medium",centered:!0}),t[2]=p):p=t[2],p}if(i){let p;return t[3]!==i?(p=h.jsx(Xs,{error:i}),t[3]=i,t[4]=p):p=t[4],p}let l;t[5]!==(r==null?void 0:r.packages)?(l=(r==null?void 0:r.packages)||[],t[5]=r==null?void 0:r.packages,t[6]=l):l=t[6];const c=l;let d,u,f;return t[7]!==n||t[8]!==a?(d=h.jsx(IR,{packageManager:n,onSuccess:a}),t[7]=n,t[8]=a,t[9]=d):d=t[9],t[10]!==c||t[11]!==a?(u=h.jsx(AR,{packages:c,onSuccess:a}),t[10]=c,t[11]=a,t[12]=u):u=t[12],t[13]!==d||t[14]!==u?(f=h.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[d,u]}),t[13]=d,t[14]=u,t[15]=f):f=t[15],f},IR=({onSuccess:t,packageManager:e})=>{const[n,o]=K.useState(""),[r,s]=K.useState(!1),{handleClick:i}=ya(),a=He(nS),l=Qt(nS);K.useEffect(()=>{a&&(o(a),l(null))},[a,l]);const c=async()=>{try{s(!0);const d=await oS({package:n});d.success?(t(),O2(n)):O2(n,d.error)}finally{o(""),s(!1)}};return h.jsxs("div",{className:"flex items-center w-full border-b",children:[h.jsx(B4,{placeholder:`Install packages with ${e}...`,id:Y_,icon:r?h.jsx(Qn,{size:"small",className:"mr-2 h-4 w-4 shrink-0 opacity-50"}):h.jsx(Re,{content:"Change package manager",children:h.jsx(ba,{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)}),h.jsx(Re,{delayDuration:300,side:"left",align:"start",content:h.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:",h.jsxs("div",{className:"flex flex-col gap-2 mt-2",children:[h.jsxs("div",{children:[h.jsx("span",{className:"font-bold tracking-wide",children:"Package name:"})," A package name; this will install the latest version.",h.jsx("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"font-bold tracking-wide",children:"Package and version:"})," ","A package with a specific version or version range.",h.jsx("div",{className:"text-muted-foreground",children:"Examples: httpx==0.27.0, httpx>=0.27.0"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"font-bold tracking-wide",children:"Git:"})," A Git repository",h.jsx("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"font-bold tracking-wide",children:"URL:"})," A remote wheel or source distribution.",h.jsx("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"font-bold tracking-wide",children:"Path:"})," A local wheel, source distribution, or project directory.",h.jsx("div",{className:"text-muted-foreground",children:"Example: /example/foo-0.1.0-py3-none-any.whl"})]})]})]}),children:h.jsx(zp,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),h.jsx("button",{type:"button",className:Oe("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"})]})},AR=t=>{const e=X.c(9),{onSuccess:n,packages:o}=t;if(o.length===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx(In,{title:"No packages",description:"No packages are installed in this environment.",icon:h.jsx(ba,{})}),e[0]=a):a=e[0],a}let r,s,i;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(Wp,{children:h.jsxs(Ks,{children:[h.jsx(Fr,{children:"Name"}),h.jsx(Fr,{children:"Version"}),h.jsx(Fr,{})]})}),e[1]=r):r=e[1],e[2]!==n||e[3]!==o){let a;e[5]!==n?(a=l=>h.jsxs(Ks,{className:"group",onClick:async()=>{await yn(`${l.name}==${l.version}`),lt({title:"Copied to clipboard"})},children:[h.jsx(zr,{children:l.name}),h.jsx(zr,{children:l.version}),h.jsxs(zr,{className:"flex justify-end",children:[h.jsx(TR,{packageName:l.name,onSuccess:n}),h.jsx(MR,{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=h.jsxs(Hp,{className:"overflow-auto flex-1",children:[r,h.jsx(qp,{children:s})]}),e[7]=s,e[8]=i):i=e[8],i},TR=({packageName:t,onSuccess:e})=>{const[n,o]=K.useState(!1);return Bn()?null:h.jsx(P2,{onClick:async()=>{try{o(!0);const r=await oS({package:t,upgrade:!0});r.success?(e(),D2(t)):D2(t,r.error)}finally{o(!1)}},loading:n,children:"Upgrade"})},MR=({packageName:t,onSuccess:e})=>{const[n,o]=K.useState(!1);return h.jsx(P2,{onClick:async()=>{try{o(!0);const r=await WV({package:t});r.success?(e(),R2(t)):R2(t,r.error)}finally{o(!1)}},loading:n,children:"Remove"})};function OR(){return HV()}var lf="ScrollArea",[L2,Q$]=h4(lf),[DR,Ln]=L2(lf),F2=A.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:o="hover",dir:r,scrollHideDelay:s=600,...i}=t,[a,l]=A.useState(null),[c,d]=A.useState(null),[u,f]=A.useState(null),[p,_]=A.useState(null),[g,m]=A.useState(null),[b,x]=A.useState(0),[y,v]=A.useState(0),[k,S]=A.useState(!1),[E,j]=A.useState(!1),I=Zs(e,M=>l(M)),T=qV(r);return h.jsx(DR,{scope:n,type:o,dir:T,scrollHideDelay:s,scrollArea:a,viewport:c,onViewportChange:d,content:u,onContentChange:f,scrollbarX:p,onScrollbarXChange:_,scrollbarXEnabled:k,onScrollbarXEnabledChange:S,scrollbarY:g,onScrollbarYChange:m,scrollbarYEnabled:E,onScrollbarYEnabledChange:j,onCornerWidthChange:x,onCornerHeightChange:v,children:h.jsx(Ws.div,{dir:T,...i,ref:I,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":y+"px",...t.style}})})});F2.displayName=lf;var z2="ScrollAreaViewport",B2=A.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:o,nonce:r,...s}=t,i=Ln(z2,n),a=A.useRef(null),l=Zs(e,a,i.onViewportChange);return h.jsxs(h.Fragment,{children:[h.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),h.jsx(Ws.div,{"data-radix-scroll-area-viewport":"",...s,ref:l,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...t.style},children:h.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:o})})]})});B2.displayName=z2;var ao="ScrollAreaScrollbar",cf=A.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=Ln(ao,t.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=r,a=t.orientation==="horizontal";return A.useEffect(()=>(a?s(!0):i(!0),()=>{a?s(!1):i(!1)}),[a,s,i]),r.type==="hover"?h.jsx(RR,{...o,ref:e,forceMount:n}):r.type==="scroll"?h.jsx(PR,{...o,ref:e,forceMount:n}):r.type==="auto"?h.jsx(U2,{...o,ref:e,forceMount:n}):r.type==="always"?h.jsx(df,{...o,ref:e}):null});cf.displayName=ao;var RR=A.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=Ln(ao,t.__scopeScrollArea),[s,i]=A.useState(!1);return A.useEffect(()=>{const a=r.scrollArea;let l=0;if(a){const c=()=>{window.clearTimeout(l),i(!0)},d=()=>{l=window.setTimeout(()=>i(!1),r.scrollHideDelay)};return a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",d),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",d)}}},[r.scrollArea,r.scrollHideDelay]),h.jsx(zc,{present:n||s,children:h.jsx(U2,{"data-state":s?"visible":"hidden",...o,ref:e})})}),PR=A.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=Ln(ao,t.__scopeScrollArea),s=t.orientation==="horizontal",i=Hl(()=>l("SCROLL_END"),100),[a,l]=function(c,d){return A.useReducer((u,f)=>d[u][f]??u,c)}("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return A.useEffect(()=>{if(a==="idle"){const c=window.setTimeout(()=>l("HIDE"),r.scrollHideDelay);return()=>window.clearTimeout(c)}},[a,r.scrollHideDelay,l]),A.useEffect(()=>{const c=r.viewport,d=s?"scrollLeft":"scrollTop";if(c){let u=c[d];const f=()=>{const p=c[d];u!==p&&(l("SCROLL"),i()),u=p};return c.addEventListener("scroll",f),()=>c.removeEventListener("scroll",f)}},[r.viewport,s,l,i]),h.jsx(zc,{present:n||a!=="hidden",children:h.jsx(df,{"data-state":a==="hidden"?"hidden":"visible",...o,ref:e,onPointerEnter:Wn(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:Wn(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),U2=A.forwardRef((t,e)=>{const n=Ln(ao,t.__scopeScrollArea),{forceMount:o,...r}=t,[s,i]=A.useState(!1),a=t.orientation==="horizontal",l=Hl(()=>{if(n.viewport){const c=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;i(a?c:d)}},10);return gs(n.viewport,l),gs(n.content,l),h.jsx(zc,{present:o||s,children:h.jsx(df,{"data-state":s?"visible":"hidden",...r,ref:e})})}),df=A.forwardRef((t,e)=>{const{orientation:n="vertical",...o}=t,r=Ln(ao,t.__scopeScrollArea),s=A.useRef(null),i=A.useRef(0),[a,l]=A.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=q2(a.viewport,a.content),d={...o,sizes:a,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:f=>s.current=f,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:f=>i.current=f};function u(f,p){return function(_,g,m,b="ltr"){const x=$l(m),y=x/2,v=g||y,k=x-v,S=m.scrollbar.paddingStart+v,E=m.scrollbar.size-m.scrollbar.paddingEnd-k,j=m.content-m.viewport,I=b==="ltr"?[0,j]:[-1*j,0];return Y2([S,E],I)(_)}(f,i.current,a,p)}return n==="horizontal"?h.jsx(LR,{...d,ref:e,onThumbPositionChange:()=>{if(r.viewport&&s.current){const f=G2(r.viewport.scrollLeft,a,r.dir);s.current.style.transform=`translate3d(${f}px, 0, 0)`}},onWheelScroll:f=>{r.viewport&&(r.viewport.scrollLeft=f)},onDragScroll:f=>{r.viewport&&(r.viewport.scrollLeft=u(f,r.dir))}}):n==="vertical"?h.jsx(FR,{...d,ref:e,onThumbPositionChange:()=>{if(r.viewport&&s.current){const f=G2(r.viewport.scrollTop,a);s.current.style.transform=`translate3d(0, ${f}px, 0)`}},onWheelScroll:f=>{r.viewport&&(r.viewport.scrollTop=f)},onDragScroll:f=>{r.viewport&&(r.viewport.scrollTop=u(f))}}):null}),LR=A.forwardRef((t,e)=>{const{sizes:n,onSizesChange:o,...r}=t,s=Ln(ao,t.__scopeScrollArea),[i,a]=A.useState(),l=A.useRef(null),c=Zs(e,l,s.onScrollbarXChange);return A.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),h.jsx($2,{"data-orientation":"horizontal",...r,ref:c,sizes:n,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":$l(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.x),onDragScroll:d=>t.onDragScroll(d.x),onWheelScroll:(d,u)=>{if(s.viewport){const f=s.viewport.scrollLeft+d.deltaX;t.onWheelScroll(f),J2(f,u)&&d.preventDefault()}},onResize:()=>{l.current&&s.viewport&&i&&o({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:Vl(i.paddingLeft),paddingEnd:Vl(i.paddingRight)}})}})}),FR=A.forwardRef((t,e)=>{const{sizes:n,onSizesChange:o,...r}=t,s=Ln(ao,t.__scopeScrollArea),[i,a]=A.useState(),l=A.useRef(null),c=Zs(e,l,s.onScrollbarYChange);return A.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),h.jsx($2,{"data-orientation":"vertical",...r,ref:c,sizes:n,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":$l(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.y),onDragScroll:d=>t.onDragScroll(d.y),onWheelScroll:(d,u)=>{if(s.viewport){const f=s.viewport.scrollTop+d.deltaY;t.onWheelScroll(f),J2(f,u)&&d.preventDefault()}},onResize:()=>{l.current&&s.viewport&&i&&o({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:Vl(i.paddingTop),paddingEnd:Vl(i.paddingBottom)}})}})}),[zR,V2]=L2(ao),$2=A.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:o,hasThumb:r,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:d,onResize:u,...f}=t,p=Ln(ao,n),[_,g]=A.useState(null),m=Zs(e,I=>g(I)),b=A.useRef(null),x=A.useRef(""),y=p.viewport,v=o.content-o.viewport,k=hr(d),S=hr(l),E=Hl(u,10);function j(I){if(b.current){const T=I.clientX-b.current.left,M=I.clientY-b.current.top;c({x:T,y:M})}}return A.useEffect(()=>{const I=T=>{const M=T.target;(_==null?void 0:_.contains(M))&&k(T,v)};return document.addEventListener("wheel",I,{passive:!1}),()=>document.removeEventListener("wheel",I,{passive:!1})},[y,_,v,k]),A.useEffect(S,[o,S]),gs(_,E),gs(p.content,E),h.jsx(zR,{scope:n,scrollbar:_,hasThumb:r,onThumbChange:hr(s),onThumbPointerUp:hr(i),onThumbPositionChange:S,onThumbPointerDown:hr(a),children:h.jsx(Ws.div,{...f,ref:m,style:{position:"absolute",...f.style},onPointerDown:Wn(t.onPointerDown,I=>{I.button===0&&(I.target.setPointerCapture(I.pointerId),b.current=_.getBoundingClientRect(),x.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),j(I))}),onPointerMove:Wn(t.onPointerMove,j),onPointerUp:Wn(t.onPointerUp,I=>{const T=I.target;T.hasPointerCapture(I.pointerId)&&T.releasePointerCapture(I.pointerId),document.body.style.webkitUserSelect=x.current,p.viewport&&(p.viewport.style.scrollBehavior=""),b.current=null})})})}),Ul="ScrollAreaThumb",H2=A.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=V2(Ul,t.__scopeScrollArea);return h.jsx(zc,{present:n||r.hasThumb,children:h.jsx(BR,{ref:e,...o})})}),BR=A.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:o,...r}=t,s=Ln(Ul,n),i=V2(Ul,n),{onThumbPositionChange:a}=i,l=Zs(e,u=>i.onThumbChange(u)),c=A.useRef(void 0),d=Hl(()=>{c.current&&(c.current(),c.current=void 0)},100);return A.useEffect(()=>{const u=s.viewport;if(u){const f=()=>{if(d(),!c.current){const p=VR(u,a);c.current=p,a()}};return a(),u.addEventListener("scroll",f),()=>u.removeEventListener("scroll",f)}},[s.viewport,d,a]),h.jsx(Ws.div,{"data-state":i.hasThumb?"visible":"hidden",...r,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...o},onPointerDownCapture:Wn(t.onPointerDownCapture,u=>{const f=u.target.getBoundingClientRect(),p=u.clientX-f.left,_=u.clientY-f.top;i.onThumbPointerDown({x:p,y:_})}),onPointerUp:Wn(t.onPointerUp,i.onThumbPointerUp)})});H2.displayName=Ul;var uf="ScrollAreaCorner",W2=A.forwardRef((t,e)=>{const n=Ln(uf,t.__scopeScrollArea),o=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&o?h.jsx(UR,{...t,ref:e}):null});W2.displayName=uf;var UR=A.forwardRef((t,e)=>{const{__scopeScrollArea:n,...o}=t,r=Ln(uf,n),[s,i]=A.useState(0),[a,l]=A.useState(0),c=!!(s&&a);return gs(r.scrollbarX,()=>{var u;const d=((u=r.scrollbarX)==null?void 0:u.offsetHeight)||0;r.onCornerHeightChange(d),l(d)}),gs(r.scrollbarY,()=>{var u;const d=((u=r.scrollbarY)==null?void 0:u.offsetWidth)||0;r.onCornerWidthChange(d),i(d)}),c?h.jsx(Ws.div,{...o,ref:e,style:{width:s,height:a,position:"absolute",right:r.dir==="ltr"?0:void 0,left:r.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function Vl(t){return t?parseInt(t,10):0}function q2(t,e){const n=t/e;return isNaN(n)?0:n}function $l(t){const e=q2(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=(t.scrollbar.size-n)*e;return Math.max(o,18)}function G2(t,e,n="ltr"){const o=$l(e),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=e.scrollbar.size-r,i=e.content-e.viewport,a=s-o,l=YV(t,n==="ltr"?[0,i]:[-1*i,0]);return Y2([0,i],[0,a])(l)}function Y2(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const o=(e[1]-e[0])/(t[1]-t[0]);return e[0]+o*(n-t[0])}}function J2(t,e){return t>0&&t<e}var VR=(t,e=()=>{})=>{let n={left:t.scrollLeft,top:t.scrollTop},o=0;return function r(){const s={left:t.scrollLeft,top:t.scrollTop},i=n.left!==s.left,a=n.top!==s.top;(i||a)&&e(),n=s,o=window.requestAnimationFrame(r)}(),()=>window.cancelAnimationFrame(o)};function Hl(t,e){const n=hr(t),o=A.useRef(0);return A.useEffect(()=>()=>window.clearTimeout(o.current),[]),A.useCallback(()=>{window.clearTimeout(o.current),o.current=window.setTimeout(n,e)},[n,e])}function gs(t,e){const n=hr(e);GV(()=>{let o=0;if(t){const r=new ResizeObserver(()=>{cancelAnimationFrame(o),o=window.requestAnimationFrame(n)});return r.observe(t),()=>{window.cancelAnimationFrame(o),r.unobserve(t)}}},[t,n])}var K2=F2,$R=B2,HR=W2;const X2=A.forwardRef((t,e)=>{const n=X.c(15);let o,r,s,i,a,l,c,d;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=Oe("relative overflow-hidden",r),n[4]=r,n[5]=i):i=n[5],n[6]!==o?(a=h.jsx($R,{className:"h-full w-full rounded-[inherit]",children:o}),n[6]=o,n[7]=a):a=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx(Z2,{}),c=h.jsx(HR,{}),n[8]=l,n[9]=c):(l=n[8],c=n[9]),n[10]!==s||n[11]!==e||n[12]!==i||n[13]!==a?(d=h.jsxs(K2,{ref:e,className:i,...s,children:[a,l,c]}),n[10]=s,n[11]=e,n[12]=i,n[13]=a,n[14]=d):d=n[14],d});X2.displayName=K2.displayName;const Z2=A.forwardRef((t,e)=>{const n=X.c(14);let o,r,s;n[0]!==t?({className:o,orientation:s,...r}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]);const i=s===void 0?"vertical":s,a=i==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",l=i==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]";let c,d,u;return n[4]!==o||n[5]!==a||n[6]!==l?(c=Oe("flex touch-none select-none transition-colors",a,l,o),n[4]=o,n[5]=a,n[6]=l,n[7]=c):c=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsx(H2,{className:"relative flex-1 rounded-full bg-border"}),n[8]=d):d=n[8],n[9]!==i||n[10]!==r||n[11]!==e||n[12]!==c?(u=h.jsx(cf,{ref:e,orientation:i,className:c,...r,children:d}),n[9]=i,n[10]=r,n[11]=e,n[12]=c,n[13]=u):u=n[13],u});Z2.displayName=cf.displayName;const WR=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,qR=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,GR={};function Q2(t,e){return(GR.jsx?qR:WR).test(t)}const YR=/[ \t\n\f\r]/g;function ek(t){return t.replace(YR,"")===""}class Hi{constructor(e,n,o){this.property=e,this.normal=n,o&&(this.space=o)}}function tk(t,e){const n={},o={};let r=-1;for(;++r<t.length;)Object.assign(n,t[r].property),Object.assign(o,t[r].normal);return new Hi(n,o,e)}function hf(t){return t.toLowerCase()}Hi.prototype.property={},Hi.prototype.normal={},Hi.prototype.space=null;class Fn{constructor(e,n){this.property=e,this.attribute=n}}Fn.prototype.space=null,Fn.prototype.boolean=!1,Fn.prototype.booleanish=!1,Fn.prototype.overloadedBoolean=!1,Fn.prototype.number=!1,Fn.prototype.commaSeparated=!1,Fn.prototype.spaceSeparated=!1,Fn.prototype.commaOrSpaceSeparated=!1,Fn.prototype.mustUseProperty=!1,Fn.prototype.defined=!1;let JR=0;const tt=Tr(),Rt=Tr(),nk=Tr(),xe=Tr(),_t=Tr(),_s=Tr(),vn=Tr();function Tr(){return 2**++JR}const ff=Object.freeze(Object.defineProperty({__proto__:null,boolean:tt,booleanish:Rt,commaOrSpaceSeparated:vn,commaSeparated:_s,number:xe,overloadedBoolean:nk,spaceSeparated:_t},Symbol.toStringTag,{value:"Module"})),pf=Object.keys(ff);class mf extends Fn{constructor(e,n,o,r){let s=-1;if(super(e,n),ok(this,"space",r),typeof o=="number")for(;++s<pf.length;){const i=pf[s];ok(this,pf[s],(o&ff[i])===ff[i])}}}function ok(t,e,n){n&&(t[e]=n)}mf.prototype.defined=!0;const KR={}.hasOwnProperty;function bs(t){const e={},n={};let o;for(o in t.properties)if(KR.call(t.properties,o)){const r=t.properties[o],s=new mf(o,t.transform(t.attributes||{},o),r,t.space);t.mustUseProperty&&t.mustUseProperty.includes(o)&&(s.mustUseProperty=!0),e[o]=s,n[hf(o)]=o,n[hf(s.attribute)]=o}return new Hi(e,n,t.space)}const rk=bs({space:"xlink",transform:(t,e)=>"xlink:"+e.slice(5).toLowerCase(),properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}}),sk=bs({space:"xml",transform:(t,e)=>"xml:"+e.slice(3).toLowerCase(),properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function ik(t,e){return e in t?t[e]:e}function ak(t,e){return ik(t,e.toLowerCase())}const lk=bs({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:ak,properties:{xmlns:null,xmlnsXLink:null}}),ck=bs({transform:(t,e)=>e==="role"?e:"aria-"+e.slice(4).toLowerCase(),properties:{ariaActiveDescendant:null,ariaAtomic:Rt,ariaAutoComplete:null,ariaBusy:Rt,ariaChecked:Rt,ariaColCount:xe,ariaColIndex:xe,ariaColSpan:xe,ariaControls:_t,ariaCurrent:null,ariaDescribedBy:_t,ariaDetails:null,ariaDisabled:Rt,ariaDropEffect:_t,ariaErrorMessage:null,ariaExpanded:Rt,ariaFlowTo:_t,ariaGrabbed:Rt,ariaHasPopup:null,ariaHidden:Rt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:_t,ariaLevel:xe,ariaLive:null,ariaModal:Rt,ariaMultiLine:Rt,ariaMultiSelectable:Rt,ariaOrientation:null,ariaOwns:_t,ariaPlaceholder:null,ariaPosInSet:xe,ariaPressed:Rt,ariaReadOnly:Rt,ariaRelevant:null,ariaRequired:Rt,ariaRoleDescription:_t,ariaRowCount:xe,ariaRowIndex:xe,ariaRowSpan:xe,ariaSelected:Rt,ariaSetSize:xe,ariaSort:null,ariaValueMax:xe,ariaValueMin:xe,ariaValueNow:xe,ariaValueText:null,role:null}}),XR=bs({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:ak,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:_s,acceptCharset:_t,accessKey:_t,action:null,allow:null,allowFullScreen:tt,allowPaymentRequest:tt,allowUserMedia:tt,alt:null,as:null,async:tt,autoCapitalize:null,autoComplete:_t,autoFocus:tt,autoPlay:tt,blocking:_t,capture:null,charSet:null,checked:tt,cite:null,className:_t,cols:xe,colSpan:null,content:null,contentEditable:Rt,controls:tt,controlsList:_t,coords:xe|_s,crossOrigin:null,data:null,dateTime:null,decoding:null,default:tt,defer:tt,dir:null,dirName:null,disabled:tt,download:nk,draggable:Rt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:tt,formTarget:null,headers:_t,height:xe,hidden:tt,high:xe,href:null,hrefLang:null,htmlFor:_t,httpEquiv:_t,id:null,imageSizes:null,imageSrcSet:null,inert:tt,inputMode:null,integrity:null,is:null,isMap:tt,itemId:null,itemProp:_t,itemRef:_t,itemScope:tt,itemType:_t,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:tt,low:xe,manifest:null,max:null,maxLength:xe,media:null,method:null,min:null,minLength:xe,multiple:tt,muted:tt,name:null,nonce:null,noModule:tt,noValidate:tt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:tt,optimum:xe,pattern:null,ping:_t,placeholder:null,playsInline:tt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:tt,referrerPolicy:null,rel:_t,required:tt,reversed:tt,rows:xe,rowSpan:xe,sandbox:_t,scope:null,scoped:tt,seamless:tt,selected:tt,shadowRootClonable:tt,shadowRootDelegatesFocus:tt,shadowRootMode:null,shape:null,size:xe,sizes:null,slot:null,span:xe,spellCheck:Rt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:xe,step:null,style:null,tabIndex:xe,target:null,title:null,translate:null,type:null,typeMustMatch:tt,useMap:null,value:Rt,width:xe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:_t,axis:null,background:null,bgColor:null,border:xe,borderColor:null,bottomMargin:xe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:tt,declare:tt,event:null,face:null,frame:null,frameBorder:null,hSpace:xe,leftMargin:xe,link:null,longDesc:null,lowSrc:null,marginHeight:xe,marginWidth:xe,noResize:tt,noHref:tt,noShade:tt,noWrap:tt,object:null,profile:null,prompt:null,rev:null,rightMargin:xe,rules:null,scheme:null,scrolling:Rt,standby:null,summary:null,text:null,topMargin:xe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:xe,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:tt,disableRemotePlayback:tt,prefix:null,property:null,results:xe,security:null,unselectable:null}}),ZR=bs({space:"svg",attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},transform:ik,properties:{about:vn,accentHeight:xe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:xe,amplitude:xe,arabicForm:null,ascent:xe,attributeName:null,attributeType:null,azimuth:xe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:xe,by:null,calcMode:null,capHeight:xe,className:_t,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:xe,diffuseConstant:xe,direction:null,display:null,dur:null,divisor:xe,dominantBaseline:null,download:tt,dx:null,dy:null,edgeMode:null,editable:null,elevation:xe,enableBackground:null,end:null,event:null,exponent:xe,externalResourcesRequired:null,fill:null,fillOpacity:xe,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:_s,g2:_s,glyphName:_s,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:xe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:xe,horizOriginX:xe,horizOriginY:xe,id:null,ideographic:xe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:xe,k:xe,k1:xe,k2:xe,k3:xe,k4:xe,kernelMatrix:vn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:xe,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:xe,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:xe,overlineThickness:xe,paintOrder:null,panose1:null,path:null,pathLength:xe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:_t,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:xe,pointsAtY:xe,pointsAtZ:xe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:vn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:vn,rev:vn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:vn,requiredFeatures:vn,requiredFonts:vn,requiredFormats:vn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:xe,specularExponent:xe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:xe,strikethroughThickness:xe,string:null,stroke:null,strokeDashArray:vn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:xe,strokeOpacity:xe,strokeWidth:null,style:null,surfaceScale:xe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:vn,tabIndex:xe,tableValues:null,target:null,targetX:xe,targetY:xe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:vn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:xe,underlineThickness:xe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:xe,values:null,vAlphabetic:xe,vMathematical:xe,vectorEffect:null,vHanging:xe,vIdeographic:xe,version:null,vertAdvY:xe,vertOriginX:xe,vertOriginY:xe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:xe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}}),QR=/^data[-\w.:]+$/i,dk=/-[a-z]/g,eP=/[A-Z]/g;function tP(t){return"-"+t.toLowerCase()}function nP(t){return t.charAt(1).toUpperCase()}const oP={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},rP=tk([sk,rk,lk,ck,XR],"html"),gf=tk([sk,rk,lk,ck,ZR],"svg"),uk=rS(JV()),sP=uk.default||uk,hk=fk("end"),_f=fk("start");function fk(t){return function(e){const n=e&&e.position&&e.position[t]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function Wi(t){return t&&typeof t=="object"?"position"in t||"type"in t?pk(t.position):"start"in t||"end"in t?pk(t):"line"in t||"column"in t?bf(t):"":""}function bf(t){return mk(t&&t.line)+":"+mk(t&&t.column)}function pk(t){return bf(t&&t.start)+"-"+bf(t&&t.end)}function mk(t){return t&&typeof t=="number"?t:1}class on extends Error{constructor(e,n,o){super(),typeof n=="string"&&(o=n,n=void 0);let r="",s={},i=!1;if(n&&(s="line"in n&&"column"in n||"start"in n&&"end"in n?{place:n}:"type"in n?{ancestors:[n],place:n.position}:{...n}),typeof e=="string"?r=e:!s.cause&&e&&(i=!0,r=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof o=="string"){const l=o.indexOf(":");l===-1?s.ruleId=o:(s.source=o.slice(0,l),s.ruleId=o.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file,this.message=r,this.line=a?a.line:void 0,this.name=Wi(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=i&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual,this.expected,this.note,this.url}}on.prototype.file="",on.prototype.name="",on.prototype.reason="",on.prototype.message="",on.prototype.stack="",on.prototype.column=void 0,on.prototype.line=void 0,on.prototype.ancestors=void 0,on.prototype.cause=void 0,on.prototype.fatal=void 0,on.prototype.place=void 0,on.prototype.ruleId=void 0,on.prototype.source=void 0;const yf={}.hasOwnProperty,iP=new Map,aP=/[A-Z]/g,lP=/-([a-z])/g,cP=new Set(["table","tbody","thead","tfoot","tr"]),dP=new Set(["td","th"]),gk="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function uP(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let o;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");o=function(i,a){return l;function l(c,d,u,f){const p=Array.isArray(u.children),_=_f(c);return a(d,u,f,p,{columnNumber:_?_.column-1:void 0,fileName:i,lineNumber:_?_.line:void 0},void 0)}}(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");o=function(i,a,l){return c;function c(d,u,f,p){const _=Array.isArray(f.children)?l:a;return p?_(u,f,p):_(u,f)}}(0,e.jsx,e.jsxs)}const r={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:o,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?gf:rP,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=_k(r,t,void 0);return s&&typeof s!="string"?s:r.create(t,r.Fragment,{children:s||void 0},void 0)}function _k(t,e,n){return e.type==="element"?function(o,r,s){const i=o.schema;let a=i;r.tagName.toLowerCase()==="svg"&&i.space==="html"&&(a=gf,o.schema=a),o.ancestors.push(r);const l=yk(o,r.tagName,!1),c=function(u,f){const p={};let _,g;for(g in f.properties)if(g!=="children"&&yf.call(f.properties,g)){const m=hP(u,g,f.properties[g]);if(m){const[b,x]=m;u.tableCellAlignToStyle&&b==="align"&&typeof x=="string"&&dP.has(f.tagName)?_=x:p[b]=x}}return _&&((p.style||(p.style={}))[u.stylePropertyNameCase==="css"?"text-align":"textAlign"]=_),p}(o,r);let d=wf(o,r);return cP.has(r.tagName)&&(d=d.filter(function(u){return typeof u!="string"||!(typeof(f=u)=="object"?f.type==="text"&&ek(f.value):ek(f));var f})),bk(o,c,l,r),xf(c,d),o.ancestors.pop(),o.schema=i,o.create(r,l,c,s)}(t,e,n):e.type==="mdxFlowExpression"||e.type==="mdxTextExpression"?function(o,r){if(r.data&&r.data.estree&&o.evaluater){const s=r.data.estree.body[0];return s.type,o.evaluater.evaluateExpression(s.expression)}qi(o,r.position)}(t,e):e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement"?function(o,r,s){const i=o.schema;let a=i;r.name==="svg"&&i.space==="html"&&(a=gf,o.schema=a),o.ancestors.push(r);const l=r.name===null?o.Fragment:yk(o,r.name,!0),c=function(u,f){const p={};for(const _ of f.attributes)if(_.type==="mdxJsxExpressionAttribute")if(_.data&&_.data.estree&&u.evaluater){const g=_.data.estree.body[0];g.type;const m=g.expression;m.type;const b=m.properties[0];b.type,Object.assign(p,u.evaluater.evaluateExpression(b.argument))}else qi(u,f.position);else{const g=_.name;let m;if(_.value&&typeof _.value=="object")if(_.value.data&&_.value.data.estree&&u.evaluater){const b=_.value.data.estree.body[0];b.type,m=u.evaluater.evaluateExpression(b.expression)}else qi(u,f.position);else m=_.value===null||_.value;p[g]=m}return p}(o,r),d=wf(o,r);return bk(o,c,l,r),xf(c,d),o.ancestors.pop(),o.schema=i,o.create(r,l,c,s)}(t,e,n):e.type==="mdxjsEsm"?function(o,r){if(r.data&&r.data.estree&&o.evaluater)return o.evaluater.evaluateProgram(r.data.estree);qi(o,r.position)}(t,e):e.type==="root"?function(o,r,s){const i={};return xf(i,wf(o,r)),o.create(r,o.Fragment,i,s)}(t,e,n):e.type==="text"?function(o,r){return r.value}(0,e):void 0}function bk(t,e,n,o){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=o)}function xf(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function wf(t,e){const n=[];let o=-1;const r=t.passKeys?new Map:iP;for(;++o<e.children.length;){const s=e.children[o];let i;if(t.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const c=r.get(l)||0;i=l+"-"+c,r.set(l,c+1)}}const a=_k(t,s,i);a!==void 0&&n.push(a)}return n}function hP(t,e,n){const o=function(r,s){const i=hf(s);let a=s,l=Fn;if(i in r.normal)return r.property[r.normal[i]];if(i.length>4&&i.slice(0,4)==="data"&&QR.test(s)){if(s.charAt(4)==="-"){const c=s.slice(5).replace(dk,nP);a="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=s.slice(4);if(!dk.test(c)){let d=c.replace(eP,tP);d.charAt(0)!=="-"&&(d="-"+d),s="data"+d}}l=mf}return new l(a,s)}(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=o.commaSeparated?function(r){const s={};return(r[r.length-1]===""?[...r,""]:r).join((s.padRight?" ":"")+","+(s.padLeft===!1?"":" ")).trim()}(n):n.join(" ").trim()),o.property==="style"){let r=typeof n=="object"?n:function(s,i){const a={};try{sP(i,l)}catch(c){if(!s.ignoreInvalidStyle){const d=c,u=new on("Cannot parse `style` attribute",{ancestors:s.ancestors,cause:d,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw u.file=s.filePath||void 0,u.url=gk+"#cannot-parse-style-attribute",u}}return a;function l(c,d){let u=c;u.slice(0,2)!=="--"&&(u.slice(0,4)==="-ms-"&&(u="ms-"+u.slice(4)),u=u.replace(lP,pP)),a[u]=d}}(t,String(n));return t.stylePropertyNameCase==="css"&&(r=function(s){const i={};let a;for(a in s)yf.call(s,a)&&(i[fP(a)]=s[a]);return i}(r)),["style",r]}return[t.elementAttributeNameCase==="react"&&o.space?oP[o.property]||o.property:o.attribute,n]}}function yk(t,e,n){let o;if(n)if(e.includes(".")){const r=e.split(".");let s,i=-1;for(;++i<r.length;){const a=Q2(r[i])?{type:"Identifier",name:r[i]}:{type:"Literal",value:r[i]};s=s?{type:"MemberExpression",object:s,property:a,computed:!!(i&&a.type==="Literal"),optional:!1}:a}o=s}else o=Q2(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};else o={type:"Literal",value:e};if(o.type==="Literal"){const r=o.value;return yf.call(t.components,r)?t.components[r]:r}if(t.evaluater)return t.evaluater.evaluateExpression(o);qi(t)}function qi(t,e){const n=new on("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=t.filePath||void 0,n.url=gk+"#cannot-handle-mdx-estrees-without-createevaluater",n}function fP(t){let e=t.replace(aP,mP);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function pP(t,e){return e.toUpperCase()}function mP(t){return"-"+t.toLowerCase()}const vf={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Wl={};function xk(t,e,n){if(function(o){return!!(o&&typeof o=="object")}(t)){if("value"in t)return t.type!=="html"||n?t.value:"";if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return wk(t.children,e,n)}return Array.isArray(t)?wk(t,e,n):""}function wk(t,e,n){const o=[];let r=-1;for(;++r<t.length;)o[r]=xk(t[r],e,n);return o.join("")}const vk=document.createElement("i");function kf(t){const e="&"+t+";";vk.innerHTML=e;const n=vk.textContent;return(n.charCodeAt(n.length-1)!==59||t==="semi")&&n!==e&&n}function lo(t,e,n,o){const r=t.length;let s,i=0;if(e=e<0?-e>r?0:r+e:e>r?r:e,n=n>0?n:0,o.length<1e4)s=Array.from(o),s.unshift(e,n),t.splice(...s);else for(n&&t.splice(e,n);i<o.length;)s=o.slice(i,i+1e4),s.unshift(e,0),t.splice(...s),i+=1e4,e+=1e4}function zn(t,e){return t.length>0?(lo(t,t.length,0,e),t):e}const kk={}.hasOwnProperty;function gP(t,e){let n;for(n in e){const o=(kk.call(t,n)?t[n]:void 0)||(t[n]={}),r=e[n];let s;if(r)for(s in r){kk.call(o,s)||(o[s]=[]);const i=r[s];_P(o[s],Array.isArray(i)?i:i?[i]:[])}}}function _P(t,e){let n=-1;const o=[];for(;++n<e.length;)(e[n].add==="after"?t:o).push(e[n]);lo(t,0,0,o)}function Sk(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||!(65535&~n)||(65535&n)==65534||n>1114111?"\uFFFD":String.fromCodePoint(n)}function ys(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const co=rr(/[A-Za-z]/),kn=rr(/[\dA-Za-z]/),bP=rr(/[#-'*+\--9=?A-Z^-~]/);function Sf(t){return t!==null&&(t<32||t===127)}const Cf=rr(/\d/),yP=rr(/[\dA-Fa-f]/),xP=rr(/[!-/:-@[-`{-~]/);function Ke(t){return t!==null&&t<-2}function _n(t){return t!==null&&(t<0||t===32)}function ht(t){return t===-2||t===-1||t===32}const wP=rr(new RegExp("\\p{P}|\\p{S}","u")),vP=rr(/\s/);function rr(t){return function(e){return e!==null&&e>-1&&t.test(String.fromCharCode(e))}}function xs(t){const e=[];let n=-1,o=0,r=0;for(;++n<t.length;){const s=t.charCodeAt(n);let i="";if(s===37&&kn(t.charCodeAt(n+1))&&kn(t.charCodeAt(n+2)))r=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(i=String.fromCharCode(s));else if(s>55295&&s<57344){const a=t.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(i=String.fromCharCode(s,a),r=1):i="\uFFFD"}else i=String.fromCharCode(s);i&&(e.push(t.slice(o,n),encodeURIComponent(i)),o=n+r+1,i=""),r&&(n+=r,r=0)}return e.join("")+t.slice(o)}function bt(t,e,n,o){const r=o?o-1:Number.POSITIVE_INFINITY;let s=0;return function(a){return ht(a)?(t.enter(n),i(a)):e(a)};function i(a){return ht(a)&&s++<r?(t.consume(a),i):(t.exit(n),e(a))}}const kP={tokenize:function(t){const e=t.attempt(this.parser.constructs.contentInitial,function(s){return s===null?void t.consume(s):(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),bt(t,e,"linePrefix"))},function(s){return t.enter("paragraph"),o(s)});let n;return e;function o(s){const i=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=i),n=i,r(s)}function r(s){return s===null?(t.exit("chunkText"),t.exit("paragraph"),void t.consume(s)):Ke(s)?(t.consume(s),t.exit("chunkText"),o):(t.consume(s),r)}}},SP={tokenize:function(t){const e=this,n=[];let o,r,s,i=0;return a;function a(y){if(i<n.length){const v=n[i];return e.containerState=v[1],t.attempt(v[0].continuation,l,c)(y)}return c(y)}function l(y){if(i++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,o&&x();const v=e.events.length;let k,S=v;for(;S--;)if(e.events[S][0]==="exit"&&e.events[S][1].type==="chunkFlow"){k=e.events[S][1].end;break}b(i);let E=v;for(;E<e.events.length;)e.events[E][1].end={...k},E++;return lo(e.events,S+1,0,e.events.slice(v)),e.events.length=E,c(y)}return a(y)}function c(y){if(i===n.length){if(!o)return f(y);if(o.currentConstruct&&o.currentConstruct.concrete)return _(y);e.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(Ck,d,u)(y)}function d(y){return o&&x(),b(i),f(y)}function u(y){return e.parser.lazy[e.now().line]=i!==n.length,s=e.now().offset,_(y)}function f(y){return e.containerState={},t.attempt(Ck,p,_)(y)}function p(y){return i++,n.push([e.currentConstruct,e.containerState]),f(y)}function _(y){return y===null?(o&&x(),b(0),void t.consume(y)):(o=o||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:r}),g(y))}function g(y){return y===null?(m(t.exit("chunkFlow"),!0),b(0),void t.consume(y)):Ke(y)?(t.consume(y),m(t.exit("chunkFlow")),i=0,e.interrupt=void 0,a):(t.consume(y),g)}function m(y,v){const k=e.sliceStream(y);if(v&&k.push(null),y.previous=r,r&&(r.next=y),r=y,o.defineSkip(y.start),o.write(k),e.parser.lazy[y.start.line]){let S=o.events.length;for(;S--;)if(o.events[S][1].start.offset<s&&(!o.events[S][1].end||o.events[S][1].end.offset>s))return;const E=e.events.length;let j,I,T=E;for(;T--;)if(e.events[T][0]==="exit"&&e.events[T][1].type==="chunkFlow"){if(j){I=e.events[T][1].end;break}j=!0}for(b(i),S=E;S<e.events.length;)e.events[S][1].end={...I},S++;lo(e.events,T+1,0,e.events.slice(E)),e.events.length=S}}function b(y){let v=n.length;for(;v-- >y;){const k=n[v];e.containerState=k[1],k[0].exit.call(e,t)}n.length=y}function x(){o.write([null]),r=void 0,o=void 0,e.containerState._closeFlow=void 0}}},Ck={tokenize:function(t,e,n){return bt(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};function Nk(t){return t===null||_n(t)||vP(t)?1:wP(t)?2:void 0}function Nf(t,e,n){const o=[];let r=-1;for(;++r<t.length;){const s=t[r].resolveAll;s&&!o.includes(s)&&(e=s(e,n),o.push(s))}return e}const jf={name:"attention",resolveAll:function(t,e){let n,o,r,s,i,a,l,c,d=-1;for(;++d<t.length;)if(t[d][0]==="enter"&&t[d][1].type==="attentionSequence"&&t[d][1]._close){for(n=d;n--;)if(t[n][0]==="exit"&&t[n][1].type==="attentionSequence"&&t[n][1]._open&&e.sliceSerialize(t[n][1]).charCodeAt(0)===e.sliceSerialize(t[d][1]).charCodeAt(0)){if((t[n][1]._close||t[d][1]._open)&&(t[d][1].end.offset-t[d][1].start.offset)%3&&!((t[n][1].end.offset-t[n][1].start.offset+t[d][1].end.offset-t[d][1].start.offset)%3))continue;a=t[n][1].end.offset-t[n][1].start.offset>1&&t[d][1].end.offset-t[d][1].start.offset>1?2:1;const u={...t[n][1].end},f={...t[d][1].start};jk(u,-a),jk(f,a),s={type:a>1?"strongSequence":"emphasisSequence",start:u,end:{...t[n][1].end}},i={type:a>1?"strongSequence":"emphasisSequence",start:{...t[d][1].start},end:f},r={type:a>1?"strongText":"emphasisText",start:{...t[n][1].end},end:{...t[d][1].start}},o={type:a>1?"strong":"emphasis",start:{...s.start},end:{...i.end}},t[n][1].end={...s.start},t[d][1].start={...i.end},l=[],t[n][1].end.offset-t[n][1].start.offset&&(l=zn(l,[["enter",t[n][1],e],["exit",t[n][1],e]])),l=zn(l,[["enter",o,e],["enter",s,e],["exit",s,e],["enter",r,e]]),l=zn(l,Nf(e.parser.constructs.insideSpan.null,t.slice(n+1,d),e)),l=zn(l,[["exit",r,e],["enter",i,e],["exit",i,e],["exit",o,e]]),t[d][1].end.offset-t[d][1].start.offset?(c=2,l=zn(l,[["enter",t[d][1],e],["exit",t[d][1],e]])):c=0,lo(t,n-1,d-n+3,l),d=n+l.length-c-2;break}}for(d=-1;++d<t.length;)t[d][1].type==="attentionSequence"&&(t[d][1].type="data");return t},tokenize:function(t,e){const n=this.parser.constructs.attentionMarkers.null,o=this.previous,r=Nk(o);let s;return function(a){return s=a,t.enter("attentionSequence"),i(a)};function i(a){if(a===s)return t.consume(a),i;const l=t.exit("attentionSequence"),c=Nk(a),d=!c||c===2&&r||n.includes(a),u=!r||r===2&&c||n.includes(o);return l._open=!!(s===42?d:d&&(r||!u)),l._close=!!(s===42?u:u&&(c||!d)),e(a)}}};function jk(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const CP={name:"autolink",tokenize:function(t,e,n){let o=0;return function(f){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),r};function r(f){return co(f)?(t.consume(f),s):f===64?n(f):l(f)}function s(f){return f===43||f===45||f===46||kn(f)?(o=1,i(f)):l(f)}function i(f){return f===58?(t.consume(f),o=0,a):(f===43||f===45||f===46||kn(f))&&o++<32?(t.consume(f),i):(o=0,l(f))}function a(f){return f===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):f===null||f===32||f===60||Sf(f)?n(f):(t.consume(f),a)}function l(f){return f===64?(t.consume(f),c):bP(f)?(t.consume(f),l):n(f)}function c(f){return kn(f)?d(f):n(f)}function d(f){return f===46?(t.consume(f),o=0,c):f===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):u(f)}function u(f){if((f===45||kn(f))&&o++<63){const p=f===45?u:d;return t.consume(f),p}return n(f)}}},ql={partial:!0,tokenize:function(t,e,n){return function(r){return ht(r)?bt(t,o,"linePrefix")(r):o(r)};function o(r){return r===null||Ke(r)?e(r):n(r)}}},Ek={continuation:{tokenize:function(t,e,n){const o=this;return function(s){return ht(s)?bt(t,r,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):r(s)};function r(s){return t.attempt(Ek,e,n)(s)}}},exit:function(t){t.exit("blockQuote")},name:"blockQuote",tokenize:function(t,e,n){const o=this;return function(s){if(s===62){const i=o.containerState;return i.open||(t.enter("blockQuote",{_container:!0}),i.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(s),t.exit("blockQuoteMarker"),r}return n(s)};function r(s){return ht(s)?(t.enter("blockQuotePrefixWhitespace"),t.consume(s),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(s))}}},Ik={name:"characterEscape",tokenize:function(t,e,n){return function(r){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(r),t.exit("escapeMarker"),o};function o(r){return xP(r)?(t.enter("characterEscapeValue"),t.consume(r),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(r)}}},Ak={name:"characterReference",tokenize:function(t,e,n){const o=this;let r,s,i=0;return function(d){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),a};function a(d){return d===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(d),t.exit("characterReferenceMarkerNumeric"),l):(t.enter("characterReferenceValue"),r=31,s=kn,c(d))}function l(d){return d===88||d===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(d),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),r=6,s=yP,c):(t.enter("characterReferenceValue"),r=7,s=Cf,c(d))}function c(d){if(d===59&&i){const u=t.exit("characterReferenceValue");return s!==kn||kf(o.sliceSerialize(u))?(t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),t.exit("characterReference"),e):n(d)}return s(d)&&i++<r?(t.consume(d),c):n(d)}}},Tk={partial:!0,tokenize:function(t,e,n){const o=this;return function(s){return s===null?n(s):(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),r)};function r(s){return o.parser.lazy[o.now().line]?n(s):e(s)}}},Mk={concrete:!0,name:"codeFenced",tokenize:function(t,e,n){const o=this,r={partial:!0,tokenize:function(y,v,k){let S=0;return E;function E(L){return y.enter("lineEnding"),y.consume(L),y.exit("lineEnding"),j}function j(L){return y.enter("codeFencedFence"),ht(L)?bt(y,I,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):I(L)}function I(L){return L===s?(y.enter("codeFencedFenceSequence"),T(L)):k(L)}function T(L){return L===s?(S++,y.consume(L),T):S>=a?(y.exit("codeFencedFenceSequence"),ht(L)?bt(y,M,"whitespace")(L):M(L)):k(L)}function M(L){return L===null||Ke(L)?(y.exit("codeFencedFence"),v(L)):k(L)}}};let s,i=0,a=0;return function(y){return function(v){const k=o.events[o.events.length-1];return i=k&&k[1].type==="linePrefix"?k[2].sliceSerialize(k[1],!0).length:0,s=v,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),l(v)}(y)};function l(y){return y===s?(a++,t.consume(y),l):a<3?n(y):(t.exit("codeFencedFenceSequence"),ht(y)?bt(t,c,"whitespace")(y):c(y))}function c(y){return y===null||Ke(y)?(t.exit("codeFencedFence"),o.interrupt?e(y):t.check(Tk,p,x)(y)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),d(y))}function d(y){return y===null||Ke(y)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),c(y)):ht(y)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),bt(t,u,"whitespace")(y)):y===96&&y===s?n(y):(t.consume(y),d)}function u(y){return y===null||Ke(y)?c(y):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),f(y))}function f(y){return y===null||Ke(y)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),c(y)):y===96&&y===s?n(y):(t.consume(y),f)}function p(y){return t.attempt(r,x,_)(y)}function _(y){return t.enter("lineEnding"),t.consume(y),t.exit("lineEnding"),g}function g(y){return i>0&&ht(y)?bt(t,m,"linePrefix",i+1)(y):m(y)}function m(y){return y===null||Ke(y)?t.check(Tk,p,x)(y):(t.enter("codeFlowValue"),b(y))}function b(y){return y===null||Ke(y)?(t.exit("codeFlowValue"),m(y)):(t.consume(y),b)}function x(y){return t.exit("codeFenced"),e(y)}}},Ef={name:"codeIndented",tokenize:function(t,e,n){const o=this;return function(l){return t.enter("codeIndented"),bt(t,r,"linePrefix",5)(l)};function r(l){const c=o.events[o.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?s(l):n(l)}function s(l){return l===null?a(l):Ke(l)?t.attempt(NP,s,a)(l):(t.enter("codeFlowValue"),i(l))}function i(l){return l===null||Ke(l)?(t.exit("codeFlowValue"),s(l)):(t.consume(l),i)}function a(l){return t.exit("codeIndented"),e(l)}}},NP={partial:!0,tokenize:function(t,e,n){const o=this;return r;function r(i){return o.parser.lazy[o.now().line]?n(i):Ke(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),r):bt(t,s,"linePrefix",5)(i)}function s(i){const a=o.events[o.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(i):Ke(i)?r(i):n(i)}}},jP={name:"codeText",previous:function(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"},resolve:function(t){let e,n,o=t.length-4,r=3;if(!(t[r][1].type!=="lineEnding"&&t[r][1].type!=="space"||t[o][1].type!=="lineEnding"&&t[o][1].type!=="space")){for(e=r;++e<o;)if(t[e][1].type==="codeTextData"){t[r][1].type="codeTextPadding",t[o][1].type="codeTextPadding",r+=2,o-=2;break}}for(e=r-1,o++;++e<=o;)n===void 0?e!==o&&t[e][1].type!=="lineEnding"&&(n=e):e!==o&&t[e][1].type!=="lineEnding"||(t[n][1].type="codeTextData",e!==n+2&&(t[n][1].end=t[e-1][1].end,t.splice(n+2,e-n-2),o-=e-n-2,e=n+2),n=void 0);return t},tokenize:function(t,e,n){let o,r,s=0;return function(d){return t.enter("codeText"),t.enter("codeTextSequence"),i(d)};function i(d){return d===96?(t.consume(d),s++,i):(t.exit("codeTextSequence"),a(d))}function a(d){return d===null?n(d):d===32?(t.enter("space"),t.consume(d),t.exit("space"),a):d===96?(r=t.enter("codeTextSequence"),o=0,c(d)):Ke(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),a):(t.enter("codeTextData"),l(d))}function l(d){return d===null||d===32||d===96||Ke(d)?(t.exit("codeTextData"),a(d)):(t.consume(d),l)}function c(d){return d===96?(t.consume(d),o++,c):o===s?(t.exit("codeTextSequence"),t.exit("codeText"),e(d)):(r.type="codeTextData",l(d))}}};class EP{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const o=n??Number.POSITIVE_INFINITY;return o<this.left.length?this.left.slice(e,o):e>this.left.length?this.right.slice(this.right.length-o+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-o+this.left.length).reverse())}splice(e,n,o){const r=n||0;this.setCursor(Math.trunc(e));const s=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return o&&Gi(this.left,o),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Gi(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Gi(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);Gi(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Gi(this.left,n.reverse())}}}function Gi(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function Ok(t){const e={};let n,o,r,s,i,a,l,c=-1;const d=new EP(t);for(;++c<d.length;){for(;c in e;)c=e[c];if(n=d.get(c),c&&n[1].type==="chunkFlow"&&d.get(c-1)[1].type==="listItemPrefix"&&(a=n[1]._tokenizer.events,r=0,r<a.length&&a[r][1].type==="lineEndingBlank"&&(r+=2),r<a.length&&a[r][1].type==="content"))for(;++r<a.length&&a[r][1].type!=="content";)a[r][1].type==="chunkText"&&(a[r][1]._isInFirstContentOfListItem=!0,r++);if(n[0]==="enter")n[1].contentType&&(Object.assign(e,IP(d,c)),c=e[c],l=!0);else if(n[1]._container){for(r=c,o=void 0;r--&&(s=d.get(r),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(o&&(d.get(o)[1].type="lineEndingBlank"),s[1].type="lineEnding",o=r);o&&(n[1].end={...d.get(o)[1].start},i=d.slice(o,c),i.unshift(n),d.splice(o,c-o+1,i))}}return lo(t,0,Number.POSITIVE_INFINITY,d.slice(0)),!l}function IP(t,e){const n=t.get(e)[1],o=t.get(e)[2];let r=e-1;const s=[],i=n._tokenizer||o.parser[n.contentType](n.start),a=i.events,l=[],c={};let d,u,f=-1,p=n,_=0,g=0;const m=[g];for(;p;){for(;t.get(++r)[1]!==p;);s.push(r),p._tokenizer||(d=o.sliceStream(p),p.next||d.push(null),u&&i.defineSkip(p.start),p._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=!0),i.write(d),p._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=void 0)),u=p,p=p.next}for(p=n;++f<a.length;)a[f][0]==="exit"&&a[f-1][0]==="enter"&&a[f][1].type===a[f-1][1].type&&a[f][1].start.line!==a[f][1].end.line&&(g=f+1,m.push(g),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(i.events=[],p?(p._tokenizer=void 0,p.previous=void 0):m.pop(),f=m.length;f--;){const b=a.slice(m[f],m[f+1]),x=s.pop();l.push([x,x+b.length-1]),t.splice(x,2,b)}for(l.reverse(),f=-1;++f<l.length;)c[_+l[f][0]]=_+l[f][1],_+=l[f][1]-l[f][0]-1;return c}const AP={resolve:function(t){return Ok(t),t},tokenize:function(t,e){let n;return function(i){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),o(i)};function o(i){return i===null?r(i):Ke(i)?t.check(TP,s,r)(i):(t.consume(i),o)}function r(i){return t.exit("chunkContent"),t.exit("content"),e(i)}function s(i){return t.consume(i),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}},TP={partial:!0,tokenize:function(t,e,n){const o=this;return function(s){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),bt(t,r,"linePrefix")};function r(s){if(s===null||Ke(s))return n(s);const i=o.events[o.events.length-1];return!o.parser.constructs.disable.null.includes("codeIndented")&&i&&i[1].type==="linePrefix"&&i[2].sliceSerialize(i[1],!0).length>=4?e(s):t.interrupt(o.parser.constructs.flow,n,e)(s)}}};function Dk(t,e,n,o,r,s,i,a,l){const c=l||Number.POSITIVE_INFINITY;let d=0;return function(m){return m===60?(t.enter(o),t.enter(r),t.enter(s),t.consume(m),t.exit(s),u):m===null||m===32||m===41||Sf(m)?n(m):(t.enter(o),t.enter(i),t.enter(a),t.enter("chunkString",{contentType:"string"}),_(m))};function u(m){return m===62?(t.enter(s),t.consume(m),t.exit(s),t.exit(r),t.exit(o),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),f(m))}function f(m){return m===62?(t.exit("chunkString"),t.exit(a),u(m)):m===null||m===60||Ke(m)?n(m):(t.consume(m),m===92?p:f)}function p(m){return m===60||m===62||m===92?(t.consume(m),f):f(m)}function _(m){return d||m!==null&&m!==41&&!_n(m)?d<c&&m===40?(t.consume(m),d++,_):m===41?(t.consume(m),d--,_):m===null||m===32||m===40||Sf(m)?n(m):(t.consume(m),m===92?g:_):(t.exit("chunkString"),t.exit(a),t.exit(i),t.exit(o),e(m))}function g(m){return m===40||m===41||m===92?(t.consume(m),_):_(m)}}function Rk(t,e,n,o,r,s){const i=this;let a,l=0;return function(f){return t.enter(o),t.enter(r),t.consume(f),t.exit(r),t.enter(s),c};function c(f){return l>999||f===null||f===91||f===93&&!a||f===94&&!l&&"_hiddenFootnoteSupport"in i.parser.constructs?n(f):f===93?(t.exit(s),t.enter(r),t.consume(f),t.exit(r),t.exit(o),e):Ke(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),c):(t.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===null||f===91||f===93||Ke(f)||l++>999?(t.exit("chunkString"),c(f)):(t.consume(f),a||(a=!ht(f)),f===92?u:d)}function u(f){return f===91||f===92||f===93?(t.consume(f),l++,d):d(f)}}function Pk(t,e,n,o,r,s){let i;return function(u){return u===34||u===39||u===40?(t.enter(o),t.enter(r),t.consume(u),t.exit(r),i=u===40?41:u,a):n(u)};function a(u){return u===i?(t.enter(r),t.consume(u),t.exit(r),t.exit(o),e):(t.enter(s),l(u))}function l(u){return u===i?(t.exit(s),a(i)):u===null?n(u):Ke(u)?(t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),bt(t,l,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),c(u))}function c(u){return u===i||u===null||Ke(u)?(t.exit("chunkString"),l(u)):(t.consume(u),u===92?d:c)}function d(u){return u===i||u===92?(t.consume(u),c):c(u)}}function Yi(t,e){let n;return function o(r){return Ke(r)?(t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),n=!0,o):ht(r)?bt(t,o,n?"linePrefix":"lineSuffix")(r):e(r)}}const MP={name:"definition",tokenize:function(t,e,n){const o=this;let r;return function(u){return t.enter("definition"),function(f){return Rk.call(o,t,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}(u)};function s(u){return r=ys(o.sliceSerialize(o.events[o.events.length-1][1]).slice(1,-1)),u===58?(t.enter("definitionMarker"),t.consume(u),t.exit("definitionMarker"),i):n(u)}function i(u){return _n(u)?Yi(t,a)(u):a(u)}function a(u){return Dk(t,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(u)}function l(u){return t.attempt(OP,c,c)(u)}function c(u){return ht(u)?bt(t,d,"whitespace")(u):d(u)}function d(u){return u===null||Ke(u)?(t.exit("definition"),o.parser.defined.push(r),e(u)):n(u)}}},OP={partial:!0,tokenize:function(t,e,n){return function(i){return _n(i)?Yi(t,o)(i):n(i)};function o(i){return Pk(t,r,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(i)}function r(i){return ht(i)?bt(t,s,"whitespace")(i):s(i)}function s(i){return i===null||Ke(i)?e(i):n(i)}}},DP={name:"hardBreakEscape",tokenize:function(t,e,n){return function(r){return t.enter("hardBreakEscape"),t.consume(r),o};function o(r){return Ke(r)?(t.exit("hardBreakEscape"),e(r)):n(r)}}},RP={name:"headingAtx",resolve:function(t,e){let n,o,r=t.length-2,s=3;return t[s][1].type==="whitespace"&&(s+=2),r-2>s&&t[r][1].type==="whitespace"&&(r-=2),t[r][1].type==="atxHeadingSequence"&&(s===r-1||r-4>s&&t[r-2][1].type==="whitespace")&&(r-=s+1===r?2:4),r>s&&(n={type:"atxHeadingText",start:t[s][1].start,end:t[r][1].end},o={type:"chunkText",start:t[s][1].start,end:t[r][1].end,contentType:"text"},lo(t,s,r-s+1,[["enter",n,e],["enter",o,e],["exit",o,e],["exit",n,e]])),t},tokenize:function(t,e,n){let o=0;return function(l){return t.enter("atxHeading"),function(c){return t.enter("atxHeadingSequence"),r(c)}(l)};function r(l){return l===35&&o++<6?(t.consume(l),r):l===null||_n(l)?(t.exit("atxHeadingSequence"),s(l)):n(l)}function s(l){return l===35?(t.enter("atxHeadingSequence"),i(l)):l===null||Ke(l)?(t.exit("atxHeading"),e(l)):ht(l)?bt(t,s,"whitespace")(l):(t.enter("atxHeadingText"),a(l))}function i(l){return l===35?(t.consume(l),i):(t.exit("atxHeadingSequence"),s(l))}function a(l){return l===null||l===35||_n(l)?(t.exit("atxHeadingText"),s(l)):(t.consume(l),a)}}},PP=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Lk=["pre","script","style","textarea"],LP={concrete:!0,name:"htmlFlow",resolveTo:function(t){let e=t.length;for(;e--&&(t[e][0]!=="enter"||t[e][1].type!=="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t},tokenize:function(t,e,n){const o=this;let r,s,i,a,l;return function(N){return function(H){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(H),c}(N)};function c(N){return N===33?(t.consume(N),d):N===47?(t.consume(N),s=!0,p):N===63?(t.consume(N),r=3,o.interrupt?e:P):co(N)?(t.consume(N),i=String.fromCharCode(N),_):n(N)}function d(N){return N===45?(t.consume(N),r=2,u):N===91?(t.consume(N),r=5,a=0,f):co(N)?(t.consume(N),r=4,o.interrupt?e:P):n(N)}function u(N){return N===45?(t.consume(N),o.interrupt?e:P):n(N)}function f(N){return N==="CDATA[".charCodeAt(a++)?(t.consume(N),a===6?o.interrupt?e:T:f):n(N)}function p(N){return co(N)?(t.consume(N),i=String.fromCharCode(N),_):n(N)}function _(N){if(N===null||N===47||N===62||_n(N)){const H=N===47,G=i.toLowerCase();return H||s||!Lk.includes(G)?PP.includes(i.toLowerCase())?(r=6,H?(t.consume(N),g):o.interrupt?e(N):T(N)):(r=7,o.interrupt&&!o.parser.lazy[o.now().line]?n(N):s?m(N):b(N)):(r=1,o.interrupt?e(N):T(N))}return N===45||kn(N)?(t.consume(N),i+=String.fromCharCode(N),_):n(N)}function g(N){return N===62?(t.consume(N),o.interrupt?e:T):n(N)}function m(N){return ht(N)?(t.consume(N),m):j(N)}function b(N){return N===47?(t.consume(N),j):N===58||N===95||co(N)?(t.consume(N),x):ht(N)?(t.consume(N),b):j(N)}function x(N){return N===45||N===46||N===58||N===95||kn(N)?(t.consume(N),x):y(N)}function y(N){return N===61?(t.consume(N),v):ht(N)?(t.consume(N),y):b(N)}function v(N){return N===null||N===60||N===61||N===62||N===96?n(N):N===34||N===39?(t.consume(N),l=N,k):ht(N)?(t.consume(N),v):S(N)}function k(N){return N===l?(t.consume(N),l=null,E):N===null||Ke(N)?n(N):(t.consume(N),k)}function S(N){return N===null||N===34||N===39||N===47||N===60||N===61||N===62||N===96||_n(N)?y(N):(t.consume(N),S)}function E(N){return N===47||N===62||ht(N)?b(N):n(N)}function j(N){return N===62?(t.consume(N),I):n(N)}function I(N){return N===null||Ke(N)?T(N):ht(N)?(t.consume(N),I):n(N)}function T(N){return N===45&&r===2?(t.consume(N),O):N===60&&r===1?(t.consume(N),z):N===62&&r===4?(t.consume(N),C):N===63&&r===3?(t.consume(N),P):N===93&&r===5?(t.consume(N),V):!Ke(N)||r!==6&&r!==7?N===null||Ke(N)?(t.exit("htmlFlowData"),M(N)):(t.consume(N),T):(t.exit("htmlFlowData"),t.check(FP,$,M)(N))}function M(N){return t.check(zP,L,$)(N)}function L(N){return t.enter("lineEnding"),t.consume(N),t.exit("lineEnding"),B}function B(N){return N===null||Ke(N)?M(N):(t.enter("htmlFlowData"),T(N))}function O(N){return N===45?(t.consume(N),P):T(N)}function z(N){return N===47?(t.consume(N),i="",F):T(N)}function F(N){if(N===62){const H=i.toLowerCase();return Lk.includes(H)?(t.consume(N),C):T(N)}return co(N)&&i.length<8?(t.consume(N),i+=String.fromCharCode(N),F):T(N)}function V(N){return N===93?(t.consume(N),P):T(N)}function P(N){return N===62?(t.consume(N),C):N===45&&r===2?(t.consume(N),P):T(N)}function C(N){return N===null||Ke(N)?(t.exit("htmlFlowData"),$(N)):(t.consume(N),C)}function $(N){return t.exit("htmlFlow"),e(N)}}},FP={partial:!0,tokenize:function(t,e,n){return function(o){return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),t.attempt(ql,e,n)}}},zP={partial:!0,tokenize:function(t,e,n){const o=this;return function(s){return Ke(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),r):n(s)};function r(s){return o.parser.lazy[o.now().line]?n(s):e(s)}}},BP={name:"htmlText",tokenize:function(t,e,n){const o=this;let r,s,i;return function(C){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(C),a};function a(C){return C===33?(t.consume(C),l):C===47?(t.consume(C),v):C===63?(t.consume(C),x):co(C)?(t.consume(C),E):n(C)}function l(C){return C===45?(t.consume(C),c):C===91?(t.consume(C),s=0,p):co(C)?(t.consume(C),b):n(C)}function c(C){return C===45?(t.consume(C),f):n(C)}function d(C){return C===null?n(C):C===45?(t.consume(C),u):Ke(C)?(i=d,F(C)):(t.consume(C),d)}function u(C){return C===45?(t.consume(C),f):d(C)}function f(C){return C===62?z(C):C===45?u(C):d(C)}function p(C){return C==="CDATA[".charCodeAt(s++)?(t.consume(C),s===6?_:p):n(C)}function _(C){return C===null?n(C):C===93?(t.consume(C),g):Ke(C)?(i=_,F(C)):(t.consume(C),_)}function g(C){return C===93?(t.consume(C),m):_(C)}function m(C){return C===62?z(C):C===93?(t.consume(C),m):_(C)}function b(C){return C===null||C===62?z(C):Ke(C)?(i=b,F(C)):(t.consume(C),b)}function x(C){return C===null?n(C):C===63?(t.consume(C),y):Ke(C)?(i=x,F(C)):(t.consume(C),x)}function y(C){return C===62?z(C):x(C)}function v(C){return co(C)?(t.consume(C),k):n(C)}function k(C){return C===45||kn(C)?(t.consume(C),k):S(C)}function S(C){return Ke(C)?(i=S,F(C)):ht(C)?(t.consume(C),S):z(C)}function E(C){return C===45||kn(C)?(t.consume(C),E):C===47||C===62||_n(C)?j(C):n(C)}function j(C){return C===47?(t.consume(C),z):C===58||C===95||co(C)?(t.consume(C),I):Ke(C)?(i=j,F(C)):ht(C)?(t.consume(C),j):z(C)}function I(C){return C===45||C===46||C===58||C===95||kn(C)?(t.consume(C),I):T(C)}function T(C){return C===61?(t.consume(C),M):Ke(C)?(i=T,F(C)):ht(C)?(t.consume(C),T):j(C)}function M(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(t.consume(C),r=C,L):Ke(C)?(i=M,F(C)):ht(C)?(t.consume(C),M):(t.consume(C),B)}function L(C){return C===r?(t.consume(C),r=void 0,O):C===null?n(C):Ke(C)?(i=L,F(C)):(t.consume(C),L)}function B(C){return C===null||C===34||C===39||C===60||C===61||C===96?n(C):C===47||C===62||_n(C)?j(C):(t.consume(C),B)}function O(C){return C===47||C===62||_n(C)?j(C):n(C)}function z(C){return C===62?(t.consume(C),t.exit("htmlTextData"),t.exit("htmlText"),e):n(C)}function F(C){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(C),t.exit("lineEnding"),V}function V(C){return ht(C)?bt(t,P,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):P(C)}function P(C){return t.enter("htmlTextData"),i(C)}}},If={name:"labelEnd",resolveAll:function(t){let e=-1;const n=[];for(;++e<t.length;){const o=t[e][1];if(n.push(t[e]),o.type==="labelImage"||o.type==="labelLink"||o.type==="labelEnd"){const r=o.type==="labelImage"?4:2;o.type="data",e+=r}}return t.length!==n.length&&lo(t,0,t.length,n),t},resolveTo:function(t,e){let n,o,r,s,i=t.length,a=0;for(;i--;)if(n=t[i][1],o){if(n.type==="link"||n.type==="labelLink"&&n._inactive)break;t[i][0]==="enter"&&n.type==="labelLink"&&(n._inactive=!0)}else if(r){if(t[i][0]==="enter"&&(n.type==="labelImage"||n.type==="labelLink")&&!n._balanced&&(o=i,n.type!=="labelLink")){a=2;break}}else n.type==="labelEnd"&&(r=i);const l={type:t[o][1].type==="labelLink"?"link":"image",start:{...t[o][1].start},end:{...t[t.length-1][1].end}},c={type:"label",start:{...t[o][1].start},end:{...t[r][1].end}},d={type:"labelText",start:{...t[o+a+2][1].end},end:{...t[r-2][1].start}};return s=[["enter",l,e],["enter",c,e]],s=zn(s,t.slice(o+1,o+a+3)),s=zn(s,[["enter",d,e]]),s=zn(s,Nf(e.parser.constructs.insideSpan.null,t.slice(o+a+4,r-3),e)),s=zn(s,[["exit",d,e],t[r-2],t[r-1],["exit",c,e]]),s=zn(s,t.slice(r+1)),s=zn(s,[["exit",l,e]]),lo(t,o,t.length,s),t},tokenize:function(t,e,n){const o=this;let r,s,i=o.events.length;for(;i--;)if((o.events[i][1].type==="labelImage"||o.events[i][1].type==="labelLink")&&!o.events[i][1]._balanced){r=o.events[i][1];break}return function(u){return r?r._inactive?d(u):(s=o.parser.defined.includes(ys(o.sliceSerialize({start:r.end,end:o.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(u),t.exit("labelMarker"),t.exit("labelEnd"),a):n(u)};function a(u){return u===40?t.attempt(UP,c,s?c:d)(u):u===91?t.attempt(VP,c,s?l:d)(u):s?c(u):d(u)}function l(u){return t.attempt($P,c,d)(u)}function c(u){return e(u)}function d(u){return r._balanced=!0,n(u)}}},UP={tokenize:function(t,e,n){return function(d){return t.enter("resource"),t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),o};function o(d){return _n(d)?Yi(t,r)(d):r(d)}function r(d){return d===41?c(d):Dk(t,s,i,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function s(d){return _n(d)?Yi(t,a)(d):c(d)}function i(d){return n(d)}function a(d){return d===34||d===39||d===40?Pk(t,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):c(d)}function l(d){return _n(d)?Yi(t,c)(d):c(d)}function c(d){return d===41?(t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),t.exit("resource"),e):n(d)}}},VP={tokenize:function(t,e,n){const o=this;return function(i){return Rk.call(o,t,r,s,"reference","referenceMarker","referenceString")(i)};function r(i){return o.parser.defined.includes(ys(o.sliceSerialize(o.events[o.events.length-1][1]).slice(1,-1)))?e(i):n(i)}function s(i){return n(i)}}},$P={tokenize:function(t,e,n){return function(r){return t.enter("reference"),t.enter("referenceMarker"),t.consume(r),t.exit("referenceMarker"),o};function o(r){return r===93?(t.enter("referenceMarker"),t.consume(r),t.exit("referenceMarker"),t.exit("reference"),e):n(r)}}},HP={name:"labelStartImage",resolveAll:If.resolveAll,tokenize:function(t,e,n){const o=this;return function(i){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(i),t.exit("labelImageMarker"),r};function r(i){return i===91?(t.enter("labelMarker"),t.consume(i),t.exit("labelMarker"),t.exit("labelImage"),s):n(i)}function s(i){return i===94&&"_hiddenFootnoteSupport"in o.parser.constructs?n(i):e(i)}}},WP={name:"labelStartLink",resolveAll:If.resolveAll,tokenize:function(t,e,n){const o=this;return function(s){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(s),t.exit("labelMarker"),t.exit("labelLink"),r};function r(s){return s===94&&"_hiddenFootnoteSupport"in o.parser.constructs?n(s):e(s)}}},Af={name:"lineEnding",tokenize:function(t,e){return function(n){return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),bt(t,e,"linePrefix")}}},Gl={name:"thematicBreak",tokenize:function(t,e,n){let o,r=0;return function(a){return t.enter("thematicBreak"),function(l){return o=l,s(l)}(a)};function s(a){return a===o?(t.enter("thematicBreakSequence"),i(a)):r>=3&&(a===null||Ke(a))?(t.exit("thematicBreak"),e(a)):n(a)}function i(a){return a===o?(t.consume(a),r++,i):(t.exit("thematicBreakSequence"),ht(a)?bt(t,s,"whitespace")(a):s(a))}}},bn={continuation:{tokenize:function(t,e,n){const o=this;return o.containerState._closeFlow=void 0,t.check(ql,r,s);function r(a){return o.containerState.furtherBlankLines=o.containerState.furtherBlankLines||o.containerState.initialBlankLine,bt(t,e,"listItemIndent",o.containerState.size+1)(a)}function s(a){return o.containerState.furtherBlankLines||!ht(a)?(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,i(a)):(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,t.attempt(GP,e,i)(a))}function i(a){return o.containerState._closeFlow=!0,o.interrupt=void 0,bt(t,t.attempt(bn,e,n),"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}},exit:function(t){t.exit(this.containerState.type)},name:"list",tokenize:function(t,e,n){const o=this,r=o.events[o.events.length-1];let s=r&&r[1].type==="linePrefix"?r[2].sliceSerialize(r[1],!0).length:0,i=0;return function(f){const p=o.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(p==="listUnordered"?!o.containerState.marker||f===o.containerState.marker:Cf(f)){if(o.containerState.type||(o.containerState.type=p,t.enter(p,{_container:!0})),p==="listUnordered")return t.enter("listItemPrefix"),f===42||f===45?t.check(Gl,n,l)(f):l(f);if(!o.interrupt||f===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),a(f)}return n(f)};function a(f){return Cf(f)&&++i<10?(t.consume(f),a):(!o.interrupt||i<2)&&(o.containerState.marker?f===o.containerState.marker:f===41||f===46)?(t.exit("listItemValue"),l(f)):n(f)}function l(f){return t.enter("listItemMarker"),t.consume(f),t.exit("listItemMarker"),o.containerState.marker=o.containerState.marker||f,t.check(ql,o.interrupt?n:c,t.attempt(qP,u,d))}function c(f){return o.containerState.initialBlankLine=!0,s++,u(f)}function d(f){return ht(f)?(t.enter("listItemPrefixWhitespace"),t.consume(f),t.exit("listItemPrefixWhitespace"),u):n(f)}function u(f){return o.containerState.size=s+o.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(f)}}},qP={partial:!0,tokenize:function(t,e,n){const o=this;return bt(t,function(r){const s=o.events[o.events.length-1];return!ht(r)&&s&&s[1].type==="listItemPrefixWhitespace"?e(r):n(r)},"listItemPrefixWhitespace",o.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},GP={partial:!0,tokenize:function(t,e,n){const o=this;return bt(t,function(r){const s=o.events[o.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===o.containerState.size?e(r):n(r)},"listItemIndent",o.containerState.size+1)}},Fk={name:"setextUnderline",resolveTo:function(t,e){let n,o,r,s=t.length;for(;s--;)if(t[s][0]==="enter"){if(t[s][1].type==="content"){n=s;break}t[s][1].type==="paragraph"&&(o=s)}else t[s][1].type==="content"&&t.splice(s,1),r||t[s][1].type!=="definition"||(r=s);const i={type:"setextHeading",start:{...t[o][1].start},end:{...t[t.length-1][1].end}};return t[o][1].type="setextHeadingText",r?(t.splice(o,0,["enter",i,e]),t.splice(r+1,0,["exit",t[n][1],e]),t[n][1].end={...t[r][1].end}):t[n][1]=i,t.push(["exit",i,e]),t},tokenize:function(t,e,n){const o=this;let r;return function(a){let l,c=o.events.length;for(;c--;)if(o.events[c][1].type!=="lineEnding"&&o.events[c][1].type!=="linePrefix"&&o.events[c][1].type!=="content"){l=o.events[c][1].type==="paragraph";break}return!o.parser.lazy[o.now().line]&&(o.interrupt||l)?(t.enter("setextHeadingLine"),r=a,function(d){return t.enter("setextHeadingLineSequence"),s(d)}(a)):n(a)};function s(a){return a===r?(t.consume(a),s):(t.exit("setextHeadingLineSequence"),ht(a)?bt(t,i,"lineSuffix")(a):i(a))}function i(a){return a===null||Ke(a)?(t.exit("setextHeadingLine"),e(a)):n(a)}}},YP={tokenize:function(t){const e=this,n=t.attempt(ql,function(r){return r===null?void t.consume(r):(t.enter("lineEndingBlank"),t.consume(r),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n)},t.attempt(this.parser.constructs.flowInitial,o,bt(t,t.attempt(this.parser.constructs.flow,o,t.attempt(AP,o)),"linePrefix")));return n;function o(r){if(r!==null)return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),e.currentConstruct=void 0,n;t.consume(r)}}},JP={resolveAll:Bk()},KP=zk("string"),XP=zk("text");function zk(t){return{resolveAll:Bk(t==="text"?ZP:void 0),tokenize:function(e){const n=this,o=this.parser.constructs[t],r=e.attempt(o,s,i);return s;function s(c){return l(c)?r(c):i(c)}function i(c){if(c!==null)return e.enter("data"),e.consume(c),a;e.consume(c)}function a(c){return l(c)?(e.exit("data"),r(c)):(e.consume(c),a)}function l(c){if(c===null)return!0;const d=o[c];let u=-1;if(d)for(;++u<d.length;){const f=d[u];if(!f.previous||f.previous.call(n,n.previous))return!0}return!1}}}}function Bk(t){return function(e,n){let o,r=-1;for(;++r<=e.length;)o===void 0?e[r]&&e[r][1].type==="data"&&(o=r,r++):e[r]&&e[r][1].type==="data"||(r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),r=o+2),o=void 0);return t?t(e,n):e}}function ZP(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const o=t[n-1][1],r=e.sliceStream(o);let s,i=r.length,a=-1,l=0;for(;i--;){const c=r[i];if(typeof c=="string"){for(a=c.length;c.charCodeAt(a-1)===32;)l++,a--;if(a)break;a=-1}else if(c===-2)s=!0,l++;else if(c!==-1){i++;break}}if(l){const c={type:n===t.length||s||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?a:o.start._bufferIndex+a,_index:o.start._index+i,line:o.end.line,column:o.end.column-l,offset:o.end.offset-l},end:{...o.end}};o.end={...c.start},o.start.offset===o.end.offset?Object.assign(o,c):(t.splice(n,0,["enter",c,e],["exit",c,e]),n+=2)}n++}return t}const QP={42:bn,43:bn,45:bn,48:bn,49:bn,50:bn,51:bn,52:bn,53:bn,54:bn,55:bn,56:bn,57:bn,62:Ek},eL={91:MP},tL={[-2]:Ef,[-1]:Ef,32:Ef},nL={35:RP,42:Gl,45:[Fk,Gl],60:LP,61:Fk,95:Gl,96:Mk,126:Mk},oL={38:Ak,92:Ik},rL={[-5]:Af,[-4]:Af,[-3]:Af,33:HP,38:Ak,42:jf,60:[CP,BP],91:WP,92:[DP,Ik],93:If,95:jf,96:jP},sL={null:[jf,JP]},iL=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:{null:[42,95]},contentInitial:eL,disable:{null:[]},document:QP,flow:nL,flowInitial:tL,insideSpan:sL,string:oL,text:rL},Symbol.toStringTag,{value:"Module"}));function aL(t,e,n){let o={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const r={},s=[];let i=[],a=[];const l={attempt:m(function(y,v){b(y,v.from)}),check:m(g),consume:function(y){Ke(y)?(o.line++,o.column=1,o.offset+=y===-3?2:1,x()):y!==-1&&(o.column++,o.offset++),o._bufferIndex<0?o._index++:(o._bufferIndex++,o._bufferIndex===i[o._index].length&&(o._bufferIndex=-1,o._index++)),c.previous=y},enter:function(y,v){const k=v||{};return k.type=y,k.start=f(),c.events.push(["enter",k,c]),a.push(k),k},exit:function(y){const v=a.pop();return v.end=f(),c.events.push(["exit",v,c]),v},interrupt:m(g,{interrupt:!0})},c={code:null,containerState:{},defineSkip:function(y){r[y.line]=y.column,x()},events:[],now:f,parser:t,previous:null,sliceSerialize:function(y,v){return function(k,S){let E=-1;const j=[];let I;for(;++E<k.length;){const T=k[E];let M;if(typeof T=="string")M=T;else switch(T){case-5:M="\r";break;case-4:M=`
124
+ hover/column:hover:bg-primary/60 dark:hover/column:hover:bg-primary/60`})}const gM=Zt(t=>{const e=t(xp);for(const n of e.cellIds.inOrderIds){const o=e.cellRuntime[n];if(o.status==="idle"&&o.consoleOutputs.some(r=>r.channel==="stdin"&&r.response===void 0))return!0}return!1}),_M=()=>{const t=X.c(3),e=bM;if(!He(gM))return null;let n,o,r;if(t[0]===Symbol.for("react.memo_cache_sentinel")?(n=h.jsx("div",{className:"flex justify-between",children:h.jsx("span",{className:"font-bold text-lg flex items-center mb-1",children:"Program waiting for input"})}),t[0]=n):n=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx(la,{className:"inline",children:"stdin"}),t[1]=o):o=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")){const s=h.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-1/2 transform -translate-x-1/2 z-[200] opacity-95",children:h.jsxs(Pc,{kind:"info",className:"flex flex-col rounded py-2 px-4 animate-in slide-in-from-top w-fit",children:[n,h.jsx("div",{className:"flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",children:h.jsx("div",{children:h.jsxs("p",{children:["The program is still running, but blocked on"," ",o,".",h.jsx(Pe,{variant:"link",className:"h-auto font-normal",onClick:e,children:"Jump to the cell"})]})})})]})});r=h.jsx(j4,{milliseconds:2e3,children:s}),t[2]=r}else r=t[2];return r};function bM(){const t=document.querySelector("[data-stdin-blocking]");t?(t.scrollIntoView({behavior:"smooth",block:"center"}),requestAnimationFrame(()=>{t.focus()})):Xt.error("No element with data-stdin-blocking found")}const yM=t=>{const e=X.c(8),n=He(DU),o=t.appConfig.width==="columns";let r,s,i;return e[0]!==t?(r=h.jsx(xM,{...t}),e[0]=t,e[1]=r):r=e[1],e[2]!==n||e[3]!==r?(s=h.jsx(a0,{id:"column-container",items:n,strategy:KE,children:r}),e[2]=n,e[3]=r,e[4]=s):s=e[4],e[5]!==o||e[6]!==s?(i=h.jsx(lM,{multiColumn:o,children:s}),e[5]=o,e[6]=s,e[7]=i):i=e[7],i},xM=t=>{const e=X.c(50),{mode:n,userConfig:o,appConfig:r,connStatus:s}=t,i=vc(),a=Lt(),{theme:l}=Fo(),{toggleSidebarPanel:c}=na(),{invisible:d}=O$(i.cellIds.idLength,n);qt("global.focusTop",a.focusTopCell),qt("global.focusBottom",a.focusBottomCell),qt("global.toggleSidebar",c),qt("global.foldCode",a.foldAll),qt("global.unfoldCode",a.unfoldAll),qt("global.formatAll",kM),qt("cell.hideCode",jn.NOOP),qt("cell.format",jn.NOOP);const u=ad(),f=a.scrollToTarget;let p,_,g,m,b,x,y,v,k,S,E,j,I,T,M;if(e[0]!==i.scrollKey||e[1]!==f?(p=()=>{i.scrollKey!==null&&f()},e[0]=i.scrollKey,e[1]=f,e[2]=p):p=e[2],e[3]!==i.cellIds||e[4]!==i.scrollKey||e[5]!==f?(_=[i.cellIds,i.scrollKey,f],e[3]=i.cellIds,e[4]=i.scrollKey,e[5]=f,e[6]=_):_=e[6],A.useEffect(p,_),e[7]!==a||e[8]!==r||e[9]!==s||e[10]!==d||e[11]!==n||e[12]!==i||e[13]!==u||e[14]!==l||e[15]!==o){const L=i.cellIds.getColumns();let B;e[26]!==i.cellIds?(B=i.cellIds.hasOnlyOneId(),e[26]=i.cellIds,e[27]=B):B=e[27];const O=B;let z;e[28]!==i.cellIds.inOrderIds?(z=i.cellIds.inOrderIds.includes(Ho),e[28]=i.cellIds.inOrderIds,e[29]=z):z=e[29];const F=z;g=D$,v="pb-[40vh]",k=d,S=r,E="pr-4",e[30]===Symbol.for("react.memo_cache_sentinel")?(j=h.jsx(X7,{}),m=h.jsx(_M,{}),e[30]=m,e[31]=j):(m=e[30],j=e[31]),e[32]!==r.width?(b=h.jsx(Y7,{width:r.width}),e[32]=r.width,e[33]=b):b=e[33];const V=r.width==="columns"&&"grid grid-flow-col auto-cols-min gap-6";e[34]!==V?(x=Oe(V),e[34]=V,e[35]=x):x=e[35],y=L.map((P,C)=>h.jsx(wM,{column:P,index:C,columnsLength:L.length,appConfig:r,notebook:i,mode:n,userConfig:o,connStatus:s,actions:a,theme:l,hasOnlyOneCell:O,invisible:d,hasSetupCell:F,onDeleteCell:u},P.id)),e[7]=a,e[8]=r,e[9]=s,e[10]=d,e[11]=n,e[12]=i,e[13]=u,e[14]=l,e[15]=o,e[16]=g,e[17]=m,e[18]=b,e[19]=x,e[20]=y,e[21]=v,e[22]=k,e[23]=S,e[24]=E,e[25]=j}else g=e[16],m=e[17],b=e[18],x=e[19],y=e[20],v=e[21],k=e[22],S=e[23],E=e[24],j=e[25];return e[36]!==x||e[37]!==y?(I=h.jsx("div",{className:x,children:y}),e[36]=x,e[37]=y,e[38]=I):I=e[38],e[39]===Symbol.for("react.memo_cache_sentinel")?(T=h.jsx(R$,{}),e[39]=T):T=e[39],e[40]!==g||e[41]!==m||e[42]!==b||e[43]!==I||e[44]!==v||e[45]!==k||e[46]!==S||e[47]!==E||e[48]!==j?(M=h.jsxs(g,{className:v,invisible:k,appConfig:S,innerClassName:E,children:[j,m,b,I,T]}),e[40]=g,e[41]=m,e[42]=b,e[43]=I,e[44]=v,e[45]=k,e[46]=S,e[47]=E,e[48]=j,e[49]=M):M=e[49],M},wM=t=>{const e=X.c(42),{column:n,index:o,columnsLength:r,appConfig:s,notebook:i,mode:a,userConfig:l,connStatus:c,actions:d,theme:u,hasOnlyOneCell:f,invisible:p,hasSetupCell:_,onDeleteCell:g}=t,m=c.state!==en.OPEN,b=n.id,x=o>0,y=o<r-1,v=s.width,k=r>1,S=n.id,E=s.width==="columns"&&"opacity-0 group-hover/column:opacity-100";let j,I;e[0]!==E?(j=Oe(E),e[0]=E,e[1]=j):j=e[1],e[2]!==n.id||e[3]!==j?(I=h.jsx(vM,{columnId:S,className:j}),e[2]=n.id,e[3]=j,e[4]=I):I=e[4];const T=`column-${o+1}`,M=n.topLevelIds;let L,B,O,z;return e[5]!==d||e[6]!==m||e[7]!==_||e[8]!==o||e[9]!==p||e[10]!==a||e[11]!==i||e[12]!==g||e[13]!==u||e[14]!==l?(L=o===0&&_&&h.jsx(kx,{theme:u,showPlaceholder:!1,allowFocus:!p,...i.cellData[Ho],...i.cellRuntime[Ho],...d,runElapsedTimeMs:i.cellRuntime[Ho].runElapsedTimeMs??i.cellData[Ho].lastExecutionTime,canDelete:!0,mode:a,appClosed:m,ref:i.cellHandles[Ho],userConfig:l,isCollapsed:!1,collapseCount:0,canMoveX:!1,actions:d,deleteCell:g},Ho),e[5]=d,e[6]=m,e[7]=_,e[8]=o,e[9]=p,e[10]=a,e[11]=i,e[12]=g,e[13]=u,e[14]=l,e[15]=L):L=e[15],e[16]!==d||e[17]!==m||e[18]!==s.width||e[19]!==n||e[20]!==f||e[21]!==p||e[22]!==a||e[23]!==i||e[24]!==g||e[25]!==u||e[26]!==l?(B=n.topLevelIds.map(F=>{if(F===Ho)return null;const V=i.cellData[F],P=i.cellRuntime[F];return h.jsx(kx,{theme:u,showPlaceholder:f,allowFocus:!p,...V,...P,runElapsedTimeMs:P.runElapsedTimeMs??V.lastExecutionTime,canDelete:!f,mode:a,appClosed:m,ref:i.cellHandles[F],userConfig:l,config:V.config,name:V.name,isCollapsed:n.isCollapsed(F),collapseCount:n.getCount(F),canMoveX:s.width==="columns",actions:d,deleteCell:g},V.id.toString())}),e[16]=d,e[17]=m,e[18]=s.width,e[19]=n,e[20]=f,e[21]=p,e[22]=a,e[23]=i,e[24]=g,e[25]=u,e[26]=l,e[27]=B):B=e[27],e[28]!==n.topLevelIds||e[29]!==T||e[30]!==L||e[31]!==B?(O=h.jsxs(a0,{id:T,items:M,strategy:XE,children:[L,B]}),e[28]=n.topLevelIds,e[29]=T,e[30]=L,e[31]=B,e[32]=O):O=e[32],e[33]!==s.width||e[34]!==n.id||e[35]!==o||e[36]!==O||e[37]!==x||e[38]!==y||e[39]!==k||e[40]!==I?(z=h.jsx(Cx,{columnId:b,index:o,canMoveLeft:x,canMoveRight:y,width:v,canDelete:k,footer:I,children:O}),e[33]=s.width,e[34]=n.id,e[35]=o,e[36]=O,e[37]=x,e[38]=y,e[39]=k,e[40]=I,e[41]=z):z=e[41],z},vM=t=>{const e=X.c(17),{columnId:n,className:o}=t,{createNewCell:r}=Lt(),s=He(Ts),[i,a]=RU(!1),l=He(sc);let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=Oe("mb-0 rounded-none sm:px-4 md:px-5 lg:px-8 tracking-wide no-wrap whitespace-nowrap","hover:bg-accent hover:text-accent-foreground font-semibold uppercase text-xs"),e[0]=c):c=e[0];const d=c;let u;e[1]!==l||e[2]!==s||e[3]!==n||e[4]!==r||e[5]!==i||e[6]!==a.toggle?(u=()=>i?h.jsx(PU,{onClose:a.toggle}):h.jsxs(h.Fragment,{children:[h.jsxs(Pe,{className:d,variant:"text",size:"sm",onClick:()=>r({cellId:{type:"__end__",columnId:n},before:!1}),children:[h.jsx(Fm,{className:"mr-2 size-4 flex-shrink-0"}),"Python"]}),h.jsxs(Pe,{className:d,variant:"text",size:"sm",onClick:()=>{ar(s,r),r({cellId:{type:"__end__",columnId:n},before:!1,code:new ta().defaultCode})},children:[h.jsx(Um,{className:"mr-2 size-4 flex-shrink-0"}),"Markdown"]}),h.jsxs(Pe,{className:d,variant:"text",size:"sm",onClick:()=>{ar(s,r),r({cellId:{type:"__end__",columnId:n},before:!1,code:new Ec().defaultCode})},children:[h.jsx(lr,{className:"mr-2 size-4 flex-shrink-0"}),"SQL"]}),h.jsx(Re,{content:l?null:h.jsx("span",{children:"Enable via settings under AI Assist"}),delayDuration:100,asChild:!1,children:h.jsxs(Pe,{className:d,variant:"text",size:"sm",disabled:!l,onClick:a.toggle,children:[h.jsx(Xi,{className:"mr-2 size-4 flex-shrink-0"}),"Generate with AI"]})})]}),e[1]=l,e[2]=s,e[3]=n,e[4]=r,e[5]=i,e[6]=a.toggle,e[7]=u):u=e[7];const f=u,p=!i&&"w-fit",_=i&&"opacity-100 w-full max-w-4xl shadow-lg shadow-[var(--blue-3)]";let g,m,b;return e[8]!==o||e[9]!==p||e[10]!==_?(g=Oe("shadow-sm border border-border rounded transition-all duration-200 overflow-hidden divide-x divide-border flex",p,_,o),e[8]=o,e[9]=p,e[10]=_,e[11]=g):g=e[11],e[12]!==f?(m=f(),e[12]=f,e[13]=m):m=e[13],e[14]!==g||e[15]!==m?(b=h.jsx("div",{className:"flex justify-center mt-4 pt-6 pb-32 group gap-4 w-full print:hidden",children:h.jsx("div",{className:g,children:m})}),e[14]=g,e[15]=m,e[16]=b):b=e[16],b};function kM(){r4()}const Nx=t=>{const e=X.c(65),{userConfig:n,appConfig:o,hideControls:r}=t,s=r!==void 0&&r;LU(D4,ON);const{setCells:i,mergeAllColumns:a,collapseAllCells:l,expandAllCells:c}=Lt(),d=He(fp),u=He(FU),f=He(zU),p=mc(),_=Qt(gd),g=d.mode==="edit",m=d.mode==="present",b=He(BU);let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=[],e[0]=x):x=e[0],A.useEffect(CM,x);const y=n.runtime.auto_instantiate;let v,k,S;e[1]!==i||e[2]!==_?(v=(ce,he)=>{i(ce);const de=ce.map(NM),me=ce.map(jM),ie=ce.map(EM);_({names:de,codes:me,configs:ie,layout:he})},e[1]=i,e[2]=_,e[3]=v):v=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(k=k4(),e[4]=k):k=e[4],e[5]!==v||e[6]!==n.runtime.auto_instantiate?(S={autoInstantiate:y,setCells:v,sessionId:k},e[5]=v,e[6]=n.runtime.auto_instantiate,e[7]=S):S=e[7];const{connection:E}=P$(S);let j,I;e[8]!==o.app_title||e[9]!==p?(j=()=>{document.title=o.app_title||$n.basename(p??"")||"Untitled Notebook"},I=[o.app_title,p],e[8]=o.app_title,e[9]=p,e[10]=j,e[11]=I):(j=e[10],I=e[11]),A.useEffect(j,I);const T=Mc(o.width);let M,L;e[12]!==o.width||e[13]!==a||e[14]!==T?(M=()=>{T==="columns"&&o.width!=="columns"&&a()},e[12]=o.width,e[13]=a,e[14]=T,e[15]=M):M=e[15],e[16]!==o.width||e[17]!==a||e[18]!==u||e[19]!==T?(L=[o.width,T,a,u],e[16]=o.width,e[17]=a,e[18]=u,e[19]=T,e[20]=L):L=e[20],A.useEffect(M,L);const B=function(){const ce=X.c(2),he=rd();let de;return ce[0]!==he?(de=()=>he(AF(fo())),ce[0]=he,ce[1]=de):de=ce[1],Qe(de)}(),O=Zm(),z=ng();let F,V,P,C,$,N;e[21]!==B?(F=()=>{B()},e[21]=B,e[22]=F):F=e[22],qt("global.runStale",F),qt("global.interrupt",IM),e[23]!==z?(V=()=>{z()},e[23]=z,e[24]=V):V=e[24],qt("global.hideCode",V),e[25]!==O?(P=()=>{O()},e[25]=O,e[26]=P):P=e[26],qt("global.runAll",P),e[27]!==l?(C=()=>{l()},e[27]=l,e[28]=C):C=e[28],qt("global.collapseAllSections",C),e[29]!==c?($=()=>{c()},e[29]=c,e[30]=$):$=e[30],qt("global.expandAllSections",$),e[31]!==o||e[32]!==E||e[33]!==n||e[34]!==d.mode?(N=h.jsx(yM,{connStatus:E,mode:d.mode,userConfig:n,appConfig:o}),e[31]=o,e[32]=E,e[33]=n,e[34]=d.mode,e[35]=N):N=e[35];const H=N,G=o.width;let Z,q,re,ne,oe,Y,Q;return e[36]===Symbol.for("react.memo_cache_sentinel")?(Z=Oe("pt-4 sm:pt-12 pb-2 mb-4 print:hidden z-50","sticky left-0"),e[36]=Z):Z=e[36],e[37]!==p||e[38]!==g?(q=g&&h.jsx("div",{className:"flex items-center justify-center container",children:h.jsx(TN,{filename:p})}),e[37]=p,e[38]=g,e[39]=q):q=e[39],e[40]!==E||e[41]!==q?(re=h.jsx(F$,{connection:E,className:Z,children:q}),e[40]=E,e[41]=q,e[42]=re):re=e[42],e[43]!==o||e[44]!==H||e[45]!==f||e[46]!==d.mode?(ne=f&&h.jsx(L$,{appConfig:o,mode:d.mode,children:H}),e[43]=o,e[44]=H,e[45]=f,e[46]=d.mode,e[47]=ne):ne=e[47],e[48]!==o.width||e[49]!==E||e[50]!==b||e[51]!==re||e[52]!==ne?(oe=h.jsxs(z$,{connection:E,isRunning:b,width:G,children:[re,ne]}),e[48]=o.width,e[49]=E,e[50]=b,e[51]=re,e[52]=ne,e[53]=oe):oe=e[53],e[54]!==o||e[55]!==E||e[56]!==s||e[57]!==m||e[58]!==b||e[59]!==B||e[60]!==z?(Y=!s&&h.jsx(Lc,{children:h.jsx(NN,{presenting:m,onTogglePresenting:z,onInterrupt:Lp,onRun:B,closed:E.state===en.CLOSED,running:b,appConfig:o})}),e[54]=o,e[55]=E,e[56]=s,e[57]=m,e[58]=b,e[59]=B,e[60]=z,e[61]=Y):Y=e[61],e[62]!==oe||e[63]!==Y?(Q=h.jsxs(h.Fragment,{children:[oe,Y]}),e[62]=oe,e[63]=Y,e[64]=Q):Q=e[64],Q};function SM(){kS.INSTANCE.stop()}function CM(){return kS.INSTANCE.start(UU),SM}function NM(t){return t.name}function jM(t){return t.code}function EM(t){return t.config}function IM(){Lp()}const AM=t=>{const e=X.c(17),[n,o]=A.useState(0),r=He(mo);let s,i,a,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=()=>o(DM),i={delayMs:1e4,whenVisible:!0},e[0]=s,e[1]=i):(s=e[0],i=e[1]),Vc(s,i),e[2]!==r.state?(a=async()=>Bn()||r.state!==en.OPEN?null:VU(),e[2]=r.state,e[3]=a):a=e[3],e[4]!==r.state||e[5]!==n?(l=[n,r.state],e[4]=r.state,e[5]=n,e[6]=l):l=e[6];const{data:c}=Xn(a,l);let d,u,f,p;return e[7]!==c?(d=(c==null?void 0:c.gpu)&&c.gpu.length>0&&h.jsx(OM,{gpus:c.gpu}),e[7]=c,e[8]=d):d=e[8],e[9]!==c?(u=c&&h.jsx(TM,{memory:c.memory,kernel:c.kernel,server:c.server}),e[9]=c,e[10]=u):u=e[10],e[11]!==c?(f=c&&h.jsx(MM,{cpu:c.cpu}),e[11]=c,e[12]=f):f=e[12],e[13]!==d||e[14]!==u||e[15]!==f?(p=h.jsxs("div",{className:"flex gap-2 items-center px-1",children:[d,u,f]}),e[13]=d,e[14]=u,e[15]=f,e[16]=p):p=e[16],p},TM=t=>{const e=X.c(25),{memory:n,kernel:o,server:r}=t,{percent:s,total:i,available:a}=n;let l;e[0]!==s?(l=Math.round(s),e[0]=s,e[1]=l):l=e[1];const c=l;let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsx("b",{children:"computer memory:"}),e[2]=d):d=e[2];const u=i-a;let f,p,_,g,m,b,x,y,v;return e[3]!==u?(f=Uu(u),e[3]=u,e[4]=f):f=e[4],e[5]!==i?(p=Uu(i),e[5]=i,e[6]=p):p=e[6],e[7]!==c||e[8]!==f||e[9]!==p?(_=h.jsxs("span",{children:[d," ",f," / ",p," GB (",c,"%)"]}),e[7]=c,e[8]=f,e[9]=p,e[10]=_):_=e[10],e[11]!==r?(g=(r==null?void 0:r.memory)&&h.jsxs("span",{children:[h.jsx("b",{children:"marimo server:"})," ",Nl(r.memory)]}),e[11]=r,e[12]=g):g=e[12],e[13]!==o?(m=(o==null?void 0:o.memory)&&h.jsxs("span",{children:[h.jsx("b",{children:"kernel:"})," ",Nl(o.memory)]}),e[13]=o,e[14]=m):m=e[14],e[15]!==_||e[16]!==g||e[17]!==m?(b=h.jsxs("div",{className:"flex flex-col gap-1",children:[_,g,m]}),e[15]=_,e[16]=g,e[17]=m,e[18]=b):b=e[18],e[19]===Symbol.for("react.memo_cache_sentinel")?(x=h.jsx(Nm,{className:"w-4 h-4"}),e[19]=x):x=e[19],e[20]!==c?(y=h.jsxs("div",{className:"flex items-center gap-1",children:[x,h.jsx(Bu,{percent:c,colorClassName:"bg-primary"})]}),e[20]=c,e[21]=y):y=e[21],e[22]!==y||e[23]!==b?(v=h.jsx(Re,{delayDuration:200,content:b,children:y}),e[22]=y,e[23]=b,e[24]=v):v=e[24],v},MM=t=>{const e=X.c(11),{cpu:n}=t,{percent:o}=n;let r;e[0]!==o?(r=Math.round(o),e[0]=o,e[1]=r):r=e[1];const s=r;let i,a,l,c,d;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsx("b",{children:"CPU:"}),e[2]=i):i=e[2],e[3]!==s?(a=h.jsxs("span",{children:[i," ",s,"%"]}),e[3]=s,e[4]=a):a=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx(y$,{className:"w-4 h-4"}),e[5]=l):l=e[5],e[6]!==s?(c=h.jsxs("div",{className:"flex items-center gap-1",children:[l,h.jsx(Bu,{percent:s,colorClassName:"bg-primary"})]}),e[6]=s,e[7]=c):c=e[7],e[8]!==a||e[9]!==c?(d=h.jsx(Re,{delayDuration:200,content:a,children:c}),e[8]=a,e[9]=c,e[10]=d):d=e[10],d},OM=t=>{const e=X.c(12),{gpus:n}=t;let o;e[0]!==n?(o=Math.round(n.reduce(RM,0)/n.length),e[0]=n,e[1]=o):o=e[1];const r=o;let s,i,a,l,c;return e[2]!==n?(s=n.map(PM),e[2]=n,e[3]=s):s=e[3],e[4]!==s?(i=h.jsx("div",{className:"flex flex-col gap-1",children:s}),e[4]=s,e[5]=i):i=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx(Em,{className:"w-4 h-4"}),e[6]=a):a=e[6],e[7]!==r?(l=h.jsxs("div",{className:"flex items-center gap-1",children:[a,h.jsx(Bu,{percent:r,colorClassName:"bg-[var(--grass-9)]"})]}),e[7]=r,e[8]=l):l=e[8],e[9]!==i||e[10]!==l?(c=h.jsx(Re,{delayDuration:200,content:i,children:l}),e[9]=i,e[10]=l,e[11]=c):c=e[11],c},Bu=t=>{const e=X.c(7),{percent:n,colorClassName:o}=t;let r;e[0]!==o?(r=Oe("h-full bg-primary",o),e[0]=o,e[1]=r):r=e[1];const s=`${n}%`;let i,a;return e[2]!==s?(i={width:s},e[2]=s,e[3]=i):i=e[3],e[4]!==r||e[5]!==i?(a=h.jsx("div",{className:"h-3 w-20 bg-[var(--slate-4)] rounded-lg overflow-hidden border",children:h.jsx("div",{className:r,style:i})}),e[4]=r,e[5]=i,e[6]=a):a=e[6],a};function Nl(t){return t>1073741824?`${Uu(t)} GB`:`${function(e){return new Intl.NumberFormat("en-US",{maximumFractionDigits:0}).format(e/1048576)}(t)} MB`}function Uu(t){return new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(t/1073741824)}function DM(t){return t+1}function RM(t,e){return t+e.memory.percent}function PM(t){return h.jsxs("span",{children:[h.jsxs("b",{children:["GPU ",t.index," (",t.name,"):"]})," ",Nl(t.memory.used)," / ",Nl(t.memory.total)," GB (",Math.round(t.memory.percent),"%)"]},t.index)}const jx=t=>He($U)[t.capability]?t.children:null,so=A.forwardRef((t,e)=>{const n=X.c(18);let o,r,s,i,a;n[0]!==t?({children:o,tooltip:a,selected:i,className:r,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i,n[5]=a):(o=n[1],r=n[2],s=n[3],i=n[4],a=n[5]);const l=!i&&"hover:bg-[var(--sage-3)]",c=i&&"bg-[var(--sage-4)]";let d,u;n[6]!==r||n[7]!==l||n[8]!==c?(d=Oe("h-full flex items-center p-2 text-sm shadow-inset font-mono cursor-pointer rounded",l,c,r),n[6]=r,n[7]=l,n[8]=c,n[9]=d):d=n[9],n[10]!==o||n[11]!==e||n[12]!==s||n[13]!==d?(u=h.jsx("div",{ref:e,className:d,...s,children:o}),n[10]=o,n[11]=e,n[12]=s,n[13]=d,n[14]=u):u=n[14];const f=u;if(a){let p;return n[15]!==f||n[16]!==a?(p=h.jsx(Re,{content:a,side:"top",delayDuration:200,children:f}),n[15]=f,n[16]=a,n[17]=p):p=n[17],p}return f});so.displayName="FooterItem";const LM=()=>{var d;const t=X.c(14),e=He(R4),n=He(sc),o=((d=e==null?void 0:e.open_ai)==null?void 0:d.model)||"gpt-4-turbo",{handleClick:r}=ya();if(!n){let u,f,p;return t[0]!==r?(u=()=>r("ai"),t[0]=r,t[1]=u):u=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(f=h.jsx(Xi,{className:"h-4 w-4 opacity-60"}),t[2]=f):f=t[2],t[3]!==u?(p=h.jsx(so,{tooltip:"Assist is disabled",selected:!1,onClick:u,children:f}),t[3]=u,t[4]=p):p=t[4],p}let s,i,a,l,c;return t[5]===Symbol.for("react.memo_cache_sentinel")?(s=h.jsx("b",{children:"Assist model:"}),t[5]=s):s=t[5],t[6]!==o?(i=h.jsxs(h.Fragment,{children:[s," ",o]}),t[6]=o,t[7]=i):i=t[7],t[8]!==r?(a=()=>r("ai"),t[8]=r,t[9]=a):a=t[9],t[10]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx(Xi,{className:"h-4 w-4"}),t[10]=l):l=t[10],t[11]!==i||t[12]!==a?(c=h.jsx(so,{tooltip:i,onClick:a,selected:!1,children:l}),t[11]=i,t[12]=a,t[13]=c):c=t[13],c},FM=()=>{const t=X.c(18),e=He(mo).state;let n,o,r,s,i,a,l;return t[0]!==e?(n=Zf(e.toLowerCase()),t[0]=e,t[1]=n):n=t[1],t[2]!==e?(o=e===en.OPEN&&h.jsx(nm,{className:"w-4 h-4"}),t[2]=e,t[3]=o):o=t[3],t[4]!==e?(r=e===en.CLOSED&&h.jsx(Jp,{className:"w-4 h-4"}),t[4]=e,t[5]=r):r=t[5],t[6]!==e?(s=e===en.CONNECTING&&h.jsx(Qn,{size:"small"}),t[6]=e,t[7]=s):s=t[7],t[8]!==e?(i=e===en.CLOSING&&h.jsx(Qn,{className:"text-destructive",size:"small"}),t[8]=e,t[9]=i):i=t[9],t[10]!==o||t[11]!==r||t[12]!==s||t[13]!==i?(a=h.jsxs("div",{className:"px-2",children:[o,r,s,i]}),t[10]=o,t[11]=r,t[12]=s,t[13]=i,t[14]=a):a=t[14],t[15]!==n||t[16]!==a?(l=h.jsx(Re,{delayDuration:200,content:n,children:a}),t[15]=n,t[16]=a,t[17]=l):l=t[17],l},zM=t=>{const e=X.c(3);let n,o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=h.jsx("path",{d:"M205.28 31.36c14.096 14.88 20.016 35.2 22.512 63.68c6.626 0 12.805 1.47 16.976 7.152l7.792 10.56A17.55 17.55 0 0 1 256 123.2v28.688c-.008 3.704-1.843 7.315-4.832 9.504C215.885 187.222 172.35 208 128 208c-49.066 0-98.19-28.273-123.168-46.608c-2.989-2.189-4.825-5.8-4.832-9.504V123.2c0-3.776 1.2-7.424 3.424-10.464l7.792-10.544c4.173-5.657 10.38-7.152 16.992-7.152c2.496-28.48 8.4-48.8 22.512-63.68C77.331 3.165 112.567.06 127.552 0H128c14.72 0 50.4 2.88 77.28 31.36m-77.264 47.376c-3.04 0-6.544.176-10.272.544c-1.312 4.896-3.248 9.312-6.08 12.128c-11.2 11.2-24.704 12.928-31.936 12.928c-6.802 0-13.927-1.42-19.744-5.088c-5.502 1.808-10.786 4.415-11.136 10.912c-.586 12.28-.637 24.55-.688 36.824c-.026 6.16-.05 12.322-.144 18.488c.024 3.579 2.182 6.903 5.44 8.384C79.936 185.92 104.976 192 128.016 192c23.008 0 48.048-6.08 74.512-18.144c3.258-1.48 5.415-4.805 5.44-8.384c.317-18.418.062-36.912-.816-55.312h.016c-.342-6.534-5.648-9.098-11.168-10.912c-5.82 3.652-12.927 5.088-19.728 5.088c-7.232 0-20.72-1.728-31.936-12.928c-2.832-2.816-4.768-7.232-6.08-12.128a106 106 0 0 0-10.24-.544m-26.941 43.93c5.748 0 10.408 4.66 10.408 10.409v19.183c0 5.749-4.66 10.409-10.408 10.409s-10.408-4.66-10.408-10.409v-19.183c0-5.748 4.66-10.408 10.408-10.408m53.333 0c5.749 0 10.409 4.66 10.409 10.409v19.183c0 5.749-4.66 10.409-10.409 10.409c-5.748 0-10.408-4.66-10.408-10.409v-19.183c0-5.748 4.66-10.408 10.408-10.408M81.44 28.32c-11.2 1.12-20.64 4.8-25.44 9.92c-10.4 11.36-8.16 40.16-2.24 46.24c4.32 4.32 12.48 7.2 21.28 7.2c6.72 0 19.52-1.44 30.08-12.16c4.64-4.48 7.52-15.68 7.2-27.04c-.32-9.12-2.88-16.64-6.72-19.84c-4.16-3.68-13.6-5.28-24.16-4.32m68.96 4.32c-3.84 3.2-6.4 10.72-6.72 19.84c-.32 11.36 2.56 22.56 7.2 27.04c10.56 10.72 23.36 12.16 30.08 12.16c8.8 0 16.96-2.88 21.28-7.2c5.92-6.08 8.16-34.88-2.24-46.24c-4.8-5.12-14.24-8.8-25.44-9.92c-10.56-.96-20 .64-24.16 4.32M128 56c-2.56 0-5.6.16-8.96.48c.32 1.76.48 3.68.64 5.76c0 1.44 0 2.88-.16 4.48c3.2-.32 5.92-.32 8.48-.32s5.28 0 8.48.32c-.16-1.6-.16-3.04-.16-4.48c.16-2.08.32-4 .64-5.76c-3.36-.32-6.4-.48-8.96-.48"}),e[0]=n):n=e[0],e[1]!==t?(o=h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.24em",height:"1em",viewBox:"0 0 256 208",fill:"currentColor",...t,children:n}),e[1]=t,e[2]=o):o=e[2],o},BM=Zt(t=>t(HU).completion.copilot),UM=()=>{const t=X.c(1);if(He(BM)==="github"){let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=h.jsx(VM,{}),t[0]=e):e=t[0],e}return null},Ex=Xt.get("[copilot-status-bar]"),VM=()=>{const t=He(uS),e=He(x$)!==null,{handleClick:n}=ya(),o=()=>n("ai"),r=t?"Ready":"Not connected",s=Qt(uS),i=Qt(w$);return WU(()=>{const a=dS();let l=!0;return(async()=>{try{if(await a.initializePromise.catch(d=>{throw Ex.error("Failed to initialize",d),a.close(),d}),!l)return;const c=await a.signedIn();if(!l)return;s(c),i(c?"signedIn":"signedOut")}catch(c){if(!l)return;Ex.warn("Connection failed",c),s(!1),i("connectionError"),lt({title:"GitHub Copilot Connection Error",description:"Failed to connect to GitHub Copilot. Check settings and try again.",variant:"danger",action:h.jsx(Pe,{variant:"link",onClick:o,children:"Settings"})})}})(),()=>{l=!1}}),h.jsx(so,{tooltip:h.jsxs(h.Fragment,{children:[h.jsx("b",{children:"GitHub Copilot:"})," ",r]}),selected:!1,onClick:o,children:h.jsx("span",{children:e?h.jsx(Qn,{className:"h-4 w-4"}):h.jsx(zM,{className:Oe("h-4 w-4",!t&&"opacity-60")})})})},$M=()=>{const t=X.c(13),e=He(os),[n,o]=fn(S4),[r,s]=A.useState(!1);if(!ga()||e==="disabled")return null;const i=e?"Real-time collaboration active":"Connecting to real-time collaboration";let a,l,c,d,u,f;return t[0]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx(qm,{className:"w-4 h-4"}),t[0]=a):a=t[0],t[1]!==i?(l=h.jsx(Ys,{asChild:!0,children:h.jsx(so,{tooltip:i,selected:!1,children:a})}),t[1]=i,t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsxs("div",{className:"space-y-2",children:[h.jsx("h4",{className:"font-medium leading-none",children:"Username"}),h.jsx("p",{className:"text-sm text-muted-foreground",children:"Set your username for real-time collaboration"})]}),t[3]=c):c=t[3],t[4]!==o?(d=p=>o(p.target.value),t[4]=o,t[5]=d):d=t[5],t[6]!==d||t[7]!==n?(u=h.jsx(Vs,{className:"w-80",children:h.jsxs("div",{className:"space-y-4",children:[c,h.jsx(ur,{value:n,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",onChange:d,placeholder:"Enter your username"})]})}),t[6]=d,t[7]=n,t[8]=u):u=t[8],t[9]!==r||t[10]!==l||t[11]!==u?(f=h.jsxs(Pr,{open:r,onOpenChange:s,children:[l,u]}),t[9]=r,t[10]=l,t[11]=u,t[12]=f):f=t[12],f},HM=()=>{const t=X.c(56),{selectedPanel:e,isTerminalOpen:n}=gc(),{toggleApplication:o,toggleTerminal:r}=na(),[s,i]=Ds(),a=He(qU),l=WM,c=dd.find(qM);let d;Bo(c,"Error panel not found"),t[0]!==r?(d=()=>{r()},t[0]=r,t[1]=d):d=t[1],qt("global.toggleTerminal",d);const u=so,f=c.tooltip,p=e===c.type,_=()=>o(c.type),g=l(c,a>0?"text-destructive":"");let m,b,x,y,v;t[2]!==a?(m=h.jsx("span",{className:"ml-1 font-mono mt-[0.125rem]",children:a}),t[2]=a,t[3]=m):m=t[3],t[4]!==u||t[5]!==c||t[6]!==p||t[7]!==_||t[8]!==g||t[9]!==m?(b=h.jsxs(u,{tooltip:f,selected:p,onClick:_,children:[g,m]}),t[4]=u,t[5]=c,t[6]=p,t[7]=_,t[8]=g,t[9]=m,t[10]=b):b=t[10],t[11]!==r?(x=()=>r(),t[11]=r,t[12]=x):x=t[12],t[13]===Symbol.for("react.memo_cache_sentinel")?(y=h.jsx(Hm,{className:"h-5 w-5"}),t[13]=y):y=t[13],t[14]!==n||t[15]!==x?(v=h.jsx(jx,{capability:"terminal",children:h.jsx(so,{tooltip:"Open terminal",selected:n,onClick:x,children:y})}),t[14]=n,t[15]=x,t[16]=v):v=t[16];const k=s.runtime.auto_instantiate?"Disable autorun on startup":"Enable autorun on startup";let S,E,j;t[17]!==s||t[18]!==i?(S=async()=>{const q={...s,runtime:{...s.runtime,auto_instantiate:!s.runtime.auto_instantiate}};await Rs({config:q}).then(()=>i(q))},t[17]=s,t[18]=i,t[19]=S):S=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(E=h.jsx("span",{children:"on startup: "}),t[20]=E):E=t[20],t[21]!==s.runtime.auto_instantiate?(j=s.runtime.auto_instantiate?h.jsx(br,{size:14}):h.jsx(_r,{size:14}),t[21]=s.runtime.auto_instantiate,t[22]=j):j=t[22];const I=s.runtime.auto_instantiate?"autorun":"lazy";let T,M,L,B;t[23]!==I?(T=h.jsx("span",{children:I}),t[23]=I,t[24]=T):T=t[24],t[25]!==j||t[26]!==T?(M=h.jsxs("div",{className:"font-prose text-sm flex items-center gap-1",children:[E,j,T]}),t[25]=j,t[26]=T,t[27]=M):M=t[27],t[28]!==k||t[29]!==S||t[30]!==M?(L=h.jsx(so,{tooltip:k,selected:!1,onClick:S,children:M}),t[28]=k,t[29]=S,t[30]=M,t[31]=L):L=t[31],t[32]===Symbol.for("react.memo_cache_sentinel")?(B=h.jsx("div",{className:"border-r border-border h-6 mx-1"}),t[32]=B):B=t[32];const O=s.runtime.on_cell_change==="autorun"?"Disable autorun":"Enable autorun";let z,F,V,P,C,$,N,H,G,Z;return t[33]!==s||t[34]!==i?(z=async()=>{const q={...s,runtime:{...s.runtime,on_cell_change:s.runtime.on_cell_change==="autorun"?"lazy":"autorun"}};await Rs({config:q}).then(()=>i(q))},t[33]=s,t[34]=i,t[35]=z):z=t[35],t[36]===Symbol.for("react.memo_cache_sentinel")?(F=h.jsx("span",{children:"on cell change: "}),t[36]=F):F=t[36],t[37]!==s.runtime.on_cell_change?(V=h.jsxs("div",{className:"font-prose text-sm flex items-center gap-1",children:[F,s.runtime.on_cell_change==="autorun"?h.jsx(br,{size:14}):h.jsx(_r,{size:14}),h.jsx("span",{children:s.runtime.on_cell_change})]}),t[37]=s.runtime.on_cell_change,t[38]=V):V=t[38],t[39]!==O||t[40]!==z||t[41]!==V?(P=h.jsx(so,{tooltip:O,selected:!1,onClick:z,children:V}),t[39]=O,t[40]=z,t[41]=V,t[42]=P):P=t[42],t[43]===Symbol.for("react.memo_cache_sentinel")?(C=h.jsx("div",{className:"border-r border-border h-6 mx-1"}),t[43]=C):C=t[43],t[44]!==s||t[45]!==i?($=!Bn()&&h.jsx(so,{tooltip:null,selected:!1,children:h.jsxs(hc,{children:[h.jsxs(fc,{className:"font-prose text-sm flex items-center gap-1",children:[h.jsx("span",{children:"on module change: "}),s.runtime.auto_reload==="off"&&h.jsx(Jp,{size:14}),s.runtime.auto_reload==="lazy"&&h.jsx(_r,{size:14}),s.runtime.auto_reload==="autorun"&&h.jsx(br,{size:14}),h.jsx("span",{children:s.runtime.auto_reload}),h.jsx(Zi,{size:14})]}),h.jsx(pc,{children:["off","lazy","autorun"].map(q=>h.jsxs(sn,{onClick:async()=>{const re={...s,runtime:{...s.runtime,auto_reload:q}};await Rs({config:re}).then(()=>i(re))},children:[q==="off"&&h.jsx(Jp,{size:14,className:"mr-2 text-muted-foreground"}),q==="lazy"&&h.jsx(_r,{size:14,className:"mr-2 text-muted-foreground"}),q==="autorun"&&h.jsx(br,{size:14,className:"mr-2 text-muted-foreground"}),q]},q))})]})}),t[44]=s,t[45]=i,t[46]=$):$=t[46],t[47]===Symbol.for("react.memo_cache_sentinel")?(N=h.jsx("div",{className:"mx-auto"}),t[47]=N):N=t[47],t[48]===Symbol.for("react.memo_cache_sentinel")?(H=h.jsx(dN,{children:h.jsx(Re,{content:h.jsx("div",{className:"w-[200px]",children:"Kiosk mode is enabled. This allows you to view the outputs of the cells without the ability to edit them."}),children:h.jsx("span",{className:"text-muted-foreground text-sm mr-4",children:"kiosk mode"})})}),t[48]=H):H=t[48],t[49]===Symbol.for("react.memo_cache_sentinel")?(G=h.jsxs("div",{className:"flex items-center",children:[h.jsx(AM,{}),h.jsx(LM,{}),h.jsx(UM,{}),h.jsx($M,{}),h.jsx(FM,{})]}),t[49]=G):G=t[49],t[50]!==v||t[51]!==L||t[52]!==P||t[53]!==$||t[54]!==b?(Z=h.jsxs("footer",{className:"h-10 py-2 bg-background flex items-center text-muted-foreground text-md px-1 border-t border-border select-none no-print text-sm shadow-[0_0_4px_1px_rgba(0,0,0,0.1)] z-50 print:hidden hide-on-fullscreen",children:[b,v,L,B,P,C,$,N,H,G]}),t[50]=v,t[51]=L,t[52]=P,t[53]=$,t[54]=b,t[55]=Z):Z=t[55],Z};function WM(t,e){const{Icon:n}=t;return h.jsx(n,{className:Oe("h-5 w-5",e)})}function qM(t){return t.type==="errors"}const GM=t=>{const e=X.c(6),{children:n}=t,{openModal:o,closeModal:r}=Un();let s,i;return e[0]!==r||e[1]!==o?(s=()=>o(h.jsx(YM,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(i=h.jsx(P4,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=i):i=e[5],i},YM=t=>{const e=X.c(9),{onClose:n}=t;let o,r,s,i,a,l,c;return e[0]!==n?(o=async d=>{d.preventDefault();const u=new FormData(d.target),f=u.get("rating"),p=u.get("message");fetch("https://marimo.io/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({rating:f,message:p})}),n(),lt({title:"Feedback sent!",description:"Thank you for your feedback!"})},e[0]=n,e[1]=o):o=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(dr,{children:"Send Feedback"}),e[2]=r):r=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(s=h.jsx("p",{className:"my-2 prose dark:prose-invert",children:"We want to hear from you \u2014 from minor bug reports to wishlist features and everything in between. Here are some ways you can get in touch:"}),e[3]=s):s=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsxs("li",{className:"my-0",children:["Take our"," ",h.jsx("a",{href:Kn.feedbackForm,target:"_blank",className:"underline",children:"two-minute survey."})]}),e[4]=i):i=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsxs("li",{className:"my-0",children:["File a"," ",h.jsx("a",{href:Kn.issuesPage,target:"_blank",className:"underline",children:"GitHub issue."})]}),e[5]=a):a=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsxs(Os,{children:[r,h.jsxs(Ps,{children:[s,h.jsxs("ul",{className:"list-disc ml-8 my-2 prose dark:prose-invert",children:[i,a,h.jsxs("li",{className:"my-0",children:["Chat with us on"," ",h.jsx("a",{href:Kn.discordLink,target:"_blank",className:"underline",children:"Discord."})]})]}),h.jsx("p",{className:"my-2 prose dark:prose-invert",children:"We're excited you're here as we build the future of Python data tooling. Thanks for being part of our community!"})]})]}),e[6]=l):l=e[6],e[7]!==o?(c=h.jsx(cr,{className:"w-fit",children:h.jsx("form",{onSubmit:o,children:l})}),e[7]=o,e[8]=c):c=e[8],c},JM=()=>{const t=X.c(10),{selectedPanel:e}=gc(),{toggleApplication:n}=na(),o=XM;let r,s,i,a,l,c;return t[0]!==e||t[1]!==n?(r="h-full pt-4 pb-1 px-1 flex flex-col items-start text-muted-foreground text-md select-none no-print text-sm z-50 dark:bg-background print:hidden hide-on-fullscreen",s=dd.filter(ZM).map(d=>h.jsx(Ix,{tooltip:d.tooltip,selected:e===d.type,onClick:()=>n(d.type),children:o(d)},d.type)),t[0]=e,t[1]=n,t[2]=r,t[3]=s):(r=t[2],s=t[3]),t[4]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsx(GM,{children:h.jsx(Ix,{tooltip:"Send feedback!",selected:!1,children:h.jsx(jm,{className:"h-5 w-5"})})}),a=h.jsx("div",{className:"flex-1"}),l=h.jsx(KM,{}),t[4]=i,t[5]=a,t[6]=l):(i=t[4],a=t[5],l=t[6]),t[7]!==r||t[8]!==s?(c=h.jsxs("div",{className:r,children:[s,i,a,l]}),t[7]=r,t[8]=s,t[9]=c):c=t[9],c},KM=()=>{const t=X.c(7),e=He(GU);let n,o,r;return t[0]!==e?(n=e>0?h.jsxs("span",{children:[e," cell",e>1?"s":""," queued or running"]}):"No cells queued or running",t[0]=e,t[1]=n):n=t[1],t[2]!==e?(o=h.jsx("div",{className:"flex flex-col-reverse gap-[1px] overflow-hidden",children:Array.from({length:e}).map(QM)}),t[2]=e,t[3]=o):o=t[3],t[4]!==n||t[5]!==o?(r=h.jsx(Re,{content:n,side:"right",delayDuration:200,children:o}),t[4]=n,t[5]=o,t[6]=r):r=t[6],r},Ix=t=>{const e=X.c(17);let n,o,r,s,i;e[0]!==t?({children:n,tooltip:i,selected:s,className:o,...r}=t,e[0]=t,e[1]=n,e[2]=o,e[3]=r,e[4]=s,e[5]=i):(n=e[1],o=e[2],r=e[3],s=e[4],i=e[5]);const a=!s&&"hover:bg-[var(--sage-3)]",l=s&&"bg-[var(--sage-4)]";let c,d,u;return e[6]!==o||e[7]!==a||e[8]!==l?(c=Oe("flex items-center p-2 text-sm mx-[1px] shadow-inset font-mono cursor-pointer rounded",a,l,o),e[6]=o,e[7]=a,e[8]=l,e[9]=c):c=e[9],e[10]!==n||e[11]!==r||e[12]!==c?(d=h.jsx("div",{className:c,...r,children:n}),e[10]=n,e[11]=r,e[12]=c,e[13]=d):d=e[13],e[14]!==d||e[15]!==i?(u=h.jsx(Re,{content:i,side:"right",delayDuration:200,children:d}),e[14]=d,e[15]=i,e[16]=u):u=e[16],u};function XM(t,e){const{Icon:n}=t;return h.jsx(n,{className:Oe("h-5 w-5",e)})}function ZM(t){return!t.hidden&&t.position==="sidebar"}function QM(t,e){return h.jsx("div",{className:"flex-shrink-0 h-1 w-2 bg-[var(--grass-6)] border border-[var(--grass-7)]"},e.toString())}let Ax;In=t=>{const e=X.c(15),{title:n,description:o,icon:r,action:s}=t;let i,a,l,c,d,u;return e[0]!==r?(i=r&&K.cloneElement(r,{className:"text-accent-foreground"}),e[0]=r,e[1]=i):i=e[1],e[2]!==n?(a=h.jsx("span",{className:"mt-1 text-accent-foreground",children:n}),e[2]=n,e[3]=a):a=e[3],e[4]!==i||e[5]!==a?(l=h.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[i,a]}),e[4]=i,e[5]=a,e[6]=l):l=e[6],e[7]!==o?(c=h.jsx("span",{className:"text-muted-foreground text-sm",children:o}),e[7]=o,e[8]=c):c=e[8],e[9]!==s?(d=s&&h.jsx("div",{className:"mt-2",children:s}),e[9]=s,e[10]=d):d=e[10],e[11]!==l||e[12]!==c||e[13]!==d?(u=h.jsxs("div",{className:"mx-6 my-6 flex flex-col gap-2",children:[l,c,d]}),e[11]=l,e[12]=c,e[13]=d,e[14]=u):u=e[14],u},Ax=()=>{const t=X.c(5),e=YU();if(e.length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(In,{title:"No errors!",icon:h.jsx(Mm,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=e.map(eO),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=h.jsx("div",{className:"flex flex-col overflow-auto",children:n}),t[3]=n,t[4]=o):o=t[4],o};function eO(t){return h.jsxs("div",{children:[h.jsx("div",{className:"text-xs font-mono font-semibold bg-muted border-y px-2 py-1",children:h.jsx(JU,{cellId:t.cellId})}),h.jsx("div",{className:"px-2",children:h.jsx(KU,{errors:t.output.data,cellId:t.cellId},t.cellId)},t.cellId)]},t.cellId)}const tO=()=>{const t=X.c(6),{items:e}=He(XU);let n,o;t[0]!==e?(o=B$(e),t[0]=e,t[1]=o):o=t[1],n=o;const r=n,{activeHeaderId:s}=U$(r);if(e.length===0){let a;return t[2]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx(In,{title:"No outline",description:"Add markdown headings to your notebook to create an outline.",icon:h.jsx(ed,{})}),t[2]=a):a=t[2],a}let i;return t[3]!==s||t[4]!==e?(i=h.jsx(V$,{items:e,activeHeaderId:s}),t[3]=s,t[4]=e,t[5]=i):i=t[5],i};function un(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=un(t[o]))!==""&&(e+=(e&&" ")+n);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}const{useDebugValue:nO}=K,{useSyncExternalStoreWithSelector:oO}=ZU,rO=t=>t;function Tx(t,e=rO,n){const o=oO(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return nO(o),o}const Mx=(t,e)=>{const n=QU(t),o=(r,s=e)=>Tx(n,r,s);return Object.assign(o,n),o};function nn(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[o,r]of t)if(!Object.is(r,e.get(o)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const o of t)if(!e.has(o))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(e,o)||!Object.is(t[o],e[o]))return!1;return!0}function io(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 sO={passive:!1},Oi={capture:!0,passive:!1};function Vu(t){t.stopImmediatePropagation()}function ss(t){t.preventDefault(),t.stopImmediatePropagation()}function Ox(t){var e=t.document.documentElement,n=eo(t).on("dragstart.drag",ss,Oi);"onselectstart"in e?n.on("selectstart.drag",ss,Oi):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Dx(t,e){var n=t.document.documentElement,o=eo(t).on("dragstart.drag",null);e&&(o.on("click.drag",ss,Oi),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 jl=t=>()=>t;function $u(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 iO(t){return!t.ctrlKey&&!t.button}function aO(){return this.parentNode}function lO(t,e){return e??{x:t.x,y:t.y}}function cO(){return navigator.maxTouchPoints||"ontouchstart"in this}$u.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};const El=t=>()=>t;function dO(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 Hu(t){t.stopImmediatePropagation()}function Di(t){t.preventDefault(),t.stopImmediatePropagation()}function uO(t){return!(t.ctrlKey&&t.type!=="wheel"||t.button)}function hO(){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 Rx(){return this.__zoom||gr}function fO(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function pO(){return navigator.maxTouchPoints||"ontouchstart"in this}function mO(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 Il=A.createContext(null),gO=Il.Provider,_O=t=>`Node type "${t}" not found. Using fallback type "default".`,bO=()=>"The React Flow parent container needs a width and a height to render the graph.",yO=()=>"Only child nodes can use a parent extent.",xO=t=>`Marker type "${t}" doesn't exist.`,wO=(t,e)=>`Couldn't create edge for ${t?"target":"source"} handle id: "${t?e.targetHandle:e.sourceHandle}", edge id: ${e.id}.`,vO=()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",kO=t=>`Edge type "${t}" not found. Using fallback type "default".`,SO=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.`,Px="[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001";function pt(t,e){const n=A.useContext(Il);if(n===null)throw new Error(Px);return Tx(n,t,e)}const Wt=()=>{const t=A.useContext(Il);if(t===null)throw new Error(Px);return A.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe,destroy:t.destroy}),[t])},CO=t=>t.userSelectionActive?"none":"all";function Al({position:t,children:e,className:n,style:o,...r}){const s=pt(CO),i=`${t}`.split("-");return K.createElement("div",{className:un(["react-flow__panel",n,...i]),style:{...o,pointerEvents:s},...r},e)}function NO({proOptions:t,position:e="bottom-right"}){return t!=null&&t.hideAttribution?null:K.createElement(Al,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},K.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}var jO=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 u=A.useRef(null),[f,p]=A.useState({x:0,y:0,width:0,height:0}),_=un(["react-flow__edge-textwrapper",c]);return A.useEffect(()=>{if(u.current){const g=u.current.getBBox();p({x:g.x,y:g.y,width:g.width,height:g.height})}},[n]),n!==void 0&&n?K.createElement("g",{transform:`translate(${t-f.width/2} ${e-f.height/2})`,className:_,visibility:f.width?"visible":"hidden",...d},r&&K.createElement("rect",{width:f.width+2*i[0],x:-i[0],y:-i[1],height:f.height+2*i[1],className:"react-flow__edge-textbg",style:s,rx:a,ry:a}),K.createElement("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:u,style:o},n),l):null});const Wu=t=>({width:t.offsetWidth,height:t.offsetHeight}),is=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),qu=(t={x:0,y:0},e)=>({x:is(t.x,e[0][0],e[1][0]),y:is(t.y,e[0][1],e[1][1])}),Lx=(t,e,n)=>t<e?is(Math.abs(t-e),1,50)/50:t>n?-is(Math.abs(t-n),1,50)/50:0,Fx=(t,e)=>[20*Lx(t.x,35,e.width-35),20*Lx(t.y,35,e.height-35)],zx=t=>{var e;return((e=t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},Gu=({x:t,y:e,width:n,height:o})=>({x:t,y:e,x2:t+n,y2:e+o}),Bx=t=>({...t.positionAbsolute||{x:0,y:0},width:t.width||0,height:t.height||0}),Yu=(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)},Rn=t=>!isNaN(t)&&isFinite(t),Nt=Symbol.for("internals"),Ux=["Enter"," ","Escape"];function Ju(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 Vx=t=>"clientX"in t,Zo=(t,e)=>{var s,i;const n=Vx(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)}},Tl=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0},Ri=({id:t,path:e,labelX:n,labelY:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:u,markerStart:f,interactionWidth:p=20})=>K.createElement(K.Fragment,null,K.createElement("path",{id:t,style:d,d:e,fill:"none",className:"react-flow__edge-path",markerEnd:u,markerStart:f}),p&&K.createElement("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:p,className:"react-flow__edge-interaction"}),r&&Rn(n)&&Rn(o)?K.createElement(jO,{x:n,y:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null);function Pi(t,e,n){return n===void 0?n:o=>{const r=e().edges.find(s=>s.id===t);r&&n(o,{...r})}}function $x({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 Hx({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 Ir,Wx,Qo,Ku,Li,qx,er,Fi,as,Gx,$e,Ml;function Yx({pos:t,x1:e,y1:n,x2:o,y2:r}){return t===$e.Left||t===$e.Right?[.5*(e+o),n]:[e,.5*(n+r)]}function Jx({sourceX:t,sourceY:e,sourcePosition:n=$e.Bottom,targetX:o,targetY:r,targetPosition:s=$e.Top}){const[i,a]=Yx({pos:n,x1:t,y1:e,x2:o,y2:r}),[l,c]=Yx({pos:s,x1:o,y1:r,x2:t,y2:e}),[d,u,f,p]=Hx({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,u,f,p]}Ri.displayName="BaseEdge",(Wx=Ir||(Ir={})).Strict="strict",Wx.Loose="loose",(Ku=Qo||(Qo={})).Free="free",Ku.Vertical="vertical",Ku.Horizontal="horizontal",(qx=Li||(Li={})).Partial="partial",qx.Full="full",(Fi=er||(er={})).Bezier="default",Fi.Straight="straight",Fi.Step="step",Fi.SmoothStep="smoothstep",Fi.SimpleBezier="simplebezier",(Gx=as||(as={})).Arrow="arrow",Gx.ArrowClosed="arrowclosed",(Ml=$e||($e={})).Left="left",Ml.Top="top",Ml.Right="right",Ml.Bottom="bottom";const Xu=A.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,sourcePosition:r=$e.Bottom,targetPosition:s=$e.Top,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:p,markerStart:_,interactionWidth:g})=>{const[m,b,x]=Jx({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:o,targetPosition:s});return K.createElement(Ri,{path:m,labelX:b,labelY:x,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:p,markerStart:_,interactionWidth:g})});Xu.displayName="SimpleBezierEdge";const Kx={[$e.Left]:{x:-1,y:0},[$e.Right]:{x:1,y:0},[$e.Top]:{x:0,y:-1},[$e.Bottom]:{x:0,y:1}},Xx=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function EO({source:t,sourcePosition:e=$e.Bottom,target:n,targetPosition:o=$e.Top,center:r,offset:s}){const i=Kx[e],a=Kx[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:S,sourcePosition:E=$e.Bottom,target:j})=>E===$e.Left||E===$e.Right?S.x<j.x?{x:1,y:0}:{x:-1,y:0}:S.y<j.y?{x:0,y:1}:{x:0,y:-1})({source:l,sourcePosition:e,target:c}),u=d.x!==0?"x":"y",f=d[u];let p,_,g=[];const m={x:0,y:0},b={x:0,y:0},[x,y,v,k]=$x({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(i[u]*a[u]==-1){p=r.x??x,_=r.y??y;const S=[{x:p,y:l.y},{x:p,y:c.y}],E=[{x:l.x,y:_},{x:c.x,y:_}];g=i[u]===f?u==="x"?S:E:u==="x"?E:S}else{const S=[{x:l.x,y:c.y}],E=[{x:c.x,y:l.y}];if(g=u==="x"?i.x===f?E:S:i.y===f?S:E,e===o){const T=Math.abs(t[u]-n[u]);if(T<=s){const M=Math.min(s-1,s-T);i[u]===f?m[u]=(l[u]>t[u]?-1:1)*M:b[u]=(c[u]>n[u]?-1:1)*M}}if(e!==o){const T=u==="x"?"y":"x",M=i[u]===a[T],L=l[T]>c[T],B=l[T]<c[T];(i[u]===1&&(!M&&L||M&&B)||i[u]!==1&&(!M&&B||M&&L))&&(g=u==="x"?S:E)}const j={x:l.x+m.x,y:l.y+m.y},I={x:c.x+b.x,y:c.y+b.y};Math.max(Math.abs(j.x-g[0].x),Math.abs(I.x-g[0].x))>=Math.max(Math.abs(j.y-g[0].y),Math.abs(I.y-g[0].y))?(p=(j.x+I.x)/2,_=g[0].y):(p=g[0].x,_=(j.y+I.y)/2)}return[[t,{x:l.x+m.x,y:l.y+m.y},...g,{x:c.x+b.x,y:c.y+b.y},n],p,_,v,k]}function Zu({sourceX:t,sourceY:e,sourcePosition:n=$e.Bottom,targetX:o,targetY:r,targetPosition:s=$e.Top,borderRadius:i=5,centerX:a,centerY:l,offset:c=20}){const[d,u,f,p,_]=EO({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,m,b)=>{let x="";return x=b>0&&b<d.length-1?function(y,v,k,S){const E=Math.min(Xx(y,v)/2,Xx(v,k)/2,S),{x:j,y:I}=v;if(y.x===j&&j===k.x||y.y===I&&I===k.y)return`L${j} ${I}`;if(y.y===I)return`L ${j+E*(y.x<k.x?-1:1)},${I}Q ${j},${I} ${j},${I+E*(y.y<k.y?1:-1)}`;const T=y.x<k.x?1:-1;return`L ${j},${I+E*(y.y<k.y?-1:1)}Q ${j},${I} ${j+E*T},${I}`}(d[b-1],m,d[b+1],i):`${b===0?"M":"L"}${m.x} ${m.y}`,g+=x},""),u,f,p,_]}const Ol=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:u=$e.Bottom,targetPosition:f=$e.Top,markerEnd:p,markerStart:_,pathOptions:g,interactionWidth:m})=>{const[b,x,y]=Zu({sourceX:t,sourceY:e,sourcePosition:u,targetX:n,targetY:o,targetPosition:f,borderRadius:g==null?void 0:g.borderRadius,offset:g==null?void 0:g.offset});return K.createElement(Ri,{path:b,labelX:x,labelY:y,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:p,markerStart:_,interactionWidth:m})});Ol.displayName="SmoothStepEdge";const Qu=A.memo(t=>{var e;return K.createElement(Ol,{...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])})});Qu.displayName="StepEdge";const eh=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:u,markerStart:f,interactionWidth:p})=>{const[_,g,m]=function({sourceX:b,sourceY:x,targetX:y,targetY:v}){const[k,S,E,j]=$x({sourceX:b,sourceY:x,targetX:y,targetY:v});return[`M ${b},${x}L ${y},${v}`,k,S,E,j]}({sourceX:t,sourceY:e,targetX:n,targetY:o});return K.createElement(Ri,{path:_,labelX:g,labelY:m,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:u,markerStart:f,interactionWidth:p})});function Dl(t,e){return t>=0?.5*t:25*e*Math.sqrt(-t)}function Zx({pos:t,x1:e,y1:n,x2:o,y2:r,c:s}){switch(t){case $e.Left:return[e-Dl(e-o,s),n];case $e.Right:return[e+Dl(o-e,s),n];case $e.Top:return[e,n-Dl(n-r,s)];case $e.Bottom:return[e,n+Dl(r-n,s)]}}function Qx({sourceX:t,sourceY:e,sourcePosition:n=$e.Bottom,targetX:o,targetY:r,targetPosition:s=$e.Top,curvature:i=.25}){const[a,l]=Zx({pos:n,x1:t,y1:e,x2:o,y2:r,c:i}),[c,d]=Zx({pos:s,x1:o,y1:r,x2:t,y2:e,c:i}),[u,f,p,_]=Hx({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}`,u,f,p,_]}eh.displayName="StraightEdge";const Rl=A.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,sourcePosition:r=$e.Bottom,targetPosition:s=$e.Top,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:p,markerStart:_,pathOptions:g,interactionWidth:m})=>{const[b,x,y]=Qx({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:o,targetPosition:s,curvature:g==null?void 0:g.curvature});return K.createElement(Ri,{path:b,labelX:x,labelY:y,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:p,markerStart:_,interactionWidth:m})});Rl.displayName="BezierEdge";const th=A.createContext(null),IO=th.Provider;th.Consumer;const AO=({source:t,sourceHandle:e,target:n,targetHandle:o})=>`reactflow__edge-${t}${e||""}-${n}${o||""}`,nh=(t,e)=>t===void 0?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(n=>`${n}=${t[n]}`).join("&")}`,oh=({x:t,y:e},[n,o,r],s,[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},ew=({x:t,y:e},[n,o,r])=>({x:t*r+n,y:e*r+o}),ls=(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}},rh=(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}=ls(r,e).positionAbsolute;return a=o,l=Gu({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)},tw=(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:u,height:f,selectable:p=!0,hidden:_=!1}=d;if(i&&!p||_)return!1;const{positionAbsolute:g}=ls(d,a),m={x:g.x,y:g.y,width:u||0,height:f||0},b=Yu(l,m);(u===void 0||f===void 0||u===null||f===null||s&&b>0||b>=(u||0)*(f||0)||d.dragging)&&c.push(d)}),c},nw=(t,e)=>{const n=t.map(o=>o.id);return e.filter(o=>n.includes(o.source)||n.includes(o.target))},ow=(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=is(l,o,r);return{x:e/2-(t.x+t.width/2)*c,y:n/2-(t.y+t.height/2)*c,zoom:c}},Ar=(t,e=0)=>t.transition().duration(e);function rw(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 TO={source:null,target:null,sourceHandle:null,targetHandle:null},sw=()=>({handleDomNode:null,isValid:!1,connection:TO,endHandle:null});function iw(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={...sw(),handleDomNode:l};if(l){const d=sh(void 0,l),u=l.getAttribute("data-nodeid"),f=l.getAttribute("data-handleid"),p=l.classList.contains("connectable"),_=l.classList.contains("connectableend"),g={source:a?u:n,sourceHandle:a?f:o,target:a?n:u,targetHandle:a?o:f};c.connection=g,p&&_&&(e===Ir.Strict?a&&d==="source"||!a&&d==="target":u!==n||f!==o)&&(c.endHandle={nodeId:u,handleId:f,type:d},c.isValid=s(g))}return c}function sh(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function ih(t){t==null||t.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function MO(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function aw({event:t,handleId:e,nodeId:n,onConnect:o,isTarget:r,getState:s,setState:i,isValidConnection:a,edgeUpdaterType:l,onReconnectEnd:c}){const d=zx(t.target),{connectionMode:u,domNode:f,autoPanOnConnect:p,connectionRadius:_,onConnectStart:g,panBy:m,getNodes:b,cancelConnection:x}=s();let y,v=0;const{x:k,y:S}=Zo(t),E=d==null?void 0:d.elementFromPoint(k,S),j=sh(l,E),I=f==null?void 0:f.getBoundingClientRect();if(!I||!j)return;let T,M=Zo(t,I),L=!1,B=null,O=!1,z=null;const F=function({nodes:$,nodeId:N,handleId:H,handleType:G}){return $.reduce((Z,q)=>{if(q[Nt]){const{handleBounds:re}=q[Nt];let ne=[],oe=[];re&&(ne=rw(q,re,"source",`${N}-${H}-${G}`),oe=rw(q,re,"target",`${N}-${H}-${G}`)),Z.push(...ne,...oe)}return Z},[])}({nodes:b(),nodeId:n,handleId:e,handleType:j}),V=()=>{if(!p)return;const[$,N]=Fx(M,I);m({x:$,y:N}),v=requestAnimationFrame(V)};function P($){const{transform:N}=s();M=Zo($,I);const{handle:H,validHandleResult:G}=function(Z,q,re,ne,oe,Y){const{x:Q,y:ce}=Zo(Z),he=q.elementsFromPoint(Q,ce).find(we=>we.classList.contains("react-flow__handle"));if(he){const we=he.getAttribute("data-nodeid");if(we){const ae=sh(void 0,he),ve=he.getAttribute("data-handleid"),ge=Y({nodeId:we,id:ve,type:ae});if(ge){const be=oe.find(Te=>Te.nodeId===we&&Te.type===ae&&Te.id===ve);return{handle:{id:ve,type:ae,nodeId:we,x:(be==null?void 0:be.x)||re.x,y:(be==null?void 0:be.y)||re.y},validHandleResult:ge}}}}let de=[],me=1/0;if(oe.forEach(we=>{const ae=Math.sqrt((we.x-re.x)**2+(we.y-re.y)**2);if(ae<=ne){const ve=Y(we);ae<=me&&(ae<me?de=[{handle:we,validHandleResult:ve}]:ae===me&&de.push({handle:we,validHandleResult:ve}),me=ae)}}),!de.length)return{handle:null,validHandleResult:sw()};if(de.length===1)return de[0];const ie=de.some(({validHandleResult:we})=>we.isValid),Ce=de.some(({handle:we})=>we.type==="target");return de.find(({handle:we,validHandleResult:ae})=>Ce?we.type==="target":!ie||ae.isValid)||de[0]}($,d,oh(M,N,!1,[1,1]),_,F,Z=>iw(Z,u,n,e,r?"target":"source",a,d));if(y=H,L||(V(),L=!0),z=G.handleDomNode,B=G.connection,O=G.isValid,i({connectionPosition:y&&O?ew({x:y.x,y:y.y},N):M,connectionStatus:MO(!!y,O),connectionEndHandle:G.endHandle}),!y&&!O&&!z)return ih(T);B.source!==B.target&&z&&(ih(T),T=z,z.classList.add("connecting","react-flow__handle-connecting"),z.classList.toggle("valid",O),z.classList.toggle("react-flow__handle-valid",O))}function C($){var N,H;(y||z)&&B&&O&&(o==null||o(B)),(H=(N=s()).onConnectEnd)==null||H.call(N,$),l&&(c==null||c($)),ih(T),x(),cancelAnimationFrame(v),L=!1,O=!1,B=null,z=null,d.removeEventListener("mousemove",P),d.removeEventListener("mouseup",C),d.removeEventListener("touchmove",P),d.removeEventListener("touchend",C)}i({connectionPosition:M,connectionStatus:null,connectionNodeId:n,connectionHandleId:e,connectionHandleType:j,connectionStartHandle:{nodeId:n,handleId:e,type:j},connectionEndHandle:null}),g==null||g(t,{nodeId:n,handleId:e,handleType:j}),d.addEventListener("mousemove",P),d.addEventListener("mouseup",C),d.addEventListener("touchmove",P),d.addEventListener("touchend",C)}const lw=()=>!0,OO=t=>({connectionStartHandle:t.connectionStartHandle,connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName}),cw=A.forwardRef(({type:t="source",position:e=$e.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:s=!0,id:i,onConnect:a,children:l,className:c,onMouseDown:d,onTouchStart:u,...f},p)=>{var j,I;const _=i||null,g=t==="target",m=Wt(),b=A.useContext(th),{connectOnClick:x,noPanClassName:y}=pt(OO,nn),{connecting:v,clickConnecting:k}=pt(((T,M,L)=>B=>{const{connectionStartHandle:O,connectionEndHandle:z,connectionClickStartHandle:F}=B;return{connecting:(O==null?void 0:O.nodeId)===T&&(O==null?void 0:O.handleId)===M&&(O==null?void 0:O.type)===L||(z==null?void 0:z.nodeId)===T&&(z==null?void 0:z.handleId)===M&&(z==null?void 0:z.type)===L,clickConnecting:(F==null?void 0:F.nodeId)===T&&(F==null?void 0:F.handleId)===M&&(F==null?void 0:F.type)===L}})(b,_,t),nn);b||((I=(j=m.getState()).onError)==null||I.call(j,"010",vO()));const S=T=>{const{defaultEdgeOptions:M,onConnect:L,hasDefaultEdges:B}=m.getState(),O={...M,...T};if(B){const{edges:z,setEdges:F}=m.getState();F(((V,P)=>{if(!V.source||!V.target)return P;let C;return C=($=>"id"in $&&"source"in $&&"target"in $)(V)?{...V}:{...V,id:AO(V)},(($,N)=>N.some(H=>!(H.source!==$.source||H.target!==$.target||H.sourceHandle!==$.sourceHandle&&(H.sourceHandle||$.sourceHandle)||H.targetHandle!==$.targetHandle&&(H.targetHandle||$.targetHandle))))(C,P)?P:P.concat(C)})(O,z))}L==null||L(O),a==null||a(O)},E=T=>{if(!b)return;const M=Vx(T);r&&(M&&T.button===0||!M)&&aw({event:T,handleId:_,nodeId:b,onConnect:S,isTarget:g,getState:m.getState,setState:m.setState,isValidConnection:n||m.getState().isValidConnection||lw}),M?d==null||d(T):u==null||u(T)};return K.createElement("div",{"data-handleid":_,"data-nodeid":b,"data-handlepos":e,"data-id":`${b}-${_}-${t}`,className:un(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",y,c,{source:!g,target:g,connectable:o,connectablestart:r,connectableend:s,connecting:k,connectionindicator:o&&(r&&!v||s&&v)}]),onMouseDown:E,onTouchStart:E,onClick:x?T=>{const{onClickConnectStart:M,onClickConnectEnd:L,connectionClickStartHandle:B,connectionMode:O,isValidConnection:z}=m.getState();if(!b||!B&&!r)return;if(!B)return M==null||M(T,{nodeId:b,handleId:_,handleType:t}),void m.setState({connectionClickStartHandle:{nodeId:b,type:t,handleId:_}});const F=zx(T.target),V=n||z||lw,{connection:P,isValid:C}=iw({nodeId:b,id:_,type:t},O,B.nodeId,B.handleId||null,B.type,V,F);C&&S(P),L==null||L(T),m.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f},l)});cw.displayName="Handle";var tr=A.memo(cw);const dw=({data:t,isConnectable:e,targetPosition:n=$e.Top,sourcePosition:o=$e.Bottom})=>K.createElement(K.Fragment,null,K.createElement(tr,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label,K.createElement(tr,{type:"source",position:o,isConnectable:e}));dw.displayName="DefaultNode";var ah=A.memo(dw);const uw=({data:t,isConnectable:e,sourcePosition:n=$e.Bottom})=>K.createElement(K.Fragment,null,t==null?void 0:t.label,K.createElement(tr,{type:"source",position:n,isConnectable:e}));uw.displayName="InputNode";var hw=A.memo(uw);const fw=({data:t,isConnectable:e,targetPosition:n=$e.Top})=>K.createElement(K.Fragment,null,K.createElement(tr,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label);fw.displayName="OutputNode";var pw=A.memo(fw);const lh=()=>null;lh.displayName="GroupNode";const DO=t=>({selectedNodes:t.getNodes().filter(e=>e.selected),selectedEdges:t.edges.filter(e=>e.selected).map(e=>({...e}))}),Pl=t=>t.id;function RO(t,e){return nn(t.selectedNodes.map(Pl),e.selectedNodes.map(Pl))&&nn(t.selectedEdges.map(Pl),e.selectedEdges.map(Pl))}const mw=A.memo(({onSelectionChange:t})=>{const e=Wt(),{selectedNodes:n,selectedEdges:o}=pt(DO,RO);return A.useEffect(()=>{const r={nodes:n,edges:o};t==null||t(r),e.getState().onSelectionChange.forEach(s=>s(r))},[n,o,t]),null});mw.displayName="SelectionListener";const PO=t=>!!t.onSelectionChange;function LO({onSelectionChange:t}){const e=pt(PO);return t||e?K.createElement(mw,{onSelectionChange:t}):null}const FO=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 cs(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 zO=({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,onConnect:r,onConnectStart:s,onConnectEnd:i,onClickConnectStart:a,onClickConnectEnd:l,nodesDraggable:c,nodesConnectable:d,nodesFocusable:u,edgesFocusable:f,edgesUpdatable:p,elevateNodesOnSelect:_,minZoom:g,maxZoom:m,nodeExtent:b,onNodesChange:x,onEdgesChange:y,elementsSelectable:v,connectionMode:k,snapGrid:S,snapToGrid:E,translateExtent:j,connectOnClick:I,defaultEdgeOptions:T,fitView:M,fitViewOptions:L,onNodesDelete:B,onEdgesDelete:O,onNodeDrag:z,onNodeDragStart:F,onNodeDragStop:V,onSelectionDrag:P,onSelectionDragStart:C,onSelectionDragStop:$,noPanClassName:N,nodeOrigin:H,rfId:G,autoPanOnConnect:Z,autoPanOnNodeDrag:q,onError:re,connectionRadius:ne,isValidConnection:oe,nodeDragThreshold:Y})=>{const{setNodes:Q,setEdges:ce,setDefaultNodesAndEdges:he,setMinZoom:de,setMaxZoom:me,setTranslateExtent:ie,setNodeExtent:Ce,reset:we}=pt(FO,nn),ae=Wt();return A.useEffect(()=>{const ve=o==null?void 0:o.map(ge=>({...ge,...T}));return he(n,ve),()=>{we()}},[]),at("defaultEdgeOptions",T,ae.setState),at("connectionMode",k,ae.setState),at("onConnect",r,ae.setState),at("onConnectStart",s,ae.setState),at("onConnectEnd",i,ae.setState),at("onClickConnectStart",a,ae.setState),at("onClickConnectEnd",l,ae.setState),at("nodesDraggable",c,ae.setState),at("nodesConnectable",d,ae.setState),at("nodesFocusable",u,ae.setState),at("edgesFocusable",f,ae.setState),at("edgesUpdatable",p,ae.setState),at("elementsSelectable",v,ae.setState),at("elevateNodesOnSelect",_,ae.setState),at("snapToGrid",E,ae.setState),at("snapGrid",S,ae.setState),at("onNodesChange",x,ae.setState),at("onEdgesChange",y,ae.setState),at("connectOnClick",I,ae.setState),at("fitViewOnInit",M,ae.setState),at("fitViewOnInitOptions",L,ae.setState),at("onNodesDelete",B,ae.setState),at("onEdgesDelete",O,ae.setState),at("onNodeDrag",z,ae.setState),at("onNodeDragStart",F,ae.setState),at("onNodeDragStop",V,ae.setState),at("onSelectionDrag",P,ae.setState),at("onSelectionDragStart",C,ae.setState),at("onSelectionDragStop",$,ae.setState),at("noPanClassName",N,ae.setState),at("nodeOrigin",H,ae.setState),at("rfId",G,ae.setState),at("autoPanOnConnect",Z,ae.setState),at("autoPanOnNodeDrag",q,ae.setState),at("onError",re,ae.setState),at("connectionRadius",ne,ae.setState),at("isValidConnection",oe,ae.setState),at("nodeDragThreshold",Y,ae.setState),cs(t,Q),cs(e,ce),cs(g,de),cs(m,me),cs(j,ie),cs(b,Ce),null},gw={display:"none"},BO={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},_w="react-flow__node-desc",bw="react-flow__edge-desc",UO=t=>t.ariaLiveMessage;function VO({rfId:t}){const e=pt(UO);return K.createElement("div",{id:`react-flow__aria-live-${t}`,"aria-live":"assertive","aria-atomic":"true",style:BO},e)}function $O({rfId:t,disableKeyboardA11y:e}){return K.createElement(K.Fragment,null,K.createElement("div",{id:`${_w}-${t}`,style:gw},"Press enter or space to select a node.",!e&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),K.createElement("div",{id:`${bw}-${t}`,style:gw},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!e&&K.createElement(VO,{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,u)=>d.concat(...u),[]);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=p=>{if(r.current=p.ctrlKey||p.metaKey||p.shiftKey,(!r.current||r.current&&!e.actInsideInputWithModifier)&&Ju(p))return!1;const _=xw(p.code,a);s.current.add(p[_]),yw(i,s.current,!1)&&(p.preventDefault(),o(!0))},u=p=>{if((!r.current||r.current&&!e.actInsideInputWithModifier)&&Ju(p))return!1;const _=xw(p.code,a);yw(i,s.current,!0)?(o(!1),s.current.clear()):s.current.delete(p[_]),p.key==="Meta"&&s.current.clear(),r.current=!1},f=()=>{s.current.clear(),o(!1)};return c==null||c.addEventListener("keydown",d),c==null||c.addEventListener("keyup",u),window.addEventListener("blur",f),()=>{c==null||c.removeEventListener("keydown",d),c==null||c.removeEventListener("keyup",u),window.removeEventListener("blur",f)}}},[t,o]),n};function yw(t,e,n){return t.filter(o=>n||o.length===e.size).some(o=>o.every(r=>e.has(r)))}function xw(t,e){return e.includes(t)?"code":"key"}function ww(t,e,n,o){var a,l;const r=t.parentNode||t.parentId;if(!r)return n;const s=e.get(r),i=ls(s,o);return ww(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 vw(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}=ww(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 ch(t,e,n,o){const r=new Map,s={},i=o?1e3:0;return t.forEach(a=>{var p;const l=(Rn(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}},u=a.parentNode||a.parentId;u&&(s[u]=!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||(p=c==null?void 0:c[Nt])==null?void 0:p.handleBounds,z:l}}),r.set(a.id,d)}),vw(r,n,s),r}function kw(t,e={}){const{getNodes:n,width:o,height:r,minZoom:s,maxZoom:i,d3Zoom:a,d3Selection:l,fitViewOnInitDone:c,fitViewOnInit:d,nodeOrigin:u}=t(),f=e.initial&&!c&&d;if(a&&l&&(f||!e.initial)){const p=n().filter(g=>{var b;const m=e.includeHiddenNodes?g.width&&g.height:!g.hidden;return(b=e.nodes)!=null&&b.length?m&&e.nodes.some(x=>x.id===g.id):m}),_=p.every(g=>g.width&&g.height);if(p.length>0&&_){const g=rh(p,u),{x:m,y:b,zoom:x}=ow(g,o,r,e.minZoom??s,e.maxZoom??i,e.padding??.1),y=gr.translate(m,b).scale(x);return typeof e.duration=="number"&&e.duration>0?a.transform(Ar(l,e.duration),y):a.transform(l,y),!0}}return!1}function HO(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 WO(t,e){return e.map(n=>{const o=t.find(r=>r.id===n.id);return o&&(n.selected=o.selected),n})}function Ll({changedNodes:t,changedEdges:e,get:n,set:o}){const{nodeInternals:r,edges:s,onNodesChange:i,onEdgesChange:a,hasDefaultNodes:l,hasDefaultEdges:c}=n();t!=null&&t.length&&(l&&o({nodeInternals:HO(t,r)}),i==null||i(t)),e!=null&&e.length&&(c&&o({edges:WO(e,s)}),a==null||a(e))}const ds=()=>{},qO={zoomIn:ds,zoomOut:ds,zoomTo:ds,getZoom:()=>1,setViewport:ds,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:ds,fitBounds:ds,project:t=>t,screenToFlowPosition:t=>t,flowToScreenPosition:t=>t,viewportInitialized:!1},GO=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection});function Bi(){const t=(()=>{const g=Wt(),{d3Zoom:m,d3Selection:b}=pt(GO,nn);return A.useMemo(()=>b&&m?{zoomIn:y=>m.scaleBy(Ar(b,y==null?void 0:y.duration),1.2),zoomOut:y=>m.scaleBy(Ar(b,y==null?void 0:y.duration),1/1.2),zoomTo:(y,v)=>m.scaleTo(Ar(b,v==null?void 0:v.duration),y),getZoom:()=>g.getState().transform[2],setViewport:(y,v)=>{const[k,S,E]=g.getState().transform,j=gr.translate(y.x??k,y.y??S).scale(y.zoom??E);m.transform(Ar(b,v==null?void 0:v.duration),j)},getViewport:()=>{const[y,v,k]=g.getState().transform;return{x:y,y:v,zoom:k}},fitView:y=>kw(g.getState,y),setCenter:(y,v,k)=>{const{width:S,height:E,maxZoom:j}=g.getState(),I=(k==null?void 0:k.zoom)!==void 0?k.zoom:j,T=S/2-y*I,M=E/2-v*I,L=gr.translate(T,M).scale(I);m.transform(Ar(b,k==null?void 0:k.duration),L)},fitBounds:(y,v)=>{const{width:k,height:S,minZoom:E,maxZoom:j}=g.getState(),{x:I,y:T,zoom:M}=ow(y,k,S,E,j,(v==null?void 0:v.padding)??.1),L=gr.translate(I,T).scale(M);m.transform(Ar(b,v==null?void 0:v.duration),L)},project:y=>{const{transform:v,snapToGrid:k,snapGrid:S}=g.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),oh(y,v,k,S)},screenToFlowPosition:y=>{const{transform:v,snapToGrid:k,snapGrid:S,domNode:E}=g.getState();if(!E)return y;const{x:j,y:I}=E.getBoundingClientRect(),T={x:y.x-j,y:y.y-I};return oh(T,v,k,S)},flowToScreenPosition:y=>{const{transform:v,domNode:k}=g.getState();if(!k)return y;const{x:S,y:E}=k.getBoundingClientRect(),j=ew(y,v);return{x:j.x+S,y:j.y+E}},viewportInitialized:!0}:qO,[m,b])})(),e=Wt(),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(m=>({...m}))},[]),s=A.useCallback(g=>{const{edges:m=[]}=e.getState();return m.find(b=>b.id===g)},[]),i=A.useCallback(g=>{const{getNodes:m,setNodes:b,hasDefaultNodes:x,onNodesChange:y}=e.getState(),v=m(),k=typeof g=="function"?g(v):g;if(x)b(k);else if(y){const S=k.length===0?v.map(E=>({type:"remove",id:E.id})):k.map(E=>({item:E,type:"reset"}));y(S)}},[]),a=A.useCallback(g=>{const{edges:m=[],setEdges:b,hasDefaultEdges:x,onEdgesChange:y}=e.getState(),v=typeof g=="function"?g(m):g;x?b(v):y&&y(v.length===0?m.map(k=>({type:"remove",id:k.id})):v.map(k=>({item:k,type:"reset"})))},[]),l=A.useCallback(g=>{const m=Array.isArray(g)?g:[g],{getNodes:b,setNodes:x,hasDefaultNodes:y,onNodesChange:v}=e.getState();if(y)x([...b(),...m]);else if(v){const k=m.map(S=>({item:S,type:"add"}));v(k)}},[]),c=A.useCallback(g=>{const m=Array.isArray(g)?g:[g],{edges:b=[],setEdges:x,hasDefaultEdges:y,onEdgesChange:v}=e.getState();y?x([...b,...m]):v&&v(m.map(k=>({item:k,type:"add"})))},[]),d=A.useCallback(()=>{const{getNodes:g,edges:m=[],transform:b}=e.getState(),[x,y,v]=b;return{nodes:g().map(k=>({...k})),edges:m.map(k=>({...k})),viewport:{x,y,zoom:v}}},[]),u=A.useCallback(({nodes:g,edges:m})=>{const{nodeInternals:b,getNodes:x,edges:y,hasDefaultNodes:v,hasDefaultEdges:k,onNodesDelete:S,onEdgesDelete:E,onNodesChange:j,onEdgesChange:I}=e.getState(),T=(g||[]).map(z=>z.id),M=(m||[]).map(z=>z.id),L=x().reduce((z,F)=>{const V=F.parentNode||F.parentId,P=!T.includes(F.id)&&V&&z.find(C=>C.id===V);return(typeof F.deletable!="boolean"||F.deletable)&&(T.includes(F.id)||P)&&z.push(F),z},[]),B=y.filter(z=>typeof z.deletable!="boolean"||z.deletable),O=B.filter(z=>M.includes(z.id));if(L||O){const z=nw(L,B),F=[...O,...z],V=F.reduce((P,C)=>(P.includes(C.id)||P.push(C.id),P),[]);(k||v)&&(k&&e.setState({edges:y.filter(P=>!V.includes(P.id))}),v&&(L.forEach(P=>{b.delete(P.id)}),e.setState({nodeInternals:new Map(b)}))),V.length>0&&(E==null||E(F),I&&I(V.map(P=>({id:P,type:"remove"})))),L.length>0&&(S==null||S(L),j)&&j(L.map(P=>({id:P.id,type:"remove"})))}},[]),f=A.useCallback(g=>{const m=Rn((b=g).width)&&Rn(b.height)&&Rn(b.x)&&Rn(b.y);var b;const x=m?null:e.getState().nodeInternals.get(g.id);return!m&&!x?[null,null,m]:[m?g:Bx(x),x,m]},[]),p=A.useCallback((g,m=!0,b)=>{const[x,y,v]=f(g);return x?(b||e.getState().getNodes()).filter(k=>{if(!(v||k.id!==y.id&&k.positionAbsolute))return!1;const S=Bx(k),E=Yu(S,x);return m&&E>0||E>=x.width*x.height}):[]},[]),_=A.useCallback((g,m,b=!0)=>{const[x]=f(g);if(!x)return!1;const y=Yu(x,m);return b&&y>0||y>=x.width*x.height},[]);return A.useMemo(()=>({...t,getNodes:n,getNode:o,getEdges:r,getEdge:s,setNodes:i,setEdges:a,addNodes:l,addEdges:c,toObject:d,deleteElements:u,getIntersectingNodes:p,isNodeIntersecting:_}),[t,n,o,r,s,i,a,l,c,d,u,p,_])}const YO={actInsideInputWithModifier:!1},dh={position:"absolute",width:"100%",height:"100%",top:0,left:0},Fl=t=>({x:t.x,y:t.y,zoom:t.k}),us=(t,e)=>t.target.closest(`.${e}`),Sw=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),Cw=t=>{const e=t.ctrlKey&&Tl()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e},JO=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection,d3ZoomHandler:t.d3ZoomHandler,userSelectionActive:t.userSelectionActive}),KO=({onMove:t,onMoveStart:e,onMoveEnd:n,onPaneContextMenu:o,zoomOnScroll:r=!0,zoomOnPinch:s=!0,panOnScroll:i=!1,panOnScrollSpeed:a=.5,panOnScrollMode:l=Qo.Free,zoomOnDoubleClick:c=!0,elementsSelectable:d,panOnDrag:u=!0,defaultViewport:f,translateExtent:p,minZoom:_,maxZoom:g,zoomActivationKeyCode:m,preventScrolling:b=!0,children:x,noWheelClassName:y,noPanClassName:v})=>{const k=A.useRef(),S=Wt(),E=A.useRef(!1),j=A.useRef(!1),I=A.useRef(null),T=A.useRef({x:0,y:0,zoom:0}),{d3Zoom:M,d3Selection:L,d3ZoomHandler:B,userSelectionActive:O}=pt(JO,nn),z=zi(m),F=A.useRef(0),V=A.useRef(!1),P=A.useRef();return function(C){const $=Wt();A.useEffect(()=>{let N;const H=()=>{var Z,q;if(!C.current)return;const G=Wu(C.current);G.height!==0&&G.width!==0||((q=(Z=$.getState()).onError)==null||q.call(Z,"004",bO())),$.setState({width:G.width||500,height:G.height||500})};return H(),window.addEventListener("resize",H),C.current&&(N=new ResizeObserver(()=>H()),N.observe(C.current)),()=>{window.removeEventListener("resize",H),N&&C.current&&N.unobserve(C.current)}},[])}(I),A.useEffect(()=>{if(I.current){const C=I.current.getBoundingClientRect(),$=function(){var q,re,ne,oe=uO,Y=hO,Q=mO,ce=fO,he=pO,de=[0,1/0],me=[[-1/0,-1/0],[1/0,1/0]],ie=250,Ce=K$,we=SS("start","zoom","end"),ae=0,ve=10;function ge(J){J.property("__zoom",Rx).on("wheel.zoom",nt,{passive:!1}).on("mousedown.zoom",it).on("dblclick.zoom",te).filter(he).on("touchstart.zoom",Ne).on("touchmove.zoom",Me).on("touchend.zoom touchcancel.zoom",Be).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function be(J,pe){return(pe=Math.max(de[0],Math.min(de[1],pe)))===J.k?J:new Qp(pe,J.x,J.y)}function Te(J,pe,_e){var ue=pe[0]-_e[0]*J.k,je=pe[1]-_e[1]*J.k;return ue===J.x&&je===J.y?J:new Qp(J.k,ue,je)}function ze(J){return[(+J[0][0]+ +J[1][0])/2,(+J[0][1]+ +J[1][1])/2]}function Xe(J,pe,_e,ue){J.on("start.zoom",function(){Fe(this,arguments).event(ue).start()}).on("interrupt.zoom end.zoom",function(){Fe(this,arguments).event(ue).end()}).tween("zoom",function(){var je=this,ke=arguments,Ve=Fe(je,ke).event(ue),Ze=Y.apply(je,ke),le=_e==null?ze(Ze):typeof _e=="function"?_e.apply(je,ke):_e,Ee=Math.max(Ze[1][0]-Ze[0][0],Ze[1][1]-Ze[0][1]),Ie=je.__zoom,Ue=typeof pe=="function"?pe.apply(je,ke):pe,We=Ce(Ie.invert(le).concat(Ee/Ie.k),Ue.invert(le).concat(Ee/Ue.k));return function(De){if(De===1)De=Ue;else{var Ge=We(De),ot=Ee/Ge[2];De=new Qp(ot,le[0]-Ge[0]*ot,le[1]-Ge[1]*ot)}Ve.zoom(null,De)}})}function Fe(J,pe,_e){return!_e&&J.__zooming||new et(J,pe)}function et(J,pe){this.that=J,this.args=pe,this.active=0,this.sourceEvent=null,this.extent=Y.apply(J,pe),this.taps=0}function nt(J,...pe){if(oe.apply(this,arguments)){var _e=Fe(this,pe).event(J),ue=this.__zoom,je=Math.max(de[0],Math.min(de[1],ue.k*Math.pow(2,ce.apply(this,arguments)))),ke=io(J);if(_e.wheel)_e.mouse[0][0]===ke[0]&&_e.mouse[0][1]===ke[1]||(_e.mouse[1]=ue.invert(_e.mouse[0]=ke)),clearTimeout(_e.wheel);else{if(ue.k===je)return;_e.mouse=[ke,ue.invert(ke)],em(this),_e.start()}Di(J),_e.wheel=setTimeout(function(){_e.wheel=null,_e.end()},150),_e.zoom("mouse",Q(Te(be(ue,je),_e.mouse[0],_e.mouse[1]),_e.extent,me))}}function it(J,...pe){if(!ne&&oe.apply(this,arguments)){var _e=J.currentTarget,ue=Fe(this,pe,!0).event(J),je=eo(J.view).on("mousemove.zoom",function(le){if(Di(le),!ue.moved){var Ee=le.clientX-Ve,Ie=le.clientY-Ze;ue.moved=Ee*Ee+Ie*Ie>ae}ue.event(le).zoom("mouse",Q(Te(ue.that.__zoom,ue.mouse[0]=io(le,_e),ue.mouse[1]),ue.extent,me))},!0).on("mouseup.zoom",function(le){je.on("mousemove.zoom mouseup.zoom",null),Dx(le.view,ue.moved),Di(le),ue.event(le).end()},!0),ke=io(J,_e),Ve=J.clientX,Ze=J.clientY;Ox(J.view),Hu(J),ue.mouse=[ke,this.__zoom.invert(ke)],em(this),ue.start()}}function te(J,...pe){if(oe.apply(this,arguments)){var _e=this.__zoom,ue=io(J.changedTouches?J.changedTouches[0]:J,this),je=_e.invert(ue),ke=_e.k*(J.shiftKey?.5:2),Ve=Q(Te(be(_e,ke),ue,je),Y.apply(this,pe),me);Di(J),ie>0?eo(this).transition().duration(ie).call(Xe,Ve,ue,J):eo(this).call(ge.transform,Ve,ue,J)}}function Ne(J,...pe){if(oe.apply(this,arguments)){var _e,ue,je,ke,Ve=J.touches,Ze=Ve.length,le=Fe(this,pe,J.changedTouches.length===Ze).event(J);for(Hu(J),ue=0;ue<Ze;++ue)ke=[ke=io(je=Ve[ue],this),this.__zoom.invert(ke),je.identifier],le.touch0?le.touch1||le.touch0[2]===ke[2]||(le.touch1=ke,le.taps=0):(le.touch0=ke,_e=!0,le.taps=1+!!q);q&&(q=clearTimeout(q)),_e&&(le.taps<2&&(re=ke[0],q=setTimeout(function(){q=null},500)),em(this),le.start())}}function Me(J,...pe){if(this.__zooming){var _e,ue,je,ke,Ve=Fe(this,pe).event(J),Ze=J.changedTouches,le=Ze.length;for(Di(J),_e=0;_e<le;++_e)je=io(ue=Ze[_e],this),Ve.touch0&&Ve.touch0[2]===ue.identifier?Ve.touch0[0]=je:Ve.touch1&&Ve.touch1[2]===ue.identifier&&(Ve.touch1[0]=je);if(ue=Ve.that.__zoom,Ve.touch1){var Ee=Ve.touch0[0],Ie=Ve.touch0[1],Ue=Ve.touch1[0],We=Ve.touch1[1],De=(De=Ue[0]-Ee[0])*De+(De=Ue[1]-Ee[1])*De,Ge=(Ge=We[0]-Ie[0])*Ge+(Ge=We[1]-Ie[1])*Ge;ue=be(ue,Math.sqrt(De/Ge)),je=[(Ee[0]+Ue[0])/2,(Ee[1]+Ue[1])/2],ke=[(Ie[0]+We[0])/2,(Ie[1]+We[1])/2]}else{if(!Ve.touch0)return;je=Ve.touch0[0],ke=Ve.touch0[1]}Ve.zoom("touch",Q(Te(ue,je,ke),Ve.extent,me))}}function Be(J,...pe){if(this.__zooming){var _e,ue,je=Fe(this,pe).event(J),ke=J.changedTouches,Ve=ke.length;for(Hu(J),ne&&clearTimeout(ne),ne=setTimeout(function(){ne=null},500),_e=0;_e<Ve;++_e)ue=ke[_e],je.touch0&&je.touch0[2]===ue.identifier?delete je.touch0:je.touch1&&je.touch1[2]===ue.identifier&&delete je.touch1;if(je.touch1&&!je.touch0&&(je.touch0=je.touch1,delete je.touch1),je.touch0)je.touch0[1]=this.__zoom.invert(je.touch0[0]);else if(je.end(),je.taps===2&&(ue=io(ue,this),Math.hypot(re[0]-ue[0],re[1]-ue[1])<ve)){var Ze=eo(this).on("dblclick.zoom");Ze&&Ze.apply(this,arguments)}}}return ge.transform=function(J,pe,_e,ue){var je=J.selection?J.selection():J;je.property("__zoom",Rx),J!==je?Xe(J,pe,_e,ue):je.interrupt().each(function(){Fe(this,arguments).event(ue).start().zoom(null,typeof pe=="function"?pe.apply(this,arguments):pe).end()})},ge.scaleBy=function(J,pe,_e,ue){ge.scaleTo(J,function(){return this.__zoom.k*(typeof pe=="function"?pe.apply(this,arguments):pe)},_e,ue)},ge.scaleTo=function(J,pe,_e,ue){ge.transform(J,function(){var je=Y.apply(this,arguments),ke=this.__zoom,Ve=_e==null?ze(je):typeof _e=="function"?_e.apply(this,arguments):_e,Ze=ke.invert(Ve),le=typeof pe=="function"?pe.apply(this,arguments):pe;return Q(Te(be(ke,le),Ve,Ze),je,me)},_e,ue)},ge.translateBy=function(J,pe,_e,ue){ge.transform(J,function(){return Q(this.__zoom.translate(typeof pe=="function"?pe.apply(this,arguments):pe,typeof _e=="function"?_e.apply(this,arguments):_e),Y.apply(this,arguments),me)},null,ue)},ge.translateTo=function(J,pe,_e,ue,je){ge.transform(J,function(){var ke=Y.apply(this,arguments),Ve=this.__zoom,Ze=ue==null?ze(ke):typeof ue=="function"?ue.apply(this,arguments):ue;return Q(gr.translate(Ze[0],Ze[1]).scale(Ve.k).translate(typeof pe=="function"?-pe.apply(this,arguments):-pe,typeof _e=="function"?-_e.apply(this,arguments):-_e),ke,me)},ue,je)},et.prototype={event:function(J){return J&&(this.sourceEvent=J),this},start:function(){return++this.active==1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(J,pe){return this.mouse&&J!=="mouse"&&(this.mouse[1]=pe.invert(this.mouse[0])),this.touch0&&J!=="touch"&&(this.touch0[1]=pe.invert(this.touch0[0])),this.touch1&&J!=="touch"&&(this.touch1[1]=pe.invert(this.touch1[0])),this.that.__zoom=pe,this.emit("zoom"),this},end:function(){return--this.active==0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(J){var pe=eo(this.that).datum();we.call(J,this.that,new dO(J,{sourceEvent:this.sourceEvent,target:ge,transform:this.that.__zoom,dispatch:we}),pe)}},ge.wheelDelta=function(J){return arguments.length?(ce=typeof J=="function"?J:El(+J),ge):ce},ge.filter=function(J){return arguments.length?(oe=typeof J=="function"?J:El(!!J),ge):oe},ge.touchable=function(J){return arguments.length?(he=typeof J=="function"?J:El(!!J),ge):he},ge.extent=function(J){return arguments.length?(Y=typeof J=="function"?J:El([[+J[0][0],+J[0][1]],[+J[1][0],+J[1][1]]]),ge):Y},ge.scaleExtent=function(J){return arguments.length?(de[0]=+J[0],de[1]=+J[1],ge):[de[0],de[1]]},ge.translateExtent=function(J){return arguments.length?(me[0][0]=+J[0][0],me[1][0]=+J[1][0],me[0][1]=+J[0][1],me[1][1]=+J[1][1],ge):[[me[0][0],me[0][1]],[me[1][0],me[1][1]]]},ge.constrain=function(J){return arguments.length?(Q=J,ge):Q},ge.duration=function(J){return arguments.length?(ie=+J,ge):ie},ge.interpolate=function(J){return arguments.length?(Ce=J,ge):Ce},ge.on=function(){var J=we.on.apply(we,arguments);return J===we?ge:J},ge.clickDistance=function(J){return arguments.length?(ae=(J=+J)*J,ge):Math.sqrt(ae)},ge.tapDistance=function(J){return arguments.length?(ve=+J,ge):ve},ge}().scaleExtent([_,g]).translateExtent(p),N=eo(I.current).call($),H=gr.translate(f.x,f.y).scale(is(f.zoom,_,g)),G=[[0,0],[C.width,C.height]],Z=$.constrain()(H,G,p);$.transform(N,Z),$.wheelDelta(Cw),S.setState({d3Zoom:$,d3Selection:N,d3ZoomHandler:N.on("wheel.zoom"),transform:[Z.x,Z.y,Z.k],domNode:I.current.closest(".react-flow")})}},[]),A.useEffect(()=>{L&&M&&(!i||z||O?B!==void 0&&L.on("wheel.zoom",function(C,$){if(!b&&C.type==="wheel"&&!C.ctrlKey||us(C,y))return null;C.preventDefault(),B.call(this,C,$)},{passive:!1}):L.on("wheel.zoom",C=>{if(us(C,y))return!1;C.preventDefault(),C.stopImmediatePropagation();const $=L.property("__zoom").k||1;if(C.ctrlKey&&s){const oe=io(C),Y=Cw(C),Q=$*Math.pow(2,Y);return void M.scaleTo(L,Q,oe,C)}const N=C.deltaMode===1?20:1;let H=l===Qo.Vertical?0:C.deltaX*N,G=l===Qo.Horizontal?0:C.deltaY*N;!Tl()&&C.shiftKey&&l!==Qo.Vertical&&(H=C.deltaY*N,G=0),M.translateBy(L,-H/$*a,-G/$*a,{internal:!0});const Z=Fl(L.property("__zoom")),{onViewportChangeStart:q,onViewportChange:re,onViewportChangeEnd:ne}=S.getState();clearTimeout(P.current),V.current||(V.current=!0,e==null||e(C,Z),q==null||q(Z)),V.current&&(t==null||t(C,Z),re==null||re(Z),P.current=setTimeout(()=>{n==null||n(C,Z),ne==null||ne(Z),V.current=!1},150))},{passive:!1}))},[O,i,l,L,M,B,z,s,b,y,e,t,n]),A.useEffect(()=>{M&&M.on("start",C=>{var H,G;if(!C.sourceEvent||C.sourceEvent.internal)return null;F.current=(H=C.sourceEvent)==null?void 0:H.button;const{onViewportChangeStart:$}=S.getState(),N=Fl(C.transform);E.current=!0,T.current=N,((G=C.sourceEvent)==null?void 0:G.type)==="mousedown"&&S.setState({paneDragging:!0}),$==null||$(N),e==null||e(C.sourceEvent,N)})},[M,e]),A.useEffect(()=>{M&&(O&&!E.current?M.on("zoom",null):O||M.on("zoom",C=>{var N;const{onViewportChange:$}=S.getState();if(S.setState({transform:[C.transform.x,C.transform.y,C.transform.k]}),j.current=!(!o||!Sw(u,F.current??0)),(t||$)&&!((N=C.sourceEvent)!=null&&N.internal)){const H=Fl(C.transform);$==null||$(H),t==null||t(C.sourceEvent,H)}}))},[O,M,t,u,o]),A.useEffect(()=>{M&&M.on("end",C=>{if(!C.sourceEvent||C.sourceEvent.internal)return null;const{onViewportChangeEnd:$}=S.getState();if(E.current=!1,S.setState({paneDragging:!1}),o&&Sw(u,F.current??0)&&!j.current&&o(C.sourceEvent),j.current=!1,(n||$)&&(N=T.current,H=C.transform,N.x!==H.x||N.y!==H.y||N.zoom!==H.k)){const G=Fl(C.transform);T.current=G,clearTimeout(k.current),k.current=setTimeout(()=>{$==null||$(G),n==null||n(C.sourceEvent,G)},i?150:0)}var N,H})},[M,i,u,n,o]),A.useEffect(()=>{M&&M.filter(C=>{const $=z||r,N=s&&C.ctrlKey;if((u===!0||Array.isArray(u)&&u.includes(1))&&C.button===1&&C.type==="mousedown"&&(us(C,"react-flow__node")||us(C,"react-flow__edge")))return!0;if(!(u||$||i||c||s)||O||!c&&C.type==="dblclick"||us(C,y)&&C.type==="wheel"||us(C,v)&&(C.type!=="wheel"||i&&C.type==="wheel"&&!z)||!s&&C.ctrlKey&&C.type==="wheel"||!$&&!i&&!N&&C.type==="wheel"||!u&&(C.type==="mousedown"||C.type==="touchstart")||Array.isArray(u)&&!u.includes(C.button)&&C.type==="mousedown")return!1;const H=Array.isArray(u)&&u.includes(C.button)||!C.button||C.button<=1;return(!C.ctrlKey||C.type==="wheel")&&H})},[O,M,r,s,i,c,u,d,z]),K.createElement("div",{className:"react-flow__renderer",ref:I,style:dh},x)},XO=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function ZO(){const{userSelectionActive:t,userSelectionRect:e}=pt(XO,nn);return t&&e?K.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}function Nw(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 jw(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&&Nw(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&&Nw(o,i);break;case"remove":return o}return o.push(i),o},n)}function Ew(t,e){return jw(t,e)}const nr=(t,e)=>({id:t,type:"select",selected:e});function hs(t,e){return t.reduce((n,o)=>{const r=e.includes(o.id);return!o.selected&&r?(o.selected=!0,n.push(nr(o.id,!0))):o.selected&&!r&&(o.selected=!1,n.push(nr(o.id,!1))),n},[])}const uh=(t,e)=>n=>{n.target===e.current&&(t==null||t(n))},QO=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,dragging:t.paneDragging}),Iw=A.memo(({isSelecting:t,selectionMode:e=Li.Full,panOnDrag:n,onSelectionStart:o,onSelectionEnd:r,onPaneClick:s,onPaneContextMenu:i,onPaneScroll:a,onPaneMouseEnter:l,onPaneMouseMove:c,onPaneMouseLeave:d,children:u})=>{const f=A.useRef(null),p=Wt(),_=A.useRef(0),g=A.useRef(0),m=A.useRef(),{userSelectionActive:b,elementsSelectable:x,dragging:y}=pt(QO,nn),v=()=>{p.setState({userSelectionActive:!1,userSelectionRect:null}),_.current=0,g.current=0},k=j=>{s==null||s(j),p.getState().resetSelectedElements(),p.setState({nodesSelectionActive:!1})},S=a?j=>a(j):void 0,E=x&&(t||b);return K.createElement("div",{className:un(["react-flow__pane",{dragging:y,selection:t}]),onClick:E?void 0:uh(k,f),onContextMenu:uh(j=>{Array.isArray(n)&&(n!=null&&n.includes(2))?j.preventDefault():i==null||i(j)},f),onWheel:uh(S,f),onMouseEnter:E?void 0:l,onMouseDown:E?j=>{const{resetSelectedElements:I,domNode:T}=p.getState();if(m.current=T==null?void 0:T.getBoundingClientRect(),!x||!t||j.button!==0||j.target!==f.current||!m.current)return;const{x:M,y:L}=Zo(j,m.current);I(),p.setState({userSelectionRect:{width:0,height:0,startX:M,startY:L,x:M,y:L}}),o==null||o(j)}:void 0,onMouseMove:E?j=>{const{userSelectionRect:I,nodeInternals:T,edges:M,transform:L,onNodesChange:B,onEdgesChange:O,nodeOrigin:z,getNodes:F}=p.getState();if(!t||!m.current||!I)return;p.setState({userSelectionActive:!0,nodesSelectionActive:!1});const V=Zo(j,m.current),P=I.startX??0,C=I.startY??0,$={...I,x:V.x<P?V.x:P,y:V.y<C?V.y:C,width:Math.abs(V.x-P),height:Math.abs(V.y-C)},N=F(),H=tw(T,$,L,e===Li.Partial,!0,z),G=nw(H,M).map(q=>q.id),Z=H.map(q=>q.id);if(_.current!==Z.length){_.current=Z.length;const q=hs(N,Z);q.length&&(B==null||B(q))}if(g.current!==G.length){g.current=G.length;const q=hs(M,G);q.length&&(O==null||O(q))}p.setState({userSelectionRect:$})}:c,onMouseUp:E?j=>{if(j.button!==0)return;const{userSelectionRect:I}=p.getState();!b&&I&&j.target===f.current&&(k==null||k(j)),p.setState({nodesSelectionActive:_.current>0}),v(),r==null||r(j)}:void 0,onMouseLeave:E?j=>{b&&(p.setState({nodesSelectionActive:_.current>0}),r==null||r(j)),v()}:d,ref:f,style:dh},u,K.createElement(ZO,null))});function Aw(t,e){const n=t.parentNode||t.parentId;if(!n)return!1;const o=e.get(n);return!!o&&(!!o.selected||Aw(o,e))}function Tw(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 e9(t,e,n,o){return Array.from(t.values()).filter(r=>(r.selected||r.id===o)&&(!r.parentNode||r.parentId||!Aw(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 Mw(t,e,n,o,r=[0,0],s){const i=function(u,f){return f&&f!=="parent"?[f[0],[f[1][0]-(u.width||0),f[1][1]-(u.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 u=n.get(l),{x:f,y:p}=ls(u,r).positionAbsolute;a=[[t.extent[0][0]+f,t.extent[0][1]+p],[t.extent[1][0]+f,t.extent[1][1]+p]]}}else if(l&&t.width&&t.height){const u=n.get(l),{x:f,y:p}=ls(u,r).positionAbsolute;a=u&&Rn(f)&&Rn(p)&&Rn(u.width)&&Rn(u.height)?[[f+t.width*r[0],p+t.height*r[1]],[f+u.width-t.width+t.width*r[0],p+u.height-t.height+t.height*r[1]]]:a}else s==null||s("005",yO()),a=i;let c={x:0,y:0};if(l){const u=n.get(l);c=ls(u,r).positionAbsolute}const d=a&&a!=="parent"?qu(e,a):e;return{position:{x:d.x-c.x,y:d.y-c.y},positionAbsolute:d}}function hh({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]}Iw.displayName="Pane";const Ow=(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,...Wu(c)}})};function Ui(t,e,n){return n===void 0?n:o=>{const r=e().nodeInternals.get(t);r&&n(o,{...r})}}function fh({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",SO(t))}function ph(t){return(e,n,o)=>t==null?void 0:t(e,o)}function Dw({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:s,selectNodesOnDrag:i}){const a=Wt(),[l,c]=A.useState(!1),d=A.useRef([]),u=A.useRef({x:null,y:null}),f=A.useRef(0),p=A.useRef(null),_=A.useRef({x:0,y:0}),g=A.useRef(null),m=A.useRef(!1),b=A.useRef(!1),x=A.useRef(!1),y=function(){const v=Wt();return A.useCallback(({sourceEvent:S})=>{const{transform:E,snapGrid:j,snapToGrid:I}=v.getState(),T=S.touches?S.touches[0].clientX:S.clientX,M=S.touches?S.touches[0].clientY:S.clientY,L={x:(T-E[0])/E[2],y:(M-E[1])/E[2]};return{xSnapped:I?j[0]*Math.round(L.x/j[0]):L.x,ySnapped:I?j[1]*Math.round(L.y/j[1]):L.y,...L}},[])}();return A.useEffect(()=>{if(t!=null&&t.current){const v=eo(t.current),k=({x:j,y:I})=>{const{nodeInternals:T,onNodeDrag:M,onSelectionDrag:L,updateNodePositions:B,nodeExtent:O,snapGrid:z,snapToGrid:F,nodeOrigin:V,onError:P}=a.getState();u.current={x:j,y:I};let C=!1,$={x:0,y:0,x2:0,y2:0};if(d.current.length>1&&O){const H=rh(d.current,V);$=Gu(H)}if(d.current=d.current.map(H=>{const G={x:j-H.distance.x,y:I-H.distance.y};F&&(G.x=z[0]*Math.round(G.x/z[0]),G.y=z[1]*Math.round(G.y/z[1]));const Z=[[O[0][0],O[0][1]],[O[1][0],O[1][1]]];d.current.length>1&&O&&!H.extent&&(Z[0][0]=H.positionAbsolute.x-$.x+O[0][0],Z[1][0]=H.positionAbsolute.x+(H.width??0)-$.x2+O[1][0],Z[0][1]=H.positionAbsolute.y-$.y+O[0][1],Z[1][1]=H.positionAbsolute.y+(H.height??0)-$.y2+O[1][1]);const q=Mw(H,G,T,Z,V,P);return C=C||H.position.x!==q.position.x||H.position.y!==q.position.y,H.position=q.position,H.positionAbsolute=q.positionAbsolute,H}),!C)return;B(d.current,!0,!0),c(!0);const N=r?M:ph(L);if(N&&g.current){const[H,G]=hh({nodeId:r,dragItems:d.current,nodeInternals:T});N(g.current,H,G)}},S=()=>{if(!p.current)return;const[j,I]=Fx(_.current,p.current);if(j!==0||I!==0){const{transform:T,panBy:M}=a.getState();u.current.x=(u.current.x??0)-j/T[2],u.current.y=(u.current.y??0)-I/T[2],M({x:j,y:I})&&k(u.current)}f.current=requestAnimationFrame(S)},E=j=>{var V;const{nodeInternals:I,multiSelectionActive:T,nodesDraggable:M,unselectNodesAndEdges:L,onNodeDragStart:B,onSelectionDragStart:O}=a.getState();b.current=!0;const z=r?B:ph(O);i&&s||T||!r||(V=I.get(r))!=null&&V.selected||L(),r&&s&&i&&fh({id:r,store:a,nodeRef:t});const F=y(j);if(u.current=F,d.current=e9(I,M,F,r),z&&d.current){const[P,C]=hh({nodeId:r,dragItems:d.current,nodeInternals:I});z(j.sourceEvent,P,C)}};if(!e){const j=function(){var I,T,M,L,B=iO,O=aO,z=lO,F=cO,V={},P=SS("start","drag","end"),C=0,$=0;function N(Y){Y.on("mousedown.drag",H).filter(F).on("touchstart.drag",q).on("touchmove.drag",re,sO).on("touchend.drag touchcancel.drag",ne).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function H(Y,Q){if(!L&&B.call(this,Y,Q)){var ce=oe(this,O.call(this,Y,Q),Y,Q,"mouse");ce&&(eo(Y.view).on("mousemove.drag",G,Oi).on("mouseup.drag",Z,Oi),Ox(Y.view),Vu(Y),M=!1,I=Y.clientX,T=Y.clientY,ce("start",Y))}}function G(Y){if(ss(Y),!M){var Q=Y.clientX-I,ce=Y.clientY-T;M=Q*Q+ce*ce>$}V.mouse("drag",Y)}function Z(Y){eo(Y.view).on("mousemove.drag mouseup.drag",null),Dx(Y.view,M),ss(Y),V.mouse("end",Y)}function q(Y,Q){if(B.call(this,Y,Q)){var ce,he,de=Y.changedTouches,me=O.call(this,Y,Q),ie=de.length;for(ce=0;ce<ie;++ce)(he=oe(this,me,Y,Q,de[ce].identifier,de[ce]))&&(Vu(Y),he("start",Y,de[ce]))}}function re(Y){var Q,ce,he=Y.changedTouches,de=he.length;for(Q=0;Q<de;++Q)(ce=V[he[Q].identifier])&&(ss(Y),ce("drag",Y,he[Q]))}function ne(Y){var Q,ce,he=Y.changedTouches,de=he.length;for(L&&clearTimeout(L),L=setTimeout(function(){L=null},500),Q=0;Q<de;++Q)(ce=V[he[Q].identifier])&&(Vu(Y),ce("end",Y,he[Q]))}function oe(Y,Q,ce,he,de,me){var ie,Ce,we,ae=P.copy(),ve=io(me||ce,Q);if((we=z.call(Y,new $u("beforestart",{sourceEvent:ce,target:N,identifier:de,active:C,x:ve[0],y:ve[1],dx:0,dy:0,dispatch:ae}),he))!=null)return ie=we.x-ve[0]||0,Ce=we.y-ve[1]||0,function ge(be,Te,ze){var Xe,Fe=ve;switch(be){case"start":V[de]=ge,Xe=C++;break;case"end":delete V[de],--C;case"drag":ve=io(ze||Te,Q),Xe=C}ae.call(be,Y,new $u(be,{sourceEvent:Te,subject:we,target:N,identifier:de,active:Xe,x:ve[0]+ie,y:ve[1]+Ce,dx:ve[0]-Fe[0],dy:ve[1]-Fe[1],dispatch:ae}),he)}}return N.filter=function(Y){return arguments.length?(B=typeof Y=="function"?Y:jl(!!Y),N):B},N.container=function(Y){return arguments.length?(O=typeof Y=="function"?Y:jl(Y),N):O},N.subject=function(Y){return arguments.length?(z=typeof Y=="function"?Y:jl(Y),N):z},N.touchable=function(Y){return arguments.length?(F=typeof Y=="function"?Y:jl(!!Y),N):F},N.on=function(){var Y=P.on.apply(P,arguments);return Y===P?N:Y},N.clickDistance=function(Y){return arguments.length?($=(Y=+Y)*Y,N):Math.sqrt($)},N}().on("start",I=>{const{domNode:T,nodeDragThreshold:M}=a.getState();M===0&&E(I),x.current=!1;const L=y(I);u.current=L,p.current=(T==null?void 0:T.getBoundingClientRect())||null,_.current=Zo(I.sourceEvent,p.current)}).on("drag",I=>{var B,O;const T=y(I),{autoPanOnNodeDrag:M,nodeDragThreshold:L}=a.getState();if(I.sourceEvent.type==="touchmove"&&I.sourceEvent.touches.length>1&&(x.current=!0),!x.current){if(!m.current&&b.current&&M&&(m.current=!0,S()),!b.current){const z=T.xSnapped-(((B=u==null?void 0:u.current)==null?void 0:B.x)??0),F=T.ySnapped-(((O=u==null?void 0:u.current)==null?void 0:O.y)??0);Math.sqrt(z*z+F*F)>L&&E(I)}(u.current.x!==T.xSnapped||u.current.y!==T.ySnapped)&&d.current&&b.current&&(g.current=I.sourceEvent,_.current=Zo(I.sourceEvent,p.current),k(T))}}).on("end",I=>{if(b.current&&!x.current&&(c(!1),m.current=!1,b.current=!1,cancelAnimationFrame(f.current),d.current)){const{updateNodePositions:T,nodeInternals:M,onNodeDragStop:L,onSelectionDragStop:B}=a.getState(),O=r?L:ph(B);if(T(d.current,!1,!1),O){const[z,F]=hh({nodeId:r,dragItems:d.current,nodeInternals:M});O(I.sourceEvent,z,F)}}}).filter(I=>{const T=I.target;return!I.button&&(!n||!Tw(T,`.${n}`,t))&&(!o||Tw(T,o,t))});return v.call(j),()=>{v.on(".drag",null)}}v.on(".drag",null)}},[t,e,n,o,s,a,r,i,y]),l}function Rw(){const t=Wt();return A.useCallback(n=>{const{nodeInternals:o,nodeExtent:r,updateNodePositions:s,getNodes:i,snapToGrid:a,snapGrid:l,onError:c,nodesDraggable:d}=t.getState(),u=i().filter(x=>x.selected&&(x.draggable||d&&x.draggable===void 0)),f=a?l[0]:5,p=a?l[1]:5,_=n.isShiftPressed?4:1,g=n.x*f*_,m=n.y*p*_,b=u.map(x=>{if(x.positionAbsolute){const y={x:x.positionAbsolute.x+g,y:x.positionAbsolute.y+m};a&&(y.x=l[0]*Math.round(y.x/l[0]),y.y=l[1]*Math.round(y.y/l[1]));const{positionAbsolute:v,position:k}=Mw(x,y,o,r,void 0,c);x.position=k,x.positionAbsolute=v}return x});s(b,!0,!1)},[])}const fs={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Vi=t=>{const e=({id:n,type:o,data:r,xPos:s,yPos:i,xPosOrigin:a,yPosOrigin:l,selected:c,onClick:d,onMouseEnter:u,onMouseMove:f,onMouseLeave:p,onContextMenu:_,onDoubleClick:g,style:m,className:b,isDraggable:x,isSelectable:y,isConnectable:v,isFocusable:k,selectNodesOnDrag:S,sourcePosition:E,targetPosition:j,hidden:I,resizeObserver:T,dragHandle:M,zIndex:L,isParent:B,noDragClassName:O,noPanClassName:z,initialized:F,disableKeyboardA11y:V,ariaLabel:P,rfId:C,hasHandleBounds:$})=>{const N=Wt(),H=A.useRef(null),G=A.useRef(null),Z=A.useRef(E),q=A.useRef(j),re=A.useRef(o),ne=y||x||d||u||f||p,oe=Rw(),Y=Ui(n,N.getState,u),Q=Ui(n,N.getState,f),ce=Ui(n,N.getState,p),he=Ui(n,N.getState,_),de=Ui(n,N.getState,g);A.useEffect(()=>()=>{G.current&&(T==null||T.unobserve(G.current),G.current=null)},[]),A.useEffect(()=>{if(H.current&&!I){const ie=H.current;F&&$&&G.current===ie||(G.current&&(T==null||T.unobserve(G.current)),T==null||T.observe(ie),G.current=ie)}},[I,F,$]),A.useEffect(()=>{const ie=re.current!==o,Ce=Z.current!==E,we=q.current!==j;H.current&&(ie||Ce||we)&&(ie&&(re.current=o),Ce&&(Z.current=E),we&&(q.current=j),N.getState().updateNodeDimensions([{id:n,nodeElement:H.current,forceUpdate:!0}]))},[n,o,E,j]);const me=Dw({nodeRef:H,disabled:I||!x,noDragClassName:O,handleSelector:M,nodeId:n,isSelectable:y,selectNodesOnDrag:S});return I?null:K.createElement("div",{className:un(["react-flow__node",`react-flow__node-${o}`,{[z]:x},b,{selected:c,selectable:y,parent:B,dragging:me}]),ref:H,style:{zIndex:L,transform:`translate(${a}px,${l}px)`,pointerEvents:ne?"all":"none",visibility:F?"visible":"hidden",...m},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:Y,onMouseMove:Q,onMouseLeave:ce,onContextMenu:he,onClick:ie=>{const{nodeDragThreshold:Ce}=N.getState();if(y&&(!S||!x||Ce>0)&&fh({id:n,store:N,nodeRef:H}),d){const we=N.getState().nodeInternals.get(n);we&&d(ie,{...we})}},onDoubleClick:de,onKeyDown:k?ie=>{if(!Ju(ie)&&!V)if(Ux.includes(ie.key)&&y){const Ce=ie.key==="Escape";fh({id:n,store:N,unselect:Ce,nodeRef:H})}else x&&c&&Object.prototype.hasOwnProperty.call(fs,ie.key)&&(N.setState({ariaLiveMessage:`Moved selected node ${ie.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~s}, y: ${~~i}`}),oe({x:fs[ie.key].x,y:fs[ie.key].y,isShiftPressed:ie.shiftKey}))}:void 0,tabIndex:k?0:void 0,role:k?"button":void 0,"aria-describedby":V?void 0:`${_w}-${C}`,"aria-label":P},K.createElement(IO,{value:n},K.createElement(t,{id:n,data:r,type:o,xPos:s,yPos:i,selected:c,isConnectable:v,sourcePosition:E,targetPosition:j,dragging:me,dragHandle:M,zIndex:L})))};return e.displayName="NodeWrapper",A.memo(e)};const t9=t=>{const e=t.getNodes().filter(n=>n.selected);return{...rh(e,t.nodeOrigin),transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`,userSelectionActive:t.userSelectionActive}};var n9=A.memo(function({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const o=Wt(),{width:r,height:s,x:i,y:a,transformString:l,userSelectionActive:c}=pt(t9,nn),d=Rw(),u=A.useRef(null);if(A.useEffect(()=>{var p;n||((p=u.current)==null||p.focus({preventScroll:!0}))},[n]),Dw({nodeRef:u}),c||!r||!s)return null;const f=t?p=>{const _=o.getState().getNodes().filter(g=>g.selected);t(p,_)}:void 0;return K.createElement("div",{className:un(["react-flow__nodesselection","react-flow__container",e]),style:{transform:l}},K.createElement("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:p=>{Object.prototype.hasOwnProperty.call(fs,p.key)&&d({x:fs[p.key].x,y:fs[p.key].y,isShiftPressed:p.shiftKey})},style:{width:r,height:s,top:a,left:i}}))});const o9=t=>t.nodesSelectionActive,Pw=({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:i,deleteKeyCode:a,onMove:l,onMoveStart:c,onMoveEnd:d,selectionKeyCode:u,selectionOnDrag:f,selectionMode:p,onSelectionStart:_,onSelectionEnd:g,multiSelectionKeyCode:m,panActivationKeyCode:b,zoomActivationKeyCode:x,elementsSelectable:y,zoomOnScroll:v,zoomOnPinch:k,panOnScroll:S,panOnScrollSpeed:E,panOnScrollMode:j,zoomOnDoubleClick:I,panOnDrag:T,defaultViewport:M,translateExtent:L,minZoom:B,maxZoom:O,preventScrolling:z,onSelectionContextMenu:F,noWheelClassName:V,noPanClassName:P,disableKeyboardA11y:C})=>{const $=pt(o9),N=zi(u),H=zi(b),G=H||T,Z=H||S,q=N||f&&G!==!0;return(({deleteKeyCode:re,multiSelectionKeyCode:ne})=>{const oe=Wt(),{deleteElements:Y}=Bi(),Q=zi(re,YO),ce=zi(ne);A.useEffect(()=>{if(Q){const{edges:he,getNodes:de}=oe.getState(),me=de().filter(Ce=>Ce.selected),ie=he.filter(Ce=>Ce.selected);Y({nodes:me,edges:ie}),oe.setState({nodesSelectionActive:!1})}},[Q]),A.useEffect(()=>{oe.setState({multiSelectionActive:ce})},[ce])})({deleteKeyCode:a,multiSelectionKeyCode:m}),K.createElement(KO,{onMove:l,onMoveStart:c,onMoveEnd:d,onPaneContextMenu:s,elementsSelectable:y,zoomOnScroll:v,zoomOnPinch:k,panOnScroll:Z,panOnScrollSpeed:E,panOnScrollMode:j,zoomOnDoubleClick:I,panOnDrag:!N&&G,defaultViewport:M,translateExtent:L,minZoom:B,maxZoom:O,zoomActivationKeyCode:x,preventScrolling:z,noWheelClassName:V,noPanClassName:P},K.createElement(Iw,{onSelectionStart:_,onSelectionEnd:g,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:i,panOnDrag:G,isSelecting:!!q,selectionMode:p},t,$&&K.createElement(n9,{onSelectionContextMenu:F,noPanClassName:P,disableKeyboardA11y:C})))};Pw.displayName="FlowRenderer";var r9=A.memo(Pw);function s9(t){return{input:Vi(t.input||hw),default:Vi(t.default||ah),output:Vi(t.output||pw),group:Vi(t.group||lh),...Object.keys(t).filter(e=>!["input","default","output","group"].includes(e)).reduce((e,n)=>(e[n]=Vi(t[n]||ah),e),{})}}const i9=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,updateNodeDimensions:t.updateNodeDimensions,onError:t.onError}),Lw=t=>{const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,updateNodeDimensions:s,onError:i}=pt(i9,nn),a=(l=t.onlyRenderVisibleElements,pt(A.useCallback(u=>l?tw(u.nodeInternals,{x:0,y:0,width:u.width,height:u.height},u.transform,!0):u.getNodes(),[l])));var l;const c=A.useRef(),d=A.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const u=new ResizeObserver(f=>{const p=f.map(_=>({id:_.target.getAttribute("data-id"),nodeElement:_.target,forceUpdate:!0}));s(p)});return c.current=u,u},[]);return A.useEffect(()=>()=>{var u;(u=c==null?void 0:c.current)==null||u.disconnect()},[]),K.createElement("div",{className:"react-flow__nodes",style:dh},a.map(u=>{var S,E,j;let f=u.type||"default";t.nodeTypes[f]||(i==null||i("003",_O(f)),f="default");const p=t.nodeTypes[f]||t.nodeTypes.default,_=!!(u.draggable||e&&u.draggable===void 0),g=!!(u.selectable||r&&u.selectable===void 0),m=!!(u.connectable||n&&u.connectable===void 0),b=!!(u.focusable||o&&u.focusable===void 0),x=t.nodeExtent?qu(u.positionAbsolute,t.nodeExtent):u.positionAbsolute,y=(x==null?void 0:x.x)??0,v=(x==null?void 0:x.y)??0,k=(({x:I,y:T,width:M,height:L,origin:B})=>M&&L?B[0]<0||B[1]<0||B[0]>1||B[1]>1?{x:I,y:T}:{x:I-M*B[0],y:T-L*B[1]}:{x:I,y:T})({x:y,y:v,width:u.width??0,height:u.height??0,origin:t.nodeOrigin});return K.createElement(p,{key:u.id,id:u.id,className:u.className,style:u.style,type:f,data:u.data,sourcePosition:u.sourcePosition||$e.Bottom,targetPosition:u.targetPosition||$e.Top,hidden:u.hidden,xPos:y,yPos:v,xPosOrigin:k.x,yPosOrigin:k.y,selectNodesOnDrag:t.selectNodesOnDrag,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,selected:!!u.selected,isDraggable:_,isSelectable:g,isConnectable:m,isFocusable:b,resizeObserver:d,dragHandle:u.dragHandle,zIndex:((S=u[Nt])==null?void 0:S.z)??0,isParent:!!((E=u[Nt])!=null&&E.isParent),noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,initialized:!!u.width&&!!u.height,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,ariaLabel:u.ariaLabel,hasHandleBounds:!!((j=u[Nt])!=null&&j.handleBounds)})}))};Lw.displayName="NodeRenderer";var a9=A.memo(Lw);const l9=(t,e,n)=>n===$e.Left?t-e:n===$e.Right?t+e:t,c9=(t,e,n)=>n===$e.Top?t-e:n===$e.Bottom?t+e:t,Fw="react-flow__edgeupdater",zw=({position:t,centerX:e,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:s,onMouseOut:i,type:a})=>K.createElement("circle",{onMouseDown:r,onMouseEnter:s,onMouseOut:i,className:un([Fw,`${Fw}-${a}`]),cx:l9(e,o,t),cy:c9(n,o,t),r:o,stroke:"transparent",fill:"transparent"}),d9=()=>!0;var ps=t=>{const e=({id:n,className:o,type:r,data:s,onClick:i,onEdgeDoubleClick:a,selected:l,animated:c,label:d,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:_,labelBgBorderRadius:g,style:m,source:b,target:x,sourceX:y,sourceY:v,targetX:k,targetY:S,sourcePosition:E,targetPosition:j,elementsSelectable:I,hidden:T,sourceHandleId:M,targetHandleId:L,onContextMenu:B,onMouseEnter:O,onMouseMove:z,onMouseLeave:F,reconnectRadius:V,onReconnect:P,onReconnectStart:C,onReconnectEnd:$,markerEnd:N,markerStart:H,rfId:G,ariaLabel:Z,isFocusable:q,isReconnectable:re,pathOptions:ne,interactionWidth:oe,disableKeyboardA11y:Y})=>{const Q=A.useRef(null),[ce,he]=A.useState(!1),[de,me]=A.useState(!1),ie=Wt(),Ce=A.useMemo(()=>`url('#${nh(H,G)}')`,[H,G]),we=A.useMemo(()=>`url('#${nh(N,G)}')`,[N,G]);if(T)return null;const ae=Pi(n,ie.getState,a),ve=Pi(n,ie.getState,B),ge=Pi(n,ie.getState,O),be=Pi(n,ie.getState,z),Te=Pi(n,ie.getState,F),ze=(nt,it)=>{if(nt.button!==0)return;const{edges:te,isValidConnection:Ne}=ie.getState(),Me=it?x:b,Be=(it?L:M)||null,J=it?"target":"source",pe=Ne||d9,_e=it,ue=te.find(je=>je.id===n);me(!0),C==null||C(nt,ue,J),aw({event:nt,handleId:Be,nodeId:Me,onConnect:je=>P==null?void 0:P(ue,je),isTarget:_e,getState:ie.getState,setState:ie.setState,isValidConnection:pe,edgeUpdaterType:J,onReconnectEnd:je=>{me(!1),$==null||$(je,ue,J)}})},Xe=()=>he(!0),Fe=()=>he(!1),et=!I&&!i;return K.createElement("g",{className:un(["react-flow__edge",`react-flow__edge-${r}`,o,{selected:l,animated:c,inactive:et,updating:ce}]),onClick:nt=>{var J;const{edges:it,addSelectedEdges:te,unselectNodesAndEdges:Ne,multiSelectionActive:Me}=ie.getState(),Be=it.find(pe=>pe.id===n);Be&&(I&&(ie.setState({nodesSelectionActive:!1}),Be.selected&&Me?(Ne({nodes:[],edges:[Be]}),(J=Q.current)==null||J.blur()):te([n])),i&&i(nt,Be))},onDoubleClick:ae,onContextMenu:ve,onMouseEnter:ge,onMouseMove:be,onMouseLeave:Te,onKeyDown:q?nt=>{var it;if(!Y&&Ux.includes(nt.key)&&I){const{unselectNodesAndEdges:te,addSelectedEdges:Ne,edges:Me}=ie.getState();nt.key==="Escape"?((it=Q.current)==null||it.blur(),te({edges:[Me.find(Be=>Be.id===n)]})):Ne([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 ${x}`,"aria-describedby":q?`${bw}-${G}`:void 0,ref:Q},!de&&K.createElement(t,{id:n,source:b,target:x,selected:l,animated:c,label:d,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:_,labelBgBorderRadius:g,data:s,style:m,sourceX:y,sourceY:v,targetX:k,targetY:S,sourcePosition:E,targetPosition:j,sourceHandleId:M,targetHandleId:L,markerStart:Ce,markerEnd:we,pathOptions:ne,interactionWidth:oe}),re&&K.createElement(K.Fragment,null,(re==="source"||re===!0)&&K.createElement(zw,{position:E,centerX:y,centerY:v,radius:V,onMouseDown:nt=>ze(nt,!0),onMouseEnter:Xe,onMouseOut:Fe,type:"source"}),(re==="target"||re===!0)&&K.createElement(zw,{position:j,centerX:k,centerY:S,radius:V,onMouseDown:nt=>ze(nt,!1),onMouseEnter:Xe,onMouseOut:Fe,type:"target"})))};return e.displayName="EdgeWrapper",A.memo(e)};function u9(t){return{default:ps(t.default||Rl),straight:ps(t.bezier||eh),step:ps(t.step||Qu),smoothstep:ps(t.step||Ol),simplebezier:ps(t.simplebezier||Xu),...Object.keys(t).filter(e=>!["default","bezier"].includes(e)).reduce((e,n)=>(e[n]=ps(t[n]||Rl),e),{})}}function Bw(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 $e.Top:return{x:o+s/2,y:r};case $e.Right:return{x:o+s,y:r+i/2};case $e.Bottom:return{x:o+s/2,y:r+i};case $e.Left:return{x:o,y:r+i/2}}}function Uw(t,e){return t?t.length!==1&&e?e&&t.find(n=>n.id===e)||null:t[0]:null}function Vw(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 h9=[{level:0,isMaxLevel:!0,edges:[]}];function f9(t,e,n){return function(o,r,s=!1){let i=-1;const a=o.reduce((c,d)=>{var p,_;const u=Rn(d.zIndex);let f=u?d.zIndex:0;if(s){const g=r.get(d.target),m=r.get(d.source),b=d.selected||(g==null?void 0:g.selected)||(m==null?void 0:m.selected),x=Math.max(((p=m==null?void 0:m[Nt])==null?void 0:p.z)||0,((_=g==null?void 0:g[Nt])==null?void 0:_.z)||0,1e3);f=(u?d.zIndex:0)+(b?x: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 u=+c;return{edges:d,level:u,isMaxLevel:u===i}});return l.length===0?h9:l}(pt(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:u,targetHeight:f,width:p,height:_,transform:g}){const m={x:Math.min(a.x,l.x),y:Math.min(a.y,l.y),x2:Math.max(a.x+c,l.x+u),y2:Math.max(a.y+d,l.y+f)};m.x===m.x2&&(m.x2+=1),m.y===m.y2&&(m.y2+=1);const b=Gu({x:(0-g[0])/g[2],y:(0-g[1])/g[2],width:p/g[2],height:_/g[2]}),x=Math.max(0,Math.min(b.x2,m.x2)-Math.max(b.x,m.x)),y=Math.max(0,Math.min(b.y2,m.y2)-Math.max(b.y,m.y));return Math.ceil(x*y)>0}({sourcePos:s.positionAbsolute||{x:0,y:0},targetPos:i.positionAbsolute||{x:0,y:0},sourceWidth:s.width,sourceHeight:s.height,targetWidth:i.width,targetHeight:i.height,width:o.width,height:o.height,transform:o.transform})}):o.edges,[t,e])),e,n)}const $w={[as.Arrow]:({color:t="none",strokeWidth:e=1})=>K.createElement("polyline",{style:{stroke:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),[as.ArrowClosed]:({color:t="none",strokeWidth:e=1})=>K.createElement("polyline",{style:{stroke:t,fill:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},p9=({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=Wt();return A.useMemo(()=>{var u,f;return Object.prototype.hasOwnProperty.call($w,c)?$w[c]:((f=(u=d.getState()).onError)==null||f.call(u,"009",xO(c)),null)},[c])}(e);return l?K.createElement("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${o}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:a,refX:"0",refY:"0"},K.createElement(l,{color:n,strokeWidth:i})):null},Hw=({defaultColor:t,rfId:e})=>{const n=pt(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=nh(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 K.createElement("defs",null,n.map(o=>K.createElement(p9,{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})))};Hw.displayName="MarkerDefinitions";var m9=A.memo(Hw);const g9=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}),Ww=({defaultMarkerColor:t,onlyRenderVisibleElements:e,elevateEdgesOnSelect:n,rfId:o,edgeTypes:r,noPanClassName:s,onEdgeContextMenu:i,onEdgeMouseEnter:a,onEdgeMouseMove:l,onEdgeMouseLeave:c,onEdgeClick:d,onEdgeDoubleClick:u,onReconnect:f,onReconnectStart:p,onReconnectEnd:_,reconnectRadius:g,children:m,disableKeyboardA11y:b})=>{const{edgesFocusable:x,edgesUpdatable:y,elementsSelectable:v,width:k,height:S,connectionMode:E,nodeInternals:j,onError:I}=pt(g9,nn),T=f9(e,j,n);return k?K.createElement(K.Fragment,null,T.map(({level:M,edges:L,isMaxLevel:B})=>K.createElement("svg",{key:M,style:{zIndex:M},width:k,height:S,className:"react-flow__edges react-flow__container"},B&&K.createElement(m9,{defaultColor:t,rfId:o}),K.createElement("g",null,L.map(O=>{const[z,F,V]=Vw(j.get(O.source)),[P,C,$]=Vw(j.get(O.target));if(!V||!$)return null;let N=O.type||"default";r[N]||(I==null||I("011",kO(N)),N="default");const H=r[N]||r.default,G=E===Ir.Strict?C.target:(C.target??[]).concat(C.source??[]),Z=Uw(F.source,O.sourceHandle),q=Uw(G,O.targetHandle),re=(Z==null?void 0:Z.position)||$e.Bottom,ne=(q==null?void 0:q.position)||$e.Top,oe=!!(O.focusable||x&&O.focusable===void 0),Y=O.reconnectable||O.updatable,Q=f!==void 0&&(Y||y&&Y===void 0);if(!Z||!q)return I==null||I("008",wO(Z,O)),null;const{sourceX:ce,sourceY:he,targetX:de,targetY:me}=((ie,Ce,we,ae,ve,ge)=>{const be=Bw(we,ie,Ce),Te=Bw(ge,ae,ve);return{sourceX:be.x,sourceY:be.y,targetX:Te.x,targetY:Te.y}})(z,Z,re,P,q,ne);return K.createElement(H,{key:O.id,id:O.id,className:un([O.className,s]),type:N,data:O.data,selected:!!O.selected,animated:!!O.animated,hidden:!!O.hidden,label:O.label,labelStyle:O.labelStyle,labelShowBg:O.labelShowBg,labelBgStyle:O.labelBgStyle,labelBgPadding:O.labelBgPadding,labelBgBorderRadius:O.labelBgBorderRadius,style:O.style,source:O.source,target:O.target,sourceHandleId:O.sourceHandle,targetHandleId:O.targetHandle,markerEnd:O.markerEnd,markerStart:O.markerStart,sourceX:ce,sourceY:he,targetX:de,targetY:me,sourcePosition:re,targetPosition:ne,elementsSelectable:v,onContextMenu:i,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,onClick:d,onEdgeDoubleClick:u,onReconnect:f,onReconnectStart:p,onReconnectEnd:_,reconnectRadius:g,rfId:o,ariaLabel:O.ariaLabel,isFocusable:oe,isReconnectable:Q,pathOptions:"pathOptions"in O?O.pathOptions:void 0,interactionWidth:O.interactionWidth,disableKeyboardA11y:b})})))),m):null};Ww.displayName="EdgeRenderer";var _9=A.memo(Ww);const b9=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function y9({children:t}){const e=pt(b9);return K.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:e}},t)}const x9={[$e.Left]:$e.Right,[$e.Right]:$e.Left,[$e.Top]:$e.Bottom,[$e.Bottom]:$e.Top},qw=({nodeId:t,handleType:e,style:n,type:o=er.Bezier,CustomComponent:r,connectionStatus:s})=>{var S,E,j;const{fromNode:i,handleId:a,toX:l,toY:c,connectionMode:d}=pt(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]),nn),u=(S=i==null?void 0:i[Nt])==null?void 0:S.handleBounds;let f=u==null?void 0:u[e];if(d===Ir.Loose&&(f=f||(u==null?void 0:u[e==="source"?"target":"source"])),!i||!f)return null;const p=a?f.find(I=>I.id===a):f[0],_=p?p.x+p.width/2:(i.width??0)/2,g=p?p.y+p.height/2:i.height??0,m=(((E=i.positionAbsolute)==null?void 0:E.x)??0)+_,b=(((j=i.positionAbsolute)==null?void 0:j.y)??0)+g,x=p==null?void 0:p.position,y=x?x9[x]:null;if(!x||!y)return null;if(r)return K.createElement(r,{connectionLineType:o,connectionLineStyle:n,fromNode:i,fromHandle:p,fromX:m,fromY:b,toX:l,toY:c,fromPosition:x,toPosition:y,connectionStatus:s});let v="";const k={sourceX:m,sourceY:b,sourcePosition:x,targetX:l,targetY:c,targetPosition:y};return o===er.Bezier?[v]=Qx(k):o===er.Step?[v]=Zu({...k,borderRadius:0}):o===er.SmoothStep?[v]=Zu(k):o===er.SimpleBezier?[v]=Jx(k):v=`M${m},${b} ${l},${c}`,K.createElement("path",{d:v,fill:"none",className:"react-flow__connection-path",style:n})};qw.displayName="ConnectionLine";const w9=t=>({nodeId:t.connectionNodeId,handleType:t.connectionHandleType,nodesConnectable:t.nodesConnectable,connectionStatus:t.connectionStatus,width:t.width,height:t.height});function v9({containerStyle:t,style:e,type:n,component:o}){const{nodeId:r,handleType:s,nodesConnectable:i,width:a,height:l,connectionStatus:c}=pt(w9,nn);return r&&s&&a&&i?K.createElement("svg",{style:t,width:a,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container"},K.createElement("g",{className:un(["react-flow__connection",c])},K.createElement(qw,{nodeId:r,handleType:s,style:e,type:n,CustomComponent:o,connectionStatus:c}))):null}function Gw(t,e){return A.useRef(null),Wt(),A.useMemo(()=>e(t),[t])}const Yw=({nodeTypes:t,edgeTypes:e,onMove:n,onMoveStart:o,onMoveEnd:r,onInit:s,onNodeClick:i,onEdgeClick:a,onNodeDoubleClick:l,onEdgeDoubleClick:c,onNodeMouseEnter:d,onNodeMouseMove:u,onNodeMouseLeave:f,onNodeContextMenu:p,onSelectionContextMenu:_,onSelectionStart:g,onSelectionEnd:m,connectionLineType:b,connectionLineStyle:x,connectionLineComponent:y,connectionLineContainerStyle:v,selectionKeyCode:k,selectionOnDrag:S,selectionMode:E,multiSelectionKeyCode:j,panActivationKeyCode:I,zoomActivationKeyCode:T,deleteKeyCode:M,onlyRenderVisibleElements:L,elementsSelectable:B,selectNodesOnDrag:O,defaultViewport:z,translateExtent:F,minZoom:V,maxZoom:P,preventScrolling:C,defaultMarkerColor:$,zoomOnScroll:N,zoomOnPinch:H,panOnScroll:G,panOnScrollSpeed:Z,panOnScrollMode:q,zoomOnDoubleClick:re,panOnDrag:ne,onPaneClick:oe,onPaneMouseEnter:Y,onPaneMouseMove:Q,onPaneMouseLeave:ce,onPaneScroll:he,onPaneContextMenu:de,onEdgeContextMenu:me,onEdgeMouseEnter:ie,onEdgeMouseMove:Ce,onEdgeMouseLeave:we,onReconnect:ae,onReconnectStart:ve,onReconnectEnd:ge,reconnectRadius:be,noDragClassName:Te,noWheelClassName:ze,noPanClassName:Xe,elevateEdgesOnSelect:Fe,disableKeyboardA11y:et,nodeOrigin:nt,nodeExtent:it,rfId:te})=>{const Ne=Gw(t,s9),Me=Gw(e,u9);return function(Be){const J=Bi(),pe=A.useRef(!1);A.useEffect(()=>{!pe.current&&J.viewportInitialized&&Be&&(setTimeout(()=>Be(J),1),pe.current=!0)},[Be,J.viewportInitialized])}(s),K.createElement(r9,{onPaneClick:oe,onPaneMouseEnter:Y,onPaneMouseMove:Q,onPaneMouseLeave:ce,onPaneContextMenu:de,onPaneScroll:he,deleteKeyCode:M,selectionKeyCode:k,selectionOnDrag:S,selectionMode:E,onSelectionStart:g,onSelectionEnd:m,multiSelectionKeyCode:j,panActivationKeyCode:I,zoomActivationKeyCode:T,elementsSelectable:B,onMove:n,onMoveStart:o,onMoveEnd:r,zoomOnScroll:N,zoomOnPinch:H,zoomOnDoubleClick:re,panOnScroll:G,panOnScrollSpeed:Z,panOnScrollMode:q,panOnDrag:ne,defaultViewport:z,translateExtent:F,minZoom:V,maxZoom:P,onSelectionContextMenu:_,preventScrolling:C,noDragClassName:Te,noWheelClassName:ze,noPanClassName:Xe,disableKeyboardA11y:et},K.createElement(y9,null,K.createElement(_9,{edgeTypes:Me,onEdgeClick:a,onEdgeDoubleClick:c,onlyRenderVisibleElements:L,onEdgeContextMenu:me,onEdgeMouseEnter:ie,onEdgeMouseMove:Ce,onEdgeMouseLeave:we,onReconnect:ae,onReconnectStart:ve,onReconnectEnd:ge,reconnectRadius:be,defaultMarkerColor:$,noPanClassName:Xe,elevateEdgesOnSelect:!!Fe,disableKeyboardA11y:et,rfId:te},K.createElement(v9,{style:x,type:b,component:y,containerStyle:v})),K.createElement("div",{className:"react-flow__edgelabel-renderer"}),K.createElement(a9,{nodeTypes:Ne,onNodeClick:i,onNodeDoubleClick:l,onNodeMouseEnter:d,onNodeMouseMove:u,onNodeMouseLeave:f,onNodeContextMenu:p,selectNodesOnDrag:O,onlyRenderVisibleElements:L,noPanClassName:Xe,noDragClassName:Te,disableKeyboardA11y:et,nodeOrigin:nt,nodeExtent:it,rfId:te})))};Yw.displayName="GraphView";var k9=A.memo(Yw);const mh=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],or={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:mh,nodeExtent:mh,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Ir.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},S9=()=>((t,e)=>t?Mx(t,e):Mx)((t,e)=>({...or,setNodes:n=>{const{nodeInternals:o,nodeOrigin:r,elevateNodesOnSelect:s}=e();t({nodeInternals:ch(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?ch(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 u=window.getComputedStyle(d),{m22:f}=new window.DOMMatrixReadOnly(u.transform),p=n.reduce((g,m)=>{const b=r.get(m.id);if(b!=null&&b.hidden)r.set(b.id,{...b,[Nt]:{...b[Nt],handleBounds:void 0}});else if(b){const x=Wu(m.nodeElement);!(!x.width||!x.height||b.width===x.width&&b.height===x.height&&!m.forceUpdate)&&(r.set(b.id,{...b,[Nt]:{...b[Nt],handleBounds:{source:Ow(".source",m.nodeElement,f,c),target:Ow(".target",m.nodeElement,f,c)}},...x}),g.push({id:b.id,type:"dimensions",dimensions:x}))}return g},[]);vw(r,c);const _=i||s&&!i&&kw(e,{initial:!0,...a});t({nodeInternals:new Map(r),fitViewOnInitDone:_}),(p==null?void 0:p.length)>0&&(o==null||o(p))},updateNodePositions:(n,o=!0,r=!1)=>{const{triggerNodeChanges:s}=e(),i=n.map(a=>{const l={id:a.id,type:"position",dragging:r};return o&&(l.positionAbsolute=a.positionAbsolute,l.position=a.position),l});s(i)},triggerNodeChanges:n=>{const{onNodesChange:o,nodeInternals:r,hasDefaultNodes:s,nodeOrigin:i,getNodes:a,elevateNodesOnSelect:l}=e();if(n!=null&&n.length){if(s){const c=ch(Ew(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=>nr(l,!0)):(i=hs(s(),n),a=hs(r,[])),Ll({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=>nr(l,!0)):(i=hs(r,n),a=hs(s(),[])),Ll({changedNodes:a,changedEdges:i,get:e,set:t})},unselectNodesAndEdges:({nodes:n,edges:o}={})=>{const{edges:r,getNodes:s}=e(),i=o||r;Ll({changedNodes:(n||s()).map(a=>(a.selected=!1,nr(a.id,!1))),changedEdges:i.map(a=>nr(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();Ll({changedNodes:o().filter(r=>r.selected).map(r=>nr(r.id,!1)),changedEdges:n.filter(r=>r.selected).map(r=>nr(r.id,!1)),get:e,set:t})},setNodeExtent:n=>{const{nodeInternals:o}=e();o.forEach(r=>{r.positionAbsolute=qu(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=gr.translate(o[0]+n.x,o[1]+n.y).scale(o[2]),d=[[0,0],[r,s]],u=i==null?void 0:i.constrain()(c,d,l);return i.transform(a,u),o[0]!==u.x||o[1]!==u.y||o[2]!==u.k},cancelConnection:()=>t({connectionNodeId:or.connectionNodeId,connectionHandleId:or.connectionHandleId,connectionHandleType:or.connectionHandleType,connectionStatus:or.connectionStatus,connectionStartHandle:or.connectionStartHandle,connectionEndHandle:or.connectionEndHandle}),reset:()=>t({...or})}),Object.is),gh=({children:t})=>{const e=A.useRef(null);return e.current||(e.current=S9()),K.createElement(gO,{value:e.current},t)};gh.displayName="ReactFlowProvider";const Jw=({children:t})=>A.useContext(Il)?K.createElement(K.Fragment,null,t):K.createElement(gh,null,t);Jw.displayName="ReactFlowWrapper";const C9={input:hw,default:ah,output:pw,group:lh},N9={default:Rl,straight:eh,step:Qu,smoothstep:Ol,simplebezier:Xu},j9=[0,0],E9=[15,15],I9={x:0,y:0,zoom:1},A9={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},_h=A.forwardRef(({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:s=C9,edgeTypes:i=N9,onNodeClick:a,onEdgeClick:l,onInit:c,onMove:d,onMoveStart:u,onMoveEnd:f,onConnect:p,onConnectStart:_,onConnectEnd:g,onClickConnectStart:m,onClickConnectEnd:b,onNodeMouseEnter:x,onNodeMouseMove:y,onNodeMouseLeave:v,onNodeContextMenu:k,onNodeDoubleClick:S,onNodeDragStart:E,onNodeDrag:j,onNodeDragStop:I,onNodesDelete:T,onEdgesDelete:M,onSelectionChange:L,onSelectionDragStart:B,onSelectionDrag:O,onSelectionDragStop:z,onSelectionContextMenu:F,onSelectionStart:V,onSelectionEnd:P,connectionMode:C=Ir.Strict,connectionLineType:$=er.Bezier,connectionLineStyle:N,connectionLineComponent:H,connectionLineContainerStyle:G,deleteKeyCode:Z="Backspace",selectionKeyCode:q="Shift",selectionOnDrag:re=!1,selectionMode:ne=Li.Full,panActivationKeyCode:oe="Space",multiSelectionKeyCode:Y=Tl()?"Meta":"Control",zoomActivationKeyCode:Q=Tl()?"Meta":"Control",snapToGrid:ce=!1,snapGrid:he=E9,onlyRenderVisibleElements:de=!1,selectNodesOnDrag:me=!0,nodesDraggable:ie,nodesConnectable:Ce,nodesFocusable:we,nodeOrigin:ae=j9,edgesFocusable:ve,edgesUpdatable:ge,elementsSelectable:be,defaultViewport:Te=I9,minZoom:ze=.5,maxZoom:Xe=2,translateExtent:Fe=mh,preventScrolling:et=!0,nodeExtent:nt,defaultMarkerColor:it="#b1b1b7",zoomOnScroll:te=!0,zoomOnPinch:Ne=!0,panOnScroll:Me=!1,panOnScrollSpeed:Be=.5,panOnScrollMode:J=Qo.Free,zoomOnDoubleClick:pe=!0,panOnDrag:_e=!0,onPaneClick:ue,onPaneMouseEnter:je,onPaneMouseMove:ke,onPaneMouseLeave:Ve,onPaneScroll:Ze,onPaneContextMenu:le,children:Ee,onEdgeContextMenu:Ie,onEdgeDoubleClick:Ue,onEdgeMouseEnter:We,onEdgeMouseMove:De,onEdgeMouseLeave:Ge,onEdgeUpdate:ot,onEdgeUpdateStart:Je,onEdgeUpdateEnd:rt,onReconnect:mt,onReconnectStart:yt,onReconnectEnd:Mt,reconnectRadius:xt=10,edgeUpdaterRadius:Bt=10,onNodesChange:Sn,onEdgesChange:hn,noDragClassName:rn="nodrag",noWheelClassName:Kt="nowheel",noPanClassName:Jn="nopan",fitView:ho=!1,fitViewOptions:vs,connectOnClick:ks=!0,attributionPosition:Ss,proOptions:Cs,defaultEdgeOptions:Ns,elevateNodesOnSelect:ir=!0,elevateEdgesOnSelect:js=!1,disableKeyboardA11y:Es=!1,autoPanOnConnect:Is=!0,autoPanOnNodeDrag:Pt=!0,connectionRadius:wt=20,isValidConnection:Cn,onError:Nn,style:As,id:ec,nodeDragThreshold:Wf,...qf},tc)=>{const Gf=ec||"1";return K.createElement("div",{...qf,style:{...As,...A9},ref:tc,className:un(["react-flow",r]),"data-testid":"rf__wrapper",id:ec},K.createElement(Jw,null,K.createElement(k9,{onInit:c,onMove:d,onMoveStart:u,onMoveEnd:f,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:x,onNodeMouseMove:y,onNodeMouseLeave:v,onNodeContextMenu:k,onNodeDoubleClick:S,nodeTypes:s,edgeTypes:i,connectionLineType:$,connectionLineStyle:N,connectionLineComponent:H,connectionLineContainerStyle:G,selectionKeyCode:q,selectionOnDrag:re,selectionMode:ne,deleteKeyCode:Z,multiSelectionKeyCode:Y,panActivationKeyCode:oe,zoomActivationKeyCode:Q,onlyRenderVisibleElements:de,selectNodesOnDrag:me,defaultViewport:Te,translateExtent:Fe,minZoom:ze,maxZoom:Xe,preventScrolling:et,zoomOnScroll:te,zoomOnPinch:Ne,zoomOnDoubleClick:pe,panOnScroll:Me,panOnScrollSpeed:Be,panOnScrollMode:J,panOnDrag:_e,onPaneClick:ue,onPaneMouseEnter:je,onPaneMouseMove:ke,onPaneMouseLeave:Ve,onPaneScroll:Ze,onPaneContextMenu:le,onSelectionContextMenu:F,onSelectionStart:V,onSelectionEnd:P,onEdgeContextMenu:Ie,onEdgeDoubleClick:Ue,onEdgeMouseEnter:We,onEdgeMouseMove:De,onEdgeMouseLeave:Ge,onReconnect:mt??ot,onReconnectStart:yt??Je,onReconnectEnd:Mt??rt,reconnectRadius:xt??Bt,defaultMarkerColor:it,noDragClassName:rn,noWheelClassName:Kt,noPanClassName:Jn,elevateEdgesOnSelect:js,rfId:Gf,disableKeyboardA11y:Es,nodeOrigin:ae,nodeExtent:nt}),K.createElement(zO,{nodes:t,edges:e,defaultNodes:n,defaultEdges:o,onConnect:p,onConnectStart:_,onConnectEnd:g,onClickConnectStart:m,onClickConnectEnd:b,nodesDraggable:ie,nodesConnectable:Ce,nodesFocusable:we,edgesFocusable:ve,edgesUpdatable:ge,elementsSelectable:be,elevateNodesOnSelect:ir,minZoom:ze,maxZoom:Xe,nodeExtent:nt,onNodesChange:Sn,onEdgesChange:hn,snapToGrid:ce,snapGrid:he,connectionMode:C,translateExtent:Fe,connectOnClick:ks,defaultEdgeOptions:Ns,fitView:ho,fitViewOptions:vs,onNodesDelete:T,onEdgesDelete:M,onNodeDragStart:E,onNodeDrag:j,onNodeDragStop:I,onSelectionDrag:O,onSelectionDragStart:B,onSelectionDragStop:z,noPanClassName:Jn,nodeOrigin:ae,rfId:Gf,autoPanOnConnect:Is,autoPanOnNodeDrag:Pt,onError:Nn,connectionRadius:wt,isValidConnection:Cn,nodeDragThreshold:Wf}),K.createElement(LO,{onSelectionChange:L}),Ee,K.createElement(NO,{proOptions:Cs,position:Ss}),K.createElement($O,{rfId:Gf,disableKeyboardA11y:Es})))});function Kw(t){return e=>{const[n,o]=A.useState(e),r=A.useCallback(s=>o(i=>t(s,i)),[]);return[n,o,r]}}_h.displayName="ReactFlow";const Xw=Kw(Ew),Zw=Kw(function(t,e){return jw(t,e)});function T9(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},K.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function M9(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},K.createElement("path",{d:"M0 0h32v4.2H0z"}))}function O9(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},K.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function D9(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},K.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function R9(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},K.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const ms=({children:t,className:e,...n})=>K.createElement("button",{type:"button",className:un(["react-flow__controls-button",e]),...n},t);ms.displayName="ControlButton";const P9=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom}),Qw=({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:u="bottom-left"})=>{const f=Wt(),[p,_]=A.useState(!1),{isInteractive:g,minZoomReached:m,maxZoomReached:b}=pt(P9,nn),{zoomIn:x,zoomOut:y,fitView:v}=Bi();return A.useEffect(()=>{_(!0)},[]),p?K.createElement(Al,{className:un(["react-flow__controls",c]),position:u,style:t,"data-testid":"rf__controls"},e&&K.createElement(K.Fragment,null,K.createElement(ms,{onClick:()=>{x(),s==null||s()},className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:b},K.createElement(T9,null)),K.createElement(ms,{onClick:()=>{y(),i==null||i()},className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:m},K.createElement(M9,null))),n&&K.createElement(ms,{className:"react-flow__controls-fitview",onClick:()=>{v(r),a==null||a()},title:"fit view","aria-label":"fit view"},K.createElement(O9,null)),o&&K.createElement(ms,{className:"react-flow__controls-interactive",onClick:()=>{f.setState({nodesDraggable:!g,nodesConnectable:!g,elementsSelectable:!g}),l==null||l(!g)},title:"toggle interactivity","aria-label":"toggle interactivity"},g?K.createElement(R9,null):K.createElement(D9,null)),d):null};Qw.displayName="Controls";var Pn,L9=A.memo(Qw);function F9({color:t,dimensions:e,lineWidth:n}){return K.createElement("path",{stroke:t,strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})}function z9({color:t,radius:e}){return K.createElement("circle",{cx:e,cy:e,r:e,fill:t})}(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(Pn||(Pn={}));const B9={[Pn.Dots]:"#91919a",[Pn.Lines]:"#eee",[Pn.Cross]:"#e2e2e2"},U9={[Pn.Dots]:1,[Pn.Lines]:1,[Pn.Cross]:6},V9=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function ev({id:t,variant:e=Pn.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:u}=pt(V9,nn),f=i||B9[e],p=o||U9[e],_=e===Pn.Dots,g=e===Pn.Cross,m=Array.isArray(n)?n:[n,n],b=[m[0]*d[2]||1,m[1]*d[2]||1],x=p*d[2],y=g?[x,x]:b,v=_?[x/s,x/s]:[y[0]/s,y[1]/s];return K.createElement("svg",{className:un(["react-flow__background",l]),style:{...a,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:c,"data-testid":"rf__background"},K.createElement("pattern",{id:u+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]})`},_?K.createElement(z9,{color:f,radius:x/s}):K.createElement(F9,{dimensions:y,color:f,lineWidth:r})),K.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${u+t})`}))}ev.displayName="Background";var $9=A.memo(ev);function bh(t){return Math.min(11*t+35,200)}const tv=K.createContext("LR"),nv=A.memo(t=>{const e=X.c(51),{data:n,selected:o}=t,r=He(n.atom),s=Fc().inOrderIds.indexOf(r.id),i=o?"var(--gray-9)":"var(--gray-3)",a=pt(H9),l=A.useContext(tv);let c,d,u,f,p;if(e[0]!==r.code||e[1]!==i||e[2]!==l||e[3]!==o){const M=r.code.split(`
125
+ `).length,L=l==="LR"?$e.Left:$e.Top;let B;e[8]!==i?(B={background:i},e[8]=i,e[9]=B):B=e[9],e[10]!==L||e[11]!==B?(u=h.jsx(tr,{type:"target",id:"inputs",position:L,style:B}),e[10]=L,e[11]=B,e[12]=u):u=e[12];const O=l==="LR"?$e.Left:$e.Top;let z;e[13]!==i?(z={background:i},e[13]=i,e[14]=z):z=e[14],e[15]!==O||e[16]!==z?(f=h.jsx(tr,{type:"source",id:"inputs",position:O,style:z}),e[15]=O,e[16]=z,e[17]=f):f=e[17];const F=o&&"border-primary";e[18]!==F?(d=Oe("flex flex-col bg-card border border-input/50 rounded-md mx-[2px] overflow-hidden",F),e[18]=F,e[19]=d):d=e[19],c=bh(M),e[0]=r.code,e[1]=i,e[2]=l,e[3]=o,e[4]=c,e[5]=d,e[6]=u,e[7]=f}else c=e[4],d=e[5],u=e[6],f=e[7];var _;let g;e[20]!==n.forceWidth||e[21]!==a?(p=n.forceWidth||(_=a,Math.min(Math.max(_-100,100),400)),e[20]=n.forceWidth,e[21]=a,e[22]=p):p=e[22],e[23]!==c||e[24]!==p?(g={height:c,width:p},e[23]=c,e[24]=p,e[25]=g):g=e[25];const m=eV(r.name,s);let b,x,y;e[26]!==m?(b=h.jsx("div",{className:"text-muted-foreground font-semibold text-xs py-1 px-2 bg-muted border-b",children:m}),e[26]=m,e[27]=b):b=e[27],e[28]!==r.code?(x=h.jsx($$,{code:r.code}),e[28]=r.code,e[29]=x):x=e[29],e[30]!==d||e[31]!==g||e[32]!==b||e[33]!==x?(y=h.jsxs("div",{className:d,style:g,children:[b,x]}),e[30]=d,e[31]=g,e[32]=b,e[33]=x,e[34]=y):y=e[34];const v=l==="LR"?$e.Right:$e.Bottom;let k,S;e[35]!==i?(k={background:i},e[35]=i,e[36]=k):k=e[36],e[37]!==v||e[38]!==k?(S=h.jsx(tr,{type:"source",id:"outputs",position:v,style:k}),e[37]=v,e[38]=k,e[39]=S):S=e[39];const E=l==="LR"?$e.Right:$e.Bottom;let j,I,T;return e[40]!==i?(j={background:i},e[40]=i,e[41]=j):j=e[41],e[42]!==E||e[43]!==j?(I=h.jsx(tr,{type:"target",id:"outputs",position:E,style:j}),e[42]=E,e[43]=j,e[44]=I):I=e[44],e[45]!==y||e[46]!==S||e[47]!==I||e[48]!==u||e[49]!==f?(T=h.jsxs("div",{children:[u,f,y,S,I]}),e[45]=y,e[46]=S,e[47]=I,e[48]=u,e[49]=f,e[50]=T):T=e[50],T},(t,e)=>["data","selected","id"].every(n=>t[n]===e[n]));nv.displayName="CustomNode";const ov={custom:nv};function H9(t){const{width:e}=t;return e}const rv=t=>{const e=X.c(18),{maxCount:n,cellIds:o,onClick:r,skipScroll:s}=t,i=Fc();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 u;e[8]!==i?(u=(_,g)=>i.inOrderIds.indexOf(_)-i.inOrderIds.indexOf(g),e[8]=i,e[9]=u):u=e[9];const f=[...o].sort(u);if(o.length===0){let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=h.jsx("div",{className:"text-muted-foreground",children:"--"}),e[10]=_):_=e[10],c=_;break e}let p;e[11]!==o.length||e[12]!==r||e[13]!==s?(p=(_,g)=>h.jsxs("span",{className:"truncate",children:[h.jsx(pr,{variant:"focus",cellId:_,skipScroll:s,className:"whitespace-nowrap",onClick:r?()=>r(_):void 0},_),g<o.length-1&&", "]},_),e[11]=o.length,e[12]=r,e[13]=s,e[14]=p):p=e[14],a=f.slice(0,n).map(p),l=o.length>n&&h.jsxs(Pr,{children:[h.jsx(Ys,{asChild:!0,children:h.jsxs("span",{className:"whitespace-nowrap text-muted-foreground text-xs hover:underline cursor-pointer",children:["+",o.length-n," more"]})}),h.jsx(Vs,{className:"w-auto",children:h.jsx("div",{className:"flex flex-col gap-1 py-1",children:f.slice(n).map(_=>h.jsx(pr,{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=h.jsxs(h.Fragment,{children:[a,l]}),e[15]=a,e[16]=l,e[17]=d):d=e[17],d)},yh=t=>{const e=X.c(15);let n,o,r,s;e[0]!==t?({name:o,declaredBy:n,onClick:r,...s}=t,e[0]=t,e[1]=n,e[2]=o,e[3]=r,e[4]=s):(n=e[1],o=e[2],r=e[3],s=e[4]);const i=n.length>1?"destructive":"outline";let a,l,c;return e[5]!==o||e[6]!==r?(a=async d=>{r?r(d):(await yn(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=h.jsx(L4,{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=h.jsx("div",{className:"max-w-[130px]",...s,children:l}),e[12]=s,e[13]=l,e[14]=c):c=e[14],c},xh=A.memo(t=>{const e=X.c(38),{onChange:n,view:o,settings:r,onSettingsChange:s}=t;let i;e[0]!==s||e[1]!==r?(i=(O,z)=>{s({...r,[O]:z})},e[0]=s,e[1]=r,e[2]=i):i=e[2];const a=i;let l,c,d,u,f,p;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx(Ys,{asChild:!0,children:h.jsx(Pe,{variant:"text",size:"xs",children:h.jsx(J3,{className:"w-4 h-4"})})}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx("div",{className:"font-semibold pb-4",children:"Settings"}),e[4]=c):c=e[4],e[5]!==a?(d=O=>a("hidePureMarkdown",!!O),e[5]=a,e[6]=d):d=e[6],e[7]!==r.hidePureMarkdown||e[8]!==d?(u=h.jsx(y4,{"data-testid":"hide-pure-markdown-checkbox",id:"hide-pure-markdown",checked:r.hidePureMarkdown,onCheckedChange:d}),e[7]=r.hidePureMarkdown,e[8]=d,e[9]=u):u=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(f=h.jsx(Rr,{htmlFor:"hide-pure-markdown",children:"Hide pure markdown"}),e[10]=f):f=e[10],e[11]!==u?(p=h.jsxs(Pr,{children:[l,h.jsxs(Vs,{className:"w-auto p-2 text-muted-foreground",children:[c,h.jsxs("div",{className:"flex items-center gap-2",children:[u,f]})]})]}),e[11]=u,e[12]=p):p=e[12];const _=p,g=o==="_minimap_";let m,b,x;e[13]!==n?(m=()=>n("_minimap_"),e[13]=n,e[14]=m):m=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(b=h.jsx(Pm,{className:"w-4 h-4 mr-1"}),e[15]=b):b=e[15],e[16]!==g||e[17]!==m?(x=h.jsxs(Pe,{variant:"outline",className:"bg-background","aria-selected":g,size:"xs",onClick:m,children:[b,"Mini Map"]}),e[16]=g,e[17]=m,e[18]=x):x=e[18];const y=o==="TB";let v,k,S;e[19]!==n?(v=()=>n("TB"),e[19]=n,e[20]=v):v=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(k=h.jsx(Ca,{className:"w-4 h-4 mr-1"}),e[21]=k):k=e[21],e[22]!==y||e[23]!==v?(S=h.jsxs(Pe,{variant:"outline",className:"bg-background","aria-selected":y,size:"xs",onClick:v,children:[k,"Vertical Tree"]}),e[22]=y,e[23]=v,e[24]=S):S=e[24];const E=o==="LR";let j,I,T,M;e[25]!==n?(j=()=>n("LR"),e[25]=n,e[26]=j):j=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(I=h.jsx(Ca,{className:"w-4 h-4 mr-1 transform -rotate-90"}),e[27]=I):I=e[27],e[28]!==E||e[29]!==j?(T=h.jsxs(Pe,{variant:"outline",className:"bg-background","aria-selected":E,size:"xs",onClick:j,children:[I," ","Horizontal Tree"]}),e[28]=E,e[29]=j,e[30]=T):T=e[30],e[31]!==x||e[32]!==S||e[33]!==T?(M=h.jsxs("div",{className:"flex gap-2",children:[x,S,T]}),e[31]=x,e[32]=S,e[33]=T,e[34]=M):M=e[34];const L=o!=="_minimap_"&&_;let B;return e[35]!==M||e[36]!==L?(B=h.jsxs(Al,{position:"top-right",className:"flex flex-col items-end gap-2",children:[M,L]}),e[35]=M,e[36]=L,e[37]=B):B=e[37],B});xh.displayName="GraphToolbar";const zl=A.memo(t=>{const e=X.c(11),{selection:n,variables:o,onClearSelection:r}=t;if(!n)return null;const s=W9;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(p=>p.usedBy.includes(n.id)),u=Object.values(o).filter(p=>p.declaredBy.includes(n.id)),f=(p,_)=>h.jsxs(h.Fragment,{children:[p.length===0&&h.jsx("div",{className:"text-muted-foreground text-sm text-center",children:"--"}),h.jsx("div",{className:"grid grid-cols-5 gap-3 items-center text-sm py-1 flex-1 empty:hidden",children:p.map(g=>h.jsxs(K.Fragment,{children:[h.jsx(yh,{declaredBy:g.declaredBy,name:g.name}),h.jsxs("div",{className:"truncate col-span-2",title:g.value??"",children:[g.value,h.jsxs("span",{className:"ml-1 truncate text-foreground/60 font-mono",children:["(",g.dataType,")"]})]}),h.jsx("div",{className:"truncate col-span-2 gap-1 items-center",children:h.jsx(rv,{skipScroll:!0,onClick:()=>s(_==="in"?g.declaredBy[0]:g.usedBy[0],g.name),maxCount:3,cellIds:g.usedBy})})]},g.name))})]});return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[h.jsx(uc,{className:"w-5 h-5"}),h.jsx(pr,{cellId:n.id}),h.jsx("div",{className:"flex-1"}),h.jsx(g0,{cellId:n.id,children:h.jsx(Pe,{variant:"ghost",size:"icon",children:h.jsx(Gc,{className:"w-4 h-4"})})}),h.jsx(Pe,{variant:"text",size:"icon",onClick:()=>{r()},children:h.jsx(go,{className:"w-4 h-4"})})]}),h.jsxs("div",{className:"text-sm flex flex-col py-3 pl-2 pr-4 flex-1 justify-center",children:[h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[h.jsx(mn,{className:"w-4 h-4"}),"Outputs"]}),f(u,"out")]}),h.jsx("hr",{className:"border-divider my-3"}),h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[h.jsx(rm,{className:"w-4 h-4"}),"Inputs"]}),f(d,"in")]})]})]})}if(n.type==="edge"){const d=Object.values(o).filter(u=>u.declaredBy.includes(n.source)&&u.usedBy.includes(n.target));return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[h.jsx(ja,{className:"w-4 h-4"}),h.jsx(pr,{cellId:n.source}),h.jsx(Hc,{className:"w-4 h-4"}),h.jsx(pr,{cellId:n.target})]}),h.jsx("div",{className:"grid grid-cols-4 gap-3 max-w-[350px] items-center text-sm p-3 flex-1",children:d.map(u=>h.jsxs(K.Fragment,{children:[h.jsx(yh,{declaredBy:u.declaredBy,name:u.name,onClick:()=>{s(u.declaredBy[0],u.name)}}),h.jsx("div",{className:"truncate text-foreground/60 font-mono",children:u.dataType}),h.jsx("div",{className:"truncate col-span-2",title:u.value??"",children:u.value})]},u.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=h.jsx(Al,{position:"bottom-left",className:"max-h-[90%] flex flex-col w-[calc(100%-5rem)]",children:h.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 W9(t,e){const n=rc(t);n&&Hp(n,e)}function sv(){const t=X.c(7),e=Bi(),n=pt(G9),o=pt(q9);let r;t[0]!==e?(r=()=>{e.fitView({duration:100})},t[0]=e,t[1]=r):r=t[1];const s=tV(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 q9(t){const{height:e}=t;return e}function G9(t){const{width:e}=t;return e}zl.displayName="GraphSelectionPanel";const iv=new class{createEdge(t,e,n){return{type:"smoothstep",pathOptions:{offset:20,borderRadius:100},data:{direction:n},markerEnd:{type:as.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:bh(ut.get(e).code.trim().split(`
126
+ `).length),position:{x:0,y:n+20}}}createElements(t,e,n,o){let r=0;const s=[],i=[];for(const[l,c]of $p.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 u of c)for(const f of d){const p=`${u}-${f}`;a.has(p)||(a.add(p),i.push(this.createEdge(u,f,"inputs"),this.createEdge(u,f,"outputs")))}}return{nodes:s,edges:i}}},Y9=t=>{const e=X.c(37),{cellIds:n,variables:o,cellAtoms:r,children:s}=t;let i;e[0]!==r||e[1]!==n||e[2]!==o?(i=iv.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,u]=Zw(c),[f,p]=Xw(a),[_,g]=A.useState(),[m,b]=A.useState(),x=A.useRef(!1);sv();const y=pt(J9);let v;e[5]!==u||e[6]!==p?(v=C=>{p(C.nodes),u([])},e[5]=u,e[6]=p,e[7]=v):v=e[7];const k=Qe(v);let S,E,j,I;e[8]!==r||e[9]!==n||e[10]!==k||e[11]!==o?(S=()=>{x.current?k(iv.createElements(n,r,o,!1)):x.current=!0},E=[n,o,r,k],e[8]=r,e[9]=n,e[10]=k,e[11]=o,e[12]=S,e[13]=E):(S=e[12],E=e[13]),A.useEffect(S,E),e[14]!==l||e[15]!==_||e[16]!==u?(j=()=>{if(_){const C=l.filter($=>{const{source:N,target:H,data:G}=$;return N===_&&G.direction==="outputs"||H===_&&G.direction==="inputs"});u(C)}},I=[_,u,l],e[14]=l,e[15]=_,e[16]=u,e[17]=j,e[18]=I):(j=e[17],I=e[18]),A.useEffect(j,I);const T=function(C,$){const N=X.c(17);let H,G;if(N[0]!==$||N[1]!==C){let Q;N[3]!==$?(Q=(ce,he)=>{const{position:de}=he;return Math.min(ce,de.y-$/2-10)},N[3]=$,N[4]=Q):Q=N[4],G=C.reduce(Q,Number.POSITIVE_INFINITY),N[0]=$,N[1]=C,N[2]=G}else G=N[2];const Z=G;let q;if(N[5]!==$||N[6]!==C){let Q;N[8]!==$?(Q=(ce,he)=>{const{position:de}=he;return Math.max(ce,de.y+$/2+10)},N[8]=$,N[9]=Q):Q=N[9],q=C.reduce(Q,Number.NEGATIVE_INFINITY),N[5]=$,N[6]=C,N[7]=q}else q=N[7];const re=q;let ne,oe,Y;return N[10]!==Z?(ne=[Number.NEGATIVE_INFINITY,Z],N[10]=Z,N[11]=ne):ne=N[11],N[12]!==re?(oe=[Number.POSITIVE_INFINITY,re],N[12]=re,N[13]=oe):oe=N[13],N[14]!==ne||N[15]!==oe?(Y=[ne,oe],N[14]=ne,N[15]=oe,N[16]=Y):Y=N[16],H=Y,H}(f,y);let M;e[19]===Symbol.for("react.memo_cache_sentinel")?(M=()=>{g(void 0),b(void 0)},e[19]=M):M=e[19];const L=M;let B;e[20]!==d||e[21]!==m||e[22]!==_||e[23]!==o?(B=()=>m?h.jsx(zl,{selection:{type:"edge",source:m.source,target:m.target},onClearSelection:L,variables:o,edges:d}):_?h.jsx(zl,{selection:{type:"node",id:_},variables:o,edges:d,onClearSelection:L}):null,e[20]=d,e[21]=m,e[22]=_,e[23]=o,e[24]=B):B=e[24];const O=B;let z,F,V,P;return e[25]!==u?(z=(C,$)=>{const N=$.id;g(N),b(void 0),u([])},e[25]=u,e[26]=z):z=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(F=(C,$)=>{b($)},e[27]=F):F=e[27],e[28]!==O?(V=O(),e[28]=O,e[29]=V):V=e[29],e[30]!==s||e[31]!==d||e[32]!==f||e[33]!==z||e[34]!==V||e[35]!==T?(P=h.jsxs(_h,{nodes:f,edges:d,nodeTypes:ov,translateExtent:T,onNodeClick:z,onNodeDoubleClick:K9,onEdgeClick:F,snapToGrid:!0,fitView:!0,elementsSelectable:!0,minZoom:1,maxZoom:1,draggable:!1,panOnScrollMode:Qo.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]=z,e[34]=V,e[35]=T,e[36]=P):P=e[36],P};function J9(t){const{height:e}=t;return e}function K9(t,e){F4(e.id,"focus")}var wh,av,lv,cv,dv,uv,vh,hv,kh,fv,Sh,pv,Ch,mv,Nh,gv,jh,_v,Eh,bv,Ih,yv,Ah,xv,Th,wv,Mh,vv,Oh,kv,Dh,Sv,Rh,Cv,Nv,jv,Ev,Iv,Av,Tv,Ph,Mv,Lh,Ov,Fh,Dv,zh,Rv,Bh,Pv,Uh,Lv,Vh,Fv,$h,zv,Hh,Bv,Wh,Uv,qh,Vv,Gh,$v,Yh,Hv,Jh,Wv,qv,Gv,Yv,Jv,Kv,Xv,Kh,Zv,Xh,Qv,e2,t2,Zh,n2,Qh,o2,ef,r2,tf,s2,nf,i2,a2,l2,c2,d2;function of(){if(av)return wh;av=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 u=c;c=d,d=u}return c+""+d+""+(l===void 0?"\0":l)}function r(s,i){return o(s,i.v,i.w,i.name)}return wh=class{constructor(s){ee(this,"_isDirected",!0);ee(this,"_isMultigraph",!1);ee(this,"_isCompound",!1);ee(this,"_label");ee(this,"_defaultNodeLabelFn",()=>{});ee(this,"_defaultEdgeLabelFn",()=>{});ee(this,"_nodes",{});ee(this,"_in",{});ee(this,"_preds",{});ee(this,"_out",{});ee(this,"_sucs",{});ee(this,"_edgeObjs",{});ee(this,"_edgeLabels",{});ee(this,"_nodeCount",0);ee(this,"_edgeCount",0);ee(this,"_parent");ee(this,"_children");s&&(this._isDirected=!Object.hasOwn(s,"directed")||s.directed,this._isMultigraph=!!Object.hasOwn(s,"multigraph")&&s.multigraph,this._isCompound=!!Object.hasOwn(s,"compound")&&s.compound),this._isCompound&&(this._parent={},this._children={},this._children[t]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(s){return this._label=s,this}graph(){return this._label}setDefaultNodeLabel(s){return this._defaultNodeLabelFn=s,typeof s!="function"&&(this._defaultNodeLabelFn=()=>s),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var s=this;return this.nodes().filter(i=>Object.keys(s._in[i]).length===0)}sinks(){var s=this;return this.nodes().filter(i=>Object.keys(s._out[i]).length===0)}setNodes(s,i){var a=arguments,l=this;return s.forEach(function(c){a.length>1?l.setNode(c,i):l.setNode(c)}),this}setNode(s,i){return Object.hasOwn(this._nodes,s)?(arguments.length>1&&(this._nodes[s]=i),this):(this._nodes[s]=arguments.length>1?i:this._defaultNodeLabelFn(s),this._isCompound&&(this._parent[s]=t,this._children[s]={},this._children[t][s]=!0),this._in[s]={},this._preds[s]={},this._out[s]={},this._sucs[s]={},++this._nodeCount,this)}node(s){return this._nodes[s]}hasNode(s){return Object.hasOwn(this._nodes,s)}removeNode(s){var i=this;if(Object.hasOwn(this._nodes,s)){var a=l=>i.removeEdge(i._edgeObjs[l]);delete this._nodes[s],this._isCompound&&(this._removeFromParentsChildList(s),delete this._parent[s],this.children(s).forEach(function(l){i.setParent(l)}),delete this._children[s]),Object.keys(this._in[s]).forEach(a),delete this._in[s],delete this._preds[s],Object.keys(this._out[s]).forEach(a),delete this._out[s],delete this._sucs[s],--this._nodeCount}return this}setParent(s,i){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(i===void 0)i=t;else{for(var a=i+="";a!==void 0;a=this.parent(a))if(a===s)throw new Error("Setting "+i+" as parent of "+s+" would create a cycle");this.setNode(i)}return this.setNode(s),this._removeFromParentsChildList(s),this._parent[s]=i,this._children[i][s]=!0,this}_removeFromParentsChildList(s){delete this._children[this._parent[s]][s]}parent(s){if(this._isCompound){var i=this._parent[s];if(i!==t)return i}}children(s=t){if(this._isCompound){var i=this._children[s];if(i)return Object.keys(i)}else{if(s===t)return this.nodes();if(this.hasNode(s))return[]}}predecessors(s){var i=this._preds[s];if(i)return Object.keys(i)}successors(s){var i=this._sucs[s];if(i)return Object.keys(i)}neighbors(s){var i=this.predecessors(s);if(i){const l=new Set(i);for(var a of this.successors(s))l.add(a);return Array.from(l.values())}}isLeaf(s){return(this.isDirected()?this.successors(s):this.neighbors(s)).length===0}filterNodes(s){var i=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});i.setGraph(this.graph());var a=this;Object.entries(this._nodes).forEach(function([d,u]){s(d)&&i.setNode(d,u)}),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 u=a.parent(d);return u===void 0||i.hasNode(u)?(l[d]=u,u):u in l?l[u]:c(u)}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 u=o(this._isDirected,s,i,a);if(Object.hasOwn(this._edgeLabels,u))return c&&(this._edgeLabels[u]=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[u]=c?l:this._defaultEdgeLabelFn(s,i,a);var f=function(p,_,g,m){var b=""+_,x=""+g;if(!p&&b>x){var y=b;b=x,x=y}var v={v:b,w:x};return m&&(v.name=m),v}(this._isDirected,s,i,a);return s=f.v,i=f.w,Object.freeze(f),this._edgeObjs[u]=f,e(this._preds[i],s),e(this._sucs[s],i),this._in[i][u]=f,this._out[s][u]=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))}},wh}function X9(){return uv?dv:(uv=1,dv={Graph:of(),version:cv?lv:(cv=1,lv="2.2.4")})}function Z9(){if(hv)return vh;hv=1;var t=of();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 vh={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}},vh}function Q9(){return fv||(fv=1,kh=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}),kh}function u2(){return pv?Sh:(pv=1,Sh=class{constructor(){ee(this,"_arr",[]);ee(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(t){return t.key})}has(t){return Object.hasOwn(this._keyIndices,t)}priority(t){var e=this._keyIndices[t];if(e!==void 0)return this._arr[e].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(t,e){var n=this._keyIndices;if(t=String(t),!Object.hasOwn(n,t)){var o=this._arr,r=o.length;return n[t]=r,o.push({key:t,priority:e}),this._decrease(r),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key}decrease(t,e){var n=this._keyIndices[t];if(e>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[n].priority+" New: "+e);this._arr[n].priority=e,this._decrease(n)}_heapify(t){var e=this._arr,n=2*t,o=n+1,r=t;n<e.length&&(r=e[n].priority<e[r].priority?n:r,o<e.length&&(r=e[o].priority<e[r].priority?o:r),r!==t&&(this._swap(t,r),this._heapify(r)))}_decrease(t){for(var e,n=this._arr,o=n[t].priority;t!==0&&!(n[e=t>>1].priority<o);)this._swap(t,e),t=e}_swap(t,e){var n=this._arr,o=this._keyIndices,r=n[t],s=n[e];n[t]=s,n[e]=r,o[s.key]=t,o[r.key]=e}},Sh)}function h2(){if(mv)return Ch;mv=1;var t=u2();Ch=function(n,o,r,s){return function(i,a,l,c){var d,u,f={},p=new t,_=function(g){var m=g.v!==d?g.v:g.w,b=f[m],x=l(g),y=u.distance+x;if(x<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+g+" Weight: "+x);y<b.distance&&(b.distance=y,b.predecessor=d,p.decrease(m,y))};for(i.nodes().forEach(function(g){var m=g===a?0:Number.POSITIVE_INFINITY;f[g]={distance:m},p.add(g,m)});p.size()>0&&(d=p.removeMin(),(u=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 Ch}function eD(){if(gv)return Nh;gv=1;var t=h2();return Nh=function(e,n,o){return e.nodes().reduce(function(r,s){return r[s]=t(e,s,n,o),r},{})},Nh}function f2(){return _v||(_v=1,jh=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}),jh}function tD(){if(bv)return Eh;bv=1;var t=f2();return Eh=function(e){return t(e).filter(function(n){return n.length>1||n.length===1&&e.hasEdge(n[0],n[0])})},Eh}function nD(){if(yv)return Ih;yv=1,Ih=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 u=d.v===c?d.w:d.v,f=s(d);a[c][u]={distance:f,predecessor:c}})}),l.forEach(function(c){var d=a[c];l.forEach(function(u){var f=a[u];l.forEach(function(p){var _=f[c],g=d[p],m=f[p],b=_.distance+g.distance;b<m.distance&&(m.distance=b,m.predecessor=g.predecessor)})})}),a}(e,n||t,o||function(r){return e.outEdges(r)})};var t=()=>1;return Ih}function p2(){if(xv)return Ah;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}xv=1;class e extends Error{constructor(){super(...arguments)}}return Ah=t,t.CycleException=e,Ah}function oD(){if(wv)return Th;wv=1;var t=p2();return Th=function(e){try{t(e)}catch(n){if(n instanceof t.CycleException)return!1;throw n}return!0},Th}function m2(){if(vv)return Mh;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 vv=1,Mh=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},Mh}function rD(){if(kv)return Oh;kv=1;var t=m2();return Oh=function(e,n){return t(e,n,"post")},Oh}function sD(){if(Sv)return Dh;Sv=1;var t=m2();return Dh=function(e,n){return t(e,n,"pre")},Dh}function iD(){if(Cv)return Rh;Cv=1;var t=of(),e=u2();return Rh=function(n,o){var r,s=new t,i={},a=new e;function l(d){var u=d.v===r?d.w:d.v,f=a.priority(u);if(f!==void 0){var p=o(d);p<f&&(i[u]=r,a.decrease(u,p))}}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},Rh}function Yn(){if(Iv)return Ev;Iv=1;var t=X9();return Ev={Graph:t.Graph,json:Z9(),alg:jv?Nv:(jv=1,Nv={components:Q9(),dijkstra:h2(),dijkstraAll:eD(),findCycles:tD(),floydWarshall:nD(),isAcyclic:oD(),postorder:rD(),preorder:sD(),prim:iD(),tarjan:f2(),topsort:p2()}),version:t.version}}function aD(){if(Mv)return Ph;Mv=1;let t=Yn().Graph,e=function(){if(Tv)return Av;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 Tv=1,Av=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(", ")+"]"}}}();Ph=function(s,i){if(s.nodeCount()<=1)return[];let a=function(l,c){let d=new t,u=0,f=0;l.nodes().forEach(g=>{d.setNode(g,{v:g,in:0,out:0})}),l.edges().forEach(g=>{let m=d.edge(g.v,g.w)||0,b=c(g),x=m+b;d.setEdge(g.v,g.w,x),f=Math.max(f,d.node(g.v).out+=b),u=Math.max(u,d.node(g.w).in+=b)});let p=function(g){const m=[];for(let b=0;b<g;b++)m.push(b);return m}(f+u+3).map(()=>new e),_=u+1;return d.nodes().forEach(g=>{r(p,_,d.node(g))}),{graph:d,buckets:p,zeroIdx:_}}(s,i||n);return function(l,c,d){let u,f=[],p=c[c.length-1],_=c[0];for(;l.nodeCount();){for(;u=_.dequeue();)o(l,c,d,u);for(;u=p.dequeue();)o(l,c,d,u);if(l.nodeCount()){for(let g=c.length-2;g>0;--g)if(u=c[g].dequeue(),u){f=f.concat(o(l,c,d,u,!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(u=>{let f=s.edge(u),p=s.node(u.v);c&&d.push({v:u.v,w:u.w}),p.out-=f,r(i,a,p)}),s.outEdges(l.v).forEach(u=>{let f=s.edge(u),p=u.w,_=s.node(p);_.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 Ph}function Dt(){if(Ov)return Lh;Ov=1;let t=Yn().Graph;function e(c,d,u,f){let p;do p=i(f);while(c.hasNode(p));return u.dummy=d,c.setNode(p,u),p}Lh={addBorderNode:function(c,d,u,f){let p={width:0,height:0};return arguments.length>=4&&(p.rank=u,p.order=f),e(c,"border",p,d)},addDummyNode:e,applyWithChunking:o,asNonCompoundGraph:function(c){let d=new t({multigraph:c.isMultigraph()}).setGraph(c.graph());return c.nodes().forEach(u=>{c.children(u).length||d.setNode(u,c.node(u))}),c.edges().forEach(u=>{d.setEdge(u,c.edge(u))}),d},buildLayerMatrix:function(c){let d=a(r(c)+1).map(()=>[]);return c.nodes().forEach(u=>{let f=c.node(u),p=f.rank;p!==void 0&&(d[p][f.order]=u)}),d},intersectRect:function(c,d){let u,f,p=c.x,_=c.y,g=d.x-p,m=d.y-_,b=c.width/2,x=c.height/2;if(!g&&!m)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(m)*b>Math.abs(g)*x?(m<0&&(x=-x),u=x*g/m,f=x):(g<0&&(b=-b),u=b,f=b*m/g),{x:p+u,y:_+f}},mapValues:function(c,d){let u=d;return typeof d=="string"&&(u=f=>f[d]),Object.entries(c).reduce((f,[p,_])=>(f[p]=u(_,p),f),{})},maxRank:r,normalizeRanks:function(c){let d=c.nodes().map(f=>{let p=c.node(f).rank;return p===void 0?Number.MAX_VALUE:p}),u=o(Math.min,d);c.nodes().forEach(f=>{let p=c.node(f);Object.hasOwn(p,"rank")&&(p.rank-=u)})},notime:function(c,d){return d()},partition:function(c,d){let u={lhs:[],rhs:[]};return c.forEach(f=>{d(f)?u.lhs.push(f):u.rhs.push(f)}),u},pick:function(c,d){const u={};for(const f of d)c[f]!==void 0&&(u[f]=c[f]);return u},predecessorWeights:function(c){let d=c.nodes().map(u=>{let f={};return c.inEdges(u).forEach(p=>{f[p.v]=(f[p.v]||0)+c.edge(p).weight}),f});return l(c.nodes(),d)},range:a,removeEmptyRanks:function(c){let d=c.nodes().map(g=>c.node(g).rank),u=o(Math.min,d),f=[];c.nodes().forEach(g=>{let m=c.node(g).rank-u;f[m]||(f[m]=[]),f[m].push(g)});let p=0,_=c.graph().nodeRankFactor;Array.from(f).forEach((g,m)=>{g===void 0&&m%_!=0?--p:g!==void 0&&p&&g.forEach(b=>c.node(b).rank+=p)})},simplify:function(c){let d=new t().setGraph(c.graph());return c.nodes().forEach(u=>d.setNode(u,c.node(u))),c.edges().forEach(u=>{let f=d.edge(u.v,u.w)||{weight:0,minlen:1},p=c.edge(u);d.setEdge(u.v,u.w,{weight:f.weight+p.weight,minlen:Math.max(f.minlen,p.minlen)})}),d},successorWeights:function(c){let d=c.nodes().map(u=>{let f={};return c.outEdges(u).forEach(p=>{f[p.w]=(f[p.w]||0)+c.edge(p).weight}),f});return l(c.nodes(),d)},time:function(c,d){let u=Date.now();try{return d()}finally{console.log(c+" time: "+(Date.now()-u)+"ms")}},uniqueId:i,zipObject:l};const n=65535;function o(c,d){if(d.length>n){const u=function(f,p=n){const _=[];for(let g=0;g<f.length;g+=p){const m=f.slice(g,g+p);_.push(m)}return _}(d);return c.apply(null,u.map(f=>c.apply(null,f)))}return c.apply(null,d)}function r(c){const d=c.nodes().map(u=>{let f=c.node(u).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,u=1){d==null&&(d=c,c=0);let f=_=>_<d;u<0&&(f=_=>d<_);const p=[];for(let _=c;f(_);_+=u)p.push(_);return p}function l(c,d){return c.reduce((u,f,p)=>(u[f]=d[p],u),{})}return Lh}function lD(){if(Dv)return Fh;Dv=1;let t=aD(),e=Dt().uniqueId;return Fh={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)}})}},Fh}function cD(){if(Rv)return zh;Rv=1;let t=Dt();return zh={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,u=o.node(d).rank,f=r.name,p=o.edge(r),_=p.labelRank;if(u!==c+1){for(o.removeEdge(r),a=0,++c;c<u;++a,++c)p.points=[],i={width:0,height:0,edgeLabel:p,edgeObj:r,rank:c},s=t.addDummyNode(o,"edge",i,"_d"),c===_&&(i.width=p.width,i.height=p.height,i.dummy="edge-label",i.labelpos=p.labelpos),o.setEdge(l,s,{weight:p.weight},f),a===0&&o.graph().dummyChains.push(s),l=s;o.setEdge(l,d,{weight:p.weight},f)}}(e,n))},undo:function(e){e.graph().dummyChains.forEach(n=>{let o,r=e.node(n),s=r.edgeLabel;for(e.setEdge(r.edgeObj,s);r.dummy;)o=e.successors(n)[0],e.removeNode(n),s.points.push({x:r.x,y:r.y}),r.dummy==="edge-label"&&(s.x=r.x,s.y=r.y,s.width=r.width,s.height=r.height),n=o,r=e.node(n)})}},zh}function Bl(){if(Pv)return Bh;Pv=1;const{applyWithChunking:t}=Dt();return Bh={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}},Bh}function g2(){if(Lv)return Uh;Lv=1;var t=Yn().Graph,e=Bl().slack;function n(s,i){return s.nodes().forEach(function a(l){i.nodeEdges(l).forEach(c=>{var d=c.v,u=l===d?c.w:d;s.hasNode(u)||e(i,c)||(s.setNode(u,{}),s.setEdge(l,u,{}),a(u))})}),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 Uh=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},Uh}function dD(){if(Fv)return Vh;Fv=1;var t=g2(),e=Bl().slack,n=Bl().longestPath,o=Yn().alg.preorder,r=Yn().alg.postorder,s=Dt().simplify;function i(g){g=s(g),n(g);var m,b=t(g);for(c(b),a(b,g);m=u(b);)p(b,g,m,f(b,g,m))}function a(g,m){var b=r(g,g.nodes());(b=b.slice(0,b.length-1)).forEach(x=>function(y,v,k){var S=y.node(k),E=S.parent;y.edge(k,E).cutvalue=l(y,v,k)}(g,m,x))}function l(g,m,b){var x=g.node(b).parent,y=!0,v=m.edge(b,x),k=0;return v||(y=!1,v=m.edge(x,b)),k=v.weight,m.nodeEdges(b).forEach(S=>{var E,j,I=S.v===b,T=I?S.w:S.v;if(T!==x){var M=I===y,L=m.edge(S).weight;if(k+=M?L:-L,E=b,j=T,g.hasEdge(E,j)){var B=g.edge(b,T).cutvalue;k+=M?-B:B}}}),k}function c(g,m){arguments.length<2&&(m=g.nodes()[0]),d(g,{},1,m)}function d(g,m,b,x,y){var v=b,k=g.node(x);return m[x]=!0,g.neighbors(x).forEach(S=>{Object.hasOwn(m,S)||(b=d(g,m,b,S,x))}),k.low=v,k.lim=b++,y?k.parent=y:delete k.parent,b}function u(g){return g.edges().find(m=>g.edge(m).cutvalue<0)}function f(g,m,b){var x=b.v,y=b.w;m.hasEdge(x,y)||(x=b.w,y=b.v);var v=g.node(x),k=g.node(y),S=v,E=!1;v.lim>k.lim&&(S=k,E=!0);var j=m.edges().filter(I=>E===_(g,g.node(I.v),S)&&E!==_(g,g.node(I.w),S));return j.reduce((I,T)=>e(m,T)<e(m,I)?T:I)}function p(g,m,b,x){var y=b.v,v=b.w;g.removeEdge(y,v),g.setEdge(x.v,x.w,{}),c(g),a(g,m),function(k,S){var E=k.nodes().find(I=>!S.node(I).parent),j=o(k,E);(j=j.slice(1)).forEach(I=>{var T=k.node(I).parent,M=S.edge(I,T),L=!1;M||(M=S.edge(T,I),L=!0),S.node(I).rank=S.node(T).rank+(L?M.minlen:-M.minlen)})}(g,m)}function _(g,m,b){return b.low<=m.lim&&m.lim<=b.lim}return Vh=i,i.initLowLimValues=c,i.initCutValues=a,i.calcCutValue=l,i.leaveEdge=u,i.enterEdge=f,i.exchangeEdges=p,Vh}function uD(){if(zv)return $h;zv=1;var t=Bl().longestPath,e=g2(),n=dD();$h=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 $h}function hD(){return Bv||(Bv=1,Hh=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(u,f,p,_){let g,m,b=[],x=[],y=Math.min(f[p].low,f[_].low),v=Math.max(f[p].lim,f[_].lim);g=p;do g=u.parent(g),b.push(g);while(g&&(f[g].low>y||v>f[g].lim));for(m=g,g=_;(g=u.parent(g))!==m;)x.push(g);return{path:b.concat(x.reverse()),lca:m}}(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]}})}),Hh}function fD(){if(Uv)return Wh;Uv=1;let t=Dt();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"),u=t.addBorderNode(n,"_bb"),f=n.node(l);n.setParent(d,l),f.borderTop=d,n.setParent(u,l),f.borderBottom=u,c.forEach(p=>{e(n,o,r,s,i,a,p);let _=n.node(p),g=_.borderTop?_.borderTop:p,m=_.borderBottom?_.borderBottom:p,b=_.borderTop?s:2*s,x=g!==m?1:i-a[l]+1;n.setEdge(d,g,{weight:b,minlen:x,nestingEdge:!0}),n.setEdge(m,u,{weight:b,minlen:x,nestingEdge:!0})}),n.parent(l)||n.setEdge(o,d,{weight:0,minlen:i+a[l]})}return Wh={run:function(n){let o=t.addDummyNode(n,"root",{},"_root"),r=function(c){var d={};function u(f,p){var _=c.children(f);_&&_.length&&_.forEach(g=>u(g,p+1)),d[f]=p}return c.children().forEach(f=>u(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,u)=>d+c.edge(u).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)})}},Wh}function pD(){if($v)return Gh;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 $v=1,Gh={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))}},Gh}function mD(){if(Jv)return Yv;Jv=1;let t=Dt();return Yv=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,u){let f=0,p=0;d.weight&&(f+=d.barycenter*d.weight,p+=d.weight),u.weight&&(f+=u.barycenter*u.weight,p+=u.weight),d.vs=u.vs.concat(d.vs),d.barycenter=f/p,d.weight=p,d.i=Math.min(u.i,d.i),u.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 gD(){if(Zv)return Kh;Zv=1;let t=(Gv||(Gv=1,qv=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),u=o.node(c.v);return{sum:l.sum+d.weight*u.order,weight:l.weight+d.weight}},{sum:0,weight:0});return{v:s,barycenter:a.sum/a.weight,weight:a.weight}}return{v:s}})}),qv),e=mD(),n=function(){if(Xv)return Kv;Xv=1;let o=Dt();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 Kv=function(s,i){let a=o.partition(s,m=>Object.hasOwn(m,"barycenter")),l=a.lhs,c=a.rhs.sort((m,b)=>b.i-m.i),d=[],u=0,f=0,p=0;var _;l.sort((_=!!i,(m,b)=>m.barycenter<b.barycenter?-1:m.barycenter>b.barycenter?1:_?b.i-m.i:m.i-b.i)),p=r(d,c,p),l.forEach(m=>{p+=m.vs.length,d.push(m.vs),u+=m.barycenter*m.weight,f+=m.weight,p=r(d,c,p)});let g={vs:d.flat(!0)};return f&&(g.barycenter=u/f,g.weight=f),g}}();return Kh=function o(r,s,i,a){let l=r.children(s),c=r.node(s),d=c?c.borderLeft:void 0,u=c?c.borderRight:void 0,f={};d&&(l=l.filter(m=>m!==d&&m!==u));let p=t(r,l);p.forEach(m=>{if(r.children(m.v).length){let y=o(r,m.v,i,a);f[m.v]=y,Object.hasOwn(y,"barycenter")&&(x=y,(b=m).barycenter!==void 0?(b.barycenter=(b.barycenter*b.weight+x.barycenter*x.weight)/(b.weight+x.weight),b.weight+=x.weight):(b.barycenter=x.barycenter,b.weight=x.weight))}var b,x});let _=e(p,i);(function(m,b){m.forEach(x=>{x.vs=x.vs.flatMap(y=>b[y]?b[y].vs:y)})})(_,f);let g=n(_,a);if(d&&(g.vs=[d,g.vs,u].flat(!0),r.predecessors(d).length)){let m=r.node(r.predecessors(d)[0]),b=r.node(r.predecessors(u)[0]);Object.hasOwn(g,"barycenter")||(g.barycenter=0,g.weight=0),g.barycenter=(g.barycenter*g.weight+m.order+b.order)/(g.weight+2),g.weight+=2}return g},Kh}function _D(){if(Qv)return Xh;Qv=1;let t=Yn().Graph,e=Dt();return Xh=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 u=d.v===a?d.w:d.v,f=i.edge(u,a),p=f!==void 0?f.weight:0;i.setEdge(u,a,{weight:n.edge(d).weight+p})}),Object.hasOwn(l,"minRank")&&i.setNode(a,{borderLeft:l.borderLeft[o],borderRight:l.borderRight[o]}))}),i},Xh}function bD(){if(n2)return Zh;n2=1;let t=function(){if(Hv)return Yh;Hv=1;let d=Dt();return Yh=function(u){let f={},p=u.nodes().filter(x=>!u.children(x).length),_=p.map(x=>u.node(x).rank),g=d.applyWithChunking(Math.max,_),m=d.range(g+1).map(()=>[]);function b(x){if(f[x])return;f[x]=!0;let y=u.node(x);m[y.rank].push(x),u.successors(x).forEach(b)}return p.sort((x,y)=>u.node(x).rank-u.node(y).rank).forEach(b),m},Yh}(),e=function(){if(Wv)return Jh;Wv=1;let d=Dt().zipObject;function u(f,p,_){let g=d(_,_.map((k,S)=>S)),m=p.flatMap(k=>f.outEdges(k).map(S=>({pos:g[S.w],weight:f.edge(S).weight})).sort((S,E)=>S.pos-E.pos)),b=1;for(;b<_.length;)b<<=1;let x=2*b-1;b-=1;let y=new Array(x).fill(0),v=0;return m.forEach(k=>{let S=k.pos+b;y[S]+=k.weight;let E=0;for(;S>0;)S%2&&(E+=y[S+1]),S=S-1>>1,y[S]+=k.weight;v+=k.weight*E}),v}return Jh=function(f,p){let _=0;for(let g=1;g<p.length;++g)_+=u(f,p[g-1],p[g]);return _},Jh}(),n=gD(),o=_D(),r=(t2||(t2=1,e2=function(d,u,f){let p,_={};f.forEach(g=>{let m,b,x=d.parent(g);for(;x;){if(m=d.parent(x),m?(b=_[m],_[m]=x):(b=p,p=x),b&&b!==x)return void u.setEdge(b,x);x=m}})}),e2),s=Yn().Graph,i=Dt();function a(d,u,f){return u.map(function(p){return o(d,p,f)})}function l(d,u){let f=new s;d.forEach(function(p){let _=p.graph().root,g=n(p,_,f,u);g.vs.forEach((m,b)=>p.node(m).order=b),r(p,f,g.vs)})}function c(d,u){Object.values(u).forEach(f=>f.forEach((p,_)=>d.node(p).order=_))}return Zh=function d(u,f){if(f&&typeof f.customOrder=="function")return void f.customOrder(u,d);let p=i.maxRank(u),_=a(u,i.range(1,p+1),"inEdges"),g=a(u,i.range(p-1,-1,-1),"outEdges"),m=t(u);if(c(u,m),f&&f.disableOptimalOrderHeuristic)return;let b,x=Number.POSITIVE_INFINITY;for(let y=0,v=0;v<4;++y,++v){l(y%2?_:g,y%4>=2),m=i.buildLayerMatrix(u);let k=e(u,m);k<x&&(v=0,b=Object.assign({},m),x=k)}c(u,b)},Zh}function yD(){if(o2)return Qh;o2=1;let t=Yn().Graph,e=Dt();function n(u,f){let p={};return f.length&&f.reduce(function(_,g){let m=0,b=0,x=_.length,y=g[g.length-1];return g.forEach((v,k)=>{let S=function(j,I){if(j.node(I).dummy)return j.predecessors(I).find(T=>j.node(T).dummy)}(u,v),E=S?u.node(S).order:x;(S||v===y)&&(g.slice(b,k+1).forEach(j=>{u.predecessors(j).forEach(I=>{let T=u.node(I),M=T.order;!(M<m||E<M)||T.dummy&&u.node(j).dummy||r(p,I,j)})}),b=k+1,m=E)}),g}),p}function o(u,f){let p={};function _(g,m,b,x,y){let v;e.range(m,b).forEach(k=>{v=g[k],u.node(v).dummy&&u.predecessors(v).forEach(S=>{let E=u.node(S);E.dummy&&(E.order<x||E.order>y)&&r(p,S,v)})})}return f.length&&f.reduce(function(g,m){let b,x=-1,y=0;return m.forEach((v,k)=>{if(u.node(v).dummy==="border"){let S=u.predecessors(v);S.length&&(b=u.node(S[0]).order,_(m,y,k,x,b),y=k,x=b)}_(m,y,m.length,b,g.length)}),m}),p}function r(u,f,p){if(f>p){let g=f;f=p,p=g}let _=u[f];_||(u[f]=_={}),_[p]=!0}function s(u,f,p){if(f>p){let _=f;f=p,p=_}return!!u[f]&&Object.hasOwn(u[f],p)}function i(u,f,p,_){let g={},m={},b={};return f.forEach(x=>{x.forEach((y,v)=>{g[y]=y,m[y]=y,b[y]=v})}),f.forEach(x=>{let y=-1;x.forEach(v=>{let k=_(v);if(k.length){k=k.sort((E,j)=>b[E]-b[j]);let S=(k.length-1)/2;for(let E=Math.floor(S),j=Math.ceil(S);E<=j;++E){let I=k[E];m[v]===v&&y<b[I]&&!s(p,v,I)&&(m[I]=v,m[v]=g[v]=g[I],y=b[I])}}})}),{root:g,align:m}}function a(u,f,p,_,g){let m={},b=function(v,k,S,E){let j=new t,I=v.graph(),T=function(M,L,B){return(O,z,F)=>{let V,P=O.node(z),C=O.node(F),$=0;if($+=P.width/2,Object.hasOwn(P,"labelpos"))switch(P.labelpos.toLowerCase()){case"l":V=-P.width/2;break;case"r":V=P.width/2}if(V&&($+=B?V:-V),V=0,$+=(P.dummy?L:M)/2,$+=(C.dummy?L: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&&($+=B?V:-V),V=0,$}}(I.nodesep,I.edgesep,E);return k.forEach(M=>{let L;M.forEach(B=>{let O=S[B];if(j.setNode(O),L){var z=S[L],F=j.edge(z,O);j.setEdge(z,O,Math.max(T(v,B,L),F||0))}L=B})}),j}(u,f,p,g),x=g?"borderLeft":"borderRight";function y(v,k){let S=b.nodes(),E=S.pop(),j={};for(;E;)j[E]?v(E):(j[E]=!0,S.push(E),S=S.concat(k(E))),E=S.pop()}return y(function(v){m[v]=b.inEdges(v).reduce((k,S)=>Math.max(k,m[S.v]+b.edge(S)),0)},b.predecessors.bind(b)),y(function(v){let k=b.outEdges(v).reduce((E,j)=>Math.min(E,m[j.w]-b.edge(j)),Number.POSITIVE_INFINITY),S=u.node(v);k!==Number.POSITIVE_INFINITY&&S.borderType!==x&&(m[v]=Math.max(m[v],k))},b.successors.bind(b)),Object.keys(_).forEach(v=>m[v]=m[p[v]]),m}function l(u,f){return Object.values(f).reduce((p,_)=>{let g=Number.NEGATIVE_INFINITY,m=Number.POSITIVE_INFINITY;Object.entries(_).forEach(([x,y])=>{let v=function(k,S){return k.node(S).width}(u,x)/2;g=Math.max(y+v,g),m=Math.min(y-v,m)});const b=g-m;return b<p[0]&&(p=[b,_]),p},[Number.POSITIVE_INFINITY,null])[1]}function c(u,f){let p=Object.values(f),_=e.applyWithChunking(Math.min,p),g=e.applyWithChunking(Math.max,p);["u","d"].forEach(m=>{["l","r"].forEach(b=>{let x=m+b,y=u[x];if(y===f)return;let v=Object.values(y),k=_-e.applyWithChunking(Math.min,v);b!=="l"&&(k=g-e.applyWithChunking(Math.max,v)),k&&(u[x]=e.mapValues(y,S=>S+k))})})}function d(u,f){return e.mapValues(u.ul,(p,_)=>{if(f)return u[f.toLowerCase()][_];{let g=Object.values(u).map(m=>m[_]).sort((m,b)=>m-b);return(g[1]+g[2])/2}})}return Qh={positionX:function(u){let f,p=e.buildLayerMatrix(u),_=Object.assign(n(u,p),o(u,p)),g={};["u","d"].forEach(b=>{f=b==="u"?p:Object.values(p).reverse(),["l","r"].forEach(x=>{x==="r"&&(f=f.map(S=>Object.values(S).reverse()));let y=(b==="u"?u.predecessors:u.successors).bind(u),v=i(u,f,_,y),k=a(u,f,v.root,v.align,x==="r");x==="r"&&(k=e.mapValues(k,S=>-S)),g[b+x]=k})});let m=l(u,g);return c(g,m),d(g,u.graph().align)},findType1Conflicts:n,findType2Conflicts:o,addConflict:r,hasConflict:s,verticalAlignment:i,horizontalCompaction:a,alignCoordinates:c,findSmallestWidthAlignment:l,balance:d},Qh}function xD(){if(r2)return ef;r2=1;let t=Dt(),e=yD().positionX;return ef=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 u=o.node(d).height;return c>u?c:u},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)},ef}function wD(){if(s2)return tf;s2=1;let t=lD(),e=cD(),n=uD(),o=Dt().normalizeRanks,r=hD(),s=Dt().removeEmptyRanks,i=fD(),a=function(){if(Vv)return qh;Vv=1;let E=Dt();function j(I,T,M,L,B,O){let z={width:0,height:0,rank:O,borderType:T},F=B[T][O-1],V=E.addDummyNode(I,"border",z,M);B[T][O]=V,I.setParent(V,L),F&&I.setEdge(F,V,{weight:1})}return qh=function(I){I.children().forEach(function T(M){let L=I.children(M),B=I.node(M);if(L.length&&L.forEach(T),Object.hasOwn(B,"minRank")){B.borderLeft=[],B.borderRight=[];for(let O=B.minRank,z=B.maxRank+1;O<z;++O)j(I,"borderLeft","_bl",M,B,O),j(I,"borderRight","_br",M,B,O)}})},qh}(),l=pD(),c=bD(),d=xD(),u=Dt(),f=Yn().Graph;tf=function(E,j){let I=j&&j.debugTiming?u.time:u.notime;I("layout",()=>{let T=I(" buildLayoutGraph",()=>function(M){let L=new f({multigraph:!0,compound:!0}),B=S(M.graph());return L.setGraph(Object.assign({},_,k(B,p),u.pick(B,g))),M.nodes().forEach(O=>{const z=k(S(M.node(O)),m);Object.keys(b).forEach(F=>{z[F]===void 0&&(z[F]=b[F])}),L.setNode(O,z),L.setParent(O,M.parent(O))}),M.edges().forEach(O=>{let z=S(M.edge(O));L.setEdge(O,Object.assign({},y,k(z,x),u.pick(z,v)))}),L}(E));I(" runLayout",()=>function(M,L,B){L(" makeSpaceForEdgeLabels",()=>function(O){let z=O.graph();z.ranksep/=2,O.edges().forEach(F=>{let V=O.edge(F);V.minlen*=2,V.labelpos.toLowerCase()!=="c"&&(z.rankdir==="TB"||z.rankdir==="BT"?V.width+=V.labeloffset:V.height+=V.labeloffset)})}(M)),L(" removeSelfEdges",()=>function(O){O.edges().forEach(z=>{if(z.v===z.w){var F=O.node(z.v);F.selfEdges||(F.selfEdges=[]),F.selfEdges.push({e:z,label:O.edge(z)}),O.removeEdge(z)}})}(M)),L(" acyclic",()=>t.run(M)),L(" nestingGraph.run",()=>i.run(M)),L(" rank",()=>n(u.asNonCompoundGraph(M))),L(" injectEdgeLabelProxies",()=>function(O){O.edges().forEach(z=>{let F=O.edge(z);if(F.width&&F.height){let V=O.node(z.v),P={rank:(O.node(z.w).rank-V.rank)/2+V.rank,e:z};u.addDummyNode(O,"edge-proxy",P,"_ep")}})}(M)),L(" removeEmptyRanks",()=>s(M)),L(" nestingGraph.cleanup",()=>i.cleanup(M)),L(" normalizeRanks",()=>o(M)),L(" assignRankMinMax",()=>function(O){let z=0;O.nodes().forEach(F=>{let V=O.node(F);V.borderTop&&(V.minRank=O.node(V.borderTop).rank,V.maxRank=O.node(V.borderBottom).rank,z=Math.max(z,V.maxRank))}),O.graph().maxRank=z}(M)),L(" removeEdgeLabelProxies",()=>function(O){O.nodes().forEach(z=>{let F=O.node(z);F.dummy==="edge-proxy"&&(O.edge(F.e).labelRank=F.rank,O.removeNode(z))})}(M)),L(" normalize.run",()=>e.run(M)),L(" parentDummyChains",()=>r(M)),L(" addBorderSegments",()=>a(M)),L(" order",()=>c(M,B)),L(" insertSelfEdges",()=>function(O){var z=u.buildLayerMatrix(O);z.forEach(F=>{var V=0;F.forEach((P,C)=>{var $=O.node(P);$.order=C+V,($.selfEdges||[]).forEach(N=>{u.addDummyNode(O,"selfedge",{width:N.label.width,height:N.label.height,rank:$.rank,order:C+ ++V,e:N.e,label:N.label},"_se")}),delete $.selfEdges})})}(M)),L(" adjustCoordinateSystem",()=>l.adjust(M)),L(" position",()=>d(M)),L(" positionSelfEdges",()=>function(O){O.nodes().forEach(z=>{var F=O.node(z);if(F.dummy==="selfedge"){var V=O.node(F.e.v),P=V.x+V.width/2,C=V.y,$=F.x-P,N=V.height/2;O.setEdge(F.e,F.label),O.removeNode(z),F.label.points=[{x:P+2*$/3,y:C-N},{x:P+5*$/6,y:C-N},{x:P+$,y:C},{x:P+5*$/6,y:C+N},{x:P+2*$/3,y:C+N}],F.label.x=F.x,F.label.y=F.y}})}(M)),L(" removeBorderNodes",()=>function(O){O.nodes().forEach(z=>{if(O.children(z).length){let F=O.node(z),V=O.node(F.borderTop),P=O.node(F.borderBottom),C=O.node(F.borderLeft[F.borderLeft.length-1]),$=O.node(F.borderRight[F.borderRight.length-1]);F.width=Math.abs($.x-C.x),F.height=Math.abs(P.y-V.y),F.x=C.x+F.width/2,F.y=V.y+F.height/2}}),O.nodes().forEach(z=>{O.node(z).dummy==="border"&&O.removeNode(z)})}(M)),L(" normalize.undo",()=>e.undo(M)),L(" fixupEdgeLabelCoords",()=>function(O){O.edges().forEach(z=>{let F=O.edge(z);if(Object.hasOwn(F,"x"))switch(F.labelpos!=="l"&&F.labelpos!=="r"||(F.width-=F.labeloffset),F.labelpos){case"l":F.x-=F.width/2+F.labeloffset;break;case"r":F.x+=F.width/2+F.labeloffset}})}(M)),L(" undoCoordinateSystem",()=>l.undo(M)),L(" translateGraph",()=>function(O){let z=Number.POSITIVE_INFINITY,F=0,V=Number.POSITIVE_INFINITY,P=0,C=O.graph(),$=C.marginx||0,N=C.marginy||0;function H(G){let Z=G.x,q=G.y,re=G.width,ne=G.height;z=Math.min(z,Z-re/2),F=Math.max(F,Z+re/2),V=Math.min(V,q-ne/2),P=Math.max(P,q+ne/2)}O.nodes().forEach(G=>H(O.node(G))),O.edges().forEach(G=>{let Z=O.edge(G);Object.hasOwn(Z,"x")&&H(Z)}),z-=$,V-=N,O.nodes().forEach(G=>{let Z=O.node(G);Z.x-=z,Z.y-=V}),O.edges().forEach(G=>{let Z=O.edge(G);Z.points.forEach(q=>{q.x-=z,q.y-=V}),Object.hasOwn(Z,"x")&&(Z.x-=z),Object.hasOwn(Z,"y")&&(Z.y-=V)}),C.width=F-z+$,C.height=P-V+N}(M)),L(" assignNodeIntersects",()=>function(O){O.edges().forEach(z=>{let F,V,P=O.edge(z),C=O.node(z.v),$=O.node(z.w);P.points?(F=P.points[0],V=P.points[P.points.length-1]):(P.points=[],F=$,V=C),P.points.unshift(u.intersectRect(C,F)),P.points.push(u.intersectRect($,V))})}(M)),L(" reversePoints",()=>function(O){O.edges().forEach(z=>{let F=O.edge(z);F.reversed&&F.points.reverse()})}(M)),L(" acyclic.undo",()=>t.undo(M))}(T,I,j)),I(" updateInputGraph",()=>function(M,L){M.nodes().forEach(B=>{let O=M.node(B),z=L.node(B);O&&(O.x=z.x,O.y=z.y,O.rank=z.rank,L.children(B).length&&(O.width=z.width,O.height=z.height))}),M.edges().forEach(B=>{let O=M.edge(B),z=L.edge(B);O.points=z.points,Object.hasOwn(z,"x")&&(O.x=z.x,O.y=z.y)}),M.graph().width=L.graph().width,M.graph().height=L.graph().height}(E,T))})};let p=["nodesep","edgesep","ranksep","marginx","marginy"],_={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},g=["acyclicer","ranker","rankdir","align"],m=["width","height"],b={width:0,height:0},x=["minlen","weight","width","height","labeloffset"],y={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},v=["labelpos"];function k(E,j){return u.mapValues(u.pick(E,j),Number)}function S(E){var j={};return E&&Object.entries(E).forEach(([I,T])=>{typeof I=="string"&&(I=I.toLowerCase()),j[I]=T}),j}return tf}function vD(){if(i2)return nf;i2=1;let t=Dt(),e=Yn().Graph;return nf={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}},nf}var _2=d2?c2:(d2=1,c2={graphlib:Yn(),layout:wD(),debug:vD(),util:{time:Dt().time,notime:Dt().notime},version:l2?a2:(l2=1,a2="1.1.4")});const $i=new _2.graphlib.Graph().setDefaultEdgeLabel(()=>({})),b2=(t,e,n)=>($i.setGraph({rankdir:n.direction,nodesep:150,ranksep:200,ranker:"longest-path"}),e.forEach(o=>$i.setEdge(o.source,o.target)),t.forEach(o=>$i.setNode(o.id,{...o,width:o.width??0,height:o.height??0})),_2.layout($i),{nodes:t.map(o=>{const{x:r,y:s}=$i.node(o.id);return{...o,position:{x:r,y:s}}}),edges:e}),y2=new class{createEdge(t,e){return{animated:!0,markerEnd:{type:as.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:bh(ut.get(e).code.trim().split(`
127
+ `).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 u of c)for(const f of d){const p=`${u}-${f}`;a.has(p)||(a.add(p),i.add(u),i.add(f),s.push(this.createEdge(u,f)))}}for(const[l,c]of $p.zip(t,e)){o||r.push(this.createNode(l,c));const d=i.has(l),u=ut.get(c).code.trim().startsWith("mo.md");!d&&u||r.push(this.createNode(l,c))}return{nodes:r,edges:s}}},kD=t=>{const e=X.c(43),{cellIds:n,variables:o,cellAtoms:r,children:s,layoutDirection:i,settings:a}=t;let l;e[0]!==r||e[1]!==n||e[2]!==i||e[3]!==a.hidePureMarkdown||e[4]!==o?(l=()=>{let C=y2.createElements(n,r,o,a.hidePureMarkdown);return C=b2(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,u,f]=Xw(c.nodes),[p,_,g]=Zw(c.edges),m=Bi();let b;e[6]!==i||e[7]!==_||e[8]!==u?(b=C=>{const $=b2(C.nodes,C.edges,{direction:i});u($.nodes),_($.edges)},e[6]=i,e[7]=_,e[8]=u,e[9]=b):b=e[9];const x=Qe(b);let y,v;e[10]!==r||e[11]!==n||e[12]!==a.hidePureMarkdown||e[13]!==x||e[14]!==o?(y=()=>{x(y2.createElements(n,r,o,a.hidePureMarkdown))},v=[n,o,r,x,a.hidePureMarkdown],e[10]=r,e[11]=n,e[12]=a.hidePureMarkdown,e[13]=x,e[14]=o,e[15]=y,e[16]=v):(y=e[15],v=e[16]),A.useEffect(y,v);const[k,S]=A.useState();let E;sv(),e[17]===Symbol.for("react.memo_cache_sentinel")?(E=()=>{S(void 0)},e[17]=E):E=e[17];const j=E;let I,T,M,L,B,O,z,F,V,P;return e[18]===Symbol.for("react.memo_cache_sentinel")?(I={minZoom:.5,maxZoom:1.5},T=(C,$)=>{S({type:"node",id:$.id})},M=(C,$)=>{const{source:N,target:H}=$;S({type:"edge",source:N,target:H})},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")?(L=h.jsx($9,{color:"#ccc",variant:Pn.Dots}),e[21]=L):L=e[21],e[22]!==m||e[23]!==d?(B=()=>{const C=ut.get(nV);if(C){const $=d.find(N=>N.id===C);$&&(m.fitView({padding:1,duration:600,nodes:[$]}),S({type:"node",id:C}))}},e[22]=m,e[23]=d,e[24]=B):B=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(O=h.jsx(Cm,{className:"size-4"}),e[25]=O):O=e[25],e[26]!==B?(z=h.jsx(L9,{position:"bottom-right",showInteractive:!1,children:h.jsx(Re,{content:"Jump to focused cell",delayDuration:200,side:"left",asChild:!1,children:h.jsx(ms,{onMouseDown:Vn.preventFocus,onClick:B,children:O})})}),e[26]=B,e[27]=z):z=e[27],e[28]!==p||e[29]!==k||e[30]!==o?(F=h.jsx(zl,{selection:k,variables:o,edges:p,onClearSelection:j}),e[28]=p,e[29]=k,e[30]=o,e[31]=F):F=e[31],e[32]!==s||e[33]!==p||e[34]!==d||e[35]!==g||e[36]!==f||e[37]!==z||e[38]!==F?(V=h.jsxs(_h,{nodes:d,edges:p,nodeTypes:ov,minZoom:.2,fitViewOptions:I,onNodeClick:T,onEdgeClick:M,onNodeDoubleClick:SD,fitView:!0,onNodesChange:f,onEdgesChange:g,zoomOnDoubleClick:!1,nodesConnectable:!1,children:[L,z,F,s]}),e[32]=s,e[33]=p,e[34]=d,e[35]=g,e[36]=f,e[37]=z,e[38]=F,e[39]=V):V=e[39],e[40]!==i||e[41]!==V?(P=h.jsx(tv.Provider,{value:i,children:V}),e[40]=i,e[41]=V,e[42]=P):P=e[42],P};function SD(t,e){F4(e.id,"focus")}const CD=Zt("_minimap_"),ND=Zt({hidePureMarkdown:!0}),jD=t=>{const e=X.c(11),[n,o]=fn(CD),[r,s]=fn(ND);let i;e[0]!==n||e[1]!==t||e[2]!==o||e[3]!==s||e[4]!==r?(i=()=>n==="_minimap_"?h.jsx(Y9,{...t,children:h.jsx(xh,{settings:r,onSettingsChange:s,view:n,onChange:o})}):h.jsx(kD,{...t,settings:r,layoutDirection:n,children:h.jsx(xh,{settings:r,onSettingsChange:s,view:n,onChange:o})}),e[0]=n,e[1]=t,e[2]=o,e[3]=s,e[4]=r,e[5]=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=h.jsx(gh,{children:l},n),e[8]=n,e[9]=l,e[10]=c):c=e[10],c},ED=()=>{const t=X.c(5),e=z4(),n=Fc(),[o]=oV();let r,s;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=Oe("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=h.jsx("div",{className:r,children:h.jsx(jD,{cellAtoms:o,variables:e,cellIds:n.inOrderIds})}),t[1]=n.inOrderIds,t[2]=o,t[3]=e,t[4]=s):s=t[4],s},x2="name",w2="type-value",rf="defs-refs",ID=[{id:x2,accessorFn:t=>[t.name,t.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>h.jsx(Yp,{header:"Name",column:t}),cell:({getValue:t})=>{const[e,n]=t();return h.jsx(yh,{name:e,declaredBy:n})}},{id:w2,accessorFn:t=>[t.dataType,t.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>h.jsx(Yp,{header:h.jsxs("div",{className:"flex flex-col gap-1",children:[h.jsx("span",{children:"Type"}),h.jsx("span",{children:"Value"})]}),column:t}),cell:({getValue:t})=>{const[e,n]=t();return h.jsxs("div",{className:"max-w-[150px]",children:[h.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs",children:e}),h.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap",title:n??"",children:n})]})}},{id:rf,accessorFn:t=>[t.declaredBy,t.usedBy,t.name,t.declaredByNames,t.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:t})=>h.jsx(Yp,{header:h.jsxs("div",{className:"flex flex-col gap-1",children:[h.jsx("span",{children:"Declared By"}),h.jsx("span",{children:"Used By"})]}),column:t}),cell:({getValue:t})=>{const[e,n,o]=t(),r=s=>{const i=rc(s);i&&Hp(i,o)};return h.jsxs("div",{className:"flex flex-col gap-1 py-1",children:[h.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-center",children:[h.jsx("span",{title:"Declared by",children:h.jsx(Bm,{className:"w-3.5 h-3.5 text-muted-foreground"})}),e.length===1?h.jsx(pr,{variant:"focus",cellId:e[0],skipScroll:!0,onClick:()=>r(e[0])}):h.jsx("div",{className:"text-destructive flex flex-row gap-2",children:e.slice(0,3).map((s,i)=>h.jsxs("span",{className:"flex",children:[h.jsx(pr,{variant:"focus",cellId:s,skipScroll:!0,className:"whitespace-nowrap text-destructive",onClick:()=>r(s)},s),i<e.length-1&&", "]},s))})]}),h.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-baseline",children:[h.jsx("span",{title:"Used by",children:h.jsx(ja,{className:"w-3.5 h-3.5 text-muted-foreground"})}),h.jsx(rv,{maxCount:3,cellIds:n,skipScroll:!0,onClick:r})]})]})}}],v2=A.memo(({className:t,cellIds:e,variables:n})=>{const[o,r]=K.useState([]),[s,i]=K.useState(""),a=rV(),l=A.useMemo(()=>{const u=f=>{const p=a[f];return cV(p)?`cell-${e.indexOf(f)}`:p??`cell-${e.indexOf(f)}`};return Object.values(n).map(f=>({...f,declaredByNames:f.declaredBy.map(u),usedByNames:f.usedBy.map(u)}))},[n,a,e]),c=A.useMemo(()=>{const u=new Map;return e.forEach((f,p)=>u.set(f,p)),function(f,p,_){p||(p={id:rf,desc:!1});let g=[];switch(p.id){case x2:g=xa(f,m=>m.name);break;case w2:g=xa(f,m=>m.dataType);break;case rf:g=xa(f,m=>_.get(m.declaredBy[0]))}return p.desc?g.reverse():g}(l,o[0],u)},[l,o,e]),d=sV({data:c,columns:ID,getCoreRowModel:lV(),onGlobalFilterChange:i,getFilteredRowModel:aV(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter:u=>u.columnDef.enableGlobalFilter??!0,globalFilterFn:"auto",manualSorting:!0,onSortingChange:r,getSortedRowModel:iV(),state:{sorting:o,globalFilter:s}});return h.jsxs(h.Fragment,{children:[h.jsx(B4,{className:"w-full",placeholder:"Search",value:s,onChange:u=>i(u.target.value)}),h.jsxs(Wp,{className:Oe("w-full text-sm flex-1 border-separate border-spacing-0",t),children:[h.jsx(qp,{children:h.jsx(Ks,{className:"whitespace-nowrap text-xs",children:d.getFlatHeaders().map(u=>h.jsx(Fr,{className:"sticky top-0 bg-background border-b",children:U4(u.column.columnDef.header,u.getContext())},u.id))})}),h.jsx(Gp,{children:d.getRowModel().rows.map(u=>h.jsx(Ks,{className:"hover:bg-accent",children:u.getVisibleCells().map(f=>h.jsx(zr,{className:"border-b",children:U4(f.column.columnDef.cell,f.getContext())},f.id))},u.id))})]})]})});v2.displayName="VariableTable";let k2,S2,C2;k2=()=>{const t=X.c(4),e=z4(),n=Fc();if(Object.keys(e).length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(In,{title:"No variables",description:"Global variables will appear here.",icon:h.jsx(uc,{})}),t[0]=r):r=t[0],r}let o;return t[1]!==n.inOrderIds||t[2]!==e?(o=h.jsx(v2,{className:"flex-1",cellIds:n.inOrderIds,variables:e}),t[1]=n.inOrderIds,t[2]=e,t[3]=o):o=t[3],o},tm=t=>{const e=X.c(6),n=t.dataTestId;let o,r;return e[0]!==t.className?(o=Oe("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=h.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},S2=()=>{const t=X.c(9),e=dV(),{clearLogs:n}=Lt();if(e.length===0){let i,a;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsx("code",{className:"border rounded px-1",children:"stdout"}),t[0]=i):i=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx(In,{title:"No logs",description:h.jsxs("span",{children:[i," and"," ",h.jsx("code",{className:"border rounded px-1",children:"stderr"})," logs will appear here."]}),icon:h.jsx(hp,{})}),t[1]=a):a=t[1],a}let o,r,s;return t[2]!==n?(o=h.jsx("div",{className:"flex flex-row justify-end px-2 py-1",children:h.jsx(tm,{dataTestId:"clear-logs-button",onClick:n})}),t[2]=n,t[3]=o):o=t[3],t[4]!==e?(r=h.jsx("div",{className:"overflow-auto flex-1",children:h.jsx(C2,{logs:e,className:"min-w-[300px]"})}),t[4]=e,t[5]=r):r=t[5],t[6]!==o||t[7]!==r?(s=h.jsxs(h.Fragment,{children:[o,r]}),t[6]=o,t[7]=r,t[8]=s):s=t[8],s},C2=t=>{const e=X.c(10),{logs:n,className:o}=t;let r,s,i,a,l;return e[0]!==o?(r=Oe("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(MD),e[3]=n,e[4]=i):i=e[4],e[5]!==i?(a=h.jsx("pre",{className:"grid text-xs font-mono gap-1 whitespace-break-spaces font-semibold align-left",children:h.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=h.jsx("div",{className:r,children:a}),e[7]=r,e[8]=a,e[9]=l):l=e[9],l};function AD(t){const e=uV(t.timestamp),n=TD[t.level],o=t.level.toUpperCase();return h.jsxs(h.Fragment,{children:[h.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)] dark:text-[var(--gray-11)]",children:["[",e,"]"]}),h.jsx("span",{className:Oe("flex-shrink-0",n),children:o}),h.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)]",children:["(",h.jsx(pr,{cellId:t.cellId}),")"]}),t.message]})}const TD={stdout:"text-[var(--grass-9)]",stderr:"text-[var(--red-9)]"};function MD(t,e){return h.jsxs("div",{className:"contents group",children:[h.jsx("span",{className:Oe("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","text-right col-span-1 py-1 pr-1"),children:e+1}),h.jsx("span",{className:Oe("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","px-2 flex gap-x-1.5 py-1 flex-wrap"),children:AD(t)})]},e)}const OD=()=>{const t=X.c(5),{documentation:e}=He(hV);if(!e){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(In,{title:"View docs as you type",description:"Move your text cursor over a symbol to see its documentation.",icon:h.jsx(td,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=Up({html:e}),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=h.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};function N2(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}om=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(u,f){var p=A.useRef(null),_=A.useRef(null);_.current=f;var g=A.useRef(null);A.useEffect(function(){m()});var m=A.useCallback(function(){var b=g.current,x=_.current,y=b||(x?x instanceof Element?x:x.current:null);p.current&&p.current.element===y&&p.current.subscriber===u||(p.current&&p.current.cleanup&&p.current.cleanup(),p.current={element:y,subscriber:u,cleanup:y?u(y):void 0})},[u]);return A.useEffect(function(){return function(){p.current&&p.current.cleanup&&(p.current.cleanup(),p.current=null)}},[]),A.useCallback(function(b){g.current=b,m()},[m])}(A.useCallback(function(u){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 p=f[0],_=t.box==="border-box"?"borderBoxSize":t.box==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",g=N2(p,_,"inlineSize"),m=N2(p,_,"blockSize"),b=g?o(g):void 0,x=m?o(m):void 0;if(c.current.width!==b||c.current.height!==x){var y={width:b,height:x};c.current.width=b,c.current.height=x,n.current?n.current(y):l.current||a(y)}})}),r.current.instance.observe(u,{box:t.box}),function(){r.current&&r.current.instance.unobserve(u)}},[t.box,o]),t.ref);return A.useMemo(function(){return{ref:d,width:i.width,height:i.height}},[d,i.width,i.height])};const sf=new Map,DD=({file:t,onOpenNotebook:e})=>{const{theme:n}=Fo(),o=He(ap),[r,s]=A.useState(""),{data:i,loading:a,error:l,setData:c}=Xn(async()=>{const g=await V4({path:t.path}),m=g.contents||"";return s(sf.get(t.path)||m),g},[t.path]),d=async()=>{r!==(i==null?void 0:i.contents)&&await yV({path:t.path,contents:r}).then(g=>{g.success&&(c(m=>m?{...m,contents:r}:void 0),s(r))})},u=A.useRef(r);if(u.current=r,A.useEffect(()=>()=>{if(!(i!=null&&i.contents))return;const g=u.current;g===i.contents?sf.delete(t.path):sf.set(t.path,g)},[t.path,i==null?void 0:i.contents]),l)return h.jsx(Xs,{error:l});if(a||!i)return null;const f=i.mimeType||"text/plain",p=f in af;if(!i.contents&&!p)return h.jsxs("div",{className:"grid grid-cols-2 gap-2 p-6",children:[h.jsx("div",{className:"font-bold text-muted-foreground",children:"Name"}),h.jsx("div",{children:i.file.name}),h.jsx("div",{className:"font-bold text-muted-foreground",children:"Type"}),h.jsx("div",{children:f})]});const _=h.jsxs("div",{className:"text-xs text-muted-foreground p-1 flex justify-end gap-2 border-b",children:[t.isMarimoFile&&!Bn()&&h.jsx(Re,{content:"Open notebook",children:h.jsx(xn,{size:"small",onClick:g=>e(g),children:h.jsx(bc,{})})}),h.jsx(Re,{content:"Download",children:h.jsx(xn,{size:"small",onClick:()=>{if(j2(f)){const g=_V(i.contents,f);bV(g,i.file.name)}else oa(new Blob([i.contents||r],{type:f}),i.file.name)},children:h.jsx(_p,{})})}),!j2(f)&&h.jsxs(h.Fragment,{children:[h.jsx(Re,{content:"Copy contents to clipboard",children:h.jsx(xn,{size:"small",onClick:async()=>{await yn(r)},children:h.jsx(Ls,{})})}),h.jsx(Re,{content:pn("global.save"),children:h.jsx(xn,{size:"small",color:r===i.contents?void 0:"green",onClick:d,disabled:r===i.contents,children:h.jsx(Na,{})})})]})]});return f.startsWith("image/")?h.jsxs(h.Fragment,{children:[_,h.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:h.jsx(fV,{base64:i.contents,mime:f})})]}):f==="text/csv"&&i.contents?h.jsxs(h.Fragment,{children:[_,h.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:h.jsx(pV,{contents:i.contents})})]}):f.startsWith("audio/")?h.jsxs(h.Fragment,{children:[_,h.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:h.jsx(mV,{base64:i.contents,mime:f})})]}):f.startsWith("video/")?h.jsxs(h.Fragment,{children:[_,h.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:h.jsx(gV,{base64:i.contents,mime:f})})]}):h.jsxs(h.Fragment,{children:[_,h.jsx("div",{className:"flex-1 overflow-auto",children:h.jsx(_a,{theme:n==="dark"?"dark":"light",language:af[f]||af.default,className:"border-b",extensions:[st.lineWrapping,Hn.of([{key:o.getHotkey("global.save").key,stopPropagation:!0,run:()=>r!==i.contents&&(d(),!0)}])],value:r,onChange:s})})]})},j2=t=>t.startsWith("image/")||t.startsWith("audio/")||t.startsWith("video/"),af={"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"},E2=Zt(new class{constructor(t){this.callbacks=t,this.delegate=new Kp([]),this.rootPath="",this.onChange=jn.NOOP,this.path=new pp("/"),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 Kp(n.files),this.rootPath=n.root,this.path=pp.guessDeliminator(n.root)}catch(n){lt({title:"Failed",description:_4(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 Kp(i.files):this.delegate.update({id:s,changes:{children:i.files}})}this.onChange(this.delegate.data)},this.relativeFromRoot=e=>{const n=function(o){return o.endsWith("/")?o:`${o}/`}(this.rootPath);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:Q3,createFileOrFolder:$4,deleteFileOrFolder:wV,renameFileOrFolder:xV})),RD=Zt({});function PD(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 I2(t){const e=X.c(4);let n;e[0]!==t?(n=t===void 0?{}:t,e[0]=t,e[1]=n):n=e[1];const o=n;let r;return e[2]!==o?(r={multiple:!0,maxSize:104857600,onError:UD,onDropRejected:FD,onDrop:LD,...o},e[2]=o,e[3]=r):r=e[3],vV(r)}async function LD(t){for(const e of t){const n=(await PD(e)).split(",")[1];await $4({path:"",type:"file",name:e.name,contents:n})}await async function(){await ut.get(E2).refreshAll([])}()}function FD(t){lt({title:"File upload failed",description:h.jsx("div",{className:"flex flex-col gap-1",children:t.map(zD)}),variant:"danger"})}function zD(t){return h.jsxs("div",{children:[t.file.name," (",t.errors.map(BD).join(", "),")"]},t.file.name)}function BD(t){return t.message}function UD(t){Xt.error(t),lt({title:"File upload failed",description:t.message,variant:"danger"})}const A2=K.createContext(null),VD=t=>{const e=X.c(60),{height:n}=t,o=A.useRef(null),[r]=fn(E2);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}=Un(),[u,f]=fn(RD);let p,_;e[1]!==r?(p=()=>r.initialize(a),e[1]=r,e[2]=p):p=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(_=[],e[3]=_):_=e[3];const{loading:g,error:m}=Xn(p,_);let b;e[4]!==u||e[5]!==r?(b=()=>{r.refreshAll(Object.keys(u).filter(C=>u[C]))},e[4]=u,e[5]=r,e[6]=b):b=e[6];const x=Qe(b);let y;e[7]!==d||e[8]!==r?(y=async()=>{d({title:"Folder name",onConfirm:async C=>{r.createFolder(C,null)}})},e[7]=d,e[8]=r,e[9]=y):y=e[9];const v=Qe(y);let k;e[10]!==d||e[11]!==r?(k=async()=>{d({title:"File name",onConfirm:async C=>{r.createFile(C,null)}})},e[10]=d,e[11]=r,e[12]=k):k=e[12];const S=Qe(k);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 j=Qe(E);if(g){let C;return e[15]===Symbol.for("react.memo_cache_sentinel")?(C=h.jsx(Qn,{size:"medium",centered:!0}),e[15]=C):C=e[15],C}if(m){let C;return e[16]!==m?(C=h.jsx(Xs,{error:m}),e[16]=m,e[17]=C):C=e[17],C}if(l){let C,$,N,H,G,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")?($=h.jsx(Pe,{onClick:C,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:h.jsx(Et,{size:16})}),e[19]=$):$=e[19],e[20]!==l.name?(N=h.jsxs("div",{className:"flex items-center pl-1 pr-3 flex-shrink-0 border-b justify-between",children:[$,h.jsx("span",{className:"font-bold",children:l.name})]}),e[20]=l.name,e[21]=N):N=e[21],e[22]!==l.path||e[23]!==r?(H=q=>T2(q,r.relativeFromRoot(l.path)),e[22]=l.path,e[23]=r,e[24]=H):H=e[24],e[25]!==l||e[26]!==H?(G=h.jsx(A.Suspense,{children:h.jsx(DD,{onOpenNotebook:H,file:l})}),e[25]=l,e[26]=H,e[27]=G):G=e[27],e[28]!==N||e[29]!==G?(Z=h.jsxs(h.Fragment,{children:[N,G]}),e[28]=N,e[29]=G,e[30]=Z):Z=e[30],Z}let I;e[31]!==j||e[32]!==S||e[33]!==v||e[34]!==x||e[35]!==r?(I=h.jsx(HD,{onRefresh:x,onCreateFile:S,onCreateFolder:v,onCollapseAll:j,tree:r}),e[31]=j,e[32]=S,e[33]=v,e[34]=x,e[35]=r,e[36]=I):I=e[36];const T=n-33;let M,L,B,O,z,F,V,P;return e[37]!==r?(M=async C=>{const{ids:$}=C;for(const N of $)await r.delete(N)},L=async C=>{const{id:$,name:N}=C;await r.rename($,N)},B=async C=>{const{dragIds:$,parentId:N}=C;await r.move($,N)},e[37]=r,e[38]=M,e[39]=L,e[40]=B):(M=e[38],L=e[39],B=e[40]),e[41]===Symbol.for("react.memo_cache_sentinel")?(O=C=>{const $=C[0];$&&($.data.isDirectory||c($.data))},e[41]=O):O=e[41],e[42]!==u||e[43]!==f||e[44]!==r?(z=async C=>{if(await r.expand(C)){const $=u[C]??!1;f({...u,[C]:!$})}},e[42]=u,e[43]=f,e[44]=r,e[45]=z):z=e[45],e[46]!==i||e[47]!==u||e[48]!==M||e[49]!==L||e[50]!==B||e[51]!==z||e[52]!==T?(F=h.jsx(v$,{width:"100%",ref:o,height:T,className:"h-full",data:i,initialOpenState:u,openByDefault:!1,renderCursor:JD,disableDrop:KD,onDelete:M,onRename:L,onMove:B,onSelect:O,onToggle:z,padding:15,rowHeight:30,indent:$D,overscanCount:1e3,disableMultiSelection:!0,children:GD}),e[46]=i,e[47]=u,e[48]=M,e[49]=L,e[50]=B,e[51]=z,e[52]=T,e[53]=F):F=e[53],e[54]!==F||e[55]!==r?(V=h.jsx(A2.Provider,{value:r,children:F}),e[54]=F,e[55]=r,e[56]=V):V=e[56],e[57]!==V||e[58]!==I?(P=h.jsxs(h.Fragment,{children:[I,V]}),e[57]=V,e[58]=I,e[59]=P):P=e[59],P},$D=15,HD=t=>{const e=X.c(30),{onRefresh:n,onCreateFile:o,onCreateFolder:r,onCollapseAll:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={noDrag:!0,noDragEventsBubbling:!0},e[0]=i):i=e[0];const{getRootProps:a,getInputProps:l}=I2(i);let c,d,u,f,p,_,g,m,b,x,y,v,k,S,E;return e[1]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(Sa,{size:16}),e[1]=c):c=e[1],e[2]!==o?(d=h.jsx(Re,{content:"Add file",children:h.jsx(Pe,{"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")?(u=h.jsx(Yc,{size:16}),e[4]=u):u=e[4],e[5]!==r?(f=h.jsx(Re,{content:"Add folder",children:h.jsx(Pe,{"data-testid":"file-explorer-add-folder-button",onClick:r,variant:"text",size:"xs",children:u})}),e[5]=r,e[6]=f):f=e[6],e[7]!==a?(p=a({}),e[7]=a,e[8]=p):p=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(_=kV({variant:"text",size:"xs"}),g=h.jsx(SV,{size:16}),e[9]=_,e[10]=g):(_=e[9],g=e[10]),e[11]!==p?(m=h.jsx(Re,{content:"Upload file",children:h.jsx("button",{"data-testid":"file-explorer-upload-button",...p,className:_,children:g})}),e[11]=p,e[12]=m):m=e[12],e[13]!==l?(b=l({}),e[13]=l,e[14]=b):b=e[14],e[15]!==b?(x=h.jsx("input",{...b,type:"file"}),e[15]=b,e[16]=x):x=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(y=h.jsx(E4,{size:16}),e[17]=y):y=e[17],e[18]!==n?(v=h.jsx(Re,{content:"Refresh",children:h.jsx(Pe,{"data-testid":"file-explorer-refresh-button",onClick:n,variant:"text",size:"xs",children:y})}),e[18]=n,e[19]=v):v=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(k=h.jsx(um,{size:16}),e[20]=k):k=e[20],e[21]!==s?(S=h.jsx(Re,{content:"Collapse all folders",children:h.jsx(Pe,{"data-testid":"file-explorer-collapse-button",onClick:s,variant:"text",size:"xs",children:k})}),e[21]=s,e[22]=S):S=e[22],e[23]!==x||e[24]!==v||e[25]!==S||e[26]!==d||e[27]!==f||e[28]!==m?(E=h.jsxs("div",{className:"flex items-center justify-end px-2 flex-shrink-0 border-b",children:[d,f,m,x,v,S]}),e[23]=x,e[24]=v,e[25]=S,e[26]=d,e[27]=f,e[28]=m,e[29]=E):E=e[29],E},WD=t=>{const e=X.c(9),{node:n,onOpenMarimoFile:o}=t;let r,s,i;return e[0]!==n?(r=a=>{n.data.isDirectory||(a.stopPropagation(),n.select())},e[0]=n,e[1]=r):r=e[1],e[2]!==n.data.isMarimoFile||e[3]!==o?(s=n.data.isMarimoFile&&!Bn()&&h.jsxs("span",{className:"flex-shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline",onClick:o,children:["open ",h.jsx(bc,{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=h.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},qD=t=>{const e=X.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=h.jsx("input",{ref:o,className:"flex-1 bg-transparent border border-border text-muted-foreground",defaultValue:n.data.name,onClick:XD,onBlur:i,onKeyDown:a}),e[6]=n.data.name,e[7]=i,e[8]=a,e[9]=l):l=e[9],l},GD=t=>{const e=X.c(53),{node:n,style:o,dragHandle:r}=t;let s;e[0]!==n.data.isDirectory||e[1]!==n.data.name?(s=n.data.isDirectory?"directory":X3(n.data.name),e[0]=n.data.isDirectory,e[1]=n.data.name,e[2]=s):s=e[2];const i=s,a=Z3[i],{openConfirm:l,openPrompt:c}=Un(),d=A.useContext(A2);let u;e[3]!==n.data.path||e[4]!==d?(u=async F=>{T2(F,d?d.relativeFromRoot(n.data.path):n.data.path)},e[3]=n.data.path,e[4]=d,e[5]=u):u=e[5];const f=u;let p;e[6]!==n.data.name||e[7]!==n.id||e[8]!==n.tree||e[9]!==l?(p=async F=>{F.stopPropagation(),F.preventDefault(),l({title:"Delete file",description:`Are you sure you want to delete ${n.data.name}?`,confirmAction:h.jsx(F3,{onClick:async()=>{await n.tree.delete(n.id)},"aria-label":"Confirm",children:"Delete"})})},e[6]=n.data.name,e[7]=n.id,e[8]=n.tree,e[9]=l,e[10]=p):p=e[10];const _=p;let g;e[11]!==n||e[12]!==c||e[13]!==d?(g=async()=>{n.open(),c({title:"Folder name",onConfirm:async F=>{d==null||d.createFolder(F,n.id)}})},e[11]=n,e[12]=c,e[13]=d,e[14]=g):g=e[14];const m=Qe(g);let b;e[15]!==n||e[16]!==c||e[17]!==d?(b=async()=>{n.open(),c({title:"File name",onConfirm:async F=>{d==null||d.createFile(F,n.id)}})},e[15]=n,e[16]=c,e[17]=d,e[18]=b):b=e[18];const x=Qe(b);let y;e[19]!==i||e[20]!==x||e[21]!==m||e[22]!==_||e[23]!==f||e[24]!==n||e[25]!==d?(y=()=>{const F={size:14,strokeWidth:1.5,className:"mr-2"};return h.jsxs(pc,{align:"end",className:"no-print w-[220px]",onClick:ZD,onCloseAutoFocus:QD,children:[!n.data.isDirectory&&h.jsxs(sn,{onSelect:()=>n.select(),children:[h.jsx(Gm,{...F}),"Open file"]}),!n.data.isDirectory&&!Bn()&&h.jsxs(sn,{onSelect:()=>{CV({path:n.data.path})},children:[h.jsx(bc,{...F}),"Open file in external editor"]}),n.data.isDirectory&&h.jsxs(h.Fragment,{children:[h.jsxs(sn,{onSelect:()=>x(),children:[h.jsx(Sa,{...F}),"Create file"]}),h.jsxs(sn,{onSelect:()=>m(),children:[h.jsx(Yc,{...F}),"Create folder"]}),h.jsx(zo,{})]}),h.jsxs(sn,{onSelect:()=>n.edit(),children:[h.jsx(Om,{...F}),"Rename"]}),h.jsxs(sn,{onSelect:async()=>{await yn(n.data.path),lt({title:"Copied to clipboard"})},children:[h.jsx(Ls,{...F}),"Copy path"]}),d&&h.jsxs(sn,{onSelect:async()=>{await yn(d.relativeFromRoot(n.data.path)),lt({title:"Copied to clipboard"})},children:[h.jsx(Ls,{...F}),"Copy relative path"]}),h.jsxs(sn,{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:V}=n.data,P=jV[i](V);await yn(P)},children:[h.jsx(NV,{...F}),"Copy snippet for reading file"]}),n.data.isMarimoFile&&!Bn()&&h.jsxs(h.Fragment,{children:[h.jsx(zo,{}),h.jsxs(sn,{onSelect:f,children:[h.jsx(Vm,{...F}),"Open notebook"]})]}),h.jsx(zo,{}),!n.data.isDirectory&&h.jsxs(h.Fragment,{children:[h.jsxs(sn,{onSelect:async()=>{const V=(await V4({path:n.data.path})).contents||"";oa(new Blob([V]),n.data.name)},children:[h.jsx(_p,{...F}),"Download"]}),h.jsx(zo,{})]}),h.jsxs(sn,{onSelect:_,variant:"danger",children:[h.jsx(ip,{...F}),"Delete"]})]})},e[19]=i,e[20]=x,e[21]=m,e[22]=_,e[23]=f,e[24]=n,e[25]=d,e[26]=y):y=e[26];const v=y;let k,S,E;e[27]===Symbol.for("react.memo_cache_sentinel")?(k=Oe("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group"),e[27]=k):k=e[27],e[28]!==n?(S=F=>{F.stopPropagation(),n.data.isDirectory&&n.toggle()},E=h.jsx(YD,{node:n}),e[28]=n,e[29]=S,e[30]=E):(S=e[29],E=e[30]);const j=n.willReceiveDrop&&n.data.isDirectory&&"bg-accent/80 hover:bg-accent/80 text-accent-foreground";let I,T,M,L,B,O,z;return e[31]!==j?(I=Oe("flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group",j),e[31]=j,e[32]=I):I=e[32],e[33]!==a||e[34]!==n.data.isMarimoFile?(T=n.data.isMarimoFile?h.jsx("img",{src:"./favicon.ico",className:"w-5 h-5 flex-shrink-0 mr-2 filter grayscale",alt:"Marimo"}):h.jsx(a,{className:"w-5 h-5 flex-shrink-0 mr-2",strokeWidth:1.5}),e[33]=a,e[34]=n.data.isMarimoFile,e[35]=T):T=e[35],e[36]!==f||e[37]!==n?(M=n.isEditing?h.jsx(qD,{node:n}):h.jsx(WD,{node:n,onOpenMarimoFile:f}),e[36]=f,e[37]=n,e[38]=M):M=e[38],e[39]===Symbol.for("react.memo_cache_sentinel")?(L=h.jsx(fc,{asChild:!0,tabIndex:-1,onClick:eR,children:h.jsx(Pe,{"data-testid":"file-explorer-more-button",variant:"text",tabIndex:-1,size:"xs",className:"mb-0","aria-label":"More options",children:h.jsx(Gc,{strokeWidth:2,className:"w-5 h-5 hidden group-hover:block"})})}),e[39]=L):L=e[39],e[40]!==v?(B=h.jsxs(hc,{modal:!1,children:[L,v()]}),e[40]=v,e[41]=B):B=e[41],e[42]!==I||e[43]!==T||e[44]!==M||e[45]!==B?(O=h.jsxs("span",{className:I,children:[T,M,B]}),e[42]=I,e[43]=T,e[44]=M,e[45]=B,e[46]=O):O=e[46],e[47]!==r||e[48]!==o||e[49]!==O||e[50]!==S||e[51]!==E?(z=h.jsxs("div",{style:o,ref:r,className:k,draggable:!0,onClick:S,children:[E,O]}),e[47]=r,e[48]=o,e[49]=O,e[50]=S,e[51]=E,e[52]=z):z=e[52],z},YD=t=>{const e=X.c(3),{node:n}=t;if(!n.data.isDirectory){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=h.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?h.jsx(Zi,{className:"w-5 h-5 flex-shrink-0"}):h.jsx(lc,{className:"w-5 h-5 flex-shrink-0"}),e[1]=n.isOpen,e[2]=o):o=e[2],o};function T2(t,e){t.stopPropagation(),t.preventDefault(),window.open(`/?file=${e}`,"_blank")}function JD(){return null}function KD(t){const{parentNode:e}=t;return!e.data.isDirectory}function XD(t){return t.stopPropagation()}function ZD(t){return t.stopPropagation()}function QD(t){return t.preventDefault()}function eR(t){return t.stopPropagation()}const tR=()=>{const t=X.c(20),{ref:e,height:n}=om(),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}=I2(r);let l,c,d,u,f,p,_,g;return t[1]!==s?(l=s(),t[1]=s,t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(c=Oe("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?(u=h.jsx("input",{...d}),t[6]=d,t[7]=u):u=t[7],t[8]!==a?(f=a&&h.jsx("div",{className:"absolute inset-0 flex items-center uppercase justify-center text-xl font-bold text-primary/90 bg-accent/85 z-10 border-2 border-dashed border-primary/90 rounded-lg pointer-events-none",children:"Drop files here"}),t[8]=a,t[9]=f):f=t[9],t[10]!==o?(p=h.jsx(VD,{height:o}),t[10]=o,t[11]=p):p=t[11],t[12]!==e||t[13]!==p?(_=h.jsx("div",{ref:e,className:"flex flex-col flex-1 overflow-hidden",children:p}),t[12]=e,t[13]=p,t[14]=_):_=t[14],t[15]!==l||t[16]!==u||t[17]!==f||t[18]!==_?(g=h.jsxs("div",{...l,className:c,children:[u,f,_]}),t[15]=l,t[16]=u,t[17]=f,t[18]=_,t[19]=g):g=t[19],g},nR=t=>{const e=X.c(6),{children:n}=t,{openModal:o,closeModal:r}=Un();let s,i;return e[0]!==r||e[1]!==o?(s=()=>o(h.jsx(rR,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(i=h.jsx(P4,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=i):i=e[5],i},oR=[st.lineWrapping],rR=t=>{const e=X.c(23),{onClose:n}=t,[o,r]=A.useState(""),{theme:s}=Fo();let i,a,l,c,d,u;e[0]!==n?(i=async y=>{y.preventDefault();const v=new FormData(y.target),k=v.get("title"),S=v.get("description"),E=v.get("code");fetch("https://marimo.io/api/suggest-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:k,description:S,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=h.jsx(dr,{children:"Contribute a Snippet"}),e[2]=a):a=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsxs(Os,{children:[a,h.jsxs(Ps,{children:["Have a useful snippet you want to share with the community? Submit it here or make a pull request"," ",h.jsx("a",{href:Kn.githubPage,target:"_blank",className:"underline",children:"on GitHub"}),"."]})]}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(ur,{id:"title",name:"title",autoFocus:!0,placeholder:"Title",required:!0,autoComplete:"off"}),d=h.jsx(EV,{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?(u=h.jsx("input",{type:"hidden",name:"code",value:o}),e[6]=o,e[7]=u):u=e[7];const f=s==="dark"?"dark":"light";let p,_,g,m,b,x;return e[8]!==o||e[9]!==f?(p=h.jsx(_a,{theme:f,language:"python",className:"cm border rounded overflow-hidden",extensions:oR,value:o,onChange:r}),e[8]=o,e[9]=f,e[10]=p):p=e[10],e[11]!==u||e[12]!==p?(_=h.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[c,d,u,p]}),e[11]=u,e[12]=p,e[13]=_):_=e[13],e[14]!==n?(g=h.jsx(Pe,{"data-testid":"snippet-cancel-button",variant:"secondary",onClick:n,children:"Cancel"}),e[14]=n,e[15]=g):g=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(m=h.jsx(Pe,{"data-testid":"snippet-send-button","aria-label":"Save",variant:"default",type:"submit",children:"Send"}),e[16]=m):m=e[16],e[17]!==g?(b=h.jsxs(ea,{children:[g,m]}),e[17]=g,e[18]=b):b=e[18],e[19]!==i||e[20]!==b||e[21]!==_?(x=h.jsx(cr,{className:"w-fit",children:h.jsxs("form",{onSubmit:i,children:[l,_,b]})}),e[19]=i,e[20]=b,e[21]=_,e[22]=x):x=e[22],x},sR=[st.lineWrapping],iR=()=>{const t=X.c(20),[e,n]=K.useState();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const{data:r,error:s,loading:i}=Xn(cR,o);if(s){let b;return t[1]!==s?(b=h.jsx(Xs,{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=h.jsx(Qn,{size:"medium",centered:!0}),t[3]=b):b=t[3],b}const a=e?"h-1/3":"h-full";let l,c,d,u,f,p,_,g,m;return t[4]!==a?(l=Oe("border-b rounded-none",a),t[4]=a,t[5]=l):l=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(Qi,{placeholder:"Search snippets...",className:"h-6 m-1",rootClassName:"flex-1 border-r"}),t[6]=c):c=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsxs("div",{className:"flex items-center w-full",children:[c,h.jsx(nR,{children:h.jsx("button",{className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:h.jsx(Lr,{className:"h-4 w-4"})})})]}),u=h.jsx(dc,{children:"No results"}),t[7]=d,t[8]=u):(d=t[7],u=t[8]),t[9]===Symbol.for("react.memo_cache_sentinel")?(f=b=>n(b),t[9]=f):f=t[9],t[10]!==r.snippets?(p=h.jsx(lR,{onSelect:f,snippets:r.snippets}),t[10]=r.snippets,t[11]=p):p=t[11],t[12]!==l||t[13]!==p?(_=h.jsxs(xc,{className:l,children:[d,u,p]}),t[12]=l,t[13]=p,t[14]=_):_=t[14],t[15]!==e?(g=h.jsx(A.Suspense,{children:h.jsx("div",{className:"h-2/3 snippet-viewer flex flex-col",children:e?h.jsx(aR,{snippet:e},e.title):h.jsx(In,{title:"",description:"Click on a snippet to view its content."})})}),t[15]=e,t[16]=g):g=t[16],t[17]!==_||t[18]!==g?(m=h.jsxs("div",{className:"flex-1 overflow-hidden",children:[_,g]}),t[17]=_,t[18]=g,t[19]=m):m=t[19],m},aR=t=>{const e=X.c(27),{snippet:n}=t,{theme:o}=Fo(),{createNewCell:r}=Lt(),s=zs();let i;e[0]!==r||e[1]!==s||e[2]!==n.sections?(i=()=>{for(const m of[...n.sections].reverse())m.code&&r({code:m.code,before:!1,cellId:s??"__end__",skipIfCodeExists:!0})},e[0]=r,e[1]=s,e[2]=n.sections,e[3]=i):i=e[3];const a=i;let l;e[4]!==r||e[5]!==s?(l=m=>{r({code:m,before:!1,cellId:s??"__end__"})},e[4]=r,e[5]=s,e[6]=l):l=e[6];const c=l;let d,u,f,p,_,g;if(e[7]!==n.title?(d=h.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")?(u=h.jsx(ti,{className:"ml-2 h-4 w-4"}),e[9]=u):u=e[9],e[10]!==a?(f=h.jsx("div",{className:"flex justify-end",children:h.jsx(ri,{children:h.jsxs(Pe,{className:"float-right",size:"xs",variant:"outline",onClick:a,children:["Insert snippet",u]})})}),e[10]=a,e[11]=f):f=e[11],e[12]!==c||e[13]!==n.sections||e[14]!==n.title||e[15]!==o){let m;e[17]!==c||e[18]!==n.title||e[19]!==o?(m=b=>{const{code:x,html:y,id:v}=b;return y?h.jsx("div",{children:Up({html:y})},`${n.title}-${v}`):x?h.jsxs("div",{className:"relative hover-actions-parent pr-2",children:[h.jsx(ri,{children:h.jsx(Re,{content:"Insert snippet",children:h.jsx(Pe,{className:"absolute -top-2 -right-1 z-10 hover-action px-2 bg-background",size:"sm",variant:"outline",onClick:()=>{c(x)},children:h.jsx(ti,{className:"h-5 w-5"})})})}),h.jsx(_a,{theme:o==="dark"?"dark":"light",language:"python",className:"cm border rounded overflow-hidden",extensions:sR,value:x,readOnly:!0},`${n.title}-${v}`)]},`${n.title}-${v}`):null},e[17]=c,e[18]=n.title,e[19]=o,e[20]=m):m=e[20],p=n.sections.map(m),e[12]=c,e[13]=n.sections,e[14]=n.title,e[15]=o,e[16]=p}else p=e[16];return e[21]!==f||e[22]!==p?(_=h.jsxs("div",{className:"px-2 py-2 space-y-4 overflow-auto flex-1",children:[f,p]}),e[21]=f,e[22]=p,e[23]=_):_=e[23],e[24]!==d||e[25]!==_?(g=h.jsxs(h.Fragment,{children:[d,_]}),e[24]=d,e[25]=_,e[26]=g):g=e[26],g},lR=t=>{const e=X.c(7),{snippets:n,onSelect:o}=t;let r,s;if(e[0]!==o||e[1]!==n){let i;e[3]!==o?(i=a=>h.jsx(po,{className:"rounded-none",onSelect:()=>o(a),children:h.jsx("div",{className:"flex flex-row gap-2 items-center",children:h.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=h.jsx(Tp,{className:"flex flex-col overflow-auto",children:r}),e[5]=r,e[6]=s):s=e[6],s};function cR(){return IV()}const dR=t=>{const e=X.c(8),{variableName:n,className:o}=t;let r;e[0]!==n?(r=()=>{const l=function(d){const u=ut.get(H4)[d];if(u)return u.declaredBy[0]}(n);if(!l)return;const c=rc(l);c&&Hp(c,n)},e[0]=n,e[1]=r):r=e[1];const s=r;let i,a;return e[2]!==o?(i=Oe("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=h.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},uR=Zt(t=>{const e=t(AV),n=t(H4),o=t(D4);return xa(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})}),hR=Zt(t=>{const e=new Map(t(TV));for(const n of W4){const o=e.get(n);o&&o.databases.length===0&&e.delete(n)}return xa([...e.values()],n=>W4.has(n.name)?1:0)}),fR=()=>{const t=X.c(32),[e,n]=K.useState(""),o=Qt(q4),r=He(uR),s=He(hR);if(r.length===0&&s.length===0){let b;return t[0]===Symbol.for("react.memo_cache_sentinel")?(b=h.jsx(In,{title:"No tables found",description:"Any datasets/dataframes in the global scope will be shown here.",action:h.jsx(jg,{children:h.jsxs(Pe,{variant:"outline",size:"sm",children:["Add database or catalog",h.jsx(Lr,{className:"h-4 w-4 ml-2"})]})}),icon:h.jsx(lr,{})}),t[0]=b):b=t[0],b}const i=!!e.trim();let a,l,c,d,u,f,p,_,g,m;if(t[1]!==o?(a=b=>{o(b.length>0),n(b)},t[1]=o,t[2]=a):a=t[2],t[3]!==e||t[4]!==a?(l=h.jsx(Qi,{placeholder:"Search tables...",className:"h-6 m-1",value:e,onValueChange:a,rootClassName:"flex-1 border-r"}),t[3]=e,t[4]=a,t[5]=l):l=t[5],t[6]!==i?(c=i&&h.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:h.jsx(go,{className:"h-4 w-4"})}),t[6]=i,t[7]=c):c=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsx(jg,{children:h.jsx("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:h.jsx(Lr,{className:"h-4 w-4"})})}),t[8]=d):d=t[8],t[9]!==l||t[10]!==c?(u=h.jsxs("div",{className:"flex items-center w-full",children:[l,c,d]}),t[9]=l,t[10]=c,t[11]=u):u=t[11],t[12]!==s||t[13]!==i||t[14]!==e){let b;t[16]!==i||t[17]!==e?(b=x=>h.jsx(pR,{connection:x,hasChildren:x.databases.length>0,children:x.databases.map(y=>h.jsx(mR,{engineName:x.name,database:y,hasSearch:i,children:h.jsx(gR,{schemas:y.schemas,defaultSchema:x.default_schema,defaultDatabase:x.default_database,engineName:x.name,databaseName:y.name,hasSearch:i,searchValue:e})},y.name))},x.name),t[16]=i,t[17]=e,t[18]=b):b=t[18],f=s.map(b),t[12]=s,t[13]=i,t[14]=e,t[15]=f}else f=t[15];return t[19]!==s.length||t[20]!==r.length?(p=s.length>0&&r.length>0&&h.jsxs(G4,{children:[h.jsx(ac,{className:"h-4 w-4 text-muted-foreground"}),h.jsx("span",{className:"text-xs",children:"Python"})]}),t[19]=s.length,t[20]=r.length,t[21]=p):p=t[21],t[22]!==e||t[23]!==r?(_=r.length>0&&h.jsx(M2,{tables:r,searchValue:e}),t[22]=e,t[23]=r,t[24]=_):_=t[24],t[25]!==f||t[26]!==p||t[27]!==_?(g=h.jsxs(Tp,{className:"flex flex-col",children:[f,p,_]}),t[25]=f,t[26]=p,t[27]=_,t[28]=g):g=t[28],t[29]!==u||t[30]!==g?(m=h.jsxs(xc,{className:"border-b bg-background rounded-none h-full pb-10 overflow-auto outline-none",shouldFilter:!1,children:[u,g]}),t[29]=u,t[30]=g,t[31]=m):m=t[31],m},pR=t=>{const e=X.c(25),{connection:n,children:o,hasChildren:r}=t,s=n.name===MV,i=s?"In-Memory":n.name,[a,l]=K.useState(!1);let c;e[0]!==n.name?(c=async()=>{l(!0),await DV({engine:n.name}),setTimeout(()=>l(!1),500)},e[0]=n.name,e[1]=c):c=e[1];const d=c;let u,f,p;e[2]!==n.dialect?(u=h.jsx(q3,{className:"h-4 w-4 text-muted-foreground",name:n.dialect}),e[2]=n.dialect,e[3]=u):u=e[3],e[4]!==n.dialect?(f=OV(n.dialect),e[4]=n.dialect,e[5]=f):f=e[5],e[6]!==f?(p=h.jsx("span",{className:"text-xs",children:f}),e[6]=f,e[7]=p):p=e[7];const _=i;let g,m,b,x,y;return e[8]!==_?(g=h.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",h.jsx(dR,{variableName:_}),")"]}),e[8]=_,e[9]=g):g=e[9],e[10]!==d||e[11]!==s||e[12]!==a?(m=!s&&h.jsx(Re,{content:"Refresh connection",children:h.jsx(Pe,{variant:"ghost",size:"icon",className:"ml-auto hover:bg-transparent hover:shadow-none",onClick:d,children:h.jsx(Ic,{className:Oe("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]=m):m=e[13],e[14]!==u||e[15]!==p||e[16]!==g||e[17]!==m?(b=h.jsxs(G4,{children:[u,p,g,m]}),e[14]=u,e[15]=p,e[16]=g,e[17]=m,e[18]=b):b=e[18],e[19]!==o||e[20]!==r?(x=r?o:h.jsx(zc,{content:"No databases available",className:"pl-2"}),e[19]=o,e[20]=r,e[21]=x):x=e[21],e[22]!==b||e[23]!==x?(y=h.jsxs(h.Fragment,{children:[b,x]}),e[22]=b,e[23]=x,e[24]=y):y=e[24],y},mR=t=>{const e=X.c(28),{hasSearch:n,engineName:o,database:r,children:s}=t,[i,a]=K.useState(!1),[l,c]=K.useState(!1);let d,u,f;e[0]!==n?(d=()=>{a(n)},u=[n],e[0]=n,e[1]=d,e[2]=u):(d=e[1],u=e[2]),K.useEffect(d,u),e[3]!==i||e[4]!==l?(f=()=>{a(!i),c(!l)},e[3]=i,e[4]=l,e[5]=f):f=e[5];const p=`${o}:${r.name}`;let _;e[6]!==i?(_=h.jsx(Z4,{isExpanded:i}),e[6]=i,e[7]=_):_=e[7];const g=l&&i?"text-foreground":"text-muted-foreground";let m,b;e[8]!==g?(m=Oe("h-4 w-4",g),e[8]=g,e[9]=m):m=e[9],e[10]!==m?(b=h.jsx(lr,{className:m}),e[10]=m,e[11]=b):b=e[11];const x=l&&i&&"font-semibold";let y,v,k,S;e[12]!==x?(y=Oe(x),e[12]=x,e[13]=y):y=e[13],e[14]!==r.name?(v=r.name===""?h.jsx("i",{children:"Not connected"}):r.name,e[14]=r.name,e[15]=v):v=e[15],e[16]!==y||e[17]!==v?(k=h.jsx("span",{className:y,children:v}),e[16]=y,e[17]=v,e[18]=k):k=e[18],e[19]!==k||e[20]!==f||e[21]!==p||e[22]!==_||e[23]!==b?(S=h.jsxs(po,{className:"text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",onSelect:f,value:p,children:[_,b,k]}),e[19]=k,e[20]=f,e[21]=p,e[22]=_,e[23]=b,e[24]=S):S=e[24];const E=i&&s;let j;return e[25]!==S||e[26]!==E?(j=h.jsxs(h.Fragment,{children:[S,E]}),e[25]=S,e[26]=E,e[27]=j):j=e[27],j},gR=t=>{const e=X.c(20),{schemas:n,defaultSchema:o,defaultDatabase:r,engineName:s,databaseName:i,hasSearch:a,searchValue:l}=t;if(n.length===0){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=h.jsx(zc,{content:"No schemas available",className:"pl-6"}),e[0]=u):u=e[0],u}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 u;e[9]!==l?(u=_=>!l||_.tables.some(g=>g.name.toLowerCase().includes(l.toLowerCase())),e[9]=l,e[10]=u):u=e[10];const f=n.filter(u);let p;e[11]!==i||e[12]!==r||e[13]!==o||e[14]!==s||e[15]!==a||e[16]!==l?(p=_=>h.jsx(_R,{databaseName:i,schema:_,hasSearch:a,children:h.jsx(M2,{tables:_.tables,searchValue:l,sqlTableContext:{engine:s,database:i,schema:_.name,defaultSchema:o,defaultDatabase:r}})},_.name),e[11]=i,e[12]=r,e[13]=o,e[14]=s,e[15]=a,e[16]=l,e[17]=p):p=e[17],c=f.map(p),e[1]=i,e[2]=r,e[3]=o,e[4]=s,e[5]=a,e[6]=n,e[7]=l,e[8]=c}else c=e[8];return e[18]!==c?(d=h.jsx(h.Fragment,{children:c}),e[18]=c,e[19]=d):d=e[19],d},_R=t=>{const e=X.c(26),{databaseName:n,schema:o,children:r,hasSearch:s}=t,[i,a]=K.useState(!1),[l,c]=K.useState(!1),d=`${n}:${o.name}`;let u,f,p,_;if(e[0]!==s?(u=()=>{a(s)},f=[s],e[0]=s,e[1]=u,e[2]=f):(u=e[1],f=e[2]),K.useEffect(u,f),X4(o.name))return r;e[3]!==i||e[4]!==l?(p=()=>{a(!i),c(!l)},e[3]=i,e[4]=l,e[5]=p):p=e[5],e[6]!==i?(_=h.jsx(Z4,{isExpanded:i}),e[6]=i,e[7]=_):_=e[7];const g=l&&i&&"text-foreground";let m,b;e[8]!==g?(m=Oe("h-4 w-4 text-muted-foreground",g),e[8]=g,e[9]=m):m=e[9],e[10]!==m?(b=h.jsx(UV,{className:m}),e[10]=m,e[11]=b):b=e[11];const x=l&&i&&"font-semibold";let y,v,k;e[12]!==x?(y=Oe(x),e[12]=x,e[13]=y):y=e[13],e[14]!==o.name||e[15]!==y?(v=h.jsx("span",{className:y,children:o.name}),e[14]=o.name,e[15]=y,e[16]=v):v=e[16],e[17]!==v||e[18]!==p||e[19]!==_||e[20]!==b||e[21]!==d?(k=h.jsxs(po,{className:"text-sm flex flex-row gap-1 items-center pl-5 cursor-pointer rounded-none",onSelect:p,value:d,children:[_,b,v]}),e[17]=v,e[18]=p,e[19]=_,e[20]=b,e[21]=d,e[22]=k):k=e[22];const S=i&&r;let E;return e[23]!==k||e[24]!==S?(E=h.jsxs(h.Fragment,{children:[k,S]}),e[23]=k,e[24]=S,e[25]=E):E=e[25],E},M2=t=>{const e=X.c(24),{tables:n,sqlTableContext:o,searchValue:r}=t,{addTableList:s}=Y4(),[i,a]=K.useState(!1),[l,c]=K.useState(!1);let d,u;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:m,database:b,schema:x}=o,y=await H$.request({engine:m,database:b,schema:x});if(!(y!=null&&y.tables))throw c(!1),new Error("No tables available");s({tables:y.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?(u=[n.length,o,i],e[5]=o,e[6]=n.length,e[7]=i,e[8]=u):u=e[8];const{loading:f,error:p}=Xn(d,u);if(f||l){let m;return e[9]===Symbol.for("react.memo_cache_sentinel")?(m=h.jsx(J4,{message:"Loading tables...",className:"pl-12"}),e[9]=m):m=e[9],m}if(p){let m;return e[10]!==p?(m=h.jsx(K4,{error:p,className:"pl-12"}),e[10]=p,e[11]=m):m=e[11],m}if(n.length===0){let m;return e[12]===Symbol.for("react.memo_cache_sentinel")?(m=h.jsx(zc,{content:"No tables found",className:"pl-9"}),e[12]=m):m=e[12],m}let _,g;if(e[13]!==r||e[14]!==o||e[15]!==n){let m;e[17]!==r?(m=y=>!r||y.name.toLowerCase().includes(r.toLowerCase()),e[17]=r,e[18]=m):m=e[18];const b=n.filter(m);let x;e[19]!==r||e[20]!==o?(x=y=>h.jsx(bR,{table:y,sqlTableContext:o,isSearching:!!r},y.name),e[19]=r,e[20]=o,e[21]=x):x=e[21],_=b.map(x),e[13]=r,e[14]=o,e[15]=n,e[16]=_}else _=e[16];return e[22]!==_?(g=h.jsx(h.Fragment,{children:_}),e[22]=_,e[23]=g):g=e[23],g},bR=t=>{const e=X.c(62),{table:n,sqlTableContext:o,isSearching:r}=t,{addTable:s}=Y4(),[i,a]=K.useState(!1),[l,c]=K.useState(!1),d=n.columns.length>0;let u,f;e[0]!==s||e[1]!==i||e[2]!==o||e[3]!==n.name||e[4]!==d||e[5]!==l?(u=async()=>{if(i&&!d&&o&&!l){c(!0);const{engine:q,database:re,schema:ne}=o,oe=await W$.request({engine:q,database:re,schema:ne,tableName:n.name});if(!(oe!=null&&oe.table))throw new Error("No table details available");s({table:oe.table,sqlTableContext:o})}},e[0]=s,e[1]=i,e[2]=o,e[3]=n.name,e[4]=d,e[5]=l,e[6]=u):u=e[6],e[7]!==i||e[8]!==d?(f=[i,d],e[7]=i,e[8]=d,e[9]=f):f=e[9];const{loading:p,error:_}=Xn(u,f),g=He(Ts),m=zs(),{createNewCell:b}=Lt();let x;e[10]!==g||e[11]!==b||e[12]!==m||e[13]!==o||e[14]!==n?(x=()=>{ar(g,b,m),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 Q4(n,"*",o);switch(n.source_type){case"local":return`mo.ui.table(${n.name})`;case"duckdb":case"connection":return Q4(n,"*",o);default:return oc(n.source_type),""}})(),before:!1,cellId:m??"__end__"})},e[10]=g,e[11]=b,e[12]=m,e[13]=o,e[14]=n,e[15]=x):x=e[15];const y=x;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:h.jsx("div",{className:"flex flex-row gap-2 items-center pl-6 group-hover:hidden",children:h.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 k=v;let S;e[19]!==_||e[20]!==p||e[21]!==o||e[22]!==n?(S=()=>{if(p)return h.jsx(J4,{message:"Loading columns...",className:"pl-12"});if(_)return h.jsx(K4,{error:_,className:"pl-12"});const q=n.columns;return q.length===0?h.jsx(zc,{content:"No columns found",className:"pl-12"}):q.map(re=>h.jsx(yR,{table:n,column:re,sqlTableContext:o},re.name))},e[19]=_,e[20]=p,e[21]=o,e[22]=n,e[23]=S):S=e[23];const E=S;let j;e[24]!==i||e[25]!==r||e[26]!==n.source_type||e[27]!==n.type?(j=()=>{if(n.source_type==="local")return;const q=n.type==="table"?RV:T3;return h.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]=j):j=e[28];const I=j,T=o?`${o.database}.${o.schema}.${n.name}`:n.name,M=o&&(X4(o.schema)?"pl-9":"pl-12"),L=(i||r)&&"font-semibold";let B,O,z,F,V,P,C,$,N,H,G,Z;return e[29]!==M||e[30]!==L?(B=Oe("rounded-none group h-8 cursor-pointer",M,L),e[29]=M,e[30]=L,e[31]=B):B=e[31],e[32]!==i?(O=()=>a(!i),e[32]=i,e[33]=O):O=e[33],e[34]!==I?(z=I(),e[34]=I,e[35]=z):z=e[35],e[36]!==n.name?(F=h.jsx("span",{className:"text-sm",children:n.name}),e[36]=n.name,e[37]=F):F=e[37],e[38]!==z||e[39]!==F?(V=h.jsxs("div",{className:"flex gap-2 items-center flex-1",children:[z,F]}),e[38]=z,e[39]=F,e[40]=V):V=e[40],e[41]!==k?(P=k(),e[41]=k,e[42]=P):P=e[42],e[43]!==y?(C=Vn.stopPropagation(()=>y()),e[43]=y,e[44]=C):C=e[44],e[45]===Symbol.for("react.memo_cache_sentinel")?($=h.jsx(PV,{className:"h-3 w-3"}),e[45]=$):$=e[45],e[46]!==C?(N=h.jsx(Re,{content:"Add table to notebook",delayDuration:400,children:h.jsx(Pe,{className:"group-hover:inline-flex hidden",variant:"text",size:"icon",onClick:C,children:$})}),e[46]=C,e[47]=N):N=e[47],e[48]!==i||e[49]!==O||e[50]!==V||e[51]!==P||e[52]!==N||e[53]!==B||e[54]!==T?(H=h.jsxs(po,{className:B,value:T,"aria-selected":i,forceMount:!0,onSelect:O,children:[V,P,N]}),e[48]=i,e[49]=O,e[50]=V,e[51]=P,e[52]=N,e[53]=B,e[54]=T,e[55]=H):H=e[55],e[56]!==i||e[57]!==E?(G=i&&E(),e[56]=i,e[57]=E,e[58]=G):G=e[58],e[59]!==H||e[60]!==G?(Z=h.jsxs(h.Fragment,{children:[H,G]}),e[59]=H,e[60]=G,e[61]=Z):Z=e[61],Z},yR=t=>{var G,Z;const e=X.c(53),{table:n,column:o,sqlTableContext:r}=t,[s,i]=K.useState(!1),a=He(q4),l=Qt(LV);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]),K.useEffect(c,d),l(s?q=>new Set([...q,`${n.name}:${o.name}`]):q=>(q.delete(`${n.name}:${o.name}`),new Set(q)));const u=He(Ts),f=zs(),{createNewCell:p}=Lt(),{columnsPreviews:_}=FV();let g;e[3]!==o.name||e[4]!==n.primary_keys?(g=((G=n.primary_keys)==null?void 0:G.includes(o.name))||!1,e[3]=o.name,e[4]=n.primary_keys,e[5]=g):g=e[5];const m=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 x=b;let y;e[9]!==u||e[10]!==p||e[11]!==f?(y=q=>{q.includes("alt")&&VV(u,p,f),p({code:q,before:!1,cellId:f??"__end__"})},e[9]=u,e[10]=p,e[11]=f,e[12]=y):y=e[12];const v=y,k=xR,S=s?"font-semibold":"";let E;e[13]!==o.name||e[14]!==S?(E=h.jsx("span",{className:S,children:o.name}),e[13]=o.name,e[14]=S,e[15]=E):E=e[15];const j=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 L=r?"pl-14":"pl-7";let B,O,z,F,V,P,C,$,N,H;return e[18]!==L?(B=Oe("flex flex-row gap-2 items-center flex-1",L),e[18]=L,e[19]=B):B=e[19],e[20]!==o.type||e[21]!==j?(O=h.jsx(zV,{columnName:j,dataType:o.type}),e[20]=o.type,e[21]=j,e[22]=O):O=e[22],e[23]!==m?(z=m&&k({tooltipContent:"Primary key",content:"PK"}),e[23]=m,e[24]=z):z=e[24],e[25]!==x?(F=x&&k({tooltipContent:"Indexed",content:"IDX"}),e[25]=x,e[26]=F):F=e[26],e[27]!==B||e[28]!==O||e[29]!==z||e[30]!==F?(V=h.jsxs("div",{className:B,children:[O,z,F]}),e[27]=B,e[28]=O,e[29]=z,e[30]=F,e[31]=V):V=e[31],e[32]!==o.name?(P=h.jsx(Re,{content:"Copy column name",delayDuration:400,children:h.jsx(Pe,{variant:"text",size:"icon",className:"group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground",children:h.jsx(eS,{tooltip:!1,value:o.name,className:"h-3 w-3"})})}),e[32]=o.name,e[33]=P):P=e[33],e[34]!==o.external_type?(C=h.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]!==P||e[39]!==C||e[40]!==I||e[41]!==T?($=h.jsxs(po,{className:"rounded-none py-1 group cursor-pointer",value:T,onSelect:M,children:[V,P,C]},I),e[36]=M,e[37]=V,e[38]=P,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?(N=s&&h.jsx("div",{className:"pl-10 pr-2 py-2 bg-[var(--slate-1)] shadow-inner border-b",children:h.jsx(wc,{children:h.jsx(BV,{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]=N):N=e[49],e[50]!==$||e[51]!==N?(H=h.jsxs(h.Fragment,{children:[$,N]}),e[50]=$,e[51]=N,e[52]=H):H=e[52],H};function xR(t){const{tooltipContent:e,content:n}=t;return h.jsx(Re,{content:e,delayDuration:100,children:h.jsx("span",{className:"text-xs text-black bg-gray-100 dark:invert rounded px-1",children:n})})}const wR=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=h.jsx(fR,{}),t[0]=e):e=t[0],e},vR=t=>{const e=X.c(4),{isOpen:n,children:o}=t,[r,s]=K.useState(!1);let i,a;return e[0]!==r||e[1]!==n?(i=()=>{n&&!r&&s(!0)},a=[n,r],e[0]=r,e[1]=n,e[2]=i,e[3]=a):(i=e[2],a=e[3]),K.useEffect(i,a),r?o:null},lf=I3("marimo:scratchpadHistory:v1",[]),kR=Zt(!1),SR=Zt(null,(t,e,n)=>{if(!(n=n.trim()))return;const o=t(lf),r=[n,...o.filter(s=>s!==n)].slice(0,15);e(lf,r)}),CR={hide_code:!1,disabled:!1},NR=()=>{const t=X.c(69),e=vc(),[n]=Ds(),{theme:o}=Fo(),r=A.useRef(null),s=zs(),{createNewCell:i,updateCellCode:a}=Lt(),l=e.cellRuntime[mr],c=l==null?void 0:l.output,d=l==null?void 0:l.status,u=l==null?void 0:l.consoleOutputs,f=e.cellData[mr],p=(f==null?void 0:f.code)??"",_=Qt(SR),[g,m]=fn(kR),b=He(lf);let x;t[0]!==_||t[1]!==p?(x=()=>{tS({code:p}),_(p)},t[0]=_,t[1]=p,t[2]=x):x=t[2];const y=Qe(x);let v;t[3]!==p||t[4]!==i||t[5]!==s?(v=()=>{p.trim()&&i({code:p,before:!1,cellId:s??"__end__"})},t[3]=p,t[4]=i,t[5]=s,t[6]=v):v=t[6];const k=Qe(v);let S;t[7]!==a?(S=()=>{a({cellId:mr,code:"",formattingChange:!1}),tS({code:""});const ae=r.current;ae&&ae.dispatch({changes:{from:0,to:ae.state.doc.length,insert:""}})},t[7]=a,t[8]=S):S=t[8];const E=Qe(S);let j;t[9]!==m||t[10]!==a?(j=ae=>{m(!1),a({cellId:mr,code:ae,formattingChange:!1});const ve=r.current;ve&&ve.dispatch({changes:{from:0,to:ve.state.doc.length,insert:ae}})},t[9]=m,t[10]=a,t[11]=j):j=t[11];const I=Qe(j),[T,M]=A.useState();let L;t[12]!==p||t[13]!==u||t[14]!==y||t[15]!==T||t[16]!==c||t[17]!==o||t[18]!==n?(L=()=>h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[40%]",children:h.jsx(Fu,{theme:o,allowFocus:!1,showPlaceholder:!1,id:mr,code:p,config:CR,status:"idle",serializedEditorState:null,runCell:y,userConfig:n,editorViewRef:r,setEditorView:ae=>{r.current=ae},hidden:!1,temporarilyShowCode:jn.NOOP,languageAdapter:T,setLanguageAdapter:M})}),h.jsx("div",{className:"flex-1 overflow-auto flex-shrink-0",children:h.jsx(Rc,{allowExpand:!1,output:c,className:"output-area",cellId:mr,stale:!1,loading:!1})}),h.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[35%]",children:h.jsx(Zp,{consoleOutputs:u,className:"overflow-auto",stale:!1,cellName:$V,onSubmitDebugger:jn.NOOP,cellId:mr,debuggerActive:!1})})]}),t[12]=p,t[13]=u,t[14]=y,t[15]=T,t[16]=c,t[17]=o,t[18]=n,t[19]=L):L=t[19];const B=L;let O;t[20]!==I||t[21]!==b||t[22]!==g||t[23]!==o?(O=()=>g?h.jsx("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:h.jsx("div",{className:"overflow-auto flex flex-col gap-3",children:b.map((ae,ve)=>h.jsx("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>I(ae),children:h.jsx(_a,{language:"python",theme:o,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:ae.trim(),editable:!1,readOnly:!0})},ve))})}):null,t[20]=I,t[21]=b,t[22]=g,t[23]=o,t[24]=O):O=t[24];const z=O;let F,V,P,C,$,N,H,G,Z,q,re;t[25]===Symbol.for("react.memo_cache_sentinel")?(F=Fs.create(mr),V=h.jsx("p",{className:"mx-2 my-2 text-muted-foreground text-sm",children:"Use this scratchpad cell to experiment with code without restrictions on variable names. Scratchpad code is ephemeral: variables defined in the scratchpad aren't saved to notebook memory, and the code is not saved in the notebook file."}),t[25]=F,t[26]=V):(F=t[25],V=t[26]),t[27]===Symbol.for("react.memo_cache_sentinel")?(P=pn("cell.run"),t[27]=P):P=t[27],t[28]===Symbol.for("react.memo_cache_sentinel")?(C=h.jsx(Qs,{color:"var(--grass-11)",size:16}),t[28]=C):C=t[28],t[29]!==y||t[30]!==g?($=h.jsx(Re,{content:P,children:h.jsx(Pe,{"data-testid":"scratchpad-run-button",onClick:y,disabled:g,variant:"text",size:"xs",children:C})}),t[29]=y,t[30]=g,t[31]=$):$=t[31],t[32]===Symbol.for("react.memo_cache_sentinel")?(N=h.jsx(fm,{size:16}),t[32]=N):N=t[32],t[33]!==E||t[34]!==g?(H=h.jsx(Re,{content:"Clear code and outputs",children:h.jsx(Pe,{disabled:g,size:"xs",variant:"text",onClick:E,children:N})}),t[33]=E,t[34]=g,t[35]=H):H=t[35],t[36]===Symbol.for("react.memo_cache_sentinel")?(G=h.jsx(ti,{size:16}),t[36]=G):G=t[36],t[37]!==k||t[38]!==g?(Z=h.jsx(ri,{children:h.jsx(Re,{content:"Insert code",children:h.jsx(Pe,{disabled:g,size:"xs",variant:"text",onClick:k,children:G})})}),t[37]=k,t[38]=g,t[39]=Z):Z=t[39],t[40]!==d?(q=(d==="running"||d==="queued")&&h.jsx(Qn,{className:"inline",size:"small"}),t[40]=d,t[41]=q):q=t[41],t[42]===Symbol.for("react.memo_cache_sentinel")?(re=h.jsx("div",{className:"flex-1"}),t[42]=re):re=t[42];const ne=g&&"bg-[var(--sky-3)] rounded-none";let oe,Y;t[43]!==ne?(oe=Oe(ne),t[43]=ne,t[44]=oe):oe=t[44],t[45]!==g||t[46]!==m?(Y=()=>m(!g),t[45]=g,t[46]=m,t[47]=Y):Y=t[47];const Q=b.length===0;let ce,he,de,me,ie,Ce,we;return t[48]===Symbol.for("react.memo_cache_sentinel")?(ce=h.jsx(xm,{size:16}),t[48]=ce):ce=t[48],t[49]!==oe||t[50]!==Y||t[51]!==Q?(he=h.jsx(Re,{content:"Toggle history",children:h.jsx(Pe,{size:"xs",variant:"text",className:oe,onClick:Y,disabled:Q,children:ce})}),t[49]=oe,t[50]=Y,t[51]=Q,t[52]=he):he=t[52],t[53]!==$||t[54]!==H||t[55]!==Z||t[56]!==q||t[57]!==he?(de=h.jsxs("div",{className:"flex items-center flex-shrink-0",children:[$,H,Z,q,re,he]}),t[53]=$,t[54]=H,t[55]=Z,t[56]=q,t[57]=he,t[58]=de):de=t[58],t[59]!==B?(me=B(),t[59]=B,t[60]=me):me=t[60],t[61]!==z?(ie=z(),t[61]=z,t[62]=ie):ie=t[62],t[63]!==me||t[64]!==ie?(Ce=h.jsxs("div",{className:"flex-1 divide-y relative overflow-hidden flex flex-col",children:[me,ie]}),t[63]=me,t[64]=ie,t[65]=Ce):Ce=t[65],t[66]!==de||t[67]!==Ce?(we=h.jsxs("div",{className:"flex flex-col h-full overflow-hidden divide-y",id:F,children:[V,de,Ce]}),t[66]=de,t[67]=Ce,t[68]=we):we=t[68],we},jR=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=h.jsx(NR,{}),t[0]=e):e=t[0],e},O2=(t,e)=>{lt(e?{title:"Failed to add package",description:e,variant:"danger"}:{title:"Package added",description:h.jsxs("div",{children:[h.jsxs("div",{children:["The package ",h.jsx(la,{className:"inline",children:t})," and its dependencies has been added to your environment."]}),h.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Some Python packages may require a kernel restart to see changes."})]})})},D2=(t,e)=>{lt(e?{title:"Failed to upgrade package",description:e,variant:"danger"}:{title:"Package upgraded",description:h.jsxs("div",{children:[h.jsxs("div",{children:["The package ",h.jsx(la,{className:"inline",children:t})," has been upgraded."]}),h.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Some Python packages may require a kernel restart to see changes."})]})})},R2=(t,e)=>{lt(e?{title:"Failed to remove package",description:e,variant:"danger"}:{title:"Package removed",description:h.jsxs("div",{children:[h.jsxs("div",{children:["The package ",h.jsx(la,{className:"inline",children:t})," has been removed from your environment."]}),h.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Some Python packages may require a kernel restart to see changes."})]})})},P2=t=>{const e=X.c(9),{onClick:n,loading:o,children:r,className:s}=t;if(o){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(Qn,{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=Oe("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=Vn.stopPropagation(n),e[3]=n,e[4]=a):a=e[4],e[5]!==r||e[6]!==i||e[7]!==a?(l=h.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},ER=()=>{const t=X.c(16),[e]=Ds(),n=e.package_management.manager;let o;t[0]!==n?(o=[n],t[0]=n,t[1]=o):o=t[1];const{data:r,loading:s,error:i,reload:a}=Xn(OR,o);if(s&&!r){let p;return t[2]===Symbol.for("react.memo_cache_sentinel")?(p=h.jsx(Qn,{size:"medium",centered:!0}),t[2]=p):p=t[2],p}if(i){let p;return t[3]!==i?(p=h.jsx(Xs,{error:i}),t[3]=i,t[4]=p):p=t[4],p}let l;t[5]!==(r==null?void 0:r.packages)?(l=(r==null?void 0:r.packages)||[],t[5]=r==null?void 0:r.packages,t[6]=l):l=t[6];const c=l;let d,u,f;return t[7]!==n||t[8]!==a?(d=h.jsx(IR,{packageManager:n,onSuccess:a}),t[7]=n,t[8]=a,t[9]=d):d=t[9],t[10]!==c||t[11]!==a?(u=h.jsx(AR,{packages:c,onSuccess:a}),t[10]=c,t[11]=a,t[12]=u):u=t[12],t[13]!==d||t[14]!==u?(f=h.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[d,u]}),t[13]=d,t[14]=u,t[15]=f):f=t[15],f},IR=({onSuccess:t,packageManager:e})=>{const[n,o]=K.useState(""),[r,s]=K.useState(!1),{handleClick:i}=ya(),a=He(nS),l=Qt(nS);K.useEffect(()=>{a&&(o(a),l(null))},[a,l]);const c=async()=>{try{s(!0);const d=await oS({package:n});d.success?(t(),O2(n)):O2(n,d.error)}finally{o(""),s(!1)}};return h.jsxs("div",{className:"flex items-center w-full border-b",children:[h.jsx(B4,{placeholder:`Install packages with ${e}...`,id:Y_,icon:r?h.jsx(Qn,{size:"small",className:"mr-2 h-4 w-4 shrink-0 opacity-50"}):h.jsx(Re,{content:"Change package manager",children:h.jsx(ba,{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)}),h.jsx(Re,{delayDuration:300,side:"left",align:"start",content:h.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:",h.jsxs("div",{className:"flex flex-col gap-2 mt-2",children:[h.jsxs("div",{children:[h.jsx("span",{className:"font-bold tracking-wide",children:"Package name:"})," A package name; this will install the latest version.",h.jsx("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"font-bold tracking-wide",children:"Package and version:"})," ","A package with a specific version or version range.",h.jsx("div",{className:"text-muted-foreground",children:"Examples: httpx==0.27.0, httpx>=0.27.0"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"font-bold tracking-wide",children:"Git:"})," A Git repository",h.jsx("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"font-bold tracking-wide",children:"URL:"})," A remote wheel or source distribution.",h.jsx("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"font-bold tracking-wide",children:"Path:"})," A local wheel, source distribution, or project directory.",h.jsx("div",{className:"text-muted-foreground",children:"Example: /example/foo-0.1.0-py3-none-any.whl"})]})]})]}),children:h.jsx(Bp,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),h.jsx("button",{type:"button",className:Oe("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"})]})},AR=t=>{const e=X.c(9),{onSuccess:n,packages:o}=t;if(o.length===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx(In,{title:"No packages",description:"No packages are installed in this environment.",icon:h.jsx(ba,{})}),e[0]=a):a=e[0],a}let r,s,i;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(qp,{children:h.jsxs(Ks,{children:[h.jsx(Fr,{children:"Name"}),h.jsx(Fr,{children:"Version"}),h.jsx(Fr,{})]})}),e[1]=r):r=e[1],e[2]!==n||e[3]!==o){let a;e[5]!==n?(a=l=>h.jsxs(Ks,{className:"group",onClick:async()=>{await yn(`${l.name}==${l.version}`),lt({title:"Copied to clipboard"})},children:[h.jsx(zr,{children:l.name}),h.jsx(zr,{children:l.version}),h.jsxs(zr,{className:"flex justify-end",children:[h.jsx(TR,{packageName:l.name,onSuccess:n}),h.jsx(MR,{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=h.jsxs(Wp,{className:"overflow-auto flex-1",children:[r,h.jsx(Gp,{children:s})]}),e[7]=s,e[8]=i):i=e[8],i},TR=({packageName:t,onSuccess:e})=>{const[n,o]=K.useState(!1);return Bn()?null:h.jsx(P2,{onClick:async()=>{try{o(!0);const r=await oS({package:t,upgrade:!0});r.success?(e(),D2(t)):D2(t,r.error)}finally{o(!1)}},loading:n,children:"Upgrade"})},MR=({packageName:t,onSuccess:e})=>{const[n,o]=K.useState(!1);return h.jsx(P2,{onClick:async()=>{try{o(!0);const r=await WV({package:t});r.success?(e(),R2(t)):R2(t,r.error)}finally{o(!1)}},loading:n,children:"Remove"})};function OR(){return HV()}var cf="ScrollArea",[L2,Q$]=h4(cf),[DR,Ln]=L2(cf),F2=A.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:o="hover",dir:r,scrollHideDelay:s=600,...i}=t,[a,l]=A.useState(null),[c,d]=A.useState(null),[u,f]=A.useState(null),[p,_]=A.useState(null),[g,m]=A.useState(null),[b,x]=A.useState(0),[y,v]=A.useState(0),[k,S]=A.useState(!1),[E,j]=A.useState(!1),I=Zs(e,M=>l(M)),T=qV(r);return h.jsx(DR,{scope:n,type:o,dir:T,scrollHideDelay:s,scrollArea:a,viewport:c,onViewportChange:d,content:u,onContentChange:f,scrollbarX:p,onScrollbarXChange:_,scrollbarXEnabled:k,onScrollbarXEnabledChange:S,scrollbarY:g,onScrollbarYChange:m,scrollbarYEnabled:E,onScrollbarYEnabledChange:j,onCornerWidthChange:x,onCornerHeightChange:v,children:h.jsx(Ws.div,{dir:T,...i,ref:I,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":y+"px",...t.style}})})});F2.displayName=cf;var z2="ScrollAreaViewport",B2=A.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:o,nonce:r,...s}=t,i=Ln(z2,n),a=A.useRef(null),l=Zs(e,a,i.onViewportChange);return h.jsxs(h.Fragment,{children:[h.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),h.jsx(Ws.div,{"data-radix-scroll-area-viewport":"",...s,ref:l,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...t.style},children:h.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:o})})]})});B2.displayName=z2;var ao="ScrollAreaScrollbar",df=A.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=Ln(ao,t.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=r,a=t.orientation==="horizontal";return A.useEffect(()=>(a?s(!0):i(!0),()=>{a?s(!1):i(!1)}),[a,s,i]),r.type==="hover"?h.jsx(RR,{...o,ref:e,forceMount:n}):r.type==="scroll"?h.jsx(PR,{...o,ref:e,forceMount:n}):r.type==="auto"?h.jsx(U2,{...o,ref:e,forceMount:n}):r.type==="always"?h.jsx(uf,{...o,ref:e}):null});df.displayName=ao;var RR=A.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=Ln(ao,t.__scopeScrollArea),[s,i]=A.useState(!1);return A.useEffect(()=>{const a=r.scrollArea;let l=0;if(a){const c=()=>{window.clearTimeout(l),i(!0)},d=()=>{l=window.setTimeout(()=>i(!1),r.scrollHideDelay)};return a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",d),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",d)}}},[r.scrollArea,r.scrollHideDelay]),h.jsx(Bc,{present:n||s,children:h.jsx(U2,{"data-state":s?"visible":"hidden",...o,ref:e})})}),PR=A.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=Ln(ao,t.__scopeScrollArea),s=t.orientation==="horizontal",i=Hl(()=>l("SCROLL_END"),100),[a,l]=function(c,d){return A.useReducer((u,f)=>d[u][f]??u,c)}("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return A.useEffect(()=>{if(a==="idle"){const c=window.setTimeout(()=>l("HIDE"),r.scrollHideDelay);return()=>window.clearTimeout(c)}},[a,r.scrollHideDelay,l]),A.useEffect(()=>{const c=r.viewport,d=s?"scrollLeft":"scrollTop";if(c){let u=c[d];const f=()=>{const p=c[d];u!==p&&(l("SCROLL"),i()),u=p};return c.addEventListener("scroll",f),()=>c.removeEventListener("scroll",f)}},[r.viewport,s,l,i]),h.jsx(Bc,{present:n||a!=="hidden",children:h.jsx(uf,{"data-state":a==="hidden"?"hidden":"visible",...o,ref:e,onPointerEnter:Wn(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:Wn(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),U2=A.forwardRef((t,e)=>{const n=Ln(ao,t.__scopeScrollArea),{forceMount:o,...r}=t,[s,i]=A.useState(!1),a=t.orientation==="horizontal",l=Hl(()=>{if(n.viewport){const c=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;i(a?c:d)}},10);return gs(n.viewport,l),gs(n.content,l),h.jsx(Bc,{present:o||s,children:h.jsx(uf,{"data-state":s?"visible":"hidden",...r,ref:e})})}),uf=A.forwardRef((t,e)=>{const{orientation:n="vertical",...o}=t,r=Ln(ao,t.__scopeScrollArea),s=A.useRef(null),i=A.useRef(0),[a,l]=A.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=q2(a.viewport,a.content),d={...o,sizes:a,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:f=>s.current=f,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:f=>i.current=f};function u(f,p){return function(_,g,m,b="ltr"){const x=$l(m),y=x/2,v=g||y,k=x-v,S=m.scrollbar.paddingStart+v,E=m.scrollbar.size-m.scrollbar.paddingEnd-k,j=m.content-m.viewport,I=b==="ltr"?[0,j]:[-1*j,0];return Y2([S,E],I)(_)}(f,i.current,a,p)}return n==="horizontal"?h.jsx(LR,{...d,ref:e,onThumbPositionChange:()=>{if(r.viewport&&s.current){const f=G2(r.viewport.scrollLeft,a,r.dir);s.current.style.transform=`translate3d(${f}px, 0, 0)`}},onWheelScroll:f=>{r.viewport&&(r.viewport.scrollLeft=f)},onDragScroll:f=>{r.viewport&&(r.viewport.scrollLeft=u(f,r.dir))}}):n==="vertical"?h.jsx(FR,{...d,ref:e,onThumbPositionChange:()=>{if(r.viewport&&s.current){const f=G2(r.viewport.scrollTop,a);s.current.style.transform=`translate3d(0, ${f}px, 0)`}},onWheelScroll:f=>{r.viewport&&(r.viewport.scrollTop=f)},onDragScroll:f=>{r.viewport&&(r.viewport.scrollTop=u(f))}}):null}),LR=A.forwardRef((t,e)=>{const{sizes:n,onSizesChange:o,...r}=t,s=Ln(ao,t.__scopeScrollArea),[i,a]=A.useState(),l=A.useRef(null),c=Zs(e,l,s.onScrollbarXChange);return A.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),h.jsx($2,{"data-orientation":"horizontal",...r,ref:c,sizes:n,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":$l(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.x),onDragScroll:d=>t.onDragScroll(d.x),onWheelScroll:(d,u)=>{if(s.viewport){const f=s.viewport.scrollLeft+d.deltaX;t.onWheelScroll(f),J2(f,u)&&d.preventDefault()}},onResize:()=>{l.current&&s.viewport&&i&&o({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:Vl(i.paddingLeft),paddingEnd:Vl(i.paddingRight)}})}})}),FR=A.forwardRef((t,e)=>{const{sizes:n,onSizesChange:o,...r}=t,s=Ln(ao,t.__scopeScrollArea),[i,a]=A.useState(),l=A.useRef(null),c=Zs(e,l,s.onScrollbarYChange);return A.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),h.jsx($2,{"data-orientation":"vertical",...r,ref:c,sizes:n,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":$l(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.y),onDragScroll:d=>t.onDragScroll(d.y),onWheelScroll:(d,u)=>{if(s.viewport){const f=s.viewport.scrollTop+d.deltaY;t.onWheelScroll(f),J2(f,u)&&d.preventDefault()}},onResize:()=>{l.current&&s.viewport&&i&&o({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:Vl(i.paddingTop),paddingEnd:Vl(i.paddingBottom)}})}})}),[zR,V2]=L2(ao),$2=A.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:o,hasThumb:r,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:d,onResize:u,...f}=t,p=Ln(ao,n),[_,g]=A.useState(null),m=Zs(e,I=>g(I)),b=A.useRef(null),x=A.useRef(""),y=p.viewport,v=o.content-o.viewport,k=hr(d),S=hr(l),E=Hl(u,10);function j(I){if(b.current){const T=I.clientX-b.current.left,M=I.clientY-b.current.top;c({x:T,y:M})}}return A.useEffect(()=>{const I=T=>{const M=T.target;(_==null?void 0:_.contains(M))&&k(T,v)};return document.addEventListener("wheel",I,{passive:!1}),()=>document.removeEventListener("wheel",I,{passive:!1})},[y,_,v,k]),A.useEffect(S,[o,S]),gs(_,E),gs(p.content,E),h.jsx(zR,{scope:n,scrollbar:_,hasThumb:r,onThumbChange:hr(s),onThumbPointerUp:hr(i),onThumbPositionChange:S,onThumbPointerDown:hr(a),children:h.jsx(Ws.div,{...f,ref:m,style:{position:"absolute",...f.style},onPointerDown:Wn(t.onPointerDown,I=>{I.button===0&&(I.target.setPointerCapture(I.pointerId),b.current=_.getBoundingClientRect(),x.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),j(I))}),onPointerMove:Wn(t.onPointerMove,j),onPointerUp:Wn(t.onPointerUp,I=>{const T=I.target;T.hasPointerCapture(I.pointerId)&&T.releasePointerCapture(I.pointerId),document.body.style.webkitUserSelect=x.current,p.viewport&&(p.viewport.style.scrollBehavior=""),b.current=null})})})}),Ul="ScrollAreaThumb",H2=A.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=V2(Ul,t.__scopeScrollArea);return h.jsx(Bc,{present:n||r.hasThumb,children:h.jsx(BR,{ref:e,...o})})}),BR=A.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:o,...r}=t,s=Ln(Ul,n),i=V2(Ul,n),{onThumbPositionChange:a}=i,l=Zs(e,u=>i.onThumbChange(u)),c=A.useRef(void 0),d=Hl(()=>{c.current&&(c.current(),c.current=void 0)},100);return A.useEffect(()=>{const u=s.viewport;if(u){const f=()=>{if(d(),!c.current){const p=VR(u,a);c.current=p,a()}};return a(),u.addEventListener("scroll",f),()=>u.removeEventListener("scroll",f)}},[s.viewport,d,a]),h.jsx(Ws.div,{"data-state":i.hasThumb?"visible":"hidden",...r,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...o},onPointerDownCapture:Wn(t.onPointerDownCapture,u=>{const f=u.target.getBoundingClientRect(),p=u.clientX-f.left,_=u.clientY-f.top;i.onThumbPointerDown({x:p,y:_})}),onPointerUp:Wn(t.onPointerUp,i.onThumbPointerUp)})});H2.displayName=Ul;var hf="ScrollAreaCorner",W2=A.forwardRef((t,e)=>{const n=Ln(hf,t.__scopeScrollArea),o=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&o?h.jsx(UR,{...t,ref:e}):null});W2.displayName=hf;var UR=A.forwardRef((t,e)=>{const{__scopeScrollArea:n,...o}=t,r=Ln(hf,n),[s,i]=A.useState(0),[a,l]=A.useState(0),c=!!(s&&a);return gs(r.scrollbarX,()=>{var u;const d=((u=r.scrollbarX)==null?void 0:u.offsetHeight)||0;r.onCornerHeightChange(d),l(d)}),gs(r.scrollbarY,()=>{var u;const d=((u=r.scrollbarY)==null?void 0:u.offsetWidth)||0;r.onCornerWidthChange(d),i(d)}),c?h.jsx(Ws.div,{...o,ref:e,style:{width:s,height:a,position:"absolute",right:r.dir==="ltr"?0:void 0,left:r.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function Vl(t){return t?parseInt(t,10):0}function q2(t,e){const n=t/e;return isNaN(n)?0:n}function $l(t){const e=q2(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=(t.scrollbar.size-n)*e;return Math.max(o,18)}function G2(t,e,n="ltr"){const o=$l(e),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=e.scrollbar.size-r,i=e.content-e.viewport,a=s-o,l=YV(t,n==="ltr"?[0,i]:[-1*i,0]);return Y2([0,i],[0,a])(l)}function Y2(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const o=(e[1]-e[0])/(t[1]-t[0]);return e[0]+o*(n-t[0])}}function J2(t,e){return t>0&&t<e}var VR=(t,e=()=>{})=>{let n={left:t.scrollLeft,top:t.scrollTop},o=0;return function r(){const s={left:t.scrollLeft,top:t.scrollTop},i=n.left!==s.left,a=n.top!==s.top;(i||a)&&e(),n=s,o=window.requestAnimationFrame(r)}(),()=>window.cancelAnimationFrame(o)};function Hl(t,e){const n=hr(t),o=A.useRef(0);return A.useEffect(()=>()=>window.clearTimeout(o.current),[]),A.useCallback(()=>{window.clearTimeout(o.current),o.current=window.setTimeout(n,e)},[n,e])}function gs(t,e){const n=hr(e);GV(()=>{let o=0;if(t){const r=new ResizeObserver(()=>{cancelAnimationFrame(o),o=window.requestAnimationFrame(n)});return r.observe(t),()=>{window.cancelAnimationFrame(o),r.unobserve(t)}}},[t,n])}var K2=F2,$R=B2,HR=W2;const X2=A.forwardRef((t,e)=>{const n=X.c(15);let o,r,s,i,a,l,c,d;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=Oe("relative overflow-hidden",r),n[4]=r,n[5]=i):i=n[5],n[6]!==o?(a=h.jsx($R,{className:"h-full w-full rounded-[inherit]",children:o}),n[6]=o,n[7]=a):a=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx(Z2,{}),c=h.jsx(HR,{}),n[8]=l,n[9]=c):(l=n[8],c=n[9]),n[10]!==s||n[11]!==e||n[12]!==i||n[13]!==a?(d=h.jsxs(K2,{ref:e,className:i,...s,children:[a,l,c]}),n[10]=s,n[11]=e,n[12]=i,n[13]=a,n[14]=d):d=n[14],d});X2.displayName=K2.displayName;const Z2=A.forwardRef((t,e)=>{const n=X.c(14);let o,r,s;n[0]!==t?({className:o,orientation:s,...r}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]);const i=s===void 0?"vertical":s,a=i==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",l=i==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]";let c,d,u;return n[4]!==o||n[5]!==a||n[6]!==l?(c=Oe("flex touch-none select-none transition-colors",a,l,o),n[4]=o,n[5]=a,n[6]=l,n[7]=c):c=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsx(H2,{className:"relative flex-1 rounded-full bg-border"}),n[8]=d):d=n[8],n[9]!==i||n[10]!==r||n[11]!==e||n[12]!==c?(u=h.jsx(df,{ref:e,orientation:i,className:c,...r,children:d}),n[9]=i,n[10]=r,n[11]=e,n[12]=c,n[13]=u):u=n[13],u});Z2.displayName=df.displayName;const WR=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,qR=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,GR={};function Q2(t,e){return(GR.jsx?qR:WR).test(t)}const YR=/[ \t\n\f\r]/g;function ek(t){return t.replace(YR,"")===""}class Hi{constructor(e,n,o){this.property=e,this.normal=n,o&&(this.space=o)}}function tk(t,e){const n={},o={};let r=-1;for(;++r<t.length;)Object.assign(n,t[r].property),Object.assign(o,t[r].normal);return new Hi(n,o,e)}function ff(t){return t.toLowerCase()}Hi.prototype.property={},Hi.prototype.normal={},Hi.prototype.space=null;class Fn{constructor(e,n){this.property=e,this.attribute=n}}Fn.prototype.space=null,Fn.prototype.boolean=!1,Fn.prototype.booleanish=!1,Fn.prototype.overloadedBoolean=!1,Fn.prototype.number=!1,Fn.prototype.commaSeparated=!1,Fn.prototype.spaceSeparated=!1,Fn.prototype.commaOrSpaceSeparated=!1,Fn.prototype.mustUseProperty=!1,Fn.prototype.defined=!1;let JR=0;const tt=Tr(),Rt=Tr(),nk=Tr(),xe=Tr(),_t=Tr(),_s=Tr(),vn=Tr();function Tr(){return 2**++JR}const pf=Object.freeze(Object.defineProperty({__proto__:null,boolean:tt,booleanish:Rt,commaOrSpaceSeparated:vn,commaSeparated:_s,number:xe,overloadedBoolean:nk,spaceSeparated:_t},Symbol.toStringTag,{value:"Module"})),mf=Object.keys(pf);class gf extends Fn{constructor(e,n,o,r){let s=-1;if(super(e,n),ok(this,"space",r),typeof o=="number")for(;++s<mf.length;){const i=mf[s];ok(this,mf[s],(o&pf[i])===pf[i])}}}function ok(t,e,n){n&&(t[e]=n)}gf.prototype.defined=!0;const KR={}.hasOwnProperty;function bs(t){const e={},n={};let o;for(o in t.properties)if(KR.call(t.properties,o)){const r=t.properties[o],s=new gf(o,t.transform(t.attributes||{},o),r,t.space);t.mustUseProperty&&t.mustUseProperty.includes(o)&&(s.mustUseProperty=!0),e[o]=s,n[ff(o)]=o,n[ff(s.attribute)]=o}return new Hi(e,n,t.space)}const rk=bs({space:"xlink",transform:(t,e)=>"xlink:"+e.slice(5).toLowerCase(),properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}}),sk=bs({space:"xml",transform:(t,e)=>"xml:"+e.slice(3).toLowerCase(),properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function ik(t,e){return e in t?t[e]:e}function ak(t,e){return ik(t,e.toLowerCase())}const lk=bs({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:ak,properties:{xmlns:null,xmlnsXLink:null}}),ck=bs({transform:(t,e)=>e==="role"?e:"aria-"+e.slice(4).toLowerCase(),properties:{ariaActiveDescendant:null,ariaAtomic:Rt,ariaAutoComplete:null,ariaBusy:Rt,ariaChecked:Rt,ariaColCount:xe,ariaColIndex:xe,ariaColSpan:xe,ariaControls:_t,ariaCurrent:null,ariaDescribedBy:_t,ariaDetails:null,ariaDisabled:Rt,ariaDropEffect:_t,ariaErrorMessage:null,ariaExpanded:Rt,ariaFlowTo:_t,ariaGrabbed:Rt,ariaHasPopup:null,ariaHidden:Rt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:_t,ariaLevel:xe,ariaLive:null,ariaModal:Rt,ariaMultiLine:Rt,ariaMultiSelectable:Rt,ariaOrientation:null,ariaOwns:_t,ariaPlaceholder:null,ariaPosInSet:xe,ariaPressed:Rt,ariaReadOnly:Rt,ariaRelevant:null,ariaRequired:Rt,ariaRoleDescription:_t,ariaRowCount:xe,ariaRowIndex:xe,ariaRowSpan:xe,ariaSelected:Rt,ariaSetSize:xe,ariaSort:null,ariaValueMax:xe,ariaValueMin:xe,ariaValueNow:xe,ariaValueText:null,role:null}}),XR=bs({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:ak,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:_s,acceptCharset:_t,accessKey:_t,action:null,allow:null,allowFullScreen:tt,allowPaymentRequest:tt,allowUserMedia:tt,alt:null,as:null,async:tt,autoCapitalize:null,autoComplete:_t,autoFocus:tt,autoPlay:tt,blocking:_t,capture:null,charSet:null,checked:tt,cite:null,className:_t,cols:xe,colSpan:null,content:null,contentEditable:Rt,controls:tt,controlsList:_t,coords:xe|_s,crossOrigin:null,data:null,dateTime:null,decoding:null,default:tt,defer:tt,dir:null,dirName:null,disabled:tt,download:nk,draggable:Rt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:tt,formTarget:null,headers:_t,height:xe,hidden:tt,high:xe,href:null,hrefLang:null,htmlFor:_t,httpEquiv:_t,id:null,imageSizes:null,imageSrcSet:null,inert:tt,inputMode:null,integrity:null,is:null,isMap:tt,itemId:null,itemProp:_t,itemRef:_t,itemScope:tt,itemType:_t,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:tt,low:xe,manifest:null,max:null,maxLength:xe,media:null,method:null,min:null,minLength:xe,multiple:tt,muted:tt,name:null,nonce:null,noModule:tt,noValidate:tt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:tt,optimum:xe,pattern:null,ping:_t,placeholder:null,playsInline:tt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:tt,referrerPolicy:null,rel:_t,required:tt,reversed:tt,rows:xe,rowSpan:xe,sandbox:_t,scope:null,scoped:tt,seamless:tt,selected:tt,shadowRootClonable:tt,shadowRootDelegatesFocus:tt,shadowRootMode:null,shape:null,size:xe,sizes:null,slot:null,span:xe,spellCheck:Rt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:xe,step:null,style:null,tabIndex:xe,target:null,title:null,translate:null,type:null,typeMustMatch:tt,useMap:null,value:Rt,width:xe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:_t,axis:null,background:null,bgColor:null,border:xe,borderColor:null,bottomMargin:xe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:tt,declare:tt,event:null,face:null,frame:null,frameBorder:null,hSpace:xe,leftMargin:xe,link:null,longDesc:null,lowSrc:null,marginHeight:xe,marginWidth:xe,noResize:tt,noHref:tt,noShade:tt,noWrap:tt,object:null,profile:null,prompt:null,rev:null,rightMargin:xe,rules:null,scheme:null,scrolling:Rt,standby:null,summary:null,text:null,topMargin:xe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:xe,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:tt,disableRemotePlayback:tt,prefix:null,property:null,results:xe,security:null,unselectable:null}}),ZR=bs({space:"svg",attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},transform:ik,properties:{about:vn,accentHeight:xe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:xe,amplitude:xe,arabicForm:null,ascent:xe,attributeName:null,attributeType:null,azimuth:xe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:xe,by:null,calcMode:null,capHeight:xe,className:_t,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:xe,diffuseConstant:xe,direction:null,display:null,dur:null,divisor:xe,dominantBaseline:null,download:tt,dx:null,dy:null,edgeMode:null,editable:null,elevation:xe,enableBackground:null,end:null,event:null,exponent:xe,externalResourcesRequired:null,fill:null,fillOpacity:xe,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:_s,g2:_s,glyphName:_s,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:xe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:xe,horizOriginX:xe,horizOriginY:xe,id:null,ideographic:xe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:xe,k:xe,k1:xe,k2:xe,k3:xe,k4:xe,kernelMatrix:vn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:xe,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:xe,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:xe,overlineThickness:xe,paintOrder:null,panose1:null,path:null,pathLength:xe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:_t,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:xe,pointsAtY:xe,pointsAtZ:xe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:vn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:vn,rev:vn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:vn,requiredFeatures:vn,requiredFonts:vn,requiredFormats:vn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:xe,specularExponent:xe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:xe,strikethroughThickness:xe,string:null,stroke:null,strokeDashArray:vn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:xe,strokeOpacity:xe,strokeWidth:null,style:null,surfaceScale:xe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:vn,tabIndex:xe,tableValues:null,target:null,targetX:xe,targetY:xe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:vn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:xe,underlineThickness:xe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:xe,values:null,vAlphabetic:xe,vMathematical:xe,vectorEffect:null,vHanging:xe,vIdeographic:xe,version:null,vertAdvY:xe,vertOriginX:xe,vertOriginY:xe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:xe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}}),QR=/^data[-\w.:]+$/i,dk=/-[a-z]/g,eP=/[A-Z]/g;function tP(t){return"-"+t.toLowerCase()}function nP(t){return t.charAt(1).toUpperCase()}const oP={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},rP=tk([sk,rk,lk,ck,XR],"html"),_f=tk([sk,rk,lk,ck,ZR],"svg"),uk=rS(JV()),sP=uk.default||uk,hk=fk("end"),bf=fk("start");function fk(t){return function(e){const n=e&&e.position&&e.position[t]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function Wi(t){return t&&typeof t=="object"?"position"in t||"type"in t?pk(t.position):"start"in t||"end"in t?pk(t):"line"in t||"column"in t?yf(t):"":""}function yf(t){return mk(t&&t.line)+":"+mk(t&&t.column)}function pk(t){return yf(t&&t.start)+"-"+yf(t&&t.end)}function mk(t){return t&&typeof t=="number"?t:1}class on extends Error{constructor(e,n,o){super(),typeof n=="string"&&(o=n,n=void 0);let r="",s={},i=!1;if(n&&(s="line"in n&&"column"in n||"start"in n&&"end"in n?{place:n}:"type"in n?{ancestors:[n],place:n.position}:{...n}),typeof e=="string"?r=e:!s.cause&&e&&(i=!0,r=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof o=="string"){const l=o.indexOf(":");l===-1?s.ruleId=o:(s.source=o.slice(0,l),s.ruleId=o.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file,this.message=r,this.line=a?a.line:void 0,this.name=Wi(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=i&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual,this.expected,this.note,this.url}}on.prototype.file="",on.prototype.name="",on.prototype.reason="",on.prototype.message="",on.prototype.stack="",on.prototype.column=void 0,on.prototype.line=void 0,on.prototype.ancestors=void 0,on.prototype.cause=void 0,on.prototype.fatal=void 0,on.prototype.place=void 0,on.prototype.ruleId=void 0,on.prototype.source=void 0;const xf={}.hasOwnProperty,iP=new Map,aP=/[A-Z]/g,lP=/-([a-z])/g,cP=new Set(["table","tbody","thead","tfoot","tr"]),dP=new Set(["td","th"]),gk="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function uP(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let o;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");o=function(i,a){return l;function l(c,d,u,f){const p=Array.isArray(u.children),_=bf(c);return a(d,u,f,p,{columnNumber:_?_.column-1:void 0,fileName:i,lineNumber:_?_.line:void 0},void 0)}}(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");o=function(i,a,l){return c;function c(d,u,f,p){const _=Array.isArray(f.children)?l:a;return p?_(u,f,p):_(u,f)}}(0,e.jsx,e.jsxs)}const r={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:o,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?_f:rP,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=_k(r,t,void 0);return s&&typeof s!="string"?s:r.create(t,r.Fragment,{children:s||void 0},void 0)}function _k(t,e,n){return e.type==="element"?function(o,r,s){const i=o.schema;let a=i;r.tagName.toLowerCase()==="svg"&&i.space==="html"&&(a=_f,o.schema=a),o.ancestors.push(r);const l=yk(o,r.tagName,!1),c=function(u,f){const p={};let _,g;for(g in f.properties)if(g!=="children"&&xf.call(f.properties,g)){const m=hP(u,g,f.properties[g]);if(m){const[b,x]=m;u.tableCellAlignToStyle&&b==="align"&&typeof x=="string"&&dP.has(f.tagName)?_=x:p[b]=x}}return _&&((p.style||(p.style={}))[u.stylePropertyNameCase==="css"?"text-align":"textAlign"]=_),p}(o,r);let d=vf(o,r);return cP.has(r.tagName)&&(d=d.filter(function(u){return typeof u!="string"||!(typeof(f=u)=="object"?f.type==="text"&&ek(f.value):ek(f));var f})),bk(o,c,l,r),wf(c,d),o.ancestors.pop(),o.schema=i,o.create(r,l,c,s)}(t,e,n):e.type==="mdxFlowExpression"||e.type==="mdxTextExpression"?function(o,r){if(r.data&&r.data.estree&&o.evaluater){const s=r.data.estree.body[0];return s.type,o.evaluater.evaluateExpression(s.expression)}qi(o,r.position)}(t,e):e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement"?function(o,r,s){const i=o.schema;let a=i;r.name==="svg"&&i.space==="html"&&(a=_f,o.schema=a),o.ancestors.push(r);const l=r.name===null?o.Fragment:yk(o,r.name,!0),c=function(u,f){const p={};for(const _ of f.attributes)if(_.type==="mdxJsxExpressionAttribute")if(_.data&&_.data.estree&&u.evaluater){const g=_.data.estree.body[0];g.type;const m=g.expression;m.type;const b=m.properties[0];b.type,Object.assign(p,u.evaluater.evaluateExpression(b.argument))}else qi(u,f.position);else{const g=_.name;let m;if(_.value&&typeof _.value=="object")if(_.value.data&&_.value.data.estree&&u.evaluater){const b=_.value.data.estree.body[0];b.type,m=u.evaluater.evaluateExpression(b.expression)}else qi(u,f.position);else m=_.value===null||_.value;p[g]=m}return p}(o,r),d=vf(o,r);return bk(o,c,l,r),wf(c,d),o.ancestors.pop(),o.schema=i,o.create(r,l,c,s)}(t,e,n):e.type==="mdxjsEsm"?function(o,r){if(r.data&&r.data.estree&&o.evaluater)return o.evaluater.evaluateProgram(r.data.estree);qi(o,r.position)}(t,e):e.type==="root"?function(o,r,s){const i={};return wf(i,vf(o,r)),o.create(r,o.Fragment,i,s)}(t,e,n):e.type==="text"?function(o,r){return r.value}(0,e):void 0}function bk(t,e,n,o){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=o)}function wf(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function vf(t,e){const n=[];let o=-1;const r=t.passKeys?new Map:iP;for(;++o<e.children.length;){const s=e.children[o];let i;if(t.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const c=r.get(l)||0;i=l+"-"+c,r.set(l,c+1)}}const a=_k(t,s,i);a!==void 0&&n.push(a)}return n}function hP(t,e,n){const o=function(r,s){const i=ff(s);let a=s,l=Fn;if(i in r.normal)return r.property[r.normal[i]];if(i.length>4&&i.slice(0,4)==="data"&&QR.test(s)){if(s.charAt(4)==="-"){const c=s.slice(5).replace(dk,nP);a="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=s.slice(4);if(!dk.test(c)){let d=c.replace(eP,tP);d.charAt(0)!=="-"&&(d="-"+d),s="data"+d}}l=gf}return new l(a,s)}(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=o.commaSeparated?function(r){const s={};return(r[r.length-1]===""?[...r,""]:r).join((s.padRight?" ":"")+","+(s.padLeft===!1?"":" ")).trim()}(n):n.join(" ").trim()),o.property==="style"){let r=typeof n=="object"?n:function(s,i){const a={};try{sP(i,l)}catch(c){if(!s.ignoreInvalidStyle){const d=c,u=new on("Cannot parse `style` attribute",{ancestors:s.ancestors,cause:d,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw u.file=s.filePath||void 0,u.url=gk+"#cannot-parse-style-attribute",u}}return a;function l(c,d){let u=c;u.slice(0,2)!=="--"&&(u.slice(0,4)==="-ms-"&&(u="ms-"+u.slice(4)),u=u.replace(lP,pP)),a[u]=d}}(t,String(n));return t.stylePropertyNameCase==="css"&&(r=function(s){const i={};let a;for(a in s)xf.call(s,a)&&(i[fP(a)]=s[a]);return i}(r)),["style",r]}return[t.elementAttributeNameCase==="react"&&o.space?oP[o.property]||o.property:o.attribute,n]}}function yk(t,e,n){let o;if(n)if(e.includes(".")){const r=e.split(".");let s,i=-1;for(;++i<r.length;){const a=Q2(r[i])?{type:"Identifier",name:r[i]}:{type:"Literal",value:r[i]};s=s?{type:"MemberExpression",object:s,property:a,computed:!!(i&&a.type==="Literal"),optional:!1}:a}o=s}else o=Q2(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};else o={type:"Literal",value:e};if(o.type==="Literal"){const r=o.value;return xf.call(t.components,r)?t.components[r]:r}if(t.evaluater)return t.evaluater.evaluateExpression(o);qi(t)}function qi(t,e){const n=new on("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=t.filePath||void 0,n.url=gk+"#cannot-handle-mdx-estrees-without-createevaluater",n}function fP(t){let e=t.replace(aP,mP);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function pP(t,e){return e.toUpperCase()}function mP(t){return"-"+t.toLowerCase()}const kf={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Wl={};function xk(t,e,n){if(function(o){return!!(o&&typeof o=="object")}(t)){if("value"in t)return t.type!=="html"||n?t.value:"";if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return wk(t.children,e,n)}return Array.isArray(t)?wk(t,e,n):""}function wk(t,e,n){const o=[];let r=-1;for(;++r<t.length;)o[r]=xk(t[r],e,n);return o.join("")}const vk=document.createElement("i");function Sf(t){const e="&"+t+";";vk.innerHTML=e;const n=vk.textContent;return(n.charCodeAt(n.length-1)!==59||t==="semi")&&n!==e&&n}function lo(t,e,n,o){const r=t.length;let s,i=0;if(e=e<0?-e>r?0:r+e:e>r?r:e,n=n>0?n:0,o.length<1e4)s=Array.from(o),s.unshift(e,n),t.splice(...s);else for(n&&t.splice(e,n);i<o.length;)s=o.slice(i,i+1e4),s.unshift(e,0),t.splice(...s),i+=1e4,e+=1e4}function zn(t,e){return t.length>0?(lo(t,t.length,0,e),t):e}const kk={}.hasOwnProperty;function gP(t,e){let n;for(n in e){const o=(kk.call(t,n)?t[n]:void 0)||(t[n]={}),r=e[n];let s;if(r)for(s in r){kk.call(o,s)||(o[s]=[]);const i=r[s];_P(o[s],Array.isArray(i)?i:i?[i]:[])}}}function _P(t,e){let n=-1;const o=[];for(;++n<e.length;)(e[n].add==="after"?t:o).push(e[n]);lo(t,0,0,o)}function Sk(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||!(65535&~n)||(65535&n)==65534||n>1114111?"\uFFFD":String.fromCodePoint(n)}function ys(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const co=rr(/[A-Za-z]/),kn=rr(/[\dA-Za-z]/),bP=rr(/[#-'*+\--9=?A-Z^-~]/);function Cf(t){return t!==null&&(t<32||t===127)}const Nf=rr(/\d/),yP=rr(/[\dA-Fa-f]/),xP=rr(/[!-/:-@[-`{-~]/);function Ke(t){return t!==null&&t<-2}function _n(t){return t!==null&&(t<0||t===32)}function ht(t){return t===-2||t===-1||t===32}const wP=rr(new RegExp("\\p{P}|\\p{S}","u")),vP=rr(/\s/);function rr(t){return function(e){return e!==null&&e>-1&&t.test(String.fromCharCode(e))}}function xs(t){const e=[];let n=-1,o=0,r=0;for(;++n<t.length;){const s=t.charCodeAt(n);let i="";if(s===37&&kn(t.charCodeAt(n+1))&&kn(t.charCodeAt(n+2)))r=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(i=String.fromCharCode(s));else if(s>55295&&s<57344){const a=t.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(i=String.fromCharCode(s,a),r=1):i="\uFFFD"}else i=String.fromCharCode(s);i&&(e.push(t.slice(o,n),encodeURIComponent(i)),o=n+r+1,i=""),r&&(n+=r,r=0)}return e.join("")+t.slice(o)}function bt(t,e,n,o){const r=o?o-1:Number.POSITIVE_INFINITY;let s=0;return function(a){return ht(a)?(t.enter(n),i(a)):e(a)};function i(a){return ht(a)&&s++<r?(t.consume(a),i):(t.exit(n),e(a))}}const kP={tokenize:function(t){const e=t.attempt(this.parser.constructs.contentInitial,function(s){return s===null?void t.consume(s):(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),bt(t,e,"linePrefix"))},function(s){return t.enter("paragraph"),o(s)});let n;return e;function o(s){const i=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=i),n=i,r(s)}function r(s){return s===null?(t.exit("chunkText"),t.exit("paragraph"),void t.consume(s)):Ke(s)?(t.consume(s),t.exit("chunkText"),o):(t.consume(s),r)}}},SP={tokenize:function(t){const e=this,n=[];let o,r,s,i=0;return a;function a(y){if(i<n.length){const v=n[i];return e.containerState=v[1],t.attempt(v[0].continuation,l,c)(y)}return c(y)}function l(y){if(i++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,o&&x();const v=e.events.length;let k,S=v;for(;S--;)if(e.events[S][0]==="exit"&&e.events[S][1].type==="chunkFlow"){k=e.events[S][1].end;break}b(i);let E=v;for(;E<e.events.length;)e.events[E][1].end={...k},E++;return lo(e.events,S+1,0,e.events.slice(v)),e.events.length=E,c(y)}return a(y)}function c(y){if(i===n.length){if(!o)return f(y);if(o.currentConstruct&&o.currentConstruct.concrete)return _(y);e.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(Ck,d,u)(y)}function d(y){return o&&x(),b(i),f(y)}function u(y){return e.parser.lazy[e.now().line]=i!==n.length,s=e.now().offset,_(y)}function f(y){return e.containerState={},t.attempt(Ck,p,_)(y)}function p(y){return i++,n.push([e.currentConstruct,e.containerState]),f(y)}function _(y){return y===null?(o&&x(),b(0),void t.consume(y)):(o=o||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:r}),g(y))}function g(y){return y===null?(m(t.exit("chunkFlow"),!0),b(0),void t.consume(y)):Ke(y)?(t.consume(y),m(t.exit("chunkFlow")),i=0,e.interrupt=void 0,a):(t.consume(y),g)}function m(y,v){const k=e.sliceStream(y);if(v&&k.push(null),y.previous=r,r&&(r.next=y),r=y,o.defineSkip(y.start),o.write(k),e.parser.lazy[y.start.line]){let S=o.events.length;for(;S--;)if(o.events[S][1].start.offset<s&&(!o.events[S][1].end||o.events[S][1].end.offset>s))return;const E=e.events.length;let j,I,T=E;for(;T--;)if(e.events[T][0]==="exit"&&e.events[T][1].type==="chunkFlow"){if(j){I=e.events[T][1].end;break}j=!0}for(b(i),S=E;S<e.events.length;)e.events[S][1].end={...I},S++;lo(e.events,T+1,0,e.events.slice(E)),e.events.length=S}}function b(y){let v=n.length;for(;v-- >y;){const k=n[v];e.containerState=k[1],k[0].exit.call(e,t)}n.length=y}function x(){o.write([null]),r=void 0,o=void 0,e.containerState._closeFlow=void 0}}},Ck={tokenize:function(t,e,n){return bt(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};function Nk(t){return t===null||_n(t)||vP(t)?1:wP(t)?2:void 0}function jf(t,e,n){const o=[];let r=-1;for(;++r<t.length;){const s=t[r].resolveAll;s&&!o.includes(s)&&(e=s(e,n),o.push(s))}return e}const Ef={name:"attention",resolveAll:function(t,e){let n,o,r,s,i,a,l,c,d=-1;for(;++d<t.length;)if(t[d][0]==="enter"&&t[d][1].type==="attentionSequence"&&t[d][1]._close){for(n=d;n--;)if(t[n][0]==="exit"&&t[n][1].type==="attentionSequence"&&t[n][1]._open&&e.sliceSerialize(t[n][1]).charCodeAt(0)===e.sliceSerialize(t[d][1]).charCodeAt(0)){if((t[n][1]._close||t[d][1]._open)&&(t[d][1].end.offset-t[d][1].start.offset)%3&&!((t[n][1].end.offset-t[n][1].start.offset+t[d][1].end.offset-t[d][1].start.offset)%3))continue;a=t[n][1].end.offset-t[n][1].start.offset>1&&t[d][1].end.offset-t[d][1].start.offset>1?2:1;const u={...t[n][1].end},f={...t[d][1].start};jk(u,-a),jk(f,a),s={type:a>1?"strongSequence":"emphasisSequence",start:u,end:{...t[n][1].end}},i={type:a>1?"strongSequence":"emphasisSequence",start:{...t[d][1].start},end:f},r={type:a>1?"strongText":"emphasisText",start:{...t[n][1].end},end:{...t[d][1].start}},o={type:a>1?"strong":"emphasis",start:{...s.start},end:{...i.end}},t[n][1].end={...s.start},t[d][1].start={...i.end},l=[],t[n][1].end.offset-t[n][1].start.offset&&(l=zn(l,[["enter",t[n][1],e],["exit",t[n][1],e]])),l=zn(l,[["enter",o,e],["enter",s,e],["exit",s,e],["enter",r,e]]),l=zn(l,jf(e.parser.constructs.insideSpan.null,t.slice(n+1,d),e)),l=zn(l,[["exit",r,e],["enter",i,e],["exit",i,e],["exit",o,e]]),t[d][1].end.offset-t[d][1].start.offset?(c=2,l=zn(l,[["enter",t[d][1],e],["exit",t[d][1],e]])):c=0,lo(t,n-1,d-n+3,l),d=n+l.length-c-2;break}}for(d=-1;++d<t.length;)t[d][1].type==="attentionSequence"&&(t[d][1].type="data");return t},tokenize:function(t,e){const n=this.parser.constructs.attentionMarkers.null,o=this.previous,r=Nk(o);let s;return function(a){return s=a,t.enter("attentionSequence"),i(a)};function i(a){if(a===s)return t.consume(a),i;const l=t.exit("attentionSequence"),c=Nk(a),d=!c||c===2&&r||n.includes(a),u=!r||r===2&&c||n.includes(o);return l._open=!!(s===42?d:d&&(r||!u)),l._close=!!(s===42?u:u&&(c||!d)),e(a)}}};function jk(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const CP={name:"autolink",tokenize:function(t,e,n){let o=0;return function(f){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),r};function r(f){return co(f)?(t.consume(f),s):f===64?n(f):l(f)}function s(f){return f===43||f===45||f===46||kn(f)?(o=1,i(f)):l(f)}function i(f){return f===58?(t.consume(f),o=0,a):(f===43||f===45||f===46||kn(f))&&o++<32?(t.consume(f),i):(o=0,l(f))}function a(f){return f===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):f===null||f===32||f===60||Cf(f)?n(f):(t.consume(f),a)}function l(f){return f===64?(t.consume(f),c):bP(f)?(t.consume(f),l):n(f)}function c(f){return kn(f)?d(f):n(f)}function d(f){return f===46?(t.consume(f),o=0,c):f===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):u(f)}function u(f){if((f===45||kn(f))&&o++<63){const p=f===45?u:d;return t.consume(f),p}return n(f)}}},ql={partial:!0,tokenize:function(t,e,n){return function(r){return ht(r)?bt(t,o,"linePrefix")(r):o(r)};function o(r){return r===null||Ke(r)?e(r):n(r)}}},Ek={continuation:{tokenize:function(t,e,n){const o=this;return function(s){return ht(s)?bt(t,r,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):r(s)};function r(s){return t.attempt(Ek,e,n)(s)}}},exit:function(t){t.exit("blockQuote")},name:"blockQuote",tokenize:function(t,e,n){const o=this;return function(s){if(s===62){const i=o.containerState;return i.open||(t.enter("blockQuote",{_container:!0}),i.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(s),t.exit("blockQuoteMarker"),r}return n(s)};function r(s){return ht(s)?(t.enter("blockQuotePrefixWhitespace"),t.consume(s),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(s))}}},Ik={name:"characterEscape",tokenize:function(t,e,n){return function(r){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(r),t.exit("escapeMarker"),o};function o(r){return xP(r)?(t.enter("characterEscapeValue"),t.consume(r),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(r)}}},Ak={name:"characterReference",tokenize:function(t,e,n){const o=this;let r,s,i=0;return function(d){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),a};function a(d){return d===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(d),t.exit("characterReferenceMarkerNumeric"),l):(t.enter("characterReferenceValue"),r=31,s=kn,c(d))}function l(d){return d===88||d===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(d),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),r=6,s=yP,c):(t.enter("characterReferenceValue"),r=7,s=Nf,c(d))}function c(d){if(d===59&&i){const u=t.exit("characterReferenceValue");return s!==kn||Sf(o.sliceSerialize(u))?(t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),t.exit("characterReference"),e):n(d)}return s(d)&&i++<r?(t.consume(d),c):n(d)}}},Tk={partial:!0,tokenize:function(t,e,n){const o=this;return function(s){return s===null?n(s):(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),r)};function r(s){return o.parser.lazy[o.now().line]?n(s):e(s)}}},Mk={concrete:!0,name:"codeFenced",tokenize:function(t,e,n){const o=this,r={partial:!0,tokenize:function(y,v,k){let S=0;return E;function E(L){return y.enter("lineEnding"),y.consume(L),y.exit("lineEnding"),j}function j(L){return y.enter("codeFencedFence"),ht(L)?bt(y,I,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):I(L)}function I(L){return L===s?(y.enter("codeFencedFenceSequence"),T(L)):k(L)}function T(L){return L===s?(S++,y.consume(L),T):S>=a?(y.exit("codeFencedFenceSequence"),ht(L)?bt(y,M,"whitespace")(L):M(L)):k(L)}function M(L){return L===null||Ke(L)?(y.exit("codeFencedFence"),v(L)):k(L)}}};let s,i=0,a=0;return function(y){return function(v){const k=o.events[o.events.length-1];return i=k&&k[1].type==="linePrefix"?k[2].sliceSerialize(k[1],!0).length:0,s=v,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),l(v)}(y)};function l(y){return y===s?(a++,t.consume(y),l):a<3?n(y):(t.exit("codeFencedFenceSequence"),ht(y)?bt(t,c,"whitespace")(y):c(y))}function c(y){return y===null||Ke(y)?(t.exit("codeFencedFence"),o.interrupt?e(y):t.check(Tk,p,x)(y)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),d(y))}function d(y){return y===null||Ke(y)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),c(y)):ht(y)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),bt(t,u,"whitespace")(y)):y===96&&y===s?n(y):(t.consume(y),d)}function u(y){return y===null||Ke(y)?c(y):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),f(y))}function f(y){return y===null||Ke(y)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),c(y)):y===96&&y===s?n(y):(t.consume(y),f)}function p(y){return t.attempt(r,x,_)(y)}function _(y){return t.enter("lineEnding"),t.consume(y),t.exit("lineEnding"),g}function g(y){return i>0&&ht(y)?bt(t,m,"linePrefix",i+1)(y):m(y)}function m(y){return y===null||Ke(y)?t.check(Tk,p,x)(y):(t.enter("codeFlowValue"),b(y))}function b(y){return y===null||Ke(y)?(t.exit("codeFlowValue"),m(y)):(t.consume(y),b)}function x(y){return t.exit("codeFenced"),e(y)}}},If={name:"codeIndented",tokenize:function(t,e,n){const o=this;return function(l){return t.enter("codeIndented"),bt(t,r,"linePrefix",5)(l)};function r(l){const c=o.events[o.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?s(l):n(l)}function s(l){return l===null?a(l):Ke(l)?t.attempt(NP,s,a)(l):(t.enter("codeFlowValue"),i(l))}function i(l){return l===null||Ke(l)?(t.exit("codeFlowValue"),s(l)):(t.consume(l),i)}function a(l){return t.exit("codeIndented"),e(l)}}},NP={partial:!0,tokenize:function(t,e,n){const o=this;return r;function r(i){return o.parser.lazy[o.now().line]?n(i):Ke(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),r):bt(t,s,"linePrefix",5)(i)}function s(i){const a=o.events[o.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(i):Ke(i)?r(i):n(i)}}},jP={name:"codeText",previous:function(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"},resolve:function(t){let e,n,o=t.length-4,r=3;if(!(t[r][1].type!=="lineEnding"&&t[r][1].type!=="space"||t[o][1].type!=="lineEnding"&&t[o][1].type!=="space")){for(e=r;++e<o;)if(t[e][1].type==="codeTextData"){t[r][1].type="codeTextPadding",t[o][1].type="codeTextPadding",r+=2,o-=2;break}}for(e=r-1,o++;++e<=o;)n===void 0?e!==o&&t[e][1].type!=="lineEnding"&&(n=e):e!==o&&t[e][1].type!=="lineEnding"||(t[n][1].type="codeTextData",e!==n+2&&(t[n][1].end=t[e-1][1].end,t.splice(n+2,e-n-2),o-=e-n-2,e=n+2),n=void 0);return t},tokenize:function(t,e,n){let o,r,s=0;return function(d){return t.enter("codeText"),t.enter("codeTextSequence"),i(d)};function i(d){return d===96?(t.consume(d),s++,i):(t.exit("codeTextSequence"),a(d))}function a(d){return d===null?n(d):d===32?(t.enter("space"),t.consume(d),t.exit("space"),a):d===96?(r=t.enter("codeTextSequence"),o=0,c(d)):Ke(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),a):(t.enter("codeTextData"),l(d))}function l(d){return d===null||d===32||d===96||Ke(d)?(t.exit("codeTextData"),a(d)):(t.consume(d),l)}function c(d){return d===96?(t.consume(d),o++,c):o===s?(t.exit("codeTextSequence"),t.exit("codeText"),e(d)):(r.type="codeTextData",l(d))}}};class EP{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const o=n??Number.POSITIVE_INFINITY;return o<this.left.length?this.left.slice(e,o):e>this.left.length?this.right.slice(this.right.length-o+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-o+this.left.length).reverse())}splice(e,n,o){const r=n||0;this.setCursor(Math.trunc(e));const s=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return o&&Gi(this.left,o),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Gi(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Gi(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);Gi(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Gi(this.left,n.reverse())}}}function Gi(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function Ok(t){const e={};let n,o,r,s,i,a,l,c=-1;const d=new EP(t);for(;++c<d.length;){for(;c in e;)c=e[c];if(n=d.get(c),c&&n[1].type==="chunkFlow"&&d.get(c-1)[1].type==="listItemPrefix"&&(a=n[1]._tokenizer.events,r=0,r<a.length&&a[r][1].type==="lineEndingBlank"&&(r+=2),r<a.length&&a[r][1].type==="content"))for(;++r<a.length&&a[r][1].type!=="content";)a[r][1].type==="chunkText"&&(a[r][1]._isInFirstContentOfListItem=!0,r++);if(n[0]==="enter")n[1].contentType&&(Object.assign(e,IP(d,c)),c=e[c],l=!0);else if(n[1]._container){for(r=c,o=void 0;r--&&(s=d.get(r),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(o&&(d.get(o)[1].type="lineEndingBlank"),s[1].type="lineEnding",o=r);o&&(n[1].end={...d.get(o)[1].start},i=d.slice(o,c),i.unshift(n),d.splice(o,c-o+1,i))}}return lo(t,0,Number.POSITIVE_INFINITY,d.slice(0)),!l}function IP(t,e){const n=t.get(e)[1],o=t.get(e)[2];let r=e-1;const s=[],i=n._tokenizer||o.parser[n.contentType](n.start),a=i.events,l=[],c={};let d,u,f=-1,p=n,_=0,g=0;const m=[g];for(;p;){for(;t.get(++r)[1]!==p;);s.push(r),p._tokenizer||(d=o.sliceStream(p),p.next||d.push(null),u&&i.defineSkip(p.start),p._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=!0),i.write(d),p._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=void 0)),u=p,p=p.next}for(p=n;++f<a.length;)a[f][0]==="exit"&&a[f-1][0]==="enter"&&a[f][1].type===a[f-1][1].type&&a[f][1].start.line!==a[f][1].end.line&&(g=f+1,m.push(g),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(i.events=[],p?(p._tokenizer=void 0,p.previous=void 0):m.pop(),f=m.length;f--;){const b=a.slice(m[f],m[f+1]),x=s.pop();l.push([x,x+b.length-1]),t.splice(x,2,b)}for(l.reverse(),f=-1;++f<l.length;)c[_+l[f][0]]=_+l[f][1],_+=l[f][1]-l[f][0]-1;return c}const AP={resolve:function(t){return Ok(t),t},tokenize:function(t,e){let n;return function(i){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),o(i)};function o(i){return i===null?r(i):Ke(i)?t.check(TP,s,r)(i):(t.consume(i),o)}function r(i){return t.exit("chunkContent"),t.exit("content"),e(i)}function s(i){return t.consume(i),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}},TP={partial:!0,tokenize:function(t,e,n){const o=this;return function(s){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),bt(t,r,"linePrefix")};function r(s){if(s===null||Ke(s))return n(s);const i=o.events[o.events.length-1];return!o.parser.constructs.disable.null.includes("codeIndented")&&i&&i[1].type==="linePrefix"&&i[2].sliceSerialize(i[1],!0).length>=4?e(s):t.interrupt(o.parser.constructs.flow,n,e)(s)}}};function Dk(t,e,n,o,r,s,i,a,l){const c=l||Number.POSITIVE_INFINITY;let d=0;return function(m){return m===60?(t.enter(o),t.enter(r),t.enter(s),t.consume(m),t.exit(s),u):m===null||m===32||m===41||Cf(m)?n(m):(t.enter(o),t.enter(i),t.enter(a),t.enter("chunkString",{contentType:"string"}),_(m))};function u(m){return m===62?(t.enter(s),t.consume(m),t.exit(s),t.exit(r),t.exit(o),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),f(m))}function f(m){return m===62?(t.exit("chunkString"),t.exit(a),u(m)):m===null||m===60||Ke(m)?n(m):(t.consume(m),m===92?p:f)}function p(m){return m===60||m===62||m===92?(t.consume(m),f):f(m)}function _(m){return d||m!==null&&m!==41&&!_n(m)?d<c&&m===40?(t.consume(m),d++,_):m===41?(t.consume(m),d--,_):m===null||m===32||m===40||Cf(m)?n(m):(t.consume(m),m===92?g:_):(t.exit("chunkString"),t.exit(a),t.exit(i),t.exit(o),e(m))}function g(m){return m===40||m===41||m===92?(t.consume(m),_):_(m)}}function Rk(t,e,n,o,r,s){const i=this;let a,l=0;return function(f){return t.enter(o),t.enter(r),t.consume(f),t.exit(r),t.enter(s),c};function c(f){return l>999||f===null||f===91||f===93&&!a||f===94&&!l&&"_hiddenFootnoteSupport"in i.parser.constructs?n(f):f===93?(t.exit(s),t.enter(r),t.consume(f),t.exit(r),t.exit(o),e):Ke(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),c):(t.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===null||f===91||f===93||Ke(f)||l++>999?(t.exit("chunkString"),c(f)):(t.consume(f),a||(a=!ht(f)),f===92?u:d)}function u(f){return f===91||f===92||f===93?(t.consume(f),l++,d):d(f)}}function Pk(t,e,n,o,r,s){let i;return function(u){return u===34||u===39||u===40?(t.enter(o),t.enter(r),t.consume(u),t.exit(r),i=u===40?41:u,a):n(u)};function a(u){return u===i?(t.enter(r),t.consume(u),t.exit(r),t.exit(o),e):(t.enter(s),l(u))}function l(u){return u===i?(t.exit(s),a(i)):u===null?n(u):Ke(u)?(t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),bt(t,l,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),c(u))}function c(u){return u===i||u===null||Ke(u)?(t.exit("chunkString"),l(u)):(t.consume(u),u===92?d:c)}function d(u){return u===i||u===92?(t.consume(u),c):c(u)}}function Yi(t,e){let n;return function o(r){return Ke(r)?(t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),n=!0,o):ht(r)?bt(t,o,n?"linePrefix":"lineSuffix")(r):e(r)}}const MP={name:"definition",tokenize:function(t,e,n){const o=this;let r;return function(u){return t.enter("definition"),function(f){return Rk.call(o,t,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}(u)};function s(u){return r=ys(o.sliceSerialize(o.events[o.events.length-1][1]).slice(1,-1)),u===58?(t.enter("definitionMarker"),t.consume(u),t.exit("definitionMarker"),i):n(u)}function i(u){return _n(u)?Yi(t,a)(u):a(u)}function a(u){return Dk(t,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(u)}function l(u){return t.attempt(OP,c,c)(u)}function c(u){return ht(u)?bt(t,d,"whitespace")(u):d(u)}function d(u){return u===null||Ke(u)?(t.exit("definition"),o.parser.defined.push(r),e(u)):n(u)}}},OP={partial:!0,tokenize:function(t,e,n){return function(i){return _n(i)?Yi(t,o)(i):n(i)};function o(i){return Pk(t,r,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(i)}function r(i){return ht(i)?bt(t,s,"whitespace")(i):s(i)}function s(i){return i===null||Ke(i)?e(i):n(i)}}},DP={name:"hardBreakEscape",tokenize:function(t,e,n){return function(r){return t.enter("hardBreakEscape"),t.consume(r),o};function o(r){return Ke(r)?(t.exit("hardBreakEscape"),e(r)):n(r)}}},RP={name:"headingAtx",resolve:function(t,e){let n,o,r=t.length-2,s=3;return t[s][1].type==="whitespace"&&(s+=2),r-2>s&&t[r][1].type==="whitespace"&&(r-=2),t[r][1].type==="atxHeadingSequence"&&(s===r-1||r-4>s&&t[r-2][1].type==="whitespace")&&(r-=s+1===r?2:4),r>s&&(n={type:"atxHeadingText",start:t[s][1].start,end:t[r][1].end},o={type:"chunkText",start:t[s][1].start,end:t[r][1].end,contentType:"text"},lo(t,s,r-s+1,[["enter",n,e],["enter",o,e],["exit",o,e],["exit",n,e]])),t},tokenize:function(t,e,n){let o=0;return function(l){return t.enter("atxHeading"),function(c){return t.enter("atxHeadingSequence"),r(c)}(l)};function r(l){return l===35&&o++<6?(t.consume(l),r):l===null||_n(l)?(t.exit("atxHeadingSequence"),s(l)):n(l)}function s(l){return l===35?(t.enter("atxHeadingSequence"),i(l)):l===null||Ke(l)?(t.exit("atxHeading"),e(l)):ht(l)?bt(t,s,"whitespace")(l):(t.enter("atxHeadingText"),a(l))}function i(l){return l===35?(t.consume(l),i):(t.exit("atxHeadingSequence"),s(l))}function a(l){return l===null||l===35||_n(l)?(t.exit("atxHeadingText"),s(l)):(t.consume(l),a)}}},PP=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Lk=["pre","script","style","textarea"],LP={concrete:!0,name:"htmlFlow",resolveTo:function(t){let e=t.length;for(;e--&&(t[e][0]!=="enter"||t[e][1].type!=="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t},tokenize:function(t,e,n){const o=this;let r,s,i,a,l;return function(N){return function(H){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(H),c}(N)};function c(N){return N===33?(t.consume(N),d):N===47?(t.consume(N),s=!0,p):N===63?(t.consume(N),r=3,o.interrupt?e:P):co(N)?(t.consume(N),i=String.fromCharCode(N),_):n(N)}function d(N){return N===45?(t.consume(N),r=2,u):N===91?(t.consume(N),r=5,a=0,f):co(N)?(t.consume(N),r=4,o.interrupt?e:P):n(N)}function u(N){return N===45?(t.consume(N),o.interrupt?e:P):n(N)}function f(N){return N==="CDATA[".charCodeAt(a++)?(t.consume(N),a===6?o.interrupt?e:T:f):n(N)}function p(N){return co(N)?(t.consume(N),i=String.fromCharCode(N),_):n(N)}function _(N){if(N===null||N===47||N===62||_n(N)){const H=N===47,G=i.toLowerCase();return H||s||!Lk.includes(G)?PP.includes(i.toLowerCase())?(r=6,H?(t.consume(N),g):o.interrupt?e(N):T(N)):(r=7,o.interrupt&&!o.parser.lazy[o.now().line]?n(N):s?m(N):b(N)):(r=1,o.interrupt?e(N):T(N))}return N===45||kn(N)?(t.consume(N),i+=String.fromCharCode(N),_):n(N)}function g(N){return N===62?(t.consume(N),o.interrupt?e:T):n(N)}function m(N){return ht(N)?(t.consume(N),m):j(N)}function b(N){return N===47?(t.consume(N),j):N===58||N===95||co(N)?(t.consume(N),x):ht(N)?(t.consume(N),b):j(N)}function x(N){return N===45||N===46||N===58||N===95||kn(N)?(t.consume(N),x):y(N)}function y(N){return N===61?(t.consume(N),v):ht(N)?(t.consume(N),y):b(N)}function v(N){return N===null||N===60||N===61||N===62||N===96?n(N):N===34||N===39?(t.consume(N),l=N,k):ht(N)?(t.consume(N),v):S(N)}function k(N){return N===l?(t.consume(N),l=null,E):N===null||Ke(N)?n(N):(t.consume(N),k)}function S(N){return N===null||N===34||N===39||N===47||N===60||N===61||N===62||N===96||_n(N)?y(N):(t.consume(N),S)}function E(N){return N===47||N===62||ht(N)?b(N):n(N)}function j(N){return N===62?(t.consume(N),I):n(N)}function I(N){return N===null||Ke(N)?T(N):ht(N)?(t.consume(N),I):n(N)}function T(N){return N===45&&r===2?(t.consume(N),O):N===60&&r===1?(t.consume(N),z):N===62&&r===4?(t.consume(N),C):N===63&&r===3?(t.consume(N),P):N===93&&r===5?(t.consume(N),V):!Ke(N)||r!==6&&r!==7?N===null||Ke(N)?(t.exit("htmlFlowData"),M(N)):(t.consume(N),T):(t.exit("htmlFlowData"),t.check(FP,$,M)(N))}function M(N){return t.check(zP,L,$)(N)}function L(N){return t.enter("lineEnding"),t.consume(N),t.exit("lineEnding"),B}function B(N){return N===null||Ke(N)?M(N):(t.enter("htmlFlowData"),T(N))}function O(N){return N===45?(t.consume(N),P):T(N)}function z(N){return N===47?(t.consume(N),i="",F):T(N)}function F(N){if(N===62){const H=i.toLowerCase();return Lk.includes(H)?(t.consume(N),C):T(N)}return co(N)&&i.length<8?(t.consume(N),i+=String.fromCharCode(N),F):T(N)}function V(N){return N===93?(t.consume(N),P):T(N)}function P(N){return N===62?(t.consume(N),C):N===45&&r===2?(t.consume(N),P):T(N)}function C(N){return N===null||Ke(N)?(t.exit("htmlFlowData"),$(N)):(t.consume(N),C)}function $(N){return t.exit("htmlFlow"),e(N)}}},FP={partial:!0,tokenize:function(t,e,n){return function(o){return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),t.attempt(ql,e,n)}}},zP={partial:!0,tokenize:function(t,e,n){const o=this;return function(s){return Ke(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),r):n(s)};function r(s){return o.parser.lazy[o.now().line]?n(s):e(s)}}},BP={name:"htmlText",tokenize:function(t,e,n){const o=this;let r,s,i;return function(C){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(C),a};function a(C){return C===33?(t.consume(C),l):C===47?(t.consume(C),v):C===63?(t.consume(C),x):co(C)?(t.consume(C),E):n(C)}function l(C){return C===45?(t.consume(C),c):C===91?(t.consume(C),s=0,p):co(C)?(t.consume(C),b):n(C)}function c(C){return C===45?(t.consume(C),f):n(C)}function d(C){return C===null?n(C):C===45?(t.consume(C),u):Ke(C)?(i=d,F(C)):(t.consume(C),d)}function u(C){return C===45?(t.consume(C),f):d(C)}function f(C){return C===62?z(C):C===45?u(C):d(C)}function p(C){return C==="CDATA[".charCodeAt(s++)?(t.consume(C),s===6?_:p):n(C)}function _(C){return C===null?n(C):C===93?(t.consume(C),g):Ke(C)?(i=_,F(C)):(t.consume(C),_)}function g(C){return C===93?(t.consume(C),m):_(C)}function m(C){return C===62?z(C):C===93?(t.consume(C),m):_(C)}function b(C){return C===null||C===62?z(C):Ke(C)?(i=b,F(C)):(t.consume(C),b)}function x(C){return C===null?n(C):C===63?(t.consume(C),y):Ke(C)?(i=x,F(C)):(t.consume(C),x)}function y(C){return C===62?z(C):x(C)}function v(C){return co(C)?(t.consume(C),k):n(C)}function k(C){return C===45||kn(C)?(t.consume(C),k):S(C)}function S(C){return Ke(C)?(i=S,F(C)):ht(C)?(t.consume(C),S):z(C)}function E(C){return C===45||kn(C)?(t.consume(C),E):C===47||C===62||_n(C)?j(C):n(C)}function j(C){return C===47?(t.consume(C),z):C===58||C===95||co(C)?(t.consume(C),I):Ke(C)?(i=j,F(C)):ht(C)?(t.consume(C),j):z(C)}function I(C){return C===45||C===46||C===58||C===95||kn(C)?(t.consume(C),I):T(C)}function T(C){return C===61?(t.consume(C),M):Ke(C)?(i=T,F(C)):ht(C)?(t.consume(C),T):j(C)}function M(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(t.consume(C),r=C,L):Ke(C)?(i=M,F(C)):ht(C)?(t.consume(C),M):(t.consume(C),B)}function L(C){return C===r?(t.consume(C),r=void 0,O):C===null?n(C):Ke(C)?(i=L,F(C)):(t.consume(C),L)}function B(C){return C===null||C===34||C===39||C===60||C===61||C===96?n(C):C===47||C===62||_n(C)?j(C):(t.consume(C),B)}function O(C){return C===47||C===62||_n(C)?j(C):n(C)}function z(C){return C===62?(t.consume(C),t.exit("htmlTextData"),t.exit("htmlText"),e):n(C)}function F(C){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(C),t.exit("lineEnding"),V}function V(C){return ht(C)?bt(t,P,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):P(C)}function P(C){return t.enter("htmlTextData"),i(C)}}},Af={name:"labelEnd",resolveAll:function(t){let e=-1;const n=[];for(;++e<t.length;){const o=t[e][1];if(n.push(t[e]),o.type==="labelImage"||o.type==="labelLink"||o.type==="labelEnd"){const r=o.type==="labelImage"?4:2;o.type="data",e+=r}}return t.length!==n.length&&lo(t,0,t.length,n),t},resolveTo:function(t,e){let n,o,r,s,i=t.length,a=0;for(;i--;)if(n=t[i][1],o){if(n.type==="link"||n.type==="labelLink"&&n._inactive)break;t[i][0]==="enter"&&n.type==="labelLink"&&(n._inactive=!0)}else if(r){if(t[i][0]==="enter"&&(n.type==="labelImage"||n.type==="labelLink")&&!n._balanced&&(o=i,n.type!=="labelLink")){a=2;break}}else n.type==="labelEnd"&&(r=i);const l={type:t[o][1].type==="labelLink"?"link":"image",start:{...t[o][1].start},end:{...t[t.length-1][1].end}},c={type:"label",start:{...t[o][1].start},end:{...t[r][1].end}},d={type:"labelText",start:{...t[o+a+2][1].end},end:{...t[r-2][1].start}};return s=[["enter",l,e],["enter",c,e]],s=zn(s,t.slice(o+1,o+a+3)),s=zn(s,[["enter",d,e]]),s=zn(s,jf(e.parser.constructs.insideSpan.null,t.slice(o+a+4,r-3),e)),s=zn(s,[["exit",d,e],t[r-2],t[r-1],["exit",c,e]]),s=zn(s,t.slice(r+1)),s=zn(s,[["exit",l,e]]),lo(t,o,t.length,s),t},tokenize:function(t,e,n){const o=this;let r,s,i=o.events.length;for(;i--;)if((o.events[i][1].type==="labelImage"||o.events[i][1].type==="labelLink")&&!o.events[i][1]._balanced){r=o.events[i][1];break}return function(u){return r?r._inactive?d(u):(s=o.parser.defined.includes(ys(o.sliceSerialize({start:r.end,end:o.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(u),t.exit("labelMarker"),t.exit("labelEnd"),a):n(u)};function a(u){return u===40?t.attempt(UP,c,s?c:d)(u):u===91?t.attempt(VP,c,s?l:d)(u):s?c(u):d(u)}function l(u){return t.attempt($P,c,d)(u)}function c(u){return e(u)}function d(u){return r._balanced=!0,n(u)}}},UP={tokenize:function(t,e,n){return function(d){return t.enter("resource"),t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),o};function o(d){return _n(d)?Yi(t,r)(d):r(d)}function r(d){return d===41?c(d):Dk(t,s,i,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function s(d){return _n(d)?Yi(t,a)(d):c(d)}function i(d){return n(d)}function a(d){return d===34||d===39||d===40?Pk(t,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):c(d)}function l(d){return _n(d)?Yi(t,c)(d):c(d)}function c(d){return d===41?(t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),t.exit("resource"),e):n(d)}}},VP={tokenize:function(t,e,n){const o=this;return function(i){return Rk.call(o,t,r,s,"reference","referenceMarker","referenceString")(i)};function r(i){return o.parser.defined.includes(ys(o.sliceSerialize(o.events[o.events.length-1][1]).slice(1,-1)))?e(i):n(i)}function s(i){return n(i)}}},$P={tokenize:function(t,e,n){return function(r){return t.enter("reference"),t.enter("referenceMarker"),t.consume(r),t.exit("referenceMarker"),o};function o(r){return r===93?(t.enter("referenceMarker"),t.consume(r),t.exit("referenceMarker"),t.exit("reference"),e):n(r)}}},HP={name:"labelStartImage",resolveAll:Af.resolveAll,tokenize:function(t,e,n){const o=this;return function(i){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(i),t.exit("labelImageMarker"),r};function r(i){return i===91?(t.enter("labelMarker"),t.consume(i),t.exit("labelMarker"),t.exit("labelImage"),s):n(i)}function s(i){return i===94&&"_hiddenFootnoteSupport"in o.parser.constructs?n(i):e(i)}}},WP={name:"labelStartLink",resolveAll:Af.resolveAll,tokenize:function(t,e,n){const o=this;return function(s){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(s),t.exit("labelMarker"),t.exit("labelLink"),r};function r(s){return s===94&&"_hiddenFootnoteSupport"in o.parser.constructs?n(s):e(s)}}},Tf={name:"lineEnding",tokenize:function(t,e){return function(n){return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),bt(t,e,"linePrefix")}}},Gl={name:"thematicBreak",tokenize:function(t,e,n){let o,r=0;return function(a){return t.enter("thematicBreak"),function(l){return o=l,s(l)}(a)};function s(a){return a===o?(t.enter("thematicBreakSequence"),i(a)):r>=3&&(a===null||Ke(a))?(t.exit("thematicBreak"),e(a)):n(a)}function i(a){return a===o?(t.consume(a),r++,i):(t.exit("thematicBreakSequence"),ht(a)?bt(t,s,"whitespace")(a):s(a))}}},bn={continuation:{tokenize:function(t,e,n){const o=this;return o.containerState._closeFlow=void 0,t.check(ql,r,s);function r(a){return o.containerState.furtherBlankLines=o.containerState.furtherBlankLines||o.containerState.initialBlankLine,bt(t,e,"listItemIndent",o.containerState.size+1)(a)}function s(a){return o.containerState.furtherBlankLines||!ht(a)?(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,i(a)):(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,t.attempt(GP,e,i)(a))}function i(a){return o.containerState._closeFlow=!0,o.interrupt=void 0,bt(t,t.attempt(bn,e,n),"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}},exit:function(t){t.exit(this.containerState.type)},name:"list",tokenize:function(t,e,n){const o=this,r=o.events[o.events.length-1];let s=r&&r[1].type==="linePrefix"?r[2].sliceSerialize(r[1],!0).length:0,i=0;return function(f){const p=o.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(p==="listUnordered"?!o.containerState.marker||f===o.containerState.marker:Nf(f)){if(o.containerState.type||(o.containerState.type=p,t.enter(p,{_container:!0})),p==="listUnordered")return t.enter("listItemPrefix"),f===42||f===45?t.check(Gl,n,l)(f):l(f);if(!o.interrupt||f===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),a(f)}return n(f)};function a(f){return Nf(f)&&++i<10?(t.consume(f),a):(!o.interrupt||i<2)&&(o.containerState.marker?f===o.containerState.marker:f===41||f===46)?(t.exit("listItemValue"),l(f)):n(f)}function l(f){return t.enter("listItemMarker"),t.consume(f),t.exit("listItemMarker"),o.containerState.marker=o.containerState.marker||f,t.check(ql,o.interrupt?n:c,t.attempt(qP,u,d))}function c(f){return o.containerState.initialBlankLine=!0,s++,u(f)}function d(f){return ht(f)?(t.enter("listItemPrefixWhitespace"),t.consume(f),t.exit("listItemPrefixWhitespace"),u):n(f)}function u(f){return o.containerState.size=s+o.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(f)}}},qP={partial:!0,tokenize:function(t,e,n){const o=this;return bt(t,function(r){const s=o.events[o.events.length-1];return!ht(r)&&s&&s[1].type==="listItemPrefixWhitespace"?e(r):n(r)},"listItemPrefixWhitespace",o.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},GP={partial:!0,tokenize:function(t,e,n){const o=this;return bt(t,function(r){const s=o.events[o.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===o.containerState.size?e(r):n(r)},"listItemIndent",o.containerState.size+1)}},Fk={name:"setextUnderline",resolveTo:function(t,e){let n,o,r,s=t.length;for(;s--;)if(t[s][0]==="enter"){if(t[s][1].type==="content"){n=s;break}t[s][1].type==="paragraph"&&(o=s)}else t[s][1].type==="content"&&t.splice(s,1),r||t[s][1].type!=="definition"||(r=s);const i={type:"setextHeading",start:{...t[o][1].start},end:{...t[t.length-1][1].end}};return t[o][1].type="setextHeadingText",r?(t.splice(o,0,["enter",i,e]),t.splice(r+1,0,["exit",t[n][1],e]),t[n][1].end={...t[r][1].end}):t[n][1]=i,t.push(["exit",i,e]),t},tokenize:function(t,e,n){const o=this;let r;return function(a){let l,c=o.events.length;for(;c--;)if(o.events[c][1].type!=="lineEnding"&&o.events[c][1].type!=="linePrefix"&&o.events[c][1].type!=="content"){l=o.events[c][1].type==="paragraph";break}return!o.parser.lazy[o.now().line]&&(o.interrupt||l)?(t.enter("setextHeadingLine"),r=a,function(d){return t.enter("setextHeadingLineSequence"),s(d)}(a)):n(a)};function s(a){return a===r?(t.consume(a),s):(t.exit("setextHeadingLineSequence"),ht(a)?bt(t,i,"lineSuffix")(a):i(a))}function i(a){return a===null||Ke(a)?(t.exit("setextHeadingLine"),e(a)):n(a)}}},YP={tokenize:function(t){const e=this,n=t.attempt(ql,function(r){return r===null?void t.consume(r):(t.enter("lineEndingBlank"),t.consume(r),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n)},t.attempt(this.parser.constructs.flowInitial,o,bt(t,t.attempt(this.parser.constructs.flow,o,t.attempt(AP,o)),"linePrefix")));return n;function o(r){if(r!==null)return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),e.currentConstruct=void 0,n;t.consume(r)}}},JP={resolveAll:Bk()},KP=zk("string"),XP=zk("text");function zk(t){return{resolveAll:Bk(t==="text"?ZP:void 0),tokenize:function(e){const n=this,o=this.parser.constructs[t],r=e.attempt(o,s,i);return s;function s(c){return l(c)?r(c):i(c)}function i(c){if(c!==null)return e.enter("data"),e.consume(c),a;e.consume(c)}function a(c){return l(c)?(e.exit("data"),r(c)):(e.consume(c),a)}function l(c){if(c===null)return!0;const d=o[c];let u=-1;if(d)for(;++u<d.length;){const f=d[u];if(!f.previous||f.previous.call(n,n.previous))return!0}return!1}}}}function Bk(t){return function(e,n){let o,r=-1;for(;++r<=e.length;)o===void 0?e[r]&&e[r][1].type==="data"&&(o=r,r++):e[r]&&e[r][1].type==="data"||(r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),r=o+2),o=void 0);return t?t(e,n):e}}function ZP(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const o=t[n-1][1],r=e.sliceStream(o);let s,i=r.length,a=-1,l=0;for(;i--;){const c=r[i];if(typeof c=="string"){for(a=c.length;c.charCodeAt(a-1)===32;)l++,a--;if(a)break;a=-1}else if(c===-2)s=!0,l++;else if(c!==-1){i++;break}}if(l){const c={type:n===t.length||s||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?a:o.start._bufferIndex+a,_index:o.start._index+i,line:o.end.line,column:o.end.column-l,offset:o.end.offset-l},end:{...o.end}};o.end={...c.start},o.start.offset===o.end.offset?Object.assign(o,c):(t.splice(n,0,["enter",c,e],["exit",c,e]),n+=2)}n++}return t}const QP={42:bn,43:bn,45:bn,48:bn,49:bn,50:bn,51:bn,52:bn,53:bn,54:bn,55:bn,56:bn,57:bn,62:Ek},eL={91:MP},tL={[-2]:If,[-1]:If,32:If},nL={35:RP,42:Gl,45:[Fk,Gl],60:LP,61:Fk,95:Gl,96:Mk,126:Mk},oL={38:Ak,92:Ik},rL={[-5]:Tf,[-4]:Tf,[-3]:Tf,33:HP,38:Ak,42:Ef,60:[CP,BP],91:WP,92:[DP,Ik],93:Af,95:Ef,96:jP},sL={null:[Ef,JP]},iL=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:{null:[42,95]},contentInitial:eL,disable:{null:[]},document:QP,flow:nL,flowInitial:tL,insideSpan:sL,string:oL,text:rL},Symbol.toStringTag,{value:"Module"}));function aL(t,e,n){let o={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const r={},s=[];let i=[],a=[];const l={attempt:m(function(y,v){b(y,v.from)}),check:m(g),consume:function(y){Ke(y)?(o.line++,o.column=1,o.offset+=y===-3?2:1,x()):y!==-1&&(o.column++,o.offset++),o._bufferIndex<0?o._index++:(o._bufferIndex++,o._bufferIndex===i[o._index].length&&(o._bufferIndex=-1,o._index++)),c.previous=y},enter:function(y,v){const k=v||{};return k.type=y,k.start=f(),c.events.push(["enter",k,c]),a.push(k),k},exit:function(y){const v=a.pop();return v.end=f(),c.events.push(["exit",v,c]),v},interrupt:m(g,{interrupt:!0})},c={code:null,containerState:{},defineSkip:function(y){r[y.line]=y.column,x()},events:[],now:f,parser:t,previous:null,sliceSerialize:function(y,v){return function(k,S){let E=-1;const j=[];let I;for(;++E<k.length;){const T=k[E];let M;if(typeof T=="string")M=T;else switch(T){case-5:M="\r";break;case-4:M=`
128
128
  `;break;case-3:M=`\r
129
- `;break;case-2:M=S?" ":" ";break;case-1:if(!S&&I)continue;M=" ";break;default:M=String.fromCharCode(T)}I=T===-2,j.push(M)}return j.join("")}(u(y),v)},sliceStream:u,write:function(y){return i=zn(i,y),p(),i[i.length-1]!==null?[]:(b(e,0),c.events=Nf(s,c.events,c),c.events)}};let d=e.tokenize.call(c,l);return e.resolveAll&&s.push(e),c;function u(y){return function(v,k){const S=k.start._index,E=k.start._bufferIndex,j=k.end._index,I=k.end._bufferIndex;let T;if(S===j)T=[v[S].slice(E,I)];else{if(T=v.slice(S,j),E>-1){const M=T[0];typeof M=="string"?T[0]=M.slice(E):T.shift()}I>0&&T.push(v[j].slice(0,I))}return T}(i,y)}function f(){const{_bufferIndex:y,_index:v,line:k,column:S,offset:E}=o;return{_bufferIndex:y,_index:v,line:k,column:S,offset:E}}function p(){let y;for(;o._index<i.length;){const v=i[o._index];if(typeof v=="string")for(y=o._index,o._bufferIndex<0&&(o._bufferIndex=0);o._index===y&&o._bufferIndex<v.length;)_(v.charCodeAt(o._bufferIndex));else _(v)}}function _(y){d=d(y)}function g(y,v){v.restore()}function m(y,v){return function(k,S,E){let j,I,T,M;return Array.isArray(k)?L(k):"tokenize"in k?L([k]):function(F){return V;function V(P){const C=P!==null&&F[P],$=P!==null&&F.null;return L([...Array.isArray(C)?C:C?[C]:[],...Array.isArray($)?$:$?[$]:[]])(P)}}(k);function L(F){return j=F,I=0,F.length===0?E:B(F[I])}function B(F){return function(V){return M=function(){const P=f(),C=c.previous,$=c.currentConstruct,N=c.events.length,H=Array.from(a);return{from:N,restore:G};function G(){o=P,c.previous=C,c.currentConstruct=$,c.events.length=N,a=H,x()}}(),T=F,F.partial||(c.currentConstruct=F),F.name&&c.parser.constructs.disable.null.includes(F.name)?z():F.tokenize.call(v?Object.assign(Object.create(c),v):c,l,O,z)(V)}}function O(F){return y(T,M),S}function z(F){return M.restore(),++I<j.length?B(j[I]):E}}}function b(y,v){y.resolveAll&&!s.includes(y)&&s.push(y),y.resolve&&lo(c.events,v,c.events.length-v,y.resolve(c.events.slice(v),c)),y.resolveTo&&(c.events=y.resolveTo(c.events,c))}function x(){o.line in r&&o.column<2&&(o.column=r[o.line],o.offset+=r[o.line]-1)}}function lL(t){const e=function(r){const s={};let i=-1;for(;++i<r.length;)gP(s,r[i]);return s}([iL,...(t||{}).extensions||[]]),n={constructs:e,content:o(kP),defined:[],document:o(SP),flow:o(YP),lazy:{},string:o(KP),text:o(XP)};return n;function o(r){return function(s){return aL(n,r,s)}}}const Uk=/[\0\t\n\r]/g,cL=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function dL(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),r=o===120||o===88;return Sk(n.slice(r?2:1),r?16:10)}return kf(n)||t}const Vk={}.hasOwnProperty;function uL(t,e,n){return typeof e!="string"&&(n=e,e=void 0),function(o){const r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(Te),autolinkProtocol:L,autolinkEmail:L,atxHeading:l(ae),blockQuote:l(de),characterEscape:L,characterReference:L,codeFenced:l(me),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:l(me,c),codeText:l(ie,c),codeTextData:L,data:L,codeFlowValue:L,definition:l(Ce),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:l(we),hardBreakEscape:l(ve),hardBreakTrailing:l(ve),htmlFlow:l(ge,c),htmlFlowData:L,htmlText:l(ge,c),htmlTextData:L,image:l(be),label:c,link:l(Te),listItem:l(Xe),listItemValue:g,listOrdered:l(ze,_),listUnordered:l(ze),paragraph:l(Fe),reference:re,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:l(ae),strong:l(et),thematicBreak:l(it)},exit:{atxHeading:u(),atxHeadingSequence:j,autolink:u(),autolinkEmail:he,autolinkProtocol:ce,blockQuote:u(),characterEscapeValue:B,characterReferenceMarkerHexadecimal:oe,characterReferenceMarkerNumeric:oe,characterReferenceValue:Y,characterReference:Q,codeFenced:u(y),codeFencedFence:x,codeFencedFenceInfo:m,codeFencedFenceMeta:b,codeFlowValue:B,codeIndented:u(v),codeText:u(P),codeTextData:B,data:B,definition:u(),definitionDestinationString:E,definitionLabelString:k,definitionTitleString:S,emphasis:u(),hardBreakEscape:u(z),hardBreakTrailing:u(z),htmlFlow:u(F),htmlFlowData:B,htmlText:u(V),htmlTextData:B,image:u($),label:H,labelText:N,lineEnding:O,link:u(C),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:ne,resourceDestinationString:G,resourceTitleString:Z,resource:q,setextHeading:u(M),setextHeadingLineSequence:T,setextHeadingText:I,strong:u(),thematicBreak:u()}};$k(r,(o||{}).mdastExtensions||[]);const s={};return i;function i(te){let Ne={type:"root",children:[]};const Me={stack:[Ne],tokenStack:[],config:r,enter:d,exit:f,buffer:c,resume:p,data:s},Be=[];let J=-1;for(;++J<te.length;)(te[J][1].type==="listOrdered"||te[J][1].type==="listUnordered")&&(te[J][0]==="enter"?Be.push(J):J=a(te,Be.pop(),J));for(J=-1;++J<te.length;){const pe=r[te[J][0]];Vk.call(pe,te[J][1].type)&&pe[te[J][1].type].call(Object.assign({sliceSerialize:te[J][2].sliceSerialize},Me),te[J][1])}if(Me.tokenStack.length>0){const pe=Me.tokenStack[Me.tokenStack.length-1];(pe[1]||Hk).call(Me,void 0,pe[0])}for(Ne.position={start:sr(te.length>0?te[0][1].start:{line:1,column:1,offset:0}),end:sr(te.length>0?te[te.length-2][1].end:{line:1,column:1,offset:0})},J=-1;++J<r.transforms.length;)Ne=r.transforms[J](Ne)||Ne;return Ne}function a(te,Ne,Me){let Be,J,pe,_e,ue=Ne-1,je=-1,ke=!1;for(;++ue<=Me;){const Ve=te[ue];switch(Ve[1].type){case"listUnordered":case"listOrdered":case"blockQuote":Ve[0]==="enter"?je++:je--,_e=void 0;break;case"lineEndingBlank":Ve[0]==="enter"&&(!Be||_e||je||pe||(pe=ue),_e=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:_e=void 0}if(!je&&Ve[0]==="enter"&&Ve[1].type==="listItemPrefix"||je===-1&&Ve[0]==="exit"&&(Ve[1].type==="listUnordered"||Ve[1].type==="listOrdered")){if(Be){let Ze=ue;for(J=void 0;Ze--;){const le=te[Ze];if(le[1].type==="lineEnding"||le[1].type==="lineEndingBlank"){if(le[0]==="exit")continue;J&&(te[J][1].type="lineEndingBlank",ke=!0),le[1].type="lineEnding",J=Ze}else if(le[1].type!=="linePrefix"&&le[1].type!=="blockQuotePrefix"&&le[1].type!=="blockQuotePrefixWhitespace"&&le[1].type!=="blockQuoteMarker"&&le[1].type!=="listItemIndent")break}pe&&(!J||pe<J)&&(Be._spread=!0),Be.end=Object.assign({},J?te[J][1].start:Ve[1].end),te.splice(J||ue,0,["exit",Be,Ve[2]]),ue++,Me++}if(Ve[1].type==="listItemPrefix"){const Ze={type:"listItem",_spread:!1,start:Object.assign({},Ve[1].start),end:void 0};Be=Ze,te.splice(ue,0,["enter",Ze,Ve[2]]),ue++,Me++,pe=void 0,_e=!0}}}return te[Ne][1]._spread=ke,Me}function l(te,Ne){return Me;function Me(Be){d.call(this,te(Be),Be),Ne&&Ne.call(this,Be)}}function c(){this.stack.push({type:"fragment",children:[]})}function d(te,Ne,Me){this.stack[this.stack.length-1].children.push(te),this.stack.push(te),this.tokenStack.push([Ne,Me||void 0]),te.position={start:sr(Ne.start),end:void 0}}function u(te){return Ne;function Ne(Me){te&&te.call(this,Me),f.call(this,Me)}}function f(te,Ne){const Me=this.stack.pop(),Be=this.tokenStack.pop();if(!Be)throw new Error("Cannot close `"+te.type+"` ("+Wi({start:te.start,end:te.end})+"): it\u2019s not open");Be[0].type!==te.type&&(Ne?Ne.call(this,te,Be[0]):(Be[1]||Hk).call(this,te,Be[0])),Me.position.end=sr(te.end)}function p(){return function(te){return xk(te,typeof Wl.includeImageAlt!="boolean"||Wl.includeImageAlt,typeof Wl.includeHtml!="boolean"||Wl.includeHtml)}(this.stack.pop())}function _(){this.data.expectingFirstListItemValue=!0}function g(te){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(te),10),this.data.expectingFirstListItemValue=void 0)}function m(){const te=this.resume();this.stack[this.stack.length-1].lang=te}function b(){const te=this.resume();this.stack[this.stack.length-1].meta=te}function x(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){const te=this.resume();this.stack[this.stack.length-1].value=te.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const te=this.resume();this.stack[this.stack.length-1].value=te.replace(/(\r?\n|\r)$/g,"")}function k(te){const Ne=this.resume(),Me=this.stack[this.stack.length-1];Me.label=Ne,Me.identifier=ys(this.sliceSerialize(te)).toLowerCase()}function S(){const te=this.resume();this.stack[this.stack.length-1].title=te}function E(){const te=this.resume();this.stack[this.stack.length-1].url=te}function j(te){const Ne=this.stack[this.stack.length-1];if(!Ne.depth){const Me=this.sliceSerialize(te).length;Ne.depth=Me}}function I(){this.data.setextHeadingSlurpLineEnding=!0}function T(te){this.stack[this.stack.length-1].depth=this.sliceSerialize(te).codePointAt(0)===61?1:2}function M(){this.data.setextHeadingSlurpLineEnding=void 0}function L(te){const Ne=this.stack[this.stack.length-1].children;let Me=Ne[Ne.length-1];Me&&Me.type==="text"||(Me=nt(),Me.position={start:sr(te.start),end:void 0},Ne.push(Me)),this.stack.push(Me)}function B(te){const Ne=this.stack.pop();Ne.value+=this.sliceSerialize(te),Ne.position.end=sr(te.end)}function O(te){const Ne=this.stack[this.stack.length-1];if(this.data.atHardBreak)return Ne.children[Ne.children.length-1].position.end=sr(te.end),void(this.data.atHardBreak=void 0);!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(Ne.type)&&(L.call(this,te),B.call(this,te))}function z(){this.data.atHardBreak=!0}function F(){const te=this.resume();this.stack[this.stack.length-1].value=te}function V(){const te=this.resume();this.stack[this.stack.length-1].value=te}function P(){const te=this.resume();this.stack[this.stack.length-1].value=te}function C(){const te=this.stack[this.stack.length-1];if(this.data.inReference){const Ne=this.data.referenceType||"shortcut";te.type+="Reference",te.referenceType=Ne,delete te.url,delete te.title}else delete te.identifier,delete te.label;this.data.referenceType=void 0}function $(){const te=this.stack[this.stack.length-1];if(this.data.inReference){const Ne=this.data.referenceType||"shortcut";te.type+="Reference",te.referenceType=Ne,delete te.url,delete te.title}else delete te.identifier,delete te.label;this.data.referenceType=void 0}function N(te){const Ne=this.sliceSerialize(te),Me=this.stack[this.stack.length-2];Me.label=function(Be){return Be.replace(cL,dL)}(Ne),Me.identifier=ys(Ne).toLowerCase()}function H(){const te=this.stack[this.stack.length-1],Ne=this.resume(),Me=this.stack[this.stack.length-1];if(this.data.inReference=!0,Me.type==="link"){const Be=te.children;Me.children=Be}else Me.alt=Ne}function G(){const te=this.resume();this.stack[this.stack.length-1].url=te}function Z(){const te=this.resume();this.stack[this.stack.length-1].title=te}function q(){this.data.inReference=void 0}function re(){this.data.referenceType="collapsed"}function ne(te){const Ne=this.resume(),Me=this.stack[this.stack.length-1];Me.label=Ne,Me.identifier=ys(this.sliceSerialize(te)).toLowerCase(),this.data.referenceType="full"}function oe(te){this.data.characterReferenceType=te.type}function Y(te){const Ne=this.sliceSerialize(te),Me=this.data.characterReferenceType;let Be;Me?(Be=Sk(Ne,Me==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Be=kf(Ne),this.stack[this.stack.length-1].value+=Be}function Q(te){this.stack.pop().position.end=sr(te.end)}function ce(te){B.call(this,te),this.stack[this.stack.length-1].url=this.sliceSerialize(te)}function he(te){B.call(this,te),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(te)}function de(){return{type:"blockquote",children:[]}}function me(){return{type:"code",lang:null,meta:null,value:""}}function ie(){return{type:"inlineCode",value:""}}function Ce(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function we(){return{type:"emphasis",children:[]}}function ae(){return{type:"heading",depth:0,children:[]}}function ve(){return{type:"break"}}function ge(){return{type:"html",value:""}}function be(){return{type:"image",title:null,url:"",alt:null}}function Te(){return{type:"link",title:null,url:"",children:[]}}function ze(te){return{type:"list",ordered:te.type==="listOrdered",start:null,spread:te._spread,children:[]}}function Xe(te){return{type:"listItem",spread:te._spread,checked:null,children:[]}}function Fe(){return{type:"paragraph",children:[]}}function et(){return{type:"strong",children:[]}}function nt(){return{type:"text",value:""}}function it(){return{type:"thematicBreak"}}}(n)(function(o){for(;!Ok(o););return o}(lL(n).document().write(function(){let o,r=1,s="",i=!0;return function(a,l,c){const d=[];let u,f,p,_,g;for(a=s+(typeof a=="string"?a.toString():new TextDecoder(l||void 0).decode(a)),p=0,s="",i&&(a.charCodeAt(0)===65279&&p++,i=void 0);p<a.length;){if(Uk.lastIndex=p,u=Uk.exec(a),_=u&&u.index!==void 0?u.index:a.length,g=a.charCodeAt(_),!u){s=a.slice(p);break}if(g===10&&p===_&&o)d.push(-3),o=void 0;else switch(o&&(d.push(-5),o=void 0),p<_&&(d.push(a.slice(p,_)),r+=_-p),g){case 0:d.push(65533),r++;break;case 9:for(f=4*Math.ceil(r/4),d.push(-2);r++<f;)d.push(-1);break;case 10:d.push(-4),r=1;break;default:o=!0,r=1}p=_+1}return c&&(o&&d.push(-5),s&&d.push(s),d.push(null)),d}}()(t,e,!0))))}function sr(t){return{line:t.line,column:t.column,offset:t.offset}}function $k(t,e){let n=-1;for(;++n<e.length;){const o=e[n];Array.isArray(o)?$k(t,o):hL(t,o)}}function hL(t,e){let n;for(n in e)if(Vk.call(e,n))switch(n){case"canContainEols":{const o=e[n];o&&t[n].push(...o);break}case"transforms":{const o=e[n];o&&t[n].push(...o);break}case"enter":case"exit":{const o=e[n];o&&Object.assign(t[n],o);break}}}function Hk(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+Wi({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+Wi({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+Wi({start:e.start,end:e.end})+") is still open")}function fL(t){const e=this;e.parser=function(n){return uL(n,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function Wk(t,e){const n=e.referenceType;let o="]";if(n==="collapsed"?o+="[]":n==="full"&&(o+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+o}];const r=t.all(e),s=r[0];s&&s.type==="text"?s.value="["+s.value:r.unshift({type:"text",value:"["});const i=r[r.length-1];return i&&i.type==="text"?i.value+=o:r.push({type:"text",value:o}),r}function qk(t){const e=t.spread;return e??t.children.length>1}function pL(t){const e=String(t),n=/\r?\n|\r/g;let o=n.exec(e),r=0;const s=[];for(;o;)s.push(Gk(e.slice(r,o.index),r>0,!0),o[0]),r=o.index+o[0].length,o=n.exec(e);return s.push(Gk(e.slice(r),r>0,!1)),s.join("")}function Gk(t,e,n){let o=0,r=t.length;if(e){let s=t.codePointAt(o);for(;s===9||s===32;)o++,s=t.codePointAt(o)}if(n){let s=t.codePointAt(r-1);for(;s===9||s===32;)r--,s=t.codePointAt(r-1)}return r>o?t.slice(o,r):""}const mL={blockquote:function(t,e){const n={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,n),t.applyData(e,n)},break:function(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
129
+ `;break;case-2:M=S?" ":" ";break;case-1:if(!S&&I)continue;M=" ";break;default:M=String.fromCharCode(T)}I=T===-2,j.push(M)}return j.join("")}(u(y),v)},sliceStream:u,write:function(y){return i=zn(i,y),p(),i[i.length-1]!==null?[]:(b(e,0),c.events=jf(s,c.events,c),c.events)}};let d=e.tokenize.call(c,l);return e.resolveAll&&s.push(e),c;function u(y){return function(v,k){const S=k.start._index,E=k.start._bufferIndex,j=k.end._index,I=k.end._bufferIndex;let T;if(S===j)T=[v[S].slice(E,I)];else{if(T=v.slice(S,j),E>-1){const M=T[0];typeof M=="string"?T[0]=M.slice(E):T.shift()}I>0&&T.push(v[j].slice(0,I))}return T}(i,y)}function f(){const{_bufferIndex:y,_index:v,line:k,column:S,offset:E}=o;return{_bufferIndex:y,_index:v,line:k,column:S,offset:E}}function p(){let y;for(;o._index<i.length;){const v=i[o._index];if(typeof v=="string")for(y=o._index,o._bufferIndex<0&&(o._bufferIndex=0);o._index===y&&o._bufferIndex<v.length;)_(v.charCodeAt(o._bufferIndex));else _(v)}}function _(y){d=d(y)}function g(y,v){v.restore()}function m(y,v){return function(k,S,E){let j,I,T,M;return Array.isArray(k)?L(k):"tokenize"in k?L([k]):function(F){return V;function V(P){const C=P!==null&&F[P],$=P!==null&&F.null;return L([...Array.isArray(C)?C:C?[C]:[],...Array.isArray($)?$:$?[$]:[]])(P)}}(k);function L(F){return j=F,I=0,F.length===0?E:B(F[I])}function B(F){return function(V){return M=function(){const P=f(),C=c.previous,$=c.currentConstruct,N=c.events.length,H=Array.from(a);return{from:N,restore:G};function G(){o=P,c.previous=C,c.currentConstruct=$,c.events.length=N,a=H,x()}}(),T=F,F.partial||(c.currentConstruct=F),F.name&&c.parser.constructs.disable.null.includes(F.name)?z():F.tokenize.call(v?Object.assign(Object.create(c),v):c,l,O,z)(V)}}function O(F){return y(T,M),S}function z(F){return M.restore(),++I<j.length?B(j[I]):E}}}function b(y,v){y.resolveAll&&!s.includes(y)&&s.push(y),y.resolve&&lo(c.events,v,c.events.length-v,y.resolve(c.events.slice(v),c)),y.resolveTo&&(c.events=y.resolveTo(c.events,c))}function x(){o.line in r&&o.column<2&&(o.column=r[o.line],o.offset+=r[o.line]-1)}}function lL(t){const e=function(r){const s={};let i=-1;for(;++i<r.length;)gP(s,r[i]);return s}([iL,...(t||{}).extensions||[]]),n={constructs:e,content:o(kP),defined:[],document:o(SP),flow:o(YP),lazy:{},string:o(KP),text:o(XP)};return n;function o(r){return function(s){return aL(n,r,s)}}}const Uk=/[\0\t\n\r]/g,cL=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function dL(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),r=o===120||o===88;return Sk(n.slice(r?2:1),r?16:10)}return Sf(n)||t}const Vk={}.hasOwnProperty;function uL(t,e,n){return typeof e!="string"&&(n=e,e=void 0),function(o){const r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(Te),autolinkProtocol:L,autolinkEmail:L,atxHeading:l(ae),blockQuote:l(de),characterEscape:L,characterReference:L,codeFenced:l(me),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:l(me,c),codeText:l(ie,c),codeTextData:L,data:L,codeFlowValue:L,definition:l(Ce),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:l(we),hardBreakEscape:l(ve),hardBreakTrailing:l(ve),htmlFlow:l(ge,c),htmlFlowData:L,htmlText:l(ge,c),htmlTextData:L,image:l(be),label:c,link:l(Te),listItem:l(Xe),listItemValue:g,listOrdered:l(ze,_),listUnordered:l(ze),paragraph:l(Fe),reference:re,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:l(ae),strong:l(et),thematicBreak:l(it)},exit:{atxHeading:u(),atxHeadingSequence:j,autolink:u(),autolinkEmail:he,autolinkProtocol:ce,blockQuote:u(),characterEscapeValue:B,characterReferenceMarkerHexadecimal:oe,characterReferenceMarkerNumeric:oe,characterReferenceValue:Y,characterReference:Q,codeFenced:u(y),codeFencedFence:x,codeFencedFenceInfo:m,codeFencedFenceMeta:b,codeFlowValue:B,codeIndented:u(v),codeText:u(P),codeTextData:B,data:B,definition:u(),definitionDestinationString:E,definitionLabelString:k,definitionTitleString:S,emphasis:u(),hardBreakEscape:u(z),hardBreakTrailing:u(z),htmlFlow:u(F),htmlFlowData:B,htmlText:u(V),htmlTextData:B,image:u($),label:H,labelText:N,lineEnding:O,link:u(C),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:ne,resourceDestinationString:G,resourceTitleString:Z,resource:q,setextHeading:u(M),setextHeadingLineSequence:T,setextHeadingText:I,strong:u(),thematicBreak:u()}};$k(r,(o||{}).mdastExtensions||[]);const s={};return i;function i(te){let Ne={type:"root",children:[]};const Me={stack:[Ne],tokenStack:[],config:r,enter:d,exit:f,buffer:c,resume:p,data:s},Be=[];let J=-1;for(;++J<te.length;)(te[J][1].type==="listOrdered"||te[J][1].type==="listUnordered")&&(te[J][0]==="enter"?Be.push(J):J=a(te,Be.pop(),J));for(J=-1;++J<te.length;){const pe=r[te[J][0]];Vk.call(pe,te[J][1].type)&&pe[te[J][1].type].call(Object.assign({sliceSerialize:te[J][2].sliceSerialize},Me),te[J][1])}if(Me.tokenStack.length>0){const pe=Me.tokenStack[Me.tokenStack.length-1];(pe[1]||Hk).call(Me,void 0,pe[0])}for(Ne.position={start:sr(te.length>0?te[0][1].start:{line:1,column:1,offset:0}),end:sr(te.length>0?te[te.length-2][1].end:{line:1,column:1,offset:0})},J=-1;++J<r.transforms.length;)Ne=r.transforms[J](Ne)||Ne;return Ne}function a(te,Ne,Me){let Be,J,pe,_e,ue=Ne-1,je=-1,ke=!1;for(;++ue<=Me;){const Ve=te[ue];switch(Ve[1].type){case"listUnordered":case"listOrdered":case"blockQuote":Ve[0]==="enter"?je++:je--,_e=void 0;break;case"lineEndingBlank":Ve[0]==="enter"&&(!Be||_e||je||pe||(pe=ue),_e=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:_e=void 0}if(!je&&Ve[0]==="enter"&&Ve[1].type==="listItemPrefix"||je===-1&&Ve[0]==="exit"&&(Ve[1].type==="listUnordered"||Ve[1].type==="listOrdered")){if(Be){let Ze=ue;for(J=void 0;Ze--;){const le=te[Ze];if(le[1].type==="lineEnding"||le[1].type==="lineEndingBlank"){if(le[0]==="exit")continue;J&&(te[J][1].type="lineEndingBlank",ke=!0),le[1].type="lineEnding",J=Ze}else if(le[1].type!=="linePrefix"&&le[1].type!=="blockQuotePrefix"&&le[1].type!=="blockQuotePrefixWhitespace"&&le[1].type!=="blockQuoteMarker"&&le[1].type!=="listItemIndent")break}pe&&(!J||pe<J)&&(Be._spread=!0),Be.end=Object.assign({},J?te[J][1].start:Ve[1].end),te.splice(J||ue,0,["exit",Be,Ve[2]]),ue++,Me++}if(Ve[1].type==="listItemPrefix"){const Ze={type:"listItem",_spread:!1,start:Object.assign({},Ve[1].start),end:void 0};Be=Ze,te.splice(ue,0,["enter",Ze,Ve[2]]),ue++,Me++,pe=void 0,_e=!0}}}return te[Ne][1]._spread=ke,Me}function l(te,Ne){return Me;function Me(Be){d.call(this,te(Be),Be),Ne&&Ne.call(this,Be)}}function c(){this.stack.push({type:"fragment",children:[]})}function d(te,Ne,Me){this.stack[this.stack.length-1].children.push(te),this.stack.push(te),this.tokenStack.push([Ne,Me||void 0]),te.position={start:sr(Ne.start),end:void 0}}function u(te){return Ne;function Ne(Me){te&&te.call(this,Me),f.call(this,Me)}}function f(te,Ne){const Me=this.stack.pop(),Be=this.tokenStack.pop();if(!Be)throw new Error("Cannot close `"+te.type+"` ("+Wi({start:te.start,end:te.end})+"): it\u2019s not open");Be[0].type!==te.type&&(Ne?Ne.call(this,te,Be[0]):(Be[1]||Hk).call(this,te,Be[0])),Me.position.end=sr(te.end)}function p(){return function(te){return xk(te,typeof Wl.includeImageAlt!="boolean"||Wl.includeImageAlt,typeof Wl.includeHtml!="boolean"||Wl.includeHtml)}(this.stack.pop())}function _(){this.data.expectingFirstListItemValue=!0}function g(te){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(te),10),this.data.expectingFirstListItemValue=void 0)}function m(){const te=this.resume();this.stack[this.stack.length-1].lang=te}function b(){const te=this.resume();this.stack[this.stack.length-1].meta=te}function x(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){const te=this.resume();this.stack[this.stack.length-1].value=te.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const te=this.resume();this.stack[this.stack.length-1].value=te.replace(/(\r?\n|\r)$/g,"")}function k(te){const Ne=this.resume(),Me=this.stack[this.stack.length-1];Me.label=Ne,Me.identifier=ys(this.sliceSerialize(te)).toLowerCase()}function S(){const te=this.resume();this.stack[this.stack.length-1].title=te}function E(){const te=this.resume();this.stack[this.stack.length-1].url=te}function j(te){const Ne=this.stack[this.stack.length-1];if(!Ne.depth){const Me=this.sliceSerialize(te).length;Ne.depth=Me}}function I(){this.data.setextHeadingSlurpLineEnding=!0}function T(te){this.stack[this.stack.length-1].depth=this.sliceSerialize(te).codePointAt(0)===61?1:2}function M(){this.data.setextHeadingSlurpLineEnding=void 0}function L(te){const Ne=this.stack[this.stack.length-1].children;let Me=Ne[Ne.length-1];Me&&Me.type==="text"||(Me=nt(),Me.position={start:sr(te.start),end:void 0},Ne.push(Me)),this.stack.push(Me)}function B(te){const Ne=this.stack.pop();Ne.value+=this.sliceSerialize(te),Ne.position.end=sr(te.end)}function O(te){const Ne=this.stack[this.stack.length-1];if(this.data.atHardBreak)return Ne.children[Ne.children.length-1].position.end=sr(te.end),void(this.data.atHardBreak=void 0);!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(Ne.type)&&(L.call(this,te),B.call(this,te))}function z(){this.data.atHardBreak=!0}function F(){const te=this.resume();this.stack[this.stack.length-1].value=te}function V(){const te=this.resume();this.stack[this.stack.length-1].value=te}function P(){const te=this.resume();this.stack[this.stack.length-1].value=te}function C(){const te=this.stack[this.stack.length-1];if(this.data.inReference){const Ne=this.data.referenceType||"shortcut";te.type+="Reference",te.referenceType=Ne,delete te.url,delete te.title}else delete te.identifier,delete te.label;this.data.referenceType=void 0}function $(){const te=this.stack[this.stack.length-1];if(this.data.inReference){const Ne=this.data.referenceType||"shortcut";te.type+="Reference",te.referenceType=Ne,delete te.url,delete te.title}else delete te.identifier,delete te.label;this.data.referenceType=void 0}function N(te){const Ne=this.sliceSerialize(te),Me=this.stack[this.stack.length-2];Me.label=function(Be){return Be.replace(cL,dL)}(Ne),Me.identifier=ys(Ne).toLowerCase()}function H(){const te=this.stack[this.stack.length-1],Ne=this.resume(),Me=this.stack[this.stack.length-1];if(this.data.inReference=!0,Me.type==="link"){const Be=te.children;Me.children=Be}else Me.alt=Ne}function G(){const te=this.resume();this.stack[this.stack.length-1].url=te}function Z(){const te=this.resume();this.stack[this.stack.length-1].title=te}function q(){this.data.inReference=void 0}function re(){this.data.referenceType="collapsed"}function ne(te){const Ne=this.resume(),Me=this.stack[this.stack.length-1];Me.label=Ne,Me.identifier=ys(this.sliceSerialize(te)).toLowerCase(),this.data.referenceType="full"}function oe(te){this.data.characterReferenceType=te.type}function Y(te){const Ne=this.sliceSerialize(te),Me=this.data.characterReferenceType;let Be;Me?(Be=Sk(Ne,Me==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Be=Sf(Ne),this.stack[this.stack.length-1].value+=Be}function Q(te){this.stack.pop().position.end=sr(te.end)}function ce(te){B.call(this,te),this.stack[this.stack.length-1].url=this.sliceSerialize(te)}function he(te){B.call(this,te),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(te)}function de(){return{type:"blockquote",children:[]}}function me(){return{type:"code",lang:null,meta:null,value:""}}function ie(){return{type:"inlineCode",value:""}}function Ce(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function we(){return{type:"emphasis",children:[]}}function ae(){return{type:"heading",depth:0,children:[]}}function ve(){return{type:"break"}}function ge(){return{type:"html",value:""}}function be(){return{type:"image",title:null,url:"",alt:null}}function Te(){return{type:"link",title:null,url:"",children:[]}}function ze(te){return{type:"list",ordered:te.type==="listOrdered",start:null,spread:te._spread,children:[]}}function Xe(te){return{type:"listItem",spread:te._spread,checked:null,children:[]}}function Fe(){return{type:"paragraph",children:[]}}function et(){return{type:"strong",children:[]}}function nt(){return{type:"text",value:""}}function it(){return{type:"thematicBreak"}}}(n)(function(o){for(;!Ok(o););return o}(lL(n).document().write(function(){let o,r=1,s="",i=!0;return function(a,l,c){const d=[];let u,f,p,_,g;for(a=s+(typeof a=="string"?a.toString():new TextDecoder(l||void 0).decode(a)),p=0,s="",i&&(a.charCodeAt(0)===65279&&p++,i=void 0);p<a.length;){if(Uk.lastIndex=p,u=Uk.exec(a),_=u&&u.index!==void 0?u.index:a.length,g=a.charCodeAt(_),!u){s=a.slice(p);break}if(g===10&&p===_&&o)d.push(-3),o=void 0;else switch(o&&(d.push(-5),o=void 0),p<_&&(d.push(a.slice(p,_)),r+=_-p),g){case 0:d.push(65533),r++;break;case 9:for(f=4*Math.ceil(r/4),d.push(-2);r++<f;)d.push(-1);break;case 10:d.push(-4),r=1;break;default:o=!0,r=1}p=_+1}return c&&(o&&d.push(-5),s&&d.push(s),d.push(null)),d}}()(t,e,!0))))}function sr(t){return{line:t.line,column:t.column,offset:t.offset}}function $k(t,e){let n=-1;for(;++n<e.length;){const o=e[n];Array.isArray(o)?$k(t,o):hL(t,o)}}function hL(t,e){let n;for(n in e)if(Vk.call(e,n))switch(n){case"canContainEols":{const o=e[n];o&&t[n].push(...o);break}case"transforms":{const o=e[n];o&&t[n].push(...o);break}case"enter":case"exit":{const o=e[n];o&&Object.assign(t[n],o);break}}}function Hk(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+Wi({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+Wi({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+Wi({start:e.start,end:e.end})+") is still open")}function fL(t){const e=this;e.parser=function(n){return uL(n,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function Wk(t,e){const n=e.referenceType;let o="]";if(n==="collapsed"?o+="[]":n==="full"&&(o+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+o}];const r=t.all(e),s=r[0];s&&s.type==="text"?s.value="["+s.value:r.unshift({type:"text",value:"["});const i=r[r.length-1];return i&&i.type==="text"?i.value+=o:r.push({type:"text",value:o}),r}function qk(t){const e=t.spread;return e??t.children.length>1}function pL(t){const e=String(t),n=/\r?\n|\r/g;let o=n.exec(e),r=0;const s=[];for(;o;)s.push(Gk(e.slice(r,o.index),r>0,!0),o[0]),r=o.index+o[0].length,o=n.exec(e);return s.push(Gk(e.slice(r),r>0,!1)),s.join("")}function Gk(t,e,n){let o=0,r=t.length;if(e){let s=t.codePointAt(o);for(;s===9||s===32;)o++,s=t.codePointAt(o)}if(n){let s=t.codePointAt(r-1);for(;s===9||s===32;)r--,s=t.codePointAt(r-1)}return r>o?t.slice(o,r):""}const mL={blockquote:function(t,e){const n={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,n),t.applyData(e,n)},break:function(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
130
130
  `}]},code:function(t,e){const n=e.value?e.value+`
131
131
  `:"",o={};e.lang&&(o.className=["language-"+e.lang]);let r={type:"element",tagName:"code",properties:o,children:[{type:"text",value:n}]};return e.meta&&(r.data={meta:e.meta}),t.patch(e,r),r=t.applyData(e,r),r={type:"element",tagName:"pre",properties:{},children:[r]},t.patch(e,r),r},delete:function(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},emphasis:function(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},footnoteReference:function(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",o=String(e.identifier).toUpperCase(),r=xs(o.toLowerCase()),s=t.footnoteOrder.indexOf(o);let i,a=t.footnoteCounts.get(o);a===void 0?(a=0,t.footnoteOrder.push(o),i=t.footnoteOrder.length):i=s+1,a+=1,t.footnoteCounts.set(o,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+r,id:n+"fnref-"+r+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(i)}]};t.patch(e,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return t.patch(e,c),t.applyData(e,c)},heading:function(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},html:function(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}},imageReference:function(t,e){const n=String(e.identifier).toUpperCase(),o=t.definitionById.get(n);if(!o)return Wk(t,e);const r={src:xs(o.url||""),alt:e.alt};o.title!==null&&o.title!==void 0&&(r.title=o.title);const s={type:"element",tagName:"img",properties:r,children:[]};return t.patch(e,s),t.applyData(e,s)},image:function(t,e){const n={src:xs(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const o={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,o),t.applyData(e,o)},inlineCode:function(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const o={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,o),t.applyData(e,o)},linkReference:function(t,e){const n=String(e.identifier).toUpperCase(),o=t.definitionById.get(n);if(!o)return Wk(t,e);const r={href:xs(o.url||"")};o.title!==null&&o.title!==void 0&&(r.title=o.title);const s={type:"element",tagName:"a",properties:r,children:t.all(e)};return t.patch(e,s),t.applyData(e,s)},link:function(t,e){const n={href:xs(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const o={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,o),t.applyData(e,o)},listItem:function(t,e,n){const o=t.all(e),r=n?function(d){let u=!1;if(d.type==="list"){u=d.spread||!1;const f=d.children;let p=-1;for(;!u&&++p<f.length;)u=qk(f[p])}return u}(n):qk(e),s={},i=[];if(typeof e.checked=="boolean"){const d=o[0];let u;d&&d.type==="element"&&d.tagName==="p"?u=d:(u={type:"element",tagName:"p",properties:{},children:[]},o.unshift(u)),u.children.length>0&&u.children.unshift({type:"text",value:" "}),u.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let a=-1;for(;++a<o.length;){const d=o[a];(r||a!==0||d.type!=="element"||d.tagName!=="p")&&i.push({type:"text",value:`
132
132
  `}),d.type!=="element"||d.tagName!=="p"||r?i.push(d):i.push(...d.children)}const l=o[o.length-1];l&&(r||l.type!=="element"||l.tagName!=="p")&&i.push({type:"text",value:`
133
- `});const c={type:"element",tagName:"li",properties:s,children:i};return t.patch(e,c),t.applyData(e,c)},list:function(t,e){const n={},o=t.all(e);let r=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++r<o.length;){const i=o[r];if(i.type==="element"&&i.tagName==="li"&&i.properties&&Array.isArray(i.properties.className)&&i.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:e.ordered?"ol":"ul",properties:n,children:t.wrap(o,!0)};return t.patch(e,s),t.applyData(e,s)},paragraph:function(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},root:function(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)},strong:function(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},table:function(t,e){const n=t.all(e),o=n.shift(),r=[];if(o){const i={type:"element",tagName:"thead",properties:{},children:t.wrap([o],!0)};t.patch(e.children[0],i),r.push(i)}if(n.length>0){const i={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},a=_f(e.children[1]),l=hk(e.children[e.children.length-1]);a&&l&&(i.position={start:a,end:l}),r.push(i)}const s={type:"element",tagName:"table",properties:{},children:t.wrap(r,!0)};return t.patch(e,s),t.applyData(e,s)},tableCell:function(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},tableRow:function(t,e,n){const o=n?n.children:void 0,r=(o?o.indexOf(e):1)===0?"th":"td",s=n&&n.type==="table"?n.align:void 0,i=s?s.length:e.children.length;let a=-1;const l=[];for(;++a<i;){const d=e.children[a],u={},f=s?s[a]:void 0;f&&(u.align=f);let p={type:"element",tagName:r,properties:u,children:[]};d&&(p.children=t.all(d),t.patch(d,p),p=t.applyData(d,p)),l.push(p)}const c={type:"element",tagName:"tr",properties:{},children:t.wrap(l,!0)};return t.patch(e,c),t.applyData(e,c)},text:function(t,e){const n={type:"text",value:pL(String(e.value))};return t.patch(e,n),t.applyData(e,n)},thematicBreak:function(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)},toml:Yl,yaml:Yl,definition:Yl,footnoteDefinition:Yl};function Yl(){}const Yk=typeof self=="object"?self:globalThis,Jk=t=>((e,n)=>{const o=(s,i)=>(e.set(i,s),s),r=s=>{if(e.has(s))return e.get(s);const[i,a]=n[s];switch(i){case 0:case-1:return o(a,s);case 1:{const l=o([],s);for(const c of a)l.push(r(c));return l}case 2:{const l=o({},s);for(const[c,d]of a)l[r(c)]=r(d);return l}case 3:return o(new Date(a),s);case 4:{const{source:l,flags:c}=a;return o(new RegExp(l,c),s)}case 5:{const l=o(new Map,s);for(const[c,d]of a)l.set(r(c),r(d));return l}case 6:{const l=o(new Set,s);for(const c of a)l.add(r(c));return l}case 7:{const{name:l,message:c}=a;return o(new Yk[l](c),s)}case 8:return o(BigInt(a),s);case"BigInt":return o(Object(BigInt(a)),s)}return o(new Yk[i](a),s)};return r})(new Map,t)(0),ws="",{toString:gL}={},{keys:_L}=Object,Ji=t=>{const e=typeof t;if(e!=="object"||!t)return[0,e];const n=gL.call(t).slice(8,-1);switch(n){case"Array":return[1,ws];case"Object":return[2,ws];case"Date":return[3,ws];case"RegExp":return[4,ws];case"Map":return[5,ws];case"Set":return[6,ws]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},Jl=([t,e])=>t===0&&(e==="function"||e==="symbol"),Kk=(t,{json:e,lossy:n}={})=>{const o=[];return((r,s,i,a)=>{const l=(d,u)=>{const f=a.push(d)-1;return i.set(u,f),f},c=d=>{if(i.has(d))return i.get(d);let[u,f]=Ji(d);switch(u){case 0:{let _=d;switch(f){case"bigint":u=8,_=d.toString();break;case"function":case"symbol":if(r)throw new TypeError("unable to serialize "+f);_=null;break;case"undefined":return l([-1],d)}return l([u,_],d)}case 1:{if(f)return l([f,[...d]],d);const _=[],g=l([u,_],d);for(const m of d)_.push(c(m));return g}case 2:{if(f)switch(f){case"BigInt":return l([f,d.toString()],d);case"Boolean":case"Number":case"String":return l([f,d.valueOf()],d)}if(s&&"toJSON"in d)return c(d.toJSON());const _=[],g=l([u,_],d);for(const m of _L(d))!r&&Jl(Ji(d[m]))||_.push([c(m),c(d[m])]);return g}case 3:return l([u,d.toISOString()],d);case 4:{const{source:_,flags:g}=d;return l([u,{source:_,flags:g}],d)}case 5:{const _=[],g=l([u,_],d);for(const[m,b]of d)(r||!Jl(Ji(m))&&!Jl(Ji(b)))&&_.push([c(m),c(b)]);return g}case 6:{const _=[],g=l([u,_],d);for(const m of d)!r&&Jl(Ji(m))||_.push(c(m));return g}}const{message:p}=d;return l([u,{name:f,message:p}],d)};return c})(!(e||n),!!e,new Map,o)(t),o},Kl=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?Jk(Kk(t,e)):structuredClone(t):(t,e)=>Jk(Kk(t,e));function bL(t,e){const n=[{type:"text",value:"\u21A9"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function yL(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}const Xk=function(t){if(t==null)return xL;if(typeof t=="function")return Xl(t);if(typeof t=="object")return Array.isArray(t)?function(e){const n=[];let o=-1;for(;++o<e.length;)n[o]=Xk(e[o]);return Xl(r);function r(...s){let i=-1;for(;++i<n.length;)if(n[i].apply(this,s))return!0;return!1}}(t):function(e){const n=e;return Xl(o);function o(r){const s=r;let i;for(i in e)if(s[i]!==n[i])return!1;return!0}}(t);if(typeof t=="string")return function(e){return Xl(n);function n(o){return o&&o.type===e}}(t);throw new Error("Expected function, string, or object as test")};function Xl(t){return function(e,n,o){return!!(function(r){return r!==null&&typeof r=="object"&&"type"in r}(e)&&t.call(this,e,typeof n=="number"?n:void 0,o||void 0))}}function xL(){return!0}const Zk=[],wL=!0,Qk=!1;function vL(t,e,n,o){let r;typeof e=="function"&&typeof n!="function"?(o=n,n=e):r=e;const s=Xk(r),i=o?-1:1;(function a(l,c,d){const u=l&&typeof l=="object"?l:{};if(typeof u.type=="string"){const p=typeof u.tagName=="string"?u.tagName:typeof u.name=="string"?u.name:void 0;Object.defineProperty(f,"name",{value:"node ("+l.type+(p?"<"+p+">":"")+")"})}return f;function f(){let p,_,g,m=Zk;if((!e||s(l,c,d[d.length-1]||void 0))&&(m=function(b){return Array.isArray(b)?b:typeof b=="number"?[wL,b]:b==null?Zk:[b]}(n(l,d)),m[0]===Qk))return m;if("children"in l&&l.children){const b=l;if(b.children&&m[0]!=="skip")for(_=(o?b.children.length:-1)+i,g=d.concat(b);_>-1&&_<b.children.length;){const x=b.children[_];if(p=a(x,_,g)(),p[0]===Qk)return p;_=typeof p[1]=="number"?p[1]:_+i}}return m}})(t,void 0,[])()}function e3(t,e,n,o){let r,s,i;typeof e=="function"?(s=void 0,i=e,r=n):(s=e,i=n,r=o),vL(t,s,function(a,l){const c=l[l.length-1],d=c?c.children.indexOf(a):void 0;return i(a,d,c)},r)}const Tf={}.hasOwnProperty,kL={};function SL(t,e){t.position&&(e.position=function(n){const o=_f(n),r=hk(n);if(o&&r)return{start:o,end:r}}(t))}function CL(t,e){let n=e;if(t&&t.data){const o=t.data.hName,r=t.data.hChildren,s=t.data.hProperties;typeof o=="string"&&(n.type==="element"?n.tagName=o:n={type:"element",tagName:o,properties:{},children:"children"in n?n.children:[n]}),n.type==="element"&&s&&Object.assign(n.properties,Kl(s)),"children"in n&&n.children&&r!=null&&(n.children=r)}return n}function NL(t,e){const n=e.data||{},o=!("value"in e)||Tf.call(n,"hProperties")||Tf.call(n,"hChildren")?{type:"element",tagName:"div",properties:{},children:t.all(e)}:{type:"text",value:e.value};return t.patch(e,o),t.applyData(e,o)}function jL(t,e){const n=[];let o=-1;for(e&&n.push({type:"text",value:`
133
+ `});const c={type:"element",tagName:"li",properties:s,children:i};return t.patch(e,c),t.applyData(e,c)},list:function(t,e){const n={},o=t.all(e);let r=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++r<o.length;){const i=o[r];if(i.type==="element"&&i.tagName==="li"&&i.properties&&Array.isArray(i.properties.className)&&i.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:e.ordered?"ol":"ul",properties:n,children:t.wrap(o,!0)};return t.patch(e,s),t.applyData(e,s)},paragraph:function(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},root:function(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)},strong:function(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},table:function(t,e){const n=t.all(e),o=n.shift(),r=[];if(o){const i={type:"element",tagName:"thead",properties:{},children:t.wrap([o],!0)};t.patch(e.children[0],i),r.push(i)}if(n.length>0){const i={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},a=bf(e.children[1]),l=hk(e.children[e.children.length-1]);a&&l&&(i.position={start:a,end:l}),r.push(i)}const s={type:"element",tagName:"table",properties:{},children:t.wrap(r,!0)};return t.patch(e,s),t.applyData(e,s)},tableCell:function(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},tableRow:function(t,e,n){const o=n?n.children:void 0,r=(o?o.indexOf(e):1)===0?"th":"td",s=n&&n.type==="table"?n.align:void 0,i=s?s.length:e.children.length;let a=-1;const l=[];for(;++a<i;){const d=e.children[a],u={},f=s?s[a]:void 0;f&&(u.align=f);let p={type:"element",tagName:r,properties:u,children:[]};d&&(p.children=t.all(d),t.patch(d,p),p=t.applyData(d,p)),l.push(p)}const c={type:"element",tagName:"tr",properties:{},children:t.wrap(l,!0)};return t.patch(e,c),t.applyData(e,c)},text:function(t,e){const n={type:"text",value:pL(String(e.value))};return t.patch(e,n),t.applyData(e,n)},thematicBreak:function(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)},toml:Yl,yaml:Yl,definition:Yl,footnoteDefinition:Yl};function Yl(){}const Yk=typeof self=="object"?self:globalThis,Jk=t=>((e,n)=>{const o=(s,i)=>(e.set(i,s),s),r=s=>{if(e.has(s))return e.get(s);const[i,a]=n[s];switch(i){case 0:case-1:return o(a,s);case 1:{const l=o([],s);for(const c of a)l.push(r(c));return l}case 2:{const l=o({},s);for(const[c,d]of a)l[r(c)]=r(d);return l}case 3:return o(new Date(a),s);case 4:{const{source:l,flags:c}=a;return o(new RegExp(l,c),s)}case 5:{const l=o(new Map,s);for(const[c,d]of a)l.set(r(c),r(d));return l}case 6:{const l=o(new Set,s);for(const c of a)l.add(r(c));return l}case 7:{const{name:l,message:c}=a;return o(new Yk[l](c),s)}case 8:return o(BigInt(a),s);case"BigInt":return o(Object(BigInt(a)),s)}return o(new Yk[i](a),s)};return r})(new Map,t)(0),ws="",{toString:gL}={},{keys:_L}=Object,Ji=t=>{const e=typeof t;if(e!=="object"||!t)return[0,e];const n=gL.call(t).slice(8,-1);switch(n){case"Array":return[1,ws];case"Object":return[2,ws];case"Date":return[3,ws];case"RegExp":return[4,ws];case"Map":return[5,ws];case"Set":return[6,ws]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},Jl=([t,e])=>t===0&&(e==="function"||e==="symbol"),Kk=(t,{json:e,lossy:n}={})=>{const o=[];return((r,s,i,a)=>{const l=(d,u)=>{const f=a.push(d)-1;return i.set(u,f),f},c=d=>{if(i.has(d))return i.get(d);let[u,f]=Ji(d);switch(u){case 0:{let _=d;switch(f){case"bigint":u=8,_=d.toString();break;case"function":case"symbol":if(r)throw new TypeError("unable to serialize "+f);_=null;break;case"undefined":return l([-1],d)}return l([u,_],d)}case 1:{if(f)return l([f,[...d]],d);const _=[],g=l([u,_],d);for(const m of d)_.push(c(m));return g}case 2:{if(f)switch(f){case"BigInt":return l([f,d.toString()],d);case"Boolean":case"Number":case"String":return l([f,d.valueOf()],d)}if(s&&"toJSON"in d)return c(d.toJSON());const _=[],g=l([u,_],d);for(const m of _L(d))!r&&Jl(Ji(d[m]))||_.push([c(m),c(d[m])]);return g}case 3:return l([u,d.toISOString()],d);case 4:{const{source:_,flags:g}=d;return l([u,{source:_,flags:g}],d)}case 5:{const _=[],g=l([u,_],d);for(const[m,b]of d)(r||!Jl(Ji(m))&&!Jl(Ji(b)))&&_.push([c(m),c(b)]);return g}case 6:{const _=[],g=l([u,_],d);for(const m of d)!r&&Jl(Ji(m))||_.push(c(m));return g}}const{message:p}=d;return l([u,{name:f,message:p}],d)};return c})(!(e||n),!!e,new Map,o)(t),o},Kl=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?Jk(Kk(t,e)):structuredClone(t):(t,e)=>Jk(Kk(t,e));function bL(t,e){const n=[{type:"text",value:"\u21A9"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function yL(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}const Xk=function(t){if(t==null)return xL;if(typeof t=="function")return Xl(t);if(typeof t=="object")return Array.isArray(t)?function(e){const n=[];let o=-1;for(;++o<e.length;)n[o]=Xk(e[o]);return Xl(r);function r(...s){let i=-1;for(;++i<n.length;)if(n[i].apply(this,s))return!0;return!1}}(t):function(e){const n=e;return Xl(o);function o(r){const s=r;let i;for(i in e)if(s[i]!==n[i])return!1;return!0}}(t);if(typeof t=="string")return function(e){return Xl(n);function n(o){return o&&o.type===e}}(t);throw new Error("Expected function, string, or object as test")};function Xl(t){return function(e,n,o){return!!(function(r){return r!==null&&typeof r=="object"&&"type"in r}(e)&&t.call(this,e,typeof n=="number"?n:void 0,o||void 0))}}function xL(){return!0}const Zk=[],wL=!0,Qk=!1;function vL(t,e,n,o){let r;typeof e=="function"&&typeof n!="function"?(o=n,n=e):r=e;const s=Xk(r),i=o?-1:1;(function a(l,c,d){const u=l&&typeof l=="object"?l:{};if(typeof u.type=="string"){const p=typeof u.tagName=="string"?u.tagName:typeof u.name=="string"?u.name:void 0;Object.defineProperty(f,"name",{value:"node ("+l.type+(p?"<"+p+">":"")+")"})}return f;function f(){let p,_,g,m=Zk;if((!e||s(l,c,d[d.length-1]||void 0))&&(m=function(b){return Array.isArray(b)?b:typeof b=="number"?[wL,b]:b==null?Zk:[b]}(n(l,d)),m[0]===Qk))return m;if("children"in l&&l.children){const b=l;if(b.children&&m[0]!=="skip")for(_=(o?b.children.length:-1)+i,g=d.concat(b);_>-1&&_<b.children.length;){const x=b.children[_];if(p=a(x,_,g)(),p[0]===Qk)return p;_=typeof p[1]=="number"?p[1]:_+i}}return m}})(t,void 0,[])()}function e3(t,e,n,o){let r,s,i;typeof e=="function"?(s=void 0,i=e,r=n):(s=e,i=n,r=o),vL(t,s,function(a,l){const c=l[l.length-1],d=c?c.children.indexOf(a):void 0;return i(a,d,c)},r)}const Mf={}.hasOwnProperty,kL={};function SL(t,e){t.position&&(e.position=function(n){const o=bf(n),r=hk(n);if(o&&r)return{start:o,end:r}}(t))}function CL(t,e){let n=e;if(t&&t.data){const o=t.data.hName,r=t.data.hChildren,s=t.data.hProperties;typeof o=="string"&&(n.type==="element"?n.tagName=o:n={type:"element",tagName:o,properties:{},children:"children"in n?n.children:[n]}),n.type==="element"&&s&&Object.assign(n.properties,Kl(s)),"children"in n&&n.children&&r!=null&&(n.children=r)}return n}function NL(t,e){const n=e.data||{},o=!("value"in e)||Mf.call(n,"hProperties")||Mf.call(n,"hChildren")?{type:"element",tagName:"div",properties:{},children:t.all(e)}:{type:"text",value:e.value};return t.patch(e,o),t.applyData(e,o)}function jL(t,e){const n=[];let o=-1;for(e&&n.push({type:"text",value:`
134
134
  `});++o<t.length;)o&&n.push({type:"text",value:`
135
135
  `}),n.push(t[o]);return e&&t.length>0&&n.push({type:"text",value:`
136
- `}),n}function t3(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function n3(t,e){const n=function(i,a){const l=a||kL,c=new Map,d=new Map,u=new Map,f={...mL,...l.handlers},p={all:function(_){const g=[];if("children"in _){const m=_.children;let b=-1;for(;++b<m.length;){const x=p.one(m[b],_);if(x){if(b&&m[b-1].type==="break"&&(Array.isArray(x)||x.type!=="text"||(x.value=t3(x.value)),!Array.isArray(x)&&x.type==="element")){const y=x.children[0];y&&y.type==="text"&&(y.value=t3(y.value))}Array.isArray(x)?g.push(...x):g.push(x)}}}return g},applyData:CL,definitionById:c,footnoteById:d,footnoteCounts:u,footnoteOrder:[],handlers:f,one:function(_,g){const m=_.type,b=p.handlers[m];if(Tf.call(p.handlers,m)&&b)return b(p,_,g);if(p.options.passThrough&&p.options.passThrough.includes(m)){if("children"in _){const{children:x,...y}=_,v=Kl(y);return v.children=p.all(_),v}return Kl(_)}return(p.options.unknownHandler||NL)(p,_,g)},options:l,patch:SL,wrap:jL};return e3(i,function(_){if(_.type==="definition"||_.type==="footnoteDefinition"){const g=_.type==="definition"?c:d,m=String(_.identifier).toUpperCase();g.has(m)||g.set(m,_)}}),p}(t,e),o=n.one(t,void 0),r=function(i){const a=typeof i.options.clobberPrefix=="string"?i.options.clobberPrefix:"user-content-",l=i.options.footnoteBackContent||bL,c=i.options.footnoteBackLabel||yL,d=i.options.footnoteLabel||"Footnotes",u=i.options.footnoteLabelTagName||"h2",f=i.options.footnoteLabelProperties||{className:["sr-only"]},p=[];let _=-1;for(;++_<i.footnoteOrder.length;){const g=i.footnoteById.get(i.footnoteOrder[_]);if(!g)continue;const m=i.all(g),b=String(g.identifier).toUpperCase(),x=xs(b.toLowerCase());let y=0;const v=[],k=i.footnoteCounts.get(b);for(;k!==void 0&&++y<=k;){v.length>0&&v.push({type:"text",value:" "});let j=typeof l=="string"?l:l(_,y);typeof j=="string"&&(j={type:"text",value:j}),v.push({type:"element",tagName:"a",properties:{href:"#"+a+"fnref-"+x+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof c=="string"?c:c(_,y),className:["data-footnote-backref"]},children:Array.isArray(j)?j:[j]})}const S=m[m.length-1];if(S&&S.type==="element"&&S.tagName==="p"){const j=S.children[S.children.length-1];j&&j.type==="text"?j.value+=" ":S.children.push({type:"text",value:" "}),S.children.push(...v)}else m.push(...v);const E={type:"element",tagName:"li",properties:{id:a+"fn-"+x},children:i.wrap(m,!0)};i.patch(g,E),p.push(E)}if(p.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...Kl(f),id:"footnote-label"},children:[{type:"text",value:d}]},{type:"text",value:`
136
+ `}),n}function t3(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function n3(t,e){const n=function(i,a){const l=a||kL,c=new Map,d=new Map,u=new Map,f={...mL,...l.handlers},p={all:function(_){const g=[];if("children"in _){const m=_.children;let b=-1;for(;++b<m.length;){const x=p.one(m[b],_);if(x){if(b&&m[b-1].type==="break"&&(Array.isArray(x)||x.type!=="text"||(x.value=t3(x.value)),!Array.isArray(x)&&x.type==="element")){const y=x.children[0];y&&y.type==="text"&&(y.value=t3(y.value))}Array.isArray(x)?g.push(...x):g.push(x)}}}return g},applyData:CL,definitionById:c,footnoteById:d,footnoteCounts:u,footnoteOrder:[],handlers:f,one:function(_,g){const m=_.type,b=p.handlers[m];if(Mf.call(p.handlers,m)&&b)return b(p,_,g);if(p.options.passThrough&&p.options.passThrough.includes(m)){if("children"in _){const{children:x,...y}=_,v=Kl(y);return v.children=p.all(_),v}return Kl(_)}return(p.options.unknownHandler||NL)(p,_,g)},options:l,patch:SL,wrap:jL};return e3(i,function(_){if(_.type==="definition"||_.type==="footnoteDefinition"){const g=_.type==="definition"?c:d,m=String(_.identifier).toUpperCase();g.has(m)||g.set(m,_)}}),p}(t,e),o=n.one(t,void 0),r=function(i){const a=typeof i.options.clobberPrefix=="string"?i.options.clobberPrefix:"user-content-",l=i.options.footnoteBackContent||bL,c=i.options.footnoteBackLabel||yL,d=i.options.footnoteLabel||"Footnotes",u=i.options.footnoteLabelTagName||"h2",f=i.options.footnoteLabelProperties||{className:["sr-only"]},p=[];let _=-1;for(;++_<i.footnoteOrder.length;){const g=i.footnoteById.get(i.footnoteOrder[_]);if(!g)continue;const m=i.all(g),b=String(g.identifier).toUpperCase(),x=xs(b.toLowerCase());let y=0;const v=[],k=i.footnoteCounts.get(b);for(;k!==void 0&&++y<=k;){v.length>0&&v.push({type:"text",value:" "});let j=typeof l=="string"?l:l(_,y);typeof j=="string"&&(j={type:"text",value:j}),v.push({type:"element",tagName:"a",properties:{href:"#"+a+"fnref-"+x+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof c=="string"?c:c(_,y),className:["data-footnote-backref"]},children:Array.isArray(j)?j:[j]})}const S=m[m.length-1];if(S&&S.type==="element"&&S.tagName==="p"){const j=S.children[S.children.length-1];j&&j.type==="text"?j.value+=" ":S.children.push({type:"text",value:" "}),S.children.push(...v)}else m.push(...v);const E={type:"element",tagName:"li",properties:{id:a+"fn-"+x},children:i.wrap(m,!0)};i.patch(g,E),p.push(E)}if(p.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...Kl(f),id:"footnote-label"},children:[{type:"text",value:d}]},{type:"text",value:`
137
137
  `},{type:"element",tagName:"ol",properties:{},children:i.wrap(p,!0)},{type:"text",value:`
138
138
  `}]}}(n),s=Array.isArray(o)?{type:"root",children:o}:o||{type:"root",children:[]};return r&&s.children.push({type:"text",value:`
139
- `},r),s}function EL(t,e){return t&&"run"in t?async function(n,o){const r=n3(n,{file:o,...e});await t.run(r,o)}:function(n,o){return n3(n,{file:o,...t||e})}}function o3(t){if(t)throw t}var Mf,r3,IL=function(){if(r3)return Mf;r3=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,o=Object.getOwnPropertyDescriptor,r=function(l){return typeof Array.isArray=="function"?Array.isArray(l):e.call(l)==="[object Array]"},s=function(l){if(!l||e.call(l)!=="[object Object]")return!1;var c,d=t.call(l,"constructor"),u=l.constructor&&l.constructor.prototype&&t.call(l.constructor.prototype,"isPrototypeOf");if(l.constructor&&!d&&!u)return!1;for(c in l);return c===void 0||t.call(l,c)},i=function(l,c){n&&c.name==="__proto__"?n(l,c.name,{enumerable:!0,configurable:!0,value:c.newValue,writable:!0}):l[c.name]=c.newValue},a=function(l,c){if(c==="__proto__"){if(!t.call(l,c))return;if(o)return o(l,c).value}return l[c]};return Mf=function l(){var c,d,u,f,p,_,g=arguments[0],m=1,b=arguments.length,x=!1;for(typeof g=="boolean"&&(x=g,g=arguments[1]||{},m=2),(g==null||typeof g!="object"&&typeof g!="function")&&(g={});m<b;++m)if((c=arguments[m])!=null)for(d in c)u=a(g,d),g!==(f=a(c,d))&&(x&&f&&(s(f)||(p=r(f)))?(p?(p=!1,_=u&&r(u)?u:[]):_=u&&s(u)?u:{},i(g,{name:d,newValue:l(x,_,f)})):f!==void 0&&i(g,{name:d,newValue:f}));return g},Mf}();const Of=rS(IL);function Df(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return!(e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null||Symbol.toStringTag in t||Symbol.iterator in t)}function AL(){const t=[],e={run:function(...n){let o=-1;const r=n.pop();if(typeof r!="function")throw new TypeError("Expected function as last argument, not "+r);(function s(i,...a){const l=t[++o];let c=-1;if(i)r(i);else{for(;++c<n.length;)a[c]!==null&&a[c]!==void 0||(a[c]=n[c]);n=a,l?function(d,u){let f;return p;function p(...m){const b=d.length>m.length;let x;b&&m.push(_);try{x=d.apply(this,m)}catch(y){if(b&&f)throw y;return _(y)}b||(x&&x.then&&typeof x.then=="function"?x.then(g,_):x instanceof Error?_(x):g(x))}function _(m,...b){f||(f=!0,u(m,...b))}function g(m){_(null,m)}}(l,s)(...a):r(null,...a)}})(null,...n)},use:function(n){if(typeof n!="function")throw new TypeError("Expected `middelware` to be a function, not "+n);return t.push(n),e}};return e}const uo={basename:function(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Ki(t);let n,o=0,r=-1,s=t.length;if(e===void 0||e.length===0||e.length>t.length){for(;s--;)if(t.codePointAt(s)===47){if(n){o=s+1;break}}else r<0&&(n=!0,r=s+1);return r<0?"":t.slice(o,r)}if(e===t)return"";let i=-1,a=e.length-1;for(;s--;)if(t.codePointAt(s)===47){if(n){o=s+1;break}}else i<0&&(n=!0,i=s+1),a>-1&&(t.codePointAt(s)===e.codePointAt(a--)?a<0&&(r=s):(a=-1,r=i));return o===r?r=i:r<0&&(r=t.length),t.slice(o,r)},dirname:function(t){if(Ki(t),t.length===0)return".";let e,n=-1,o=t.length;for(;--o;)if(t.codePointAt(o)===47){if(e){n=o;break}}else e||(e=!0);return n<0?t.codePointAt(0)===47?"/":".":n===1&&t.codePointAt(0)===47?"//":t.slice(0,n)},extname:function(t){Ki(t);let e,n=t.length,o=-1,r=0,s=-1,i=0;for(;n--;){const a=t.codePointAt(n);if(a!==47)o<0&&(e=!0,o=n+1),a===46?s<0?s=n:i!==1&&(i=1):s>-1&&(i=-1);else if(e){r=n+1;break}}return s<0||o<0||i===0||i===1&&s===o-1&&s===r+1?"":t.slice(s,o)},join:function(...t){let e,n=-1;for(;++n<t.length;)Ki(t[n]),t[n]&&(e=e===void 0?t[n]:e+"/"+t[n]);return e===void 0?".":function(o){Ki(o);const r=o.codePointAt(0)===47;let s=function(i,a){let l,c,d="",u=0,f=-1,p=0,_=-1;for(;++_<=i.length;){if(_<i.length)l=i.codePointAt(_);else{if(l===47)break;l=47}if(l===47){if(!(f===_-1||p===1))if(f!==_-1&&p===2){if(d.length<2||u!==2||d.codePointAt(d.length-1)!==46||d.codePointAt(d.length-2)!==46){if(d.length>2){if(c=d.lastIndexOf("/"),c!==d.length-1){c<0?(d="",u=0):(d=d.slice(0,c),u=d.length-1-d.lastIndexOf("/")),f=_,p=0;continue}}else if(d.length>0){d="",u=0,f=_,p=0;continue}}a&&(d=d.length>0?d+"/..":"..",u=2)}else d.length>0?d+="/"+i.slice(f+1,_):d=i.slice(f+1,_),u=_-f-1;f=_,p=0}else l===46&&p>-1?p++:p=-1}return d}(o,!r);return s.length!==0||r||(s="."),s.length>0&&o.codePointAt(o.length-1)===47&&(s+="/"),r?"/"+s:s}(e)},sep:"/"};function Ki(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const TL={cwd:function(){return"/"}};function Rf(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function ML(t){if(typeof t=="string")t=new URL(t);else if(!Rf(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const n=e.pathname;let o=-1;for(;++o<n.length;)if(n.codePointAt(o)===37&&n.codePointAt(o+1)===50){const r=n.codePointAt(o+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(n)}(t)}const Pf=["history","path","basename","stem","extname","dirname"];class s3{constructor(e){let n;n=e?Rf(e)?{path:e}:typeof e=="string"||function(s){return!!(s&&typeof s=="object"&&"byteLength"in s&&"byteOffset"in s)}(e)?{value:e}:e:{},this.cwd="cwd"in n?"":TL.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let o,r=-1;for(;++r<Pf.length;){const s=Pf[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}for(o in n)Pf.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?uo.basename(this.path):void 0}set basename(e){Ff(e,"basename"),Lf(e,"basename"),this.path=uo.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?uo.dirname(this.path):void 0}set dirname(e){i3(this.basename,"dirname"),this.path=uo.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?uo.extname(this.path):void 0}set extname(e){if(Lf(e,"extname"),i3(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=uo.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Rf(e)&&(e=ML(e)),Ff(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?uo.basename(this.path,this.extname):void 0}set stem(e){Ff(e,"stem"),Lf(e,"stem"),this.path=uo.join(this.dirname||"",e+(this.extname||""))}fail(e,n,o){const r=this.message(e,n,o);throw r.fatal=!0,r}info(e,n,o){const r=this.message(e,n,o);return r.fatal=void 0,r}message(e,n,o){const r=new on(e,n,o);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function Lf(t,e){if(t&&t.includes(uo.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+uo.sep+"`")}function Ff(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function i3(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}const OL=function(t){const e=this.constructor.prototype,n=e[t],o=function(){return n.apply(o,arguments)};return Object.setPrototypeOf(o,e),o},DL={}.hasOwnProperty;class zf extends OL{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=AL()}copy(){const e=new zf;let n=-1;for(;++n<this.attachers.length;){const o=this.attachers[n];e.use(...o)}return e.data(Of(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(Vf("data",this.frozen),this.namespace[e]=n,this):DL.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Vf("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...o]=this.attachers[this.freezeIndex];if(o[0]===!1)continue;o[0]===!0&&(o[0]=void 0);const r=n.call(e,...o);typeof r=="function"&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=Zl(e),o=this.parser||this.Parser;return Bf("parse",o),o(String(n),n)}process(e,n){const o=this;return this.freeze(),Bf("process",this.parser||this.Parser),Uf("process",this.compiler||this.Compiler),n?r(void 0,n):new Promise(r);function r(s,i){const a=Zl(e),l=o.parse(a);function c(d,u){d||!u?i(d):s?s(u):n(void 0,u)}o.run(l,a,function(d,u,f){if(d||!u||!f)return c(d);const p=u,_=o.stringify(p,f);var g;typeof(g=_)=="string"||function(m){return!!(m&&typeof m=="object"&&"byteLength"in m&&"byteOffset"in m)}(g)?f.value=_:f.result=_,c(d,f)})}}processSync(e){let n,o=!1;return this.freeze(),Bf("processSync",this.parser||this.Parser),Uf("processSync",this.compiler||this.Compiler),this.process(e,function(r,s){o=!0,o3(r),n=s}),l3("processSync","process",o),n}run(e,n,o){a3(e),this.freeze();const r=this.transformers;return o||typeof n!="function"||(o=n,n=void 0),o?s(void 0,o):new Promise(s);function s(i,a){const l=Zl(n);r.run(e,l,function(c,d,u){const f=d||e;c?a(c):i?i(f):o(void 0,f,u)})}}runSync(e,n){let o,r=!1;return this.run(e,n,function(s,i){o3(s),o=i,r=!0}),l3("runSync","run",r),o}stringify(e,n){this.freeze();const o=Zl(n),r=this.compiler||this.Compiler;return Uf("stringify",r),a3(e),r(e,o)}use(e,...n){const o=this.attachers,r=this.namespace;if(Vf("use",this.frozen),e!=null)if(typeof e=="function")l(e,n);else{if(typeof e!="object")throw new TypeError("Expected usable value, not `"+e+"`");Array.isArray(e)?a(e):i(e)}return this;function s(c){if(typeof c=="function")l(c,[]);else{if(typeof c!="object")throw new TypeError("Expected usable value, not `"+c+"`");if(Array.isArray(c)){const[d,...u]=c;l(d,u)}else i(c)}}function i(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(c.plugins),c.settings&&(r.settings=Of(!0,r.settings,c.settings))}function a(c){let d=-1;if(c!=null){if(!Array.isArray(c))throw new TypeError("Expected a list of plugins, not `"+c+"`");for(;++d<c.length;)s(c[d])}}function l(c,d){let u=-1,f=-1;for(;++u<o.length;)if(o[u][0]===c){f=u;break}if(f===-1)o.push([c,...d]);else if(d.length>0){let[p,..._]=d;const g=o[f][1];Df(g)&&Df(p)&&(p=Of(!0,g,p)),o[f]=[c,p,..._]}}}}const RL=new zf().freeze();function Bf(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Uf(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Vf(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function a3(t){if(!Df(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function l3(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Zl(t){return function(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}(t)?t:new s3(t)}const c3=[],d3={allowDangerousHtml:!0},PL=/^(https?|ircs?|mailto|xmpp)$/i,LL=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function FL(t){const e=function(o){const r=o.rehypePlugins||c3,s=o.remarkPlugins||c3,i=o.remarkRehypeOptions?{...o.remarkRehypeOptions,...d3}:d3;return RL().use(fL).use(s).use(EL,i).use(r)}(t),n=function(o){const r=o.children||"",s=new s3;return typeof r=="string"&&(s.value=r),s}(t);return function(o,r){const s=r.allowedElements,i=r.allowElement,a=r.components,l=r.disallowedElements,c=r.skipHtml,d=r.unwrapDisallowed,u=r.urlTransform||zL;for(const p of LL)Object.hasOwn(r,p.from)&&(p.from,p.to&&p.to,p.id);return r.className&&(o={type:"element",tagName:"div",properties:{className:r.className},children:o.type==="root"?o.children:[o]}),e3(o,f),uP(o,{Fragment:h.Fragment,components:a,ignoreInvalidStyle:!0,jsx:h.jsx,jsxs:h.jsxs,passKeys:!0,passNode:!0});function f(p,_,g){if(p.type==="raw"&&g&&typeof _=="number")return c?g.children.splice(_,1):g.children[_]={type:"text",value:p.value},_;if(p.type==="element"){let m;for(m in vf)if(Object.hasOwn(vf,m)&&Object.hasOwn(p.properties,m)){const b=p.properties[m],x=vf[m];(x===null||x.includes(p.tagName))&&(p.properties[m]=u(String(b||""),m,p))}}if(p.type==="element"){let m=s?!s.includes(p.tagName):!!l&&l.includes(p.tagName);if(!m&&i&&typeof _=="number"&&(m=!i(p,_,g)),m&&g&&typeof _=="number")return d&&p.children?g.children.splice(_,1,...p.children):g.children.splice(_,1),_}}}(e.runSync(e.parse(n),n),t)}function zL(t){const e=t.indexOf(":"),n=t.indexOf("?"),o=t.indexOf("#"),r=t.indexOf("/");return e===-1||r!==-1&&e>r||n!==-1&&e>n||o!==-1&&e>o||PL.test(t.slice(0,e))?t:""}const BL=[st.lineWrapping],UL=new Set(["python","markdown","sql","json","yaml","toml","shell","javascript","typescript","jsx","tsx","css","html"]),VL=t=>{const e=X.c(26),{code:n,language:o}=t,{theme:r}=Fo(),{createNewCell:s}=Lt(),i=zs(),a=He(Ts),[l,c]=A.useState(n);let d,u,f;e[0]!==n?(d=()=>{c(n)},u=[n],e[0]=n,e[1]=d,e[2]=u):(d=e[1],u=e[2]),A.useEffect(d,u),e[3]!==a||e[4]!==s||e[5]!==o||e[6]!==i||e[7]!==l?(f=()=>{const j=function(I,T){return I?I==="python"?{language:I,code:T}:I==="sql"?{language:"python",code:Ec.fromQuery(T)}:I==="markdown"?{language:"python",code:ta.fromMarkdown(T)}:I==="shell"||I==="bash"?{language:"python",code:`import subprocess
139
+ `},r),s}function EL(t,e){return t&&"run"in t?async function(n,o){const r=n3(n,{file:o,...e});await t.run(r,o)}:function(n,o){return n3(n,{file:o,...t||e})}}function o3(t){if(t)throw t}var Of,r3,IL=function(){if(r3)return Of;r3=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,o=Object.getOwnPropertyDescriptor,r=function(l){return typeof Array.isArray=="function"?Array.isArray(l):e.call(l)==="[object Array]"},s=function(l){if(!l||e.call(l)!=="[object Object]")return!1;var c,d=t.call(l,"constructor"),u=l.constructor&&l.constructor.prototype&&t.call(l.constructor.prototype,"isPrototypeOf");if(l.constructor&&!d&&!u)return!1;for(c in l);return c===void 0||t.call(l,c)},i=function(l,c){n&&c.name==="__proto__"?n(l,c.name,{enumerable:!0,configurable:!0,value:c.newValue,writable:!0}):l[c.name]=c.newValue},a=function(l,c){if(c==="__proto__"){if(!t.call(l,c))return;if(o)return o(l,c).value}return l[c]};return Of=function l(){var c,d,u,f,p,_,g=arguments[0],m=1,b=arguments.length,x=!1;for(typeof g=="boolean"&&(x=g,g=arguments[1]||{},m=2),(g==null||typeof g!="object"&&typeof g!="function")&&(g={});m<b;++m)if((c=arguments[m])!=null)for(d in c)u=a(g,d),g!==(f=a(c,d))&&(x&&f&&(s(f)||(p=r(f)))?(p?(p=!1,_=u&&r(u)?u:[]):_=u&&s(u)?u:{},i(g,{name:d,newValue:l(x,_,f)})):f!==void 0&&i(g,{name:d,newValue:f}));return g},Of}();const Df=rS(IL);function Rf(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return!(e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null||Symbol.toStringTag in t||Symbol.iterator in t)}function AL(){const t=[],e={run:function(...n){let o=-1;const r=n.pop();if(typeof r!="function")throw new TypeError("Expected function as last argument, not "+r);(function s(i,...a){const l=t[++o];let c=-1;if(i)r(i);else{for(;++c<n.length;)a[c]!==null&&a[c]!==void 0||(a[c]=n[c]);n=a,l?function(d,u){let f;return p;function p(...m){const b=d.length>m.length;let x;b&&m.push(_);try{x=d.apply(this,m)}catch(y){if(b&&f)throw y;return _(y)}b||(x&&x.then&&typeof x.then=="function"?x.then(g,_):x instanceof Error?_(x):g(x))}function _(m,...b){f||(f=!0,u(m,...b))}function g(m){_(null,m)}}(l,s)(...a):r(null,...a)}})(null,...n)},use:function(n){if(typeof n!="function")throw new TypeError("Expected `middelware` to be a function, not "+n);return t.push(n),e}};return e}const uo={basename:function(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Ki(t);let n,o=0,r=-1,s=t.length;if(e===void 0||e.length===0||e.length>t.length){for(;s--;)if(t.codePointAt(s)===47){if(n){o=s+1;break}}else r<0&&(n=!0,r=s+1);return r<0?"":t.slice(o,r)}if(e===t)return"";let i=-1,a=e.length-1;for(;s--;)if(t.codePointAt(s)===47){if(n){o=s+1;break}}else i<0&&(n=!0,i=s+1),a>-1&&(t.codePointAt(s)===e.codePointAt(a--)?a<0&&(r=s):(a=-1,r=i));return o===r?r=i:r<0&&(r=t.length),t.slice(o,r)},dirname:function(t){if(Ki(t),t.length===0)return".";let e,n=-1,o=t.length;for(;--o;)if(t.codePointAt(o)===47){if(e){n=o;break}}else e||(e=!0);return n<0?t.codePointAt(0)===47?"/":".":n===1&&t.codePointAt(0)===47?"//":t.slice(0,n)},extname:function(t){Ki(t);let e,n=t.length,o=-1,r=0,s=-1,i=0;for(;n--;){const a=t.codePointAt(n);if(a!==47)o<0&&(e=!0,o=n+1),a===46?s<0?s=n:i!==1&&(i=1):s>-1&&(i=-1);else if(e){r=n+1;break}}return s<0||o<0||i===0||i===1&&s===o-1&&s===r+1?"":t.slice(s,o)},join:function(...t){let e,n=-1;for(;++n<t.length;)Ki(t[n]),t[n]&&(e=e===void 0?t[n]:e+"/"+t[n]);return e===void 0?".":function(o){Ki(o);const r=o.codePointAt(0)===47;let s=function(i,a){let l,c,d="",u=0,f=-1,p=0,_=-1;for(;++_<=i.length;){if(_<i.length)l=i.codePointAt(_);else{if(l===47)break;l=47}if(l===47){if(!(f===_-1||p===1))if(f!==_-1&&p===2){if(d.length<2||u!==2||d.codePointAt(d.length-1)!==46||d.codePointAt(d.length-2)!==46){if(d.length>2){if(c=d.lastIndexOf("/"),c!==d.length-1){c<0?(d="",u=0):(d=d.slice(0,c),u=d.length-1-d.lastIndexOf("/")),f=_,p=0;continue}}else if(d.length>0){d="",u=0,f=_,p=0;continue}}a&&(d=d.length>0?d+"/..":"..",u=2)}else d.length>0?d+="/"+i.slice(f+1,_):d=i.slice(f+1,_),u=_-f-1;f=_,p=0}else l===46&&p>-1?p++:p=-1}return d}(o,!r);return s.length!==0||r||(s="."),s.length>0&&o.codePointAt(o.length-1)===47&&(s+="/"),r?"/"+s:s}(e)},sep:"/"};function Ki(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const TL={cwd:function(){return"/"}};function Pf(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function ML(t){if(typeof t=="string")t=new URL(t);else if(!Pf(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const n=e.pathname;let o=-1;for(;++o<n.length;)if(n.codePointAt(o)===37&&n.codePointAt(o+1)===50){const r=n.codePointAt(o+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(n)}(t)}const Lf=["history","path","basename","stem","extname","dirname"];class s3{constructor(e){let n;n=e?Pf(e)?{path:e}:typeof e=="string"||function(s){return!!(s&&typeof s=="object"&&"byteLength"in s&&"byteOffset"in s)}(e)?{value:e}:e:{},this.cwd="cwd"in n?"":TL.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let o,r=-1;for(;++r<Lf.length;){const s=Lf[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}for(o in n)Lf.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?uo.basename(this.path):void 0}set basename(e){zf(e,"basename"),Ff(e,"basename"),this.path=uo.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?uo.dirname(this.path):void 0}set dirname(e){i3(this.basename,"dirname"),this.path=uo.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?uo.extname(this.path):void 0}set extname(e){if(Ff(e,"extname"),i3(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=uo.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Pf(e)&&(e=ML(e)),zf(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?uo.basename(this.path,this.extname):void 0}set stem(e){zf(e,"stem"),Ff(e,"stem"),this.path=uo.join(this.dirname||"",e+(this.extname||""))}fail(e,n,o){const r=this.message(e,n,o);throw r.fatal=!0,r}info(e,n,o){const r=this.message(e,n,o);return r.fatal=void 0,r}message(e,n,o){const r=new on(e,n,o);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function Ff(t,e){if(t&&t.includes(uo.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+uo.sep+"`")}function zf(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function i3(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}const OL=function(t){const e=this.constructor.prototype,n=e[t],o=function(){return n.apply(o,arguments)};return Object.setPrototypeOf(o,e),o},DL={}.hasOwnProperty;class Bf extends OL{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=AL()}copy(){const e=new Bf;let n=-1;for(;++n<this.attachers.length;){const o=this.attachers[n];e.use(...o)}return e.data(Df(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?($f("data",this.frozen),this.namespace[e]=n,this):DL.call(this.namespace,e)&&this.namespace[e]||void 0:e?($f("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...o]=this.attachers[this.freezeIndex];if(o[0]===!1)continue;o[0]===!0&&(o[0]=void 0);const r=n.call(e,...o);typeof r=="function"&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=Zl(e),o=this.parser||this.Parser;return Uf("parse",o),o(String(n),n)}process(e,n){const o=this;return this.freeze(),Uf("process",this.parser||this.Parser),Vf("process",this.compiler||this.Compiler),n?r(void 0,n):new Promise(r);function r(s,i){const a=Zl(e),l=o.parse(a);function c(d,u){d||!u?i(d):s?s(u):n(void 0,u)}o.run(l,a,function(d,u,f){if(d||!u||!f)return c(d);const p=u,_=o.stringify(p,f);var g;typeof(g=_)=="string"||function(m){return!!(m&&typeof m=="object"&&"byteLength"in m&&"byteOffset"in m)}(g)?f.value=_:f.result=_,c(d,f)})}}processSync(e){let n,o=!1;return this.freeze(),Uf("processSync",this.parser||this.Parser),Vf("processSync",this.compiler||this.Compiler),this.process(e,function(r,s){o=!0,o3(r),n=s}),l3("processSync","process",o),n}run(e,n,o){a3(e),this.freeze();const r=this.transformers;return o||typeof n!="function"||(o=n,n=void 0),o?s(void 0,o):new Promise(s);function s(i,a){const l=Zl(n);r.run(e,l,function(c,d,u){const f=d||e;c?a(c):i?i(f):o(void 0,f,u)})}}runSync(e,n){let o,r=!1;return this.run(e,n,function(s,i){o3(s),o=i,r=!0}),l3("runSync","run",r),o}stringify(e,n){this.freeze();const o=Zl(n),r=this.compiler||this.Compiler;return Vf("stringify",r),a3(e),r(e,o)}use(e,...n){const o=this.attachers,r=this.namespace;if($f("use",this.frozen),e!=null)if(typeof e=="function")l(e,n);else{if(typeof e!="object")throw new TypeError("Expected usable value, not `"+e+"`");Array.isArray(e)?a(e):i(e)}return this;function s(c){if(typeof c=="function")l(c,[]);else{if(typeof c!="object")throw new TypeError("Expected usable value, not `"+c+"`");if(Array.isArray(c)){const[d,...u]=c;l(d,u)}else i(c)}}function i(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(c.plugins),c.settings&&(r.settings=Df(!0,r.settings,c.settings))}function a(c){let d=-1;if(c!=null){if(!Array.isArray(c))throw new TypeError("Expected a list of plugins, not `"+c+"`");for(;++d<c.length;)s(c[d])}}function l(c,d){let u=-1,f=-1;for(;++u<o.length;)if(o[u][0]===c){f=u;break}if(f===-1)o.push([c,...d]);else if(d.length>0){let[p,..._]=d;const g=o[f][1];Rf(g)&&Rf(p)&&(p=Df(!0,g,p)),o[f]=[c,p,..._]}}}}const RL=new Bf().freeze();function Uf(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Vf(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function $f(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function a3(t){if(!Rf(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function l3(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Zl(t){return function(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}(t)?t:new s3(t)}const c3=[],d3={allowDangerousHtml:!0},PL=/^(https?|ircs?|mailto|xmpp)$/i,LL=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function FL(t){const e=function(o){const r=o.rehypePlugins||c3,s=o.remarkPlugins||c3,i=o.remarkRehypeOptions?{...o.remarkRehypeOptions,...d3}:d3;return RL().use(fL).use(s).use(EL,i).use(r)}(t),n=function(o){const r=o.children||"",s=new s3;return typeof r=="string"&&(s.value=r),s}(t);return function(o,r){const s=r.allowedElements,i=r.allowElement,a=r.components,l=r.disallowedElements,c=r.skipHtml,d=r.unwrapDisallowed,u=r.urlTransform||zL;for(const p of LL)Object.hasOwn(r,p.from)&&(p.from,p.to&&p.to,p.id);return r.className&&(o={type:"element",tagName:"div",properties:{className:r.className},children:o.type==="root"?o.children:[o]}),e3(o,f),uP(o,{Fragment:h.Fragment,components:a,ignoreInvalidStyle:!0,jsx:h.jsx,jsxs:h.jsxs,passKeys:!0,passNode:!0});function f(p,_,g){if(p.type==="raw"&&g&&typeof _=="number")return c?g.children.splice(_,1):g.children[_]={type:"text",value:p.value},_;if(p.type==="element"){let m;for(m in kf)if(Object.hasOwn(kf,m)&&Object.hasOwn(p.properties,m)){const b=p.properties[m],x=kf[m];(x===null||x.includes(p.tagName))&&(p.properties[m]=u(String(b||""),m,p))}}if(p.type==="element"){let m=s?!s.includes(p.tagName):!!l&&l.includes(p.tagName);if(!m&&i&&typeof _=="number"&&(m=!i(p,_,g)),m&&g&&typeof _=="number")return d&&p.children?g.children.splice(_,1,...p.children):g.children.splice(_,1),_}}}(e.runSync(e.parse(n),n),t)}function zL(t){const e=t.indexOf(":"),n=t.indexOf("?"),o=t.indexOf("#"),r=t.indexOf("/");return e===-1||r!==-1&&e>r||n!==-1&&e>n||o!==-1&&e>o||PL.test(t.slice(0,e))?t:""}const BL=[st.lineWrapping],UL=new Set(["python","markdown","sql","json","yaml","toml","shell","javascript","typescript","jsx","tsx","css","html"]),VL=t=>{const e=X.c(26),{code:n,language:o}=t,{theme:r}=Fo(),{createNewCell:s}=Lt(),i=zs(),a=He(Ts),[l,c]=A.useState(n);let d,u,f;e[0]!==n?(d=()=>{c(n)},u=[n],e[0]=n,e[1]=d,e[2]=u):(d=e[1],u=e[2]),A.useEffect(d,u),e[3]!==a||e[4]!==s||e[5]!==o||e[6]!==i||e[7]!==l?(f=()=>{const j=function(I,T){return I?I==="python"?{language:I,code:T}:I==="sql"?{language:"python",code:Ec.fromQuery(T)}:I==="markdown"?{language:"python",code:ta.fromMarkdown(T)}:I==="shell"||I==="bash"?{language:"python",code:`import subprocess
140
140
  subprocess.run("${T}")`}:{language:"python",code:`_${I} = """
141
141
  ${T}
142
- """`}:{language:"python",code:T}}(o,l);o==="sql"&&ar(a,s,i),s({code:j.code,before:!1,cellId:i??"__end__"})},e[3]=a,e[4]=s,e[5]=o,e[6]=i,e[7]=l,e[8]=f):f=e[8];const p=f;let _;e[9]!==l?(_=async()=>{await yn(l)},e[9]=l,e[10]=_):_=e[10];const g=_,m=r==="dark"?"dark":"light",b=o&&UL.has(o)?o:void 0;let x,y,v,k,S,E;return e[11]!==m||e[12]!==b||e[13]!==l?(x=h.jsx(_a,{theme:m,language:b,className:"cm border rounded overflow-hidden",extensions:BL,value:l,onChange:c}),e[11]=m,e[12]=b,e[13]=l,e[14]=x):x=e[14],e[15]!==g?(y=h.jsx($L,{size:"xs",variant:"outline",onClick:g,children:"Copy"}),e[15]=g,e[16]=y):y=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(v=h.jsx(ti,{className:"ml-2 h-4 w-4"}),e[17]=v):v=e[17],e[18]!==p?(k=h.jsxs(Pe,{size:"xs",variant:"outline",onClick:p,children:["Add to Notebook",v]}),e[18]=p,e[19]=k):k=e[19],e[20]!==k||e[21]!==y?(S=h.jsxs("div",{className:"flex justify-end mt-2 space-x-2",children:[y,k]}),e[20]=k,e[21]=y,e[22]=S):S=e[22],e[23]!==S||e[24]!==x?(E=h.jsxs("div",{className:"relative",children:[x,S]}),e[23]=S,e[24]=x,e[25]=E):E=e[25],E},$L=t=>{const e=X.c(12);let n,o;e[0]!==t?({onClick:n,...o}=t,e[0]=t,e[1]=n,e[2]=o):(n=e[1],o=e[2]);const[r,s]=A.useState(!1);let i,a,l;e[3]!==r?(i=()=>{r&&setTimeout(()=>s(!1),1e3)},a=[r],e[3]=r,e[4]=i,e[5]=a):(i=e[4],a=e[5]),A.useEffect(i,a),e[6]!==n?(l=u=>{n==null||n(u),s(!0)},e[6]=n,e[7]=l):l=e[7];const c=r?"Copied":"Copy";let d;return e[8]!==o||e[9]!==l||e[10]!==c?(d=h.jsx(Pe,{...o,onClick:l,children:c}),e[8]=o,e[9]=l,e[10]=c,e[11]=d):d=e[11],d},HL={code:({children:t,className:e})=>{const n=e==null?void 0:e.replace("language-","");return n&&typeof t=="string"?h.jsxs("div",{children:[h.jsx("div",{className:"text-xs text-muted-foreground pl-1",children:n}),h.jsx(VL,{code:t.trim(),language:n})]}):h.jsx("code",{className:e,children:t})}},u3=A.memo(t=>{const e=X.c(2),{content:n}=t;let o;return e[0]!==n?(o=h.jsx(FL,{components:HL,className:"prose dark:prose-invert max-w-none prose-pre:pl-0",children:n}),e[0]=n,e[1]=o):o=e[1],o},(t,e)=>t.content===e.content);u3.displayName="MemoizedMarkdownBlock";const h3=A.memo(({content:t})=>{const e=A.useMemo(()=>{return n=t,KV.lexer(n).map(o=>o.raw);var n},[t]);return h.jsx(h.Fragment,{children:e.map((n,o)=>h.jsx(u3,{content:n},`markdown-block-${o}`))})});h3.displayName="MarkdownRenderer";const $f=(t,e,n,o)=>e?{...t,chats:t.chats.map(r=>r.id===e?{...r,messages:[...r.messages,{role:n,content:o,timestamp:Date.now()}],updatedAt:Date.now()}:r)}:(Xt.warn("No active chat"),t),WL=t=>{var y;const e=X.c(27),{onNewChat:n,activeChatId:o,setActiveChat:r,chats:s}=t,i=He(R4),{handleClick:a}=ya(),l=((y=i==null?void 0:i.open_ai)==null?void 0:y.model)||"gpt-4-turbo";let c,d,u,f,p,_,g,m,b,x;if(e[0]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(Lr,{className:"h-4 w-4"}),e[0]=c):c=e[0],e[1]!==n?(d=h.jsx(Re,{content:"New chat",children:h.jsx(Pe,{variant:"text",size:"icon",onClick:n,children:c})}),e[1]=n,e[2]=d):d=e[2],e[3]!==a?(u=()=>a("ai"),e[3]=a,e[4]=u):u=e[4],e[5]!==l||e[6]!==u?(f=h.jsx(Pe,{variant:"text",size:"xs",className:"hover:bg-foreground/10 py-2",onClick:u,children:l}),e[5]=l,e[6]=u,e[7]=f):f=e[7],e[8]!==d||e[9]!==f?(p=h.jsxs("div",{className:"flex items-center gap-2",children:[d,f]}),e[8]=d,e[9]=f,e[10]=p):p=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(_=h.jsx(Re,{content:"Previous chats",children:h.jsx(Ys,{asChild:!0,children:h.jsx(Pe,{variant:"text",size:"icon",children:h.jsx(QV,{className:"h-4 w-4"})})})}),e[11]=_):_=e[11],e[12]!==s.length?(g=s.length===0&&h.jsx(In,{title:"No chats yet",description:"Start a new chat to get started",icon:h.jsx(dp,{})}),e[12]=s.length,e[13]=g):g=e[13],e[14]!==o||e[15]!==s||e[16]!==r){let v;e[18]!==o||e[19]!==r?(v=k=>h.jsxs("div",{className:Oe("p-3 rounded-md cursor-pointer hover:bg-accent",k.id===o&&"bg-accent"),onClick:()=>{r(k.id)},children:[h.jsx("div",{className:"font-medium",children:k.title}),h.jsx("div",{className:"text-sm text-muted-foreground",children:e$(k.updatedAt)})]},k.id),e[18]=o,e[19]=r,e[20]=v):v=e[20],m=s.map(v),e[14]=o,e[15]=s,e[16]=r,e[17]=m}else m=e[17];return e[21]!==g||e[22]!==m?(b=h.jsxs(Pr,{children:[_,h.jsx(Vs,{className:"w-[520px] p-0",align:"start",side:"right",children:h.jsx(X2,{className:"h-[500px] p-4",children:h.jsxs("div",{className:"space-y-4",children:[g,m]})})})]}),e[21]=g,e[22]=m,e[23]=b):b=e[23],e[24]!==p||e[25]!==b?(x=h.jsxs("div",{className:"flex border-b px-2 py-1 justify-between flex-shrink-0 items-center",children:[p,b]}),e[24]=p,e[25]=b,e[26]=x):x=e[26],x},f3=A.memo(t=>{const e=X.c(14),{message:n,index:o,theme:r,onEdit:s,setChatState:i,chatState:a}=t,l=n.role==="user"?"justify-end":"justify-start";let c,d,u;return e[0]!==l?(c=Oe("flex group relative",l),e[0]=l,e[1]=c):c=e[1],e[2]!==a||e[3]!==o||e[4]!==n.content||e[5]!==n.id||e[6]!==n.role||e[7]!==s||e[8]!==i||e[9]!==r?(d=n.role==="user"?h.jsx("div",{className:"w-[95%] bg-background border p-1 rounded-sm",children:h.jsx(Dc,{value:n.content,theme:r,placeholder:"Type your message...",onChange:YL,onSubmit:(f,p)=>{p.trim()&&(s(o,p),a.activeChatId&&i(_=>$f(_,a.activeChatId,"user",p)))},onClose:JL},n.id)}):h.jsxs("div",{className:"w-[95%]",children:[h.jsx("div",{className:"absolute right-1 top-1 opacity-0 group-hover:opacity-100 transition-opacity",children:h.jsx(eS,{className:"h-3 w-3",value:n.content})}),h.jsx(h3,{content:n.content})]}),e[2]=a,e[3]=o,e[4]=n.content,e[5]=n.id,e[6]=n.role,e[7]=s,e[8]=i,e[9]=r,e[10]=d):d=e[10],e[11]!==c||e[12]!==d?(u=h.jsx("div",{className:c,children:d}),e[11]=c,e[12]=d,e[13]=u):u=e[13],u});f3.displayName="ChatMessage";const p3=A.memo(t=>{var c,d;const e=X.c(8),{input:n,setInput:o,onSubmit:r,theme:s,inputRef:i}=t;let a,l;return e[0]!==((c=i.current)==null?void 0:c.editor)?(a=()=>{var u,f;return(f=(u=i.current)==null?void 0:u.editor)==null?void 0:f.blur()},e[0]=(d=i.current)==null?void 0:d.editor,e[1]=a):a=e[1],e[2]!==n||e[3]!==r||e[4]!==o||e[5]!==a||e[6]!==s?(l=h.jsx("div",{className:"px-2 py-3 border-t relative flex-shrink-0 min-h-[80px]",children:h.jsx(Dc,{value:n,onChange:o,onSubmit:r,onClose:a,theme:s,placeholder:"Type your message..."})}),e[2]=n,e[3]=r,e[4]=o,e[5]=a,e[6]=s,e[7]=l):l=e[7],l});p3.displayName="ChatInput";const qL=()=>{const t=X.c(6),e=He(sc),{handleClick:n}=ya();if(!e){let r,s,i;return t[0]!==n?(r=h.jsx(Pe,{variant:"outline",size:"sm",onClick:()=>n("ai"),children:"Edit AI settings"}),t[0]=n,t[1]=r):r=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(s=h.jsx(dp,{}),t[2]=s):s=t[2],t[3]!==r?(i=h.jsx(In,{title:"Chat with AI",description:"AI is currently disabled. Add your API key to enable.",action:r,icon:s}),t[3]=r,t[4]=i):i=t[4],i}let o;return t[5]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx(GL,{}),t[5]=o):o=t[5],o},GL=()=>{const t=X.c(79),[e,n]=fn(rd),[o,r]=fn(FS),[s,i]=A.useState(""),a=A.useRef(null),l=A.useRef(null),c=A.useRef(null),d=A.useRef(null),{theme:u}=Fo(),f=o==null?void 0:o.id;let p,_,g,m,b,x;t[0]!==o?(_=o?o.messages.map(KL):[],t[0]=o,t[1]=_):_=t[1],p=_,t[2]===Symbol.for("react.memo_cache_sentinel")?(g=Sp("api/ai/chat").toString(),m=Nc.headers(),t[2]=g,t[3]=m):(g=t[2],m=t[3]),t[4]!==n?(b=be=>{n(Te=>$f(Te,Te.activeChatId,"assistant",be.content))},t[4]=n,t[5]=b):b=t[5],t[6]!==f||t[7]!==p||t[8]!==b?(x={id:f,initialMessages:p,keepLastMessageOnError:!0,experimental_throttle:100,api:g,headers:m,experimental_prepareRequestBody:ZL,streamProtocol:"text",onFinish:b,onError:QL,onResponse:eF},t[6]=f,t[7]=p,t[8]=b,t[9]=x):x=t[9];const{messages:y,input:v,setInput:k,setMessages:S,append:E,handleSubmit:j,error:I,status:T,reload:M,stop:L}=XV(x),B=T==="submitted"||T==="streaming";let O,z,F;t[10]===Symbol.for("react.memo_cache_sentinel")?(O=()=>{requestAnimationFrame(()=>{if(c.current){const be=c.current;be.scrollTop=be.scrollHeight}})},t[10]=O):O=t[10],t[11]!==e.activeChatId?(z=[e.activeChatId],t[11]=e.activeChatId,t[12]=z):z=t[12],A.useEffect(O,z),t[13]!==E||t[14]!==n||t[15]!==k?(F=be=>{const Te={id:ZV(),title:`${be.slice(0,30)}...`,messages:[{role:"user",content:be,timestamp:Date.now()}],createdAt:Date.now(),updatedAt:Date.now()};n(ze=>({chats:[...ze.chats,Te],activeChatId:Te.id})),k(""),E({role:"user",content:be})},t[13]=E,t[14]=n,t[15]=k,t[16]=F):F=t[16];const V=F;let P;t[17]!==r||t[18]!==k?(P=()=>{r(null),k(""),i("")},t[17]=r,t[18]=k,t[19]=P):P=t[19];const C=P;let $;t[20]!==E||t[21]!==S?($=(be,Te)=>{S(ze=>ze.slice(0,be)),E({role:"user",content:Te})},t[20]=E,t[21]=S,t[22]=$):$=t[22];const N=$;let H;t[23]!==e.activeChatId||t[24]!==j||t[25]!==n?(H=(be,Te)=>{Te.trim()&&(j(be),e.activeChatId&&n(ze=>$f(ze,e.activeChatId,"user",Te)))},t[23]=e.activeChatId,t[24]=j,t[25]=n,t[26]=H):H=t[26];const G=H;let Z;t[27]!==M?(Z=()=>{M()},t[27]=M,t[28]=Z):Z=t[28];const q=Z;let re;t[29]!==V||t[30]!==s?(re=()=>{s.trim()&&V(s.trim())},t[29]=V,t[30]=s,t[31]=re):re=t[31];const ne=re;let oe;t[32]===Symbol.for("react.memo_cache_sentinel")?(oe=()=>{var be,Te;return(Te=(be=a.current)==null?void 0:be.editor)==null?void 0:Te.blur()},t[32]=oe):oe=t[32];const Y=oe,Q=o==null?void 0:o.id;let ce,he,de,me,ie,Ce,we,ae,ve,ge;if(t[33]!==e.chats||t[34]!==C||t[35]!==r||t[36]!==Q?(ce=h.jsx(Fp,{children:h.jsx(WL,{onNewChat:C,activeChatId:Q,setActiveChat:r,chats:e.chats})}),t[33]=e.chats,t[34]=C,t[35]=r,t[36]=Q,t[37]=ce):ce=t[37],t[38]!==ne||t[39]!==y||t[40]!==s||t[41]!==u?(he=(!y||y.length===0)&&h.jsx("div",{className:"flex rounded-md border px-1 bg-background",children:h.jsx(Dc,{value:s,placeholder:"Ask anything, @ to include context about tables or dataframes",theme:u,onClose:Y,onChange:i,onSubmit:ne},"new-thread-input")}),t[38]=ne,t[39]=y,t[40]=s,t[41]=u,t[42]=he):he=t[42],t[43]!==e||t[44]!==N||t[45]!==y||t[46]!==n||t[47]!==u){let be;t[49]!==e||t[50]!==N||t[51]!==n||t[52]!==u?(be=(Te,ze)=>h.jsx(f3,{message:Te,index:ze,theme:u,onEdit:N,setChatState:n,chatState:e},ze),t[49]=e,t[50]=N,t[51]=n,t[52]=u,t[53]=be):be=t[53],de=y.map(be),t[43]=e,t[44]=N,t[45]=y,t[46]=n,t[47]=u,t[48]=de}else de=t[48];return t[54]!==B?(me=B&&h.jsx("div",{className:"flex justify-center py-4",children:h.jsx(Mp,{className:"h-4 w-4 animate-spin"})}),t[54]=B,t[55]=me):me=t[55],t[56]!==I||t[57]!==q?(ie=I&&h.jsxs("div",{className:"flex items-center justify-center space-x-2 mb-4",children:[h.jsx(Xs,{error:I}),h.jsx(Pe,{variant:"outline",size:"sm",onClick:q,children:"Retry"})]}),t[56]=I,t[57]=q,t[58]=ie):ie=t[58],t[59]===Symbol.for("react.memo_cache_sentinel")?(Ce=h.jsx("div",{ref:d}),t[59]=Ce):Ce=t[59],t[60]!==he||t[61]!==de||t[62]!==me||t[63]!==ie?(we=h.jsxs("div",{className:"flex-1 px-3 bg-[var(--slate-1)] gap-4 py-3 flex flex-col overflow-y-auto",ref:c,children:[he,de,me,ie,Ce]}),t[60]=he,t[61]=de,t[62]=me,t[63]=ie,t[64]=we):we=t[64],t[65]!==B||t[66]!==L?(ae=B&&h.jsx("div",{className:"w-full flex justify-center items-center z-20 border-t",children:h.jsx(Pe,{variant:"linkDestructive",size:"sm",onClick:L,children:"Stop"})}),t[65]=B,t[66]=L,t[67]=ae):ae=t[67],t[68]!==G||t[69]!==v||t[70]!==y||t[71]!==k||t[72]!==u?(ve=y&&y.length>0&&h.jsx(p3,{input:v,setInput:k,onSubmit:G,theme:u,inputRef:l}),t[68]=G,t[69]=v,t[70]=y,t[71]=k,t[72]=u,t[73]=ve):ve=t[73],t[74]!==ce||t[75]!==we||t[76]!==ae||t[77]!==ve?(ge=h.jsxs("div",{className:"flex flex-col h-[calc(100%-53px)]",children:[ce,we,ae,ve]}),t[74]=ce,t[75]=we,t[76]=ae,t[77]=ve,t[78]=ge):ge=t[78],ge};function YL(){}function JL(){}function KL(t){const{role:e,content:n,timestamp:o}=t;return{role:e,content:n,id:o.toString()}}function XL(t){return t.content}function ZL(t){return{...t,...b4({input:t.messages.map(XL).join(`
143
- `)}),includeOtherCode:Sc("")}}function QL(t){Xt.error("An error occurred:",t)}function eF(t){Xt.debug("Received HTTP response from server:",t)}const tF=K.lazy(()=>Op(()=>import("./tracing-BCPVXqFJ.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122]),import.meta.url).then(t=>({default:t.Tracing}))),nF=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=h.jsx(K.Suspense,{fallback:h.jsx(oF,{}),children:h.jsx(tF,{})}),t[0]=e):e=t[0],e},oF=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=h.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:h.jsx(Qn,{})}),t[0]=e):e=t[0],e},rF=()=>{const t=X.c(25),{openModal:e,closeModal:n}=Un();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const{data:r,loading:s,error:i,reload:a}=Xn(iF,o);let l;t[1]!==r?(l=r===void 0?[]:r,t[1]=r,t[2]=l):l=t[2];const c=l;let d;t[3]!==c?(d=c.filter(aF).map(lF),t[3]=c,t[4]=d):d=t[4];const u=d;if(s&&c.length===0){let y;return t[5]===Symbol.for("react.memo_cache_sentinel")?(y=h.jsx(Qn,{size:"medium",centered:!0}),t[5]=y):y=t[5],y}if(i){let y;return t[6]!==i?(y=h.jsx(Xs,{error:i}),t[6]=i,t[7]=y):y=t[7],y}if(c.length===0){let y;return t[8]===Symbol.for("react.memo_cache_sentinel")?(y=h.jsx(In,{title:"No environment variables",description:"No environment variables are available in this notebook.",icon:h.jsx(Yc,{})}),t[8]=y):y=t[8],y}let f,p,_,g,m,b,x;return t[9]!==n||t[10]!==e||t[11]!==u||t[12]!==a?(f=()=>e(h.jsx(kg,{providerNames:u,onSuccess:()=>{a(),n()},onClose:n})),t[9]=n,t[10]=e,t[11]=u,t[12]=a,t[13]=f):f=t[13],t[14]===Symbol.for("react.memo_cache_sentinel")?(p=h.jsx(Lr,{className:"h-4 w-4"}),t[14]=p):p=t[14],t[15]!==f?(_=h.jsx("div",{className:"flex justify-end h-8 border-b",children:h.jsx("button",{type:"button",className:"float-right border-l px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:f,children:p})}),t[15]=f,t[16]=_):_=t[16],t[17]===Symbol.for("react.memo_cache_sentinel")?(g=h.jsx(Wp,{children:h.jsxs(Ks,{children:[h.jsx(Fr,{children:"Environment Variable"}),h.jsx(Fr,{children:"Source"}),h.jsx(Fr,{})]})}),t[17]=g):g=t[17],t[18]!==c?(m=c.map(cF),t[18]=c,t[19]=m):m=t[19],t[20]!==m?(b=h.jsxs(Hp,{className:"overflow-auto flex-1 mb-16",children:[g,h.jsx(qp,{children:m})]}),t[20]=m,t[21]=b):b=t[21],t[22]!==_||t[23]!==b?(x=h.jsxs("div",{className:"flex flex-col h-full",children:[_,b]}),t[22]=_,t[23]=b,t[24]=x):x=t[24],x},sF=t=>{const e=X.c(9),{className:n,ariaLabel:o,onCopy:r}=t,[s,i]=K.useState(!1);let a;e[0]!==r?(a=()=>{r(),i(!0),setTimeout(()=>i(!1),1e3)},e[0]=r,e[1]=a):a=e[1];const l=a;let c,d;return e[2]!==s?(c=s?h.jsx(_c,{className:"w-3 h-3 text-green-700 rounded"}):h.jsx(Ls,{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=h.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 iF(){return vg((await bS.request({})).secrets)}function aF(t){return t.provider!=="env"}function lF(t){return t.name}function cF(t){return t.keys.map(e=>h.jsxs(Ks,{className:"group",children:[h.jsx(zr,{children:e}),h.jsx(zr,{children:t.provider!=="env"&&h.jsx(L4,{variant:"outline",className:"select-none",children:t.name})}),h.jsx(zr,{children:h.jsx(sF,{ariaLabel:`Copy ${e}`,onCopy:async()=>{await yn(`os.environ["${e}"]`),lt({title:"Copied to clipboard",description:`os.environ["${e}"] has been copied to your clipboard.`})},className:Oe("float-right px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible")})})]},`${t.name}-${e}`))}const dF=K.lazy(()=>Op(()=>import("./terminal-D0zmCMwt.js"),__vite__mapDeps([123,1,2,124]),import.meta.url)),uF=t=>{const e=X.c(120),{children:n}=t,{isSidebarOpen:o,isTerminalOpen:r,selectedPanel:s}=gc(),{setIsSidebarOpen:i,setIsTerminalOpen:a}=na(),l=K.useRef(null),c=K.useRef(null);let d,u,f,p,_;e[0]!==o?(d=()=>{if(!l.current)return;const ue=l.current.isCollapsed();o&&ue&&l.current.expand(),o||ue||l.current.collapse(),requestAnimationFrame(fF)},u=[o],e[0]=o,e[1]=d,e[2]=u):(d=e[1],u=e[2]),A.useEffect(d,u),e[3]!==r?(f=()=>{if(!c.current)return;const ue=c.current.isCollapsed();r&&ue&&c.current.expand(),r||ue||c.current.collapse(),requestAnimationFrame(mF)},p=[r],e[3]=r,e[4]=f,e[5]=p):(f=e[4],p=e[5]),A.useEffect(f,p),e[6]!==n?(_=h.jsx(Bc,{id:"app",className:"relative h-full",children:h.jsx(A.Suspense,{children:n})},"app"),e[6]=n,e[7]=_):_=e[7];const g=_,m=o?"resize-handle":"resize-handle-collapsed";let b,x;e[8]!==m?(b=Oe("border-border no-print z-10",m,"vertical"),e[8]=m,e[9]=b):b=e[9],e[10]!==b?(x=h.jsx(sS,{onDragging:iS,className:b}),e[10]=b,e[11]=x):x=e[11];const y=x,v=r?"resize-handle":"resize-handle-collapsed";let k,S;e[12]!==v?(k=Oe("border-border no-print z-20",v,"horizontal"),e[12]=v,e[13]=k):k=e[13],e[14]!==k?(S=h.jsx(sS,{onDragging:iS,className:k}),e[14]=k,e[15]=S):S=e[15];const E=S;let j,I,T,M,L,B,O,z,F,V,P,C,$,N,H,G,Z,q,re,ne,oe;e[16]!==s?(j=h.jsx("div",{className:"text-sm text-[var(--slate-11)] uppercase tracking-wide font-semibold flex-1",children:s}),e[16]=s,e[17]=j):j=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=h.jsx(go,{className:"w-4 h-4"}),e[20]=T):T=e[20],e[21]!==I?(M=h.jsx(Pe,{"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]!==j||e[24]!==M?(L=h.jsxs("div",{className:"p-3 border-b flex justify-between items-center",children:[j,M]}),e[23]=j,e[24]=M,e[25]=L):L=e[25],e[26]!==s?(B=s==="files"&&h.jsx(tR,{}),e[26]=s,e[27]=B):B=e[27],e[28]!==s?(O=s==="errors"&&h.jsx(Ax,{}),e[28]=s,e[29]=O):O=e[29],e[30]!==s?(z=s==="variables"&&h.jsx(k2,{}),e[30]=s,e[31]=z):z=e[31],e[32]!==s?(F=s==="dependencies"&&h.jsx(ED,{}),e[32]=s,e[33]=F):F=e[33],e[34]!==s?(V=s==="packages"&&h.jsx(ER,{}),e[34]=s,e[35]=V):V=e[35],e[36]!==s?(P=s==="outline"&&h.jsx(tO,{}),e[36]=s,e[37]=P):P=e[37],e[38]!==s?(C=s==="datasources"&&h.jsx(wR,{}),e[38]=s,e[39]=C):C=e[39],e[40]!==s?($=s==="documentation"&&h.jsx(OD,{}),e[40]=s,e[41]=$):$=e[41],e[42]!==s?(N=s==="snippets"&&h.jsx(iR,{}),e[42]=s,e[43]=N):N=e[43],e[44]!==s?(H=s==="scratchpad"&&h.jsx(jR,{}),e[44]=s,e[45]=H):H=e[45],e[46]!==s?(G=s==="chat"&&h.jsx(qL,{}),e[46]=s,e[47]=G):G=e[47],e[48]!==s?(Z=s==="logs"&&h.jsx(S2,{}),e[48]=s,e[49]=Z):Z=e[49],e[50]!==s?(q=s==="tracing"&&h.jsx(nF,{}),e[50]=s,e[51]=q):q=e[51],e[52]!==s?(re=s==="secrets"&&h.jsx(rF,{}),e[52]=s,e[53]=re):re=e[53],e[54]!==B||e[55]!==O||e[56]!==z||e[57]!==F||e[58]!==V||e[59]!==P||e[60]!==C||e[61]!==$||e[62]!==N||e[63]!==H||e[64]!==G||e[65]!==Z||e[66]!==q||e[67]!==re?(ne=h.jsx(A.Suspense,{children:h.jsxs(Lc,{children:[B,O,z,F,V,P,C,$,N,H,G,Z,q,re]})}),e[54]=B,e[55]=O,e[56]=z,e[57]=F,e[58]=V,e[59]=P,e[60]=C,e[61]=$,e[62]=N,e[63]=H,e[64]=G,e[65]=Z,e[66]=q,e[67]=re,e[68]=ne):ne=e[68],e[69]!==L||e[70]!==ne?(oe=h.jsx(wc,{children:h.jsxs("div",{className:"flex flex-col h-full flex-1 overflow-hidden mr-[-4px]",children:[L,ne]})}),e[69]=L,e[70]=ne,e[71]=oe):oe=e[71];const Y=oe,Q=o&&"border-r border-l border-[var(--slate-7)]";let ce,he,de,me,ie,Ce;e[72]!==Q?(ce=Oe("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",Q),e[72]=Q,e[73]=ce):ce=e[73],e[74]===Symbol.for("react.memo_cache_sentinel")?(he=(ue,je)=>{var ke;je===0&&ue===10&&((ke=l.current)==null||ke.resize(30))},e[74]=he):he=e[74],e[75]!==i?(de=()=>i(!1),me=()=>i(!0),e[75]=i,e[76]=de,e[77]=me):(de=e[76],me=e[77]),e[78]!==Y||e[79]!==y?(ie=h.jsxs("span",{className:"flex flex-row h-full",children:[Y," ",y]}),e[78]=Y,e[79]=y,e[80]=ie):ie=e[80],e[81]!==ce||e[82]!==de||e[83]!==me||e[84]!==ie?(Ce=h.jsx(Bc,{ref:l,id:"helper",collapsedSize:0,collapsible:!0,className:ce,minSize:10,defaultSize:0,maxSize:75,onResize:he,onCollapse:de,onExpand:me,children:ie},"helper"),e[81]=ce,e[82]=de,e[83]=me,e[84]=ie,e[85]=Ce):Ce=e[85];const we=Ce,ae=r&&"border-[var(--slate-7)]";let ve,ge,be,Te,ze,Xe,Fe,et;e[86]!==ae?(ve=Oe("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",ae),e[86]=ae,e[87]=ve):ve=e[87],e[88]===Symbol.for("react.memo_cache_sentinel")?(ge=(ue,je)=>{var ke;je===0&&ue===10&&((ke=c.current)==null||ke.resize(30))},e[88]=ge):ge=e[88],e[89]!==a?(be=()=>a(!1),Te=()=>a(!0),e[89]=a,e[90]=be,e[91]=Te):(be=e[90],Te=e[91]),e[92]!==a?(ze=()=>a(!1),e[92]=a,e[93]=ze):ze=e[93],e[94]!==r||e[95]!==ze?(Xe=h.jsx(dF,{visible:r,onClose:ze}),e[94]=r,e[95]=ze,e[96]=Xe):Xe=e[96],e[97]!==r||e[98]!==Xe?(Fe=h.jsx(vR,{isOpen:r,children:Xe}),e[97]=r,e[98]=Xe,e[99]=Fe):Fe=e[99],e[100]!==ve||e[101]!==be||e[102]!==Te||e[103]!==Fe||e[104]!==E?(et=h.jsxs(Bc,{ref:c,id:"terminal",collapsedSize:0,collapsible:!0,className:ve,minSize:10,defaultSize:0,maxSize:75,onResize:ge,onCollapse:be,onExpand:Te,children:[E,Fe]},"terminal"),e[100]=ve,e[101]=be,e[102]=Te,e[103]=Fe,e[104]=E,e[105]=et):et=e[105];const nt=et;let it,te,Ne,Me,Be,J,pe,_e;return e[106]===Symbol.for("react.memo_cache_sentinel")?(it=q$(),e[106]=it):it=e[106],e[107]===Symbol.for("react.memo_cache_sentinel")?(te=h.jsx(Lc,{children:h.jsx(JM,{})}),e[107]=te):te=e[107],e[108]!==nt?(Ne=h.jsx(jx,{capability:"terminal",children:nt}),e[108]=nt,e[109]=Ne):Ne=e[109],e[110]!==g||e[111]!==Ne?(Me=h.jsx(Bc,{children:h.jsxs(aS,{autoSaveId:"marimo:chrome:v1:l1",direction:"vertical",children:[g,Ne]})}),e[110]=g,e[111]=Ne,e[112]=Me):Me=e[112],e[113]===Symbol.for("react.memo_cache_sentinel")?(Be=h.jsx(t$,{}),e[113]=Be):Be=e[113],e[114]!==we||e[115]!==Me?(J=h.jsxs(aS,{autoSaveId:"marimo:chrome:v1:l2",direction:"horizontal",storage:it,children:[te,we,Me,Be]}),e[114]=we,e[115]=Me,e[116]=J):J=e[116],e[117]===Symbol.for("react.memo_cache_sentinel")?(pe=h.jsx(wc,{children:h.jsx(Lc,{children:h.jsx(HM,{})})}),e[117]=pe):pe=e[117],e[118]!==J?(_e=h.jsxs(G$,{children:[J,pe]}),e[118]=J,e[119]=_e):_e=e[119],_e};function hF(){window.dispatchEvent(new Event("resize"))}function fF(){requestAnimationFrame(hF)}function pF(){window.dispatchEvent(new Event("resize"))}function mF(){requestAnimationFrame(pF)}let m3;m3=new URL(window.location.href).searchParams.get(n$.showChrome)==="false",CS=Object.freeze(Object.defineProperty({__proto__:null,default:t=>{const e=X.c(10);if(m3){let s,i,a;return e[0]!==t?(s=h.jsx(Nx,{hideControls:!0,...t}),e[0]=t,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsx(eg,{}),e[2]=i):i=e[2],e[3]!==s?(a=h.jsxs(h.Fragment,{children:[s,i]}),e[3]=s,e[4]=a):a=e[4],a}let n,o,r;return e[5]!==t?(n=h.jsx(Nx,{...t}),e[5]=t,e[6]=n):n=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx(eg,{}),e[7]=o):o=e[7],e[8]!==n?(r=h.jsxs(uF,{children:[n,o]}),e[8]=n,e[9]=r):r=e[9],r}},Symbol.toStringTag,{value:"Module"}))});export{tm as C,Vc as E,In as P,X$ as __tla,nm as a,CS as e,wa as f,om as u};
142
+ """`}:{language:"python",code:T}}(o,l);o==="sql"&&ar(a,s,i),s({code:j.code,before:!1,cellId:i??"__end__"})},e[3]=a,e[4]=s,e[5]=o,e[6]=i,e[7]=l,e[8]=f):f=e[8];const p=f;let _;e[9]!==l?(_=async()=>{await yn(l)},e[9]=l,e[10]=_):_=e[10];const g=_,m=r==="dark"?"dark":"light",b=o&&UL.has(o)?o:void 0;let x,y,v,k,S,E;return e[11]!==m||e[12]!==b||e[13]!==l?(x=h.jsx(_a,{theme:m,language:b,className:"cm border rounded overflow-hidden",extensions:BL,value:l,onChange:c}),e[11]=m,e[12]=b,e[13]=l,e[14]=x):x=e[14],e[15]!==g?(y=h.jsx($L,{size:"xs",variant:"outline",onClick:g,children:"Copy"}),e[15]=g,e[16]=y):y=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(v=h.jsx(ti,{className:"ml-2 h-4 w-4"}),e[17]=v):v=e[17],e[18]!==p?(k=h.jsxs(Pe,{size:"xs",variant:"outline",onClick:p,children:["Add to Notebook",v]}),e[18]=p,e[19]=k):k=e[19],e[20]!==k||e[21]!==y?(S=h.jsxs("div",{className:"flex justify-end mt-2 space-x-2",children:[y,k]}),e[20]=k,e[21]=y,e[22]=S):S=e[22],e[23]!==S||e[24]!==x?(E=h.jsxs("div",{className:"relative",children:[x,S]}),e[23]=S,e[24]=x,e[25]=E):E=e[25],E},$L=t=>{const e=X.c(12);let n,o;e[0]!==t?({onClick:n,...o}=t,e[0]=t,e[1]=n,e[2]=o):(n=e[1],o=e[2]);const[r,s]=A.useState(!1);let i,a,l;e[3]!==r?(i=()=>{r&&setTimeout(()=>s(!1),1e3)},a=[r],e[3]=r,e[4]=i,e[5]=a):(i=e[4],a=e[5]),A.useEffect(i,a),e[6]!==n?(l=u=>{n==null||n(u),s(!0)},e[6]=n,e[7]=l):l=e[7];const c=r?"Copied":"Copy";let d;return e[8]!==o||e[9]!==l||e[10]!==c?(d=h.jsx(Pe,{...o,onClick:l,children:c}),e[8]=o,e[9]=l,e[10]=c,e[11]=d):d=e[11],d},HL={code:({children:t,className:e})=>{const n=e==null?void 0:e.replace("language-","");return n&&typeof t=="string"?h.jsxs("div",{children:[h.jsx("div",{className:"text-xs text-muted-foreground pl-1",children:n}),h.jsx(VL,{code:t.trim(),language:n})]}):h.jsx("code",{className:e,children:t})}},u3=A.memo(t=>{const e=X.c(2),{content:n}=t;let o;return e[0]!==n?(o=h.jsx(FL,{components:HL,className:"prose dark:prose-invert max-w-none prose-pre:pl-0",children:n}),e[0]=n,e[1]=o):o=e[1],o},(t,e)=>t.content===e.content);u3.displayName="MemoizedMarkdownBlock";const h3=A.memo(({content:t})=>{const e=A.useMemo(()=>{return n=t,KV.lexer(n).map(o=>o.raw);var n},[t]);return h.jsx(h.Fragment,{children:e.map((n,o)=>h.jsx(u3,{content:n},`markdown-block-${o}`))})});h3.displayName="MarkdownRenderer";const Hf=(t,e,n,o)=>e?{...t,chats:t.chats.map(r=>r.id===e?{...r,messages:[...r.messages,{role:n,content:o,timestamp:Date.now()}],updatedAt:Date.now()}:r)}:(Xt.warn("No active chat"),t),WL=t=>{var y;const e=X.c(27),{onNewChat:n,activeChatId:o,setActiveChat:r,chats:s}=t,i=He(R4),{handleClick:a}=ya(),l=((y=i==null?void 0:i.open_ai)==null?void 0:y.model)||"gpt-4-turbo";let c,d,u,f,p,_,g,m,b,x;if(e[0]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(Lr,{className:"h-4 w-4"}),e[0]=c):c=e[0],e[1]!==n?(d=h.jsx(Re,{content:"New chat",children:h.jsx(Pe,{variant:"text",size:"icon",onClick:n,children:c})}),e[1]=n,e[2]=d):d=e[2],e[3]!==a?(u=()=>a("ai"),e[3]=a,e[4]=u):u=e[4],e[5]!==l||e[6]!==u?(f=h.jsx(Pe,{variant:"text",size:"xs",className:"hover:bg-foreground/10 py-2",onClick:u,children:l}),e[5]=l,e[6]=u,e[7]=f):f=e[7],e[8]!==d||e[9]!==f?(p=h.jsxs("div",{className:"flex items-center gap-2",children:[d,f]}),e[8]=d,e[9]=f,e[10]=p):p=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(_=h.jsx(Re,{content:"Previous chats",children:h.jsx(Ys,{asChild:!0,children:h.jsx(Pe,{variant:"text",size:"icon",children:h.jsx(QV,{className:"h-4 w-4"})})})}),e[11]=_):_=e[11],e[12]!==s.length?(g=s.length===0&&h.jsx(In,{title:"No chats yet",description:"Start a new chat to get started",icon:h.jsx(up,{})}),e[12]=s.length,e[13]=g):g=e[13],e[14]!==o||e[15]!==s||e[16]!==r){let v;e[18]!==o||e[19]!==r?(v=k=>h.jsxs("div",{className:Oe("p-3 rounded-md cursor-pointer hover:bg-accent",k.id===o&&"bg-accent"),onClick:()=>{r(k.id)},children:[h.jsx("div",{className:"font-medium",children:k.title}),h.jsx("div",{className:"text-sm text-muted-foreground",children:e$(k.updatedAt)})]},k.id),e[18]=o,e[19]=r,e[20]=v):v=e[20],m=s.map(v),e[14]=o,e[15]=s,e[16]=r,e[17]=m}else m=e[17];return e[21]!==g||e[22]!==m?(b=h.jsxs(Pr,{children:[_,h.jsx(Vs,{className:"w-[520px] p-0",align:"start",side:"right",children:h.jsx(X2,{className:"h-[500px] p-4",children:h.jsxs("div",{className:"space-y-4",children:[g,m]})})})]}),e[21]=g,e[22]=m,e[23]=b):b=e[23],e[24]!==p||e[25]!==b?(x=h.jsxs("div",{className:"flex border-b px-2 py-1 justify-between flex-shrink-0 items-center",children:[p,b]}),e[24]=p,e[25]=b,e[26]=x):x=e[26],x},f3=A.memo(t=>{const e=X.c(14),{message:n,index:o,theme:r,onEdit:s,setChatState:i,chatState:a}=t,l=n.role==="user"?"justify-end":"justify-start";let c,d,u;return e[0]!==l?(c=Oe("flex group relative",l),e[0]=l,e[1]=c):c=e[1],e[2]!==a||e[3]!==o||e[4]!==n.content||e[5]!==n.id||e[6]!==n.role||e[7]!==s||e[8]!==i||e[9]!==r?(d=n.role==="user"?h.jsx("div",{className:"w-[95%] bg-background border p-1 rounded-sm",children:h.jsx(Dc,{value:n.content,theme:r,placeholder:"Type your message...",onChange:YL,onSubmit:(f,p)=>{p.trim()&&(s(o,p),a.activeChatId&&i(_=>Hf(_,a.activeChatId,"user",p)))},onClose:JL},n.id)}):h.jsxs("div",{className:"w-[95%]",children:[h.jsx("div",{className:"absolute right-1 top-1 opacity-0 group-hover:opacity-100 transition-opacity",children:h.jsx(eS,{className:"h-3 w-3",value:n.content})}),h.jsx(h3,{content:n.content})]}),e[2]=a,e[3]=o,e[4]=n.content,e[5]=n.id,e[6]=n.role,e[7]=s,e[8]=i,e[9]=r,e[10]=d):d=e[10],e[11]!==c||e[12]!==d?(u=h.jsx("div",{className:c,children:d}),e[11]=c,e[12]=d,e[13]=u):u=e[13],u});f3.displayName="ChatMessage";const p3=A.memo(t=>{var c,d;const e=X.c(8),{input:n,setInput:o,onSubmit:r,theme:s,inputRef:i}=t;let a,l;return e[0]!==((c=i.current)==null?void 0:c.editor)?(a=()=>{var u,f;return(f=(u=i.current)==null?void 0:u.editor)==null?void 0:f.blur()},e[0]=(d=i.current)==null?void 0:d.editor,e[1]=a):a=e[1],e[2]!==n||e[3]!==r||e[4]!==o||e[5]!==a||e[6]!==s?(l=h.jsx("div",{className:"px-2 py-3 border-t relative flex-shrink-0 min-h-[80px]",children:h.jsx(Dc,{value:n,onChange:o,onSubmit:r,onClose:a,theme:s,placeholder:"Type your message..."})}),e[2]=n,e[3]=r,e[4]=o,e[5]=a,e[6]=s,e[7]=l):l=e[7],l});p3.displayName="ChatInput";const qL=()=>{const t=X.c(6),e=He(sc),{handleClick:n}=ya();if(!e){let r,s,i;return t[0]!==n?(r=h.jsx(Pe,{variant:"outline",size:"sm",onClick:()=>n("ai"),children:"Edit AI settings"}),t[0]=n,t[1]=r):r=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(s=h.jsx(up,{}),t[2]=s):s=t[2],t[3]!==r?(i=h.jsx(In,{title:"Chat with AI",description:"AI is currently disabled. Add your API key to enable.",action:r,icon:s}),t[3]=r,t[4]=i):i=t[4],i}let o;return t[5]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx(GL,{}),t[5]=o):o=t[5],o},GL=()=>{const t=X.c(79),[e,n]=fn(sd),[o,r]=fn(FS),[s,i]=A.useState(""),a=A.useRef(null),l=A.useRef(null),c=A.useRef(null),d=A.useRef(null),{theme:u}=Fo(),f=o==null?void 0:o.id;let p,_,g,m,b,x;t[0]!==o?(_=o?o.messages.map(KL):[],t[0]=o,t[1]=_):_=t[1],p=_,t[2]===Symbol.for("react.memo_cache_sentinel")?(g=Cp("api/ai/chat").toString(),m=Nc.headers(),t[2]=g,t[3]=m):(g=t[2],m=t[3]),t[4]!==n?(b=be=>{n(Te=>Hf(Te,Te.activeChatId,"assistant",be.content))},t[4]=n,t[5]=b):b=t[5],t[6]!==f||t[7]!==p||t[8]!==b?(x={id:f,initialMessages:p,keepLastMessageOnError:!0,experimental_throttle:100,api:g,headers:m,experimental_prepareRequestBody:ZL,streamProtocol:"text",onFinish:b,onError:QL,onResponse:eF},t[6]=f,t[7]=p,t[8]=b,t[9]=x):x=t[9];const{messages:y,input:v,setInput:k,setMessages:S,append:E,handleSubmit:j,error:I,status:T,reload:M,stop:L}=XV(x),B=T==="submitted"||T==="streaming";let O,z,F;t[10]===Symbol.for("react.memo_cache_sentinel")?(O=()=>{requestAnimationFrame(()=>{if(c.current){const be=c.current;be.scrollTop=be.scrollHeight}})},t[10]=O):O=t[10],t[11]!==e.activeChatId?(z=[e.activeChatId],t[11]=e.activeChatId,t[12]=z):z=t[12],A.useEffect(O,z),t[13]!==E||t[14]!==n||t[15]!==k?(F=be=>{const Te={id:ZV(),title:`${be.slice(0,30)}...`,messages:[{role:"user",content:be,timestamp:Date.now()}],createdAt:Date.now(),updatedAt:Date.now()};n(ze=>({chats:[...ze.chats,Te],activeChatId:Te.id})),k(""),E({role:"user",content:be})},t[13]=E,t[14]=n,t[15]=k,t[16]=F):F=t[16];const V=F;let P;t[17]!==r||t[18]!==k?(P=()=>{r(null),k(""),i("")},t[17]=r,t[18]=k,t[19]=P):P=t[19];const C=P;let $;t[20]!==E||t[21]!==S?($=(be,Te)=>{S(ze=>ze.slice(0,be)),E({role:"user",content:Te})},t[20]=E,t[21]=S,t[22]=$):$=t[22];const N=$;let H;t[23]!==e.activeChatId||t[24]!==j||t[25]!==n?(H=(be,Te)=>{Te.trim()&&(j(be),e.activeChatId&&n(ze=>Hf(ze,e.activeChatId,"user",Te)))},t[23]=e.activeChatId,t[24]=j,t[25]=n,t[26]=H):H=t[26];const G=H;let Z;t[27]!==M?(Z=()=>{M()},t[27]=M,t[28]=Z):Z=t[28];const q=Z;let re;t[29]!==V||t[30]!==s?(re=()=>{s.trim()&&V(s.trim())},t[29]=V,t[30]=s,t[31]=re):re=t[31];const ne=re;let oe;t[32]===Symbol.for("react.memo_cache_sentinel")?(oe=()=>{var be,Te;return(Te=(be=a.current)==null?void 0:be.editor)==null?void 0:Te.blur()},t[32]=oe):oe=t[32];const Y=oe,Q=o==null?void 0:o.id;let ce,he,de,me,ie,Ce,we,ae,ve,ge;if(t[33]!==e.chats||t[34]!==C||t[35]!==r||t[36]!==Q?(ce=h.jsx(zp,{children:h.jsx(WL,{onNewChat:C,activeChatId:Q,setActiveChat:r,chats:e.chats})}),t[33]=e.chats,t[34]=C,t[35]=r,t[36]=Q,t[37]=ce):ce=t[37],t[38]!==ne||t[39]!==y||t[40]!==s||t[41]!==u?(he=(!y||y.length===0)&&h.jsx("div",{className:"flex rounded-md border px-1 bg-background",children:h.jsx(Dc,{value:s,placeholder:"Ask anything, @ to include context about tables or dataframes",theme:u,onClose:Y,onChange:i,onSubmit:ne},"new-thread-input")}),t[38]=ne,t[39]=y,t[40]=s,t[41]=u,t[42]=he):he=t[42],t[43]!==e||t[44]!==N||t[45]!==y||t[46]!==n||t[47]!==u){let be;t[49]!==e||t[50]!==N||t[51]!==n||t[52]!==u?(be=(Te,ze)=>h.jsx(f3,{message:Te,index:ze,theme:u,onEdit:N,setChatState:n,chatState:e},ze),t[49]=e,t[50]=N,t[51]=n,t[52]=u,t[53]=be):be=t[53],de=y.map(be),t[43]=e,t[44]=N,t[45]=y,t[46]=n,t[47]=u,t[48]=de}else de=t[48];return t[54]!==B?(me=B&&h.jsx("div",{className:"flex justify-center py-4",children:h.jsx(Op,{className:"h-4 w-4 animate-spin"})}),t[54]=B,t[55]=me):me=t[55],t[56]!==I||t[57]!==q?(ie=I&&h.jsxs("div",{className:"flex items-center justify-center space-x-2 mb-4",children:[h.jsx(Xs,{error:I}),h.jsx(Pe,{variant:"outline",size:"sm",onClick:q,children:"Retry"})]}),t[56]=I,t[57]=q,t[58]=ie):ie=t[58],t[59]===Symbol.for("react.memo_cache_sentinel")?(Ce=h.jsx("div",{ref:d}),t[59]=Ce):Ce=t[59],t[60]!==he||t[61]!==de||t[62]!==me||t[63]!==ie?(we=h.jsxs("div",{className:"flex-1 px-3 bg-[var(--slate-1)] gap-4 py-3 flex flex-col overflow-y-auto",ref:c,children:[he,de,me,ie,Ce]}),t[60]=he,t[61]=de,t[62]=me,t[63]=ie,t[64]=we):we=t[64],t[65]!==B||t[66]!==L?(ae=B&&h.jsx("div",{className:"w-full flex justify-center items-center z-20 border-t",children:h.jsx(Pe,{variant:"linkDestructive",size:"sm",onClick:L,children:"Stop"})}),t[65]=B,t[66]=L,t[67]=ae):ae=t[67],t[68]!==G||t[69]!==v||t[70]!==y||t[71]!==k||t[72]!==u?(ve=y&&y.length>0&&h.jsx(p3,{input:v,setInput:k,onSubmit:G,theme:u,inputRef:l}),t[68]=G,t[69]=v,t[70]=y,t[71]=k,t[72]=u,t[73]=ve):ve=t[73],t[74]!==ce||t[75]!==we||t[76]!==ae||t[77]!==ve?(ge=h.jsxs("div",{className:"flex flex-col h-[calc(100%-53px)]",children:[ce,we,ae,ve]}),t[74]=ce,t[75]=we,t[76]=ae,t[77]=ve,t[78]=ge):ge=t[78],ge};function YL(){}function JL(){}function KL(t){const{role:e,content:n,timestamp:o}=t;return{role:e,content:n,id:o.toString()}}function XL(t){return t.content}function ZL(t){return{...t,...b4({input:t.messages.map(XL).join(`
143
+ `)}),includeOtherCode:Sc("")}}function QL(t){Xt.error("An error occurred:",t)}function eF(t){Xt.debug("Received HTTP response from server:",t)}const tF=K.lazy(()=>Dp(()=>import("./tracing-BGJu6zL2.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122]),import.meta.url).then(t=>({default:t.Tracing}))),nF=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=h.jsx(K.Suspense,{fallback:h.jsx(oF,{}),children:h.jsx(tF,{})}),t[0]=e):e=t[0],e},oF=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=h.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:h.jsx(Qn,{})}),t[0]=e):e=t[0],e},rF=()=>{const t=X.c(25),{openModal:e,closeModal:n}=Un();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const{data:r,loading:s,error:i,reload:a}=Xn(iF,o);let l;t[1]!==r?(l=r===void 0?[]:r,t[1]=r,t[2]=l):l=t[2];const c=l;let d;t[3]!==c?(d=c.filter(aF).map(lF),t[3]=c,t[4]=d):d=t[4];const u=d;if(s&&c.length===0){let y;return t[5]===Symbol.for("react.memo_cache_sentinel")?(y=h.jsx(Qn,{size:"medium",centered:!0}),t[5]=y):y=t[5],y}if(i){let y;return t[6]!==i?(y=h.jsx(Xs,{error:i}),t[6]=i,t[7]=y):y=t[7],y}if(c.length===0){let y;return t[8]===Symbol.for("react.memo_cache_sentinel")?(y=h.jsx(In,{title:"No environment variables",description:"No environment variables are available in this notebook.",icon:h.jsx(Jc,{})}),t[8]=y):y=t[8],y}let f,p,_,g,m,b,x;return t[9]!==n||t[10]!==e||t[11]!==u||t[12]!==a?(f=()=>e(h.jsx(kg,{providerNames:u,onSuccess:()=>{a(),n()},onClose:n})),t[9]=n,t[10]=e,t[11]=u,t[12]=a,t[13]=f):f=t[13],t[14]===Symbol.for("react.memo_cache_sentinel")?(p=h.jsx(Lr,{className:"h-4 w-4"}),t[14]=p):p=t[14],t[15]!==f?(_=h.jsx("div",{className:"flex justify-end h-8 border-b",children:h.jsx("button",{type:"button",className:"float-right border-l px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:f,children:p})}),t[15]=f,t[16]=_):_=t[16],t[17]===Symbol.for("react.memo_cache_sentinel")?(g=h.jsx(qp,{children:h.jsxs(Ks,{children:[h.jsx(Fr,{children:"Environment Variable"}),h.jsx(Fr,{children:"Source"}),h.jsx(Fr,{})]})}),t[17]=g):g=t[17],t[18]!==c?(m=c.map(cF),t[18]=c,t[19]=m):m=t[19],t[20]!==m?(b=h.jsxs(Wp,{className:"overflow-auto flex-1 mb-16",children:[g,h.jsx(Gp,{children:m})]}),t[20]=m,t[21]=b):b=t[21],t[22]!==_||t[23]!==b?(x=h.jsxs("div",{className:"flex flex-col h-full",children:[_,b]}),t[22]=_,t[23]=b,t[24]=x):x=t[24],x},sF=t=>{const e=X.c(9),{className:n,ariaLabel:o,onCopy:r}=t,[s,i]=K.useState(!1);let a;e[0]!==r?(a=()=>{r(),i(!0),setTimeout(()=>i(!1),1e3)},e[0]=r,e[1]=a):a=e[1];const l=a;let c,d;return e[2]!==s?(c=s?h.jsx(_c,{className:"w-3 h-3 text-green-700 rounded"}):h.jsx(Ls,{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=h.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 iF(){return vg((await bS.request({})).secrets)}function aF(t){return t.provider!=="env"}function lF(t){return t.name}function cF(t){return t.keys.map(e=>h.jsxs(Ks,{className:"group",children:[h.jsx(zr,{children:e}),h.jsx(zr,{children:t.provider!=="env"&&h.jsx(L4,{variant:"outline",className:"select-none",children:t.name})}),h.jsx(zr,{children:h.jsx(sF,{ariaLabel:`Copy ${e}`,onCopy:async()=>{await yn(`os.environ["${e}"]`),lt({title:"Copied to clipboard",description:`os.environ["${e}"] has been copied to your clipboard.`})},className:Oe("float-right px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible")})})]},`${t.name}-${e}`))}const dF=K.lazy(()=>Dp(()=>import("./terminal-D8UdkD7U.js"),__vite__mapDeps([123,1,2,124]),import.meta.url)),uF=t=>{const e=X.c(120),{children:n}=t,{isSidebarOpen:o,isTerminalOpen:r,selectedPanel:s}=gc(),{setIsSidebarOpen:i,setIsTerminalOpen:a}=na(),l=K.useRef(null),c=K.useRef(null);let d,u,f,p,_;e[0]!==o?(d=()=>{if(!l.current)return;const ue=l.current.isCollapsed();o&&ue&&l.current.expand(),o||ue||l.current.collapse(),requestAnimationFrame(fF)},u=[o],e[0]=o,e[1]=d,e[2]=u):(d=e[1],u=e[2]),A.useEffect(d,u),e[3]!==r?(f=()=>{if(!c.current)return;const ue=c.current.isCollapsed();r&&ue&&c.current.expand(),r||ue||c.current.collapse(),requestAnimationFrame(mF)},p=[r],e[3]=r,e[4]=f,e[5]=p):(f=e[4],p=e[5]),A.useEffect(f,p),e[6]!==n?(_=h.jsx(Uc,{id:"app",className:"relative h-full",children:h.jsx(A.Suspense,{children:n})},"app"),e[6]=n,e[7]=_):_=e[7];const g=_,m=o?"resize-handle":"resize-handle-collapsed";let b,x;e[8]!==m?(b=Oe("border-border no-print z-10",m,"vertical"),e[8]=m,e[9]=b):b=e[9],e[10]!==b?(x=h.jsx(sS,{onDragging:iS,className:b}),e[10]=b,e[11]=x):x=e[11];const y=x,v=r?"resize-handle":"resize-handle-collapsed";let k,S;e[12]!==v?(k=Oe("border-border no-print z-20",v,"horizontal"),e[12]=v,e[13]=k):k=e[13],e[14]!==k?(S=h.jsx(sS,{onDragging:iS,className:k}),e[14]=k,e[15]=S):S=e[15];const E=S;let j,I,T,M,L,B,O,z,F,V,P,C,$,N,H,G,Z,q,re,ne,oe;e[16]!==s?(j=h.jsx("div",{className:"text-sm text-[var(--slate-11)] uppercase tracking-wide font-semibold flex-1",children:s}),e[16]=s,e[17]=j):j=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=h.jsx(go,{className:"w-4 h-4"}),e[20]=T):T=e[20],e[21]!==I?(M=h.jsx(Pe,{"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]!==j||e[24]!==M?(L=h.jsxs("div",{className:"p-3 border-b flex justify-between items-center",children:[j,M]}),e[23]=j,e[24]=M,e[25]=L):L=e[25],e[26]!==s?(B=s==="files"&&h.jsx(tR,{}),e[26]=s,e[27]=B):B=e[27],e[28]!==s?(O=s==="errors"&&h.jsx(Ax,{}),e[28]=s,e[29]=O):O=e[29],e[30]!==s?(z=s==="variables"&&h.jsx(k2,{}),e[30]=s,e[31]=z):z=e[31],e[32]!==s?(F=s==="dependencies"&&h.jsx(ED,{}),e[32]=s,e[33]=F):F=e[33],e[34]!==s?(V=s==="packages"&&h.jsx(ER,{}),e[34]=s,e[35]=V):V=e[35],e[36]!==s?(P=s==="outline"&&h.jsx(tO,{}),e[36]=s,e[37]=P):P=e[37],e[38]!==s?(C=s==="datasources"&&h.jsx(wR,{}),e[38]=s,e[39]=C):C=e[39],e[40]!==s?($=s==="documentation"&&h.jsx(OD,{}),e[40]=s,e[41]=$):$=e[41],e[42]!==s?(N=s==="snippets"&&h.jsx(iR,{}),e[42]=s,e[43]=N):N=e[43],e[44]!==s?(H=s==="scratchpad"&&h.jsx(jR,{}),e[44]=s,e[45]=H):H=e[45],e[46]!==s?(G=s==="chat"&&h.jsx(qL,{}),e[46]=s,e[47]=G):G=e[47],e[48]!==s?(Z=s==="logs"&&h.jsx(S2,{}),e[48]=s,e[49]=Z):Z=e[49],e[50]!==s?(q=s==="tracing"&&h.jsx(nF,{}),e[50]=s,e[51]=q):q=e[51],e[52]!==s?(re=s==="secrets"&&h.jsx(rF,{}),e[52]=s,e[53]=re):re=e[53],e[54]!==B||e[55]!==O||e[56]!==z||e[57]!==F||e[58]!==V||e[59]!==P||e[60]!==C||e[61]!==$||e[62]!==N||e[63]!==H||e[64]!==G||e[65]!==Z||e[66]!==q||e[67]!==re?(ne=h.jsx(A.Suspense,{children:h.jsxs(Lc,{children:[B,O,z,F,V,P,C,$,N,H,G,Z,q,re]})}),e[54]=B,e[55]=O,e[56]=z,e[57]=F,e[58]=V,e[59]=P,e[60]=C,e[61]=$,e[62]=N,e[63]=H,e[64]=G,e[65]=Z,e[66]=q,e[67]=re,e[68]=ne):ne=e[68],e[69]!==L||e[70]!==ne?(oe=h.jsx(wc,{children:h.jsxs("div",{className:"flex flex-col h-full flex-1 overflow-hidden mr-[-4px]",children:[L,ne]})}),e[69]=L,e[70]=ne,e[71]=oe):oe=e[71];const Y=oe,Q=o&&"border-r border-l border-[var(--slate-7)]";let ce,he,de,me,ie,Ce;e[72]!==Q?(ce=Oe("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",Q),e[72]=Q,e[73]=ce):ce=e[73],e[74]===Symbol.for("react.memo_cache_sentinel")?(he=(ue,je)=>{var ke;je===0&&ue===10&&((ke=l.current)==null||ke.resize(30))},e[74]=he):he=e[74],e[75]!==i?(de=()=>i(!1),me=()=>i(!0),e[75]=i,e[76]=de,e[77]=me):(de=e[76],me=e[77]),e[78]!==Y||e[79]!==y?(ie=h.jsxs("span",{className:"flex flex-row h-full",children:[Y," ",y]}),e[78]=Y,e[79]=y,e[80]=ie):ie=e[80],e[81]!==ce||e[82]!==de||e[83]!==me||e[84]!==ie?(Ce=h.jsx(Uc,{ref:l,id:"helper",collapsedSize:0,collapsible:!0,className:ce,minSize:10,defaultSize:0,maxSize:75,onResize:he,onCollapse:de,onExpand:me,children:ie},"helper"),e[81]=ce,e[82]=de,e[83]=me,e[84]=ie,e[85]=Ce):Ce=e[85];const we=Ce,ae=r&&"border-[var(--slate-7)]";let ve,ge,be,Te,ze,Xe,Fe,et;e[86]!==ae?(ve=Oe("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",ae),e[86]=ae,e[87]=ve):ve=e[87],e[88]===Symbol.for("react.memo_cache_sentinel")?(ge=(ue,je)=>{var ke;je===0&&ue===10&&((ke=c.current)==null||ke.resize(30))},e[88]=ge):ge=e[88],e[89]!==a?(be=()=>a(!1),Te=()=>a(!0),e[89]=a,e[90]=be,e[91]=Te):(be=e[90],Te=e[91]),e[92]!==a?(ze=()=>a(!1),e[92]=a,e[93]=ze):ze=e[93],e[94]!==r||e[95]!==ze?(Xe=h.jsx(dF,{visible:r,onClose:ze}),e[94]=r,e[95]=ze,e[96]=Xe):Xe=e[96],e[97]!==r||e[98]!==Xe?(Fe=h.jsx(vR,{isOpen:r,children:Xe}),e[97]=r,e[98]=Xe,e[99]=Fe):Fe=e[99],e[100]!==ve||e[101]!==be||e[102]!==Te||e[103]!==Fe||e[104]!==E?(et=h.jsxs(Uc,{ref:c,id:"terminal",collapsedSize:0,collapsible:!0,className:ve,minSize:10,defaultSize:0,maxSize:75,onResize:ge,onCollapse:be,onExpand:Te,children:[E,Fe]},"terminal"),e[100]=ve,e[101]=be,e[102]=Te,e[103]=Fe,e[104]=E,e[105]=et):et=e[105];const nt=et;let it,te,Ne,Me,Be,J,pe,_e;return e[106]===Symbol.for("react.memo_cache_sentinel")?(it=q$(),e[106]=it):it=e[106],e[107]===Symbol.for("react.memo_cache_sentinel")?(te=h.jsx(Lc,{children:h.jsx(JM,{})}),e[107]=te):te=e[107],e[108]!==nt?(Ne=h.jsx(jx,{capability:"terminal",children:nt}),e[108]=nt,e[109]=Ne):Ne=e[109],e[110]!==g||e[111]!==Ne?(Me=h.jsx(Uc,{children:h.jsxs(aS,{autoSaveId:"marimo:chrome:v1:l1",direction:"vertical",children:[g,Ne]})}),e[110]=g,e[111]=Ne,e[112]=Me):Me=e[112],e[113]===Symbol.for("react.memo_cache_sentinel")?(Be=h.jsx(t$,{}),e[113]=Be):Be=e[113],e[114]!==we||e[115]!==Me?(J=h.jsxs(aS,{autoSaveId:"marimo:chrome:v1:l2",direction:"horizontal",storage:it,children:[te,we,Me,Be]}),e[114]=we,e[115]=Me,e[116]=J):J=e[116],e[117]===Symbol.for("react.memo_cache_sentinel")?(pe=h.jsx(wc,{children:h.jsx(Lc,{children:h.jsx(HM,{})})}),e[117]=pe):pe=e[117],e[118]!==J?(_e=h.jsxs(G$,{children:[J,pe]}),e[118]=J,e[119]=_e):_e=e[119],_e};function hF(){window.dispatchEvent(new Event("resize"))}function fF(){requestAnimationFrame(hF)}function pF(){window.dispatchEvent(new Event("resize"))}function mF(){requestAnimationFrame(pF)}let m3;m3=new URL(window.location.href).searchParams.get(n$.showChrome)==="false",CS=Object.freeze(Object.defineProperty({__proto__:null,default:t=>{const e=X.c(10);if(m3){let s,i,a;return e[0]!==t?(s=h.jsx(Nx,{hideControls:!0,...t}),e[0]=t,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsx(eg,{}),e[2]=i):i=e[2],e[3]!==s?(a=h.jsxs(h.Fragment,{children:[s,i]}),e[3]=s,e[4]=a):a=e[4],a}let n,o,r;return e[5]!==t?(n=h.jsx(Nx,{...t}),e[5]=t,e[6]=n):n=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx(eg,{}),e[7]=o):o=e[7],e[8]!==n?(r=h.jsxs(uF,{children:[n,o]}),e[8]=n,e[9]=r):r=e[9],r}},Symbol.toStringTag,{value:"Module"}))});export{tm as C,$c as E,In as P,X$ as __tla,nm as a,CS as e,wa as f,om as u};