@marimo-team/frontend 0.14.10-dev20 → 0.14.10-dev3
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.
- package/dist/assets/{ConnectedDataExplorerComponent-xhypXmHP.js → ConnectedDataExplorerComponent-DlFZ9wdD.js} +1 -1
- package/dist/assets/{ImageComparisonComponent-CuT2DiU_.js → ImageComparisonComponent-CUztY-Bx.js} +1 -1
- package/dist/assets/{VegaLite-CZPBjYdL.js → VegaLite-COHJ-W2y.js} +1 -1
- package/dist/assets/{_baseEach-BCq1QunV.js → _baseEach-CIwfC8KI.js} +1 -1
- package/dist/assets/_baseMap-CWwnc8Fb.js +1 -0
- package/dist/assets/{_baseUniq-DsVx03Xh.js → _baseUniq-D-Wv2aZA.js} +1 -1
- package/dist/assets/{_createAggregator-Ba81XR0f.js → _createAggregator-BFY8QAxM.js} +1 -1
- package/dist/assets/{any-language-editor-D89ohP8-.js → any-language-editor-CmwMcKCg.js} +1 -1
- package/dist/assets/{architectureDiagram-IEHRJDOE-Bqy8A1ty.js → architectureDiagram-IEHRJDOE-DwbLG1K6.js} +1 -1
- package/dist/assets/{blockDiagram-JOT3LUYC-DWGFz276.js → blockDiagram-JOT3LUYC-rjtCCZm-.js} +1 -1
- package/dist/assets/{c4Diagram-VJAJSXHY-BaOdN25X.js → c4Diagram-VJAJSXHY-NkCM-dfk.js} +1 -1
- package/dist/assets/channel-Br7XUERZ.js +1 -0
- package/dist/assets/{chunk-4BMEZGHF-CkjJnX2u.js → chunk-4BMEZGHF-BjB6DBlu.js} +1 -1
- package/dist/assets/{chunk-A2AXSNBT-a1s-o-2J.js → chunk-A2AXSNBT-n3U9Tlep.js} +1 -1
- package/dist/assets/{chunk-AEK57VVT-AIgYDw2J.js → chunk-AEK57VVT-DKgqkz3G.js} +1 -1
- package/dist/assets/{chunk-D6G4REZN-DWoFE-ph.js → chunk-D6G4REZN-CMcpV03x.js} +1 -1
- package/dist/assets/{chunk-RZ5BOZE2-D_FFPG3U.js → chunk-RZ5BOZE2-hSgO414F.js} +1 -1
- package/dist/assets/{chunk-XZIHB7SX-EkhL4wJD.js → chunk-XZIHB7SX-2bBuPjFw.js} +1 -1
- package/dist/assets/{circle-play-BMHPESBW.js → circle-play-B6y4l4ml.js} +1 -1
- package/dist/assets/classDiagram-GIVACNV2-Dd5VO8M9.js +1 -0
- package/dist/assets/classDiagram-v2-COTLJTTW-Dd5VO8M9.js +1 -0
- package/dist/assets/clone-C-g0Z-kJ.js +1 -0
- package/dist/assets/{compile-Damt1e16.js → compile-Ds3GpY37.js} +1 -1
- package/dist/assets/{dagre-OKDRZEBW-CGUb-yRu.js → dagre-OKDRZEBW-DqqVSsIq.js} +1 -1
- package/dist/assets/{data-editor-bYstOkO_.js → data-editor-D1OkJiC1.js} +1 -1
- package/dist/assets/{diagram-SSKATNLV-FwTyvSfY.js → diagram-SSKATNLV-Bz9FQ6IS.js} +1 -1
- package/dist/assets/{diagram-VNBRO52H-3TqYsaSt.js → diagram-VNBRO52H-BqsmOGnR.js} +1 -1
- package/dist/assets/{edit-page-DDga9Bn0.js → edit-page-BHOMHIQ_.js} +4 -4
- package/dist/assets/{erDiagram-Q7BY3M3F-CtRJc8Nz.js → erDiagram-Q7BY3M3F-Cbxy8mle.js} +1 -1
- package/dist/assets/{flowDiagram-4HSFHLVR-DjtJKD_Z.js → flowDiagram-4HSFHLVR-QBJUvrkt.js} +1 -1
- package/dist/assets/{ganttDiagram-APWFNJXF-9Lh3_xwg.js → ganttDiagram-APWFNJXF-hJaDkxfe.js} +1 -1
- package/dist/assets/{gitGraphDiagram-7IBYFJ6S-mSQBtVLg.js → gitGraphDiagram-7IBYFJ6S-DaHHSvj1.js} +1 -1
- package/dist/assets/{graph-IrIGy0Ij.js → graph-CaeG45ac.js} +1 -1
- package/dist/assets/{home-page-CNMiYKVV.js → home-page-bypbKurs.js} +1 -1
- package/dist/assets/{index-EbLetw4e.js → index-B0v1TUmW.js} +1 -1
- package/dist/assets/{index-35e8utiM.js → index-BIoa1h_M.js} +1 -1
- package/dist/assets/{index-2n_uhCrQ.js → index-BZilHG_6.js} +1 -1
- package/dist/assets/{index-BsUs07E9.js → index-BrLZu1m3.js} +1 -1
- package/dist/assets/{index-CSsS2b0Z.js → index-Bt9ulLuD.js} +1 -1
- package/dist/assets/{index-Bfi4fmBc.js → index-Bv2lycgb.js} +1 -1
- package/dist/assets/{index-DhdD-An0.js → index-C5FhBFgH.js} +1 -1
- package/dist/assets/{index-CUzcOfxz.js → index-CMc3obDE.js} +1 -1
- package/dist/assets/{index-Cq15mGfX.js → index-CScw2zd1.js} +1 -1
- package/dist/assets/{index-C3fEZ0Os.js → index-CZGVf2t7.js} +1 -1
- package/dist/assets/{index-Ba21-oA7.js → index-CeN2C0l1.js} +1 -1
- package/dist/assets/{index-BVP4ykSA.js → index-DZIgtc-p.js} +1 -1
- package/dist/assets/{index-Dyk-xt3p.js → index-DetPm8Wz.js} +1 -1
- package/dist/assets/{index-BzDF-7zA.js → index-DjeOFBOc.js} +1 -1
- package/dist/assets/{index-JuXGMVhT.js → index-DuMWjnm-.js} +1 -1
- package/dist/assets/{index-txb0mb7R.js → index-Efv2AoHv.js} +146 -146
- package/dist/assets/{index-DEVx6k2J.js → index-kUwGWpGA.js} +1 -1
- package/dist/assets/{index-Dab8F8qD.js → index-koMCYoOd.js} +1 -1
- package/dist/assets/{index-5b7VjltT.js → index-kop0pRsf.js} +1 -1
- package/dist/assets/infoDiagram-PH2N3AL5-3FSmJO6S.js +2 -0
- package/dist/assets/{journeyDiagram-U35MCT3I-CbytJqly.js → journeyDiagram-U35MCT3I-CfEnFYue.js} +1 -1
- package/dist/assets/{kanban-definition-NDS4AKOZ-W6yBdwhF.js → kanban-definition-NDS4AKOZ-Ds_QEBio.js} +1 -1
- package/dist/assets/{layout-DlbUiVTi.js → layout-qpXZ8cU9.js} +1 -1
- package/dist/assets/{linear-Dj45uvUC.js → linear-BAbOG_EP.js} +1 -1
- package/dist/assets/{mermaid-CF64dWR7.js → mermaid-D83rqikS.js} +4 -4
- package/dist/assets/{min-Bi7qOXpu.js → min-leFdsuRH.js} +1 -1
- package/dist/assets/{mindmap-definition-ALO5MXBD-CEZNGiuh.js → mindmap-definition-ALO5MXBD-BcaJvQjC.js} +1 -1
- package/dist/assets/{pieDiagram-IB7DONF6-Bmtf6Osx.js → pieDiagram-IB7DONF6-BxYs4q66.js} +1 -1
- package/dist/assets/{quadrantDiagram-7GDLP6J5-BJI493xo.js → quadrantDiagram-7GDLP6J5-DILqJmYw.js} +1 -1
- package/dist/assets/{radar-MK3ICKWK-tcdT_E-c.js → radar-MK3ICKWK-J8qsfnWG.js} +1 -1
- package/dist/assets/{react-plotly-Cm8tbitC.js → react-plotly-DrsKuFjj.js} +1 -1
- package/dist/assets/{requirementDiagram-KVF5MWMF-B0Dl_7g_.js → requirementDiagram-KVF5MWMF-CE89hd83.js} +1 -1
- package/dist/assets/{run-page-D4giGLEq.js → run-page-YxUvlgx8.js} +1 -1
- package/dist/assets/{sankeyDiagram-QLVOVGJD-3MDzKxBN.js → sankeyDiagram-QLVOVGJD-Coc8Aeo-.js} +1 -1
- package/dist/assets/{sequenceDiagram-X6HHIX6F-5W9llLvo.js → sequenceDiagram-X6HHIX6F-CyKnW4j0.js} +1 -1
- package/dist/assets/{shutdown-button-s5kelj0_.js → shutdown-button-iAjIETC2.js} +1 -1
- package/dist/assets/{slides-component-Bj1IZwWl.js → slides-component-4vkuB1VP.js} +1 -1
- package/dist/assets/{sortBy-YjMpBoem.js → sortBy-S-JAmHjf.js} +1 -1
- package/dist/assets/{stateDiagram-DGXRK772-CDmwph_l.js → stateDiagram-DGXRK772-RDXxGkev.js} +1 -1
- package/dist/assets/stateDiagram-v2-YXO3MK2T-BFPOPxos.js +1 -0
- package/dist/assets/{storage-TQaz51Ul.js → storage-D99GqsAj.js} +3 -3
- package/dist/assets/{terminal-BoXScU3t.js → terminal-CujgA_Fv.js} +1 -1
- package/dist/assets/{time-uFdtyzoO.js → time-DLrmhaqR.js} +1 -1
- package/dist/assets/{timeline-definition-BDJGKUSR-Bc4KvRrH.js → timeline-definition-BDJGKUSR-BGMUaMou.js} +1 -1
- package/dist/assets/{tracing-C7fLEsxH.js → tracing-DWbu8K8J.js} +2 -2
- package/dist/assets/{vega-component-DETxercC.js → vega-component-DgKGkxEr.js} +1 -1
- package/dist/assets/{xychartDiagram-VJFVF3MP-YgHFBUco.js → xychartDiagram-VJFVF3MP-C-QBiihj.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +10 -6
- package/dist/assets/_baseMap-DIOkSXLh.js +0 -1
- package/dist/assets/channel-CkgsSbnI.js +0 -1
- package/dist/assets/classDiagram-GIVACNV2-B0rECIpB.js +0 -1
- package/dist/assets/classDiagram-v2-COTLJTTW-B0rECIpB.js +0 -1
- package/dist/assets/clone-DnjbzbBr.js +0 -1
- package/dist/assets/infoDiagram-PH2N3AL5-Djntz0RO.js +0 -2
- package/dist/assets/stateDiagram-v2-YXO3MK2T-C-dFepoJ.js +0 -1
@@ -1,5 +1,5 @@
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./tracing-
|
2
|
-
var rz=Object.defineProperty;var S3=Rt=>{throw TypeError(Rt)};var sz=(Rt,Ct,dn)=>Ct in Rt?rz(Rt,Ct,{enumerable:!0,configurable:!0,writable:!0,value:dn}):Rt[Ct]=dn;var Q=(Rt,Ct,dn)=>sz(Rt,typeof Ct!="symbol"?Ct+"":Ct,dn),iz=(Rt,Ct,dn)=>Ct.has(Rt)||S3("Cannot "+dn);var C3=(Rt,Ct,dn)=>(iz(Rt,Ct,"read from private field"),dn?dn.call(Rt):Ct.get(Rt)),N3=(Rt,Ct,dn)=>Ct.has(Rt)?S3("Cannot add the same private member more than once"):Ct instanceof WeakSet?Ct.add(Rt):Ct.set(Rt,dn);import{u as Oe,Q as T,ia as az,ib as lz,ic as j3,id as cz,ie as dz,ig as uz,a as K,ih as hz,ii as jr,ij as fz,ik as Jf,il as E3,im as pz,io as mz,ip as I3,iq as Gl,c as X,ez as gz,aq as ut,j as u,ag as Yn,an as er,am as ks,ao as Ss,br as tr,W as Te,ap as pn,ir as Vi,al as nr,aR as Pn,ar as $i,a4 as Ae,a0 as Kt,dW as Kf,eJ as Cs,is as _z,aM as Xe,a8 as kt,it as bz,eP as Ln,iu as A3,iv as T3,iw as Xf,ix as M3,iy as yz,L as It,dD as Yl,aY as or,iz as Jl,a_ as Zf,au as xn,iA as xz,a7 as Qf,iB as wz,iC as O3,eO as D3,_ as Ht,b5 as R3,iD as P3,cF as ep,iE as vz,dN as ct,iF as L3,dU as tp,iG as kz,iH as Kl,Z as Be,bc as Fn,iI as Xl,iJ as Hi,eE as Ns,iK as Sz,iL as Wi,iM as Cz,eM as Nz,iN as F3,iO as z3,en as jz,iP as ao,iQ as Er,aW as Zl,iR as Ez,iS as Ql,iT as B3,a5 as js,eb as U3,a6 as qi,iU as Iz,iV as np,iW as Ir,bt as Ar,eF as Tr,fl as V3,g5 as Mr,fA as Az,bf as tn,iX as Tz,iY as Mz,g3 as op,aO as ec,iZ as rp,i_ as Oz,i$ as $3,j0 as sp,j1 as Dz,j2 as Rz,j3 as lo,j4 as H3,g9 as ip,j5 as Gi,j6 as tc,es as ke,j7 as We,j8 as ap,j9 as xt,ja as W3,dx as nc,dt as oc,du as rc,dv as sc,ds as Yi,jb as Pz,fy as lp,b4 as wn,aI as zn,fo as q3,fq as G3,fr as Lz,fw as Fz,fs as Y3,V as je,em as zz,aU as Es,b2 as Is,aV as As,a$ as Wt,eN as co,jc as Bz,fu as J3,jd as Uz,fm as K3,fn as X3,je as Or,dw as Z3,jf as Q3,jg as Vz,jh as $z,ak as Hz,aj as Wz,ji as cp,dA as qz,dC as dp,fa as ic,jj as ac,jk as lc,bw as vn,jl as Gz,eI as Ji,f7 as cn,bk as e4,dX as Ft,jm as Yz,eh as Jz,ah as up,jn as Ki,jo as cc,jp as Kz,jq as Xz,jr as t4,js as nn,aX as Zz,at as hp,g8 as n4,eo as dc,jt as Qz,gu as fp,bj as uc,ju as pp,ai as eB,jv as tB,as as Xi,eA as o4,bn as nB,jw as oB,jx as r4,jy as rB,jz as sB,jA as iB,jB as aB,jC as lB,dy as Do,jD as cB,jE as hc,jF as Ts,o as Ro,n as tt,fP as kn,jG as Sn,jH as dt,jI as Ms,jJ as At,g4 as qt,jK as mp,er as Jn,jL as dB,jM as uB,bh as s4,bi as i4,jN as a4,jO as hB,gw as Os,jP as fc,be as pc,gx as Dr,eQ as gp,jQ as fB,jR as pB,jS as mB,jT as gB,jU as l4,jV as Zi,jW as c4,jX as _B,jY as d4,jZ as u4,j_ as bB,j$ as h4,k0 as f4,eR as mc,k1 as yB,k2 as p4,k3 as Qi,k4 as ea,k5 as gc,k6 as rr,k7 as m4,k8 as Po,k9 as Ds,ka as _p,kb as ta,kc as Rs,kd as bp,ke as yp,kf as g4,kg as _c,kh as xB,S as na,ki as oa,kj as wB,dT as bc,kk as vB,kl as xp,km as kB,kn as SB,ko as yc,e0 as CB,kp as wp,kq as Ps,kr as xc,ks as Ls,fO as Bn,fZ as Lo,fL as _4,cp as b4,kt as vp,fx as y4,ku as kp,kv as x4,kw as ra,kx as w4,ky as wc,kz as Sp,kA as sa,kB as ia,kC as aa,kD as NB,fH as vc,kE as kc,kF as Sc,eg as jB,fI as EB,kG as IB,kH as AB,kI as TB,kJ as MB,r as OB,kK as DB,kL as RB,kM as PB,fS as LB,kN as sr,kO as FB,kP as v4,t as P,kQ as zB,kR as BB,kS as UB,kT as VB,kU as $B,kV as HB,kW as WB,kX as qB,kY as GB,kZ as YB,k_ as JB,k$ as KB,l0 as XB,l1 as ZB,l2 as QB,l3 as eU,l4 as tU,l5 as nU,l6 as oU,l7 as rU,l8 as sU,l9 as iU,la as aU,lb as lU,lc as cU,ld as dU,le as uU,lf as hU,lg as fU,lh as Cp,li as Cc,lj as k4,lk as pU,ll as mU,lm as S4,ln as gU,lo as Fs,lp as Un,lq as _U,lr as bU,ls as yU,lt as xU,lu as wU,lv as vU,lw as kU,lx as SU,ly as CU,lz as NU,lA as ir,lB as jU,lC as EU,lD as IU,lE as AU,dZ as TU,lF as MU,lG as C4,e1 as OU,lH as Nc,lI as DU,lJ as RU,lK as PU,lL as LU,X as ar,lM as jc,lN as FU,lO as zU,lP as N4,lQ as Np,gv as zs,lR as BU,lS as UU,lT as VU,lU as $U,fX as HU,bq as WU,$ as jp,lV as j4,lW as qU,lX as GU,lY as Ep,lZ as Ip,l_ as YU,l$ as E4,m0 as I4,m1 as Ec,fK as JU,ab as A4,dL as KU,m2 as T4,fj as St,m3 as la,m4 as Bs,m5 as XU,m6 as ZU,m7 as Ap,m8 as QU,co as Tp,m9 as eV,U as lr,bg as M4,ma as tV,mb as nV,mc as Ic,md as O4,dJ as Mp,bs as D4,me as oV,mf as rV,mg as R4,mh as sV,mi as iV,mj as P4,ac as Op,mk as aV,bu as L4,ml as lV,eH as cV,mm as Fo,ek as F4,mn as z4,eL as B4,fB as Ac,mo as Dp,mp as U4,aT as Rp,el as Tc,mq as V4,mr as dV,ms as uV,mt as hV,mu as $4,mv as fV,mw as H4,mx as pV,gm as mV,fp as gV,ft as Pp,gp as _V,bp as Mc,my as bV,mz as W4,mA as Lp,mB as yV,mC as xV,mD as wV,mE as vV,mF as q4,fc as Fp,dF as G4,mG as kV,mH as SV,mI as CV,aN as NV,mJ as jV,mK as EV,mL as IV,mM as AV,a9 as TV,mN as Oc,aa as MV,mO as Y4,f8 as OV,mP as J4,ad as Vn,fF as DV,mQ as RV,mR as PV,mS as K4,mT as LV,mU as Us,mV as FV,mW as Dc,mX as zV,mY as BV,y as X4,mZ as UV,dl as VV,m_ as ca,m$ as $V,n0 as HV,n1 as WV,n2 as qV,C as Z4,n3 as GV,n4 as YV,n5 as JV,E as Rr,eW as KV,bd as XV,bb as ZV,n6 as QV,n7 as e$,a2 as Rc,n8 as t$,a3 as cr,dI as Q4,n9 as zp,na as n$,dV as eS,nb as o$,nc as tS,nd as r$,ne as nS,nf as s$,ng as i$,nh as oS,ni as rS,nj as sS,f6 as iS,nk as a$,nl as l$,nm as aS,nn as lS,no as Pc,np as cS,nq as c$,nr as dS,ns as d$,nt as u$,nu as uS,nv as h$,nw as f$,nx as p$,ny as m$,nz as g$,nA as _$,nB as b$,dS as y$,nC as x$,nD as w$,fY as Bp,nE as v$,nF as k$,nG as S$,nH as C$,nI as N$,nJ as j$,nK as E$,nL as I$,nM as A$,nN as T$,nO as Up,nP as M$,fN as O$,nQ as D$,nR as R$,nS as P$,nT as hS,nU as L$,nV as F$,a1 as z$,eC as B$,ge as U$,nW as V$,nX as $$,gg as Vp,gc as Vs,gh as Pr,gd as Lr,gi as $p,gj as Hp,nY as fS,gf as H$,nZ as pS,n_ as W$,n$ as mS,o0 as dr,o1 as gS,go as q$,o2 as G$,o3 as Y$,o4 as J$,o5 as K$,o6 as X$,o7 as Z$,o8 as _S,et as Q$,o9 as Wp,av as Lc,oa as bS,ob as yS,ax as xS,aw as eH,dR as tH,__tla as nH}from"./index-txb0mb7R.js";import{b as $s,A as oH,L as wS,g as rH,G as sH,s as iH,k as aH,B as vS,a as lH,M as cH,Y as dH,c as mn,u as da,C as uH,S as hH,K as fH,d as pH,i as mH,e as kS,f as gH,h as _H,j as ua,P as qp,l as SS,m as bH,n as yH,o as xH,p as CS,q as Gp,T as wH}from"./shutdown-button-s5kelj0_.js";import{V as NS,d as Hs,I as Yp,N as jS,S as ES,e as IS,f as AS,L as TS,g as MS,F as OS,M as vH,l as DS,h as kH,j as uo,k as Fc,m as zc,i as SH,E as RS,n as CH,o as Jp,p as NH,q as jH,s as EH,t as IH,v as AH,w as TH,x as MH,y as OH,a as DH,C as RH,R as PS,A as PH,b as LH,T as FH,z as zH,B as BH,D as UH,G as VH,O as $H,c as HH,P as WH,__tla as qH}from"./storage-TQaz51Ul.js";import{c as GH}from"./_createAggregator-Ba81XR0f.js";import{s as Kn,i as ur,T as Kp,a as Xp}from"./transform-DetRMEbJ.js";import{g as LS}from"./timer-Bqd5yn_a.js";import{i as YH}from"./zoom-COrs4lFh.js";import{s as ha}from"./sortBy-YjMpBoem.js";let Zp,Bc,gn,Uc,FS,fa,Qp,JH=Promise.all([(()=>{try{return nH}catch{}})(),(()=>{try{return qH}catch{}})()]).then(async()=>{var ql,w3;var Rt=GH(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});let Ct,dn,em,Vc,Ws,Fr,tm,nm,om,rm,pa,$c,sm,ma,im,Hc,am,lm,Wc,cm,dm,um,ga,hm,qc,fm,pm,mm,gm,_m,bm,Gc,ym,Yc,Jc,xm,wm,vm,km,Sm,_a,Cm,Nm,Kc,jm,Em,Im,Xc,Am,Tm,Mm,ba,Zc,Qc,Om,Dm,Rm,Pm,Lm,Fm,zm,Bm,Um,ed,td,Vm,$m,Hm,ya,hr,fr;Ct=Oe("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),dn=Oe("arrow-right-from-line",[["path",{d:"M3 5v14",key:"1nt18q"}],["path",{d:"M21 12H7",key:"13ipq5"}],["path",{d:"m15 18 6-6-6-6",key:"6tx3qv"}]]),em=Oe("arrow-right-to-line",[["path",{d:"M17 12H3",key:"8awo09"}],["path",{d:"m11 18 6-6-6-6",key:"8c2y43"}],["path",{d:"M21 5v14",key:"nzette"}]]),Vc=Oe("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),Ws=Oe("ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]),Fr=Oe("between-horizontal-start",[["rect",{width:"13",height:"7",x:"8",y:"3",rx:"1",key:"pkso9a"}],["path",{d:"m2 9 3 3-3 3",key:"1agib5"}],["rect",{width:"13",height:"7",x:"8",y:"14",rx:"1",key:"1q5fc1"}]]),tm=Oe("chevrons-down",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),nm=Oe("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),Uc=Oe("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),om=Oe("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),rm=Oe("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),pa=Oe("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),$c=Oe("clipboard-copy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]),sm=Oe("clipboard-paste",[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]]),ma=Oe("cloud-download",[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]]),im=Oe("code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]),Hc=Oe("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]),am=Oe("copy-minus",[["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),lm=Oe("diamond-plus",[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]),Wc=Oe("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]),cm=Oe("eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]),dm=Oe("fast-forward",[["polygon",{points:"13 19 22 12 13 5 13 19",key:"587y9g"}],["polygon",{points:"2 19 11 12 2 5 2 19",key:"3pweh0"}]]),um=Oe("file-pen",[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]),ga=Oe("file-plus-2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]]),hm=Oe("files",[["path",{d:"M20 7h-3a2 2 0 0 1-2-2V2",key:"x099mo"}],["path",{d:"M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z",key:"18t6ie"}],["path",{d:"M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8",key:"1nja0z"}]]),qc=Oe("folder-plus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),fm=Oe("folder-tree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]),pm=Oe("grip-vertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]),mm=Oe("hard-drive-download",[["path",{d:"M12 2v8",key:"1q4o3n"}],["path",{d:"m16 6-4 4-4-4",key:"6wukr"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 18h.01",key:"h775k"}]]),gm=Oe("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]),_m=Oe("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]),bm=Oe("key-round",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]),Gc=Oe("key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]),ym=Oe("keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]),Yc=Oe("layout-template",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]),Jc=Oe("list-tree",[["path",{d:"M21 12h-8",key:"1bmf0i"}],["path",{d:"M21 6H8",key:"1pqkrb"}],["path",{d:"M21 18h-8",key:"1tm79t"}],["path",{d:"M3 6v4c0 1.1.9 2 2 2h3",key:"1ywdgy"}],["path",{d:"M3 10v6c0 1.1.9 2 2 2h3",key:"2wc746"}]]),xm=Oe("list",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]),wm=Oe("map-pin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]),vm=Oe("memory-stick",[["path",{d:"M6 19v-3",key:"1nvgqn"}],["path",{d:"M10 19v-3",key:"iu8nkm"}],["path",{d:"M14 19v-3",key:"kcehxu"}],["path",{d:"M18 19v-3",key:"1vh91z"}],["path",{d:"M8 11V9",key:"63erz4"}],["path",{d:"M16 11V9",key:"fru6f3"}],["path",{d:"M12 11V9",key:"ha00sb"}],["path",{d:"M2 15h20",key:"16ne18"}],["path",{d:"M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z",key:"lhddv3"}]]),km=Oe("message-circle-question",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),Sm=Oe("microchip",[["path",{d:"M18 12h2",key:"quuxs7"}],["path",{d:"M18 16h2",key:"zsn3lv"}],["path",{d:"M18 20h2",key:"9x5y9y"}],["path",{d:"M18 4h2",key:"1luxfb"}],["path",{d:"M18 8h2",key:"nxqzg"}],["path",{d:"M4 12h2",key:"1ltxp0"}],["path",{d:"M4 16h2",key:"8a5zha"}],["path",{d:"M4 20h2",key:"27dk57"}],["path",{d:"M4 4h2",key:"10groj"}],["path",{d:"M4 8h2",key:"18vq6w"}],["path",{d:"M8 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2h-1.5c-.276 0-.494.227-.562.495a2 2 0 0 1-3.876 0C9.994 2.227 9.776 2 9.5 2z",key:"1681fp"}]]),_a=Oe("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]),Cm=Oe("octagon-alert",[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]]),Nm=Oe("package-check",[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]),Kc=Oe("package-x",[["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["path",{d:"m17 13 5 5m-5 0 5-5",key:"im3w4b"}]]),jm=Oe("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Em=Oe("party-popper",[["path",{d:"M5.8 11.3 2 22l10.7-3.79",key:"gwxi1d"}],["path",{d:"M4 3h.01",key:"1vcuye"}],["path",{d:"M22 8h.01",key:"1mrtc2"}],["path",{d:"M15 2h.01",key:"1cjtqr"}],["path",{d:"M22 20h.01",key:"1mrys2"}],["path",{d:"m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10",key:"hbicv8"}],["path",{d:"m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17",key:"1i94pl"}],["path",{d:"m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7",key:"1cofks"}],["path",{d:"M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z",key:"4kbmks"}]]),Im=Oe("pen-line",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]),Xc=Oe("presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]),Am=Oe("regex",[["path",{d:"M17 3v10",key:"15fgeh"}],["path",{d:"m12.67 5.5 8.66 5",key:"1gpheq"}],["path",{d:"m12.67 10.5 8.66-5",key:"1dkfa6"}],["path",{d:"M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z",key:"swwfx4"}]]),Tm=Oe("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]),Mm=Oe("rows-3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]),ba=Oe("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]),Zc=Oe("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]),Qc=Oe("scroll-text",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]),Om=Oe("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),Dm=Oe("square-code",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),Rm=Oe("square-dashed-bottom-code",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["path",{d:"M5 21a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2",key:"as5y1o"}],["path",{d:"M9 21h1",key:"15o7lz"}]]),Pm=Oe("square-equal",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M7 14h10",key:"1mhdw3"}]]),Lm=Oe("square-m",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8l4 4 4-4v8",key:"141u4e"}]]),Fm=Oe("square-play",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m9 8 6 4-6 4Z",key:"f1r3lt"}]]),zm=Oe("square-power",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),Bm=Oe("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]),Um=Oe("text-cursor-input",[["path",{d:"M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6",key:"1528k5"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1",key:"1mj8rg"}],["path",{d:"M9 6v12",key:"velyjx"}]]),ed=Oe("text-search",[["path",{d:"M21 6H3",key:"1jwq7v"}],["path",{d:"M10 12H3",key:"1ulcyk"}],["path",{d:"M10 18H3",key:"13769t"}],["circle",{cx:"17",cy:"15",r:"3",key:"1upz2a"}],["path",{d:"m21 19-1.9-1.9",key:"dwi7p8"}]]),td=Oe("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),Vm=Oe("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]),$m=Oe("view",[["path",{d:"M21 17v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-2",key:"mrq65r"}],["path",{d:"M21 7V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2",key:"be3xqs"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]]),Hm=Oe("whole-word",[["circle",{cx:"7",cy:"12",r:"3",key:"12clwm"}],["path",{d:"M10 9v6",key:"17i7lo"}],["circle",{cx:"17",cy:"12",r:"3",key:"gl7c2s"}],["path",{d:"M14 7v8",key:"dl84cr"}],["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]]),ya=Oe("workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]),hr=Oe("zap-off",[["path",{d:"M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317",key:"193nxd"}],["path",{d:"M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773",key:"27a7lr"}],["path",{d:"M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643",key:"1e0qe9"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),fr=Oe("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);const zS=T.createContext({}),BS=T.forwardRef(function(t,e){[t,e]=dz(t,e,zS);let{toolbarProps:n}=function(s,i){const{"aria-label":a,"aria-labelledby":l,orientation:c="horizontal"}=s;let[d,h]=T.useState(!1);az(()=>{var m;h(!(!i.current||!(!((m=i.current.parentElement)===null||m===void 0)&&m.closest('[role="toolbar"]'))))});const{direction:f}=lz(),p=f==="rtl"&&c==="horizontal";let _=cz(i);const g=T.useRef(null);return{toolbarProps:{...j3(s,{labelable:!0}),role:d?"group":"toolbar","aria-orientation":c,"aria-label":a,"aria-labelledby":a==null?l:void 0,onKeyDownCapture:d?void 0:m=>{if(m.currentTarget.contains(m.target)){if(c==="horizontal"&&m.key==="ArrowRight"||c==="vertical"&&m.key==="ArrowDown")p?_.focusPrevious():_.focusNext();else{if(!(c==="horizontal"&&m.key==="ArrowLeft"||c==="vertical"&&m.key==="ArrowUp"))return m.key==="Tab"?(m.stopPropagation(),g.current=document.activeElement,void(m.shiftKey?_.focusFirst():_.focusLast())):void 0;p?_.focusNext():_.focusPrevious()}m.stopPropagation(),m.preventDefault()}},onFocusCapture:d?void 0:m=>{var b,y;g.current&&!m.currentTarget.contains(m.relatedTarget)&&(!((b=i.current)===null||b===void 0)&&b.contains(m.target))&&((y=g.current)===null||y===void 0||y.focus(),g.current=null)},onBlurCapture:d?void 0:m=>{m.currentTarget.contains(m.relatedTarget)||g.current||(g.current=m.target)}}}}(t,e),o=uz({...t,values:{orientation:t.orientation||"horizontal"},defaultClassName:"react-aria-Toolbar"}),r=j3(t);return delete r.id,K.createElement("div",{...hz(n,r),...o,ref:e,slot:t.slot||void 0,"data-orientation":t.orientation||"horizontal"},o.children)});function xa(t,e){const n=+jr(t)-+jr(e);return n<0?-1:n>0?1:n}function US(t,e){const n=jr(t,e==null?void 0:e.in);return+function(o,r){const s=jr(o,r==null?void 0:r.in);return s.setHours(23,59,59,999),s}(n,e)==+function(o,r){const s=jr(o,r==null?void 0:r.in),i=s.getMonth();return s.setFullYear(s.getFullYear(),i+1,0),s.setHours(23,59,59,999),s}(n,e)}function VS(t,e,n){const[o,r,s]=Jf(n==null?void 0:n.in,t,t,e),i=xa(r,s),a=Math.abs(function(d,h,f){const[p,_]=Jf(f==null?void 0:f.in,d,h);return 12*(p.getFullYear()-_.getFullYear())+(p.getMonth()-_.getMonth())}(r,s));if(a<1)return 0;r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-i*a);let l=xa(r,s)===-i;US(o)&&a===1&&xa(o,s)===1&&(l=!1);const c=i*(a-+l);return c===0?0:c}function $S(t,e,n){const o=function(r,s){return+jr(r)-+jr(s)}(t,e)/1e3;return(r=>{const s=(0,Math.trunc)(r);return s===0?0:s})(o)}function HS(t,e){return function(n,o,r){const s=pz(),i=(r==null?void 0:r.locale)??s.locale??mz,a=xa(n,o);if(isNaN(a))throw new RangeError("Invalid time value");const l=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:a}),[c,d]=Jf(r==null?void 0:r.in,...a>0?[o,n]:[n,o]),h=$S(d,c),f=(E3(d)-E3(c))/1e3,p=Math.round((h-f)/60);let _;if(p<2)return p===0?i.formatDistance("lessThanXMinutes",1,l):i.formatDistance("xMinutes",p,l);if(p<45)return i.formatDistance("xMinutes",p,l);if(p<90)return i.formatDistance("aboutXHours",1,l);if(p<I3){const g=Math.round(p/60);return i.formatDistance("aboutXHours",g,l)}if(p<2520)return i.formatDistance("xDays",1,l);if(p<Gl){const g=Math.round(p/I3);return i.formatDistance("xDays",g,l)}if(p<2*Gl)return _=Math.round(p/Gl),i.formatDistance("aboutXMonths",_,l);if(_=VS(d,c),_<12){const g=Math.round(p/Gl);return i.formatDistance("xMonths",g,l)}{const g=_%12,m=Math.trunc(_/12);return g<3?i.formatDistance("aboutXYears",m,l):g<9?i.formatDistance("overXYears",m,l):i.formatDistance("almostXYears",m+1,l)}}(t,function(n){return fz(n,Date.now())}(t),e)}const wa="https://static.marimo.app",WS=t=>{const e=X.c(24),{onClose:n}=t,[o,r]=T.useState("");let s;s=Math.random().toString(36).slice(2,6);const i=`${o}-${s}`,a=`${wa}/static/${i}`;let l,c,d,h,f,p,_,g,m,b,y;return e[0]!==n||e[1]!==i?(l=async x=>{x.preventDefault(),n();const v=await gz({download:!1,includeCode:!0,files:NS.INSTANCE.filenames()}),C=ut({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${wa}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:v,path:i})}).catch(()=>{C.dismiss(),ut({title:"Error uploading static page",description:u.jsxs("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",u.jsx("a",{href:Yn.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),C.dismiss(),ut({title:"Static page uploaded!",description:u.jsxs("div",{children:["The URL has been copied to your clipboard.",u.jsx("br",{}),"You can share it with anyone."]})})},e[0]=n,e[1]=i,e[2]=l):l=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(er,{children:"Share static notebook"}),e[3]=c):c=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsxs(ks,{children:[c,u.jsxs(Ss,{children:["You can publish a static, non-interactive version of this notebook to the public web. We will create a link for you that lives on"," ",u.jsx("a",{href:wa,target:"_blank",children:wa}),"."]})]}),e[4]=d):d=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(h=x=>{const v=x.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,"");r(v)},e[5]=h):h=e[5],e[6]!==o?(f=u.jsx(tr,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:h,required:!0,autoComplete:"off"}),e[6]=o,e[7]=f):f=e[7],e[8]!==a?(p=u.jsxs("div",{className:"font-semibold text-sm text-muted-foreground gap-2 flex flex-col",children:["Anyone will be able to access your notebook at this URL:",u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(qS,{text:a}),u.jsx("span",{className:"text-primary",children:a})]})]}),e[8]=a,e[9]=p):p=e[9],e[10]!==f||e[11]!==p?(_=u.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[f,p]}),e[10]=f,e[11]=p,e[12]=_):_=e[12],e[13]!==n?(g=u.jsx(Te,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),e[13]=n,e[14]=g):g=e[14],e[15]!==a?(m=u.jsx(Te,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await pn(a)},children:"Create"}),e[15]=a,e[16]=m):m=e[16],e[17]!==m||e[18]!==g?(b=u.jsxs(Vi,{children:[g,m]}),e[17]=m,e[18]=g,e[19]=b):b=e[19],e[20]!==b||e[21]!==l||e[22]!==_?(y=u.jsx(nr,{className:"w-fit",children:u.jsxs("form",{onSubmit:l,children:[d,_,b]})}),e[20]=b,e[21]=l,e[22]=_,e[23]=y):y=e[23],y},qS=t=>{const e=X.c(8),[n,o]=K.useState(!1);let r;e[0]!==t.text?(r=Pn.stopPropagation(async c=>{c.preventDefault(),await pn(t.text),o(!0),setTimeout(()=>o(!1),2e3)}),e[0]=t.text,e[1]=r):r=e[1];const s=r;let i,a,l;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx($i,{size:14,strokeWidth:1.5}),e[2]=i):i=e[2],e[3]!==s?(a=u.jsx(Te,{"data-testid":"copy-static-notebook-url-button",onClick:s,size:"xs",variant:"secondary",children:i}),e[3]=s,e[4]=a):a=e[4],e[5]!==n||e[6]!==a?(l=u.jsx(Ae,{content:"Copied!",open:n,children:a}),e[5]=n,e[6]=a,e[7]=l):l=e[7],l};function Wm(){const t=X.c(2),e=Kt(Kf);let n;return t[0]!==e?(n=()=>{const o=document.getElementsByClassName("output-area"),r=window.innerHeight||document.documentElement.clientHeight;let s;s=null;for(const i of Array.from(o)){const a=i.getBoundingClientRect();if(a.top>=0&&a.top<=r||a.bottom>=0&&a.bottom<=r){s=Cs.parse(i.parentNode.id);break}}e(i=>({mode:_z(i.mode),cellAnchor:s})),requestAnimationFrame(()=>{var i;s!==null&&((i=document.getElementById(Cs.create(s)))==null||i.scrollIntoView())})},t[0]=e,t[1]=n):n=t[1],n}function nd(t){const e=X.c(3),n=od();let o;return e[0]!==t||e[1]!==n?(o=()=>{t!==void 0&&n([t])},e[0]=t,e[1]=n,e[2]=o):o=e[2],Xe(o)}function qm(){const t=X.c(2),e=od();let n;return t[0]!==e?(n=()=>e(A3(Ln())),t[0]=e,t[1]=n):n=t[1],Xe(n)}function od(){const t=X.c(2),{prepareForRun:e}=kt();let n;return t[0]!==e?(n=async o=>{var a,l;if(o.length===0)return;const{cellHandles:r,cellData:s}=Ln(),i=[];for(const c of o){const d=r[c],h=(a=d==null?void 0:d.current)==null?void 0:a.editorView;let f;h?(T3(h)!=="markdown"&&Xf(h),f=M3(h)):f=((l=s[c])==null?void 0:l.code)||"",i.push(f),e({cellId:c})}await yz({cellIds:o,codes:i}).catch(GS)},t[0]=e,t[1]=n):n=t[1],Xe(n)}function GS(t){It.error(t)}const rd=[{type:"files",Icon:fm,tooltip:"View files",position:"sidebar"},{type:"variables",Icon:Yl,tooltip:"Explore variables",position:"sidebar"},{type:"datasources",Icon:or,tooltip:"Explore data sources",position:"sidebar"},{type:"dependencies",Icon:_a,tooltip:"Explore dependencies",position:"sidebar"},{type:"packages",Icon:$s,tooltip:"Manage packages",position:"sidebar"},{type:"outline",Icon:Qc,tooltip:"View outline",position:"sidebar"},{type:"chat",Icon:Jl,tooltip:"Chat with AI",position:"sidebar"},{type:"documentation",Icon:ed,tooltip:"View live docs",position:"sidebar"},{type:"logs",Icon:Zf,tooltip:"Notebook logs",position:"sidebar"},{type:"tracing",Icon:oH,tooltip:"Tracing",position:"sidebar"},{type:"snippets",Icon:Rm,tooltip:"Snippets",position:"sidebar"},{type:"secrets",Icon:bm,tooltip:"Secrets",hidden:xn(),position:"sidebar"},{type:"scratchpad",Icon:xz,tooltip:"Scratchpad",position:"sidebar"},{type:"errors",Icon:Qf,tooltip:"View errors",position:"footer"}];function YS(){const t=X.c(7);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0];const[n,o]=function(i,a){const l=X.c(11);let c;l[0]!==a?(c=new wz(a),l[0]=a,l[1]=c):c=l[1];const d=c;let h;l[2]!==i||l[3]!==d?(h=()=>d.get(i),l[2]=i,l[3]=d,l[4]=h):h=l[4];const[f,p]=T.useState(h);let _;l[5]!==i||l[6]!==d?(_=b=>{p(b),d.set(i,b)},l[5]=i,l[6]=d,l[7]=_):_=l[7];const g=_;let m;return l[8]!==g||l[9]!==f?(m=[f,g],l[8]=g,l[9]=f,l[10]=m):m=l[10],m}("marimo:commands",e);let r,s;return t[1]!==n||t[2]!==o?(r=i=>{const a=(l=[i,...n],[...new Set(l)]);var l;o(a.slice(0,3))},t[1]=n,t[2]=o,t[3]=r):r=t[3],t[4]!==n||t[5]!==r?(s={recentCommands:n,addRecentCommand:r},t[4]=n,t[5]=r,t[6]=s):s=t[6],s}function Gm(t){return t.dropdown!==void 0}function va(t,e=""){return t.flatMap(n=>n.label?Gm(n)?va(n.dropdown,`${e+n.label} > `):{...n,label:e+n.label}:[])}const qs=t=>{const e=X.c(8),{children:n,layerTop:o}=t,r=o!==void 0&&o;let s;e[0]!==n?(s=K.Children.toArray(n),e[0]=n,e[1]=s):s=e[1];const[i,a]=s,l=`second-icon absolute ${r?"top-[-2px] left-[-2px]":"bottom-[-2px] right-[-2px]"} rounded-full`;let c,d;return e[2]!==a||e[3]!==l?(c=u.jsx("div",{className:l,children:a}),e[2]=a,e[3]=l,e[4]=c):c=e[4],e[5]!==i||e[6]!==c?(d=u.jsxs("div",{className:"multi-icon relative w-fit",children:[i,c]}),e[5]=i,e[6]=c,e[7]=d):d=e[7],d},ka=Ht(null),JS=Ht(!1),sd=R3("marimo:ai:chatState:v2",{chats:[],activeChatId:null}),KS=Ht(t=>{const e=t(sd);return e.chats.find(n=>n.id===e.activeChatId)},(t,e,n)=>{e(sd,o=>({...o,activeChatId:n}))});function Ym(t){return t!==P3&&!!(t&&t.trim().length>0)}const id=t=>{const e=X.c(7);let n,o;e[0]!==t?(n=a=>{var l;(a.ctrlKey||a.metaKey)&&a.key==="z"&&(a.preventDefault(),a.stopPropagation(),(l=t.onClick)==null||l.call(t,a))},e[0]=t,e[1]=n):n=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(o={capture:!0},e[2]=o):o=e[2],ep(window,"keydown",n,o);const r=t.children??"Undo";let s,i;return e[3]===Symbol.for("react.memo_cache_sentinel")?(s=u.jsx(vz,{className:"ml-2",shortcut:"cmd-z"}),e[3]=s):s=e[3],e[4]!==r||e[5]!==t?(i=u.jsxs(Te,{"data-testid":"undo-button",size:"sm",variant:"outline",...t,children:[r," ",s]}),e[4]=r,e[5]=t,e[6]=i):i=e[6],i};function ad(){const t=X.c(3),{deleteCell:e,undoDeleteCell:n}=kt();let o;return t[0]!==e||t[1]!==n?(o=r=>{var l;if(ct.get(L3))return;const{cellId:s}=r,i=ct.get(tp),a=(((l=i.cellData[s])==null?void 0:l.code)??"").trim()==="";if(e({cellId:s}),kz({cellId:s}).catch(()=>{n()}),!a){const{dismiss:c}=ut({title:"Cell deleted",description:"You can bring it back by clicking undo or through the command palette.",action:u.jsx(id,{"data-testid":"undo-delete-button",onClick:()=>{n(),d()}})}),d=c}},t[0]=e,t[1]=n,t[2]=o):o=t[2],Xe(o)}function Jm(){const t=X.c(3),{splitCell:e,undoSplitCell:n}=kt();let o;return t[0]!==e||t[1]!==n?(o=r=>{const s=Kl(r.cellId);if(!s)return;const i=M3(s);e(r);const{dismiss:a}=ut({title:"Cell split",action:u.jsx(id,{"data-testid":"undo-split-button",size:"sm",variant:"outline",onClick:()=>{n({...r,snapshot:i}),l()},children:"Undo"})}),l=a},t[0]=e,t[1]=n,t[2]=o):o=t[2],Xe(o)}function ld(t){const e=X.c(49),{cell:n}=t,{createNewCell:o,updateCellConfig:r,updateCellName:s,moveCell:i,sendToTop:a,sendToBottom:l,addColumnBreakpoint:c,clearCellOutput:d}=kt(),h=Jm(),f=nd(n==null?void 0:n.cellId),p=!Be(L3),_=ad(),{openModal:g}=Fn(),m=Kt(ka),b=Be(Xl),y=Be(Hi),x=Be(Ns),v=Be(Sz);if(!n||x){let j;return e[0]===Symbol.for("react.memo_cache_sentinel")?(j=[],e[0]=j):j=e[0],j}const{cellId:C,config:k,getEditorView:E,name:N,hasOutput:I,hasConsoleOutput:A,status:M}=n;let R;e[1]!==C||e[2]!==k.disabled||e[3]!==r?(R=async()=>{const j={disabled:!k.disabled};await Ir({configs:{[C]:j}}),r({cellId:C,config:j})},e[1]=C,e[2]=k.disabled,e[3]=r,e[4]=R):R=e[4];const z=R;let D;e[5]!==C||e[6]!==k.hide_code||e[7]!==E||e[8]!==r?(D=async()=>{const j={hide_code:!k.hide_code};await Ir({configs:{[C]:j}}),r({cellId:C,config:j});const W=E();W&&(j.hide_code?W.contentDOM.blur():W.focus())},e[5]=C,e[6]=k.hide_code,e[7]=E,e[8]=r,e[9]=D):D=e[9];const F=D;let B,U,O,S,$;return e[10]===Symbol.for("react.memo_cache_sentinel")?(B=u.jsx(Um,{size:13,strokeWidth:1.5}),e[10]=B):B=e[10],e[11]!==C||e[12]!==N||e[13]!==g||e[14]!==s?(U=()=>{g(u.jsxs(nr,{children:[u.jsx(ks,{children:u.jsx(er,{children:"Rename cell"})}),u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx(Ar,{htmlFor:"cell-name",children:"Cell name"}),u.jsx(jS,{placeholder:"cell name",value:N,onKeyDown:j=>{j.key==="Enter"&&(j.preventDefault(),j.stopPropagation(),g(null))},onChange:j=>s({cellId:C,name:j})})]})]}))},e[11]=C,e[12]=N,e[13]=g,e[14]=s,e[15]=U):U=e[15],e[16]!==C||e[17]!==s?(O=j=>s({cellId:C,name:j}),e[16]=C,e[17]=s,e[18]=O):O=e[18],e[19]!==N||e[20]!==O?(S=u.jsx(jS,{placeholder:"cell name",value:N,onChange:O}),e[19]=N,e[20]=O,e[21]=S):S=e[21],e[22]!==c||e[23]!==b||e[24]!==v||e[25]!==y||e[26]!==p||e[27]!==C||e[28]!==d||e[29]!==k.disabled||e[30]!==k.hide_code||e[31]!==o||e[32]!==_||e[33]!==E||e[34]!==A||e[35]!==I||e[36]!==i||e[37]!==N||e[38]!==f||e[39]!==l||e[40]!==a||e[41]!==m||e[42]!==h||e[43]!==M||e[44]!==U||e[45]!==S||e[46]!==z||e[47]!==F?($=[[{icon:B,label:"Name",disableClick:!0,handle:eC,handleHeadless:U,rightElement:S},{icon:u.jsx(Hs,{size:13,strokeWidth:1.5}),label:"Run cell",hotkey:"cell.run",hidden:M==="running"||M==="queued"||M==="disabled-transitively"||k.disabled,handle:()=>f()},{icon:u.jsx(Wi,{size:13,strokeWidth:1.5}),label:"AI completion",hidden:!b,handle:()=>{m(j=>(j==null?void 0:j.cellId)===C?null:{cellId:C})},hotkey:"cell.aiCompletion"},{icon:u.jsx(Zc,{size:13,strokeWidth:1.5}),label:"Split cell",hotkey:"cell.splitCell",handle:()=>h({cellId:C})},{icon:u.jsx(Yp,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!I,handle:()=>function(j){const W=document.getElementById(O3.create(j));W&&(W.classList.add("printing-output"),D3(W,"result.png").finally(()=>{W.classList.remove("printing-output")}))}(C)},{icon:u.jsx(Nz,{size:13,strokeWidth:1.5}),label:"Format cell",hotkey:"cell.format",handle:()=>{const j=E();j&&Cz({[C]:j})}},{icon:k.hide_code?u.jsx(F3,{size:13,strokeWidth:1.5}):u.jsx(z3,{size:13,strokeWidth:1.5}),label:k.hide_code?"Show code":"Hide code",handle:F,hotkey:"cell.hideCode"},{icon:k.disabled?u.jsx(hr,{size:13,strokeWidth:1.5}):u.jsx(fr,{size:13,strokeWidth:1.5}),label:"Reactive execution",rightElement:u.jsx(jz,{"data-testid":"cell-disable-switch",checked:!k.disabled,size:"sm",onCheckedChange:z}),handle:z},{icon:u.jsx(Qf,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(I||A),handle:()=>{d({cellId:C})}}],[{icon:u.jsx(Zl,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:()=>{const j=E();j&&(ao(y,o),Er(j,"markdown",{keepCodeAsIs:!1}))}},{icon:u.jsx(or,{size:13,strokeWidth:1.5}),label:"Convert to SQL",handle:()=>{const j=E();j&&(ao(y,o),Er(j,"sql",{keepCodeAsIs:!1}))}},{icon:u.jsx(Ql,{}),label:"Toggle as Python",handle:()=>{const j=E();j&&(ao(y,o),Ez(j,"python",{force:!0}))}}],[{icon:u.jsxs(qs,{children:[u.jsx(pa,{size:13,strokeWidth:1.5}),u.jsx(B3,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>o({cellId:C,before:!0})},{icon:u.jsxs(qs,{children:[u.jsx(pa,{size:13,strokeWidth:1.5}),u.jsx(js,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>o({cellId:C,before:!1})},{icon:u.jsx(B3,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>i({cellId:C,before:!0})},{icon:u.jsx(js,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>i({cellId:C,before:!1})},{icon:u.jsx(U3,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>i({cellId:C,direction:"left"}),hidden:v!=="columns"},{icon:u.jsx(qi,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>i({cellId:C,direction:"right"}),hidden:v!=="columns"},{icon:u.jsx(nm,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>a({cellId:C})},{icon:u.jsx(tm,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>l({cellId:C})},{icon:u.jsx(Iz,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",hidden:v!=="columns",handle:()=>c({cellId:C})}],[{icon:u.jsx(wS,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!Ym(N),tooltip:Ym(N)?void 0:"Only named cells can be linked to",handle:async()=>{await pn(function(j){const W=new URL(window.location.href);return W.hash=`scrollTo=${encodeURIComponent(j)}`,W.toString()}(N)),ut({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!p,variant:"danger",icon:u.jsx(np,{size:13,strokeWidth:1.5}),handle:()=>{_({cellId:C})}}]].map(ZS).filter(XS),e[22]=c,e[23]=b,e[24]=v,e[25]=y,e[26]=p,e[27]=C,e[28]=d,e[29]=k.disabled,e[30]=k.hide_code,e[31]=o,e[32]=_,e[33]=E,e[34]=A,e[35]=I,e[36]=i,e[37]=N,e[38]=f,e[39]=l,e[40]=a,e[41]=m,e[42]=h,e[43]=M,e[44]=U,e[45]=S,e[46]=z,e[47]=F,e[48]=$):$=e[48],$}function XS(t){return t.length>0}function ZS(t){return t.filter(QS)}function QS(t){return!t.hidden}function eC(t){t==null||t.stopPropagation(),t==null||t.preventDefault()}function tC(t){return!t.hidden}const cd=Ht(!1),Km=()=>{const t=X.c(37),[e,n]=tn(cd),o=Tz(),r=Be(Mz),s=Be(op);let i;t[0]!==r?(i={cell:r},t[0]=r,t[1]=i):i=t[1];let a=ld(i).flat();a=va(a);const l=function(){const O=X.c(61),[S,$]=Tr(),[j,W]=V3();let Y;O[0]!==$?(Y=async ee=>{await Mr({config:ee}).then(()=>{$(ee)})},O[0]=$,O[1]=Y):Y=O[1];const G=Y;let q;O[2]!==W?(q=async ee=>{await Az({config:ee}).then(()=>{W(ee)})},O[2]=W,O[3]=q):q=O[3];const te=q;let re;if(O[4]!==j||O[5]!==S||O[6]!==te||O[7]!==G){let ee,ue,me,de,fe;O[9]!==j?(ee=De=>De!==j.width,O[9]=j,O[10]=ee):ee=O[10],O[11]!==j||O[12]!==te?(ue=De=>({label:`App config > Set width=${De}`,handle:()=>{te({...j,width:De})}}),O[11]=j,O[12]=te,O[13]=ue):ue=O[13],O[14]!==S||O[15]!==G?(me={label:"Config > Set theme: dark",handle:()=>{G({...S,display:{...S.display,theme:"dark"}})}},O[14]=S,O[15]=G,O[16]=me):me=O[16],O[17]!==S||O[18]!==G?(de={label:"Config > Set theme: light",handle:()=>{G({...S,display:{...S.display,theme:"light"}})}},O[17]=S,O[18]=G,O[19]=de):de=O[19],O[20]!==S||O[21]!==G?(fe={label:"Config > Set theme: system",handle:()=>{G({...S,display:{...S.display,theme:"system"}})}},O[20]=S,O[21]=G,O[22]=fe):fe=O[22];const he=S.keymap.preset==="vim";let Ce,Ee;O[23]!==S||O[24]!==G?(Ce=()=>{G({...S,keymap:{...S.keymap,preset:"vim"}})},O[23]=S,O[24]=G,O[25]=Ce):Ce=O[25],O[26]!==he||O[27]!==Ce?(Ee={label:"Config > Switch keymap to VIM",hidden:he,handle:Ce},O[26]=he,O[27]=Ce,O[28]=Ee):Ee=O[28];const ae=S.keymap.preset==="default";let Me,xe,Re;O[29]!==S||O[30]!==G?(Me=()=>{G({...S,keymap:{...S.keymap,preset:"default"}})},O[29]=S,O[30]=G,O[31]=Me):Me=O[31],O[32]!==ae||O[33]!==Me?(xe={label:"Config > Switch keymap to default (current: VIM)",hidden:ae,handle:Me},O[32]=ae,O[33]=Me,O[34]=xe):xe=O[34],O[35]!==S||O[36]!==G?(Re=()=>{G({...S,completion:{...S.completion,copilot:!1}})},O[35]=S,O[36]=G,O[37]=Re):Re=O[37];const Ue=S.completion.copilot!=="github";let Je,Ke;O[38]!==Re||O[39]!==Ue?(Je={label:"Config > Disable GitHub Copilot",handle:Re,hidden:Ue},O[38]=Re,O[39]=Ue,O[40]=Je):Je=O[40],O[41]!==S||O[42]!==G?(Ke=()=>{G({...S,completion:{...S.completion,copilot:"github"}})},O[41]=S,O[42]=G,O[43]=Ke):Ke=O[43];const Pe=S.completion.copilot==="github";let st;O[44]!==Ke||O[45]!==Pe?(st={label:"Config > Enable GitHub Copilot",handle:Ke,hidden:Pe},O[44]=Ke,O[45]=Pe,O[46]=st):st=O[46];const et=!S.display.reference_highlighting;let nt,ne,ve,Se;O[47]!==S||O[48]!==G?(nt=()=>{G({...S,display:{...S.display,reference_highlighting:!1}})},O[47]=S,O[48]=G,O[49]=nt):nt=O[49],O[50]!==et||O[51]!==nt?(ne={label:"Config > Disable reference highlighting",hidden:et,handle:nt},O[50]=et,O[51]=nt,O[52]=ne):ne=O[52],O[53]!==S||O[54]!==G?(ve=()=>{G({...S,display:{...S.display,reference_highlighting:!0}})},O[53]=S,O[54]=G,O[55]=ve):ve=O[55],O[56]!==S.display.reference_highlighting||O[57]!==ve?(Se={label:"Config > Enable reference highlighting",hidden:S.display.reference_highlighting,handle:ve},O[56]=S.display.reference_highlighting,O[57]=ve,O[58]=Se):Se=O[58],re=[...rH().filter(ee).map(ue),me,de,fe,Ee,xe,Je,st,ne,Se],O[4]=j,O[5]=S,O[6]=te,O[7]=G,O[8]=re}else re=O[8];const ie=re;let Z;return O[59]!==ie?(Z=ie.filter(tC),O[59]=ie,O[60]=Z):Z=O[60],Z}();let c=Ng();c=[...va(c),...va(l)];const d=c.filter(nC),h=ec.keyBy(d,oC),{recentCommands:f,addRecentCommand:p}=YS();let _;t[2]!==f?(_=new Set(f),t[2]=f,t[3]=_):_=t[3];const g=_;let m,b;t[4]!==s||t[5]!==n?(m=O=>{Rz(s.getHotkey("global.commandPalette").key)(O)&&(O.preventDefault(),n(rC))},t[4]=s,t[5]=n,t[6]=m):m=t[6],ep(document,"keydown",m),t[7]!==p||t[8]!==s||t[9]!==o||t[10]!==n?(b=(O,S)=>{const $=o[O];if(!$)return null;const j=s.getHotkey(O);return u.jsxs(lo,{disabled:S.disabled,onSelect:()=>{p(O),n(!1),requestAnimationFrame(()=>{$()})},value:j.name,children:[u.jsxs("span",{children:[j.name,S.tooltip&&u.jsx("span",{className:"ml-2",children:S.tooltip})]}),u.jsx(H3,{children:u.jsx(ip,{shortcut:j.key})})]},O)},t[7]=p,t[8]=s,t[9]=o,t[10]=n,t[11]=b):b=t[11];const y=b;let x;t[12]!==p||t[13]!==s||t[14]!==n?(x=(O,S,$,j)=>{const W=$===void 0?{}:$;return u.jsxs(lo,{disabled:W.disabled,onSelect:()=>{p(O),n(!1),requestAnimationFrame(()=>{S()})},value:O,children:[u.jsxs("span",{children:[O,W.tooltip&&u.jsxs("span",{className:"ml-2",children:["(",W.tooltip,")"]})]}),j&&u.jsx(H3,{children:u.jsx(ip,{shortcut:s.getHotkey(j).key})})]},O)},t[12]=p,t[13]=s,t[14]=n,t[15]=x):x=t[15];const v=x,C=Dz;let k;t[16]===Symbol.for("react.memo_cache_sentinel")?(k=u.jsx(Gi,{placeholder:"Type to search..."}),t[16]=k):k=t[16];const E=sp;let N;t[17]===Symbol.for("react.memo_cache_sentinel")?(N=u.jsx(tc,{children:"No results found."}),t[17]=N):N=t[17];const I=f.length>0&&u.jsxs(u.Fragment,{children:[u.jsx(rp,{heading:"Recently Used",children:f.map(O=>{const S=h[O];return Oz(O)?y(O,{disabled:S==null?void 0:S.disabled,tooltip:S==null?void 0:S.tooltip}):S&&!Gm(S)?v(S.label,S.handleHeadless||S.handle,{disabled:S.disabled,tooltip:S.tooltip}):null})}),u.jsx($3,{})]}),A=rp,M=s.iterate().map(O=>{if(g.has(O))return null;const S=h[O];return y(O,{disabled:S==null?void 0:S.disabled,tooltip:S==null?void 0:S.tooltip})}),R=d.map(O=>g.has(O.label)?null:v(O.label,O.handleHeadless||O.handle,{disabled:O.disabled,tooltip:O.tooltip}));let z;t[18]!==g||t[19]!==v?(z=O=>g.has(O.label)?null:v(`Cell > ${O.label}`,O.handleHeadless||O.handle,{disabled:O.disabled,tooltip:O.tooltip}),t[18]=g,t[19]=v,t[20]=z):z=t[20];const D=a.map(z);let F,B,U;return t[21]!==A||t[22]!==R||t[23]!==D||t[24]!==M?(F=u.jsxs(A,{heading:"Commands",children:[M,R,D]}),t[21]=A,t[22]=R,t[23]=D,t[24]=M,t[25]=F):F=t[25],t[26]!==E||t[27]!==F||t[28]!==N||t[29]!==I?(B=u.jsxs(E,{children:[N,I,F]}),t[26]=E,t[27]=F,t[28]=N,t[29]=I,t[30]=B):B=t[30],t[31]!==C||t[32]!==e||t[33]!==n||t[34]!==B||t[35]!==k?(U=u.jsxs(C,{open:e,onOpenChange:n,children:[k,B]}),t[31]=C,t[32]=e,t[33]=n,t[34]=B,t[35]=k,t[36]=U):U=t[36],U};function nC(t){return!t.hotkey}function oC(t){return t.label}function rC(t){return!t}function pr(){return ke.string().optional().describe(We.of({label:"Password",inputType:"password",placeholder:"password",optionRegex:".*password.*"}))}function Xm(){return ke.string().optional().describe(We.of({label:"Token",inputType:"password",placeholder:"token",optionRegex:".*token.*"}))}function Sa(){return ke.string().optional().describe(We.of({label:"Warehouse Name",placeholder:"warehouse",optionRegex:".*warehouse.*"}))}function Zm(){return ke.string().optional().describe(We.of({label:"URI",optionRegex:".*uri.*"}))}function mr(){return ke.string().nonempty().describe(We.of({label:"Host",placeholder:"localhost",optionRegex:".*host.*"}))}function ho(){return ke.string().describe(We.of({label:"Database",placeholder:"db name",optionRegex:".*database.*"}))}function gr(){return ke.string().nonempty().describe(We.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function _r(t){const e=ke.coerce.string().describe(We.of({label:"Port",inputType:"number",placeholder:t==null?void 0:t.toString()})).transform(Number).refine(n=>n>=0&&n<=65535,{message:"Port must be between 0 and 65535"});return t!==void 0?e.default(t.toString()):e}function Qm(){return ke.boolean().default(!1).describe(We.of({label:"Read Only"}))}const eg=ke.object({type:ke.literal("postgres"),host:mr(),port:_r(5432).optional(),database:ho(),username:gr(),password:pr(),ssl:ke.boolean().default(!1).describe(We.of({label:"Use SSL"}))}).describe(We.of({direction:"two-columns"})),tg=ke.object({type:ke.literal("mysql"),host:mr(),port:_r(3306),database:ho(),username:gr(),password:pr(),ssl:ke.boolean().default(!1).describe(We.of({label:"Use SSL"}))}).describe(We.of({direction:"two-columns"})),ng=ke.object({type:ke.literal("sqlite"),database:ho().describe(We.of({label:"Database Path"}))}).describe(We.of({direction:"two-columns"})),og=ke.object({type:ke.literal("duckdb"),database:ho().describe(We.of({label:"Database Path"})),read_only:Qm()}).describe(We.of({direction:"two-columns"})),rg=ke.object({type:ke.literal("motherduck"),database:ho().default("my_db").describe(We.of({label:"Database Name"})),token:Xm()}).describe(We.of({direction:"two-columns"})),sg=ke.object({type:ke.literal("snowflake"),account:ke.string().nonempty().describe(We.of({label:"Account",optionRegex:".*snowflake.*"})),warehouse:ke.string().optional().describe(We.of({label:"Warehouse",optionRegex:".*snowflake.*"})),database:ho(),schema:ke.string().optional().describe(We.of({label:"Schema",optionRegex:".*snowflake.*"})),username:gr(),password:pr(),role:ke.string().optional().describe(We.of({label:"Role"}))}).describe(We.of({direction:"two-columns"})),ig=ke.object({type:ke.literal("bigquery"),project:ke.string().nonempty().describe(We.of({label:"Project ID",optionRegex:".*bigquery.*"})),dataset:ke.string().nonempty().describe(We.of({label:"Dataset",optionRegex:".*bigquery.*"})),credentials_json:ke.string().describe(We.of({label:"Credentials JSON",inputType:"textarea"}))}).describe(We.of({direction:"two-columns"})),ag=ke.object({type:ke.literal("clickhouse_connect"),host:mr(),port:_r(8123).optional(),username:gr(),password:pr(),secure:ke.boolean().default(!1).describe(We.of({label:"Use HTTPs"}))}).describe(We.of({direction:"two-columns"})),lg=ke.object({type:ke.literal("timeplus"),host:mr().default("localhost"),port:_r(8123).optional(),username:gr().default("default"),password:pr().default("")}).describe(We.of({direction:"two-columns"})),cg=ke.object({type:ke.literal("chdb"),database:ho().describe(We.of({label:"Database Path"})),read_only:Qm()}).describe(We.of({direction:"two-columns"})),dg=ke.object({type:ke.literal("trino"),host:mr(),port:_r(8080),database:ho(),schema:ke.string().describe(We.of({label:"Schema",placeholder:"schema name",optionRegex:".*schema.*"})).optional(),username:gr(),password:pr(),async_support:ke.boolean().default(!1).describe(We.of({label:"Async Support"}))}).describe(We.of({direction:"two-columns"})),ug=ke.object({type:ke.literal("iceberg"),name:ke.string().describe(We.of({label:"Catalog Name"})),catalog:ke.discriminatedUnion("type",[ke.object({type:ke.literal("REST"),warehouse:Sa(),uri:ke.string().optional().describe(We.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:Xm()}),ke.object({type:ke.literal("SQL"),warehouse:Sa(),uri:ke.string().optional().describe(We.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),ke.object({type:ke.literal("Hive"),warehouse:Sa(),uri:Zm()}),ke.object({type:ke.literal("Glue"),warehouse:Sa(),uri:Zm()}),ke.object({type:ke.literal("DynamoDB"),"dynamodb.profile-name":ke.string().optional().describe(We.of({label:"Profile Name"})),"dynamodb.region":ke.string().optional().describe(We.of({label:"Region"})),"dynamodb.access-key-id":ke.string().optional().describe(We.of({label:"Access Key ID"})),"dynamodb.secret-access-key":ke.string().optional().describe(We.of({label:"Secret Access Key",inputType:"password"})),"dynamodb.session-token":ke.string().optional().describe(We.of({label:"Session Token",inputType:"password"}))})]).default({type:"REST"}).describe(We.of({special:"tabs"}))}),hg=ke.object({type:ke.literal("datafusion"),sessionContext:ke.boolean().optional().describe(We.of({label:"Use Session Context"}))}),fg=ke.object({type:ke.literal("pyspark"),host:mr().optional(),port:_r().optional()}),pg=ke.object({type:ke.literal("redshift"),host:mr(),port:_r(5439),connectionType:ke.discriminatedUnion("type",[ke.object({type:ke.literal("IAM credentials"),region:ke.string().describe(We.of({label:"Region"})),aws_access_key_id:ke.string().nonempty().describe(We.of({label:"AWS Access Key ID",inputType:"password",optionRegex:".*aws_access_key_id.*"})),aws_secret_access_key:ke.string().nonempty().describe(We.of({label:"AWS Secret Access Key",inputType:"password",optionRegex:".*aws_secret_access_key.*"})),aws_session_token:ke.string().optional().describe(We.of({label:"AWS Session Token",inputType:"password",optionRegex:".*aws_session_token.*"}))}),ke.object({type:ke.literal("DB credentials"),user:gr(),password:pr()})]).default({type:"IAM credentials",aws_access_key_id:"",aws_secret_access_key:"",region:""}),database:ho()}).describe(We.of({direction:"two-columns"})),sC=ke.discriminatedUnion("type",[eg,tg,ng,og,rg,sg,ig,ag,lg,cg,dg,ug,hg,fg,pg]),dd="env:";function Ca(t){return typeof t=="string"&&t.startsWith(dd)}function ud(t){return`${dd}${t}`}const mg={sqlmodel:"SQLModel",sqlalchemy:"SQLAlchemy",duckdb:"DuckDB",clickhouse_connect:"ClickHouse Connect",chdb:"chDB",pyiceberg:"PyIceberg",ibis:"Ibis",motherduck:"MotherDuck",redshift:"Redshift"};class on{constructor(e,n,o){this.connection=void 0,this.orm=void 0,this.secrets=void 0,this.connection=e,this.orm=n,this.secrets=o}get imports(){const e=new Set(this.generateImports());switch(this.orm){case"sqlalchemy":e.add("import sqlalchemy");break;case"sqlmodel":e.add("import sqlmodel");break;case"duckdb":e.add("import duckdb")}return e}}class iC{constructor(){this.secrets={}}get imports(){return Object.keys(this.secrets).length===0?new Set:new Set(["import os"])}print(e,n,o){if(e=(r=>`_${r}`)(e),Ca(n)){const r=n.replace(dd,""),s=o?`os.environ.get("${r}", "${o}")`:`os.environ.get("${r}")`;return this.secrets[e]=s,e}if(o!=null){const r=`os.environ.get("${n}", "${o}")`;return this.secrets[e]=r,e}return typeof n=="number"||typeof n=="number"?`${n}`:typeof n=="boolean"?zr(n):n?`"${n}"`:""}printInFString(e,n,o){if(n===void 0)return"";if(typeof n=="number")return`${n}`;if(typeof n=="boolean")return zr(n);const r=this.print(e,n,o);return r.startsWith('"')&&r.endsWith('"')?r.slice(1,-1):`{${r}}`}printPassword(e,n,o){const r=o?this.printInFString.bind(this):this.print.bind(this);return Ca(e)?r("password",e):r("password",n,e)}getSecrets(){return this.secrets}formatSecrets(){return Object.keys(this.secrets).length===0?"":Object.entries(this.secrets).map(([e,n])=>`${e} = ${n}`).join(`
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./tracing-DWbu8K8J.js","./index-Efv2AoHv.js","./index-B-hr6ABS.css","./compile-Ds3GpY37.js","./time-DLrmhaqR.js","./timer-Bqd5yn_a.js","./linear-BAbOG_EP.js","./init-DLRA0X12.js","./range-CtcPcB_L.js","./zoom-COrs4lFh.js","./ordinal-DDUp3AbE.js","./colors-bszWmPJw.js","./step-BwsUM5iJ.js","./arc-CfyY4LWz.js","./storage-D99GqsAj.js","./index-Bv2lycgb.js","./index-CeN2C0l1.js","./index-DuMWjnm-.js","./index-BIoa1h_M.js","./index-B0v1TUmW.js","./index-Bt9ulLuD.js","./index-CMc3obDE.js","./index-kUwGWpGA.js","./index-koMCYoOd.js","./index-DjeOFBOc.js","./index-DetPm8Wz.js","./index-BrLZu1m3.js","./index-C5FhBFgH.js","./apl-CXdQSnD-.js","./asciiarmor-D5V0T9Cu.js","./asterisk-B46aRdXb.js","./brainfuck-CtZaYBKt.js","./clike-BgBwzOhw.js","./cmake-DXn5xaP-.js","./cobol-stawOqaz.js","./coffeescript-BTDxI-eT.js","./commonlisp-vq6DHwts.js","./crystal-CRzZ78HM.js","./cypher-gJDei3ni.js","./d-BShv7fp-.js","./diff-UJJ5BM9S.js","./dockerfile-knGOOxt4.js","./simple-mode-C3vEBAcb.js","./dtd-DI9Herc-.js","./dylan-DkEP81N9.js","./ebnf-B-Df8AvO.js","./ecl-DPFc0Uaf.js","./eiffel-DR5c0IrL.js","./elm-DompmV0j.js","./erlang-BuqgqA5h.js","./factor-CFXhaUWb.js","./fcl-CVaBTCzQ.js","./forth-POgR1ypr.js","./fortran-DL7KluxX.js","./gas-bV0CklSb.js","./gherkin-B6X1vGSW.js","./groovy-DnIzCrpZ.js","./haskell-CLQs6EAM.js","./haxe-D25e-2l-.js","./http-BKJkqRj4.js","./idl-pcmmZuaN.js","./jinja2-DhgKlfW7.js","./julia-DjdwvFuI.js","./livescript-HO6ttBFx.js","./lua-8DXOpKDz.js","./mathematica-IIbmv7SK.js","./mbox-z_N2Mo3d.js","./mirc-DkvFAiy5.js","./modelica-DSrSSXCg.js","./mscgen-B2igx18G.js","./mumps-zvxmGV4l.js","./nginx-B4hAVlXN.js","./nsis-BvKfQ9lQ.js","./ntriples-BSwWqoLa.js","./octave-C4hdQ5Hf.js","./oz-qQq7irPq.js","./pascal-CafrKXZF.js","./perl-tdMlh9QA.js","./pig-CwGJVRC4.js","./powershell-D1ly3AHC.js","./properties-_nPj978X.js","./protobuf-B4y9do6W.js","./puppet-Bc-yJKzi.js","./q-B0kTJ4cI.js","./r-BA4EbLKE.js","./ruby-CR-u2WLS.js","./sas-Bqaci40L.js","./scheme-qjP0V5Ag.js","./shell-BLav31RL.js","./sieve-r025o_jW.js","./smalltalk-C7J3IyEP.js","./solr-78MBEUkU.js","./sparql-BRLJFz69.js","./spreadsheet-CGlWr0eM.js","./stylus-Bdo_Aemu.js","./swift-B_XXVlXX.js","./tcl-B2fODqDH.js","./textile-BuVhTOzU.js","./tiddlywiki-BgR6AEZu.js","./tiki-CI-ztowC.js","./toml-wcPdHu67.js","./troff-Ce85hlLp.js","./ttcn-BxnYHtq8.js","./turtle-BkSuIpt-.js","./vb-BHgjm0DN.js","./vbscript-Dawdd5GZ.js","./velocity-BdD_26Jv.js","./verilog-B4LBqg_1.js","./vhdl-CWWH2SUo.js","./webidl-CGwyPRYs.js","./xquery-CVDBqZPY.js","./yacas-I8QjZlxf.js","./z80-D8p3gKXp.js","./storage-De8XnUVS.css","./shutdown-button-iAjIETC2.js","./index-CScw2zd1.js","./shutdown-button-C1rhMrxo.css","./circle-play-B6y4l4ml.js","./_createAggregator-BFY8QAxM.js","./_baseEach-CIwfC8KI.js","./transform-DetRMEbJ.js","./sortBy-S-JAmHjf.js","./_baseMap-CWwnc8Fb.js","./terminal-CujgA_Fv.js","./terminal-WqMRJt5Z.css"])))=>i.map(i=>d[i]);
|
2
|
+
var rz=Object.defineProperty;var S3=Rt=>{throw TypeError(Rt)};var sz=(Rt,Ct,dn)=>Ct in Rt?rz(Rt,Ct,{enumerable:!0,configurable:!0,writable:!0,value:dn}):Rt[Ct]=dn;var Q=(Rt,Ct,dn)=>sz(Rt,typeof Ct!="symbol"?Ct+"":Ct,dn),iz=(Rt,Ct,dn)=>Ct.has(Rt)||S3("Cannot "+dn);var C3=(Rt,Ct,dn)=>(iz(Rt,Ct,"read from private field"),dn?dn.call(Rt):Ct.get(Rt)),N3=(Rt,Ct,dn)=>Ct.has(Rt)?S3("Cannot add the same private member more than once"):Ct instanceof WeakSet?Ct.add(Rt):Ct.set(Rt,dn);import{u as Oe,Q as T,ia as az,ib as lz,ic as j3,id as cz,ie as dz,ig as uz,a as K,ih as hz,ii as jr,ij as fz,ik as Jf,il as E3,im as pz,io as mz,ip as I3,iq as Gl,c as X,ez as gz,aq as ut,j as u,ag as Yn,an as er,am as ks,ao as Ss,br as tr,W as Te,ap as pn,ir as Vi,al as nr,aR as Pn,ar as $i,a4 as Ae,a0 as Kt,dW as Kf,eJ as Cs,is as _z,aM as Xe,a8 as kt,it as bz,eP as Ln,iu as A3,iv as T3,iw as Xf,ix as M3,iy as yz,L as It,dD as Yl,aY as or,iz as Jl,a_ as Zf,au as xn,iA as xz,a7 as Qf,iB as wz,iC as O3,eO as D3,_ as Ht,b5 as R3,iD as P3,cF as ep,iE as vz,dN as ct,iF as L3,dU as tp,iG as kz,iH as Kl,Z as Be,bc as Fn,iI as Xl,iJ as Hi,eE as Ns,iK as Sz,iL as Wi,iM as Cz,eM as Nz,iN as F3,iO as z3,en as jz,iP as ao,iQ as Er,aW as Zl,iR as Ez,iS as Ql,iT as B3,a5 as js,eb as U3,a6 as qi,iU as Iz,iV as np,iW as Ir,bt as Ar,eF as Tr,fl as V3,g5 as Mr,fA as Az,bf as tn,iX as Tz,iY as Mz,g3 as op,aO as ec,iZ as rp,i_ as Oz,i$ as $3,j0 as sp,j1 as Dz,j2 as Rz,j3 as lo,j4 as H3,g9 as ip,j5 as Gi,j6 as tc,es as ke,j7 as We,j8 as ap,j9 as xt,ja as W3,dx as nc,dt as oc,du as rc,dv as sc,ds as Yi,jb as Pz,fy as lp,b4 as wn,aI as zn,fo as q3,fq as G3,fr as Lz,fw as Fz,fs as Y3,V as je,em as zz,aU as Es,b2 as Is,aV as As,a$ as Wt,eN as co,jc as Bz,fu as J3,jd as Uz,fm as K3,fn as X3,je as Or,dw as Z3,jf as Q3,jg as Vz,jh as $z,ak as Hz,aj as Wz,ji as cp,dA as qz,dC as dp,fa as ic,jj as ac,jk as lc,bw as vn,jl as Gz,eI as Ji,f7 as cn,bk as e4,dX as Ft,jm as Yz,eh as Jz,ah as up,jn as Ki,jo as cc,jp as Kz,jq as Xz,jr as t4,js as nn,aX as Zz,at as hp,g8 as n4,eo as dc,jt as Qz,gu as fp,bj as uc,ju as pp,ai as eB,jv as tB,as as Xi,eA as o4,bn as nB,jw as oB,jx as r4,jy as rB,jz as sB,jA as iB,jB as aB,jC as lB,dy as Do,jD as cB,jE as hc,jF as Ts,o as Ro,n as tt,fP as kn,jG as Sn,jH as dt,jI as Ms,jJ as At,g4 as qt,jK as mp,er as Jn,jL as dB,jM as uB,bh as s4,bi as i4,jN as a4,jO as hB,gw as Os,jP as fc,be as pc,gx as Dr,eQ as gp,jQ as fB,jR as pB,jS as mB,jT as gB,jU as l4,jV as Zi,jW as c4,jX as _B,jY as d4,jZ as u4,j_ as bB,j$ as h4,k0 as f4,eR as mc,k1 as yB,k2 as p4,k3 as Qi,k4 as ea,k5 as gc,k6 as rr,k7 as m4,k8 as Po,k9 as Ds,ka as _p,kb as ta,kc as Rs,kd as bp,ke as yp,kf as g4,kg as _c,kh as xB,S as na,ki as oa,kj as wB,dT as bc,kk as vB,kl as xp,km as kB,kn as SB,ko as yc,e0 as CB,kp as wp,kq as Ps,kr as xc,ks as Ls,fO as Bn,fZ as Lo,fL as _4,cp as b4,kt as vp,fx as y4,ku as kp,kv as x4,kw as ra,kx as w4,ky as wc,kz as Sp,kA as sa,kB as ia,kC as aa,kD as NB,fH as vc,kE as kc,kF as Sc,eg as jB,fI as EB,kG as IB,kH as AB,kI as TB,kJ as MB,r as OB,kK as DB,kL as RB,kM as PB,fS as LB,kN as sr,kO as FB,kP as v4,t as P,kQ as zB,kR as BB,kS as UB,kT as VB,kU as $B,kV as HB,kW as WB,kX as qB,kY as GB,kZ as YB,k_ as JB,k$ as KB,l0 as XB,l1 as ZB,l2 as QB,l3 as eU,l4 as tU,l5 as nU,l6 as oU,l7 as rU,l8 as sU,l9 as iU,la as aU,lb as lU,lc as cU,ld as dU,le as uU,lf as hU,lg as fU,lh as Cp,li as Cc,lj as k4,lk as pU,ll as mU,lm as S4,ln as gU,lo as Fs,lp as Un,lq as _U,lr as bU,ls as yU,lt as xU,lu as wU,lv as vU,lw as kU,lx as SU,ly as CU,lz as NU,lA as ir,lB as jU,lC as EU,lD as IU,lE as AU,dZ as TU,lF as MU,lG as C4,e1 as OU,lH as Nc,lI as DU,lJ as RU,lK as PU,lL as LU,X as ar,lM as jc,lN as FU,lO as zU,lP as N4,lQ as Np,gv as zs,lR as BU,lS as UU,lT as VU,lU as $U,fX as HU,bq as WU,$ as jp,lV as j4,lW as qU,lX as GU,lY as Ep,lZ as Ip,l_ as YU,l$ as E4,m0 as I4,m1 as Ec,fK as JU,ab as A4,dL as KU,m2 as T4,fj as St,m3 as la,m4 as Bs,m5 as XU,m6 as ZU,m7 as Ap,m8 as QU,co as Tp,m9 as eV,U as lr,bg as M4,ma as tV,mb as nV,mc as Ic,md as O4,dJ as Mp,bs as D4,me as oV,mf as rV,mg as R4,mh as sV,mi as iV,mj as P4,ac as Op,mk as aV,bu as L4,ml as lV,eH as cV,mm as Fo,ek as F4,mn as z4,eL as B4,fB as Ac,mo as Dp,mp as U4,aT as Rp,el as Tc,mq as V4,mr as dV,ms as uV,mt as hV,mu as $4,mv as fV,mw as H4,mx as pV,gm as mV,fp as gV,ft as Pp,gp as _V,bp as Mc,my as bV,mz as W4,mA as Lp,mB as yV,mC as xV,mD as wV,mE as vV,mF as q4,fc as Fp,dF as G4,mG as kV,mH as SV,mI as CV,aN as NV,mJ as jV,mK as EV,mL as IV,mM as AV,a9 as TV,mN as Oc,aa as MV,mO as Y4,f8 as OV,mP as J4,ad as Vn,fF as DV,mQ as RV,mR as PV,mS as K4,mT as LV,mU as Us,mV as FV,mW as Dc,mX as zV,mY as BV,y as X4,mZ as UV,dl as VV,m_ as ca,m$ as $V,n0 as HV,n1 as WV,n2 as qV,C as Z4,n3 as GV,n4 as YV,n5 as JV,E as Rr,eW as KV,bd as XV,bb as ZV,n6 as QV,n7 as e$,a2 as Rc,n8 as t$,a3 as cr,dI as Q4,n9 as zp,na as n$,dV as eS,nb as o$,nc as tS,nd as r$,ne as nS,nf as s$,ng as i$,nh as oS,ni as rS,nj as sS,f6 as iS,nk as a$,nl as l$,nm as aS,nn as lS,no as Pc,np as cS,nq as c$,nr as dS,ns as d$,nt as u$,nu as uS,nv as h$,nw as f$,nx as p$,ny as m$,nz as g$,nA as _$,nB as b$,dS as y$,nC as x$,nD as w$,fY as Bp,nE as v$,nF as k$,nG as S$,nH as C$,nI as N$,nJ as j$,nK as E$,nL as I$,nM as A$,nN as T$,nO as Up,nP as M$,fN as O$,nQ as D$,nR as R$,nS as P$,nT as hS,nU as L$,nV as F$,a1 as z$,eC as B$,ge as U$,nW as V$,nX as $$,gg as Vp,gc as Vs,gh as Pr,gd as Lr,gi as $p,gj as Hp,nY as fS,gf as H$,nZ as pS,n_ as W$,n$ as mS,o0 as dr,o1 as gS,go as q$,o2 as G$,o3 as Y$,o4 as J$,o5 as K$,o6 as X$,o7 as Z$,o8 as _S,et as Q$,o9 as Wp,av as Lc,oa as bS,ob as yS,ax as xS,aw as eH,dR as tH,__tla as nH}from"./index-Efv2AoHv.js";import{b as $s,A as oH,L as wS,g as rH,G as sH,s as iH,k as aH,B as vS,a as lH,M as cH,Y as dH,c as mn,u as da,C as uH,S as hH,K as fH,d as pH,i as mH,e as kS,f as gH,h as _H,j as ua,P as qp,l as SS,m as bH,n as yH,o as xH,p as CS,q as Gp,T as wH}from"./shutdown-button-iAjIETC2.js";import{V as NS,d as Hs,I as Yp,N as jS,S as ES,e as IS,f as AS,L as TS,g as MS,F as OS,M as vH,l as DS,h as kH,j as uo,k as Fc,m as zc,i as SH,E as RS,n as CH,o as Jp,p as NH,q as jH,s as EH,t as IH,v as AH,w as TH,x as MH,y as OH,a as DH,C as RH,R as PS,A as PH,b as LH,T as FH,z as zH,B as BH,D as UH,G as VH,O as $H,c as HH,P as WH,__tla as qH}from"./storage-D99GqsAj.js";import{c as GH}from"./_createAggregator-BFY8QAxM.js";import{s as Kn,i as ur,T as Kp,a as Xp}from"./transform-DetRMEbJ.js";import{g as LS}from"./timer-Bqd5yn_a.js";import{i as YH}from"./zoom-COrs4lFh.js";import{s as ha}from"./sortBy-S-JAmHjf.js";let Zp,Bc,gn,Uc,FS,fa,Qp,JH=Promise.all([(()=>{try{return nH}catch{}})(),(()=>{try{return qH}catch{}})()]).then(async()=>{var ql,w3;var Rt=GH(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});let Ct,dn,em,Vc,Ws,Fr,tm,nm,om,rm,pa,$c,sm,ma,im,Hc,am,lm,Wc,cm,dm,um,ga,hm,qc,fm,pm,mm,gm,_m,bm,Gc,ym,Yc,Jc,xm,wm,vm,km,Sm,_a,Cm,Nm,Kc,jm,Em,Im,Xc,Am,Tm,Mm,ba,Zc,Qc,Om,Dm,Rm,Pm,Lm,Fm,zm,Bm,Um,ed,td,Vm,$m,Hm,ya,hr,fr;Ct=Oe("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),dn=Oe("arrow-right-from-line",[["path",{d:"M3 5v14",key:"1nt18q"}],["path",{d:"M21 12H7",key:"13ipq5"}],["path",{d:"m15 18 6-6-6-6",key:"6tx3qv"}]]),em=Oe("arrow-right-to-line",[["path",{d:"M17 12H3",key:"8awo09"}],["path",{d:"m11 18 6-6-6-6",key:"8c2y43"}],["path",{d:"M21 5v14",key:"nzette"}]]),Vc=Oe("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),Ws=Oe("ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]),Fr=Oe("between-horizontal-start",[["rect",{width:"13",height:"7",x:"8",y:"3",rx:"1",key:"pkso9a"}],["path",{d:"m2 9 3 3-3 3",key:"1agib5"}],["rect",{width:"13",height:"7",x:"8",y:"14",rx:"1",key:"1q5fc1"}]]),tm=Oe("chevrons-down",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),nm=Oe("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),Uc=Oe("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),om=Oe("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),rm=Oe("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),pa=Oe("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),$c=Oe("clipboard-copy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]),sm=Oe("clipboard-paste",[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]]),ma=Oe("cloud-download",[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]]),im=Oe("code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]),Hc=Oe("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]),am=Oe("copy-minus",[["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),lm=Oe("diamond-plus",[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]),Wc=Oe("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]),cm=Oe("eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]),dm=Oe("fast-forward",[["polygon",{points:"13 19 22 12 13 5 13 19",key:"587y9g"}],["polygon",{points:"2 19 11 12 2 5 2 19",key:"3pweh0"}]]),um=Oe("file-pen",[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]),ga=Oe("file-plus-2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]]),hm=Oe("files",[["path",{d:"M20 7h-3a2 2 0 0 1-2-2V2",key:"x099mo"}],["path",{d:"M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z",key:"18t6ie"}],["path",{d:"M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8",key:"1nja0z"}]]),qc=Oe("folder-plus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),fm=Oe("folder-tree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]),pm=Oe("grip-vertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]),mm=Oe("hard-drive-download",[["path",{d:"M12 2v8",key:"1q4o3n"}],["path",{d:"m16 6-4 4-4-4",key:"6wukr"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 18h.01",key:"h775k"}]]),gm=Oe("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]),_m=Oe("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]),bm=Oe("key-round",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]),Gc=Oe("key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]),ym=Oe("keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]),Yc=Oe("layout-template",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]),Jc=Oe("list-tree",[["path",{d:"M21 12h-8",key:"1bmf0i"}],["path",{d:"M21 6H8",key:"1pqkrb"}],["path",{d:"M21 18h-8",key:"1tm79t"}],["path",{d:"M3 6v4c0 1.1.9 2 2 2h3",key:"1ywdgy"}],["path",{d:"M3 10v6c0 1.1.9 2 2 2h3",key:"2wc746"}]]),xm=Oe("list",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]),wm=Oe("map-pin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]),vm=Oe("memory-stick",[["path",{d:"M6 19v-3",key:"1nvgqn"}],["path",{d:"M10 19v-3",key:"iu8nkm"}],["path",{d:"M14 19v-3",key:"kcehxu"}],["path",{d:"M18 19v-3",key:"1vh91z"}],["path",{d:"M8 11V9",key:"63erz4"}],["path",{d:"M16 11V9",key:"fru6f3"}],["path",{d:"M12 11V9",key:"ha00sb"}],["path",{d:"M2 15h20",key:"16ne18"}],["path",{d:"M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z",key:"lhddv3"}]]),km=Oe("message-circle-question",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),Sm=Oe("microchip",[["path",{d:"M18 12h2",key:"quuxs7"}],["path",{d:"M18 16h2",key:"zsn3lv"}],["path",{d:"M18 20h2",key:"9x5y9y"}],["path",{d:"M18 4h2",key:"1luxfb"}],["path",{d:"M18 8h2",key:"nxqzg"}],["path",{d:"M4 12h2",key:"1ltxp0"}],["path",{d:"M4 16h2",key:"8a5zha"}],["path",{d:"M4 20h2",key:"27dk57"}],["path",{d:"M4 4h2",key:"10groj"}],["path",{d:"M4 8h2",key:"18vq6w"}],["path",{d:"M8 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2h-1.5c-.276 0-.494.227-.562.495a2 2 0 0 1-3.876 0C9.994 2.227 9.776 2 9.5 2z",key:"1681fp"}]]),_a=Oe("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]),Cm=Oe("octagon-alert",[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]]),Nm=Oe("package-check",[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]),Kc=Oe("package-x",[["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["path",{d:"m17 13 5 5m-5 0 5-5",key:"im3w4b"}]]),jm=Oe("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Em=Oe("party-popper",[["path",{d:"M5.8 11.3 2 22l10.7-3.79",key:"gwxi1d"}],["path",{d:"M4 3h.01",key:"1vcuye"}],["path",{d:"M22 8h.01",key:"1mrtc2"}],["path",{d:"M15 2h.01",key:"1cjtqr"}],["path",{d:"M22 20h.01",key:"1mrys2"}],["path",{d:"m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10",key:"hbicv8"}],["path",{d:"m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17",key:"1i94pl"}],["path",{d:"m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7",key:"1cofks"}],["path",{d:"M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z",key:"4kbmks"}]]),Im=Oe("pen-line",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]),Xc=Oe("presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]),Am=Oe("regex",[["path",{d:"M17 3v10",key:"15fgeh"}],["path",{d:"m12.67 5.5 8.66 5",key:"1gpheq"}],["path",{d:"m12.67 10.5 8.66-5",key:"1dkfa6"}],["path",{d:"M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z",key:"swwfx4"}]]),Tm=Oe("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]),Mm=Oe("rows-3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]),ba=Oe("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]),Zc=Oe("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]),Qc=Oe("scroll-text",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]),Om=Oe("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),Dm=Oe("square-code",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),Rm=Oe("square-dashed-bottom-code",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["path",{d:"M5 21a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2",key:"as5y1o"}],["path",{d:"M9 21h1",key:"15o7lz"}]]),Pm=Oe("square-equal",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M7 14h10",key:"1mhdw3"}]]),Lm=Oe("square-m",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8l4 4 4-4v8",key:"141u4e"}]]),Fm=Oe("square-play",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m9 8 6 4-6 4Z",key:"f1r3lt"}]]),zm=Oe("square-power",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),Bm=Oe("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]),Um=Oe("text-cursor-input",[["path",{d:"M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6",key:"1528k5"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1",key:"1mj8rg"}],["path",{d:"M9 6v12",key:"velyjx"}]]),ed=Oe("text-search",[["path",{d:"M21 6H3",key:"1jwq7v"}],["path",{d:"M10 12H3",key:"1ulcyk"}],["path",{d:"M10 18H3",key:"13769t"}],["circle",{cx:"17",cy:"15",r:"3",key:"1upz2a"}],["path",{d:"m21 19-1.9-1.9",key:"dwi7p8"}]]),td=Oe("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),Vm=Oe("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]),$m=Oe("view",[["path",{d:"M21 17v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-2",key:"mrq65r"}],["path",{d:"M21 7V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2",key:"be3xqs"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]]),Hm=Oe("whole-word",[["circle",{cx:"7",cy:"12",r:"3",key:"12clwm"}],["path",{d:"M10 9v6",key:"17i7lo"}],["circle",{cx:"17",cy:"12",r:"3",key:"gl7c2s"}],["path",{d:"M14 7v8",key:"dl84cr"}],["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]]),ya=Oe("workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]),hr=Oe("zap-off",[["path",{d:"M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317",key:"193nxd"}],["path",{d:"M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773",key:"27a7lr"}],["path",{d:"M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643",key:"1e0qe9"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),fr=Oe("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);const zS=T.createContext({}),BS=T.forwardRef(function(t,e){[t,e]=dz(t,e,zS);let{toolbarProps:n}=function(s,i){const{"aria-label":a,"aria-labelledby":l,orientation:c="horizontal"}=s;let[d,h]=T.useState(!1);az(()=>{var m;h(!(!i.current||!(!((m=i.current.parentElement)===null||m===void 0)&&m.closest('[role="toolbar"]'))))});const{direction:f}=lz(),p=f==="rtl"&&c==="horizontal";let _=cz(i);const g=T.useRef(null);return{toolbarProps:{...j3(s,{labelable:!0}),role:d?"group":"toolbar","aria-orientation":c,"aria-label":a,"aria-labelledby":a==null?l:void 0,onKeyDownCapture:d?void 0:m=>{if(m.currentTarget.contains(m.target)){if(c==="horizontal"&&m.key==="ArrowRight"||c==="vertical"&&m.key==="ArrowDown")p?_.focusPrevious():_.focusNext();else{if(!(c==="horizontal"&&m.key==="ArrowLeft"||c==="vertical"&&m.key==="ArrowUp"))return m.key==="Tab"?(m.stopPropagation(),g.current=document.activeElement,void(m.shiftKey?_.focusFirst():_.focusLast())):void 0;p?_.focusNext():_.focusPrevious()}m.stopPropagation(),m.preventDefault()}},onFocusCapture:d?void 0:m=>{var b,y;g.current&&!m.currentTarget.contains(m.relatedTarget)&&(!((b=i.current)===null||b===void 0)&&b.contains(m.target))&&((y=g.current)===null||y===void 0||y.focus(),g.current=null)},onBlurCapture:d?void 0:m=>{m.currentTarget.contains(m.relatedTarget)||g.current||(g.current=m.target)}}}}(t,e),o=uz({...t,values:{orientation:t.orientation||"horizontal"},defaultClassName:"react-aria-Toolbar"}),r=j3(t);return delete r.id,K.createElement("div",{...hz(n,r),...o,ref:e,slot:t.slot||void 0,"data-orientation":t.orientation||"horizontal"},o.children)});function xa(t,e){const n=+jr(t)-+jr(e);return n<0?-1:n>0?1:n}function US(t,e){const n=jr(t,e==null?void 0:e.in);return+function(o,r){const s=jr(o,r==null?void 0:r.in);return s.setHours(23,59,59,999),s}(n,e)==+function(o,r){const s=jr(o,r==null?void 0:r.in),i=s.getMonth();return s.setFullYear(s.getFullYear(),i+1,0),s.setHours(23,59,59,999),s}(n,e)}function VS(t,e,n){const[o,r,s]=Jf(n==null?void 0:n.in,t,t,e),i=xa(r,s),a=Math.abs(function(d,h,f){const[p,_]=Jf(f==null?void 0:f.in,d,h);return 12*(p.getFullYear()-_.getFullYear())+(p.getMonth()-_.getMonth())}(r,s));if(a<1)return 0;r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-i*a);let l=xa(r,s)===-i;US(o)&&a===1&&xa(o,s)===1&&(l=!1);const c=i*(a-+l);return c===0?0:c}function $S(t,e,n){const o=function(r,s){return+jr(r)-+jr(s)}(t,e)/1e3;return(r=>{const s=(0,Math.trunc)(r);return s===0?0:s})(o)}function HS(t,e){return function(n,o,r){const s=pz(),i=(r==null?void 0:r.locale)??s.locale??mz,a=xa(n,o);if(isNaN(a))throw new RangeError("Invalid time value");const l=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:a}),[c,d]=Jf(r==null?void 0:r.in,...a>0?[o,n]:[n,o]),h=$S(d,c),f=(E3(d)-E3(c))/1e3,p=Math.round((h-f)/60);let _;if(p<2)return p===0?i.formatDistance("lessThanXMinutes",1,l):i.formatDistance("xMinutes",p,l);if(p<45)return i.formatDistance("xMinutes",p,l);if(p<90)return i.formatDistance("aboutXHours",1,l);if(p<I3){const g=Math.round(p/60);return i.formatDistance("aboutXHours",g,l)}if(p<2520)return i.formatDistance("xDays",1,l);if(p<Gl){const g=Math.round(p/I3);return i.formatDistance("xDays",g,l)}if(p<2*Gl)return _=Math.round(p/Gl),i.formatDistance("aboutXMonths",_,l);if(_=VS(d,c),_<12){const g=Math.round(p/Gl);return i.formatDistance("xMonths",g,l)}{const g=_%12,m=Math.trunc(_/12);return g<3?i.formatDistance("aboutXYears",m,l):g<9?i.formatDistance("overXYears",m,l):i.formatDistance("almostXYears",m+1,l)}}(t,function(n){return fz(n,Date.now())}(t),e)}const wa="https://static.marimo.app",WS=t=>{const e=X.c(24),{onClose:n}=t,[o,r]=T.useState("");let s;s=Math.random().toString(36).slice(2,6);const i=`${o}-${s}`,a=`${wa}/static/${i}`;let l,c,d,h,f,p,_,g,m,b,y;return e[0]!==n||e[1]!==i?(l=async x=>{x.preventDefault(),n();const v=await gz({download:!1,includeCode:!0,files:NS.INSTANCE.filenames()}),C=ut({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${wa}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:v,path:i})}).catch(()=>{C.dismiss(),ut({title:"Error uploading static page",description:u.jsxs("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",u.jsx("a",{href:Yn.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),C.dismiss(),ut({title:"Static page uploaded!",description:u.jsxs("div",{children:["The URL has been copied to your clipboard.",u.jsx("br",{}),"You can share it with anyone."]})})},e[0]=n,e[1]=i,e[2]=l):l=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(er,{children:"Share static notebook"}),e[3]=c):c=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsxs(ks,{children:[c,u.jsxs(Ss,{children:["You can publish a static, non-interactive version of this notebook to the public web. We will create a link for you that lives on"," ",u.jsx("a",{href:wa,target:"_blank",children:wa}),"."]})]}),e[4]=d):d=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(h=x=>{const v=x.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,"");r(v)},e[5]=h):h=e[5],e[6]!==o?(f=u.jsx(tr,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:h,required:!0,autoComplete:"off"}),e[6]=o,e[7]=f):f=e[7],e[8]!==a?(p=u.jsxs("div",{className:"font-semibold text-sm text-muted-foreground gap-2 flex flex-col",children:["Anyone will be able to access your notebook at this URL:",u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(qS,{text:a}),u.jsx("span",{className:"text-primary",children:a})]})]}),e[8]=a,e[9]=p):p=e[9],e[10]!==f||e[11]!==p?(_=u.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[f,p]}),e[10]=f,e[11]=p,e[12]=_):_=e[12],e[13]!==n?(g=u.jsx(Te,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),e[13]=n,e[14]=g):g=e[14],e[15]!==a?(m=u.jsx(Te,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await pn(a)},children:"Create"}),e[15]=a,e[16]=m):m=e[16],e[17]!==m||e[18]!==g?(b=u.jsxs(Vi,{children:[g,m]}),e[17]=m,e[18]=g,e[19]=b):b=e[19],e[20]!==b||e[21]!==l||e[22]!==_?(y=u.jsx(nr,{className:"w-fit",children:u.jsxs("form",{onSubmit:l,children:[d,_,b]})}),e[20]=b,e[21]=l,e[22]=_,e[23]=y):y=e[23],y},qS=t=>{const e=X.c(8),[n,o]=K.useState(!1);let r;e[0]!==t.text?(r=Pn.stopPropagation(async c=>{c.preventDefault(),await pn(t.text),o(!0),setTimeout(()=>o(!1),2e3)}),e[0]=t.text,e[1]=r):r=e[1];const s=r;let i,a,l;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx($i,{size:14,strokeWidth:1.5}),e[2]=i):i=e[2],e[3]!==s?(a=u.jsx(Te,{"data-testid":"copy-static-notebook-url-button",onClick:s,size:"xs",variant:"secondary",children:i}),e[3]=s,e[4]=a):a=e[4],e[5]!==n||e[6]!==a?(l=u.jsx(Ae,{content:"Copied!",open:n,children:a}),e[5]=n,e[6]=a,e[7]=l):l=e[7],l};function Wm(){const t=X.c(2),e=Kt(Kf);let n;return t[0]!==e?(n=()=>{const o=document.getElementsByClassName("output-area"),r=window.innerHeight||document.documentElement.clientHeight;let s;s=null;for(const i of Array.from(o)){const a=i.getBoundingClientRect();if(a.top>=0&&a.top<=r||a.bottom>=0&&a.bottom<=r){s=Cs.parse(i.parentNode.id);break}}e(i=>({mode:_z(i.mode),cellAnchor:s})),requestAnimationFrame(()=>{var i;s!==null&&((i=document.getElementById(Cs.create(s)))==null||i.scrollIntoView())})},t[0]=e,t[1]=n):n=t[1],n}function nd(t){const e=X.c(3),n=od();let o;return e[0]!==t||e[1]!==n?(o=()=>{t!==void 0&&n([t])},e[0]=t,e[1]=n,e[2]=o):o=e[2],Xe(o)}function qm(){const t=X.c(2),e=od();let n;return t[0]!==e?(n=()=>e(A3(Ln())),t[0]=e,t[1]=n):n=t[1],Xe(n)}function od(){const t=X.c(2),{prepareForRun:e}=kt();let n;return t[0]!==e?(n=async o=>{var a,l;if(o.length===0)return;const{cellHandles:r,cellData:s}=Ln(),i=[];for(const c of o){const d=r[c],h=(a=d==null?void 0:d.current)==null?void 0:a.editorView;let f;h?(T3(h)!=="markdown"&&Xf(h),f=M3(h)):f=((l=s[c])==null?void 0:l.code)||"",i.push(f),e({cellId:c})}await yz({cellIds:o,codes:i}).catch(GS)},t[0]=e,t[1]=n):n=t[1],Xe(n)}function GS(t){It.error(t)}const rd=[{type:"files",Icon:fm,tooltip:"View files",position:"sidebar"},{type:"variables",Icon:Yl,tooltip:"Explore variables",position:"sidebar"},{type:"datasources",Icon:or,tooltip:"Explore data sources",position:"sidebar"},{type:"dependencies",Icon:_a,tooltip:"Explore dependencies",position:"sidebar"},{type:"packages",Icon:$s,tooltip:"Manage packages",position:"sidebar"},{type:"outline",Icon:Qc,tooltip:"View outline",position:"sidebar"},{type:"chat",Icon:Jl,tooltip:"Chat with AI",position:"sidebar"},{type:"documentation",Icon:ed,tooltip:"View live docs",position:"sidebar"},{type:"logs",Icon:Zf,tooltip:"Notebook logs",position:"sidebar"},{type:"tracing",Icon:oH,tooltip:"Tracing",position:"sidebar"},{type:"snippets",Icon:Rm,tooltip:"Snippets",position:"sidebar"},{type:"secrets",Icon:bm,tooltip:"Secrets",hidden:xn(),position:"sidebar"},{type:"scratchpad",Icon:xz,tooltip:"Scratchpad",position:"sidebar"},{type:"errors",Icon:Qf,tooltip:"View errors",position:"footer"}];function YS(){const t=X.c(7);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0];const[n,o]=function(i,a){const l=X.c(11);let c;l[0]!==a?(c=new wz(a),l[0]=a,l[1]=c):c=l[1];const d=c;let h;l[2]!==i||l[3]!==d?(h=()=>d.get(i),l[2]=i,l[3]=d,l[4]=h):h=l[4];const[f,p]=T.useState(h);let _;l[5]!==i||l[6]!==d?(_=b=>{p(b),d.set(i,b)},l[5]=i,l[6]=d,l[7]=_):_=l[7];const g=_;let m;return l[8]!==g||l[9]!==f?(m=[f,g],l[8]=g,l[9]=f,l[10]=m):m=l[10],m}("marimo:commands",e);let r,s;return t[1]!==n||t[2]!==o?(r=i=>{const a=(l=[i,...n],[...new Set(l)]);var l;o(a.slice(0,3))},t[1]=n,t[2]=o,t[3]=r):r=t[3],t[4]!==n||t[5]!==r?(s={recentCommands:n,addRecentCommand:r},t[4]=n,t[5]=r,t[6]=s):s=t[6],s}function Gm(t){return t.dropdown!==void 0}function va(t,e=""){return t.flatMap(n=>n.label?Gm(n)?va(n.dropdown,`${e+n.label} > `):{...n,label:e+n.label}:[])}const qs=t=>{const e=X.c(8),{children:n,layerTop:o}=t,r=o!==void 0&&o;let s;e[0]!==n?(s=K.Children.toArray(n),e[0]=n,e[1]=s):s=e[1];const[i,a]=s,l=`second-icon absolute ${r?"top-[-2px] left-[-2px]":"bottom-[-2px] right-[-2px]"} rounded-full`;let c,d;return e[2]!==a||e[3]!==l?(c=u.jsx("div",{className:l,children:a}),e[2]=a,e[3]=l,e[4]=c):c=e[4],e[5]!==i||e[6]!==c?(d=u.jsxs("div",{className:"multi-icon relative w-fit",children:[i,c]}),e[5]=i,e[6]=c,e[7]=d):d=e[7],d},ka=Ht(null),JS=Ht(!1),sd=R3("marimo:ai:chatState:v2",{chats:[],activeChatId:null}),KS=Ht(t=>{const e=t(sd);return e.chats.find(n=>n.id===e.activeChatId)},(t,e,n)=>{e(sd,o=>({...o,activeChatId:n}))});function Ym(t){return t!==P3&&!!(t&&t.trim().length>0)}const id=t=>{const e=X.c(7);let n,o;e[0]!==t?(n=a=>{var l;(a.ctrlKey||a.metaKey)&&a.key==="z"&&(a.preventDefault(),a.stopPropagation(),(l=t.onClick)==null||l.call(t,a))},e[0]=t,e[1]=n):n=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(o={capture:!0},e[2]=o):o=e[2],ep(window,"keydown",n,o);const r=t.children??"Undo";let s,i;return e[3]===Symbol.for("react.memo_cache_sentinel")?(s=u.jsx(vz,{className:"ml-2",shortcut:"cmd-z"}),e[3]=s):s=e[3],e[4]!==r||e[5]!==t?(i=u.jsxs(Te,{"data-testid":"undo-button",size:"sm",variant:"outline",...t,children:[r," ",s]}),e[4]=r,e[5]=t,e[6]=i):i=e[6],i};function ad(){const t=X.c(3),{deleteCell:e,undoDeleteCell:n}=kt();let o;return t[0]!==e||t[1]!==n?(o=r=>{var l;if(ct.get(L3))return;const{cellId:s}=r,i=ct.get(tp),a=(((l=i.cellData[s])==null?void 0:l.code)??"").trim()==="";if(e({cellId:s}),kz({cellId:s}).catch(()=>{n()}),!a){const{dismiss:c}=ut({title:"Cell deleted",description:"You can bring it back by clicking undo or through the command palette.",action:u.jsx(id,{"data-testid":"undo-delete-button",onClick:()=>{n(),d()}})}),d=c}},t[0]=e,t[1]=n,t[2]=o):o=t[2],Xe(o)}function Jm(){const t=X.c(3),{splitCell:e,undoSplitCell:n}=kt();let o;return t[0]!==e||t[1]!==n?(o=r=>{const s=Kl(r.cellId);if(!s)return;const i=M3(s);e(r);const{dismiss:a}=ut({title:"Cell split",action:u.jsx(id,{"data-testid":"undo-split-button",size:"sm",variant:"outline",onClick:()=>{n({...r,snapshot:i}),l()},children:"Undo"})}),l=a},t[0]=e,t[1]=n,t[2]=o):o=t[2],Xe(o)}function ld(t){const e=X.c(49),{cell:n}=t,{createNewCell:o,updateCellConfig:r,updateCellName:s,moveCell:i,sendToTop:a,sendToBottom:l,addColumnBreakpoint:c,clearCellOutput:d}=kt(),h=Jm(),f=nd(n==null?void 0:n.cellId),p=!Be(L3),_=ad(),{openModal:g}=Fn(),m=Kt(ka),b=Be(Xl),y=Be(Hi),x=Be(Ns),v=Be(Sz);if(!n||x){let j;return e[0]===Symbol.for("react.memo_cache_sentinel")?(j=[],e[0]=j):j=e[0],j}const{cellId:C,config:k,getEditorView:E,name:N,hasOutput:I,hasConsoleOutput:A,status:M}=n;let R;e[1]!==C||e[2]!==k.disabled||e[3]!==r?(R=async()=>{const j={disabled:!k.disabled};await Ir({configs:{[C]:j}}),r({cellId:C,config:j})},e[1]=C,e[2]=k.disabled,e[3]=r,e[4]=R):R=e[4];const z=R;let D;e[5]!==C||e[6]!==k.hide_code||e[7]!==E||e[8]!==r?(D=async()=>{const j={hide_code:!k.hide_code};await Ir({configs:{[C]:j}}),r({cellId:C,config:j});const W=E();W&&(j.hide_code?W.contentDOM.blur():W.focus())},e[5]=C,e[6]=k.hide_code,e[7]=E,e[8]=r,e[9]=D):D=e[9];const F=D;let B,U,O,S,$;return e[10]===Symbol.for("react.memo_cache_sentinel")?(B=u.jsx(Um,{size:13,strokeWidth:1.5}),e[10]=B):B=e[10],e[11]!==C||e[12]!==N||e[13]!==g||e[14]!==s?(U=()=>{g(u.jsxs(nr,{children:[u.jsx(ks,{children:u.jsx(er,{children:"Rename cell"})}),u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx(Ar,{htmlFor:"cell-name",children:"Cell name"}),u.jsx(jS,{placeholder:"cell name",value:N,onKeyDown:j=>{j.key==="Enter"&&(j.preventDefault(),j.stopPropagation(),g(null))},onChange:j=>s({cellId:C,name:j})})]})]}))},e[11]=C,e[12]=N,e[13]=g,e[14]=s,e[15]=U):U=e[15],e[16]!==C||e[17]!==s?(O=j=>s({cellId:C,name:j}),e[16]=C,e[17]=s,e[18]=O):O=e[18],e[19]!==N||e[20]!==O?(S=u.jsx(jS,{placeholder:"cell name",value:N,onChange:O}),e[19]=N,e[20]=O,e[21]=S):S=e[21],e[22]!==c||e[23]!==b||e[24]!==v||e[25]!==y||e[26]!==p||e[27]!==C||e[28]!==d||e[29]!==k.disabled||e[30]!==k.hide_code||e[31]!==o||e[32]!==_||e[33]!==E||e[34]!==A||e[35]!==I||e[36]!==i||e[37]!==N||e[38]!==f||e[39]!==l||e[40]!==a||e[41]!==m||e[42]!==h||e[43]!==M||e[44]!==U||e[45]!==S||e[46]!==z||e[47]!==F?($=[[{icon:B,label:"Name",disableClick:!0,handle:eC,handleHeadless:U,rightElement:S},{icon:u.jsx(Hs,{size:13,strokeWidth:1.5}),label:"Run cell",hotkey:"cell.run",hidden:M==="running"||M==="queued"||M==="disabled-transitively"||k.disabled,handle:()=>f()},{icon:u.jsx(Wi,{size:13,strokeWidth:1.5}),label:"AI completion",hidden:!b,handle:()=>{m(j=>(j==null?void 0:j.cellId)===C?null:{cellId:C})},hotkey:"cell.aiCompletion"},{icon:u.jsx(Zc,{size:13,strokeWidth:1.5}),label:"Split cell",hotkey:"cell.splitCell",handle:()=>h({cellId:C})},{icon:u.jsx(Yp,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!I,handle:()=>function(j){const W=document.getElementById(O3.create(j));W&&(W.classList.add("printing-output"),D3(W,"result.png").finally(()=>{W.classList.remove("printing-output")}))}(C)},{icon:u.jsx(Nz,{size:13,strokeWidth:1.5}),label:"Format cell",hotkey:"cell.format",handle:()=>{const j=E();j&&Cz({[C]:j})}},{icon:k.hide_code?u.jsx(F3,{size:13,strokeWidth:1.5}):u.jsx(z3,{size:13,strokeWidth:1.5}),label:k.hide_code?"Show code":"Hide code",handle:F,hotkey:"cell.hideCode"},{icon:k.disabled?u.jsx(hr,{size:13,strokeWidth:1.5}):u.jsx(fr,{size:13,strokeWidth:1.5}),label:"Reactive execution",rightElement:u.jsx(jz,{"data-testid":"cell-disable-switch",checked:!k.disabled,size:"sm",onCheckedChange:z}),handle:z},{icon:u.jsx(Qf,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(I||A),handle:()=>{d({cellId:C})}}],[{icon:u.jsx(Zl,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:()=>{const j=E();j&&(ao(y,o),Er(j,"markdown",{keepCodeAsIs:!1}))}},{icon:u.jsx(or,{size:13,strokeWidth:1.5}),label:"Convert to SQL",handle:()=>{const j=E();j&&(ao(y,o),Er(j,"sql",{keepCodeAsIs:!1}))}},{icon:u.jsx(Ql,{}),label:"Toggle as Python",handle:()=>{const j=E();j&&(ao(y,o),Ez(j,"python",{force:!0}))}}],[{icon:u.jsxs(qs,{children:[u.jsx(pa,{size:13,strokeWidth:1.5}),u.jsx(B3,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>o({cellId:C,before:!0})},{icon:u.jsxs(qs,{children:[u.jsx(pa,{size:13,strokeWidth:1.5}),u.jsx(js,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>o({cellId:C,before:!1})},{icon:u.jsx(B3,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>i({cellId:C,before:!0})},{icon:u.jsx(js,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>i({cellId:C,before:!1})},{icon:u.jsx(U3,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>i({cellId:C,direction:"left"}),hidden:v!=="columns"},{icon:u.jsx(qi,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>i({cellId:C,direction:"right"}),hidden:v!=="columns"},{icon:u.jsx(nm,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>a({cellId:C})},{icon:u.jsx(tm,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>l({cellId:C})},{icon:u.jsx(Iz,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",hidden:v!=="columns",handle:()=>c({cellId:C})}],[{icon:u.jsx(wS,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!Ym(N),tooltip:Ym(N)?void 0:"Only named cells can be linked to",handle:async()=>{await pn(function(j){const W=new URL(window.location.href);return W.hash=`scrollTo=${encodeURIComponent(j)}`,W.toString()}(N)),ut({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!p,variant:"danger",icon:u.jsx(np,{size:13,strokeWidth:1.5}),handle:()=>{_({cellId:C})}}]].map(ZS).filter(XS),e[22]=c,e[23]=b,e[24]=v,e[25]=y,e[26]=p,e[27]=C,e[28]=d,e[29]=k.disabled,e[30]=k.hide_code,e[31]=o,e[32]=_,e[33]=E,e[34]=A,e[35]=I,e[36]=i,e[37]=N,e[38]=f,e[39]=l,e[40]=a,e[41]=m,e[42]=h,e[43]=M,e[44]=U,e[45]=S,e[46]=z,e[47]=F,e[48]=$):$=e[48],$}function XS(t){return t.length>0}function ZS(t){return t.filter(QS)}function QS(t){return!t.hidden}function eC(t){t==null||t.stopPropagation(),t==null||t.preventDefault()}function tC(t){return!t.hidden}const cd=Ht(!1),Km=()=>{const t=X.c(37),[e,n]=tn(cd),o=Tz(),r=Be(Mz),s=Be(op);let i;t[0]!==r?(i={cell:r},t[0]=r,t[1]=i):i=t[1];let a=ld(i).flat();a=va(a);const l=function(){const O=X.c(61),[S,$]=Tr(),[j,W]=V3();let Y;O[0]!==$?(Y=async ee=>{await Mr({config:ee}).then(()=>{$(ee)})},O[0]=$,O[1]=Y):Y=O[1];const G=Y;let q;O[2]!==W?(q=async ee=>{await Az({config:ee}).then(()=>{W(ee)})},O[2]=W,O[3]=q):q=O[3];const te=q;let re;if(O[4]!==j||O[5]!==S||O[6]!==te||O[7]!==G){let ee,ue,me,de,fe;O[9]!==j?(ee=De=>De!==j.width,O[9]=j,O[10]=ee):ee=O[10],O[11]!==j||O[12]!==te?(ue=De=>({label:`App config > Set width=${De}`,handle:()=>{te({...j,width:De})}}),O[11]=j,O[12]=te,O[13]=ue):ue=O[13],O[14]!==S||O[15]!==G?(me={label:"Config > Set theme: dark",handle:()=>{G({...S,display:{...S.display,theme:"dark"}})}},O[14]=S,O[15]=G,O[16]=me):me=O[16],O[17]!==S||O[18]!==G?(de={label:"Config > Set theme: light",handle:()=>{G({...S,display:{...S.display,theme:"light"}})}},O[17]=S,O[18]=G,O[19]=de):de=O[19],O[20]!==S||O[21]!==G?(fe={label:"Config > Set theme: system",handle:()=>{G({...S,display:{...S.display,theme:"system"}})}},O[20]=S,O[21]=G,O[22]=fe):fe=O[22];const he=S.keymap.preset==="vim";let Ce,Ee;O[23]!==S||O[24]!==G?(Ce=()=>{G({...S,keymap:{...S.keymap,preset:"vim"}})},O[23]=S,O[24]=G,O[25]=Ce):Ce=O[25],O[26]!==he||O[27]!==Ce?(Ee={label:"Config > Switch keymap to VIM",hidden:he,handle:Ce},O[26]=he,O[27]=Ce,O[28]=Ee):Ee=O[28];const ae=S.keymap.preset==="default";let Me,xe,Re;O[29]!==S||O[30]!==G?(Me=()=>{G({...S,keymap:{...S.keymap,preset:"default"}})},O[29]=S,O[30]=G,O[31]=Me):Me=O[31],O[32]!==ae||O[33]!==Me?(xe={label:"Config > Switch keymap to default (current: VIM)",hidden:ae,handle:Me},O[32]=ae,O[33]=Me,O[34]=xe):xe=O[34],O[35]!==S||O[36]!==G?(Re=()=>{G({...S,completion:{...S.completion,copilot:!1}})},O[35]=S,O[36]=G,O[37]=Re):Re=O[37];const Ue=S.completion.copilot!=="github";let Je,Ke;O[38]!==Re||O[39]!==Ue?(Je={label:"Config > Disable GitHub Copilot",handle:Re,hidden:Ue},O[38]=Re,O[39]=Ue,O[40]=Je):Je=O[40],O[41]!==S||O[42]!==G?(Ke=()=>{G({...S,completion:{...S.completion,copilot:"github"}})},O[41]=S,O[42]=G,O[43]=Ke):Ke=O[43];const Pe=S.completion.copilot==="github";let st;O[44]!==Ke||O[45]!==Pe?(st={label:"Config > Enable GitHub Copilot",handle:Ke,hidden:Pe},O[44]=Ke,O[45]=Pe,O[46]=st):st=O[46];const et=!S.display.reference_highlighting;let nt,ne,ve,Se;O[47]!==S||O[48]!==G?(nt=()=>{G({...S,display:{...S.display,reference_highlighting:!1}})},O[47]=S,O[48]=G,O[49]=nt):nt=O[49],O[50]!==et||O[51]!==nt?(ne={label:"Config > Disable reference highlighting",hidden:et,handle:nt},O[50]=et,O[51]=nt,O[52]=ne):ne=O[52],O[53]!==S||O[54]!==G?(ve=()=>{G({...S,display:{...S.display,reference_highlighting:!0}})},O[53]=S,O[54]=G,O[55]=ve):ve=O[55],O[56]!==S.display.reference_highlighting||O[57]!==ve?(Se={label:"Config > Enable reference highlighting",hidden:S.display.reference_highlighting,handle:ve},O[56]=S.display.reference_highlighting,O[57]=ve,O[58]=Se):Se=O[58],re=[...rH().filter(ee).map(ue),me,de,fe,Ee,xe,Je,st,ne,Se],O[4]=j,O[5]=S,O[6]=te,O[7]=G,O[8]=re}else re=O[8];const ie=re;let Z;return O[59]!==ie?(Z=ie.filter(tC),O[59]=ie,O[60]=Z):Z=O[60],Z}();let c=Ng();c=[...va(c),...va(l)];const d=c.filter(nC),h=ec.keyBy(d,oC),{recentCommands:f,addRecentCommand:p}=YS();let _;t[2]!==f?(_=new Set(f),t[2]=f,t[3]=_):_=t[3];const g=_;let m,b;t[4]!==s||t[5]!==n?(m=O=>{Rz(s.getHotkey("global.commandPalette").key)(O)&&(O.preventDefault(),n(rC))},t[4]=s,t[5]=n,t[6]=m):m=t[6],ep(document,"keydown",m),t[7]!==p||t[8]!==s||t[9]!==o||t[10]!==n?(b=(O,S)=>{const $=o[O];if(!$)return null;const j=s.getHotkey(O);return u.jsxs(lo,{disabled:S.disabled,onSelect:()=>{p(O),n(!1),requestAnimationFrame(()=>{$()})},value:j.name,children:[u.jsxs("span",{children:[j.name,S.tooltip&&u.jsx("span",{className:"ml-2",children:S.tooltip})]}),u.jsx(H3,{children:u.jsx(ip,{shortcut:j.key})})]},O)},t[7]=p,t[8]=s,t[9]=o,t[10]=n,t[11]=b):b=t[11];const y=b;let x;t[12]!==p||t[13]!==s||t[14]!==n?(x=(O,S,$,j)=>{const W=$===void 0?{}:$;return u.jsxs(lo,{disabled:W.disabled,onSelect:()=>{p(O),n(!1),requestAnimationFrame(()=>{S()})},value:O,children:[u.jsxs("span",{children:[O,W.tooltip&&u.jsxs("span",{className:"ml-2",children:["(",W.tooltip,")"]})]}),j&&u.jsx(H3,{children:u.jsx(ip,{shortcut:s.getHotkey(j).key})})]},O)},t[12]=p,t[13]=s,t[14]=n,t[15]=x):x=t[15];const v=x,C=Dz;let k;t[16]===Symbol.for("react.memo_cache_sentinel")?(k=u.jsx(Gi,{placeholder:"Type to search..."}),t[16]=k):k=t[16];const E=sp;let N;t[17]===Symbol.for("react.memo_cache_sentinel")?(N=u.jsx(tc,{children:"No results found."}),t[17]=N):N=t[17];const I=f.length>0&&u.jsxs(u.Fragment,{children:[u.jsx(rp,{heading:"Recently Used",children:f.map(O=>{const S=h[O];return Oz(O)?y(O,{disabled:S==null?void 0:S.disabled,tooltip:S==null?void 0:S.tooltip}):S&&!Gm(S)?v(S.label,S.handleHeadless||S.handle,{disabled:S.disabled,tooltip:S.tooltip}):null})}),u.jsx($3,{})]}),A=rp,M=s.iterate().map(O=>{if(g.has(O))return null;const S=h[O];return y(O,{disabled:S==null?void 0:S.disabled,tooltip:S==null?void 0:S.tooltip})}),R=d.map(O=>g.has(O.label)?null:v(O.label,O.handleHeadless||O.handle,{disabled:O.disabled,tooltip:O.tooltip}));let z;t[18]!==g||t[19]!==v?(z=O=>g.has(O.label)?null:v(`Cell > ${O.label}`,O.handleHeadless||O.handle,{disabled:O.disabled,tooltip:O.tooltip}),t[18]=g,t[19]=v,t[20]=z):z=t[20];const D=a.map(z);let F,B,U;return t[21]!==A||t[22]!==R||t[23]!==D||t[24]!==M?(F=u.jsxs(A,{heading:"Commands",children:[M,R,D]}),t[21]=A,t[22]=R,t[23]=D,t[24]=M,t[25]=F):F=t[25],t[26]!==E||t[27]!==F||t[28]!==N||t[29]!==I?(B=u.jsxs(E,{children:[N,I,F]}),t[26]=E,t[27]=F,t[28]=N,t[29]=I,t[30]=B):B=t[30],t[31]!==C||t[32]!==e||t[33]!==n||t[34]!==B||t[35]!==k?(U=u.jsxs(C,{open:e,onOpenChange:n,children:[k,B]}),t[31]=C,t[32]=e,t[33]=n,t[34]=B,t[35]=k,t[36]=U):U=t[36],U};function nC(t){return!t.hotkey}function oC(t){return t.label}function rC(t){return!t}function pr(){return ke.string().optional().describe(We.of({label:"Password",inputType:"password",placeholder:"password",optionRegex:".*password.*"}))}function Xm(){return ke.string().optional().describe(We.of({label:"Token",inputType:"password",placeholder:"token",optionRegex:".*token.*"}))}function Sa(){return ke.string().optional().describe(We.of({label:"Warehouse Name",placeholder:"warehouse",optionRegex:".*warehouse.*"}))}function Zm(){return ke.string().optional().describe(We.of({label:"URI",optionRegex:".*uri.*"}))}function mr(){return ke.string().nonempty().describe(We.of({label:"Host",placeholder:"localhost",optionRegex:".*host.*"}))}function ho(){return ke.string().describe(We.of({label:"Database",placeholder:"db name",optionRegex:".*database.*"}))}function gr(){return ke.string().nonempty().describe(We.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function _r(t){const e=ke.coerce.string().describe(We.of({label:"Port",inputType:"number",placeholder:t==null?void 0:t.toString()})).transform(Number).refine(n=>n>=0&&n<=65535,{message:"Port must be between 0 and 65535"});return t!==void 0?e.default(t.toString()):e}function Qm(){return ke.boolean().default(!1).describe(We.of({label:"Read Only"}))}const eg=ke.object({type:ke.literal("postgres"),host:mr(),port:_r(5432).optional(),database:ho(),username:gr(),password:pr(),ssl:ke.boolean().default(!1).describe(We.of({label:"Use SSL"}))}).describe(We.of({direction:"two-columns"})),tg=ke.object({type:ke.literal("mysql"),host:mr(),port:_r(3306),database:ho(),username:gr(),password:pr(),ssl:ke.boolean().default(!1).describe(We.of({label:"Use SSL"}))}).describe(We.of({direction:"two-columns"})),ng=ke.object({type:ke.literal("sqlite"),database:ho().describe(We.of({label:"Database Path"}))}).describe(We.of({direction:"two-columns"})),og=ke.object({type:ke.literal("duckdb"),database:ho().describe(We.of({label:"Database Path"})),read_only:Qm()}).describe(We.of({direction:"two-columns"})),rg=ke.object({type:ke.literal("motherduck"),database:ho().default("my_db").describe(We.of({label:"Database Name"})),token:Xm()}).describe(We.of({direction:"two-columns"})),sg=ke.object({type:ke.literal("snowflake"),account:ke.string().nonempty().describe(We.of({label:"Account",optionRegex:".*snowflake.*"})),warehouse:ke.string().optional().describe(We.of({label:"Warehouse",optionRegex:".*snowflake.*"})),database:ho(),schema:ke.string().optional().describe(We.of({label:"Schema",optionRegex:".*snowflake.*"})),username:gr(),password:pr(),role:ke.string().optional().describe(We.of({label:"Role"}))}).describe(We.of({direction:"two-columns"})),ig=ke.object({type:ke.literal("bigquery"),project:ke.string().nonempty().describe(We.of({label:"Project ID",optionRegex:".*bigquery.*"})),dataset:ke.string().nonempty().describe(We.of({label:"Dataset",optionRegex:".*bigquery.*"})),credentials_json:ke.string().describe(We.of({label:"Credentials JSON",inputType:"textarea"}))}).describe(We.of({direction:"two-columns"})),ag=ke.object({type:ke.literal("clickhouse_connect"),host:mr(),port:_r(8123).optional(),username:gr(),password:pr(),secure:ke.boolean().default(!1).describe(We.of({label:"Use HTTPs"}))}).describe(We.of({direction:"two-columns"})),lg=ke.object({type:ke.literal("timeplus"),host:mr().default("localhost"),port:_r(8123).optional(),username:gr().default("default"),password:pr().default("")}).describe(We.of({direction:"two-columns"})),cg=ke.object({type:ke.literal("chdb"),database:ho().describe(We.of({label:"Database Path"})),read_only:Qm()}).describe(We.of({direction:"two-columns"})),dg=ke.object({type:ke.literal("trino"),host:mr(),port:_r(8080),database:ho(),schema:ke.string().describe(We.of({label:"Schema",placeholder:"schema name",optionRegex:".*schema.*"})).optional(),username:gr(),password:pr(),async_support:ke.boolean().default(!1).describe(We.of({label:"Async Support"}))}).describe(We.of({direction:"two-columns"})),ug=ke.object({type:ke.literal("iceberg"),name:ke.string().describe(We.of({label:"Catalog Name"})),catalog:ke.discriminatedUnion("type",[ke.object({type:ke.literal("REST"),warehouse:Sa(),uri:ke.string().optional().describe(We.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:Xm()}),ke.object({type:ke.literal("SQL"),warehouse:Sa(),uri:ke.string().optional().describe(We.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),ke.object({type:ke.literal("Hive"),warehouse:Sa(),uri:Zm()}),ke.object({type:ke.literal("Glue"),warehouse:Sa(),uri:Zm()}),ke.object({type:ke.literal("DynamoDB"),"dynamodb.profile-name":ke.string().optional().describe(We.of({label:"Profile Name"})),"dynamodb.region":ke.string().optional().describe(We.of({label:"Region"})),"dynamodb.access-key-id":ke.string().optional().describe(We.of({label:"Access Key ID"})),"dynamodb.secret-access-key":ke.string().optional().describe(We.of({label:"Secret Access Key",inputType:"password"})),"dynamodb.session-token":ke.string().optional().describe(We.of({label:"Session Token",inputType:"password"}))})]).default({type:"REST"}).describe(We.of({special:"tabs"}))}),hg=ke.object({type:ke.literal("datafusion"),sessionContext:ke.boolean().optional().describe(We.of({label:"Use Session Context"}))}),fg=ke.object({type:ke.literal("pyspark"),host:mr().optional(),port:_r().optional()}),pg=ke.object({type:ke.literal("redshift"),host:mr(),port:_r(5439),connectionType:ke.discriminatedUnion("type",[ke.object({type:ke.literal("IAM credentials"),region:ke.string().describe(We.of({label:"Region"})),aws_access_key_id:ke.string().nonempty().describe(We.of({label:"AWS Access Key ID",inputType:"password",optionRegex:".*aws_access_key_id.*"})),aws_secret_access_key:ke.string().nonempty().describe(We.of({label:"AWS Secret Access Key",inputType:"password",optionRegex:".*aws_secret_access_key.*"})),aws_session_token:ke.string().optional().describe(We.of({label:"AWS Session Token",inputType:"password",optionRegex:".*aws_session_token.*"}))}),ke.object({type:ke.literal("DB credentials"),user:gr(),password:pr()})]).default({type:"IAM credentials",aws_access_key_id:"",aws_secret_access_key:"",region:""}),database:ho()}).describe(We.of({direction:"two-columns"})),sC=ke.discriminatedUnion("type",[eg,tg,ng,og,rg,sg,ig,ag,lg,cg,dg,ug,hg,fg,pg]),dd="env:";function Ca(t){return typeof t=="string"&&t.startsWith(dd)}function ud(t){return`${dd}${t}`}const mg={sqlmodel:"SQLModel",sqlalchemy:"SQLAlchemy",duckdb:"DuckDB",clickhouse_connect:"ClickHouse Connect",chdb:"chDB",pyiceberg:"PyIceberg",ibis:"Ibis",motherduck:"MotherDuck",redshift:"Redshift"};class on{constructor(e,n,o){this.connection=void 0,this.orm=void 0,this.secrets=void 0,this.connection=e,this.orm=n,this.secrets=o}get imports(){const e=new Set(this.generateImports());switch(this.orm){case"sqlalchemy":e.add("import sqlalchemy");break;case"sqlmodel":e.add("import sqlmodel");break;case"duckdb":e.add("import duckdb")}return e}}class iC{constructor(){this.secrets={}}get imports(){return Object.keys(this.secrets).length===0?new Set:new Set(["import os"])}print(e,n,o){if(e=(r=>`_${r}`)(e),Ca(n)){const r=n.replace(dd,""),s=o?`os.environ.get("${r}", "${o}")`:`os.environ.get("${r}")`;return this.secrets[e]=s,e}if(o!=null){const r=`os.environ.get("${n}", "${o}")`;return this.secrets[e]=r,e}return typeof n=="number"||typeof n=="number"?`${n}`:typeof n=="boolean"?zr(n):n?`"${n}"`:""}printInFString(e,n,o){if(n===void 0)return"";if(typeof n=="number")return`${n}`;if(typeof n=="boolean")return zr(n);const r=this.print(e,n,o);return r.startsWith('"')&&r.endsWith('"')?r.slice(1,-1):`{${r}}`}printPassword(e,n,o){const r=o?this.printInFString.bind(this):this.print.bind(this);return Ca(e)?r("password",e):r("password",n,e)}getSecrets(){return this.secrets}formatSecrets(){return Object.keys(this.secrets).length===0?"":Object.entries(this.secrets).map(([e,n])=>`${e} = ${n}`).join(`
|
3
3
|
`)}}class aC extends on{generateImports(){return[]}generateConnectionCode(){const e=this.connection.ssl?", connect_args={'sslmode': 'require'}":"",n=this.secrets.printPassword(this.connection.password,"POSTGRES_PASSWORD",!0),o=this.secrets.printInFString("username",this.connection.username),r=this.secrets.printInFString("host",this.connection.host),s=this.secrets.printInFString("port",this.connection.port),i=this.secrets.printInFString("database",this.connection.database);return xt(`
|
4
4
|
DATABASE_URL = f"postgresql://${o}:${n}@${r}:${s}/${i}"
|
5
5
|
engine = ${this.orm}.create_engine(DATABASE_URL${e})
|
@@ -115,7 +115,7 @@ ${p.codeBefore}
|
|
115
115
|
${p.selection}
|
116
116
|
</rewrite_this>
|
117
117
|
${p.codeAfter}
|
118
|
-
`.trim(),g=_4();await b4();const m=await fetch(g.getAiURL("completion").toString(),{method:"POST",headers:g.headers(),body:JSON.stringify({prompt:p.prompt,code:_,selectedText:p.selection,includeOtherCode:"",language:p.language})}),b=((v=p.selection.match(/^\s*/))==null?void 0:v[0])||"",y=(C=m.body)==null?void 0:C.getReader();if(!y)throw new Error("Failed to get response reader");let x="";for(;;){const{done:k,value:E}=await y.read();if(k)break;x+=new TextDecoder().decode(E)}return x.startsWith(b)||(x=b+x),x}({prompt:f.prompt,selection:f.selection,codeBefore:f.codeBefore,codeAfter:f.codeAfter,language:T3(f.editorView)})}):[],d5(ct),VB(e,c.reference_highlighting??!1)];var h},p5=t=>{const{theme:e,hotkeys:n,completionConfig:o,cellId:r,lspConfig:s,diagnosticsConfig:i}=t,a=A_(t);return[tt.lineWrapping,$B(),HB(),WB(),qB(),GB(),YB(),JB(),KB({position:"fixed",parent:document.querySelector("#App")??void 0}),XB(),e==="dark"?u5:h5,ZB(s),r5(o),QB(),eU(),uE(),Lo.high(Bn.of(iU)),tU(),nU(),oU.of(" "),v4(aU,{fallback:!0}),Bn.of(lU),rU({placeholderType:a,completionConfig:o,hotkeys:n,cellId:r,lspConfig:{...s,diagnostics:i}}),sU.of(cU()),sr.allowMultipleSelections.of(!0),s5(n),Bn.of([{key:"Tab",run:l=>w4(l)||(c=>{const{from:d,to:h}=c.state.selection.main;if(d!==h)return!1;const f=c.state.doc.lineAt(h);return f.text.slice(0,h-f.from).trim()!==""&&fU(c)})(l)||dU(l),preventDefault:!0},{key:n.getHotkey("completion.moveDown").key,run:l=>sa(l.state)!==null&&(wc(!0)(l),!0),preventDefault:!0},{key:n.getHotkey("completion.moveUp").key,run:l=>sa(l.state)!==null&&(wc(!1)(l),!0),preventDefault:!0}]),Bn.of([...uU,hU])]},m5={width:void 0,height:void 0};function T_(t,e,n){return t[e]?Array.isArray(t[e])?t[e][0][n]:t[e][n]:e==="contentBoxSize"?t.contentRect[n==="inlineSize"?"width":"height"]:void 0}function M_(t){const e=t.current;if(e===null)throw new ReferenceError("Attempting to dereference null object.");return e}let O_,D_,R_,P_;O_=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!0}),D_=new Intl.DateTimeFormat("en-US",{month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!0}),R_=t=>{const e=X.c(79),{editing:n,status:o,disabled:r,staleInputs:s,edited:i,interrupted:a,elapsedTime:l,runStartTimestamp:c,lastRunStartTimestamp:d,uninstantiated:h}=t;if(!n)return null;const f=c??d;let p;e[0]!==f?(p=f?u.jsx(P_,{lastRanTime:f}):null,e[0]=f,e[1]=p):p=e[1];const _=p;if(r&&o==="running")return It.error("CellStatusComponent: disabled and running"),null;if(r&&s){let g,m,b,y;return e[2]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("span",{children:"This cell is stale, but it's disabled and can't be run"}),e[2]=g):g=e[2],e[3]!==_?(m=u.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[3]=_,e[4]=m):m=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"stale",children:u.jsxs(qs,{children:[u.jsx(Ws,{className:"h-5 w-5",strokeWidth:1.5}),u.jsx(Cc,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[5]=b):b=e[5],e[6]!==m?(y=u.jsx(Ae,{content:m,usePortal:!0,children:b}),e[6]=m,e[7]=y):y=e[7],y}if(r){let g,m,b,y;return e[8]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("span",{children:"This cell is disabled"}),e[8]=g):g=e[8],e[9]!==_?(m=u.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[9]=_,e[10]=m):m=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx("div",{className:"cell-status-icon cell-status-disabled","data-testid":"cell-status","data-status":"disabled",children:u.jsx(Ws,{className:"h-5 w-5",strokeWidth:1.5})}),e[11]=b):b=e[11],e[12]!==m?(y=u.jsx(Ae,{content:m,usePortal:!0,children:b}),e[12]=m,e[13]=y):y=e[13],y}if(!s&&o==="disabled-transitively"){let g,m,b,y;return e[14]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("span",{children:"An ancestor of this cell is disabled, so it can't be run"}),e[14]=g):g=e[14],e[15]!==_?(m=u.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[15]=_,e[16]=m):m=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"disabled-transitively",children:u.jsxs(qs,{layerTop:!0,children:[u.jsx(ya,{className:"h-5 w-5",strokeWidth:1.5}),u.jsx(Ws,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[17]=b):b=e[17],e[18]!==m?(y=u.jsx(Ae,{content:m,usePortal:!0,children:b}),e[18]=m,e[19]=y):y=e[19],y}if(s&&o==="disabled-transitively"){let g,m,b,y;return e[20]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("span",{children:"This cell is stale, but an ancestor is disabled so it can't be run"}),e[20]=g):g=e[20],e[21]!==_?(m=u.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[21]=_,e[22]=m):m=e[22],e[23]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"stale",children:u.jsxs(qs,{children:[u.jsx(Cc,{className:"h-5 w-5",strokeWidth:1}),u.jsx(Ws,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[23]=b):b=e[23],e[24]!==m?(y=u.jsx(Ae,{content:m,usePortal:!0,children:b}),e[24]=m,e[25]=y):y=e[25],y}if(o==="running"){let g,m,b,y,x;return e[26]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("span",{children:"This cell is running"}),e[26]=g):g=e[26],e[27]!==_?(m=u.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[27]=_,e[28]=m):m=e[28],e[29]!==c?(b=Cp.fromSeconds(c)||Cp.now(),e[29]=c,e[30]=b):b=e[30],e[31]!==b?(y=u.jsx("div",{className:"cell-status-icon elapsed-time running","data-testid":"cell-status","data-status":"running",children:u.jsx(g5,{startTime:b})}),e[31]=b,e[32]=y):y=e[32],e[33]!==m||e[34]!==y?(x=u.jsx(Ae,{content:m,usePortal:!0,children:y}),e[33]=m,e[34]=y,e[35]=x):x=e[35],x}if(o==="queued"){let g,m,b,y;return e[36]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("span",{children:"This cell is queued to run"}),e[36]=g):g=e[36],e[37]!==_?(m=u.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[37]=_,e[38]=m):m=e[38],e[39]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx("div",{className:"cell-status-icon cell-status-queued","data-testid":"cell-status","data-status":"queued",children:u.jsx(RS,{className:"h-5 w-5",strokeWidth:1.5})}),e[39]=b):b=e[39],e[40]!==m?(y=u.jsx(Ae,{content:m,usePortal:!0,children:b}),e[40]=m,e[41]=y):y=e[41],y}if(i||a||s||h){let g;e[42]!==l?(g=fa(l),e[42]=l,e[43]=g):g=e[43];const m=g;let b;e[44]!==l||e[45]!==m?(b=l?u.jsx(Bc,{elapsedTime:m}):null,e[44]=l,e[45]=m,e[46]=b):b=e[46];const y=b;let x,v,C,k,E,N="";if(h)x="This cell has not yet been run";else if(a){let I;x="This cell was interrupted when it was last run",e[47]!==y?(I=u.jsxs("span",{children:["This cell ran for ",y," before being interrupted"]}),e[47]=y,e[48]=I):I=e[48],N=I}else if(i){let I;x="This cell has been modified since it was last run",e[49]!==y?(I=u.jsxs("span",{children:["This cell took ",y," to run"]}),e[49]=y,e[50]=I):I=e[50],N=I}else{let I;x="This cell has not been run with the latest inputs",e[51]!==y?(I=u.jsxs("span",{children:["This cell took ",y," to run"]}),e[51]=y,e[52]=I):I=e[52],N=I}return e[53]===Symbol.for("react.memo_cache_sentinel")?(v=u.jsx("div",{className:"cell-status-stale","data-testid":"cell-status","data-status":"outdated",children:u.jsx(Cc,{className:"h-5 w-5",strokeWidth:1.5})}),e[53]=v):v=e[53],e[54]!==x?(C=u.jsx(Ae,{content:x,usePortal:!0,children:v}),e[54]=x,e[55]=C):C=e[55],e[56]!==l||e[57]!==m||e[58]!==_||e[59]!==N?(k=l&&u.jsx(Ae,{content:u.jsxs("div",{className:"flex flex-col gap-1",children:[N,_]}),usePortal:!0,children:u.jsx("div",{className:"elapsed-time hover-action","data-testid":"cell-status","data-status":"outdated",children:u.jsx("span",{children:m})})}),e[56]=l,e[57]=m,e[58]=_,e[59]=N,e[60]=k):k=e[60],e[61]!==C||e[62]!==k?(E=u.jsxs("div",{className:"cell-status-icon flex items-center gap-2",children:[C,k]}),e[61]=C,e[62]=k,e[63]=E):E=e[63],E}if(l!==null){let g;e[64]!==l?(g=fa(l),e[64]=l,e[65]=g):g=e[65];const m=g;let b;e[66]!==l||e[67]!==m?(b=l?u.jsx(Bc,{elapsedTime:m}):null,e[66]=l,e[67]=m,e[68]=b):b=e[68];const y=b;let x,v,C,k;return e[69]!==y?(x=u.jsxs("span",{children:["This cell took ",y," to run"]}),e[69]=y,e[70]=x):x=e[70],e[71]!==_||e[72]!==x?(v=u.jsxs("div",{className:"flex flex-col gap-1",children:[x,_]}),e[71]=_,e[72]=x,e[73]=v):v=e[73],e[74]!==m?(C=u.jsx("div",{className:"cell-status-icon elapsed-time hover-action","data-testid":"cell-status","data-status":"idle",children:u.jsx("span",{children:m})}),e[74]=m,e[75]=C):C=e[75],e[76]!==v||e[77]!==C?(k=u.jsx(Ae,{content:v,usePortal:!0,children:C}),e[76]=v,e[77]=C,e[78]=k):k=e[78],k}return null},Bc=t=>{const e=X.c(2);let n;return e[0]!==t.elapsedTime?(n=u.jsx("span",{className:"tracking-wide font-semibold",children:t.elapsedTime}),e[0]=t.elapsedTime,e[1]=n):n=e[1],n},P_=t=>{const e=X.c(18),n=1e3*t.lastRanTime;let o,r,s,i,a,l,c,d,h;if(e[0]!==n){const f=new Date(n),p=new Date,_=f.toDateString()===p.toDateString()?O_:D_;i="Ran at",a=" ",l=u.jsx("strong",{className:"tracking-wide font-semibold",children:_.format(f)}),c=" ",o="text-muted-foreground",r="(",s=HS(f),e[0]=n,e[1]=o,e[2]=r,e[3]=s,e[4]=i,e[5]=a,e[6]=l,e[7]=c}else o=e[1],r=e[2],s=e[3],i=e[4],a=e[5],l=e[6],c=e[7];return e[8]!==o||e[9]!==r||e[10]!==s?(d=u.jsxs("span",{className:o,children:[r,s," ago)"]}),e[8]=o,e[9]=r,e[10]=s,e[11]=d):d=e[11],e[12]!==i||e[13]!==a||e[14]!==l||e[15]!==c||e[16]!==d?(h=u.jsxs("span",{children:[i,a,l,c,d]}),e[12]=i,e[13]=a,e[14]=l,e[15]=c,e[16]=d,e[17]=h):h=e[17],h},fa=function(t){if(t===null)return"";const e=t,n=e/1e3;return n>=60?`${Math.floor(n/60)}m${Math.floor(n%60)}s`:n>=1?`${n.toFixed(2).toString()}s`:`${e.toFixed(0).toString()}ms`};const g5=t=>{const e=X.c(6);let n;e[0]!==t.startTime?(n=t.startTime.toMilliseconds(),e[0]=t.startTime,e[1]=n):n=e[1];const o=function(i){const a=T.useRef(i),[l,c]=T.useState(i);return T.useEffect(()=>{const d=setInterval(()=>{c(Cp.now().toMilliseconds())},17);return()=>clearInterval(d)},[]),l-a.current}(n);let r,s;return e[2]!==o?(r=fa(o),e[2]=o,e[3]=r):r=e[3],e[4]!==r?(s=u.jsx("span",{children:r}),e[4]=r,e[5]=s):s=e[5],s};var fu="ContextMenu",[_5,KH]=S4(fu,[k4]),sn=k4(),[b5,L_]=_5(fu),F_=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:o,dir:r,modal:s=!0}=t,[i,a]=T.useState(!1),l=sn(e),c=ir(o),d=T.useCallback(h=>{a(h),c(h)},[c]);return u.jsx(b5,{scope:e,open:i,onOpenChange:d,modal:s,children:u.jsx(jU,{...l,dir:r,open:i,onOpenChange:d,modal:s,children:n})})};F_.displayName=fu;var z_="ContextMenuTrigger",B_=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:o=!1,...r}=t,s=L_(z_,n),i=sn(n),a=T.useRef({x:0,y:0}),l=T.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...a.current})}),c=T.useRef(0),d=T.useCallback(()=>window.clearTimeout(c.current),[]),h=f=>{a.current={x:f.clientX,y:f.clientY},s.onOpenChange(!0)};return T.useEffect(()=>d,[d]),T.useEffect(()=>{o&&d()},[o,d]),u.jsxs(u.Fragment,{children:[u.jsx(gU,{...i,virtualRef:l}),u.jsx(Fs.span,{"data-state":s.open?"open":"closed","data-disabled":o?"":void 0,...r,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:o?t.onContextMenu:Un(t.onContextMenu,f=>{d(),h(f),f.preventDefault()}),onPointerDown:o?t.onPointerDown:Un(t.onPointerDown,il(f=>{d(),c.current=window.setTimeout(()=>h(f),700)})),onPointerMove:o?t.onPointerMove:Un(t.onPointerMove,il(d)),onPointerCancel:o?t.onPointerCancel:Un(t.onPointerCancel,il(d)),onPointerUp:o?t.onPointerUp:Un(t.onPointerUp,il(d))})]})});B_.displayName=z_;var U_=t=>{const{__scopeContextMenu:e,...n}=t,o=sn(e);return u.jsx(EU,{...o,...n})};U_.displayName="ContextMenuPortal";var V_="ContextMenuContent",$_=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=L_(V_,n),s=sn(n),i=T.useRef(!1);return u.jsx(_U,{...s,...o,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:a=>{var l;(l=t.onCloseAutoFocus)==null||l.call(t,a),!a.defaultPrevented&&i.current&&a.preventDefault(),i.current=!1},onInteractOutside:a=>{var l;(l=t.onInteractOutside)==null||l.call(t,a),a.defaultPrevented||r.modal||(i.current=!0)},style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});$_.displayName=V_,T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=sn(n);return u.jsx(bU,{...r,...o,ref:e})}).displayName="ContextMenuGroup";var H_=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=sn(n);return u.jsx(yU,{...r,...o,ref:e})});H_.displayName="ContextMenuLabel";var W_=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=sn(n);return u.jsx(mU,{...r,...o,ref:e})});W_.displayName="ContextMenuItem";var q_=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=sn(n);return u.jsx(xU,{...r,...o,ref:e})});q_.displayName="ContextMenuCheckboxItem",T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=sn(n);return u.jsx(wU,{...r,...o,ref:e})}).displayName="ContextMenuRadioGroup";var G_=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=sn(n);return u.jsx(vU,{...r,...o,ref:e})});G_.displayName="ContextMenuRadioItem";var Y_=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=sn(n);return u.jsx(kU,{...r,...o,ref:e})});Y_.displayName="ContextMenuItemIndicator";var J_=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=sn(n);return u.jsx(pU,{...r,...o,ref:e})});J_.displayName="ContextMenuSeparator",T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=sn(n);return u.jsx(SU,{...r,...o,ref:e})}).displayName="ContextMenuArrow";var K_=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=sn(n);return u.jsx(CU,{...r,...o,ref:e})});K_.displayName="ContextMenuSubTrigger";var X_=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=sn(n);return u.jsx(NU,{...r,...o,ref:e,style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});function il(t){return e=>e.pointerType!=="mouse"?t(e):void 0}X_.displayName="ContextMenuSubContent";var Z_=$_,Q_=H_,e0=W_,t0=q_,n0=G_,o0=Y_,r0=J_,s0=K_,i0=X_;const a0=F_,l0=B_,y5=TU(U_);T.forwardRef((t,e)=>{const n=X.c(14);let o,r,s,i,a,l,c;return n[0]!==t?({className:r,inset:s,children:o,...i}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i):(o=n[1],r=n[2],s=n[3],i=n[4]),n[5]!==r||n[6]!==s?(a=MU({className:r,inset:s}),n[5]=r,n[6]=s,n[7]=a):a=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx(RU,{className:"ml-auto h-4 w-4"}),n[8]=l):l=n[8],n[9]!==o||n[10]!==i||n[11]!==e||n[12]!==a?(c=u.jsxs(s0,{ref:e,className:a,...i,children:[o,l]}),n[9]=o,n[10]=i,n[11]=e,n[12]=a,n[13]=c):c=n[13],c}).displayName=s0.displayName;const c0="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";T.forwardRef((t,e)=>{const n=X.c(9);let o,r,s,i;return n[0]!==t?({className:o,...r}=t,n[0]=t,n[1]=o,n[2]=r):(o=n[1],r=n[2]),n[3]!==o?(s=je(C4({subcontent:!0}),c0,o),n[3]=o,n[4]=s):s=n[4],n[5]!==r||n[6]!==e||n[7]!==s?(i=u.jsx(i0,{ref:e,className:s,...r}),n[5]=r,n[6]=e,n[7]=s,n[8]=i):i=n[8],i}).displayName=i0.displayName;const pu=T.forwardRef((t,e)=>{const n=X.c(15);let o,r,s;n[0]!==t?({className:o,scrollable:s,...r}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]);const i=s===void 0||s;let a;n[4]!==o||n[5]!==i?(a=je(C4(),c0,i&&"overflow-auto",o),n[4]=o,n[5]=i,n[6]=a):a=n[6];const l=i?"calc(var(--radix-context-menu-content-available-height) - 30px)":void 0;let c,d;return n[7]!==r.style||n[8]!==l?(c={...r.style,maxHeight:l},n[7]=r.style,n[8]=l,n[9]=c):c=n[9],n[10]!==r||n[11]!==e||n[12]!==a||n[13]!==c?(d=u.jsx(y5,{children:u.jsx(OU,{children:u.jsx(Z_,{ref:e,className:a,style:c,...r})})}),n[10]=r,n[11]=e,n[12]=a,n[13]=c,n[14]=d):d=n[14],d});pu.displayName=Z_.displayName;const pi=T.forwardRef((t,e)=>{const n=X.c(13);let o,r,s,i,a,l;return n[0]!==t?({className:o,inset:r,variant:i,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i):(o=n[1],r=n[2],s=n[3],i=n[4]),n[5]!==o||n[6]!==r||n[7]!==i?(a=AU({className:o,inset:r,variant:i}),n[5]=o,n[6]=r,n[7]=i,n[8]=a):a=n[8],n[9]!==s||n[10]!==e||n[11]!==a?(l=u.jsx(e0,{ref:e,className:a,...s}),n[9]=s,n[10]=e,n[11]=a,n[12]=l):l=n[12],l});pi.displayName=e0.displayName,T.forwardRef((t,e)=>{const n=X.c(15);let o,r,s,i,a,l,c,d;return n[0]!==t?({className:s,children:r,checked:o,...i}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i):(o=n[1],r=n[2],s=n[3],i=n[4]),n[5]!==s?(a=Nc({className:s}),n[5]=s,n[6]=a):a=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(l=Nc(),n[7]=l):l=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx("span",{className:l,children:u.jsx(o0,{children:u.jsx(PU,{className:"h-4 w-4"})})}),n[8]=c):c=n[8],n[9]!==o||n[10]!==r||n[11]!==i||n[12]!==e||n[13]!==a?(d=u.jsxs(t0,{ref:e,className:a,checked:o,...i,children:[c,r]}),n[9]=o,n[10]=r,n[11]=i,n[12]=e,n[13]=a,n[14]=d):d=n[14],d}).displayName=t0.displayName,T.forwardRef((t,e)=>{const n=X.c(13);let o,r,s,i,a,l,c;return n[0]!==t?({className:r,children:o,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]),n[4]!==r?(i=Nc({className:r}),n[4]=r,n[5]=i):i=n[5],n[6]===Symbol.for("react.memo_cache_sentinel")?(a=Nc(),n[6]=a):a=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx("span",{className:a,children:u.jsx(o0,{children:u.jsx(LU,{className:"h-4 w-4 fill-current"})})}),n[7]=l):l=n[7],n[8]!==o||n[9]!==s||n[10]!==e||n[11]!==i?(c=u.jsxs(n0,{ref:e,className:i,...s,children:[l,o]}),n[8]=o,n[9]=s,n[10]=e,n[11]=i,n[12]=c):c=n[12],c}).displayName=n0.displayName,T.forwardRef((t,e)=>{const n=X.c(11);let o,r,s,i,a;return n[0]!==t?({className:o,inset:r,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]),n[4]!==o||n[5]!==r?(i=DU({className:o,inset:r}),n[4]=o,n[5]=r,n[6]=i):i=n[6],n[7]!==s||n[8]!==e||n[9]!==i?(a=u.jsx(Q_,{ref:e,className:i,...s}),n[7]=s,n[8]=e,n[9]=i,n[10]=a):a=n[10],a}).displayName=Q_.displayName;const d0=T.forwardRef((t,e)=>{const n=X.c(9);let o,r,s,i;return n[0]!==t?({className:o,...r}=t,n[0]=t,n[1]=o,n[2]=r):(o=n[1],r=n[2]),n[3]!==o?(s=je(IU({className:o})),n[3]=o,n[4]=s):s=n[4],n[5]!==r||n[6]!==e||n[7]!==s?(i=u.jsx(r0,{ref:e,className:s,...r}),n[5]=r,n[6]=e,n[7]=s,n[8]=i):i=n[8],i});d0.displayName=r0.displayName;const u0=t=>{const e=X.c(20),{connectionState:n,onClick:o,tooltipContent:r}=t;let s;e[0]!==n||e[1]!==r?(s=Fc(n)||r,e[0]=n,e[1]=r,e[2]=s):s=e[2];const i=s;let a;e[3]!==i||e[4]!==n?(a=uo(n)?i:u.jsxs("div",{className:"flex flex-col gap-4",children:[u.jsx("div",{children:i}),u.jsx("div",{className:"text-xs text-muted-foreground font-medium pt-1 -mt-2 border-t border-border",children:"Right-click for cell types"})]}),e[3]=i,e[4]=n,e[5]=a):a=e[5];const l=a;let c,d,h,f,p,_;return e[6]!==o?(c=()=>o==null?void 0:o({code:""}),e[6]=o,e[7]=c):c=e[7],e[8]!==n?(d=je("shoulder-button hover-action",uo(n)&&" inactive-button"),e[8]=n,e[9]=d):d=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(ar,{strokeWidth:1.8}),e[10]=h):h=e[10],e[11]!==c||e[12]!==d?(f=u.jsx(mn,{onClick:c,className:d,onMouseDown:Pn.preventFocus,shape:"circle",size:"small",color:"hint-green","data-testid":"create-cell-button",children:h}),e[11]=c,e[12]=d,e[13]=f):f=e[13],e[14]!==l||e[15]!==f?(p=u.jsx(Ae,{content:l,children:f}),e[14]=l,e[15]=f,e[16]=p):p=e[16],e[17]!==o||e[18]!==p?(_=u.jsx(x5,{onClick:o,children:p}),e[17]=o,e[18]=p,e[19]=_):_=e[19],_},x5=t=>{const e=X.c(26),{children:n,onClick:o}=t,{createNewCell:r}=kt();if(!o)return n;let s,i,a,l,c,d,h,f,p,_,g,m;return e[0]!==n?(s=u.jsx(l0,{children:n}),e[0]=n,e[1]=s):s=e[1],e[2]!==o?(i=b=>{b.stopPropagation(),o({code:""})},e[2]=o,e[3]=i):i=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx("div",{className:"mr-3 text-muted-foreground",children:u.jsx(Ql,{})}),e[4]=a):a=e[4],e[5]!==i?(l=u.jsxs(pi,{onSelect:i,children:[a,"Python cell"]},"python"),e[5]=i,e[6]=l):l=e[6],e[7]!==r||e[8]!==o?(c=b=>{b.stopPropagation(),ao(!0,r),o({code:new Ji().defaultCode})},e[7]=r,e[8]=o,e[9]=c):c=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsx("div",{className:"mr-3 text-muted-foreground",children:u.jsx(Zl,{})}),e[10]=d):d=e[10],e[11]!==c?(h=u.jsxs(pi,{onSelect:c,children:[d,"Markdown cell"]},"markdown"),e[11]=c,e[12]=h):h=e[12],e[13]!==r||e[14]!==o?(f=b=>{b.stopPropagation(),ao(!0,r),o({code:new jc().defaultCode})},e[13]=r,e[14]=o,e[15]=f):f=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx("div",{className:"mr-3 text-muted-foreground",children:u.jsx(or,{size:13,strokeWidth:1.5})}),e[16]=p):p=e[16],e[17]!==f?(_=u.jsxs(pi,{onSelect:f,children:[p,"SQL cell"]},"sql"),e[17]=f,e[18]=_):_=e[18],e[19]!==l||e[20]!==h||e[21]!==_?(g=u.jsxs(pu,{children:[l,h,_]}),e[19]=l,e[20]=h,e[21]=_,e[22]=g):g=e[22],e[23]!==s||e[24]!==g?(m=u.jsxs(a0,{children:[s,g]}),e[23]=s,e[24]=g,e[25]=m):m=e[25],m},h0=K.memo(K.forwardRef((t,e)=>{const n=X.c(34);let o,r,s;n[0]!==t?({children:o,showTooltip:s,...r}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]);const i=s===void 0||s,[a,l]=T.useState(!1);let c;n[4]!==r?(c={cell:r},n[4]=r,n[5]=c):c=n[5];const d=ld(c),h=zU();let f,p,_,g,m,b;if(n[6]===Symbol.for("react.memo_cache_sentinel")?(f=()=>({toggle:()=>l(w5)}),n[6]=f):f=n[6],T.useImperativeHandle(e,f),n[7]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx(Gi,{placeholder:"Search actions...",className:"h-6 m-1"}),n[7]=p):p=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(_=u.jsx(tc,{children:"No results"}),n[8]=_):_=n[8],n[9]!==d){let N;n[11]!==d.length?(N=(I,A)=>u.jsxs(T.Fragment,{children:[u.jsx(rp,{children:I.map(M=>{let R=u.jsxs("div",{className:"flex items-center flex-1",children:[M.icon&&u.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:M.icon}),u.jsx("div",{className:"flex-1",children:M.label}),u.jsxs("div",{className:"flex-shrink-0 text-sm",children:[M.hotkey&&N4(M.hotkey),M.rightElement]})]});return M.tooltip&&(R=u.jsx(Ae,{content:M.tooltip,delayDuration:100,children:R})),u.jsx(lo,{className:je(M.disabled&&"!opacity-50"),onSelect:()=>{M.disableClick||M.disabled||(M.handle(),l(!1))},variant:M.variant,children:R},M.label)})},A),A<d.length-1&&u.jsx($3,{})]},A),n[11]=d.length,n[12]=N):N=n[12],g=d.map(N),n[9]=d,n[10]=g}else g=n[10];n[13]!==g?(m=u.jsxs(fc,{children:[p,u.jsxs(Np,{children:[_,g]})]}),n[13]=g,n[14]=m):m=n[14],n[15]!==h||n[16]!==m?(b=u.jsx(Os,{className:"w-[300px] p-0 pt-1 overflow-auto",scrollable:!0,...h,children:m}),n[15]=h,n[16]=m,n[17]=b):b=n[17];const y=b;if(!i){let N,I;return n[18]!==o?(N=u.jsx(zs,{asChild:!0,children:o}),n[18]=o,n[19]=N):N=n[19],n[20]!==y||n[21]!==a||n[22]!==N?(I=u.jsxs(Dr,{open:a,onOpenChange:l,children:[N,y]}),n[20]=y,n[21]=a,n[22]=N,n[23]=I):I=n[23],I}let x;n[24]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx(BU,{tabIndex:-1,children:nn("cell.cellActions")}),n[24]=x):x=n[24];const v=!a&&x;let C,k,E;return n[25]!==o?(C=u.jsx(UU,{children:u.jsx(zs,{className:"flex",children:o})}),n[25]=o,n[26]=C):C=n[26],n[27]!==v||n[28]!==C?(k=u.jsxs(VU,{delayDuration:200,disableHoverableContent:!0,children:[v,C]}),n[27]=v,n[28]=C,n[29]=k):k=n[29],n[30]!==y||n[31]!==a||n[32]!==k?(E=u.jsxs(Dr,{open:a,onOpenChange:l,children:[k,y]}),n[30]=y,n[31]=a,n[32]=k,n[33]=E):E=n[33],E})),f0=K.memo(t=>{const e=X.c(5),{children:n,cellId:o}=t;let r,s;e[0]!==o?(s=FU(o),e[0]=o,e[1]=s):s=e[1],r=s;const i=Be(r);if(!i)return null;let a;return e[2]!==n||e[3]!==i?(a=u.jsx(h0,{showTooltip:!1,...i,children:n}),e[2]=n,e[3]=i,e[4]=a):a=e[4],a});function w5(t){return!t}f0.displayName="ConnectionCellActionsDropdown";const p0=t=>{const e=X.c(32);let n,o,r;e[0]!==t?({children:n,...o}=t,e[0]=t,e[1]=n,e[2]=o):(n=e[1],o=e[2]),e[3]!==o?(r={cell:o},e[3]=o,e[4]=r):r=e[4];const s=ld(r),[i,a]=K.useState(),l=!!i;let c,d,h,f,p,_,g,m,b,y;if(e[5]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx($i,{size:13,strokeWidth:1.5}),e[5]=c):c=e[5],e[6]!==o?(d=async()=>{var C;if((C=window.getSelection())==null?void 0:C.toString())return void document.execCommand("copy");const v=document.getElementById(O3.create(o.cellId));v?await pn(v.textContent??""):It.warn("cell-context-menu: output not found")},e[6]=o,e[7]=d):d=e[7],e[8]!==s||e[9]!==n||e[10]!==i||e[11]!==o||e[12]!==l||e[13]!==d){const x=[{label:"Copy",hidden:l,icon:c,handle:d},{label:"Cut",hidden:!!i,icon:u.jsx(Zc,{size:13,strokeWidth:1.5}),handle:v5},{label:"Paste",hidden:!!i,icon:u.jsx(sm,{size:13,strokeWidth:1.5}),handle:async()=>{const{getEditorView:k}=o,E=k();if(E)try{const N=await navigator.clipboard.readText();if(N){const{from:I,to:A}=E.state.selection.main,M=E.state.update({changes:{from:I,to:A,insert:N}});E.dispatch(M)}}catch(N){const I=N;It.error("Failed to paste from clipboard",I),$U({command:"paste"})}}},{label:"Copy image",hidden:!i,icon:u.jsx($c,{size:13,strokeWidth:1.5}),handle:async()=>{if(i){const k=await fetch(i.src),E=await k.blob(),N=new ClipboardItem({[E.type]:E});await navigator.clipboard.write([N]).then(k5).catch(S5)}}},{icon:u.jsx(Yp,{size:13,strokeWidth:1.5}),label:"Download image",hidden:!i,handle:()=>{if(i){const k=document.createElement("a");k.download="image.png",k.href=i.src,k.click()}}},{label:"Go to Definition",icon:u.jsx(WU,{size:13,strokeWidth:1.5}),handle:()=>{const{getEditorView:k}=o,E=k();E&&HU(E)}}],v=[x,...s];let C;f=a0,e[20]===Symbol.for("react.memo_cache_sentinel")?(C=k=>{k.target instanceof HTMLImageElement?a(k.target):a(void 0)},e[20]=C):C=e[20],e[21]!==n?(m=u.jsx(l0,{onContextMenu:C,asChild:!0,children:n}),e[21]=n,e[22]=m):m=e[22],h=pu,p="w-[300px]",_=!0,g=v.map((k,E)=>u.jsxs(T.Fragment,{children:[k.map(C5),E<v.length-1&&u.jsx(d0,{})]},E)),e[8]=s,e[9]=n,e[10]=i,e[11]=o,e[12]=l,e[13]=d,e[14]=h,e[15]=f,e[16]=p,e[17]=_,e[18]=g,e[19]=m}else h=e[14],f=e[15],p=e[16],_=e[17],g=e[18],m=e[19];return e[23]!==h||e[24]!==p||e[25]!==_||e[26]!==g?(b=u.jsx(h,{className:p,scrollable:_,children:g}),e[23]=h,e[24]=p,e[25]=_,e[26]=g,e[27]=b):b=e[27],e[28]!==f||e[29]!==m||e[30]!==b?(y=u.jsxs(f,{children:[m,b]}),e[28]=f,e[29]=m,e[30]=b,e[31]=y):y=e[31],y};function v5(){document.execCommand("cut")}function k5(){ut({title:"Copied image to clipboard"})}function S5(t){ut({title:"Failed to copy image to clipboard. Try downloading instead.",description:t.message}),It.error("Failed to copy image to clipboard",t)}function C5(t){if(t.hidden)return null;let e=u.jsxs("div",{className:"flex items-center flex-1",children:[t.icon&&u.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:t.icon}),u.jsx("div",{className:"flex-1",children:t.label}),u.jsxs("div",{className:"flex-shrink-0 text-sm",children:[t.hotkey&&N4(t.hotkey),t.rightElement]})]});return t.tooltip&&(e=u.jsx(Ae,{delayDuration:100,content:t.tooltip,children:e})),u.jsx(pi,{className:t.disabled?"!opacity-50":"",onSelect:n=>{t.disableClick||t.disabled||t.handle(n)},variant:t.variant,children:e},t.label)}const N5=""+new URL("loro_wasm_bg-DHBNbovs.wasm",import.meta.url).href;let w;function mu(t){w=t}const yt=new Array(128).fill(void 0);function be(t){return yt[t]}yt.push(void 0,null,!0,!1);let $e=0,al=null;function Gr(){return al!==null&&al.byteLength!==0||(al=new Uint8Array(w.memory.buffer)),al}let ll=new(typeof TextEncoder>"u"?(0,module.require)("util").TextEncoder:TextEncoder)("utf-8");const j5=typeof ll.encodeInto=="function"?function(t,e){return ll.encodeInto(t,e)}:function(t,e){const n=ll.encode(t);return e.set(n),{read:t.length,written:n.length}};function ft(t,e,n){if(n===void 0){const a=ll.encode(t),l=e(a.length,1)>>>0;return Gr().subarray(l,l+a.length).set(a),$e=a.length,l}let o=t.length,r=e(o,1)>>>0;const s=Gr();let i=0;for(;i<o;i++){const a=t.charCodeAt(i);if(a>127)break;s[r+i]=a}if(i!==o){i!==0&&(t=t.slice(i)),r=n(r,o,o=i+3*t.length,1)>>>0;const a=Gr().subarray(r+i,r+o);i+=j5(t,a).written,r=n(r,o,i,1)>>>0}return $e=i,r}let Yr=null;function L(){return(Yr===null||Yr.buffer.detached===!0||Yr.buffer.detached===void 0&&Yr.buffer!==w.memory.buffer)&&(Yr=new DataView(w.memory.buffer)),Yr}let mi=yt.length;function oe(t){mi===yt.length&&yt.push(yt.length+1);const e=mi;return mi=yt[e],yt[e]=t,e}function Yt(t,e){try{return t.apply(this,e)}catch(n){w.__wbindgen_export_2(oe(n))}}let m0=new(typeof TextDecoder>"u"?(0,module.require)("util").TextDecoder:TextDecoder)("utf-8",{ignoreBOM:!0,fatal:!0});function jt(t,e){return t>>>=0,m0.decode(Gr().subarray(t,t+e))}function H(t){const e=be(t);return function(n){n<132||(yt[n]=mi,mi=n)}(t),e}function jn(t){return t==null}m0.decode();const g0=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>{w.__wbindgen_export_4.get(t.dtor)(t.a,t.b)});function _0(t,e,n,o){const r={a:t,b:e,cnt:1,dtor:n},s=(...i)=>{r.cnt++;const a=r.a;r.a=0;try{return o(a,r.b,...i)}finally{--r.cnt===0?(w.__wbindgen_export_4.get(r.dtor)(a,r.b),g0.unregister(r)):r.a=a}};return s.original=r,g0.register(s,r,r),s}function gu(t){const e=typeof t;if(e=="number"||e=="boolean"||t==null)return`${t}`;if(e=="string")return`"${t}"`;if(e=="symbol"){const r=t.description;return r==null?"Symbol":`Symbol(${r})`}if(e=="function"){const r=t.name;return typeof r=="string"&&r.length>0?`Function(${r})`:"Function"}if(Array.isArray(t)){const r=t.length;let s="[";r>0&&(s+=gu(t[0]));for(let i=1;i<r;i++)s+=", "+gu(t[i]);return s+="]",s}const n=/\[object ([^\]]+)\]/.exec(toString.call(t));let o;if(!(n&&n.length>1))return toString.call(t);if(o=n[1],o=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message}
|
118
|
+
`.trim(),g=_4();await b4();const m=await fetch(g.getAiURL("completion").toString(),{method:"POST",headers:g.headers(),body:JSON.stringify({prompt:p.prompt,code:_,selectedText:p.selection,includeOtherCode:"",language:p.language})}),b=((v=p.selection.match(/^\s*/))==null?void 0:v[0])||"",y=(C=m.body)==null?void 0:C.getReader();if(!y)throw new Error("Failed to get response reader");let x="";for(;;){const{done:k,value:E}=await y.read();if(k)break;x+=new TextDecoder().decode(E)}return x.startsWith(b)||(x=b+x),x}({prompt:f.prompt,selection:f.selection,codeBefore:f.codeBefore,codeAfter:f.codeAfter,language:T3(f.editorView)})}):[],d5(ct),VB(e,c.reference_highlighting??!1)];var h},p5=t=>{const{theme:e,hotkeys:n,completionConfig:o,cellId:r,lspConfig:s,diagnosticsConfig:i}=t,a=A_(t);return[tt.lineWrapping,$B(),HB(),WB(),qB(),GB(),YB(),JB(),KB({position:"fixed",parent:document.querySelector("#App")??void 0}),XB(),e==="dark"?u5:h5,ZB(s),r5(o),QB(),eU(),uE(),Lo.high(Bn.of(iU)),tU(),nU(),oU.of(" "),v4(aU,{fallback:!0}),Bn.of(lU),rU({placeholderType:a,completionConfig:o,hotkeys:n,cellId:r,lspConfig:{...s,diagnostics:i}}),sU.of(cU()),sr.allowMultipleSelections.of(!0),s5(n),Bn.of([{key:"Tab",run:l=>w4(l)||(c=>{const{from:d,to:h}=c.state.selection.main;if(d!==h)return!1;const f=c.state.doc.lineAt(h);return f.text.slice(0,h-f.from).trim()!==""&&fU(c)})(l)||dU(l),preventDefault:!0},{key:n.getHotkey("completion.moveDown").key,run:l=>sa(l.state)!==null&&(wc(!0)(l),!0),preventDefault:!0},{key:n.getHotkey("completion.moveUp").key,run:l=>sa(l.state)!==null&&(wc(!1)(l),!0),preventDefault:!0}]),Bn.of([...uU,hU])]},m5={width:void 0,height:void 0};function T_(t,e,n){return t[e]?Array.isArray(t[e])?t[e][0][n]:t[e][n]:e==="contentBoxSize"?t.contentRect[n==="inlineSize"?"width":"height"]:void 0}function M_(t){const e=t.current;if(e===null)throw new ReferenceError("Attempting to dereference null object.");return e}let O_,D_,R_,P_;O_=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!0}),D_=new Intl.DateTimeFormat("en-US",{month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!0}),R_=t=>{const e=X.c(79),{editing:n,status:o,disabled:r,staleInputs:s,edited:i,interrupted:a,elapsedTime:l,runStartTimestamp:c,lastRunStartTimestamp:d,uninstantiated:h}=t;if(!n)return null;const f=c??d;let p;e[0]!==f?(p=f?u.jsx(P_,{lastRanTime:f}):null,e[0]=f,e[1]=p):p=e[1];const _=p;if(r&&o==="running")return It.error("CellStatusComponent: disabled and running"),null;if(r&&s){let g,m,b,y;return e[2]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("span",{children:"This cell is stale, but it's disabled and can't be run"}),e[2]=g):g=e[2],e[3]!==_?(m=u.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[3]=_,e[4]=m):m=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"stale",children:u.jsxs(qs,{children:[u.jsx(Ws,{className:"h-5 w-5",strokeWidth:1.5}),u.jsx(Cc,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[5]=b):b=e[5],e[6]!==m?(y=u.jsx(Ae,{content:m,usePortal:!0,children:b}),e[6]=m,e[7]=y):y=e[7],y}if(r){let g,m,b,y;return e[8]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("span",{children:"This cell is disabled"}),e[8]=g):g=e[8],e[9]!==_?(m=u.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[9]=_,e[10]=m):m=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx("div",{className:"cell-status-icon cell-status-disabled","data-testid":"cell-status","data-status":"disabled",children:u.jsx(Ws,{className:"h-5 w-5",strokeWidth:1.5})}),e[11]=b):b=e[11],e[12]!==m?(y=u.jsx(Ae,{content:m,usePortal:!0,children:b}),e[12]=m,e[13]=y):y=e[13],y}if(!s&&o==="disabled-transitively"){let g,m,b,y;return e[14]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("span",{children:"An ancestor of this cell is disabled, so it can't be run"}),e[14]=g):g=e[14],e[15]!==_?(m=u.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[15]=_,e[16]=m):m=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"disabled-transitively",children:u.jsxs(qs,{layerTop:!0,children:[u.jsx(ya,{className:"h-5 w-5",strokeWidth:1.5}),u.jsx(Ws,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[17]=b):b=e[17],e[18]!==m?(y=u.jsx(Ae,{content:m,usePortal:!0,children:b}),e[18]=m,e[19]=y):y=e[19],y}if(s&&o==="disabled-transitively"){let g,m,b,y;return e[20]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("span",{children:"This cell is stale, but an ancestor is disabled so it can't be run"}),e[20]=g):g=e[20],e[21]!==_?(m=u.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[21]=_,e[22]=m):m=e[22],e[23]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"stale",children:u.jsxs(qs,{children:[u.jsx(Cc,{className:"h-5 w-5",strokeWidth:1}),u.jsx(Ws,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[23]=b):b=e[23],e[24]!==m?(y=u.jsx(Ae,{content:m,usePortal:!0,children:b}),e[24]=m,e[25]=y):y=e[25],y}if(o==="running"){let g,m,b,y,x;return e[26]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("span",{children:"This cell is running"}),e[26]=g):g=e[26],e[27]!==_?(m=u.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[27]=_,e[28]=m):m=e[28],e[29]!==c?(b=Cp.fromSeconds(c)||Cp.now(),e[29]=c,e[30]=b):b=e[30],e[31]!==b?(y=u.jsx("div",{className:"cell-status-icon elapsed-time running","data-testid":"cell-status","data-status":"running",children:u.jsx(g5,{startTime:b})}),e[31]=b,e[32]=y):y=e[32],e[33]!==m||e[34]!==y?(x=u.jsx(Ae,{content:m,usePortal:!0,children:y}),e[33]=m,e[34]=y,e[35]=x):x=e[35],x}if(o==="queued"){let g,m,b,y;return e[36]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("span",{children:"This cell is queued to run"}),e[36]=g):g=e[36],e[37]!==_?(m=u.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[37]=_,e[38]=m):m=e[38],e[39]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx("div",{className:"cell-status-icon cell-status-queued","data-testid":"cell-status","data-status":"queued",children:u.jsx(RS,{className:"h-5 w-5",strokeWidth:1.5})}),e[39]=b):b=e[39],e[40]!==m?(y=u.jsx(Ae,{content:m,usePortal:!0,children:b}),e[40]=m,e[41]=y):y=e[41],y}if(i||a||s||h){let g;e[42]!==l?(g=fa(l),e[42]=l,e[43]=g):g=e[43];const m=g;let b;e[44]!==l||e[45]!==m?(b=l?u.jsx(Bc,{elapsedTime:m}):null,e[44]=l,e[45]=m,e[46]=b):b=e[46];const y=b;let x,v,C,k,E,N="";if(h)x="This cell has not yet been run";else if(a){let I;x="This cell was interrupted when it was last run",e[47]!==y?(I=u.jsxs("span",{children:["This cell ran for ",y," before being interrupted"]}),e[47]=y,e[48]=I):I=e[48],N=I}else if(i){let I;x="This cell has been modified since it was last run",e[49]!==y?(I=u.jsxs("span",{children:["This cell took ",y," to run"]}),e[49]=y,e[50]=I):I=e[50],N=I}else{let I;x="This cell has not been run with the latest inputs",e[51]!==y?(I=u.jsxs("span",{children:["This cell took ",y," to run"]}),e[51]=y,e[52]=I):I=e[52],N=I}return e[53]===Symbol.for("react.memo_cache_sentinel")?(v=u.jsx("div",{className:"cell-status-stale","data-testid":"cell-status","data-status":"outdated",children:u.jsx(Cc,{className:"h-5 w-5",strokeWidth:1.5})}),e[53]=v):v=e[53],e[54]!==x?(C=u.jsx(Ae,{content:x,usePortal:!0,children:v}),e[54]=x,e[55]=C):C=e[55],e[56]!==l||e[57]!==m||e[58]!==_||e[59]!==N?(k=l&&u.jsx(Ae,{content:u.jsxs("div",{className:"flex flex-col gap-1",children:[N,_]}),usePortal:!0,children:u.jsx("div",{className:"elapsed-time hover-action","data-testid":"cell-status","data-status":"outdated",children:u.jsx("span",{children:m})})}),e[56]=l,e[57]=m,e[58]=_,e[59]=N,e[60]=k):k=e[60],e[61]!==C||e[62]!==k?(E=u.jsxs("div",{className:"cell-status-icon flex items-center gap-2",children:[C,k]}),e[61]=C,e[62]=k,e[63]=E):E=e[63],E}if(l!==null){let g;e[64]!==l?(g=fa(l),e[64]=l,e[65]=g):g=e[65];const m=g;let b;e[66]!==l||e[67]!==m?(b=l?u.jsx(Bc,{elapsedTime:m}):null,e[66]=l,e[67]=m,e[68]=b):b=e[68];const y=b;let x,v,C,k;return e[69]!==y?(x=u.jsxs("span",{children:["This cell took ",y," to run"]}),e[69]=y,e[70]=x):x=e[70],e[71]!==_||e[72]!==x?(v=u.jsxs("div",{className:"flex flex-col gap-1",children:[x,_]}),e[71]=_,e[72]=x,e[73]=v):v=e[73],e[74]!==m?(C=u.jsx("div",{className:"cell-status-icon elapsed-time hover-action","data-testid":"cell-status","data-status":"idle",children:u.jsx("span",{children:m})}),e[74]=m,e[75]=C):C=e[75],e[76]!==v||e[77]!==C?(k=u.jsx(Ae,{content:v,usePortal:!0,children:C}),e[76]=v,e[77]=C,e[78]=k):k=e[78],k}return null},Bc=t=>{const e=X.c(2);let n;return e[0]!==t.elapsedTime?(n=u.jsx("span",{className:"tracking-wide font-semibold",children:t.elapsedTime}),e[0]=t.elapsedTime,e[1]=n):n=e[1],n},P_=t=>{const e=X.c(18),n=1e3*t.lastRanTime;let o,r,s,i,a,l,c,d,h;if(e[0]!==n){const f=new Date(n),p=new Date,_=f.toDateString()===p.toDateString()?O_:D_;i="Ran at",a=" ",l=u.jsx("strong",{className:"tracking-wide font-semibold",children:_.format(f)}),c=" ",o="text-muted-foreground",r="(",s=HS(f),e[0]=n,e[1]=o,e[2]=r,e[3]=s,e[4]=i,e[5]=a,e[6]=l,e[7]=c}else o=e[1],r=e[2],s=e[3],i=e[4],a=e[5],l=e[6],c=e[7];return e[8]!==o||e[9]!==r||e[10]!==s?(d=u.jsxs("span",{className:o,children:[r,s," ago)"]}),e[8]=o,e[9]=r,e[10]=s,e[11]=d):d=e[11],e[12]!==i||e[13]!==a||e[14]!==l||e[15]!==c||e[16]!==d?(h=u.jsxs("span",{children:[i,a,l,c,d]}),e[12]=i,e[13]=a,e[14]=l,e[15]=c,e[16]=d,e[17]=h):h=e[17],h},fa=function(t){if(t===null)return"";const e=t,n=e/1e3;return n>=60?`${Math.floor(n/60)}m${Math.floor(n%60)}s`:n>=1?`${n.toFixed(2).toString()}s`:`${e.toFixed(0).toString()}ms`};const g5=t=>{const e=X.c(6);let n;e[0]!==t.startTime?(n=t.startTime.toMilliseconds(),e[0]=t.startTime,e[1]=n):n=e[1];const o=function(i){const a=T.useRef(i),[l,c]=T.useState(i);return T.useEffect(()=>{const d=setInterval(()=>{c(Cp.now().toMilliseconds())},17);return()=>clearInterval(d)},[]),l-a.current}(n);let r,s;return e[2]!==o?(r=fa(o),e[2]=o,e[3]=r):r=e[3],e[4]!==r?(s=u.jsx("span",{children:r}),e[4]=r,e[5]=s):s=e[5],s};var fu="ContextMenu",[_5,KH]=S4(fu,[k4]),sn=k4(),[b5,L_]=_5(fu),F_=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:o,dir:r,modal:s=!0}=t,[i,a]=T.useState(!1),l=sn(e),c=ir(o),d=T.useCallback(h=>{a(h),c(h)},[c]);return u.jsx(b5,{scope:e,open:i,onOpenChange:d,modal:s,children:u.jsx(jU,{...l,dir:r,open:i,onOpenChange:d,modal:s,children:n})})};F_.displayName=fu;var z_="ContextMenuTrigger",B_=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:o=!1,...r}=t,s=L_(z_,n),i=sn(n),a=T.useRef({x:0,y:0}),l=T.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...a.current})}),c=T.useRef(0),d=T.useCallback(()=>window.clearTimeout(c.current),[]),h=f=>{a.current={x:f.clientX,y:f.clientY},s.onOpenChange(!0)};return T.useEffect(()=>d,[d]),T.useEffect(()=>{o&&d()},[o,d]),u.jsxs(u.Fragment,{children:[u.jsx(gU,{...i,virtualRef:l}),u.jsx(Fs.span,{"data-state":s.open?"open":"closed","data-disabled":o?"":void 0,...r,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:o?t.onContextMenu:Un(t.onContextMenu,f=>{d(),h(f),f.preventDefault()}),onPointerDown:o?t.onPointerDown:Un(t.onPointerDown,il(f=>{d(),c.current=window.setTimeout(()=>h(f),700)})),onPointerMove:o?t.onPointerMove:Un(t.onPointerMove,il(d)),onPointerCancel:o?t.onPointerCancel:Un(t.onPointerCancel,il(d)),onPointerUp:o?t.onPointerUp:Un(t.onPointerUp,il(d))})]})});B_.displayName=z_;var U_=t=>{const{__scopeContextMenu:e,...n}=t,o=sn(e);return u.jsx(EU,{...o,...n})};U_.displayName="ContextMenuPortal";var V_="ContextMenuContent",$_=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=L_(V_,n),s=sn(n),i=T.useRef(!1);return u.jsx(_U,{...s,...o,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:a=>{var l;(l=t.onCloseAutoFocus)==null||l.call(t,a),!a.defaultPrevented&&i.current&&a.preventDefault(),i.current=!1},onInteractOutside:a=>{var l;(l=t.onInteractOutside)==null||l.call(t,a),a.defaultPrevented||r.modal||(i.current=!0)},style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});$_.displayName=V_,T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=sn(n);return u.jsx(bU,{...r,...o,ref:e})}).displayName="ContextMenuGroup";var H_=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=sn(n);return u.jsx(yU,{...r,...o,ref:e})});H_.displayName="ContextMenuLabel";var W_=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=sn(n);return u.jsx(mU,{...r,...o,ref:e})});W_.displayName="ContextMenuItem";var q_=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=sn(n);return u.jsx(xU,{...r,...o,ref:e})});q_.displayName="ContextMenuCheckboxItem",T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=sn(n);return u.jsx(wU,{...r,...o,ref:e})}).displayName="ContextMenuRadioGroup";var G_=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=sn(n);return u.jsx(vU,{...r,...o,ref:e})});G_.displayName="ContextMenuRadioItem";var Y_=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=sn(n);return u.jsx(kU,{...r,...o,ref:e})});Y_.displayName="ContextMenuItemIndicator";var J_=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=sn(n);return u.jsx(pU,{...r,...o,ref:e})});J_.displayName="ContextMenuSeparator",T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=sn(n);return u.jsx(SU,{...r,...o,ref:e})}).displayName="ContextMenuArrow";var K_=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=sn(n);return u.jsx(CU,{...r,...o,ref:e})});K_.displayName="ContextMenuSubTrigger";var X_=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=sn(n);return u.jsx(NU,{...r,...o,ref:e,style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});function il(t){return e=>e.pointerType!=="mouse"?t(e):void 0}X_.displayName="ContextMenuSubContent";var Z_=$_,Q_=H_,e0=W_,t0=q_,n0=G_,o0=Y_,r0=J_,s0=K_,i0=X_;const a0=F_,l0=B_,y5=TU(U_);T.forwardRef((t,e)=>{const n=X.c(14);let o,r,s,i,a,l,c;return n[0]!==t?({className:r,inset:s,children:o,...i}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i):(o=n[1],r=n[2],s=n[3],i=n[4]),n[5]!==r||n[6]!==s?(a=MU({className:r,inset:s}),n[5]=r,n[6]=s,n[7]=a):a=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx(RU,{className:"ml-auto h-4 w-4"}),n[8]=l):l=n[8],n[9]!==o||n[10]!==i||n[11]!==e||n[12]!==a?(c=u.jsxs(s0,{ref:e,className:a,...i,children:[o,l]}),n[9]=o,n[10]=i,n[11]=e,n[12]=a,n[13]=c):c=n[13],c}).displayName=s0.displayName;const c0="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";T.forwardRef((t,e)=>{const n=X.c(9);let o,r,s,i;return n[0]!==t?({className:o,...r}=t,n[0]=t,n[1]=o,n[2]=r):(o=n[1],r=n[2]),n[3]!==o?(s=je(C4({subcontent:!0}),c0,o),n[3]=o,n[4]=s):s=n[4],n[5]!==r||n[6]!==e||n[7]!==s?(i=u.jsx(i0,{ref:e,className:s,...r}),n[5]=r,n[6]=e,n[7]=s,n[8]=i):i=n[8],i}).displayName=i0.displayName;const pu=T.forwardRef((t,e)=>{const n=X.c(15);let o,r,s;n[0]!==t?({className:o,scrollable:s,...r}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]);const i=s===void 0||s;let a;n[4]!==o||n[5]!==i?(a=je(C4(),c0,i&&"overflow-auto",o),n[4]=o,n[5]=i,n[6]=a):a=n[6];const l=i?"calc(var(--radix-context-menu-content-available-height) - 30px)":void 0;let c,d;return n[7]!==r.style||n[8]!==l?(c={...r.style,maxHeight:l},n[7]=r.style,n[8]=l,n[9]=c):c=n[9],n[10]!==r||n[11]!==e||n[12]!==a||n[13]!==c?(d=u.jsx(y5,{children:u.jsx(OU,{children:u.jsx(Z_,{ref:e,className:a,style:c,...r})})}),n[10]=r,n[11]=e,n[12]=a,n[13]=c,n[14]=d):d=n[14],d});pu.displayName=Z_.displayName;const pi=T.forwardRef((t,e)=>{const n=X.c(13);let o,r,s,i,a,l;return n[0]!==t?({className:o,inset:r,variant:i,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i):(o=n[1],r=n[2],s=n[3],i=n[4]),n[5]!==o||n[6]!==r||n[7]!==i?(a=AU({className:o,inset:r,variant:i}),n[5]=o,n[6]=r,n[7]=i,n[8]=a):a=n[8],n[9]!==s||n[10]!==e||n[11]!==a?(l=u.jsx(e0,{ref:e,className:a,...s}),n[9]=s,n[10]=e,n[11]=a,n[12]=l):l=n[12],l});pi.displayName=e0.displayName,T.forwardRef((t,e)=>{const n=X.c(15);let o,r,s,i,a,l,c,d;return n[0]!==t?({className:s,children:r,checked:o,...i}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i):(o=n[1],r=n[2],s=n[3],i=n[4]),n[5]!==s?(a=Nc({className:s}),n[5]=s,n[6]=a):a=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(l=Nc(),n[7]=l):l=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx("span",{className:l,children:u.jsx(o0,{children:u.jsx(PU,{className:"h-4 w-4"})})}),n[8]=c):c=n[8],n[9]!==o||n[10]!==r||n[11]!==i||n[12]!==e||n[13]!==a?(d=u.jsxs(t0,{ref:e,className:a,checked:o,...i,children:[c,r]}),n[9]=o,n[10]=r,n[11]=i,n[12]=e,n[13]=a,n[14]=d):d=n[14],d}).displayName=t0.displayName,T.forwardRef((t,e)=>{const n=X.c(13);let o,r,s,i,a,l,c;return n[0]!==t?({className:r,children:o,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]),n[4]!==r?(i=Nc({className:r}),n[4]=r,n[5]=i):i=n[5],n[6]===Symbol.for("react.memo_cache_sentinel")?(a=Nc(),n[6]=a):a=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx("span",{className:a,children:u.jsx(o0,{children:u.jsx(LU,{className:"h-4 w-4 fill-current"})})}),n[7]=l):l=n[7],n[8]!==o||n[9]!==s||n[10]!==e||n[11]!==i?(c=u.jsxs(n0,{ref:e,className:i,...s,children:[l,o]}),n[8]=o,n[9]=s,n[10]=e,n[11]=i,n[12]=c):c=n[12],c}).displayName=n0.displayName,T.forwardRef((t,e)=>{const n=X.c(11);let o,r,s,i,a;return n[0]!==t?({className:o,inset:r,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]),n[4]!==o||n[5]!==r?(i=DU({className:o,inset:r}),n[4]=o,n[5]=r,n[6]=i):i=n[6],n[7]!==s||n[8]!==e||n[9]!==i?(a=u.jsx(Q_,{ref:e,className:i,...s}),n[7]=s,n[8]=e,n[9]=i,n[10]=a):a=n[10],a}).displayName=Q_.displayName;const d0=T.forwardRef((t,e)=>{const n=X.c(9);let o,r,s,i;return n[0]!==t?({className:o,...r}=t,n[0]=t,n[1]=o,n[2]=r):(o=n[1],r=n[2]),n[3]!==o?(s=je(IU({className:o})),n[3]=o,n[4]=s):s=n[4],n[5]!==r||n[6]!==e||n[7]!==s?(i=u.jsx(r0,{ref:e,className:s,...r}),n[5]=r,n[6]=e,n[7]=s,n[8]=i):i=n[8],i});d0.displayName=r0.displayName;const u0=t=>{const e=X.c(20),{connectionState:n,onClick:o,tooltipContent:r}=t;let s;e[0]!==n||e[1]!==r?(s=Fc(n)||r,e[0]=n,e[1]=r,e[2]=s):s=e[2];const i=s;let a;e[3]!==i||e[4]!==n?(a=uo(n)?i:u.jsxs("div",{className:"flex flex-col gap-4",children:[u.jsx("div",{children:i}),u.jsx("div",{className:"text-xs text-muted-foreground font-medium pt-1 -mt-2 border-t border-border",children:"Right-click for cell types"})]}),e[3]=i,e[4]=n,e[5]=a):a=e[5];const l=a;let c,d,h,f,p,_;return e[6]!==o?(c=()=>o==null?void 0:o({code:""}),e[6]=o,e[7]=c):c=e[7],e[8]!==n?(d=je("shoulder-button hover-action",uo(n)&&" inactive-button"),e[8]=n,e[9]=d):d=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(ar,{strokeWidth:1.8}),e[10]=h):h=e[10],e[11]!==c||e[12]!==d?(f=u.jsx(mn,{onClick:c,className:d,onMouseDown:Pn.preventFocus,shape:"circle",size:"small",color:"hint-green","data-testid":"create-cell-button",children:h}),e[11]=c,e[12]=d,e[13]=f):f=e[13],e[14]!==l||e[15]!==f?(p=u.jsx(Ae,{content:l,usePortal:!1,children:f}),e[14]=l,e[15]=f,e[16]=p):p=e[16],e[17]!==o||e[18]!==p?(_=u.jsx(x5,{onClick:o,children:p}),e[17]=o,e[18]=p,e[19]=_):_=e[19],_},x5=t=>{const e=X.c(26),{children:n,onClick:o}=t,{createNewCell:r}=kt();if(!o)return n;let s,i,a,l,c,d,h,f,p,_,g,m;return e[0]!==n?(s=u.jsx(l0,{children:n}),e[0]=n,e[1]=s):s=e[1],e[2]!==o?(i=b=>{b.stopPropagation(),o({code:""})},e[2]=o,e[3]=i):i=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx("div",{className:"mr-3 text-muted-foreground",children:u.jsx(Ql,{})}),e[4]=a):a=e[4],e[5]!==i?(l=u.jsxs(pi,{onSelect:i,children:[a,"Python cell"]},"python"),e[5]=i,e[6]=l):l=e[6],e[7]!==r||e[8]!==o?(c=b=>{b.stopPropagation(),ao(!0,r),o({code:new Ji().defaultCode})},e[7]=r,e[8]=o,e[9]=c):c=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsx("div",{className:"mr-3 text-muted-foreground",children:u.jsx(Zl,{})}),e[10]=d):d=e[10],e[11]!==c?(h=u.jsxs(pi,{onSelect:c,children:[d,"Markdown cell"]},"markdown"),e[11]=c,e[12]=h):h=e[12],e[13]!==r||e[14]!==o?(f=b=>{b.stopPropagation(),ao(!0,r),o({code:new jc().defaultCode})},e[13]=r,e[14]=o,e[15]=f):f=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx("div",{className:"mr-3 text-muted-foreground",children:u.jsx(or,{size:13,strokeWidth:1.5})}),e[16]=p):p=e[16],e[17]!==f?(_=u.jsxs(pi,{onSelect:f,children:[p,"SQL cell"]},"sql"),e[17]=f,e[18]=_):_=e[18],e[19]!==l||e[20]!==h||e[21]!==_?(g=u.jsxs(pu,{children:[l,h,_]}),e[19]=l,e[20]=h,e[21]=_,e[22]=g):g=e[22],e[23]!==s||e[24]!==g?(m=u.jsxs(a0,{children:[s,g]}),e[23]=s,e[24]=g,e[25]=m):m=e[25],m},h0=K.memo(K.forwardRef((t,e)=>{const n=X.c(34);let o,r,s;n[0]!==t?({children:o,showTooltip:s,...r}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]);const i=s===void 0||s,[a,l]=T.useState(!1);let c;n[4]!==r?(c={cell:r},n[4]=r,n[5]=c):c=n[5];const d=ld(c),h=zU();let f,p,_,g,m,b;if(n[6]===Symbol.for("react.memo_cache_sentinel")?(f=()=>({toggle:()=>l(w5)}),n[6]=f):f=n[6],T.useImperativeHandle(e,f),n[7]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx(Gi,{placeholder:"Search actions...",className:"h-6 m-1"}),n[7]=p):p=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(_=u.jsx(tc,{children:"No results"}),n[8]=_):_=n[8],n[9]!==d){let N;n[11]!==d.length?(N=(I,A)=>u.jsxs(T.Fragment,{children:[u.jsx(rp,{children:I.map(M=>{let R=u.jsxs("div",{className:"flex items-center flex-1",children:[M.icon&&u.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:M.icon}),u.jsx("div",{className:"flex-1",children:M.label}),u.jsxs("div",{className:"flex-shrink-0 text-sm",children:[M.hotkey&&N4(M.hotkey),M.rightElement]})]});return M.tooltip&&(R=u.jsx(Ae,{content:M.tooltip,delayDuration:100,children:R})),u.jsx(lo,{className:je(M.disabled&&"!opacity-50"),onSelect:()=>{M.disableClick||M.disabled||(M.handle(),l(!1))},variant:M.variant,children:R},M.label)})},A),A<d.length-1&&u.jsx($3,{})]},A),n[11]=d.length,n[12]=N):N=n[12],g=d.map(N),n[9]=d,n[10]=g}else g=n[10];n[13]!==g?(m=u.jsxs(fc,{children:[p,u.jsxs(Np,{children:[_,g]})]}),n[13]=g,n[14]=m):m=n[14],n[15]!==h||n[16]!==m?(b=u.jsx(Os,{className:"w-[300px] p-0 pt-1 overflow-auto",scrollable:!0,...h,children:m}),n[15]=h,n[16]=m,n[17]=b):b=n[17];const y=b;if(!i){let N,I;return n[18]!==o?(N=u.jsx(zs,{asChild:!0,children:o}),n[18]=o,n[19]=N):N=n[19],n[20]!==y||n[21]!==a||n[22]!==N?(I=u.jsxs(Dr,{open:a,onOpenChange:l,children:[N,y]}),n[20]=y,n[21]=a,n[22]=N,n[23]=I):I=n[23],I}let x;n[24]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx(BU,{tabIndex:-1,children:nn("cell.cellActions")}),n[24]=x):x=n[24];const v=!a&&x;let C,k,E;return n[25]!==o?(C=u.jsx(UU,{children:u.jsx(zs,{className:"flex",children:o})}),n[25]=o,n[26]=C):C=n[26],n[27]!==v||n[28]!==C?(k=u.jsxs(VU,{delayDuration:200,disableHoverableContent:!0,children:[v,C]}),n[27]=v,n[28]=C,n[29]=k):k=n[29],n[30]!==y||n[31]!==a||n[32]!==k?(E=u.jsxs(Dr,{open:a,onOpenChange:l,children:[k,y]}),n[30]=y,n[31]=a,n[32]=k,n[33]=E):E=n[33],E})),f0=K.memo(t=>{const e=X.c(5),{children:n,cellId:o}=t;let r,s;e[0]!==o?(s=FU(o),e[0]=o,e[1]=s):s=e[1],r=s;const i=Be(r);if(!i)return null;let a;return e[2]!==n||e[3]!==i?(a=u.jsx(h0,{showTooltip:!1,...i,children:n}),e[2]=n,e[3]=i,e[4]=a):a=e[4],a});function w5(t){return!t}f0.displayName="ConnectionCellActionsDropdown";const p0=t=>{const e=X.c(32);let n,o,r;e[0]!==t?({children:n,...o}=t,e[0]=t,e[1]=n,e[2]=o):(n=e[1],o=e[2]),e[3]!==o?(r={cell:o},e[3]=o,e[4]=r):r=e[4];const s=ld(r),[i,a]=K.useState(),l=!!i;let c,d,h,f,p,_,g,m,b,y;if(e[5]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx($i,{size:13,strokeWidth:1.5}),e[5]=c):c=e[5],e[6]!==o?(d=async()=>{var C;if((C=window.getSelection())==null?void 0:C.toString())return void document.execCommand("copy");const v=document.getElementById(O3.create(o.cellId));v?await pn(v.textContent??""):It.warn("cell-context-menu: output not found")},e[6]=o,e[7]=d):d=e[7],e[8]!==s||e[9]!==n||e[10]!==i||e[11]!==o||e[12]!==l||e[13]!==d){const x=[{label:"Copy",hidden:l,icon:c,handle:d},{label:"Cut",hidden:!!i,icon:u.jsx(Zc,{size:13,strokeWidth:1.5}),handle:v5},{label:"Paste",hidden:!!i,icon:u.jsx(sm,{size:13,strokeWidth:1.5}),handle:async()=>{const{getEditorView:k}=o,E=k();if(E)try{const N=await navigator.clipboard.readText();if(N){const{from:I,to:A}=E.state.selection.main,M=E.state.update({changes:{from:I,to:A,insert:N}});E.dispatch(M)}}catch(N){const I=N;It.error("Failed to paste from clipboard",I),$U({command:"paste"})}}},{label:"Copy image",hidden:!i,icon:u.jsx($c,{size:13,strokeWidth:1.5}),handle:async()=>{if(i){const k=await fetch(i.src),E=await k.blob(),N=new ClipboardItem({[E.type]:E});await navigator.clipboard.write([N]).then(k5).catch(S5)}}},{icon:u.jsx(Yp,{size:13,strokeWidth:1.5}),label:"Download image",hidden:!i,handle:()=>{if(i){const k=document.createElement("a");k.download="image.png",k.href=i.src,k.click()}}},{label:"Go to Definition",icon:u.jsx(WU,{size:13,strokeWidth:1.5}),handle:()=>{const{getEditorView:k}=o,E=k();E&&HU(E)}}],v=[x,...s];let C;f=a0,e[20]===Symbol.for("react.memo_cache_sentinel")?(C=k=>{k.target instanceof HTMLImageElement?a(k.target):a(void 0)},e[20]=C):C=e[20],e[21]!==n?(m=u.jsx(l0,{onContextMenu:C,asChild:!0,children:n}),e[21]=n,e[22]=m):m=e[22],h=pu,p="w-[300px]",_=!0,g=v.map((k,E)=>u.jsxs(T.Fragment,{children:[k.map(C5),E<v.length-1&&u.jsx(d0,{})]},E)),e[8]=s,e[9]=n,e[10]=i,e[11]=o,e[12]=l,e[13]=d,e[14]=h,e[15]=f,e[16]=p,e[17]=_,e[18]=g,e[19]=m}else h=e[14],f=e[15],p=e[16],_=e[17],g=e[18],m=e[19];return e[23]!==h||e[24]!==p||e[25]!==_||e[26]!==g?(b=u.jsx(h,{className:p,scrollable:_,children:g}),e[23]=h,e[24]=p,e[25]=_,e[26]=g,e[27]=b):b=e[27],e[28]!==f||e[29]!==m||e[30]!==b?(y=u.jsxs(f,{children:[m,b]}),e[28]=f,e[29]=m,e[30]=b,e[31]=y):y=e[31],y};function v5(){document.execCommand("cut")}function k5(){ut({title:"Copied image to clipboard"})}function S5(t){ut({title:"Failed to copy image to clipboard. Try downloading instead.",description:t.message}),It.error("Failed to copy image to clipboard",t)}function C5(t){if(t.hidden)return null;let e=u.jsxs("div",{className:"flex items-center flex-1",children:[t.icon&&u.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:t.icon}),u.jsx("div",{className:"flex-1",children:t.label}),u.jsxs("div",{className:"flex-shrink-0 text-sm",children:[t.hotkey&&N4(t.hotkey),t.rightElement]})]});return t.tooltip&&(e=u.jsx(Ae,{delayDuration:100,content:t.tooltip,children:e})),u.jsx(pi,{className:t.disabled?"!opacity-50":"",onSelect:n=>{t.disableClick||t.disabled||t.handle(n)},variant:t.variant,children:e},t.label)}const N5=""+new URL("loro_wasm_bg-DHBNbovs.wasm",import.meta.url).href;let w;function mu(t){w=t}const yt=new Array(128).fill(void 0);function be(t){return yt[t]}yt.push(void 0,null,!0,!1);let $e=0,al=null;function Gr(){return al!==null&&al.byteLength!==0||(al=new Uint8Array(w.memory.buffer)),al}let ll=new(typeof TextEncoder>"u"?(0,module.require)("util").TextEncoder:TextEncoder)("utf-8");const j5=typeof ll.encodeInto=="function"?function(t,e){return ll.encodeInto(t,e)}:function(t,e){const n=ll.encode(t);return e.set(n),{read:t.length,written:n.length}};function ft(t,e,n){if(n===void 0){const a=ll.encode(t),l=e(a.length,1)>>>0;return Gr().subarray(l,l+a.length).set(a),$e=a.length,l}let o=t.length,r=e(o,1)>>>0;const s=Gr();let i=0;for(;i<o;i++){const a=t.charCodeAt(i);if(a>127)break;s[r+i]=a}if(i!==o){i!==0&&(t=t.slice(i)),r=n(r,o,o=i+3*t.length,1)>>>0;const a=Gr().subarray(r+i,r+o);i+=j5(t,a).written,r=n(r,o,i,1)>>>0}return $e=i,r}let Yr=null;function L(){return(Yr===null||Yr.buffer.detached===!0||Yr.buffer.detached===void 0&&Yr.buffer!==w.memory.buffer)&&(Yr=new DataView(w.memory.buffer)),Yr}let mi=yt.length;function oe(t){mi===yt.length&&yt.push(yt.length+1);const e=mi;return mi=yt[e],yt[e]=t,e}function Yt(t,e){try{return t.apply(this,e)}catch(n){w.__wbindgen_export_2(oe(n))}}let m0=new(typeof TextDecoder>"u"?(0,module.require)("util").TextDecoder:TextDecoder)("utf-8",{ignoreBOM:!0,fatal:!0});function jt(t,e){return t>>>=0,m0.decode(Gr().subarray(t,t+e))}function H(t){const e=be(t);return function(n){n<132||(yt[n]=mi,mi=n)}(t),e}function jn(t){return t==null}m0.decode();const g0=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>{w.__wbindgen_export_4.get(t.dtor)(t.a,t.b)});function _0(t,e,n,o){const r={a:t,b:e,cnt:1,dtor:n},s=(...i)=>{r.cnt++;const a=r.a;r.a=0;try{return o(a,r.b,...i)}finally{--r.cnt===0?(w.__wbindgen_export_4.get(r.dtor)(a,r.b),g0.unregister(r)):r.a=a}};return s.original=r,g0.register(s,r,r),s}function gu(t){const e=typeof t;if(e=="number"||e=="boolean"||t==null)return`${t}`;if(e=="string")return`"${t}"`;if(e=="symbol"){const r=t.description;return r==null?"Symbol":`Symbol(${r})`}if(e=="function"){const r=t.name;return typeof r=="string"&&r.length>0?`Function(${r})`:"Function"}if(Array.isArray(t)){const r=t.length;let s="[";r>0&&(s+=gu(t[0]));for(let i=1;i<r;i++)s+=", "+gu(t[i]);return s+="]",s}const n=/\[object ([^\]]+)\]/.exec(toString.call(t));let o;if(!(n&&n.length>1))return toString.call(t);if(o=n[1],o=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message}
|
119
119
|
${t.stack}`:o}function Zn(t,e){return t>>>=0,Gr().subarray(t/1,t/1+e)}function $o(t,e){const n=e(1*t.length,1)>>>0;return Gr().set(t,n/1),$e=t.length,n}function En(t,e){t>>>=0;const n=L(),o=[];for(let r=t;r<t+4*e;r+=4)o.push(H(n.getUint32(r,!0)));return o}function _n(t,e){const n=e(4*t.length,4)>>>0,o=L();for(let r=0;r<t.length;r++)o.setUint32(n+4*r,oe(t[r]),!0);return $e=t.length,n}let Jt=128;function un(t){if(Jt==1)throw new Error("out of js stack");return yt[--Jt]=t,Jt}function Jr(t,e){if(!(t instanceof e))throw new Error(`expected instance of ${e.name}`)}function E5(t,e,n){w.__wbindgen_export_5(t,e,oe(n))}function I5(t,e){w.__wbindgen_export_6(t,e)}const b0=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_awarenesswasm_free(t>>>0,1));class y0{__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,b0.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_awarenesswasm_free(e,0)}constructor(e,n){const o=w.awarenesswasm_new(oe(e),n);return this.__wbg_ptr=o>>>0,b0.register(this,this.__wbg_ptr,this),this}encode(e){try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.awarenesswasm_encode(s,this.__wbg_ptr,oe(e));var n=L().getInt32(s+0,!0),o=L().getInt32(s+4,!0),r=Zn(n,o).slice();return w.__wbindgen_export_3(n,1*o,1),r}finally{w.__wbindgen_add_to_stack_pointer(16)}}encodeAll(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.awarenesswasm_encodeAll(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=Zn(e,n).slice();return w.__wbindgen_export_3(e,1*n,1),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}apply(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=$o(e,w.__wbindgen_export_0),i=$e;w.awarenesswasm_apply(r,this.__wbg_ptr,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}setLocalState(e){w.awarenesswasm_setLocalState(this.__wbg_ptr,oe(e))}peer(){return H(w.awarenesswasm_peer(this.__wbg_ptr))}getAllStates(){return H(w.awarenesswasm_getAllStates(this.__wbg_ptr))}getState(e){return H(w.awarenesswasm_getState(this.__wbg_ptr,oe(e)))}getTimestamp(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.awarenesswasm_getTimestamp(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getFloat64(r+8,!0);return n===0?void 0:o}finally{w.__wbindgen_add_to_stack_pointer(16)}}removeOutdated(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.awarenesswasm_removeOutdated(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=En(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}length(){return w.awarenesswasm_length(this.__wbg_ptr)}isEmpty(){return w.awarenesswasm_isEmpty(this.__wbg_ptr)!==0}peers(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.awarenesswasm_peers(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=En(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}}const x0=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_changemodifier_free(t>>>0,1));class Kr{static __wrap(e){e>>>=0;const n=Object.create(Kr.prototype);return n.__wbg_ptr=e,x0.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,x0.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_changemodifier_free(e,0)}setMessage(e){const n=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=$e,r=w.changemodifier_setMessage(this.__wbg_ptr,n,o);return Kr.__wrap(r)}setTimestamp(e){const n=w.changemodifier_setTimestamp(this.__wbg_ptr,e);return Kr.__wrap(n)}}const w0=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_cursor_free(t>>>0,1));class Hn{static __wrap(e){e>>>=0;const n=Object.create(Hn.prototype);return n.__wbg_ptr=e,w0.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,w0.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_cursor_free(e,0)}containerId(){return H(w.cursor_containerId(this.__wbg_ptr))}pos(){return H(w.cursor_pos(this.__wbg_ptr))}side(){return H(w.cursor_side(this.__wbg_ptr))}encode(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.cursor_encode(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=Zn(e,n).slice();return w.__wbindgen_export_3(e,1*n,1),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}static decode(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=$o(e,w.__wbindgen_export_0),i=$e;w.cursor_decode(r,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return Hn.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}kind(){return H(w.cursor_kind(this.__wbg_ptr))}}const v0=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_ephemeralstorewasm_free(t>>>0,1)),_u=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorocounter_free(t>>>0,1));class gi{static __wrap(e){e>>>=0;const n=Object.create(gi.prototype);return n.__wbg_ptr=e,_u.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,_u.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_lorocounter_free(e,0)}constructor(){const e=w.lorocounter_new();return this.__wbg_ptr=e>>>0,_u.register(this,this.__wbg_ptr,this),this}kind(){return H(w.lorocounter_kind(this.__wbg_ptr))}get id(){return H(w.lorocounter_id(this.__wbg_ptr))}increment(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorocounter_increment(o,this.__wbg_ptr,e);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}decrement(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorocounter_decrement(o,this.__wbg_ptr,e);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get value(){return w.lorocounter_value(this.__wbg_ptr)}subscribe(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorocounter_subscribe(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}parent(){return H(w.lorocounter_parent(this.__wbg_ptr))}isAttached(){return w.lorocounter_isAttached(this.__wbg_ptr)!==0}getAttached(){return H(w.lorocounter_getAttached(this.__wbg_ptr))}getShallowValue(){return w.lorocounter_getShallowValue(this.__wbg_ptr)}}const bu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorodoc_free(t>>>0,1));class po{static __wrap(e){e>>>=0;const n=Object.create(po.prototype);return n.__wbg_ptr=e,bu.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,bu.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_lorodoc_free(e,0)}constructor(){const e=w.lorodoc_new();return this.__wbg_ptr=e>>>0,bu.register(this,this.__wbg_ptr,this),this}setDetachedEditing(e){w.lorodoc_setDetachedEditing(this.__wbg_ptr,e)}isDetachedEditingEnabled(){return w.lorodoc_isDetachedEditingEnabled(this.__wbg_ptr)!==0}setRecordTimestamp(e){w.lorodoc_setRecordTimestamp(this.__wbg_ptr,e)}setChangeMergeInterval(e){w.lorodoc_setChangeMergeInterval(this.__wbg_ptr,e)}configTextStyle(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_configTextStyle(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}configDefaultTextStyle(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_configDefaultTextStyle(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}static fromSnapshot(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=$o(e,w.__wbindgen_export_0),i=$e;w.lorodoc_fromSnapshot(r,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return po.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}attach(){w.lorodoc_attach(this.__wbg_ptr)}isDetached(){return w.lorodoc_isDetached(this.__wbg_ptr)!==0}detach(){w.lorodoc_detach(this.__wbg_ptr)}fork(){const e=w.lorodoc_fork(this.__wbg_ptr);return po.__wrap(e)}forkAt(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=_n(e,w.__wbindgen_export_0),i=$e;w.lorodoc_forkAt(r,this.__wbg_ptr,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return po.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}checkoutToLatest(){try{const n=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_checkoutToLatest(n,this.__wbg_ptr);var e=L().getInt32(n+0,!0);if(L().getInt32(n+4,!0))throw H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}travelChangeAncestors(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=_n(e,w.__wbindgen_export_0),i=$e;w.lorodoc_travelChangeAncestors(r,this.__wbg_ptr,s,i,oe(n));var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}findIdSpansBetween(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16),i=_n(e,w.__wbindgen_export_0),a=$e,l=_n(n,w.__wbindgen_export_0),c=$e;w.lorodoc_findIdSpansBetween(s,this.__wbg_ptr,i,a,l,c);var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}checkout(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16),r=_n(e,w.__wbindgen_export_0),s=$e;w.lorodoc_checkout(o,this.__wbg_ptr,r,s);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get peerId(){const e=w.lorodoc_peerId(this.__wbg_ptr);return BigInt.asUintN(64,e)}get peerIdStr(){return H(w.lorodoc_peerIdStr(this.__wbg_ptr))}setPeerId(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_setPeerId(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}commit(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_commit(o,this.__wbg_ptr,jn(e)?0:oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getPendingTxnLength(){return w.lorodoc_getPendingTxnLength(this.__wbg_ptr)>>>0}getText(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getText(r,this.__wbg_ptr,un(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return Wo.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),yt[Jt++]=void 0}}getMap(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getMap(r,this.__wbg_ptr,un(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return Ho.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),yt[Jt++]=void 0}}getList(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getList(r,this.__wbg_ptr,un(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return _i.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),yt[Jt++]=void 0}}getMovableList(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getMovableList(r,this.__wbg_ptr,un(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return bi.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),yt[Jt++]=void 0}}getCounter(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getCounter(r,this.__wbg_ptr,un(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return gi.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),yt[Jt++]=void 0}}getTree(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getTree(r,this.__wbg_ptr,un(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return yi.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),yt[Jt++]=void 0}}hasContainer(e){return w.lorodoc_hasContainer(this.__wbg_ptr,oe(e))!==0}getContainerById(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getContainerById(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}setNextCommitMessage(e){const n=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=$e;w.lorodoc_setNextCommitMessage(this.__wbg_ptr,n,o)}setNextCommitOrigin(e){const n=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=$e;w.lorodoc_setNextCommitOrigin(this.__wbg_ptr,n,o)}setNextCommitTimestamp(e){w.lorodoc_setNextCommitTimestamp(this.__wbg_ptr,e)}setNextCommitOptions(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_setNextCommitOptions(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}clearNextCommitOptions(){w.lorodoc_clearNextCommitOptions(this.__wbg_ptr)}getDeepValueWithID(){return H(w.lorodoc_getDeepValueWithID(this.__wbg_ptr))}getPathToContainer(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getPathToContainer(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}JSONPath(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),i=$e;w.lorodoc_JSONPath(r,this.__wbg_ptr,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}version(){const e=w.lorodoc_version(this.__wbg_ptr);return In.__wrap(e)}shallowSinceVV(){const e=w.lorodoc_shallowSinceVV(this.__wbg_ptr);return In.__wrap(e)}isShallow(){return w.lorodoc_isShallow(this.__wbg_ptr)!==0}shallowSinceFrontiers(){return H(w.lorodoc_shallowSinceFrontiers(this.__wbg_ptr))}oplogVersion(){const e=w.lorodoc_oplogVersion(this.__wbg_ptr);return In.__wrap(e)}frontiers(){return H(w.lorodoc_frontiers(this.__wbg_ptr))}oplogFrontiers(){return H(w.lorodoc_oplogFrontiers(this.__wbg_ptr))}cmpWithFrontiers(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=_n(e,w.__wbindgen_export_0),i=$e;w.lorodoc_cmpWithFrontiers(r,this.__wbg_ptr,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return n}finally{w.__wbindgen_add_to_stack_pointer(16)}}cmpFrontiers(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16),i=_n(e,w.__wbindgen_export_0),a=$e,l=_n(n,w.__wbindgen_export_0),c=$e;w.lorodoc_cmpFrontiers(s,this.__wbg_ptr,i,a,l,c);var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}exportSnapshot(){try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_exportSnapshot(s,this.__wbg_ptr);var e=L().getInt32(s+0,!0),n=L().getInt32(s+4,!0),o=L().getInt32(s+8,!0);if(L().getInt32(s+12,!0))throw H(o);var r=Zn(e,n).slice();return w.__wbindgen_export_3(e,1*n,1),r}finally{w.__wbindgen_add_to_stack_pointer(16)}}exportFrom(e){try{const i=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_exportFrom(i,this.__wbg_ptr,oe(e));var n=L().getInt32(i+0,!0),o=L().getInt32(i+4,!0),r=L().getInt32(i+8,!0);if(L().getInt32(i+12,!0))throw H(r);var s=Zn(n,o).slice();return w.__wbindgen_export_3(n,1*o,1),s}finally{w.__wbindgen_add_to_stack_pointer(16)}}export(e){try{const i=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_export(i,this.__wbg_ptr,oe(e));var n=L().getInt32(i+0,!0),o=L().getInt32(i+4,!0),r=L().getInt32(i+8,!0);if(L().getInt32(i+12,!0))throw H(r);var s=Zn(n,o).slice();return w.__wbindgen_export_3(n,1*o,1),s}finally{w.__wbindgen_add_to_stack_pointer(16)}}exportJsonUpdates(e,n,o){try{const i=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_exportJsonUpdates(i,this.__wbg_ptr,oe(e),oe(n),jn(o)?16777215:o?1:0);var r=L().getInt32(i+0,!0),s=L().getInt32(i+4,!0);if(L().getInt32(i+8,!0))throw H(s);return H(r)}finally{w.__wbindgen_add_to_stack_pointer(16)}}exportJsonInIdSpan(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_exportJsonInIdSpan(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}importJsonUpdates(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_importJsonUpdates(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}import(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=$o(e,w.__wbindgen_export_0),i=$e;w.lorodoc_import(r,this.__wbg_ptr,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}importUpdateBatch(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_importBatch(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}importBatch(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_importBatch(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getShallowValue(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getShallowValue(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_toJSON(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}subscribe(e){return H(w.lorodoc_subscribe(this.__wbg_ptr,oe(e)))}subscribeLocalUpdates(e){return H(w.lorodoc_subscribeLocalUpdates(this.__wbg_ptr,oe(e)))}debugHistory(){w.lorodoc_debugHistory(this.__wbg_ptr)}changeCount(){return w.lorodoc_changeCount(this.__wbg_ptr)>>>0}opCount(){return w.lorodoc_opCount(this.__wbg_ptr)>>>0}getAllChanges(){return H(w.lorodoc_getAllChanges(this.__wbg_ptr))}getChangeAt(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getChangeAt(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getChangeAtLamport(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16),i=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),a=$e;w.lorodoc_getChangeAtLamport(s,this.__wbg_ptr,i,a,n);var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getOpsInChange(e){try{const i=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getOpsInChange(i,this.__wbg_ptr,oe(e));var n=L().getInt32(i+0,!0),o=L().getInt32(i+4,!0),r=L().getInt32(i+8,!0);if(L().getInt32(i+12,!0))throw H(r);var s=En(n,o).slice();return w.__wbindgen_export_3(n,4*o,4),s}finally{w.__wbindgen_add_to_stack_pointer(16)}}frontiersToVV(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=_n(e,w.__wbindgen_export_0),i=$e;w.lorodoc_frontiersToVV(r,this.__wbg_ptr,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return In.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}vvToFrontiers(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);Jr(e,In),w.lorodoc_vvToFrontiers(r,this.__wbg_ptr,e.__wbg_ptr);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getByPath(e){const n=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=$e;return H(w.lorodoc_getByPath(this.__wbg_ptr,n,o))}getCursorPos(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);Jr(e,Hn),w.lorodoc_getCursorPos(r,this.__wbg_ptr,e.__wbg_ptr);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getChangedContainersIn(e,n){try{const a=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getChangedContainersIn(a,this.__wbg_ptr,oe(e),n);var o=L().getInt32(a+0,!0),r=L().getInt32(a+4,!0),s=L().getInt32(a+8,!0);if(L().getInt32(a+12,!0))throw H(s);var i=En(o,r).slice();return w.__wbindgen_export_3(o,4*r,4),i}finally{w.__wbindgen_add_to_stack_pointer(16)}}revertTo(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16),r=_n(e,w.__wbindgen_export_0),s=$e;w.lorodoc_revertTo(o,this.__wbg_ptr,r,s);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}applyDiff(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_applyDiff(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}diff(e,n,o){try{const i=w.__wbindgen_add_to_stack_pointer(-16),a=_n(e,w.__wbindgen_export_0),l=$e,c=_n(n,w.__wbindgen_export_0),d=$e;w.lorodoc_diff(i,this.__wbg_ptr,a,l,c,d,jn(o)?16777215:o?1:0);var r=L().getInt32(i+0,!0),s=L().getInt32(i+4,!0);if(L().getInt32(i+8,!0))throw H(s);return H(r)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getUncommittedOpsAsJson(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getUncommittedOpsAsJson(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}subscribeFirstCommitFromPeer(e){return H(w.lorodoc_subscribeFirstCommitFromPeer(this.__wbg_ptr,oe(e)))}subscribePreCommit(e){return H(w.lorodoc_subscribePreCommit(this.__wbg_ptr,oe(e)))}deleteRootContainer(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_deleteRootContainer(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}setHideEmptyRootContainers(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_setHideEmptyRootContainers(o,this.__wbg_ptr,e);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}}const yu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorolist_free(t>>>0,1));class _i{static __wrap(e){e>>>=0;const n=Object.create(_i.prototype);return n.__wbg_ptr=e,yu.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,yu.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_lorolist_free(e,0)}constructor(){const e=w.lorolist_new();return this.__wbg_ptr=e>>>0,yu.register(this,this.__wbg_ptr,this),this}kind(){return H(w.lorolist_kind(this.__wbg_ptr))}insert(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_insert(r,this.__wbg_ptr,e,oe(n));var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}delete(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_delete(r,this.__wbg_ptr,e,n);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get(e){return H(w.lorolist_get(this.__wbg_ptr,e))}get id(){return H(w.lorolist_id(this.__wbg_ptr))}toArray(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_toArray(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=En(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return H(w.lorolist_toJSON(this.__wbg_ptr))}insertContainer(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_insertContainer(s,this.__wbg_ptr,e,oe(n));var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}pushContainer(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_pushContainer(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}subscribe(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_subscribe(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get length(){return w.lorolist_length(this.__wbg_ptr)>>>0}parent(){return H(w.lorolist_parent(this.__wbg_ptr))}isAttached(){return w.lorolist_isAttached(this.__wbg_ptr)!==0}getAttached(){return H(w.lorolist_getAttached(this.__wbg_ptr))}getCursor(e,n){const o=w.lorolist_getCursor(this.__wbg_ptr,e,oe(n));return o===0?void 0:Hn.__wrap(o)}push(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_push(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}pop(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_pop(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}clear(){try{const n=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_clear(n,this.__wbg_ptr);var e=L().getInt32(n+0,!0);if(L().getInt32(n+4,!0))throw H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getIdAt(e){return H(w.lorolist_getIdAt(this.__wbg_ptr,e))}isDeleted(){return w.lorolist_isDeleted(this.__wbg_ptr)!==0}getShallowValue(){return H(w.lorolist_getShallowValue(this.__wbg_ptr))}}const xu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_loromap_free(t>>>0,1));class Ho{static __wrap(e){e>>>=0;const n=Object.create(Ho.prototype);return n.__wbg_ptr=e,xu.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,xu.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_loromap_free(e,0)}constructor(){const e=w.loromap_new();return this.__wbg_ptr=e>>>0,xu.register(this,this.__wbg_ptr,this),this}kind(){return H(w.loromap_kind(this.__wbg_ptr))}set(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),i=$e;w.loromap_set(r,this.__wbg_ptr,s,i,oe(n));var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}delete(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16),r=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),s=$e;w.loromap_delete(o,this.__wbg_ptr,r,s);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get(e){const n=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=$e;return H(w.loromap_get(this.__wbg_ptr,n,o))}getOrCreateContainer(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16),i=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),a=$e;w.loromap_getOrCreateContainer(s,this.__wbg_ptr,i,a,oe(n));var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}keys(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromap_keys(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=En(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}values(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromap_values(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=En(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}entries(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromap_entries(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=En(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}get id(){return H(w.loromap_id(this.__wbg_ptr))}toJSON(){return H(w.loromap_toJSON(this.__wbg_ptr))}setContainer(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16),i=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),a=$e;w.loromap_setContainer(s,this.__wbg_ptr,i,a,oe(n));var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}subscribe(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromap_subscribe(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get size(){return w.loromap_size(this.__wbg_ptr)>>>0}parent(){return H(w.loromap_parent(this.__wbg_ptr))}isAttached(){return w.loromap_isAttached(this.__wbg_ptr)!==0}getAttached(){return H(w.loromap_getAttached(this.__wbg_ptr))}clear(){try{const n=w.__wbindgen_add_to_stack_pointer(-16);w.loromap_clear(n,this.__wbg_ptr);var e=L().getInt32(n+0,!0);if(L().getInt32(n+4,!0))throw H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getLastEditor(e){const n=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=$e;return H(w.loromap_getLastEditor(this.__wbg_ptr,n,o))}isDeleted(){return w.loromap_isDeleted(this.__wbg_ptr)!==0}getShallowValue(){return H(w.loromap_getShallowValue(this.__wbg_ptr))}}const wu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_loromovablelist_free(t>>>0,1));class bi{static __wrap(e){e>>>=0;const n=Object.create(bi.prototype);return n.__wbg_ptr=e,wu.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,wu.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_loromovablelist_free(e,0)}constructor(){const e=w.loromovablelist_new();return this.__wbg_ptr=e>>>0,wu.register(this,this.__wbg_ptr,this),this}kind(){return H(w.loromovablelist_kind(this.__wbg_ptr))}insert(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_insert(r,this.__wbg_ptr,e,oe(n));var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}delete(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_delete(r,this.__wbg_ptr,e,n);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get(e){return H(w.loromovablelist_get(this.__wbg_ptr,e))}get id(){return H(w.loromovablelist_id(this.__wbg_ptr))}toArray(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_toArray(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=En(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return H(w.loromovablelist_toJSON(this.__wbg_ptr))}insertContainer(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_insertContainer(s,this.__wbg_ptr,e,oe(n));var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}pushContainer(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_pushContainer(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}subscribe(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_subscribe(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get length(){return w.loromovablelist_length(this.__wbg_ptr)>>>0}parent(){return H(w.loromovablelist_parent(this.__wbg_ptr))}isAttached(){return w.loromovablelist_isAttached(this.__wbg_ptr)!==0}getAttached(){return H(w.loromovablelist_getAttached(this.__wbg_ptr))}getCursor(e,n){const o=w.loromovablelist_getCursor(this.__wbg_ptr,e,oe(n));return o===0?void 0:Hn.__wrap(o)}move(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_move(r,this.__wbg_ptr,e,n);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}set(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_set(r,this.__wbg_ptr,e,oe(n));var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}setContainer(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_setContainer(s,this.__wbg_ptr,e,oe(n));var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}push(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_push(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}pop(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_pop(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}clear(){try{const n=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_clear(n,this.__wbg_ptr);var e=L().getInt32(n+0,!0);if(L().getInt32(n+4,!0))throw H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getCreatorAt(e){return H(w.loromovablelist_getCreatorAt(this.__wbg_ptr,e))}getLastMoverAt(e){return H(w.loromovablelist_getLastMoverAt(this.__wbg_ptr,e))}getLastEditorAt(e){return H(w.loromovablelist_getLastEditorAt(this.__wbg_ptr,e))}isDeleted(){return w.loromovablelist_isDeleted(this.__wbg_ptr)!==0}getShallowValue(){return H(w.loromovablelist_getShallowValue(this.__wbg_ptr))}}const vu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorotext_free(t>>>0,1));class Wo{static __wrap(e){e>>>=0;const n=Object.create(Wo.prototype);return n.__wbg_ptr=e,vu.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,vu.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_lorotext_free(e,0)}constructor(){const e=w.lorotext_new();return this.__wbg_ptr=e>>>0,vu.register(this,this.__wbg_ptr,this),this}kind(){return H(w.lorotext_kind(this.__wbg_ptr))}iter(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_iter(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}update(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),i=$e;w.lorotext_update(r,this.__wbg_ptr,s,i,oe(n));var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}updateByLine(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),i=$e;w.lorotext_updateByLine(r,this.__wbg_ptr,s,i,oe(n));var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}insert(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=ft(n,w.__wbindgen_export_0,w.__wbindgen_export_1),i=$e;w.lorotext_insert(r,this.__wbg_ptr,e,s,i);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}slice(e,n){let o,r;try{const h=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_slice(h,this.__wbg_ptr,e,n);var s=L().getInt32(h+0,!0),i=L().getInt32(h+4,!0),a=L().getInt32(h+8,!0),l=L().getInt32(h+12,!0),c=s,d=i;if(l)throw c=0,d=0,H(a);return o=c,r=d,jt(c,d)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(o,r,1)}}charAt(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_charAt(r,this.__wbg_ptr,e);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return String.fromCodePoint(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}splice(e,n,o){let r,s;try{const f=w.__wbindgen_add_to_stack_pointer(-16),p=ft(o,w.__wbindgen_export_0,w.__wbindgen_export_1),_=$e;w.lorotext_splice(f,this.__wbg_ptr,e,n,p,_);var i=L().getInt32(f+0,!0),a=L().getInt32(f+4,!0),l=L().getInt32(f+8,!0),c=L().getInt32(f+12,!0),d=i,h=a;if(c)throw d=0,h=0,H(l);return r=d,s=h,jt(d,h)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(r,s,1)}}insertUtf8(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=ft(n,w.__wbindgen_export_0,w.__wbindgen_export_1),i=$e;w.lorotext_insertUtf8(r,this.__wbg_ptr,e,s,i);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}delete(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_delete(r,this.__wbg_ptr,e,n);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}deleteUtf8(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_deleteUtf8(r,this.__wbg_ptr,e,n);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}mark(e,n,o){try{const s=w.__wbindgen_add_to_stack_pointer(-16),i=ft(n,w.__wbindgen_export_0,w.__wbindgen_export_1),a=$e;w.lorotext_mark(s,this.__wbg_ptr,oe(e),i,a,oe(o));var r=L().getInt32(s+0,!0);if(L().getInt32(s+4,!0))throw H(r)}finally{w.__wbindgen_add_to_stack_pointer(16)}}unmark(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=ft(n,w.__wbindgen_export_0,w.__wbindgen_export_1),i=$e;w.lorotext_unmark(r,this.__wbg_ptr,oe(e),s,i);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}toString(){let e,n;try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_toString(s,this.__wbg_ptr);var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);return e=o,n=r,jt(o,r)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(e,n,1)}}toDelta(){return H(w.lorotext_toDelta(this.__wbg_ptr))}get id(){return H(w.lorotext_id(this.__wbg_ptr))}get length(){return w.lorotext_length(this.__wbg_ptr)>>>0}subscribe(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_subscribe(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}applyDelta(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_applyDelta(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}parent(){return H(w.lorotext_parent(this.__wbg_ptr))}isAttached(){return w.lorotext_isAttached(this.__wbg_ptr)!==0}getAttached(){return H(w.lorotext_getAttached(this.__wbg_ptr))}getCursor(e,n){const o=w.lorotext_getCursor(this.__wbg_ptr,e,oe(n));return o===0?void 0:Hn.__wrap(o)}push(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16),r=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),s=$e;w.lorotext_push(o,this.__wbg_ptr,r,s);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getEditorOf(e){return H(w.lorotext_getEditorOf(this.__wbg_ptr,e))}isDeleted(){return w.lorotext_isDeleted(this.__wbg_ptr)!==0}getShallowValue(){let e,n;try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_getShallowValue(s,this.__wbg_ptr);var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);return e=o,n=r,jt(o,r)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(e,n,1)}}toJSON(){return H(w.lorotext_toJSON(this.__wbg_ptr))}}const ku=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorotree_free(t>>>0,1));class yi{static __wrap(e){e>>>=0;const n=Object.create(yi.prototype);return n.__wbg_ptr=e,ku.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,ku.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_lorotree_free(e,0)}constructor(){const e=w.lorotree_new();return this.__wbg_ptr=e>>>0,ku.register(this,this.__wbg_ptr,this),this}kind(){return H(w.lorotree_kind(this.__wbg_ptr))}createNode(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_createNode(s,this.__wbg_ptr,un(e),jn(n)?4294967297:n>>>0);var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return Qn.__wrap(o)}finally{w.__wbindgen_add_to_stack_pointer(16),yt[Jt++]=void 0}}move(e,n,o){try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_move(s,this.__wbg_ptr,un(e),un(n),jn(o)?4294967297:o>>>0);var r=L().getInt32(s+0,!0);if(L().getInt32(s+4,!0))throw H(r)}finally{w.__wbindgen_add_to_stack_pointer(16),yt[Jt++]=void 0,yt[Jt++]=void 0}}delete(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_delete(o,this.__wbg_ptr,un(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16),yt[Jt++]=void 0}}getNodeByID(e){try{const n=w.lorotree_getNodeByID(this.__wbg_ptr,un(e));return n===0?void 0:Qn.__wrap(n)}finally{yt[Jt++]=void 0}}get id(){return H(w.lorotree_id(this.__wbg_ptr))}has(e){try{return w.lorotree_has(this.__wbg_ptr,un(e))!==0}finally{yt[Jt++]=void 0}}isNodeDeleted(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_isNodeDeleted(r,this.__wbg_ptr,un(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return n!==0}finally{w.__wbindgen_add_to_stack_pointer(16),yt[Jt++]=void 0}}toArray(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_toArray(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getNodes(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_getNodes(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return H(w.lorotree_toJSON(this.__wbg_ptr))}nodes(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_nodes(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=En(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}roots(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_roots(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=En(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}subscribe(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_subscribe(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}parent(){return H(w.lorotree_parent(this.__wbg_ptr))}isAttached(){return w.lorotree_isAttached(this.__wbg_ptr)!==0}getAttached(){return H(w.lorotree_getAttached(this.__wbg_ptr))}enableFractionalIndex(e){w.lorotree_enableFractionalIndex(this.__wbg_ptr,e)}disableFractionalIndex(){w.lorotree_disableFractionalIndex(this.__wbg_ptr)}isFractionalIndexEnabled(){return w.lorotree_isFractionalIndexEnabled(this.__wbg_ptr)!==0}isDeleted(){return w.lorotree_isDeleted(this.__wbg_ptr)!==0}getShallowValue(){return H(w.lorotree_getShallowValue(this.__wbg_ptr))}}const k0=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorotreenode_free(t>>>0,1));class Qn{static __wrap(e){e>>>=0;const n=Object.create(Qn.prototype);return n.__wbg_ptr=e,k0.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,k0.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_lorotreenode_free(e,0)}__getClassname(){let e,n;try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode___getClassname(s,this.__wbg_ptr);var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);return e=o,n=r,jt(o,r)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(e,n,1)}}get id(){return H(w.lorotreenode_id(this.__wbg_ptr))}createNode(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_createNode(r,this.__wbg_ptr,jn(e)?4294967297:e>>>0);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return Qn.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}move(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_move(r,this.__wbg_ptr,un(e),jn(n)?4294967297:n>>>0);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16),yt[Jt++]=void 0}}moveAfter(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);Jr(e,Qn),w.lorotreenode_moveAfter(o,this.__wbg_ptr,e.__wbg_ptr);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}moveBefore(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);Jr(e,Qn),w.lorotreenode_moveBefore(o,this.__wbg_ptr,e.__wbg_ptr);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}index(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_index(o,this.__wbg_ptr);var e=L().getFloat64(o+0,!0),n=L().getInt32(o+8,!0);if(L().getInt32(o+12,!0))throw H(n);return e===4294967297?void 0:e}finally{w.__wbindgen_add_to_stack_pointer(16)}}fractionalIndex(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_fractionalIndex(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get data(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_data(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return Ho.__wrap(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_toJSON(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}parent(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_parent(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return e===0?void 0:Qn.__wrap(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}children(){return H(w.lorotreenode_children(this.__wbg_ptr))}isDeleted(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_isDeleted(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return e!==0}finally{w.__wbindgen_add_to_stack_pointer(16)}}getLastMoveId(){return H(w.lorotreenode_getLastMoveId(this.__wbg_ptr))}creationId(){return H(w.lorotreenode_creationId(this.__wbg_ptr))}creator(){return H(w.lorotreenode_creator(this.__wbg_ptr))}}const S0=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_undomanager_free(t>>>0,1)),Su=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_versionvector_free(t>>>0,1));class In{static __wrap(e){e>>>=0;const n=Object.create(In.prototype);return n.__wbg_ptr=e,Su.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Su.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_versionvector_free(e,0)}constructor(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_new(r,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return this.__wbg_ptr=n>>>0,Su.register(this,this.__wbg_ptr,this),this}finally{w.__wbindgen_add_to_stack_pointer(16)}}static parseJSON(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_parseJSON(r,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return In.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return H(w.versionvector_toJSON(this.__wbg_ptr))}encode(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_encode(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=Zn(e,n).slice();return w.__wbindgen_export_3(e,1*n,1),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}static decode(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=$o(e,w.__wbindgen_export_0),i=$e;w.versionvector_decode(r,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return In.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_get(r,this.__wbg_ptr,oe(e));var n=L().getFloat64(r+0,!0),o=L().getInt32(r+8,!0);if(L().getInt32(r+12,!0))throw H(o);return n===4294967297?void 0:n}finally{w.__wbindgen_add_to_stack_pointer(16)}}compare(e){Jr(e,In);const n=w.versionvector_compare(this.__wbg_ptr,e.__wbg_ptr);return n===4294967297?void 0:n}setEnd(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_setEnd(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}setLast(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_setLast(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}remove(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_remove(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}length(){return w.versionvector_length(this.__wbg_ptr)>>>0}}function C0(t,e){const n=ft(String(be(e)),w.__wbindgen_export_0,w.__wbindgen_export_1),o=$e;L().setInt32(t+4,o,!0),L().setInt32(t+0,n,!0)}function N0(){return Yt(function(t,e,n){return oe(Reflect.apply(be(t),be(e),be(n)))},arguments)}function j0(t){return oe(be(t).buffer)}function E0(){return Yt(function(t,e){return oe(be(t).call(be(e)))},arguments)}function I0(){return Yt(function(t,e,n){return oe(be(t).call(be(e),be(n)))},arguments)}function A0(){return Yt(function(t,e,n,o,r){return oe(be(t).call(be(e),be(n),be(o),be(r)))},arguments)}function T0(){return Yt(function(t,e,n,o){return oe(be(t).call(be(e),be(n),be(o)))},arguments)}function M0(t){return oe(Kr.__wrap(t))}function O0(t){return oe(be(t).crypto)}function D0(t){return oe(Hn.__wrap(t))}function R0(t){return be(t).done}function P0(t){return oe(be(t).entries())}function L0(t){return oe(Object.entries(be(t)))}function F0(t,e){let n,o;try{n=t,o=e,console.error(jt(t,e))}finally{w.__wbindgen_export_3(n,o,1)}}function z0(t,e){console.error(jt(t,e))}function B0(t){return oe(Array.from(be(t)))}function U0(){return Yt(function(t,e){be(t).getRandomValues(be(e))},arguments)}function V0(t,e){return oe(be(t)[e>>>0])}function $0(){return Yt(function(t,e){return oe(Reflect.get(be(t),be(e)))},arguments)}function H0(t,e){return be(t)[e>>>0]}function W0(t,e){return oe(be(t)[be(e)])}function q0(){return Yt(function(){return oe(globalThis.globalThis)},arguments)}function G0(){return Yt(function(){return oe(global.global)},arguments)}function Y0(t){let e;try{e=be(t)instanceof ArrayBuffer}catch{e=!1}return e}function J0(t){let e;try{e=be(t)instanceof Map}catch{e=!1}return e}function K0(t){let e;try{e=be(t)instanceof Object}catch{e=!1}return e}function X0(t){let e;try{e=be(t)instanceof Uint8Array}catch{e=!1}return e}function Z0(t){return Array.isArray(be(t))}function Q0(t){return Number.isSafeInteger(be(t))}function eb(){return oe(Symbol.iterator)}function tb(t){return be(t).length}function nb(t){return be(t).length}function ob(t,e,n,o,r,s,i,a){let l,c;try{l=t,c=e,console.log(jt(t,e),jt(n,o),jt(r,s),jt(i,a))}finally{w.__wbindgen_export_3(l,c,1)}}function rb(t,e){console.log(jt(t,e))}function sb(t,e){let n,o;try{n=t,o=e,console.log(jt(t,e))}finally{w.__wbindgen_export_3(n,o,1)}}function ib(t){return oe(gi.__wrap(t))}function ab(t){return oe(_i.__wrap(t))}function lb(t){return oe(Ho.__wrap(t))}function cb(t){return oe(bi.__wrap(t))}function db(t){return oe(Wo.__wrap(t))}function ub(t){return oe(yi.__wrap(t))}function hb(t){return oe(Qn.__wrap(t))}function fb(t,e){performance.mark(jt(t,e))}function pb(){return Yt(function(t,e,n,o){let r,s,i,a;try{r=t,s=e,i=n,a=o,performance.measure(jt(t,e),jt(n,o))}finally{w.__wbindgen_export_3(r,s,1),w.__wbindgen_export_3(i,a,1)}},arguments)}function mb(t){return oe(be(t).msCrypto)}function gb(){return oe(new Map)}function _b(t){return oe(new Uint8Array(be(t)))}function bb(){return oe(new Object)}function yb(){return oe(new Error)}function xb(){return oe(new Array)}function wb(t,e){return oe(new Function(jt(t,e)))}function vb(t,e,n){return oe(new Uint8Array(be(t),e>>>0,n>>>0))}function kb(t){return oe(new Uint8Array(t>>>0))}function Sb(t){return oe(new Array(t>>>0))}function Cb(t){return oe(be(t).next)}function Nb(){return Yt(function(t){return oe(be(t).next())},arguments)}function jb(t){return oe(be(t).node)}function Eb(){return Date.now()}function Ib(){return Yt(function(t){return oe(Reflect.ownKeys(be(t)))},arguments)}function Ab(t){return oe(be(t).process)}function Tb(t,e){return be(t).push(be(e))}function Mb(){return Yt(function(t,e){be(t).randomFillSync(H(e))},arguments)}function Ob(){return Yt(function(){return oe(module.require)},arguments)}function Db(t){return oe(Promise.resolve(be(t)))}function Rb(){return Yt(function(){return oe(self.self)},arguments)}function Pb(){return Yt(function(t,e,n){return Reflect.set(be(t),be(e),be(n))},arguments)}function Lb(t,e,n){return oe(be(t).set(be(e),be(n)))}function Fb(t,e,n){be(t)[H(e)]=H(n)}function zb(t,e,n){be(t).set(be(e),n>>>0)}function Bb(t,e,n){be(t)[e>>>0]=H(n)}function Ub(t,e,n){be(t)[e>>>0]=n}function Vb(t,e){const n=ft(be(e).stack,w.__wbindgen_export_0,w.__wbindgen_export_1),o=$e;L().setInt32(t+4,o,!0),L().setInt32(t+0,n,!0)}function $b(t,e,n){return oe(be(t).subarray(e>>>0,n>>>0))}function Hb(t,e){return oe(be(t).then(be(e)))}function Wb(t){return oe(be(t).value)}function qb(t){return oe(be(t).versions)}function Gb(t){return oe(In.__wrap(t))}function Yb(){return Yt(function(){return oe(window.window)},arguments)}function Jb(t){return+be(t)}function Kb(t){return oe(t)}function Xb(t){return oe(BigInt.asUintN(64,t))}function Zb(t,e){const n=be(e),o=typeof n=="bigint"?n:void 0;L().setBigInt64(t+8,jn(o)?BigInt(0):o,!0),L().setInt32(t+0,!jn(o),!0)}function Qb(t){const e=be(t);return typeof e=="boolean"?e?1:0:2}function ey(t){const e=H(t).original;return e.cnt--==1?(e.a=0,!0):!1}function ty(t,e,n){return oe(_0(t,e,10,E5))}function ny(t,e,n){return oe(_0(t,e,8,I5))}function oy(t,e){const n=ft(gu(be(e)),w.__wbindgen_export_0,w.__wbindgen_export_1),o=$e;L().setInt32(t+4,o,!0),L().setInt32(t+0,n,!0)}function ry(t,e){return oe(new Error(jt(t,e)))}function sy(t,e){return be(t)in be(e)}function iy(t){return Array.isArray(be(t))}function ay(t){return typeof be(t)=="bigint"}function ly(t){return!be(t)}function cy(t){return typeof be(t)=="function"}function dy(t){return be(t)===null}function uy(t){const e=be(t);return typeof e=="object"&&e!==null}function hy(t){return typeof be(t)=="string"}function fy(t){return be(t)===void 0}function py(t,e){return be(t)===be(e)}function my(t,e){return be(t)==be(e)}function gy(){return oe(w.memory)}function _y(t,e){const n=be(e),o=typeof n=="number"?n:void 0;L().setFloat64(t+8,jn(o)?0:o,!0),L().setInt32(t+0,!jn(o),!0)}function by(t){return oe(t)}function yy(t){return oe(be(t))}function xy(t){H(t)}function wy(t){throw H(t)}function vy(t,e){const n=be(e),o=typeof n=="string"?n:void 0;var r=jn(o)?0:ft(o,w.__wbindgen_export_0,w.__wbindgen_export_1),s=$e;L().setInt32(t+4,s,!0),L().setInt32(t+0,r,!0)}function ky(t,e){return oe(jt(t,e))}function Sy(t,e){throw new Error(jt(t,e))}function Cy(t){return oe(typeof be(t))}const A5=Object.freeze(Object.defineProperty({__proto__:null,AwarenessWasm:y0,ChangeModifier:Kr,Cursor:Hn,EphemeralStoreWasm:class{__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,v0.unregister(this),t}free(){const t=this.__destroy_into_raw();w.__wbg_ephemeralstorewasm_free(t,0)}constructor(t){const e=w.ephemeralstorewasm_new(t);return this.__wbg_ptr=e>>>0,v0.register(this,this.__wbg_ptr,this),this}set(t,e){const n=ft(t,w.__wbindgen_export_0,w.__wbindgen_export_1),o=$e;w.ephemeralstorewasm_set(this.__wbg_ptr,n,o,oe(e))}delete(t){const e=ft(t,w.__wbindgen_export_0,w.__wbindgen_export_1),n=$e;w.ephemeralstorewasm_delete(this.__wbg_ptr,e,n)}get(t){const e=ft(t,w.__wbindgen_export_0,w.__wbindgen_export_1),n=$e;return H(w.ephemeralstorewasm_get(this.__wbg_ptr,e,n))}getAllStates(){return H(w.ephemeralstorewasm_getAllStates(this.__wbg_ptr))}subscribeLocalUpdates(t){return H(w.ephemeralstorewasm_subscribeLocalUpdates(this.__wbg_ptr,oe(t)))}subscribe(t){return H(w.ephemeralstorewasm_subscribe(this.__wbg_ptr,oe(t)))}encode(t){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=ft(t,w.__wbindgen_export_0,w.__wbindgen_export_1),i=$e;w.ephemeralstorewasm_encode(r,this.__wbg_ptr,s,i);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=Zn(e,n).slice();return w.__wbindgen_export_3(e,1*n,1),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}encodeAll(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.ephemeralstorewasm_encodeAll(o,this.__wbg_ptr);var t=L().getInt32(o+0,!0),e=L().getInt32(o+4,!0),n=Zn(t,e).slice();return w.__wbindgen_export_3(t,1*e,1),n}finally{w.__wbindgen_add_to_stack_pointer(16)}}apply(t){const e=$o(t,w.__wbindgen_export_0),n=$e;w.ephemeralstorewasm_apply(this.__wbg_ptr,e,n)}removeOutdated(){w.ephemeralstorewasm_removeOutdated(this.__wbg_ptr)}isEmpty(){return w.ephemeralstorewasm_isEmpty(this.__wbg_ptr)!==0}keys(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.ephemeralstorewasm_keys(o,this.__wbg_ptr);var t=L().getInt32(o+0,!0),e=L().getInt32(o+4,!0),n=En(t,e).slice();return w.__wbindgen_export_3(t,4*e,4),n}finally{w.__wbindgen_add_to_stack_pointer(16)}}},LORO_VERSION:function(){let t,e;try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.LORO_VERSION(r);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);return t=n,e=o,jt(n,o)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(t,e,1)}},LoroCounter:gi,LoroDoc:po,LoroList:_i,LoroMap:Ho,LoroMovableList:bi,LoroText:Wo,LoroTree:yi,LoroTreeNode:Qn,UndoManager:class{__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,S0.unregister(this),t}free(){const t=this.__destroy_into_raw();w.__wbg_undomanager_free(t,0)}constructor(t,e){Jr(t,po);const n=w.undomanager_new(t.__wbg_ptr,oe(e));return this.__wbg_ptr=n>>>0,S0.register(this,this.__wbg_ptr,this),this}undo(){try{const n=w.__wbindgen_add_to_stack_pointer(-16);w.undomanager_undo(n,this.__wbg_ptr);var t=L().getInt32(n+0,!0),e=L().getInt32(n+4,!0);if(L().getInt32(n+8,!0))throw H(e);return t!==0}finally{w.__wbindgen_add_to_stack_pointer(16)}}redo(){try{const n=w.__wbindgen_add_to_stack_pointer(-16);w.undomanager_redo(n,this.__wbg_ptr);var t=L().getInt32(n+0,!0),e=L().getInt32(n+4,!0);if(L().getInt32(n+8,!0))throw H(e);return t!==0}finally{w.__wbindgen_add_to_stack_pointer(16)}}canUndo(){return w.undomanager_canUndo(this.__wbg_ptr)!==0}canRedo(){return w.undomanager_canRedo(this.__wbg_ptr)!==0}setMaxUndoSteps(t){w.undomanager_setMaxUndoSteps(this.__wbg_ptr,t)}setMergeInterval(t){w.undomanager_setMergeInterval(this.__wbg_ptr,t)}addExcludeOriginPrefix(t){const e=ft(t,w.__wbindgen_export_0,w.__wbindgen_export_1),n=$e;w.undomanager_addExcludeOriginPrefix(this.__wbg_ptr,e,n)}setOnPush(t){w.undomanager_setOnPush(this.__wbg_ptr,oe(t))}setOnPop(t){w.undomanager_setOnPop(this.__wbg_ptr,oe(t))}clear(){w.undomanager_clear(this.__wbg_ptr)}},VersionVector:In,__wbg_String_8f0eb39a4a4c2f66:C0,__wbg_apply_9bb7fe8fff013a3f:N0,__wbg_buffer_ef9774282e5dab94:j0,__wbg_call_0ad083564791763a:E0,__wbg_call_a34b6b4765f27be0:I0,__wbg_call_d00953b926be4879:A0,__wbg_call_efe5a4db7065d1a2:T0,__wbg_changemodifier_new:M0,__wbg_crypto_ed58b8e10a292839:O0,__wbg_cursor_new:D0,__wbg_done_f4c254830a095eaf:R0,__wbg_entries_4dce6361e3ba6fbc:P0,__wbg_entries_83beb641792ccb9c:L0,__wbg_error_7534b8e9a36f1ab4:F0,__wbg_error_9912f7d6d7835a4b:z0,__wbg_from_3aa0fcaa8eef0104:B0,__wbg_getRandomValues_bcb4912f16000dc4:U0,__wbg_get_0c3cc364764a0b98:V0,__wbg_get_b996a12be035ef4f:$0,__wbg_getindex_a471648b3037c750:H0,__wbg_getwithrefkey_1dc361bd10053bfe:W0,__wbg_globalThis_6b4d52a0b6aaeaea:q0,__wbg_global_49324ce12193de77:G0,__wbg_instanceof_ArrayBuffer_ff40e55b5978e215:Y0,__wbg_instanceof_Map_0f3f3653f757ced1:J0,__wbg_instanceof_Object_9108547bac1f91b1:K0,__wbg_instanceof_Uint8Array_db97368f94b1373f:X0,__wbg_isArray_8738f1062fa88586:Z0,__wbg_isSafeInteger_a1b3e0811faecf2f:Q0,__wbg_iterator_c0c688f37fa815e6:eb,__wbg_length_12246a78d2f65d3a:tb,__wbg_length_c24da17096edfe57:nb,__wbg_log_0cc1b7768397bcfe:ob,__wbg_log_0fd6c49475c7bece:rb,__wbg_log_cb9e190acc5753fb:sb,__wbg_lorocounter_new:ib,__wbg_lorolist_new:ab,__wbg_loromap_new:lb,__wbg_loromovablelist_new:cb,__wbg_lorotext_new:db,__wbg_lorotree_new:ub,__wbg_lorotreenode_new:hb,__wbg_mark_7438147ce31e9d4b:fb,__wbg_measure_fb7825c11612c823:pb,__wbg_msCrypto_0a36e2ec3a343d26:mb,__wbg_new_518e2184725aa711:gb,__wbg_new_59845962d1127937:_b,__wbg_new_67abf4a77618ee3e:bb,__wbg_new_8a6f238a6ece86ea:yb,__wbg_new_e2d07398d7689006:xb,__wbg_newnoargs_a136448eeb7d48ac:wb,__wbg_newwithbyteoffsetandlength_84908302a4c137cf:vb,__wbg_newwithlength_4c216eaaf23f2f9a:kb,__wbg_newwithlength_88b49de1eb24d63e:Sb,__wbg_next_928df8c15fc0c9b0:Cb,__wbg_next_9dc0926f351c7090:Nb,__wbg_node_02999533c4ea02e3:jb,__wbg_now_3e8577e703add0ba:Eb,__wbg_ownKeys_b16312a839a4152c:Ib,__wbg_process_5c1d670bc53614b8:Ab,__wbg_push_e7d7247e69dad3ee:Tb,__wbg_randomFillSync_ab2cfe79ebbf2740:Mb,__wbg_require_79b1e9274cde3c87:Ob,__wbg_resolve_267ff08e7e1d2ce4:Db,__wbg_self_cca3ca60d61220f4:Rb,__wbg_set_1b50d2de855a9d50:Pb,__wbg_set_393f510a6b7e9da5:Lb,__wbg_set_3f1d0b984ed272ed:Fb,__wbg_set_5deee49b10b2b780:zb,__wbg_set_93ba9407b5476ec6:Bb,__wbg_set_wasm:mu,__wbg_setindex_e0b7b31bfc87ba3f:Ub,__wbg_stack_0ed75d68575b0f3c:Vb,__wbg_subarray_2dc34705c0dc7cdb:$b,__wbg_then_84907e7a6730461e:Hb,__wbg_value_51f8a88d4a1805fb:Wb,__wbg_versions_c71aa1626a93e0a1:qb,__wbg_versionvector_new:Gb,__wbg_window_2aba046d3fc4ad7c:Yb,__wbindgen_as_number:Jb,__wbindgen_bigint_from_i64:Kb,__wbindgen_bigint_from_u64:Xb,__wbindgen_bigint_get_as_i64:Zb,__wbindgen_boolean_get:Qb,__wbindgen_cb_drop:ey,__wbindgen_closure_wrapper483:ty,__wbindgen_closure_wrapper486:ny,__wbindgen_debug_string:oy,__wbindgen_error_new:ry,__wbindgen_in:sy,__wbindgen_is_array:iy,__wbindgen_is_bigint:ay,__wbindgen_is_falsy:ly,__wbindgen_is_function:cy,__wbindgen_is_null:dy,__wbindgen_is_object:uy,__wbindgen_is_string:hy,__wbindgen_is_undefined:fy,__wbindgen_jsval_eq:py,__wbindgen_jsval_loose_eq:my,__wbindgen_memory:gy,__wbindgen_number_get:_y,__wbindgen_number_new:by,__wbindgen_object_clone_ref:yy,__wbindgen_object_drop_ref:xy,__wbindgen_rethrow:wy,__wbindgen_string_get:vy,__wbindgen_string_new:ky,__wbindgen_throw:Sy,__wbindgen_typeof:Cy,decodeFrontiers:function(t){try{const o=w.__wbindgen_add_to_stack_pointer(-16),r=$o(t,w.__wbindgen_export_0),s=$e;w.decodeFrontiers(o,r,s);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}},decodeImportBlobMeta:function(t,e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=$o(t,w.__wbindgen_export_0),i=$e;w.decodeImportBlobMeta(r,s,i,e);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}},encodeFrontiers:function(t){try{const s=w.__wbindgen_add_to_stack_pointer(-16),i=_n(t,w.__wbindgen_export_0),a=$e;w.encodeFrontiers(s,i,a);var e=L().getInt32(s+0,!0),n=L().getInt32(s+4,!0),o=L().getInt32(s+8,!0);if(L().getInt32(s+12,!0))throw H(o);var r=Zn(e,n).slice();return w.__wbindgen_export_3(e,1*n,1),r}finally{w.__wbindgen_add_to_stack_pointer(16)}},run:function(){w.run()},setDebug:function(){w.setDebug()}},Symbol.toStringTag,{value:"Module"}));URL=globalThis.URL;const V=await(async(t={},e)=>{let n;if(e.startsWith("data:")){const o=e.replace(/^data:.*?base64,/,"");let r;if(typeof Buffer=="function"&&typeof Buffer.from=="function")r=Buffer.from(o,"base64");else{if(typeof atob!="function")throw new Error("Cannot decode base64-encoded data URL");{const s=atob(o);r=new Uint8Array(s.length);for(let i=0;i<s.length;i++)r[i]=s.charCodeAt(i)}}n=await WebAssembly.instantiate(r,t)}else{const o=await fetch(e),r=o.headers.get("Content-Type")||"";if("instantiateStreaming"in WebAssembly&&r.startsWith("application/wasm"))n=await WebAssembly.instantiateStreaming(o,t);else{const s=await o.arrayBuffer();n=await WebAssembly.instantiate(s,t)}}return n.instance.exports})({"./loro_wasm_bg.js":{__wbindgen_object_drop_ref:xy,__wbg_lorotree_new:ub,__wbg_lorocounter_new:ib,__wbg_loromovablelist_new:cb,__wbg_lorotreenode_new:hb,__wbg_cursor_new:D0,__wbg_lorolist_new:ab,__wbg_lorotext_new:db,__wbg_loromap_new:lb,__wbg_versionvector_new:Gb,__wbg_changemodifier_new:M0,__wbindgen_is_function:cy,__wbindgen_string_new:ky,__wbindgen_boolean_get:Qb,__wbindgen_error_new:ry,__wbindgen_object_clone_ref:yy,__wbindgen_string_get:vy,__wbindgen_is_undefined:fy,__wbindgen_in:sy,__wbindgen_is_bigint:ay,__wbindgen_number_get:_y,__wbindgen_bigint_from_i64:Kb,__wbindgen_jsval_eq:py,__wbindgen_is_object:uy,__wbindgen_bigint_from_u64:Xb,__wbindgen_cb_drop:ey,__wbindgen_as_number:Jb,__wbindgen_is_string:hy,__wbindgen_is_null:dy,__wbindgen_number_new:by,__wbindgen_is_array:iy,__wbindgen_typeof:Cy,__wbg_error_9912f7d6d7835a4b:z0,__wbg_log_0fd6c49475c7bece:rb,__wbindgen_is_falsy:ly,__wbindgen_jsval_loose_eq:my,__wbg_String_8f0eb39a4a4c2f66:C0,__wbg_getwithrefkey_1dc361bd10053bfe:W0,__wbg_set_3f1d0b984ed272ed:Fb,__wbg_log_cb9e190acc5753fb:sb,__wbg_log_0cc1b7768397bcfe:ob,__wbg_mark_7438147ce31e9d4b:fb,__wbg_measure_fb7825c11612c823:pb,__wbg_new_8a6f238a6ece86ea:yb,__wbg_stack_0ed75d68575b0f3c:Vb,__wbg_error_7534b8e9a36f1ab4:F0,__wbg_now_3e8577e703add0ba:Eb,__wbg_crypto_ed58b8e10a292839:O0,__wbg_process_5c1d670bc53614b8:Ab,__wbg_versions_c71aa1626a93e0a1:qb,__wbg_node_02999533c4ea02e3:jb,__wbg_require_79b1e9274cde3c87:Ob,__wbg_msCrypto_0a36e2ec3a343d26:mb,__wbg_randomFillSync_ab2cfe79ebbf2740:Mb,__wbg_getRandomValues_bcb4912f16000dc4:U0,__wbg_self_cca3ca60d61220f4:Rb,__wbg_window_2aba046d3fc4ad7c:Yb,__wbg_globalThis_6b4d52a0b6aaeaea:q0,__wbg_global_49324ce12193de77:G0,__wbg_newnoargs_a136448eeb7d48ac:wb,__wbg_call_0ad083564791763a:E0,__wbg_get_0c3cc364764a0b98:V0,__wbg_length_12246a78d2f65d3a:tb,__wbg_new_e2d07398d7689006:xb,__wbg_new_518e2184725aa711:gb,__wbg_next_928df8c15fc0c9b0:Cb,__wbg_next_9dc0926f351c7090:Nb,__wbg_done_f4c254830a095eaf:R0,__wbg_value_51f8a88d4a1805fb:Wb,__wbg_iterator_c0c688f37fa815e6:eb,__wbg_get_b996a12be035ef4f:$0,__wbg_new_67abf4a77618ee3e:bb,__wbg_newwithlength_88b49de1eb24d63e:Sb,__wbg_set_93ba9407b5476ec6:Bb,__wbg_from_3aa0fcaa8eef0104:B0,__wbg_isArray_8738f1062fa88586:Z0,__wbg_push_e7d7247e69dad3ee:Tb,__wbg_instanceof_ArrayBuffer_ff40e55b5978e215:Y0,__wbg_call_a34b6b4765f27be0:I0,__wbg_call_efe5a4db7065d1a2:T0,__wbg_call_d00953b926be4879:A0,__wbg_instanceof_Map_0f3f3653f757ced1:J0,__wbg_set_393f510a6b7e9da5:Lb,__wbg_entries_4dce6361e3ba6fbc:P0,__wbg_isSafeInteger_a1b3e0811faecf2f:Q0,__wbg_instanceof_Object_9108547bac1f91b1:K0,__wbg_entries_83beb641792ccb9c:L0,__wbg_apply_9bb7fe8fff013a3f:N0,__wbg_ownKeys_b16312a839a4152c:Ib,__wbg_set_1b50d2de855a9d50:Pb,__wbg_buffer_ef9774282e5dab94:j0,__wbg_resolve_267ff08e7e1d2ce4:Db,__wbg_then_84907e7a6730461e:Hb,__wbg_newwithbyteoffsetandlength_84908302a4c137cf:vb,__wbg_new_59845962d1127937:_b,__wbg_set_5deee49b10b2b780:zb,__wbg_length_c24da17096edfe57:nb,__wbg_instanceof_Uint8Array_db97368f94b1373f:X0,__wbg_newwithlength_4c216eaaf23f2f9a:kb,__wbg_subarray_2dc34705c0dc7cdb:$b,__wbg_getindex_a471648b3037c750:H0,__wbg_setindex_e0b7b31bfc87ba3f:Ub,__wbindgen_bigint_get_as_i64:Zb,__wbindgen_debug_string:oy,__wbindgen_throw:Sy,__wbindgen_rethrow:wy,__wbindgen_memory:gy,__wbindgen_closure_wrapper483:ty,__wbindgen_closure_wrapper486:ny}},N5),T5=V.memory,M5=V.__wbg_lorocounter_free,O5=V.lorocounter_new,D5=V.lorocounter_kind,R5=V.lorocounter_id,P5=V.lorocounter_increment,L5=V.lorocounter_decrement,F5=V.lorocounter_value,z5=V.lorocounter_subscribe,B5=V.lorocounter_parent,U5=V.lorocounter_isAttached,V5=V.lorocounter_getAttached,$5=V.lorocounter_getShallowValue,H5=V.__wbg_awarenesswasm_free,W5=V.awarenesswasm_new,q5=V.awarenesswasm_encode,G5=V.awarenesswasm_encodeAll,Y5=V.awarenesswasm_apply,J5=V.awarenesswasm_setLocalState,K5=V.awarenesswasm_peer,X5=V.awarenesswasm_getAllStates,Z5=V.awarenesswasm_getState,Q5=V.awarenesswasm_getTimestamp,e6=V.awarenesswasm_removeOutdated,t6=V.awarenesswasm_length,n6=V.awarenesswasm_isEmpty,o6=V.awarenesswasm_peers,r6=V.__wbg_ephemeralstorewasm_free,s6=V.ephemeralstorewasm_new,i6=V.ephemeralstorewasm_set,a6=V.ephemeralstorewasm_delete,l6=V.ephemeralstorewasm_get,c6=V.ephemeralstorewasm_getAllStates,d6=V.ephemeralstorewasm_subscribeLocalUpdates,u6=V.ephemeralstorewasm_subscribe,h6=V.ephemeralstorewasm_encode,f6=V.ephemeralstorewasm_encodeAll,p6=V.ephemeralstorewasm_apply,m6=V.ephemeralstorewasm_removeOutdated,g6=V.ephemeralstorewasm_isEmpty,_6=V.ephemeralstorewasm_keys,b6=V.LORO_VERSION,y6=V.run,x6=V.encodeFrontiers,w6=V.decodeFrontiers,v6=V.setDebug,k6=V.__wbg_lorodoc_free,S6=V.lorodoc_new,C6=V.lorodoc_setDetachedEditing,N6=V.lorodoc_isDetachedEditingEnabled,j6=V.lorodoc_setRecordTimestamp,E6=V.lorodoc_setChangeMergeInterval,I6=V.lorodoc_configTextStyle,A6=V.lorodoc_configDefaultTextStyle,T6=V.lorodoc_fromSnapshot,M6=V.lorodoc_attach,O6=V.lorodoc_isDetached,D6=V.lorodoc_detach,R6=V.lorodoc_fork,P6=V.lorodoc_forkAt,L6=V.lorodoc_checkoutToLatest,F6=V.lorodoc_travelChangeAncestors,z6=V.lorodoc_findIdSpansBetween,B6=V.lorodoc_checkout,U6=V.lorodoc_peerId,V6=V.lorodoc_peerIdStr,$6=V.lorodoc_setPeerId,H6=V.lorodoc_commit,W6=V.lorodoc_getPendingTxnLength,q6=V.lorodoc_getText,G6=V.lorodoc_getMap,Y6=V.lorodoc_getList,J6=V.lorodoc_getMovableList,K6=V.lorodoc_getCounter,X6=V.lorodoc_getTree,Z6=V.lorodoc_hasContainer,Q6=V.lorodoc_getContainerById,eI=V.lorodoc_setNextCommitMessage,tI=V.lorodoc_setNextCommitOrigin,nI=V.lorodoc_setNextCommitTimestamp,oI=V.lorodoc_setNextCommitOptions,rI=V.lorodoc_clearNextCommitOptions,sI=V.lorodoc_getDeepValueWithID,iI=V.lorodoc_getPathToContainer,aI=V.lorodoc_JSONPath,lI=V.lorodoc_version,cI=V.lorodoc_shallowSinceVV,dI=V.lorodoc_isShallow,uI=V.lorodoc_shallowSinceFrontiers,hI=V.lorodoc_oplogVersion,fI=V.lorodoc_frontiers,pI=V.lorodoc_oplogFrontiers,mI=V.lorodoc_cmpWithFrontiers,gI=V.lorodoc_cmpFrontiers,_I=V.lorodoc_exportSnapshot,bI=V.lorodoc_exportFrom,yI=V.lorodoc_export,xI=V.lorodoc_exportJsonUpdates,wI=V.lorodoc_exportJsonInIdSpan,vI=V.lorodoc_importJsonUpdates,kI=V.lorodoc_import,SI=V.lorodoc_importBatch,CI=V.lorodoc_getShallowValue,NI=V.lorodoc_toJSON,jI=V.lorodoc_subscribe,EI=V.lorodoc_subscribeLocalUpdates,II=V.lorodoc_debugHistory,AI=V.lorodoc_changeCount,TI=V.lorodoc_opCount,MI=V.lorodoc_getAllChanges,OI=V.lorodoc_getChangeAt,DI=V.lorodoc_getChangeAtLamport,RI=V.lorodoc_getOpsInChange,PI=V.lorodoc_frontiersToVV,LI=V.lorodoc_vvToFrontiers,FI=V.lorodoc_getByPath,zI=V.lorodoc_getCursorPos,BI=V.lorodoc_getChangedContainersIn,UI=V.lorodoc_revertTo,VI=V.lorodoc_applyDiff,$I=V.lorodoc_diff,HI=V.lorodoc_getUncommittedOpsAsJson,WI=V.lorodoc_subscribeFirstCommitFromPeer,qI=V.lorodoc_subscribePreCommit,GI=V.lorodoc_deleteRootContainer,YI=V.lorodoc_setHideEmptyRootContainers,JI=V.__wbg_lorotext_free,KI=V.lorotext_new,XI=V.lorotext_kind,ZI=V.lorotext_iter,QI=V.lorotext_update,e8=V.lorotext_updateByLine,t8=V.lorotext_insert,n8=V.lorotext_slice,o8=V.lorotext_charAt,r8=V.lorotext_splice,s8=V.lorotext_insertUtf8,i8=V.lorotext_delete,a8=V.lorotext_deleteUtf8,l8=V.lorotext_mark,c8=V.lorotext_unmark,d8=V.lorotext_toString,u8=V.lorotext_toDelta,h8=V.lorotext_id,f8=V.lorotext_length,p8=V.lorotext_subscribe,m8=V.lorotext_applyDelta,g8=V.lorotext_parent,_8=V.lorotext_isAttached,b8=V.lorotext_getAttached,y8=V.lorotext_getCursor,x8=V.lorotext_push,w8=V.lorotext_getEditorOf,v8=V.lorotext_isDeleted,k8=V.lorotext_getShallowValue,S8=V.lorotext_toJSON,C8=V.__wbg_loromap_free,N8=V.loromap_new,j8=V.loromap_kind,E8=V.loromap_set,I8=V.loromap_delete,A8=V.loromap_get,T8=V.loromap_getOrCreateContainer,M8=V.loromap_keys,O8=V.loromap_values,D8=V.loromap_entries,R8=V.loromap_id,P8=V.loromap_toJSON,L8=V.loromap_setContainer,F8=V.loromap_subscribe,z8=V.loromap_size,B8=V.loromap_parent,U8=V.loromap_isAttached,V8=V.loromap_getAttached,$8=V.loromap_clear,H8=V.loromap_getLastEditor,W8=V.loromap_isDeleted,q8=V.loromap_getShallowValue,G8=V.__wbg_lorolist_free,Y8=V.lorolist_new,J8=V.lorolist_kind,K8=V.lorolist_insert,X8=V.lorolist_delete,Z8=V.lorolist_get,Q8=V.lorolist_id,eA=V.lorolist_toArray,tA=V.lorolist_toJSON,nA=V.lorolist_insertContainer,oA=V.lorolist_pushContainer,rA=V.lorolist_subscribe,sA=V.lorolist_length,iA=V.lorolist_parent,aA=V.lorolist_isAttached,lA=V.lorolist_getAttached,cA=V.lorolist_getCursor,dA=V.lorolist_push,uA=V.lorolist_pop,hA=V.lorolist_clear,fA=V.lorolist_getIdAt,pA=V.lorolist_isDeleted,mA=V.lorolist_getShallowValue,gA=V.loromovablelist_new,_A=V.loromovablelist_kind,bA=V.loromovablelist_insert,yA=V.loromovablelist_delete,xA=V.loromovablelist_get,wA=V.loromovablelist_id,vA=V.loromovablelist_toArray,kA=V.loromovablelist_toJSON,SA=V.loromovablelist_insertContainer,CA=V.loromovablelist_pushContainer,NA=V.loromovablelist_subscribe,jA=V.loromovablelist_length,EA=V.loromovablelist_parent,IA=V.loromovablelist_isAttached,AA=V.loromovablelist_getAttached,TA=V.loromovablelist_getCursor,MA=V.loromovablelist_move,OA=V.loromovablelist_set,DA=V.loromovablelist_setContainer,RA=V.loromovablelist_push,PA=V.loromovablelist_pop,LA=V.loromovablelist_clear,FA=V.loromovablelist_getCreatorAt,zA=V.loromovablelist_getLastMoverAt,BA=V.loromovablelist_getLastEditorAt,UA=V.loromovablelist_isDeleted,VA=V.loromovablelist_getShallowValue,$A=V.__wbg_lorotree_free,HA=V.lorotreenode___getClassname,WA=V.__wbg_lorotreenode_free,qA=V.lorotreenode_id,GA=V.lorotreenode_createNode,YA=V.lorotreenode_move,JA=V.lorotreenode_moveAfter,KA=V.lorotreenode_moveBefore,XA=V.lorotreenode_index,ZA=V.lorotreenode_fractionalIndex,QA=V.lorotreenode_data,eT=V.lorotreenode_toJSON,tT=V.lorotreenode_parent,nT=V.lorotreenode_children,oT=V.lorotreenode_isDeleted,rT=V.lorotreenode_getLastMoveId,sT=V.lorotreenode_creationId,iT=V.lorotreenode_creator,aT=V.lorotree_new,lT=V.lorotree_kind,cT=V.lorotree_createNode,dT=V.lorotree_move,uT=V.lorotree_delete,hT=V.lorotree_getNodeByID,fT=V.lorotree_id,pT=V.lorotree_has,mT=V.lorotree_isNodeDeleted,gT=V.lorotree_toArray,_T=V.lorotree_getNodes,bT=V.lorotree_toJSON,yT=V.lorotree_nodes,xT=V.lorotree_roots,wT=V.lorotree_subscribe,vT=V.lorotree_parent,kT=V.lorotree_isAttached,ST=V.lorotree_getAttached,CT=V.lorotree_enableFractionalIndex,NT=V.lorotree_disableFractionalIndex,jT=V.lorotree_isFractionalIndexEnabled,ET=V.lorotree_isDeleted,IT=V.lorotree_getShallowValue,AT=V.__wbg_cursor_free,TT=V.cursor_containerId,MT=V.cursor_pos,OT=V.cursor_side,DT=V.cursor_encode,RT=V.cursor_decode,PT=V.cursor_kind,LT=V.__wbg_undomanager_free,FT=V.undomanager_new,zT=V.undomanager_undo,BT=V.undomanager_redo,UT=V.undomanager_canUndo,VT=V.undomanager_canRedo,$T=V.undomanager_setMaxUndoSteps,HT=V.undomanager_setMergeInterval,WT=V.undomanager_addExcludeOriginPrefix,qT=V.undomanager_setOnPush,GT=V.undomanager_setOnPop,YT=V.undomanager_clear,JT=V.__wbg_versionvector_free,KT=V.versionvector_new,XT=V.versionvector_parseJSON,ZT=V.versionvector_toJSON,QT=V.versionvector_encode,e7=V.versionvector_decode,t7=V.versionvector_get,n7=V.versionvector_compare,o7=V.versionvector_setEnd,r7=V.versionvector_setLast,s7=V.versionvector_remove,i7=V.versionvector_length,a7=V.decodeImportBlobMeta,l7=V.__wbg_changemodifier_free,c7=V.changemodifier_setMessage,d7=V.changemodifier_setTimestamp,u7=V.lorodoc_importUpdateBatch,h7=V.__wbg_loromovablelist_free,f7=V.__wbindgen_export_0,p7=V.__wbindgen_export_1,m7=V.__wbindgen_export_2,g7=V.__wbindgen_export_3,_7=V.__wbindgen_export_4,b7=V.__wbindgen_add_to_stack_pointer,y7=V.__wbindgen_export_5,x7=V.__wbindgen_export_6,Cu=V.__wbindgen_start,Ny=Object.freeze(Object.defineProperty({__proto__:null,LORO_VERSION:b6,__wbg_awarenesswasm_free:H5,__wbg_changemodifier_free:l7,__wbg_cursor_free:AT,__wbg_ephemeralstorewasm_free:r6,__wbg_lorocounter_free:M5,__wbg_lorodoc_free:k6,__wbg_lorolist_free:G8,__wbg_loromap_free:C8,__wbg_loromovablelist_free:h7,__wbg_lorotext_free:JI,__wbg_lorotree_free:$A,__wbg_lorotreenode_free:WA,__wbg_undomanager_free:LT,__wbg_versionvector_free:JT,__wbindgen_add_to_stack_pointer:b7,__wbindgen_export_0:f7,__wbindgen_export_1:p7,__wbindgen_export_2:m7,__wbindgen_export_3:g7,__wbindgen_export_4:_7,__wbindgen_export_5:y7,__wbindgen_export_6:x7,__wbindgen_start:Cu,awarenesswasm_apply:Y5,awarenesswasm_encode:q5,awarenesswasm_encodeAll:G5,awarenesswasm_getAllStates:X5,awarenesswasm_getState:Z5,awarenesswasm_getTimestamp:Q5,awarenesswasm_isEmpty:n6,awarenesswasm_length:t6,awarenesswasm_new:W5,awarenesswasm_peer:K5,awarenesswasm_peers:o6,awarenesswasm_removeOutdated:e6,awarenesswasm_setLocalState:J5,changemodifier_setMessage:c7,changemodifier_setTimestamp:d7,cursor_containerId:TT,cursor_decode:RT,cursor_encode:DT,cursor_kind:PT,cursor_pos:MT,cursor_side:OT,decodeFrontiers:w6,decodeImportBlobMeta:a7,encodeFrontiers:x6,ephemeralstorewasm_apply:p6,ephemeralstorewasm_delete:a6,ephemeralstorewasm_encode:h6,ephemeralstorewasm_encodeAll:f6,ephemeralstorewasm_get:l6,ephemeralstorewasm_getAllStates:c6,ephemeralstorewasm_isEmpty:g6,ephemeralstorewasm_keys:_6,ephemeralstorewasm_new:s6,ephemeralstorewasm_removeOutdated:m6,ephemeralstorewasm_set:i6,ephemeralstorewasm_subscribe:u6,ephemeralstorewasm_subscribeLocalUpdates:d6,lorocounter_decrement:L5,lorocounter_getAttached:V5,lorocounter_getShallowValue:$5,lorocounter_id:R5,lorocounter_increment:P5,lorocounter_isAttached:U5,lorocounter_kind:D5,lorocounter_new:O5,lorocounter_parent:B5,lorocounter_subscribe:z5,lorocounter_value:F5,lorodoc_JSONPath:aI,lorodoc_applyDiff:VI,lorodoc_attach:M6,lorodoc_changeCount:AI,lorodoc_checkout:B6,lorodoc_checkoutToLatest:L6,lorodoc_clearNextCommitOptions:rI,lorodoc_cmpFrontiers:gI,lorodoc_cmpWithFrontiers:mI,lorodoc_commit:H6,lorodoc_configDefaultTextStyle:A6,lorodoc_configTextStyle:I6,lorodoc_debugHistory:II,lorodoc_deleteRootContainer:GI,lorodoc_detach:D6,lorodoc_diff:$I,lorodoc_export:yI,lorodoc_exportFrom:bI,lorodoc_exportJsonInIdSpan:wI,lorodoc_exportJsonUpdates:xI,lorodoc_exportSnapshot:_I,lorodoc_findIdSpansBetween:z6,lorodoc_fork:R6,lorodoc_forkAt:P6,lorodoc_fromSnapshot:T6,lorodoc_frontiers:fI,lorodoc_frontiersToVV:PI,lorodoc_getAllChanges:MI,lorodoc_getByPath:FI,lorodoc_getChangeAt:OI,lorodoc_getChangeAtLamport:DI,lorodoc_getChangedContainersIn:BI,lorodoc_getContainerById:Q6,lorodoc_getCounter:K6,lorodoc_getCursorPos:zI,lorodoc_getDeepValueWithID:sI,lorodoc_getList:Y6,lorodoc_getMap:G6,lorodoc_getMovableList:J6,lorodoc_getOpsInChange:RI,lorodoc_getPathToContainer:iI,lorodoc_getPendingTxnLength:W6,lorodoc_getShallowValue:CI,lorodoc_getText:q6,lorodoc_getTree:X6,lorodoc_getUncommittedOpsAsJson:HI,lorodoc_hasContainer:Z6,lorodoc_import:kI,lorodoc_importBatch:SI,lorodoc_importJsonUpdates:vI,lorodoc_importUpdateBatch:u7,lorodoc_isDetached:O6,lorodoc_isDetachedEditingEnabled:N6,lorodoc_isShallow:dI,lorodoc_new:S6,lorodoc_opCount:TI,lorodoc_oplogFrontiers:pI,lorodoc_oplogVersion:hI,lorodoc_peerId:U6,lorodoc_peerIdStr:V6,lorodoc_revertTo:UI,lorodoc_setChangeMergeInterval:E6,lorodoc_setDetachedEditing:C6,lorodoc_setHideEmptyRootContainers:YI,lorodoc_setNextCommitMessage:eI,lorodoc_setNextCommitOptions:oI,lorodoc_setNextCommitOrigin:tI,lorodoc_setNextCommitTimestamp:nI,lorodoc_setPeerId:$6,lorodoc_setRecordTimestamp:j6,lorodoc_shallowSinceFrontiers:uI,lorodoc_shallowSinceVV:cI,lorodoc_subscribe:jI,lorodoc_subscribeFirstCommitFromPeer:WI,lorodoc_subscribeLocalUpdates:EI,lorodoc_subscribePreCommit:qI,lorodoc_toJSON:NI,lorodoc_travelChangeAncestors:F6,lorodoc_version:lI,lorodoc_vvToFrontiers:LI,lorolist_clear:hA,lorolist_delete:X8,lorolist_get:Z8,lorolist_getAttached:lA,lorolist_getCursor:cA,lorolist_getIdAt:fA,lorolist_getShallowValue:mA,lorolist_id:Q8,lorolist_insert:K8,lorolist_insertContainer:nA,lorolist_isAttached:aA,lorolist_isDeleted:pA,lorolist_kind:J8,lorolist_length:sA,lorolist_new:Y8,lorolist_parent:iA,lorolist_pop:uA,lorolist_push:dA,lorolist_pushContainer:oA,lorolist_subscribe:rA,lorolist_toArray:eA,lorolist_toJSON:tA,loromap_clear:$8,loromap_delete:I8,loromap_entries:D8,loromap_get:A8,loromap_getAttached:V8,loromap_getLastEditor:H8,loromap_getOrCreateContainer:T8,loromap_getShallowValue:q8,loromap_id:R8,loromap_isAttached:U8,loromap_isDeleted:W8,loromap_keys:M8,loromap_kind:j8,loromap_new:N8,loromap_parent:B8,loromap_set:E8,loromap_setContainer:L8,loromap_size:z8,loromap_subscribe:F8,loromap_toJSON:P8,loromap_values:O8,loromovablelist_clear:LA,loromovablelist_delete:yA,loromovablelist_get:xA,loromovablelist_getAttached:AA,loromovablelist_getCreatorAt:FA,loromovablelist_getCursor:TA,loromovablelist_getLastEditorAt:BA,loromovablelist_getLastMoverAt:zA,loromovablelist_getShallowValue:VA,loromovablelist_id:wA,loromovablelist_insert:bA,loromovablelist_insertContainer:SA,loromovablelist_isAttached:IA,loromovablelist_isDeleted:UA,loromovablelist_kind:_A,loromovablelist_length:jA,loromovablelist_move:MA,loromovablelist_new:gA,loromovablelist_parent:EA,loromovablelist_pop:PA,loromovablelist_push:RA,loromovablelist_pushContainer:CA,loromovablelist_set:OA,loromovablelist_setContainer:DA,loromovablelist_subscribe:NA,loromovablelist_toArray:vA,loromovablelist_toJSON:kA,lorotext_applyDelta:m8,lorotext_charAt:o8,lorotext_delete:i8,lorotext_deleteUtf8:a8,lorotext_getAttached:b8,lorotext_getCursor:y8,lorotext_getEditorOf:w8,lorotext_getShallowValue:k8,lorotext_id:h8,lorotext_insert:t8,lorotext_insertUtf8:s8,lorotext_isAttached:_8,lorotext_isDeleted:v8,lorotext_iter:ZI,lorotext_kind:XI,lorotext_length:f8,lorotext_mark:l8,lorotext_new:KI,lorotext_parent:g8,lorotext_push:x8,lorotext_slice:n8,lorotext_splice:r8,lorotext_subscribe:p8,lorotext_toDelta:u8,lorotext_toJSON:S8,lorotext_toString:d8,lorotext_unmark:c8,lorotext_update:QI,lorotext_updateByLine:e8,lorotree_createNode:cT,lorotree_delete:uT,lorotree_disableFractionalIndex:NT,lorotree_enableFractionalIndex:CT,lorotree_getAttached:ST,lorotree_getNodeByID:hT,lorotree_getNodes:_T,lorotree_getShallowValue:IT,lorotree_has:pT,lorotree_id:fT,lorotree_isAttached:kT,lorotree_isDeleted:ET,lorotree_isFractionalIndexEnabled:jT,lorotree_isNodeDeleted:mT,lorotree_kind:lT,lorotree_move:dT,lorotree_new:aT,lorotree_nodes:yT,lorotree_parent:vT,lorotree_roots:xT,lorotree_subscribe:wT,lorotree_toArray:gT,lorotree_toJSON:bT,lorotreenode___getClassname:HA,lorotreenode_children:nT,lorotreenode_createNode:GA,lorotreenode_creationId:sT,lorotreenode_creator:iT,lorotreenode_data:QA,lorotreenode_fractionalIndex:ZA,lorotreenode_getLastMoveId:rT,lorotreenode_id:qA,lorotreenode_index:XA,lorotreenode_isDeleted:oT,lorotreenode_move:YA,lorotreenode_moveAfter:JA,lorotreenode_moveBefore:KA,lorotreenode_parent:tT,lorotreenode_toJSON:eT,memory:T5,run:y6,setDebug:v6,undomanager_addExcludeOriginPrefix:WT,undomanager_canRedo:VT,undomanager_canUndo:UT,undomanager_clear:YT,undomanager_new:FT,undomanager_redo:BT,undomanager_setMaxUndoSteps:$T,undomanager_setMergeInterval:HT,undomanager_setOnPop:GT,undomanager_setOnPush:qT,undomanager_undo:zT,versionvector_compare:n7,versionvector_decode:e7,versionvector_encode:QT,versionvector_get:t7,versionvector_length:i7,versionvector_new:KT,versionvector_parseJSON:XT,versionvector_remove:s7,versionvector_setEnd:o7,versionvector_setLast:r7,versionvector_toJSON:ZT},Symbol.toStringTag,{value:"Module"}));if(Cu)mu(Ny),Cu();else{const t=await jp(()=>Promise.resolve().then(()=>Ny),void 0,import.meta.url);mu(new WebAssembly.Instance(t.default,{"./loro_wasm_bg.js":A5}).exports)}const w7=["Map","Text","List","Tree","MovableList","Counter"];function jy(t){if(typeof t!="object"||t==null)return!1;const e=Object.getPrototypeOf(t);return e!=null&&typeof e=="object"&&typeof e.kind=="function"&&w7.includes(t.kind())}po.prototype.toJsonWithReplacer=function(t){const e=new Set,n=this,o=(i,a)=>{if(typeof a=="string"&&a.startsWith("cid:")&&!e.has(a)){e.add(a);const c=n.getContainerById(a);if(c==null)throw new Error(`ContainerID not found: ${a}`);const d=t(i,c);if(d===c){const h=c.getShallowValue();return typeof h=="object"?r(h):h}if(jy(d))throw new Error("Using new container is not allowed in toJsonWithReplacer");return typeof d=="object"&&d!=null?r(d):d}if(typeof a=="object"&&a!=null)return r(a);const l=t(i,a);if(jy(l))throw new Error("Using new container is not allowed in toJsonWithReplacer");return l},r=i=>{if(Array.isArray(i))return i.map((l,c)=>o(c,l)).filter(l=>l!==void 0);const a={};for(const[l,c]of Object.entries(i)){const d=o(l,c);d!==void 0&&(a[l]=d)}return a},s=n.getShallowValue();return r(s)};const v7=tt.baseTheme({".loro-cursor":{position:"absolute",width:"2px",display:"inline-block",height:"1.2em"},".loro-cursor::before":{position:"absolute",top:"1.3em",left:"0",content:"var(--rtc-name)",padding:"2px 6px",fontSize:"12px",borderRadius:"3px",whiteSpace:"nowrap",userSelect:"none",backgroundColor:"inherit",opacity:"0.7"},".loro-selection":{opacity:"0.5"}}),xi=At.define(),Nu=Sn.define({create:()=>({remoteCursors:new Map,isCheckout:!1}),update(t,e){for(const n of e.effects)if(n.is(xi))switch(n.value.type){case"update":{const{peer:o,user:r,cursor:s}=n.value;t.remoteCursors.set(o,{uid:o,cursor:s,user:r});break}case"delete":t.remoteCursors.delete(n.value.peer);break;case"checkout":t.isCheckout=n.value.checkout}return t}}),Ey=t=>{const e=t.transactions.flatMap(n=>n.effects).filter(n=>n.is(xi));return t.docChanged||t.viewportChanged||e.length>0};class cl{constructor(e,n,o,r,s){this.left=e,this.top=n,this.height=o,this.name=r,this.colorClassName=s}draw(){const e=document.createElement("div");return this.adjust(e),e}update(e){return this.adjust(e),!0}adjust(e){e.style.left=`${this.left}px`,e.style.top=`${this.top}px`,e.style.height=`${this.height}px`,e.className=`loro-cursor ${this.colorClassName}`,e.style.setProperty("--rtc-name",`"${this.name}"`)}eq(e){return this.left===e.left&&this.top===e.top&&this.height===e.height&&this.name===e.name}static createCursor(e,n,o,r){const s=cl.calculateAbsoluteCursorPosition(n,e);if(!s)return[];const i=e.scrollDOM.getBoundingClientRect(),a=(e.textDirection===GU.LTR?i.left:i.right-e.scrollDOM.clientWidth)-e.scrollDOM.scrollLeft,l=i.top-e.scrollDOM.scrollTop;return[new cl(s.left-a,s.top-l,s.bottom-s.top,o,r)]}static calculateAbsoluteCursorPosition(e,n){const o=Math.max(0,Math.min(n.state.doc.length,e.anchor));return n.coordsAtPos(o,e.assoc||1)}}const k7=(t,e,n,o)=>{const r=[],{updated:s,added:i}=n;for(const a of[...s,...i]){const l=Iy(t,e,a,o);l&&r.push(l)}return r},Iy=(t,e,n,o)=>{const r=e.getAllStates()[n];if(!r||n===t.peerIdStr||r.scopeId!==o)return;if(r.type==="delete")return xi.of({type:"delete",peer:r.uid,scopeId:r.scopeId});const s=Hn.decode(r.cursor.anchor),i=t.getCursorPos(s).offset;let a=i;if(r.cursor.head){const l=Hn.decode(r.cursor.head);a=t.getCursorPos(l).offset}return xi.of({type:"update",peer:r.uid,scopeId:r.scopeId,cursor:{anchor:i,head:a},user:r.user})};class S7{constructor(e,n,o,r,s,i,a){this.view=e,this.doc=n,this.user=o,this.awareness=r,this.getTextFromDoc=s,this.scopeId=i,this.getUserId=a,this.sub=void 0,this.sub=this.doc.subscribe(l=>{if(l.by==="local"){const c=[];for(const d of this.awareness.peers()){const h=Iy(this.doc,this.awareness,d,this.scopeId);h&&c.push(h)}this.view.dispatch({effects:c})}else l.by==="checkout"&&this.view.dispatch({effects:[xi.of({type:"checkout",checkout:this.doc.isDetached()})]})})}update(e){if(!e.selectionSet&&!e.focusChanged&&!e.docChanged)return;const n=e.state.selection.main;if(this.view.hasFocus&&!this.doc.isDetached()){const o=N7(this.doc,this.getTextFromDoc,n.anchor,n.head);this.awareness.setLocalState({type:"update",uid:this.getUserId?this.getUserId():this.doc.peerIdStr,scopeId:this.scopeId,cursor:o,user:this.user})}else this.awareness.setLocalState({type:"delete",uid:this.getUserId?this.getUserId():this.doc.peerIdStr,scopeId:this.scopeId})}destroy(){var e;(e=this.sub)==null||e.call(this),this.awareness.setLocalState({type:"delete",uid:this.getUserId?this.getUserId():this.doc.peerIdStr,scopeId:this.scopeId})}}class C7{constructor(e,n,o,r){this.view=e,this.doc=n,this.awareness=o,this.scopeId=r,this._awarenessListener=void 0;const s=async(i,a)=>{a!=="local"&&this.view.dispatch({effects:k7(this.doc,this.awareness,i,this.scopeId)})};this._awarenessListener=s,this.awareness.addListener(s)}destroy(){this._awarenessListener&&this.awareness.removeListener(this._awarenessListener)}}const N7=(t,e,n,o)=>{var i,a;n===o&&(o=void 0);const r=(i=e(t).getCursor(n))==null?void 0:i.encode();if(!r)throw new Error("cursor head not found");let s;return o!==void 0&&(s=(a=e(t).getCursor(o))==null?void 0:a.encode()),{anchor:r,head:s}},dl=["bg-[var(--amber-6)]","bg-[var(--blue-6)]","bg-[var(--crimson-6)]","bg-[var(--cyan-6)]","bg-[var(--grass-6)]","bg-[var(--gray-6)]","bg-[var(--green-6)]","bg-[var(--lime-6)]","bg-[var(--orange-6)]","bg-[var(--purple-6)]","bg-[var(--red-6)]","bg-[var(--sage-6)]","bg-[var(--sky-6)]","bg-[var(--slate-6)]"],j7=(t,e,n)=>kn.define(o=>new E7(o,t,e,n)),Xr=Sp.define();class E7{constructor(e,n,o,r){this.view=e,this.doc=n,this.docPath=o,this.getTextFromDoc=r,this.sub=void 0,this.isInitDispatch=!1,this.onRemoteUpdate=s=>{if(s.by!=="local")if(s.by!=="checkout"){if(s.by==="import"){const i=[];let a=0;for(const{diff:l,path:c}of s.events){if(c.join("/")!==this.docPath.join("/")||l.type!=="text")continue;const d=l.diff;for(const h of d)h.insert?i.push({from:a,to:a,insert:h.insert}):h.delete?(i.push({from:a,to:a+h.delete}),a+=h.delete):h.retain!=null&&(a+=h.retain);i.length>0&&this.view.dispatch({changes:i,annotations:[Xr.of(this)]})}}}else this.view.dispatch({changes:[{from:0,to:this.view.state.doc.length,insert:this.getTextFromDoc(this.doc).toString()}],annotations:[Xr.of(this)]})},this.sub=n.subscribe(this.onRemoteUpdate),Promise.resolve().then(()=>{this.isInitDispatch=!0;const s=this.view.state.doc.toString(),i=this.getTextFromDoc(this.doc);s!==i.toString()&&e.dispatch({changes:[{from:0,to:this.view.state.doc.length,insert:i.toString()}]})})}update(e){if(this.isInitDispatch)return void(this.isInitDispatch=!1);if(!e.docChanged||e.transactions.length>0&&(e.transactions[0].annotation(Xr)===this||e.transactions[0].annotation(Xr)==="undo"))return;let n=0;e.changes.iterChanges((o,r,s,i,a)=>{const l=a.sliceString(0,a.length,`
|
120
120
|
`);o!==r&&this.getTextFromDoc(this.doc).delete(o+n,r-o),l.length>0&&this.getTextFromDoc(this.doc).insert(o+n,l),n+=l.length-(r-o)}),this.doc.commit()}destroy(){var e;(e=this.sub)==null||e.call(this),this.sub=void 0}}const an=It.get("rtc"),Ay=an.get("awareness").disabled(),ju="awareness:",Zr=Ht(void 0),Ut=new po,ul=new class{constructor(t,e=3e4){this.listeners=new Set,this.inner=new y0(t,e),this.peer=t,this.timeout=e}apply(t,e="remote"){const{updated:n,added:o}=this.inner.apply(t);this.listeners.forEach(r=>{r({updated:n,added:o,removed:[]},e)}),this.startTimerIfNotEmpty()}setLocalState(t){const e=this.inner.getState(this.peer)==null;this.inner.setLocalState(t),e?this.listeners.forEach(n=>{n({updated:[],added:[this.inner.peer()],removed:[]},"local")}):this.listeners.forEach(n=>{n({updated:[this.inner.peer()],added:[],removed:[]},"local")}),this.startTimerIfNotEmpty()}getLocalState(){return this.inner.getState(this.peer)}getAllStates(){return this.inner.getAllStates()}encode(t){return this.inner.encode(t)}encodeAll(){return this.inner.encodeAll()}addListener(t){this.listeners.add(t)}removeListener(t){this.listeners.delete(t)}peers(){return this.inner.peers()}destroy(){clearInterval(this.timer),this.listeners.clear()}startTimerIfNotEmpty(){this.inner.isEmpty()||this.timer!=null||(this.timer=setInterval(()=>{const t=this.inner.removeOutdated();t.length>0&&this.listeners.forEach(e=>{e({updated:[],added:[],removed:t},"timeout")}),this.inner.isEmpty()&&(clearInterval(this.timer),this.timer=void 0)},this.timeout/2))}}(Ut.peerIdStr),Eu=JU(()=>{an.debug("creating websocket");const t=_4().getWsSyncURL(A4()).toString(),e=new CH(t,void 0,{maxRetries:10,debug:!1,startClosed:!0,connectionTimeout:1e4});return Promise.resolve().then(async()=>{await b4(),KU()==="edit"&&e.reconnect()}),e.addEventListener("message",async n=>{const o=n.data,r=await o.arrayBuffer(),s=new Uint8Array(r);if(function(i,a){return new TextDecoder().decode(i.slice(0,a.length))===a}(s,ju)){const i=function(a,l){return a.slice(l.length)}(s,ju);return ul.apply(i),void Ay.debug("applied awareness update")}Ut.import(s),an.debug("imported doc change. new doc:",Ut.toJSON()),ct.get(Zr)!==Ut&&ct.set(Zr,Ut)}),e.addEventListener("open",()=>{an.debug("websocket open")}),e.addEventListener("close",n=>{an.warn("websocket close",n),ct.get(Zr)===Ut&&ct.set(Zr,void 0)}),e});function Iu(t,e,n=""){if(xn())return{extension:[],code:n};const o=Ut.getByPath(`codes/${t}`)!==void 0,r=Ut.getMap("codes").getOrCreateContainer(t,new Wo);o||(an.log("initializing code for new cell",n),r.insert(0,n));const s={get name(){return ct.get(T4)||"Anonymous"},get colorClassName(){return(i=>{if(typeof i=="string"){let a=0;for(let l=0;l<i.length;l++)a=(a<<5)-a+i.charCodeAt(l),a=Math.trunc(a);return dl[Math.abs(a)%dl.length]}return dl[i%dl.length]})(this.name)}};return{code:n.toString(),extension:[I7(t),A7(t),T7(Ut,ul,s,()=>r,t),j7(Ut,["codes",t],()=>r)]}}function I7(t){const e=(o,r)=>{const s=o.state.field(Sc).type,i=r.toString();i&&i!==s&&(an.debug(`[incoming] setting language type: ${s} -> ${i}`),Er(o,i,{keepCodeAsIs:!0}))},n=(o,r)=>{const s=o.state.field(Ip),i=r.toJSON();Zi(s,i)||o.dispatch({effects:[E4.of(i)],annotations:[Xr.of(!0)]})};return kn.define(o=>{let r;return Promise.resolve().then(()=>{const s=Ut.getByPath(`languages/${t}`);if(!s)return void an.error("no language container found for cell",t);Do(s instanceof Wo,"language type is not a LoroText");const i=Ut.getByPath(`language_metadata/${t}`);i?(Do(i instanceof Ho,"language metadata is not a LoroMap"),e(o,s),n(o,i),r=Ut.subscribe(a=>{if(a.origin==="local")return;const l=a.events.some(d=>d.target===s.id),c=a.events.some(d=>d.target===i.id);l&&e(o,s),c&&n(o,i)})):an.error("no language metadata container found for cell",t)}),{destroy(){r()}}})}function A7(t){const e=Ut.getMap("languages").getOrCreateContainer(t,new Wo),n=Ut.getMap("language_metadata").getOrCreateContainer(t,new Ho);return tt.updateListener.of(o=>{const r=e.toString()!=="";if(!o.docChanged&&r)return;if(!r){const i=Ep(o.state).type;Er(o.view,i),an.debug("no initial language, setting default to",i),e.delete(0,e.length),e.insert(0,i),an.debug("no initial language metadata, setting default to",o.state.field(Ip));const a=o.state.field(Ip);for(const l of Object.keys(a))n.set(l,a[l]);return void Ut.commit()}let s=!1;for(const i of o.transactions)if(!i.annotation(Xr)){for(const a of i.effects)if(a.is(YU)&&e.toString()!==a.value.type&&(an.debug(`[outgoing] language change: ${e} -> ${a.value.type}`),e.delete(0,e.length),e.insert(0,a.value.type),s=!0),a.is(E4)||a.is(I4)){const l=a.value;a.is(I4)?(an.debug("[outgoing] setting language metadata: ",l),n.clear()):an.debug("[outgoing] updating language metadata: ",l);for(const c of Object.keys(l))n.set(c,l[c]);s=!0}}s&&Ut.commit()})}function T7(t,e,n,o,r,s){const i=`loro:cell:${r}`;return[Nu,j4({above:!0,class:"loro-cursor-layer",update:Ey,markers:a=>{const{remoteCursors:l,isCheckout:c}=a.state.field(Nu);return c?[]:[...l.values()].flatMap(d=>{var f,p;const h=Ro.cursor(d.cursor.anchor);return cl.createCursor(a,h,((f=d.user)==null?void 0:f.name)||"unknown",((p=d.user)==null?void 0:p.colorClassName)||"")})}}),j4({above:!1,class:"loro-selection-layer",update:Ey,markers:a=>{const{remoteCursors:l,isCheckout:c}=a.state.field(Nu);return c?[]:[...l.entries()].filter(([,d])=>d.cursor.head!==void 0&&d.cursor.anchor!==d.cursor.head).flatMap(([,d])=>{var f;const h=Ro.range(d.cursor.anchor,d.cursor.head);return qU.forRange(a,`loro-selection ${((f=d.user)==null?void 0:f.colorClassName)||""}`,h)})}}),kn.define(a=>new S7(a,t,n,e,o,i,s)),kn.define(a=>new C7(a,t,e,i)),v7]}function hl(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}Ec()&&Eu(),Ut.subscribeLocalUpdates(t=>{an.debug("local update, sending to server"),Eu().send(t)}),ul.addListener((t,e)=>{const n=[...t.added,...t.removed,...t.updated];e==="local"&&(Ay.debug("awareness changes",n),Eu().send(function(o,r){const s=new TextEncoder().encode(o);return new Uint8Array([...s,...r])}(ju,ul.encode(n))))});var Ty={modified:{doc:""},original:{doc:""}},My=T.createContext(Ty);function M7(t,e){return St({},t,e,{modified:St({},t.modified,e.modified),original:St({},t.original,e.original)})}var Au=()=>T.useContext(My),O7=t=>{var{children:e,theme:n}=t,[o,r]=T.useReducer(M7,St({},Ty,{theme:n}));return T.useEffect(()=>r({theme:n}),[n]),u.jsx(My.Provider,{value:St({},o,{dispatch:r}),children:e})},D7=["extensions","value","selection","onChange"],Oy=t=>{var{extensions:e=[],value:n,selection:o,onChange:r}=t,s=la(t,D7),{theme:i,dispatch:a}=Au(),l=Bs(St({},s,{theme:i}));return T.useEffect(()=>a({original:{doc:n,selection:o,extensions:[...l,...e]},originalExtension:{onChange:r,option:s,extension:[e]}}),[t]),null};Oy.displayName="CodeMirrorMerge.Original";var R7=["extensions","value","selection","onChange"],Dy=t=>{var{extensions:e=[],value:n,selection:o,onChange:r}=t,s=la(t,R7),{theme:i,dispatch:a}=Au(),l=Bs(St({},s,{theme:i}));return T.useEffect(()=>{a({modified:{doc:n,selection:o,extensions:[...l,...e]},modifiedExtension:{onChange:r,option:s,extension:[e]}})},[t]),null};Dy.displayName="CodeMirrorMerge.Modified";class Et{constructor(e,n,o,r){this.fromA=e,this.toA=n,this.fromB=o,this.toB=r}offset(e,n){return new Et(this.fromA+e,this.toA+e,this.fromB+n,this.toB+n)}}function vr(t,e,n,o,r,s){if(t==o)return[];let i=Ou(t,e,n,o,r,s),a=Du(t,e+i,n,o,r+i,s),l=(n-=a)-(e+=i),c=(s-=a)-(r+=i);if(!l||!c)return[new Et(e,n,r,s)];if(l>c){let h=t.slice(e,n).indexOf(o.slice(r,s));if(h>-1)return[new Et(e,e+h,r,r),new Et(e+h+c,n,s,s)]}else if(c>l){let h=o.slice(r,s).indexOf(t.slice(e,n));if(h>-1)return[new Et(e,e,r,r+h),new Et(n,n,r+h+l,s)]}if(l==1||c==1)return[new Et(e,n,r,s)];let d=Ly(t,e,n,o,r,s);if(d){let[h,f,p]=d;return vr(t,e,h,o,r,f).concat(vr(t,h+p,n,o,f+p,s))}return function(h,f,p,_,g,m){let b=p-f,y=m-g;if(wi<1e9&&Math.min(b,y)>16*wi)return Math.min(b,y)>64*wi?[new Et(f,p,g,m)]:Fy(h,f,p,_,g,m);let x=Math.ceil((b+y)/2);Tu.reset(x),Mu.reset(x);let v=(N,I)=>h.charCodeAt(f+N)==_.charCodeAt(g+I),C=(N,I)=>h.charCodeAt(p-N-1)==_.charCodeAt(m-I-1),k=(b-y)%2!=0?Mu:null,E=k?null:Tu;for(let N=0;N<x;N++){if(N>wi)return Fy(h,f,p,_,g,m);let I=Tu.advance(N,b,y,x,k,!1,v)||Mu.advance(N,b,y,x,E,!0,C);if(I)return P7(h,f,p,f+I[0],_,g,m,g+I[1])}return[new Et(f,p,g,m)]}(t,e,n,o,r,s)}let wi=1e9;class Ry{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let n=0;n<this.len;n++)this.vec[n]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,n,o,r,s,i,a){for(let l=-e+this.start;l<=e-this.end;l+=2){let c=r+l,d=l==-e||l!=e&&this.vec[c-1]<this.vec[c+1]?this.vec[c+1]:this.vec[c-1]+1,h=d-l;for(;d<n&&h<o&&a(d,h);)d++,h++;if(this.vec[c]=d,d>n)this.end+=2;else if(h>o)this.start+=2;else if(s){let f=r+(n-o)-l;if(f>=0&&f<this.len&&s.vec[f]!=-1){if(i){let p=s.vec[f];if(p>=n-d)return[p,r+p-f]}else if(d>=n-s.vec[f])return[d,h]}}}return null}}const Tu=new Ry,Mu=new Ry;function P7(t,e,n,o,r,s,i,a){let l=!1;return Qr(t,o)||++o!=n||(l=!0),Qr(r,a)||++a!=i||(l=!0),l?[new Et(e,n,s,i)]:vr(t,e,o,r,s,a).concat(vr(t,o,n,r,a,i))}function Py(t,e){let n=1,o=Math.min(t,e);for(;n<o;)n<<=1;return n}function Ou(t,e,n,o,r,s){if(e==n||e==s||t.charCodeAt(e)!=o.charCodeAt(r))return 0;let i=Py(n-e,s-r);for(let a=e,l=r;;){let c=a+i,d=l+i;if(c>n||d>s||t.slice(a,c)!=o.slice(l,d)){if(i==1)return a-e-(Qr(t,a)?0:1);i>>=1}else{if(c==n||d==s)return c-e;a=c,l=d}}}function Du(t,e,n,o,r,s){if(e==n||r==s||t.charCodeAt(n-1)!=o.charCodeAt(s-1))return 0;let i=Py(n-e,s-r);for(let a=n,l=s;;){let c=a-i,d=l-i;if(c<e||d<r||t.slice(c,a)!=o.slice(d,l)){if(i==1)return n-a-(Qr(t,a)?0:1);i>>=1}else{if(c==e||d==r)return n-c;a=c,l=d}}}function Ru(t,e,n,o,r,s,i,a){let l=o.slice(r,s),c=null;for(;;){if(c||i<a)return c;for(let d=e+i;;){Qr(t,d)||d++;let h=d+i;if(Qr(t,h)||(h+=h==d+1?1:-1),h>=n)break;let f=t.slice(d,h),p=-1;for(;(p=l.indexOf(f,p+1))!=-1;){let _=Ou(t,h,n,o,r+p+f.length,s),g=Du(t,e,d,o,r,r+p),m=f.length+_+g;(!c||c[2]<m)&&(c=[d-g,r+p-g,m])}d=h}if(a<0)return c;i>>=1}}function Ly(t,e,n,o,r,s){let i=n-e,a=s-r;if(i<a){let l=Ly(o,r,s,t,e,n);return l&&[l[1],l[0],l[2]]}return i<4||2*a<i?null:Ru(t,e,n,o,r,s,Math.floor(i/4),-1)}function Fy(t,e,n,o,r,s){let i,a=n-e,l=s-r;if(a<l){let f=Ru(o,r,s,t,e,n,Math.floor(a/6),50);i=f&&[f[1],f[0],f[2]]}else i=Ru(t,e,n,o,r,s,Math.floor(l/6),50);if(!i)return[new Et(e,n,r,s)];let[c,d,h]=i;return vr(t,e,c,o,r,d).concat(vr(t,c+h,n,o,d+h,s))}function zy(t,e){for(let n=1;n<t.length;n++){let o=t[n-1],r=t[n];o.toA>r.fromA-e&&o.toB>r.fromB-e&&(t[n-1]=new Et(o.fromA,r.toA,o.fromB,r.toB),t.splice(n--,1))}}let kr;try{kr=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function By(t){return t>48&&t<58||t>64&&t<91||t>96&&t<123}function Uy(t,e){if(e==t.length)return 0;let n=t.charCodeAt(e);return n<192?By(n)?1:0:kr?Wy(n)&&e!=t.length-1?kr.test(t.slice(e,e+2))?2:0:kr.test(String.fromCharCode(n))?1:0:0}function Vy(t,e){if(!e)return 0;let n=t.charCodeAt(e-1);return n<192?By(n)?1:0:kr?qy(n)&&e!=1?kr.test(t.slice(e-2,e))?2:0:kr.test(String.fromCharCode(n))?1:0:0}function $y(t,e,n){if(e==t.length||!Vy(t,e))return e;for(let o=e,r=e+n;;){let s=Uy(t,o);if(!s)return o;if(o+=s,o>r)return e}}function Hy(t,e,n){if(!e||!Uy(t,e))return e;for(let o=e,r=e-n;;){let s=Vy(t,o);if(!s)return o;if(o-=s,o<r)return e}}function L7(t,e,n){for(let o=e,r=e-n;;){let s=o?t.charCodeAt(o-1):10;if(s==10)return o;if(o--,o<r||s!=32&&s!=9)return e}}const Wy=t=>t>=55296&&t<=56319,qy=t=>t>=56320&&t<=57343;function Qr(t,e){return!e||e==t.length||!Wy(t.charCodeAt(e-1))||!qy(t.charCodeAt(e))}function F7(t,e,n){var o;return wi=((o=n==null?void 0:n.scanLimit)!==null&&o!==void 0?o:1e9)>>1,function(r,s,i){for(;;){zy(i,1);let a=!1;for(let l=0;l<i.length;l++){let c,d,h=i[l];(c=Ou(r,h.fromA,h.toA,s,h.fromB,h.toB))&&(h=i[l]=new Et(h.fromA+c,h.toA,h.fromB+c,h.toB)),(d=Du(r,h.fromA,h.toA,s,h.fromB,h.toB))&&(h=i[l]=new Et(h.fromA,h.toA-d,h.fromB,h.toB-d));let f=h.toA-h.fromA,p=h.toB-h.fromB;if(f&&p)continue;let _=h.fromA-(l?i[l-1].toA:0),g=(l<i.length-1?i[l+1].fromA:r.length)-h.toA;if(!_||!g)continue;let m=f?r.slice(h.fromA,h.toA):s.slice(h.fromB,h.toB);_<=m.length&&r.slice(h.fromA-_,h.fromA)==m.slice(m.length-_)?(i[l]=new Et(h.fromA-_,h.toA-_,h.fromB-_,h.toB-_),a=!0):g<=m.length&&r.slice(h.toA,h.toA+g)==m.slice(0,g)&&(i[l]=new Et(h.fromA+g,h.toA+g,h.fromB+g,h.toB+g),a=!0)}if(!a)break}return i}(t,e,vr(t,0,t.length,e,0,e.length))}function Gy(t,e,n){return function(o,r,s){for(let i=0,a=0;a<o.length;a++){let l=o[a],c=l.toA-l.fromA,d=l.toB-l.fromB;if(c&&d||c>3||d>3){let h=a==o.length-1?r.length:o[a+1].fromA,f=l.fromA-i,p=h-l.toA,_=Hy(r,l.fromA,Math.min(f,5)),g=$y(r,l.toA,Math.min(p,5)),m=l.fromA-_,b=g-l.toA;if(!c||!d){let y,x,v=Math.max(c,d),[C,k,E]=c?[r,l.fromA,l.toA]:[s,l.fromB,l.toB];m&&b?(v>m&&r.slice(_,l.fromA)==C.slice(E-m,E)?(l=o[a]=new Et(_,_+c,l.fromB-m,l.toB-m),_=l.fromA,g=$y(r,l.toA,Math.min(h-l.toA,5))):v>b&&r.slice(l.toA,g)==C.slice(k,k+b)&&(l=o[a]=new Et(g-c,g,l.fromB+b,l.toB+b),g=l.toA,_=Hy(r,l.fromA,Math.min(l.fromA-i,5))),m=l.fromA-_,b=g-l.toA):m||b||!(x=l.fromA-(y=L7(r,l.fromA,f)))||r.slice(y,l.fromA)!=C.slice(E-x,E)||(l=o[a]=new Et(y,y+c,l.fromB-x,l.toB-x))}(m||b)&&(l=o[a]=new Et(l.fromA-m,l.toA+b,l.fromB-m,l.toB+b)),i=l.toA}}return zy(o,3),o}(F7(t,e,n),t,e)}const eo=Ps.define({combine:t=>t[0]}),Pu=At.define(),es=Sn.define({create:t=>null,update(t,e){for(let n of e.effects)n.is(Pu)&&(t=n.value);return t}});class ts{constructor(e,n,o,r,s){this.changes=e,this.fromA=n,this.toA=o,this.fromB=r,this.toB=s}offset(e,n){return e||n?new ts(this.changes,this.fromA+e,this.toA+e,this.fromB+n,this.toB+n):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,n,o){return Ky(Gy(e.toString(),n.toString(),o),e,n,0,0)}static updateA(e,n,o,r,s){return Qy(Zy(e,r,!0,o.length),e,n,o,s)}static updateB(e,n,o,r,s){return Qy(Zy(e,r,!1,n.length),e,n,o,s)}}function Yy(t,e,n,o){let r=n.lineAt(t),s=o.lineAt(e);return r.to==t&&s.to==e&&t<n.length&&e<o.length?[t+1,e+1]:[r.from,s.from]}function Jy(t,e,n,o){let r=n.lineAt(t),s=o.lineAt(e);return r.from==t&&s.from==e?[t,e]:[r.to+1,s.to+1]}function Ky(t,e,n,o,r){let s=[];for(let i=0;i<t.length;i++){let a=t[i],[l,c]=Yy(a.fromA+o,a.fromB+r,e,n),[d,h]=Jy(a.toA+o,a.toB+r,e,n),f=[a.offset(-l+o,-c+r)];for(;i<t.length-1;){let p=t[i+1],[_,g]=Yy(p.fromA+o,p.fromB+r,e,n);if(_>d+1&&g>h+1)break;f.push(p.offset(-l+o,-c+r)),[d,h]=Jy(p.toA+o,p.toB+r,e,n),i++}s.push(new ts(f,l,Math.max(l,d),c,Math.max(c,h)))}return s}const fl=1e3;function Xy(t,e,n,o){let r=0,s=t.length;for(;;){if(r==s){let d=0,h=0;r&&({toA:d,toB:h}=t[r-1]);let f=e-(n?d:h);return[d+f,h+f]}let i=r+s>>1,a=t[i],[l,c]=n?[a.fromA,a.toA]:[a.fromB,a.toB];if(l>e)s=i;else{if(!(c<=e))return o?[a.fromA,a.fromB]:[a.toA,a.toB];r=i+1}}}function Zy(t,e,n,o){let r=[];return e.iterChangedRanges((s,i,a,l)=>{let c=0,d=n?e.length:o,h=0,f=n?o:e.length;s>fl&&([c,h]=Xy(t,s-fl,n,!0)),i<e.length-fl&&([d,f]=Xy(t,i+fl,n,!1));let p,_=l-a-(i-s),[g,m]=n?[_,0]:[0,_];r.length&&(p=r[r.length-1]).toA>=c?r[r.length-1]={fromA:p.fromA,fromB:p.fromB,toA:d,toB:f,diffA:p.diffA+g,diffB:p.diffB+m}:r.push({fromA:c,toA:d,fromB:h,toB:f,diffA:g,diffB:m})}),r}function Qy(t,e,n,o,r){if(!t.length)return e;let s=0,i=0,a=0,l=[];for(let c of t){let d=c.fromA+i,h=c.toA+i+c.diffA,f=c.fromB+a,p=c.toB+a+c.diffB;for(;s<e.length;){let _=e[s];if(_.toA+i<=d&&_.toB+a<=f)l.push(_.offset(i,a));else if(_.fromA+i>h)break;s++}for(let _ of Ky(Gy(n.sliceString(d,h),o.sliceString(f,p),r),n,o,d,f))l.push(_);for(i+=c.diffA,a+=c.diffB;s<e.length;){let _=e[s];if(_.fromA>h+i&&_.fromB>p+a)break;s++}}for(;s<e.length;)l.push(e[s++].offset(i,a));return l}const ex=kn.fromClass(class{constructor(t){({deco:this.deco,gutter:this.gutter}=ox(t))}update(t){var e,n;(t.docChanged||t.viewportChanged||(e=t.startState,n=t.state,e.field(es,!1)!=n.field(es,!1))||function(o,r){return o.facet(eo)!=r.facet(eo)}(t.startState,t.state))&&({deco:this.deco,gutter:this.gutter}=ox(t.view))}},{decorations:t=>t.deco}),pl=Lo.low(ZU({class:"cm-changeGutter",markers:t=>{var e;return((e=t.plugin(ex))===null||e===void 0?void 0:e.gutter)||Ap.empty}})),tx=dt.line({class:"cm-changedLine"}),z7=dt.mark({class:"cm-changedText"}),B7=dt.mark({tagName:"ins",class:"cm-insertedLine"}),U7=dt.mark({tagName:"del",class:"cm-deletedLine"}),nx=new class extends QU{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function V7(t,e,n,o,r,s){let i=n?t.fromA:t.fromB,a=n?t.toA:t.toB,l=0;if(i!=a){r.add(i,i,tx),r.add(i,a,n?U7:B7),s&&s.add(i,i,nx);for(let c=e.iterRange(i,a-1),d=i;!c.next().done;){if(c.lineBreak){d++,r.add(d,d,tx),s&&s.add(d,d,nx);continue}let h=d+c.value.length;if(o)for(;l<t.changes.length;){let f=t.changes[l],p=i+(n?f.fromA:f.fromB),_=i+(n?f.toA:f.toB),g=Math.max(d,p),m=Math.min(h,_);if(g<m&&r.add(g,m,z7),!(_<h))break;l++}d=h}}}function ox(t){let e=t.state.field(es),{side:n,highlightChanges:o,markGutter:r}=t.state.facet(eo),s=n=="a",i=new Ms,a=r?new Ms:null,{from:l,to:c}=t.viewport;for(let d of e){if((s?d.fromA:d.fromB)>=c)break;(s?d.toA:d.toB)>l&&V7(d,t.state.doc,s,o,i,a)}return{deco:i.finish(),gutter:a&&a.finish()}}class ml extends Ls{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 gl=At.define({map:(t,e)=>t.map(e)}),vi=Sn.define({create:()=>dt.none,update:(t,e)=>{for(let n of e.effects)if(n.is(gl))return n.value;return t.map(e.changes)},provide:t=>tt.decorations.from(t)}),Lu=.01,Fu=At.define({map:(t,e)=>e.mapPos(t)});class $7 extends Ls{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let n=document.createElement("div");return n.className="cm-collapsedLines",n.textContent="\u299A "+e.state.phrase("$ unchanged lines",this.lines)+" \u299A",n.addEventListener("click",o=>{let r=e.posAtDOM(o.target);e.dispatch({effects:Fu.of(r)});let{side:s,sibling:i}=e.state.facet(eo);i&&i().dispatch({effects:Fu.of(H7(r,e.state.field(es),s=="a"))})}),n}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}}function H7(t,e,n){let o=0,r=0;for(let s=0;;s++){let i=s<e.length?e[s]:null;if(!i||(n?i.fromA:i.fromB)>=t)return r+(t-o);[o,r]=n?[i.toA,i.toB]:[i.toB,i.toA]}}const W7=Sn.define({create:t=>dt.none,update(t,e){t=t.map(e.changes);for(let n of e.effects)n.is(Fu)&&(t=t.update({filter:o=>o!=n.value}));return t},provide:t=>tt.decorations.from(t)});function rx({margin:t=3,minSize:e=4}){return W7.init(n=>function(o,r,s){let i=new Ms,a=o.facet(eo).side=="a",l=o.field(es),c=1;for(let d=0;;d++){let h=d<l.length?l[d]:null,f=d?c+r:1,p=h?o.doc.lineAt(a?h.fromA:h.fromB).number-1-r:o.doc.lines,_=p-f+1;if(_>=s&&i.add(o.doc.line(f).from,o.doc.line(p).to,dt.replace({widget:new $7(_),block:!0})),!h)break;c=o.doc.lineAt(Math.min(o.doc.length,a?h.toA:h.toB)).number}return i.finish()}(n,t,e))}const q7=tt.styleModule.of(new XU({".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"}})),G7=tt.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"}}),sx=new kc,_l=new kc;class ix{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig;let n=[Lo.low(ex),G7,q7,vi,tt.updateListener.of(h=>{this.measuring<0&&(h.heightChanged||h.viewportChanged)&&!h.transactions.some(f=>f.effects.some(p=>p.is(gl)))&&this.measure()})],o=[eo.of({side:"a",sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&o.push(pl);let r=sr.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],tt.editorAttributes.of({class:"cm-merge-a"}),_l.of(o),n]}),s=[eo.of({side:"b",sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&s.push(pl);let i=sr.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],tt.editorAttributes.of({class:"cm-merge-b"}),_l.of(s),n]});this.chunks=ts.build(r.doc,i.doc,this.diffConf);let a=[es.init(()=>this.chunks),sx.of(e.collapseUnchanged?rx(e.collapseUnchanged):[])];r=r.update({effects:At.appendConfig.of(a)}).state,i=i.update({effects:At.appendConfig.of(a)}).state,this.dom=document.createElement("div"),this.dom.className="cm-mergeView",this.editorDOM=this.dom.appendChild(document.createElement("div")),this.editorDOM.className="cm-mergeViewEditors";let l=e.orientation||"a-b",c=document.createElement("div");c.className="cm-mergeViewEditor";let d=document.createElement("div");d.className="cm-mergeViewEditor",this.editorDOM.appendChild(l=="a-b"?c:d),this.editorDOM.appendChild(l=="a-b"?d:c),this.a=new tt({state:r,parent:c,root:e.root,dispatchTransactions:h=>this.dispatch(h,this.a)}),this.b=new tt({state:i,parent:d,root:e.root,dispatchTransactions:h=>this.dispatch(h,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls=="b-to-a",e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,n){if(e.some(o=>o.docChanged)){let o=e[e.length-1],r=e.reduce((i,a)=>i.compose(a.changes),ia.empty(e[0].startState.doc.length));this.chunks=n==this.a?ts.updateA(this.chunks,o.newDoc,this.b.state.doc,r,this.diffConf):ts.updateB(this.chunks,this.a.state.doc,o.newDoc,r,this.diffConf),n.update([...e,o.state.update({effects:Pu.of(this.chunks)})]);let s=n==this.a?this.b:this.a;s.update([s.state.update({effects:Pu.of(this.chunks)})]),this.scheduleMeasure()}else n.update(e)}reconfigure(e){if("diffConfig"in e&&(this.diffConf=e.diffConfig),"orientation"in e){let s=e.orientation!="b-a";if(s!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let i=this.a.dom.parentNode,a=this.b.dom.parentNode;i.remove(),a.remove(),this.editorDOM.insertBefore(s?i:a,this.editorDOM.firstChild),this.editorDOM.appendChild(s?a:i),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in e||"renderRevertControl"in e){let s=!!this.revertDOM,i=this.revertToA,a=this.renderRevert;"revertControls"in e&&(s=!!e.revertControls,i=e.revertControls=="b-to-a"),"renderRevertControl"in e&&(a=e.renderRevertControl),this.setupRevertControls(s,i,a)}let n="highlightChanges"in e,o="gutter"in e,r="collapseUnchanged"in e;if(n||o||r){let s=[],i=[];if(n||o){let a=this.a.state.facet(eo),l=o?e.gutter!==!1:a.markGutter,c=n?e.highlightChanges!==!1:a.highlightChanges;s.push(_l.reconfigure([eo.of({side:"a",sibling:()=>this.b,highlightChanges:c,markGutter:l}),l?pl:[]])),i.push(_l.reconfigure([eo.of({side:"b",sibling:()=>this.a,highlightChanges:c,markGutter:l}),l?pl:[]]))}if(r){let a=sx.reconfigure(e.collapseUnchanged?rx(e.collapseUnchanged):[]);s.push(a),i.push(a)}this.a.dispatch({effects:s}),this.b.dispatch({effects:i})}this.scheduleMeasure()}setupRevertControls(e,n,o){this.revertToA=n,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=o,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement("div"),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener("mousedown",r=>this.revertClicked(r)),this.revertDOM.className="cm-merge-revert"):this.revertDOM&&(this.revertDOM.textContent="")}scheduleMeasure(){if(this.measuring<0){let e=this.dom.ownerDocument.defaultView||window;this.measuring=e.requestAnimationFrame(()=>{this.measuring=-1,this.measure()})}}measure(){(function(e,n,o){let r=new Ms,s=new Ms,i=e.state.field(vi).iter(),a=n.state.field(vi).iter(),l=0,c=0,d=0,h=0;for(let g=0;;g++){let m=g<o.length?o[g]:null;if(l<(m?m.fromA:e.state.doc.length)){let b=e.lineBlockAt(l).top+d-(n.lineBlockAt(c).top+h);b<-.01?(d-=b,r.add(l,l,dt.widget({widget:new ml(-b),block:!0,side:-1}))):b>Lu&&(h+=b,s.add(c,c,dt.widget({widget:new ml(b),block:!0,side:-1})))}if(!m)break;for(l=m.toA,c=m.toB;i.value&&i.from<l;)d-=i.value.spec.widget.height,i.next();for(;a.value&&a.from<c;)h-=a.value.spec.widget.height,a.next()}for(;i.value;)d-=i.value.spec.widget.height,i.next();for(;a.value;)h-=a.value.spec.widget.height,a.next();let f=e.contentHeight+d-(n.contentHeight+h);f<Lu?r.add(e.state.doc.length,e.state.doc.length,dt.widget({widget:new ml(-f),block:!0,side:1})):f>Lu&&s.add(n.state.doc.length,n.state.doc.length,dt.widget({widget:new ml(f),block:!0,side:1}));let p=r.finish(),_=s.finish();Ap.eq([p],[e.state.field(vi)])||e.dispatch({effects:gl.of(p)}),Ap.eq([_],[n.state.field(vi)])||n.dispatch({effects:gl.of(_)})})(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,n=e.firstChild,o=this.a.viewport,r=this.b.viewport;for(let s=0;s<this.chunks.length;s++){let i=this.chunks[s];if(i.fromA>o.to||i.fromB>r.to)break;if(i.fromA<o.from||i.fromB<r.from)continue;let a=this.a.lineBlockAt(i.fromA).top+"px";for(;n&&+n.dataset.chunk<s;)n=ax(n);n&&n.dataset.chunk==String(s)?(n.style.top!=a&&(n.style.top=a),n=n.nextSibling):e.insertBefore(this.renderRevertButton(a,s),n)}for(;n;)n=ax(n)}renderRevertButton(e,n){let o;if(this.renderRevert)o=this.renderRevert();else{o=document.createElement("button");let r=this.a.state.phrase("Revert this chunk");o.setAttribute("aria-label",r),o.setAttribute("title",r),o.textContent=this.revertToLeft?"\u21DC":"\u21DD"}return o.style.top=e,o.setAttribute("data-chunk",String(n)),o}revertClicked(e){let n,o=e.target;for(;o&&o.parentNode!=this.revertDOM;)o=o.parentNode;if(o&&(n=this.chunks[o.dataset.chunk])){let[r,s,i,a,l,c]=this.revertToA?[this.b,this.a,n.fromB,n.toB,n.fromA,n.toA]:[this.a,this.b,n.fromA,n.toA,n.fromB,n.toB],d=r.state.sliceDoc(i,Math.max(i,a-1));i!=a&&c<=s.state.doc.length&&(d+=r.state.lineBreak),s.dispatch({changes:{from:l,to:Math.min(s.state.doc.length,c),insert:d},userEvent:"revert"}),e.preventDefault()}}destroy(){this.a.destroy(),this.b.destroy(),this.measuring>-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}}function ax(t){let e=t.nextSibling;return t.remove(),e}var Y7=["className","children","orientation","revertControls","highlightChanges","gutter","collapseUnchanged","destroyRerender","renderRevertControl","diffConfig"],J7=["modified","modifiedExtension","original","originalExtension","theme","dispatch"],lx=K.forwardRef((t,e)=>{var{className:n,children:o,orientation:r,revertControls:s,highlightChanges:i,gutter:a,collapseUnchanged:l,destroyRerender:c=!0,renderRevertControl:d,diffConfig:h}=t,f=la(t,Y7),p=Au(),{modified:_,modifiedExtension:g,original:m,originalExtension:b,theme:y,dispatch:x}=p,v=la(p,J7),C=T.useRef(null),k=T.useRef(),E={orientation:r,revertControls:s,highlightChanges:i,gutter:a,collapseUnchanged:l,renderRevertControl:d,diffConfig:h};T.useImperativeHandle(e,()=>({container:C.current,view:k.current,modified:_,original:m,config:St({a:m,b:_,parent:C.current},E)}),[C,k,_,m,E]);var N=tt.updateListener.of(A=>{if(A.docChanged&&typeof(b==null?void 0:b.onChange)=="function"){var M=A.state.doc.toString();b==null||b.onChange(M,A)}}),I=tt.updateListener.of(A=>{if(A.docChanged&&typeof(g==null?void 0:g.onChange)=="function"){var M=A.state.doc.toString();g==null||g.onChange(M,A)}});return T.useEffect(()=>{!k.current&&C.current&&b&&g&&(k.current=new ix(St({a:St({},m,{extensions:[...(b==null?void 0:b.extension)||[],...Bs(St({},b==null?void 0:b.option,{theme:y})),N]}),b:St({},_,{extensions:[...(g==null?void 0:g.extension)||[],...Bs(St({},g==null?void 0:g.option,{theme:y})),I]}),parent:C.current},E)),x({view:k.current}))},[k,C,b,g]),T.useEffect(()=>{if(m&&m.doc&&k.current){var A,M,R=(A=k.current)==null?void 0:A.a.state.doc.toString();R!==m.doc&&((M=k.current)==null||M.a.dispatch({changes:{from:0,to:R.length,insert:m.doc||""}}))}if(_&&_.doc&&k.current){var z,D,F=(z=k.current)==null?void 0:z.b.state.doc.toString();F!==_.doc&&((D=k.current)==null||D.b.dispatch({changes:{from:0,to:F.length,insert:_.doc||""}}))}if(c&&k.current){var B=k.current.a.state.selection.ranges[0].from,U=k.current.b.state.selection.ranges[0].from;k.current.destroy(),k.current=new ix(St({a:St({},m,{extensions:[...(b==null?void 0:b.extension)||[],...Bs(St({},b==null?void 0:b.option,{theme:y}))]}),b:St({},_,{extensions:[...(g==null?void 0:g.extension)||[],...Bs(St({},g==null?void 0:g.option,{theme:y}))]}),parent:C.current},E)),B&&(k.current.a.focus(),k.current.a.dispatch({selection:{anchor:B,head:B}})),U&&(k.current.b.focus(),k.current.b.dispatch({selection:{anchor:U,head:U}}))}},[k,y,C.current,m,_,b,g,c]),T.useEffect(()=>()=>k.current&&k.current.destroy(),[]),T.useEffect(()=>{if(k.current){var A={};v.orientation!==r&&(A.orientation=r),v.revertControls!==s&&(A.revertControls=s),v.highlightChanges!==i&&(A.highlightChanges=i),v.gutter!==a&&(A.gutter=a),v.collapseUnchanged!==l&&(A.collapseUnchanged=l),v.renderRevertControl!==d&&(A.collapseUnchanged=l),Object.keys(A).length&&x&&k.current&&(k.current.reconfigure(St({},A)),x(St({},A)))}},[x,k,r,s,i,a,l,d]),u.jsx("div",St({ref:C,className:"cm-merge-theme"+(n?" "+n:"")},f,{children:o}))});lx.displayName="CodeMirrorMerge.Internal";var K7=["theme"],ns=K.forwardRef((t,e)=>{var{theme:n}=t,o=la(t,K7);return u.jsx(O7,{theme:n,children:u.jsx(lx,St({},o,{ref:e}))})});ns.Original=Oy,ns.Modified=Dy,ns.displayName="CodeMirrorMerge";const X7=ns.Original,Z7=ns.Modified,cx=[tV(),tt.lineWrapping],Q7=t=>{const e=X.c(42),{className:n,onChange:o,initialPrompt:r,currentLanguageAdapter:s,currentCode:i,declineChange:a,acceptChange:l,enabled:c,children:d}=t;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={},e[0]=h):h=e[0];const[f,p]=T.useState(h),[_,g]=tn(JS),m=Tp(),{completion:b,input:y,stop:x,isLoading:v,setCompletion:C,setInput:k,handleSubmit:E}=eV({api:m.getAiURL("completion").toString(),headers:m.headers(),initialInput:r,streamProtocol:"text",experimental_throttle:100,body:{...f,includeOtherCode:_?vc(i):"",code:i,language:s},onError:eM,onFinish:(G,q)=>{N(q.trimEnd())}}),N=C,I=K.useRef(null);let A,M,R,z;e[1]!==c?(A=()=>{var q;const G=I.current;c&&G&&(requestAnimationFrame(()=>{var te;(te=G.view)==null||te.focus()}),nV((q=I.current)==null?void 0:q.view))},M=[c],e[1]=c,e[2]=A,e[3]=M):(A=e[2],M=e[3]),T.useEffect(A,M),e[4]!==c||e[5]!==r||e[6]!==k?(R=()=>{c&&k(r||"")},z=[c,r,k],e[4]=c,e[5]=r,e[6]=k,e[7]=R,e[8]=z):(R=e[7],z=e[8]),T.useEffect(R,z);const{theme:D}=lr();let F;e[9]!==n?(F=je("flex flex-col w-full rounded-[inherit]",n),e[9]=n,e[10]=F):F=e[10];const B=c&&"max-h-[400px] min-h-11 visible",U=!c&&"max-h-0 min-h-0 invisible";let O,S,$,j;e[11]!==B||e[12]!==U?(O=je("flex items-center gap-2 border-b px-3 transition-all rounded-[inherit] rounded-b-none duration-300",B,U),e[11]=B,e[12]=U,e[13]=O):O=e[13],e[14]!==l||e[15]!==b||e[16]!==a||e[17]!==c||e[18]!==E||e[19]!==_||e[20]!==y||e[21]!==v||e[22]!==N||e[23]!==g||e[24]!==k||e[25]!==x||e[26]!==D?(S=c&&u.jsxs(u.Fragment,{children:[u.jsx(Wi,{className:"text-[var(--blue-10)] flex-shrink-0",size:16}),u.jsx(Ic,{inputRef:I,theme:D,onClose:()=>{a(),N("")},value:y,onChange:G=>{k(G),p(O4({input:G}))},onSubmit:()=>{v||E()}}),v&&u.jsxs(Te,{"data-testid":"stop-completion-button",variant:"text",size:"xs",className:"mb-0",onClick:x,children:[u.jsx(Mp,{className:"animate-spin mr-1",size:14}),"Stop"]}),!v&&b&&u.jsx(Te,{"data-testid":"accept-completion-button",variant:"text",size:"xs",className:"mb-0",disabled:v,onClick:()=>{l(b),N("")},children:u.jsx("span",{className:"text-[var(--grass-11)] opacity-100",children:"Accept"})}),u.jsx("div",{className:"h-full w-px bg-border mx-2"}),u.jsx(Ae,{content:"Include code from other cells",children:u.jsxs("div",{className:"flex flex-row items-start gap-1 overflow-hidden",children:[u.jsx(D4,{"data-testid":"include-other-cells-checkbox",id:"include-other-cells",checked:_,onCheckedChange:G=>g(!!G)}),u.jsx(Ar,{htmlFor:"include-other-cells",className:"text-muted-foreground text-xs whitespace-nowrap ellipsis",children:"Include all code"})]})}),u.jsx(Te,{"data-testid":"decline-completion-button",variant:"text",size:"icon",disabled:v,onClick:()=>{x(),a(),N("")},children:u.jsx(Jn,{className:"text-[var(--red-10)]",size:16})})]}),e[14]=l,e[15]=b,e[16]=a,e[17]=c,e[18]=E,e[19]=_,e[20]=y,e[21]=v,e[22]=N,e[23]=g,e[24]=k,e[25]=x,e[26]=D,e[27]=S):S=e[27],e[28]!==O||e[29]!==S?($=u.jsx("div",{className:O,children:S}),e[28]=O,e[29]=S,e[30]=$):$=e[30],e[31]!==b||e[32]!==i||e[33]!==c||e[34]!==o||e[35]!==D?(j=b&&c&&u.jsxs(ns,{className:"cm",theme:D,children:[u.jsx(X7,{onChange:o,value:i,extensions:cx}),u.jsx(Z7,{value:b,editable:!1,readOnly:!0,extensions:cx})]}),e[31]=b,e[32]=i,e[33]=c,e[34]=o,e[35]=D,e[36]=j):j=e[36];const W=(!b||!c)&&d;let Y;return e[37]!==$||e[38]!==j||e[39]!==W||e[40]!==F?(Y=u.jsxs("div",{className:F,children:[$,j,W]}),e[37]=$,e[38]=j,e[39]=W,e[40]=F,e[41]=Y):Y=e[41],Y};function eM(t){ut({title:"Completion failed",description:M4(t)})}const tM=t=>{const e=X.c(24),{editorView:n,code:o,currentLanguageAdapter:r,onAfterToggle:s}=t;let i,a;e[0]!==o?(a=new Ji().isSupported(o)||o.trim()==="",e[0]=o,e[1]=a):a=e[1],i=a;const l=i;let c,d;e[2]!==o?(d=new jc().isSupported(o)||o.trim()==="",e[2]=o,e[3]=d):d=e[3],c=d;const h=c&&r==="python";let f,p;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsx(or,{color:"var(--sky-11)",strokeWidth:2.5,className:"w-4 h-4"}),e[4]=f):f=e[4],e[5]!==r||e[6]!==n||e[7]!==s||e[8]!==h?(p=u.jsx(zu,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:h,icon:f,toType:"sql",displayName:"SQL",onAfterToggle:s}),e[5]=r,e[6]=n,e[7]=s,e[8]=h,e[9]=p):p=e[9];const _=l&&r==="python";let g,m,b,y,x;return e[10]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx(Zl,{fill:"var(--sky-11)",color:"black",className:"w-4 h-4"}),e[10]=g):g=e[10],e[11]!==r||e[12]!==n||e[13]!==s||e[14]!==_?(m=u.jsx(zu,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:_,icon:g,toType:"markdown",displayName:"Markdown",onAfterToggle:s}),e[11]=r,e[12]=n,e[13]=s,e[14]=_,e[15]=m):m=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(Ql,{fill:"var(--sky-11)",color:"black",className:"w-4 h-4"}),e[16]=b):b=e[16],e[17]!==r||e[18]!==n?(y=u.jsx(zu,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:!0,icon:b,toType:"python",displayName:"Python",onAfterToggle:wn.NOOP}),e[17]=r,e[18]=n,e[19]=y):y=e[19],e[20]!==m||e[21]!==y||e[22]!==p?(x=u.jsxs("div",{className:"absolute right-3 top-2 z-20 flex hover-action gap-1",children:[p,m,y]}),e[20]=m,e[21]=y,e[22]=p,e[23]=x):x=e[23],x},zu=t=>{const e=X.c(10),{editorView:n,currentLanguageAdapter:o,canSwitchToLanguage:r,icon:s,toType:i,displayName:a,onAfterToggle:l}=t;let c;e[0]!==n||e[1]!==l||e[2]!==i?(c=()=>{n&&(Er(n,i),l())},e[0]=n,e[1]=l,e[2]=i,e[3]=c):c=e[3];const d=c;if(!r||o===i)return null;const h=`View as ${a}`;let f,p;return e[4]!==d||e[5]!==s?(f=u.jsx(Te,{"data-testid":"language-toggle-button",variant:"text",size:"xs",className:"opacity-80 px-1",onClick:d,children:s}),e[4]=d,e[5]=s,e[6]=f):f=e[6],e[7]!==h||e[8]!==f?(p=u.jsx(Ae,{content:h,children:f}),e[7]=h,e[8]=f,e[9]=p):p=e[9],p},dx=({theme:t,showPlaceholder:e,id:n,config:o,code:r,status:s,serializedEditorState:i,setEditorView:a,runCell:l,userConfig:c,editorViewRef:d,editorViewParentRef:h,hidden:f,hasOutput:p,temporarilyShowCode:_,languageAdapter:g,setLanguageAdapter:m,showLanguageToggles:b=!0})=>{var G;const[y,x]=tn(ka),v=oV(),C=ad(),{saveOrNameNotebook:k}=Og(),E=s==="running"||s==="queued",N=kt(),I=Jm(),A=g==="markdown",M=Xe(()=>!E&&(C({cellId:n}),!0)),R=Xe(()=>!E&&(l(),!0)),z=Xe(()=>{const q=!o.hide_code;return Ir({configs:{[n]:{hide_code:q}}}),N.updateCellConfig({cellId:n,config:{hide_code:q}}),q}),D=Be(Hi),F=Xe(()=>{ao(D,N.createNewCell)}),B=rV(c),U=T.useMemo(()=>{const q=f5({cellId:n,showPlaceholder:e,enableAI:B,cellActions:{...N,afterToggleMarkdown:F,onRun:R,deleteCell:M,saveNotebook:k,createManyBelow:te=>{for(const re of[...te].reverse())N.createNewCell({code:re,before:!1,cellId:n,skipIfCodeExists:!0})},splitCell:I,toggleHideCode:z,aiCellCompletion:()=>{let te=!1;return x(re=>(re==null?void 0:re.cellId)===n?(te=!0,null):{cellId:n}),te}},completionConfig:c.completion,keymapConfig:c.keymap,lspConfig:c.language_servers,theme:t,hotkeys:new R4(c.keymap.overrides??{}),diagnosticsConfig:c.diagnostics,displayConfig:c.display});return q.push(kn.define(te=>{const re=te.state.field(Sc);return m(re.type),{update(ie){const Z=ie.state.field(Sc);m(Z.type)}}}),tt.updateListener.of(te=>{te.selectionSet&&te.state.selection.ranges.some(re=>re.from!==re.to)&&_({focus:!1})})),q},[n,c.keymap,c.completion,c.language_servers,c.diagnostics,B,t,e,N,I,z,M,R,x,F,m,_,k]),O=Ec(),S=Xe(()=>{if(O){const te=Iu(n,0,r);U.push(te.extension),r=te.code}const q=new tt({state:sr.create({doc:r,extensions:U})});a(q),O||Er(q,Ep(q.state).type)}),$=Xe(()=>{if(Do(d.current!==null,"Editor view is not initialized"),O){const q=Iu(n);U.push(q.extension)}d.current.dispatch({effects:[At.reconfigure.of([U]),sV(d.current,c.completion,new R4(c.keymap.overrides??{}),{...c.language_servers,diagnostics:c.diagnostics})]})}),j=Xe(()=>{if(Do(i,"Editor view is not initialized"),O){const te=Iu(n,0,r);U.push(te.extension),r=te.code}const q=new tt({state:sr.fromJSON(i,{doc:r,extensions:U},{history:iV})});O||Er(q,Ep(q.state).type),a(q),N.clearSerializedEditorState({cellId:n})});T.useEffect(()=>{i===null?d.current===null?S():$():j(),d.current!==null&&h&&h.current!==null&&h.current.replaceChildren(d.current.dom)},[S,$,j,d,h,i,U]),T.useEffect(()=>{const q=d.current;return()=>{q==null||q.destroy()}},[d]);const W=f&&!A||f&&A&&!p;let Y="";return A&&f&&p?Y="h-0 overflow-hidden":f&&(Y="opacity-20 h-8 [&>div.cm-editor]:h-full [&>div.cm-editor]:overflow-hidden"),u.jsx(Q7,{enabled:(y==null?void 0:y.cellId)===n,initialPrompt:y==null?void 0:y.initialPrompt,currentCode:((G=d.current)==null?void 0:G.state.doc.toString())??r,currentLanguageAdapter:g,declineChange:Xe(()=>{var q;x(null),(q=d.current)==null||q.focus()}),onChange:Xe(q=>{var te;(te=d.current)==null||te.dispatch({changes:{from:0,to:d.current.state.doc.length,insert:q}})}),acceptChange:Xe(q=>{var te,re;(te=d.current)==null||te.dispatch({changes:{from:0,to:d.current.state.doc.length,insert:q}}),(re=d.current)==null||re.focus(),x(null)}),children:u.jsxs("div",{className:"relative w-full",onFocus:()=>v(n),children:[W&&u.jsx(P4,{tooltip:"Edit code",className:"absolute inset-0 z-10",onClick:_}),u.jsx(ux,{className:Y,editorView:d.current,ref:h}),!f&&b&&u.jsx("div",{className:"absolute top-1 right-5",children:u.jsx(tM,{code:r,editorView:d.current,currentLanguageAdapter:g,onAfterToggle:F})})]})})},ux=K.forwardRef((t,e)=>{const n=X.c(10),{className:o,editorView:r}=t,s=T.useRef(null);let i,a,l,c,d;return n[0]!==r?(i=()=>{r!==null&&s.current!==null&&s.current.children.length===0&&s.current.append(r.dom)},a=[r,s],n[0]=r,n[1]=i,n[2]=a):(i=n[1],a=n[2]),T.useEffect(i,a),n[3]!==o?(l=je("cm mathjax_ignore",o),n[3]=o,n[4]=l):l=n[4],n[5]!==e?(c=h=>{e?hl(e,s)(h):hl(s)(h)},n[5]=e,n[6]=c):c=n[6],n[7]!==l||n[8]!==c?(d=u.jsx("div",{className:l,ref:c,"data-testid":"cell-editor"}),n[7]=l,n[8]=c,n[9]=d):d=n[9],d});ux.displayName="CellCodeMirrorEditor";const Bu=Ec()?function(t){const e=n=>{const o=X.c(5),r=Be(cn),[s,i]=tn(Zr);if(r.state===Ft.CONNECTING||s===void 0){let l,c;return o[0]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx("span",{children:"Waiting for real-time collaboration connection..."}),o[0]=l):l=o[0],o[1]!==i?(c=u.jsx("div",{className:"flex h-full w-full items-baseline p-4",children:u.jsxs(Op,{milliseconds:1e3,fallback:null,children:[l,u.jsx(Te,{variant:"link",onClick:()=>{i("disabled")},children:"Turn off real-time collaboration"})]})}),o[1]=i,o[2]=c):c=o[2],c}let a;return o[3]!==n?(a=u.jsx(t,{...n}),o[3]=n,o[4]=a):a=o[4],a};return e.displayName=`WithWaitUntilConnected(${t.displayName})`,e}(T.memo(dx)):T.memo(dx),nM=t=>{const e=X.c(10);let n,o,r,s;return e[0]!==t.left?(n=u.jsx("div",{className:"flex-1 flex item-center gap-2",children:t.left}),e[0]=t.left,e[1]=n):n=e[1],e[2]!==t.center?(o=u.jsx("div",{className:"flex-1 flex item-center gap-2 justify-center",children:t.center}),e[2]=t.center,e[3]=o):o=e[3],e[4]!==t.right?(r=u.jsx("div",{className:"flex-1 flex item-center gap-2 justify-end",children:t.right}),e[4]=t.right,e[5]=r):r=e[5],e[6]!==n||e[7]!==o||e[8]!==r?(s=u.jsxs("div",{className:"flex items-center gap-2 w-full px-3",children:[n,o,r]}),e[6]=n,e[7]=o,e[8]=r,e[9]=s):s=e[9],s},oM=t=>{const e=X.c(8);if(!t.canCollapse&&!t.isCollapsed)return null;const n=t.isCollapsed?"Expand":"Collapse";let o,r,s;return e[0]!==t.isCollapsed?(o=u.jsx("span",{children:u.jsx(rM,{isCollapsed:t.isCollapsed})}),e[0]=t.isCollapsed,e[1]=o):o=e[1],e[2]!==n||e[3]!==o?(r=u.jsx(Ae,{content:n,children:o}),e[2]=n,e[3]=o,e[4]=r):r=e[4],e[5]!==t.onClick||e[6]!==r?(s=u.jsx(Te,{variant:"text",size:"icon",onClick:t.onClick,children:r}),e[5]=t.onClick,e[6]=r,e[7]=s):s=e[7],s},rM=t=>{const e=X.c(2),{isCollapsed:n}=t;let o;return e[0]!==n?(o=n?u.jsx(qi,{className:"w-5 h-5 flex-shrink-0"}):u.jsx(js,{className:"w-5 h-5 flex-shrink-0"}),e[0]=n,e[1]=o):o=e[1],o},hx=T.memo(t=>{const e=X.c(24),{onClick:n,count:o,cellId:r}=t,s=mc();let i;e[0]!==r||e[1]!==s?(i=aV(s,r),e[0]=r,e[1]=s,e[2]=i):i=e[2];const a=i;let l,c;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=je("flex items-center justify-between w-[calc(100%-2rem)] h-9 bg-muted rounded-b mx-4 opacity-80 hover:opacity-100 cursor-pointer"),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(lV,{className:"w-4 h-4 flex-shrink-0"}),e[4]=c):c=e[4];const d=o===1?"cell":"cells";let h,f,p,_,g,m,b;return e[5]!==o||e[6]!==d?(h=u.jsxs(u.Fragment,{children:[c,u.jsxs("span",{className:"text-sm text-gray-500",children:[o," ",d," collapsed"]})]}),e[5]=o,e[6]=d,e[7]=h):h=e[7],e[8]!==a.errored?(f=a.errored&&u.jsx(Ae,{content:"Has errors",delayDuration:100,children:u.jsx(Cm,{className:"w-4 h-4 flex-shrink-0 text-destructive"})}),e[8]=a.errored,e[9]=f):f=e[9],e[10]!==a.stale?(p=a.stale&&u.jsx(Ae,{content:"Has stale cells",delayDuration:100,children:u.jsx(L4,{className:"w-4 h-4 flex-shrink-0 text-[var(--yellow-11)]"})}),e[10]=a.stale,e[11]=p):p=e[11],e[12]!==a.runningOrQueued?(_=a.runningOrQueued&&u.jsx(Ae,{content:"Running",delayDuration:100,children:u.jsx(Mp,{className:"w-4 h-4 flex-shrink-0 animate-spin"})}),e[12]=a.runningOrQueued,e[13]=_):_=e[13],e[14]!==f||e[15]!==p||e[16]!==_?(g=u.jsxs(u.Fragment,{children:[f,p,_]}),e[14]=f,e[15]=p,e[16]=_,e[17]=g):g=e[17],e[18]!==h||e[19]!==g?(m=u.jsx(nM,{center:h,right:g}),e[18]=h,e[19]=g,e[20]=m):m=e[20],e[21]!==n||e[22]!==m?(b=u.jsx("div",{onClick:n,className:l,children:m}),e[21]=n,e[22]=m,e[23]=b):b=e[23],b});hx.displayName="CollapsedCellBanner";const fx=t=>{const e=X.c(31),{status:n,connectionState:o,onClick:r}=t,s=n==="running"||n==="queued";let i,a,l,c,d,h,f,p,_,g,m,b,y,x;if(e[0]!==o||e[1]!==s||e[2]!==r||e[3]!==n){const v=uo(o);let C;if(v){let k;e[14]!==o?(k=Fc(o),e[14]=o,e[15]=k):k=e[15],C=k}else C=n==="running"?"A cell can't be deleted when it's running":n==="queued"?"A cell can't be deleted when it's queued to run":"Delete";a=Ae,_=C,g=!1,i=Te,l="ghost",c="icon",d=r,h="delete-button",f=Pn.preventFocus,p=je("hover:bg-transparent text-destructive/60 hover:text-destructive",(v||s)&&"inactive-button"),e[0]=o,e[1]=s,e[2]=r,e[3]=n,e[4]=i,e[5]=a,e[6]=l,e[7]=c,e[8]=d,e[9]=h,e[10]=f,e[11]=p,e[12]=_,e[13]=g}else i=e[4],a=e[5],l=e[6],c=e[7],d=e[8],h=e[9],f=e[10],p=e[11],_=e[12],g=e[13];return e[16]===Symbol.for("react.memo_cache_sentinel")?(m={boxShadow:"none"},b=u.jsx(np,{size:14}),e[16]=m,e[17]=b):(m=e[16],b=e[17]),e[18]!==i||e[19]!==l||e[20]!==c||e[21]!==d||e[22]!==h||e[23]!==f||e[24]!==p?(y=u.jsx(i,{variant:l,size:c,onClick:d,"data-testid":h,onMouseDown:f,className:p,style:m,children:b}),e[18]=i,e[19]=l,e[20]=c,e[21]=d,e[22]=h,e[23]=f,e[24]=p,e[25]=y):y=e[25],e[26]!==a||e[27]!==y||e[28]!==_||e[29]!==g?(x=u.jsx(a,{content:_,usePortal:g,children:y}),e[26]=a,e[27]=y,e[28]=_,e[29]=g,e[30]=x):x=e[30],x},sM=t=>{const e=X.c(27),{onClick:n,connectionState:o,needsRun:r,status:s,config:i,edited:a}=t,l=s==="disabled-transitively",c=s==="running"||s==="queued";let d,h;e[0]!==l||e[1]!==i.disabled||e[2]!==o||e[3]!==a||e[4]!==c||e[5]!==r?(d=uo(o)||c||!i.disabled&&l&&!a,h=function(m,b,y,x){return uo(m)?"disabled":b&&!y?"stale":y||x?"disabled":"green"}(o,r,c,d),e[0]=l,e[1]=i.disabled,e[2]=o,e[3]=a,e[4]=c,e[5]=r,e[6]=d,e[7]=h):(d=e[6],h=e[7]);const f=h;if(i.disabled){let m,b;return e[8]===Symbol.for("react.memo_cache_sentinel")?(m=u.jsx(mm,{}),e[8]=m):m=e[8],e[9]!==d||e[10]!==n||e[11]!==f?(b=u.jsx(Qs,{tooltip:"Add code to notebook",disabled:d,onClick:n,variant:f,"data-testid":"run-button",children:m}),e[9]=d,e[10]=n,e[11]=f,e[12]=b):b=e[12],b}if(!i.disabled&&l&&!a){let m,b;return e[13]===Symbol.for("react.memo_cache_sentinel")?(m=u.jsx(Hs,{strokeWidth:1.2}),e[13]=m):m=e[13],e[14]!==d||e[15]!==n||e[16]!==f?(b=u.jsx(Qs,{disabled:d,tooltip:"This cell can't be run because it has a disabled ancestor",onClick:n,variant:f,"data-testid":"run-button",children:m}),e[14]=d,e[15]=n,e[16]=f,e[17]=b):b=e[17],b}let p,_,g;if(uo(o)){let m;e[18]!==o?(m=Fc(o),e[18]=o,e[19]=m):m=e[19],p=m}else if(s==="queued")p="This cell is already queued to run";else if(s==="running")p="This cell is already running.";else{let m;e[20]===Symbol.for("react.memo_cache_sentinel")?(m=nn("cell.run"),e[20]=m):m=e[20],p=m}return e[21]===Symbol.for("react.memo_cache_sentinel")?(_=u.jsx(Hs,{strokeWidth:1.2}),e[21]=_):_=e[21],e[22]!==d||e[23]!==n||e[24]!==p||e[25]!==f?(g=u.jsx(Qs,{tooltip:p,disabled:d,onClick:n,variant:f,"data-testid":"run-button",children:_}),e[22]=d,e[23]=n,e[24]=p,e[25]=f,e[26]=g):g=e[26],g},px=K.createContext(null),mx=T.memo(()=>T.use(px));mx.displayName="DragHandle";const gx=K.forwardRef((t,e)=>{const n=X.c(21);let o,r,s,i,a;n[0]!==t?({cellId:r,canMoveX:o,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]),n[4]!==r?(i=r.toString(),n[4]=r,n[5]=i):i=n[5],n[6]!==i?(a={id:i},n[6]=i,n[7]=a):a=n[7];const{attributes:l,listeners:c,setNodeRef:d,transform:h,transition:f,isDragging:p}=p1(a);let _;n[8]!==h?(_=function(y){return!y||y.x===0&&y.y===0&&y.scaleX===1&&y.scaleY===1}(h)?null:h,n[8]=h,n[9]=_):_=n[9];const g=_,m=g==null?void 0:f;let b;return n[10]!==l||n[11]!==o||n[12]!==r||n[13]!==p||n[14]!==c||n[15]!==s||n[16]!==e||n[17]!==d||n[18]!==g||n[19]!==m?(b=u.jsx(_x,{ref:e,cellId:r,canMoveX:o,...s,attributes:l,listeners:c,setNodeRef:d,transform:g,transition:m,isDragging:p}),n[10]=l,n[11]=o,n[12]=r,n[13]=p,n[14]=c,n[15]=s,n[16]=e,n[17]=d,n[18]=g,n[19]=m,n[20]=b):b=n[20],b});gx.displayName="SortableCell";const _x=K.forwardRef((t,e)=>{const n=X.c(37);let o,r,s,i,a,l,c,d,h,f;if(n[0]!==t){const{cellId:I,canMoveX:A,children:M,attributes:R,listeners:z,setNodeRef:D,transform:F,transition:B,isDragging:U,...O}=t;r=A,s=M,o=R,a=z,c=D,d=F,h=B,i=U,l=O,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i,n[5]=a,n[6]=l,n[7]=c,n[8]=d,n[9]=h}else o=n[1],r=n[2],s=n[3],i=n[4],a=n[5],l=n[6],c=n[7],d=n[8],h=n[9];n[10]!==r||n[11]!==d?(f=d?yc.Transform.toString({x:r?d.x:0,y:d.y,scaleX:1,scaleY:1}):void 0,n[10]=r,n[11]=d,n[12]=f):f=n[12];const p=i?2:void 0;let _;n[13]!==f||n[14]!==p||n[15]!==h?(_={transform:f,transition:h,zIndex:p,position:"relative"},n[13]=f,n[14]=p,n[15]=h,n[16]=_):_=n[16];const g=_;let m,b;n[17]===Symbol.for("react.memo_cache_sentinel")?(m=u.jsx(pm,{strokeWidth:1,size:20}),n[17]=m):m=n[17],n[18]!==o||n[19]!==a?(b=u.jsx("div",{...o,...a,onMouseDown:Pn.preventFocus,"data-testid":"drag-button",className:"py-[1px] cursor-grab opacity-50 hover:opacity-100 hover-action hover:bg-muted rounded border border-transparent hover:border-border active:bg-accent",children:m}),n[18]=o,n[19]=a,n[20]=b):b=n[20];const y=b,x=!!d;let v;n[21]!==e||n[22]!==c?(v=I=>{hl(e,c)(I)},n[21]=e,n[22]=c,n[23]=v):v=n[23];const C=x&&"is-moving";let k,E,N;return n[24]!==l.className||n[25]!==C?(k=je(l.className,C,"outline-offset-4 outline-primary/40 rounded-lg"),n[24]=l.className,n[25]=C,n[26]=k):k=n[26],n[27]!==s||n[28]!==y?(E=u.jsx(px.Provider,{value:y,children:s}),n[27]=s,n[28]=y,n[29]=E):E=n[29],n[30]!==i||n[31]!==l||n[32]!==g||n[33]!==v||n[34]!==k||n[35]!==E?(N=u.jsx("div",{tabIndex:-1,ref:v,...l,"data-is-dragging":i,className:k,style:g,children:E}),n[30]=i,n[31]=l,n[32]=g,n[33]=v,n[34]=k,n[35]=E,n[36]=N):N=n[36],N});function bx(t,e){const n=X.c(9);let o;n[0]!==t.current||n[1]!==e?(o=l=>{t.current===null||t.current.contains(l.relatedTarget)||e.current===null||Xf(e.current)},n[0]=t.current,n[1]=e,n[2]=o):o=n[2];const r=Xe(o);let s;n[3]!==t.current||n[4]!==e?(s=l=>{if(t.current===document.activeElement&&e.current!==null&&sa(e.current.state)==="active"){for(const c of x4)if(l.key===c.key&&c.run){c.run(e.current),l.preventDefault(),l.stopPropagation();break}e.current.focus()}},n[3]=t.current,n[4]=e,n[5]=s):s=n[5];const i=Xe(s);let a;return n[6]!==r||n[7]!==i?(a={closeCompletionHandler:r,resumeCompletionHandler:i},n[6]=r,n[7]=i,n[8]=a):a=n[8],a}function yx(t,e,n,o,r,s,i,a,l){const c=X.c(51);let d,h,f,p,_,g,m,b,y,x,v,C,k,E,N,I;c[0]!==o||c[1]!==e||c[2]!==n?(d=()=>{n(),o.moveToNextCell({cellId:e,before:!1})},h=()=>{n(),o.moveToNextCell({cellId:e,before:!0})},c[0]=o,c[1]=e,c[2]=n,c[3]=d,c[4]=h):(d=c[3],h=c[4]),c[5]!==o||c[6]!==e?(f=()=>o.createNewCell({cellId:e,before:!0}),p=()=>o.createNewCell({cellId:e,before:!1}),_=()=>o.moveCell({cellId:e,before:!0}),g=()=>o.moveCell({cellId:e,before:!1}),c[5]=o,c[6]=e,c[7]=f,c[8]=p,c[9]=_,c[10]=g):(f=c[7],p=c[8],_=c[9],g=c[10]),c[11]!==o||c[12]!==r||c[13]!==e?(m=()=>r?o.moveCell({cellId:e,direction:"left"}):void 0,b=()=>r?o.moveCell({cellId:e,direction:"right"}):void 0,c[11]=o,c[12]=r,c[13]=e,c[14]=m,c[15]=b):(m=c[14],b=c[15]),c[16]!==o||c[17]!==s||c[18]!==e||c[19]!==(t==null?void 0:t.current)||c[20]!==i?(y=()=>{var M,R,z;const A=!s.hide_code;Ir({configs:{[e]:{hide_code:A}}}),o.updateCellConfig({cellId:e,config:{hide_code:A}}),A?((M=i.current)==null||M.contentDOM.blur(),(R=t==null?void 0:t.current)==null||R.focus()):(z=i.current)==null||z.focus()},c[16]=o,c[17]=s,c[18]=e,c[19]=t==null?void 0:t.current,c[20]=i,c[21]=y):y=c[21],c[22]!==o||c[23]!==e?(k=()=>o.moveToNextCell({cellId:e,before:!1,noCreate:!0}),x=()=>o.moveToNextCell({cellId:e,before:!0,noCreate:!0}),v=()=>o.sendToBottom({cellId:e}),C=()=>o.sendToTop({cellId:e}),c[22]=o,c[23]=e,c[24]=x,c[25]=v,c[26]=C,c[27]=k):(x=c[24],v=c[25],C=c[26],k=c[27]),c[28]!==e||c[29]!==i||c[30]!==a?(E=()=>{let A;A=!1,a(M=>(M==null?void 0:M.cellId)===e?(A=!0,null):{cellId:e}),A&&M_(i).focus()},c[28]=e,c[29]=i,c[30]=a,c[31]=E):E=c[31],c[32]!==l?(N=()=>{var A;(A=l.current)==null||A.toggle()},c[32]=l,c[33]=N):N=c[33],c[34]!==n||c[35]!==d||c[36]!==h||c[37]!==x||c[38]!==v||c[39]!==C||c[40]!==E||c[41]!==N||c[42]!==f||c[43]!==p||c[44]!==_||c[45]!==g||c[46]!==m||c[47]!==b||c[48]!==y||c[49]!==k?(I={"cell.run":n,"cell.runAndNewBelow":d,"cell.runAndNewAbove":h,"cell.createAbove":f,"cell.createBelow":p,"cell.moveUp":_,"cell.moveDown":g,"cell.moveLeft":m,"cell.moveRight":b,"cell.hideCode":y,"cell.focusDown":k,"cell.focusUp":x,"cell.sendToBottom":v,"cell.sendToTop":C,"cell.aiCompletion":E,"cell.cellActions":N},c[34]=n,c[35]=d,c[36]=h,c[37]=x,c[38]=v,c[39]=C,c[40]=E,c[41]=N,c[42]=f,c[43]=p,c[44]=_,c[45]=g,c[46]=m,c[47]=b,c[48]=y,c[49]=k,c[50]=I):I=c[50],uV(t,I)}function xx(t,e,n,o,r,s){const i=X.c(16);let a,l,c,d,h;i[0]!==n||i[1]!==e?(a=f=>(!f||!Pn.fromInput(f))&&(n.moveToNextCell({cellId:e,before:!1,noCreate:!0}),!0),l=f=>(!f||!Pn.fromInput(f))&&(n.moveToNextCell({cellId:e,before:!0,noCreate:!0}),!0),i[0]=n,i[1]=e,i[2]=a,i[3]=l):(a=i[2],l=i[3]),i[4]!==o?(c=()=>(o(),!1),i[4]=o,i[5]=c):c=i[5],i[6]!==n||i[7]!==e||i[8]!==s||i[9]!==r.keymap.preset?(d=r.keymap.preset!=="vim"||s?{}:{j:f=>(!f||!Pn.fromInput(f))&&(n.moveToNextCell({cellId:e,before:!1,noCreate:!0}),!0),k:f=>(!f||!Pn.fromInput(f))&&(n.moveToNextCell({cellId:e,before:!0,noCreate:!0}),!0)},i[6]=n,i[7]=e,i[8]=s,i[9]=r.keymap.preset,i[10]=d):d=i[10],i[11]!==a||i[12]!==l||i[13]!==c||i[14]!==d?(h={ArrowDown:a,ArrowUp:l,Enter:c,...d},i[11]=a,i[12]=l,i[13]=c,i[14]=d,i[15]=h):h=i[15],hV(t,h)}_x.displayName="SortableCellInternal";const wx=T.forwardRef((t,e)=>{const n=X.c(14),{id:o,output:r,interrupted:s,errored:i,stopped:a,name:l,outputStale:c,outputLoading:d}=t;let h;n[0]===Symbol.for("react.memo_cache_sentinel")?(h=Ac("marimo-cell","hover-actions-parent z-10",{published:!0}),n[0]=h):h=n[0];const f=h;let p;n[1]!==o?(p=Cs.create(o),n[1]=o,n[2]=p):p=n[2];const _=p,g=B4(r==null?void 0:r.mimetype);if(i||s||a||g)return null;let m,b;return n[3]!==o||n[4]!==r||n[5]!==d||n[6]!==c?(m=u.jsx(Tc,{allowExpand:!1,forceExpand:!0,output:r,className:"output-area",cellId:o,stale:c,loading:d}),n[3]=o,n[4]=r,n[5]=d,n[6]=c,n[7]=m):m=n[7],n[8]!==_||n[9]!==o||n[10]!==l||n[11]!==e||n[12]!==m?(b=u.jsx("div",{tabIndex:-1,id:_,ref:e,className:f,"data-cell-id":o,"data-cell-name":l,children:m}),n[8]=_,n[9]=o,n[10]=l,n[11]=e,n[12]=m,n[13]=b):b=n[13],b});wx.displayName="ReadonlyCellComponent";const iM=({theme:t,showPlaceholder:e,id:n,code:o,output:r,consoleOutputs:s,status:i,runStartTimestamp:a,lastRunStartTimestamp:l,runElapsedTimeMs:c,edited:d,interrupted:h,errored:f,stopped:p,staleInputs:_,serializedEditorState:g,serialization:m,debuggerActive:b,connectionState:y,canDelete:x,actions:v,deleteCell:C,userConfig:k,outline:E,isCollapsed:N,collapseCount:I,config:A,canMoveX:M,name:R,editorView:z,setEditorView:D,outputStale:F})=>{const B=T.useRef(null),U=T.useRef(null),O=T.useRef(null),S=T.useRef(null),$=Kt(ka),j=nd(n),[W,Y]=T.useState(),G=A.disabled||i==="disabled-transitively",q=U4({executionTime:c,status:i,errored:f,interrupted:h,stopped:p}),te=d||h||_&&!G,re=F4(i),ie=(i==="queued"||d||_)&&!h,Z=T.useCallback(()=>z.current,[z]),{closeCompletionHandler:ee,resumeCompletionHandler:ue}=bx(B,z),{isCellCodeShown:me,isMarkdown:de,isMarkdownCodeHidden:fe,temporarilyShowCode:he,showHiddenMarkdownCode:Ce}=function(J,ge,_e,pe){const le=X.c(13),[He,Fe]=T.useState(!1),Ze=!J.hide_code||He,se=ge==="markdown",Ne=se&&!Ze;let Ie;le[0]!==_e||le[1]!==pe||le[2]!==Ze?(Ie=it=>{var Lt,en;if(Ze)return;const ot=(it==null?void 0:it.focus)??!0;Fe(!0),ot&&((Lt=_e.current)==null||Lt.focus());const at=(en=pe.current)==null?void 0:en.parentElement;if(!at)return void It.error("Cell: No parent element found for editor view");const Dt=()=>{requestAnimationFrame(()=>{var $t;at.contains(document.activeElement)||(Fe(!1),($t=_e.current)==null||$t.dom.blur(),at.removeEventListener("focusout",Dt))})};at.addEventListener("focusout",Dt)},le[0]=_e,le[1]=pe,le[2]=Ze,le[3]=Ie):Ie=le[3];const Ve=Xe(Ie);let Ye;le[4]!==Ne||le[5]!==Ve?(Ye=()=>{Ne&&Ve({focus:!0})},le[4]=Ne,le[5]=Ve,le[6]=Ye):Ye=le[6];const Le=Xe(Ye);let qe;return le[7]!==Ze||le[8]!==se||le[9]!==Ne||le[10]!==Le||le[11]!==Ve?(qe={isCellCodeShown:Ze,isMarkdown:se,isMarkdownCodeHidden:Ne,temporarilyShowCode:Ve,showHiddenMarkdownCode:Le},le[7]=Ze,le[8]=se,le[9]=Ne,le[10]=Le,le[11]=Ve,le[12]=qe):qe=le[12],qe}(A,W,z,O);yx(B,n,j,v,M,A,z,$,U),xx(B,n,v,Ce,k,me);const Ee=dV(E),ae=!z4(r),Me=s.length>0,xe=k.display.cell_output,Re=ae&&xe==="above",Ue=ae&&xe==="below",[Je,Ke]=T.useState(!1),[Pe,st]=T.useState(!1);(function(J){const{ref:ge,box:_e="content-box",skip:pe}=J,le=T.useRef({...m5}),He=T.useRef(void 0);He.current=J.onResize,T.useEffect(()=>{if(!ge.current||pe||typeof window>"u"||!("ResizeObserver"in window))return;const Fe=new ResizeObserver(([Ze])=>{const se=_e==="border-box"?"borderBoxSize":_e==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",Ne=T_(Ze,se,"inlineSize"),Ie=T_(Ze,se,"blockSize");if(le.current.width!==Ne||le.current.height!==Ie){const Ve={width:Ne,height:Ie};le.current.width=Ne,le.current.height=Ie,He.current&&He.current(Ve)}});return Fe.observe(ge.current,{box:_e}),()=>{Fe.disconnect()}},[_e,ge,pe])})({ref:S,skip:!de,onResize:J=>{const ge=J.height&&J.height<68,_e=fe&&(ge||xe==="below");Ke(_e),Ee&&_e?st(!0):Pe&&st(!1)}});const et=J=>u.jsx(P4,{tooltip:"Edit markdown",className:je("z-20 relative",J),onClick:he}),nt=ae&&u.jsxs("div",{className:"relative",onDoubleClick:Ce,children:[u.jsx("div",{className:"absolute top-5 -left-8 z-10 print:hidden",children:u.jsx(oM,{isCollapsed:N,onClick:()=>{N?v.expandCell({cellId:n}):v.collapseCell({cellId:n})},canCollapse:Ee})}),fe&&Ue&&et("top-3"),u.jsx(Tc,{allowExpand:!0,forceExpand:fe,output:r,className:"output-area",cellId:n,stale:F,loading:re}),fe&&Re&&et("bottom-3")]}),ne=Ac("marimo-cell","hover-actions-parent z-10",{interactive:!0,"needs-run":te,"has-error":f,stopped:p,disabled:A.disabled,stale:i==="disabled-transitively",borderless:fe&&ae}),ve=Cs.create(n),Se=Xe(J=>{$({cellId:n,initialPrompt:J.prompt})}),De=!(!m||m.toLowerCase()!=="valid");return u.jsx(Dp,{children:u.jsx(p0,{cellId:n,config:A,status:i,getEditorView:Z,hasOutput:ae,hasConsoleOutput:Me,name:R,children:u.jsxs(gx,{tabIndex:-1,ref:B,"data-status":i,onBlur:ee,onKeyDown:ue,cellId:n,canMoveX:M,title:A.disabled?"This cell is disabled":i==="disabled-transitively"?"This cell has a disabled ancestor":void 0,children:[u.jsxs("div",{className:ne,id:ve,ref:S,"data-cell-id":n,"data-cell-name":R,children:[xe==="above"&&nt,u.jsxs("div",{className:je("tray"),"data-hidden":fe,children:[u.jsx("div",{className:"absolute right-2 -top-4 z-10",children:u.jsx(kx,{edited:d,connectionState:y,status:i,cellConfig:A,needsRun:te,hasOutput:ae,hasConsoleOutput:Me,cellActionDropdownRef:U,cellId:n,name:R,getEditorView:Z,onRun:j})}),u.jsx(aM,{cellId:n,className:je(fe&&Re&&"-top-7",fe&&Ue&&"-bottom-8",fe&&Pe&&"-left-[3.8rem]"),connectionState:y,actions:v}),u.jsx(Bu,{theme:t,showPlaceholder:e,id:n,code:o,config:A,status:i,serializedEditorState:g,runCell:j,setEditorView:D,userConfig:k,editorViewRef:z,editorViewParentRef:O,hidden:!me,hasOutput:ae,temporarilyShowCode:he,languageAdapter:W,setLanguageAdapter:Y}),u.jsx(vx,{className:je(fe&&xe==="below"&&"top-14"),edited:d,status:i,isCellStatusInline:Je,uninstantiated:q,disabled:A.disabled,runElapsedTimeMs:c,runStartTimestamp:a,lastRunStartTimestamp:l,staleInputs:_,interrupted:h}),u.jsx("div",{className:"shoulder-bottom hover-action",children:x&&me&&u.jsx(fx,{connectionState:y,status:i,onClick:()=>{re||uo(y)||C({cellId:n})}})})]}),xe==="below"&&nt,m&&u.jsxs("a",{href:"https://links.marimo.app/reusable-definitions",target:"_blank",className:"hover:underline py-1 px-2 flex items-center justify-end gap-2 last:rounded-b",rel:"noopener",children:[De&&u.jsx("span",{className:"text-muted-foreground text-xs font-bold",children:"reusable"}),u.jsx(Ae,{content:u.jsx("span",{className:"max-w-16 text-xs",children:De?"This function or class can be imported into other Python notebooks or modules.":u.jsxs(u.Fragment,{children:["This definition can't be reused in other Python modules:",u.jsx("br",{}),u.jsx("br",{}),u.jsx("pre",{children:m}),u.jsx("br",{}),"Click this icon to learn more."]})}),children:De&&u.jsx(Yl,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})||u.jsx(Rp,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})})]}),u.jsx(Jp,{consoleOutputs:s,stale:ie,cellName:m?"_":R,onRefactorWithAI:Se,onClear:()=>{v.clearCellConsoleOutput({cellId:n})},onSubmitDebugger:(J,ge)=>{v.setStdinResponse({cellId:n,response:J,outputIndex:ge}),V4({text:J})},cellId:n,debuggerActive:b})]}),N&&u.jsx(hx,{onClick:()=>v.expandCell({cellId:n}),count:I,cellId:n})]})})})},vx=t=>{const e=X.c(19),{className:n,disabled:o,edited:r,interrupted:s,isCellStatusInline:i,lastRunStartTimestamp:a,runElapsedTimeMs:l,runStartTimestamp:c,staleInputs:d,status:h,uninstantiated:f}=t,p=o!==void 0&&o;let _;e[0]!==p||e[1]!==r||e[2]!==s||e[3]!==a||e[4]!==l||e[5]!==c||e[6]!==d||e[7]!==h||e[8]!==f?(_=u.jsx(R_,{status:h,staleInputs:d,interrupted:s,editing:!0,edited:r,disabled:p,elapsedTime:l,runStartTimestamp:c,uninstantiated:f,lastRunStartTimestamp:a}),e[0]=p,e[1]=r,e[2]=s,e[3]=a,e[4]=l,e[5]=c,e[6]=d,e[7]=h,e[8]=f,e[9]=_):_=e[9];const g=_;let m;e[10]!==n?(m=je("shoulder-right z-20",n),e[10]=n,e[11]=m):m=e[11];const b=!i&&g;let y;e[12]===Symbol.for("react.memo_cache_sentinel")?(y=u.jsx(mx,{}),e[12]=y):y=e[12];const x=i&&g;let v,C;return e[13]!==x?(v=u.jsxs("div",{className:"flex gap-2 items-end",children:[y,x]}),e[13]=x,e[14]=v):v=e[14],e[15]!==m||e[16]!==b||e[17]!==v?(C=u.jsxs("div",{className:m,children:[b,v]}),e[15]=m,e[16]=b,e[17]=v,e[18]=C):C=e[18],C},aM=t=>{const e=X.c(21),{className:n,connectionState:o,actions:r,cellId:s}=t;let i;e[0]!==r||e[1]!==s?(i=v=>{const C=v===void 0?{}:v;return r.createNewCell({cellId:s,before:!1,...C})},e[0]=r,e[1]=s,e[2]=i):i=e[2];const a=Xe(i);let l;e[3]!==r||e[4]!==s?(l=v=>{const C=v===void 0?{}:v;return r.createNewCell({cellId:s,before:!0,...C})},e[3]=r,e[4]=s,e[5]=l):l=e[5];const c=Xe(l),d=zc(o);let h,f;e[6]!==n?(h=je("absolute flex flex-col gap-[2px] justify-center h-full left-[-34px] z-20",n),e[6]=n,e[7]=h):h=e[7],e[8]===Symbol.for("react.memo_cache_sentinel")?(f=nn("cell.createAbove"),e[8]=f):f=e[8];const p=d?c:void 0;let _,g,m;e[9]!==o||e[10]!==p?(_=u.jsx(u0,{tooltipContent:f,connectionState:o,onClick:p}),e[9]=o,e[10]=p,e[11]=_):_=e[11],e[12]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("div",{className:"flex-1"}),e[12]=g):g=e[12],e[13]===Symbol.for("react.memo_cache_sentinel")?(m=nn("cell.createBelow"),e[13]=m):m=e[13];const b=d?a:void 0;let y,x;return e[14]!==o||e[15]!==b?(y=u.jsx(u0,{tooltipContent:m,connectionState:o,onClick:b}),e[14]=o,e[15]=b,e[16]=y):y=e[16],e[17]!==h||e[18]!==_||e[19]!==y?(x=u.jsxs("div",{className:h,children:[_,g,y]}),e[17]=h,e[18]=_,e[19]=y,e[20]=x):x=e[20],x},kx=t=>{const e=X.c(27),{edited:n,connectionState:o,status:r,cellConfig:s,needsRun:i,hasOutput:a,hasConsoleOutput:l,onRun:c,cellActionDropdownRef:d,cellId:h,getEditorView:f,name:p,includeCellActions:_}=t,g=_===void 0||_,m=zc(o),b=!i&&"hover-action";let y;e[0]!==b?(y=je(b),e[0]=b,e[1]=y):y=e[1];const x=m?c:wn.NOOP;let v,C,k,E;return e[2]!==s||e[3]!==o||e[4]!==n||e[5]!==i||e[6]!==r||e[7]!==x?(v=u.jsx(sM,{edited:n,onClick:x,connectionState:o,status:r,config:s,needsRun:i}),e[2]=s,e[3]=o,e[4]=n,e[5]=i,e[6]=r,e[7]=x,e[8]=v):v=e[8],e[9]!==o||e[10]!==r?(C=u.jsx(Uj,{status:r,connectionState:o}),e[9]=o,e[10]=r,e[11]=C):C=e[11],e[12]!==d||e[13]!==s||e[14]!==h||e[15]!==f||e[16]!==l||e[17]!==a||e[18]!==g||e[19]!==p||e[20]!==r?(k=g&&u.jsx(h0,{ref:d,cellId:h,status:r,getEditorView:f,name:p,config:s,hasOutput:a,hasConsoleOutput:l,children:u.jsx(Qs,{variant:"green",tooltip:null,"data-testid":"cell-actions-button",children:u.jsx(RS,{strokeWidth:1.5})})}),e[12]=d,e[13]=s,e[14]=h,e[15]=f,e[16]=l,e[17]=a,e[18]=g,e[19]=p,e[20]=r,e[21]=k):k=e[21],e[22]!==y||e[23]!==v||e[24]!==C||e[25]!==k?(E=u.jsxs(Bj,{className:y,children:[v,C,k]}),e[22]=y,e[23]=v,e[24]=C,e[25]=k,e[26]=E):E=e[26],E},lM=({theme:t,showPlaceholder:e,id:n,code:o,output:r,consoleOutputs:s,status:i,runStartTimestamp:a,lastRunStartTimestamp:l,runElapsedTimeMs:c,edited:d,interrupted:h,errored:f,stopped:p,staleInputs:_,serializedEditorState:g,debuggerActive:m,connectionState:b,canDelete:y,actions:x,deleteCell:v,userConfig:C,config:k,canMoveX:E,name:N,editorView:I,setEditorView:A})=>{const M=T.useRef(null),R=T.useRef(null),z=T.useRef(null),D=Kt(ka),F=nd(n),B=k.disabled||i==="disabled-transitively",U=U4({executionTime:c,status:i,errored:f,interrupted:h,stopped:p}),O=d||h||_&&!B,S=i==="running"||i==="queued",$=(i==="queued"||d||_)&&!h,j=T.useCallback(()=>I.current,[I]),{closeCompletionHandler:W,resumeCompletionHandler:Y}=bx(M,I);yx(M,n,F,x,E,k,I,D,R),xx(M,n,x,wn.NOOP,C,!0);const G=!z4(r),q=s.length>0,te=B4(r==null?void 0:r.mimetype),re=Ac("marimo-cell","hover-actions-parent z-10 border shadow-sm","!border-[var(--blue-5)] !rounded-sm",{"needs-run":O,"has-error":f,stopped:p}),ie=Cs.create(n),Z=Xe(ee=>{D({cellId:n,initialPrompt:ee.prompt})});return u.jsx(Dp,{children:u.jsx(p0,{cellId:n,config:k,status:i,getEditorView:j,hasOutput:G,hasConsoleOutput:q,name:N,children:u.jsxs("div",{className:re,"data-status":i,id:ie,ref:M,onBlur:W,onKeyDown:Y,title:k.disabled?"This cell is disabled":i==="disabled-transitively"?"This cell has a disabled ancestor":void 0,"data-cell-id":n,"data-cell-name":N,"data-setup-cell":!0,children:[u.jsxs("div",{className:je("tray"),"data-hidden":!1,children:[u.jsx("div",{className:"absolute right-2 -top-4 z-10",children:u.jsx(kx,{edited:d,connectionState:b,status:i,cellConfig:k,needsRun:O,hasOutput:G,hasConsoleOutput:q,cellActionDropdownRef:R,cellId:n,name:N,getEditorView:j,onRun:F,includeCellActions:!1})}),u.jsx(Bu,{theme:t,showPlaceholder:e,id:n,code:o,config:k,status:i,serializedEditorState:g,runCell:F,setEditorView:A,userConfig:C,editorViewRef:I,editorViewParentRef:z,hidden:!1,hasOutput:G,temporarilyShowCode:wn.NOOP,languageAdapter:"python",setLanguageAdapter:wn.NOOP,showLanguageToggles:!1}),u.jsx(vx,{edited:d,status:i,isCellStatusInline:!1,uninstantiated:U,disabled:k.disabled,runElapsedTimeMs:c,runStartTimestamp:a,lastRunStartTimestamp:l,staleInputs:_,interrupted:h}),u.jsx("div",{className:"shoulder-bottom hover-action",children:y&&u.jsx(fx,{connectionState:b,status:i,onClick:()=>{S||uo(b)||v({cellId:n})}})})]}),u.jsxs("div",{className:"py-1 px-2 flex justify-end gap-2 last:rounded-b",children:[u.jsx("span",{className:"text-muted-foreground text-xs font-bold",children:"setup cell"}),u.jsx(Ae,{content:u.jsxs("span",{className:"max-w-16",children:["This ",u.jsx("b",{children:"setup cell"})," is guaranteed to run before all other cells. Include ",u.jsx("br",{}),"initialization or imports and constants required by top-level functions."]}),children:u.jsx(Rp,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})})]}),te&&u.jsx(Tc,{allowExpand:!0,forceExpand:!0,output:r,className:"output-area",cellId:n,stale:!1,loading:S}),u.jsx(Jp,{consoleOutputs:s,stale:$,cellName:"_",onRefactorWithAI:Z,onClear:()=>{x.clearCellConsoleOutput({cellId:n})},onSubmitDebugger:(ee,ue)=>{x.setStdinResponse({cellId:n,response:ee,outputIndex:ue}),V4({text:ee})},cellId:n,debuggerActive:m})]})})})},Sx=T.memo(T.forwardRef((t,e)=>{const{status:n,output:o,runStartTimestamp:r,interrupted:s,staleInputs:i,edited:a,id:l,mode:c}=t;It.debug("Rendering Cell",l);const d=T.useRef(null);T.useImperativeHandle(e,()=>({get editorView(){return M_(d)},get editorViewOrNull(){return d.current}}),[d]);const h=cV({status:n,output:o,runStartTimestamp:r,interrupted:s,staleInputs:i},a),f=F4(n);return l===Fo?u.jsx(lM,{...t,editorView:d,setEditorView:p=>{d.current=p},outputStale:h}):c==="edit"?u.jsx(iM,{...t,editorView:d,setEditorView:p=>{d.current=p},outputStale:h}):u.jsx(wx,{...t,outputStale:h,outputLoading:f})})),cM=(t,e)=>function(n,o){const r=/^(\d+)\.(\d+)\.(\d+)(?:-([\w.-]+))?(?:\+([\w.-]+))?$/,s=i=>{const a=i.match(r);if(!a)return null;const[,l,c,d,h]=a;return{major:Number.parseInt(l,10),minor:Number.parseInt(c,10),patch:Number.parseInt(d,10),preRelease:h||""}};try{const i=s(n),a=s(o);return i&&a?i.major!==a.major?i.major-a.major:i.minor!==a.minor?i.minor-a.minor:i.patch!==a.patch?i.patch-a.patch:i.preRelease===""&&a.preRelease!==""?1:i.preRelease!==""&&a.preRelease===""?-1:i.preRelease.localeCompare(a.preRelease):n.localeCompare(o,void 0,{numeric:!0,sensitivity:"base"})}catch{return n.localeCompare(o,void 0,{numeric:!0,sensitivity:"base"})}}(e,t),Cx=new class{constructor(t){this.ttl=void 0,this.cache=new Map,this.ttl=t.ttl}cleanupExpiredEntries(){const t=Date.now();for(const[e,n]of this.cache.entries())t-n.timestamp>this.ttl&&this.cache.delete(e)}get(t){this.cleanupExpiredEntries();const e=this.cache.get(t);if(e){if(!(Date.now()-e.timestamp>this.ttl))return e.data;this.cache.delete(t)}}set(t,e){this.cache.set(t,{data:e,timestamp:Date.now()})}clear(){this.cache.clear()}}({ttl:3e5}),dM=$4({info:$4({provides_extra:H4().array().nullable()}),releases:fV(H4(),pV())});function Nx(t){const e=X.c(5);let n;e[0]!==t?(n=function(i){return i.replaceAll(/\[.*]/g,"").trim()}(t),e[0]=t,e[1]=n):n=e[1];const o=n;let r,s;return e[2]!==o?(r=async()=>{const i=Cx.get(o);if(i)return i;const a=await fetch(`https://pypi.org/pypi/${o}/json`,{method:"GET"});if(!a.ok)throw new Error(`HTTP ${a.status}: ${a.statusText}`);const l=dM.transform(uM).parse(await a.json());return Cx.set(o,l),l},s=[o],e[2]=o,e[3]=r,e[4]=s):(r=e[3],s=e[4]),zn(r,s)}function uM(t){return{versions:Object.keys(t.releases).toSorted(cM),extras:t.info.provides_extra??[]}}function jx(t){const e=t.match(/^([^[]+)(?:\[([^\]]+)])?$/);if(!e)return{name:t,extras:[]};const[,n,o]=e;return{name:n,extras:o?o.split(",").map(r=>r.trim()):[]}}const hM=()=>{const t=X.c(70),{packageAlert:e}=NH(),{clearPackageAlert:n}=jH(),[o]=Tr();let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={},t[0]=r):r=t[0];const[s,i]=T.useState(r);let a;t[1]===Symbol.for("react.memo_cache_sentinel")?(a={},t[1]=a):a=t[1];const[l,c]=T.useState(a);if(e===null)return null;const d=o.package_management.manager!=="pixi";if(EH(e)){let h,f,p,_,g,m,b,y,x,v;if(t[2]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[u.jsx(Kc,{className:"w-5 h-5 inline-block mr-2"}),"Missing packages"]}),t[2]=h):h=t[2],t[3]!==n||t[4]!==e.id?(f=()=>n(e.id),t[3]=n,t[4]=e.id,t[5]=f):f=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx(Jn,{className:"w-5 h-5"}),t[6]=p):p=t[6],t[7]!==f?(_=u.jsxs("div",{className:"flex justify-between",children:[h,u.jsx(Te,{variant:"text","data-testid":"remove-banner-button",size:"icon",onClick:f,children:p})]}),t[7]=f,t[8]=_):_=t[8],t[9]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("p",{children:"The following packages were not found:"}),t[9]=g):g=t[9],t[10]!==s||t[11]!==d||t[12]!==e.packages||t[13]!==l){let C;t[15]!==s||t[16]!==d||t[17]!==l?(C=(k,E)=>{const N=jx(k),I=l[k]||N.extras;return u.jsxs("li",{className:"flex items-center gap-2 font-mono text-sm",children:[u.jsx($s,{size:"1rem"}),u.jsx(gM,{packageName:N.name,selectedExtras:I,onExtrasChange:A=>c(M=>({...M,[k]:A}))}),d&&u.jsx(_M,{value:s[k]??"latest",onChange:A=>i(M=>({...M,[k]:A})),packageName:N.name})]},E)},t[15]=s,t[16]=d,t[17]=l,t[18]=C):C=t[18],m=e.packages.map(C),t[10]=s,t[11]=d,t[12]=e.packages,t[13]=l,t[14]=m}else m=t[14];return t[19]!==m?(b=u.jsxs("div",{children:[g,u.jsx("ul",{className:"list-disc ml-4 mt-1",children:m})]}),t[19]=m,t[20]=b):b=t[20],t[21]!==n||t[22]!==s||t[23]!==e.id||t[24]!==e.isolated||t[25]!==e.packages||t[26]!==l||t[27]!==o.package_management.manager?(y=u.jsx("div",{className:"ml-auto flex flex-row items-baseline",children:e.isolated?u.jsxs(u.Fragment,{children:[u.jsx(pM,{manager:o.package_management.manager,packages:e.packages.map(C=>{const k=jx(C),E=l[C]||k.extras;return function(N,I){return I.length===0?N:`${N}[${I.join(",")}]`}(k.name,E)}),versions:s,clearPackageAlert:()=>n(e.id)}),!xn()&&u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"px-2 text-sm",children:"with"})," ",u.jsx(mM,{})]})]}):u.jsxs("p",{children:["If you set up a"," ",u.jsx(lp,{href:"https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments",children:"virtual environment"}),", marimo can install these packages for you."]})}),t[21]=n,t[22]=s,t[23]=e.id,t[24]=e.isolated,t[25]=e.packages,t[26]=l,t[27]=o.package_management.manager,t[28]=y):y=t[28],t[29]!==b||t[30]!==y?(x=u.jsxs("div",{className:"flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",children:[b,y]}),t[29]=b,t[30]=y,t[31]=x):x=t[31],t[32]!==x||t[33]!==_?(v=u.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-12 min-w-[400px] z-[200] opacity-95",children:u.jsxs(Mc,{kind:"danger",className:"flex flex-col rounded py-3 px-5 animate-in slide-in-from-left",children:[_,x]})}),t[32]=x,t[33]=_,t[34]=v):v=t[34],v}if(IH(e)){let h;t[35]!==e.packages?(h=function(D){const F=new Set(Object.values(D)),B=F.has("queued")||F.has("installing")?"installing":F.has("failed")?"failed":"installed";return B==="installing"?{status:"installing",title:"Installing packages",titleIcon:u.jsx(ma,{className:"w-5 h-5 inline-block mr-2"}),description:"Installing packages:"}:B==="installed"?{status:"installed",title:"All packages installed!",titleIcon:u.jsx(Nm,{className:"w-5 h-5 inline-block mr-2"}),description:"Installed packages:"}:{status:"failed",title:"Some packages failed to install",titleIcon:u.jsx(Kc,{className:"w-5 h-5 inline-block mr-2"}),description:"See terminal for error logs."}}(e.packages),t[35]=e.packages,t[36]=h):h=t[36];const{status:f,title:p,titleIcon:_,description:g}=h;f==="installed"&&setTimeout(()=>n(e.id),1e4);const m=f==="failed"?"danger":"info";let b,y,x,v,C;t[37]!==p||t[38]!==_?(b=u.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[_,p]}),t[37]=p,t[38]=_,t[39]=b):b=t[39],t[40]!==n||t[41]!==e.id?(y=()=>n(e.id),t[40]=n,t[41]=e.id,t[42]=y):y=t[42],t[43]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx(Jn,{className:"w-5 h-5"}),t[43]=x):x=t[43],t[44]!==y?(v=u.jsx(Te,{variant:"text","data-testid":"remove-banner-button",size:"icon",onClick:y,children:x}),t[44]=y,t[45]=v):v=t[45],t[46]!==b||t[47]!==v?(C=u.jsxs("div",{className:"flex justify-between",children:[b,v]}),t[46]=b,t[47]=v,t[48]=C):C=t[48];const k=f==="installed"&&"text-accent-foreground";let E,N,I,A,M,R,z;if(t[49]!==k?(E=je("flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",k),t[49]=k,t[50]=E):E=t[50],t[51]!==g?(N=u.jsx("p",{children:g}),t[51]=g,t[52]=N):N=t[52],t[53]!==e.packages||t[54]!==f){let D;t[56]!==f?(D=(F,B)=>{const[U,O]=F;return u.jsxs("li",{className:je("flex items-center gap-1 font-mono text-sm",O==="installing"&&"font-semibold",O==="failed"&&"text-destructive",O==="installed"&&"text-accent-foreground",O==="installed"&&f==="failed"&&"text-muted-foreground"),children:[u.jsx(fM,{status:O}),U]},B)},t[56]=f,t[57]=D):D=t[57],I=Object.entries(e.packages).map(D),t[53]=e.packages,t[54]=f,t[55]=I}else I=t[55];return t[58]!==I?(A=u.jsx("ul",{className:"list-disc ml-4 mt-1",children:I}),t[58]=I,t[59]=A):A=t[59],t[60]!==N||t[61]!==A?(M=u.jsxs("div",{children:[N,A]}),t[60]=N,t[61]=A,t[62]=M):M=t[62],t[63]!==E||t[64]!==M?(R=u.jsx("div",{className:E,children:M}),t[63]=E,t[64]=M,t[65]=R):R=t[65],t[66]!==R||t[67]!==m||t[68]!==C?(z=u.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-12 min-w-[400px] z-[200] opacity-95",children:u.jsxs(Mc,{kind:m,className:"flex flex-col rounded pt-3 pb-4 px-5",children:[C,R]})}),t[66]=R,t[67]=m,t[68]=C,t[69]=z):z=t[69],z}return ic(e),null},fM=t=>{const e=X.c(4),{status:n}=t;switch(n){case"queued":{let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx($s,{size:"1rem"}),e[0]=o):o=e[0],o}case"installing":{let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(ma,{size:"1rem"}),e[1]=o):o=e[1],o}case"installed":{let o;return e[2]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(dc,{size:"1rem"}),e[2]=o):o=e[2],o}case"failed":{let o;return e[3]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(Jn,{size:"1rem"}),e[3]=o):o=e[3],o}default:return ic(n),null}},pM=t=>{const e=X.c(9),{manager:n,packages:o,versions:r,clearPackageAlert:s}=t;let i,a,l,c;return e[0]!==s||e[1]!==n||e[2]!==o||e[3]!==r?(i=async()=>{s();const d={...r};for(const h of o)d[h]=d[h]??"";await bV({manager:n,versions:d}).catch(bM)},e[0]=s,e[1]=n,e[2]=o,e[3]=r,e[4]=i):i=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx(ma,{className:"w-4 h-4 mr-2"}),l=u.jsx("span",{className:"font-semibold",children:"Install"}),e[5]=a,e[6]=l):(a=e[5],l=e[6]),e[7]!==i?(c=u.jsxs(Te,{variant:"outline","data-testid":"install-packages-button",size:"sm",onClick:i,children:[a,l]}),e[7]=i,e[8]=c):c=e[8],c},mM=()=>{const t=X.c(16),[e,n]=Tr();let o,r;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=K3(mV),t[0]=o):o=t[0],t[1]!==e?(r={resolver:o,defaultValues:e},t[1]=e,t[2]=r):r=t[2];const s=X3(r);let i;t[3]!==n?(i=async f=>{await Mr({config:f}).then(()=>{n(f)})},t[3]=n,t[4]=i):i=t[4];const a=i;let l,c,d,h;return t[5]!==s||t[6]!==a?(l=s.handleSubmit(a),t[5]=s,t[6]=a,t[7]=l):l=t[7],t[8]!==s.control?(c=u.jsx("div",{className:"flex flex-col gap-3",children:u.jsx(q3,{control:s.control,name:"package_management.manager",render:xM})}),t[8]=s.control,t[9]=c):c=t[9],t[10]!==l||t[11]!==c?(d=u.jsx("form",{onChange:l,className:"flex flex-col gap-5",children:c}),t[10]=l,t[11]=c,t[12]=d):d=t[12],t[13]!==s||t[14]!==d?(h=u.jsx(gV,{...s,children:d}),t[13]=s,t[14]=d,t[15]=h):h=t[15],h},gM=t=>{const e=X.c(14),{packageName:n,selectedExtras:o,onExtrasChange:r}=t,[s,i]=T.useState(!1),{isPending:a,error:l,data:c}=Nx(n);let d;e[0]!==r||e[1]!==o?(d=(g,m)=>{r(m?[...o,g]:o.filter(b=>b!==g))},e[0]=r,e[1]=o,e[2]=d):d=e[2];const h=d,f=!a&&!l;let p,_;if(e[3]!==(c==null?void 0:c.extras)?(p=(c==null?void 0:c.extras)??[],e[3]=c==null?void 0:c.extras,e[4]=p):p=e[4],e[5]!==f||e[6]!==h||e[7]!==s||e[8]!==n||e[9]!==o||e[10]!==p){const g=p.filter(wM);let m;e[12]!==n?(m=u.jsx("span",{className:"shrink-0",children:n}),e[12]=n,e[13]=m):m=e[13],_=u.jsxs("div",{className:"flex items-center max-w-72",children:[m,o.length>0?u.jsxs("span",{className:"flex items-center min-w-0 flex-1",children:[u.jsx("span",{className:"shrink-0",children:"["}),u.jsxs(Es,{open:s&&f,onOpenChange:b=>{f&&i(b)},children:[u.jsx(Is,{asChild:!0,children:u.jsx("button",{className:"hover:bg-muted/50 rounded text-sm px-1 transition-colors border border-muted-foreground/30 hover:border-muted-foreground/60 min-w-0 flex-1 truncate text-left",title:`Selected extras: ${o.join(", ")}`,children:o.join(",")})}),u.jsxs(As,{align:"start",className:"w-64 p-0 max-h-96 flex flex-col",children:[o.length>0&&u.jsx("div",{className:"p-2 bg-popover border-b border-border",children:u.jsx("div",{className:"flex flex-wrap gap-1 p-1 min-h-[24px]",children:o.map(b=>u.jsxs("span",{className:"inline-flex items-center gap-1 px-1 py-0.5 text-sm font-mono border border-muted-foreground/30 hover:border-muted-foreground/60 rounded-sm cursor-pointer group transition-colors",onClick:()=>h(b,!1),children:[b,u.jsx(Jn,{className:"w-3 h-3 opacity-60 group-hover:opacity-100"})]},b))})}),u.jsx("div",{className:"overflow-y-auto flex-1",children:g.map(b=>u.jsx(W4,{checked:o.includes(b),onCheckedChange:y=>{h(b,y)},className:"font-mono text-sm",onSelect:vM,children:b},b))})]})]}),u.jsx("span",{className:"shrink-0",children:"]"})]}):g.length>0?u.jsxs(Es,{open:s&&f,onOpenChange:b=>{f&&i(b)},children:[u.jsx(Is,{asChild:!0,children:u.jsx("button",{disabled:!f,className:je("hover:bg-muted/50 rounded text-sm ml-2 transition-colors border border-muted-foreground/30 hover:border-muted-foreground/60 h-5 w-5 flex items-center justify-center p-0",!f&&"opacity-50 cursor-not-allowed"),title:f?"Add extras":"Loading extras...",children:u.jsx(ar,{className:"w-3 h-3 flex-shrink-0"})})}),u.jsxs(As,{align:"start",className:"w-64 p-0 max-h-96 flex flex-col",children:[u.jsx("div",{className:"p-2 bg-popover border-b border-border",children:u.jsx("span",{className:"text-muted-foreground italic text-sm",children:"Package extras"})}),u.jsx("div",{className:"overflow-y-auto flex-1",children:g.map(b=>u.jsx(W4,{checked:o.includes(b),onCheckedChange:y=>{h(b,y)},className:"font-mono text-sm",onSelect:kM,children:b},b))})]})]}):null]}),e[5]=f,e[6]=h,e[7]=s,e[8]=n,e[9]=o,e[10]=p,e[11]=_}else _=e[11];return _},_M=t=>{const e=X.c(16),{value:n,onChange:o,packageName:r}=t,{error:s,isPending:i,data:a}=Nx(r);if(s){let h,f,p;return e[0]!==o?(h=_=>o(_.target.value),e[0]=o,e[1]=h):h=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsx("option",{value:"latest",children:"latest"}),e[2]=f):f=e[2],e[3]!==h||e[4]!==n?(p=u.jsx(Ae,{content:"Failed to fetch package versions",children:u.jsx(Pp,{value:n,onChange:h,disabled:!0,className:"inline-flex ml-2 w-24 text-ellipsis",children:f})}),e[3]=h,e[4]=n,e[5]=p):p=e[5],p}let l,c,d;return e[6]!==o?(l=h=>o(h.target.value),e[6]=o,e[7]=l):l=e[7],e[8]!==i||e[9]!==a?(c=i?u.jsx("option",{value:"latest",children:"latest"}):["latest",...a.versions.slice(0,100)].map(SM),e[8]=i,e[9]=a,e[10]=c):c=e[10],e[11]!==i||e[12]!==l||e[13]!==c||e[14]!==n?(d=u.jsx(Pp,{value:n,onChange:l,disabled:i,className:"inline-flex ml-2 w-24 text-ellipsis",children:c}),e[11]=i,e[12]=l,e[13]=c,e[14]=n,e[15]=d):d=e[15],d};function bM(t){It.error(t)}function yM(t){return u.jsx("option",{value:t,children:t},t)}function xM(t){const{field:e}=t;return u.jsxs(G3,{children:[u.jsx(Y3,{children:u.jsx(Pp,{"data-testid":"install-package-manager-select",onChange:n=>e.onChange(n.target.value),value:e.value,disabled:e.disabled,className:"inline-flex mr-2",children:_V.map(yM)})}),u.jsx(J3,{})]})}function wM(t){return!/^(dev|test|testing)$/i.test(t)}function vM(t){return t.preventDefault()}function kM(t){return t.preventDefault()}function SM(t){return u.jsx("option",{value:t,children:t},t)}const CM=t=>{let{transform:e}=t;return{...e,x:0}},NM={threshold:{x:0,y:.1}},jM=K.memo(t=>{const e=X.c(23),{children:n,multiColumn:o}=t,{dropCellOverCell:r,dropCellOverColumn:s,moveColumn:i,compactColumns:a}=kt(),[l,c]=T.useState(null),[d,h]=T.useState(null),[f]=V3();let p;e:{if(f.width==="columns"){p=Lp.EMPTY;break e}let D;e[0]===Symbol.for("react.memo_cache_sentinel")?(D=[CM],e[0]=D):D=e[0],p=D}const _=p;let g,m;e[1]===Symbol.for("react.memo_cache_sentinel")?(g={activationConstraint:{distance:8}},e[1]=g):g=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(m={coordinateGetter:Fj},e[2]=m):m=e[2];const b=function(){for(var D=arguments.length,F=new Array(D),B=0;B<D;B++)F[B]=arguments[B];return T.useMemo(()=>[...F].filter(U=>U!=null),[...F])}(Lg(Ed,g),Lg(Nd,m));let y;e[3]===Symbol.for("react.memo_cache_sentinel")?(y=D=>{c(D.active.id);const F=Ln();h(F.cellIds)},e[3]=y):y=e[3];const x=Xe(y);let v;e[4]!==d?(v=()=>{c(null),h(null)},e[4]=d,e[5]=v):v=e[5];const C=Xe(v);let k;e[6]!==l?(k=D=>{const F=D.droppableContainers.filter(EM);if(l&&os(l))return wd({...D,droppableContainers:F});const B=(j=>{let{droppableContainers:W,droppableRects:Y,pointerCoordinates:G}=j;if(!G)return[];const q=[];for(const te of W){const{id:re}=te,ie=Y.get(re);if(ie&&nj(G,ie)){const Z=yd(ie).reduce((ue,me)=>ue+_d(G,me),0),ee=Number((Z/4).toFixed(4));q.push({id:re,data:{droppableContainer:te,value:ee}})}}return q.sort(bd)})({...D,droppableContainers:F}),U=xd(B.length>0?B:zg({...D,droppableContainers:F}),"id");if(!U)return[];Do(os(U),`Expected column id. Got: ${U}`);const O=Ln().cellIds.get(U);if(Do(O,`Expected column. Got: ${U}`),O&&O.topLevelIds.length===0)return[{id:U}];const S=new Set(O.topLevelIds),$=wd({...D,droppableContainers:D.droppableContainers.filter(j=>j.id!==U&&S.has(j.id))});if($.length>0){const j=$[0].id;return Do(Uu(j),`Expected cell id. Got: ${j}`),[{id:j}]}return[]},e[6]=l,e[7]=k):k=e[7];const E=k;let N;e[8]!==r||e[9]!==s||e[10]!==i?(N=D=>{const{active:F,over:B}=D,U=B==null?void 0:B.id;if(U!=null&&F.id!==U){if(Uu(F.id)){if(os(U))return void s({cellId:F.id,columnId:U});if(Uu(U))return void r({cellId:F.id,overCellId:U})}os(F.id)&&os(U)&&i({column:F.id,overColumn:U})}},e[8]=r,e[9]=s,e[10]=i,e[11]=N):N=e[11];const I=Xe(N);let A;e[12]!==a?(A=D=>{const{active:F,over:B}=D;B!==null&&F.id!==B.id&&a()},e[12]=a,e[13]=A):A=e[13];const M=Xe(A),R=o?E:wd;let z;return e[14]!==n||e[15]!==C||e[16]!==M||e[17]!==I||e[18]!==x||e[19]!==_||e[20]!==b||e[21]!==R?(z=u.jsx(Cj,{autoScroll:NM,sensors:b,collisionDetection:R,modifiers:_,onDragEnd:M,onDragStart:x,onDragCancel:C,onDragOver:I,children:n}),e[14]=n,e[15]=C,e[16]=M,e[17]=I,e[18]=x,e[19]=_,e[20]=b,e[21]=R,e[22]=z):z=e[22],z});function Uu(t){return typeof t=="string"&&!t.startsWith("tree_")}function os(t){return typeof t=="string"&&t.startsWith("tree_")}function EM(t){return os(t.id)}const IM=t=>{const e=X.c(13),{className:n,size:o,gap:r,durationMs:s}=t,i=o===void 0?8:o,a=r===void 0?"gap-1":r,l=s===void 0?1200:s,c=`${l}ms`;let d;e[0]!==c?(d={animationDuration:c},e[0]=c,e[1]=d):d=e[1];const h=d;let f,p,_,g;return e[2]!==n||e[3]!==a?(f=Ac("flex",a,n),e[2]=n,e[3]=a,e[4]=f):f=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(p=[0,1,2],e[5]=p):p=e[5],e[6]!==h||e[7]!==l||e[8]!==i?(_=p.map(m=>u.jsx(yV,{width:i,height:i,className:"fill-current text-current animate-ellipsis-dot",style:{...h,animationDelay:l/3*m+"ms"}},m)),e[6]=h,e[7]=l,e[8]=i,e[9]=_):_=e[9],e[10]!==f||e[11]!==_?(g=u.jsx("div",{className:f,"aria-label":"Loading",children:_}),e[10]=f,e[11]=_,e[12]=g):g=e[12],g},AM=()=>{const t=X.c(2),e=Be(xV);let n;return t[0]!==e?(n=e&&u.jsx(Op,{milliseconds:1e3,children:u.jsx("div",{className:"absolute top-4 m-0 flex items-center min-h-[28px] left-1/2 transform -translate-x-1/2 z-[200] ",children:u.jsx(Ae,{content:"Connecting to a marimo runtime",children:u.jsx("div",{className:"flex items-center",children:u.jsx(IM,{size:5,className:"text-yellow-500"})})})})}),t[0]=e,t[1]=n):n=t[1],n},Ex=K.forwardRef((t,e)=>{const n=X.c(62);let o,r,s,i,a,l;n[0]!==t?({columnId:i,canDelete:o,canMoveLeft:r,canMoveRight:s,...a}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i,n[5]=a):(o=n[1],r=n[2],s=n[3],i=n[4],a=n[5]),n[6]!==i?(l={id:i},n[6]=i,n[7]=l):l=n[7];const{attributes:c,listeners:d,setNodeRef:h,transform:f,transition:p,isDragging:_,isOver:g}=p1(l);let m;n[8]!==f?(m=f?yc.Transform.toString({x:f.x,y:0,scaleX:1,scaleY:1}):void 0,n[8]=f,n[9]=m):m=n[9];const b=_?2:void 0;let y;n[10]!==m||n[11]!==b||n[12]!==p?(y={transform:m,transition:p,zIndex:b,position:"relative","--gutter-width":"50px"},n[10]=m,n[11]=b,n[12]=p,n[13]=y):y=n[13];const x=y,{deleteColumn:v,moveColumn:C,addColumn:k}=kt();let E;n[14]===Symbol.for("react.memo_cache_sentinel")?(E=je("h-full hover:bg-muted rounded-none"),n[14]=E):E=n[14];const N=E,I=MM;let A;n[15]!==i||n[16]!==C?(A=()=>C({column:i,overColumn:"_left_"}),n[15]=i,n[16]=C,n[17]=A):A=n[17];const M=!r;let R,z,D;n[18]===Symbol.for("react.memo_cache_sentinel")?(R=u.jsx(U3,{className:"size-4"}),n[18]=R):R=n[18],n[19]!==A||n[20]!==M?(z=u.jsx(Ae,{content:"Move column left",side:"top",delayDuration:300,children:u.jsx(Te,{variant:"text",size:"sm",className:N,onClick:A,disabled:M,children:R})}),n[19]=A,n[20]=M,n[21]=z):z=n[21],n[22]!==i||n[23]!==C?(D=()=>C({column:i,overColumn:"_right_"}),n[22]=i,n[23]=C,n[24]=D):D=n[24];const F=!s;let B,U,O,S,$,j,W,Y;n[25]===Symbol.for("react.memo_cache_sentinel")?(B=u.jsx(qi,{className:"size-4"}),n[25]=B):B=n[25],n[26]!==D||n[27]!==F?(U=u.jsx(Ae,{content:"Move column right",side:"top",delayDuration:300,children:u.jsx(Te,{variant:"text",size:"sm",className:N,onClick:D,disabled:F,children:B})}),n[26]=D,n[27]=F,n[28]=U):U=n[28],n[29]!==c||n[30]!==d?(O=u.jsx("div",{className:"flex gap-2 h-full flex-grow active:bg-accent cursor-grab",...c,...d,"data-testid":"column-drag-button"}),n[29]=c,n[30]=d,n[31]=O):O=n[31],n[32]!==o||n[33]!==i||n[34]!==v?(S=o&&u.jsx(Ae,{content:"Delete column",side:"top",delayDuration:300,children:u.jsx(Te,{variant:"text",size:"sm",className:"opacity-0 group-hover:opacity-70 group-hover:hover:opacity-100 text-destructive h-full hover:bg-destructive/20 rounded-none",onClick:()=>v({columnId:i}),children:u.jsx(Jn,{className:"size-4"})})}),n[32]=o,n[33]=i,n[34]=v,n[35]=S):S=n[35],n[36]!==k||n[37]!==i?($=()=>{k({columnId:i}),requestAnimationFrame(I)},n[36]=k,n[37]=i,n[38]=$):$=n[38],n[39]===Symbol.for("react.memo_cache_sentinel")?(j=u.jsx(ar,{className:"size-4"}),n[39]=j):j=n[39],n[40]!==$?(W=u.jsx(Ae,{content:"Add column",side:"top",delayDuration:300,children:u.jsx(Te,{variant:"text",size:"sm",className:N,onClick:$,children:j})}),n[40]=$,n[41]=W):W=n[41],n[42]!==U||n[43]!==O||n[44]!==S||n[45]!==W||n[46]!==z?(Y=u.jsxs("div",{className:"h-6 group flex items-center rounded-t-lg border hover:border-border border-[var(--slate-3)] overflow-hidden bg-[var(--slate-1)]",children:[z,U,O,S,W]}),n[42]=U,n[43]=O,n[44]=S,n[45]=W,n[46]=z,n[47]=Y):Y=n[47];const G=Y;let q;n[48]!==e||n[49]!==h?(q=ue=>{hl(e,h)(ue)},n[48]=e,n[49]=h,n[50]=q):q=n[50];const te=_?"":a.className,re=_?"z-20":"z-1 hover:z-10 focus-within:z-10",ie=g&&"bg-accent/20";let Z,ee;return n[51]!==te||n[52]!==re||n[53]!==ie?(Z=je(te,re,ie),n[51]=te,n[52]=re,n[53]=ie,n[54]=Z):Z=n[54],n[55]!==G||n[56]!==_||n[57]!==a||n[58]!==x||n[59]!==q||n[60]!==Z?(ee=u.jsxs("div",{tabIndex:-1,ref:q,...a,style:x,"data-is-dragging":_,className:Z,children:[G,a.children]}),n[55]=G,n[56]=_,n[57]=a,n[58]=x,n[59]=q,n[60]=Z,n[61]=ee):ee=n[61],ee});Ex.displayName="SortableColumn";const TM=T.memo(Ex);function MM(){const t=document.getElementById("App");t&&t.scrollTo({left:t.scrollLeft+1e3,behavior:"smooth"})}const{getColumnWidth:OM,saveColumnWidth:DM}=wV,Ix=T.memo(t=>{const e=X.c(14),n=T.useRef(null);let o;e[0]!==t.children||e[1]!==t.index||e[2]!==t.width?(o=t.width==="columns"?u.jsx(RM,{startingWidth:OM(t.index),onResize:i=>{DM(t.index,i)},children:t.children}):u.jsx("div",{className:"flex flex-col gap-5",children:t.children}),e[0]=t.children,e[1]=t.index,e[2]=t.width,e[3]=o):o=e[3];const r=o;if(t.width==="columns"){let i;return e[4]!==r||e[5]!==t.canDelete||e[6]!==t.canMoveLeft||e[7]!==t.canMoveRight||e[8]!==t.columnId||e[9]!==t.footer?(i=u.jsxs(TM,{tabIndex:-1,ref:n,canDelete:t.canDelete,columnId:t.columnId,canMoveLeft:t.canMoveLeft,canMoveRight:t.canMoveRight,className:"group/column",children:[r,t.footer]}),e[4]=r,e[5]=t.canDelete,e[6]=t.canMoveLeft,e[7]=t.canMoveRight,e[8]=t.columnId,e[9]=t.footer,e[10]=i):i=e[10],i}let s;return e[11]!==r||e[12]!==t.footer?(s=u.jsxs(u.Fragment,{children:[r,t.footer]}),e[11]=r,e[12]=t.footer,e[13]=s):s=e[13],s});Ix.displayName="Column";const RM=t=>{const e=X.c(15),{startingWidth:n,onResize:o,children:r}=t;let s;e[0]!==o||e[1]!==n?(s={startingWidth:n,onResize:o},e[0]=o,e[1]=n,e[2]=s):s=e[2];const{resizableDivRef:i,handleRefs:a,style:l}=vV(s),c=PM;let d,h,f,p;return e[3]!==a.left?(d=c(a.left),e[3]=a.left,e[4]=d):d=e[4],e[5]!==r||e[6]!==i||e[7]!==l?(h=u.jsx("div",{ref:i,className:"flex flex-col gap-5 box-content min-h-[100px] px-11 py-6 min-w-[500px] z-1",style:l,children:r}),e[5]=r,e[6]=i,e[7]=l,e[8]=h):h=e[8],e[9]!==a.right?(f=c(a.right),e[9]=a.right,e[10]=f):f=e[10],e[11]!==d||e[12]!==h||e[13]!==f?(p=u.jsxs("div",{className:"flex flex-row",children:[d,h,f]}),e[11]=d,e[12]=h,e[13]=f,e[14]=p):p=e[14],p};function PM(t){return u.jsx("div",{ref:t,className:`w-[3px] cursor-col-resize transition-colors duration-200 z-[100]
|
121
121
|
relative before:content-[''] before:absolute before:inset-y-0 before:-left-[3px]
|
@@ -141,4 +141,4 @@ ${A}
|
|
141
141
|
`)}),includeOtherCode:vc("")}),onFinish:A=>{e(M=>kl(M,M.activeChatId,"assistant",A.content,A.parts))},onToolCall:async({toolCall:A})=>{try{const M=await JV({toolName:A.toolName,arguments:A.args});return M.result||M.error}catch(M){return It.error("Tool call failed:",M),`Error: ${M instanceof Error?M.message:String(M)}`}},onError:A=>{It.error("An error occurred:",A)},onResponse:A=>{It.debug("Received HTTP response from server:",A)}}),k=x==="submitted"||x==="streaming",E=k&&f.length>0&&(A=>{if(A.length===0)return!1;const M=A.at(-1);if(!M||M.role!=="assistant"||!M.parts)return!1;const R=M.parts;return R.length===0?!1:R[R.length-1].type==="reasoning"})(f);T.useEffect(()=>{requestAnimationFrame(()=>{if(l.current){const A=l.current;A.scrollTop=A.scrollHeight}})},[t.activeChatId]);const N=(A,M)=>{g(R=>R.slice(0,A)),t.activeChatId&&e(R=>({...R,chats:R.chats.map(z=>z.id===t.activeChatId?{...z,messages:z.messages.slice(0,A),updatedAt:Date.now()}:z)})),m({role:"user",content:M}),t.activeChatId&&e(R=>kl(R,t.activeChatId,"user",M))},I=()=>{r.trim()&&(A=>{const M={id:KV(),title:A.length>50?`${A.slice(0,50)}...`:A,messages:[],createdAt:Date.now(),updatedAt:Date.now()};e(R=>({chats:[...R.chats,M],activeChatId:M.id})),_(""),m({role:"user",content:A})})(r.trim())};return u.jsxs("div",{className:"flex flex-col h-[calc(100%-53px)]",children:[u.jsx(Dp,{children:u.jsx(BD,{onNewChat:()=>{o(null),_(""),s("")},activeChatId:n==null?void 0:n.id,setActiveChat:o,chats:[...t.chats].sort((A,M)=>M.updatedAt-A.updatedAt)})}),u.jsxs("div",{className:"flex-1 px-3 bg-[var(--slate-1)] gap-4 py-3 flex flex-col overflow-y-auto",ref:l,children:[(!f||f.length===0)&&u.jsxs("div",{className:"flex flex-col rounded-md border bg-background",children:[u.jsx("div",{className:"px-1",children:u.jsx(Ic,{value:r,placeholder:"Ask anything, @ to include context about tables or dataframes",theme:d,onClose:()=>{var A,M;return(M=(A=i.current)==null?void 0:A.editor)==null?void 0:M.blur()},onChange:s,onSubmit:I},"new-thread-input")}),u.jsx(Nh,{input:r,onSendClick:I,isLoading:k,onStop:C})]}),f.map((A,M)=>u.jsx(uv,{message:A,index:M,theme:d,onEdit:N,setChatState:e,chatState:t,isStreamingReasoning:E,totalMessages:f.length},M)),k&&u.jsx("div",{className:"flex justify-center py-4",children:u.jsx(Mp,{className:"h-4 w-4 animate-spin"})}),y&&u.jsxs("div",{className:"flex items-center justify-center space-x-2 mb-4",children:[u.jsx(Rr,{error:y}),u.jsx(Te,{variant:"outline",size:"sm",onClick:()=>{v()},children:"Retry"})]}),u.jsx("div",{ref:c})]}),k&&u.jsx("div",{className:"w-full flex justify-center items-center z-20 border-t",children:u.jsx(Te,{variant:"linkDestructive",size:"sm",onClick:C,children:"Stop"})}),f&&f.length>0&&u.jsx(hv,{input:p,setInput:_,onSubmit:(A,M)=>{M.trim()&&(b(A),t.activeChatId&&e(R=>kl(R,t.activeChatId,"user",M)))},theme:d,inputRef:a,isLoading:k,onStop:C})]})};function $D(){}function HD(){}function WD(t){return u.jsx(Yi,{value:t,className:"text-sm",children:t},t)}function ln(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n,o=0;o<t.length;o++)(n=ln(t[o]))!==""&&(e+=(e&&" ")+n);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}const{useDebugValue:qD}=K,{useSyncExternalStoreWithSelector:GD}=QV,YD=t=>t;function fv(t,e=YD,n){const o=GD(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return qD(o),o}const pv=(t,e)=>{const n=e$(t),o=(r,s=e)=>fv(n,r,s);return Object.assign(o,n),o};function Qt(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[o,r]of t)if(!Object.is(r,e.get(o)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const o of t)if(!e.has(o))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(e,o)||!Object.is(t[o],e[o]))return!1;return!0}function so(t,e){if(t=function(s){let i;for(;i=s.sourceEvent;)s=i;return s}(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=t.clientX,o.y=t.clientY,[(o=o.matrixTransform(e.getScreenCTM().inverse())).x,o.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}}return[t.pageX,t.pageY]}const JD={passive:!1},Ai={capture:!0,passive:!1};function jh(t){t.stopImmediatePropagation()}function ds(t){t.preventDefault(),t.stopImmediatePropagation()}function mv(t){var e=t.document.documentElement,n=Kn(t).on("dragstart.drag",ds,Ai);"onselectstart"in e?n.on("selectstart.drag",ds,Ai):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function gv(t,e){var n=t.document.documentElement,o=Kn(t).on("dragstart.drag",null);e&&(o.on("click.drag",ds,Ai),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Ml=t=>()=>t;function Eh(t,{sourceEvent:e,subject:n,target:o,identifier:r,active:s,x:i,y:a,dx:l,dy:c,dispatch:d}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:d}})}function KD(t){return!t.ctrlKey&&!t.button}function XD(){return this.parentNode}function ZD(t,e){return e??{x:t.x,y:t.y}}function QD(){return navigator.maxTouchPoints||"ontouchstart"in this}Eh.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};const Ol=t=>()=>t;function eR(t,{sourceEvent:e,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function Ih(t){t.stopImmediatePropagation()}function Ti(t){t.preventDefault(),t.stopImmediatePropagation()}function tR(t){return!(t.ctrlKey&&t.type!=="wheel"||t.button)}function nR(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]:[[0,0],[t.clientWidth,t.clientHeight]]}function _v(){return this.__zoom||ur}function oR(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function rR(){return navigator.maxTouchPoints||"ontouchstart"in this}function sR(t,e,n){var o=t.invertX(e[0][0])-n[0][0],r=t.invertX(e[1][0])-n[1][0],s=t.invertY(e[0][1])-n[0][1],i=t.invertY(e[1][1])-n[1][1];return t.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i))}const Dl=T.createContext(null),iR=Dl.Provider,aR=t=>`Node type "${t}" not found. Using fallback type "default".`,lR=()=>"The React Flow parent container needs a width and a height to render the graph.",cR=()=>"Only child nodes can use a parent extent.",dR=t=>`Marker type "${t}" doesn't exist.`,uR=(t,e)=>`Couldn't create edge for ${t?"target":"source"} handle id: "${t?e.targetHandle:e.sourceHandle}", edge id: ${e.id}.`,hR=()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",fR=t=>`Edge type "${t}" not found. Using fallback type "default".`,pR=t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,bv="[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001";function pt(t,e){const n=T.useContext(Dl);if(n===null)throw new Error(bv);return fv(n,t,e)}const Vt=()=>{const t=T.useContext(Dl);if(t===null)throw new Error(bv);return T.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe,destroy:t.destroy}),[t])},mR=t=>t.userSelectionActive?"none":"all";function Rl({position:t,children:e,className:n,style:o,...r}){const s=pt(mR),i=`${t}`.split("-");return K.createElement("div",{className:ln(["react-flow__panel",n,...i]),style:{...o,pointerEvents:s},...r},e)}function gR({proOptions:t,position:e="bottom-right"}){return t!=null&&t.hideAttribution?null:K.createElement(Rl,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},K.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}var _R=T.memo(({x:t,y:e,label:n,labelStyle:o={},labelShowBg:r=!0,labelBgStyle:s={},labelBgPadding:i=[2,4],labelBgBorderRadius:a=2,children:l,className:c,...d})=>{const h=T.useRef(null),[f,p]=T.useState({x:0,y:0,width:0,height:0}),_=ln(["react-flow__edge-textwrapper",c]);return T.useEffect(()=>{if(h.current){const g=h.current.getBBox();p({x:g.x,y:g.y,width:g.width,height:g.height})}},[n]),n!==void 0&&n?K.createElement("g",{transform:`translate(${t-f.width/2} ${e-f.height/2})`,className:_,visibility:f.width?"visible":"hidden",...d},r&&K.createElement("rect",{width:f.width+2*i[0],x:-i[0],y:-i[1],height:f.height+2*i[1],className:"react-flow__edge-textbg",style:s,rx:a,ry:a}),K.createElement("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:h,style:o},n),l):null});const Ah=t=>({width:t.offsetWidth,height:t.offsetHeight}),us=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),Th=(t={x:0,y:0},e)=>({x:us(t.x,e[0][0],e[1][0]),y:us(t.y,e[0][1],e[1][1])}),yv=(t,e,n)=>t<e?us(Math.abs(t-e),1,50)/50:t>n?-us(Math.abs(t-n),1,50)/50:0,xv=(t,e)=>[20*yv(t.x,35,e.width-35),20*yv(t.y,35,e.height-35)],wv=t=>{var e;return((e=t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},Mh=({x:t,y:e,width:n,height:o})=>({x:t,y:e,x2:t+n,y2:e+o}),vv=t=>({...t.positionAbsolute||{x:0,y:0},width:t.width||0,height:t.height||0}),Oh=(t,e)=>{const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),o=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*o)},On=t=>!isNaN(t)&&isFinite(t),vt=Symbol.for("internals"),kv=["Enter"," ","Escape"];function Dh(t){var o,r;const e=(s=>"nativeEvent"in s)(t)?t.nativeEvent:t,n=((r=(o=e.composedPath)==null?void 0:o.call(e))==null?void 0:r[0])||t.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const Sv=t=>"clientX"in t,Yo=(t,e)=>{var s,i;const n=Sv(t),o=n?t.clientX:(s=t.touches)==null?void 0:s[0].clientX,r=n?t.clientY:(i=t.touches)==null?void 0:i[0].clientY;return{x:o-((e==null?void 0:e.left)??0),y:r-((e==null?void 0:e.top)??0)}},Pl=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0},Mi=({id:t,path:e,labelX:n,labelY:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:h,markerStart:f,interactionWidth:p=20})=>K.createElement(K.Fragment,null,K.createElement("path",{id:t,style:d,d:e,fill:"none",className:"react-flow__edge-path",markerEnd:h,markerStart:f}),p&&K.createElement("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:p,className:"react-flow__edge-interaction"}),r&&On(n)&&On(o)?K.createElement(_R,{x:n,y:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null);function Oi(t,e,n){return n===void 0?n:o=>{const r=e().edges.find(s=>s.id===t);r&&n(o,{...r})}}function Cv({sourceX:t,sourceY:e,targetX:n,targetY:o}){const r=Math.abs(n-t)/2,s=n<t?n+r:n-r,i=Math.abs(o-e)/2;return[s,o<e?o+i:o-i,r,i]}function Nv({sourceX:t,sourceY:e,targetX:n,targetY:o,sourceControlX:r,sourceControlY:s,targetControlX:i,targetControlY:a}){const l=.125*t+.375*r+.375*i+.125*n,c=.125*e+.375*s+.375*a+.125*o;return[l,c,Math.abs(l-t),Math.abs(c-e)]}var Cr,jv,Jo,Rh,Di,Ev,Ko,Ri,hs,Iv,ze,Ll;function Av({pos:t,x1:e,y1:n,x2:o,y2:r}){return t===ze.Left||t===ze.Right?[.5*(e+o),n]:[e,.5*(n+r)]}function Tv({sourceX:t,sourceY:e,sourcePosition:n=ze.Bottom,targetX:o,targetY:r,targetPosition:s=ze.Top}){const[i,a]=Av({pos:n,x1:t,y1:e,x2:o,y2:r}),[l,c]=Av({pos:s,x1:o,y1:r,x2:t,y2:e}),[d,h,f,p]=Nv({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:l,targetControlY:c});return[`M${t},${e} C${i},${a} ${l},${c} ${o},${r}`,d,h,f,p]}Mi.displayName="BaseEdge",(jv=Cr||(Cr={})).Strict="strict",jv.Loose="loose",(Rh=Jo||(Jo={})).Free="free",Rh.Vertical="vertical",Rh.Horizontal="horizontal",(Ev=Di||(Di={})).Partial="partial",Ev.Full="full",(Ri=Ko||(Ko={})).Bezier="default",Ri.Straight="straight",Ri.Step="step",Ri.SmoothStep="smoothstep",Ri.SimpleBezier="simplebezier",(Iv=hs||(hs={})).Arrow="arrow",Iv.ArrowClosed="arrowclosed",(Ll=ze||(ze={})).Left="left",Ll.Top="top",Ll.Right="right",Ll.Bottom="bottom";const Ph=T.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,sourcePosition:r=ze.Bottom,targetPosition:s=ze.Top,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:p,markerStart:_,interactionWidth:g})=>{const[m,b,y]=Tv({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:o,targetPosition:s});return K.createElement(Mi,{path:m,labelX:b,labelY:y,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:p,markerStart:_,interactionWidth:g})});Ph.displayName="SimpleBezierEdge";const Mv={[ze.Left]:{x:-1,y:0},[ze.Right]:{x:1,y:0},[ze.Top]:{x:0,y:-1},[ze.Bottom]:{x:0,y:1}},Ov=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function bR({source:t,sourcePosition:e=ze.Bottom,target:n,targetPosition:o=ze.Top,center:r,offset:s}){const i=Mv[e],a=Mv[o],l={x:t.x+i.x*s,y:t.y+i.y*s},c={x:n.x+a.x*s,y:n.y+a.y*s},d=(({source:k,sourcePosition:E=ze.Bottom,target:N})=>E===ze.Left||E===ze.Right?k.x<N.x?{x:1,y:0}:{x:-1,y:0}:k.y<N.y?{x:0,y:1}:{x:0,y:-1})({source:l,sourcePosition:e,target:c}),h=d.x!==0?"x":"y",f=d[h];let p,_,g=[];const m={x:0,y:0},b={x:0,y:0},[y,x,v,C]=Cv({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(i[h]*a[h]===-1){p=r.x??y,_=r.y??x;const k=[{x:p,y:l.y},{x:p,y:c.y}],E=[{x:l.x,y:_},{x:c.x,y:_}];g=i[h]===f?h==="x"?k:E:h==="x"?E:k}else{const k=[{x:l.x,y:c.y}],E=[{x:c.x,y:l.y}];if(g=h==="x"?i.x===f?E:k:i.y===f?k:E,e===o){const A=Math.abs(t[h]-n[h]);if(A<=s){const M=Math.min(s-1,s-A);i[h]===f?m[h]=(l[h]>t[h]?-1:1)*M:b[h]=(c[h]>n[h]?-1:1)*M}}if(e!==o){const A=h==="x"?"y":"x",M=i[h]===a[A],R=l[A]>c[A],z=l[A]<c[A];(i[h]===1&&(!M&&R||M&&z)||i[h]!==1&&(!M&&z||M&&R))&&(g=h==="x"?k:E)}const N={x:l.x+m.x,y:l.y+m.y},I={x:c.x+b.x,y:c.y+b.y};Math.max(Math.abs(N.x-g[0].x),Math.abs(I.x-g[0].x))>=Math.max(Math.abs(N.y-g[0].y),Math.abs(I.y-g[0].y))?(p=(N.x+I.x)/2,_=g[0].y):(p=g[0].x,_=(N.y+I.y)/2)}return[[t,{x:l.x+m.x,y:l.y+m.y},...g,{x:c.x+b.x,y:c.y+b.y},n],p,_,v,C]}function Lh({sourceX:t,sourceY:e,sourcePosition:n=ze.Bottom,targetX:o,targetY:r,targetPosition:s=ze.Top,borderRadius:i=5,centerX:a,centerY:l,offset:c=20}){const[d,h,f,p,_]=bR({source:{x:t,y:e},sourcePosition:n,target:{x:o,y:r},targetPosition:s,center:{x:a,y:l},offset:c});return[d.reduce((g,m,b)=>{let y="";return y=b>0&&b<d.length-1?function(x,v,C,k){const E=Math.min(Ov(x,v)/2,Ov(v,C)/2,k),{x:N,y:I}=v;if(x.x===N&&N===C.x||x.y===I&&I===C.y)return`L${N} ${I}`;if(x.y===I)return`L ${N+E*(x.x<C.x?-1:1)},${I}Q ${N},${I} ${N},${I+E*(x.y<C.y?1:-1)}`;const A=x.x<C.x?1:-1;return`L ${N},${I+E*(x.y<C.y?-1:1)}Q ${N},${I} ${N+E*A},${I}`}(d[b-1],m,d[b+1],i):`${b===0?"M":"L"}${m.x} ${m.y}`,g+=y},""),h,f,p,_]}const Fl=T.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,sourcePosition:h=ze.Bottom,targetPosition:f=ze.Top,markerEnd:p,markerStart:_,pathOptions:g,interactionWidth:m})=>{const[b,y,x]=Lh({sourceX:t,sourceY:e,sourcePosition:h,targetX:n,targetY:o,targetPosition:f,borderRadius:g==null?void 0:g.borderRadius,offset:g==null?void 0:g.offset});return K.createElement(Mi,{path:b,labelX:y,labelY:x,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:p,markerStart:_,interactionWidth:m})});Fl.displayName="SmoothStepEdge";const Fh=T.memo(t=>{var e;return K.createElement(Fl,{...t,pathOptions:T.useMemo(()=>{var n;return{borderRadius:0,offset:(n=t.pathOptions)==null?void 0:n.offset}},[(e=t.pathOptions)==null?void 0:e.offset])})});Fh.displayName="StepEdge";const zh=T.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:h,markerStart:f,interactionWidth:p})=>{const[_,g,m]=function({sourceX:b,sourceY:y,targetX:x,targetY:v}){const[C,k,E,N]=Cv({sourceX:b,sourceY:y,targetX:x,targetY:v});return[`M ${b},${y}L ${x},${v}`,C,k,E,N]}({sourceX:t,sourceY:e,targetX:n,targetY:o});return K.createElement(Mi,{path:_,labelX:g,labelY:m,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:h,markerStart:f,interactionWidth:p})});function zl(t,e){return t>=0?.5*t:25*e*Math.sqrt(-t)}function Dv({pos:t,x1:e,y1:n,x2:o,y2:r,c:s}){switch(t){case ze.Left:return[e-zl(e-o,s),n];case ze.Right:return[e+zl(o-e,s),n];case ze.Top:return[e,n-zl(n-r,s)];case ze.Bottom:return[e,n+zl(r-n,s)]}}function Rv({sourceX:t,sourceY:e,sourcePosition:n=ze.Bottom,targetX:o,targetY:r,targetPosition:s=ze.Top,curvature:i=.25}){const[a,l]=Dv({pos:n,x1:t,y1:e,x2:o,y2:r,c:i}),[c,d]=Dv({pos:s,x1:o,y1:r,x2:t,y2:e,c:i}),[h,f,p,_]=Nv({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:d});return[`M${t},${e} C${a},${l} ${c},${d} ${o},${r}`,h,f,p,_]}zh.displayName="StraightEdge";const Bl=T.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,sourcePosition:r=ze.Bottom,targetPosition:s=ze.Top,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:p,markerStart:_,pathOptions:g,interactionWidth:m})=>{const[b,y,x]=Rv({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:o,targetPosition:s,curvature:g==null?void 0:g.curvature});return K.createElement(Mi,{path:b,labelX:y,labelY:x,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:p,markerStart:_,interactionWidth:m})});Bl.displayName="BezierEdge";const Bh=T.createContext(null),yR=Bh.Provider;Bh.Consumer;const xR=({source:t,sourceHandle:e,target:n,targetHandle:o})=>`reactflow__edge-${t}${e||""}-${n}${o||""}`,Uh=(t,e)=>t===void 0?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(n=>`${n}=${t[n]}`).join("&")}`,Vh=({x:t,y:e},[n,o,r],s,[i,a])=>{const l={x:(t-n)/r,y:(e-o)/r};return s?{x:i*Math.round(l.x/i),y:a*Math.round(l.y/a)}:l},Pv=({x:t,y:e},[n,o,r])=>({x:t*r+n,y:e*r+o}),fs=(t,e=[0,0])=>{if(!t)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(t.width??0)*e[0],o=(t.height??0)*e[1],r={x:t.position.x-n,y:t.position.y-o};return{...r,positionAbsolute:t.positionAbsolute?{x:t.positionAbsolute.x-n,y:t.positionAbsolute.y-o}:r}},$h=(t,e=[0,0])=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((o,r)=>{const{x:s,y:i}=fs(r,e).positionAbsolute;return a=o,l=Mh({x:s,y:i,width:r.width||0,height:r.height||0}),{x:Math.min(a.x,l.x),y:Math.min(a.y,l.y),x2:Math.max(a.x2,l.x2),y2:Math.max(a.y2,l.y2)};var a,l},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return(({x:o,y:r,x2:s,y2:i})=>({x:o,y:r,width:s-o,height:i-r}))(n)},Lv=(t,e,[n,o,r]=[0,0,1],s=!1,i=!1,a=[0,0])=>{const l={x:(e.x-n)/r,y:(e.y-o)/r,width:e.width/r,height:e.height/r},c=[];return t.forEach(d=>{const{width:h,height:f,selectable:p=!0,hidden:_=!1}=d;if(i&&!p||_)return!1;const{positionAbsolute:g}=fs(d,a),m={x:g.x,y:g.y,width:h||0,height:f||0},b=Oh(l,m);(h===void 0||f===void 0||h===null||f===null||s&&b>0||b>=(h||0)*(f||0)||d.dragging)&&c.push(d)}),c},Fv=(t,e)=>{const n=t.map(o=>o.id);return e.filter(o=>n.includes(o.source)||n.includes(o.target))},zv=(t,e,n,o,r,s=.1)=>{const i=e/(t.width*(1+s)),a=n/(t.height*(1+s)),l=Math.min(i,a),c=us(l,o,r);return{x:e/2-(t.x+t.width/2)*c,y:n/2-(t.y+t.height/2)*c,zoom:c}},Nr=(t,e=0)=>t.transition().duration(e);function Bv(t,e,n,o){return(e[n]||[]).reduce((r,s)=>{var i,a;return`${t.id}-${s.id}-${n}`!==o&&r.push({id:s.id||null,type:n,nodeId:t.id,x:(((i=t.positionAbsolute)==null?void 0:i.x)??0)+s.x+s.width/2,y:(((a=t.positionAbsolute)==null?void 0:a.y)??0)+s.y+s.height/2}),r},[])}const wR={source:null,target:null,sourceHandle:null,targetHandle:null},Uv=()=>({handleDomNode:null,isValid:!1,connection:wR,endHandle:null});function Vv(t,e,n,o,r,s,i){const a=r==="target",l=i.querySelector(`.react-flow__handle[data-id="${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`),c={...Uv(),handleDomNode:l};if(l){const d=Hh(void 0,l),h=l.getAttribute("data-nodeid"),f=l.getAttribute("data-handleid"),p=l.classList.contains("connectable"),_=l.classList.contains("connectableend"),g={source:a?h:n,sourceHandle:a?f:o,target:a?n:h,targetHandle:a?o:f};c.connection=g,p&&_&&(e===Cr.Strict?a&&d==="source"||!a&&d==="target":h!==n||f!==o)&&(c.endHandle={nodeId:h,handleId:f,type:d},c.isValid=s(g))}return c}function Hh(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function Wh(t){t==null||t.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function vR(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function $v({event:t,handleId:e,nodeId:n,onConnect:o,isTarget:r,getState:s,setState:i,isValidConnection:a,edgeUpdaterType:l,onReconnectEnd:c}){const d=wv(t.target),{connectionMode:h,domNode:f,autoPanOnConnect:p,connectionRadius:_,onConnectStart:g,panBy:m,getNodes:b,cancelConnection:y}=s();let x,v=0;const{x:C,y:k}=Yo(t),E=d==null?void 0:d.elementFromPoint(C,k),N=Hh(l,E),I=f==null?void 0:f.getBoundingClientRect();if(!I||!N)return;let A,M=Yo(t,I),R=!1,z=null,D=!1,F=null;const B=function({nodes:$,nodeId:j,handleId:W,handleType:Y}){return $.reduce((G,q)=>{if(q[vt]){const{handleBounds:te}=q[vt];let re=[],ie=[];te&&(re=Bv(q,te,"source",`${j}-${W}-${Y}`),ie=Bv(q,te,"target",`${j}-${W}-${Y}`)),G.push(...re,...ie)}return G},[])}({nodes:b(),nodeId:n,handleId:e,handleType:N}),U=()=>{if(!p)return;const[$,j]=xv(M,I);m({x:$,y:j}),v=requestAnimationFrame(U)};function O($){const{transform:j}=s();M=Yo($,I);const{handle:W,validHandleResult:Y}=function(G,q,te,re,ie,Z){const{x:ee,y:ue}=Yo(G),me=q.elementsFromPoint(ee,ue).find(Ee=>Ee.classList.contains("react-flow__handle"));if(me){const Ee=me.getAttribute("data-nodeid");if(Ee){const ae=Hh(void 0,me),Me=me.getAttribute("data-handleid"),xe=Z({nodeId:Ee,id:Me,type:ae});if(xe){const Re=ie.find(Ue=>Ue.nodeId===Ee&&Ue.type===ae&&Ue.id===Me);return{handle:{id:Me,type:ae,nodeId:Ee,x:(Re==null?void 0:Re.x)||te.x,y:(Re==null?void 0:Re.y)||te.y},validHandleResult:xe}}}}let de=[],fe=1/0;if(ie.forEach(Ee=>{const ae=Math.sqrt((Ee.x-te.x)**2+(Ee.y-te.y)**2);if(ae<=re){const Me=Z(Ee);ae<=fe&&(ae<fe?de=[{handle:Ee,validHandleResult:Me}]:ae===fe&&de.push({handle:Ee,validHandleResult:Me}),fe=ae)}}),!de.length)return{handle:null,validHandleResult:Uv()};if(de.length===1)return de[0];const he=de.some(({validHandleResult:Ee})=>Ee.isValid),Ce=de.some(({handle:Ee})=>Ee.type==="target");return de.find(({handle:Ee,validHandleResult:ae})=>Ce?Ee.type==="target":!he||ae.isValid)||de[0]}($,d,Vh(M,j,!1,[1,1]),_,B,G=>Vv(G,h,n,e,r?"target":"source",a,d));if(x=W,R||(U(),R=!0),F=Y.handleDomNode,z=Y.connection,D=Y.isValid,i({connectionPosition:x&&D?Pv({x:x.x,y:x.y},j):M,connectionStatus:vR(!!x,D),connectionEndHandle:Y.endHandle}),!x&&!D&&!F)return Wh(A);z.source!==z.target&&F&&(Wh(A),A=F,F.classList.add("connecting","react-flow__handle-connecting"),F.classList.toggle("valid",D),F.classList.toggle("react-flow__handle-valid",D))}function S($){var j,W;(x||F)&&z&&D&&(o==null||o(z)),(W=(j=s()).onConnectEnd)==null||W.call(j,$),l&&(c==null||c($)),Wh(A),y(),cancelAnimationFrame(v),R=!1,D=!1,z=null,F=null,d.removeEventListener("mousemove",O),d.removeEventListener("mouseup",S),d.removeEventListener("touchmove",O),d.removeEventListener("touchend",S)}i({connectionPosition:M,connectionStatus:null,connectionNodeId:n,connectionHandleId:e,connectionHandleType:N,connectionStartHandle:{nodeId:n,handleId:e,type:N},connectionEndHandle:null}),g==null||g(t,{nodeId:n,handleId:e,handleType:N}),d.addEventListener("mousemove",O),d.addEventListener("mouseup",S),d.addEventListener("touchmove",O),d.addEventListener("touchend",S)}const Hv=()=>!0,kR=t=>({connectionStartHandle:t.connectionStartHandle,connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName}),Wv=T.forwardRef(({type:t="source",position:e=ze.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:s=!0,id:i,onConnect:a,children:l,className:c,onMouseDown:d,onTouchStart:h,...f},p)=>{var N,I;const _=i||null,g=t==="target",m=Vt(),b=T.useContext(Bh),{connectOnClick:y,noPanClassName:x}=pt(kR,Qt),{connecting:v,clickConnecting:C}=pt(((A,M,R)=>z=>{const{connectionStartHandle:D,connectionEndHandle:F,connectionClickStartHandle:B}=z;return{connecting:(D==null?void 0:D.nodeId)===A&&(D==null?void 0:D.handleId)===M&&(D==null?void 0:D.type)===R||(F==null?void 0:F.nodeId)===A&&(F==null?void 0:F.handleId)===M&&(F==null?void 0:F.type)===R,clickConnecting:(B==null?void 0:B.nodeId)===A&&(B==null?void 0:B.handleId)===M&&(B==null?void 0:B.type)===R}})(b,_,t),Qt);b||((I=(N=m.getState()).onError)==null||I.call(N,"010",hR()));const k=A=>{const{defaultEdgeOptions:M,onConnect:R,hasDefaultEdges:z}=m.getState(),D={...M,...A};if(z){const{edges:F,setEdges:B}=m.getState();B(((U,O)=>{if(!U.source||!U.target)return O;let S;return S=($=>"id"in $&&"source"in $&&"target"in $)(U)?{...U}:{...U,id:xR(U)},(($,j)=>j.some(W=>!(W.source!==$.source||W.target!==$.target||W.sourceHandle!==$.sourceHandle&&(W.sourceHandle||$.sourceHandle)||W.targetHandle!==$.targetHandle&&(W.targetHandle||$.targetHandle))))(S,O)?O:O.concat(S)})(D,F))}R==null||R(D),a==null||a(D)},E=A=>{if(!b)return;const M=Sv(A);r&&(M&&A.button===0||!M)&&$v({event:A,handleId:_,nodeId:b,onConnect:k,isTarget:g,getState:m.getState,setState:m.setState,isValidConnection:n||m.getState().isValidConnection||Hv}),M?d==null||d(A):h==null||h(A)};return K.createElement("div",{"data-handleid":_,"data-nodeid":b,"data-handlepos":e,"data-id":`${b}-${_}-${t}`,className:ln(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",x,c,{source:!g,target:g,connectable:o,connectablestart:r,connectableend:s,connecting:C,connectionindicator:o&&(r&&!v||s&&v)}]),onMouseDown:E,onTouchStart:E,onClick:y?A=>{const{onClickConnectStart:M,onClickConnectEnd:R,connectionClickStartHandle:z,connectionMode:D,isValidConnection:F}=m.getState();if(!b||!z&&!r)return;if(!z)return M==null||M(A,{nodeId:b,handleId:_,handleType:t}),void m.setState({connectionClickStartHandle:{nodeId:b,type:t,handleId:_}});const B=wv(A.target),U=n||F||Hv,{connection:O,isValid:S}=Vv({nodeId:b,id:_,type:t},D,z.nodeId,z.handleId||null,z.type,U,B);S&&k(O),R==null||R(A),m.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f},l)});Wv.displayName="Handle";var Xo=T.memo(Wv);const qv=({data:t,isConnectable:e,targetPosition:n=ze.Top,sourcePosition:o=ze.Bottom})=>K.createElement(K.Fragment,null,K.createElement(Xo,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label,K.createElement(Xo,{type:"source",position:o,isConnectable:e}));qv.displayName="DefaultNode";var qh=T.memo(qv);const Gv=({data:t,isConnectable:e,sourcePosition:n=ze.Bottom})=>K.createElement(K.Fragment,null,t==null?void 0:t.label,K.createElement(Xo,{type:"source",position:n,isConnectable:e}));Gv.displayName="InputNode";var Yv=T.memo(Gv);const Jv=({data:t,isConnectable:e,targetPosition:n=ze.Top})=>K.createElement(K.Fragment,null,K.createElement(Xo,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label);Jv.displayName="OutputNode";var Kv=T.memo(Jv);const Gh=()=>null;Gh.displayName="GroupNode";const SR=t=>({selectedNodes:t.getNodes().filter(e=>e.selected),selectedEdges:t.edges.filter(e=>e.selected).map(e=>({...e}))}),Ul=t=>t.id;function CR(t,e){return Qt(t.selectedNodes.map(Ul),e.selectedNodes.map(Ul))&&Qt(t.selectedEdges.map(Ul),e.selectedEdges.map(Ul))}const Xv=T.memo(({onSelectionChange:t})=>{const e=Vt(),{selectedNodes:n,selectedEdges:o}=pt(SR,CR);return T.useEffect(()=>{const r={nodes:n,edges:o};t==null||t(r),e.getState().onSelectionChange.forEach(s=>s(r))},[n,o,t]),null});Xv.displayName="SelectionListener";const NR=t=>!!t.onSelectionChange;function jR({onSelectionChange:t}){const e=pt(NR);return t||e?K.createElement(Xv,{onSelectionChange:t}):null}const ER=t=>({setNodes:t.setNodes,setEdges:t.setEdges,setDefaultNodesAndEdges:t.setDefaultNodesAndEdges,setMinZoom:t.setMinZoom,setMaxZoom:t.setMaxZoom,setTranslateExtent:t.setTranslateExtent,setNodeExtent:t.setNodeExtent,reset:t.reset});function ps(t,e){T.useEffect(()=>{t!==void 0&&e(t)},[t])}function rt(t,e,n){T.useEffect(()=>{e!==void 0&&n({[t]:e})},[e])}const IR=({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,onConnect:r,onConnectStart:s,onConnectEnd:i,onClickConnectStart:a,onClickConnectEnd:l,nodesDraggable:c,nodesConnectable:d,nodesFocusable:h,edgesFocusable:f,edgesUpdatable:p,elevateNodesOnSelect:_,minZoom:g,maxZoom:m,nodeExtent:b,onNodesChange:y,onEdgesChange:x,elementsSelectable:v,connectionMode:C,snapGrid:k,snapToGrid:E,translateExtent:N,connectOnClick:I,defaultEdgeOptions:A,fitView:M,fitViewOptions:R,onNodesDelete:z,onEdgesDelete:D,onNodeDrag:F,onNodeDragStart:B,onNodeDragStop:U,onSelectionDrag:O,onSelectionDragStart:S,onSelectionDragStop:$,noPanClassName:j,nodeOrigin:W,rfId:Y,autoPanOnConnect:G,autoPanOnNodeDrag:q,onError:te,connectionRadius:re,isValidConnection:ie,nodeDragThreshold:Z})=>{const{setNodes:ee,setEdges:ue,setDefaultNodesAndEdges:me,setMinZoom:de,setMaxZoom:fe,setTranslateExtent:he,setNodeExtent:Ce,reset:Ee}=pt(ER,Qt),ae=Vt();return T.useEffect(()=>{const Me=o==null?void 0:o.map(xe=>({...xe,...A}));return me(n,Me),()=>{Ee()}},[]),rt("defaultEdgeOptions",A,ae.setState),rt("connectionMode",C,ae.setState),rt("onConnect",r,ae.setState),rt("onConnectStart",s,ae.setState),rt("onConnectEnd",i,ae.setState),rt("onClickConnectStart",a,ae.setState),rt("onClickConnectEnd",l,ae.setState),rt("nodesDraggable",c,ae.setState),rt("nodesConnectable",d,ae.setState),rt("nodesFocusable",h,ae.setState),rt("edgesFocusable",f,ae.setState),rt("edgesUpdatable",p,ae.setState),rt("elementsSelectable",v,ae.setState),rt("elevateNodesOnSelect",_,ae.setState),rt("snapToGrid",E,ae.setState),rt("snapGrid",k,ae.setState),rt("onNodesChange",y,ae.setState),rt("onEdgesChange",x,ae.setState),rt("connectOnClick",I,ae.setState),rt("fitViewOnInit",M,ae.setState),rt("fitViewOnInitOptions",R,ae.setState),rt("onNodesDelete",z,ae.setState),rt("onEdgesDelete",D,ae.setState),rt("onNodeDrag",F,ae.setState),rt("onNodeDragStart",B,ae.setState),rt("onNodeDragStop",U,ae.setState),rt("onSelectionDrag",O,ae.setState),rt("onSelectionDragStart",S,ae.setState),rt("onSelectionDragStop",$,ae.setState),rt("noPanClassName",j,ae.setState),rt("nodeOrigin",W,ae.setState),rt("rfId",Y,ae.setState),rt("autoPanOnConnect",G,ae.setState),rt("autoPanOnNodeDrag",q,ae.setState),rt("onError",te,ae.setState),rt("connectionRadius",re,ae.setState),rt("isValidConnection",ie,ae.setState),rt("nodeDragThreshold",Z,ae.setState),ps(t,ee),ps(e,ue),ps(g,de),ps(m,fe),ps(N,he),ps(b,Ce),null},Zv={display:"none"},AR={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Qv="react-flow__node-desc",e2="react-flow__edge-desc",TR=t=>t.ariaLiveMessage;function MR({rfId:t}){const e=pt(TR);return K.createElement("div",{id:`react-flow__aria-live-${t}`,"aria-live":"assertive","aria-atomic":"true",style:AR},e)}function OR({rfId:t,disableKeyboardA11y:e}){return K.createElement(K.Fragment,null,K.createElement("div",{id:`${Qv}-${t}`,style:Zv},"Press enter or space to select a node.",!e&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),K.createElement("div",{id:`${e2}-${t}`,style:Zv},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!e&&K.createElement(MR,{rfId:t}))}var Pi=(t=null,e={actInsideInputWithModifier:!0})=>{const[n,o]=T.useState(!1),r=T.useRef(!1),s=T.useRef(new Set([])),[i,a]=T.useMemo(()=>{if(t!==null){const l=(Array.isArray(t)?t:[t]).filter(d=>typeof d=="string").map(d=>d.split("+")),c=l.reduce((d,h)=>d.concat(...h),[]);return[l,c]}return[[],[]]},[t]);return T.useEffect(()=>{const l=typeof document<"u"?document:null,c=(e==null?void 0:e.target)||l;if(t!==null){const d=p=>{if(r.current=p.ctrlKey||p.metaKey||p.shiftKey,(!r.current||r.current&&!e.actInsideInputWithModifier)&&Dh(p))return!1;const _=n2(p.code,a);s.current.add(p[_]),t2(i,s.current,!1)&&(p.preventDefault(),o(!0))},h=p=>{if((!r.current||r.current&&!e.actInsideInputWithModifier)&&Dh(p))return!1;const _=n2(p.code,a);t2(i,s.current,!0)?(o(!1),s.current.clear()):s.current.delete(p[_]),p.key==="Meta"&&s.current.clear(),r.current=!1},f=()=>{s.current.clear(),o(!1)};return c==null||c.addEventListener("keydown",d),c==null||c.addEventListener("keyup",h),window.addEventListener("blur",f),()=>{c==null||c.removeEventListener("keydown",d),c==null||c.removeEventListener("keyup",h),window.removeEventListener("blur",f)}}},[t,o]),n};function t2(t,e,n){return t.filter(o=>n||o.length===e.size).some(o=>o.every(r=>e.has(r)))}function n2(t,e){return e.includes(t)?"code":"key"}function o2(t,e,n,o){var a,l;const r=t.parentNode||t.parentId;if(!r)return n;const s=e.get(r),i=fs(s,o);return o2(s,e,{x:(n.x??0)+i.x,y:(n.y??0)+i.y,z:(((a=s[vt])==null?void 0:a.z)??0)>(n.z??0)?((l=s[vt])==null?void 0:l.z)??0:n.z??0},o)}function r2(t,e,n){t.forEach(o=>{var s;const r=o.parentNode||o.parentId;if(r&&!t.has(r))throw new Error(`Parent node ${r} not found`);if(r||n!=null&&n[o.id]){const{x:i,y:a,z:l}=o2(o,t,{...o.position,z:((s=o[vt])==null?void 0:s.z)??0},e);o.positionAbsolute={x:i,y:a},o[vt].z=l,n!=null&&n[o.id]&&(o[vt].isParent=!0)}})}function Yh(t,e,n,o){const r=new Map,s={},i=o?1e3:0;return t.forEach(a=>{var p;const l=(On(a.zIndex)?a.zIndex:0)+(a.selected?i:0),c=e.get(a.id),d={...a,positionAbsolute:{x:a.position.x,y:a.position.y}},h=a.parentNode||a.parentId;h&&(s[h]=!0);const f=(c==null?void 0:c.type)&&(c==null?void 0:c.type)!==a.type;Object.defineProperty(d,vt,{enumerable:!1,value:{handleBounds:f||(p=c==null?void 0:c[vt])==null?void 0:p.handleBounds,z:l}}),r.set(a.id,d)}),r2(r,n,s),r}function s2(t,e={}){const{getNodes:n,width:o,height:r,minZoom:s,maxZoom:i,d3Zoom:a,d3Selection:l,fitViewOnInitDone:c,fitViewOnInit:d,nodeOrigin:h}=t(),f=e.initial&&!c&&d;if(a&&l&&(f||!e.initial)){const p=n().filter(g=>{var b;const m=e.includeHiddenNodes?g.width&&g.height:!g.hidden;return(b=e.nodes)!=null&&b.length?m&&e.nodes.some(y=>y.id===g.id):m}),_=p.every(g=>g.width&&g.height);if(p.length>0&&_){const g=$h(p,h),{x:m,y:b,zoom:y}=zv(g,o,r,e.minZoom??s,e.maxZoom??i,e.padding??.1),x=ur.translate(m,b).scale(y);return typeof e.duration=="number"&&e.duration>0?a.transform(Nr(l,e.duration),x):a.transform(l,x),!0}}return!1}function DR(t,e){return t.forEach(n=>{const o=e.get(n.id);o&&e.set(o.id,{...o,[vt]:o[vt],selected:n.selected})}),new Map(e)}function RR(t,e){return e.map(n=>{const o=t.find(r=>r.id===n.id);return o&&(n.selected=o.selected),n})}function Vl({changedNodes:t,changedEdges:e,get:n,set:o}){const{nodeInternals:r,edges:s,onNodesChange:i,onEdgesChange:a,hasDefaultNodes:l,hasDefaultEdges:c}=n();t!=null&&t.length&&(l&&o({nodeInternals:DR(t,r)}),i==null||i(t)),e!=null&&e.length&&(c&&o({edges:RR(e,s)}),a==null||a(e))}const ms=()=>{},PR={zoomIn:ms,zoomOut:ms,zoomTo:ms,getZoom:()=>1,setViewport:ms,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:ms,fitBounds:ms,project:t=>t,screenToFlowPosition:t=>t,flowToScreenPosition:t=>t,viewportInitialized:!1},LR=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection});function Li(){const t=(()=>{const g=Vt(),{d3Zoom:m,d3Selection:b}=pt(LR,Qt);return T.useMemo(()=>b&&m?{zoomIn:x=>m.scaleBy(Nr(b,x==null?void 0:x.duration),1.2),zoomOut:x=>m.scaleBy(Nr(b,x==null?void 0:x.duration),1/1.2),zoomTo:(x,v)=>m.scaleTo(Nr(b,v==null?void 0:v.duration),x),getZoom:()=>g.getState().transform[2],setViewport:(x,v)=>{const[C,k,E]=g.getState().transform,N=ur.translate(x.x??C,x.y??k).scale(x.zoom??E);m.transform(Nr(b,v==null?void 0:v.duration),N)},getViewport:()=>{const[x,v,C]=g.getState().transform;return{x,y:v,zoom:C}},fitView:x=>s2(g.getState,x),setCenter:(x,v,C)=>{const{width:k,height:E,maxZoom:N}=g.getState(),I=(C==null?void 0:C.zoom)!==void 0?C.zoom:N,A=k/2-x*I,M=E/2-v*I,R=ur.translate(A,M).scale(I);m.transform(Nr(b,C==null?void 0:C.duration),R)},fitBounds:(x,v)=>{const{width:C,height:k,minZoom:E,maxZoom:N}=g.getState(),{x:I,y:A,zoom:M}=zv(x,C,k,E,N,(v==null?void 0:v.padding)??.1),R=ur.translate(I,A).scale(M);m.transform(Nr(b,v==null?void 0:v.duration),R)},project:x=>{const{transform:v,snapToGrid:C,snapGrid:k}=g.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),Vh(x,v,C,k)},screenToFlowPosition:x=>{const{transform:v,snapToGrid:C,snapGrid:k,domNode:E}=g.getState();if(!E)return x;const{x:N,y:I}=E.getBoundingClientRect(),A={x:x.x-N,y:x.y-I};return Vh(A,v,C,k)},flowToScreenPosition:x=>{const{transform:v,domNode:C}=g.getState();if(!C)return x;const{x:k,y:E}=C.getBoundingClientRect(),N=Pv(x,v);return{x:N.x+k,y:N.y+E}},viewportInitialized:!0}:PR,[m,b])})(),e=Vt(),n=T.useCallback(()=>e.getState().getNodes().map(g=>({...g})),[]),o=T.useCallback(g=>e.getState().nodeInternals.get(g),[]),r=T.useCallback(()=>{const{edges:g=[]}=e.getState();return g.map(m=>({...m}))},[]),s=T.useCallback(g=>{const{edges:m=[]}=e.getState();return m.find(b=>b.id===g)},[]),i=T.useCallback(g=>{const{getNodes:m,setNodes:b,hasDefaultNodes:y,onNodesChange:x}=e.getState(),v=m(),C=typeof g=="function"?g(v):g;if(y)b(C);else if(x){const k=C.length===0?v.map(E=>({type:"remove",id:E.id})):C.map(E=>({item:E,type:"reset"}));x(k)}},[]),a=T.useCallback(g=>{const{edges:m=[],setEdges:b,hasDefaultEdges:y,onEdgesChange:x}=e.getState(),v=typeof g=="function"?g(m):g;y?b(v):x&&x(v.length===0?m.map(C=>({type:"remove",id:C.id})):v.map(C=>({item:C,type:"reset"})))},[]),l=T.useCallback(g=>{const m=Array.isArray(g)?g:[g],{getNodes:b,setNodes:y,hasDefaultNodes:x,onNodesChange:v}=e.getState();if(x)y([...b(),...m]);else if(v){const C=m.map(k=>({item:k,type:"add"}));v(C)}},[]),c=T.useCallback(g=>{const m=Array.isArray(g)?g:[g],{edges:b=[],setEdges:y,hasDefaultEdges:x,onEdgesChange:v}=e.getState();x?y([...b,...m]):v&&v(m.map(C=>({item:C,type:"add"})))},[]),d=T.useCallback(()=>{const{getNodes:g,edges:m=[],transform:b}=e.getState(),[y,x,v]=b;return{nodes:g().map(C=>({...C})),edges:m.map(C=>({...C})),viewport:{x:y,y:x,zoom:v}}},[]),h=T.useCallback(({nodes:g,edges:m})=>{const{nodeInternals:b,getNodes:y,edges:x,hasDefaultNodes:v,hasDefaultEdges:C,onNodesDelete:k,onEdgesDelete:E,onNodesChange:N,onEdgesChange:I}=e.getState(),A=(g||[]).map(F=>F.id),M=(m||[]).map(F=>F.id),R=y().reduce((F,B)=>{const U=B.parentNode||B.parentId,O=!A.includes(B.id)&&U&&F.find(S=>S.id===U);return(typeof B.deletable!="boolean"||B.deletable)&&(A.includes(B.id)||O)&&F.push(B),F},[]),z=x.filter(F=>typeof F.deletable!="boolean"||F.deletable),D=z.filter(F=>M.includes(F.id));if(R||D){const F=Fv(R,z),B=[...D,...F],U=B.reduce((O,S)=>(O.includes(S.id)||O.push(S.id),O),[]);(C||v)&&(C&&e.setState({edges:x.filter(O=>!U.includes(O.id))}),v&&(R.forEach(O=>{b.delete(O.id)}),e.setState({nodeInternals:new Map(b)}))),U.length>0&&(E==null||E(B),I&&I(U.map(O=>({id:O,type:"remove"})))),R.length>0&&(k==null||k(R),N)&&N(R.map(O=>({id:O.id,type:"remove"})))}},[]),f=T.useCallback(g=>{const m=On((b=g).width)&&On(b.height)&&On(b.x)&&On(b.y);var b;const y=m?null:e.getState().nodeInternals.get(g.id);return!m&&!y?[null,null,m]:[m?g:vv(y),y,m]},[]),p=T.useCallback((g,m=!0,b)=>{const[y,x,v]=f(g);return y?(b||e.getState().getNodes()).filter(C=>{if(!(v||C.id!==x.id&&C.positionAbsolute))return!1;const k=vv(C),E=Oh(k,y);return m&&E>0||E>=y.width*y.height}):[]},[]),_=T.useCallback((g,m,b=!0)=>{const[y]=f(g);if(!y)return!1;const x=Oh(y,m);return b&&x>0||x>=y.width*y.height},[]);return T.useMemo(()=>({...t,getNodes:n,getNode:o,getEdges:r,getEdge:s,setNodes:i,setEdges:a,addNodes:l,addEdges:c,toObject:d,deleteElements:h,getIntersectingNodes:p,isNodeIntersecting:_}),[t,n,o,r,s,i,a,l,c,d,h,p,_])}const FR={actInsideInputWithModifier:!1},Jh={position:"absolute",width:"100%",height:"100%",top:0,left:0},$l=t=>({x:t.x,y:t.y,zoom:t.k}),gs=(t,e)=>t.target.closest(`.${e}`),i2=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),a2=t=>{const e=t.ctrlKey&&Pl()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e},zR=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection,d3ZoomHandler:t.d3ZoomHandler,userSelectionActive:t.userSelectionActive}),BR=({onMove:t,onMoveStart:e,onMoveEnd:n,onPaneContextMenu:o,zoomOnScroll:r=!0,zoomOnPinch:s=!0,panOnScroll:i=!1,panOnScrollSpeed:a=.5,panOnScrollMode:l=Jo.Free,zoomOnDoubleClick:c=!0,elementsSelectable:d,panOnDrag:h=!0,defaultViewport:f,translateExtent:p,minZoom:_,maxZoom:g,zoomActivationKeyCode:m,preventScrolling:b=!0,children:y,noWheelClassName:x,noPanClassName:v})=>{const C=T.useRef(),k=Vt(),E=T.useRef(!1),N=T.useRef(!1),I=T.useRef(null),A=T.useRef({x:0,y:0,zoom:0}),{d3Zoom:M,d3Selection:R,d3ZoomHandler:z,userSelectionActive:D}=pt(zR,Qt),F=Pi(m),B=T.useRef(0),U=T.useRef(!1),O=T.useRef();return function(S){const $=Vt();T.useEffect(()=>{let j;const W=()=>{var G,q;if(!S.current)return;const Y=Ah(S.current);Y.height!==0&&Y.width!==0||((q=(G=$.getState()).onError)==null||q.call(G,"004",lR())),$.setState({width:Y.width||500,height:Y.height||500})};return W(),window.addEventListener("resize",W),S.current&&(j=new ResizeObserver(()=>W()),j.observe(S.current)),()=>{window.removeEventListener("resize",W),j&&S.current&&j.unobserve(S.current)}},[])}(I),T.useEffect(()=>{if(I.current){const S=I.current.getBoundingClientRect(),$=function(){var q,te,re,ie=tR,Z=nR,ee=sR,ue=oR,me=rR,de=[0,1/0],fe=[[-1/0,-1/0],[1/0,1/0]],he=250,Ce=YH,Ee=LS("start","zoom","end"),ae=0,Me=10;function xe(J){J.property("__zoom",_v).on("wheel.zoom",et,{passive:!1}).on("mousedown.zoom",nt).on("dblclick.zoom",ne).filter(me).on("touchstart.zoom",ve).on("touchmove.zoom",Se).on("touchend.zoom touchcancel.zoom",De).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function Re(J,ge){return(ge=Math.max(de[0],Math.min(de[1],ge)))===J.k?J:new Kp(ge,J.x,J.y)}function Ue(J,ge,_e){var pe=ge[0]-_e[0]*J.k,le=ge[1]-_e[1]*J.k;return pe===J.x&&le===J.y?J:new Kp(J.k,pe,le)}function Je(J){return[(+J[0][0]+ +J[1][0])/2,(+J[0][1]+ +J[1][1])/2]}function Ke(J,ge,_e,pe){J.on("start.zoom",function(){Pe(this,arguments).event(pe).start()}).on("interrupt.zoom end.zoom",function(){Pe(this,arguments).event(pe).end()}).tween("zoom",function(){var le=this,He=arguments,Fe=Pe(le,He).event(pe),Ze=Z.apply(le,He),se=_e==null?Je(Ze):typeof _e=="function"?_e.apply(le,He):_e,Ne=Math.max(Ze[1][0]-Ze[0][0],Ze[1][1]-Ze[0][1]),Ie=le.__zoom,Ve=typeof ge=="function"?ge.apply(le,He):ge,Ye=Ce(Ie.invert(se).concat(Ne/Ie.k),Ve.invert(se).concat(Ne/Ve.k));return function(Le){if(Le===1)Le=Ve;else{var qe=Ye(Le),it=Ne/qe[2];Le=new Kp(it,se[0]-qe[0]*it,se[1]-qe[1]*it)}Fe.zoom(null,Le)}})}function Pe(J,ge,_e){return!_e&&J.__zooming||new st(J,ge)}function st(J,ge){this.that=J,this.args=ge,this.active=0,this.sourceEvent=null,this.extent=Z.apply(J,ge),this.taps=0}function et(J,...ge){if(ie.apply(this,arguments)){var _e=Pe(this,ge).event(J),pe=this.__zoom,le=Math.max(de[0],Math.min(de[1],pe.k*Math.pow(2,ue.apply(this,arguments)))),He=so(J);if(_e.wheel)_e.mouse[0][0]===He[0]&&_e.mouse[0][1]===He[1]||(_e.mouse[1]=pe.invert(_e.mouse[0]=He)),clearTimeout(_e.wheel);else{if(pe.k===le)return;_e.mouse=[He,pe.invert(He)],Xp(this),_e.start()}Ti(J),_e.wheel=setTimeout(function(){_e.wheel=null,_e.end()},150),_e.zoom("mouse",ee(Ue(Re(pe,le),_e.mouse[0],_e.mouse[1]),_e.extent,fe))}}function nt(J,...ge){if(!re&&ie.apply(this,arguments)){var _e=J.currentTarget,pe=Pe(this,ge,!0).event(J),le=Kn(J.view).on("mousemove.zoom",function(se){if(Ti(se),!pe.moved){var Ne=se.clientX-Fe,Ie=se.clientY-Ze;pe.moved=Ne*Ne+Ie*Ie>ae}pe.event(se).zoom("mouse",ee(Ue(pe.that.__zoom,pe.mouse[0]=so(se,_e),pe.mouse[1]),pe.extent,fe))},!0).on("mouseup.zoom",function(se){le.on("mousemove.zoom mouseup.zoom",null),gv(se.view,pe.moved),Ti(se),pe.event(se).end()},!0),He=so(J,_e),Fe=J.clientX,Ze=J.clientY;mv(J.view),Ih(J),pe.mouse=[He,this.__zoom.invert(He)],Xp(this),pe.start()}}function ne(J,...ge){if(ie.apply(this,arguments)){var _e=this.__zoom,pe=so(J.changedTouches?J.changedTouches[0]:J,this),le=_e.invert(pe),He=_e.k*(J.shiftKey?.5:2),Fe=ee(Ue(Re(_e,He),pe,le),Z.apply(this,ge),fe);Ti(J),he>0?Kn(this).transition().duration(he).call(Ke,Fe,pe,J):Kn(this).call(xe.transform,Fe,pe,J)}}function ve(J,...ge){if(ie.apply(this,arguments)){var _e,pe,le,He,Fe=J.touches,Ze=Fe.length,se=Pe(this,ge,J.changedTouches.length===Ze).event(J);for(Ih(J),pe=0;pe<Ze;++pe)He=[He=so(le=Fe[pe],this),this.__zoom.invert(He),le.identifier],se.touch0?se.touch1||se.touch0[2]===He[2]||(se.touch1=He,se.taps=0):(se.touch0=He,_e=!0,se.taps=1+!!q);q&&(q=clearTimeout(q)),_e&&(se.taps<2&&(te=He[0],q=setTimeout(function(){q=null},500)),Xp(this),se.start())}}function Se(J,...ge){if(this.__zooming){var _e,pe,le,He,Fe=Pe(this,ge).event(J),Ze=J.changedTouches,se=Ze.length;for(Ti(J),_e=0;_e<se;++_e)le=so(pe=Ze[_e],this),Fe.touch0&&Fe.touch0[2]===pe.identifier?Fe.touch0[0]=le:Fe.touch1&&Fe.touch1[2]===pe.identifier&&(Fe.touch1[0]=le);if(pe=Fe.that.__zoom,Fe.touch1){var Ne=Fe.touch0[0],Ie=Fe.touch0[1],Ve=Fe.touch1[0],Ye=Fe.touch1[1],Le=(Le=Ve[0]-Ne[0])*Le+(Le=Ve[1]-Ne[1])*Le,qe=(qe=Ye[0]-Ie[0])*qe+(qe=Ye[1]-Ie[1])*qe;pe=Re(pe,Math.sqrt(Le/qe)),le=[(Ne[0]+Ve[0])/2,(Ne[1]+Ve[1])/2],He=[(Ie[0]+Ye[0])/2,(Ie[1]+Ye[1])/2]}else{if(!Fe.touch0)return;le=Fe.touch0[0],He=Fe.touch0[1]}Fe.zoom("touch",ee(Ue(pe,le,He),Fe.extent,fe))}}function De(J,...ge){if(this.__zooming){var _e,pe,le=Pe(this,ge).event(J),He=J.changedTouches,Fe=He.length;for(Ih(J),re&&clearTimeout(re),re=setTimeout(function(){re=null},500),_e=0;_e<Fe;++_e)pe=He[_e],le.touch0&&le.touch0[2]===pe.identifier?delete le.touch0:le.touch1&&le.touch1[2]===pe.identifier&&delete le.touch1;if(le.touch1&&!le.touch0&&(le.touch0=le.touch1,delete le.touch1),le.touch0)le.touch0[1]=this.__zoom.invert(le.touch0[0]);else if(le.end(),le.taps===2&&(pe=so(pe,this),Math.hypot(te[0]-pe[0],te[1]-pe[1])<Me)){var Ze=Kn(this).on("dblclick.zoom");Ze&&Ze.apply(this,arguments)}}}return xe.transform=function(J,ge,_e,pe){var le=J.selection?J.selection():J;le.property("__zoom",_v),J!==le?Ke(J,ge,_e,pe):le.interrupt().each(function(){Pe(this,arguments).event(pe).start().zoom(null,typeof ge=="function"?ge.apply(this,arguments):ge).end()})},xe.scaleBy=function(J,ge,_e,pe){xe.scaleTo(J,function(){return this.__zoom.k*(typeof ge=="function"?ge.apply(this,arguments):ge)},_e,pe)},xe.scaleTo=function(J,ge,_e,pe){xe.transform(J,function(){var le=Z.apply(this,arguments),He=this.__zoom,Fe=_e==null?Je(le):typeof _e=="function"?_e.apply(this,arguments):_e,Ze=He.invert(Fe),se=typeof ge=="function"?ge.apply(this,arguments):ge;return ee(Ue(Re(He,se),Fe,Ze),le,fe)},_e,pe)},xe.translateBy=function(J,ge,_e,pe){xe.transform(J,function(){return ee(this.__zoom.translate(typeof ge=="function"?ge.apply(this,arguments):ge,typeof _e=="function"?_e.apply(this,arguments):_e),Z.apply(this,arguments),fe)},null,pe)},xe.translateTo=function(J,ge,_e,pe,le){xe.transform(J,function(){var He=Z.apply(this,arguments),Fe=this.__zoom,Ze=pe==null?Je(He):typeof pe=="function"?pe.apply(this,arguments):pe;return ee(ur.translate(Ze[0],Ze[1]).scale(Fe.k).translate(typeof ge=="function"?-ge.apply(this,arguments):-ge,typeof _e=="function"?-_e.apply(this,arguments):-_e),He,fe)},pe,le)},st.prototype={event:function(J){return J&&(this.sourceEvent=J),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(J,ge){return this.mouse&&J!=="mouse"&&(this.mouse[1]=ge.invert(this.mouse[0])),this.touch0&&J!=="touch"&&(this.touch0[1]=ge.invert(this.touch0[0])),this.touch1&&J!=="touch"&&(this.touch1[1]=ge.invert(this.touch1[0])),this.that.__zoom=ge,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(J){var ge=Kn(this.that).datum();Ee.call(J,this.that,new eR(J,{sourceEvent:this.sourceEvent,target:xe,transform:this.that.__zoom,dispatch:Ee}),ge)}},xe.wheelDelta=function(J){return arguments.length?(ue=typeof J=="function"?J:Ol(+J),xe):ue},xe.filter=function(J){return arguments.length?(ie=typeof J=="function"?J:Ol(!!J),xe):ie},xe.touchable=function(J){return arguments.length?(me=typeof J=="function"?J:Ol(!!J),xe):me},xe.extent=function(J){return arguments.length?(Z=typeof J=="function"?J:Ol([[+J[0][0],+J[0][1]],[+J[1][0],+J[1][1]]]),xe):Z},xe.scaleExtent=function(J){return arguments.length?(de[0]=+J[0],de[1]=+J[1],xe):[de[0],de[1]]},xe.translateExtent=function(J){return arguments.length?(fe[0][0]=+J[0][0],fe[1][0]=+J[1][0],fe[0][1]=+J[0][1],fe[1][1]=+J[1][1],xe):[[fe[0][0],fe[0][1]],[fe[1][0],fe[1][1]]]},xe.constrain=function(J){return arguments.length?(ee=J,xe):ee},xe.duration=function(J){return arguments.length?(he=+J,xe):he},xe.interpolate=function(J){return arguments.length?(Ce=J,xe):Ce},xe.on=function(){var J=Ee.on.apply(Ee,arguments);return J===Ee?xe:J},xe.clickDistance=function(J){return arguments.length?(ae=(J=+J)*J,xe):Math.sqrt(ae)},xe.tapDistance=function(J){return arguments.length?(Me=+J,xe):Me},xe}().scaleExtent([_,g]).translateExtent(p),j=Kn(I.current).call($),W=ur.translate(f.x,f.y).scale(us(f.zoom,_,g)),Y=[[0,0],[S.width,S.height]],G=$.constrain()(W,Y,p);$.transform(j,G),$.wheelDelta(a2),k.setState({d3Zoom:$,d3Selection:j,d3ZoomHandler:j.on("wheel.zoom"),transform:[G.x,G.y,G.k],domNode:I.current.closest(".react-flow")})}},[]),T.useEffect(()=>{R&&M&&(!i||F||D?z!==void 0&&R.on("wheel.zoom",function(S,$){if(!b&&S.type==="wheel"&&!S.ctrlKey||gs(S,x))return null;S.preventDefault(),z.call(this,S,$)},{passive:!1}):R.on("wheel.zoom",S=>{if(gs(S,x))return!1;S.preventDefault(),S.stopImmediatePropagation();const $=R.property("__zoom").k||1;if(S.ctrlKey&&s){const ie=so(S),Z=a2(S),ee=$*Math.pow(2,Z);return void M.scaleTo(R,ee,ie,S)}const j=S.deltaMode===1?20:1;let W=l===Jo.Vertical?0:S.deltaX*j,Y=l===Jo.Horizontal?0:S.deltaY*j;!Pl()&&S.shiftKey&&l!==Jo.Vertical&&(W=S.deltaY*j,Y=0),M.translateBy(R,-W/$*a,-Y/$*a,{internal:!0});const G=$l(R.property("__zoom")),{onViewportChangeStart:q,onViewportChange:te,onViewportChangeEnd:re}=k.getState();clearTimeout(O.current),U.current||(U.current=!0,e==null||e(S,G),q==null||q(G)),U.current&&(t==null||t(S,G),te==null||te(G),O.current=setTimeout(()=>{n==null||n(S,G),re==null||re(G),U.current=!1},150))},{passive:!1}))},[D,i,l,R,M,z,F,s,b,x,e,t,n]),T.useEffect(()=>{M&&M.on("start",S=>{var W,Y;if(!S.sourceEvent||S.sourceEvent.internal)return null;B.current=(W=S.sourceEvent)==null?void 0:W.button;const{onViewportChangeStart:$}=k.getState(),j=$l(S.transform);E.current=!0,A.current=j,((Y=S.sourceEvent)==null?void 0:Y.type)==="mousedown"&&k.setState({paneDragging:!0}),$==null||$(j),e==null||e(S.sourceEvent,j)})},[M,e]),T.useEffect(()=>{M&&(D&&!E.current?M.on("zoom",null):D||M.on("zoom",S=>{var j;const{onViewportChange:$}=k.getState();if(k.setState({transform:[S.transform.x,S.transform.y,S.transform.k]}),N.current=!(!o||!i2(h,B.current??0)),(t||$)&&!((j=S.sourceEvent)!=null&&j.internal)){const W=$l(S.transform);$==null||$(W),t==null||t(S.sourceEvent,W)}}))},[D,M,t,h,o]),T.useEffect(()=>{M&&M.on("end",S=>{if(!S.sourceEvent||S.sourceEvent.internal)return null;const{onViewportChangeEnd:$}=k.getState();if(E.current=!1,k.setState({paneDragging:!1}),o&&i2(h,B.current??0)&&!N.current&&o(S.sourceEvent),N.current=!1,(n||$)&&(j=A.current,W=S.transform,j.x!==W.x||j.y!==W.y||j.zoom!==W.k)){const Y=$l(S.transform);A.current=Y,clearTimeout(C.current),C.current=setTimeout(()=>{$==null||$(Y),n==null||n(S.sourceEvent,Y)},i?150:0)}var j,W})},[M,i,h,n,o]),T.useEffect(()=>{M&&M.filter(S=>{const $=F||r,j=s&&S.ctrlKey;if((h===!0||Array.isArray(h)&&h.includes(1))&&S.button===1&&S.type==="mousedown"&&(gs(S,"react-flow__node")||gs(S,"react-flow__edge")))return!0;if(!(h||$||i||c||s)||D||!c&&S.type==="dblclick"||gs(S,x)&&S.type==="wheel"||gs(S,v)&&(S.type!=="wheel"||i&&S.type==="wheel"&&!F)||!s&&S.ctrlKey&&S.type==="wheel"||!$&&!i&&!j&&S.type==="wheel"||!h&&(S.type==="mousedown"||S.type==="touchstart")||Array.isArray(h)&&!h.includes(S.button)&&S.type==="mousedown")return!1;const W=Array.isArray(h)&&h.includes(S.button)||!S.button||S.button<=1;return(!S.ctrlKey||S.type==="wheel")&&W})},[D,M,r,s,i,c,h,d,F]),K.createElement("div",{className:"react-flow__renderer",ref:I,style:Jh},y)},UR=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function VR(){const{userSelectionActive:t,userSelectionRect:e}=pt(UR,Qt);return t&&e?K.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}function l2(t,e){const n=e.parentNode||e.parentId,o=t.find(r=>r.id===n);if(o){const r=e.position.x+e.width-o.width,s=e.position.y+e.height-o.height;if(r>0||s>0||e.position.x<0||e.position.y<0){if(o.style={...o.style},o.style.width=o.style.width??o.width,o.style.height=o.style.height??o.height,r>0&&(o.style.width+=r),s>0&&(o.style.height+=s),e.position.x<0){const i=Math.abs(e.position.x);o.position.x=o.position.x-i,o.style.width+=i,e.position.x=0}if(e.position.y<0){const i=Math.abs(e.position.y);o.position.y=o.position.y-i,o.style.height+=i,e.position.y=0}o.width=o.style.width,o.height=o.style.height}}}function c2(t,e){if(t.some(o=>o.type==="reset"))return t.filter(o=>o.type==="reset").map(o=>o.item);const n=t.filter(o=>o.type==="add").map(o=>o.item);return e.reduce((o,r)=>{const s=t.filter(a=>a.id===r.id);if(s.length===0)return o.push(r),o;const i={...r};for(const a of s)if(a)switch(a.type){case"select":i.selected=a.selected;break;case"position":a.position!==void 0&&(i.position=a.position),a.positionAbsolute!==void 0&&(i.positionAbsolute=a.positionAbsolute),a.dragging!==void 0&&(i.dragging=a.dragging),i.expandParent&&l2(o,i);break;case"dimensions":a.dimensions!==void 0&&(i.width=a.dimensions.width,i.height=a.dimensions.height),a.updateStyle!==void 0&&(i.style={...i.style||{},...a.dimensions}),typeof a.resizing=="boolean"&&(i.resizing=a.resizing),i.expandParent&&l2(o,i);break;case"remove":return o}return o.push(i),o},n)}function d2(t,e){return c2(t,e)}const Zo=(t,e)=>({id:t,type:"select",selected:e});function _s(t,e){return t.reduce((n,o)=>{const r=e.includes(o.id);return!o.selected&&r?(o.selected=!0,n.push(Zo(o.id,!0))):o.selected&&!r&&(o.selected=!1,n.push(Zo(o.id,!1))),n},[])}const Kh=(t,e)=>n=>{n.target===e.current&&(t==null||t(n))},$R=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,dragging:t.paneDragging}),u2=T.memo(({isSelecting:t,selectionMode:e=Di.Full,panOnDrag:n,onSelectionStart:o,onSelectionEnd:r,onPaneClick:s,onPaneContextMenu:i,onPaneScroll:a,onPaneMouseEnter:l,onPaneMouseMove:c,onPaneMouseLeave:d,children:h})=>{const f=T.useRef(null),p=Vt(),_=T.useRef(0),g=T.useRef(0),m=T.useRef(),{userSelectionActive:b,elementsSelectable:y,dragging:x}=pt($R,Qt),v=()=>{p.setState({userSelectionActive:!1,userSelectionRect:null}),_.current=0,g.current=0},C=N=>{s==null||s(N),p.getState().resetSelectedElements(),p.setState({nodesSelectionActive:!1})},k=a?N=>a(N):void 0,E=y&&(t||b);return K.createElement("div",{className:ln(["react-flow__pane",{dragging:x,selection:t}]),onClick:E?void 0:Kh(C,f),onContextMenu:Kh(N=>{Array.isArray(n)&&(n!=null&&n.includes(2))?N.preventDefault():i==null||i(N)},f),onWheel:Kh(k,f),onMouseEnter:E?void 0:l,onMouseDown:E?N=>{const{resetSelectedElements:I,domNode:A}=p.getState();if(m.current=A==null?void 0:A.getBoundingClientRect(),!y||!t||N.button!==0||N.target!==f.current||!m.current)return;const{x:M,y:R}=Yo(N,m.current);I(),p.setState({userSelectionRect:{width:0,height:0,startX:M,startY:R,x:M,y:R}}),o==null||o(N)}:void 0,onMouseMove:E?N=>{const{userSelectionRect:I,nodeInternals:A,edges:M,transform:R,onNodesChange:z,onEdgesChange:D,nodeOrigin:F,getNodes:B}=p.getState();if(!t||!m.current||!I)return;p.setState({userSelectionActive:!0,nodesSelectionActive:!1});const U=Yo(N,m.current),O=I.startX??0,S=I.startY??0,$={...I,x:U.x<O?U.x:O,y:U.y<S?U.y:S,width:Math.abs(U.x-O),height:Math.abs(U.y-S)},j=B(),W=Lv(A,$,R,e===Di.Partial,!0,F),Y=Fv(W,M).map(q=>q.id),G=W.map(q=>q.id);if(_.current!==G.length){_.current=G.length;const q=_s(j,G);q.length&&(z==null||z(q))}if(g.current!==Y.length){g.current=Y.length;const q=_s(M,Y);q.length&&(D==null||D(q))}p.setState({userSelectionRect:$})}:c,onMouseUp:E?N=>{if(N.button!==0)return;const{userSelectionRect:I}=p.getState();!b&&I&&N.target===f.current&&(C==null||C(N)),p.setState({nodesSelectionActive:_.current>0}),v(),r==null||r(N)}:void 0,onMouseLeave:E?N=>{b&&(p.setState({nodesSelectionActive:_.current>0}),r==null||r(N)),v()}:d,ref:f,style:Jh},h,K.createElement(VR,null))});function h2(t,e){const n=t.parentNode||t.parentId;if(!n)return!1;const o=e.get(n);return!!o&&(!!o.selected||h2(o,e))}function f2(t,e,n){let o=t;do{if(o!=null&&o.matches(e))return!0;if(o===n.current)return!1;o=o.parentElement}while(o);return!1}function HR(t,e,n,o){return Array.from(t.values()).filter(r=>(r.selected||r.id===o)&&(!r.parentNode||r.parentId||!h2(r,t))&&(r.draggable||e&&r.draggable===void 0)).map(r=>{var s,i;return{id:r.id,position:r.position||{x:0,y:0},positionAbsolute:r.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((s=r.positionAbsolute)==null?void 0:s.x)??0),y:n.y-(((i=r.positionAbsolute)==null?void 0:i.y)??0)},delta:{x:0,y:0},extent:r.extent,parentNode:r.parentNode||r.parentId,parentId:r.parentNode||r.parentId,width:r.width,height:r.height,expandParent:r.expandParent}})}function p2(t,e,n,o,r=[0,0],s){const i=function(h,f){return f&&f!=="parent"?[f[0],[f[1][0]-(h.width||0),f[1][1]-(h.height||0)]]:f}(t,t.extent||o);let a=i;const l=t.parentNode||t.parentId;if(t.extent!=="parent"||t.expandParent){if(t.extent&&l&&t.extent!=="parent"){const h=n.get(l),{x:f,y:p}=fs(h,r).positionAbsolute;a=[[t.extent[0][0]+f,t.extent[0][1]+p],[t.extent[1][0]+f,t.extent[1][1]+p]]}}else if(l&&t.width&&t.height){const h=n.get(l),{x:f,y:p}=fs(h,r).positionAbsolute;a=h&&On(f)&&On(p)&&On(h.width)&&On(h.height)?[[f+t.width*r[0],p+t.height*r[1]],[f+h.width-t.width+t.width*r[0],p+h.height-t.height+t.height*r[1]]]:a}else s==null||s("005",cR()),a=i;let c={x:0,y:0};if(l){const h=n.get(l);c=fs(h,r).positionAbsolute}const d=a&&a!=="parent"?Th(e,a):e;return{position:{x:d.x-c.x,y:d.y-c.y},positionAbsolute:d}}function Xh({nodeId:t,dragItems:e,nodeInternals:n}){const o=e.map(r=>({...n.get(r.id),position:r.position,positionAbsolute:r.positionAbsolute}));return[t?o.find(r=>r.id===t):o[0],o]}u2.displayName="Pane";const m2=(t,e,n,o)=>{const r=e.querySelectorAll(t);if(!r||!r.length)return null;const s=Array.from(r),i=e.getBoundingClientRect(),a=i.width*o[0],l=i.height*o[1];return s.map(c=>{const d=c.getBoundingClientRect();return{id:c.getAttribute("data-handleid"),position:c.getAttribute("data-handlepos"),x:(d.left-i.left-a)/n,y:(d.top-i.top-l)/n,...Ah(c)}})};function Fi(t,e,n){return n===void 0?n:o=>{const r=e().nodeInternals.get(t);r&&n(o,{...r})}}function Zh({id:t,store:e,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:s,multiSelectionActive:i,nodeInternals:a,onError:l}=e.getState(),c=a.get(t);c?(e.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&i)&&(s({nodes:[c],edges:[]}),requestAnimationFrame(()=>{var d;return(d=o==null?void 0:o.current)==null?void 0:d.blur()})):r([t])):l==null||l("012",pR(t))}function Qh(t){return(e,n,o)=>t==null?void 0:t(e,o)}function g2({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:s,selectNodesOnDrag:i}){const a=Vt(),[l,c]=T.useState(!1),d=T.useRef([]),h=T.useRef({x:null,y:null}),f=T.useRef(0),p=T.useRef(null),_=T.useRef({x:0,y:0}),g=T.useRef(null),m=T.useRef(!1),b=T.useRef(!1),y=T.useRef(!1),x=function(){const v=Vt();return T.useCallback(({sourceEvent:k})=>{const{transform:E,snapGrid:N,snapToGrid:I}=v.getState(),A=k.touches?k.touches[0].clientX:k.clientX,M=k.touches?k.touches[0].clientY:k.clientY,R={x:(A-E[0])/E[2],y:(M-E[1])/E[2]};return{xSnapped:I?N[0]*Math.round(R.x/N[0]):R.x,ySnapped:I?N[1]*Math.round(R.y/N[1]):R.y,...R}},[])}();return T.useEffect(()=>{if(t!=null&&t.current){const v=Kn(t.current),C=({x:N,y:I})=>{const{nodeInternals:A,onNodeDrag:M,onSelectionDrag:R,updateNodePositions:z,nodeExtent:D,snapGrid:F,snapToGrid:B,nodeOrigin:U,onError:O}=a.getState();h.current={x:N,y:I};let S=!1,$={x:0,y:0,x2:0,y2:0};if(d.current.length>1&&D){const W=$h(d.current,U);$=Mh(W)}if(d.current=d.current.map(W=>{const Y={x:N-W.distance.x,y:I-W.distance.y};B&&(Y.x=F[0]*Math.round(Y.x/F[0]),Y.y=F[1]*Math.round(Y.y/F[1]));const G=[[D[0][0],D[0][1]],[D[1][0],D[1][1]]];d.current.length>1&&D&&!W.extent&&(G[0][0]=W.positionAbsolute.x-$.x+D[0][0],G[1][0]=W.positionAbsolute.x+(W.width??0)-$.x2+D[1][0],G[0][1]=W.positionAbsolute.y-$.y+D[0][1],G[1][1]=W.positionAbsolute.y+(W.height??0)-$.y2+D[1][1]);const q=p2(W,Y,A,G,U,O);return S=S||W.position.x!==q.position.x||W.position.y!==q.position.y,W.position=q.position,W.positionAbsolute=q.positionAbsolute,W}),!S)return;z(d.current,!0,!0),c(!0);const j=r?M:Qh(R);if(j&&g.current){const[W,Y]=Xh({nodeId:r,dragItems:d.current,nodeInternals:A});j(g.current,W,Y)}},k=()=>{if(!p.current)return;const[N,I]=xv(_.current,p.current);if(N!==0||I!==0){const{transform:A,panBy:M}=a.getState();h.current.x=(h.current.x??0)-N/A[2],h.current.y=(h.current.y??0)-I/A[2],M({x:N,y:I})&&C(h.current)}f.current=requestAnimationFrame(k)},E=N=>{var U;const{nodeInternals:I,multiSelectionActive:A,nodesDraggable:M,unselectNodesAndEdges:R,onNodeDragStart:z,onSelectionDragStart:D}=a.getState();b.current=!0;const F=r?z:Qh(D);i&&s||A||!r||(U=I.get(r))!=null&&U.selected||R(),r&&s&&i&&Zh({id:r,store:a,nodeRef:t});const B=x(N);if(h.current=B,d.current=HR(I,M,B,r),F&&d.current){const[O,S]=Xh({nodeId:r,dragItems:d.current,nodeInternals:I});F(N.sourceEvent,O,S)}};if(!e){const N=function(){var I,A,M,R,z=KD,D=XD,F=ZD,B=QD,U={},O=LS("start","drag","end"),S=0,$=0;function j(Z){Z.on("mousedown.drag",W).filter(B).on("touchstart.drag",q).on("touchmove.drag",te,JD).on("touchend.drag touchcancel.drag",re).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function W(Z,ee){if(!R&&z.call(this,Z,ee)){var ue=ie(this,D.call(this,Z,ee),Z,ee,"mouse");ue&&(Kn(Z.view).on("mousemove.drag",Y,Ai).on("mouseup.drag",G,Ai),mv(Z.view),jh(Z),M=!1,I=Z.clientX,A=Z.clientY,ue("start",Z))}}function Y(Z){if(ds(Z),!M){var ee=Z.clientX-I,ue=Z.clientY-A;M=ee*ee+ue*ue>$}U.mouse("drag",Z)}function G(Z){Kn(Z.view).on("mousemove.drag mouseup.drag",null),gv(Z.view,M),ds(Z),U.mouse("end",Z)}function q(Z,ee){if(z.call(this,Z,ee)){var ue,me,de=Z.changedTouches,fe=D.call(this,Z,ee),he=de.length;for(ue=0;ue<he;++ue)(me=ie(this,fe,Z,ee,de[ue].identifier,de[ue]))&&(jh(Z),me("start",Z,de[ue]))}}function te(Z){var ee,ue,me=Z.changedTouches,de=me.length;for(ee=0;ee<de;++ee)(ue=U[me[ee].identifier])&&(ds(Z),ue("drag",Z,me[ee]))}function re(Z){var ee,ue,me=Z.changedTouches,de=me.length;for(R&&clearTimeout(R),R=setTimeout(function(){R=null},500),ee=0;ee<de;++ee)(ue=U[me[ee].identifier])&&(jh(Z),ue("end",Z,me[ee]))}function ie(Z,ee,ue,me,de,fe){var he,Ce,Ee,ae=O.copy(),Me=so(fe||ue,ee);if((Ee=F.call(Z,new Eh("beforestart",{sourceEvent:ue,target:j,identifier:de,active:S,x:Me[0],y:Me[1],dx:0,dy:0,dispatch:ae}),me))!=null)return he=Ee.x-Me[0]||0,Ce=Ee.y-Me[1]||0,function xe(Re,Ue,Je){var Ke,Pe=Me;switch(Re){case"start":U[de]=xe,Ke=S++;break;case"end":delete U[de],--S;case"drag":Me=so(Je||Ue,ee),Ke=S}ae.call(Re,Z,new Eh(Re,{sourceEvent:Ue,subject:Ee,target:j,identifier:de,active:Ke,x:Me[0]+he,y:Me[1]+Ce,dx:Me[0]-Pe[0],dy:Me[1]-Pe[1],dispatch:ae}),me)}}return j.filter=function(Z){return arguments.length?(z=typeof Z=="function"?Z:Ml(!!Z),j):z},j.container=function(Z){return arguments.length?(D=typeof Z=="function"?Z:Ml(Z),j):D},j.subject=function(Z){return arguments.length?(F=typeof Z=="function"?Z:Ml(Z),j):F},j.touchable=function(Z){return arguments.length?(B=typeof Z=="function"?Z:Ml(!!Z),j):B},j.on=function(){var Z=O.on.apply(O,arguments);return Z===O?j:Z},j.clickDistance=function(Z){return arguments.length?($=(Z=+Z)*Z,j):Math.sqrt($)},j}().on("start",I=>{const{domNode:A,nodeDragThreshold:M}=a.getState();M===0&&E(I),y.current=!1;const R=x(I);h.current=R,p.current=(A==null?void 0:A.getBoundingClientRect())||null,_.current=Yo(I.sourceEvent,p.current)}).on("drag",I=>{var z,D;const A=x(I),{autoPanOnNodeDrag:M,nodeDragThreshold:R}=a.getState();if(I.sourceEvent.type==="touchmove"&&I.sourceEvent.touches.length>1&&(y.current=!0),!y.current){if(!m.current&&b.current&&M&&(m.current=!0,k()),!b.current){const F=A.xSnapped-(((z=h==null?void 0:h.current)==null?void 0:z.x)??0),B=A.ySnapped-(((D=h==null?void 0:h.current)==null?void 0:D.y)??0);Math.sqrt(F*F+B*B)>R&&E(I)}(h.current.x!==A.xSnapped||h.current.y!==A.ySnapped)&&d.current&&b.current&&(g.current=I.sourceEvent,_.current=Yo(I.sourceEvent,p.current),C(A))}}).on("end",I=>{if(b.current&&!y.current&&(c(!1),m.current=!1,b.current=!1,cancelAnimationFrame(f.current),d.current)){const{updateNodePositions:A,nodeInternals:M,onNodeDragStop:R,onSelectionDragStop:z}=a.getState(),D=r?R:Qh(z);if(A(d.current,!1,!1),D){const[F,B]=Xh({nodeId:r,dragItems:d.current,nodeInternals:M});D(I.sourceEvent,F,B)}}}).filter(I=>{const A=I.target;return!I.button&&(!n||!f2(A,`.${n}`,t))&&(!o||f2(A,o,t))});return v.call(N),()=>{v.on(".drag",null)}}v.on(".drag",null)}},[t,e,n,o,s,a,r,i,x]),l}function _2(){const t=Vt();return T.useCallback(n=>{const{nodeInternals:o,nodeExtent:r,updateNodePositions:s,getNodes:i,snapToGrid:a,snapGrid:l,onError:c,nodesDraggable:d}=t.getState(),h=i().filter(y=>y.selected&&(y.draggable||d&&y.draggable===void 0)),f=a?l[0]:5,p=a?l[1]:5,_=n.isShiftPressed?4:1,g=n.x*f*_,m=n.y*p*_,b=h.map(y=>{if(y.positionAbsolute){const x={x:y.positionAbsolute.x+g,y:y.positionAbsolute.y+m};a&&(x.x=l[0]*Math.round(x.x/l[0]),x.y=l[1]*Math.round(x.y/l[1]));const{positionAbsolute:v,position:C}=p2(y,x,o,r,void 0,c);y.position=C,y.positionAbsolute=v}return y});s(b,!0,!1)},[])}const bs={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var zi=t=>{const e=({id:n,type:o,data:r,xPos:s,yPos:i,xPosOrigin:a,yPosOrigin:l,selected:c,onClick:d,onMouseEnter:h,onMouseMove:f,onMouseLeave:p,onContextMenu:_,onDoubleClick:g,style:m,className:b,isDraggable:y,isSelectable:x,isConnectable:v,isFocusable:C,selectNodesOnDrag:k,sourcePosition:E,targetPosition:N,hidden:I,resizeObserver:A,dragHandle:M,zIndex:R,isParent:z,noDragClassName:D,noPanClassName:F,initialized:B,disableKeyboardA11y:U,ariaLabel:O,rfId:S,hasHandleBounds:$})=>{const j=Vt(),W=T.useRef(null),Y=T.useRef(null),G=T.useRef(E),q=T.useRef(N),te=T.useRef(o),re=x||y||d||h||f||p,ie=_2(),Z=Fi(n,j.getState,h),ee=Fi(n,j.getState,f),ue=Fi(n,j.getState,p),me=Fi(n,j.getState,_),de=Fi(n,j.getState,g);T.useEffect(()=>()=>{Y.current&&(A==null||A.unobserve(Y.current),Y.current=null)},[]),T.useEffect(()=>{if(W.current&&!I){const he=W.current;B&&$&&Y.current===he||(Y.current&&(A==null||A.unobserve(Y.current)),A==null||A.observe(he),Y.current=he)}},[I,B,$]),T.useEffect(()=>{const he=te.current!==o,Ce=G.current!==E,Ee=q.current!==N;W.current&&(he||Ce||Ee)&&(he&&(te.current=o),Ce&&(G.current=E),Ee&&(q.current=N),j.getState().updateNodeDimensions([{id:n,nodeElement:W.current,forceUpdate:!0}]))},[n,o,E,N]);const fe=g2({nodeRef:W,disabled:I||!y,noDragClassName:D,handleSelector:M,nodeId:n,isSelectable:x,selectNodesOnDrag:k});return I?null:K.createElement("div",{className:ln(["react-flow__node",`react-flow__node-${o}`,{[F]:y},b,{selected:c,selectable:x,parent:z,dragging:fe}]),ref:W,style:{zIndex:R,transform:`translate(${a}px,${l}px)`,pointerEvents:re?"all":"none",visibility:B?"visible":"hidden",...m},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:Z,onMouseMove:ee,onMouseLeave:ue,onContextMenu:me,onClick:he=>{const{nodeDragThreshold:Ce}=j.getState();if(x&&(!k||!y||Ce>0)&&Zh({id:n,store:j,nodeRef:W}),d){const Ee=j.getState().nodeInternals.get(n);Ee&&d(he,{...Ee})}},onDoubleClick:de,onKeyDown:C?he=>{if(!Dh(he)&&!U)if(kv.includes(he.key)&&x){const Ce=he.key==="Escape";Zh({id:n,store:j,unselect:Ce,nodeRef:W})}else y&&c&&Object.prototype.hasOwnProperty.call(bs,he.key)&&(j.setState({ariaLiveMessage:`Moved selected node ${he.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~s}, y: ${~~i}`}),ie({x:bs[he.key].x,y:bs[he.key].y,isShiftPressed:he.shiftKey}))}:void 0,tabIndex:C?0:void 0,role:C?"button":void 0,"aria-describedby":U?void 0:`${Qv}-${S}`,"aria-label":O},K.createElement(yR,{value:n},K.createElement(t,{id:n,data:r,type:o,xPos:s,yPos:i,selected:c,isConnectable:v,sourcePosition:E,targetPosition:N,dragging:fe,dragHandle:M,zIndex:R})))};return e.displayName="NodeWrapper",T.memo(e)};const WR=t=>{const e=t.getNodes().filter(n=>n.selected);return{...$h(e,t.nodeOrigin),transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`,userSelectionActive:t.userSelectionActive}};var qR=T.memo(function({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const o=Vt(),{width:r,height:s,x:i,y:a,transformString:l,userSelectionActive:c}=pt(WR,Qt),d=_2(),h=T.useRef(null);if(T.useEffect(()=>{var p;n||((p=h.current)==null||p.focus({preventScroll:!0}))},[n]),g2({nodeRef:h}),c||!r||!s)return null;const f=t?p=>{const _=o.getState().getNodes().filter(g=>g.selected);t(p,_)}:void 0;return K.createElement("div",{className:ln(["react-flow__nodesselection","react-flow__container",e]),style:{transform:l}},K.createElement("div",{ref:h,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:p=>{Object.prototype.hasOwnProperty.call(bs,p.key)&&d({x:bs[p.key].x,y:bs[p.key].y,isShiftPressed:p.shiftKey})},style:{width:r,height:s,top:a,left:i}}))});const GR=t=>t.nodesSelectionActive,b2=({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:i,deleteKeyCode:a,onMove:l,onMoveStart:c,onMoveEnd:d,selectionKeyCode:h,selectionOnDrag:f,selectionMode:p,onSelectionStart:_,onSelectionEnd:g,multiSelectionKeyCode:m,panActivationKeyCode:b,zoomActivationKeyCode:y,elementsSelectable:x,zoomOnScroll:v,zoomOnPinch:C,panOnScroll:k,panOnScrollSpeed:E,panOnScrollMode:N,zoomOnDoubleClick:I,panOnDrag:A,defaultViewport:M,translateExtent:R,minZoom:z,maxZoom:D,preventScrolling:F,onSelectionContextMenu:B,noWheelClassName:U,noPanClassName:O,disableKeyboardA11y:S})=>{const $=pt(GR),j=Pi(h),W=Pi(b),Y=W||A,G=W||k,q=j||f&&Y!==!0;return(({deleteKeyCode:te,multiSelectionKeyCode:re})=>{const ie=Vt(),{deleteElements:Z}=Li(),ee=Pi(te,FR),ue=Pi(re);T.useEffect(()=>{if(ee){const{edges:me,getNodes:de}=ie.getState(),fe=de().filter(Ce=>Ce.selected),he=me.filter(Ce=>Ce.selected);Z({nodes:fe,edges:he}),ie.setState({nodesSelectionActive:!1})}},[ee]),T.useEffect(()=>{ie.setState({multiSelectionActive:ue})},[ue])})({deleteKeyCode:a,multiSelectionKeyCode:m}),K.createElement(BR,{onMove:l,onMoveStart:c,onMoveEnd:d,onPaneContextMenu:s,elementsSelectable:x,zoomOnScroll:v,zoomOnPinch:C,panOnScroll:G,panOnScrollSpeed:E,panOnScrollMode:N,zoomOnDoubleClick:I,panOnDrag:!j&&Y,defaultViewport:M,translateExtent:R,minZoom:z,maxZoom:D,zoomActivationKeyCode:y,preventScrolling:F,noWheelClassName:U,noPanClassName:O},K.createElement(u2,{onSelectionStart:_,onSelectionEnd:g,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:i,panOnDrag:Y,isSelecting:!!q,selectionMode:p},t,$&&K.createElement(qR,{onSelectionContextMenu:B,noPanClassName:O,disableKeyboardA11y:S})))};b2.displayName="FlowRenderer";var YR=T.memo(b2);function JR(t){return{input:zi(t.input||Yv),default:zi(t.default||qh),output:zi(t.output||Kv),group:zi(t.group||Gh),...Object.keys(t).filter(e=>!["input","default","output","group"].includes(e)).reduce((e,n)=>(e[n]=zi(t[n]||qh),e),{})}}const KR=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,updateNodeDimensions:t.updateNodeDimensions,onError:t.onError}),y2=t=>{const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,updateNodeDimensions:s,onError:i}=pt(KR,Qt),a=(l=t.onlyRenderVisibleElements,pt(T.useCallback(h=>l?Lv(h.nodeInternals,{x:0,y:0,width:h.width,height:h.height},h.transform,!0):h.getNodes(),[l])));var l;const c=T.useRef(),d=T.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const h=new ResizeObserver(f=>{const p=f.map(_=>({id:_.target.getAttribute("data-id"),nodeElement:_.target,forceUpdate:!0}));s(p)});return c.current=h,h},[]);return T.useEffect(()=>()=>{var h;(h=c==null?void 0:c.current)==null||h.disconnect()},[]),K.createElement("div",{className:"react-flow__nodes",style:Jh},a.map(h=>{var k,E,N;let f=h.type||"default";t.nodeTypes[f]||(i==null||i("003",aR(f)),f="default");const p=t.nodeTypes[f]||t.nodeTypes.default,_=!!(h.draggable||e&&h.draggable===void 0),g=!!(h.selectable||r&&h.selectable===void 0),m=!!(h.connectable||n&&h.connectable===void 0),b=!!(h.focusable||o&&h.focusable===void 0),y=t.nodeExtent?Th(h.positionAbsolute,t.nodeExtent):h.positionAbsolute,x=(y==null?void 0:y.x)??0,v=(y==null?void 0:y.y)??0,C=(({x:I,y:A,width:M,height:R,origin:z})=>M&&R?z[0]<0||z[1]<0||z[0]>1||z[1]>1?{x:I,y:A}:{x:I-M*z[0],y:A-R*z[1]}:{x:I,y:A})({x,y:v,width:h.width??0,height:h.height??0,origin:t.nodeOrigin});return K.createElement(p,{key:h.id,id:h.id,className:h.className,style:h.style,type:f,data:h.data,sourcePosition:h.sourcePosition||ze.Bottom,targetPosition:h.targetPosition||ze.Top,hidden:h.hidden,xPos:x,yPos:v,xPosOrigin:C.x,yPosOrigin:C.y,selectNodesOnDrag:t.selectNodesOnDrag,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,selected:!!h.selected,isDraggable:_,isSelectable:g,isConnectable:m,isFocusable:b,resizeObserver:d,dragHandle:h.dragHandle,zIndex:((k=h[vt])==null?void 0:k.z)??0,isParent:!!((E=h[vt])!=null&&E.isParent),noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,initialized:!!h.width&&!!h.height,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,ariaLabel:h.ariaLabel,hasHandleBounds:!!((N=h[vt])!=null&&N.handleBounds)})}))};y2.displayName="NodeRenderer";var XR=T.memo(y2);const ZR=(t,e,n)=>n===ze.Left?t-e:n===ze.Right?t+e:t,QR=(t,e,n)=>n===ze.Top?t-e:n===ze.Bottom?t+e:t,x2="react-flow__edgeupdater",w2=({position:t,centerX:e,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:s,onMouseOut:i,type:a})=>K.createElement("circle",{onMouseDown:r,onMouseEnter:s,onMouseOut:i,className:ln([x2,`${x2}-${a}`]),cx:ZR(e,o,t),cy:QR(n,o,t),r:o,stroke:"transparent",fill:"transparent"}),eP=()=>!0;var ys=t=>{const e=({id:n,className:o,type:r,data:s,onClick:i,onEdgeDoubleClick:a,selected:l,animated:c,label:d,labelStyle:h,labelShowBg:f,labelBgStyle:p,labelBgPadding:_,labelBgBorderRadius:g,style:m,source:b,target:y,sourceX:x,sourceY:v,targetX:C,targetY:k,sourcePosition:E,targetPosition:N,elementsSelectable:I,hidden:A,sourceHandleId:M,targetHandleId:R,onContextMenu:z,onMouseEnter:D,onMouseMove:F,onMouseLeave:B,reconnectRadius:U,onReconnect:O,onReconnectStart:S,onReconnectEnd:$,markerEnd:j,markerStart:W,rfId:Y,ariaLabel:G,isFocusable:q,isReconnectable:te,pathOptions:re,interactionWidth:ie,disableKeyboardA11y:Z})=>{const ee=T.useRef(null),[ue,me]=T.useState(!1),[de,fe]=T.useState(!1),he=Vt(),Ce=T.useMemo(()=>`url('#${Uh(W,Y)}')`,[W,Y]),Ee=T.useMemo(()=>`url('#${Uh(j,Y)}')`,[j,Y]);if(A)return null;const ae=Oi(n,he.getState,a),Me=Oi(n,he.getState,z),xe=Oi(n,he.getState,D),Re=Oi(n,he.getState,F),Ue=Oi(n,he.getState,B),Je=(et,nt)=>{if(et.button!==0)return;const{edges:ne,isValidConnection:ve}=he.getState(),Se=nt?y:b,De=(nt?R:M)||null,J=nt?"target":"source",ge=ve||eP,_e=nt,pe=ne.find(le=>le.id===n);fe(!0),S==null||S(et,pe,J),$v({event:et,handleId:De,nodeId:Se,onConnect:le=>O==null?void 0:O(pe,le),isTarget:_e,getState:he.getState,setState:he.setState,isValidConnection:ge,edgeUpdaterType:J,onReconnectEnd:le=>{fe(!1),$==null||$(le,pe,J)}})},Ke=()=>me(!0),Pe=()=>me(!1),st=!I&&!i;return K.createElement("g",{className:ln(["react-flow__edge",`react-flow__edge-${r}`,o,{selected:l,animated:c,inactive:st,updating:ue}]),onClick:et=>{var J;const{edges:nt,addSelectedEdges:ne,unselectNodesAndEdges:ve,multiSelectionActive:Se}=he.getState(),De=nt.find(ge=>ge.id===n);De&&(I&&(he.setState({nodesSelectionActive:!1}),De.selected&&Se?(ve({nodes:[],edges:[De]}),(J=ee.current)==null||J.blur()):ne([n])),i&&i(et,De))},onDoubleClick:ae,onContextMenu:Me,onMouseEnter:xe,onMouseMove:Re,onMouseLeave:Ue,onKeyDown:q?et=>{var nt;if(!Z&&kv.includes(et.key)&&I){const{unselectNodesAndEdges:ne,addSelectedEdges:ve,edges:Se}=he.getState();et.key==="Escape"?((nt=ee.current)==null||nt.blur(),ne({edges:[Se.find(De=>De.id===n)]})):ve([n])}}:void 0,tabIndex:q?0:void 0,role:q?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":G===null?void 0:G||`Edge from ${b} to ${y}`,"aria-describedby":q?`${e2}-${Y}`:void 0,ref:ee},!de&&K.createElement(t,{id:n,source:b,target:y,selected:l,animated:c,label:d,labelStyle:h,labelShowBg:f,labelBgStyle:p,labelBgPadding:_,labelBgBorderRadius:g,data:s,style:m,sourceX:x,sourceY:v,targetX:C,targetY:k,sourcePosition:E,targetPosition:N,sourceHandleId:M,targetHandleId:R,markerStart:Ce,markerEnd:Ee,pathOptions:re,interactionWidth:ie}),te&&K.createElement(K.Fragment,null,(te==="source"||te===!0)&&K.createElement(w2,{position:E,centerX:x,centerY:v,radius:U,onMouseDown:et=>Je(et,!0),onMouseEnter:Ke,onMouseOut:Pe,type:"source"}),(te==="target"||te===!0)&&K.createElement(w2,{position:N,centerX:C,centerY:k,radius:U,onMouseDown:et=>Je(et,!1),onMouseEnter:Ke,onMouseOut:Pe,type:"target"})))};return e.displayName="EdgeWrapper",T.memo(e)};function tP(t){return{default:ys(t.default||Bl),straight:ys(t.bezier||zh),step:ys(t.step||Fh),smoothstep:ys(t.step||Fl),simplebezier:ys(t.simplebezier||Ph),...Object.keys(t).filter(e=>!["default","bezier"].includes(e)).reduce((e,n)=>(e[n]=ys(t[n]||Bl),e),{})}}function v2(t,e,n=null){const o=((n==null?void 0:n.x)||0)+e.x,r=((n==null?void 0:n.y)||0)+e.y,s=(n==null?void 0:n.width)||e.width,i=(n==null?void 0:n.height)||e.height;switch(t){case ze.Top:return{x:o+s/2,y:r};case ze.Right:return{x:o+s,y:r+i/2};case ze.Bottom:return{x:o+s/2,y:r+i};case ze.Left:return{x:o,y:r+i/2}}}function k2(t,e){return t?t.length!==1&&e?e&&t.find(n=>n.id===e)||null:t[0]:null}function S2(t){var o,r,s,i,a;const e=((o=t==null?void 0:t[vt])==null?void 0:o.handleBounds)||null,n=e&&(t==null?void 0:t.width)&&(t==null?void 0:t.height)&&((r=t==null?void 0:t.positionAbsolute)==null?void 0:r.x)!==void 0&&((s=t==null?void 0:t.positionAbsolute)==null?void 0:s.y)!==void 0;return[{x:((i=t==null?void 0:t.positionAbsolute)==null?void 0:i.x)||0,y:((a=t==null?void 0:t.positionAbsolute)==null?void 0:a.y)||0,width:(t==null?void 0:t.width)||0,height:(t==null?void 0:t.height)||0},e,!!n]}const nP=[{level:0,isMaxLevel:!0,edges:[]}];function oP(t,e,n){return function(o,r,s=!1){let i=-1;const a=o.reduce((c,d)=>{var p,_;const h=On(d.zIndex);let f=h?d.zIndex:0;if(s){const g=r.get(d.target),m=r.get(d.source),b=d.selected||(g==null?void 0:g.selected)||(m==null?void 0:m.selected),y=Math.max(((p=m==null?void 0:m[vt])==null?void 0:p.z)||0,((_=g==null?void 0:g[vt])==null?void 0:_.z)||0,1e3);f=(h?d.zIndex:0)+(b?y:0)}return c[f]?c[f].push(d):c[f]=[d],i=f>i?f:i,c},{}),l=Object.entries(a).map(([c,d])=>{const h=+c;return{edges:d,level:h,isMaxLevel:h===i}});return l.length===0?nP:l}(pt(T.useCallback(o=>t?o.edges.filter(r=>{const s=e.get(r.source),i=e.get(r.target);return(s==null?void 0:s.width)&&(s==null?void 0:s.height)&&(i==null?void 0:i.width)&&(i==null?void 0:i.height)&&function({sourcePos:a,targetPos:l,sourceWidth:c,sourceHeight:d,targetWidth:h,targetHeight:f,width:p,height:_,transform:g}){const m={x:Math.min(a.x,l.x),y:Math.min(a.y,l.y),x2:Math.max(a.x+c,l.x+h),y2:Math.max(a.y+d,l.y+f)};m.x===m.x2&&(m.x2+=1),m.y===m.y2&&(m.y2+=1);const b=Mh({x:(0-g[0])/g[2],y:(0-g[1])/g[2],width:p/g[2],height:_/g[2]}),y=Math.max(0,Math.min(b.x2,m.x2)-Math.max(b.x,m.x)),x=Math.max(0,Math.min(b.y2,m.y2)-Math.max(b.y,m.y));return Math.ceil(y*x)>0}({sourcePos:s.positionAbsolute||{x:0,y:0},targetPos:i.positionAbsolute||{x:0,y:0},sourceWidth:s.width,sourceHeight:s.height,targetWidth:i.width,targetHeight:i.height,width:o.width,height:o.height,transform:o.transform})}):o.edges,[t,e])),e,n)}const C2={[hs.Arrow]:({color:t="none",strokeWidth:e=1})=>K.createElement("polyline",{style:{stroke:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),[hs.ArrowClosed]:({color:t="none",strokeWidth:e=1})=>K.createElement("polyline",{style:{stroke:t,fill:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},rP=({id:t,type:e,color:n,width:o=12.5,height:r=12.5,markerUnits:s="strokeWidth",strokeWidth:i,orient:a="auto-start-reverse"})=>{const l=function(c){const d=Vt();return T.useMemo(()=>{var h,f;return Object.prototype.hasOwnProperty.call(C2,c)?C2[c]:((f=(h=d.getState()).onError)==null||f.call(h,"009",dR(c)),null)},[c])}(e);return l?K.createElement("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${o}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:a,refX:"0",refY:"0"},K.createElement(l,{color:n,strokeWidth:i})):null},N2=({defaultColor:t,rfId:e})=>{const n=pt(T.useCallback((({defaultColor:o,rfId:r})=>s=>{const i=[];return s.edges.reduce((a,l)=>([l.markerStart,l.markerEnd].forEach(c=>{if(c&&typeof c=="object"){const d=Uh(c,r);i.includes(d)||(a.push({id:d,color:c.color||o,...c}),i.push(d))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))})({defaultColor:t,rfId:e}),[t,e]),(o,r)=>!(o.length!==r.length||o.some((s,i)=>s.id!==r[i].id)));return K.createElement("defs",null,n.map(o=>K.createElement(rP,{id:o.id,key:o.id,type:o.type,color:o.color,width:o.width,height:o.height,markerUnits:o.markerUnits,strokeWidth:o.strokeWidth,orient:o.orient})))};N2.displayName="MarkerDefinitions";var sP=T.memo(N2);const iP=t=>({nodesConnectable:t.nodesConnectable,edgesFocusable:t.edgesFocusable,edgesUpdatable:t.edgesUpdatable,elementsSelectable:t.elementsSelectable,width:t.width,height:t.height,connectionMode:t.connectionMode,nodeInternals:t.nodeInternals,onError:t.onError}),j2=({defaultMarkerColor:t,onlyRenderVisibleElements:e,elevateEdgesOnSelect:n,rfId:o,edgeTypes:r,noPanClassName:s,onEdgeContextMenu:i,onEdgeMouseEnter:a,onEdgeMouseMove:l,onEdgeMouseLeave:c,onEdgeClick:d,onEdgeDoubleClick:h,onReconnect:f,onReconnectStart:p,onReconnectEnd:_,reconnectRadius:g,children:m,disableKeyboardA11y:b})=>{const{edgesFocusable:y,edgesUpdatable:x,elementsSelectable:v,width:C,height:k,connectionMode:E,nodeInternals:N,onError:I}=pt(iP,Qt),A=oP(e,N,n);return C?K.createElement(K.Fragment,null,A.map(({level:M,edges:R,isMaxLevel:z})=>K.createElement("svg",{key:M,style:{zIndex:M},width:C,height:k,className:"react-flow__edges react-flow__container"},z&&K.createElement(sP,{defaultColor:t,rfId:o}),K.createElement("g",null,R.map(D=>{const[F,B,U]=S2(N.get(D.source)),[O,S,$]=S2(N.get(D.target));if(!U||!$)return null;let j=D.type||"default";r[j]||(I==null||I("011",fR(j)),j="default");const W=r[j]||r.default,Y=E===Cr.Strict?S.target:(S.target??[]).concat(S.source??[]),G=k2(B.source,D.sourceHandle),q=k2(Y,D.targetHandle),te=(G==null?void 0:G.position)||ze.Bottom,re=(q==null?void 0:q.position)||ze.Top,ie=!!(D.focusable||y&&D.focusable===void 0),Z=D.reconnectable||D.updatable,ee=f!==void 0&&(Z||x&&Z===void 0);if(!G||!q)return I==null||I("008",uR(G,D)),null;const{sourceX:ue,sourceY:me,targetX:de,targetY:fe}=((he,Ce,Ee,ae,Me,xe)=>{const Re=v2(Ee,he,Ce),Ue=v2(xe,ae,Me);return{sourceX:Re.x,sourceY:Re.y,targetX:Ue.x,targetY:Ue.y}})(F,G,te,O,q,re);return K.createElement(W,{key:D.id,id:D.id,className:ln([D.className,s]),type:j,data:D.data,selected:!!D.selected,animated:!!D.animated,hidden:!!D.hidden,label:D.label,labelStyle:D.labelStyle,labelShowBg:D.labelShowBg,labelBgStyle:D.labelBgStyle,labelBgPadding:D.labelBgPadding,labelBgBorderRadius:D.labelBgBorderRadius,style:D.style,source:D.source,target:D.target,sourceHandleId:D.sourceHandle,targetHandleId:D.targetHandle,markerEnd:D.markerEnd,markerStart:D.markerStart,sourceX:ue,sourceY:me,targetX:de,targetY:fe,sourcePosition:te,targetPosition:re,elementsSelectable:v,onContextMenu:i,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,onClick:d,onEdgeDoubleClick:h,onReconnect:f,onReconnectStart:p,onReconnectEnd:_,reconnectRadius:g,rfId:o,ariaLabel:D.ariaLabel,isFocusable:ie,isReconnectable:ee,pathOptions:"pathOptions"in D?D.pathOptions:void 0,interactionWidth:D.interactionWidth,disableKeyboardA11y:b})})))),m):null};j2.displayName="EdgeRenderer";var aP=T.memo(j2);const lP=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function cP({children:t}){const e=pt(lP);return K.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:e}},t)}const dP={[ze.Left]:ze.Right,[ze.Right]:ze.Left,[ze.Top]:ze.Bottom,[ze.Bottom]:ze.Top},E2=({nodeId:t,handleType:e,style:n,type:o=Ko.Bezier,CustomComponent:r,connectionStatus:s})=>{var k,E,N;const{fromNode:i,handleId:a,toX:l,toY:c,connectionMode:d}=pt(T.useCallback(I=>({fromNode:I.nodeInternals.get(t),handleId:I.connectionHandleId,toX:(I.connectionPosition.x-I.transform[0])/I.transform[2],toY:(I.connectionPosition.y-I.transform[1])/I.transform[2],connectionMode:I.connectionMode}),[t]),Qt),h=(k=i==null?void 0:i[vt])==null?void 0:k.handleBounds;let f=h==null?void 0:h[e];if(d===Cr.Loose&&(f=f||(h==null?void 0:h[e==="source"?"target":"source"])),!i||!f)return null;const p=a?f.find(I=>I.id===a):f[0],_=p?p.x+p.width/2:(i.width??0)/2,g=p?p.y+p.height/2:i.height??0,m=(((E=i.positionAbsolute)==null?void 0:E.x)??0)+_,b=(((N=i.positionAbsolute)==null?void 0:N.y)??0)+g,y=p==null?void 0:p.position,x=y?dP[y]:null;if(!y||!x)return null;if(r)return K.createElement(r,{connectionLineType:o,connectionLineStyle:n,fromNode:i,fromHandle:p,fromX:m,fromY:b,toX:l,toY:c,fromPosition:y,toPosition:x,connectionStatus:s});let v="";const C={sourceX:m,sourceY:b,sourcePosition:y,targetX:l,targetY:c,targetPosition:x};return o===Ko.Bezier?[v]=Rv(C):o===Ko.Step?[v]=Lh({...C,borderRadius:0}):o===Ko.SmoothStep?[v]=Lh(C):o===Ko.SimpleBezier?[v]=Tv(C):v=`M${m},${b} ${l},${c}`,K.createElement("path",{d:v,fill:"none",className:"react-flow__connection-path",style:n})};E2.displayName="ConnectionLine";const uP=t=>({nodeId:t.connectionNodeId,handleType:t.connectionHandleType,nodesConnectable:t.nodesConnectable,connectionStatus:t.connectionStatus,width:t.width,height:t.height});function hP({containerStyle:t,style:e,type:n,component:o}){const{nodeId:r,handleType:s,nodesConnectable:i,width:a,height:l,connectionStatus:c}=pt(uP,Qt);return r&&s&&a&&i?K.createElement("svg",{style:t,width:a,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container"},K.createElement("g",{className:ln(["react-flow__connection",c])},K.createElement(E2,{nodeId:r,handleType:s,style:e,type:n,CustomComponent:o,connectionStatus:c}))):null}function I2(t,e){return T.useRef(null),Vt(),T.useMemo(()=>e(t),[t])}const A2=({nodeTypes:t,edgeTypes:e,onMove:n,onMoveStart:o,onMoveEnd:r,onInit:s,onNodeClick:i,onEdgeClick:a,onNodeDoubleClick:l,onEdgeDoubleClick:c,onNodeMouseEnter:d,onNodeMouseMove:h,onNodeMouseLeave:f,onNodeContextMenu:p,onSelectionContextMenu:_,onSelectionStart:g,onSelectionEnd:m,connectionLineType:b,connectionLineStyle:y,connectionLineComponent:x,connectionLineContainerStyle:v,selectionKeyCode:C,selectionOnDrag:k,selectionMode:E,multiSelectionKeyCode:N,panActivationKeyCode:I,zoomActivationKeyCode:A,deleteKeyCode:M,onlyRenderVisibleElements:R,elementsSelectable:z,selectNodesOnDrag:D,defaultViewport:F,translateExtent:B,minZoom:U,maxZoom:O,preventScrolling:S,defaultMarkerColor:$,zoomOnScroll:j,zoomOnPinch:W,panOnScroll:Y,panOnScrollSpeed:G,panOnScrollMode:q,zoomOnDoubleClick:te,panOnDrag:re,onPaneClick:ie,onPaneMouseEnter:Z,onPaneMouseMove:ee,onPaneMouseLeave:ue,onPaneScroll:me,onPaneContextMenu:de,onEdgeContextMenu:fe,onEdgeMouseEnter:he,onEdgeMouseMove:Ce,onEdgeMouseLeave:Ee,onReconnect:ae,onReconnectStart:Me,onReconnectEnd:xe,reconnectRadius:Re,noDragClassName:Ue,noWheelClassName:Je,noPanClassName:Ke,elevateEdgesOnSelect:Pe,disableKeyboardA11y:st,nodeOrigin:et,nodeExtent:nt,rfId:ne})=>{const ve=I2(t,JR),Se=I2(e,tP);return function(De){const J=Li(),ge=T.useRef(!1);T.useEffect(()=>{!ge.current&&J.viewportInitialized&&De&&(setTimeout(()=>De(J),1),ge.current=!0)},[De,J.viewportInitialized])}(s),K.createElement(YR,{onPaneClick:ie,onPaneMouseEnter:Z,onPaneMouseMove:ee,onPaneMouseLeave:ue,onPaneContextMenu:de,onPaneScroll:me,deleteKeyCode:M,selectionKeyCode:C,selectionOnDrag:k,selectionMode:E,onSelectionStart:g,onSelectionEnd:m,multiSelectionKeyCode:N,panActivationKeyCode:I,zoomActivationKeyCode:A,elementsSelectable:z,onMove:n,onMoveStart:o,onMoveEnd:r,zoomOnScroll:j,zoomOnPinch:W,zoomOnDoubleClick:te,panOnScroll:Y,panOnScrollSpeed:G,panOnScrollMode:q,panOnDrag:re,defaultViewport:F,translateExtent:B,minZoom:U,maxZoom:O,onSelectionContextMenu:_,preventScrolling:S,noDragClassName:Ue,noWheelClassName:Je,noPanClassName:Ke,disableKeyboardA11y:st},K.createElement(cP,null,K.createElement(aP,{edgeTypes:Se,onEdgeClick:a,onEdgeDoubleClick:c,onlyRenderVisibleElements:R,onEdgeContextMenu:fe,onEdgeMouseEnter:he,onEdgeMouseMove:Ce,onEdgeMouseLeave:Ee,onReconnect:ae,onReconnectStart:Me,onReconnectEnd:xe,reconnectRadius:Re,defaultMarkerColor:$,noPanClassName:Ke,elevateEdgesOnSelect:!!Pe,disableKeyboardA11y:st,rfId:ne},K.createElement(hP,{style:y,type:b,component:x,containerStyle:v})),K.createElement("div",{className:"react-flow__edgelabel-renderer"}),K.createElement(XR,{nodeTypes:ve,onNodeClick:i,onNodeDoubleClick:l,onNodeMouseEnter:d,onNodeMouseMove:h,onNodeMouseLeave:f,onNodeContextMenu:p,selectNodesOnDrag:D,onlyRenderVisibleElements:R,noPanClassName:Ke,noDragClassName:Ue,disableKeyboardA11y:st,nodeOrigin:et,nodeExtent:nt,rfId:ne})))};A2.displayName="GraphView";var fP=T.memo(A2);const ef=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Qo={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:ef,nodeExtent:ef,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Cr.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:(t,e)=>{},isValidConnection:void 0},pP=()=>((t,e)=>t?pv(t,e):pv)((t,e)=>({...Qo,setNodes:n=>{const{nodeInternals:o,nodeOrigin:r,elevateNodesOnSelect:s}=e();t({nodeInternals:Yh(n,o,r,s)})},getNodes:()=>Array.from(e().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:o={}}=e();t({edges:n.map(r=>({...o,...r}))})},setDefaultNodesAndEdges:(n,o)=>{const r=n!==void 0,s=o!==void 0,i=r?Yh(n,new Map,e().nodeOrigin,e().elevateNodesOnSelect):new Map;t({nodeInternals:i,edges:s?o:[],hasDefaultNodes:r,hasDefaultEdges:s})},updateNodeDimensions:n=>{const{onNodesChange:o,nodeInternals:r,fitViewOnInit:s,fitViewOnInitDone:i,fitViewOnInitOptions:a,domNode:l,nodeOrigin:c}=e(),d=l==null?void 0:l.querySelector(".react-flow__viewport");if(!d)return;const h=window.getComputedStyle(d),{m22:f}=new window.DOMMatrixReadOnly(h.transform),p=n.reduce((g,m)=>{const b=r.get(m.id);if(b!=null&&b.hidden)r.set(b.id,{...b,[vt]:{...b[vt],handleBounds:void 0}});else if(b){const y=Ah(m.nodeElement);!(!y.width||!y.height||b.width===y.width&&b.height===y.height&&!m.forceUpdate)&&(r.set(b.id,{...b,[vt]:{...b[vt],handleBounds:{source:m2(".source",m.nodeElement,f,c),target:m2(".target",m.nodeElement,f,c)}},...y}),g.push({id:b.id,type:"dimensions",dimensions:y}))}return g},[]);r2(r,c);const _=i||s&&!i&&s2(e,{initial:!0,...a});t({nodeInternals:new Map(r),fitViewOnInitDone:_}),(p==null?void 0:p.length)>0&&(o==null||o(p))},updateNodePositions:(n,o=!0,r=!1)=>{const{triggerNodeChanges:s}=e(),i=n.map(a=>{const l={id:a.id,type:"position",dragging:r};return o&&(l.positionAbsolute=a.positionAbsolute,l.position=a.position),l});s(i)},triggerNodeChanges:n=>{const{onNodesChange:o,nodeInternals:r,hasDefaultNodes:s,nodeOrigin:i,getNodes:a,elevateNodesOnSelect:l}=e();if(n!=null&&n.length){if(s){const c=Yh(d2(n,a()),r,i,l);t({nodeInternals:c})}o==null||o(n)}},addSelectedNodes:n=>{const{multiSelectionActive:o,edges:r,getNodes:s}=e();let i,a=null;o?i=n.map(l=>Zo(l,!0)):(i=_s(s(),n),a=_s(r,[])),Vl({changedNodes:i,changedEdges:a,get:e,set:t})},addSelectedEdges:n=>{const{multiSelectionActive:o,edges:r,getNodes:s}=e();let i,a=null;o?i=n.map(l=>Zo(l,!0)):(i=_s(r,n),a=_s(s(),[])),Vl({changedNodes:a,changedEdges:i,get:e,set:t})},unselectNodesAndEdges:({nodes:n,edges:o}={})=>{const{edges:r,getNodes:s}=e(),i=o||r;Vl({changedNodes:(n||s()).map(a=>(a.selected=!1,Zo(a.id,!1))),changedEdges:i.map(a=>Zo(a.id,!1)),get:e,set:t})},setMinZoom:n=>{const{d3Zoom:o,maxZoom:r}=e();o==null||o.scaleExtent([n,r]),t({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:o,minZoom:r}=e();o==null||o.scaleExtent([r,n]),t({maxZoom:n})},setTranslateExtent:n=>{var o;(o=e().d3Zoom)==null||o.translateExtent(n),t({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:o}=e();Vl({changedNodes:o().filter(r=>r.selected).map(r=>Zo(r.id,!1)),changedEdges:n.filter(r=>r.selected).map(r=>Zo(r.id,!1)),get:e,set:t})},setNodeExtent:n=>{const{nodeInternals:o}=e();o.forEach(r=>{r.positionAbsolute=Th(r.position,n)}),t({nodeExtent:n,nodeInternals:new Map(o)})},panBy:n=>{const{transform:o,width:r,height:s,d3Zoom:i,d3Selection:a,translateExtent:l}=e();if(!i||!a||!n.x&&!n.y)return!1;const c=ur.translate(o[0]+n.x,o[1]+n.y).scale(o[2]),d=[[0,0],[r,s]],h=i==null?void 0:i.constrain()(c,d,l);return i.transform(a,h),o[0]!==h.x||o[1]!==h.y||o[2]!==h.k},cancelConnection:()=>t({connectionNodeId:Qo.connectionNodeId,connectionHandleId:Qo.connectionHandleId,connectionHandleType:Qo.connectionHandleType,connectionStatus:Qo.connectionStatus,connectionStartHandle:Qo.connectionStartHandle,connectionEndHandle:Qo.connectionEndHandle}),reset:()=>t({...Qo})}),Object.is),tf=({children:t})=>{const e=T.useRef(null);return e.current||(e.current=pP()),K.createElement(iR,{value:e.current},t)};tf.displayName="ReactFlowProvider";const T2=({children:t})=>T.useContext(Dl)?K.createElement(K.Fragment,null,t):K.createElement(tf,null,t);T2.displayName="ReactFlowWrapper";const mP={input:Yv,default:qh,output:Kv,group:Gh},gP={default:Bl,straight:zh,step:Fh,smoothstep:Fl,simplebezier:Ph},_P=[0,0],bP=[15,15],yP={x:0,y:0,zoom:1},xP={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},nf=T.forwardRef(({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:s=mP,edgeTypes:i=gP,onNodeClick:a,onEdgeClick:l,onInit:c,onMove:d,onMoveStart:h,onMoveEnd:f,onConnect:p,onConnectStart:_,onConnectEnd:g,onClickConnectStart:m,onClickConnectEnd:b,onNodeMouseEnter:y,onNodeMouseMove:x,onNodeMouseLeave:v,onNodeContextMenu:C,onNodeDoubleClick:k,onNodeDragStart:E,onNodeDrag:N,onNodeDragStop:I,onNodesDelete:A,onEdgesDelete:M,onSelectionChange:R,onSelectionDragStart:z,onSelectionDrag:D,onSelectionDragStop:F,onSelectionContextMenu:B,onSelectionStart:U,onSelectionEnd:O,connectionMode:S=Cr.Strict,connectionLineType:$=Ko.Bezier,connectionLineStyle:j,connectionLineComponent:W,connectionLineContainerStyle:Y,deleteKeyCode:G="Backspace",selectionKeyCode:q="Shift",selectionOnDrag:te=!1,selectionMode:re=Di.Full,panActivationKeyCode:ie="Space",multiSelectionKeyCode:Z=Pl()?"Meta":"Control",zoomActivationKeyCode:ee=Pl()?"Meta":"Control",snapToGrid:ue=!1,snapGrid:me=bP,onlyRenderVisibleElements:de=!1,selectNodesOnDrag:fe=!0,nodesDraggable:he,nodesConnectable:Ce,nodesFocusable:Ee,nodeOrigin:ae=_P,edgesFocusable:Me,edgesUpdatable:xe,elementsSelectable:Re,defaultViewport:Ue=yP,minZoom:Je=.5,maxZoom:Ke=2,translateExtent:Pe=ef,preventScrolling:st=!0,nodeExtent:et,defaultMarkerColor:nt="#b1b1b7",zoomOnScroll:ne=!0,zoomOnPinch:ve=!0,panOnScroll:Se=!1,panOnScrollSpeed:De=.5,panOnScrollMode:J=Jo.Free,zoomOnDoubleClick:ge=!0,panOnDrag:_e=!0,onPaneClick:pe,onPaneMouseEnter:le,onPaneMouseMove:He,onPaneMouseLeave:Fe,onPaneScroll:Ze,onPaneContextMenu:se,children:Ne,onEdgeContextMenu:Ie,onEdgeDoubleClick:Ve,onEdgeMouseEnter:Ye,onEdgeMouseMove:Le,onEdgeMouseLeave:qe,onEdgeUpdate:it,onEdgeUpdateStart:ot,onEdgeUpdateEnd:at,onReconnect:Dt,onReconnectStart:Lt,onReconnectEnd:en,reconnectRadius:$t=10,edgeUpdaterRadius:Gn=10,onNodesChange:ws,onEdgesChange:io,noDragClassName:Oo="nodrag",noWheelClassName:Rn="nowheel",noPanClassName:vs="nopan",fitView:Ui=!1,fitViewOptions:VF,connectOnClick:$F=!0,attributionPosition:HF,proOptions:WF,defaultEdgeOptions:qF,elevateNodesOnSelect:GF=!0,elevateEdgesOnSelect:YF=!1,disableKeyboardA11y:v3=!1,autoPanOnConnect:JF=!0,autoPanOnNodeDrag:KF=!0,connectionRadius:XF=20,isValidConnection:ZF,onError:QF,style:ez,id:k3,nodeDragThreshold:tz,...nz},oz)=>{const Yf=k3||"1";return K.createElement("div",{...nz,style:{...ez,...xP},ref:oz,className:ln(["react-flow",r]),"data-testid":"rf__wrapper",id:k3},K.createElement(T2,null,K.createElement(fP,{onInit:c,onMove:d,onMoveStart:h,onMoveEnd:f,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:y,onNodeMouseMove:x,onNodeMouseLeave:v,onNodeContextMenu:C,onNodeDoubleClick:k,nodeTypes:s,edgeTypes:i,connectionLineType:$,connectionLineStyle:j,connectionLineComponent:W,connectionLineContainerStyle:Y,selectionKeyCode:q,selectionOnDrag:te,selectionMode:re,deleteKeyCode:G,multiSelectionKeyCode:Z,panActivationKeyCode:ie,zoomActivationKeyCode:ee,onlyRenderVisibleElements:de,selectNodesOnDrag:fe,defaultViewport:Ue,translateExtent:Pe,minZoom:Je,maxZoom:Ke,preventScrolling:st,zoomOnScroll:ne,zoomOnPinch:ve,zoomOnDoubleClick:ge,panOnScroll:Se,panOnScrollSpeed:De,panOnScrollMode:J,panOnDrag:_e,onPaneClick:pe,onPaneMouseEnter:le,onPaneMouseMove:He,onPaneMouseLeave:Fe,onPaneScroll:Ze,onPaneContextMenu:se,onSelectionContextMenu:B,onSelectionStart:U,onSelectionEnd:O,onEdgeContextMenu:Ie,onEdgeDoubleClick:Ve,onEdgeMouseEnter:Ye,onEdgeMouseMove:Le,onEdgeMouseLeave:qe,onReconnect:Dt??it,onReconnectStart:Lt??ot,onReconnectEnd:en??at,reconnectRadius:$t??Gn,defaultMarkerColor:nt,noDragClassName:Oo,noWheelClassName:Rn,noPanClassName:vs,elevateEdgesOnSelect:YF,rfId:Yf,disableKeyboardA11y:v3,nodeOrigin:ae,nodeExtent:et}),K.createElement(IR,{nodes:t,edges:e,defaultNodes:n,defaultEdges:o,onConnect:p,onConnectStart:_,onConnectEnd:g,onClickConnectStart:m,onClickConnectEnd:b,nodesDraggable:he,nodesConnectable:Ce,nodesFocusable:Ee,edgesFocusable:Me,edgesUpdatable:xe,elementsSelectable:Re,elevateNodesOnSelect:GF,minZoom:Je,maxZoom:Ke,nodeExtent:et,onNodesChange:ws,onEdgesChange:io,snapToGrid:ue,snapGrid:me,connectionMode:S,translateExtent:Pe,connectOnClick:$F,defaultEdgeOptions:qF,fitView:Ui,fitViewOptions:VF,onNodesDelete:A,onEdgesDelete:M,onNodeDragStart:E,onNodeDrag:N,onNodeDragStop:I,onSelectionDrag:D,onSelectionDragStart:z,onSelectionDragStop:F,noPanClassName:vs,nodeOrigin:ae,rfId:Yf,autoPanOnConnect:JF,autoPanOnNodeDrag:KF,onError:QF,connectionRadius:XF,isValidConnection:ZF,nodeDragThreshold:tz}),K.createElement(jR,{onSelectionChange:R}),Ne,K.createElement(gR,{proOptions:WF,position:HF}),K.createElement(OR,{rfId:Yf,disableKeyboardA11y:v3})))});function M2(t){return e=>{const[n,o]=T.useState(e),r=T.useCallback(s=>o(i=>t(s,i)),[]);return[n,o,r]}}nf.displayName="ReactFlow";const O2=M2(d2),D2=M2(function(t,e){return c2(t,e)});function wP(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},K.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function vP(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},K.createElement("path",{d:"M0 0h32v4.2H0z"}))}function kP(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},K.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function SP(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},K.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function CP(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},K.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const xs=({children:t,className:e,...n})=>K.createElement("button",{type:"button",className:ln(["react-flow__controls-button",e]),...n},t);xs.displayName="ControlButton";const NP=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom}),R2=({style:t,showZoom:e=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:s,onZoomOut:i,onFitView:a,onInteractiveChange:l,className:c,children:d,position:h="bottom-left"})=>{const f=Vt(),[p,_]=T.useState(!1),{isInteractive:g,minZoomReached:m,maxZoomReached:b}=pt(NP,Qt),{zoomIn:y,zoomOut:x,fitView:v}=Li();return T.useEffect(()=>{_(!0)},[]),p?K.createElement(Rl,{className:ln(["react-flow__controls",c]),position:h,style:t,"data-testid":"rf__controls"},e&&K.createElement(K.Fragment,null,K.createElement(xs,{onClick:()=>{y(),s==null||s()},className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:b},K.createElement(wP,null)),K.createElement(xs,{onClick:()=>{x(),i==null||i()},className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:m},K.createElement(vP,null))),n&&K.createElement(xs,{className:"react-flow__controls-fitview",onClick:()=>{v(r),a==null||a()},title:"fit view","aria-label":"fit view"},K.createElement(kP,null)),o&&K.createElement(xs,{className:"react-flow__controls-interactive",onClick:()=>{f.setState({nodesDraggable:!g,nodesConnectable:!g,elementsSelectable:!g}),l==null||l(!g)},title:"toggle interactivity","aria-label":"toggle interactivity"},g?K.createElement(CP,null):K.createElement(SP,null)),d):null};R2.displayName="Controls";var Dn,jP=T.memo(R2);function EP({color:t,dimensions:e,lineWidth:n}){return K.createElement("path",{stroke:t,strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})}function IP({color:t,radius:e}){return K.createElement("circle",{cx:e,cy:e,r:e,fill:t})}(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(Dn||(Dn={}));const AP={[Dn.Dots]:"#91919a",[Dn.Lines]:"#eee",[Dn.Cross]:"#e2e2e2"},TP={[Dn.Dots]:1,[Dn.Lines]:1,[Dn.Cross]:6},MP=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function P2({id:t,variant:e=Dn.Dots,gap:n=20,size:o,lineWidth:r=1,offset:s=2,color:i,style:a,className:l}){const c=T.useRef(null),{transform:d,patternId:h}=pt(MP,Qt),f=i||AP[e],p=o||TP[e],_=e===Dn.Dots,g=e===Dn.Cross,m=Array.isArray(n)?n:[n,n],b=[m[0]*d[2]||1,m[1]*d[2]||1],y=p*d[2],x=g?[y,y]:b,v=_?[y/s,y/s]:[x[0]/s,x[1]/s];return K.createElement("svg",{className:ln(["react-flow__background",l]),style:{...a,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:c,"data-testid":"rf__background"},K.createElement("pattern",{id:h+t,x:d[0]%b[0],y:d[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${v[0]},-${v[1]})`},_?K.createElement(IP,{color:f,radius:y/s}):K.createElement(EP,{dimensions:x,color:f,lineWidth:r})),K.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${h+t})`}))}P2.displayName="Background";var OP=T.memo(P2);function of(t){return Math.min(11*t+35,200)}const L2=K.createContext("LR"),F2=T.memo(t=>{const e=X.c(51),{data:n,selected:o}=t,r=Be(n.atom),s=Rc().inOrderIds.indexOf(r.id),i=o?"var(--gray-9)":"var(--gray-3)",a=pt(DP),l=T.use(L2);let c,d,h,f,p;if(e[0]!==r.code||e[1]!==i||e[2]!==l||e[3]!==o){const M=r.code.split(`
|
142
142
|
`).length,R=l==="LR"?ze.Left:ze.Top;let z;e[8]!==i?(z={background:i},e[8]=i,e[9]=z):z=e[9],e[10]!==R||e[11]!==z?(h=u.jsx(Xo,{type:"target",id:"inputs",position:R,style:z}),e[10]=R,e[11]=z,e[12]=h):h=e[12];const D=l==="LR"?ze.Left:ze.Top;let F;e[13]!==i?(F={background:i},e[13]=i,e[14]=F):F=e[14],e[15]!==D||e[16]!==F?(f=u.jsx(Xo,{type:"source",id:"inputs",position:D,style:F}),e[15]=D,e[16]=F,e[17]=f):f=e[17];const B=o&&"border-primary";e[18]!==B?(d=je("flex flex-col bg-card border border-input/50 rounded-md mx-[2px] overflow-hidden",B),e[18]=B,e[19]=d):d=e[19],c=of(M),e[0]=r.code,e[1]=i,e[2]=l,e[3]=o,e[4]=c,e[5]=d,e[6]=h,e[7]=f}else c=e[4],d=e[5],h=e[6],f=e[7];var _;let g;e[20]!==n.forceWidth||e[21]!==a?(p=n.forceWidth||(_=a,Math.min(Math.max(_-100,100),400)),e[20]=n.forceWidth,e[21]=a,e[22]=p):p=e[22],e[23]!==c||e[24]!==p?(g={height:c,width:p},e[23]=c,e[24]=p,e[25]=g):g=e[25];const m=t$(r.name,s);let b,y,x;e[26]!==m?(b=u.jsx("div",{className:"text-muted-foreground font-semibold text-xs py-1 px-2 bg-muted border-b",children:m}),e[26]=m,e[27]=b):b=e[27],e[28]!==r.code?(y=u.jsx(FH,{code:r.code}),e[28]=r.code,e[29]=y):y=e[29],e[30]!==d||e[31]!==g||e[32]!==b||e[33]!==y?(x=u.jsxs("div",{className:d,style:g,children:[b,y]}),e[30]=d,e[31]=g,e[32]=b,e[33]=y,e[34]=x):x=e[34];const v=l==="LR"?ze.Right:ze.Bottom;let C,k;e[35]!==i?(C={background:i},e[35]=i,e[36]=C):C=e[36],e[37]!==v||e[38]!==C?(k=u.jsx(Xo,{type:"source",id:"outputs",position:v,style:C}),e[37]=v,e[38]=C,e[39]=k):k=e[39];const E=l==="LR"?ze.Right:ze.Bottom;let N,I,A;return e[40]!==i?(N={background:i},e[40]=i,e[41]=N):N=e[41],e[42]!==E||e[43]!==N?(I=u.jsx(Xo,{type:"target",id:"outputs",position:E,style:N}),e[42]=E,e[43]=N,e[44]=I):I=e[44],e[45]!==x||e[46]!==k||e[47]!==I||e[48]!==h||e[49]!==f?(A=u.jsxs("div",{children:[h,f,x,k,I]}),e[45]=x,e[46]=k,e[47]=I,e[48]=h,e[49]=f,e[50]=A):A=e[50],A},(t,e)=>["data","selected","id"].every(n=>t[n]===e[n]));F2.displayName="CustomNode";const z2={custom:F2};function DP(t){const{width:e}=t;return e}const B2=t=>{const e=X.c(18),{maxCount:n,cellIds:o,onClick:r,skipScroll:s}=t,i=Rc();let a,l,c,d;if(e[0]!==o||e[1]!==i||e[2]!==n||e[3]!==r||e[4]!==s){c=Symbol.for("react.early_return_sentinel");e:{let h;e[8]!==i?(h=(_,g)=>i.inOrderIds.indexOf(_)-i.inOrderIds.indexOf(g),e[8]=i,e[9]=h):h=e[9];const f=[...o].sort(h);if(o.length===0){let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=u.jsx("div",{className:"text-muted-foreground",children:"--"}),e[10]=_):_=e[10],c=_;break e}let p;e[11]!==o.length||e[12]!==r||e[13]!==s?(p=(_,g)=>u.jsxs("span",{className:"truncate",children:[u.jsx(cr,{variant:"focus",cellId:_,skipScroll:s,className:"whitespace-nowrap",onClick:r?()=>r(_):void 0},_),g<o.length-1&&", "]},_),e[11]=o.length,e[12]=r,e[13]=s,e[14]=p):p=e[14],a=f.slice(0,n).map(p),l=o.length>n&&u.jsxs(Dr,{children:[u.jsx(zs,{asChild:!0,children:u.jsxs("span",{className:"whitespace-nowrap text-muted-foreground text-xs hover:underline cursor-pointer",children:["+",o.length-n," more"]})}),u.jsx(Os,{className:"w-auto",children:u.jsx("div",{className:"flex flex-col gap-1 py-1",children:f.slice(n).map(_=>u.jsx(cr,{variant:"focus",cellId:_,className:"whitespace-nowrap",onClick:r?()=>r(_):void 0},_))})})]})}e[0]=o,e[1]=i,e[2]=n,e[3]=r,e[4]=s,e[5]=a,e[6]=l,e[7]=c}else a=e[5],l=e[6],c=e[7];return c!==Symbol.for("react.early_return_sentinel")?c:(e[15]!==a||e[16]!==l?(d=u.jsxs(u.Fragment,{children:[a,l]}),e[15]=a,e[16]=l,e[17]=d):d=e[17],d)},rf=t=>{const e=X.c(15);let n,o,r,s;e[0]!==t?({name:o,declaredBy:n,onClick:r,...s}=t,e[0]=t,e[1]=n,e[2]=o,e[3]=r,e[4]=s):(n=e[1],o=e[2],r=e[3],s=e[4]);const i=n.length>1?"destructive":"outline";let a,l,c;return e[5]!==o||e[6]!==r?(a=async d=>{r?r(d):(await pn(o),ut({title:"Copied to clipboard"}))},e[5]=o,e[6]=r,e[7]=a):a=e[7],e[8]!==o||e[9]!==i||e[10]!==a?(l=u.jsx(Q4,{title:o,variant:i,className:"rounded-sm text-ellipsis block overflow-hidden max-w-fit cursor-pointer font-medium",onClick:a,children:o}),e[8]=o,e[9]=i,e[10]=a,e[11]=l):l=e[11],e[12]!==s||e[13]!==l?(c=u.jsx("div",{className:"max-w-[130px]",...s,children:l}),e[12]=s,e[13]=l,e[14]=c):c=e[14],c},sf=T.memo(t=>{const e=X.c(38),{onChange:n,view:o,settings:r,onSettingsChange:s}=t;let i;e[0]!==s||e[1]!==r?(i=(D,F)=>{s({...r,[D]:F})},e[0]=s,e[1]=r,e[2]=i):i=e[2];const a=i;let l,c,d,h,f,p;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx(zs,{asChild:!0,children:u.jsx(Te,{variant:"text",size:"xs",children:u.jsx(fp,{className:"w-4 h-4"})})}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx("div",{className:"font-semibold pb-4",children:"Settings"}),e[4]=c):c=e[4],e[5]!==a?(d=D=>a("hidePureMarkdown",!!D),e[5]=a,e[6]=d):d=e[6],e[7]!==r.hidePureMarkdown||e[8]!==d?(h=u.jsx(D4,{"data-testid":"hide-pure-markdown-checkbox",id:"hide-pure-markdown",checked:r.hidePureMarkdown,onCheckedChange:d}),e[7]=r.hidePureMarkdown,e[8]=d,e[9]=h):h=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsx(Ar,{htmlFor:"hide-pure-markdown",children:"Hide pure markdown"}),e[10]=f):f=e[10],e[11]!==h?(p=u.jsxs(Dr,{children:[l,u.jsxs(Os,{className:"w-auto p-2 text-muted-foreground",children:[c,u.jsxs("div",{className:"flex items-center gap-2",children:[h,f]})]})]}),e[11]=h,e[12]=p):p=e[12];const _=p,g=o==="_minimap_";let m,b,y;e[13]!==n?(m=()=>n("_minimap_"),e[13]=n,e[14]=m):m=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(Mm,{className:"w-4 h-4 mr-1"}),e[15]=b):b=e[15],e[16]!==g||e[17]!==m?(y=u.jsxs(Te,{variant:"outline",className:"bg-background","aria-selected":g,size:"xs",onClick:m,children:[b,"Mini Map"]}),e[16]=g,e[17]=m,e[18]=y):y=e[18];const x=o==="TB";let v,C,k;e[19]!==n?(v=()=>n("TB"),e[19]=n,e[20]=v):v=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(C=u.jsx(_a,{className:"w-4 h-4 mr-1"}),e[21]=C):C=e[21],e[22]!==x||e[23]!==v?(k=u.jsxs(Te,{variant:"outline",className:"bg-background","aria-selected":x,size:"xs",onClick:v,children:[C,"Vertical Tree"]}),e[22]=x,e[23]=v,e[24]=k):k=e[24];const E=o==="LR";let N,I,A,M;e[25]!==n?(N=()=>n("LR"),e[25]=n,e[26]=N):N=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(I=u.jsx(_a,{className:"w-4 h-4 mr-1 transform -rotate-90"}),e[27]=I):I=e[27],e[28]!==E||e[29]!==N?(A=u.jsxs(Te,{variant:"outline",className:"bg-background","aria-selected":E,size:"xs",onClick:N,children:[I," ","Horizontal Tree"]}),e[28]=E,e[29]=N,e[30]=A):A=e[30],e[31]!==y||e[32]!==k||e[33]!==A?(M=u.jsxs("div",{className:"flex gap-2",children:[y,k,A]}),e[31]=y,e[32]=k,e[33]=A,e[34]=M):M=e[34];const R=o!=="_minimap_"&&_;let z;return e[35]!==M||e[36]!==R?(z=u.jsxs(Rl,{position:"top-right",className:"flex flex-col items-end gap-2",children:[M,R]}),e[35]=M,e[36]=R,e[37]=z):z=e[37],z});sf.displayName="GraphToolbar";const Hl=T.memo(t=>{const e=X.c(11),{selection:n,variables:o,onClearSelection:r}=t;if(!n)return null;const s=RP;let i;e[0]!==r||e[1]!==n.id||e[2]!==n.source||e[3]!==n.target||e[4]!==n.type||e[5]!==o?(i=()=>{if(n.type==="node"){const d=Object.values(o).filter(p=>p.usedBy.includes(n.id)),h=Object.values(o).filter(p=>p.declaredBy.includes(n.id)),f=(p,_)=>u.jsxs(u.Fragment,{children:[p.length===0&&u.jsx("div",{className:"text-muted-foreground text-sm text-center",children:"--"}),u.jsx("div",{className:"grid grid-cols-5 gap-3 items-center text-sm py-1 flex-1 empty:hidden",children:p.map(g=>u.jsxs(K.Fragment,{children:[u.jsx(rf,{declaredBy:g.declaredBy,name:g.name}),u.jsxs("div",{className:"truncate col-span-2",title:g.value??"",children:[g.value,u.jsxs("span",{className:"ml-1 truncate text-foreground/60 font-mono",children:["(",g.dataType,")"]})]}),u.jsx("div",{className:"truncate col-span-2 gap-1 items-center",children:u.jsx(B2,{skipScroll:!0,onClick:()=>s(_==="in"?g.declaredBy[0]:g.usedBy[0],g.name),maxCount:3,cellIds:g.usedBy})})]},g.name))})]});return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[u.jsx(Yl,{className:"w-5 h-5"}),u.jsx(cr,{cellId:n.id}),u.jsx("div",{className:"flex-1"}),u.jsx(f0,{cellId:n.id,children:u.jsx(Te,{variant:"ghost",size:"icon",children:u.jsx(Wc,{className:"w-4 h-4"})})}),u.jsx(Te,{variant:"text",size:"icon",onClick:()=>{r()},children:u.jsx(Jn,{className:"w-4 h-4"})})]}),u.jsxs("div",{className:"text-sm flex flex-col py-3 pl-2 pr-4 flex-1 justify-center",children:[u.jsxs("div",{className:"flex flex-col gap-2",children:[u.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[u.jsx(dn,{className:"w-4 h-4"}),"Outputs"]}),f(h,"out")]}),u.jsx("hr",{className:"border-divider my-3"}),u.jsxs("div",{className:"flex flex-col gap-2",children:[u.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[u.jsx(em,{className:"w-4 h-4"}),"Inputs"]}),f(d,"in")]})]})]})}if(n.type==="edge"){const d=Object.values(o).filter(h=>h.declaredBy.includes(n.source)&&h.usedBy.includes(n.target));return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[u.jsx(ya,{className:"w-4 h-4"}),u.jsx(cr,{cellId:n.source}),u.jsx(Vc,{className:"w-4 h-4"}),u.jsx(cr,{cellId:n.target})]}),u.jsx("div",{className:"grid grid-cols-4 gap-3 max-w-[350px] items-center text-sm p-3 flex-1",children:d.map(h=>u.jsxs(K.Fragment,{children:[u.jsx(rf,{declaredBy:h.declaredBy,name:h.name,onClick:()=>{s(h.declaredBy[0],h.name)}}),u.jsx("div",{className:"truncate text-foreground/60 font-mono",children:h.dataType}),u.jsx("div",{className:"truncate col-span-2",title:h.value??"",children:h.value})]},h.name))})]})}},e[0]=r,e[1]=n.id,e[2]=n.source,e[3]=n.target,e[4]=n.type,e[5]=o,e[6]=i):i=e[6];const a=i;let l,c;return e[7]!==a?(l=a(),e[7]=a,e[8]=l):l=e[8],e[9]!==l?(c=u.jsx(Rl,{position:"bottom-left",className:"max-h-[90%] flex flex-col w-[calc(100%-5rem)]",children:u.jsx("div",{className:"min-h-[100px] shadow-md rounded-md border max-w-[550px] border-primary/40 my-4 min-w-[240px] bg-[var(--slate-1)] text-muted-foreground/80 flex flex-col overflow-y-auto",children:l})}),e[9]=l,e[10]=c):c=e[10],c});function RP(t,e){const n=Kl(t);n&&zp(n,e)}function U2(){const t=X.c(7),e=Li(),n=pt(LP),o=pt(PP);let r;t[0]!==e?(r=()=>{e.fitView({duration:100})},t[0]=e,t[1]=r):r=t[1];const s=n$(r,100);let i,a;t[2]!==s||t[3]!==o||t[4]!==n?(i=()=>{n&&o&&s()},a=[n,o,s],t[2]=s,t[3]=o,t[4]=n,t[5]=i,t[6]=a):(i=t[5],a=t[6]),T.useEffect(i,a)}function PP(t){const{height:e}=t;return e}function LP(t){const{width:e}=t;return e}Hl.displayName="GraphSelectionPanel";const V2=new class{createEdge(t,e,n){return{type:"smoothstep",pathOptions:{offset:20,borderRadius:100},data:{direction:n},markerEnd:{type:hs.Arrow},id:`${t}-${e}-${n}`,source:t,sourceHandle:n,targetHandle:n,target:e}}createNode(t,e,n){return{id:t,data:{atom:e},width:250,type:"custom",height:of(ct.get(e).code.trim().split(`
|
143
143
|
`).length),position:{x:0,y:n+20}}}createElements(t,e,n,o){let r=0;const s=[],i=[];for(const[l,c]of Lp.zip(t,e)){const d=this.createNode(l,c,r);s.push(d),r=d.position.y+(d.height||0)}const a=new Set;for(const l of Object.values(n)){const{declaredBy:c,usedBy:d}=l;for(const h of c)for(const f of d){const p=`${h}-${f}`;a.has(p)||(a.add(p),i.push(this.createEdge(h,f,"inputs"),this.createEdge(h,f,"outputs")))}}return{nodes:s,edges:i}}},FP=t=>{const e=X.c(37),{cellIds:n,variables:o,cellAtoms:r,children:s}=t;let i;e[0]!==r||e[1]!==n||e[2]!==o?(i=V2.createElements(n,r,o,!1),e[0]=r,e[1]=n,e[2]=o,e[3]=i):i=e[3];const{nodes:a,edges:l}=i;let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=[],e[4]=c):c=e[4];const[d,h]=D2(c),[f,p]=O2(a),[_,g]=T.useState(),[m,b]=T.useState(),y=T.useRef(!1);U2();const x=pt(zP);let v;e[5]!==h||e[6]!==p?(v=S=>{p(S.nodes),h([])},e[5]=h,e[6]=p,e[7]=v):v=e[7];const C=Xe(v);let k,E,N,I;e[8]!==r||e[9]!==n||e[10]!==C||e[11]!==o?(k=()=>{y.current?C(V2.createElements(n,r,o,!1)):y.current=!0},E=[n,o,r,C],e[8]=r,e[9]=n,e[10]=C,e[11]=o,e[12]=k,e[13]=E):(k=e[12],E=e[13]),T.useEffect(k,E),e[14]!==l||e[15]!==_||e[16]!==h?(N=()=>{if(_){const S=l.filter($=>{const{source:j,target:W,data:Y}=$;return j===_&&Y.direction==="outputs"||W===_&&Y.direction==="inputs"});h(S)}},I=[_,h,l],e[14]=l,e[15]=_,e[16]=h,e[17]=N,e[18]=I):(N=e[17],I=e[18]),T.useEffect(N,I);const A=function(S,$){const j=X.c(17);let W,Y;if(j[0]!==$||j[1]!==S){let ee;j[3]!==$?(ee=(ue,me)=>{const{position:de}=me;return Math.min(ue,de.y-$/2-10)},j[3]=$,j[4]=ee):ee=j[4],Y=S.reduce(ee,Number.POSITIVE_INFINITY),j[0]=$,j[1]=S,j[2]=Y}else Y=j[2];const G=Y;let q;if(j[5]!==$||j[6]!==S){let ee;j[8]!==$?(ee=(ue,me)=>{const{position:de}=me;return Math.max(ue,de.y+$/2+10)},j[8]=$,j[9]=ee):ee=j[9],q=S.reduce(ee,Number.NEGATIVE_INFINITY),j[5]=$,j[6]=S,j[7]=q}else q=j[7];const te=q;let re,ie,Z;return j[10]!==G?(re=[Number.NEGATIVE_INFINITY,G],j[10]=G,j[11]=re):re=j[11],j[12]!==te?(ie=[Number.POSITIVE_INFINITY,te],j[12]=te,j[13]=ie):ie=j[13],j[14]!==re||j[15]!==ie?(Z=[re,ie],j[14]=re,j[15]=ie,j[16]=Z):Z=j[16],W=Z,W}(f,x);let M;e[19]===Symbol.for("react.memo_cache_sentinel")?(M=()=>{g(void 0),b(void 0)},e[19]=M):M=e[19];const R=M;let z;e[20]!==d||e[21]!==m||e[22]!==_||e[23]!==o?(z=()=>m?u.jsx(Hl,{selection:{type:"edge",source:m.source,target:m.target},onClearSelection:R,variables:o,edges:d}):_?u.jsx(Hl,{selection:{type:"node",id:_},variables:o,edges:d,onClearSelection:R}):null,e[20]=d,e[21]=m,e[22]=_,e[23]=o,e[24]=z):z=e[24];const D=z;let F,B,U,O;return e[25]!==h?(F=(S,$)=>{const j=$.id;g(j),b(void 0),h([])},e[25]=h,e[26]=F):F=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(B=(S,$)=>{b($)},e[27]=B):B=e[27],e[28]!==D?(U=D(),e[28]=D,e[29]=U):U=e[29],e[30]!==s||e[31]!==d||e[32]!==f||e[33]!==F||e[34]!==U||e[35]!==A?(O=u.jsxs(nf,{nodes:f,edges:d,nodeTypes:z2,translateExtent:A,onNodeClick:F,onNodeDoubleClick:BP,onEdgeClick:B,snapToGrid:!0,fitView:!0,elementsSelectable:!0,minZoom:1,maxZoom:1,draggable:!1,panOnScrollMode:Jo.Vertical,zoomOnDoubleClick:!1,nodesDraggable:!1,nodesConnectable:!1,nodesFocusable:!1,edgesFocusable:!1,selectNodesOnDrag:!1,panOnDrag:!1,preventScrolling:!1,zoomOnPinch:!1,panOnScroll:!0,autoPanOnNodeDrag:!1,autoPanOnConnect:!1,children:[U,s]}),e[30]=s,e[31]=d,e[32]=f,e[33]=F,e[34]=U,e[35]=A,e[36]=O):O=e[36],O};function zP(t){const{height:e}=t;return e}function BP(t,e){eS(e.id,"focus")}var af,$2,H2,W2,q2,G2,lf,Y2,cf,J2,df,K2,uf,X2,hf,Z2,ff,Q2,pf,ek,mf,tk,gf,nk,_f,ok,bf,rk,yf,sk,xf,ik,wf,ak,lk,ck,dk,uk,hk,fk,vf,pk,kf,mk,Sf,gk,Cf,_k,Nf,bk,jf,yk,Ef,xk,If,wk,Af,vk,Tf,kk,Mf,Sk,Of,Ck,Df,Nk,Rf,jk,Ek,Ik,Ak,Tk,Mk,Ok,Pf,Dk,Lf,Rk,Pk,Lk,Ff,Fk,zf,zk,Bf,Bk,Uf,Uk,Vf,Vk,$k,Hk,Wk,qk;function $f(){if($2)return af;$2=1;var t="\0";function e(s,i){s[i]?s[i]++:s[i]=1}function n(s,i){--s[i]||delete s[i]}function o(s,i,a,l){var c=""+i,d=""+a;if(!s&&c>d){var h=c;c=d,d=h}return c+""+d+""+(l===void 0?"\0":l)}function r(s,i){return o(s,i.v,i.w,i.name)}return af=class{constructor(s){Q(this,"_isDirected",!0);Q(this,"_isMultigraph",!1);Q(this,"_isCompound",!1);Q(this,"_label");Q(this,"_defaultNodeLabelFn",()=>{});Q(this,"_defaultEdgeLabelFn",()=>{});Q(this,"_nodes",{});Q(this,"_in",{});Q(this,"_preds",{});Q(this,"_out",{});Q(this,"_sucs",{});Q(this,"_edgeObjs",{});Q(this,"_edgeLabels",{});Q(this,"_nodeCount",0);Q(this,"_edgeCount",0);Q(this,"_parent");Q(this,"_children");s&&(this._isDirected=!Object.hasOwn(s,"directed")||s.directed,this._isMultigraph=!!Object.hasOwn(s,"multigraph")&&s.multigraph,this._isCompound=!!Object.hasOwn(s,"compound")&&s.compound),this._isCompound&&(this._parent={},this._children={},this._children[t]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(s){return this._label=s,this}graph(){return this._label}setDefaultNodeLabel(s){return this._defaultNodeLabelFn=s,typeof s!="function"&&(this._defaultNodeLabelFn=()=>s),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var s=this;return this.nodes().filter(i=>Object.keys(s._in[i]).length===0)}sinks(){var s=this;return this.nodes().filter(i=>Object.keys(s._out[i]).length===0)}setNodes(s,i){var a=arguments,l=this;return s.forEach(function(c){a.length>1?l.setNode(c,i):l.setNode(c)}),this}setNode(s,i){return Object.hasOwn(this._nodes,s)?(arguments.length>1&&(this._nodes[s]=i),this):(this._nodes[s]=arguments.length>1?i:this._defaultNodeLabelFn(s),this._isCompound&&(this._parent[s]=t,this._children[s]={},this._children[t][s]=!0),this._in[s]={},this._preds[s]={},this._out[s]={},this._sucs[s]={},++this._nodeCount,this)}node(s){return this._nodes[s]}hasNode(s){return Object.hasOwn(this._nodes,s)}removeNode(s){var i=this;if(Object.hasOwn(this._nodes,s)){var a=l=>i.removeEdge(i._edgeObjs[l]);delete this._nodes[s],this._isCompound&&(this._removeFromParentsChildList(s),delete this._parent[s],this.children(s).forEach(function(l){i.setParent(l)}),delete this._children[s]),Object.keys(this._in[s]).forEach(a),delete this._in[s],delete this._preds[s],Object.keys(this._out[s]).forEach(a),delete this._out[s],delete this._sucs[s],--this._nodeCount}return this}setParent(s,i){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(i===void 0)i=t;else{for(var a=i+="";a!==void 0;a=this.parent(a))if(a===s)throw new Error("Setting "+i+" as parent of "+s+" would create a cycle");this.setNode(i)}return this.setNode(s),this._removeFromParentsChildList(s),this._parent[s]=i,this._children[i][s]=!0,this}_removeFromParentsChildList(s){delete this._children[this._parent[s]][s]}parent(s){if(this._isCompound){var i=this._parent[s];if(i!==t)return i}}children(s=t){if(this._isCompound){var i=this._children[s];if(i)return Object.keys(i)}else{if(s===t)return this.nodes();if(this.hasNode(s))return[]}}predecessors(s){var i=this._preds[s];if(i)return Object.keys(i)}successors(s){var i=this._sucs[s];if(i)return Object.keys(i)}neighbors(s){var i=this.predecessors(s);if(i){const l=new Set(i);for(var a of this.successors(s))l.add(a);return Array.from(l.values())}}isLeaf(s){return(this.isDirected()?this.successors(s):this.neighbors(s)).length===0}filterNodes(s){var i=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});i.setGraph(this.graph());var a=this;Object.entries(this._nodes).forEach(function([d,h]){s(d)&&i.setNode(d,h)}),Object.values(this._edgeObjs).forEach(function(d){i.hasNode(d.v)&&i.hasNode(d.w)&&i.setEdge(d,a.edge(d))});var l={};function c(d){var h=a.parent(d);return h===void 0||i.hasNode(h)?(l[d]=h,h):h in l?l[h]:c(h)}return this._isCompound&&i.nodes().forEach(d=>i.setParent(d,c(d))),i}setDefaultEdgeLabel(s){return this._defaultEdgeLabelFn=s,typeof s!="function"&&(this._defaultEdgeLabelFn=()=>s),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(s,i){var a=this,l=arguments;return s.reduce(function(c,d){return l.length>1?a.setEdge(c,d,i):a.setEdge(c,d),d}),this}setEdge(){var s,i,a,l,c=!1,d=arguments[0];typeof d=="object"&&d!==null&&"v"in d?(s=d.v,i=d.w,a=d.name,arguments.length===2&&(l=arguments[1],c=!0)):(s=d,i=arguments[1],a=arguments[3],arguments.length>2&&(l=arguments[2],c=!0)),s=""+s,i=""+i,a!==void 0&&(a=""+a);var h=o(this._isDirected,s,i,a);if(Object.hasOwn(this._edgeLabels,h))return c&&(this._edgeLabels[h]=l),this;if(a!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(s),this.setNode(i),this._edgeLabels[h]=c?l:this._defaultEdgeLabelFn(s,i,a);var f=function(p,_,g,m){var b=""+_,y=""+g;if(!p&&b>y){var x=b;b=y,y=x}var v={v:b,w:y};return m&&(v.name=m),v}(this._isDirected,s,i,a);return s=f.v,i=f.w,Object.freeze(f),this._edgeObjs[h]=f,e(this._preds[i],s),e(this._sucs[s],i),this._in[i][h]=f,this._out[s][h]=f,this._edgeCount++,this}edge(s,i,a){var l=arguments.length===1?r(this._isDirected,arguments[0]):o(this._isDirected,s,i,a);return this._edgeLabels[l]}edgeAsObj(){const s=this.edge(...arguments);return typeof s!="object"?{label:s}:s}hasEdge(s,i,a){var l=arguments.length===1?r(this._isDirected,arguments[0]):o(this._isDirected,s,i,a);return Object.hasOwn(this._edgeLabels,l)}removeEdge(s,i,a){var l=arguments.length===1?r(this._isDirected,arguments[0]):o(this._isDirected,s,i,a),c=this._edgeObjs[l];return c&&(s=c.v,i=c.w,delete this._edgeLabels[l],delete this._edgeObjs[l],n(this._preds[i],s),n(this._sucs[s],i),delete this._in[i][l],delete this._out[s][l],this._edgeCount--),this}inEdges(s,i){var a=this._in[s];if(a){var l=Object.values(a);return i?l.filter(c=>c.v===i):l}}outEdges(s,i){var a=this._out[s];if(a){var l=Object.values(a);return i?l.filter(c=>c.w===i):l}}nodeEdges(s,i){var a=this.inEdges(s,i);if(a)return a.concat(this.outEdges(s,i))}},af}function UP(){return G2?q2:(G2=1,q2={Graph:$f(),version:W2?H2:(W2=1,H2="2.2.4")})}function VP(){if(Y2)return lf;Y2=1;var t=$f();function e(o){return o.nodes().map(function(r){var s=o.node(r),i=o.parent(r),a={v:r};return s!==void 0&&(a.value=s),i!==void 0&&(a.parent=i),a})}function n(o){return o.edges().map(function(r){var s=o.edge(r),i={v:r.v,w:r.w};return r.name!==void 0&&(i.name=r.name),s!==void 0&&(i.value=s),i})}return lf={write:function(o){var r={options:{directed:o.isDirected(),multigraph:o.isMultigraph(),compound:o.isCompound()},nodes:e(o),edges:n(o)};return o.graph()!==void 0&&(r.value=structuredClone(o.graph())),r},read:function(o){var r=new t(o.options).setGraph(o.value);return o.nodes.forEach(function(s){r.setNode(s.v,s.value),s.parent&&r.setParent(s.v,s.parent)}),o.edges.forEach(function(s){r.setEdge({v:s.v,w:s.w,name:s.name},s.value)}),r}},lf}function $P(){return J2||(J2=1,cf=function(t){var e,n={},o=[];function r(s){Object.hasOwn(n,s)||(n[s]=!0,e.push(s),t.successors(s).forEach(r),t.predecessors(s).forEach(r))}return t.nodes().forEach(function(s){e=[],r(s),e.length&&o.push(e)}),o}),cf}function Gk(){return K2?df:(K2=1,df=class{constructor(){Q(this,"_arr",[]);Q(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(t){return t.key})}has(t){return Object.hasOwn(this._keyIndices,t)}priority(t){var e=this._keyIndices[t];if(e!==void 0)return this._arr[e].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(t,e){var n=this._keyIndices;if(t=String(t),!Object.hasOwn(n,t)){var o=this._arr,r=o.length;return n[t]=r,o.push({key:t,priority:e}),this._decrease(r),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key}decrease(t,e){var n=this._keyIndices[t];if(e>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[n].priority+" New: "+e);this._arr[n].priority=e,this._decrease(n)}_heapify(t){var e=this._arr,n=2*t,o=n+1,r=t;n<e.length&&(r=e[n].priority<e[r].priority?n:r,o<e.length&&(r=e[o].priority<e[r].priority?o:r),r!==t&&(this._swap(t,r),this._heapify(r)))}_decrease(t){for(var e,n=this._arr,o=n[t].priority;t!==0&&!(n[e=t>>1].priority<o);)this._swap(t,e),t=e}_swap(t,e){var n=this._arr,o=this._keyIndices,r=n[t],s=n[e];n[t]=s,n[e]=r,o[s.key]=t,o[r.key]=e}},df)}function Yk(){if(X2)return uf;X2=1;var t=Gk();uf=function(n,o,r,s){return function(i,a,l,c){var d,h,f={},p=new t,_=function(g){var m=g.v!==d?g.v:g.w,b=f[m],y=l(g),x=h.distance+y;if(y<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+g+" Weight: "+y);x<b.distance&&(b.distance=x,b.predecessor=d,p.decrease(m,x))};for(i.nodes().forEach(function(g){var m=g===a?0:Number.POSITIVE_INFINITY;f[g]={distance:m},p.add(g,m)});p.size()>0&&(d=p.removeMin(),(h=f[d]).distance!==Number.POSITIVE_INFINITY);)c(d).forEach(_);return f}(n,String(o),r||e,s||function(i){return n.outEdges(i)})};var e=()=>1;return uf}function HP(){if(Z2)return hf;Z2=1;var t=Yk();return hf=function(e,n,o){return e.nodes().reduce(function(r,s){return r[s]=t(e,s,n,o),r},{})},hf}function Jk(){return Q2||(Q2=1,ff=function(t){var e=0,n=[],o={},r=[];function s(i){var a=o[i]={onStack:!0,lowlink:e,index:e++};if(n.push(i),t.successors(i).forEach(function(d){Object.hasOwn(o,d)?o[d].onStack&&(a.lowlink=Math.min(a.lowlink,o[d].index)):(s(d),a.lowlink=Math.min(a.lowlink,o[d].lowlink))}),a.lowlink===a.index){var l,c=[];do l=n.pop(),o[l].onStack=!1,c.push(l);while(i!==l);r.push(c)}}return t.nodes().forEach(function(i){Object.hasOwn(o,i)||s(i)}),r}),ff}function WP(){if(ek)return pf;ek=1;var t=Jk();return pf=function(e){return t(e).filter(function(n){return n.length>1||n.length===1&&e.hasEdge(n[0],n[0])})},pf}function qP(){if(tk)return mf;tk=1,mf=function(e,n,o){return function(r,s,i){var a={},l=r.nodes();return l.forEach(function(c){a[c]={},a[c][c]={distance:0},l.forEach(function(d){c!==d&&(a[c][d]={distance:Number.POSITIVE_INFINITY})}),i(c).forEach(function(d){var h=d.v===c?d.w:d.v,f=s(d);a[c][h]={distance:f,predecessor:c}})}),l.forEach(function(c){var d=a[c];l.forEach(function(h){var f=a[h];l.forEach(function(p){var _=f[c],g=d[p],m=f[p],b=_.distance+g.distance;b<m.distance&&(m.distance=b,m.predecessor=g.predecessor)})})}),a}(e,n||t,o||function(r){return e.outEdges(r)})};var t=()=>1;return mf}function Kk(){if(nk)return gf;function t(n){var o={},r={},s=[];if(n.sinks().forEach(function i(a){if(Object.hasOwn(r,a))throw new e;Object.hasOwn(o,a)||(r[a]=!0,o[a]=!0,n.predecessors(a).forEach(i),delete r[a],s.push(a))}),Object.keys(o).length!==n.nodeCount())throw new e;return s}nk=1;class e extends Error{constructor(){super(...arguments)}}return gf=t,t.CycleException=e,gf}function GP(){if(ok)return _f;ok=1;var t=Kk();return _f=function(e){try{t(e)}catch(n){if(n instanceof t.CycleException)return!1;throw n}return!0},_f}function Xk(){if(rk)return bf;function t(o,r,s,i){for(var a=[[o,!1]];a.length>0;){var l=a.pop();l[1]?i.push(l[0]):Object.hasOwn(s,l[0])||(s[l[0]]=!0,a.push([l[0],!0]),n(r(l[0]),c=>a.push([c,!1])))}}function e(o,r,s,i){for(var a=[o];a.length>0;){var l=a.pop();Object.hasOwn(s,l)||(s[l]=!0,i.push(l),n(r(l),c=>a.push(c)))}}function n(o,r){for(var s=o.length;s--;)r(o[s],s,o);return o}return rk=1,bf=function(o,r,s){Array.isArray(r)||(r=[r]);var i=o.isDirected()?d=>o.successors(d):d=>o.neighbors(d),a=s==="post"?t:e,l=[],c={};return r.forEach(d=>{if(!o.hasNode(d))throw new Error("Graph does not have node: "+d);a(d,i,c,l)}),l},bf}function YP(){if(sk)return yf;sk=1;var t=Xk();return yf=function(e,n){return t(e,n,"post")},yf}function JP(){if(ik)return xf;ik=1;var t=Xk();return xf=function(e,n){return t(e,n,"pre")},xf}function KP(){if(ak)return wf;ak=1;var t=$f(),e=Gk();return wf=function(n,o){var r,s=new t,i={},a=new e;function l(d){var h=d.v===r?d.w:d.v,f=a.priority(h);if(f!==void 0){var p=o(d);p<f&&(i[h]=r,a.decrease(h,p))}}if(n.nodeCount()===0)return s;n.nodes().forEach(function(d){a.add(d,Number.POSITIVE_INFINITY),s.setNode(d)}),a.decrease(n.nodes()[0],0);for(var c=!1;a.size()>0;){if(r=a.removeMin(),Object.hasOwn(i,r))s.setEdge(r,i[r]);else{if(c)throw new Error("Input graph is not connected: "+n);c=!0}n.nodeEdges(r).forEach(l)}return s},wf}function qn(){if(uk)return dk;uk=1;var t=UP();return dk={Graph:t.Graph,json:VP(),alg:ck?lk:(ck=1,lk={components:$P(),dijkstra:Yk(),dijkstraAll:HP(),findCycles:WP(),floydWarshall:qP(),isAcyclic:GP(),postorder:YP(),preorder:JP(),prim:KP(),tarjan:Jk(),topsort:Kk()}),version:t.version}}function XP(){if(pk)return vf;pk=1;let t=qn().Graph,e=function(){if(fk)return hk;function s(a){a._prev._next=a._next,a._next._prev=a._prev,delete a._next,delete a._prev}function i(a,l){if(a!=="_next"&&a!=="_prev")return l}return fk=1,hk=class{constructor(){let a={};a._next=a._prev=a,this._sentinel=a}dequeue(){let a=this._sentinel,l=a._prev;if(l!==a)return s(l),l}enqueue(a){let l=this._sentinel;a._prev&&a._next&&s(a),a._next=l._next,l._next._prev=a,l._next=a,a._prev=l}toString(){let a=[],l=this._sentinel,c=l._prev;for(;c!==l;)a.push(JSON.stringify(c,i)),c=c._prev;return"["+a.join(", ")+"]"}}}();vf=function(s,i){if(s.nodeCount()<=1)return[];let a=function(l,c){let d=new t,h=0,f=0;l.nodes().forEach(g=>{d.setNode(g,{v:g,in:0,out:0})}),l.edges().forEach(g=>{let m=d.edge(g.v,g.w)||0,b=c(g),y=m+b;d.setEdge(g.v,g.w,y),f=Math.max(f,d.node(g.v).out+=b),h=Math.max(h,d.node(g.w).in+=b)});let p=function(g){const m=[];for(let b=0;b<g;b++)m.push(b);return m}(f+h+3).map(()=>new e),_=h+1;return d.nodes().forEach(g=>{r(p,_,d.node(g))}),{graph:d,buckets:p,zeroIdx:_}}(s,i||n);return function(l,c,d){let h,f=[],p=c[c.length-1],_=c[0];for(;l.nodeCount();){for(;h=_.dequeue();)o(l,c,d,h);for(;h=p.dequeue();)o(l,c,d,h);if(l.nodeCount()){for(let g=c.length-2;g>0;--g)if(h=c[g].dequeue(),h){f=f.concat(o(l,c,d,h,!0));break}}}return f}(a.graph,a.buckets,a.zeroIdx).flatMap(l=>s.outEdges(l.v,l.w))};let n=()=>1;function o(s,i,a,l,c){let d=c?[]:void 0;return s.inEdges(l.v).forEach(h=>{let f=s.edge(h),p=s.node(h.v);c&&d.push({v:h.v,w:h.w}),p.out-=f,r(i,a,p)}),s.outEdges(l.v).forEach(h=>{let f=s.edge(h),p=h.w,_=s.node(p);_.in-=f,r(i,a,_)}),s.removeNode(l.v),d}function r(s,i,a){a.out?a.in?s[a.out-a.in+i].enqueue(a):s[s.length-1].enqueue(a):s[0].enqueue(a)}return vf}function Ot(){if(mk)return kf;mk=1;let t=qn().Graph;function e(c,d,h,f){let p;do p=i(f);while(c.hasNode(p));return h.dummy=d,c.setNode(p,h),p}kf={addBorderNode:function(c,d,h,f){let p={width:0,height:0};return arguments.length>=4&&(p.rank=h,p.order=f),e(c,"border",p,d)},addDummyNode:e,applyWithChunking:o,asNonCompoundGraph:function(c){let d=new t({multigraph:c.isMultigraph()}).setGraph(c.graph());return c.nodes().forEach(h=>{c.children(h).length||d.setNode(h,c.node(h))}),c.edges().forEach(h=>{d.setEdge(h,c.edge(h))}),d},buildLayerMatrix:function(c){let d=a(r(c)+1).map(()=>[]);return c.nodes().forEach(h=>{let f=c.node(h),p=f.rank;p!==void 0&&(d[p][f.order]=h)}),d},intersectRect:function(c,d){let h,f,p=c.x,_=c.y,g=d.x-p,m=d.y-_,b=c.width/2,y=c.height/2;if(!g&&!m)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(m)*b>Math.abs(g)*y?(m<0&&(y=-y),h=y*g/m,f=y):(g<0&&(b=-b),h=b,f=b*m/g),{x:p+h,y:_+f}},mapValues:function(c,d){let h=d;return typeof d=="string"&&(h=f=>f[d]),Object.entries(c).reduce((f,[p,_])=>(f[p]=h(_,p),f),{})},maxRank:r,normalizeRanks:function(c){let d=c.nodes().map(f=>{let p=c.node(f).rank;return p===void 0?Number.MAX_VALUE:p}),h=o(Math.min,d);c.nodes().forEach(f=>{let p=c.node(f);Object.hasOwn(p,"rank")&&(p.rank-=h)})},notime:function(c,d){return d()},partition:function(c,d){let h={lhs:[],rhs:[]};return c.forEach(f=>{d(f)?h.lhs.push(f):h.rhs.push(f)}),h},pick:function(c,d){const h={};for(const f of d)c[f]!==void 0&&(h[f]=c[f]);return h},predecessorWeights:function(c){let d=c.nodes().map(h=>{let f={};return c.inEdges(h).forEach(p=>{f[p.v]=(f[p.v]||0)+c.edge(p).weight}),f});return l(c.nodes(),d)},range:a,removeEmptyRanks:function(c){let d=c.nodes().map(g=>c.node(g).rank),h=o(Math.min,d),f=[];c.nodes().forEach(g=>{let m=c.node(g).rank-h;f[m]||(f[m]=[]),f[m].push(g)});let p=0,_=c.graph().nodeRankFactor;Array.from(f).forEach((g,m)=>{g===void 0&&m%_!==0?--p:g!==void 0&&p&&g.forEach(b=>c.node(b).rank+=p)})},simplify:function(c){let d=new t().setGraph(c.graph());return c.nodes().forEach(h=>d.setNode(h,c.node(h))),c.edges().forEach(h=>{let f=d.edge(h.v,h.w)||{weight:0,minlen:1},p=c.edge(h);d.setEdge(h.v,h.w,{weight:f.weight+p.weight,minlen:Math.max(f.minlen,p.minlen)})}),d},successorWeights:function(c){let d=c.nodes().map(h=>{let f={};return c.outEdges(h).forEach(p=>{f[p.w]=(f[p.w]||0)+c.edge(p).weight}),f});return l(c.nodes(),d)},time:function(c,d){let h=Date.now();try{return d()}finally{console.log(c+" time: "+(Date.now()-h)+"ms")}},uniqueId:i,zipObject:l};const n=65535;function o(c,d){if(d.length>n){const h=function(f,p=n){const _=[];for(let g=0;g<f.length;g+=p){const m=f.slice(g,g+p);_.push(m)}return _}(d);return c.apply(null,h.map(f=>c.apply(null,f)))}return c.apply(null,d)}function r(c){const d=c.nodes().map(h=>{let f=c.node(h).rank;return f===void 0?Number.MIN_VALUE:f});return o(Math.max,d)}let s=0;function i(c){var d=++s;return toString(c)+d}function a(c,d,h=1){d==null&&(d=c,c=0);let f=_=>_<d;h<0&&(f=_=>d<_);const p=[];for(let _=c;f(_);_+=h)p.push(_);return p}function l(c,d){return c.reduce((h,f,p)=>(h[f]=d[p],h),{})}return kf}function ZP(){if(gk)return Sf;gk=1;let t=XP(),e=Ot().uniqueId;return Sf={run:function(n){(n.graph().acyclicer==="greedy"?t(n,function(r){return s=>r.edge(s).weight}(n)):function(r){let s=[],i={},a={};function l(c){Object.hasOwn(a,c)||(a[c]=!0,i[c]=!0,r.outEdges(c).forEach(d=>{Object.hasOwn(i,d.w)?s.push(d):l(d.w)}),delete i[c])}return r.nodes().forEach(l),s}(n)).forEach(r=>{let s=n.edge(r);n.removeEdge(r),s.forwardName=r.name,s.reversed=!0,n.setEdge(r.w,r.v,s,e("rev"))})},undo:function(n){n.edges().forEach(o=>{let r=n.edge(o);if(r.reversed){n.removeEdge(o);let s=r.forwardName;delete r.reversed,delete r.forwardName,n.setEdge(o.w,o.v,r,s)}})}},Sf}function QP(){if(_k)return Cf;_k=1;let t=Ot();return Cf={run:function(e){e.graph().dummyChains=[],e.edges().forEach(n=>function(o,r){let s,i,a,l=r.v,c=o.node(l).rank,d=r.w,h=o.node(d).rank,f=r.name,p=o.edge(r),_=p.labelRank;if(h!==c+1){for(o.removeEdge(r),a=0,++c;c<h;++a,++c)p.points=[],i={width:0,height:0,edgeLabel:p,edgeObj:r,rank:c},s=t.addDummyNode(o,"edge",i,"_d"),c===_&&(i.width=p.width,i.height=p.height,i.dummy="edge-label",i.labelpos=p.labelpos),o.setEdge(l,s,{weight:p.weight},f),a===0&&o.graph().dummyChains.push(s),l=s;o.setEdge(l,d,{weight:p.weight},f)}}(e,n))},undo:function(e){e.graph().dummyChains.forEach(n=>{let o,r=e.node(n),s=r.edgeLabel;for(e.setEdge(r.edgeObj,s);r.dummy;)o=e.successors(n)[0],e.removeNode(n),s.points.push({x:r.x,y:r.y}),r.dummy==="edge-label"&&(s.x=r.x,s.y=r.y,s.width=r.width,s.height=r.height),n=o,r=e.node(n)})}},Cf}function Wl(){if(bk)return Nf;bk=1;const{applyWithChunking:t}=Ot();return Nf={longestPath:function(e){var n={};e.sources().forEach(function o(r){var s=e.node(r);if(Object.hasOwn(n,r))return s.rank;n[r]=!0;let i=e.outEdges(r).map(l=>l==null?Number.POSITIVE_INFINITY:o(l.w)-e.edge(l).minlen);var a=t(Math.min,i);return a===Number.POSITIVE_INFINITY&&(a=0),s.rank=a})},slack:function(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen}},Nf}function Zk(){if(yk)return jf;yk=1;var t=qn().Graph,e=Wl().slack;function n(s,i){return s.nodes().forEach(function a(l){i.nodeEdges(l).forEach(c=>{var d=c.v,h=l===d?c.w:d;s.hasNode(h)||e(i,c)||(s.setNode(h,{}),s.setEdge(l,h,{}),a(h))})}),s.nodeCount()}function o(s,i){return i.edges().reduce((a,l)=>{let c=Number.POSITIVE_INFINITY;return s.hasNode(l.v)!==s.hasNode(l.w)&&(c=e(i,l)),c<a[0]?[c,l]:a},[Number.POSITIVE_INFINITY,null])[1]}function r(s,i,a){s.nodes().forEach(l=>i.node(l).rank+=a)}return jf=function(s){var i,a,l=new t({directed:!1}),c=s.nodes()[0],d=s.nodeCount();for(l.setNode(c,{});n(l,s)<d;)i=o(l,s),a=l.hasNode(i.v)?e(s,i):-e(s,i),r(l,s,a);return l},jf}function eL(){if(xk)return Ef;xk=1;var t=Zk(),e=Wl().slack,n=Wl().longestPath,o=qn().alg.preorder,r=qn().alg.postorder,s=Ot().simplify;function i(g){g=s(g),n(g);var m,b=t(g);for(c(b),a(b,g);m=h(b);)p(b,g,m,f(b,g,m))}function a(g,m){var b=r(g,g.nodes());(b=b.slice(0,b.length-1)).forEach(y=>function(x,v,C){var k=x.node(C),E=k.parent;x.edge(C,E).cutvalue=l(x,v,C)}(g,m,y))}function l(g,m,b){var y=g.node(b).parent,x=!0,v=m.edge(b,y),C=0;return v||(x=!1,v=m.edge(y,b)),C=v.weight,m.nodeEdges(b).forEach(k=>{var E,N,I=k.v===b,A=I?k.w:k.v;if(A!==y){var M=I===x,R=m.edge(k).weight;if(C+=M?R:-R,E=b,N=A,g.hasEdge(E,N)){var z=g.edge(b,A).cutvalue;C+=M?-z:z}}}),C}function c(g,m){arguments.length<2&&(m=g.nodes()[0]),d(g,{},1,m)}function d(g,m,b,y,x){var v=b,C=g.node(y);return m[y]=!0,g.neighbors(y).forEach(k=>{Object.hasOwn(m,k)||(b=d(g,m,b,k,y))}),C.low=v,C.lim=b++,x?C.parent=x:delete C.parent,b}function h(g){return g.edges().find(m=>g.edge(m).cutvalue<0)}function f(g,m,b){var y=b.v,x=b.w;m.hasEdge(y,x)||(y=b.w,x=b.v);var v=g.node(y),C=g.node(x),k=v,E=!1;v.lim>C.lim&&(k=C,E=!0);var N=m.edges().filter(I=>E===_(g,g.node(I.v),k)&&E!==_(g,g.node(I.w),k));return N.reduce((I,A)=>e(m,A)<e(m,I)?A:I)}function p(g,m,b,y){var x=b.v,v=b.w;g.removeEdge(x,v),g.setEdge(y.v,y.w,{}),c(g),a(g,m),function(C,k){var E=C.nodes().find(I=>!k.node(I).parent),N=o(C,E);(N=N.slice(1)).forEach(I=>{var A=C.node(I).parent,M=k.edge(I,A),R=!1;M||(M=k.edge(A,I),R=!0),k.node(I).rank=k.node(A).rank+(R?M.minlen:-M.minlen)})}(g,m)}function _(g,m,b){return b.low<=m.lim&&m.lim<=b.lim}return Ef=i,i.initLowLimValues=c,i.initCutValues=a,i.calcCutValue=l,i.leaveEdge=h,i.enterEdge=f,i.exchangeEdges=p,Ef}function tL(){if(wk)return If;wk=1;var t=Wl().longestPath,e=Zk(),n=eL();If=function(s){switch(s.graph().ranker){case"network-simplex":default:r(s);break;case"tight-tree":(function(i){t(i),e(i)})(s);break;case"longest-path":o(s)}};var o=t;function r(s){n(s)}return If}function nL(){return vk||(vk=1,Af=function(t){let e=function(n){let o={},r=0;function s(i){let a=r;n.children(i).forEach(s),o[i]={low:a,lim:r++}}return n.children().forEach(s),o}(t);t.graph().dummyChains.forEach(n=>{let o=t.node(n),r=o.edgeObj,s=function(h,f,p,_){let g,m,b=[],y=[],x=Math.min(f[p].low,f[_].low),v=Math.max(f[p].lim,f[_].lim);g=p;do g=h.parent(g),b.push(g);while(g&&(f[g].low>x||v>f[g].lim));for(m=g,g=_;(g=h.parent(g))!==m;)y.push(g);return{path:b.concat(y.reverse()),lca:m}}(t,e,r.v,r.w),i=s.path,a=s.lca,l=0,c=i[l],d=!0;for(;n!==r.w;){if(o=t.node(n),d){for(;(c=i[l])!==a&&t.node(c).maxRank<o.rank;)l++;c===a&&(d=!1)}if(!d){for(;l<i.length-1&&t.node(c=i[l+1]).minRank<=o.rank;)l++;c=i[l]}t.setParent(n,c),n=t.successors(n)[0]}})}),Af}function oL(){if(kk)return Tf;kk=1;let t=Ot();function e(n,o,r,s,i,a,l){let c=n.children(l);if(!c.length)return void(l!==o&&n.setEdge(o,l,{weight:0,minlen:r}));let d=t.addBorderNode(n,"_bt"),h=t.addBorderNode(n,"_bb"),f=n.node(l);n.setParent(d,l),f.borderTop=d,n.setParent(h,l),f.borderBottom=h,c.forEach(p=>{e(n,o,r,s,i,a,p);let _=n.node(p),g=_.borderTop?_.borderTop:p,m=_.borderBottom?_.borderBottom:p,b=_.borderTop?s:2*s,y=g!==m?1:i-a[l]+1;n.setEdge(d,g,{weight:b,minlen:y,nestingEdge:!0}),n.setEdge(m,h,{weight:b,minlen:y,nestingEdge:!0})}),n.parent(l)||n.setEdge(o,d,{weight:0,minlen:i+a[l]})}return Tf={run:function(n){let o=t.addDummyNode(n,"root",{},"_root"),r=function(c){var d={};function h(f,p){var _=c.children(f);_&&_.length&&_.forEach(g=>h(g,p+1)),d[f]=p}return c.children().forEach(f=>h(f,1)),d}(n),s=Object.values(r),i=t.applyWithChunking(Math.max,s)-1,a=2*i+1;n.graph().nestingRoot=o,n.edges().forEach(c=>n.edge(c).minlen*=a);let l=function(c){return c.edges().reduce((d,h)=>d+c.edge(h).weight,0)}(n)+1;n.children().forEach(c=>e(n,o,a,l,i,r,c)),n.graph().nodeRankFactor=a},cleanup:function(n){var o=n.graph();n.removeNode(o.nestingRoot),delete o.nestingRoot,n.edges().forEach(r=>{n.edge(r).nestingEdge&&n.removeEdge(r)})}},Tf}function rL(){if(Ck)return Of;function t(r){r.nodes().forEach(s=>e(r.node(s))),r.edges().forEach(s=>e(r.edge(s)))}function e(r){let s=r.width;r.width=r.height,r.height=s}function n(r){r.y=-r.y}function o(r){let s=r.x;r.x=r.y,r.y=s}return Ck=1,Of={adjust:function(r){let s=r.graph().rankdir.toLowerCase();s!=="lr"&&s!=="rl"||t(r)},undo:function(r){let s=r.graph().rankdir.toLowerCase();s!=="bt"&&s!=="rl"||function(i){i.nodes().forEach(a=>n(i.node(a))),i.edges().forEach(a=>{let l=i.edge(a);l.points.forEach(n),Object.hasOwn(l,"y")&&n(l)})}(r),s!=="lr"&&s!=="rl"||(function(i){i.nodes().forEach(a=>o(i.node(a))),i.edges().forEach(a=>{let l=i.edge(a);l.points.forEach(o),Object.hasOwn(l,"x")&&o(l)})}(r),t(r))}},Of}function sL(){if(Tk)return Ak;Tk=1;let t=Ot();return Ak=function(e,n){let o={};return e.forEach((r,s)=>{let i=o[r.v]={indegree:0,in:[],out:[],vs:[r.v],i:s};r.barycenter!==void 0&&(i.barycenter=r.barycenter,i.weight=r.weight)}),n.edges().forEach(r=>{let s=o[r.v],i=o[r.w];s!==void 0&&i!==void 0&&(i.indegree++,s.out.push(o[r.w]))}),function(r){let s=[];function i(l){return c=>{c.merged||(c.barycenter===void 0||l.barycenter===void 0||c.barycenter>=l.barycenter)&&function(d,h){let f=0,p=0;d.weight&&(f+=d.barycenter*d.weight,p+=d.weight),h.weight&&(f+=h.barycenter*h.weight,p+=h.weight),d.vs=h.vs.concat(d.vs),d.barycenter=f/p,d.weight=p,d.i=Math.min(h.i,d.i),h.merged=!0}(l,c)}}function a(l){return c=>{c.in.push(l),--c.indegree===0&&r.push(c)}}for(;r.length;){let l=r.pop();s.push(l),l.in.reverse().forEach(i(l)),l.out.forEach(a(l))}return s.filter(l=>!l.merged).map(l=>t.pick(l,["vs","i","barycenter","weight"]))}(Object.values(o).filter(r=>!r.indegree))}}function iL(){if(Dk)return Pf;Dk=1;let t=(Ik||(Ik=1,Ek=function(o,r=[]){return r.map(s=>{let i=o.inEdges(s);if(i.length){let a=i.reduce((l,c)=>{let d=o.edge(c),h=o.node(c.v);return{sum:l.sum+d.weight*h.order,weight:l.weight+d.weight}},{sum:0,weight:0});return{v:s,barycenter:a.sum/a.weight,weight:a.weight}}return{v:s}})}),Ek),e=sL(),n=function(){if(Ok)return Mk;Ok=1;let o=Ot();function r(s,i,a){let l;for(;i.length&&(l=i[i.length-1]).i<=a;)i.pop(),s.push(l.vs),a++;return a}return Mk=function(s,i){let a=o.partition(s,m=>Object.hasOwn(m,"barycenter")),l=a.lhs,c=a.rhs.sort((m,b)=>b.i-m.i),d=[],h=0,f=0,p=0;var _;l.sort((_=!!i,(m,b)=>m.barycenter<b.barycenter?-1:m.barycenter>b.barycenter?1:_?b.i-m.i:m.i-b.i)),p=r(d,c,p),l.forEach(m=>{p+=m.vs.length,d.push(m.vs),h+=m.barycenter*m.weight,f+=m.weight,p=r(d,c,p)});let g={vs:d.flat(!0)};return f&&(g.barycenter=h/f,g.weight=f),g}}();return Pf=function o(r,s,i,a){let l=r.children(s),c=r.node(s),d=c?c.borderLeft:void 0,h=c?c.borderRight:void 0,f={};d&&(l=l.filter(m=>m!==d&&m!==h));let p=t(r,l);p.forEach(m=>{if(r.children(m.v).length){let x=o(r,m.v,i,a);f[m.v]=x,Object.hasOwn(x,"barycenter")&&(y=x,(b=m).barycenter!==void 0?(b.barycenter=(b.barycenter*b.weight+y.barycenter*y.weight)/(b.weight+y.weight),b.weight+=y.weight):(b.barycenter=y.barycenter,b.weight=y.weight))}var b,y});let _=e(p,i);(function(m,b){m.forEach(y=>{y.vs=y.vs.flatMap(x=>b[x]?b[x].vs:x)})})(_,f);let g=n(_,a);if(d&&(g.vs=[d,g.vs,h].flat(!0),r.predecessors(d).length)){let m=r.node(r.predecessors(d)[0]),b=r.node(r.predecessors(h)[0]);Object.hasOwn(g,"barycenter")||(g.barycenter=0,g.weight=0),g.barycenter=(g.barycenter*g.weight+m.order+b.order)/(g.weight+2),g.weight+=2}return g},Pf}function aL(){if(Rk)return Lf;Rk=1;let t=qn().Graph,e=Ot();return Lf=function(n,o,r){let s=function(a){for(var l;a.hasNode(l=e.uniqueId("_root")););return l}(n),i=new t({compound:!0}).setGraph({root:s}).setDefaultNodeLabel(a=>n.node(a));return n.nodes().forEach(a=>{let l=n.node(a),c=n.parent(a);(l.rank===o||l.minRank<=o&&o<=l.maxRank)&&(i.setNode(a),i.setParent(a,c||s),n[r](a).forEach(d=>{let h=d.v===a?d.w:d.v,f=i.edge(h,a),p=f!==void 0?f.weight:0;i.setEdge(h,a,{weight:n.edge(d).weight+p})}),Object.hasOwn(l,"minRank")&&i.setNode(a,{borderLeft:l.borderLeft[o],borderRight:l.borderRight[o]}))}),i},Lf}function lL(){if(Fk)return Ff;Fk=1;let t=function(){if(Nk)return Df;Nk=1;let d=Ot();return Df=function(h){let f={},p=h.nodes().filter(y=>!h.children(y).length),_=p.map(y=>h.node(y).rank),g=d.applyWithChunking(Math.max,_),m=d.range(g+1).map(()=>[]);function b(y){if(f[y])return;f[y]=!0;let x=h.node(y);m[x.rank].push(y),h.successors(y).forEach(b)}return p.sort((y,x)=>h.node(y).rank-h.node(x).rank).forEach(b),m},Df}(),e=function(){if(jk)return Rf;jk=1;let d=Ot().zipObject;function h(f,p,_){let g=d(_,_.map((C,k)=>k)),m=p.flatMap(C=>f.outEdges(C).map(k=>({pos:g[k.w],weight:f.edge(k).weight})).sort((k,E)=>k.pos-E.pos)),b=1;for(;b<_.length;)b<<=1;let y=2*b-1;b-=1;let x=new Array(y).fill(0),v=0;return m.forEach(C=>{let k=C.pos+b;x[k]+=C.weight;let E=0;for(;k>0;)k%2&&(E+=x[k+1]),k=k-1>>1,x[k]+=C.weight;v+=C.weight*E}),v}return Rf=function(f,p){let _=0;for(let g=1;g<p.length;++g)_+=h(f,p[g-1],p[g]);return _},Rf}(),n=iL(),o=aL(),r=(Lk||(Lk=1,Pk=function(d,h,f){let p,_={};f.forEach(g=>{let m,b,y=d.parent(g);for(;y;){if(m=d.parent(y),m?(b=_[m],_[m]=y):(b=p,p=y),b&&b!==y)return void h.setEdge(b,y);y=m}})}),Pk),s=qn().Graph,i=Ot();function a(d,h,f){return h.map(function(p){return o(d,p,f)})}function l(d,h){let f=new s;d.forEach(function(p){let _=p.graph().root,g=n(p,_,f,h);g.vs.forEach((m,b)=>p.node(m).order=b),r(p,f,g.vs)})}function c(d,h){Object.values(h).forEach(f=>f.forEach((p,_)=>d.node(p).order=_))}return Ff=function d(h,f){if(f&&typeof f.customOrder=="function")return void f.customOrder(h,d);let p=i.maxRank(h),_=a(h,i.range(1,p+1),"inEdges"),g=a(h,i.range(p-1,-1,-1),"outEdges"),m=t(h);if(c(h,m),f&&f.disableOptimalOrderHeuristic)return;let b,y=Number.POSITIVE_INFINITY;for(let x=0,v=0;v<4;++x,++v){l(x%2?_:g,x%4>=2),m=i.buildLayerMatrix(h);let C=e(h,m);C<y&&(v=0,b=Object.assign({},m),y=C)}c(h,b)},Ff}function cL(){if(zk)return zf;zk=1;let t=qn().Graph,e=Ot();function n(h,f){let p={};return f.length&&f.reduce(function(_,g){let m=0,b=0,y=_.length,x=g[g.length-1];return g.forEach((v,C)=>{let k=function(N,I){if(N.node(I).dummy)return N.predecessors(I).find(A=>N.node(A).dummy)}(h,v),E=k?h.node(k).order:y;(k||v===x)&&(g.slice(b,C+1).forEach(N=>{h.predecessors(N).forEach(I=>{let A=h.node(I),M=A.order;!(M<m||E<M)||A.dummy&&h.node(N).dummy||r(p,I,N)})}),b=C+1,m=E)}),g}),p}function o(h,f){let p={};function _(g,m,b,y,x){let v;e.range(m,b).forEach(C=>{v=g[C],h.node(v).dummy&&h.predecessors(v).forEach(k=>{let E=h.node(k);E.dummy&&(E.order<y||E.order>x)&&r(p,k,v)})})}return f.length&&f.reduce(function(g,m){let b,y=-1,x=0;return m.forEach((v,C)=>{if(h.node(v).dummy==="border"){let k=h.predecessors(v);k.length&&(b=h.node(k[0]).order,_(m,x,C,y,b),x=C,y=b)}_(m,x,m.length,b,g.length)}),m}),p}function r(h,f,p){if(f>p){let g=f;f=p,p=g}let _=h[f];_||(h[f]=_={}),_[p]=!0}function s(h,f,p){if(f>p){let _=f;f=p,p=_}return!!h[f]&&Object.hasOwn(h[f],p)}function i(h,f,p,_){let g={},m={},b={};return f.forEach(y=>{y.forEach((x,v)=>{g[x]=x,m[x]=x,b[x]=v})}),f.forEach(y=>{let x=-1;y.forEach(v=>{let C=_(v);if(C.length){C=C.sort((E,N)=>b[E]-b[N]);let k=(C.length-1)/2;for(let E=Math.floor(k),N=Math.ceil(k);E<=N;++E){let I=C[E];m[v]===v&&x<b[I]&&!s(p,v,I)&&(m[I]=v,m[v]=g[v]=g[I],x=b[I])}}})}),{root:g,align:m}}function a(h,f,p,_,g){let m={},b=function(v,C,k,E){let N=new t,I=v.graph(),A=function(M,R,z){return(D,F,B)=>{let U,O=D.node(F),S=D.node(B),$=0;if($+=O.width/2,Object.hasOwn(O,"labelpos"))switch(O.labelpos.toLowerCase()){case"l":U=-O.width/2;break;case"r":U=O.width/2}if(U&&($+=z?U:-U),U=0,$+=(O.dummy?R:M)/2,$+=(S.dummy?R:M)/2,$+=S.width/2,Object.hasOwn(S,"labelpos"))switch(S.labelpos.toLowerCase()){case"l":U=S.width/2;break;case"r":U=-S.width/2}return U&&($+=z?U:-U),U=0,$}}(I.nodesep,I.edgesep,E);return C.forEach(M=>{let R;M.forEach(z=>{let D=k[z];if(N.setNode(D),R){var F=k[R],B=N.edge(F,D);N.setEdge(F,D,Math.max(A(v,z,R),B||0))}R=z})}),N}(h,f,p,g),y=g?"borderLeft":"borderRight";function x(v,C){let k=b.nodes(),E=k.pop(),N={};for(;E;)N[E]?v(E):(N[E]=!0,k.push(E),k=k.concat(C(E))),E=k.pop()}return x(function(v){m[v]=b.inEdges(v).reduce((C,k)=>Math.max(C,m[k.v]+b.edge(k)),0)},b.predecessors.bind(b)),x(function(v){let C=b.outEdges(v).reduce((E,N)=>Math.min(E,m[N.w]-b.edge(N)),Number.POSITIVE_INFINITY),k=h.node(v);C!==Number.POSITIVE_INFINITY&&k.borderType!==y&&(m[v]=Math.max(m[v],C))},b.successors.bind(b)),Object.keys(_).forEach(v=>m[v]=m[p[v]]),m}function l(h,f){return Object.values(f).reduce((p,_)=>{let g=Number.NEGATIVE_INFINITY,m=Number.POSITIVE_INFINITY;Object.entries(_).forEach(([y,x])=>{let v=function(C,k){return C.node(k).width}(h,y)/2;g=Math.max(x+v,g),m=Math.min(x-v,m)});const b=g-m;return b<p[0]&&(p=[b,_]),p},[Number.POSITIVE_INFINITY,null])[1]}function c(h,f){let p=Object.values(f),_=e.applyWithChunking(Math.min,p),g=e.applyWithChunking(Math.max,p);["u","d"].forEach(m=>{["l","r"].forEach(b=>{let y=m+b,x=h[y];if(x===f)return;let v=Object.values(x),C=_-e.applyWithChunking(Math.min,v);b!=="l"&&(C=g-e.applyWithChunking(Math.max,v)),C&&(h[y]=e.mapValues(x,k=>k+C))})})}function d(h,f){return e.mapValues(h.ul,(p,_)=>{if(f)return h[f.toLowerCase()][_];{let g=Object.values(h).map(m=>m[_]).sort((m,b)=>m-b);return(g[1]+g[2])/2}})}return zf={positionX:function(h){let f,p=e.buildLayerMatrix(h),_=Object.assign(n(h,p),o(h,p)),g={};["u","d"].forEach(b=>{f=b==="u"?p:Object.values(p).reverse(),["l","r"].forEach(y=>{y==="r"&&(f=f.map(k=>Object.values(k).reverse()));let x=(b==="u"?h.predecessors:h.successors).bind(h),v=i(h,f,_,x),C=a(h,f,v.root,v.align,y==="r");y==="r"&&(C=e.mapValues(C,k=>-k)),g[b+y]=C})});let m=l(h,g);return c(g,m),d(g,h.graph().align)},findType1Conflicts:n,findType2Conflicts:o,addConflict:r,hasConflict:s,verticalAlignment:i,horizontalCompaction:a,alignCoordinates:c,findSmallestWidthAlignment:l,balance:d},zf}function dL(){if(Bk)return Bf;Bk=1;let t=Ot(),e=cL().positionX;return Bf=function(n){n=t.asNonCompoundGraph(n),function(o){let r=t.buildLayerMatrix(o),s=o.graph().ranksep,i=0;r.forEach(a=>{const l=a.reduce((c,d)=>{const h=o.node(d).height;return c>h?c:h},0);a.forEach(c=>o.node(c).y=i+l/2),i+=l+s})}(n),Object.entries(e(n)).forEach(([o,r])=>n.node(o).x=r)},Bf}function uL(){if(Uk)return Uf;Uk=1;let t=ZP(),e=QP(),n=tL(),o=Ot().normalizeRanks,r=nL(),s=Ot().removeEmptyRanks,i=oL(),a=function(){if(Sk)return Mf;Sk=1;let E=Ot();function N(I,A,M,R,z,D){let F={width:0,height:0,rank:D,borderType:A},B=z[A][D-1],U=E.addDummyNode(I,"border",F,M);z[A][D]=U,I.setParent(U,R),B&&I.setEdge(B,U,{weight:1})}return Mf=function(I){I.children().forEach(function A(M){let R=I.children(M),z=I.node(M);if(R.length&&R.forEach(A),Object.hasOwn(z,"minRank")){z.borderLeft=[],z.borderRight=[];for(let D=z.minRank,F=z.maxRank+1;D<F;++D)N(I,"borderLeft","_bl",M,z,D),N(I,"borderRight","_br",M,z,D)}})},Mf}(),l=rL(),c=lL(),d=dL(),h=Ot(),f=qn().Graph;Uf=function(E,N){let I=N&&N.debugTiming?h.time:h.notime;I("layout",()=>{let A=I(" buildLayoutGraph",()=>function(M){let R=new f({multigraph:!0,compound:!0}),z=k(M.graph());return R.setGraph(Object.assign({},_,C(z,p),h.pick(z,g))),M.nodes().forEach(D=>{const F=C(k(M.node(D)),m);Object.keys(b).forEach(B=>{F[B]===void 0&&(F[B]=b[B])}),R.setNode(D,F),R.setParent(D,M.parent(D))}),M.edges().forEach(D=>{let F=k(M.edge(D));R.setEdge(D,Object.assign({},x,C(F,y),h.pick(F,v)))}),R}(E));I(" runLayout",()=>function(M,R,z){R(" makeSpaceForEdgeLabels",()=>function(D){let F=D.graph();F.ranksep/=2,D.edges().forEach(B=>{let U=D.edge(B);U.minlen*=2,U.labelpos.toLowerCase()!=="c"&&(F.rankdir==="TB"||F.rankdir==="BT"?U.width+=U.labeloffset:U.height+=U.labeloffset)})}(M)),R(" removeSelfEdges",()=>function(D){D.edges().forEach(F=>{if(F.v===F.w){var B=D.node(F.v);B.selfEdges||(B.selfEdges=[]),B.selfEdges.push({e:F,label:D.edge(F)}),D.removeEdge(F)}})}(M)),R(" acyclic",()=>t.run(M)),R(" nestingGraph.run",()=>i.run(M)),R(" rank",()=>n(h.asNonCompoundGraph(M))),R(" injectEdgeLabelProxies",()=>function(D){D.edges().forEach(F=>{let B=D.edge(F);if(B.width&&B.height){let U=D.node(F.v),O={rank:(D.node(F.w).rank-U.rank)/2+U.rank,e:F};h.addDummyNode(D,"edge-proxy",O,"_ep")}})}(M)),R(" removeEmptyRanks",()=>s(M)),R(" nestingGraph.cleanup",()=>i.cleanup(M)),R(" normalizeRanks",()=>o(M)),R(" assignRankMinMax",()=>function(D){let F=0;D.nodes().forEach(B=>{let U=D.node(B);U.borderTop&&(U.minRank=D.node(U.borderTop).rank,U.maxRank=D.node(U.borderBottom).rank,F=Math.max(F,U.maxRank))}),D.graph().maxRank=F}(M)),R(" removeEdgeLabelProxies",()=>function(D){D.nodes().forEach(F=>{let B=D.node(F);B.dummy==="edge-proxy"&&(D.edge(B.e).labelRank=B.rank,D.removeNode(F))})}(M)),R(" normalize.run",()=>e.run(M)),R(" parentDummyChains",()=>r(M)),R(" addBorderSegments",()=>a(M)),R(" order",()=>c(M,z)),R(" insertSelfEdges",()=>function(D){var F=h.buildLayerMatrix(D);F.forEach(B=>{var U=0;B.forEach((O,S)=>{var $=D.node(O);$.order=S+U,($.selfEdges||[]).forEach(j=>{h.addDummyNode(D,"selfedge",{width:j.label.width,height:j.label.height,rank:$.rank,order:S+ ++U,e:j.e,label:j.label},"_se")}),delete $.selfEdges})})}(M)),R(" adjustCoordinateSystem",()=>l.adjust(M)),R(" position",()=>d(M)),R(" positionSelfEdges",()=>function(D){D.nodes().forEach(F=>{var B=D.node(F);if(B.dummy==="selfedge"){var U=D.node(B.e.v),O=U.x+U.width/2,S=U.y,$=B.x-O,j=U.height/2;D.setEdge(B.e,B.label),D.removeNode(F),B.label.points=[{x:O+2*$/3,y:S-j},{x:O+5*$/6,y:S-j},{x:O+$,y:S},{x:O+5*$/6,y:S+j},{x:O+2*$/3,y:S+j}],B.label.x=B.x,B.label.y=B.y}})}(M)),R(" removeBorderNodes",()=>function(D){D.nodes().forEach(F=>{if(D.children(F).length){let B=D.node(F),U=D.node(B.borderTop),O=D.node(B.borderBottom),S=D.node(B.borderLeft[B.borderLeft.length-1]),$=D.node(B.borderRight[B.borderRight.length-1]);B.width=Math.abs($.x-S.x),B.height=Math.abs(O.y-U.y),B.x=S.x+B.width/2,B.y=U.y+B.height/2}}),D.nodes().forEach(F=>{D.node(F).dummy==="border"&&D.removeNode(F)})}(M)),R(" normalize.undo",()=>e.undo(M)),R(" fixupEdgeLabelCoords",()=>function(D){D.edges().forEach(F=>{let B=D.edge(F);if(Object.hasOwn(B,"x"))switch(B.labelpos!=="l"&&B.labelpos!=="r"||(B.width-=B.labeloffset),B.labelpos){case"l":B.x-=B.width/2+B.labeloffset;break;case"r":B.x+=B.width/2+B.labeloffset}})}(M)),R(" undoCoordinateSystem",()=>l.undo(M)),R(" translateGraph",()=>function(D){let F=Number.POSITIVE_INFINITY,B=0,U=Number.POSITIVE_INFINITY,O=0,S=D.graph(),$=S.marginx||0,j=S.marginy||0;function W(Y){let G=Y.x,q=Y.y,te=Y.width,re=Y.height;F=Math.min(F,G-te/2),B=Math.max(B,G+te/2),U=Math.min(U,q-re/2),O=Math.max(O,q+re/2)}D.nodes().forEach(Y=>W(D.node(Y))),D.edges().forEach(Y=>{let G=D.edge(Y);Object.hasOwn(G,"x")&&W(G)}),F-=$,U-=j,D.nodes().forEach(Y=>{let G=D.node(Y);G.x-=F,G.y-=U}),D.edges().forEach(Y=>{let G=D.edge(Y);G.points.forEach(q=>{q.x-=F,q.y-=U}),Object.hasOwn(G,"x")&&(G.x-=F),Object.hasOwn(G,"y")&&(G.y-=U)}),S.width=B-F+$,S.height=O-U+j}(M)),R(" assignNodeIntersects",()=>function(D){D.edges().forEach(F=>{let B,U,O=D.edge(F),S=D.node(F.v),$=D.node(F.w);O.points?(B=O.points[0],U=O.points[O.points.length-1]):(O.points=[],B=$,U=S),O.points.unshift(h.intersectRect(S,B)),O.points.push(h.intersectRect($,U))})}(M)),R(" reversePoints",()=>function(D){D.edges().forEach(F=>{let B=D.edge(F);B.reversed&&B.points.reverse()})}(M)),R(" acyclic.undo",()=>t.undo(M))}(A,I,N)),I(" updateInputGraph",()=>function(M,R){M.nodes().forEach(z=>{let D=M.node(z),F=R.node(z);D&&(D.x=F.x,D.y=F.y,D.rank=F.rank,R.children(z).length&&(D.width=F.width,D.height=F.height))}),M.edges().forEach(z=>{let D=M.edge(z),F=R.edge(z);D.points=F.points,Object.hasOwn(F,"x")&&(D.x=F.x,D.y=F.y)}),M.graph().width=R.graph().width,M.graph().height=R.graph().height}(E,A))})};let p=["nodesep","edgesep","ranksep","marginx","marginy"],_={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},g=["acyclicer","ranker","rankdir","align"],m=["width","height"],b={width:0,height:0},y=["minlen","weight","width","height","labeloffset"],x={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},v=["labelpos"];function C(E,N){return h.mapValues(h.pick(E,N),Number)}function k(E){var N={};return E&&Object.entries(E).forEach(([I,A])=>{typeof I=="string"&&(I=I.toLowerCase()),N[I]=A}),N}return Uf}function hL(){if(Vk)return Vf;Vk=1;let t=Ot(),e=qn().Graph;return Vf={debugOrdering:function(n){let o=t.buildLayerMatrix(n),r=new e({compound:!0,multigraph:!0}).setGraph({});return n.nodes().forEach(s=>{r.setNode(s,{label:s}),r.setParent(s,"layer"+n.node(s).rank)}),n.edges().forEach(s=>r.setEdge(s.v,s.w,{},s.name)),o.forEach((s,i)=>{let a="layer"+i;r.setNode(a,{rank:"same"}),s.reduce((l,c)=>(r.setEdge(l,c,{style:"invis"}),c))}),r}},Vf}var Qk=qk?Wk:(qk=1,Wk={graphlib:qn(),layout:uL(),debug:hL(),util:{time:Ot().time,notime:Ot().notime},version:Hk?$k:(Hk=1,$k="1.1.4")});const Bi=new Qk.graphlib.Graph().setDefaultEdgeLabel(()=>({})),e3=(t,e,n)=>(Bi.setGraph({rankdir:n.direction,nodesep:150,ranksep:200,ranker:"longest-path"}),e.forEach(o=>Bi.setEdge(o.source,o.target)),t.forEach(o=>Bi.setNode(o.id,{...o,width:o.width??0,height:o.height??0})),Qk.layout(Bi),{nodes:t.map(o=>{const{x:r,y:s}=Bi.node(o.id);return{...o,position:{x:r,y:s}}}),edges:e}),t3=new class{createEdge(t,e){return{animated:!0,markerEnd:{type:hs.ArrowClosed},id:`${t}-${e}`,style:{strokeWidth:2},source:t,sourceHandle:"outputs",targetHandle:"inputs",target:e}}createNode(t,e){return{id:t,data:{atom:e,forceWidth:300},width:300,type:"custom",height:of(ct.get(e).code.trim().split(`
|
144
|
-
`).length),position:{x:0,y:0}}}createElements(t,e,n,o){const r=[],s=[],i=new Set,a=new Set;for(const l of Object.values(n)){if(l.value==="marimo"&&l.name==="mo")continue;const{declaredBy:c,usedBy:d}=l;for(const h of c)for(const f of d){const p=`${h}-${f}`;a.has(p)||(a.add(p),i.add(h),i.add(f),s.push(this.createEdge(h,f)))}}for(const[l,c]of Lp.zip(t,e)){o||r.push(this.createNode(l,c));const d=i.has(l),h=ct.get(c).code.trim().startsWith("mo.md");!d&&h||r.push(this.createNode(l,c))}return{nodes:r,edges:s}}},fL=t=>{const e=X.c(43),{cellIds:n,variables:o,cellAtoms:r,children:s,layoutDirection:i,settings:a}=t;let l;e[0]!==r||e[1]!==n||e[2]!==i||e[3]!==a.hidePureMarkdown||e[4]!==o?(l=()=>{let S=t3.createElements(n,r,o,a.hidePureMarkdown);return S=e3(S.nodes,S.edges,{direction:i}),S},e[0]=r,e[1]=n,e[2]=i,e[3]=a.hidePureMarkdown,e[4]=o,e[5]=l):l=e[5];const[c]=T.useState(l),[d,h,f]=O2(c.nodes),[p,_,g]=D2(c.edges),m=Li();let b;e[6]!==i||e[7]!==_||e[8]!==h?(b=S=>{const $=e3(S.nodes,S.edges,{direction:i});h($.nodes),_($.edges)},e[6]=i,e[7]=_,e[8]=h,e[9]=b):b=e[9];const y=Xe(b);let x,v;e[10]!==r||e[11]!==n||e[12]!==a.hidePureMarkdown||e[13]!==y||e[14]!==o?(x=()=>{y(t3.createElements(n,r,o,a.hidePureMarkdown))},v=[n,o,r,y,a.hidePureMarkdown],e[10]=r,e[11]=n,e[12]=a.hidePureMarkdown,e[13]=y,e[14]=o,e[15]=x,e[16]=v):(x=e[15],v=e[16]),T.useEffect(x,v);const[C,k]=T.useState();let E;U2(),e[17]===Symbol.for("react.memo_cache_sentinel")?(E=()=>{k(void 0)},e[17]=E):E=e[17];const N=E;let I,A,M,R,z,D,F,B,U,O;return e[18]===Symbol.for("react.memo_cache_sentinel")?(I={minZoom:.5,maxZoom:1.5},A=(S,$)=>{k({type:"node",id:$.id})},M=(S,$)=>{const{source:j,target:W}=$;k({type:"edge",source:j,target:W})},e[18]=I,e[19]=A,e[20]=M):(I=e[18],A=e[19],M=e[20]),e[21]===Symbol.for("react.memo_cache_sentinel")?(R=u.jsx(OP,{color:"#ccc",variant:Dn.Dots}),e[21]=R):R=e[21],e[22]!==m||e[23]!==d?(z=()=>{const S=ct.get(o$);if(S){const $=d.find(j=>j.id===S);$&&(m.fitView({padding:1,duration:600,nodes:[$]}),k({type:"node",id:S}))}},e[22]=m,e[23]=d,e[24]=z):z=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(D=u.jsx(wm,{className:"size-4"}),e[25]=D):D=e[25],e[26]!==z?(F=u.jsx(jP,{position:"bottom-right",showInteractive:!1,children:u.jsx(Ae,{content:"Jump to focused cell",delayDuration:200,side:"left",asChild:!1,children:u.jsx(xs,{onMouseDown:Pn.preventFocus,onClick:z,children:D})})}),e[26]=z,e[27]=F):F=e[27],e[28]!==p||e[29]!==C||e[30]!==o?(B=u.jsx(Hl,{selection:C,variables:o,edges:p,onClearSelection:N}),e[28]=p,e[29]=C,e[30]=o,e[31]=B):B=e[31],e[32]!==s||e[33]!==p||e[34]!==d||e[35]!==g||e[36]!==f||e[37]!==F||e[38]!==B?(U=u.jsxs(nf,{nodes:d,edges:p,nodeTypes:z2,minZoom:.2,fitViewOptions:I,onNodeClick:A,onEdgeClick:M,onNodeDoubleClick:pL,fitView:!0,onNodesChange:f,onEdgesChange:g,zoomOnDoubleClick:!1,nodesConnectable:!1,children:[R,F,B,s]}),e[32]=s,e[33]=p,e[34]=d,e[35]=g,e[36]=f,e[37]=F,e[38]=B,e[39]=U):U=e[39],e[40]!==i||e[41]!==U?(O=u.jsx(L2,{value:i,children:U}),e[40]=i,e[41]=U,e[42]=O):O=e[42],O};function pL(t,e){eS(e.id,"focus")}const mL=Ht("_minimap_"),gL=Ht({hidePureMarkdown:!0}),_L=t=>{const e=X.c(11),[n,o]=tn(mL),[r,s]=tn(gL);let i;e[0]!==n||e[1]!==t||e[2]!==o||e[3]!==s||e[4]!==r?(i=()=>n==="_minimap_"?u.jsx(FP,{...t,children:u.jsx(sf,{settings:r,onSettingsChange:s,view:n,onChange:o})}):u.jsx(fL,{...t,settings:r,layoutDirection:n,children:u.jsx(sf,{settings:r,onSettingsChange:s,view:n,onChange:o})}),e[0]=n,e[1]=t,e[2]=o,e[3]=s,e[4]=r,e[5]=i):i=e[5];const a=i;let l,c;return e[6]!==a?(l=a(),e[6]=a,e[7]=l):l=e[7],e[8]!==n||e[9]!==l?(c=u.jsx(tf,{children:l},n),e[8]=n,e[9]=l,e[10]=c):c=e[10],c},bL=()=>{const t=X.c(5),e=tS(),n=Rc(),[o]=r$();let r,s;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=je("w-full h-full flex-1 mx-auto -mb-4 relative"),t[0]=r):r=t[0],t[1]!==n.inOrderIds||t[2]!==o||t[3]!==e?(s=u.jsx("div",{className:r,children:u.jsx(_L,{cellAtoms:o,variables:e,cellIds:n.inOrderIds})}),t[1]=n.inOrderIds,t[2]=o,t[3]=e,t[4]=s):s=t[4],s},yL=t=>{const e=X.c(4),{isOpen:n,children:o}=t,[r,s]=K.useState(!1);let i,a;return e[0]!==r||e[1]!==n?(i=()=>{n&&!r&&s(!0)},a=[n,r],e[0]=r,e[1]=n,e[2]=i,e[3]=a):(i=e[2],a=e[3]),K.useEffect(i,a),r?o:null},xL=t=>{const e=X.c(8),{variableName:n,className:o}=t;let r;e[0]!==n?(r=()=>{const l=function(d){const h=ct.get(nS)[d];if(h)return h.declaredBy[0]}(n);if(!l)return;const c=Kl(l);c&&zp(c,n)},e[0]=n,e[1]=r):r=e[1];const s=r;let i,a;return e[2]!==o?(i=je("text-link opacity-80 hover:opacity-100 hover:underline",o),e[2]=o,e[3]=i):i=e[3],e[4]!==s||e[5]!==i||e[6]!==n?(a=u.jsx("button",{type:"button",onClick:s,className:i,children:n}),e[4]=s,e[5]=i,e[6]=n,e[7]=a):a=e[7],a},wL=Ht(t=>{const e=t(s$),n=t(nS),o=t(Y4);return ha(e,r=>{if(!r.variable_name)return-1;const s=Object.values(n).find(a=>a.name===r.variable_name);if(!s)return 0;const i=o.inOrderIds.indexOf(s.declaredBy[0]);return i===-1?0:i})}),vL=Ht(t=>{const e=new Map(t(i$));for(const n of oS){const o=e.get(n);o&&o.databases.length===0&&e.delete(n)}return ha([...e.values()],n=>oS.has(n.name)?1:0)}),kL=()=>{const t=X.c(32),[e,n]=K.useState(""),o=Kt(rS),r=Be(wL),s=Be(vL);if(r.length===0&&s.length===0){let b;return t[0]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(gn,{title:"No tables found",description:"Any datasets/dataframes in the global scope will be shown here.",action:u.jsx(wg,{children:u.jsxs(Te,{variant:"outline",size:"sm",children:["Add database or catalog",u.jsx(ar,{className:"h-4 w-4 ml-2"})]})}),icon:u.jsx(or,{})}),t[0]=b):b=t[0],b}const i=!!e.trim();let a,l,c,d,h,f,p,_,g,m;if(t[1]!==o?(a=b=>{o(b.length>0),n(b)},t[1]=o,t[2]=a):a=t[2],t[3]!==e||t[4]!==a?(l=u.jsx(Gi,{placeholder:"Search tables...",className:"h-6 m-1",value:e,onValueChange:a,rootClassName:"flex-1 border-r"}),t[3]=e,t[4]=a,t[5]=l):l=t[5],t[6]!==i?(c=i&&u.jsx("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:()=>n(""),children:u.jsx(Jn,{className:"h-4 w-4"})}),t[6]=i,t[7]=c):c=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsx(wg,{children:u.jsx("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:u.jsx(ar,{className:"h-4 w-4"})})}),t[8]=d):d=t[8],t[9]!==l||t[10]!==c?(h=u.jsxs("div",{className:"flex items-center w-full",children:[l,c,d]}),t[9]=l,t[10]=c,t[11]=h):h=t[11],t[12]!==s||t[13]!==i||t[14]!==e){let b;t[16]!==i||t[17]!==e?(b=y=>u.jsx(SL,{connection:y,hasChildren:y.databases.length>0,children:y.databases.map(x=>u.jsx(CL,{engineName:y.name,database:x,hasSearch:i,children:u.jsx(NL,{schemas:x.schemas,defaultSchema:y.default_schema,defaultDatabase:y.default_database,engineName:y.name,databaseName:x.name,hasSearch:i,searchValue:e})},x.name))},y.name),t[16]=i,t[17]=e,t[18]=b):b=t[18],f=s.map(b),t[12]=s,t[13]=i,t[14]=e,t[15]=f}else f=t[15];return t[19]!==s.length||t[20]!==r.length?(p=s.length>0&&r.length>0&&u.jsxs(sS,{children:[u.jsx(Ql,{className:"h-4 w-4 text-muted-foreground"}),u.jsx("span",{className:"text-xs",children:"Python"})]}),t[19]=s.length,t[20]=r.length,t[21]=p):p=t[21],t[22]!==e||t[23]!==r?(_=r.length>0&&u.jsx(n3,{tables:r,searchValue:e}),t[22]=e,t[23]=r,t[24]=_):_=t[24],t[25]!==f||t[26]!==p||t[27]!==_?(g=u.jsxs(Np,{className:"flex flex-col",children:[f,p,_]}),t[25]=f,t[26]=p,t[27]=_,t[28]=g):g=t[28],t[29]!==h||t[30]!==g?(m=u.jsxs(fc,{className:"border-b bg-background rounded-none h-full pb-10 overflow-auto outline-none",shouldFilter:!1,children:[h,g]}),t[29]=h,t[30]=g,t[31]=m):m=t[31],m},SL=t=>{const e=X.c(25),{connection:n,children:o,hasChildren:r}=t,s=n.name===a$,i=s?"In-Memory":n.name,[a,l]=K.useState(!1);let c;e[0]!==n.name?(c=async()=>{l(!0),await c$({engine:n.name}),setTimeout(()=>l(!1),500)},e[0]=n.name,e[1]=c):c=e[1];const d=c;let h,f,p;e[2]!==n.dialect?(h=u.jsx(Q3,{className:"h-4 w-4 text-muted-foreground",name:n.dialect}),e[2]=n.dialect,e[3]=h):h=e[3],e[4]!==n.dialect?(f=l$(n.dialect),e[4]=n.dialect,e[5]=f):f=e[5],e[6]!==f?(p=u.jsx("span",{className:"text-xs",children:f}),e[6]=f,e[7]=p):p=e[7];const _=i;let g,m,b,y,x;return e[8]!==_?(g=u.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",u.jsx(xL,{variableName:_}),")"]}),e[8]=_,e[9]=g):g=e[9],e[10]!==d||e[11]!==s||e[12]!==a?(m=!s&&u.jsx(Ae,{content:"Refresh connection",children:u.jsx(Te,{variant:"ghost",size:"icon",className:"ml-auto hover:bg-transparent hover:shadow-none",onClick:d,children:u.jsx(Cc,{className:je("h-4 w-4 text-muted-foreground hover:text-foreground",a&&"animate-[spin_0.5s]")})})}),e[10]=d,e[11]=s,e[12]=a,e[13]=m):m=e[13],e[14]!==h||e[15]!==p||e[16]!==g||e[17]!==m?(b=u.jsxs(sS,{children:[h,p,g,m]}),e[14]=h,e[15]=p,e[16]=g,e[17]=m,e[18]=b):b=e[18],e[19]!==o||e[20]!==r?(y=r?o:u.jsx(Pc,{content:"No databases available",className:"pl-2"}),e[19]=o,e[20]=r,e[21]=y):y=e[21],e[22]!==b||e[23]!==y?(x=u.jsxs(u.Fragment,{children:[b,y]}),e[22]=b,e[23]=y,e[24]=x):x=e[24],x},CL=t=>{const e=X.c(28),{hasSearch:n,engineName:o,database:r,children:s}=t,[i,a]=K.useState(!1),[l,c]=K.useState(!1);let d,h,f;e[0]!==n?(d=()=>{a(n)},h=[n],e[0]=n,e[1]=d,e[2]=h):(d=e[1],h=e[2]),K.useEffect(d,h),e[3]!==i||e[4]!==l?(f=()=>{a(!i),c(!l)},e[3]=i,e[4]=l,e[5]=f):f=e[5];const p=`${o}:${r.name}`;let _;e[6]!==i?(_=u.jsx(dS,{isExpanded:i}),e[6]=i,e[7]=_):_=e[7];const g=l&&i?"text-foreground":"text-muted-foreground";let m,b;e[8]!==g?(m=je("h-4 w-4",g),e[8]=g,e[9]=m):m=e[9],e[10]!==m?(b=u.jsx(or,{className:m}),e[10]=m,e[11]=b):b=e[11];const y=l&&i&&"font-semibold";let x,v,C,k;e[12]!==y?(x=je(y),e[12]=y,e[13]=x):x=e[13],e[14]!==r.name?(v=r.name===""?u.jsx("i",{children:"Not connected"}):r.name,e[14]=r.name,e[15]=v):v=e[15],e[16]!==x||e[17]!==v?(C=u.jsx("span",{className:x,children:v}),e[16]=x,e[17]=v,e[18]=C):C=e[18],e[19]!==C||e[20]!==f||e[21]!==p||e[22]!==_||e[23]!==b?(k=u.jsxs(lo,{className:"text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",onSelect:f,value:p,children:[_,b,C]}),e[19]=C,e[20]=f,e[21]=p,e[22]=_,e[23]=b,e[24]=k):k=e[24];const E=i&&s;let N;return e[25]!==k||e[26]!==E?(N=u.jsxs(u.Fragment,{children:[k,E]}),e[25]=k,e[26]=E,e[27]=N):N=e[27],N},NL=t=>{const e=X.c(20),{schemas:n,defaultSchema:o,defaultDatabase:r,engineName:s,databaseName:i,hasSearch:a,searchValue:l}=t;if(n.length===0){let h;return e[0]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(Pc,{content:"No schemas available",className:"pl-6"}),e[0]=h):h=e[0],h}let c,d;if(e[1]!==i||e[2]!==r||e[3]!==o||e[4]!==s||e[5]!==a||e[6]!==n||e[7]!==l){let h;e[9]!==l?(h=_=>!l||_.tables.some(g=>g.name.toLowerCase().includes(l.toLowerCase())),e[9]=l,e[10]=h):h=e[10];const f=n.filter(h);let p;e[11]!==i||e[12]!==r||e[13]!==o||e[14]!==s||e[15]!==a||e[16]!==l?(p=_=>u.jsx(jL,{databaseName:i,schema:_,hasSearch:a,children:u.jsx(n3,{tables:_.tables,searchValue:l,sqlTableContext:{engine:s,database:i,schema:_.name,defaultSchema:o,defaultDatabase:r}})},_.name),e[11]=i,e[12]=r,e[13]=o,e[14]=s,e[15]=a,e[16]=l,e[17]=p):p=e[17],c=f.map(p),e[1]=i,e[2]=r,e[3]=o,e[4]=s,e[5]=a,e[6]=n,e[7]=l,e[8]=c}else c=e[8];return e[18]!==c?(d=u.jsx(u.Fragment,{children:c}),e[18]=c,e[19]=d):d=e[19],d},jL=t=>{const e=X.c(26),{databaseName:n,schema:o,children:r,hasSearch:s}=t,[i,a]=K.useState(!1),[l,c]=K.useState(!1),d=`${n}:${o.name}`;let h,f,p,_;if(e[0]!==s?(h=()=>{a(s)},f=[s],e[0]=s,e[1]=h,e[2]=f):(h=e[1],f=e[2]),K.useEffect(h,f),cS(o.name))return r;e[3]!==i||e[4]!==l?(p=()=>{a(!i),c(!l)},e[3]=i,e[4]=l,e[5]=p):p=e[5],e[6]!==i?(_=u.jsx(dS,{isExpanded:i}),e[6]=i,e[7]=_):_=e[7];const g=l&&i&&"text-foreground";let m,b;e[8]!==g?(m=je("h-4 w-4 text-muted-foreground",g),e[8]=g,e[9]=m):m=e[9],e[10]!==m?(b=u.jsx(g$,{className:m}),e[10]=m,e[11]=b):b=e[11];const y=l&&i&&"font-semibold";let x,v,C;e[12]!==y?(x=je(y),e[12]=y,e[13]=x):x=e[13],e[14]!==o.name||e[15]!==x?(v=u.jsx("span",{className:x,children:o.name}),e[14]=o.name,e[15]=x,e[16]=v):v=e[16],e[17]!==v||e[18]!==p||e[19]!==_||e[20]!==b||e[21]!==d?(C=u.jsxs(lo,{className:"text-sm flex flex-row gap-1 items-center pl-5 cursor-pointer rounded-none",onSelect:p,value:d,children:[_,b,v]}),e[17]=v,e[18]=p,e[19]=_,e[20]=b,e[21]=d,e[22]=C):C=e[22];const k=i&&r;let E;return e[23]!==C||e[24]!==k?(E=u.jsxs(u.Fragment,{children:[C,k]}),e[23]=C,e[24]=k,e[25]=E):E=e[25],E},n3=t=>{const e=X.c(24),{tables:n,sqlTableContext:o,searchValue:r}=t,{addTableList:s}=iS(),[i,a]=K.useState(!1),[l,c]=K.useState(!1);let d,h;e[0]!==s||e[1]!==o||e[2]!==n.length||e[3]!==i?(d=async()=>{if(n.length===0&&o&&!i){a(!0),c(!0);const{engine:m,database:b,schema:y}=o,x=await zH.request({engine:m,database:b,schema:y});if(!(x!=null&&x.tables))throw c(!1),new Error("No tables available");s({tables:x.tables,sqlTableContext:o}),c(!1)}},e[0]=s,e[1]=o,e[2]=n.length,e[3]=i,e[4]=d):d=e[4],e[5]!==o||e[6]!==n.length||e[7]!==i?(h=[n.length,o,i],e[5]=o,e[6]=n.length,e[7]=i,e[8]=h):h=e[8];const{isPending:f,error:p}=zn(d,h);if(f||l){let m;return e[9]===Symbol.for("react.memo_cache_sentinel")?(m=u.jsx(aS,{message:"Loading tables...",className:"pl-12"}),e[9]=m):m=e[9],m}if(p){let m;return e[10]!==p?(m=u.jsx(lS,{error:p,className:"pl-12"}),e[10]=p,e[11]=m):m=e[11],m}if(n.length===0){let m;return e[12]===Symbol.for("react.memo_cache_sentinel")?(m=u.jsx(Pc,{content:"No tables found",className:"pl-9"}),e[12]=m):m=e[12],m}let _,g;if(e[13]!==r||e[14]!==o||e[15]!==n){let m;e[17]!==r?(m=x=>!r||x.name.toLowerCase().includes(r.toLowerCase()),e[17]=r,e[18]=m):m=e[18];const b=n.filter(m);let y;e[19]!==r||e[20]!==o?(y=x=>u.jsx(EL,{table:x,sqlTableContext:o,isSearching:!!r},x.name),e[19]=r,e[20]=o,e[21]=y):y=e[21],_=b.map(y),e[13]=r,e[14]=o,e[15]=n,e[16]=_}else _=e[16];return e[22]!==_?(g=u.jsx(u.Fragment,{children:_}),e[22]=_,e[23]=g):g=e[23],g},EL=t=>{const e=X.c(62),{table:n,sqlTableContext:o,isSearching:r}=t,{addTable:s}=iS(),[i,a]=K.useState(!1),[l,c]=K.useState(!1),d=n.columns.length>0;let h,f;e[0]!==s||e[1]!==i||e[2]!==o||e[3]!==n.name||e[4]!==d||e[5]!==l?(h=async()=>{if(i&&!d&&o&&!l){c(!0);const{engine:q,database:te,schema:re}=o,ie=await BH.request({engine:q,database:te,schema:re,tableName:n.name});if(!(ie!=null&&ie.table))throw new Error("No table details available");s({table:ie.table,sqlTableContext:o})}},e[0]=s,e[1]=i,e[2]=o,e[3]=n.name,e[4]=d,e[5]=l,e[6]=h):h=e[6],e[7]!==i||e[8]!==d?(f=[i,d],e[7]=i,e[8]=d,e[9]=f):f=e[9];const{isPending:p,error:_}=zn(h,f),g=Be(Hi),m=Or(),{createNewCell:b}=kt();let y;e[10]!==g||e[11]!==b||e[12]!==m||e[13]!==o||e[14]!==n?(y=()=>{ao(g,b,m),b({code:(()=>{if(n.source_type==="catalog"){const q=o!=null&&o.database?`${o.database}.${n.name}`:n.name;return`${n.engine}.load_table("${q}")`}if(o)return uS(n,"*",o);switch(n.source_type){case"local":return`mo.ui.table(${n.name})`;case"duckdb":case"connection":return uS(n,"*",o);default:return ic(n.source_type),""}})(),before:!1,cellId:m??"__end__"})},e[10]=g,e[11]=b,e[12]=m,e[13]=o,e[14]=n,e[15]=y):y=e[15];const x=y;let v;e[16]!==n.num_columns||e[17]!==n.num_rows?(v=()=>{const q=[];return n.num_rows!=null&&q.push(`${n.num_rows} rows`),n.num_columns!=null&&q.push(`${n.num_columns} columns`),q.length===0?null:u.jsx("div",{className:"flex flex-row gap-2 items-center pl-6 group-hover:hidden",children:u.jsx("span",{className:"text-xs text-muted-foreground",children:q.join(", ")})})},e[16]=n.num_columns,e[17]=n.num_rows,e[18]=v):v=e[18];const C=v;let k;e[19]!==_||e[20]!==p||e[21]!==o||e[22]!==n?(k=()=>{if(p)return u.jsx(aS,{message:"Loading columns...",className:"pl-12"});if(_)return u.jsx(lS,{error:_,className:"pl-12"});const q=n.columns;return q.length===0?u.jsx(Pc,{content:"No columns found",className:"pl-12"}):q.map(te=>u.jsx(IL,{table:n,column:te,sqlTableContext:o},te.name))},e[19]=_,e[20]=p,e[21]=o,e[22]=n,e[23]=k):k=e[23];const E=k;let N;e[24]!==i||e[25]!==r||e[26]!==n.source_type||e[27]!==n.type?(N=()=>{if(n.source_type==="local")return;const q=n.type==="table"?d$:F3;return u.jsx(q,{className:"h-3 w-3",strokeWidth:i||r?2.5:void 0})},e[24]=i,e[25]=r,e[26]=n.source_type,e[27]=n.type,e[28]=N):N=e[28];const I=N,A=o?`${o.database}.${o.schema}.${n.name}`:n.name,M=o&&(cS(o.schema)?"pl-9":"pl-12"),R=(i||r)&&"font-semibold";let z,D,F,B,U,O,S,$,j,W,Y,G;return e[29]!==M||e[30]!==R?(z=je("rounded-none group h-8 cursor-pointer",M,R),e[29]=M,e[30]=R,e[31]=z):z=e[31],e[32]!==i?(D=()=>a(!i),e[32]=i,e[33]=D):D=e[33],e[34]!==I?(F=I(),e[34]=I,e[35]=F):F=e[35],e[36]!==n.name?(B=u.jsx("span",{className:"text-sm",children:n.name}),e[36]=n.name,e[37]=B):B=e[37],e[38]!==F||e[39]!==B?(U=u.jsxs("div",{className:"flex gap-2 items-center flex-1",children:[F,B]}),e[38]=F,e[39]=B,e[40]=U):U=e[40],e[41]!==C?(O=C(),e[41]=C,e[42]=O):O=e[42],e[43]!==x?(S=Pn.stopPropagation(()=>x()),e[43]=x,e[44]=S):S=e[44],e[45]===Symbol.for("react.memo_cache_sentinel")?($=u.jsx(u$,{className:"h-3 w-3"}),e[45]=$):$=e[45],e[46]!==S?(j=u.jsx(Ae,{content:"Add table to notebook",delayDuration:400,children:u.jsx(Te,{className:"group-hover:inline-flex hidden",variant:"text",size:"icon",onClick:S,children:$})}),e[46]=S,e[47]=j):j=e[47],e[48]!==i||e[49]!==D||e[50]!==U||e[51]!==O||e[52]!==j||e[53]!==z||e[54]!==A?(W=u.jsxs(lo,{className:z,value:A,"aria-selected":i,forceMount:!0,onSelect:D,children:[U,O,j]}),e[48]=i,e[49]=D,e[50]=U,e[51]=O,e[52]=j,e[53]=z,e[54]=A,e[55]=W):W=e[55],e[56]!==i||e[57]!==E?(Y=i&&E(),e[56]=i,e[57]=E,e[58]=Y):Y=e[58],e[59]!==W||e[60]!==Y?(G=u.jsxs(u.Fragment,{children:[W,Y]}),e[59]=W,e[60]=Y,e[61]=G):G=e[61],G},IL=t=>{var Y,G;const e=X.c(53),{table:n,column:o,sqlTableContext:r}=t,[s,i]=K.useState(!1),a=Be(rS),l=Kt(h$);let c,d;e[0]!==a?(c=()=>{a&&i(!1)},d=[a],e[0]=a,e[1]=c,e[2]=d):(c=e[1],d=e[2]),K.useEffect(c,d),l(s?q=>new Set([...q,`${n.name}:${o.name}`]):q=>(q.delete(`${n.name}:${o.name}`),new Set(q)));const h=Be(Hi),f=Or(),{createNewCell:p}=kt(),{columnsPreviews:_}=f$();let g;e[3]!==o.name||e[4]!==n.primary_keys?(g=((Y=n.primary_keys)==null?void 0:Y.includes(o.name))||!1,e[3]=o.name,e[4]=n.primary_keys,e[5]=g):g=e[5];const m=g;let b;e[6]!==o.name||e[7]!==n.indexes?(b=((G=n.indexes)==null?void 0:G.includes(o.name))||!1,e[6]=o.name,e[7]=n.indexes,e[8]=b):b=e[8];const y=b;let x;e[9]!==h||e[10]!==p||e[11]!==f?(x=q=>{q.includes("alt")&&_$(h,p,f),p({code:q,before:!1,cellId:f??"__end__"})},e[9]=h,e[10]=p,e[11]=f,e[12]=x):x=e[12];const v=x,C=AL,k=s?"font-semibold":"";let E;e[13]!==o.name||e[14]!==k?(E=u.jsx("span",{className:k,children:o.name}),e[13]=o.name,e[14]=k,e[15]=E):E=e[15];const N=E,I=`${n.name}.${o.name}`,A=`${n.name}.${o.name}`;let M;e[16]!==s?(M=()=>i(!s),e[16]=s,e[17]=M):M=e[17];const R=r?"pl-14":"pl-7";let z,D,F,B,U,O,S,$,j,W;return e[18]!==R?(z=je("flex flex-row gap-2 items-center flex-1",R),e[18]=R,e[19]=z):z=e[19],e[20]!==o.type||e[21]!==N?(D=u.jsx(p$,{columnName:N,dataType:o.type}),e[20]=o.type,e[21]=N,e[22]=D):D=e[22],e[23]!==m?(F=m&&C({tooltipContent:"Primary key",content:"PK"}),e[23]=m,e[24]=F):F=e[24],e[25]!==y?(B=y&&C({tooltipContent:"Indexed",content:"IDX"}),e[25]=y,e[26]=B):B=e[26],e[27]!==z||e[28]!==D||e[29]!==F||e[30]!==B?(U=u.jsxs("div",{className:z,children:[D,F,B]}),e[27]=z,e[28]=D,e[29]=F,e[30]=B,e[31]=U):U=e[31],e[32]!==o.name?(O=u.jsx(Ae,{content:"Copy column name",delayDuration:400,children:u.jsx(Te,{variant:"text",size:"icon",className:"group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground",children:u.jsx(Z4,{tooltip:!1,value:o.name,className:"h-3 w-3"})})}),e[32]=o.name,e[33]=O):O=e[33],e[34]!==o.external_type?(S=u.jsx("span",{className:"text-xs text-muted-foreground",children:o.external_type}),e[34]=o.external_type,e[35]=S):S=e[35],e[36]!==M||e[37]!==U||e[38]!==O||e[39]!==S||e[40]!==I||e[41]!==A?($=u.jsxs(lo,{className:"rounded-none py-1 group cursor-pointer",value:A,onSelect:M,children:[U,O,S]},I),e[36]=M,e[37]=U,e[38]=O,e[39]=S,e[40]=I,e[41]=A,e[42]=$):$=e[42],e[43]!==o||e[44]!==_||e[45]!==v||e[46]!==s||e[47]!==r||e[48]!==n?(j=s&&u.jsx("div",{className:"pl-10 pr-2 py-2 bg-[var(--slate-1)] shadow-inner border-b",children:u.jsx(pc,{children:u.jsx(m$,{table:n,column:o,onAddColumnChart:v,preview:_.get(r?`${r.database}.${r.schema}.${n.name}:${o.name}`:`${n.name}:${o.name}`),sqlTableContext:r})})}),e[43]=o,e[44]=_,e[45]=v,e[46]=s,e[47]=r,e[48]=n,e[49]=j):j=e[49],e[50]!==$||e[51]!==j?(W=u.jsxs(u.Fragment,{children:[$,j]}),e[50]=$,e[51]=j,e[52]=W):W=e[52],W};function AL(t){const{tooltipContent:e,content:n}=t;return u.jsx(Ae,{content:e,delayDuration:100,children:u.jsx("span",{className:"text-xs text-black bg-gray-100 dark:invert rounded px-1",children:n})})}const TL=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx(kL,{}),t[0]=e):e=t[0],e},ML=()=>{const t=X.c(5),{documentation:e}=Be(b$);if(!e){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(gn,{title:"View docs as you type",description:"Move your text cursor over a symbol to see its documentation.",icon:u.jsx(ed,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=Fp({html:e}),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=u.jsx("div",{className:"p-3 overflow-y-auto overflow-x-hidden h-full docs-documentation flex flex-col gap-4",children:n}),t[3]=n,t[4]=o):o=t[4],o},OL=()=>{const t=X.c(5),e=y$();if(e.length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(gn,{title:"No errors!",icon:u.jsx(Em,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=e.map(DL),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=u.jsx("div",{className:"flex flex-col overflow-auto",children:n}),t[3]=n,t[4]=o):o=t[4],o};function DL(t){return u.jsxs("div",{children:[u.jsx("div",{className:"text-xs font-mono font-semibold bg-muted border-y px-2 py-1",children:u.jsx(x$,{cellId:t.cellId})}),u.jsx("div",{className:"px-2",children:u.jsx(w$,{errors:t.output.data,cellId:t.cellId},t.cellId)},t.cellId)]},t.cellId)}function o3(t,e,n){return t[e]?t[e][0]?t[e][0][n]:t[e][n]:e==="contentBoxSize"?t.contentRect[n==="inlineSize"?"width":"height"]:void 0}Qp=function(t){t===void 0&&(t={});var e=t.onResize,n=T.useRef(void 0);n.current=e;var o=t.round||Math.round,r=T.useRef(),s=T.useState({width:void 0,height:void 0}),i=s[0],a=s[1],l=T.useRef(!1);T.useEffect(function(){return l.current=!1,function(){l.current=!0}},[]);var c=T.useRef({width:void 0,height:void 0}),d=function(h,f){var p=T.useRef(null),_=T.useRef(null);_.current=f;var g=T.useRef(null);T.useEffect(function(){m()});var m=T.useCallback(function(){var b=g.current,y=_.current,x=b||(y?y instanceof Element?y:y.current:null);p.current&&p.current.element===x&&p.current.subscriber===h||(p.current&&p.current.cleanup&&p.current.cleanup(),p.current={element:x,subscriber:h,cleanup:x?h(x):void 0})},[h]);return T.useEffect(function(){return function(){p.current&&p.current.cleanup&&(p.current.cleanup(),p.current=null)}},[]),T.useCallback(function(b){g.current=b,m()},[m])}(T.useCallback(function(h){return r.current&&r.current.box===t.box&&r.current.round===o||(r.current={box:t.box,round:o,instance:new ResizeObserver(function(f){var p=f[0],_=t.box==="border-box"?"borderBoxSize":t.box==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",g=o3(p,_,"inlineSize"),m=o3(p,_,"blockSize"),b=g?o(g):void 0,y=m?o(m):void 0;if(c.current.width!==b||c.current.height!==y){var x={width:b,height:y};c.current.width=b,c.current.height=y,n.current?n.current(x):l.current||a(x)}})}),r.current.instance.observe(h,{box:t.box}),function(){r.current&&r.current.instance.unobserve(h)}},[t.box,o]),t.ref);return T.useMemo(function(){return{ref:d,width:i.width,height:i.height}},[d,i.width,i.height])};const Hf=new Map,RL=({file:t,onOpenNotebook:e})=>{const{theme:n}=lr(),o=Be(op),[r,s]=T.useState(""),{data:i,isPending:a,error:l,setData:c}=zn(async()=>{const g=await Bp({path:t.path}),m=g.contents||"";return s(Hf.get(t.path)||m),g},[t.path]),d=async()=>{r!==(i==null?void 0:i.contents)&&await I$({path:t.path,contents:r}).then(g=>{g.success&&(c(m=>({...m,contents:r})),s(r))})},h=T.useRef(r);if(h.current=r,T.useEffect(()=>()=>{if(!(i!=null&&i.contents))return;const g=h.current;g===i.contents?Hf.delete(t.path):Hf.set(t.path,g)},[t.path,i==null?void 0:i.contents]),l)return u.jsx(Rr,{error:l});if(a||!i)return null;const f=i.mimeType||"text/plain",p=f in Wf;if(!i.contents&&!p)return u.jsxs("div",{className:"grid grid-cols-2 gap-2 p-6",children:[u.jsx("div",{className:"font-bold text-muted-foreground",children:"Name"}),u.jsx("div",{children:i.file.name}),u.jsx("div",{className:"font-bold text-muted-foreground",children:"Type"}),u.jsx("div",{children:f})]});const _=u.jsxs("div",{className:"text-xs text-muted-foreground p-1 flex justify-end gap-2 border-b",children:[t.isMarimoFile&&!xn()&&u.jsx(Ae,{content:"Open notebook",children:u.jsx(mn,{size:"small",onClick:g=>e(g),children:u.jsx(uc,{})})}),u.jsx(Ae,{content:"Download",children:u.jsx(mn,{size:"small",onClick:()=>{if(r3(f)){const g=j$(i.contents,f);return void E$(g,i.file.name)}Xi(new Blob([i.contents||r],{type:f}),i.file.name)},children:u.jsx(hp,{})})}),!r3(f)&&u.jsxs(u.Fragment,{children:[u.jsx(Ae,{content:"Copy contents to clipboard",children:u.jsx(mn,{size:"small",onClick:async()=>{await pn(r)},children:u.jsx($i,{})})}),u.jsx(Ae,{content:nn("global.save"),children:u.jsx(mn,{size:"small",color:r===i.contents?void 0:"green",onClick:d,disabled:r===i.contents,children:u.jsx(ba,{})})})]})]});return f.startsWith("image/")?u.jsxs(u.Fragment,{children:[_,u.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:u.jsx(v$,{base64:i.contents,mime:f})})]}):f==="text/csv"&&i.contents?u.jsxs(u.Fragment,{children:[_,u.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:u.jsx(k$,{contents:i.contents})})]}):f.startsWith("audio/")?u.jsxs(u.Fragment,{children:[_,u.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:u.jsx(S$,{base64:i.contents,mime:f})})]}):f.startsWith("video/")?u.jsxs(u.Fragment,{children:[_,u.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:u.jsx(C$,{base64:i.contents,mime:f})})]}):f.startsWith("application/pdf")?u.jsxs(u.Fragment,{children:[_,u.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:u.jsx(N$,{base64:i.contents,mime:f})})]}):u.jsxs(u.Fragment,{children:[_,u.jsx("div",{className:"flex-1 overflow-auto",children:u.jsx(T.Suspense,{children:u.jsx(ca,{theme:n==="dark"?"dark":"light",language:Wf[f]||Wf.default,className:"border-b",extensions:[tt.lineWrapping,Bn.of([{key:o.getHotkey("global.save").key,stopPropagation:!0,run:()=>r!==i.contents&&(d(),!0)}])],value:r,onChange:s})})})]})},r3=t=>t.startsWith("image/")||t.startsWith("audio/")||t.startsWith("video/")||t.startsWith("application/pdf"),Wf={"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"},s3=Ht(new class{constructor(t){this.callbacks=t,this.delegate=new Gp([]),this.rootPath="",this.onChange=wn.NOOP,this.path=new lc("/"),this.initialize=async e=>{if(this.onChange=e,this.delegate.data.length===0)try{const n=await this.callbacks.listFiles({path:this.rootPath});this.delegate=new Gp(n.files),this.rootPath=n.root,this.path=lc.guessDeliminator(n.root)}catch(n){ut({title:"Failed",description:M4(n)})}this.onChange(this.delegate.data)},this.refreshAll=async e=>{const n=[this.rootPath,...e.map(r=>{var s;return(s=this.delegate.find(r))==null?void 0:s.data.path})].filter(Boolean),o=await Promise.all(n.map(r=>this.callbacks.listFiles({path:r}).catch(()=>({files:[]}))));for(const[r,s]of n.entries()){const i=o[r];s===this.rootPath?this.delegate=new Gp(i.files):this.delegate.update({id:s,changes:{children:i.files}})}this.onChange(this.delegate.data)},this.relativeFromRoot=e=>{const n=this.rootPath.endsWith(this.path.deliminator)?this.rootPath:`${this.rootPath}${this.path.deliminator}`;return e.startsWith(n)?e.slice(n.length):e},this.handleResponse=e=>e.success?e:(ut({title:"Failed",description:e.message}),null)}async expand(t){const e=this.delegate.find(t);if(!e||!e.data.isDirectory)return!1;if(e.children&&e.children.length>0)return!0;const n=await this.callbacks.listFiles({path:e.data.path});return this.delegate.update({id:t,changes:{children:n.files}}),this.onChange(this.delegate.data),!0}async rename(t,e){const n=this.delegate.find(t);if(!n)return;const o=n.data.path,r=this.path.join(this.path.dirname(o),e);await this.callbacks.renameFileOrFolder({path:o,newPath:r}).then(this.handleResponse),this.delegate.update({id:t,changes:{name:e,path:r}}),this.onChange(this.delegate.data),await this.refreshAll([r])}async move(t,e){var o;const n=e?((o=this.delegate.find(e))==null?void 0:o.data.path)??e:this.rootPath;await Promise.all(t.map(r=>{this.delegate.move({id:r,parentId:e,index:0});const s=this.delegate.find(r);if(!s)return Promise.resolve();const i=this.path.join(n,this.path.basename(s.data.path));return this.delegate.update({id:r,changes:{path:i}}),this.callbacks.renameFileOrFolder({path:s.data.path,newPath:i}).then(this.handleResponse)})),this.onChange(this.delegate.data),await this.refreshAll([n])}async createFile(t,e){var r;const n=e?((r=this.delegate.find(e))==null?void 0:r.data.path)??e:this.rootPath,o=await this.callbacks.createFileOrFolder({path:n,type:"file",name:t}).then(this.handleResponse);o!=null&&o.info&&(this.delegate.create({parentId:e,index:0,data:o.info}),this.onChange(this.delegate.data),await this.refreshAll([n]))}async createFolder(t,e){var r;const n=e?((r=this.delegate.find(e))==null?void 0:r.data.path)??e:this.rootPath,o=await this.callbacks.createFileOrFolder({path:n,type:"directory",name:t}).then(this.handleResponse);o!=null&&o.info&&(this.delegate.create({parentId:e,index:0,data:o.info}),this.onChange(this.delegate.data),await this.refreshAll([n]))}async delete(t){const e=this.delegate.find(t);e&&(await this.callbacks.deleteFileOrFolder({path:e.data.path}).then(this.handleResponse),this.delegate.drop({id:t}),this.onChange(this.delegate.data))}}({listFiles:a4,createFileOrFolder:Up,deleteFileOrFolder:T$,renameFileOrFolder:A$})),PL=Ht({});function LL(t){return new Promise((e,n)=>{const o=new FileReader;o.onload=r=>{var s;e((s=r.target)==null?void 0:s.result)},o.onerror=r=>{n(new Error(`Failed to read blob: ${r.type}`))},o.readAsDataURL(t)})}function i3(t){const e=X.c(4);let n;e[0]!==t?(n=t===void 0?{}:t,e[0]=t,e[1]=n):n=e[1];const o=n;let r;return e[2]!==o?(r={multiple:!0,maxSize:104857600,onError:VL,onDropRejected:zL,onDrop:FL,...o},e[2]=o,e[3]=r):r=e[3],M$(r)}async function FL(t){for(const e of t){const n=HL($L(e));let o="";n&&(o=lc.guessDeliminator(n).dirname(n));const r=(await LL(e)).split(",")[1];await Up({path:o,type:"file",name:e.name,contents:r})}await async function(){await ct.get(s3).refreshAll([])}()}function zL(t){ut({title:"File upload failed",description:u.jsx("div",{className:"flex flex-col gap-1",children:t.map(BL)}),variant:"danger"})}function BL(t){return u.jsxs("div",{children:[t.file.name," (",t.errors.map(UL).join(", "),")"]},t.file.name)}function UL(t){return t.message}function VL(t){It.error(t),ut({title:"File upload failed",description:t.message,variant:"danger"})}function $L(t){return t.webkitRelativePath?t.webkitRelativePath:"path"in t&&typeof t.path=="string"?t.path:"relativePath"in t&&typeof t.relativePath=="string"?t.relativePath:void 0}function HL(t){if(t)return t.replace(/^\/+/,"")}const a3=K.createContext(null),WL=t=>{const e=X.c(60),{height:n}=t,o=T.useRef(null),[r]=tn(s3);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=[],e[0]=s):s=e[0];const[i,a]=T.useState(s),[l,c]=T.useState(null),{openPrompt:d}=Fn(),[h,f]=tn(PL);let p,_;e[1]!==r?(p=()=>r.initialize(a),e[1]=r,e[2]=p):p=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(_=[],e[3]=_):_=e[3];const{isPending:g,error:m}=zn(p,_);let b;e[4]!==h||e[5]!==r?(b=()=>{r.refreshAll(Object.keys(h).filter(S=>h[S]))},e[4]=h,e[5]=r,e[6]=b):b=e[6];const y=Xe(b);let x;e[7]!==d||e[8]!==r?(x=async()=>{d({title:"Folder name",onConfirm:async S=>{r.createFolder(S,null)}})},e[7]=d,e[8]=r,e[9]=x):x=e[9];const v=Xe(x);let C;e[10]!==d||e[11]!==r?(C=async()=>{d({title:"File name",onConfirm:async S=>{r.createFile(S,null)}})},e[10]=d,e[11]=r,e[12]=C):C=e[12];const k=Xe(C);let E;e[13]!==f?(E=()=>{var S;(S=o.current)==null||S.closeAll(),f({})},e[13]=f,e[14]=E):E=e[14];const N=Xe(E);if(g){let S;return e[15]===Symbol.for("react.memo_cache_sentinel")?(S=u.jsx(Vn,{size:"medium",centered:!0}),e[15]=S):S=e[15],S}if(m){let S;return e[16]!==m?(S=u.jsx(Rr,{error:m}),e[16]=m,e[17]=S):S=e[17],S}if(l){let S,$,j,W,Y,G;return e[18]===Symbol.for("react.memo_cache_sentinel")?(S=()=>c(null),e[18]=S):S=e[18],e[19]===Symbol.for("react.memo_cache_sentinel")?($=u.jsx(Te,{onClick:S,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:u.jsx(Ct,{size:16})}),e[19]=$):$=e[19],e[20]!==l.name?(j=u.jsxs("div",{className:"flex items-center pl-1 pr-3 flex-shrink-0 border-b justify-between",children:[$,u.jsx("span",{className:"font-bold",children:l.name})]}),e[20]=l.name,e[21]=j):j=e[21],e[22]!==l.path||e[23]!==r?(W=q=>l3(q,r.relativeFromRoot(l.path)),e[22]=l.path,e[23]=r,e[24]=W):W=e[24],e[25]!==l||e[26]!==W?(Y=u.jsx(T.Suspense,{children:u.jsx(RL,{onOpenNotebook:W,file:l})}),e[25]=l,e[26]=W,e[27]=Y):Y=e[27],e[28]!==j||e[29]!==Y?(G=u.jsxs(u.Fragment,{children:[j,Y]}),e[28]=j,e[29]=Y,e[30]=G):G=e[30],G}let I;e[31]!==N||e[32]!==k||e[33]!==v||e[34]!==y||e[35]!==r?(I=u.jsx(GL,{onRefresh:y,onCreateFile:k,onCreateFolder:v,onCollapseAll:N,tree:r}),e[31]=N,e[32]=k,e[33]=v,e[34]=y,e[35]=r,e[36]=I):I=e[36];const A=n-33;let M,R,z,D,F,B,U,O;return e[37]!==r?(M=async S=>{const{ids:$}=S;for(const j of $)await r.delete(j)},R=async S=>{const{id:$,name:j}=S;await r.rename($,j)},z=async S=>{const{dragIds:$,parentId:j}=S;await r.move($,j)},e[37]=r,e[38]=M,e[39]=R,e[40]=z):(M=e[38],R=e[39],z=e[40]),e[41]===Symbol.for("react.memo_cache_sentinel")?(D=S=>{const $=S[0];$&&($.data.isDirectory||c($.data))},e[41]=D):D=e[41],e[42]!==h||e[43]!==f||e[44]!==r?(F=async S=>{if(await r.expand(S)){const $=h[S]??!1;f({...h,[S]:!$})}},e[42]=h,e[43]=f,e[44]=r,e[45]=F):F=e[45],e[46]!==i||e[47]!==h||e[48]!==M||e[49]!==R||e[50]!==z||e[51]!==F||e[52]!==A?(B=u.jsx(wH,{width:"100%",ref:o,height:A,className:"h-full",data:i,initialOpenState:h,openByDefault:!1,renderCursor:ZL,disableDrop:QL,onDelete:M,onRename:R,onMove:z,onSelect:D,onToggle:F,padding:15,rowHeight:30,indent:qL,overscanCount:1e3,disableMultiSelection:!0,children:KL}),e[46]=i,e[47]=h,e[48]=M,e[49]=R,e[50]=z,e[51]=F,e[52]=A,e[53]=B):B=e[53],e[54]!==B||e[55]!==r?(U=u.jsx(a3,{value:r,children:B}),e[54]=B,e[55]=r,e[56]=U):U=e[56],e[57]!==U||e[58]!==I?(O=u.jsxs(u.Fragment,{children:[I,U]}),e[57]=U,e[58]=I,e[59]=O):O=e[59],O},qL=15,GL=t=>{const e=X.c(30),{onRefresh:n,onCreateFile:o,onCreateFolder:r,onCollapseAll:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={noDrag:!0,noDragEventsBubbling:!0},e[0]=i):i=e[0];const{getRootProps:a,getInputProps:l}=i3(i);let c,d,h,f,p,_,g,m,b,y,x,v,C,k,E;return e[1]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(ga,{size:16}),e[1]=c):c=e[1],e[2]!==o?(d=u.jsx(Ae,{content:"Add file",children:u.jsx(Te,{"data-testid":"file-explorer-add-file-button",onClick:o,variant:"text",size:"xs",children:c})}),e[2]=o,e[3]=d):d=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(qc,{size:16}),e[4]=h):h=e[4],e[5]!==r?(f=u.jsx(Ae,{content:"Add folder",children:u.jsx(Te,{"data-testid":"file-explorer-add-folder-button",onClick:r,variant:"text",size:"xs",children:h})}),e[5]=r,e[6]=f):f=e[6],e[7]!==a?(p=a({}),e[7]=a,e[8]=p):p=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(_=O$({variant:"text",size:"xs"}),g=u.jsx(R$,{size:16}),e[9]=_,e[10]=g):(_=e[9],g=e[10]),e[11]!==p?(m=u.jsx(Ae,{content:"Upload file",children:u.jsx("button",{"data-testid":"file-explorer-upload-button",...p,className:_,children:g})}),e[11]=p,e[12]=m):m=e[12],e[13]!==l?(b=l({}),e[13]=l,e[14]=b):b=e[14],e[15]!==b?(y=u.jsx("input",{...b,type:"file"}),e[15]=b,e[16]=y):y=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx(L4,{size:16}),e[17]=x):x=e[17],e[18]!==n?(v=u.jsx(Ae,{content:"Refresh",children:u.jsx(Te,{"data-testid":"file-explorer-refresh-button",onClick:n,variant:"text",size:"xs",children:x})}),e[18]=n,e[19]=v):v=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(C=u.jsx(am,{size:16}),e[20]=C):C=e[20],e[21]!==s?(k=u.jsx(Ae,{content:"Collapse all folders",children:u.jsx(Te,{"data-testid":"file-explorer-collapse-button",onClick:s,variant:"text",size:"xs",children:C})}),e[21]=s,e[22]=k):k=e[22],e[23]!==y||e[24]!==v||e[25]!==k||e[26]!==d||e[27]!==f||e[28]!==m?(E=u.jsxs("div",{className:"flex items-center justify-end px-2 flex-shrink-0 border-b",children:[d,f,m,y,v,k]}),e[23]=y,e[24]=v,e[25]=k,e[26]=d,e[27]=f,e[28]=m,e[29]=E):E=e[29],E},YL=t=>{const e=X.c(9),{node:n,onOpenMarimoFile:o}=t;let r,s,i;return e[0]!==n?(r=a=>{n.data.isDirectory||(a.stopPropagation(),n.select())},e[0]=n,e[1]=r):r=e[1],e[2]!==n.data.isMarimoFile||e[3]!==o?(s=n.data.isMarimoFile&&!xn()&&u.jsxs("span",{className:"flex-shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline",onClick:o,children:["open ",u.jsx(uc,{className:"inline ml-1",size:12})]}),e[2]=n.data.isMarimoFile,e[3]=o,e[4]=s):s=e[4],e[5]!==n.data.name||e[6]!==r||e[7]!==s?(i=u.jsxs("span",{className:"flex-1 overflow-hidden text-ellipsis",onClick:r,children:[n.data.name,s]}),e[5]=n.data.name,e[6]=r,e[7]=s,e[8]=i):i=e[8],i},JL=t=>{const e=X.c(10),{node:n}=t,o=T.useRef(null);let r,s,i,a,l;return e[0]!==n.data.name?(r=()=>{var c,d;(c=o.current)==null||c.focus(),(d=o.current)==null||d.setSelectionRange(0,n.data.name.lastIndexOf("."))},s=[n.data.name],e[0]=n.data.name,e[1]=r,e[2]=s):(r=e[1],s=e[2]),T.useEffect(r,s),e[3]!==n?(i=()=>n.reset(),a=c=>{c.key==="Escape"&&n.reset(),c.key==="Enter"&&n.submit(c.currentTarget.value)},e[3]=n,e[4]=i,e[5]=a):(i=e[4],a=e[5]),e[6]!==n.data.name||e[7]!==i||e[8]!==a?(l=u.jsx("input",{ref:o,className:"flex-1 bg-transparent border border-border text-muted-foreground",defaultValue:n.data.name,onClick:eF,onBlur:i,onKeyDown:a}),e[6]=n.data.name,e[7]=i,e[8]=a,e[9]=l):l=e[9],l},KL=({node:t,style:e,dragHandle:n})=>{const o=t.data.isDirectory?"directory":s4(t.data.name),r=i4[o],{openConfirm:s,openPrompt:i}=Fn(),{createNewCell:a}=kt(),l=Or(),c=T.use(a3),d=async g=>{l3(g,c?c.relativeFromRoot(t.data.path):t.data.path)},h=async g=>{g.stopPropagation(),g.preventDefault(),s({title:"Delete file",description:`Are you sure you want to delete ${t.data.name}?`,confirmAction:u.jsx(e4,{onClick:async()=>{await t.tree.delete(t.id)},"aria-label":"Confirm",children:"Delete"})})},f=Xe(async()=>{t.open(),i({title:"Folder name",onConfirm:async g=>{c==null||c.createFolder(g,t.id)}})}),p=Xe(async()=>{t.open(),i({title:"File name",onConfirm:async g=>{c==null||c.createFile(g,t.id)}})}),_=Xe(async()=>{var y;if(!c||t.data.isDirectory)return;const[g,m]=D$(t.data.name),b=`${g}_copy${m}`;try{const x=await Bp({path:t.data.path}),v=((y=t.parent)==null?void 0:y.data.path)||"";await Up({path:v,type:"file",name:b,contents:x.contents?btoa(x.contents):void 0}),await c.refreshAll([v])}catch{ut({title:"Failed to duplicate file",description:"Unable to create a duplicate of the file",variant:"danger"})}});return u.jsxs("div",{style:e,ref:n,className:je("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group"),draggable:!0,onClick:g=>{g.stopPropagation(),t.data.isDirectory&&t.toggle()},children:[u.jsx(XL,{node:t}),u.jsxs("span",{className:je("flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group",t.willReceiveDrop&&t.data.isDirectory&&"bg-accent/80 hover:bg-accent/80 text-accent-foreground"),children:[t.data.isMarimoFile?u.jsx("img",{src:"./favicon.ico",className:"w-5 h-5 flex-shrink-0 mr-2 filter grayscale",alt:"Marimo"}):u.jsx(r,{className:"w-5 h-5 flex-shrink-0 mr-2",strokeWidth:1.5}),t.isEditing?u.jsx(JL,{node:t}):u.jsx(YL,{node:t,onOpenMarimoFile:d}),u.jsxs(Es,{modal:!1,children:[u.jsx(Is,{asChild:!0,tabIndex:-1,onClick:g=>g.stopPropagation(),children:u.jsx(Te,{"data-testid":"file-explorer-more-button",variant:"text",tabIndex:-1,size:"xs",className:"mb-0","aria-label":"More options",children:u.jsx(Wc,{strokeWidth:2,className:"w-5 h-5 hidden group-hover:block"})})}),(()=>{const g={size:14,strokeWidth:1.5,className:"mr-2"};return u.jsxs(As,{align:"end",className:"no-print w-[220px]",onClick:m=>m.stopPropagation(),onCloseAutoFocus:m=>m.preventDefault(),children:[!t.data.isDirectory&&u.jsxs(Wt,{onSelect:()=>t.select(),children:[u.jsx($m,{...g}),"Open file"]}),!t.data.isDirectory&&!xn()&&u.jsxs(Wt,{onSelect:()=>{P$({path:t.data.path})},children:[u.jsx(uc,{...g}),"Open file in external editor"]}),t.data.isDirectory&&u.jsxs(u.Fragment,{children:[u.jsxs(Wt,{onSelect:()=>p(),children:[u.jsx(ga,{...g}),"Create file"]}),u.jsxs(Wt,{onSelect:()=>f(),children:[u.jsx(qc,{...g}),"Create folder"]}),u.jsx(co,{})]}),u.jsxs(Wt,{onSelect:()=>t.edit(),children:[u.jsx(Im,{...g}),"Rename"]}),!t.data.isDirectory&&u.jsxs(Wt,{onSelect:_,children:[u.jsx($i,{...g}),"Duplicate"]}),u.jsxs(Wt,{onSelect:async()=>{await pn(t.data.path),ut({title:"Copied to clipboard"})},children:[u.jsx(Jc,{...g}),"Copy path"]}),c&&u.jsxs(Wt,{onSelect:async()=>{await pn(c.relativeFromRoot(t.data.path)),ut({title:"Copied to clipboard"})},children:[u.jsx(Jc,{...g}),"Copy relative path"]}),u.jsx(co,{}),u.jsxs(Wt,{onSelect:()=>{const{path:m}=t.data;(b=>{a({code:b,before:!1,cellId:l??"__end__"})})(hS[o](m))},children:[u.jsx(Fr,{...g}),"Insert snippet for reading file"]}),u.jsxs(Wt,{onSelect:async()=>{ut({title:"Copied to clipboard",description:"Code to open the file has been copied to your clipboard. You can also drag and drop this file into the editor"});const{path:m}=t.data,b=hS[o](m);await pn(b)},children:[u.jsx(L$,{...g}),"Copy snippet for reading file"]}),t.data.isMarimoFile&&!xn()&&u.jsxs(u.Fragment,{children:[u.jsx(co,{}),u.jsxs(Wt,{onSelect:d,children:[u.jsx(Fm,{...g}),"Open notebook"]})]}),u.jsx(co,{}),!t.data.isDirectory&&u.jsxs(u.Fragment,{children:[u.jsxs(Wt,{onSelect:async()=>{const m=(await Bp({path:t.data.path})).contents||"";Xi(new Blob([m]),t.data.name)},children:[u.jsx(hp,{...g}),"Download"]}),u.jsx(co,{})]}),u.jsxs(Wt,{onSelect:h,variant:"danger",children:[u.jsx(np,{...g}),"Delete"]})]})})()]})]})]})},XL=t=>{const e=X.c(3),{node:n}=t;if(!n.data.isDirectory){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx("span",{className:"w-5 h-5 flex-shrink-0"}),e[0]=r):r=e[0],r}let o;return e[1]!==n.isOpen?(o=n.isOpen?u.jsx(js,{className:"w-5 h-5 flex-shrink-0"}):u.jsx(qi,{className:"w-5 h-5 flex-shrink-0"}),e[1]=n.isOpen,e[2]=o):o=e[2],o};function l3(t,e){t.stopPropagation(),t.preventDefault(),window.open(`/?file=${e}`,"_blank")}function ZL(){return null}function QL(t){const{parentNode:e}=t;return!e.data.isDirectory}function eF(t){return t.stopPropagation()}let c3,d3,u3;c3=()=>{const t=X.c(20),{ref:e,height:n}=Qp(),o=n===void 0?1:n;let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={noClick:!0,noKeyboard:!0},t[0]=r):r=t[0];const{getRootProps:s,getInputProps:i,isDragActive:a}=i3(r);let l,c,d,h,f,p,_,g;return t[1]!==s?(l=s(),t[1]=s,t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(c=je("flex flex-col flex-1 overflow-hidden relative"),t[3]=c):c=t[3],t[4]!==i?(d=i(),t[4]=i,t[5]=d):d=t[5],t[6]!==d?(h=u.jsx("input",{...d}),t[6]=d,t[7]=h):h=t[7],t[8]!==a?(f=a&&u.jsx("div",{className:"absolute inset-0 flex items-center uppercase justify-center text-xl font-bold text-primary/90 bg-accent/85 z-10 border-2 border-dashed border-primary/90 rounded-lg pointer-events-none",children:"Drop files here"}),t[8]=a,t[9]=f):f=t[9],t[10]!==o?(p=u.jsx(WL,{height:o}),t[10]=o,t[11]=p):p=t[11],t[12]!==e||t[13]!==p?(_=u.jsx("div",{ref:e,className:"flex flex-col flex-1 overflow-hidden",children:p}),t[12]=e,t[13]=p,t[14]=_):_=t[14],t[15]!==l||t[16]!==h||t[17]!==f||t[18]!==_?(g=u.jsxs("div",{...l,className:c,children:[h,f,_]}),t[15]=l,t[16]=h,t[17]=f,t[18]=_,t[19]=g):g=t[19],g},Zp=t=>{const e=X.c(6),n=t.dataTestId;let o,r;return e[0]!==t.className?(o=je("text-xs font-semibold text-accent-foreground",t.className),e[0]=t.className,e[1]=o):o=e[1],e[2]!==t.dataTestId||e[3]!==t.onClick||e[4]!==o?(r=u.jsx("button",{type:"button","data-testid":n,className:o,onClick:t.onClick,children:"Clear"}),e[2]=t.dataTestId,e[3]=t.onClick,e[4]=o,e[5]=r):r=e[5],r},d3=()=>{const t=X.c(9),e=F$(),{clearLogs:n}=kt();if(e.length===0){let i,a;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx("code",{className:"border rounded px-1",children:"stdout"}),t[0]=i):i=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx(gn,{title:"No logs",description:u.jsxs("span",{children:[i," and"," ",u.jsx("code",{className:"border rounded px-1",children:"stderr"})," logs will appear here."]}),icon:u.jsx(Zf,{})}),t[1]=a):a=t[1],a}let o,r,s;return t[2]!==n?(o=u.jsx("div",{className:"flex flex-row justify-end px-2 py-1",children:u.jsx(Zp,{dataTestId:"clear-logs-button",onClick:n})}),t[2]=n,t[3]=o):o=t[3],t[4]!==e?(r=u.jsx("div",{className:"overflow-auto flex-1",children:u.jsx(u3,{logs:e,className:"min-w-[300px]"})}),t[4]=e,t[5]=r):r=t[5],t[6]!==o||t[7]!==r?(s=u.jsxs(u.Fragment,{children:[o,r]}),t[6]=o,t[7]=r,t[8]=s):s=t[8],s},u3=t=>{const e=X.c(10),{logs:n,className:o}=t;let r,s,i,a,l;return e[0]!==o?(r=je("flex flex-col",o),e[0]=o,e[1]=r):r=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(s={whiteSpace:"pre-wrap"},e[2]=s):s=e[2],e[3]!==n?(i=n.map(oF),e[3]=n,e[4]=i):i=e[4],e[5]!==i?(a=u.jsx("pre",{className:"grid text-xs font-mono gap-1 whitespace-break-spaces font-semibold align-left",children:u.jsx("div",{className:"grid grid-cols-[30px,1fr]",style:s,children:i})}),e[5]=i,e[6]=a):a=e[6],e[7]!==r||e[8]!==a?(l=u.jsx("div",{className:r,children:a}),e[7]=r,e[8]=a,e[9]=l):l=e[9],l};function tF(t){const e=z$(t.timestamp),n=nF[t.level],o=t.level.toUpperCase();return u.jsxs(u.Fragment,{children:[u.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)] dark:text-[var(--gray-11)]",children:["[",e,"]"]}),u.jsx("span",{className:je("flex-shrink-0",n),children:o}),u.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)]",children:["(",u.jsx(cr,{cellId:t.cellId}),")"]}),t.message]})}const nF={stdout:"text-[var(--grass-9)]",stderr:"text-[var(--red-9)]"};function oF(t,e){return u.jsxs("div",{className:"contents group",children:[u.jsx("span",{className:je("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","text-right col-span-1 py-1 pr-1"),children:e+1}),u.jsx("span",{className:je("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","px-2 flex gap-x-1.5 py-1 flex-wrap"),children:tF(t)})]},e)}const rF=()=>{const t=X.c(7),{items:e}=Be(B$);let n,o;t[0]!==e?(o=UH(e),t[0]=e,t[1]=o):o=t[1],n=o;const r=n,{activeHeaderId:s,activeOccurrences:i}=VH(r);if(e.length===0){let l;return t[2]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx(gn,{title:"No outline",description:"Add markdown headings to your notebook to create an outline.",icon:u.jsx(Qc,{})}),t[2]=l):l=t[2],l}let a;return t[3]!==s||t[4]!==i||t[5]!==e?(a=u.jsx($H,{items:e,activeHeaderId:s,activeOccurrences:i}),t[3]=s,t[4]=i,t[5]=e,t[6]=a):a=t[6],a},h3=Ht(null),f3=t=>{const e=X.c(9),{onClick:n,loading:o,children:r,className:s}=t;if(o){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(Vn,{size:"small",className:"h-4 w-4 shrink-0 opacity-50"}),e[0]=c):c=e[0],c}let i,a,l;return e[1]!==s?(i=je("px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible",s),e[1]=s,e[2]=i):i=e[2],e[3]!==n?(a=Pn.stopPropagation(n),e[3]=n,e[4]=a):a=e[4],e[5]!==r||e[6]!==i||e[7]!==a?(l=u.jsx("button",{type:"button",className:i,onClick:a,children:r}),e[5]=r,e[6]=i,e[7]=a,e[8]=l):l=e[8],l},sF=()=>{var v,C;const t=X.c(27),[e]=Tr(),n=e.package_management.manager,[o,r]=K.useState(null);let s;t[0]!==n?(s=[n],t[0]=n,t[1]=s):s=t[1];const{data:i,error:a,refetch:l,isPending:c}=zn(cF,s);if(c){let k;return t[2]===Symbol.for("react.memo_cache_sentinel")?(k=u.jsx(Vn,{size:"medium",centered:!0}),t[2]=k):k=t[2],k}if(a){let k;return t[3]!==a?(k=u.jsx(Rr,{error:a}),t[3]=a,t[4]=k):k=t[4],k}const d=i.tree!=null;let h;t[5]!==d||t[6]!==o?(h=function(k,E){return k==="list"?"list":E?k||"tree":"list"}(o,d),t[5]=d,t[6]=o,t[7]=h):h=t[7];const f=h,p=(v=i.tree)==null?void 0:v.name,_=(C=i==null?void 0:i.tree)==null?void 0:C.version,g=p==="<root>";let m,b,y,x;return t[8]!==n||t[9]!==l?(m=u.jsx(iF,{packageManager:n,onSuccess:l}),t[8]=n,t[9]=l,t[10]=m):m=t[10],t[11]!==g||t[12]!==d||t[13]!==p||t[14]!==_||t[15]!==f?(b=d&&u.jsxs("div",{className:"flex items-center justify-between px-2 py-1 border-b",children:[u.jsxs("div",{className:"flex gap-1",children:[u.jsx("button",{type:"button",className:je("px-2 py-1 text-xs rounded",f==="list"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>r("list"),children:"List"}),u.jsx("button",{type:"button",className:je("px-2 py-1 text-xs rounded",f==="tree"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>r("tree"),children:"Tree"})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium",title:g?"sandbox":"project",children:g?"sandbox":"project"}),p&&!g&&u.jsxs("span",{className:"text-xs text-muted-foreground",children:[p,_&&` v${_}`]})]})]}),t[11]=g,t[12]=d,t[13]=p,t[14]=_,t[15]=f,t[16]=b):b=t[16],t[17]!==i.list||t[18]!==i.tree||t[19]!==a||t[20]!==l||t[21]!==f?(y=f==="list"?u.jsx(aF,{packages:i.list,onSuccess:l}):u.jsx(lF,{tree:i.tree,error:a,onSuccess:l}),t[17]=i.list,t[18]=i.tree,t[19]=a,t[20]=l,t[21]=f,t[22]=y):y=t[22],t[23]!==m||t[24]!==b||t[25]!==y?(x=u.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[m,b,y]}),t[23]=m,t[24]=b,t[25]=y,t[26]=x):x=t[26],x},iF=t=>{const e=X.c(40),{onSuccess:n,packageManager:o}=t,[r,s]=K.useState(""),{handleClick:i}=ua(),a=Be(h3),l=Kt(h3);let c,d;e[0]!==a||e[1]!==l?(c=()=>{a&&(s(a),l(null))},d=[a,l],e[0]=a,e[1]=l,e[2]=c,e[3]=d):(c=e[2],d=e[3]),K.useEffect(c,d);const{loading:h,handleInstallPackages:f}=$$();let p;e[4]!==n?(p=()=>{n(),s("")},e[4]=n,e[5]=p):p=e[5];const _=p;let g;e[6]!==f||e[7]!==r||e[8]!==_?(g=()=>{f(r.split(",").map(dF),_)},e[6]=f,e[7]=r,e[8]=_,e[9]=g):g=e[9];const m=g,b=`Install packages with ${o}...`;let y,x,v,C,k,E,N,I,A,M,R,z,D,F;e[10]!==h||e[11]!==i?(y=h?u.jsx(Vn,{size:"small",className:"mr-2 h-4 w-4 shrink-0 opacity-50"}):u.jsx(Ae,{content:"Change package manager",children:u.jsx($s,{onClick:()=>i("packageManagement"),className:"mr-2 h-4 w-4 shrink-0 opacity-50 hover:opacity-80 cursor-pointer"})}),e[10]=h,e[11]=i,e[12]=y):y=e[12],e[13]!==m?(x=j=>{j.key==="Enter"&&(j.preventDefault(),m())},e[13]=m,e[14]=x):x=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(v=j=>s(j.target.value),e[15]=v):v=e[15],e[16]!==r||e[17]!==b||e[18]!==y||e[19]!==x?(C=u.jsx(fS,{placeholder:b,id:k1,icon:y,rootClassName:"flex-1 border-none",value:r,onKeyDown:x,onChange:v}),e[16]=r,e[17]=b,e[18]=y,e[19]=x,e[20]=C):C=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(k=u.jsx("span",{className:"font-bold tracking-wide",children:"Package name:"}),e[21]=k):k=e[21],e[22]===Symbol.for("react.memo_cache_sentinel")?(E=u.jsxs("div",{children:[k," A package name; this will install the latest version.",u.jsx("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),N=u.jsx("span",{className:"font-bold tracking-wide",children:"Package and version:"}),e[22]=E,e[23]=N):(E=e[22],N=e[23]),e[24]===Symbol.for("react.memo_cache_sentinel")?(I=u.jsxs("div",{children:[N," ","A package with a specific version or version range.",u.jsx("div",{className:"text-muted-foreground",children:"Examples: httpx==0.27.0, httpx>=0.27.0"})]}),A=u.jsx("span",{className:"font-bold tracking-wide",children:"Git:"}),e[24]=I,e[25]=A):(I=e[24],A=e[25]),e[26]===Symbol.for("react.memo_cache_sentinel")?(M=u.jsxs("div",{children:[A," A Git repository",u.jsx("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),R=u.jsx("span",{className:"font-bold tracking-wide",children:"URL:"}),e[26]=M,e[27]=R):(M=e[26],R=e[27]),e[28]===Symbol.for("react.memo_cache_sentinel")?(z=u.jsxs("div",{children:[R," A remote wheel or source distribution.",u.jsx("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),D=u.jsx("span",{className:"font-bold tracking-wide",children:"Path:"}),e[28]=z,e[29]=D):(z=e[28],D=e[29]),e[30]===Symbol.for("react.memo_cache_sentinel")?(F=u.jsx(Ae,{delayDuration:300,side:"left",align:"start",content:u.jsxs("div",{className:"text-sm flex flex-col w-full max-w-[360px]",children:["Packages are installed using the package manager specified in your user configuration. Depending on your package manager, you can install packages with various formats:",u.jsxs("div",{className:"flex flex-col gap-2 mt-2",children:[E,I,M,z,u.jsxs("div",{children:[D," A local wheel, source distribution, or project directory.",u.jsx("div",{className:"text-muted-foreground",children:"Example: /example/foo-0.1.0-py3-none-any.whl"})]})]})]}),children:u.jsx(Rp,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),e[30]=F):F=e[30];const B=r&&"bg-accent text-accent-foreground";let U;e[31]!==B?(U=je("float-right px-2 m-0 h-full text-sm text-secondary-foreground ml-2",B,"disabled:cursor-not-allowed disabled:opacity-50"),e[31]=B,e[32]=U):U=e[32];const O=!r;let S,$;return e[33]!==m||e[34]!==U||e[35]!==O?(S=u.jsx("button",{type:"button",className:U,onClick:m,disabled:O,children:"Add"}),e[33]=m,e[34]=U,e[35]=O,e[36]=S):S=e[36],e[37]!==S||e[38]!==C?($=u.jsxs("div",{className:"flex items-center w-full border-b",children:[C,F,S]}),e[37]=S,e[38]=C,e[39]=$):$=e[39],$},aF=t=>{const e=X.c(9),{onSuccess:n,packages:o}=t;if(o.length===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx(gn,{title:"No packages",description:"No packages are installed in this environment.",icon:u.jsx($s,{})}),e[0]=a):a=e[0],a}let r,s,i;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(Vp,{children:u.jsxs(Vs,{children:[u.jsx(Pr,{children:"Name"}),u.jsx(Pr,{children:"Version"}),u.jsx(Pr,{})]})}),e[1]=r):r=e[1],e[2]!==n||e[3]!==o){let a;e[5]!==n?(a=l=>u.jsxs(Vs,{className:"group",onClick:async()=>{await pn(`${l.name}==${l.version}`),ut({title:"Copied to clipboard"})},children:[u.jsx(Lr,{children:l.name}),u.jsx(Lr,{children:l.version}),u.jsxs(Lr,{className:"flex justify-end",children:[u.jsx(p3,{packageName:l.name,onSuccess:n}),u.jsx(m3,{packageName:l.name,onSuccess:n})]})]},l.name),e[5]=n,e[6]=a):a=e[6],s=o.map(a),e[2]=n,e[3]=o,e[4]=s}else s=e[4];return e[7]!==s?(i=u.jsxs($p,{className:"overflow-auto flex-1",children:[r,u.jsx(Hp,{children:s})]}),e[7]=s,e[8]=i):i=e[8],i},p3=({packageName:t,onSuccess:e})=>{const[n,o]=K.useState(!1);return xn()?null:u.jsx(f3,{onClick:async()=>{try{o(!0);const r=await H$({package:t,upgrade:!0});r.success?(e(),pS(t)):pS(t,r.error)}finally{o(!1)}},loading:n,children:"Upgrade"})},m3=({packageName:t,onSuccess:e})=>{const[n,o]=K.useState(!1);return u.jsx(f3,{onClick:async()=>{try{o(!0);const r=await W$({package:t});r.success?(e(),mS(t)):mS(t,r.error)}finally{o(!1)}},loading:n,children:"Remove"})},lF=t=>{const e=X.c(18),{tree:n,error:o,onSuccess:r}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=new Set,e[0]=s):s=e[0];const[i,a]=K.useState(s);let l,c,d;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{a(new Set)},e[1]=l):l=e[1],e[2]!==n?(c=[n],e[2]=n,e[3]=c):c=e[3],K.useEffect(l,c),o){let _;return e[4]!==o?(_=u.jsx(Rr,{error:o}),e[4]=o,e[5]=_):_=e[5],_}if(!n){let _;return e[6]===Symbol.for("react.memo_cache_sentinel")?(_=u.jsx(Vn,{size:"medium",centered:!0}),e[6]=_):_=e[6],_}if(n.dependencies.length===0){let _;return e[7]===Symbol.for("react.memo_cache_sentinel")?(_=u.jsx(gn,{title:"No dependencies",description:"No package dependencies found in this environment.",icon:u.jsx($s,{})}),e[7]=_):_=e[7],_}e[8]===Symbol.for("react.memo_cache_sentinel")?(d=_=>{a(g=>{const m=new Set(g);return m.has(_)?m.delete(_):m.add(_),m})},e[8]=d):d=e[8];const h=d;let f,p;if(e[9]!==i||e[10]!==r||e[11]!==n.dependencies){let _;e[13]!==i||e[14]!==r?(_=(g,m)=>u.jsx("div",{className:"border-b",children:u.jsx(g3,{nodeId:`root-${m}`,node:g,level:0,isTopLevel:!0,expandedNodes:i,onToggle:h,onSuccess:r})},`${g.name}-${m}`),e[13]=i,e[14]=r,e[15]=_):_=e[15],f=n.dependencies.map(_),e[9]=i,e[10]=r,e[11]=n.dependencies,e[12]=f}else f=e[12];return e[16]!==f?(p=u.jsx("div",{className:"flex-1 overflow-auto",children:u.jsx("div",{children:f})}),e[16]=f,e[17]=p):p=e[17],p},g3=t=>{const e=X.c(57),{nodeId:n,node:o,level:r,isTopLevel:s,expandedNodes:i,onToggle:a,onSuccess:l}=t,c=s!==void 0&&s,d=o.dependencies.length>0;let h;e[0]!==i||e[1]!==n?(h=i.has(n),e[0]=i,e[1]=n,e[2]=h):h=e[2];const f=h,p=c?0:16+16*r;let _;e[3]!==d||e[4]!==n||e[5]!==a?(_=U=>{U.key!=="Enter"&&U.key!==" "||(U.preventDefault(),d&&a(n))},e[3]=d,e[4]=n,e[5]=a,e[6]=_):_=e[6];const g=_;let m;e[7]!==d||e[8]!==n||e[9]!==a?(m=U=>{U.stopPropagation(),d&&a(n)},e[7]=d,e[8]=n,e[9]=a,e[10]=m):m=e[10];const b=m,y=d&&"select-none",x=c?"px-2 py-0.5":"";let v,C;e[11]!==y||e[12]!==x?(v=je("flex items-center group cursor-pointer text-sm whitespace-nowrap","hover:bg-[var(--slate-2)] focus:bg-[var(--slate-2)] focus:outline-none",y,x),e[11]=y,e[12]=x,e[13]=v):v=e[13],e[14]!==p||e[15]!==c?(C=c?{}:{paddingLeft:`${p}px`},e[14]=p,e[15]=c,e[16]=C):C=e[16];const k=d?f:void 0;let E,N,I,A,M,R,z,D,F,B;return e[17]!==d||e[18]!==f?(E=d?f?u.jsx(js,{className:"w-4 h-4 mr-2 flex-shrink-0"}):u.jsx(qi,{className:"w-4 h-4 mr-2 flex-shrink-0"}):u.jsx("div",{className:"w-4 mr-2 flex-shrink-0"}),e[17]=d,e[18]=f,e[19]=E):E=e[19],e[20]!==o.name?(N=u.jsx("span",{className:"font-medium truncate",children:o.name}),e[20]=o.name,e[21]=N):N=e[21],e[22]!==o.version?(I=o.version&&u.jsxs("span",{className:"text-muted-foreground text-xs",children:["v",o.version]}),e[22]=o.version,e[23]=I):I=e[23],e[24]!==N||e[25]!==I?(A=u.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 py-1.5",children:[N,I]}),e[24]=N,e[25]=I,e[26]=A):A=e[26],e[27]!==o.tags?(M=o.tags.map(uF),e[27]=o.tags,e[28]=M):M=e[28],e[29]!==M?(R=u.jsx("div",{className:"flex items-center gap-1 ml-2",children:M}),e[29]=M,e[30]=R):R=e[30],e[31]!==c||e[32]!==o.name||e[33]!==l?(z=c&&u.jsxs("div",{className:"flex gap-1 invisible group-hover:visible",children:[u.jsx(p3,{packageName:o.name,onSuccess:l}),u.jsx(m3,{packageName:o.name,onSuccess:l})]}),e[31]=c,e[32]=o.name,e[33]=l,e[34]=z):z=e[34],e[35]!==b||e[36]!==g||e[37]!==E||e[38]!==A||e[39]!==R||e[40]!==z||e[41]!==v||e[42]!==C||e[43]!==k?(D=u.jsxs("div",{className:v,style:C,onClick:b,onKeyDown:g,tabIndex:0,role:"treeitem","aria-selected":!1,"aria-expanded":k,children:[E,A,R,z]}),e[35]=b,e[36]=g,e[37]=E,e[38]=A,e[39]=R,e[40]=z,e[41]=v,e[42]=C,e[43]=k,e[44]=D):D=e[44],e[45]!==i||e[46]!==d||e[47]!==f||e[48]!==r||e[49]!==o.dependencies||e[50]!==n||e[51]!==l||e[52]!==a?(F=d&&f&&u.jsx("div",{role:"group",children:o.dependencies.map((U,O)=>u.jsx(g3,{nodeId:`${n}-${O}`,node:U,level:r+1,isTopLevel:!1,expandedNodes:i,onToggle:a,onSuccess:l},`${U.name}-${O}`))}),e[45]=i,e[46]=d,e[47]=f,e[48]=r,e[49]=o.dependencies,e[50]=n,e[51]=l,e[52]=a,e[53]=F):F=e[53],e[54]!==D||e[55]!==F?(B=u.jsxs("div",{children:[D,F]}),e[54]=D,e[55]=F,e[56]=B):B=e[56],B};async function cF(){const[t,e]=await Promise.all([U$(),V$()]);return{list:t.packages,tree:e.tree}}function dF(t){return t.trim()}function uF(t,e){return t.kind==="cycle"?u.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-orange-300 dark:border-orange-700 text-orange-700 dark:text-orange-300",title:"cycle",children:"cycle"},e):t.kind==="extra"?u.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-blue-300 dark:border-blue-700 text-blue-700 dark:text-blue-300",title:t.value,children:t.value},e):t.kind==="group"?u.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-green-300 dark:border-green-700 text-green-700 dark:text-green-300",title:t.value,children:t.value},e):null}const qf=R3("marimo:scratchpadHistory:v1",[]),hF=Ht(!1),fF=Ht(null,(t,e,n)=>{if(!(n=n.trim()))return;const o=t(qf),r=[n,...o.filter(s=>s!==n)].slice(0,15);e(qf,r)}),pF={hide_code:!1,disabled:!1},mF=()=>{const t=X.c(69),e=mc(),[n]=Tr(),{theme:o}=lr(),r=T.useRef(null),s=Or(),{createNewCell:i,updateCellCode:a}=kt(),l=e.cellRuntime[dr],c=l==null?void 0:l.output,d=l==null?void 0:l.status,h=l==null?void 0:l.consoleOutputs,f=e.cellData[dr],p=(f==null?void 0:f.code)??"",_=Kt(fF),[g,m]=tn(hF),b=Be(qf);let y;t[0]!==_||t[1]!==p?(y=()=>{gS({code:p}),_(p)},t[0]=_,t[1]=p,t[2]=y):y=t[2];const x=Xe(y);let v;t[3]!==p||t[4]!==i||t[5]!==s?(v=()=>{p.trim()&&i({code:p,before:!1,cellId:s??"__end__"})},t[3]=p,t[4]=i,t[5]=s,t[6]=v):v=t[6];const C=Xe(v);let k;t[7]!==a?(k=()=>{a({cellId:dr,code:"",formattingChange:!1}),gS({code:""});const ae=r.current;ae&&ae.dispatch({changes:{from:0,to:ae.state.doc.length,insert:""}})},t[7]=a,t[8]=k):k=t[8];const E=Xe(k);let N;t[9]!==m||t[10]!==a?(N=ae=>{m(!1),a({cellId:dr,code:ae,formattingChange:!1});const Me=r.current;Me&&Me.dispatch({changes:{from:0,to:Me.state.doc.length,insert:ae}})},t[9]=m,t[10]=a,t[11]=N):N=t[11];const I=Xe(N),[A,M]=T.useState();let R;t[12]!==p||t[13]!==h||t[14]!==x||t[15]!==A||t[16]!==c||t[17]!==o||t[18]!==n?(R=()=>u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[40%]",children:u.jsx(Bu,{theme:o,showPlaceholder:!1,id:dr,code:p,config:pF,status:"idle",serializedEditorState:null,runCell:x,userConfig:n,editorViewRef:r,setEditorView:ae=>{r.current=ae},hidden:!1,temporarilyShowCode:wn.NOOP,languageAdapter:A,setLanguageAdapter:M})}),u.jsx("div",{className:"flex-1 overflow-auto flex-shrink-0",children:u.jsx(Tc,{allowExpand:!1,output:c,className:"output-area",cellId:dr,stale:!1,loading:!1})}),u.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[35%]",children:u.jsx(Jp,{consoleOutputs:h,className:"overflow-auto",stale:!1,cellName:P3,onSubmitDebugger:wn.NOOP,cellId:dr,debuggerActive:!1})})]}),t[12]=p,t[13]=h,t[14]=x,t[15]=A,t[16]=c,t[17]=o,t[18]=n,t[19]=R):R=t[19];const z=R;let D;t[20]!==I||t[21]!==b||t[22]!==g||t[23]!==o?(D=()=>g?u.jsx("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:u.jsx("div",{className:"overflow-auto flex flex-col gap-3",children:b.map((ae,Me)=>u.jsx("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>I(ae),children:u.jsx(T.Suspense,{children:u.jsx(ca,{language:"python",theme:o,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:ae.trim(),editable:!1,readOnly:!0})})},Me))})}):null,t[20]=I,t[21]=b,t[22]=g,t[23]=o,t[24]=D):D=t[24];const F=D;let B,U,O,S,$,j,W,Y,G,q,te;t[25]===Symbol.for("react.memo_cache_sentinel")?(B=Cs.create(dr),U=u.jsx("p",{className:"mx-2 my-2 text-muted-foreground text-sm",children:"Use this scratchpad cell to experiment with code without restrictions on variable names. Scratchpad code is ephemeral: variables defined in the scratchpad aren't saved to notebook memory, and the code is not saved in the notebook file."}),t[25]=B,t[26]=U):(B=t[25],U=t[26]),t[27]===Symbol.for("react.memo_cache_sentinel")?(O=nn("cell.run"),t[27]=O):O=t[27],t[28]===Symbol.for("react.memo_cache_sentinel")?(S=u.jsx(Hs,{color:"var(--grass-11)",size:16}),t[28]=S):S=t[28],t[29]!==x||t[30]!==g?($=u.jsx(Ae,{content:O,children:u.jsx(Te,{"data-testid":"scratchpad-run-button",onClick:x,disabled:g,variant:"text",size:"xs",children:S})}),t[29]=x,t[30]=g,t[31]=$):$=t[31],t[32]===Symbol.for("react.memo_cache_sentinel")?(j=u.jsx(cm,{size:16}),t[32]=j):j=t[32],t[33]!==E||t[34]!==g?(W=u.jsx(Ae,{content:"Clear code and outputs",children:u.jsx(Te,{disabled:g,size:"xs",variant:"text",onClick:E,children:j})}),t[33]=E,t[34]=g,t[35]=W):W=t[35],t[36]===Symbol.for("react.memo_cache_sentinel")?(Y=u.jsx(Fr,{size:16}),t[36]=Y):Y=t[36],t[37]!==C||t[38]!==g?(G=u.jsx(Ys,{children:u.jsx(Ae,{content:"Insert code",children:u.jsx(Te,{disabled:g,size:"xs",variant:"text",onClick:C,children:Y})})}),t[37]=C,t[38]=g,t[39]=G):G=t[39],t[40]!==d?(q=(d==="running"||d==="queued")&&u.jsx(Vn,{className:"inline",size:"small"}),t[40]=d,t[41]=q):q=t[41],t[42]===Symbol.for("react.memo_cache_sentinel")?(te=u.jsx("div",{className:"flex-1"}),t[42]=te):te=t[42];const re=g&&"bg-[var(--sky-3)] rounded-none";let ie,Z;t[43]!==re?(ie=je(re),t[43]=re,t[44]=ie):ie=t[44],t[45]!==g||t[46]!==m?(Z=()=>m(!g),t[45]=g,t[46]=m,t[47]=Z):Z=t[47];const ee=b.length===0;let ue,me,de,fe,he,Ce,Ee;return t[48]===Symbol.for("react.memo_cache_sentinel")?(ue=u.jsx(gm,{size:16}),t[48]=ue):ue=t[48],t[49]!==ie||t[50]!==Z||t[51]!==ee?(me=u.jsx(Ae,{content:"Toggle history",children:u.jsx(Te,{size:"xs",variant:"text",className:ie,onClick:Z,disabled:ee,children:ue})}),t[49]=ie,t[50]=Z,t[51]=ee,t[52]=me):me=t[52],t[53]!==$||t[54]!==W||t[55]!==G||t[56]!==q||t[57]!==me?(de=u.jsxs("div",{className:"flex items-center flex-shrink-0",children:[$,W,G,q,te,me]}),t[53]=$,t[54]=W,t[55]=G,t[56]=q,t[57]=me,t[58]=de):de=t[58],t[59]!==z?(fe=z(),t[59]=z,t[60]=fe):fe=t[60],t[61]!==F?(he=F(),t[61]=F,t[62]=he):he=t[62],t[63]!==fe||t[64]!==he?(Ce=u.jsxs("div",{className:"flex-1 divide-y relative overflow-hidden flex flex-col",children:[fe,he]}),t[63]=fe,t[64]=he,t[65]=Ce):Ce=t[65],t[66]!==de||t[67]!==Ce?(Ee=u.jsxs("div",{className:"flex flex-col h-full overflow-hidden divide-y",id:B,children:[U,de,Ce]}),t[66]=de,t[67]=Ce,t[68]=Ee):Ee=t[68],Ee},gF=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx(mF,{}),t[0]=e):e=t[0],e},_F=()=>{const t=X.c(23),{openModal:e,closeModal:n}=Fn();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const{data:r,isPending:s,error:i,refetch:a}=zn(yF,o);if(s){let b;return t[1]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(Vn,{size:"medium",centered:!0}),t[1]=b):b=t[1],b}if(i){let b;return t[2]!==i?(b=u.jsx(Rr,{error:i}),t[2]=i,t[3]=b):b=t[3],b}let l;t[4]!==r?(l=r.filter(xF).map(wF),t[4]=r,t[5]=l):l=t[5];const c=l;if(r.length===0){let b;return t[6]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(gn,{title:"No environment variables",description:"No environment variables are available in this notebook.",icon:u.jsx(Gc,{})}),t[6]=b):b=t[6],b}let d,h,f,p,_,g,m;return t[7]!==n||t[8]!==e||t[9]!==c||t[10]!==a?(d=()=>e(u.jsx(_g,{providerNames:c,onSuccess:()=>{a(),n()},onClose:n})),t[7]=n,t[8]=e,t[9]=c,t[10]=a,t[11]=d):d=t[11],t[12]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(ar,{className:"h-4 w-4"}),t[12]=h):h=t[12],t[13]!==d?(f=u.jsx("div",{className:"flex justify-end h-8 border-b",children:u.jsx("button",{type:"button",className:"float-right border-l px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:d,children:h})}),t[13]=d,t[14]=f):f=t[14],t[15]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx(Vp,{children:u.jsxs(Vs,{children:[u.jsx(Pr,{children:"Environment Variable"}),u.jsx(Pr,{children:"Source"}),u.jsx(Pr,{})]})}),t[15]=p):p=t[15],t[16]!==r?(_=r.map(vF),t[16]=r,t[17]=_):_=t[17],t[18]!==_?(g=u.jsxs($p,{className:"overflow-auto flex-1 mb-16",children:[p,u.jsx(Hp,{children:_})]}),t[18]=_,t[19]=g):g=t[19],t[20]!==f||t[21]!==g?(m=u.jsxs("div",{className:"flex flex-col h-full",children:[f,g]}),t[20]=f,t[21]=g,t[22]=m):m=t[22],m},bF=t=>{const e=X.c(9),{className:n,ariaLabel:o,onCopy:r}=t,[s,i]=K.useState(!1);let a;e[0]!==r?(a=()=>{r(),i(!0),setTimeout(()=>i(!1),1e3)},e[0]=r,e[1]=a):a=e[1];const l=a;let c,d;return e[2]!==s?(c=s?u.jsx(dc,{className:"w-3 h-3 text-green-700 rounded"}):u.jsx($i,{className:"w-3 h-3 hover:bg-muted rounded"}),e[2]=s,e[3]=c):c=e[3],e[4]!==o||e[5]!==n||e[6]!==l||e[7]!==c?(d=u.jsx("button",{type:"button",className:n,onClick:l,"aria-label":o,children:c}),e[4]=o,e[5]=n,e[6]=l,e[7]=c,e[8]=d):d=e[8],d};async function yF(){return gg((await ES.request({})).secrets)}function xF(t){return t.provider!=="env"}function wF(t){return t.name}function vF(t){return t.keys.map(e=>u.jsxs(Vs,{className:"group",children:[u.jsx(Lr,{children:e}),u.jsx(Lr,{children:t.provider!=="env"&&u.jsx(Q4,{variant:"outline",className:"select-none",children:t.name})}),u.jsx(Lr,{children:u.jsx(bF,{ariaLabel:`Copy ${e}`,onCopy:async()=>{await pn(`os.environ["${e}"]`),ut({title:"Copied to clipboard",description:`os.environ["${e}"] has been copied to your clipboard.`})},className:je("float-right px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible")})})]},`${t.name}-${e}`))}const kF=t=>{const e=X.c(6),{children:n}=t,{openModal:o,closeModal:r}=Fn();let s,i;return e[0]!==r||e[1]!==o?(s=()=>o(u.jsx(CF,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(i=u.jsx(K4,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=i):i=e[5],i},SF=[tt.lineWrapping],CF=t=>{const e=X.c(23),{onClose:n}=t,[o,r]=T.useState(""),{theme:s}=lr();let i,a,l,c,d,h;e[0]!==n?(i=async x=>{x.preventDefault();const v=new FormData(x.target),C=v.get("title"),k=v.get("description"),E=v.get("code");fetch("https://marimo.io/api/suggest-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:C,description:k,code:E})}),n(),ut({title:"Snippet Submitted",description:"Thank you for contributing! We will review your snippet shortly."})},e[0]=n,e[1]=i):i=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx(er,{children:"Contribute a Snippet"}),e[2]=a):a=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsxs(ks,{children:[a,u.jsxs(Ss,{children:["Have a useful snippet you want to share with the community? Submit it here or make a pull request"," ",u.jsx("a",{href:Yn.githubPage,target:"_blank",className:"underline",children:"on GitHub"}),"."]})]}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(tr,{id:"title",name:"title",autoFocus:!0,placeholder:"Title",required:!0,autoComplete:"off"}),d=u.jsx(q$,{id:"description",name:"description",autoFocus:!0,placeholder:"Description",rows:5,required:!0,autoComplete:"off"}),e[4]=c,e[5]=d):(c=e[4],d=e[5]),e[6]!==o?(h=u.jsx("input",{type:"hidden",name:"code",value:o}),e[6]=o,e[7]=h):h=e[7];const f=s==="dark"?"dark":"light";let p,_,g,m,b,y;return e[8]!==o||e[9]!==f?(p=u.jsx(ca,{theme:f,language:"python",className:"cm border rounded overflow-hidden",extensions:SF,value:o,onChange:r}),e[8]=o,e[9]=f,e[10]=p):p=e[10],e[11]!==h||e[12]!==p?(_=u.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[c,d,h,p]}),e[11]=h,e[12]=p,e[13]=_):_=e[13],e[14]!==n?(g=u.jsx(Te,{"data-testid":"snippet-cancel-button",variant:"secondary",onClick:n,children:"Cancel"}),e[14]=n,e[15]=g):g=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(m=u.jsx(Te,{"data-testid":"snippet-send-button","aria-label":"Save",variant:"default",type:"submit",children:"Send"}),e[16]=m):m=e[16],e[17]!==g?(b=u.jsxs(Vi,{children:[g,m]}),e[17]=g,e[18]=b):b=e[18],e[19]!==i||e[20]!==b||e[21]!==_?(y=u.jsx(nr,{className:"w-fit",children:u.jsxs("form",{onSubmit:i,children:[l,_,b]})}),e[19]=i,e[20]=b,e[21]=_,e[22]=y):y=e[22],y},NF=[tt.lineWrapping],jF=()=>{const t=X.c(20),[e,n]=K.useState();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const{data:r,error:s,isPending:i}=zn(AF,o);if(s){let b;return t[1]!==s?(b=u.jsx(Rr,{error:s}),t[1]=s,t[2]=b):b=t[2],b}if(i||!r){let b;return t[3]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(Vn,{size:"medium",centered:!0}),t[3]=b):b=t[3],b}const a=e?"h-1/3":"h-full";let l,c,d,h,f,p,_,g,m;return t[4]!==a?(l=je("border-b rounded-none",a),t[4]=a,t[5]=l):l=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(Gi,{placeholder:"Search snippets...",className:"h-6 m-1",rootClassName:"flex-1 border-r"}),t[6]=c):c=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsxs("div",{className:"flex items-center w-full",children:[c,u.jsx(kF,{children:u.jsx("button",{className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:u.jsx(ar,{className:"h-4 w-4"})})})]}),h=u.jsx(tc,{children:"No results"}),t[7]=d,t[8]=h):(d=t[7],h=t[8]),t[9]===Symbol.for("react.memo_cache_sentinel")?(f=b=>n(b),t[9]=f):f=t[9],t[10]!==r.snippets?(p=u.jsx(IF,{onSelect:f,snippets:r.snippets}),t[10]=r.snippets,t[11]=p):p=t[11],t[12]!==l||t[13]!==p?(_=u.jsxs(fc,{className:l,children:[d,h,p]}),t[12]=l,t[13]=p,t[14]=_):_=t[14],t[15]!==e?(g=u.jsx(T.Suspense,{children:u.jsx("div",{className:"h-2/3 snippet-viewer flex flex-col",children:e?u.jsx(EF,{snippet:e},e.title):u.jsx(gn,{title:"",description:"Click on a snippet to view its content."})})}),t[15]=e,t[16]=g):g=t[16],t[17]!==_||t[18]!==g?(m=u.jsxs("div",{className:"flex-1 overflow-hidden",children:[_,g]}),t[17]=_,t[18]=g,t[19]=m):m=t[19],m},EF=t=>{const e=X.c(27),{snippet:n}=t,{theme:o}=lr(),{createNewCell:r}=kt(),s=Or();let i;e[0]!==r||e[1]!==s||e[2]!==n.sections?(i=()=>{for(const m of[...n.sections].reverse())m.code&&r({code:m.code,before:!1,cellId:s??"__end__",skipIfCodeExists:!0})},e[0]=r,e[1]=s,e[2]=n.sections,e[3]=i):i=e[3];const a=i;let l;e[4]!==r||e[5]!==s?(l=m=>{r({code:m,before:!1,cellId:s??"__end__"})},e[4]=r,e[5]=s,e[6]=l):l=e[6];const c=l;let d,h,f,p,_,g;if(e[7]!==n.title?(d=u.jsx("div",{className:"text-sm font-semibold bg-muted border-y px-2 py-1",children:n.title}),e[7]=n.title,e[8]=d):d=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(Fr,{className:"ml-2 h-4 w-4"}),e[9]=h):h=e[9],e[10]!==a?(f=u.jsx("div",{className:"flex justify-end",children:u.jsx(Ys,{children:u.jsxs(Te,{className:"float-right",size:"xs",variant:"outline",onClick:a,children:["Insert snippet",h]})})}),e[10]=a,e[11]=f):f=e[11],e[12]!==c||e[13]!==n.sections||e[14]!==n.title||e[15]!==o){let m;e[17]!==c||e[18]!==n.title||e[19]!==o?(m=b=>{const{code:y,html:x,id:v}=b;return x?u.jsx("div",{children:Fp({html:x})},`${n.title}-${v}`):y?u.jsxs("div",{className:"relative hover-actions-parent pr-2",children:[u.jsx(Ys,{children:u.jsx(Ae,{content:"Insert snippet",children:u.jsx(Te,{className:"absolute -top-2 -right-1 z-10 hover-action px-2 bg-background",size:"sm",variant:"outline",onClick:()=>{c(y)},children:u.jsx(Fr,{className:"h-5 w-5"})})})}),u.jsx(T.Suspense,{children:u.jsx(ca,{theme:o==="dark"?"dark":"light",language:"python",className:"cm border rounded overflow-hidden",extensions:NF,value:y,readOnly:!0},`${n.title}-${v}`)})]},`${n.title}-${v}`):null},e[17]=c,e[18]=n.title,e[19]=o,e[20]=m):m=e[20],p=n.sections.map(m),e[12]=c,e[13]=n.sections,e[14]=n.title,e[15]=o,e[16]=p}else p=e[16];return e[21]!==f||e[22]!==p?(_=u.jsxs("div",{className:"px-2 py-2 space-y-4 overflow-auto flex-1",children:[f,p]}),e[21]=f,e[22]=p,e[23]=_):_=e[23],e[24]!==d||e[25]!==_?(g=u.jsxs(u.Fragment,{children:[d,_]}),e[24]=d,e[25]=_,e[26]=g):g=e[26],g},IF=t=>{const e=X.c(7),{snippets:n,onSelect:o}=t;let r,s;if(e[0]!==o||e[1]!==n){let i;e[3]!==o?(i=a=>u.jsx(lo,{className:"rounded-none",onSelect:()=>o(a),children:u.jsx("div",{className:"flex flex-row gap-2 items-center",children:u.jsx("span",{className:"mt-1 text-accent-foreground",children:a.title})})},a.title),e[3]=o,e[4]=i):i=e[4],r=n.map(i),e[0]=o,e[1]=n,e[2]=r}else r=e[2];return e[5]!==r?(s=u.jsx(Np,{className:"flex flex-col overflow-auto",children:r}),e[5]=r,e[6]=s):s=e[6],s};function AF(){return G$()}const TF=K.lazy(()=>jp(()=>import("./tracing-C7fLEsxH.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122]),import.meta.url).then(t=>({default:t.Tracing}))),MF=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx(K.Suspense,{fallback:u.jsx(OF,{}),children:u.jsx(TF,{})}),t[0]=e):e=t[0],e},OF=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:u.jsx(Vn,{})}),t[0]=e):e=t[0],e},_3="name",b3="type-value",Gf="defs-refs",DF=[{id:_3,accessorFn:t=>[t.name,t.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>u.jsx(Wp,{header:"Name",column:t}),cell:({getValue:t})=>{const[e,n]=t();return u.jsx(rf,{name:e,declaredBy:n})}},{id:b3,accessorFn:t=>[t.dataType,t.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>u.jsx(Wp,{header:u.jsxs("div",{className:"flex flex-col gap-1",children:[u.jsx("span",{children:"Type"}),u.jsx("span",{children:"Value"})]}),column:t}),cell:({getValue:t})=>{const[e,n]=t();return u.jsxs("div",{className:"max-w-[150px]",children:[u.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs",children:e}),u.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap",title:n??"",children:n})]})}},{id:Gf,accessorFn:t=>[t.declaredBy,t.usedBy,t.name,t.declaredByNames,t.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:t})=>u.jsx(Wp,{header:u.jsxs("div",{className:"flex flex-col gap-1",children:[u.jsx("span",{children:"Declared By"}),u.jsx("span",{children:"Used By"})]}),column:t}),cell:({getValue:t})=>{const[e,n,o]=t(),r=s=>{const i=Kl(s);i&&zp(i,o)};return u.jsxs("div",{className:"flex flex-col gap-1 py-1",children:[u.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-center",children:[u.jsx("span",{title:"Declared by",children:u.jsx(Pm,{className:"w-3.5 h-3.5 text-muted-foreground"})}),e.length===1?u.jsx(cr,{variant:"focus",cellId:e[0],skipScroll:!0,onClick:()=>r(e[0])}):u.jsx("div",{className:"text-destructive flex flex-row gap-2",children:e.slice(0,3).map((s,i)=>u.jsxs("span",{className:"flex",children:[u.jsx(cr,{variant:"focus",cellId:s,skipScroll:!0,className:"whitespace-nowrap text-destructive",onClick:()=>r(s)},s),i<e.length-1&&", "]},s))})]}),u.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-baseline",children:[u.jsx("span",{title:"Used by",children:u.jsx(ya,{className:"w-3.5 h-3.5 text-muted-foreground"})}),u.jsx(B2,{maxCount:3,cellIds:n,skipScroll:!0,onClick:r})]})]})}}],y3=T.memo(({className:t,cellIds:e,variables:n})=>{const[o,r]=K.useState([]),[s,i]=K.useState(""),a=Y$(),l=T.useMemo(()=>{const h=f=>{const p=a[f];return Q$(p)?`cell-${e.indexOf(f)}`:p??`cell-${e.indexOf(f)}`};return Object.values(n).map(f=>({...f,declaredByNames:f.declaredBy.map(h),usedByNames:f.usedBy.map(h)}))},[n,a,e]),c=T.useMemo(()=>{const h=new Map;return e.forEach((f,p)=>h.set(f,p)),function(f,p,_){p||(p={id:Gf,desc:!1});let g=[];switch(p.id){case _3:g=ha(f,m=>m.name);break;case b3:g=ha(f,m=>m.dataType);break;case Gf:g=ha(f,m=>_.get(m.declaredBy[0]))}return p.desc?g.reverse():g}(l,o[0],h)},[l,o,e]),d=J$({data:c,columns:DF,getCoreRowModel:Z$(),onGlobalFilterChange:i,getFilteredRowModel:X$(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter:h=>h.columnDef.enableGlobalFilter??!0,globalFilterFn:"auto",manualSorting:!0,onSortingChange:r,getSortedRowModel:K$(),state:{sorting:o,globalFilter:s}});return u.jsxs(u.Fragment,{children:[u.jsx(fS,{className:"w-full",placeholder:"Search",value:s,onChange:h=>i(h.target.value)}),u.jsxs($p,{className:je("w-full text-sm flex-1 border-separate border-spacing-0",t),children:[u.jsx(Vp,{children:u.jsx(Vs,{className:"whitespace-nowrap text-xs",children:d.getFlatHeaders().map(h=>u.jsx(Pr,{className:"sticky top-0 bg-background border-b",children:_S(h.column.columnDef.header,h.getContext())},h.id))})}),u.jsx(Hp,{children:d.getRowModel().rows.map(h=>u.jsx(Vs,{className:"hover:bg-accent",children:h.getVisibleCells().map(f=>u.jsx(Lr,{className:"border-b",children:_S(f.column.columnDef.cell,f.getContext())},f.id))},h.id))})]})]})});y3.displayName="VariableTable";const RF=()=>{const t=X.c(4),e=tS(),n=Rc();if(Object.keys(e).length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(gn,{title:"No variables",description:"Global variables will appear here.",icon:u.jsx(Yl,{})}),t[0]=r):r=t[0],r}let o;return t[1]!==n.inOrderIds||t[2]!==e?(o=u.jsx(y3,{className:"flex-1",cellIds:n.inOrderIds,variables:e}),t[1]=n.inOrderIds,t[2]=e,t[3]=o):o=t[3],o},PF=K.lazy(()=>jp(()=>import("./terminal-BoXScU3t.js"),__vite__mapDeps([123,1,2,124]),import.meta.url)),LF=t=>{const e=X.c(121),{children:n}=t,{isSidebarOpen:o,isTerminalOpen:r,selectedPanel:s}=cc(),{setIsSidebarOpen:i,setIsTerminalOpen:a}=Ki(),l=K.useRef(null),c=K.useRef(null);let d,h,f,p,_;e[0]!==o?(d=()=>{if(!l.current)return;const le=l.current.isCollapsed();o&&le&&l.current.expand(),o||le||l.current.collapse(),requestAnimationFrame(zF)},h=[o],e[0]=o,e[1]=d,e[2]=h):(d=e[1],h=e[2]),T.useEffect(d,h),e[3]!==r?(f=()=>{if(!c.current)return;const le=c.current.isCollapsed();r&&le&&c.current.expand(),r||le||c.current.collapse(),requestAnimationFrame(UF)},p=[r],e[3]=r,e[4]=f,e[5]=p):(f=e[4],p=e[5]),T.useEffect(f,p),e[6]!==n?(_=u.jsx(Lc,{id:"app",className:"relative h-full",children:u.jsx(T.Suspense,{children:n})},"app"),e[6]=n,e[7]=_):_=e[7];const g=_,m=o?"resize-handle":"resize-handle-collapsed";let b,y;e[8]!==m?(b=je("border-border no-print z-10",m,"vertical"),e[8]=m,e[9]=b):b=e[9],e[10]!==b?(y=u.jsx(bS,{onDragging:yS,className:b}),e[10]=b,e[11]=y):y=e[11];const x=y,v=r?"resize-handle":"resize-handle-collapsed";let C,k;e[12]!==v?(C=je("border-border no-print z-20",v,"horizontal"),e[12]=v,e[13]=C):C=e[13],e[14]!==C?(k=u.jsx(bS,{onDragging:yS,className:C}),e[14]=C,e[15]=k):k=e[15];const E=k;let N,I,A,M,R,z,D,F,B,U,O,S,$,j,W,Y,G,q,te,re,ie;e[16]!==s?(N=u.jsx("div",{className:"text-sm text-[var(--slate-11)] uppercase tracking-wide font-semibold flex-1",children:s}),e[16]=s,e[17]=N):N=e[17],e[18]!==i?(I=()=>i(!1),e[18]=i,e[19]=I):I=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(A=u.jsx(Jn,{className:"w-4 h-4"}),e[20]=A):A=e[20],e[21]!==I?(M=u.jsx(Te,{"data-testid":"close-helper-pane",className:"m-0",size:"xs",variant:"text",onClick:I,children:A}),e[21]=I,e[22]=M):M=e[22],e[23]!==N||e[24]!==M?(R=u.jsxs("div",{className:"p-3 border-b flex justify-between items-center",children:[N,M]}),e[23]=N,e[24]=M,e[25]=R):R=e[25],e[26]!==s?(z=s==="files"&&u.jsx(c3,{}),e[26]=s,e[27]=z):z=e[27],e[28]!==s?(D=s==="errors"&&u.jsx(OL,{}),e[28]=s,e[29]=D):D=e[29],e[30]!==s?(F=s==="variables"&&u.jsx(RF,{}),e[30]=s,e[31]=F):F=e[31],e[32]!==s?(B=s==="dependencies"&&u.jsx(bL,{}),e[32]=s,e[33]=B):B=e[33],e[34]!==s?(U=s==="packages"&&u.jsx(sF,{}),e[34]=s,e[35]=U):U=e[35],e[36]!==s?(O=s==="outline"&&u.jsx(rF,{}),e[36]=s,e[37]=O):O=e[37],e[38]!==s?(S=s==="datasources"&&u.jsx(TL,{}),e[38]=s,e[39]=S):S=e[39],e[40]!==s?($=s==="documentation"&&u.jsx(ML,{}),e[40]=s,e[41]=$):$=e[41],e[42]!==s?(j=s==="snippets"&&u.jsx(jF,{}),e[42]=s,e[43]=j):j=e[43],e[44]!==s?(W=s==="scratchpad"&&u.jsx(gF,{}),e[44]=s,e[45]=W):W=e[45],e[46]!==s?(Y=s==="chat"&&u.jsx(UD,{}),e[46]=s,e[47]=Y):Y=e[47],e[48]!==s?(G=s==="logs"&&u.jsx(d3,{}),e[48]=s,e[49]=G):G=e[49],e[50]!==s?(q=s==="tracing"&&u.jsx(MF,{}),e[50]=s,e[51]=q):q=e[51],e[52]!==s?(te=s==="secrets"&&u.jsx(_F,{}),e[52]=s,e[53]=te):te=e[53],e[54]!==z||e[55]!==D||e[56]!==F||e[57]!==B||e[58]!==U||e[59]!==O||e[60]!==S||e[61]!==$||e[62]!==j||e[63]!==W||e[64]!==Y||e[65]!==G||e[66]!==q||e[67]!==te?(re=u.jsx(T.Suspense,{children:u.jsxs(Oc,{children:[z,D,F,B,U,O,S,$,j,W,Y,G,q,te]})}),e[54]=z,e[55]=D,e[56]=F,e[57]=B,e[58]=U,e[59]=O,e[60]=S,e[61]=$,e[62]=j,e[63]=W,e[64]=Y,e[65]=G,e[66]=q,e[67]=te,e[68]=re):re=e[68],e[69]!==R||e[70]!==re?(ie=u.jsx(pc,{children:u.jsxs("div",{className:"flex flex-col h-full flex-1 overflow-hidden mr-[-4px]",children:[R,re]})}),e[69]=R,e[70]=re,e[71]=ie):ie=e[71];const Z=ie,ee=o&&"border-r border-l border-[var(--slate-7)]";let ue,me,de,fe,he,Ce;e[72]!==ee?(ue=je("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",ee),e[72]=ee,e[73]=ue):ue=e[73],e[74]===Symbol.for("react.memo_cache_sentinel")?(me=(le,He)=>{var Fe;He===0&&le===10&&((Fe=l.current)==null||Fe.resize(30))},e[74]=me):me=e[74],e[75]!==i?(de=()=>i(!1),fe=()=>i(!0),e[75]=i,e[76]=de,e[77]=fe):(de=e[76],fe=e[77]),e[78]!==Z||e[79]!==x?(he=u.jsxs("span",{className:"flex flex-row h-full",children:[Z," ",x]}),e[78]=Z,e[79]=x,e[80]=he):he=e[80],e[81]!==ue||e[82]!==de||e[83]!==fe||e[84]!==he?(Ce=u.jsx(Lc,{ref:l,id:"helper",collapsedSize:0,collapsible:!0,className:ue,minSize:10,defaultSize:0,maxSize:75,onResize:me,onCollapse:de,onExpand:fe,children:he},"helper"),e[81]=ue,e[82]=de,e[83]=fe,e[84]=he,e[85]=Ce):Ce=e[85];const Ee=Ce,ae=r&&"border-[var(--slate-7)]";let Me,xe,Re,Ue,Je,Ke,Pe,st,et;e[86]!==ae?(Me=je("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",ae),e[86]=ae,e[87]=Me):Me=e[87],e[88]===Symbol.for("react.memo_cache_sentinel")?(xe=(le,He)=>{var Fe;He===0&&le===10&&((Fe=c.current)==null||Fe.resize(30))},e[88]=xe):xe=e[88],e[89]!==a?(Re=()=>a(!1),Ue=()=>a(!0),e[89]=a,e[90]=Re,e[91]=Ue):(Re=e[90],Ue=e[91]),e[92]===Symbol.for("react.memo_cache_sentinel")?(Je=u.jsx("div",{}),e[92]=Je):Je=e[92],e[93]!==a?(Ke=()=>a(!1),e[93]=a,e[94]=Ke):Ke=e[94],e[95]!==r||e[96]!==Ke?(Pe=u.jsx(T.Suspense,{fallback:Je,children:u.jsx(PF,{visible:r,onClose:Ke})}),e[95]=r,e[96]=Ke,e[97]=Pe):Pe=e[97],e[98]!==r||e[99]!==Pe?(st=u.jsx(yL,{isOpen:r,children:Pe}),e[98]=r,e[99]=Pe,e[100]=st):st=e[100],e[101]!==Me||e[102]!==Re||e[103]!==Ue||e[104]!==st||e[105]!==E?(et=u.jsxs(Lc,{ref:c,id:"terminal",collapsedSize:0,collapsible:!0,className:Me,minSize:10,defaultSize:0,maxSize:75,onResize:xe,onCollapse:Re,onExpand:Ue,children:[E,st]},"terminal"),e[101]=Me,e[102]=Re,e[103]=Ue,e[104]=st,e[105]=E,e[106]=et):et=e[106];const nt=et;let ne,ve,Se,De,J,ge,_e,pe;return e[107]===Symbol.for("react.memo_cache_sentinel")?(ne=HH(),e[107]=ne):ne=e[107],e[108]===Symbol.for("react.memo_cache_sentinel")?(ve=u.jsx(Oc,{children:u.jsx(kO,{})}),e[108]=ve):ve=e[108],e[109]!==nt?(Se=u.jsx(Ox,{capability:"terminal",children:nt}),e[109]=nt,e[110]=Se):Se=e[110],e[111]!==g||e[112]!==Se?(De=u.jsx(Lc,{children:u.jsxs(xS,{autoSaveId:"marimo:chrome:v1:l1",direction:"vertical",children:[g,Se]})}),e[111]=g,e[112]=Se,e[113]=De):De=e[113],e[114]===Symbol.for("react.memo_cache_sentinel")?(J=u.jsx(eH,{}),e[114]=J):J=e[114],e[115]!==Ee||e[116]!==De?(ge=u.jsxs(xS,{autoSaveId:"marimo:chrome:v1:l2",direction:"horizontal",storage:ne,children:[ve,Ee,De,J]}),e[115]=Ee,e[116]=De,e[117]=ge):ge=e[117],e[118]===Symbol.for("react.memo_cache_sentinel")?(_e=u.jsx(pc,{children:u.jsx(Oc,{children:u.jsx(bO,{})})}),e[118]=_e):_e=e[118],e[119]!==ge?(pe=u.jsxs(WH,{children:[ge,_e]}),e[119]=ge,e[120]=pe):pe=e[120],pe};function FF(){window.dispatchEvent(new Event("resize"))}function zF(){requestAnimationFrame(FF)}function BF(){window.dispatchEvent(new Event("resize"))}function UF(){requestAnimationFrame(BF)}let x3;x3=new URL(window.location.href).searchParams.get(tH.showChrome)==="false",FS=Object.freeze(Object.defineProperty({__proto__:null,default:t=>{const e=X.c(10);if(x3){let s,i,a;return e[0]!==t?(s=u.jsx(Mx,{hideControls:!0,...t}),e[0]=t,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx(Km,{}),e[2]=i):i=e[2],e[3]!==s?(a=u.jsxs(u.Fragment,{children:[s,i]}),e[3]=s,e[4]=a):a=e[4],a}let n,o,r;return e[5]!==t?(n=u.jsx(Mx,{...t}),e[5]=t,e[6]=n):n=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(Km,{}),e[7]=o):o=e[7],e[8]!==n?(r=u.jsxs(LF,{children:[n,o]}),e[8]=n,e[9]=r):r=e[9],r}},Symbol.toStringTag,{value:"Module"}))});export{Zp as C,Bc as E,gn as P,JH as __tla,Uc as a,FS as e,fa as f,Qp as u};
|
144
|
+
`).length),position:{x:0,y:0}}}createElements(t,e,n,o){const r=[],s=[],i=new Set,a=new Set;for(const l of Object.values(n)){if(l.value==="marimo"&&l.name==="mo")continue;const{declaredBy:c,usedBy:d}=l;for(const h of c)for(const f of d){const p=`${h}-${f}`;a.has(p)||(a.add(p),i.add(h),i.add(f),s.push(this.createEdge(h,f)))}}for(const[l,c]of Lp.zip(t,e)){o||r.push(this.createNode(l,c));const d=i.has(l),h=ct.get(c).code.trim().startsWith("mo.md");!d&&h||r.push(this.createNode(l,c))}return{nodes:r,edges:s}}},fL=t=>{const e=X.c(43),{cellIds:n,variables:o,cellAtoms:r,children:s,layoutDirection:i,settings:a}=t;let l;e[0]!==r||e[1]!==n||e[2]!==i||e[3]!==a.hidePureMarkdown||e[4]!==o?(l=()=>{let S=t3.createElements(n,r,o,a.hidePureMarkdown);return S=e3(S.nodes,S.edges,{direction:i}),S},e[0]=r,e[1]=n,e[2]=i,e[3]=a.hidePureMarkdown,e[4]=o,e[5]=l):l=e[5];const[c]=T.useState(l),[d,h,f]=O2(c.nodes),[p,_,g]=D2(c.edges),m=Li();let b;e[6]!==i||e[7]!==_||e[8]!==h?(b=S=>{const $=e3(S.nodes,S.edges,{direction:i});h($.nodes),_($.edges)},e[6]=i,e[7]=_,e[8]=h,e[9]=b):b=e[9];const y=Xe(b);let x,v;e[10]!==r||e[11]!==n||e[12]!==a.hidePureMarkdown||e[13]!==y||e[14]!==o?(x=()=>{y(t3.createElements(n,r,o,a.hidePureMarkdown))},v=[n,o,r,y,a.hidePureMarkdown],e[10]=r,e[11]=n,e[12]=a.hidePureMarkdown,e[13]=y,e[14]=o,e[15]=x,e[16]=v):(x=e[15],v=e[16]),T.useEffect(x,v);const[C,k]=T.useState();let E;U2(),e[17]===Symbol.for("react.memo_cache_sentinel")?(E=()=>{k(void 0)},e[17]=E):E=e[17];const N=E;let I,A,M,R,z,D,F,B,U,O;return e[18]===Symbol.for("react.memo_cache_sentinel")?(I={minZoom:.5,maxZoom:1.5},A=(S,$)=>{k({type:"node",id:$.id})},M=(S,$)=>{const{source:j,target:W}=$;k({type:"edge",source:j,target:W})},e[18]=I,e[19]=A,e[20]=M):(I=e[18],A=e[19],M=e[20]),e[21]===Symbol.for("react.memo_cache_sentinel")?(R=u.jsx(OP,{color:"#ccc",variant:Dn.Dots}),e[21]=R):R=e[21],e[22]!==m||e[23]!==d?(z=()=>{const S=ct.get(o$);if(S){const $=d.find(j=>j.id===S);$&&(m.fitView({padding:1,duration:600,nodes:[$]}),k({type:"node",id:S}))}},e[22]=m,e[23]=d,e[24]=z):z=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(D=u.jsx(wm,{className:"size-4"}),e[25]=D):D=e[25],e[26]!==z?(F=u.jsx(jP,{position:"bottom-right",showInteractive:!1,children:u.jsx(Ae,{content:"Jump to focused cell",delayDuration:200,side:"left",asChild:!1,children:u.jsx(xs,{onMouseDown:Pn.preventFocus,onClick:z,children:D})})}),e[26]=z,e[27]=F):F=e[27],e[28]!==p||e[29]!==C||e[30]!==o?(B=u.jsx(Hl,{selection:C,variables:o,edges:p,onClearSelection:N}),e[28]=p,e[29]=C,e[30]=o,e[31]=B):B=e[31],e[32]!==s||e[33]!==p||e[34]!==d||e[35]!==g||e[36]!==f||e[37]!==F||e[38]!==B?(U=u.jsxs(nf,{nodes:d,edges:p,nodeTypes:z2,minZoom:.2,fitViewOptions:I,onNodeClick:A,onEdgeClick:M,onNodeDoubleClick:pL,fitView:!0,onNodesChange:f,onEdgesChange:g,zoomOnDoubleClick:!1,nodesConnectable:!1,children:[R,F,B,s]}),e[32]=s,e[33]=p,e[34]=d,e[35]=g,e[36]=f,e[37]=F,e[38]=B,e[39]=U):U=e[39],e[40]!==i||e[41]!==U?(O=u.jsx(L2,{value:i,children:U}),e[40]=i,e[41]=U,e[42]=O):O=e[42],O};function pL(t,e){eS(e.id,"focus")}const mL=Ht("_minimap_"),gL=Ht({hidePureMarkdown:!0}),_L=t=>{const e=X.c(11),[n,o]=tn(mL),[r,s]=tn(gL);let i;e[0]!==n||e[1]!==t||e[2]!==o||e[3]!==s||e[4]!==r?(i=()=>n==="_minimap_"?u.jsx(FP,{...t,children:u.jsx(sf,{settings:r,onSettingsChange:s,view:n,onChange:o})}):u.jsx(fL,{...t,settings:r,layoutDirection:n,children:u.jsx(sf,{settings:r,onSettingsChange:s,view:n,onChange:o})}),e[0]=n,e[1]=t,e[2]=o,e[3]=s,e[4]=r,e[5]=i):i=e[5];const a=i;let l,c;return e[6]!==a?(l=a(),e[6]=a,e[7]=l):l=e[7],e[8]!==n||e[9]!==l?(c=u.jsx(tf,{children:l},n),e[8]=n,e[9]=l,e[10]=c):c=e[10],c},bL=()=>{const t=X.c(5),e=tS(),n=Rc(),[o]=r$();let r,s;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=je("w-full h-full flex-1 mx-auto -mb-4 relative"),t[0]=r):r=t[0],t[1]!==n.inOrderIds||t[2]!==o||t[3]!==e?(s=u.jsx("div",{className:r,children:u.jsx(_L,{cellAtoms:o,variables:e,cellIds:n.inOrderIds})}),t[1]=n.inOrderIds,t[2]=o,t[3]=e,t[4]=s):s=t[4],s},yL=t=>{const e=X.c(4),{isOpen:n,children:o}=t,[r,s]=K.useState(!1);let i,a;return e[0]!==r||e[1]!==n?(i=()=>{n&&!r&&s(!0)},a=[n,r],e[0]=r,e[1]=n,e[2]=i,e[3]=a):(i=e[2],a=e[3]),K.useEffect(i,a),r?o:null},xL=t=>{const e=X.c(8),{variableName:n,className:o}=t;let r;e[0]!==n?(r=()=>{const l=function(d){const h=ct.get(nS)[d];if(h)return h.declaredBy[0]}(n);if(!l)return;const c=Kl(l);c&&zp(c,n)},e[0]=n,e[1]=r):r=e[1];const s=r;let i,a;return e[2]!==o?(i=je("text-link opacity-80 hover:opacity-100 hover:underline",o),e[2]=o,e[3]=i):i=e[3],e[4]!==s||e[5]!==i||e[6]!==n?(a=u.jsx("button",{type:"button",onClick:s,className:i,children:n}),e[4]=s,e[5]=i,e[6]=n,e[7]=a):a=e[7],a},wL=Ht(t=>{const e=t(s$),n=t(nS),o=t(Y4);return ha(e,r=>{if(!r.variable_name)return-1;const s=Object.values(n).find(a=>a.name===r.variable_name);if(!s)return 0;const i=o.inOrderIds.indexOf(s.declaredBy[0]);return i===-1?0:i})}),vL=Ht(t=>{const e=new Map(t(i$));for(const n of oS){const o=e.get(n);o&&o.databases.length===0&&e.delete(n)}return ha([...e.values()],n=>oS.has(n.name)?1:0)}),kL=()=>{const t=X.c(32),[e,n]=K.useState(""),o=Kt(rS),r=Be(wL),s=Be(vL);if(r.length===0&&s.length===0){let b;return t[0]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(gn,{title:"No tables found",description:"Any datasets/dataframes in the global scope will be shown here.",action:u.jsx(wg,{children:u.jsxs(Te,{variant:"outline",size:"sm",children:["Add database or catalog",u.jsx(ar,{className:"h-4 w-4 ml-2"})]})}),icon:u.jsx(or,{})}),t[0]=b):b=t[0],b}const i=!!e.trim();let a,l,c,d,h,f,p,_,g,m;if(t[1]!==o?(a=b=>{o(b.length>0),n(b)},t[1]=o,t[2]=a):a=t[2],t[3]!==e||t[4]!==a?(l=u.jsx(Gi,{placeholder:"Search tables...",className:"h-6 m-1",value:e,onValueChange:a,rootClassName:"flex-1 border-r"}),t[3]=e,t[4]=a,t[5]=l):l=t[5],t[6]!==i?(c=i&&u.jsx("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:()=>n(""),children:u.jsx(Jn,{className:"h-4 w-4"})}),t[6]=i,t[7]=c):c=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsx(wg,{children:u.jsx("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:u.jsx(ar,{className:"h-4 w-4"})})}),t[8]=d):d=t[8],t[9]!==l||t[10]!==c?(h=u.jsxs("div",{className:"flex items-center w-full",children:[l,c,d]}),t[9]=l,t[10]=c,t[11]=h):h=t[11],t[12]!==s||t[13]!==i||t[14]!==e){let b;t[16]!==i||t[17]!==e?(b=y=>u.jsx(SL,{connection:y,hasChildren:y.databases.length>0,children:y.databases.map(x=>u.jsx(CL,{engineName:y.name,database:x,hasSearch:i,children:u.jsx(NL,{schemas:x.schemas,defaultSchema:y.default_schema,defaultDatabase:y.default_database,engineName:y.name,databaseName:x.name,hasSearch:i,searchValue:e})},x.name))},y.name),t[16]=i,t[17]=e,t[18]=b):b=t[18],f=s.map(b),t[12]=s,t[13]=i,t[14]=e,t[15]=f}else f=t[15];return t[19]!==s.length||t[20]!==r.length?(p=s.length>0&&r.length>0&&u.jsxs(sS,{children:[u.jsx(Ql,{className:"h-4 w-4 text-muted-foreground"}),u.jsx("span",{className:"text-xs",children:"Python"})]}),t[19]=s.length,t[20]=r.length,t[21]=p):p=t[21],t[22]!==e||t[23]!==r?(_=r.length>0&&u.jsx(n3,{tables:r,searchValue:e}),t[22]=e,t[23]=r,t[24]=_):_=t[24],t[25]!==f||t[26]!==p||t[27]!==_?(g=u.jsxs(Np,{className:"flex flex-col",children:[f,p,_]}),t[25]=f,t[26]=p,t[27]=_,t[28]=g):g=t[28],t[29]!==h||t[30]!==g?(m=u.jsxs(fc,{className:"border-b bg-background rounded-none h-full pb-10 overflow-auto outline-none",shouldFilter:!1,children:[h,g]}),t[29]=h,t[30]=g,t[31]=m):m=t[31],m},SL=t=>{const e=X.c(25),{connection:n,children:o,hasChildren:r}=t,s=n.name===a$,i=s?"In-Memory":n.name,[a,l]=K.useState(!1);let c;e[0]!==n.name?(c=async()=>{l(!0),await c$({engine:n.name}),setTimeout(()=>l(!1),500)},e[0]=n.name,e[1]=c):c=e[1];const d=c;let h,f,p;e[2]!==n.dialect?(h=u.jsx(Q3,{className:"h-4 w-4 text-muted-foreground",name:n.dialect}),e[2]=n.dialect,e[3]=h):h=e[3],e[4]!==n.dialect?(f=l$(n.dialect),e[4]=n.dialect,e[5]=f):f=e[5],e[6]!==f?(p=u.jsx("span",{className:"text-xs",children:f}),e[6]=f,e[7]=p):p=e[7];const _=i;let g,m,b,y,x;return e[8]!==_?(g=u.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",u.jsx(xL,{variableName:_}),")"]}),e[8]=_,e[9]=g):g=e[9],e[10]!==d||e[11]!==s||e[12]!==a?(m=!s&&u.jsx(Ae,{content:"Refresh connection",children:u.jsx(Te,{variant:"ghost",size:"icon",className:"ml-auto hover:bg-transparent hover:shadow-none",onClick:d,children:u.jsx(Cc,{className:je("h-4 w-4 text-muted-foreground hover:text-foreground",a&&"animate-[spin_0.5s]")})})}),e[10]=d,e[11]=s,e[12]=a,e[13]=m):m=e[13],e[14]!==h||e[15]!==p||e[16]!==g||e[17]!==m?(b=u.jsxs(sS,{children:[h,p,g,m]}),e[14]=h,e[15]=p,e[16]=g,e[17]=m,e[18]=b):b=e[18],e[19]!==o||e[20]!==r?(y=r?o:u.jsx(Pc,{content:"No databases available",className:"pl-2"}),e[19]=o,e[20]=r,e[21]=y):y=e[21],e[22]!==b||e[23]!==y?(x=u.jsxs(u.Fragment,{children:[b,y]}),e[22]=b,e[23]=y,e[24]=x):x=e[24],x},CL=t=>{const e=X.c(28),{hasSearch:n,engineName:o,database:r,children:s}=t,[i,a]=K.useState(!1),[l,c]=K.useState(!1);let d,h,f;e[0]!==n?(d=()=>{a(n)},h=[n],e[0]=n,e[1]=d,e[2]=h):(d=e[1],h=e[2]),K.useEffect(d,h),e[3]!==i||e[4]!==l?(f=()=>{a(!i),c(!l)},e[3]=i,e[4]=l,e[5]=f):f=e[5];const p=`${o}:${r.name}`;let _;e[6]!==i?(_=u.jsx(dS,{isExpanded:i}),e[6]=i,e[7]=_):_=e[7];const g=l&&i?"text-foreground":"text-muted-foreground";let m,b;e[8]!==g?(m=je("h-4 w-4",g),e[8]=g,e[9]=m):m=e[9],e[10]!==m?(b=u.jsx(or,{className:m}),e[10]=m,e[11]=b):b=e[11];const y=l&&i&&"font-semibold";let x,v,C,k;e[12]!==y?(x=je(y),e[12]=y,e[13]=x):x=e[13],e[14]!==r.name?(v=r.name===""?u.jsx("i",{children:"Not connected"}):r.name,e[14]=r.name,e[15]=v):v=e[15],e[16]!==x||e[17]!==v?(C=u.jsx("span",{className:x,children:v}),e[16]=x,e[17]=v,e[18]=C):C=e[18],e[19]!==C||e[20]!==f||e[21]!==p||e[22]!==_||e[23]!==b?(k=u.jsxs(lo,{className:"text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",onSelect:f,value:p,children:[_,b,C]}),e[19]=C,e[20]=f,e[21]=p,e[22]=_,e[23]=b,e[24]=k):k=e[24];const E=i&&s;let N;return e[25]!==k||e[26]!==E?(N=u.jsxs(u.Fragment,{children:[k,E]}),e[25]=k,e[26]=E,e[27]=N):N=e[27],N},NL=t=>{const e=X.c(20),{schemas:n,defaultSchema:o,defaultDatabase:r,engineName:s,databaseName:i,hasSearch:a,searchValue:l}=t;if(n.length===0){let h;return e[0]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(Pc,{content:"No schemas available",className:"pl-6"}),e[0]=h):h=e[0],h}let c,d;if(e[1]!==i||e[2]!==r||e[3]!==o||e[4]!==s||e[5]!==a||e[6]!==n||e[7]!==l){let h;e[9]!==l?(h=_=>!l||_.tables.some(g=>g.name.toLowerCase().includes(l.toLowerCase())),e[9]=l,e[10]=h):h=e[10];const f=n.filter(h);let p;e[11]!==i||e[12]!==r||e[13]!==o||e[14]!==s||e[15]!==a||e[16]!==l?(p=_=>u.jsx(jL,{databaseName:i,schema:_,hasSearch:a,children:u.jsx(n3,{tables:_.tables,searchValue:l,sqlTableContext:{engine:s,database:i,schema:_.name,defaultSchema:o,defaultDatabase:r}})},_.name),e[11]=i,e[12]=r,e[13]=o,e[14]=s,e[15]=a,e[16]=l,e[17]=p):p=e[17],c=f.map(p),e[1]=i,e[2]=r,e[3]=o,e[4]=s,e[5]=a,e[6]=n,e[7]=l,e[8]=c}else c=e[8];return e[18]!==c?(d=u.jsx(u.Fragment,{children:c}),e[18]=c,e[19]=d):d=e[19],d},jL=t=>{const e=X.c(26),{databaseName:n,schema:o,children:r,hasSearch:s}=t,[i,a]=K.useState(!1),[l,c]=K.useState(!1),d=`${n}:${o.name}`;let h,f,p,_;if(e[0]!==s?(h=()=>{a(s)},f=[s],e[0]=s,e[1]=h,e[2]=f):(h=e[1],f=e[2]),K.useEffect(h,f),cS(o.name))return r;e[3]!==i||e[4]!==l?(p=()=>{a(!i),c(!l)},e[3]=i,e[4]=l,e[5]=p):p=e[5],e[6]!==i?(_=u.jsx(dS,{isExpanded:i}),e[6]=i,e[7]=_):_=e[7];const g=l&&i&&"text-foreground";let m,b;e[8]!==g?(m=je("h-4 w-4 text-muted-foreground",g),e[8]=g,e[9]=m):m=e[9],e[10]!==m?(b=u.jsx(g$,{className:m}),e[10]=m,e[11]=b):b=e[11];const y=l&&i&&"font-semibold";let x,v,C;e[12]!==y?(x=je(y),e[12]=y,e[13]=x):x=e[13],e[14]!==o.name||e[15]!==x?(v=u.jsx("span",{className:x,children:o.name}),e[14]=o.name,e[15]=x,e[16]=v):v=e[16],e[17]!==v||e[18]!==p||e[19]!==_||e[20]!==b||e[21]!==d?(C=u.jsxs(lo,{className:"text-sm flex flex-row gap-1 items-center pl-5 cursor-pointer rounded-none",onSelect:p,value:d,children:[_,b,v]}),e[17]=v,e[18]=p,e[19]=_,e[20]=b,e[21]=d,e[22]=C):C=e[22];const k=i&&r;let E;return e[23]!==C||e[24]!==k?(E=u.jsxs(u.Fragment,{children:[C,k]}),e[23]=C,e[24]=k,e[25]=E):E=e[25],E},n3=t=>{const e=X.c(24),{tables:n,sqlTableContext:o,searchValue:r}=t,{addTableList:s}=iS(),[i,a]=K.useState(!1),[l,c]=K.useState(!1);let d,h;e[0]!==s||e[1]!==o||e[2]!==n.length||e[3]!==i?(d=async()=>{if(n.length===0&&o&&!i){a(!0),c(!0);const{engine:m,database:b,schema:y}=o,x=await zH.request({engine:m,database:b,schema:y});if(!(x!=null&&x.tables))throw c(!1),new Error("No tables available");s({tables:x.tables,sqlTableContext:o}),c(!1)}},e[0]=s,e[1]=o,e[2]=n.length,e[3]=i,e[4]=d):d=e[4],e[5]!==o||e[6]!==n.length||e[7]!==i?(h=[n.length,o,i],e[5]=o,e[6]=n.length,e[7]=i,e[8]=h):h=e[8];const{isPending:f,error:p}=zn(d,h);if(f||l){let m;return e[9]===Symbol.for("react.memo_cache_sentinel")?(m=u.jsx(aS,{message:"Loading tables...",className:"pl-12"}),e[9]=m):m=e[9],m}if(p){let m;return e[10]!==p?(m=u.jsx(lS,{error:p,className:"pl-12"}),e[10]=p,e[11]=m):m=e[11],m}if(n.length===0){let m;return e[12]===Symbol.for("react.memo_cache_sentinel")?(m=u.jsx(Pc,{content:"No tables found",className:"pl-9"}),e[12]=m):m=e[12],m}let _,g;if(e[13]!==r||e[14]!==o||e[15]!==n){let m;e[17]!==r?(m=x=>!r||x.name.toLowerCase().includes(r.toLowerCase()),e[17]=r,e[18]=m):m=e[18];const b=n.filter(m);let y;e[19]!==r||e[20]!==o?(y=x=>u.jsx(EL,{table:x,sqlTableContext:o,isSearching:!!r},x.name),e[19]=r,e[20]=o,e[21]=y):y=e[21],_=b.map(y),e[13]=r,e[14]=o,e[15]=n,e[16]=_}else _=e[16];return e[22]!==_?(g=u.jsx(u.Fragment,{children:_}),e[22]=_,e[23]=g):g=e[23],g},EL=t=>{const e=X.c(62),{table:n,sqlTableContext:o,isSearching:r}=t,{addTable:s}=iS(),[i,a]=K.useState(!1),[l,c]=K.useState(!1),d=n.columns.length>0;let h,f;e[0]!==s||e[1]!==i||e[2]!==o||e[3]!==n.name||e[4]!==d||e[5]!==l?(h=async()=>{if(i&&!d&&o&&!l){c(!0);const{engine:q,database:te,schema:re}=o,ie=await BH.request({engine:q,database:te,schema:re,tableName:n.name});if(!(ie!=null&&ie.table))throw new Error("No table details available");s({table:ie.table,sqlTableContext:o})}},e[0]=s,e[1]=i,e[2]=o,e[3]=n.name,e[4]=d,e[5]=l,e[6]=h):h=e[6],e[7]!==i||e[8]!==d?(f=[i,d],e[7]=i,e[8]=d,e[9]=f):f=e[9];const{isPending:p,error:_}=zn(h,f),g=Be(Hi),m=Or(),{createNewCell:b}=kt();let y;e[10]!==g||e[11]!==b||e[12]!==m||e[13]!==o||e[14]!==n?(y=()=>{ao(g,b,m),b({code:(()=>{if(n.source_type==="catalog"){const q=o!=null&&o.database?`${o.database}.${n.name}`:n.name;return`${n.engine}.load_table("${q}")`}if(o)return uS(n,"*",o);switch(n.source_type){case"local":return`mo.ui.table(${n.name})`;case"duckdb":case"connection":return uS(n,"*",o);default:return ic(n.source_type),""}})(),before:!1,cellId:m??"__end__"})},e[10]=g,e[11]=b,e[12]=m,e[13]=o,e[14]=n,e[15]=y):y=e[15];const x=y;let v;e[16]!==n.num_columns||e[17]!==n.num_rows?(v=()=>{const q=[];return n.num_rows!=null&&q.push(`${n.num_rows} rows`),n.num_columns!=null&&q.push(`${n.num_columns} columns`),q.length===0?null:u.jsx("div",{className:"flex flex-row gap-2 items-center pl-6 group-hover:hidden",children:u.jsx("span",{className:"text-xs text-muted-foreground",children:q.join(", ")})})},e[16]=n.num_columns,e[17]=n.num_rows,e[18]=v):v=e[18];const C=v;let k;e[19]!==_||e[20]!==p||e[21]!==o||e[22]!==n?(k=()=>{if(p)return u.jsx(aS,{message:"Loading columns...",className:"pl-12"});if(_)return u.jsx(lS,{error:_,className:"pl-12"});const q=n.columns;return q.length===0?u.jsx(Pc,{content:"No columns found",className:"pl-12"}):q.map(te=>u.jsx(IL,{table:n,column:te,sqlTableContext:o},te.name))},e[19]=_,e[20]=p,e[21]=o,e[22]=n,e[23]=k):k=e[23];const E=k;let N;e[24]!==i||e[25]!==r||e[26]!==n.source_type||e[27]!==n.type?(N=()=>{if(n.source_type==="local")return;const q=n.type==="table"?d$:F3;return u.jsx(q,{className:"h-3 w-3",strokeWidth:i||r?2.5:void 0})},e[24]=i,e[25]=r,e[26]=n.source_type,e[27]=n.type,e[28]=N):N=e[28];const I=N,A=o?`${o.database}.${o.schema}.${n.name}`:n.name,M=o&&(cS(o.schema)?"pl-9":"pl-12"),R=(i||r)&&"font-semibold";let z,D,F,B,U,O,S,$,j,W,Y,G;return e[29]!==M||e[30]!==R?(z=je("rounded-none group h-8 cursor-pointer",M,R),e[29]=M,e[30]=R,e[31]=z):z=e[31],e[32]!==i?(D=()=>a(!i),e[32]=i,e[33]=D):D=e[33],e[34]!==I?(F=I(),e[34]=I,e[35]=F):F=e[35],e[36]!==n.name?(B=u.jsx("span",{className:"text-sm",children:n.name}),e[36]=n.name,e[37]=B):B=e[37],e[38]!==F||e[39]!==B?(U=u.jsxs("div",{className:"flex gap-2 items-center flex-1",children:[F,B]}),e[38]=F,e[39]=B,e[40]=U):U=e[40],e[41]!==C?(O=C(),e[41]=C,e[42]=O):O=e[42],e[43]!==x?(S=Pn.stopPropagation(()=>x()),e[43]=x,e[44]=S):S=e[44],e[45]===Symbol.for("react.memo_cache_sentinel")?($=u.jsx(u$,{className:"h-3 w-3"}),e[45]=$):$=e[45],e[46]!==S?(j=u.jsx(Ae,{content:"Add table to notebook",delayDuration:400,children:u.jsx(Te,{className:"group-hover:inline-flex hidden",variant:"text",size:"icon",onClick:S,children:$})}),e[46]=S,e[47]=j):j=e[47],e[48]!==i||e[49]!==D||e[50]!==U||e[51]!==O||e[52]!==j||e[53]!==z||e[54]!==A?(W=u.jsxs(lo,{className:z,value:A,"aria-selected":i,forceMount:!0,onSelect:D,children:[U,O,j]}),e[48]=i,e[49]=D,e[50]=U,e[51]=O,e[52]=j,e[53]=z,e[54]=A,e[55]=W):W=e[55],e[56]!==i||e[57]!==E?(Y=i&&E(),e[56]=i,e[57]=E,e[58]=Y):Y=e[58],e[59]!==W||e[60]!==Y?(G=u.jsxs(u.Fragment,{children:[W,Y]}),e[59]=W,e[60]=Y,e[61]=G):G=e[61],G},IL=t=>{var Y,G;const e=X.c(53),{table:n,column:o,sqlTableContext:r}=t,[s,i]=K.useState(!1),a=Be(rS),l=Kt(h$);let c,d;e[0]!==a?(c=()=>{a&&i(!1)},d=[a],e[0]=a,e[1]=c,e[2]=d):(c=e[1],d=e[2]),K.useEffect(c,d),l(s?q=>new Set([...q,`${n.name}:${o.name}`]):q=>(q.delete(`${n.name}:${o.name}`),new Set(q)));const h=Be(Hi),f=Or(),{createNewCell:p}=kt(),{columnsPreviews:_}=f$();let g;e[3]!==o.name||e[4]!==n.primary_keys?(g=((Y=n.primary_keys)==null?void 0:Y.includes(o.name))||!1,e[3]=o.name,e[4]=n.primary_keys,e[5]=g):g=e[5];const m=g;let b;e[6]!==o.name||e[7]!==n.indexes?(b=((G=n.indexes)==null?void 0:G.includes(o.name))||!1,e[6]=o.name,e[7]=n.indexes,e[8]=b):b=e[8];const y=b;let x;e[9]!==h||e[10]!==p||e[11]!==f?(x=q=>{q.includes("alt")&&_$(h,p,f),p({code:q,before:!1,cellId:f??"__end__"})},e[9]=h,e[10]=p,e[11]=f,e[12]=x):x=e[12];const v=x,C=AL,k=s?"font-semibold":"";let E;e[13]!==o.name||e[14]!==k?(E=u.jsx("span",{className:k,children:o.name}),e[13]=o.name,e[14]=k,e[15]=E):E=e[15];const N=E,I=`${n.name}.${o.name}`,A=`${n.name}.${o.name}`;let M;e[16]!==s?(M=()=>i(!s),e[16]=s,e[17]=M):M=e[17];const R=r?"pl-14":"pl-7";let z,D,F,B,U,O,S,$,j,W;return e[18]!==R?(z=je("flex flex-row gap-2 items-center flex-1",R),e[18]=R,e[19]=z):z=e[19],e[20]!==o.type||e[21]!==N?(D=u.jsx(p$,{columnName:N,dataType:o.type}),e[20]=o.type,e[21]=N,e[22]=D):D=e[22],e[23]!==m?(F=m&&C({tooltipContent:"Primary key",content:"PK"}),e[23]=m,e[24]=F):F=e[24],e[25]!==y?(B=y&&C({tooltipContent:"Indexed",content:"IDX"}),e[25]=y,e[26]=B):B=e[26],e[27]!==z||e[28]!==D||e[29]!==F||e[30]!==B?(U=u.jsxs("div",{className:z,children:[D,F,B]}),e[27]=z,e[28]=D,e[29]=F,e[30]=B,e[31]=U):U=e[31],e[32]!==o.name?(O=u.jsx(Ae,{content:"Copy column name",delayDuration:400,children:u.jsx(Te,{variant:"text",size:"icon",className:"group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground",children:u.jsx(Z4,{tooltip:!1,value:o.name,className:"h-3 w-3"})})}),e[32]=o.name,e[33]=O):O=e[33],e[34]!==o.external_type?(S=u.jsx("span",{className:"text-xs text-muted-foreground",children:o.external_type}),e[34]=o.external_type,e[35]=S):S=e[35],e[36]!==M||e[37]!==U||e[38]!==O||e[39]!==S||e[40]!==I||e[41]!==A?($=u.jsxs(lo,{className:"rounded-none py-1 group cursor-pointer",value:A,onSelect:M,children:[U,O,S]},I),e[36]=M,e[37]=U,e[38]=O,e[39]=S,e[40]=I,e[41]=A,e[42]=$):$=e[42],e[43]!==o||e[44]!==_||e[45]!==v||e[46]!==s||e[47]!==r||e[48]!==n?(j=s&&u.jsx("div",{className:"pl-10 pr-2 py-2 bg-[var(--slate-1)] shadow-inner border-b",children:u.jsx(pc,{children:u.jsx(m$,{table:n,column:o,onAddColumnChart:v,preview:_.get(r?`${r.database}.${r.schema}.${n.name}:${o.name}`:`${n.name}:${o.name}`),sqlTableContext:r})})}),e[43]=o,e[44]=_,e[45]=v,e[46]=s,e[47]=r,e[48]=n,e[49]=j):j=e[49],e[50]!==$||e[51]!==j?(W=u.jsxs(u.Fragment,{children:[$,j]}),e[50]=$,e[51]=j,e[52]=W):W=e[52],W};function AL(t){const{tooltipContent:e,content:n}=t;return u.jsx(Ae,{content:e,delayDuration:100,children:u.jsx("span",{className:"text-xs text-black bg-gray-100 dark:invert rounded px-1",children:n})})}const TL=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx(kL,{}),t[0]=e):e=t[0],e},ML=()=>{const t=X.c(5),{documentation:e}=Be(b$);if(!e){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(gn,{title:"View docs as you type",description:"Move your text cursor over a symbol to see its documentation.",icon:u.jsx(ed,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=Fp({html:e}),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=u.jsx("div",{className:"p-3 overflow-y-auto overflow-x-hidden h-full docs-documentation flex flex-col gap-4",children:n}),t[3]=n,t[4]=o):o=t[4],o},OL=()=>{const t=X.c(5),e=y$();if(e.length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(gn,{title:"No errors!",icon:u.jsx(Em,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=e.map(DL),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=u.jsx("div",{className:"flex flex-col overflow-auto",children:n}),t[3]=n,t[4]=o):o=t[4],o};function DL(t){return u.jsxs("div",{children:[u.jsx("div",{className:"text-xs font-mono font-semibold bg-muted border-y px-2 py-1",children:u.jsx(x$,{cellId:t.cellId})}),u.jsx("div",{className:"px-2",children:u.jsx(w$,{errors:t.output.data,cellId:t.cellId},t.cellId)},t.cellId)]},t.cellId)}function o3(t,e,n){return t[e]?t[e][0]?t[e][0][n]:t[e][n]:e==="contentBoxSize"?t.contentRect[n==="inlineSize"?"width":"height"]:void 0}Qp=function(t){t===void 0&&(t={});var e=t.onResize,n=T.useRef(void 0);n.current=e;var o=t.round||Math.round,r=T.useRef(),s=T.useState({width:void 0,height:void 0}),i=s[0],a=s[1],l=T.useRef(!1);T.useEffect(function(){return l.current=!1,function(){l.current=!0}},[]);var c=T.useRef({width:void 0,height:void 0}),d=function(h,f){var p=T.useRef(null),_=T.useRef(null);_.current=f;var g=T.useRef(null);T.useEffect(function(){m()});var m=T.useCallback(function(){var b=g.current,y=_.current,x=b||(y?y instanceof Element?y:y.current:null);p.current&&p.current.element===x&&p.current.subscriber===h||(p.current&&p.current.cleanup&&p.current.cleanup(),p.current={element:x,subscriber:h,cleanup:x?h(x):void 0})},[h]);return T.useEffect(function(){return function(){p.current&&p.current.cleanup&&(p.current.cleanup(),p.current=null)}},[]),T.useCallback(function(b){g.current=b,m()},[m])}(T.useCallback(function(h){return r.current&&r.current.box===t.box&&r.current.round===o||(r.current={box:t.box,round:o,instance:new ResizeObserver(function(f){var p=f[0],_=t.box==="border-box"?"borderBoxSize":t.box==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",g=o3(p,_,"inlineSize"),m=o3(p,_,"blockSize"),b=g?o(g):void 0,y=m?o(m):void 0;if(c.current.width!==b||c.current.height!==y){var x={width:b,height:y};c.current.width=b,c.current.height=y,n.current?n.current(x):l.current||a(x)}})}),r.current.instance.observe(h,{box:t.box}),function(){r.current&&r.current.instance.unobserve(h)}},[t.box,o]),t.ref);return T.useMemo(function(){return{ref:d,width:i.width,height:i.height}},[d,i.width,i.height])};const Hf=new Map,RL=({file:t,onOpenNotebook:e})=>{const{theme:n}=lr(),o=Be(op),[r,s]=T.useState(""),{data:i,isPending:a,error:l,setData:c}=zn(async()=>{const g=await Bp({path:t.path}),m=g.contents||"";return s(Hf.get(t.path)||m),g},[t.path]),d=async()=>{r!==(i==null?void 0:i.contents)&&await I$({path:t.path,contents:r}).then(g=>{g.success&&(c(m=>({...m,contents:r})),s(r))})},h=T.useRef(r);if(h.current=r,T.useEffect(()=>()=>{if(!(i!=null&&i.contents))return;const g=h.current;g===i.contents?Hf.delete(t.path):Hf.set(t.path,g)},[t.path,i==null?void 0:i.contents]),l)return u.jsx(Rr,{error:l});if(a||!i)return null;const f=i.mimeType||"text/plain",p=f in Wf;if(!i.contents&&!p)return u.jsxs("div",{className:"grid grid-cols-2 gap-2 p-6",children:[u.jsx("div",{className:"font-bold text-muted-foreground",children:"Name"}),u.jsx("div",{children:i.file.name}),u.jsx("div",{className:"font-bold text-muted-foreground",children:"Type"}),u.jsx("div",{children:f})]});const _=u.jsxs("div",{className:"text-xs text-muted-foreground p-1 flex justify-end gap-2 border-b",children:[t.isMarimoFile&&!xn()&&u.jsx(Ae,{content:"Open notebook",children:u.jsx(mn,{size:"small",onClick:g=>e(g),children:u.jsx(uc,{})})}),u.jsx(Ae,{content:"Download",children:u.jsx(mn,{size:"small",onClick:()=>{if(r3(f)){const g=j$(i.contents,f);return void E$(g,i.file.name)}Xi(new Blob([i.contents||r],{type:f}),i.file.name)},children:u.jsx(hp,{})})}),!r3(f)&&u.jsxs(u.Fragment,{children:[u.jsx(Ae,{content:"Copy contents to clipboard",children:u.jsx(mn,{size:"small",onClick:async()=>{await pn(r)},children:u.jsx($i,{})})}),u.jsx(Ae,{content:nn("global.save"),children:u.jsx(mn,{size:"small",color:r===i.contents?void 0:"green",onClick:d,disabled:r===i.contents,children:u.jsx(ba,{})})})]})]});return f.startsWith("image/")?u.jsxs(u.Fragment,{children:[_,u.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:u.jsx(v$,{base64:i.contents,mime:f})})]}):f==="text/csv"&&i.contents?u.jsxs(u.Fragment,{children:[_,u.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:u.jsx(k$,{contents:i.contents})})]}):f.startsWith("audio/")?u.jsxs(u.Fragment,{children:[_,u.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:u.jsx(S$,{base64:i.contents,mime:f})})]}):f.startsWith("video/")?u.jsxs(u.Fragment,{children:[_,u.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:u.jsx(C$,{base64:i.contents,mime:f})})]}):f.startsWith("application/pdf")?u.jsxs(u.Fragment,{children:[_,u.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:u.jsx(N$,{base64:i.contents,mime:f})})]}):u.jsxs(u.Fragment,{children:[_,u.jsx("div",{className:"flex-1 overflow-auto",children:u.jsx(T.Suspense,{children:u.jsx(ca,{theme:n==="dark"?"dark":"light",language:Wf[f]||Wf.default,className:"border-b",extensions:[tt.lineWrapping,Bn.of([{key:o.getHotkey("global.save").key,stopPropagation:!0,run:()=>r!==i.contents&&(d(),!0)}])],value:r,onChange:s})})})]})},r3=t=>t.startsWith("image/")||t.startsWith("audio/")||t.startsWith("video/")||t.startsWith("application/pdf"),Wf={"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"},s3=Ht(new class{constructor(t){this.callbacks=t,this.delegate=new Gp([]),this.rootPath="",this.onChange=wn.NOOP,this.path=new lc("/"),this.initialize=async e=>{if(this.onChange=e,this.delegate.data.length===0)try{const n=await this.callbacks.listFiles({path:this.rootPath});this.delegate=new Gp(n.files),this.rootPath=n.root,this.path=lc.guessDeliminator(n.root)}catch(n){ut({title:"Failed",description:M4(n)})}this.onChange(this.delegate.data)},this.refreshAll=async e=>{const n=[this.rootPath,...e.map(r=>{var s;return(s=this.delegate.find(r))==null?void 0:s.data.path})].filter(Boolean),o=await Promise.all(n.map(r=>this.callbacks.listFiles({path:r}).catch(()=>({files:[]}))));for(const[r,s]of n.entries()){const i=o[r];s===this.rootPath?this.delegate=new Gp(i.files):this.delegate.update({id:s,changes:{children:i.files}})}this.onChange(this.delegate.data)},this.relativeFromRoot=e=>{const n=this.rootPath.endsWith(this.path.deliminator)?this.rootPath:`${this.rootPath}${this.path.deliminator}`;return e.startsWith(n)?e.slice(n.length):e},this.handleResponse=e=>e.success?e:(ut({title:"Failed",description:e.message}),null)}async expand(t){const e=this.delegate.find(t);if(!e||!e.data.isDirectory)return!1;if(e.children&&e.children.length>0)return!0;const n=await this.callbacks.listFiles({path:e.data.path});return this.delegate.update({id:t,changes:{children:n.files}}),this.onChange(this.delegate.data),!0}async rename(t,e){const n=this.delegate.find(t);if(!n)return;const o=n.data.path,r=this.path.join(this.path.dirname(o),e);await this.callbacks.renameFileOrFolder({path:o,newPath:r}).then(this.handleResponse),this.delegate.update({id:t,changes:{name:e,path:r}}),this.onChange(this.delegate.data),await this.refreshAll([r])}async move(t,e){var o;const n=e?((o=this.delegate.find(e))==null?void 0:o.data.path)??e:this.rootPath;await Promise.all(t.map(r=>{this.delegate.move({id:r,parentId:e,index:0});const s=this.delegate.find(r);if(!s)return Promise.resolve();const i=this.path.join(n,this.path.basename(s.data.path));return this.delegate.update({id:r,changes:{path:i}}),this.callbacks.renameFileOrFolder({path:s.data.path,newPath:i}).then(this.handleResponse)})),this.onChange(this.delegate.data),await this.refreshAll([n])}async createFile(t,e){var r;const n=e?((r=this.delegate.find(e))==null?void 0:r.data.path)??e:this.rootPath,o=await this.callbacks.createFileOrFolder({path:n,type:"file",name:t}).then(this.handleResponse);o!=null&&o.info&&(this.delegate.create({parentId:e,index:0,data:o.info}),this.onChange(this.delegate.data),await this.refreshAll([n]))}async createFolder(t,e){var r;const n=e?((r=this.delegate.find(e))==null?void 0:r.data.path)??e:this.rootPath,o=await this.callbacks.createFileOrFolder({path:n,type:"directory",name:t}).then(this.handleResponse);o!=null&&o.info&&(this.delegate.create({parentId:e,index:0,data:o.info}),this.onChange(this.delegate.data),await this.refreshAll([n]))}async delete(t){const e=this.delegate.find(t);e&&(await this.callbacks.deleteFileOrFolder({path:e.data.path}).then(this.handleResponse),this.delegate.drop({id:t}),this.onChange(this.delegate.data))}}({listFiles:a4,createFileOrFolder:Up,deleteFileOrFolder:T$,renameFileOrFolder:A$})),PL=Ht({});function LL(t){return new Promise((e,n)=>{const o=new FileReader;o.onload=r=>{var s;e((s=r.target)==null?void 0:s.result)},o.onerror=r=>{n(new Error(`Failed to read blob: ${r.type}`))},o.readAsDataURL(t)})}function i3(t){const e=X.c(4);let n;e[0]!==t?(n=t===void 0?{}:t,e[0]=t,e[1]=n):n=e[1];const o=n;let r;return e[2]!==o?(r={multiple:!0,maxSize:104857600,onError:VL,onDropRejected:zL,onDrop:FL,...o},e[2]=o,e[3]=r):r=e[3],M$(r)}async function FL(t){for(const e of t){const n=HL($L(e));let o="";n&&(o=lc.guessDeliminator(n).dirname(n));const r=(await LL(e)).split(",")[1];await Up({path:o,type:"file",name:e.name,contents:r})}await async function(){await ct.get(s3).refreshAll([])}()}function zL(t){ut({title:"File upload failed",description:u.jsx("div",{className:"flex flex-col gap-1",children:t.map(BL)}),variant:"danger"})}function BL(t){return u.jsxs("div",{children:[t.file.name," (",t.errors.map(UL).join(", "),")"]},t.file.name)}function UL(t){return t.message}function VL(t){It.error(t),ut({title:"File upload failed",description:t.message,variant:"danger"})}function $L(t){return t.webkitRelativePath?t.webkitRelativePath:"path"in t&&typeof t.path=="string"?t.path:"relativePath"in t&&typeof t.relativePath=="string"?t.relativePath:void 0}function HL(t){if(t)return t.replace(/^\/+/,"")}const a3=K.createContext(null),WL=t=>{const e=X.c(60),{height:n}=t,o=T.useRef(null),[r]=tn(s3);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=[],e[0]=s):s=e[0];const[i,a]=T.useState(s),[l,c]=T.useState(null),{openPrompt:d}=Fn(),[h,f]=tn(PL);let p,_;e[1]!==r?(p=()=>r.initialize(a),e[1]=r,e[2]=p):p=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(_=[],e[3]=_):_=e[3];const{isPending:g,error:m}=zn(p,_);let b;e[4]!==h||e[5]!==r?(b=()=>{r.refreshAll(Object.keys(h).filter(S=>h[S]))},e[4]=h,e[5]=r,e[6]=b):b=e[6];const y=Xe(b);let x;e[7]!==d||e[8]!==r?(x=async()=>{d({title:"Folder name",onConfirm:async S=>{r.createFolder(S,null)}})},e[7]=d,e[8]=r,e[9]=x):x=e[9];const v=Xe(x);let C;e[10]!==d||e[11]!==r?(C=async()=>{d({title:"File name",onConfirm:async S=>{r.createFile(S,null)}})},e[10]=d,e[11]=r,e[12]=C):C=e[12];const k=Xe(C);let E;e[13]!==f?(E=()=>{var S;(S=o.current)==null||S.closeAll(),f({})},e[13]=f,e[14]=E):E=e[14];const N=Xe(E);if(g){let S;return e[15]===Symbol.for("react.memo_cache_sentinel")?(S=u.jsx(Vn,{size:"medium",centered:!0}),e[15]=S):S=e[15],S}if(m){let S;return e[16]!==m?(S=u.jsx(Rr,{error:m}),e[16]=m,e[17]=S):S=e[17],S}if(l){let S,$,j,W,Y,G;return e[18]===Symbol.for("react.memo_cache_sentinel")?(S=()=>c(null),e[18]=S):S=e[18],e[19]===Symbol.for("react.memo_cache_sentinel")?($=u.jsx(Te,{onClick:S,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:u.jsx(Ct,{size:16})}),e[19]=$):$=e[19],e[20]!==l.name?(j=u.jsxs("div",{className:"flex items-center pl-1 pr-3 flex-shrink-0 border-b justify-between",children:[$,u.jsx("span",{className:"font-bold",children:l.name})]}),e[20]=l.name,e[21]=j):j=e[21],e[22]!==l.path||e[23]!==r?(W=q=>l3(q,r.relativeFromRoot(l.path)),e[22]=l.path,e[23]=r,e[24]=W):W=e[24],e[25]!==l||e[26]!==W?(Y=u.jsx(T.Suspense,{children:u.jsx(RL,{onOpenNotebook:W,file:l})}),e[25]=l,e[26]=W,e[27]=Y):Y=e[27],e[28]!==j||e[29]!==Y?(G=u.jsxs(u.Fragment,{children:[j,Y]}),e[28]=j,e[29]=Y,e[30]=G):G=e[30],G}let I;e[31]!==N||e[32]!==k||e[33]!==v||e[34]!==y||e[35]!==r?(I=u.jsx(GL,{onRefresh:y,onCreateFile:k,onCreateFolder:v,onCollapseAll:N,tree:r}),e[31]=N,e[32]=k,e[33]=v,e[34]=y,e[35]=r,e[36]=I):I=e[36];const A=n-33;let M,R,z,D,F,B,U,O;return e[37]!==r?(M=async S=>{const{ids:$}=S;for(const j of $)await r.delete(j)},R=async S=>{const{id:$,name:j}=S;await r.rename($,j)},z=async S=>{const{dragIds:$,parentId:j}=S;await r.move($,j)},e[37]=r,e[38]=M,e[39]=R,e[40]=z):(M=e[38],R=e[39],z=e[40]),e[41]===Symbol.for("react.memo_cache_sentinel")?(D=S=>{const $=S[0];$&&($.data.isDirectory||c($.data))},e[41]=D):D=e[41],e[42]!==h||e[43]!==f||e[44]!==r?(F=async S=>{if(await r.expand(S)){const $=h[S]??!1;f({...h,[S]:!$})}},e[42]=h,e[43]=f,e[44]=r,e[45]=F):F=e[45],e[46]!==i||e[47]!==h||e[48]!==M||e[49]!==R||e[50]!==z||e[51]!==F||e[52]!==A?(B=u.jsx(wH,{width:"100%",ref:o,height:A,className:"h-full",data:i,initialOpenState:h,openByDefault:!1,renderCursor:ZL,disableDrop:QL,onDelete:M,onRename:R,onMove:z,onSelect:D,onToggle:F,padding:15,rowHeight:30,indent:qL,overscanCount:1e3,disableMultiSelection:!0,children:KL}),e[46]=i,e[47]=h,e[48]=M,e[49]=R,e[50]=z,e[51]=F,e[52]=A,e[53]=B):B=e[53],e[54]!==B||e[55]!==r?(U=u.jsx(a3,{value:r,children:B}),e[54]=B,e[55]=r,e[56]=U):U=e[56],e[57]!==U||e[58]!==I?(O=u.jsxs(u.Fragment,{children:[I,U]}),e[57]=U,e[58]=I,e[59]=O):O=e[59],O},qL=15,GL=t=>{const e=X.c(30),{onRefresh:n,onCreateFile:o,onCreateFolder:r,onCollapseAll:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={noDrag:!0,noDragEventsBubbling:!0},e[0]=i):i=e[0];const{getRootProps:a,getInputProps:l}=i3(i);let c,d,h,f,p,_,g,m,b,y,x,v,C,k,E;return e[1]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(ga,{size:16}),e[1]=c):c=e[1],e[2]!==o?(d=u.jsx(Ae,{content:"Add file",children:u.jsx(Te,{"data-testid":"file-explorer-add-file-button",onClick:o,variant:"text",size:"xs",children:c})}),e[2]=o,e[3]=d):d=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(qc,{size:16}),e[4]=h):h=e[4],e[5]!==r?(f=u.jsx(Ae,{content:"Add folder",children:u.jsx(Te,{"data-testid":"file-explorer-add-folder-button",onClick:r,variant:"text",size:"xs",children:h})}),e[5]=r,e[6]=f):f=e[6],e[7]!==a?(p=a({}),e[7]=a,e[8]=p):p=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(_=O$({variant:"text",size:"xs"}),g=u.jsx(R$,{size:16}),e[9]=_,e[10]=g):(_=e[9],g=e[10]),e[11]!==p?(m=u.jsx(Ae,{content:"Upload file",children:u.jsx("button",{"data-testid":"file-explorer-upload-button",...p,className:_,children:g})}),e[11]=p,e[12]=m):m=e[12],e[13]!==l?(b=l({}),e[13]=l,e[14]=b):b=e[14],e[15]!==b?(y=u.jsx("input",{...b,type:"file"}),e[15]=b,e[16]=y):y=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx(L4,{size:16}),e[17]=x):x=e[17],e[18]!==n?(v=u.jsx(Ae,{content:"Refresh",children:u.jsx(Te,{"data-testid":"file-explorer-refresh-button",onClick:n,variant:"text",size:"xs",children:x})}),e[18]=n,e[19]=v):v=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(C=u.jsx(am,{size:16}),e[20]=C):C=e[20],e[21]!==s?(k=u.jsx(Ae,{content:"Collapse all folders",children:u.jsx(Te,{"data-testid":"file-explorer-collapse-button",onClick:s,variant:"text",size:"xs",children:C})}),e[21]=s,e[22]=k):k=e[22],e[23]!==y||e[24]!==v||e[25]!==k||e[26]!==d||e[27]!==f||e[28]!==m?(E=u.jsxs("div",{className:"flex items-center justify-end px-2 flex-shrink-0 border-b",children:[d,f,m,y,v,k]}),e[23]=y,e[24]=v,e[25]=k,e[26]=d,e[27]=f,e[28]=m,e[29]=E):E=e[29],E},YL=t=>{const e=X.c(9),{node:n,onOpenMarimoFile:o}=t;let r,s,i;return e[0]!==n?(r=a=>{n.data.isDirectory||(a.stopPropagation(),n.select())},e[0]=n,e[1]=r):r=e[1],e[2]!==n.data.isMarimoFile||e[3]!==o?(s=n.data.isMarimoFile&&!xn()&&u.jsxs("span",{className:"flex-shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline",onClick:o,children:["open ",u.jsx(uc,{className:"inline ml-1",size:12})]}),e[2]=n.data.isMarimoFile,e[3]=o,e[4]=s):s=e[4],e[5]!==n.data.name||e[6]!==r||e[7]!==s?(i=u.jsxs("span",{className:"flex-1 overflow-hidden text-ellipsis",onClick:r,children:[n.data.name,s]}),e[5]=n.data.name,e[6]=r,e[7]=s,e[8]=i):i=e[8],i},JL=t=>{const e=X.c(10),{node:n}=t,o=T.useRef(null);let r,s,i,a,l;return e[0]!==n.data.name?(r=()=>{var c,d;(c=o.current)==null||c.focus(),(d=o.current)==null||d.setSelectionRange(0,n.data.name.lastIndexOf("."))},s=[n.data.name],e[0]=n.data.name,e[1]=r,e[2]=s):(r=e[1],s=e[2]),T.useEffect(r,s),e[3]!==n?(i=()=>n.reset(),a=c=>{c.key==="Escape"&&n.reset(),c.key==="Enter"&&n.submit(c.currentTarget.value)},e[3]=n,e[4]=i,e[5]=a):(i=e[4],a=e[5]),e[6]!==n.data.name||e[7]!==i||e[8]!==a?(l=u.jsx("input",{ref:o,className:"flex-1 bg-transparent border border-border text-muted-foreground",defaultValue:n.data.name,onClick:eF,onBlur:i,onKeyDown:a}),e[6]=n.data.name,e[7]=i,e[8]=a,e[9]=l):l=e[9],l},KL=({node:t,style:e,dragHandle:n})=>{const o=t.data.isDirectory?"directory":s4(t.data.name),r=i4[o],{openConfirm:s,openPrompt:i}=Fn(),{createNewCell:a}=kt(),l=Or(),c=T.use(a3),d=async g=>{l3(g,c?c.relativeFromRoot(t.data.path):t.data.path)},h=async g=>{g.stopPropagation(),g.preventDefault(),s({title:"Delete file",description:`Are you sure you want to delete ${t.data.name}?`,confirmAction:u.jsx(e4,{onClick:async()=>{await t.tree.delete(t.id)},"aria-label":"Confirm",children:"Delete"})})},f=Xe(async()=>{t.open(),i({title:"Folder name",onConfirm:async g=>{c==null||c.createFolder(g,t.id)}})}),p=Xe(async()=>{t.open(),i({title:"File name",onConfirm:async g=>{c==null||c.createFile(g,t.id)}})}),_=Xe(async()=>{var y;if(!c||t.data.isDirectory)return;const[g,m]=D$(t.data.name),b=`${g}_copy${m}`;try{const x=await Bp({path:t.data.path}),v=((y=t.parent)==null?void 0:y.data.path)||"";await Up({path:v,type:"file",name:b,contents:x.contents?btoa(x.contents):void 0}),await c.refreshAll([v])}catch{ut({title:"Failed to duplicate file",description:"Unable to create a duplicate of the file",variant:"danger"})}});return u.jsxs("div",{style:e,ref:n,className:je("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group"),draggable:!0,onClick:g=>{g.stopPropagation(),t.data.isDirectory&&t.toggle()},children:[u.jsx(XL,{node:t}),u.jsxs("span",{className:je("flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group",t.willReceiveDrop&&t.data.isDirectory&&"bg-accent/80 hover:bg-accent/80 text-accent-foreground"),children:[t.data.isMarimoFile?u.jsx("img",{src:"./favicon.ico",className:"w-5 h-5 flex-shrink-0 mr-2 filter grayscale",alt:"Marimo"}):u.jsx(r,{className:"w-5 h-5 flex-shrink-0 mr-2",strokeWidth:1.5}),t.isEditing?u.jsx(JL,{node:t}):u.jsx(YL,{node:t,onOpenMarimoFile:d}),u.jsxs(Es,{modal:!1,children:[u.jsx(Is,{asChild:!0,tabIndex:-1,onClick:g=>g.stopPropagation(),children:u.jsx(Te,{"data-testid":"file-explorer-more-button",variant:"text",tabIndex:-1,size:"xs",className:"mb-0","aria-label":"More options",children:u.jsx(Wc,{strokeWidth:2,className:"w-5 h-5 hidden group-hover:block"})})}),(()=>{const g={size:14,strokeWidth:1.5,className:"mr-2"};return u.jsxs(As,{align:"end",className:"no-print w-[220px]",onClick:m=>m.stopPropagation(),onCloseAutoFocus:m=>m.preventDefault(),children:[!t.data.isDirectory&&u.jsxs(Wt,{onSelect:()=>t.select(),children:[u.jsx($m,{...g}),"Open file"]}),!t.data.isDirectory&&!xn()&&u.jsxs(Wt,{onSelect:()=>{P$({path:t.data.path})},children:[u.jsx(uc,{...g}),"Open file in external editor"]}),t.data.isDirectory&&u.jsxs(u.Fragment,{children:[u.jsxs(Wt,{onSelect:()=>p(),children:[u.jsx(ga,{...g}),"Create file"]}),u.jsxs(Wt,{onSelect:()=>f(),children:[u.jsx(qc,{...g}),"Create folder"]}),u.jsx(co,{})]}),u.jsxs(Wt,{onSelect:()=>t.edit(),children:[u.jsx(Im,{...g}),"Rename"]}),!t.data.isDirectory&&u.jsxs(Wt,{onSelect:_,children:[u.jsx($i,{...g}),"Duplicate"]}),u.jsxs(Wt,{onSelect:async()=>{await pn(t.data.path),ut({title:"Copied to clipboard"})},children:[u.jsx(Jc,{...g}),"Copy path"]}),c&&u.jsxs(Wt,{onSelect:async()=>{await pn(c.relativeFromRoot(t.data.path)),ut({title:"Copied to clipboard"})},children:[u.jsx(Jc,{...g}),"Copy relative path"]}),u.jsx(co,{}),u.jsxs(Wt,{onSelect:()=>{const{path:m}=t.data;(b=>{a({code:b,before:!1,cellId:l??"__end__"})})(hS[o](m))},children:[u.jsx(Fr,{...g}),"Insert snippet for reading file"]}),u.jsxs(Wt,{onSelect:async()=>{ut({title:"Copied to clipboard",description:"Code to open the file has been copied to your clipboard. You can also drag and drop this file into the editor"});const{path:m}=t.data,b=hS[o](m);await pn(b)},children:[u.jsx(L$,{...g}),"Copy snippet for reading file"]}),t.data.isMarimoFile&&!xn()&&u.jsxs(u.Fragment,{children:[u.jsx(co,{}),u.jsxs(Wt,{onSelect:d,children:[u.jsx(Fm,{...g}),"Open notebook"]})]}),u.jsx(co,{}),!t.data.isDirectory&&u.jsxs(u.Fragment,{children:[u.jsxs(Wt,{onSelect:async()=>{const m=(await Bp({path:t.data.path})).contents||"";Xi(new Blob([m]),t.data.name)},children:[u.jsx(hp,{...g}),"Download"]}),u.jsx(co,{})]}),u.jsxs(Wt,{onSelect:h,variant:"danger",children:[u.jsx(np,{...g}),"Delete"]})]})})()]})]})]})},XL=t=>{const e=X.c(3),{node:n}=t;if(!n.data.isDirectory){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx("span",{className:"w-5 h-5 flex-shrink-0"}),e[0]=r):r=e[0],r}let o;return e[1]!==n.isOpen?(o=n.isOpen?u.jsx(js,{className:"w-5 h-5 flex-shrink-0"}):u.jsx(qi,{className:"w-5 h-5 flex-shrink-0"}),e[1]=n.isOpen,e[2]=o):o=e[2],o};function l3(t,e){t.stopPropagation(),t.preventDefault(),window.open(`/?file=${e}`,"_blank")}function ZL(){return null}function QL(t){const{parentNode:e}=t;return!e.data.isDirectory}function eF(t){return t.stopPropagation()}let c3,d3,u3;c3=()=>{const t=X.c(20),{ref:e,height:n}=Qp(),o=n===void 0?1:n;let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={noClick:!0,noKeyboard:!0},t[0]=r):r=t[0];const{getRootProps:s,getInputProps:i,isDragActive:a}=i3(r);let l,c,d,h,f,p,_,g;return t[1]!==s?(l=s(),t[1]=s,t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(c=je("flex flex-col flex-1 overflow-hidden relative"),t[3]=c):c=t[3],t[4]!==i?(d=i(),t[4]=i,t[5]=d):d=t[5],t[6]!==d?(h=u.jsx("input",{...d}),t[6]=d,t[7]=h):h=t[7],t[8]!==a?(f=a&&u.jsx("div",{className:"absolute inset-0 flex items-center uppercase justify-center text-xl font-bold text-primary/90 bg-accent/85 z-10 border-2 border-dashed border-primary/90 rounded-lg pointer-events-none",children:"Drop files here"}),t[8]=a,t[9]=f):f=t[9],t[10]!==o?(p=u.jsx(WL,{height:o}),t[10]=o,t[11]=p):p=t[11],t[12]!==e||t[13]!==p?(_=u.jsx("div",{ref:e,className:"flex flex-col flex-1 overflow-hidden",children:p}),t[12]=e,t[13]=p,t[14]=_):_=t[14],t[15]!==l||t[16]!==h||t[17]!==f||t[18]!==_?(g=u.jsxs("div",{...l,className:c,children:[h,f,_]}),t[15]=l,t[16]=h,t[17]=f,t[18]=_,t[19]=g):g=t[19],g},Zp=t=>{const e=X.c(6),n=t.dataTestId;let o,r;return e[0]!==t.className?(o=je("text-xs font-semibold text-accent-foreground",t.className),e[0]=t.className,e[1]=o):o=e[1],e[2]!==t.dataTestId||e[3]!==t.onClick||e[4]!==o?(r=u.jsx("button",{type:"button","data-testid":n,className:o,onClick:t.onClick,children:"Clear"}),e[2]=t.dataTestId,e[3]=t.onClick,e[4]=o,e[5]=r):r=e[5],r},d3=()=>{const t=X.c(9),e=F$(),{clearLogs:n}=kt();if(e.length===0){let i,a;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx("code",{className:"border rounded px-1",children:"stdout"}),t[0]=i):i=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx(gn,{title:"No logs",description:u.jsxs("span",{children:[i," and"," ",u.jsx("code",{className:"border rounded px-1",children:"stderr"})," logs will appear here."]}),icon:u.jsx(Zf,{})}),t[1]=a):a=t[1],a}let o,r,s;return t[2]!==n?(o=u.jsx("div",{className:"flex flex-row justify-end px-2 py-1",children:u.jsx(Zp,{dataTestId:"clear-logs-button",onClick:n})}),t[2]=n,t[3]=o):o=t[3],t[4]!==e?(r=u.jsx("div",{className:"overflow-auto flex-1",children:u.jsx(u3,{logs:e,className:"min-w-[300px]"})}),t[4]=e,t[5]=r):r=t[5],t[6]!==o||t[7]!==r?(s=u.jsxs(u.Fragment,{children:[o,r]}),t[6]=o,t[7]=r,t[8]=s):s=t[8],s},u3=t=>{const e=X.c(10),{logs:n,className:o}=t;let r,s,i,a,l;return e[0]!==o?(r=je("flex flex-col",o),e[0]=o,e[1]=r):r=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(s={whiteSpace:"pre-wrap"},e[2]=s):s=e[2],e[3]!==n?(i=n.map(oF),e[3]=n,e[4]=i):i=e[4],e[5]!==i?(a=u.jsx("pre",{className:"grid text-xs font-mono gap-1 whitespace-break-spaces font-semibold align-left",children:u.jsx("div",{className:"grid grid-cols-[30px,1fr]",style:s,children:i})}),e[5]=i,e[6]=a):a=e[6],e[7]!==r||e[8]!==a?(l=u.jsx("div",{className:r,children:a}),e[7]=r,e[8]=a,e[9]=l):l=e[9],l};function tF(t){const e=z$(t.timestamp),n=nF[t.level],o=t.level.toUpperCase();return u.jsxs(u.Fragment,{children:[u.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)] dark:text-[var(--gray-11)]",children:["[",e,"]"]}),u.jsx("span",{className:je("flex-shrink-0",n),children:o}),u.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)]",children:["(",u.jsx(cr,{cellId:t.cellId}),")"]}),t.message]})}const nF={stdout:"text-[var(--grass-9)]",stderr:"text-[var(--red-9)]"};function oF(t,e){return u.jsxs("div",{className:"contents group",children:[u.jsx("span",{className:je("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","text-right col-span-1 py-1 pr-1"),children:e+1}),u.jsx("span",{className:je("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","px-2 flex gap-x-1.5 py-1 flex-wrap"),children:tF(t)})]},e)}const rF=()=>{const t=X.c(7),{items:e}=Be(B$);let n,o;t[0]!==e?(o=UH(e),t[0]=e,t[1]=o):o=t[1],n=o;const r=n,{activeHeaderId:s,activeOccurrences:i}=VH(r);if(e.length===0){let l;return t[2]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx(gn,{title:"No outline",description:"Add markdown headings to your notebook to create an outline.",icon:u.jsx(Qc,{})}),t[2]=l):l=t[2],l}let a;return t[3]!==s||t[4]!==i||t[5]!==e?(a=u.jsx($H,{items:e,activeHeaderId:s,activeOccurrences:i}),t[3]=s,t[4]=i,t[5]=e,t[6]=a):a=t[6],a},h3=Ht(null),f3=t=>{const e=X.c(9),{onClick:n,loading:o,children:r,className:s}=t;if(o){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(Vn,{size:"small",className:"h-4 w-4 shrink-0 opacity-50"}),e[0]=c):c=e[0],c}let i,a,l;return e[1]!==s?(i=je("px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible",s),e[1]=s,e[2]=i):i=e[2],e[3]!==n?(a=Pn.stopPropagation(n),e[3]=n,e[4]=a):a=e[4],e[5]!==r||e[6]!==i||e[7]!==a?(l=u.jsx("button",{type:"button",className:i,onClick:a,children:r}),e[5]=r,e[6]=i,e[7]=a,e[8]=l):l=e[8],l},sF=()=>{var v,C;const t=X.c(27),[e]=Tr(),n=e.package_management.manager,[o,r]=K.useState(null);let s;t[0]!==n?(s=[n],t[0]=n,t[1]=s):s=t[1];const{data:i,error:a,refetch:l,isPending:c}=zn(cF,s);if(c){let k;return t[2]===Symbol.for("react.memo_cache_sentinel")?(k=u.jsx(Vn,{size:"medium",centered:!0}),t[2]=k):k=t[2],k}if(a){let k;return t[3]!==a?(k=u.jsx(Rr,{error:a}),t[3]=a,t[4]=k):k=t[4],k}const d=i.tree!=null;let h;t[5]!==d||t[6]!==o?(h=function(k,E){return k==="list"?"list":E?k||"tree":"list"}(o,d),t[5]=d,t[6]=o,t[7]=h):h=t[7];const f=h,p=(v=i.tree)==null?void 0:v.name,_=(C=i==null?void 0:i.tree)==null?void 0:C.version,g=p==="<root>";let m,b,y,x;return t[8]!==n||t[9]!==l?(m=u.jsx(iF,{packageManager:n,onSuccess:l}),t[8]=n,t[9]=l,t[10]=m):m=t[10],t[11]!==g||t[12]!==d||t[13]!==p||t[14]!==_||t[15]!==f?(b=d&&u.jsxs("div",{className:"flex items-center justify-between px-2 py-1 border-b",children:[u.jsxs("div",{className:"flex gap-1",children:[u.jsx("button",{type:"button",className:je("px-2 py-1 text-xs rounded",f==="list"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>r("list"),children:"List"}),u.jsx("button",{type:"button",className:je("px-2 py-1 text-xs rounded",f==="tree"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>r("tree"),children:"Tree"})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium",title:g?"sandbox":"project",children:g?"sandbox":"project"}),p&&!g&&u.jsxs("span",{className:"text-xs text-muted-foreground",children:[p,_&&` v${_}`]})]})]}),t[11]=g,t[12]=d,t[13]=p,t[14]=_,t[15]=f,t[16]=b):b=t[16],t[17]!==i.list||t[18]!==i.tree||t[19]!==a||t[20]!==l||t[21]!==f?(y=f==="list"?u.jsx(aF,{packages:i.list,onSuccess:l}):u.jsx(lF,{tree:i.tree,error:a,onSuccess:l}),t[17]=i.list,t[18]=i.tree,t[19]=a,t[20]=l,t[21]=f,t[22]=y):y=t[22],t[23]!==m||t[24]!==b||t[25]!==y?(x=u.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[m,b,y]}),t[23]=m,t[24]=b,t[25]=y,t[26]=x):x=t[26],x},iF=t=>{const e=X.c(40),{onSuccess:n,packageManager:o}=t,[r,s]=K.useState(""),{handleClick:i}=ua(),a=Be(h3),l=Kt(h3);let c,d;e[0]!==a||e[1]!==l?(c=()=>{a&&(s(a),l(null))},d=[a,l],e[0]=a,e[1]=l,e[2]=c,e[3]=d):(c=e[2],d=e[3]),K.useEffect(c,d);const{loading:h,handleInstallPackages:f}=$$();let p;e[4]!==n?(p=()=>{n(),s("")},e[4]=n,e[5]=p):p=e[5];const _=p;let g;e[6]!==f||e[7]!==r||e[8]!==_?(g=()=>{f(r.split(",").map(dF),_)},e[6]=f,e[7]=r,e[8]=_,e[9]=g):g=e[9];const m=g,b=`Install packages with ${o}...`;let y,x,v,C,k,E,N,I,A,M,R,z,D,F;e[10]!==h||e[11]!==i?(y=h?u.jsx(Vn,{size:"small",className:"mr-2 h-4 w-4 shrink-0 opacity-50"}):u.jsx(Ae,{content:"Change package manager",children:u.jsx($s,{onClick:()=>i("packageManagement"),className:"mr-2 h-4 w-4 shrink-0 opacity-50 hover:opacity-80 cursor-pointer"})}),e[10]=h,e[11]=i,e[12]=y):y=e[12],e[13]!==m?(x=j=>{j.key==="Enter"&&(j.preventDefault(),m())},e[13]=m,e[14]=x):x=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(v=j=>s(j.target.value),e[15]=v):v=e[15],e[16]!==r||e[17]!==b||e[18]!==y||e[19]!==x?(C=u.jsx(fS,{placeholder:b,id:k1,icon:y,rootClassName:"flex-1 border-none",value:r,onKeyDown:x,onChange:v}),e[16]=r,e[17]=b,e[18]=y,e[19]=x,e[20]=C):C=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(k=u.jsx("span",{className:"font-bold tracking-wide",children:"Package name:"}),e[21]=k):k=e[21],e[22]===Symbol.for("react.memo_cache_sentinel")?(E=u.jsxs("div",{children:[k," A package name; this will install the latest version.",u.jsx("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),N=u.jsx("span",{className:"font-bold tracking-wide",children:"Package and version:"}),e[22]=E,e[23]=N):(E=e[22],N=e[23]),e[24]===Symbol.for("react.memo_cache_sentinel")?(I=u.jsxs("div",{children:[N," ","A package with a specific version or version range.",u.jsx("div",{className:"text-muted-foreground",children:"Examples: httpx==0.27.0, httpx>=0.27.0"})]}),A=u.jsx("span",{className:"font-bold tracking-wide",children:"Git:"}),e[24]=I,e[25]=A):(I=e[24],A=e[25]),e[26]===Symbol.for("react.memo_cache_sentinel")?(M=u.jsxs("div",{children:[A," A Git repository",u.jsx("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),R=u.jsx("span",{className:"font-bold tracking-wide",children:"URL:"}),e[26]=M,e[27]=R):(M=e[26],R=e[27]),e[28]===Symbol.for("react.memo_cache_sentinel")?(z=u.jsxs("div",{children:[R," A remote wheel or source distribution.",u.jsx("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),D=u.jsx("span",{className:"font-bold tracking-wide",children:"Path:"}),e[28]=z,e[29]=D):(z=e[28],D=e[29]),e[30]===Symbol.for("react.memo_cache_sentinel")?(F=u.jsx(Ae,{delayDuration:300,side:"left",align:"start",content:u.jsxs("div",{className:"text-sm flex flex-col w-full max-w-[360px]",children:["Packages are installed using the package manager specified in your user configuration. Depending on your package manager, you can install packages with various formats:",u.jsxs("div",{className:"flex flex-col gap-2 mt-2",children:[E,I,M,z,u.jsxs("div",{children:[D," A local wheel, source distribution, or project directory.",u.jsx("div",{className:"text-muted-foreground",children:"Example: /example/foo-0.1.0-py3-none-any.whl"})]})]})]}),children:u.jsx(Rp,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),e[30]=F):F=e[30];const B=r&&"bg-accent text-accent-foreground";let U;e[31]!==B?(U=je("float-right px-2 m-0 h-full text-sm text-secondary-foreground ml-2",B,"disabled:cursor-not-allowed disabled:opacity-50"),e[31]=B,e[32]=U):U=e[32];const O=!r;let S,$;return e[33]!==m||e[34]!==U||e[35]!==O?(S=u.jsx("button",{type:"button",className:U,onClick:m,disabled:O,children:"Add"}),e[33]=m,e[34]=U,e[35]=O,e[36]=S):S=e[36],e[37]!==S||e[38]!==C?($=u.jsxs("div",{className:"flex items-center w-full border-b",children:[C,F,S]}),e[37]=S,e[38]=C,e[39]=$):$=e[39],$},aF=t=>{const e=X.c(9),{onSuccess:n,packages:o}=t;if(o.length===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx(gn,{title:"No packages",description:"No packages are installed in this environment.",icon:u.jsx($s,{})}),e[0]=a):a=e[0],a}let r,s,i;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(Vp,{children:u.jsxs(Vs,{children:[u.jsx(Pr,{children:"Name"}),u.jsx(Pr,{children:"Version"}),u.jsx(Pr,{})]})}),e[1]=r):r=e[1],e[2]!==n||e[3]!==o){let a;e[5]!==n?(a=l=>u.jsxs(Vs,{className:"group",onClick:async()=>{await pn(`${l.name}==${l.version}`),ut({title:"Copied to clipboard"})},children:[u.jsx(Lr,{children:l.name}),u.jsx(Lr,{children:l.version}),u.jsxs(Lr,{className:"flex justify-end",children:[u.jsx(p3,{packageName:l.name,onSuccess:n}),u.jsx(m3,{packageName:l.name,onSuccess:n})]})]},l.name),e[5]=n,e[6]=a):a=e[6],s=o.map(a),e[2]=n,e[3]=o,e[4]=s}else s=e[4];return e[7]!==s?(i=u.jsxs($p,{className:"overflow-auto flex-1",children:[r,u.jsx(Hp,{children:s})]}),e[7]=s,e[8]=i):i=e[8],i},p3=({packageName:t,onSuccess:e})=>{const[n,o]=K.useState(!1);return xn()?null:u.jsx(f3,{onClick:async()=>{try{o(!0);const r=await H$({package:t,upgrade:!0});r.success?(e(),pS(t)):pS(t,r.error)}finally{o(!1)}},loading:n,children:"Upgrade"})},m3=({packageName:t,onSuccess:e})=>{const[n,o]=K.useState(!1);return u.jsx(f3,{onClick:async()=>{try{o(!0);const r=await W$({package:t});r.success?(e(),mS(t)):mS(t,r.error)}finally{o(!1)}},loading:n,children:"Remove"})},lF=t=>{const e=X.c(18),{tree:n,error:o,onSuccess:r}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=new Set,e[0]=s):s=e[0];const[i,a]=K.useState(s);let l,c,d;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{a(new Set)},e[1]=l):l=e[1],e[2]!==n?(c=[n],e[2]=n,e[3]=c):c=e[3],K.useEffect(l,c),o){let _;return e[4]!==o?(_=u.jsx(Rr,{error:o}),e[4]=o,e[5]=_):_=e[5],_}if(!n){let _;return e[6]===Symbol.for("react.memo_cache_sentinel")?(_=u.jsx(Vn,{size:"medium",centered:!0}),e[6]=_):_=e[6],_}if(n.dependencies.length===0){let _;return e[7]===Symbol.for("react.memo_cache_sentinel")?(_=u.jsx(gn,{title:"No dependencies",description:"No package dependencies found in this environment.",icon:u.jsx($s,{})}),e[7]=_):_=e[7],_}e[8]===Symbol.for("react.memo_cache_sentinel")?(d=_=>{a(g=>{const m=new Set(g);return m.has(_)?m.delete(_):m.add(_),m})},e[8]=d):d=e[8];const h=d;let f,p;if(e[9]!==i||e[10]!==r||e[11]!==n.dependencies){let _;e[13]!==i||e[14]!==r?(_=(g,m)=>u.jsx("div",{className:"border-b",children:u.jsx(g3,{nodeId:`root-${m}`,node:g,level:0,isTopLevel:!0,expandedNodes:i,onToggle:h,onSuccess:r})},`${g.name}-${m}`),e[13]=i,e[14]=r,e[15]=_):_=e[15],f=n.dependencies.map(_),e[9]=i,e[10]=r,e[11]=n.dependencies,e[12]=f}else f=e[12];return e[16]!==f?(p=u.jsx("div",{className:"flex-1 overflow-auto",children:u.jsx("div",{children:f})}),e[16]=f,e[17]=p):p=e[17],p},g3=t=>{const e=X.c(57),{nodeId:n,node:o,level:r,isTopLevel:s,expandedNodes:i,onToggle:a,onSuccess:l}=t,c=s!==void 0&&s,d=o.dependencies.length>0;let h;e[0]!==i||e[1]!==n?(h=i.has(n),e[0]=i,e[1]=n,e[2]=h):h=e[2];const f=h,p=c?0:16+16*r;let _;e[3]!==d||e[4]!==n||e[5]!==a?(_=U=>{U.key!=="Enter"&&U.key!==" "||(U.preventDefault(),d&&a(n))},e[3]=d,e[4]=n,e[5]=a,e[6]=_):_=e[6];const g=_;let m;e[7]!==d||e[8]!==n||e[9]!==a?(m=U=>{U.stopPropagation(),d&&a(n)},e[7]=d,e[8]=n,e[9]=a,e[10]=m):m=e[10];const b=m,y=d&&"select-none",x=c?"px-2 py-0.5":"";let v,C;e[11]!==y||e[12]!==x?(v=je("flex items-center group cursor-pointer text-sm whitespace-nowrap","hover:bg-[var(--slate-2)] focus:bg-[var(--slate-2)] focus:outline-none",y,x),e[11]=y,e[12]=x,e[13]=v):v=e[13],e[14]!==p||e[15]!==c?(C=c?{}:{paddingLeft:`${p}px`},e[14]=p,e[15]=c,e[16]=C):C=e[16];const k=d?f:void 0;let E,N,I,A,M,R,z,D,F,B;return e[17]!==d||e[18]!==f?(E=d?f?u.jsx(js,{className:"w-4 h-4 mr-2 flex-shrink-0"}):u.jsx(qi,{className:"w-4 h-4 mr-2 flex-shrink-0"}):u.jsx("div",{className:"w-4 mr-2 flex-shrink-0"}),e[17]=d,e[18]=f,e[19]=E):E=e[19],e[20]!==o.name?(N=u.jsx("span",{className:"font-medium truncate",children:o.name}),e[20]=o.name,e[21]=N):N=e[21],e[22]!==o.version?(I=o.version&&u.jsxs("span",{className:"text-muted-foreground text-xs",children:["v",o.version]}),e[22]=o.version,e[23]=I):I=e[23],e[24]!==N||e[25]!==I?(A=u.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 py-1.5",children:[N,I]}),e[24]=N,e[25]=I,e[26]=A):A=e[26],e[27]!==o.tags?(M=o.tags.map(uF),e[27]=o.tags,e[28]=M):M=e[28],e[29]!==M?(R=u.jsx("div",{className:"flex items-center gap-1 ml-2",children:M}),e[29]=M,e[30]=R):R=e[30],e[31]!==c||e[32]!==o.name||e[33]!==l?(z=c&&u.jsxs("div",{className:"flex gap-1 invisible group-hover:visible",children:[u.jsx(p3,{packageName:o.name,onSuccess:l}),u.jsx(m3,{packageName:o.name,onSuccess:l})]}),e[31]=c,e[32]=o.name,e[33]=l,e[34]=z):z=e[34],e[35]!==b||e[36]!==g||e[37]!==E||e[38]!==A||e[39]!==R||e[40]!==z||e[41]!==v||e[42]!==C||e[43]!==k?(D=u.jsxs("div",{className:v,style:C,onClick:b,onKeyDown:g,tabIndex:0,role:"treeitem","aria-selected":!1,"aria-expanded":k,children:[E,A,R,z]}),e[35]=b,e[36]=g,e[37]=E,e[38]=A,e[39]=R,e[40]=z,e[41]=v,e[42]=C,e[43]=k,e[44]=D):D=e[44],e[45]!==i||e[46]!==d||e[47]!==f||e[48]!==r||e[49]!==o.dependencies||e[50]!==n||e[51]!==l||e[52]!==a?(F=d&&f&&u.jsx("div",{role:"group",children:o.dependencies.map((U,O)=>u.jsx(g3,{nodeId:`${n}-${O}`,node:U,level:r+1,isTopLevel:!1,expandedNodes:i,onToggle:a,onSuccess:l},`${U.name}-${O}`))}),e[45]=i,e[46]=d,e[47]=f,e[48]=r,e[49]=o.dependencies,e[50]=n,e[51]=l,e[52]=a,e[53]=F):F=e[53],e[54]!==D||e[55]!==F?(B=u.jsxs("div",{children:[D,F]}),e[54]=D,e[55]=F,e[56]=B):B=e[56],B};async function cF(){const[t,e]=await Promise.all([U$(),V$()]);return{list:t.packages,tree:e.tree}}function dF(t){return t.trim()}function uF(t,e){return t.kind==="cycle"?u.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-orange-300 dark:border-orange-700 text-orange-700 dark:text-orange-300",title:"cycle",children:"cycle"},e):t.kind==="extra"?u.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-blue-300 dark:border-blue-700 text-blue-700 dark:text-blue-300",title:t.value,children:t.value},e):t.kind==="group"?u.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-green-300 dark:border-green-700 text-green-700 dark:text-green-300",title:t.value,children:t.value},e):null}const qf=R3("marimo:scratchpadHistory:v1",[]),hF=Ht(!1),fF=Ht(null,(t,e,n)=>{if(!(n=n.trim()))return;const o=t(qf),r=[n,...o.filter(s=>s!==n)].slice(0,15);e(qf,r)}),pF={hide_code:!1,disabled:!1},mF=()=>{const t=X.c(69),e=mc(),[n]=Tr(),{theme:o}=lr(),r=T.useRef(null),s=Or(),{createNewCell:i,updateCellCode:a}=kt(),l=e.cellRuntime[dr],c=l==null?void 0:l.output,d=l==null?void 0:l.status,h=l==null?void 0:l.consoleOutputs,f=e.cellData[dr],p=(f==null?void 0:f.code)??"",_=Kt(fF),[g,m]=tn(hF),b=Be(qf);let y;t[0]!==_||t[1]!==p?(y=()=>{gS({code:p}),_(p)},t[0]=_,t[1]=p,t[2]=y):y=t[2];const x=Xe(y);let v;t[3]!==p||t[4]!==i||t[5]!==s?(v=()=>{p.trim()&&i({code:p,before:!1,cellId:s??"__end__"})},t[3]=p,t[4]=i,t[5]=s,t[6]=v):v=t[6];const C=Xe(v);let k;t[7]!==a?(k=()=>{a({cellId:dr,code:"",formattingChange:!1}),gS({code:""});const ae=r.current;ae&&ae.dispatch({changes:{from:0,to:ae.state.doc.length,insert:""}})},t[7]=a,t[8]=k):k=t[8];const E=Xe(k);let N;t[9]!==m||t[10]!==a?(N=ae=>{m(!1),a({cellId:dr,code:ae,formattingChange:!1});const Me=r.current;Me&&Me.dispatch({changes:{from:0,to:Me.state.doc.length,insert:ae}})},t[9]=m,t[10]=a,t[11]=N):N=t[11];const I=Xe(N),[A,M]=T.useState();let R;t[12]!==p||t[13]!==h||t[14]!==x||t[15]!==A||t[16]!==c||t[17]!==o||t[18]!==n?(R=()=>u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[40%]",children:u.jsx(Bu,{theme:o,showPlaceholder:!1,id:dr,code:p,config:pF,status:"idle",serializedEditorState:null,runCell:x,userConfig:n,editorViewRef:r,setEditorView:ae=>{r.current=ae},hidden:!1,temporarilyShowCode:wn.NOOP,languageAdapter:A,setLanguageAdapter:M})}),u.jsx("div",{className:"flex-1 overflow-auto flex-shrink-0",children:u.jsx(Tc,{allowExpand:!1,output:c,className:"output-area",cellId:dr,stale:!1,loading:!1})}),u.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[35%]",children:u.jsx(Jp,{consoleOutputs:h,className:"overflow-auto",stale:!1,cellName:P3,onSubmitDebugger:wn.NOOP,cellId:dr,debuggerActive:!1})})]}),t[12]=p,t[13]=h,t[14]=x,t[15]=A,t[16]=c,t[17]=o,t[18]=n,t[19]=R):R=t[19];const z=R;let D;t[20]!==I||t[21]!==b||t[22]!==g||t[23]!==o?(D=()=>g?u.jsx("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:u.jsx("div",{className:"overflow-auto flex flex-col gap-3",children:b.map((ae,Me)=>u.jsx("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>I(ae),children:u.jsx(T.Suspense,{children:u.jsx(ca,{language:"python",theme:o,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:ae.trim(),editable:!1,readOnly:!0})})},Me))})}):null,t[20]=I,t[21]=b,t[22]=g,t[23]=o,t[24]=D):D=t[24];const F=D;let B,U,O,S,$,j,W,Y,G,q,te;t[25]===Symbol.for("react.memo_cache_sentinel")?(B=Cs.create(dr),U=u.jsx("p",{className:"mx-2 my-2 text-muted-foreground text-sm",children:"Use this scratchpad cell to experiment with code without restrictions on variable names. Scratchpad code is ephemeral: variables defined in the scratchpad aren't saved to notebook memory, and the code is not saved in the notebook file."}),t[25]=B,t[26]=U):(B=t[25],U=t[26]),t[27]===Symbol.for("react.memo_cache_sentinel")?(O=nn("cell.run"),t[27]=O):O=t[27],t[28]===Symbol.for("react.memo_cache_sentinel")?(S=u.jsx(Hs,{color:"var(--grass-11)",size:16}),t[28]=S):S=t[28],t[29]!==x||t[30]!==g?($=u.jsx(Ae,{content:O,children:u.jsx(Te,{"data-testid":"scratchpad-run-button",onClick:x,disabled:g,variant:"text",size:"xs",children:S})}),t[29]=x,t[30]=g,t[31]=$):$=t[31],t[32]===Symbol.for("react.memo_cache_sentinel")?(j=u.jsx(cm,{size:16}),t[32]=j):j=t[32],t[33]!==E||t[34]!==g?(W=u.jsx(Ae,{content:"Clear code and outputs",children:u.jsx(Te,{disabled:g,size:"xs",variant:"text",onClick:E,children:j})}),t[33]=E,t[34]=g,t[35]=W):W=t[35],t[36]===Symbol.for("react.memo_cache_sentinel")?(Y=u.jsx(Fr,{size:16}),t[36]=Y):Y=t[36],t[37]!==C||t[38]!==g?(G=u.jsx(Ys,{children:u.jsx(Ae,{content:"Insert code",children:u.jsx(Te,{disabled:g,size:"xs",variant:"text",onClick:C,children:Y})})}),t[37]=C,t[38]=g,t[39]=G):G=t[39],t[40]!==d?(q=(d==="running"||d==="queued")&&u.jsx(Vn,{className:"inline",size:"small"}),t[40]=d,t[41]=q):q=t[41],t[42]===Symbol.for("react.memo_cache_sentinel")?(te=u.jsx("div",{className:"flex-1"}),t[42]=te):te=t[42];const re=g&&"bg-[var(--sky-3)] rounded-none";let ie,Z;t[43]!==re?(ie=je(re),t[43]=re,t[44]=ie):ie=t[44],t[45]!==g||t[46]!==m?(Z=()=>m(!g),t[45]=g,t[46]=m,t[47]=Z):Z=t[47];const ee=b.length===0;let ue,me,de,fe,he,Ce,Ee;return t[48]===Symbol.for("react.memo_cache_sentinel")?(ue=u.jsx(gm,{size:16}),t[48]=ue):ue=t[48],t[49]!==ie||t[50]!==Z||t[51]!==ee?(me=u.jsx(Ae,{content:"Toggle history",children:u.jsx(Te,{size:"xs",variant:"text",className:ie,onClick:Z,disabled:ee,children:ue})}),t[49]=ie,t[50]=Z,t[51]=ee,t[52]=me):me=t[52],t[53]!==$||t[54]!==W||t[55]!==G||t[56]!==q||t[57]!==me?(de=u.jsxs("div",{className:"flex items-center flex-shrink-0",children:[$,W,G,q,te,me]}),t[53]=$,t[54]=W,t[55]=G,t[56]=q,t[57]=me,t[58]=de):de=t[58],t[59]!==z?(fe=z(),t[59]=z,t[60]=fe):fe=t[60],t[61]!==F?(he=F(),t[61]=F,t[62]=he):he=t[62],t[63]!==fe||t[64]!==he?(Ce=u.jsxs("div",{className:"flex-1 divide-y relative overflow-hidden flex flex-col",children:[fe,he]}),t[63]=fe,t[64]=he,t[65]=Ce):Ce=t[65],t[66]!==de||t[67]!==Ce?(Ee=u.jsxs("div",{className:"flex flex-col h-full overflow-hidden divide-y",id:B,children:[U,de,Ce]}),t[66]=de,t[67]=Ce,t[68]=Ee):Ee=t[68],Ee},gF=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx(mF,{}),t[0]=e):e=t[0],e},_F=()=>{const t=X.c(23),{openModal:e,closeModal:n}=Fn();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const{data:r,isPending:s,error:i,refetch:a}=zn(yF,o);if(s){let b;return t[1]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(Vn,{size:"medium",centered:!0}),t[1]=b):b=t[1],b}if(i){let b;return t[2]!==i?(b=u.jsx(Rr,{error:i}),t[2]=i,t[3]=b):b=t[3],b}let l;t[4]!==r?(l=r.filter(xF).map(wF),t[4]=r,t[5]=l):l=t[5];const c=l;if(r.length===0){let b;return t[6]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(gn,{title:"No environment variables",description:"No environment variables are available in this notebook.",icon:u.jsx(Gc,{})}),t[6]=b):b=t[6],b}let d,h,f,p,_,g,m;return t[7]!==n||t[8]!==e||t[9]!==c||t[10]!==a?(d=()=>e(u.jsx(_g,{providerNames:c,onSuccess:()=>{a(),n()},onClose:n})),t[7]=n,t[8]=e,t[9]=c,t[10]=a,t[11]=d):d=t[11],t[12]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(ar,{className:"h-4 w-4"}),t[12]=h):h=t[12],t[13]!==d?(f=u.jsx("div",{className:"flex justify-end h-8 border-b",children:u.jsx("button",{type:"button",className:"float-right border-l px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:d,children:h})}),t[13]=d,t[14]=f):f=t[14],t[15]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx(Vp,{children:u.jsxs(Vs,{children:[u.jsx(Pr,{children:"Environment Variable"}),u.jsx(Pr,{children:"Source"}),u.jsx(Pr,{})]})}),t[15]=p):p=t[15],t[16]!==r?(_=r.map(vF),t[16]=r,t[17]=_):_=t[17],t[18]!==_?(g=u.jsxs($p,{className:"overflow-auto flex-1 mb-16",children:[p,u.jsx(Hp,{children:_})]}),t[18]=_,t[19]=g):g=t[19],t[20]!==f||t[21]!==g?(m=u.jsxs("div",{className:"flex flex-col h-full",children:[f,g]}),t[20]=f,t[21]=g,t[22]=m):m=t[22],m},bF=t=>{const e=X.c(9),{className:n,ariaLabel:o,onCopy:r}=t,[s,i]=K.useState(!1);let a;e[0]!==r?(a=()=>{r(),i(!0),setTimeout(()=>i(!1),1e3)},e[0]=r,e[1]=a):a=e[1];const l=a;let c,d;return e[2]!==s?(c=s?u.jsx(dc,{className:"w-3 h-3 text-green-700 rounded"}):u.jsx($i,{className:"w-3 h-3 hover:bg-muted rounded"}),e[2]=s,e[3]=c):c=e[3],e[4]!==o||e[5]!==n||e[6]!==l||e[7]!==c?(d=u.jsx("button",{type:"button",className:n,onClick:l,"aria-label":o,children:c}),e[4]=o,e[5]=n,e[6]=l,e[7]=c,e[8]=d):d=e[8],d};async function yF(){return gg((await ES.request({})).secrets)}function xF(t){return t.provider!=="env"}function wF(t){return t.name}function vF(t){return t.keys.map(e=>u.jsxs(Vs,{className:"group",children:[u.jsx(Lr,{children:e}),u.jsx(Lr,{children:t.provider!=="env"&&u.jsx(Q4,{variant:"outline",className:"select-none",children:t.name})}),u.jsx(Lr,{children:u.jsx(bF,{ariaLabel:`Copy ${e}`,onCopy:async()=>{await pn(`os.environ["${e}"]`),ut({title:"Copied to clipboard",description:`os.environ["${e}"] has been copied to your clipboard.`})},className:je("float-right px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible")})})]},`${t.name}-${e}`))}const kF=t=>{const e=X.c(6),{children:n}=t,{openModal:o,closeModal:r}=Fn();let s,i;return e[0]!==r||e[1]!==o?(s=()=>o(u.jsx(CF,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(i=u.jsx(K4,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=i):i=e[5],i},SF=[tt.lineWrapping],CF=t=>{const e=X.c(23),{onClose:n}=t,[o,r]=T.useState(""),{theme:s}=lr();let i,a,l,c,d,h;e[0]!==n?(i=async x=>{x.preventDefault();const v=new FormData(x.target),C=v.get("title"),k=v.get("description"),E=v.get("code");fetch("https://marimo.io/api/suggest-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:C,description:k,code:E})}),n(),ut({title:"Snippet Submitted",description:"Thank you for contributing! We will review your snippet shortly."})},e[0]=n,e[1]=i):i=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx(er,{children:"Contribute a Snippet"}),e[2]=a):a=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsxs(ks,{children:[a,u.jsxs(Ss,{children:["Have a useful snippet you want to share with the community? Submit it here or make a pull request"," ",u.jsx("a",{href:Yn.githubPage,target:"_blank",className:"underline",children:"on GitHub"}),"."]})]}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(tr,{id:"title",name:"title",autoFocus:!0,placeholder:"Title",required:!0,autoComplete:"off"}),d=u.jsx(q$,{id:"description",name:"description",autoFocus:!0,placeholder:"Description",rows:5,required:!0,autoComplete:"off"}),e[4]=c,e[5]=d):(c=e[4],d=e[5]),e[6]!==o?(h=u.jsx("input",{type:"hidden",name:"code",value:o}),e[6]=o,e[7]=h):h=e[7];const f=s==="dark"?"dark":"light";let p,_,g,m,b,y;return e[8]!==o||e[9]!==f?(p=u.jsx(ca,{theme:f,language:"python",className:"cm border rounded overflow-hidden",extensions:SF,value:o,onChange:r}),e[8]=o,e[9]=f,e[10]=p):p=e[10],e[11]!==h||e[12]!==p?(_=u.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[c,d,h,p]}),e[11]=h,e[12]=p,e[13]=_):_=e[13],e[14]!==n?(g=u.jsx(Te,{"data-testid":"snippet-cancel-button",variant:"secondary",onClick:n,children:"Cancel"}),e[14]=n,e[15]=g):g=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(m=u.jsx(Te,{"data-testid":"snippet-send-button","aria-label":"Save",variant:"default",type:"submit",children:"Send"}),e[16]=m):m=e[16],e[17]!==g?(b=u.jsxs(Vi,{children:[g,m]}),e[17]=g,e[18]=b):b=e[18],e[19]!==i||e[20]!==b||e[21]!==_?(y=u.jsx(nr,{className:"w-fit",children:u.jsxs("form",{onSubmit:i,children:[l,_,b]})}),e[19]=i,e[20]=b,e[21]=_,e[22]=y):y=e[22],y},NF=[tt.lineWrapping],jF=()=>{const t=X.c(20),[e,n]=K.useState();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const{data:r,error:s,isPending:i}=zn(AF,o);if(s){let b;return t[1]!==s?(b=u.jsx(Rr,{error:s}),t[1]=s,t[2]=b):b=t[2],b}if(i||!r){let b;return t[3]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(Vn,{size:"medium",centered:!0}),t[3]=b):b=t[3],b}const a=e?"h-1/3":"h-full";let l,c,d,h,f,p,_,g,m;return t[4]!==a?(l=je("border-b rounded-none",a),t[4]=a,t[5]=l):l=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(Gi,{placeholder:"Search snippets...",className:"h-6 m-1",rootClassName:"flex-1 border-r"}),t[6]=c):c=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsxs("div",{className:"flex items-center w-full",children:[c,u.jsx(kF,{children:u.jsx("button",{className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:u.jsx(ar,{className:"h-4 w-4"})})})]}),h=u.jsx(tc,{children:"No results"}),t[7]=d,t[8]=h):(d=t[7],h=t[8]),t[9]===Symbol.for("react.memo_cache_sentinel")?(f=b=>n(b),t[9]=f):f=t[9],t[10]!==r.snippets?(p=u.jsx(IF,{onSelect:f,snippets:r.snippets}),t[10]=r.snippets,t[11]=p):p=t[11],t[12]!==l||t[13]!==p?(_=u.jsxs(fc,{className:l,children:[d,h,p]}),t[12]=l,t[13]=p,t[14]=_):_=t[14],t[15]!==e?(g=u.jsx(T.Suspense,{children:u.jsx("div",{className:"h-2/3 snippet-viewer flex flex-col",children:e?u.jsx(EF,{snippet:e},e.title):u.jsx(gn,{title:"",description:"Click on a snippet to view its content."})})}),t[15]=e,t[16]=g):g=t[16],t[17]!==_||t[18]!==g?(m=u.jsxs("div",{className:"flex-1 overflow-hidden",children:[_,g]}),t[17]=_,t[18]=g,t[19]=m):m=t[19],m},EF=t=>{const e=X.c(27),{snippet:n}=t,{theme:o}=lr(),{createNewCell:r}=kt(),s=Or();let i;e[0]!==r||e[1]!==s||e[2]!==n.sections?(i=()=>{for(const m of[...n.sections].reverse())m.code&&r({code:m.code,before:!1,cellId:s??"__end__",skipIfCodeExists:!0})},e[0]=r,e[1]=s,e[2]=n.sections,e[3]=i):i=e[3];const a=i;let l;e[4]!==r||e[5]!==s?(l=m=>{r({code:m,before:!1,cellId:s??"__end__"})},e[4]=r,e[5]=s,e[6]=l):l=e[6];const c=l;let d,h,f,p,_,g;if(e[7]!==n.title?(d=u.jsx("div",{className:"text-sm font-semibold bg-muted border-y px-2 py-1",children:n.title}),e[7]=n.title,e[8]=d):d=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(Fr,{className:"ml-2 h-4 w-4"}),e[9]=h):h=e[9],e[10]!==a?(f=u.jsx("div",{className:"flex justify-end",children:u.jsx(Ys,{children:u.jsxs(Te,{className:"float-right",size:"xs",variant:"outline",onClick:a,children:["Insert snippet",h]})})}),e[10]=a,e[11]=f):f=e[11],e[12]!==c||e[13]!==n.sections||e[14]!==n.title||e[15]!==o){let m;e[17]!==c||e[18]!==n.title||e[19]!==o?(m=b=>{const{code:y,html:x,id:v}=b;return x?u.jsx("div",{children:Fp({html:x})},`${n.title}-${v}`):y?u.jsxs("div",{className:"relative hover-actions-parent pr-2",children:[u.jsx(Ys,{children:u.jsx(Ae,{content:"Insert snippet",children:u.jsx(Te,{className:"absolute -top-2 -right-1 z-10 hover-action px-2 bg-background",size:"sm",variant:"outline",onClick:()=>{c(y)},children:u.jsx(Fr,{className:"h-5 w-5"})})})}),u.jsx(T.Suspense,{children:u.jsx(ca,{theme:o==="dark"?"dark":"light",language:"python",className:"cm border rounded overflow-hidden",extensions:NF,value:y,readOnly:!0},`${n.title}-${v}`)})]},`${n.title}-${v}`):null},e[17]=c,e[18]=n.title,e[19]=o,e[20]=m):m=e[20],p=n.sections.map(m),e[12]=c,e[13]=n.sections,e[14]=n.title,e[15]=o,e[16]=p}else p=e[16];return e[21]!==f||e[22]!==p?(_=u.jsxs("div",{className:"px-2 py-2 space-y-4 overflow-auto flex-1",children:[f,p]}),e[21]=f,e[22]=p,e[23]=_):_=e[23],e[24]!==d||e[25]!==_?(g=u.jsxs(u.Fragment,{children:[d,_]}),e[24]=d,e[25]=_,e[26]=g):g=e[26],g},IF=t=>{const e=X.c(7),{snippets:n,onSelect:o}=t;let r,s;if(e[0]!==o||e[1]!==n){let i;e[3]!==o?(i=a=>u.jsx(lo,{className:"rounded-none",onSelect:()=>o(a),children:u.jsx("div",{className:"flex flex-row gap-2 items-center",children:u.jsx("span",{className:"mt-1 text-accent-foreground",children:a.title})})},a.title),e[3]=o,e[4]=i):i=e[4],r=n.map(i),e[0]=o,e[1]=n,e[2]=r}else r=e[2];return e[5]!==r?(s=u.jsx(Np,{className:"flex flex-col overflow-auto",children:r}),e[5]=r,e[6]=s):s=e[6],s};function AF(){return G$()}const TF=K.lazy(()=>jp(()=>import("./tracing-DWbu8K8J.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122]),import.meta.url).then(t=>({default:t.Tracing}))),MF=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx(K.Suspense,{fallback:u.jsx(OF,{}),children:u.jsx(TF,{})}),t[0]=e):e=t[0],e},OF=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:u.jsx(Vn,{})}),t[0]=e):e=t[0],e},_3="name",b3="type-value",Gf="defs-refs",DF=[{id:_3,accessorFn:t=>[t.name,t.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>u.jsx(Wp,{header:"Name",column:t}),cell:({getValue:t})=>{const[e,n]=t();return u.jsx(rf,{name:e,declaredBy:n})}},{id:b3,accessorFn:t=>[t.dataType,t.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>u.jsx(Wp,{header:u.jsxs("div",{className:"flex flex-col gap-1",children:[u.jsx("span",{children:"Type"}),u.jsx("span",{children:"Value"})]}),column:t}),cell:({getValue:t})=>{const[e,n]=t();return u.jsxs("div",{className:"max-w-[150px]",children:[u.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs",children:e}),u.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap",title:n??"",children:n})]})}},{id:Gf,accessorFn:t=>[t.declaredBy,t.usedBy,t.name,t.declaredByNames,t.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:t})=>u.jsx(Wp,{header:u.jsxs("div",{className:"flex flex-col gap-1",children:[u.jsx("span",{children:"Declared By"}),u.jsx("span",{children:"Used By"})]}),column:t}),cell:({getValue:t})=>{const[e,n,o]=t(),r=s=>{const i=Kl(s);i&&zp(i,o)};return u.jsxs("div",{className:"flex flex-col gap-1 py-1",children:[u.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-center",children:[u.jsx("span",{title:"Declared by",children:u.jsx(Pm,{className:"w-3.5 h-3.5 text-muted-foreground"})}),e.length===1?u.jsx(cr,{variant:"focus",cellId:e[0],skipScroll:!0,onClick:()=>r(e[0])}):u.jsx("div",{className:"text-destructive flex flex-row gap-2",children:e.slice(0,3).map((s,i)=>u.jsxs("span",{className:"flex",children:[u.jsx(cr,{variant:"focus",cellId:s,skipScroll:!0,className:"whitespace-nowrap text-destructive",onClick:()=>r(s)},s),i<e.length-1&&", "]},s))})]}),u.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-baseline",children:[u.jsx("span",{title:"Used by",children:u.jsx(ya,{className:"w-3.5 h-3.5 text-muted-foreground"})}),u.jsx(B2,{maxCount:3,cellIds:n,skipScroll:!0,onClick:r})]})]})}}],y3=T.memo(({className:t,cellIds:e,variables:n})=>{const[o,r]=K.useState([]),[s,i]=K.useState(""),a=Y$(),l=T.useMemo(()=>{const h=f=>{const p=a[f];return Q$(p)?`cell-${e.indexOf(f)}`:p??`cell-${e.indexOf(f)}`};return Object.values(n).map(f=>({...f,declaredByNames:f.declaredBy.map(h),usedByNames:f.usedBy.map(h)}))},[n,a,e]),c=T.useMemo(()=>{const h=new Map;return e.forEach((f,p)=>h.set(f,p)),function(f,p,_){p||(p={id:Gf,desc:!1});let g=[];switch(p.id){case _3:g=ha(f,m=>m.name);break;case b3:g=ha(f,m=>m.dataType);break;case Gf:g=ha(f,m=>_.get(m.declaredBy[0]))}return p.desc?g.reverse():g}(l,o[0],h)},[l,o,e]),d=J$({data:c,columns:DF,getCoreRowModel:Z$(),onGlobalFilterChange:i,getFilteredRowModel:X$(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter:h=>h.columnDef.enableGlobalFilter??!0,globalFilterFn:"auto",manualSorting:!0,onSortingChange:r,getSortedRowModel:K$(),state:{sorting:o,globalFilter:s}});return u.jsxs(u.Fragment,{children:[u.jsx(fS,{className:"w-full",placeholder:"Search",value:s,onChange:h=>i(h.target.value)}),u.jsxs($p,{className:je("w-full text-sm flex-1 border-separate border-spacing-0",t),children:[u.jsx(Vp,{children:u.jsx(Vs,{className:"whitespace-nowrap text-xs",children:d.getFlatHeaders().map(h=>u.jsx(Pr,{className:"sticky top-0 bg-background border-b",children:_S(h.column.columnDef.header,h.getContext())},h.id))})}),u.jsx(Hp,{children:d.getRowModel().rows.map(h=>u.jsx(Vs,{className:"hover:bg-accent",children:h.getVisibleCells().map(f=>u.jsx(Lr,{className:"border-b",children:_S(f.column.columnDef.cell,f.getContext())},f.id))},h.id))})]})]})});y3.displayName="VariableTable";const RF=()=>{const t=X.c(4),e=tS(),n=Rc();if(Object.keys(e).length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(gn,{title:"No variables",description:"Global variables will appear here.",icon:u.jsx(Yl,{})}),t[0]=r):r=t[0],r}let o;return t[1]!==n.inOrderIds||t[2]!==e?(o=u.jsx(y3,{className:"flex-1",cellIds:n.inOrderIds,variables:e}),t[1]=n.inOrderIds,t[2]=e,t[3]=o):o=t[3],o},PF=K.lazy(()=>jp(()=>import("./terminal-CujgA_Fv.js"),__vite__mapDeps([123,1,2,124]),import.meta.url)),LF=t=>{const e=X.c(121),{children:n}=t,{isSidebarOpen:o,isTerminalOpen:r,selectedPanel:s}=cc(),{setIsSidebarOpen:i,setIsTerminalOpen:a}=Ki(),l=K.useRef(null),c=K.useRef(null);let d,h,f,p,_;e[0]!==o?(d=()=>{if(!l.current)return;const le=l.current.isCollapsed();o&&le&&l.current.expand(),o||le||l.current.collapse(),requestAnimationFrame(zF)},h=[o],e[0]=o,e[1]=d,e[2]=h):(d=e[1],h=e[2]),T.useEffect(d,h),e[3]!==r?(f=()=>{if(!c.current)return;const le=c.current.isCollapsed();r&&le&&c.current.expand(),r||le||c.current.collapse(),requestAnimationFrame(UF)},p=[r],e[3]=r,e[4]=f,e[5]=p):(f=e[4],p=e[5]),T.useEffect(f,p),e[6]!==n?(_=u.jsx(Lc,{id:"app",className:"relative h-full",children:u.jsx(T.Suspense,{children:n})},"app"),e[6]=n,e[7]=_):_=e[7];const g=_,m=o?"resize-handle":"resize-handle-collapsed";let b,y;e[8]!==m?(b=je("border-border no-print z-10",m,"vertical"),e[8]=m,e[9]=b):b=e[9],e[10]!==b?(y=u.jsx(bS,{onDragging:yS,className:b}),e[10]=b,e[11]=y):y=e[11];const x=y,v=r?"resize-handle":"resize-handle-collapsed";let C,k;e[12]!==v?(C=je("border-border no-print z-20",v,"horizontal"),e[12]=v,e[13]=C):C=e[13],e[14]!==C?(k=u.jsx(bS,{onDragging:yS,className:C}),e[14]=C,e[15]=k):k=e[15];const E=k;let N,I,A,M,R,z,D,F,B,U,O,S,$,j,W,Y,G,q,te,re,ie;e[16]!==s?(N=u.jsx("div",{className:"text-sm text-[var(--slate-11)] uppercase tracking-wide font-semibold flex-1",children:s}),e[16]=s,e[17]=N):N=e[17],e[18]!==i?(I=()=>i(!1),e[18]=i,e[19]=I):I=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(A=u.jsx(Jn,{className:"w-4 h-4"}),e[20]=A):A=e[20],e[21]!==I?(M=u.jsx(Te,{"data-testid":"close-helper-pane",className:"m-0",size:"xs",variant:"text",onClick:I,children:A}),e[21]=I,e[22]=M):M=e[22],e[23]!==N||e[24]!==M?(R=u.jsxs("div",{className:"p-3 border-b flex justify-between items-center",children:[N,M]}),e[23]=N,e[24]=M,e[25]=R):R=e[25],e[26]!==s?(z=s==="files"&&u.jsx(c3,{}),e[26]=s,e[27]=z):z=e[27],e[28]!==s?(D=s==="errors"&&u.jsx(OL,{}),e[28]=s,e[29]=D):D=e[29],e[30]!==s?(F=s==="variables"&&u.jsx(RF,{}),e[30]=s,e[31]=F):F=e[31],e[32]!==s?(B=s==="dependencies"&&u.jsx(bL,{}),e[32]=s,e[33]=B):B=e[33],e[34]!==s?(U=s==="packages"&&u.jsx(sF,{}),e[34]=s,e[35]=U):U=e[35],e[36]!==s?(O=s==="outline"&&u.jsx(rF,{}),e[36]=s,e[37]=O):O=e[37],e[38]!==s?(S=s==="datasources"&&u.jsx(TL,{}),e[38]=s,e[39]=S):S=e[39],e[40]!==s?($=s==="documentation"&&u.jsx(ML,{}),e[40]=s,e[41]=$):$=e[41],e[42]!==s?(j=s==="snippets"&&u.jsx(jF,{}),e[42]=s,e[43]=j):j=e[43],e[44]!==s?(W=s==="scratchpad"&&u.jsx(gF,{}),e[44]=s,e[45]=W):W=e[45],e[46]!==s?(Y=s==="chat"&&u.jsx(UD,{}),e[46]=s,e[47]=Y):Y=e[47],e[48]!==s?(G=s==="logs"&&u.jsx(d3,{}),e[48]=s,e[49]=G):G=e[49],e[50]!==s?(q=s==="tracing"&&u.jsx(MF,{}),e[50]=s,e[51]=q):q=e[51],e[52]!==s?(te=s==="secrets"&&u.jsx(_F,{}),e[52]=s,e[53]=te):te=e[53],e[54]!==z||e[55]!==D||e[56]!==F||e[57]!==B||e[58]!==U||e[59]!==O||e[60]!==S||e[61]!==$||e[62]!==j||e[63]!==W||e[64]!==Y||e[65]!==G||e[66]!==q||e[67]!==te?(re=u.jsx(T.Suspense,{children:u.jsxs(Oc,{children:[z,D,F,B,U,O,S,$,j,W,Y,G,q,te]})}),e[54]=z,e[55]=D,e[56]=F,e[57]=B,e[58]=U,e[59]=O,e[60]=S,e[61]=$,e[62]=j,e[63]=W,e[64]=Y,e[65]=G,e[66]=q,e[67]=te,e[68]=re):re=e[68],e[69]!==R||e[70]!==re?(ie=u.jsx(pc,{children:u.jsxs("div",{className:"flex flex-col h-full flex-1 overflow-hidden mr-[-4px]",children:[R,re]})}),e[69]=R,e[70]=re,e[71]=ie):ie=e[71];const Z=ie,ee=o&&"border-r border-l border-[var(--slate-7)]";let ue,me,de,fe,he,Ce;e[72]!==ee?(ue=je("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",ee),e[72]=ee,e[73]=ue):ue=e[73],e[74]===Symbol.for("react.memo_cache_sentinel")?(me=(le,He)=>{var Fe;He===0&&le===10&&((Fe=l.current)==null||Fe.resize(30))},e[74]=me):me=e[74],e[75]!==i?(de=()=>i(!1),fe=()=>i(!0),e[75]=i,e[76]=de,e[77]=fe):(de=e[76],fe=e[77]),e[78]!==Z||e[79]!==x?(he=u.jsxs("span",{className:"flex flex-row h-full",children:[Z," ",x]}),e[78]=Z,e[79]=x,e[80]=he):he=e[80],e[81]!==ue||e[82]!==de||e[83]!==fe||e[84]!==he?(Ce=u.jsx(Lc,{ref:l,id:"helper",collapsedSize:0,collapsible:!0,className:ue,minSize:10,defaultSize:0,maxSize:75,onResize:me,onCollapse:de,onExpand:fe,children:he},"helper"),e[81]=ue,e[82]=de,e[83]=fe,e[84]=he,e[85]=Ce):Ce=e[85];const Ee=Ce,ae=r&&"border-[var(--slate-7)]";let Me,xe,Re,Ue,Je,Ke,Pe,st,et;e[86]!==ae?(Me=je("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",ae),e[86]=ae,e[87]=Me):Me=e[87],e[88]===Symbol.for("react.memo_cache_sentinel")?(xe=(le,He)=>{var Fe;He===0&&le===10&&((Fe=c.current)==null||Fe.resize(30))},e[88]=xe):xe=e[88],e[89]!==a?(Re=()=>a(!1),Ue=()=>a(!0),e[89]=a,e[90]=Re,e[91]=Ue):(Re=e[90],Ue=e[91]),e[92]===Symbol.for("react.memo_cache_sentinel")?(Je=u.jsx("div",{}),e[92]=Je):Je=e[92],e[93]!==a?(Ke=()=>a(!1),e[93]=a,e[94]=Ke):Ke=e[94],e[95]!==r||e[96]!==Ke?(Pe=u.jsx(T.Suspense,{fallback:Je,children:u.jsx(PF,{visible:r,onClose:Ke})}),e[95]=r,e[96]=Ke,e[97]=Pe):Pe=e[97],e[98]!==r||e[99]!==Pe?(st=u.jsx(yL,{isOpen:r,children:Pe}),e[98]=r,e[99]=Pe,e[100]=st):st=e[100],e[101]!==Me||e[102]!==Re||e[103]!==Ue||e[104]!==st||e[105]!==E?(et=u.jsxs(Lc,{ref:c,id:"terminal",collapsedSize:0,collapsible:!0,className:Me,minSize:10,defaultSize:0,maxSize:75,onResize:xe,onCollapse:Re,onExpand:Ue,children:[E,st]},"terminal"),e[101]=Me,e[102]=Re,e[103]=Ue,e[104]=st,e[105]=E,e[106]=et):et=e[106];const nt=et;let ne,ve,Se,De,J,ge,_e,pe;return e[107]===Symbol.for("react.memo_cache_sentinel")?(ne=HH(),e[107]=ne):ne=e[107],e[108]===Symbol.for("react.memo_cache_sentinel")?(ve=u.jsx(Oc,{children:u.jsx(kO,{})}),e[108]=ve):ve=e[108],e[109]!==nt?(Se=u.jsx(Ox,{capability:"terminal",children:nt}),e[109]=nt,e[110]=Se):Se=e[110],e[111]!==g||e[112]!==Se?(De=u.jsx(Lc,{children:u.jsxs(xS,{autoSaveId:"marimo:chrome:v1:l1",direction:"vertical",children:[g,Se]})}),e[111]=g,e[112]=Se,e[113]=De):De=e[113],e[114]===Symbol.for("react.memo_cache_sentinel")?(J=u.jsx(eH,{}),e[114]=J):J=e[114],e[115]!==Ee||e[116]!==De?(ge=u.jsxs(xS,{autoSaveId:"marimo:chrome:v1:l2",direction:"horizontal",storage:ne,children:[ve,Ee,De,J]}),e[115]=Ee,e[116]=De,e[117]=ge):ge=e[117],e[118]===Symbol.for("react.memo_cache_sentinel")?(_e=u.jsx(pc,{children:u.jsx(Oc,{children:u.jsx(bO,{})})}),e[118]=_e):_e=e[118],e[119]!==ge?(pe=u.jsxs(WH,{children:[ge,_e]}),e[119]=ge,e[120]=pe):pe=e[120],pe};function FF(){window.dispatchEvent(new Event("resize"))}function zF(){requestAnimationFrame(FF)}function BF(){window.dispatchEvent(new Event("resize"))}function UF(){requestAnimationFrame(BF)}let x3;x3=new URL(window.location.href).searchParams.get(tH.showChrome)==="false",FS=Object.freeze(Object.defineProperty({__proto__:null,default:t=>{const e=X.c(10);if(x3){let s,i,a;return e[0]!==t?(s=u.jsx(Mx,{hideControls:!0,...t}),e[0]=t,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx(Km,{}),e[2]=i):i=e[2],e[3]!==s?(a=u.jsxs(u.Fragment,{children:[s,i]}),e[3]=s,e[4]=a):a=e[4],a}let n,o,r;return e[5]!==t?(n=u.jsx(Mx,{...t}),e[5]=t,e[6]=n):n=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(Km,{}),e[7]=o):o=e[7],e[8]!==n?(r=u.jsxs(LF,{children:[n,o]}),e[8]=n,e[9]=r):r=e[9],r}},Symbol.toStringTag,{value:"Module"}))});export{Zp as C,Bc as E,gn as P,JH as __tla,Uc as a,FS as e,fa as f,Qp as u};
|