@marimo-team/frontend 0.9.24-dev2 → 0.9.24-dev4

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 (82) hide show
  1. package/dist/assets/{ConnectedDataExplorerComponent-gvG_ptHu.js → ConnectedDataExplorerComponent-CLia_F9A.js} +1 -1
  2. package/dist/assets/{VegaLite-VAliyUG0.js → VegaLite-B46DH2eL.js} +1 -1
  3. package/dist/assets/{_baseEach-By7GjPKT.js → _baseEach-CgWyw4y0.js} +1 -1
  4. package/dist/assets/_baseMap-uyabRAGc.js +1 -0
  5. package/dist/assets/{_baseUniq-CTx5Lbia.js → _baseUniq-Bi5N5Yzy.js} +1 -1
  6. package/dist/assets/{any-language-editor-B_x2FdqY.js → any-language-editor-BCHhqHKZ.js} +1 -1
  7. package/dist/assets/{architectureDiagram-IFBEXTG3-IiVJQgrK.js → architectureDiagram-IFBEXTG3-zc5_c3sj.js} +1 -1
  8. package/dist/assets/{blockDiagram-TCMKQVZ6-UuDjqI8l.js → blockDiagram-TCMKQVZ6-6cssJaQF.js} +1 -1
  9. package/dist/assets/{c4Diagram-ZCSEYPFN-jvgm4NL6.js → c4Diagram-ZCSEYPFN-D0K1uozC.js} +1 -1
  10. package/dist/assets/channel-DjuEWEWl.js +1 -0
  11. package/dist/assets/{chunk-4LC2V6XN-bhGghvnk.js → chunk-4LC2V6XN-Cjm0y9k8.js} +1 -1
  12. package/dist/assets/{chunk-5RIWM3LS-KonRQeIS.js → chunk-5RIWM3LS-DPRxUM6f.js} +1 -1
  13. package/dist/assets/{chunk-6JKP7OK7-BSZnGlXI.js → chunk-6JKP7OK7-JtpnKBB5.js} +1 -1
  14. package/dist/assets/{chunk-NGC4727B-ViksgIIX.js → chunk-NGC4727B-BSb-ujLV.js} +1 -1
  15. package/dist/assets/{chunk-REEJFE46-Bk6rikIt.js → chunk-REEJFE46-DVt5BOcC.js} +1 -1
  16. package/dist/assets/{chunk-RYO7GUH3-B4c9QlLH.js → chunk-RYO7GUH3-CaENbPi1.js} +1 -1
  17. package/dist/assets/{chunk-V35ELUW5-GXvgmvSe.js → chunk-V35ELUW5-4VDbh1Oe.js} +1 -1
  18. package/dist/assets/{classDiagram-Q73GJZWF-CdGJRyK-.js → classDiagram-Q73GJZWF-CxFhK4Sc.js} +1 -1
  19. package/dist/assets/{classDiagram-v2-C6QPLPW4-CABaGRKI.js → classDiagram-v2-C6QPLPW4-Yvpy7xIJ.js} +1 -1
  20. package/dist/assets/clone-DIsr-gZE.js +1 -0
  21. package/dist/assets/{dagre-7KT5K2WU-BbNHwUto.js → dagre-7KT5K2WU-B6EImbbY.js} +1 -1
  22. package/dist/assets/{data-editor-CjvP_WoL.js → data-editor-DGo8RYqS.js} +1 -1
  23. package/dist/assets/{diagram-AVGMFHF7-eh7PI21N.js → diagram-AVGMFHF7-rznbLoKZ.js} +1 -1
  24. package/dist/assets/edit-page-Bo19FVst.js +14 -0
  25. package/dist/assets/{erDiagram-DKC2X5TE-C3bEZzaq.js → erDiagram-DKC2X5TE-D0sZAZv8.js} +1 -1
  26. package/dist/assets/{flowDiagram-NWEUNK3L-21DclXSg.js → flowDiagram-NWEUNK3L-ChuRoQbb.js} +1 -1
  27. package/dist/assets/{ganttDiagram-HLVPPPRE-B2guFMfW.js → ganttDiagram-HLVPPPRE-D7yKuSAa.js} +1 -1
  28. package/dist/assets/{gitGraph-YCYPL57B-BSUz_lHw.js → gitGraph-YCYPL57B-B_8LFrsd.js} +1 -1
  29. package/dist/assets/{gitGraphDiagram-JPZ3KUXI-Cui8oVd0.js → gitGraphDiagram-JPZ3KUXI-CK_ROfYq.js} +1 -1
  30. package/dist/assets/{graph-BJrlcR8o.js → graph-vvrJliTu.js} +1 -1
  31. package/dist/assets/{home-page-CaN-lhtl.js → home-page-PElPHd8x.js} +1 -1
  32. package/dist/assets/{index-DxZasjiV.js → index-4n7uEtvJ.js} +1 -1
  33. package/dist/assets/{index-BWFFHSbm.js → index-BMRNptuQ.js} +1 -1
  34. package/dist/assets/{index-BZ7LaHXw.js → index-BTRDKSPt.js} +1 -1
  35. package/dist/assets/{index-DvWoMn6H.js → index-BqwS-nTq.js} +1 -1
  36. package/dist/assets/{index-CHnsLmvs.js → index-Bx_AD2M7.js} +1 -1
  37. package/dist/assets/{index-CneuY1PS.js → index-CfuSgB0w.js} +1 -1
  38. package/dist/assets/{index-DkbamP0k.js → index-Ck0H7hT5.js} +1 -1
  39. package/dist/assets/{index-DR4PUr24.js → index-Cm6vfB41.js} +1 -1
  40. package/dist/assets/{index-DIulF_uO.js → index-CtupZXK3.js} +1 -1
  41. package/dist/assets/{index-6Zvy9-Zv.js → index-DNtiTpQV.js} +9 -9
  42. package/dist/assets/{index-D8WxEAxR.js → index-DW82zmWJ.js} +1 -1
  43. package/dist/assets/{index-wN867m6B.js → index-Dbqfd5DT.js} +1 -1
  44. package/dist/assets/{index-DlGJO6ot.js → index-DbyMSW8a.js} +1 -1
  45. package/dist/assets/{index-BKAZy2WF.js → index-DoQ2RVzU.js} +1 -1
  46. package/dist/assets/{index-B5RWIbA9.js → index-_uXdftCa.js} +1 -1
  47. package/dist/assets/{index-CFB_Svy6.js → index-mN7mRuHJ.js} +1 -1
  48. package/dist/assets/{index-Ci2UGbm-.js → index-q4PqzyEM.js} +1 -1
  49. package/dist/assets/{infoDiagram-RZZSJVI2-BgqHbHaP.js → infoDiagram-RZZSJVI2-DMFKn3f7.js} +1 -1
  50. package/dist/assets/{journeyDiagram-BLD6N6MZ-z5dGBj-m.js → journeyDiagram-BLD6N6MZ-DZH_TdoV.js} +1 -1
  51. package/dist/assets/{json-CxeVIpnf.js → json-BFAfJfgF.js} +1 -1
  52. package/dist/assets/{layout-BVAaAC2q.js → layout-zXPbDOQb.js} +1 -1
  53. package/dist/assets/{linear-B30tLBNa.js → linear-q2-qqo4X.js} +1 -1
  54. package/dist/assets/{mermaid-ugyWhs8A.js → mermaid-Dyiw1PCl.js} +3 -3
  55. package/dist/assets/{min-m9MPXOdZ.js → min-CuRCym14.js} +1 -1
  56. package/dist/assets/{mindmap-definition-OEB2RXX2-C1vcH_AV.js → mindmap-definition-OEB2RXX2-C8ZGlLyq.js} +1 -1
  57. package/dist/assets/{pieDiagram-X7YZ5ZEZ-9KU51XKt.js → pieDiagram-X7YZ5ZEZ-_bBkRSkz.js} +1 -1
  58. package/dist/assets/{quadrantDiagram-F36EZAVT-CEEzhWuH.js → quadrantDiagram-F36EZAVT-IcbMGopg.js} +1 -1
  59. package/dist/assets/{react-plotly-BdOtjaEC.js → react-plotly-Dizv5a5L.js} +1 -1
  60. package/dist/assets/{requirementDiagram-JG2LMPGF-Fe2wTdtw.js → requirementDiagram-JG2LMPGF-68mKNqpi.js} +1 -1
  61. package/dist/assets/{run-page-B-B2HuzH.js → run-page-oI5LQFEQ.js} +1 -1
  62. package/dist/assets/{sankeyDiagram-ATFNWWW6-C4nazkWA.js → sankeyDiagram-ATFNWWW6-DppZ3-9J.js} +1 -1
  63. package/dist/assets/{sequenceDiagram-WK7YDQ3N-DxxB8afB.js → sequenceDiagram-WK7YDQ3N-CHssBZGD.js} +1 -1
  64. package/dist/assets/{slides-component-CCBjhtyC.js → slides-component-qthAmai8.js} +1 -1
  65. package/dist/assets/{sortBy-Bkv30UAB.js → sortBy-DgVI0emz.js} +1 -1
  66. package/dist/assets/{stateDiagram-4JV6CC6H-Du5IFlQI.js → stateDiagram-4JV6CC6H-DLR_Y9XC.js} +1 -1
  67. package/dist/assets/stateDiagram-v2-7KT6RKTD-FR7rJWcr.js +1 -0
  68. package/dist/assets/{terminal-DPZQKLNq.js → terminal-CtWgl8M5.js} +1 -1
  69. package/dist/assets/{time-DdTiDGKL.js → time-D185ZFOF.js} +1 -1
  70. package/dist/assets/{timeline-definition-3ZMEY6HS-DiJf8vd8.js → timeline-definition-3ZMEY6HS-D13TM0kk.js} +1 -1
  71. package/dist/assets/{transform-Dqi1zzPr.js → transform-CnzFMpbA.js} +1 -1
  72. package/dist/assets/{tree-6yHcWndz.js → tree-YeA4gu-a.js} +1 -1
  73. package/dist/assets/{useMarimoWebSocket-BZh7ReXE.js → useMarimoWebSocket-DgfFxWuu.js} +3 -3
  74. package/dist/assets/{vega-component-pSMdC9-v.js → vega-component-C900usq1.js} +1 -1
  75. package/dist/assets/{xychartDiagram-KECQ2H5Q-PXQ4LOtx.js → xychartDiagram-KECQ2H5Q-CRx2oFSi.js} +1 -1
  76. package/dist/index.html +1 -1
  77. package/package.json +1 -1
  78. package/dist/assets/_baseMap-PVELY_EB.js +0 -1
  79. package/dist/assets/channel-Clt0aLcn.js +0 -1
  80. package/dist/assets/clone-b7v1GffU.js +0 -1
  81. package/dist/assets/edit-page-DEIjHQNw.js +0 -14
  82. package/dist/assets/stateDiagram-v2-7KT6RKTD-BWwu0hQA.js +0 -1
@@ -0,0 +1,14 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-q4PqzyEM.js","./VegaLite-B46DH2eL.js","./index-DNtiTpQV.js","./index-CwO3Nrt7.css","./time-D185ZFOF.js","./timer-CK-RIWfW.js","./linear-q2-qqo4X.js","./init-DLRA0X12.js","./range-CtcPcB_L.js","./zoom-COrs4lFh.js","./ordinal-DDUp3AbE.js","./colors-bszWmPJw.js","./arc-lt4NHaVr.js","./step-CNn2V7Th.js","./index-Ck0H7hT5.js","./terminal-CtWgl8M5.js","./terminal-DMtZkNnb.css"])))=>i.map(i=>d[i]);
2
+ var e,t=Object.defineProperty,n=(e,n,o)=>((e,n,o)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[n]=o)(e,"symbol"!=typeof n?n+"":n,o);import{b1 as o,G as r,fq as a,fr as s,fs as i,ft as l,fu as c,fv as d,R as u,fw as h,D as m,bz as f,K as p,fx as g,at as v,W as x,a2 as y,Z as b,_ as w,fy as k,X as N,e8 as E,fz as C,cV as S,dm as j,ej as _,ek as I,el as A,en as M,eh as T,ei as O,em as D,fA as P,fB as R,dq as F,du as L,al as z,F as B,fC as U,eE as V,fD as $,ar as G,dY as H,ce as W,fE as q,ds as Y,fF as K,fG as J,a0 as X,fH as Z,dw as Q,fI as ee,H as te,ba as ne,fJ as oe,fK as re,fL as ae,dj as se,fM as ie,dn as le,fN as ce,fO as de,fP as ue,cU as he,fQ as me,bB as fe,fR as pe,fS as ge,bc as ve,fT as xe,fU as ye,fV as be,Y as we,br as ke,fW as Ne,a6 as Ee,dk as Ce,fg as Se,eR as je,fj as _e,b7 as Ie,eS as Ae,as as Me,fX as Te,fY as Oe,fZ as De,eT as Pe,f_ as Re,f$ as Fe,eX as Le,g0 as ze,g1 as Be,g2 as Ue,g3 as Ve,d9 as $e,g4 as Ge,bp as He,$ as We,ap as qe,a1 as Ye,bF as Ke,g5 as Je,dX as Xe,g6 as Ze,c$ as Qe,dr as et,ep as tt,bA as nt,g7 as ot,g8 as rt,df as at,g9 as st,ga as it,bv as lt,gb as ct,gc as dt,gd as ut,ge as ht,gf as mt,gg as ft,T as pt,a3 as gt,gh as vt,da as xt,bC as yt,eW as bt,cW as wt,gi as kt,fk as Nt,gj as Et,bk as Ct,bD as St,gk as jt,gl as _t,gm as It,gn as At,dp as Mt,bf as Tt,bg as Ot,go as Dt,dM as Pt,d7 as Rt,gp as Ft,eD as Lt,k as zt,j as Bt,gq as Ut,gr as Vt,gs as $t,ez as Gt,gt as Ht,gu as Wt,c_ as qt,gv as Yt,gw as Kt,a7 as Jt,b2 as Xt,aj as Zt,bb as Qt,gx as en,bu as tn,gy as nn,fn as on,fm as rn,gz as an,eH as sn,gA as ln,gB as cn,eO as dn,gC as un,ey as hn,gD as mn,gE as fn,gF as pn,gG as gn,gH as vn,gI as xn,m as yn,gJ as bn,gK as wn,gL as kn,t as Nn,gM as En,gN as Cn,gO as Sn,gP as jn,gQ as _n,gR as In,gS as An,gT as Mn,gU as Tn,gV as On,gW as Dn,gX as Pn,gY as Rn,gZ as Fn,g_ as Ln,g$ as zn,h0 as Bn,h1 as Un,h2 as Vn,h3 as $n,h4 as Gn,h5 as Hn,h6 as Wn,h7 as qn,h8 as Yn,h9 as Kn,ha as Jn,hb as Xn,hc as Zn,hd as Qn,he as eo,hf as to,hg as no,hh as oo,hi as ro,fo as ao,hj as so,hk as io,hl as lo,hm as co,hn as uo,ho,hp as mo,hq as fo,hr as po,hs as go,ht as vo,hu as xo,hv as yo,hw as bo,dy as wo,hx as ko,hy as No,dB as Eo,hz as Co,hA as So,hB as jo,hC as _o,hD as Io,hE as Ao,hF as Mo,a8 as To,dg as Oo,hG as Do,dF as Po,hH as Ro,hI as Fo,hJ as Lo,hK as zo,hL as Bo,hM as Uo,hN as Vo,hO as $o,hP as Go,hQ as Ho,a4 as Wo,hR as qo,hS as Yo,dV as Ko,hT as Jo,hU as Xo,hV as Zo,hW as Qo,hX as er,hY as tr,hZ as nr,h_ as or,h$ as rr,i0 as ar,i1 as sr,i2 as ir,i3 as lr,i4 as cr,i5 as dr,fl as ur,i6 as hr,i7 as mr,i8 as fr,bo as pr,eM as gr,i9 as vr,ia as xr,ib as yr,ic as br,id as wr,ie as kr,ig as Nr,eB as Er,ih as Cr,bj as Sr,ii as jr,bU as _r,b3 as Ir,ah as Ar,dW as Mr,ij as Tr,cS as Or,b8 as Dr,ik as Pr,dP as Rr,bZ as Fr,il as Lr,bq as zr,im as Br,io as Ur,ip as Vr,iq as $r,ir as Gr,is as Hr,it as Wr,iu as qr,iv as Yr,bs as Kr,bd as Jr,iw as Xr,ix as Zr,de as Qr,iy as ea,iz as ta,iA as na,iB as oa,iC as ra,cX as aa,et as sa,di as ia,iD as la,bn as ca,iE as da,ea as ua,e_ as ha,e$ as ma,f0 as fa,f4 as pa,f2 as ga,f5 as va,f7 as xa,fa as ya,fd as ba,f8 as wa,iF as ka,iG as Na,dN as Ea,iH as Ca,e6 as Sa,iI as ja,fb as _a,iJ as Ia,iK as Aa,iL as Ma,iM as Ta,J as Oa,dt as Da,iN as Pa,iO as Ra,iP as Fa,M as La,iQ as za,iR as Ba,O as Ua,iS as Va,dl as $a,iT as Ga,iU as Ha,P as Wa,iV as qa,ex as Ya,b9 as Ka,iW as Ja,iX as Xa,iY as Za,fc as Qa,iZ as es,dU as ts,i_ as ns,i$ as os,dd as rs,j0 as as,j1 as ss,j2 as is,j3 as ls,es as cs,j4 as ds,j5 as us,dx as hs,j6 as ms,j7 as fs,j8 as ps,j9 as gs,ja as vs,jb as xs,jc as ys,jd as bs,je as ws,jf as ks,jg as Ns,jh as Es,ji as Cs,jj as Ss,jk as js,d2 as _s,jl as Is,jm as As,jn as Ms,jo as Ts,jp as Os,aq as Ds,bw as Ps,jq as Rs,jr as Fs,js as Ls,jt as zs,ju as Bs,jv as Us,jw as Vs,jx as $s,jy as Gs,jz as Hs,jA as Ws,jB as qs,jC as Ys,eG as Ks,jD as Js,jE as Xs,jF as Zs,jG as Qs,jH as ei,e5 as ti,cN as ni,jI as oi,b6 as ri,jJ as ai,jK as si,jL as ii,au as li,jM as ci,jN as di,jO as ui}from"./index-DNtiTpQV.js";import{a as hi,B as mi,G as fi,g as pi,M as gi,b as vi,c as xi,d as yi,s as bi,k as wi,C as ki,S as Ni,K as Ei,e as Ci,f as Si,i as ji,h as _i,j as Ii,L as Ai,l as Mi,m as Ti,n as Oi,u as Di,o as Pi,p as Ri,q as Fi,P as Li,r as zi,t as Bi,T as Ui}from"./tree-YeA4gu-a.js";import{b as Vi,c as $i,L as Gi,I as Hi,N as Wi,V as qi,d as Yi,W as Ki,F as Ji,e as Xi,M as Zi,E as Qi,f as el,g as tl,h as nl,i as ol,j as rl,k as al,l as sl,m as il,n as ll,o as cl,u as dl,C as ul,R as hl,p as ml,a as fl,A as pl,q as gl,r as vl,O as xl,T as yl}from"./useMarimoWebSocket-DgfFxWuu.js";import{s as bl,i as wl,T as kl,c as Nl}from"./transform-CnzFMpbA.js";import{g as El}from"./timer-CK-RIWfW.js";import{i as Cl}from"./zoom-COrs4lFh.js";import{s as Sl}from"./sortBy-DgVI0emz.js";import"./main-cdvIQCIX.js";import"./index-Ck0H7hT5.js";import"./_baseEach-CgWyw4y0.js";import"./_baseMap-uyabRAGc.js";
3
+ /**
4
+ * @license lucide-react v0.428.0 - ISC
5
+ *
6
+ * This source code is licensed under the ISC license.
7
+ * See the LICENSE file in the root directory of this source tree.
8
+ */const jl=o("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),_l=o("ArrowRightFromLine",[["path",{d:"M3 5v14",key:"1nt18q"}],["path",{d:"M21 12H7",key:"13ipq5"}],["path",{d:"m15 18 6-6-6-6",key:"6tx3qv"}]]),Il=o("ArrowRightToLine",[["path",{d:"M17 12H3",key:"8awo09"}],["path",{d:"m11 18 6-6-6-6",key:"8c2y43"}],["path",{d:"M21 5v14",key:"nzette"}]]),Al=o("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),Ml=o("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]),Tl=o("BetweenHorizontalStart",[["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"}]]),Ol=o("BookMarked",[["path",{d:"M10 2v8l3-3 3 3V2",key:"sqw3rj"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]),Dl=o("Box",[["path",{d:"M21 8a2 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 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]),Pl=o("ChevronsDown",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),Rl=o("ChevronsUp",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),Fl=o("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),Ll=o("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),zl=o("ClipboardCopy",[["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"}]]),Bl=o("ClipboardPaste",[["path",{d:"M15 2H9a1 1 0 0 0-1 1v2c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V3c0-.6-.4-1-1-1Z",key:"1pp7kr"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2M16 4h2a2 2 0 0 1 2 2v2M11 14h10",key:"2ik1ml"}],["path",{d:"m17 10 4 4-4 4",key:"vp2hj1"}]]),Ul=o("CloudDownload",[["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"}]]),Vl=o("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]),$l=o("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"}]]),Gl=o("CopyMinus",[["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"}]]),Hl=o("EllipsisVertical",[["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"}]]),Wl=o("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"}]]),ql=o("FilePen",[["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"}]]),Yl=o("FilePlus2",[["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"}]]),Kl=o("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"}]]),Jl=o("FolderPlus",[["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"}]]),Xl=o("FolderTree",[["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"}]]),Zl=o("GripVertical",[["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"}]]),Ql=o("HardDriveDownload",[["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"}]]),ec=o("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"}]]),tc=o("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"}]]),nc=o("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"}]]),oc=o("LayoutTemplate",[["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"}]]),rc=o("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]),ac=o("List",[["line",{x1:"8",x2:"21",y1:"6",y2:"6",key:"7ey8pc"}],["line",{x1:"8",x2:"21",y1:"12",y2:"12",key:"rjfblc"}],["line",{x1:"8",x2:"21",y1:"18",y2:"18",key:"c3b1m8"}],["line",{x1:"3",x2:"3.01",y1:"6",y2:"6",key:"1g7gq3"}],["line",{x1:"3",x2:"3.01",y1:"12",y2:"12",key:"1pjlvk"}],["line",{x1:"3",x2:"3.01",y1:"18",y2:"18",key:"28t2mc"}]]),sc=o("MapPin",[["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"}]]),ic=o("MemoryStick",[["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"}]]),lc=o("MessageCircleQuestion",[["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"}]]),cc=o("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"}]]),dc=o("NotebookPen",[["path",{d:"M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4",key:"re6nr2"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M21.378 5.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:"pqwjuv"}]]),uc=o("OctagonAlert",[["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"}]]),hc=o("PackageCheck",[["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"}]]),mc=o("PackageX",[["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"}]]),fc=o("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),pc=o("PartyPopper",[["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"}]]),gc=o("PenLine",[["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"}]]),vc=o("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]),xc=o("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"}]]),yc=o("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"}]]),bc=o("RotateCcw",[["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"}]]),wc=o("Rows3",[["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"}]]),kc=o("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"}]]),Nc=o("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"}]]),Ec=o("ScrollText",[["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"}]]),Cc=o("Share2",[["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"}]]),Sc=o("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]),jc=o("SquareCode",[["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"}]]),_c=o("SquareDashedBottomCode",[["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"}]]),Ic=o("SquareEqual",[["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"}]]),Ac=o("SquareM",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8l4 4 4-4v8",key:"141u4e"}]]),Mc=o("SquarePlay",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m9 8 6 4-6 4Z",key:"f1r3lt"}]]),Tc=o("SquarePlus",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),Oc=o("SquarePower",[["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"}]]),Dc=o("SquareTerminal",[["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"}]]),Pc=o("TextCursorInput",[["path",{d:"M5 4h1a3 3 0 0 1 3 3 3 3 0 0 1 3-3h1",key:"18xjzo"}],["path",{d:"M13 20h-1a3 3 0 0 1-3-3 3 3 0 0 1-3 3H5",key:"fj48gi"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M9 7v10",key:"1vc8ob"}]]),Rc=o("TextSearch",[["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"}]]),Fc=o("Undo2",[["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"}]]),Lc=o("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"}]]),zc=o("WholeWord",[["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"}]]),Bc=o("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"}]]),Uc=o("ZapOff",[["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"}]]),Vc=o("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"}]]);
9
+ /**
10
+ * @license lucide-react v0.428.0 - ISC
11
+ *
12
+ * This source code is licensed under the ISC license.
13
+ * See the LICENSE file in the root directory of this source tree.
14
+ */const $c=r.createContext({});function Gc(e,t){[e,t]=l(e,t,$c);let{toolbarProps:n}=function(e,t){const{"aria-label":n,"aria-labelledby":o,orientation:l="horizontal"}=e;let[c,d]=r.useState(!1);a((()=>{var e;d(!(!t.current||!(null===(e=t.current.parentElement)||void 0===e?void 0:e.closest('[role="toolbar"]'))))}));const{direction:u}=s(),h="rtl"===u&&"horizontal"===l;let m=i(t);const f=r.useRef(null);return{toolbarProps:{role:c?"group":"toolbar","aria-orientation":l,"aria-label":n,"aria-labelledby":null==n?o:void 0,onKeyDownCapture:c?void 0:e=>{if(e.currentTarget.contains(e.target)){if("horizontal"===l&&"ArrowRight"===e.key||"vertical"===l&&"ArrowDown"===e.key)h?m.focusPrevious():m.focusNext();else{if(!("horizontal"===l&&"ArrowLeft"===e.key||"vertical"===l&&"ArrowUp"===e.key))return"Tab"===e.key?(e.stopPropagation(),f.current=document.activeElement,void(e.shiftKey?m.focusFirst():m.focusLast())):void 0;h?m.focusNext():m.focusPrevious()}e.stopPropagation(),e.preventDefault()}},onFocusCapture:c?void 0:e=>{var n,o;f.current&&!e.currentTarget.contains(e.relatedTarget)&&(null===(n=t.current)||void 0===n?void 0:n.contains(e.target))&&(null===(o=f.current)||void 0===o||o.focus(),f.current=null)},onBlurCapture:c?void 0:e=>{e.currentTarget.contains(e.relatedTarget)||f.current||(f.current=e.target)}}}}(e,t),o=c({...e,values:{orientation:e.orientation||"horizontal"},defaultClassName:"react-aria-Toolbar"}),m=d(e);return delete m.id,u.createElement("div",{...h(n,m),...o,ref:t,slot:e.slot||void 0,"data-orientation":e.orientation||"horizontal"},o.children)}const Hc=r.forwardRef(Gc),Wc=e=>{const t=m(35);let n;t[0]!==e?(n=()=>{y(new Blob([e.getCellsAsJSON()],{type:"text/plain"}),`${e.proposedName}.json`)},t[0]=e,t[1]=n):n=t[1];const o=n;let r,a,s,i,l,c,d,u,h,f,g,v,E,C,S,j,_;return t[2]!==o||t[3]!==e?(r=t=>{t.preventDefault(),o(),e.closeModal()},t[2]=o,t[3]=e,t[4]=r):r=t[4],t[5]!==e?(a=t=>{"Escape"===t.key&&e.closeModal()},t[5]=e,t[6]=a):a=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(s=p.jsx(b,{className:"text-accent mb-6",children:"Download unsaved changes?"}),t[7]=s):s=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(i={wordBreak:"break-word"},l=p.jsx("p",{children:"This app has unsaved changes. To recover:"}),c={paddingBottom:"10px"},t[8]=i,t[9]=l,t[10]=c):(i=t[8],l=t[9],c=t[10]),t[11]!==e.proposedName?(d=p.jsxs("li",{style:c,children:['Click the "Download" button. This will download a file called ',p.jsxs("code",{children:[e.proposedName,".json"]}),". This file contains your code."]}),t[11]=e.proposedName,t[12]=d):d=t[12],t[13]===Symbol.for("react.memo_cache_sentinel")?(u={paddingBottom:"10px"},t[13]=u):u=t[13],t[14]===Symbol.for("react.memo_cache_sentinel")?(h={display:"block",padding:"10px"},t[14]=h):h=t[14],t[15]!==e.proposedName?(f=p.jsxs("code",{style:h,children:["marimo recover ",e.proposedName,".json ",">"," ",e.proposedName,".py"]}),t[15]=e.proposedName,t[16]=f):f=t[16],t[17]!==e.proposedName?(g=p.jsxs("code",{children:[e.proposedName,".py"]}),t[17]=e.proposedName,t[18]=g):g=t[18],t[19]!==f||t[20]!==g?(v=p.jsxs("li",{style:u,children:["In your terminal, type",f,"to overwrite ",g," with the recovered changes."]}),t[19]=f,t[20]=g,t[21]=v):v=t[21],t[22]!==d||t[23]!==v?(E=p.jsxs(w,{className:"markdown break-words",style:i,children:[l,p.jsxs("ol",{children:[d,v]})]}),t[22]=d,t[23]=v,t[24]=E):E=t[24],t[25]!==e.closeModal?(C=p.jsx(x,{"aria-label":"Cancel",variant:"secondary","data-testid":"cancel-recovery-button",onClick:e.closeModal,children:"Cancel"}),t[25]=e.closeModal,t[26]=C):C=t[26],t[27]===Symbol.for("react.memo_cache_sentinel")?(S=p.jsx(x,{"data-testid":"download-recovery-button","aria-label":"Download",variant:"default",type:"submit",children:"Download"}),t[27]=S):S=t[27],t[28]!==C?(j=p.jsxs(k,{children:[C,S]}),t[28]=C,t[29]=j):j=t[29],t[30]!==r||t[31]!==a||t[32]!==E||t[33]!==j?(_=p.jsx(N,{className:"w-fit",children:p.jsxs("form",{onSubmit:r,onKeyDown:a,children:[s,E,j]})}),t[30]=r,t[31]=a,t[32]=E,t[33]=j,t[34]=_):_=t[34],_},qc=e=>{const t=m(13),{filename:n,needsSave:o,getCellsAsJSON:r}=e,{openModal:a,closeModal:s}=f();let i;t[0]!==n?(i=null===n?"app":n.slice(0,-3),t[0]=n,t[1]=i):i=t[1];const l=i;let c;t[2]!==o||t[3]!==a||t[4]!==r||t[5]!==l||t[6]!==s?(c=()=>{o&&a(p.jsx(Wc,{getCellsAsJSON:r,proposedName:l,closeModal:s}))},t[2]=o,t[3]=a,t[4]=r,t[5]=l,t[6]=s,t[7]=c):c=t[7];const d=c;let u;hi("global.save",d),t[8]===Symbol.for("react.memo_cache_sentinel")?(u=g("global.save"),t[8]=u):u=t[8];const h=o?"yellow":"gray";let x,y;return t[9]===Symbol.for("react.memo_cache_sentinel")?(x=p.jsx(kc,{strokeWidth:1.5,size:18}),t[9]=x):x=t[9],t[10]!==d||t[11]!==h?(y=p.jsx(v,{content:u,children:p.jsx(mi,{onClick:d,id:"save-button","aria-label":"Save",className:"rectangle",color:h,children:x})}),t[10]=d,t[11]=h,t[12]=y):y=t[12],y},Yc=()=>{const e=m(7),{selectedLayout:t}=Vi(),{setLayoutView:n}=$i();if(j()&&!pi("wasm_layouts"))return null;let o,r,a,s;return e[0]!==n?(o=e=>n(e),e[0]=n,e[1]=o):o=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(r=p.jsx(T,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:p.jsx(O,{placeholder:"Select a view"})}),e[2]=r):r=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(a=p.jsx(_,{children:p.jsxs(I,{children:[p.jsx(A,{children:"View as"}),Gi.map(Zc)]})}),e[3]=a):a=e[3],e[4]!==t||e[5]!==o?(s=p.jsxs(D,{"data-testid":"layout-select",value:t,onValueChange:o,children:[r,a]}),e[4]=t,e[5]=o,e[6]=s):s=e[6],s};function Kc(e){const t=Jc(e);return p.jsx(t,{className:"h-4 w-4"})}function Jc(e){switch(e){case"vertical":return ac;case"grid":return fi;case"slides":return xc;default:return E(e),C}}function Xc(e){return S(e)}function Zc(e){return p.jsx(M,{value:e,children:p.jsxs("div",{className:"flex items-center gap-1.5 leading-5",children:[Kc(e),p.jsx("span",{children:Xc(e)})]})},e)}function Qc(){const e=m(7);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=[],e[0]=t):t=e[0];const[n,o]=function(e,t){const n=m(10);let o;n[0]!==e||n[1]!==t?(o=new P(e,t),n[0]=e,n[1]=t,n[2]=o):o=n[2];const a=o;let s;n[3]!==a?(s=()=>a.get(),n[3]=a,n[4]=s):s=n[4];const[i,l]=r.useState(s);let c;n[5]!==a?(c=e=>{l(e),a.set(e)},n[5]=a,n[6]=c):c=n[6];const d=c;let u;return n[7]!==i||n[8]!==d?(u=[i,d],n[7]=i,n[8]=d,n[9]=u):u=n[9],u}("marimo:commands",t);let a,s;return e[1]!==n||e[2]!==o?(a=e=>{const t=(r=[e,...n],[...new Set(r)]);var r;o(t.slice(0,3))},e[1]=n,e[2]=o,e[3]=a):a=e[3],e[4]!==n||e[5]!==a?(s={recentCommands:n,addRecentCommand:a},e[4]=n,e[5]=a,e[6]=s):s=e[6],s}function ed(e){return void 0!==e.dropdown}function td(e,t=""){return e.flatMap((e=>e.label?ed(e)?td(e.dropdown,`${t+e.label} > `):{...e,label:t+e.label}:[]))}const nd=e=>{const t=m(8),{children:n,layerTop:o}=e,r=void 0!==o&&o;let a;t[0]!==n?(a=u.Children.toArray(n),t[0]=n,t[1]=a):a=t[1];const[s,i]=a,l=`second-icon absolute ${r?"top-[-2px] left-[-2px]":"bottom-[-2px] right-[-2px]"} rounded-full`;let c,d;return t[2]!==l||t[3]!==i?(c=p.jsx("div",{className:l,children:i}),t[2]=l,t[3]=i,t[4]=c):c=t[4],t[5]!==s||t[6]!==c?(d=p.jsxs("div",{className:"multi-icon relative w-fit",children:[s,c]}),t[5]=s,t[6]=c,t[7]=d):d=t[7],d};function od(){const e=m(3),t=L(),{prepareForRun:n}=B();let o;e[0]!==t||e[1]!==n?(o=async e=>{if(0===e.length)return;const{cellHandles:o,cellData:r}=t,a=[];for(const t of e){const e=o[t];e.current?(a.push(V(e.current.editorView)),e.current.registerRun()):(n({cellId:t}),a.push(r[t].code))}await $({cellIds:e,codes:a}).catch((e=>{G.error(e)}))},e[0]=t,e[1]=n,e[2]=o):o=e[2];return z(o)}const rd=H(null),ad=H(!1),sd=e=>{const t=m(7);let n,o;t[0]!==e.onClick?(n=t=>{var n;(t.ctrlKey||t.metaKey)&&"z"===t.key&&(t.preventDefault(),t.stopPropagation(),null==(n=e.onClick)||n.call(e,t))},t[0]=e.onClick,t[1]=n):n=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(o={capture:!0},t[2]=o):o=t[2],W(window,"keydown",n,o);const r=e.children??"Undo";let a,s;return t[3]===Symbol.for("react.memo_cache_sentinel")?(a=p.jsx(q,{className:"ml-2",shortcut:"cmd-z"}),t[3]=a):a=t[3],t[4]!==e||t[5]!==r?(s=p.jsxs(x,{"data-testid":"undo-button",size:"sm",variant:"outline",...e,children:[r," ",a]}),t[4]=e,t[5]=r,t[6]=s):s=t[6],s};function id(){const e=m(3),{deleteCell:t,undoDeleteCell:n}=B();let o;return e[0]!==t||e[1]!==n?(o=e=>{if(Y.get(K))return;const{cellId:o}=e;t({cellId:o}),J({cellId:o}).catch((()=>{n()}));const{dismiss:r}=X({title:"Cell deleted",description:"You can bring it back by clicking undo or through the command palette.",action:p.jsx(sd,{"data-testid":"undo-delete-button",onClick:()=>{n(),a()}})}),a=r},e[0]=t,e[1]=n,e[2]=o):o=e[2],z(o)}function ld(e,t,n,o=Y){if(t in o.get(Z))return!1;const{cellData:r,cellIds:a}=o.get(Q),s=new RegExp(`import[ \t]+${e}[ \t]+as[ \t]+${t}`,"g");for(const i of a.inOrderIds)if(s.test(r[i].code))return!1;return n(`import ${e} as ${t}`),!0}function cd(e,t,n){return ld("marimo","mo",(o=>{const r=ee.create();t({cellId:n??"__end__",before:!1,code:o,lastCodeRun:e?o:void 0,newCellId:r,autoFocus:!1}),e&&$({cellIds:[r],codes:[o]})}))}function dd(e){const t=m(51),{cell:n}=e,{createNewCell:o,updateCellConfig:r,updateCellCode:a,updateCellName:s,moveCell:i,sendToTop:l,sendToBottom:c,addColumnBreakpoint:d}=B(),u=function(e){const t=m(3),n=od();let o;return t[0]!==e||t[1]!==n?(o=()=>{void 0!==e&&n([e])},t[0]=e,t[1]=n,t[2]=o):o=t[2],z(o)}(null==n?void 0:n.cellId),h=!te(K),g=id(),{openModal:v}=f(),x=ne(rd),y=te(oe),w=te(re),k=ae(),E=te(se),C=te(ie);if(!n||E){let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0],e}const{cellId:S,config:j,getEditorView:_,name:I,hasOutput:A,status:M}=n;let T;t[1]!==k.inOrderIds||t[2]!==S?(T=k.inOrderIds.indexOf(S),t[1]=k.inOrderIds,t[2]=S,t[3]=T):T=t[3];const O=T;let D;t[4]!==j.disabled||t[5]!==S||t[6]!==r?(D=async()=>{const e={disabled:!j.disabled};await be({configs:{[S]:e}}),r({cellId:S,config:e})},t[4]=j.disabled,t[5]=S,t[6]=r,t[7]=D):D=t[7];const P=D;let L;t[8]!==j.hide_code||t[9]!==S||t[10]!==r||t[11]!==_?(L=async()=>{const e={hide_code:!j.hide_code};await be({configs:{[S]:e}}),r({cellId:S,config:e});const t=_();t&&(e.hide_code?t.contentDOM.blur():t.focus())},t[8]=j.hide_code,t[9]=S,t[10]=r,t[11]=_,t[12]=L):L=t[12];const U=L;let V,$;t[13]===Symbol.for("react.memo_cache_sentinel")?(V=p.jsx(Pc,{size:13,strokeWidth:1.5}),t[13]=V):V=t[13],t[14]!==v||t[15]!==O||t[16]!==I||t[17]!==s||t[18]!==S?($=()=>{v(p.jsxs(N,{children:[p.jsx(we,{children:p.jsx(b,{children:"Rename cell"})}),p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx(ke,{htmlFor:"cell-name",children:"Cell name"}),p.jsx(Wi,{placeholder:`cell_${O}`,value:I,onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),e.stopPropagation(),v(null))},onChange:e=>s({cellId:S,name:e})})]})]}))},t[14]=v,t[15]=O,t[16]=I,t[17]=s,t[18]=S,t[19]=$):$=t[19];const G=`cell_${O}`;let H,W,q;if(t[20]!==s||t[21]!==S?(H=e=>s({cellId:S,name:e}),t[20]=s,t[21]=S,t[22]=H):H=t[22],t[23]!==G||t[24]!==I||t[25]!==H?(W=p.jsx(Wi,{placeholder:G,value:I,onChange:H}),t[23]=G,t[24]=I,t[25]=H,t[26]=W):W=t[26],t[27]!==$||t[28]!==W||t[29]!==M||t[30]!==j.disabled||t[31]!==j.hide_code||t[32]!==u||t[33]!==y||t[34]!==x||t[35]!==S||t[36]!==A||t[37]!==_||t[38]!==a||t[39]!==U||t[40]!==P||t[41]!==w||t[42]!==o||t[43]!==i||t[44]!==l||t[45]!==c||t[46]!==C||t[47]!==d||t[48]!==h||t[49]!==g){q=[[{icon:V,label:"Name",disableClick:!0,handle:fd,handleHeadless:$,rightElement:W},{icon:p.jsx(vc,{size:13,strokeWidth:1.5}),label:"Run cell",hotkey:"cell.run",hidden:"running"===M||"queued"===M||"disabled-transitively"===M||j.disabled,handle:()=>u()},{icon:p.jsx(Sc,{size:13,strokeWidth:1.5}),label:"AI completion",hidden:!y,handle:()=>{x((e=>(null==e?void 0:e.cellId)===S?null:{cellId:S}))},hotkey:"cell.aiCompletion"},{icon:p.jsx(Hi,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!A,handle:()=>function(e){const t=document.getElementById(R.create(e));t&&(t.classList.add("printing-output"),F(t,"result.png").finally((()=>{t.classList.remove("printing-output")})))}(S)},{icon:p.jsx(le,{size:13,strokeWidth:1.5}),label:"Format cell",hotkey:"cell.format",handle:()=>{const e=_();e&&ce({[S]:e},a)}},{icon:j.hide_code?p.jsx(de,{size:13,strokeWidth:1.5}):p.jsx(ue,{size:13,strokeWidth:1.5}),label:j.hide_code?"Show code":"Hide code",handle:U,hotkey:"cell.hideCode"},{icon:j.disabled?p.jsx(Uc,{size:13,strokeWidth:1.5}):p.jsx(Vc,{size:13,strokeWidth:1.5}),label:"Reactive execution",rightElement:p.jsx(he,{"data-testid":"cell-disable-switch",checked:!j.disabled,size:"sm",onCheckedChange:P}),handle:P}],[{icon:p.jsx(gi,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:()=>{const e=_();e&&(cd(w,o),me(e,"markdown",{keepCodeAsIs:!0}))}},{icon:p.jsx(fe,{size:13,strokeWidth:1.5}),label:"Convert to SQL",handle:()=>{const e=_();e&&(cd(w,o),me(e,"sql",{keepCodeAsIs:!0}))}},{icon:p.jsx(vi,{}),label:"Toggle as Python",handle:()=>{const e=_();e&&(cd(w,o),pe(e,"python",{force:!0}))}}],[{icon:p.jsxs(nd,{children:[p.jsx(Ll,{size:13,strokeWidth:1.5}),p.jsx(ge,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>o({cellId:S,before:!0})},{icon:p.jsxs(nd,{children:[p.jsx(Ll,{size:13,strokeWidth:1.5}),p.jsx(ve,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>o({cellId:S,before:!1})},{icon:p.jsx(ge,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>i({cellId:S,before:!0})},{icon:p.jsx(ve,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>i({cellId:S,before:!1})},{icon:p.jsx(Rl,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>l({cellId:S})},{icon:p.jsx(Pl,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>c({cellId:S})},{icon:p.jsx(xe,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",hidden:"columns"!==C,handle:()=>d({cellId:S})}],[{label:"Delete",hidden:!h,variant:"danger",icon:p.jsx(ye,{size:13,strokeWidth:1.5}),handle:()=>{g({cellId:S})}}]].map(hd).filter(ud),t[27]=$,t[28]=W,t[29]=M,t[30]=j.disabled,t[31]=j.hide_code,t[32]=u,t[33]=y,t[34]=x,t[35]=S,t[36]=A,t[37]=_,t[38]=a,t[39]=U,t[40]=P,t[41]=w,t[42]=o,t[43]=i,t[44]=l,t[45]=c,t[46]=C,t[47]=d,t[48]=h,t[49]=g,t[50]=q}else q=t[50];return q}function ud(e){return e.length>0}function hd(e){return e.filter(md)}function md(e){return!e.hidden}function fd(e){null==e||e.stopPropagation(),null==e||e.preventDefault()}const pd=H(null);function gd(){return te(pd)}const vd=H((e=>{const t=e(pd);return t?t===Ne?null:xd(t,e(Q)):null}));function xd(e,t){var n;const{cellData:o,cellHandles:r,cellRuntime:a}=t,s=o[e],i=a[e],l=null==(n=r[e])?void 0:n.current;if(!s||!l)return null;return{cellId:e,name:s.name,config:s.config,status:i?i.status:"idle",getEditorView:()=>l.editorView,hasOutput:null!=(null==i?void 0:i.output)}}function yd(e){return!e.hidden}const bd=H(!1),wd=()=>{const e=m(32),[t,n]=Ie(bd),o=yi(),r=te(vd),a=te(Ae);let s;e[0]!==r?(s={cell:r},e[0]=r,e[1]=s):s=e[1];let i=dd(s).flat();i=td(i);const l=function(){const e=m(46),{theme:t}=Ee(),[n,o]=Ce(),[r,a]=Se();let s;e[0]!==o?(s=async e=>{await je({config:e}).then((()=>{o(e)}))},e[0]=o,e[1]=s):s=e[1];const i=s;let l;e[2]!==a?(l=async e=>{await _e({config:e}).then((()=>{a(e)}))},e[2]=a,e[3]=l):l=e[3];const c=l;let d,u;if(e[4]!==r||e[5]!==c){let t;e[7]!==r.width?(t=e=>e!==r.width,e[7]=r.width,e[8]=t):t=e[8],d=xi().filter(t).map((e=>({label:`App config > Set width=${e}`,handle:()=>{c({...r,width:e})}}))),e[4]=r,e[5]=c,e[6]=d}else d=e[6];e[9]!==i||e[10]!==n||e[11]!==t?(u={label:"Config > Toggle dark mode",handle:()=>{i({...n,display:{...n.display,theme:"dark"===t?"light":"dark"}})}},e[9]=i,e[10]=n,e[11]=t,e[12]=u):u=e[12];const h="vim"===n.keymap.preset;let f,p;e[13]!==i||e[14]!==n?(f=()=>{i({...n,keymap:{...n.keymap,preset:"vim"}})},e[13]=i,e[14]=n,e[15]=f):f=e[15],e[16]!==h||e[17]!==f?(p={label:"Config > Switch keymap to VIM",hidden:h,handle:f},e[16]=h,e[17]=f,e[18]=p):p=e[18];const g="default"===n.keymap.preset;let v,x,y;e[19]!==i||e[20]!==n?(v=()=>{i({...n,keymap:{...n.keymap,preset:"default"}})},e[19]=i,e[20]=n,e[21]=v):v=e[21],e[22]!==g||e[23]!==v?(x={label:"Config > Switch keymap to default (current: VIM)",hidden:g,handle:v},e[22]=g,e[23]=v,e[24]=x):x=e[24],e[25]!==i||e[26]!==n?(y=()=>{i({...n,completion:{...n.completion,copilot:!1}})},e[25]=i,e[26]=n,e[27]=y):y=e[27];const b="github"!==n.completion.copilot;let w,k;e[28]!==y||e[29]!==b?(w={label:"Config > Disable GitHub Copilot",handle:y,hidden:b},e[28]=y,e[29]=b,e[30]=w):w=e[30],e[31]!==i||e[32]!==n?(k=()=>{i({...n,completion:{...n.completion,copilot:"github"}})},e[31]=i,e[32]=n,e[33]=k):k=e[33];const N="github"===n.completion.copilot;let E,C;e[34]!==k||e[35]!==N?(E={label:"Config > Enable GitHub Copilot",handle:k,hidden:N},e[34]=k,e[35]=N,e[36]=E):E=e[36],e[37]!==d||e[38]!==u||e[39]!==p||e[40]!==x||e[41]!==w||e[42]!==E?(C=[...d,u,p,x,w,E],e[37]=d,e[38]=u,e[39]=p,e[40]=x,e[41]=w,e[42]=E,e[43]=C):C=e[43];const S=C;let j;return e[44]!==S?(j=S.filter(yd),e[44]=S,e[45]=j):j=e[45],j}();let c=Ld();c=[...td(c),...td(l)];const d=c.filter(kd),u=Me.keyBy(d,Nd),{recentCommands:h,addRecentCommand:f}=Qc(),g=new Set(h);let v,x;e[2]!==a||e[3]!==n?(v=e=>{Pe(a.getHotkey("global.commandPalette").key)(e)&&(e.preventDefault(),n((e=>!e)))},e[2]=a,e[3]=n,e[4]=v):v=e[4],W(document,"keydown",v),e[5]!==o||e[6]!==a||e[7]!==f||e[8]!==n?(x=(e,t)=>{const r=o[e];if(!r)return null;const s=a.getHotkey(e);return p.jsxs(Re,{disabled:t.disabled,onSelect:()=>{f(e),n(!1),requestAnimationFrame((()=>{r()}))},value:s.name,children:[p.jsxs("span",{children:[s.name,t.tooltip&&p.jsx("span",{className:"ml-2",children:t.tooltip})]}),p.jsx(Fe,{children:p.jsx(Le,{shortcut:s.key})})]},e)},e[5]=o,e[6]=a,e[7]=f,e[8]=n,e[9]=x):x=e[9];const y=x;let b;e[10]!==f||e[11]!==n||e[12]!==a?(b=(e,t,o,r)=>{const s=void 0===o?{}:o;return p.jsxs(Re,{disabled:s.disabled,onSelect:()=>{f(e),n(!1),requestAnimationFrame((()=>{t()}))},value:e,children:[p.jsxs("span",{children:[e,s.tooltip&&p.jsxs("span",{className:"ml-2",children:["(",s.tooltip,")"]})]}),r&&p.jsx(Fe,{children:p.jsx(Le,{shortcut:a.getHotkey(r).key})})]},e)},e[10]=f,e[11]=n,e[12]=a,e[13]=b):b=e[13];const w=b,k=ze;let N;e[14]===Symbol.for("react.memo_cache_sentinel")?(N=p.jsx(Be,{placeholder:"Type to search..."}),e[14]=N):N=e[14];const E=Ue;let C;e[15]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(Ve,{children:"No results found."}),e[15]=C):C=e[15];const S=h.length>0&&p.jsxs(p.Fragment,{children:[p.jsx(Te,{heading:"Recently Used",children:h.map((e=>{const t=u[e];return Oe(e)?y(e,{disabled:null==t?void 0:t.disabled,tooltip:null==t?void 0:t.tooltip}):t&&!ed(t)?w(t.label,t.handleHeadless||t.handle,{disabled:t.disabled,tooltip:t.tooltip}):null}))}),p.jsx(De,{})]}),j=Te,_=a.iterate().map((e=>{if(g.has(e))return null;const t=u[e];return y(e,{disabled:null==t?void 0:t.disabled,tooltip:null==t?void 0:t.tooltip})})),I=d.map((e=>g.has(e.label)?null:w(e.label,e.handleHeadless||e.handle,{disabled:e.disabled,tooltip:e.tooltip}))),A=i.map((e=>g.has(e.label)?null:w(`Cell > ${e.label}`,e.handleHeadless||e.handle,{disabled:e.disabled,tooltip:e.tooltip})));let M,T,O;return e[16]!==j||e[17]!==_||e[18]!==I||e[19]!==A?(M=p.jsxs(j,{heading:"Commands",children:[_,I,A]}),e[16]=j,e[17]=_,e[18]=I,e[19]=A,e[20]=M):M=e[20],e[21]!==E||e[22]!==C||e[23]!==S||e[24]!==M?(T=p.jsxs(E,{children:[C,S,M]}),e[21]=E,e[22]=C,e[23]=S,e[24]=M,e[25]=T):T=e[25],e[26]!==k||e[27]!==t||e[28]!==n||e[29]!==N||e[30]!==T?(O=p.jsxs(k,{open:t,onOpenChange:n,children:[N,T]}),e[26]=k,e[27]=t,e[28]=n,e[29]=N,e[30]=T,e[31]=O):O=e[31],O};function kd(e){return!e.hotkey}function Nd(e){return e.label}const Ed="https://static.marimo.app",Cd=({onClose:e})=>{const[t,n]=r.useState(""),o=`${t}-${r.useRef(Math.random().toString(36).slice(2,6)).current}`,a=`${Ed}/static/${o}`;return p.jsx(N,{className:"w-fit",children:p.jsxs("form",{onSubmit:async t=>{t.preventDefault(),e();const n=await $e({download:!1,includeCode:!0,files:qi.INSTANCE.filenames()}),r=X({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${Ed}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:n,path:o})}).catch((()=>{r.dismiss(),X({title:"Error uploading static page",description:p.jsxs("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",p.jsx("a",{href:Ge.issuesPage,target:"_blank",rel:"noreferrer",className:"underline",children:"GitHub"}),"."]})})})),r.dismiss(),X({title:"Static page uploaded!",description:p.jsxs("div",{children:["The URL has been copied to your clipboard.",p.jsx("br",{}),"You can share it with anyone."]})})},children:[p.jsxs(we,{children:[p.jsx(b,{children:"Share static notebook"}),p.jsxs(w,{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"," ",p.jsx("a",{href:Ed,target:"_blank",rel:"noreferrer",children:Ed}),"."]})]}),p.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[p.jsx(He,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:t,placeholder:"Notebook slug",onChange:e=>{const t=e.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,"");n(t)},required:!0,autoComplete:"off"}),p.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:",p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Sd,{text:a}),p.jsx("span",{className:"text-primary",children:a})]})]})]}),p.jsxs(k,{children:[p.jsx(x,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:e,children:"Cancel"}),p.jsx(x,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await We(a)},children:"Create"})]})]})})},Sd=e=>{const t=m(8),[n,o]=u.useState(!1);let r;t[0]!==e.text?(r=qe.stopPropagation((async t=>{t.preventDefault(),await We(e.text),o(!0),setTimeout((()=>o(!1)),2e3)})),t[0]=e.text,t[1]=r):r=t[1];const a=r;let s,i,l;return t[2]===Symbol.for("react.memo_cache_sentinel")?(s=p.jsx(Ye,{size:14,strokeWidth:1.5}),t[2]=s):s=t[2],t[3]!==a?(i=p.jsx(x,{"data-testid":"copy-static-notebook-url-button",onClick:a,size:"xs",variant:"secondary",children:s}),t[3]=a,t[4]=i):i=t[4],t[5]!==n||t[6]!==i?(l=p.jsx(v,{content:"Copied!",open:n,children:i}),t[5]=n,t[6]=i,t[7]=l):l=t[7],l};function jd(){const e=m(3),{openConfirm:t}=f(),n=ne(Yi);let o;return e[0]!==t||e[1]!==n?(o=()=>{t({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:p.jsx(Ke,{onClick:async()=>{n({state:Ki.CLOSING}),await Je(),Xe()},"aria-label":"Confirm Restart",children:"Restart"})})},e[0]=t,e[1]=n,e[2]=o):o=e[2],o}const _d=new Ze("marimo:sidebar",Qe.object({selectedPanel:Qe.string().optional().transform((e=>e)),isSidebarOpen:Qe.boolean(),isTerminalOpen:Qe.boolean()}),(function(){return{selectedPanel:"variables",isSidebarOpen:!1,isTerminalOpen:!1}}));const{reducer:Id,createActions:Ad,valueAtom:Md,useActions:Td}=et((()=>_d.get()),{openApplication:(e,t)=>({...e,selectedPanel:t,isSidebarOpen:!e.isSidebarOpen||e.selectedPanel!==t}),toggleSidebarPanel:e=>({...e,isSidebarOpen:!e.isSidebarOpen}),setIsSidebarOpen:(e,t)=>({...e,isSidebarOpen:t}),toggleTerminal:e=>({...e,isTerminalOpen:!e.isTerminalOpen}),setIsTerminalOpen:(e,t)=>({...e,isTerminalOpen:t})},[(e,t)=>_d.set(t)]),Od=()=>{const e=m(2),t=te(Md);if(t.isSidebarOpen)return t;let n;return e[0]!==t?(n={...t,selectedPanel:void 0},e[0]=t,e[1]=n):n=e[1],n};function Dd(){return Td()}const Pd=[{type:"files",Icon:Xl,tooltip:"View files",position:"sidebar"},{type:"variables",Icon:tt,tooltip:"Explore variables",position:"sidebar"},{type:"datasources",Icon:fe,tooltip:"Explore data sources",position:"sidebar"},{type:"dependencies",Icon:cc,tooltip:"Explore dependencies",position:"sidebar"},{type:"packages",Icon:Dl,tooltip:"Manage packages",position:"sidebar"},{type:"outline",Icon:Ec,tooltip:"View outline",position:"sidebar"},{type:"documentation",Icon:Rc,tooltip:"View live docs",position:"sidebar"},{type:"logs",Icon:nt,tooltip:"Notebook logs",position:"sidebar"},{type:"snippets",Icon:_c,tooltip:"Snippets",position:"sidebar"},{type:"scratchpad",Icon:dc,hidden:!pi("scratchpad"),tooltip:"Scratchpad",position:"sidebar"},{type:"errors",Icon:ot,tooltip:"View errors",position:"footer"}];function Rd(){const e=m(2),t=ne(rt);let n;e[0]!==t?(n=()=>{const e=document.getElementsByClassName("output-area"),n=window.innerHeight||document.documentElement.clientHeight;let o;o=null;for(const t of Array.from(e)){const e=t.getBoundingClientRect();if(e.top>=0&&e.top<=n||e.bottom>=0&&e.bottom<=n){o=at.parse(t.parentNode.id);break}}t((e=>({mode:st(e.mode),cellAnchor:o}))),requestAnimationFrame((()=>{var e;null!==o&&(null==(e=document.getElementById(at.create(o)))||e.scrollIntoView())}))},e[0]=t,e[1]=n):n=e[1];return n}const Fd=e=>{null==e||e.preventDefault(),null==e||e.stopPropagation()};function Ld(){const[e]=dt(),{openModal:t,closeModal:n}=f(),{openApplication:o}=Dd(),{selectedPanel:r}=Od(),[a]=Ie(rt),s=te(se),i=L(),{updateCellConfig:l,undoDeleteCell:c}=B(),d=jd(),u=function(e){const t=m(4),{openPrompt:n,closeModal:o}=f();let r;return t[0]!==e||t[1]!==n||t[2]!==o?(r=()=>{if(!e)return null;const t=it.guessDeliminator(e),r=lt.basename(e);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${r}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:n=>{const r=t.join(lt.dirname(e),n);ct({source:e,destination:r}).then((()=>{o(),X({title:"Notebook copied",description:"A copy of the notebook has been created."}),window.open(`/?file=${r}`,"_blank")}))}})},t[0]=e,t[1]=n,t[2]=o,t[3]=r):r=t[3],r}(e),h=ne(bd),v=ne(bi),x=ne(wi),b=ut(i),w=ht(i),{selectedLayout:k}=Vi(),{setLayoutView:N}=$i(),E=Rd();return[{icon:p.jsx(Cc,{size:14,strokeWidth:1.5}),label:"Share",handle:Fd,dropdown:[{icon:p.jsx(mt,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",handle:async()=>{t(p.jsx(Cd,{onClose:n}))}},{icon:p.jsx(rc,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",handle:async()=>{const e=await ft(),t=pt({code:e.contents});await We(t),X({title:"Copied",description:"Link copied to clipboard."})}}]},{icon:p.jsx(gt,{size:14,strokeWidth:1.5}),label:"Download",handle:Fd,dropdown:[{icon:p.jsx(Ji,{size:14,strokeWidth:1.5}),label:"Download as HTML",handle:async()=>{e?await Xi({filename:e,includeCode:!0}):X({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."})}},{icon:p.jsx(Ji,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{e?await Xi({filename:e,includeCode:!1}):X({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."})}},{icon:p.jsx(gi,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{const e=await vt({download:!1});y(new Blob([e],{type:"text/plain"}),xt.toMarkdown(document.title))}},{icon:p.jsx(Vl,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{const e=await ft();y(new Blob([e.contents],{type:"text/plain"}),xt.toPY(document.title))}},{divider:!0,icon:p.jsx(Hi,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:"present"!==a.mode,tooltip:"present"===a.mode?void 0:p.jsxs("span",{children:["Only available in app view. ",p.jsx("br",{}),"Toggle with: ",g("global.hideCode",!1)]}),handle:async()=>{const e=document.getElementById("App");e&&await F(e,document.title)}},{icon:p.jsx(yt,{size:14,strokeWidth:1.5}),label:"Download as PDF",disabled:"present"!==a.mode,tooltip:"present"===a.mode?void 0:p.jsxs("span",{children:["Only available in app view. ",p.jsx("br",{}),"Toggle with: ",g("global.hideCode",!1)]}),handle:async()=>{const e=new Event("export-beforeprint"),t=new Event("export-afterprint");window.dispatchEvent(e),setTimeout((()=>window.print()),0),setTimeout((()=>window.dispatchEvent(t)),0)}}]},{divider:!0,icon:p.jsx(fc,{size:14,strokeWidth:1.5}),label:"Helper panel",handle:Fd,dropdown:Pd.flatMap((({type:e,Icon:t,hidden:n})=>{return n?[]:{label:S(e),rightElement:(a=r===e,p.jsx("div",{className:"w-8 flex justify-end",children:a&&p.jsx(wt,{size:14})})),icon:p.jsx(t,{size:14,strokeWidth:1.5}),handle:()=>o(e)};var a}))},{icon:p.jsx(xc,{size:14,strokeWidth:1.5}),label:"Present as",handle:Fd,dropdown:[{icon:"present"===a.mode?p.jsx(bt,{size:14,strokeWidth:1.5}):p.jsx(oc,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{E()}},...Gi.map(((e,t)=>{const n=Jc(e);return{divider:0===t,label:Xc(e),icon:p.jsx(n,{size:14,strokeWidth:1.5}),rightElement:p.jsx("div",{className:"w-8 flex justify-end",children:k===e&&p.jsx(wt,{size:14})}),handle:()=>{N(e),"edit"===a.mode&&E()}}}))]},{icon:p.jsx(Kl,{size:14,strokeWidth:1.5}),label:"Create notebook copy",hidden:!e||j(),handle:u},{icon:p.jsx(zl,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!e,handle:async()=>{const e=await ft();await We(e.contents),X({title:"Copied",description:"Code copied to clipboard."})}},{icon:p.jsx(Vc,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:0===b.length||s,handle:async()=>{const e=b.map((e=>e.id)),t=Me.fromEntries(e.map((e=>[e,{disabled:!1}])));await be({configs:t});for(const n of e)l({cellId:n,config:{disabled:!1}})}},{icon:p.jsx(Uc,{size:14,strokeWidth:1.5}),label:"Disable all cells",hidden:0===w.length||s,handle:async()=>{const e=w.map((e=>e.id)),t=Me.fromEntries(e.map((e=>[e,{disabled:!0}])));await be({configs:t});for(const n of e)l({cellId:n,config:{disabled:!0}})}},{icon:p.jsx(Fc,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!kt(i)||s,handle:()=>{c()}},{divider:!0,icon:p.jsx($l,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>h((e=>!e))},{icon:p.jsx(Nt,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>v((e=>!e))},{icon:p.jsx(nc,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>x((e=>!e))},{icon:p.jsx(Ol,{size:14,strokeWidth:1.5}),label:"Open documentation",handle:()=>{window.open("https://docs.marimo.io","_blank")}},{divider:!0,icon:p.jsx(tc,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:()=>{window.location.href=document.baseURI}},{icon:p.jsx(Oc,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:d}].filter((e=>!e.hidden))}const zd=()=>{const e=m(10),t=Ld();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=p.jsx(mi,{"aria-label":"Config",shape:"circle",size:"small",className:"h-[27px] w-[27px]","data-testid":"notebook-menu-dropdown",color:"hint-green",children:p.jsx(Zi,{strokeWidth:1.8})}),e[0]=n):n=e[0];const o=n,r=Bd;let a;e[1]===Symbol.for("react.memo_cache_sentinel")?(a=e=>{const t=p.jsx(Ct,{variant:e.variant,disabled:e.disabled,onSelect:t=>e.handle(t),"data-testid":`notebook-menu-dropdown-${e.label}`,children:r(e)},e.label);return e.tooltip?p.jsx(v,{content:e.tooltip,side:"left",delayDuration:100,children:p.jsx("span",{children:t})},e.label):t},e[1]=a):a=e[1];const s=a;let i,l,c,d,h;if(e[2]===Symbol.for("react.memo_cache_sentinel")?(i=p.jsx(St,{asChild:!0,children:o}),e[2]=i):i=e[2],e[3]!==t){let n;e[5]===Symbol.for("react.memo_cache_sentinel")?(n=e=>e.hidden?null:e.dropdown?p.jsxs(jt,{children:[p.jsx(_t,{"data-testid":`notebook-menu-dropdown-${e.label}`,children:r(e)}),p.jsx(It,{children:p.jsx(At,{children:e.dropdown.map((e=>p.jsxs(u.Fragment,{children:[e.divider&&p.jsx(Mt,{}),s(e)]},e.label)))})})]},e.label):p.jsxs(u.Fragment,{children:[e.divider&&p.jsx(Mt,{}),s(e)]},e.label),e[5]=n):n=e[5],l=t.map(n),e[3]=t,e[4]=l}else l=e[4];return e[6]===Symbol.for("react.memo_cache_sentinel")?(c=p.jsx(Mt,{}),e[6]=c):c=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(d=p.jsx("div",{className:"flex-1 px-2 text-xs text-muted-foreground",children:p.jsxs("span",{children:["Version: ",Et()]})}),e[7]=d):d=e[7],e[8]!==l?(h=p.jsxs(Tt,{modal:!1,children:[i,p.jsxs(Ot,{align:"end",className:"no-print w-[240px]",children:[l,c,d]})]}),e[8]=l,e[9]=h):h=e[9],h};function Bd(e){return p.jsxs(p.Fragment,{children:[e.icon&&p.jsx("span",{className:"flex-0 mr-2",children:e.icon}),p.jsx("span",{className:"flex-1",children:e.labelElement||e.label}),e.hotkey&&p.jsx(Dt,{shortcut:e.hotkey,className:"ml-4"}),e.rightElement]})}const Ud=Pt({findText:"",replaceText:"",caseSensitive:!1,wholeWord:!1,regexp:!1,isOpen:!1,currentView:void 0},((e,t)=>{if(void 0===t)return e;switch(t.type){case"setFind":return{...e,findText:t.find};case"setReplace":return{...e,replaceText:t.replace};case"setCaseSensitive":return{...e,caseSensitive:t.caseSensitive};case"setWholeWord":return{...e,wholeWord:t.wholeWord};case"setRegex":return{...e,regexp:t.regexp};case"setIsOpen":return{...e,isOpen:t.isOpen};case"setCurrentView":return{...e,currentView:{view:t.view,range:t.range}};case"clearCurrentView":return{...e,currentView:void 0}}}));function Vd(e){if([...document.querySelectorAll('[role="dialog"][data-state="open"]')].some((e=>e instanceof HTMLElement&&e.childNodes.length>0)))return!1;if(e){const t=e.state.selection.main,n=e.state.sliceDoc(t.from,t.to);n?(Y.set(Ud,{type:"setFind",find:n}),Y.set(Ud,{type:"setCurrentView",view:e,range:{from:t.from,to:t.to}})):Y.set(Ud,{type:"setCurrentView",view:e,range:{from:0,to:0}})}return Y.get(Ud).isOpen?(Y.set(Ud,{type:"setIsOpen",isOpen:!1}),requestAnimationFrame((()=>{Y.set(Ud,{type:"setIsOpen",isOpen:!0})})),!0):(Y.set(Ud,{type:"setIsOpen",isOpen:!0}),!0)}function $d(){return!!Y.get(Ud).isOpen&&(Y.set(Ud,{type:"setIsOpen",isOpen:!1}),!0)}function Gd(e){return Rt("create"in e,'Expected query to have a "create" method'),e}function Hd(e){return()=>{const t=Y.get(Ud),n=new Ft({search:t.findText,caseSensitive:t.caseSensitive,regexp:t.regexp,replace:t.replaceText,wholeWord:t.wholeWord});return!!n.valid&&e({query:Gd(n).create(),search:n})}}const Wd=e=>Hd((({query:t})=>{const n=Lt(),o=Y.get(Ud).currentView||{view:n[0],range:{from:0,to:0}};let r=o.range.to;"prev"===e&&(n.reverse(),r=o.range.from);let a=n.indexOf(o.view);a<0&&(a=0);const s=[...n,...n].slice(a);for(const i of s){const n="next"===e?t.nextMatch(i.state,0,r??0):t.prevMatch(i.state,r??i.state.doc.length,i.state.doc.length);if(!n){r=null,i.dispatch({selection:zt.single(0)});continue}const o=zt.single(n.from,n.to);return i.dispatch({selection:o,effects:[Bt.scrollIntoView(o.main,{y:"center"})],userEvent:"select.search"}),Y.set(Ud,{type:"setCurrentView",view:i,range:{from:n.from,to:n.to}}),n}return!1})),qd=Wd("next"),Yd=Wd("prev"),Kd=Hd((({query:e})=>{var t;const n=Lt(),o=[];for(const r of n){if(r.state.readOnly)continue;const n=null==(t=e.matchAll(r.state,1e9))?void 0:t.map((t=>{const{from:n,to:o}=t;return{from:n,to:o,insert:e.getReplacement(t)}}));if(!n||0===n.length)continue;const a=r.state.doc.toString();o.push((()=>{r.dispatch({changes:[{from:0,to:r.state.doc.length,insert:a}],userEvent:"input.replace.all"})})),r.dispatch({changes:n,userEvent:"input.replace.all"})}return()=>{for(const e of o)e()}})),Jd=Hd((({query:e})=>{const t=Lt(),n=Y.get(Ud).currentView||{view:t[0],range:{from:0,to:0}};let o=n.range.from,r=t.indexOf(n.view);r<0&&(r=0);const a=[...t,...t].slice(r);for(const s of a){const t=e.nextMatch(s.state,0,o??0);if(!t){o=null,s.dispatch({selection:zt.single(0)});continue}const n=s.state.toText(e.getReplacement(t));return s.dispatch({changes:[{from:t.from,to:t.to,insert:n}],userEvent:"input.replace"}),qd()}return!1})),Xd=Hd((({query:e})=>{const t=Lt();let n=0;const o=new Map;for(const r of t){const t=e.matchAll(r.state,1e9)||[];for(const e of t){const{from:t,to:a}=e,s=o.get(r)||new Map;s.set(`${t}:${a}`,n++),o.set(r,s)}}return{count:n,position:o}})),Zd=Ut.define();function Qd(){const e=Lt();for(const t of e)t.state.readOnly||t.dispatch({effects:Zd.of(new Ft({search:""}))})}const eu=Vt.define({create(){const e=Y.get(Ud);return Gd(new Ft({search:e.findText,caseSensitive:e.caseSensitive,regexp:e.regexp,replace:e.replaceText,wholeWord:e.wholeWord})).create()},update(e,t){for(const n of t.effects)n.is(Zd)&&(e=Gd(n.value).create());return e}}),tu=$t.mark({class:"cm-searchMatch"}),nu=$t.mark({class:"cm-searchMatch cm-searchMatch-selected"}),ou=Gt.fromClass(class{constructor(e){this.view=e,this.decorations=void 0,this.decorations=this.highlight(e.state.field(eu))}update(e){const t=e.state.field(eu);(t!==e.startState.field(eu)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight(e){if(!e.spec.valid)return $t.none;const{view:t}=this,n=new Ht,o=t.visibleRanges,r=o.length;for(let a=0;a<r;a++){let{to:s}=o[a];const{from:i}=o[a];for(;a<r-1&&s>o[a+1].from-500;)s=o[++a].to;e.highlight(t.state,i,s,((e,o)=>{const r=t.state.selection.ranges.some((t=>t.from===e&&t.to===o));n.add(e,o,r?nu:tu)}))}return n.finish()}},{decorations:e=>e.decorations}),ru=Bt.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"}}),au=()=>{var e;const t=m(99),[n,o]=r.useState(!1),[a,s]=Ie(Ud),[i,l]=r.useState(),c=r.useRef(null),d=te(Ae);let u,h,f,g,y;if(t[0]!==n||t[1]!==a.isOpen?(u=()=>(!n||!a.isOpen)&&Vd(),t[0]=n,t[1]=a.isOpen,t[2]=u):u=t[2],hi("cell.findAndReplace",u),t[3]!==a.isOpen?(h=()=>{a.isOpen&&c.current&&(c.current.focus(),c.current.select())},f=[a.isOpen],t[3]=a.isOpen,t[4]=h,t[5]=f):(h=t[4],f=t[5]),r.useEffect(h,f),t[6]!==a.isOpen||t[7]!==a.findText?(g=()=>{if(!a.isOpen)return void Qd();if(""===a.findText)return l(void 0),void Qd();const e=Xd();l(!1===e?void 0:e),function(){const e=Y.get(Ud),t=Lt();for(const n of t)n.state.readOnly||n.dispatch({effects:Zd.of(new Ft({search:e.findText,caseSensitive:e.caseSensitive,regexp:e.regexp,replace:e.replaceText,wholeWord:e.wholeWord}))})}()},t[6]=a.isOpen,t[7]=a.findText,t[8]=g):g=t[8],t[9]!==a.findText||t[10]!==a.isOpen||t[11]!==a.caseSensitive||t[12]!==a.regexp||t[13]!==a.wholeWord?(y=[a.findText,a.isOpen,a.caseSensitive,a.regexp,a.wholeWord],t[9]=a.findText,t[10]=a.isOpen,t[11]=a.caseSensitive,t[12]=a.regexp,t[13]=a.wholeWord,t[14]=y):y=t[14],r.useEffect(g,y),!a.isOpen)return null;const b=a.currentView;let w;t[15]!==b||t[16]!==i?(w=b&&i?null==(e=i.position.get(b.view))?void 0:e.get(`${b.range.from}:${b.range.to}`):void 0,t[15]=b,t[16]=i,t[17]=w):w=t[17];const k=w;let N,E,C,S,j,_,I,A,M,T,O;t[18]===Symbol.for("react.memo_cache_sentinel")?(N=()=>o(!0),t[18]=N):N=t[18],t[19]===Symbol.for("react.memo_cache_sentinel")?(E=()=>o(!1),t[19]=E):E=t[19],t[20]!==s?(C=e=>{"Escape"===e.key&&s({type:"setIsOpen",isOpen:!1})},t[20]=s,t[21]=C):C=t[21],t[22]!==s?(S=()=>s({type:"setIsOpen",isOpen:!1}),t[22]=s,t[23]=S):S=t[23],t[24]===Symbol.for("react.memo_cache_sentinel")?(j=p.jsx(qt,{className:"w-4 h-4"}),t[24]=j):j=t[24],t[25]!==S?(_=p.jsx("div",{className:"absolute top-0 right-0",children:p.jsx(x,{"data-testid":"close-find-replace-button",onClick:S,size:"xs",variant:"text",children:j})}),t[25]=S,t[26]=_):_=t[26],t[27]!==s?(I=e=>{s({type:"setFind",find:e.target.value})},t[27]=s,t[28]=I):I=t[28],t[29]!==a.findText||t[30]!==I?(A=p.jsx(He,{ref:c,"data-testid":"find-input",value:a.findText,autoFocus:!0,className:"mr-2 mb-0",placeholder:"Find",onKeyDown:iu,onChange:I}),t[29]=a.findText,t[30]=I,t[31]=A):A=t[31],t[32]!==s?(M=e=>{s({type:"setReplace",replace:e.target.value})},t[32]=s,t[33]=M):M=t[33],t[34]!==a.replaceText||t[35]!==M?(T=p.jsx(He,{"data-testid":"replace-input",value:a.replaceText,placeholder:"Replace",onChange:M}),t[34]=a.replaceText,t[35]=M,t[36]=T):T=t[36],t[37]!==A||t[38]!==T?(O=p.jsxs("div",{className:"flex flex-col flex-2 gap-2 w-[55%]",children:[A,T]}),t[37]=A,t[38]=T,t[39]=O):O=t[39];const D=a.caseSensitive?"on":"off";let P,R,F;t[40]!==s?(P=e=>s({type:"setCaseSensitive",caseSensitive:e}),t[40]=s,t[41]=P):P=t[41],t[42]===Symbol.for("react.memo_cache_sentinel")?(R=p.jsx(Yt,{className:"w-4 h-4"}),t[42]=R):R=t[42],t[43]!==a.caseSensitive||t[44]!==D||t[45]!==P?(F=p.jsx(v,{content:"Case Sensitive",children:p.jsx(Wt,{size:"sm",pressed:a.caseSensitive,"data-state":D,onPressedChange:P,children:R})}),t[43]=a.caseSensitive,t[44]=D,t[45]=P,t[46]=F):F=t[46];const L=a.wholeWord?"on":"off";let z,B,U;t[47]!==s?(z=e=>s({type:"setWholeWord",wholeWord:e}),t[47]=s,t[48]=z):z=t[48],t[49]===Symbol.for("react.memo_cache_sentinel")?(B=p.jsx(zc,{className:"w-4 h-4"}),t[49]=B):B=t[49],t[50]!==a.wholeWord||t[51]!==L||t[52]!==z?(U=p.jsx(v,{content:"Match Whole Word",children:p.jsx(Wt,{size:"sm",pressed:a.wholeWord,"data-state":L,onPressedChange:z,children:B})}),t[50]=a.wholeWord,t[51]=L,t[52]=z,t[53]=U):U=t[53];const V=a.regexp?"on":"off";let $,G,H,W;t[54]!==s?($=e=>s({type:"setRegex",regexp:e}),t[54]=s,t[55]=$):$=t[55],t[56]===Symbol.for("react.memo_cache_sentinel")?(G=p.jsx(yc,{className:"w-4 h-4"}),t[56]=G):G=t[56],t[57]!==a.regexp||t[58]!==V||t[59]!==$?(H=p.jsx(v,{content:"Use Regular Expression",children:p.jsx(Wt,{size:"sm",pressed:a.regexp,"data-state":V,onPressedChange:$,children:G})}),t[57]=a.regexp,t[58]=V,t[59]=$,t[60]=H):H=t[60],t[61]!==F||t[62]!==U||t[63]!==H?(W=p.jsxs("div",{className:"flex items-center gap-[2px]",children:[F,U,H]}),t[61]=F,t[62]=U,t[63]=H,t[64]=W):W=t[64];const q=""===a.findText||""===a.replaceText;let K;t[65]!==q?(K=p.jsx(x,{"data-testid":"replace-next-button",size:"xs",variant:"outline",className:"h-6 text-xs",onClick:lu,disabled:q,children:"Replace Next"}),t[65]=q,t[66]=K):K=t[66];const J=""===a.findText||""===a.replaceText;let X,Z,Q,ee,ne,oe,re,ae,se,ie,le,ce;return t[67]!==J?(X=p.jsx(x,{"data-testid":"replace-all-button",size:"xs",variant:"outline",className:"h-6 text-xs",onClick:cu,disabled:J,children:"Replace All"}),t[67]=J,t[68]=X):X=t[68],t[69]!==K||t[70]!==X?(Z=p.jsxs("div",{className:"flex items-center gap-[2px]",children:[K,X]}),t[69]=K,t[70]=X,t[71]=Z):Z=t[71],t[72]!==W||t[73]!==Z?(Q=p.jsxs("div",{className:"flex flex-col gap-2",children:[W,Z]}),t[72]=W,t[73]=Z,t[74]=Q):Q=t[74],t[75]!==O||t[76]!==Q?(ee=p.jsxs("div",{className:"flex items-center gap-3",children:[O,Q]}),t[75]=O,t[76]=Q,t[77]=ee):ee=t[77],t[78]===Symbol.for("react.memo_cache_sentinel")?(ne=p.jsx(v,{content:"Find Previous",children:p.jsx(x,{"data-testid":"find-prev-button",size:"xs",variant:"secondary",onClick:du,children:p.jsx(jl,{className:"w-4 h-4"})})}),t[78]=ne):ne=t[78],t[79]===Symbol.for("react.memo_cache_sentinel")?(oe=p.jsx(v,{content:"Find Next",children:p.jsx(x,{"data-testid":"find-next-button",size:"xs",variant:"secondary",onClick:uu,children:p.jsx(Al,{className:"w-4 h-4"})})}),t[79]=oe):oe=t[79],t[80]!==i||t[81]!==k?(re=null!=i&&null==k&&p.jsxs("span",{className:"text-sm",children:[i.count," matches"]}),t[80]=i,t[81]=k,t[82]=re):re=t[82],t[83]!==i||t[84]!==k?(ae=null!=i&&null!=k&&p.jsxs("span",{className:"text-sm",children:[k+1," of ",i.count]}),t[83]=i,t[84]=k,t[85]=ae):ae=t[85],t[86]!==re||t[87]!==ae?(se=p.jsxs("div",{className:"flex items-center gap-2",children:[ne,oe,re,ae]}),t[86]=re,t[87]=ae,t[88]=se):se=t[88],t[89]!==d?(ie=d.getHotkey("cell.findAndReplace"),t[89]=d,t[90]=ie):ie=t[90],t[91]!==ie.key?(le=p.jsxs("div",{className:"text-xs text-muted-foreground flex gap-1 mt-2",children:["Press"," ",p.jsx(Le,{shortcut:ie.key})," ","again to open the native browser search."]}),t[91]=ie.key,t[92]=le):le=t[92],t[93]!==C||t[94]!==_||t[95]!==ee||t[96]!==se||t[97]!==le?(ce=p.jsx(Kt,{restoreFocus:!0,autoFocus:!0,children:p.jsxs("div",{onFocus:N,onClick:su,onBlur:E,className:"fixed top-0 right-0 w-[500px] flex flex-col bg-[var(--sage-1)] p-4 z-50 mt-2 mr-3 rounded-md shadow-lg border gap-2 print:hidden",onKeyDown:C,children:[_,ee,se,le]})}),t[93]=C,t[94]=_,t[95]=ee,t[96]=se,t[97]=le,t[98]=ce):ce=t[98],ce};function su(e){e.stopPropagation(),e.preventDefault()}function iu(e){"Enter"===e.key&&(e.shiftKey?Yd():qd())}function lu(){return Jd()}function cu(){const e=Kd();if(!e)return;const{dismiss:t}=X({title:"Replaced all occurrences",action:p.jsx(sd,{"data-testid":"undo-replace-all-button",onClick:()=>{e(),n()}})}),n=t}function du(){return Yd()}function uu(){return qd()}function hu(e){const t=m(3),[n,o]=r.useState(!1);let a,s;return t[0]!==e?(a=()=>{if(!e)return;o(!1);const t=setTimeout((()=>{o(!0)}),200);return()=>clearTimeout(t)},s=[e],t[0]=e,t[1]=a,t[2]=s):(a=t[1],s=t[2]),r.useEffect(a,s),e&&n}const mu=()=>{const e=m(6),t=ne(bd);let n;e[0]!==t?(n=()=>t((e=>!e)),e[0]=t,e[1]=n):n=e[1];const o=n;let r,a,s;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=g("global.commandPalette"),e[2]=r):r=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(a=p.jsx($l,{strokeWidth:1.5,size:18}),e[3]=a):a=e[3],e[4]!==o?(s=p.jsx(v,{content:r,children:p.jsx(mi,{"data-testid":"command-palette-button",onClick:o,shape:"rectangle",color:"hint-green",children:a})}),e[4]=o,e[5]=s):s=e[5],s},fu=e=>{const{children:t}=e;return te(se)?null:t},pu=e=>{const{children:t}=e;return te(se)?t:null},gu=e=>{const t=m(48),{filename:n,needsSave:o,onSaveNotebook:r,getCellsAsJSON:a,presenting:s,onTogglePresenting:i,onInterrupt:l,onRun:c,closed:d,running:u,needsRun:h,undoAvailable:f,appWidth:x}=e,{undoDeleteCell:y}=B();let b;t[0]!==r?(b=e=>{e.preventDefault(),e.stopPropagation(),r()},t[0]=r,t[1]=b):b=t[1];const w=b;let k,N,E=null;if(!d&&f){let e,n;t[2]===Symbol.for("react.memo_cache_sentinel")?(e=p.jsx(Fc,{size:16,strokeWidth:1.5}),t[2]=e):e=t[2],t[3]!==y?(n=p.jsx(v,{content:"Undo cell deletion",children:p.jsx(mi,{"data-testid":"undo-delete-cell",size:"medium",color:"hint-green",shape:"circle",onClick:y,children:e})}),t[3]=y,t[4]=n):n=t[4],E=n}t[5]!==s?(k=!s&&p.jsx(au,{}),t[5]=s,t[6]=k):k=t[6],t[7]!==d||t[8]!==s?(N=!d&&p.jsxs("div",{className:yu,children:[s&&p.jsx(Yc,{}),p.jsx(zd,{}),p.jsx(ki,{}),p.jsx(Ni,{description:"This will terminate the Python kernel. You'll lose all data that's in memory."})]}),t[7]=d,t[8]=s,t[9]=N):N=t[9];const C="compact"===x&&"xl:flex-row items-end";let S,j,_,I,A,M,T,O,D,P,R,F,L;return t[10]!==C?(S=Jt(bu,C),t[10]=C,t[11]=S):S=t[11],t[12]!==d||t[13]!==n||t[14]!==a||t[15]!==o||t[16]!==w?(j=p.jsx(fu,{children:d?p.jsx(qc,{filename:n,getCellsAsJSON:a,needsSave:o}):p.jsx(v,{content:g("global.save"),children:p.jsx(mi,{"data-testid":"save-button",id:"save-button",shape:"rectangle",color:o?"yellow":"hint-green",onClick:w,children:p.jsx(kc,{strokeWidth:1.5,size:18})})})}),t[12]=d,t[13]=n,t[14]=a,t[15]=o,t[16]=w,t[17]=j):j=t[17],t[18]===Symbol.for("react.memo_cache_sentinel")?(_=g("global.hideCode"),t[18]=_):_=t[18],t[19]!==s?(I=s?p.jsx(bt,{strokeWidth:1.5,size:18}):p.jsx(oc,{strokeWidth:1.5,size:18}),t[19]=s,t[20]=I):I=t[20],t[21]!==i||t[22]!==I?(A=p.jsx(v,{content:_,children:p.jsx(mi,{"data-testid":"hide-code-button",id:"preview-button",shape:"rectangle",color:"hint-green",onClick:i,children:I})}),t[21]=i,t[22]=I,t[23]=A):A=t[23],t[24]===Symbol.for("react.memo_cache_sentinel")?(M=p.jsx(mu,{}),T=p.jsx(Ei,{}),O=p.jsx("div",{}),t[24]=M,t[25]=T,t[26]=O):(M=t[24],T=t[25],O=t[26]),t[27]!==d||t[28]!==u||t[29]!==l?(D=!d&&p.jsx(xu,{running:u,onInterrupt:l}),t[27]=d,t[28]=u,t[29]=l,t[30]=D):D=t[30],t[31]!==d||t[32]!==h||t[33]!==c?(P=!d&&p.jsx(vu,{needsRun:h,onRun:c}),t[31]=d,t[32]=h,t[33]=c,t[34]=P):P=t[34],t[35]!==E||t[36]!==D||t[37]!==P?(R=p.jsx(fu,{children:p.jsxs("div",{className:"flex flex-col gap-2 items-center",children:[E,D,P]})}),t[35]=E,t[36]=D,t[37]=P,t[38]=R):R=t[38],t[39]!==S||t[40]!==j||t[41]!==A||t[42]!==R?(F=p.jsxs("div",{className:S,children:[j,A,M,T,O,R]}),t[39]=S,t[40]=j,t[41]=A,t[42]=R,t[43]=F):F=t[43],t[44]!==k||t[45]!==N||t[46]!==F?(L=p.jsxs(p.Fragment,{children:[k,N,F]}),t[44]=k,t[45]=N,t[46]=F,t[47]=L):L=t[47],L},vu=e=>{const t=m(5),{needsRun:n,onRun:o}=e;if(n){let e,n,r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=g("global.runStale"),t[0]=e):e=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(n=p.jsx(vc,{strokeWidth:1.5,size:16}),t[1]=n):n=t[1],t[2]!==o?(r=p.jsx(v,{content:e,children:p.jsx(mi,{"data-testid":"run-button",size:"medium",color:"yellow",shape:"circle",onClick:o,children:n})}),t[2]=o,t[3]=r):r=t[3],r}let r;return t[4]===Symbol.for("react.memo_cache_sentinel")?(r=p.jsx(v,{content:"Nothing to run",children:p.jsx(mi,{"data-testid":"run-button",className:"inactive-button",color:"disabled",size:"medium",shape:"circle",children:p.jsx(vc,{strokeWidth:1.5,size:16})})}),t[4]=r):r=t[4],r},xu=e=>{const t=m(8),{running:n,onInterrupt:o}=e,r=hu(n);let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=g("global.interrupt"),t[0]=a):a=t[0];const s=!r&&"inactive-button active:shadow-xsSolid";let i;t[1]!==s?(i=Jt(s),t[1]=s,t[2]=i):i=t[2];const l=r?"yellow":"disabled",c=r?o:Xt.NOOP;let d,u;return t[3]===Symbol.for("react.memo_cache_sentinel")?(d=p.jsx(C,{strokeWidth:1.5,size:16}),t[3]=d):d=t[3],t[4]!==i||t[5]!==l||t[6]!==c?(u=p.jsx(v,{content:a,children:p.jsx(mi,{className:i,"data-testid":"interrupt-button",size:"medium",color:l,shape:"circle",onClick:c,children:d})}),t[4]=i,t[5]=l,t[6]=c,t[7]=u):u=t[7],u},yu="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",bu="absolute bottom-5 right-5 flex flex-col gap-2 items-center no-print pointer-events-auto z-30 print:hidden",wu=e=>{const t=m(35),{resetOnBlur:n,placeholderText:o,initialValue:a,flexibleWidth:s,onNameChange:i,className:l}=e,c=void 0!==n&&n,d=void 0===a?null:a,u=void 0!==s&&s,[h,f]=r.useState(d);let g;t[0]===Symbol.for("react.memo_cache_sentinel")?(g=[],t[0]=g):g=t[0];const[v,x]=r.useState(g),[y,b]=r.useState(!1),w=r.useRef(null),k=r.useRef(!1);let N,E,C;t[1]!==d?(N=()=>{f(d)},E=[d],t[1]=d,t[2]=N,t[3]=E):(N=t[2],E=t[3]),r.useEffect(N,E),t[4]===Symbol.for("react.memo_cache_sentinel")?(C=()=>{b(!0)},t[4]=C):C=t[4];const S=C;let j;t[5]!==c||t[6]!==d?(j=e=>{var t;(null==(t=e.relatedTarget)?void 0:t.closest(".filename-input"))||(b(!1),c&&f(d))},t[5]=c,t[6]=d,t[7]=j):j=t[7];const _=j;let I;t[8]!==h?(I=lt.dirname(h||""),t[8]=h,t[9]=I):I=t[9];const A=I,M=lt.basename(h||""),T=v.filter((e=>lt.basename(e.path).startsWith(M)));let O,D;t[10]!==y||t[11]!==A?(O=async()=>{if(!y)return void x([]);const e=await en({path:A});x(e.files)},D=[A,y],t[10]=y,t[11]=A,t[12]=O,t[13]=D):(O=t[12],D=t[13]);const{loading:P}=Zt(O,D),R=function(e,t,n){if(!e)return;if(e.endsWith("/"))return;(pi("markdown")?new Set(["py","md","markdown","qmd"]):new Set(["py"])).has(lt.extension(e))||(e=e.endsWith(".")?`${e}py`:e.endsWith(".p")?`${e}y`:`${e}.py`);if(t.some((t=>t.path===e||lt.basename(t.path)===e)))return;if(n&&(n===e||lt.basename(n)===e))return;return e}(h,v,d),F=(R||T.length>0)&&p.jsxs(Ue,{className:"font-mono",children:[!P&&p.jsx(Ve,{children:"No files"}),R&&p.jsxs(Re,{variant:"success",className:"py-2 px-3",onSelect:()=>{var e;R&&(k.current=!0,i(R),null==(e=w.current)||e.blur())},children:[p.jsx(ql,{className:"w-4 h-4 mr-2"})," ",p.jsxs("span",{className:"text-sm",children:[d?"Rename to: ":"Save as: ",p.jsx("span",{className:"font-medium text-sm",children:lt.basename(R)})]})]},"_rename_"),T.map((e=>{const t=e.isDirectory?"directory":Qt(e.path),n=tn[t];return p.jsxs(Re,{variant:e.isDirectory?"default":"muted",className:"py-2 px-3",onSelect:()=>{e.isDirectory?f(`${e.path}/`):f(e.path)},children:[p.jsx(n,{className:"w-4 h-4 mr-2"})," ",lt.basename(e.path)]},e.path)}))]}),L=10*Math.max(20,(null==h?void 0:h.length)||(null==o?void 0:o.length)||0),z=y?h||"":d||"";let B,U,V;t[14]!==u||t[15]!==L?(B=u?{maxWidth:L}:void 0,t[14]=u,t[15]=L,t[16]=B):B=t[16],t[17]!==l?(U=Jt(l,"w-full px-4 py-1 my-1 h-9 font-mono text-foreground/60"),t[17]=l,t[18]=U):U=t[18],t[19]!==z||t[20]!==o||t[21]!==B||t[22]!==U?(V=p.jsx(nn,{children:p.jsx(Be,{"data-testid":"dir-completion-input",tabIndex:-1,rootClassName:"border-none justify-center px-1",spellCheck:"false",value:z,onKeyDown:ku,icon:null,ref:w,onValueChange:f,placeholder:o,autoComplete:"off",style:B,className:U})}),t[19]=z,t[20]=o,t[21]=B,t[22]=U,t[23]=V):V=t[23];const $=F&&"group-focus-within:block";let G,H,W,q;return t[24]!==$?(G=Jt("p-0 w-full min-w-80 max-w-80vw hidden",$),t[24]=$,t[25]=G):G=t[25],t[26]!==G||t[27]!==F?(H=p.jsx(on,{side:"bottom",className:G,portal:!1,children:F}),t[26]=G,t[27]=F,t[28]=H):H=t[28],t[29]!==V||t[30]!==H?(W=p.jsxs(Ue,{children:[V,H]}),t[29]=V,t[30]=H,t[31]=W):W=t[31],t[32]!==_||t[33]!==W?(q=p.jsx(rn,{open:!0,modal:!1,children:p.jsx(an,{onFocus:S,onBlur:_,shouldFilter:!1,className:"bg-transparent group filename-input",children:W})}),t[32]=_,t[33]=W,t[34]=q):q=t[34],q};function ku(e){"Escape"===e.key&&e.currentTarget.blur()}const Nu=e=>{const t=m(7),{filename:n,setFilename:o}=e;let r;t[0]!==n?(r=n?lt.basename(n):"untitled marimo app",t[0]=n,t[1]=r):r=t[1];const a=null===n?"missing-filename":"filename";let s;return t[2]!==r||t[3]!==n||t[4]!==o||t[5]!==a?(s=p.jsx(wu,{placeholderText:r,initialValue:n,onNameChange:o,flexibleWidth:!0,resetOnBlur:!0,"data-testid":"filename-input",className:a}),t[2]=r,t[3]=n,t[4]=o,t[5]=a,t[6]=s):s=t[6],s};function Eu(e){return[sn.of([{key:"Escape",preventDefault:!1,run:$d},{key:e.getHotkey("cell.selectNextOccurrence").key,preventDefault:!0,run:ln},{key:e.getHotkey("cell.findAndReplace").key,preventDefault:!0,run:Vd}]),cn(),ou,eu,ru]}var Cu=Object.defineProperty,Su=(e,t,n)=>(((e,t,n)=>{t in e?Cu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n);const ju=Vt.define({create:()=>({suggestion:null}),update(e,t){const n=t.effects.find((e=>e.is(_u)));return t.state.doc&&n&&t.state.doc==n.value.doc?{suggestion:n.value.text}:{suggestion:null}}}),_u=Ut.define();class Iu extends un{constructor(e){super(),Su(this,"suggestion"),this.suggestion=e}toDOM(){const e=document.createElement("span");return e.style.opacity="0.4",e.className="cm-inline-suggestion",e.textContent=this.suggestion,e}get lineBreaks(){return this.suggestion.split("\n").length-1}}const Au=e=>Gt.fromClass(class{async update(t){const n=t.state.doc;if(!t.docChanged)return;const o=await e(t.state);t.view.dispatch({effects:_u.of({text:o,doc:n})})}}),Mu=Gt.fromClass(class{constructor(){Su(this,"decorations"),this.decorations=$t.none}update(e){var t;const n=null==(t=e.state.field(ju))?void 0:t.suggestion;this.decorations=n?function(e,t){const n=e.state.selection.main.head,o=[],r=$t.widget({widget:new Iu(t),side:1});return o.push(r.range(n)),$t.set(o)}(e.view,n):$t.none}},{decorations:e=>e.decorations}),Tu=dn.highest(sn.of([{key:"Tab",run:e=>{var t;const n=null==(t=e.state.field(ju))?void 0:t.suggestion;return!!n&&(e.dispatch({...Ou(e.state,n,e.state.selection.main.head,e.state.selection.main.head)}),!0)}}]));function Ou(e,t,n,o){return{...e.changeByRange((r=>{if(r==e.selection.main)return{changes:{from:n,to:o,insert:t},range:zt.cursor(n+t.length)};const a=o-n;return!r.empty||a&&e.sliceDoc(r.from-a,r.from)!=e.sliceDoc(n,o)?{range:r}:{changes:{from:r.from-a,to:r.from,insert:t},range:zt.cursor(r.from-a+t.length)}})),userEvent:"input.complete"}}function Du(e){const{delay:t=500}=e,n=function(e,t,n){let o=()=>{};return(...r)=>(o(),new Promise(((a,s)=>{const i=setTimeout((()=>a(e(...r))),t);o=()=>{clearTimeout(i),void 0!==n&&s(n)}})))}(e.fetchFn,t);return[ju,Au(n),Mu,Tu]}const Pu=Ut.define(),Ru=Ut.define(),Fu=Ut.define();function Lu(e,t){if(!e)throw new Error(t)}function zu(e){if("number"!=typeof e)throw new Error("invalid int 32: "+typeof e);if(!Number.isInteger(e)||e>2147483647||e<-2147483648)throw new Error("invalid int 32: "+e)}function Bu(e){if("number"!=typeof e)throw new Error("invalid uint 32: "+typeof e);if(!Number.isInteger(e)||e>4294967295||e<0)throw new Error("invalid uint 32: "+e)}function Uu(e){if("number"!=typeof e)throw new Error("invalid float 32: "+typeof e);if(Number.isFinite(e)&&(e>34028234663852886e22||e<-34028234663852886e22))throw new Error("invalid float 32: "+e)}const Vu=Symbol("@bufbuild/protobuf/enum-type");function $u(e){const t=e[Vu];return Lu(t,"missing enum type on enum object"),t}function Gu(e,t,n,o){e[Vu]=Hu(t,n.map((t=>({no:t.no,name:t.name,localName:e[t.no]}))))}function Hu(e,t,n){const o=Object.create(null),r=Object.create(null),a=[];for(const s of t){const e=qu(s);a.push(e),o[s.name]=e,r[s.no]=e}return{typeName:e,values:a,findName:e=>o[e],findNumber:e=>r[e]}}function Wu(e,t,n){const o={};for(const r of t){const e=qu(r);o[e.localName]=e.no,o[e.no]=e.localName}return Gu(o,e,t),o}function qu(e){return"localName"in e?e:Object.assign(Object.assign({},e),{localName:e.name})}class Yu{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,t){const n=this.getType().runtime.bin,o=n.makeReadOptions(t);return n.readMessage(this,o.readerFactory(e),e.byteLength,o),this}fromJson(e,t){const n=this.getType(),o=n.runtime.json,r=o.makeReadOptions(t);return o.readMessage(n,e,r,this),this}fromJsonString(e,t){let n;try{n=JSON.parse(e)}catch(o){throw new Error(`cannot decode ${this.getType().typeName} from JSON: ${o instanceof Error?o.message:String(o)}`)}return this.fromJson(n,t)}toBinary(e){const t=this.getType().runtime.bin,n=t.makeWriteOptions(e),o=n.writerFactory();return t.writeMessage(this,o,n),o.finish()}toJson(e){const t=this.getType().runtime.json,n=t.makeWriteOptions(e);return t.writeMessage(this,n)}toJsonString(e){var t;const n=this.toJson(e);return JSON.stringify(n,null,null!==(t=null==e?void 0:e.prettySpaces)&&void 0!==t?t:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}}function Ku(){let e=0,t=0;for(let o=0;o<28;o+=7){let n=this.buf[this.pos++];if(e|=(127&n)<<o,!(128&n))return this.assertBounds(),[e,t]}let n=this.buf[this.pos++];if(e|=(15&n)<<28,t=(112&n)>>4,!(128&n))return this.assertBounds(),[e,t];for(let o=3;o<=31;o+=7){let n=this.buf[this.pos++];if(t|=(127&n)<<o,!(128&n))return this.assertBounds(),[e,t]}throw new Error("invalid varint")}function Ju(e,t,n){for(let a=0;a<28;a+=7){const o=e>>>a,r=!(o>>>7==0&&0==t),s=255&(r?128|o:o);if(n.push(s),!r)return}const o=e>>>28&15|(7&t)<<4,r=!!(t>>3);if(n.push(255&(r?128|o:o)),r){for(let e=3;e<31;e+=7){const o=t>>>e,r=!(o>>>7==0),a=255&(r?128|o:o);if(n.push(a),!r)return}n.push(t>>>31&1)}}const Xu=4294967296;function Zu(e){const t="-"===e[0];t&&(e=e.slice(1));const n=1e6;let o=0,r=0;function a(t,a){const s=Number(e.slice(t,a));r*=n,o=o*n+s,o>=Xu&&(r+=o/Xu|0,o%=Xu)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?th(o,r):eh(o,r)}function Qu(e,t){if(({lo:e,hi:t}=function(e,t){return{lo:e>>>0,hi:t>>>0}}(e,t)),t<=2097151)return String(Xu*t+e);const n=16777215&(e>>>24|t<<8),o=t>>16&65535;let r=(16777215&e)+6777216*n+6710656*o,a=n+8147497*o,s=2*o;const i=1e7;return r>=i&&(a+=Math.floor(r/i),r%=i),a>=i&&(s+=Math.floor(a/i),a%=i),s.toString()+nh(a)+nh(r)}function eh(e,t){return{lo:0|e,hi:0|t}}function th(e,t){return t=~t,e?e=1+~e:t+=1,eh(e,t)}const nh=e=>{const t=String(e);return"0000000".slice(t.length)+t};function oh(e,t){if(e>=0){for(;e>127;)t.push(127&e|128),e>>>=7;t.push(e)}else{for(let n=0;n<9;n++)t.push(127&e|128),e>>=7;t.push(1)}}function rh(){let e=this.buf[this.pos++],t=127&e;if(!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<7,!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<14,!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<21,!(128&e))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(15&e)<<28;for(let n=5;128&e&&n<10;n++)e=this.buf[this.pos++];if(128&e)throw new Error("invalid varint");return this.assertBounds(),t>>>0}var ah={};const sh=function(){const e=new DataView(new ArrayBuffer(8));if("function"==typeof BigInt&&"function"==typeof e.getBigInt64&&"function"==typeof e.getBigUint64&&"function"==typeof e.setBigInt64&&"function"==typeof e.setBigUint64&&("object"!=typeof process||"1"!==ah.BUF_BIGINT_DISABLE)){const t=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),o=BigInt("0"),r=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(e){const o="bigint"==typeof e?e:BigInt(e);if(o>n||o<t)throw new Error(`int64 invalid: ${e}`);return o},uParse(e){const t="bigint"==typeof e?e:BigInt(e);if(t>r||t<o)throw new Error(`uint64 invalid: ${e}`);return t},enc(t){return e.setBigInt64(0,this.parse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(t){return e.setBigInt64(0,this.uParse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec:(t,n)=>(e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigInt64(0,!0)),uDec:(t,n)=>(e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigUint64(0,!0))}}const t=e=>Lu(/^-?[0-9]+$/.test(e),`int64 invalid: ${e}`),n=e=>Lu(/^[0-9]+$/.test(e),`uint64 invalid: ${e}`);return{zero:"0",supported:!1,parse:e=>("string"!=typeof e&&(e=e.toString()),t(e),e),uParse:e=>("string"!=typeof e&&(e=e.toString()),n(e),e),enc:e=>("string"!=typeof e&&(e=e.toString()),t(e),Zu(e)),uEnc:e=>("string"!=typeof e&&(e=e.toString()),n(e),Zu(e)),dec:(e,t)=>function(e,t){let n=eh(e,t);const o=2147483648&n.hi;o&&(n=th(n.lo,n.hi));const r=Qu(n.lo,n.hi);return o?"-"+r:r}(e,t),uDec:(e,t)=>Qu(e,t)}}();var ih,lh,ch,dh,uh,hh;function mh(e,t,n){if(t===n)return!0;if(e==ih.BYTES){if(!(t instanceof Uint8Array&&n instanceof Uint8Array))return!1;if(t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e]!==n[e])return!1;return!0}switch(e){case ih.UINT64:case ih.FIXED64:case ih.INT64:case ih.SFIXED64:case ih.SINT64:return t==n}return!1}function fh(e,t){switch(e){case ih.BOOL:return!1;case ih.UINT64:case ih.FIXED64:case ih.INT64:case ih.SFIXED64:case ih.SINT64:return 0==t?sh.zero:"0";case ih.DOUBLE:case ih.FLOAT:return 0;case ih.BYTES:return new Uint8Array(0);case ih.STRING:return"";default:return 0}}function ph(e,t){switch(e){case ih.BOOL:return!1===t;case ih.STRING:return""===t;case ih.BYTES:return t instanceof Uint8Array&&!t.byteLength;default:return 0==t}}(lh=ih||(ih={}))[lh.DOUBLE=1]="DOUBLE",lh[lh.FLOAT=2]="FLOAT",lh[lh.INT64=3]="INT64",lh[lh.UINT64=4]="UINT64",lh[lh.INT32=5]="INT32",lh[lh.FIXED64=6]="FIXED64",lh[lh.FIXED32=7]="FIXED32",lh[lh.BOOL=8]="BOOL",lh[lh.STRING=9]="STRING",lh[lh.BYTES=12]="BYTES",lh[lh.UINT32=13]="UINT32",lh[lh.SFIXED32=15]="SFIXED32",lh[lh.SFIXED64=16]="SFIXED64",lh[lh.SINT32=17]="SINT32",lh[lh.SINT64=18]="SINT64",(dh=ch||(ch={}))[dh.BIGINT=0]="BIGINT",dh[dh.STRING=1]="STRING",(hh=uh||(uh={}))[hh.Varint=0]="Varint",hh[hh.Bit64=1]="Bit64",hh[hh.LengthDelimited=2]="LengthDelimited",hh[hh.StartGroup=3]="StartGroup",hh[hh.EndGroup=4]="EndGroup",hh[hh.Bit32=5]="Bit32";class gh{constructor(e){this.stack=[],this.textEncoder=null!=e?e:new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let o=0;o<this.chunks.length;o++)e+=this.chunks[o].length;let t=new Uint8Array(e),n=0;for(let o=0;o<this.chunks.length;o++)t.set(this.chunks[o],n),n+=this.chunks[o].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),t=this.stack.pop();if(!t)throw new Error("invalid state, fork stack empty");return this.chunks=t.chunks,this.buf=t.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(Bu(e);e>127;)this.buf.push(127&e|128),e>>>=7;return this.buf.push(e),this}int32(e){return zu(e),oh(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 t=this.textEncoder.encode(e);return this.uint32(t.byteLength),this.raw(t)}float(e){Uu(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){Bu(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){zu(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return zu(e),oh(e=(e<<1^e>>31)>>>0,this.buf),this}sfixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),o=sh.enc(e);return n.setInt32(0,o.lo,!0),n.setInt32(4,o.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),o=sh.uEnc(e);return n.setInt32(0,o.lo,!0),n.setInt32(4,o.hi,!0),this.raw(t)}int64(e){let t=sh.enc(e);return Ju(t.lo,t.hi,this.buf),this}sint64(e){let t=sh.enc(e),n=t.hi>>31;return Ju(t.lo<<1^n,(t.hi<<1|t.lo>>>31)^n,this.buf),this}uint64(e){let t=sh.uEnc(e);return Ju(t.lo,t.hi,this.buf),this}}class vh{constructor(e,t){this.varint64=Ku,this.uint32=rh,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=null!=t?t:new TextDecoder}tag(){let e=this.uint32(),t=e>>>3,n=7&e;if(t<=0||n<0||n>5)throw new Error("illegal tag: field no "+t+" wire type "+n);return[t,n]}skip(e,t){let n=this.pos;switch(e){case uh.Varint:for(;128&this.buf[this.pos++];);break;case uh.Bit64:this.pos+=4;case uh.Bit32:this.pos+=4;break;case uh.LengthDelimited:let n=this.uint32();this.pos+=n;break;case uh.StartGroup:for(;;){const[e,n]=this.tag();if(n===uh.EndGroup){if(void 0!==t&&e!==t)throw new Error("invalid end group tag");break}this.skip(n,e)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(n,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 sh.dec(...this.varint64())}uint64(){return sh.uDec(...this.varint64())}sint64(){let[e,t]=this.varint64(),n=-(1&e);return e=(e>>>1|(1&t)<<31)^n,t=t>>>1^n,sh.dec(e,t)}bool(){let[e,t]=this.varint64();return 0!==e||0!==t}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return sh.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return sh.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(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.textDecoder.decode(this.bytes())}}function xh(e){const t=e.field.localName,n=Object.create(null);return n[t]=function(e){const t=e.field;if(t.repeated)return[];if(void 0!==t.default)return t.default;switch(t.kind){case"enum":return t.T.values[0].no;case"scalar":return fh(t.T,t.L);case"message":const e=t.T,n=new e;return e.fieldWrapper?e.fieldWrapper.unwrapField(n):n;case"map":throw"map fields are not allowed to be extensions"}}(e),[n,()=>n[t]]}let yh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),bh=[];for(let tO=0;tO<yh.length;tO++)bh[yh[tO].charCodeAt(0)]=tO;bh["-".charCodeAt(0)]=yh.indexOf("+"),bh["_".charCodeAt(0)]=yh.indexOf("/");const wh={dec(e){let t=3*e.length/4;"="==e[e.length-2]?t-=2:"="==e[e.length-1]&&(t-=1);let n,o=new Uint8Array(t),r=0,a=0,s=0;for(let i=0;i<e.length;i++){if(n=bh[e.charCodeAt(i)],void 0===n)switch(e[i]){case"=":a=0;case"\n":case"\r":case"\t":case" ":continue;default:throw Error("invalid base64 string.")}switch(a){case 0:s=n,a=1;break;case 1:o[r++]=s<<2|(48&n)>>4,s=n,a=2;break;case 2:o[r++]=(15&s)<<4|(60&n)>>2,s=n,a=3;break;case 3:o[r++]=(3&s)<<6|n,a=0}}if(1==a)throw Error("invalid base64 string.");return o.subarray(0,r)},enc(e){let t,n="",o=0,r=0;for(let a=0;a<e.length;a++)switch(t=e[a],o){case 0:n+=yh[t>>2],r=(3&t)<<4,o=1;break;case 1:n+=yh[r|t>>4],r=(15&t)<<2,o=2;break;case 2:n+=yh[r|t>>6],n+=yh[63&t],o=0}return o&&(n+=yh[r],n+="=",1==o&&(n+="=")),n}};function kh(e,t,n){Ch(t,e);const o=t.runtime.bin.makeReadOptions(n),r=function(e,t){if(!t.repeated&&("enum"==t.kind||"scalar"==t.kind)){for(let n=e.length-1;n>=0;--n)if(e[n].no==t.no)return[e[n]];return[]}return e.filter((e=>e.no===t.no))}(e.getType().runtime.bin.listUnknownFields(e),t.field),[a,s]=xh(t);for(const i of r)t.runtime.bin.readField(a,o.readerFactory(i.data),t.field,i.wireType,o);return s()}function Nh(e,t,n,o){Ch(t,e);const r=t.runtime.bin.makeReadOptions(o),a=t.runtime.bin.makeWriteOptions(o);if(Eh(e,t)){const n=e.getType().runtime.bin.listUnknownFields(e).filter((e=>e.no!=t.field.no));e.getType().runtime.bin.discardUnknownFields(e);for(const t of n)e.getType().runtime.bin.onUnknownField(e,t.no,t.wireType,t.data)}const s=a.writerFactory();let i=t.field;i.opt||i.repeated||"enum"!=i.kind&&"scalar"!=i.kind||(i=Object.assign(Object.assign({},t.field),{opt:!0})),t.runtime.bin.writeField(i,n,s,a);const l=r.readerFactory(s.finish());for(;l.pos<l.len;){const[t,n]=l.tag(),o=l.skip(n,t);e.getType().runtime.bin.onUnknownField(e,t,n,o)}}function Eh(e,t){const n=e.getType();return t.extendee.typeName===n.typeName&&!!n.runtime.bin.listUnknownFields(e).find((e=>e.no==t.field.no))}function Ch(e,t){Lu(e.extendee.typeName==t.getType().typeName,`extension ${e.typeName} can only be applied to message ${e.extendee.typeName}`)}function Sh(e,t){const n=e.localName;if(e.repeated)return t[n].length>0;if(e.oneof)return t[e.oneof.localName].case===n;switch(e.kind){case"enum":case"scalar":return e.opt||e.req?void 0!==t[n]:"enum"==e.kind?t[n]!==e.T.values[0].no:!ph(e.T,t[n]);case"message":return void 0!==t[n];case"map":return Object.keys(t[n]).length>0}}function jh(e,t){const n=e.localName,o=!e.opt&&!e.req;if(e.repeated)t[n]=[];else if(e.oneof)t[e.oneof.localName]={case:void 0};else switch(e.kind){case"map":t[n]={};break;case"enum":t[n]=o?e.T.values[0].no:void 0;break;case"scalar":t[n]=o?fh(e.T,e.L):void 0;break;case"message":t[n]=void 0}}function _h(e,t){if(null===e||"object"!=typeof e)return!1;if(!Object.getOwnPropertyNames(Yu.prototype).every((t=>t in e&&"function"==typeof e[t])))return!1;const n=e.getType();return null!==n&&"function"==typeof n&&"typeName"in n&&"string"==typeof n.typeName&&(void 0===t||n.typeName==t.typeName)}function Ih(e,t){return _h(t)||!e.fieldWrapper?t:e.fieldWrapper.wrapField(t)}ih.DOUBLE,ih.FLOAT,ih.INT64,ih.UINT64,ih.INT32,ih.UINT32,ih.BOOL,ih.STRING,ih.BYTES;const Ah={ignoreUnknownFields:!1},Mh={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function Th(e){return e?Object.assign(Object.assign({},Ah),e):Ah}function Oh(e){return e?Object.assign(Object.assign({},Mh),e):Mh}const Dh=Symbol(),Ph=Symbol();function Rh(e){if(null===e)return"null";switch(typeof e){case"object":return Array.isArray(e)?"array":"object";case"string":return e.length>100?"string":`"${e.split('"').join('\\"')}"`;default:return String(e)}}function Fh(e,t,n,o,r){let a=n.localName;if(n.repeated){if(Lu("map"!=n.kind),null===t)return;if(!Array.isArray(t))throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${Rh(t)}`);const i=e[a];for(const e of t){if(null===e)throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${Rh(e)}`);switch(n.kind){case"message":i.push(n.T.fromJson(e,o));break;case"enum":const t=Bh(n.T,e,o.ignoreUnknownFields,!0);t!==Ph&&i.push(t);break;case"scalar":try{i.push(zh(n.T,e,n.L,!0))}catch(s){let t=`cannot decode field ${r.typeName}.${n.name} from JSON: ${Rh(e)}`;throw s instanceof Error&&s.message.length>0&&(t+=`: ${s.message}`),new Error(t)}}}}else if("map"==n.kind){if(null===t)return;if("object"!=typeof t||Array.isArray(t))throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${Rh(t)}`);const i=e[a];for(const[e,a]of Object.entries(t)){if(null===a)throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: map value null`);let l;try{l=Lh(n.K,e)}catch(s){let e=`cannot decode map key for field ${r.typeName}.${n.name} from JSON: ${Rh(t)}`;throw s instanceof Error&&s.message.length>0&&(e+=`: ${s.message}`),new Error(e)}switch(n.V.kind){case"message":i[l]=n.V.T.fromJson(a,o);break;case"enum":const e=Bh(n.V.T,a,o.ignoreUnknownFields,!0);e!==Ph&&(i[l]=e);break;case"scalar":try{i[l]=zh(n.V.T,a,ch.BIGINT,!0)}catch(s){let e=`cannot decode map value for field ${r.typeName}.${n.name} from JSON: ${Rh(t)}`;throw s instanceof Error&&s.message.length>0&&(e+=`: ${s.message}`),new Error(e)}}}}else switch(n.oneof&&(e=e[n.oneof.localName]={case:a},a="value"),n.kind){case"message":const i=n.T;if(null===t&&"google.protobuf.Value"!=i.typeName)return;let l=e[a];_h(l)?l.fromJson(t,o):(e[a]=l=i.fromJson(t,o),i.fieldWrapper&&!n.oneof&&(e[a]=i.fieldWrapper.unwrapField(l)));break;case"enum":const c=Bh(n.T,t,o.ignoreUnknownFields,!1);switch(c){case Dh:jh(n,e);break;case Ph:break;default:e[a]=c}break;case"scalar":try{const o=zh(n.T,t,n.L,!1);if(o===Dh)jh(n,e);else e[a]=o}catch(s){let e=`cannot decode field ${r.typeName}.${n.name} from JSON: ${Rh(t)}`;throw s instanceof Error&&s.message.length>0&&(e+=`: ${s.message}`),new Error(e)}}}function Lh(e,t){if(e===ih.BOOL)switch(t){case"true":t=!0;break;case"false":t=!1}return zh(e,t,ch.BIGINT,!0).toString()}function zh(e,t,n,o){if(null===t)return o?fh(e,n):Dh;switch(e){case ih.DOUBLE:case ih.FLOAT:if("NaN"===t)return Number.NaN;if("Infinity"===t)return Number.POSITIVE_INFINITY;if("-Infinity"===t)return Number.NEGATIVE_INFINITY;if(""===t)break;if("string"==typeof t&&t.trim().length!==t.length)break;if("string"!=typeof t&&"number"!=typeof t)break;const o=Number(t);if(Number.isNaN(o))break;if(!Number.isFinite(o))break;return e==ih.FLOAT&&Uu(o),o;case ih.INT32:case ih.FIXED32:case ih.SFIXED32:case ih.SINT32:case ih.UINT32:let a;if("number"==typeof t?a=t:"string"==typeof t&&t.length>0&&t.trim().length===t.length&&(a=Number(t)),void 0===a)break;return e==ih.UINT32||e==ih.FIXED32?Bu(a):zu(a),a;case ih.INT64:case ih.SFIXED64:case ih.SINT64:if("number"!=typeof t&&"string"!=typeof t)break;const s=sh.parse(t);return n?s.toString():s;case ih.FIXED64:case ih.UINT64:if("number"!=typeof t&&"string"!=typeof t)break;const i=sh.uParse(t);return n?i.toString():i;case ih.BOOL:if("boolean"!=typeof t)break;return t;case ih.STRING:if("string"!=typeof t)break;try{encodeURIComponent(t)}catch(r){throw new Error("invalid UTF8")}return t;case ih.BYTES:if(""===t)return new Uint8Array(0);if("string"!=typeof t)break;return wh.dec(t)}throw new Error}function Bh(e,t,n,o){if(null===t)return"google.protobuf.NullValue"==e.typeName?0:o?e.values[0].no:Dh;switch(typeof t){case"number":if(Number.isInteger(t))return t;break;case"string":const o=e.findName(t);if(void 0!==o)return o.no;if(n)return Ph}throw new Error(`cannot decode enum ${e.typeName} from JSON: ${Rh(t)}`)}function Uh(e){return!(!e.repeated&&"map"!=e.kind)||!e.oneof&&("message"!=e.kind&&(!e.opt&&!e.req))}function Vh(e,t,n){if("map"==e.kind){Lu("object"==typeof t&&null!=t);const o={},r=Object.entries(t);switch(e.V.kind){case"scalar":for(const[n,a]of r)o[n.toString()]=Gh(e.V.T,a);break;case"message":for(const[e,a]of r)o[e.toString()]=a.toJson(n);break;case"enum":const t=e.V.T;for(const[e,a]of r)o[e.toString()]=$h(t,a,n.enumAsInteger)}return n.emitDefaultValues||r.length>0?o:void 0}if(e.repeated){Lu(Array.isArray(t));const o=[];switch(e.kind){case"scalar":for(let n=0;n<t.length;n++)o.push(Gh(e.T,t[n]));break;case"enum":for(let r=0;r<t.length;r++)o.push($h(e.T,t[r],n.enumAsInteger));break;case"message":for(let e=0;e<t.length;e++)o.push(t[e].toJson(n))}return n.emitDefaultValues||o.length>0?o:void 0}switch(e.kind){case"scalar":return Gh(e.T,t);case"enum":return $h(e.T,t,n.enumAsInteger);case"message":return Ih(e.T,t).toJson(n)}}function $h(e,t,n){var o;if(Lu("number"==typeof t),"google.protobuf.NullValue"==e.typeName)return null;if(n)return t;const r=e.findNumber(t);return null!==(o=null==r?void 0:r.name)&&void 0!==o?o:t}function Gh(e,t){switch(e){case ih.INT32:case ih.SFIXED32:case ih.SINT32:case ih.FIXED32:case ih.UINT32:return Lu("number"==typeof t),t;case ih.FLOAT:case ih.DOUBLE:return Lu("number"==typeof t),Number.isNaN(t)?"NaN":t===Number.POSITIVE_INFINITY?"Infinity":t===Number.NEGATIVE_INFINITY?"-Infinity":t;case ih.STRING:return Lu("string"==typeof t),t;case ih.BOOL:return Lu("boolean"==typeof t),t;case ih.UINT64:case ih.FIXED64:case ih.INT64:case ih.SFIXED64:case ih.SINT64:return Lu("bigint"==typeof t||"string"==typeof t||"number"==typeof t),t.toString();case ih.BYTES:return Lu(t instanceof Uint8Array),wh.enc(t)}}const Hh=Symbol("@bufbuild/protobuf/unknown-fields"),Wh={readUnknownFields:!0,readerFactory:e=>new vh(e)},qh={writeUnknownFields:!0,writerFactory:()=>new gh};function Yh(e){return e?Object.assign(Object.assign({},Wh),e):Wh}function Kh(e){return e?Object.assign(Object.assign({},qh),e):qh}function Jh(e,t,n,o,r){let{repeated:a,localName:s}=n;switch(n.oneof&&((e=e[n.oneof.localName]).case!=s&&delete e.value,e.case=s,s="value"),n.kind){case"scalar":case"enum":const i="enum"==n.kind?ih.INT32:n.T;let l=Qh;if("scalar"==n.kind&&n.L>0&&(l=Zh),a){let n=e[s];if(o==uh.LengthDelimited&&i!=ih.STRING&&i!=ih.BYTES){let e=t.uint32()+t.pos;for(;t.pos<e;)n.push(l(t,i))}else n.push(l(t,i))}else e[s]=l(t,i);break;case"message":const c=n.T;a?e[s].push(Xh(t,new c,r,n)):_h(e[s])?Xh(t,e[s],r,n):(e[s]=Xh(t,new c,r,n),!c.fieldWrapper||n.oneof||n.repeated||(e[s]=c.fieldWrapper.unwrapField(e[s])));break;case"map":let[d,u]=function(e,t,n){const o=t.uint32(),r=t.pos+o;let a,s;for(;t.pos<r;){const[o]=t.tag();switch(o){case 1:a=Qh(t,e.K);break;case 2:switch(e.V.kind){case"scalar":s=Qh(t,e.V.T);break;case"enum":s=t.int32();break;case"message":s=Xh(t,new e.V.T,n,void 0)}}}void 0===a&&(a=fh(e.K,ch.BIGINT));"string"!=typeof a&&"number"!=typeof a&&(a=a.toString());if(void 0===s)switch(e.V.kind){case"scalar":s=fh(e.V.T,ch.BIGINT);break;case"enum":s=e.V.T.values[0].no;break;case"message":s=new e.V.T}return[a,s]}(n,t,r);e[s][d]=u}}function Xh(e,t,n,o){const r=t.getType().runtime.bin,a=null==o?void 0:o.delimited;return r.readMessage(t,e,a?o.no:e.uint32(),n,a),t}function Zh(e,t){const n=Qh(e,t);return"bigint"==typeof n?n.toString():n}function Qh(e,t){switch(t){case ih.STRING:return e.string();case ih.BOOL:return e.bool();case ih.DOUBLE:return e.double();case ih.FLOAT:return e.float();case ih.INT32:return e.int32();case ih.INT64:return e.int64();case ih.UINT64:return e.uint64();case ih.FIXED64:return e.fixed64();case ih.BYTES:return e.bytes();case ih.FIXED32:return e.fixed32();case ih.SFIXED32:return e.sfixed32();case ih.SFIXED64:return e.sfixed64();case ih.SINT64:return e.sint64();case ih.UINT32:return e.uint32();case ih.SINT32:return e.sint32()}}function em(e,t,n,o){Lu(void 0!==t);const r=e.repeated;switch(e.kind){case"scalar":case"enum":let a="enum"==e.kind?ih.INT32:e.T;if(r)if(Lu(Array.isArray(t)),e.packed)!function(e,t,n,o){if(!o.length)return;e.tag(n,uh.LengthDelimited).fork();let[,r]=rm(t);for(let a=0;a<o.length;a++)e[r](o[a]);e.join()}(n,a,e.no,t);else for(const o of t)om(n,a,e.no,o);else om(n,a,e.no,t);break;case"message":if(r){Lu(Array.isArray(t));for(const r of t)nm(n,o,e,r)}else nm(n,o,e,t);break;case"map":Lu("object"==typeof t&&null!=t);for(const[r,s]of Object.entries(t))tm(n,o,e,r,s)}}function tm(e,t,n,o,r){e.tag(n.no,uh.LengthDelimited),e.fork();let a=o;switch(n.K){case ih.INT32:case ih.FIXED32:case ih.UINT32:case ih.SFIXED32:case ih.SINT32:a=Number.parseInt(o);break;case ih.BOOL:Lu("true"==o||"false"==o),a="true"==o}switch(om(e,n.K,1,a),n.V.kind){case"scalar":om(e,n.V.T,2,r);break;case"enum":om(e,ih.INT32,2,r);break;case"message":Lu(void 0!==r),e.tag(2,uh.LengthDelimited).bytes(r.toBinary(t))}e.join()}function nm(e,t,n,o){const r=Ih(n.T,o);n.delimited?e.tag(n.no,uh.StartGroup).raw(r.toBinary(t)).tag(n.no,uh.EndGroup):e.tag(n.no,uh.LengthDelimited).bytes(r.toBinary(t))}function om(e,t,n,o){Lu(void 0!==o);let[r,a]=rm(t);e.tag(n,r)[a](o)}function rm(e){let t=uh.Varint;switch(e){case ih.BYTES:case ih.STRING:t=uh.LengthDelimited;break;case ih.DOUBLE:case ih.FIXED64:case ih.SFIXED64:t=uh.Bit64;break;case ih.FIXED32:case ih.SFIXED32:case ih.FLOAT:t=uh.Bit32}return[t,ih[e].toLowerCase()]}function am(e){if(void 0===e)return e;if(_h(e))return e.clone();if(e instanceof Uint8Array){const t=new Uint8Array(e.byteLength);return t.set(e),t}return e}function sm(e){return e instanceof Uint8Array?e:new Uint8Array(e)}class im{constructor(e,t){this._fields=e,this._normalizer=t}findJsonName(e){if(!this.jsonNames){const e={};for(const t of this.list())e[t.jsonName]=e[t.name]=t;this.jsonNames=e}return this.jsonNames[e]}find(e){if(!this.numbers){const e={};for(const t of this.list())e[t.no]=t;this.numbers=e}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,t)=>e.no-t.no))),this.numbersAsc}byMember(){if(!this.members){this.members=[];const e=this.members;let t;for(const n of this.list())n.oneof?n.oneof!==t&&(t=n.oneof,e.push(t)):e.push(n)}return this.members}}function lm(e,t){const n=dm(e);return t?n:pm(fm(n))}const cm=dm;function dm(e){let t=!1;const n=[];for(let o=0;o<e.length;o++){let r=e.charAt(o);switch(r){case"_":t=!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),t=!1;break;default:t&&(t=!1,r=r.toUpperCase()),n.push(r)}}return n.join("")}const um=new Set(["constructor","toString","toJSON","valueOf"]),hm=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),mm=e=>`${e}$`,fm=e=>hm.has(e)?mm(e):e,pm=e=>um.has(e)?mm(e):e;class gm{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=lm(e,!1)}addField(e){Lu(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 e=0;e<this.fields.length;e++)this._lookup[this.fields[e].localName]=this.fields[e]}return this._lookup[e]}}const vm=(xm=e=>new im(e,(e=>function(e){var t,n,o,r,a,s;const i=[];let l;for(const c of"function"==typeof e?e():e){const e=c;if(e.localName=lm(c.name,void 0!==c.oneof),e.jsonName=null!==(t=c.jsonName)&&void 0!==t?t:cm(c.name),e.repeated=null!==(n=c.repeated)&&void 0!==n&&n,"scalar"==c.kind&&(e.L=null!==(o=c.L)&&void 0!==o?o:ch.BIGINT),e.delimited=null!==(r=c.delimited)&&void 0!==r&&r,e.req=null!==(a=c.req)&&void 0!==a&&a,e.opt=null!==(s=c.opt)&&void 0!==s&&s,void 0===c.packed&&(e.packed="enum"==c.kind||"scalar"==c.kind&&c.T!=ih.BYTES&&c.T!=ih.STRING),void 0!==c.oneof){const t="string"==typeof c.oneof?c.oneof:c.oneof.name;l&&l.name==t||(l=new gm(t)),e.oneof=l,l.addField(e)}i.push(e)}return i}(e))),ym=e=>{for(const t of e.getType().fields.byMember()){if(t.opt)continue;const n=t.localName,o=e;if(t.repeated)o[n]=[];else switch(t.kind){case"oneof":o[n]={case:void 0};break;case"enum":o[n]=0;break;case"map":o[n]={};break;case"scalar":o[n]=fh(t.T,t.L)}}},{syntax:"proto3",json:{makeReadOptions:Th,makeWriteOptions:Oh,readMessage(e,t,n,o){if(null==t||Array.isArray(t)||"object"!=typeof t)throw new Error(`cannot decode message ${e.typeName} from JSON: ${Rh(t)}`);o=null!=o?o:new e;const r=new Map,a=n.typeRegistry;for(const[s,i]of Object.entries(t)){const t=e.fields.findJsonName(s);if(t){if(t.oneof){if(null===i&&"scalar"==t.kind)continue;const n=r.get(t.oneof);if(void 0!==n)throw new Error(`cannot decode message ${e.typeName} from JSON: multiple keys for oneof "${t.oneof.name}" present: "${n}", "${s}"`);r.set(t.oneof,s)}Fh(o,i,t,n,e)}else{let t=!1;if((null==a?void 0:a.findExtension)&&s.startsWith("[")&&s.endsWith("]")){const r=a.findExtension(s.substring(1,s.length-1));if(r&&r.extendee.typeName==e.typeName){t=!0;const[e,a]=xh(r);Fh(e,i,r.field,n,r),Nh(o,r,a(),n)}}if(!t&&!n.ignoreUnknownFields)throw new Error(`cannot decode message ${e.typeName} from JSON: key "${s}" is unknown`)}}return o},writeMessage(e,t){const n=e.getType(),o={};let r;try{for(r of n.fields.byNumber()){if(!Sh(r,e)){if(r.req)throw"required field not set";if(!t.emitDefaultValues)continue;if(!Uh(r))continue}const n=Vh(r,r.oneof?e[r.oneof.localName].value:e[r.localName],t);void 0!==n&&(o[t.useProtoFieldName?r.name:r.jsonName]=n)}const a=t.typeRegistry;if(null==a?void 0:a.findExtensionFor)for(const r of n.runtime.bin.listUnknownFields(e)){const s=a.findExtensionFor(n.typeName,r.no);if(s&&Eh(e,s)){const n=kh(e,s,t),r=Vh(s.field,n,t);void 0!==r&&(o[s.field.jsonName]=r)}}}catch(a){const e=r?`cannot encode field ${n.typeName}.${r.name} to JSON`:`cannot encode message ${n.typeName} to JSON`,t=a instanceof Error?a.message:String(a);throw new Error(e+(t.length>0?`: ${t}`:""))}return o},readScalar:(e,t,n)=>zh(e,t,null!=n?n:ch.BIGINT,!0),writeScalar(e,t,n){if(void 0!==t)return n||ph(e,t)?Gh(e,t):void 0},debug:Rh},bin:{makeReadOptions:Yh,makeWriteOptions:Kh,listUnknownFields(e){var t;return null!==(t=e[Hh])&&void 0!==t?t:[]},discardUnknownFields(e){delete e[Hh]},writeUnknownFields(e,t){const n=e[Hh];if(n)for(const o of n)t.tag(o.no,o.wireType).raw(o.data)},onUnknownField(e,t,n,o){const r=e;Array.isArray(r[Hh])||(r[Hh]=[]),r[Hh].push({no:t,wireType:n,data:o})},readMessage(e,t,n,o,r){const a=e.getType(),s=r?t.len:t.pos+n;let i,l;for(;t.pos<s&&([i,l]=t.tag(),!0!==r||l!=uh.EndGroup);){const n=a.fields.find(i);if(n)Jh(e,t,n,l,o);else{const n=t.skip(l,i);o.readUnknownFields&&this.onUnknownField(e,i,l,n)}}if(r&&(l!=uh.EndGroup||i!==n))throw new Error("invalid end group tag")},readField:Jh,writeMessage(e,t,n){const o=e.getType();for(const r of o.fields.byNumber())if(Sh(r,e))em(r,r.oneof?e[r.oneof.localName].value:e[r.localName],t,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(e,t),t},writeField(e,t,n,o){void 0!==t&&em(e,t,n,o)}},util:Object.assign(Object.assign({},{setEnumType:Gu,initPartial(e,t){if(void 0===e)return;const n=t.getType();for(const o of n.fields.byMember()){const n=o.localName,r=t,a=e;if(null!=a[n])switch(o.kind){case"oneof":const e=a[n].case;if(void 0===e)continue;const t=o.findField(e);let s=a[n].value;t&&"message"==t.kind&&!_h(s,t.T)?s=new t.T(s):t&&"scalar"===t.kind&&t.T===ih.BYTES&&(s=sm(s)),r[n]={case:e,value:s};break;case"scalar":case"enum":let i=a[n];o.T===ih.BYTES&&(i=o.repeated?i.map(sm):sm(i)),r[n]=i;break;case"map":switch(o.V.kind){case"scalar":case"enum":if(o.V.T===ih.BYTES)for(const[t,o]of Object.entries(a[n]))r[n][t]=sm(o);else Object.assign(r[n],a[n]);break;case"message":const e=o.V.T;for(const t of Object.keys(a[n])){let o=a[n][t];e.fieldWrapper||(o=new e(o)),r[n][t]=o}}break;case"message":const l=o.T;if(o.repeated)r[n]=a[n].map((e=>_h(e,l)?e:new l(e)));else{const e=a[n];l.fieldWrapper?"google.protobuf.BytesValue"===l.typeName?r[n]=sm(e):r[n]=e:r[n]=_h(e,l)?e:new l(e)}}}},equals:(e,t,n)=>t===n||!(!t||!n)&&e.fields.byMember().every((e=>{const o=t[e.localName],r=n[e.localName];if(e.repeated){if(o.length!==r.length)return!1;switch(e.kind){case"message":return o.every(((t,n)=>e.T.equals(t,r[n])));case"scalar":return o.every(((t,n)=>mh(e.T,t,r[n])));case"enum":return o.every(((e,t)=>mh(ih.INT32,e,r[t])))}throw new Error(`repeated cannot contain ${e.kind}`)}switch(e.kind){case"message":return e.T.equals(o,r);case"enum":return mh(ih.INT32,o,r);case"scalar":return mh(e.T,o,r);case"oneof":if(o.case!==r.case)return!1;const t=e.findField(o.case);if(void 0===t)return!0;switch(t.kind){case"message":return t.T.equals(o.value,r.value);case"enum":return mh(ih.INT32,o.value,r.value);case"scalar":return mh(t.T,o.value,r.value)}throw new Error(`oneof cannot contain ${t.kind}`);case"map":const n=Object.keys(o).concat(Object.keys(r));switch(e.V.kind){case"message":const t=e.V.T;return n.every((e=>t.equals(o[e],r[e])));case"enum":return n.every((e=>mh(ih.INT32,o[e],r[e])));case"scalar":const a=e.V.T;return n.every((e=>mh(a,o[e],r[e])))}}})),clone(e){const t=e.getType(),n=new t,o=n;for(const r of t.fields.byMember()){const t=e[r.localName];let n;if(r.repeated)n=t.map(am);else if("map"==r.kind){n=o[r.localName];for(const[e,o]of Object.entries(t))n[e]=am(o)}else n="oneof"==r.kind?r.findField(t.case)?{case:t.case,value:am(t.value)}:{case:void 0}:am(t);o[r.localName]=n}for(const r of t.runtime.bin.listUnknownFields(e))t.runtime.bin.onUnknownField(o,r.no,r.wireType,r.data);return n}}),{newFieldList:xm,initFields:ym}),makeMessageType(e,t,n){return function(e,t,n,o){var r;const a=null!==(r=null==o?void 0:o.localName)&&void 0!==r?r:t.substring(t.lastIndexOf(".")+1),s={[a]:function(t){e.util.initFields(this),e.util.initPartial(t,this)}}[a];return Object.setPrototypeOf(s.prototype,new Yu),Object.assign(s,{runtime:e,typeName:t,fields:e.util.newFieldList(n),fromBinary:(e,t)=>(new s).fromBinary(e,t),fromJson:(e,t)=>(new s).fromJson(e,t),fromJsonString:(e,t)=>(new s).fromJsonString(e,t),equals:(t,n)=>e.util.equals(s,t,n)}),s}(this,e,t,n)},makeEnum:Wu,makeEnumType:Hu,getEnumType:$u,makeExtension(e,t,n){return function(e,t,n,o){let r;return{typeName:t,extendee:n,get field(){if(!r){const n="function"==typeof o?o():o;n.name=t.split(".").pop(),n.jsonName=`[${t}]`,r=e.util.newFieldList([n]).list()[0]}return r},runtime:e}}(this,e,t,n)}});var xm,ym,bm,wm,km,Nm,Em,Cm,Sm,jm,_m,Im,Am,Mm,Tm,Om;(wm=bm||(bm={}))[wm.Unary=0]="Unary",wm[wm.ServerStreaming=1]="ServerStreaming",wm[wm.ClientStreaming=2]="ClientStreaming",wm[wm.BiDiStreaming=3]="BiDiStreaming",(Nm=km||(km={}))[Nm.NoSideEffects=1]="NoSideEffects",Nm[Nm.Idempotent=2]="Idempotent",(Cm=Em||(Em={}))[Cm.UNSPECIFIED=0]="UNSPECIFIED",Cm[Cm.JUPYTER_FORMAT=77]="JUPYTER_FORMAT",vm.util.setEnumType(Em,"exa.codeium_common_pb.ExperimentKey",[{no:0,name:"UNSPECIFIED"},{no:77,name:"JUPYTER_FORMAT"}]),(jm=Sm||(Sm={}))[jm.CODEIUM=0]="CODEIUM",vm.util.setEnumType(Sm,"exa.codeium_common_pb.AuthSource",[{no:0,name:"AUTH_SOURCE_CODEIUM"}]),(Im=_m||(_m={}))[Im.UNSPECIFIED=0]="UNSPECIFIED",Im[Im.ENABLE_CODEIUM=1]="ENABLE_CODEIUM",Im[Im.DISABLE_CODEIUM=2]="DISABLE_CODEIUM",Im[Im.SHOW_PREVIOUS_COMPLETION=3]="SHOW_PREVIOUS_COMPLETION",Im[Im.SHOW_NEXT_COMPLETION=4]="SHOW_NEXT_COMPLETION",vm.util.setEnumType(_m,"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"}]),(Mm=Am||(Am={}))[Mm.UNSPECIFIED=0]="UNSPECIFIED",Mm[Mm.TYPING_AS_SUGGESTED=1]="TYPING_AS_SUGGESTED",Mm[Mm.CACHE=2]="CACHE",Mm[Mm.NETWORK=3]="NETWORK",vm.util.setEnumType(Am,"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"}]),(Om=Tm||(Tm={}))[Om.UNSPECIFIED=0]="UNSPECIFIED",Om[Om.C=1]="C",Om[Om.CLOJURE=2]="CLOJURE",Om[Om.COFFEESCRIPT=3]="COFFEESCRIPT",Om[Om.CPP=4]="CPP",Om[Om.CSHARP=5]="CSHARP",Om[Om.CSS=6]="CSS",Om[Om.CUDACPP=7]="CUDACPP",Om[Om.DOCKERFILE=8]="DOCKERFILE",Om[Om.GO=9]="GO",Om[Om.GROOVY=10]="GROOVY",Om[Om.HANDLEBARS=11]="HANDLEBARS",Om[Om.HASKELL=12]="HASKELL",Om[Om.HCL=13]="HCL",Om[Om.HTML=14]="HTML",Om[Om.INI=15]="INI",Om[Om.JAVA=16]="JAVA",Om[Om.JAVASCRIPT=17]="JAVASCRIPT",Om[Om.JSON=18]="JSON",Om[Om.JULIA=19]="JULIA",Om[Om.KOTLIN=20]="KOTLIN",Om[Om.LATEX=21]="LATEX",Om[Om.LESS=22]="LESS",Om[Om.LUA=23]="LUA",Om[Om.MAKEFILE=24]="MAKEFILE",Om[Om.MARKDOWN=25]="MARKDOWN",Om[Om.OBJECTIVEC=26]="OBJECTIVEC",Om[Om.OBJECTIVECPP=27]="OBJECTIVECPP",Om[Om.PERL=28]="PERL",Om[Om.PHP=29]="PHP",Om[Om.PLAINTEXT=30]="PLAINTEXT",Om[Om.PROTOBUF=31]="PROTOBUF",Om[Om.PBTXT=32]="PBTXT",Om[Om.PYTHON=33]="PYTHON",Om[Om.R=34]="R",Om[Om.RUBY=35]="RUBY",Om[Om.RUST=36]="RUST",Om[Om.SASS=37]="SASS",Om[Om.SCALA=38]="SCALA",Om[Om.SCSS=39]="SCSS",Om[Om.SHELL=40]="SHELL",Om[Om.SQL=41]="SQL",Om[Om.STARLARK=42]="STARLARK",Om[Om.SWIFT=43]="SWIFT",Om[Om.TSX=44]="TSX",Om[Om.TYPESCRIPT=45]="TYPESCRIPT",Om[Om.VISUALBASIC=46]="VISUALBASIC",Om[Om.VUE=47]="VUE",Om[Om.XML=48]="XML",Om[Om.XSL=49]="XSL",Om[Om.YAML=50]="YAML",Om[Om.SVELTE=51]="SVELTE",Om[Om.TOML=52]="TOML",Om[Om.DART=53]="DART",Om[Om.RST=54]="RST",Om[Om.OCAML=55]="OCAML",Om[Om.CMAKE=56]="CMAKE",Om[Om.PASCAL=57]="PASCAL",Om[Om.ELIXIR=58]="ELIXIR",Om[Om.FSHARP=59]="FSHARP",Om[Om.LISP=60]="LISP",Om[Om.MATLAB=61]="MATLAB",Om[Om.POWERSHELL=62]="POWERSHELL",Om[Om.SOLIDITY=63]="SOLIDITY",Om[Om.ADA=64]="ADA",Om[Om.OCAML_INTERFACE=65]="OCAML_INTERFACE",vm.util.setEnumType(Tm,"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 Dm=class e extends Yu{constructor(e){super(),n(this,"completionId",""),n(this,"text",""),n(this,"prefix",""),n(this,"stop",""),n(this,"score",0),n(this,"tokens",[]),n(this,"decodedTokens",[]),n(this,"probabilities",[]),n(this,"adjustedProbabilities",[]),n(this,"generatedLength",sh.zero),vm.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return vm.util.equals(e,t,n)}};n(Dm,"runtime",vm),n(Dm,"typeName","exa.codeium_common_pb.Completion"),n(Dm,"fields",vm.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 Pm=Dm;const Rm=class e extends Yu{constructor(e){super(),n(this,"ideName",""),n(this,"ideVersion",""),n(this,"extensionName",""),n(this,"extensionVersion",""),n(this,"apiKey",""),n(this,"locale",""),n(this,"sessionId",""),n(this,"requestId",sh.zero),n(this,"userAgent",""),n(this,"url",""),n(this,"authSource",Sm.CODEIUM),vm.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return vm.util.equals(e,t,n)}};n(Rm,"runtime",vm),n(Rm,"typeName","exa.codeium_common_pb.Metadata"),n(Rm,"fields",vm.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:vm.getEnumType(Sm)}])));let Fm=Rm;const Lm=class e extends Yu{constructor(e){super(),n(this,"tabSize",sh.zero),n(this,"insertSpaces",!1),vm.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return vm.util.equals(e,t,n)}};n(Lm,"runtime",vm),n(Lm,"typeName","exa.codeium_common_pb.EditorOptions"),n(Lm,"fields",vm.util.newFieldList((()=>[{no:1,name:"tab_size",kind:"scalar",T:4},{no:2,name:"insert_spaces",kind:"scalar",T:8}])));let zm=Lm;e=class extends Yu{constructor(e){super(),n(this,"eventType",_m.UNSPECIFIED),n(this,"eventJson",""),n(this,"timestampUnixMs",sh.zero),vm.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return vm.util.equals(e,t,n)}},n(e,"runtime",vm),n(e,"typeName","exa.codeium_common_pb.Event"),n(e,"fields",vm.util.newFieldList((()=>[{no:1,name:"event_type",kind:"enum",T:vm.getEnumType(_m)},{no:2,name:"event_json",kind:"scalar",T:9},{no:3,name:"timestamp_unix_ms",kind:"scalar",T:3}])));class Bm extends un{constructor(e,t){super(),n(this,"index"),n(this,"total"),this.index=e,this.total=t}toDOM(){const e=document.createElement("span");e.setAttribute("aria-hidden","true"),e.className="cm-codeium-cycle";const t=e.appendChild(document.createElement("span"));t.className="cm-codeium-cycle-explanation",t.innerText=`${this.index+1}/${this.total}`;const n=e.appendChild(document.createElement("button"));return n.className="cm-codeium-cycle-key",n.innerText="→ (Ctrl ])",n.dataset.action="codeium-cycle",e}ignoreEvent(){return!1}}const Um=hn.define({combine:e=>mn(e,{language:Tm.TYPESCRIPT,timeout:150,widgetClass:Bm,alwaysOn:!0},{})}),Vm=hn.define({combine:e=>mn(e,{override:()=>[]},{})}),$m=$t.mark({class:"cm-ghostText"}),Gm=Vt.define({create:e=>null,update(e,t){var n;const o=t.state.facet(Um);for(const r of t.effects){if(r.is(Pu)){const{changeSpecs:e,index:t}=r.value,a=e[t].map((e=>$m.range(e.absoluteStartPos,e.absoluteEndPos))),s=null==(n=a.at(-1))?void 0:n.to;return{index:t,decorations:$t.set([...a,...void 0!==s&&e.length>1&&o.widgetClass?[$t.widget({widget:new o.widgetClass(t,e.length),side:1}).range(s)]:[]]),changeSpecs:e,reverseChangeSet:r.value.reverseChangeSet}}if(r.is(Ru))return null;if(r.is(Fu))return null}return e?{...e,decorations:e.decorations.map(t.changes),reverseChangeSet:e.reverseChangeSet.map(t.changes)}:e},provide:e=>Bt.decorations.from(e,(e=>(null==e?void 0:e.decorations)||$t.none))}),Hm=fn.define(),Wm=fn.define();var qm,Ym;function Km(e){const t=qm[e];return"string"!=typeof t?e.toString():t[0].toLowerCase()+t.substring(1).replace(/[A-Z]/g,(e=>"_"+e.toLowerCase()))}let Jm;(Ym=qm||(qm={}))[Ym.Canceled=1]="Canceled",Ym[Ym.Unknown=2]="Unknown",Ym[Ym.InvalidArgument=3]="InvalidArgument",Ym[Ym.DeadlineExceeded=4]="DeadlineExceeded",Ym[Ym.NotFound=5]="NotFound",Ym[Ym.AlreadyExists=6]="AlreadyExists",Ym[Ym.PermissionDenied=7]="PermissionDenied",Ym[Ym.ResourceExhausted=8]="ResourceExhausted",Ym[Ym.FailedPrecondition=9]="FailedPrecondition",Ym[Ym.Aborted=10]="Aborted",Ym[Ym.OutOfRange=11]="OutOfRange",Ym[Ym.Unimplemented=12]="Unimplemented",Ym[Ym.Internal=13]="Internal",Ym[Ym.Unavailable=14]="Unavailable",Ym[Ym.DataLoss=15]="DataLoss",Ym[Ym.Unauthenticated=16]="Unauthenticated";class Xm extends Error{constructor(e,t=qm.Unknown,n,o,r){super(function(e,t){return e.length?`[${Km(t)}] ${e}`:`[${Km(t)}]`}(e,t)),this.name="ConnectError",Object.setPrototypeOf(this,new.target.prototype),this.rawMessage=e,this.code=t,this.metadata=new Headers(null!=n?n:{}),this.details=null!=o?o:[],this.cause=r}static from(e,t=qm.Unknown){return e instanceof Xm?e:e instanceof Error?"AbortError"==e.name?new Xm(e.message,qm.Canceled):new Xm(e.message,t,void 0,void 0,e):new Xm(String(e),t,void 0,void 0,e)}static[Symbol.hasInstance](e){return e instanceof Error&&(Object.getPrototypeOf(e)===Xm.prototype||"ConnectError"===e.name&&"code"in e&&"number"==typeof e.code&&"metadata"in e&&"details"in e&&Array.isArray(e.details)&&"rawMessage"in e&&"string"==typeof e.rawMessage&&"cause"in e)}findDetails(e){const t="typeName"in e?{findMessage:t=>t===e.typeName?e:void 0}:e,n=[];for(const r of this.details){if("getType"in r){t.findMessage(r.getType().typeName)&&n.push(r);continue}const e=t.findMessage(r.type);if(e)try{n.push(e.fromBinary(r.value))}catch(o){}}return n}}var Zm=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(n){t[n]=e[n]&&function(t){return new Promise((function(o,r){(function(e,t,n,o){Promise.resolve(o).then((function(t){e({value:t,done:n})}),t)})(o,r,(t=e[n](t)).done,t.value)}))}}},Qm=function(e){return this instanceof Qm?(this.v=e,this):new Qm(e)},ef=function(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(e,t||[]),a=[];return o={},s("next"),s("throw"),s("return",(function(e){return function(t){return Promise.resolve(t).then(e,c)}})),o[Symbol.asyncIterator]=function(){return this},o;function s(e,t){r[e]&&(o[e]=function(t){return new Promise((function(n,o){a.push([e,t,n,o])>1||i(e,t)}))},t&&(o[e]=t(o[e])))}function i(e,t){try{(n=r[e](t)).value instanceof Qm?Promise.resolve(n.value.v).then(l,c):d(a[0][2],n)}catch(o){d(a[0][3],o)}var n}function l(e){i("next",e)}function c(e){i("throw",e)}function d(e,t){e(t),a.shift(),a.length&&i(a[0][0],a[0][1])}};function tf(e){return ef(this,arguments,(function*(){yield Qm(yield*function(e){var t,n;return t={},o("next"),o("throw",(function(e){throw e})),o("return"),t[Symbol.iterator]=function(){return this},t;function o(o,r){t[o]=e[o]?function(t){return(n=!n)?{value:Qm(e[o](t)),done:!1}:r?r(t):t}:r}}(Zm(e)))}))}var nf=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(n){t[n]=e[n]&&function(t){return new Promise((function(o,r){(function(e,t,n,o){Promise.resolve(o).then((function(t){e({value:t,done:n})}),t)})(o,r,(t=e[n](t)).done,t.value)}))}}},of=function(e){return this instanceof of?(this.v=e,this):new of(e)},rf=function(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(e,t||[]),a=[];return o={},s("next"),s("throw"),s("return",(function(e){return function(t){return Promise.resolve(t).then(e,c)}})),o[Symbol.asyncIterator]=function(){return this},o;function s(e,t){r[e]&&(o[e]=function(t){return new Promise((function(n,o){a.push([e,t,n,o])>1||i(e,t)}))},t&&(o[e]=t(o[e])))}function i(e,t){try{(n=r[e](t)).value instanceof of?Promise.resolve(n.value.v).then(l,c):d(a[0][2],n)}catch(o){d(a[0][3],o)}var n}function l(e){i("next",e)}function c(e){i("throw",e)}function d(e,t){e(t),a.shift(),a.length&&i(a[0][0],a[0][1])}};function af(e,t){const n=function(){var n,o;return rf(this,arguments,(function*(){const r=yield of(e);null===(n=null==t?void 0:t.onHeader)||void 0===n||n.call(t,r.header),yield of(yield*function(e){var t,n;return t={},o("next"),o("throw",(function(e){throw e})),o("return"),t[Symbol.iterator]=function(){return this},t;function o(o,r){t[o]=e[o]?function(t){return(n=!n)?{value:of(e[o](t)),done:!1}:r?r(t):t}:r}}(nf(r.message))),null===(o=null==t?void 0:t.onTrailer)||void 0===o||o.call(t,r.trailer)}))}()[Symbol.asyncIterator]();return{[Symbol.asyncIterator]:()=>({next:()=>n.next()})}}function sf(e){if(!e.aborted)return;if(void 0!==e.reason)return e.reason;const t=new Error("This operation was aborted");return t.name="AbortError",t}function lf(){return{get(e){return e.id in this?this[e.id]:e.defaultValue},set(e,t){return this[e.id]=t,this},delete(e){return delete this[e.id],this}}}function cf(e,t,n){const o="string"==typeof t?t:t.typeName,r="string"==typeof n?n:n.name;return e.toString().replace(/\/?$/,`/${o}/${r}`)}function df(e,t){return t instanceof e?t:new e(t)}function uf(e,t){function n(t){return!0===t.done?t:{done:t.done,value:df(e,t.value)}}return{[Symbol.asyncIterator](){const e=t[Symbol.asyncIterator](),o={next:()=>e.next().then(n)};return void 0!==e.throw&&(o.throw=t=>e.throw(t).then(n)),void 0!==e.return&&(o.return=t=>e.return(t).then(n)),o}}}function hf(e,t){var n;return null!==(n=null==t?void 0:t.concat().reverse().reduce(((e,t)=>t(e)),e))&&void 0!==n?n:e}function mf(e){var t;const n=Object.assign({},e);return null!==(t=n.ignoreUnknownFields)&&void 0!==t||(n.ignoreUnknownFields=!0),n}function ff(e,t,n,o){const r=t?pf(e.I,o):gf(e.I,n);return{parse:(t?pf(e.O,o):gf(e.O,n)).parse,serialize:r.serialize}}function pf(e,t){return{parse(n){try{return e.fromBinary(n,t)}catch(o){const e=o instanceof Error?o.message:String(o);throw new Xm(`parse binary: ${e}`,qm.InvalidArgument)}},serialize(e){try{return e.toBinary(t)}catch(n){const e=n instanceof Error?n.message:String(n);throw new Xm(`serialize binary: ${e}`,qm.Internal)}}}}function gf(e,t){var n,o;const r=null!==(n=null==t?void 0:t.textEncoder)&&void 0!==n?n:new TextEncoder,a=null!==(o=null==t?void 0:t.textDecoder)&&void 0!==o?o:new TextDecoder,s=mf(t);return{parse(t){try{const n=a.decode(t);return e.fromJsonString(n,s)}catch(n){throw Xm.from(n,qm.InvalidArgument)}},serialize(e){try{const t=e.toJsonString(s);return r.encode(t)}catch(t){throw Xm.from(t,qm.Internal)}}}}const vf=/^application\/(connect\+)?(?:(json)(?:; ?charset=utf-?8)?|(proto))$/i;function xf(e,t,n){if(t&&new Headers(t).forEach(((e,t)=>n.metadata.append(t,e))),"object"!=typeof e||null==e||Array.isArray(e)||!("code"in e)||"string"!=typeof e.code)throw n;const o=function(e){if(!Jm){Jm={};for(const e of Object.values(qm))"string"!=typeof e&&(Jm[Km(e)]=e)}return Jm[e]}(e.code);if(void 0===o)throw n;const r=e.message;if(null!=r&&"string"!=typeof r)throw n;const a=new Xm(null!=r?r:"",o,t);if("details"in e&&Array.isArray(e.details))for(const i of e.details){if(null===i||"object"!=typeof i||Array.isArray(i)||"string"!=typeof i.type||"string"!=typeof i.value||"debug"in i&&"object"!=typeof i.debug)throw n;try{a.details.push({type:i.type,value:wh.dec(i.value),debug:i.debug})}catch(s){throw n}}return a}function yf(e){const t=new Xm("invalid end stream",qm.InvalidArgument);let n;try{n=JSON.parse("string"==typeof e?e:(new TextDecoder).decode(e))}catch(r){throw t}if("object"!=typeof n||null==n||Array.isArray(n))throw t;const o=new Headers;if("metadata"in n){if("object"!=typeof n.metadata||null==n.metadata||Array.isArray(n.metadata))throw t;for(const[e,r]of Object.entries(n.metadata)){if(!Array.isArray(r)||r.some((e=>"string"!=typeof e)))throw t;for(const t of r)o.append(e,t)}}return{metadata:o,error:"error"in n?xf(n.error,o,t):void 0}}const bf="Content-Type",wf="Content-Length",kf="Content-Encoding",Nf="Accept-Encoding",Ef="Connect-Protocol-Version";function Cf(e){const t=new Headers,n=new Headers;return e.forEach(((e,o)=>{o.toLowerCase().startsWith("trailer-")?n.set(o.substring(8),e):t.set(o,e)})),[t,n]}function Sf(e,t,n,o,r){const a=new Headers(null!=o?o:{});return void 0!==n&&a.set("Connect-Timeout-Ms",`${n}`),a.set(bf,e==bm.Unary?t?"application/proto":"application/json":t?"application/connect+proto":"application/connect+json"),a.set(Ef,"1"),a}function jf(e,t,n){const o=function(e){const t=null==e?void 0:e.match(vf);if(!t)return;return{stream:!!t[1],binary:!!t[3]}}(n.get("Content-Type"));if(200!==t){const r=new Xm(`HTTP ${t}`,function(e){switch(e){case 400:return qm.InvalidArgument;case 401:return qm.Unauthenticated;case 403:return qm.PermissionDenied;case 404:return qm.Unimplemented;case 408:return qm.DeadlineExceeded;case 409:return qm.Aborted;case 412:return qm.FailedPrecondition;case 413:case 431:return qm.ResourceExhausted;case 415:return qm.Internal;case 429:case 502:case 503:case 504:return qm.Unavailable;default:return qm.Unknown}}(t),n);if(e==bm.Unary&&o&&!o.binary)return{isUnaryError:!0,unaryError:r};throw r}return{isUnaryError:!1}}const _f="application/";function If(e,t,n){let o="?connect=v1";const r=e.header.get(bf);0===(null==r?void 0:r.indexOf(_f))&&(o+="&encoding="+encodeURIComponent(r.slice(12)));const a=e.header.get(kf);null!==a&&"identity"!==a&&(o+="&compression="+encodeURIComponent(a),n=!0),n&&(o+="&base64=1"),o+="&message="+function(e,t){return t?wh.enc(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""):encodeURIComponent((new TextDecoder).decode(e))}(t,n);const s=e.url+o,i=new Headers(e.header);return[Ef,bf,wf,kf,Nf].forEach((e=>i.delete(e))),Object.assign(Object.assign({},e),{init:Object.assign(Object.assign({},e.init),{method:"GET"}),url:s,header:i})}function Af(e){const{signal:t,cleanup:n}=function(e){const t=new AbortController,n=()=>{t.abort(new Xm("the operation timed out",qm.DeadlineExceeded))};let o;return void 0!==e&&(e<=0?n():o=setTimeout(n,e)),{signal:t.signal,cleanup:()=>clearTimeout(o)}}(e.timeoutMs),o=function(...e){const t=new AbortController,n=e.filter((e=>void 0!==e)).concat(t.signal);for(const r of n){if(r.aborted){o.apply(r);break}r.addEventListener("abort",o)}function o(){t.signal.aborted||t.abort(sf(this));for(const e of n)e.removeEventListener("abort",o)}return t}(e.signal,t);return[o.signal,function(e){const r=Xm.from(t.aborted?sf(t):e);return o.abort(r),n(),Promise.reject(r)},function(){n(),o.abort()}]}var Mf,Tf,Of,Df,Pf,Rf;(Tf=Mf||(Mf={}))[Tf.UNSPECIFIED=0]="UNSPECIFIED",Tf[Tf.INACTIVE=1]="INACTIVE",Tf[Tf.PROCESSING=2]="PROCESSING",Tf[Tf.SUCCESS=3]="SUCCESS",Tf[Tf.WARNING=4]="WARNING",Tf[Tf.ERROR=5]="ERROR",vm.util.setEnumType(Mf,"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"}]),(Df=Of||(Of={}))[Df.UNSPECIFIED=0]="UNSPECIFIED",Df[Df.SINGLE=1]="SINGLE",Df[Df.MULTI=2]="MULTI",vm.util.setEnumType(Of,"exa.language_server_pb.LineType",[{no:0,name:"LINE_TYPE_UNSPECIFIED"},{no:1,name:"LINE_TYPE_SINGLE"},{no:2,name:"LINE_TYPE_MULTI"}]),(Rf=Pf||(Pf={}))[Rf.UNSPECIFIED=0]="UNSPECIFIED",Rf[Rf.INLINE=1]="INLINE",Rf[Rf.BLOCK=2]="BLOCK",Rf[Rf.INLINE_MASK=3]="INLINE_MASK",vm.util.setEnumType(Pf,"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 Ff=class e extends Yu{constructor(e){super(),n(this,"threshold",0),vm.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return vm.util.equals(e,t,n)}};n(Ff,"runtime",vm),n(Ff,"typeName","exa.language_server_pb.MultilineConfig"),n(Ff,"fields",vm.util.newFieldList((()=>[{no:1,name:"threshold",kind:"scalar",T:2}])));let Lf=Ff;const zf=class e extends Yu{constructor(e){super(),n(this,"metadata"),n(this,"document"),n(this,"editorOptions"),n(this,"otherDocuments",[]),n(this,"experimentConfig"),n(this,"modelName",""),n(this,"multilineConfig"),vm.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return vm.util.equals(e,t,n)}};n(zf,"runtime",vm),n(zf,"typeName","exa.language_server_pb.GetCompletionsRequest"),n(zf,"fields",vm.util.newFieldList((()=>[{no:1,name:"metadata",kind:"message",T:Fm},{no:2,name:"document",kind:"message",T:ep},{no:3,name:"editor_options",kind:"message",T:zm},{no:5,name:"other_documents",kind:"message",T:ep,repeated:!0},{no:7,name:"experiment_config",kind:"message",T:np},{no:10,name:"model_name",kind:"scalar",T:9},{no:13,name:"multiline_config",kind:"message",T:Lf}])));let Bf=zf;const Uf=class e extends Yu{constructor(e){super(),n(this,"state"),n(this,"completionItems",[]),vm.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return vm.util.equals(e,t,n)}};n(Uf,"runtime",vm),n(Uf,"typeName","exa.language_server_pb.GetCompletionsResponse"),n(Uf,"fields",vm.util.newFieldList((()=>[{no:1,name:"state",kind:"message",T:rp},{no:2,name:"completion_items",kind:"message",T:hp,repeated:!0}])));let Vf=Uf;const $f=class e extends Yu{constructor(e){super(),n(this,"metadata"),n(this,"completionId",""),vm.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return vm.util.equals(e,t,n)}};n($f,"runtime",vm),n($f,"typeName","exa.language_server_pb.AcceptCompletionRequest"),n($f,"fields",vm.util.newFieldList((()=>[{no:1,name:"metadata",kind:"message",T:Fm},{no:2,name:"completion_id",kind:"scalar",T:9}])));let Gf=$f;const Hf=class e extends Yu{constructor(e){super(),vm.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return vm.util.equals(e,t,n)}};n(Hf,"runtime",vm),n(Hf,"typeName","exa.language_server_pb.AcceptCompletionResponse"),n(Hf,"fields",vm.util.newFieldList((()=>[])));let Wf=Hf;const qf=class e extends Yu{constructor(e){super(),vm.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return vm.util.equals(e,t,n)}};n(qf,"runtime",vm),n(qf,"typeName","exa.language_server_pb.GetAuthTokenRequest"),n(qf,"fields",vm.util.newFieldList((()=>[])));let Yf=qf;const Kf=class e extends Yu{constructor(e){super(),n(this,"authToken",""),n(this,"uuid",""),vm.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return vm.util.equals(e,t,n)}};n(Kf,"runtime",vm),n(Kf,"typeName","exa.language_server_pb.GetAuthTokenResponse"),n(Kf,"fields",vm.util.newFieldList((()=>[{no:1,name:"auth_token",kind:"scalar",T:9},{no:2,name:"uuid",kind:"scalar",T:9}])));let Jf=Kf;const Xf=class e extends Yu{constructor(e){super(),n(this,"row",sh.zero),n(this,"col",sh.zero),vm.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return vm.util.equals(e,t,n)}};n(Xf,"runtime",vm),n(Xf,"typeName","exa.language_server_pb.DocumentPosition"),n(Xf,"fields",vm.util.newFieldList((()=>[{no:1,name:"row",kind:"scalar",T:4},{no:2,name:"col",kind:"scalar",T:4}])));let Zf=Xf;const Qf=class e extends Yu{constructor(e){super(),n(this,"absolutePath",""),n(this,"relativePath",""),n(this,"text",""),n(this,"editorLanguage",""),n(this,"language",Tm.UNSPECIFIED),n(this,"cursorOffset",sh.zero),n(this,"cursorPosition"),n(this,"lineEnding",""),vm.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return vm.util.equals(e,t,n)}};n(Qf,"runtime",vm),n(Qf,"typeName","exa.language_server_pb.Document"),n(Qf,"fields",vm.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:vm.getEnumType(Tm)},{no:6,name:"cursor_offset",kind:"scalar",T:4},{no:8,name:"cursor_position",kind:"message",T:Zf},{no:7,name:"line_ending",kind:"scalar",T:9}])));let ep=Qf;const tp=class e extends Yu{constructor(e){super(),n(this,"forceEnableExperiments",[]),vm.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return vm.util.equals(e,t,n)}};n(tp,"runtime",vm),n(tp,"typeName","exa.language_server_pb.ExperimentConfig"),n(tp,"fields",vm.util.newFieldList((()=>[{no:1,name:"force_enable_experiments",kind:"enum",T:vm.getEnumType(Em),repeated:!0}])));let np=tp;const op=class e extends Yu{constructor(e){super(),n(this,"state",Mf.UNSPECIFIED),n(this,"message",""),vm.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return vm.util.equals(e,t,n)}};n(op,"runtime",vm),n(op,"typeName","exa.language_server_pb.State"),n(op,"fields",vm.util.newFieldList((()=>[{no:1,name:"state",kind:"enum",T:vm.getEnumType(Mf)},{no:2,name:"message",kind:"scalar",T:9}])));let rp=op;const ap=class e extends Yu{constructor(e){super(),n(this,"startOffset",sh.zero),n(this,"endOffset",sh.zero),n(this,"startPosition"),n(this,"endPosition"),vm.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return vm.util.equals(e,t,n)}};n(ap,"runtime",vm),n(ap,"typeName","exa.language_server_pb.Range"),n(ap,"fields",vm.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:Zf},{no:4,name:"end_position",kind:"message",T:Zf}])));let sp=ap;const ip=class e extends Yu{constructor(e){super(),n(this,"text",""),n(this,"deltaCursorOffset",sh.zero),vm.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return vm.util.equals(e,t,n)}};n(ip,"runtime",vm),n(ip,"typeName","exa.language_server_pb.Suffix"),n(ip,"fields",vm.util.newFieldList((()=>[{no:1,name:"text",kind:"scalar",T:9},{no:2,name:"delta_cursor_offset",kind:"scalar",T:3}])));let lp=ip;const cp=class e extends Yu{constructor(e){super(),n(this,"text",""),n(this,"offset",sh.zero),n(this,"type",Pf.UNSPECIFIED),n(this,"prefix",""),n(this,"line",sh.zero),vm.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return vm.util.equals(e,t,n)}};n(cp,"runtime",vm),n(cp,"typeName","exa.language_server_pb.CompletionPart"),n(cp,"fields",vm.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:vm.getEnumType(Pf)},{no:4,name:"prefix",kind:"scalar",T:9},{no:5,name:"line",kind:"scalar",T:4}])));let dp=cp;const up=class e extends Yu{constructor(e){super(),n(this,"completion"),n(this,"suffix"),n(this,"range"),n(this,"source",Am.UNSPECIFIED),n(this,"completionParts",[]),vm.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return vm.util.equals(e,t,n)}};n(up,"runtime",vm),n(up,"typeName","exa.language_server_pb.CompletionItem"),n(up,"fields",vm.util.newFieldList((()=>[{no:1,name:"completion",kind:"message",T:Pm},{no:5,name:"suffix",kind:"message",T:lp},{no:2,name:"range",kind:"message",T:sp},{no:3,name:"source",kind:"enum",T:vm.getEnumType(Am)},{no:8,name:"completion_parts",kind:"message",T:dp,repeated:!0}])));let hp=up;const mp={typeName:"exa.language_server_pb.LanguageServerService",methods:{getCompletions:{name:"GetCompletions",I:Bf,O:Vf,kind:bm.Unary},acceptCompletion:{name:"AcceptCompletion",I:Gf,O:Wf,kind:bm.Unary},getAuthToken:{name:"GetAuthToken",I:Yf,O:Jf,kind:bm.Unary}}};var fp=function(e){return this instanceof fp?(this.v=e,this):new fp(e)},pp=function(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(e,t||[]),a=[];return o={},s("next"),s("throw"),s("return",(function(e){return function(t){return Promise.resolve(t).then(e,c)}})),o[Symbol.asyncIterator]=function(){return this},o;function s(e,t){r[e]&&(o[e]=function(t){return new Promise((function(n,o){a.push([e,t,n,o])>1||i(e,t)}))},t&&(o[e]=t(o[e])))}function i(e,t){try{(n=r[e](t)).value instanceof fp?Promise.resolve(n.value.v).then(l,c):d(a[0][2],n)}catch(o){d(a[0][3],o)}var n}function l(e){i("next",e)}function c(e){i("throw",e)}function d(e,t){e(t),a.shift(),a.length&&i(a[0][0],a[0][1])}};const gp=function(e){var t;!function(){try{new Headers}catch(e){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=null!==(t=e.useBinaryFormat)&&void 0!==t&&t;return{async unary(t,o,r,a,s,i,l){var c;const{serialize:d,parse:u}=ff(o,n,e.jsonOptions,e.binaryOptions);return a=void 0===a?e.defaultTimeoutMs:a<=0?void 0:a,await function(e){const t=hf(e.next,e.interceptors),[n,o,r]=Af(e);return t(Object.assign(Object.assign({},e.req),{message:df(e.req.method.I,e.req.message),signal:n})).then((e=>(r(),e)),o)}({interceptors:e.interceptors,signal:r,timeoutMs:a,req:{stream:!1,service:t,method:o,url:cf(e.baseUrl,t,o),init:{method:"POST",credentials:null!==(c=e.credentials)&&void 0!==c?c:"same-origin",redirect:"error",mode:"cors"},header:Sf(o.kind,n,a,s),contextValues:null!=l?l:lf(),message:i},next:async r=>{var a;let s=null;!0===e.useHttpGet&&o.idempotency===km.NoSideEffects?r=If(r,d(r.message),n):s=d(r.message);const i=null!==(a=e.fetch)&&void 0!==a?a:globalThis.fetch,l=await i(r.url,Object.assign(Object.assign({},r.init),{headers:r.header,signal:r.signal,body:s})),{isUnaryError:c,unaryError:h}=jf(o.kind,l.status,l.headers);if(c)throw xf(await l.json(),function(...e){const t=new Headers;for(const n of e)n.forEach(((e,n)=>{t.append(n,e)}));return t}(...Cf(l.headers)),h);const[m,f]=Cf(l.headers);return{stream:!1,service:t,method:o,header:m,message:n?u(new Uint8Array(await l.arrayBuffer())):o.O.fromJson(await l.json(),mf(e.jsonOptions)),trailer:f}}})},async stream(t,o,r,a,s,i,l){var c;const{serialize:d,parse:u}=ff(o,n,e.jsonOptions,e.binaryOptions);function h(e,t,n){return pp(this,arguments,(function*(){const o=function(e){let t,n=new Uint8Array(0);function o(e){const t=new Uint8Array(n.length+e.length);t.set(n),t.set(e,n.length),n=t}return new ReadableStream({start(){t=e.getReader()},async pull(e){let r;for(;;){if(void 0===r&&n.byteLength>=5){let e=0;for(let t=1;t<5;t++)e=(e<<8)+n[t];r={flags:n[0],length:e}}if(void 0!==r&&n.byteLength>=r.length+5)break;const e=await t.read();if(e.done)break;o(e.value)}if(void 0===r)return 0==n.byteLength?void e.close():void e.error(new Xm("premature end of stream",qm.DataLoss));const a=n.subarray(5,5+r.length);n=n.subarray(5+r.length),e.enqueue({flags:r.flags,data:a})}})}(e).getReader();let r=!1;for(;;){const e=yield fp(o.read());if(e.done)break;const{flags:a,data:s}=e.value;if(2&~a)yield yield fp(u(s));else{r=!0;const e=yf(s);if(e.error){const t=e.error;throw n.forEach(((e,n)=>{t.metadata.append(n,e)})),t}e.metadata.forEach(((e,n)=>t.set(n,e)))}}if(!r)throw"missing EndStreamResponse"}))}async function m(e){if(o.kind!=bm.ServerStreaming)throw"The fetch API does not support streaming request bodies";const t=await e[Symbol.asyncIterator]().next();if(1==t.done)throw"missing request message";return function(e,t){const n=new Uint8Array(t.length+5);n.set(t,5);const o=new DataView(n.buffer,n.byteOffset,n.byteLength);return o.setUint8(0,e),o.setUint32(1,t.length),n}(0,d(t.value))}return a=void 0===a?e.defaultTimeoutMs:a<=0?void 0:a,await function(e){const t=hf(e.next,e.interceptors),[n,o,r]=Af(e),a=Object.assign(Object.assign({},e.req),{message:uf(e.req.method.I,e.req.message),signal:n});let s=!1;return n.addEventListener("abort",(function(){var t,n;const o=e.req.message[Symbol.asyncIterator]();s||null===(t=o.throw)||void 0===t||t.call(o,this.reason).catch((()=>{})),null===(n=o.return)||void 0===n||n.call(o).catch((()=>{}))})),t(a).then((e=>Object.assign(Object.assign({},e),{message:{[Symbol.asyncIterator](){const t=e.message[Symbol.asyncIterator]();return{next:()=>t.next().then((e=>(1==e.done&&(s=!0,r()),e)),o)}}}})),o)}({interceptors:e.interceptors,timeoutMs:a,signal:r,req:{stream:!0,service:t,method:o,url:cf(e.baseUrl,t,o),init:{method:"POST",credentials:null!==(c=e.credentials)&&void 0!==c?c:"same-origin",redirect:"error",mode:"cors"},header:Sf(o.kind,n,a,s),contextValues:null!=l?l:lf(),message:i},next:async t=>{var n;const r=null!==(n=e.fetch)&&void 0!==n?n:globalThis.fetch,a=await r(t.url,Object.assign(Object.assign({},t.init),{headers:t.header,signal:t.signal,body:await m(t.message)}));if(jf(o.kind,a.status,a.headers),null===a.body)throw"missing response body";const s=new Headers;return Object.assign(Object.assign({},t),{header:a.headers,trailer:s,message:h(a.body,s,a.headers)})}})}}}({baseUrl:"https://web-backend.codeium.com",useBinaryFormat:!0}),vp=(yp=gp,function(e,t){const n={};for(const[o,r]of Object.entries(e.methods)){const a=t(Object.assign(Object.assign({},r),{localName:o,service:e}));null!=a&&(n[o]=a)}return n}(xp=mp,(e=>{switch(e.kind){case bm.Unary:return function(e,t,n){return async function(o,r){var a,s;const i=await e.unary(t,n,null==r?void 0:r.signal,null==r?void 0:r.timeoutMs,null==r?void 0:r.headers,o,null==r?void 0:r.contextValues);return null===(a=null==r?void 0:r.onHeader)||void 0===a||a.call(r,i.header),null===(s=null==r?void 0:r.onTrailer)||void 0===s||s.call(r,i.trailer),i.message}}(yp,xp,e);case bm.ServerStreaming:return function(e,t,n){return function(o,r){return af(e.stream(t,n,null==r?void 0:r.signal,null==r?void 0:r.timeoutMs,null==r?void 0:r.headers,tf([o]),null==r?void 0:r.contextValues),r)}}(yp,xp,e);case bm.ClientStreaming:return function(e,t,n){return async function(o,r){var a,s,i,l,c,d;const u=await e.stream(t,n,null==r?void 0:r.signal,null==r?void 0:r.timeoutMs,null==r?void 0:r.headers,o,null==r?void 0:r.contextValues);let h;null===(c=null==r?void 0:r.onHeader)||void 0===c||c.call(r,u.header);try{for(var m,f=!0,p=nf(u.message);!(a=(m=await p.next()).done);f=!0)l=m.value,f=!1,h=l}catch(g){s={error:g}}finally{try{f||a||!(i=p.return)||await i.call(p)}finally{if(s)throw s.error}}if(!h)throw new Xm("protocol error: missing response message",qm.Internal);return null===(d=null==r?void 0:r.onTrailer)||void 0===d||d.call(r,u.trailer),h}}(yp,xp,e);case bm.BiDiStreaming:return function(e,t,n){return function(o,r){return af(e.stream(t,n,null==r?void 0:r.signal,null==r?void 0:r.timeoutMs,null==r?void 0:r.headers,o,null==r?void 0:r.contextValues),r)}}(yp,xp,e);default:return null}})));var xp,yp;let bp;try{bp=crypto.randomUUID()}catch{bp=function(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(e=>(+e^(crypto.getRandomValues(new Uint8Array(1))[0]??0)&15>>+e/4).toString(16)))}()}async function wp(e,t){const n=e.state.facet(Um),{override:o}=e.state.facet(Vm),r=await o(),a=e.state,s=a.selection.main.head,i=a.doc.toString();try{const o=await async function({text:e,cursorOffset:t,config:n,otherDocuments:o}){return await vp.getCompletions({metadata:{ideName:"web",ideVersion:"0.0.5",extensionName:"@valtown/codemirror-codeium",extensionVersion:"1.0.0",apiKey:n.apiKey,sessionId:bp,authSource:n.authSource},document:{text:e,cursorOffset:BigInt(t),language:n.language,editorLanguage:"typescript",lineEnding:"\n"},editorOptions:{tabSize:2n,insertSpaces:!0},otherDocuments:o,multilineConfig:void 0},{headers:{Authorization:`Basic ${n.apiKey}-${bp}`}})}({text:i,cursorOffset:s,config:n,otherDocuments:r});if(!o||0===o.completionItems.length)return;if(void 0!==t&&s!==t||"active"===pn(e.state)||!e.hasFocus)return;const l=o.completionItems.map((e=>{let t=0;return e.completionParts.filter((e=>3!==e.type)).map((e=>{const n=Number(e.offset),o=2===e.type?`\n${e.text}`:e.text,r={absoluteStartPos:t+n,absoluteEndPos:t+n+o.length,from:n,to:n,insert:o};return t+=o.length,r}))})),c=0,d=l.at(c);if(!d)return;const u=gn.of(d,a.doc.length),h=u.invert(a.doc);e.dispatch({changes:u,effects:Pu.of({index:c,reverseChangeSet:h,changeSpecs:l}),annotations:[Wm.of(null),Hm.of(null),vn.addToHistory.of(!1)]})}catch(l){console.warn("copilot completion failed",l),await new Promise((e=>setTimeout(e,300)))}}function kp(){let e=null,t=0;return Bt.updateListener.of((n=>{const o=n.view.state.facet(Um);if(!o.alwaysOn)return;if(!function(e){return e.docChanged&&!e.transactions.some((e=>e.effects.some((e=>e.is(Ru)||e.is(Fu)))))}(n))return;if(e&&clearTimeout(e),function(e){if(!e.view.hasFocus)return!0;if(e.state.field(Gm))return!0;if("active"===pn(e.state))return!0;for(const t of e.transactions)if(void 0!==t.annotation(Hm))return!0}(n))return;const r=n.state.selection.main.head;o.shouldComplete&&!o.shouldComplete(new xn(n.view.state,r,!1))||(e=setTimeout((async()=>{r===t&&await wp(n.view,t)}),o.timeout),t=r)}))}function Np(e){var t;const n=e.state.field(Gm);if(!n)return!1;const o=null==(t=n.reverseChangeSet)?void 0:t.invert(e.state.doc);e.dispatch({changes:n.reverseChangeSet,effects:Ru.of(null),annotations:[Wm.of(null),Hm.of(null),vn.addToHistory.of(!1)]});let r=0;return null==o||o.iterChangedRanges(((e,t,n,o)=>{r=o})),e.dispatch({changes:o,selection:zt.cursor(r),annotations:[Hm.of(null),vn.addToHistory.of(!0)]}),!0}const Ep=e=>{const{state:t}=e,n=t.field(Gm);if(!n)return!1;const{changeSpecs:o}=n;if(o.length<2)return!1;const r=(n.index+1)%o.length,a=o.at(r);if(!a)return!1;const s=n.reverseChangeSet.apply(t.doc),i=gn.of(n.reverseChangeSet,t.doc.length).compose(gn.of(a,s.length)),l=gn.of(a,s.length).invert(s);return e.dispatch({changes:i,effects:Pu.of({index:r,reverseChangeSet:l,changeSpecs:o}),annotations:[Wm.of(null),Hm.of(null),vn.addToHistory.of(!1)]}),!0};function Cp(e){const t=e.state.field(Gm);return!!t&&(e.dispatch({changes:t.reverseChangeSet,effects:Fu.of(null),annotations:[Wm.of(null),Hm.of(null),vn.addToHistory.of(!1)]}),!1)}function Sp(){return Bt.domEventHandlers({keydown:(e,t)=>("]"!==e.key||!e.ctrlKey)&&("Shift"!==e.key&&"Control"!==e.key&&"Alt"!==e.key&&"Meta"!==e.key&&function(e,t){return!!e.state.field(Gm)&&("Tab"===t?Np(e):Cp(e))}(t,e.key)),mouseup(e,t){const n=e.target;return"BUTTON"===n.nodeName&&"codeium-cycle"===n.dataset.action?(Ep(t),e.stopPropagation(),e.preventDefault(),!0):function(e){var t,n;let o=!1;const r=null==(t=e.state.selection.asSingle().ranges.at(0))?void 0:t.head,a=e.state.field(Gm);return!(void 0===r||!a)&&(null==(n=a.decorations)||n.between(r,r,(()=>{o=!0})),o)}(t)?Np(t):Cp(t)}})}const jp=e=>{const t=[];return"codeium"===e.copilot&&e.codeium_api_key&&t.push(function(e){return[Um.of(e),Gm,dn.highest(sn.of([{key:"Ctrl-]",run:Ep}])),dn.highest(Bt.updateListener.of((e=>{e.focusChanged&&Cp(e.view)}))),dn.high(Sp()),kp()]}({apiKey:e.codeium_api_key,language:Tm.PYTHON}),Vm.of({override:async()=>[{text:Ci(""),language:Tm.PYTHON,editorLanguage:"python"}]})),"github"===e.copilot&&t.push(Du({delay:500,fetchFn:async e=>{if(!ji())return"";if(0===e.doc.length)return"";await new Promise((e=>setTimeout(e,20)));const t=e.doc.toString(),n=function(e,t){const n=e.doc.toString(),o=t.split("\n").length-n.split("\n").length,r=function(e,t){const n=e.lineAt(t);return{line:n.number-1,character:t-n.from}}(e.doc,e.selection.main.head);return r.line+=o,{doc:{source:t,tabSize:e.tabSize,indentSize:1,insertSpaces:!0,path:Ii,version:"replace_me",uri:`file://${Ii}`,relativePath:Ii,languageId:Ai,position:r}}}(e,Ci(t)),o=function(e,t,n){if(0===e.completions.length)return"";const{displayText:o,position:r}=e.completions[0],a=r.character-t.character,s=a<0?o.slice(-a):o,i=n.doc.sliceString(n.selection.main.head,n.doc.length);for(let l=0;l<s.length;l++){const e=s.slice(l);if(i.startsWith(e))return s.slice(0,l)}return s}(await _i().getCompletion(n),n.doc.position,e);return o&&G.debug("Copilot suggestion:",o),o}})),[...t,Si().slice(0,-2)]};const _p=$t.mark({class:"underline"}),Ip=Ut.define(),Ap=Ut.define(),Mp=Vt.define({create:()=>$t.none,update(e,t){let n=e.map(t.changes);for(const o of t.effects)o.is(Ip)?n=e.update({add:[_p.range(o.value.from,o.value.to)]}):o.is(Ap)&&(n=$t.none);return n},provide:e=>Bt.decorations.from(e)});class Tp{constructor(e,t){this.view=void 0,this.commandClickMode=void 0,this.hoveredRange=void 0,this.onClick=void 0,this.keydown=e=>{"Meta"!==e.key&&"Control"!==e.key||(this.commandClickMode=!0,this.view.dom.addEventListener("mousemove",this.mousemove),this.view.dom.addEventListener("click",this.click))},this.keyup=e=>{"Meta"!==e.key&&"Control"!==e.key||this.exitCommandClickMode()},this.windowBlur=()=>{this.commandClickMode&&this.exitCommandClickMode()},this.mousemove=e=>{if(!e.metaKey&&!e.ctrlKey)return void this.exitCommandClickMode();if(!this.commandClickMode)return void this.clearUnderline();const t=this.view.posAtCoords({x:e.clientX,y:e.clientY});if(null==t)return void this.clearUnderline();const n=yn(this.view.state).cursorAt(t);if("VariableName"===n.name){const{from:e,to:o}=n;if(this.hoveredRange&&this.hoveredRange.from===e&&this.hoveredRange.to===o)return;this.clearUnderline(),this.hoveredRange={from:e,to:o,position:t},this.view.dispatch({effects:Ip.of(this.hoveredRange)})}else this.clearUnderline()},this.click=e=>{if(this.hoveredRange){const t=this.view.state.doc.sliceString(this.hoveredRange.from,this.hoveredRange.to);e.preventDefault(),e.stopPropagation(),this.onClick(this.view,t),this.view.dispatch({selection:{head:this.hoveredRange.position,anchor:this.hoveredRange.position}})}},this.view=e,this.commandClickMode=!1,this.hoveredRange=null,this.onClick=t,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:Ap.of(null)}),this.hoveredRange=null)}}const Op=({variant:e,settings:t,styles:n})=>{const o=Bt.theme({"&":{backgroundColor:t.background,color:t.foreground},".cm-content":{caretColor:t.caret},".cm-cursor, .cm-dropCursor":{borderLeftColor:t.caret},"&.cm-focused .cm-selectionBackgroundm .cm-selectionBackground, .cm-content ::selection":{backgroundColor:t.selection},".cm-activeLine":{backgroundColor:t.lineHighlight},".cm-gutters":{backgroundColor:t.gutterBackground,color:t.gutterForeground},".cm-activeLineGutter":{backgroundColor:t.lineHighlight}},{dark:"dark"===e}),r=wn.define(n);return[o,kn(r)]};Op({variant:"dark",settings:{background:"#200020",foreground:"#D0D0FF",caret:"#7070FF",selection:"#80000080",gutterBackground:"#200020",gutterForeground:"#C080C0",lineHighlight:"#80000040"},styles:[{tag:Nn.comment,color:"#404080"},{tag:[Nn.string,Nn.regexp],color:"#999999"},{tag:Nn.number,color:"#7090B0"},{tag:[Nn.bool,Nn.null],color:"#8080A0"},{tag:[Nn.punctuation,Nn.derefOperator],color:"#805080"},{tag:Nn.keyword,color:"#60B0FF"},{tag:Nn.definitionKeyword,color:"#B0FFF0"},{tag:Nn.moduleKeyword,color:"#60B0FF"},{tag:Nn.operator,color:"#A0A0FF"},{tag:[Nn.variableName,Nn.self],color:"#008080"},{tag:Nn.operatorKeyword,color:"#A0A0FF"},{tag:Nn.controlKeyword,color:"#80A0FF"},{tag:Nn.className,color:"#70E080"},{tag:[Nn.function(Nn.propertyName),Nn.propertyName],color:"#50A0A0"},{tag:Nn.tagName,color:"#009090"},{tag:Nn.modifier,color:"#B0FFF0"},{tag:[Nn.squareBracket,Nn.attributeName],color:"#D0D0FF"}]}),Op({variant:"light",settings:{background:"#fcfcfc",foreground:"#5c6166",caret:"#ffaa33",selection:"#036dd626",gutterBackground:"#fcfcfc",gutterForeground:"#8a919966",lineHighlight:"#8a91991a"},styles:[{tag:Nn.comment,color:"#787b8099"},{tag:Nn.string,color:"#86b300"},{tag:Nn.regexp,color:"#4cbf99"},{tag:[Nn.number,Nn.bool,Nn.null],color:"#ffaa33"},{tag:Nn.variableName,color:"#5c6166"},{tag:[Nn.definitionKeyword,Nn.modifier],color:"#fa8d3e"},{tag:[Nn.keyword,Nn.special(Nn.brace)],color:"#fa8d3e"},{tag:Nn.operator,color:"#ed9366"},{tag:Nn.separator,color:"#5c6166b3"},{tag:Nn.punctuation,color:"#5c6166"},{tag:[Nn.definition(Nn.propertyName),Nn.function(Nn.variableName)],color:"#f2ae49"},{tag:[Nn.className,Nn.definition(Nn.typeName)],color:"#22a4e6"},{tag:[Nn.tagName,Nn.typeName,Nn.self,Nn.labelName],color:"#55b4d4"},{tag:Nn.angleBracket,color:"#55b4d480"},{tag:Nn.attributeName,color:"#f2ae49"}]}),Op({variant:"dark",settings:{background:"#15191EFA",foreground:"#EEF2F7",caret:"#C4C4C4",selection:"#90B2D557",gutterBackground:"#15191EFA",gutterForeground:"#aaaaaa95",lineHighlight:"#57575712"},styles:[{tag:Nn.comment,color:"#6E6E6E"},{tag:[Nn.string,Nn.regexp,Nn.special(Nn.brace)],color:"#5C81B3"},{tag:Nn.number,color:"#C1E1B8"},{tag:Nn.bool,color:"#53667D"},{tag:[Nn.definitionKeyword,Nn.modifier,Nn.function(Nn.propertyName)],color:"#A3D295",fontWeight:"bold"},{tag:[Nn.keyword,Nn.moduleKeyword,Nn.operatorKeyword,Nn.operator],color:"#697A8E",fontWeight:"bold"},{tag:[Nn.variableName,Nn.attributeName],color:"#708E67"},{tag:[Nn.function(Nn.variableName),Nn.definition(Nn.propertyName),Nn.derefOperator],color:"#fff"},{tag:Nn.tagName,color:"#A3D295"}]}),Op({variant:"dark",settings:{background:"#2e241d",foreground:"#BAAE9E",caret:"#A7A7A7",selection:"#DDF0FF33",gutterBackground:"#28211C",gutterForeground:"#BAAE9E90",lineHighlight:"#FFFFFF08"},styles:[{tag:Nn.comment,color:"#666666"},{tag:[Nn.string,Nn.special(Nn.brace)],color:"#54BE0D"},{tag:Nn.regexp,color:"#E9C062"},{tag:Nn.number,color:"#CF6A4C"},{tag:[Nn.keyword,Nn.operator],color:"#5EA6EA"},{tag:Nn.variableName,color:"#7587A6"},{tag:[Nn.definitionKeyword,Nn.modifier],color:"#F9EE98"},{tag:[Nn.propertyName,Nn.function(Nn.variableName)],color:"#937121"},{tag:[Nn.typeName,Nn.angleBracket,Nn.tagName],color:"#9B859D"}]}),Op({variant:"dark",settings:{background:"#3b2627",foreground:"#E6E1C4",caret:"#E6E1C4",selection:"#16120E",gutterBackground:"#3b2627",gutterForeground:"#E6E1C490",lineHighlight:"#1F1611"},styles:[{tag:Nn.comment,color:"#6B4E32"},{tag:[Nn.keyword,Nn.operator,Nn.derefOperator],color:"#EF5D32"},{tag:Nn.className,color:"#EFAC32",fontWeight:"bold"},{tag:[Nn.typeName,Nn.propertyName,Nn.function(Nn.variableName),Nn.definition(Nn.variableName)],color:"#EFAC32"},{tag:Nn.definition(Nn.typeName),color:"#EFAC32",fontWeight:"bold"},{tag:Nn.labelName,color:"#EFAC32",fontWeight:"bold"},{tag:[Nn.number,Nn.bool],color:"#6C99BB"},{tag:[Nn.variableName,Nn.self],color:"#7DAF9C"},{tag:[Nn.string,Nn.special(Nn.brace),Nn.regexp],color:"#D9D762"},{tag:[Nn.angleBracket,Nn.tagName,Nn.attributeName],color:"#EFCB43"}]}),Op({variant:"dark",settings:{background:"#000205",foreground:"#FFFFFF",caret:"#E60065",selection:"#E60C6559",gutterBackground:"#000205",gutterForeground:"#ffffff90",lineHighlight:"#4DD7FC1A"},styles:[{tag:Nn.comment,color:"#404040"},{tag:[Nn.string,Nn.special(Nn.brace),Nn.regexp],color:"#00D8FF"},{tag:Nn.number,color:"#E62286"},{tag:[Nn.variableName,Nn.attributeName,Nn.self],color:"#E62286",fontWeight:"bold"},{tag:Nn.function(Nn.variableName),color:"#fff",fontWeight:"bold"}]}),Op({variant:"light",settings:{background:"#fff",foreground:"#000",caret:"#000",selection:"#BDD5FC",gutterBackground:"#fff",gutterForeground:"#00000070",lineHighlight:"#FFFBD1"},styles:[{tag:Nn.comment,color:"#BCC8BA"},{tag:[Nn.string,Nn.special(Nn.brace),Nn.regexp],color:"#5D90CD"},{tag:[Nn.number,Nn.bool,Nn.null],color:"#46A609"},{tag:Nn.keyword,color:"#AF956F"},{tag:[Nn.definitionKeyword,Nn.modifier],color:"#C52727"},{tag:[Nn.angleBracket,Nn.tagName,Nn.attributeName],color:"#606060"},{tag:Nn.self,color:"#000"}]}),Op({variant:"dark",settings:{background:"#00254b",foreground:"#FFFFFF",caret:"#FFFFFF",selection:"#B36539BF",gutterBackground:"#00254b",gutterForeground:"#FFFFFF70",lineHighlight:"#00000059"},styles:[{tag:Nn.comment,color:"#0088FF"},{tag:Nn.string,color:"#3AD900"},{tag:Nn.regexp,color:"#80FFC2"},{tag:[Nn.number,Nn.bool,Nn.null],color:"#FF628C"},{tag:[Nn.definitionKeyword,Nn.modifier],color:"#FFEE80"},{tag:Nn.variableName,color:"#CCCCCC"},{tag:Nn.self,color:"#FF80E1"},{tag:[Nn.className,Nn.definition(Nn.propertyName),Nn.function(Nn.variableName),Nn.definition(Nn.typeName),Nn.labelName],color:"#FFDD00"},{tag:[Nn.keyword,Nn.operator],color:"#FF9D00"},{tag:[Nn.propertyName,Nn.typeName],color:"#80FFBB"},{tag:Nn.special(Nn.brace),color:"#EDEF7D"},{tag:Nn.attributeName,color:"#9EFFFF"},{tag:Nn.derefOperator,color:"#fff"}]}),Op({variant:"dark",settings:{background:"#060521",foreground:"#E0E0E0",caret:"#FFFFFFA6",selection:"#122BBB",gutterBackground:"#060521",gutterForeground:"#E0E0E090",lineHighlight:"#FFFFFF0F"},styles:[{tag:Nn.comment,color:"#AEAEAE"},{tag:[Nn.string,Nn.special(Nn.brace),Nn.regexp],color:"#8DFF8E"},{tag:[Nn.className,Nn.definition(Nn.propertyName),Nn.function(Nn.variableName),Nn.function(Nn.definition(Nn.variableName)),Nn.definition(Nn.typeName)],color:"#A3EBFF"},{tag:[Nn.number,Nn.bool,Nn.null],color:"#62E9BD"},{tag:[Nn.keyword,Nn.operator],color:"#2BF1DC"},{tag:[Nn.definitionKeyword,Nn.modifier],color:"#F8FBB1"},{tag:[Nn.variableName,Nn.self],color:"#B683CA"},{tag:[Nn.angleBracket,Nn.tagName,Nn.typeName,Nn.propertyName],color:"#60A4F1"},{tag:Nn.derefOperator,color:"#E0E0E0"},{tag:Nn.attributeName,color:"#7BACCA"}]}),Op({variant:"dark",settings:{background:"#2d2f3f",foreground:"#f8f8f2",caret:"#f8f8f0",selection:"#44475a",gutterBackground:"#282a36",gutterForeground:"rgb(144, 145, 148)",lineHighlight:"#44475a"},styles:[{tag:Nn.comment,color:"#6272a4"},{tag:[Nn.string,Nn.special(Nn.brace)],color:"#f1fa8c"},{tag:[Nn.number,Nn.self,Nn.bool,Nn.null],color:"#bd93f9"},{tag:[Nn.keyword,Nn.operator],color:"#ff79c6"},{tag:[Nn.definitionKeyword,Nn.typeName],color:"#8be9fd"},{tag:Nn.definition(Nn.typeName),color:"#f8f8f2"},{tag:[Nn.className,Nn.definition(Nn.propertyName),Nn.function(Nn.variableName),Nn.attributeName],color:"#50fa7b"}]}),Op({variant:"light",settings:{background:"#FFFFFF",foreground:"#000000",caret:"#000000",selection:"#80C7FF",gutterBackground:"#FFFFFF",gutterForeground:"#00000070",lineHighlight:"#C1E2F8"},styles:[{tag:Nn.comment,color:"#AAAAAA"},{tag:[Nn.keyword,Nn.operator,Nn.typeName,Nn.tagName,Nn.propertyName],color:"#2F6F9F",fontWeight:"bold"},{tag:[Nn.attributeName,Nn.definition(Nn.propertyName)],color:"#4F9FD0"},{tag:[Nn.className,Nn.string,Nn.special(Nn.brace)],color:"#CF4F5F"},{tag:Nn.number,color:"#CF4F5F",fontWeight:"bold"},{tag:Nn.variableName,fontWeight:"bold"}]}),Op({variant:"light",settings:{background:"#f2f1f8",foreground:"#0c006b",caret:"#5c49e9",selection:"#d5d1f2",gutterBackground:"#f2f1f8",gutterForeground:"#0c006b70",lineHighlight:"#e1def3"},styles:[{tag:Nn.comment,color:"#9995b7"},{tag:Nn.keyword,color:"#ff5792",fontWeight:"bold"},{tag:[Nn.definitionKeyword,Nn.modifier],color:"#ff5792"},{tag:[Nn.className,Nn.tagName,Nn.definition(Nn.typeName)],color:"#0094f0"},{tag:[Nn.number,Nn.bool,Nn.null,Nn.special(Nn.brace)],color:"#5842ff"},{tag:[Nn.definition(Nn.propertyName),Nn.function(Nn.variableName)],color:"#0095a8"},{tag:Nn.typeName,color:"#b3694d"},{tag:[Nn.propertyName,Nn.variableName],color:"#fa8900"},{tag:Nn.operator,color:"#ff5792"},{tag:Nn.self,color:"#e64100"},{tag:[Nn.string,Nn.regexp],color:"#00b368"},{tag:[Nn.paren,Nn.bracket],color:"#0431fa"},{tag:Nn.labelName,color:"#00bdd6"},{tag:Nn.attributeName,color:"#e64100"},{tag:Nn.angleBracket,color:"#9995b7"}]}),Op({variant:"light",settings:{background:"#faf4ed",foreground:"#575279",caret:"#575279",selection:"#6e6a8614",gutterBackground:"#faf4ed",gutterForeground:"#57527970",lineHighlight:"#6e6a860d"},styles:[{tag:Nn.comment,color:"#9893a5"},{tag:[Nn.bool,Nn.null],color:"#286983"},{tag:Nn.number,color:"#d7827e"},{tag:Nn.className,color:"#d7827e"},{tag:[Nn.angleBracket,Nn.tagName,Nn.typeName],color:"#56949f"},{tag:Nn.attributeName,color:"#907aa9"},{tag:Nn.punctuation,color:"#797593"},{tag:[Nn.keyword,Nn.modifier],color:"#286983"},{tag:[Nn.string,Nn.regexp],color:"#ea9d34"},{tag:Nn.variableName,color:"#d7827e"}]}),Op({variant:"light",settings:{background:"#FFFFFF",foreground:"#000000",caret:"#000000",selection:"#FFFD0054",gutterBackground:"#FFFFFF",gutterForeground:"#00000070",lineHighlight:"#00000008"},styles:[{tag:Nn.comment,color:"#CFCFCF"},{tag:[Nn.number,Nn.bool,Nn.null],color:"#E66C29"},{tag:[Nn.className,Nn.definition(Nn.propertyName),Nn.function(Nn.variableName),Nn.labelName,Nn.definition(Nn.typeName)],color:"#2EB43B"},{tag:Nn.keyword,color:"#D8B229"},{tag:Nn.operator,color:"#4EA44E",fontWeight:"bold"},{tag:[Nn.definitionKeyword,Nn.modifier],color:"#925A47"},{tag:Nn.string,color:"#704D3D"},{tag:Nn.typeName,color:"#2F8996"},{tag:[Nn.variableName,Nn.propertyName],color:"#77ACB0"},{tag:Nn.self,color:"#77ACB0",fontWeight:"bold"},{tag:Nn.regexp,color:"#E3965E"},{tag:[Nn.tagName,Nn.angleBracket],color:"#BAA827"},{tag:Nn.attributeName,color:"#B06520"},{tag:Nn.derefOperator,color:"#000"}]}),Op({variant:"light",settings:{background:"#fef7e5",foreground:"#586E75",caret:"#000000",selection:"#073642",gutterBackground:"#fef7e5",gutterForeground:"#586E7580",lineHighlight:"#EEE8D5"},styles:[{tag:Nn.comment,color:"#93A1A1"},{tag:Nn.string,color:"#2AA198"},{tag:Nn.regexp,color:"#D30102"},{tag:Nn.number,color:"#D33682"},{tag:Nn.variableName,color:"#268BD2"},{tag:[Nn.keyword,Nn.operator,Nn.punctuation],color:"#859900"},{tag:[Nn.definitionKeyword,Nn.modifier],color:"#073642",fontWeight:"bold"},{tag:[Nn.className,Nn.self,Nn.definition(Nn.propertyName)],color:"#268BD2"},{tag:Nn.function(Nn.variableName),color:"#268BD2"},{tag:[Nn.bool,Nn.null],color:"#B58900"},{tag:Nn.tagName,color:"#268BD2",fontWeight:"bold"},{tag:Nn.angleBracket,color:"#93A1A1"},{tag:Nn.attributeName,color:"#93A1A1"},{tag:Nn.typeName,color:"#859900"}]}),Op({variant:"light",settings:{background:"#FFFFFF",foreground:"#4D4D4C",caret:"#AEAFAD",selection:"#D6D6D6",gutterBackground:"#FFFFFF",gutterForeground:"#4D4D4C80",lineHighlight:"#EFEFEF"},styles:[{tag:Nn.comment,color:"#8E908C"},{tag:[Nn.variableName,Nn.self,Nn.propertyName,Nn.attributeName,Nn.regexp],color:"#C82829"},{tag:[Nn.number,Nn.bool,Nn.null],color:"#F5871F"},{tag:[Nn.className,Nn.typeName,Nn.definition(Nn.typeName)],color:"#C99E00"},{tag:[Nn.string,Nn.special(Nn.brace)],color:"#718C00"},{tag:Nn.operator,color:"#3E999F"},{tag:[Nn.definition(Nn.propertyName),Nn.function(Nn.variableName)],color:"#4271AE"},{tag:Nn.keyword,color:"#8959A8"},{tag:Nn.derefOperator,color:"#4D4D4C"}]});const Dp=Op({variant:"light",settings:{background:"#ffffff",foreground:"#000000",caret:"#000000",selection:"#d7d4f0",lineHighlight:"#cceeff44",gutterBackground:"var(--color-background)",gutterForeground:"var(--gray-10)"},styles:[{tag:Nn.comment,color:"#708090"},{tag:Nn.variableName,color:"#000000"},{tag:[Nn.string,Nn.special(Nn.brace)],color:"#a11"},{tag:Nn.number,color:"#164"},{tag:Nn.bool,color:"#219"},{tag:Nn.null,color:"#219"},{tag:Nn.keyword,color:"#708",fontWeight:500},{tag:Nn.className,color:"#00f"},{tag:Nn.definition(Nn.typeName),color:"#00f"},{tag:Nn.typeName,color:"#085"},{tag:Nn.angleBracket,color:"#000000"},{tag:Nn.tagName,color:"#170"},{tag:Nn.attributeName,color:"#00c"},{tag:Nn.operator,color:"#a2f",fontWeight:500},{tag:[Nn.function(Nn.variableName)],color:"#00c"},{tag:[Nn.propertyName],color:"#05a"}]});const Pp=e=>{const{theme:t,hotkeys:n,completionConfig:o}=e;return[Bt.lineWrapping,_n(),In(),An(),Mn(),Tn(),On(),Dn(),Pn({position:"fixed",parent:document.querySelector("#App")??void 0}),Rn(),"dark"===t?Fn:Dp,Ln(),jp(o),zn(),Bn(),dn.high(sn.of(Un)),Vn(),$n(),Gn.of(" "),kn(Hn,{fallback:!0}),sn.of(Wn),qn(e),Yn.of(Kn()),Jn.allowMultipleSelections.of(!0),Eu(n),sn.of([{key:"Tab",run:e=>Xn(e)||(e=>{const{from:t,to:n}=e.state.selection.main;if(t!==n)return!1;const o=e.state.doc.lineAt(n);return""!==o.text.slice(0,n-o.from).trim()&&to(e)})(e)||Zn(e),preventDefault:!0}]),sn.of([...Qn,eo])]};function Rp(e){const t=e.current;if(null===t)throw new ReferenceError("Attempting to dereference null object.");return t}const Fp="ContextMenu",[Lp,zp]=no(Fp,[oo]),Bp=oo(),[Up,Vp]=Lp(Fp),$p=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,disabled:o=!1,...a}=e,s=Vp("ContextMenuTrigger",n),i=Bp(n),l=r.useRef({x:0,y:0}),c=r.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...l.current})}),d=r.useRef(0),u=r.useCallback((()=>window.clearTimeout(d.current)),[]),h=e=>{l.current={x:e.clientX,y:e.clientY},s.onOpenChange(!0)};return r.useEffect((()=>u),[u]),r.useEffect((()=>{o&&u()}),[o,u]),r.createElement(r.Fragment,null,r.createElement(xo,ao({},i,{virtualRef:c})),r.createElement(yo.span,ao({"data-state":s.open?"open":"closed","data-disabled":o?"":void 0},a,{ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:o?e.onContextMenu:bo(e.onContextMenu,(e=>{u(),h(e),e.preventDefault()})),onPointerDown:o?e.onPointerDown:bo(e.onPointerDown,Gp((e=>{u(),d.current=window.setTimeout((()=>h(e)),700)}))),onPointerMove:o?e.onPointerMove:bo(e.onPointerMove,Gp(u)),onPointerCancel:o?e.onPointerCancel:bo(e.onPointerCancel,Gp(u)),onPointerUp:o?e.onPointerUp:bo(e.onPointerUp,Gp(u))})))}));function Gp(e){return t=>"mouse"!==t.pointerType?e(t):void 0}const Hp=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=Vp("ContextMenuContent",n),s=Bp(n),i=r.useRef(!1);return r.createElement(so,ao({},s,o,{ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:t=>{var n;null===(n=e.onCloseAutoFocus)||void 0===n||n.call(e,t),!t.defaultPrevented&&i.current&&t.preventDefault(),i.current=!1},onInteractOutside:t=>{var n;null===(n=e.onInteractOutside)||void 0===n||n.call(e,t),t.defaultPrevented||a.modal||(i.current=!0)},style:{...e.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)"}}))})),Wp=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=Bp(n);return r.createElement(io,ao({},a,o,{ref:t}))})),qp=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=Bp(n);return r.createElement(lo,ao({},a,o,{ref:t}))})),Yp=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=Bp(n);return r.createElement(co,ao({},a,o,{ref:t}))})),Kp=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=Bp(n);return r.createElement(uo,ao({},a,o,{ref:t}))})),Jp=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=Bp(n);return r.createElement(po,ao({},a,o,{ref:t}))})),Xp=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=Bp(n);return r.createElement(ho,ao({},a,o,{ref:t}))})),Zp=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=Bp(n);return r.createElement(mo,ao({},a,o,{ref:t}))})),Qp=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=Bp(n);return r.createElement(fo,ao({},a,o,{ref:t,style:{...e.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)"}}))})),eg=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:o,dir:a,modal:s=!0}=e,[i,l]=r.useState(!1),c=Bp(t),d=go(o),u=r.useCallback((e=>{l(e),d(e)}),[d]);return r.createElement(Up,{scope:t,open:i,onOpenChange:u,modal:s},r.createElement(vo,ao({},c,{dir:a,open:i,onOpenChange:u,modal:s}),n))},tg=$p,ng=wo((e=>{const{__scopeContextMenu:t,...n}=e,o=Bp(t);return r.createElement(ro,ao({},o,n))}));r.forwardRef(((e,t)=>{const n=m(14);let o,r,a,s,i,l,c;return n[0]!==e?(({className:o,inset:r,children:s,...a}=e),n[0]=e,n[1]=o,n[2]=r,n[3]=a,n[4]=s):(o=n[1],r=n[2],a=n[3],s=n[4]),n[5]!==o||n[6]!==r?(i=ko({className:o,inset:r}),n[5]=o,n[6]=r,n[7]=i):i=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(l=p.jsx(Io,{className:"ml-auto h-4 w-4"}),n[8]=l):l=n[8],n[9]!==t||n[10]!==i||n[11]!==a||n[12]!==s?(c=p.jsxs(Zp,{ref:t,className:i,...a,children:[s,l]}),n[9]=t,n[10]=i,n[11]=a,n[12]=s,n[13]=c):c=n[13],c})).displayName=Zp.displayName;const og="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";r.forwardRef(((e,t)=>{const n=m(9);let o,r,a,s;return n[0]!==e?(({className:o,...r}=e),n[0]=e,n[1]=o,n[2]=r):(o=n[1],r=n[2]),n[3]!==o?(a=Jt(No({subcontent:!0}),og,o),n[3]=o,n[4]=a):a=n[4],n[5]!==t||n[6]!==a||n[7]!==r?(s=p.jsx(Qp,{ref:t,className:a,...r}),n[5]=t,n[6]=a,n[7]=r,n[8]=s):s=n[8],s})).displayName=Qp.displayName;const rg=r.forwardRef(((e,t)=>{const n=m(9);let o,r,a,s;return n[0]!==e?(({className:o,...r}=e),n[0]=e,n[1]=o,n[2]=r):(o=n[1],r=n[2]),n[3]!==o?(a=Jt(No(),og,o),n[3]=o,n[4]=a):a=n[4],n[5]!==t||n[6]!==a||n[7]!==r?(s=p.jsx(ng,{children:p.jsx(Eo,{children:p.jsx(Hp,{ref:t,className:a,...r})})}),n[5]=t,n[6]=a,n[7]=r,n[8]=s):s=n[8],s}));rg.displayName=Hp.displayName;const ag=r.forwardRef(((e,t)=>{const n=m(13);let o,r,a,s,i,l;return n[0]!==e?(({className:o,inset:r,variant:a,...s}=e),n[0]=e,n[1]=o,n[2]=r,n[3]=a,n[4]=s):(o=n[1],r=n[2],a=n[3],s=n[4]),n[5]!==o||n[6]!==r||n[7]!==a?(i=Co({className:o,inset:r,variant:a}),n[5]=o,n[6]=r,n[7]=a,n[8]=i):i=n[8],n[9]!==t||n[10]!==i||n[11]!==s?(l=p.jsx(qp,{ref:t,className:i,...s}),n[9]=t,n[10]=i,n[11]=s,n[12]=l):l=n[12],l}));ag.displayName=qp.displayName;r.forwardRef(((e,t)=>{const n=m(15);let o,r,a,s,i,l,c,d;return n[0]!==e?(({className:o,children:s,checked:r,...a}=e),n[0]=e,n[1]=o,n[2]=r,n[3]=a,n[4]=s):(o=n[1],r=n[2],a=n[3],s=n[4]),n[5]!==o?(i=So({className:o}),n[5]=o,n[6]=i):i=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(l=So(),n[7]=l):l=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(c=p.jsx("span",{className:l,children:p.jsx(Jp,{children:p.jsx(Ao,{className:"h-4 w-4"})})}),n[8]=c):c=n[8],n[9]!==t||n[10]!==i||n[11]!==r||n[12]!==a||n[13]!==s?(d=p.jsxs(Yp,{ref:t,className:i,checked:r,...a,children:[c,s]}),n[9]=t,n[10]=i,n[11]=r,n[12]=a,n[13]=s,n[14]=d):d=n[14],d})).displayName=Yp.displayName;r.forwardRef(((e,t)=>{const n=m(13);let o,r,a,s,i,l,c;return n[0]!==e?(({className:o,children:a,...r}=e),n[0]=e,n[1]=o,n[2]=r,n[3]=a):(o=n[1],r=n[2],a=n[3]),n[4]!==o?(s=So({className:o}),n[4]=o,n[5]=s):s=n[5],n[6]===Symbol.for("react.memo_cache_sentinel")?(i=So(),n[6]=i):i=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(l=p.jsx("span",{className:i,children:p.jsx(Jp,{children:p.jsx(Mo,{className:"h-4 w-4 fill-current"})})}),n[7]=l):l=n[7],n[8]!==t||n[9]!==s||n[10]!==r||n[11]!==a?(c=p.jsxs(Kp,{ref:t,className:s,...r,children:[l,a]}),n[8]=t,n[9]=s,n[10]=r,n[11]=a,n[12]=c):c=n[12],c})).displayName=Kp.displayName;r.forwardRef(((e,t)=>{const n=m(11);let o,r,a,s,i;return n[0]!==e?(({className:o,inset:r,...a}=e),n[0]=e,n[1]=o,n[2]=r,n[3]=a):(o=n[1],r=n[2],a=n[3]),n[4]!==o||n[5]!==r?(s=jo({className:o,inset:r}),n[4]=o,n[5]=r,n[6]=s):s=n[6],n[7]!==t||n[8]!==s||n[9]!==a?(i=p.jsx(Wp,{ref:t,className:s,...a}),n[7]=t,n[8]=s,n[9]=a,n[10]=i):i=n[10],i})).displayName=Wp.displayName;const sg=r.forwardRef(((e,t)=>{const n=m(9);let o,r,a,s;return n[0]!==e?(({className:o,...r}=e),n[0]=e,n[1]=o,n[2]=r):(o=n[1],r=n[2]),n[3]!==o?(a=Jt(_o({className:o})),n[3]=o,n[4]=a):a=n[4],n[5]!==t||n[6]!==a||n[7]!==r?(s=p.jsx(Xp,{ref:t,className:a,...r}),n[5]=t,n[6]=a,n[7]=r,n[8]=s):s=n[8],s}));sg.displayName=Xp.displayName;const ig=e=>{const t=m(14),{appClosed:n,onClick:o,tooltipContent:r}=e;let a;t[0]!==o?(a=()=>null==o?void 0:o({code:""}),t[0]=o,t[1]=a):a=t[1];const s=n&&" inactive-button";let i,l,c,d,u;return t[2]!==s?(i=Jt("shoulder-button hover-action",s),t[2]=s,t[3]=i):i=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(l=p.jsx(To,{strokeWidth:1.8}),t[4]=l):l=t[4],t[5]!==a||t[6]!==i?(c=p.jsx(mi,{onClick:a,className:i,onMouseDown:qe.preventFocus,shape:"circle",size:"small",color:"hint-green","data-testid":"create-cell-button",children:l}),t[5]=a,t[6]=i,t[7]=c):c=t[7],t[8]!==r||t[9]!==c?(d=p.jsx(v,{content:r,usePortal:!1,children:c}),t[8]=r,t[9]=c,t[10]=d):d=t[10],t[11]!==o||t[12]!==d?(u=p.jsx(lg,{onClick:o,children:d}),t[11]=o,t[12]=d,t[13]=u):u=t[13],u},lg=e=>{const t=m(24),{children:n,onClick:o}=e;if(!o)return n;let r,a,s,i,l,c,d,u,h,f,g,v;return t[0]!==n?(r=p.jsx(tg,{children:n}),t[0]=n,t[1]=r):r=t[1],t[2]!==o?(a=e=>{e.stopPropagation(),o({code:""})},t[2]=o,t[3]=a):a=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(s=p.jsx("div",{className:"mr-3 text-muted-foreground",children:p.jsx(vi,{})}),t[4]=s):s=t[4],t[5]!==a?(i=p.jsxs(ag,{onSelect:a,children:[s,"Python cell"]},"python"),t[5]=a,t[6]=i):i=t[6],t[7]!==o?(l=e=>{e.stopPropagation(),o({code:(new Oo).defaultCode})},t[7]=o,t[8]=l):l=t[8],t[9]===Symbol.for("react.memo_cache_sentinel")?(c=p.jsx("div",{className:"mr-3 text-muted-foreground",children:p.jsx(gi,{})}),t[9]=c):c=t[9],t[10]!==l?(d=p.jsxs(ag,{onSelect:l,children:[c,"Markdown cell"]},"markdown"),t[10]=l,t[11]=d):d=t[11],t[12]!==o?(u=e=>{e.stopPropagation(),o({code:(new Do).defaultCode})},t[12]=o,t[13]=u):u=t[13],t[14]===Symbol.for("react.memo_cache_sentinel")?(h=p.jsx("div",{className:"mr-3 text-muted-foreground",children:p.jsx(fe,{size:13,strokeWidth:1.5})}),t[14]=h):h=t[14],t[15]!==u?(f=p.jsxs(ag,{onSelect:u,children:[h,"SQL cell"]},"sql"),t[15]=u,t[16]=f):f=t[16],t[17]!==i||t[18]!==d||t[19]!==f?(g=p.jsxs(rg,{children:[i,d,f]}),t[17]=i,t[18]=d,t[19]=f,t[20]=g):g=t[20],t[21]!==r||t[22]!==g?(v=p.jsxs(eg,{children:[r,g]}),t[21]=r,t[22]=g,t[23]=v):v=t[23],v},cg=Po("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"}}),dg=e=>{const t=m(21);let n,o,r,a,s;t[0]!==e?(({children:a,tooltip:s,disabled:n,variant:r,...o}=e),t[0]=e,t[1]=n,t[2]=o,t[3]=r,t[4]=a,t[5]=s):(n=t[1],o=t[2],r=t[3],a=t[4],s=t[5]);const i=void 0!==n&&n;let l,c,d;t[6]!==i||t[7]!==o.onClick?(l=e=>{var t;i||null==(t=o.onClick)||t.call(o,e)},t[6]=i,t[7]=o.onClick,t[8]=l):l=t[8],t[9]!==r||t[10]!==o.className?(c=Jt(cg({variant:r}),o.className),t[9]=r,t[10]=o.className,t[11]=c):c=t[11],t[12]!==i||t[13]!==o||t[14]!==l||t[15]!==c||t[16]!==a?(d=p.jsx("button",{disabled:i,...o,onClick:l,onMouseDown:qe.preventFocus,className:c,children:a}),t[12]=i,t[13]=o,t[14]=l,t[15]=c,t[16]=a,t[17]=d):d=t[17];const u=d;if(s){let e;return t[18]!==s||t[19]!==u?(e=p.jsx(v,{content:s,side:"top",delayDuration:200,usePortal:!1,children:u}),t[18]=s,t[19]=u,t[20]=e):e=t[20],e}return u},ug=({children:e,className:t})=>p.jsx(Hc,{className:Jt("flex items-center gap-1 bg-background m-[2px] rounded-full",t),children:e});const hg=e=>{const t=m(22),{onClick:n,appClosed:o,needsRun:r,status:a,config:s,edited:i}=e,l="disabled-transitively"===a,c="running"===a||"queued"===a,d=o||c||!s.disabled&&l&&!i;let u;t[0]!==o||t[1]!==r||t[2]!==c||t[3]!==d?(u=function(e,t,n,o){return e?"disabled":t&&!n?"stale":n||o?"disabled":"green"}(o,r,c,d),t[0]=o,t[1]=r,t[2]=c,t[3]=d,t[4]=u):u=t[4];const h=u;if(s.disabled){let e,o;return t[5]===Symbol.for("react.memo_cache_sentinel")?(e=p.jsx(Ql,{}),t[5]=e):e=t[5],t[6]!==d||t[7]!==n||t[8]!==h?(o=p.jsx(dg,{tooltip:"Add code to notebook",disabled:d,onClick:n,variant:h,"data-testid":"run-button",children:e}),t[6]=d,t[7]=n,t[8]=h,t[9]=o):o=t[9],o}if(!s.disabled&&l&&!i){let e,o;return t[10]===Symbol.for("react.memo_cache_sentinel")?(e=p.jsx(vc,{strokeWidth:1.2}),t[10]=e):e=t[10],t[11]!==d||t[12]!==n||t[13]!==h?(o=p.jsx(dg,{disabled:d,tooltip:"This cell can't be run because it has a disabled ancestor",onClick:n,variant:h,"data-testid":"run-button",children:e}),t[11]=d,t[12]=n,t[13]=h,t[14]=o):o=t[14],o}let f,v,x;if(o)f="App disconnected";else if("queued"===a)f="This cell is already queued to run";else if("running"===a)f="This cell is already running.";else{let e;t[15]===Symbol.for("react.memo_cache_sentinel")?(e=g("cell.run"),t[15]=e):e=t[15],f=e}return t[16]===Symbol.for("react.memo_cache_sentinel")?(v=p.jsx(vc,{strokeWidth:1.2}),t[16]=v):v=t[16],t[17]!==f||t[18]!==d||t[19]!==n||t[20]!==h?(x=p.jsx(dg,{tooltip:f,disabled:d,onClick:n,variant:h,"data-testid":"run-button",children:v}),t[17]=f,t[18]=d,t[19]=n,t[20]=h,t[21]=x):x=t[21],x},mg=e=>{const t=m(10),{status:n,appClosed:o,onClick:r}=e;let a;a=o?"App disconnected":"running"===n?"A cell can't be deleted when it's running":"queued"===n?"A cell can't be deleted when it's queued to run":"Delete";const s=a,i=(o||("running"===n||"queued"===n))&&"inactive-button";let l,c,d,u,h;return t[0]!==i?(l=Jt("hover:bg-transparent text-destructive/60 hover:text-destructive",i),t[0]=i,t[1]=l):l=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(c={boxShadow:"none"},d=p.jsx(ye,{size:14}),t[2]=c,t[3]=d):(c=t[2],d=t[3]),t[4]!==r||t[5]!==l?(u=p.jsx(x,{variant:"ghost",size:"icon",onClick:r,"data-testid":"delete-button",onMouseDown:qe.preventFocus,className:l,style:c,children:d}),t[4]=r,t[5]=l,t[6]=u):u=t[6],t[7]!==a||t[8]!==u?(h=p.jsx(v,{content:s,usePortal:!1,children:u}),t[7]=a,t[8]=u,t[9]=h):h=t[9],h};const fg=e=>{const t=m(27),{editing:n,status:o,disabled:r,staleInputs:a,edited:s,interrupted:i,elapsedTime:l,runStartTimestamp:c,uninstantiated:d}=e;if(!n)return null;if(r&&"running"===o)return G.error("CellStatusComponent: disabled and running"),null;if(r&&a){let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=p.jsx(v,{content:"This cell is stale, but it's disabled and can't be run",usePortal:!1,children:p.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"stale",children:p.jsxs(nd,{children:[p.jsx(Ml,{className:"h-5 w-5",strokeWidth:1.5}),p.jsx(Fo,{className:"h-3 w-3",strokeWidth:2.5})]})})}),t[0]=e):e=t[0],e}if(r){let e;return t[1]===Symbol.for("react.memo_cache_sentinel")?(e=p.jsx(v,{content:"This cell is disabled",usePortal:!1,children:p.jsx("div",{className:"cell-status-icon cell-status-disabled","data-testid":"cell-status","data-status":"disabled",children:p.jsx(Ml,{className:"h-5 w-5",strokeWidth:1.5})})}),t[1]=e):e=t[1],e}if(!a&&"disabled-transitively"===o){let e;return t[2]===Symbol.for("react.memo_cache_sentinel")?(e=p.jsx(v,{content:"An ancestor of this cell is disabled, so it can't be run",usePortal:!1,children:p.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"disabled-transitively",children:p.jsxs(nd,{layerTop:!0,children:[p.jsx(Bc,{className:"h-5 w-5",strokeWidth:1.5}),p.jsx(Ml,{className:"h-3 w-3",strokeWidth:2.5})]})})}),t[2]=e):e=t[2],e}if(a&&"disabled-transitively"===o){let e;return t[3]===Symbol.for("react.memo_cache_sentinel")?(e=p.jsx(v,{content:"This cell is stale, but an ancestor is disabled so it can't be run",usePortal:!1,children:p.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"stale",children:p.jsxs(nd,{children:[p.jsx(Fo,{className:"h-5 w-5",strokeWidth:1}),p.jsx(Ml,{className:"h-3 w-3",strokeWidth:2.5})]})})}),t[3]=e):e=t[3],e}if("running"===o){let e,n;return t[4]!==c?(e=Ro.fromSeconds(c)||Ro.now(),t[4]=c,t[5]=e):e=t[5],t[6]!==e?(n=p.jsx(v,{content:"This cell is running",usePortal:!1,children:p.jsx("div",{className:"cell-status-icon elapsed-time running","data-testid":"cell-status","data-status":"running",children:p.jsx(gg,{startTime:e})})}),t[6]=e,t[7]=n):n=t[7],n}if("queued"===o){let e;return t[8]===Symbol.for("react.memo_cache_sentinel")?(e=p.jsx(v,{content:"This cell is queued to run",usePortal:!1,children:p.jsx("div",{className:"cell-status-icon cell-status-queued","data-testid":"cell-status","data-status":"queued",children:p.jsx(Qi,{className:"h-5 w-5",strokeWidth:1.5})})}),t[8]=e):e=t[8],e}if(s||i||a||d){let e;t[9]!==l?(e=pg(l),t[9]=l,t[10]=e):e=t[10];const n=e;let o,r,a,c,u,h="";return d?o="This cell has not yet been run":i?(o="This cell was interrupted when it was last run",h=`This cell ran for ${n} before being interrupted`):s?(o="This cell has been modified since it was last run",h=`This cell took ${n} to run`):(o="This cell has not been run with the latest inputs",h=`This cell took ${n} to run`),t[11]===Symbol.for("react.memo_cache_sentinel")?(r=p.jsx("div",{className:"cell-status-stale","data-testid":"cell-status","data-status":"outdated",children:p.jsx(Fo,{className:"h-5 w-5",strokeWidth:1.5})}),t[11]=r):r=t[11],t[12]!==o?(a=p.jsx(v,{content:o,usePortal:!1,children:r}),t[12]=o,t[13]=a):a=t[13],t[14]!==n||t[15]!==h?(c=n&&p.jsx(v,{content:h,usePortal:!1,children:p.jsx("div",{className:"elapsed-time hover-action","data-testid":"cell-status","data-status":"outdated",children:p.jsx("span",{children:n})})}),t[14]=n,t[15]=h,t[16]=c):c=t[16],t[17]!==a||t[18]!==c?(u=p.jsxs("div",{className:"cell-status-icon flex items-center gap-2",children:[a,c]}),t[17]=a,t[18]=c,t[19]=u):u=t[19],u}if(null!==l){let e;t[20]!==l?(e=pg(l),t[20]=l,t[21]=e):e=t[21];const n=e,o=`This cell took ${n} to run`;let r,a;return t[22]!==n?(r=p.jsx("div",{className:"cell-status-icon elapsed-time hover-action","data-testid":"cell-status","data-status":"idle",children:p.jsx("span",{children:n})}),t[22]=n,t[23]=r):r=t[23],t[24]!==o||t[25]!==r?(a=p.jsx(v,{content:o,usePortal:!1,children:r}),t[24]=o,t[25]=r,t[26]=a):a=t[26],a}return null};function pg(e){if(null===e)return"";if(e>6e4){const t=(e/6e4).toFixed(0),n=(e%6e4/1e3).toFixed(0);return`${t.toString()}m${n.toString()}s`}return e>1e3?`${(e/1e3).toFixed(2).toString()}s`:`${e.toFixed(0).toString()}ms`}const gg=e=>{const t=m(6);let n;t[0]!==e.startTime?(n=e.startTime.toMilliseconds(),t[0]=e.startTime,t[1]=n):n=t[1];const o=function(e){const t=r.useRef(e),[n,o]=r.useState(e);return r.useEffect((()=>{const e=setInterval((()=>{o(Ro.now().toMilliseconds())}),17);return()=>clearInterval(e)}),[]),n-t.current}(n);let a,s;return t[2]!==o?(a=pg(o),t[2]=o,t[3]=a):a=t[3],t[4]!==a?(s=p.jsx("span",{children:a}),t[4]=a,t[5]=s):s=t[5],s};function vg(...e){return t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}}const xg={display:"none"};function yg(e){let{id:t,value:n}=e;return u.createElement("div",{id:t,style:xg},n)}function bg(e){let{id:t,announcement:n,ariaLiveType:o="assertive"}=e;return u.createElement("div",{id:t,style:{position:"fixed",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 wg=r.createContext(null);const kg={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},Ng={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Eg(e){let{announcements:t=Ng,container:n,hiddenTextDescribedById:o,screenReaderInstructions:a=kg}=e;const{announce:s,announcement:i}=function(){const[e,t]=r.useState("");return{announce:r.useCallback((e=>{null!=e&&t(e)}),[]),announcement:e}}(),l=Go("DndLiveRegion"),[c,d]=r.useState(!1);if(r.useEffect((()=>{d(!0)}),[]),function(e){const t=r.useContext(wg);r.useEffect((()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)}),[e,t])}(r.useMemo((()=>({onDragStart(e){let{active:n}=e;s(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:o}=e;t.onDragMove&&s(t.onDragMove({active:n,over:o}))},onDragOver(e){let{active:n,over:o}=e;s(t.onDragOver({active:n,over:o}))},onDragEnd(e){let{active:n,over:o}=e;s(t.onDragEnd({active:n,over:o}))},onDragCancel(e){let{active:n,over:o}=e;s(t.onDragCancel({active:n,over:o}))}})),[s,t])),!c)return null;const h=u.createElement(u.Fragment,null,u.createElement(yg,{id:o,value:a.draggable}),u.createElement(bg,{id:l,announcement:i}));return n?Wo.createPortal(h,n):h}var Cg,Sg;function jg(){}function _g(e,t){return r.useMemo((()=>({sensor:e,options:null!=t?t:{}})),[e,t])}(Sg=Cg||(Cg={})).DragStart="dragStart",Sg.DragMove="dragMove",Sg.DragEnd="dragEnd",Sg.DragCancel="dragCancel",Sg.DragOver="dragOver",Sg.RegisterDroppable="registerDroppable",Sg.SetDroppableDisabled="setDroppableDisabled",Sg.UnregisterDroppable="unregisterDroppable";const Ig=Object.freeze({x:0,y:0});function Ag(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Mg(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return n-o}function Tg(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return o-n}function Og(e){let{left:t,top:n,height:o,width:r}=e;return[{x:t,y:n},{x:t+r,y:n},{x:t,y:n+o},{x:t+r,y:n+o}]}function Dg(e,t){if(!e||0===e.length)return null;const[n]=e;return t?n[t]:n}function Pg(e,t,n){return void 0===t&&(t=e.left),void 0===n&&(n=e.top),{x:t+.5*e.width,y:n+.5*e.height}}const Rg=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e;const r=Pg(t,t.left,t.top),a=[];for(const s of o){const{id:e}=s,t=n.get(e);if(t){const n=Ag(Pg(t),r);a.push({id:e,data:{droppableContainer:s,value:n}})}}return a.sort(Mg)};function Fg(e,t){const n=Math.max(t.top,e.top),o=Math.max(t.left,e.left),r=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),s=r-o,i=a-n;if(o<r&&n<a){const n=t.width*t.height,o=e.width*e.height,r=s*i;return Number((r/(n+o-r)).toFixed(4))}return 0}const Lg=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e;const r=[];for(const a of o){const{id:e}=a,o=n.get(e);if(o){const n=Fg(o,t);n>0&&r.push({id:e,data:{droppableContainer:a,value:n}})}}return r.sort(Tg)};function zg(e,t){const{top:n,left:o,bottom:r,right:a}=t;return n<=e.y&&e.y<=r&&o<=e.x&&e.x<=a}function Bg(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ig}function Ug(e){return function(t){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(((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x})),{...t})}}const Vg=Ug(1);const $g={ignoreTransform:!1};function Gg(e,t){void 0===t&&(t=$g);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:o}=Lo(e).getComputedStyle(e);t&&(n=function(e,t,n){const o=function(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}(t);if(!o)return e;const{scaleX:r,scaleY:a,x:s,y:i}=o,l=e.left-s-(1-r)*parseFloat(n),c=e.top-i-(1-a)*parseFloat(n.slice(n.indexOf(" ")+1)),d=r?e.width/r:e.width,u=a?e.height/a:e.height;return{width:d,height:u,top:c,right:l+d,bottom:c+u,left:l}}(n,t,o))}const{top:o,left:r,width:a,height:s,bottom:i,right:l}=n;return{top:o,left:r,width:a,height:s,bottom:i,right:l}}function Hg(e){return Gg(e,{ignoreTransform:!0})}function Wg(e,t){const n=[];return e?function o(r){if(null!=t&&n.length>=t)return n;if(!r)return n;if(tr(r)&&null!=r.scrollingElement&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!Zo(r)||nr(r))return n;if(n.includes(r))return n;const a=Lo(e).getComputedStyle(r);return r!==e&&function(e,t){void 0===t&&(t=Lo(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some((e=>{const o=t[e];return"string"==typeof o&&n.test(o)}))}(r,a)&&n.push(r),function(e,t){return void 0===t&&(t=Lo(e).getComputedStyle(e)),"fixed"===t.position}(r,a)?n:o(r.parentNode)}(e):n}function qg(e){const[t]=Wg(e,1);return null!=t?t:null}function Yg(e){return Xo&&e?or(e)?e:rr(e)?tr(e)||e===zo(e).scrollingElement?window:Zo(e)?e:null:null:null}function Kg(e){return or(e)?e.scrollX:e.scrollLeft}function Jg(e){return or(e)?e.scrollY:e.scrollTop}function Xg(e){return{x:Kg(e),y:Jg(e)}}var Zg,Qg;function ev(e){return!(!Xo||!e)&&e===document.scrollingElement}function tv(e){const t={x:0,y:0},n=ev(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},o={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=o.y,isRight:e.scrollLeft>=o.x,maxScroll:o,minScroll:t}}(Qg=Zg||(Zg={}))[Qg.Forward=1]="Forward",Qg[Qg.Backward=-1]="Backward";const nv={x:.2,y:.2};function ov(e,t,n,o,r){let{top:a,left:s,right:i,bottom:l}=n;void 0===o&&(o=10),void 0===r&&(r=nv);const{isTop:c,isBottom:d,isLeft:u,isRight:h}=tv(e),m={x:0,y:0},f={x:0,y:0},p=t.height*r.y,g=t.width*r.x;return!c&&a<=t.top+p?(m.y=Zg.Backward,f.y=o*Math.abs((t.top+p-a)/p)):!d&&l>=t.bottom-p&&(m.y=Zg.Forward,f.y=o*Math.abs((t.bottom-p-l)/p)),!h&&i>=t.right-g?(m.x=Zg.Forward,f.x=o*Math.abs((t.right-g-i)/g)):!u&&s<=t.left+g&&(m.x=Zg.Backward,f.x=o*Math.abs((t.left+g-s)/g)),{direction:m,speed:f}}function rv(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:n,right:o,bottom:r}=e.getBoundingClientRect();return{top:t,left:n,right:o,bottom:r,width:e.clientWidth,height:e.clientHeight}}function av(e){return e.reduce(((e,t)=>Vo(e,Xg(t))),Ig)}const sv=[["x",["left","right"],function(e){return e.reduce(((e,t)=>e+Kg(t)),0)}],["y",["top","bottom"],function(e){return e.reduce(((e,t)=>e+Jg(t)),0)}]];class iv{constructor(e,t){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 n=Wg(t),o=av(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[r,a,s]of sv)for(const e of a)Object.defineProperty(this,e,{get:()=>{const t=s(n),a=o[r]-t;return this.rect[e]+a},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class lv{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach((e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)}))},this.target=e}add(e,t,n){var o;null==(o=this.target)||o.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function cv(e,t){const n=Math.abs(e.x),o=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+o**2)>t:"x"in t&&"y"in t?n>t.x&&o>t.y:"x"in t?n>t.x:"y"in t&&o>t.y}var dv,uv,hv,mv;function fv(e){e.preventDefault()}function pv(e){e.stopPropagation()}(uv=dv||(dv={})).Click="click",uv.DragStart="dragstart",uv.Keydown="keydown",uv.ContextMenu="contextmenu",uv.Resize="resize",uv.SelectionChange="selectionchange",uv.VisibilityChange="visibilitychange",(mv=hv||(hv={})).Space="Space",mv.Down="ArrowDown",mv.Right="ArrowRight",mv.Left="ArrowLeft",mv.Up="ArrowUp",mv.Esc="Escape",mv.Enter="Enter";const gv={start:[hv.Space,hv.Enter],cancel:[hv.Esc],end:[hv.Space,hv.Enter]},vv=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case hv.Right:return{...n,x:n.x+25};case hv.Left:return{...n,x:n.x-25};case hv.Down:return{...n,y:n.y+25};case hv.Up:return{...n,y:n.y-25}}};class xv{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:t}}=e;this.props=e,this.listeners=new lv(zo(t)),this.windowListeners=new lv(Lo(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(dv.Resize,this.handleCancel),this.windowListeners.add(dv.VisibilityChange,this.handleCancel),setTimeout((()=>this.listeners.add(dv.Keydown,this.handleKeyDown)))}handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&function(e,t){if(void 0===t&&(t=Gg),!e)return;const{top:n,left:o,bottom:r,right:a}=t(e);qg(e)&&(r<=0||a<=0||n>=window.innerHeight||o>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}(n),t(Ig)}handleKeyDown(e){if(Bo(e)){const{active:t,context:n,options:o}=this.props,{keyboardCodes:r=gv,coordinateGetter:a=vv,scrollBehavior:s="smooth"}=o,{code:i}=e;if(r.end.includes(i))return void this.handleEnd(e);if(r.cancel.includes(i))return void this.handleCancel(e);const{collisionRect:l}=n.current,c=l?{x:l.left,y:l.top}:Ig;this.referenceCoordinates||(this.referenceCoordinates=c);const d=a(e,{active:t,context:n.current,currentCoordinates:c});if(d){const t=Uo(d,c),o={x:0,y:0},{scrollableAncestors:r}=n.current;for(const n of r){const r=e.code,{isTop:a,isRight:i,isLeft:l,isBottom:c,maxScroll:u,minScroll:h}=tv(n),m=rv(n),f={x:Math.min(r===hv.Right?m.right-m.width/2:m.right,Math.max(r===hv.Right?m.left:m.left+m.width/2,d.x)),y:Math.min(r===hv.Down?m.bottom-m.height/2:m.bottom,Math.max(r===hv.Down?m.top:m.top+m.height/2,d.y))},p=r===hv.Right&&!i||r===hv.Left&&!l,g=r===hv.Down&&!c||r===hv.Up&&!a;if(p&&f.x!==d.x){const e=n.scrollLeft+t.x,a=r===hv.Right&&e<=u.x||r===hv.Left&&e>=h.x;if(a&&!t.y)return void n.scrollTo({left:e,behavior:s});o.x=a?n.scrollLeft-e:r===hv.Right?n.scrollLeft-u.x:n.scrollLeft-h.x,o.x&&n.scrollBy({left:-o.x,behavior:s});break}if(g&&f.y!==d.y){const e=n.scrollTop+t.y,a=r===hv.Down&&e<=u.y||r===hv.Up&&e>=h.y;if(a&&!t.x)return void n.scrollTo({top:e,behavior:s});o.y=a?n.scrollTop-e:r===hv.Down?n.scrollTop-u.y:n.scrollTop-h.y,o.y&&n.scrollBy({top:-o.y,behavior:s});break}}this.handleMove(e,Vo(Uo(d,this.referenceCoordinates),o))}}}handleMove(e,t){const{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function yv(e){return Boolean(e&&"distance"in e)}function bv(e){return Boolean(e&&"delay"in e)}xv.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:o=gv,onActivation:r}=t,{active:a}=n;const{code:s}=e.nativeEvent;if(o.start.includes(s)){const t=a.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==r||r({event:e.nativeEvent}),!0)}return!1}}];class wv{constructor(e,t,n){var o;void 0===n&&(n=function(e){const{EventTarget:t}=Lo(e);return e instanceof t?e:zo(e)}(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=t;const{event:r}=e,{target:a}=r;this.props=e,this.events=t,this.document=zo(a),this.documentListeners=new lv(this.document),this.listeners=new lv(n),this.windowListeners=new lv(Lo(a)),this.initialCoordinates=null!=(o=Ho(r))?o:Ig,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:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),this.windowListeners.add(dv.Resize,this.handleCancel),this.windowListeners.add(dv.DragStart,fv),this.windowListeners.add(dv.VisibilityChange,this.handleCancel),this.windowListeners.add(dv.ContextMenu,fv),this.documentListeners.add(dv.Keydown,this.handleKeydown),t){if(null!=n&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(bv(t))return void(this.timeoutId=setTimeout(this.handleStart,t.delay));if(yv(t))return}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(dv.Click,pv,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(dv.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:o,props:r}=this,{onMove:a,options:{activationConstraint:s}}=r;if(!o)return;const i=null!=(t=Ho(e))?t:Ig,l=Uo(o,i);if(!n&&s){if(yv(s)){if(null!=s.tolerance&&cv(l,s.tolerance))return this.handleCancel();if(cv(l,s.distance))return this.handleStart()}return bv(s)&&cv(l,s.tolerance)?this.handleCancel():void 0}e.cancelable&&e.preventDefault(),a(i)}handleEnd(){const{onEnd:e}=this.props;this.detach(),e()}handleCancel(){const{onCancel:e}=this.props;this.detach(),e()}handleKeydown(e){e.code===hv.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const kv={move:{name:"pointermove"},end:{name:"pointerup"}};class Nv extends wv{constructor(e){const{event:t}=e,n=zo(t.target);super(e,kv,n)}}Nv.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return!(!n.isPrimary||0!==n.button)&&(null==o||o({event:n}),!0)}}];const Ev={move:{name:"mousemove"},end:{name:"mouseup"}};var Cv,Sv;(Sv=Cv||(Cv={}))[Sv.RightClick=2]="RightClick";(class extends wv{constructor(e){super(e,Ev,zo(e.event.target))}}).activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return n.button!==Cv.RightClick&&(null==o||o({event:n}),!0)}}];const jv={move:{name:"touchmove"},end:{name:"touchend"}};var _v,Iv,Av,Mv;function Tv(e){let{acceleration:t,activator:n=_v.Pointer,canScroll:o,draggingRect:a,enabled:s,interval:i=5,order:l=Av.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,delta:h,threshold:m}=e;const f=function(e){let{delta:t,disabled:n}=e;const o=Ko(t);return Jo((e=>{if(n||!o||!e)return Ov;const r={x:Math.sign(t.x-o.x),y:Math.sign(t.y-o.y)};return{x:{[Zg.Backward]:e.x[Zg.Backward]||-1===r.x,[Zg.Forward]:e.x[Zg.Forward]||1===r.x},y:{[Zg.Backward]:e.y[Zg.Backward]||-1===r.y,[Zg.Forward]:e.y[Zg.Forward]||1===r.y}}}),[n,t,o])}({delta:h,disabled:!s}),[p,g]=Yo(),v=r.useRef({x:0,y:0}),x=r.useRef({x:0,y:0}),y=r.useMemo((()=>{switch(n){case _v.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case _v.DraggableRect:return a}}),[n,a,c]),b=r.useRef(null),w=r.useCallback((()=>{const e=b.current;if(!e)return;const t=v.current.x*x.current.x,n=v.current.y*x.current.y;e.scrollBy(t,n)}),[]),k=r.useMemo((()=>l===Av.TreeOrder?[...d].reverse():d),[l,d]);r.useEffect((()=>{if(s&&d.length&&y){for(const e of k){if(!1===(null==o?void 0:o(e)))continue;const n=d.indexOf(e),r=u[n];if(!r)continue;const{direction:a,speed:s}=ov(e,r,y,t,m);for(const e of["x","y"])f[e][a[e]]||(s[e]=0,a[e]=0);if(s.x>0||s.y>0)return g(),b.current=e,p(w,i),v.current=s,void(x.current=a)}v.current={x:0,y:0},x.current={x:0,y:0},g()}else g()}),[t,w,o,g,s,i,JSON.stringify(y),JSON.stringify(f),p,d,k,u,JSON.stringify(m)])}(class extends wv{constructor(e){super(e,jv)}static setup(){return window.addEventListener(jv.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(jv.move.name,e)};function e(){}}}).activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;const{touches:r}=n;return!(r.length>1)&&(null==o||o({event:n}),!0)}}],(Iv=_v||(_v={}))[Iv.Pointer=0]="Pointer",Iv[Iv.DraggableRect=1]="DraggableRect",(Mv=Av||(Av={}))[Mv.TreeOrder=0]="TreeOrder",Mv[Mv.ReversedTreeOrder=1]="ReversedTreeOrder";const Ov={x:{[Zg.Backward]:!1,[Zg.Forward]:!1},y:{[Zg.Backward]:!1,[Zg.Forward]:!1}};var Dv,Pv,Rv;(Pv=Dv||(Dv={}))[Pv.Always=0]="Always",Pv[Pv.BeforeDragging=1]="BeforeDragging",Pv[Pv.WhileDragging=2]="WhileDragging",(Rv||(Rv={})).Optimized="optimized";const Fv=new Map;function Lv(e,t){return Jo((n=>e?n||("function"==typeof t?t(e):e):null),[t,e])}function zv(e){let{callback:t,disabled:n}=e;const o=ar(t),a=r.useMemo((()=>{if(n||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(o)}),[n]);return r.useEffect((()=>()=>null==a?void 0:a.disconnect()),[a]),a}function Bv(e){return new iv(Gg(e),e)}function Uv(e,t,n){void 0===t&&(t=Bv);const[o,a]=r.useReducer((function(o){if(!e)return null;var r;if(!1===e.isConnected)return null!=(r=null!=o?o:n)?r:null;const a=t(e);if(JSON.stringify(o)===JSON.stringify(a))return o;return a}),null),s=function(e){let{callback:t,disabled:n}=e;const o=ar(t),a=r.useMemo((()=>{if(n||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(o)}),[o,n]);return r.useEffect((()=>()=>null==a?void 0:a.disconnect()),[a]),a}({callback(t){if(e)for(const n of t){const{type:t,target:o}=n;if("childList"===t&&o instanceof HTMLElement&&o.contains(e)){a();break}}}}),i=zv({callback:a});return qo((()=>{a(),e?(null==i||i.observe(e),null==s||s.observe(document.body,{childList:!0,subtree:!0})):(null==i||i.disconnect(),null==s||s.disconnect())}),[e]),o}const Vv=[];function $v(e,t){void 0===t&&(t=[]);const n=r.useRef(null);return r.useEffect((()=>{n.current=null}),t),r.useEffect((()=>{const t=e!==Ig;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)}),[e]),n.current?Uo(e,n.current):Ig}function Gv(e){return r.useMemo((()=>e?function(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}(e):null),[e])}const Hv=[];function Wv(e){let{measure:t}=e;const[n,o]=r.useState(null),a=zv({callback:r.useCallback((e=>{for(const{target:n}of e)if(Zo(n)){o((e=>{const o=t(n);return e?{...e,width:o.width,height:o.height}:o}));break}}),[t])}),s=r.useCallback((e=>{const n=function(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Zo(t)?t:e}(e);null==a||a.disconnect(),n&&(null==a||a.observe(n)),o(n?t(n):null)}),[t,a]),[i,l]=Qo(s);return r.useMemo((()=>({nodeRef:i,rect:n,setRef:l})),[n,i,l])}const qv=[{sensor:Nv,options:{}},{sensor:xv,options:{}}],Yv={current:{}},Kv={draggable:{measure:Hg},droppable:{measure:Hg,strategy:Dv.WhileDragging,frequency:Rv.Optimized},dragOverlay:{measure:Gg}};class Jv extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter((e=>{let{disabled:t}=e;return!t}))}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}const Xv={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Jv,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:jg},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Kv,measureDroppableContainers:jg,windowRect:null,measuringScheduled:!1},Zv={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:jg,draggableNodes:new Map,over:null,measureDroppableContainers:jg},Qv=r.createContext(Zv),ex=r.createContext(Xv);function tx(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Jv}}}function nx(e,t){switch(t.type){case Cg.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Cg.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case Cg.DragEnd:case Cg.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Cg.RegisterDroppable:{const{element:n}=t,{id:o}=n,r=new Jv(e.droppable.containers);return r.set(o,n),{...e,droppable:{...e.droppable,containers:r}}}case Cg.SetDroppableDisabled:{const{id:n,key:o,disabled:r}=t,a=e.droppable.containers.get(n);if(!a||o!==a.key)return e;const s=new Jv(e.droppable.containers);return s.set(n,{...a,disabled:r}),{...e,droppable:{...e.droppable,containers:s}}}case Cg.UnregisterDroppable:{const{id:n,key:o}=t,r=e.droppable.containers.get(n);if(!r||o!==r.key)return e;const a=new Jv(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function ox(e){let{disabled:t}=e;const{active:n,activatorEvent:o,draggableNodes:a}=r.useContext(Qv),s=Ko(o),i=Ko(null==n?void 0:n.id);return r.useEffect((()=>{if(!t&&!o&&s&&null!=i){if(!Bo(s))return;if(document.activeElement===s.target)return;const e=a.get(i);if(!e)return;const{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame((()=>{for(const e of[t.current,n.current]){if(!e)continue;const t=er(e);if(t){t.focus();break}}}))}}),[o,t,a,i,s]),null}const rx=r.createContext({...Ig,scaleX:1,scaleY:1});var ax,sx;(sx=ax||(ax={}))[sx.Uninitialized=0]="Uninitialized",sx[sx.Initializing=1]="Initializing",sx[sx.Initialized=2]="Initialized";const ix=r.memo((function(e){var t,n,o,a;let{id:s,accessibility:i,autoScroll:l=!0,children:c,sensors:d=qv,collisionDetection:h=Lg,measuring:m,modifiers:f,...p}=e;const g=r.useReducer(nx,void 0,tx),[v,x]=g,[y,b]=function(){const[e]=r.useState((()=>new Set)),t=r.useCallback((t=>(e.add(t),()=>e.delete(t))),[e]);return[r.useCallback((t=>{let{type:n,event:o}=t;e.forEach((e=>{var t;return null==(t=e[n])?void 0:t.call(e,o)}))}),[e]),t]}(),[w,k]=r.useState(ax.Uninitialized),N=w===ax.Initialized,{draggable:{active:E,nodes:C,translate:S},droppable:{containers:j}}=v,_=E?C.get(E):null,I=r.useRef({initial:null,translated:null}),A=r.useMemo((()=>{var e;return null!=E?{id:E,data:null!=(e=null==_?void 0:_.data)?e:Yv,rect:I}:null}),[E,_]),M=r.useRef(null),[T,O]=r.useState(null),[D,P]=r.useState(null),R=$o(p,Object.values(p)),F=Go("DndDescribedBy",s),L=r.useMemo((()=>j.getEnabled()),[j]),z=(B=m,r.useMemo((()=>({draggable:{...Kv.draggable,...null==B?void 0:B.draggable},droppable:{...Kv.droppable,...null==B?void 0:B.droppable},dragOverlay:{...Kv.dragOverlay,...null==B?void 0:B.dragOverlay}})),[null==B?void 0:B.draggable,null==B?void 0:B.droppable,null==B?void 0:B.dragOverlay]));var B;const{droppableRects:U,measureDroppableContainers:V,measuringScheduled:$}=function(e,t){let{dragging:n,dependencies:o,config:a}=t;const[s,i]=r.useState(null),{frequency:l,measure:c,strategy:d}=a,u=r.useRef(e),h=function(){switch(d){case Dv.Always:return!1;case Dv.BeforeDragging:return n;default:return!n}}(),m=$o(h),f=r.useCallback((function(e){void 0===e&&(e=[]),m.current||i((t=>null===t?e:t.concat(e.filter((e=>!t.includes(e))))))}),[m]),p=r.useRef(null),g=Jo((t=>{if(h&&!n)return Fv;if(!t||t===Fv||u.current!==e||null!=s){const t=new Map;for(let n of e){if(!n)continue;if(s&&s.length>0&&!s.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}const e=n.node.current,o=e?new iv(c(e),e):null;n.rect.current=o,o&&t.set(n.id,o)}return t}return t}),[e,s,n,h,c]);return r.useEffect((()=>{u.current=e}),[e]),r.useEffect((()=>{h||f()}),[n,h]),r.useEffect((()=>{s&&s.length>0&&i(null)}),[JSON.stringify(s)]),r.useEffect((()=>{h||"number"!=typeof l||null!==p.current||(p.current=setTimeout((()=>{f(),p.current=null}),l))}),[l,h,f,...o]),{droppableRects:g,measureDroppableContainers:f,measuringScheduled:null!=s}}(L,{dragging:N,dependencies:[S.x,S.y],config:z.droppable}),G=function(e,t){const n=null!==t?e.get(t):void 0,o=n?n.node.current:null;return Jo((e=>{var n;return null===t?null:null!=(n=null!=o?o:e)?n:null}),[o,t])}(C,E),H=r.useMemo((()=>D?Ho(D):null),[D]),W=function(){const e=!1===(null==T?void 0:T.autoScrollEnabled),t="object"==typeof l?!1===l.enabled:!1===l,n=N&&!e&&!t;if("object"==typeof l)return{...l,enabled:n};return{enabled:n}}(),q=function(e,t){return Lv(e,t)}(G,z.draggable.measure);!function(e){let{activeNode:t,measure:n,initialRect:o,config:a=!0}=e;const s=r.useRef(!1),{x:i,y:l}="boolean"==typeof a?{x:a,y:a}:a;qo((()=>{if(!i&&!l||!t)return void(s.current=!1);if(s.current||!o)return;const e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;const r=Bg(n(e),o);if(i||(r.x=0),l||(r.y=0),s.current=!0,Math.abs(r.x)>0||Math.abs(r.y)>0){const t=qg(e);t&&t.scrollBy({top:r.y,left:r.x})}}),[t,i,l,o,n])}({activeNode:E?C.get(E):null,config:W.layoutShiftCompensation,initialRect:q,measure:z.draggable.measure});const Y=Uv(G,z.draggable.measure,q),K=Uv(G?G.parentElement:null),J=r.useRef({activatorEvent:null,active:null,activeNode:G,collisionRect:null,collisions:null,droppableRects:U,draggableNodes:C,draggingNode:null,draggingNodeRect:null,droppableContainers:j,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),X=j.getNodeFor(null==(t=J.current.over)?void 0:t.id),Z=Wv({measure:z.dragOverlay.measure}),Q=null!=(n=Z.nodeRef.current)?n:G,ee=N?null!=(o=Z.rect)?o:Y:null,te=Boolean(Z.nodeRef.current&&Z.rect),ne=Bg(oe=te?null:Y,Lv(oe));var oe;const re=Gv(Q?Lo(Q):null),ae=function(e){const t=r.useRef(e),n=Jo((n=>e?n&&n!==Vv&&e&&t.current&&e.parentNode===t.current.parentNode?n:Wg(e):Vv),[e]);return r.useEffect((()=>{t.current=e}),[e]),n}(N?null!=X?X:G:null),se=function(e,t){void 0===t&&(t=Gg);const[n]=e,o=Gv(n?Lo(n):null),[a,s]=r.useReducer((function(){return e.length?e.map((e=>ev(e)?o:new iv(t(e),e))):Hv}),Hv),i=zv({callback:s});return e.length>0&&a===Hv&&s(),qo((()=>{e.length?e.forEach((e=>null==i?void 0:i.observe(e))):(null==i||i.disconnect(),s())}),[e]),a}(ae),ie=function(e,t){let{transform:n,...o}=t;return null!=e&&e.length?e.reduce(((e,t)=>t({transform:e,...o})),n):n}(f,{transform:{x:S.x-ne.x,y:S.y-ne.y,scaleX:1,scaleY:1},activatorEvent:D,active:A,activeNodeRect:Y,containerNodeRect:K,draggingNodeRect:ee,over:J.current.over,overlayNodeRect:Z.rect,scrollableAncestors:ae,scrollableAncestorRects:se,windowRect:re}),le=H?Vo(H,S):null,ce=function(e){const[t,n]=r.useState(null),o=r.useRef(e),a=r.useCallback((e=>{const t=Yg(e.target);t&&n((e=>e?(e.set(t,Xg(t)),new Map(e)):null))}),[]);return r.useEffect((()=>{const t=o.current;if(e!==t){r(t);const s=e.map((e=>{const t=Yg(e);return t?(t.addEventListener("scroll",a,{passive:!0}),[t,Xg(t)]):null})).filter((e=>null!=e));n(s.length?new Map(s):null),o.current=e}return()=>{r(e),r(t)};function r(e){e.forEach((e=>{const t=Yg(e);null==t||t.removeEventListener("scroll",a)}))}}),[a,e]),r.useMemo((()=>e.length?t?Array.from(t.values()).reduce(((e,t)=>Vo(e,t)),Ig):av(e):Ig),[e,t])}(ae),de=$v(ce),ue=$v(ce,[Y]),he=Vo(ie,de),me=ee?Vg(ee,ie):null,fe=A&&me?h({active:A,collisionRect:me,droppableRects:U,droppableContainers:L,pointerCoordinates:le}):null,pe=Dg(fe,"id"),[ge,ve]=r.useState(null),xe=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(te?ie:Vo(ie,ue),null!=(a=null==ge?void 0:ge.rect)?a:null,Y),ye=r.useCallback(((e,t)=>{let{sensor:n,options:o}=t;if(null==M.current)return;const r=C.get(M.current);if(!r)return;const a=e.nativeEvent,s=new n({active:M.current,activeNode:r,event:a,options:o,context:J,onStart(e){const t=M.current;if(null==t)return;const n=C.get(t);if(!n)return;const{onDragStart:o}=R.current,r={active:{id:t,data:n.data,rect:I}};Wo.unstable_batchedUpdates((()=>{null==o||o(r),k(ax.Initializing),x({type:Cg.DragStart,initialCoordinates:e,active:t}),y({type:"onDragStart",event:r})}))},onMove(e){x({type:Cg.DragMove,coordinates:e})},onEnd:i(Cg.DragEnd),onCancel:i(Cg.DragCancel)});function i(e){return async function(){const{active:t,collisions:n,over:o,scrollAdjustedTranslate:r}=J.current;let s=null;if(t&&r){const{cancelDrop:i}=R.current;if(s={activatorEvent:a,active:t,collisions:n,delta:r,over:o},e===Cg.DragEnd&&"function"==typeof i){await Promise.resolve(i(s))&&(e=Cg.DragCancel)}}M.current=null,Wo.unstable_batchedUpdates((()=>{x({type:e}),k(ax.Uninitialized),ve(null),O(null),P(null);const t=e===Cg.DragEnd?"onDragEnd":"onDragCancel";if(s){const e=R.current[t];null==e||e(s),y({type:t,event:s})}}))}}Wo.unstable_batchedUpdates((()=>{O(s),P(e.nativeEvent)}))}),[C]),be=function(e,t){return r.useMemo((()=>e.reduce(((e,n)=>{const{sensor:o}=n;return[...e,...o.activators.map((e=>({eventName:e.eventName,handler:t(e.handler,n)})))]}),[])),[e,t])}(d,r.useCallback(((e,t)=>(n,o)=>{const r=n.nativeEvent,a=C.get(o);if(null!==M.current||!a||r.dndKit||r.defaultPrevented)return;const s={active:a};!0===e(n,t.options,s)&&(r.dndKit={capturedBy:t.sensor},M.current=o,ye(n,t))}),[C,ye]));!function(e){r.useEffect((()=>{if(!Xo)return;const t=e.map((e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()}));return()=>{for(const e of t)null==e||e()}}),e.map((e=>{let{sensor:t}=e;return t})))}(d),qo((()=>{Y&&w===ax.Initializing&&k(ax.Initialized)}),[Y,w]),r.useEffect((()=>{const{onDragMove:e}=R.current,{active:t,activatorEvent:n,collisions:o,over:r}=J.current;if(!t||!n)return;const a={active:t,activatorEvent:n,collisions:o,delta:{x:he.x,y:he.y},over:r};Wo.unstable_batchedUpdates((()=>{null==e||e(a),y({type:"onDragMove",event:a})}))}),[he.x,he.y]),r.useEffect((()=>{const{active:e,activatorEvent:t,collisions:n,droppableContainers:o,scrollAdjustedTranslate:r}=J.current;if(!e||null==M.current||!t||!r)return;const{onDragOver:a}=R.current,s=o.get(pe),i=s&&s.rect.current?{id:s.id,rect:s.rect.current,data:s.data,disabled:s.disabled}:null,l={active:e,activatorEvent:t,collisions:n,delta:{x:r.x,y:r.y},over:i};Wo.unstable_batchedUpdates((()=>{ve(i),null==a||a(l),y({type:"onDragOver",event:l})}))}),[pe]),qo((()=>{J.current={activatorEvent:D,active:A,activeNode:G,collisionRect:me,collisions:fe,droppableRects:U,draggableNodes:C,draggingNode:Q,draggingNodeRect:ee,droppableContainers:j,over:ge,scrollableAncestors:ae,scrollAdjustedTranslate:he},I.current={initial:ee,translated:me}}),[A,G,fe,me,C,Q,ee,U,j,ge,ae,he]),Tv({...W,delta:S,draggingRect:me,pointerCoordinates:le,scrollableAncestors:ae,scrollableAncestorRects:se});const we=r.useMemo((()=>({active:A,activeNode:G,activeNodeRect:Y,activatorEvent:D,collisions:fe,containerNodeRect:K,dragOverlay:Z,draggableNodes:C,droppableContainers:j,droppableRects:U,over:ge,measureDroppableContainers:V,scrollableAncestors:ae,scrollableAncestorRects:se,measuringConfiguration:z,measuringScheduled:$,windowRect:re})),[A,G,Y,D,fe,K,Z,C,j,U,ge,V,ae,se,z,$,re]),ke=r.useMemo((()=>({activatorEvent:D,activators:be,active:A,activeNodeRect:Y,ariaDescribedById:{draggable:F},dispatch:x,draggableNodes:C,over:ge,measureDroppableContainers:V})),[D,be,A,Y,x,F,C,ge,V]);return u.createElement(wg.Provider,{value:b},u.createElement(Qv.Provider,{value:ke},u.createElement(ex.Provider,{value:we},u.createElement(rx.Provider,{value:xe},c)),u.createElement(ox,{disabled:!1===(null==i?void 0:i.restoreFocus)})),u.createElement(Eg,{...i,hiddenTextDescribedById:F}))})),lx=r.createContext(null),cx="button";function dx(e){let{id:t,data:n,disabled:o=!1,attributes:a}=e;const s=Go("Droppable"),{activators:i,activatorEvent:l,active:c,activeNodeRect:d,ariaDescribedById:u,draggableNodes:h,over:m}=r.useContext(Qv),{role:f=cx,roleDescription:p="draggable",tabIndex:g=0}=null!=a?a:{},v=(null==c?void 0:c.id)===t,x=r.useContext(v?rx:lx),[y,b]=Qo(),[w,k]=Qo(),N=function(e,t){return r.useMemo((()=>e.reduce(((e,n)=>{let{eventName:o,handler:r}=n;return e[o]=e=>{r(e,t)},e}),{})),[e,t])}(i,t),E=$o(n);qo((()=>(h.set(t,{id:t,key:s,node:y,activatorNode:w,data:E}),()=>{const e=h.get(t);e&&e.key===s&&h.delete(t)})),[h,t]);return{active:c,activatorEvent:l,activeNodeRect:d,attributes:r.useMemo((()=>({role:f,tabIndex:g,"aria-disabled":o,"aria-pressed":!(!v||f!==cx)||void 0,"aria-roledescription":p,"aria-describedby":u.draggable})),[o,f,g,v,p,u.draggable]),isDragging:v,listeners:o?void 0:N,node:y,over:m,setNodeRef:b,setActivatorNodeRef:k,transform:x}}const ux={timeout:25};function hx(e,t,n){const o=e.slice();return o.splice(n<0?o.length+n:n,0,o.splice(t,1)[0]),o}function mx(e,t){return e.reduce(((e,n,o)=>{const r=t.get(n);return r&&(e[o]=r),e}),Array(e.length))}function fx(e){return null!==e&&e>=0}const px={scaleX:1,scaleY:1},gx=e=>{var t;let{rects:n,activeNodeRect:o,activeIndex:r,overIndex:a,index:s}=e;const i=null!=(t=n[r])?t:o;if(!i)return null;const l=function(e,t,n){const o=e[t],r=e[t-1],a=e[t+1];if(!o||!r&&!a)return 0;if(n<t)return r?o.left-(r.left+r.width):a.left-(o.left+o.width);return a?a.left-(o.left+o.width):o.left-(r.left+r.width)}(n,s,r);if(s===r){const e=n[a];return e?{x:r<a?e.left+e.width-(i.left+i.width):e.left-i.left,y:0,...px}:null}return s>r&&s<=a?{x:-i.width-l,y:0,...px}:s<r&&s>=a?{x:i.width+l,y:0,...px}:{x:0,y:0,...px}};const vx=e=>{let{rects:t,activeIndex:n,overIndex:o,index:r}=e;const a=hx(t,o,n),s=t[r],i=a[r];return i&&s?{x:i.left-s.left,y:i.top-s.top,scaleX:i.width/s.width,scaleY:i.height/s.height}:null},xx={scaleX:1,scaleY:1},yx=e=>{var t;let{activeIndex:n,activeNodeRect:o,index:r,rects:a,overIndex:s}=e;const i=null!=(t=a[n])?t:o;if(!i)return null;if(r===n){const e=a[s];return e?{x:0,y:n<s?e.top+e.height-(i.top+i.height):e.top-i.top,...xx}:null}const l=function(e,t,n){const o=e[t],r=e[t-1],a=e[t+1];if(!o)return 0;if(n<t)return r?o.top-(r.top+r.height):a?a.top-(o.top+o.height):0;return a?a.top-(o.top+o.height):r?o.top-(r.top+r.height):0}(a,r,n);return r>n&&r<=s?{x:0,y:-i.height-l,...xx}:r<n&&r>=s?{x:0,y:i.height+l,...xx}:{x:0,y:0,...xx}};const bx="Sortable",wx=u.createContext({activeIndex:-1,containerId:bx,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:vx,disabled:{draggable:!1,droppable:!1}});function kx(e){let{children:t,id:n,items:o,strategy:a=vx,disabled:s=!1}=e;const{active:i,dragOverlay:l,droppableRects:c,over:d,measureDroppableContainers:h}=r.useContext(ex),m=Go(bx,n),f=Boolean(null!==l.rect),p=r.useMemo((()=>o.map((e=>"object"==typeof e&&"id"in e?e.id:e))),[o]),g=null!=i,v=i?p.indexOf(i.id):-1,x=d?p.indexOf(d.id):-1,y=r.useRef(p),b=!function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(p,y.current),w=-1!==x&&-1===v||b,k=function(e){return"boolean"==typeof e?{draggable:e,droppable:e}:e}(s);qo((()=>{b&&g&&h(p)}),[b,p,g,h]),r.useEffect((()=>{y.current=p}),[p]);const N=r.useMemo((()=>({activeIndex:v,containerId:m,disabled:k,disableTransforms:w,items:p,overIndex:x,useDragOverlay:f,sortedRects:mx(p,c),strategy:a})),[v,m,k.draggable,k.droppable,w,p,x,c,f,a]);return u.createElement(wx.Provider,{value:N},t)}const Nx=e=>{let{id:t,items:n,activeIndex:o,overIndex:r}=e;return hx(n,o,r).indexOf(t)},Ex=e=>{let{containerId:t,isSorting:n,wasDragging:o,index:r,items:a,newIndex:s,previousItems:i,previousContainerId:l,transition:c}=e;return!(!c||!o)&&((i===a||r!==s)&&(!!n||s!==r&&t===l))},Cx={duration:200,easing:"ease"},Sx="transform",jx=ir.Transition.toString({property:Sx,duration:0,easing:"linear"}),_x={roleDescription:"sortable"};function Ix(e){let{animateLayoutChanges:t=Ex,attributes:n,disabled:o,data:a,getNewIndex:s=Nx,id:i,strategy:l,resizeObserverConfig:c,transition:d=Cx}=e;const{items:u,containerId:h,activeIndex:m,disabled:f,disableTransforms:p,sortedRects:g,overIndex:v,useDragOverlay:x,strategy:y}=r.useContext(wx),b=function(e,t){var n,o;if("boolean"==typeof e)return{draggable:e,droppable:!1};return{draggable:null!=(n=null==e?void 0:e.draggable)?n:t.draggable,droppable:null!=(o=null==e?void 0:e.droppable)?o:t.droppable}}(o,f),w=u.indexOf(i),k=r.useMemo((()=>({sortable:{containerId:h,index:w,items:u},...a})),[h,a,w,u]),N=r.useMemo((()=>u.slice(u.indexOf(i))),[u,i]),{rect:E,node:C,isOver:S,setNodeRef:j}=function(e){let{data:t,disabled:n=!1,id:o,resizeObserverConfig:a}=e;const s=Go("Droppable"),{active:i,dispatch:l,over:c,measureDroppableContainers:d}=r.useContext(Qv),u=r.useRef({disabled:n}),h=r.useRef(!1),m=r.useRef(null),f=r.useRef(null),{disabled:p,updateMeasurementsFor:g,timeout:v}={...ux,...a},x=$o(null!=g?g:o),y=zv({callback:r.useCallback((()=>{h.current?(null!=f.current&&clearTimeout(f.current),f.current=setTimeout((()=>{d(Array.isArray(x.current)?x.current:[x.current]),f.current=null}),v)):h.current=!0}),[v]),disabled:p||!i}),b=r.useCallback(((e,t)=>{y&&(t&&(y.unobserve(t),h.current=!1),e&&y.observe(e))}),[y]),[w,k]=Qo(b),N=$o(t);return r.useEffect((()=>{y&&w.current&&(y.disconnect(),h.current=!1,y.observe(w.current))}),[w,y]),qo((()=>(l({type:Cg.RegisterDroppable,element:{id:o,key:s,disabled:n,node:w,rect:m,data:N}}),()=>l({type:Cg.UnregisterDroppable,key:s,id:o}))),[o]),r.useEffect((()=>{n!==u.current.disabled&&(l({type:Cg.SetDroppableDisabled,id:o,key:s,disabled:n}),u.current.disabled=n)}),[o,s,n,l]),{active:i,rect:m,isOver:(null==c?void 0:c.id)===o,node:w,over:c,setNodeRef:k}}({id:i,data:k,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:N,...c}}),{active:_,activatorEvent:I,activeNodeRect:A,attributes:M,setNodeRef:T,listeners:O,isDragging:D,over:P,setActivatorNodeRef:R,transform:F}=dx({id:i,data:k,attributes:{..._x,...n},disabled:b.draggable}),L=sr(j,T),z=Boolean(_),B=z&&!p&&fx(m)&&fx(v),U=!x&&D,V=U&&B?F:null,$=B?null!=V?V:(null!=l?l:y)({rects:g,activeNodeRect:A,activeIndex:m,overIndex:v,index:w}):null,G=fx(m)&&fx(v)?s({id:i,items:u,activeIndex:m,overIndex:v}):w,H=null==_?void 0:_.id,W=r.useRef({activeId:H,items:u,newIndex:G,containerId:h}),q=u!==W.current.items,Y=t({active:_,containerId:h,isDragging:D,isSorting:z,id:i,index:w,items:u,newIndex:W.current.newIndex,previousItems:W.current.items,previousContainerId:W.current.containerId,transition:d,wasDragging:null!=W.current.activeId}),K=function(e){let{disabled:t,index:n,node:o,rect:a}=e;const[s,i]=r.useState(null),l=r.useRef(n);return qo((()=>{if(!t&&n!==l.current&&o.current){const e=a.current;if(e){const t=Gg(o.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&i(n)}}n!==l.current&&(l.current=n)}),[t,n,o,a]),r.useEffect((()=>{s&&i(null)}),[s]),s}({disabled:!Y,index:w,node:C,rect:E});return r.useEffect((()=>{z&&W.current.newIndex!==G&&(W.current.newIndex=G),h!==W.current.containerId&&(W.current.containerId=h),u!==W.current.items&&(W.current.items=u)}),[z,G,h,u]),r.useEffect((()=>{if(H===W.current.activeId)return;if(H&&!W.current.activeId)return void(W.current.activeId=H);const e=setTimeout((()=>{W.current.activeId=H}),50);return()=>clearTimeout(e)}),[H]),{active:_,activeIndex:m,attributes:M,data:k,rect:E,index:w,newIndex:G,items:u,isOver:S,isSorting:z,isDragging:D,listeners:O,node:C,overIndex:v,over:P,setNodeRef:L,setActivatorNodeRef:R,setDroppableNodeRef:j,setDraggableNodeRef:T,transform:null!=K?K:$,transition:function(){if(K||q&&W.current.newIndex===w)return jx;if(U&&!Bo(I)||!d)return;if(z||Y)return ir.Transition.toString({...d,property:Sx});return}()}}function Ax(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&"object"==typeof t.sortable&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const Mx=[hv.Down,hv.Right,hv.Up,hv.Left],Tx=(e,t)=>{let{context:{active:n,collisionRect:o,droppableRects:r,droppableContainers:a,over:s,scrollableAncestors:i}}=t;if(Mx.includes(e.code)){if(e.preventDefault(),!n||!o)return;const t=[];a.getEnabled().forEach((n=>{if(!n||null!=n&&n.disabled)return;const a=r.get(n.id);if(a)switch(e.code){case hv.Down:o.top<a.top&&t.push(n);break;case hv.Up:o.top>a.top&&t.push(n);break;case hv.Left:o.left>a.left&&t.push(n);break;case hv.Right:o.left<a.left&&t.push(n)}}));const l=(e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e;const r=Og(t),a=[];for(const s of o){const{id:e}=s,t=n.get(e);if(t){const n=Og(t),o=r.reduce(((e,t,o)=>e+Ag(n[o],t)),0),i=Number((o/4).toFixed(4));a.push({id:e,data:{droppableContainer:s,value:i}})}}return a.sort(Mg)})({active:n,collisionRect:o,droppableRects:r,droppableContainers:t,pointerCoordinates:null});let c=Dg(l,"id");if(c===(null==s?void 0:s.id)&&l.length>1&&(c=l[1].id),null!=c){const e=a.get(n.id),t=a.get(c),s=t?r.get(t.id):null,l=null==t?void 0:t.node.current;if(l&&s&&e&&t){const n=Wg(l).some(((e,t)=>i[t]!==e)),r=Ox(e,t),a=function(e,t){if(!Ax(e)||!Ax(t))return!1;if(!Ox(e,t))return!1;return e.data.current.sortable.index<t.data.current.sortable.index}(e,t),c=n||!r?{x:0,y:0}:{x:a?o.width-s.width:0,y:a?o.height-s.height:0},d={x:s.left,y:s.top};return c.x&&c.y?d:Uo(d,c)}}}};function Ox(e,t){return!(!Ax(e)||!Ax(t))&&e.data.current.sortable.containerId===t.data.current.sortable.containerId}const Dx=u.createContext(null),Px=r.memo((()=>r.useContext(Dx)));Px.displayName="DragHandle";const Rx=u.forwardRef((({cellId:e,canMoveX:t,...n},o)=>{const{attributes:r,listeners:a,setNodeRef:s,transform:i,transition:l,isDragging:c}=Ix({id:e.toString()}),d={transform:i?ir.Transform.toString({x:t?i.x:0,y:i.y,scaleX:1,scaleY:1}):void 0,transition:l,zIndex:c?2:void 0,position:"relative"},u=vg(o,s),h=p.jsx("div",{...r,...a,onMouseDown:qe.preventFocus,"data-testid":"drag-button",className:"py-[1px] cursor-grab opacity-50 hover:opacity-100 hover-action hover:bg-muted rounded border border-transparent hover:border-border active:bg-accent",children:p.jsx(Zl,{strokeWidth:1,size:20})}),m=Boolean(i);return p.jsx("div",{tabIndex:-1,ref:u,...n,"data-is-dragging":c,className:Jt(n.className,m&&"is-moving","outline-offset-4 outline-primary/40 rounded-lg"),style:d,children:p.jsx(Dx.Provider,{value:h,children:n.children})})}));Rx.displayName="SortableCell";const Fx=r.memo(Rx),Lx=u.memo(u.forwardRef(((e,t)=>{const n=m(34);let o,a,s;n[0]!==e?(({children:s,showTooltip:o,...a}=e),n[0]=e,n[1]=o,n[2]=a,n[3]=s):(o=n[1],a=n[2],s=n[3]);const i=void 0===o||o,[l,c]=r.useState(!1);let d;n[4]!==a?(d={cell:a},n[4]=a,n[5]=d):d=n[5];const u=dd(d),h=lr();let f,v,x,y,b,w;if(n[6]===Symbol.for("react.memo_cache_sentinel")?(f=()=>({toggle:()=>c((e=>!e))}),n[6]=f):f=n[6],r.useImperativeHandle(t,f),n[7]===Symbol.for("react.memo_cache_sentinel")?(v=p.jsx(Be,{placeholder:"Search actions...",className:"h-6 m-1"}),n[7]=v):v=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(x=p.jsx(Ve,{children:"No results"}),n[8]=x):x=n[8],n[9]!==u){let e;n[11]!==u.length?(e=(e,t)=>p.jsxs(r.Fragment,{children:[p.jsx(Te,{children:e.map((e=>p.jsx(Re,{onSelect:()=>{e.disableClick||(e.handle(),c(!1))},variant:e.variant,children:p.jsxs("div",{className:"flex items-center flex-1",children:[e.icon&&p.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:e.icon}),p.jsx("div",{className:"flex-1",children:e.label}),p.jsxs("div",{className:"flex-shrink-0 text-sm",children:[e.hotkey&&cr(e.hotkey),e.rightElement]})]})},e.label)))},t),t<u.length-1&&p.jsx(De,{})]},t),n[11]=u.length,n[12]=e):e=n[12],y=u.map(e),n[9]=u,n[10]=y}else y=n[10];n[13]!==y?(b=p.jsxs(an,{children:[v,p.jsxs(dr,{children:[x,y]})]}),n[13]=y,n[14]=b):b=n[14],n[15]!==h||n[16]!==b?(w=p.jsx(on,{className:"w-[300px] p-0 pt-1",...h,children:b}),n[15]=h,n[16]=b,n[17]=w):w=n[17];const k=w;if(!i){let e,t;return n[18]!==s?(e=p.jsx(ur,{asChild:!0,children:s}),n[18]=s,n[19]=e):e=n[19],n[20]!==l||n[21]!==e||n[22]!==k?(t=p.jsxs(rn,{open:l,onOpenChange:c,children:[e,k]}),n[20]=l,n[21]=e,n[22]=k,n[23]=t):t=n[23],t}let N;n[24]===Symbol.for("react.memo_cache_sentinel")?(N=p.jsx(hr,{tabIndex:-1,children:g("cell.cellActions")}),n[24]=N):N=n[24];const E=!l&&N;let C,S,j;return n[25]!==s?(C=p.jsx(mr,{children:p.jsx(ur,{className:"flex",children:s})}),n[25]=s,n[26]=C):C=n[26],n[27]!==E||n[28]!==C?(S=p.jsxs(fr,{delayDuration:200,disableHoverableContent:!0,children:[E,C]}),n[27]=E,n[28]=C,n[29]=S):S=n[29],n[30]!==l||n[31]!==S||n[32]!==k?(j=p.jsxs(rn,{open:l,onOpenChange:c,children:[S,k]}),n[30]=l,n[31]=S,n[32]=k,n[33]=j):j=n[33],j}))),zx=u.memo((e=>{const t=m(5),{children:n,cellId:o}=e;let r,a;t[0]!==o?(a=function(e){return H((t=>xd(e,t(Q))))}(o),t[0]=o,t[1]=a):a=t[1],r=a;const s=te(r);if(!s)return null;let i;return t[2]!==s||t[3]!==n?(i=p.jsx(Lx,{showTooltip:!1,...s,children:n}),t[2]=s,t[3]=n,t[4]=i):i=t[4],i}));zx.displayName="ConnectionCellActionsDropdown";const Bx=e=>{const t=m(29);let n,o,r;t[0]!==e?(({children:o,...n}=e),t[0]=e,t[1]=n,t[2]=o):(n=t[1],o=t[2]),t[3]!==n?(r={cell:n},t[3]=n,t[4]=r):r=t[4];const a=dd(r),[s,i]=u.useState();let l,c,d,h,f,g,v,x,y;if(t[5]===Symbol.for("react.memo_cache_sentinel")?(l=p.jsx(Ye,{size:13,strokeWidth:1.5}),t[5]=l):l=t[5],t[6]!==n.cellId?(c=()=>{var e;if(null==(e=window.getSelection())?void 0:e.toString())return void document.execCommand("copy");const t=document.getElementById(R.create(n.cellId));t?navigator.clipboard.writeText(t.textContent??""):G.warn("cell-context-menu: output not found")},t[6]=n.cellId,t[7]=c):c=t[7],t[8]!==c||t[9]!==n||t[10]!==s||t[11]!==o||t[12]!==a){const e=[{label:"Copy",icon:l,handle:c},{label:"Cut",icon:p.jsx(Nc,{size:13,strokeWidth:1.5}),handle:Ux},{label:"Paste",icon:p.jsx(Bl,{size:13,strokeWidth:1.5}),handle:async()=>{const{getEditorView:e}=n,t=e();if(!t)return;const o=await navigator.clipboard.readText();if(o){const{from:e,to:n}=t.state.selection.main,r=t.state.update({changes:{from:e,to:n,insert:o}});t.dispatch(r)}}},{icon:p.jsx(Hi,{size:13,strokeWidth:1.5}),label:"Download image",hidden:!s,handle:()=>{if(s){const e=document.createElement("a");e.download="image.png",e.href=s.src,e.click()}}},{label:"Go to Definition",icon:p.jsx(pr,{size:13,strokeWidth:1.5}),handle:()=>{const{getEditorView:e}=n,t=e();t&&gr(t)}}];let r;g=eg,t[18]===Symbol.for("react.memo_cache_sentinel")?(r=e=>{e.target instanceof HTMLImageElement?i(e.target):i(void 0)},t[18]=r):r=t[18],t[19]!==o?(v=p.jsx(tg,{onContextMenu:r,asChild:!0,children:o}),t[19]=o,t[20]=v):v=t[20],d=rg,h="w-[300px]",f=[e,...a].map($x),t[8]=c,t[9]=n,t[10]=s,t[11]=o,t[12]=a,t[13]=d,t[14]=h,t[15]=f,t[16]=g,t[17]=v}else d=t[13],h=t[14],f=t[15],g=t[16],v=t[17];return t[21]!==d||t[22]!==h||t[23]!==f?(x=p.jsx(d,{className:h,children:f}),t[21]=d,t[22]=h,t[23]=f,t[24]=x):x=t[24],t[25]!==g||t[26]!==v||t[27]!==x?(y=p.jsxs(g,{children:[v,x]}),t[25]=g,t[26]=v,t[27]=x,t[28]=y):y=t[28],y};function Ux(){document.execCommand("cut")}function Vx(e){return e.hidden?null:p.jsx(ag,{onSelect:t=>{e.handle(t)},variant:e.variant,children:p.jsxs("div",{className:"flex items-center flex-1",children:[e.icon&&p.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:e.icon}),p.jsx("div",{className:"flex-1",children:e.label}),p.jsxs("div",{className:"flex-shrink-0 text-sm",children:[e.hotkey&&cr(e.hotkey),e.rightElement]})]})},e.label)}function $x(e,t){return p.jsxs(r.Fragment,{children:[e.map(Vx),t<e.length-1&&p.jsx(sg,{})]},t)}const Gx=e=>{const t=m(24),{editorView:n,code:o,currentLanguageAdapter:r,onAfterToggle:a}=e;let s,i;t[0]!==o?(i=(new Oo).isSupported(o)||""===o.trim(),t[0]=o,t[1]=i):i=t[1],s=i;const l=s;let c,d;t[2]!==o?(d=(new Do).isSupported(o)||""===o.trim(),t[2]=o,t[3]=d):d=t[3],c=d;const u=c&&"python"===r;let h,f;t[4]===Symbol.for("react.memo_cache_sentinel")?(h=p.jsx(fe,{color:"var(--sky-11)",strokeWidth:2.5,className:"w-4 h-4"}),t[4]=h):h=t[4],t[5]!==n||t[6]!==r||t[7]!==u||t[8]!==a?(f=p.jsx(Hx,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:u,icon:h,toType:"sql",displayName:"SQL",onAfterToggle:a}),t[5]=n,t[6]=r,t[7]=u,t[8]=a,t[9]=f):f=t[9];const g=l&&"python"===r;let v,x,y,b,w;return t[10]===Symbol.for("react.memo_cache_sentinel")?(v=p.jsx(gi,{fill:"var(--sky-11)",color:"black",className:"w-4 h-4"}),t[10]=v):v=t[10],t[11]!==n||t[12]!==r||t[13]!==g||t[14]!==a?(x=p.jsx(Hx,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:g,icon:v,toType:"markdown",displayName:"Markdown",onAfterToggle:a}),t[11]=n,t[12]=r,t[13]=g,t[14]=a,t[15]=x):x=t[15],t[16]===Symbol.for("react.memo_cache_sentinel")?(y=p.jsx(vi,{fill:"var(--sky-11)",color:"black",className:"w-4 h-4"}),t[16]=y):y=t[16],t[17]!==n||t[18]!==r?(b=p.jsx(Hx,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:!0,icon:y,toType:"python",displayName:"Python",onAfterToggle:Xt.NOOP}),t[17]=n,t[18]=r,t[19]=b):b=t[19],t[20]!==f||t[21]!==x||t[22]!==b?(w=p.jsxs("div",{className:"absolute right-3 top-2 z-20 flex hover-action gap-1",children:[f,x,b]}),t[20]=f,t[21]=x,t[22]=b,t[23]=w):w=t[23],w},Hx=e=>{const t=m(10),{editorView:n,currentLanguageAdapter:o,canSwitchToLanguage:r,icon:a,toType:s,displayName:i,onAfterToggle:l}=e;if(!r)return null;if(o===s)return null;const c=`View as ${i}`;let d,u,h;return t[0]!==n||t[1]!==s||t[2]!==l?(d=()=>{n&&(me(n,s),l())},t[0]=n,t[1]=s,t[2]=l,t[3]=d):d=t[3],t[4]!==d||t[5]!==a?(u=p.jsx(x,{"data-testid":"language-toggle-button",variant:"text",size:"xs",className:"opacity-80 px-1",onClick:d,children:a}),t[4]=d,t[5]=a,t[6]=u):u=t[6],t[7]!==c||t[8]!==u?(h=p.jsx(v,{content:c,children:u}),t[7]=c,t[8]=u,t[9]=h):h=t[9],h};var Wx={modified:{doc:""},original:{doc:""}},qx=r.createContext(Wx);function Yx(e,t){return ao({},e,t,{modified:ao({},e.modified,t.modified),original:ao({},e.original,t.original)})}var Kx=()=>r.useContext(qx),Jx=e=>{var{children:t,theme:n}=e,[o,a]=r.useReducer(Yx,ao({},Wx,{theme:n}));return r.useEffect((()=>a({theme:n})),[n]),p.jsx(qx.Provider,{value:ao({},o,{dispatch:a}),children:t})},Xx=["extensions","value","selection","onChange"],Zx=e=>{var{extensions:t=[],value:n,selection:o,onChange:a}=e,s=vr(e,Xx),{theme:i,dispatch:l}=Kx(),c=xr(ao({},s,{theme:i}));return r.useEffect((()=>l({original:{doc:n,selection:o,extensions:[...c,...t]},originalExtension:{onChange:a,option:s,extension:[t]}})),[e]),null};Zx.displayName="CodeMirrorMerge.Original";var Qx=["extensions","value","selection","onChange"],ey=e=>{var{extensions:t=[],value:n,selection:o,onChange:a}=e,s=vr(e,Qx),{theme:i,dispatch:l}=Kx(),c=xr(ao({},s,{theme:i}));return r.useEffect((()=>{l({modified:{doc:n,selection:o,extensions:[...c,...t]},modifiedExtension:{onChange:a,option:s,extension:[t]}})}),[e]),null};ey.displayName="CodeMirrorMerge.Modified";class ty{constructor(e,t,n,o){this.fromA=e,this.toA=t,this.fromB=n,this.toB=o}offset(e,t){return new ty(this.fromA+e,this.toA+e,this.fromB+t,this.toB+t)}}function ny(e,t,n,o,r,a){if(e==o)return[];let s=cy(e,t,n,o,r,a),i=dy(e,t+s,n,o,r+s,a),l=(n-=i)-(t+=s),c=(a-=i)-(r+=s);if(!l||!c)return[new ty(t,n,r,a)];if(l>c){let s=e.slice(t,n).indexOf(o.slice(r,a));if(s>-1)return[new ty(t,t+s,r,r),new ty(t+s+c,n,a,a)]}else if(c>l){let s=o.slice(r,a).indexOf(e.slice(t,n));if(s>-1)return[new ty(t,t,r,r+s),new ty(n,n,r+s+l,a)]}if(1==l||1==c)return[new ty(t,n,r,a)];let d=hy(e,t,n,o,r,a);if(d){let[s,i,l]=d;return ny(e,t,s,o,r,i).concat(ny(e,s+l,n,o,i+l,a))}return function(e,t,n,o,r,a){let s=n-t,i=a-r;if(oy<1e9&&Math.min(s,i)>16*oy)return Math.min(s,i)>64*oy?[new ty(t,n,r,a)]:my(e,t,n,o,r,a);let l=Math.ceil((s+i)/2);ay.reset(l),sy.reset(l);let c=(n,a)=>e.charCodeAt(t+n)==o.charCodeAt(r+a),d=(t,r)=>e.charCodeAt(n-t-1)==o.charCodeAt(a-r-1),u=(s-i)%2!=0?sy:null,h=u?null:ay;for(let m=0;m<l;m++){if(m>oy)return my(e,t,n,o,r,a);let f=ay.advance(m,s,i,l,u,!1,c)||sy.advance(m,s,i,l,h,!0,d);if(f)return iy(e,t,n,t+f[0],o,r,a,r+f[1])}return[new ty(t,n,r,a)]}(e,t,n,o,r,a)}let oy=1e9;class ry{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let t=0;t<this.len;t++)this.vec[t]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,t,n,o,r,a,s){for(let i=-e+this.start;i<=e-this.end;i+=2){let l=o+i,c=i==-e||i!=e&&this.vec[l-1]<this.vec[l+1]?this.vec[l+1]:this.vec[l-1]+1,d=c-i;for(;c<t&&d<n&&s(c,d);)c++,d++;if(this.vec[l]=c,c>t)this.end+=2;else if(d>n)this.start+=2;else if(r){let e=o+(t-n)-i;if(e>=0&&e<this.len&&-1!=r.vec[e])if(a){let n=r.vec[e];if(n>=t-c)return[n,o+n-e]}else{if(c>=t-r.vec[e])return[c,d]}}}return null}}const ay=new ry,sy=new ry;function iy(e,t,n,o,r,a,s,i){let l=!1;return Ey(e,o)||++o!=n||(l=!0),Ey(r,i)||++i!=s||(l=!0),l?[new ty(t,n,a,s)]:ny(e,t,o,r,a,i).concat(ny(e,o,n,r,i,s))}function ly(e,t){let n=1,o=Math.min(e,t);for(;n<o;)n<<=1;return n}function cy(e,t,n,o,r,a){if(t==n||t==a||e.charCodeAt(t)!=o.charCodeAt(r))return 0;let s=ly(n-t,a-r);for(let i=t,l=r;;){let r=i+s,c=l+s;if(r>n||c>a||e.slice(i,r)!=o.slice(l,c)){if(1==s)return i-t-(Ey(e,i)?0:1);s>>=1}else{if(r==n||c==a)return r-t;i=r,l=c}}}function dy(e,t,n,o,r,a){if(t==n||r==a||e.charCodeAt(n-1)!=o.charCodeAt(a-1))return 0;let s=ly(n-t,a-r);for(let i=n,l=a;;){let a=i-s,c=l-s;if(a<t||c<r||e.slice(a,i)!=o.slice(c,l)){if(1==s)return n-i-(Ey(e,i)?0:1);s>>=1}else{if(a==t||c==r)return n-a;i=a,l=c}}}function uy(e,t,n,o,r,a,s,i){let l=o.slice(r,a),c=null;for(;;){if(c||s<i)return c;for(let i=t+s;;){Ey(e,i)||i++;let d=i+s;if(Ey(e,d)||(d+=d==i+1?1:-1),d>=n)break;let u=e.slice(i,d),h=-1;for(;-1!=(h=l.indexOf(u,h+1));){let s=cy(e,d,n,o,r+h+u.length,a),l=dy(e,t,i,o,r,r+h),m=u.length+s+l;(!c||c[2]<m)&&(c=[i-l,r+h-l,m])}i=d}if(i<0)return c;s>>=1}}function hy(e,t,n,o,r,a){let s=n-t,i=a-r;if(s<i){let s=hy(o,r,a,e,t,n);return s&&[s[1],s[0],s[2]]}return s<4||2*i<s?null:uy(e,t,n,o,r,a,Math.floor(s/4),-1)}function my(e,t,n,o,r,a){let s,i=n-t,l=a-r;if(i<l){let l=uy(o,r,a,e,t,n,Math.floor(i/6),50);s=l&&[l[1],l[0],l[2]]}else s=uy(e,t,n,o,r,a,Math.floor(l/6),50);if(!s)return[new ty(t,n,r,a)];let[c,d,u]=s;return ny(e,t,c,o,r,d).concat(ny(e,c+u,n,o,d+u,a))}function fy(e,t){for(let n=1;n<e.length;n++){let o=e[n-1],r=e[n];o.toA>r.fromA-t&&o.toB>r.fromB-t&&(e[n-1]=new ty(o.fromA,r.toA,o.fromB,r.toB),e.splice(n--,1))}}let py;try{py=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch(eO){}function gy(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function vy(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?gy(n)?1:0:py?ky(n)&&t!=e.length-1?py.test(e.slice(t,t+2))?2:0:py.test(String.fromCharCode(n))?1:0:0}function xy(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?gy(n)?1:0:py?Ny(n)&&1!=t?py.test(e.slice(t-2,t))?2:0:py.test(String.fromCharCode(n))?1:0:0}function yy(e,t,n){if(t==e.length||!xy(e,t))return t;for(let o=t,r=t+n;;){let n=vy(e,o);if(!n)return o;if(o+=n,o>r)return t}}function by(e,t,n){if(!t||!vy(e,t))return t;for(let o=t,r=t-n;;){let n=xy(e,o);if(!n)return o;if(o-=n,o<r)return t}}function wy(e,t,n){for(let o=t,r=t-n;;){let n=o?e.charCodeAt(o-1):10;if(10==n)return o;if(o--,o<r||32!=n&&9!=n)return t}}const ky=e=>e>=55296&&e<=56319,Ny=e=>e>=56320&&e<=57343;function Ey(e,t){return!t||t==e.length||!ky(e.charCodeAt(t-1))||!Ny(e.charCodeAt(t))}function Cy(e,t,n){var o;return oy=(null!==(o=null==n?void 0:n.scanLimit)&&void 0!==o?o:1e9)>>1,function(e,t,n){for(;;){fy(n,1);let o=!1;for(let r=0;r<n.length;r++){let a,s,i=n[r];(a=cy(e,i.fromA,i.toA,t,i.fromB,i.toB))&&(i=n[r]=new ty(i.fromA+a,i.toA,i.fromB+a,i.toB)),(s=dy(e,i.fromA,i.toA,t,i.fromB,i.toB))&&(i=n[r]=new ty(i.fromA,i.toA-s,i.fromB,i.toB-s));let l=i.toA-i.fromA,c=i.toB-i.fromB;if(l&&c)continue;let d=i.fromA-(r?n[r-1].toA:0),u=(r<n.length-1?n[r+1].fromA:e.length)-i.toA;if(!d||!u)continue;let h=l?e.slice(i.fromA,i.toA):t.slice(i.fromB,i.toB);d<=h.length&&e.slice(i.fromA-d,i.fromA)==h.slice(h.length-d)?(n[r]=new ty(i.fromA-d,i.toA-d,i.fromB-d,i.toB-d),o=!0):u<=h.length&&e.slice(i.toA,i.toA+u)==h.slice(0,u)&&(n[r]=new ty(i.fromA+u,i.toA+u,i.fromB+u,i.toB+u),o=!0)}if(!o)break}return n}(e,t,ny(e,0,e.length,t,0,t.length))}function Sy(e,t,n){return function(e,t,n){for(let o=0,r=0;r<e.length;r++){let a=e[r],s=a.toA-a.fromA,i=a.toB-a.fromB;if(s&&i||s>3||i>3){let l=r==e.length-1?t.length:e[r+1].fromA,c=a.fromA-o,d=l-a.toA,u=by(t,a.fromA,Math.min(c,5)),h=yy(t,a.toA,Math.min(d,5)),m=a.fromA-u,f=h-a.toA;if(!s||!i){let d,p,g=Math.max(s,i),[v,x,y]=s?[t,a.fromA,a.toA]:[n,a.fromB,a.toB];m&&f?(g>m&&t.slice(u,a.fromA)==v.slice(y-m,y)?(a=e[r]=new ty(u,u+s,a.fromB-m,a.toB-m),u=a.fromA,h=yy(t,a.toA,Math.min(l-a.toA,5))):g>f&&t.slice(a.toA,h)==v.slice(x,x+f)&&(a=e[r]=new ty(h-s,h,a.fromB+f,a.toB+f),h=a.toA,u=by(t,a.fromA,Math.min(a.fromA-o,5))),m=a.fromA-u,f=h-a.toA):m||f||!(p=a.fromA-(d=wy(t,a.fromA,c)))||t.slice(d,a.fromA)!=v.slice(y-p,y)||(a=e[r]=new ty(d,d+s,a.fromB-p,a.toB-p))}(m||f)&&(a=e[r]=new ty(a.fromA-m,a.toA+f,a.fromB-m,a.toB+f)),o=a.toA}}return fy(e,3),e}(Cy(e,t,n),e,t)}const jy=hn.define({combine:e=>e[0]}),_y=Ut.define(),Iy=Vt.define({create:e=>null,update(e,t){for(let n of t.effects)n.is(_y)&&(e=n.value);return e}});class Ay{constructor(e,t,n,o,r){this.changes=e,this.fromA=t,this.toA=n,this.fromB=o,this.toB=r}offset(e,t){return e||t?new Ay(this.changes,this.fromA+e,this.toA+e,this.fromB+t,this.toB+t):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,t,n){return Oy(Sy(e.toString(),t.toString(),n),e,t,0,0)}static updateA(e,t,n,o,r){return Fy(Ry(e,o,!0,n.length),e,t,n,r)}static updateB(e,t,n,o,r){return Fy(Ry(e,o,!1,t.length),e,t,n,r)}}function My(e,t,n,o){let r=n.lineAt(e),a=o.lineAt(t);return r.to==e&&a.to==t&&e<n.length&&t<o.length?[e+1,t+1]:[r.from,a.from]}function Ty(e,t,n,o){let r=n.lineAt(e),a=o.lineAt(t);return r.from==e&&a.from==t?[e,t]:[r.to+1,a.to+1]}function Oy(e,t,n,o,r){let a=[];for(let s=0;s<e.length;s++){let i=e[s],[l,c]=My(i.fromA+o,i.fromB+r,t,n),[d,u]=Ty(i.toA+o,i.toB+r,t,n),h=[i.offset(-l+o,-c+r)];for(;s<e.length-1;){let a=e[s+1],[i,m]=My(a.fromA+o,a.fromB+r,t,n);if(i>d+1&&m>u+1)break;h.push(a.offset(-l+o,-c+r)),[d,u]=Ty(a.toA+o,a.toB+r,t,n),s++}a.push(new Ay(h,l,Math.max(l,d),c,Math.max(c,u)))}return a}const Dy=1e3;function Py(e,t,n,o){let r=0,a=e.length;for(;;){if(r==a){let o=0,a=0;r&&({toA:o,toB:a}=e[r-1]);let s=t-(n?o:a);return[o+s,a+s]}let s=r+a>>1,i=e[s],[l,c]=n?[i.fromA,i.toA]:[i.fromB,i.toB];if(l>t)a=s;else{if(!(c<=t))return o?[i.fromA,i.fromB]:[i.toA,i.toB];r=s+1}}}function Ry(e,t,n,o){let r=[];return t.iterChangedRanges(((a,s,i,l)=>{let c=0,d=n?t.length:o,u=0,h=n?o:t.length;a>Dy&&([c,u]=Py(e,a-Dy,n,!0)),s<t.length-Dy&&([d,h]=Py(e,s+Dy,n,!1));let m,f=l-i-(s-a),[p,g]=n?[f,0]:[0,f];r.length&&(m=r[r.length-1]).toA>=c?r[r.length-1]={fromA:m.fromA,fromB:m.fromB,toA:d,toB:h,diffA:m.diffA+p,diffB:m.diffB+g}:r.push({fromA:c,toA:d,fromB:u,toB:h,diffA:p,diffB:g})})),r}function Fy(e,t,n,o,r){if(!e.length)return t;let a=0,s=0,i=0,l=[];for(let c of e){let e=c.fromA+s,d=c.toA+s+c.diffA,u=c.fromB+i,h=c.toB+i+c.diffB;for(;a<t.length;){let n=t[a];if(n.toA+s<=e&&n.toB+i<=u)l.push(n.offset(s,i));else if(n.fromA+s>d)break;a++}for(let t of Oy(Sy(n.sliceString(e,d),o.sliceString(u,h),r),n,o,e,u))l.push(t);for(s+=c.diffA,i+=c.diffB;a<t.length;){let e=t[a];if(e.fromA>d+s&&e.fromB>h+i)break;a++}}for(;a<t.length;)l.push(t[a++].offset(s,i));return l}const Ly=Gt.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=Wy(e))}update(e){var t,n;(e.docChanged||e.viewportChanged||(t=e.startState,n=e.state,t.field(Iy,!1)!=n.field(Iy,!1))||function(e,t){return e.facet(jy)!=t.facet(jy)}(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=Wy(e.view))}},{decorations:e=>e.deco}),zy=dn.low(yr({class:"cm-changeGutter",markers:e=>{var t;return(null===(t=e.plugin(Ly))||void 0===t?void 0:t.gutter)||br.empty}}));const By=$t.line({class:"cm-changedLine"}),Uy=$t.mark({class:"cm-changedText"}),Vy=$t.mark({tagName:"ins",class:"cm-insertedLine"}),$y=$t.mark({tagName:"del",class:"cm-deletedLine"}),Gy=new class extends Nr{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function Hy(e,t,n,o,r,a){let s=n?e.fromA:e.fromB,i=n?e.toA:e.toB,l=0;if(s!=i){r.add(s,s,By),r.add(s,i,n?$y:Vy),a&&a.add(s,s,Gy);for(let c=t.iterRange(s,i-1),d=s;!c.next().done;){if(c.lineBreak){d++,r.add(d,d,By),a&&a.add(d,d,Gy);continue}let t=d+c.value.length;if(o)for(;l<e.changes.length;){let o=e.changes[l],a=s+(n?o.fromA:o.fromB),i=s+(n?o.toA:o.toB),c=Math.max(d,a),u=Math.min(t,i);if(c<u&&r.add(c,u,Uy),!(i<t))break;l++}d=t}}}function Wy(e){let t=e.state.field(Iy),{side:n,highlightChanges:o,markGutter:r}=e.state.facet(jy),a="a"==n,s=new Ht,i=r?new Ht:null,{from:l,to:c}=e.viewport;for(let d of t){if((a?d.fromA:d.fromB)>=c)break;(a?d.toA:d.toB)>l&&Hy(d,e.state.doc,a,o,s,i)}return{deco:s.finish(),gutter:i&&i.finish()}}class qy extends un{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 Yy=Ut.define({map:(e,t)=>e.map(t)}),Ky=Vt.define({create:()=>$t.none,update:(e,t)=>{for(let n of t.effects)if(n.is(Yy))return n.value;return e.map(t.changes)},provide:e=>Bt.decorations.from(e)}),Jy=.01;const Xy=Ut.define({map:(e,t)=>t.mapPos(e)});class Zy extends un{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let t=document.createElement("div");return t.className="cm-collapsedLines",t.textContent="⦚ "+e.state.phrase("$ unchanged lines",this.lines)+" ⦚",t.addEventListener("click",(t=>{let n=e.posAtDOM(t.target);e.dispatch({effects:Xy.of(n)});let{side:o,sibling:r}=e.state.facet(jy);r&&r().dispatch({effects:Xy.of(Qy(n,e.state.field(Iy),"a"==o))})})),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}}function Qy(e,t,n){let o=0,r=0;for(let a=0;;a++){let s=a<t.length?t[a]:null;if(!s||(n?s.fromA:s.fromB)>=e)return r+(e-o);[o,r]=n?[s.toA,s.toB]:[s.toB,s.toA]}}const eb=Vt.define({create:e=>$t.none,update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(Xy)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>Bt.decorations.from(e)});function tb({margin:e=3,minSize:t=4}){return eb.init((n=>function(e,t,n){let o=new Ht,r="a"==e.facet(jy).side,a=e.field(Iy),s=1;for(let i=0;;i++){let l=i<a.length?a[i]:null,c=i?s+t:1,d=l?e.doc.lineAt(r?l.fromA:l.fromB).number-1-t:e.doc.lines,u=d-c+1;if(u>=n&&o.add(e.doc.line(c).from,e.doc.line(d).to,$t.replace({widget:new Zy(u),block:!0})),!l)break;s=e.doc.lineAt(Math.min(e.doc.length,r?l.toA:l.toB)).number}return o.finish()}(n,e,t)))}const nb=Bt.styleModule.of(new wr({".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"}})),ob=Bt.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"}}),rb=new kr,ab=new kr;class sb{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig;let t=[dn.low(Ly),ob,nb,Ky,Bt.updateListener.of((e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some((e=>e.effects.some((e=>e.is(Yy)))))&&this.measure()}))],n=[jy.of({side:"a",sibling:()=>this.b,highlightChanges:!1!==e.highlightChanges,markGutter:!1!==e.gutter})];!1!==e.gutter&&n.push(zy);let o=Jn.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],Bt.editorAttributes.of({class:"cm-merge-a"}),ab.of(n),t]}),r=[jy.of({side:"b",sibling:()=>this.a,highlightChanges:!1!==e.highlightChanges,markGutter:!1!==e.gutter})];!1!==e.gutter&&r.push(zy);let a=Jn.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],Bt.editorAttributes.of({class:"cm-merge-b"}),ab.of(r),t]});this.chunks=Ay.build(o.doc,a.doc,this.diffConf);let s=[Iy.init((()=>this.chunks)),rb.of(e.collapseUnchanged?tb(e.collapseUnchanged):[])];o=o.update({effects:Ut.appendConfig.of(s)}).state,a=a.update({effects:Ut.appendConfig.of(s)}).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 i=e.orientation||"a-b",l=document.createElement("div");l.className="cm-mergeViewEditor";let c=document.createElement("div");c.className="cm-mergeViewEditor",this.editorDOM.appendChild("a-b"==i?l:c),this.editorDOM.appendChild("a-b"==i?c:l),this.a=new Bt({state:o,parent:l,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new Bt({state:a,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.b)}),this.setupRevertControls(!!e.revertControls,"b-to-a"==e.revertControls,e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,t){if(e.some((e=>e.docChanged))){let n=e[e.length-1],o=e.reduce(((e,t)=>e.compose(t.changes)),gn.empty(e[0].startState.doc.length));this.chunks=t==this.a?Ay.updateA(this.chunks,n.newDoc,this.b.state.doc,o,this.diffConf):Ay.updateB(this.chunks,this.a.state.doc,n.newDoc,o,this.diffConf),t.update([...e,n.state.update({effects:_y.of(this.chunks)})]);let r=t==this.a?this.b:this.a;r.update([r.state.update({effects:_y.of(this.chunks)})]),this.scheduleMeasure()}else t.update(e)}reconfigure(e){if("diffConfig"in e&&(this.diffConf=e.diffConfig),"orientation"in e){let t="b-a"!=e.orientation;if(t!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let e=this.a.dom.parentNode,n=this.b.dom.parentNode;e.remove(),n.remove(),this.editorDOM.insertBefore(t?e:n,this.editorDOM.firstChild),this.editorDOM.appendChild(t?n:e),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in e||"renderRevertControl"in e){let t=!!this.revertDOM,n=this.revertToA,o=this.renderRevert;"revertControls"in e&&(t=!!e.revertControls,n="b-to-a"==e.revertControls),"renderRevertControl"in e&&(o=e.renderRevertControl),this.setupRevertControls(t,n,o)}let t="highlightChanges"in e,n="gutter"in e,o="collapseUnchanged"in e;if(t||n||o){let r=[],a=[];if(t||n){let o=this.a.state.facet(jy),s=n?!1!==e.gutter:o.markGutter,i=t?!1!==e.highlightChanges:o.highlightChanges;r.push(ab.reconfigure([jy.of({side:"a",sibling:()=>this.b,highlightChanges:i,markGutter:s}),s?zy:[]])),a.push(ab.reconfigure([jy.of({side:"b",sibling:()=>this.a,highlightChanges:i,markGutter:s}),s?zy:[]]))}if(o){let t=rb.reconfigure(e.collapseUnchanged?tb(e.collapseUnchanged):[]);r.push(t),a.push(t)}this.a.dispatch({effects:r}),this.b.dispatch({effects:a})}this.scheduleMeasure()}setupRevertControls(e,t,n){this.revertToA=t,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=n,!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",(e=>this.revertClicked(e))),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,t,n){let o=new Ht,r=new Ht,a=e.state.field(Ky).iter(),s=t.state.field(Ky).iter(),i=0,l=0,c=0,d=0;for(let f=0;;f++){let u=f<n.length?n[f]:null;if(i<(u?u.fromA:e.state.doc.length)){let n=e.lineBlockAt(i).top+c-(t.lineBlockAt(l).top+d);n<-.01?(c-=n,o.add(i,i,$t.widget({widget:new qy(-n),block:!0,side:-1}))):n>Jy&&(d+=n,r.add(l,l,$t.widget({widget:new qy(n),block:!0,side:-1})))}if(!u)break;for(i=u.toA,l=u.toB;a.value&&a.from<i;)c-=a.value.spec.widget.height,a.next();for(;s.value&&s.from<l;)d-=s.value.spec.widget.height,s.next()}for(;a.value;)c-=a.value.spec.widget.height,a.next();for(;s.value;)d-=s.value.spec.widget.height,s.next();let u=e.contentHeight+c-(t.contentHeight+d);u<Jy?o.add(e.state.doc.length,e.state.doc.length,$t.widget({widget:new qy(-u),block:!0,side:1})):u>Jy&&r.add(t.state.doc.length,t.state.doc.length,$t.widget({widget:new qy(u),block:!0,side:1}));let h=o.finish(),m=r.finish();br.eq([h],[e.state.field(Ky)])||e.dispatch({effects:Yy.of(h)}),br.eq([m],[t.state.field(Ky)])||t.dispatch({effects:Yy.of(m)})}(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,t=e.firstChild,n=this.a.viewport,o=this.b.viewport;for(let r=0;r<this.chunks.length;r++){let a=this.chunks[r];if(a.fromA>n.to||a.fromB>o.to)break;if(a.fromA<n.from||a.fromB<o.from)continue;let s=this.a.lineBlockAt(a.fromA).top+"px";for(;t&&+t.dataset.chunk<r;)t=ib(t);t&&t.dataset.chunk==String(r)?(t.style.top!=s&&(t.style.top=s),t=t.nextSibling):e.insertBefore(this.renderRevertButton(s,r),t)}for(;t;)t=ib(t)}renderRevertButton(e,t){let n;if(this.renderRevert)n=this.renderRevert();else{n=document.createElement("button");let e=this.a.state.phrase("Revert this chunk");n.setAttribute("aria-label",e),n.setAttribute("title",e),n.textContent=this.revertToLeft?"⇜":"⇝"}return n.style.top=e,n.setAttribute("data-chunk",String(t)),n}revertClicked(e){let t,n=e.target;for(;n&&n.parentNode!=this.revertDOM;)n=n.parentNode;if(n&&(t=this.chunks[n.dataset.chunk])){let[n,o,r,a,s,i]=this.revertToA?[this.b,this.a,t.fromB,t.toB,t.fromA,t.toA]:[this.a,this.b,t.fromA,t.toA,t.fromB,t.toB],l=n.state.sliceDoc(r,Math.max(r,a-1));r!=a&&i<=o.state.doc.length&&(l+=n.state.lineBreak),o.dispatch({changes:{from:s,to:Math.min(o.state.doc.length,i),insert:l},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 ib(e){let t=e.nextSibling;return e.remove(),t}var lb=["className","children","orientation","revertControls","highlightChanges","gutter","collapseUnchanged","destroyRerender","renderRevertControl"],cb=["modified","modifiedExtension","original","originalExtension","theme","dispatch"],db=u.forwardRef(((e,t)=>{var{className:n,children:o,orientation:a,revertControls:s,highlightChanges:i,gutter:l,collapseUnchanged:c,destroyRerender:d=!0,renderRevertControl:u}=e,h=vr(e,lb),m=Kx(),{modified:f,modifiedExtension:g,original:v,originalExtension:x,theme:y,dispatch:b}=m,w=vr(m,cb),k=r.useRef(null),N=r.useRef(),E={orientation:a,revertControls:s,highlightChanges:i,gutter:l,collapseUnchanged:c,renderRevertControl:u};r.useImperativeHandle(t,(()=>({container:k.current,view:N.current,modified:f,original:v,config:ao({a:v,b:f,parent:k.current},E)})),[k,N,f,v,E]);var C=Bt.updateListener.of((e=>{if(e.docChanged&&"function"==typeof(null==x?void 0:x.onChange)){var t=e.state.doc.toString();null==x||x.onChange(t,e)}})),S=Bt.updateListener.of((e=>{if(e.docChanged&&"function"==typeof(null==g?void 0:g.onChange)){var t=e.state.doc.toString();null==g||g.onChange(t,e)}}));r.useEffect((()=>{!N.current&&k.current&&x&&g&&(N.current=new sb(ao({a:ao({},v,{extensions:[...(null==x?void 0:x.extension)||[],...xr(ao({},null==x?void 0:x.option,{theme:y})),C]}),b:ao({},f,{extensions:[...(null==g?void 0:g.extension)||[],...xr(ao({},null==g?void 0:g.option,{theme:y})),S]}),parent:k.current},E)),b({view:N.current}))}),[N,k,x,g]),r.useEffect((()=>{if(v&&v.doc&&N.current){var e,t,n=null==(e=N.current)?void 0:e.a.state.doc.toString();if(n!==v.doc)null==(t=N.current)||t.a.dispatch({changes:{from:0,to:n.length,insert:v.doc||""}})}if(f&&f.doc&&N.current){var o,r,a=null==(o=N.current)?void 0:o.b.state.doc.toString();if(a!==f.doc)null==(r=N.current)||r.b.dispatch({changes:{from:0,to:a.length,insert:f.doc||""}})}if(d&&N.current){var s=N.current.a.state.selection.ranges[0].from,i=N.current.b.state.selection.ranges[0].from;N.current.destroy(),N.current=new sb(ao({a:ao({},v,{extensions:[...(null==x?void 0:x.extension)||[],...xr(ao({},null==x?void 0:x.option,{theme:y}))]}),b:ao({},f,{extensions:[...(null==g?void 0:g.extension)||[],...xr(ao({},null==g?void 0:g.option,{theme:y}))]}),parent:k.current},E)),s&&(N.current.a.focus(),N.current.a.dispatch({selection:{anchor:s,head:s}})),i&&(N.current.b.focus(),N.current.b.dispatch({selection:{anchor:i,head:i}}))}}),[N,y,k.current,v,f,x,g,d]),r.useEffect((()=>()=>N.current&&N.current.destroy()),[]),r.useEffect((()=>{if(N.current){var e={};w.orientation!==a&&(e.orientation=a),w.revertControls!==s&&(e.revertControls=s),w.highlightChanges!==i&&(e.highlightChanges=i),w.gutter!==l&&(e.gutter=l),w.collapseUnchanged!==c&&(e.collapseUnchanged=c),w.renderRevertControl!==u&&(e.collapseUnchanged=c),Object.keys(e).length&&b&&N.current&&(N.current.reconfigure(ao({},e)),b(ao({},e)))}}),[b,N,a,s,i,l,c,u]);return p.jsx("div",ao({ref:k,className:"cm-merge-theme"+(n?" "+n:"")},h,{children:o}))}));db.displayName="CodeMirrorMerge.Internal";var ub=["theme"],hb=u.forwardRef(((e,t)=>{var{theme:n}=e,o=vr(e,ub);return p.jsx(Jx,{theme:n,children:p.jsx(db,ao({},o,{ref:t}))})}));function mb(e){return void 0===e&&(e=[]),Er({override:[t=>{var n=t.matchBefore(/@(\w+)?/);return n?n&&n.from==n.to&&!t.explicit?null:{from:null==n?void 0:n.from,options:[...e]}:null}]})}function fb(e){const t=function(e){const t=Y.get(Cr),n=Sr.keyBy(t,(e=>e.name)),o=e.match(/@([\w.]+)/g)||[];return o.map((e=>e.slice(1))).map((e=>n.get(e))).filter(Boolean)}(e);return G.debug("Included datasets",t),{includeOtherCode:Ci(""),context:{schema:t.map((e=>({name:e.name,columns:e.columns.map((e=>({name:e.name,type:e.type})))})))},code:""}}hb.Original=Zx,hb.Modified=ey,hb.displayName="CodeMirrorMerge",mb();const pb=[jr(),Bt.lineWrapping],gb=[_r(),Bt.lineWrapping],vb=Ir("marimo:ai-language","python"),xb=e=>{const t=m(65),{onClose:n}=e,{createNewCell:o}=B();let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a={},t[0]=a):a=t[0];const[s,i]=r.useState(a),[l,c]=Ie(vb),{theme:d}=Ee();let u,h,f;t[1]===Symbol.for("react.memo_cache_sentinel")?(u=Ar("api/ai/completion").toString(),h=Mr.headers(),t[1]=u,t[2]=h):(u=t[1],h=t[2]),t[3]!==s||t[4]!==l?(f={api:u,headers:h,streamMode:"text",body:{...s,language:l},onError:bb},t[3]=s,t[4]=l,t[5]=f):f=t[5];const{completion:g,input:v,stop:y,isLoading:b,setCompletion:w,setInput:k,handleSubmit:N}=Tr(f);let E;t[6]===Symbol.for("react.memo_cache_sentinel")?(E=p.jsx(Sc,{className:"size-4 text-[var(--blue-11)]"}),t[6]=E):E=t[6];const C="python"===l?"Python":"SQL";let S,j,_,I,A,M,T,O,D,P,R,F,L,z,U;t[7]===Symbol.for("react.memo_cache_sentinel")?(S=p.jsx(Pr,{className:"ml-1 h-3.5 w-3.5 text-muted-foreground/70"}),t[7]=S):S=t[7],t[8]!==C?(j=p.jsx(St,{asChild:!0,children:p.jsxs(x,{variant:"text",className:"ml-2",size:"xs","data-testid":"language-button",children:[C,S]})}),t[8]=C,t[9]=j):j=t[9],t[10]!==c?(_=p.jsx(Ct,{onClick:()=>c("python"),children:"Python"}),t[10]=c,t[11]=_):_=t[11],t[12]!==c?(I=p.jsx(Ct,{onClick:()=>c("sql"),children:"SQL"}),t[12]=c,t[13]=I):I=t[13],t[14]!==_||t[15]!==I?(A=p.jsxs(Ot,{align:"center",children:[_,I]}),t[14]=_,t[15]=I,t[16]=A):A=t[16],t[17]!==j||t[18]!==A?(M=p.jsxs(Tt,{modal:!1,children:[j,A]}),t[17]=j,t[18]=A,t[19]=M):M=t[19],t[20]!==w||t[21]!==n?(T=()=>{w(""),n()},t[20]=w,t[21]=n,t[22]=T):T=t[22],t[23]!==k?(O=e=>{k(e),i(fb(e))},t[23]=k,t[24]=O):O=t[24],t[25]!==b||t[26]!==N?(D=()=>{b||N()},t[25]=b,t[26]=N,t[27]=D):D=t[27],t[28]!==d||t[29]!==T||t[30]!==v||t[31]!==O||t[32]!==D?(P=p.jsx(yb,{theme:d,onClose:T,value:v,onChange:O,onSubmit:D}),t[28]=d,t[29]=T,t[30]=v,t[31]=O,t[32]=D,t[33]=P):P=t[33],t[34]!==b||t[35]!==y?(R=b&&p.jsxs(x,{"data-testid":"stop-completion-button",variant:"text",size:"sm",className:"mb-0",onClick:y,children:[p.jsx(Rr,{className:"animate-spin mr-1",size:14}),"Stop"]}),t[34]=b,t[35]=y,t[36]=R):R=t[36],t[37]!==b||t[38]!==g||t[39]!==o||t[40]!==l||t[41]!==w||t[42]!==n?(F=!b&&g&&p.jsx(x,{"data-testid":"accept-completion-button",variant:"text",size:"sm",className:"mb-0",disabled:b,onClick:()=>{o({cellId:"__end__",before:!1,code:"python"===l?g:Do.fromQuery(g)}),w(""),n()},children:p.jsx("span",{className:"text-[var(--grass-11)] opacity-100",children:"Accept"})}),t[37]=b,t[38]=g,t[39]=o,t[40]=l,t[41]=w,t[42]=n,t[43]=F):F=t[43],t[44]===Symbol.for("react.memo_cache_sentinel")?(L=p.jsx(qt,{className:"size-4"}),t[44]=L):L=t[44],t[45]!==n?(z=p.jsx(x,{variant:"text",size:"sm",className:"mb-0",onClick:n,children:L}),t[45]=n,t[46]=z):z=t[46],t[47]!==M||t[48]!==P||t[49]!==R||t[50]!==F||t[51]!==z?(U=p.jsxs("div",{className:"flex items-center px-3",children:[E,M,P,R,F,z]}),t[47]=M,t[48]=P,t[49]=R,t[50]=F,t[51]=z,t[52]=U):U=t[52];const V=U;let $,G,H,W;return t[53]===Symbol.for("react.memo_cache_sentinel")?($=Jt("flex flex-col w-full gap-2 py-2"),t[53]=$):$=t[53],t[54]!==g?(G=!g&&p.jsxs("span",{className:"text-xs text-muted-foreground px-3 flex flex-col gap-1",children:[p.jsxs("span",{children:["You can mention"," ",p.jsx("span",{className:"text-[var(--cyan-11)]",children:"@dataframe"})," or"," ",p.jsx("span",{className:"text-[var(--cyan-11)]",children:"@sql_table"})," to pull additional context such as column names."]}),p.jsx("span",{children:"Code from other cells is automatically included."})]}),t[54]=g,t[55]=G):G=t[55],t[56]!==g||t[57]!==d||t[58]!==l||t[59]!==w?(H=g&&p.jsx(Fr,{value:g,className:"cm border-t",onChange:w,theme:"dark"===d?"dark":"light",extensions:"python"===l?pb:gb}),t[56]=g,t[57]=d,t[58]=l,t[59]=w,t[60]=H):H=t[60],t[61]!==V||t[62]!==G||t[63]!==H?(W=p.jsxs("div",{className:$,children:[V,G,H]}),t[61]=V,t[62]=G,t[63]=H,t[64]=W):W=t[64],W},yb=e=>{const t=m(20),{value:n,inputRef:o,onChange:r,onSubmit:a,onClose:s,theme:i}=e,l=a,c=s,d=te(Cr);let u,h,f,g,v,x,y,b;if(t[0]!==d){let e;t[2]===Symbol.for("react.memo_cache_sentinel")?(e=e=>({label:`@${e.name}`,info:()=>{const t=[null==e.num_rows?void 0:`${e.num_rows} rows`,null==e.num_columns?void 0:`${e.num_columns} columns`].filter(Boolean).join(", "),n=document.createElement("div");if(n.classList.add("prose","prose-sm","dark:prose-invert"),t){const e=document.createElement("div");e.textContent=t,e.style.fontWeight="bold",n.append(e)}if(e.source){const t=document.createElement("figcaption");t.textContent=`Source: ${e.source}`,n.append(t)}if(e.columns){const t=document.createElement("table"),o=t.insertRow(),r=o.insertCell();r.textContent="Column",r.style.fontWeight="bold";const a=o.insertCell();a.textContent="Type",a.style.fontWeight="bold",e.columns.forEach((e=>{const n=t.insertRow();n.insertCell().textContent=e.name;n.insertCell().textContent=e.type})),n.append(t)}return n}}),t[2]=e):e=t[2];h=mb(d.map(e)),t[0]=d,t[1]=h}else h=t[1];t[3]===Symbol.for("react.memo_cache_sentinel")?(f=Or(),t[3]=f):f=t[3],t[4]!==l?(g=dn.highest(sn.of([{preventDefault:!0,stopPropagation:!0,any:(e,t)=>{const n=t.metaKey||t.ctrlKey||t.shiftKey;if("Enter"===t.key&&!n)return l(),t.preventDefault(),t.stopPropagation(),!0;if("Enter"===t.key&&t.shiftKey){const n=e.state.selection.main.from;return e.dispatch({changes:{from:n,to:n,insert:"\n"},selection:{anchor:n+1,head:n+1}}),t.preventDefault(),t.stopPropagation(),!0}return!1}}])),t[4]=l,t[5]=g):g=t[5],t[6]!==c?(v=sn.of([{key:"Escape",preventDefault:!0,stopPropagation:!0,run:()=>(c(),!0)}]),t[6]=c,t[7]=v):v=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(x=sn.of([{key:"ArrowUp",preventDefault:!0,stopPropagation:!0}]),y=sn.of([{key:"ArrowDown",preventDefault:!0,stopPropagation:!0}]),t[8]=x,t[9]=y):(x=t[8],y=t[9]),t[10]!==h||t[11]!==g||t[12]!==v?(b=[h,Bt.lineWrapping,f,g,v,x,y],t[10]=h,t[11]=g,t[12]=v,t[13]=b):b=t[13],u=b;const w=u,k="dark"===i?"dark":"light";let N;return t[14]!==o||t[15]!==n||t[16]!==w||t[17]!==r||t[18]!==k?(N=p.jsx(Fr,{ref:o,className:"flex-1 font-sans overflow-auto my-1",autoFocus:!0,width:"100%",value:n,basicSetup:!1,extensions:w,onChange:r,theme:k,placeholder:"Generate with AI"}),t[14]=o,t[15]=n,t[16]=w,t[17]=r,t[18]=k,t[19]=N):N=t[19],N};function bb(e){X({title:"Generate with AI failed",description:Dr(e)})}const wb=hb.Original,kb=hb.Modified,Nb=[jr(),Bt.lineWrapping],Eb=e=>{const t=m(53),{onChange:n,initialPrompt:o,currentLanguageAdapter:a,currentCode:s,declineChange:i,acceptChange:l,enabled:c,children:d}=e;let h;t[0]===Symbol.for("react.memo_cache_sentinel")?(h={},t[0]=h):h=t[0];const[f,g]=r.useState(h),[y,b]=Ie(ad);let w,k,N,E,C;t[1]===Symbol.for("react.memo_cache_sentinel")?(w=Ar("api/ai/completion").toString(),k=Mr.headers(),t[1]=w,t[2]=k):(w=t[1],k=t[2]),t[3]!==y||t[4]!==s?(N=y?Ci(s):"",t[3]=y,t[4]=s,t[5]=N):N=t[5],t[6]!==f||t[7]!==N||t[8]!==s||t[9]!==a?(E={...f,includeOtherCode:N,code:s,language:a},t[6]=f,t[7]=N,t[8]=s,t[9]=a,t[10]=E):E=t[10],t[11]!==o||t[12]!==E?(C={api:w,headers:k,initialInput:o,streamMode:"text",body:E,onError:Cb},t[11]=o,t[12]=E,t[13]=C):C=t[13];const{completion:S,input:j,stop:_,isLoading:I,setCompletion:A,setInput:M,handleSubmit:T}=Tr(C),O=u.useRef(null);let D,P,R,F;t[14]!==c?(D=()=>{const e=O.current;c&&e&&(requestAnimationFrame((()=>{var t;null==(t=e.view)||t.focus()})),Lr(O.current.view))},P=[c],t[14]=c,t[15]=D,t[16]=P):(D=t[15],P=t[16]),r.useEffect(D,P),t[17]!==c||t[18]!==M||t[19]!==o?(R=()=>{c&&M(o||"")},F=[c,o,M],t[17]=c,t[18]=M,t[19]=o,t[20]=R,t[21]=F):(R=t[20],F=t[21]),r.useEffect(R,F);const{theme:L}=Ee(),z=c&&"max-h-[400px] min-h-11 visible",B=!c&&"max-h-0 min-h-0 invisible";let U,V,$,G;t[22]!==z||t[23]!==B?(U=Jt("flex items-center gap-2 border-b px-3 transition-all rounded-[inherit] rounded-b-none duration-300 overflow-hidden",z,B),t[22]=z,t[23]=B,t[24]=U):U=t[24],t[25]!==c||t[26]!==i||t[27]!==A||t[28]!==M||t[29]!==I||t[30]!==T||t[31]!==O||t[32]!==L||t[33]!==j||t[34]!==_||t[35]!==S||t[36]!==l||t[37]!==b||t[38]!==y?(V=c&&p.jsxs(p.Fragment,{children:[p.jsx(Sc,{className:"text-[var(--blue-10)] flex-shrink-0",size:16}),p.jsx(yb,{inputRef:O,theme:L,onClose:()=>{i(),A("")},value:j,onChange:e=>{M(e),g(fb(e))},onSubmit:()=>{I||T()}}),I&&p.jsxs(x,{"data-testid":"stop-completion-button",variant:"text",size:"xs",className:"mb-0",onClick:_,children:[p.jsx(Rr,{className:"animate-spin mr-1",size:14}),"Stop"]}),!I&&S&&p.jsx(x,{"data-testid":"accept-completion-button",variant:"text",size:"xs",className:"mb-0",disabled:I,onClick:()=>{l(S),A("")},children:p.jsx("span",{className:"text-[var(--grass-11)] opacity-100",children:"Accept"})}),p.jsx("div",{className:"h-full w-px bg-border mx-2"}),p.jsx(v,{content:"Include code from other cells",children:p.jsxs("div",{className:"flex flex-row items-start gap-1 overflow-hidden",children:[p.jsx(zr,{"data-testid":"include-other-cells-checkbox",id:"include-other-cells",checked:y,onCheckedChange:e=>b(Boolean(e))}),p.jsx(ke,{htmlFor:"include-other-cells",className:"text-muted-foreground text-xs whitespace-nowrap ellipsis",children:"Include all code"})]})}),p.jsx(x,{"data-testid":"decline-completion-button",variant:"text",size:"icon",disabled:I,onClick:()=>{_(),i(),A("")},children:p.jsx(qt,{className:"text-[var(--red-10)]",size:16})})]}),t[25]=c,t[26]=i,t[27]=A,t[28]=M,t[29]=I,t[30]=T,t[31]=O,t[32]=L,t[33]=j,t[34]=_,t[35]=S,t[36]=l,t[37]=b,t[38]=y,t[39]=V):V=t[39],t[40]!==U||t[41]!==V?($=p.jsx("div",{className:U,children:V}),t[40]=U,t[41]=V,t[42]=$):$=t[42],t[43]!==S||t[44]!==c||t[45]!==n||t[46]!==s||t[47]!==L?(G=S&&c&&p.jsxs(hb,{className:"cm",theme:L,children:[p.jsx(wb,{onChange:n,value:s,extensions:Nb}),p.jsx(kb,{value:S,editable:!1,readOnly:!0,extensions:Nb})]}),t[43]=S,t[44]=c,t[45]=n,t[46]=s,t[47]=L,t[48]=G):G=t[48];const H=(!S||!c)&&d;let W;return t[49]!==$||t[50]!==G||t[51]!==H?(W=p.jsxs("div",{className:"flex flex-col w-full rounded-[inherit] overflow-hidden",children:[$,G,H]}),t[49]=$,t[50]=G,t[51]=H,t[52]=W):W=t[52],W};function Cb(e){X({title:"Completion failed",description:Dr(e)})}const Sb=u.forwardRef(((e,t)=>{const{className:n,editorView:o}=e,a=r.useRef(null);return r.useEffect((()=>{null!==o&&null!==a.current&&0===a.current.children.length&&a.current.append(o.dom)}),[o,a]),p.jsx("div",{className:Jt("cm",n),ref:vg(t,a),"data-testid":"cell-editor"})}));Sb.displayName="CellCodeMirrorEditor";const jb=r.memo((({theme:e,showPlaceholder:t,allowFocus:n,id:o,config:a,code:s,status:i,serializedEditorState:l,runCell:c,updateCellCode:d,createNewCell:u,deleteCell:h,focusCell:f,moveCell:g,moveToNextCell:v,updateCellConfig:x,clearSerializedEditorState:y,userConfig:b,editorViewRef:w,hidden:k,setTemporarilyVisible:N})=>{var E;const[C,S]=Ie(rd),[j,_]=r.useState(),I=function(){const e=m(2),t=ne(pd);let n;return e[0]!==t?(n=e=>{Ne!==e&&t(e)},e[0]=t,e[1]=n):n=e[1],n}(),A=r.useRef(null),M="running"===i||"queued"===i,{sendToTop:T,sendToBottom:O}=B(),D=function(){const e=m(3),{splitCell:t,undoSplitCell:n}=B();let o;return e[0]!==t||e[1]!==n?(o=e=>{const o=Br(e.cellId),r=(null==o?void 0:o.state.doc.toString())??"";t(e);const{dismiss:a}=X({title:"Cell split",action:p.jsx(sd,{"data-testid":"undo-split-button",size:"sm",variant:"outline",onClick:()=>{n({...e,snapshot:r}),s()},children:"Undo"})}),s=a},e[0]=t,e[1]=n,e[2]=o):o=e[2],z(o)}(),P=z((()=>!M&&(h({cellId:o}),!0))),R=r.useCallback((()=>u({cellId:o,before:!1})),[o,u]),F=r.useCallback((()=>u({cellId:o,before:!0})),[o,u]),L=r.useCallback((()=>g({cellId:o,before:!1})),[o,g]),U=r.useCallback((()=>g({cellId:o,before:!0})),[o,g]),V=r.useCallback((()=>f({cellId:o,before:!1})),[o,f]),$=r.useCallback((()=>f({cellId:o,before:!0})),[o,f]),G=z((()=>{const e=!a.hide_code;return be({configs:{[o]:{hide_code:e}}}),x({cellId:o,config:{hide_code:e}}),e})),H=te(re),W=z((()=>{cd(H,u)})),q=Ur(b),Y=r.useMemo((()=>{const n=(e=>{const{cellId:t,cellMovementCallbacks:n,cellCodeCallbacks:o,keymapConfig:r,hotkeys:a}=e;return[Mi(r,n),[Bt.domEventHandlers({drop:(e,t)=>{var n,o;const r=null==(n=e.dataTransfer)?void 0:n.files[0];if(null==r?void 0:r.type.startsWith("text/"))return e.preventDefault(),En(t,r),!0;if(null==r?void 0:r.type.startsWith("image/"))return e.preventDefault(),Cn(t,r),!0;const a=null==(o=e.dataTransfer)?void 0:o.getData("text/plain");if(a){e.preventDefault();const n=t.posAtCoords({x:e.clientX,y:e.clientY});return null!==n&&t.dispatch({changes:{from:n,to:n,insert:a},scrollIntoView:!0}),!0}return!1},dragover:e=>{e.preventDefault()}})],Sn(t,n,a),jn(t,o,a),Pp(e),[Mp,(s=(e,t)=>{bn(e,t)},Gt.define((e=>new Tp(e,s)))),Bt.baseTheme({".underline":{textDecoration:"underline",cursor:"pointer",color:"var(--link)"}})]];var s})({cellId:o,showPlaceholder:t,enableAI:q,cellCodeCallbacks:{updateCellCode:d,afterToggleMarkdown:W},cellMovementCallbacks:{onRun:c,deleteCell:P,createAbove:F,createBelow:R,moveUp:U,moveDown:L,focusUp:$,focusDown:V,sendToTop:T,sendToBottom:O,splitCell:D,moveToNextCell:v,toggleHideCode:G,aiCellCompletion:()=>{let e=!1;return S((t=>(null==t?void 0:t.cellId)===o?(e=!0,null):{cellId:o})),e}},completionConfig:b.completion,keymapConfig:b.keymap,theme:e,hotkeys:new Vr(b.keymap.overrides??{})});return n.push(Gt.define((e=>{const t=e.state.field($r);return _(t.type),{update(e){const t=e.state.field($r);_(t.type)}}}))),n}),[o,b.keymap,b.completion,q,e,t,F,R,$,V,U,L,v,T,O,D,G,d,P,c,S,W]);r.useEffect((()=>{let e;null===l?null===w.current?(w.current=new Bt({state:Jn.create({doc:s,extensions:Y})}),e=!0,me(w.current,Gr(w.current.state).type)):(w.current.dispatch({effects:[Ut.reconfigure.of([Y]),Hr(w.current,b.completion,new Vr(b.keymap.overrides??{}))]}),e=!1):(w.current=new Bt({state:Jn.fromJSON(l,{doc:s,extensions:Y},{history:Wr})}),me(w.current,Gr(w.current.state).type),e=!0,y({cellId:o})),null!==w.current&&null!==A.current&&A.current.replaceChildren(w.current.dom),e&&n&&requestAnimationFrame((()=>{var e,t;null==(e=w.current)||e.focus(),null==(t=w.current)||t.dom.scrollIntoView({behavior:"smooth",block:"nearest"})}))}),[w,Y,b.completion,b.keymap,y,o,l]),r.useEffect((()=>()=>{var e;null==(e=w.current)||e.destroy()}),[w]);const K=r.useCallback((async()=>{var e,t;if(k&&void 0!==N){N(!0),null==(e=w.current)||e.focus();const n=null==(t=A.current)?void 0:t.parentElement,o=new AbortController;null==n||n.addEventListener("focusout",(()=>{requestAnimationFrame((()=>{var e;const t=document.activeElement;(null==n?void 0:n.contains(t))||(N(!1),null==(e=w.current)||e.dom.blur(),o.abort())}))}),{signal:o.signal})}}),[k,N,w,A]);return p.jsx(Eb,{enabled:(null==C?void 0:C.cellId)===o,initialPrompt:null==C?void 0:C.initialPrompt,currentCode:(null==(E=w.current)?void 0:E.state.doc.toString())??s,currentLanguageAdapter:j,declineChange:()=>{var e;S(null),null==(e=w.current)||e.focus()},onChange:e=>{var t;null==(t=w.current)||t.dispatch({changes:{from:0,to:w.current.state.doc.length,insert:e}})},acceptChange:e=>{var t,n;null==(t=w.current)||t.dispatch({changes:{from:0,to:w.current.state.doc.length,insert:e}}),null==(n=w.current)||n.focus(),S(null)},children:p.jsxs("div",{className:"relative w-full",onFocus:()=>I(o),children:[k&&p.jsx(qr,{onClick:K}),p.jsx(Sb,{className:Jt(k&&"opacity-20 h-8 overflow-hidden"),editorView:w.current,ref:A}),!k&&p.jsx("div",{className:"absolute top-1 right-5",children:p.jsx(Gx,{code:s,editorView:w.current,currentLanguageAdapter:j,onAfterToggle:W})})]})})})),_b=e=>{const t=m(10);let n,o,r,a;return t[0]!==e.left?(n=p.jsx("div",{className:"flex-1 flex item-center gap-2",children:e.left}),t[0]=e.left,t[1]=n):n=t[1],t[2]!==e.center?(o=p.jsx("div",{className:"flex-1 flex item-center gap-2 justify-center",children:e.center}),t[2]=e.center,t[3]=o):o=t[3],t[4]!==e.right?(r=p.jsx("div",{className:"flex-1 flex item-center gap-2 justify-end",children:e.right}),t[4]=e.right,t[5]=r):r=t[5],t[6]!==n||t[7]!==o||t[8]!==r?(a=p.jsxs("div",{className:"flex items-center gap-2 w-full px-3",children:[n,o,r]}),t[6]=n,t[7]=o,t[8]=r,t[9]=a):a=t[9],a},Ib=e=>{const t=m(8);if(!e.canCollapse&&!e.isCollapsed)return null;const n=e.isCollapsed?"Expand":"Collapse";let o,r,a;return t[0]!==e.isCollapsed?(o=p.jsx(Ab,{isCollapsed:e.isCollapsed}),t[0]=e.isCollapsed,t[1]=o):o=t[1],t[2]!==n||t[3]!==o?(r=p.jsx(v,{content:n,children:o}),t[2]=n,t[3]=o,t[4]=r):r=t[4],t[5]!==e.onClick||t[6]!==r?(a=p.jsx(x,{variant:"text",size:"icon",onClick:e.onClick,children:r}),t[5]=e.onClick,t[6]=r,t[7]=a):a=t[7],a},Ab=e=>{const t=m(2),{isCollapsed:n}=e;let o;return t[0]!==n?(o=n?p.jsx(Jr,{className:"w-5 h-5 flex-shrink-0"}):p.jsx(ve,{className:"w-5 h-5 flex-shrink-0"}),t[0]=n,t[1]=o):o=t[1],o},Mb=r.memo((e=>{const t=m(24),{onClick:n,count:o,cellId:r}=e,a=L();let s;t[0]!==a||t[1]!==r?(s=Yr(a,r),t[0]=a,t[1]=r,t[2]=s):s=t[2];const i=s;let l,c;t[3]===Symbol.for("react.memo_cache_sentinel")?(l=Jt("flex items-center justify-between w-[calc(100%-2rem)] h-9 bg-muted rounded-b mx-4 opacity-80 hover:opacity-100 cursor-pointer"),t[3]=l):l=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(c=p.jsx(Pr,{className:"w-4 h-4 flex-shrink-0"}),t[4]=c):c=t[4];const d=1===o?"cell":"cells";let u,h,f,g,x,y,b;return t[5]!==o||t[6]!==d?(u=p.jsxs(p.Fragment,{children:[c,p.jsxs("span",{className:"text-sm text-gray-500",children:[o," ",d," collapsed"]})]}),t[5]=o,t[6]=d,t[7]=u):u=t[7],t[8]!==i.errored?(h=i.errored&&p.jsx(v,{content:"Has errors",delayDuration:100,children:p.jsx(uc,{className:"w-4 h-4 flex-shrink-0 text-destructive"})}),t[8]=i.errored,t[9]=h):h=t[9],t[10]!==i.stale?(f=i.stale&&p.jsx(v,{content:"Has stale cells",delayDuration:100,children:p.jsx(Kr,{className:"w-4 h-4 flex-shrink-0 text-[var(--yellow-11)]"})}),t[10]=i.stale,t[11]=f):f=t[11],t[12]!==i.runningOrQueued?(g=i.runningOrQueued&&p.jsx(v,{content:"Running",delayDuration:100,children:p.jsx(Rr,{className:"w-4 h-4 flex-shrink-0 animate-spin"})}),t[12]=i.runningOrQueued,t[13]=g):g=t[13],t[14]!==h||t[15]!==f||t[16]!==g?(x=p.jsxs(p.Fragment,{children:[h,f,g]}),t[14]=h,t[15]=f,t[16]=g,t[17]=x):x=t[17],t[18]!==u||t[19]!==x?(y=p.jsx(_b,{center:u,right:x}),t[18]=u,t[19]=x,t[20]=y):y=t[20],t[21]!==n||t[22]!==y?(b=p.jsx("div",{onClick:n,className:l,children:y}),t[21]=n,t[22]=y,t[23]=b):b=t[23],b}));Mb.displayName="CollapsedCellBanner";const Tb=e=>{const t=m(6),{appClosed:n,status:o}=e,r=hu("running"===o);let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=g("global.interrupt"),t[0]=a):a=t[0];const s=n||!r,i=r?Xr:Xt.NOOP,l=r?"stale":"disabled";let c,d;return t[1]===Symbol.for("react.memo_cache_sentinel")?(c=p.jsx(C,{strokeWidth:1.5}),t[1]=c):c=t[1],t[2]!==s||t[3]!==i||t[4]!==l?(d=p.jsx(dg,{tooltip:a,disabled:s,onClick:i,variant:l,"data-testid":"run-button",children:c}),t[2]=s,t[3]=i,t[4]=l,t[5]=d):d=t[5],d},Ob=e=>{const t=m(26),{edited:n,appClosed:o,status:r,cellConfig:a,needsRun:s,hasOutput:i,onRun:l,cellActionDropdownRef:c,cellId:d,getEditorView:u,name:h}=e,f=!s&&"hover-action";let g;t[0]!==f?(g=Jt(f),t[0]=f,t[1]=g):g=t[1];const v=o?Xt.NOOP:l;let x,y,b,w,k;return t[2]!==n||t[3]!==v||t[4]!==o||t[5]!==r||t[6]!==a||t[7]!==s?(x=p.jsx(hg,{edited:n,onClick:v,appClosed:o,status:r,config:a,needsRun:s}),t[2]=n,t[3]=v,t[4]=o,t[5]=r,t[6]=a,t[7]=s,t[8]=x):x=t[8],t[9]!==r||t[10]!==o?(y=p.jsx(Tb,{status:r,appClosed:o}),t[9]=r,t[10]=o,t[11]=y):y=t[11],t[12]===Symbol.for("react.memo_cache_sentinel")?(b=p.jsx(dg,{variant:"green",tooltip:null,children:p.jsx(Qi,{strokeWidth:1.5})}),t[12]=b):b=t[12],t[13]!==c||t[14]!==d||t[15]!==r||t[16]!==u||t[17]!==h||t[18]!==a||t[19]!==i?(w=p.jsx(Lx,{ref:c,cellId:d,status:r,getEditorView:u,name:h,config:a,hasOutput:i,children:b}),t[13]=c,t[14]=d,t[15]=r,t[16]=u,t[17]=h,t[18]=a,t[19]=i,t[20]=w):w=t[20],t[21]!==g||t[22]!==x||t[23]!==y||t[24]!==w?(k=p.jsxs(ug,{className:g,children:[x,y,w]}),t[21]=g,t[22]=x,t[23]=y,t[24]=w,t[25]=k):k=t[25],k},Db=r.memo(r.forwardRef((({theme:e,showPlaceholder:t,allowFocus:n,id:o,code:a,output:s,consoleOutputs:i,status:l,runStartTimestamp:c,runElapsedTimeMs:d,edited:u,interrupted:h,errored:m,stopped:f,staleInputs:v,serializedEditorState:x,mode:y,debuggerActive:b,appClosed:w,canDelete:k,updateCellCode:N,prepareForRun:E,createNewCell:C,deleteCell:S,focusCell:j,moveCell:_,setStdinResponse:I,moveToNextCell:A,updateCellConfig:M,clearSerializedEditorState:T,sendToBottom:O,sendToTop:D,collapseCell:P,expandCell:R,userConfig:F,outline:L,isCollapsed:B,collapseCount:U,config:H,canMoveX:W,name:q},Y)=>{G.debug("Rendering Cell",o);const K=r.useRef(null),J=r.useRef(null),X=r.useRef(null),Z=ne(rd),[Q,ee]=r.useState(!1),te=H.disabled||"disabled-transitively"===l,oe=Zr(F.runtime.auto_instantiate,d,l,m,h,f),re=oe||u||h||v&&!te,ae="running"===l||"queued"===l,se=Qr({status:l,output:s,runStartTimestamp:c,interrupted:h,staleInputs:v},u),ie=("queued"===l||u||v)&&!h,le="edit"===y,ce=r.useCallback((()=>{const e=Rp(X),t=V(e);return"markdown"!==ea(e)&&ta(e),E({cellId:o}),t}),[o,X,E]);r.useImperativeHandle(Y,(()=>({get editorView(){return Rp(X)},registerRun:ce})),[X,ce]);const de=r.useCallback((()=>X.current),[X]),ue=z((async()=>{if(ae)return;const e=ce();await $({cellIds:[o],codes:[e]}).catch((e=>{G.error("Error running cell",e)}))})),he=r.useCallback(((e={})=>C({cellId:o,before:!1,...e})),[o,C]),me=r.useCallback(((e={})=>C({cellId:o,before:!0,...e})),[o,C]),fe=r.useCallback((e=>{null===K.current||K.current.contains(e.relatedTarget)||null===X.current||ta(X.current)}),[]),pe=r.useCallback((e=>{if(K.current===document.activeElement&&null!==X.current&&"active"===pn(X.current.state)){for(const t of na)if(e.key===t.key&&t.run){t.run(X.current),e.preventDefault(),e.stopPropagation();break}X.current.focus()}}),[K,X]),ge=!oa(s),ve=ge&&p.jsxs("div",{className:"relative",children:[p.jsx("div",{className:"absolute top-5 -left-8 z-10 print:hidden",children:p.jsx(Ib,{isCollapsed:B,onClick:()=>{B?R({cellId:o}):P({cellId:o})},canCollapse:ra(L)})}),p.jsx(aa,{allowExpand:le,output:s,className:"output-area",cellId:o,stale:se})]}),xe=sa("Cell","hover-actions-parent z-10",{published:!le,interactive:le,"needs-run":re,"has-error":m,stopped:f,disabled:H.disabled,stale:"disabled-transitively"===l}),ye=at.create(o),we=!H.hide_code||Q;if(Ti(le?K:null,{"cell.run":ue,"cell.runAndNewBelow":()=>{ue(),A({cellId:o,before:!1})},"cell.runAndNewAbove":()=>{ue(),A({cellId:o,before:!0})},"cell.createAbove":me,"cell.createBelow":he,"cell.moveUp":()=>_({cellId:o,before:!0}),"cell.moveDown":()=>_({cellId:o,before:!1}),"cell.hideCode":()=>{var e,t,n;const r=!H.hide_code;be({configs:{[o]:{hide_code:r}}}),M({cellId:o,config:{hide_code:r}}),r?(null==(e=X.current)||e.contentDOM.blur(),null==(t=K.current)||t.focus()):null==(n=X.current)||n.focus()},"cell.focusDown":()=>A({cellId:o,before:!1}),"cell.focusUp":()=>A({cellId:o,before:!0}),"cell.sendToBottom":()=>O({cellId:o}),"cell.sendToTop":()=>D({cellId:o}),"cell.aiCompletion":()=>{let e=!1;Z((t=>(null==t?void 0:t.cellId)===o?(e=!0,null):{cellId:o})),e&&Rp(X).focus()},"cell.cellActions":()=>{var e;null==(e=J.current)||e.toggle()}}),Oi(le?K:null,{ArrowDown:()=>(A({cellId:o,before:!1,noCreate:!0}),!0),ArrowUp:()=>(A({cellId:o,before:!0,noCreate:!0}),!0),..."vim"!==F.keymap.preset||we?{}:{j:()=>(A({cellId:o,before:!1,noCreate:!0}),!0),k:()=>(A({cellId:o,before:!0,noCreate:!0}),!0)}}),!le){const e=ia(null==s?void 0:s.mimetype);return m||h||f||e?null:p.jsx("div",{tabIndex:-1,id:ye,ref:K,className:xe,children:ve})}return p.jsx(Bx,{cellId:o,config:H,status:l,getEditorView:de,hasOutput:ge,name:q,children:p.jsxs(Fx,{tabIndex:-1,ref:K,"data-status":l,onBlur:fe,onKeyDown:pe,cellId:o,canMoveX:W,title:H.disabled?"This cell is disabled":"disabled-transitively"===l?"This cell has a disabled ancestor":void 0,children:[p.jsxs("div",{className:xe,id:ye,children:["above"===F.display.cell_output&&ve,p.jsxs("div",{className:"tray",children:[p.jsx("div",{className:"absolute right-2 -top-4 z-10",children:p.jsx(Ob,{edited:u,appClosed:w,status:l,cellConfig:H,needsRun:re,hasOutput:ge,cellActionDropdownRef:J,cellId:o,name:q,getEditorView:de,onRun:ue})}),p.jsxs("div",{className:"absolute flex flex-col gap-[2px] justify-center h-full left-[-34px] z-20",children:[p.jsx(ig,{tooltipContent:g("cell.createAbove"),appClosed:w,onClick:w?void 0:me}),p.jsx("div",{className:"flex-1"}),p.jsx(ig,{tooltipContent:g("cell.createBelow"),appClosed:w,onClick:w?void 0:he})]}),p.jsx(jb,{theme:e,showPlaceholder:t,allowFocus:n,id:o,code:a,config:H,status:l,serializedEditorState:x,runCell:ue,updateCellCode:N,createNewCell:C,deleteCell:S,focusCell:j,moveCell:_,moveToNextCell:A,updateCellConfig:M,clearSerializedEditorState:T,userConfig:F,editorViewRef:X,hidden:!we,setTemporarilyVisible:ee}),p.jsxs("div",{className:"shoulder-right z-20",children:[p.jsx(fg,{status:l,staleInputs:v,interrupted:h,editing:le,edited:u,disabled:H.disabled??!1,elapsedTime:d,runStartTimestamp:c,uninstantiated:oe}),p.jsx("div",{className:"flex gap-2 items-end",children:p.jsx(Px,{})})]}),p.jsx("div",{className:"shoulder-bottom hover-action",children:k&&we&&p.jsx(mg,{appClosed:w,status:l,onClick:()=>{ae||w||S({cellId:o})}})})]}),"below"===F.display.cell_output&&ve,p.jsx(el,{consoleOutputs:i,stale:ie,cellName:q,onRefactorWithAI:e=>{Z({cellId:o,initialPrompt:e.prompt})},onSubmitDebugger:(e,t)=>{I({cellId:o,response:e,outputIndex:t}),la({text:e})},cellId:o,debuggerActive:b})]}),B&&p.jsx(Mb,{onClick:()=>R({cellId:o}),count:U,cellId:o})]})})}))),Pb=e=>{const t=m(10),{width:n}=e,{banners:o}=tl(),{removeBanner:r}=nl();if(0===o.length)return null;const a="columns"===n&&"sticky left-12 w-full max-w-[80vw]";let s,i,l;if(t[0]!==a?(s=Jt("flex flex-col gap-4 mb-5 print:hidden",a),t[0]=a,t[1]=s):s=t[1],t[2]!==r||t[3]!==o){let e;t[5]!==r?(e=e=>p.jsxs(ca,{kind:e.variant||"info",className:"flex flex-col rounded p-3",children:[p.jsxs("div",{className:"flex justify-between",children:[p.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[p.jsx(da,{className:"w-5 h-5 inline-block mr-2"}),e.title]}),p.jsx(x,{"data-testid":"remove-banner-button",variant:"text",size:"icon",onClick:()=>r(e.id),children:p.jsx(qt,{className:"w-5 h-5"})})]}),p.jsxs("div",{className:"flex justify-between items-end",children:[p.jsx("span",{children:ua({html:e.description})}),"restart"===e.action&&p.jsx(Rb,{})]})]},e.id),t[5]=r,t[6]=e):e=t[6],i=o.map(e),t[2]=r,t[3]=o,t[4]=i}else i=t[4];return t[7]!==s||t[8]!==i?(l=p.jsx("div",{className:s,children:i}),t[7]=s,t[8]=i,t[9]=l):l=t[9],l},Rb=()=>{const e=m(3),t=jd();let n,o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=p.jsx(bc,{className:"w-3 h-3 mr-2"}),e[0]=n):n=e[0],e[1]!==t?(o=p.jsxs(x,{"data-testid":"restart-session-button",variant:"link",size:"xs",onClick:t,children:[n,"Restart"]}),e[1]=t,e[2]=o):o=e[2],o};const Fb=(e,t)=>function(e,t){const n=/^(\d+)\.(\d+)\.(\d+)(?:-([\w.-]+))?(?:\+([\w.-]+))?$/,o=e=>{const t=e.match(n);if(!t)return null;const[,o,r,a,s]=t;return{major:Number.parseInt(o,10),minor:Number.parseInt(r,10),patch:Number.parseInt(a,10),preRelease:s||""}};try{const n=o(e),r=o(t);return n&&r?n.major!==r.major?n.major-r.major:n.minor!==r.minor?n.minor-r.minor:n.patch!==r.patch?n.patch-r.patch:""===n.preRelease&&""!==r.preRelease?1:""!==n.preRelease&&""===r.preRelease?-1:n.preRelease.localeCompare(r.preRelease):e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}catch{return e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}}(t,e);const Lb=()=>{const e=m(64),{packageAlert:t}=ol(),{clearPackageAlert:n}=rl(),[o]=Ce();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];const[s,i]=r.useState(a);if(null===t)return null;const l="pixi"!==o.package_management.manager;if(al(t)){let r,a,c,d,u,h,m,f,g,v;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(r=p.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[p.jsx(mc,{className:"w-5 h-5 inline-block mr-2"}),"Missing packages"]}),e[1]=r):r=e[1],e[2]!==n||e[3]!==t.id?(a=()=>n(t.id),e[2]=n,e[3]=t.id,e[4]=a):a=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(c=p.jsx(qt,{className:"w-5 h-5"}),e[5]=c):c=e[5],e[6]!==a?(d=p.jsxs("div",{className:"flex justify-between",children:[r,p.jsx(x,{variant:"text","data-testid":"remove-banner-button",size:"icon",onClick:a,children:c})]}),e[6]=a,e[7]=d):d=e[7],e[8]===Symbol.for("react.memo_cache_sentinel")?(u=p.jsx("p",{children:"The following packages were not found:"}),e[8]=u):u=e[8],e[9]!==l||e[10]!==s||e[11]!==t.packages){let n;e[13]!==l||e[14]!==s?(n=(e,t)=>p.jsxs("li",{className:"flex items-center gap-1 font-mono text-sm",children:[p.jsx(Dl,{size:"1rem"}),e,l&&p.jsx(Vb,{value:s[e]??"latest",onChange:t=>i((n=>({...n,[e]:t}))),packageName:e})]},t),e[13]=l,e[14]=s,e[15]=n):n=e[15],h=t.packages.map(n),e[9]=l,e[10]=s,e[11]=t.packages,e[12]=h}else h=e[12];return e[16]!==h?(m=p.jsxs("div",{children:[u,p.jsx("ul",{className:"list-disc ml-4 mt-1",children:h})]}),e[16]=h,e[17]=m):m=e[17],e[18]!==t||e[19]!==n||e[20]!==o||e[21]!==s?(f=p.jsx("div",{className:"ml-auto flex flex-row items-baseline",children:t.isolated?p.jsxs(p.Fragment,{children:[p.jsx(Bb,{manager:o.package_management.manager,versions:s,clearPackageAlert:()=>n(t.id)}),!j()&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"px-2 text-sm",children:"with"})," ",p.jsx(Ub,{})]})]}):p.jsxs("p",{children:["If you set up a"," ",p.jsx("a",{href:"https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments",className:"text-accent-foreground hover:underline",target:"_blank",rel:"noreferrer",children:"virtual environment"}),", marimo can install these packages for you."]})}),e[18]=t,e[19]=n,e[20]=o,e[21]=s,e[22]=f):f=e[22],e[23]!==m||e[24]!==f?(g=p.jsxs("div",{className:"flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",children:[m,f]}),e[23]=m,e[24]=f,e[25]=g):g=e[25],e[26]!==d||e[27]!==g?(v=p.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-12 min-w-[400px] z-[200] opacity-95",children:p.jsxs(ca,{kind:"danger",className:"flex flex-col rounded py-3 px-5 animate-in slide-in-from-left",children:[d,g]})}),e[26]=d,e[27]=g,e[28]=v):v=e[28],v}if(sl(t)){let o;e[29]!==t.packages?(o=function(e){const t=new Set(Object.values(e)),n=t.has("queued")||t.has("installing")?"installing":t.has("failed")?"failed":"installed";if("installing"===n)return{status:"installing",title:"Installing packages",titleIcon:p.jsx(Ul,{className:"w-5 h-5 inline-block mr-2"}),description:"Installing packages:"};if("installed"===n)return{status:"installed",title:"All packages installed!",titleIcon:p.jsx(hc,{className:"w-5 h-5 inline-block mr-2"}),description:"Installed packages:"};return{status:"failed",title:"Some packages failed to install",titleIcon:p.jsx(mc,{className:"w-5 h-5 inline-block mr-2"}),description:"See terminal for error logs."}}(t.packages),e[29]=t.packages,e[30]=o):o=e[30];const{status:r,title:a,titleIcon:s,description:i}=o;"installed"===r&&setTimeout((()=>n(t.id)),1e4);const l="failed"===r?"danger":"info";let c,d,u,h,m;e[31]!==s||e[32]!==a?(c=p.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[s,a]}),e[31]=s,e[32]=a,e[33]=c):c=e[33],e[34]!==n||e[35]!==t.id?(d=()=>n(t.id),e[34]=n,e[35]=t.id,e[36]=d):d=e[36],e[37]===Symbol.for("react.memo_cache_sentinel")?(u=p.jsx(qt,{className:"w-5 h-5"}),e[37]=u):u=e[37],e[38]!==d?(h=p.jsx(x,{variant:"text","data-testid":"remove-banner-button",size:"icon",onClick:d,children:u}),e[38]=d,e[39]=h):h=e[39],e[40]!==c||e[41]!==h?(m=p.jsxs("div",{className:"flex justify-between",children:[c,h]}),e[40]=c,e[41]=h,e[42]=m):m=e[42];const f="installed"===r&&"text-accent-foreground";let g,v,y,b,w,k,N;if(e[43]!==f?(g=Jt("flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",f),e[43]=f,e[44]=g):g=e[44],e[45]!==i?(v=p.jsx("p",{children:i}),e[45]=i,e[46]=v):v=e[46],e[47]!==t.packages||e[48]!==r){let n;e[50]!==r?(n=(e,t)=>{const[n,o]=e;return p.jsxs("li",{className:Jt("flex items-center gap-1 font-mono text-sm","installing"===o&&"font-semibold","failed"===o&&"text-destructive","installed"===o&&"text-accent-foreground","installed"===o&&"failed"===r&&"text-muted-foreground"),children:[p.jsx(zb,{status:o}),n]},t)},e[50]=r,e[51]=n):n=e[51],y=Object.entries(t.packages).map(n),e[47]=t.packages,e[48]=r,e[49]=y}else y=e[49];return e[52]!==y?(b=p.jsx("ul",{className:"list-disc ml-4 mt-1",children:y}),e[52]=y,e[53]=b):b=e[53],e[54]!==v||e[55]!==b?(w=p.jsxs("div",{children:[v,b]}),e[54]=v,e[55]=b,e[56]=w):w=e[56],e[57]!==g||e[58]!==w?(k=p.jsx("div",{className:g,children:w}),e[57]=g,e[58]=w,e[59]=k):k=e[59],e[60]!==l||e[61]!==m||e[62]!==k?(N=p.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-12 min-w-[400px] z-[200] opacity-95",children:p.jsxs(ca,{kind:l,className:"flex flex-col rounded pt-3 pb-4 px-5",children:[m,k]})}),e[60]=l,e[61]=m,e[62]=k,e[63]=N):N=e[63],N}return E(t),null};const zb=e=>{const t=m(4),{status:n}=e;switch(n){case"queued":{let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=p.jsx(Dl,{size:"1rem"}),t[0]=e):e=t[0],e}case"installing":{let e;return t[1]===Symbol.for("react.memo_cache_sentinel")?(e=p.jsx(Ul,{size:"1rem"}),t[1]=e):e=t[1],e}case"installed":{let e;return t[2]===Symbol.for("react.memo_cache_sentinel")?(e=p.jsx(wt,{size:"1rem"}),t[2]=e):e=t[2],e}case"failed":{let e;return t[3]===Symbol.for("react.memo_cache_sentinel")?(e=p.jsx(qt,{size:"1rem"}),t[3]=e):e=t[3],e}default:return E(n),null}},Bb=e=>{const t=m(8),{manager:n,versions:o,clearPackageAlert:r}=e;let a,s,i,l;return t[0]!==r||t[1]!==n||t[2]!==o?(a=async()=>{r(),await ka({manager:n,versions:o}).catch((e=>{G.error(e)}))},t[0]=r,t[1]=n,t[2]=o,t[3]=a):a=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(s=p.jsx(Ul,{className:"w-4 h-4 mr-2"}),i=p.jsx("span",{className:"font-semibold",children:"Install"}),t[4]=s,t[5]=i):(s=t[4],i=t[5]),t[6]!==a?(l=p.jsxs(x,{variant:"outline","data-testid":"install-packages-button",size:"sm",onClick:a,children:[s,i]}),t[6]=a,t[7]=l):l=t[7],l},Ub=()=>{const e=m(16),[t,n]=Ce();let o,r;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=ha(ma),e[0]=o):o=e[0],e[1]!==t?(r={resolver:o,defaultValues:t},e[1]=t,e[2]=r):r=e[2];const a=fa(r);let s;e[3]!==n?(s=async e=>{await je({config:e}).then((()=>{n(e)}))},e[3]=n,e[4]=s):s=e[4];const i=s;let l,c,d,u;return e[5]!==a||e[6]!==i?(l=a.handleSubmit(i),e[5]=a,e[6]=i,e[7]=l):l=e[7],e[8]!==a.control?(c=p.jsx("div",{className:"flex flex-col gap-3",children:p.jsx(pa,{control:a.control,name:"package_management.manager",render:Gb})}),e[8]=a.control,e[9]=c):c=e[9],e[10]!==l||e[11]!==c?(d=p.jsx("form",{onChange:l,className:"flex flex-col gap-5",children:c}),e[10]=l,e[11]=c,e[12]=d):d=e[12],e[13]!==a||e[14]!==d?(u=p.jsx(ga,{...a,children:d}),e[13]=a,e[14]=d,e[15]=u):u=e[15],u},Vb=e=>{const t=m(21),{value:n,onChange:o,packageName:r}=e;let a,s;t[0]!==r?(a=async()=>{const e=await fetch(`https://pypi.org/pypi/${t=r,t.replaceAll(/\[.*]/g,"").trim()}/json`,{method:"GET",signal:AbortSignal.timeout(5e3)});var t;const n=await e.json();return["latest",...Object.keys(n.releases).sort(Fb).slice(0,100)]},s=[r],t[0]=r,t[1]=a,t[2]=s):(a=t[1],s=t[2]);const{data:i,loading:l,error:c}=Zt(a,s);let d;t[3]!==i?(d=void 0===i?[]:i,t[3]=i,t[4]=d):d=t[4];const u=d;if(c){let e,r,a;return t[5]!==o?(e=e=>o(e.target.value),t[5]=o,t[6]=e):e=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(r=p.jsx("option",{value:"latest",children:"latest"}),t[7]=r):r=t[7],t[8]!==n||t[9]!==e?(a=p.jsx(v,{content:"Failed to fetch package versions",children:p.jsx(ya,{value:n,onChange:e,disabled:!0,className:"inline-flex ml-2",children:r})}),t[8]=n,t[9]=e,t[10]=a):a=t[10],a}let h,f,g;return t[11]!==o?(h=e=>o(e.target.value),t[11]=o,t[12]=h):h=t[12],t[13]!==l||t[14]!==u?(f=l?p.jsx("option",{value:"latest",children:"latest"}):u.map(Hb),t[13]=l,t[14]=u,t[15]=f):f=t[15],t[16]!==n||t[17]!==h||t[18]!==l||t[19]!==f?(g=p.jsx(ya,{value:n,onChange:h,disabled:l,className:"inline-flex ml-2",children:f}),t[16]=n,t[17]=h,t[18]=l,t[19]=f,t[20]=g):g=t[20],g};function $b(e){return p.jsx("option",{value:e,children:e},e)}function Gb(e){const{field:t}=e;return p.jsxs(va,{children:[p.jsx(xa,{children:p.jsx(ya,{"data-testid":"install-package-manager-select",onChange:e=>t.onChange(e.target.value),value:t.value,disabled:t.disabled,className:"inline-flex mr-2",children:ba.map($b)})}),p.jsx(wa,{})]})}function Hb(e){return p.jsx("option",{value:e,children:e},e)}const Wb=e=>{let{transform:t}=e;return{...t,x:0}},qb={threshold:{x:0,y:.1}},Yb=u.memo((e=>{const t=m(25),{children:n,multiColumn:o}=e,{cellIds:a}=L(),{dropCellOverCell:s,dropCellOverColumn:i,moveColumn:l,compactColumns:c}=B(),[d,u]=r.useState(null),[h,f]=r.useState(null),[g]=Se();let v;e:{if("columns"===g.width){v=Na.EMPTY;break e}let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[Wb],t[0]=e):e=t[0],v=e}const x=v;let y,b;t[1]===Symbol.for("react.memo_cache_sentinel")?(y={activationConstraint:{distance:8}},t[1]=y):y=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(b={coordinateGetter:Tx},t[2]=b):b=t[2];const w=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.useMemo((()=>[...t].filter((e=>null!=e))),[...t])}(_g(Nv,y),_g(xv,b));let k;t[3]!==a?(k=e=>{u(e.active.id),f(a)},t[3]=a,t[4]=k):k=t[4];const N=z(k);let E;t[5]!==h?(E=()=>{u(null),f(null)},t[5]=h,t[6]=E):E=t[6];const C=z(E);let S;t[7]!==d||t[8]!==a?(S=e=>{const t=e.droppableContainers.filter((e=>Jb(e.id)));if(d&&Jb(d))return Rg({...e,droppableContainers:t});const n=(e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:o}=e;if(!o)return[];const r=[];for(const a of t){const{id:e}=a,t=n.get(e);if(t&&zg(o,t)){const n=Og(t).reduce(((e,t)=>e+Ag(o,t)),0),s=Number((n/4).toFixed(4));r.push({id:e,data:{droppableContainer:a,value:s}})}}return r.sort(Mg)})({...e,droppableContainers:t}),o=Dg(n.length>0?n:Lg({...e,droppableContainers:t}),"id");if(!o)return[];Rt(Jb(o),`Expected column id. Got: ${o}`);const r=a.get(o);if(Rt(r,`Expected column. Got: ${o}`),r&&0===r.topLevelIds.length)return[{id:o}];const s=new Set(r.topLevelIds),i=Rg({...e,droppableContainers:e.droppableContainers.filter((e=>e.id!==o&&s.has(e.id)))});if(i.length>0){const e=i[0].id;return Rt(Kb(e),`Expected cell id. Got: ${e}`),[{id:e}]}return[]},t[7]=d,t[8]=a,t[9]=S):S=t[9];const j=S;let _;t[10]!==i||t[11]!==s||t[12]!==l?(_=e=>{const{active:t,over:n}=e,o=null==n?void 0:n.id;if(null!=o&&t.id!==o){if(Kb(t.id)){if(Jb(o))return void i({cellId:t.id,columnId:o});if(Kb(o))return void s({cellId:t.id,overCellId:o})}Jb(t.id)&&Jb(o)&&l({column:t.id,overColumn:o})}},t[10]=i,t[11]=s,t[12]=l,t[13]=_):_=t[13];const I=z(_);let A;t[14]!==c?(A=e=>{const{active:t,over:n}=e;null!==n&&t.id!==n.id&&c()},t[14]=c,t[15]=A):A=t[15];const M=z(A),T=o?j:Rg;let O;return t[16]!==w||t[17]!==T||t[18]!==x||t[19]!==M||t[20]!==N||t[21]!==C||t[22]!==I||t[23]!==n?(O=p.jsx(ix,{autoScroll:qb,sensors:w,collisionDetection:T,modifiers:x,onDragEnd:M,onDragStart:N,onDragCancel:C,onDragOver:I,children:n}),t[16]=w,t[17]=T,t[18]=x,t[19]=M,t[20]=N,t[21]=C,t[22]=I,t[23]=n,t[24]=O):O=t[24],O}));function Kb(e){return"string"==typeof e&&!e.startsWith("tree_")}function Jb(e){return"string"==typeof e&&e.startsWith("tree_")}const Xb=u.forwardRef((({columnId:e,canDelete:t,canMoveLeft:n,canMoveRight:o,...r},a)=>{const{attributes:s,listeners:i,setNodeRef:l,transform:c,transition:d,isDragging:u,isOver:h}=Ix({id:e}),m={transform:c?ir.Transform.toString({x:c.x,y:0,scaleX:1,scaleY:1}):void 0,transition:d,zIndex:u?2:void 0,position:"relative","--gutter-width":"50px"},f=vg(a,l),{deleteColumn:g,moveColumn:y,addColumn:b}=B(),w=Jt("h-full hover:bg-muted rounded-none"),k=()=>{const e=document.getElementById("App");e&&e.scrollTo({left:e.scrollLeft+1e3,behavior:"smooth"})},N=p.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:[p.jsx(v,{content:"Move column left",side:"top",delayDuration:300,children:p.jsx(x,{variant:"text",size:"sm",className:w,onClick:()=>y({column:e,overColumn:"_left_"}),disabled:!n,children:p.jsx(Ea,{className:"size-4"})})}),p.jsx(v,{content:"Move column right",side:"top",delayDuration:300,children:p.jsx(x,{variant:"text",size:"sm",className:w,onClick:()=>y({column:e,overColumn:"_right_"}),disabled:!o,children:p.jsx(Jr,{className:"size-4"})})}),p.jsx("div",{className:"flex gap-2 h-full flex-grow active:bg-accent cursor-grab",...s,...i,"data-testid":"column-drag-button"}),t&&p.jsx(v,{content:"Delete column",side:"top",delayDuration:300,children:p.jsx(x,{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:()=>g({columnId:e}),children:p.jsx(qt,{className:"size-4"})})}),p.jsx(v,{content:"Add column",side:"top",delayDuration:300,children:p.jsx(x,{variant:"text",size:"sm",className:w,onClick:()=>{b({columnId:e}),requestAnimationFrame(k)},children:p.jsx(To,{className:"size-4"})})})]});return p.jsxs("div",{tabIndex:-1,ref:f,...r,style:m,"data-is-dragging":u,className:Jt(u?"":r.className,u?"z-20":"z-1 hover:z-10 focus-within:z-10",h&&"bg-accent/20"),children:[N,r.children]})}));Xb.displayName="SortableColumn";const Zb=r.memo(Xb),Qb=r.memo((e=>{const t=m(15),n=r.useRef(null),o="columns"===e.width&&"w-contentWidth box-content\t min-h-[100px] border border-t-0 border-[var(--slate-3)] rounded-b-lg px-11 py-6 bg-[var(--slate-2)]";let a,s;t[0]!==o?(a=Jt("flex flex-col gap-5",o),t[0]=o,t[1]=a):a=t[1],t[2]!==a||t[3]!==e.children?(s=p.jsx("div",{className:a,children:e.children}),t[2]=a,t[3]=e.children,t[4]=s):s=t[4];const i=s;if("columns"===e.width){let o;return t[5]!==e.canDelete||t[6]!==e.columnId||t[7]!==e.canMoveLeft||t[8]!==e.canMoveRight||t[9]!==e.footer||t[10]!==i?(o=p.jsxs(Zb,{tabIndex:-1,ref:n,canDelete:e.canDelete,columnId:e.columnId,canMoveLeft:e.canMoveLeft,canMoveRight:e.canMoveRight,className:"group/column",children:[i,e.footer]}),t[5]=e.canDelete,t[6]=e.columnId,t[7]=e.canMoveLeft,t[8]=e.canMoveRight,t[9]=e.footer,t[10]=i,t[11]=o):o=t[11],o}let l;return t[12]!==i||t[13]!==e.footer?(l=p.jsxs(p.Fragment,{children:[i,e.footer]}),t[12]=i,t[13]=e.footer,t[14]=l):l=t[14],l}));Qb.displayName="Column";const ew=e=>{const t=m(67),{notebook:n,mode:o,userConfig:a,appConfig:s,connStatus:i}=e,l=B(),{theme:c}=Ee(),{toggleSidebarPanel:d}=Dd(),{invisible:u}=il(n.cellIds.idLength,o);let h;hi("global.focusTop",l.focusTopCell),hi("global.focusBottom",l.focusBottomCell),hi("global.toggleSidebar",d),hi("global.foldCode",l.foldAll),hi("global.unfoldCode",l.unfoldAll),t[0]!==l.updateCellCode?(h=()=>{ja(l.updateCellCode)},t[0]=l.updateCellCode,t[1]=h):h=t[1],hi("global.formatAll",h),hi("cell.hideCode",Xt.NOOP),hi("cell.format",Xt.NOOP);const f=id(),g=l.scrollToTarget;let v,x,y,b,w,k,N,E,C,S,j,_,I,A,M,T,O,D,P,R,F,L;if(t[2]!==n.scrollKey||t[3]!==g?(v=()=>{null!==n.scrollKey&&g()},t[2]=n.scrollKey,t[3]=g,t[4]=v):v=t[4],t[5]!==n.cellIds||t[6]!==n.scrollKey||t[7]!==g?(x=[n.cellIds,n.scrollKey,g],t[5]=n.cellIds,t[6]=n.scrollKey,t[7]=g,t[8]=x):x=t[8],r.useEffect(v,x),t[9]!==n.cellIds||t[10]!==n.cellData||t[11]!==n.cellRuntime||t[12]!==n.scrollKey||t[13]!==n.cellHandles||t[14]!==u||t[15]!==s||t[16]!==c||t[17]!==o||t[18]!==i.state||t[19]!==a||t[20]!==l||t[21]!==f){const e=n.cellIds.getColumns();let r;t[37]!==n.cellIds?(r=n.cellIds.hasOnlyOneId(),t[37]=n.cellIds,t[38]=r):r=t[38];const d=r;j=ll,_="pb-[40vh]",I=u,A=s,M="pr-4",t[39]===Symbol.for("react.memo_cache_sentinel")?(T=p.jsx(Lb,{}),t[39]=T):T=t[39],t[40]!==s.width?(O=p.jsx(Pb,{width:s.width}),t[40]=s.width,t[41]=O):O=t[41],C=Yb,S="columns"===s.width,w=kx,k="column-container",N=e.map(nw),E=gx;const h="columns"===s.width&&"grid grid-flow-col auto-cols-min gap-6";t[42]!==h?(y=Jt(h),t[42]=h,t[43]=y):y=t[43],b=e.map(((t,r)=>p.jsx(Qb,{columnId:t.id,canMoveLeft:r>0,canMoveRight:r<e.length-1,width:s.width,canDelete:e.length>1,footer:p.jsx(tw,{columnId:t.id,className:Jt("columns"===s.width&&"opacity-0 group-hover/column:opacity-100")}),children:p.jsx(kx,{id:`column-${r+1}`,items:t.topLevelIds,strategy:yx,children:t.topLevelIds.map((e=>{const r=n.cellData[e],h=n.cellRuntime[e];return p.jsx(Db,{theme:c,showPlaceholder:d,allowFocus:!u&&!n.scrollKey,id:r.id,code:r.code,outline:h.outline,output:h.output,consoleOutputs:h.consoleOutputs,status:h.status,edited:r.edited,interrupted:h.interrupted,errored:h.errored,stopped:h.stopped,staleInputs:h.staleInputs,runStartTimestamp:h.runStartTimestamp,runElapsedTimeMs:h.runElapsedTimeMs??r.lastExecutionTime,serializedEditorState:r.serializedEditorState,canDelete:!d,mode:o,appClosed:i.state!==Ki.OPEN,ref:n.cellHandles[e],userConfig:a,debuggerActive:h.debuggerActive,config:r.config,name:r.name,isCollapsed:t.isCollapsed(e),collapseCount:t.getCount(e),canMoveX:"columns"===s.width,...l,deleteCell:f},r.id.toString())}))})},t.id))),t[9]=n.cellIds,t[10]=n.cellData,t[11]=n.cellRuntime,t[12]=n.scrollKey,t[13]=n.cellHandles,t[14]=u,t[15]=s,t[16]=c,t[17]=o,t[18]=i.state,t[19]=a,t[20]=l,t[21]=f,t[22]=y,t[23]=b,t[24]=w,t[25]=k,t[26]=N,t[27]=E,t[28]=C,t[29]=S,t[30]=j,t[31]=_,t[32]=I,t[33]=A,t[34]=M,t[35]=T,t[36]=O}else y=t[22],b=t[23],w=t[24],k=t[25],N=t[26],E=t[27],C=t[28],S=t[29],j=t[30],_=t[31],I=t[32],A=t[33],M=t[34],T=t[35],O=t[36];return t[44]!==y||t[45]!==b?(D=p.jsx("div",{className:y,children:b}),t[44]=y,t[45]=b,t[46]=D):D=t[46],t[47]!==w||t[48]!==k||t[49]!==N||t[50]!==E||t[51]!==D?(P=p.jsx(w,{id:k,items:N,strategy:E,children:D}),t[47]=w,t[48]=k,t[49]=N,t[50]=E,t[51]=D,t[52]=P):P=t[52],t[53]!==C||t[54]!==S||t[55]!==P?(R=p.jsx(C,{multiColumn:S,children:P}),t[53]=C,t[54]=S,t[55]=P,t[56]=R):R=t[56],t[57]===Symbol.for("react.memo_cache_sentinel")?(F=p.jsx(cl,{}),t[57]=F):F=t[57],t[58]!==j||t[59]!==_||t[60]!==I||t[61]!==A||t[62]!==M||t[63]!==T||t[64]!==O||t[65]!==R?(L=p.jsxs(j,{className:_,invisible:I,appConfig:A,innerClassName:M,children:[T,O,R,F]}),t[58]=j,t[59]=_,t[60]=I,t[61]=A,t[62]=M,t[63]=T,t[64]=O,t[65]=R,t[66]=L):L=t[66],L},tw=e=>{const t=m(18),{columnId:n,className:o}=e,{createNewCell:r}=B(),a=te(re),[s,i]=Ca(!1),l=te(oe),c=te(Sa).sql;let d;t[0]===Symbol.for("react.memo_cache_sentinel")?(d=Jt("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"),t[0]=d):d=t[0];const u=d;let h;t[1]!==s||t[2]!==i.toggle||t[3]!==r||t[4]!==n||t[5]!==a||t[6]!==c||t[7]!==l?(h=()=>s?p.jsx(xb,{onClose:i.toggle}):p.jsxs(p.Fragment,{children:[p.jsxs(x,{className:u,variant:"text",size:"sm",onClick:()=>r({cellId:{type:"__end__",columnId:n},before:!1}),children:[p.jsx(jc,{className:"mr-2 size-4 flex-shrink-0"}),"Python"]}),p.jsxs(x,{className:u,variant:"text",size:"sm",onClick:()=>{cd(a,r),r({cellId:{type:"__end__",columnId:n},before:!1,code:(new Oo).defaultCode})},children:[p.jsx(Ac,{className:"mr-2 size-4 flex-shrink-0"}),"Markdown"]}),p.jsx(v,{content:c?null:p.jsxs("div",{className:"flex flex-col",children:[p.jsxs("span",{children:["Additional dependencies required:",p.jsx(_a,{className:"inline",children:"pip install 'marimo[sql]'"}),"."]}),p.jsx("span",{children:"You will need to restart the notebook after installing."})]}),delayDuration:100,asChild:!1,children:p.jsxs(x,{className:u,variant:"text",size:"sm",disabled:!c,onClick:()=>{cd(a,r),r({cellId:{type:"__end__",columnId:n},before:!1,code:(new Do).defaultCode})},children:[p.jsx(fe,{className:"mr-2 size-4 flex-shrink-0"}),"SQL"]})}),p.jsx(v,{content:l?null:p.jsx("span",{children:"Enable via settings under AI Assist"}),delayDuration:100,asChild:!1,children:p.jsxs(x,{className:u,variant:"text",size:"sm",disabled:!l,onClick:i.toggle,children:[p.jsx(Sc,{className:"mr-2 size-4 flex-shrink-0"}),"Generate with AI"]})})]}),t[1]=s,t[2]=i.toggle,t[3]=r,t[4]=n,t[5]=a,t[6]=c,t[7]=l,t[8]=h):h=t[8];const f=h,g=!s&&"w-fit",y=s&&"opacity-100 w-full max-w-4xl shadow-lg shadow-[var(--blue-3)]";let b,w,k;return t[9]!==g||t[10]!==y||t[11]!==o?(b=Jt("shadow-sm border border-border rounded transition-all duration-200 overflow-hidden divide-x divide-border flex",g,y,o),t[9]=g,t[10]=y,t[11]=o,t[12]=b):b=t[12],t[13]!==f?(w=f(),t[13]=f,t[14]=w):w=t[14],t[15]!==b||t[16]!==w?(k=p.jsx("div",{className:"flex justify-center mt-4 pt-6 pb-32 group gap-4 w-full print:hidden",children:p.jsx("div",{className:b,children:w})}),t[15]=b,t[16]=w,t[17]=k):k=t[17],k};function nw(e){return e.id}async function ow(){await Aa({download:!1,includeCode:!0,files:qi.INSTANCE.filenames()})}async function rw(){await Ma({download:!1})}const aw=e=>{const t=m(117),{userConfig:n,appConfig:o}=e,a=L();Ta(Ba,za.onCellIdsChange);const{setCells:s,updateCellCode:i,mergeAllColumns:l}=B(),c=te(rt),[d,u]=dt(),[h,g]=r.useState(),v=Vi(),{openModal:x,closeModal:y,openAlert:b}=f(),w="edit"===c.mode,k="present"===c.mode,N=te(Oa),E=te(se);let C;t[0]!==b?(C=function(){b("Failed to save notebook: not connected to a kernel.")},t[0]=b,t[1]=C):C=t[1];const S=C;let j;t[2]===Symbol.for("react.memo_cache_sentinel")?(j=[],t[2]=j):j=t[2],r.useEffect(lw,j);const _=n.runtime.auto_instantiate;let I,A,M;t[3]!==s?(I=(e,t)=>{s(e);const n=e.map((e=>e.name)),o=e.map((e=>e.code)),r=e.map((e=>e.config));g({names:n,codes:o,configs:r,layout:t})},t[3]=s,t[4]=I):I=t[4],t[5]===Symbol.for("react.memo_cache_sentinel")?(A=Ua(),t[5]=A):A=t[5],t[6]!==n.runtime.auto_instantiate||t[7]!==I?(M={autoInstantiate:_,setCells:I,sessionId:A},t[6]=n.runtime.auto_instantiate,t[7]=I,t[8]=M):M=t[8];const{connection:T}=dl(M);let O;t[9]!==T.state||t[10]!==S||t[11]!==u||t[12]!==o.app_title||t[13]!==b?(O=async e=>T.state!==Ki.OPEN?(S(),null):(Va((t=>{null===e?t.delete($a.filePath):t.set($a.filePath,e)})),Ga({filename:e}).then((()=>(u(e),document.title=o.app_title||lt.basename(e)||"Untitled Notebook",e))).catch((e=>(b(e.message),null)))),t[9]=T.state,t[10]=S,t[11]=u,t[12]=o.app_title,t[13]=b,t[14]=O):O=t[14];const D=z(O);let P,R;t[15]!==o.app_title||t[16]!==d?(P=()=>{document.title=o.app_title||lt.basename(d??"")||"Untitled Notebook"},R=[o.app_title,d],t[15]=o.app_title,t[16]=d,t[17]=P,t[18]=R):(P=t[17],R=t[18]),r.useEffect(P,R);const F=a.cellIds.colLength,V=Ko(o.width);let $,H,q,Y,K,J;t[19]!==V||t[20]!==o.width||t[21]!==l?($=()=>{"columns"===V&&"columns"!==o.width&&l()},t[19]=V,t[20]=o.width,t[21]=l,t[22]=$):$=t[22],t[23]!==o.width||t[24]!==V||t[25]!==l||t[26]!==F?(H=[o.width,V,l,F],t[23]=o.width,t[24]=V,t[25]=l,t[26]=F,t[27]=H):H=t[27],r.useEffect($,H),t[28]!==a?(J=Da(a),K=J.map(cw),Y=J.map(dw),q=J.map(uw),t[28]=a,t[29]=q,t[30]=Y,t[31]=K,t[32]=J):(q=t[29],Y=t[30],K=t[31],J=t[32]);const Z=q;let Q;t[33]!==a?(Q=Pa(a),t[33]=a,t[34]=Q):Q=t[34];const ee=Q;let ne;t[35]!==a||t[36]!==v||t[37]!==h?(ne=Ra(a,v,h),t[35]=a,t[36]=v,t[37]=h,t[38]=ne):ne=t[38];const oe=ne;let re;t[39]!==E||t[40]!==Y||t[41]!==T.state||t[42]!==S||t[43]!==K||t[44]!==Z||t[45]!==ee||t[46]!==n.save.format_on_save||t[47]!==i||t[48]!==v?(re=(e,t)=>{E||0!==Y.length&&(T.state===Ki.OPEN?(G.log("saving to ",e),Ha({cellIds:K,codes:Y,names:Z,filename:e,configs:ee,layout:ml(),persist:!0}).then((()=>{t&&(X({title:"Notebook saved"}),n.save.format_on_save&&ja(i)),g({names:Z,codes:Y,configs:ee,layout:v})}))):S())},t[39]=E,t[40]=Y,t[41]=T.state,t[42]=S,t[43]=K,t[44]=Z,t[45]=ee,t[46]=n.save.format_on_save,t[47]=i,t[48]=v,t[49]=re):re=t[49];const ae=z(re);let ie;t[50]!==d||t[51]!==T.state||t[52]!==ae?(ie=e=>{const t=void 0!==e&&e;null!==d&&T.state===Ki.OPEN&&ae(d,t)},t[50]=d,t[51]=T.state,t[52]=ae,t[53]=ie):ie=t[53];const le=z(ie),ce=z((()=>{le(!0),null===d&&T.state!==Ki.CLOSED&&x(p.jsx(sw,{onClose:y,onSave:he}))}));let de,ue;t[54]!==le||t[55]!==oe||t[56]!==Y||t[57]!==ee||t[58]!==Z||t[59]!==T||t[60]!==n||t[61]!==E?(de={onSave:le,needsSave:oe,codes:Y,cellConfigs:ee,cellNames:Z,connStatus:T,config:n,kioskMode:E},t[54]=le,t[55]=oe,t[56]=Y,t[57]=ee,t[58]=Z,t[59]=T,t[60]=n,t[61]=E,t[62]=de):de=t[62],function(e){const t=m(16),{codes:n,cellConfigs:o,config:a,connStatus:s,cellNames:i,needsSave:l,kioskMode:c,onSave:d}=e,u=r.useRef(null);let h,f;t[0]!==c||t[1]!==a.save.autosave||t[2]!==a.save.autosave_delay||t[3]!==l||t[4]!==s.state||t[5]!==d?(h=()=>{if(!c)return"after_delay"===a.save.autosave&&(null!==u.current&&clearTimeout(u.current),l&&s.state===Ki.OPEN&&(u.current=setTimeout(d,a.save.autosave_delay))),()=>{null!==u.current&&clearTimeout(u.current)}},t[0]=c,t[1]=a.save.autosave,t[2]=a.save.autosave_delay,t[3]=l,t[4]=s.state,t[5]=d,t[6]=h):h=t[6],t[7]!==n||t[8]!==o||t[9]!==i||t[10]!==a.save||t[11]!==s.state||t[12]!==d||t[13]!==c||t[14]!==l?(f=[n,o,i,a.save,s.state,d,c,l],t[7]=n,t[8]=o,t[9]=i,t[10]=a.save,t[11]=s.state,t[12]=d,t[13]=c,t[14]=l,t[15]=f):f=t[15],r.useEffect(h,f)}(de),function(){const e=m(4),t=te(Ia),{state:n}=te(Yi),o=t.auto_download.includes("markdown"),r=t.auto_download.includes("html"),a=!o||n!==Ki.OPEN,s=!r||n!==Ki.OPEN;let i,l;e[0]!==a?(i={delayMs:5e3,whenVisible:!0,disabled:a},e[0]=a,e[1]=i):i=e[1],Di(rw,i),e[2]!==s?(l={delayMs:5e3,whenVisible:!0,disabled:s},e[2]=s,e[3]=l):l=e[3],Di(ow,l)}(),t[63]!==oe?(ue=e=>{if(!Wa())return oe?(e.preventDefault(),e.returnValue="You have unsaved changes. Are you sure you want to quit?"):void 0},t[63]=oe,t[64]=ue):ue=t[64],W(window,"beforeunload",ue);const he=e=>{D(e).then((e=>{null!==e&&ae(e,!0)}))},me=function(){const e=m(3),t=L(),n=od();let o;return e[0]!==n||e[1]!==t?(o=()=>n(U(t)),e[0]=n,e[1]=t,e[2]=o):o=e[2],z(o)}(),fe=Rd();let pe,ge,ve;t[65]!==me?(pe=()=>{me()},t[65]=me,t[66]=pe):pe=t[66],hi("global.runStale",pe),hi("global.save",ce),hi("global.interrupt",hw),t[67]!==fe?(ge=()=>{fe()},t[67]=fe,t[68]=ge):ge=t[68],hi("global.hideCode",ge),t[69]!==d||t[70]!==J?(ve=()=>JSON.stringify({filename:d,cells:J.map((e=>({name:e.name,code:e.code})))},null,2),t[69]=d,t[70]=J,t[71]=ve):ve=t[71];const xe=z(ve);let ye;t[72]!==a||t[73]!==T||t[74]!==c.mode||t[75]!==n||t[76]!==o?(ye=p.jsx(ew,{notebook:a,connStatus:T,mode:c.mode,userConfig:n,appConfig:o}),t[72]=a,t[73]=T,t[74]=c.mode,t[75]=n,t[76]=o,t[77]=ye):ye=t[77];const be=ye,we=o.width;let ke,Ne,Ee,Ce,Se;t[78]===Symbol.for("react.memo_cache_sentinel")?(ke=Jt("pt-4 sm:pt-12 pb-2 mb-4 print:hidden z-50","sticky left-0"),t[78]=ke):ke=t[78],t[79]!==w||t[80]!==d||t[81]!==D?(Ne=w&&p.jsx("div",{className:"flex items-center justify-center container",children:p.jsx(Nu,{filename:d,setFilename:D})}),t[79]=w,t[80]=d,t[81]=D,t[82]=Ne):Ne=t[82],t[83]!==T||t[84]!==Ne?(Ee=p.jsx(fl,{connection:T,className:ke,children:Ne}),t[83]=T,t[84]=Ne,t[85]=Ee):Ee=t[85],t[86]!==J.length||t[87]!==o||t[88]!==c||t[89]!==be?(Ce=J.length>0&&p.jsx(ul,{appConfig:o,mode:c.mode,children:be}),t[86]=J.length,t[87]=o,t[88]=c,t[89]=be,t[90]=Ce):Ce=t[90],t[91]!==T||t[92]!==N||t[93]!==o.width||t[94]!==Ee||t[95]!==Ce?(Se=p.jsxs(pl,{connection:T,isRunning:N,width:we,children:[Ee,Ce]}),t[91]=T,t[92]=N,t[93]=o.width,t[94]=Ee,t[95]=Ce,t[96]=Se):Se=t[96];const je=T.state===Ki.CLOSED;let _e,Ie,Ae,Me;return t[97]!==a?(_e=Fa(a),t[97]=a,t[98]=_e):_e=t[98],t[99]!==a?(Ie=kt(a),t[99]=a,t[100]=Ie):Ie=t[100],t[101]!==d||t[102]!==oe||t[103]!==ce||t[104]!==xe||t[105]!==k||t[106]!==fe||t[107]!==me||t[108]!==je||t[109]!==N||t[110]!==_e||t[111]!==Ie||t[112]!==o.width?(Ae=p.jsx(gu,{filename:d,needsSave:oe,onSaveNotebook:ce,getCellsAsJSON:xe,presenting:k,onTogglePresenting:fe,onInterrupt:Xr,onRun:me,closed:je,running:N,needsRun:_e,undoAvailable:Ie,appWidth:o.width}),t[101]=d,t[102]=oe,t[103]=ce,t[104]=xe,t[105]=k,t[106]=fe,t[107]=me,t[108]=je,t[109]=N,t[110]=_e,t[111]=Ie,t[112]=o.width,t[113]=Ae):Ae=t[113],t[114]!==Se||t[115]!==Ae?(Me=p.jsxs(p.Fragment,{children:[Se,Ae]}),t[114]=Se,t[115]=Ae,t[116]=Me):Me=t[116],Me},sw=e=>{const t=m(17),{onClose:n,onSave:o}=e,[a,s]=r.useState();let i;t[0]!==o||t[1]!==n?(i=e=>{s(e),e.trim()&&(o(e),n())},t[0]=o,t[1]=n,t[2]=i):i=t[2];const l=i;let c,d,u,h;t[3]===Symbol.for("react.memo_cache_sentinel")?(c=p.jsx(b,{children:"Save notebook"}),t[3]=c):c=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(d=p.jsx(ke,{className:"text-md pt-6 px-1",children:"Save as"}),t[4]=d):d=t[4],t[5]!==l?(u=p.jsxs("div",{className:"flex flex-col",children:[d,p.jsx(wu,{onNameChange:l,placeholderText:"filename",className:"missing-filename"})]}),t[5]=l,t[6]=u):u=t[6],t[7]!==n?(h=p.jsx(x,{"data-testid":"cancel-save-dialog-button","aria-label":"Cancel",variant:"secondary",onClick:n,children:"Cancel"}),t[7]=n,t[8]=h):h=t[8];const f=!a;let g,v,y;return t[9]!==f?(g=p.jsx(x,{"data-testid":"submit-save-dialog-button","aria-label":"Save",variant:"default",disabled:f,type:"submit",children:"Save"}),t[9]=f,t[10]=g):g=t[10],t[11]!==h||t[12]!==g?(v=p.jsxs(k,{children:[h,g]}),t[11]=h,t[12]=g,t[13]=v):v=t[13],t[14]!==u||t[15]!==v?(y=p.jsxs(N,{children:[c,u,v]}),t[14]=u,t[15]=v,t[16]=y):y=t[16],y};function iw(){hl.INSTANCE.stop()}function lw(){return hl.INSTANCE.start(La),iw}function cw(e){return e.id}function dw(e){return e.code}function uw(e){return e.name}function hw(){Xr()}const{createElement:mw,createContext:fw,createRef:pw,forwardRef:gw,useCallback:vw,useContext:xw,useEffect:yw,useImperativeHandle:bw,useLayoutEffect:ww,useMemo:kw,useRef:Nw,useState:Ew}=qa,Cw=qa["useId".toString()],Sw=ww,jw=fw(null);jw.displayName="PanelGroupContext";const _w=Sw,Iw="function"==typeof Cw?Cw:()=>null;let Aw=0;function Mw(e=null){const t=Iw(),n=Nw(e||t||null);return null===n.current&&(n.current=""+Aw++),null!=e?e:n.current}function Tw({children:e,className:t="",collapsedSize:n,collapsible:o,defaultSize:r,forwardedRef:a,id:s,maxSize:i,minSize:l,onCollapse:c,onExpand:d,onResize:u,order:h,style:m,tagName:f="div",...p}){const g=xw(jw);if(null===g)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:v,expandPanel:x,getPanelSize:y,getPanelStyle:b,groupId:w,isPanelCollapsed:k,reevaluatePanelConstraints:N,registerPanel:E,resizePanel:C,unregisterPanel:S}=g,j=Mw(s),_=Nw({callbacks:{onCollapse:c,onExpand:d,onResize:u},constraints:{collapsedSize:n,collapsible:o,defaultSize:r,maxSize:i,minSize:l},id:j,idIsFromProps:void 0!==s,order:h});Nw({didLogMissingDefaultSizeWarning:!1}),_w((()=>{const{callbacks:e,constraints:t}=_.current,a={...t};_.current.id=j,_.current.idIsFromProps=void 0!==s,_.current.order=h,e.onCollapse=c,e.onExpand=d,e.onResize=u,t.collapsedSize=n,t.collapsible=o,t.defaultSize=r,t.maxSize=i,t.minSize=l,a.collapsedSize===t.collapsedSize&&a.collapsible===t.collapsible&&a.maxSize===t.maxSize&&a.minSize===t.minSize||N(_.current,a)})),_w((()=>{const e=_.current;return E(e),()=>{S(e)}}),[h,j,E,S]),bw(a,(()=>({collapse:()=>{v(_.current)},expand:e=>{x(_.current,e)},getId:()=>j,getSize:()=>y(_.current),isCollapsed:()=>k(_.current),isExpanded:()=>!k(_.current),resize:e=>{C(_.current,e)}})),[v,x,y,k,j,C]);const I=b(_.current,r);return mw(f,{...p,children:e,className:t,id:s,style:{...I,...m},"data-panel":"","data-panel-collapsible":o||void 0,"data-panel-group-id":w,"data-panel-id":j,"data-panel-size":parseFloat(""+I.flexGrow).toFixed(1)})}const Ow=gw(((e,t)=>mw(Tw,{...e,forwardedRef:t})));Tw.displayName="Panel",Ow.displayName="forwardRef(Panel)";let Dw=null,Pw=null;function Rw(e,t){const n=function(e,t){if(t){const e=!!(t&Kw),n=!!(t&Jw);if(t&qw)return e?"se-resize":n?"ne-resize":"e-resize";if(t&Yw)return e?"sw-resize":n?"nw-resize":"w-resize";if(e)return"s-resize";if(n)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}(e,t);Dw!==n&&(Dw=n,null===Pw&&(Pw=document.createElement("style"),document.head.appendChild(Pw)),Pw.innerHTML=`*{cursor: ${n}!important;}`)}function Fw(e){return"keydown"===e.type}function Lw(e){return e.type.startsWith("pointer")}function zw(e){return e.type.startsWith("mouse")}function Bw(e){if(Lw(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(zw(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}const Uw=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Vw(e){const t=getComputedStyle(e);return"fixed"===t.position||(!("auto"===t.zIndex||"static"===t.position&&!function(e){var t;const n=getComputedStyle(null!==(t=Ww(e))&&void 0!==t?t:e).display;return"flex"===n||"inline-flex"===n}(e))||(+t.opacity<1||("transform"in t&&"none"!==t.transform||("webkitTransform"in t&&"none"!==t.webkitTransform||("mixBlendMode"in t&&"normal"!==t.mixBlendMode||("filter"in t&&"none"!==t.filter||("webkitFilter"in t&&"none"!==t.webkitFilter||("isolation"in t&&"isolate"===t.isolation||(!!Uw.test(t.willChange)||"touch"===t.webkitOverflowScrolling)))))))))}function $w(e){let t=e.length;for(;t--;){const n=e[t];if(uk(n,"Missing node"),Vw(n))return n}return null}function Gw(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Hw(e){const t=[];for(;e;)t.push(e),e=Ww(e);return t}function Ww(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const qw=1,Yw=2,Kw=4,Jw=8,Xw="coarse"===function(){if("function"==typeof matchMedia)return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}();let Zw=[],Qw=!1,ek=new Map,tk=new Map;const nk=new Set;function ok(e){const{target:t}=e,{x:n,y:o}=Bw(e);Qw=!0,sk({target:t,x:n,y:o}),ck(),Zw.length>0&&(dk("down",e),e.preventDefault(),e.stopPropagation())}function rk(e){const{x:t,y:n}=Bw(e);if(!Qw){const{target:o}=e;sk({target:o,x:t,y:n})}dk("move",e),lk(),Zw.length>0&&e.preventDefault()}function ak(e){const{target:t}=e,{x:n,y:o}=Bw(e);tk.clear(),Qw=!1,Zw.length>0&&e.preventDefault(),dk("up",e),sk({target:t,x:n,y:o}),lk(),ck()}function sk({target:e,x:t,y:n}){Zw.splice(0);let o=null;e instanceof HTMLElement&&(o=e),nk.forEach((e=>{const{element:r,hitAreaMargins:a}=e,s=r.getBoundingClientRect(),{bottom:i,left:l,right:c,top:d}=s,u=Xw?a.coarse:a.fine;if(t>=l-u&&t<=c+u&&n>=d-u&&n<=i+u){if(null!==o&&r!==o&&!r.contains(o)&&!o.contains(r)&&function(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:Hw(e),b:Hw(t)};let o;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),o=e;uk(o,"Stacking order can only be calculated for elements with a common ancestor");const r=Gw($w(n.a)),a=Gw($w(n.b));if(r===a){const e=o.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)};let r=e.length;for(;r--;){const n=e[r];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(r-a)}(o,r)>0){let e=o,t=!1;for(;e&&!e.contains(r);){if(h=e.getBoundingClientRect(),m=s,h.x<m.x+m.width&&h.x+h.width>m.x&&h.y<m.y+m.height&&h.y+h.height>m.y){t=!0;break}e=e.parentElement}if(t)return}Zw.push(e)}var h,m}))}function ik(e,t){tk.set(e,t)}function lk(){let e=!1,t=!1;Zw.forEach((n=>{const{direction:o}=n;"horizontal"===o?e=!0:t=!0}));let n=0;tk.forEach((e=>{n|=e})),e&&t?Rw("intersection",n):e?Rw("horizontal",n):t?Rw("vertical",n):null!==Pw&&(document.head.removeChild(Pw),Dw=null,Pw=null)}function ck(){ek.forEach(((e,t)=>{const{body:n}=t;n.removeEventListener("contextmenu",ak),n.removeEventListener("pointerdown",ok),n.removeEventListener("pointerleave",rk),n.removeEventListener("pointermove",rk)})),window.removeEventListener("pointerup",ak),window.removeEventListener("pointercancel",ak),nk.size>0&&(Qw?(Zw.length>0&&ek.forEach(((e,t)=>{const{body:n}=t;e>0&&(n.addEventListener("contextmenu",ak),n.addEventListener("pointerleave",rk),n.addEventListener("pointermove",rk))})),window.addEventListener("pointerup",ak),window.addEventListener("pointercancel",ak)):ek.forEach(((e,t)=>{const{body:n}=t;e>0&&(n.addEventListener("pointerdown",ok,{capture:!0}),n.addEventListener("pointermove",rk))})))}function dk(e,t){nk.forEach((n=>{const{setResizeHandlerState:o}=n,r=Zw.includes(n);o(e,r,t)}))}function uk(e,t){if(!e)throw console.error(t),Error(t)}function hk(e,t,n=10){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function mk(e,t,n=10){return 0===hk(e,t,n)}function fk(e,t,n){return 0===hk(e,t,n)}function pk({panelConstraints:e,panelIndex:t,size:n}){const o=e[t];uk(null!=o,`Panel constraints not found for index ${t}`);let{collapsedSize:r=0,collapsible:a,maxSize:s=100,minSize:i=0}=o;if(hk(n,i)<0)if(a){n=hk(n,(r+i)/2)<0?r:i}else n=i;return n=Math.min(s,n),n=parseFloat(n.toFixed(10))}function gk({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:o,prevLayout:r,trigger:a}){if(fk(e,0))return t;const s=[...t],[i,l]=o;uk(null!=i,"Invalid first pivot index"),uk(null!=l,"Invalid second pivot index");let c=0;if("keyboard"===a){{const o=e<0?l:i,r=n[o];uk(r,`Panel constraints not found for index ${o}`);const{collapsedSize:a=0,collapsible:s,minSize:c=0}=r;if(s){const n=t[o];if(uk(null!=n,`Previous layout not found for panel index ${o}`),fk(n,a)){const t=c-n;hk(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{const o=e<0?i:l,r=n[o];uk(r,`No panel constraints found for index ${o}`);const{collapsedSize:a=0,collapsible:s,minSize:c=0}=r;if(s){const n=t[o];if(uk(null!=n,`Previous layout not found for panel index ${o}`),fk(n,c)){const t=n-a;hk(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}}{const o=e<0?1:-1;let r=e<0?l:i,a=0;for(;;){const e=t[r];uk(null!=e,`Previous layout not found for panel index ${r}`);if(a+=pk({panelConstraints:n,panelIndex:r,size:100})-e,r+=o,r<0||r>=n.length)break}const s=Math.min(Math.abs(e),Math.abs(a));e=e<0?0-s:s}{let o=e<0?i:l;for(;o>=0&&o<n.length;){const r=Math.abs(e)-Math.abs(c),a=t[o];uk(null!=a,`Previous layout not found for panel index ${o}`);const i=pk({panelConstraints:n,panelIndex:o,size:a-r});if(!fk(a,i)&&(c+=a-i,s[o]=i,c.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?o--:o++}}if(function(e,t,n){if(e.length!==t.length)return!1;for(let o=0;o<e.length;o++)if(!fk(e[o],t[o],n))return!1;return!0}(r,s))return r;{const o=e<0?l:i,r=t[o];uk(null!=r,`Previous layout not found for panel index ${o}`);const a=r+c,d=pk({panelConstraints:n,panelIndex:o,size:a});if(s[o]=d,!fk(d,a)){let t=a-d;let o=e<0?l:i;for(;o>=0&&o<n.length;){const r=s[o];uk(null!=r,`Previous layout not found for panel index ${o}`);const a=pk({panelConstraints:n,panelIndex:o,size:r+t});if(fk(r,a)||(t-=a-r,s[o]=a),fk(t,0))break;e>0?o--:o++}}}return fk(s.reduce(((e,t)=>t+e),0),100)?s:r}function vk({layout:e,panelsArray:t,pivotIndices:n}){let o=0,r=100,a=0,s=0;const i=n[0];uk(null!=i,"No pivot index found"),t.forEach(((e,t)=>{const{constraints:n}=e,{maxSize:l=100,minSize:c=0}=n;t===i?(o=c,r=l):(a+=c,s+=l)}));return{valueMax:Math.min(r,100-a),valueMin:Math.max(o,100-s),valueNow:e[i]}}function xk(e,t=document){return Array.from(t.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`))}function yk(e,t,n=document){const o=xk(e,n).findIndex((e=>e.getAttribute("data-panel-resize-handle-id")===t));return null!=o?o:null}function bk(e,t,n){const o=yk(e,t,n);return null!=o?[o,o+1]:[-1,-1]}function wk(e,t=document){var n;if(t instanceof HTMLElement&&(null==t||null===(n=t.dataset)||void 0===n?void 0:n.panelGroupId)==e)return t;const o=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return o||null}function kk(e,t=document){const n=t.querySelector(`[data-panel-resize-handle-id="${e}"]`);return n||null}function Nk({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:o,panelDataArray:r,panelGroupElement:a,setLayout:s}){Nw({didWarnAboutMissingResizeHandle:!1}),_w((()=>{if(!a)return;const e=xk(n,a);for(let t=0;t<r.length-1;t++){const{valueMax:n,valueMin:a,valueNow:s}=vk({layout:o,panelsArray:r,pivotIndices:[t,t+1]}),i=e[t];if(null==i);else{const e=r[t];uk(e,`No panel data found for index "${t}"`),i.setAttribute("aria-controls",e.id),i.setAttribute("aria-valuemax",""+Math.round(n)),i.setAttribute("aria-valuemin",""+Math.round(a)),i.setAttribute("aria-valuenow",null!=s?""+Math.round(s):"")}}return()=>{e.forEach(((e,t)=>{e.removeAttribute("aria-controls"),e.removeAttribute("aria-valuemax"),e.removeAttribute("aria-valuemin"),e.removeAttribute("aria-valuenow")}))}}),[n,o,r,a]),yw((()=>{if(!a)return;const e=t.current;uk(e,"Eager values not found");const{panelDataArray:r}=e;uk(null!=wk(n,a),`No group found for id "${n}"`);const i=xk(n,a);uk(i,`No resize handles found for group id "${n}"`);const l=i.map((e=>{const t=e.getAttribute("data-panel-resize-handle-id");uk(t,"Resize handle element has no handle id attribute");const[i,l]=function(e,t,n,o=document){var r,a,s,i;const l=kk(t,o),c=xk(e,o),d=l?c.indexOf(l):-1;return[null!==(r=null===(a=n[d])||void 0===a?void 0:a.id)&&void 0!==r?r:null,null!==(s=null===(i=n[d+1])||void 0===i?void 0:i.id)&&void 0!==s?s:null]}(n,t,r,a);if(null==i||null==l)return()=>{};const c=e=>{if(!e.defaultPrevented)switch(e.key){case"Enter":{e.preventDefault();const l=r.findIndex((e=>e.id===i));if(l>=0){const e=r[l];uk(e,`No panel data found for index ${l}`);const i=o[l],{collapsedSize:c=0,collapsible:d,minSize:u=0}=e.constraints;if(null!=i&&d){const e=gk({delta:fk(i,c)?u-c:c-i,initialLayout:o,panelConstraints:r.map((e=>e.constraints)),pivotIndices:bk(n,t,a),prevLayout:o,trigger:"keyboard"});o!==e&&s(e)}}break}}};return e.addEventListener("keydown",c),()=>{e.removeEventListener("keydown",c)}}));return()=>{l.forEach((e=>e()))}}),[a,e,t,n,o,r,s])}function Ek(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Ck(e,t){const n="horizontal"===e,{x:o,y:r}=Bw(t);return n?o:r}function Sk(e,t,n,o,r,a){if(Fw(e)){const t="horizontal"===n;let o=0;o=e.shiftKey?100:null!=r?r:10;let a=0;switch(e.key){case"ArrowDown":a=t?0:o;break;case"ArrowLeft":a=t?-o:0;break;case"ArrowRight":a=t?o:0;break;case"ArrowUp":a=t?0:-o;break;case"End":a=100;break;case"Home":a=-100}return a}return null==o?0:function(e,t,n,o,r){const a="horizontal"===n,s=kk(t,r);uk(s,`No resize handle element found for id "${t}"`);const i=s.getAttribute("data-panel-group-id");uk(i,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=o;const c=Ck(n,e),d=wk(i,r);uk(d,`No group element found for id "${i}"`);const u=d.getBoundingClientRect();return(c-l)/(a?u.width:u.height)*100}(e,t,n,o,a)}function jk(e,t,n){t.forEach(((t,o)=>{const r=e[o];uk(r,`Panel data not found for index ${o}`);const{callbacks:a,constraints:s,id:i}=r,{collapsedSize:l=0,collapsible:c}=s,d=n[i];if(null==d||t!==d){n[i]=t;const{onCollapse:e,onExpand:o,onResize:r}=a;r&&r(t,d),c&&(e||o)&&(!o||null!=d&&!mk(d,l)||mk(t,l)||o(),!e||null!=d&&mk(d,l)||!mk(t,l)||e())}}))}function _k(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function Ik(e){try{if("undefined"==typeof localStorage)throw new Error("localStorage not supported in this environment");e.getItem=e=>localStorage.getItem(e),e.setItem=(e,t)=>{localStorage.setItem(e,t)}}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function Ak(e){return`react-resizable-panels:${e}`}function Mk(e){return e.map((e=>{const{constraints:t,id:n,idIsFromProps:o,order:r}=e;return o?n:r?`${r}:${JSON.stringify(t)}`:JSON.stringify(t)})).sort(((e,t)=>e.localeCompare(t))).join(",")}function Tk(e,t){try{const n=Ak(e),o=t.getItem(n);if(o){const e=JSON.parse(o);if("object"==typeof e&&null!=e)return e}}catch(n){}return null}function Ok(e,t,n,o,r){var a;const s=Ak(e),i=Mk(t),l=null!==(a=Tk(e,r))&&void 0!==a?a:{};l[i]={expandToSizes:Object.fromEntries(n.entries()),layout:o};try{r.setItem(s,JSON.stringify(l))}catch(c){console.error(c)}}function Dk({layout:e,panelConstraints:t}){const n=[...e],o=n.reduce(((e,t)=>e+t),0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map((e=>`${e}%`)).join(", ")}`);if(!fk(o,100))for(let a=0;a<t.length;a++){const e=n[a];uk(null!=e,`No layout data found for index ${a}`);const t=100/o*e;n[a]=t}let r=0;for(let a=0;a<t.length;a++){const e=n[a];uk(null!=e,`No layout data found for index ${a}`);const o=pk({panelConstraints:t,panelIndex:a,size:e});e!=o&&(r+=e-o,n[a]=o)}if(!fk(r,0))for(let a=0;a<t.length;a++){const e=n[a];uk(null!=e,`No layout data found for index ${a}`);const o=pk({panelConstraints:t,panelIndex:a,size:e+r});if(e!==o&&(r-=o-e,n[a]=o,fk(r,0)))break}return n}const Pk={getItem:e=>(Ik(Pk),Pk.getItem(e)),setItem:(e,t)=>{Ik(Pk),Pk.setItem(e,t)}},Rk={};function Fk({autoSaveId:e=null,children:t,className:n="",direction:o,forwardedRef:r,id:a=null,onLayout:s=null,keyboardResizeBy:i=null,storage:l=Pk,style:c,tagName:d="div",...u}){const h=Mw(a),m=Nw(null),[f,p]=Ew(null),[g,v]=Ew([]),x=Nw({}),y=Nw(new Map),b=Nw(0),w=Nw({autoSaveId:e,direction:o,dragState:f,id:h,keyboardResizeBy:i,onLayout:s,storage:l}),k=Nw({layout:g,panelDataArray:[],panelDataArrayChanged:!1});Nw({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),bw(r,(()=>({getId:()=>w.current.id,getLayout:()=>{const{layout:e}=k.current;return e},setLayout:e=>{const{onLayout:t}=w.current,{layout:n,panelDataArray:o}=k.current,r=Dk({layout:e,panelConstraints:o.map((e=>e.constraints))});Ek(n,r)||(v(r),k.current.layout=r,t&&t(r),jk(o,r,x.current))}})),[]),_w((()=>{w.current.autoSaveId=e,w.current.direction=o,w.current.dragState=f,w.current.id=h,w.current.onLayout=s,w.current.storage=l})),Nk({committedValuesRef:w,eagerValuesRef:k,groupId:h,layout:g,panelDataArray:k.current.panelDataArray,setLayout:v,panelGroupElement:m.current}),yw((()=>{const{panelDataArray:t}=k.current;if(e){if(0===g.length||g.length!==t.length)return;let n=Rk[e];null==n&&(n=function(e,t=10){let n=null;return(...o)=>{null!==n&&clearTimeout(n),n=setTimeout((()=>{e(...o)}),t)}}(Ok,100),Rk[e]=n);const o=[...t],r=new Map(y.current);n(e,o,r,g,l)}}),[e,g,l]),yw((()=>{}));const N=vw((e=>{const{onLayout:t}=w.current,{layout:n,panelDataArray:o}=k.current;if(e.constraints.collapsible){const r=o.map((e=>e.constraints)),{collapsedSize:a=0,panelSize:s,pivotIndices:i}=Bk(o,e,n);if(uk(null!=s,`Panel size not found for panel "${e.id}"`),!mk(s,a)){y.current.set(e.id,s);const l=gk({delta:zk(o,e)===o.length-1?s-a:a-s,initialLayout:n,panelConstraints:r,pivotIndices:i,prevLayout:n,trigger:"imperative-api"});_k(n,l)||(v(l),k.current.layout=l,t&&t(l),jk(o,l,x.current))}}}),[]),E=vw(((e,t)=>{const{onLayout:n}=w.current,{layout:o,panelDataArray:r}=k.current;if(e.constraints.collapsible){const a=r.map((e=>e.constraints)),{collapsedSize:s=0,panelSize:i=0,minSize:l=0,pivotIndices:c}=Bk(r,e,o),d=null!=t?t:l;if(mk(i,s)){const t=y.current.get(e.id),s=null!=t&&t>=d?t:d,l=gk({delta:zk(r,e)===r.length-1?i-s:s-i,initialLayout:o,panelConstraints:a,pivotIndices:c,prevLayout:o,trigger:"imperative-api"});_k(o,l)||(v(l),k.current.layout=l,n&&n(l),jk(r,l,x.current))}}}),[]),C=vw((e=>{const{layout:t,panelDataArray:n}=k.current,{panelSize:o}=Bk(n,e,t);return uk(null!=o,`Panel size not found for panel "${e.id}"`),o}),[]),S=vw(((e,t)=>{const{panelDataArray:n}=k.current,o=zk(n,e);return function({defaultSize:e,dragState:t,layout:n,panelData:o,panelIndex:r,precision:a=3}){const s=n[r];let i;return i=null==s?null!=e?e.toPrecision(a):"1":1===o.length?"1":s.toPrecision(a),{flexBasis:0,flexGrow:i,flexShrink:1,overflow:"hidden",pointerEvents:null!==t?"none":void 0}}({defaultSize:t,dragState:f,layout:g,panelData:n,panelIndex:o})}),[f,g]),j=vw((e=>{const{layout:t,panelDataArray:n}=k.current,{collapsedSize:o=0,collapsible:r,panelSize:a}=Bk(n,e,t);return uk(null!=a,`Panel size not found for panel "${e.id}"`),!0===r&&mk(a,o)}),[]),_=vw((e=>{const{layout:t,panelDataArray:n}=k.current,{collapsedSize:o=0,collapsible:r,panelSize:a}=Bk(n,e,t);return uk(null!=a,`Panel size not found for panel "${e.id}"`),!r||hk(a,o)>0}),[]),I=vw((e=>{const{panelDataArray:t}=k.current;t.push(e),t.sort(((e,t)=>{const n=e.order,o=t.order;return null==n&&null==o?0:null==n?-1:null==o?1:n-o})),k.current.panelDataArrayChanged=!0}),[]);_w((()=>{if(k.current.panelDataArrayChanged){k.current.panelDataArrayChanged=!1;const{autoSaveId:e,onLayout:t,storage:n}=w.current,{layout:o,panelDataArray:r}=k.current;let a=null;if(e){const t=function(e,t,n){var o,r;return null!==(r=(null!==(o=Tk(e,n))&&void 0!==o?o:{})[Mk(t)])&&void 0!==r?r:null}(e,r,n);t&&(y.current=new Map(Object.entries(t.expandToSizes)),a=t.layout)}null==a&&(a=function({panelDataArray:e}){const t=Array(e.length),n=e.map((e=>e.constraints));let o=0,r=100;for(let a=0;a<e.length;a++){const e=n[a];uk(e,`Panel constraints not found for index ${a}`);const{defaultSize:s}=e;null!=s&&(o++,t[a]=s,r-=s)}for(let a=0;a<e.length;a++){const s=n[a];uk(s,`Panel constraints not found for index ${a}`);const{defaultSize:i}=s;if(null!=i)continue;const l=r/(e.length-o);o++,t[a]=l,r-=l}return t}({panelDataArray:r}));const s=Dk({layout:a,panelConstraints:r.map((e=>e.constraints))});Ek(o,s)||(v(s),k.current.layout=s,t&&t(s),jk(r,s,x.current))}})),_w((()=>{const e=k.current;return()=>{e.layout=[]}}),[]);const A=vw((e=>function(t){t.preventDefault();const n=m.current;if(!n)return()=>null;const{direction:o,dragState:r,id:a,keyboardResizeBy:s,onLayout:i}=w.current,{layout:l,panelDataArray:c}=k.current,{initialLayout:d}=null!=r?r:{},u=bk(a,e,n);let h=Sk(t,e,o,r,s,n);if(0===h)return;const f="horizontal"===o;"rtl"===document.dir&&f&&(h=-h);const p=gk({delta:h,initialLayout:null!=d?d:l,panelConstraints:c.map((e=>e.constraints)),pivotIndices:u,prevLayout:l,trigger:Fw(t)?"keyboard":"mouse-or-touch"}),g=!_k(l,p);(Lw(t)||zw(t))&&b.current!=h&&(b.current=h,ik(e,g?0:f?h<0?qw:Yw:h<0?Kw:Jw)),g&&(v(p),k.current.layout=p,i&&i(p),jk(c,p,x.current))}),[]),M=vw(((e,t)=>{const{onLayout:n}=w.current,{layout:o,panelDataArray:r}=k.current,a=r.map((e=>e.constraints)),{panelSize:s,pivotIndices:i}=Bk(r,e,o);uk(null!=s,`Panel size not found for panel "${e.id}"`);const l=gk({delta:zk(r,e)===r.length-1?s-t:t-s,initialLayout:o,panelConstraints:a,pivotIndices:i,prevLayout:o,trigger:"imperative-api"});_k(o,l)||(v(l),k.current.layout=l,n&&n(l),jk(r,l,x.current))}),[]),T=vw(((e,t)=>{const{layout:n,panelDataArray:o}=k.current,{collapsedSize:r=0,collapsible:a}=t,{collapsedSize:s=0,collapsible:i,maxSize:l=100,minSize:c=0}=e.constraints,{panelSize:d}=Bk(o,e,n);null!=d&&(a&&i&&mk(d,r)?mk(r,s)||M(e,s):d<c?M(e,c):d>l&&M(e,l))}),[M]),O=vw(((e,t)=>{const{direction:n}=w.current,{layout:o}=k.current;if(!m.current)return;const r=kk(e,m.current);uk(r,`Drag handle element not found for id "${e}"`);const a=Ck(n,t);p({dragHandleId:e,dragHandleRect:r.getBoundingClientRect(),initialCursorPosition:a,initialLayout:o})}),[]),D=vw((()=>{p(null)}),[]),P=vw((e=>{const{panelDataArray:t}=k.current,n=zk(t,e);n>=0&&(t.splice(n,1),delete x.current[e.id],k.current.panelDataArrayChanged=!0)}),[]),R=kw((()=>({collapsePanel:N,direction:o,dragState:f,expandPanel:E,getPanelSize:C,getPanelStyle:S,groupId:h,isPanelCollapsed:j,isPanelExpanded:_,reevaluatePanelConstraints:T,registerPanel:I,registerResizeHandle:A,resizePanel:M,startDragging:O,stopDragging:D,unregisterPanel:P,panelGroupElement:m.current})),[N,f,o,E,C,S,h,j,_,T,I,A,M,O,D,P]),F={display:"flex",flexDirection:"horizontal"===o?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return mw(jw.Provider,{value:R},mw(d,{...u,children:t,className:n,id:a,ref:m,style:{...F,...c},"data-panel-group":"","data-panel-group-direction":o,"data-panel-group-id":h}))}const Lk=gw(((e,t)=>mw(Fk,{...e,forwardedRef:t})));function zk(e,t){return e.findIndex((e=>e===t||e.id===t.id))}function Bk(e,t,n){const o=zk(e,t),r=o===e.length-1?[o-1,o]:[o,o+1],a=n[o];return{...t.constraints,panelSize:a,pivotIndices:r}}function Uk({children:e=null,className:t="",disabled:n=!1,hitAreaMargins:o,id:r,onDragging:a,style:s={},tabIndex:i=0,tagName:l="div",...c}){var d,u;const h=Nw(null),m=Nw({onDragging:a});yw((()=>{m.current.onDragging=a}));const f=xw(jw);if(null===f)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:p,groupId:g,registerResizeHandle:v,startDragging:x,stopDragging:y,panelGroupElement:b}=f,w=Mw(r),[k,N]=Ew("inactive"),[E,C]=Ew(!1),[S,j]=Ew(null),_=Nw({state:k});_w((()=>{_.current.state=k})),yw((()=>{if(n)j(null);else{const e=v(w);j((()=>e))}}),[n,w,v]);const I=null!==(d=null==o?void 0:o.coarse)&&void 0!==d?d:15,A=null!==(u=null==o?void 0:o.fine)&&void 0!==u?u:5;yw((()=>{if(n||null==S)return;const e=h.current;uk(e,"Element ref not attached");return function(e,t,n,o,r){var a;const{ownerDocument:s}=t,i={direction:n,element:t,hitAreaMargins:o,setResizeHandlerState:r},l=null!==(a=ek.get(s))&&void 0!==a?a:0;return ek.set(s,l+1),nk.add(i),ck(),function(){var t;tk.delete(e),nk.delete(i);const n=null!==(t=ek.get(s))&&void 0!==t?t:1;ek.set(s,n-1),ck(),1===n&&ek.delete(s)}}(w,e,p,{coarse:I,fine:A},((e,t,n)=>{if(t)switch(e){case"down":{N("drag"),x(w,n);const{onDragging:e}=m.current;e&&e(!0);break}case"move":{const{state:e}=_.current;"drag"!==e&&N("hover"),S(n);break}case"up":{N("hover"),y();const{onDragging:e}=m.current;e&&e(!1);break}}else N("inactive")}))}),[I,p,n,A,v,w,S,x,y]),function({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:o}){yw((()=>{if(e||null==n||null==o)return;const r=kk(t,o);if(null==r)return;const a=e=>{if(!e.defaultPrevented)switch(e.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":e.preventDefault(),n(e);break;case"F6":{e.preventDefault();const n=r.getAttribute("data-panel-group-id");uk(n,`No group element found for id "${n}"`);const a=xk(n,o),s=yk(n,t,o);uk(null!==s,`No resize element found for id "${t}"`),a[e.shiftKey?s>0?s-1:a.length-1:s+1<a.length?s+1:0].focus();break}}};return r.addEventListener("keydown",a),()=>{r.removeEventListener("keydown",a)}}),[o,e,t,n])}({disabled:n,handleId:w,resizeHandler:S,panelGroupElement:b});return mw(l,{...c,children:e,className:t,id:r,onBlur:()=>C(!1),onFocus:()=>C(!0),ref:h,role:"separator",style:{touchAction:"none",userSelect:"none",...s},tabIndex:i,"data-panel-group-direction":p,"data-panel-group-id":g,"data-resize-handle":"","data-resize-handle-active":"drag"===k?"pointer":E?"keyboard":void 0,"data-resize-handle-state":k,"data-panel-resize-handle-enabled":!n,"data-panel-resize-handle-id":w})}Fk.displayName="PanelGroup",Lk.displayName="forwardRef(PanelGroup)",Uk.displayName="PanelResizeHandle";const Vk=e=>{const t=m(3);let n,o;return t[0]===Symbol.for("react.memo_cache_sentinel")?(n=p.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"}),t[0]=n):n=t[0],t[1]!==e?(o=p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.24em",height:"1em",viewBox:"0 0 256 208",fill:"currentColor",...e,children:n}),t[1]=e,t[2]=o):o=t[2],o},$k=e=>{const t=m(17);let n,o,r,a,s;t[0]!==e?(({children:a,tooltip:s,selected:n,className:o,...r}=e),t[0]=e,t[1]=n,t[2]=o,t[3]=r,t[4]=a,t[5]=s):(n=t[1],o=t[2],r=t[3],a=t[4],s=t[5]);const i=!n&&"hover:bg-[var(--sage-3)]",l=n&&"bg-[var(--sage-4)]";let c,d;t[6]!==i||t[7]!==l||t[8]!==o?(c=Jt("h-full flex items-center p-2 text-sm shadow-inset font-mono cursor-pointer rounded",i,l,o),t[6]=i,t[7]=l,t[8]=o,t[9]=c):c=t[9],t[10]!==c||t[11]!==r||t[12]!==a?(d=p.jsx("div",{className:c,...r,children:a}),t[10]=c,t[11]=r,t[12]=a,t[13]=d):d=t[13];const u=d;if(s){let e;return t[14]!==s||t[15]!==u?(e=p.jsx(v,{content:s,side:"top",delayDuration:200,children:u}),t[14]=s,t[15]=u,t[16]=e):e=t[16],e}return u},Gk=()=>{var e;const t=m(10),n=te(Wk),o=te(oe),r=(null==(e=null==n?void 0:n.open_ai)?void 0:e.model)||"gpt-4-turbo",{handleClick:a}=qk();if(!o){let e,n;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=p.jsx(Sc,{className:"h-4 w-4 opacity-60"}),t[0]=e):e=t[0],t[1]!==a?(n=p.jsx($k,{tooltip:"Assist is disabled",selected:!1,onClick:a,children:e}),t[1]=a,t[2]=n):n=t[2],n}let s,i,l,c;return t[3]===Symbol.for("react.memo_cache_sentinel")?(s=p.jsx("b",{children:"Assist model:"}),t[3]=s):s=t[3],t[4]!==r?(i=p.jsxs(p.Fragment,{children:[s," ",r]}),t[4]=r,t[5]=i):i=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(l=p.jsx(Sc,{className:"h-4 w-4"}),t[6]=l):l=t[6],t[7]!==i||t[8]!==a?(c=p.jsx($k,{tooltip:i,onClick:a,selected:!1,children:l}),t[7]=i,t[8]=a,t[9]=c):c=t[9],c},Hk=H((e=>e(Ya).completion.copilot)),Wk=H((e=>e(Ya).ai));function qk(){const e=m(5),t=ne(Pi),n=ne(bi);let o;e[0]!==t||e[1]!==n?(o=()=>{t("ai"),n(!0)},e[0]=t,e[1]=n,e[2]=o):o=e[2];const r=o;let a;return e[3]!==r?(a={handleClick:r},e[3]=r,e[4]=a):a=e[4],a}const Yk=()=>{const e=m(1);if("github"===te(Hk)){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=p.jsx(Kk,{}),e[0]=t):t=e[0],t}return null},Kk=()=>{const e=m(10),t=te(Ri),n=null!==te(Fi),{handleClick:o}=qk(),r=t?"Ready":"Not connected";let a,s,i,l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=p.jsx("b",{children:"GitHub Copilot:"}),e[0]=a):a=e[0],e[1]!==r?(s=p.jsxs(p.Fragment,{children:[a," ",r]}),e[1]=r,e[2]=s):s=e[2],e[3]!==n||e[4]!==t?(i=p.jsx("span",{children:n?p.jsx(Ka,{className:"h-4 w-4"}):p.jsx(Vk,{className:Jt("h-4 w-4",!t&&"opacity-60")})}),e[3]=n,e[4]=t,e[5]=i):i=e[5],e[6]!==s||e[7]!==o||e[8]!==i?(l=p.jsx($k,{tooltip:s,selected:!1,onClick:o,children:i}),e[6]=s,e[7]=o,e[8]=i,e[9]=l):l=e[9],l},Jk=e=>{const t=m(18),[n,o]=r.useState(0),a=te(Yi);let s,i,l,c;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=()=>o((e=>e+1)),i={delayMs:1e4,whenVisible:!0},t[0]=s,t[1]=i):(s=t[0],i=t[1]),Di(s,i),t[2]!==a.state?(l=async()=>j()||a.state!==Ki.OPEN?null:Ja(),t[2]=a.state,t[3]=l):l=t[3],t[4]!==n||t[5]!==a.state?(c=[n,a.state],t[4]=n,t[5]=a.state,t[6]=c):c=t[6];const{data:d}=Zt(l,c);let u,h,f,g,v;return t[7]!==d?(u=d&&p.jsx(Zk,{memory:d.memory,kernel:d.kernel,server:d.server}),t[7]=d,t[8]=u):u=t[8],t[9]!==d?(h=d&&p.jsx(Qk,{cpu:d.cpu}),t[9]=d,t[10]=h):h=t[10],t[11]===Symbol.for("react.memo_cache_sentinel")?(f=p.jsxs("div",{className:"flex items-center",children:[p.jsx(Gk,{}),p.jsx(Yk,{})]}),t[11]=f):f=t[11],t[12]!==a.state?(g=p.jsx(Xk,{connection:a.state}),t[12]=a.state,t[13]=g):g=t[13],t[14]!==u||t[15]!==h||t[16]!==g?(v=p.jsxs("div",{className:"flex gap-2 items-center",children:[u,h,f,g]}),t[14]=u,t[15]=h,t[16]=g,t[17]=v):v=t[17],v},Xk=e=>{const t=m(18),{connection:n}=e;let o,r,a,s,i,l,c;return t[0]!==n?(o=S(n.toLowerCase()),t[0]=n,t[1]=o):o=t[1],t[2]!==n?(r=n===Ki.OPEN&&p.jsx(Fl,{className:"w-4 h-4"}),t[2]=n,t[3]=r):r=t[3],t[4]!==n?(a=n===Ki.CLOSED&&p.jsx(Li,{className:"w-4 h-4"}),t[4]=n,t[5]=a):a=t[5],t[6]!==n?(s=n===Ki.CONNECTING&&p.jsx(Ka,{size:"small"}),t[6]=n,t[7]=s):s=t[7],t[8]!==n?(i=n===Ki.CLOSING&&p.jsx(Ka,{className:"text-destructive",size:"small"}),t[8]=n,t[9]=i):i=t[9],t[10]!==r||t[11]!==a||t[12]!==s||t[13]!==i?(l=p.jsxs("div",{children:[r,a,s,i]}),t[10]=r,t[11]=a,t[12]=s,t[13]=i,t[14]=l):l=t[14],t[15]!==o||t[16]!==l?(c=p.jsx(v,{delayDuration:200,content:o,children:l}),t[15]=o,t[16]=l,t[17]=c):c=t[17],c},Zk=e=>{const t=m(25),{memory:n,kernel:o,server:r}=e,{percent:a,total:s,used:i}=n;let l;t[0]!==a?(l=Math.round(a),t[0]=a,t[1]=l):l=t[1];const c=l;let d,u,h,f,g,x,y,b,w,k;return t[2]===Symbol.for("react.memo_cache_sentinel")?(d=p.jsx("b",{children:"computer memory:"}),t[2]=d):d=t[2],t[3]!==i?(u=nN(i),t[3]=i,t[4]=u):u=t[4],t[5]!==s?(h=nN(s),t[5]=s,t[6]=h):h=t[6],t[7]!==u||t[8]!==h||t[9]!==c?(f=p.jsxs("span",{children:[d," ",u," / ",h," GB (",c,"%)"]}),t[7]=u,t[8]=h,t[9]=c,t[10]=f):f=t[10],t[11]!==(null==r?void 0:r.memory)?(g=(null==r?void 0:r.memory)&&p.jsxs("span",{children:[p.jsx("b",{children:"marimo server:"})," ",tN(r.memory)]}),t[11]=null==r?void 0:r.memory,t[12]=g):g=t[12],t[13]!==(null==o?void 0:o.memory)?(x=(null==o?void 0:o.memory)&&p.jsxs("span",{children:[p.jsx("b",{children:"kernel:"})," ",tN(o.memory)]}),t[13]=null==o?void 0:o.memory,t[14]=x):x=t[14],t[15]!==f||t[16]!==g||t[17]!==x?(y=p.jsxs("div",{className:"flex flex-col gap-1",children:[f,g,x]}),t[15]=f,t[16]=g,t[17]=x,t[18]=y):y=t[18],t[19]===Symbol.for("react.memo_cache_sentinel")?(b=p.jsx(ic,{className:"w-4 h-4"}),t[19]=b):b=t[19],t[20]!==c?(w=p.jsxs("div",{className:"flex items-center gap-1",children:[b,p.jsx(eN,{percent:c})]}),t[20]=c,t[21]=w):w=t[21],t[22]!==y||t[23]!==w?(k=p.jsx(v,{delayDuration:200,content:y,children:w}),t[22]=y,t[23]=w,t[24]=k):k=t[24],k},Qk=e=>{const t=m(11),{cpu:n}=e,{percent:o}=n;let r;t[0]!==o?(r=Math.round(o),t[0]=o,t[1]=r):r=t[1];const a=r;let s,i,l,c,d;return t[2]===Symbol.for("react.memo_cache_sentinel")?(s=p.jsx("b",{children:"CPU:"}),t[2]=s):s=t[2],t[3]!==a?(i=p.jsxs("span",{children:[s," ",a,"%"]}),t[3]=a,t[4]=i):i=t[4],t[5]===Symbol.for("react.memo_cache_sentinel")?(l=p.jsx(zi,{className:"w-4 h-4"}),t[5]=l):l=t[5],t[6]!==a?(c=p.jsxs("div",{className:"flex items-center gap-1",children:[l,p.jsx(eN,{percent:a})]}),t[6]=a,t[7]=c):c=t[7],t[8]!==i||t[9]!==c?(d=p.jsx(v,{delayDuration:200,content:i,children:c}),t[8]=i,t[9]=c,t[10]=d):d=t[10],d},eN=e=>{const t=m(2),{percent:n}=e,o=`${n}%`;let r;return t[0]!==o?(r=p.jsx("div",{className:"h-3 w-20 bg-[var(--slate-4)] rounded-lg overflow-hidden border",children:p.jsx("div",{className:"h-full bg-primary",style:{width:o}})}),t[0]=o,t[1]=r):r=t[1],r};function tN(e){return e>1073741824?`${nN(e)} GB`:`${function(e){return new Intl.NumberFormat("en-US",{maximumFractionDigits:0}).format(e/1048576)}(e)} MB`}function nN(e){return new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(e/1073741824)}const oN=e=>te(Sa)[e.capability]?e.children:null,rN=()=>{const e=m(56),{selectedPanel:t,isTerminalOpen:n}=Od(),{openApplication:o,toggleTerminal:r}=Dd(),[a,s]=Ce(),i=te(Xa),l=aN,c=Pd.find(sN);let d;Rt(c,"Error panel not found"),e[0]!==r?(d=()=>{r()},e[0]=r,e[1]=d):d=e[1],hi("global.toggleTerminal",d);const u=$k,h=c.tooltip,f=t===c.type,g=()=>o(c.type),x=l(c,i>0?"text-destructive":"");let y,b,w,k,N;e[2]!==i?(y=p.jsx("span",{className:"ml-1 font-mono mt-[0.125rem]",children:i}),e[2]=i,e[3]=y):y=e[3],e[4]!==u||e[5]!==c.tooltip||e[6]!==f||e[7]!==g||e[8]!==x||e[9]!==y?(b=p.jsxs(u,{tooltip:h,selected:f,onClick:g,children:[x,y]}),e[4]=u,e[5]=c.tooltip,e[6]=f,e[7]=g,e[8]=x,e[9]=y,e[10]=b):b=e[10],e[11]!==r?(w=()=>r(),e[11]=r,e[12]=w):w=e[12],e[13]===Symbol.for("react.memo_cache_sentinel")?(k=p.jsx(Dc,{className:"h-5 w-5"}),e[13]=k):k=e[13],e[14]!==n||e[15]!==w?(N=p.jsx(oN,{capability:"terminal",children:p.jsx($k,{tooltip:"Open terminal",selected:n,onClick:w,children:k})}),e[14]=n,e[15]=w,e[16]=N):N=e[16];const E=a.runtime.auto_instantiate?"Disable autorun on startup":"Enable autorun on startup";let C,S,_;e[17]!==a||e[18]!==s?(C=async()=>{const e={...a,runtime:{...a.runtime,auto_instantiate:!a.runtime.auto_instantiate}};await je({config:e}).then((()=>s(e)))},e[17]=a,e[18]=s,e[19]=C):C=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(S=p.jsx("span",{children:"on startup: "}),e[20]=S):S=e[20],e[21]!==a.runtime.auto_instantiate?(_=a.runtime.auto_instantiate?p.jsx(Vc,{size:14}):p.jsx(Uc,{size:14}),e[21]=a.runtime.auto_instantiate,e[22]=_):_=e[22];const I=a.runtime.auto_instantiate?"autorun":"lazy";let A,M,T,O;e[23]!==I?(A=p.jsx("span",{children:I}),e[23]=I,e[24]=A):A=e[24],e[25]!==_||e[26]!==A?(M=p.jsxs("div",{className:"font-prose text-sm flex items-center gap-1",children:[S,_,A]}),e[25]=_,e[26]=A,e[27]=M):M=e[27],e[28]!==E||e[29]!==C||e[30]!==M?(T=p.jsx($k,{tooltip:E,selected:!1,onClick:C,children:M}),e[28]=E,e[29]=C,e[30]=M,e[31]=T):T=e[31],e[32]===Symbol.for("react.memo_cache_sentinel")?(O=p.jsx("div",{className:"border-r border-border h-6 mx-1"}),e[32]=O):O=e[32];const D="autorun"===a.runtime.on_cell_change?"Disable autorun":"Enable autorun";let P,R,F,L,z,B,U,V,$,G;return e[33]!==a||e[34]!==s?(P=async()=>{const e={...a,runtime:{...a.runtime,on_cell_change:"autorun"===a.runtime.on_cell_change?"lazy":"autorun"}};await je({config:e}).then((()=>s(e)))},e[33]=a,e[34]=s,e[35]=P):P=e[35],e[36]===Symbol.for("react.memo_cache_sentinel")?(R=p.jsx("span",{children:"on cell change: "}),e[36]=R):R=e[36],e[37]!==a.runtime.on_cell_change?(F=p.jsxs("div",{className:"font-prose text-sm flex items-center gap-1",children:[R,"autorun"===a.runtime.on_cell_change?p.jsx(Vc,{size:14}):p.jsx(Uc,{size:14}),p.jsx("span",{children:a.runtime.on_cell_change})]}),e[37]=a.runtime.on_cell_change,e[38]=F):F=e[38],e[39]!==D||e[40]!==P||e[41]!==F?(L=p.jsx($k,{tooltip:D,selected:!1,onClick:P,children:F}),e[39]=D,e[40]=P,e[41]=F,e[42]=L):L=e[42],e[43]===Symbol.for("react.memo_cache_sentinel")?(z=p.jsx("div",{className:"border-r border-border h-6 mx-1"}),e[43]=z):z=e[43],e[44]!==a||e[45]!==s?(B=!j()&&p.jsx($k,{tooltip:null,selected:!1,children:p.jsxs(Tt,{children:[p.jsxs(St,{className:"font-prose text-sm flex items-center gap-1",children:[p.jsx("span",{children:"on module change: "}),"off"===a.runtime.auto_reload&&p.jsx(Li,{size:14}),"lazy"===a.runtime.auto_reload&&p.jsx(Uc,{size:14}),"autorun"===a.runtime.auto_reload&&p.jsx(Vc,{size:14}),p.jsx("span",{children:a.runtime.auto_reload}),p.jsx(ve,{size:14})]}),p.jsx(Ot,{children:["off","lazy","autorun"].map((e=>p.jsxs(Ct,{onClick:async()=>{const t={...a,runtime:{...a.runtime,auto_reload:e}};await je({config:t}).then((()=>s(t)))},children:["off"===e&&p.jsx(Li,{size:14,className:"mr-2 text-muted-foreground"}),"lazy"===e&&p.jsx(Uc,{size:14,className:"mr-2 text-muted-foreground"}),"autorun"===e&&p.jsx(Vc,{size:14,className:"mr-2 text-muted-foreground"}),e]},e)))})]})}),e[44]=a,e[45]=s,e[46]=B):B=e[46],e[47]===Symbol.for("react.memo_cache_sentinel")?(U=p.jsx("div",{className:"mx-auto"}),e[47]=U):U=e[47],e[48]===Symbol.for("react.memo_cache_sentinel")?(V=p.jsx(pu,{children:p.jsx(v,{content:p.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:p.jsx("span",{className:"text-muted-foreground text-sm mr-4",children:"kiosk mode"})})}),$=p.jsx(Jk,{}),e[48]=V,e[49]=$):(V=e[48],$=e[49]),e[50]!==b||e[51]!==N||e[52]!==T||e[53]!==L||e[54]!==B?(G=p.jsxs("footer",{className:"h-10 py-2 bg-background flex items-center text-muted-foreground text-md pl-1 pr-4 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,N,T,O,L,z,B,U,V,$]}),e[50]=b,e[51]=N,e[52]=T,e[53]=L,e[54]=B,e[55]=G):G=e[55],G};function aN(e,t){const{Icon:n}=e;return p.jsx(n,{className:Jt("h-5 w-5",t)})}function sN(e){return"errors"===e.type}const iN=e=>{const t=m(6),{children:n}=e,{openModal:o,closeModal:r}=f();let a,s;return t[0]!==o||t[1]!==r?(a=()=>o(p.jsx(cN,{onClose:r})),t[0]=o,t[1]=r,t[2]=a):a=t[2],t[3]!==a||t[4]!==n?(s=p.jsx(Za,{onClick:a,children:n}),t[3]=a,t[4]=n,t[5]=s):s=t[5],s},lN={"😡":1,"🙁":2,"😐":3,"🙂":4,"😍":5},cN=e=>{const t=m(13),{onClose:n}=e;let o,r,a,s,i,l,c,d;return t[0]!==n?(o=async e=>{e.preventDefault();const t=new FormData(e.target),o=t.get("rating"),r=t.get("message");fetch("https://marimo.io/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({rating:o,message:r})}),n(),X({title:"Feedback sent!",description:"Thank you for your feedback!"})},t[0]=n,t[1]=o):o=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(r=p.jsx(b,{children:"Send Feedback"}),t[2]=r):r=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(a=p.jsxs(we,{children:[r,p.jsxs(w,{children:["Let us know what you think about marimo! If you have a bug that you would like to report, please use the"," ",p.jsx("a",{href:Ge.issuesPage,target:"_blank",rel:"noreferrer",className:"underline",children:"GitHub issue tracker"}),"."]}),p.jsx(w,{children:"Your feedback is anonymous and will help us improve marimo. Thank you!"})]}),t[3]=a):a=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(s=p.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[p.jsx("div",{className:"flex gap-5 justify-center",children:Object.entries(lN).map(dN)}),p.jsx(Qa,{id:"message",name:"message",autoFocus:!0,placeholder:"Your feedback; if you'd like us to respond, please include your email!",rows:5,required:!0,autoComplete:"off"})]}),t[4]=s):s=t[4],t[5]!==n?(i=p.jsx(x,{"data-testid":"feedback-cancel-button",variant:"secondary",onClick:n,children:"Cancel"}),t[5]=n,t[6]=i):i=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(l=p.jsx(x,{"data-testid":"feedback-send-button","aria-label":"Save",variant:"default",type:"submit",children:"Send"}),t[7]=l):l=t[7],t[8]!==i?(c=p.jsxs(k,{children:[i,l]}),t[8]=i,t[9]=c):c=t[9],t[10]!==o||t[11]!==c?(d=p.jsx(N,{className:"w-fit",children:p.jsxs("form",{onSubmit:o,children:[a,s,c]})}),t[10]=o,t[11]=c,t[12]=d):d=t[12],d};function dN(e){const[t,n]=e;return p.jsxs("label",{className:"flex flex-col items-center select-none",children:[p.jsx("input",{type:"radio",className:"peer hidden",name:"rating",value:n,"aria-label":t},t),p.jsx("span",{className:"text-4xl peer-checked:opacity-100 opacity-40 cursor-pointer",children:t})]},t)}const uN=()=>{const e=m(10),{selectedPanel:t}=Od(),{openApplication:n}=Dd(),o=fN;let r,a,s,i,l,c;if(e[0]!==t||e[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",a=Pd.filter(pN).map((e=>p.jsx(mN,{tooltip:e.tooltip,selected:t===e.type,onClick:()=>n(e.type),children:o(e)},e.type))),e[0]=t,e[1]=n,e[2]=r,e[3]=a}else r=e[2],a=e[3];return e[4]===Symbol.for("react.memo_cache_sentinel")?(s=p.jsx(iN,{children:p.jsx(mN,{tooltip:"Send feedback!",selected:!1,children:p.jsx(lc,{className:"h-5 w-5"})})}),i=p.jsx("div",{className:"flex-1"}),l=p.jsx(hN,{}),e[4]=s,e[5]=i,e[6]=l):(s=e[4],i=e[5],l=e[6]),e[7]!==r||e[8]!==a?(c=p.jsxs("div",{className:r,children:[a,s,i,l]}),e[7]=r,e[8]=a,e[9]=c):c=e[9],c},hN=()=>{const e=m(9),t=te(es);let n,o,r,a;return e[0]!==t?(n=t>0?p.jsxs("span",{children:[t," cell",t>1?"s":""," queued or running"]}):"No cells queued or running",e[0]=t,e[1]=n):n=e[1],e[2]!==t?(o=Array.from({length:t}).map(gN),e[2]=t,e[3]=o):o=e[3],e[4]!==o?(r=p.jsx("div",{className:"flex flex-col-reverse gap-[1px] overflow-hidden",children:o}),e[4]=o,e[5]=r):r=e[5],e[6]!==n||e[7]!==r?(a=p.jsx(v,{content:n,side:"right",delayDuration:200,children:r}),e[6]=n,e[7]=r,e[8]=a):a=e[8],a},mN=e=>{const t=m(17);let n,o,r,a,s;t[0]!==e?(({children:a,tooltip:s,selected:n,className:o,...r}=e),t[0]=e,t[1]=n,t[2]=o,t[3]=r,t[4]=a,t[5]=s):(n=t[1],o=t[2],r=t[3],a=t[4],s=t[5]);const i=!n&&"hover:bg-[var(--sage-3)]",l=n&&"bg-[var(--sage-4)]";let c,d,u;return t[6]!==i||t[7]!==l||t[8]!==o?(c=Jt("flex items-center p-2 text-sm mx-[1px] shadow-inset font-mono cursor-pointer rounded",i,l,o),t[6]=i,t[7]=l,t[8]=o,t[9]=c):c=t[9],t[10]!==c||t[11]!==r||t[12]!==a?(d=p.jsx("div",{className:c,...r,children:a}),t[10]=c,t[11]=r,t[12]=a,t[13]=d):d=t[13],t[14]!==s||t[15]!==d?(u=p.jsx(v,{content:s,side:"right",delayDuration:200,children:d}),t[14]=s,t[15]=d,t[16]=u):u=t[16],u};function fN(e,t){const{Icon:n}=e;return p.jsx(n,{className:Jt("h-5 w-5",t)})}function pN(e){return!e.hidden&&"sidebar"===e.position}function gN(e,t){return p.jsx("div",{className:"flex-shrink-0 h-1 w-2 bg-[var(--grass-6)] border border-[var(--grass-7)]"},t.toString())}Qe.record(Qe.tuple([Qe.number(),Qe.number()]));let vN=null;const xN=e=>{const t=m(12),{title:n,description:o,icon:r}=e;let a,s,i,l,c;return t[0]!==r?(a=r&&u.cloneElement(r,{className:"text-accent-foreground"}),t[0]=r,t[1]=a):a=t[1],t[2]!==n?(s=p.jsx("span",{className:"mt-1 text-accent-foreground",children:n}),t[2]=n,t[3]=s):s=t[3],t[4]!==a||t[5]!==s?(i=p.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[a,s]}),t[4]=a,t[5]=s,t[6]=i):i=t[6],t[7]!==o?(l=p.jsx("span",{className:"text-muted-foreground text-sm",children:o}),t[7]=o,t[8]=l):l=t[8],t[9]!==i||t[10]!==l?(c=p.jsxs("div",{className:"mx-6 my-6 flex flex-col gap-2",children:[i,l]}),t[9]=i,t[10]=l,t[11]=c):c=t[11],c},yN=()=>{const e=m(5),t=ts();if(0===t.length){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=p.jsx(xN,{title:"No errors!",icon:p.jsx(pc,{})}),e[0]=t):t=e[0],t}let n,o;return e[1]!==t?(n=t.map(bN),e[1]=t,e[2]=n):n=e[2],e[3]!==n?(o=p.jsx("div",{className:"flex flex-col overflow-auto",children:n}),e[3]=n,e[4]=o):o=e[4],o};function bN(e){return p.jsxs("div",{children:[p.jsx("div",{className:"text-xs font-mono font-semibold bg-muted border-y px-2 py-1",children:p.jsx(ns,{cellId:e.cellId})}),p.jsx("div",{className:"px-2",children:p.jsx(os,{errors:e.output.data},e.cellId)},e.cellId)]},e.cellId)}const wN=()=>{const e=m(6),{items:t}=te(rs);let n,o;e[0]!==t?(o=gl(t),e[0]=t,e[1]=o):o=e[1],n=o;const r=n,{activeHeaderId:a}=vl(r);if(0===t.length){let t;return e[2]===Symbol.for("react.memo_cache_sentinel")?(t=p.jsx(xN,{title:"No outline",description:"Add markdown headings to your notebook to create an outline.",icon:p.jsx(Ec,{})}),e[2]=t):t=e[2],t}let s;return e[3]!==t||e[4]!==a?(s=p.jsx(xl,{items:t,activeHeaderId:a}),e[3]=t,e[4]=a,e[5]=s):s=e[5],s};function kN(e){if("string"==typeof e||"number"==typeof e)return""+e;let t="";if(Array.isArray(e))for(let n,o=0;o<e.length;o++)""!==(n=kN(e[o]))&&(t+=(t&&" ")+n);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}const{useDebugValue:NN}=u,{useSyncExternalStoreWithSelector:EN}=as,CN=e=>e;function SN(e,t=CN,n){const o=EN(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return NN(o),o}const jN=(e,t)=>{const n=ss(e),o=(e,o=t)=>SN(n,e,o);return Object.assign(o,n),o};function _N(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[n,o]of e)if(!Object.is(o,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}function IN(e,t){if(e=function(e){let t;for(;t=e.sourceEvent;)e=t;return e}(e),void 0===t&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,[(o=o.matrixTransform(t.getScreenCTM().inverse())).x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}const AN={passive:!1},MN={capture:!0,passive:!1};function TN(e){e.stopImmediatePropagation()}function ON(e){e.preventDefault(),e.stopImmediatePropagation()}function DN(e){var t=e.document.documentElement,n=bl(e).on("dragstart.drag",ON,MN);"onselectstart"in t?n.on("selectstart.drag",ON,MN):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function PN(e,t){var n=e.document.documentElement,o=bl(e).on("dragstart.drag",null);t&&(o.on("click.drag",ON,MN),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 RN=e=>()=>e;function FN(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:a,x:s,y:i,dx:l,dy:c,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,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:a,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:i,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:d}})}function LN(e){return!e.ctrlKey&&!e.button}function zN(){return this.parentNode}function BN(e,t){return null==t?{x:e.x,y:e.y}:t}function UN(){return navigator.maxTouchPoints||"ontouchstart"in this}FN.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};const VN=e=>()=>e;function $N(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function GN(e){e.stopImmediatePropagation()}function HN(e){e.preventDefault(),e.stopImmediatePropagation()}function WN(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function qN(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).x,e.y],[e.x+e.width,e.y+e.height]]:[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]:[[0,0],[e.clientWidth,e.clientHeight]]}function YN(){return this.__zoom||wl}function KN(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function JN(){return navigator.maxTouchPoints||"ontouchstart"in this}function XN(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>a?(a+s)/2:Math.min(0,a)||Math.max(0,s))}const ZN=r.createContext(null),QN=ZN.Provider,eE=e=>`Node type "${e}" not found. Using fallback type "default".`,tE=()=>"The React Flow parent container needs a width and a height to render the graph.",nE=()=>"Only child nodes can use a parent extent.",oE=e=>`Marker type "${e}" doesn't exist.`,rE=(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,aE=()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",sE=e=>`Edge type "${e}" not found. Using fallback type "default".`,iE=e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,lE=(()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001")();function cE(e,t){const n=r.useContext(ZN);if(null===n)throw new Error(lE);return SN(n,e,t)}const dE=()=>{const e=r.useContext(ZN);if(null===e)throw new Error(lE);return r.useMemo((()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy})),[e])},uE=e=>e.userSelectionActive?"none":"all";function hE({position:e,children:t,className:n,style:o,...r}){const a=cE(uE),s=`${e}`.split("-");return u.createElement("div",{className:kN(["react-flow__panel",n,...s]),style:{...o,pointerEvents:a},...r},t)}function mE({proOptions:e,position:t="bottom-right"}){return(null==e?void 0:e.hideAttribution)?null:u.createElement(hE,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},u.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}var fE=r.memo((({x:e,y:t,label:n,labelStyle:o={},labelShowBg:a=!0,labelBgStyle:s={},labelBgPadding:i=[2,4],labelBgBorderRadius:l=2,children:c,className:d,...h})=>{const m=r.useRef(null),[f,p]=r.useState({x:0,y:0,width:0,height:0}),g=kN(["react-flow__edge-textwrapper",d]);return r.useEffect((()=>{if(m.current){const e=m.current.getBBox();p({x:e.x,y:e.y,width:e.width,height:e.height})}}),[n]),void 0!==n&&n?u.createElement("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:g,visibility:f.width?"visible":"hidden",...h},a&&u.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:l,ry:l}),u.createElement("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:m,style:o},n),c):null}));const pE=e=>({width:e.offsetWidth,height:e.offsetHeight}),gE=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),vE=(e={x:0,y:0},t)=>({x:gE(e.x,t[0][0],t[1][0]),y:gE(e.y,t[0][1],t[1][1])}),xE=(e,t,n)=>e<t?gE(Math.abs(e-t),1,50)/50:e>n?-gE(Math.abs(e-n),1,50)/50:0,yE=(e,t)=>[20*xE(e.x,35,t.width-35),20*xE(e.y,35,t.height-35)],bE=e=>{var t;return(null==(t=e.getRootNode)?void 0:t.call(e))||(null==window?void 0:window.document)},wE=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),kE=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),NE=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},EE=e=>!isNaN(e)&&isFinite(e),CE=Symbol.for("internals"),SE=["Enter"," ","Escape"];function jE(e){var t,n;const o=(e=>"nativeEvent"in e)(e)?e.nativeEvent:e,r=(null==(n=null==(t=o.composedPath)?void 0:t.call(o))?void 0:n[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(null==r?void 0:r.nodeName)||(null==r?void 0:r.hasAttribute("contenteditable"))||!!(null==r?void 0:r.closest(".nokey"))}const _E=e=>"clientX"in e,IE=(e,t)=>{var n,o;const r=_E(e),a=r?e.clientX:null==(n=e.touches)?void 0:n[0].clientX,s=r?e.clientY:null==(o=e.touches)?void 0:o[0].clientY;return{x:a-((null==t?void 0:t.left)??0),y:s-((null==t?void 0:t.top)??0)}},AE=()=>{var e;return"undefined"!=typeof navigator&&(null==(e=null==navigator?void 0:navigator.userAgent)?void 0:e.indexOf("Mac"))>=0},ME=({id:e,path:t,labelX:n,labelY:o,label:r,labelStyle:a,labelShowBg:s,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:h,markerStart:m,interactionWidth:f=20})=>u.createElement(u.Fragment,null,u.createElement("path",{id:e,style:d,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:h,markerStart:m}),f&&u.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:f,className:"react-flow__edge-interaction"}),r&&EE(n)&&EE(o)?u.createElement(fE,{x:n,y:o,label:r,labelStyle:a,labelShowBg:s,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:c}):null);function TE(e,t,n){return void 0===n?n:o=>{const r=t().edges.find((t=>t.id===e));r&&n(o,{...r})}}function OE({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,a=n<e?n+r:n-r,s=Math.abs(o-t)/2;return[a,o<t?o+s:o-s,r,s]}function DE({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:a,targetControlX:s,targetControlY:i}){const l=.125*e+.375*r+.375*s+.125*n,c=.125*t+.375*a+.375*i+.125*o;return[l,c,Math.abs(l-e),Math.abs(c-t)]}var PE,RE,FE,LE,zE,BE,UE,VE,$E,GE,HE,WE;function qE({pos:e,x1:t,y1:n,x2:o,y2:r}){return e===HE.Left||e===HE.Right?[.5*(t+o),n]:[t,.5*(n+r)]}function YE({sourceX:e,sourceY:t,sourcePosition:n=HE.Bottom,targetX:o,targetY:r,targetPosition:a=HE.Top}){const[s,i]=qE({pos:n,x1:e,y1:t,x2:o,y2:r}),[l,c]=qE({pos:a,x1:o,y1:r,x2:e,y2:t}),[d,u,h,m]=DE({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:s,sourceControlY:i,targetControlX:l,targetControlY:c});return[`M${e},${t} C${s},${i} ${l},${c} ${o},${r}`,d,u,h,m]}ME.displayName="BaseEdge",(RE=PE||(PE={})).Strict="strict",RE.Loose="loose",(LE=FE||(FE={})).Free="free",LE.Vertical="vertical",LE.Horizontal="horizontal",(BE=zE||(zE={})).Partial="partial",BE.Full="full",(VE=UE||(UE={})).Bezier="default",VE.Straight="straight",VE.Step="step",VE.SmoothStep="smoothstep",VE.SimpleBezier="simplebezier",(GE=$E||($E={})).Arrow="arrow",GE.ArrowClosed="arrowclosed",(WE=HE||(HE={})).Left="left",WE.Top="top",WE.Right="right",WE.Bottom="bottom";const KE=r.memo((({sourceX:e,sourceY:t,targetX:n,targetY:o,sourcePosition:r=HE.Bottom,targetPosition:a=HE.Top,label:s,labelStyle:i,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:m,markerEnd:f,markerStart:p,interactionWidth:g})=>{const[v,x,y]=YE({sourceX:e,sourceY:t,sourcePosition:r,targetX:n,targetY:o,targetPosition:a});return u.createElement(ME,{path:v,labelX:x,labelY:y,label:s,labelStyle:i,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:m,markerEnd:f,markerStart:p,interactionWidth:g})}));KE.displayName="SimpleBezierEdge";const JE={[HE.Left]:{x:-1,y:0},[HE.Right]:{x:1,y:0},[HE.Top]:{x:0,y:-1},[HE.Bottom]:{x:0,y:1}},XE=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function ZE({source:e,sourcePosition:t=HE.Bottom,target:n,targetPosition:o=HE.Top,center:r,offset:a}){const s=JE[t],i=JE[o],l={x:e.x+s.x*a,y:e.y+s.y*a},c={x:n.x+i.x*a,y:n.y+i.y*a},d=(({source:e,sourcePosition:t=HE.Bottom,target:n})=>t===HE.Left||t===HE.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1})({source:l,sourcePosition:t,target:c}),u=0!==d.x?"x":"y",h=d[u];let m,f,p=[];const g={x:0,y:0},v={x:0,y:0},[x,y,b,w]=OE({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[u]*i[u]==-1){m=r.x??x,f=r.y??y;const e=[{x:m,y:l.y},{x:m,y:c.y}],t=[{x:l.x,y:f},{x:c.x,y:f}];p=s[u]===h?"x"===u?e:t:"x"===u?t:e}else{const r=[{x:l.x,y:c.y}],d=[{x:c.x,y:l.y}];if(p="x"===u?s.x===h?d:r:s.y===h?r:d,t===o){const t=Math.abs(e[u]-n[u]);if(t<=a){const o=Math.min(a-1,a-t);s[u]===h?g[u]=(l[u]>e[u]?-1:1)*o:v[u]=(c[u]>n[u]?-1:1)*o}}if(t!==o){const e="x"===u?"y":"x",t=s[u]===i[e],n=l[e]>c[e],o=l[e]<c[e];(1===s[u]&&(!t&&n||t&&o)||1!==s[u]&&(!t&&o||t&&n))&&(p="x"===u?r:d)}const x={x:l.x+g.x,y:l.y+g.y},y={x:c.x+v.x,y:c.y+v.y};Math.max(Math.abs(x.x-p[0].x),Math.abs(y.x-p[0].x))>=Math.max(Math.abs(x.y-p[0].y),Math.abs(y.y-p[0].y))?(m=(x.x+y.x)/2,f=p[0].y):(m=p[0].x,f=(x.y+y.y)/2)}return[[e,{x:l.x+g.x,y:l.y+g.y},...p,{x:c.x+v.x,y:c.y+v.y},n],m,f,b,w]}function QE({sourceX:e,sourceY:t,sourcePosition:n=HE.Bottom,targetX:o,targetY:r,targetPosition:a=HE.Top,borderRadius:s=5,centerX:i,centerY:l,offset:c=20}){const[d,u,h,m,f]=ZE({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:a,center:{x:i,y:l},offset:c});return[d.reduce(((e,t,n)=>{let o="";return o=n>0&&n<d.length-1?function(e,t,n,o){const r=Math.min(XE(e,t)/2,XE(t,n)/2,o),{x:a,y:s}=t;if(e.x===a&&a===n.x||e.y===s&&s===n.y)return`L${a} ${s}`;if(e.y===s)return`L ${a+r*(e.x<n.x?-1:1)},${s}Q ${a},${s} ${a},${s+r*(e.y<n.y?1:-1)}`;const i=e.x<n.x?1:-1;return`L ${a},${s+r*(e.y<n.y?-1:1)}Q ${a},${s} ${a+r*i},${s}`}(d[n-1],t,d[n+1],s):`${0===n?"M":"L"}${t.x} ${t.y}`,e+=o}),""),u,h,m,f]}const eC=r.memo((({sourceX:e,sourceY:t,targetX:n,targetY:o,label:r,labelStyle:a,labelShowBg:s,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:c,style:d,sourcePosition:h=HE.Bottom,targetPosition:m=HE.Top,markerEnd:f,markerStart:p,pathOptions:g,interactionWidth:v})=>{const[x,y,b]=QE({sourceX:e,sourceY:t,sourcePosition:h,targetX:n,targetY:o,targetPosition:m,borderRadius:null==g?void 0:g.borderRadius,offset:null==g?void 0:g.offset});return u.createElement(ME,{path:x,labelX:y,labelY:b,label:r,labelStyle:a,labelShowBg:s,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:f,markerStart:p,interactionWidth:v})}));eC.displayName="SmoothStepEdge";const tC=r.memo((e=>{var t;return u.createElement(eC,{...e,pathOptions:r.useMemo((()=>{var t;return{borderRadius:0,offset:null==(t=e.pathOptions)?void 0:t.offset}}),[null==(t=e.pathOptions)?void 0:t.offset])})}));tC.displayName="StepEdge";const nC=r.memo((({sourceX:e,sourceY:t,targetX:n,targetY:o,label:r,labelStyle:a,labelShowBg:s,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:h,markerStart:m,interactionWidth:f})=>{const[p,g,v]=function({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,a,s,i]=OE({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,a,s,i]}({sourceX:e,sourceY:t,targetX:n,targetY:o});return u.createElement(ME,{path:p,labelX:g,labelY:v,label:r,labelStyle:a,labelShowBg:s,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:h,markerStart:m,interactionWidth:f})}));function oC(e,t){return e>=0?.5*e:25*t*Math.sqrt(-e)}function rC({pos:e,x1:t,y1:n,x2:o,y2:r,c:a}){switch(e){case HE.Left:return[t-oC(t-o,a),n];case HE.Right:return[t+oC(o-t,a),n];case HE.Top:return[t,n-oC(n-r,a)];case HE.Bottom:return[t,n+oC(r-n,a)]}}function aC({sourceX:e,sourceY:t,sourcePosition:n=HE.Bottom,targetX:o,targetY:r,targetPosition:a=HE.Top,curvature:s=.25}){const[i,l]=rC({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[c,d]=rC({pos:a,x1:o,y1:r,x2:e,y2:t,c:s}),[u,h,m,f]=DE({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:i,sourceControlY:l,targetControlX:c,targetControlY:d});return[`M${e},${t} C${i},${l} ${c},${d} ${o},${r}`,u,h,m,f]}nC.displayName="StraightEdge";const sC=r.memo((({sourceX:e,sourceY:t,targetX:n,targetY:o,sourcePosition:r=HE.Bottom,targetPosition:a=HE.Top,label:s,labelStyle:i,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:m,markerEnd:f,markerStart:p,pathOptions:g,interactionWidth:v})=>{const[x,y,b]=aC({sourceX:e,sourceY:t,sourcePosition:r,targetX:n,targetY:o,targetPosition:a,curvature:null==g?void 0:g.curvature});return u.createElement(ME,{path:x,labelX:y,labelY:b,label:s,labelStyle:i,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:m,markerEnd:f,markerStart:p,interactionWidth:v})}));sC.displayName="BezierEdge";const iC=r.createContext(null),lC=iC.Provider;iC.Consumer;const cC=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`reactflow__edge-${e}${t||""}-${n}${o||""}`,dC=(e,t)=>{if(void 0===e)return"";if("string"==typeof e)return e;return`${t?`${t}__`:""}${Object.keys(e).sort().map((t=>`${t}=${e[t]}`)).join("&")}`},uC=({x:e,y:t},[n,o,r],a,[s,i])=>{const l={x:(e-n)/r,y:(t-o)/r};return a?{x:s*Math.round(l.x/s),y:i*Math.round(l.y/i)}:l},hC=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o}),mC=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],o=(e.height??0)*t[1],r={x:e.position.x-n,y:e.position.y-o};return{...r,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-o}:r}},fC=(e,t=[0,0])=>{if(0===e.length)return{x:0,y:0,width:0,height:0};return(({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}))(e.reduce(((e,n)=>{const{x:o,y:r}=mC(n,t).positionAbsolute;return a=e,s=wE({x:o,y:r,width:n.width||0,height:n.height||0}),{x:Math.min(a.x,s.x),y:Math.min(a.y,s.y),x2:Math.max(a.x2,s.x2),y2:Math.max(a.y2,s.y2)};var a,s}),{x:1/0,y:1/0,x2:-1/0,y2:-1/0}))},pC=(e,t,[n,o,r]=[0,0,1],a=!1,s=!1,i=[0,0])=>{const l={x:(t.x-n)/r,y:(t.y-o)/r,width:t.width/r,height:t.height/r},c=[];return e.forEach((e=>{const{width:t,height:n,selectable:o=!0,hidden:r=!1}=e;if(s&&!o||r)return!1;const{positionAbsolute:d}=mC(e,i),u={x:d.x,y:d.y,width:t||0,height:n||0},h=NE(l,u);(void 0===t||void 0===n||null===t||null===n||a&&h>0||h>=(t||0)*(n||0)||e.dragging)&&c.push(e)})),c},gC=(e,t)=>{const n=e.map((e=>e.id));return t.filter((e=>n.includes(e.source)||n.includes(e.target)))},vC=(e,t,n,o,r,a=.1)=>{const s=t/(e.width*(1+a)),i=n/(e.height*(1+a)),l=Math.min(s,i),c=gE(l,o,r);return{x:t/2-(e.x+e.width/2)*c,y:n/2-(e.y+e.height/2)*c,zoom:c}},xC=(e,t=0)=>e.transition().duration(t);function yC(e,t,n,o){return(t[n]||[]).reduce(((t,r)=>{var a,s;return`${e.id}-${r.id}-${n}`!==o&&t.push({id:r.id||null,type:n,nodeId:e.id,x:((null==(a=e.positionAbsolute)?void 0:a.x)??0)+r.x+r.width/2,y:((null==(s=e.positionAbsolute)?void 0:s.y)??0)+r.y+r.height/2}),t}),[])}const bC={source:null,target:null,sourceHandle:null,targetHandle:null},wC=()=>({handleDomNode:null,isValid:!1,connection:bC,endHandle:null});function kC(e,t,n,o,r,a,s){const i="target"===r,l=s.querySelector(`.react-flow__handle[data-id="${null==e?void 0:e.nodeId}-${null==e?void 0:e.id}-${null==e?void 0:e.type}"]`),c={...wC(),handleDomNode:l};if(l){const e=NC(void 0,l),r=l.getAttribute("data-nodeid"),s=l.getAttribute("data-handleid"),d=l.classList.contains("connectable"),u=l.classList.contains("connectableend"),h={source:i?r:n,sourceHandle:i?s:o,target:i?n:r,targetHandle:i?o:s};c.connection=h;d&&u&&(t===PE.Strict?i&&"source"===e||!i&&"target"===e:r!==n||s!==o)&&(c.endHandle={nodeId:r,handleId:s,type:e},c.isValid=a(h))}return c}function NC(e,t){return e||((null==t?void 0:t.classList.contains("target"))?"target":(null==t?void 0:t.classList.contains("source"))?"source":null)}function EC(e){null==e||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function CC(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function SC({event:e,handleId:t,nodeId:n,onConnect:o,isTarget:r,getState:a,setState:s,isValidConnection:i,edgeUpdaterType:l,onReconnectEnd:c}){const d=bE(e.target),{connectionMode:u,domNode:h,autoPanOnConnect:m,connectionRadius:f,onConnectStart:p,panBy:g,getNodes:v,cancelConnection:x}=a();let y,b=0;const{x:w,y:k}=IE(e),N=null==d?void 0:d.elementFromPoint(w,k),E=NC(l,N),C=null==h?void 0:h.getBoundingClientRect();if(!C||!E)return;let S,j=IE(e,C),_=!1,I=null,A=!1,M=null;const T=function({nodes:e,nodeId:t,handleId:n,handleType:o}){return e.reduce(((e,r)=>{if(r[CE]){const{handleBounds:a}=r[CE];let s=[],i=[];a&&(s=yC(r,a,"source",`${t}-${n}-${o}`),i=yC(r,a,"target",`${t}-${n}-${o}`)),e.push(...s,...i)}return e}),[])}({nodes:v(),nodeId:n,handleId:t,handleType:E}),O=()=>{if(!m)return;const[e,t]=yE(j,C);g({x:e,y:t}),b=requestAnimationFrame(O)};function D(e){const{transform:o}=a();j=IE(e,C);const{handle:l,validHandleResult:c}=function(e,t,n,o,r,a){const{x:s,y:i}=IE(e),l=t.elementsFromPoint(s,i).find((e=>e.classList.contains("react-flow__handle")));if(l){const e=l.getAttribute("data-nodeid");if(e){const t=NC(void 0,l),o=l.getAttribute("data-handleid"),s=a({nodeId:e,id:o,type:t});if(s){const a=r.find((n=>n.nodeId===e&&n.type===t&&n.id===o));return{handle:{id:o,type:t,nodeId:e,x:(null==a?void 0:a.x)||n.x,y:(null==a?void 0:a.y)||n.y},validHandleResult:s}}}}let c=[],d=1/0;if(r.forEach((e=>{const t=Math.sqrt((e.x-n.x)**2+(e.y-n.y)**2);if(t<=o){const n=a(e);t<=d&&(t<d?c=[{handle:e,validHandleResult:n}]:t===d&&c.push({handle:e,validHandleResult:n}),d=t)}})),!c.length)return{handle:null,validHandleResult:wC()};if(1===c.length)return c[0];const u=c.some((({validHandleResult:e})=>e.isValid)),h=c.some((({handle:e})=>"target"===e.type));return c.find((({handle:e,validHandleResult:t})=>h?"target"===e.type:!u||t.isValid))||c[0]}(e,d,uC(j,o,!1,[1,1]),f,T,(e=>kC(e,u,n,t,r?"target":"source",i,d)));if(y=l,_||(O(),_=!0),M=c.handleDomNode,I=c.connection,A=c.isValid,s({connectionPosition:y&&A?hC({x:y.x,y:y.y},o):j,connectionStatus:CC(!!y,A),connectionEndHandle:c.endHandle}),!y&&!A&&!M)return EC(S);I.source!==I.target&&M&&(EC(S),S=M,M.classList.add("connecting","react-flow__handle-connecting"),M.classList.toggle("valid",A),M.classList.toggle("react-flow__handle-valid",A))}function P(e){var t,n;(y||M)&&I&&A&&(null==o||o(I)),null==(n=(t=a()).onConnectEnd)||n.call(t,e),l&&(null==c||c(e)),EC(S),x(),cancelAnimationFrame(b),_=!1,A=!1,I=null,M=null,d.removeEventListener("mousemove",D),d.removeEventListener("mouseup",P),d.removeEventListener("touchmove",D),d.removeEventListener("touchend",P)}s({connectionPosition:j,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:E,connectionStartHandle:{nodeId:n,handleId:t,type:E},connectionEndHandle:null}),null==p||p(e,{nodeId:n,handleId:t,handleType:E}),d.addEventListener("mousemove",D),d.addEventListener("mouseup",P),d.addEventListener("touchmove",D),d.addEventListener("touchend",P)}const jC=()=>!0,_C=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),IC=r.forwardRef((({type:e="source",position:t=HE.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:a=!0,isConnectableEnd:s=!0,id:i,onConnect:l,children:c,className:d,onMouseDown:h,onTouchStart:m,...f},p)=>{var g,v;const x=i||null,y="target"===e,b=dE(),w=r.useContext(iC),{connectOnClick:k,noPanClassName:N}=cE(_C,_N),{connecting:E,clickConnecting:C}=cE(((e,t,n)=>o=>{const{connectionStartHandle:r,connectionEndHandle:a,connectionClickStartHandle:s}=o;return{connecting:(null==r?void 0:r.nodeId)===e&&(null==r?void 0:r.handleId)===t&&(null==r?void 0:r.type)===n||(null==a?void 0:a.nodeId)===e&&(null==a?void 0:a.handleId)===t&&(null==a?void 0:a.type)===n,clickConnecting:(null==s?void 0:s.nodeId)===e&&(null==s?void 0:s.handleId)===t&&(null==s?void 0:s.type)===n}})(w,x,e),_N);w||null==(v=(g=b.getState()).onError)||v.call(g,"010",aE());const S=e=>{const{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:o}=b.getState(),r={...t,...e};if(o){const{edges:e,setEdges:t}=b.getState();t(((e,t)=>{if(!e.source||!e.target)return t;let n;var o;return n="id"in(o=e)&&"source"in o&&"target"in o?{...e}:{...e,id:cC(e)},((e,t)=>t.some((t=>!(t.source!==e.source||t.target!==e.target||t.sourceHandle!==e.sourceHandle&&(t.sourceHandle||e.sourceHandle)||t.targetHandle!==e.targetHandle&&(t.targetHandle||e.targetHandle)))))(n,t)?t:t.concat(n)})(r,e))}null==n||n(r),null==l||l(r)},j=e=>{if(!w)return;const t=_E(e);a&&(t&&0===e.button||!t)&&SC({event:e,handleId:x,nodeId:w,onConnect:S,isTarget:y,getState:b.getState,setState:b.setState,isValidConnection:n||b.getState().isValidConnection||jC}),t?null==h||h(e):null==m||m(e)};return u.createElement("div",{"data-handleid":x,"data-nodeid":w,"data-handlepos":t,"data-id":`${w}-${x}-${e}`,className:kN(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",N,d,{source:!y,target:y,connectable:o,connectablestart:a,connectableend:s,connecting:C,connectionindicator:o&&(a&&!E||s&&E)}]),onMouseDown:j,onTouchStart:j,onClick:k?t=>{const{onClickConnectStart:o,onClickConnectEnd:r,connectionClickStartHandle:s,connectionMode:i,isValidConnection:l}=b.getState();if(!w||!s&&!a)return;if(!s)return null==o||o(t,{nodeId:w,handleId:x,handleType:e}),void b.setState({connectionClickStartHandle:{nodeId:w,type:e,handleId:x}});const c=bE(t.target),d=n||l||jC,{connection:u,isValid:h}=kC({nodeId:w,id:x,type:e},i,s.nodeId,s.handleId||null,s.type,d,c);h&&S(u),null==r||r(t),b.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f},c)}));IC.displayName="Handle";var AC=r.memo(IC);const MC=({data:e,isConnectable:t,targetPosition:n=HE.Top,sourcePosition:o=HE.Bottom})=>u.createElement(u.Fragment,null,u.createElement(AC,{type:"target",position:n,isConnectable:t}),null==e?void 0:e.label,u.createElement(AC,{type:"source",position:o,isConnectable:t}));MC.displayName="DefaultNode";var TC=r.memo(MC);const OC=({data:e,isConnectable:t,sourcePosition:n=HE.Bottom})=>u.createElement(u.Fragment,null,null==e?void 0:e.label,u.createElement(AC,{type:"source",position:n,isConnectable:t}));OC.displayName="InputNode";var DC=r.memo(OC);const PC=({data:e,isConnectable:t,targetPosition:n=HE.Top})=>u.createElement(u.Fragment,null,u.createElement(AC,{type:"target",position:n,isConnectable:t}),null==e?void 0:e.label);PC.displayName="OutputNode";var RC=r.memo(PC);const FC=()=>null;FC.displayName="GroupNode";const LC=e=>({selectedNodes:e.getNodes().filter((e=>e.selected)),selectedEdges:e.edges.filter((e=>e.selected)).map((e=>({...e})))}),zC=e=>e.id;function BC(e,t){return _N(e.selectedNodes.map(zC),t.selectedNodes.map(zC))&&_N(e.selectedEdges.map(zC),t.selectedEdges.map(zC))}const UC=r.memo((({onSelectionChange:e})=>{const t=dE(),{selectedNodes:n,selectedEdges:o}=cE(LC,BC);return r.useEffect((()=>{const r={nodes:n,edges:o};null==e||e(r),t.getState().onSelectionChange.forEach((e=>e(r)))}),[n,o,e]),null}));UC.displayName="SelectionListener";const VC=e=>!!e.onSelectionChange;function $C({onSelectionChange:e}){const t=cE(VC);return e||t?u.createElement(UC,{onSelectionChange:e}):null}const GC=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function HC(e,t){r.useEffect((()=>{void 0!==e&&t(e)}),[e])}function WC(e,t,n){r.useEffect((()=>{void 0!==t&&n({[e]:t})}),[t])}const qC=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:a,onConnectStart:s,onConnectEnd:i,onClickConnectStart:l,onClickConnectEnd:c,nodesDraggable:d,nodesConnectable:u,nodesFocusable:h,edgesFocusable:m,edgesUpdatable:f,elevateNodesOnSelect:p,minZoom:g,maxZoom:v,nodeExtent:x,onNodesChange:y,onEdgesChange:b,elementsSelectable:w,connectionMode:k,snapGrid:N,snapToGrid:E,translateExtent:C,connectOnClick:S,defaultEdgeOptions:j,fitView:_,fitViewOptions:I,onNodesDelete:A,onEdgesDelete:M,onNodeDrag:T,onNodeDragStart:O,onNodeDragStop:D,onSelectionDrag:P,onSelectionDragStart:R,onSelectionDragStop:F,noPanClassName:L,nodeOrigin:z,rfId:B,autoPanOnConnect:U,autoPanOnNodeDrag:V,onError:$,connectionRadius:G,isValidConnection:H,nodeDragThreshold:W})=>{const{setNodes:q,setEdges:Y,setDefaultNodesAndEdges:K,setMinZoom:J,setMaxZoom:X,setTranslateExtent:Z,setNodeExtent:Q,reset:ee}=cE(GC,_N),te=dE();return r.useEffect((()=>{const e=null==o?void 0:o.map((e=>({...e,...j})));return K(n,e),()=>{ee()}}),[]),WC("defaultEdgeOptions",j,te.setState),WC("connectionMode",k,te.setState),WC("onConnect",a,te.setState),WC("onConnectStart",s,te.setState),WC("onConnectEnd",i,te.setState),WC("onClickConnectStart",l,te.setState),WC("onClickConnectEnd",c,te.setState),WC("nodesDraggable",d,te.setState),WC("nodesConnectable",u,te.setState),WC("nodesFocusable",h,te.setState),WC("edgesFocusable",m,te.setState),WC("edgesUpdatable",f,te.setState),WC("elementsSelectable",w,te.setState),WC("elevateNodesOnSelect",p,te.setState),WC("snapToGrid",E,te.setState),WC("snapGrid",N,te.setState),WC("onNodesChange",y,te.setState),WC("onEdgesChange",b,te.setState),WC("connectOnClick",S,te.setState),WC("fitViewOnInit",_,te.setState),WC("fitViewOnInitOptions",I,te.setState),WC("onNodesDelete",A,te.setState),WC("onEdgesDelete",M,te.setState),WC("onNodeDrag",T,te.setState),WC("onNodeDragStart",O,te.setState),WC("onNodeDragStop",D,te.setState),WC("onSelectionDrag",P,te.setState),WC("onSelectionDragStart",R,te.setState),WC("onSelectionDragStop",F,te.setState),WC("noPanClassName",L,te.setState),WC("nodeOrigin",z,te.setState),WC("rfId",B,te.setState),WC("autoPanOnConnect",U,te.setState),WC("autoPanOnNodeDrag",V,te.setState),WC("onError",$,te.setState),WC("connectionRadius",G,te.setState),WC("isValidConnection",H,te.setState),WC("nodeDragThreshold",W,te.setState),HC(e,q),HC(t,Y),HC(g,J),HC(v,X),HC(C,Z),HC(x,Q),null},YC={display:"none"},KC={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},JC="react-flow__node-desc",XC="react-flow__edge-desc",ZC=e=>e.ariaLiveMessage;function QC({rfId:e}){const t=cE(ZC);return u.createElement("div",{id:`react-flow__aria-live-${e}`,"aria-live":"assertive","aria-atomic":"true",style:KC},t)}function eS({rfId:e,disableKeyboardA11y:t}){return u.createElement(u.Fragment,null,u.createElement("div",{id:`${JC}-${e}`,style:YC},"Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),u.createElement("div",{id:`${XC}-${e}`,style:YC},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&u.createElement(QC,{rfId:e}))}var tS=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,o]=r.useState(!1),a=r.useRef(!1),s=r.useRef(new Set([])),[i,l]=r.useMemo((()=>{if(null!==e){const t=(Array.isArray(e)?e:[e]).filter((e=>"string"==typeof e)).map((e=>e.split("+"))),n=t.reduce(((e,t)=>e.concat(...t)),[]);return[t,n]}return[[],[]]}),[e]);return r.useEffect((()=>{const n="undefined"!=typeof document?document:null,r=(null==t?void 0:t.target)||n;if(null!==e){const e=e=>{a.current=e.ctrlKey||e.metaKey||e.shiftKey;if((!a.current||a.current&&!t.actInsideInputWithModifier)&&jE(e))return!1;const n=oS(e.code,l);s.current.add(e[n]),nS(i,s.current,!1)&&(e.preventDefault(),o(!0))},n=e=>{if((!a.current||a.current&&!t.actInsideInputWithModifier)&&jE(e))return!1;const n=oS(e.code,l);nS(i,s.current,!0)?(o(!1),s.current.clear()):s.current.delete(e[n]),"Meta"===e.key&&s.current.clear(),a.current=!1},c=()=>{s.current.clear(),o(!1)};return null==r||r.addEventListener("keydown",e),null==r||r.addEventListener("keyup",n),window.addEventListener("blur",c),()=>{null==r||r.removeEventListener("keydown",e),null==r||r.removeEventListener("keyup",n),window.removeEventListener("blur",c)}}}),[e,o]),n};function nS(e,t,n){return e.filter((e=>n||e.length===t.size)).some((e=>e.every((e=>t.has(e)))))}function oS(e,t){return t.includes(e)?"code":"key"}function rS(e,t,n,o){var r,a;const s=e.parentNode||e.parentId;if(!s)return n;const i=t.get(s),l=mC(i,o);return rS(i,t,{x:(n.x??0)+l.x,y:(n.y??0)+l.y,z:((null==(r=i[CE])?void 0:r.z)??0)>(n.z??0)?(null==(a=i[CE])?void 0:a.z)??0:n.z??0},o)}function aS(e,t,n){e.forEach((o=>{var r;const a=o.parentNode||o.parentId;if(a&&!e.has(a))throw new Error(`Parent node ${a} not found`);if(a||(null==n?void 0:n[o.id])){const{x:a,y:s,z:i}=rS(o,e,{...o.position,z:(null==(r=o[CE])?void 0:r.z)??0},t);o.positionAbsolute={x:a,y:s},o[CE].z=i,(null==n?void 0:n[o.id])&&(o[CE].isParent=!0)}}))}function sS(e,t,n,o){const r=new Map,a={},s=o?1e3:0;return e.forEach((e=>{var n;const o=(EE(e.zIndex)?e.zIndex:0)+(e.selected?s:0),i=t.get(e.id),l={...e,positionAbsolute:{x:e.position.x,y:e.position.y}},c=e.parentNode||e.parentId;c&&(a[c]=!0);const d=(null==i?void 0:i.type)&&(null==i?void 0:i.type)!==e.type;Object.defineProperty(l,CE,{enumerable:!1,value:{handleBounds:d||null==(n=null==i?void 0:i[CE])?void 0:n.handleBounds,z:o}}),r.set(e.id,l)})),aS(r,n,a),r}function iS(e,t={}){const{getNodes:n,width:o,height:r,minZoom:a,maxZoom:s,d3Zoom:i,d3Selection:l,fitViewOnInitDone:c,fitViewOnInit:d,nodeOrigin:u}=e(),h=t.initial&&!c&&d;if(i&&l&&(h||!t.initial)){const e=n().filter((e=>{var n;const o=t.includeHiddenNodes?e.width&&e.height:!e.hidden;return(null==(n=t.nodes)?void 0:n.length)?o&&t.nodes.some((t=>t.id===e.id)):o})),c=e.every((e=>e.width&&e.height));if(e.length>0&&c){const n=fC(e,u),{x:c,y:d,zoom:h}=vC(n,o,r,t.minZoom??a,t.maxZoom??s,t.padding??.1),m=wl.translate(c,d).scale(h);return"number"==typeof t.duration&&t.duration>0?i.transform(xC(l,t.duration),m):i.transform(l,m),!0}}return!1}function lS(e,t){return e.forEach((e=>{const n=t.get(e.id);n&&t.set(n.id,{...n,[CE]:n[CE],selected:e.selected})})),new Map(t)}function cS(e,t){return t.map((t=>{const n=e.find((e=>e.id===t.id));return n&&(t.selected=n.selected),t}))}function dS({changedNodes:e,changedEdges:t,get:n,set:o}){const{nodeInternals:r,edges:a,onNodesChange:s,onEdgesChange:i,hasDefaultNodes:l,hasDefaultEdges:c}=n();(null==e?void 0:e.length)&&(l&&o({nodeInternals:lS(e,r)}),null==s||s(e)),(null==t?void 0:t.length)&&(c&&o({edges:cS(t,a)}),null==i||i(t))}const uS=()=>{},hS={zoomIn:uS,zoomOut:uS,zoomTo:uS,getZoom:()=>1,setViewport:uS,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:uS,fitBounds:uS,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},mS=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection});function fS(){const e=(()=>{const e=dE(),{d3Zoom:t,d3Selection:n}=cE(mS,_N);return r.useMemo((()=>n&&t?{zoomIn:e=>t.scaleBy(xC(n,null==e?void 0:e.duration),1.2),zoomOut:e=>t.scaleBy(xC(n,null==e?void 0:e.duration),1/1.2),zoomTo:(e,o)=>t.scaleTo(xC(n,null==o?void 0:o.duration),e),getZoom:()=>e.getState().transform[2],setViewport:(o,r)=>{const[a,s,i]=e.getState().transform,l=wl.translate(o.x??a,o.y??s).scale(o.zoom??i);t.transform(xC(n,null==r?void 0:r.duration),l)},getViewport:()=>{const[t,n,o]=e.getState().transform;return{x:t,y:n,zoom:o}},fitView:t=>iS(e.getState,t),setCenter:(o,r,a)=>{const{width:s,height:i,maxZoom:l}=e.getState(),c=void 0!==(null==a?void 0:a.zoom)?a.zoom:l,d=s/2-o*c,u=i/2-r*c,h=wl.translate(d,u).scale(c);t.transform(xC(n,null==a?void 0:a.duration),h)},fitBounds:(o,r)=>{const{width:a,height:s,minZoom:i,maxZoom:l}=e.getState(),{x:c,y:d,zoom:u}=vC(o,a,s,i,l,(null==r?void 0:r.padding)??.1),h=wl.translate(c,d).scale(u);t.transform(xC(n,null==r?void 0:r.duration),h)},project:t=>{const{transform:n,snapToGrid:o,snapGrid:r}=e.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"),uC(t,n,o,r)},screenToFlowPosition:t=>{const{transform:n,snapToGrid:o,snapGrid:r,domNode:a}=e.getState();if(!a)return t;const{x:s,y:i}=a.getBoundingClientRect(),l={x:t.x-s,y:t.y-i};return uC(l,n,o,r)},flowToScreenPosition:t=>{const{transform:n,domNode:o}=e.getState();if(!o)return t;const{x:r,y:a}=o.getBoundingClientRect(),s=hC(t,n);return{x:s.x+r,y:s.y+a}},viewportInitialized:!0}:hS),[t,n])})(),t=dE(),n=r.useCallback((()=>t.getState().getNodes().map((e=>({...e})))),[]),o=r.useCallback((e=>t.getState().nodeInternals.get(e)),[]),a=r.useCallback((()=>{const{edges:e=[]}=t.getState();return e.map((e=>({...e})))}),[]),s=r.useCallback((e=>{const{edges:n=[]}=t.getState();return n.find((t=>t.id===e))}),[]),i=r.useCallback((e=>{const{getNodes:n,setNodes:o,hasDefaultNodes:r,onNodesChange:a}=t.getState(),s=n(),i="function"==typeof e?e(s):e;if(r)o(i);else if(a){a(0===i.length?s.map((e=>({type:"remove",id:e.id}))):i.map((e=>({item:e,type:"reset"}))))}}),[]),l=r.useCallback((e=>{const{edges:n=[],setEdges:o,hasDefaultEdges:r,onEdgesChange:a}=t.getState(),s="function"==typeof e?e(n):e;if(r)o(s);else if(a){a(0===s.length?n.map((e=>({type:"remove",id:e.id}))):s.map((e=>({item:e,type:"reset"}))))}}),[]),c=r.useCallback((e=>{const n=Array.isArray(e)?e:[e],{getNodes:o,setNodes:r,hasDefaultNodes:a,onNodesChange:s}=t.getState();if(a){r([...o(),...n])}else if(s){s(n.map((e=>({item:e,type:"add"}))))}}),[]),d=r.useCallback((e=>{const n=Array.isArray(e)?e:[e],{edges:o=[],setEdges:r,hasDefaultEdges:a,onEdgesChange:s}=t.getState();if(a)r([...o,...n]);else if(s){s(n.map((e=>({item:e,type:"add"}))))}}),[]),u=r.useCallback((()=>{const{getNodes:e,edges:n=[],transform:o}=t.getState(),[r,a,s]=o;return{nodes:e().map((e=>({...e}))),edges:n.map((e=>({...e}))),viewport:{x:r,y:a,zoom:s}}}),[]),h=r.useCallback((({nodes:e,edges:n})=>{const{nodeInternals:o,getNodes:r,edges:a,hasDefaultNodes:s,hasDefaultEdges:i,onNodesDelete:l,onEdgesDelete:c,onNodesChange:d,onEdgesChange:u}=t.getState(),h=(e||[]).map((e=>e.id)),m=(n||[]).map((e=>e.id)),f=r().reduce(((e,t)=>{const n=t.parentNode||t.parentId,o=!h.includes(t.id)&&n&&e.find((e=>e.id===n));return("boolean"!=typeof t.deletable||t.deletable)&&(h.includes(t.id)||o)&&e.push(t),e}),[]),p=a.filter((e=>"boolean"!=typeof e.deletable||e.deletable)),g=p.filter((e=>m.includes(e.id)));if(f||g){const e=gC(f,p),n=[...g,...e],r=n.reduce(((e,t)=>(e.includes(t.id)||e.push(t.id),e)),[]);if((i||s)&&(i&&t.setState({edges:a.filter((e=>!r.includes(e.id)))}),s&&(f.forEach((e=>{o.delete(e.id)})),t.setState({nodeInternals:new Map(o)}))),r.length>0&&(null==c||c(n),u&&u(r.map((e=>({id:e,type:"remove"}))))),f.length>0&&(null==l||l(f),d)){d(f.map((e=>({id:e.id,type:"remove"}))))}}}),[]),m=r.useCallback((e=>{const n=EE((o=e).width)&&EE(o.height)&&EE(o.x)&&EE(o.y);var o;const r=n?null:t.getState().nodeInternals.get(e.id);if(!n&&!r)return[null,null,n];return[n?e:kE(r),r,n]}),[]),f=r.useCallback(((e,n=!0,o)=>{const[r,a,s]=m(e);return r?(o||t.getState().getNodes()).filter((e=>{if(!(s||e.id!==a.id&&e.positionAbsolute))return!1;const t=kE(e),o=NE(t,r);return n&&o>0||o>=r.width*r.height})):[]}),[]),p=r.useCallback(((e,t,n=!0)=>{const[o]=m(e);if(!o)return!1;const r=NE(o,t);return n&&r>0||r>=o.width*o.height}),[]);return r.useMemo((()=>({...e,getNodes:n,getNode:o,getEdges:a,getEdge:s,setNodes:i,setEdges:l,addNodes:c,addEdges:d,toObject:u,deleteElements:h,getIntersectingNodes:f,isNodeIntersecting:p})),[e,n,o,a,s,i,l,c,d,u,h,f,p])}const pS={actInsideInputWithModifier:!1};const gS={position:"absolute",width:"100%",height:"100%",top:0,left:0},vS=e=>({x:e.x,y:e.y,zoom:e.k}),xS=(e,t)=>e.target.closest(`.${t}`),yS=(e,t)=>2===t&&Array.isArray(e)&&e.includes(2),bS=e=>{const t=e.ctrlKey&&AE()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*t},wS=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),kS=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:o,zoomOnScroll:a=!0,zoomOnPinch:s=!0,panOnScroll:i=!1,panOnScrollSpeed:l=.5,panOnScrollMode:c=FE.Free,zoomOnDoubleClick:d=!0,elementsSelectable:h,panOnDrag:m=!0,defaultViewport:f,translateExtent:p,minZoom:g,maxZoom:v,zoomActivationKeyCode:x,preventScrolling:y=!0,children:b,noWheelClassName:w,noPanClassName:k})=>{const N=r.useRef(),E=dE(),C=r.useRef(!1),S=r.useRef(!1),j=r.useRef(null),_=r.useRef({x:0,y:0,zoom:0}),{d3Zoom:I,d3Selection:A,d3ZoomHandler:M,userSelectionActive:T}=cE(wS,_N),O=tS(x),D=r.useRef(0),P=r.useRef(!1),R=r.useRef();return function(e){const t=dE();r.useEffect((()=>{let n;const o=()=>{var n,o;if(!e.current)return;const r=pE(e.current);0!==r.height&&0!==r.width||null==(o=(n=t.getState()).onError)||o.call(n,"004",tE()),t.setState({width:r.width||500,height:r.height||500})};return o(),window.addEventListener("resize",o),e.current&&(n=new ResizeObserver((()=>o())),n.observe(e.current)),()=>{window.removeEventListener("resize",o),n&&e.current&&n.unobserve(e.current)}}),[])}(j),r.useEffect((()=>{if(j.current){const e=j.current.getBoundingClientRect(),t=function(){var e,t,n,o=WN,r=qN,a=XN,s=KN,i=JN,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],d=250,u=Cl,h=El("start","zoom","end"),m=0,f=10;function p(e){e.property("__zoom",YN).on("wheel.zoom",k,{passive:!1}).on("mousedown.zoom",N).on("dblclick.zoom",E).filter(i).on("touchstart.zoom",C).on("touchmove.zoom",S).on("touchend.zoom touchcancel.zoom",j).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(e,t){return(t=Math.max(l[0],Math.min(l[1],t)))===e.k?e:new kl(t,e.x,e.y)}function v(e,t,n){var o=t[0]-n[0]*e.k,r=t[1]-n[1]*e.k;return o===e.x&&r===e.y?e:new kl(e.k,o,r)}function x(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function y(e,t,n,o){e.on("start.zoom",(function(){b(this,arguments).event(o).start()})).on("interrupt.zoom end.zoom",(function(){b(this,arguments).event(o).end()})).tween("zoom",(function(){var e=this,a=arguments,s=b(e,a).event(o),i=r.apply(e,a),l=null==n?x(i):"function"==typeof n?n.apply(e,a):n,c=Math.max(i[1][0]-i[0][0],i[1][1]-i[0][1]),d=e.__zoom,h="function"==typeof t?t.apply(e,a):t,m=u(d.invert(l).concat(c/d.k),h.invert(l).concat(c/h.k));return function(e){if(1===e)e=h;else{var t=m(e),n=c/t[2];e=new kl(n,l[0]-t[0]*n,l[1]-t[1]*n)}s.zoom(null,e)}}))}function b(e,t,n){return!n&&e.__zooming||new w(e,t)}function w(e,t){this.that=e,this.args=t,this.active=0,this.sourceEvent=null,this.extent=r.apply(e,t),this.taps=0}function k(e,...t){if(o.apply(this,arguments)){var n=b(this,t).event(e),r=this.__zoom,i=Math.max(l[0],Math.min(l[1],r.k*Math.pow(2,s.apply(this,arguments)))),d=IN(e);if(n.wheel)n.mouse[0][0]===d[0]&&n.mouse[0][1]===d[1]||(n.mouse[1]=r.invert(n.mouse[0]=d)),clearTimeout(n.wheel);else{if(r.k===i)return;n.mouse=[d,r.invert(d)],Nl(this),n.start()}HN(e),n.wheel=setTimeout((function(){n.wheel=null,n.end()}),150),n.zoom("mouse",a(v(g(r,i),n.mouse[0],n.mouse[1]),n.extent,c))}}function N(e,...t){if(!n&&o.apply(this,arguments)){var r=e.currentTarget,s=b(this,t,!0).event(e),i=bl(e.view).on("mousemove.zoom",(function(e){if(HN(e),!s.moved){var t=e.clientX-d,n=e.clientY-u;s.moved=t*t+n*n>m}s.event(e).zoom("mouse",a(v(s.that.__zoom,s.mouse[0]=IN(e,r),s.mouse[1]),s.extent,c))}),!0).on("mouseup.zoom",(function(e){i.on("mousemove.zoom mouseup.zoom",null),PN(e.view,s.moved),HN(e),s.event(e).end()}),!0),l=IN(e,r),d=e.clientX,u=e.clientY;DN(e.view),GN(e),s.mouse=[l,this.__zoom.invert(l)],Nl(this),s.start()}}function E(e,...t){if(o.apply(this,arguments)){var n=this.__zoom,s=IN(e.changedTouches?e.changedTouches[0]:e,this),i=n.invert(s),l=n.k*(e.shiftKey?.5:2),u=a(v(g(n,l),s,i),r.apply(this,t),c);HN(e),d>0?bl(this).transition().duration(d).call(y,u,s,e):bl(this).call(p.transform,u,s,e)}}function C(n,...r){if(o.apply(this,arguments)){var a,s,i,l,c=n.touches,d=c.length,u=b(this,r,n.changedTouches.length===d).event(n);for(GN(n),s=0;s<d;++s)l=[l=IN(i=c[s],this),this.__zoom.invert(l),i.identifier],u.touch0?u.touch1||u.touch0[2]===l[2]||(u.touch1=l,u.taps=0):(u.touch0=l,a=!0,u.taps=1+!!e);e&&(e=clearTimeout(e)),a&&(u.taps<2&&(t=l[0],e=setTimeout((function(){e=null}),500)),Nl(this),u.start())}}function S(e,...t){if(this.__zooming){var n,o,r,s,i=b(this,t).event(e),l=e.changedTouches,d=l.length;for(HN(e),n=0;n<d;++n)r=IN(o=l[n],this),i.touch0&&i.touch0[2]===o.identifier?i.touch0[0]=r:i.touch1&&i.touch1[2]===o.identifier&&(i.touch1[0]=r);if(o=i.that.__zoom,i.touch1){var u=i.touch0[0],h=i.touch0[1],m=i.touch1[0],f=i.touch1[1],p=(p=m[0]-u[0])*p+(p=m[1]-u[1])*p,x=(x=f[0]-h[0])*x+(x=f[1]-h[1])*x;o=g(o,Math.sqrt(p/x)),r=[(u[0]+m[0])/2,(u[1]+m[1])/2],s=[(h[0]+f[0])/2,(h[1]+f[1])/2]}else{if(!i.touch0)return;r=i.touch0[0],s=i.touch0[1]}i.zoom("touch",a(v(o,r,s),i.extent,c))}}function j(e,...o){if(this.__zooming){var r,a,s=b(this,o).event(e),i=e.changedTouches,l=i.length;for(GN(e),n&&clearTimeout(n),n=setTimeout((function(){n=null}),500),r=0;r<l;++r)a=i[r],s.touch0&&s.touch0[2]===a.identifier?delete s.touch0:s.touch1&&s.touch1[2]===a.identifier&&delete s.touch1;if(s.touch1&&!s.touch0&&(s.touch0=s.touch1,delete s.touch1),s.touch0)s.touch0[1]=this.__zoom.invert(s.touch0[0]);else if(s.end(),2===s.taps&&(a=IN(a,this),Math.hypot(t[0]-a[0],t[1]-a[1])<f)){var c=bl(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return p.transform=function(e,t,n,o){var r=e.selection?e.selection():e;r.property("__zoom",YN),e!==r?y(e,t,n,o):r.interrupt().each((function(){b(this,arguments).event(o).start().zoom(null,"function"==typeof t?t.apply(this,arguments):t).end()}))},p.scaleBy=function(e,t,n,o){p.scaleTo(e,(function(){return this.__zoom.k*("function"==typeof t?t.apply(this,arguments):t)}),n,o)},p.scaleTo=function(e,t,n,o){p.transform(e,(function(){var e=r.apply(this,arguments),o=this.__zoom,s=null==n?x(e):"function"==typeof n?n.apply(this,arguments):n,i=o.invert(s),l="function"==typeof t?t.apply(this,arguments):t;return a(v(g(o,l),s,i),e,c)}),n,o)},p.translateBy=function(e,t,n,o){p.transform(e,(function(){return a(this.__zoom.translate("function"==typeof t?t.apply(this,arguments):t,"function"==typeof n?n.apply(this,arguments):n),r.apply(this,arguments),c)}),null,o)},p.translateTo=function(e,t,n,o,s){p.transform(e,(function(){var e=r.apply(this,arguments),s=this.__zoom,i=null==o?x(e):"function"==typeof o?o.apply(this,arguments):o;return a(wl.translate(i[0],i[1]).scale(s.k).translate("function"==typeof t?-t.apply(this,arguments):-t,"function"==typeof n?-n.apply(this,arguments):-n),e,c)}),o,s)},w.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return 1==++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(e,t){return this.mouse&&"mouse"!==e&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var t=bl(this.that).datum();h.call(e,this.that,new $N(e,{sourceEvent:this.sourceEvent,target:p,type:e,transform:this.that.__zoom,dispatch:h}),t)}},p.wheelDelta=function(e){return arguments.length?(s="function"==typeof e?e:VN(+e),p):s},p.filter=function(e){return arguments.length?(o="function"==typeof e?e:VN(!!e),p):o},p.touchable=function(e){return arguments.length?(i="function"==typeof e?e:VN(!!e),p):i},p.extent=function(e){return arguments.length?(r="function"==typeof e?e:VN([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),p):r},p.scaleExtent=function(e){return arguments.length?(l[0]=+e[0],l[1]=+e[1],p):[l[0],l[1]]},p.translateExtent=function(e){return arguments.length?(c[0][0]=+e[0][0],c[1][0]=+e[1][0],c[0][1]=+e[0][1],c[1][1]=+e[1][1],p):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},p.constrain=function(e){return arguments.length?(a=e,p):a},p.duration=function(e){return arguments.length?(d=+e,p):d},p.interpolate=function(e){return arguments.length?(u=e,p):u},p.on=function(){var e=h.on.apply(h,arguments);return e===h?p:e},p.clickDistance=function(e){return arguments.length?(m=(e=+e)*e,p):Math.sqrt(m)},p.tapDistance=function(e){return arguments.length?(f=+e,p):f},p}().scaleExtent([g,v]).translateExtent(p),n=bl(j.current).call(t),o=wl.translate(f.x,f.y).scale(gE(f.zoom,g,v)),r=[[0,0],[e.width,e.height]],a=t.constrain()(o,r,p);t.transform(n,a),t.wheelDelta(bS),E.setState({d3Zoom:t,d3Selection:n,d3ZoomHandler:n.on("wheel.zoom"),transform:[a.x,a.y,a.k],domNode:j.current.closest(".react-flow")})}}),[]),r.useEffect((()=>{A&&I&&(!i||O||T?void 0!==M&&A.on("wheel.zoom",(function(e,t){if(!y&&"wheel"===e.type&&!e.ctrlKey||xS(e,w))return null;e.preventDefault(),M.call(this,e,t)}),{passive:!1}):A.on("wheel.zoom",(o=>{if(xS(o,w))return!1;o.preventDefault(),o.stopImmediatePropagation();const r=A.property("__zoom").k||1;if(o.ctrlKey&&s){const e=IN(o),t=bS(o),n=r*Math.pow(2,t);return void I.scaleTo(A,n,e,o)}const a=1===o.deltaMode?20:1;let i=c===FE.Vertical?0:o.deltaX*a,d=c===FE.Horizontal?0:o.deltaY*a;!AE()&&o.shiftKey&&c!==FE.Vertical&&(i=o.deltaY*a,d=0),I.translateBy(A,-i/r*l,-d/r*l,{internal:!0});const u=vS(A.property("__zoom")),{onViewportChangeStart:h,onViewportChange:m,onViewportChangeEnd:f}=E.getState();clearTimeout(R.current),P.current||(P.current=!0,null==t||t(o,u),null==h||h(u)),P.current&&(null==e||e(o,u),null==m||m(u),R.current=setTimeout((()=>{null==n||n(o,u),null==f||f(u),P.current=!1}),150))}),{passive:!1}))}),[T,i,c,A,I,M,O,s,y,w,t,e,n]),r.useEffect((()=>{I&&I.on("start",(e=>{var n,o;if(!e.sourceEvent||e.sourceEvent.internal)return null;D.current=null==(n=e.sourceEvent)?void 0:n.button;const{onViewportChangeStart:r}=E.getState(),a=vS(e.transform);C.current=!0,_.current=a,"mousedown"===(null==(o=e.sourceEvent)?void 0:o.type)&&E.setState({paneDragging:!0}),null==r||r(a),null==t||t(e.sourceEvent,a)}))}),[I,t]),r.useEffect((()=>{I&&(T&&!C.current?I.on("zoom",null):T||I.on("zoom",(t=>{var n;const{onViewportChange:r}=E.getState();if(E.setState({transform:[t.transform.x,t.transform.y,t.transform.k]}),S.current=!(!o||!yS(m,D.current??0)),(e||r)&&!(null==(n=t.sourceEvent)?void 0:n.internal)){const n=vS(t.transform);null==r||r(n),null==e||e(t.sourceEvent,n)}})))}),[T,I,e,m,o]),r.useEffect((()=>{I&&I.on("end",(e=>{if(!e.sourceEvent||e.sourceEvent.internal)return null;const{onViewportChangeEnd:t}=E.getState();if(C.current=!1,E.setState({paneDragging:!1}),o&&yS(m,D.current??0)&&!S.current&&o(e.sourceEvent),S.current=!1,(n||t)&&(r=_.current,a=e.transform,r.x!==a.x||r.y!==a.y||r.zoom!==a.k)){const o=vS(e.transform);_.current=o,clearTimeout(N.current),N.current=setTimeout((()=>{null==t||t(o),null==n||n(e.sourceEvent,o)}),i?150:0)}var r,a}))}),[I,i,m,n,o]),r.useEffect((()=>{I&&I.filter((e=>{const t=O||a,n=s&&e.ctrlKey;if((!0===m||Array.isArray(m)&&m.includes(1))&&1===e.button&&"mousedown"===e.type&&(xS(e,"react-flow__node")||xS(e,"react-flow__edge")))return!0;if(!(m||t||i||d||s))return!1;if(T)return!1;if(!d&&"dblclick"===e.type)return!1;if(xS(e,w)&&"wheel"===e.type)return!1;if(xS(e,k)&&("wheel"!==e.type||i&&"wheel"===e.type&&!O))return!1;if(!s&&e.ctrlKey&&"wheel"===e.type)return!1;if(!t&&!i&&!n&&"wheel"===e.type)return!1;if(!m&&("mousedown"===e.type||"touchstart"===e.type))return!1;if(Array.isArray(m)&&!m.includes(e.button)&&"mousedown"===e.type)return!1;const o=Array.isArray(m)&&m.includes(e.button)||!e.button||e.button<=1;return(!e.ctrlKey||"wheel"===e.type)&&o}))}),[T,I,a,s,i,d,m,h,O]),u.createElement("div",{className:"react-flow__renderer",ref:j,style:gS},b)},NS=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function ES(){const{userSelectionActive:e,userSelectionRect:t}=cE(NS,_N);return e&&t?u.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function CS(e,t){const n=t.parentNode||t.parentId,o=e.find((e=>e.id===n));if(o){const e=t.position.x+t.width-o.width,n=t.position.y+t.height-o.height;if(e>0||n>0||t.position.x<0||t.position.y<0){if(o.style={...o.style},o.style.width=o.style.width??o.width,o.style.height=o.style.height??o.height,e>0&&(o.style.width+=e),n>0&&(o.style.height+=n),t.position.x<0){const e=Math.abs(t.position.x);o.position.x=o.position.x-e,o.style.width+=e,t.position.x=0}if(t.position.y<0){const e=Math.abs(t.position.y);o.position.y=o.position.y-e,o.style.height+=e,t.position.y=0}o.width=o.style.width,o.height=o.style.height}}}function SS(e,t){if(e.some((e=>"reset"===e.type)))return e.filter((e=>"reset"===e.type)).map((e=>e.item));const n=e.filter((e=>"add"===e.type)).map((e=>e.item));return t.reduce(((t,n)=>{const o=e.filter((e=>e.id===n.id));if(0===o.length)return t.push(n),t;const r={...n};for(const e of o)if(e)switch(e.type){case"select":r.selected=e.selected;break;case"position":void 0!==e.position&&(r.position=e.position),void 0!==e.positionAbsolute&&(r.positionAbsolute=e.positionAbsolute),void 0!==e.dragging&&(r.dragging=e.dragging),r.expandParent&&CS(t,r);break;case"dimensions":void 0!==e.dimensions&&(r.width=e.dimensions.width,r.height=e.dimensions.height),void 0!==e.updateStyle&&(r.style={...r.style||{},...e.dimensions}),"boolean"==typeof e.resizing&&(r.resizing=e.resizing),r.expandParent&&CS(t,r);break;case"remove":return t}return t.push(r),t}),n)}function jS(e,t){return SS(e,t)}const _S=(e,t)=>({id:e,type:"select",selected:t});function IS(e,t){return e.reduce(((e,n)=>{const o=t.includes(n.id);return!n.selected&&o?(n.selected=!0,e.push(_S(n.id,!0))):n.selected&&!o&&(n.selected=!1,e.push(_S(n.id,!1))),e}),[])}const AS=(e,t)=>n=>{n.target===t.current&&(null==e||e(n))},MS=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),TS=r.memo((({isSelecting:e,selectionMode:t=zE.Full,panOnDrag:n,onSelectionStart:o,onSelectionEnd:a,onPaneClick:s,onPaneContextMenu:i,onPaneScroll:l,onPaneMouseEnter:c,onPaneMouseMove:d,onPaneMouseLeave:h,children:m})=>{const f=r.useRef(null),p=dE(),g=r.useRef(0),v=r.useRef(0),x=r.useRef(),{userSelectionActive:y,elementsSelectable:b,dragging:w}=cE(MS,_N),k=()=>{p.setState({userSelectionActive:!1,userSelectionRect:null}),g.current=0,v.current=0},N=e=>{null==s||s(e),p.getState().resetSelectedElements(),p.setState({nodesSelectionActive:!1})},E=l?e=>l(e):void 0,C=b&&(e||y);return u.createElement("div",{className:kN(["react-flow__pane",{dragging:w,selection:e}]),onClick:C?void 0:AS(N,f),onContextMenu:AS((e=>{Array.isArray(n)&&(null==n?void 0:n.includes(2))?e.preventDefault():null==i||i(e)}),f),onWheel:AS(E,f),onMouseEnter:C?void 0:c,onMouseDown:C?t=>{const{resetSelectedElements:n,domNode:r}=p.getState();if(x.current=null==r?void 0:r.getBoundingClientRect(),!b||!e||0!==t.button||t.target!==f.current||!x.current)return;const{x:a,y:s}=IE(t,x.current);n(),p.setState({userSelectionRect:{width:0,height:0,startX:a,startY:s,x:a,y:s}}),null==o||o(t)}:void 0,onMouseMove:C?n=>{const{userSelectionRect:o,nodeInternals:r,edges:a,transform:s,onNodesChange:i,onEdgesChange:l,nodeOrigin:c,getNodes:d}=p.getState();if(!e||!x.current||!o)return;p.setState({userSelectionActive:!0,nodesSelectionActive:!1});const u=IE(n,x.current),h=o.startX??0,m=o.startY??0,f={...o,x:u.x<h?u.x:h,y:u.y<m?u.y:m,width:Math.abs(u.x-h),height:Math.abs(u.y-m)},y=d(),b=pC(r,f,s,t===zE.Partial,!0,c),w=gC(b,a).map((e=>e.id)),k=b.map((e=>e.id));if(g.current!==k.length){g.current=k.length;const e=IS(y,k);e.length&&(null==i||i(e))}if(v.current!==w.length){v.current=w.length;const e=IS(a,w);e.length&&(null==l||l(e))}p.setState({userSelectionRect:f})}:d,onMouseUp:C?e=>{if(0!==e.button)return;const{userSelectionRect:t}=p.getState();!y&&t&&e.target===f.current&&(null==N||N(e)),p.setState({nodesSelectionActive:g.current>0}),k(),null==a||a(e)}:void 0,onMouseLeave:C?e=>{y&&(p.setState({nodesSelectionActive:g.current>0}),null==a||a(e)),k()}:h,ref:f,style:gS},m,u.createElement(ES,null))}));function OS(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const o=t.get(n);return!!o&&(!!o.selected||OS(o,t))}function DS(e,t,n){let o=e;do{if(null==o?void 0:o.matches(t))return!0;if(o===n.current)return!1;o=o.parentElement}while(o);return!1}function PS(e,t,n,o){return Array.from(e.values()).filter((n=>(n.selected||n.id===o)&&(!n.parentNode||n.parentId||!OS(n,e))&&(n.draggable||t&&void 0===n.draggable))).map((e=>{var t,o;return{id:e.id,position:e.position||{x:0,y:0},positionAbsolute:e.positionAbsolute||{x:0,y:0},distance:{x:n.x-((null==(t=e.positionAbsolute)?void 0:t.x)??0),y:n.y-((null==(o=e.positionAbsolute)?void 0:o.y)??0)},delta:{x:0,y:0},extent:e.extent,parentNode:e.parentNode||e.parentId,parentId:e.parentNode||e.parentId,width:e.width,height:e.height,expandParent:e.expandParent}}))}function RS(e,t,n,o,r=[0,0],a){const s=function(e,t){return t&&"parent"!==t?[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]:t}(e,e.extent||o);let i=s;const l=e.parentNode||e.parentId;if("parent"!==e.extent||e.expandParent){if(e.extent&&l&&"parent"!==e.extent){const t=n.get(l),{x:o,y:a}=mC(t,r).positionAbsolute;i=[[e.extent[0][0]+o,e.extent[0][1]+a],[e.extent[1][0]+o,e.extent[1][1]+a]]}}else if(l&&e.width&&e.height){const t=n.get(l),{x:o,y:a}=mC(t,r).positionAbsolute;i=t&&EE(o)&&EE(a)&&EE(t.width)&&EE(t.height)?[[o+e.width*r[0],a+e.height*r[1]],[o+t.width-e.width+e.width*r[0],a+t.height-e.height+e.height*r[1]]]:i}else null==a||a("005",nE()),i=s;let c={x:0,y:0};if(l){const e=n.get(l);c=mC(e,r).positionAbsolute}const d=i&&"parent"!==i?vE(t,i):t;return{position:{x:d.x-c.x,y:d.y-c.y},positionAbsolute:d}}function FS({nodeId:e,dragItems:t,nodeInternals:n}){const o=t.map((e=>({...n.get(e.id),position:e.position,positionAbsolute:e.positionAbsolute})));return[e?o.find((t=>t.id===e)):o[0],o]}TS.displayName="Pane";const LS=(e,t,n,o)=>{const r=t.querySelectorAll(e);if(!r||!r.length)return null;const a=Array.from(r),s=t.getBoundingClientRect(),i=s.width*o[0],l=s.height*o[1];return a.map((e=>{const t=e.getBoundingClientRect();return{id:e.getAttribute("data-handleid"),position:e.getAttribute("data-handlepos"),x:(t.left-s.left-i)/n,y:(t.top-s.top-l)/n,...pE(e)}}))};function zS(e,t,n){return void 0===n?n:o=>{const r=t().nodeInternals.get(e);r&&n(o,{...r})}}function BS({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:a,multiSelectionActive:s,nodeInternals:i,onError:l}=t.getState(),c=i.get(e);c?(t.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&s)&&(a({nodes:[c],edges:[]}),requestAnimationFrame((()=>{var e;return null==(e=null==o?void 0:o.current)?void 0:e.blur()}))):r([e])):null==l||l("012",iE(e))}function US(e){return(t,n,o)=>null==e?void 0:e(t,o)}function VS({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:o,nodeId:a,isSelectable:s,selectNodesOnDrag:i}){const l=dE(),[c,d]=r.useState(!1),u=r.useRef([]),h=r.useRef({x:null,y:null}),m=r.useRef(0),f=r.useRef(null),p=r.useRef({x:0,y:0}),g=r.useRef(null),v=r.useRef(!1),x=r.useRef(!1),y=r.useRef(!1),b=function(){const e=dE();return r.useCallback((({sourceEvent:t})=>{const{transform:n,snapGrid:o,snapToGrid:r}=e.getState(),a=t.touches?t.touches[0].clientX:t.clientX,s=t.touches?t.touches[0].clientY:t.clientY,i={x:(a-n[0])/n[2],y:(s-n[1])/n[2]};return{xSnapped:r?o[0]*Math.round(i.x/o[0]):i.x,ySnapped:r?o[1]*Math.round(i.y/o[1]):i.y,...i}}),[])}();return r.useEffect((()=>{if(null==e?void 0:e.current){const r=bl(e.current),c=({x:e,y:t})=>{const{nodeInternals:n,onNodeDrag:o,onSelectionDrag:r,updateNodePositions:s,nodeExtent:i,snapGrid:c,snapToGrid:m,nodeOrigin:f,onError:p}=l.getState();h.current={x:e,y:t};let v=!1,x={x:0,y:0,x2:0,y2:0};if(u.current.length>1&&i){const e=fC(u.current,f);x=wE(e)}if(u.current=u.current.map((o=>{const r={x:e-o.distance.x,y:t-o.distance.y};m&&(r.x=c[0]*Math.round(r.x/c[0]),r.y=c[1]*Math.round(r.y/c[1]));const a=[[i[0][0],i[0][1]],[i[1][0],i[1][1]]];u.current.length>1&&i&&!o.extent&&(a[0][0]=o.positionAbsolute.x-x.x+i[0][0],a[1][0]=o.positionAbsolute.x+(o.width??0)-x.x2+i[1][0],a[0][1]=o.positionAbsolute.y-x.y+i[0][1],a[1][1]=o.positionAbsolute.y+(o.height??0)-x.y2+i[1][1]);const s=RS(o,r,n,a,f,p);return v=v||o.position.x!==s.position.x||o.position.y!==s.position.y,o.position=s.position,o.positionAbsolute=s.positionAbsolute,o})),!v)return;s(u.current,!0,!0),d(!0);const y=a?o:US(r);if(y&&g.current){const[e,t]=FS({nodeId:a,dragItems:u.current,nodeInternals:n});y(g.current,e,t)}},w=()=>{if(!f.current)return;const[e,t]=yE(p.current,f.current);if(0!==e||0!==t){const{transform:n,panBy:o}=l.getState();h.current.x=(h.current.x??0)-e/n[2],h.current.y=(h.current.y??0)-t/n[2],o({x:e,y:t})&&c(h.current)}m.current=requestAnimationFrame(w)},k=t=>{var n;const{nodeInternals:o,multiSelectionActive:r,nodesDraggable:c,unselectNodesAndEdges:d,onNodeDragStart:m,onSelectionDragStart:f}=l.getState();x.current=!0;const p=a?m:US(f);i&&s||r||!a||(null==(n=o.get(a))?void 0:n.selected)||d(),a&&s&&i&&BS({id:a,store:l,nodeRef:e});const g=b(t);if(h.current=g,u.current=PS(o,c,g,a),p&&u.current){const[e,n]=FS({nodeId:a,dragItems:u.current,nodeInternals:o});p(t.sourceEvent,e,n)}};if(!t){const t=function(){var e,t,n,o,r=LN,a=zN,s=BN,i=UN,l={},c=El("start","drag","end"),d=0,u=0;function h(e){e.on("mousedown.drag",m).filter(i).on("touchstart.drag",g).on("touchmove.drag",v,AN).on("touchend.drag touchcancel.drag",x).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(s,i){if(!o&&r.call(this,s,i)){var l=y(this,a.call(this,s,i),s,i,"mouse");l&&(bl(s.view).on("mousemove.drag",f,MN).on("mouseup.drag",p,MN),DN(s.view),TN(s),n=!1,e=s.clientX,t=s.clientY,l("start",s))}}function f(o){if(ON(o),!n){var r=o.clientX-e,a=o.clientY-t;n=r*r+a*a>u}l.mouse("drag",o)}function p(e){bl(e.view).on("mousemove.drag mouseup.drag",null),PN(e.view,n),ON(e),l.mouse("end",e)}function g(e,t){if(r.call(this,e,t)){var n,o,s=e.changedTouches,i=a.call(this,e,t),l=s.length;for(n=0;n<l;++n)(o=y(this,i,e,t,s[n].identifier,s[n]))&&(TN(e),o("start",e,s[n]))}}function v(e){var t,n,o=e.changedTouches,r=o.length;for(t=0;t<r;++t)(n=l[o[t].identifier])&&(ON(e),n("drag",e,o[t]))}function x(e){var t,n,r=e.changedTouches,a=r.length;for(o&&clearTimeout(o),o=setTimeout((function(){o=null}),500),t=0;t<a;++t)(n=l[r[t].identifier])&&(TN(e),n("end",e,r[t]))}function y(e,t,n,o,r,a){var i,u,m,f=c.copy(),p=IN(a||n,t);if(null!=(m=s.call(e,new FN("beforestart",{sourceEvent:n,target:h,identifier:r,active:d,x:p[0],y:p[1],dx:0,dy:0,dispatch:f}),o)))return i=m.x-p[0]||0,u=m.y-p[1]||0,function n(a,s,c){var g,v=p;switch(a){case"start":l[r]=n,g=d++;break;case"end":delete l[r],--d;case"drag":p=IN(c||s,t),g=d}f.call(a,e,new FN(a,{sourceEvent:s,subject:m,target:h,identifier:r,active:g,x:p[0]+i,y:p[1]+u,dx:p[0]-v[0],dy:p[1]-v[1],dispatch:f}),o)}}return h.filter=function(e){return arguments.length?(r="function"==typeof e?e:RN(!!e),h):r},h.container=function(e){return arguments.length?(a="function"==typeof e?e:RN(e),h):a},h.subject=function(e){return arguments.length?(s="function"==typeof e?e:RN(e),h):s},h.touchable=function(e){return arguments.length?(i="function"==typeof e?e:RN(!!e),h):i},h.on=function(){var e=c.on.apply(c,arguments);return e===c?h:e},h.clickDistance=function(e){return arguments.length?(u=(e=+e)*e,h):Math.sqrt(u)},h}().on("start",(e=>{const{domNode:t,nodeDragThreshold:n}=l.getState();0===n&&k(e),y.current=!1;const o=b(e);h.current=o,f.current=(null==t?void 0:t.getBoundingClientRect())||null,p.current=IE(e.sourceEvent,f.current)})).on("drag",(e=>{var t,n;const o=b(e),{autoPanOnNodeDrag:r,nodeDragThreshold:a}=l.getState();if("touchmove"===e.sourceEvent.type&&e.sourceEvent.touches.length>1&&(y.current=!0),!y.current){if(!v.current&&x.current&&r&&(v.current=!0,w()),!x.current){const r=o.xSnapped-((null==(t=null==h?void 0:h.current)?void 0:t.x)??0),s=o.ySnapped-((null==(n=null==h?void 0:h.current)?void 0:n.y)??0);Math.sqrt(r*r+s*s)>a&&k(e)}(h.current.x!==o.xSnapped||h.current.y!==o.ySnapped)&&u.current&&x.current&&(g.current=e.sourceEvent,p.current=IE(e.sourceEvent,f.current),c(o))}})).on("end",(e=>{if(x.current&&!y.current&&(d(!1),v.current=!1,x.current=!1,cancelAnimationFrame(m.current),u.current)){const{updateNodePositions:t,nodeInternals:n,onNodeDragStop:o,onSelectionDragStop:r}=l.getState(),s=a?o:US(r);if(t(u.current,!1,!1),s){const[t,o]=FS({nodeId:a,dragItems:u.current,nodeInternals:n});s(e.sourceEvent,t,o)}}})).filter((t=>{const r=t.target;return!t.button&&(!n||!DS(r,`.${n}`,e))&&(!o||DS(r,o,e))}));return r.call(t),()=>{r.on(".drag",null)}}r.on(".drag",null)}}),[e,t,n,o,s,l,a,i,b]),c}function $S(){const e=dE();return r.useCallback((t=>{const{nodeInternals:n,nodeExtent:o,updateNodePositions:r,getNodes:a,snapToGrid:s,snapGrid:i,onError:l,nodesDraggable:c}=e.getState(),d=a().filter((e=>e.selected&&(e.draggable||c&&void 0===e.draggable))),u=s?i[0]:5,h=s?i[1]:5,m=t.isShiftPressed?4:1,f=t.x*u*m,p=t.y*h*m;r(d.map((e=>{if(e.positionAbsolute){const t={x:e.positionAbsolute.x+f,y:e.positionAbsolute.y+p};s&&(t.x=i[0]*Math.round(t.x/i[0]),t.y=i[1]*Math.round(t.y/i[1]));const{positionAbsolute:r,position:a}=RS(e,t,n,o,void 0,l);e.position=a,e.positionAbsolute=r}return e})),!0,!1)}),[])}const GS={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var HS=e=>{const t=({id:t,type:n,data:o,xPos:a,yPos:s,xPosOrigin:i,yPosOrigin:l,selected:c,onClick:d,onMouseEnter:h,onMouseMove:m,onMouseLeave:f,onContextMenu:p,onDoubleClick:g,style:v,className:x,isDraggable:y,isSelectable:b,isConnectable:w,isFocusable:k,selectNodesOnDrag:N,sourcePosition:E,targetPosition:C,hidden:S,resizeObserver:j,dragHandle:_,zIndex:I,isParent:A,noDragClassName:M,noPanClassName:T,initialized:O,disableKeyboardA11y:D,ariaLabel:P,rfId:R,hasHandleBounds:F})=>{const L=dE(),z=r.useRef(null),B=r.useRef(null),U=r.useRef(E),V=r.useRef(C),$=r.useRef(n),G=b||y||d||h||m||f,H=$S(),W=zS(t,L.getState,h),q=zS(t,L.getState,m),Y=zS(t,L.getState,f),K=zS(t,L.getState,p),J=zS(t,L.getState,g);r.useEffect((()=>()=>{B.current&&(null==j||j.unobserve(B.current),B.current=null)}),[]),r.useEffect((()=>{if(z.current&&!S){const e=z.current;O&&F&&B.current===e||(B.current&&(null==j||j.unobserve(B.current)),null==j||j.observe(e),B.current=e)}}),[S,O,F]),r.useEffect((()=>{const e=$.current!==n,o=U.current!==E,r=V.current!==C;z.current&&(e||o||r)&&(e&&($.current=n),o&&(U.current=E),r&&(V.current=C),L.getState().updateNodeDimensions([{id:t,nodeElement:z.current,forceUpdate:!0}]))}),[t,n,E,C]);const X=VS({nodeRef:z,disabled:S||!y,noDragClassName:M,handleSelector:_,nodeId:t,isSelectable:b,selectNodesOnDrag:N});return S?null:u.createElement("div",{className:kN(["react-flow__node",`react-flow__node-${n}`,{[T]:y},x,{selected:c,selectable:b,parent:A,dragging:X}]),ref:z,style:{zIndex:I,transform:`translate(${i}px,${l}px)`,pointerEvents:G?"all":"none",visibility:O?"visible":"hidden",...v},"data-id":t,"data-testid":`rf__node-${t}`,onMouseEnter:W,onMouseMove:q,onMouseLeave:Y,onContextMenu:K,onClick:e=>{const{nodeDragThreshold:n}=L.getState();if(b&&(!N||!y||n>0)&&BS({id:t,store:L,nodeRef:z}),d){const n=L.getState().nodeInternals.get(t);n&&d(e,{...n})}},onDoubleClick:J,onKeyDown:k?e=>{if(!jE(e)&&!D)if(SE.includes(e.key)&&b){const n="Escape"===e.key;BS({id:t,store:L,unselect:n,nodeRef:z})}else y&&c&&Object.prototype.hasOwnProperty.call(GS,e.key)&&(L.setState({ariaLiveMessage:`Moved selected node ${e.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~a}, y: ${~~s}`}),H({x:GS[e.key].x,y:GS[e.key].y,isShiftPressed:e.shiftKey}))}:void 0,tabIndex:k?0:void 0,role:k?"button":void 0,"aria-describedby":D?void 0:`${JC}-${R}`,"aria-label":P},u.createElement(lC,{value:t},u.createElement(e,{id:t,data:o,type:n,xPos:a,yPos:s,selected:c,isConnectable:w,sourcePosition:E,targetPosition:C,dragging:X,dragHandle:_,zIndex:I})))};return t.displayName="NodeWrapper",r.memo(t)};const WS=e=>{const t=e.getNodes().filter((e=>e.selected));return{...fC(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};var qS=r.memo((function({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const o=dE(),{width:a,height:s,x:i,y:l,transformString:c,userSelectionActive:d}=cE(WS,_N),h=$S(),m=r.useRef(null);if(r.useEffect((()=>{var e;n||null==(e=m.current)||e.focus({preventScroll:!0})}),[n]),VS({nodeRef:m}),d||!a||!s)return null;const f=e?t=>{const n=o.getState().getNodes().filter((e=>e.selected));e(t,n)}:void 0;return u.createElement("div",{className:kN(["react-flow__nodesselection","react-flow__container",t]),style:{transform:c}},u.createElement("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(GS,e.key)&&h({x:GS[e.key].x,y:GS[e.key].y,isShiftPressed:e.shiftKey})},style:{width:a,height:s,top:l,left:i}}))}));const YS=e=>e.nodesSelectionActive,KS=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:a,onPaneContextMenu:s,onPaneScroll:i,deleteKeyCode:l,onMove:c,onMoveStart:d,onMoveEnd:h,selectionKeyCode:m,selectionOnDrag:f,selectionMode:p,onSelectionStart:g,onSelectionEnd:v,multiSelectionKeyCode:x,panActivationKeyCode:y,zoomActivationKeyCode:b,elementsSelectable:w,zoomOnScroll:k,zoomOnPinch:N,panOnScroll:E,panOnScrollSpeed:C,panOnScrollMode:S,zoomOnDoubleClick:j,panOnDrag:_,defaultViewport:I,translateExtent:A,minZoom:M,maxZoom:T,preventScrolling:O,onSelectionContextMenu:D,noWheelClassName:P,noPanClassName:R,disableKeyboardA11y:F})=>{const L=cE(YS),z=tS(m),B=tS(y),U=B||_,V=B||E,$=z||f&&!0!==U;return(({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=dE(),{deleteElements:o}=fS(),a=tS(e,pS),s=tS(t);r.useEffect((()=>{if(a){const{edges:e,getNodes:t}=n.getState(),r=t().filter((e=>e.selected)),a=e.filter((e=>e.selected));o({nodes:r,edges:a}),n.setState({nodesSelectionActive:!1})}}),[a]),r.useEffect((()=>{n.setState({multiSelectionActive:s})}),[s])})({deleteKeyCode:l,multiSelectionKeyCode:x}),u.createElement(kS,{onMove:c,onMoveStart:d,onMoveEnd:h,onPaneContextMenu:s,elementsSelectable:w,zoomOnScroll:k,zoomOnPinch:N,panOnScroll:V,panOnScrollSpeed:C,panOnScrollMode:S,zoomOnDoubleClick:j,panOnDrag:!z&&U,defaultViewport:I,translateExtent:A,minZoom:M,maxZoom:T,zoomActivationKeyCode:b,preventScrolling:O,noWheelClassName:P,noPanClassName:R},u.createElement(TS,{onSelectionStart:g,onSelectionEnd:v,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:a,onPaneContextMenu:s,onPaneScroll:i,panOnDrag:U,isSelecting:!!$,selectionMode:p},e,L&&u.createElement(qS,{onSelectionContextMenu:D,noPanClassName:R,disableKeyboardA11y:F})))};KS.displayName="FlowRenderer";var JS=r.memo(KS);function XS(e){return{...{input:HS(e.input||DC),default:HS(e.default||TC),output:HS(e.output||RC),group:HS(e.group||FC)},...Object.keys(e).filter((e=>!["input","default","output","group"].includes(e))).reduce(((t,n)=>(t[n]=HS(e[n]||TC),t)),{})}}const ZS=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),QS=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:o,elementsSelectable:a,updateNodeDimensions:s,onError:i}=cE(ZS,_N),l=(c=e.onlyRenderVisibleElements,cE(r.useCallback((e=>c?pC(e.nodeInternals,{x:0,y:0,width:e.width,height:e.height},e.transform,!0):e.getNodes()),[c])));var c;const d=r.useRef(),h=r.useMemo((()=>{if("undefined"==typeof ResizeObserver)return null;const e=new ResizeObserver((e=>{const t=e.map((e=>({id:e.target.getAttribute("data-id"),nodeElement:e.target,forceUpdate:!0})));s(t)}));return d.current=e,e}),[]);return r.useEffect((()=>()=>{var e;null==(e=null==d?void 0:d.current)||e.disconnect()}),[]),u.createElement("div",{className:"react-flow__nodes",style:gS},l.map((r=>{var s,l,c;let d=r.type||"default";e.nodeTypes[d]||(null==i||i("003",eE(d)),d="default");const m=e.nodeTypes[d]||e.nodeTypes.default,f=!!(r.draggable||t&&void 0===r.draggable),p=!!(r.selectable||a&&void 0===r.selectable),g=!!(r.connectable||n&&void 0===r.connectable),v=!!(r.focusable||o&&void 0===r.focusable),x=e.nodeExtent?vE(r.positionAbsolute,e.nodeExtent):r.positionAbsolute,y=(null==x?void 0:x.x)??0,b=(null==x?void 0:x.y)??0,w=(({x:e,y:t,width:n,height:o,origin:r})=>n&&o?r[0]<0||r[1]<0||r[0]>1||r[1]>1?{x:e,y:t}:{x:e-n*r[0],y:t-o*r[1]}:{x:e,y:t})({x:y,y:b,width:r.width??0,height:r.height??0,origin:e.nodeOrigin});return u.createElement(m,{key:r.id,id:r.id,className:r.className,style:r.style,type:d,data:r.data,sourcePosition:r.sourcePosition||HE.Bottom,targetPosition:r.targetPosition||HE.Top,hidden:r.hidden,xPos:y,yPos:b,xPosOrigin:w.x,yPosOrigin:w.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!r.selected,isDraggable:f,isSelectable:p,isConnectable:g,isFocusable:v,resizeObserver:h,dragHandle:r.dragHandle,zIndex:(null==(s=r[CE])?void 0:s.z)??0,isParent:!!(null==(l=r[CE])?void 0:l.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!r.width&&!!r.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:r.ariaLabel,hasHandleBounds:!!(null==(c=r[CE])?void 0:c.handleBounds)})})))};QS.displayName="NodeRenderer";var ej=r.memo(QS);const tj=(e,t,n)=>n===HE.Left?e-t:n===HE.Right?e+t:e,nj=(e,t,n)=>n===HE.Top?e-t:n===HE.Bottom?e+t:e,oj="react-flow__edgeupdater",rj=({position:e,centerX:t,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:a,onMouseOut:s,type:i})=>u.createElement("circle",{onMouseDown:r,onMouseEnter:a,onMouseOut:s,className:kN([oj,`${oj}-${i}`]),cx:tj(t,o,e),cy:nj(n,o,e),r:o,stroke:"transparent",fill:"transparent"}),aj=()=>!0;var sj=e=>{const t=({id:t,className:n,type:o,data:a,onClick:s,onEdgeDoubleClick:i,selected:l,animated:c,label:d,labelStyle:h,labelShowBg:m,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:g,style:v,source:x,target:y,sourceX:b,sourceY:w,targetX:k,targetY:N,sourcePosition:E,targetPosition:C,elementsSelectable:S,hidden:j,sourceHandleId:_,targetHandleId:I,onContextMenu:A,onMouseEnter:M,onMouseMove:T,onMouseLeave:O,reconnectRadius:D,onReconnect:P,onReconnectStart:R,onReconnectEnd:F,markerEnd:L,markerStart:z,rfId:B,ariaLabel:U,isFocusable:V,isReconnectable:$,pathOptions:G,interactionWidth:H,disableKeyboardA11y:W})=>{const q=r.useRef(null),[Y,K]=r.useState(!1),[J,X]=r.useState(!1),Z=dE(),Q=r.useMemo((()=>`url('#${dC(z,B)}')`),[z,B]),ee=r.useMemo((()=>`url('#${dC(L,B)}')`),[L,B]);if(j)return null;const te=TE(t,Z.getState,i),ne=TE(t,Z.getState,A),oe=TE(t,Z.getState,M),re=TE(t,Z.getState,T),ae=TE(t,Z.getState,O),se=(e,n)=>{if(0!==e.button)return;const{edges:o,isValidConnection:r}=Z.getState(),a=n?y:x,s=(n?I:_)||null,i=n?"target":"source",l=r||aj,c=n,d=o.find((e=>e.id===t));X(!0),null==R||R(e,d,i);SC({event:e,handleId:s,nodeId:a,onConnect:e=>null==P?void 0:P(d,e),isTarget:c,getState:Z.getState,setState:Z.setState,isValidConnection:l,edgeUpdaterType:i,onReconnectEnd:e=>{X(!1),null==F||F(e,d,i)}})},ie=()=>K(!0),le=()=>K(!1),ce=!S&&!s;return u.createElement("g",{className:kN(["react-flow__edge",`react-flow__edge-${o}`,n,{selected:l,animated:c,inactive:ce,updating:Y}]),onClick:e=>{var n;const{edges:o,addSelectedEdges:r,unselectNodesAndEdges:a,multiSelectionActive:i}=Z.getState(),l=o.find((e=>e.id===t));l&&(S&&(Z.setState({nodesSelectionActive:!1}),l.selected&&i?(a({nodes:[],edges:[l]}),null==(n=q.current)||n.blur()):r([t])),s&&s(e,l))},onDoubleClick:te,onContextMenu:ne,onMouseEnter:oe,onMouseMove:re,onMouseLeave:ae,onKeyDown:V?e=>{var n;if(!W&&SE.includes(e.key)&&S){const{unselectNodesAndEdges:o,addSelectedEdges:r,edges:a}=Z.getState();"Escape"===e.key?(null==(n=q.current)||n.blur(),o({edges:[a.find((e=>e.id===t))]})):r([t])}}:void 0,tabIndex:V?0:void 0,role:V?"button":"img","data-testid":`rf__edge-${t}`,"aria-label":null===U?void 0:U||`Edge from ${x} to ${y}`,"aria-describedby":V?`${XC}-${B}`:void 0,ref:q},!J&&u.createElement(e,{id:t,source:x,target:y,selected:l,animated:c,label:d,labelStyle:h,labelShowBg:m,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:g,data:a,style:v,sourceX:b,sourceY:w,targetX:k,targetY:N,sourcePosition:E,targetPosition:C,sourceHandleId:_,targetHandleId:I,markerStart:Q,markerEnd:ee,pathOptions:G,interactionWidth:H}),$&&u.createElement(u.Fragment,null,("source"===$||!0===$)&&u.createElement(rj,{position:E,centerX:b,centerY:w,radius:D,onMouseDown:e=>se(e,!0),onMouseEnter:ie,onMouseOut:le,type:"source"}),("target"===$||!0===$)&&u.createElement(rj,{position:C,centerX:k,centerY:N,radius:D,onMouseDown:e=>se(e,!1),onMouseEnter:ie,onMouseOut:le,type:"target"})))};return t.displayName="EdgeWrapper",r.memo(t)};function ij(e){return{...{default:sj(e.default||sC),straight:sj(e.bezier||nC),step:sj(e.step||tC),smoothstep:sj(e.step||eC),simplebezier:sj(e.simplebezier||KE)},...Object.keys(e).filter((e=>!["default","bezier"].includes(e))).reduce(((t,n)=>(t[n]=sj(e[n]||sC),t)),{})}}function lj(e,t,n=null){const o=((null==n?void 0:n.x)||0)+t.x,r=((null==n?void 0:n.y)||0)+t.y,a=(null==n?void 0:n.width)||t.width,s=(null==n?void 0:n.height)||t.height;switch(e){case HE.Top:return{x:o+a/2,y:r};case HE.Right:return{x:o+a,y:r+s/2};case HE.Bottom:return{x:o+a/2,y:r+s};case HE.Left:return{x:o,y:r+s/2}}}function cj(e,t){return e?1!==e.length&&t?t&&e.find((e=>e.id===t))||null:e[0]:null}function dj(e){var t,n,o,r,a;const s=(null==(t=null==e?void 0:e[CE])?void 0:t.handleBounds)||null,i=s&&(null==e?void 0:e.width)&&(null==e?void 0:e.height)&&void 0!==(null==(n=null==e?void 0:e.positionAbsolute)?void 0:n.x)&&void 0!==(null==(o=null==e?void 0:e.positionAbsolute)?void 0:o.y);return[{x:(null==(r=null==e?void 0:e.positionAbsolute)?void 0:r.x)||0,y:(null==(a=null==e?void 0:e.positionAbsolute)?void 0:a.y)||0,width:(null==e?void 0:e.width)||0,height:(null==e?void 0:e.height)||0},s,!!i]}const uj=[{level:0,isMaxLevel:!0,edges:[]}];function hj(e,t,n){return function(e,t,n=!1){let o=-1;const r=e.reduce(((e,r)=>{var a,s;const i=EE(r.zIndex);let l=i?r.zIndex:0;if(n){const e=t.get(r.target),n=t.get(r.source),o=r.selected||(null==e?void 0:e.selected)||(null==n?void 0:n.selected),c=Math.max((null==(a=null==n?void 0:n[CE])?void 0:a.z)||0,(null==(s=null==e?void 0:e[CE])?void 0:s.z)||0,1e3);l=(i?r.zIndex:0)+(o?c:0)}return e[l]?e[l].push(r):e[l]=[r],o=l>o?l:o,e}),{}),a=Object.entries(r).map((([e,t])=>{const n=+e;return{edges:t,level:n,isMaxLevel:n===o}}));return 0===a.length?uj:a}(cE(r.useCallback((n=>e?n.edges.filter((e=>{const o=t.get(e.source),r=t.get(e.target);return(null==o?void 0:o.width)&&(null==o?void 0:o.height)&&(null==r?void 0:r.width)&&(null==r?void 0:r.height)&&function({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:o,targetWidth:r,targetHeight:a,width:s,height:i,transform:l}){const c={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+r),y2:Math.max(e.y+o,t.y+a)};c.x===c.x2&&(c.x2+=1),c.y===c.y2&&(c.y2+=1);const d=wE({x:(0-l[0])/l[2],y:(0-l[1])/l[2],width:s/l[2],height:i/l[2]}),u=Math.max(0,Math.min(d.x2,c.x2)-Math.max(d.x,c.x)),h=Math.max(0,Math.min(d.y2,c.y2)-Math.max(d.y,c.y));return Math.ceil(u*h)>0}({sourcePos:o.positionAbsolute||{x:0,y:0},targetPos:r.positionAbsolute||{x:0,y:0},sourceWidth:o.width,sourceHeight:o.height,targetWidth:r.width,targetHeight:r.height,width:n.width,height:n.height,transform:n.transform})})):n.edges),[e,t])),t,n)}const mj={[$E.Arrow]:({color:e="none",strokeWidth:t=1})=>u.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),[$E.ArrowClosed]:({color:e="none",strokeWidth:t=1})=>u.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})};const fj=({id:e,type:t,color:n,width:o=12.5,height:a=12.5,markerUnits:s="strokeWidth",strokeWidth:i,orient:l="auto-start-reverse"})=>{const c=function(e){const t=dE();return r.useMemo((()=>{var n,o;return Object.prototype.hasOwnProperty.call(mj,e)?mj[e]:(null==(o=(n=t.getState()).onError)||o.call(n,"009",oE(e)),null)}),[e])}(t);return c?u.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${o}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:l,refX:"0",refY:"0"},u.createElement(c,{color:n,strokeWidth:i})):null},pj=({defaultColor:e,rfId:t})=>{const n=cE(r.useCallback((({defaultColor:e,rfId:t})=>n=>{const o=[];return n.edges.reduce(((n,r)=>([r.markerStart,r.markerEnd].forEach((r=>{if(r&&"object"==typeof r){const a=dC(r,t);o.includes(a)||(n.push({id:a,color:r.color||e,...r}),o.push(a))}})),n)),[]).sort(((e,t)=>e.id.localeCompare(t.id)))})({defaultColor:e,rfId:t}),[e,t]),((e,t)=>!(e.length!==t.length||e.some(((e,n)=>e.id!==t[n].id)))));return u.createElement("defs",null,n.map((e=>u.createElement(fj,{id:e.id,key:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient}))))};pj.displayName="MarkerDefinitions";var gj=r.memo(pj);const vj=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),xj=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:o,edgeTypes:r,noPanClassName:a,onEdgeContextMenu:s,onEdgeMouseEnter:i,onEdgeMouseMove:l,onEdgeMouseLeave:c,onEdgeClick:d,onEdgeDoubleClick:h,onReconnect:m,onReconnectStart:f,onReconnectEnd:p,reconnectRadius:g,children:v,disableKeyboardA11y:x})=>{const{edgesFocusable:y,edgesUpdatable:b,elementsSelectable:w,width:k,height:N,connectionMode:E,nodeInternals:C,onError:S}=cE(vj,_N),j=hj(t,C,n);return k?u.createElement(u.Fragment,null,j.map((({level:t,edges:n,isMaxLevel:v})=>u.createElement("svg",{key:t,style:{zIndex:t},width:k,height:N,className:"react-flow__edges react-flow__container"},v&&u.createElement(gj,{defaultColor:e,rfId:o}),u.createElement("g",null,n.map((e=>{const[t,n,v]=dj(C.get(e.source)),[k,N,j]=dj(C.get(e.target));if(!v||!j)return null;let _=e.type||"default";r[_]||(null==S||S("011",sE(_)),_="default");const I=r[_]||r.default,A=E===PE.Strict?N.target:(N.target??[]).concat(N.source??[]),M=cj(n.source,e.sourceHandle),T=cj(A,e.targetHandle),O=(null==M?void 0:M.position)||HE.Bottom,D=(null==T?void 0:T.position)||HE.Top,P=!!(e.focusable||y&&void 0===e.focusable),R=e.reconnectable||e.updatable,F=void 0!==m&&(R||b&&void 0===R);if(!M||!T)return null==S||S("008",rE(M,e)),null;const{sourceX:L,sourceY:z,targetX:B,targetY:U}=((e,t,n,o,r,a)=>{const s=lj(n,e,t),i=lj(a,o,r);return{sourceX:s.x,sourceY:s.y,targetX:i.x,targetY:i.y}})(t,M,O,k,T,D);return u.createElement(I,{key:e.id,id:e.id,className:kN([e.className,a]),type:_,data:e.data,selected:!!e.selected,animated:!!e.animated,hidden:!!e.hidden,label:e.label,labelStyle:e.labelStyle,labelShowBg:e.labelShowBg,labelBgStyle:e.labelBgStyle,labelBgPadding:e.labelBgPadding,labelBgBorderRadius:e.labelBgBorderRadius,style:e.style,source:e.source,target:e.target,sourceHandleId:e.sourceHandle,targetHandleId:e.targetHandle,markerEnd:e.markerEnd,markerStart:e.markerStart,sourceX:L,sourceY:z,targetX:B,targetY:U,sourcePosition:O,targetPosition:D,elementsSelectable:w,onContextMenu:s,onMouseEnter:i,onMouseMove:l,onMouseLeave:c,onClick:d,onEdgeDoubleClick:h,onReconnect:m,onReconnectStart:f,onReconnectEnd:p,reconnectRadius:g,rfId:o,ariaLabel:e.ariaLabel,isFocusable:P,isReconnectable:F,pathOptions:"pathOptions"in e?e.pathOptions:void 0,interactionWidth:e.interactionWidth,disableKeyboardA11y:x})})))))),v):null};xj.displayName="EdgeRenderer";var yj=r.memo(xj);const bj=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function wj({children:e}){const t=cE(bj);return u.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}const kj={[HE.Left]:HE.Right,[HE.Right]:HE.Left,[HE.Top]:HE.Bottom,[HE.Bottom]:HE.Top},Nj=({nodeId:e,handleType:t,style:n,type:o=UE.Bezier,CustomComponent:a,connectionStatus:s})=>{var i,l,c;const{fromNode:d,handleId:h,toX:m,toY:f,connectionMode:p}=cE(r.useCallback((t=>({fromNode:t.nodeInternals.get(e),handleId:t.connectionHandleId,toX:(t.connectionPosition.x-t.transform[0])/t.transform[2],toY:(t.connectionPosition.y-t.transform[1])/t.transform[2],connectionMode:t.connectionMode})),[e]),_N),g=null==(i=null==d?void 0:d[CE])?void 0:i.handleBounds;let v=null==g?void 0:g[t];if(p===PE.Loose&&(v=v||(null==g?void 0:g["source"===t?"target":"source"])),!d||!v)return null;const x=h?v.find((e=>e.id===h)):v[0],y=x?x.x+x.width/2:(d.width??0)/2,b=x?x.y+x.height/2:d.height??0,w=((null==(l=d.positionAbsolute)?void 0:l.x)??0)+y,k=((null==(c=d.positionAbsolute)?void 0:c.y)??0)+b,N=null==x?void 0:x.position,E=N?kj[N]:null;if(!N||!E)return null;if(a)return u.createElement(a,{connectionLineType:o,connectionLineStyle:n,fromNode:d,fromHandle:x,fromX:w,fromY:k,toX:m,toY:f,fromPosition:N,toPosition:E,connectionStatus:s});let C="";const S={sourceX:w,sourceY:k,sourcePosition:N,targetX:m,targetY:f,targetPosition:E};return o===UE.Bezier?[C]=aC(S):o===UE.Step?[C]=QE({...S,borderRadius:0}):o===UE.SmoothStep?[C]=QE(S):o===UE.SimpleBezier?[C]=YE(S):C=`M${w},${k} ${m},${f}`,u.createElement("path",{d:C,fill:"none",className:"react-flow__connection-path",style:n})};Nj.displayName="ConnectionLine";const Ej=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function Cj({containerStyle:e,style:t,type:n,component:o}){const{nodeId:r,handleType:a,nodesConnectable:s,width:i,height:l,connectionStatus:c}=cE(Ej,_N);return!!(r&&a&&i&&s)?u.createElement("svg",{style:e,width:i,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container"},u.createElement("g",{className:kN(["react-flow__connection",c])},u.createElement(Nj,{nodeId:r,handleType:a,style:t,type:n,CustomComponent:o,connectionStatus:c}))):null}function Sj(e,t){r.useRef(null),dE();return r.useMemo((()=>t(e)),[e])}const jj=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:o,onMoveEnd:a,onInit:s,onNodeClick:i,onEdgeClick:l,onNodeDoubleClick:c,onEdgeDoubleClick:d,onNodeMouseEnter:h,onNodeMouseMove:m,onNodeMouseLeave:f,onNodeContextMenu:p,onSelectionContextMenu:g,onSelectionStart:v,onSelectionEnd:x,connectionLineType:y,connectionLineStyle:b,connectionLineComponent:w,connectionLineContainerStyle:k,selectionKeyCode:N,selectionOnDrag:E,selectionMode:C,multiSelectionKeyCode:S,panActivationKeyCode:j,zoomActivationKeyCode:_,deleteKeyCode:I,onlyRenderVisibleElements:A,elementsSelectable:M,selectNodesOnDrag:T,defaultViewport:O,translateExtent:D,minZoom:P,maxZoom:R,preventScrolling:F,defaultMarkerColor:L,zoomOnScroll:z,zoomOnPinch:B,panOnScroll:U,panOnScrollSpeed:V,panOnScrollMode:$,zoomOnDoubleClick:G,panOnDrag:H,onPaneClick:W,onPaneMouseEnter:q,onPaneMouseMove:Y,onPaneMouseLeave:K,onPaneScroll:J,onPaneContextMenu:X,onEdgeContextMenu:Z,onEdgeMouseEnter:Q,onEdgeMouseMove:ee,onEdgeMouseLeave:te,onReconnect:ne,onReconnectStart:oe,onReconnectEnd:re,reconnectRadius:ae,noDragClassName:se,noWheelClassName:ie,noPanClassName:le,elevateEdgesOnSelect:ce,disableKeyboardA11y:de,nodeOrigin:ue,nodeExtent:he,rfId:me})=>{const fe=Sj(e,XS),pe=Sj(t,ij);return function(e){const t=fS(),n=r.useRef(!1);r.useEffect((()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout((()=>e(t)),1),n.current=!0)}),[e,t.viewportInitialized])}(s),u.createElement(JS,{onPaneClick:W,onPaneMouseEnter:q,onPaneMouseMove:Y,onPaneMouseLeave:K,onPaneContextMenu:X,onPaneScroll:J,deleteKeyCode:I,selectionKeyCode:N,selectionOnDrag:E,selectionMode:C,onSelectionStart:v,onSelectionEnd:x,multiSelectionKeyCode:S,panActivationKeyCode:j,zoomActivationKeyCode:_,elementsSelectable:M,onMove:n,onMoveStart:o,onMoveEnd:a,zoomOnScroll:z,zoomOnPinch:B,zoomOnDoubleClick:G,panOnScroll:U,panOnScrollSpeed:V,panOnScrollMode:$,panOnDrag:H,defaultViewport:O,translateExtent:D,minZoom:P,maxZoom:R,onSelectionContextMenu:g,preventScrolling:F,noDragClassName:se,noWheelClassName:ie,noPanClassName:le,disableKeyboardA11y:de},u.createElement(wj,null,u.createElement(yj,{edgeTypes:pe,onEdgeClick:l,onEdgeDoubleClick:d,onlyRenderVisibleElements:A,onEdgeContextMenu:Z,onEdgeMouseEnter:Q,onEdgeMouseMove:ee,onEdgeMouseLeave:te,onReconnect:ne,onReconnectStart:oe,onReconnectEnd:re,reconnectRadius:ae,defaultMarkerColor:L,noPanClassName:le,elevateEdgesOnSelect:!!ce,disableKeyboardA11y:de,rfId:me},u.createElement(Cj,{style:b,type:y,component:w,containerStyle:k})),u.createElement("div",{className:"react-flow__edgelabel-renderer"}),u.createElement(ej,{nodeTypes:fe,onNodeClick:i,onNodeDoubleClick:c,onNodeMouseEnter:h,onNodeMouseMove:m,onNodeMouseLeave:f,onNodeContextMenu:p,selectNodesOnDrag:T,onlyRenderVisibleElements:A,noPanClassName:le,noDragClassName:se,disableKeyboardA11y:de,nodeOrigin:ue,nodeExtent:he,rfId:me})))};jj.displayName="GraphView";var _j=r.memo(jj);const Ij=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Aj={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:Ij,nodeExtent:Ij,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:PE.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:(e,t)=>{},isValidConnection:void 0},Mj=()=>{return e=(e,t)=>({...Aj,setNodes:n=>{const{nodeInternals:o,nodeOrigin:r,elevateNodesOnSelect:a}=t();e({nodeInternals:sS(n,o,r,a)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:o={}}=t();e({edges:n.map((e=>({...o,...e})))})},setDefaultNodesAndEdges:(n,o)=>{const r=void 0!==n,a=void 0!==o,s=r?sS(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:s,edges:a?o:[],hasDefaultNodes:r,hasDefaultEdges:a})},updateNodeDimensions:n=>{const{onNodesChange:o,nodeInternals:r,fitViewOnInit:a,fitViewOnInitDone:s,fitViewOnInitOptions:i,domNode:l,nodeOrigin:c}=t(),d=null==l?void 0:l.querySelector(".react-flow__viewport");if(!d)return;const u=window.getComputedStyle(d),{m22:h}=new window.DOMMatrixReadOnly(u.transform),m=n.reduce(((e,t)=>{const n=r.get(t.id);if(null==n?void 0:n.hidden)r.set(n.id,{...n,[CE]:{...n[CE],handleBounds:void 0}});else if(n){const o=pE(t.nodeElement);o.width&&o.height&&(n.width!==o.width||n.height!==o.height||t.forceUpdate)&&(r.set(n.id,{...n,[CE]:{...n[CE],handleBounds:{source:LS(".source",t.nodeElement,h,c),target:LS(".target",t.nodeElement,h,c)}},...o}),e.push({id:n.id,type:"dimensions",dimensions:o}))}return e}),[]);aS(r,c);const f=s||a&&!s&&iS(t,{initial:!0,...i});e({nodeInternals:new Map(r),fitViewOnInitDone:f}),(null==m?void 0:m.length)>0&&(null==o||o(m))},updateNodePositions:(e,n=!0,o=!1)=>{const{triggerNodeChanges:r}=t();r(e.map((e=>{const t={id:e.id,type:"position",dragging:o};return n&&(t.positionAbsolute=e.positionAbsolute,t.position=e.position),t})))},triggerNodeChanges:n=>{const{onNodesChange:o,nodeInternals:r,hasDefaultNodes:a,nodeOrigin:s,getNodes:i,elevateNodesOnSelect:l}=t();if(null==n?void 0:n.length){if(a){const t=sS(jS(n,i()),r,s,l);e({nodeInternals:t})}null==o||o(n)}},addSelectedNodes:n=>{const{multiSelectionActive:o,edges:r,getNodes:a}=t();let s,i=null;o?s=n.map((e=>_S(e,!0))):(s=IS(a(),n),i=IS(r,[])),dS({changedNodes:s,changedEdges:i,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:o,edges:r,getNodes:a}=t();let s,i=null;o?s=n.map((e=>_S(e,!0))):(s=IS(r,n),i=IS(a(),[])),dS({changedNodes:i,changedEdges:s,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:o}={})=>{const{edges:r,getNodes:a}=t(),s=o||r;dS({changedNodes:(n||a()).map((e=>(e.selected=!1,_S(e.id,!1)))),changedEdges:s.map((e=>_S(e.id,!1))),get:t,set:e})},setMinZoom:n=>{const{d3Zoom:o,maxZoom:r}=t();null==o||o.scaleExtent([n,r]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:o,minZoom:r}=t();null==o||o.scaleExtent([r,n]),e({maxZoom:n})},setTranslateExtent:n=>{var o;null==(o=t().d3Zoom)||o.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:o}=t();dS({changedNodes:o().filter((e=>e.selected)).map((e=>_S(e.id,!1))),changedEdges:n.filter((e=>e.selected)).map((e=>_S(e.id,!1))),get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:o}=t();o.forEach((e=>{e.positionAbsolute=vE(e.position,n)})),e({nodeExtent:n,nodeInternals:new Map(o)})},panBy:e=>{const{transform:n,width:o,height:r,d3Zoom:a,d3Selection:s,translateExtent:i}=t();if(!a||!s||!e.x&&!e.y)return!1;const l=wl.translate(n[0]+e.x,n[1]+e.y).scale(n[2]),c=[[0,0],[o,r]],d=null==a?void 0:a.constrain()(l,c,i);return a.transform(s,d),n[0]!==d.x||n[1]!==d.y||n[2]!==d.k},cancelConnection:()=>e({connectionNodeId:Aj.connectionNodeId,connectionHandleId:Aj.connectionHandleId,connectionHandleType:Aj.connectionHandleType,connectionStatus:Aj.connectionStatus,connectionStartHandle:Aj.connectionStartHandle,connectionEndHandle:Aj.connectionEndHandle}),reset:()=>e({...Aj})}),t=Object.is,e?jN(e,t):jN;var e,t},Tj=({children:e})=>{const t=r.useRef(null);return t.current||(t.current=Mj()),u.createElement(QN,{value:t.current},e)};Tj.displayName="ReactFlowProvider";const Oj=({children:e})=>r.useContext(ZN)?u.createElement(u.Fragment,null,e):u.createElement(Tj,null,e);Oj.displayName="ReactFlowWrapper";const Dj={input:DC,default:TC,output:RC,group:FC},Pj={default:sC,straight:nC,step:tC,smoothstep:eC,simplebezier:KE},Rj=[0,0],Fj=[15,15],Lj={x:0,y:0,zoom:1},zj={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},Bj=r.forwardRef((({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:a=Dj,edgeTypes:s=Pj,onNodeClick:i,onEdgeClick:l,onInit:c,onMove:d,onMoveStart:h,onMoveEnd:m,onConnect:f,onConnectStart:p,onConnectEnd:g,onClickConnectStart:v,onClickConnectEnd:x,onNodeMouseEnter:y,onNodeMouseMove:b,onNodeMouseLeave:w,onNodeContextMenu:k,onNodeDoubleClick:N,onNodeDragStart:E,onNodeDrag:C,onNodeDragStop:S,onNodesDelete:j,onEdgesDelete:_,onSelectionChange:I,onSelectionDragStart:A,onSelectionDrag:M,onSelectionDragStop:T,onSelectionContextMenu:O,onSelectionStart:D,onSelectionEnd:P,connectionMode:R=PE.Strict,connectionLineType:F=UE.Bezier,connectionLineStyle:L,connectionLineComponent:z,connectionLineContainerStyle:B,deleteKeyCode:U="Backspace",selectionKeyCode:V="Shift",selectionOnDrag:$=!1,selectionMode:G=zE.Full,panActivationKeyCode:H="Space",multiSelectionKeyCode:W=(AE()?"Meta":"Control"),zoomActivationKeyCode:q=(AE()?"Meta":"Control"),snapToGrid:Y=!1,snapGrid:K=Fj,onlyRenderVisibleElements:J=!1,selectNodesOnDrag:X=!0,nodesDraggable:Z,nodesConnectable:Q,nodesFocusable:ee,nodeOrigin:te=Rj,edgesFocusable:ne,edgesUpdatable:oe,elementsSelectable:re,defaultViewport:ae=Lj,minZoom:se=.5,maxZoom:ie=2,translateExtent:le=Ij,preventScrolling:ce=!0,nodeExtent:de,defaultMarkerColor:ue="#b1b1b7",zoomOnScroll:he=!0,zoomOnPinch:me=!0,panOnScroll:fe=!1,panOnScrollSpeed:pe=.5,panOnScrollMode:ge=FE.Free,zoomOnDoubleClick:ve=!0,panOnDrag:xe=!0,onPaneClick:ye,onPaneMouseEnter:be,onPaneMouseMove:we,onPaneMouseLeave:ke,onPaneScroll:Ne,onPaneContextMenu:Ee,children:Ce,onEdgeContextMenu:Se,onEdgeDoubleClick:je,onEdgeMouseEnter:_e,onEdgeMouseMove:Ie,onEdgeMouseLeave:Ae,onEdgeUpdate:Me,onEdgeUpdateStart:Te,onEdgeUpdateEnd:Oe,onReconnect:De,onReconnectStart:Pe,onReconnectEnd:Re,reconnectRadius:Fe=10,edgeUpdaterRadius:Le=10,onNodesChange:ze,onEdgesChange:Be,noDragClassName:Ue="nodrag",noWheelClassName:Ve="nowheel",noPanClassName:$e="nopan",fitView:Ge=!1,fitViewOptions:He,connectOnClick:We=!0,attributionPosition:qe,proOptions:Ye,defaultEdgeOptions:Ke,elevateNodesOnSelect:Je=!0,elevateEdgesOnSelect:Xe=!1,disableKeyboardA11y:Ze=!1,autoPanOnConnect:Qe=!0,autoPanOnNodeDrag:et=!0,connectionRadius:tt=20,isValidConnection:nt,onError:ot,style:rt,id:at,nodeDragThreshold:st,...it},lt)=>{const ct=at||"1";return u.createElement("div",{...it,style:{...rt,...zj},ref:lt,className:kN(["react-flow",r]),"data-testid":"rf__wrapper",id:at},u.createElement(Oj,null,u.createElement(_j,{onInit:c,onMove:d,onMoveStart:h,onMoveEnd:m,onNodeClick:i,onEdgeClick:l,onNodeMouseEnter:y,onNodeMouseMove:b,onNodeMouseLeave:w,onNodeContextMenu:k,onNodeDoubleClick:N,nodeTypes:a,edgeTypes:s,connectionLineType:F,connectionLineStyle:L,connectionLineComponent:z,connectionLineContainerStyle:B,selectionKeyCode:V,selectionOnDrag:$,selectionMode:G,deleteKeyCode:U,multiSelectionKeyCode:W,panActivationKeyCode:H,zoomActivationKeyCode:q,onlyRenderVisibleElements:J,selectNodesOnDrag:X,defaultViewport:ae,translateExtent:le,minZoom:se,maxZoom:ie,preventScrolling:ce,zoomOnScroll:he,zoomOnPinch:me,zoomOnDoubleClick:ve,panOnScroll:fe,panOnScrollSpeed:pe,panOnScrollMode:ge,panOnDrag:xe,onPaneClick:ye,onPaneMouseEnter:be,onPaneMouseMove:we,onPaneMouseLeave:ke,onPaneScroll:Ne,onPaneContextMenu:Ee,onSelectionContextMenu:O,onSelectionStart:D,onSelectionEnd:P,onEdgeContextMenu:Se,onEdgeDoubleClick:je,onEdgeMouseEnter:_e,onEdgeMouseMove:Ie,onEdgeMouseLeave:Ae,onReconnect:De??Me,onReconnectStart:Pe??Te,onReconnectEnd:Re??Oe,reconnectRadius:Fe??Le,defaultMarkerColor:ue,noDragClassName:Ue,noWheelClassName:Ve,noPanClassName:$e,elevateEdgesOnSelect:Xe,rfId:ct,disableKeyboardA11y:Ze,nodeOrigin:te,nodeExtent:de}),u.createElement(qC,{nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:f,onConnectStart:p,onConnectEnd:g,onClickConnectStart:v,onClickConnectEnd:x,nodesDraggable:Z,nodesConnectable:Q,nodesFocusable:ee,edgesFocusable:ne,edgesUpdatable:oe,elementsSelectable:re,elevateNodesOnSelect:Je,minZoom:se,maxZoom:ie,nodeExtent:de,onNodesChange:ze,onEdgesChange:Be,snapToGrid:Y,snapGrid:K,connectionMode:R,translateExtent:le,connectOnClick:We,defaultEdgeOptions:Ke,fitView:Ge,fitViewOptions:He,onNodesDelete:j,onEdgesDelete:_,onNodeDragStart:E,onNodeDrag:C,onNodeDragStop:S,onSelectionDrag:M,onSelectionDragStart:A,onSelectionDragStop:T,noPanClassName:$e,nodeOrigin:te,rfId:ct,autoPanOnConnect:Qe,autoPanOnNodeDrag:et,onError:ot,connectionRadius:tt,isValidConnection:nt,nodeDragThreshold:st}),u.createElement($C,{onSelectionChange:I}),Ce,u.createElement(mE,{proOptions:Ye,position:qe}),u.createElement(eS,{rfId:ct,disableKeyboardA11y:Ze})))}));function Uj(e){return t=>{const[n,o]=r.useState(t),a=r.useCallback((t=>o((n=>e(t,n)))),[]);return[n,o,a]}}Bj.displayName="ReactFlow";const Vj=Uj(jS),$j=Uj((function(e,t){return SS(e,t)}));function Gj(){return u.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},u.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function Hj(){return u.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},u.createElement("path",{d:"M0 0h32v4.2H0z"}))}function Wj(){return u.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},u.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 qj(){return u.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},u.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 Yj(){return u.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},u.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 Kj=({children:e,className:t,...n})=>u.createElement("button",{type:"button",className:kN(["react-flow__controls-button",t]),...n},e);Kj.displayName="ControlButton";const Jj=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),Xj=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:a,onZoomIn:s,onZoomOut:i,onFitView:l,onInteractiveChange:c,className:d,children:h,position:m="bottom-left"})=>{const f=dE(),[p,g]=r.useState(!1),{isInteractive:v,minZoomReached:x,maxZoomReached:y}=cE(Jj,_N),{zoomIn:b,zoomOut:w,fitView:k}=fS();if(r.useEffect((()=>{g(!0)}),[]),!p)return null;return u.createElement(hE,{className:kN(["react-flow__controls",d]),position:m,style:e,"data-testid":"rf__controls"},t&&u.createElement(u.Fragment,null,u.createElement(Kj,{onClick:()=>{b(),null==s||s()},className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:y},u.createElement(Gj,null)),u.createElement(Kj,{onClick:()=>{w(),null==i||i()},className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:x},u.createElement(Hj,null))),n&&u.createElement(Kj,{className:"react-flow__controls-fitview",onClick:()=>{k(a),null==l||l()},title:"fit view","aria-label":"fit view"},u.createElement(Wj,null)),o&&u.createElement(Kj,{className:"react-flow__controls-interactive",onClick:()=>{f.setState({nodesDraggable:!v,nodesConnectable:!v,elementsSelectable:!v}),null==c||c(!v)},title:"toggle interactivity","aria-label":"toggle interactivity"},v?u.createElement(Yj,null):u.createElement(qj,null)),h)};Xj.displayName="Controls";var Zj,Qj,e_=r.memo(Xj);function t_({color:e,dimensions:t,lineWidth:n}){return u.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function n_({color:e,radius:t}){return u.createElement("circle",{cx:t,cy:t,r:t,fill:e})}(Qj=Zj||(Zj={})).Lines="lines",Qj.Dots="dots",Qj.Cross="cross";const o_={[Zj.Dots]:"#91919a",[Zj.Lines]:"#eee",[Zj.Cross]:"#e2e2e2"},r_={[Zj.Dots]:1,[Zj.Lines]:1,[Zj.Cross]:6},a_=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function s_({id:e,variant:t=Zj.Dots,gap:n=20,size:o,lineWidth:a=1,offset:s=2,color:i,style:l,className:c}){const d=r.useRef(null),{transform:h,patternId:m}=cE(a_,_N),f=i||o_[t],p=o||r_[t],g=t===Zj.Dots,v=t===Zj.Cross,x=Array.isArray(n)?n:[n,n],y=[x[0]*h[2]||1,x[1]*h[2]||1],b=p*h[2],w=v?[b,b]:y,k=g?[b/s,b/s]:[w[0]/s,w[1]/s];return u.createElement("svg",{className:kN(["react-flow__background",c]),style:{...l,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:d,"data-testid":"rf__background"},u.createElement("pattern",{id:m+e,x:h[0]%y[0],y:h[1]%y[1],width:y[0],height:y[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${k[0]},-${k[1]})`},g?u.createElement(n_,{color:f,radius:b/s}):u.createElement(t_,{dimensions:w,color:f,lineWidth:a})),u.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+e})`}))}s_.displayName="Background";var i_=r.memo(s_);function l_(e){return Math.min(11*e+35,200)}const c_=u.createContext("LR"),d_=r.memo((e=>{const t=m(51),{data:n,selected:o}=e,a=te(n.atom),s=ae().inOrderIds.indexOf(a.id),i=o?"var(--gray-9)":"var(--gray-3)",l=cE(h_),c=r.useContext(c_);let d,u,h,f,g;if(t[0]!==a.code||t[1]!==c||t[2]!==i||t[3]!==o){const e=a.code.split("\n").length,n="LR"===c?HE.Left:HE.Top;let r;t[8]!==i?(r={background:i},t[8]=i,t[9]=r):r=t[9],t[10]!==n||t[11]!==r?(h=p.jsx(AC,{type:"target",id:"inputs",position:n,style:r}),t[10]=n,t[11]=r,t[12]=h):h=t[12];const s="LR"===c?HE.Left:HE.Top;let l;t[13]!==i?(l={background:i},t[13]=i,t[14]=l):l=t[14],t[15]!==s||t[16]!==l?(f=p.jsx(AC,{type:"source",id:"inputs",position:s,style:l}),t[15]=s,t[16]=l,t[17]=f):f=t[17];const m=o&&"border-primary";t[18]!==m?(u=Jt("flex flex-col bg-card border border-input/50 rounded-md mx-[2px] overflow-hidden",m),t[18]=m,t[19]=u):u=t[19],d=l_(e),t[0]=a.code,t[1]=c,t[2]=i,t[3]=o,t[4]=d,t[5]=u,t[6]=h,t[7]=f}else d=t[4],u=t[5],h=t[6],f=t[7];var v;let x;t[20]!==n.forceWidth||t[21]!==l?(g=n.forceWidth||(v=l,Math.min(Math.max(v-100,100),400)),t[20]=n.forceWidth,t[21]=l,t[22]=g):g=t[22],t[23]!==d||t[24]!==g?(x={height:d,width:g},t[23]=d,t[24]=g,t[25]=x):x=t[25];const y=is(a.name,s);let b,w,k;t[26]!==y?(b=p.jsx("div",{className:"text-muted-foreground font-semibold text-xs py-1 px-2 bg-muted border-b",children:y}),t[26]=y,t[27]=b):b=t[27],t[28]!==a.code?(w=p.jsx(yl,{code:a.code}),t[28]=a.code,t[29]=w):w=t[29],t[30]!==u||t[31]!==x||t[32]!==b||t[33]!==w?(k=p.jsxs("div",{className:u,style:x,children:[b,w]}),t[30]=u,t[31]=x,t[32]=b,t[33]=w,t[34]=k):k=t[34];const N="LR"===c?HE.Right:HE.Bottom;let E,C;t[35]!==i?(E={background:i},t[35]=i,t[36]=E):E=t[36],t[37]!==N||t[38]!==E?(C=p.jsx(AC,{type:"source",id:"outputs",position:N,style:E}),t[37]=N,t[38]=E,t[39]=C):C=t[39];const S="LR"===c?HE.Right:HE.Bottom;let j,_,I;return t[40]!==i?(j={background:i},t[40]=i,t[41]=j):j=t[41],t[42]!==S||t[43]!==j?(_=p.jsx(AC,{type:"target",id:"outputs",position:S,style:j}),t[42]=S,t[43]=j,t[44]=_):_=t[44],t[45]!==h||t[46]!==f||t[47]!==k||t[48]!==C||t[49]!==_?(I=p.jsxs("div",{children:[h,f,k,C,_]}),t[45]=h,t[46]=f,t[47]=k,t[48]=C,t[49]=_,t[50]=I):I=t[50],I}),((e,t)=>["data","selected","id"].every((n=>e[n]===t[n]))));d_.displayName="CustomNode";const u_={custom:d_};function h_(e){const{width:t}=e;return t}const m_=e=>{const t=m(18),{maxCount:n,cellIds:o,onClick:r,skipScroll:a}=e,s=ae();let i,l,c,d;if(t[0]!==o||t[1]!==s.inOrderIds||t[2]!==n||t[3]!==a||t[4]!==r){c=Symbol.for("react.early_return_sentinel");e:{let e;t[8]!==s.inOrderIds?(e=(e,t)=>s.inOrderIds.indexOf(e)-s.inOrderIds.indexOf(t),t[8]=s.inOrderIds,t[9]=e):e=t[9];const d=[...o].sort(e);if(0===o.length){let e;t[10]===Symbol.for("react.memo_cache_sentinel")?(e=p.jsx("div",{className:"text-muted-foreground",children:"--"}),t[10]=e):e=t[10],c=e;break e}let u;t[11]!==a||t[12]!==r||t[13]!==o.length?(u=(e,t)=>p.jsxs("span",{className:"truncate",children:[p.jsx(ls,{variant:"focus",cellId:e,skipScroll:a,className:"whitespace-nowrap",onClick:r?()=>r(e):void 0},e),t<o.length-1&&", "]},e),t[11]=a,t[12]=r,t[13]=o.length,t[14]=u):u=t[14],i=d.slice(0,n).map(u),l=o.length>n&&p.jsxs(rn,{children:[p.jsx(ur,{asChild:!0,children:p.jsxs("span",{className:"whitespace-nowrap text-muted-foreground text-xs hover:underline cursor-pointer",children:["+",o.length-n," more"]})}),p.jsx(on,{className:"w-auto",children:p.jsx("div",{className:"flex flex-col gap-1 py-1",children:d.slice(n).map((e=>p.jsx(ls,{variant:"focus",cellId:e,className:"whitespace-nowrap",onClick:r?()=>r(e):void 0},e)))})})]})}t[0]=o,t[1]=s.inOrderIds,t[2]=n,t[3]=a,t[4]=r,t[5]=i,t[6]=l,t[7]=c}else i=t[5],l=t[6],c=t[7];return c!==Symbol.for("react.early_return_sentinel")?c:(t[15]!==i||t[16]!==l?(d=p.jsxs(p.Fragment,{children:[i,l]}),t[15]=i,t[16]=l,t[17]=d):d=t[17],d)},f_=e=>{const t=m(15);let n,o,r,a;t[0]!==e?(({name:r,declaredBy:n,onClick:o,...a}=e),t[0]=e,t[1]=n,t[2]=o,t[3]=r,t[4]=a):(n=t[1],o=t[2],r=t[3],a=t[4]);const s=n.length>1?"destructive":"outline";let i,l,c;return t[5]!==o||t[6]!==r?(i=async e=>{o?o(e):(await We(r),X({title:"Copied to clipboard"}))},t[5]=o,t[6]=r,t[7]=i):i=t[7],t[8]!==r||t[9]!==s||t[10]!==i?(l=p.jsx(cs,{title:r,variant:s,className:"rounded-sm text-ellipsis block overflow-hidden max-w-fit cursor-pointer font-medium",onClick:i,children:r}),t[8]=r,t[9]=s,t[10]=i,t[11]=l):l=t[11],t[12]!==a||t[13]!==l?(c=p.jsx("div",{className:"max-w-[130px]",...a,children:l}),t[12]=a,t[13]=l,t[14]=c):c=t[14],c},p_=r.memo((e=>{const t=m(38),{onChange:n,view:o,settings:r,onSettingsChange:a}=e;let s;t[0]!==a||t[1]!==r?(s=(e,t)=>{a({...r,[e]:t})},t[0]=a,t[1]=r,t[2]=s):s=t[2];const i=s;let l,c,d,u,h,f;t[3]===Symbol.for("react.memo_cache_sentinel")?(l=p.jsx(ur,{asChild:!0,children:p.jsx(x,{variant:"text",size:"xs",children:p.jsx(Nt,{className:"w-4 h-4"})})}),t[3]=l):l=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(c=p.jsx("div",{className:"font-semibold pb-4",children:"Settings"}),t[4]=c):c=t[4],t[5]!==i?(d=e=>i("hidePureMarkdown",Boolean(e)),t[5]=i,t[6]=d):d=t[6],t[7]!==r.hidePureMarkdown||t[8]!==d?(u=p.jsx(zr,{"data-testid":"hide-pure-markdown-checkbox",id:"hide-pure-markdown",checked:r.hidePureMarkdown,onCheckedChange:d}),t[7]=r.hidePureMarkdown,t[8]=d,t[9]=u):u=t[9],t[10]===Symbol.for("react.memo_cache_sentinel")?(h=p.jsx(ke,{htmlFor:"hide-pure-markdown",children:"Hide pure markdown"}),t[10]=h):h=t[10],t[11]!==u?(f=p.jsxs(rn,{children:[l,p.jsxs(on,{className:"w-auto p-2 text-muted-foreground",children:[c,p.jsxs("div",{className:"flex items-center gap-2",children:[u,h]})]})]}),t[11]=u,t[12]=f):f=t[12];const g=f,v="_minimap_"===o;let y,b,w;t[13]!==n?(y=()=>n("_minimap_"),t[13]=n,t[14]=y):y=t[14],t[15]===Symbol.for("react.memo_cache_sentinel")?(b=p.jsx(wc,{className:"w-4 h-4 mr-1"}),t[15]=b):b=t[15],t[16]!==v||t[17]!==y?(w=p.jsxs(x,{variant:"outline",className:"bg-background","aria-selected":v,size:"xs",onClick:y,children:[b,"Mini Map"]}),t[16]=v,t[17]=y,t[18]=w):w=t[18];const k="TB"===o;let N,E,C;t[19]!==n?(N=()=>n("TB"),t[19]=n,t[20]=N):N=t[20],t[21]===Symbol.for("react.memo_cache_sentinel")?(E=p.jsx(cc,{className:"w-4 h-4 mr-1"}),t[21]=E):E=t[21],t[22]!==k||t[23]!==N?(C=p.jsxs(x,{variant:"outline",className:"bg-background","aria-selected":k,size:"xs",onClick:N,children:[E,"Vertical Tree"]}),t[22]=k,t[23]=N,t[24]=C):C=t[24];const S="LR"===o;let j,_,I,A;t[25]!==n?(j=()=>n("LR"),t[25]=n,t[26]=j):j=t[26],t[27]===Symbol.for("react.memo_cache_sentinel")?(_=p.jsx(cc,{className:"w-4 h-4 mr-1 transform -rotate-90"}),t[27]=_):_=t[27],t[28]!==S||t[29]!==j?(I=p.jsxs(x,{variant:"outline",className:"bg-background","aria-selected":S,size:"xs",onClick:j,children:[_," ","Horizontal Tree"]}),t[28]=S,t[29]=j,t[30]=I):I=t[30],t[31]!==w||t[32]!==C||t[33]!==I?(A=p.jsxs("div",{className:"flex gap-2",children:[w,C,I]}),t[31]=w,t[32]=C,t[33]=I,t[34]=A):A=t[34];const M="_minimap_"!==o&&g;let T;return t[35]!==A||t[36]!==M?(T=p.jsxs(hE,{position:"top-right",className:"flex flex-col items-end gap-2",children:[A,M]}),t[35]=A,t[36]=M,t[37]=T):T=t[37],T}));p_.displayName="GraphToolbar";const g_=r.memo((e=>{const t=m(11),{selection:n,variables:o,onClearSelection:r}=e;if(!n)return null;const a=v_;let s;t[0]!==n.type||t[1]!==n.id||t[2]!==n.source||t[3]!==n.target||t[4]!==o||t[5]!==r?(s=()=>{if("node"===n.type){const e=Object.values(o).filter((e=>e.usedBy.includes(n.id))),t=Object.values(o).filter((e=>e.declaredBy.includes(n.id))),s=(e,t)=>p.jsxs(p.Fragment,{children:[0===e.length&&p.jsx("div",{className:"text-muted-foreground text-sm text-center",children:"--"}),p.jsx("div",{className:"grid grid-cols-5 gap-3 items-center text-sm py-1 flex-1 empty:hidden",children:e.map((e=>p.jsxs(u.Fragment,{children:[p.jsx(f_,{declaredBy:e.declaredBy,name:e.name}),p.jsxs("div",{className:"truncate col-span-2",title:e.value??"",children:[e.value,p.jsxs("span",{className:"ml-1 truncate text-foreground/60 font-mono",children:["(",e.dataType,")"]})]}),p.jsx("div",{className:"truncate col-span-2 gap-1 items-center",children:p.jsx(m_,{skipScroll:!0,onClick:()=>a("in"===t?e.declaredBy[0]:e.usedBy[0],e.name),maxCount:3,cellIds:e.usedBy})})]},e.name)))})]});return p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[p.jsx(tt,{className:"w-5 h-5"}),p.jsx(ls,{cellId:n.id}),p.jsx("div",{className:"flex-1"}),p.jsx(zx,{cellId:n.id,children:p.jsx(x,{variant:"ghost",size:"icon",children:p.jsx(Hl,{className:"w-4 h-4"})})}),p.jsx(x,{variant:"text",size:"icon",onClick:()=>{r()},children:p.jsx(qt,{className:"w-4 h-4"})})]}),p.jsxs("div",{className:"text-sm flex flex-col py-3 pl-2 pr-4 flex-1 justify-center",children:[p.jsxs("div",{className:"flex flex-col gap-2",children:[p.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[p.jsx(_l,{className:"w-4 h-4"}),"Outputs"]}),s(t,"out")]}),p.jsx("hr",{className:"border-divider my-3"}),p.jsxs("div",{className:"flex flex-col gap-2",children:[p.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[p.jsx(Il,{className:"w-4 h-4"}),"Inputs"]}),s(e,"in")]})]})]})}if("edge"===n.type){const e=Object.values(o).filter((e=>e.declaredBy.includes(n.source)&&e.usedBy.includes(n.target)));return p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[p.jsx(Bc,{className:"w-4 h-4"}),p.jsx(ls,{cellId:n.source}),p.jsx(Al,{className:"w-4 h-4"}),p.jsx(ls,{cellId:n.target})]}),p.jsx("div",{className:"grid grid-cols-4 gap-3 max-w-[350px] items-center text-sm p-3 flex-1",children:e.map((e=>p.jsxs(u.Fragment,{children:[p.jsx(f_,{declaredBy:e.declaredBy,name:e.name,onClick:()=>{a(e.declaredBy[0],e.name)}}),p.jsx("div",{className:"truncate text-foreground/60 font-mono",children:e.dataType}),p.jsx("div",{className:"truncate col-span-2",title:e.value??"",children:e.value})]},e.name)))})]})}},t[0]=n.type,t[1]=n.id,t[2]=n.source,t[3]=n.target,t[4]=o,t[5]=r,t[6]=s):s=t[6];const i=s;let l,c;return t[7]!==i?(l=i(),t[7]=i,t[8]=l):l=t[8],t[9]!==l?(c=p.jsx(hE,{position:"bottom-left",className:"max-h-[90%] flex flex-col w-[calc(100%-5rem)]",children:p.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})}),t[9]=l,t[10]=c):c=t[10],c}));function v_(e,t){const n=Br(e);n&&ds(n,t)}function x_(){const e=m(7),t=fS(),n=cE(b_),o=cE(y_);let a;e[0]!==t?(a=()=>{t.fitView({duration:100})},e[0]=t,e[1]=a):a=e[1];const s=us(a,100);let i,l;e[2]!==n||e[3]!==o||e[4]!==s?(i=()=>{n&&o&&s()},l=[n,o,s],e[2]=n,e[3]=o,e[4]=s,e[5]=i,e[6]=l):(i=e[5],l=e[6]),r.useEffect(i,l)}function y_(e){const{height:t}=e;return t}function b_(e){const{width:t}=e;return t}g_.displayName="GraphSelectionPanel";const w_=new class{createEdge(e,t,n){return{type:"smoothstep",pathOptions:{offset:20,borderRadius:100},data:{direction:n},markerEnd:{type:$E.Arrow},id:`${e}-${t}-${n}`,source:e,sourceHandle:n,targetHandle:n,target:t}}createNode(e,t,n){return{id:e,data:{atom:t},width:250,type:"custom",height:l_(Y.get(t).code.trim().split("\n").length),position:{x:0,y:n+20}}}createElements(e,t,n,o){let r=0;const a=[],s=[];for(const[l,c]of Na.zip(e,t)){const e=this.createNode(l,c,r);a.push(e),r=e.position.y+(e.height||0)}const i=new Set;for(const l of Object.values(n)){const{declaredBy:e,usedBy:t}=l;for(const n of e)for(const e of t){const t=`${n}-${e}`;i.has(t)||(i.add(t),s.push(this.createEdge(n,e,"inputs"),this.createEdge(n,e,"outputs")))}}return{nodes:a,edges:s}}},k_=e=>{const t=m(37),{cellIds:n,variables:o,cellAtoms:a,children:s}=e;let i;t[0]!==n||t[1]!==a||t[2]!==o?(i=w_.createElements(n,a,o,!1),t[0]=n,t[1]=a,t[2]=o,t[3]=i):i=t[3];const{nodes:l,edges:c}=i;let d;t[4]===Symbol.for("react.memo_cache_sentinel")?(d=[],t[4]=d):d=t[4];const[u,h]=$j(d),[f,g]=Vj(l),[v,x]=r.useState(),[y,b]=r.useState(),w=r.useRef(!1);x_();const k=cE(N_);let N;t[5]!==g||t[6]!==h?(N=e=>{g(e.nodes),h([])},t[5]=g,t[6]=h,t[7]=N):N=t[7];const E=z(N);let C,S,j,_;t[8]!==E||t[9]!==n||t[10]!==a||t[11]!==o?(C=()=>{w.current?E(w_.createElements(n,a,o,!1)):w.current=!0},S=[n,o,a,E],t[8]=E,t[9]=n,t[10]=a,t[11]=o,t[12]=C,t[13]=S):(C=t[12],S=t[13]),r.useEffect(C,S),t[14]!==v||t[15]!==c||t[16]!==h?(j=()=>{if(v){const e=c.filter((e=>{const{source:t,target:n,data:o}=e;return t===v&&"outputs"===o.direction||n===v&&"inputs"===o.direction}));h(e)}},_=[v,h,c],t[14]=v,t[15]=c,t[16]=h,t[17]=j,t[18]=_):(j=t[17],_=t[18]),r.useEffect(j,_);const I=function(e,t){const n=m(17);let o,r;if(n[0]!==t||n[1]!==e){let o;n[3]!==t?(o=(e,n)=>{const{position:o}=n;return Math.min(e,o.y-t/2-10)},n[3]=t,n[4]=o):o=n[4],r=e.reduce(o,Number.POSITIVE_INFINITY),n[0]=t,n[1]=e,n[2]=r}else r=n[2];const a=r;let s;if(n[5]!==t||n[6]!==e){let o;n[8]!==t?(o=(e,n)=>{const{position:o}=n;return Math.max(e,o.y+t/2+10)},n[8]=t,n[9]=o):o=n[9],s=e.reduce(o,Number.NEGATIVE_INFINITY),n[5]=t,n[6]=e,n[7]=s}else s=n[7];const i=s;let l,c,d;n[10]!==a?(l=[Number.NEGATIVE_INFINITY,a],n[10]=a,n[11]=l):l=n[11];n[12]!==i?(c=[Number.POSITIVE_INFINITY,i],n[12]=i,n[13]=c):c=n[13];n[14]!==l||n[15]!==c?(d=[l,c],n[14]=l,n[15]=c,n[16]=d):d=n[16];return o=d,o}(f,k);let A;t[19]===Symbol.for("react.memo_cache_sentinel")?(A=()=>{x(void 0),b(void 0)},t[19]=A):A=t[19];const M=A;let T;t[20]!==y||t[21]!==o||t[22]!==u||t[23]!==v?(T=()=>y?p.jsx(g_,{selection:{type:"edge",source:y.source,target:y.target},onClearSelection:M,variables:o,edges:u}):v?p.jsx(g_,{selection:{type:"node",id:v},variables:o,edges:u,onClearSelection:M}):null,t[20]=y,t[21]=o,t[22]=u,t[23]=v,t[24]=T):T=t[24];const O=T;let D,P,R,F;return t[25]!==h?(D=(e,t)=>{const n=t.id;x(n),b(void 0),h([])},t[25]=h,t[26]=D):D=t[26],t[27]===Symbol.for("react.memo_cache_sentinel")?(P=(e,t)=>{b(t)},t[27]=P):P=t[27],t[28]!==O?(R=O(),t[28]=O,t[29]=R):R=t[29],t[30]!==f||t[31]!==u||t[32]!==I||t[33]!==D||t[34]!==R||t[35]!==s?(F=p.jsxs(Bj,{nodes:f,edges:u,nodeTypes:u_,translateExtent:I,onNodeClick:D,onNodeDoubleClick:E_,onEdgeClick:P,snapToGrid:!0,fitView:!0,elementsSelectable:!0,minZoom:1,maxZoom:1,draggable:!1,panOnScrollMode:FE.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:[R,s]}),t[30]=f,t[31]=u,t[32]=I,t[33]=D,t[34]=R,t[35]=s,t[36]=F):F=t[36],F};function N_(e){const{height:t}=e;return t}function E_(e,t){hs(t.id,"focus")}var C_="\0";function S_(e,t){e[t]?e[t]++:e[t]=1}function j_(e,t){--e[t]||delete e[t]}function __(e,t,n,o){var r=""+t,a=""+n;if(!e&&r>a){var s=r;r=a,a=s}return r+""+a+""+(void 0===o?"\0":o)}function I_(e,t){return __(e,t.v,t.w,t.name)}var A_=class{constructor(e){n(this,"_isDirected",!0),n(this,"_isMultigraph",!1),n(this,"_isCompound",!1),n(this,"_label"),n(this,"_defaultNodeLabelFn",(()=>{})),n(this,"_defaultEdgeLabelFn",(()=>{})),n(this,"_nodes",{}),n(this,"_in",{}),n(this,"_preds",{}),n(this,"_out",{}),n(this,"_sucs",{}),n(this,"_edgeObjs",{}),n(this,"_edgeLabels",{}),n(this,"_nodeCount",0),n(this,"_edgeCount",0),n(this,"_parent"),n(this,"_children"),e&&(this._isDirected=!Object.hasOwn(e,"directed")||e.directed,this._isMultigraph=!!Object.hasOwn(e,"multigraph")&&e.multigraph,this._isCompound=!!Object.hasOwn(e,"compound")&&e.compound),this._isCompound&&(this._parent={},this._children={},this._children[C_]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return this._defaultNodeLabelFn=e,"function"!=typeof e&&(this._defaultNodeLabelFn=()=>e),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var e=this;return this.nodes().filter((t=>0===Object.keys(e._in[t]).length))}sinks(){var e=this;return this.nodes().filter((t=>0===Object.keys(e._out[t]).length))}setNodes(e,t){var n=arguments,o=this;return e.forEach((function(e){n.length>1?o.setNode(e,t):o.setNode(e)})),this}setNode(e,t){return Object.hasOwn(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=C_,this._children[e]={},this._children[C_][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return Object.hasOwn(this._nodes,e)}removeNode(e){var t=this;if(Object.hasOwn(this._nodes,e)){var n=e=>t.removeEdge(t._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach((function(e){t.setParent(e)})),delete this._children[e]),Object.keys(this._in[e]).forEach(n),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(n),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(void 0===t)t=C_;else{for(var n=t+="";void 0!==n;n=this.parent(n))if(n===e)throw new Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var t=this._parent[e];if(t!==C_)return t}}children(e=C_){if(this._isCompound){var t=this._children[e];if(t)return Object.keys(t)}else{if(e===C_)return this.nodes();if(this.hasNode(e))return[]}}predecessors(e){var t=this._preds[e];if(t)return Object.keys(t)}successors(e){var t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){var t=this.predecessors(e);if(t){const o=new Set(t);for(var n of this.successors(e))o.add(n);return Array.from(o.values())}}isLeaf(e){return 0===(this.isDirected()?this.successors(e):this.neighbors(e)).length}filterNodes(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var n=this;Object.entries(this._nodes).forEach((function([n,o]){e(n)&&t.setNode(n,o)})),Object.values(this._edgeObjs).forEach((function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,n.edge(e))}));var o={};function r(e){var a=n.parent(e);return void 0===a||t.hasNode(a)?(o[e]=a,a):a in o?o[a]:r(a)}return this._isCompound&&t.nodes().forEach((e=>t.setParent(e,r(e)))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=e,"function"!=typeof e&&(this._defaultEdgeLabelFn=()=>e),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){var n=this,o=arguments;return e.reduce((function(e,r){return o.length>1?n.setEdge(e,r,t):n.setEdge(e,r),r})),this}setEdge(){var e,t,n,o,r=!1,a=arguments[0];"object"==typeof a&&null!==a&&"v"in a?(e=a.v,t=a.w,n=a.name,2===arguments.length&&(o=arguments[1],r=!0)):(e=a,t=arguments[1],n=arguments[3],arguments.length>2&&(o=arguments[2],r=!0)),e=""+e,t=""+t,void 0!==n&&(n=""+n);var s=__(this._isDirected,e,t,n);if(Object.hasOwn(this._edgeLabels,s))return r&&(this._edgeLabels[s]=o),this;if(void 0!==n&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(t),this._edgeLabels[s]=r?o:this._defaultEdgeLabelFn(e,t,n);var i=function(e,t,n,o){var r=""+t,a=""+n;if(!e&&r>a){var s=r;r=a,a=s}var i={v:r,w:a};o&&(i.name=o);return i}(this._isDirected,e,t,n);return e=i.v,t=i.w,Object.freeze(i),this._edgeObjs[s]=i,S_(this._preds[t],e),S_(this._sucs[e],t),this._in[t][s]=i,this._out[e][s]=i,this._edgeCount++,this}edge(e,t,n){var o=1===arguments.length?I_(this._isDirected,arguments[0]):__(this._isDirected,e,t,n);return this._edgeLabels[o]}edgeAsObj(){const e=this.edge(...arguments);return"object"!=typeof e?{label:e}:e}hasEdge(e,t,n){var o=1===arguments.length?I_(this._isDirected,arguments[0]):__(this._isDirected,e,t,n);return Object.hasOwn(this._edgeLabels,o)}removeEdge(e,t,n){var o=1===arguments.length?I_(this._isDirected,arguments[0]):__(this._isDirected,e,t,n),r=this._edgeObjs[o];return r&&(e=r.v,t=r.w,delete this._edgeLabels[o],delete this._edgeObjs[o],j_(this._preds[t],e),j_(this._sucs[e],t),delete this._in[t][o],delete this._out[e][o],this._edgeCount--),this}inEdges(e,t){var n=this._in[e];if(n){var o=Object.values(n);return t?o.filter((e=>e.v===t)):o}}outEdges(e,t){var n=this._out[e];if(n){var o=Object.values(n);return t?o.filter((e=>e.w===t)):o}}nodeEdges(e,t){var n=this.inEdges(e,t);if(n)return n.concat(this.outEdges(e,t))}},M_={Graph:A_,version:"2.2.4"},T_=A_,O_={write:function(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:D_(e),edges:P_(e)};void 0!==e.graph()&&(t.value=structuredClone(e.graph()));return t},read:function(e){var t=new T_(e.options).setGraph(e.value);return e.nodes.forEach((function(e){t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)})),e.edges.forEach((function(e){t.setEdge({v:e.v,w:e.w,name:e.name},e.value)})),t}};function D_(e){return e.nodes().map((function(t){var n=e.node(t),o=e.parent(t),r={v:t};return void 0!==n&&(r.value=n),void 0!==o&&(r.parent=o),r}))}function P_(e){return e.edges().map((function(t){var n=e.edge(t),o={v:t.v,w:t.w};return void 0!==t.name&&(o.name=t.name),void 0!==n&&(o.value=n),o}))}var R_=function(e){var t,n={},o=[];function r(o){Object.hasOwn(n,o)||(n[o]=!0,t.push(o),e.successors(o).forEach(r),e.predecessors(o).forEach(r))}return e.nodes().forEach((function(e){t=[],r(e),t.length&&o.push(t)})),o};var F_=class{constructor(){n(this,"_arr",[]),n(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map((function(e){return e.key}))}has(e){return Object.hasOwn(this._keyIndices,e)}priority(e){var t=this._keyIndices[e];if(void 0!==t)return this._arr[t].priority}min(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key}add(e,t){var n=this._keyIndices;if(e=String(e),!Object.hasOwn(n,e)){var o=this._arr,r=o.length;return n[e]=r,o.push({key:e,priority:t}),this._decrease(r),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){var n=this._keyIndices[e];if(t>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[n].priority+" New: "+t);this._arr[n].priority=t,this._decrease(n)}_heapify(e){var t=this._arr,n=2*e,o=n+1,r=e;n<t.length&&(r=t[n].priority<t[r].priority?n:r,o<t.length&&(r=t[o].priority<t[r].priority?o:r),r!==e&&(this._swap(e,r),this._heapify(r)))}_decrease(e){for(var t,n=this._arr,o=n[e].priority;0!==e&&!(n[t=e>>1].priority<o);)this._swap(e,t),e=t}_swap(e,t){var n=this._arr,o=this._keyIndices,r=n[e],a=n[t];n[e]=a,n[t]=r,o[a.key]=e,o[r.key]=t}},L_=F_,z_=function(e,t,n,o){return function(e,t,n,o){var r,a,s={},i=new L_,l=function(e){var t=e.v!==r?e.v:e.w,o=s[t],l=n(e),c=a.distance+l;if(l<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+l);c<o.distance&&(o.distance=c,o.predecessor=r,i.decrease(t,c))};e.nodes().forEach((function(e){var n=e===t?0:Number.POSITIVE_INFINITY;s[e]={distance:n},i.add(e,n)}));for(;i.size()>0&&(r=i.removeMin(),(a=s[r]).distance!==Number.POSITIVE_INFINITY);)o(r).forEach(l);return s}(e,String(t),n||B_,o||function(t){return e.outEdges(t)})},B_=()=>1;var U_=z_,V_=function(e,t,n){return e.nodes().reduce((function(o,r){return o[r]=U_(e,r,t,n),o}),{})};var $_=function(e){var t=0,n=[],o={},r=[];function a(s){var i=o[s]={onStack:!0,lowlink:t,index:t++};if(n.push(s),e.successors(s).forEach((function(e){Object.hasOwn(o,e)?o[e].onStack&&(i.lowlink=Math.min(i.lowlink,o[e].index)):(a(e),i.lowlink=Math.min(i.lowlink,o[e].lowlink))})),i.lowlink===i.index){var l,c=[];do{l=n.pop(),o[l].onStack=!1,c.push(l)}while(s!==l);r.push(c)}}return e.nodes().forEach((function(e){Object.hasOwn(o,e)||a(e)})),r};var G_=$_,H_=function(e){return G_(e).filter((function(t){return t.length>1||1===t.length&&e.hasEdge(t[0],t[0])}))};var W_=function(e,t,n){return function(e,t,n){var o={},r=e.nodes();return r.forEach((function(e){o[e]={},o[e][e]={distance:0},r.forEach((function(t){e!==t&&(o[e][t]={distance:Number.POSITIVE_INFINITY})})),n(e).forEach((function(n){var r=n.v===e?n.w:n.v,a=t(n);o[e][r]={distance:a,predecessor:e}}))})),r.forEach((function(e){var t=o[e];r.forEach((function(n){var a=o[n];r.forEach((function(n){var o=a[e],r=t[n],s=a[n],i=o.distance+r.distance;i<s.distance&&(s.distance=i,s.predecessor=r.predecessor)}))}))})),o}(e,t||q_,n||function(t){return e.outEdges(t)})},q_=()=>1;function Y_(e){var t={},n={},o=[];if(e.sinks().forEach((function r(a){if(Object.hasOwn(n,a))throw new K_;Object.hasOwn(t,a)||(n[a]=!0,t[a]=!0,e.predecessors(a).forEach(r),delete n[a],o.push(a))})),Object.keys(t).length!==e.nodeCount())throw new K_;return o}class K_ extends Error{constructor(){super(...arguments)}}var J_=Y_;Y_.CycleException=K_;var X_=J_;var Z_=function(e,t,n){Array.isArray(t)||(t=[t]);var o=e.isDirected()?t=>e.successors(t):t=>e.neighbors(t),r="post"===n?Q_:eI,a=[],s={};return t.forEach((t=>{if(!e.hasNode(t))throw new Error("Graph does not have node: "+t);r(t,o,s,a)})),a};function Q_(e,t,n,o){for(var r=[[e,!1]];r.length>0;){var a=r.pop();a[1]?o.push(a[0]):Object.hasOwn(n,a[0])||(n[a[0]]=!0,r.push([a[0],!0]),tI(t(a[0]),(e=>r.push([e,!1]))))}}function eI(e,t,n,o){for(var r=[e];r.length>0;){var a=r.pop();Object.hasOwn(n,a)||(n[a]=!0,o.push(a),tI(t(a),(e=>r.push(e))))}}function tI(e,t){for(var n=e.length;n--;)t(e[n],n,e);return e}var nI=Z_;var oI=Z_;var rI=A_,aI=F_;var sI={Graph:M_.Graph,json:O_,alg:{components:R_,dijkstra:z_,dijkstraAll:V_,findCycles:H_,floydWarshall:W_,isAcyclic:function(e){try{X_(e)}catch(t){if(t instanceof X_.CycleException)return!1;throw t}return!0},postorder:function(e,t){return nI(e,t,"post")},preorder:function(e,t){return oI(e,t,"pre")},prim:function(e,t){var n,o=new rI,r={},a=new aI;function s(e){var o=e.v===n?e.w:e.v,s=a.priority(o);if(void 0!==s){var i=t(e);i<s&&(r[o]=n,a.decrease(o,i))}}if(0===e.nodeCount())return o;e.nodes().forEach((function(e){a.add(e,Number.POSITIVE_INFINITY),o.setNode(e)})),a.decrease(e.nodes()[0],0);var i=!1;for(;a.size()>0;){if(n=a.removeMin(),Object.hasOwn(r,n))o.setEdge(n,r[n]);else{if(i)throw new Error("Input graph is not connected: "+e);i=!0}e.nodeEdges(n).forEach(s)}return o},tarjan:$_,topsort:J_},version:M_.version};function iI(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function lI(e,t){if("_next"!==e&&"_prev"!==e)return t}let cI=sI.Graph,dI=class{constructor(){let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return iI(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&iI(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,lI)),n=n._prev;return"["+e.join(", ")+"]"}};var uI=function(e,t){if(e.nodeCount()<=1)return[];let n=function(e,t){let n=new cI,o=0,r=0;e.nodes().forEach((e=>{n.setNode(e,{v:e,in:0,out:0})})),e.edges().forEach((e=>{let a=n.edge(e.v,e.w)||0,s=t(e),i=a+s;n.setEdge(e.v,e.w,i),r=Math.max(r,n.node(e.v).out+=s),o=Math.max(o,n.node(e.w).in+=s)}));let a=function(e){const t=[];for(let n=0;n<e;n++)t.push(n);return t}(r+o+3).map((()=>new dI)),s=o+1;return n.nodes().forEach((e=>{fI(a,s,n.node(e))})),{graph:n,buckets:a,zeroIdx:s}}(e,t||hI);return function(e,t,n){let o,r=[],a=t[t.length-1],s=t[0];for(;e.nodeCount();){for(;o=s.dequeue();)mI(e,t,n,o);for(;o=a.dequeue();)mI(e,t,n,o);if(e.nodeCount())for(let a=t.length-2;a>0;--a)if(o=t[a].dequeue(),o){r=r.concat(mI(e,t,n,o,!0));break}}return r}(n.graph,n.buckets,n.zeroIdx).flatMap((t=>e.outEdges(t.v,t.w)))};let hI=()=>1;function mI(e,t,n,o,r){let a=r?[]:void 0;return e.inEdges(o.v).forEach((o=>{let s=e.edge(o),i=e.node(o.v);r&&a.push({v:o.v,w:o.w}),i.out-=s,fI(t,n,i)})),e.outEdges(o.v).forEach((o=>{let r=e.edge(o),a=o.w,s=e.node(a);s.in-=r,fI(t,n,s)})),e.removeNode(o.v),a}function fI(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}let pI=sI.Graph;var gI={addBorderNode:function(e,t,n,o){let r={width:0,height:0};arguments.length>=4&&(r.rank=n,r.order=o);return vI(e,"border",r,t)},addDummyNode:vI,applyWithChunking:yI,asNonCompoundGraph:function(e){let t=new pI({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach((n=>{e.children(n).length||t.setNode(n,e.node(n))})),e.edges().forEach((n=>{t.setEdge(n,e.edge(n))})),t},buildLayerMatrix:function(e){let t=NI(bI(e)+1).map((()=>[]));return e.nodes().forEach((n=>{let o=e.node(n),r=o.rank;void 0!==r&&(t[r][o.order]=n)})),t},intersectRect:function(e,t){let n,o,r=e.x,a=e.y,s=t.x-r,i=t.y-a,l=e.width/2,c=e.height/2;if(!s&&!i)throw new Error("Not possible to find intersection inside of the rectangle");Math.abs(i)*l>Math.abs(s)*c?(i<0&&(c=-c),n=c*s/i,o=c):(s<0&&(l=-l),n=l,o=l*i/s);return{x:r+n,y:a+o}},mapValues:function(e,t){let n=t;"string"==typeof t&&(n=e=>e[t]);return Object.entries(e).reduce(((e,[t,o])=>(e[t]=n(o,t),e)),{})},maxRank:bI,normalizeRanks:function(e){let t=e.nodes().map((t=>{let n=e.node(t).rank;return void 0===n?Number.MAX_VALUE:n})),n=yI(Math.min,t);e.nodes().forEach((t=>{let o=e.node(t);Object.hasOwn(o,"rank")&&(o.rank-=n)}))},notime:function(e,t){return t()},partition:function(e,t){let n={lhs:[],rhs:[]};return e.forEach((e=>{t(e)?n.lhs.push(e):n.rhs.push(e)})),n},pick:function(e,t){const n={};for(const o of t)void 0!==e[o]&&(n[o]=e[o]);return n},predecessorWeights:function(e){let t=e.nodes().map((t=>{let n={};return e.inEdges(t).forEach((t=>{n[t.v]=(n[t.v]||0)+e.edge(t).weight})),n}));return EI(e.nodes(),t)},range:NI,removeEmptyRanks:function(e){let t=e.nodes().map((t=>e.node(t).rank)),n=yI(Math.min,t),o=[];e.nodes().forEach((t=>{let r=e.node(t).rank-n;o[r]||(o[r]=[]),o[r].push(t)}));let r=0,a=e.graph().nodeRankFactor;Array.from(o).forEach(((t,n)=>{void 0===t&&n%a!=0?--r:void 0!==t&&r&&t.forEach((t=>e.node(t).rank+=r))}))},simplify:function(e){let t=(new pI).setGraph(e.graph());return e.nodes().forEach((n=>t.setNode(n,e.node(n)))),e.edges().forEach((n=>{let o=t.edge(n.v,n.w)||{weight:0,minlen:1},r=e.edge(n);t.setEdge(n.v,n.w,{weight:o.weight+r.weight,minlen:Math.max(o.minlen,r.minlen)})})),t},successorWeights:function(e){let t=e.nodes().map((t=>{let n={};return e.outEdges(t).forEach((t=>{n[t.w]=(n[t.w]||0)+e.edge(t).weight})),n}));return EI(e.nodes(),t)},time:function(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}},uniqueId:kI,zipObject:EI};function vI(e,t,n,o){let r;do{r=kI(o)}while(e.hasNode(r));return n.dummy=t,e.setNode(r,n),r}const xI=65535;function yI(e,t){if(t.length>xI){const n=function(e,t=xI){const n=[];for(let o=0;o<e.length;o+=t){const r=e.slice(o,o+t);n.push(r)}return n}(t);return e.apply(null,n.map((t=>e.apply(null,t))))}return e.apply(null,t)}function bI(e){const t=e.nodes().map((t=>{let n=e.node(t).rank;return void 0===n?Number.MIN_VALUE:n}));return yI(Math.max,t)}let wI=0;function kI(e){var t=++wI;return toString(e)+t}function NI(e,t,n=1){null==t&&(t=e,e=0);let o=e=>e<t;n<0&&(o=e=>t<e);const r=[];for(let a=e;o(a);a+=n)r.push(a);return r}function EI(e,t){return e.reduce(((e,n,o)=>(e[n]=t[o],e)),{})}let CI=uI,SI=gI.uniqueId;var jI={run:function(e){("greedy"===e.graph().acyclicer?CI(e,(t=e,e=>t.edge(e).weight)):function(e){let t=[],n={},o={};function r(a){Object.hasOwn(o,a)||(o[a]=!0,n[a]=!0,e.outEdges(a).forEach((e=>{Object.hasOwn(n,e.w)?t.push(e):r(e.w)})),delete n[a])}return e.nodes().forEach(r),t}(e)).forEach((t=>{let n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,SI("rev"))}));var t},undo:function(e){e.edges().forEach((t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let o=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,o)}}))}};let _I=gI;var II={run:function(e){e.graph().dummyChains=[],e.edges().forEach((t=>function(e,t){let n,o,r,a=t.v,s=e.node(a).rank,i=t.w,l=e.node(i).rank,c=t.name,d=e.edge(t),u=d.labelRank;if(l===s+1)return;for(e.removeEdge(t),r=0,++s;s<l;++r,++s)d.points=[],o={width:0,height:0,edgeLabel:d,edgeObj:t,rank:s},n=_I.addDummyNode(e,"edge",o,"_d"),s===u&&(o.width=d.width,o.height=d.height,o.dummy="edge-label",o.labelpos=d.labelpos),e.setEdge(a,n,{weight:d.weight},c),0===r&&e.graph().dummyChains.push(n),a=n;e.setEdge(a,i,{weight:d.weight},c)}(e,t)))},undo:function(e){e.graph().dummyChains.forEach((t=>{let n,o=e.node(t),r=o.edgeLabel;for(e.setEdge(o.edgeObj,r);o.dummy;)n=e.successors(t)[0],e.removeNode(t),r.points.push({x:o.x,y:o.y}),"edge-label"===o.dummy&&(r.x=o.x,r.y=o.y,r.width=o.width,r.height=o.height),t=n,o=e.node(t)}))}};const{applyWithChunking:AI}=gI;var MI={longestPath:function(e){var t={};e.sources().forEach((function n(o){var r=e.node(o);if(Object.hasOwn(t,o))return r.rank;t[o]=!0;let a=e.outEdges(o).map((t=>null==t?Number.POSITIVE_INFINITY:n(t.w)-e.edge(t).minlen));var s=AI(Math.min,a);return s===Number.POSITIVE_INFINITY&&(s=0),r.rank=s}))},slack:function(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}};var TI=sI.Graph,OI=MI.slack,DI=function(e){var t,n,o=new TI({directed:!1}),r=e.nodes()[0],a=e.nodeCount();o.setNode(r,{});for(;PI(o,e)<a;)t=RI(o,e),n=o.hasNode(t.v)?OI(e,t):-OI(e,t),FI(o,e,n);return o};function PI(e,t){return e.nodes().forEach((function n(o){t.nodeEdges(o).forEach((r=>{var a=r.v,s=o===a?r.w:a;e.hasNode(s)||OI(t,r)||(e.setNode(s,{}),e.setEdge(o,s,{}),n(s))}))})),e.nodeCount()}function RI(e,t){return t.edges().reduce(((n,o)=>{let r=Number.POSITIVE_INFINITY;return e.hasNode(o.v)!==e.hasNode(o.w)&&(r=OI(t,o)),r<n[0]?[r,o]:n}),[Number.POSITIVE_INFINITY,null])[1]}function FI(e,t,n){e.nodes().forEach((e=>t.node(e).rank+=n))}var LI=DI,zI=MI.slack,BI=MI.longestPath,UI=sI.alg.preorder,VI=sI.alg.postorder,$I=gI.simplify,GI=HI;function HI(e){e=$I(e),BI(e);var t,n=LI(e);for(YI(n),WI(n,e);t=JI(n);)ZI(n,e,t,XI(n,e,t))}function WI(e,t){var n=VI(e,e.nodes());(n=n.slice(0,n.length-1)).forEach((n=>function(e,t,n){var o=e.node(n),r=o.parent;e.edge(n,r).cutvalue=qI(e,t,n)}(e,t,n)))}function qI(e,t,n){var o=e.node(n).parent,r=!0,a=t.edge(n,o),s=0;return a||(r=!1,a=t.edge(o,n)),s=a.weight,t.nodeEdges(n).forEach((a=>{var i,l,c=a.v===n,d=c?a.w:a.v;if(d!==o){var u=c===r,h=t.edge(a).weight;if(s+=u?h:-h,i=n,l=d,e.hasEdge(i,l)){var m=e.edge(n,d).cutvalue;s+=u?-m:m}}})),s}function YI(e,t){arguments.length<2&&(t=e.nodes()[0]),KI(e,{},1,t)}function KI(e,t,n,o,r){var a=n,s=e.node(o);return t[o]=!0,e.neighbors(o).forEach((r=>{Object.hasOwn(t,r)||(n=KI(e,t,n,r,o))})),s.low=a,s.lim=n++,r?s.parent=r:delete s.parent,n}function JI(e){return e.edges().find((t=>e.edge(t).cutvalue<0))}function XI(e,t,n){var o=n.v,r=n.w;t.hasEdge(o,r)||(o=n.w,r=n.v);var a=e.node(o),s=e.node(r),i=a,l=!1;return a.lim>s.lim&&(i=s,l=!0),t.edges().filter((t=>l===QI(e,e.node(t.v),i)&&l!==QI(e,e.node(t.w),i))).reduce(((e,n)=>zI(t,n)<zI(t,e)?n:e))}function ZI(e,t,n,o){var r=n.v,a=n.w;e.removeEdge(r,a),e.setEdge(o.v,o.w,{}),YI(e),WI(e,t),function(e,t){var n=e.nodes().find((e=>!t.node(e).parent)),o=UI(e,n);(o=o.slice(1)).forEach((n=>{var o=e.node(n).parent,r=t.edge(n,o),a=!1;r||(r=t.edge(o,n),a=!0),t.node(n).rank=t.node(o).rank+(a?r.minlen:-r.minlen)}))}(e,t)}function QI(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}HI.initLowLimValues=YI,HI.initCutValues=WI,HI.calcCutValue=qI,HI.leaveEdge=JI,HI.enterEdge=XI,HI.exchangeEdges=ZI;var eA=MI.longestPath,tA=DI,nA=GI,oA=function(e){switch(e.graph().ranker){case"network-simplex":default:aA(e);break;case"tight-tree":!function(e){eA(e),tA(e)}(e);break;case"longest-path":rA(e)}};var rA=eA;function aA(e){nA(e)}let sA=gI;function iA(e,t,n,o,r,a,s){let i=e.children(s);if(!i.length)return void(s!==t&&e.setEdge(t,s,{weight:0,minlen:n}));let l=sA.addBorderNode(e,"_bt"),c=sA.addBorderNode(e,"_bb"),d=e.node(s);e.setParent(l,s),d.borderTop=l,e.setParent(c,s),d.borderBottom=c,i.forEach((i=>{iA(e,t,n,o,r,a,i);let d=e.node(i),u=d.borderTop?d.borderTop:i,h=d.borderBottom?d.borderBottom:i,m=d.borderTop?o:2*o,f=u!==h?1:r-a[s]+1;e.setEdge(l,u,{weight:m,minlen:f,nestingEdge:!0}),e.setEdge(h,c,{weight:m,minlen:f,nestingEdge:!0})})),e.parent(s)||e.setEdge(t,l,{weight:0,minlen:r+a[s]})}let lA=gI;function cA(e,t,n,o,r,a){let s={width:0,height:0,rank:a,borderType:t},i=r[t][a-1],l=lA.addDummyNode(e,"border",s,n);r[t][a]=l,e.setParent(l,o),i&&e.setEdge(i,l,{weight:1})}function dA(e){e.nodes().forEach((t=>uA(e.node(t)))),e.edges().forEach((t=>uA(e.edge(t))))}function uA(e){let t=e.width;e.width=e.height,e.height=t}function hA(e){e.y=-e.y}function mA(e){let t=e.x;e.x=e.y,e.y=t}let fA=gI;let pA=gI.zipObject;function gA(e,t,n){let o=pA(n,n.map(((e,t)=>t))),r=t.flatMap((t=>e.outEdges(t).map((t=>({pos:o[t.w],weight:e.edge(t).weight}))).sort(((e,t)=>e.pos-t.pos)))),a=1;for(;a<n.length;)a<<=1;let s=2*a-1;a-=1;let i=new Array(s).fill(0),l=0;return r.forEach((e=>{let t=e.pos+a;i[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=i[t+1]),t=t-1>>1,i[t]+=e.weight;l+=e.weight*n})),l}let vA=gI;let xA=gI;function yA(e,t,n){let o;for(;t.length&&(o=t[t.length-1]).i<=n;)t.pop(),e.push(o.vs),n++;return n}let bA=function(e,t=[]){return t.map((t=>{let n=e.inEdges(t);if(n.length){let o=n.reduce(((t,n)=>{let o=e.edge(n),r=e.node(n.v);return{sum:t.sum+o.weight*r.order,weight:t.weight+o.weight}}),{sum:0,weight:0});return{v:t,barycenter:o.sum/o.weight,weight:o.weight}}return{v:t}}))},wA=function(e,t){let n={};return e.forEach(((e,t)=>{let o=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};void 0!==e.barycenter&&(o.barycenter=e.barycenter,o.weight=e.weight)})),t.edges().forEach((e=>{let t=n[e.v],o=n[e.w];void 0!==t&&void 0!==o&&(o.indegree++,t.out.push(n[e.w]))})),function(e){let t=[];function n(e){return t=>{t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&function(e,t){let n=0,o=0;e.weight&&(n+=e.barycenter*e.weight,o+=e.weight);t.weight&&(n+=t.barycenter*t.weight,o+=t.weight);e.vs=t.vs.concat(e.vs),e.barycenter=n/o,e.weight=o,e.i=Math.min(t.i,e.i),t.merged=!0}(e,t)}}function o(t){return n=>{n.in.push(t),0==--n.indegree&&e.push(n)}}for(;e.length;){let r=e.pop();t.push(r),r.in.reverse().forEach(n(r)),r.out.forEach(o(r))}return t.filter((e=>!e.merged)).map((e=>vA.pick(e,["vs","i","barycenter","weight"])))}(Object.values(n).filter((e=>!e.indegree)))},kA=function(e,t){let n=xA.partition(e,(e=>Object.hasOwn(e,"barycenter"))),o=n.lhs,r=n.rhs.sort(((e,t)=>t.i-e.i)),a=[],s=0,i=0,l=0;o.sort((c=!!t,(e,t)=>e.barycenter<t.barycenter?-1:e.barycenter>t.barycenter?1:c?t.i-e.i:e.i-t.i)),l=yA(a,r,l),o.forEach((e=>{l+=e.vs.length,a.push(e.vs),s+=e.barycenter*e.weight,i+=e.weight,l=yA(a,r,l)}));var c;let d={vs:a.flat(!0)};i&&(d.barycenter=s/i,d.weight=i);return d};var NA=function e(t,n,o,r){let a=t.children(n),s=t.node(n),i=s?s.borderLeft:void 0,l=s?s.borderRight:void 0,c={};i&&(a=a.filter((e=>e!==i&&e!==l)));let d=bA(t,a);d.forEach((n=>{if(t.children(n.v).length){let i=e(t,n.v,o,r);c[n.v]=i,Object.hasOwn(i,"barycenter")&&(s=i,void 0!==(a=n).barycenter?(a.barycenter=(a.barycenter*a.weight+s.barycenter*s.weight)/(a.weight+s.weight),a.weight+=s.weight):(a.barycenter=s.barycenter,a.weight=s.weight))}var a,s}));let u=wA(d,o);!function(e,t){e.forEach((e=>{e.vs=e.vs.flatMap((e=>t[e]?t[e].vs:e))}))}(u,c);let h=kA(u,r);if(i&&(h.vs=[i,h.vs,l].flat(!0),t.predecessors(i).length)){let e=t.node(t.predecessors(i)[0]),n=t.node(t.predecessors(l)[0]);Object.hasOwn(h,"barycenter")||(h.barycenter=0,h.weight=0),h.barycenter=(h.barycenter*h.weight+e.order+n.order)/(h.weight+2),h.weight+=2}return h};let EA=sI.Graph,CA=gI;let SA=function(e){let t={},n=e.nodes().filter((t=>!e.children(t).length)),o=n.map((t=>e.node(t).rank)),r=fA.applyWithChunking(Math.max,o),a=fA.range(r+1).map((()=>[]));return n.sort(((t,n)=>e.node(t).rank-e.node(n).rank)).forEach((function n(o){if(t[o])return;t[o]=!0;let r=e.node(o);a[r.rank].push(o),e.successors(o).forEach(n)})),a},jA=function(e,t){let n=0;for(let o=1;o<t.length;++o)n+=gA(e,t[o-1],t[o]);return n},_A=NA,IA=function(e,t,n){let o=function(e){var t;for(;e.hasNode(t=CA.uniqueId("_root")););return t}(e),r=new EA({compound:!0}).setGraph({root:o}).setDefaultNodeLabel((t=>e.node(t)));return e.nodes().forEach((a=>{let s=e.node(a),i=e.parent(a);(s.rank===t||s.minRank<=t&&t<=s.maxRank)&&(r.setNode(a),r.setParent(a,i||o),e[n](a).forEach((t=>{let n=t.v===a?t.w:t.v,o=r.edge(n,a),s=void 0!==o?o.weight:0;r.setEdge(n,a,{weight:e.edge(t).weight+s})})),Object.hasOwn(s,"minRank")&&r.setNode(a,{borderLeft:s.borderLeft[t],borderRight:s.borderRight[t]}))})),r},AA=function(e,t,n){let o,r={};n.forEach((n=>{let a,s,i=e.parent(n);for(;i;){if(a=e.parent(i),a?(s=r[a],r[a]=i):(s=o,o=i),s&&s!==i)return void t.setEdge(s,i);i=a}}))},MA=sI.Graph,TA=gI;var OA=function e(t,n){if(n&&"function"==typeof n.customOrder)return void n.customOrder(t,e);let o=TA.maxRank(t),r=DA(t,TA.range(1,o+1),"inEdges"),a=DA(t,TA.range(o-1,-1,-1),"outEdges"),s=SA(t);if(RA(t,s),n&&n.disableOptimalOrderHeuristic)return;let i,l=Number.POSITIVE_INFINITY;for(let c=0,d=0;d<4;++c,++d){PA(c%2?r:a,c%4>=2),s=TA.buildLayerMatrix(t);let e=jA(t,s);e<l&&(d=0,i=Object.assign({},s),l=e)}RA(t,i)};function DA(e,t,n){return t.map((function(t){return IA(e,t,n)}))}function PA(e,t){let n=new MA;e.forEach((function(e){let o=e.graph().root,r=_A(e,o,n,t);r.vs.forEach(((t,n)=>e.node(t).order=n)),AA(e,n,r.vs)}))}function RA(e,t){Object.values(t).forEach((t=>t.forEach(((t,n)=>e.node(t).order=n))))}let FA=sI.Graph,LA=gI;var zA=function(e){let t,n=LA.buildLayerMatrix(e),o=Object.assign(BA(e,n),UA(e,n)),r={};["u","d"].forEach((a=>{t="u"===a?n:Object.values(n).reverse(),["l","r"].forEach((n=>{"r"===n&&(t=t.map((e=>Object.values(e).reverse())));let s=("u"===a?e.predecessors:e.successors).bind(e),i=GA(e,t,o,s),l=HA(e,t,i.root,i.align,"r"===n);"r"===n&&(l=LA.mapValues(l,(e=>-e))),r[a+n]=l}))}));let a=WA(e,r);return qA(r,a),YA(r,e.graph().align)};function BA(e,t){let n={};return t.length&&t.reduce((function(t,o){let r=0,a=0,s=t.length,i=o[o.length-1];return o.forEach(((t,l)=>{let c=function(e,t){if(e.node(t).dummy)return e.predecessors(t).find((t=>e.node(t).dummy))}(e,t),d=c?e.node(c).order:s;(c||t===i)&&(o.slice(a,l+1).forEach((t=>{e.predecessors(t).forEach((o=>{let a=e.node(o),s=a.order;!(s<r||d<s)||a.dummy&&e.node(t).dummy||VA(n,o,t)}))})),a=l+1,r=d)})),o})),n}function UA(e,t){let n={};function o(t,o,r,a,s){let i;LA.range(o,r).forEach((o=>{i=t[o],e.node(i).dummy&&e.predecessors(i).forEach((t=>{let o=e.node(t);o.dummy&&(o.order<a||o.order>s)&&VA(n,t,i)}))}))}return t.length&&t.reduce((function(t,n){let r,a=-1,s=0;return n.forEach(((i,l)=>{if("border"===e.node(i).dummy){let t=e.predecessors(i);t.length&&(r=e.node(t[0]).order,o(n,s,l,a,r),s=l,a=r)}o(n,s,n.length,r,t.length)})),n})),n}function VA(e,t,n){if(t>n){let e=t;t=n,n=e}let o=e[t];o||(e[t]=o={}),o[n]=!0}function $A(e,t,n){if(t>n){let e=t;t=n,n=e}return!!e[t]&&Object.hasOwn(e[t],n)}function GA(e,t,n,o){let r={},a={},s={};return t.forEach((e=>{e.forEach(((e,t)=>{r[e]=e,a[e]=e,s[e]=t}))})),t.forEach((e=>{let t=-1;e.forEach((e=>{let i=o(e);if(i.length){i=i.sort(((e,t)=>s[e]-s[t]));let o=(i.length-1)/2;for(let l=Math.floor(o),c=Math.ceil(o);l<=c;++l){let o=i[l];a[e]===e&&t<s[o]&&!$A(n,e,o)&&(a[o]=e,a[e]=r[e]=r[o],t=s[o])}}}))})),{root:r,align:a}}function HA(e,t,n,o,r){let a={},s=function(e,t,n,o){let r=new FA,a=e.graph(),s=function(e,t,n){return(o,r,a)=>{let s,i=o.node(r),l=o.node(a),c=0;if(c+=i.width/2,Object.hasOwn(i,"labelpos"))switch(i.labelpos.toLowerCase()){case"l":s=-i.width/2;break;case"r":s=i.width/2}if(s&&(c+=n?s:-s),s=0,c+=(i.dummy?t:e)/2,c+=(l.dummy?t:e)/2,c+=l.width/2,Object.hasOwn(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":s=l.width/2;break;case"r":s=-l.width/2}return s&&(c+=n?s:-s),s=0,c}}(a.nodesep,a.edgesep,o);return t.forEach((t=>{let o;t.forEach((t=>{let a=n[t];if(r.setNode(a),o){var i=n[o],l=r.edge(i,a);r.setEdge(i,a,Math.max(s(e,t,o),l||0))}o=t}))})),r}(e,t,n,r),i=r?"borderLeft":"borderRight";function l(e,t){let n=s.nodes(),o=n.pop(),r={};for(;o;)r[o]?e(o):(r[o]=!0,n.push(o),n=n.concat(t(o))),o=n.pop()}return l((function(e){a[e]=s.inEdges(e).reduce(((e,t)=>Math.max(e,a[t.v]+s.edge(t))),0)}),s.predecessors.bind(s)),l((function(t){let n=s.outEdges(t).reduce(((e,t)=>Math.min(e,a[t.w]-s.edge(t))),Number.POSITIVE_INFINITY),o=e.node(t);n!==Number.POSITIVE_INFINITY&&o.borderType!==i&&(a[t]=Math.max(a[t],n))}),s.successors.bind(s)),Object.keys(o).forEach((e=>a[e]=a[n[e]])),a}function WA(e,t){return Object.values(t).reduce(((t,n)=>{let o=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY;Object.entries(n).forEach((([t,n])=>{let a=function(e,t){return e.node(t).width}(e,t)/2;o=Math.max(n+a,o),r=Math.min(n-a,r)}));const a=o-r;return a<t[0]&&(t=[a,n]),t}),[Number.POSITIVE_INFINITY,null])[1]}function qA(e,t){let n=Object.values(t),o=LA.applyWithChunking(Math.min,n),r=LA.applyWithChunking(Math.max,n);["u","d"].forEach((n=>{["l","r"].forEach((a=>{let s=n+a,i=e[s];if(i===t)return;let l=Object.values(i),c=o-LA.applyWithChunking(Math.min,l);"l"!==a&&(c=r-LA.applyWithChunking(Math.max,l)),c&&(e[s]=LA.mapValues(i,(e=>e+c)))}))}))}function YA(e,t){return LA.mapValues(e.ul,((n,o)=>{if(t)return e[t.toLowerCase()][o];{let t=Object.values(e).map((e=>e[o])).sort(((e,t)=>e-t));return(t[1]+t[2])/2}}))}let KA=gI,JA=zA;let XA=jI,ZA=II,QA=oA,eM=gI.normalizeRanks,tM=function(e){let t=function(e){let t={},n=0;function o(r){let a=n;e.children(r).forEach(o),t[r]={low:a,lim:n++}}return e.children().forEach(o),t}(e);e.graph().dummyChains.forEach((n=>{let o=e.node(n),r=o.edgeObj,a=function(e,t,n,o){let r,a,s=[],i=[],l=Math.min(t[n].low,t[o].low),c=Math.max(t[n].lim,t[o].lim);r=n;do{r=e.parent(r),s.push(r)}while(r&&(t[r].low>l||c>t[r].lim));a=r,r=o;for(;(r=e.parent(r))!==a;)i.push(r);return{path:s.concat(i.reverse()),lca:a}}(e,t,r.v,r.w),s=a.path,i=a.lca,l=0,c=s[l],d=!0;for(;n!==r.w;){if(o=e.node(n),d){for(;(c=s[l])!==i&&e.node(c).maxRank<o.rank;)l++;c===i&&(d=!1)}if(!d){for(;l<s.length-1&&e.node(c=s[l+1]).minRank<=o.rank;)l++;c=s[l]}e.setParent(n,c),n=e.successors(n)[0]}}))},nM=gI.removeEmptyRanks,oM={run:function(e){let t=sA.addDummyNode(e,"root",{},"_root"),n=function(e){var t={};function n(o,r){var a=e.children(o);a&&a.length&&a.forEach((e=>n(e,r+1))),t[o]=r}return e.children().forEach((e=>n(e,1))),t}(e),o=Object.values(n),r=sA.applyWithChunking(Math.max,o)-1,a=2*r+1;e.graph().nestingRoot=t,e.edges().forEach((t=>e.edge(t).minlen*=a));let s=function(e){return e.edges().reduce(((t,n)=>t+e.edge(n).weight),0)}(e)+1;e.children().forEach((o=>iA(e,t,a,s,r,n,o))),e.graph().nodeRankFactor=a},cleanup:function(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach((t=>{e.edge(t).nestingEdge&&e.removeEdge(t)}))}},rM=function(e){e.children().forEach((function t(n){let o=e.children(n),r=e.node(n);if(o.length&&o.forEach(t),Object.hasOwn(r,"minRank")){r.borderLeft=[],r.borderRight=[];for(let t=r.minRank,o=r.maxRank+1;t<o;++t)cA(e,"borderLeft","_bl",n,r,t),cA(e,"borderRight","_br",n,r,t)}}))},aM={adjust:function(e){let t=e.graph().rankdir.toLowerCase();"lr"!==t&&"rl"!==t||dA(e)},undo:function(e){let t=e.graph().rankdir.toLowerCase();"bt"!==t&&"rl"!==t||function(e){e.nodes().forEach((t=>hA(e.node(t)))),e.edges().forEach((t=>{let n=e.edge(t);n.points.forEach(hA),Object.hasOwn(n,"y")&&hA(n)}))}(e);"lr"!==t&&"rl"!==t||(!function(e){e.nodes().forEach((t=>mA(e.node(t)))),e.edges().forEach((t=>{let n=e.edge(t);n.points.forEach(mA),Object.hasOwn(n,"x")&&mA(n)}))}(e),dA(e))}},sM=OA,iM=function(e){(function(e){let t=KA.buildLayerMatrix(e),n=e.graph().ranksep,o=0;t.forEach((t=>{const r=t.reduce(((t,n)=>{const o=e.node(n).height;return t>o?t:o}),0);t.forEach((t=>e.node(t).y=o+r/2)),o+=r+n}))})(e=KA.asNonCompoundGraph(e)),Object.entries(JA(e)).forEach((([t,n])=>e.node(t).x=n))},lM=gI,cM=sI.Graph;var dM=function(e,t){let n=t&&t.debugTiming?lM.time:lM.notime;n("layout",(()=>{let o=n(" buildLayoutGraph",(()=>function(e){let t=new cM({multigraph:!0,compound:!0}),n=bM(e.graph());return t.setGraph(Object.assign({},hM,yM(n,uM),lM.pick(n,mM))),e.nodes().forEach((n=>{const o=yM(bM(e.node(n)),fM);Object.keys(pM).forEach((e=>{void 0===o[e]&&(o[e]=pM[e])})),t.setNode(n,o),t.setParent(n,e.parent(n))})),e.edges().forEach((n=>{let o=bM(e.edge(n));t.setEdge(n,Object.assign({},vM,yM(o,gM),lM.pick(o,xM)))})),t}(e)));n(" runLayout",(()=>function(e,t,n){t(" makeSpaceForEdgeLabels",(()=>function(e){let t=e.graph();t.ranksep/=2,e.edges().forEach((n=>{let o=e.edge(n);o.minlen*=2,"c"!==o.labelpos.toLowerCase()&&("TB"===t.rankdir||"BT"===t.rankdir?o.width+=o.labeloffset:o.height+=o.labeloffset)}))}(e))),t(" removeSelfEdges",(()=>function(e){e.edges().forEach((t=>{if(t.v===t.w){var n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}}))}(e))),t(" acyclic",(()=>XA.run(e))),t(" nestingGraph.run",(()=>oM.run(e))),t(" rank",(()=>QA(lM.asNonCompoundGraph(e)))),t(" injectEdgeLabelProxies",(()=>function(e){e.edges().forEach((t=>{let n=e.edge(t);if(n.width&&n.height){let n=e.node(t.v),o={rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t};lM.addDummyNode(e,"edge-proxy",o,"_ep")}}))}(e))),t(" removeEmptyRanks",(()=>nM(e))),t(" nestingGraph.cleanup",(()=>oM.cleanup(e))),t(" normalizeRanks",(()=>eM(e))),t(" assignRankMinMax",(()=>function(e){let t=0;e.nodes().forEach((n=>{let o=e.node(n);o.borderTop&&(o.minRank=e.node(o.borderTop).rank,o.maxRank=e.node(o.borderBottom).rank,t=Math.max(t,o.maxRank))})),e.graph().maxRank=t}(e))),t(" removeEdgeLabelProxies",(()=>function(e){e.nodes().forEach((t=>{let n=e.node(t);"edge-proxy"===n.dummy&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))}))}(e))),t(" normalize.run",(()=>ZA.run(e))),t(" parentDummyChains",(()=>tM(e))),t(" addBorderSegments",(()=>rM(e))),t(" order",(()=>sM(e,n))),t(" insertSelfEdges",(()=>function(e){var t=lM.buildLayerMatrix(e);t.forEach((t=>{var n=0;t.forEach(((t,o)=>{var r=e.node(t);r.order=o+n,(r.selfEdges||[]).forEach((t=>{lM.addDummyNode(e,"selfedge",{width:t.label.width,height:t.label.height,rank:r.rank,order:o+ ++n,e:t.e,label:t.label},"_se")})),delete r.selfEdges}))}))}(e))),t(" adjustCoordinateSystem",(()=>aM.adjust(e))),t(" position",(()=>iM(e))),t(" positionSelfEdges",(()=>function(e){e.nodes().forEach((t=>{var n=e.node(t);if("selfedge"===n.dummy){var o=e.node(n.e.v),r=o.x+o.width/2,a=o.y,s=n.x-r,i=o.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:r+2*s/3,y:a-i},{x:r+5*s/6,y:a-i},{x:r+s,y:a},{x:r+5*s/6,y:a+i},{x:r+2*s/3,y:a+i}],n.label.x=n.x,n.label.y=n.y}}))}(e))),t(" removeBorderNodes",(()=>function(e){e.nodes().forEach((t=>{if(e.children(t).length){let n=e.node(t),o=e.node(n.borderTop),r=e.node(n.borderBottom),a=e.node(n.borderLeft[n.borderLeft.length-1]),s=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(s.x-a.x),n.height=Math.abs(r.y-o.y),n.x=a.x+n.width/2,n.y=o.y+n.height/2}})),e.nodes().forEach((t=>{"border"===e.node(t).dummy&&e.removeNode(t)}))}(e))),t(" normalize.undo",(()=>ZA.undo(e))),t(" fixupEdgeLabelCoords",(()=>function(e){e.edges().forEach((t=>{let n=e.edge(t);if(Object.hasOwn(n,"x"))switch("l"!==n.labelpos&&"r"!==n.labelpos||(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset}}))}(e))),t(" undoCoordinateSystem",(()=>aM.undo(e))),t(" translateGraph",(()=>function(e){let t=Number.POSITIVE_INFINITY,n=0,o=Number.POSITIVE_INFINITY,r=0,a=e.graph(),s=a.marginx||0,i=a.marginy||0;function l(e){let a=e.x,s=e.y,i=e.width,l=e.height;t=Math.min(t,a-i/2),n=Math.max(n,a+i/2),o=Math.min(o,s-l/2),r=Math.max(r,s+l/2)}e.nodes().forEach((t=>l(e.node(t)))),e.edges().forEach((t=>{let n=e.edge(t);Object.hasOwn(n,"x")&&l(n)})),t-=s,o-=i,e.nodes().forEach((n=>{let r=e.node(n);r.x-=t,r.y-=o})),e.edges().forEach((n=>{let r=e.edge(n);r.points.forEach((e=>{e.x-=t,e.y-=o})),Object.hasOwn(r,"x")&&(r.x-=t),Object.hasOwn(r,"y")&&(r.y-=o)})),a.width=n-t+s,a.height=r-o+i}(e))),t(" assignNodeIntersects",(()=>function(e){e.edges().forEach((t=>{let n,o,r=e.edge(t),a=e.node(t.v),s=e.node(t.w);r.points?(n=r.points[0],o=r.points[r.points.length-1]):(r.points=[],n=s,o=a),r.points.unshift(lM.intersectRect(a,n)),r.points.push(lM.intersectRect(s,o))}))}(e))),t(" reversePoints",(()=>function(e){e.edges().forEach((t=>{let n=e.edge(t);n.reversed&&n.points.reverse()}))}(e))),t(" acyclic.undo",(()=>XA.undo(e)))}(o,n,t))),n(" updateInputGraph",(()=>function(e,t){e.nodes().forEach((n=>{let o=e.node(n),r=t.node(n);o&&(o.x=r.x,o.y=r.y,o.rank=r.rank,t.children(n).length&&(o.width=r.width,o.height=r.height))})),e.edges().forEach((n=>{let o=e.edge(n),r=t.edge(n);o.points=r.points,Object.hasOwn(r,"x")&&(o.x=r.x,o.y=r.y)})),e.graph().width=t.graph().width,e.graph().height=t.graph().height}(e,o)))}))};let uM=["nodesep","edgesep","ranksep","marginx","marginy"],hM={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},mM=["acyclicer","ranker","rankdir","align"],fM=["width","height"],pM={width:0,height:0},gM=["minlen","weight","width","height","labeloffset"],vM={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},xM=["labelpos"];function yM(e,t){return lM.mapValues(lM.pick(e,t),Number)}function bM(e){var t={};return e&&Object.entries(e).forEach((([e,n])=>{"string"==typeof e&&(e=e.toLowerCase()),t[e]=n})),t}let wM=gI,kM=sI.Graph;var NM={graphlib:sI,layout:dM,debug:{debugOrdering:function(e){let t=wM.buildLayerMatrix(e),n=new kM({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach((t=>{n.setNode(t,{label:t}),n.setParent(t,"layer"+e.node(t).rank)})),e.edges().forEach((e=>n.setEdge(e.v,e.w,{},e.name))),t.forEach(((e,t)=>{let o="layer"+t;n.setNode(o,{rank:"same"}),e.reduce(((e,t)=>(n.setEdge(e,t,{style:"invis"}),t)))})),n}},util:{time:gI.time,notime:gI.notime},version:"1.1.4"};const EM=(new NM.graphlib.Graph).setDefaultEdgeLabel((()=>({}))),CM=(e,t,n)=>(EM.setGraph({rankdir:n.direction,nodesep:150,ranksep:200,ranker:"longest-path"}),t.forEach((e=>EM.setEdge(e.source,e.target))),e.forEach((e=>EM.setNode(e.id,{...e,width:e.width??0,height:e.height??0}))),NM.layout(EM),{nodes:e.map((e=>{const{x:t,y:n}=EM.node(e.id);return{...e,position:{x:t,y:n}}})),edges:t}),SM=new class{createEdge(e,t){return{animated:!0,markerEnd:{type:$E.ArrowClosed},id:`${e}-${t}`,style:{strokeWidth:2},source:e,sourceHandle:"outputs",targetHandle:"inputs",target:t}}createNode(e,t){return{id:e,data:{atom:t,forceWidth:300},width:300,type:"custom",height:l_(Y.get(t).code.trim().split("\n").length),position:{x:0,y:0}}}createElements(e,t,n,o){const r=[],a=[],s=new Set,i=new Set;for(const l of Object.values(n)){if("marimo"===l.value&&"mo"===l.name)continue;const{declaredBy:e,usedBy:t}=l;for(const n of e)for(const e of t){const t=`${n}-${e}`;i.has(t)||(i.add(t),s.add(n),s.add(e),a.push(this.createEdge(n,e)))}}for(const[l,c]of Na.zip(e,t)){o||r.push(this.createNode(l,c));const e=s.has(l),t=Y.get(c).code.trim().startsWith("mo.md");!e&&t||r.push(this.createNode(l,c))}return{nodes:r,edges:a}}},jM=({cellIds:e,variables:t,cellAtoms:n,children:o,layoutDirection:a,settings:s})=>{const i=r.useMemo((()=>{let o=SM.createElements(e,n,t,s.hidePureMarkdown);return o=CM(o.nodes,o.edges,{direction:a}),o}),[]),[l,c,d]=Vj(i.nodes),[u,h,m]=$j(i.edges),f=fS(),g=z((e=>{const t=CM(e.nodes,e.edges,{direction:a});c(t.nodes),h(t.edges)}));r.useEffect((()=>{g(SM.createElements(e,n,t,s.hidePureMarkdown))}),[e,t,n,g,s.hidePureMarkdown]);const[x,y]=r.useState();x_();return p.jsx(c_.Provider,{value:a,children:p.jsxs(Bj,{nodes:l,edges:u,nodeTypes:u_,minZoom:.2,fitViewOptions:{minZoom:.5,maxZoom:1.5},onNodeClick:(e,t)=>{y({type:"node",id:t.id})},onEdgeClick:(e,t)=>{const{source:n,target:o}=t;y({type:"edge",source:n,target:o})},onNodeDoubleClick:(e,t)=>{hs(t.id,"focus")},fitView:!0,onNodesChange:d,onEdgesChange:m,zoomOnDoubleClick:!1,nodesConnectable:!1,children:[p.jsx(i_,{color:"#ccc",variant:Zj.Dots}),p.jsx(e_,{position:"bottom-right",showInteractive:!1,children:p.jsx(v,{content:"Jump to focused cell",delayDuration:200,side:"left",asChild:!1,children:p.jsx(Kj,{onMouseDown:qe.preventFocus,onClick:()=>{const e=Y.get(pd);if(e){const t=l.find((t=>t.id===e));t&&(f.fitView({padding:1,duration:600,nodes:[t]}),y({type:"node",id:e}))}},children:p.jsx(sc,{className:"size-4"})})})}),p.jsx(g_,{selection:x,variables:t,edges:u,onClearSelection:()=>{y(void 0)}}),o]})})},_M=H("_minimap_"),IM=H({hidePureMarkdown:!0}),AM=e=>{const t=m(11),[n,o]=Ie(_M),[r,a]=Ie(IM);let s;t[0]!==n||t[1]!==e||t[2]!==r||t[3]!==a||t[4]!==o?(s=()=>"_minimap_"===n?p.jsx(k_,{...e,children:p.jsx(p_,{settings:r,onSettingsChange:a,view:n,onChange:o})}):p.jsx(jM,{...e,settings:r,layoutDirection:n,children:p.jsx(p_,{settings:r,onSettingsChange:a,view:n,onChange:o})}),t[0]=n,t[1]=e,t[2]=r,t[3]=a,t[4]=o,t[5]=s):s=t[5];const i=s;let l,c;return t[6]!==i?(l=i(),t[6]=i,t[7]=l):l=t[7],t[8]!==n||t[9]!==l?(c=p.jsx(Tj,{children:l},n),t[8]=n,t[9]=l,t[10]=c):c=t[10],c},MM=()=>{const e=m(5),t=ms(),n=ae(),[o]=fs();let r,a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=Jt("w-full h-full flex-1 mx-auto -mb-4 relative"),e[0]=r):r=e[0],e[1]!==o||e[2]!==t||e[3]!==n.inOrderIds?(a=p.jsx("div",{className:r,children:p.jsx(AM,{cellAtoms:o,variables:t,cellIds:n.inOrderIds})}),e[1]=o,e[2]=t,e[3]=n.inOrderIds,e[4]=a):a=e[4],a};const TM="name",OM="type-value",DM="defs-refs",PM=[{id:TM,accessorFn:e=>[e.name,e.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:e})=>p.jsx(Is,{header:"Name",column:e}),cell:({getValue:e})=>{const[t,n]=e();return p.jsx(f_,{name:t,declaredBy:n})}},{id:OM,accessorFn:e=>[e.dataType,e.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:e})=>p.jsx(Is,{header:p.jsxs("div",{className:"flex flex-col gap-1",children:[p.jsx("span",{children:"Type"}),p.jsx("span",{children:"Value"})]}),column:e}),cell:({getValue:e})=>{const[t,n]=e();return p.jsxs("div",{className:"max-w-[150px]",children:[p.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs",children:t}),p.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap",title:n??"",children:n})]})}},{id:DM,accessorFn:e=>[e.declaredBy,e.usedBy,e.name,e.declaredByNames,e.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:e})=>p.jsx(Is,{header:p.jsxs("div",{className:"flex flex-col gap-1",children:[p.jsx("span",{children:"Declared By"}),p.jsx("span",{children:"Used By"})]}),column:e}),cell:({getValue:e})=>{const[t,n,o]=e(),r=e=>{const t=Br(e);t&&ds(t,o)};return p.jsxs("div",{className:"flex flex-col gap-1 py-1",children:[p.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-center",children:[p.jsx("span",{title:"Declared by",children:p.jsx(Ic,{className:"w-3.5 h-3.5 text-muted-foreground"})}),1===t.length?p.jsx(ls,{variant:"focus",cellId:t[0],skipScroll:!0,onClick:()=>r(t[0])}):p.jsx("div",{className:"text-destructive flex flex-row gap-2",children:t.slice(0,3).map(((e,n)=>p.jsxs("span",{className:"flex",children:[p.jsx(ls,{variant:"focus",cellId:e,skipScroll:!0,className:"whitespace-nowrap text-destructive",onClick:()=>r(e)},e),n<t.length-1&&", "]},e)))})]}),p.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-baseline",children:[p.jsx("span",{title:"Used by",children:p.jsx(Bc,{className:"w-3.5 h-3.5 text-muted-foreground"})}),p.jsx(m_,{maxCount:3,cellIds:n,skipScroll:!0,onClick:r})]})]})}}];const RM=r.memo((({className:e,cellIds:t,variables:n})=>{const[o,a]=u.useState([]),[s,i]=u.useState(""),l=ps(),c=r.useMemo((()=>{const e=e=>{const n=l[e];return n===_s?`cell-${t.indexOf(e)}`:n??`cell-${t.indexOf(e)}`};return Object.values(n).map((t=>({...t,declaredByNames:t.declaredBy.map(e),usedByNames:t.usedBy.map(e)})))}),[n,l,t]),d=r.useMemo((()=>{const e=new Map;return t.forEach(((t,n)=>e.set(t,n))),function(e,t,n){t||(t={id:DM,desc:!1});let o=[];switch(t.id){case TM:o=Sl(e,(e=>e.name));break;case OM:o=Sl(e,(e=>e.dataType));break;case DM:o=Sl(e,(e=>n.get(e.declaredBy[0])))}return t.desc?o.reverse():o}(c,o[0],e)}),[c,o,t]),h=gs({data:d,columns:PM,getCoreRowModel:vs(),onGlobalFilterChange:i,getFilteredRowModel:xs(),enableFilters:!0,enableGlobalFilter:!0,getColumnCanGlobalFilter:e=>e.columnDef.enableGlobalFilter??!0,globalFilterFn:"auto",manualSorting:!0,onSortingChange:a,getSortedRowModel:ys(),state:{sorting:o,globalFilter:s}});return p.jsxs(p.Fragment,{children:[p.jsx(bs,{className:"w-full",placeholder:"Search",value:s,onChange:e=>i(e.target.value)}),p.jsxs(ws,{className:Jt("w-full text-sm flex-1 border-separate border-spacing-0",e),children:[p.jsx(ks,{children:p.jsx(Ns,{className:"whitespace-nowrap text-xs",children:h.getFlatHeaders().map((e=>p.jsx(Es,{className:"sticky top-0 bg-background border-b",children:Cs(e.column.columnDef.header,e.getContext())},e.id)))})}),p.jsx(Ss,{children:h.getRowModel().rows.map((e=>p.jsx(Ns,{className:"hover:bg-accent",children:e.getVisibleCells().map((e=>p.jsx(js,{className:"border-b",children:Cs(e.column.columnDef.cell,e.getContext())},e.id)))},e.id)))})]})]})}));RM.displayName="VariableTable";const FM=()=>{const e=m(4),t=ms(),n=ae();if(0===Object.keys(t).length){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=p.jsx(xN,{title:"No variables",description:"Global variables will appear here.",icon:p.jsx(tt,{})}),e[0]=t):t=e[0],t}let o;return e[1]!==n.inOrderIds||e[2]!==t?(o=p.jsx(RM,{className:"flex-1",cellIds:n.inOrderIds,variables:t}),e[1]=n.inOrderIds,e[2]=t,e[3]=o):o=e[3],o},LM=()=>{const e=m(9),t=As(),{clearLogs:n}=B();if(0===t.length){let t,n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=p.jsx("code",{className:"border rounded px-1",children:"stdout"}),e[0]=t):t=e[0],e[1]===Symbol.for("react.memo_cache_sentinel")?(n=p.jsx(xN,{title:"No logs",description:p.jsxs("span",{children:[t," and"," ",p.jsx("code",{className:"border rounded px-1",children:"stderr"})," logs will appear here."]}),icon:p.jsx(nt,{})}),e[1]=n):n=e[1],n}let o,r,a;return e[2]!==n?(o=p.jsx("div",{className:"flex flex-row justify-end px-2 py-1",children:p.jsx("button",{"data-testid":"clear-logs-button",className:"text-xs font-semibold text-accent-foreground",onClick:n,children:"Clear"})}),e[2]=n,e[3]=o):o=e[3],e[4]!==t?(r=p.jsx("div",{className:"overflow-auto flex-1",children:p.jsx(zM,{logs:t,className:"min-w-[300px]"})}),e[4]=t,e[5]=r):r=e[5],e[6]!==o||e[7]!==r?(a=p.jsxs(p.Fragment,{children:[o,r]}),e[6]=o,e[7]=r,e[8]=a):a=e[8],a},zM=e=>{const t=m(11),{logs:n,className:o}=e;let r,a,s,i,l;if(t[0]!==o?(r=Jt("flex flex-col",o),t[0]=o,t[1]=r):r=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(a={whiteSpace:"pre-wrap"},t[2]=a):a=t[2],t[3]!==n){let e;t[5]===Symbol.for("react.memo_cache_sentinel")?(e=(e,t)=>p.jsxs("div",{className:"contents group",children:[p.jsx("span",{className:Jt("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","text-right col-span-1 py-1 pr-1"),children:t+1}),p.jsx("span",{className:Jt("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","px-2 flex gap-x-1.5 py-1 flex-wrap"),children:BM(e)})]},t),t[5]=e):e=t[5],s=n.map(e),t[3]=n,t[4]=s}else s=t[4];return t[6]!==s?(i=p.jsx("pre",{className:"grid text-xs font-mono gap-1 whitespace-break-spaces font-semibold align-left",children:p.jsx("div",{className:"grid grid-cols-[30px,1fr]",style:a,children:s})}),t[6]=s,t[7]=i):i=t[7],t[8]!==r||t[9]!==i?(l=p.jsx("div",{className:r,children:i}),t[8]=r,t[9]=i,t[10]=l):l=t[10],l};function BM(e){const t=Ms(e.timestamp),n=UM[e.level],o=e.level.toUpperCase();return p.jsxs(p.Fragment,{children:[p.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)]",children:["[",t,"]"]}),p.jsx("span",{className:Jt("flex-shrink-0",n),children:o}),p.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)]",children:["(",p.jsx(ls,{cellId:e.cellId}),")"]}),e.message]})}const UM={stdout:"text-[var(--grass-9)]",stderr:"text-[var(--red-9)]"},VM=()=>{const e=m(5),{documentation:t}=te(Ts);if(!t){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=p.jsx(xN,{title:"View docs as you type",description:"Move your text cursor over a symbol to see its documentation.",icon:p.jsx(Rc,{})}),e[0]=t):t=e[0],t}let n,o;return e[1]!==t?(n=ua({html:t}),e[1]=t,e[2]=n):n=e[2],e[3]!==n?(o=p.jsx("div",{className:"p-3 overflow-y-auto overflow-x-hidden h-full docs-documentation flex flex-col gap-4",children:n}),e[3]=n,e[4]=o):o=e[4],o};function $M(e,t,n){return e[t]?e[t][0]?e[t][0][n]:e[t][n]:"contentBoxSize"===t?e.contentRect["inlineSize"===n?"width":"height"]:void 0}function GM(e){void 0===e&&(e={});var t=e.onResize,n=r.useRef(void 0);n.current=t;var o=e.round||Math.round,a=r.useRef(),s=r.useState({width:void 0,height:void 0}),i=s[0],l=s[1],c=r.useRef(!1);r.useEffect((function(){return c.current=!1,function(){c.current=!0}}),[]);var d=r.useRef({width:void 0,height:void 0}),u=function(e,t){var n=r.useRef(null),o=r.useRef(null);o.current=t;var a=r.useRef(null);r.useEffect((function(){s()}));var s=r.useCallback((function(){var t=a.current,r=o.current,s=t||(r?r instanceof Element?r:r.current:null);n.current&&n.current.element===s&&n.current.subscriber===e||(n.current&&n.current.cleanup&&n.current.cleanup(),n.current={element:s,subscriber:e,cleanup:s?e(s):void 0})}),[e]);return r.useEffect((function(){return function(){n.current&&n.current.cleanup&&(n.current.cleanup(),n.current=null)}}),[]),r.useCallback((function(e){a.current=e,s()}),[s])}(r.useCallback((function(t){return a.current&&a.current.box===e.box&&a.current.round===o||(a.current={box:e.box,round:o,instance:new ResizeObserver((function(t){var r=t[0],a="border-box"===e.box?"borderBoxSize":"device-pixel-content-box"===e.box?"devicePixelContentBoxSize":"contentBoxSize",s=$M(r,a,"inlineSize"),i=$M(r,a,"blockSize"),u=s?o(s):void 0,h=i?o(i):void 0;if(d.current.width!==u||d.current.height!==h){var m={width:u,height:h};d.current.width=u,d.current.height=h,n.current?n.current(m):c.current||l(m)}}))}),a.current.instance.observe(t,{box:e.box}),function(){a.current&&a.current.instance.unobserve(t)}}),[e.box,o]),e.ref);return r.useMemo((function(){return{ref:u,width:i.width,height:i.height}}),[u,i.width,i.height])}const HM=new Map,WM=({file:e,onOpenNotebook:t})=>{const{theme:n}=Ee(),o=te(Ae),[a,s]=r.useState(""),{data:i,loading:l,error:c,setData:d}=Zt((async()=>{const t=await Os({path:e.path}),n=t.contents||"";return s(HM.get(e.path)||n),t}),[e.path]),u=async()=>{a!==(null==i?void 0:i.contents)&&await Us({path:e.path,contents:a}).then((e=>{e.success&&(d((e=>e?{...e,contents:a}:void 0)),s(a))}))},h=r.useRef(a);if(h.current=a,r.useEffect((()=>()=>{if(!i)return;const t=h.current;t===i.contents?HM.delete(e.path):HM.set(e.path,t)}),[e.path,null==i?void 0:i.contents]),c)return p.jsx(Ds,{error:c});if(l||!i)return null;const m=i.mimeType||"text/plain",f=m in YM;if(!i.contents&&!f)return p.jsxs("div",{className:"grid grid-cols-2 gap-2 p-6",children:[p.jsx("div",{className:"font-bold text-muted-foreground",children:"Name"}),p.jsx("div",{children:i.file.name}),p.jsx("div",{className:"font-bold text-muted-foreground",children:"Type"}),p.jsx("div",{children:m})]});const x=p.jsxs("div",{className:"text-xs text-muted-foreground p-1 flex justify-end gap-2 border-b",children:[e.isMarimoFile&&!j()&&p.jsx(v,{content:"Open notebook",children:p.jsx(mi,{size:"small",onClick:e=>t(e),children:p.jsx(Ps,{})})}),p.jsx(v,{content:"Download",children:p.jsx(mi,{size:"small",onClick:()=>{if(qM(m)){const e=Vs(i.contents,m);$s(e,i.file.name)}else y(new Blob([i.contents||a],{type:m}),i.file.name)},children:p.jsx(gt,{})})}),!qM(m)&&p.jsxs(p.Fragment,{children:[p.jsx(v,{content:"Copy contents to clipboard",children:p.jsx(mi,{size:"small",onClick:async()=>{await We(a)},children:p.jsx(Ye,{})})}),p.jsx(v,{content:g("global.save"),children:p.jsx(mi,{size:"small",color:a===i.contents?void 0:"green",onClick:u,disabled:a===i.contents,children:p.jsx(kc,{})})})]})]});return m.startsWith("image/")?p.jsxs(p.Fragment,{children:[x,p.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:p.jsx(Rs,{base64:i.contents,mime:m})})]}):"text/csv"===m&&i.contents?p.jsxs(p.Fragment,{children:[x,p.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:p.jsx(Fs,{contents:i.contents})})]}):m.startsWith("audio/")?p.jsxs(p.Fragment,{children:[x,p.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:p.jsx(Ls,{base64:i.contents,mime:m})})]}):m.startsWith("video/")?p.jsxs(p.Fragment,{children:[x,p.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:p.jsx(zs,{base64:i.contents,mime:m})})]}):p.jsxs(p.Fragment,{children:[x,p.jsx("div",{className:"flex-1 overflow-auto",children:p.jsx(Bs,{theme:"dark"===n?"dark":"light",language:YM[m]||YM.default,className:"border-b",extensions:[Bt.lineWrapping,sn.of([{key:o.getHotkey("global.save").key,stopPropagation:!0,run:()=>a!==i.contents&&(u(),!0)}])],value:a,onChange:s})})]})},qM=e=>!!e&&(e.startsWith("image/")||e.startsWith("audio/")||e.startsWith("video/")),YM={"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"};const KM=H(new class{constructor(e){this.callbacks=e,this.delegate=new Bi([]),this.rootPath="",this.onChange=Xt.NOOP,this.path=new it("/"),this.initialize=async e=>{if(this.onChange=e,0===this.delegate.data.length)try{const e=await this.callbacks.listFiles({path:this.rootPath});this.delegate=new Bi(e.files),this.rootPath=e.root,this.path=it.guessDeliminator(e.root)}catch(t){X({title:"Failed",description:Dr(t)})}this.onChange(this.delegate.data)},this.refreshAll=async e=>{const t=[this.rootPath,...e.map((e=>{var t;return null==(t=this.delegate.find(e))?void 0:t.data.path}))].filter(Boolean),n=await Promise.all(t.map((e=>this.callbacks.listFiles({path:e}).catch((()=>({files:[]}))))));for(const[o,r]of t.entries()){const e=n[o];r===this.rootPath?this.delegate=new Bi(e.files):this.delegate.update({id:r,changes:{children:e.files}})}this.onChange(this.delegate.data)},this.relativeFromRoot=e=>{const t=function(e){return e.endsWith("/")?e:`${e}/`}(this.rootPath);return e.startsWith(t)?e.slice(t.length):e},this.handleResponse=e=>e.success?e:(X({title:"Failed",description:e.message}),null)}async expand(e){const t=this.delegate.find(e);if(!t)return!1;if(!t.data.isDirectory)return!1;if(t.children&&t.children.length>0)return!0;const n=await this.callbacks.listFiles({path:t.data.path});return this.delegate.update({id:e,changes:{children:n.files}}),this.onChange(this.delegate.data),!0}async rename(e,t){const n=this.delegate.find(e);if(!n)return;const o=n.data.path,r=this.path.join(this.path.dirname(o),t);await this.callbacks.renameFileOrFolder({path:o,newPath:r}).then(this.handleResponse),this.delegate.update({id:e,changes:{name:t,path:r}}),this.onChange(this.delegate.data),await this.refreshAll([r])}async move(e,t){var n;const o=t?(null==(n=this.delegate.find(t))?void 0:n.data.path)??t:this.rootPath;await Promise.all(e.map((e=>{this.delegate.move({id:e,parentId:t,index:0});const n=this.delegate.find(e);if(!n)return Promise.resolve();const r=this.path.join(o,this.path.basename(n.data.path));return this.delegate.update({id:e,changes:{path:r}}),this.callbacks.renameFileOrFolder({path:n.data.path,newPath:r}).then(this.handleResponse)}))),this.onChange(this.delegate.data),await this.refreshAll([o])}async createFile(e,t){var n;const o=t?(null==(n=this.delegate.find(t))?void 0:n.data.path)??t:this.rootPath,r=await this.callbacks.createFileOrFolder({path:o,type:"file",name:e}).then(this.handleResponse);(null==r?void 0:r.info)&&(this.delegate.create({parentId:t,index:0,data:r.info}),this.onChange(this.delegate.data),await this.refreshAll([o]))}async createFolder(e,t){var n;const o=t?(null==(n=this.delegate.find(t))?void 0:n.data.path)??t:this.rootPath,r=await this.callbacks.createFileOrFolder({path:o,type:"directory",name:e}).then(this.handleResponse);(null==r?void 0:r.info)&&(this.delegate.create({parentId:t,index:0,data:r.info}),this.onChange(this.delegate.data),await this.refreshAll([o]))}async delete(e){const t=this.delegate.find(e);t&&(await this.callbacks.deleteFileOrFolder({path:t.data.path}).then(this.handleResponse),this.delegate.drop({id:e}),this.onChange(this.delegate.data))}}({listFiles:en,createFileOrFolder:Gs,deleteFileOrFolder:Hs,renameFileOrFolder:Ws})),JM=H({});function XM(e){const t=m(4);let n;t[0]!==e?(n=void 0===e?{}:e,t[0]=e,t[1]=n):n=t[1];const o=n;let r;return t[2]!==o?(r={multiple:!0,maxSize:104857600,onError:nT,onDropRejected:QM,onDrop:ZM,...o},t[2]=o,t[3]=r):r=t[3],qs(r)}async function ZM(e){for(const t of e){const e=(await Ys(t)).split(",")[1];await Gs({path:"",type:"file",name:t.name,contents:e})}await async function(){await Y.get(KM).refreshAll([])}()}function QM(e){X({title:"File upload failed",description:p.jsx("div",{className:"flex flex-col gap-1",children:e.map(eT)}),variant:"danger"})}function eT(e){return p.jsxs("div",{children:[e.file.name," (",e.errors.map(tT).join(", "),")"]},e.file.name)}function tT(e){return e.message}function nT(e){G.error(e),X({title:"File upload failed",description:e.message,variant:"danger"})}const oT=u.createContext(null),rT=e=>{const t=m(60),{height:n}=e,o=r.useRef(null),[a]=Ie(KM);let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=[],t[0]=s):s=t[0];const[i,l]=r.useState(s),[c,d]=r.useState(null),{openPrompt:u}=f(),[h,g]=Ie(JM);let v,y;t[1]!==a?(v=()=>a.initialize(l),t[1]=a,t[2]=v):v=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(y=[],t[3]=y):y=t[3];const{loading:b,error:w}=Zt(v,y);let k;t[4]!==a||t[5]!==h?(k=()=>{a.refreshAll(Object.keys(h).filter((e=>h[e])))},t[4]=a,t[5]=h,t[6]=k):k=t[6];const N=z(k);let E;t[7]!==u||t[8]!==a?(E=async()=>{u({title:"Folder name",onConfirm:async e=>{a.createFolder(e,null)}})},t[7]=u,t[8]=a,t[9]=E):E=t[9];const C=z(E);let S;t[10]!==u||t[11]!==a?(S=async()=>{u({title:"File name",onConfirm:async e=>{a.createFile(e,null)}})},t[10]=u,t[11]=a,t[12]=S):S=t[12];const j=z(S);let _;t[13]!==g?(_=()=>{var e;null==(e=o.current)||e.closeAll(),g({})},t[13]=g,t[14]=_):_=t[14];const I=z(_);if(b){let e;return t[15]===Symbol.for("react.memo_cache_sentinel")?(e=p.jsx(Ka,{size:"medium",centered:!0}),t[15]=e):e=t[15],e}if(w){let e;return t[16]!==w?(e=p.jsx(Ds,{error:w}),t[16]=w,t[17]=e):e=t[17],e}if(c){let e,n,o,s,i,l;return t[18]===Symbol.for("react.memo_cache_sentinel")?(e=()=>d(null),t[18]=e):e=t[18],t[19]===Symbol.for("react.memo_cache_sentinel")?(n=p.jsx(x,{onClick:e,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:p.jsx(jl,{size:16})}),t[19]=n):n=t[19],t[20]!==c.name?(o=p.jsxs("div",{className:"flex items-center pl-1 pr-3 flex-shrink-0 border-b justify-between",children:[n,p.jsx("span",{className:"font-bold",children:c.name})]}),t[20]=c.name,t[21]=o):o=t[21],t[22]!==a||t[23]!==c.path?(s=e=>uT(e,a.relativeFromRoot(c.path)),t[22]=a,t[23]=c.path,t[24]=s):s=t[24],t[25]!==s||t[26]!==c?(i=p.jsx(r.Suspense,{children:p.jsx(WM,{onOpenNotebook:s,file:c})}),t[25]=s,t[26]=c,t[27]=i):i=t[27],t[28]!==o||t[29]!==i?(l=p.jsxs(p.Fragment,{children:[o,i]}),t[28]=o,t[29]=i,t[30]=l):l=t[30],l}let A;t[31]!==N||t[32]!==j||t[33]!==C||t[34]!==I||t[35]!==a?(A=p.jsx(sT,{onRefresh:N,onCreateFile:j,onCreateFolder:C,onCollapseAll:I,tree:a}),t[31]=N,t[32]=j,t[33]=C,t[34]=I,t[35]=a,t[36]=A):A=t[36];const M=n-33;let T,O,D,P,R,F,L,B;return t[37]!==a?(T=async e=>{const{ids:t}=e;for(const n of t)await a.delete(n)},O=async e=>{const{id:t,name:n}=e;await a.rename(t,n)},D=async e=>{const{dragIds:t,parentId:n}=e;await a.move(t,n)},t[37]=a,t[38]=T,t[39]=O,t[40]=D):(T=t[38],O=t[39],D=t[40]),t[41]===Symbol.for("react.memo_cache_sentinel")?(P=e=>{const t=e[0];t&&(t.data.isDirectory||d(t.data))},t[41]=P):P=t[41],t[42]!==a||t[43]!==h||t[44]!==g?(R=async e=>{if(await a.expand(e)){const t=h[e]??!1;g({...h,[e]:!t})}},t[42]=a,t[43]=h,t[44]=g,t[45]=R):R=t[45],t[46]!==M||t[47]!==i||t[48]!==h||t[49]!==T||t[50]!==O||t[51]!==D||t[52]!==R?(F=p.jsx(Ui,{width:"100%",ref:o,height:M,className:"h-full",data:i,initialOpenState:h,openByDefault:!1,renderCursor:hT,disableDrop:mT,onDelete:T,onRename:O,onMove:D,onSelect:P,onToggle:R,padding:15,rowHeight:30,indent:aT,overscanCount:1e3,disableMultiSelection:!0,children:cT}),t[46]=M,t[47]=i,t[48]=h,t[49]=T,t[50]=O,t[51]=D,t[52]=R,t[53]=F):F=t[53],t[54]!==a||t[55]!==F?(L=p.jsx(oT.Provider,{value:a,children:F}),t[54]=a,t[55]=F,t[56]=L):L=t[56],t[57]!==A||t[58]!==L?(B=p.jsxs(p.Fragment,{children:[A,L]}),t[57]=A,t[58]=L,t[59]=B):B=t[59],B},aT=15,sT=e=>{const t=m(30),{onRefresh:n,onCreateFile:o,onCreateFolder:r,onCollapseAll:a}=e;let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s={noDrag:!0,noDragEventsBubbling:!0},t[0]=s):s=t[0];const{getRootProps:i,getInputProps:l}=XM(s);let c,d,u,h,f,g,y,b,w,k,N,E,C,S,j;return t[1]===Symbol.for("react.memo_cache_sentinel")?(c=p.jsx(Yl,{size:16}),t[1]=c):c=t[1],t[2]!==o?(d=p.jsx(v,{content:"Add file",children:p.jsx(x,{"data-testid":"file-explorer-add-file-button",onClick:o,variant:"text",size:"xs",children:c})}),t[2]=o,t[3]=d):d=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(u=p.jsx(Jl,{size:16}),t[4]=u):u=t[4],t[5]!==r?(h=p.jsx(v,{content:"Add folder",children:p.jsx(x,{"data-testid":"file-explorer-add-folder-button",onClick:r,variant:"text",size:"xs",children:u})}),t[5]=r,t[6]=h):h=t[6],t[7]!==i?(f=i({}),t[7]=i,t[8]=f):f=t[8],t[9]===Symbol.for("react.memo_cache_sentinel")?(g=Ks({variant:"text",size:"xs"}),y=p.jsx(Js,{size:16}),t[9]=g,t[10]=y):(g=t[9],y=t[10]),t[11]!==f?(b=p.jsx(v,{content:"Upload file",children:p.jsx("button",{"data-testid":"file-explorer-upload-button",...f,className:g,children:y})}),t[11]=f,t[12]=b):b=t[12],t[13]!==l?(w=l({}),t[13]=l,t[14]=w):w=t[14],t[15]!==w?(k=p.jsx("input",{...w,type:"file"}),t[15]=w,t[16]=k):k=t[16],t[17]===Symbol.for("react.memo_cache_sentinel")?(N=p.jsx(Kr,{size:16}),t[17]=N):N=t[17],t[18]!==n?(E=p.jsx(v,{content:"Refresh",children:p.jsx(x,{"data-testid":"file-explorer-refresh-button",onClick:n,variant:"text",size:"xs",children:N})}),t[18]=n,t[19]=E):E=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(Gl,{size:16}),t[20]=C):C=t[20],t[21]!==a?(S=p.jsx(v,{content:"Collapse all folders",children:p.jsx(x,{"data-testid":"file-explorer-collapse-button",onClick:a,variant:"text",size:"xs",children:C})}),t[21]=a,t[22]=S):S=t[22],t[23]!==d||t[24]!==h||t[25]!==b||t[26]!==k||t[27]!==E||t[28]!==S?(j=p.jsxs("div",{className:"flex items-center justify-end px-2 flex-shrink-0 border-b",children:[d,h,b,k,E,S]}),t[23]=d,t[24]=h,t[25]=b,t[26]=k,t[27]=E,t[28]=S,t[29]=j):j=t[29],j},iT=e=>{const t=m(9),{node:n,onOpenMarimoFile:o}=e;let r,a,s;return t[0]!==n?(r=e=>{n.data.isDirectory||(e.stopPropagation(),n.select())},t[0]=n,t[1]=r):r=t[1],t[2]!==n.data.isMarimoFile||t[3]!==o?(a=n.data.isMarimoFile&&!j()&&p.jsxs("span",{className:"flex-shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline",onClick:o,children:["open ",p.jsx(Ps,{className:"inline ml-1",size:12})]}),t[2]=n.data.isMarimoFile,t[3]=o,t[4]=a):a=t[4],t[5]!==r||t[6]!==n.data.name||t[7]!==a?(s=p.jsxs("span",{className:"flex-1 overflow-hidden text-ellipsis",onClick:r,children:[n.data.name,a]}),t[5]=r,t[6]=n.data.name,t[7]=a,t[8]=s):s=t[8],s},lT=e=>{const t=m(10),{node:n}=e,o=r.useRef(null);let a,s,i,l,c;return t[0]!==n.data.name?(a=()=>{var e,t;null==(e=o.current)||e.focus(),null==(t=o.current)||t.setSelectionRange(0,n.data.name.lastIndexOf("."))},s=[n.data.name],t[0]=n.data.name,t[1]=a,t[2]=s):(a=t[1],s=t[2]),r.useEffect(a,s),t[3]!==n?(i=()=>n.reset(),l=e=>{"Escape"===e.key&&n.reset(),"Enter"===e.key&&n.submit(e.currentTarget.value)},t[3]=n,t[4]=i,t[5]=l):(i=t[4],l=t[5]),t[6]!==n.data.name||t[7]!==i||t[8]!==l?(c=p.jsx("input",{ref:o,className:"flex-1 bg-transparent border border-border text-muted-foreground",defaultValue:n.data.name,onClick:fT,onBlur:i,onKeyDown:l}),t[6]=n.data.name,t[7]=i,t[8]=l,t[9]=c):c=t[9],c},cT=e=>{const t=m(52),{node:n,style:o,dragHandle:a}=e;let s;t[0]!==n.data?(s=n.data.isDirectory?"directory":Qt(n.data.name),t[0]=n.data,t[1]=s):s=t[1];const i=s,l=tn[i],{openConfirm:c,openPrompt:d}=f(),u=r.useContext(oT);let h;t[2]!==u||t[3]!==n.data.path?(h=async e=>{uT(e,u?u.relativeFromRoot(n.data.path):n.data.path)},t[2]=u,t[3]=n.data.path,t[4]=h):h=t[4];const g=h;let v;t[5]!==c||t[6]!==n.data.name||t[7]!==n.tree||t[8]!==n.id?(v=async e=>{e.stopPropagation(),e.preventDefault(),c({title:"Delete file",description:`Are you sure you want to delete ${n.data.name}?`,confirmAction:p.jsx(Ke,{onClick:async()=>{await n.tree.delete(n.id)},"aria-label":"Confirm",children:"Delete"})})},t[5]=c,t[6]=n.data.name,t[7]=n.tree,t[8]=n.id,t[9]=v):v=t[9];const b=v;let w;t[10]!==n||t[11]!==d||t[12]!==u?(w=async()=>{n.open(),d({title:"Folder name",onConfirm:async e=>{null==u||u.createFolder(e,n.id)}})},t[10]=n,t[11]=d,t[12]=u,t[13]=w):w=t[13];const k=z(w);let N;t[14]!==n||t[15]!==d||t[16]!==u?(N=async()=>{n.open(),d({title:"File name",onConfirm:async e=>{null==u||u.createFile(e,n.id)}})},t[14]=n,t[15]=d,t[16]=u,t[17]=N):N=t[17];const E=z(N);let C;t[18]!==n||t[19]!==E||t[20]!==k||t[21]!==u||t[22]!==i||t[23]!==g||t[24]!==b?(C=()=>{const e={size:14,strokeWidth:1.5,className:"mr-2"};return p.jsxs(Ot,{align:"end",className:"no-print w-[220px]",onClick:e=>e.stopPropagation(),onCloseAutoFocus:e=>e.preventDefault(),children:[!n.data.isDirectory&&p.jsxs(Ct,{onSelect:()=>n.select(),children:[p.jsx(Lc,{...e}),"Open file"]}),n.data.isDirectory&&p.jsxs(p.Fragment,{children:[p.jsxs(Ct,{onSelect:()=>E(),children:[p.jsx(Yl,{...e}),"Create file"]}),p.jsxs(Ct,{onSelect:()=>k(),children:[p.jsx(Jl,{...e}),"Create folder"]}),p.jsx(Mt,{})]}),p.jsxs(Ct,{onSelect:()=>n.edit(),children:[p.jsx(gc,{...e}),"Rename"]}),p.jsxs(Ct,{onSelect:async()=>{await We(n.data.path),X({title:"Copied to clipboard"})},children:[p.jsx(Ye,{...e}),"Copy path"]}),u&&p.jsxs(Ct,{onSelect:async()=>{await We(u.relativeFromRoot(n.data.path)),X({title:"Copied to clipboard"})},children:[p.jsx(Ye,{...e}),"Copy relative path"]}),p.jsxs(Ct,{onSelect:async()=>{X({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:e}=n.data,t=Xs[i](e);await We(t)},children:[p.jsx(Zs,{...e}),"Copy snippet for reading file"]}),n.data.isMarimoFile&&!j()&&p.jsxs(p.Fragment,{children:[p.jsx(Mt,{}),p.jsxs(Ct,{onSelect:g,children:[p.jsx(Mc,{...e}),"Open notebook"]})]}),p.jsx(Mt,{}),!n.data.isDirectory&&p.jsxs(p.Fragment,{children:[p.jsxs(Ct,{onSelect:async()=>{const e=(await Os({path:n.data.path})).contents||"";y(new Blob([e]),n.data.name)},children:[p.jsx(gt,{...e}),"Download"]}),p.jsx(Mt,{})]}),p.jsxs(Ct,{onSelect:b,variant:"danger",children:[p.jsx(ye,{...e}),"Delete"]})]})},t[18]=n,t[19]=E,t[20]=k,t[21]=u,t[22]=i,t[23]=g,t[24]=b,t[25]=C):C=t[25];const S=C;let _,I,A;t[26]===Symbol.for("react.memo_cache_sentinel")?(_=Jt("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group"),t[26]=_):_=t[26],t[27]!==n?(I=e=>{e.stopPropagation(),n.data.isDirectory&&n.toggle()},A=p.jsx(dT,{node:n}),t[27]=n,t[28]=I,t[29]=A):(I=t[28],A=t[29]);const M=n.willReceiveDrop&&n.data.isDirectory&&"bg-accent/80 hover:bg-accent/80 text-accent-foreground";let T,O,D,P,R,F,L;return t[30]!==M?(T=Jt("flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group",M),t[30]=M,t[31]=T):T=t[31],t[32]!==n.data.isMarimoFile||t[33]!==l?(O=n.data.isMarimoFile?p.jsx("img",{src:"/favicon.ico",className:"w-5 h-5 flex-shrink-0 mr-2 filter grayscale",alt:"Marimo"}):p.jsx(l,{className:"w-5 h-5 flex-shrink-0 mr-2",strokeWidth:1.5}),t[32]=n.data.isMarimoFile,t[33]=l,t[34]=O):O=t[34],t[35]!==n||t[36]!==g?(D=n.isEditing?p.jsx(lT,{node:n}):p.jsx(iT,{node:n,onOpenMarimoFile:g}),t[35]=n,t[36]=g,t[37]=D):D=t[37],t[38]===Symbol.for("react.memo_cache_sentinel")?(P=p.jsx(St,{asChild:!0,tabIndex:-1,onClick:pT,children:p.jsx(x,{"data-testid":"file-explorer-more-button",variant:"text",tabIndex:-1,size:"xs",className:"mb-0","aria-label":"More options",children:p.jsx(Hl,{strokeWidth:2,className:"w-5 h-5 hidden group-hover:block"})})}),t[38]=P):P=t[38],t[39]!==S?(R=p.jsxs(Tt,{modal:!1,children:[P,S()]}),t[39]=S,t[40]=R):R=t[40],t[41]!==T||t[42]!==O||t[43]!==D||t[44]!==R?(F=p.jsxs("span",{className:T,children:[O,D,R]}),t[41]=T,t[42]=O,t[43]=D,t[44]=R,t[45]=F):F=t[45],t[46]!==o||t[47]!==a||t[48]!==I||t[49]!==A||t[50]!==F?(L=p.jsxs("div",{style:o,ref:a,className:_,draggable:!0,onClick:I,children:[A,F]}),t[46]=o,t[47]=a,t[48]=I,t[49]=A,t[50]=F,t[51]=L):L=t[51],L},dT=e=>{const t=m(3),{node:n}=e;if(!n.data.isDirectory){let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=p.jsx("span",{className:"w-5 h-5 flex-shrink-0"}),t[0]=e):e=t[0],e}let o;return t[1]!==n.isOpen?(o=n.isOpen?p.jsx(ve,{className:"w-5 h-5 flex-shrink-0"}):p.jsx(Jr,{className:"w-5 h-5 flex-shrink-0"}),t[1]=n.isOpen,t[2]=o):o=t[2],o};function uT(e,t){e.stopPropagation(),e.preventDefault(),window.open(`/?file=${t}`,"_blank")}function hT(){return null}function mT(e){const{parentNode:t}=e;return!t.data.isDirectory}function fT(e){return e.stopPropagation()}function pT(e){return e.stopPropagation()}const gT=()=>{const e=m(20),{ref:t,height:n}=GM(),o=void 0===n?1:n;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={noClick:!0,noKeyboard:!0},e[0]=r):r=e[0];const{getRootProps:a,getInputProps:s,isDragActive:i}=XM(r);let l,c,d,u,h,f,g,v;return e[1]!==a?(l=a(),e[1]=a,e[2]=l):l=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(c=Jt("flex flex-col flex-1 overflow-hidden relative"),e[3]=c):c=e[3],e[4]!==s?(d=s(),e[4]=s,e[5]=d):d=e[5],e[6]!==d?(u=p.jsx("input",{...d}),e[6]=d,e[7]=u):u=e[7],e[8]!==i?(h=i&&p.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"}),e[8]=i,e[9]=h):h=e[9],e[10]!==o?(f=p.jsx(rT,{height:o}),e[10]=o,e[11]=f):f=e[11],e[12]!==t||e[13]!==f?(g=p.jsx("div",{ref:t,className:"flex flex-col flex-1 overflow-hidden",children:f}),e[12]=t,e[13]=f,e[14]=g):g=e[14],e[15]!==l||e[16]!==u||e[17]!==h||e[18]!==g?(v=p.jsxs("div",{...l,className:c,children:[u,h,g]}),e[15]=l,e[16]=u,e[17]=h,e[18]=g,e[19]=v):v=e[19],v},vT=e=>{const t=m(6),{children:n}=e,{openModal:o,closeModal:r}=f();let a,s;return t[0]!==o||t[1]!==r?(a=()=>o(p.jsx(yT,{onClose:r})),t[0]=o,t[1]=r,t[2]=a):a=t[2],t[3]!==a||t[4]!==n?(s=p.jsx(Za,{onClick:a,children:n}),t[3]=a,t[4]=n,t[5]=s):s=t[5],s},xT=[Bt.lineWrapping],yT=e=>{const t=m(23),{onClose:n}=e,[o,a]=r.useState(""),{theme:s}=Ee();let i,l,c,d,u,h;t[0]!==n?(i=async e=>{e.preventDefault();const t=new FormData(e.target),o=t.get("title"),r=t.get("description"),a=t.get("code");fetch("https://marimo.io/api/suggest-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:o,description:r,code:a})}),n(),X({title:"Snippet Submitted",description:"Thank you for contributing! We will review your snippet shortly."})},t[0]=n,t[1]=i):i=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(l=p.jsx(b,{children:"Contribute a Snippet"}),t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(c=p.jsxs(we,{children:[l,p.jsxs(w,{children:["Have a useful snippet you want to share with the community? Submit it here or make a pull request"," ",p.jsx("a",{href:Ge.githubPage,target:"_blank",rel:"noreferrer",className:"underline",children:"on GitHub"}),"."]})]}),t[3]=c):c=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(d=p.jsx(He,{id:"title",name:"title",autoFocus:!0,placeholder:"Title",required:!0,autoComplete:"off"}),u=p.jsx(Qa,{id:"description",name:"description",autoFocus:!0,placeholder:"Description",rows:5,required:!0,autoComplete:"off"}),t[4]=d,t[5]=u):(d=t[4],u=t[5]),t[6]!==o?(h=p.jsx("input",{type:"hidden",name:"code",value:o}),t[6]=o,t[7]=h):h=t[7];const f="dark"===s?"dark":"light";let g,v,y,E,C,S;return t[8]!==f||t[9]!==o?(g=p.jsx(Bs,{theme:f,language:"python",className:"cm border rounded overflow-hidden",extensions:xT,value:o,onChange:a}),t[8]=f,t[9]=o,t[10]=g):g=t[10],t[11]!==h||t[12]!==g?(v=p.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[d,u,h,g]}),t[11]=h,t[12]=g,t[13]=v):v=t[13],t[14]!==n?(y=p.jsx(x,{"data-testid":"snippet-cancel-button",variant:"secondary",onClick:n,children:"Cancel"}),t[14]=n,t[15]=y):y=t[15],t[16]===Symbol.for("react.memo_cache_sentinel")?(E=p.jsx(x,{"data-testid":"snippet-send-button","aria-label":"Save",variant:"default",type:"submit",children:"Send"}),t[16]=E):E=t[16],t[17]!==y?(C=p.jsxs(k,{children:[y,E]}),t[17]=y,t[18]=C):C=t[18],t[19]!==i||t[20]!==v||t[21]!==C?(S=p.jsx(N,{className:"w-fit",children:p.jsxs("form",{onSubmit:i,children:[c,v,C]})}),t[19]=i,t[20]=v,t[21]=C,t[22]=S):S=t[22],S},bT=[Bt.lineWrapping],wT=()=>{const e=m(20),[t,n]=u.useState();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],e[0]=o):o=e[0];const{data:a,error:s,loading:i}=Zt(ET,o);if(s){let t;return e[1]!==s?(t=p.jsx(Ds,{error:s}),e[1]=s,e[2]=t):t=e[2],t}if(i||!a){let t;return e[3]===Symbol.for("react.memo_cache_sentinel")?(t=p.jsx(Ka,{size:"medium",centered:!0}),e[3]=t):t=e[3],t}const l=t?"h-1/3":"h-full";let c,d,h,f,g,v,x,y,b;return e[4]!==l?(c=Jt("border-b rounded-none",l),e[4]=l,e[5]=c):c=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(d=p.jsx(Be,{placeholder:"Search snippets...",className:"h-6 m-1",rootClassName:"flex-1 border-r"}),e[6]=d):d=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(h=p.jsxs("div",{className:"flex items-center w-full",children:[d,p.jsx(vT,{children:p.jsx("button",{className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:p.jsx(To,{className:"h-4 w-4"})})})]}),f=p.jsx(Ve,{children:"No results"}),e[7]=h,e[8]=f):(h=e[7],f=e[8]),e[9]===Symbol.for("react.memo_cache_sentinel")?(g=e=>n(e),e[9]=g):g=e[9],e[10]!==a.snippets?(v=p.jsx(NT,{onSelect:g,snippets:a.snippets}),e[10]=a.snippets,e[11]=v):v=e[11],e[12]!==c||e[13]!==v?(x=p.jsxs(an,{className:c,children:[h,f,v]}),e[12]=c,e[13]=v,e[14]=x):x=e[14],e[15]!==t?(y=p.jsx(r.Suspense,{children:p.jsx("div",{className:"h-2/3 snippet-viewer flex flex-col",children:t?p.jsx(kT,{snippet:t},t.title):p.jsx(xN,{title:"",description:"Click on a snippet to view its content."})})}),e[15]=t,e[16]=y):y=e[16],e[17]!==x||e[18]!==y?(b=p.jsxs("div",{className:"flex-1 overflow-hidden",children:[x,y]}),e[17]=x,e[18]=y,e[19]=b):b=e[19],b},kT=e=>{const t=m(27),{snippet:n}=e,{theme:o}=Ee(),{createNewCell:r}=B(),a=gd();let s;t[0]!==n.sections||t[1]!==r||t[2]!==a?(s=()=>{for(const e of[...n.sections].reverse())e.code&&r({code:e.code,before:!1,cellId:a??"__end__"})},t[0]=n.sections,t[1]=r,t[2]=a,t[3]=s):s=t[3];const i=s;let l;t[4]!==r||t[5]!==a?(l=e=>{r({code:e,before:!1,cellId:a??"__end__"})},t[4]=r,t[5]=a,t[6]=l):l=t[6];const c=l;let d,u,h,f,g,y;if(t[7]!==n.title?(d=p.jsx("div",{className:"text-sm font-semibold bg-muted border-y px-2 py-1",children:n.title}),t[7]=n.title,t[8]=d):d=t[8],t[9]===Symbol.for("react.memo_cache_sentinel")?(u=p.jsx(Tl,{className:"ml-2 h-4 w-4"}),t[9]=u):u=t[9],t[10]!==i?(h=p.jsx("div",{className:"flex justify-end",children:p.jsx(fu,{children:p.jsxs(x,{className:"float-right",size:"xs",variant:"outline",onClick:i,children:["Insert snippet",u]})})}),t[10]=i,t[11]=h):h=t[11],t[12]!==n.title||t[13]!==n.sections||t[14]!==c||t[15]!==o){let e;t[17]!==n.title||t[18]!==c||t[19]!==o?(e=e=>{const{code:t,html:r,id:a}=e;return r?p.jsx("div",{children:ua({html:r})},`${n.title}-${a}`):t?p.jsxs("div",{className:"relative hover-actions-parent pr-2",children:[p.jsx(fu,{children:p.jsx(v,{content:"Insert snippet",children:p.jsx(x,{className:"absolute -top-2 -right-1 z-10 hover-action px-2 bg-background",size:"sm",variant:"outline",onClick:()=>{c(t)},children:p.jsx(Tl,{className:"h-5 w-5"})})})}),p.jsx(Bs,{theme:"dark"===o?"dark":"light",language:"python",className:"cm border rounded overflow-hidden",extensions:bT,value:t,readOnly:!0},`${n.title}-${a}`)]},`${n.title}-${a}`):null},t[17]=n.title,t[18]=c,t[19]=o,t[20]=e):e=t[20],f=n.sections.map(e),t[12]=n.title,t[13]=n.sections,t[14]=c,t[15]=o,t[16]=f}else f=t[16];return t[21]!==h||t[22]!==f?(g=p.jsxs("div",{className:"px-2 py-2 space-y-4 overflow-auto flex-1",children:[h,f]}),t[21]=h,t[22]=f,t[23]=g):g=t[23],t[24]!==d||t[25]!==g?(y=p.jsxs(p.Fragment,{children:[d,g]}),t[24]=d,t[25]=g,t[26]=y):y=t[26],y},NT=e=>{const t=m(7),{snippets:n,onSelect:o}=e;let r,a;if(t[0]!==o||t[1]!==n){let e;t[3]!==o?(e=e=>p.jsx(Re,{className:"rounded-none",onSelect:()=>o(e),children:p.jsx("div",{className:"flex flex-row gap-2 items-center",children:p.jsx("span",{className:"mt-1 text-accent-foreground",children:e.title})})},e.title),t[3]=o,t[4]=e):e=t[4],r=n.map(e),t[0]=o,t[1]=n,t[2]=r}else r=t[2];return t[5]!==r?(a=p.jsx(dr,{className:"flex flex-col overflow-auto",children:r}),t[5]=r,t[6]=a):a=t[6],a};function ET(){return Qs()}const CT=e=>{const t=m(11),{value:n,className:o,tooltip:a}=e,[s,i]=r.useState(!1);let l;t[0]!==n?(l=qe.stopPropagation((async()=>{await We(n).then((()=>{i(!0),setTimeout((()=>i(!1)),2e3)}))})),t[0]=n,t[1]=l):l=t[1];const c=l;let d,u;t[2]!==s||t[3]!==o?(d=s?p.jsx(wt,{className:Jt(o,"text-[var(--grass-11)]")}):p.jsx(Ye,{className:o}),t[2]=s,t[3]=o,t[4]=d):d=t[4],t[5]!==c||t[6]!==d?(u=p.jsx("span",{onClick:c,children:d}),t[5]=c,t[6]=d,t[7]=u):u=t[7];const h=u;if(!1===a)return h;const f=s?"Copied!":a??"Copy to clipboard";let g;return t[8]!==f||t[9]!==h?(g=p.jsx(v,{content:f,delayDuration:400,children:h}),t[8]=f,t[9]=h,t[10]=g):g=t[10],g},ST=H((e=>{const t=e(Cr),n=e(Z),o=e(Ba);return Sl(t,(e=>{if(!e.variable_name)return-1;const t=Object.values(n).find((t=>t.name===e.variable_name));if(!t)return 0;const r=o.inOrderIds.indexOf(t.declaredBy[0]);return-1===r?0:r}))})),jT=()=>{const e=m(43),[t,n]=u.useState(""),o=te(re),r=gd(),{expandedColumns:a,expandedTables:s,columnsPreviews:i}=ei(),{toggleTable:l,toggleColumn:c,closeAllColumns:d}=ti(),{createNewCell:h}=B(),f=te(ST);if(0===f.length){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=p.jsx(xN,{title:"No tables found",description:"Any datasets/dataframes in the global scope will be shown here.",icon:p.jsx(fe,{})}),e[0]=t):t=e[0],t}let g;e[1]!==o||e[2]!==h||e[3]!==r?(g=e=>{e.includes("alt")&&function(e,t,n){ld("altair","alt",(o=>{const r=ee.create();t({cellId:n??"__end__",before:!1,code:o,lastCodeRun:e?o:void 0,newCellId:r,autoFocus:!1}),e&&$({cellIds:[r],codes:[o]})}))}(o,h,r),h({code:e,before:!1,cellId:r??"__end__"})},e[1]=o,e[2]=h,e[3]=r,e[4]=g):g=e[4];const v=g;let x;e[5]!==o||e[6]!==h||e[7]!==r?(x=e=>{cd(o,h,r);let t="";e:switch(e.source_type){case"local":t=`mo.ui.table(${e.name})`;break e;case"duckdb":t=`_df = mo.sql(f"SELECT * FROM ${e.name} LIMIT 100")`;break e;default:E(e.source_type)}h({code:t,before:!1,cellId:r??"__end__"})},e[5]=o,e[6]=h,e[7]=r,e[8]=x):x=e[8];const y=x,b=!!t.trim();let w,k,N,C,S,j,_,I,A,M,T;return e[9]===Symbol.for("react.memo_cache_sentinel")?(w=Jt("border-b bg-background rounded-none","h-full"),e[9]=w):w=e[9],e[10]!==d?(k=e=>{e.length>0&&d(),n(e)},e[10]=d,e[11]=k):k=e[11],e[12]!==t||e[13]!==k?(N=p.jsx(Be,{placeholder:"Search tables...",className:"h-6 m-1",value:t,onValueChange:k,rootClassName:"flex-1 border-r"}),e[12]=t,e[13]=k,e[14]=N):N=e[14],e[15]!==b?(C=b&&p.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:p.jsx(qt,{className:"h-4 w-4"})}),e[15]=b,e[16]=C):C=e[16],e[17]!==N||e[18]!==C?(S=p.jsxs("div",{className:"flex items-center w-full",children:[N,C]}),e[17]=N,e[18]=C,e[19]=S):S=e[19],e[20]!==c||e[21]!==i?(j=(e,t)=>{const n=`${e.name}:${t.name}`;c({table:e.name,column:t.name}),i.has(n)||oi({source:e.source,tableName:e.name,columnName:t.name,sourceType:e.source_type})},e[20]=c,e[21]=i,e[22]=j):j=e[22],e[23]!==l?(_=e=>{l(e.name)},e[23]=l,e[24]=_):_=e[24],e[25]!==b||e[26]!==s?(I=e=>!!b||s.has(e.name),e[25]=b,e[26]=s,e[27]=I):I=e[27],e[28]!==a?(A=(e,t)=>{const n=`${e.name}:${t.name}`;return a.has(n)},e[28]=a,e[29]=A):A=e[29],e[30]!==v||e[31]!==y||e[32]!==j||e[33]!==_||e[34]!==i||e[35]!==f||e[36]!==b||e[37]!==I||e[38]!==A?(M=p.jsx(_T,{onAddColumnChart:v,onAddTable:y,onExpandColumn:j,onExpandTable:_,columnPreviews:i,tables:f,isSearching:b,isTableExpanded:I,isColumnExpanded:A}),e[30]=v,e[31]=y,e[32]=j,e[33]=_,e[34]=i,e[35]=f,e[36]=b,e[37]=I,e[38]=A,e[39]=M):M=e[39],e[40]!==S||e[41]!==M?(T=p.jsx("div",{className:"flex-1 overflow-hidden",children:p.jsxs(an,{className:w,children:[S,M]})}),e[40]=S,e[41]=M,e[42]=T):T=e[42],T},_T=e=>{const t=m(25),{tables:n,isSearching:o,columnPreviews:r,onAddColumnChart:a,onAddTable:s,onExpandTable:i,onExpandColumn:l,isTableExpanded:c,isColumnExpanded:d}=e;let h,f,g,v;if(t[0]!==n||t[1]!==c||t[2]!==o||t[3]!==i||t[4]!==s||t[5]!==l||t[6]!==d||t[7]!==a||t[8]!==r){let e,m;e=Object.entries(Me.groupBy(n,OT,DT)),e=Sl(e,PT),t[12]!==c||t[13]!==o||t[14]!==i||t[15]!==s||t[16]!==l||t[17]!==d||t[18]!==a||t[19]!==r?(m=e=>{const t=c(e),n=[p.jsx(IT,{table:e,forceMount:o,onExpand:()=>i(e),onAddTable:()=>s(e),isExpanded:t},e.name)];return t&&n.push(...e.columns.map((t=>p.jsxs(u.Fragment,{children:[p.jsx(AT,{table:e,column:t,onExpandColumn:l,isExpanded:d(e,t)},`${e.name}.${t.name}`),d(e,t)&&p.jsx("div",{className:"pl-10 pr-2 py-2 bg-[var(--slate-1)] shadow-inner border-b",children:p.jsx(ri,{children:p.jsx(TT,{table:e,column:t,onAddColumnChart:a,preview:r.get(`${e.name}:${t.name}`)})})})]},`${e.name}.${t.name}`)))),n},t[12]=c,t[13]=o,t[14]=i,t[15]=s,t[16]=l,t[17]=d,t[18]=a,t[19]=r,t[20]=m):m=t[20];const v=m;h=dr,f="flex flex-col overflow-auto",g=(()=>0===e.length?null:1===e.length?e[0][1].flatMap(v):e.flatMap(((e,t)=>{const[n,o]=e;return[p.jsx("div",{className:Jt("font-bold px-2 py-1 text-muted-foreground bg-[var(--slate-2)] border-t text-sm",t>0&&"border-t"),children:"memory"===n?"In-Memory":n},n),...o.flatMap(v)]})))(),t[0]=n,t[1]=c,t[2]=o,t[3]=i,t[4]=s,t[5]=l,t[6]=d,t[7]=a,t[8]=r,t[9]=h,t[10]=f,t[11]=g}else h=t[9],f=t[10],g=t[11];return t[21]!==h||t[22]!==f||t[23]!==g?(v=p.jsx(h,{className:f,children:g}),t[21]=h,t[22]=f,t[23]=g,t[24]=v):v=t[24],v},IT=e=>{const t=m(27),{table:n,onExpand:o,onAddTable:r,isExpanded:a}=e;let s;t[0]!==n.num_rows||t[1]!==n.num_columns?(s=()=>{const e=[];return null!=n.num_rows&&e.push(`${n.num_rows} rows`),null!=n.num_columns&&e.push(`${n.num_columns} columns`),0===e.length?null:p.jsx("div",{className:"flex flex-row gap-2 items-center pl-6 group-hover:hidden",children:p.jsx("span",{className:"text-xs text-muted-foreground",children:e.join(", ")})})},t[0]=n.num_rows,t[1]=n.num_columns,t[2]=s):s=t[2];const i=s,l=n.name,c=a&&"rotate-90";let d,u,h,f,g,y,b,w,k;return t[3]!==c?(d=Jt("h-3 w-3 transition-transform",c),t[3]=c,t[4]=d):d=t[4],t[5]!==d?(u=p.jsx(Jr,{className:d}),t[5]=d,t[6]=u):u=t[6],t[7]!==n.name?(h=p.jsx("span",{className:"text-sm",children:n.name}),t[7]=n.name,t[8]=h):h=t[8],t[9]!==u||t[10]!==h?(f=p.jsxs("div",{className:"flex gap-1 items-center flex-1",children:[u,h]}),t[9]=u,t[10]=h,t[11]=f):f=t[11],t[12]!==i?(g=i(),t[12]=i,t[13]=g):g=t[13],t[14]!==r||t[15]!==n?(y=qe.stopPropagation((()=>r(n))),t[14]=r,t[15]=n,t[16]=y):y=t[16],t[17]===Symbol.for("react.memo_cache_sentinel")?(b=p.jsx(Tc,{className:"h-3 w-3"}),t[17]=b):b=t[17],t[18]!==y?(w=p.jsx(v,{content:"Add table to notebook",delayDuration:400,children:p.jsx(x,{className:"group-hover:inline-flex hidden",variant:"text",size:"icon",onClick:y,children:b})}),t[18]=y,t[19]=w):w=t[19],t[20]!==n.name||t[21]!==a||t[22]!==o||t[23]!==f||t[24]!==g||t[25]!==w?(k=p.jsxs(Re,{className:"rounded-none py-1 group min-h-9 border-t",value:l,"aria-selected":a,forceMount:!0,onSelect:o,children:[f,g,w]}),t[20]=n.name,t[21]=a,t[22]=o,t[23]=f,t[24]=g,t[25]=w,t[26]=k):k=t[26],k},AT=e=>{const t=m(22),{table:n,column:o,onExpandColumn:r}=e,a=ai[o.type],s=`${n.name}.${o.name}`,i=`${n.name}.${o.name}`;let l,c,d,u,h,f,g;return t[0]!==r||t[1]!==n||t[2]!==o?(l=()=>r(n,o),t[0]=r,t[1]=n,t[2]=o,t[3]=l):l=t[3],t[4]!==a?(c=p.jsx(a,{className:"flex-shrink-0 h-3 w-3",strokeWidth:1.5}),t[4]=a,t[5]=c):c=t[5],t[6]!==o.name?(d=p.jsx("span",{children:o.name}),t[6]=o.name,t[7]=d):d=t[7],t[8]!==c||t[9]!==d?(u=p.jsxs("div",{className:"flex flex-row gap-2 items-center pl-6 flex-1",children:[c,d]}),t[8]=c,t[9]=d,t[10]=u):u=t[10],t[11]!==o.name?(h=p.jsx(v,{content:"Copy column name",delayDuration:400,children:p.jsx(x,{variant:"text",size:"icon",className:"group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground",children:p.jsx(CT,{tooltip:!1,value:o.name,className:"h-3 w-3"})})}),t[11]=o.name,t[12]=h):h=t[12],t[13]!==o.external_type?(f=p.jsx("span",{className:"text-xs text-muted-foreground",children:o.external_type}),t[13]=o.external_type,t[14]=f):f=t[14],t[15]!==s||t[16]!==i||t[17]!==l||t[18]!==u||t[19]!==h||t[20]!==f?(g=p.jsxs(Re,{className:"rounded-none py-1 group",value:i,onSelect:l,children:[u,h,f]},s),t[15]=s,t[16]=i,t[17]=l,t[18]=u,t[19]=h,t[20]=f,t[21]=g):g=t[21],g},MT=u.lazy((()=>ni((()=>import("./index-q4PqzyEM.js")),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]),import.meta.url).then((e=>({default:e.VegaLite}))))),TT=e=>{const t=m(26),{table:n,column:o,preview:r,onAddColumnChart:a}=e,{theme:s}=Ee();if(!r){let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=p.jsx("span",{className:"text-xs text-muted-foreground",children:"Loading..."}),t[0]=e):e=t[0],e}let i;t[1]!==r.error?(i=r.error&&p.jsx("span",{className:"text-xs text-muted-foreground",children:r.error}),t[1]=r.error,t[2]=i):i=t[2];const l=i;let c;t[3]!==r.summary?(c=r.summary&&p.jsx("div",{className:"gap-x-16 gap-y-1 grid grid-cols-2-fit border rounded p-2 empty:hidden",children:Object.entries(r.summary).map(RT)}),t[3]=r.summary,t[4]=c):c=t[4];const d=c,u=FT;let h;t[5]!==r.chart_spec||t[6]!==s?(h=r.chart_spec&&p.jsx(MT,{spec:u(JSON.parse(r.chart_spec)),width:"container",height:100,actions:!1,theme:"dark"===s?"dark":"vox"}),t[5]=r.chart_spec,t[6]=s,t[7]=h):h=t[7];const f=h;let g;t[8]!==r.chart_code||t[9]!==n||t[10]!==a?(g=r.chart_code&&"local"===n.source_type&&p.jsx(v,{content:"Add chart to notebook",delayDuration:400,children:p.jsx(x,{variant:"outline",size:"icon",className:"z-10 bg-background absolute right-1 -top-1",onClick:qe.stopPropagation((()=>a(r.chart_code||""))),children:p.jsx(Tc,{className:"h-3 w-3"})})}),t[8]=r.chart_code,t[9]=n,t[10]=a,t[11]=g):g=t[11];const y=g;let b;t[12]!==n||t[13]!==o||t[14]!==a?(b="duckdb"===n.source_type&&p.jsx(v,{content:"Add SQL cell",delayDuration:400,children:p.jsx(x,{variant:"outline",size:"icon",className:"z-10 bg-background absolute right-1 -top-1",onClick:qe.stopPropagation((()=>{const e=`_df = mo.sql(f'SELECT "${o.name}" FROM ${n.name} LIMIT 100')`;a(e)})),children:p.jsx(Tc,{className:"h-3 w-3"})})}),t[12]=n,t[13]=o,t[14]=a,t[15]=b):b=t[15];const w=b;let k;t[16]!==r.chart_max_rows_errors?(k=r.chart_max_rows_errors&&p.jsx("span",{className:"text-xs text-muted-foreground",children:"Too many rows to render the chart."}),t[16]=r.chart_max_rows_errors,t[17]=k):k=t[17];const N=k;if(!(l||d||f||N)){let e;return t[18]===Symbol.for("react.memo_cache_sentinel")?(e=p.jsx("span",{className:"text-xs text-muted-foreground",children:"No data"}),t[18]=e):e=t[18],e}let E;return t[19]!==l||t[20]!==y||t[21]!==w||t[22]!==N||t[23]!==f||t[24]!==d?(E=p.jsxs("div",{className:"flex flex-col gap-2 relative",children:[l,y,w,N,f,d]}),t[19]=l,t[20]=y,t[21]=w,t[22]=N,t[23]=f,t[24]=d,t[25]=E):E=t[25],E};function OT(e){return e.source}function DT(e){return e}function PT(e){const[t]=e;return"memory"===t?0:1}function RT(e){const[t,n]=e;return null==n?null:p.jsxs("div",{className:"flex items-center gap-1 group",children:[p.jsx(CT,{className:"h-3 w-3 invisible group-hover:visible",value:String(n)}),p.jsx("span",{className:"text-xs min-w-[60px] uppercase",children:t}),p.jsx("span",{className:"text-xs font-bold text-muted-foreground tracking-wide",children:si(n)})]},t)}function FT(e){return{...e,config:{...e.config,background:"transparent"}}}const LT=e=>{const t=m(4),{isOpen:n,children:o}=e,[r,a]=u.useState(!1);let s,i;return t[0]!==n||t[1]!==r?(s=()=>{n&&!r&&a(!0)},i=[n,r],t[0]=n,t[1]=r,t[2]=s,t[3]=i):(s=t[2],i=t[3]),u.useEffect(s,i),r?o:null},zT=Ir("marimo:scratchpadHistory:v1",[]),BT=H(!1),UT=H(null,((e,t,n)=>{if(!(n=n.trim()))return;const o=e(zT),r=[n,...o.filter((e=>e!==n))].slice(0,15);t(zT,r)})),VT={hide_code:!1,disabled:!1},$T=()=>{const e=m(79),t=L(),[n]=Ce(),{theme:o}=Ee(),a=r.useRef(null),s=gd(),{createNewCell:i,updateCellCode:l}=B(),c=t.cellRuntime[Ne],d=null==c?void 0:c.output,u=null==c?void 0:c.status,h=null==c?void 0:c.consoleOutputs,f=t.cellData[Ne],y=(null==f?void 0:f.code)??"",b=ne(UT),[w,k]=Ie(BT),N=te(zT);let E;e[0]!==y||e[1]!==b?(E=()=>{ii({code:y}),b(y)},e[0]=y,e[1]=b,e[2]=E):E=e[2];const C=z(E);let S;e[3]!==y||e[4]!==i||e[5]!==s?(S=()=>{y.trim()&&i({code:y,before:!1,cellId:s??"__end__"})},e[3]=y,e[4]=i,e[5]=s,e[6]=S):S=e[6];const j=z(S);let _;e[7]!==l?(_=()=>{l({cellId:Ne,code:"",formattingChange:!1}),ii({code:""});const e=a.current;e&&e.dispatch({changes:{from:0,to:e.state.doc.length,insert:""}})},e[7]=l,e[8]=_):_=e[8];const I=z(_);let A;e[9]!==k||e[10]!==l?(A=e=>{k(!1),l({cellId:Ne,code:e,formattingChange:!1});const t=a.current;t&&t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}})},e[9]=k,e[10]=l,e[11]=A):A=e[11];const M=z(A);let T,O,D,P,R,F,U,V;if(e[12]!==o||e[13]!==y||e[14]!==C||e[15]!==l||e[16]!==n||e[17]!==d||e[18]!==h||e[19]!==w||e[20]!==N||e[21]!==M||e[22]!==I||e[23]!==j||e[24]!==u||e[25]!==k){const t=()=>p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[40%]",children:p.jsx(jb,{theme:o,allowFocus:!1,showPlaceholder:!1,id:Ne,code:y,config:VT,status:"idle",serializedEditorState:null,runCell:C,updateCellCode:l,createNewCell:Xt.NOOP,deleteCell:Xt.NOOP,focusCell:Xt.NOOP,moveCell:Xt.NOOP,moveToNextCell:void 0,updateCellConfig:Xt.NOOP,clearSerializedEditorState:Xt.NOOP,userConfig:n,editorViewRef:a,hidden:!1})}),p.jsx("div",{className:"flex-1 overflow-auto flex-shrink-0",children:p.jsx(aa,{allowExpand:!1,output:d,className:"output-area",cellId:Ne,stale:!1})}),p.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[35%]",children:p.jsx(el,{consoleOutputs:h,className:"overflow-auto",stale:!1,cellName:_s,onSubmitDebugger:Xt.NOOP,cellId:Ne,debuggerActive:!1})})]});let r;e[32]!==w||e[33]!==N||e[34]!==M||e[35]!==o?(r=()=>w?p.jsx("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:p.jsx("div",{className:"overflow-auto flex flex-col gap-3",children:N.map(((e,t)=>p.jsx("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>M(e),children:p.jsx(Bs,{language:"python",theme:o,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:e.trim(),editable:!1,readOnly:!0})},t)))})}):null,e[32]=w,e[33]=N,e[34]=M,e[35]=o,e[36]=r):r=e[36];const s=r;let i,c,m,f,b,E,S,_,A;D="flex flex-col h-full overflow-hidden divide-y",e[37]===Symbol.for("react.memo_cache_sentinel")?(P=at.create(Ne),e[37]=P):P=e[37],e[38]===Symbol.for("react.memo_cache_sentinel")?(i=g("cell.run"),e[38]=i):i=e[38],e[39]===Symbol.for("react.memo_cache_sentinel")?(c=p.jsx(vc,{color:"var(--grass-11)",size:16}),e[39]=c):c=e[39],e[40]!==C||e[41]!==w?(m=p.jsx(v,{content:i,children:p.jsx(x,{"data-testid":"scratchpad-run-button",onClick:C,disabled:w,variant:"text",size:"xs",children:c})}),e[40]=C,e[41]=w,e[42]=m):m=e[42],e[43]===Symbol.for("react.memo_cache_sentinel")?(f=p.jsx(Wl,{size:16}),e[43]=f):f=e[43],e[44]!==w||e[45]!==I?(b=p.jsx(v,{content:"Clear code and outputs",children:p.jsx(x,{disabled:w,size:"xs",variant:"text",onClick:I,children:f})}),e[44]=w,e[45]=I,e[46]=b):b=e[46],e[47]===Symbol.for("react.memo_cache_sentinel")?(E=p.jsx(Tl,{size:16}),e[47]=E):E=e[47],e[48]!==w||e[49]!==j?(S=p.jsx(fu,{children:p.jsx(v,{content:"Insert code",children:p.jsx(x,{disabled:w,size:"xs",variant:"text",onClick:j,children:E})})}),e[48]=w,e[49]=j,e[50]=S):S=e[50],e[51]!==u?(_=("running"===u||"queued"===u)&&p.jsx(Ka,{className:"inline",size:"small"}),e[51]=u,e[52]=_):_=e[52],e[53]===Symbol.for("react.memo_cache_sentinel")?(A=p.jsx("div",{className:"flex-1"}),e[53]=A):A=e[53];const L=w&&"bg-[var(--sky-3)] rounded-none";let z,B;e[54]!==L?(z=Jt(L),e[54]=L,e[55]=z):z=e[55],e[56]!==k||e[57]!==w?(B=()=>k(!w),e[56]=k,e[57]=w,e[58]=B):B=e[58];const U=0===N.length;let V,$;e[59]===Symbol.for("react.memo_cache_sentinel")?(V=p.jsx(ec,{size:16}),e[59]=V):V=e[59],e[60]!==z||e[61]!==B||e[62]!==U?($=p.jsx(v,{content:"Toggle history",children:p.jsx(x,{size:"xs",variant:"text",className:z,onClick:B,disabled:U,children:V})}),e[60]=z,e[61]=B,e[62]=U,e[63]=$):$=e[63],e[64]!==m||e[65]!==b||e[66]!==S||e[67]!==_||e[68]!==$?(R=p.jsxs("div",{className:"flex items-center flex-shrink-0",children:[m,b,S,_,A,$]}),e[64]=m,e[65]=b,e[66]=S,e[67]=_,e[68]=$,e[69]=R):R=e[69],T="flex-1 divide-y relative",O=t(),F=s(),e[12]=o,e[13]=y,e[14]=C,e[15]=l,e[16]=n,e[17]=d,e[18]=h,e[19]=w,e[20]=N,e[21]=M,e[22]=I,e[23]=j,e[24]=u,e[25]=k,e[26]=T,e[27]=O,e[28]=D,e[29]=P,e[30]=R,e[31]=F}else T=e[26],O=e[27],D=e[28],P=e[29],R=e[30],F=e[31];return e[70]!==T||e[71]!==O||e[72]!==F?(U=p.jsxs("div",{className:T,children:[O,F]}),e[70]=T,e[71]=O,e[72]=F,e[73]=U):U=e[73],e[74]!==D||e[75]!==P||e[76]!==R||e[77]!==U?(V=p.jsxs("div",{className:D,id:P,children:[R,U]}),e[74]=D,e[75]=P,e[76]=R,e[77]=U,e[78]=V):V=e[78],V},GT=()=>{const e=m(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=p.jsx($T,{}),e[0]=t):t=e[0],t},HT=()=>{const e=m(16),[t]=Ce(),n=t.package_management.manager;let o;e[0]!==n?(o=[n],e[0]=n,e[1]=o):o=e[1];const{data:r,loading:a,error:s,reload:i}=Zt(KT,o);if(a&&!r){let t;return e[2]===Symbol.for("react.memo_cache_sentinel")?(t=p.jsx(Ka,{size:"medium",centered:!0}),e[2]=t):t=e[2],t}if(s){let t;return e[3]!==s?(t=p.jsx(Ds,{error:s}),e[3]=s,e[4]=t):t=e[4],t}let l;e[5]!==(null==r?void 0:r.packages)?(l=(null==r?void 0:r.packages)||[],e[5]=null==r?void 0:r.packages,e[6]=l):l=e[6];const c=l;let d,u,h;return e[7]!==n||e[8]!==i?(d=p.jsx(WT,{packageManager:n,onSuccess:i}),e[7]=n,e[8]=i,e[9]=d):d=e[9],e[10]!==c||e[11]!==i?(u=p.jsx(qT,{packages:c,onSuccess:i}),e[10]=c,e[11]=i,e[12]=u):u=e[12],e[13]!==d||e[14]!==u?(h=p.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[d,u]}),e[13]=d,e[14]=u,e[15]=h):h=e[15],h},WT=({onSuccess:e,packageManager:t})=>{const[n,o]=u.useState(""),[r,a]=u.useState(!1),s=async()=>{try{a(!0);const t=await di({package:n});t.success?(e(),X({title:"Package added",description:p.jsxs("span",{children:["The package ",p.jsx(_a,{className:"inline",children:n})," and its dependencies has been added to your environment."]})})):X({title:"Failed to add package",description:t.error,variant:"danger"})}finally{o(""),a(!1)}};return p.jsxs("div",{className:"flex items-center w-full border-b",children:[p.jsx(bs,{placeholder:`Install packages with ${t}...`,icon:r?p.jsx(Ka,{size:"small",className:"mr-2 h-4 w-4 shrink-0 opacity-50"}):p.jsx(Dl,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),rootClassName:"flex-1 border-none",value:n,onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),s())},onChange:e=>o(e.target.value)}),p.jsx(v,{delayDuration:300,side:"left",align:"start",content:p.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:",p.jsxs("div",{className:"flex flex-col gap-2 mt-2",children:[p.jsxs("div",{children:[p.jsx("span",{className:"font-bold tracking-wide",children:"Package name:"})," A package name; this will install the latest version.",p.jsx("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),p.jsxs("div",{children:[p.jsx("span",{className:"font-bold tracking-wide",children:"Package and version:"})," ","A package with a specific version or version range.",p.jsx("div",{className:"text-muted-foreground",children:"Examples: httpx==0.27.0, httpx>=0.27.0"})]}),p.jsxs("div",{children:[p.jsx("span",{className:"font-bold tracking-wide",children:"Git:"})," A Git repository",p.jsx("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),p.jsxs("div",{children:[p.jsx("span",{className:"font-bold tracking-wide",children:"URL:"})," A remote wheel or source distribution.",p.jsx("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),p.jsxs("div",{children:[p.jsx("span",{className:"font-bold tracking-wide",children:"Path:"})," A local wheel, source distribution, or project directory.",p.jsx("div",{className:"text-muted-foreground",children:"Example: /example/foo-0.1.0-py3-none-any.whl"})]})]})]}),children:p.jsx(li,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),p.jsx("button",{type:"button",className:Jt("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:s,disabled:!n,children:"Add"})]})},qT=e=>{const t=m(9),{onSuccess:n,packages:o}=e;if(0===o.length){let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=p.jsx(xN,{title:"No packages",description:"No packages are installed in this environment.",icon:p.jsx(Dl,{})}),t[0]=e):e=t[0],e}let r,a,s;if(t[1]===Symbol.for("react.memo_cache_sentinel")?(r=p.jsx(ks,{children:p.jsxs(Ns,{children:[p.jsx(Es,{children:"Name"}),p.jsx(Es,{children:"Version"}),p.jsx(Es,{})]})}),t[1]=r):r=t[1],t[2]!==n||t[3]!==o){let e;t[5]!==n?(e=e=>p.jsxs(Ns,{className:"group",onClick:async()=>{await We(`${e.name}==${e.version}`),X({title:"Copied to clipboard"})},children:[p.jsx(js,{children:e.name}),p.jsx(js,{children:e.version}),p.jsx(js,{children:p.jsx(YT,{packageName:e.name,onSuccess:n})})]},e.name),t[5]=n,t[6]=e):e=t[6],a=o.map(e),t[2]=n,t[3]=o,t[4]=a}else a=t[4];return t[7]!==a?(s=p.jsxs(ws,{className:"overflow-auto flex-1",children:[r,p.jsx(Ss,{children:a})]}),t[7]=a,t[8]=s):s=t[8],s},YT=({packageName:e,onSuccess:t})=>{const[n,o]=u.useState(!1);return n?p.jsx(Ka,{size:"small",className:"float-right mr-2 h-4 w-4 shrink-0 opacity-50"}):p.jsx("button",{type:"button",className:Jt("float-right px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible"),onClick:qe.stopPropagation((async()=>{try{o(!0);const n=await ui({package:e});n.success?(t(),X({title:"Package removed",description:p.jsxs("span",{children:["The package ",p.jsx(_a,{className:"inline",children:e})," has been removed from your environment."]})})):X({title:"Failed to add package",description:n.error,variant:"danger"})}finally{o(!1)}})),children:"Remove"})};function KT(){return ci()}const JT=u.lazy((()=>ni((()=>import("./terminal-CtWgl8M5.js")),__vite__mapDeps([15,2,3,16]),import.meta.url))),XT=e=>{const t=m(110),{children:n}=e,{isSidebarOpen:o,isTerminalOpen:a,selectedPanel:s}=Od(),{setIsSidebarOpen:i,setIsTerminalOpen:l}=Dd(),c=u.useRef(null),d=u.useRef(null);let h,f,g,v,y;t[0]!==o?(h=()=>{if(!c.current)return;const e=c.current.isCollapsed();o&&e&&c.current.expand(),o||e||c.current.collapse(),requestAnimationFrame((()=>{requestAnimationFrame((()=>{window.dispatchEvent(new Event("resize"))}))}))},f=[o],t[0]=o,t[1]=h,t[2]=f):(h=t[1],f=t[2]),r.useEffect(h,f),t[3]!==a?(g=()=>{if(!d.current)return;const e=d.current.isCollapsed();a&&e&&d.current.expand(),a||e||d.current.collapse(),requestAnimationFrame((()=>{requestAnimationFrame((()=>{window.dispatchEvent(new Event("resize"))}))}))},v=[a],t[3]=a,t[4]=g,t[5]=v):(g=t[4],v=t[5]),r.useEffect(g,v),t[6]!==n?(y=p.jsx(Ow,{id:"app",className:"relative h-full",children:p.jsx(r.Suspense,{children:n})},"app"),t[6]=n,t[7]=y):y=t[7];const b=y,w=ZT,k=o?"resize-handle":"resize-handle-collapsed";let N,E;t[8]!==k?(N=Jt("border-border no-print z-10",k,"vertical"),t[8]=k,t[9]=N):N=t[9],t[10]!==N?(E=p.jsx(Uk,{onDragging:w,className:N}),t[10]=N,t[11]=E):E=t[11];const C=E,S=a?"resize-handle":"resize-handle-collapsed";let j,_;t[12]!==S?(j=Jt("border-border no-print z-20",S,"horizontal"),t[12]=S,t[13]=j):j=t[13],t[14]!==j?(_=p.jsx(Uk,{onDragging:w,className:j}),t[14]=j,t[15]=_):_=t[15];const I=_;let A,M,T,O,D,P,R,F,L,z,B,U,V,$,G,H,W;t[16]!==s?(A=p.jsx("div",{className:"text-sm text-[var(--slate-11)] uppercase tracking-wide font-semibold flex-1",children:s}),t[16]=s,t[17]=A):A=t[17],t[18]!==i?(M=()=>i(!1),t[18]=i,t[19]=M):M=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(T=p.jsx(qt,{className:"w-4 h-4"}),t[20]=T):T=t[20],t[21]!==M?(O=p.jsx(x,{"data-testid":"close-helper-pane",className:"m-0",size:"xs",variant:"text",onClick:M,children:T}),t[21]=M,t[22]=O):O=t[22],t[23]!==A||t[24]!==O?(D=p.jsxs("div",{className:"p-3 border-b flex justify-between items-center",children:[A,O]}),t[23]=A,t[24]=O,t[25]=D):D=t[25],t[26]!==s?(P="files"===s&&p.jsx(gT,{}),t[26]=s,t[27]=P):P=t[27],t[28]!==s?(R="errors"===s&&p.jsx(yN,{}),t[28]=s,t[29]=R):R=t[29],t[30]!==s?(F="variables"===s&&p.jsx(FM,{}),t[30]=s,t[31]=F):F=t[31],t[32]!==s?(L="dependencies"===s&&p.jsx(MM,{}),t[32]=s,t[33]=L):L=t[33],t[34]!==s?(z="packages"===s&&p.jsx(HT,{}),t[34]=s,t[35]=z):z=t[35],t[36]!==s?(B="outline"===s&&p.jsx(wN,{}),t[36]=s,t[37]=B):B=t[37],t[38]!==s?(U="datasources"===s&&p.jsx(jT,{}),t[38]=s,t[39]=U):U=t[39],t[40]!==s?(V="documentation"===s&&p.jsx(VM,{}),t[40]=s,t[41]=V):V=t[41],t[42]!==s?($="snippets"===s&&p.jsx(wT,{}),t[42]=s,t[43]=$):$=t[43],t[44]!==s?(G="scratchpad"===s&&p.jsx(GT,{}),t[44]=s,t[45]=G):G=t[45],t[46]!==s?(H="logs"===s&&p.jsx(LM,{}),t[46]=s,t[47]=H):H=t[47],t[48]!==D||t[49]!==P||t[50]!==R||t[51]!==F||t[52]!==L||t[53]!==z||t[54]!==B||t[55]!==U||t[56]!==V||t[57]!==$||t[58]!==G||t[59]!==H?(W=p.jsx(ri,{children:p.jsx(r.Suspense,{children:p.jsxs("div",{className:"flex flex-col h-full flex-1 overflow-hidden mr-[-4px]",children:[D,P,R,F,L,z,B,U,V,$,G,H]})})}),t[48]=D,t[49]=P,t[50]=R,t[51]=F,t[52]=L,t[53]=z,t[54]=B,t[55]=U,t[56]=V,t[57]=$,t[58]=G,t[59]=H,t[60]=W):W=t[60];const q=W,Y=o&&"border-r border-l border-[var(--slate-7)]";let K,J,X,Z,Q,ee;t[61]!==Y?(K=Jt("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",Y),t[61]=Y,t[62]=K):K=t[62],t[63]===Symbol.for("react.memo_cache_sentinel")?(J=(e,t)=>{var n;0===t&&10===e&&(null==(n=c.current)||n.resize(30))},t[63]=J):J=t[63],t[64]!==i?(X=()=>i(!1),Z=()=>i(!0),t[64]=i,t[65]=X,t[66]=Z):(X=t[65],Z=t[66]),t[67]!==q||t[68]!==C?(Q=p.jsxs("span",{className:"flex flex-row h-full",children:[q," ",C]}),t[67]=q,t[68]=C,t[69]=Q):Q=t[69],t[70]!==c||t[71]!==K||t[72]!==X||t[73]!==Z||t[74]!==Q?(ee=p.jsx(Ow,{ref:c,id:"helper",collapsedSize:0,collapsible:!0,className:K,minSize:10,defaultSize:0,maxSize:75,onResize:J,onCollapse:X,onExpand:Z,children:Q},"helper"),t[70]=c,t[71]=K,t[72]=X,t[73]=Z,t[74]=Q,t[75]=ee):ee=t[75];const te=ee,ne=a&&"border-[var(--slate-7)]";let oe,re,ae,se,ie,le,ce,de;t[76]!==ne?(oe=Jt("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",ne),t[76]=ne,t[77]=oe):oe=t[77],t[78]===Symbol.for("react.memo_cache_sentinel")?(re=(e,t)=>{var n;0===t&&10===e&&(null==(n=d.current)||n.resize(30))},t[78]=re):re=t[78],t[79]!==l?(ae=()=>l(!1),se=()=>l(!0),t[79]=l,t[80]=ae,t[81]=se):(ae=t[80],se=t[81]),t[82]!==l?(ie=()=>l(!1),t[82]=l,t[83]=ie):ie=t[83],t[84]!==a||t[85]!==ie?(le=p.jsx(JT,{visible:a,onClose:ie}),t[84]=a,t[85]=ie,t[86]=le):le=t[86],t[87]!==a||t[88]!==le?(ce=p.jsx(LT,{isOpen:a,children:le}),t[87]=a,t[88]=le,t[89]=ce):ce=t[89],t[90]!==d||t[91]!==oe||t[92]!==ae||t[93]!==se||t[94]!==I||t[95]!==ce?(de=p.jsxs(Ow,{ref:d,id:"terminal",collapsedSize:0,collapsible:!0,className:oe,minSize:10,defaultSize:0,maxSize:75,onResize:re,onCollapse:ae,onExpand:se,children:[I,ce]},"terminal"),t[90]=d,t[91]=oe,t[92]=ae,t[93]=se,t[94]=I,t[95]=ce,t[96]=de):de=t[96];const ue=de;let he,me,fe,pe,ge,ve,xe;return t[97]===Symbol.for("react.memo_cache_sentinel")?(he={getItem:e=>vN||(vN??null),setItem(e,t){vN=t||null}},me=p.jsx(uN,{}),t[97]=he,t[98]=me):(he=t[97],me=t[98]),t[99]!==ue?(fe=p.jsx(oN,{capability:"terminal",children:ue}),t[99]=ue,t[100]=fe):fe=t[100],t[101]!==b||t[102]!==fe?(pe=p.jsx(Ow,{children:p.jsxs(Lk,{autoSaveId:"marimo:chrome:v1:l1",direction:"vertical",children:[b,fe]})}),t[101]=b,t[102]=fe,t[103]=pe):pe=t[103],t[104]!==te||t[105]!==pe?(ge=p.jsxs(Lk,{autoSaveId:"marimo:chrome:v1:l2",direction:"horizontal",storage:he,children:[me,te,pe]}),t[104]=te,t[105]=pe,t[106]=ge):ge=t[106],t[107]===Symbol.for("react.memo_cache_sentinel")?(ve=p.jsx(ri,{children:p.jsx(rN,{})}),t[107]=ve):ve=t[107],t[108]!==ge?(xe=p.jsxs("div",{className:"flex flex-col flex-1 overflow-hidden absolute inset-0 print:relative",children:[ge,ve]}),t[108]=ge,t[109]=xe):xe=t[109],xe};function ZT(e){e||window.dispatchEvent(new Event("resize"))}const QT=e=>{const t=m(5);let n,o,r;return t[0]!==e?(n=p.jsx(aw,{...e}),t[0]=e,t[1]=n):n=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(o=p.jsx(wd,{}),t[2]=o):o=t[2],t[3]!==n?(r=p.jsxs(XT,{children:[n,o]}),t[3]=n,t[4]=r):r=t[4],r};export{QT as default};